From: support Date: Tue, 21 Feb 2023 17:15:13 +0000 (+0000) Subject: Built motion from commit 53172ac8.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/%7B%7Bhash%7D%7D/%22?a=commitdiff_plain;h=20ea4bb33c0909cc3a955887906a2e373a83fce1;p=motion2.git Built motion from commit 53172ac8.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f8bc186..a1a545f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-21T10:09:44.092Z", + "time": "2023-02-21T17:07:06.975Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 362387d..a6c8722 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-21T10:09:44.092Z", + "time": "2023-02-21T17:07:06.975Z", "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 c08bba1..bb8fc4d 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 _0x2888=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x83a0b2,_0x5a3aee){var _0x3fa21a=function(_0x5c2515){while(--_0x5c2515){_0x83a0b2['push'](_0x83a0b2['shift']());}};_0x3fa21a(++_0x5a3aee);}(_0x2888,0x102));var _0x8288=function(_0x491a09,_0x91cd3c){_0x491a09=_0x491a09-0x0;var _0x27956c=_0x2888[_0x491a09];return _0x27956c;};'use strict';var Sequelize=require(_0x8288('0x0'));module[_0x8288('0x1')]={'name':{'type':Sequelize[_0x8288('0x2')],'get':function(_0x190f2b){return this[_0x8288('0x3')]('action');}},'action':{'type':Sequelize[_0x8288('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8288('0x5'),_0x8288('0x6'),_0x8288('0x7'),_0x8288('0x8'),'urlForward',_0x8288('0x9'),'bot',_0x8288('0xa')]],'msg':_0x8288('0xb')}},'comment':_0x8288('0xb')},'data1':{'type':Sequelize[_0x8288('0x4')](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['STRING'](0x1000),'comment':_0x8288('0xc')},'data3':{'type':Sequelize[_0x8288('0x4')](0x1000),'comment':_0x8288('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x8288('0x4')](0x1000),'comments':_0x8288('0xe')},'data6':{'type':Sequelize[_0x8288('0x4')],'comments':_0x8288('0xf')},'data7':{'type':Sequelize[_0x8288('0x10')],'comments':_0x8288('0x11')}}; \ No newline at end of file +var _0xbaad=['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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x1698dc,_0x36e1c5){var _0x296f21=function(_0x467603){while(--_0x467603){_0x1698dc['push'](_0x1698dc['shift']());}};_0x296f21(++_0x36e1c5);}(_0xbaad,0x1e6));var _0xdbaa=function(_0x1d2cab,_0xafde3){_0x1d2cab=_0x1d2cab-0x0;var _0x4861d2=_0xbaad[_0x1d2cab];return _0x4861d2;};'use strict';var Sequelize=require(_0xdbaa('0x0'));module[_0xdbaa('0x1')]={'name':{'type':Sequelize[_0xdbaa('0x2')],'get':function(_0x36b71c){return this[_0xdbaa('0x3')](_0xdbaa('0x4'));}},'action':{'type':Sequelize[_0xdbaa('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdbaa('0x6'),_0xdbaa('0x7'),_0xdbaa('0x8'),_0xdbaa('0x9'),_0xdbaa('0xa'),_0xdbaa('0xb'),_0xdbaa('0xc'),_0xdbaa('0xd')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xdbaa('0xe')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xdbaa('0xf')},'data2':{'type':Sequelize[_0xdbaa('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xdbaa('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[_0xdbaa('0x5')](0x1000),'comments':_0xdbaa('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xdbaa('0x11')},'data6':{'type':Sequelize[_0xdbaa('0x5')],'comments':_0xdbaa('0x12')},'data7':{'type':Sequelize['TEXT'],'comments':_0xdbaa('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d869514..a04b653 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 _0xb98e=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','update','body','Action','find','params','catch'];(function(_0x14335a,_0x34e57b){var _0x270a3b=function(_0x455913){while(--_0x455913){_0x14335a['push'](_0x14335a['shift']());}};_0x270a3b(++_0x34e57b);}(_0xb98e,0x188));var _0xeb98=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xb98e[_0x249e96];return _0x17444c;};'use strict';var emlformat=require(_0xeb98('0x0'));var rimraf=require(_0xeb98('0x1'));var zipdir=require(_0xeb98('0x2'));var jsonpatch=require(_0xeb98('0x3'));var rp=require(_0xeb98('0x4'));var moment=require(_0xeb98('0x5'));var BPromise=require(_0xeb98('0x6'));var Mustache=require(_0xeb98('0x7'));var util=require(_0xeb98('0x8'));var path=require(_0xeb98('0x9'));var sox=require(_0xeb98('0xa'));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(_0xeb98('0xb'));var crypto=require(_0xeb98('0xc'));var jsforce=require(_0xeb98('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeb98('0xe'));var querystring=require('querystring');var Papa=require(_0xeb98('0xf'));var Redis=require(_0xeb98('0x10'));var authService=require(_0xeb98('0x11'));var qs=require(_0xeb98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb98('0x13'));var logger=require(_0xeb98('0x14'))(_0xeb98('0x15'));var utils=require(_0xeb98('0x16'));var config=require(_0xeb98('0x17'));var licenseUtil=require(_0xeb98('0x18'));var db=require(_0xeb98('0x19'))['db'];function respondWithStatusCode(_0x76bddf,_0x2acfc9){_0x2acfc9=_0x2acfc9||0xcc;return function(_0x38593b){if(_0x38593b){return _0x76bddf[_0xeb98('0x1a')](_0x2acfc9);}return _0x76bddf[_0xeb98('0x1b')](_0x2acfc9)[_0xeb98('0x1c')]();};}function respondWithResult(_0x451e01,_0x5462d4){_0x5462d4=_0x5462d4||0xc8;return function(_0x1522b5){if(_0x1522b5){return _0x451e01['status'](_0x5462d4)[_0xeb98('0x1d')](_0x1522b5);}};}function respondWithFilteredResult(_0x2ac353,_0x5c8cc5){return function(_0x4e2bf6){if(_0x4e2bf6){var _0x3dc623=typeof _0x5c8cc5['offset']===_0xeb98('0x1e')&&typeof _0x5c8cc5[_0xeb98('0x1f')]===_0xeb98('0x1e');var _0x13d7c7=_0x4e2bf6[_0xeb98('0x20')];var _0x15442c=_0x3dc623?0x0:_0x5c8cc5['offset'];var _0x2a5e7f=_0x3dc623?_0x4e2bf6['count']:_0x5c8cc5['offset']+_0x5c8cc5['limit'];var _0x3d3ff5;if(_0x2a5e7f>=_0x13d7c7){_0x2a5e7f=_0x13d7c7;_0x3d3ff5=0xc8;}else{_0x3d3ff5=0xce;}_0x2ac353[_0xeb98('0x1b')](_0x3d3ff5);return _0x2ac353[_0xeb98('0x21')]('Content-Range',_0x15442c+'-'+_0x2a5e7f+'/'+_0x13d7c7)[_0xeb98('0x1d')](_0x4e2bf6);}return null;};}function patchUpdates(_0x31335d){return function(_0x30c233){try{jsonpatch[_0xeb98('0x22')](_0x30c233,_0x31335d,!![]);}catch(_0x231870){return BPromise[_0xeb98('0x23')](_0x231870);}return _0x30c233[_0xeb98('0x24')]();};}function saveUpdates(_0x1edba5,_0x3343f5){return function(_0x2415ca){if(_0x2415ca){return _0x2415ca['update'](_0x1edba5)[_0xeb98('0x25')](function(_0xc94a45){return _0xc94a45;});}return null;};}function removeEntity(_0x5a2532,_0x4c713e){return function(_0x1f9ace){if(_0x1f9ace){return _0x1f9ace[_0xeb98('0x26')]()[_0xeb98('0x25')](function(){_0x5a2532[_0xeb98('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30b70a,_0x4f0699){return function(_0x567330){if(!_0x567330){_0x30b70a[_0xeb98('0x1a')](0x194);}return _0x567330;};}function handleError(_0x1c77b1,_0x568c2d){_0x568c2d=_0x568c2d||0x1f4;return function(_0x4647b7){logger[_0xeb98('0x27')](_0x4647b7[_0xeb98('0x28')]);if(_0x4647b7[_0xeb98('0x29')]){delete _0x4647b7[_0xeb98('0x29')];}_0x1c77b1[_0xeb98('0x1b')](_0x568c2d)[_0xeb98('0x2a')](_0x4647b7);};}exports[_0xeb98('0x2b')]=function(_0x1cd94e,_0x35a86d){if(_0x1cd94e['body']['id']){delete _0x1cd94e[_0xeb98('0x2c')]['id'];}return db[_0xeb98('0x2d')][_0xeb98('0x2e')]({'where':{'id':_0x1cd94e[_0xeb98('0x2f')]['id']}})[_0xeb98('0x25')](handleEntityNotFound(_0x35a86d,null))['then'](saveUpdates(_0x1cd94e[_0xeb98('0x2c')],null))[_0xeb98('0x25')](respondWithResult(_0x35a86d,null))[_0xeb98('0x30')](handleError(_0x35a86d,null));};exports[_0xeb98('0x26')]=function(_0x5b327b,_0x133b49){return db['Action'][_0xeb98('0x2e')]({'where':{'id':_0x5b327b[_0xeb98('0x2f')]['id']}})[_0xeb98('0x25')](handleEntityNotFound(_0x133b49,null))[_0xeb98('0x25')](removeEntity(_0x133b49,null))[_0xeb98('0x30')](handleError(_0x133b49,null));}; \ No newline at end of file +var _0xb722=['count','offset','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','body','find','params','Action','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x2ce4ad,_0x1375c5){var _0xba860f=function(_0x17c1ab){while(--_0x17c1ab){_0x2ce4ad['push'](_0x2ce4ad['shift']());}};_0xba860f(++_0x1375c5);}(_0xb722,0x1a1));var _0x2b72=function(_0x4bc54d,_0x118086){_0x4bc54d=_0x4bc54d-0x0;var _0x5cb698=_0xb722[_0x4bc54d];return _0x5cb698;};'use strict';var emlformat=require(_0x2b72('0x0'));var rimraf=require(_0x2b72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b72('0x2'));var rp=require(_0x2b72('0x3'));var moment=require(_0x2b72('0x4'));var BPromise=require(_0x2b72('0x5'));var Mustache=require(_0x2b72('0x6'));var util=require(_0x2b72('0x7'));var path=require(_0x2b72('0x8'));var sox=require(_0x2b72('0x9'));var csv=require('to-csv');var ejs=require(_0x2b72('0xa'));var fs=require('fs');var fs_extra=require(_0x2b72('0xb'));var _=require('lodash');var squel=require(_0x2b72('0xc'));var crypto=require(_0x2b72('0xd'));var jsforce=require(_0x2b72('0xe'));var deskjs=require(_0x2b72('0xf'));var toCsv=require(_0x2b72('0x10'));var querystring=require(_0x2b72('0x11'));var Papa=require(_0x2b72('0x12'));var Redis=require(_0x2b72('0x13'));var authService=require(_0x2b72('0x14'));var qs=require(_0x2b72('0x15'));var as=require(_0x2b72('0x16'));var hardwareService=require(_0x2b72('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2b72('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2b72('0x19'));var db=require(_0x2b72('0x1a'))['db'];function respondWithStatusCode(_0x41a607,_0x5d8ec4){_0x5d8ec4=_0x5d8ec4||0xcc;return function(_0x3baeda){if(_0x3baeda){return _0x41a607[_0x2b72('0x1b')](_0x5d8ec4);}return _0x41a607[_0x2b72('0x1c')](_0x5d8ec4)[_0x2b72('0x1d')]();};}function respondWithResult(_0xc3122b,_0x38f61c){_0x38f61c=_0x38f61c||0xc8;return function(_0x582e29){if(_0x582e29){return _0xc3122b[_0x2b72('0x1c')](_0x38f61c)[_0x2b72('0x1e')](_0x582e29);}};}function respondWithFilteredResult(_0x2eb91c,_0x5bdaf6){return function(_0xb4afb){if(_0xb4afb){var _0x7737=typeof _0x5bdaf6['offset']===_0x2b72('0x1f')&&typeof _0x5bdaf6[_0x2b72('0x20')]==='undefined';var _0x32ac10=_0xb4afb[_0x2b72('0x21')];var _0x16005b=_0x7737?0x0:_0x5bdaf6[_0x2b72('0x22')];var _0x55c228=_0x7737?_0xb4afb[_0x2b72('0x21')]:_0x5bdaf6[_0x2b72('0x22')]+_0x5bdaf6[_0x2b72('0x20')];var _0x456a11;if(_0x55c228>=_0x32ac10){_0x55c228=_0x32ac10;_0x456a11=0xc8;}else{_0x456a11=0xce;}_0x2eb91c[_0x2b72('0x1c')](_0x456a11);return _0x2eb91c['set'](_0x2b72('0x23'),_0x16005b+'-'+_0x55c228+'/'+_0x32ac10)[_0x2b72('0x1e')](_0xb4afb);}return null;};}function patchUpdates(_0x601939){return function(_0x497331){try{jsonpatch[_0x2b72('0x24')](_0x497331,_0x601939,!![]);}catch(_0x5aef45){return BPromise[_0x2b72('0x25')](_0x5aef45);}return _0x497331['save']();};}function saveUpdates(_0x2355c0,_0x1920e4){return function(_0x2594ff){if(_0x2594ff){return _0x2594ff[_0x2b72('0x26')](_0x2355c0)['then'](function(_0x4a7e55){return _0x4a7e55;});}return null;};}function removeEntity(_0x47feb9,_0x45b6b2){return function(_0x3b8d7b){if(_0x3b8d7b){return _0x3b8d7b[_0x2b72('0x27')]()[_0x2b72('0x28')](function(){_0x47feb9[_0x2b72('0x1c')](0xcc)[_0x2b72('0x1d')]();});}};}function handleEntityNotFound(_0x118797,_0x2f8b6d){return function(_0x5bc0ec){if(!_0x5bc0ec){_0x118797[_0x2b72('0x1b')](0x194);}return _0x5bc0ec;};}function handleError(_0x3de6fb,_0x4e75f2){_0x4e75f2=_0x4e75f2||0x1f4;return function(_0x35feb5){logger[_0x2b72('0x29')](_0x35feb5[_0x2b72('0x2a')]);if(_0x35feb5['name']){delete _0x35feb5[_0x2b72('0x2b')];}_0x3de6fb['status'](_0x4e75f2)[_0x2b72('0x2c')](_0x35feb5);};}exports['update']=function(_0x14d697,_0x9e8d3c){if(_0x14d697[_0x2b72('0x2d')]['id']){delete _0x14d697[_0x2b72('0x2d')]['id'];}return db['Action'][_0x2b72('0x2e')]({'where':{'id':_0x14d697[_0x2b72('0x2f')]['id']}})[_0x2b72('0x28')](handleEntityNotFound(_0x9e8d3c,null))[_0x2b72('0x28')](saveUpdates(_0x14d697['body'],null))[_0x2b72('0x28')](respondWithResult(_0x9e8d3c,null))['catch'](handleError(_0x9e8d3c,null));};exports[_0x2b72('0x27')]=function(_0x266693,_0x3496d6){return db[_0x2b72('0x30')][_0x2b72('0x2e')]({'where':{'id':_0x266693[_0x2b72('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3496d6,null))[_0x2b72('0x28')](removeEntity(_0x3496d6,null))[_0x2b72('0x31')](handleError(_0x3496d6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b55251d..e44ec80 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 _0x73a1=['tools_actions','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action'];(function(_0x18f6da,_0x10be70){var _0x35c6e4=function(_0x52da51){while(--_0x52da51){_0x18f6da['push'](_0x18f6da['shift']());}};_0x35c6e4(++_0x10be70);}(_0x73a1,0x161));var _0x173a=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x73a1[_0x503950];return _0x1657a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x173a('0x0'))(_0x173a('0x1'));var moment=require('moment');var BPromise=require(_0x173a('0x2'));var rp=require(_0x173a('0x3'));var fs=require('fs');var path=require(_0x173a('0x4'));var rimraf=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var attributes=require('./action.attributes');module[_0x173a('0x7')]=function(_0x1a8b94,_0xac84a){return _0x1a8b94[_0x173a('0x8')](_0x173a('0x9'),attributes,{'tableName':_0x173a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43d4=['api','moment','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger'];(function(_0xccb939,_0x2ba302){var _0x42027d=function(_0x1e27cd){while(--_0x1e27cd){_0xccb939['push'](_0xccb939['shift']());}};_0x42027d(++_0x2ba302);}(_0x43d4,0x173));var _0x443d=function(_0x32fe12,_0x32f64d){_0x32fe12=_0x32fe12-0x0;var _0x5346d4=_0x43d4[_0x32fe12];return _0x5346d4;};'use strict';var _=require(_0x443d('0x0'));var util=require(_0x443d('0x1'));var logger=require(_0x443d('0x2'))(_0x443d('0x3'));var moment=require(_0x443d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x443d('0x5'));var config=require(_0x443d('0x6'));var attributes=require(_0x443d('0x7'));module[_0x443d('0x8')]=function(_0x4b3123,_0x5df9e0){return _0x4b3123[_0x443d('0x9')](_0x443d('0xa'),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 1471665..198ed46 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 _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(_0x5086bd,_0x58e31f){var _0x56479b=function(_0xec1be1){while(--_0xec1be1){_0x5086bd['push'](_0x5086bd['shift']());}};_0x56479b(++_0x58e31f);}(_0xe14b,0x93));var _0xbe14=function(_0x547510,_0x30e1c5){_0x547510=_0x547510-0x0;var _0x273c31=_0xe14b[_0x547510];return _0x273c31;};'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 +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x51b1f2,_0x5b6a93){var _0x1fa5fa=function(_0x3a7ffe){while(--_0x3a7ffe){_0x51b1f2['push'](_0x51b1f2['shift']());}};_0x1fa5fa(++_0x5b6a93);}(_0xabce,0x103));var _0xeabc=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xabce[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 133f321..7e37fe3 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 _0x37c0=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','update','destroy','exports','multer','util'];(function(_0x909557,_0x3a0599){var _0x867eaf=function(_0x2ddc9f){while(--_0x2ddc9f){_0x909557['push'](_0x909557['shift']());}};_0x867eaf(++_0x3a0599);}(_0x37c0,0x15c));var _0x037c=function(_0x5c5b17,_0x3c4947){_0x5c5b17=_0x5c5b17-0x0;var _0x1c6282=_0x37c0[_0x5c5b17];return _0x1c6282;};'use strict';var multer=require(_0x037c('0x0'));var util=require(_0x037c('0x1'));var path=require(_0x037c('0x2'));var timeout=require('connect-timeout');var express=require(_0x037c('0x3'));var router=express[_0x037c('0x4')]();var fs_extra=require(_0x037c('0x5'));var auth=require(_0x037c('0x6'));var interaction=require(_0x037c('0x7'));var config=require(_0x037c('0x8'));var controller=require(_0x037c('0x9'));router['put'](_0x037c('0xa'),auth['isAuthenticated'](),controller[_0x037c('0xb')]);router['delete'](_0x037c('0xa'),auth['isAuthenticated'](),controller[_0x037c('0xc')]);module[_0x037c('0xd')]=router; \ No newline at end of file +var _0xea6e=['isAuthenticated','update','delete','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x110596,_0x1faae7){var _0x51fef2=function(_0x443662){while(--_0x443662){_0x110596['push'](_0x110596['shift']());}};_0x51fef2(++_0x1faae7);}(_0xea6e,0x1a9));var _0xeea6=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0xea6e[_0x2dc343];return _0x51eac5;};'use strict';var multer=require(_0xeea6('0x0'));var util=require(_0xeea6('0x1'));var path=require(_0xeea6('0x2'));var timeout=require(_0xeea6('0x3'));var express=require('express');var router=express[_0xeea6('0x4')]();var fs_extra=require(_0xeea6('0x5'));var auth=require(_0xeea6('0x6'));var interaction=require(_0xeea6('0x7'));var config=require(_0xeea6('0x8'));var controller=require('./action.controller');router[_0xeea6('0x9')]('/:id',auth[_0xeea6('0xa')](),controller[_0xeea6('0xb')]);router[_0xeea6('0xc')](_0xeea6('0xd'),auth[_0xeea6('0xa')](),controller['destroy']);module[_0xeea6('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index db2805f..c9035a8 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x4da444,_0x3f6072){var _0x37040f=function(_0x33b62d){while(--_0x33b62d){_0x4da444['push'](_0x4da444['shift']());}};_0x37040f(++_0x3f6072);}(_0xeda8,0x104));var _0x8eda=function(_0x46ce2e,_0x19e9f2){_0x46ce2e=_0x46ce2e-0x0;var _0x400554=_0xeda8[_0x46ce2e];return _0x400554;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 206e2c9..bfece3b 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 _0xd90c=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','replace','function','format','groupBy','order','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','value','ValidationErrorItem','from','%s.%s\x20=\x20%s.%s','web','%s-%s.%s','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','output','savename','select','countTable','COUNT(*)','ROUND(%s)','debug','Limited\x20Query:','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','reject','save','update','destroy','get','CustomReports','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','AnalyticCustomReport','includeAll','findAll','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3b6248,_0x369c42){var _0x46c3e1=function(_0x4e6e13){while(--_0x4e6e13){_0x3b6248['push'](_0x3b6248['shift']());}};_0x46c3e1(++_0x369c42);}(_0xd90c,0x194));var _0xcd90=function(_0x5d8f,_0x14d9d3){_0x5d8f=_0x5d8f-0x0;var _0x252a50=_0xd90c[_0x5d8f];return _0x252a50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd90('0x0'));var zipdir=require(_0xcd90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd90('0x2'));var moment=require(_0xcd90('0x3'));var BPromise=require(_0xcd90('0x4'));var Mustache=require(_0xcd90('0x5'));var util=require(_0xcd90('0x6'));var path=require('path');var sox=require(_0xcd90('0x7'));var csv=require(_0xcd90('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd90('0x9'));var _=require('lodash');var squel=require(_0xcd90('0xa'));var crypto=require(_0xcd90('0xb'));var jsforce=require(_0xcd90('0xc'));var deskjs=require(_0xcd90('0xd'));var toCsv=require(_0xcd90('0x8'));var querystring=require(_0xcd90('0xe'));var Papa=require(_0xcd90('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd90('0x10'));var hardwareService=require(_0xcd90('0x11'));var logger=require(_0xcd90('0x12'))(_0xcd90('0x13'));var utils=require(_0xcd90('0x14'));var config=require(_0xcd90('0x15'));var licenseUtil=require(_0xcd90('0x16'));var db=require(_0xcd90('0x17'))['db'];var dbH=require(_0xcd90('0x17'))['dbH'];function respondWithStatusCode(_0x588994,_0x566602){_0x566602=_0x566602||0xcc;return function(_0x168eab){if(_0x168eab){return _0x588994['sendStatus'](_0x566602);}return _0x588994['status'](_0x566602)['end']();};}function respondWithResult(_0x56b5de,_0x528ded){_0x528ded=_0x528ded||0xc8;return function(_0x3e447e){if(_0x3e447e){return _0x56b5de[_0xcd90('0x18')](_0x528ded)[_0xcd90('0x19')](_0x3e447e);}};}function respondWithFilteredResult(_0x5d696e,_0x3d8568){return function(_0x485fa8){if(_0x485fa8){var _0x404b4b=typeof _0x3d8568[_0xcd90('0x1a')]===_0xcd90('0x1b')&&typeof _0x3d8568[_0xcd90('0x1c')]==='undefined';var _0x2c3195=_0x485fa8[_0xcd90('0x1d')];var _0x1212dc=_0x404b4b?0x0:_0x3d8568[_0xcd90('0x1a')];var _0x3d9b55=_0x404b4b?_0x485fa8['count']:_0x3d8568[_0xcd90('0x1a')]+_0x3d8568['limit'];var _0x1640a0;if(_0x3d9b55>=_0x2c3195){_0x3d9b55=_0x2c3195;_0x1640a0=0xc8;}else{_0x1640a0=0xce;}_0x5d696e[_0xcd90('0x18')](_0x1640a0);return _0x5d696e['set']('Content-Range',_0x1212dc+'-'+_0x3d9b55+'/'+_0x2c3195)[_0xcd90('0x19')](_0x485fa8);}return null;};}function patchUpdates(_0x2ac571){return function(_0x2456b4){try{jsonpatch['apply'](_0x2456b4,_0x2ac571,!![]);}catch(_0x41e254){return BPromise[_0xcd90('0x1e')](_0x41e254);}return _0x2456b4[_0xcd90('0x1f')]();};}function saveUpdates(_0xf1e087,_0x336846){return function(_0x17d935){if(_0x17d935){return _0x17d935[_0xcd90('0x20')](_0xf1e087)['then'](function(_0x44db84){return _0x44db84;});}return null;};}function removeEntity(_0x2a438b,_0x5ed642){return function(_0x5dae8e){if(_0x5dae8e){return _0x5dae8e[_0xcd90('0x21')]()['then'](function(){var _0xa410a3=_0x5dae8e[_0xcd90('0x22')]({'plain':!![]});var _0x52666f=_0xcd90('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x52666f,'resourceId':_0xa410a3['id']}})[_0xcd90('0x24')](function(){return _0x5dae8e;});})[_0xcd90('0x24')](function(){_0x2a438b[_0xcd90('0x18')](0xcc)[_0xcd90('0x25')]();});}};}function handleEntityNotFound(_0x1d45e9,_0x1d271b){return function(_0x4f8c40){if(!_0x4f8c40){_0x1d45e9[_0xcd90('0x26')](0x194);}return _0x4f8c40;};}function handleError(_0x49e401,_0x9133bf){_0x9133bf=_0x9133bf||0x1f4;return function(_0x18d58a){logger[_0xcd90('0x27')](_0x18d58a[_0xcd90('0x28')]);if(_0x18d58a[_0xcd90('0x29')]){delete _0x18d58a['name'];}_0x49e401[_0xcd90('0x18')](_0x9133bf)[_0xcd90('0x2a')](_0x18d58a);};}exports[_0xcd90('0x2b')]=function(_0x1b9d82,_0x2d312c){var _0x507cfa={},_0x4052e7={},_0x16bbab={'count':0x0,'rows':[]};var _0x4049b6=_[_0xcd90('0x2c')](db['AnalyticCustomReport'][_0xcd90('0x2d')],function(_0x10004d){return{'name':_0x10004d['fieldName'],'type':_0x10004d[_0xcd90('0x2e')][_0xcd90('0x2f')]};});_0x4052e7[_0xcd90('0x30')]=_['map'](_0x4049b6,_0xcd90('0x29'));_0x4052e7[_0xcd90('0x31')]=_[_0xcd90('0x32')](_0x1b9d82['query']);_0x4052e7[_0xcd90('0x33')]=_[_0xcd90('0x34')](_0x4052e7[_0xcd90('0x30')],_0x4052e7['query']);_0x507cfa[_0xcd90('0x35')]=_['intersection'](_0x4052e7['model'],qs[_0xcd90('0x36')](_0x1b9d82[_0xcd90('0x31')][_0xcd90('0x36')]));_0x507cfa['attributes']=_0x507cfa[_0xcd90('0x35')][_0xcd90('0x37')]?_0x507cfa[_0xcd90('0x35')]:_0x4052e7[_0xcd90('0x30')];if(!_0x1b9d82['query'][_0xcd90('0x38')](_0xcd90('0x39'))){_0x507cfa[_0xcd90('0x1c')]=qs[_0xcd90('0x1c')](_0x1b9d82['query'][_0xcd90('0x1c')]);_0x507cfa[_0xcd90('0x1a')]=qs[_0xcd90('0x1a')](_0x1b9d82[_0xcd90('0x31')][_0xcd90('0x1a')]);}_0x507cfa['order']=qs['sort'](_0x1b9d82['query'][_0xcd90('0x3a')]);_0x507cfa['where']=qs[_0xcd90('0x33')](_[_0xcd90('0x3b')](_0x1b9d82[_0xcd90('0x31')],_0x4052e7[_0xcd90('0x33')]),_0x4049b6);if(_0x1b9d82['query'][_0xcd90('0x3c')]){_0x507cfa[_0xcd90('0x3d')]=_['merge'](_0x507cfa[_0xcd90('0x3d')],{'$or':_[_0xcd90('0x2c')](_0x4049b6,function(_0x72ab36){if(_0x72ab36[_0xcd90('0x2e')]!==_0xcd90('0x3e')){var _0x5a8052={};_0x5a8052[_0x72ab36['name']]={'$like':'%'+_0x1b9d82[_0xcd90('0x31')][_0xcd90('0x3c')]+'%'};return _0x5a8052;}})});}_0x507cfa=_[_0xcd90('0x3f')]({},_0x507cfa,_0x1b9d82[_0xcd90('0x40')]);var _0x49bf30={'where':_0x507cfa[_0xcd90('0x3d')]};return db[_0xcd90('0x41')]['count'](_0x49bf30)[_0xcd90('0x24')](function(_0x33e97a){_0x16bbab[_0xcd90('0x1d')]=_0x33e97a;if(_0x1b9d82[_0xcd90('0x31')][_0xcd90('0x42')]){_0x507cfa['include']=[{'all':!![]}];}return db[_0xcd90('0x41')][_0xcd90('0x43')](_0x507cfa);})[_0xcd90('0x24')](function(_0x3b5139){_0x16bbab['rows']=_0x3b5139;return _0x16bbab;})[_0xcd90('0x24')](respondWithFilteredResult(_0x2d312c,_0x507cfa))[_0xcd90('0x44')](handleError(_0x2d312c,null));};exports['show']=function(_0x2a3f16,_0x3a0e42){var _0x3023d5={'raw':![],'where':{'id':_0x2a3f16[_0xcd90('0x45')]['id']}},_0x5f191b={};_0x5f191b[_0xcd90('0x30')]=_[_0xcd90('0x32')](db[_0xcd90('0x41')][_0xcd90('0x2d')]);_0x5f191b[_0xcd90('0x31')]=_[_0xcd90('0x32')](_0x2a3f16[_0xcd90('0x31')]);_0x5f191b[_0xcd90('0x33')]=_[_0xcd90('0x34')](_0x5f191b[_0xcd90('0x30')],_0x5f191b['query']);_0x3023d5[_0xcd90('0x35')]=_[_0xcd90('0x34')](_0x5f191b[_0xcd90('0x30')],qs[_0xcd90('0x36')](_0x2a3f16['query'][_0xcd90('0x36')]));_0x3023d5[_0xcd90('0x35')]=_0x3023d5['attributes'][_0xcd90('0x37')]?_0x3023d5[_0xcd90('0x35')]:_0x5f191b[_0xcd90('0x30')];if(_0x2a3f16['query']['includeAll']){_0x3023d5['include']=[{'all':!![]}];}_0x3023d5=_[_0xcd90('0x3f')]({},_0x3023d5,_0x2a3f16[_0xcd90('0x40')]);return db[_0xcd90('0x41')]['find'](_0x3023d5)['then'](handleEntityNotFound(_0x3a0e42,null))[_0xcd90('0x24')](respondWithResult(_0x3a0e42,null))['catch'](handleError(_0x3a0e42,null));};exports[_0xcd90('0x46')]=function(_0xbd66d6,_0x50cc61){return db[_0xcd90('0x41')]['create'](_0xbd66d6['body'],{})[_0xcd90('0x24')](function(_0x518066){var _0x27b5b4=_0xbd66d6[_0xcd90('0x47')][_0xcd90('0x22')]({'plain':!![]});if(!_0x27b5b4)throw new Error(_0xcd90('0x48'));if(_0x27b5b4[_0xcd90('0x49')]===_0xcd90('0x47')){var _0xd3690a=_0x518066[_0xcd90('0x22')]({'plain':!![]});var _0x1720b5='Reports';return db[_0xcd90('0x4a')]['find']({'where':{'name':_0x1720b5,'userProfileId':_0x27b5b4[_0xcd90('0x4b')]},'raw':!![]})[_0xcd90('0x24')](function(_0x32b476){if(_0x32b476&&_0x32b476[_0xcd90('0x4c')]===0x0){return db[_0xcd90('0x4d')]['create']({'name':_0xd3690a['name'],'resourceId':_0xd3690a['id'],'type':'CustomReports','sectionId':_0x32b476['id']},{})[_0xcd90('0x24')](function(){return _0x518066;});}else{return _0x518066;}})[_0xcd90('0x44')](function(_0x2f0cd6){logger[_0xcd90('0x27')](_0xcd90('0x4e'),_0x2f0cd6);throw _0x2f0cd6;});}return _0x518066;})[_0xcd90('0x24')](respondWithResult(_0x50cc61,0xc9))[_0xcd90('0x44')](handleError(_0x50cc61,null));};exports[_0xcd90('0x20')]=function(_0x3ee117,_0x43f255){if(_0x3ee117[_0xcd90('0x4f')]['id']){delete _0x3ee117['body']['id'];}return db[_0xcd90('0x41')][_0xcd90('0x50')]({'where':{'id':_0x3ee117[_0xcd90('0x45')]['id']}})['then'](handleEntityNotFound(_0x43f255,null))[_0xcd90('0x24')](saveUpdates(_0x3ee117[_0xcd90('0x4f')],null))[_0xcd90('0x24')](respondWithResult(_0x43f255,null))[_0xcd90('0x44')](handleError(_0x43f255,null));};exports[_0xcd90('0x21')]=function(_0x44a9b2,_0x3eef6f){return db[_0xcd90('0x41')]['find']({'where':{'id':_0x44a9b2[_0xcd90('0x45')]['id']}})[_0xcd90('0x24')](handleEntityNotFound(_0x3eef6f,null))['then'](removeEntity(_0x3eef6f,null))[_0xcd90('0x44')](handleError(_0x3eef6f,null));};exports[_0xcd90('0x51')]=function(_0x34cfd4,_0x459ac7){var _0x204a96=0xa;var _0x167883=[_0xcd90('0x52'),_0xcd90('0x53'),_0xcd90('0x54'),'cross_join'];var _0x3f47b3={'SUM':'SUM(%s)','COUNT':_0xcd90('0x55'),'COUNT DISTINCT':_0xcd90('0x56'),'MAX':_0xcd90('0x57'),'MIN':_0xcd90('0x58'),'AVG':_0xcd90('0x59'),'GROUP_CONCAT':_0xcd90('0x5a'),'GROUP_CONCAT ASC':_0xcd90('0x5b'),'GROUP_CONCAT DESC':_0xcd90('0x5c')};var _0x19d0ab={'SEC_TO_TIME':_0xcd90('0x5d'),'DATE':_0xcd90('0x5e'),'HOUR':_0xcd90('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcd90('0x60')};var _0x489422=function(_0x14db94){return!_[_0xcd90('0x61')]([_0xcd90('0x62'),_0xcd90('0x63'),'IS\x20EMPTY',_0xcd90('0x64')],_0x14db94);};var _0x1d9873=function(_0xc337fd){if(!_0xc337fd||!_0xc337fd[_0xcd90('0x65')]['length']){return'';}for(var _0x58b875='(',_0x4e0b8f=0x0;_0x4e0b8f<_0xc337fd[_0xcd90('0x65')][_0xcd90('0x37')];_0x4e0b8f+=0x1){_0x4e0b8f>0x0&&(_0x58b875+='\x20'+_0xc337fd[_0xcd90('0x66')]+'\x20');_0x58b875+=_0xc337fd[_0xcd90('0x65')][_0x4e0b8f]['group']?_0x1d9873(_0xc337fd[_0xcd90('0x65')][_0x4e0b8f][_0xcd90('0x67')]):_0xc337fd['rules'][_0x4e0b8f][_0xcd90('0x68')]+'\x20'+_0xc337fd[_0xcd90('0x65')][_0x4e0b8f][_0xcd90('0x69')]+(_0x489422(_0xc337fd[_0xcd90('0x65')][_0x4e0b8f][_0xcd90('0x69')])?'\x20'+_0xc337fd[_0xcd90('0x65')][_0x4e0b8f]['value']:'');}return _0x58b875+')';};var _0x3ef861={'where':{'id':_0x34cfd4['params']['id']}},_0x47b510,_0x28d770,_0x3197b3,_0x14a59e,_0x14c0d2;_0x3ef861=_[_0xcd90('0x3f')]({},_0x3ef861,_0x34cfd4['options']);return db[_0xcd90('0x41')][_0xcd90('0x50')](_0x3ef861)[_0xcd90('0x24')](function(_0x228c62){if(_0x228c62){_0x47b510=_0x228c62;return _0x228c62[_0xcd90('0x6a')]();}return null;})[_0xcd90('0x24')](function(_0x283b4b){if(_0x283b4b){if(!_0x283b4b['length']){throw new db[(_0xcd90('0x6b'))]['ValidationErrorItem'](_0xcd90('0x6c'),0x193);}_0x28d770=_0x283b4b;return db[_0xcd90('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xcd90('0x24')](function(_0x1da753){if(_0x1da753){_0x3197b3=_[_0xcd90('0x6e')](_0x1da753,'id');var _0x31ee53;var _0x31de09=squel['select']();_0x31de09['from'](_0x47b510[_0xcd90('0x6f')]);for(var _0x5abf07=0x0;_0x5abf07<_0x28d770['length'];_0x5abf07+=0x1){_0x31ee53=_0x28d770[_0x5abf07][_0xcd90('0x70')]?_0x3197b3[_0x28d770[_0x5abf07]['MetricId']][_0xcd90('0x71')]:_0x28d770[_0x5abf07][_0xcd90('0x68')];_0x31ee53=_0x28d770[_0x5abf07]['function']?_[_0xcd90('0x72')](_0x3f47b3[_0x28d770[_0x5abf07][_0xcd90('0x73')]],'%s',_0x31ee53):_0x31ee53;_0x31ee53=_0x28d770[_0x5abf07][_0xcd90('0x74')]?_['replace'](_0x19d0ab[_0x28d770[_0x5abf07]['format']],'%s',_0x31ee53):_0x31ee53;if(_0x28d770[_0x5abf07][_0xcd90('0x75')]){_0x31de09[_0xcd90('0x67')](_0x31ee53);}_0x28d770[_0x5abf07]['orderBy']&&_0x31de09[_0xcd90('0x76')](_0x31ee53,_0x28d770[_0x5abf07][_0xcd90('0x77')]===_0xcd90('0x78')?![]:!![]);_0x31de09['field'](_0x31ee53,_0x28d770[_0x5abf07][_0xcd90('0x79')]||_0x31ee53);}if(_0x47b510[_0xcd90('0x7a')]){_0x47b510[_0xcd90('0x7a')]=JSON[_0xcd90('0x7b')](_0x47b510[_0xcd90('0x7a')]);for(var _0x27a4dc=0x0;_0x27a4dc<_0x47b510[_0xcd90('0x7a')][_0xcd90('0x37')];_0x27a4dc+=0x1){if(_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x2e')]&&_[_0xcd90('0x61')](_0x167883,_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x2e')])&&_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x7c')]&&_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x7d')]&&_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x7e')]){_0x31de09[_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x2e')]](_0x47b510['joins'][_0x27a4dc][_0xcd90('0x7d')],null,util[_0xcd90('0x74')]('%s.%s\x20=\x20%s.%s',_0x47b510[_0xcd90('0x6f')],_0x47b510['joins'][_0x27a4dc][_0xcd90('0x7c')],_0x47b510[_0xcd90('0x7a')][_0x27a4dc][_0xcd90('0x7d')],_0x47b510['joins'][_0x27a4dc][_0xcd90('0x7e')]));}}}if(_0x47b510['conditions']){_0x47b510[_0xcd90('0x7f')]=JSON[_0xcd90('0x7b')](_0x47b510[_0xcd90('0x7f')]);_0x31de09[_0xcd90('0x3d')](_0x1d9873(_0x47b510[_0xcd90('0x7f')]['group']));}_0x14c0d2=_0x31de09[_0xcd90('0x80')]();_0x31de09[_0xcd90('0x1c')](_0x204a96);_0x31de09['offset'](0x0);logger['debug']('Limited\x20Query:',_0x31de09[_0xcd90('0x81')]());return dbH[_0xcd90('0x82')][_0xcd90('0x31')](_0x31de09[_0xcd90('0x81')](),{'type':dbH[_0xcd90('0x82')][_0xcd90('0x83')][_0xcd90('0x84')]});}})[_0xcd90('0x24')](respondWithResult(_0x459ac7,null))[_0xcd90('0x44')](handleError(_0x459ac7,null));};function runReport(_0x100d41,_0x18edbd,_0x73ee9d){var _0x1f464f=_0x18edbd[_0xcd90('0x29')];var _0x351b21=0xa;var _0x23b5ab=[_0xcd90('0x52'),_0xcd90('0x53'),'right_join',_0xcd90('0x85')];var _0x1c370e={'SUM':_0xcd90('0x86'),'COUNT':_0xcd90('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcd90('0x57'),'MIN':_0xcd90('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcd90('0x5b'),'GROUP_CONCAT DESC':_0xcd90('0x5c')};var _0x1b647c={'SEC_TO_TIME':_0xcd90('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a0019=function(_0x37b726){return!_['includes']([_0xcd90('0x62'),_0xcd90('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x37b726);};var _0x3c490e=function(_0x495992){if(!_0x495992||!_0x495992[_0xcd90('0x65')][_0xcd90('0x37')]){return'';}for(var _0x1ced2b='(',_0x2ac844=0x0;_0x2ac844<_0x495992[_0xcd90('0x65')][_0xcd90('0x37')];_0x2ac844+=0x1){_0x2ac844>0x0&&(_0x1ced2b+='\x20'+_0x495992[_0xcd90('0x66')]+'\x20');_0x1ced2b+=_0x495992[_0xcd90('0x65')][_0x2ac844][_0xcd90('0x67')]?_0x3c490e(_0x495992[_0xcd90('0x65')][_0x2ac844][_0xcd90('0x67')]):_0x495992[_0xcd90('0x65')][_0x2ac844]['field']+'\x20'+_0x495992[_0xcd90('0x65')][_0x2ac844]['condition']+(_0x5a0019(_0x495992['rules'][_0x2ac844]['condition'])?'\x20'+_0x495992[_0xcd90('0x65')][_0x2ac844][_0xcd90('0x87')]:'');}return _0x1ced2b+')';};var _0x5a84b1={'where':{'id':_0x100d41['id']}},_0x740246,_0x58d3e2,_0x37c4da,_0x24a5d8,_0x256460;_0x5a84b1=_['merge']({},_0x5a84b1,_0x73ee9d);return db['AnalyticCustomReport']['find'](_0x5a84b1)[_0xcd90('0x24')](function(_0x40dcb6){if(_0x40dcb6){_0x740246=_0x40dcb6;return _0x40dcb6[_0xcd90('0x6a')]();}return null;})['then'](function(_0x4ed024){if(_0x4ed024){if(!_0x4ed024[_0xcd90('0x37')]){throw new db[(_0xcd90('0x6b'))][(_0xcd90('0x88'))](_0xcd90('0x6c'),0x193);}_0x58d3e2=_0x4ed024;return db[_0xcd90('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xcd90('0x24')](function(_0x11795c){if(_0x11795c){_0x37c4da=_[_0xcd90('0x6e')](_0x11795c,'id');var _0x460b08;var _0xb355f3=squel['select']();_0xb355f3[_0xcd90('0x89')](_0x740246[_0xcd90('0x6f')]);for(var _0x1ecb7a=0x0;_0x1ecb7a<_0x58d3e2['length'];_0x1ecb7a+=0x1){_0x460b08=_0x58d3e2[_0x1ecb7a][_0xcd90('0x70')]?_0x37c4da[_0x58d3e2[_0x1ecb7a][_0xcd90('0x70')]][_0xcd90('0x71')]:_0x58d3e2[_0x1ecb7a][_0xcd90('0x68')];_0x460b08=_0x58d3e2[_0x1ecb7a][_0xcd90('0x73')]?_[_0xcd90('0x72')](_0x1c370e[_0x58d3e2[_0x1ecb7a]['function']],'%s',_0x460b08):_0x460b08;_0x460b08=_0x58d3e2[_0x1ecb7a][_0xcd90('0x74')]?_['replace'](_0x1b647c[_0x58d3e2[_0x1ecb7a]['format']],'%s',_0x460b08):_0x460b08;if(_0x58d3e2[_0x1ecb7a][_0xcd90('0x75')]){_0xb355f3[_0xcd90('0x67')](_0x460b08);}_0x58d3e2[_0x1ecb7a][_0xcd90('0x77')]&&_0xb355f3[_0xcd90('0x76')](_0x460b08,_0x58d3e2[_0x1ecb7a]['orderBy']===_0xcd90('0x78')?![]:!![]);_0xb355f3[_0xcd90('0x68')](_0x460b08,_0x58d3e2[_0x1ecb7a][_0xcd90('0x79')]||_0x460b08);}if(_0x740246[_0xcd90('0x7a')]){_0x740246[_0xcd90('0x7a')]=JSON['parse'](_0x740246[_0xcd90('0x7a')]);for(var _0x164dd8=0x0;_0x164dd8<_0x740246[_0xcd90('0x7a')][_0xcd90('0x37')];_0x164dd8+=0x1){if(_0x740246[_0xcd90('0x7a')][_0x164dd8][_0xcd90('0x2e')]&&_[_0xcd90('0x61')](_0x23b5ab,_0x740246['joins'][_0x164dd8][_0xcd90('0x2e')])&&_0x740246[_0xcd90('0x7a')][_0x164dd8][_0xcd90('0x7c')]&&_0x740246[_0xcd90('0x7a')][_0x164dd8]['foreignTable']&&_0x740246[_0xcd90('0x7a')][_0x164dd8][_0xcd90('0x7e')]){_0xb355f3[_0x740246[_0xcd90('0x7a')][_0x164dd8][_0xcd90('0x2e')]](_0x740246[_0xcd90('0x7a')][_0x164dd8][_0xcd90('0x7d')],null,util[_0xcd90('0x74')](_0xcd90('0x8a'),_0x740246[_0xcd90('0x6f')],_0x740246['joins'][_0x164dd8][_0xcd90('0x7c')],_0x740246['joins'][_0x164dd8][_0xcd90('0x7d')],_0x740246[_0xcd90('0x7a')][_0x164dd8][_0xcd90('0x7e')]));}}}if(_0x740246[_0xcd90('0x7f')]){_0x740246[_0xcd90('0x7f')]=JSON[_0xcd90('0x7b')](_0x740246['conditions']);_0xb355f3['where'](_0x3c490e(_0x740246[_0xcd90('0x7f')][_0xcd90('0x67')]));}_0x256460=_0xb355f3[_0xcd90('0x80')]();_0xb355f3['limit'](_0x351b21);_0xb355f3[_0xcd90('0x1a')](0x0);return;}})[_0xcd90('0x24')](function(){if(_0x18edbd['output']===_0xcd90('0x8b')){return null;}var _0x32ec47=_[_0xcd90('0x3f')](_0x18edbd,{'name':_0x18edbd['fullPath']||_0x18edbd[_0xcd90('0x29')]||_0x740246['name'],'basename':_0x1f464f,'savename':util[_0xcd90('0x74')](_0xcd90('0x8c'),_0x18edbd[_0xcd90('0x29')]||_0x740246[_0xcd90('0x29')],require('randomstring')[_0xcd90('0x8d')](0x4),_0x18edbd['output']||'csv'),'reportId':_0x740246['id'],'reportType':_0xcd90('0x8e')});return db[_0xcd90('0x8f')]['create'](_0x32ec47,{'raw':!![]});})['then'](function(_0x240be7){if(_0x740246[_0xcd90('0x6f')]==='cdr'){_0x256460['where'](_0x740246[_0xcd90('0x6f')]+_0xcd90('0x90'),_0x18edbd[_0xcd90('0x91')],_0x18edbd[_0xcd90('0x92')]);}else{_0x256460['where'](_0x740246[_0xcd90('0x6f')]+_0xcd90('0x93'),_0x18edbd[_0xcd90('0x91')],_0x18edbd['endDate']);}if(_0x240be7){logger['info'](_0xcd90('0x94'),_0x256460[_0xcd90('0x81')]());require('child_process')[_0xcd90('0x95')](path[_0xcd90('0x52')](__dirname,_0xcd90('0x96'),_0x240be7[_0xcd90('0x97')]),[_0x240be7['id'],_0x256460['toString'](),path[_0xcd90('0x52')](__dirname,'../../files/reports',_0x240be7[_0xcd90('0x98')]),_0x1f464f]);return _0x240be7;}else{var _0x29e7a3=squel[_0xcd90('0x99')]();_0x29e7a3[_0xcd90('0x89')]('('+_0x256460[_0xcd90('0x81')]()+')',_0xcd90('0x9a'));_0x29e7a3[_0xcd90('0x68')](_0xcd90('0x9b'),'count');_0x256460['limit'](_0x18edbd[_0xcd90('0x1c')]||_0x351b21);_0x256460['offset'](_0x18edbd[_0xcd90('0x1a')]||0x0);return dbH['sequelize'][_0xcd90('0x31')](_0x29e7a3['toString'](),{'type':dbH[_0xcd90('0x82')][_0xcd90('0x83')]['SELECT']})[_0xcd90('0x24')](function(_0x5c3667){if(!_0x5c3667[_0xcd90('0x37')]){_0x24a5d8=0x0;}else{_0x24a5d8=_0x5c3667[0x0][_0xcd90('0x1d')]||0x0;}return dbH[_0xcd90('0x82')][_0xcd90('0x31')](_0x256460[_0xcd90('0x81')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xcd90('0x24')](function(_0x2745ab){return{'rows':_0x2745ab||[],'count':_0x24a5d8};});}});}exports['run']=function(_0x3ca88e,_0x18768d){return runReport(_0x3ca88e[_0xcd90('0x45')],_0x3ca88e[_0xcd90('0x31')],_0x3ca88e[_0xcd90('0x40')])[_0xcd90('0x24')](respondWithResult(_0x18768d,null))['catch'](handleError(_0x18768d,null));};exports['runReport']=runReport;exports[_0xcd90('0x31')]=function(_0x3d2e62,_0x156fbb){var _0x6b1cf=0xa;var _0x12ab41=[_0xcd90('0x52'),_0xcd90('0x53'),_0xcd90('0x54'),_0xcd90('0x85')];var _0x24c062={'SUM':_0xcd90('0x86'),'COUNT':_0xcd90('0x55'),'COUNT DISTINCT':_0xcd90('0x56'),'MAX':_0xcd90('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcd90('0x5b'),'GROUP_CONCAT DESC':_0xcd90('0x5c')};var _0x37a906={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcd90('0x9c'),'UNIX_TIMESTAMP':_0xcd90('0x60')};var _0x49036e=function(_0x3efaca){return!_[_0xcd90('0x61')]([_0xcd90('0x62'),_0xcd90('0x63'),'IS\x20EMPTY',_0xcd90('0x64')],_0x3efaca);};var _0x93820c=function(_0x4eab49){if(!_0x4eab49||!_0x4eab49[_0xcd90('0x65')]['length']){return'';}for(var _0x495030='(',_0x37ef0e=0x0;_0x37ef0e<_0x4eab49[_0xcd90('0x65')][_0xcd90('0x37')];_0x37ef0e+=0x1){_0x37ef0e>0x0&&(_0x495030+='\x20'+_0x4eab49[_0xcd90('0x66')]+'\x20');_0x495030+=_0x4eab49['rules'][_0x37ef0e]['group']?_0x93820c(_0x4eab49[_0xcd90('0x65')][_0x37ef0e][_0xcd90('0x67')]):_0x4eab49[_0xcd90('0x65')][_0x37ef0e][_0xcd90('0x68')]+'\x20'+_0x4eab49[_0xcd90('0x65')][_0x37ef0e][_0xcd90('0x69')]+(_0x49036e(_0x4eab49[_0xcd90('0x65')][_0x37ef0e][_0xcd90('0x69')])?'\x20'+_0x4eab49[_0xcd90('0x65')][_0x37ef0e][_0xcd90('0x87')]:'');}return _0x495030+')';};var _0x46fc3b={'where':{'id':_0x3d2e62[_0xcd90('0x45')]['id']}},_0x14a077,_0x4571e8,_0xe7199a,_0x4f8aae,_0x21c4bb;_0x46fc3b=_[_0xcd90('0x3f')]({},_0x46fc3b,_0x3d2e62['options']);return db['AnalyticCustomReport'][_0xcd90('0x50')](_0x46fc3b)[_0xcd90('0x24')](function(_0x55b6d0){if(_0x55b6d0){_0x14a077=_0x55b6d0;return _0x55b6d0['getFields']();}return null;})['then'](function(_0x29e76e){if(_0x29e76e){if(!_0x29e76e[_0xcd90('0x37')]){throw new db[(_0xcd90('0x6b'))]['ValidationErrorItem'](_0xcd90('0x6c'),0x193);}_0x4571e8=_0x29e76e;return db[_0xcd90('0x6d')][_0xcd90('0x43')]({'raw':!![]});}return null;})[_0xcd90('0x24')](function(_0x25dcb6){if(_0x25dcb6){_0xe7199a=_[_0xcd90('0x6e')](_0x25dcb6,'id');var _0x274e29;var _0x56885d=squel[_0xcd90('0x99')]();_0x56885d[_0xcd90('0x89')](_0x14a077[_0xcd90('0x6f')]);for(var _0x2719df=0x0;_0x2719df<_0x4571e8[_0xcd90('0x37')];_0x2719df+=0x1){_0x274e29=_0x4571e8[_0x2719df]['MetricId']?_0xe7199a[_0x4571e8[_0x2719df][_0xcd90('0x70')]][_0xcd90('0x71')]:_0x4571e8[_0x2719df][_0xcd90('0x68')];_0x274e29=_0x4571e8[_0x2719df][_0xcd90('0x73')]?_[_0xcd90('0x72')](_0x24c062[_0x4571e8[_0x2719df][_0xcd90('0x73')]],'%s',_0x274e29):_0x274e29;_0x274e29=_0x4571e8[_0x2719df][_0xcd90('0x74')]?_[_0xcd90('0x72')](_0x37a906[_0x4571e8[_0x2719df][_0xcd90('0x74')]],'%s',_0x274e29):_0x274e29;if(_0x4571e8[_0x2719df][_0xcd90('0x75')]){_0x56885d[_0xcd90('0x67')](_0x274e29);}_0x4571e8[_0x2719df][_0xcd90('0x77')]&&_0x56885d['order'](_0x274e29,_0x4571e8[_0x2719df]['orderBy']===_0xcd90('0x78')?![]:!![]);_0x56885d[_0xcd90('0x68')](_0x274e29,_0x4571e8[_0x2719df]['alias']||_0x274e29);}if(_0x14a077['joins']){_0x14a077[_0xcd90('0x7a')]=JSON['parse'](_0x14a077[_0xcd90('0x7a')]);for(var _0x3581b1=0x0;_0x3581b1<_0x14a077[_0xcd90('0x7a')][_0xcd90('0x37')];_0x3581b1+=0x1){if(_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x2e')]&&_[_0xcd90('0x61')](_0x12ab41,_0x14a077[_0xcd90('0x7a')][_0x3581b1]['type'])&&_0x14a077['joins'][_0x3581b1][_0xcd90('0x7c')]&&_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x7d')]&&_0x14a077[_0xcd90('0x7a')][_0x3581b1]['foreignKey']){_0x56885d[_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x2e')]](_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x7d')],null,util[_0xcd90('0x74')](_0xcd90('0x8a'),_0x14a077[_0xcd90('0x6f')],_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x7c')],_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x7d')],_0x14a077[_0xcd90('0x7a')][_0x3581b1][_0xcd90('0x7e')]));}}}if(_0x14a077[_0xcd90('0x7f')]){_0x14a077['conditions']=JSON[_0xcd90('0x7b')](_0x14a077[_0xcd90('0x7f')]);_0x56885d[_0xcd90('0x3d')](_0x93820c(_0x14a077['conditions'][_0xcd90('0x67')]));}_0x21c4bb=_0x56885d[_0xcd90('0x80')]();_0x56885d[_0xcd90('0x1c')](_0x6b1cf);_0x56885d[_0xcd90('0x1a')](0x0);logger[_0xcd90('0x9d')](_0xcd90('0x9e'),_0x56885d['toString']());return dbH[_0xcd90('0x82')][_0xcd90('0x31')](_0x56885d['toString'](),{'type':dbH[_0xcd90('0x82')][_0xcd90('0x83')][_0xcd90('0x84')]});}})[_0xcd90('0x24')](function(){return{'sql':_0x21c4bb[_0xcd90('0x81')]()};})[_0xcd90('0x24')](respondWithResult(_0x156fbb,null))['catch'](handleError(_0x156fbb,null));}; \ No newline at end of file +var _0xed5a=['orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','format','conditions','clone','debug','toString','sequelize','left_join','cross_join','AVG(%s)','GROUP_CONCAT(%s)','UNIX_TIMESTAMP(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','select','from','metric','groupBy','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','right_join','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','status','set','json','apply','update','get','UserProfileResource','destroy','then','error','stack','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','table','MetricId','function','replace'];(function(_0x47217f,_0x444865){var _0x3914eb=function(_0x34d051){while(--_0x34d051){_0x47217f['push'](_0x47217f['shift']());}};_0x3914eb(++_0x444865);}(_0xed5a,0x180));var _0xaed5=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xed5a[_0xf51c06];return _0x1d5420;};'use strict';var emlformat=require(_0xaed5('0x0'));var rimraf=require(_0xaed5('0x1'));var zipdir=require(_0xaed5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaed5('0x3'));var moment=require(_0xaed5('0x4'));var BPromise=require(_0xaed5('0x5'));var Mustache=require(_0xaed5('0x6'));var util=require('util');var path=require(_0xaed5('0x7'));var sox=require(_0xaed5('0x8'));var csv=require(_0xaed5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaed5('0xa'));var _=require(_0xaed5('0xb'));var squel=require('squel');var crypto=require(_0xaed5('0xc'));var jsforce=require(_0xaed5('0xd'));var deskjs=require(_0xaed5('0xe'));var toCsv=require(_0xaed5('0x9'));var querystring=require(_0xaed5('0xf'));var Papa=require('papaparse');var Redis=require(_0xaed5('0x10'));var authService=require(_0xaed5('0x11'));var qs=require(_0xaed5('0x12'));var as=require(_0xaed5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaed5('0x14'));var utils=require(_0xaed5('0x15'));var config=require(_0xaed5('0x16'));var licenseUtil=require(_0xaed5('0x17'));var db=require(_0xaed5('0x18'))['db'];var dbH=require(_0xaed5('0x18'))['dbH'];function respondWithStatusCode(_0x232290,_0x638530){_0x638530=_0x638530||0xcc;return function(_0x3b789e){if(_0x3b789e){return _0x232290[_0xaed5('0x19')](_0x638530);}return _0x232290['status'](_0x638530)[_0xaed5('0x1a')]();};}function respondWithResult(_0x149b14,_0x3a609a){_0x3a609a=_0x3a609a||0xc8;return function(_0x1eecce){if(_0x1eecce){return _0x149b14['status'](_0x3a609a)['json'](_0x1eecce);}};}function respondWithFilteredResult(_0x374a35,_0x20af56){return function(_0x5dd4b6){if(_0x5dd4b6){var _0x4fbe42=typeof _0x20af56[_0xaed5('0x1b')]===_0xaed5('0x1c')&&typeof _0x20af56['limit']==='undefined';var _0x846168=_0x5dd4b6[_0xaed5('0x1d')];var _0x111dbe=_0x4fbe42?0x0:_0x20af56[_0xaed5('0x1b')];var _0x104e60=_0x4fbe42?_0x5dd4b6[_0xaed5('0x1d')]:_0x20af56[_0xaed5('0x1b')]+_0x20af56['limit'];var _0x376f28;if(_0x104e60>=_0x846168){_0x104e60=_0x846168;_0x376f28=0xc8;}else{_0x376f28=0xce;}_0x374a35[_0xaed5('0x1e')](_0x376f28);return _0x374a35[_0xaed5('0x1f')]('Content-Range',_0x111dbe+'-'+_0x104e60+'/'+_0x846168)[_0xaed5('0x20')](_0x5dd4b6);}return null;};}function patchUpdates(_0x292ecf){return function(_0x479da3){try{jsonpatch[_0xaed5('0x21')](_0x479da3,_0x292ecf,!![]);}catch(_0x23ae04){return BPromise['reject'](_0x23ae04);}return _0x479da3['save']();};}function saveUpdates(_0x517fd0,_0x57f87a){return function(_0xf36e42){if(_0xf36e42){return _0xf36e42[_0xaed5('0x22')](_0x517fd0)['then'](function(_0x256c56){return _0x256c56;});}return null;};}function removeEntity(_0x3accf5,_0x418a11){return function(_0xc76732){if(_0xc76732){return _0xc76732['destroy']()['then'](function(){var _0x28bda7=_0xc76732[_0xaed5('0x23')]({'plain':!![]});var _0x589965='CustomReports';return db[_0xaed5('0x24')][_0xaed5('0x25')]({'where':{'type':_0x589965,'resourceId':_0x28bda7['id']}})[_0xaed5('0x26')](function(){return _0xc76732;});})[_0xaed5('0x26')](function(){_0x3accf5['status'](0xcc)[_0xaed5('0x1a')]();});}};}function handleEntityNotFound(_0x593fbd,_0x1eb7b3){return function(_0x5c880e){if(!_0x5c880e){_0x593fbd['sendStatus'](0x194);}return _0x5c880e;};}function handleError(_0x1f030f,_0x5960cc){_0x5960cc=_0x5960cc||0x1f4;return function(_0x3bc5c1){logger[_0xaed5('0x27')](_0x3bc5c1[_0xaed5('0x28')]);if(_0x3bc5c1['name']){delete _0x3bc5c1['name'];}_0x1f030f[_0xaed5('0x1e')](_0x5960cc)[_0xaed5('0x29')](_0x3bc5c1);};}exports[_0xaed5('0x2a')]=function(_0x15db0b,_0x3abf0e){var _0x302e43={},_0xebdb29={},_0x58cb55={'count':0x0,'rows':[]};var _0x66764e=_[_0xaed5('0x2b')](db[_0xaed5('0x2c')][_0xaed5('0x2d')],function(_0x2c8795){return{'name':_0x2c8795[_0xaed5('0x2e')],'type':_0x2c8795[_0xaed5('0x2f')][_0xaed5('0x30')]};});_0xebdb29[_0xaed5('0x31')]=_['map'](_0x66764e,_0xaed5('0x32'));_0xebdb29[_0xaed5('0x33')]=_[_0xaed5('0x34')](_0x15db0b[_0xaed5('0x33')]);_0xebdb29[_0xaed5('0x35')]=_[_0xaed5('0x36')](_0xebdb29[_0xaed5('0x31')],_0xebdb29[_0xaed5('0x33')]);_0x302e43['attributes']=_[_0xaed5('0x36')](_0xebdb29[_0xaed5('0x31')],qs[_0xaed5('0x37')](_0x15db0b[_0xaed5('0x33')][_0xaed5('0x37')]));_0x302e43[_0xaed5('0x38')]=_0x302e43[_0xaed5('0x38')]['length']?_0x302e43['attributes']:_0xebdb29[_0xaed5('0x31')];if(!_0x15db0b[_0xaed5('0x33')][_0xaed5('0x39')](_0xaed5('0x3a'))){_0x302e43['limit']=qs['limit'](_0x15db0b[_0xaed5('0x33')][_0xaed5('0x3b')]);_0x302e43[_0xaed5('0x1b')]=qs[_0xaed5('0x1b')](_0x15db0b[_0xaed5('0x33')][_0xaed5('0x1b')]);}_0x302e43[_0xaed5('0x3c')]=qs[_0xaed5('0x3d')](_0x15db0b[_0xaed5('0x33')][_0xaed5('0x3d')]);_0x302e43[_0xaed5('0x3e')]=qs[_0xaed5('0x35')](_[_0xaed5('0x3f')](_0x15db0b[_0xaed5('0x33')],_0xebdb29['filters']),_0x66764e);if(_0x15db0b[_0xaed5('0x33')][_0xaed5('0x40')]){_0x302e43[_0xaed5('0x3e')]=_[_0xaed5('0x41')](_0x302e43['where'],{'$or':_[_0xaed5('0x2b')](_0x66764e,function(_0x525bf5){if(_0x525bf5[_0xaed5('0x2f')]!==_0xaed5('0x42')){var _0xff17ef={};_0xff17ef[_0x525bf5[_0xaed5('0x32')]]={'$like':'%'+_0x15db0b[_0xaed5('0x33')]['filter']+'%'};return _0xff17ef;}})});}_0x302e43=_[_0xaed5('0x41')]({},_0x302e43,_0x15db0b[_0xaed5('0x43')]);var _0x45da73={'where':_0x302e43[_0xaed5('0x3e')]};return db[_0xaed5('0x2c')][_0xaed5('0x1d')](_0x45da73)[_0xaed5('0x26')](function(_0x350c1b){_0x58cb55['count']=_0x350c1b;if(_0x15db0b[_0xaed5('0x33')]['includeAll']){_0x302e43[_0xaed5('0x44')]=[{'all':!![]}];}return db[_0xaed5('0x2c')][_0xaed5('0x45')](_0x302e43);})[_0xaed5('0x26')](function(_0x29d738){_0x58cb55[_0xaed5('0x46')]=_0x29d738;return _0x58cb55;})[_0xaed5('0x26')](respondWithFilteredResult(_0x3abf0e,_0x302e43))[_0xaed5('0x47')](handleError(_0x3abf0e,null));};exports[_0xaed5('0x48')]=function(_0x427a06,_0x4e1bc1){var _0x46dc14={'raw':![],'where':{'id':_0x427a06['params']['id']}},_0x471503={};_0x471503[_0xaed5('0x31')]=_[_0xaed5('0x34')](db['AnalyticCustomReport'][_0xaed5('0x2d')]);_0x471503[_0xaed5('0x33')]=_[_0xaed5('0x34')](_0x427a06[_0xaed5('0x33')]);_0x471503[_0xaed5('0x35')]=_['intersection'](_0x471503[_0xaed5('0x31')],_0x471503['query']);_0x46dc14[_0xaed5('0x38')]=_['intersection'](_0x471503[_0xaed5('0x31')],qs[_0xaed5('0x37')](_0x427a06[_0xaed5('0x33')][_0xaed5('0x37')]));_0x46dc14[_0xaed5('0x38')]=_0x46dc14[_0xaed5('0x38')][_0xaed5('0x49')]?_0x46dc14[_0xaed5('0x38')]:_0x471503[_0xaed5('0x31')];if(_0x427a06[_0xaed5('0x33')]['includeAll']){_0x46dc14[_0xaed5('0x44')]=[{'all':!![]}];}_0x46dc14=_[_0xaed5('0x41')]({},_0x46dc14,_0x427a06['options']);return db[_0xaed5('0x2c')][_0xaed5('0x4a')](_0x46dc14)[_0xaed5('0x26')](handleEntityNotFound(_0x4e1bc1,null))['then'](respondWithResult(_0x4e1bc1,null))['catch'](handleError(_0x4e1bc1,null));};exports[_0xaed5('0x4b')]=function(_0x4287f3,_0x1946c1){return db[_0xaed5('0x2c')][_0xaed5('0x4b')](_0x4287f3['body'],{})[_0xaed5('0x26')](function(_0xe2de6d){var _0x281bec=_0x4287f3['user'][_0xaed5('0x23')]({'plain':!![]});if(!_0x281bec)throw new Error(_0xaed5('0x4c'));if(_0x281bec[_0xaed5('0x4d')]===_0xaed5('0x4e')){var _0x47038b=_0xe2de6d['get']({'plain':!![]});var _0x1d104a='Reports';return db[_0xaed5('0x4f')][_0xaed5('0x4a')]({'where':{'name':_0x1d104a,'userProfileId':_0x281bec[_0xaed5('0x50')]},'raw':!![]})[_0xaed5('0x26')](function(_0x2e6e68){if(_0x2e6e68&&_0x2e6e68['autoAssociation']===0x0){return db[_0xaed5('0x24')][_0xaed5('0x4b')]({'name':_0x47038b['name'],'resourceId':_0x47038b['id'],'type':_0xaed5('0x51'),'sectionId':_0x2e6e68['id']},{})[_0xaed5('0x26')](function(){return _0xe2de6d;});}else{return _0xe2de6d;}})[_0xaed5('0x47')](function(_0xbbd90b){logger[_0xaed5('0x27')](_0xaed5('0x52'),_0xbbd90b);throw _0xbbd90b;});}return _0xe2de6d;})[_0xaed5('0x26')](respondWithResult(_0x1946c1,0xc9))['catch'](handleError(_0x1946c1,null));};exports[_0xaed5('0x22')]=function(_0x5965a8,_0x2a7dd2){if(_0x5965a8[_0xaed5('0x53')]['id']){delete _0x5965a8[_0xaed5('0x53')]['id'];}return db[_0xaed5('0x2c')]['find']({'where':{'id':_0x5965a8[_0xaed5('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a7dd2,null))[_0xaed5('0x26')](saveUpdates(_0x5965a8[_0xaed5('0x53')],null))[_0xaed5('0x26')](respondWithResult(_0x2a7dd2,null))[_0xaed5('0x47')](handleError(_0x2a7dd2,null));};exports['destroy']=function(_0x3d80c8,_0xbb0363){return db['AnalyticCustomReport'][_0xaed5('0x4a')]({'where':{'id':_0x3d80c8[_0xaed5('0x54')]['id']}})[_0xaed5('0x26')](handleEntityNotFound(_0xbb0363,null))[_0xaed5('0x26')](removeEntity(_0xbb0363,null))[_0xaed5('0x47')](handleError(_0xbb0363,null));};exports[_0xaed5('0x55')]=function(_0x5c5c52,_0x4828f0){var _0x14d05f=0xa;var _0x229624=[_0xaed5('0x56'),'left_join','right_join','cross_join'];var _0x505e0d={'SUM':_0xaed5('0x57'),'COUNT':_0xaed5('0x58'),'COUNT DISTINCT':_0xaed5('0x59'),'MAX':_0xaed5('0x5a'),'MIN':_0xaed5('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaed5('0x5c'),'GROUP_CONCAT DESC':_0xaed5('0x5d')};var _0x2f95c6={'SEC_TO_TIME':_0xaed5('0x5e'),'DATE':_0xaed5('0x5f'),'HOUR':_0xaed5('0x60'),'ROUND':_0xaed5('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xabd9c1=function(_0x416be7){return!_[_0xaed5('0x62')]([_0xaed5('0x63'),_0xaed5('0x64'),_0xaed5('0x65'),_0xaed5('0x66')],_0x416be7);};var _0x45b919=function(_0x584bc9){if(!_0x584bc9||!_0x584bc9[_0xaed5('0x67')][_0xaed5('0x49')]){return'';}for(var _0x468007='(',_0x16adc0=0x0;_0x16adc0<_0x584bc9[_0xaed5('0x67')][_0xaed5('0x49')];_0x16adc0+=0x1){_0x16adc0>0x0&&(_0x468007+='\x20'+_0x584bc9['operator']+'\x20');_0x468007+=_0x584bc9['rules'][_0x16adc0][_0xaed5('0x68')]?_0x45b919(_0x584bc9[_0xaed5('0x67')][_0x16adc0][_0xaed5('0x68')]):_0x584bc9['rules'][_0x16adc0][_0xaed5('0x69')]+'\x20'+_0x584bc9['rules'][_0x16adc0]['condition']+(_0xabd9c1(_0x584bc9['rules'][_0x16adc0][_0xaed5('0x6a')])?'\x20'+_0x584bc9[_0xaed5('0x67')][_0x16adc0][_0xaed5('0x6b')]:'');}return _0x468007+')';};var _0x20a344={'where':{'id':_0x5c5c52[_0xaed5('0x54')]['id']}},_0x47b5af,_0x2765d,_0xbf7dc1,_0x29581f,_0x18be83;_0x20a344=_[_0xaed5('0x41')]({},_0x20a344,_0x5c5c52[_0xaed5('0x43')]);return db['AnalyticCustomReport']['find'](_0x20a344)['then'](function(_0x5aebe0){if(_0x5aebe0){_0x47b5af=_0x5aebe0;return _0x5aebe0[_0xaed5('0x6c')]();}return null;})['then'](function(_0x105432){if(_0x105432){if(!_0x105432[_0xaed5('0x49')]){throw new db[(_0xaed5('0x6d'))][(_0xaed5('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2765d=_0x105432;return db[_0xaed5('0x6f')][_0xaed5('0x45')]({'raw':!![]});}return null;})['then'](function(_0x387342){if(_0x387342){_0xbf7dc1=_[_0xaed5('0x70')](_0x387342,'id');var _0x10d5d6;var _0x4c912e=squel['select']();_0x4c912e['from'](_0x47b5af[_0xaed5('0x71')]);for(var _0x2d6191=0x0;_0x2d6191<_0x2765d[_0xaed5('0x49')];_0x2d6191+=0x1){_0x10d5d6=_0x2765d[_0x2d6191][_0xaed5('0x72')]?_0xbf7dc1[_0x2765d[_0x2d6191]['MetricId']]['metric']:_0x2765d[_0x2d6191][_0xaed5('0x69')];_0x10d5d6=_0x2765d[_0x2d6191][_0xaed5('0x73')]?_['replace'](_0x505e0d[_0x2765d[_0x2d6191][_0xaed5('0x73')]],'%s',_0x10d5d6):_0x10d5d6;_0x10d5d6=_0x2765d[_0x2d6191]['format']?_[_0xaed5('0x74')](_0x2f95c6[_0x2765d[_0x2d6191]['format']],'%s',_0x10d5d6):_0x10d5d6;if(_0x2765d[_0x2d6191]['groupBy']){_0x4c912e[_0xaed5('0x68')](_0x10d5d6);}_0x2765d[_0x2d6191][_0xaed5('0x75')]&&_0x4c912e[_0xaed5('0x3c')](_0x10d5d6,_0x2765d[_0x2d6191][_0xaed5('0x75')]===_0xaed5('0x76')?![]:!![]);_0x4c912e[_0xaed5('0x69')](_0x10d5d6,_0x2765d[_0x2d6191][_0xaed5('0x77')]||_0x10d5d6);}if(_0x47b5af[_0xaed5('0x78')]){_0x47b5af[_0xaed5('0x78')]=JSON['parse'](_0x47b5af['joins']);for(var _0x4f8dc4=0x0;_0x4f8dc4<_0x47b5af[_0xaed5('0x78')]['length'];_0x4f8dc4+=0x1){if(_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x2f')]&&_[_0xaed5('0x62')](_0x229624,_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x2f')])&&_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x79')]&&_0x47b5af['joins'][_0x4f8dc4]['foreignTable']&&_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x7a')]){_0x4c912e[_0x47b5af[_0xaed5('0x78')][_0x4f8dc4]['type']](_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x7b')],null,util[_0xaed5('0x7c')]('%s.%s\x20=\x20%s.%s',_0x47b5af['table'],_0x47b5af['joins'][_0x4f8dc4][_0xaed5('0x79')],_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x7b')],_0x47b5af[_0xaed5('0x78')][_0x4f8dc4][_0xaed5('0x7a')]));}}}if(_0x47b5af[_0xaed5('0x7d')]){_0x47b5af[_0xaed5('0x7d')]=JSON['parse'](_0x47b5af[_0xaed5('0x7d')]);_0x4c912e[_0xaed5('0x3e')](_0x45b919(_0x47b5af[_0xaed5('0x7d')][_0xaed5('0x68')]));}_0x18be83=_0x4c912e[_0xaed5('0x7e')]();_0x4c912e[_0xaed5('0x3b')](_0x14d05f);_0x4c912e[_0xaed5('0x1b')](0x0);logger[_0xaed5('0x7f')]('Limited\x20Query:',_0x4c912e[_0xaed5('0x80')]());return dbH[_0xaed5('0x81')][_0xaed5('0x33')](_0x4c912e[_0xaed5('0x80')](),{'type':dbH[_0xaed5('0x81')]['QueryTypes']['SELECT']});}})[_0xaed5('0x26')](respondWithResult(_0x4828f0,null))[_0xaed5('0x47')](handleError(_0x4828f0,null));};function runReport(_0x4d3634,_0x43c2cf,_0x598ba5){var _0x185fe4=_0x43c2cf['name'];var _0x34e119=0xa;var _0x1353f9=[_0xaed5('0x56'),_0xaed5('0x82'),'right_join',_0xaed5('0x83')];var _0x39b2b4={'SUM':_0xaed5('0x57'),'COUNT':_0xaed5('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xaed5('0x5b'),'AVG':_0xaed5('0x84'),'GROUP_CONCAT':_0xaed5('0x85'),'GROUP_CONCAT ASC':_0xaed5('0x5c'),'GROUP_CONCAT DESC':_0xaed5('0x5d')};var _0x4763ff={'SEC_TO_TIME':_0xaed5('0x5e'),'DATE':'DATE(%s)','HOUR':_0xaed5('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xaed5('0x86')};var _0x3b9f83=function(_0x5257ac){return!_[_0xaed5('0x62')](['IS\x20NULL',_0xaed5('0x64'),_0xaed5('0x65'),_0xaed5('0x66')],_0x5257ac);};var _0xda9468=function(_0x196d4f){if(!_0x196d4f||!_0x196d4f[_0xaed5('0x67')][_0xaed5('0x49')]){return'';}for(var _0x33246a='(',_0x4244a9=0x0;_0x4244a9<_0x196d4f[_0xaed5('0x67')]['length'];_0x4244a9+=0x1){_0x4244a9>0x0&&(_0x33246a+='\x20'+_0x196d4f[_0xaed5('0x87')]+'\x20');_0x33246a+=_0x196d4f[_0xaed5('0x67')][_0x4244a9]['group']?_0xda9468(_0x196d4f[_0xaed5('0x67')][_0x4244a9][_0xaed5('0x68')]):_0x196d4f['rules'][_0x4244a9][_0xaed5('0x69')]+'\x20'+_0x196d4f['rules'][_0x4244a9]['condition']+(_0x3b9f83(_0x196d4f[_0xaed5('0x67')][_0x4244a9][_0xaed5('0x6a')])?'\x20'+_0x196d4f[_0xaed5('0x67')][_0x4244a9]['value']:'');}return _0x33246a+')';};var _0x3dc4ed={'where':{'id':_0x4d3634['id']}},_0x4280d3,_0x320018,_0x412ab2,_0x150aad,_0x12a97b;_0x3dc4ed=_[_0xaed5('0x41')]({},_0x3dc4ed,_0x598ba5);return db[_0xaed5('0x2c')]['find'](_0x3dc4ed)[_0xaed5('0x26')](function(_0x3a37f4){if(_0x3a37f4){_0x4280d3=_0x3a37f4;return _0x3a37f4[_0xaed5('0x6c')]();}return null;})['then'](function(_0x17c8ea){if(_0x17c8ea){if(!_0x17c8ea[_0xaed5('0x49')]){throw new db[(_0xaed5('0x6d'))]['ValidationErrorItem'](_0xaed5('0x88'),0x193);}_0x320018=_0x17c8ea;return db[_0xaed5('0x6f')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x245fdc){if(_0x245fdc){_0x412ab2=_[_0xaed5('0x70')](_0x245fdc,'id');var _0x3a4aa6;var _0x36653b=squel[_0xaed5('0x89')]();_0x36653b[_0xaed5('0x8a')](_0x4280d3[_0xaed5('0x71')]);for(var _0x5773de=0x0;_0x5773de<_0x320018[_0xaed5('0x49')];_0x5773de+=0x1){_0x3a4aa6=_0x320018[_0x5773de][_0xaed5('0x72')]?_0x412ab2[_0x320018[_0x5773de][_0xaed5('0x72')]][_0xaed5('0x8b')]:_0x320018[_0x5773de]['field'];_0x3a4aa6=_0x320018[_0x5773de][_0xaed5('0x73')]?_['replace'](_0x39b2b4[_0x320018[_0x5773de]['function']],'%s',_0x3a4aa6):_0x3a4aa6;_0x3a4aa6=_0x320018[_0x5773de][_0xaed5('0x7c')]?_[_0xaed5('0x74')](_0x4763ff[_0x320018[_0x5773de][_0xaed5('0x7c')]],'%s',_0x3a4aa6):_0x3a4aa6;if(_0x320018[_0x5773de][_0xaed5('0x8c')]){_0x36653b[_0xaed5('0x68')](_0x3a4aa6);}_0x320018[_0x5773de][_0xaed5('0x75')]&&_0x36653b[_0xaed5('0x3c')](_0x3a4aa6,_0x320018[_0x5773de][_0xaed5('0x75')]==='DESC'?![]:!![]);_0x36653b['field'](_0x3a4aa6,_0x320018[_0x5773de]['alias']||_0x3a4aa6);}if(_0x4280d3[_0xaed5('0x78')]){_0x4280d3[_0xaed5('0x78')]=JSON['parse'](_0x4280d3['joins']);for(var _0x48d0a9=0x0;_0x48d0a9<_0x4280d3['joins'][_0xaed5('0x49')];_0x48d0a9+=0x1){if(_0x4280d3[_0xaed5('0x78')][_0x48d0a9]['type']&&_[_0xaed5('0x62')](_0x1353f9,_0x4280d3[_0xaed5('0x78')][_0x48d0a9][_0xaed5('0x2f')])&&_0x4280d3[_0xaed5('0x78')][_0x48d0a9][_0xaed5('0x79')]&&_0x4280d3[_0xaed5('0x78')][_0x48d0a9][_0xaed5('0x7b')]&&_0x4280d3[_0xaed5('0x78')][_0x48d0a9][_0xaed5('0x7a')]){_0x36653b[_0x4280d3['joins'][_0x48d0a9][_0xaed5('0x2f')]](_0x4280d3['joins'][_0x48d0a9][_0xaed5('0x7b')],null,util['format'](_0xaed5('0x8d'),_0x4280d3[_0xaed5('0x71')],_0x4280d3[_0xaed5('0x78')][_0x48d0a9]['parentKey'],_0x4280d3[_0xaed5('0x78')][_0x48d0a9][_0xaed5('0x7b')],_0x4280d3[_0xaed5('0x78')][_0x48d0a9][_0xaed5('0x7a')]));}}}if(_0x4280d3[_0xaed5('0x7d')]){_0x4280d3['conditions']=JSON['parse'](_0x4280d3[_0xaed5('0x7d')]);_0x36653b[_0xaed5('0x3e')](_0xda9468(_0x4280d3['conditions'][_0xaed5('0x68')]));}_0x12a97b=_0x36653b[_0xaed5('0x7e')]();_0x36653b[_0xaed5('0x3b')](_0x34e119);_0x36653b[_0xaed5('0x1b')](0x0);return;}})[_0xaed5('0x26')](function(){if(_0x43c2cf[_0xaed5('0x8e')]==='web'){return null;}var _0x2fcf22=_[_0xaed5('0x41')](_0x43c2cf,{'name':_0x43c2cf[_0xaed5('0x8f')]||_0x43c2cf[_0xaed5('0x32')]||_0x4280d3[_0xaed5('0x32')],'basename':_0x185fe4,'savename':util[_0xaed5('0x7c')](_0xaed5('0x90'),_0x43c2cf[_0xaed5('0x32')]||_0x4280d3[_0xaed5('0x32')],require(_0xaed5('0x91'))['generate'](0x4),_0x43c2cf[_0xaed5('0x8e')]||_0xaed5('0x92')),'reportId':_0x4280d3['id'],'reportType':'custom'});return db[_0xaed5('0x93')][_0xaed5('0x4b')](_0x2fcf22,{'raw':!![]});})['then'](function(_0x32a7e4){if(_0x4280d3[_0xaed5('0x71')]===_0xaed5('0x94')){_0x12a97b[_0xaed5('0x3e')](_0x4280d3[_0xaed5('0x71')]+_0xaed5('0x95'),_0x43c2cf[_0xaed5('0x96')],_0x43c2cf[_0xaed5('0x97')]);}else{_0x12a97b[_0xaed5('0x3e')](_0x4280d3[_0xaed5('0x71')]+_0xaed5('0x98'),_0x43c2cf['startDate'],_0x43c2cf[_0xaed5('0x97')]);}if(_0x32a7e4){logger[_0xaed5('0x99')](_0xaed5('0x9a'),_0x12a97b[_0xaed5('0x80')]());require(_0xaed5('0x9b'))[_0xaed5('0x9c')](path[_0xaed5('0x56')](__dirname,_0xaed5('0x9d'),_0x32a7e4[_0xaed5('0x8e')]),[_0x32a7e4['id'],_0x12a97b[_0xaed5('0x80')](),path[_0xaed5('0x56')](__dirname,_0xaed5('0x9e'),_0x32a7e4[_0xaed5('0x9f')]),_0x185fe4]);return _0x32a7e4;}else{var _0x2102d4=squel[_0xaed5('0x89')]();_0x2102d4[_0xaed5('0x8a')]('('+_0x12a97b[_0xaed5('0x80')]()+')',_0xaed5('0xa0'));_0x2102d4[_0xaed5('0x69')](_0xaed5('0xa1'),'count');_0x12a97b[_0xaed5('0x3b')](_0x43c2cf[_0xaed5('0x3b')]||_0x34e119);_0x12a97b[_0xaed5('0x1b')](_0x43c2cf['offset']||0x0);return dbH['sequelize']['query'](_0x2102d4[_0xaed5('0x80')](),{'type':dbH[_0xaed5('0x81')][_0xaed5('0xa2')]['SELECT']})['then'](function(_0x5441cd){if(!_0x5441cd[_0xaed5('0x49')]){_0x150aad=0x0;}else{_0x150aad=_0x5441cd[0x0][_0xaed5('0x1d')]||0x0;}return dbH['sequelize'][_0xaed5('0x33')](_0x12a97b['toString'](),{'type':dbH[_0xaed5('0x81')][_0xaed5('0xa2')][_0xaed5('0xa3')]});})[_0xaed5('0x26')](function(_0x1cb2cd){return{'rows':_0x1cb2cd||[],'count':_0x150aad};});}});}exports[_0xaed5('0xa4')]=function(_0x3f032c,_0x336f6e){return runReport(_0x3f032c[_0xaed5('0x54')],_0x3f032c[_0xaed5('0x33')],_0x3f032c['options'])[_0xaed5('0x26')](respondWithResult(_0x336f6e,null))[_0xaed5('0x47')](handleError(_0x336f6e,null));};exports['runReport']=runReport;exports['query']=function(_0x304d38,_0x2292d5){var _0x2002f9=0xa;var _0x97e1ad=[_0xaed5('0x56'),_0xaed5('0x82'),_0xaed5('0xa5'),_0xaed5('0x83')];var _0x3cccdb={'SUM':'SUM(%s)','COUNT':_0xaed5('0x58'),'COUNT DISTINCT':_0xaed5('0x59'),'MAX':_0xaed5('0x5a'),'MIN':_0xaed5('0x5b'),'AVG':_0xaed5('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaed5('0x5c'),'GROUP_CONCAT DESC':_0xaed5('0x5d')};var _0x1e57b4={'SEC_TO_TIME':_0xaed5('0x5e'),'DATE':_0xaed5('0x5f'),'HOUR':_0xaed5('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ef500=function(_0x523a88){return!_['includes']([_0xaed5('0x63'),_0xaed5('0x64'),_0xaed5('0x65'),_0xaed5('0x66')],_0x523a88);};var _0x559214=function(_0x48c450){if(!_0x48c450||!_0x48c450[_0xaed5('0x67')][_0xaed5('0x49')]){return'';}for(var _0x155f01='(',_0x5214bc=0x0;_0x5214bc<_0x48c450[_0xaed5('0x67')]['length'];_0x5214bc+=0x1){_0x5214bc>0x0&&(_0x155f01+='\x20'+_0x48c450[_0xaed5('0x87')]+'\x20');_0x155f01+=_0x48c450[_0xaed5('0x67')][_0x5214bc][_0xaed5('0x68')]?_0x559214(_0x48c450[_0xaed5('0x67')][_0x5214bc][_0xaed5('0x68')]):_0x48c450['rules'][_0x5214bc][_0xaed5('0x69')]+'\x20'+_0x48c450[_0xaed5('0x67')][_0x5214bc][_0xaed5('0x6a')]+(_0x2ef500(_0x48c450['rules'][_0x5214bc][_0xaed5('0x6a')])?'\x20'+_0x48c450[_0xaed5('0x67')][_0x5214bc][_0xaed5('0x6b')]:'');}return _0x155f01+')';};var _0x21a837={'where':{'id':_0x304d38[_0xaed5('0x54')]['id']}},_0x59058a,_0x51d4f1,_0x5aad3d,_0x4eceb7,_0x153077;_0x21a837=_[_0xaed5('0x41')]({},_0x21a837,_0x304d38[_0xaed5('0x43')]);return db[_0xaed5('0x2c')][_0xaed5('0x4a')](_0x21a837)[_0xaed5('0x26')](function(_0x41623c){if(_0x41623c){_0x59058a=_0x41623c;return _0x41623c['getFields']();}return null;})[_0xaed5('0x26')](function(_0x3de961){if(_0x3de961){if(!_0x3de961[_0xaed5('0x49')]){throw new db[(_0xaed5('0x6d'))][(_0xaed5('0x6e'))](_0xaed5('0x88'),0x193);}_0x51d4f1=_0x3de961;return db[_0xaed5('0x6f')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x37bf5c){if(_0x37bf5c){_0x5aad3d=_[_0xaed5('0x70')](_0x37bf5c,'id');var _0x2f4543;var _0x1d4ca4=squel[_0xaed5('0x89')]();_0x1d4ca4[_0xaed5('0x8a')](_0x59058a[_0xaed5('0x71')]);for(var _0x30be31=0x0;_0x30be31<_0x51d4f1[_0xaed5('0x49')];_0x30be31+=0x1){_0x2f4543=_0x51d4f1[_0x30be31][_0xaed5('0x72')]?_0x5aad3d[_0x51d4f1[_0x30be31][_0xaed5('0x72')]][_0xaed5('0x8b')]:_0x51d4f1[_0x30be31]['field'];_0x2f4543=_0x51d4f1[_0x30be31][_0xaed5('0x73')]?_['replace'](_0x3cccdb[_0x51d4f1[_0x30be31]['function']],'%s',_0x2f4543):_0x2f4543;_0x2f4543=_0x51d4f1[_0x30be31][_0xaed5('0x7c')]?_[_0xaed5('0x74')](_0x1e57b4[_0x51d4f1[_0x30be31][_0xaed5('0x7c')]],'%s',_0x2f4543):_0x2f4543;if(_0x51d4f1[_0x30be31]['groupBy']){_0x1d4ca4[_0xaed5('0x68')](_0x2f4543);}_0x51d4f1[_0x30be31][_0xaed5('0x75')]&&_0x1d4ca4[_0xaed5('0x3c')](_0x2f4543,_0x51d4f1[_0x30be31]['orderBy']===_0xaed5('0x76')?![]:!![]);_0x1d4ca4[_0xaed5('0x69')](_0x2f4543,_0x51d4f1[_0x30be31][_0xaed5('0x77')]||_0x2f4543);}if(_0x59058a['joins']){_0x59058a[_0xaed5('0x78')]=JSON['parse'](_0x59058a['joins']);for(var _0x455109=0x0;_0x455109<_0x59058a[_0xaed5('0x78')][_0xaed5('0x49')];_0x455109+=0x1){if(_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x2f')]&&_['includes'](_0x97e1ad,_0x59058a[_0xaed5('0x78')][_0x455109]['type'])&&_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x79')]&&_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x7b')]&&_0x59058a['joins'][_0x455109][_0xaed5('0x7a')]){_0x1d4ca4[_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x2f')]](_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x7b')],null,util[_0xaed5('0x7c')](_0xaed5('0x8d'),_0x59058a['table'],_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x79')],_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x7b')],_0x59058a[_0xaed5('0x78')][_0x455109][_0xaed5('0x7a')]));}}}if(_0x59058a[_0xaed5('0x7d')]){_0x59058a[_0xaed5('0x7d')]=JSON['parse'](_0x59058a['conditions']);_0x1d4ca4[_0xaed5('0x3e')](_0x559214(_0x59058a[_0xaed5('0x7d')][_0xaed5('0x68')]));}_0x153077=_0x1d4ca4[_0xaed5('0x7e')]();_0x1d4ca4[_0xaed5('0x3b')](_0x2002f9);_0x1d4ca4[_0xaed5('0x1b')](0x0);logger[_0xaed5('0x7f')](_0xaed5('0xa6'),_0x1d4ca4[_0xaed5('0x80')]());return dbH['sequelize']['query'](_0x1d4ca4[_0xaed5('0x80')](),{'type':dbH[_0xaed5('0x81')]['QueryTypes'][_0xaed5('0xa3')]});}})['then'](function(){return{'sql':_0x153077[_0xaed5('0x80')]()};})[_0xaed5('0x26')](respondWithResult(_0x2292d5,null))[_0xaed5('0x47')](handleError(_0x2292d5,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9098a80..4b2f7eb 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 _0xb603=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','util','api','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb603,0x7b));var _0x3b60=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xb603[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require(_0x3b60('0x0'));var logger=require('../../config/logger')(_0x3b60('0x1'));var moment=require('moment');var BPromise=require(_0x3b60('0x2'));var rp=require(_0x3b60('0x3'));var fs=require('fs');var path=require(_0x3b60('0x4'));var rimraf=require(_0x3b60('0x5'));var config=require(_0x3b60('0x6'));var attributes=require(_0x3b60('0x7'));module['exports']=function(_0x49596b,_0x4fec35){return _0x49596b[_0x3b60('0x8')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f35=['analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport'];(function(_0x28a74b,_0x256e2f){var _0x313a33=function(_0x2cfe45){while(--_0x2cfe45){_0x28a74b['push'](_0x28a74b['shift']());}};_0x313a33(++_0x256e2f);}(_0x7f35,0x1ed));var _0x57f3=function(_0x37a507,_0x16580a){_0x37a507=_0x37a507-0x0;var _0x368a1a=_0x7f35[_0x37a507];return _0x368a1a;};'use strict';var _=require(_0x57f3('0x0'));var util=require(_0x57f3('0x1'));var logger=require(_0x57f3('0x2'))('api');var moment=require(_0x57f3('0x3'));var BPromise=require(_0x57f3('0x4'));var rp=require(_0x57f3('0x5'));var fs=require('fs');var path=require(_0x57f3('0x6'));var rimraf=require(_0x57f3('0x7'));var config=require(_0x57f3('0x8'));var attributes=require(_0x57f3('0x9'));module['exports']=function(_0x31fdd2,_0x41fc27){return _0x31fdd2['define'](_0x57f3('0xa'),attributes,{'tableName':_0x57f3('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 7a61ebe..c647f1a 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 _0xd25c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x49d5a6,_0x3a1f12){var _0x56d4fa=function(_0x1faeb8){while(--_0x1faeb8){_0x49d5a6['push'](_0x49d5a6['shift']());}};_0x56d4fa(++_0x3a1f12);}(_0xd25c,0x11a));var _0xcd25=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd25c[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xcd25('0x0'));var util=require('util');var moment=require(_0xcd25('0x1'));var BPromise=require(_0xcd25('0x2'));var rs=require(_0xcd25('0x3'));var fs=require('fs');var Redis=require(_0xcd25('0x4'));var db=require(_0xcd25('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd25('0x6'))(_0xcd25('0x7'));var config=require(_0xcd25('0x8'));var jayson=require(_0xcd25('0x9'));var client=jayson[_0xcd25('0xa')][_0xcd25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce790,_0x57c19f,_0x3bba6f){return new BPromise(function(_0x2fc27e,_0x5c031c){return client[_0xcd25('0xc')](_0x4ce790,_0x3bba6f)['then'](function(_0x15c5e7){logger[_0xcd25('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57c19f,_0xcd25('0xe'));logger[_0xcd25('0xf')](_0xcd25('0x10'),_0x57c19f,_0xcd25('0xe'),JSON[_0xcd25('0x11')](_0x15c5e7));if(_0x15c5e7[_0xcd25('0x12')]){if(_0x15c5e7['error'][_0xcd25('0x13')]===0x1f4){logger[_0xcd25('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57c19f,_0x15c5e7[_0xcd25('0x12')][_0xcd25('0x14')]);return _0x5c031c(_0x15c5e7[_0xcd25('0x12')]['message']);}logger[_0xcd25('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57c19f,_0x15c5e7[_0xcd25('0x12')]['message']);return _0x2fc27e(_0x15c5e7[_0xcd25('0x12')][_0xcd25('0x14')]);}else{logger['info'](_0xcd25('0x15'),_0x57c19f,_0xcd25('0xe'));_0x2fc27e(_0x15c5e7[_0xcd25('0x16')][_0xcd25('0x14')]);}})[_0xcd25('0x17')](function(_0x25bf0d){logger[_0xcd25('0x12')](_0xcd25('0x15'),_0x57c19f,_0x25bf0d);_0x5c031c(_0x25bf0d);});});} \ No newline at end of file +var _0x8253=['request','then','info','debug','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','request\x20sent','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x5cd883,_0x3d1e2a){var _0x23bace=function(_0x16293a){while(--_0x16293a){_0x5cd883['push'](_0x5cd883['shift']());}};_0x23bace(++_0x3d1e2a);}(_0x8253,0x1a2));var _0x3825=function(_0x451980,_0x2ad060){_0x451980=_0x451980-0x0;var _0x3a66cf=_0x8253[_0x451980];return _0x3a66cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3825('0x0'));var BPromise=require(_0x3825('0x1'));var rs=require(_0x3825('0x2'));var fs=require('fs');var Redis=require(_0x3825('0x3'));var db=require(_0x3825('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3825('0x5'));var jayson=require(_0x3825('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28521b,_0x2005fb,_0x3b8690){return new BPromise(function(_0x2fb04d,_0x1c0847){return client[_0x3825('0x7')](_0x28521b,_0x3b8690)[_0x3825('0x8')](function(_0x2b3245){logger[_0x3825('0x9')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2005fb,'request\x20sent');logger[_0x3825('0xa')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2005fb,'request\x20sent',JSON['stringify'](_0x2b3245));if(_0x2b3245['error']){if(_0x2b3245[_0x3825('0xb')][_0x3825('0xc')]===0x1f4){logger[_0x3825('0xb')](_0x3825('0xd'),_0x2005fb,_0x2b3245[_0x3825('0xb')]['message']);return _0x1c0847(_0x2b3245[_0x3825('0xb')][_0x3825('0xe')]);}logger[_0x3825('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2005fb,_0x2b3245[_0x3825('0xb')]['message']);return _0x2fb04d(_0x2b3245['error'][_0x3825('0xe')]);}else{logger[_0x3825('0x9')](_0x3825('0xd'),_0x2005fb,_0x3825('0xf'));_0x2fb04d(_0x2b3245['result'][_0x3825('0xe')]);}})[_0x3825('0x10')](function(_0x2d4e4a){logger[_0x3825('0xb')](_0x3825('0xd'),_0x2005fb,_0x2d4e4a);_0x1c0847(_0x2d4e4a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7d60f32..33f31fd 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 _0x2853=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports'];(function(_0x4a7cb9,_0x42df8c){var _0x4bfd62=function(_0x5016b5){while(--_0x5016b5){_0x4a7cb9['push'](_0x4a7cb9['shift']());}};_0x4bfd62(++_0x42df8c);}(_0x2853,0xea));var _0x3285=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2853[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x3285('0x0'));var path=require(_0x3285('0x1'));var timeout=require(_0x3285('0x2'));var express=require(_0x3285('0x3'));var router=express[_0x3285('0x4')]();var fs_extra=require(_0x3285('0x5'));var auth=require(_0x3285('0x6'));var interaction=require(_0x3285('0x7'));var config=require(_0x3285('0x8'));var controller=require(_0x3285('0x9'));router['get']('/',auth[_0x3285('0xa')](),controller['index']);router[_0x3285('0xb')](_0x3285('0xc'),auth[_0x3285('0xa')](),controller[_0x3285('0xd')]);router[_0x3285('0xb')](_0x3285('0xe'),auth[_0x3285('0xa')](),controller[_0x3285('0xf')]);router[_0x3285('0xb')](_0x3285('0x10'),auth[_0x3285('0xa')](),controller[_0x3285('0x11')]);router['get'](_0x3285('0x12'),auth[_0x3285('0xa')](),controller[_0x3285('0x13')]);router[_0x3285('0x14')]('/',auth[_0x3285('0xa')](),controller[_0x3285('0x15')]);router[_0x3285('0x16')](_0x3285('0xc'),auth[_0x3285('0xa')](),controller[_0x3285('0x17')]);router['delete']('/:id',auth[_0x3285('0xa')](),controller[_0x3285('0x18')]);module[_0x3285('0x19')]=router; \ No newline at end of file +var _0xd5c7=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','update','delete','destroy'];(function(_0x1e7edc,_0x4394c3){var _0x56dcae=function(_0x5208c8){while(--_0x5208c8){_0x1e7edc['push'](_0x1e7edc['shift']());}};_0x56dcae(++_0x4394c3);}(_0xd5c7,0x180));var _0x7d5c=function(_0x1c7e28,_0x30ea10){_0x1c7e28=_0x1c7e28-0x0;var _0x25f956=_0xd5c7[_0x1c7e28];return _0x25f956;};'use strict';var multer=require(_0x7d5c('0x0'));var util=require('util');var path=require(_0x7d5c('0x1'));var timeout=require(_0x7d5c('0x2'));var express=require(_0x7d5c('0x3'));var router=express[_0x7d5c('0x4')]();var fs_extra=require(_0x7d5c('0x5'));var auth=require(_0x7d5c('0x6'));var interaction=require(_0x7d5c('0x7'));var config=require(_0x7d5c('0x8'));var controller=require(_0x7d5c('0x9'));router[_0x7d5c('0xa')]('/',auth[_0x7d5c('0xb')](),controller[_0x7d5c('0xc')]);router[_0x7d5c('0xa')](_0x7d5c('0xd'),auth[_0x7d5c('0xb')](),controller[_0x7d5c('0xe')]);router[_0x7d5c('0xa')](_0x7d5c('0xf'),auth[_0x7d5c('0xb')](),controller[_0x7d5c('0x10')]);router[_0x7d5c('0xa')](_0x7d5c('0x11'),auth['isAuthenticated'](),controller[_0x7d5c('0x12')]);router[_0x7d5c('0xa')]('/:id/query',auth[_0x7d5c('0xb')](),controller[_0x7d5c('0x13')]);router[_0x7d5c('0x14')]('/',auth[_0x7d5c('0xb')](),controller['create']);router['put']('/:id',auth[_0x7d5c('0xb')](),controller[_0x7d5c('0x15')]);router[_0x7d5c('0x16')](_0x7d5c('0xd'),auth[_0x7d5c('0xb')](),controller[_0x7d5c('0x17')]);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 4256745..7825041 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x433ab5,_0x16e711){var _0x315911=function(_0x2d24a2){while(--_0x2d24a2){_0x433ab5['push'](_0x433ab5['shift']());}};_0x315911(++_0x16e711);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x850605,_0x278e88){_0x850605=_0x850605-0x0;var _0x7eafa1=_0x3eea[_0x850605];return _0x7eafa1;};'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 +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x35cb74,_0x141a20){_0x35cb74=_0x35cb74-0x0;var _0x48acbf=_0x8ef6[_0x35cb74];return _0x48acbf;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'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 5f46351..5e18100 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xabce[_0x3899d1];return _0xeb4a7d;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xabce[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 595e920..774ef84 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 _0x4cff=['exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x1f2f86,_0x57341c){var _0x43a6b3=function(_0x30430b){while(--_0x30430b){_0x1f2f86['push'](_0x1f2f86['shift']());}};_0x43a6b3(++_0x57341c);}(_0x4cff,0xe8));var _0xf4cf=function(_0x1e1850,_0x47f3e1){_0x1e1850=_0x1e1850-0x0;var _0x36458d=_0x4cff[_0x1e1850];return _0x36458d;};'use strict';var _=require('lodash');var util=require(_0xf4cf('0x0'));var logger=require(_0xf4cf('0x1'))(_0xf4cf('0x2'));var moment=require('moment');var BPromise=require(_0xf4cf('0x3'));var rp=require(_0xf4cf('0x4'));var fs=require('fs');var path=require(_0xf4cf('0x5'));var rimraf=require('rimraf');var config=require(_0xf4cf('0x6'));var attributes=require(_0xf4cf('0x7'));module[_0xf4cf('0x8')]=function(_0x13031f,_0x297cba){return _0x13031f[_0xf4cf('0x9')](_0xf4cf('0xa'),attributes,{'tableName':_0xf4cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35e4=['lodash','util','../../config/logger','api','moment','bluebird','path','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x5848ef,_0x4010df){var _0x34ef2a=function(_0x467b36){while(--_0x467b36){_0x5848ef['push'](_0x5848ef['shift']());}};_0x34ef2a(++_0x4010df);}(_0x35e4,0x84));var _0x435e=function(_0x39705e,_0x452f5a){_0x39705e=_0x39705e-0x0;var _0xe408f3=_0x35e4[_0x39705e];return _0xe408f3;};'use strict';var _=require(_0x435e('0x0'));var util=require(_0x435e('0x1'));var logger=require(_0x435e('0x2'))(_0x435e('0x3'));var moment=require(_0x435e('0x4'));var BPromise=require(_0x435e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x435e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x435e('0x7')]=function(_0x5176d5,_0xa96d8c){return _0x5176d5[_0x435e('0x8')](_0x435e('0x9'),attributes,{'tableName':_0x435e('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 57b4fb4..78f2787 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 _0x1e44=['result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0x1e44,0xe9));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x41e4('0x0'));var moment=require('moment');var BPromise=require(_0x41e4('0x1'));var rs=require(_0x41e4('0x2'));var fs=require('fs');var Redis=require(_0x41e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x41e4('0x4'));var logger=require('../../config/logger')(_0x41e4('0x5'));var config=require(_0x41e4('0x6'));var jayson=require(_0x41e4('0x7'));var client=jayson[_0x41e4('0x8')][_0x41e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x103aa2,_0x5a2ada,_0x16fe0f){return new BPromise(function(_0x1b8151,_0x27b484){return client['request'](_0x103aa2,_0x16fe0f)[_0x41e4('0xa')](function(_0x2a12ef){logger[_0x41e4('0xb')](_0x41e4('0xc'),_0x5a2ada,_0x41e4('0xd'));logger[_0x41e4('0xe')](_0x41e4('0xf'),_0x5a2ada,'request\x20sent',JSON['stringify'](_0x2a12ef));if(_0x2a12ef['error']){if(_0x2a12ef[_0x41e4('0x10')][_0x41e4('0x11')]===0x1f4){logger[_0x41e4('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5a2ada,_0x2a12ef['error'][_0x41e4('0x12')]);return _0x27b484(_0x2a12ef[_0x41e4('0x10')][_0x41e4('0x12')]);}logger[_0x41e4('0x10')](_0x41e4('0xc'),_0x5a2ada,_0x2a12ef[_0x41e4('0x10')][_0x41e4('0x12')]);return _0x1b8151(_0x2a12ef[_0x41e4('0x10')][_0x41e4('0x12')]);}else{logger['info'](_0x41e4('0xc'),_0x5a2ada,_0x41e4('0xd'));_0x1b8151(_0x2a12ef[_0x41e4('0x13')]['message']);}})[_0x41e4('0x14')](function(_0x5912eb){logger['error'](_0x41e4('0xc'),_0x5a2ada,_0x5912eb);_0x27b484(_0x5912eb);});});} \ No newline at end of file +var _0xbaaf=['../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbaaf,0x111));var _0xfbaa=function(_0x5eff99,_0x39ad14){_0x5eff99=_0x5eff99-0x0;var _0x293de7=_0xbaaf[_0x5eff99];return _0x293de7;};'use strict';var _=require('lodash');var util=require(_0xfbaa('0x0'));var moment=require('moment');var BPromise=require(_0xfbaa('0x1'));var rs=require(_0xfbaa('0x2'));var fs=require('fs');var Redis=require(_0xfbaa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbaa('0x4'));var logger=require(_0xfbaa('0x5'))(_0xfbaa('0x6'));var config=require(_0xfbaa('0x7'));var jayson=require(_0xfbaa('0x8'));var client=jayson[_0xfbaa('0x9')][_0xfbaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ea1f6,_0x203006,_0x1c8a5e){return new BPromise(function(_0x516796,_0x4fd881){return client['request'](_0x2ea1f6,_0x1c8a5e)[_0xfbaa('0xb')](function(_0x490a2b){logger[_0xfbaa('0xc')](_0xfbaa('0xd'),_0x203006,_0xfbaa('0xe'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x203006,_0xfbaa('0xe'),JSON[_0xfbaa('0xf')](_0x490a2b));if(_0x490a2b['error']){if(_0x490a2b[_0xfbaa('0x10')]['code']===0x1f4){logger[_0xfbaa('0x10')](_0xfbaa('0xd'),_0x203006,_0x490a2b[_0xfbaa('0x10')][_0xfbaa('0x11')]);return _0x4fd881(_0x490a2b['error']['message']);}logger[_0xfbaa('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x203006,_0x490a2b['error']['message']);return _0x516796(_0x490a2b[_0xfbaa('0x10')]['message']);}else{logger[_0xfbaa('0xc')](_0xfbaa('0xd'),_0x203006,_0xfbaa('0xe'));_0x516796(_0x490a2b[_0xfbaa('0x12')]['message']);}})[_0xfbaa('0x13')](function(_0x4881fa){logger[_0xfbaa('0x10')](_0xfbaa('0xd'),_0x203006,_0x4881fa);_0x4fd881(_0x4881fa);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9cc91f3..770d9ac 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 _0x3a32=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','query','post','create','put','destroy','multer','util','path','connect-timeout'];(function(_0x1bd153,_0x3a3110){var _0x1f7f6c=function(_0x5f5670){while(--_0x5f5670){_0x1bd153['push'](_0x1bd153['shift']());}};_0x1f7f6c(++_0x3a3110);}(_0x3a32,0x65));var _0x23a3=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x3a32[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var path=require(_0x23a3('0x2'));var timeout=require(_0x23a3('0x3'));var express=require(_0x23a3('0x4'));var router=express['Router']();var fs_extra=require(_0x23a3('0x5'));var auth=require(_0x23a3('0x6'));var interaction=require(_0x23a3('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x23a3('0x8')]('/',auth[_0x23a3('0x9')](),controller[_0x23a3('0xa')]);router[_0x23a3('0x8')](_0x23a3('0xb'),auth[_0x23a3('0x9')](),controller[_0x23a3('0xc')]);router[_0x23a3('0x8')](_0x23a3('0xd'),auth[_0x23a3('0x9')](),controller['preview']);router[_0x23a3('0x8')]('/:id/run',auth[_0x23a3('0x9')](),controller[_0x23a3('0xe')]);router[_0x23a3('0x8')](_0x23a3('0xf'),auth[_0x23a3('0x9')](),controller[_0x23a3('0x10')]);router[_0x23a3('0x11')]('/',auth[_0x23a3('0x9')](),controller[_0x23a3('0x12')]);router[_0x23a3('0x13')](_0x23a3('0xb'),auth[_0x23a3('0x9')](),controller['update']);router['delete'](_0x23a3('0xb'),auth[_0x23a3('0x9')](),controller[_0x23a3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1815=['isAuthenticated','index','/:id','show','/:id/preview','preview','post','create','update','delete','multer','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get'];(function(_0x24f611,_0x512b7c){var _0x2bc7a7=function(_0x3adaaa){while(--_0x3adaaa){_0x24f611['push'](_0x24f611['shift']());}};_0x2bc7a7(++_0x512b7c);}(_0x1815,0xa3));var _0x5181=function(_0x43fc7d,_0x97d6b2){_0x43fc7d=_0x43fc7d-0x0;var _0x2b568e=_0x1815[_0x43fc7d];return _0x2b568e;};'use strict';var multer=require(_0x5181('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5181('0x1'));var router=express[_0x5181('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5181('0x3'));var interaction=require(_0x5181('0x4'));var config=require('../../config/environment');var controller=require(_0x5181('0x5'));router[_0x5181('0x6')]('/',auth[_0x5181('0x7')](),controller[_0x5181('0x8')]);router[_0x5181('0x6')](_0x5181('0x9'),auth[_0x5181('0x7')](),controller[_0x5181('0xa')]);router[_0x5181('0x6')](_0x5181('0xb'),auth['isAuthenticated'](),controller[_0x5181('0xc')]);router[_0x5181('0x6')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['get']('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0x5181('0xd')]('/',auth[_0x5181('0x7')](),controller[_0x5181('0xe')]);router['put'](_0x5181('0x9'),auth[_0x5181('0x7')](),controller[_0x5181('0xf')]);router[_0x5181('0x10')](_0x5181('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0b9bcc9..2b52887 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 _0x77e3=['Loading','ENUM','manual','INTEGER','UNSIGNED','exports','STRING','pdf','xlsx','DATE'];(function(_0x99250c,_0x4603c0){var _0x3927d5=function(_0xa13c94){while(--_0xa13c94){_0x99250c['push'](_0x99250c['shift']());}};_0x3927d5(++_0x4603c0);}(_0x77e3,0x69));var _0x377e=function(_0x532577,_0x22e2fe){_0x532577=_0x532577-0x0;var _0x5fdc7e=_0x77e3[_0x532577];return _0x5fdc7e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x377e('0x0')]={'name':{'type':Sequelize[_0x377e('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x377e('0x2'),_0x377e('0x3')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x377e('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x377e('0x5')},'type':{'type':Sequelize[_0x377e('0x6')](_0x377e('0x7'),'scheduled'),'allowNull':![],'defaultValue':_0x377e('0x7')},'reportId':{'type':Sequelize[_0x377e('0x8')](0xb)[_0x377e('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x26c9=['Loading','manual','INTEGER','UNSIGNED','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0xab752c,_0xc3f85a){var _0x40553d=function(_0x471542){while(--_0x471542){_0xab752c['push'](_0xab752c['shift']());}};_0x40553d(++_0xc3f85a);}(_0x26c9,0x18a));var _0x926c=function(_0x19c02b,_0x13618a){_0x19c02b=_0x19c02b-0x0;var _0x42a649=_0x26c9[_0x19c02b];return _0x42a649;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x926c('0x0')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x926c('0x1')](_0x926c('0x2'),_0x926c('0x3'),_0x926c('0x4')),'allowNull':![],'defaultValue':_0x926c('0x2')},'savename':{'type':Sequelize[_0x926c('0x0')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x926c('0x5')]},'status':{'type':Sequelize[_0x926c('0x0')],'defaultValue':_0x926c('0x6')},'type':{'type':Sequelize[_0x926c('0x1')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x926c('0x7')},'reportId':{'type':Sequelize[_0x926c('0x8')](0xb)[_0x926c('0x9')]},'reportType':{'type':Sequelize[_0x926c('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index bfb28a9..614910c 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 _0x11f3=['fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x5f168c,_0x2b7e8e){var _0x405a03=function(_0x3bca4f){while(--_0x3bca4f){_0x5f168c['push'](_0x5f168c['shift']());}};_0x405a03(++_0x2b7e8e);}(_0x11f3,0x118));var _0x311f=function(_0x56fe68,_0x40fdef){_0x56fe68=_0x56fe68-0x0;var _0x1eeb3b=_0x11f3[_0x56fe68];return _0x1eeb3b;};'use strict';var emlformat=require(_0x311f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x311f('0x1'));var jsonpatch=require(_0x311f('0x2'));var rp=require(_0x311f('0x3'));var moment=require(_0x311f('0x4'));var BPromise=require(_0x311f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x311f('0x6'));var sox=require(_0x311f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x311f('0x8'));var _=require(_0x311f('0x9'));var squel=require(_0x311f('0xa'));var crypto=require(_0x311f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x311f('0xc'));var querystring=require(_0x311f('0xd'));var Papa=require(_0x311f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x311f('0xf'));var hardwareService=require(_0x311f('0x10'));var logger=require(_0x311f('0x11'))(_0x311f('0x12'));var utils=require('../../config/utils');var config=require(_0x311f('0x13'));var licenseUtil=require(_0x311f('0x14'));var db=require(_0x311f('0x15'))['db'];function respondWithStatusCode(_0x4c1d2b,_0x454f23){_0x454f23=_0x454f23||0xcc;return function(_0x3853b6){if(_0x3853b6){return _0x4c1d2b[_0x311f('0x16')](_0x454f23);}return _0x4c1d2b[_0x311f('0x17')](_0x454f23)[_0x311f('0x18')]();};}function respondWithResult(_0x59a9af,_0x588dc5){_0x588dc5=_0x588dc5||0xc8;return function(_0x569a5d){if(_0x569a5d){return _0x59a9af['status'](_0x588dc5)[_0x311f('0x19')](_0x569a5d);}};}function respondWithFilteredResult(_0x45205f,_0x4b62a3){return function(_0x5a3b46){if(_0x5a3b46){var _0x3ca013=typeof _0x4b62a3[_0x311f('0x1a')]===_0x311f('0x1b')&&typeof _0x4b62a3[_0x311f('0x1c')]===_0x311f('0x1b');var _0x20928a=_0x5a3b46['count'];var _0x599853=_0x3ca013?0x0:_0x4b62a3['offset'];var _0xe3dd85=_0x3ca013?_0x5a3b46[_0x311f('0x1d')]:_0x4b62a3[_0x311f('0x1a')]+_0x4b62a3[_0x311f('0x1c')];var _0x57d92f;if(_0xe3dd85>=_0x20928a){_0xe3dd85=_0x20928a;_0x57d92f=0xc8;}else{_0x57d92f=0xce;}_0x45205f[_0x311f('0x17')](_0x57d92f);return _0x45205f[_0x311f('0x1e')](_0x311f('0x1f'),_0x599853+'-'+_0xe3dd85+'/'+_0x20928a)['json'](_0x5a3b46);}return null;};}function patchUpdates(_0x16ad57){return function(_0x4c33e6){try{jsonpatch[_0x311f('0x20')](_0x4c33e6,_0x16ad57,!![]);}catch(_0x4e4daf){return BPromise[_0x311f('0x21')](_0x4e4daf);}return _0x4c33e6[_0x311f('0x22')]();};}function saveUpdates(_0x54a556,_0x8bdf81){return function(_0x40a4ea){if(_0x40a4ea){return _0x40a4ea[_0x311f('0x23')](_0x54a556)['then'](function(_0xed6471){return _0xed6471;});}return null;};}function removeEntity(_0x78b4f7,_0x1d2dc5){return function(_0x4cf0d0){if(_0x4cf0d0){return _0x4cf0d0['destroy']()[_0x311f('0x24')](function(){var _0xc5d64e=_0x4cf0d0[_0x311f('0x25')]({'plain':!![]});var _0x2e2ed1=_0x311f('0x26');return db['UserProfileResource'][_0x311f('0x27')]({'where':{'type':_0x2e2ed1,'resourceId':_0xc5d64e['id']}})[_0x311f('0x24')](function(){return _0x4cf0d0;});})[_0x311f('0x24')](function(){_0x78b4f7[_0x311f('0x17')](0xcc)[_0x311f('0x18')]();});}};}function handleEntityNotFound(_0x2871fa,_0x50cc7e){return function(_0x3d8112){if(!_0x3d8112){_0x2871fa['sendStatus'](0x194);}return _0x3d8112;};}function handleError(_0xfbfec5,_0x22d2fc){_0x22d2fc=_0x22d2fc||0x1f4;return function(_0x2060d2){logger[_0x311f('0x28')](_0x2060d2[_0x311f('0x29')]);if(_0x2060d2[_0x311f('0x2a')]){delete _0x2060d2['name'];}_0xfbfec5[_0x311f('0x17')](_0x22d2fc)[_0x311f('0x2b')](_0x2060d2);};}exports[_0x311f('0x2c')]=function(_0x4810cf,_0x18077c){var _0xd39ea5={},_0x539780={},_0x10521c={'count':0x0,'rows':[]};var _0x4391b1=_[_0x311f('0x2d')](db[_0x311f('0x2e')][_0x311f('0x2f')],function(_0x2661a0){return{'name':_0x2661a0[_0x311f('0x30')],'type':_0x2661a0[_0x311f('0x31')][_0x311f('0x32')]};});_0x539780['model']=_[_0x311f('0x2d')](_0x4391b1,_0x311f('0x2a'));_0x539780['query']=_[_0x311f('0x33')](_0x4810cf[_0x311f('0x34')]);_0x539780[_0x311f('0x35')]=_['intersection'](_0x539780[_0x311f('0x36')],_0x539780['query']);_0xd39ea5[_0x311f('0x37')]=_[_0x311f('0x38')](_0x539780[_0x311f('0x36')],qs[_0x311f('0x39')](_0x4810cf[_0x311f('0x34')][_0x311f('0x39')]));_0xd39ea5[_0x311f('0x37')]=_0xd39ea5[_0x311f('0x37')][_0x311f('0x3a')]?_0xd39ea5[_0x311f('0x37')]:_0x539780[_0x311f('0x36')];if(!_0x4810cf[_0x311f('0x34')]['hasOwnProperty']('nolimit')){_0xd39ea5[_0x311f('0x1c')]=qs['limit'](_0x4810cf[_0x311f('0x34')][_0x311f('0x1c')]);_0xd39ea5[_0x311f('0x1a')]=qs[_0x311f('0x1a')](_0x4810cf[_0x311f('0x34')]['offset']);}_0xd39ea5['order']=qs[_0x311f('0x3b')](_0x4810cf[_0x311f('0x34')][_0x311f('0x3b')]);_0xd39ea5[_0x311f('0x3c')]=qs[_0x311f('0x35')](_[_0x311f('0x3d')](_0x4810cf[_0x311f('0x34')],_0x539780[_0x311f('0x35')]),_0x4391b1);if(_0x4810cf[_0x311f('0x34')][_0x311f('0x3e')]){_0xd39ea5[_0x311f('0x3c')]=_[_0x311f('0x3f')](_0xd39ea5[_0x311f('0x3c')],{'$or':_[_0x311f('0x2d')](_0x4391b1,function(_0xe5ec07){if(_0xe5ec07['type']!==_0x311f('0x40')){var _0x3ee9c0={};_0x3ee9c0[_0xe5ec07[_0x311f('0x2a')]]={'$like':'%'+_0x4810cf[_0x311f('0x34')]['filter']+'%'};return _0x3ee9c0;}})});}_0xd39ea5=_[_0x311f('0x3f')]({},_0xd39ea5,_0x4810cf[_0x311f('0x41')]);var _0x53ee7a={'where':_0xd39ea5[_0x311f('0x3c')]};return db['AnalyticExtractedReport'][_0x311f('0x1d')](_0x53ee7a)[_0x311f('0x24')](function(_0x1dc8bb){_0x10521c[_0x311f('0x1d')]=_0x1dc8bb;if(_0x4810cf[_0x311f('0x34')][_0x311f('0x42')]){_0xd39ea5[_0x311f('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0xd39ea5);})[_0x311f('0x24')](function(_0x4f4bc0){_0x10521c[_0x311f('0x44')]=_0x4f4bc0;return _0x10521c;})[_0x311f('0x24')](respondWithFilteredResult(_0x18077c,_0xd39ea5))[_0x311f('0x45')](handleError(_0x18077c,null));};exports[_0x311f('0x46')]=function(_0x3453c5,_0x796911){var _0x36deff={'raw':!![],'where':{'id':_0x3453c5[_0x311f('0x47')]['id']}},_0x3d0dc5={};_0x3d0dc5[_0x311f('0x36')]=_[_0x311f('0x33')](db[_0x311f('0x2e')][_0x311f('0x2f')]);_0x3d0dc5[_0x311f('0x34')]=_['keys'](_0x3453c5[_0x311f('0x34')]);_0x3d0dc5[_0x311f('0x35')]=_[_0x311f('0x38')](_0x3d0dc5[_0x311f('0x36')],_0x3d0dc5[_0x311f('0x34')]);_0x36deff[_0x311f('0x37')]=_[_0x311f('0x38')](_0x3d0dc5[_0x311f('0x36')],qs[_0x311f('0x39')](_0x3453c5[_0x311f('0x34')]['fields']));_0x36deff['attributes']=_0x36deff[_0x311f('0x37')][_0x311f('0x3a')]?_0x36deff[_0x311f('0x37')]:_0x3d0dc5[_0x311f('0x36')];if(_0x3453c5['query']['includeAll']){_0x36deff[_0x311f('0x43')]=[{'all':!![]}];}_0x36deff=_[_0x311f('0x3f')]({},_0x36deff,_0x3453c5['options']);return db[_0x311f('0x2e')]['find'](_0x36deff)[_0x311f('0x24')](handleEntityNotFound(_0x796911,null))[_0x311f('0x24')](respondWithResult(_0x796911,null))[_0x311f('0x45')](handleError(_0x796911,null));};exports[_0x311f('0x48')]=function(_0x2b07e9,_0x552aad){return db[_0x311f('0x2e')][_0x311f('0x48')](_0x2b07e9['body'],{})[_0x311f('0x24')](function(_0x6aeb07){var _0x5e8135=_0x2b07e9[_0x311f('0x49')]['get']({'plain':!![]});if(!_0x5e8135)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e8135[_0x311f('0x4a')]==='user'){var _0x541ccf=_0x6aeb07[_0x311f('0x25')]({'plain':!![]});var _0x22bf6b=_0x311f('0x26');return db[_0x311f('0x4b')]['find']({'where':{'name':_0x22bf6b,'userProfileId':_0x5e8135[_0x311f('0x4c')]},'raw':!![]})[_0x311f('0x24')](function(_0x424563){if(_0x424563&&_0x424563[_0x311f('0x4d')]===0x0){return db['UserProfileResource'][_0x311f('0x48')]({'name':_0x541ccf[_0x311f('0x2a')],'resourceId':_0x541ccf['id'],'type':_0x424563[_0x311f('0x2a')],'sectionId':_0x424563['id']},{})[_0x311f('0x24')](function(){return _0x6aeb07;});}else{return _0x6aeb07;}})[_0x311f('0x45')](function(_0x2dc3d4){logger['error'](_0x311f('0x4e'),_0x2dc3d4);throw _0x2dc3d4;});}return _0x6aeb07;})[_0x311f('0x24')](respondWithResult(_0x552aad,0xc9))['catch'](handleError(_0x552aad,null));};exports['update']=function(_0x107ded,_0x24075){if(_0x107ded[_0x311f('0x4f')]['id']){delete _0x107ded[_0x311f('0x4f')]['id'];}return db[_0x311f('0x2e')]['find']({'where':{'id':_0x107ded[_0x311f('0x47')]['id']}})['then'](handleEntityNotFound(_0x24075,null))[_0x311f('0x24')](saveUpdates(_0x107ded[_0x311f('0x4f')],null))[_0x311f('0x24')](respondWithResult(_0x24075,null))['catch'](handleError(_0x24075,null));};exports[_0x311f('0x27')]=function(_0x35ece7,_0x1c71d8){return db[_0x311f('0x2e')][_0x311f('0x50')]({'where':{'id':_0x35ece7[_0x311f('0x47')]['id']}})[_0x311f('0x24')](handleEntityNotFound(_0x1c71d8,null))['then'](removeEntity(_0x1c71d8,null))[_0x311f('0x45')](handleError(_0x1c71d8,null));};exports[_0x311f('0x51')]=function(_0x4883a7,_0x436e1c,_0x2582df){return db['AnalyticExtractedReport'][_0x311f('0x50')]({'where':{'id':_0x4883a7[_0x311f('0x47')]['id']},'attributes':['name',_0x311f('0x52'),_0x311f('0x53'),_0x311f('0x54')],'raw':!![]})[_0x311f('0x24')](handleEntityNotFound(_0x436e1c,null))[_0x311f('0x24')](function(_0x3efd58){if(_0x3efd58){if(!fs[_0x311f('0x55')](path[_0x311f('0x56')](config[_0x311f('0x57')],'server/files/reports',_0x3efd58[_0x311f('0x53')]))){throw new db[(_0x311f('0x58'))][(_0x311f('0x59'))](_0x311f('0x5a'));}if(_0x4883a7[_0x311f('0x34')][_0x311f('0x5b')]){return _0x436e1c[_0x311f('0x16')](0xc8);}return _0x436e1c[_0x311f('0x51')](path[_0x311f('0x56')](config['root'],_0x311f('0x5c'),_0x3efd58['savename']),util[_0x311f('0x5d')](_0x311f('0x5e'),_0x3efd58[_0x311f('0x52')]||_0x3efd58[_0x311f('0x2a')],_0x3efd58[_0x311f('0x54')][_0x311f('0x5f')]()));}})[_0x311f('0x45')](handleError(_0x436e1c,null));}; \ No newline at end of file +var _0x8d2b=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ExtractedReports','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length'];(function(_0x373edd,_0x1c8e44){var _0x2fbecd=function(_0x54ea63){while(--_0x54ea63){_0x373edd['push'](_0x373edd['shift']());}};_0x2fbecd(++_0x1c8e44);}(_0x8d2b,0x1ab));var _0xb8d2=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x8d2b[_0xf71120];return _0xbe2fd3;};'use strict';var emlformat=require(_0xb8d2('0x0'));var rimraf=require(_0xb8d2('0x1'));var zipdir=require(_0xb8d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8d2('0x3'));var moment=require(_0xb8d2('0x4'));var BPromise=require(_0xb8d2('0x5'));var Mustache=require(_0xb8d2('0x6'));var util=require(_0xb8d2('0x7'));var path=require(_0xb8d2('0x8'));var sox=require(_0xb8d2('0x9'));var csv=require(_0xb8d2('0xa'));var ejs=require(_0xb8d2('0xb'));var fs=require('fs');var fs_extra=require(_0xb8d2('0xc'));var _=require(_0xb8d2('0xd'));var squel=require('squel');var crypto=require(_0xb8d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb8d2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb8d2('0x10'));var Papa=require('papaparse');var Redis=require(_0xb8d2('0x11'));var authService=require(_0xb8d2('0x12'));var qs=require(_0xb8d2('0x13'));var as=require(_0xb8d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb8d2('0x15'));var utils=require('../../config/utils');var config=require(_0xb8d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8d2('0x17'))['db'];function respondWithStatusCode(_0x5f04ca,_0xd29e20){_0xd29e20=_0xd29e20||0xcc;return function(_0x2aee41){if(_0x2aee41){return _0x5f04ca[_0xb8d2('0x18')](_0xd29e20);}return _0x5f04ca['status'](_0xd29e20)[_0xb8d2('0x19')]();};}function respondWithResult(_0xabc180,_0x4eaef1){_0x4eaef1=_0x4eaef1||0xc8;return function(_0x3e0ce6){if(_0x3e0ce6){return _0xabc180[_0xb8d2('0x1a')](_0x4eaef1)[_0xb8d2('0x1b')](_0x3e0ce6);}};}function respondWithFilteredResult(_0x53c19b,_0x20b50e){return function(_0x269e0e){if(_0x269e0e){var _0xcff364=typeof _0x20b50e[_0xb8d2('0x1c')]===_0xb8d2('0x1d')&&typeof _0x20b50e[_0xb8d2('0x1e')]===_0xb8d2('0x1d');var _0x34f6d3=_0x269e0e[_0xb8d2('0x1f')];var _0x22aa24=_0xcff364?0x0:_0x20b50e[_0xb8d2('0x1c')];var _0x248b5f=_0xcff364?_0x269e0e[_0xb8d2('0x1f')]:_0x20b50e[_0xb8d2('0x1c')]+_0x20b50e['limit'];var _0x2a366e;if(_0x248b5f>=_0x34f6d3){_0x248b5f=_0x34f6d3;_0x2a366e=0xc8;}else{_0x2a366e=0xce;}_0x53c19b[_0xb8d2('0x1a')](_0x2a366e);return _0x53c19b[_0xb8d2('0x20')]('Content-Range',_0x22aa24+'-'+_0x248b5f+'/'+_0x34f6d3)[_0xb8d2('0x1b')](_0x269e0e);}return null;};}function patchUpdates(_0x27386b){return function(_0x352ac0){try{jsonpatch[_0xb8d2('0x21')](_0x352ac0,_0x27386b,!![]);}catch(_0x2fbf18){return BPromise[_0xb8d2('0x22')](_0x2fbf18);}return _0x352ac0[_0xb8d2('0x23')]();};}function saveUpdates(_0x4111a9,_0x3918ea){return function(_0x13b0a1){if(_0x13b0a1){return _0x13b0a1[_0xb8d2('0x24')](_0x4111a9)[_0xb8d2('0x25')](function(_0x5a504f){return _0x5a504f;});}return null;};}function removeEntity(_0x55353d,_0x569de0){return function(_0x4ffbec){if(_0x4ffbec){return _0x4ffbec[_0xb8d2('0x26')]()[_0xb8d2('0x25')](function(){var _0x2c12d0=_0x4ffbec[_0xb8d2('0x27')]({'plain':!![]});var _0x51b45f=_0xb8d2('0x28');return db['UserProfileResource'][_0xb8d2('0x26')]({'where':{'type':_0x51b45f,'resourceId':_0x2c12d0['id']}})[_0xb8d2('0x25')](function(){return _0x4ffbec;});})['then'](function(){_0x55353d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x534abe,_0x353fd5){return function(_0x1e10c1){if(!_0x1e10c1){_0x534abe[_0xb8d2('0x18')](0x194);}return _0x1e10c1;};}function handleError(_0x1b0d84,_0x2e74f6){_0x2e74f6=_0x2e74f6||0x1f4;return function(_0x223bd3){logger['error'](_0x223bd3[_0xb8d2('0x29')]);if(_0x223bd3[_0xb8d2('0x2a')]){delete _0x223bd3['name'];}_0x1b0d84[_0xb8d2('0x1a')](_0x2e74f6)[_0xb8d2('0x2b')](_0x223bd3);};}exports[_0xb8d2('0x2c')]=function(_0x45ed30,_0x588c8d){var _0x5c29c9={},_0x1c4517={},_0x460dc2={'count':0x0,'rows':[]};var _0x293b16=_['map'](db[_0xb8d2('0x2d')][_0xb8d2('0x2e')],function(_0x3e5302){return{'name':_0x3e5302[_0xb8d2('0x2f')],'type':_0x3e5302[_0xb8d2('0x30')][_0xb8d2('0x31')]};});_0x1c4517['model']=_[_0xb8d2('0x32')](_0x293b16,'name');_0x1c4517[_0xb8d2('0x33')]=_['keys'](_0x45ed30['query']);_0x1c4517[_0xb8d2('0x34')]=_[_0xb8d2('0x35')](_0x1c4517[_0xb8d2('0x36')],_0x1c4517[_0xb8d2('0x33')]);_0x5c29c9[_0xb8d2('0x37')]=_[_0xb8d2('0x35')](_0x1c4517[_0xb8d2('0x36')],qs[_0xb8d2('0x38')](_0x45ed30[_0xb8d2('0x33')]['fields']));_0x5c29c9['attributes']=_0x5c29c9[_0xb8d2('0x37')][_0xb8d2('0x39')]?_0x5c29c9[_0xb8d2('0x37')]:_0x1c4517[_0xb8d2('0x36')];if(!_0x45ed30['query']['hasOwnProperty'](_0xb8d2('0x3a'))){_0x5c29c9[_0xb8d2('0x1e')]=qs['limit'](_0x45ed30[_0xb8d2('0x33')][_0xb8d2('0x1e')]);_0x5c29c9[_0xb8d2('0x1c')]=qs[_0xb8d2('0x1c')](_0x45ed30['query']['offset']);}_0x5c29c9[_0xb8d2('0x3b')]=qs[_0xb8d2('0x3c')](_0x45ed30[_0xb8d2('0x33')][_0xb8d2('0x3c')]);_0x5c29c9[_0xb8d2('0x3d')]=qs[_0xb8d2('0x34')](_[_0xb8d2('0x3e')](_0x45ed30[_0xb8d2('0x33')],_0x1c4517['filters']),_0x293b16);if(_0x45ed30[_0xb8d2('0x33')][_0xb8d2('0x3f')]){_0x5c29c9[_0xb8d2('0x3d')]=_['merge'](_0x5c29c9[_0xb8d2('0x3d')],{'$or':_['map'](_0x293b16,function(_0x4582e2){if(_0x4582e2[_0xb8d2('0x30')]!==_0xb8d2('0x40')){var _0x36864b={};_0x36864b[_0x4582e2[_0xb8d2('0x2a')]]={'$like':'%'+_0x45ed30[_0xb8d2('0x33')][_0xb8d2('0x3f')]+'%'};return _0x36864b;}})});}_0x5c29c9=_['merge']({},_0x5c29c9,_0x45ed30[_0xb8d2('0x41')]);var _0xeb857d={'where':_0x5c29c9[_0xb8d2('0x3d')]};return db[_0xb8d2('0x2d')][_0xb8d2('0x1f')](_0xeb857d)[_0xb8d2('0x25')](function(_0x19bf2d){_0x460dc2[_0xb8d2('0x1f')]=_0x19bf2d;if(_0x45ed30[_0xb8d2('0x33')]['includeAll']){_0x5c29c9[_0xb8d2('0x42')]=[{'all':!![]}];}return db[_0xb8d2('0x2d')]['findAll'](_0x5c29c9);})[_0xb8d2('0x25')](function(_0x285766){_0x460dc2[_0xb8d2('0x43')]=_0x285766;return _0x460dc2;})[_0xb8d2('0x25')](respondWithFilteredResult(_0x588c8d,_0x5c29c9))[_0xb8d2('0x44')](handleError(_0x588c8d,null));};exports[_0xb8d2('0x45')]=function(_0x2a1b45,_0x3e8310){var _0x3d0f23={'raw':!![],'where':{'id':_0x2a1b45[_0xb8d2('0x46')]['id']}},_0xbea801={};_0xbea801['model']=_[_0xb8d2('0x47')](db[_0xb8d2('0x2d')][_0xb8d2('0x2e')]);_0xbea801[_0xb8d2('0x33')]=_['keys'](_0x2a1b45['query']);_0xbea801[_0xb8d2('0x34')]=_[_0xb8d2('0x35')](_0xbea801[_0xb8d2('0x36')],_0xbea801[_0xb8d2('0x33')]);_0x3d0f23[_0xb8d2('0x37')]=_['intersection'](_0xbea801[_0xb8d2('0x36')],qs['fields'](_0x2a1b45['query'][_0xb8d2('0x38')]));_0x3d0f23[_0xb8d2('0x37')]=_0x3d0f23[_0xb8d2('0x37')][_0xb8d2('0x39')]?_0x3d0f23[_0xb8d2('0x37')]:_0xbea801[_0xb8d2('0x36')];if(_0x2a1b45[_0xb8d2('0x33')][_0xb8d2('0x48')]){_0x3d0f23[_0xb8d2('0x42')]=[{'all':!![]}];}_0x3d0f23=_[_0xb8d2('0x49')]({},_0x3d0f23,_0x2a1b45[_0xb8d2('0x41')]);return db['AnalyticExtractedReport'][_0xb8d2('0x4a')](_0x3d0f23)['then'](handleEntityNotFound(_0x3e8310,null))[_0xb8d2('0x25')](respondWithResult(_0x3e8310,null))[_0xb8d2('0x44')](handleError(_0x3e8310,null));};exports[_0xb8d2('0x4b')]=function(_0x673839,_0x22ba4c){return db[_0xb8d2('0x2d')][_0xb8d2('0x4b')](_0x673839[_0xb8d2('0x4c')],{})[_0xb8d2('0x25')](function(_0x5285f5){var _0x200a6d=_0x673839[_0xb8d2('0x4d')][_0xb8d2('0x27')]({'plain':!![]});if(!_0x200a6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200a6d[_0xb8d2('0x4e')]==='user'){var _0xd7e100=_0x5285f5[_0xb8d2('0x27')]({'plain':!![]});var _0x452a7f=_0xb8d2('0x28');return db[_0xb8d2('0x4f')][_0xb8d2('0x4a')]({'where':{'name':_0x452a7f,'userProfileId':_0x200a6d[_0xb8d2('0x50')]},'raw':!![]})[_0xb8d2('0x25')](function(_0x3de457){if(_0x3de457&&_0x3de457[_0xb8d2('0x51')]===0x0){return db[_0xb8d2('0x52')][_0xb8d2('0x4b')]({'name':_0xd7e100[_0xb8d2('0x2a')],'resourceId':_0xd7e100['id'],'type':_0x3de457['name'],'sectionId':_0x3de457['id']},{})[_0xb8d2('0x25')](function(){return _0x5285f5;});}else{return _0x5285f5;}})[_0xb8d2('0x44')](function(_0x2e5821){logger[_0xb8d2('0x53')](_0xb8d2('0x54'),_0x2e5821);throw _0x2e5821;});}return _0x5285f5;})[_0xb8d2('0x25')](respondWithResult(_0x22ba4c,0xc9))[_0xb8d2('0x44')](handleError(_0x22ba4c,null));};exports['update']=function(_0x2213b5,_0x5bccb0){if(_0x2213b5[_0xb8d2('0x4c')]['id']){delete _0x2213b5[_0xb8d2('0x4c')]['id'];}return db[_0xb8d2('0x2d')]['find']({'where':{'id':_0x2213b5[_0xb8d2('0x46')]['id']}})[_0xb8d2('0x25')](handleEntityNotFound(_0x5bccb0,null))[_0xb8d2('0x25')](saveUpdates(_0x2213b5['body'],null))[_0xb8d2('0x25')](respondWithResult(_0x5bccb0,null))[_0xb8d2('0x44')](handleError(_0x5bccb0,null));};exports[_0xb8d2('0x26')]=function(_0x15d19d,_0x40c5b3){return db[_0xb8d2('0x2d')][_0xb8d2('0x4a')]({'where':{'id':_0x15d19d[_0xb8d2('0x46')]['id']}})[_0xb8d2('0x25')](handleEntityNotFound(_0x40c5b3,null))[_0xb8d2('0x25')](removeEntity(_0x40c5b3,null))[_0xb8d2('0x44')](handleError(_0x40c5b3,null));};exports[_0xb8d2('0x55')]=function(_0x14e672,_0x2eda95,_0x5b96fd){return db[_0xb8d2('0x2d')][_0xb8d2('0x4a')]({'where':{'id':_0x14e672['params']['id']},'attributes':[_0xb8d2('0x2a'),_0xb8d2('0x56'),_0xb8d2('0x57'),_0xb8d2('0x58')],'raw':!![]})[_0xb8d2('0x25')](handleEntityNotFound(_0x2eda95,null))['then'](function(_0x9d25ed){if(_0x9d25ed){if(!fs[_0xb8d2('0x59')](path[_0xb8d2('0x5a')](config[_0xb8d2('0x5b')],'server/files/reports',_0x9d25ed[_0xb8d2('0x57')]))){throw new db[(_0xb8d2('0x5c'))][(_0xb8d2('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x14e672[_0xb8d2('0x33')][_0xb8d2('0x5e')]){return _0x2eda95[_0xb8d2('0x18')](0xc8);}return _0x2eda95[_0xb8d2('0x55')](path['join'](config[_0xb8d2('0x5b')],'server/files/reports',_0x9d25ed[_0xb8d2('0x57')]),util['format'](_0xb8d2('0x5f'),_0x9d25ed['basename']||_0x9d25ed[_0xb8d2('0x2a')],_0x9d25ed[_0xb8d2('0x58')][_0xb8d2('0x60')]()));}})['catch'](handleError(_0x2eda95,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1451a09..8d25b9b 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 _0xc5f8=['api','moment','bluebird','request-promise','path','../../config/environment','exports','AnalyticExtractedReport','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc5f8,0x74));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c5f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c5f('0x1'));var moment=require(_0x8c5f('0x2'));var BPromise=require(_0x8c5f('0x3'));var rp=require(_0x8c5f('0x4'));var fs=require('fs');var path=require(_0x8c5f('0x5'));var rimraf=require('rimraf');var config=require(_0x8c5f('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x8c5f('0x7')]=function(_0x13bbbc,_0x305aad){return _0x13bbbc['define'](_0x8c5f('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87e8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x39f28f,_0x352bf1){var _0x595e11=function(_0x1d9da8){while(--_0x1d9da8){_0x39f28f['push'](_0x39f28f['shift']());}};_0x595e11(++_0x352bf1);}(_0x87e8,0x151));var _0x887e=function(_0x492990,_0x2e8cd4){_0x492990=_0x492990-0x0;var _0x1daa7c=_0x87e8[_0x492990];return _0x1daa7c;};'use strict';var _=require(_0x887e('0x0'));var util=require(_0x887e('0x1'));var logger=require(_0x887e('0x2'))(_0x887e('0x3'));var moment=require(_0x887e('0x4'));var BPromise=require('bluebird');var rp=require(_0x887e('0x5'));var fs=require('fs');var path=require(_0x887e('0x6'));var rimraf=require(_0x887e('0x7'));var config=require(_0x887e('0x8'));var attributes=require(_0x887e('0x9'));module['exports']=function(_0x10dacc,_0x22c1e4){return _0x10dacc[_0x887e('0xa')](_0x887e('0xb'),attributes,{'tableName':_0x887e('0xc'),'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 fdcb607..3f51d70 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 _0xb375=['jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x355059,_0x3e089c){var _0x146343=function(_0x50e027){while(--_0x50e027){_0x355059['push'](_0x355059['shift']());}};_0x146343(++_0x3e089c);}(_0xb375,0x9f));var _0x5b37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb375[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5b37('0x0'));var util=require(_0x5b37('0x1'));var moment=require(_0x5b37('0x2'));var BPromise=require(_0x5b37('0x3'));var rs=require(_0x5b37('0x4'));var fs=require('fs');var Redis=require(_0x5b37('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b37('0x6'))(_0x5b37('0x7'));var config=require(_0x5b37('0x8'));var jayson=require(_0x5b37('0x9'));var client=jayson['client'][_0x5b37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44f4ce,_0x122aac,_0xd9c66f){return new BPromise(function(_0x24145b,_0x3c3861){return client[_0x5b37('0xb')](_0x44f4ce,_0xd9c66f)['then'](function(_0x51b17a){logger[_0x5b37('0xc')](_0x5b37('0xd'),_0x122aac,_0x5b37('0xe'));logger[_0x5b37('0xf')](_0x5b37('0x10'),_0x122aac,'request\x20sent',JSON['stringify'](_0x51b17a));if(_0x51b17a[_0x5b37('0x11')]){if(_0x51b17a[_0x5b37('0x11')][_0x5b37('0x12')]===0x1f4){logger[_0x5b37('0x11')](_0x5b37('0xd'),_0x122aac,_0x51b17a['error'][_0x5b37('0x13')]);return _0x3c3861(_0x51b17a['error'][_0x5b37('0x13')]);}logger[_0x5b37('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x122aac,_0x51b17a['error'][_0x5b37('0x13')]);return _0x24145b(_0x51b17a[_0x5b37('0x11')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x122aac,_0x5b37('0xe'));_0x24145b(_0x51b17a['result'][_0x5b37('0x13')]);}})[_0x5b37('0x14')](function(_0x408bba){logger[_0x5b37('0x11')](_0x5b37('0xd'),_0x122aac,_0x408bba);_0x3c3861(_0x408bba);});});} \ No newline at end of file +var _0x08df=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x08df,0xe6));var _0xf08d=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x08df[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0xf08d('0x0'));var util=require(_0xf08d('0x1'));var moment=require('moment');var BPromise=require(_0xf08d('0x2'));var rs=require(_0xf08d('0x3'));var fs=require('fs');var Redis=require(_0xf08d('0x4'));var db=require(_0xf08d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf08d('0x6'))(_0xf08d('0x7'));var config=require(_0xf08d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf08d('0x9')][_0xf08d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37cdbc,_0x2a47f0,_0x25496f){return new BPromise(function(_0x41eefa,_0x5963ed){return client[_0xf08d('0xb')](_0x37cdbc,_0x25496f)[_0xf08d('0xc')](function(_0x2ee081){logger[_0xf08d('0xd')](_0xf08d('0xe'),_0x2a47f0,_0xf08d('0xf'));logger[_0xf08d('0x10')](_0xf08d('0x11'),_0x2a47f0,'request\x20sent',JSON[_0xf08d('0x12')](_0x2ee081));if(_0x2ee081[_0xf08d('0x13')]){if(_0x2ee081[_0xf08d('0x13')][_0xf08d('0x14')]===0x1f4){logger[_0xf08d('0x13')](_0xf08d('0xe'),_0x2a47f0,_0x2ee081['error'][_0xf08d('0x15')]);return _0x5963ed(_0x2ee081[_0xf08d('0x13')][_0xf08d('0x15')]);}logger['error'](_0xf08d('0xe'),_0x2a47f0,_0x2ee081['error'][_0xf08d('0x15')]);return _0x41eefa(_0x2ee081[_0xf08d('0x13')]['message']);}else{logger[_0xf08d('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2a47f0,_0xf08d('0xf'));_0x41eefa(_0x2ee081['result'][_0xf08d('0x15')]);}})[_0xf08d('0x16')](function(_0x4e7ca9){logger[_0xf08d('0x13')](_0xf08d('0xe'),_0x2a47f0,_0x4e7ca9);_0x5963ed(_0x4e7ca9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 6ea197c..f44a0c7 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 _0xedcf=['show','/:id/download','download','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index'];(function(_0x37e52a,_0x493694){var _0x6ca662=function(_0x4dafc5){while(--_0x4dafc5){_0x37e52a['push'](_0x37e52a['shift']());}};_0x6ca662(++_0x493694);}(_0xedcf,0x191));var _0xfedc=function(_0x367354,_0x1b5cd1){_0x367354=_0x367354-0x0;var _0x9a51eb=_0xedcf[_0x367354];return _0x9a51eb;};'use strict';var multer=require(_0xfedc('0x0'));var util=require(_0xfedc('0x1'));var path=require(_0xfedc('0x2'));var timeout=require(_0xfedc('0x3'));var express=require('express');var router=express[_0xfedc('0x4')]();var fs_extra=require(_0xfedc('0x5'));var auth=require(_0xfedc('0x6'));var interaction=require(_0xfedc('0x7'));var config=require(_0xfedc('0x8'));var controller=require(_0xfedc('0x9'));router[_0xfedc('0xa')]('/',auth[_0xfedc('0xb')](),controller[_0xfedc('0xc')]);router[_0xfedc('0xa')]('/:id',auth[_0xfedc('0xb')](),controller[_0xfedc('0xd')]);router['get'](_0xfedc('0xe'),auth[_0xfedc('0xb')](),controller[_0xfedc('0xf')]);router[_0xfedc('0x10')]('/',auth[_0xfedc('0xb')](),controller[_0xfedc('0x11')]);router[_0xfedc('0x12')](_0xfedc('0x13'),auth[_0xfedc('0xb')](),controller['update']);router[_0xfedc('0x14')](_0xfedc('0x13'),auth[_0xfedc('0xb')](),controller[_0xfedc('0x15')]);module[_0xfedc('0x16')]=router; \ No newline at end of file +var _0x0535=['show','/:id/download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id'];(function(_0x3b1027,_0x5bc8c6){var _0xb75f51=function(_0x1fe49d){while(--_0x1fe49d){_0x3b1027['push'](_0x3b1027['shift']());}};_0xb75f51(++_0x5bc8c6);}(_0x0535,0x1eb));var _0x5053=function(_0x586aa0,_0x3f4b42){_0x586aa0=_0x586aa0-0x0;var _0xc91e96=_0x0535[_0x586aa0];return _0xc91e96;};'use strict';var multer=require(_0x5053('0x0'));var util=require(_0x5053('0x1'));var path=require(_0x5053('0x2'));var timeout=require(_0x5053('0x3'));var express=require(_0x5053('0x4'));var router=express['Router']();var fs_extra=require(_0x5053('0x5'));var auth=require(_0x5053('0x6'));var interaction=require(_0x5053('0x7'));var config=require(_0x5053('0x8'));var controller=require(_0x5053('0x9'));router[_0x5053('0xa')]('/',auth[_0x5053('0xb')](),controller['index']);router['get'](_0x5053('0xc'),auth['isAuthenticated'](),controller[_0x5053('0xd')]);router[_0x5053('0xa')](_0x5053('0xe'),auth[_0x5053('0xb')](),controller['download']);router[_0x5053('0xf')]('/',auth[_0x5053('0xb')](),controller[_0x5053('0x10')]);router[_0x5053('0x11')](_0x5053('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5053('0x12')](_0x5053('0xc'),auth[_0x5053('0xb')](),controller[_0x5053('0x13')]);module[_0x5053('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9accd8e..f1e8603 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 _0xe7bb=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0xe7bb,0x148));var _0xbe7b=function(_0x4797a1,_0x2f87fb){_0x4797a1=_0x4797a1-0x0;var _0x20e3ea=_0xe7bb[_0x4797a1];return _0x20e3ea;};'use strict';var Sequelize=require(_0xbe7b('0x0'));module[_0xbe7b('0x1')]={'field':{'type':Sequelize[_0xbe7b('0x2')]},'alias':{'type':Sequelize[_0xbe7b('0x3')]},'function':{'type':Sequelize[_0xbe7b('0x3')]},'format':{'type':Sequelize[_0xbe7b('0x3')]},'groupBy':{'type':Sequelize[_0xbe7b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe7b('0x3')]},'custom':{'type':Sequelize[_0xbe7b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x16ca=['sequelize','exports','STRING','BOOLEAN'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x16ca,0x1d4));var _0xa16c=function(_0x4998bd,_0x3faca9){_0x4998bd=_0x4998bd-0x0;var _0x5d4b6c=_0x16ca[_0x4998bd];return _0x5d4b6c;};'use strict';var Sequelize=require(_0xa16c('0x0'));module[_0xa16c('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xa16c('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xa16c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa16c('0x2')]},'custom':{'type':Sequelize[_0xa16c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5c4a496..1a3cfae 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 _0x37f8=['find','create','body','bulkCreate','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','length','include'];(function(_0x1f8ff1,_0x4157a1){var _0x56e65b=function(_0x4953ee){while(--_0x4953ee){_0x1f8ff1['push'](_0x1f8ff1['shift']());}};_0x56e65b(++_0x4157a1);}(_0x37f8,0x1ab));var _0x837f=function(_0x5df89d,_0x2f3a0e){_0x5df89d=_0x5df89d-0x0;var _0x319c4c=_0x37f8[_0x5df89d];return _0x319c4c;};'use strict';var emlformat=require(_0x837f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x837f('0x1'));var rp=require(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require(_0x837f('0x4'));var Mustache=require(_0x837f('0x5'));var util=require('util');var path=require(_0x837f('0x6'));var sox=require(_0x837f('0x7'));var csv=require(_0x837f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x837f('0x9'));var _=require(_0x837f('0xa'));var squel=require('squel');var crypto=require(_0x837f('0xb'));var jsforce=require(_0x837f('0xc'));var deskjs=require(_0x837f('0xd'));var toCsv=require(_0x837f('0x8'));var querystring=require(_0x837f('0xe'));var Papa=require(_0x837f('0xf'));var Redis=require(_0x837f('0x10'));var authService=require(_0x837f('0x11'));var qs=require(_0x837f('0x12'));var as=require(_0x837f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x837f('0x14'))(_0x837f('0x15'));var utils=require(_0x837f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x837f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cc2db,_0x2ae8b4){_0x2ae8b4=_0x2ae8b4||0xcc;return function(_0x117ba8){if(_0x117ba8){return _0x2cc2db['sendStatus'](_0x2ae8b4);}return _0x2cc2db[_0x837f('0x18')](_0x2ae8b4)[_0x837f('0x19')]();};}function respondWithResult(_0x37962d,_0x5c27db){_0x5c27db=_0x5c27db||0xc8;return function(_0x346654){if(_0x346654){return _0x37962d[_0x837f('0x18')](_0x5c27db)['json'](_0x346654);}};}function respondWithFilteredResult(_0x30edaa,_0x25b4f6){return function(_0x27dac2){if(_0x27dac2){var _0x3e54a1=typeof _0x25b4f6[_0x837f('0x1a')]===_0x837f('0x1b')&&typeof _0x25b4f6[_0x837f('0x1c')]===_0x837f('0x1b');var _0xa1e8e3=_0x27dac2[_0x837f('0x1d')];var _0x1e6bad=_0x3e54a1?0x0:_0x25b4f6[_0x837f('0x1a')];var _0x5885e5=_0x3e54a1?_0x27dac2[_0x837f('0x1d')]:_0x25b4f6[_0x837f('0x1a')]+_0x25b4f6[_0x837f('0x1c')];var _0x2b0340;if(_0x5885e5>=_0xa1e8e3){_0x5885e5=_0xa1e8e3;_0x2b0340=0xc8;}else{_0x2b0340=0xce;}_0x30edaa['status'](_0x2b0340);return _0x30edaa[_0x837f('0x1e')](_0x837f('0x1f'),_0x1e6bad+'-'+_0x5885e5+'/'+_0xa1e8e3)[_0x837f('0x20')](_0x27dac2);}return null;};}function patchUpdates(_0x43342d){return function(_0x91ee59){try{jsonpatch[_0x837f('0x21')](_0x91ee59,_0x43342d,!![]);}catch(_0x16fdbd){return BPromise['reject'](_0x16fdbd);}return _0x91ee59['save']();};}function saveUpdates(_0x3ba0d6,_0x1c642f){return function(_0x4748be){if(_0x4748be){return _0x4748be[_0x837f('0x22')](_0x3ba0d6)[_0x837f('0x23')](function(_0x1bccc8){return _0x1bccc8;});}return null;};}function removeEntity(_0x3a5ae8,_0x503bb7){return function(_0x783781){if(_0x783781){return _0x783781['destroy']()[_0x837f('0x23')](function(){_0x3a5ae8[_0x837f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2becca,_0x219312){return function(_0x395bfc){if(!_0x395bfc){_0x2becca[_0x837f('0x24')](0x194);}return _0x395bfc;};}function handleError(_0x5dc635,_0x5f4f70){_0x5f4f70=_0x5f4f70||0x1f4;return function(_0x22511b){logger[_0x837f('0x25')](_0x22511b['stack']);if(_0x22511b[_0x837f('0x26')]){delete _0x22511b[_0x837f('0x26')];}_0x5dc635[_0x837f('0x18')](_0x5f4f70)[_0x837f('0x27')](_0x22511b);};}exports[_0x837f('0x28')]=function(_0x1e9212,_0x206241){var _0x450f3e={},_0x4c682a={},_0x3a96d7={'count':0x0,'rows':[]};var _0x507151=_[_0x837f('0x29')](db['AnalyticFieldReport'][_0x837f('0x2a')],function(_0x5e1ca4){return{'name':_0x5e1ca4[_0x837f('0x2b')],'type':_0x5e1ca4[_0x837f('0x2c')][_0x837f('0x2d')]};});_0x4c682a[_0x837f('0x2e')]=_[_0x837f('0x29')](_0x507151,'name');_0x4c682a[_0x837f('0x2f')]=_[_0x837f('0x30')](_0x1e9212[_0x837f('0x2f')]);_0x4c682a[_0x837f('0x31')]=_[_0x837f('0x32')](_0x4c682a[_0x837f('0x2e')],_0x4c682a[_0x837f('0x2f')]);_0x450f3e[_0x837f('0x33')]=_[_0x837f('0x32')](_0x4c682a[_0x837f('0x2e')],qs[_0x837f('0x34')](_0x1e9212['query'][_0x837f('0x34')]));_0x450f3e[_0x837f('0x33')]=_0x450f3e[_0x837f('0x33')]['length']?_0x450f3e[_0x837f('0x33')]:_0x4c682a['model'];if(!_0x1e9212[_0x837f('0x2f')]['hasOwnProperty'](_0x837f('0x35'))){_0x450f3e['limit']=qs[_0x837f('0x1c')](_0x1e9212[_0x837f('0x2f')][_0x837f('0x1c')]);_0x450f3e[_0x837f('0x1a')]=qs[_0x837f('0x1a')](_0x1e9212['query'][_0x837f('0x1a')]);}_0x450f3e[_0x837f('0x36')]=qs[_0x837f('0x37')](_0x1e9212[_0x837f('0x2f')]['sort']);_0x450f3e['where']=qs['filters'](_[_0x837f('0x38')](_0x1e9212[_0x837f('0x2f')],_0x4c682a[_0x837f('0x31')]),_0x507151);if(_0x1e9212['query'][_0x837f('0x39')]){_0x450f3e[_0x837f('0x3a')]=_[_0x837f('0x3b')](_0x450f3e[_0x837f('0x3a')],{'$or':_[_0x837f('0x29')](_0x507151,function(_0x3b127c){if(_0x3b127c[_0x837f('0x2c')]!==_0x837f('0x3c')){var _0x2092d0={};_0x2092d0[_0x3b127c[_0x837f('0x26')]]={'$like':'%'+_0x1e9212[_0x837f('0x2f')][_0x837f('0x39')]+'%'};return _0x2092d0;}})});}_0x450f3e=_[_0x837f('0x3b')]({},_0x450f3e,_0x1e9212[_0x837f('0x3d')]);var _0x237c8c={'where':_0x450f3e[_0x837f('0x3a')]};return db[_0x837f('0x3e')][_0x837f('0x1d')](_0x237c8c)['then'](function(_0x2f68de){_0x3a96d7[_0x837f('0x1d')]=_0x2f68de;if(_0x1e9212[_0x837f('0x2f')][_0x837f('0x3f')]){_0x450f3e['include']=[{'all':!![]}];}return db[_0x837f('0x3e')][_0x837f('0x40')](_0x450f3e);})['then'](function(_0x2f9325){_0x3a96d7[_0x837f('0x41')]=_0x2f9325;return _0x3a96d7;})[_0x837f('0x23')](respondWithFilteredResult(_0x206241,_0x450f3e))[_0x837f('0x42')](handleError(_0x206241,null));};exports[_0x837f('0x43')]=function(_0x32edca,_0x1ed168){var _0x197261={'raw':![],'where':{'id':_0x32edca[_0x837f('0x44')]['id']}},_0x36e1d8={};_0x36e1d8[_0x837f('0x2e')]=_[_0x837f('0x30')](db[_0x837f('0x3e')]['rawAttributes']);_0x36e1d8['query']=_[_0x837f('0x30')](_0x32edca['query']);_0x36e1d8[_0x837f('0x31')]=_[_0x837f('0x32')](_0x36e1d8[_0x837f('0x2e')],_0x36e1d8[_0x837f('0x2f')]);_0x197261[_0x837f('0x33')]=_[_0x837f('0x32')](_0x36e1d8[_0x837f('0x2e')],qs[_0x837f('0x34')](_0x32edca['query']['fields']));_0x197261[_0x837f('0x33')]=_0x197261[_0x837f('0x33')][_0x837f('0x45')]?_0x197261[_0x837f('0x33')]:_0x36e1d8[_0x837f('0x2e')];if(_0x32edca['query']['includeAll']){_0x197261[_0x837f('0x46')]=[{'all':!![]}];}_0x197261=_[_0x837f('0x3b')]({},_0x197261,_0x32edca[_0x837f('0x3d')]);return db[_0x837f('0x3e')][_0x837f('0x47')](_0x197261)[_0x837f('0x23')](handleEntityNotFound(_0x1ed168,null))[_0x837f('0x23')](respondWithResult(_0x1ed168,null))['catch'](handleError(_0x1ed168,null));};exports[_0x837f('0x48')]=function(_0x1f0312,_0x356dbd){return db[_0x837f('0x3e')]['create'](_0x1f0312[_0x837f('0x49')],{})[_0x837f('0x23')](respondWithResult(_0x356dbd,0xc9))[_0x837f('0x42')](handleError(_0x356dbd,null));};exports[_0x837f('0x4a')]=function(_0x588001,_0x1572ac){return db[_0x837f('0x3e')][_0x837f('0x4a')](_0x588001[_0x837f('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1572ac,0xc9))[_0x837f('0x42')](handleError(_0x1572ac,null));};exports[_0x837f('0x22')]=function(_0x15a408,_0x20c3ec){if(_0x15a408[_0x837f('0x49')]['id']){delete _0x15a408[_0x837f('0x49')]['id'];}return db['AnalyticFieldReport'][_0x837f('0x47')]({'where':{'id':_0x15a408['params']['id']}})[_0x837f('0x23')](handleEntityNotFound(_0x20c3ec,null))[_0x837f('0x23')](saveUpdates(_0x15a408['body'],null))['then'](respondWithResult(_0x20c3ec,null))['catch'](handleError(_0x20c3ec,null));};exports[_0x837f('0x4b')]=function(_0x11508e,_0x2cea90){return db['AnalyticFieldReport'][_0x837f('0x47')]({'where':{'id':_0x11508e[_0x837f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cea90,null))[_0x837f('0x23')](removeEntity(_0x2cea90,null))['catch'](handleError(_0x2cea90,null));};exports[_0x837f('0x4c')]=function(_0x4ff27f,_0x1adbbb){return db[_0x837f('0x3e')]['destroy']({'where':{'id':_0x4ff27f[_0x837f('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x837f('0x23')](respondWithResult(_0x1adbbb,0xcc))[_0x837f('0x42')](handleError(_0x1adbbb,null));};exports[_0x837f('0x4d')]=function(_0x57c62d,_0x3be0e4,_0x134bb1){return db[_0x837f('0x4e')][_0x837f('0x4f')]({'where':{'id':_0x57c62d[_0x837f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3be0e4,null))['then'](function(_0x34271c){if(_0x34271c){return db[_0x837f('0x50')][_0x837f('0x51')](function(_0x257b1b){return db[_0x837f('0x3e')][_0x837f('0x4b')]({'where':{'CustomReportId':_0x57c62d['params']['id']},'transaction':_0x257b1b})['then'](function(_0x3e514b){var _0x498d11=_[_0x837f('0x29')](_0x57c62d[_0x837f('0x49')],function(_0x5ebd48){delete _0x5ebd48['id'];_0x5ebd48[_0x837f('0x52')]=_0x57c62d[_0x837f('0x44')]['id'];return _0x5ebd48;});return db['AnalyticFieldReport'][_0x837f('0x4a')](_0x498d11,{'transaction':_0x257b1b});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x57c62d[_0x837f('0x44')]['id']}});});}})['then'](respondWithResult(_0x3be0e4,null))[_0x837f('0x42')](handleError(_0x3be0e4,null));}; \ No newline at end of file +var _0xa8f8=['fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','show','params','find','create','body','catch','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x1665d9,_0x18304c){var _0x48f948=function(_0x1674f1){while(--_0x1674f1){_0x1665d9['push'](_0x1665d9['shift']());}};_0x48f948(++_0x18304c);}(_0xa8f8,0xcf));var _0x8a8f=function(_0xdb5808,_0x58c067){_0xdb5808=_0xdb5808-0x0;var _0x111072=_0xa8f8[_0xdb5808];return _0x111072;};'use strict';var emlformat=require(_0x8a8f('0x0'));var rimraf=require(_0x8a8f('0x1'));var zipdir=require(_0x8a8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8f('0x3'));var moment=require('moment');var BPromise=require(_0x8a8f('0x4'));var Mustache=require(_0x8a8f('0x5'));var util=require(_0x8a8f('0x6'));var path=require(_0x8a8f('0x7'));var sox=require(_0x8a8f('0x8'));var csv=require('to-csv');var ejs=require(_0x8a8f('0x9'));var fs=require('fs');var fs_extra=require(_0x8a8f('0xa'));var _=require(_0x8a8f('0xb'));var squel=require(_0x8a8f('0xc'));var crypto=require('crypto');var jsforce=require(_0x8a8f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a8f('0xe'));var Papa=require('papaparse');var Redis=require(_0x8a8f('0xf'));var authService=require(_0x8a8f('0x10'));var qs=require(_0x8a8f('0x11'));var as=require(_0x8a8f('0x12'));var hardwareService=require(_0x8a8f('0x13'));var logger=require(_0x8a8f('0x14'))('api');var utils=require(_0x8a8f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8a8f('0x16'));var db=require(_0x8a8f('0x17'))['db'];function respondWithStatusCode(_0x1601c8,_0x357301){_0x357301=_0x357301||0xcc;return function(_0x196e96){if(_0x196e96){return _0x1601c8[_0x8a8f('0x18')](_0x357301);}return _0x1601c8['status'](_0x357301)['end']();};}function respondWithResult(_0x2938b7,_0x512021){_0x512021=_0x512021||0xc8;return function(_0x5aa639){if(_0x5aa639){return _0x2938b7['status'](_0x512021)[_0x8a8f('0x19')](_0x5aa639);}};}function respondWithFilteredResult(_0x558b68,_0x130dd7){return function(_0x66d2b9){if(_0x66d2b9){var _0x4d2595=typeof _0x130dd7[_0x8a8f('0x1a')]===_0x8a8f('0x1b')&&typeof _0x130dd7[_0x8a8f('0x1c')]==='undefined';var _0x207e78=_0x66d2b9[_0x8a8f('0x1d')];var _0x3a97e0=_0x4d2595?0x0:_0x130dd7['offset'];var _0x4592cf=_0x4d2595?_0x66d2b9[_0x8a8f('0x1d')]:_0x130dd7[_0x8a8f('0x1a')]+_0x130dd7[_0x8a8f('0x1c')];var _0x51ad9e;if(_0x4592cf>=_0x207e78){_0x4592cf=_0x207e78;_0x51ad9e=0xc8;}else{_0x51ad9e=0xce;}_0x558b68[_0x8a8f('0x1e')](_0x51ad9e);return _0x558b68[_0x8a8f('0x1f')](_0x8a8f('0x20'),_0x3a97e0+'-'+_0x4592cf+'/'+_0x207e78)[_0x8a8f('0x19')](_0x66d2b9);}return null;};}function patchUpdates(_0x72f6be){return function(_0x9db74d){try{jsonpatch[_0x8a8f('0x21')](_0x9db74d,_0x72f6be,!![]);}catch(_0x4c3db){return BPromise[_0x8a8f('0x22')](_0x4c3db);}return _0x9db74d['save']();};}function saveUpdates(_0x43cb3e,_0x2311a6){return function(_0x3e95b8){if(_0x3e95b8){return _0x3e95b8[_0x8a8f('0x23')](_0x43cb3e)[_0x8a8f('0x24')](function(_0xc008c4){return _0xc008c4;});}return null;};}function removeEntity(_0x1c3c75,_0xb3e52e){return function(_0xa5216e){if(_0xa5216e){return _0xa5216e[_0x8a8f('0x25')]()[_0x8a8f('0x24')](function(){_0x1c3c75[_0x8a8f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5d97e,_0x48be8e){return function(_0x1b7cbf){if(!_0x1b7cbf){_0xe5d97e[_0x8a8f('0x18')](0x194);}return _0x1b7cbf;};}function handleError(_0x39b97d,_0x2d82de){_0x2d82de=_0x2d82de||0x1f4;return function(_0x19cd4d){logger[_0x8a8f('0x26')](_0x19cd4d[_0x8a8f('0x27')]);if(_0x19cd4d[_0x8a8f('0x28')]){delete _0x19cd4d[_0x8a8f('0x28')];}_0x39b97d['status'](_0x2d82de)[_0x8a8f('0x29')](_0x19cd4d);};}exports[_0x8a8f('0x2a')]=function(_0x3034a1,_0x5f4fae){var _0x166017={},_0x3c2c8f={},_0x8e530b={'count':0x0,'rows':[]};var _0x2052dd=_[_0x8a8f('0x2b')](db['AnalyticFieldReport'][_0x8a8f('0x2c')],function(_0x3bd6d4){return{'name':_0x3bd6d4[_0x8a8f('0x2d')],'type':_0x3bd6d4[_0x8a8f('0x2e')][_0x8a8f('0x2f')]};});_0x3c2c8f[_0x8a8f('0x30')]=_[_0x8a8f('0x2b')](_0x2052dd,_0x8a8f('0x28'));_0x3c2c8f[_0x8a8f('0x31')]=_[_0x8a8f('0x32')](_0x3034a1[_0x8a8f('0x31')]);_0x3c2c8f[_0x8a8f('0x33')]=_['intersection'](_0x3c2c8f['model'],_0x3c2c8f[_0x8a8f('0x31')]);_0x166017[_0x8a8f('0x34')]=_[_0x8a8f('0x35')](_0x3c2c8f[_0x8a8f('0x30')],qs['fields'](_0x3034a1[_0x8a8f('0x31')][_0x8a8f('0x36')]));_0x166017[_0x8a8f('0x34')]=_0x166017[_0x8a8f('0x34')][_0x8a8f('0x37')]?_0x166017['attributes']:_0x3c2c8f[_0x8a8f('0x30')];if(!_0x3034a1[_0x8a8f('0x31')][_0x8a8f('0x38')]('nolimit')){_0x166017[_0x8a8f('0x1c')]=qs[_0x8a8f('0x1c')](_0x3034a1['query'][_0x8a8f('0x1c')]);_0x166017['offset']=qs[_0x8a8f('0x1a')](_0x3034a1['query'][_0x8a8f('0x1a')]);}_0x166017[_0x8a8f('0x39')]=qs['sort'](_0x3034a1['query'][_0x8a8f('0x3a')]);_0x166017[_0x8a8f('0x3b')]=qs[_0x8a8f('0x33')](_[_0x8a8f('0x3c')](_0x3034a1[_0x8a8f('0x31')],_0x3c2c8f[_0x8a8f('0x33')]),_0x2052dd);if(_0x3034a1[_0x8a8f('0x31')]['filter']){_0x166017[_0x8a8f('0x3b')]=_['merge'](_0x166017['where'],{'$or':_[_0x8a8f('0x2b')](_0x2052dd,function(_0x1504bf){if(_0x1504bf[_0x8a8f('0x2e')]!==_0x8a8f('0x3d')){var _0x198f3f={};_0x198f3f[_0x1504bf['name']]={'$like':'%'+_0x3034a1[_0x8a8f('0x31')][_0x8a8f('0x3e')]+'%'};return _0x198f3f;}})});}_0x166017=_[_0x8a8f('0x3f')]({},_0x166017,_0x3034a1[_0x8a8f('0x40')]);var _0x5c937c={'where':_0x166017[_0x8a8f('0x3b')]};return db[_0x8a8f('0x41')][_0x8a8f('0x1d')](_0x5c937c)['then'](function(_0x34de0e){_0x8e530b[_0x8a8f('0x1d')]=_0x34de0e;if(_0x3034a1['query'][_0x8a8f('0x42')]){_0x166017[_0x8a8f('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8a8f('0x44')](_0x166017);})[_0x8a8f('0x24')](function(_0x44931b){_0x8e530b[_0x8a8f('0x45')]=_0x44931b;return _0x8e530b;})[_0x8a8f('0x24')](respondWithFilteredResult(_0x5f4fae,_0x166017))['catch'](handleError(_0x5f4fae,null));};exports[_0x8a8f('0x46')]=function(_0x23d95a,_0x3a37e4){var _0x103210={'raw':![],'where':{'id':_0x23d95a[_0x8a8f('0x47')]['id']}},_0x2e12cc={};_0x2e12cc[_0x8a8f('0x30')]=_[_0x8a8f('0x32')](db[_0x8a8f('0x41')][_0x8a8f('0x2c')]);_0x2e12cc[_0x8a8f('0x31')]=_[_0x8a8f('0x32')](_0x23d95a[_0x8a8f('0x31')]);_0x2e12cc[_0x8a8f('0x33')]=_[_0x8a8f('0x35')](_0x2e12cc[_0x8a8f('0x30')],_0x2e12cc['query']);_0x103210[_0x8a8f('0x34')]=_[_0x8a8f('0x35')](_0x2e12cc[_0x8a8f('0x30')],qs[_0x8a8f('0x36')](_0x23d95a[_0x8a8f('0x31')][_0x8a8f('0x36')]));_0x103210[_0x8a8f('0x34')]=_0x103210['attributes'][_0x8a8f('0x37')]?_0x103210[_0x8a8f('0x34')]:_0x2e12cc[_0x8a8f('0x30')];if(_0x23d95a[_0x8a8f('0x31')][_0x8a8f('0x42')]){_0x103210[_0x8a8f('0x43')]=[{'all':!![]}];}_0x103210=_['merge']({},_0x103210,_0x23d95a[_0x8a8f('0x40')]);return db[_0x8a8f('0x41')][_0x8a8f('0x48')](_0x103210)[_0x8a8f('0x24')](handleEntityNotFound(_0x3a37e4,null))[_0x8a8f('0x24')](respondWithResult(_0x3a37e4,null))['catch'](handleError(_0x3a37e4,null));};exports[_0x8a8f('0x49')]=function(_0x3916a7,_0x16fd91){return db[_0x8a8f('0x41')][_0x8a8f('0x49')](_0x3916a7[_0x8a8f('0x4a')],{})['then'](respondWithResult(_0x16fd91,0xc9))[_0x8a8f('0x4b')](handleError(_0x16fd91,null));};exports[_0x8a8f('0x4c')]=function(_0x402dea,_0x729f1e){return db[_0x8a8f('0x41')][_0x8a8f('0x4c')](_0x402dea[_0x8a8f('0x4a')],{'raw':![],'individualHooks':!![]})[_0x8a8f('0x24')](respondWithResult(_0x729f1e,0xc9))[_0x8a8f('0x4b')](handleError(_0x729f1e,null));};exports[_0x8a8f('0x23')]=function(_0x15e237,_0x3c5242){if(_0x15e237[_0x8a8f('0x4a')]['id']){delete _0x15e237[_0x8a8f('0x4a')]['id'];}return db[_0x8a8f('0x41')][_0x8a8f('0x48')]({'where':{'id':_0x15e237['params']['id']}})[_0x8a8f('0x24')](handleEntityNotFound(_0x3c5242,null))['then'](saveUpdates(_0x15e237['body'],null))[_0x8a8f('0x24')](respondWithResult(_0x3c5242,null))[_0x8a8f('0x4b')](handleError(_0x3c5242,null));};exports[_0x8a8f('0x25')]=function(_0x581c5b,_0x2b9a8f){return db[_0x8a8f('0x41')][_0x8a8f('0x48')]({'where':{'id':_0x581c5b['params']['id']}})['then'](handleEntityNotFound(_0x2b9a8f,null))[_0x8a8f('0x24')](removeEntity(_0x2b9a8f,null))[_0x8a8f('0x4b')](handleError(_0x2b9a8f,null));};exports[_0x8a8f('0x4d')]=function(_0x1f7572,_0x27bcbe){return db[_0x8a8f('0x41')][_0x8a8f('0x25')]({'where':{'id':_0x1f7572[_0x8a8f('0x31')][_0x8a8f('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x8a8f('0x24')](respondWithResult(_0x27bcbe,0xcc))['catch'](handleError(_0x27bcbe,null));};exports[_0x8a8f('0x4f')]=function(_0xdc9894,_0x52c4ba,_0xf20816){return db[_0x8a8f('0x50')][_0x8a8f('0x51')]({'where':{'id':_0xdc9894['params']['id']}})[_0x8a8f('0x24')](handleEntityNotFound(_0x52c4ba,null))[_0x8a8f('0x24')](function(_0x28bd60){if(_0x28bd60){return db['sequelize'][_0x8a8f('0x52')](function(_0x257b99){return db[_0x8a8f('0x41')][_0x8a8f('0x25')]({'where':{'CustomReportId':_0xdc9894[_0x8a8f('0x47')]['id']},'transaction':_0x257b99})[_0x8a8f('0x24')](function(_0x2c9c8a){var _0x33b3f9=_[_0x8a8f('0x2b')](_0xdc9894['body'],function(_0x15a8fe){delete _0x15a8fe['id'];_0x15a8fe[_0x8a8f('0x53')]=_0xdc9894[_0x8a8f('0x47')]['id'];return _0x15a8fe;});return db[_0x8a8f('0x41')][_0x8a8f('0x4c')](_0x33b3f9,{'transaction':_0x257b99});});})[_0x8a8f('0x24')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0xdc9894[_0x8a8f('0x47')]['id']}});});}})[_0x8a8f('0x24')](respondWithResult(_0x52c4ba,null))[_0x8a8f('0x4b')](handleError(_0x52c4ba,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6419f67..c59672d 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 _0x45aa=['lodash','api','moment','bluebird','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x56d61c,_0x21707d){var _0x499c05=function(_0x6451b7){while(--_0x6451b7){_0x56d61c['push'](_0x56d61c['shift']());}};_0x499c05(++_0x21707d);}(_0x45aa,0x158));var _0xa45a=function(_0x75ff5c,_0x45c306){_0x75ff5c=_0x75ff5c-0x0;var _0xcffae9=_0x45aa[_0x75ff5c];return _0xcffae9;};'use strict';var _=require(_0xa45a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa45a('0x1'));var moment=require(_0xa45a('0x2'));var BPromise=require(_0xa45a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa45a('0x4'));module[_0xa45a('0x5')]=function(_0x3206d6,_0x5179b3){return _0x3206d6[_0xa45a('0x6')]('AnalyticFieldReport',attributes,{'tableName':_0xa45a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97d1=['util','../../config/logger','api','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x1b0265,_0x530166){var _0x34a785=function(_0x578623){while(--_0x578623){_0x1b0265['push'](_0x1b0265['shift']());}};_0x34a785(++_0x530166);}(_0x97d1,0x18c));var _0x197d=function(_0x701c5d,_0x47a566){_0x701c5d=_0x701c5d-0x0;var _0x617b08=_0x97d1[_0x701c5d];return _0x617b08;};'use strict';var _=require('lodash');var util=require(_0x197d('0x0'));var logger=require(_0x197d('0x1'))(_0x197d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x197d('0x3'));var fs=require('fs');var path=require(_0x197d('0x4'));var rimraf=require(_0x197d('0x5'));var config=require('../../config/environment');var attributes=require(_0x197d('0x6'));module[_0x197d('0x7')]=function(_0x1981cb,_0x5bd188){return _0x1981cb[_0x197d('0x8')](_0x197d('0x9'),attributes,{'tableName':_0x197d('0xa'),'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 c3ecf8b..c110c5f 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 _0xc357=['client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0xc357,0x1c1));var _0x7c35=function(_0x402373,_0x53fb31){_0x402373=_0x402373-0x0;var _0x25a890=_0xc357[_0x402373];return _0x25a890;};'use strict';var _=require(_0x7c35('0x0'));var util=require(_0x7c35('0x1'));var moment=require(_0x7c35('0x2'));var BPromise=require(_0x7c35('0x3'));var rs=require(_0x7c35('0x4'));var fs=require('fs');var Redis=require(_0x7c35('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c35('0x6'));var logger=require(_0x7c35('0x7'))(_0x7c35('0x8'));var config=require(_0x7c35('0x9'));var jayson=require(_0x7c35('0xa'));var client=jayson[_0x7c35('0xb')][_0x7c35('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x394e61,_0x20cdf6,_0x4581e4){return new BPromise(function(_0x3d7caf,_0x362d8f){return client[_0x7c35('0xd')](_0x394e61,_0x4581e4)[_0x7c35('0xe')](function(_0x3f64ec){logger['info'](_0x7c35('0xf'),_0x20cdf6,_0x7c35('0x10'));logger['debug'](_0x7c35('0x11'),_0x20cdf6,_0x7c35('0x10'),JSON['stringify'](_0x3f64ec));if(_0x3f64ec[_0x7c35('0x12')]){if(_0x3f64ec[_0x7c35('0x12')]['code']===0x1f4){logger[_0x7c35('0x12')](_0x7c35('0xf'),_0x20cdf6,_0x3f64ec['error'][_0x7c35('0x13')]);return _0x362d8f(_0x3f64ec[_0x7c35('0x12')]['message']);}logger[_0x7c35('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x20cdf6,_0x3f64ec['error'][_0x7c35('0x13')]);return _0x3d7caf(_0x3f64ec[_0x7c35('0x12')][_0x7c35('0x13')]);}else{logger[_0x7c35('0x14')](_0x7c35('0xf'),_0x20cdf6,_0x7c35('0x10'));_0x3d7caf(_0x3f64ec[_0x7c35('0x15')][_0x7c35('0x13')]);}})[_0x7c35('0x16')](function(_0x19b86d){logger[_0x7c35('0x12')](_0x7c35('0xf'),_0x20cdf6,_0x19b86d);_0x362d8f(_0x19b86d);});});} \ No newline at end of file +var _0x5eba=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x24f890,_0x37890a){var _0x150d59=function(_0x36a83b){while(--_0x36a83b){_0x24f890['push'](_0x24f890['shift']());}};_0x150d59(++_0x37890a);}(_0x5eba,0x15d));var _0xa5eb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5eba[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xa5eb('0x0'));var moment=require(_0xa5eb('0x1'));var BPromise=require(_0xa5eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5eb('0x3'));var db=require(_0xa5eb('0x4'))['db'];var utils=require(_0xa5eb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa5eb('0x6'));var jayson=require(_0xa5eb('0x7'));var client=jayson[_0xa5eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc492,_0x2a4e10,_0x14927e){return new BPromise(function(_0x4820cb,_0x37c5a3){return client[_0xa5eb('0x9')](_0x4dc492,_0x14927e)[_0xa5eb('0xa')](function(_0x359ea1){logger[_0xa5eb('0xb')](_0xa5eb('0xc'),_0x2a4e10,_0xa5eb('0xd'));logger['debug'](_0xa5eb('0xe'),_0x2a4e10,'request\x20sent',JSON['stringify'](_0x359ea1));if(_0x359ea1[_0xa5eb('0xf')]){if(_0x359ea1[_0xa5eb('0xf')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2a4e10,_0x359ea1[_0xa5eb('0xf')]['message']);return _0x37c5a3(_0x359ea1[_0xa5eb('0xf')][_0xa5eb('0x10')]);}logger[_0xa5eb('0xf')](_0xa5eb('0xc'),_0x2a4e10,_0x359ea1[_0xa5eb('0xf')]['message']);return _0x4820cb(_0x359ea1[_0xa5eb('0xf')]['message']);}else{logger[_0xa5eb('0xb')](_0xa5eb('0xc'),_0x2a4e10,_0xa5eb('0xd'));_0x4820cb(_0x359ea1[_0xa5eb('0x11')][_0xa5eb('0x10')]);}})[_0xa5eb('0x12')](function(_0x5829e5){logger[_0xa5eb('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2a4e10,_0x5829e5);_0x37c5a3(_0x5829e5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e781dee..8f6dd29 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(_0x326c2a,_0x12ed32){var _0x386496=function(_0x47de9d){while(--_0x47de9d){_0x326c2a['push'](_0x326c2a['shift']());}};_0x386496(++_0x12ed32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x4f8bff,_0x1d7a9c){var _0x365554=function(_0x2b019b){while(--_0x2b019b){_0x4f8bff['push'](_0x4f8bff['shift']());}};_0x365554(++_0x1d7a9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 9194da2..e944d05 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 _0xa1e8=['STRING','name','sequelize'];(function(_0x5320f2,_0x4427ff){var _0x16eff9=function(_0x21879f){while(--_0x21879f){_0x5320f2['push'](_0x5320f2['shift']());}};_0x16eff9(++_0x4427ff);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x1068e2,_0x5da9f6){_0x1068e2=_0x1068e2-0x0;var _0x4bc4f2=_0xa1e8[_0x1068e2];return _0x4bc4f2;};'use strict';var Sequelize=require(_0x8a1e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a1e('0x1')],'allowNull':![],'unique':_0x8a1e('0x2')},'table':{'type':Sequelize[_0x8a1e('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x8a1e('0x1')]}}; \ No newline at end of file +var _0x915a=['STRING','name','sequelize','exports'];(function(_0x56241c,_0x47eba5){var _0x35a07b=function(_0x19afe8){while(--_0x19afe8){_0x56241c['push'](_0x56241c['shift']());}};_0x35a07b(++_0x47eba5);}(_0x915a,0x1d2));var _0xa915=function(_0xf13970,_0xd0f3a0){_0xf13970=_0xf13970-0x0;var _0x25fa5f=_0x915a[_0xf13970];return _0x25fa5f;};'use strict';var Sequelize=require(_0xa915('0x0'));module[_0xa915('0x1')]={'name':{'type':Sequelize[_0xa915('0x2')],'allowNull':![],'unique':_0xa915('0x3')},'table':{'type':Sequelize[_0xa915('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa915('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a613838..ab2443a 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 _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x360e5b,_0x2f5b){var _0x48c8b2=function(_0x10d63d){while(--_0x10d63d){_0x360e5b['push'](_0x360e5b['shift']());}};_0x48c8b2(++_0x2f5b);}(_0x55ca,0x126));var _0xa55c=function(_0x263999,_0x477176){_0x263999=_0x263999-0x0;var _0x336996=_0x55ca[_0x263999];return _0x336996;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4baf26,_0x34dc70){var _0x3d12c6=function(_0x46582a){while(--_0x46582a){_0x4baf26['push'](_0x4baf26['shift']());}};_0x3d12c6(++_0x34dc70);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x410344,_0x11c039){_0x410344=_0x410344-0x0;var _0x210ff4=_0x7fbe[_0x410344];return _0x210ff4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5e9d258..b3185fc 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 _0x1db9=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x486eff,_0x5cb3b0){var _0x95293b=function(_0x25b947){while(--_0x25b947){_0x486eff['push'](_0x486eff['shift']());}};_0x95293b(++_0x5cb3b0);}(_0x1db9,0x176));var _0x91db=function(_0x139529,_0x253a7c){_0x139529=_0x139529-0x0;var _0x1f9df0=_0x1db9[_0x139529];return _0x1f9df0;};'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('./analyticMetric.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbecd=['AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x2077be,_0x26136a){var _0x198bbf=function(_0x2fd7e3){while(--_0x2fd7e3){_0x2077be['push'](_0x2077be['shift']());}};_0x198bbf(++_0x26136a);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var logger=require(_0xdbec('0x1'))(_0xdbec('0x2'));var moment=require('moment');var BPromise=require(_0xdbec('0x3'));var rp=require(_0xdbec('0x4'));var fs=require('fs');var path=require(_0xdbec('0x5'));var rimraf=require(_0xdbec('0x6'));var config=require(_0xdbec('0x7'));var attributes=require(_0xdbec('0x8'));module[_0xdbec('0x9')]=function(_0x411618,_0x578a3b){return _0x411618[_0xdbec('0xa')](_0xdbec('0xb'),attributes,{'tableName':_0xdbec('0xc'),'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 758d524..b06bcc3 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 _0xfd3b=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x5cbcdf,_0x2224a4){var _0x4be16f=function(_0x12665c){while(--_0x12665c){_0x5cbcdf['push'](_0x5cbcdf['shift']());}};_0x4be16f(++_0x2224a4);}(_0xfd3b,0xd9));var _0xbfd3=function(_0x23b4df,_0x3bd0fc){_0x23b4df=_0x23b4df-0x0;var _0x25d87b=_0xfd3b[_0x23b4df];return _0x25d87b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfd3('0x0'));var BPromise=require('bluebird');var rs=require(_0xbfd3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfd3('0x2'))['db'];var utils=require(_0xbfd3('0x3'));var logger=require(_0xbfd3('0x4'))(_0xbfd3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfd3('0x6')][_0xbfd3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26dbc0,_0x46e10d,_0x3427b4){return new BPromise(function(_0x3dda28,_0x300a70){return client['request'](_0x26dbc0,_0x3427b4)[_0xbfd3('0x8')](function(_0x332c0f){logger[_0xbfd3('0x9')](_0xbfd3('0xa'),_0x46e10d,_0xbfd3('0xb'));logger[_0xbfd3('0xc')](_0xbfd3('0xd'),_0x46e10d,'request\x20sent',JSON[_0xbfd3('0xe')](_0x332c0f));if(_0x332c0f[_0xbfd3('0xf')]){if(_0x332c0f[_0xbfd3('0xf')]['code']===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x46e10d,_0x332c0f[_0xbfd3('0xf')]['message']);return _0x300a70(_0x332c0f[_0xbfd3('0xf')][_0xbfd3('0x10')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x46e10d,_0x332c0f[_0xbfd3('0xf')][_0xbfd3('0x10')]);return _0x3dda28(_0x332c0f[_0xbfd3('0xf')]['message']);}else{logger[_0xbfd3('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x46e10d,_0xbfd3('0xb'));_0x3dda28(_0x332c0f[_0xbfd3('0x11')][_0xbfd3('0x10')]);}})[_0xbfd3('0x12')](function(_0x59684f){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x46e10d,_0x59684f);_0x300a70(_0x59684f);});});} \ No newline at end of file +var _0x6cd7=['jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xb971d3,_0x2df9cf){var _0x2710bf=function(_0x551dbc){while(--_0x551dbc){_0xb971d3['push'](_0xb971d3['shift']());}};_0x2710bf(++_0x2df9cf);}(_0x6cd7,0x1d3));var _0x76cd=function(_0x44f1f1,_0x4be4e4){_0x44f1f1=_0x44f1f1-0x0;var _0x1fae61=_0x6cd7[_0x44f1f1];return _0x1fae61;};'use strict';var _=require(_0x76cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x76cd('0x1'));var fs=require('fs');var Redis=require(_0x76cd('0x2'));var db=require(_0x76cd('0x3'))['db'];var utils=require(_0x76cd('0x4'));var logger=require(_0x76cd('0x5'))(_0x76cd('0x6'));var config=require(_0x76cd('0x7'));var jayson=require(_0x76cd('0x8'));var client=jayson['client'][_0x76cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fe37b,_0x2d12d9,_0x497afd){return new BPromise(function(_0x32467d,_0x4c1427){return client[_0x76cd('0xa')](_0x4fe37b,_0x497afd)[_0x76cd('0xb')](function(_0x2056b7){logger[_0x76cd('0xc')](_0x76cd('0xd'),_0x2d12d9,'request\x20sent');logger[_0x76cd('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2d12d9,_0x76cd('0xf'),JSON['stringify'](_0x2056b7));if(_0x2056b7[_0x76cd('0x10')]){if(_0x2056b7[_0x76cd('0x10')]['code']===0x1f4){logger[_0x76cd('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x2d12d9,_0x2056b7[_0x76cd('0x10')]['message']);return _0x4c1427(_0x2056b7['error']['message']);}logger['error'](_0x76cd('0xd'),_0x2d12d9,_0x2056b7[_0x76cd('0x10')][_0x76cd('0x11')]);return _0x32467d(_0x2056b7[_0x76cd('0x10')][_0x76cd('0x11')]);}else{logger['info'](_0x76cd('0xd'),_0x2d12d9,_0x76cd('0xf'));_0x32467d(_0x2056b7[_0x76cd('0x12')]['message']);}})['catch'](function(_0x195cbb){logger[_0x76cd('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x2d12d9,_0x195cbb);_0x4c1427(_0x195cbb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0567246..27e6f46 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 _0xdb94=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb94,0xe5));var _0x4db9=function(_0x31cc2d,_0x906ff){_0x31cc2d=_0x31cc2d-0x0;var _0x53529c=_0xdb94[_0x31cc2d];return _0x53529c;};'use strict';var multer=require('multer');var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db9('0x2'));var router=express[_0x4db9('0x3')]();var fs_extra=require(_0x4db9('0x4'));var auth=require(_0x4db9('0x5'));var interaction=require(_0x4db9('0x6'));var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0x9')]);router[_0x4db9('0xa')](_0x4db9('0xb'),auth[_0x4db9('0x8')](),controller['show']);router[_0x4db9('0xc')]('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0xd')]);router[_0x4db9('0xe')](_0x4db9('0xb'),auth['isAuthenticated'](),controller[_0x4db9('0xf')]);router[_0x4db9('0x10')](_0x4db9('0xb'),auth[_0x4db9('0x8')](),controller[_0x4db9('0x11')]);module[_0x4db9('0x12')]=router; \ No newline at end of file +var _0x3fc6=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0x3fc6,0x159));var _0x63fc=function(_0x533f09,_0x3a31e2){_0x533f09=_0x533f09-0x0;var _0x52d981=_0x3fc6[_0x533f09];return _0x52d981;};'use strict';var multer=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var path=require(_0x63fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x63fc('0x3'));var router=express[_0x63fc('0x4')]();var fs_extra=require(_0x63fc('0x5'));var auth=require(_0x63fc('0x6'));var interaction=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x63fc('0x9')](),controller[_0x63fc('0xa')]);router[_0x63fc('0xb')]('/:id',auth[_0x63fc('0x9')](),controller[_0x63fc('0xc')]);router['post']('/',auth[_0x63fc('0x9')](),controller[_0x63fc('0xd')]);router[_0x63fc('0xe')](_0x63fc('0xf'),auth[_0x63fc('0x9')](),controller[_0x63fc('0x10')]);router[_0x63fc('0x11')](_0x63fc('0xf'),auth[_0x63fc('0x9')](),controller[_0x63fc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3ea2715..836d765 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 _0xc0bd=['sequelize','exports','TEXT'];(function(_0xf61586,_0x56b0c4){var _0x2b6eb3=function(_0x47e12b){while(--_0x47e12b){_0xf61586['push'](_0xf61586['shift']());}};_0x2b6eb3(++_0x56b0c4);}(_0xc0bd,0x10e));var _0xdc0b=function(_0x436e07,_0x53348f){_0x436e07=_0x436e07-0x0;var _0x52c4e4=_0xc0bd[_0x436e07];return _0x52c4e4;};'use strict';var Sequelize=require(_0xdc0b('0x0'));module[_0xdc0b('0x1')]={'tree':{'type':Sequelize[_0xdc0b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7aad=['sequelize','TEXT'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x7aad,0x160));var _0xd7aa=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7aad[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xd7aa('0x0'));module['exports']={'tree':{'type':Sequelize[_0xd7aa('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 d340643..bfd271b 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 _0x95f6=['moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x1170fe,_0x414dcf){var _0x5a5e84=function(_0x4faa20){while(--_0x4faa20){_0x1170fe['push'](_0x1170fe['shift']());}};_0x5a5e84(++_0x414dcf);}(_0x95f6,0xe3));var _0x695f=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0x95f6[_0x33670a];return _0x36ad1d;};'use strict';var emlformat=require(_0x695f('0x0'));var rimraf=require(_0x695f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x695f('0x2'));var rp=require(_0x695f('0x3'));var moment=require(_0x695f('0x4'));var BPromise=require(_0x695f('0x5'));var Mustache=require(_0x695f('0x6'));var util=require(_0x695f('0x7'));var path=require('path');var sox=require(_0x695f('0x8'));var csv=require(_0x695f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x695f('0xa'));var _=require(_0x695f('0xb'));var squel=require(_0x695f('0xc'));var crypto=require('crypto');var jsforce=require(_0x695f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x695f('0x9'));var querystring=require(_0x695f('0xe'));var Papa=require(_0x695f('0xf'));var Redis=require(_0x695f('0x10'));var authService=require(_0x695f('0x11'));var qs=require(_0x695f('0x12'));var as=require(_0x695f('0x13'));var hardwareService=require(_0x695f('0x14'));var logger=require(_0x695f('0x15'))(_0x695f('0x16'));var utils=require(_0x695f('0x17'));var config=require(_0x695f('0x18'));var licenseUtil=require(_0x695f('0x19'));var db=require(_0x695f('0x1a'))['db'];function respondWithStatusCode(_0x5058ed,_0x772819){_0x772819=_0x772819||0xcc;return function(_0xbefb39){if(_0xbefb39){return _0x5058ed['sendStatus'](_0x772819);}return _0x5058ed[_0x695f('0x1b')](_0x772819)[_0x695f('0x1c')]();};}function respondWithResult(_0x474ee2,_0x1917e6){_0x1917e6=_0x1917e6||0xc8;return function(_0x2de76b){if(_0x2de76b){return _0x474ee2[_0x695f('0x1b')](_0x1917e6)[_0x695f('0x1d')](_0x2de76b);}};}function respondWithFilteredResult(_0x58b159,_0x2f3057){return function(_0x305512){if(_0x305512){var _0x25ed89=typeof _0x2f3057[_0x695f('0x1e')]===_0x695f('0x1f')&&typeof _0x2f3057[_0x695f('0x20')]===_0x695f('0x1f');var _0x4111d6=_0x305512[_0x695f('0x21')];var _0x5f4d27=_0x25ed89?0x0:_0x2f3057[_0x695f('0x1e')];var _0x4481bb=_0x25ed89?_0x305512[_0x695f('0x21')]:_0x2f3057[_0x695f('0x1e')]+_0x2f3057['limit'];var _0x4f54f8;if(_0x4481bb>=_0x4111d6){_0x4481bb=_0x4111d6;_0x4f54f8=0xc8;}else{_0x4f54f8=0xce;}_0x58b159['status'](_0x4f54f8);return _0x58b159[_0x695f('0x22')](_0x695f('0x23'),_0x5f4d27+'-'+_0x4481bb+'/'+_0x4111d6)[_0x695f('0x1d')](_0x305512);}return null;};}function patchUpdates(_0x593929){return function(_0x1a6734){try{jsonpatch['apply'](_0x1a6734,_0x593929,!![]);}catch(_0x4fc4ea){return BPromise[_0x695f('0x24')](_0x4fc4ea);}return _0x1a6734[_0x695f('0x25')]();};}function saveUpdates(_0x14df64,_0x323ad7){return function(_0x2f6da2){if(_0x2f6da2){return _0x2f6da2[_0x695f('0x26')](_0x14df64)[_0x695f('0x27')](function(_0x49107c){return _0x49107c;});}return null;};}function removeEntity(_0x11c62f,_0x52847b){return function(_0x3a6b45){if(_0x3a6b45){return _0x3a6b45[_0x695f('0x28')]()[_0x695f('0x27')](function(){_0x11c62f[_0x695f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e6e2,_0x12e64e){return function(_0x26a828){if(!_0x26a828){_0x24e6e2[_0x695f('0x29')](0x194);}return _0x26a828;};}function handleError(_0x355de5,_0x17716f){_0x17716f=_0x17716f||0x1f4;return function(_0x1d7eca){logger[_0x695f('0x2a')](_0x1d7eca[_0x695f('0x2b')]);if(_0x1d7eca['name']){delete _0x1d7eca[_0x695f('0x2c')];}_0x355de5[_0x695f('0x1b')](_0x17716f)['send'](_0x1d7eca);};}exports[_0x695f('0x2d')]=function(_0x2c2106,_0x4aedaf){var _0x28aa28={},_0x283b76={},_0x42951c={'count':0x0,'rows':[]};var _0x18bd06=_[_0x695f('0x2e')](db[_0x695f('0x2f')][_0x695f('0x30')],function(_0x5e5eb1){return{'name':_0x5e5eb1[_0x695f('0x31')],'type':_0x5e5eb1['type'][_0x695f('0x32')]};});_0x283b76['model']=_['map'](_0x18bd06,_0x695f('0x2c'));_0x283b76[_0x695f('0x33')]=_[_0x695f('0x34')](_0x2c2106[_0x695f('0x33')]);_0x283b76[_0x695f('0x35')]=_[_0x695f('0x36')](_0x283b76[_0x695f('0x37')],_0x283b76['query']);_0x28aa28[_0x695f('0x38')]=_['intersection'](_0x283b76[_0x695f('0x37')],qs[_0x695f('0x39')](_0x2c2106['query'][_0x695f('0x39')]));_0x28aa28['attributes']=_0x28aa28[_0x695f('0x38')]['length']?_0x28aa28[_0x695f('0x38')]:_0x283b76[_0x695f('0x37')];if(!_0x2c2106['query'][_0x695f('0x3a')]('nolimit')){_0x28aa28[_0x695f('0x20')]=qs[_0x695f('0x20')](_0x2c2106[_0x695f('0x33')]['limit']);_0x28aa28[_0x695f('0x1e')]=qs[_0x695f('0x1e')](_0x2c2106['query']['offset']);}_0x28aa28['order']=qs[_0x695f('0x3b')](_0x2c2106[_0x695f('0x33')][_0x695f('0x3b')]);_0x28aa28['where']=qs[_0x695f('0x35')](_[_0x695f('0x3c')](_0x2c2106[_0x695f('0x33')],_0x283b76[_0x695f('0x35')]),_0x18bd06);if(_0x2c2106[_0x695f('0x33')][_0x695f('0x3d')]){_0x28aa28[_0x695f('0x3e')]=_[_0x695f('0x3f')](_0x28aa28[_0x695f('0x3e')],{'$or':_[_0x695f('0x2e')](_0x18bd06,function(_0xba6a84){if(_0xba6a84[_0x695f('0x40')]!==_0x695f('0x41')){var _0x35e968={};_0x35e968[_0xba6a84['name']]={'$like':'%'+_0x2c2106['query'][_0x695f('0x3d')]+'%'};return _0x35e968;}})});}_0x28aa28=_[_0x695f('0x3f')]({},_0x28aa28,_0x2c2106[_0x695f('0x42')]);var _0x3a2e14={'where':_0x28aa28[_0x695f('0x3e')]};return db[_0x695f('0x2f')][_0x695f('0x21')](_0x3a2e14)[_0x695f('0x27')](function(_0x271442){_0x42951c['count']=_0x271442;if(_0x2c2106['query'][_0x695f('0x43')]){_0x28aa28['include']=[{'all':!![]}];}return db[_0x695f('0x2f')][_0x695f('0x44')](_0x28aa28);})['then'](function(_0x338e6a){_0x42951c[_0x695f('0x45')]=_0x338e6a;return _0x42951c;})[_0x695f('0x27')](respondWithFilteredResult(_0x4aedaf,_0x28aa28))['catch'](handleError(_0x4aedaf,null));};exports[_0x695f('0x46')]=function(_0x53dd29,_0xc07bbb){var _0x4b90ea={'raw':!![],'where':{'id':_0x53dd29[_0x695f('0x47')]['id']}},_0x1f1a40={};_0x1f1a40['model']=_[_0x695f('0x34')](db[_0x695f('0x2f')][_0x695f('0x30')]);_0x1f1a40[_0x695f('0x33')]=_['keys'](_0x53dd29[_0x695f('0x33')]);_0x1f1a40['filters']=_[_0x695f('0x36')](_0x1f1a40[_0x695f('0x37')],_0x1f1a40[_0x695f('0x33')]);_0x4b90ea[_0x695f('0x38')]=_['intersection'](_0x1f1a40[_0x695f('0x37')],qs[_0x695f('0x39')](_0x53dd29[_0x695f('0x33')][_0x695f('0x39')]));_0x4b90ea[_0x695f('0x38')]=_0x4b90ea[_0x695f('0x38')]['length']?_0x4b90ea[_0x695f('0x38')]:_0x1f1a40[_0x695f('0x37')];if(_0x53dd29[_0x695f('0x33')][_0x695f('0x43')]){_0x4b90ea[_0x695f('0x48')]=[{'all':!![]}];}_0x4b90ea=_[_0x695f('0x3f')]({},_0x4b90ea,_0x53dd29[_0x695f('0x42')]);return db[_0x695f('0x2f')][_0x695f('0x49')](_0x4b90ea)[_0x695f('0x27')](handleEntityNotFound(_0xc07bbb,null))['then'](respondWithResult(_0xc07bbb,null))[_0x695f('0x4a')](handleError(_0xc07bbb,null));};exports[_0x695f('0x4b')]=function(_0x2d5c6d,_0x3bcfb5){return db[_0x695f('0x2f')]['create'](_0x2d5c6d[_0x695f('0x4c')],{})[_0x695f('0x27')](respondWithResult(_0x3bcfb5,0xc9))[_0x695f('0x4a')](handleError(_0x3bcfb5,null));};exports[_0x695f('0x26')]=function(_0x5a2d6a,_0x5cf4d1){if(_0x5a2d6a[_0x695f('0x4c')]['id']){delete _0x5a2d6a[_0x695f('0x4c')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x5a2d6a['params']['id']}})[_0x695f('0x27')](handleEntityNotFound(_0x5cf4d1,null))[_0x695f('0x27')](saveUpdates(_0x5a2d6a[_0x695f('0x4c')],null))['then'](respondWithResult(_0x5cf4d1,null))[_0x695f('0x4a')](handleError(_0x5cf4d1,null));};exports[_0x695f('0x28')]=function(_0x4cceba,_0x1d9359){return db[_0x695f('0x2f')][_0x695f('0x49')]({'where':{'id':_0x4cceba[_0x695f('0x47')]['id']}})[_0x695f('0x27')](handleEntityNotFound(_0x1d9359,null))[_0x695f('0x27')](removeEntity(_0x1d9359,null))[_0x695f('0x4a')](handleError(_0x1d9359,null));}; \ No newline at end of file +var _0x0b88=['save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','AnalyticTreeReport','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x0b88,0x13e));var _0x80b8=function(_0x8e952b,_0x1befc5){_0x8e952b=_0x8e952b-0x0;var _0x132332=_0x0b88[_0x8e952b];return _0x132332;};'use strict';var emlformat=require(_0x80b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x80b8('0x1'));var jsonpatch=require(_0x80b8('0x2'));var rp=require(_0x80b8('0x3'));var moment=require(_0x80b8('0x4'));var BPromise=require(_0x80b8('0x5'));var Mustache=require(_0x80b8('0x6'));var util=require(_0x80b8('0x7'));var path=require(_0x80b8('0x8'));var sox=require(_0x80b8('0x9'));var csv=require(_0x80b8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80b8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80b8('0xc'));var toCsv=require(_0x80b8('0xa'));var querystring=require(_0x80b8('0xd'));var Papa=require('papaparse');var Redis=require(_0x80b8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x80b8('0xf'));var as=require(_0x80b8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80b8('0x11'))(_0x80b8('0x12'));var utils=require(_0x80b8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x80b8('0x14'));var db=require(_0x80b8('0x15'))['db'];function respondWithStatusCode(_0x306c6a,_0x124164){_0x124164=_0x124164||0xcc;return function(_0x2ba10f){if(_0x2ba10f){return _0x306c6a[_0x80b8('0x16')](_0x124164);}return _0x306c6a[_0x80b8('0x17')](_0x124164)[_0x80b8('0x18')]();};}function respondWithResult(_0x12c48a,_0x545c21){_0x545c21=_0x545c21||0xc8;return function(_0x3b3ac0){if(_0x3b3ac0){return _0x12c48a['status'](_0x545c21)[_0x80b8('0x19')](_0x3b3ac0);}};}function respondWithFilteredResult(_0x24b120,_0x3e3553){return function(_0x256024){if(_0x256024){var _0x26f2fa=typeof _0x3e3553[_0x80b8('0x1a')]===_0x80b8('0x1b')&&typeof _0x3e3553[_0x80b8('0x1c')]===_0x80b8('0x1b');var _0x12d584=_0x256024['count'];var _0x5d944b=_0x26f2fa?0x0:_0x3e3553['offset'];var _0x2f85f0=_0x26f2fa?_0x256024[_0x80b8('0x1d')]:_0x3e3553['offset']+_0x3e3553[_0x80b8('0x1c')];var _0x299396;if(_0x2f85f0>=_0x12d584){_0x2f85f0=_0x12d584;_0x299396=0xc8;}else{_0x299396=0xce;}_0x24b120[_0x80b8('0x17')](_0x299396);return _0x24b120[_0x80b8('0x1e')]('Content-Range',_0x5d944b+'-'+_0x2f85f0+'/'+_0x12d584)[_0x80b8('0x19')](_0x256024);}return null;};}function patchUpdates(_0x1c9ac2){return function(_0x3d267c){try{jsonpatch[_0x80b8('0x1f')](_0x3d267c,_0x1c9ac2,!![]);}catch(_0x4366a3){return BPromise['reject'](_0x4366a3);}return _0x3d267c[_0x80b8('0x20')]();};}function saveUpdates(_0x2f4c45,_0x323e71){return function(_0x128f8f){if(_0x128f8f){return _0x128f8f[_0x80b8('0x21')](_0x2f4c45)[_0x80b8('0x22')](function(_0x5172e3){return _0x5172e3;});}return null;};}function removeEntity(_0x45db9a,_0x599812){return function(_0x1a9030){if(_0x1a9030){return _0x1a9030[_0x80b8('0x23')]()[_0x80b8('0x22')](function(){_0x45db9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b33c,_0x394863){return function(_0x26fca4){if(!_0x26fca4){_0x40b33c[_0x80b8('0x16')](0x194);}return _0x26fca4;};}function handleError(_0x24db76,_0x548067){_0x548067=_0x548067||0x1f4;return function(_0x3139a3){logger[_0x80b8('0x24')](_0x3139a3['stack']);if(_0x3139a3['name']){delete _0x3139a3[_0x80b8('0x25')];}_0x24db76[_0x80b8('0x17')](_0x548067)[_0x80b8('0x26')](_0x3139a3);};}exports[_0x80b8('0x27')]=function(_0x10eb63,_0x7390bf){var _0xe175b0={},_0x1a0f8c={},_0x242c06={'count':0x0,'rows':[]};var _0x20204c=_['map'](db['AnalyticTreeReport'][_0x80b8('0x28')],function(_0x4fa035){return{'name':_0x4fa035['fieldName'],'type':_0x4fa035[_0x80b8('0x29')][_0x80b8('0x2a')]};});_0x1a0f8c[_0x80b8('0x2b')]=_[_0x80b8('0x2c')](_0x20204c,_0x80b8('0x25'));_0x1a0f8c[_0x80b8('0x2d')]=_['keys'](_0x10eb63['query']);_0x1a0f8c['filters']=_[_0x80b8('0x2e')](_0x1a0f8c[_0x80b8('0x2b')],_0x1a0f8c[_0x80b8('0x2d')]);_0xe175b0[_0x80b8('0x2f')]=_[_0x80b8('0x2e')](_0x1a0f8c[_0x80b8('0x2b')],qs[_0x80b8('0x30')](_0x10eb63['query'][_0x80b8('0x30')]));_0xe175b0[_0x80b8('0x2f')]=_0xe175b0[_0x80b8('0x2f')][_0x80b8('0x31')]?_0xe175b0['attributes']:_0x1a0f8c['model'];if(!_0x10eb63[_0x80b8('0x2d')][_0x80b8('0x32')]('nolimit')){_0xe175b0[_0x80b8('0x1c')]=qs[_0x80b8('0x1c')](_0x10eb63['query']['limit']);_0xe175b0[_0x80b8('0x1a')]=qs[_0x80b8('0x1a')](_0x10eb63['query'][_0x80b8('0x1a')]);}_0xe175b0['order']=qs[_0x80b8('0x33')](_0x10eb63[_0x80b8('0x2d')][_0x80b8('0x33')]);_0xe175b0[_0x80b8('0x34')]=qs['filters'](_[_0x80b8('0x35')](_0x10eb63[_0x80b8('0x2d')],_0x1a0f8c[_0x80b8('0x36')]),_0x20204c);if(_0x10eb63[_0x80b8('0x2d')][_0x80b8('0x37')]){_0xe175b0['where']=_[_0x80b8('0x38')](_0xe175b0[_0x80b8('0x34')],{'$or':_['map'](_0x20204c,function(_0x373a44){if(_0x373a44[_0x80b8('0x29')]!==_0x80b8('0x39')){var _0x123d7a={};_0x123d7a[_0x373a44[_0x80b8('0x25')]]={'$like':'%'+_0x10eb63[_0x80b8('0x2d')][_0x80b8('0x37')]+'%'};return _0x123d7a;}})});}_0xe175b0=_[_0x80b8('0x38')]({},_0xe175b0,_0x10eb63[_0x80b8('0x3a')]);var _0x119c3f={'where':_0xe175b0[_0x80b8('0x34')]};return db['AnalyticTreeReport'][_0x80b8('0x1d')](_0x119c3f)['then'](function(_0x33933f){_0x242c06['count']=_0x33933f;if(_0x10eb63[_0x80b8('0x2d')][_0x80b8('0x3b')]){_0xe175b0[_0x80b8('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x80b8('0x3d')](_0xe175b0);})[_0x80b8('0x22')](function(_0x370bff){_0x242c06[_0x80b8('0x3e')]=_0x370bff;return _0x242c06;})[_0x80b8('0x22')](respondWithFilteredResult(_0x7390bf,_0xe175b0))[_0x80b8('0x3f')](handleError(_0x7390bf,null));};exports['show']=function(_0x2c2529,_0x50c29f){var _0x48ca09={'raw':!![],'where':{'id':_0x2c2529[_0x80b8('0x40')]['id']}},_0x4a1b2f={};_0x4a1b2f['model']=_[_0x80b8('0x41')](db['AnalyticTreeReport'][_0x80b8('0x28')]);_0x4a1b2f[_0x80b8('0x2d')]=_[_0x80b8('0x41')](_0x2c2529[_0x80b8('0x2d')]);_0x4a1b2f['filters']=_[_0x80b8('0x2e')](_0x4a1b2f[_0x80b8('0x2b')],_0x4a1b2f['query']);_0x48ca09[_0x80b8('0x2f')]=_['intersection'](_0x4a1b2f[_0x80b8('0x2b')],qs[_0x80b8('0x30')](_0x2c2529['query'][_0x80b8('0x30')]));_0x48ca09[_0x80b8('0x2f')]=_0x48ca09['attributes'][_0x80b8('0x31')]?_0x48ca09[_0x80b8('0x2f')]:_0x4a1b2f[_0x80b8('0x2b')];if(_0x2c2529['query']['includeAll']){_0x48ca09[_0x80b8('0x3c')]=[{'all':!![]}];}_0x48ca09=_[_0x80b8('0x38')]({},_0x48ca09,_0x2c2529[_0x80b8('0x3a')]);return db[_0x80b8('0x42')][_0x80b8('0x43')](_0x48ca09)[_0x80b8('0x22')](handleEntityNotFound(_0x50c29f,null))['then'](respondWithResult(_0x50c29f,null))['catch'](handleError(_0x50c29f,null));};exports['create']=function(_0x32eb83,_0xac360d){return db['AnalyticTreeReport'][_0x80b8('0x44')](_0x32eb83[_0x80b8('0x45')],{})[_0x80b8('0x22')](respondWithResult(_0xac360d,0xc9))[_0x80b8('0x3f')](handleError(_0xac360d,null));};exports[_0x80b8('0x21')]=function(_0x1d17ab,_0x50f083){if(_0x1d17ab[_0x80b8('0x45')]['id']){delete _0x1d17ab['body']['id'];}return db['AnalyticTreeReport'][_0x80b8('0x43')]({'where':{'id':_0x1d17ab[_0x80b8('0x40')]['id']}})[_0x80b8('0x22')](handleEntityNotFound(_0x50f083,null))[_0x80b8('0x22')](saveUpdates(_0x1d17ab[_0x80b8('0x45')],null))[_0x80b8('0x22')](respondWithResult(_0x50f083,null))[_0x80b8('0x3f')](handleError(_0x50f083,null));};exports[_0x80b8('0x23')]=function(_0x251261,_0x56ca51){return db[_0x80b8('0x42')][_0x80b8('0x43')]({'where':{'id':_0x251261[_0x80b8('0x40')]['id']}})['then'](handleEntityNotFound(_0x56ca51,null))[_0x80b8('0x22')](removeEntity(_0x56ca51,null))['catch'](handleError(_0x56ca51,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 55723d1..b7ce727 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 _0x1b54=['util','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x1b54,0x74));var _0x41b5=function(_0x5527f6,_0x450dac){_0x5527f6=_0x5527f6-0x0;var _0x40be53=_0x1b54[_0x5527f6];return _0x40be53;};'use strict';var _=require(_0x41b5('0x0'));var util=require(_0x41b5('0x1'));var logger=require('../../config/logger')(_0x41b5('0x2'));var moment=require(_0x41b5('0x3'));var BPromise=require('bluebird');var rp=require(_0x41b5('0x4'));var fs=require('fs');var path=require(_0x41b5('0x5'));var rimraf=require(_0x41b5('0x6'));var config=require(_0x41b5('0x7'));var attributes=require(_0x41b5('0x8'));module[_0x41b5('0x9')]=function(_0x3e8aa6,_0x218b1f){return _0x3e8aa6[_0x41b5('0xa')](_0x41b5('0xb'),attributes,{'tableName':_0x41b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd01a=['api','moment','bluebird','rimraf','../../config/environment','exports','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x1f0639,_0x306cfb){var _0x1080c2=function(_0x3d6490){while(--_0x3d6490){_0x1f0639['push'](_0x1f0639['shift']());}};_0x1080c2(++_0x306cfb);}(_0xd01a,0x151));var _0xad01=function(_0x3c4cd4,_0x3556f2){_0x3c4cd4=_0x3c4cd4-0x0;var _0x5cb366=_0xd01a[_0x3c4cd4];return _0x5cb366;};'use strict';var _=require(_0xad01('0x0'));var util=require(_0xad01('0x1'));var logger=require(_0xad01('0x2'))(_0xad01('0x3'));var moment=require(_0xad01('0x4'));var BPromise=require(_0xad01('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xad01('0x6'));var config=require(_0xad01('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xad01('0x8')]=function(_0xfe1f24,_0x5e805f){return _0xfe1f24['define']('AnalyticTreeReport',attributes,{'tableName':_0xad01('0x9'),'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 97b1324..c3266ab 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5cbe57,_0x2af0cf){var _0x14cca4=function(_0x1d13f1){while(--_0x1d13f1){_0x5cbe57['push'](_0x5cbe57['shift']());}};_0x14cca4(++_0x2af0cf);}(_0x2ef3,0xba));var _0x32ef=function(_0x31468e,_0x303635){_0x31468e=_0x31468e-0x0;var _0x5899cb=_0x2ef3[_0x31468e];return _0x5899cb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5abbaf,_0x1a0041){_0x5abbaf=_0x5abbaf-0x0;var _0xad0c75=_0x7a54[_0x5abbaf];return _0xad0c75;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a86c7c7..ec59f76 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 _0xef86=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete'];(function(_0x4cfc85,_0x4d6829){var _0x1972af=function(_0x22b4d5){while(--_0x22b4d5){_0x4cfc85['push'](_0x4cfc85['shift']());}};_0x1972af(++_0x4d6829);}(_0xef86,0x178));var _0x6ef8=function(_0x5b80c8,_0x8f620f){_0x5b80c8=_0x5b80c8-0x0;var _0x314c6c=_0xef86[_0x5b80c8];return _0x314c6c;};'use strict';var multer=require(_0x6ef8('0x0'));var util=require(_0x6ef8('0x1'));var path=require(_0x6ef8('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ef8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6ef8('0x4'));var interaction=require(_0x6ef8('0x5'));var config=require(_0x6ef8('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x6ef8('0x7')]('/',auth[_0x6ef8('0x8')](),controller[_0x6ef8('0x9')]);router[_0x6ef8('0x7')](_0x6ef8('0xa'),auth[_0x6ef8('0x8')](),controller['show']);router[_0x6ef8('0xb')]('/',auth[_0x6ef8('0x8')](),controller[_0x6ef8('0xc')]);router[_0x6ef8('0xd')](_0x6ef8('0xa'),auth[_0x6ef8('0x8')](),controller['update']);router[_0x6ef8('0xe')](_0x6ef8('0xa'),auth[_0x6ef8('0x8')](),controller[_0x6ef8('0xf')]);module[_0x6ef8('0x10')]=router; \ No newline at end of file +var _0xf580=['index','/:id','show','create','put','delete','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x469a2d,_0x53bcbe){var _0x148147=function(_0xe46eea){while(--_0xe46eea){_0x469a2d['push'](_0x469a2d['shift']());}};_0x148147(++_0x53bcbe);}(_0xf580,0x128));var _0x0f58=function(_0x2767d6,_0x4c0b1b){_0x2767d6=_0x2767d6-0x0;var _0x58f812=_0xf580[_0x2767d6];return _0x58f812;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0f58('0x0'));var express=require(_0x0f58('0x1'));var router=express[_0x0f58('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f58('0x3'));var config=require(_0x0f58('0x4'));var controller=require(_0x0f58('0x5'));router[_0x0f58('0x6')]('/',auth[_0x0f58('0x7')](),controller[_0x0f58('0x8')]);router[_0x0f58('0x6')](_0x0f58('0x9'),auth[_0x0f58('0x7')](),controller[_0x0f58('0xa')]);router['post']('/',auth[_0x0f58('0x7')](),controller[_0x0f58('0xb')]);router[_0x0f58('0xc')]('/:id',auth[_0x0f58('0x7')](),controller['update']);router[_0x0f58('0xd')](_0x0f58('0x9'),auth[_0x0f58('0x7')](),controller[_0x0f58('0xe')]);module[_0x0f58('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6502497..5d003fb 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 _0x1cc7=['STRING','sequelize','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1cc7,0x15a));var _0x71cc=function(_0x51e2be,_0x42eaa5){_0x51e2be=_0x51e2be-0x0;var _0x4d93df=_0x1cc7[_0x51e2be];return _0x4d93df;};'use strict';var Sequelize=require(_0x71cc('0x0'));module[_0x71cc('0x1')]={'name':{'type':Sequelize[_0x71cc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x295f=['exports','STRING'];(function(_0x1e2e47,_0x28c9bb){var _0x471f21=function(_0x4d1fc3){while(--_0x4d1fc3){_0x1e2e47['push'](_0x1e2e47['shift']());}};_0x471f21(++_0x28c9bb);}(_0x295f,0x168));var _0xf295=function(_0x4f1d08,_0x9422d0){_0x4f1d08=_0x4f1d08-0x0;var _0x54ff81=_0x295f[_0x4f1d08];return _0x54ff81;};'use strict';var Sequelize=require('sequelize');module[_0xf295('0x0')]={'name':{'type':Sequelize[_0xf295('0x1')]},'basename':{'type':Sequelize[_0xf295('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b7120cc..34fba37 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 _0xf2da=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','clone','get','createdAt','updatedAt','body','omit','create','originalname','file','mimetype','download','findOne','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x32580e,_0x13b569){var _0x19f538=function(_0x1ed012){while(--_0x1ed012){_0x32580e['push'](_0x32580e['shift']());}};_0x19f538(++_0x13b569);}(_0xf2da,0x1ca));var _0xaf2d=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0xf2da[_0x34ad72];return _0x5c9aa8;};'use strict';var emlformat=require(_0xaf2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaf2d('0x2'));var BPromise=require(_0xaf2d('0x3'));var Mustache=require(_0xaf2d('0x4'));var util=require('util');var path=require(_0xaf2d('0x5'));var sox=require('sox');var csv=require(_0xaf2d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf2d('0x7'));var _=require(_0xaf2d('0x8'));var squel=require('squel');var crypto=require(_0xaf2d('0x9'));var jsforce=require(_0xaf2d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf2d('0xb'));var Papa=require(_0xaf2d('0xc'));var Redis=require(_0xaf2d('0xd'));var authService=require(_0xaf2d('0xe'));var qs=require(_0xaf2d('0xf'));var as=require(_0xaf2d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf2d('0x11'))(_0xaf2d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaf2d('0x13'))['db'];function respondWithStatusCode(_0x11e406,_0x23cc2c){_0x23cc2c=_0x23cc2c||0xcc;return function(_0x1e42f6){if(_0x1e42f6){return _0x11e406[_0xaf2d('0x14')](_0x23cc2c);}return _0x11e406[_0xaf2d('0x15')](_0x23cc2c)[_0xaf2d('0x16')]();};}function respondWithResult(_0x2d57ec,_0x1b06e1){_0x1b06e1=_0x1b06e1||0xc8;return function(_0x58b264){if(_0x58b264){return _0x2d57ec[_0xaf2d('0x15')](_0x1b06e1)[_0xaf2d('0x17')](_0x58b264);}};}function respondWithFilteredResult(_0x6ccb66,_0x483d66){return function(_0x4d647a){if(_0x4d647a){var _0x2a8842=typeof _0x483d66[_0xaf2d('0x18')]===_0xaf2d('0x19')&&typeof _0x483d66[_0xaf2d('0x1a')]===_0xaf2d('0x19');var _0x1b7a1d=_0x4d647a[_0xaf2d('0x1b')];var _0x2945bd=_0x2a8842?0x0:_0x483d66[_0xaf2d('0x18')];var _0x16c13e=_0x2a8842?_0x4d647a[_0xaf2d('0x1b')]:_0x483d66[_0xaf2d('0x18')]+_0x483d66[_0xaf2d('0x1a')];var _0x8a11f2;if(_0x16c13e>=_0x1b7a1d){_0x16c13e=_0x1b7a1d;_0x8a11f2=0xc8;}else{_0x8a11f2=0xce;}_0x6ccb66[_0xaf2d('0x15')](_0x8a11f2);return _0x6ccb66['set'](_0xaf2d('0x1c'),_0x2945bd+'-'+_0x16c13e+'/'+_0x1b7a1d)[_0xaf2d('0x17')](_0x4d647a);}return null;};}function patchUpdates(_0x120435){return function(_0x22543a){try{jsonpatch[_0xaf2d('0x1d')](_0x22543a,_0x120435,!![]);}catch(_0x1b93f7){return BPromise[_0xaf2d('0x1e')](_0x1b93f7);}return _0x22543a[_0xaf2d('0x1f')]();};}function saveUpdates(_0x14328f,_0x1c603b){return function(_0x513409){if(_0x513409){return _0x513409[_0xaf2d('0x20')](_0x14328f)[_0xaf2d('0x21')](function(_0x4c06e3){return _0x4c06e3;});}return null;};}function removeEntity(_0x3af619,_0x2b2814){return function(_0x324984){if(_0x324984){return _0x324984[_0xaf2d('0x22')]()[_0xaf2d('0x21')](function(){_0x3af619[_0xaf2d('0x15')](0xcc)[_0xaf2d('0x16')]();});}};}function handleEntityNotFound(_0x21c513,_0x18354c){return function(_0x26d9e1){if(!_0x26d9e1){_0x21c513['sendStatus'](0x194);}return _0x26d9e1;};}function handleError(_0x4973c3,_0x299588){_0x299588=_0x299588||0x1f4;return function(_0x832d7e){logger[_0xaf2d('0x23')](_0x832d7e[_0xaf2d('0x24')]);if(_0x832d7e[_0xaf2d('0x25')]){delete _0x832d7e['name'];}_0x4973c3[_0xaf2d('0x15')](_0x299588)['send'](_0x832d7e);};}exports[_0xaf2d('0x26')]=function(_0x1b37b8,_0x1cc8af){var _0x4a6da9={},_0x4ff9ab={},_0x3a65b5={'count':0x0,'rows':[]};var _0x30d094=_[_0xaf2d('0x27')](db[_0xaf2d('0x28')][_0xaf2d('0x29')],function(_0x34748f){return{'name':_0x34748f['fieldName'],'type':_0x34748f[_0xaf2d('0x2a')][_0xaf2d('0x2b')]};});_0x4ff9ab[_0xaf2d('0x2c')]=_[_0xaf2d('0x27')](_0x30d094,_0xaf2d('0x25'));_0x4ff9ab[_0xaf2d('0x2d')]=_[_0xaf2d('0x2e')](_0x1b37b8[_0xaf2d('0x2d')]);_0x4ff9ab[_0xaf2d('0x2f')]=_[_0xaf2d('0x30')](_0x4ff9ab[_0xaf2d('0x2c')],_0x4ff9ab[_0xaf2d('0x2d')]);_0x4a6da9['attributes']=_[_0xaf2d('0x30')](_0x4ff9ab[_0xaf2d('0x2c')],qs[_0xaf2d('0x31')](_0x1b37b8['query'][_0xaf2d('0x31')]));_0x4a6da9[_0xaf2d('0x32')]=_0x4a6da9[_0xaf2d('0x32')][_0xaf2d('0x33')]?_0x4a6da9[_0xaf2d('0x32')]:_0x4ff9ab[_0xaf2d('0x2c')];if(!_0x1b37b8[_0xaf2d('0x2d')][_0xaf2d('0x34')](_0xaf2d('0x35'))){_0x4a6da9['limit']=qs[_0xaf2d('0x1a')](_0x1b37b8[_0xaf2d('0x2d')][_0xaf2d('0x1a')]);_0x4a6da9[_0xaf2d('0x18')]=qs[_0xaf2d('0x18')](_0x1b37b8['query'][_0xaf2d('0x18')]);}_0x4a6da9[_0xaf2d('0x36')]=qs[_0xaf2d('0x37')](_0x1b37b8[_0xaf2d('0x2d')][_0xaf2d('0x37')]);_0x4a6da9[_0xaf2d('0x38')]=qs[_0xaf2d('0x2f')](_[_0xaf2d('0x39')](_0x1b37b8[_0xaf2d('0x2d')],_0x4ff9ab[_0xaf2d('0x2f')]),_0x30d094);if(_0x1b37b8[_0xaf2d('0x2d')][_0xaf2d('0x3a')]){_0x4a6da9['where']=_[_0xaf2d('0x3b')](_0x4a6da9[_0xaf2d('0x38')],{'$or':_[_0xaf2d('0x27')](_0x30d094,function(_0x3d29b9){if(_0x3d29b9[_0xaf2d('0x2a')]!==_0xaf2d('0x3c')){var _0x3b1d89={};_0x3b1d89[_0x3d29b9['name']]={'$like':'%'+_0x1b37b8[_0xaf2d('0x2d')][_0xaf2d('0x3a')]+'%'};return _0x3b1d89;}})});}_0x4a6da9=_[_0xaf2d('0x3b')]({},_0x4a6da9,_0x1b37b8['options']);var _0x519645={'where':_0x4a6da9[_0xaf2d('0x38')]};return db['Attachment'][_0xaf2d('0x1b')](_0x519645)['then'](function(_0x42c531){_0x3a65b5['count']=_0x42c531;if(_0x1b37b8[_0xaf2d('0x2d')][_0xaf2d('0x3d')]){_0x4a6da9[_0xaf2d('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0xaf2d('0x3f')](_0x4a6da9);})[_0xaf2d('0x21')](function(_0x36da9c){_0x3a65b5[_0xaf2d('0x40')]=_0x36da9c;return _0x3a65b5;})[_0xaf2d('0x21')](respondWithFilteredResult(_0x1cc8af,_0x4a6da9))[_0xaf2d('0x41')](handleError(_0x1cc8af,null));};exports[_0xaf2d('0x42')]=function(_0x2aa952,_0x43acc3){var _0x20c734={'raw':!![],'where':{'id':_0x2aa952[_0xaf2d('0x43')]['id']}},_0x1fd0a5={};_0x1fd0a5[_0xaf2d('0x2c')]=_[_0xaf2d('0x2e')](db['Attachment'][_0xaf2d('0x29')]);_0x1fd0a5[_0xaf2d('0x2d')]=_[_0xaf2d('0x2e')](_0x2aa952[_0xaf2d('0x2d')]);_0x1fd0a5[_0xaf2d('0x2f')]=_['intersection'](_0x1fd0a5[_0xaf2d('0x2c')],_0x1fd0a5[_0xaf2d('0x2d')]);_0x20c734['attributes']=_['intersection'](_0x1fd0a5[_0xaf2d('0x2c')],qs['fields'](_0x2aa952[_0xaf2d('0x2d')]['fields']));_0x20c734['attributes']=_0x20c734[_0xaf2d('0x32')][_0xaf2d('0x33')]?_0x20c734[_0xaf2d('0x32')]:_0x1fd0a5[_0xaf2d('0x2c')];if(_0x2aa952[_0xaf2d('0x2d')][_0xaf2d('0x3d')]){_0x20c734['include']=[{'all':!![]}];}_0x20c734=_[_0xaf2d('0x3b')]({},_0x20c734,_0x2aa952[_0xaf2d('0x44')]);return db[_0xaf2d('0x28')][_0xaf2d('0x45')](_0x20c734)[_0xaf2d('0x21')](handleEntityNotFound(_0x43acc3,null))[_0xaf2d('0x21')](respondWithResult(_0x43acc3,null))[_0xaf2d('0x41')](handleError(_0x43acc3,null));};exports[_0xaf2d('0x46')]=function(_0x216bad,_0x39aa3d){var _0x168788={'where':{'id':_0x216bad[_0xaf2d('0x43')]['id']}},_0x22ad3a={};_0x22ad3a[_0xaf2d('0x2c')]=_[_0xaf2d('0x2e')](db[_0xaf2d('0x28')][_0xaf2d('0x29')]);_0x168788[_0xaf2d('0x32')]=_['intersection'](_0x22ad3a[_0xaf2d('0x2c')],qs[_0xaf2d('0x31')](_0x216bad['query'][_0xaf2d('0x31')]));_0x168788[_0xaf2d('0x32')]=_0x168788[_0xaf2d('0x32')][_0xaf2d('0x33')]?_0x168788[_0xaf2d('0x32')]:_0x22ad3a[_0xaf2d('0x2c')];if(_0x216bad[_0xaf2d('0x2d')]['includeAll']){_0x168788['include']=[{'all':!![]}];}_0x168788=_[_0xaf2d('0x3b')]({},_0x168788,_0x216bad[_0xaf2d('0x44')]);return db[_0xaf2d('0x28')][_0xaf2d('0x45')](_0x168788)[_0xaf2d('0x21')](handleEntityNotFound(_0x39aa3d,null))[_0xaf2d('0x21')](function(_0x1abe6d){if(_0x1abe6d){var _0x39c4b8=_0x1abe6d[_0xaf2d('0x47')]({'plain':!![]});_0x39c4b8=qs['omit'](_0x39c4b8,['id',_0xaf2d('0x48'),_0xaf2d('0x49')]);_0x216bad[_0xaf2d('0x4a')]=_[_0xaf2d('0x4b')](_0x216bad['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0xaf2d('0x4c')](_[_0xaf2d('0x3b')](_0x39c4b8,_0x216bad['body']),{'include':_0x216bad[_0xaf2d('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xaf2d('0x21')](respondWithResult(_0x39aa3d,0xc9))[_0xaf2d('0x41')](handleError(_0x39aa3d,null));};exports[_0xaf2d('0x20')]=function(_0x23a90d,_0x21f91d){if(_0x23a90d[_0xaf2d('0x4a')]['id']){delete _0x23a90d[_0xaf2d('0x4a')]['id'];}return db[_0xaf2d('0x28')][_0xaf2d('0x45')]({'where':{'id':_0x23a90d['params']['id']}})[_0xaf2d('0x21')](handleEntityNotFound(_0x21f91d,null))[_0xaf2d('0x21')](saveUpdates(_0x23a90d[_0xaf2d('0x4a')],null))[_0xaf2d('0x21')](respondWithResult(_0x21f91d,null))[_0xaf2d('0x41')](handleError(_0x21f91d,null));};exports[_0xaf2d('0x22')]=function(_0x5bb3c6,_0xe4df82){return db[_0xaf2d('0x28')][_0xaf2d('0x45')]({'where':{'id':_0x5bb3c6[_0xaf2d('0x43')]['id']}})[_0xaf2d('0x21')](handleEntityNotFound(_0xe4df82,null))['then'](removeEntity(_0xe4df82,null))[_0xaf2d('0x41')](handleError(_0xe4df82,null));};exports[_0xaf2d('0x4c')]=function(_0x35f356,_0x2e523c,_0x47ccfc){_0x35f356[_0xaf2d('0x4a')][_0xaf2d('0x25')]=_0x35f356['file'][_0xaf2d('0x4d')];_0x35f356[_0xaf2d('0x4a')]['basename']=_0x35f356[_0xaf2d('0x4e')]['filename'];_0x35f356['body']['type']=_0x35f356[_0xaf2d('0x4e')][_0xaf2d('0x4f')];return db['Attachment'][_0xaf2d('0x4c')](_0x35f356['body'])[_0xaf2d('0x21')](respondWithResult(_0x2e523c,0xc9))[_0xaf2d('0x41')](handleError(_0x2e523c,null));};exports[_0xaf2d('0x50')]=function(_0x531ccc,_0x33f439,_0x34d524){return db['Attachment'][_0xaf2d('0x51')]({'where':{'id':_0x531ccc['params']['id']},'raw':!![]})[_0xaf2d('0x21')](handleEntityNotFound(_0x33f439,null))[_0xaf2d('0x21')](function(_0x554c75){if(_0x554c75){var _0x19e3b6=_0x554c75['ChatOfflineMessageId']!==null;var _0x585ae1=path[_0xaf2d('0x52')](config['root'],_0xaf2d('0x53'));if(_0x19e3b6){_0x585ae1=path[_0xaf2d('0x52')](_0x585ae1,_0xaf2d('0x54'));}var _0x383e18=path['join'](_0x585ae1,_0x554c75[_0xaf2d('0x55')]);return _0x33f439[_0xaf2d('0x50')](_0x383e18);}})[_0xaf2d('0x41')](handleError(_0x33f439,null));}; \ No newline at end of file +var _0x7a3e=['options','include','findAll','rows','catch','params','find','get','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','root','offline-chat/','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x7a3e,0x17b));var _0xe7a3=function(_0x43fd4b,_0x3f68ec){_0x43fd4b=_0x43fd4b-0x0;var _0x1fc2e2=_0x7a3e[_0x43fd4b];return _0x1fc2e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7a3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7a3('0x1'));var rp=require(_0xe7a3('0x2'));var moment=require(_0xe7a3('0x3'));var BPromise=require(_0xe7a3('0x4'));var Mustache=require(_0xe7a3('0x5'));var util=require(_0xe7a3('0x6'));var path=require(_0xe7a3('0x7'));var sox=require(_0xe7a3('0x8'));var csv=require(_0xe7a3('0x9'));var ejs=require(_0xe7a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe7a3('0xb'));var crypto=require(_0xe7a3('0xc'));var jsforce=require(_0xe7a3('0xd'));var deskjs=require(_0xe7a3('0xe'));var toCsv=require(_0xe7a3('0x9'));var querystring=require(_0xe7a3('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7a3('0x10'));var authService=require(_0xe7a3('0x11'));var qs=require(_0xe7a3('0x12'));var as=require(_0xe7a3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe7a3('0x14'));var config=require(_0xe7a3('0x15'));var licenseUtil=require(_0xe7a3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b65d4,_0x1ade64){_0x1ade64=_0x1ade64||0xcc;return function(_0x26fef7){if(_0x26fef7){return _0x4b65d4[_0xe7a3('0x17')](_0x1ade64);}return _0x4b65d4['status'](_0x1ade64)[_0xe7a3('0x18')]();};}function respondWithResult(_0xad5a9b,_0x438ecb){_0x438ecb=_0x438ecb||0xc8;return function(_0x15e842){if(_0x15e842){return _0xad5a9b[_0xe7a3('0x19')](_0x438ecb)[_0xe7a3('0x1a')](_0x15e842);}};}function respondWithFilteredResult(_0x425e5b,_0x42b4de){return function(_0x118952){if(_0x118952){var _0x21a2aa=typeof _0x42b4de[_0xe7a3('0x1b')]===_0xe7a3('0x1c')&&typeof _0x42b4de[_0xe7a3('0x1d')]===_0xe7a3('0x1c');var _0x52704e=_0x118952['count'];var _0x251f6a=_0x21a2aa?0x0:_0x42b4de[_0xe7a3('0x1b')];var _0x3bf283=_0x21a2aa?_0x118952[_0xe7a3('0x1e')]:_0x42b4de[_0xe7a3('0x1b')]+_0x42b4de[_0xe7a3('0x1d')];var _0x4063a8;if(_0x3bf283>=_0x52704e){_0x3bf283=_0x52704e;_0x4063a8=0xc8;}else{_0x4063a8=0xce;}_0x425e5b[_0xe7a3('0x19')](_0x4063a8);return _0x425e5b[_0xe7a3('0x1f')](_0xe7a3('0x20'),_0x251f6a+'-'+_0x3bf283+'/'+_0x52704e)[_0xe7a3('0x1a')](_0x118952);}return null;};}function patchUpdates(_0xdecbc4){return function(_0x1010bc){try{jsonpatch[_0xe7a3('0x21')](_0x1010bc,_0xdecbc4,!![]);}catch(_0x570ef5){return BPromise[_0xe7a3('0x22')](_0x570ef5);}return _0x1010bc[_0xe7a3('0x23')]();};}function saveUpdates(_0x52890b,_0x14072c){return function(_0x37345a){if(_0x37345a){return _0x37345a[_0xe7a3('0x24')](_0x52890b)[_0xe7a3('0x25')](function(_0x204c08){return _0x204c08;});}return null;};}function removeEntity(_0x2b140c,_0x4ee209){return function(_0x152c93){if(_0x152c93){return _0x152c93[_0xe7a3('0x26')]()[_0xe7a3('0x25')](function(){_0x2b140c[_0xe7a3('0x19')](0xcc)[_0xe7a3('0x18')]();});}};}function handleEntityNotFound(_0x553f81,_0x4f3182){return function(_0x58b714){if(!_0x58b714){_0x553f81[_0xe7a3('0x17')](0x194);}return _0x58b714;};}function handleError(_0x13ccfa,_0x319529){_0x319529=_0x319529||0x1f4;return function(_0x589b03){logger[_0xe7a3('0x27')](_0x589b03[_0xe7a3('0x28')]);if(_0x589b03['name']){delete _0x589b03[_0xe7a3('0x29')];}_0x13ccfa[_0xe7a3('0x19')](_0x319529)[_0xe7a3('0x2a')](_0x589b03);};}exports[_0xe7a3('0x2b')]=function(_0x221576,_0x594275){var _0x323eb0={},_0x2c6ecf={},_0x70764a={'count':0x0,'rows':[]};var _0x23dd0c=_['map'](db[_0xe7a3('0x2c')][_0xe7a3('0x2d')],function(_0x41626f){return{'name':_0x41626f[_0xe7a3('0x2e')],'type':_0x41626f[_0xe7a3('0x2f')][_0xe7a3('0x30')]};});_0x2c6ecf[_0xe7a3('0x31')]=_[_0xe7a3('0x32')](_0x23dd0c,'name');_0x2c6ecf[_0xe7a3('0x33')]=_[_0xe7a3('0x34')](_0x221576[_0xe7a3('0x33')]);_0x2c6ecf[_0xe7a3('0x35')]=_[_0xe7a3('0x36')](_0x2c6ecf[_0xe7a3('0x31')],_0x2c6ecf['query']);_0x323eb0[_0xe7a3('0x37')]=_[_0xe7a3('0x36')](_0x2c6ecf[_0xe7a3('0x31')],qs[_0xe7a3('0x38')](_0x221576['query'][_0xe7a3('0x38')]));_0x323eb0['attributes']=_0x323eb0[_0xe7a3('0x37')][_0xe7a3('0x39')]?_0x323eb0[_0xe7a3('0x37')]:_0x2c6ecf['model'];if(!_0x221576[_0xe7a3('0x33')][_0xe7a3('0x3a')](_0xe7a3('0x3b'))){_0x323eb0[_0xe7a3('0x1d')]=qs[_0xe7a3('0x1d')](_0x221576['query'][_0xe7a3('0x1d')]);_0x323eb0[_0xe7a3('0x1b')]=qs[_0xe7a3('0x1b')](_0x221576[_0xe7a3('0x33')][_0xe7a3('0x1b')]);}_0x323eb0[_0xe7a3('0x3c')]=qs[_0xe7a3('0x3d')](_0x221576['query'][_0xe7a3('0x3d')]);_0x323eb0[_0xe7a3('0x3e')]=qs[_0xe7a3('0x35')](_['pick'](_0x221576['query'],_0x2c6ecf[_0xe7a3('0x35')]),_0x23dd0c);if(_0x221576[_0xe7a3('0x33')]['filter']){_0x323eb0[_0xe7a3('0x3e')]=_[_0xe7a3('0x3f')](_0x323eb0['where'],{'$or':_[_0xe7a3('0x32')](_0x23dd0c,function(_0x7a7572){if(_0x7a7572[_0xe7a3('0x2f')]!==_0xe7a3('0x40')){var _0x2184cd={};_0x2184cd[_0x7a7572[_0xe7a3('0x29')]]={'$like':'%'+_0x221576[_0xe7a3('0x33')][_0xe7a3('0x41')]+'%'};return _0x2184cd;}})});}_0x323eb0=_['merge']({},_0x323eb0,_0x221576[_0xe7a3('0x42')]);var _0x490e33={'where':_0x323eb0['where']};return db[_0xe7a3('0x2c')][_0xe7a3('0x1e')](_0x490e33)[_0xe7a3('0x25')](function(_0x24cc94){_0x70764a[_0xe7a3('0x1e')]=_0x24cc94;if(_0x221576['query']['includeAll']){_0x323eb0[_0xe7a3('0x43')]=[{'all':!![]}];}return db[_0xe7a3('0x2c')][_0xe7a3('0x44')](_0x323eb0);})[_0xe7a3('0x25')](function(_0x4e1fc2){_0x70764a[_0xe7a3('0x45')]=_0x4e1fc2;return _0x70764a;})['then'](respondWithFilteredResult(_0x594275,_0x323eb0))[_0xe7a3('0x46')](handleError(_0x594275,null));};exports['show']=function(_0x3bd930,_0x2cfd48){var _0x24c4aa={'raw':!![],'where':{'id':_0x3bd930[_0xe7a3('0x47')]['id']}},_0x13eb53={};_0x13eb53[_0xe7a3('0x31')]=_[_0xe7a3('0x34')](db[_0xe7a3('0x2c')][_0xe7a3('0x2d')]);_0x13eb53[_0xe7a3('0x33')]=_[_0xe7a3('0x34')](_0x3bd930[_0xe7a3('0x33')]);_0x13eb53[_0xe7a3('0x35')]=_[_0xe7a3('0x36')](_0x13eb53[_0xe7a3('0x31')],_0x13eb53['query']);_0x24c4aa[_0xe7a3('0x37')]=_[_0xe7a3('0x36')](_0x13eb53[_0xe7a3('0x31')],qs[_0xe7a3('0x38')](_0x3bd930['query']['fields']));_0x24c4aa[_0xe7a3('0x37')]=_0x24c4aa[_0xe7a3('0x37')]['length']?_0x24c4aa[_0xe7a3('0x37')]:_0x13eb53[_0xe7a3('0x31')];if(_0x3bd930['query']['includeAll']){_0x24c4aa['include']=[{'all':!![]}];}_0x24c4aa=_[_0xe7a3('0x3f')]({},_0x24c4aa,_0x3bd930[_0xe7a3('0x42')]);return db['Attachment'][_0xe7a3('0x48')](_0x24c4aa)[_0xe7a3('0x25')](handleEntityNotFound(_0x2cfd48,null))[_0xe7a3('0x25')](respondWithResult(_0x2cfd48,null))[_0xe7a3('0x46')](handleError(_0x2cfd48,null));};exports['clone']=function(_0x323b6b,_0x52823d){var _0x4ecb64={'where':{'id':_0x323b6b[_0xe7a3('0x47')]['id']}},_0x38064d={};_0x38064d[_0xe7a3('0x31')]=_[_0xe7a3('0x34')](db[_0xe7a3('0x2c')][_0xe7a3('0x2d')]);_0x4ecb64[_0xe7a3('0x37')]=_[_0xe7a3('0x36')](_0x38064d[_0xe7a3('0x31')],qs[_0xe7a3('0x38')](_0x323b6b['query']['fields']));_0x4ecb64[_0xe7a3('0x37')]=_0x4ecb64[_0xe7a3('0x37')][_0xe7a3('0x39')]?_0x4ecb64[_0xe7a3('0x37')]:_0x38064d[_0xe7a3('0x31')];if(_0x323b6b['query']['includeAll']){_0x4ecb64[_0xe7a3('0x43')]=[{'all':!![]}];}_0x4ecb64=_['merge']({},_0x4ecb64,_0x323b6b[_0xe7a3('0x42')]);return db[_0xe7a3('0x2c')]['find'](_0x4ecb64)[_0xe7a3('0x25')](handleEntityNotFound(_0x52823d,null))[_0xe7a3('0x25')](function(_0x16c3f9){if(_0x16c3f9){var _0x318602=_0x16c3f9[_0xe7a3('0x49')]({'plain':!![]});_0x318602=qs[_0xe7a3('0x4a')](_0x318602,['id',_0xe7a3('0x4b'),_0xe7a3('0x4c')]);_0x323b6b[_0xe7a3('0x4d')]=_[_0xe7a3('0x4a')](_0x323b6b[_0xe7a3('0x4d')],['id',_0xe7a3('0x4b'),'updatedAt']);return db['Attachment'][_0xe7a3('0x4e')](_[_0xe7a3('0x3f')](_0x318602,_0x323b6b['body']),{'include':_0x323b6b[_0xe7a3('0x33')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xe7a3('0x25')](respondWithResult(_0x52823d,0xc9))['catch'](handleError(_0x52823d,null));};exports[_0xe7a3('0x24')]=function(_0x3ac246,_0x150971){if(_0x3ac246[_0xe7a3('0x4d')]['id']){delete _0x3ac246[_0xe7a3('0x4d')]['id'];}return db[_0xe7a3('0x2c')][_0xe7a3('0x48')]({'where':{'id':_0x3ac246[_0xe7a3('0x47')]['id']}})[_0xe7a3('0x25')](handleEntityNotFound(_0x150971,null))['then'](saveUpdates(_0x3ac246[_0xe7a3('0x4d')],null))[_0xe7a3('0x25')](respondWithResult(_0x150971,null))[_0xe7a3('0x46')](handleError(_0x150971,null));};exports['destroy']=function(_0x36829d,_0x3933e3){return db[_0xe7a3('0x2c')]['find']({'where':{'id':_0x36829d[_0xe7a3('0x47')]['id']}})['then'](handleEntityNotFound(_0x3933e3,null))[_0xe7a3('0x25')](removeEntity(_0x3933e3,null))['catch'](handleError(_0x3933e3,null));};exports[_0xe7a3('0x4e')]=function(_0x4586a3,_0x1e2f2c,_0xe4e3f0){_0x4586a3[_0xe7a3('0x4d')]['name']=_0x4586a3[_0xe7a3('0x4f')]['originalname'];_0x4586a3[_0xe7a3('0x4d')][_0xe7a3('0x50')]=_0x4586a3[_0xe7a3('0x4f')][_0xe7a3('0x51')];_0x4586a3[_0xe7a3('0x4d')][_0xe7a3('0x2f')]=_0x4586a3[_0xe7a3('0x4f')][_0xe7a3('0x52')];return db[_0xe7a3('0x2c')][_0xe7a3('0x4e')](_0x4586a3[_0xe7a3('0x4d')])['then'](respondWithResult(_0x1e2f2c,0xc9))[_0xe7a3('0x46')](handleError(_0x1e2f2c,null));};exports['download']=function(_0x31859f,_0xc749bd,_0x1d18f4){return db[_0xe7a3('0x2c')][_0xe7a3('0x53')]({'where':{'id':_0x31859f[_0xe7a3('0x47')]['id']},'raw':!![]})[_0xe7a3('0x25')](handleEntityNotFound(_0xc749bd,null))[_0xe7a3('0x25')](function(_0x570d8c){if(_0x570d8c){var _0xa5897c=_0x570d8c[_0xe7a3('0x54')]!==null;var _0x361066=path[_0xe7a3('0x55')](config[_0xe7a3('0x56')],'server/files/attachments/');if(_0xa5897c){_0x361066=path[_0xe7a3('0x55')](_0x361066,_0xe7a3('0x57'));}var _0x17532c=path[_0xe7a3('0x55')](_0x361066,_0x570d8c[_0xe7a3('0x50')]);return _0xc749bd[_0xe7a3('0x58')](_0x17532c);}})[_0xe7a3('0x46')](handleError(_0xc749bd,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5624ca5..0527ce7 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 _0xfc83=['exports','define','lodash','request-promise','path','../../config/environment','./attachment.attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xfc83,0x1bb));var _0x3fc8=function(_0x5f0285,_0x5968fb){_0x5f0285=_0x5f0285-0x0;var _0x312527=_0xfc83[_0x5f0285];return _0x312527;};'use strict';var _=require(_0x3fc8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3fc8('0x1'));var fs=require('fs');var path=require(_0x3fc8('0x2'));var rimraf=require('rimraf');var config=require(_0x3fc8('0x3'));var attributes=require(_0x3fc8('0x4'));module[_0x3fc8('0x5')]=function(_0x2d2dde,_0x3da91d){return _0x2d2dde[_0x3fc8('0x6')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a80=['Attachment','attachments','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0x40c778,_0x471c5d){var _0x42127f=function(_0x414ec7){while(--_0x414ec7){_0x40c778['push'](_0x40c778['shift']());}};_0x42127f(++_0x471c5d);}(_0x3a80,0x154));var _0x03a8=function(_0x75a7dc,_0x2d5289){_0x75a7dc=_0x75a7dc-0x0;var _0x100d01=_0x3a80[_0x75a7dc];return _0x100d01;};'use strict';var _=require(_0x03a8('0x0'));var util=require('util');var logger=require(_0x03a8('0x1'))(_0x03a8('0x2'));var moment=require('moment');var BPromise=require(_0x03a8('0x3'));var rp=require(_0x03a8('0x4'));var fs=require('fs');var path=require(_0x03a8('0x5'));var rimraf=require(_0x03a8('0x6'));var config=require(_0x03a8('0x7'));var attributes=require(_0x03a8('0x8'));module[_0x03a8('0x9')]=function(_0x4dc8ba,_0x2f9753){return _0x4dc8ba[_0x03a8('0xa')](_0x03a8('0xb'),attributes,{'tableName':_0x03a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index eec4cde..7e2147c 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 _0x04b8=['Attachment','create','body','options','raw','debug','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateAttachment'];(function(_0x14cb75,_0x119a59){var _0x4cd743=function(_0xd0e0b2){while(--_0xd0e0b2){_0x14cb75['push'](_0x14cb75['shift']());}};_0x4cd743(++_0x119a59);}(_0x04b8,0x159));var _0x804b=function(_0x11238d,_0x499ac8){_0x11238d=_0x11238d-0x0;var _0x3686b0=_0x04b8[_0x11238d];return _0x3686b0;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var moment=require('moment');var BPromise=require(_0x804b('0x1'));var rs=require(_0x804b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x804b('0x3'))['db'];var utils=require(_0x804b('0x4'));var logger=require('../../config/logger')(_0x804b('0x5'));var config=require(_0x804b('0x6'));var jayson=require(_0x804b('0x7'));var client=jayson['client'][_0x804b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5404,_0x476262,_0x50826d){return new BPromise(function(_0x27e950,_0x1071b4){return client['request'](_0x3c5404,_0x50826d)[_0x804b('0x9')](function(_0x336325){logger[_0x804b('0xa')](_0x804b('0xb'),_0x476262,_0x804b('0xc'));logger['debug'](_0x804b('0xd'),_0x476262,_0x804b('0xc'),JSON[_0x804b('0xe')](_0x336325));if(_0x336325[_0x804b('0xf')]){if(_0x336325[_0x804b('0xf')][_0x804b('0x10')]===0x1f4){logger['error'](_0x804b('0xb'),_0x476262,_0x336325['error'][_0x804b('0x11')]);return _0x1071b4(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}logger[_0x804b('0xf')]('Attachment,\x20%s,\x20%s',_0x476262,_0x336325[_0x804b('0xf')][_0x804b('0x11')]);return _0x27e950(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}else{logger['info'](_0x804b('0xb'),_0x476262,_0x804b('0xc'));_0x27e950(_0x336325['result'][_0x804b('0x11')]);}})['catch'](function(_0x2c90b9){logger[_0x804b('0xf')](_0x804b('0xb'),_0x476262,_0x2c90b9);_0x1071b4(_0x2c90b9);});});}exports[_0x804b('0x12')]=function(_0x3a05c0){var _0x5a0a82=this;return new Promise(function(_0x871d6c,_0x50b4fe){return db[_0x804b('0x13')][_0x804b('0x14')](_0x3a05c0[_0x804b('0x15')],{'raw':_0x3a05c0[_0x804b('0x16')]?_0x3a05c0['options'][_0x804b('0x17')]===undefined?!![]:![]:!![]})[_0x804b('0x9')](function(_0x427166){logger[_0x804b('0xa')](_0x804b('0x12'),_0x3a05c0);logger[_0x804b('0x18')](_0x804b('0x12'),_0x3a05c0,JSON[_0x804b('0xe')](_0x427166));_0x871d6c(_0x427166);})[_0x804b('0x19')](function(_0x2b7271){logger[_0x804b('0xf')]('CreateAttachment',_0x2b7271[_0x804b('0x11')],_0x3a05c0);_0x50b4fe(_0x5a0a82[_0x804b('0xf')](0x1f4,_0x2b7271['message']));});});}; \ No newline at end of file +var _0x9224=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','create','body','options','raw'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9224,0xa3));var _0x4922=function(_0x1953a9,_0x12bedb){_0x1953a9=_0x1953a9-0x0;var _0x46b7c3=_0x9224[_0x1953a9];return _0x46b7c3;};'use strict';var _=require('lodash');var util=require(_0x4922('0x0'));var moment=require(_0x4922('0x1'));var BPromise=require(_0x4922('0x2'));var rs=require(_0x4922('0x3'));var fs=require('fs');var Redis=require(_0x4922('0x4'));var db=require(_0x4922('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4922('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4922('0x7')][_0x4922('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4216c0,_0x251048,_0x7a8bd1){return new BPromise(function(_0x245562,_0x5c65dd){return client[_0x4922('0x9')](_0x4216c0,_0x7a8bd1)[_0x4922('0xa')](function(_0x50db40){logger[_0x4922('0xb')](_0x4922('0xc'),_0x251048,_0x4922('0xd'));logger[_0x4922('0xe')](_0x4922('0xf'),_0x251048,_0x4922('0xd'),JSON[_0x4922('0x10')](_0x50db40));if(_0x50db40[_0x4922('0x11')]){if(_0x50db40['error'][_0x4922('0x12')]===0x1f4){logger['error'](_0x4922('0xc'),_0x251048,_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);return _0x5c65dd(_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);}logger['error'](_0x4922('0xc'),_0x251048,_0x50db40[_0x4922('0x11')]['message']);return _0x245562(_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);}else{logger[_0x4922('0xb')](_0x4922('0xc'),_0x251048,_0x4922('0xd'));_0x245562(_0x50db40[_0x4922('0x14')][_0x4922('0x13')]);}})['catch'](function(_0x2ae924){logger['error'](_0x4922('0xc'),_0x251048,_0x2ae924);_0x5c65dd(_0x2ae924);});});}exports[_0x4922('0x15')]=function(_0x1d7fc2){var _0x15cdc9=this;return new Promise(function(_0x2ef410,_0x435e7b){return db['Attachment'][_0x4922('0x16')](_0x1d7fc2[_0x4922('0x17')],{'raw':_0x1d7fc2[_0x4922('0x18')]?_0x1d7fc2[_0x4922('0x18')][_0x4922('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6a2d){logger[_0x4922('0xb')](_0x4922('0x15'),_0x1d7fc2);logger[_0x4922('0xe')](_0x4922('0x15'),_0x1d7fc2,JSON[_0x4922('0x10')](_0x2b6a2d));_0x2ef410(_0x2b6a2d);})[_0x4922('0x1a')](function(_0x3b182b){logger['error'](_0x4922('0x15'),_0x3b182b[_0x4922('0x13')],_0x1d7fc2);_0x435e7b(_0x15cdc9['error'](0x1f4,_0x3b182b[_0x4922('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 37eb14e..7b3db64 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x272f77,_0x16df79){var _0x112c0d=function(_0x440b93){while(--_0x440b93){_0x272f77['push'](_0x272f77['shift']());}};_0x112c0d(++_0x16df79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a6e88,_0xd356f0){_0x3a6e88=_0x3a6e88-0x0;var _0x2527a9=_0x5f2f[_0x3a6e88];return _0x2527a9;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x52200a,_0x213479){var _0x46fe3b=function(_0x46848e){while(--_0x46848e){_0x52200a['push'](_0x52200a['shift']());}};_0x46fe3b(++_0x213479);}(_0x757a,0xde));var _0xa757=function(_0x4ae8d1,_0x743049){_0x4ae8d1=_0x4ae8d1-0x0;var _0x71ce21=_0x757a[_0x4ae8d1];return _0x71ce21;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 28b880d..84b32ad 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 _0x8d01=['moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','api','activedirectory','undefined','baseDN','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','user','agent','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local'];(function(_0x545dda,_0x577f99){var _0xef8cba=function(_0x3cf2e8){while(--_0x3cf2e8){_0x545dda['push'](_0x545dda['shift']());}};_0xef8cba(++_0x577f99);}(_0x8d01,0x193));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require(_0x18d0('0x0'));var LocalStrategy=require(_0x18d0('0x1'))['Strategy'];var moment=require(_0x18d0('0x2'));var ActiveDirectory=require(_0x18d0('0x3'));var BPromise=require(_0x18d0('0x4'));var util=require(_0x18d0('0x5'));var db=require(_0x18d0('0x6'))['db'];var authService=require(_0x18d0('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x18d0('0x8'));function isActiveDirectoryConfigured(_0x5211ca){var _0x3de2d8=![];if(typeof _0x5211ca[_0x18d0('0x9')]!==_0x18d0('0xa')){_0x3de2d8=_0x5211ca[_0x18d0('0x9')][_0x18d0('0xb')]&&_0x5211ca[_0x18d0('0x9')]['url']&&_0x5211ca[_0x18d0('0x9')][_0x18d0('0xc')];}return _0x3de2d8;}function adAuthenticate(_0x1ed66a,_0x14557f,_0x3319c6){return new BPromise(function(_0x1fc404,_0x4874b1){try{var _0x3f59f7=new ActiveDirectory(_0x1ed66a);_0x3f59f7[_0x18d0('0xd')](_0x14557f,_0x3319c6,function(_0x1375fb,_0x5a2817){if(_0x1375fb){logger[_0x18d0('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x14557f,util['inspect'](_0x1375fb,{'showHidden':![],'depth':null}));_0x4874b1(_0x18d0('0xf'));}else if(!_0x5a2817){logger[_0x18d0('0xe')](_0x18d0('0x10'),_0x14557f);_0x4874b1(_0x18d0('0xf'));}else{_0x1fc404(_0x5a2817);}});}catch(_0x309cef){_0x4874b1(_0x309cef);}});}function ActiveDirectoryAuthenticate(_0x49c6e7,_0x200df5,_0x418374,_0x4bdca5){var _0x278153,_0x5aac21;if(!isActiveDirectoryConfigured(config)){logger[_0x18d0('0xe')](_0x18d0('0x11'),_0x200df5);return _0x4bdca5(null,![],{'message':_0x18d0('0xf')});}return db[_0x18d0('0x12')][_0x18d0('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x18d0('0x14')],'raw':!![]})[_0x18d0('0x15')](function(_0x2d36bd){_0x278153=_0x2d36bd;if(!_0x278153['adSsoEnabled']){logger[_0x18d0('0xe')](_0x18d0('0x16'),_0x200df5);throw new Error(_0x18d0('0xf'));}return _0x49c6e7[_0x18d0('0x13')]({'attributes':['id',_0x18d0('0x17'),_0x18d0('0x18'),_0x18d0('0x19'),_0x18d0('0x1a'),'disabled',_0x18d0('0x1b'),'blockedAt','online'],'where':{'name':_0x200df5,'role':{'$or':['admin',_0x18d0('0x1c'),_0x18d0('0x1d')]},'adSsoEnabled':!![]}});})[_0x18d0('0x15')](function(_0x4bec6a){if(!_0x4bec6a||_0x4bec6a&&_0x4bec6a[_0x18d0('0x17')]!==_0x200df5){throw new Error(_0x18d0('0xf'));}_0x5aac21=_0x4bec6a;var _0x1c164e=_0x5aac21[_0x18d0('0x17')]+'@'+config[_0x18d0('0x9')][_0x18d0('0xc')];return adAuthenticate(config[_0x18d0('0x9')],_0x1c164e,_0x418374);})[_0x18d0('0x15')](function(_0x2c1a76){if(_0x5aac21['disabled']){throw new Error(_0x18d0('0xf'));}if(_0x278153['blockDuration']>0x0){if(_0x5aac21[_0x18d0('0x1b')]){if(moment(_0x5aac21[_0x18d0('0x1e')])[_0x18d0('0x1f')](_0x278153[_0x18d0('0x14')],_0x18d0('0x20'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x18d0('0x21')](_0x5aac21,0x0,![],null)[_0x18d0('0x15')](function(){return utils[_0x18d0('0x22')](_0x5aac21);})[_0x18d0('0x15')](function(){return _0x4bdca5(null,_0x5aac21);});}else{return utils['getLicense'](_0x5aac21)[_0x18d0('0x15')](function(){return _0x4bdca5(null,_0x5aac21);});}}else{return utils[_0x18d0('0x22')](_0x5aac21)[_0x18d0('0x15')](function(){return _0x4bdca5(null,_0x5aac21);});}})[_0x18d0('0x23')](function(_0xfdc08f){return _0x4bdca5(null,![],_0xfdc08f);});}function handleError(_0x5c5b78,_0x3dfa94,_0x4cf86e){return _0x5c5b78[_0x18d0('0x24')](_0x3dfa94||0x1f4)['send']({'message':_0x4cf86e?_0x4cf86e[_0x18d0('0x25')]||_0x4cf86e:''});}exports[_0x18d0('0x26')]=function(_0x4fc99e,_0x3f540b,_0x2c94ec){passport[_0x18d0('0xd')](_0x18d0('0x27'),function(_0x224d6a,_0xc0bf90,_0x448507){var _0x132e87=_0x224d6a||_0x448507;if(_0x132e87){return handleError(_0x3f540b,0x191,_0x132e87);}if(!_0xc0bf90){return handleError(_0x3f540b,0x194,{'message':_0x18d0('0x28')});}else{var _0xfa8aa={'payload':{'id':_0xc0bf90['id'],'role':_0xc0bf90[_0x18d0('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x18d0('0x29')](_0xfa8aa)[_0x18d0('0x15')](function(_0x47ec8f){_0x3f540b[_0x18d0('0x2a')]({'id':_0xc0bf90['id'],'token':_0x47ec8f,'statusCall':'','isAlreadyLogged':_0xc0bf90['online']});});}})(_0x4fc99e,_0x3f540b,_0x2c94ec);};passport[_0x18d0('0x2b')](_0x18d0('0x27'),new LocalStrategy({'usernameField':_0x18d0('0x17'),'passwordField':_0x18d0('0x18')},function(_0x2579a1,_0x261d75,_0x30d4c8){return ActiveDirectoryAuthenticate(db[_0x18d0('0x2c')],_0x2579a1,_0x261d75,_0x30d4c8);})); \ No newline at end of file +var _0x4f11=['use','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','admin','user','name','add','clearBlockUser','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x3cfbf2,_0x444904){var _0x1492ed=function(_0x293a91){while(--_0x293a91){_0x3cfbf2['push'](_0x3cfbf2['shift']());}};_0x1492ed(++_0x444904);}(_0x4f11,0xcd));var _0x14f1=function(_0x64c9c3,_0x432c66){_0x64c9c3=_0x64c9c3-0x0;var _0x5a189c=_0x4f11[_0x64c9c3];return _0x5a189c;};'use strict';var passport=require(_0x14f1('0x0'));var LocalStrategy=require(_0x14f1('0x1'))[_0x14f1('0x2')];var moment=require(_0x14f1('0x3'));var ActiveDirectory=require(_0x14f1('0x4'));var BPromise=require('bluebird');var util=require(_0x14f1('0x5'));var db=require(_0x14f1('0x6'))['db'];var authService=require(_0x14f1('0x7'));var utils=require(_0x14f1('0x8'));var config=require(_0x14f1('0x9'));var logger=require(_0x14f1('0xa'))(_0x14f1('0xb'));function isActiveDirectoryConfigured(_0x58c2c6){var _0x2dd330=![];if(typeof _0x58c2c6['activedirectory']!==_0x14f1('0xc')){_0x2dd330=_0x58c2c6[_0x14f1('0xd')][_0x14f1('0xe')]&&_0x58c2c6[_0x14f1('0xd')][_0x14f1('0xf')]&&_0x58c2c6[_0x14f1('0xd')][_0x14f1('0x10')];}return _0x2dd330;}function adAuthenticate(_0x591c2e,_0x7e066a,_0xca801c){return new BPromise(function(_0x76e4d,_0x2a502d){try{var _0x4828bf=new ActiveDirectory(_0x591c2e);_0x4828bf['authenticate'](_0x7e066a,_0xca801c,function(_0x4a7058,_0x2125d2){if(_0x4a7058){logger[_0x14f1('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x7e066a,util[_0x14f1('0x12')](_0x4a7058,{'showHidden':![],'depth':null}));_0x2a502d(_0x14f1('0x13'));}else if(!_0x2125d2){logger[_0x14f1('0x11')](_0x14f1('0x14'),_0x7e066a);_0x2a502d(_0x14f1('0x13'));}else{_0x76e4d(_0x2125d2);}});}catch(_0x367f18){_0x2a502d(_0x367f18);}});}function ActiveDirectoryAuthenticate(_0x5ad8d8,_0x1086b0,_0x7a3f1e,_0x29d949){var _0x36572a,_0x391c01;if(!isActiveDirectoryConfigured(config)){logger[_0x14f1('0x11')](_0x14f1('0x15'),_0x1086b0);return _0x29d949(null,![],{'message':_0x14f1('0x13')});}return db[_0x14f1('0x16')][_0x14f1('0x17')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x14f1('0x18')],'raw':!![]})[_0x14f1('0x19')](function(_0x45e42d){_0x36572a=_0x45e42d;if(!_0x36572a[_0x14f1('0x1a')]){logger[_0x14f1('0x11')](_0x14f1('0x1b'),_0x1086b0);throw new Error(_0x14f1('0x13'));}return _0x5ad8d8[_0x14f1('0x17')]({'attributes':['id','name',_0x14f1('0x1c'),_0x14f1('0x1d'),_0x14f1('0x1e'),_0x14f1('0x1f'),_0x14f1('0x20'),_0x14f1('0x21'),_0x14f1('0x22')],'where':{'name':_0x1086b0,'role':{'$or':[_0x14f1('0x23'),_0x14f1('0x24'),'agent']},'adSsoEnabled':!![]}});})[_0x14f1('0x19')](function(_0x4f5a83){if(!_0x4f5a83||_0x4f5a83&&_0x4f5a83[_0x14f1('0x25')]!==_0x1086b0){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x391c01=_0x4f5a83;var _0x393262=_0x391c01['name']+'@'+config['activedirectory'][_0x14f1('0x10')];return adAuthenticate(config[_0x14f1('0xd')],_0x393262,_0x7a3f1e);})[_0x14f1('0x19')](function(_0x31975a){if(_0x391c01['disabled']){throw new Error(_0x14f1('0x13'));}if(_0x36572a[_0x14f1('0x18')]>0x0){if(_0x391c01['blocked']){if(moment(_0x391c01[_0x14f1('0x21')])[_0x14f1('0x26')](_0x36572a['blockDuration'],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x14f1('0x27')](_0x391c01,0x0,![],null)[_0x14f1('0x19')](function(){return utils[_0x14f1('0x28')](_0x391c01);})[_0x14f1('0x19')](function(){return _0x29d949(null,_0x391c01);});}else{return utils['getLicense'](_0x391c01)[_0x14f1('0x19')](function(){return _0x29d949(null,_0x391c01);});}}else{return utils[_0x14f1('0x28')](_0x391c01)['then'](function(){return _0x29d949(null,_0x391c01);});}})[_0x14f1('0x29')](function(_0x61f3dd){return _0x29d949(null,![],_0x61f3dd);});}function handleError(_0x37e650,_0x501604,_0x4ee1d5){return _0x37e650[_0x14f1('0x2a')](_0x501604||0x1f4)['send']({'message':_0x4ee1d5?_0x4ee1d5[_0x14f1('0x2b')]||_0x4ee1d5:''});}exports[_0x14f1('0x2c')]=function(_0x1244c7,_0x2bbdb1,_0x12e500){passport[_0x14f1('0x2d')](_0x14f1('0x2e'),function(_0x1a5cef,_0x450d1e,_0x4e4ef9){var _0x89257b=_0x1a5cef||_0x4e4ef9;if(_0x89257b){return handleError(_0x2bbdb1,0x191,_0x89257b);}if(!_0x450d1e){return handleError(_0x2bbdb1,0x194,{'message':_0x14f1('0x2f')});}else{var _0x57811e={'payload':{'id':_0x450d1e['id'],'role':_0x450d1e[_0x14f1('0x1e')]},'options':{'expiresIn':0x15180}};return authService[_0x14f1('0x30')](_0x57811e)['then'](function(_0x3cc83e){_0x2bbdb1[_0x14f1('0x31')]({'id':_0x450d1e['id'],'token':_0x3cc83e,'statusCall':'','isAlreadyLogged':_0x450d1e['online']});});}})(_0x1244c7,_0x2bbdb1,_0x12e500);};passport[_0x14f1('0x32')]('ad-login',new LocalStrategy({'usernameField':_0x14f1('0x25'),'passwordField':_0x14f1('0x1c')},function(_0x5cad08,_0x5ebf81,_0x254e0d){return ActiveDirectoryAuthenticate(db['User'],_0x5cad08,_0x5ebf81,_0x254e0d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 63c1609..e98dd31 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 _0x7c3b=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x58ff85,_0x754999){var _0x331870=function(_0x12b5c9){while(--_0x12b5c9){_0x58ff85['push'](_0x58ff85['shift']());}};_0x331870(++_0x754999);}(_0x7c3b,0x9d));var _0xb7c3=function(_0x233d36,_0x18271c){_0x233d36=_0x233d36-0x0;var _0x1d4b17=_0x7c3b[_0x233d36];return _0x1d4b17;};'use strict';var express=require(_0xb7c3('0x0'));var router=express[_0xb7c3('0x1')]();var controller=require(_0xb7c3('0x2'));router['post']('/',controller[_0xb7c3('0x3')]);module[_0xb7c3('0x4')]=router; \ No newline at end of file +var _0xa4dd=['login','exports','Router','./authActiveDirectory.controller'];(function(_0x574de1,_0x123779){var _0x51030d=function(_0x288b21){while(--_0x288b21){_0x574de1['push'](_0x574de1['shift']());}};_0x51030d(++_0x123779);}(_0xa4dd,0x1da));var _0xda4d=function(_0x4aa1b1,_0x56b523){_0x4aa1b1=_0x4aa1b1-0x0;var _0x1961c4=_0xa4dd[_0x4aa1b1];return _0x1961c4;};'use strict';var express=require('express');var router=express[_0xda4d('0x0')]();var controller=require(_0xda4d('0x1'));router['post']('/',controller[_0xda4d('0x2')]);module[_0xda4d('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 aa56d08..7b40526 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x2ecf86,_0x222f6d){_0x2ecf86=_0x2ecf86-0x0;var _0x58f6ec=_0x7a54[_0x2ecf86];return _0x58f6ec;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x51d958,_0x1aaa67){var _0x7d6412=function(_0x2e9eee){while(--_0x2e9eee){_0x51d958['push'](_0x51d958['shift']());}};_0x7d6412(++_0x1aaa67);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5e4778a..7a2dcdc 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 _0xf5af=['isMiddleware','setTokenCookie','exports','passport','Router','../user/user.controller.js','get','login','/callback','callback'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0xf5af,0x175));var _0xff5a=function(_0x41fc64,_0x2609d6){_0x41fc64=_0x41fc64-0x0;var _0x3b9dad=_0xf5af[_0x41fc64];return _0x3b9dad;};'use strict';var express=require('express');var passport=require(_0xff5a('0x0'));var router=express[_0xff5a('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xff5a('0x2'));var authService=require('../../components/auth/service');router[_0xff5a('0x3')]('/',controller[_0xff5a('0x4')]);router[_0xff5a('0x3')](_0xff5a('0x5'),controller[_0xff5a('0x6')],authService[_0xff5a('0x7')],userController[_0xff5a('0x4')],authService[_0xff5a('0x8')]);module[_0xff5a('0x9')]=router; \ No newline at end of file +var _0xa7b1=['exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x4e95ba,_0x13ca80){var _0xa4576=function(_0x184e06){while(--_0x184e06){_0x4e95ba['push'](_0x4e95ba['shift']());}};_0xa4576(++_0x13ca80);}(_0xa7b1,0x1f0));var _0x1a7b=function(_0x33b0ac,_0x385378){_0x33b0ac=_0x33b0ac-0x0;var _0x888a0a=_0xa7b1[_0x33b0ac];return _0x888a0a;};'use strict';var express=require(_0x1a7b('0x0'));var passport=require('passport');var router=express[_0x1a7b('0x1')]();var controller=require(_0x1a7b('0x2'));var userController=require(_0x1a7b('0x3'));var authService=require(_0x1a7b('0x4'));router['get']('/',controller[_0x1a7b('0x5')]);router['get'](_0x1a7b('0x6'),controller[_0x1a7b('0x7')],authService[_0x1a7b('0x8')],userController[_0x1a7b('0x5')],authService[_0x1a7b('0x9')]);module[_0x1a7b('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 1448fad..4f76a43 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 _0x0f5f=['passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','blockDuration','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','find','MailServerOut','Smtp','CloudProvider','merge','format','email','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','save','Password\x20reset!','catch','use','util'];(function(_0x3c233a,_0x378882){var _0x5d8815=function(_0x568936){while(--_0x568936){_0x3c233a['push'](_0x3c233a['shift']());}};_0x5d8815(++_0x378882);}(_0x0f5f,0xa7));var _0xf0f5=function(_0x45b86a,_0x2dda03){_0x45b86a=_0x45b86a-0x0;var _0x113053=_0x0f5f[_0x45b86a];return _0x113053;};'use strict';var util=require(_0xf0f5('0x0'));var passport=require(_0xf0f5('0x1'));var LocalStrategy=require(_0xf0f5('0x2'))[_0xf0f5('0x3')];var jayson=require(_0xf0f5('0x4'));var _=require(_0xf0f5('0x5'));var rs=require(_0xf0f5('0x6'));var moment=require('moment');var db=require(_0xf0f5('0x7'))['db'];var authService=require(_0xf0f5('0x8'));var utils=require(_0xf0f5('0x9'));var client=jayson[_0xf0f5('0xa')][_0xf0f5('0xb')]({'port':0x232b});function localAuthenticate(_0x200802,_0x459868,_0x332dbe,_0x3742ec){var _0x56ae27,_0x3a79d3;return db[_0xf0f5('0xc')][_0xf0f5('0xd')]({'where':{'id':0x1},'attributes':[_0xf0f5('0xe'),'blockDuration'],'raw':!![]})[_0xf0f5('0xf')](function(_0x4fef7c){_0x56ae27=_0x4fef7c;return _0x200802[_0xf0f5('0xd')]({'attributes':['id',_0xf0f5('0x10'),_0xf0f5('0x11'),_0xf0f5('0x12'),'role',_0xf0f5('0x13'),_0xf0f5('0x14'),_0xf0f5('0x15'),_0xf0f5('0x16')],'where':{'name':_0x459868,'role':{'$or':[_0xf0f5('0x17'),_0xf0f5('0x18'),_0xf0f5('0x19')]}}});})[_0xf0f5('0xf')](function(_0x484eb9){if(!_0x484eb9||_0x484eb9&&_0x484eb9[_0xf0f5('0x10')]!==_0x459868){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3a79d3=_0x484eb9;return _0x3a79d3;}})[_0xf0f5('0xf')](function(){_0x3a79d3[_0xf0f5('0x1a')](_0x332dbe,function(_0x39f1d1,_0x45fecb){var _0x315570=_0x3a79d3['loginAttempts']+0x1;if(_0x39f1d1){return _0x3742ec(_0x39f1d1);}else if(!_0x45fecb){if(_0x3a79d3[_0xf0f5('0x13')]){return _0x3742ec(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x56ae27[_0xf0f5('0xe')]>0x0){if(_0x3a79d3[_0xf0f5('0x14')]){if(_0x56ae27[_0xf0f5('0x1b')]>0x0){if(moment(_0x3a79d3[_0xf0f5('0x15')])[_0xf0f5('0x1c')](_0x56ae27[_0xf0f5('0x1b')],_0xf0f5('0x1d'))>moment()){return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});}else{return utils[_0xf0f5('0x1f')](_0x3a79d3,_0x315570,![],null)[_0xf0f5('0xf')](function(){return _0x3742ec(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});}}else{if(_0x315570>=_0x56ae27[_0xf0f5('0xe')]){return utils['clearBlockUser'](_0x3a79d3,0x0,!![],moment())[_0xf0f5('0xf')](function(){return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});});}else{return utils[_0xf0f5('0x1f')](_0x3a79d3,_0x315570,![],null)['then'](function(){return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});});}}}else{return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});}}else{if(_0x3a79d3[_0xf0f5('0x13')]){return _0x3742ec(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x56ae27[_0xf0f5('0xe')]>0x0){if(_0x3a79d3[_0xf0f5('0x14')]){if(_0x56ae27[_0xf0f5('0x1b')]>0x0){if(moment(_0x3a79d3['blockedAt'])[_0xf0f5('0x1c')](_0x56ae27['blockDuration'],_0xf0f5('0x1d'))>moment()){return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});}else{return utils[_0xf0f5('0x1f')](_0x3a79d3,0x0,![],null)[_0xf0f5('0xf')](function(){return utils[_0xf0f5('0x20')](_0x3a79d3);})['then'](function(){return _0x3742ec(null,_0x3a79d3);});}}else{return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});}}else{return utils[_0xf0f5('0x1f')](_0x3a79d3,0x0,![],null)[_0xf0f5('0xf')](function(){return utils[_0xf0f5('0x20')](_0x3a79d3);})[_0xf0f5('0xf')](function(){return _0x3742ec(null,_0x3a79d3);})['catch'](function(_0x30c4d4){return _0x3742ec(null,![],_0x30c4d4);});}}else{if(_0x3a79d3[_0xf0f5('0x14')]){return _0x3742ec(null,![],{'message':_0xf0f5('0x1e')});}else{return utils[_0xf0f5('0x20')](_0x3a79d3)[_0xf0f5('0xf')](function(){return _0x3742ec(null,_0x3a79d3);});}}}});})['catch'](function(_0x1af9e8){return _0x3742ec(null,![],_0x1af9e8);});}function sendServiceMail(_0x2bb634){return db['MailAccount'][_0xf0f5('0x21')]({'where':{'service':!![]},'attributes':['id',_0xf0f5('0x10'),'email'],'include':[{'model':db[_0xf0f5('0x22')],'as':_0xf0f5('0x23'),'include':[{'model':db[_0xf0f5('0x24')],'as':_0xf0f5('0x24')}]}]})['then'](function(_0xe5cb3a){if(!_0xe5cb3a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5267ba=_0xe5cb3a['getSmtpOptions']();var _0x5c85c9={'account':_0x5267ba,'message':_[_0xf0f5('0x25')]({'from':util[_0xf0f5('0x26')]('\x22%s\x22\x20<%s>',_0xe5cb3a['name'],_0xe5cb3a[_0xf0f5('0x27')]||_0xe5cb3a[_0xf0f5('0x23')]['user'])},_0x2bb634)};return client[_0xf0f5('0x28')]('SendMail',_0x5c85c9);})[_0xf0f5('0xf')](function(_0x314891){if(_0x314891['error']){throw new Error(util[_0xf0f5('0x26')](_0xf0f5('0x29'),_0x314891['error'][_0xf0f5('0x2a')]||JSON[_0xf0f5('0x2b')](_0x314891[_0xf0f5('0x2c')])));}return!![];});}function handleError(_0x2fe680,_0x84f139,_0x3206f0){return _0x2fe680[_0xf0f5('0x2d')](_0x84f139||0x1f4)[_0xf0f5('0x2e')]({'message':_0x3206f0?_0x3206f0[_0xf0f5('0x2a')]||_0x3206f0:''});}exports[_0xf0f5('0x2f')]=function(_0x3813c2,_0x12b690,_0x490893){passport[_0xf0f5('0x1a')](_0xf0f5('0x30'),function(_0x4c90b3,_0x33d990,_0x5ac832){var _0x39da1f=_0x4c90b3||_0x5ac832;if(_0x39da1f){return handleError(_0x12b690,0x191,_0x39da1f);}if(!_0x33d990){return handleError(_0x12b690,0x194,{'message':_0xf0f5('0x31')});}else{var _0xd166c8={'payload':{'id':_0x33d990['id'],'role':_0x33d990[_0xf0f5('0x32')]},'options':{'expiresIn':0x15180}};return authService[_0xf0f5('0x33')](_0xd166c8)['then'](function(_0x153dc0){_0x12b690[_0xf0f5('0x34')]({'id':_0x33d990['id'],'token':_0x153dc0,'statusCall':'','isAlreadyLogged':_0x33d990[_0xf0f5('0x35')]});});}})(_0x3813c2,_0x12b690,_0x490893);};exports[_0xf0f5('0x36')]=function(_0x1fc4bc,_0x371c6b){if(!_0x1fc4bc[_0xf0f5('0x37')]['email']){return handleError(_0x371c6b,0x1f4,{'message':_0xf0f5('0x38')});}var _0x213da8=rs['generate']();_0x1fc4bc[_0xf0f5('0x37')][_0xf0f5('0x27')]=_0x1fc4bc['body'][_0xf0f5('0x27')][_0xf0f5('0x39')]()[_0xf0f5('0x3a')]();var _0x4340ce;return db[_0xf0f5('0xc')][_0xf0f5('0xd')]({'where':{'id':0x1},'attributes':[_0xf0f5('0xe'),'blockDuration'],'raw':!![]})[_0xf0f5('0xf')](function(_0x58a8b0){_0x4340ce=_0x58a8b0;return db['User'][_0xf0f5('0x21')]({'where':{'email':_0x1fc4bc[_0xf0f5('0x37')][_0xf0f5('0x27')]}});})['then'](function(_0x3cfae9){if(!_0x3cfae9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3cfae9[_0xf0f5('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3cfae9[_0xf0f5('0x14')]){if(moment(_0x3cfae9['blockedAt'])[_0xf0f5('0x1c')](_0x4340ce['blockDuration'],'minutes')>moment()){throw new Error(_0xf0f5('0x3b'));}else{_0x3cfae9[_0xf0f5('0x14')]=![];_0x3cfae9[_0xf0f5('0x15')]=null;}}_0x3cfae9['resetPasswordToken']=_0x213da8;_0x3cfae9[_0xf0f5('0x3c')]=Date[_0xf0f5('0x3d')]()+0x36ee80;return _0x3cfae9['save']();})[_0xf0f5('0xf')](function(){return sendServiceMail({'to':_0x1fc4bc[_0xf0f5('0x37')][_0xf0f5('0x27')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xf0f5('0x3e')+_0xf0f5('0x3f')+_0xf0f5('0x40')+_0x1fc4bc['headers'][_0xf0f5('0x41')]+_0xf0f5('0x42')+_0x213da8+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xf0f5('0xf')](function(){_0x371c6b[_0xf0f5('0x2d')](0xc8)[_0xf0f5('0x2e')]({'message':_0xf0f5('0x43')});})['catch'](function(_0x41df26){return handleError(_0x371c6b,0x1f4,_0x41df26);});};exports[_0xf0f5('0x44')]=function(_0x584d6e,_0x1809f7){return db[_0xf0f5('0x45')][_0xf0f5('0x21')]({'where':{'resetPasswordToken':_0x584d6e[_0xf0f5('0x46')][_0xf0f5('0x47')],'resetPasswordExpires':{'$gt':Date[_0xf0f5('0x3d')]()}}})['then'](function(_0x2729a8){if(!_0x2729a8){throw new Error(_0xf0f5('0x48'));}return db[_0xf0f5('0xc')][_0xf0f5('0xd')]({'attributes':['id',_0xf0f5('0x49'),_0xf0f5('0x4a'),_0xf0f5('0x4b')]})[_0xf0f5('0xf')](function(_0x4698c9){if(_0x4698c9[_0xf0f5('0x49')])authService[_0xf0f5('0x4c')](_0x584d6e[_0xf0f5('0x37')][_0xf0f5('0x11')]);if(!_0x4698c9['enforcePasswordHistory']||!_0x2729a8[_0xf0f5('0x4d')])return _0x2729a8;authService[_0xf0f5('0x4e')](_0x584d6e[_0xf0f5('0x37')][_0xf0f5('0x11')],_0x2729a8['previousPasswords'],_0x4698c9[_0xf0f5('0x4b')]);return _0x2729a8;})[_0xf0f5('0xf')](function(){_0x2729a8[_0xf0f5('0x11')]=_0x584d6e[_0xf0f5('0x37')][_0xf0f5('0x11')];_0x2729a8[_0xf0f5('0x4f')]=null;_0x2729a8['resetPasswordExpires']=null;return _0x2729a8[_0xf0f5('0x50')]();});})[_0xf0f5('0xf')](function(){_0x1809f7[_0xf0f5('0x2d')](0xc8)[_0xf0f5('0x2e')]({'message':_0xf0f5('0x51')});})[_0xf0f5('0x52')](function(_0x23e3f7){return handleError(_0x1809f7,0x1f4,_0x23e3f7);});};passport[_0xf0f5('0x53')](_0xf0f5('0x30'),new LocalStrategy({'usernameField':_0xf0f5('0x10'),'passwordField':_0xf0f5('0x11')},function(_0x202bed,_0x1dcdba,_0x213b51){return localAuthenticate(db[_0xf0f5('0x45')],_0x202bed,_0x1dcdba,_0x213b51);})); \ No newline at end of file +var _0x65a4=['findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','add','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','user','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','trim','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','send','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x65a4,0x185));var _0x465a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x65a4[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0x465a('0x0'));var passport=require(_0x465a('0x1'));var LocalStrategy=require(_0x465a('0x2'))[_0x465a('0x3')];var jayson=require(_0x465a('0x4'));var _=require(_0x465a('0x5'));var rs=require('randomstring');var moment=require(_0x465a('0x6'));var db=require(_0x465a('0x7'))['db'];var authService=require(_0x465a('0x8'));var utils=require(_0x465a('0x9'));var client=jayson['client'][_0x465a('0xa')]({'port':0x232b});function localAuthenticate(_0x16bc0e,_0x14fb56,_0x2db2be,_0x3183e8){var _0x2f9fed,_0x143ace;return db['Setting'][_0x465a('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x465a('0xc')],'raw':!![]})[_0x465a('0xd')](function(_0x45ac3f){_0x2f9fed=_0x45ac3f;return _0x16bc0e['findOne']({'attributes':['id',_0x465a('0xe'),_0x465a('0xf'),_0x465a('0x10'),_0x465a('0x11'),_0x465a('0x12'),_0x465a('0x13'),_0x465a('0x14'),'loginAttempts'],'where':{'name':_0x14fb56,'role':{'$or':[_0x465a('0x15'),'user','agent']}}});})[_0x465a('0xd')](function(_0x14d68e){if(!_0x14d68e||_0x14d68e&&_0x14d68e[_0x465a('0xe')]!==_0x14fb56){throw new Error(_0x465a('0x16'));}else{_0x143ace=_0x14d68e;return _0x143ace;}})[_0x465a('0xd')](function(){_0x143ace[_0x465a('0x17')](_0x2db2be,function(_0x4d5a97,_0x542361){var _0x1b2a3d=_0x143ace[_0x465a('0x18')]+0x1;if(_0x4d5a97){return _0x3183e8(_0x4d5a97);}else if(!_0x542361){if(_0x143ace[_0x465a('0x12')]){return _0x3183e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2f9fed[_0x465a('0x19')]>0x0){if(_0x143ace[_0x465a('0x13')]){if(_0x2f9fed['blockDuration']>0x0){if(moment(_0x143ace['blockedAt'])[_0x465a('0x1a')](_0x2f9fed['blockDuration'],'minutes')>moment()){return _0x3183e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x465a('0x1b')](_0x143ace,_0x1b2a3d,![],null)['then'](function(){return _0x3183e8(null,![],{'message':_0x465a('0x16')});});}}else{return _0x3183e8(null,![],{'message':_0x465a('0x16')});}}else{if(_0x1b2a3d>=_0x2f9fed['allowedLoginAttempts']){return utils['clearBlockUser'](_0x143ace,0x0,!![],moment())[_0x465a('0xd')](function(){return _0x3183e8(null,![],{'message':_0x465a('0x16')});});}else{return utils[_0x465a('0x1b')](_0x143ace,_0x1b2a3d,![],null)[_0x465a('0xd')](function(){return _0x3183e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3183e8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x143ace['disabled']){return _0x3183e8(null,![],{'message':_0x465a('0x16')});}else if(_0x2f9fed[_0x465a('0x19')]>0x0){if(_0x143ace[_0x465a('0x13')]){if(_0x2f9fed[_0x465a('0xc')]>0x0){if(moment(_0x143ace[_0x465a('0x14')])['add'](_0x2f9fed[_0x465a('0xc')],'minutes')>moment()){return _0x3183e8(null,![],{'message':_0x465a('0x16')});}else{return utils['clearBlockUser'](_0x143ace,0x0,![],null)[_0x465a('0xd')](function(){return utils[_0x465a('0x1c')](_0x143ace);})['then'](function(){return _0x3183e8(null,_0x143ace);});}}else{return _0x3183e8(null,![],{'message':_0x465a('0x16')});}}else{return utils[_0x465a('0x1b')](_0x143ace,0x0,![],null)[_0x465a('0xd')](function(){return utils[_0x465a('0x1c')](_0x143ace);})[_0x465a('0xd')](function(){return _0x3183e8(null,_0x143ace);})[_0x465a('0x1d')](function(_0x43449f){return _0x3183e8(null,![],_0x43449f);});}}else{if(_0x143ace[_0x465a('0x13')]){return _0x3183e8(null,![],{'message':_0x465a('0x16')});}else{return utils[_0x465a('0x1c')](_0x143ace)[_0x465a('0xd')](function(){return _0x3183e8(null,_0x143ace);});}}}});})[_0x465a('0x1d')](function(_0x1a3585){return _0x3183e8(null,![],_0x1a3585);});}function sendServiceMail(_0x529864){return db[_0x465a('0x1e')][_0x465a('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x465a('0xe'),_0x465a('0x20')],'include':[{'model':db[_0x465a('0x21')],'as':_0x465a('0x22'),'include':[{'model':db[_0x465a('0x23')],'as':_0x465a('0x23')}]}]})[_0x465a('0xd')](function(_0x44878a){if(!_0x44878a){throw new Error(_0x465a('0x24'));}var _0x39dd8a=_0x44878a[_0x465a('0x25')]();var _0x24074f={'account':_0x39dd8a,'message':_[_0x465a('0x26')]({'from':util['format'](_0x465a('0x27'),_0x44878a[_0x465a('0xe')],_0x44878a[_0x465a('0x20')]||_0x44878a[_0x465a('0x22')][_0x465a('0x28')])},_0x529864)};return client[_0x465a('0x29')](_0x465a('0x2a'),_0x24074f);})[_0x465a('0xd')](function(_0x477f4f){if(_0x477f4f[_0x465a('0x2b')]){throw new Error(util[_0x465a('0x2c')](_0x465a('0x2d'),_0x477f4f[_0x465a('0x2b')][_0x465a('0x2e')]||JSON[_0x465a('0x2f')](_0x477f4f[_0x465a('0x2b')])));}return!![];});}function handleError(_0x2d74b7,_0x111d7e,_0x346183){return _0x2d74b7[_0x465a('0x30')](_0x111d7e||0x1f4)['send']({'message':_0x346183?_0x346183[_0x465a('0x2e')]||_0x346183:''});}exports[_0x465a('0x31')]=function(_0x4709e6,_0xb59aab,_0x51e93b){passport[_0x465a('0x17')](_0x465a('0x32'),function(_0x10c0b2,_0x4ac56d,_0x171728){var _0x31941f=_0x10c0b2||_0x171728;if(_0x31941f){return handleError(_0xb59aab,0x191,_0x31941f);}if(!_0x4ac56d){return handleError(_0xb59aab,0x194,{'message':_0x465a('0x33')});}else{var _0x169577={'payload':{'id':_0x4ac56d['id'],'role':_0x4ac56d[_0x465a('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x465a('0x34')](_0x169577)['then'](function(_0x13f150){_0xb59aab[_0x465a('0x35')]({'id':_0x4ac56d['id'],'token':_0x13f150,'statusCall':'','isAlreadyLogged':_0x4ac56d['online']});});}})(_0x4709e6,_0xb59aab,_0x51e93b);};exports[_0x465a('0x36')]=function(_0x6fe1aa,_0x1b6d2e){if(!_0x6fe1aa[_0x465a('0x37')][_0x465a('0x20')]){return handleError(_0x1b6d2e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x15f5c8=rs['generate']();_0x6fe1aa[_0x465a('0x37')]['email']=_0x6fe1aa[_0x465a('0x37')]['email'][_0x465a('0x38')]()['toLowerCase']();var _0x5841c8;return db[_0x465a('0x39')][_0x465a('0xb')]({'where':{'id':0x1},'attributes':[_0x465a('0x19'),_0x465a('0xc')],'raw':!![]})[_0x465a('0xd')](function(_0x1f8fae){_0x5841c8=_0x1f8fae;return db[_0x465a('0x3a')][_0x465a('0x1f')]({'where':{'email':_0x6fe1aa[_0x465a('0x37')]['email']}});})['then'](function(_0x7beda1){if(!_0x7beda1){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x7beda1['disabled']){throw new Error(_0x465a('0x3b'));}if(_0x7beda1[_0x465a('0x13')]){if(moment(_0x7beda1[_0x465a('0x14')])['add'](_0x5841c8[_0x465a('0xc')],_0x465a('0x3c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x7beda1[_0x465a('0x13')]=![];_0x7beda1[_0x465a('0x14')]=null;}}_0x7beda1[_0x465a('0x3d')]=_0x15f5c8;_0x7beda1[_0x465a('0x3e')]=Date[_0x465a('0x3f')]()+0x36ee80;return _0x7beda1[_0x465a('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x6fe1aa[_0x465a('0x37')]['email'],'subject':_0x465a('0x41'),'text':_0x465a('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x6fe1aa['headers']['host']+_0x465a('0x43')+_0x15f5c8+'\x0a\x0a'+_0x465a('0x44')});})[_0x465a('0xd')](function(){_0x1b6d2e['status'](0xc8)['send']({'message':_0x465a('0x45')});})[_0x465a('0x1d')](function(_0x4624d8){return handleError(_0x1b6d2e,0x1f4,_0x4624d8);});};exports[_0x465a('0x46')]=function(_0x244e78,_0x202d47){return db[_0x465a('0x3a')][_0x465a('0x1f')]({'where':{'resetPasswordToken':_0x244e78[_0x465a('0x47')][_0x465a('0x48')],'resetPasswordExpires':{'$gt':Date[_0x465a('0x3f')]()}}})['then'](function(_0x5eac7c){if(!_0x5eac7c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x465a('0xb')]({'attributes':['id','securePassword',_0x465a('0x49'),_0x465a('0x4a')]})['then'](function(_0x1c335c){if(_0x1c335c[_0x465a('0x4b')])authService[_0x465a('0x4c')](_0x244e78[_0x465a('0x37')][_0x465a('0xf')]);if(!_0x1c335c[_0x465a('0x49')]||!_0x5eac7c[_0x465a('0x4d')])return _0x5eac7c;authService[_0x465a('0x4e')](_0x244e78[_0x465a('0x37')][_0x465a('0xf')],_0x5eac7c[_0x465a('0x4d')],_0x1c335c[_0x465a('0x4a')]);return _0x5eac7c;})['then'](function(){_0x5eac7c[_0x465a('0xf')]=_0x244e78[_0x465a('0x37')][_0x465a('0xf')];_0x5eac7c[_0x465a('0x3d')]=null;_0x5eac7c['resetPasswordExpires']=null;return _0x5eac7c[_0x465a('0x40')]();});})[_0x465a('0xd')](function(){_0x202d47[_0x465a('0x30')](0xc8)[_0x465a('0x4f')]({'message':'Password\x20reset!'});})['catch'](function(_0x582800){return handleError(_0x202d47,0x1f4,_0x582800);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0x465a('0xe'),'passwordField':'password'},function(_0x4e86e4,_0x2033eb,_0x3bc9cb){return localAuthenticate(db[_0x465a('0x3a')],_0x4e86e4,_0x2033eb,_0x3bc9cb);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c4bd647..2ae684d 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 _0x3033=['forgot','/reset/:token','reset','express','Router','post','login','/forgot'];(function(_0x24963c,_0x32a74f){var _0x4d6294=function(_0x3d99d1){while(--_0x3d99d1){_0x24963c['push'](_0x24963c['shift']());}};_0x4d6294(++_0x32a74f);}(_0x3033,0x1b3));var _0x3303=function(_0x34129e,_0x484c10){_0x34129e=_0x34129e-0x0;var _0x1d9c65=_0x3033[_0x34129e];return _0x1d9c65;};'use strict';var express=require(_0x3303('0x0'));var router=express[_0x3303('0x1')]();var controller=require('./authLocal.controller');router[_0x3303('0x2')]('/',controller[_0x3303('0x3')]);router[_0x3303('0x2')](_0x3303('0x4'),controller[_0x3303('0x5')]);router[_0x3303('0x2')](_0x3303('0x6'),controller[_0x3303('0x7')]);module['exports']=router; \ No newline at end of file +var _0xf894=['./authLocal.controller','post','login','forgot','exports','express','Router'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf894,0x186));var _0x4f89=function(_0x559758,_0x314ab1){_0x559758=_0x559758-0x0;var _0x544a9a=_0xf894[_0x559758];return _0x544a9a;};'use strict';var express=require(_0x4f89('0x0'));var router=express[_0x4f89('0x1')]();var controller=require(_0x4f89('0x2'));router[_0x4f89('0x3')]('/',controller[_0x4f89('0x4')]);router['post']('/forgot',controller[_0x4f89('0x5')]);router['post']('/reset/:token',controller['reset']);module[_0x4f89('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e003bd2..dd5a49e 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 _0x410e=['STRING','INTEGER','sequelize','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x410e,0x10e));var _0xe410=function(_0x38f26e,_0xa15f5e){_0x38f26e=_0x38f26e-0x0;var _0x1e2fb3=_0x410e[_0x38f26e];return _0x1e2fb3;};'use strict';var Sequelize=require(_0xe410('0x0'));module[_0xe410('0x1')]={'name':{'type':Sequelize[_0xe410('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe410('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe410('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x18cb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x30be97,_0x3ea719){var _0x1d3a90=function(_0x512e8a){while(--_0x512e8a){_0x30be97['push'](_0x30be97['shift']());}};_0x1d3a90(++_0x3ea719);}(_0x18cb,0x1ed));var _0xb18c=function(_0x265639,_0x29bb4e){_0x265639=_0x265639-0x0;var _0x4df1c3=_0x18cb[_0x265639];return _0x4df1c3;};'use strict';var Sequelize=require(_0xb18c('0x0'));module[_0xb18c('0x1')]={'name':{'type':Sequelize[_0xb18c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb18c('0x2')]},'description':{'type':Sequelize[_0xb18c('0x2')]},'status':{'type':Sequelize[_0xb18c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 4bfa762..1481a3f 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 _0xf8ea=['omit','getConditions','findOne','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','intersection','find','create','body','Condition','ids'];(function(_0x15569e,_0x39fa26){var _0x404aa7=function(_0xb12b0a){while(--_0xb12b0a){_0x15569e['push'](_0x15569e['shift']());}};_0x404aa7(++_0x39fa26);}(_0xf8ea,0x13a));var _0xaf8e=function(_0x538c48,_0x538cfa){_0x538c48=_0x538c48-0x0;var _0x4c7364=_0xf8ea[_0x538c48];return _0x4c7364;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaf8e('0x0'));var jsonpatch=require(_0xaf8e('0x1'));var rp=require(_0xaf8e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf8e('0x3'));var util=require(_0xaf8e('0x4'));var path=require(_0xaf8e('0x5'));var sox=require(_0xaf8e('0x6'));var csv=require(_0xaf8e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf8e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf8e('0x9'));var jsforce=require(_0xaf8e('0xa'));var deskjs=require(_0xaf8e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaf8e('0xc'));var Papa=require('papaparse');var Redis=require(_0xaf8e('0xd'));var authService=require(_0xaf8e('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf8e('0xf'));var logger=require('../../config/logger')(_0xaf8e('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaf8e('0x11'));var db=require(_0xaf8e('0x12'))['db'];function respondWithStatusCode(_0xb6db6d,_0x4ee399){_0x4ee399=_0x4ee399||0xcc;return function(_0x1c2344){if(_0x1c2344){return _0xb6db6d[_0xaf8e('0x13')](_0x4ee399);}return _0xb6db6d['status'](_0x4ee399)[_0xaf8e('0x14')]();};}function respondWithResult(_0x11a4c3,_0x2e4224){_0x2e4224=_0x2e4224||0xc8;return function(_0x1a7c81){if(_0x1a7c81){return _0x11a4c3[_0xaf8e('0x15')](_0x2e4224)['json'](_0x1a7c81);}};}function respondWithFilteredResult(_0x4d4b5f,_0x32fa59){return function(_0x513460){if(_0x513460){var _0x56af27=typeof _0x32fa59[_0xaf8e('0x16')]===_0xaf8e('0x17')&&typeof _0x32fa59['limit']===_0xaf8e('0x17');var _0x447cb7=_0x513460['count'];var _0x4b7683=_0x56af27?0x0:_0x32fa59[_0xaf8e('0x16')];var _0x4221c9=_0x56af27?_0x513460[_0xaf8e('0x18')]:_0x32fa59[_0xaf8e('0x16')]+_0x32fa59[_0xaf8e('0x19')];var _0x15b61e;if(_0x4221c9>=_0x447cb7){_0x4221c9=_0x447cb7;_0x15b61e=0xc8;}else{_0x15b61e=0xce;}_0x4d4b5f[_0xaf8e('0x15')](_0x15b61e);return _0x4d4b5f[_0xaf8e('0x1a')](_0xaf8e('0x1b'),_0x4b7683+'-'+_0x4221c9+'/'+_0x447cb7)['json'](_0x513460);}return null;};}function patchUpdates(_0x466f0e){return function(_0x59f270){try{jsonpatch[_0xaf8e('0x1c')](_0x59f270,_0x466f0e,!![]);}catch(_0x1738e5){return BPromise[_0xaf8e('0x1d')](_0x1738e5);}return _0x59f270['save']();};}function saveUpdates(_0x3d1f13,_0x49fe07){return function(_0x2a1f67){if(_0x2a1f67){return _0x2a1f67[_0xaf8e('0x1e')](_0x3d1f13)['then'](function(_0xe8983a){return _0xe8983a;});}return null;};}function removeEntity(_0x31fd2e,_0x424fd9){return function(_0x4cf95f){if(_0x4cf95f){return _0x4cf95f[_0xaf8e('0x1f')]()[_0xaf8e('0x20')](function(){_0x31fd2e[_0xaf8e('0x15')](0xcc)[_0xaf8e('0x14')]();});}};}function handleEntityNotFound(_0x981746,_0x5aa8a2){return function(_0x2c1814){if(!_0x2c1814){_0x981746[_0xaf8e('0x13')](0x194);}return _0x2c1814;};}function handleError(_0x52abce,_0x449da1){_0x449da1=_0x449da1||0x1f4;return function(_0xbc7ff8){logger['error'](_0xbc7ff8[_0xaf8e('0x21')]);if(_0xbc7ff8[_0xaf8e('0x22')]){delete _0xbc7ff8['name'];}_0x52abce['status'](_0x449da1)[_0xaf8e('0x23')](_0xbc7ff8);};}exports[_0xaf8e('0x24')]=function(_0x5b62d6,_0x475117){var _0x308821={},_0x65c950={},_0x2566cf={'count':0x0,'rows':[]};var _0x2321a1=_[_0xaf8e('0x25')](db[_0xaf8e('0x26')][_0xaf8e('0x27')],function(_0x4ac101){return{'name':_0x4ac101[_0xaf8e('0x28')],'type':_0x4ac101[_0xaf8e('0x29')][_0xaf8e('0x2a')]};});_0x65c950[_0xaf8e('0x2b')]=_[_0xaf8e('0x25')](_0x2321a1,_0xaf8e('0x22'));_0x65c950[_0xaf8e('0x2c')]=_[_0xaf8e('0x2d')](_0x5b62d6[_0xaf8e('0x2c')]);_0x65c950[_0xaf8e('0x2e')]=_['intersection'](_0x65c950[_0xaf8e('0x2b')],_0x65c950[_0xaf8e('0x2c')]);_0x308821[_0xaf8e('0x2f')]=_['intersection'](_0x65c950[_0xaf8e('0x2b')],qs['fields'](_0x5b62d6[_0xaf8e('0x2c')][_0xaf8e('0x30')]));_0x308821[_0xaf8e('0x2f')]=_0x308821[_0xaf8e('0x2f')][_0xaf8e('0x31')]?_0x308821[_0xaf8e('0x2f')]:_0x65c950[_0xaf8e('0x2b')];if(!_0x5b62d6['query'][_0xaf8e('0x32')](_0xaf8e('0x33'))){_0x308821['limit']=qs[_0xaf8e('0x19')](_0x5b62d6[_0xaf8e('0x2c')][_0xaf8e('0x19')]);_0x308821[_0xaf8e('0x16')]=qs[_0xaf8e('0x16')](_0x5b62d6[_0xaf8e('0x2c')][_0xaf8e('0x16')]);}_0x308821[_0xaf8e('0x34')]=qs[_0xaf8e('0x35')](_0x5b62d6['query']['sort']);_0x308821['where']=qs['filters'](_[_0xaf8e('0x36')](_0x5b62d6[_0xaf8e('0x2c')],_0x65c950[_0xaf8e('0x2e')]),_0x2321a1);if(_0x5b62d6['query'][_0xaf8e('0x37')]){_0x308821['where']=_['merge'](_0x308821[_0xaf8e('0x38')],{'$or':_[_0xaf8e('0x25')](_0x2321a1,function(_0x121532){if(_0x121532[_0xaf8e('0x29')]!==_0xaf8e('0x39')){var _0x5dbb19={};_0x5dbb19[_0x121532[_0xaf8e('0x22')]]={'$like':'%'+_0x5b62d6[_0xaf8e('0x2c')][_0xaf8e('0x37')]+'%'};return _0x5dbb19;}})});}_0x308821=_[_0xaf8e('0x3a')]({},_0x308821,_0x5b62d6[_0xaf8e('0x3b')]);var _0x34ac43={'where':_0x308821[_0xaf8e('0x38')]};return db[_0xaf8e('0x26')][_0xaf8e('0x18')](_0x34ac43)[_0xaf8e('0x20')](function(_0xc4038b){_0x2566cf['count']=_0xc4038b;if(_0x5b62d6['query'][_0xaf8e('0x3c')]){_0x308821['include']=[{'all':!![]}];}return db[_0xaf8e('0x26')][_0xaf8e('0x3d')](_0x308821);})[_0xaf8e('0x20')](function(_0x160dbc){_0x2566cf[_0xaf8e('0x3e')]=_0x160dbc;return _0x2566cf;})['then'](respondWithFilteredResult(_0x475117,_0x308821))[_0xaf8e('0x3f')](handleError(_0x475117,null));};exports['show']=function(_0x3960fa,_0x2fd0b0){var _0x4176a5={'raw':![],'where':{'id':_0x3960fa[_0xaf8e('0x40')]['id']}},_0x89a8b2={};_0x89a8b2[_0xaf8e('0x2b')]=_[_0xaf8e('0x2d')](db['Automation'][_0xaf8e('0x27')]);_0x89a8b2['query']=_[_0xaf8e('0x2d')](_0x3960fa[_0xaf8e('0x2c')]);_0x89a8b2['filters']=_[_0xaf8e('0x41')](_0x89a8b2[_0xaf8e('0x2b')],_0x89a8b2[_0xaf8e('0x2c')]);_0x4176a5[_0xaf8e('0x2f')]=_[_0xaf8e('0x41')](_0x89a8b2[_0xaf8e('0x2b')],qs['fields'](_0x3960fa[_0xaf8e('0x2c')]['fields']));_0x4176a5[_0xaf8e('0x2f')]=_0x4176a5[_0xaf8e('0x2f')]['length']?_0x4176a5[_0xaf8e('0x2f')]:_0x89a8b2[_0xaf8e('0x2b')];if(_0x3960fa['query'][_0xaf8e('0x3c')]){_0x4176a5['include']=[{'all':!![]}];}_0x4176a5=_[_0xaf8e('0x3a')]({},_0x4176a5,_0x3960fa[_0xaf8e('0x3b')]);return db[_0xaf8e('0x26')][_0xaf8e('0x42')](_0x4176a5)[_0xaf8e('0x20')](handleEntityNotFound(_0x2fd0b0,null))[_0xaf8e('0x20')](respondWithResult(_0x2fd0b0,null))[_0xaf8e('0x3f')](handleError(_0x2fd0b0,null));};exports[_0xaf8e('0x43')]=function(_0x5a5018,_0x2d1aee){return db[_0xaf8e('0x26')]['create'](_0x5a5018[_0xaf8e('0x44')],{})[_0xaf8e('0x20')](respondWithResult(_0x2d1aee,0xc9))[_0xaf8e('0x3f')](handleError(_0x2d1aee,null));};exports['update']=function(_0x2bc764,_0x38a54c){if(_0x2bc764[_0xaf8e('0x44')]['id']){delete _0x2bc764['body']['id'];}return db[_0xaf8e('0x26')]['find']({'where':{'id':_0x2bc764[_0xaf8e('0x40')]['id']}})[_0xaf8e('0x20')](handleEntityNotFound(_0x38a54c,null))[_0xaf8e('0x20')](saveUpdates(_0x2bc764[_0xaf8e('0x44')],null))[_0xaf8e('0x20')](respondWithResult(_0x38a54c,null))[_0xaf8e('0x3f')](handleError(_0x38a54c,null));};exports[_0xaf8e('0x1f')]=function(_0x219306,_0x481e24){return db[_0xaf8e('0x26')][_0xaf8e('0x42')]({'where':{'id':_0x219306[_0xaf8e('0x40')]['id']}})['then'](handleEntityNotFound(_0x481e24,null))[_0xaf8e('0x20')](removeEntity(_0x481e24,null))[_0xaf8e('0x3f')](handleError(_0x481e24,null));};exports['addConditions']=function(_0x426de5,_0x5b8aa8,_0x2d6e8f){return db[_0xaf8e('0x45')][_0xaf8e('0x42')]({'where':{'id':_0x426de5[_0xaf8e('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b8aa8,null))[_0xaf8e('0x20')](function(_0x5e94a3){if(_0x5e94a3){return _0x5e94a3['addConditions'](_0x426de5[_0xaf8e('0x44')][_0xaf8e('0x46')],_[_0xaf8e('0x47')](_0x426de5[_0xaf8e('0x44')],['ids','id'])||{});}})[_0xaf8e('0x20')](respondWithResult(_0x5b8aa8,null))['catch'](handleError(_0x5b8aa8,null));};exports[_0xaf8e('0x48')]=function(_0x42ab50,_0x425dcc,_0x493111){var _0x254346={};var _0x2fc7eb={};var _0x563549;var _0x218d3e;return db[_0xaf8e('0x26')][_0xaf8e('0x49')]({'where':{'id':_0x42ab50['params']['id']}})[_0xaf8e('0x20')](handleEntityNotFound(_0x425dcc,null))[_0xaf8e('0x20')](function(_0x3dd0e8){if(_0x3dd0e8){_0x563549=_0x3dd0e8;_0x2fc7eb[_0xaf8e('0x2b')]=_[_0xaf8e('0x2d')](db[_0xaf8e('0x45')][_0xaf8e('0x27')]);_0x2fc7eb[_0xaf8e('0x2c')]=_[_0xaf8e('0x2d')](_0x42ab50[_0xaf8e('0x2c')]);_0x2fc7eb[_0xaf8e('0x2e')]=_[_0xaf8e('0x41')](_0x2fc7eb[_0xaf8e('0x2b')],_0x2fc7eb[_0xaf8e('0x2c')]);_0x254346[_0xaf8e('0x2f')]=_['intersection'](_0x2fc7eb[_0xaf8e('0x2b')],qs['fields'](_0x42ab50['query']['fields']));_0x254346[_0xaf8e('0x2f')]=_0x254346[_0xaf8e('0x2f')][_0xaf8e('0x31')]?_0x254346['attributes']:_0x2fc7eb[_0xaf8e('0x2b')];_0x254346[_0xaf8e('0x34')]=qs[_0xaf8e('0x35')](_0x42ab50['query'][_0xaf8e('0x35')]);_0x254346[_0xaf8e('0x38')]=qs['filters'](_[_0xaf8e('0x36')](_0x42ab50['query'],_0x2fc7eb[_0xaf8e('0x2e')]));if(_0x42ab50[_0xaf8e('0x2c')]['filter']){_0x254346[_0xaf8e('0x38')]=_[_0xaf8e('0x3a')](_0x254346[_0xaf8e('0x38')],{'$or':_[_0xaf8e('0x25')](_0x254346[_0xaf8e('0x2f')],function(_0x17e34f){var _0x1814dc={};_0x1814dc[_0x17e34f]={'$like':'%'+_0x42ab50['query'][_0xaf8e('0x37')]+'%'};return _0x1814dc;})});}_0x254346=_[_0xaf8e('0x3a')]({},_0x254346,_0x42ab50['options']);return _0x563549['getConditions'](_0x254346);}})[_0xaf8e('0x20')](function(_0x1f6966){if(_0x1f6966){_0x218d3e=_0x1f6966['length'];if(!_0x42ab50[_0xaf8e('0x2c')][_0xaf8e('0x32')](_0xaf8e('0x33'))){_0x254346['limit']=qs[_0xaf8e('0x19')](_0x42ab50[_0xaf8e('0x2c')][_0xaf8e('0x19')]);_0x254346[_0xaf8e('0x16')]=qs['offset'](_0x42ab50[_0xaf8e('0x2c')][_0xaf8e('0x16')]);}return _0x563549[_0xaf8e('0x48')](_0x254346);}})[_0xaf8e('0x20')](function(_0x1e9e9b){if(_0x1e9e9b){return _0x1e9e9b?{'count':_0x218d3e,'rows':_0x1e9e9b}:null;}})[_0xaf8e('0x20')](respondWithResult(_0x425dcc,null))[_0xaf8e('0x3f')](handleError(_0x425dcc,null));};exports[_0xaf8e('0x4a')]=function(_0x5f3d93,_0x3f14e2,_0x29080d){return db[_0xaf8e('0x4b')][_0xaf8e('0x42')]({'where':{'id':_0x5f3d93[_0xaf8e('0x40')]['id']}})[_0xaf8e('0x20')](handleEntityNotFound(_0x3f14e2,null))[_0xaf8e('0x20')](function(_0x1d58a1){if(_0x1d58a1){return _0x1d58a1[_0xaf8e('0x4a')](_0x5f3d93[_0xaf8e('0x44')]['ids'],_[_0xaf8e('0x47')](_0x5f3d93['body'],[_0xaf8e('0x46'),'id'])||{});}})[_0xaf8e('0x20')](respondWithResult(_0x3f14e2,null))[_0xaf8e('0x3f')](handleError(_0x3f14e2,null));};exports['getActions']=function(_0x3ce7f4,_0x2d1a9f,_0x43c20f){var _0x4e4350={};var _0x3f4275={};var _0x98e9aa;var _0x323065;return db['Automation'][_0xaf8e('0x49')]({'where':{'id':_0x3ce7f4[_0xaf8e('0x40')]['id']}})[_0xaf8e('0x20')](handleEntityNotFound(_0x2d1a9f,null))[_0xaf8e('0x20')](function(_0x2dc1bd){if(_0x2dc1bd){_0x98e9aa=_0x2dc1bd;_0x3f4275[_0xaf8e('0x2b')]=_[_0xaf8e('0x2d')](db[_0xaf8e('0x4b')]['rawAttributes']);_0x3f4275[_0xaf8e('0x2c')]=_['keys'](_0x3ce7f4[_0xaf8e('0x2c')]);_0x3f4275['filters']=_[_0xaf8e('0x41')](_0x3f4275[_0xaf8e('0x2b')],_0x3f4275[_0xaf8e('0x2c')]);_0x4e4350[_0xaf8e('0x2f')]=_[_0xaf8e('0x41')](_0x3f4275['model'],qs[_0xaf8e('0x30')](_0x3ce7f4[_0xaf8e('0x2c')][_0xaf8e('0x30')]));_0x4e4350[_0xaf8e('0x2f')]=_0x4e4350[_0xaf8e('0x2f')][_0xaf8e('0x31')]?_0x4e4350[_0xaf8e('0x2f')]:_0x3f4275[_0xaf8e('0x2b')];_0x4e4350['order']=qs['sort'](_0x3ce7f4[_0xaf8e('0x2c')][_0xaf8e('0x35')]);_0x4e4350['where']=qs[_0xaf8e('0x2e')](_[_0xaf8e('0x36')](_0x3ce7f4[_0xaf8e('0x2c')],_0x3f4275[_0xaf8e('0x2e')]));if(_0x3ce7f4[_0xaf8e('0x2c')][_0xaf8e('0x37')]){_0x4e4350[_0xaf8e('0x38')]=_[_0xaf8e('0x3a')](_0x4e4350['where'],{'$or':_['map'](_0x4e4350[_0xaf8e('0x2f')],function(_0x5da0a8){var _0x5e6d80={};_0x5e6d80[_0x5da0a8]={'$like':'%'+_0x3ce7f4[_0xaf8e('0x2c')][_0xaf8e('0x37')]+'%'};return _0x5e6d80;})});}_0x4e4350=_[_0xaf8e('0x3a')]({},_0x4e4350,_0x3ce7f4['options']);return _0x98e9aa[_0xaf8e('0x4c')](_0x4e4350);}})['then'](function(_0x104358){if(_0x104358){_0x323065=_0x104358[_0xaf8e('0x31')];if(!_0x3ce7f4['query']['hasOwnProperty'](_0xaf8e('0x33'))){_0x4e4350[_0xaf8e('0x19')]=qs[_0xaf8e('0x19')](_0x3ce7f4[_0xaf8e('0x2c')][_0xaf8e('0x19')]);_0x4e4350[_0xaf8e('0x16')]=qs[_0xaf8e('0x16')](_0x3ce7f4[_0xaf8e('0x2c')][_0xaf8e('0x16')]);}return _0x98e9aa['getActions'](_0x4e4350);}})[_0xaf8e('0x20')](function(_0xa138ce){if(_0xa138ce){return _0xa138ce?{'count':_0x323065,'rows':_0xa138ce}:null;}})[_0xaf8e('0x20')](respondWithResult(_0x2d1a9f,null))[_0xaf8e('0x3f')](handleError(_0x2d1a9f,null));}; \ No newline at end of file +var _0x1d0a=['apply','save','update','then','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','destroy','find','addConditions','Condition','ids','omit','getConditions','order','hasOwnProperty','addActions','Action','findOne','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','limit','undefined','count','offset'];(function(_0x23f4b5,_0x51c195){var _0x1ee161=function(_0x2dadb5){while(--_0x2dadb5){_0x23f4b5['push'](_0x23f4b5['shift']());}};_0x1ee161(++_0x51c195);}(_0x1d0a,0x17b));var _0xa1d0=function(_0x4227f0,_0x23724b){_0x4227f0=_0x4227f0-0x0;var _0x2e04d9=_0x1d0a[_0x4227f0];return _0x2e04d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1d0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa1d0('0x1'));var BPromise=require(_0xa1d0('0x2'));var Mustache=require(_0xa1d0('0x3'));var util=require(_0xa1d0('0x4'));var path=require(_0xa1d0('0x5'));var sox=require(_0xa1d0('0x6'));var csv=require('to-csv');var ejs=require(_0xa1d0('0x7'));var fs=require('fs');var fs_extra=require(_0xa1d0('0x8'));var _=require(_0xa1d0('0x9'));var squel=require(_0xa1d0('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1d0('0xb'));var toCsv=require(_0xa1d0('0xc'));var querystring=require(_0xa1d0('0xd'));var Papa=require(_0xa1d0('0xe'));var Redis=require(_0xa1d0('0xf'));var authService=require(_0xa1d0('0x10'));var qs=require(_0xa1d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1d0('0x12'));var logger=require(_0xa1d0('0x13'))(_0xa1d0('0x14'));var utils=require(_0xa1d0('0x15'));var config=require(_0xa1d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1d0('0x17'))['db'];function respondWithStatusCode(_0x1f2a67,_0x571731){_0x571731=_0x571731||0xcc;return function(_0x3f42e6){if(_0x3f42e6){return _0x1f2a67['sendStatus'](_0x571731);}return _0x1f2a67['status'](_0x571731)[_0xa1d0('0x18')]();};}function respondWithResult(_0x31bf5e,_0x2796c9){_0x2796c9=_0x2796c9||0xc8;return function(_0x3b629c){if(_0x3b629c){return _0x31bf5e[_0xa1d0('0x19')](_0x2796c9)[_0xa1d0('0x1a')](_0x3b629c);}};}function respondWithFilteredResult(_0x31cb0a,_0xcb45fe){return function(_0x57a9e1){if(_0x57a9e1){var _0x1ef267=typeof _0xcb45fe['offset']==='undefined'&&typeof _0xcb45fe[_0xa1d0('0x1b')]===_0xa1d0('0x1c');var _0x537c78=_0x57a9e1[_0xa1d0('0x1d')];var _0x25cf77=_0x1ef267?0x0:_0xcb45fe[_0xa1d0('0x1e')];var _0x260bc8=_0x1ef267?_0x57a9e1[_0xa1d0('0x1d')]:_0xcb45fe[_0xa1d0('0x1e')]+_0xcb45fe[_0xa1d0('0x1b')];var _0xdc707e;if(_0x260bc8>=_0x537c78){_0x260bc8=_0x537c78;_0xdc707e=0xc8;}else{_0xdc707e=0xce;}_0x31cb0a[_0xa1d0('0x19')](_0xdc707e);return _0x31cb0a['set']('Content-Range',_0x25cf77+'-'+_0x260bc8+'/'+_0x537c78)['json'](_0x57a9e1);}return null;};}function patchUpdates(_0x303383){return function(_0x16bc6d){try{jsonpatch[_0xa1d0('0x1f')](_0x16bc6d,_0x303383,!![]);}catch(_0x33c226){return BPromise['reject'](_0x33c226);}return _0x16bc6d[_0xa1d0('0x20')]();};}function saveUpdates(_0x280957,_0x10cc06){return function(_0x2dfa7f){if(_0x2dfa7f){return _0x2dfa7f[_0xa1d0('0x21')](_0x280957)['then'](function(_0x525a60){return _0x525a60;});}return null;};}function removeEntity(_0x1ccae6,_0x50bef0){return function(_0x4c147c){if(_0x4c147c){return _0x4c147c['destroy']()[_0xa1d0('0x22')](function(){_0x1ccae6['status'](0xcc)[_0xa1d0('0x18')]();});}};}function handleEntityNotFound(_0x1909c3,_0x4ccd5f){return function(_0x466eef){if(!_0x466eef){_0x1909c3[_0xa1d0('0x23')](0x194);}return _0x466eef;};}function handleError(_0x292b99,_0x27671e){_0x27671e=_0x27671e||0x1f4;return function(_0x322900){logger[_0xa1d0('0x24')](_0x322900[_0xa1d0('0x25')]);if(_0x322900[_0xa1d0('0x26')]){delete _0x322900[_0xa1d0('0x26')];}_0x292b99[_0xa1d0('0x19')](_0x27671e)[_0xa1d0('0x27')](_0x322900);};}exports[_0xa1d0('0x28')]=function(_0x44e1a6,_0x4f8dc1){var _0x1ab93f={},_0x18f453={},_0x311627={'count':0x0,'rows':[]};var _0x117c4f=_[_0xa1d0('0x29')](db[_0xa1d0('0x2a')][_0xa1d0('0x2b')],function(_0x27e86d){return{'name':_0x27e86d[_0xa1d0('0x2c')],'type':_0x27e86d[_0xa1d0('0x2d')][_0xa1d0('0x2e')]};});_0x18f453[_0xa1d0('0x2f')]=_[_0xa1d0('0x29')](_0x117c4f,'name');_0x18f453[_0xa1d0('0x30')]=_[_0xa1d0('0x31')](_0x44e1a6[_0xa1d0('0x30')]);_0x18f453[_0xa1d0('0x32')]=_[_0xa1d0('0x33')](_0x18f453['model'],_0x18f453[_0xa1d0('0x30')]);_0x1ab93f[_0xa1d0('0x34')]=_['intersection'](_0x18f453['model'],qs[_0xa1d0('0x35')](_0x44e1a6['query']['fields']));_0x1ab93f['attributes']=_0x1ab93f['attributes']['length']?_0x1ab93f[_0xa1d0('0x34')]:_0x18f453[_0xa1d0('0x2f')];if(!_0x44e1a6['query']['hasOwnProperty'](_0xa1d0('0x36'))){_0x1ab93f['limit']=qs[_0xa1d0('0x1b')](_0x44e1a6[_0xa1d0('0x30')][_0xa1d0('0x1b')]);_0x1ab93f[_0xa1d0('0x1e')]=qs[_0xa1d0('0x1e')](_0x44e1a6[_0xa1d0('0x30')][_0xa1d0('0x1e')]);}_0x1ab93f['order']=qs[_0xa1d0('0x37')](_0x44e1a6[_0xa1d0('0x30')][_0xa1d0('0x37')]);_0x1ab93f['where']=qs[_0xa1d0('0x32')](_[_0xa1d0('0x38')](_0x44e1a6[_0xa1d0('0x30')],_0x18f453[_0xa1d0('0x32')]),_0x117c4f);if(_0x44e1a6[_0xa1d0('0x30')][_0xa1d0('0x39')]){_0x1ab93f[_0xa1d0('0x3a')]=_[_0xa1d0('0x3b')](_0x1ab93f['where'],{'$or':_['map'](_0x117c4f,function(_0x5bf0a2){if(_0x5bf0a2['type']!=='VIRTUAL'){var _0x1f3364={};_0x1f3364[_0x5bf0a2[_0xa1d0('0x26')]]={'$like':'%'+_0x44e1a6['query'][_0xa1d0('0x39')]+'%'};return _0x1f3364;}})});}_0x1ab93f=_['merge']({},_0x1ab93f,_0x44e1a6[_0xa1d0('0x3c')]);var _0x4e659f={'where':_0x1ab93f['where']};return db['Automation'][_0xa1d0('0x1d')](_0x4e659f)[_0xa1d0('0x22')](function(_0x239957){_0x311627['count']=_0x239957;if(_0x44e1a6[_0xa1d0('0x30')][_0xa1d0('0x3d')]){_0x1ab93f[_0xa1d0('0x3e')]=[{'all':!![]}];}return db[_0xa1d0('0x2a')][_0xa1d0('0x3f')](_0x1ab93f);})[_0xa1d0('0x22')](function(_0x358af1){_0x311627[_0xa1d0('0x40')]=_0x358af1;return _0x311627;})['then'](respondWithFilteredResult(_0x4f8dc1,_0x1ab93f))[_0xa1d0('0x41')](handleError(_0x4f8dc1,null));};exports['show']=function(_0x1421ce,_0x45ca5d){var _0x595938={'raw':![],'where':{'id':_0x1421ce[_0xa1d0('0x42')]['id']}},_0x22892a={};_0x22892a['model']=_['keys'](db['Automation'][_0xa1d0('0x2b')]);_0x22892a[_0xa1d0('0x30')]=_[_0xa1d0('0x31')](_0x1421ce['query']);_0x22892a[_0xa1d0('0x32')]=_['intersection'](_0x22892a[_0xa1d0('0x2f')],_0x22892a[_0xa1d0('0x30')]);_0x595938[_0xa1d0('0x34')]=_[_0xa1d0('0x33')](_0x22892a['model'],qs[_0xa1d0('0x35')](_0x1421ce[_0xa1d0('0x30')][_0xa1d0('0x35')]));_0x595938[_0xa1d0('0x34')]=_0x595938[_0xa1d0('0x34')][_0xa1d0('0x43')]?_0x595938[_0xa1d0('0x34')]:_0x22892a[_0xa1d0('0x2f')];if(_0x1421ce[_0xa1d0('0x30')]['includeAll']){_0x595938[_0xa1d0('0x3e')]=[{'all':!![]}];}_0x595938=_[_0xa1d0('0x3b')]({},_0x595938,_0x1421ce[_0xa1d0('0x3c')]);return db[_0xa1d0('0x2a')]['find'](_0x595938)[_0xa1d0('0x22')](handleEntityNotFound(_0x45ca5d,null))['then'](respondWithResult(_0x45ca5d,null))[_0xa1d0('0x41')](handleError(_0x45ca5d,null));};exports['create']=function(_0x2d2365,_0x2751f3){return db[_0xa1d0('0x2a')][_0xa1d0('0x44')](_0x2d2365[_0xa1d0('0x45')],{})[_0xa1d0('0x22')](respondWithResult(_0x2751f3,0xc9))[_0xa1d0('0x41')](handleError(_0x2751f3,null));};exports[_0xa1d0('0x21')]=function(_0x335877,_0x49ff55){if(_0x335877[_0xa1d0('0x45')]['id']){delete _0x335877['body']['id'];}return db[_0xa1d0('0x2a')]['find']({'where':{'id':_0x335877[_0xa1d0('0x42')]['id']}})[_0xa1d0('0x22')](handleEntityNotFound(_0x49ff55,null))[_0xa1d0('0x22')](saveUpdates(_0x335877[_0xa1d0('0x45')],null))[_0xa1d0('0x22')](respondWithResult(_0x49ff55,null))['catch'](handleError(_0x49ff55,null));};exports[_0xa1d0('0x46')]=function(_0x8fe2fa,_0x36f6a7){return db['Automation'][_0xa1d0('0x47')]({'where':{'id':_0x8fe2fa[_0xa1d0('0x42')]['id']}})['then'](handleEntityNotFound(_0x36f6a7,null))[_0xa1d0('0x22')](removeEntity(_0x36f6a7,null))[_0xa1d0('0x41')](handleError(_0x36f6a7,null));};exports[_0xa1d0('0x48')]=function(_0x4d139d,_0x3648d5,_0x25c45c){return db[_0xa1d0('0x49')][_0xa1d0('0x47')]({'where':{'id':_0x4d139d[_0xa1d0('0x42')]['id']}})[_0xa1d0('0x22')](handleEntityNotFound(_0x3648d5,null))['then'](function(_0x7f43a1){if(_0x7f43a1){return _0x7f43a1['addConditions'](_0x4d139d[_0xa1d0('0x45')][_0xa1d0('0x4a')],_[_0xa1d0('0x4b')](_0x4d139d[_0xa1d0('0x45')],[_0xa1d0('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x3648d5,null))['catch'](handleError(_0x3648d5,null));};exports[_0xa1d0('0x4c')]=function(_0x3419e4,_0x1660ad,_0x3c305e){var _0x243e08={};var _0x29c210={};var _0x2b4039;var _0x4c1c16;return db[_0xa1d0('0x2a')]['findOne']({'where':{'id':_0x3419e4[_0xa1d0('0x42')]['id']}})[_0xa1d0('0x22')](handleEntityNotFound(_0x1660ad,null))['then'](function(_0x2c1284){if(_0x2c1284){_0x2b4039=_0x2c1284;_0x29c210[_0xa1d0('0x2f')]=_['keys'](db[_0xa1d0('0x49')][_0xa1d0('0x2b')]);_0x29c210[_0xa1d0('0x30')]=_[_0xa1d0('0x31')](_0x3419e4[_0xa1d0('0x30')]);_0x29c210[_0xa1d0('0x32')]=_['intersection'](_0x29c210['model'],_0x29c210[_0xa1d0('0x30')]);_0x243e08[_0xa1d0('0x34')]=_[_0xa1d0('0x33')](_0x29c210[_0xa1d0('0x2f')],qs[_0xa1d0('0x35')](_0x3419e4[_0xa1d0('0x30')][_0xa1d0('0x35')]));_0x243e08[_0xa1d0('0x34')]=_0x243e08[_0xa1d0('0x34')]['length']?_0x243e08['attributes']:_0x29c210[_0xa1d0('0x2f')];_0x243e08[_0xa1d0('0x4d')]=qs[_0xa1d0('0x37')](_0x3419e4[_0xa1d0('0x30')][_0xa1d0('0x37')]);_0x243e08['where']=qs[_0xa1d0('0x32')](_[_0xa1d0('0x38')](_0x3419e4['query'],_0x29c210[_0xa1d0('0x32')]));if(_0x3419e4['query']['filter']){_0x243e08[_0xa1d0('0x3a')]=_[_0xa1d0('0x3b')](_0x243e08[_0xa1d0('0x3a')],{'$or':_[_0xa1d0('0x29')](_0x243e08[_0xa1d0('0x34')],function(_0x28f849){var _0x2bce92={};_0x2bce92[_0x28f849]={'$like':'%'+_0x3419e4[_0xa1d0('0x30')][_0xa1d0('0x39')]+'%'};return _0x2bce92;})});}_0x243e08=_[_0xa1d0('0x3b')]({},_0x243e08,_0x3419e4[_0xa1d0('0x3c')]);return _0x2b4039['getConditions'](_0x243e08);}})[_0xa1d0('0x22')](function(_0x1d5404){if(_0x1d5404){_0x4c1c16=_0x1d5404[_0xa1d0('0x43')];if(!_0x3419e4[_0xa1d0('0x30')][_0xa1d0('0x4e')](_0xa1d0('0x36'))){_0x243e08['limit']=qs[_0xa1d0('0x1b')](_0x3419e4['query'][_0xa1d0('0x1b')]);_0x243e08[_0xa1d0('0x1e')]=qs[_0xa1d0('0x1e')](_0x3419e4[_0xa1d0('0x30')]['offset']);}return _0x2b4039[_0xa1d0('0x4c')](_0x243e08);}})[_0xa1d0('0x22')](function(_0x4bc803){if(_0x4bc803){return _0x4bc803?{'count':_0x4c1c16,'rows':_0x4bc803}:null;}})[_0xa1d0('0x22')](respondWithResult(_0x1660ad,null))[_0xa1d0('0x41')](handleError(_0x1660ad,null));};exports[_0xa1d0('0x4f')]=function(_0x4b9246,_0x5df7fb,_0x2118d3){return db[_0xa1d0('0x50')]['find']({'where':{'id':_0x4b9246[_0xa1d0('0x42')]['id']}})[_0xa1d0('0x22')](handleEntityNotFound(_0x5df7fb,null))[_0xa1d0('0x22')](function(_0x181338){if(_0x181338){return _0x181338['addActions'](_0x4b9246[_0xa1d0('0x45')][_0xa1d0('0x4a')],_[_0xa1d0('0x4b')](_0x4b9246[_0xa1d0('0x45')],[_0xa1d0('0x4a'),'id'])||{});}})[_0xa1d0('0x22')](respondWithResult(_0x5df7fb,null))['catch'](handleError(_0x5df7fb,null));};exports['getActions']=function(_0x11ab37,_0x37c38e,_0x41f8c0){var _0x671fa3={};var _0x3fd111={};var _0x48420f;var _0x117342;return db['Automation'][_0xa1d0('0x51')]({'where':{'id':_0x11ab37['params']['id']}})['then'](handleEntityNotFound(_0x37c38e,null))[_0xa1d0('0x22')](function(_0x51aca2){if(_0x51aca2){_0x48420f=_0x51aca2;_0x3fd111['model']=_[_0xa1d0('0x31')](db[_0xa1d0('0x50')][_0xa1d0('0x2b')]);_0x3fd111['query']=_['keys'](_0x11ab37[_0xa1d0('0x30')]);_0x3fd111[_0xa1d0('0x32')]=_['intersection'](_0x3fd111['model'],_0x3fd111['query']);_0x671fa3[_0xa1d0('0x34')]=_[_0xa1d0('0x33')](_0x3fd111[_0xa1d0('0x2f')],qs[_0xa1d0('0x35')](_0x11ab37[_0xa1d0('0x30')][_0xa1d0('0x35')]));_0x671fa3[_0xa1d0('0x34')]=_0x671fa3['attributes']['length']?_0x671fa3['attributes']:_0x3fd111[_0xa1d0('0x2f')];_0x671fa3[_0xa1d0('0x4d')]=qs[_0xa1d0('0x37')](_0x11ab37['query']['sort']);_0x671fa3[_0xa1d0('0x3a')]=qs[_0xa1d0('0x32')](_[_0xa1d0('0x38')](_0x11ab37[_0xa1d0('0x30')],_0x3fd111['filters']));if(_0x11ab37[_0xa1d0('0x30')][_0xa1d0('0x39')]){_0x671fa3[_0xa1d0('0x3a')]=_[_0xa1d0('0x3b')](_0x671fa3['where'],{'$or':_[_0xa1d0('0x29')](_0x671fa3['attributes'],function(_0x218f47){var _0x5c06be={};_0x5c06be[_0x218f47]={'$like':'%'+_0x11ab37[_0xa1d0('0x30')][_0xa1d0('0x39')]+'%'};return _0x5c06be;})});}_0x671fa3=_['merge']({},_0x671fa3,_0x11ab37['options']);return _0x48420f['getActions'](_0x671fa3);}})[_0xa1d0('0x22')](function(_0x47a6e1){if(_0x47a6e1){_0x117342=_0x47a6e1[_0xa1d0('0x43')];if(!_0x11ab37[_0xa1d0('0x30')][_0xa1d0('0x4e')]('nolimit')){_0x671fa3[_0xa1d0('0x1b')]=qs[_0xa1d0('0x1b')](_0x11ab37[_0xa1d0('0x30')][_0xa1d0('0x1b')]);_0x671fa3[_0xa1d0('0x1e')]=qs[_0xa1d0('0x1e')](_0x11ab37[_0xa1d0('0x30')][_0xa1d0('0x1e')]);}return _0x48420f['getActions'](_0x671fa3);}})[_0xa1d0('0x22')](function(_0x24a32d){if(_0x24a32d){return _0x24a32d?{'count':_0x117342,'rows':_0x24a32d}:null;}})[_0xa1d0('0x22')](respondWithResult(_0x37c38e,null))[_0xa1d0('0x41')](handleError(_0x37c38e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ae66ef2..97a80dd 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 _0x3e9f=['exports','define','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x3e9f,0x10e));var _0xf3e9=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x3e9f[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xf3e9('0x0'));var util=require(_0xf3e9('0x1'));var logger=require('../../config/logger')(_0xf3e9('0x2'));var moment=require(_0xf3e9('0x3'));var BPromise=require(_0xf3e9('0x4'));var rp=require(_0xf3e9('0x5'));var fs=require('fs');var path=require(_0xf3e9('0x6'));var rimraf=require(_0xf3e9('0x7'));var config=require(_0xf3e9('0x8'));var attributes=require(_0xf3e9('0x9'));module[_0xf3e9('0xa')]=function(_0xb33505,_0x5e6c2b){return _0xb33505[_0xf3e9('0xb')](_0xf3e9('0xc'),attributes,{'tableName':_0xf3e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf886=['../../config/logger','api','moment','bluebird','path','rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util'];(function(_0x371ea6,_0x3158d9){var _0x33431e=function(_0x1649bb){while(--_0x1649bb){_0x371ea6['push'](_0x371ea6['shift']());}};_0x33431e(++_0x3158d9);}(_0xf886,0x142));var _0x6f88=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xf886[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require(_0x6f88('0x0'));var util=require(_0x6f88('0x1'));var logger=require(_0x6f88('0x2'))(_0x6f88('0x3'));var moment=require(_0x6f88('0x4'));var BPromise=require(_0x6f88('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f88('0x6'));var rimraf=require(_0x6f88('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f88('0x8'));module[_0x6f88('0x9')]=function(_0x4b4ac6,_0x2dfd0a){return _0x4b4ac6['define'](_0x6f88('0xa'),attributes,{'tableName':_0x6f88('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 56a4760..849fbbb 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 _0x38b2=['util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x38b2,0xf6));var _0x238b=function(_0xdf6b11,_0x1ece9f){_0xdf6b11=_0xdf6b11-0x0;var _0x599f62=_0x38b2[_0xdf6b11];return _0x599f62;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var moment=require(_0x238b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238b('0x3'));var db=require(_0x238b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x238b('0x5'))('rpc');var config=require(_0x238b('0x6'));var jayson=require(_0x238b('0x7'));var client=jayson[_0x238b('0x8')][_0x238b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5509fe,_0x202714,_0x12ac57){return new BPromise(function(_0x4b79d3,_0x16e19d){return client[_0x238b('0xa')](_0x5509fe,_0x12ac57)[_0x238b('0xb')](function(_0x3124e1){logger[_0x238b('0xc')](_0x238b('0xd'),_0x202714,_0x238b('0xe'));logger['debug'](_0x238b('0xf'),_0x202714,_0x238b('0xe'),JSON[_0x238b('0x10')](_0x3124e1));if(_0x3124e1[_0x238b('0x11')]){if(_0x3124e1[_0x238b('0x11')]['code']===0x1f4){logger[_0x238b('0x11')](_0x238b('0xd'),_0x202714,_0x3124e1[_0x238b('0x11')][_0x238b('0x12')]);return _0x16e19d(_0x3124e1['error']['message']);}logger['error'](_0x238b('0xd'),_0x202714,_0x3124e1[_0x238b('0x11')][_0x238b('0x12')]);return _0x4b79d3(_0x3124e1[_0x238b('0x11')][_0x238b('0x12')]);}else{logger[_0x238b('0xc')](_0x238b('0xd'),_0x202714,_0x238b('0xe'));_0x4b79d3(_0x3124e1['result'][_0x238b('0x12')]);}})['catch'](function(_0x2bb3e7){logger['error'](_0x238b('0xd'),_0x202714,_0x2bb3e7);_0x16e19d(_0x2bb3e7);});});} \ No newline at end of file +var _0x349f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x419cee,_0x3f2988){var _0x4b6be2=function(_0x2967d3){while(--_0x2967d3){_0x419cee['push'](_0x419cee['shift']());}};_0x4b6be2(++_0x3f2988);}(_0x349f,0xa8));var _0xf349=function(_0x3e4cb3,_0x99f949){_0x3e4cb3=_0x3e4cb3-0x0;var _0x2a11b3=_0x349f[_0x3e4cb3];return _0x2a11b3;};'use strict';var _=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var moment=require(_0xf349('0x2'));var BPromise=require('bluebird');var rs=require(_0xf349('0x3'));var fs=require('fs');var Redis=require(_0xf349('0x4'));var db=require(_0xf349('0x5'))['db'];var utils=require(_0xf349('0x6'));var logger=require(_0xf349('0x7'))(_0xf349('0x8'));var config=require(_0xf349('0x9'));var jayson=require(_0xf349('0xa'));var client=jayson[_0xf349('0xb')][_0xf349('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c6f4c,_0x1bd44a,_0x23fb4b){return new BPromise(function(_0x6c6cd2,_0x21a480){return client[_0xf349('0xd')](_0x4c6f4c,_0x23fb4b)[_0xf349('0xe')](function(_0x3e2147){logger['info']('Automation,\x20%s,\x20%s',_0x1bd44a,_0xf349('0xf'));logger[_0xf349('0x10')](_0xf349('0x11'),_0x1bd44a,_0xf349('0xf'),JSON[_0xf349('0x12')](_0x3e2147));if(_0x3e2147['error']){if(_0x3e2147['error']['code']===0x1f4){logger[_0xf349('0x13')](_0xf349('0x14'),_0x1bd44a,_0x3e2147[_0xf349('0x13')][_0xf349('0x15')]);return _0x21a480(_0x3e2147[_0xf349('0x13')]['message']);}logger[_0xf349('0x13')](_0xf349('0x14'),_0x1bd44a,_0x3e2147['error'][_0xf349('0x15')]);return _0x6c6cd2(_0x3e2147[_0xf349('0x13')]['message']);}else{logger[_0xf349('0x16')]('Automation,\x20%s,\x20%s',_0x1bd44a,_0xf349('0xf'));_0x6c6cd2(_0x3e2147[_0xf349('0x17')][_0xf349('0x15')]);}})[_0xf349('0x18')](function(_0x14c06d){logger[_0xf349('0x13')](_0xf349('0x14'),_0x1bd44a,_0x14c06d);_0x21a480(_0x14c06d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e623de8..87a6784 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 _0x2557=['isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x2557,0x11e));var _0x7255=function(_0x54cf7e,_0x2f5310){_0x54cf7e=_0x54cf7e-0x0;var _0x47bb30=_0x2557[_0x54cf7e];return _0x47bb30;};'use strict';var multer=require(_0x7255('0x0'));var util=require('util');var path=require(_0x7255('0x1'));var timeout=require(_0x7255('0x2'));var express=require(_0x7255('0x3'));var router=express[_0x7255('0x4')]();var fs_extra=require(_0x7255('0x5'));var auth=require(_0x7255('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x7255('0x7')]('/',auth[_0x7255('0x8')](),controller[_0x7255('0x9')]);router[_0x7255('0x7')](_0x7255('0xa'),auth[_0x7255('0x8')](),controller['show']);router[_0x7255('0x7')](_0x7255('0xb'),auth[_0x7255('0x8')](),controller['getConditions']);router[_0x7255('0x7')](_0x7255('0xc'),auth[_0x7255('0x8')](),controller[_0x7255('0xd')]);router[_0x7255('0xe')]('/',auth[_0x7255('0x8')](),controller[_0x7255('0xf')]);router['post'](_0x7255('0xb'),auth['isAuthenticated'](),controller['addConditions']);router['post'](_0x7255('0xc'),auth[_0x7255('0x8')](),controller[_0x7255('0x10')]);router[_0x7255('0x11')](_0x7255('0xa'),auth[_0x7255('0x8')](),controller[_0x7255('0x12')]);router['delete'](_0x7255('0xa'),auth[_0x7255('0x8')](),controller[_0x7255('0x13')]);module[_0x7255('0x14')]=router; \ No newline at end of file +var _0xd765=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','post','create','put'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xd765,0xdf));var _0x5d76=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd765[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x5d76('0x0'));var util=require(_0x5d76('0x1'));var path=require(_0x5d76('0x2'));var timeout=require(_0x5d76('0x3'));var express=require(_0x5d76('0x4'));var router=express[_0x5d76('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5d76('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5d76('0x7'));var controller=require(_0x5d76('0x8'));router['get']('/',auth[_0x5d76('0x9')](),controller[_0x5d76('0xa')]);router[_0x5d76('0xb')](_0x5d76('0xc'),auth[_0x5d76('0x9')](),controller[_0x5d76('0xd')]);router['get']('/:id/conditions',auth[_0x5d76('0x9')](),controller[_0x5d76('0xe')]);router[_0x5d76('0xb')](_0x5d76('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x5d76('0x10')]('/',auth[_0x5d76('0x9')](),controller[_0x5d76('0x11')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x5d76('0x10')](_0x5d76('0xf'),auth[_0x5d76('0x9')](),controller['addActions']);router[_0x5d76('0x12')](_0x5d76('0xc'),auth['isAuthenticated'](),controller[_0x5d76('0x13')]);router[_0x5d76('0x14')](_0x5d76('0xc'),auth[_0x5d76('0x9')](),controller[_0x5d76('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 28e7202..93fb0eb 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 _0x4ffa=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#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)','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)','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER'];(function(_0x1f4674,_0x146085){var _0x3e7f42=function(_0x4bd366){while(--_0x4bd366){_0x1f4674['push'](_0x1f4674['shift']());}};_0x3e7f42(++_0x146085);}(_0x4ffa,0x124));var _0xa4ff=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4ffa[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa4ff('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa4ff('0x1')](_0xa4ff('0x2')),'allowNull':![],'defaultValue':_0xa4ff('0x2')},'description':{'type':Sequelize[_0xa4ff('0x0')]},'active':{'type':Sequelize[_0xa4ff('0x3')],'defaultValue':0x0,'comment':_0xa4ff('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xa4ff('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa4ff('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa4ff('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa4ff('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4ff('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa4ff('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4ff('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa4ff('0x7')](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa4ff('0x7')](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xa4ff('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa4ff('0xa')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xa4ff('0xb'),_0xa4ff('0xc'),'onlyIfOpen'),'defaultValue':_0xa4ff('0xb')},'dialAMDActive':{'type':Sequelize[_0xa4ff('0x3')],'defaultValue':0x0,'comment':_0xa4ff('0xd')},'dialAMDInitialSilence':{'type':Sequelize[_0xa4ff('0x7')](0x9)[_0xa4ff('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa4ff('0xe')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa4ff('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa4ff('0xf')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa4ff('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa4ff('0x10')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa4ff('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xa4ff('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa4ff('0x7')](0x9)[_0xa4ff('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa4ff('0x11')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa4ff('0x7')](0x9)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa4ff('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa4ff('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa4ff('0x12')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa4ff('0x13'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xa4ff('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa4ff('0x14')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xa4ff('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa4ff('0x15')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4ff('0x16')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa4ff('0x7')](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4ff('0x17')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4ff('0x18')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa4ff('0x7')](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4ff('0x19')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4ff('0x1a')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4ff('0x1b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa4ff('0x7')](0x3)[_0xa4ff('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4ff('0x1c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa4ff('0x7')](0x5)[_0xa4ff('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4ff('0x1d')}}; \ No newline at end of file +var _0xa1ea=['ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*'];(function(_0x1182e8,_0x14cc0e){var _0x4deabd=function(_0x2178c1){while(--_0x2178c1){_0x1182e8['push'](_0x1182e8['shift']());}};_0x4deabd(++_0x14cc0e);}(_0xa1ea,0x102));var _0xaa1e=function(_0x188b18,_0x22f59a){_0x188b18=_0x188b18-0x0;var _0x52e7ce=_0xa1ea[_0x188b18];return _0x52e7ce;};'use strict';var Sequelize=require(_0xaa1e('0x0'));module[_0xaa1e('0x1')]={'name':{'type':Sequelize[_0xaa1e('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xaa1e('0x3')),'allowNull':![],'defaultValue':_0xaa1e('0x3')},'description':{'type':Sequelize[_0xaa1e('0x2')]},'active':{'type':Sequelize[_0xaa1e('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xaa1e('0x5')](0x4)[_0xaa1e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaa1e('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xaa1e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaa1e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa1e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaa1e('0x5')](0x3)[_0xaa1e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaa1e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa1e('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa1e('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaa1e('0x6')],'defaultValue':0x3,'comment':_0xaa1e('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa1e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xaa1e('0x5')](0x3)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaa1e('0xd')},'dialTimezone':{'type':Sequelize[_0xaa1e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaa1e('0x2')],'defaultValue':_0xaa1e('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xaa1e('0xf')](_0xaa1e('0x10'),'never',_0xaa1e('0x11')),'defaultValue':_0xaa1e('0x10')},'dialAMDActive':{'type':Sequelize[_0xaa1e('0x4')],'defaultValue':0x0,'comment':_0xaa1e('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xaa1e('0x5')](0x9)[_0xaa1e('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaa1e('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xaa1e('0x5')](0x9)[_0xaa1e('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaa1e('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaa1e('0x5')](0x9)[_0xaa1e('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaa1e('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xaa1e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaa1e('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaa1e('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaa1e('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaa1e('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaa1e('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xaa1e('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaa1e('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaa1e('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaa1e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaa1e('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaa1e('0xf')](_0xaa1e('0x1c'),_0xaa1e('0x1d')),'defaultValue':_0xaa1e('0x1c')},'dialPrefix':{'type':Sequelize[_0xaa1e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaa1e('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaa1e('0x1e')},'dialCutDigit':{'type':Sequelize[_0xaa1e('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaa1e('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaa1e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa1e('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa1e('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xaa1e('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa1e('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaa1e('0x5')](0x3)[_0xaa1e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa1e('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xaa1e('0x5')](0x3)[_0xaa1e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa1e('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)[_0xaa1e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaa1e('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaa1e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaa1e('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaa1e('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index d7ecfd7..1bd87e5 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 _0x5e49=['userProfileId','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','toString','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','eml-format','rimraf','zip-dir','moment','mustache','util','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','createdAt','body','omit','updatedAt','UserProfileSection'];(function(_0x212577,_0x3826ca){var _0xccb36b=function(_0x1ae7a3){while(--_0x1ae7a3){_0x212577['push'](_0x212577['shift']());}};_0xccb36b(++_0x3826ca);}(_0x5e49,0x152));var _0x95e4=function(_0x1b2704,_0x345e20){_0x1b2704=_0x1b2704-0x0;var _0x4e3e41=_0x5e49[_0x1b2704];return _0x4e3e41;};'use strict';var emlformat=require(_0x95e4('0x0'));var rimraf=require(_0x95e4('0x1'));var zipdir=require(_0x95e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x95e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x95e4('0x4'));var util=require(_0x95e4('0x5'));var path=require('path');var sox=require(_0x95e4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95e4('0x7'));var squel=require(_0x95e4('0x8'));var crypto=require(_0x95e4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x95e4('0xa'));var querystring=require(_0x95e4('0xb'));var Papa=require(_0x95e4('0xc'));var Redis=require(_0x95e4('0xd'));var authService=require(_0x95e4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x95e4('0xf'));var hardwareService=require(_0x95e4('0x10'));var logger=require(_0x95e4('0x11'))('api');var utils=require(_0x95e4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x95e4('0x13'));var db=require(_0x95e4('0x14'))['db'];function respondWithStatusCode(_0x7744c,_0x5cec3e){_0x5cec3e=_0x5cec3e||0xcc;return function(_0x1c2faa){if(_0x1c2faa){return _0x7744c[_0x95e4('0x15')](_0x5cec3e);}return _0x7744c[_0x95e4('0x16')](_0x5cec3e)[_0x95e4('0x17')]();};}function respondWithResult(_0x471429,_0x24d17c){_0x24d17c=_0x24d17c||0xc8;return function(_0x4c3d40){if(_0x4c3d40){return _0x471429['status'](_0x24d17c)[_0x95e4('0x18')](_0x4c3d40);}};}function respondWithFilteredResult(_0x5a96f2,_0xa70bb7){return function(_0x264d7e){if(_0x264d7e){var _0x2da6d0=typeof _0xa70bb7[_0x95e4('0x19')]==='undefined'&&typeof _0xa70bb7[_0x95e4('0x1a')]===_0x95e4('0x1b');var _0x550ccc=_0x264d7e[_0x95e4('0x1c')];var _0x38e928=_0x2da6d0?0x0:_0xa70bb7[_0x95e4('0x19')];var _0x438e04=_0x2da6d0?_0x264d7e[_0x95e4('0x1c')]:_0xa70bb7[_0x95e4('0x19')]+_0xa70bb7[_0x95e4('0x1a')];var _0x2369b3;if(_0x438e04>=_0x550ccc){_0x438e04=_0x550ccc;_0x2369b3=0xc8;}else{_0x2369b3=0xce;}_0x5a96f2['status'](_0x2369b3);return _0x5a96f2[_0x95e4('0x1d')](_0x95e4('0x1e'),_0x38e928+'-'+_0x438e04+'/'+_0x550ccc)[_0x95e4('0x18')](_0x264d7e);}return null;};}function patchUpdates(_0x39b060){return function(_0x98eacd){try{jsonpatch['apply'](_0x98eacd,_0x39b060,!![]);}catch(_0x4eeb73){return BPromise[_0x95e4('0x1f')](_0x4eeb73);}return _0x98eacd['save']();};}function saveUpdates(_0x2d15ab,_0x15628c){return function(_0x5f06b1){if(_0x5f06b1){return _0x5f06b1[_0x95e4('0x20')](_0x2d15ab)['then'](function(_0x24f041){return _0x24f041;});}return null;};}function removeEntity(_0x169b01,_0x1b1009){return function(_0x7a624b){if(_0x7a624b){return _0x7a624b['destroy']()[_0x95e4('0x21')](function(){var _0x251f0b=_0x7a624b[_0x95e4('0x22')]({'plain':!![]});var _0x280230=_0x95e4('0x23');return db[_0x95e4('0x24')][_0x95e4('0x25')]({'where':{'type':_0x280230,'resourceId':_0x251f0b['id']}})['then'](function(){return _0x7a624b;});})[_0x95e4('0x21')](function(){_0x169b01[_0x95e4('0x16')](0xcc)[_0x95e4('0x17')]();});}};}function handleEntityNotFound(_0x3d566d,_0x1e4a04){return function(_0x281bbc){if(!_0x281bbc){_0x3d566d['sendStatus'](0x194);}return _0x281bbc;};}function handleError(_0x151ccb,_0x2782d9){_0x2782d9=_0x2782d9||0x1f4;return function(_0x7c445a){logger[_0x95e4('0x26')](_0x7c445a[_0x95e4('0x27')]);if(_0x7c445a[_0x95e4('0x28')]){delete _0x7c445a[_0x95e4('0x28')];}_0x151ccb[_0x95e4('0x16')](_0x2782d9)[_0x95e4('0x29')](_0x7c445a);};}exports[_0x95e4('0x2a')]=function(_0x5a6c47,_0x3c6d05){var _0x18ee61={},_0x374c92={},_0x53d403={'count':0x0,'rows':[]};var _0x28c0f0=_[_0x95e4('0x2b')](db[_0x95e4('0x2c')][_0x95e4('0x2d')],function(_0xe70192){return{'name':_0xe70192[_0x95e4('0x2e')],'type':_0xe70192[_0x95e4('0x2f')]['key']};});_0x374c92[_0x95e4('0x30')]=_[_0x95e4('0x2b')](_0x28c0f0,_0x95e4('0x28'));_0x374c92['query']=_[_0x95e4('0x31')](_0x5a6c47[_0x95e4('0x32')]);_0x374c92[_0x95e4('0x33')]=_[_0x95e4('0x34')](_0x374c92[_0x95e4('0x30')],_0x374c92[_0x95e4('0x32')]);_0x18ee61[_0x95e4('0x35')]=_['intersection'](_0x374c92[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x5a6c47[_0x95e4('0x32')][_0x95e4('0x36')]));_0x18ee61[_0x95e4('0x35')]=_0x18ee61['attributes'][_0x95e4('0x37')]?_0x18ee61[_0x95e4('0x35')]:_0x374c92[_0x95e4('0x30')];if(!_0x5a6c47['query'][_0x95e4('0x38')](_0x95e4('0x39'))){_0x18ee61['limit']=qs[_0x95e4('0x1a')](_0x5a6c47[_0x95e4('0x32')]['limit']);_0x18ee61[_0x95e4('0x19')]=qs[_0x95e4('0x19')](_0x5a6c47[_0x95e4('0x32')]['offset']);}_0x18ee61[_0x95e4('0x3a')]=qs[_0x95e4('0x3b')](_0x5a6c47[_0x95e4('0x32')][_0x95e4('0x3b')]);_0x18ee61[_0x95e4('0x3c')]=qs[_0x95e4('0x33')](_[_0x95e4('0x3d')](_0x5a6c47['query'],_0x374c92[_0x95e4('0x33')]),_0x28c0f0);if(_0x5a6c47['query']['filter']){_0x18ee61['where']=_[_0x95e4('0x3e')](_0x18ee61['where'],{'$or':_['map'](_0x28c0f0,function(_0x2eeb89){if(_0x2eeb89[_0x95e4('0x2f')]!=='VIRTUAL'){var _0x4b3631={};_0x4b3631[_0x2eeb89[_0x95e4('0x28')]]={'$like':'%'+_0x5a6c47[_0x95e4('0x32')][_0x95e4('0x3f')]+'%'};return _0x4b3631;}})});}_0x18ee61=_[_0x95e4('0x3e')]({},_0x18ee61,_0x5a6c47[_0x95e4('0x40')]);var _0x5f5b5a={'where':_0x18ee61[_0x95e4('0x3c')]};return db[_0x95e4('0x2c')][_0x95e4('0x1c')](_0x5f5b5a)[_0x95e4('0x21')](function(_0x198869){_0x53d403[_0x95e4('0x1c')]=_0x198869;if(_0x5a6c47[_0x95e4('0x32')]['includeAll']){_0x18ee61[_0x95e4('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x95e4('0x42')](_0x18ee61);})[_0x95e4('0x21')](function(_0x52f83f){_0x53d403[_0x95e4('0x43')]=_0x52f83f;return _0x53d403;})[_0x95e4('0x21')](respondWithFilteredResult(_0x3c6d05,_0x18ee61))[_0x95e4('0x44')](handleError(_0x3c6d05,null));};exports[_0x95e4('0x45')]=function(_0x437470,_0x1dfa39){var _0x1c4160={'raw':![],'where':{'id':_0x437470['params']['id']}},_0x13129a={};_0x13129a[_0x95e4('0x30')]=_[_0x95e4('0x31')](db[_0x95e4('0x2c')][_0x95e4('0x2d')]);_0x13129a['query']=_[_0x95e4('0x31')](_0x437470[_0x95e4('0x32')]);_0x13129a[_0x95e4('0x33')]=_[_0x95e4('0x34')](_0x13129a[_0x95e4('0x30')],_0x13129a['query']);_0x1c4160[_0x95e4('0x35')]=_[_0x95e4('0x34')](_0x13129a['model'],qs[_0x95e4('0x36')](_0x437470[_0x95e4('0x32')][_0x95e4('0x36')]));_0x1c4160['attributes']=_0x1c4160['attributes'][_0x95e4('0x37')]?_0x1c4160['attributes']:_0x13129a['model'];if(_0x437470[_0x95e4('0x32')]['includeAll']){_0x1c4160[_0x95e4('0x41')]=[{'all':!![]}];}_0x1c4160=_['merge']({},_0x1c4160,_0x437470['options']);return db[_0x95e4('0x2c')][_0x95e4('0x46')](_0x1c4160)[_0x95e4('0x21')](handleEntityNotFound(_0x1dfa39,null))['then'](respondWithResult(_0x1dfa39,null))['catch'](handleError(_0x1dfa39,null));};exports[_0x95e4('0x47')]=function(_0x1186ba,_0x1e269d){return db[_0x95e4('0x2c')][_0x95e4('0x47')](_0x1186ba['body'],{})[_0x95e4('0x21')](function(_0xf90e5b){var _0xc1ceb4=_0x1186ba['user'][_0x95e4('0x22')]({'plain':!![]});if(!_0xc1ceb4)throw new Error(_0x95e4('0x48'));if(_0xc1ceb4[_0x95e4('0x49')]===_0x95e4('0x4a')){var _0x24a46a=_0xf90e5b[_0x95e4('0x22')]({'plain':!![]});var _0x59440c=_0x95e4('0x23');return db['UserProfileSection'][_0x95e4('0x46')]({'where':{'name':_0x59440c,'userProfileId':_0xc1ceb4['userProfileId']},'raw':!![]})[_0x95e4('0x21')](function(_0x5d6283){if(_0x5d6283&&_0x5d6283[_0x95e4('0x4b')]===0x0){return db[_0x95e4('0x24')][_0x95e4('0x47')]({'name':_0x24a46a['name'],'resourceId':_0x24a46a['id'],'type':_0x5d6283[_0x95e4('0x28')],'sectionId':_0x5d6283['id']},{})[_0x95e4('0x21')](function(){return _0xf90e5b;});}else{return _0xf90e5b;}})['catch'](function(_0x3df80a){logger['error'](_0x95e4('0x4c'),_0x3df80a);throw _0x3df80a;});}return _0xf90e5b;})[_0x95e4('0x21')](respondWithResult(_0x1e269d,0xc9))[_0x95e4('0x44')](handleError(_0x1e269d,null));};exports[_0x95e4('0x4d')]=function(_0x3bf893,_0x5ba4ea){var _0x2fbb73={'where':{'id':_0x3bf893[_0x95e4('0x4e')]['id']}},_0xd34b7f={};_0xd34b7f[_0x95e4('0x30')]=_[_0x95e4('0x31')](db['Campaign'][_0x95e4('0x2d')]);_0x2fbb73['attributes']=_['intersection'](_0xd34b7f[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x3bf893[_0x95e4('0x32')][_0x95e4('0x36')]));_0x2fbb73[_0x95e4('0x35')]=_0x2fbb73[_0x95e4('0x35')][_0x95e4('0x37')]?_0x2fbb73['attributes']:_0xd34b7f[_0x95e4('0x30')];if(_0x3bf893['query'][_0x95e4('0x4f')]){_0x2fbb73['include']=[{'all':!![]}];}_0x2fbb73=_[_0x95e4('0x3e')]({},_0x2fbb73,_0x3bf893[_0x95e4('0x40')]);return db[_0x95e4('0x2c')][_0x95e4('0x46')](_0x2fbb73)[_0x95e4('0x21')](handleEntityNotFound(_0x5ba4ea,null))[_0x95e4('0x21')](function(_0x4c65b7){if(_0x4c65b7){var _0x123601=_0x4c65b7[_0x95e4('0x22')]({'plain':!![]});_0x123601=qs['omit'](_0x123601,['id',_0x95e4('0x50'),'updatedAt']);_0x3bf893[_0x95e4('0x51')]=_[_0x95e4('0x52')](_0x3bf893[_0x95e4('0x51')],['id',_0x95e4('0x50'),_0x95e4('0x53')]);return db[_0x95e4('0x2c')][_0x95e4('0x47')](_['merge'](_0x123601,_0x3bf893[_0x95e4('0x51')]),{'include':_0x3bf893[_0x95e4('0x32')][_0x95e4('0x4f')]?[{'all':!![]}]:undefined})[_0x95e4('0x21')](function(_0x5c8ec0){var _0x4e2f82=_0x3bf893[_0x95e4('0x4a')][_0x95e4('0x22')]({'plain':!![]});if(!_0x4e2f82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e2f82['role']==='user'){var _0x398207=_0x5c8ec0[_0x95e4('0x22')]({'plain':!![]});var _0x529a89='IvrCampaigns';return db[_0x95e4('0x54')][_0x95e4('0x46')]({'where':{'name':_0x529a89,'userProfileId':_0x4e2f82[_0x95e4('0x55')]},'raw':!![]})[_0x95e4('0x21')](function(_0x2ee11a){if(_0x2ee11a&&_0x2ee11a[_0x95e4('0x4b')]===0x0){return db['UserProfileResource'][_0x95e4('0x47')]({'name':_0x398207[_0x95e4('0x28')],'resourceId':_0x398207['id'],'type':_0x2ee11a[_0x95e4('0x28')],'sectionId':_0x2ee11a['id']},{})[_0x95e4('0x21')](function(){return _0x5c8ec0;});}else{return _0x5c8ec0;}})['catch'](function(_0x5c1d9a){logger[_0x95e4('0x26')](_0x95e4('0x4c'),_0x5c1d9a);throw _0x5c1d9a;});}return _0x5c8ec0;});}})[_0x95e4('0x21')](respondWithResult(_0x5ba4ea,0xc9))[_0x95e4('0x44')](handleError(_0x5ba4ea,null));};exports[_0x95e4('0x20')]=function(_0x104026,_0x47b4d6){if(_0x104026[_0x95e4('0x51')]['id']){delete _0x104026[_0x95e4('0x51')]['id'];}return db[_0x95e4('0x2c')][_0x95e4('0x46')]({'where':{'id':_0x104026['params']['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x47b4d6,null))[_0x95e4('0x21')](saveUpdates(_0x104026[_0x95e4('0x51')],null))[_0x95e4('0x21')](respondWithResult(_0x47b4d6,null))[_0x95e4('0x44')](handleError(_0x47b4d6,null));};exports[_0x95e4('0x25')]=function(_0x97d441,_0x548269){return db[_0x95e4('0x2c')][_0x95e4('0x46')]({'where':{'id':_0x97d441[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x548269,null))['then'](removeEntity(_0x548269,null))['catch'](handleError(_0x548269,null));};exports[_0x95e4('0x56')]=function(_0x5bbfbe,_0x3694d4,_0x40c42f){var _0x4d365a={'raw':!![],'where':{}};var _0x58ad27={};var _0x3dfa42={'count':0x0,'rows':[]};return db[_0x95e4('0x2c')][_0x95e4('0x57')]({'where':{'id':_0x5bbfbe[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x3694d4,null))[_0x95e4('0x21')](function(_0x14dabc){if(_0x14dabc){_0x58ad27[_0x95e4('0x30')]=_[_0x95e4('0x31')](db[_0x95e4('0x58')]['rawAttributes']);_0x58ad27['query']=_[_0x95e4('0x31')](_0x5bbfbe[_0x95e4('0x32')]);_0x58ad27[_0x95e4('0x33')]=_[_0x95e4('0x34')](_0x58ad27[_0x95e4('0x30')],_0x58ad27['query']);_0x4d365a[_0x95e4('0x35')]=_[_0x95e4('0x34')](_0x58ad27[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x5bbfbe['query'][_0x95e4('0x36')]));_0x4d365a[_0x95e4('0x35')]=_0x4d365a[_0x95e4('0x35')][_0x95e4('0x37')]?_0x4d365a[_0x95e4('0x35')]:_0x58ad27[_0x95e4('0x30')];if(!_0x5bbfbe[_0x95e4('0x32')][_0x95e4('0x38')](_0x95e4('0x39'))){_0x4d365a[_0x95e4('0x1a')]=qs['limit'](_0x5bbfbe[_0x95e4('0x32')]['limit']);_0x4d365a[_0x95e4('0x19')]=qs[_0x95e4('0x19')](_0x5bbfbe['query'][_0x95e4('0x19')]);}_0x4d365a['order']=qs[_0x95e4('0x3b')](_0x5bbfbe[_0x95e4('0x32')][_0x95e4('0x3b')]);_0x4d365a[_0x95e4('0x3c')]=qs[_0x95e4('0x33')](_[_0x95e4('0x3d')](_0x5bbfbe['query'],_0x58ad27[_0x95e4('0x33')]));_0x4d365a[_0x95e4('0x3c')][_0x95e4('0x59')]=_0x14dabc['id'];if(_0x5bbfbe[_0x95e4('0x32')][_0x95e4('0x3f')]){_0x4d365a[_0x95e4('0x3c')]=_[_0x95e4('0x3e')](_0x4d365a[_0x95e4('0x3c')],{'$or':_['map'](_0x4d365a[_0x95e4('0x35')],function(_0x3bfd72){var _0x30ccf0={};_0x30ccf0[_0x3bfd72]={'$like':'%'+_0x5bbfbe[_0x95e4('0x32')]['filter']+'%'};return _0x30ccf0;})});}_0x4d365a=_[_0x95e4('0x3e')]({},_0x4d365a,_0x5bbfbe['options']);return db['CmHopper']['count']({'where':_0x4d365a[_0x95e4('0x3c')]})[_0x95e4('0x21')](function(_0x78c143){_0x3dfa42['count']=_0x78c143;if(_0x5bbfbe['query'][_0x95e4('0x4f')]){_0x4d365a[_0x95e4('0x41')]=[{'all':!![]}];}return db[_0x95e4('0x58')]['findAll'](_0x4d365a);})[_0x95e4('0x21')](function(_0x3c2c28){_0x3dfa42[_0x95e4('0x43')]=_0x3c2c28;return _0x3dfa42;});}})['then'](respondWithFilteredResult(_0x3694d4,_0x4d365a))['catch'](handleError(_0x3694d4,null));};exports[_0x95e4('0x5a')]=function(_0x58c46b,_0x552925,_0x168d45){var _0x39edf8={'raw':!![],'where':{}};var _0x383d60={};var _0x34a289={'count':0x0,'rows':[]};return db[_0x95e4('0x2c')][_0x95e4('0x57')]({'where':{'id':_0x58c46b[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x552925,null))[_0x95e4('0x21')](function(_0x43280d){if(_0x43280d){_0x383d60[_0x95e4('0x30')]=_[_0x95e4('0x31')](db[_0x95e4('0x5b')][_0x95e4('0x2d')]);_0x383d60[_0x95e4('0x32')]=_[_0x95e4('0x31')](_0x58c46b[_0x95e4('0x32')]);_0x383d60[_0x95e4('0x33')]=_['intersection'](_0x383d60[_0x95e4('0x30')],_0x383d60[_0x95e4('0x32')]);_0x39edf8['attributes']=_[_0x95e4('0x34')](_0x383d60[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x58c46b['query'][_0x95e4('0x36')]));_0x39edf8[_0x95e4('0x35')]=_0x39edf8[_0x95e4('0x35')]['length']?_0x39edf8[_0x95e4('0x35')]:_0x383d60['model'];if(!_0x58c46b['query'][_0x95e4('0x38')](_0x95e4('0x39'))){_0x39edf8[_0x95e4('0x1a')]=qs[_0x95e4('0x1a')](_0x58c46b[_0x95e4('0x32')][_0x95e4('0x1a')]);_0x39edf8[_0x95e4('0x19')]=qs[_0x95e4('0x19')](_0x58c46b[_0x95e4('0x32')][_0x95e4('0x19')]);}_0x39edf8[_0x95e4('0x3a')]=qs[_0x95e4('0x3b')](_0x58c46b['query'][_0x95e4('0x3b')]);_0x39edf8[_0x95e4('0x3c')]=qs['filters'](_['pick'](_0x58c46b['query'],_0x383d60[_0x95e4('0x33')]));_0x39edf8['where'][_0x95e4('0x59')]=_0x43280d['id'];if(_0x58c46b[_0x95e4('0x32')]['filter']){_0x39edf8[_0x95e4('0x3c')]=_[_0x95e4('0x3e')](_0x39edf8[_0x95e4('0x3c')],{'$or':_[_0x95e4('0x2b')](_0x39edf8['attributes'],function(_0x1df0b3){var _0x2f1581={};_0x2f1581[_0x1df0b3]={'$like':'%'+_0x58c46b[_0x95e4('0x32')][_0x95e4('0x3f')]+'%'};return _0x2f1581;})});}_0x39edf8=_[_0x95e4('0x3e')]({},_0x39edf8,_0x58c46b[_0x95e4('0x40')]);return db[_0x95e4('0x5b')][_0x95e4('0x1c')]({'where':_0x39edf8[_0x95e4('0x3c')]})['then'](function(_0x5a05ab){_0x34a289['count']=_0x5a05ab;if(_0x58c46b[_0x95e4('0x32')][_0x95e4('0x4f')]){_0x39edf8[_0x95e4('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x95e4('0x42')](_0x39edf8);})[_0x95e4('0x21')](function(_0x511471){_0x34a289[_0x95e4('0x43')]=_0x511471;return _0x34a289;});}})['then'](respondWithFilteredResult(_0x552925,_0x39edf8))[_0x95e4('0x44')](handleError(_0x552925,null));};exports[_0x95e4('0x5c')]=function(_0x734e9f,_0x98f744,_0x59dfd9){var _0x345921={'raw':!![],'where':{}};var _0x4a6e90={};var _0x1c276e={'count':0x0,'rows':[]};return db[_0x95e4('0x2c')][_0x95e4('0x57')]({'where':{'id':_0x734e9f[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x98f744,null))['then'](function(_0x37c3a1){if(_0x37c3a1){_0x4a6e90['model']=_[_0x95e4('0x31')](db[_0x95e4('0x5d')]['rawAttributes']);_0x4a6e90[_0x95e4('0x32')]=_['keys'](_0x734e9f[_0x95e4('0x32')]);_0x4a6e90['filters']=_[_0x95e4('0x34')](_0x4a6e90[_0x95e4('0x30')],_0x4a6e90['query']);_0x345921[_0x95e4('0x35')]=_[_0x95e4('0x34')](_0x4a6e90[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x734e9f[_0x95e4('0x32')][_0x95e4('0x36')]));_0x345921['attributes']=_0x345921[_0x95e4('0x35')][_0x95e4('0x37')]?_0x345921[_0x95e4('0x35')]:_0x4a6e90[_0x95e4('0x30')];if(!_0x734e9f[_0x95e4('0x32')][_0x95e4('0x38')](_0x95e4('0x39'))){_0x345921[_0x95e4('0x1a')]=qs['limit'](_0x734e9f[_0x95e4('0x32')][_0x95e4('0x1a')]);_0x345921[_0x95e4('0x19')]=qs['offset'](_0x734e9f[_0x95e4('0x32')][_0x95e4('0x19')]);}_0x345921[_0x95e4('0x3a')]=qs[_0x95e4('0x3b')](_0x734e9f[_0x95e4('0x32')][_0x95e4('0x3b')]);_0x345921[_0x95e4('0x3c')]=qs[_0x95e4('0x33')](_[_0x95e4('0x3d')](_0x734e9f['query'],_0x4a6e90[_0x95e4('0x33')]));_0x345921[_0x95e4('0x3c')][_0x95e4('0x59')]=_0x37c3a1['id'];if(_0x734e9f['query']['filter']){_0x345921[_0x95e4('0x3c')]=_['merge'](_0x345921[_0x95e4('0x3c')],{'$or':_[_0x95e4('0x2b')](_0x345921[_0x95e4('0x35')],function(_0x2527ef){var _0x56afab={};_0x56afab[_0x2527ef]={'$like':'%'+_0x734e9f[_0x95e4('0x32')][_0x95e4('0x3f')]+'%'};return _0x56afab;})});}_0x345921=_[_0x95e4('0x3e')]({},_0x345921,_0x734e9f[_0x95e4('0x40')]);return db['CmHopperFinal'][_0x95e4('0x1c')]({'where':_0x345921[_0x95e4('0x3c')]})['then'](function(_0x3b704f){_0x1c276e[_0x95e4('0x1c')]=_0x3b704f;if(_0x734e9f[_0x95e4('0x32')][_0x95e4('0x4f')]){_0x345921[_0x95e4('0x41')]=[{'all':!![]}];}return db[_0x95e4('0x5d')]['findAll'](_0x345921);})[_0x95e4('0x21')](function(_0x45f5af){_0x1c276e[_0x95e4('0x43')]=_0x45f5af;return _0x1c276e;});}})[_0x95e4('0x21')](respondWithFilteredResult(_0x98f744,_0x345921))[_0x95e4('0x44')](handleError(_0x98f744,null));};exports[_0x95e4('0x5e')]=function(_0x4f9888,_0x2e0efc,_0x6910f3){var _0x130697={'raw':!![],'where':{}};var _0x47c4ef={};var _0x9b9f37={'count':0x0,'rows':[]};return db['Campaign'][_0x95e4('0x57')]({'where':{'id':_0x4f9888[_0x95e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e0efc,null))[_0x95e4('0x21')](function(_0x212eea){if(_0x212eea){_0x47c4ef[_0x95e4('0x30')]=_[_0x95e4('0x31')](db['CmHopperBlack'][_0x95e4('0x2d')]);_0x47c4ef[_0x95e4('0x32')]=_['keys'](_0x4f9888[_0x95e4('0x32')]);_0x47c4ef[_0x95e4('0x33')]=_[_0x95e4('0x34')](_0x47c4ef[_0x95e4('0x30')],_0x47c4ef[_0x95e4('0x32')]);_0x130697['attributes']=_['intersection'](_0x47c4ef[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x4f9888['query'][_0x95e4('0x36')]));_0x130697[_0x95e4('0x35')]=_0x130697[_0x95e4('0x35')][_0x95e4('0x37')]?_0x130697['attributes']:_0x47c4ef['model'];if(!_0x4f9888[_0x95e4('0x32')][_0x95e4('0x38')]('nolimit')){_0x130697[_0x95e4('0x1a')]=qs[_0x95e4('0x1a')](_0x4f9888[_0x95e4('0x32')][_0x95e4('0x1a')]);_0x130697['offset']=qs['offset'](_0x4f9888[_0x95e4('0x32')][_0x95e4('0x19')]);}_0x130697['order']=qs['sort'](_0x4f9888[_0x95e4('0x32')][_0x95e4('0x3b')]);_0x130697[_0x95e4('0x3c')]=qs[_0x95e4('0x33')](_[_0x95e4('0x3d')](_0x4f9888['query'],_0x47c4ef[_0x95e4('0x33')]));_0x130697[_0x95e4('0x3c')][_0x95e4('0x59')]=_0x212eea['id'];if(_0x4f9888[_0x95e4('0x32')]['filter']){_0x130697['where']=_['merge'](_0x130697[_0x95e4('0x3c')],{'$or':_[_0x95e4('0x2b')](_0x130697[_0x95e4('0x35')],function(_0x1af6bd){var _0x486cfd={};_0x486cfd[_0x1af6bd]={'$like':'%'+_0x4f9888[_0x95e4('0x32')][_0x95e4('0x3f')]+'%'};return _0x486cfd;})});}_0x130697=_[_0x95e4('0x3e')]({},_0x130697,_0x4f9888[_0x95e4('0x40')]);return db[_0x95e4('0x5f')][_0x95e4('0x1c')]({'where':_0x130697[_0x95e4('0x3c')]})[_0x95e4('0x21')](function(_0xf921fe){_0x9b9f37[_0x95e4('0x1c')]=_0xf921fe;if(_0x4f9888[_0x95e4('0x32')][_0x95e4('0x4f')]){_0x130697[_0x95e4('0x41')]=[{'all':!![]}];}return db[_0x95e4('0x5f')]['findAll'](_0x130697);})[_0x95e4('0x21')](function(_0x5085eb){_0x9b9f37[_0x95e4('0x43')]=_0x5085eb;return _0x9b9f37;});}})[_0x95e4('0x21')](respondWithFilteredResult(_0x2e0efc,_0x130697))['catch'](handleError(_0x2e0efc,null));};exports[_0x95e4('0x60')]=function(_0x140e5b,_0x50ad9c,_0x349eda){var _0x89243e={};var _0x3a67ce={};var _0xbdb79;var _0x4101cc;return db[_0x95e4('0x2c')][_0x95e4('0x57')]({'where':{'id':_0x140e5b['params']['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x50ad9c,null))[_0x95e4('0x21')](function(_0x5eae32){if(_0x5eae32){_0xbdb79=_0x5eae32;_0x3a67ce[_0x95e4('0x30')]=_[_0x95e4('0x31')](db[_0x95e4('0x61')][_0x95e4('0x2d')]);_0x3a67ce[_0x95e4('0x32')]=_['keys'](_0x140e5b[_0x95e4('0x32')]);_0x3a67ce[_0x95e4('0x33')]=_[_0x95e4('0x34')](_0x3a67ce['model'],_0x3a67ce[_0x95e4('0x32')]);_0x89243e[_0x95e4('0x35')]=_[_0x95e4('0x34')](_0x3a67ce[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x140e5b[_0x95e4('0x32')][_0x95e4('0x36')]));_0x89243e[_0x95e4('0x35')]=_0x89243e['attributes'][_0x95e4('0x37')]?_0x89243e[_0x95e4('0x35')]:_0x3a67ce[_0x95e4('0x30')];_0x89243e['order']=qs[_0x95e4('0x3b')](_0x140e5b[_0x95e4('0x32')]['sort']);_0x89243e[_0x95e4('0x3c')]=qs[_0x95e4('0x33')](_[_0x95e4('0x3d')](_0x140e5b[_0x95e4('0x32')],_0x3a67ce[_0x95e4('0x33')]));if(_0x140e5b[_0x95e4('0x32')][_0x95e4('0x3f')]){_0x89243e[_0x95e4('0x3c')]=_[_0x95e4('0x3e')](_0x89243e[_0x95e4('0x3c')],{'$or':_[_0x95e4('0x2b')](_0x89243e[_0x95e4('0x35')],function(_0x42e293){var _0x97c060={};_0x97c060[_0x42e293]={'$like':'%'+_0x140e5b['query'][_0x95e4('0x3f')]+'%'};return _0x97c060;})});}_0x89243e=_['merge']({},_0x89243e,_0x140e5b['options']);return _0xbdb79[_0x95e4('0x60')](_0x89243e);}})['then'](function(_0x2647cd){if(_0x2647cd){_0x4101cc=_0x2647cd[_0x95e4('0x37')];if(!_0x140e5b[_0x95e4('0x32')][_0x95e4('0x38')](_0x95e4('0x39'))){_0x89243e[_0x95e4('0x1a')]=qs[_0x95e4('0x1a')](_0x140e5b['query'][_0x95e4('0x1a')]);_0x89243e[_0x95e4('0x19')]=qs['offset'](_0x140e5b[_0x95e4('0x32')][_0x95e4('0x19')]);}return _0xbdb79[_0x95e4('0x60')](_0x89243e);}})[_0x95e4('0x21')](function(_0x5c420e){if(_0x5c420e){return _0x5c420e?{'count':_0x4101cc,'rows':_0x5c420e}:null;}})['then'](respondWithResult(_0x50ad9c,null))[_0x95e4('0x44')](handleError(_0x50ad9c,null));};exports[_0x95e4('0x62')]=function(_0x54e6d5,_0x36cfa3,_0x63297c){var _0x3ac9c7,_0x543f02;var _0x28a5aa=[];var _0x3e56b1=moment()[_0x95e4('0x63')](_0x95e4('0x64'));return db[_0x95e4('0x2c')][_0x95e4('0x46')]({'where':{'id':_0x54e6d5[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x36cfa3,null))[_0x95e4('0x21')](function(_0x412536){if(_0x412536){_0x543f02=_0x412536;return _0x412536['addLists'](_0x54e6d5[_0x95e4('0x51')]['ids'],_[_0x95e4('0x52')](_0x54e6d5[_0x95e4('0x51')],[_0x95e4('0x65'),'id'])||{});}return null;})[_0x95e4('0x66')](function(_0x160908){var _0x18af88;var _0x3386fa;_0x3ac9c7=_0x160908||[];var _0x383d90=[];if(_0x160908){for(var _0x3fa31b=0x0;_0x3fa31b<_0x160908[_0x95e4('0x37')];_0x3fa31b+=0x1){var _0x185e7b=_0x160908[_0x3fa31b][_0x95e4('0x22')]({'plain':!![]});_0x543f02[_0x95e4('0x67')]=_0x54e6d5[_0x95e4('0x51')][_0x95e4('0x67')]?_0x54e6d5['body'][_0x95e4('0x67')]:_0x543f02[_0x95e4('0x67')];switch(_0x543f02[_0x95e4('0x67')]){case _0x95e4('0x68'):_0x18af88=squel[_0x95e4('0x69')]()[_0x95e4('0x6a')](_0x95e4('0x6b'))['fromQuery']([_0x95e4('0x6c'),_0x95e4('0x6d'),_0x95e4('0x6e'),_0x95e4('0x6f'),_0x95e4('0x59'),'createdAt',_0x95e4('0x53')],squel[_0x95e4('0x70')]()[_0x95e4('0x71')](_0x95e4('0x6c'),'phone')[_0x95e4('0x71')](_0x95e4('0x72'),_0x95e4('0x6d'))[_0x95e4('0x71')]('id','ContactId')['field'](_0x185e7b['CmListId']['toString'](),_0x95e4('0x6f'))['field'](_0x54e6d5[_0x95e4('0x4e')]['id']['toString'](),_0x95e4('0x59'))[_0x95e4('0x71')]('\x27'+_0x3e56b1+'\x27',_0x95e4('0x50'))[_0x95e4('0x71')]('\x27'+_0x3e56b1+'\x27',_0x95e4('0x53'))['from'](_0x95e4('0x73'))[_0x95e4('0x3c')](_0x95e4('0x74'))[_0x95e4('0x3c')](_0x95e4('0x75'),_0x185e7b['CmListId']['toString']())[_0x95e4('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x95e4('0x3c')](_0x95e4('0x76'),squel[_0x95e4('0x70')]()[_0x95e4('0x71')](_0x95e4('0x77'))[_0x95e4('0x78')](_0x95e4('0x79'))[_0x95e4('0x3c')](_0x95e4('0x7a'),_0x54e6d5[_0x95e4('0x4e')]['id'][_0x95e4('0x7b')]()))[_0x95e4('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x95e4('0x70')]()[_0x95e4('0x71')](_0x95e4('0x7c'))[_0x95e4('0x78')]('cm_hopper')['where'](_0x95e4('0x7a'),_0x54e6d5['params']['id'][_0x95e4('0x7b')]())))[_0x95e4('0x7b')]();break;case _0x95e4('0x7d'):_0x18af88=squel[_0x95e4('0x69')]()[_0x95e4('0x6a')](_0x95e4('0x6b'))[_0x95e4('0x7e')](['phone',_0x95e4('0x6d'),_0x95e4('0x6e'),_0x95e4('0x6f'),_0x95e4('0x59'),_0x95e4('0x50'),_0x95e4('0x53')],squel[_0x95e4('0x70')]()[_0x95e4('0x71')]('phone',_0x95e4('0x6c'))[_0x95e4('0x71')](_0x95e4('0x72'),'scheduledAt')[_0x95e4('0x71')]('id',_0x95e4('0x6e'))[_0x95e4('0x71')](_0x185e7b['CmListId']['toString'](),_0x95e4('0x6f'))[_0x95e4('0x71')](_0x54e6d5[_0x95e4('0x4e')]['id'][_0x95e4('0x7b')](),_0x95e4('0x59'))[_0x95e4('0x71')]('\x27'+_0x3e56b1+'\x27',_0x95e4('0x50'))[_0x95e4('0x71')]('\x27'+_0x3e56b1+'\x27',_0x95e4('0x53'))[_0x95e4('0x78')](_0x95e4('0x73'))['where'](_0x95e4('0x74'))[_0x95e4('0x3c')](_0x95e4('0x75'),_0x185e7b[_0x95e4('0x7f')][_0x95e4('0x7b')]())['where'](_0x95e4('0x80'))[_0x95e4('0x3c')](_0x95e4('0x76'),squel[_0x95e4('0x70')]()[_0x95e4('0x71')](_0x95e4('0x7c'))['from'](_0x95e4('0x6b'))[_0x95e4('0x3c')](_0x95e4('0x7a'),_0x54e6d5[_0x95e4('0x4e')]['id'][_0x95e4('0x7b')]())))[_0x95e4('0x7b')]();break;default:_0x18af88=squel[_0x95e4('0x69')]()[_0x95e4('0x6a')](_0x95e4('0x6b'))[_0x95e4('0x7e')]([_0x95e4('0x6c'),_0x95e4('0x6d'),_0x95e4('0x6e'),_0x95e4('0x6f'),_0x95e4('0x59'),'createdAt','updatedAt'],squel[_0x95e4('0x70')]()[_0x95e4('0x71')](_0x95e4('0x6c'),_0x95e4('0x6c'))['field'](_0x95e4('0x72'),_0x95e4('0x6d'))[_0x95e4('0x71')]('id',_0x95e4('0x6e'))[_0x95e4('0x71')](_0x185e7b[_0x95e4('0x7f')][_0x95e4('0x7b')](),_0x95e4('0x6f'))[_0x95e4('0x71')](_0x54e6d5[_0x95e4('0x4e')]['id'][_0x95e4('0x7b')](),_0x95e4('0x59'))[_0x95e4('0x71')]('\x27'+_0x3e56b1+'\x27',_0x95e4('0x50'))['field']('\x27'+_0x3e56b1+'\x27','updatedAt')['from'](_0x95e4('0x73'))[_0x95e4('0x3c')](_0x95e4('0x74'))[_0x95e4('0x3c')](_0x95e4('0x75'),_0x185e7b['CmListId']['toString']())[_0x95e4('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x95e4('0x7b')]();}_0x3386fa=squel[_0x95e4('0x69')]()[_0x95e4('0x6a')](_0x95e4('0x81'))['fromQuery']([_0x95e4('0x82'),_0x95e4('0x6d'),'phone','OrderBy',_0x95e4('0x50'),_0x95e4('0x53')],squel['select']()['field'](_0x95e4('0x83'),'id')[_0x95e4('0x71')]('NOW()',_0x95e4('0x6d'))[_0x95e4('0x71')]('ci.item',_0x95e4('0x6c'))[_0x95e4('0x71')](_0x95e4('0x84'),'OrderBy')[_0x95e4('0x71')]('\x27'+_0x3e56b1+'\x27','createdAt')['field']('\x27'+_0x3e56b1+'\x27','updatedAt')[_0x95e4('0x78')]('cm_contact_has_items','ci')['join']('cm_hopper','h',_0x95e4('0x85'))[_0x95e4('0x3c')]('h.ListId\x20=\x20?',_0x185e7b[_0x95e4('0x7f')][_0x95e4('0x7b')]())[_0x95e4('0x3c')]('h.CampaignId=?',_0x54e6d5[_0x95e4('0x4e')]['id']['toString']())[_0x95e4('0x3c')](_0x95e4('0x86'),_0x3e56b1))[_0x95e4('0x7b')]();_0x383d90[_0x95e4('0x87')](db['sequelize'][_0x95e4('0x32')](_0x18af88));_0x28a5aa[_0x95e4('0x87')](db[_0x95e4('0x88')]['query'](_0x3386fa));}return BPromise[_0x95e4('0x89')](_0x383d90);}})[_0x95e4('0x21')](function(){return BPromise[_0x95e4('0x89')](_0x28a5aa);})[_0x95e4('0x21')](function(){return _0x3ac9c7;})[_0x95e4('0x21')](respondWithResult(_0x36cfa3,null))[_0x95e4('0x44')](handleError(_0x36cfa3,null));};exports[_0x95e4('0x8a')]=function(_0x46089c,_0x3e2762,_0xe12c96){return db[_0x95e4('0x2c')][_0x95e4('0x46')]({'where':{'id':_0x46089c[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x3e2762,null))[_0x95e4('0x21')](function(_0x27b0df){if(_0x27b0df){return _0x27b0df[_0x95e4('0x8a')](_0x46089c[_0x95e4('0x32')][_0x95e4('0x65')]);}})[_0x95e4('0x21')](function(_0x2901d6){if(_0x2901d6){return db[_0x95e4('0x58')][_0x95e4('0x25')]({'where':{'ListId':_0x46089c[_0x95e4('0x32')][_0x95e4('0x65')],'CampaignId':_0x46089c[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](function(){return _0x2901d6;});}})[_0x95e4('0x21')](respondWithStatusCode(_0x3e2762,null))[_0x95e4('0x44')](handleError(_0x3e2762,null));};exports[_0x95e4('0x8b')]=function(_0x8adba0,_0x43af58,_0x25be13){var _0x52964d={};var _0x30b103={};var _0x581181;var _0x43b1ae;return db[_0x95e4('0x2c')][_0x95e4('0x57')]({'where':{'id':_0x8adba0[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x43af58,null))[_0x95e4('0x21')](function(_0x38859e){if(_0x38859e){_0x581181=_0x38859e;_0x30b103[_0x95e4('0x30')]=_['keys'](db[_0x95e4('0x61')][_0x95e4('0x2d')]);_0x30b103['query']=_[_0x95e4('0x31')](_0x8adba0[_0x95e4('0x32')]);_0x30b103[_0x95e4('0x33')]=_[_0x95e4('0x34')](_0x30b103['model'],_0x30b103['query']);_0x52964d[_0x95e4('0x35')]=_['intersection'](_0x30b103[_0x95e4('0x30')],qs[_0x95e4('0x36')](_0x8adba0[_0x95e4('0x32')][_0x95e4('0x36')]));_0x52964d[_0x95e4('0x35')]=_0x52964d[_0x95e4('0x35')][_0x95e4('0x37')]?_0x52964d[_0x95e4('0x35')]:_0x30b103[_0x95e4('0x30')];_0x52964d[_0x95e4('0x3a')]=qs['sort'](_0x8adba0[_0x95e4('0x32')][_0x95e4('0x3b')]);_0x52964d[_0x95e4('0x3c')]=qs[_0x95e4('0x33')](_['pick'](_0x8adba0[_0x95e4('0x32')],_0x30b103['filters']));if(_0x8adba0[_0x95e4('0x32')][_0x95e4('0x3f')]){_0x52964d[_0x95e4('0x3c')]=_[_0x95e4('0x3e')](_0x52964d['where'],{'$or':_[_0x95e4('0x2b')](_0x52964d['attributes'],function(_0x189b2d){var _0x36a61a={};_0x36a61a[_0x189b2d]={'$like':'%'+_0x8adba0[_0x95e4('0x32')][_0x95e4('0x3f')]+'%'};return _0x36a61a;})});}_0x52964d=_[_0x95e4('0x3e')]({},_0x52964d,_0x8adba0['options']);return _0x581181[_0x95e4('0x8b')](_0x52964d);}})[_0x95e4('0x21')](function(_0x2bf66c){if(_0x2bf66c){_0x43b1ae=_0x2bf66c[_0x95e4('0x37')];if(!_0x8adba0[_0x95e4('0x32')][_0x95e4('0x38')](_0x95e4('0x39'))){_0x52964d[_0x95e4('0x1a')]=qs[_0x95e4('0x1a')](_0x8adba0[_0x95e4('0x32')]['limit']);_0x52964d[_0x95e4('0x19')]=qs[_0x95e4('0x19')](_0x8adba0[_0x95e4('0x32')]['offset']);}return _0x581181['getBlackLists'](_0x52964d);}})[_0x95e4('0x21')](function(_0x3b03d5){if(_0x3b03d5){return _0x3b03d5?{'count':_0x43b1ae,'rows':_0x3b03d5}:null;}})[_0x95e4('0x21')](respondWithResult(_0x43af58,null))[_0x95e4('0x44')](handleError(_0x43af58,null));};exports[_0x95e4('0x8c')]=function(_0x364054,_0x39dbb7,_0x46432e){var _0x1efbbb,_0x57bb95;var _0x2b3ca7=[];var _0xd77dc7=moment()['format'](_0x95e4('0x64'));return db['Campaign']['find']({'where':{'id':_0x364054[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x39dbb7,null))[_0x95e4('0x21')](function(_0x5b9e4c){if(_0x5b9e4c){_0x57bb95=_0x5b9e4c;return _0x5b9e4c[_0x95e4('0x8c')](_0x364054[_0x95e4('0x51')][_0x95e4('0x65')],_['omit'](_0x364054[_0x95e4('0x51')],[_0x95e4('0x65'),'id'])||{});}return null;})['spread'](function(_0x124017){var _0xa012e6;var _0x3b8d1b;_0x1efbbb=_0x124017||[];var _0x56e251=[];if(_0x124017){for(var _0x3480fa=0x0;_0x3480fa<_0x124017[_0x95e4('0x37')];_0x3480fa+=0x1){var _0x55bc79=_0x124017[_0x3480fa][_0x95e4('0x22')]({'plain':!![]});_0xa012e6=squel[_0x95e4('0x69')]()[_0x95e4('0x6a')]('cm_hopper_black')[_0x95e4('0x7e')]([_0x95e4('0x6c'),_0x95e4('0x6e'),_0x95e4('0x6f'),_0x95e4('0x59'),_0x95e4('0x50'),_0x95e4('0x53')],squel[_0x95e4('0x70')]()['field'](_0x95e4('0x6c'),'phone')[_0x95e4('0x71')]('id',_0x95e4('0x6e'))['field'](_0x55bc79[_0x95e4('0x7f')][_0x95e4('0x7b')](),_0x95e4('0x6f'))[_0x95e4('0x71')](_0x364054['params']['id']['toString'](),_0x95e4('0x59'))['field'](_0x95e4('0x72'),'createdAt')[_0x95e4('0x71')](_0x95e4('0x72'),_0x95e4('0x53'))[_0x95e4('0x78')]('cm_contacts')[_0x95e4('0x3c')](_0x95e4('0x74'))[_0x95e4('0x3c')](_0x95e4('0x75'),_0x55bc79[_0x95e4('0x7f')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x95e4('0x7b')]();_0x56e251[_0x95e4('0x87')](db[_0x95e4('0x88')][_0x95e4('0x32')](_0xa012e6));}return BPromise[_0x95e4('0x89')](_0x56e251);}})['then'](function(){return _0x1efbbb;})[_0x95e4('0x21')](respondWithResult(_0x39dbb7,null))[_0x95e4('0x44')](handleError(_0x39dbb7,null));};exports['removeBlackLists']=function(_0x5cc249,_0x1e52eb,_0x36cd7d){return db['Campaign'][_0x95e4('0x46')]({'where':{'id':_0x5cc249[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](handleEntityNotFound(_0x1e52eb,null))[_0x95e4('0x21')](function(_0x14c168){if(_0x14c168){return _0x14c168['removeBlackLists'](_0x5cc249[_0x95e4('0x32')][_0x95e4('0x65')]);}})[_0x95e4('0x21')](function(_0x4e08c2){if(_0x4e08c2){return db[_0x95e4('0x5f')][_0x95e4('0x25')]({'where':{'ListId':_0x5cc249[_0x95e4('0x32')][_0x95e4('0x65')],'CampaignId':_0x5cc249[_0x95e4('0x4e')]['id']}})[_0x95e4('0x21')](function(){return _0x4e08c2;});}})[_0x95e4('0x21')](respondWithStatusCode(_0x1e52eb,null))['catch'](handleError(_0x1e52eb,null));}; \ No newline at end of file +var _0xa5df=['keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','createdAt','updatedAt','getHoppers','findOne','CmHopper','CampaignId','CmHopperHistory','hasOwnProperty','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','omit','dialCheckDuplicateType','into','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','ListId\x20=\x20?','cm_hopper','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','request-promise','mustache','sox','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','UserProfileResource','destroy','then','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x2f5272,_0x4cb698){var _0x30b0f9=function(_0x4e81c4){while(--_0x4e81c4){_0x2f5272['push'](_0x2f5272['shift']());}};_0x30b0f9(++_0x4cb698);}(_0xa5df,0xe8));var _0xfa5d=function(_0x16011b,_0x5cbe6c){_0x16011b=_0x16011b-0x0;var _0x3c50f8=_0xa5df[_0x16011b];return _0x3c50f8;};'use strict';var emlformat=require(_0xfa5d('0x0'));var rimraf=require(_0xfa5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa5d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa5d('0x3'));var util=require('util');var path=require('path');var sox=require(_0xfa5d('0x4'));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('squel');var crypto=require(_0xfa5d('0x5'));var jsforce=require(_0xfa5d('0x6'));var deskjs=require('desk.js');var toCsv=require(_0xfa5d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfa5d('0x8'));var authService=require(_0xfa5d('0x9'));var qs=require(_0xfa5d('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa5d('0xb'));var logger=require(_0xfa5d('0xc'))('api');var utils=require(_0xfa5d('0xd'));var config=require(_0xfa5d('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2edc6d,_0x535c04){_0x535c04=_0x535c04||0xcc;return function(_0x49b6f4){if(_0x49b6f4){return _0x2edc6d[_0xfa5d('0xf')](_0x535c04);}return _0x2edc6d[_0xfa5d('0x10')](_0x535c04)[_0xfa5d('0x11')]();};}function respondWithResult(_0x485d78,_0x5f5ca0){_0x5f5ca0=_0x5f5ca0||0xc8;return function(_0xc9d9db){if(_0xc9d9db){return _0x485d78['status'](_0x5f5ca0)[_0xfa5d('0x12')](_0xc9d9db);}};}function respondWithFilteredResult(_0x1ba120,_0x198272){return function(_0x3b4b91){if(_0x3b4b91){var _0x5eb640=typeof _0x198272[_0xfa5d('0x13')]===_0xfa5d('0x14')&&typeof _0x198272[_0xfa5d('0x15')]===_0xfa5d('0x14');var _0x5595ca=_0x3b4b91[_0xfa5d('0x16')];var _0x5d165f=_0x5eb640?0x0:_0x198272[_0xfa5d('0x13')];var _0x51f9df=_0x5eb640?_0x3b4b91[_0xfa5d('0x16')]:_0x198272[_0xfa5d('0x13')]+_0x198272[_0xfa5d('0x15')];var _0x46f32d;if(_0x51f9df>=_0x5595ca){_0x51f9df=_0x5595ca;_0x46f32d=0xc8;}else{_0x46f32d=0xce;}_0x1ba120[_0xfa5d('0x10')](_0x46f32d);return _0x1ba120[_0xfa5d('0x17')](_0xfa5d('0x18'),_0x5d165f+'-'+_0x51f9df+'/'+_0x5595ca)[_0xfa5d('0x12')](_0x3b4b91);}return null;};}function patchUpdates(_0x14ff29){return function(_0x2a95f8){try{jsonpatch[_0xfa5d('0x19')](_0x2a95f8,_0x14ff29,!![]);}catch(_0x497c0a){return BPromise['reject'](_0x497c0a);}return _0x2a95f8[_0xfa5d('0x1a')]();};}function saveUpdates(_0x534add,_0x47f21e){return function(_0x499071){if(_0x499071){return _0x499071[_0xfa5d('0x1b')](_0x534add)['then'](function(_0x1664f6){return _0x1664f6;});}return null;};}function removeEntity(_0x340b7c,_0x35dc54){return function(_0x51cba2){if(_0x51cba2){return _0x51cba2['destroy']()['then'](function(){var _0x5debcd=_0x51cba2['get']({'plain':!![]});var _0x3550a1='IvrCampaigns';return db[_0xfa5d('0x1c')][_0xfa5d('0x1d')]({'where':{'type':_0x3550a1,'resourceId':_0x5debcd['id']}})['then'](function(){return _0x51cba2;});})[_0xfa5d('0x1e')](function(){_0x340b7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x128ff4,_0x4b6d11){return function(_0x37d93e){if(!_0x37d93e){_0x128ff4['sendStatus'](0x194);}return _0x37d93e;};}function handleError(_0x57bcfe,_0x5e2345){_0x5e2345=_0x5e2345||0x1f4;return function(_0x117b11){logger[_0xfa5d('0x1f')](_0x117b11[_0xfa5d('0x20')]);if(_0x117b11[_0xfa5d('0x21')]){delete _0x117b11[_0xfa5d('0x21')];}_0x57bcfe[_0xfa5d('0x10')](_0x5e2345)[_0xfa5d('0x22')](_0x117b11);};}exports[_0xfa5d('0x23')]=function(_0x5919b6,_0x20289f){var _0x474c78={},_0x5cce05={},_0x598cbc={'count':0x0,'rows':[]};var _0x2c783f=_['map'](db[_0xfa5d('0x24')][_0xfa5d('0x25')],function(_0x8bffb1){return{'name':_0x8bffb1[_0xfa5d('0x26')],'type':_0x8bffb1[_0xfa5d('0x27')][_0xfa5d('0x28')]};});_0x5cce05[_0xfa5d('0x29')]=_[_0xfa5d('0x2a')](_0x2c783f,_0xfa5d('0x21'));_0x5cce05[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0x5919b6[_0xfa5d('0x2b')]);_0x5cce05['filters']=_[_0xfa5d('0x2d')](_0x5cce05[_0xfa5d('0x29')],_0x5cce05[_0xfa5d('0x2b')]);_0x474c78[_0xfa5d('0x2e')]=_[_0xfa5d('0x2d')](_0x5cce05[_0xfa5d('0x29')],qs[_0xfa5d('0x2f')](_0x5919b6[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0x474c78[_0xfa5d('0x2e')]=_0x474c78[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0x474c78[_0xfa5d('0x2e')]:_0x5cce05[_0xfa5d('0x29')];if(!_0x5919b6[_0xfa5d('0x2b')]['hasOwnProperty'](_0xfa5d('0x31'))){_0x474c78[_0xfa5d('0x15')]=qs['limit'](_0x5919b6[_0xfa5d('0x2b')]['limit']);_0x474c78[_0xfa5d('0x13')]=qs[_0xfa5d('0x13')](_0x5919b6['query'][_0xfa5d('0x13')]);}_0x474c78[_0xfa5d('0x32')]=qs[_0xfa5d('0x33')](_0x5919b6[_0xfa5d('0x2b')]['sort']);_0x474c78[_0xfa5d('0x34')]=qs[_0xfa5d('0x35')](_[_0xfa5d('0x36')](_0x5919b6['query'],_0x5cce05['filters']),_0x2c783f);if(_0x5919b6[_0xfa5d('0x2b')][_0xfa5d('0x37')]){_0x474c78['where']=_[_0xfa5d('0x38')](_0x474c78['where'],{'$or':_['map'](_0x2c783f,function(_0x211b34){if(_0x211b34['type']!==_0xfa5d('0x39')){var _0x16e99f={};_0x16e99f[_0x211b34['name']]={'$like':'%'+_0x5919b6[_0xfa5d('0x2b')][_0xfa5d('0x37')]+'%'};return _0x16e99f;}})});}_0x474c78=_[_0xfa5d('0x38')]({},_0x474c78,_0x5919b6[_0xfa5d('0x3a')]);var _0x31868d={'where':_0x474c78['where']};return db[_0xfa5d('0x24')][_0xfa5d('0x16')](_0x31868d)[_0xfa5d('0x1e')](function(_0x1970fc){_0x598cbc[_0xfa5d('0x16')]=_0x1970fc;if(_0x5919b6[_0xfa5d('0x2b')]['includeAll']){_0x474c78[_0xfa5d('0x3b')]=[{'all':!![]}];}return db[_0xfa5d('0x24')]['findAll'](_0x474c78);})['then'](function(_0x18bea6){_0x598cbc[_0xfa5d('0x3c')]=_0x18bea6;return _0x598cbc;})[_0xfa5d('0x1e')](respondWithFilteredResult(_0x20289f,_0x474c78))[_0xfa5d('0x3d')](handleError(_0x20289f,null));};exports[_0xfa5d('0x3e')]=function(_0xf817bd,_0x18c42c){var _0xfc8bc9={'raw':![],'where':{'id':_0xf817bd[_0xfa5d('0x3f')]['id']}},_0x53c37a={};_0x53c37a['model']=_[_0xfa5d('0x2c')](db[_0xfa5d('0x24')][_0xfa5d('0x25')]);_0x53c37a[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0xf817bd[_0xfa5d('0x2b')]);_0x53c37a[_0xfa5d('0x35')]=_[_0xfa5d('0x2d')](_0x53c37a[_0xfa5d('0x29')],_0x53c37a[_0xfa5d('0x2b')]);_0xfc8bc9['attributes']=_[_0xfa5d('0x2d')](_0x53c37a[_0xfa5d('0x29')],qs['fields'](_0xf817bd[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0xfc8bc9[_0xfa5d('0x2e')]=_0xfc8bc9[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0xfc8bc9[_0xfa5d('0x2e')]:_0x53c37a['model'];if(_0xf817bd[_0xfa5d('0x2b')][_0xfa5d('0x40')]){_0xfc8bc9[_0xfa5d('0x3b')]=[{'all':!![]}];}_0xfc8bc9=_[_0xfa5d('0x38')]({},_0xfc8bc9,_0xf817bd[_0xfa5d('0x3a')]);return db[_0xfa5d('0x24')]['find'](_0xfc8bc9)[_0xfa5d('0x1e')](handleEntityNotFound(_0x18c42c,null))[_0xfa5d('0x1e')](respondWithResult(_0x18c42c,null))[_0xfa5d('0x3d')](handleError(_0x18c42c,null));};exports['create']=function(_0x50c5f3,_0x156c1e){return db[_0xfa5d('0x24')][_0xfa5d('0x41')](_0x50c5f3[_0xfa5d('0x42')],{})[_0xfa5d('0x1e')](function(_0x17b540){var _0x153bcf=_0x50c5f3['user'][_0xfa5d('0x43')]({'plain':!![]});if(!_0x153bcf)throw new Error(_0xfa5d('0x44'));if(_0x153bcf[_0xfa5d('0x45')]===_0xfa5d('0x46')){var _0x2fe279=_0x17b540[_0xfa5d('0x43')]({'plain':!![]});var _0x3f5e91='IvrCampaigns';return db[_0xfa5d('0x47')]['find']({'where':{'name':_0x3f5e91,'userProfileId':_0x153bcf[_0xfa5d('0x48')]},'raw':!![]})[_0xfa5d('0x1e')](function(_0x118963){if(_0x118963&&_0x118963[_0xfa5d('0x49')]===0x0){return db[_0xfa5d('0x1c')][_0xfa5d('0x41')]({'name':_0x2fe279[_0xfa5d('0x21')],'resourceId':_0x2fe279['id'],'type':_0x118963[_0xfa5d('0x21')],'sectionId':_0x118963['id']},{})[_0xfa5d('0x1e')](function(){return _0x17b540;});}else{return _0x17b540;}})[_0xfa5d('0x3d')](function(_0x556001){logger[_0xfa5d('0x1f')](_0xfa5d('0x4a'),_0x556001);throw _0x556001;});}return _0x17b540;})[_0xfa5d('0x1e')](respondWithResult(_0x156c1e,0xc9))[_0xfa5d('0x3d')](handleError(_0x156c1e,null));};exports[_0xfa5d('0x4b')]=function(_0x1a90f1,_0x5ae786){var _0x112bd3={'where':{'id':_0x1a90f1[_0xfa5d('0x3f')]['id']}},_0x423a86={};_0x423a86[_0xfa5d('0x29')]=_[_0xfa5d('0x2c')](db['Campaign']['rawAttributes']);_0x112bd3['attributes']=_[_0xfa5d('0x2d')](_0x423a86[_0xfa5d('0x29')],qs[_0xfa5d('0x2f')](_0x1a90f1[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0x112bd3[_0xfa5d('0x2e')]=_0x112bd3[_0xfa5d('0x2e')]['length']?_0x112bd3[_0xfa5d('0x2e')]:_0x423a86[_0xfa5d('0x29')];if(_0x1a90f1[_0xfa5d('0x2b')][_0xfa5d('0x40')]){_0x112bd3[_0xfa5d('0x3b')]=[{'all':!![]}];}_0x112bd3=_[_0xfa5d('0x38')]({},_0x112bd3,_0x1a90f1[_0xfa5d('0x3a')]);return db['Campaign'][_0xfa5d('0x4c')](_0x112bd3)[_0xfa5d('0x1e')](handleEntityNotFound(_0x5ae786,null))[_0xfa5d('0x1e')](function(_0x33fdcd){if(_0x33fdcd){var _0x5bb4fa=_0x33fdcd[_0xfa5d('0x43')]({'plain':!![]});_0x5bb4fa=qs['omit'](_0x5bb4fa,['id',_0xfa5d('0x4d'),'updatedAt']);_0x1a90f1[_0xfa5d('0x42')]=_['omit'](_0x1a90f1[_0xfa5d('0x42')],['id',_0xfa5d('0x4d'),_0xfa5d('0x4e')]);return db[_0xfa5d('0x24')]['create'](_[_0xfa5d('0x38')](_0x5bb4fa,_0x1a90f1[_0xfa5d('0x42')]),{'include':_0x1a90f1[_0xfa5d('0x2b')][_0xfa5d('0x40')]?[{'all':!![]}]:undefined})[_0xfa5d('0x1e')](function(_0x1abfb7){var _0x57549f=_0x1a90f1[_0xfa5d('0x46')][_0xfa5d('0x43')]({'plain':!![]});if(!_0x57549f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57549f[_0xfa5d('0x45')]===_0xfa5d('0x46')){var _0x27a586=_0x1abfb7[_0xfa5d('0x43')]({'plain':!![]});var _0xb4eff7='IvrCampaigns';return db[_0xfa5d('0x47')][_0xfa5d('0x4c')]({'where':{'name':_0xb4eff7,'userProfileId':_0x57549f[_0xfa5d('0x48')]},'raw':!![]})[_0xfa5d('0x1e')](function(_0x4c4c25){if(_0x4c4c25&&_0x4c4c25['autoAssociation']===0x0){return db['UserProfileResource'][_0xfa5d('0x41')]({'name':_0x27a586[_0xfa5d('0x21')],'resourceId':_0x27a586['id'],'type':_0x4c4c25['name'],'sectionId':_0x4c4c25['id']},{})['then'](function(){return _0x1abfb7;});}else{return _0x1abfb7;}})[_0xfa5d('0x3d')](function(_0x385964){logger[_0xfa5d('0x1f')](_0xfa5d('0x4a'),_0x385964);throw _0x385964;});}return _0x1abfb7;});}})[_0xfa5d('0x1e')](respondWithResult(_0x5ae786,0xc9))[_0xfa5d('0x3d')](handleError(_0x5ae786,null));};exports[_0xfa5d('0x1b')]=function(_0x874e4d,_0x17f978){if(_0x874e4d[_0xfa5d('0x42')]['id']){delete _0x874e4d['body']['id'];}return db[_0xfa5d('0x24')]['find']({'where':{'id':_0x874e4d[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x17f978,null))[_0xfa5d('0x1e')](saveUpdates(_0x874e4d[_0xfa5d('0x42')],null))[_0xfa5d('0x1e')](respondWithResult(_0x17f978,null))[_0xfa5d('0x3d')](handleError(_0x17f978,null));};exports[_0xfa5d('0x1d')]=function(_0x2c165,_0x1e61a8){return db['Campaign'][_0xfa5d('0x4c')]({'where':{'id':_0x2c165[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x1e61a8,null))['then'](removeEntity(_0x1e61a8,null))[_0xfa5d('0x3d')](handleError(_0x1e61a8,null));};exports[_0xfa5d('0x4f')]=function(_0x2b7a77,_0x9b533e,_0x1d02ee){var _0x423832={'raw':!![],'where':{}};var _0x1a7150={};var _0x233a37={'count':0x0,'rows':[]};return db[_0xfa5d('0x24')][_0xfa5d('0x50')]({'where':{'id':_0x2b7a77[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x9b533e,null))['then'](function(_0x5e66b7){if(_0x5e66b7){_0x1a7150[_0xfa5d('0x29')]=_[_0xfa5d('0x2c')](db[_0xfa5d('0x51')]['rawAttributes']);_0x1a7150[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0x2b7a77[_0xfa5d('0x2b')]);_0x1a7150[_0xfa5d('0x35')]=_[_0xfa5d('0x2d')](_0x1a7150[_0xfa5d('0x29')],_0x1a7150['query']);_0x423832[_0xfa5d('0x2e')]=_[_0xfa5d('0x2d')](_0x1a7150[_0xfa5d('0x29')],qs[_0xfa5d('0x2f')](_0x2b7a77[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0x423832[_0xfa5d('0x2e')]=_0x423832[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0x423832['attributes']:_0x1a7150[_0xfa5d('0x29')];if(!_0x2b7a77['query']['hasOwnProperty']('nolimit')){_0x423832[_0xfa5d('0x15')]=qs[_0xfa5d('0x15')](_0x2b7a77['query']['limit']);_0x423832[_0xfa5d('0x13')]=qs[_0xfa5d('0x13')](_0x2b7a77['query'][_0xfa5d('0x13')]);}_0x423832['order']=qs[_0xfa5d('0x33')](_0x2b7a77[_0xfa5d('0x2b')][_0xfa5d('0x33')]);_0x423832[_0xfa5d('0x34')]=qs[_0xfa5d('0x35')](_['pick'](_0x2b7a77[_0xfa5d('0x2b')],_0x1a7150['filters']));_0x423832[_0xfa5d('0x34')][_0xfa5d('0x52')]=_0x5e66b7['id'];if(_0x2b7a77[_0xfa5d('0x2b')][_0xfa5d('0x37')]){_0x423832[_0xfa5d('0x34')]=_['merge'](_0x423832[_0xfa5d('0x34')],{'$or':_[_0xfa5d('0x2a')](_0x423832[_0xfa5d('0x2e')],function(_0x26e397){var _0x3deaeb={};_0x3deaeb[_0x26e397]={'$like':'%'+_0x2b7a77['query'][_0xfa5d('0x37')]+'%'};return _0x3deaeb;})});}_0x423832=_[_0xfa5d('0x38')]({},_0x423832,_0x2b7a77['options']);return db[_0xfa5d('0x51')]['count']({'where':_0x423832[_0xfa5d('0x34')]})[_0xfa5d('0x1e')](function(_0x3ce1bf){_0x233a37[_0xfa5d('0x16')]=_0x3ce1bf;if(_0x2b7a77[_0xfa5d('0x2b')][_0xfa5d('0x40')]){_0x423832['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x423832);})[_0xfa5d('0x1e')](function(_0x2d0a72){_0x233a37[_0xfa5d('0x3c')]=_0x2d0a72;return _0x233a37;});}})['then'](respondWithFilteredResult(_0x9b533e,_0x423832))[_0xfa5d('0x3d')](handleError(_0x9b533e,null));};exports['getHopperHistories']=function(_0x329fb1,_0x54e19d,_0x2405b3){var _0x12feca={'raw':!![],'where':{}};var _0x57755b={};var _0x1a4095={'count':0x0,'rows':[]};return db[_0xfa5d('0x24')][_0xfa5d('0x50')]({'where':{'id':_0x329fb1[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x54e19d,null))[_0xfa5d('0x1e')](function(_0x1c35d9){if(_0x1c35d9){_0x57755b[_0xfa5d('0x29')]=_[_0xfa5d('0x2c')](db[_0xfa5d('0x53')][_0xfa5d('0x25')]);_0x57755b[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0x329fb1[_0xfa5d('0x2b')]);_0x57755b[_0xfa5d('0x35')]=_[_0xfa5d('0x2d')](_0x57755b[_0xfa5d('0x29')],_0x57755b['query']);_0x12feca['attributes']=_[_0xfa5d('0x2d')](_0x57755b[_0xfa5d('0x29')],qs[_0xfa5d('0x2f')](_0x329fb1[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0x12feca[_0xfa5d('0x2e')]=_0x12feca['attributes'][_0xfa5d('0x30')]?_0x12feca[_0xfa5d('0x2e')]:_0x57755b['model'];if(!_0x329fb1['query'][_0xfa5d('0x54')](_0xfa5d('0x31'))){_0x12feca[_0xfa5d('0x15')]=qs[_0xfa5d('0x15')](_0x329fb1[_0xfa5d('0x2b')][_0xfa5d('0x15')]);_0x12feca[_0xfa5d('0x13')]=qs[_0xfa5d('0x13')](_0x329fb1[_0xfa5d('0x2b')][_0xfa5d('0x13')]);}_0x12feca[_0xfa5d('0x32')]=qs['sort'](_0x329fb1[_0xfa5d('0x2b')][_0xfa5d('0x33')]);_0x12feca['where']=qs[_0xfa5d('0x35')](_[_0xfa5d('0x36')](_0x329fb1[_0xfa5d('0x2b')],_0x57755b[_0xfa5d('0x35')]));_0x12feca[_0xfa5d('0x34')][_0xfa5d('0x52')]=_0x1c35d9['id'];if(_0x329fb1['query'][_0xfa5d('0x37')]){_0x12feca['where']=_[_0xfa5d('0x38')](_0x12feca['where'],{'$or':_[_0xfa5d('0x2a')](_0x12feca[_0xfa5d('0x2e')],function(_0x37ff1e){var _0x2dda91={};_0x2dda91[_0x37ff1e]={'$like':'%'+_0x329fb1[_0xfa5d('0x2b')]['filter']+'%'};return _0x2dda91;})});}_0x12feca=_['merge']({},_0x12feca,_0x329fb1['options']);return db[_0xfa5d('0x53')][_0xfa5d('0x16')]({'where':_0x12feca[_0xfa5d('0x34')]})[_0xfa5d('0x1e')](function(_0xa85059){_0x1a4095['count']=_0xa85059;if(_0x329fb1[_0xfa5d('0x2b')][_0xfa5d('0x40')]){_0x12feca[_0xfa5d('0x3b')]=[{'all':!![]}];}return db[_0xfa5d('0x53')][_0xfa5d('0x55')](_0x12feca);})[_0xfa5d('0x1e')](function(_0x8fd596){_0x1a4095[_0xfa5d('0x3c')]=_0x8fd596;return _0x1a4095;});}})[_0xfa5d('0x1e')](respondWithFilteredResult(_0x54e19d,_0x12feca))[_0xfa5d('0x3d')](handleError(_0x54e19d,null));};exports[_0xfa5d('0x56')]=function(_0x21d158,_0x33b048,_0x46cc1d){var _0x5c453a={'raw':!![],'where':{}};var _0x4189f2={};var _0x50b935={'count':0x0,'rows':[]};return db[_0xfa5d('0x24')][_0xfa5d('0x50')]({'where':{'id':_0x21d158[_0xfa5d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x33b048,null))[_0xfa5d('0x1e')](function(_0x1a374c){if(_0x1a374c){_0x4189f2[_0xfa5d('0x29')]=_[_0xfa5d('0x2c')](db[_0xfa5d('0x57')]['rawAttributes']);_0x4189f2[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0x21d158['query']);_0x4189f2['filters']=_['intersection'](_0x4189f2[_0xfa5d('0x29')],_0x4189f2[_0xfa5d('0x2b')]);_0x5c453a[_0xfa5d('0x2e')]=_[_0xfa5d('0x2d')](_0x4189f2[_0xfa5d('0x29')],qs[_0xfa5d('0x2f')](_0x21d158['query'][_0xfa5d('0x2f')]));_0x5c453a[_0xfa5d('0x2e')]=_0x5c453a[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0x5c453a['attributes']:_0x4189f2[_0xfa5d('0x29')];if(!_0x21d158[_0xfa5d('0x2b')]['hasOwnProperty'](_0xfa5d('0x31'))){_0x5c453a[_0xfa5d('0x15')]=qs[_0xfa5d('0x15')](_0x21d158[_0xfa5d('0x2b')][_0xfa5d('0x15')]);_0x5c453a['offset']=qs['offset'](_0x21d158['query'][_0xfa5d('0x13')]);}_0x5c453a[_0xfa5d('0x32')]=qs['sort'](_0x21d158[_0xfa5d('0x2b')][_0xfa5d('0x33')]);_0x5c453a[_0xfa5d('0x34')]=qs[_0xfa5d('0x35')](_[_0xfa5d('0x36')](_0x21d158[_0xfa5d('0x2b')],_0x4189f2[_0xfa5d('0x35')]));_0x5c453a['where'][_0xfa5d('0x52')]=_0x1a374c['id'];if(_0x21d158[_0xfa5d('0x2b')][_0xfa5d('0x37')]){_0x5c453a[_0xfa5d('0x34')]=_[_0xfa5d('0x38')](_0x5c453a[_0xfa5d('0x34')],{'$or':_[_0xfa5d('0x2a')](_0x5c453a['attributes'],function(_0xc5c56){var _0x19dd21={};_0x19dd21[_0xc5c56]={'$like':'%'+_0x21d158[_0xfa5d('0x2b')][_0xfa5d('0x37')]+'%'};return _0x19dd21;})});}_0x5c453a=_['merge']({},_0x5c453a,_0x21d158[_0xfa5d('0x3a')]);return db[_0xfa5d('0x57')][_0xfa5d('0x16')]({'where':_0x5c453a[_0xfa5d('0x34')]})[_0xfa5d('0x1e')](function(_0x394509){_0x50b935[_0xfa5d('0x16')]=_0x394509;if(_0x21d158[_0xfa5d('0x2b')][_0xfa5d('0x40')]){_0x5c453a['include']=[{'all':!![]}];}return db[_0xfa5d('0x57')][_0xfa5d('0x55')](_0x5c453a);})['then'](function(_0x9b8d32){_0x50b935[_0xfa5d('0x3c')]=_0x9b8d32;return _0x50b935;});}})['then'](respondWithFilteredResult(_0x33b048,_0x5c453a))[_0xfa5d('0x3d')](handleError(_0x33b048,null));};exports['getHopperBlacks']=function(_0x20aeb4,_0x176001,_0x2705e0){var _0x10ce7d={'raw':!![],'where':{}};var _0x39cd9f={};var _0x8bb023={'count':0x0,'rows':[]};return db[_0xfa5d('0x24')]['findOne']({'where':{'id':_0x20aeb4[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x176001,null))[_0xfa5d('0x1e')](function(_0x398c84){if(_0x398c84){_0x39cd9f[_0xfa5d('0x29')]=_['keys'](db[_0xfa5d('0x58')][_0xfa5d('0x25')]);_0x39cd9f[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0x20aeb4[_0xfa5d('0x2b')]);_0x39cd9f[_0xfa5d('0x35')]=_[_0xfa5d('0x2d')](_0x39cd9f[_0xfa5d('0x29')],_0x39cd9f[_0xfa5d('0x2b')]);_0x10ce7d[_0xfa5d('0x2e')]=_['intersection'](_0x39cd9f['model'],qs['fields'](_0x20aeb4[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0x10ce7d[_0xfa5d('0x2e')]=_0x10ce7d[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0x10ce7d['attributes']:_0x39cd9f['model'];if(!_0x20aeb4[_0xfa5d('0x2b')][_0xfa5d('0x54')]('nolimit')){_0x10ce7d[_0xfa5d('0x15')]=qs[_0xfa5d('0x15')](_0x20aeb4[_0xfa5d('0x2b')][_0xfa5d('0x15')]);_0x10ce7d['offset']=qs[_0xfa5d('0x13')](_0x20aeb4[_0xfa5d('0x2b')][_0xfa5d('0x13')]);}_0x10ce7d[_0xfa5d('0x32')]=qs[_0xfa5d('0x33')](_0x20aeb4[_0xfa5d('0x2b')][_0xfa5d('0x33')]);_0x10ce7d['where']=qs[_0xfa5d('0x35')](_['pick'](_0x20aeb4[_0xfa5d('0x2b')],_0x39cd9f[_0xfa5d('0x35')]));_0x10ce7d[_0xfa5d('0x34')][_0xfa5d('0x52')]=_0x398c84['id'];if(_0x20aeb4[_0xfa5d('0x2b')][_0xfa5d('0x37')]){_0x10ce7d[_0xfa5d('0x34')]=_[_0xfa5d('0x38')](_0x10ce7d[_0xfa5d('0x34')],{'$or':_[_0xfa5d('0x2a')](_0x10ce7d[_0xfa5d('0x2e')],function(_0x24daa4){var _0x3c03b3={};_0x3c03b3[_0x24daa4]={'$like':'%'+_0x20aeb4[_0xfa5d('0x2b')]['filter']+'%'};return _0x3c03b3;})});}_0x10ce7d=_[_0xfa5d('0x38')]({},_0x10ce7d,_0x20aeb4['options']);return db[_0xfa5d('0x58')]['count']({'where':_0x10ce7d['where']})[_0xfa5d('0x1e')](function(_0x23a404){_0x8bb023['count']=_0x23a404;if(_0x20aeb4['query'][_0xfa5d('0x40')]){_0x10ce7d[_0xfa5d('0x3b')]=[{'all':!![]}];}return db[_0xfa5d('0x58')][_0xfa5d('0x55')](_0x10ce7d);})[_0xfa5d('0x1e')](function(_0x232606){_0x8bb023['rows']=_0x232606;return _0x8bb023;});}})[_0xfa5d('0x1e')](respondWithFilteredResult(_0x176001,_0x10ce7d))['catch'](handleError(_0x176001,null));};exports[_0xfa5d('0x59')]=function(_0x2e3c25,_0x240e7c,_0x434db1){var _0x1d0b99={};var _0x147ec1={};var _0xef642;var _0x4dc25b;return db[_0xfa5d('0x24')][_0xfa5d('0x50')]({'where':{'id':_0x2e3c25['params']['id']}})['then'](handleEntityNotFound(_0x240e7c,null))[_0xfa5d('0x1e')](function(_0x5c147f){if(_0x5c147f){_0xef642=_0x5c147f;_0x147ec1['model']=_[_0xfa5d('0x2c')](db[_0xfa5d('0x5a')][_0xfa5d('0x25')]);_0x147ec1[_0xfa5d('0x2b')]=_['keys'](_0x2e3c25[_0xfa5d('0x2b')]);_0x147ec1[_0xfa5d('0x35')]=_['intersection'](_0x147ec1[_0xfa5d('0x29')],_0x147ec1[_0xfa5d('0x2b')]);_0x1d0b99[_0xfa5d('0x2e')]=_[_0xfa5d('0x2d')](_0x147ec1[_0xfa5d('0x29')],qs[_0xfa5d('0x2f')](_0x2e3c25[_0xfa5d('0x2b')]['fields']));_0x1d0b99[_0xfa5d('0x2e')]=_0x1d0b99[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0x1d0b99[_0xfa5d('0x2e')]:_0x147ec1[_0xfa5d('0x29')];_0x1d0b99[_0xfa5d('0x32')]=qs[_0xfa5d('0x33')](_0x2e3c25[_0xfa5d('0x2b')][_0xfa5d('0x33')]);_0x1d0b99[_0xfa5d('0x34')]=qs['filters'](_[_0xfa5d('0x36')](_0x2e3c25['query'],_0x147ec1[_0xfa5d('0x35')]));if(_0x2e3c25['query'][_0xfa5d('0x37')]){_0x1d0b99[_0xfa5d('0x34')]=_['merge'](_0x1d0b99[_0xfa5d('0x34')],{'$or':_[_0xfa5d('0x2a')](_0x1d0b99[_0xfa5d('0x2e')],function(_0x2a4242){var _0x3c3f25={};_0x3c3f25[_0x2a4242]={'$like':'%'+_0x2e3c25[_0xfa5d('0x2b')][_0xfa5d('0x37')]+'%'};return _0x3c3f25;})});}_0x1d0b99=_['merge']({},_0x1d0b99,_0x2e3c25[_0xfa5d('0x3a')]);return _0xef642[_0xfa5d('0x59')](_0x1d0b99);}})[_0xfa5d('0x1e')](function(_0x37e184){if(_0x37e184){_0x4dc25b=_0x37e184[_0xfa5d('0x30')];if(!_0x2e3c25[_0xfa5d('0x2b')][_0xfa5d('0x54')](_0xfa5d('0x31'))){_0x1d0b99[_0xfa5d('0x15')]=qs[_0xfa5d('0x15')](_0x2e3c25[_0xfa5d('0x2b')][_0xfa5d('0x15')]);_0x1d0b99[_0xfa5d('0x13')]=qs[_0xfa5d('0x13')](_0x2e3c25[_0xfa5d('0x2b')][_0xfa5d('0x13')]);}return _0xef642[_0xfa5d('0x59')](_0x1d0b99);}})['then'](function(_0x393f68){if(_0x393f68){return _0x393f68?{'count':_0x4dc25b,'rows':_0x393f68}:null;}})[_0xfa5d('0x1e')](respondWithResult(_0x240e7c,null))[_0xfa5d('0x3d')](handleError(_0x240e7c,null));};exports[_0xfa5d('0x5b')]=function(_0x492987,_0x10a906,_0x332249){var _0x1c657d,_0x4b6945;var _0x3d76b2=[];var _0x146c83=moment()[_0xfa5d('0x5c')](_0xfa5d('0x5d'));return db['Campaign']['find']({'where':{'id':_0x492987[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x10a906,null))['then'](function(_0x2b7765){if(_0x2b7765){_0x4b6945=_0x2b7765;return _0x2b7765[_0xfa5d('0x5b')](_0x492987['body'][_0xfa5d('0x5e')],_[_0xfa5d('0x5f')](_0x492987[_0xfa5d('0x42')],[_0xfa5d('0x5e'),'id'])||{});}return null;})['spread'](function(_0xf2328e){var _0x50f4fd;var _0x422a68;_0x1c657d=_0xf2328e||[];var _0x5aed15=[];if(_0xf2328e){for(var _0x333b41=0x0;_0x333b41<_0xf2328e[_0xfa5d('0x30')];_0x333b41+=0x1){var _0x303cd8=_0xf2328e[_0x333b41][_0xfa5d('0x43')]({'plain':!![]});_0x4b6945['dialCheckDuplicateType']=_0x492987['body'][_0xfa5d('0x60')]?_0x492987[_0xfa5d('0x42')][_0xfa5d('0x60')]:_0x4b6945[_0xfa5d('0x60')];switch(_0x4b6945[_0xfa5d('0x60')]){case'always':_0x50f4fd=squel['insert']()[_0xfa5d('0x61')]('cm_hopper')['fromQuery']([_0xfa5d('0x62'),_0xfa5d('0x63'),'ContactId',_0xfa5d('0x64'),'CampaignId','createdAt','updatedAt'],squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')]('phone',_0xfa5d('0x62'))['field'](_0xfa5d('0x67'),'scheduledAt')[_0xfa5d('0x66')]('id',_0xfa5d('0x68'))[_0xfa5d('0x66')](_0x303cd8[_0xfa5d('0x69')][_0xfa5d('0x6a')](),_0xfa5d('0x64'))['field'](_0x492987[_0xfa5d('0x3f')]['id'][_0xfa5d('0x6a')](),_0xfa5d('0x52'))[_0xfa5d('0x66')]('\x27'+_0x146c83+'\x27',_0xfa5d('0x4d'))['field']('\x27'+_0x146c83+'\x27',_0xfa5d('0x4e'))[_0xfa5d('0x6b')](_0xfa5d('0x6c'))[_0xfa5d('0x34')](_0xfa5d('0x6d'))[_0xfa5d('0x34')]('ListId\x20=\x20?',_0x303cd8[_0xfa5d('0x69')][_0xfa5d('0x6a')]())[_0xfa5d('0x34')](_0xfa5d('0x6e'))[_0xfa5d('0x34')](_0xfa5d('0x6f'),squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')](_0xfa5d('0x70'))[_0xfa5d('0x6b')](_0xfa5d('0x71'))[_0xfa5d('0x34')](_0xfa5d('0x72'),_0x492987['params']['id'][_0xfa5d('0x6a')]()))[_0xfa5d('0x34')](_0xfa5d('0x6f'),squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')](_0xfa5d('0x73'))[_0xfa5d('0x6b')]('cm_hopper')[_0xfa5d('0x34')](_0xfa5d('0x72'),_0x492987['params']['id'][_0xfa5d('0x6a')]())))[_0xfa5d('0x6a')]();break;case _0xfa5d('0x74'):_0x50f4fd=squel[_0xfa5d('0x75')]()[_0xfa5d('0x61')]('cm_hopper')[_0xfa5d('0x76')]([_0xfa5d('0x62'),_0xfa5d('0x63'),_0xfa5d('0x68'),_0xfa5d('0x64'),_0xfa5d('0x52'),_0xfa5d('0x4d'),_0xfa5d('0x4e')],squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')](_0xfa5d('0x62'),_0xfa5d('0x62'))[_0xfa5d('0x66')](_0xfa5d('0x67'),_0xfa5d('0x63'))[_0xfa5d('0x66')]('id','ContactId')['field'](_0x303cd8[_0xfa5d('0x69')][_0xfa5d('0x6a')](),'ListId')[_0xfa5d('0x66')](_0x492987[_0xfa5d('0x3f')]['id'][_0xfa5d('0x6a')](),_0xfa5d('0x52'))['field']('\x27'+_0x146c83+'\x27',_0xfa5d('0x4d'))['field']('\x27'+_0x146c83+'\x27','updatedAt')[_0xfa5d('0x6b')]('cm_contacts')[_0xfa5d('0x34')](_0xfa5d('0x6d'))[_0xfa5d('0x34')](_0xfa5d('0x77'),_0x303cd8[_0xfa5d('0x69')][_0xfa5d('0x6a')]())[_0xfa5d('0x34')](_0xfa5d('0x6e'))[_0xfa5d('0x34')](_0xfa5d('0x6f'),squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')](_0xfa5d('0x73'))[_0xfa5d('0x6b')]('cm_hopper')['where'](_0xfa5d('0x72'),_0x492987['params']['id'][_0xfa5d('0x6a')]())))[_0xfa5d('0x6a')]();break;default:_0x50f4fd=squel['insert']()[_0xfa5d('0x61')](_0xfa5d('0x78'))[_0xfa5d('0x76')](['phone',_0xfa5d('0x63'),'ContactId',_0xfa5d('0x64'),'CampaignId',_0xfa5d('0x4d'),_0xfa5d('0x4e')],squel[_0xfa5d('0x65')]()['field'](_0xfa5d('0x62'),_0xfa5d('0x62'))[_0xfa5d('0x66')](_0xfa5d('0x67'),_0xfa5d('0x63'))[_0xfa5d('0x66')]('id',_0xfa5d('0x68'))[_0xfa5d('0x66')](_0x303cd8[_0xfa5d('0x69')][_0xfa5d('0x6a')](),_0xfa5d('0x64'))[_0xfa5d('0x66')](_0x492987[_0xfa5d('0x3f')]['id']['toString'](),_0xfa5d('0x52'))[_0xfa5d('0x66')]('\x27'+_0x146c83+'\x27',_0xfa5d('0x4d'))[_0xfa5d('0x66')]('\x27'+_0x146c83+'\x27','updatedAt')[_0xfa5d('0x6b')](_0xfa5d('0x6c'))[_0xfa5d('0x34')](_0xfa5d('0x6d'))['where'](_0xfa5d('0x77'),_0x303cd8['CmListId']['toString']())['where'](_0xfa5d('0x6e')))[_0xfa5d('0x6a')]();}_0x422a68=squel[_0xfa5d('0x75')]()[_0xfa5d('0x61')](_0xfa5d('0x79'))['fromQuery']([_0xfa5d('0x7a'),_0xfa5d('0x63'),_0xfa5d('0x62'),_0xfa5d('0x7b'),_0xfa5d('0x4d'),'updatedAt'],squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')](_0xfa5d('0x7c'),'id')[_0xfa5d('0x66')](_0xfa5d('0x67'),_0xfa5d('0x63'))['field']('ci.item',_0xfa5d('0x62'))[_0xfa5d('0x66')](_0xfa5d('0x7d'),_0xfa5d('0x7b'))[_0xfa5d('0x66')]('\x27'+_0x146c83+'\x27',_0xfa5d('0x4d'))[_0xfa5d('0x66')]('\x27'+_0x146c83+'\x27','updatedAt')[_0xfa5d('0x6b')](_0xfa5d('0x7e'),'ci')[_0xfa5d('0x7f')](_0xfa5d('0x78'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0xfa5d('0x80'),_0x303cd8[_0xfa5d('0x69')][_0xfa5d('0x6a')]())['where']('h.CampaignId=?',_0x492987[_0xfa5d('0x3f')]['id']['toString']())[_0xfa5d('0x34')](_0xfa5d('0x81'),_0x146c83))[_0xfa5d('0x6a')]();_0x5aed15[_0xfa5d('0x82')](db[_0xfa5d('0x83')][_0xfa5d('0x2b')](_0x50f4fd));_0x3d76b2[_0xfa5d('0x82')](db['sequelize'][_0xfa5d('0x2b')](_0x422a68));}return BPromise[_0xfa5d('0x84')](_0x5aed15);}})[_0xfa5d('0x1e')](function(){return BPromise[_0xfa5d('0x84')](_0x3d76b2);})[_0xfa5d('0x1e')](function(){return _0x1c657d;})[_0xfa5d('0x1e')](respondWithResult(_0x10a906,null))[_0xfa5d('0x3d')](handleError(_0x10a906,null));};exports[_0xfa5d('0x85')]=function(_0x4d0176,_0x312120,_0x5b9982){return db[_0xfa5d('0x24')]['find']({'where':{'id':_0x4d0176[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x312120,null))[_0xfa5d('0x1e')](function(_0x2daa22){if(_0x2daa22){return _0x2daa22[_0xfa5d('0x85')](_0x4d0176[_0xfa5d('0x2b')]['ids']);}})[_0xfa5d('0x1e')](function(_0xbc0e8f){if(_0xbc0e8f){return db[_0xfa5d('0x51')][_0xfa5d('0x1d')]({'where':{'ListId':_0x4d0176[_0xfa5d('0x2b')][_0xfa5d('0x5e')],'CampaignId':_0x4d0176['params']['id']}})[_0xfa5d('0x1e')](function(){return _0xbc0e8f;});}})['then'](respondWithStatusCode(_0x312120,null))['catch'](handleError(_0x312120,null));};exports[_0xfa5d('0x86')]=function(_0x48ae11,_0x38cc51,_0x33294d){var _0x597bac={};var _0x461cf8={};var _0x361ebb;var _0x27d415;return db['Campaign'][_0xfa5d('0x50')]({'where':{'id':_0x48ae11['params']['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x38cc51,null))['then'](function(_0x15292f){if(_0x15292f){_0x361ebb=_0x15292f;_0x461cf8[_0xfa5d('0x29')]=_[_0xfa5d('0x2c')](db[_0xfa5d('0x5a')][_0xfa5d('0x25')]);_0x461cf8[_0xfa5d('0x2b')]=_[_0xfa5d('0x2c')](_0x48ae11[_0xfa5d('0x2b')]);_0x461cf8[_0xfa5d('0x35')]=_[_0xfa5d('0x2d')](_0x461cf8[_0xfa5d('0x29')],_0x461cf8[_0xfa5d('0x2b')]);_0x597bac['attributes']=_['intersection'](_0x461cf8[_0xfa5d('0x29')],qs['fields'](_0x48ae11[_0xfa5d('0x2b')][_0xfa5d('0x2f')]));_0x597bac[_0xfa5d('0x2e')]=_0x597bac[_0xfa5d('0x2e')][_0xfa5d('0x30')]?_0x597bac['attributes']:_0x461cf8[_0xfa5d('0x29')];_0x597bac['order']=qs[_0xfa5d('0x33')](_0x48ae11[_0xfa5d('0x2b')][_0xfa5d('0x33')]);_0x597bac['where']=qs[_0xfa5d('0x35')](_[_0xfa5d('0x36')](_0x48ae11['query'],_0x461cf8[_0xfa5d('0x35')]));if(_0x48ae11[_0xfa5d('0x2b')][_0xfa5d('0x37')]){_0x597bac[_0xfa5d('0x34')]=_[_0xfa5d('0x38')](_0x597bac['where'],{'$or':_[_0xfa5d('0x2a')](_0x597bac['attributes'],function(_0x2de8f3){var _0x50ca7c={};_0x50ca7c[_0x2de8f3]={'$like':'%'+_0x48ae11['query'][_0xfa5d('0x37')]+'%'};return _0x50ca7c;})});}_0x597bac=_['merge']({},_0x597bac,_0x48ae11[_0xfa5d('0x3a')]);return _0x361ebb[_0xfa5d('0x86')](_0x597bac);}})[_0xfa5d('0x1e')](function(_0x1c6375){if(_0x1c6375){_0x27d415=_0x1c6375[_0xfa5d('0x30')];if(!_0x48ae11['query'][_0xfa5d('0x54')](_0xfa5d('0x31'))){_0x597bac[_0xfa5d('0x15')]=qs[_0xfa5d('0x15')](_0x48ae11[_0xfa5d('0x2b')]['limit']);_0x597bac[_0xfa5d('0x13')]=qs[_0xfa5d('0x13')](_0x48ae11[_0xfa5d('0x2b')][_0xfa5d('0x13')]);}return _0x361ebb[_0xfa5d('0x86')](_0x597bac);}})[_0xfa5d('0x1e')](function(_0x2c3b8d){if(_0x2c3b8d){return _0x2c3b8d?{'count':_0x27d415,'rows':_0x2c3b8d}:null;}})['then'](respondWithResult(_0x38cc51,null))['catch'](handleError(_0x38cc51,null));};exports['addBlackLists']=function(_0x10c4cd,_0x36c359,_0x4215ca){var _0x4ce962,_0x3cffc4;var _0x2fa394=[];var _0xd4ad0a=moment()[_0xfa5d('0x5c')](_0xfa5d('0x5d'));return db[_0xfa5d('0x24')]['find']({'where':{'id':_0x10c4cd[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x36c359,null))[_0xfa5d('0x1e')](function(_0x549e5f){if(_0x549e5f){_0x3cffc4=_0x549e5f;return _0x549e5f[_0xfa5d('0x87')](_0x10c4cd['body']['ids'],_[_0xfa5d('0x5f')](_0x10c4cd[_0xfa5d('0x42')],['ids','id'])||{});}return null;})['spread'](function(_0xb26a8c){var _0x546585;var _0x1214bf;_0x4ce962=_0xb26a8c||[];var _0x24dff2=[];if(_0xb26a8c){for(var _0x3c147e=0x0;_0x3c147e<_0xb26a8c[_0xfa5d('0x30')];_0x3c147e+=0x1){var _0x393e1f=_0xb26a8c[_0x3c147e][_0xfa5d('0x43')]({'plain':!![]});_0x546585=squel[_0xfa5d('0x75')]()[_0xfa5d('0x61')](_0xfa5d('0x88'))[_0xfa5d('0x76')](['phone',_0xfa5d('0x68'),'ListId','CampaignId',_0xfa5d('0x4d'),_0xfa5d('0x4e')],squel[_0xfa5d('0x65')]()[_0xfa5d('0x66')](_0xfa5d('0x62'),_0xfa5d('0x62'))['field']('id',_0xfa5d('0x68'))[_0xfa5d('0x66')](_0x393e1f['CmListId'][_0xfa5d('0x6a')](),'ListId')['field'](_0x10c4cd[_0xfa5d('0x3f')]['id'][_0xfa5d('0x6a')](),_0xfa5d('0x52'))['field'](_0xfa5d('0x67'),_0xfa5d('0x4d'))[_0xfa5d('0x66')](_0xfa5d('0x67'),_0xfa5d('0x4e'))[_0xfa5d('0x6b')](_0xfa5d('0x6c'))[_0xfa5d('0x34')]('deletedAt\x20IS\x20NULL')[_0xfa5d('0x34')]('ListId\x20=\x20?',_0x393e1f[_0xfa5d('0x69')]['toString']())[_0xfa5d('0x34')](_0xfa5d('0x6e')))[_0xfa5d('0x6a')]();_0x24dff2[_0xfa5d('0x82')](db[_0xfa5d('0x83')]['query'](_0x546585));}return BPromise[_0xfa5d('0x84')](_0x24dff2);}})[_0xfa5d('0x1e')](function(){return _0x4ce962;})[_0xfa5d('0x1e')](respondWithResult(_0x36c359,null))[_0xfa5d('0x3d')](handleError(_0x36c359,null));};exports[_0xfa5d('0x89')]=function(_0x325913,_0x43dee1,_0x5eb124){return db[_0xfa5d('0x24')]['find']({'where':{'id':_0x325913[_0xfa5d('0x3f')]['id']}})[_0xfa5d('0x1e')](handleEntityNotFound(_0x43dee1,null))[_0xfa5d('0x1e')](function(_0x48e775){if(_0x48e775){return _0x48e775[_0xfa5d('0x89')](_0x325913[_0xfa5d('0x2b')][_0xfa5d('0x5e')]);}})[_0xfa5d('0x1e')](function(_0x13cfd3){if(_0x13cfd3){return db[_0xfa5d('0x58')][_0xfa5d('0x1d')]({'where':{'ListId':_0x325913[_0xfa5d('0x2b')]['ids'],'CampaignId':_0x325913[_0xfa5d('0x3f')]['id']}})['then'](function(){return _0x13cfd3;});}})[_0xfa5d('0x1e')](respondWithStatusCode(_0x43dee1,null))[_0xfa5d('0x3d')](handleError(_0x43dee1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 23bc622..54d37cf 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x217b5b,_0x3572bf){var _0x2c357f=function(_0x2f16ad){while(--_0x2f16ad){_0x217b5b['push'](_0x217b5b['shift']());}};_0x2c357f(++_0x3572bf);}(_0x7a54,0x106));var _0x47a5=function(_0x47203e,_0x5f2962){_0x47203e=_0x47203e-0x0;var _0xef49d3=_0x7a54[_0x47203e];return _0xef49d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x241eb9,_0x5ccc3f){var _0x4f916b=function(_0x412d98){while(--_0x412d98){_0x241eb9['push'](_0x241eb9['shift']());}};_0x4f916b(++_0x5ccc3f);}(_0x7a54,0x106));var _0x47a5=function(_0x5cade1,_0x201cc7){_0x5cade1=_0x5cade1-0x0;var _0x7f4b1d=_0x7a54[_0x5cade1];return _0x7f4b1d;};'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 0b4c8a0..ba2c12c 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 _0xc30d=['where','attributes','limit','map','model','include','GetCampaign','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','Campaign','findAll','options','raw'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xc30d,0x6e));var _0xdc30=function(_0x5b33be,_0x20b6e7){_0x5b33be=_0x5b33be-0x0;var _0x1497f4=_0xc30d[_0x5b33be];return _0x1497f4;};'use strict';var _=require(_0xdc30('0x0'));var util=require('util');var moment=require(_0xdc30('0x1'));var BPromise=require(_0xdc30('0x2'));var rs=require(_0xdc30('0x3'));var fs=require('fs');var Redis=require(_0xdc30('0x4'));var db=require(_0xdc30('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc30('0x6'))('rpc');var config=require(_0xdc30('0x7'));var jayson=require(_0xdc30('0x8'));var client=jayson[_0xdc30('0x9')][_0xdc30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4011da,_0x2773c5,_0x4a0310){return new BPromise(function(_0x1cdfb4,_0x39c377){return client[_0xdc30('0xb')](_0x4011da,_0x4a0310)[_0xdc30('0xc')](function(_0x1a9c5f){logger[_0xdc30('0xd')](_0xdc30('0xe'),_0x2773c5,_0xdc30('0xf'));logger[_0xdc30('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x2773c5,'request\x20sent',JSON['stringify'](_0x1a9c5f));if(_0x1a9c5f[_0xdc30('0x11')]){if(_0x1a9c5f[_0xdc30('0x11')][_0xdc30('0x12')]===0x1f4){logger[_0xdc30('0x11')](_0xdc30('0xe'),_0x2773c5,_0x1a9c5f[_0xdc30('0x11')][_0xdc30('0x13')]);return _0x39c377(_0x1a9c5f['error'][_0xdc30('0x13')]);}logger[_0xdc30('0x11')](_0xdc30('0xe'),_0x2773c5,_0x1a9c5f[_0xdc30('0x11')]['message']);return _0x1cdfb4(_0x1a9c5f[_0xdc30('0x11')][_0xdc30('0x13')]);}else{logger[_0xdc30('0xd')]('Campaign,\x20%s,\x20%s',_0x2773c5,_0xdc30('0xf'));_0x1cdfb4(_0x1a9c5f[_0xdc30('0x14')][_0xdc30('0x13')]);}})[_0xdc30('0x15')](function(_0x358251){logger[_0xdc30('0x11')](_0xdc30('0xe'),_0x2773c5,_0x358251);_0x39c377(_0x358251);});});}exports['GetCampaign']=function(_0x3eff2c){var _0x158bfc=this;return new Promise(function(_0x57a868,_0x5678a9){return db[_0xdc30('0x16')][_0xdc30('0x17')]({'raw':_0x3eff2c[_0xdc30('0x18')]?_0x3eff2c[_0xdc30('0x18')][_0xdc30('0x19')]===undefined?!![]:![]:!![],'where':_0x3eff2c[_0xdc30('0x18')]?_0x3eff2c[_0xdc30('0x18')][_0xdc30('0x1a')]||null:null,'attributes':_0x3eff2c[_0xdc30('0x18')]?_0x3eff2c[_0xdc30('0x18')][_0xdc30('0x1b')]||null:null,'limit':_0x3eff2c[_0xdc30('0x18')]?_0x3eff2c[_0xdc30('0x18')][_0xdc30('0x1c')]||null:null,'include':_0x3eff2c[_0xdc30('0x18')]?_0x3eff2c[_0xdc30('0x18')]['include']?_[_0xdc30('0x1d')](_0x3eff2c['options']['include'],function(_0x2bde2e){return{'model':db[_0x2bde2e[_0xdc30('0x1e')]],'as':_0x2bde2e['as'],'attributes':_0x2bde2e[_0xdc30('0x1b')],'include':_0x2bde2e['include']?_[_0xdc30('0x1d')](_0x2bde2e[_0xdc30('0x1f')],function(_0x4fdafc){return{'model':db[_0x4fdafc[_0xdc30('0x1e')]],'as':_0x4fdafc['as'],'attributes':_0x4fdafc['attributes'],'include':_0x4fdafc[_0xdc30('0x1f')]?_['map'](_0x4fdafc[_0xdc30('0x1f')],function(_0x16ee63){return{'model':db[_0x16ee63[_0xdc30('0x1e')]],'as':_0x16ee63['as'],'attributes':_0x16ee63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7c310e){logger['info'](_0xdc30('0x20'),_0x3eff2c);logger[_0xdc30('0x10')](_0xdc30('0x20'),_0x3eff2c,JSON[_0xdc30('0x21')](_0x7c310e));_0x57a868(_0x7c310e);})[_0xdc30('0x15')](function(_0x2c309e){logger['error'](_0xdc30('0x20'),_0x2c309e[_0xdc30('0x13')],_0x3eff2c);_0x5678a9(_0x158bfc[_0xdc30('0x11')](0x1f4,_0x2c309e[_0xdc30('0x13')]));});});}; \ No newline at end of file +var _0xcee0=['result','catch','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcee0,0x1e1));var _0x0cee=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xcee0[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0x0cee('0x0'));var util=require(_0x0cee('0x1'));var moment=require(_0x0cee('0x2'));var BPromise=require(_0x0cee('0x3'));var rs=require(_0x0cee('0x4'));var fs=require('fs');var Redis=require(_0x0cee('0x5'));var db=require(_0x0cee('0x6'))['db'];var utils=require(_0x0cee('0x7'));var logger=require(_0x0cee('0x8'))('rpc');var config=require(_0x0cee('0x9'));var jayson=require(_0x0cee('0xa'));var client=jayson[_0x0cee('0xb')][_0x0cee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2af845,_0x49f5ef,_0x45491f){return new BPromise(function(_0x24ff83,_0x34854d){return client[_0x0cee('0xd')](_0x2af845,_0x45491f)[_0x0cee('0xe')](function(_0x3ec038){logger[_0x0cee('0xf')](_0x0cee('0x10'),_0x49f5ef,_0x0cee('0x11'));logger[_0x0cee('0x12')](_0x0cee('0x13'),_0x49f5ef,_0x0cee('0x11'),JSON['stringify'](_0x3ec038));if(_0x3ec038[_0x0cee('0x14')]){if(_0x3ec038[_0x0cee('0x14')][_0x0cee('0x15')]===0x1f4){logger[_0x0cee('0x14')](_0x0cee('0x10'),_0x49f5ef,_0x3ec038[_0x0cee('0x14')][_0x0cee('0x16')]);return _0x34854d(_0x3ec038[_0x0cee('0x14')]['message']);}logger[_0x0cee('0x14')](_0x0cee('0x10'),_0x49f5ef,_0x3ec038[_0x0cee('0x14')][_0x0cee('0x16')]);return _0x24ff83(_0x3ec038[_0x0cee('0x14')][_0x0cee('0x16')]);}else{logger[_0x0cee('0xf')](_0x0cee('0x10'),_0x49f5ef,'request\x20sent');_0x24ff83(_0x3ec038[_0x0cee('0x17')][_0x0cee('0x16')]);}})[_0x0cee('0x18')](function(_0x652dcc){logger[_0x0cee('0x14')](_0x0cee('0x10'),_0x49f5ef,_0x652dcc);_0x34854d(_0x652dcc);});});}exports[_0x0cee('0x19')]=function(_0x237596){var _0x2e20b7=this;return new Promise(function(_0x500b0d,_0x1e811d){return db['Campaign'][_0x0cee('0x1a')]({'raw':_0x237596[_0x0cee('0x1b')]?_0x237596['options'][_0x0cee('0x1c')]===undefined?!![]:![]:!![],'where':_0x237596[_0x0cee('0x1b')]?_0x237596[_0x0cee('0x1b')][_0x0cee('0x1d')]||null:null,'attributes':_0x237596[_0x0cee('0x1b')]?_0x237596[_0x0cee('0x1b')][_0x0cee('0x1e')]||null:null,'limit':_0x237596[_0x0cee('0x1b')]?_0x237596[_0x0cee('0x1b')][_0x0cee('0x1f')]||null:null,'include':_0x237596[_0x0cee('0x1b')]?_0x237596[_0x0cee('0x1b')][_0x0cee('0x20')]?_['map'](_0x237596[_0x0cee('0x1b')][_0x0cee('0x20')],function(_0x512cfc){return{'model':db[_0x512cfc['model']],'as':_0x512cfc['as'],'attributes':_0x512cfc[_0x0cee('0x1e')],'include':_0x512cfc[_0x0cee('0x20')]?_[_0x0cee('0x21')](_0x512cfc['include'],function(_0x15e4ed){return{'model':db[_0x15e4ed[_0x0cee('0x22')]],'as':_0x15e4ed['as'],'attributes':_0x15e4ed[_0x0cee('0x1e')],'include':_0x15e4ed[_0x0cee('0x20')]?_[_0x0cee('0x21')](_0x15e4ed[_0x0cee('0x20')],function(_0x24739e){return{'model':db[_0x24739e[_0x0cee('0x22')]],'as':_0x24739e['as'],'attributes':_0x24739e[_0x0cee('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ceaf4){logger[_0x0cee('0xf')]('GetCampaign',_0x237596);logger[_0x0cee('0x12')](_0x0cee('0x19'),_0x237596,JSON[_0x0cee('0x23')](_0x3ceaf4));_0x500b0d(_0x3ceaf4);})[_0x0cee('0x18')](function(_0x5d69e2){logger[_0x0cee('0x14')](_0x0cee('0x19'),_0x5d69e2[_0x0cee('0x16')],_0x237596);_0x1e811d(_0x2e20b7[_0x0cee('0x14')](0x1f4,_0x5d69e2[_0x0cee('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 71a4b20..de47ee2 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 _0x5139=['update','delete','removeBlackLists','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','/:id','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put'];(function(_0x7b7cf3,_0x8acc46){var _0x43455e=function(_0x3434df){while(--_0x3434df){_0x7b7cf3['push'](_0x7b7cf3['shift']());}};_0x43455e(++_0x8acc46);}(_0x5139,0xa4));var _0x9513=function(_0x26ef30,_0x38267a){_0x26ef30=_0x26ef30-0x0;var _0x59fe20=_0x5139[_0x26ef30];return _0x59fe20;};'use strict';var multer=require('multer');var util=require(_0x9513('0x0'));var path=require('path');var timeout=require(_0x9513('0x1'));var express=require(_0x9513('0x2'));var router=express[_0x9513('0x3')]();var fs_extra=require(_0x9513('0x4'));var auth=require(_0x9513('0x5'));var interaction=require(_0x9513('0x6'));var config=require(_0x9513('0x7'));var controller=require(_0x9513('0x8'));router['get']('/',auth[_0x9513('0x9')](),controller[_0x9513('0xa')]);router['get'](_0x9513('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9513('0xc')](_0x9513('0xd'),auth[_0x9513('0x9')](),controller['getHoppers']);router[_0x9513('0xc')](_0x9513('0xe'),auth['isAuthenticated'](),controller[_0x9513('0xf')]);router[_0x9513('0xc')](_0x9513('0x10'),auth[_0x9513('0x9')](),controller[_0x9513('0x11')]);router['get'](_0x9513('0x12'),auth[_0x9513('0x9')](),controller[_0x9513('0x13')]);router[_0x9513('0xc')]('/:id/lists',auth['isAuthenticated'](),controller[_0x9513('0x14')]);router[_0x9513('0xc')](_0x9513('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x9513('0x16')]('/',auth[_0x9513('0x9')](),controller[_0x9513('0x17')]);router[_0x9513('0x16')](_0x9513('0x18'),auth[_0x9513('0x9')](),controller[_0x9513('0x19')]);router[_0x9513('0x16')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x9513('0x16')](_0x9513('0x15'),auth[_0x9513('0x9')](),controller[_0x9513('0x1a')]);router[_0x9513('0x1b')](_0x9513('0xb'),auth[_0x9513('0x9')](),controller[_0x9513('0x1c')]);router[_0x9513('0x1d')](_0x9513('0xb'),auth[_0x9513('0x9')](),controller['destroy']);router[_0x9513('0x1d')]('/:id/lists',auth[_0x9513('0x9')](),controller['removeLists']);router[_0x9513('0x1d')](_0x9513('0x15'),auth[_0x9513('0x9')](),controller[_0x9513('0x1e')]);module[_0x9513('0x1f')]=router; \ No newline at end of file +var _0xe439=['../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','clone','addLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2d0c13,_0x3fa0e7){var _0x1c580a=function(_0x36dc92){while(--_0x36dc92){_0x2d0c13['push'](_0x2d0c13['shift']());}};_0x1c580a(++_0x3fa0e7);}(_0xe439,0xc0));var _0x9e43=function(_0x5ec8ca,_0x3649e3){_0x5ec8ca=_0x5ec8ca-0x0;var _0x315ec4=_0xe439[_0x5ec8ca];return _0x315ec4;};'use strict';var multer=require(_0x9e43('0x0'));var util=require(_0x9e43('0x1'));var path=require(_0x9e43('0x2'));var timeout=require(_0x9e43('0x3'));var express=require(_0x9e43('0x4'));var router=express['Router']();var fs_extra=require(_0x9e43('0x5'));var auth=require(_0x9e43('0x6'));var interaction=require(_0x9e43('0x7'));var config=require(_0x9e43('0x8'));var controller=require(_0x9e43('0x9'));router['get']('/',auth[_0x9e43('0xa')](),controller[_0x9e43('0xb')]);router[_0x9e43('0xc')]('/:id',auth[_0x9e43('0xa')](),controller['show']);router[_0x9e43('0xc')]('/:id/hoppers',auth[_0x9e43('0xa')](),controller[_0x9e43('0xd')]);router[_0x9e43('0xc')]('/:id/hopper_histories',auth[_0x9e43('0xa')](),controller[_0x9e43('0xe')]);router['get'](_0x9e43('0xf'),auth[_0x9e43('0xa')](),controller[_0x9e43('0x10')]);router[_0x9e43('0xc')](_0x9e43('0x11'),auth['isAuthenticated'](),controller[_0x9e43('0x12')]);router['get'](_0x9e43('0x13'),auth[_0x9e43('0xa')](),controller['getLists']);router['get'](_0x9e43('0x14'),auth[_0x9e43('0xa')](),controller[_0x9e43('0x15')]);router[_0x9e43('0x16')]('/',auth['isAuthenticated'](),controller[_0x9e43('0x17')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x9e43('0x18')]);router[_0x9e43('0x16')](_0x9e43('0x13'),auth['isAuthenticated'](),controller[_0x9e43('0x19')]);router['post'](_0x9e43('0x14'),auth[_0x9e43('0xa')](),controller['addBlackLists']);router[_0x9e43('0x1a')]('/:id',auth[_0x9e43('0xa')](),controller[_0x9e43('0x1b')]);router[_0x9e43('0x1c')]('/:id',auth[_0x9e43('0xa')](),controller[_0x9e43('0x1d')]);router[_0x9e43('0x1c')](_0x9e43('0x13'),auth[_0x9e43('0xa')](),controller[_0x9e43('0x1e')]);router[_0x9e43('0x1c')](_0x9e43('0x14'),auth[_0x9e43('0xa')](),controller[_0x9e43('0x1f')]);module[_0x9e43('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 7ed0d89..afe3973 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 _0x04e9=['TEXT','medium','VIRTUAL','getDataValue','key','STRING'];(function(_0x333a74,_0x4e5043){var _0x5d1062=function(_0x2ae6a3){while(--_0x2ae6a3){_0x333a74['push'](_0x333a74['shift']());}};_0x5d1062(++_0x4e5043);}(_0x04e9,0x173));var _0x904e=function(_0x16aefb,_0x14361a){_0x16aefb=_0x16aefb-0x0;var _0x31afb2=_0x04e9[_0x16aefb];return _0x31afb2;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x904e('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x904e('0x1')],'length':_0x904e('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x904e('0x3')],'get':function(){return this[_0x904e('0x4')](_0x904e('0x5'));}}}; \ No newline at end of file +var _0x3413=['getDataValue','key','sequelize','exports','TEXT','medium'];(function(_0xec3584,_0x28f47e){var _0x272b72=function(_0x424537){while(--_0x424537){_0xec3584['push'](_0xec3584['shift']());}};_0x272b72(++_0x28f47e);}(_0x3413,0x68));var _0x3341=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3413[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3341('0x0'));module[_0x3341('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3341('0x2')],'length':_0x3341('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3341('0x4')](_0x3341('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1f51b31..84da57a 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 _0x273e=['util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','update','then','get','CannedAnswers','UserProfileResource','end','sendStatus','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','findAll','rows','show','params','rawAttributes','attributes','length','include','find','catch','body','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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'];(function(_0x259cad,_0x3dae11){var _0x4e6a68=function(_0x1669dc){while(--_0x1669dc){_0x259cad['push'](_0x259cad['shift']());}};_0x4e6a68(++_0x3dae11);}(_0x273e,0x1ac));var _0xe273=function(_0x3725d7,_0x99c771){_0x3725d7=_0x3725d7-0x0;var _0x3764cc=_0x273e[_0x3725d7];return _0x3764cc;};'use strict';var emlformat=require(_0xe273('0x0'));var rimraf=require(_0xe273('0x1'));var zipdir=require(_0xe273('0x2'));var jsonpatch=require(_0xe273('0x3'));var rp=require(_0xe273('0x4'));var moment=require('moment');var BPromise=require(_0xe273('0x5'));var Mustache=require(_0xe273('0x6'));var util=require(_0xe273('0x7'));var path=require(_0xe273('0x8'));var sox=require('sox');var csv=require(_0xe273('0x9'));var ejs=require(_0xe273('0xa'));var fs=require('fs');var fs_extra=require(_0xe273('0xb'));var _=require(_0xe273('0xc'));var squel=require(_0xe273('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe273('0x9'));var querystring=require(_0xe273('0xe'));var Papa=require('papaparse');var Redis=require(_0xe273('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe273('0x10'));var as=require(_0xe273('0x11'));var hardwareService=require(_0xe273('0x12'));var logger=require('../../config/logger')(_0xe273('0x13'));var utils=require('../../config/utils');var config=require(_0xe273('0x14'));var licenseUtil=require(_0xe273('0x15'));var db=require(_0xe273('0x16'))['db'];function respondWithStatusCode(_0x3d0ddf,_0xd8675c){_0xd8675c=_0xd8675c||0xcc;return function(_0x4e93b4){if(_0x4e93b4){return _0x3d0ddf['sendStatus'](_0xd8675c);}return _0x3d0ddf[_0xe273('0x17')](_0xd8675c)['end']();};}function respondWithResult(_0x5daded,_0x3cf152){_0x3cf152=_0x3cf152||0xc8;return function(_0x507f5b){if(_0x507f5b){return _0x5daded[_0xe273('0x17')](_0x3cf152)[_0xe273('0x18')](_0x507f5b);}};}function respondWithFilteredResult(_0x5ce816,_0x2b63e0){return function(_0x2d7e58){if(_0x2d7e58){var _0x5d6d41=typeof _0x2b63e0[_0xe273('0x19')]===_0xe273('0x1a')&&typeof _0x2b63e0[_0xe273('0x1b')]==='undefined';var _0x2208b5=_0x2d7e58[_0xe273('0x1c')];var _0x1eedb3=_0x5d6d41?0x0:_0x2b63e0[_0xe273('0x19')];var _0x3e070a=_0x5d6d41?_0x2d7e58[_0xe273('0x1c')]:_0x2b63e0[_0xe273('0x19')]+_0x2b63e0[_0xe273('0x1b')];var _0xaa4e3f;if(_0x3e070a>=_0x2208b5){_0x3e070a=_0x2208b5;_0xaa4e3f=0xc8;}else{_0xaa4e3f=0xce;}_0x5ce816[_0xe273('0x17')](_0xaa4e3f);return _0x5ce816[_0xe273('0x1d')]('Content-Range',_0x1eedb3+'-'+_0x3e070a+'/'+_0x2208b5)[_0xe273('0x18')](_0x2d7e58);}return null;};}function patchUpdates(_0x6b49de){return function(_0x2b971b){try{jsonpatch[_0xe273('0x1e')](_0x2b971b,_0x6b49de,!![]);}catch(_0xf0e8fc){return BPromise['reject'](_0xf0e8fc);}return _0x2b971b[_0xe273('0x1f')]();};}function saveUpdates(_0x34cec4,_0x30a80a){return function(_0x3efd43){if(_0x3efd43){return _0x3efd43[_0xe273('0x20')](_0x34cec4)[_0xe273('0x21')](function(_0x2ed8f4){return _0x2ed8f4;});}return null;};}function removeEntity(_0x3262fa,_0x24ee11){return function(_0x405eef){if(_0x405eef){return _0x405eef['destroy']()[_0xe273('0x21')](function(){var _0x298f18=_0x405eef[_0xe273('0x22')]({'plain':!![]});var _0x2a1f1c=_0xe273('0x23');return db[_0xe273('0x24')]['destroy']({'where':{'type':_0x2a1f1c,'resourceId':_0x298f18['id']}})['then'](function(){return _0x405eef;});})[_0xe273('0x21')](function(){_0x3262fa[_0xe273('0x17')](0xcc)[_0xe273('0x25')]();});}};}function handleEntityNotFound(_0x53a4fe,_0x35970e){return function(_0xda34c4){if(!_0xda34c4){_0x53a4fe[_0xe273('0x26')](0x194);}return _0xda34c4;};}function handleError(_0x29bde6,_0x5a8445){_0x5a8445=_0x5a8445||0x1f4;return function(_0x566dd6){logger['error'](_0x566dd6['stack']);if(_0x566dd6[_0xe273('0x27')]){delete _0x566dd6[_0xe273('0x27')];}_0x29bde6[_0xe273('0x17')](_0x5a8445)[_0xe273('0x28')](_0x566dd6);};}exports[_0xe273('0x29')]=function(_0x64c7e8,_0x34fdac){var _0x5e5cf2={},_0x156415={},_0x118c3c={'count':0x0,'rows':[]};var _0x3e43b8=_[_0xe273('0x2a')](db[_0xe273('0x2b')]['rawAttributes'],function(_0x3bc85a){return{'name':_0x3bc85a[_0xe273('0x2c')],'type':_0x3bc85a[_0xe273('0x2d')][_0xe273('0x2e')]};});_0x156415[_0xe273('0x2f')]=_[_0xe273('0x2a')](_0x3e43b8,'name');_0x156415[_0xe273('0x30')]=_[_0xe273('0x31')](_0x64c7e8[_0xe273('0x30')]);_0x156415[_0xe273('0x32')]=_[_0xe273('0x33')](_0x156415[_0xe273('0x2f')],_0x156415[_0xe273('0x30')]);_0x5e5cf2['attributes']=_['intersection'](_0x156415[_0xe273('0x2f')],qs[_0xe273('0x34')](_0x64c7e8[_0xe273('0x30')]['fields']));_0x5e5cf2['attributes']=_0x5e5cf2['attributes']['length']?_0x5e5cf2['attributes']:_0x156415[_0xe273('0x2f')];if(!_0x64c7e8[_0xe273('0x30')][_0xe273('0x35')](_0xe273('0x36'))){_0x5e5cf2[_0xe273('0x1b')]=qs[_0xe273('0x1b')](_0x64c7e8[_0xe273('0x30')][_0xe273('0x1b')]);_0x5e5cf2['offset']=qs[_0xe273('0x19')](_0x64c7e8[_0xe273('0x30')][_0xe273('0x19')]);}_0x5e5cf2[_0xe273('0x37')]=qs[_0xe273('0x38')](_0x64c7e8['query']['sort']);_0x5e5cf2[_0xe273('0x39')]=qs[_0xe273('0x32')](_['pick'](_0x64c7e8[_0xe273('0x30')],_0x156415[_0xe273('0x32')]),_0x3e43b8);if(_0x64c7e8[_0xe273('0x30')]['filter']){_0x5e5cf2[_0xe273('0x39')]=_[_0xe273('0x3a')](_0x5e5cf2[_0xe273('0x39')],{'$or':[{'key':{'$like':'%'+_0x64c7e8[_0xe273('0x30')][_0xe273('0x3b')]+'%'}},{'value':{'$like':'%'+_0x64c7e8['query']['filter']+'%'}}]});}_0x5e5cf2=_[_0xe273('0x3a')]({},_0x5e5cf2,_0x64c7e8['options']);var _0x48cf3c={'where':_0x5e5cf2[_0xe273('0x39')]};return db[_0xe273('0x2b')]['count'](_0x48cf3c)[_0xe273('0x21')](function(_0xb070e0){_0x118c3c[_0xe273('0x1c')]=_0xb070e0;if(_0x64c7e8[_0xe273('0x30')][_0xe273('0x3c')]){_0x5e5cf2['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe273('0x3d')](_0x5e5cf2);})['then'](function(_0x272bcd){_0x118c3c[_0xe273('0x3e')]=_0x272bcd;return _0x118c3c;})['then'](respondWithFilteredResult(_0x34fdac,_0x5e5cf2))['catch'](handleError(_0x34fdac,null));};exports[_0xe273('0x3f')]=function(_0x3ed147,_0x30cb26){var _0x5309a3={'raw':!![],'where':{'id':_0x3ed147[_0xe273('0x40')]['id']}},_0x4e4f1e={};_0x4e4f1e[_0xe273('0x2f')]=_[_0xe273('0x31')](db[_0xe273('0x2b')][_0xe273('0x41')]);_0x4e4f1e[_0xe273('0x30')]=_['keys'](_0x3ed147['query']);_0x4e4f1e[_0xe273('0x32')]=_[_0xe273('0x33')](_0x4e4f1e[_0xe273('0x2f')],_0x4e4f1e[_0xe273('0x30')]);_0x5309a3[_0xe273('0x42')]=_[_0xe273('0x33')](_0x4e4f1e['model'],qs[_0xe273('0x34')](_0x3ed147[_0xe273('0x30')]['fields']));_0x5309a3[_0xe273('0x42')]=_0x5309a3[_0xe273('0x42')][_0xe273('0x43')]?_0x5309a3[_0xe273('0x42')]:_0x4e4f1e[_0xe273('0x2f')];if(_0x3ed147[_0xe273('0x30')][_0xe273('0x3c')]){_0x5309a3[_0xe273('0x44')]=[{'all':!![]}];}_0x5309a3=_[_0xe273('0x3a')]({},_0x5309a3,_0x3ed147['options']);return db[_0xe273('0x2b')][_0xe273('0x45')](_0x5309a3)[_0xe273('0x21')](handleEntityNotFound(_0x30cb26,null))['then'](respondWithResult(_0x30cb26,null))[_0xe273('0x46')](handleError(_0x30cb26,null));};exports[_0xe273('0x20')]=function(_0x385fb8,_0x307bfd){if(_0x385fb8['body']['id']){delete _0x385fb8[_0xe273('0x47')]['id'];}return db[_0xe273('0x2b')]['find']({'where':{'id':_0x385fb8[_0xe273('0x40')]['id']}})[_0xe273('0x21')](handleEntityNotFound(_0x307bfd,null))[_0xe273('0x21')](saveUpdates(_0x385fb8[_0xe273('0x47')],null))['then'](respondWithResult(_0x307bfd,null))['catch'](handleError(_0x307bfd,null));};exports[_0xe273('0x48')]=function(_0x4f9b06,_0x38380b){return db[_0xe273('0x2b')][_0xe273('0x45')]({'where':{'id':_0x4f9b06[_0xe273('0x40')]['id']}})[_0xe273('0x21')](handleEntityNotFound(_0x38380b,null))[_0xe273('0x21')](removeEntity(_0x38380b,null))['catch'](handleError(_0x38380b,null));};exports[_0xe273('0x49')]=function(_0x1cb61c,_0xd780c5){var _0x389ec5={'key':_0x1cb61c[_0xe273('0x47')][_0xe273('0x2e')]};if(_0x1cb61c[_0xe273('0x47')][_0xe273('0x4a')]){_0x389ec5['MailAccountId']=_0x1cb61c[_0xe273('0x47')][_0xe273('0x4a')];}else if(_0x1cb61c[_0xe273('0x47')]['SmsAccountId']){_0x389ec5[_0xe273('0x4b')]=_0x1cb61c[_0xe273('0x47')]['SmsAccountId'];}else if(_0x1cb61c[_0xe273('0x47')][_0xe273('0x4c')]){_0x389ec5[_0xe273('0x4c')]=_0x1cb61c['body'][_0xe273('0x4c')];}else if(_0x1cb61c[_0xe273('0x47')][_0xe273('0x4d')]){_0x389ec5[_0xe273('0x4d')]=_0x1cb61c['body'][_0xe273('0x4d')];}return db['CannedAnswer'][_0xe273('0x45')]({'where':_0x389ec5})[_0xe273('0x21')](function(_0x2bcf39){if(_0x2bcf39){throw new db[(_0xe273('0x4e'))][(_0xe273('0x4f'))](_0xe273('0x50'));}return db[_0xe273('0x2b')]['create'](_0x1cb61c[_0xe273('0x47')]);})[_0xe273('0x21')](function(_0x3c1737){var _0x267823=_0x1cb61c[_0xe273('0x51')][_0xe273('0x22')]({'plain':!![]});if(!_0x267823)throw new Error(_0xe273('0x52'));if(_0x267823[_0xe273('0x53')]===_0xe273('0x51')){var _0x34b8f8=_0x3c1737[_0xe273('0x22')]({'plain':!![]});return db[_0xe273('0x54')]['find']({'where':{'name':_0xe273('0x23'),'userProfileId':_0x267823['userProfileId']},'raw':!![]})[_0xe273('0x21')](function(_0x2e1ab7){if(_0x2e1ab7&&_0x2e1ab7[_0xe273('0x55')]===0x0){return db[_0xe273('0x24')][_0xe273('0x49')]({'name':_0x34b8f8[_0xe273('0x27')],'resourceId':_0x34b8f8['id'],'type':_0x2e1ab7[_0xe273('0x27')],'sectionId':_0x2e1ab7['id']},{})['then'](function(){return _0x3c1737;});}else{return _0x3c1737;}})[_0xe273('0x46')](function(_0x952593){logger['error'](_0xe273('0x56'),_0x952593);throw _0x952593;});}return _0x3c1737;})[_0xe273('0x21')](respondWithResult(_0xd780c5,0xc9))[_0xe273('0x46')](handleError(_0xd780c5,null));}; \ No newline at end of file +var _0xce7e=['where','filter','options','includeAll','include','findAll','rows','catch','show','find','update','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','then','get','CannedAnswers','UserProfileResource','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge'];(function(_0x275d85,_0x5a883e){var _0x3cd754=function(_0x209dee){while(--_0x209dee){_0x275d85['push'](_0x275d85['shift']());}};_0x3cd754(++_0x5a883e);}(_0xce7e,0x106));var _0xece7=function(_0x2e86e8,_0x25bf06){_0x2e86e8=_0x2e86e8-0x0;var _0x1f065a=_0xce7e[_0x2e86e8];return _0x1f065a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xece7('0x0'));var zipdir=require(_0xece7('0x1'));var jsonpatch=require(_0xece7('0x2'));var rp=require(_0xece7('0x3'));var moment=require(_0xece7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xece7('0x5'));var util=require(_0xece7('0x6'));var path=require(_0xece7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xece7('0x8'));var fs=require('fs');var fs_extra=require(_0xece7('0x9'));var _=require('lodash');var squel=require(_0xece7('0xa'));var crypto=require('crypto');var jsforce=require(_0xece7('0xb'));var deskjs=require(_0xece7('0xc'));var toCsv=require(_0xece7('0xd'));var querystring=require(_0xece7('0xe'));var Papa=require(_0xece7('0xf'));var Redis=require('ioredis');var authService=require(_0xece7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xece7('0x11'));var logger=require(_0xece7('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xece7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xece7('0x14'))['db'];function respondWithStatusCode(_0x335cad,_0x1949b8){_0x1949b8=_0x1949b8||0xcc;return function(_0x57e56c){if(_0x57e56c){return _0x335cad[_0xece7('0x15')](_0x1949b8);}return _0x335cad[_0xece7('0x16')](_0x1949b8)[_0xece7('0x17')]();};}function respondWithResult(_0x4c0660,_0x352353){_0x352353=_0x352353||0xc8;return function(_0x5899a1){if(_0x5899a1){return _0x4c0660[_0xece7('0x16')](_0x352353)['json'](_0x5899a1);}};}function respondWithFilteredResult(_0x5ce44d,_0x5ce872){return function(_0x385d7b){if(_0x385d7b){var _0x513645=typeof _0x5ce872[_0xece7('0x18')]===_0xece7('0x19')&&typeof _0x5ce872[_0xece7('0x1a')]==='undefined';var _0x449f48=_0x385d7b[_0xece7('0x1b')];var _0x33414b=_0x513645?0x0:_0x5ce872['offset'];var _0x237519=_0x513645?_0x385d7b[_0xece7('0x1b')]:_0x5ce872[_0xece7('0x18')]+_0x5ce872[_0xece7('0x1a')];var _0x1d39f3;if(_0x237519>=_0x449f48){_0x237519=_0x449f48;_0x1d39f3=0xc8;}else{_0x1d39f3=0xce;}_0x5ce44d[_0xece7('0x16')](_0x1d39f3);return _0x5ce44d['set']('Content-Range',_0x33414b+'-'+_0x237519+'/'+_0x449f48)[_0xece7('0x1c')](_0x385d7b);}return null;};}function patchUpdates(_0x3344b7){return function(_0x34615d){try{jsonpatch['apply'](_0x34615d,_0x3344b7,!![]);}catch(_0x1343e2){return BPromise[_0xece7('0x1d')](_0x1343e2);}return _0x34615d[_0xece7('0x1e')]();};}function saveUpdates(_0x5741a1,_0x5d3ed6){return function(_0x1e7ad3){if(_0x1e7ad3){return _0x1e7ad3['update'](_0x5741a1)[_0xece7('0x1f')](function(_0x183b75){return _0x183b75;});}return null;};}function removeEntity(_0x34a833,_0x12a852){return function(_0x14da43){if(_0x14da43){return _0x14da43['destroy']()[_0xece7('0x1f')](function(){var _0x421a50=_0x14da43[_0xece7('0x20')]({'plain':!![]});var _0x1d64a3=_0xece7('0x21');return db[_0xece7('0x22')]['destroy']({'where':{'type':_0x1d64a3,'resourceId':_0x421a50['id']}})[_0xece7('0x1f')](function(){return _0x14da43;});})['then'](function(){_0x34a833[_0xece7('0x16')](0xcc)[_0xece7('0x17')]();});}};}function handleEntityNotFound(_0x2e82c5,_0x238d73){return function(_0x239dc1){if(!_0x239dc1){_0x2e82c5[_0xece7('0x15')](0x194);}return _0x239dc1;};}function handleError(_0x2706f0,_0x4fa2c3){_0x4fa2c3=_0x4fa2c3||0x1f4;return function(_0x450722){logger[_0xece7('0x23')](_0x450722[_0xece7('0x24')]);if(_0x450722[_0xece7('0x25')]){delete _0x450722[_0xece7('0x25')];}_0x2706f0['status'](_0x4fa2c3)['send'](_0x450722);};}exports[_0xece7('0x26')]=function(_0x190ba2,_0x5c2f72){var _0x593573={},_0x45a213={},_0x76400c={'count':0x0,'rows':[]};var _0x5bfd19=_['map'](db[_0xece7('0x27')][_0xece7('0x28')],function(_0xa6374b){return{'name':_0xa6374b[_0xece7('0x29')],'type':_0xa6374b['type'][_0xece7('0x2a')]};});_0x45a213[_0xece7('0x2b')]=_[_0xece7('0x2c')](_0x5bfd19,_0xece7('0x25'));_0x45a213[_0xece7('0x2d')]=_[_0xece7('0x2e')](_0x190ba2[_0xece7('0x2d')]);_0x45a213[_0xece7('0x2f')]=_[_0xece7('0x30')](_0x45a213['model'],_0x45a213[_0xece7('0x2d')]);_0x593573[_0xece7('0x31')]=_[_0xece7('0x30')](_0x45a213[_0xece7('0x2b')],qs[_0xece7('0x32')](_0x190ba2[_0xece7('0x2d')]['fields']));_0x593573[_0xece7('0x31')]=_0x593573[_0xece7('0x31')][_0xece7('0x33')]?_0x593573[_0xece7('0x31')]:_0x45a213[_0xece7('0x2b')];if(!_0x190ba2[_0xece7('0x2d')][_0xece7('0x34')](_0xece7('0x35'))){_0x593573[_0xece7('0x1a')]=qs['limit'](_0x190ba2[_0xece7('0x2d')][_0xece7('0x1a')]);_0x593573[_0xece7('0x18')]=qs[_0xece7('0x18')](_0x190ba2[_0xece7('0x2d')]['offset']);}_0x593573[_0xece7('0x36')]=qs[_0xece7('0x37')](_0x190ba2[_0xece7('0x2d')][_0xece7('0x37')]);_0x593573['where']=qs[_0xece7('0x2f')](_[_0xece7('0x38')](_0x190ba2[_0xece7('0x2d')],_0x45a213[_0xece7('0x2f')]),_0x5bfd19);if(_0x190ba2['query']['filter']){_0x593573['where']=_[_0xece7('0x39')](_0x593573[_0xece7('0x3a')],{'$or':[{'key':{'$like':'%'+_0x190ba2[_0xece7('0x2d')][_0xece7('0x3b')]+'%'}},{'value':{'$like':'%'+_0x190ba2['query'][_0xece7('0x3b')]+'%'}}]});}_0x593573=_[_0xece7('0x39')]({},_0x593573,_0x190ba2[_0xece7('0x3c')]);var _0x461515={'where':_0x593573[_0xece7('0x3a')]};return db[_0xece7('0x27')][_0xece7('0x1b')](_0x461515)[_0xece7('0x1f')](function(_0x35e233){_0x76400c[_0xece7('0x1b')]=_0x35e233;if(_0x190ba2[_0xece7('0x2d')][_0xece7('0x3d')]){_0x593573[_0xece7('0x3e')]=[{'all':!![]}];}return db[_0xece7('0x27')][_0xece7('0x3f')](_0x593573);})[_0xece7('0x1f')](function(_0x3700e5){_0x76400c[_0xece7('0x40')]=_0x3700e5;return _0x76400c;})['then'](respondWithFilteredResult(_0x5c2f72,_0x593573))[_0xece7('0x41')](handleError(_0x5c2f72,null));};exports[_0xece7('0x42')]=function(_0x3e0401,_0x59d998){var _0x3cd57e={'raw':!![],'where':{'id':_0x3e0401['params']['id']}},_0x4d9777={};_0x4d9777[_0xece7('0x2b')]=_[_0xece7('0x2e')](db[_0xece7('0x27')][_0xece7('0x28')]);_0x4d9777['query']=_[_0xece7('0x2e')](_0x3e0401[_0xece7('0x2d')]);_0x4d9777[_0xece7('0x2f')]=_[_0xece7('0x30')](_0x4d9777[_0xece7('0x2b')],_0x4d9777[_0xece7('0x2d')]);_0x3cd57e[_0xece7('0x31')]=_[_0xece7('0x30')](_0x4d9777[_0xece7('0x2b')],qs['fields'](_0x3e0401['query'][_0xece7('0x32')]));_0x3cd57e['attributes']=_0x3cd57e[_0xece7('0x31')][_0xece7('0x33')]?_0x3cd57e[_0xece7('0x31')]:_0x4d9777[_0xece7('0x2b')];if(_0x3e0401['query'][_0xece7('0x3d')]){_0x3cd57e[_0xece7('0x3e')]=[{'all':!![]}];}_0x3cd57e=_[_0xece7('0x39')]({},_0x3cd57e,_0x3e0401[_0xece7('0x3c')]);return db[_0xece7('0x27')][_0xece7('0x43')](_0x3cd57e)[_0xece7('0x1f')](handleEntityNotFound(_0x59d998,null))['then'](respondWithResult(_0x59d998,null))[_0xece7('0x41')](handleError(_0x59d998,null));};exports[_0xece7('0x44')]=function(_0x383284,_0x1468e7){if(_0x383284[_0xece7('0x45')]['id']){delete _0x383284['body']['id'];}return db['CannedAnswer'][_0xece7('0x43')]({'where':{'id':_0x383284['params']['id']}})[_0xece7('0x1f')](handleEntityNotFound(_0x1468e7,null))[_0xece7('0x1f')](saveUpdates(_0x383284['body'],null))[_0xece7('0x1f')](respondWithResult(_0x1468e7,null))[_0xece7('0x41')](handleError(_0x1468e7,null));};exports['destroy']=function(_0x44cbf2,_0x2a5e21){return db[_0xece7('0x27')][_0xece7('0x43')]({'where':{'id':_0x44cbf2[_0xece7('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a5e21,null))[_0xece7('0x1f')](removeEntity(_0x2a5e21,null))[_0xece7('0x41')](handleError(_0x2a5e21,null));};exports[_0xece7('0x47')]=function(_0x3e775a,_0x309716){var _0x4067fe={'key':_0x3e775a[_0xece7('0x45')][_0xece7('0x2a')]};if(_0x3e775a[_0xece7('0x45')][_0xece7('0x48')]){_0x4067fe[_0xece7('0x48')]=_0x3e775a[_0xece7('0x45')][_0xece7('0x48')];}else if(_0x3e775a[_0xece7('0x45')][_0xece7('0x49')]){_0x4067fe[_0xece7('0x49')]=_0x3e775a[_0xece7('0x45')][_0xece7('0x49')];}else if(_0x3e775a[_0xece7('0x45')][_0xece7('0x4a')]){_0x4067fe[_0xece7('0x4a')]=_0x3e775a['body']['OpenchannelAccountId'];}else if(_0x3e775a['body']['ChatWebsiteId']){_0x4067fe[_0xece7('0x4b')]=_0x3e775a[_0xece7('0x45')][_0xece7('0x4b')];}return db[_0xece7('0x27')][_0xece7('0x43')]({'where':_0x4067fe})[_0xece7('0x1f')](function(_0x288e85){if(_0x288e85){throw new db['Sequelize'][(_0xece7('0x4c'))](_0xece7('0x4d'));}return db[_0xece7('0x27')]['create'](_0x3e775a[_0xece7('0x45')]);})[_0xece7('0x1f')](function(_0x4fd346){var _0x5ee11d=_0x3e775a[_0xece7('0x4e')][_0xece7('0x20')]({'plain':!![]});if(!_0x5ee11d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ee11d['role']===_0xece7('0x4e')){var _0x459ccb=_0x4fd346['get']({'plain':!![]});return db[_0xece7('0x4f')]['find']({'where':{'name':_0xece7('0x21'),'userProfileId':_0x5ee11d['userProfileId']},'raw':!![]})[_0xece7('0x1f')](function(_0x571173){if(_0x571173&&_0x571173['autoAssociation']===0x0){return db['UserProfileResource'][_0xece7('0x47')]({'name':_0x459ccb[_0xece7('0x25')],'resourceId':_0x459ccb['id'],'type':_0x571173[_0xece7('0x25')],'sectionId':_0x571173['id']},{})['then'](function(){return _0x4fd346;});}else{return _0x4fd346;}})[_0xece7('0x41')](function(_0x214f58){logger[_0xece7('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x214f58);throw _0x214f58;});}return _0x4fd346;})[_0xece7('0x1f')](respondWithResult(_0x309716,0xc9))[_0xece7('0x41')](handleError(_0x309716,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 03f5927..42da8df 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 _0x0962=['../../config/environment','./cannedAnswer.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d0d63,_0x39cfa5){var _0x11dafe=function(_0x4f9a5e){while(--_0x4f9a5e){_0x3d0d63['push'](_0x3d0d63['shift']());}};_0x11dafe(++_0x39cfa5);}(_0x0962,0x116));var _0x2096=function(_0x3a9d5a,_0x4da2d1){_0x3a9d5a=_0x3a9d5a-0x0;var _0x141eda=_0x0962[_0x3a9d5a];return _0x141eda;};'use strict';var _=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var logger=require(_0x2096('0x2'))(_0x2096('0x3'));var moment=require(_0x2096('0x4'));var BPromise=require(_0x2096('0x5'));var rp=require(_0x2096('0x6'));var fs=require('fs');var path=require(_0x2096('0x7'));var rimraf=require('rimraf');var config=require(_0x2096('0x8'));var attributes=require(_0x2096('0x9'));module['exports']=function(_0x233148,_0x38b92b){return _0x233148[_0x2096('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2096('0xb'),'collate':_0x2096('0xc')});}; \ No newline at end of file +var _0x3ea3=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','tools_canned_answers','utf8mb4_unicode_ci','lodash'];(function(_0xde1219,_0x1702f7){var _0x213431=function(_0x5b8566){while(--_0x5b8566){_0xde1219['push'](_0xde1219['shift']());}};_0x213431(++_0x1702f7);}(_0x3ea3,0x1c7));var _0x33ea=function(_0x3821a8,_0x1ddaf8){_0x3821a8=_0x3821a8-0x0;var _0x19c8c=_0x3ea3[_0x3821a8];return _0x19c8c;};'use strict';var _=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var logger=require(_0x33ea('0x2'))(_0x33ea('0x3'));var moment=require(_0x33ea('0x4'));var BPromise=require('bluebird');var rp=require(_0x33ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33ea('0x6'));var config=require(_0x33ea('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x33ea('0x8')]=function(_0x5152d1,_0x38ba3d){return _0x5152d1[_0x33ea('0x9')]('CannedAnswer',attributes,{'tableName':_0x33ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x33ea('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index dc045cb..88bb4aa 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(_0x20c719,_0x4da4f9){var _0x15954c=function(_0x1eb76c){while(--_0x1eb76c){_0x20c719['push'](_0x20c719['shift']());}};_0x15954c(++_0x4da4f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3cfe26,_0xf4ecef){var _0x390996=function(_0x33daca){while(--_0x33daca){_0x3cfe26['push'](_0x3cfe26['shift']());}};_0x390996(++_0xf4ecef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9a7c87e..1e56a15 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 _0xa213=['create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa213,0x181));var _0x3a21=function(_0x5ee5b5,_0x31c99c){_0x5ee5b5=_0x5ee5b5-0x0;var _0x6f8eb9=_0xa213[_0x5ee5b5];return _0x6f8eb9;};'use strict';var multer=require('multer');var util=require(_0x3a21('0x0'));var path=require(_0x3a21('0x1'));var timeout=require(_0x3a21('0x2'));var express=require(_0x3a21('0x3'));var router=express[_0x3a21('0x4')]();var fs_extra=require(_0x3a21('0x5'));var auth=require(_0x3a21('0x6'));var interaction=require(_0x3a21('0x7'));var config=require(_0x3a21('0x8'));var controller=require('./cannedAnswer.controller');router[_0x3a21('0x9')]('/',auth[_0x3a21('0xa')](),controller[_0x3a21('0xb')]);router[_0x3a21('0x9')](_0x3a21('0xc'),auth['isAuthenticated'](),controller[_0x3a21('0xd')]);router[_0x3a21('0xe')]('/',auth['isAuthenticated'](),controller[_0x3a21('0xf')]);router[_0x3a21('0x10')](_0x3a21('0xc'),auth[_0x3a21('0xa')](),controller['update']);router[_0x3a21('0x11')](_0x3a21('0xc'),auth[_0x3a21('0xa')](),controller[_0x3a21('0x12')]);module[_0x3a21('0x13')]=router; \ No newline at end of file +var _0xae24=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xae24,0x1a3));var _0x4ae2=function(_0x18a65f,_0x1b638d){_0x18a65f=_0x18a65f-0x0;var _0xed28c7=_0xae24[_0x18a65f];return _0xed28c7;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require(_0x4ae2('0x1'));var path=require(_0x4ae2('0x2'));var timeout=require(_0x4ae2('0x3'));var express=require(_0x4ae2('0x4'));var router=express['Router']();var fs_extra=require(_0x4ae2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x6'));var config=require(_0x4ae2('0x7'));var controller=require(_0x4ae2('0x8'));router[_0x4ae2('0x9')]('/',auth[_0x4ae2('0xa')](),controller[_0x4ae2('0xb')]);router['get']('/:id',auth[_0x4ae2('0xa')](),controller[_0x4ae2('0xc')]);router['post']('/',auth[_0x4ae2('0xa')](),controller[_0x4ae2('0xd')]);router[_0x4ae2('0xe')](_0x4ae2('0xf'),auth[_0x4ae2('0xa')](),controller[_0x4ae2('0x10')]);router['delete'](_0x4ae2('0xf'),auth['isAuthenticated'](),controller[_0x4ae2('0x11')]);module[_0x4ae2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 0960d23..3f9546f 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 _0x608c=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x553c78,_0x4656c2){var _0x2f68c5=function(_0x4b9fac){while(--_0x4b9fac){_0x553c78['push'](_0x553c78['shift']());}};_0x2f68c5(++_0x4656c2);}(_0x608c,0x1a1));var _0xc608=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0x608c[_0x38ff2b];return _0x341f5e;};'use strict';var Sequelize=require(_0xc608('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xc608('0x1')],'allowNull':![],'defaultValue':_0xc608('0x2')},'clid':{'type':Sequelize[_0xc608('0x3')]},'src':{'type':Sequelize[_0xc608('0x3')]},'dst':{'type':Sequelize[_0xc608('0x3')]},'dcontext':{'type':Sequelize[_0xc608('0x3')]},'channel':{'type':Sequelize[_0xc608('0x3')]},'dstchannel':{'type':Sequelize[_0xc608('0x3')]},'lastapp':{'type':Sequelize[_0xc608('0x3')]},'lastdata':{'type':Sequelize[_0xc608('0x3')]},'duration':{'type':Sequelize[_0xc608('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc608('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc608('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc608('0x3')]},'linkedid':{'type':Sequelize[_0xc608('0x3')]},'sequence':{'type':Sequelize[_0xc608('0x3')]},'peeraccount':{'type':Sequelize[_0xc608('0x3')]},'type':{'type':Sequelize[_0xc608('0x3')]},'tag':{'type':Sequelize[_0xc608('0x3')]}}; \ No newline at end of file +var _0xacb8=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x475846,_0x1538be){var _0x4a7f68=function(_0x53f655){while(--_0x53f655){_0x475846['push'](_0x475846['shift']());}};_0x4a7f68(++_0x1538be);}(_0xacb8,0x119));var _0x8acb=function(_0x3445b0,_0x362241){_0x3445b0=_0x3445b0-0x0;var _0x2251c0=_0xacb8[_0x3445b0];return _0x2251c0;};'use strict';var Sequelize=require(_0x8acb('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x8acb('0x1')],'allowNull':![],'defaultValue':_0x8acb('0x2')},'clid':{'type':Sequelize[_0x8acb('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8acb('0x3')]},'dcontext':{'type':Sequelize[_0x8acb('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x8acb('0x3')]},'lastapp':{'type':Sequelize[_0x8acb('0x3')]},'lastdata':{'type':Sequelize[_0x8acb('0x3')]},'duration':{'type':Sequelize[_0x8acb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8acb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8acb('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8acb('0x3')]},'userfield':{'type':Sequelize[_0x8acb('0x3')]},'uniqueid':{'type':Sequelize[_0x8acb('0x3')]},'linkedid':{'type':Sequelize[_0x8acb('0x3')]},'sequence':{'type':Sequelize[_0x8acb('0x3')]},'peeraccount':{'type':Sequelize[_0x8acb('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0d5112e..91c7fbd 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 _0xf006=['fieldName','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0xf006,0x146));var _0x6f00=function(_0xc11280,_0x5c97b8){_0xc11280=_0xc11280-0x0;var _0x45b2f7=_0xf006[_0xc11280];return _0x45b2f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f00('0x0'));var jsonpatch=require(_0x6f00('0x1'));var rp=require('request-promise');var moment=require(_0x6f00('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f00('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f00('0x4'));var csv=require(_0x6f00('0x5'));var ejs=require(_0x6f00('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x5'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];function respondWithStatusCode(_0x36a2ec,_0x289fe9){_0x289fe9=_0x289fe9||0xcc;return function(_0x5e3264){if(_0x5e3264){return _0x36a2ec[_0x6f00('0x17')](_0x289fe9);}return _0x36a2ec['status'](_0x289fe9)[_0x6f00('0x18')]();};}function respondWithResult(_0x5047f5,_0x324e67){_0x324e67=_0x324e67||0xc8;return function(_0x220e68){if(_0x220e68){return _0x5047f5[_0x6f00('0x19')](_0x324e67)[_0x6f00('0x1a')](_0x220e68);}};}function respondWithFilteredResult(_0xa6e7a1,_0x411203){return function(_0x46bc2c){if(_0x46bc2c){var _0x4d8aee=typeof _0x411203[_0x6f00('0x1b')]==='undefined'&&typeof _0x411203[_0x6f00('0x1c')]==='undefined';var _0x534275=_0x46bc2c[_0x6f00('0x1d')];var _0x6cf83f=_0x4d8aee?0x0:_0x411203[_0x6f00('0x1b')];var _0x340f78=_0x4d8aee?_0x46bc2c[_0x6f00('0x1d')]:_0x411203[_0x6f00('0x1b')]+_0x411203[_0x6f00('0x1c')];var _0x295640;if(_0x340f78>=_0x534275){_0x340f78=_0x534275;_0x295640=0xc8;}else{_0x295640=0xce;}_0xa6e7a1[_0x6f00('0x19')](_0x295640);return _0xa6e7a1[_0x6f00('0x1e')](_0x6f00('0x1f'),_0x6cf83f+'-'+_0x340f78+'/'+_0x534275)[_0x6f00('0x1a')](_0x46bc2c);}return null;};}function patchUpdates(_0x4e11de){return function(_0x4f3031){try{jsonpatch['apply'](_0x4f3031,_0x4e11de,!![]);}catch(_0x2a5286){return BPromise[_0x6f00('0x20')](_0x2a5286);}return _0x4f3031[_0x6f00('0x21')]();};}function saveUpdates(_0x57340f,_0xe301e5){return function(_0x9066ff){if(_0x9066ff){return _0x9066ff[_0x6f00('0x22')](_0x57340f)[_0x6f00('0x23')](function(_0x388983){return _0x388983;});}return null;};}function removeEntity(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(_0x1ea061){return _0x1ea061['destroy']()[_0x6f00('0x23')](function(){_0x1cbf1c[_0x6f00('0x19')](0xcc)[_0x6f00('0x18')]();});}};}function handleEntityNotFound(_0x4d41ef,_0x37f062){return function(_0x4f7e29){if(!_0x4f7e29){_0x4d41ef[_0x6f00('0x17')](0x194);}return _0x4f7e29;};}function handleError(_0x511293,_0x434735){_0x434735=_0x434735||0x1f4;return function(_0x39375d){logger[_0x6f00('0x24')](_0x39375d[_0x6f00('0x25')]);if(_0x39375d[_0x6f00('0x26')]){delete _0x39375d['name'];}_0x511293[_0x6f00('0x19')](_0x434735)[_0x6f00('0x27')](_0x39375d);};}exports[_0x6f00('0x28')]=function(_0x4366a4,_0x2671fe){var _0x235a86={},_0xff36ce={},_0x451849={'count':0x0,'rows':[]};var _0x22f107=_[_0x6f00('0x29')](db[_0x6f00('0x2a')][_0x6f00('0x2b')],function(_0x29555d){return{'name':_0x29555d[_0x6f00('0x2c')],'type':_0x29555d['type']['key']};});_0xff36ce['model']=_['map'](_0x22f107,'name');_0xff36ce['query']=_[_0x6f00('0x2d')](_0x4366a4['query']);_0xff36ce[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0xff36ce[_0x6f00('0x30')],_0xff36ce[_0x6f00('0x31')]);_0x235a86[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0xff36ce['model'],qs[_0x6f00('0x33')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x33')]));_0x235a86[_0x6f00('0x32')]=_0x235a86[_0x6f00('0x32')]['length']?_0x235a86['attributes']:_0xff36ce['model'];if(!_0x4366a4[_0x6f00('0x31')][_0x6f00('0x34')](_0x6f00('0x35'))){_0x235a86[_0x6f00('0x1c')]=qs[_0x6f00('0x1c')](_0x4366a4['query'][_0x6f00('0x1c')]);_0x235a86[_0x6f00('0x1b')]=qs[_0x6f00('0x1b')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x1b')]);}_0x235a86[_0x6f00('0x36')]=qs[_0x6f00('0x37')](_0x4366a4['query'][_0x6f00('0x37')]);_0x235a86[_0x6f00('0x38')]=qs[_0x6f00('0x2e')](_['pick'](_0x4366a4[_0x6f00('0x31')],_0xff36ce[_0x6f00('0x2e')]),_0x22f107);if(_0x4366a4[_0x6f00('0x31')]['filter']){_0x235a86[_0x6f00('0x38')]=_['merge'](_0x235a86[_0x6f00('0x38')],{'$or':_['map'](_0x22f107,function(_0x3dc8e3){if(_0x3dc8e3[_0x6f00('0x39')]!==_0x6f00('0x3a')){var _0x896b3f={};_0x896b3f[_0x3dc8e3['name']]={'$like':'%'+_0x4366a4[_0x6f00('0x31')]['filter']+'%'};return _0x896b3f;}})});}_0x235a86=_[_0x6f00('0x3b')]({},_0x235a86,_0x4366a4['options']);var _0x7785e1={'where':_0x235a86[_0x6f00('0x38')]};return db[_0x6f00('0x2a')][_0x6f00('0x1d')](_0x7785e1)['then'](function(_0x53dc8c){_0x451849[_0x6f00('0x1d')]=_0x53dc8c;if(_0x4366a4['query'][_0x6f00('0x3c')]){_0x235a86[_0x6f00('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x6f00('0x3e')](_0x235a86);})['then'](function(_0x4cac2c){_0x451849[_0x6f00('0x3f')]=_0x4cac2c;return _0x451849;})[_0x6f00('0x23')](respondWithFilteredResult(_0x2671fe,_0x235a86))[_0x6f00('0x40')](handleError(_0x2671fe,null));};exports[_0x6f00('0x41')]=function(_0x56399a,_0x38ee25){var _0x4523f2={'raw':!![],'where':{'id':_0x56399a[_0x6f00('0x42')]['id']}},_0x2bb5aa={};_0x2bb5aa[_0x6f00('0x30')]=_[_0x6f00('0x2d')](db['Cdr'][_0x6f00('0x2b')]);_0x2bb5aa[_0x6f00('0x31')]=_[_0x6f00('0x2d')](_0x56399a[_0x6f00('0x31')]);_0x2bb5aa[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],_0x2bb5aa[_0x6f00('0x31')]);_0x4523f2[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],qs[_0x6f00('0x33')](_0x56399a['query'][_0x6f00('0x33')]));_0x4523f2[_0x6f00('0x32')]=_0x4523f2['attributes'][_0x6f00('0x43')]?_0x4523f2['attributes']:_0x2bb5aa[_0x6f00('0x30')];if(_0x56399a[_0x6f00('0x31')][_0x6f00('0x3c')]){_0x4523f2[_0x6f00('0x3d')]=[{'all':!![]}];}_0x4523f2=_['merge']({},_0x4523f2,_0x56399a[_0x6f00('0x44')]);return db['Cdr'][_0x6f00('0x45')](_0x4523f2)['then'](handleEntityNotFound(_0x38ee25,null))[_0x6f00('0x23')](respondWithResult(_0x38ee25,null))[_0x6f00('0x40')](handleError(_0x38ee25,null));};exports[_0x6f00('0x46')]=function(_0x9b003,_0x470ff3){return db[_0x6f00('0x2a')][_0x6f00('0x46')](_0x9b003[_0x6f00('0x47')],{})['then'](respondWithResult(_0x470ff3,0xc9))[_0x6f00('0x40')](handleError(_0x470ff3,null));};exports['update']=function(_0x265666,_0x31fb17){if(_0x265666[_0x6f00('0x47')]['id']){delete _0x265666['body']['id'];}return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x265666[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x31fb17,null))[_0x6f00('0x23')](saveUpdates(_0x265666['body'],null))[_0x6f00('0x23')](respondWithResult(_0x31fb17,null))['catch'](handleError(_0x31fb17,null));};exports[_0x6f00('0x48')]=function(_0x222b4c,_0x4c6e06){return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x222b4c[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c6e06,null))[_0x6f00('0x23')](removeEntity(_0x4c6e06,null))['catch'](handleError(_0x4c6e06,null));};exports[_0x6f00('0x49')]=function(_0x7f80ed,_0x3100ee){return db[_0x6f00('0x2a')][_0x6f00('0x49')]()[_0x6f00('0x23')](respondWithResult(_0x3100ee,null))[_0x6f00('0x40')](handleError(_0x3100ee,null));}; \ No newline at end of file +var _0xac95=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','index','map','Cdr','type','key','model'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0xac95,0xa8));var _0x5ac9=function(_0x9cb007,_0x36ce28){_0x9cb007=_0x9cb007-0x0;var _0x3037f5=_0xac95[_0x9cb007];return _0x3037f5;};'use strict';var emlformat=require(_0x5ac9('0x0'));var rimraf=require(_0x5ac9('0x1'));var zipdir=require(_0x5ac9('0x2'));var jsonpatch=require(_0x5ac9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ac9('0x4'));var Mustache=require(_0x5ac9('0x5'));var util=require('util');var path=require(_0x5ac9('0x6'));var sox=require(_0x5ac9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ac9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ac9('0x9'));var _=require(_0x5ac9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ac9('0xb'));var deskjs=require(_0x5ac9('0xc'));var toCsv=require(_0x5ac9('0xd'));var querystring=require(_0x5ac9('0xe'));var Papa=require(_0x5ac9('0xf'));var Redis=require(_0x5ac9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ac9('0x11'));var as=require(_0x5ac9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac9('0x13'))('api');var utils=require(_0x5ac9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5ac9('0x15'));var db=require(_0x5ac9('0x16'))['db'];function respondWithStatusCode(_0x371231,_0x40eb62){_0x40eb62=_0x40eb62||0xcc;return function(_0x4f9a04){if(_0x4f9a04){return _0x371231['sendStatus'](_0x40eb62);}return _0x371231[_0x5ac9('0x17')](_0x40eb62)['end']();};}function respondWithResult(_0x3a7d64,_0x364007){_0x364007=_0x364007||0xc8;return function(_0x50658c){if(_0x50658c){return _0x3a7d64[_0x5ac9('0x17')](_0x364007)[_0x5ac9('0x18')](_0x50658c);}};}function respondWithFilteredResult(_0x3f8fac,_0x122590){return function(_0x456ed9){if(_0x456ed9){var _0x2fe47e=typeof _0x122590[_0x5ac9('0x19')]===_0x5ac9('0x1a')&&typeof _0x122590[_0x5ac9('0x1b')]==='undefined';var _0x53a8db=_0x456ed9[_0x5ac9('0x1c')];var _0x193c56=_0x2fe47e?0x0:_0x122590[_0x5ac9('0x19')];var _0x4463ff=_0x2fe47e?_0x456ed9[_0x5ac9('0x1c')]:_0x122590[_0x5ac9('0x19')]+_0x122590[_0x5ac9('0x1b')];var _0x429bf3;if(_0x4463ff>=_0x53a8db){_0x4463ff=_0x53a8db;_0x429bf3=0xc8;}else{_0x429bf3=0xce;}_0x3f8fac[_0x5ac9('0x17')](_0x429bf3);return _0x3f8fac[_0x5ac9('0x1d')](_0x5ac9('0x1e'),_0x193c56+'-'+_0x4463ff+'/'+_0x53a8db)[_0x5ac9('0x18')](_0x456ed9);}return null;};}function patchUpdates(_0x2efa5f){return function(_0x479c6b){try{jsonpatch[_0x5ac9('0x1f')](_0x479c6b,_0x2efa5f,!![]);}catch(_0x1f5546){return BPromise[_0x5ac9('0x20')](_0x1f5546);}return _0x479c6b[_0x5ac9('0x21')]();};}function saveUpdates(_0x2d2ba5,_0x492679){return function(_0x45417d){if(_0x45417d){return _0x45417d[_0x5ac9('0x22')](_0x2d2ba5)['then'](function(_0x5e42a1){return _0x5e42a1;});}return null;};}function removeEntity(_0x5a4664,_0xc36d2){return function(_0x2e666b){if(_0x2e666b){return _0x2e666b['destroy']()['then'](function(){_0x5a4664[_0x5ac9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49352f,_0x2d1bb5){return function(_0x505acc){if(!_0x505acc){_0x49352f[_0x5ac9('0x23')](0x194);}return _0x505acc;};}function handleError(_0x3b77be,_0x770c48){_0x770c48=_0x770c48||0x1f4;return function(_0x3a7f68){logger[_0x5ac9('0x24')](_0x3a7f68[_0x5ac9('0x25')]);if(_0x3a7f68[_0x5ac9('0x26')]){delete _0x3a7f68[_0x5ac9('0x26')];}_0x3b77be[_0x5ac9('0x17')](_0x770c48)['send'](_0x3a7f68);};}exports[_0x5ac9('0x27')]=function(_0x14a7fe,_0x2a7db9){var _0x3a536c={},_0x3d51ab={},_0x58c9be={'count':0x0,'rows':[]};var _0x47f6ad=_[_0x5ac9('0x28')](db[_0x5ac9('0x29')]['rawAttributes'],function(_0x3a15cf){return{'name':_0x3a15cf['fieldName'],'type':_0x3a15cf[_0x5ac9('0x2a')][_0x5ac9('0x2b')]};});_0x3d51ab[_0x5ac9('0x2c')]=_['map'](_0x47f6ad,_0x5ac9('0x26'));_0x3d51ab[_0x5ac9('0x2d')]=_[_0x5ac9('0x2e')](_0x14a7fe[_0x5ac9('0x2d')]);_0x3d51ab[_0x5ac9('0x2f')]=_[_0x5ac9('0x30')](_0x3d51ab['model'],_0x3d51ab['query']);_0x3a536c[_0x5ac9('0x31')]=_['intersection'](_0x3d51ab['model'],qs[_0x5ac9('0x32')](_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x32')]));_0x3a536c[_0x5ac9('0x31')]=_0x3a536c[_0x5ac9('0x31')][_0x5ac9('0x33')]?_0x3a536c[_0x5ac9('0x31')]:_0x3d51ab[_0x5ac9('0x2c')];if(!_0x14a7fe[_0x5ac9('0x2d')]['hasOwnProperty'](_0x5ac9('0x34'))){_0x3a536c[_0x5ac9('0x1b')]=qs['limit'](_0x14a7fe['query'][_0x5ac9('0x1b')]);_0x3a536c[_0x5ac9('0x19')]=qs[_0x5ac9('0x19')](_0x14a7fe[_0x5ac9('0x2d')]['offset']);}_0x3a536c[_0x5ac9('0x35')]=qs['sort'](_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x36')]);_0x3a536c[_0x5ac9('0x37')]=qs[_0x5ac9('0x2f')](_[_0x5ac9('0x38')](_0x14a7fe[_0x5ac9('0x2d')],_0x3d51ab[_0x5ac9('0x2f')]),_0x47f6ad);if(_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x39')]){_0x3a536c[_0x5ac9('0x37')]=_[_0x5ac9('0x3a')](_0x3a536c[_0x5ac9('0x37')],{'$or':_['map'](_0x47f6ad,function(_0x5d57ff){if(_0x5d57ff[_0x5ac9('0x2a')]!==_0x5ac9('0x3b')){var _0x3003f6={};_0x3003f6[_0x5d57ff[_0x5ac9('0x26')]]={'$like':'%'+_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x39')]+'%'};return _0x3003f6;}})});}_0x3a536c=_['merge']({},_0x3a536c,_0x14a7fe[_0x5ac9('0x3c')]);var _0x16b74e={'where':_0x3a536c['where']};return db['Cdr']['count'](_0x16b74e)[_0x5ac9('0x3d')](function(_0xc6be86){_0x58c9be[_0x5ac9('0x1c')]=_0xc6be86;if(_0x14a7fe[_0x5ac9('0x2d')]['includeAll']){_0x3a536c[_0x5ac9('0x3e')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x3a536c);})[_0x5ac9('0x3d')](function(_0x45bc9b){_0x58c9be['rows']=_0x45bc9b;return _0x58c9be;})[_0x5ac9('0x3d')](respondWithFilteredResult(_0x2a7db9,_0x3a536c))[_0x5ac9('0x3f')](handleError(_0x2a7db9,null));};exports['show']=function(_0x2a1c19,_0xba7c84){var _0x433634={'raw':!![],'where':{'id':_0x2a1c19[_0x5ac9('0x40')]['id']}},_0x1caf84={};_0x1caf84[_0x5ac9('0x2c')]=_[_0x5ac9('0x2e')](db[_0x5ac9('0x29')][_0x5ac9('0x41')]);_0x1caf84[_0x5ac9('0x2d')]=_[_0x5ac9('0x2e')](_0x2a1c19[_0x5ac9('0x2d')]);_0x1caf84['filters']=_[_0x5ac9('0x30')](_0x1caf84[_0x5ac9('0x2c')],_0x1caf84[_0x5ac9('0x2d')]);_0x433634['attributes']=_[_0x5ac9('0x30')](_0x1caf84[_0x5ac9('0x2c')],qs[_0x5ac9('0x32')](_0x2a1c19['query'][_0x5ac9('0x32')]));_0x433634[_0x5ac9('0x31')]=_0x433634[_0x5ac9('0x31')][_0x5ac9('0x33')]?_0x433634[_0x5ac9('0x31')]:_0x1caf84[_0x5ac9('0x2c')];if(_0x2a1c19['query']['includeAll']){_0x433634[_0x5ac9('0x3e')]=[{'all':!![]}];}_0x433634=_['merge']({},_0x433634,_0x2a1c19[_0x5ac9('0x3c')]);return db['Cdr'][_0x5ac9('0x42')](_0x433634)[_0x5ac9('0x3d')](handleEntityNotFound(_0xba7c84,null))[_0x5ac9('0x3d')](respondWithResult(_0xba7c84,null))[_0x5ac9('0x3f')](handleError(_0xba7c84,null));};exports[_0x5ac9('0x43')]=function(_0x671363,_0x324b7d){return db[_0x5ac9('0x29')][_0x5ac9('0x43')](_0x671363[_0x5ac9('0x44')],{})[_0x5ac9('0x3d')](respondWithResult(_0x324b7d,0xc9))['catch'](handleError(_0x324b7d,null));};exports[_0x5ac9('0x22')]=function(_0x4bb9c7,_0x482df4){if(_0x4bb9c7['body']['id']){delete _0x4bb9c7[_0x5ac9('0x44')]['id'];}return db[_0x5ac9('0x29')][_0x5ac9('0x42')]({'where':{'id':_0x4bb9c7['params']['id']}})[_0x5ac9('0x3d')](handleEntityNotFound(_0x482df4,null))[_0x5ac9('0x3d')](saveUpdates(_0x4bb9c7[_0x5ac9('0x44')],null))[_0x5ac9('0x3d')](respondWithResult(_0x482df4,null))[_0x5ac9('0x3f')](handleError(_0x482df4,null));};exports[_0x5ac9('0x45')]=function(_0x499fd3,_0x47a7b8){return db[_0x5ac9('0x29')][_0x5ac9('0x42')]({'where':{'id':_0x499fd3['params']['id']}})[_0x5ac9('0x3d')](handleEntityNotFound(_0x47a7b8,null))[_0x5ac9('0x3d')](removeEntity(_0x47a7b8,null))[_0x5ac9('0x3f')](handleError(_0x47a7b8,null));};exports[_0x5ac9('0x46')]=function(_0x6b3995,_0x575a3f){return db[_0x5ac9('0x29')][_0x5ac9('0x46')]()[_0x5ac9('0x3d')](respondWithResult(_0x575a3f,null))['catch'](handleError(_0x575a3f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8077015..b4bd4ea 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(_0x37bf68,_0x3e5229){var _0x1c3851=function(_0x310de2){while(--_0x310de2){_0x37bf68['push'](_0x37bf68['shift']());}};_0x1c3851(++_0x3e5229);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xa507e1,_0x480eac){var _0x1bcba3=function(_0xf8595b){while(--_0xf8595b){_0xa507e1['push'](_0xa507e1['shift']());}};_0x1bcba3(++_0x480eac);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 48f2b1a..120a5e5 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 _0x4143=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x1e6992,_0x17ba6b){var _0x641ce=function(_0x3f8256){while(--_0x3f8256){_0x1e6992['push'](_0x1e6992['shift']());}};_0x641ce(++_0x17ba6b);}(_0x4143,0x107));var _0x3414=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x4143[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x3414('0x0'));var util=require(_0x3414('0x1'));var moment=require(_0x3414('0x2'));var BPromise=require(_0x3414('0x3'));var rs=require(_0x3414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3414('0x5'))['db'];var utils=require(_0x3414('0x6'));var logger=require(_0x3414('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3414('0x8'));var client=jayson[_0x3414('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b209,_0x3bda66,_0x5cb0eb){return new BPromise(function(_0x2248d6,_0x127830){return client[_0x3414('0xa')](_0x31b209,_0x5cb0eb)[_0x3414('0xb')](function(_0xf35baf){logger[_0x3414('0xc')](_0x3414('0xd'),_0x3bda66,_0x3414('0xe'));logger[_0x3414('0xf')](_0x3414('0x10'),_0x3bda66,'request\x20sent',JSON[_0x3414('0x11')](_0xf35baf));if(_0xf35baf[_0x3414('0x12')]){if(_0xf35baf[_0x3414('0x12')][_0x3414('0x13')]===0x1f4){logger[_0x3414('0x12')](_0x3414('0xd'),_0x3bda66,_0xf35baf['error'][_0x3414('0x14')]);return _0x127830(_0xf35baf[_0x3414('0x12')][_0x3414('0x14')]);}logger[_0x3414('0x12')]('Cdr,\x20%s,\x20%s',_0x3bda66,_0xf35baf[_0x3414('0x12')][_0x3414('0x14')]);return _0x2248d6(_0xf35baf[_0x3414('0x12')][_0x3414('0x14')]);}else{logger['info'](_0x3414('0xd'),_0x3bda66,_0x3414('0xe'));_0x2248d6(_0xf35baf['result'][_0x3414('0x14')]);}})[_0x3414('0x15')](function(_0x37320a){logger[_0x3414('0x12')](_0x3414('0xd'),_0x3bda66,_0x37320a);_0x127830(_0x37320a);});});} \ No newline at end of file +var _0x0752=['client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e2b56,_0x280b73){var _0xbbf763=function(_0x49934f){while(--_0x49934f){_0x1e2b56['push'](_0x1e2b56['shift']());}};_0xbbf763(++_0x280b73);}(_0x0752,0xa4));var _0x2075=function(_0x4109ab,_0x35a6c6){_0x4109ab=_0x4109ab-0x0;var _0x4073c4=_0x0752[_0x4109ab];return _0x4073c4;};'use strict';var _=require(_0x2075('0x0'));var util=require(_0x2075('0x1'));var moment=require('moment');var BPromise=require(_0x2075('0x2'));var rs=require(_0x2075('0x3'));var fs=require('fs');var Redis=require(_0x2075('0x4'));var db=require(_0x2075('0x5'))['db'];var utils=require(_0x2075('0x6'));var logger=require(_0x2075('0x7'))(_0x2075('0x8'));var config=require(_0x2075('0x9'));var jayson=require(_0x2075('0xa'));var client=jayson[_0x2075('0xb')][_0x2075('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x411fe3,_0x3145fc,_0x1896b5){return new BPromise(function(_0x7d293e,_0x4e222b){return client[_0x2075('0xd')](_0x411fe3,_0x1896b5)[_0x2075('0xe')](function(_0x4c8445){logger[_0x2075('0xf')](_0x2075('0x10'),_0x3145fc,_0x2075('0x11'));logger['debug'](_0x2075('0x12'),_0x3145fc,_0x2075('0x11'),JSON[_0x2075('0x13')](_0x4c8445));if(_0x4c8445[_0x2075('0x14')]){if(_0x4c8445['error'][_0x2075('0x15')]===0x1f4){logger[_0x2075('0x14')]('Cdr,\x20%s,\x20%s',_0x3145fc,_0x4c8445[_0x2075('0x14')][_0x2075('0x16')]);return _0x4e222b(_0x4c8445[_0x2075('0x14')][_0x2075('0x16')]);}logger[_0x2075('0x14')](_0x2075('0x10'),_0x3145fc,_0x4c8445[_0x2075('0x14')][_0x2075('0x16')]);return _0x7d293e(_0x4c8445['error'][_0x2075('0x16')]);}else{logger[_0x2075('0xf')](_0x2075('0x10'),_0x3145fc,'request\x20sent');_0x7d293e(_0x4c8445[_0x2075('0x17')][_0x2075('0x16')]);}})[_0x2075('0x18')](function(_0x2fd239){logger['error'](_0x2075('0x10'),_0x3145fc,_0x2fd239);_0x4e222b(_0x2fd239);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 26e143e..c553441 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x41eb8b,_0x8e630f){var _0x57f6be=function(_0x552d87){while(--_0x552d87){_0x41eb8b['push'](_0x41eb8b['shift']());}};_0x57f6be(++_0x8e630f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4febd4,_0x256ec4){var _0x12c32e=function(_0x3c5f29){while(--_0x3c5f29){_0x4febd4['push'](_0x4febd4['shift']());}};_0x12c32e(++_0x256ec4);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f1837,_0x4b304e){_0x1f1837=_0x1f1837-0x0;var _0x25ab57=_0xb10b[_0x1f1837];return _0x25ab57;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 81dbeeb..f949920 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 _0xd143=['*,*,*,*','exports','INTEGER','noop','STRING'];(function(_0x543896,_0xea52c1){var _0x4f3be3=function(_0x4358fe){while(--_0x4358fe){_0x543896['push'](_0x543896['shift']());}};_0x4f3be3(++_0xea52c1);}(_0xd143,0x1e6));var _0x3d14=function(_0x1b5e7e,_0x26ae2d){_0x1b5e7e=_0x1b5e7e-0x0;var _0x11188c=_0xd143[_0x1b5e7e];return _0x11188c;};'use strict';var Sequelize=require('sequelize');module[_0x3d14('0x0')]={'priority':{'type':Sequelize[_0x3d14('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3d14('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3d14('0x3')]},'interval':{'type':Sequelize[_0x3d14('0x3')],'defaultValue':_0x3d14('0x4')}}; \ No newline at end of file +var _0x26a3=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x26a3,0x1ce));var _0x326a=function(_0x1faa29,_0x4d6a85){_0x1faa29=_0x1faa29-0x0;var _0x452fe0=_0x26a3[_0x1faa29];return _0x452fe0;};'use strict';var Sequelize=require(_0x326a('0x0'));module[_0x326a('0x1')]={'priority':{'type':Sequelize[_0x326a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x326a('0x3')],'allowNull':![],'defaultValue':_0x326a('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x326a('0x3')]},'interval':{'type':Sequelize[_0x326a('0x3')],'defaultValue':_0x326a('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index dc11383..ac2be04 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 _0x6146=['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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x5a6744,_0x144876){var _0xff7177=function(_0x4b3e10){while(--_0x4b3e10){_0x5a6744['push'](_0x5a6744['shift']());}};_0xff7177(++_0x144876);}(_0x6146,0xba));var _0x6614=function(_0x9f321b,_0x2f2818){_0x9f321b=_0x9f321b-0x0;var _0x574eb7=_0x6146[_0x9f321b];return _0x574eb7;};'use strict';var emlformat=require(_0x6614('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6614('0x1'));var jsonpatch=require(_0x6614('0x2'));var rp=require(_0x6614('0x3'));var moment=require(_0x6614('0x4'));var BPromise=require(_0x6614('0x5'));var Mustache=require(_0x6614('0x6'));var util=require(_0x6614('0x7'));var path=require('path');var sox=require(_0x6614('0x8'));var csv=require(_0x6614('0x9'));var ejs=require(_0x6614('0xa'));var fs=require('fs');var fs_extra=require(_0x6614('0xb'));var _=require(_0x6614('0xc'));var squel=require(_0x6614('0xd'));var crypto=require(_0x6614('0xe'));var jsforce=require(_0x6614('0xf'));var deskjs=require(_0x6614('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6614('0x11'));var Papa=require(_0x6614('0x12'));var Redis=require(_0x6614('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6614('0x14'));var as=require(_0x6614('0x15'));var hardwareService=require(_0x6614('0x16'));var logger=require(_0x6614('0x17'))(_0x6614('0x18'));var utils=require(_0x6614('0x19'));var config=require(_0x6614('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6614('0x1b'))['db'];function respondWithStatusCode(_0x4fa29b,_0x3550a7){_0x3550a7=_0x3550a7||0xcc;return function(_0x11b16b){if(_0x11b16b){return _0x4fa29b[_0x6614('0x1c')](_0x3550a7);}return _0x4fa29b[_0x6614('0x1d')](_0x3550a7)[_0x6614('0x1e')]();};}function respondWithResult(_0x1d0d2b,_0x1bae1d){_0x1bae1d=_0x1bae1d||0xc8;return function(_0x288cd7){if(_0x288cd7){return _0x1d0d2b[_0x6614('0x1d')](_0x1bae1d)['json'](_0x288cd7);}};}function respondWithFilteredResult(_0x481f26,_0x219365){return function(_0x40a008){if(_0x40a008){var _0x5e933f=typeof _0x219365[_0x6614('0x1f')]===_0x6614('0x20')&&typeof _0x219365[_0x6614('0x21')]==='undefined';var _0xfddeb9=_0x40a008[_0x6614('0x22')];var _0x449ec5=_0x5e933f?0x0:_0x219365['offset'];var _0x53080d=_0x5e933f?_0x40a008[_0x6614('0x22')]:_0x219365[_0x6614('0x1f')]+_0x219365[_0x6614('0x21')];var _0x30c5bc;if(_0x53080d>=_0xfddeb9){_0x53080d=_0xfddeb9;_0x30c5bc=0xc8;}else{_0x30c5bc=0xce;}_0x481f26['status'](_0x30c5bc);return _0x481f26[_0x6614('0x23')](_0x6614('0x24'),_0x449ec5+'-'+_0x53080d+'/'+_0xfddeb9)[_0x6614('0x25')](_0x40a008);}return null;};}function patchUpdates(_0x5442e0){return function(_0x15c667){try{jsonpatch[_0x6614('0x26')](_0x15c667,_0x5442e0,!![]);}catch(_0x13868d){return BPromise[_0x6614('0x27')](_0x13868d);}return _0x15c667[_0x6614('0x28')]();};}function saveUpdates(_0x1db8fc,_0x18889c){return function(_0x3275ee){if(_0x3275ee){return _0x3275ee['update'](_0x1db8fc)[_0x6614('0x29')](function(_0x4a665a){return _0x4a665a;});}return null;};}function removeEntity(_0x13ad7a,_0x30205e){return function(_0x332fca){if(_0x332fca){return _0x332fca['destroy']()['then'](function(){_0x13ad7a[_0x6614('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1137ef,_0x5c8651){return function(_0x3c82e5){if(!_0x3c82e5){_0x1137ef[_0x6614('0x1c')](0x194);}return _0x3c82e5;};}function handleError(_0x5ddae6,_0x119e53){_0x119e53=_0x119e53||0x1f4;return function(_0x4e9450){logger[_0x6614('0x2a')](_0x4e9450[_0x6614('0x2b')]);if(_0x4e9450[_0x6614('0x2c')]){delete _0x4e9450[_0x6614('0x2c')];}_0x5ddae6[_0x6614('0x1d')](_0x119e53)[_0x6614('0x2d')](_0x4e9450);};}exports[_0x6614('0x2e')]=function(_0x2f9a26,_0x1fef5f){var _0x32ee73={'raw':!![],'where':{'id':_0x2f9a26[_0x6614('0x2f')]['id']}},_0x153b8e={};_0x153b8e[_0x6614('0x30')]=_['keys'](db[_0x6614('0x31')][_0x6614('0x32')]);_0x153b8e[_0x6614('0x33')]=_[_0x6614('0x34')](_0x2f9a26[_0x6614('0x33')]);_0x153b8e[_0x6614('0x35')]=_[_0x6614('0x36')](_0x153b8e[_0x6614('0x30')],_0x153b8e['query']);_0x32ee73[_0x6614('0x37')]=_[_0x6614('0x36')](_0x153b8e[_0x6614('0x30')],qs['fields'](_0x2f9a26['query'][_0x6614('0x38')]));_0x32ee73['attributes']=_0x32ee73[_0x6614('0x37')][_0x6614('0x39')]?_0x32ee73['attributes']:_0x153b8e[_0x6614('0x30')];if(_0x2f9a26[_0x6614('0x33')][_0x6614('0x3a')]){_0x32ee73['include']=[{'all':!![]}];}_0x32ee73=_[_0x6614('0x3b')]({},_0x32ee73,_0x2f9a26[_0x6614('0x3c')]);return db[_0x6614('0x31')][_0x6614('0x3d')](_0x32ee73)[_0x6614('0x29')](handleEntityNotFound(_0x1fef5f,null))[_0x6614('0x29')](respondWithResult(_0x1fef5f,null))[_0x6614('0x3e')](handleError(_0x1fef5f,null));};exports[_0x6614('0x3f')]=function(_0x2c40d1,_0x15a9bd){if(_0x2c40d1[_0x6614('0x40')]['id']){delete _0x2c40d1[_0x6614('0x40')]['id'];}return db[_0x6614('0x31')][_0x6614('0x3d')]({'where':{'id':_0x2c40d1[_0x6614('0x2f')]['id']}})[_0x6614('0x29')](handleEntityNotFound(_0x15a9bd,null))[_0x6614('0x29')](saveUpdates(_0x2c40d1[_0x6614('0x40')],null))[_0x6614('0x29')](respondWithResult(_0x15a9bd,null))[_0x6614('0x3e')](handleError(_0x15a9bd,null));};exports['destroy']=function(_0x1a59b8,_0x1019fe){return db[_0x6614('0x31')][_0x6614('0x3d')]({'where':{'id':_0x1a59b8[_0x6614('0x2f')]['id']}})[_0x6614('0x29')](handleEntityNotFound(_0x1019fe,null))[_0x6614('0x29')](removeEntity(_0x1019fe,null))[_0x6614('0x3e')](handleError(_0x1019fe,null));}; \ No newline at end of file +var _0x252f=['status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','show','params','model','query','keys','intersection','fields','attributes','length','merge','options','ChatApplication','find','catch','body','destroy','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5249b7,_0x361a1d){var _0x552a2b=function(_0x26f199){while(--_0x26f199){_0x5249b7['push'](_0x5249b7['shift']());}};_0x552a2b(++_0x361a1d);}(_0x252f,0xd0));var _0xf252=function(_0x561e73,_0x13a224){_0x561e73=_0x561e73-0x0;var _0x2dc60d=_0x252f[_0x561e73];return _0x2dc60d;};'use strict';var emlformat=require(_0xf252('0x0'));var rimraf=require(_0xf252('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf252('0x2'));var moment=require(_0xf252('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf252('0x4'));var path=require(_0xf252('0x5'));var sox=require(_0xf252('0x6'));var csv=require(_0xf252('0x7'));var ejs=require(_0xf252('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf252('0x9'));var squel=require(_0xf252('0xa'));var crypto=require(_0xf252('0xb'));var jsforce=require(_0xf252('0xc'));var deskjs=require(_0xf252('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf252('0xe'));var Papa=require(_0xf252('0xf'));var Redis=require('ioredis');var authService=require(_0xf252('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf252('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf252('0x12'))(_0xf252('0x13'));var utils=require(_0xf252('0x14'));var config=require(_0xf252('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf252('0x16'))['db'];function respondWithStatusCode(_0xf54ee9,_0x2fc7d3){_0x2fc7d3=_0x2fc7d3||0xcc;return function(_0x10d4e1){if(_0x10d4e1){return _0xf54ee9[_0xf252('0x17')](_0x2fc7d3);}return _0xf54ee9[_0xf252('0x18')](_0x2fc7d3)['end']();};}function respondWithResult(_0x36da86,_0x18fa76){_0x18fa76=_0x18fa76||0xc8;return function(_0xbdb67a){if(_0xbdb67a){return _0x36da86['status'](_0x18fa76)[_0xf252('0x19')](_0xbdb67a);}};}function respondWithFilteredResult(_0xf7285f,_0x33c420){return function(_0x25affc){if(_0x25affc){var _0x486254=typeof _0x33c420[_0xf252('0x1a')]==='undefined'&&typeof _0x33c420[_0xf252('0x1b')]===_0xf252('0x1c');var _0x331bd6=_0x25affc['count'];var _0x4f6bd5=_0x486254?0x0:_0x33c420[_0xf252('0x1a')];var _0x34ce46=_0x486254?_0x25affc[_0xf252('0x1d')]:_0x33c420['offset']+_0x33c420[_0xf252('0x1b')];var _0x4f063c;if(_0x34ce46>=_0x331bd6){_0x34ce46=_0x331bd6;_0x4f063c=0xc8;}else{_0x4f063c=0xce;}_0xf7285f['status'](_0x4f063c);return _0xf7285f[_0xf252('0x1e')](_0xf252('0x1f'),_0x4f6bd5+'-'+_0x34ce46+'/'+_0x331bd6)[_0xf252('0x19')](_0x25affc);}return null;};}function patchUpdates(_0x2ab64c){return function(_0x4c86fb){try{jsonpatch[_0xf252('0x20')](_0x4c86fb,_0x2ab64c,!![]);}catch(_0x43a9f0){return BPromise[_0xf252('0x21')](_0x43a9f0);}return _0x4c86fb[_0xf252('0x22')]();};}function saveUpdates(_0x574614,_0x579022){return function(_0x12d287){if(_0x12d287){return _0x12d287[_0xf252('0x23')](_0x574614)[_0xf252('0x24')](function(_0x524683){return _0x524683;});}return null;};}function removeEntity(_0x18c14d,_0x2ba040){return function(_0x284dca){if(_0x284dca){return _0x284dca['destroy']()[_0xf252('0x24')](function(){_0x18c14d[_0xf252('0x18')](0xcc)[_0xf252('0x25')]();});}};}function handleEntityNotFound(_0x36f8a5,_0x74ad3c){return function(_0x165ff4){if(!_0x165ff4){_0x36f8a5['sendStatus'](0x194);}return _0x165ff4;};}function handleError(_0x4dd530,_0xdd0977){_0xdd0977=_0xdd0977||0x1f4;return function(_0x2c6073){logger[_0xf252('0x26')](_0x2c6073[_0xf252('0x27')]);if(_0x2c6073[_0xf252('0x28')]){delete _0x2c6073[_0xf252('0x28')];}_0x4dd530[_0xf252('0x18')](_0xdd0977)[_0xf252('0x29')](_0x2c6073);};}exports[_0xf252('0x2a')]=function(_0x4bc687,_0x234af2){var _0x5aedad={'raw':!![],'where':{'id':_0x4bc687[_0xf252('0x2b')]['id']}},_0x534c98={};_0x534c98[_0xf252('0x2c')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x534c98[_0xf252('0x2d')]=_[_0xf252('0x2e')](_0x4bc687[_0xf252('0x2d')]);_0x534c98['filters']=_[_0xf252('0x2f')](_0x534c98['model'],_0x534c98[_0xf252('0x2d')]);_0x5aedad['attributes']=_[_0xf252('0x2f')](_0x534c98[_0xf252('0x2c')],qs[_0xf252('0x30')](_0x4bc687[_0xf252('0x2d')][_0xf252('0x30')]));_0x5aedad[_0xf252('0x31')]=_0x5aedad[_0xf252('0x31')][_0xf252('0x32')]?_0x5aedad[_0xf252('0x31')]:_0x534c98['model'];if(_0x4bc687[_0xf252('0x2d')]['includeAll']){_0x5aedad['include']=[{'all':!![]}];}_0x5aedad=_[_0xf252('0x33')]({},_0x5aedad,_0x4bc687[_0xf252('0x34')]);return db[_0xf252('0x35')][_0xf252('0x36')](_0x5aedad)['then'](handleEntityNotFound(_0x234af2,null))['then'](respondWithResult(_0x234af2,null))[_0xf252('0x37')](handleError(_0x234af2,null));};exports[_0xf252('0x23')]=function(_0x2f803b,_0x1fec2e){if(_0x2f803b[_0xf252('0x38')]['id']){delete _0x2f803b[_0xf252('0x38')]['id'];}return db['ChatApplication'][_0xf252('0x36')]({'where':{'id':_0x2f803b['params']['id']}})[_0xf252('0x24')](handleEntityNotFound(_0x1fec2e,null))['then'](saveUpdates(_0x2f803b[_0xf252('0x38')],null))[_0xf252('0x24')](respondWithResult(_0x1fec2e,null))[_0xf252('0x37')](handleError(_0x1fec2e,null));};exports[_0xf252('0x39')]=function(_0x35d20b,_0x5311f9){return db[_0xf252('0x35')][_0xf252('0x36')]({'where':{'id':_0x35d20b[_0xf252('0x2b')]['id']}})[_0xf252('0x24')](handleEntityNotFound(_0x5311f9,null))[_0xf252('0x24')](removeEntity(_0x5311f9,null))[_0xf252('0x37')](handleError(_0x5311f9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3c2230e..4a8bba7 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 _0xfeff=['util','../../config/logger','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','utf8mb4_unicode_ci','lodash'];(function(_0x19b96a,_0x2303ca){var _0x4dcbd1=function(_0x385460){while(--_0x385460){_0x19b96a['push'](_0x19b96a['shift']());}};_0x4dcbd1(++_0x2303ca);}(_0xfeff,0xe5));var _0xffef=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xfeff[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xffef('0x0'));var util=require(_0xffef('0x1'));var logger=require(_0xffef('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xffef('0x3'));var rimraf=require(_0xffef('0x4'));var config=require(_0xffef('0x5'));var attributes=require(_0xffef('0x6'));module[_0xffef('0x7')]=function(_0xaf0432,_0x2b43ee){return _0xaf0432['define'](_0xffef('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xffef('0x9')});}; \ No newline at end of file +var _0x954d=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','api'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x954d,0x196));var _0xd954=function(_0x1b3d60,_0x51583b){_0x1b3d60=_0x1b3d60-0x0;var _0x4abc3d=_0x954d[_0x1b3d60];return _0x4abc3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd954('0x0'));var moment=require(_0xd954('0x1'));var BPromise=require(_0xd954('0x2'));var rp=require(_0xd954('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd954('0x4'));var config=require(_0xd954('0x5'));var attributes=require(_0xd954('0x6'));module['exports']=function(_0x53e385,_0x57382b){return _0x53e385[_0xd954('0x7')](_0xd954('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd954('0x9'),'collate':_0xd954('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0221a98..0a7bfc8 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 _0x0133=['ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','ChatApplication,\x20%s,\x20%s','debug'];(function(_0x40f5d4,_0x5c7478){var _0x4408b9=function(_0x367ca5){while(--_0x367ca5){_0x40f5d4['push'](_0x40f5d4['shift']());}};_0x4408b9(++_0x5c7478);}(_0x0133,0x197));var _0x3013=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x0133[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x3013('0x0'));var util=require(_0x3013('0x1'));var moment=require(_0x3013('0x2'));var BPromise=require(_0x3013('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3013('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3013('0x5'));var logger=require('../../config/logger')(_0x3013('0x6'));var config=require(_0x3013('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3013('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x577e16,_0x5a449e,_0x55e9df){return new BPromise(function(_0x5038a8,_0x22361a){return client['request'](_0x577e16,_0x55e9df)[_0x3013('0x9')](function(_0x270686){logger[_0x3013('0xa')](_0x3013('0xb'),_0x5a449e,'request\x20sent');logger[_0x3013('0xc')](_0x3013('0xd'),_0x5a449e,_0x3013('0xe'),JSON[_0x3013('0xf')](_0x270686));if(_0x270686[_0x3013('0x10')]){if(_0x270686[_0x3013('0x10')][_0x3013('0x11')]===0x1f4){logger[_0x3013('0x10')](_0x3013('0xb'),_0x5a449e,_0x270686[_0x3013('0x10')][_0x3013('0x12')]);return _0x22361a(_0x270686['error']['message']);}logger[_0x3013('0x10')](_0x3013('0xb'),_0x5a449e,_0x270686[_0x3013('0x10')][_0x3013('0x12')]);return _0x5038a8(_0x270686[_0x3013('0x10')][_0x3013('0x12')]);}else{logger[_0x3013('0xa')]('ChatApplication,\x20%s,\x20%s',_0x5a449e,_0x3013('0xe'));_0x5038a8(_0x270686[_0x3013('0x13')][_0x3013('0x12')]);}})[_0x3013('0x14')](function(_0x19eb86){logger[_0x3013('0x10')](_0x3013('0xb'),_0x5a449e,_0x19eb86);_0x22361a(_0x19eb86);});});} \ No newline at end of file +var _0xd9bd=['http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xd9bd,0x1f0));var _0xdd9b=function(_0x5ff52a,_0x6310c8){_0x5ff52a=_0x5ff52a-0x0;var _0x56a84a=_0xd9bd[_0x5ff52a];return _0x56a84a;};'use strict';var _=require('lodash');var util=require(_0xdd9b('0x0'));var moment=require(_0xdd9b('0x1'));var BPromise=require(_0xdd9b('0x2'));var rs=require(_0xdd9b('0x3'));var fs=require('fs');var Redis=require(_0xdd9b('0x4'));var db=require(_0xdd9b('0x5'))['db'];var utils=require(_0xdd9b('0x6'));var logger=require('../../config/logger')(_0xdd9b('0x7'));var config=require(_0xdd9b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdd9b('0x9')][_0xdd9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5bb7,_0x4eff81,_0xa886df){return new BPromise(function(_0x126d07,_0x239e4d){return client[_0xdd9b('0xb')](_0x3a5bb7,_0xa886df)[_0xdd9b('0xc')](function(_0x19be82){logger[_0xdd9b('0xd')](_0xdd9b('0xe'),_0x4eff81,_0xdd9b('0xf'));logger['debug'](_0xdd9b('0x10'),_0x4eff81,_0xdd9b('0xf'),JSON[_0xdd9b('0x11')](_0x19be82));if(_0x19be82[_0xdd9b('0x12')]){if(_0x19be82[_0xdd9b('0x12')][_0xdd9b('0x13')]===0x1f4){logger['error'](_0xdd9b('0xe'),_0x4eff81,_0x19be82['error'][_0xdd9b('0x14')]);return _0x239e4d(_0x19be82[_0xdd9b('0x12')][_0xdd9b('0x14')]);}logger[_0xdd9b('0x12')](_0xdd9b('0xe'),_0x4eff81,_0x19be82[_0xdd9b('0x12')][_0xdd9b('0x14')]);return _0x126d07(_0x19be82[_0xdd9b('0x12')][_0xdd9b('0x14')]);}else{logger['info'](_0xdd9b('0xe'),_0x4eff81,_0xdd9b('0xf'));_0x126d07(_0x19be82['result'][_0xdd9b('0x14')]);}})[_0xdd9b('0x15')](function(_0x1525a0){logger[_0xdd9b('0x12')](_0xdd9b('0xe'),_0x4eff81,_0x1525a0);_0x239e4d(_0x1525a0);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d2874e9..b8bb648 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 _0xebf5=['./chatApplication.controller','get','isAuthenticated','show','put','update','/:id','multer','util','path','express','Router','fs-extra','../../config/environment'];(function(_0x561a36,_0x4226d4){var _0x44353b=function(_0x5308b3){while(--_0x5308b3){_0x561a36['push'](_0x561a36['shift']());}};_0x44353b(++_0x4226d4);}(_0xebf5,0x12d));var _0x5ebf=function(_0x22dfe0,_0x43613b){_0x22dfe0=_0x22dfe0-0x0;var _0x91bbfb=_0xebf5[_0x22dfe0];return _0x91bbfb;};'use strict';var multer=require(_0x5ebf('0x0'));var util=require(_0x5ebf('0x1'));var path=require(_0x5ebf('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ebf('0x3'));var router=express[_0x5ebf('0x4')]();var fs_extra=require(_0x5ebf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ebf('0x6'));var controller=require(_0x5ebf('0x7'));router[_0x5ebf('0x8')]('/:id',auth[_0x5ebf('0x9')](),controller[_0x5ebf('0xa')]);router[_0x5ebf('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5ebf('0xc')]);router['delete'](_0x5ebf('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x436c=['../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0x436c,0x8a));var _0xc436=function(_0x4d8261,_0x2b1c12){_0x4d8261=_0x4d8261-0x0;var _0x2a56a2=_0x436c[_0x4d8261];return _0x2a56a2;};'use strict';var multer=require(_0xc436('0x0'));var util=require(_0xc436('0x1'));var path=require(_0xc436('0x2'));var timeout=require(_0xc436('0x3'));var express=require('express');var router=express[_0xc436('0x4')]();var fs_extra=require(_0xc436('0x5'));var auth=require(_0xc436('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc436('0x7'));router[_0xc436('0x8')](_0xc436('0x9'),auth[_0xc436('0xa')](),controller[_0xc436('0xb')]);router[_0xc436('0xc')](_0xc436('0x9'),auth[_0xc436('0xa')](),controller[_0xc436('0xd')]);router[_0xc436('0xe')]('/:id',auth[_0xc436('0xa')](),controller[_0xc436('0xf')]);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 34447b5..6422256 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 _0x0514=['sequelize','STRING'];(function(_0x820291,_0x121322){var _0x338d05=function(_0x1a1c9c){while(--_0x1a1c9c){_0x820291['push'](_0x820291['shift']());}};_0x338d05(++_0x121322);}(_0x0514,0x1f0));var _0x4051=function(_0x171fb1,_0x57c30a){_0x171fb1=_0x171fb1-0x0;var _0x1ca28c=_0x0514[_0x171fb1];return _0x1ca28c;};'use strict';var Sequelize=require(_0x4051('0x0'));module['exports']={'name':{'type':Sequelize[_0x4051('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4051('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x1261=['exports','STRING','BOOLEAN'];(function(_0x51be52,_0x15aa89){var _0x16ac7f=function(_0x4dbafe){while(--_0x4dbafe){_0x51be52['push'](_0x51be52['shift']());}};_0x16ac7f(++_0x15aa89);}(_0x1261,0x144));var _0x1126=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x1261[_0x26659f];return _0x42667f;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'name':{'type':Sequelize[_0x1126('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1126('0x1')]},'write':{'type':Sequelize[_0x1126('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 54e5ba2..a9a7d89 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 _0x3797=['count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','limit'];(function(_0x49b9fb,_0x3a49f6){var _0x19742e=function(_0x30b19b){while(--_0x30b19b){_0x49b9fb['push'](_0x49b9fb['shift']());}};_0x19742e(++_0x3a49f6);}(_0x3797,0x164));var _0x7379=function(_0x232d32,_0x3ccf6d){_0x232d32=_0x232d32-0x0;var _0x163cf2=_0x3797[_0x232d32];return _0x163cf2;};'use strict';var emlformat=require(_0x7379('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7379('0x1'));var jsonpatch=require(_0x7379('0x2'));var rp=require(_0x7379('0x3'));var moment=require(_0x7379('0x4'));var BPromise=require(_0x7379('0x5'));var Mustache=require('mustache');var util=require(_0x7379('0x6'));var path=require('path');var sox=require(_0x7379('0x7'));var csv=require(_0x7379('0x8'));var ejs=require(_0x7379('0x9'));var fs=require('fs');var fs_extra=require(_0x7379('0xa'));var _=require(_0x7379('0xb'));var squel=require(_0x7379('0xc'));var crypto=require(_0x7379('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7379('0xe'));var toCsv=require(_0x7379('0x8'));var querystring=require('querystring');var Papa=require(_0x7379('0xf'));var Redis=require(_0x7379('0x10'));var authService=require(_0x7379('0x11'));var qs=require(_0x7379('0x12'));var as=require(_0x7379('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7379('0x14'))(_0x7379('0x15'));var utils=require(_0x7379('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7379('0x17'))['db'];config[_0x7379('0x18')]=_[_0x7379('0x19')](config[_0x7379('0x18')],{'host':_0x7379('0x1a'),'port':0x18eb});var socket=require(_0x7379('0x1b'))(new Redis(config[_0x7379('0x18')]));require(_0x7379('0x1c'))[_0x7379('0x1d')](socket);function respondWithStatusCode(_0x495d24,_0x41d35f){_0x41d35f=_0x41d35f||0xcc;return function(_0x55bf95){if(_0x55bf95){return _0x495d24[_0x7379('0x1e')](_0x41d35f);}return _0x495d24['status'](_0x41d35f)[_0x7379('0x1f')]();};}function respondWithResult(_0x5db331,_0x1fc4d4){_0x1fc4d4=_0x1fc4d4||0xc8;return function(_0x1cdff3){if(_0x1cdff3){return _0x5db331[_0x7379('0x20')](_0x1fc4d4)[_0x7379('0x21')](_0x1cdff3);}};}function respondWithFilteredResult(_0x305501,_0x591a32){return function(_0x8d6ef9){if(_0x8d6ef9){var _0x4f5ab7=typeof _0x591a32[_0x7379('0x22')]==='undefined'&&typeof _0x591a32[_0x7379('0x23')]==='undefined';var _0x599317=_0x8d6ef9['count'];var _0x1c63b2=_0x4f5ab7?0x0:_0x591a32[_0x7379('0x22')];var _0x4208af=_0x4f5ab7?_0x8d6ef9[_0x7379('0x24')]:_0x591a32[_0x7379('0x22')]+_0x591a32[_0x7379('0x23')];var _0x33e92e;if(_0x4208af>=_0x599317){_0x4208af=_0x599317;_0x33e92e=0xc8;}else{_0x33e92e=0xce;}_0x305501[_0x7379('0x20')](_0x33e92e);return _0x305501[_0x7379('0x25')](_0x7379('0x26'),_0x1c63b2+'-'+_0x4208af+'/'+_0x599317)['json'](_0x8d6ef9);}return null;};}function patchUpdates(_0x55fbfd){return function(_0x394509){try{jsonpatch[_0x7379('0x27')](_0x394509,_0x55fbfd,!![]);}catch(_0x358c43){return BPromise[_0x7379('0x28')](_0x358c43);}return _0x394509[_0x7379('0x29')]();};}function saveUpdates(_0x3d4350,_0x1b749f){return function(_0x5c8756){if(_0x5c8756){return _0x5c8756[_0x7379('0x2a')](_0x3d4350)[_0x7379('0x2b')](function(_0x31eead){return _0x31eead;});}return null;};}function removeEntity(_0x34a68f,_0x541c33){return function(_0x575832){if(_0x575832){return _0x575832[_0x7379('0x2c')]()[_0x7379('0x2b')](function(){_0x34a68f[_0x7379('0x20')](0xcc)[_0x7379('0x1f')]();});}};}function handleEntityNotFound(_0x196900,_0x5e0207){return function(_0x7c0630){if(!_0x7c0630){_0x196900['sendStatus'](0x194);}return _0x7c0630;};}function handleError(_0x11a9d2,_0x170c23){_0x170c23=_0x170c23||0x1f4;return function(_0x2ac48c){logger['error'](_0x2ac48c[_0x7379('0x2d')]);if(_0x2ac48c[_0x7379('0x2e')]){delete _0x2ac48c[_0x7379('0x2e')];}_0x11a9d2[_0x7379('0x20')](_0x170c23)[_0x7379('0x2f')](_0x2ac48c);};}exports[_0x7379('0x30')]=function(_0x5f3787,_0x3f7525){var _0x1ca092={},_0x2fd6f8={},_0x2ffa03={'count':0x0,'rows':[]};var _0x571334=_[_0x7379('0x31')](db[_0x7379('0x32')][_0x7379('0x33')],function(_0x32d9bb){return{'name':_0x32d9bb[_0x7379('0x34')],'type':_0x32d9bb[_0x7379('0x35')]['key']};});_0x2fd6f8[_0x7379('0x36')]=_['map'](_0x571334,'name');_0x2fd6f8[_0x7379('0x37')]=_[_0x7379('0x38')](_0x5f3787['query']);_0x2fd6f8['filters']=_[_0x7379('0x39')](_0x2fd6f8[_0x7379('0x36')],_0x2fd6f8[_0x7379('0x37')]);_0x1ca092[_0x7379('0x3a')]=_[_0x7379('0x39')](_0x2fd6f8[_0x7379('0x36')],qs[_0x7379('0x3b')](_0x5f3787[_0x7379('0x37')][_0x7379('0x3b')]));_0x1ca092[_0x7379('0x3a')]=_0x1ca092[_0x7379('0x3a')][_0x7379('0x3c')]?_0x1ca092[_0x7379('0x3a')]:_0x2fd6f8[_0x7379('0x36')];if(!_0x5f3787[_0x7379('0x37')]['hasOwnProperty'](_0x7379('0x3d'))){_0x1ca092[_0x7379('0x23')]=qs[_0x7379('0x23')](_0x5f3787[_0x7379('0x37')][_0x7379('0x23')]);_0x1ca092['offset']=qs['offset'](_0x5f3787[_0x7379('0x37')]['offset']);}_0x1ca092[_0x7379('0x3e')]=qs['sort'](_0x5f3787[_0x7379('0x37')][_0x7379('0x3f')]);_0x1ca092['where']=qs[_0x7379('0x40')](_[_0x7379('0x41')](_0x5f3787['query'],_0x2fd6f8[_0x7379('0x40')]),_0x571334);if(_0x5f3787['query'][_0x7379('0x42')]){_0x1ca092['where']=_[_0x7379('0x43')](_0x1ca092[_0x7379('0x44')],{'$or':_[_0x7379('0x31')](_0x571334,function(_0x38412b){if(_0x38412b[_0x7379('0x35')]!==_0x7379('0x45')){var _0x273e96={};_0x273e96[_0x38412b[_0x7379('0x2e')]]={'$like':'%'+_0x5f3787[_0x7379('0x37')][_0x7379('0x42')]+'%'};return _0x273e96;}})});}_0x1ca092=_['merge']({},_0x1ca092,_0x5f3787['options']);var _0x189646={'where':_0x1ca092[_0x7379('0x44')]};return db['ChatGroup'][_0x7379('0x24')](_0x189646)[_0x7379('0x2b')](function(_0x42e968){_0x2ffa03[_0x7379('0x24')]=_0x42e968;if(_0x5f3787[_0x7379('0x37')][_0x7379('0x46')]){_0x1ca092[_0x7379('0x47')]=[{'all':!![]}];}return db[_0x7379('0x32')][_0x7379('0x48')](_0x1ca092);})['then'](function(_0x1716f9){_0x2ffa03[_0x7379('0x49')]=_0x1716f9;return _0x2ffa03;})[_0x7379('0x2b')](respondWithFilteredResult(_0x3f7525,_0x1ca092))['catch'](handleError(_0x3f7525,null));};exports[_0x7379('0x4a')]=function(_0x28b3cb,_0x227e9f){var _0x1eeef6={'raw':!![],'where':{'id':_0x28b3cb[_0x7379('0x4b')]['id']}},_0x1ba726={};_0x1ba726[_0x7379('0x36')]=_[_0x7379('0x38')](db[_0x7379('0x32')][_0x7379('0x33')]);_0x1ba726['query']=_[_0x7379('0x38')](_0x28b3cb[_0x7379('0x37')]);_0x1ba726['filters']=_[_0x7379('0x39')](_0x1ba726[_0x7379('0x36')],_0x1ba726[_0x7379('0x37')]);_0x1eeef6[_0x7379('0x3a')]=_[_0x7379('0x39')](_0x1ba726['model'],qs[_0x7379('0x3b')](_0x28b3cb[_0x7379('0x37')][_0x7379('0x3b')]));_0x1eeef6[_0x7379('0x3a')]=_0x1eeef6['attributes']['length']?_0x1eeef6['attributes']:_0x1ba726[_0x7379('0x36')];if(_0x28b3cb[_0x7379('0x37')]['includeAll']){_0x1eeef6[_0x7379('0x47')]=[{'all':!![]}];}_0x1eeef6=_[_0x7379('0x43')]({},_0x1eeef6,_0x28b3cb[_0x7379('0x4c')]);return db['ChatGroup']['find'](_0x1eeef6)[_0x7379('0x2b')](handleEntityNotFound(_0x227e9f,null))[_0x7379('0x2b')](respondWithResult(_0x227e9f,null))[_0x7379('0x4d')](handleError(_0x227e9f,null));};exports[_0x7379('0x4e')]=function(_0x244caf,_0x5bce17){return db[_0x7379('0x32')]['create'](_0x244caf[_0x7379('0x4f')],{})[_0x7379('0x2b')](respondWithResult(_0x5bce17,0xc9))[_0x7379('0x4d')](handleError(_0x5bce17,null));};exports['update']=function(_0x2e7f37,_0x3a5dd9){if(_0x2e7f37['body']['id']){delete _0x2e7f37['body']['id'];}return db['ChatGroup'][_0x7379('0x50')]({'where':{'id':_0x2e7f37[_0x7379('0x4b')]['id']}})[_0x7379('0x2b')](handleEntityNotFound(_0x3a5dd9,null))[_0x7379('0x2b')](saveUpdates(_0x2e7f37[_0x7379('0x4f')],null))[_0x7379('0x2b')](respondWithResult(_0x3a5dd9,null))[_0x7379('0x4d')](handleError(_0x3a5dd9,null));};exports[_0x7379('0x2c')]=function(_0x11141d,_0x23b92e){return db['ChatGroup'][_0x7379('0x50')]({'where':{'id':_0x11141d[_0x7379('0x4b')]['id']}})['then'](handleEntityNotFound(_0x23b92e,null))[_0x7379('0x2b')](removeEntity(_0x23b92e,null))[_0x7379('0x4d')](handleError(_0x23b92e,null));};exports[_0x7379('0x51')]=function(_0x313375,_0x5efe69){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x5efe69,null))[_0x7379('0x4d')](handleError(_0x5efe69,null));};exports[_0x7379('0x52')]=function(_0x38da20,_0x1ff82e,_0x5e266e){return db['ChatInternalMessage'][_0x7379('0x24')]({'where':{'ChatGroupId':_0x38da20[_0x7379('0x4b')]['id'],'ToId':_0x38da20[_0x7379('0x53')]['id'],'read':![]}})['then'](function(_0x53bb2a){return{'id':_[_0x7379('0x54')](_0x38da20[_0x7379('0x4b')]['id']),'count':_0x53bb2a};})[_0x7379('0x2b')](respondWithResult(_0x1ff82e,null))[_0x7379('0x4d')](handleError(_0x1ff82e,null));};exports[_0x7379('0x55')]=function(_0x34421e,_0x4beeb3,_0x102df5){return db[_0x7379('0x32')][_0x7379('0x50')]({'where':{'id':_0x34421e[_0x7379('0x4b')]['id']}})[_0x7379('0x2b')](handleEntityNotFound(_0x4beeb3,null))[_0x7379('0x2b')](function(_0x273a8c){if(_0x273a8c){return _0x273a8c[_0x7379('0x55')](_0x34421e[_0x7379('0x4f')][_0x7379('0x56')],_[_0x7379('0x57')](_0x34421e[_0x7379('0x4f')],[_0x7379('0x56'),'id'])||{});}})[_0x7379('0x2b')](respondWithResult(_0x4beeb3,null))[_0x7379('0x4d')](handleError(_0x4beeb3,null));};exports[_0x7379('0x58')]=function(_0x1f5771,_0x2abb75,_0x53b188){var _0x3318b5={};var _0x4252f0={};var _0x45c9b3;var _0x323055;return db[_0x7379('0x32')][_0x7379('0x59')]({'where':{'id':_0x1f5771[_0x7379('0x4b')]['id']}})[_0x7379('0x2b')](handleEntityNotFound(_0x2abb75,null))['then'](function(_0x11d107){if(_0x11d107){_0x45c9b3=_0x11d107;_0x4252f0[_0x7379('0x36')]=_[_0x7379('0x38')](db['User'][_0x7379('0x33')]);_0x4252f0[_0x7379('0x37')]=_[_0x7379('0x38')](_0x1f5771['query']);_0x4252f0[_0x7379('0x40')]=_[_0x7379('0x39')](_0x4252f0['model'],_0x4252f0[_0x7379('0x37')]);_0x3318b5['attributes']=_['intersection'](_0x4252f0['model'],qs[_0x7379('0x3b')](_0x1f5771[_0x7379('0x37')][_0x7379('0x3b')]));_0x3318b5[_0x7379('0x3a')]=_0x3318b5[_0x7379('0x3a')][_0x7379('0x3c')]?_0x3318b5[_0x7379('0x3a')]:_0x4252f0['model'];_0x3318b5[_0x7379('0x3e')]=qs[_0x7379('0x3f')](_0x1f5771['query']['sort']);_0x3318b5[_0x7379('0x44')]=qs[_0x7379('0x40')](_[_0x7379('0x41')](_0x1f5771[_0x7379('0x37')],_0x4252f0[_0x7379('0x40')]));if(_0x1f5771[_0x7379('0x37')][_0x7379('0x42')]){_0x3318b5[_0x7379('0x44')]=_[_0x7379('0x43')](_0x3318b5[_0x7379('0x44')],{'$or':_[_0x7379('0x31')](_0x3318b5['attributes'],function(_0x4b7961){var _0x198ae8={};_0x198ae8[_0x4b7961]={'$like':'%'+_0x1f5771[_0x7379('0x37')][_0x7379('0x42')]+'%'};return _0x198ae8;})});}_0x3318b5=_[_0x7379('0x43')]({},_0x3318b5,_0x1f5771[_0x7379('0x4c')]);return _0x45c9b3[_0x7379('0x58')](_0x3318b5);}})[_0x7379('0x2b')](function(_0x8b5780){if(_0x8b5780){_0x323055=_0x8b5780[_0x7379('0x3c')];if(!_0x1f5771['query']['hasOwnProperty'](_0x7379('0x3d'))){_0x3318b5[_0x7379('0x23')]=qs[_0x7379('0x23')](_0x1f5771[_0x7379('0x37')]['limit']);_0x3318b5[_0x7379('0x22')]=qs[_0x7379('0x22')](_0x1f5771[_0x7379('0x37')][_0x7379('0x22')]);}return _0x45c9b3[_0x7379('0x58')](_0x3318b5);}})[_0x7379('0x2b')](function(_0x387ba9){if(_0x387ba9){return _0x387ba9?{'count':_0x323055,'rows':_0x387ba9}:null;}})[_0x7379('0x2b')](respondWithResult(_0x2abb75,null))['catch'](handleError(_0x2abb75,null));};exports[_0x7379('0x5a')]=function(_0xf512c0,_0x207649,_0x51742a){return db['ChatGroup'][_0x7379('0x50')]({'where':{'id':_0xf512c0[_0x7379('0x4b')]['id']}})[_0x7379('0x2b')](handleEntityNotFound(_0x207649,null))[_0x7379('0x2b')](function(_0x1d1246){if(_0x1d1246){return _0x1d1246[_0x7379('0x5a')](_0xf512c0[_0x7379('0x37')]['ids']);}})[_0x7379('0x2b')](respondWithStatusCode(_0x207649,null))[_0x7379('0x4d')](handleError(_0x207649,null));};exports[_0x7379('0x5b')]=function(_0x17ca5a,_0x1c059e,_0x4caa38){if(_0x17ca5a['body']['id']){delete _0x17ca5a[_0x7379('0x4f')]['id'];}return db[_0x7379('0x32')]['find']({'where':{'id':_0x17ca5a['params']['id']}})[_0x7379('0x2b')](handleEntityNotFound(_0x1c059e,null))[_0x7379('0x2b')](function(_0xe343a5){if(_0xe343a5){_0x17ca5a['body']['ChatGroupId']=_0xe343a5['id'];return db[_0x7379('0x5c')][_0x7379('0x4e')](_0x17ca5a[_0x7379('0x4f')]);}})['then'](respondWithResult(_0x1c059e,null))[_0x7379('0x4d')](handleError(_0x1c059e,null));};exports[_0x7379('0x5d')]=function(_0xc1657d,_0x1e24e9,_0x2a342e){var _0x157494={};var _0x64d288={};var _0x24e47a;var _0x154197;return db['ChatGroup'][_0x7379('0x59')]({'where':{'id':_0xc1657d[_0x7379('0x4b')]['id']}})[_0x7379('0x2b')](handleEntityNotFound(_0x1e24e9,null))[_0x7379('0x2b')](function(_0x558fd6){if(_0x558fd6){_0x24e47a=_0x558fd6;_0x64d288[_0x7379('0x36')]=_[_0x7379('0x38')](db[_0x7379('0x5c')][_0x7379('0x33')]);_0x64d288[_0x7379('0x37')]=_[_0x7379('0x38')](_0xc1657d['query']);_0x64d288[_0x7379('0x40')]=_['intersection'](_0x64d288[_0x7379('0x36')],_0x64d288[_0x7379('0x37')]);_0x157494[_0x7379('0x3a')]=_[_0x7379('0x39')](_0x64d288[_0x7379('0x36')],qs[_0x7379('0x3b')](_0xc1657d[_0x7379('0x37')][_0x7379('0x3b')]));_0x157494['attributes']=_0x157494[_0x7379('0x3a')][_0x7379('0x3c')]?_0x157494[_0x7379('0x3a')]:_0x64d288[_0x7379('0x36')];_0x157494[_0x7379('0x3e')]=qs[_0x7379('0x3f')](_0xc1657d[_0x7379('0x37')][_0x7379('0x3f')]);_0x157494[_0x7379('0x44')]=qs[_0x7379('0x40')](_[_0x7379('0x41')](_0xc1657d['query'],_0x64d288[_0x7379('0x40')]));if(_0xc1657d['query']['filter']){_0x157494[_0x7379('0x44')]=_[_0x7379('0x43')](_0x157494[_0x7379('0x44')],{'$or':_[_0x7379('0x31')](_0x157494[_0x7379('0x3a')],function(_0x8de295){var _0x56141d={};_0x56141d[_0x8de295]={'$like':'%'+_0xc1657d[_0x7379('0x37')][_0x7379('0x42')]+'%'};return _0x56141d;})});}if(_0xc1657d[_0x7379('0x37')][_0x7379('0x5e')]){var _0x586139=_0xc1657d[_0x7379('0x37')]['$gte']['split'](',');var _0x3db31a={};_0x3db31a[_0x586139[0x0]]={'$gte':moment(_0x586139[0x1])[_0x7379('0x5f')](_0x7379('0x60'))};_0x157494[_0x7379('0x44')]=_[_0x7379('0x43')](_0x157494[_0x7379('0x44')],_0x3db31a);}_0x157494=_[_0x7379('0x43')]({},_0x157494,_0xc1657d[_0x7379('0x4c')]);return _0x24e47a[_0x7379('0x5d')](_0x157494);}})[_0x7379('0x2b')](function(_0x426e34){if(_0x426e34){_0x154197=_0x426e34['length'];if(!_0xc1657d['query'][_0x7379('0x61')](_0x7379('0x3d'))){_0x157494[_0x7379('0x23')]=qs[_0x7379('0x23')](_0xc1657d[_0x7379('0x37')][_0x7379('0x23')]);_0x157494[_0x7379('0x22')]=qs['offset'](_0xc1657d[_0x7379('0x37')]['offset']);}return _0x24e47a[_0x7379('0x5d')](_0x157494);}})[_0x7379('0x2b')](function(_0x39ef80){if(_0x39ef80){return _0x39ef80?{'count':_0x154197,'rows':_0x39ef80}:null;}})[_0x7379('0x2b')](respondWithResult(_0x1e24e9,null))['catch'](handleError(_0x1e24e9,null));}; \ No newline at end of file +var _0x88f2=['ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','reject','update','destroy','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','ChatGroup','findAll','rows','catch','params','intersection','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','User','getMembers','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x3b8e87,_0x20af08){var _0x242a76=function(_0x1ad9fa){while(--_0x1ad9fa){_0x3b8e87['push'](_0x3b8e87['shift']());}};_0x242a76(++_0x20af08);}(_0x88f2,0x1c7));var _0x288f=function(_0xd124af,_0x4b2563){_0xd124af=_0xd124af-0x0;var _0x4228d3=_0x88f2[_0xd124af];return _0x4228d3;};'use strict';var emlformat=require(_0x288f('0x0'));var rimraf=require(_0x288f('0x1'));var zipdir=require(_0x288f('0x2'));var jsonpatch=require(_0x288f('0x3'));var rp=require('request-promise');var moment=require(_0x288f('0x4'));var BPromise=require(_0x288f('0x5'));var Mustache=require(_0x288f('0x6'));var util=require('util');var path=require(_0x288f('0x7'));var sox=require(_0x288f('0x8'));var csv=require(_0x288f('0x9'));var ejs=require(_0x288f('0xa'));var fs=require('fs');var fs_extra=require(_0x288f('0xb'));var _=require('lodash');var squel=require(_0x288f('0xc'));var crypto=require('crypto');var jsforce=require(_0x288f('0xd'));var deskjs=require(_0x288f('0xe'));var toCsv=require(_0x288f('0x9'));var querystring=require(_0x288f('0xf'));var Papa=require('papaparse');var Redis=require(_0x288f('0x10'));var authService=require(_0x288f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x288f('0x12'));var hardwareService=require(_0x288f('0x13'));var logger=require(_0x288f('0x14'))(_0x288f('0x15'));var utils=require(_0x288f('0x16'));var config=require(_0x288f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x288f('0x18'))['db'];config['redis']=_[_0x288f('0x19')](config[_0x288f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x288f('0x1b'))(new Redis(config[_0x288f('0x1a')]));require('./chatGroup.socket')[_0x288f('0x1c')](socket);function respondWithStatusCode(_0x4a0a69,_0x3be335){_0x3be335=_0x3be335||0xcc;return function(_0x109440){if(_0x109440){return _0x4a0a69['sendStatus'](_0x3be335);}return _0x4a0a69[_0x288f('0x1d')](_0x3be335)[_0x288f('0x1e')]();};}function respondWithResult(_0x3802f9,_0x48647d){_0x48647d=_0x48647d||0xc8;return function(_0xf9725){if(_0xf9725){return _0x3802f9[_0x288f('0x1d')](_0x48647d)[_0x288f('0x1f')](_0xf9725);}};}function respondWithFilteredResult(_0x3a555e,_0x11583a){return function(_0x5b6727){if(_0x5b6727){var _0x24ecfd=typeof _0x11583a[_0x288f('0x20')]===_0x288f('0x21')&&typeof _0x11583a[_0x288f('0x22')]===_0x288f('0x21');var _0x5a6248=_0x5b6727[_0x288f('0x23')];var _0x2b49d6=_0x24ecfd?0x0:_0x11583a['offset'];var _0x9762ec=_0x24ecfd?_0x5b6727[_0x288f('0x23')]:_0x11583a['offset']+_0x11583a[_0x288f('0x22')];var _0x5bd299;if(_0x9762ec>=_0x5a6248){_0x9762ec=_0x5a6248;_0x5bd299=0xc8;}else{_0x5bd299=0xce;}_0x3a555e[_0x288f('0x1d')](_0x5bd299);return _0x3a555e['set']('Content-Range',_0x2b49d6+'-'+_0x9762ec+'/'+_0x5a6248)[_0x288f('0x1f')](_0x5b6727);}return null;};}function patchUpdates(_0x946953){return function(_0x2c9275){try{jsonpatch['apply'](_0x2c9275,_0x946953,!![]);}catch(_0x340030){return BPromise[_0x288f('0x24')](_0x340030);}return _0x2c9275['save']();};}function saveUpdates(_0x3e2b06,_0x12b084){return function(_0x34d59c){if(_0x34d59c){return _0x34d59c[_0x288f('0x25')](_0x3e2b06)['then'](function(_0x2c0fdb){return _0x2c0fdb;});}return null;};}function removeEntity(_0x4a6a62,_0x3377c4){return function(_0x34bf30){if(_0x34bf30){return _0x34bf30[_0x288f('0x26')]()[_0x288f('0x27')](function(){_0x4a6a62[_0x288f('0x1d')](0xcc)[_0x288f('0x1e')]();});}};}function handleEntityNotFound(_0x434163,_0x2ca24b){return function(_0x5abd5d){if(!_0x5abd5d){_0x434163[_0x288f('0x28')](0x194);}return _0x5abd5d;};}function handleError(_0x17879e,_0xb43bb0){_0xb43bb0=_0xb43bb0||0x1f4;return function(_0x15bcd1){logger['error'](_0x15bcd1['stack']);if(_0x15bcd1[_0x288f('0x29')]){delete _0x15bcd1['name'];}_0x17879e[_0x288f('0x1d')](_0xb43bb0)[_0x288f('0x2a')](_0x15bcd1);};}exports[_0x288f('0x2b')]=function(_0x31e15b,_0x44fc19){var _0x32fb25={},_0x2be33a={},_0x4154de={'count':0x0,'rows':[]};var _0x2148f0=_[_0x288f('0x2c')](db['ChatGroup'][_0x288f('0x2d')],function(_0x260bd0){return{'name':_0x260bd0[_0x288f('0x2e')],'type':_0x260bd0[_0x288f('0x2f')][_0x288f('0x30')]};});_0x2be33a['model']=_[_0x288f('0x2c')](_0x2148f0,_0x288f('0x29'));_0x2be33a['query']=_[_0x288f('0x31')](_0x31e15b[_0x288f('0x32')]);_0x2be33a['filters']=_['intersection'](_0x2be33a['model'],_0x2be33a[_0x288f('0x32')]);_0x32fb25['attributes']=_['intersection'](_0x2be33a[_0x288f('0x33')],qs[_0x288f('0x34')](_0x31e15b['query']['fields']));_0x32fb25[_0x288f('0x35')]=_0x32fb25[_0x288f('0x35')][_0x288f('0x36')]?_0x32fb25[_0x288f('0x35')]:_0x2be33a[_0x288f('0x33')];if(!_0x31e15b[_0x288f('0x32')][_0x288f('0x37')](_0x288f('0x38'))){_0x32fb25['limit']=qs[_0x288f('0x22')](_0x31e15b[_0x288f('0x32')][_0x288f('0x22')]);_0x32fb25[_0x288f('0x20')]=qs[_0x288f('0x20')](_0x31e15b[_0x288f('0x32')][_0x288f('0x20')]);}_0x32fb25[_0x288f('0x39')]=qs['sort'](_0x31e15b[_0x288f('0x32')][_0x288f('0x3a')]);_0x32fb25['where']=qs[_0x288f('0x3b')](_[_0x288f('0x3c')](_0x31e15b[_0x288f('0x32')],_0x2be33a[_0x288f('0x3b')]),_0x2148f0);if(_0x31e15b['query'][_0x288f('0x3d')]){_0x32fb25[_0x288f('0x3e')]=_[_0x288f('0x3f')](_0x32fb25[_0x288f('0x3e')],{'$or':_[_0x288f('0x2c')](_0x2148f0,function(_0xfe16a0){if(_0xfe16a0[_0x288f('0x2f')]!=='VIRTUAL'){var _0x4a8b25={};_0x4a8b25[_0xfe16a0[_0x288f('0x29')]]={'$like':'%'+_0x31e15b[_0x288f('0x32')][_0x288f('0x3d')]+'%'};return _0x4a8b25;}})});}_0x32fb25=_['merge']({},_0x32fb25,_0x31e15b[_0x288f('0x40')]);var _0x783a6b={'where':_0x32fb25['where']};return db['ChatGroup'][_0x288f('0x23')](_0x783a6b)[_0x288f('0x27')](function(_0x308880){_0x4154de[_0x288f('0x23')]=_0x308880;if(_0x31e15b[_0x288f('0x32')][_0x288f('0x41')]){_0x32fb25['include']=[{'all':!![]}];}return db[_0x288f('0x42')][_0x288f('0x43')](_0x32fb25);})[_0x288f('0x27')](function(_0x26f2b0){_0x4154de[_0x288f('0x44')]=_0x26f2b0;return _0x4154de;})[_0x288f('0x27')](respondWithFilteredResult(_0x44fc19,_0x32fb25))[_0x288f('0x45')](handleError(_0x44fc19,null));};exports['show']=function(_0x1e6f62,_0x47a483){var _0x34e5b9={'raw':!![],'where':{'id':_0x1e6f62[_0x288f('0x46')]['id']}},_0x41fcbb={};_0x41fcbb[_0x288f('0x33')]=_[_0x288f('0x31')](db[_0x288f('0x42')][_0x288f('0x2d')]);_0x41fcbb['query']=_['keys'](_0x1e6f62[_0x288f('0x32')]);_0x41fcbb[_0x288f('0x3b')]=_['intersection'](_0x41fcbb[_0x288f('0x33')],_0x41fcbb[_0x288f('0x32')]);_0x34e5b9[_0x288f('0x35')]=_[_0x288f('0x47')](_0x41fcbb['model'],qs[_0x288f('0x34')](_0x1e6f62[_0x288f('0x32')][_0x288f('0x34')]));_0x34e5b9['attributes']=_0x34e5b9[_0x288f('0x35')]['length']?_0x34e5b9[_0x288f('0x35')]:_0x41fcbb['model'];if(_0x1e6f62['query'][_0x288f('0x41')]){_0x34e5b9['include']=[{'all':!![]}];}_0x34e5b9=_[_0x288f('0x3f')]({},_0x34e5b9,_0x1e6f62[_0x288f('0x40')]);return db[_0x288f('0x42')][_0x288f('0x48')](_0x34e5b9)['then'](handleEntityNotFound(_0x47a483,null))[_0x288f('0x27')](respondWithResult(_0x47a483,null))[_0x288f('0x45')](handleError(_0x47a483,null));};exports[_0x288f('0x49')]=function(_0x1c23a2,_0x892824){return db[_0x288f('0x42')][_0x288f('0x49')](_0x1c23a2[_0x288f('0x4a')],{})[_0x288f('0x27')](respondWithResult(_0x892824,0xc9))['catch'](handleError(_0x892824,null));};exports[_0x288f('0x25')]=function(_0x382d75,_0x51f00a){if(_0x382d75[_0x288f('0x4a')]['id']){delete _0x382d75[_0x288f('0x4a')]['id'];}return db[_0x288f('0x42')][_0x288f('0x48')]({'where':{'id':_0x382d75[_0x288f('0x46')]['id']}})[_0x288f('0x27')](handleEntityNotFound(_0x51f00a,null))[_0x288f('0x27')](saveUpdates(_0x382d75['body'],null))[_0x288f('0x27')](respondWithResult(_0x51f00a,null))[_0x288f('0x45')](handleError(_0x51f00a,null));};exports['destroy']=function(_0x4a7a6c,_0x55d079){return db[_0x288f('0x42')][_0x288f('0x48')]({'where':{'id':_0x4a7a6c[_0x288f('0x46')]['id']}})['then'](handleEntityNotFound(_0x55d079,null))[_0x288f('0x27')](removeEntity(_0x55d079,null))['catch'](handleError(_0x55d079,null));};exports[_0x288f('0x4b')]=function(_0xf15634,_0x578c19){return db[_0x288f('0x42')][_0x288f('0x4b')]()[_0x288f('0x27')](respondWithResult(_0x578c19,null))[_0x288f('0x45')](handleError(_0x578c19,null));};exports[_0x288f('0x4c')]=function(_0x27156e,_0x314209,_0x1f50ce){return db[_0x288f('0x4d')]['count']({'where':{'ChatGroupId':_0x27156e[_0x288f('0x46')]['id'],'ToId':_0x27156e[_0x288f('0x4e')]['id'],'read':![]}})[_0x288f('0x27')](function(_0x19dde8){return{'id':_[_0x288f('0x4f')](_0x27156e[_0x288f('0x46')]['id']),'count':_0x19dde8};})['then'](respondWithResult(_0x314209,null))['catch'](handleError(_0x314209,null));};exports['addMembers']=function(_0xe7531a,_0x1f489c,_0x543447){return db[_0x288f('0x42')][_0x288f('0x48')]({'where':{'id':_0xe7531a['params']['id']}})[_0x288f('0x27')](handleEntityNotFound(_0x1f489c,null))['then'](function(_0x4b3460){if(_0x4b3460){return _0x4b3460[_0x288f('0x50')](_0xe7531a['body']['ids'],_[_0x288f('0x51')](_0xe7531a['body'],[_0x288f('0x52'),'id'])||{});}})[_0x288f('0x27')](respondWithResult(_0x1f489c,null))[_0x288f('0x45')](handleError(_0x1f489c,null));};exports['getMembers']=function(_0xf85108,_0x133f86,_0x44f00a){var _0x24949a={};var _0x3d0561={};var _0x600f03;var _0x52f1df;return db['ChatGroup'][_0x288f('0x53')]({'where':{'id':_0xf85108[_0x288f('0x46')]['id']}})['then'](handleEntityNotFound(_0x133f86,null))['then'](function(_0x2d602b){if(_0x2d602b){_0x600f03=_0x2d602b;_0x3d0561['model']=_[_0x288f('0x31')](db[_0x288f('0x54')][_0x288f('0x2d')]);_0x3d0561[_0x288f('0x32')]=_[_0x288f('0x31')](_0xf85108[_0x288f('0x32')]);_0x3d0561[_0x288f('0x3b')]=_['intersection'](_0x3d0561[_0x288f('0x33')],_0x3d0561[_0x288f('0x32')]);_0x24949a[_0x288f('0x35')]=_[_0x288f('0x47')](_0x3d0561['model'],qs[_0x288f('0x34')](_0xf85108[_0x288f('0x32')]['fields']));_0x24949a['attributes']=_0x24949a[_0x288f('0x35')]['length']?_0x24949a[_0x288f('0x35')]:_0x3d0561['model'];_0x24949a['order']=qs[_0x288f('0x3a')](_0xf85108[_0x288f('0x32')][_0x288f('0x3a')]);_0x24949a[_0x288f('0x3e')]=qs[_0x288f('0x3b')](_['pick'](_0xf85108[_0x288f('0x32')],_0x3d0561[_0x288f('0x3b')]));if(_0xf85108[_0x288f('0x32')][_0x288f('0x3d')]){_0x24949a['where']=_['merge'](_0x24949a[_0x288f('0x3e')],{'$or':_[_0x288f('0x2c')](_0x24949a[_0x288f('0x35')],function(_0x56136e){var _0x135b48={};_0x135b48[_0x56136e]={'$like':'%'+_0xf85108[_0x288f('0x32')][_0x288f('0x3d')]+'%'};return _0x135b48;})});}_0x24949a=_['merge']({},_0x24949a,_0xf85108[_0x288f('0x40')]);return _0x600f03['getMembers'](_0x24949a);}})[_0x288f('0x27')](function(_0x4d1a70){if(_0x4d1a70){_0x52f1df=_0x4d1a70[_0x288f('0x36')];if(!_0xf85108[_0x288f('0x32')]['hasOwnProperty'](_0x288f('0x38'))){_0x24949a[_0x288f('0x22')]=qs[_0x288f('0x22')](_0xf85108[_0x288f('0x32')]['limit']);_0x24949a[_0x288f('0x20')]=qs[_0x288f('0x20')](_0xf85108[_0x288f('0x32')][_0x288f('0x20')]);}return _0x600f03[_0x288f('0x55')](_0x24949a);}})['then'](function(_0x58c4f3){if(_0x58c4f3){return _0x58c4f3?{'count':_0x52f1df,'rows':_0x58c4f3}:null;}})['then'](respondWithResult(_0x133f86,null))[_0x288f('0x45')](handleError(_0x133f86,null));};exports[_0x288f('0x56')]=function(_0x2448e0,_0x27598b,_0x48c777){return db[_0x288f('0x42')][_0x288f('0x48')]({'where':{'id':_0x2448e0[_0x288f('0x46')]['id']}})[_0x288f('0x27')](handleEntityNotFound(_0x27598b,null))['then'](function(_0x44932c){if(_0x44932c){return _0x44932c[_0x288f('0x56')](_0x2448e0['query'][_0x288f('0x52')]);}})[_0x288f('0x27')](respondWithStatusCode(_0x27598b,null))[_0x288f('0x45')](handleError(_0x27598b,null));};exports['addMessage']=function(_0x5324f2,_0x55a117,_0xefa238){if(_0x5324f2[_0x288f('0x4a')]['id']){delete _0x5324f2['body']['id'];}return db[_0x288f('0x42')][_0x288f('0x48')]({'where':{'id':_0x5324f2[_0x288f('0x46')]['id']}})[_0x288f('0x27')](handleEntityNotFound(_0x55a117,null))[_0x288f('0x27')](function(_0x469698){if(_0x469698){_0x5324f2['body'][_0x288f('0x57')]=_0x469698['id'];return db[_0x288f('0x4d')][_0x288f('0x49')](_0x5324f2[_0x288f('0x4a')]);}})['then'](respondWithResult(_0x55a117,null))[_0x288f('0x45')](handleError(_0x55a117,null));};exports[_0x288f('0x58')]=function(_0x1a0131,_0xdd24a2,_0x1bde0f){var _0x42f7ba={};var _0x4b938f={};var _0x1894ef;var _0x5e5350;return db['ChatGroup']['findOne']({'where':{'id':_0x1a0131[_0x288f('0x46')]['id']}})['then'](handleEntityNotFound(_0xdd24a2,null))[_0x288f('0x27')](function(_0x481629){if(_0x481629){_0x1894ef=_0x481629;_0x4b938f[_0x288f('0x33')]=_[_0x288f('0x31')](db[_0x288f('0x4d')][_0x288f('0x2d')]);_0x4b938f[_0x288f('0x32')]=_['keys'](_0x1a0131[_0x288f('0x32')]);_0x4b938f[_0x288f('0x3b')]=_['intersection'](_0x4b938f['model'],_0x4b938f[_0x288f('0x32')]);_0x42f7ba[_0x288f('0x35')]=_[_0x288f('0x47')](_0x4b938f[_0x288f('0x33')],qs[_0x288f('0x34')](_0x1a0131[_0x288f('0x32')][_0x288f('0x34')]));_0x42f7ba[_0x288f('0x35')]=_0x42f7ba[_0x288f('0x35')][_0x288f('0x36')]?_0x42f7ba[_0x288f('0x35')]:_0x4b938f['model'];_0x42f7ba[_0x288f('0x39')]=qs['sort'](_0x1a0131[_0x288f('0x32')][_0x288f('0x3a')]);_0x42f7ba[_0x288f('0x3e')]=qs['filters'](_[_0x288f('0x3c')](_0x1a0131['query'],_0x4b938f['filters']));if(_0x1a0131['query'][_0x288f('0x3d')]){_0x42f7ba['where']=_[_0x288f('0x3f')](_0x42f7ba['where'],{'$or':_[_0x288f('0x2c')](_0x42f7ba['attributes'],function(_0x2052d1){var _0xdabfcf={};_0xdabfcf[_0x2052d1]={'$like':'%'+_0x1a0131[_0x288f('0x32')]['filter']+'%'};return _0xdabfcf;})});}if(_0x1a0131[_0x288f('0x32')][_0x288f('0x59')]){var _0x3ac1ec=_0x1a0131[_0x288f('0x32')]['$gte'][_0x288f('0x5a')](',');var _0x4b34be={};_0x4b34be[_0x3ac1ec[0x0]]={'$gte':moment(_0x3ac1ec[0x1])[_0x288f('0x5b')](_0x288f('0x5c'))};_0x42f7ba['where']=_['merge'](_0x42f7ba['where'],_0x4b34be);}_0x42f7ba=_['merge']({},_0x42f7ba,_0x1a0131[_0x288f('0x40')]);return _0x1894ef[_0x288f('0x58')](_0x42f7ba);}})[_0x288f('0x27')](function(_0x206081){if(_0x206081){_0x5e5350=_0x206081[_0x288f('0x36')];if(!_0x1a0131['query'][_0x288f('0x37')](_0x288f('0x38'))){_0x42f7ba[_0x288f('0x22')]=qs[_0x288f('0x22')](_0x1a0131[_0x288f('0x32')]['limit']);_0x42f7ba[_0x288f('0x20')]=qs[_0x288f('0x20')](_0x1a0131[_0x288f('0x32')][_0x288f('0x20')]);}return _0x1894ef['getMessages'](_0x42f7ba);}})[_0x288f('0x27')](function(_0x5d8715){if(_0x5d8715){return _0x5d8715?{'count':_0x5e5350,'rows':_0x5d8715}:null;}})[_0x288f('0x27')](respondWithResult(_0xdd24a2,null))[_0x288f('0x45')](handleError(_0xdd24a2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index bb73b25..07e11c1 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 _0xcc4b=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup'];(function(_0x1d0de6,_0x3c2621){var _0x2fa79f=function(_0x1e9418){while(--_0x1e9418){_0x1d0de6['push'](_0x1d0de6['shift']());}};_0x2fa79f(++_0x3c2621);}(_0xcc4b,0x16f));var _0xbcc4=function(_0x22a75f,_0xf98f1f){_0x22a75f=_0x22a75f-0x0;var _0x583584=_0xcc4b[_0x22a75f];return _0x583584;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xbcc4('0x0'))['db'][_0xbcc4('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbcc4('0x2')](0x0);var events={'afterCreate':_0xbcc4('0x3'),'afterUpdate':_0xbcc4('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc9c076){return function(_0x4c960d,_0x370606,_0x27b998){ChatGroupEvents[_0xbcc4('0x5')](_0xc9c076+':'+_0x4c960d['id'],_0x4c960d);ChatGroupEvents['emit'](_0xc9c076,_0x4c960d);_0x27b998(null);};}for(var e in events){if(events[_0xbcc4('0x6')](e)){var event=events[e];ChatGroup[_0xbcc4('0x7')](e,emitEvent(event));}}module[_0xbcc4('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xdcdb=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x18d29b,_0x3034d2){var _0x3c354f=function(_0xb6ea2){while(--_0xb6ea2){_0x18d29b['push'](_0x18d29b['shift']());}};_0x3c354f(++_0x3034d2);}(_0xdcdb,0x64));var _0xbdcd=function(_0x3cbea3,_0x17cae9){_0x3cbea3=_0x3cbea3-0x0;var _0x5cd639=_0xdcdb[_0x3cbea3];return _0x5cd639;};'use strict';var EventEmitter=require(_0xbdcd('0x0'));var ChatGroup=require(_0xbdcd('0x1'))['db'][_0xbdcd('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbdcd('0x3')](0x0);var events={'afterCreate':_0xbdcd('0x4'),'afterUpdate':_0xbdcd('0x5'),'afterDestroy':_0xbdcd('0x6')};function emitEvent(_0x408a2f){return function(_0x13e06e,_0x2dbf8c,_0x2a604c){ChatGroupEvents[_0xbdcd('0x7')](_0x408a2f+':'+_0x13e06e['id'],_0x13e06e);ChatGroupEvents[_0xbdcd('0x7')](_0x408a2f,_0x13e06e);_0x2a604c(null);};}for(var e in events){if(events[_0xbdcd('0x8')](e)){var event=events[e];ChatGroup[_0xbdcd('0x9')](e,emitEvent(event));}}module[_0xbdcd('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index b75656e..6c94ee2 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 _0xe9d7=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x34fbd4,_0x3b303b){var _0x5723dc=function(_0x44cd65){while(--_0x44cd65){_0x34fbd4['push'](_0x34fbd4['shift']());}};_0x5723dc(++_0x3b303b);}(_0xe9d7,0xd8));var _0x7e9d=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xe9d7[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0x7e9d('0x0'));var util=require(_0x7e9d('0x1'));var logger=require(_0x7e9d('0x2'))(_0x7e9d('0x3'));var moment=require(_0x7e9d('0x4'));var BPromise=require(_0x7e9d('0x5'));var rp=require(_0x7e9d('0x6'));var fs=require('fs');var path=require(_0x7e9d('0x7'));var rimraf=require(_0x7e9d('0x8'));var config=require(_0x7e9d('0x9'));var attributes=require(_0x7e9d('0xa'));module[_0x7e9d('0xb')]=function(_0x2b4566,_0x3bb1fb){return _0x2b4566[_0x7e9d('0xc')](_0x7e9d('0xd'),attributes,{'tableName':_0x7e9d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa02d=['./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1dc0bf,_0x592eef){var _0x24ecef=function(_0xf954e3){while(--_0xf954e3){_0x1dc0bf['push'](_0x1dc0bf['shift']());}};_0x24ecef(++_0x592eef);}(_0xa02d,0x197));var _0xda02=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0xa02d[_0x323430];return _0x9eecd1;};'use strict';var _=require(_0xda02('0x0'));var util=require('util');var logger=require(_0xda02('0x1'))(_0xda02('0x2'));var moment=require(_0xda02('0x3'));var BPromise=require(_0xda02('0x4'));var rp=require(_0xda02('0x5'));var fs=require('fs');var path=require(_0xda02('0x6'));var rimraf=require(_0xda02('0x7'));var config=require(_0xda02('0x8'));var attributes=require(_0xda02('0x9'));module[_0xda02('0xa')]=function(_0x5a0a08,_0x3d9600){return _0x5a0a08['define'](_0xda02('0xb'),attributes,{'tableName':_0xda02('0xc'),'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 faf0581..0446b72 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 _0x8375=['request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info'];(function(_0x5875e7,_0x2c3ef8){var _0x1ebb9b=function(_0x517a44){while(--_0x517a44){_0x5875e7['push'](_0x5875e7['shift']());}};_0x1ebb9b(++_0x2c3ef8);}(_0x8375,0x132));var _0x5837=function(_0x5e96cf,_0x9698c){_0x5e96cf=_0x5e96cf-0x0;var _0x3bf168=_0x8375[_0x5e96cf];return _0x3bf168;};'use strict';var _=require('lodash');var util=require(_0x5837('0x0'));var moment=require(_0x5837('0x1'));var BPromise=require(_0x5837('0x2'));var rs=require(_0x5837('0x3'));var fs=require('fs');var Redis=require(_0x5837('0x4'));var db=require(_0x5837('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5837('0x6'))(_0x5837('0x7'));var config=require('../../config/environment');var jayson=require(_0x5837('0x8'));var client=jayson[_0x5837('0x9')][_0x5837('0xa')]({'port':0x232a});config[_0x5837('0xb')]=_['defaults'](config[_0x5837('0xb')],{'host':_0x5837('0xc'),'port':0x18eb});var socket=require(_0x5837('0xd'))(new Redis(config[_0x5837('0xb')]));require(_0x5837('0xe'))[_0x5837('0xf')](socket);function respondWithRpcPromise(_0x1bde71,_0x3f16c1,_0x2ce163){return new BPromise(function(_0x4f2b93,_0x4051b5){return client[_0x5837('0x10')](_0x1bde71,_0x2ce163)['then'](function(_0x102203){logger[_0x5837('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3f16c1,_0x5837('0x12'));logger['debug'](_0x5837('0x13'),_0x3f16c1,_0x5837('0x12'),JSON[_0x5837('0x14')](_0x102203));if(_0x102203[_0x5837('0x15')]){if(_0x102203['error'][_0x5837('0x16')]===0x1f4){logger[_0x5837('0x15')](_0x5837('0x17'),_0x3f16c1,_0x102203['error'][_0x5837('0x18')]);return _0x4051b5(_0x102203[_0x5837('0x15')][_0x5837('0x18')]);}logger[_0x5837('0x15')](_0x5837('0x17'),_0x3f16c1,_0x102203[_0x5837('0x15')]['message']);return _0x4f2b93(_0x102203['error']['message']);}else{logger[_0x5837('0x11')](_0x5837('0x17'),_0x3f16c1,_0x5837('0x12'));_0x4f2b93(_0x102203[_0x5837('0x19')][_0x5837('0x18')]);}})[_0x5837('0x1a')](function(_0x2b87fb){logger['error'](_0x5837('0x17'),_0x3f16c1,_0x2b87fb);_0x4051b5(_0x2b87fb);});});} \ No newline at end of file +var _0x383a=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','request','request\x20sent'];(function(_0x4f9704,_0x48445e){var _0x247f1b=function(_0x1010c5){while(--_0x1010c5){_0x4f9704['push'](_0x4f9704['shift']());}};_0x247f1b(++_0x48445e);}(_0x383a,0x1ad));var _0xa383=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x383a[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require('lodash');var util=require(_0xa383('0x0'));var moment=require(_0xa383('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa383('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa383('0x3'));var logger=require(_0xa383('0x4'))(_0xa383('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa383('0x6')][_0xa383('0x7')]({'port':0x232a});config[_0xa383('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa383('0x8')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x1b676b,_0x3d63e4,_0x54a64c){return new BPromise(function(_0x3c0b0b,_0x98afe6){return client[_0xa383('0x9')](_0x1b676b,_0x54a64c)['then'](function(_0x2b6871){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3d63e4,_0xa383('0xa'));logger[_0xa383('0xb')](_0xa383('0xc'),_0x3d63e4,_0xa383('0xa'),JSON['stringify'](_0x2b6871));if(_0x2b6871[_0xa383('0xd')]){if(_0x2b6871[_0xa383('0xd')][_0xa383('0xe')]===0x1f4){logger[_0xa383('0xd')](_0xa383('0xf'),_0x3d63e4,_0x2b6871[_0xa383('0xd')][_0xa383('0x10')]);return _0x98afe6(_0x2b6871[_0xa383('0xd')]['message']);}logger['error'](_0xa383('0xf'),_0x3d63e4,_0x2b6871[_0xa383('0xd')][_0xa383('0x10')]);return _0x3c0b0b(_0x2b6871[_0xa383('0xd')]['message']);}else{logger[_0xa383('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3d63e4,_0xa383('0xa'));_0x3c0b0b(_0x2b6871[_0xa383('0x12')][_0xa383('0x10')]);}})[_0xa383('0x13')](function(_0x1e0b81){logger[_0xa383('0xd')](_0xa383('0xf'),_0x3d63e4,_0x1e0b81);_0x98afe6(_0x1e0b81);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b0b7df5..5b65078 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 _0xed5c=['./chatGroup.events','save','remove','emit','register','length'];(function(_0x2e589c,_0x68475b){var _0x3ff05e=function(_0x24ecf9){while(--_0x24ecf9){_0x2e589c['push'](_0x2e589c['shift']());}};_0x3ff05e(++_0x68475b);}(_0xed5c,0x1c8));var _0xced5=function(_0x401eb5,_0x22790e){_0x401eb5=_0x401eb5-0x0;var _0x2dd86c=_0xed5c[_0x401eb5];return _0x2dd86c;};'use strict';var ChatGroupEvents=require(_0xced5('0x0'));var events=[_0xced5('0x1'),_0xced5('0x2'),'update'];function createListener(_0x5f9868,_0x173bf8){return function(_0x20c081){_0x173bf8[_0xced5('0x3')](_0x5f9868,_0x20c081);};}function removeListener(_0x4a2081,_0x2c9e11){return function(){ChatGroupEvents['removeListener'](_0x4a2081,_0x2c9e11);};}exports[_0xced5('0x4')]=function(_0x3a6579){for(var _0x20edbf=0x0,_0x17a85a=events[_0xced5('0x5')];_0x20edbf<_0x17a85a;_0x20edbf++){var _0x593c84=events[_0x20edbf];var _0x12fcc2=createListener('chatGroup:'+_0x593c84,_0x3a6579);ChatGroupEvents['on'](_0x593c84,_0x12fcc2);}}; \ No newline at end of file +var _0x566f=['remove','update','emit','removeListener','register','chatGroup:','./chatGroup.events'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x566f,0x1e2));var _0xf566=function(_0x43970e,_0x2e9e79){_0x43970e=_0x43970e-0x0;var _0x4fb408=_0x566f[_0x43970e];return _0x4fb408;};'use strict';var ChatGroupEvents=require(_0xf566('0x0'));var events=['save',_0xf566('0x1'),_0xf566('0x2')];function createListener(_0x4cef56,_0x2aded2){return function(_0x4ada16){_0x2aded2[_0xf566('0x3')](_0x4cef56,_0x4ada16);};}function removeListener(_0x1712bb,_0x825595){return function(){ChatGroupEvents[_0xf566('0x4')](_0x1712bb,_0x825595);};}exports[_0xf566('0x5')]=function(_0x2de8ae){for(var _0x5e0aef=0x0,_0xe1dc3d=events['length'];_0x5e0aef<_0xe1dc3d;_0x5e0aef++){var _0x4827db=events[_0x5e0aef];var _0x491fc9=createListener(_0xf566('0x6')+_0x4827db,_0x2de8ae);ChatGroupEvents['on'](_0x4827db,_0x491fc9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d960a9f..9412265 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 _0x7915=['/:id/members','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/:id','show','/:id/unread','isAuthenticated','getUnread','/:id/messages','getMessages','post','addMembers','addMessage','put','update','destroy','delete'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x7915,0x1c2));var _0x5791=function(_0x37a927,_0x1a10ad){_0x37a927=_0x37a927-0x0;var _0x1ad0c4=_0x7915[_0x37a927];return _0x1ad0c4;};'use strict';var multer=require(_0x5791('0x0'));var util=require(_0x5791('0x1'));var path=require(_0x5791('0x2'));var timeout=require(_0x5791('0x3'));var express=require(_0x5791('0x4'));var router=express[_0x5791('0x5')]();var fs_extra=require(_0x5791('0x6'));var auth=require(_0x5791('0x7'));var interaction=require(_0x5791('0x8'));var config=require(_0x5791('0x9'));var controller=require(_0x5791('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5791('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5791('0xb')](_0x5791('0xc'),auth['isAuthenticated'](),controller[_0x5791('0xd')]);router[_0x5791('0xb')](_0x5791('0xe'),auth[_0x5791('0xf')](),controller[_0x5791('0x10')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x5791('0xb')](_0x5791('0x11'),auth[_0x5791('0xf')](),controller[_0x5791('0x12')]);router[_0x5791('0x13')]('/',auth[_0x5791('0xf')](),controller['create']);router[_0x5791('0x13')]('/:id/members',auth['isAuthenticated'](),controller[_0x5791('0x14')]);router[_0x5791('0x13')](_0x5791('0x11'),auth[_0x5791('0xf')](),controller[_0x5791('0x15')]);router[_0x5791('0x16')](_0x5791('0xc'),auth[_0x5791('0xf')](),controller[_0x5791('0x17')]);router['delete'](_0x5791('0xc'),auth[_0x5791('0xf')](),controller[_0x5791('0x18')]);router[_0x5791('0x19')](_0x5791('0x1a'),auth[_0x5791('0xf')](),controller['removeMembers']);module[_0x5791('0x1b')]=router; \ No newline at end of file +var _0x45e1=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0x45e1,0x11f));var _0x145e=function(_0x4cc123,_0x34b10c){_0x4cc123=_0x4cc123-0x0;var _0x982e94=_0x45e1[_0x4cc123];return _0x982e94;};'use strict';var multer=require(_0x145e('0x0'));var util=require(_0x145e('0x1'));var path=require(_0x145e('0x2'));var timeout=require(_0x145e('0x3'));var express=require(_0x145e('0x4'));var router=express[_0x145e('0x5')]();var fs_extra=require(_0x145e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x145e('0x7'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x145e('0x8')](),controller[_0x145e('0x9')]);router[_0x145e('0xa')]('/describe',auth[_0x145e('0x8')](),controller['describe']);router[_0x145e('0xa')](_0x145e('0xb'),auth['isAuthenticated'](),controller[_0x145e('0xc')]);router[_0x145e('0xa')](_0x145e('0xd'),auth[_0x145e('0x8')](),controller[_0x145e('0xe')]);router['get'](_0x145e('0xf'),auth[_0x145e('0x8')](),controller[_0x145e('0x10')]);router[_0x145e('0xa')](_0x145e('0x11'),auth[_0x145e('0x8')](),controller[_0x145e('0x12')]);router[_0x145e('0x13')]('/',auth[_0x145e('0x8')](),controller[_0x145e('0x14')]);router[_0x145e('0x13')]('/:id/members',auth[_0x145e('0x8')](),controller[_0x145e('0x15')]);router[_0x145e('0x13')](_0x145e('0x11'),auth[_0x145e('0x8')](),controller[_0x145e('0x16')]);router[_0x145e('0x17')](_0x145e('0xb'),auth[_0x145e('0x8')](),controller[_0x145e('0x18')]);router[_0x145e('0x19')]('/:id',auth[_0x145e('0x8')](),controller[_0x145e('0x1a')]);router['delete']('/:id/members',auth['isAuthenticated'](),controller[_0x145e('0x1b')]);module[_0x145e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3c9f7f7..8336fbf 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 _0xb8df=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','out'];(function(_0x36b5be,_0x25cbb9){var _0x186b09=function(_0x559d03){while(--_0x559d03){_0x36b5be['push'](_0x36b5be['shift']());}};_0x186b09(++_0x25cbb9);}(_0xb8df,0x9a));var _0xfb8d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb8df[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0xfb8d('0x0'));module[_0xfb8d('0x1')]={'closed':{'type':Sequelize[_0xfb8d('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfb8d('0x3')]},'ratingType':{'type':Sequelize[_0xfb8d('0x4')](_0xfb8d('0x5'),_0xfb8d('0x6')),'defaultValue':_0xfb8d('0x5')},'ratingMessage':{'type':Sequelize[_0xfb8d('0x7')]},'pathTranscript':{'type':Sequelize[_0xfb8d('0x7')]},'mailTranscript':{'type':Sequelize[_0xfb8d('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfb8d('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfb8d('0x8')]},'thirdDisposition':{'type':Sequelize[_0xfb8d('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xfb8d('0x8')]},'osName':{'type':Sequelize[_0xfb8d('0x8')]},'osVersion':{'type':Sequelize[_0xfb8d('0x8')]},'deviceModel':{'type':Sequelize[_0xfb8d('0x8')]},'deviceVendor':{'type':Sequelize[_0xfb8d('0x8')]},'deviceType':{'type':Sequelize[_0xfb8d('0x8')]},'referer':{'type':Sequelize[_0xfb8d('0x7')]},'customerIp':{'type':Sequelize[_0xfb8d('0x8')]},'formData':{'type':Sequelize[_0xfb8d('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xfb8d('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfb8d('0x4')]('in',_0xfb8d('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xfb8d('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xfb8d('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xfb8d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfb8d('0x3')]}}; \ No newline at end of file +var _0x8c1e=['STRING','DATE','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x32f060,_0x3e6045){var _0x596642=function(_0x351ce7){while(--_0x351ce7){_0x32f060['push'](_0x32f060['shift']());}};_0x596642(++_0x3e6045);}(_0x8c1e,0x1f3));var _0xe8c1=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x8c1e[_0x1a9204];return _0x17ca68;};'use strict';var Sequelize=require(_0xe8c1('0x0'));module[_0xe8c1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe8c1('0x2')]},'ratingType':{'type':Sequelize[_0xe8c1('0x3')](_0xe8c1('0x4'),_0xe8c1('0x5')),'defaultValue':_0xe8c1('0x4')},'ratingMessage':{'type':Sequelize[_0xe8c1('0x6')]},'pathTranscript':{'type':Sequelize[_0xe8c1('0x6')]},'mailTranscript':{'type':Sequelize[_0xe8c1('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe8c1('0x8')]},'disposition':{'type':Sequelize[_0xe8c1('0x7')]},'secondDisposition':{'type':Sequelize[_0xe8c1('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe8c1('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xe8c1('0x7')]},'osVersion':{'type':Sequelize[_0xe8c1('0x7')]},'deviceModel':{'type':Sequelize[_0xe8c1('0x7')]},'deviceVendor':{'type':Sequelize[_0xe8c1('0x7')]},'deviceType':{'type':Sequelize[_0xe8c1('0x7')]},'referer':{'type':Sequelize[_0xe8c1('0x6')]},'customerIp':{'type':Sequelize[_0xe8c1('0x7')]},'formData':{'type':Sequelize[_0xe8c1('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xe8c1('0x8')]},'lastMsgAt':{'type':Sequelize[_0xe8c1('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xe8c1('0x3')]('in',_0xe8c1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe8c1('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xe8c1('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xe8c1('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe8c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ca487c3..21dad68 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 _0xbee2=['path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','destroy','stack','name','send','merge','body','contact','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','keys','filters','model','attributes','intersection','fields','include','options','find','create','update','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','out','ChatMessage','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','server/files/attachments/','join','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','length','%s%d','agentAlias','System','customer','ContactId','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','CloudProvider','Smtp','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','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','push','includeAll','omit','spread','Tag','color','emit','unix','toString','server','files','attachments','Contact','firstName','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','bluebird','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbee2,0x19c));var _0x2bee=function(_0xebb59a,_0x3e69c1){_0xebb59a=_0xebb59a-0x0;var _0x818667=_0xbee2[_0xebb59a];return _0x818667;};'use strict';var rimraf=require(_0x2bee('0x0'));var zipdir=require('zip-dir');var rp=require(_0x2bee('0x1'));var moment=require('moment');var BPromise=require(_0x2bee('0x2'));var Mustache=require('mustache');var util=require(_0x2bee('0x3'));var path=require(_0x2bee('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x2bee('0x5'));var interaction=require(_0x2bee('0x6'));var qs=require(_0x2bee('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x2bee('0x8'))(_0x2bee('0x9'));var config=require('../../config/environment');var db=require(_0x2bee('0xa'))['db'];config[_0x2bee('0xb')]=_[_0x2bee('0xc')](config[_0x2bee('0xb')],{'host':_0x2bee('0xd'),'port':0x18eb});var socket=require(_0x2bee('0xe'))(new Redis(config[_0x2bee('0xb')]));require(_0x2bee('0xf'))[_0x2bee('0x10')](socket);var jayson=require(_0x2bee('0x11'));var client=jayson[_0x2bee('0x12')][_0x2bee('0x13')]({'port':0x232b});var client9004=jayson[_0x2bee('0x12')][_0x2bee('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x575471,_0x52ac15,_0x29dcd4,_0x58e4ba){return new BPromise(function(_0x2de4d9,_0x28845b){var _0x269df4=_0x58e4ba||client;return _0x269df4['request'](_0x575471,_0x29dcd4)[_0x2bee('0x14')](function(_0xab9356){logger[_0x2bee('0x15')](_0x2bee('0x16'),_0x52ac15,_0x2bee('0x17'));logger[_0x2bee('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x52ac15,_0x2bee('0x17'),JSON[_0x2bee('0x19')](_0xab9356));if(_0xab9356['error']){if(_0xab9356[_0x2bee('0x1a')][_0x2bee('0x1b')]===0x1f4){logger[_0x2bee('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x52ac15,_0xab9356[_0x2bee('0x1a')][_0x2bee('0x1c')]);return _0x28845b(_0xab9356[_0x2bee('0x1a')]['message']);}logger[_0x2bee('0x1a')](_0x2bee('0x16'),_0x52ac15,_0xab9356[_0x2bee('0x1a')][_0x2bee('0x1c')]);return _0x2de4d9(_0xab9356[_0x2bee('0x1a')][_0x2bee('0x1c')]);}else{logger[_0x2bee('0x15')](_0x2bee('0x16'),_0x52ac15,'request\x20sent');_0x2de4d9(_0xab9356['result']['message']);}})[_0x2bee('0x1d')](function(_0x337d2a){logger['error'](_0x2bee('0x16'),_0x52ac15,_0x337d2a);_0x28845b(_0x337d2a);});});}function respondWithStatusCode(_0x45a657,_0x52b0b3){_0x52b0b3=_0x52b0b3||0xcc;return function(_0x13cafb){if(_0x13cafb){return _0x45a657[_0x2bee('0x1e')](_0x52b0b3);}return _0x45a657[_0x2bee('0x1f')](_0x52b0b3)[_0x2bee('0x20')]();};}function respondWithResult(_0x52474e,_0x48726b){_0x48726b=_0x48726b||0xc8;return function(_0x5d825a){if(_0x5d825a){return _0x52474e[_0x2bee('0x1f')](_0x48726b)[_0x2bee('0x21')](_0x5d825a);}};}function respondWithFilteredResult(_0x3f2eef,_0x3ba261){return function(_0x1c585c){if(_0x1c585c){var _0x27be4c=typeof _0x3ba261['offset']===_0x2bee('0x22')&&typeof _0x3ba261[_0x2bee('0x23')]===_0x2bee('0x22');var _0x14fdd7=_0x1c585c['count'];var _0x20ae1=_0x27be4c?0x0:_0x3ba261[_0x2bee('0x24')];var _0x4b8649=_0x27be4c?_0x1c585c[_0x2bee('0x25')]:_0x3ba261[_0x2bee('0x24')]+_0x3ba261['limit'];var _0x50e892;if(_0x4b8649>=_0x14fdd7){_0x4b8649=_0x14fdd7;_0x50e892=0xc8;}else{_0x50e892=0xce;}_0x3f2eef[_0x2bee('0x1f')](_0x50e892);return _0x3f2eef['set'](_0x2bee('0x26'),_0x20ae1+'-'+_0x4b8649+'/'+_0x14fdd7)['json'](_0x1c585c);}return null;};}function saveUpdates(_0x1add8f){return function(_0xa5ec8){if(_0xa5ec8){return _0xa5ec8['update'](_0x1add8f)[_0x2bee('0x14')](function(_0x660ddc){return _0x660ddc;});}return null;};}function removeEntity(_0x5d3a38){return function(_0x1794cb){if(_0x1794cb){return _0x1794cb[_0x2bee('0x27')]()['then'](function(){_0x5d3a38['status'](0xcc)[_0x2bee('0x20')]();});}};}function handleEntityNotFound(_0x177f3f){return function(_0x320ff3){if(!_0x320ff3){_0x177f3f[_0x2bee('0x1e')](0x194);}return _0x320ff3;};}function handleError(_0x2577a7,_0xfb037e){_0xfb037e=_0xfb037e||0x1f4;return function(_0x3c2030){logger[_0x2bee('0x1a')](_0x3c2030[_0x2bee('0x28')]);if(_0x3c2030[_0x2bee('0x29')]){delete _0x3c2030[_0x2bee('0x29')];}_0x2577a7[_0x2bee('0x1f')](_0xfb037e)[_0x2bee('0x2a')](_0x3c2030);};}function getMustacheRender(_0x4c0494,_0x4df429){return Mustache['render'](_0x4c0494,_[_0x2bee('0x2b')](_0x4df429[_0x2bee('0x2c')],{'contact':_0x4df429[_0x2bee('0x2d')],'message':_0x4df429['message'],'agent':_0x4df429[_0x2bee('0x2e')],'interaction':_0x4df429[_0x2bee('0x2f')],'account':_0x4df429['account']}))||'';}exports[_0x2bee('0x30')]=function(_0x5173df,_0x7c1255){var _0x594ab6={};var _0x4a4a3f=_[_0x2bee('0x31')](db[_0x2bee('0x32')][_0x2bee('0x33')],function(_0x21820b){return{'name':_0x21820b[_0x2bee('0x34')],'type':_0x21820b[_0x2bee('0x35')][_0x2bee('0x36')]};});_0x594ab6=qs[_0x2bee('0x37')](_0x4a4a3f,_0x5173df);return interaction[_0x2bee('0x38')](_0x2bee('0x39'),_0x5173df[_0x2bee('0x3a')],_0x5173df[_0x2bee('0x3b')],_0x594ab6,_0x4a4a3f)[_0x2bee('0x14')](respondWithFilteredResult(_0x7c1255,_0x594ab6))[_0x2bee('0x1d')](handleError(_0x7c1255,null));};exports[_0x2bee('0x3c')]=function(_0xc95c23,_0x313ed4){var _0x1c3363={'raw':![],'where':{'id':_0xc95c23[_0x2bee('0x3d')]['id']}},_0xc5ba66={};_0xc5ba66['model']=_['keys'](db[_0x2bee('0x32')][_0x2bee('0x33')]);_0xc5ba66[_0x2bee('0x3a')]=_[_0x2bee('0x3e')](_0xc95c23[_0x2bee('0x3a')]);_0xc5ba66[_0x2bee('0x3f')]=_['intersection'](_0xc5ba66[_0x2bee('0x40')],_0xc5ba66[_0x2bee('0x3a')]);_0x1c3363[_0x2bee('0x41')]=_[_0x2bee('0x42')](_0xc5ba66[_0x2bee('0x40')],qs[_0x2bee('0x43')](_0xc95c23[_0x2bee('0x3a')][_0x2bee('0x43')]));_0x1c3363[_0x2bee('0x41')]=_0x1c3363[_0x2bee('0x41')]['length']?_0x1c3363[_0x2bee('0x41')]:_0xc5ba66[_0x2bee('0x40')];if(_0xc95c23[_0x2bee('0x3a')]['includeAll']){_0x1c3363[_0x2bee('0x44')]=[{'all':!![]}];}_0x1c3363=_['merge']({},_0x1c3363,_0xc95c23[_0x2bee('0x45')]);return db[_0x2bee('0x32')][_0x2bee('0x46')](_0x1c3363)['then'](handleEntityNotFound(_0x313ed4,null))[_0x2bee('0x14')](respondWithResult(_0x313ed4,null))[_0x2bee('0x1d')](handleError(_0x313ed4,null));};exports['create']=function(_0x1b802f,_0x2c48c4){return db['ChatInteraction'][_0x2bee('0x47')](_0x1b802f['body'],{})[_0x2bee('0x14')](respondWithResult(_0x2c48c4,0xc9))[_0x2bee('0x1d')](handleError(_0x2c48c4,null));};exports[_0x2bee('0x48')]=function(_0x15f0bd,_0x1c2e07){if(_0x15f0bd[_0x2bee('0x2c')]['id']){delete _0x15f0bd[_0x2bee('0x2c')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x15f0bd['params']['id']}})[_0x2bee('0x14')](handleEntityNotFound(_0x1c2e07,null))[_0x2bee('0x14')](saveUpdates(_0x15f0bd[_0x2bee('0x2c')],null))[_0x2bee('0x14')](respondWithResult(_0x1c2e07,null))['catch'](handleError(_0x1c2e07,null));};exports[_0x2bee('0x27')]=function(_0x278612,_0x596768){return db['ChatInteraction'][_0x2bee('0x46')]({'where':{'id':_0x278612[_0x2bee('0x3d')]['id']}})[_0x2bee('0x14')](handleEntityNotFound(_0x596768,null))['then'](removeEntity(_0x596768,null))[_0x2bee('0x1d')](handleError(_0x596768,null));};exports['describe']=function(_0xeb216a,_0x4fa9cb){return db[_0x2bee('0x32')][_0x2bee('0x49')]()['then'](respondWithResult(_0x4fa9cb,null))[_0x2bee('0x1d')](handleError(_0x4fa9cb,null));};exports[_0x2bee('0x4a')]=function(_0x17c2f4,_0x2b899f){var _0x2467ea=_0x17c2f4[_0x2bee('0x3d')]['id'];var _0x518973;var _0x13222d;var _0x2a4b0a;return db[_0x2bee('0x32')][_0x2bee('0x4b')]({'where':{'id':_0x2467ea}})[_0x2bee('0x14')](function(_0x2dd67f){_0x518973=_0x2dd67f;return db[_0x2bee('0x4c')]['findOne']({'where':{'id':_0x2dd67f[_0x2bee('0x4d')]},'attributes':['id',_0x2bee('0x4e'),_0x2bee('0x4f'),_0x2bee('0x50'),_0x2bee('0x51'),_0x2bee('0x52')],'raw':!![]});})[_0x2bee('0x14')](function(_0x2e4b17){if(_0x2e4b17&&_0x2e4b17['vidaooApiKey']&&_0x2e4b17[_0x2bee('0x4f')]){_0x13222d=_0x2e4b17;var _0xeec22d={'interaction':{'id':_0x2467ea},'agent':{'id':_0x17c2f4[_0x2bee('0x3b')]['id'],'name':_0x17c2f4['user']['name'],'fullname':_0x17c2f4[_0x2bee('0x3b')][_0x2bee('0x53')],'email':_0x17c2f4[_0x2bee('0x3b')][_0x2bee('0x54')]},'contact':_0x17c2f4[_0x2bee('0x2c')]['contact'],'account':_0x17c2f4['body'][_0x2bee('0x55')]};var _0x5bdc7b={'rejectUnauthorized':![],'method':_0x2bee('0x56'),'url':_0x2bee('0x57'),'headers':{'X-APIKEY':_0x2e4b17[_0x2bee('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x17c2f4[_0x2bee('0x3b')][_0x2bee('0x54')]],'buttons':null,'topic':_0x13222d['vidaooTopic'],'note':_['isNull'](_0x13222d[_0x2bee('0x51')])?null:getMustacheRender(_0x13222d[_0x2bee('0x51')],_0xeec22d),'metadata':null},'redirect':_0x2bee('0x58'),'json':!![]};try{if(!_[_0x2bee('0x59')](_0x13222d[_0x2bee('0x52')])){var _0x467fef=getMustacheRender(_0x13222d[_0x2bee('0x52')],_0xeec22d);var _0x3453d7=JSON[_0x2bee('0x5a')](_0x467fef);_0x5bdc7b['body'][_0x2bee('0x5b')]=_0x3453d7;}}catch(_0x485f10){throw new db[(_0x2bee('0x5c'))]['ValidationError'](_0x2bee('0x5d'));}return rp(_0x5bdc7b);}else{throw new db[(_0x2bee('0x5c'))][(_0x2bee('0x5e'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x2bee('0x14')](function(_0x497a8b){_0x2a4b0a=_0x497a8b;if(_0x2a4b0a['id']){var _0x57775a={'body':_0x2a4b0a['join_url'],'ChatWebsiteId':_0x13222d['id'],'ChatInteractionId':_0x518973['id'],'direction':_0x2bee('0x5f'),'UserId':_0x17c2f4[_0x2bee('0x3b')]['id']};return db[_0x2bee('0x60')][_0x2bee('0x47')](_0x57775a,{});}else{throw new db['Sequelize'][(_0x2bee('0x5e'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x2bee('0x14')](function(){return _0x518973['updateAttributes']({'vidaooSessionId':_0x2a4b0a['id']});})[_0x2bee('0x14')](respondWithResult(_0x2b899f,null))['catch'](handleError(_0x2b899f,null));};exports[_0x2bee('0x61')]=function(_0x2f3c85,_0x5872dc){if(_0x2f3c85[_0x2bee('0x2c')]['id']){delete _0x2f3c85['body']['id'];}return db[_0x2bee('0x32')][_0x2bee('0x46')]({'where':{'id':_0x2f3c85[_0x2bee('0x3d')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x2bee('0x14')](handleEntityNotFound(_0x5872dc,null))[_0x2bee('0x14')](saveUpdates(_0x2f3c85[_0x2bee('0x2c')],null))[_0x2bee('0x14')](respondWithResult(_0x5872dc,null))[_0x2bee('0x1d')](handleError(_0x5872dc,null));};exports[_0x2bee('0x62')]=function(_0x222b4d,_0xa522f6){if(_0x222b4d['body']['id']){delete _0x222b4d[_0x2bee('0x2c')]['id'];}return db[_0x2bee('0x32')][_0x2bee('0x46')]({'where':{'id':_0x222b4d[_0x2bee('0x3d')]['id']}})[_0x2bee('0x14')](function(_0x1ddc4a){if(!_0x1ddc4a){logger['error'](_0x2bee('0x63'),_0x2bee('0x62'),0x194,_0x2bee('0x64'));_0xa522f6[_0x2bee('0x1e')](0x194);}else{if(_0x1ddc4a[_0x2bee('0x65')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x1ddc4a;})['then'](function(_0x1d822a){if(_0x1d822a){return _0x1d822a['update']({'closed':_0x222b4d[_0x2bee('0x2c')][_0x2bee('0x66')],'disposition':_0x222b4d['body'][_0x2bee('0x67')]})['then'](function(_0x391a09){return _0x391a09;});}})[_0x2bee('0x14')](function(){return respondWithRpcPromise(_0x2bee('0x68'),_0x2bee('0x62'),_0x222b4d[_0x2bee('0x2c')],client9004);})[_0x2bee('0x14')](respondWithResult(_0xa522f6,null))['catch'](handleError(_0xa522f6,null));};exports[_0x2bee('0x69')]=function(_0x10ce19,_0x12b397){_0x10ce19[_0x2bee('0x2c')][_0x2bee('0x29')]=_0x10ce19[_0x2bee('0x6a')][_0x2bee('0x6b')];_0x10ce19[_0x2bee('0x2c')][_0x2bee('0x6c')]=_0x10ce19[_0x2bee('0x6a')][_0x2bee('0x6d')];_0x10ce19['body']['type']=_0x10ce19[_0x2bee('0x6a')][_0x2bee('0x6e')];return db[_0x2bee('0x6f')][_0x2bee('0x47')](_0x10ce19['body'])[_0x2bee('0x14')](respondWithResult(_0x12b397,0xc9))[_0x2bee('0x1d')](handleError(_0x12b397,null));};exports[_0x2bee('0x70')]=function(_0x1786f5,_0xf34276){return db[_0x2bee('0x32')][_0x2bee('0x4b')]({'where':{'id':_0x1786f5[_0x2bee('0x3d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xf34276,null))[_0x2bee('0x14')](function(_0x3123ad){if(_0x3123ad){if(_0x3123ad[_0x2bee('0x66')]){return _0xf34276['status'](0x193)['json']({'status':0x193,'message':_0x2bee('0x71')});}return db[_0x2bee('0x6f')]['findOne']({'where':{'id':_0x1786f5[_0x2bee('0x3a')]['attachId']},'raw':!![]})[_0x2bee('0x14')](handleEntityNotFound(_0xf34276,null));}})[_0x2bee('0x14')](function(_0xd5002a){if(_0xd5002a){var _0x1c4293=_0xd5002a[_0x2bee('0x72')]!==null;var _0x3adb90=path['join'](config['root'],_0x2bee('0x73'));if(_0x1c4293){_0x3adb90=path[_0x2bee('0x74')](_0x3adb90,'offline-chat/');}var _0x17a93a=path[_0x2bee('0x74')](_0x3adb90,_0xd5002a['basename']);return _0xf34276[_0x2bee('0x75')](_0x17a93a);}})['catch'](handleError(_0xf34276,null));};exports[_0x2bee('0x76')]=function(_0x6e5631,_0x19a6f9){var _0x92e2dd=null;var _0x24d75d=null;var _0x2b6db2=null;if(_0x6e5631[_0x2bee('0x2c')]['id']){delete _0x6e5631[_0x2bee('0x2c')]['id'];}if(_0x6e5631['body'][_0x2bee('0x77')]){_0x2b6db2=path[_0x2bee('0x74')](config[_0x2bee('0x78')],_0x2bee('0x79'),util[_0x2bee('0x7a')](_0x2bee('0x7b'),Date[_0x2bee('0x7c')]()));_0x6e5631[_0x2bee('0x2c')][_0x2bee('0x7d')]=_0x2b6db2;}return db['ChatInteraction'][_0x2bee('0x46')]({'where':{'id':_0x6e5631[_0x2bee('0x3d')]['id']},'include':[{'model':db[_0x2bee('0x60')],'as':_0x2bee('0x7e'),'include':[{'model':db[_0x2bee('0x7f')],'as':_0x2bee('0x7f')}]}]})[_0x2bee('0x14')](handleEntityNotFound(_0x19a6f9,null))[_0x2bee('0x14')](saveUpdates(_0x6e5631[_0x2bee('0x2c')],null))[_0x2bee('0x14')](function(_0x2b80a5){if(_0x2b80a5){_0x92e2dd=_0x2b80a5;return db[_0x2bee('0x4c')]['find']({'where':{'id':_0x92e2dd[_0x2bee('0x4d')]}});}})[_0x2bee('0x14')](function(_0x19972a){if(_0x19972a){_0x24d75d=_0x19972a;return db[_0x2bee('0x80')][_0x2bee('0x46')]({'where':{'id':_0x92e2dd['ContactId']}});}})[_0x2bee('0x14')](function(_0x1c8741){if(_0x1c8741){if(_0x2b6db2){var _0x3d9a6b=null;for(var _0x1a2a7b=0x1;_0x1a2a7b<_0x92e2dd[_0x2bee('0x7e')][_0x2bee('0x81')];++_0x1a2a7b){_0x3d9a6b=_0x92e2dd['Messages'][_0x1a2a7b];var _0x422fc9=_0x3d9a6b[_0x2bee('0x65')]?util[_0x2bee('0x7a')](_0x2bee('0x82'),_0x24d75d[_0x2bee('0x83')],_0x3d9a6b['UserId']):_0x2bee('0x84');var _0x4fcd07=_0x6e5631[_0x2bee('0x2c')][_0x2bee('0x85')]||util[_0x2bee('0x7a')](_0x2bee('0x82'),'Visitor',_0x3d9a6b[_0x2bee('0x86')]);switch(_0x24d75d[_0x2bee('0x87')]){case _0x2bee('0x88'):_0x422fc9=_0x3d9a6b[_0x2bee('0x65')]?util[_0x2bee('0x7a')]('%s%d',_0x24d75d[_0x2bee('0x83')],_0x3d9a6b[_0x2bee('0x65')]):'System';break;case _0x2bee('0x89'):_0x422fc9=_0x3d9a6b[_0x2bee('0x65')]?_0x3d9a6b[_0x2bee('0x7f')][_0x2bee('0x8a')]||_0x3d9a6b['User']['fullname']:_0x2bee('0x84');break;case _0x2bee('0x8b'):_0x422fc9=_0x3d9a6b[_0x2bee('0x65')]?_0x3d9a6b[_0x2bee('0x7f')][_0x2bee('0x53')]:_0x2bee('0x84');break;default:_0x422fc9=_0x3d9a6b[_0x2bee('0x65')]?util[_0x2bee('0x7a')]('%s%d',_0x24d75d[_0x2bee('0x83')],_0x3d9a6b[_0x2bee('0x65')]):_0x2bee('0x84');}var _0x1b9d8f=util[_0x2bee('0x7a')](_0x2bee('0x8c'),moment(_0x3d9a6b[_0x2bee('0x8d')])['format'](_0x2bee('0x8e')),_0x3d9a6b[_0x2bee('0x8f')]==='in'?_0x4fcd07:_0x422fc9,_0x3d9a6b[_0x2bee('0x2c')]);if(!_0x3d9a6b[_0x2bee('0x90')]){fs[_0x2bee('0x91')](_0x2b6db2,_0x1b9d8f);}}return db['MailAccount'][_0x2bee('0x4b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2bee('0x92')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x2bee('0x14')](function(_0x2ad4a4){if(!_0x2ad4a4||!_0x2ad4a4[_0x2bee('0x93')]||!_0x6e5631[_0x2bee('0x2c')])return _0x92e2dd;var _0x44088c=_0x2ad4a4[_0x2bee('0x94')]();return respondWithRpcPromise(_0x2bee('0x95'),_0x2bee('0x96'),{'account':_0x44088c,'message':{'from':util[_0x2bee('0x7a')](_0x2bee('0x97'),_0x2ad4a4[_0x2bee('0x29')],_0x2ad4a4['email']||_0x2ad4a4['Smtp']['user']),'to':_0x6e5631[_0x2bee('0x2c')][_0x2bee('0x77')],'subject':_0x2bee('0x98'),'text':util['format'](_0x2bee('0x99'),_0x6e5631[_0x2bee('0x2c')][_0x2bee('0x77')]),'attachments':[{'path':_0x2b6db2}]}})[_0x2bee('0x14')](function(){return _0x92e2dd;})['catch'](function(_0x463ad3){logger[_0x2bee('0x1a')](_0x463ad3);});})[_0x2bee('0x14')](respondWithStatusCode(_0x19a6f9,0xc8))[_0x2bee('0x1d')](handleError(_0x19a6f9,null));};exports[_0x2bee('0x9a')]=function(_0x28d1bb,_0x3259af){return db[_0x2bee('0x60')][_0x2bee('0x46')]({'where':{'id':_0x28d1bb['params']['id']}})['then'](handleEntityNotFound(_0x3259af,null))[_0x2bee('0x14')](function(_0x27555f){if(_0x27555f){return _0x27555f['addMessage'](_0x28d1bb[_0x2bee('0x2c')][_0x2bee('0x9b')],_['omit'](_0x28d1bb[_0x2bee('0x2c')],[_0x2bee('0x9b'),'id'])||{});}})[_0x2bee('0x14')](respondWithResult(_0x3259af,null))[_0x2bee('0x1d')](handleError(_0x3259af,null));};exports['getMessages']=function(_0x483a72,_0x1580a1){var _0x51dfcf={'raw':![],'where':{}};var _0x2c3988={};var _0x4ac41a={'count':0x0,'rows':[]};return db[_0x2bee('0x32')][_0x2bee('0x4b')]({'where':{'id':_0x483a72['params']['id']}})[_0x2bee('0x14')](handleEntityNotFound(_0x1580a1,null))[_0x2bee('0x14')](function(_0x297542){if(_0x297542){_0x2c3988[_0x2bee('0x40')]=_[_0x2bee('0x3e')](db['ChatMessage'][_0x2bee('0x33')]);_0x2c3988['query']=_['keys'](_0x483a72[_0x2bee('0x3a')]);_0x2c3988[_0x2bee('0x3f')]=_[_0x2bee('0x42')](_0x2c3988[_0x2bee('0x40')],_0x2c3988[_0x2bee('0x3a')]);_0x51dfcf[_0x2bee('0x41')]=_['intersection'](_0x2c3988[_0x2bee('0x40')],qs[_0x2bee('0x43')](_0x483a72[_0x2bee('0x3a')][_0x2bee('0x43')]));_0x51dfcf[_0x2bee('0x41')]=_0x51dfcf[_0x2bee('0x41')][_0x2bee('0x81')]?_0x51dfcf[_0x2bee('0x41')]:_0x2c3988[_0x2bee('0x40')];if(!_0x483a72['query'][_0x2bee('0x9c')](_0x2bee('0x9d'))){_0x51dfcf[_0x2bee('0x23')]=qs[_0x2bee('0x23')](_0x483a72[_0x2bee('0x3a')][_0x2bee('0x23')]);_0x51dfcf['offset']=qs[_0x2bee('0x24')](_0x483a72[_0x2bee('0x3a')][_0x2bee('0x24')]);}_0x51dfcf[_0x2bee('0x9e')]=qs[_0x2bee('0x9f')](_0x483a72[_0x2bee('0x3a')][_0x2bee('0x9f')]);_0x51dfcf[_0x2bee('0xa0')]=qs['filters'](_[_0x2bee('0xa1')](_0x483a72[_0x2bee('0x3a')],_0x2c3988[_0x2bee('0x3f')]));_0x51dfcf[_0x2bee('0xa0')][_0x2bee('0xa2')]=_0x297542['id'];if(_0x483a72[_0x2bee('0x3a')][_0x2bee('0xa3')]){_0x51dfcf[_0x2bee('0xa0')]=_[_0x2bee('0x2b')](_0x51dfcf[_0x2bee('0xa0')],{'$or':_[_0x2bee('0x31')](_0x51dfcf[_0x2bee('0x41')],function(_0x16306b){var _0x32a252={};_0x32a252[_0x16306b]={'$like':'%'+_0x483a72[_0x2bee('0x3a')][_0x2bee('0xa3')]+'%'};return _0x32a252;})});}if(_0x483a72[_0x2bee('0x3a')][_0x2bee('0xa4')]){var _0x33fa2d=_0x483a72[_0x2bee('0x3a')][_0x2bee('0xa4')][_0x2bee('0xa5')](',');var _0xd19f4d={};_0xd19f4d[_0x33fa2d[0x0]]={'$gte':moment(_0x33fa2d[0x1])['format'](_0x2bee('0xa6'))};_0x51dfcf[_0x2bee('0xa0')]=_['merge'](_0x51dfcf[_0x2bee('0xa0')],_0xd19f4d);}_0x51dfcf=_[_0x2bee('0x2b')]({},_0x51dfcf,_0x483a72[_0x2bee('0x45')]);return db[_0x2bee('0x60')][_0x2bee('0x25')]({'where':_0x51dfcf[_0x2bee('0xa0')]})[_0x2bee('0x14')](function(_0xcdb21c){_0x4ac41a[_0x2bee('0x25')]=_0xcdb21c;if(_0x483a72[_0x2bee('0x3a')]['includeAll']){_0x51dfcf['include']=[{'all':!![]}];}return db[_0x2bee('0x60')]['findAll'](_0x51dfcf);})[_0x2bee('0x14')](function(_0x1235c1){_0x4ac41a[_0x2bee('0xa7')]=_0x1235c1;return _0x4ac41a;});}})[_0x2bee('0x14')](respondWithFilteredResult(_0x1580a1,_0x51dfcf))[_0x2bee('0x1d')](handleError(_0x1580a1,null));};exports[_0x2bee('0xa8')]=function(_0x3ff5d5,_0x22a8cd){var _0x4da989={'where':{}},_0x5da5bc={},_0x1e1bc3={'count':0x0,'rows':[]};return db[_0x2bee('0x32')][_0x2bee('0x4b')]({'where':{'id':_0x3ff5d5['params']['id']}})[_0x2bee('0x14')](handleEntityNotFound(_0x22a8cd,null))[_0x2bee('0x14')](function(_0x5ef943){if(_0x5ef943){_0x5da5bc[_0x2bee('0x40')]=_[_0x2bee('0x3e')](db[_0x2bee('0x60')][_0x2bee('0x33')]);_0x5da5bc[_0x2bee('0x3a')]=_[_0x2bee('0x3e')](_0x3ff5d5[_0x2bee('0x3a')]);_0x5da5bc['filters']=_[_0x2bee('0x42')](_0x5da5bc[_0x2bee('0x40')],_0x5da5bc['query']);_0x4da989[_0x2bee('0x41')]=_['intersection'](_0x5da5bc[_0x2bee('0x40')],qs[_0x2bee('0x43')](_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0x43')]));_0x4da989[_0x2bee('0x41')]=_0x4da989['attributes'][_0x2bee('0x81')]?_0x4da989['attributes']:_0x5da5bc[_0x2bee('0x40')];if(!_0x3ff5d5[_0x2bee('0x3a')]['hasOwnProperty'](_0x2bee('0x9d'))){_0x4da989[_0x2bee('0x23')]=qs[_0x2bee('0x23')](_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0x23')]);_0x4da989[_0x2bee('0x24')]=qs['offset'](_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0x24')]);}_0x4da989[_0x2bee('0x9e')]=qs['sort'](_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0x9f')]);_0x4da989[_0x2bee('0xa0')]=qs[_0x2bee('0x3f')](_[_0x2bee('0xa1')](_0x3ff5d5[_0x2bee('0x3a')],_0x5da5bc['filters']));_0x4da989['where']['ChatInteractionId']=_0x5ef943['id'];if(_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0xa3')]){_0x4da989['where']=_[_0x2bee('0x2b')](_0x4da989[_0x2bee('0xa0')],{'$or':_['map'](_0x4da989[_0x2bee('0x41')],function(_0x1dea30){var _0xe36fff={};_0xe36fff[_0x1dea30]={'$like':'%'+_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0xa3')]+'%'};return _0xe36fff;})});}_0x4da989[_0x2bee('0xa0')][_0x2bee('0x90')]=![];if(_0x3ff5d5[_0x2bee('0x3a')]['id']){_0x4da989[_0x2bee('0xa0')]['id']={'$gt':_0x3ff5d5['query']['id']};}_0x4da989=_[_0x2bee('0x2b')]({},_0x4da989,_0x3ff5d5[_0x2bee('0x45')]);return db['ChatMessage'][_0x2bee('0x25')]({'where':_0x4da989['where']})[_0x2bee('0x14')](function(_0x20f9fa){_0x1e1bc3[_0x2bee('0x25')]=_0x20f9fa;_0x4da989[_0x2bee('0x44')]=[];if(_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0xa9')]){_0x4da989[_0x2bee('0x44')][_0x2bee('0xaa')]({'model':db['User'],'as':_0x2bee('0x7f'),'attributes':['id',_0x2bee('0x53'),_0x2bee('0x8a')]});}if(_0x3ff5d5[_0x2bee('0x3a')][_0x2bee('0xab')]){_0x4da989[_0x2bee('0x44')]=[{'all':!![]}];}return db[_0x2bee('0x60')][_0x2bee('0x38')](_0x4da989);})[_0x2bee('0x14')](function(_0x4dfa52){_0x1e1bc3[_0x2bee('0xa7')]=_0x4dfa52;return _0x1e1bc3;});}})['then'](respondWithFilteredResult(_0x22a8cd,_0x4da989))[_0x2bee('0x1d')](handleError(_0x22a8cd,null));};exports['addTags']=function(_0xd4348e,_0x1f9a6c){return db[_0x2bee('0x32')]['find']({'where':{'id':_0xd4348e[_0x2bee('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1f9a6c,null))[_0x2bee('0x14')](function(_0x4ee570){if(_0x4ee570){return _0x4ee570['setTags'](_0xd4348e['body'][_0x2bee('0x9b')],_[_0x2bee('0xac')](_0xd4348e[_0x2bee('0x2c')],[_0x2bee('0x9b'),'id'])||{})[_0x2bee('0xad')](function(){return db[_0x2bee('0xae')][_0x2bee('0x38')]({'attributes':['id','name',_0x2bee('0xaf')],'where':{'id':_0xd4348e[_0x2bee('0x2c')][_0x2bee('0x9b')]}});})['then'](function(_0x2b594c){socket[_0x2bee('0xb0')]('chatInteractionTags:save',{'id':Number(_0xd4348e[_0x2bee('0x3d')]['id']),'tags':_0x2b594c||[]});return{'id':Number(_0xd4348e[_0x2bee('0x3d')]['id']),'tags':_0x2b594c||[]};});}})[_0x2bee('0x14')](respondWithResult(_0x1f9a6c,null))[_0x2bee('0x1d')](handleError(_0x1f9a6c,null));};exports['removeTags']=function(_0x42b9a6,_0x479ff4){return db[_0x2bee('0x32')][_0x2bee('0x46')]({'where':{'id':_0x42b9a6['params']['id']}})[_0x2bee('0x14')](handleEntityNotFound(_0x479ff4,null))[_0x2bee('0x14')](function(_0x352547){if(_0x352547){return _0x352547['removeTags'](_0x42b9a6[_0x2bee('0x3a')][_0x2bee('0x9b')]);}})[_0x2bee('0x14')](respondWithStatusCode(_0x479ff4,null))[_0x2bee('0x1d')](handleError(_0x479ff4,null));};exports['download']=function(_0x53017a,_0x35bd1c){var _0x4d4042=moment()[_0x2bee('0xb1')]()[_0x2bee('0xb2')]();var _0xc3a644=path[_0x2bee('0x74')](config[_0x2bee('0x78')],'server','files','tmp');var _0x548c58=path[_0x2bee('0x74')](config[_0x2bee('0x78')],_0x2bee('0xb3'),_0x2bee('0xb4'),_0x2bee('0xb5'));var _0x22cbec=path[_0x2bee('0x74')](_0xc3a644,_0x4d4042);var _0x3bb7c9=util['format']('transcript-%d-%s.zip',_0x53017a['params']['id'],_0x4d4042);var _0x4ca031=path[_0x2bee('0x74')](_0xc3a644,_0x3bb7c9);var _0xa1d675=[];_0xa1d675[_0x2bee('0xaa')]({'model':db[_0x2bee('0x7f')],'as':'User','attributes':['id',_0x2bee('0x53')],'raw':!![]});_0xa1d675['push']({'model':db[_0x2bee('0x80')],'as':_0x2bee('0xb6'),'attributes':['id',_0x2bee('0xb7'),_0x2bee('0xb8')],'raw':!![]});if(_0x53017a[_0x2bee('0x3a')][_0x2bee('0xb5')]){_0xa1d675[_0x2bee('0xaa')]({'model':db[_0x2bee('0x6f')],'as':'Attachment','raw':!![]});}var _0x20c7f5=[{'model':db[_0x2bee('0x60')],'as':_0x2bee('0x7e'),'attributes':['id','body','createdAt',_0x2bee('0x8f'),'secret',_0x2bee('0xb9')],'include':_0xa1d675}];_0x20c7f5[_0x2bee('0xaa')]({'model':db[_0x2bee('0x4c')],'as':_0x2bee('0xba'),'attributes':['id',_0x2bee('0x29')]});_0x20c7f5[_0x2bee('0xaa')]({'model':db[_0x2bee('0x7f')],'as':'Owner','attributes':['id',_0x2bee('0x53')]});return db[_0x2bee('0x32')][_0x2bee('0x46')]({'where':{'id':_0x53017a[_0x2bee('0x3d')]['id']},'include':_0x20c7f5})[_0x2bee('0x14')](handleEntityNotFound(_0x35bd1c,null))['then'](function(_0x23c679){if(_0x23c679){var _0x56e27e=_0x23c679[_0x2bee('0xbb')]({'plain':!![]});fs[_0x2bee('0xbc')](_0x22cbec);var _0x7e3e50={'channel':_0x2bee('0xbd'),'account':_0x56e27e[_0x2bee('0xba')][_0x2bee('0x29')],'agent':_0x56e27e[_0x2bee('0xbe')]?_0x56e27e[_0x2bee('0xbe')][_0x2bee('0x53')]:_0x2bee('0xbf'),'createdAt':moment(_0x56e27e['createdAt'])[_0x2bee('0x7a')](_0x2bee('0xa6'))[_0x2bee('0xb2')](),'closedAt':_0x56e27e['closed']?moment(_0x56e27e[_0x2bee('0xc0')])[_0x2bee('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2bee('0xb2')]():'','disposition':_0x56e27e[_0x2bee('0x67')],'chatInfo':{'browser':_0x56e27e['browserName'],'os':_0x56e27e['osName'],'referer':_0x56e27e[_0x2bee('0xc1')],'customerIp':_0x56e27e[_0x2bee('0xc2')],'customerPort':_0x56e27e[_0x2bee('0xc3')]?_0x56e27e[_0x2bee('0xc3')]:_0x2bee('0xbf')},'messages':_(_0x56e27e[_0x2bee('0x7e')])[_0x2bee('0xc4')]()[_0x2bee('0xa3')]({'secret':![]})['map'](function(_0x5a02c1){if(_0x5a02c1[_0x2bee('0x6f')]){var _0x5d0da8=path[_0x2bee('0x74')](_0x548c58,_0x5a02c1[_0x2bee('0x6f')]['basename']);if(fs[_0x2bee('0xc5')](_0x5d0da8)){fs[_0x2bee('0xc6')](_0x5d0da8)[_0x2bee('0xc7')](fs[_0x2bee('0xc8')](path[_0x2bee('0x74')](_0x22cbec,_0x5a02c1[_0x2bee('0x6f')]['basename'])));}}return{'date':moment(_0x5a02c1[_0x2bee('0x8d')])['format'](_0x2bee('0xa6'))[_0x2bee('0xb2')](),'sender':_0x5a02c1[_0x2bee('0x8f')]==='out'?_0x5a02c1[_0x2bee('0x7f')]?_0x5a02c1[_0x2bee('0x7f')][_0x2bee('0x53')]:_0x2bee('0x84'):_0x5a02c1[_0x2bee('0xb6')][_0x2bee('0xb7')]+(_0x5a02c1[_0x2bee('0xb6')]['lastName']?'\x20'+_0x5a02c1[_0x2bee('0xb6')][_0x2bee('0xb8')]:''),'body':_0x5a02c1[_0x2bee('0x6f')]?_0x5a02c1['Attachment'][_0x2bee('0x6c')]:_0x5a02c1['body'],'direction':_0x5a02c1['direction']===_0x2bee('0x5f')?'A':'C','secret':_0x5a02c1[_0x2bee('0x90')],'read':_0x5a02c1[_0x2bee('0xb9')],'attachment':_0x5a02c1[_0x2bee('0x6f')]};})['value']()};return ejs[_0x2bee('0xc9')](path['join'](config[_0x2bee('0x78')],_0x2bee('0xb3'),_0x2bee('0xca'),'downloadInteraction.ejs'),{'interaction':_0x7e3e50})['then'](function(_0x32d36f){var _0x9c20be=path['join'](_0x22cbec,_0x2bee('0xcb')+_0x56e27e['id']+'-'+_0x4d4042+_0x2bee('0xcc'));var _0x5e348b={'path':_0x9c20be,'channel':_0x2bee('0xbd'),'interactionId':_0x56e27e['id']};return pdf[_0x2bee('0xcd')](_0x32d36f,_0x5e348b);})[_0x2bee('0x14')](function(){return new Promise(function(_0x5b333c,_0x15868f){zipdir(_0x22cbec,{'saveTo':_0x4ca031},function(_0x40ff6c,_0x510ed9){if(_0x40ff6c)return _0x15868f(_0x40ff6c);return _0x5b333c(_0x510ed9);});})[_0x2bee('0x14')](function(){return new BPromise(function(_0x4d8ddd,_0x43f1e8){rimraf(_0x22cbec,function(_0x3e4be6){if(_0x3e4be6)_0x43f1e8(_0x3e4be6);return _0x4d8ddd();});});})[_0x2bee('0x14')](function(){return _0x35bd1c[_0x2bee('0x75')](_0x4ca031,_0x3bb7c9,function(_0x5774b8){if(_0x5774b8){logger[_0x2bee('0x1a')](_0x2bee('0xce'),_0x5774b8);}else{fs[_0x2bee('0xcf')](_0x4ca031);}});});});}else{return _0x35bd1c['sendStatus'](0xc8);}})['catch'](handleError(_0x35bd1c,null));}; \ No newline at end of file +var _0x9de9=['toString','server','files','tmp','attachments','secret','read','Account','get','mkdirSync','Chat','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','referer','customerIp','customerPort','tail','existsSync','createReadStream','out','lastName','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./chatInteraction.socket','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','stack','name','send','merge','body','contact','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','chat','user','show','keys','query','model','attributes','intersection','fields','length','includeAll','include','options','create','update','find','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','disposition','AbandonInteraction','attachmentUpload','basename','file','Attachment','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ContactId','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','omit','ids','getMessages','filters','hasOwnProperty','nolimit','sort','where','ChatInteractionId','filter','$gte','split','findAll','pick','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix'];(function(_0x4537d2,_0x359e33){var _0x4e6285=function(_0x4c5a86){while(--_0x4c5a86){_0x4537d2['push'](_0x4537d2['shift']());}};_0x4e6285(++_0x359e33);}(_0x9de9,0xea));var _0x99de=function(_0x349f9f,_0x287410){_0x349f9f=_0x349f9f-0x0;var _0x3a1069=_0x9de9[_0x349f9f];return _0x3a1069;};'use strict';var rimraf=require(_0x99de('0x0'));var zipdir=require(_0x99de('0x1'));var rp=require('request-promise');var moment=require(_0x99de('0x2'));var BPromise=require(_0x99de('0x3'));var Mustache=require(_0x99de('0x4'));var util=require('util');var path=require(_0x99de('0x5'));var ejs=require(_0x99de('0x6'));var fs=require('fs');var _=require(_0x99de('0x7'));var Redis=require(_0x99de('0x8'));var interaction=require(_0x99de('0x9'));var qs=require(_0x99de('0xa'));var pdf=require(_0x99de('0xb'));var logger=require(_0x99de('0xc'))(_0x99de('0xd'));var config=require(_0x99de('0xe'));var db=require(_0x99de('0xf'))['db'];config[_0x99de('0x10')]=_[_0x99de('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x99de('0x12'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x99de('0x13')][_0x99de('0x14')]({'port':0x232b});var client9004=jayson[_0x99de('0x13')][_0x99de('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x1aa4ce,_0xf823d2,_0x3169e3,_0x532b0d){return new BPromise(function(_0x2c3f7e,_0x1975cd){var _0x48d1a5=_0x532b0d||client;return _0x48d1a5[_0x99de('0x15')](_0x1aa4ce,_0x3169e3)[_0x99de('0x16')](function(_0x15897f){logger[_0x99de('0x17')](_0x99de('0x18'),_0xf823d2,_0x99de('0x19'));logger[_0x99de('0x1a')](_0x99de('0x1b'),_0xf823d2,'request\x20sent',JSON[_0x99de('0x1c')](_0x15897f));if(_0x15897f['error']){if(_0x15897f[_0x99de('0x1d')][_0x99de('0x1e')]===0x1f4){logger[_0x99de('0x1d')](_0x99de('0x18'),_0xf823d2,_0x15897f[_0x99de('0x1d')]['message']);return _0x1975cd(_0x15897f[_0x99de('0x1d')][_0x99de('0x1f')]);}logger[_0x99de('0x1d')](_0x99de('0x18'),_0xf823d2,_0x15897f['error'][_0x99de('0x1f')]);return _0x2c3f7e(_0x15897f['error']['message']);}else{logger[_0x99de('0x17')](_0x99de('0x18'),_0xf823d2,_0x99de('0x19'));_0x2c3f7e(_0x15897f[_0x99de('0x20')][_0x99de('0x1f')]);}})[_0x99de('0x21')](function(_0x305fee){logger[_0x99de('0x1d')](_0x99de('0x18'),_0xf823d2,_0x305fee);_0x1975cd(_0x305fee);});});}function respondWithStatusCode(_0x52444b,_0xf850d3){_0xf850d3=_0xf850d3||0xcc;return function(_0x5e796a){if(_0x5e796a){return _0x52444b[_0x99de('0x22')](_0xf850d3);}return _0x52444b[_0x99de('0x23')](_0xf850d3)[_0x99de('0x24')]();};}function respondWithResult(_0x1f26b4,_0x6339da){_0x6339da=_0x6339da||0xc8;return function(_0x158860){if(_0x158860){return _0x1f26b4[_0x99de('0x23')](_0x6339da)[_0x99de('0x25')](_0x158860);}};}function respondWithFilteredResult(_0x5e066d,_0x2b94dc){return function(_0x1c35f0){if(_0x1c35f0){var _0x52980d=typeof _0x2b94dc[_0x99de('0x26')]==='undefined'&&typeof _0x2b94dc[_0x99de('0x27')]===_0x99de('0x28');var _0x95b561=_0x1c35f0[_0x99de('0x29')];var _0x554e7b=_0x52980d?0x0:_0x2b94dc['offset'];var _0xaf2afd=_0x52980d?_0x1c35f0[_0x99de('0x29')]:_0x2b94dc[_0x99de('0x26')]+_0x2b94dc['limit'];var _0x53199c;if(_0xaf2afd>=_0x95b561){_0xaf2afd=_0x95b561;_0x53199c=0xc8;}else{_0x53199c=0xce;}_0x5e066d[_0x99de('0x23')](_0x53199c);return _0x5e066d[_0x99de('0x2a')](_0x99de('0x2b'),_0x554e7b+'-'+_0xaf2afd+'/'+_0x95b561)[_0x99de('0x25')](_0x1c35f0);}return null;};}function saveUpdates(_0x5acb27){return function(_0x4b77ac){if(_0x4b77ac){return _0x4b77ac['update'](_0x5acb27)[_0x99de('0x16')](function(_0x4e0f05){return _0x4e0f05;});}return null;};}function removeEntity(_0x4e9279){return function(_0x875bf6){if(_0x875bf6){return _0x875bf6[_0x99de('0x2c')]()[_0x99de('0x16')](function(){_0x4e9279['status'](0xcc)[_0x99de('0x24')]();});}};}function handleEntityNotFound(_0x3ff95f){return function(_0x36ab95){if(!_0x36ab95){_0x3ff95f['sendStatus'](0x194);}return _0x36ab95;};}function handleError(_0x1545f3,_0x3a8152){_0x3a8152=_0x3a8152||0x1f4;return function(_0x3baa74){logger[_0x99de('0x1d')](_0x3baa74[_0x99de('0x2d')]);if(_0x3baa74[_0x99de('0x2e')]){delete _0x3baa74[_0x99de('0x2e')];}_0x1545f3[_0x99de('0x23')](_0x3a8152)[_0x99de('0x2f')](_0x3baa74);};}function getMustacheRender(_0x29a05f,_0x48c592){return Mustache['render'](_0x29a05f,_[_0x99de('0x30')](_0x48c592[_0x99de('0x31')],{'contact':_0x48c592[_0x99de('0x32')],'message':_0x48c592[_0x99de('0x1f')],'agent':_0x48c592[_0x99de('0x33')],'interaction':_0x48c592[_0x99de('0x34')],'account':_0x48c592['account']}))||'';}exports[_0x99de('0x35')]=function(_0x4c1efa,_0x4596a6){var _0xa7746c={};var _0x3297df=_[_0x99de('0x36')](db[_0x99de('0x37')][_0x99de('0x38')],function(_0x853c36){return{'name':_0x853c36[_0x99de('0x39')],'type':_0x853c36[_0x99de('0x3a')]['key']};});_0xa7746c=qs[_0x99de('0x3b')](_0x3297df,_0x4c1efa);return interaction['findAll'](_0x99de('0x3c'),_0x4c1efa['query'],_0x4c1efa[_0x99de('0x3d')],_0xa7746c,_0x3297df)['then'](respondWithFilteredResult(_0x4596a6,_0xa7746c))[_0x99de('0x21')](handleError(_0x4596a6,null));};exports[_0x99de('0x3e')]=function(_0x3e3c5c,_0x46888f){var _0xc9f6bd={'raw':![],'where':{'id':_0x3e3c5c['params']['id']}},_0x3c64c1={};_0x3c64c1['model']=_[_0x99de('0x3f')](db[_0x99de('0x37')][_0x99de('0x38')]);_0x3c64c1['query']=_[_0x99de('0x3f')](_0x3e3c5c[_0x99de('0x40')]);_0x3c64c1['filters']=_['intersection'](_0x3c64c1[_0x99de('0x41')],_0x3c64c1[_0x99de('0x40')]);_0xc9f6bd[_0x99de('0x42')]=_[_0x99de('0x43')](_0x3c64c1[_0x99de('0x41')],qs['fields'](_0x3e3c5c[_0x99de('0x40')][_0x99de('0x44')]));_0xc9f6bd['attributes']=_0xc9f6bd['attributes'][_0x99de('0x45')]?_0xc9f6bd['attributes']:_0x3c64c1[_0x99de('0x41')];if(_0x3e3c5c[_0x99de('0x40')][_0x99de('0x46')]){_0xc9f6bd[_0x99de('0x47')]=[{'all':!![]}];}_0xc9f6bd=_[_0x99de('0x30')]({},_0xc9f6bd,_0x3e3c5c[_0x99de('0x48')]);return db[_0x99de('0x37')]['find'](_0xc9f6bd)['then'](handleEntityNotFound(_0x46888f,null))[_0x99de('0x16')](respondWithResult(_0x46888f,null))[_0x99de('0x21')](handleError(_0x46888f,null));};exports[_0x99de('0x49')]=function(_0x219973,_0x4f9501){return db[_0x99de('0x37')][_0x99de('0x49')](_0x219973[_0x99de('0x31')],{})[_0x99de('0x16')](respondWithResult(_0x4f9501,0xc9))['catch'](handleError(_0x4f9501,null));};exports[_0x99de('0x4a')]=function(_0x254c3b,_0x91209b){if(_0x254c3b['body']['id']){delete _0x254c3b[_0x99de('0x31')]['id'];}return db[_0x99de('0x37')][_0x99de('0x4b')]({'where':{'id':_0x254c3b[_0x99de('0x4c')]['id']}})[_0x99de('0x16')](handleEntityNotFound(_0x91209b,null))[_0x99de('0x16')](saveUpdates(_0x254c3b['body'],null))[_0x99de('0x16')](respondWithResult(_0x91209b,null))[_0x99de('0x21')](handleError(_0x91209b,null));};exports['destroy']=function(_0x66dfde,_0x2f7d32){return db['ChatInteraction'][_0x99de('0x4b')]({'where':{'id':_0x66dfde[_0x99de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f7d32,null))[_0x99de('0x16')](removeEntity(_0x2f7d32,null))[_0x99de('0x21')](handleError(_0x2f7d32,null));};exports[_0x99de('0x4d')]=function(_0x413472,_0x238fbb){return db['ChatInteraction']['describe']()[_0x99de('0x16')](respondWithResult(_0x238fbb,null))[_0x99de('0x21')](handleError(_0x238fbb,null));};exports[_0x99de('0x4e')]=function(_0x29d424,_0x1c6599){var _0x34fc16=_0x29d424[_0x99de('0x4c')]['id'];var _0x349569;var _0x305467;var _0x2cc9ad;return db['ChatInteraction'][_0x99de('0x4f')]({'where':{'id':_0x34fc16}})['then'](function(_0x2b7f44){_0x349569=_0x2b7f44;return db[_0x99de('0x50')][_0x99de('0x4f')]({'where':{'id':_0x2b7f44[_0x99de('0x51')]},'attributes':['id',_0x99de('0x52'),'vidaooEscalation',_0x99de('0x53'),_0x99de('0x54'),_0x99de('0x55')],'raw':!![]});})[_0x99de('0x16')](function(_0x43f1bd){if(_0x43f1bd&&_0x43f1bd[_0x99de('0x52')]&&_0x43f1bd[_0x99de('0x56')]){_0x305467=_0x43f1bd;var _0x18f38f={'interaction':{'id':_0x34fc16},'agent':{'id':_0x29d424[_0x99de('0x3d')]['id'],'name':_0x29d424[_0x99de('0x3d')]['name'],'fullname':_0x29d424['user'][_0x99de('0x57')],'email':_0x29d424[_0x99de('0x3d')][_0x99de('0x58')]},'contact':_0x29d424[_0x99de('0x31')]['contact'],'account':_0x29d424['body'][_0x99de('0x59')]};var _0xde780={'rejectUnauthorized':![],'method':'POST','url':_0x99de('0x5a'),'headers':{'X-APIKEY':_0x43f1bd[_0x99de('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x29d424[_0x99de('0x3d')][_0x99de('0x58')]],'buttons':null,'topic':_0x305467[_0x99de('0x53')],'note':_[_0x99de('0x5b')](_0x305467[_0x99de('0x54')])?null:getMustacheRender(_0x305467['vidaooNote'],_0x18f38f),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x305467[_0x99de('0x55')])){var _0x57bad7=getMustacheRender(_0x305467[_0x99de('0x55')],_0x18f38f);var _0x383e87=JSON['parse'](_0x57bad7);_0xde780[_0x99de('0x31')]['metadata']=_0x383e87;}}catch(_0x54f07a){throw new db[(_0x99de('0x5c'))][(_0x99de('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xde780);}else{throw new db[(_0x99de('0x5c'))][(_0x99de('0x5d'))](_0x99de('0x5e'));}})[_0x99de('0x16')](function(_0x3a7673){_0x2cc9ad=_0x3a7673;if(_0x2cc9ad['id']){var _0x1eb75c={'body':_0x2cc9ad['join_url'],'ChatWebsiteId':_0x305467['id'],'ChatInteractionId':_0x349569['id'],'direction':'out','UserId':_0x29d424[_0x99de('0x3d')]['id']};return db[_0x99de('0x5f')]['create'](_0x1eb75c,{});}else{throw new db[(_0x99de('0x5c'))][(_0x99de('0x5d'))](_0x99de('0x60'));}})[_0x99de('0x16')](function(){return _0x349569[_0x99de('0x61')]({'vidaooSessionId':_0x2cc9ad['id']});})[_0x99de('0x16')](respondWithResult(_0x1c6599,null))['catch'](handleError(_0x1c6599,null));};exports['customUpdate']=function(_0xe520b8,_0x55d2d8){if(_0xe520b8[_0x99de('0x31')]['id']){delete _0xe520b8[_0x99de('0x31')]['id'];}return db[_0x99de('0x37')][_0x99de('0x4b')]({'where':{'id':_0xe520b8[_0x99de('0x4c')]['id']},'include':[{'model':db[_0x99de('0x62')],'as':_0x99de('0x63')}]})[_0x99de('0x16')](handleEntityNotFound(_0x55d2d8,null))['then'](saveUpdates(_0xe520b8[_0x99de('0x31')],null))['then'](respondWithResult(_0x55d2d8,null))[_0x99de('0x21')](handleError(_0x55d2d8,null));};exports[_0x99de('0x64')]=function(_0x790f13,_0x4ab3ab){if(_0x790f13[_0x99de('0x31')]['id']){delete _0x790f13['body']['id'];}return db['ChatInteraction'][_0x99de('0x4b')]({'where':{'id':_0x790f13[_0x99de('0x4c')]['id']}})['then'](function(_0x1f2fb7){if(!_0x1f2fb7){logger['error'](_0x99de('0x65'),'abandon',0x194,_0x99de('0x66'));_0x4ab3ab[_0x99de('0x22')](0x194);}else{if(_0x1f2fb7[_0x99de('0x67')]){throw new db['Sequelize'][(_0x99de('0x5d'))]('Interaction\x20already\x20assigned');}}return _0x1f2fb7;})['then'](function(_0x394cf7){if(_0x394cf7){return _0x394cf7['update']({'closed':_0x790f13[_0x99de('0x31')]['closed'],'disposition':_0x790f13[_0x99de('0x31')][_0x99de('0x68')]})[_0x99de('0x16')](function(_0x390421){return _0x390421;});}})[_0x99de('0x16')](function(){return respondWithRpcPromise(_0x99de('0x69'),_0x99de('0x64'),_0x790f13[_0x99de('0x31')],client9004);})[_0x99de('0x16')](respondWithResult(_0x4ab3ab,null))[_0x99de('0x21')](handleError(_0x4ab3ab,null));};exports[_0x99de('0x6a')]=function(_0x13aee1,_0x41511f){_0x13aee1['body']['name']=_0x13aee1['file']['originalname'];_0x13aee1['body'][_0x99de('0x6b')]=_0x13aee1['file']['filename'];_0x13aee1['body'][_0x99de('0x3a')]=_0x13aee1[_0x99de('0x6c')]['mimetype'];return db[_0x99de('0x6d')][_0x99de('0x49')](_0x13aee1['body'])['then'](respondWithResult(_0x41511f,0xc9))[_0x99de('0x21')](handleError(_0x41511f,null));};exports['attachmentDownload']=function(_0x302a3c,_0x3ce5d9){return db[_0x99de('0x37')][_0x99de('0x4f')]({'where':{'id':_0x302a3c[_0x99de('0x4c')]['id']},'raw':!![]})[_0x99de('0x16')](handleEntityNotFound(_0x3ce5d9,null))['then'](function(_0x4be993){if(_0x4be993){if(_0x4be993[_0x99de('0x6e')]){return _0x3ce5d9[_0x99de('0x23')](0x193)[_0x99de('0x25')]({'status':0x193,'message':_0x99de('0x6f')});}return db[_0x99de('0x6d')][_0x99de('0x4f')]({'where':{'id':_0x302a3c[_0x99de('0x40')][_0x99de('0x70')]},'raw':!![]})[_0x99de('0x16')](handleEntityNotFound(_0x3ce5d9,null));}})[_0x99de('0x16')](function(_0x7ed6cc){if(_0x7ed6cc){var _0x267d36=_0x7ed6cc[_0x99de('0x71')]!==null;var _0x3020e2=path[_0x99de('0x72')](config[_0x99de('0x73')],'server/files/attachments/');if(_0x267d36){_0x3020e2=path[_0x99de('0x72')](_0x3020e2,_0x99de('0x74'));}var _0x4e0692=path[_0x99de('0x72')](_0x3020e2,_0x7ed6cc[_0x99de('0x6b')]);return _0x3ce5d9['download'](_0x4e0692);}})['catch'](handleError(_0x3ce5d9,null));};exports[_0x99de('0x75')]=function(_0x381892,_0x553763){var _0x44a88a=null;var _0x521fa2=null;var _0x1b70bf=null;if(_0x381892[_0x99de('0x31')]['id']){delete _0x381892[_0x99de('0x31')]['id'];}if(_0x381892['body']['mailTranscript']){_0x1b70bf=path[_0x99de('0x72')](config[_0x99de('0x73')],_0x99de('0x76'),util[_0x99de('0x77')](_0x99de('0x78'),Date['now']()));_0x381892[_0x99de('0x31')][_0x99de('0x79')]=_0x1b70bf;}return db['ChatInteraction'][_0x99de('0x4b')]({'where':{'id':_0x381892[_0x99de('0x4c')]['id']},'include':[{'model':db[_0x99de('0x5f')],'as':_0x99de('0x7a'),'include':[{'model':db[_0x99de('0x7b')],'as':_0x99de('0x7b')}]}]})[_0x99de('0x16')](handleEntityNotFound(_0x553763,null))[_0x99de('0x16')](saveUpdates(_0x381892[_0x99de('0x31')],null))[_0x99de('0x16')](function(_0x125365){if(_0x125365){_0x44a88a=_0x125365;return db[_0x99de('0x50')][_0x99de('0x4b')]({'where':{'id':_0x44a88a[_0x99de('0x51')]}});}})[_0x99de('0x16')](function(_0x1b635d){if(_0x1b635d){_0x521fa2=_0x1b635d;return db[_0x99de('0x62')]['find']({'where':{'id':_0x44a88a[_0x99de('0x7c')]}});}})[_0x99de('0x16')](function(_0x5c626d){if(_0x5c626d){if(_0x1b70bf){var _0x3d1b16=null;for(var _0x111c24=0x1;_0x111c24<_0x44a88a['Messages']['length'];++_0x111c24){_0x3d1b16=_0x44a88a[_0x99de('0x7a')][_0x111c24];var _0x63d456=_0x3d1b16[_0x99de('0x67')]?util['format']('%s%d',_0x521fa2[_0x99de('0x7d')],_0x3d1b16['UserId']):_0x99de('0x7e');var _0x53fa43=_0x381892['body'][_0x99de('0x7f')]||util[_0x99de('0x77')](_0x99de('0x80'),_0x99de('0x81'),_0x3d1b16['ContactId']);switch(_0x521fa2[_0x99de('0x82')]){case _0x99de('0x83'):_0x63d456=_0x3d1b16[_0x99de('0x67')]?util['format'](_0x99de('0x80'),_0x521fa2[_0x99de('0x7d')],_0x3d1b16[_0x99de('0x67')]):_0x99de('0x7e');break;case'agent_alias':_0x63d456=_0x3d1b16['UserId']?_0x3d1b16[_0x99de('0x7b')][_0x99de('0x84')]||_0x3d1b16['User'][_0x99de('0x57')]:_0x99de('0x7e');break;case _0x99de('0x85'):_0x63d456=_0x3d1b16[_0x99de('0x67')]?_0x3d1b16['User'][_0x99de('0x57')]:_0x99de('0x7e');break;default:_0x63d456=_0x3d1b16['UserId']?util[_0x99de('0x77')](_0x99de('0x80'),_0x521fa2[_0x99de('0x7d')],_0x3d1b16[_0x99de('0x67')]):_0x99de('0x7e');}var _0x4aa681=util[_0x99de('0x77')](_0x99de('0x86'),moment(_0x3d1b16[_0x99de('0x87')])[_0x99de('0x77')](_0x99de('0x88')),_0x3d1b16[_0x99de('0x89')]==='in'?_0x53fa43:_0x63d456,_0x3d1b16[_0x99de('0x31')]);if(!_0x3d1b16['secret']){fs[_0x99de('0x8a')](_0x1b70bf,_0x4aa681);}}return db['MailAccount'][_0x99de('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0x99de('0x8b')],'as':_0x99de('0x8c'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x99de('0x8d'),'raw':!![]}]}]});}}})['then'](function(_0x2c68d5){if(!_0x2c68d5||!_0x2c68d5[_0x99de('0x8c')]||!_0x381892[_0x99de('0x31')])return _0x44a88a;var _0x24c34a=_0x2c68d5['getSmtpOptions']();return respondWithRpcPromise(_0x99de('0x8e'),_0x99de('0x8f'),{'account':_0x24c34a,'message':{'from':util[_0x99de('0x77')]('\x22%s\x22\x20<%s>',_0x2c68d5[_0x99de('0x2e')],_0x2c68d5[_0x99de('0x58')]||_0x2c68d5[_0x99de('0x8c')][_0x99de('0x3d')]),'to':_0x381892[_0x99de('0x31')][_0x99de('0x90')],'subject':_0x99de('0x91'),'text':util[_0x99de('0x77')](_0x99de('0x92'),_0x381892[_0x99de('0x31')][_0x99de('0x90')]),'attachments':[{'path':_0x1b70bf}]}})[_0x99de('0x16')](function(){return _0x44a88a;})[_0x99de('0x21')](function(_0x248635){logger[_0x99de('0x1d')](_0x248635);});})['then'](respondWithStatusCode(_0x553763,0xc8))[_0x99de('0x21')](handleError(_0x553763,null));};exports['addMessage']=function(_0xb2b1bf,_0x4d1ef6){return db[_0x99de('0x5f')]['find']({'where':{'id':_0xb2b1bf[_0x99de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d1ef6,null))[_0x99de('0x16')](function(_0x447f69){if(_0x447f69){return _0x447f69['addMessage'](_0xb2b1bf[_0x99de('0x31')]['ids'],_[_0x99de('0x93')](_0xb2b1bf['body'],[_0x99de('0x94'),'id'])||{});}})['then'](respondWithResult(_0x4d1ef6,null))['catch'](handleError(_0x4d1ef6,null));};exports[_0x99de('0x95')]=function(_0x4531db,_0x5be36a){var _0x32fe0b={'raw':![],'where':{}};var _0x11e232={};var _0x58608c={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x99de('0x4f')]({'where':{'id':_0x4531db['params']['id']}})[_0x99de('0x16')](handleEntityNotFound(_0x5be36a,null))[_0x99de('0x16')](function(_0x1bdfe5){if(_0x1bdfe5){_0x11e232[_0x99de('0x41')]=_[_0x99de('0x3f')](db[_0x99de('0x5f')]['rawAttributes']);_0x11e232[_0x99de('0x40')]=_[_0x99de('0x3f')](_0x4531db[_0x99de('0x40')]);_0x11e232[_0x99de('0x96')]=_[_0x99de('0x43')](_0x11e232[_0x99de('0x41')],_0x11e232[_0x99de('0x40')]);_0x32fe0b['attributes']=_[_0x99de('0x43')](_0x11e232['model'],qs[_0x99de('0x44')](_0x4531db['query'][_0x99de('0x44')]));_0x32fe0b[_0x99de('0x42')]=_0x32fe0b[_0x99de('0x42')]['length']?_0x32fe0b[_0x99de('0x42')]:_0x11e232[_0x99de('0x41')];if(!_0x4531db[_0x99de('0x40')][_0x99de('0x97')](_0x99de('0x98'))){_0x32fe0b[_0x99de('0x27')]=qs[_0x99de('0x27')](_0x4531db[_0x99de('0x40')][_0x99de('0x27')]);_0x32fe0b[_0x99de('0x26')]=qs[_0x99de('0x26')](_0x4531db[_0x99de('0x40')][_0x99de('0x26')]);}_0x32fe0b['order']=qs['sort'](_0x4531db['query'][_0x99de('0x99')]);_0x32fe0b[_0x99de('0x9a')]=qs[_0x99de('0x96')](_['pick'](_0x4531db[_0x99de('0x40')],_0x11e232[_0x99de('0x96')]));_0x32fe0b['where'][_0x99de('0x9b')]=_0x1bdfe5['id'];if(_0x4531db[_0x99de('0x40')][_0x99de('0x9c')]){_0x32fe0b[_0x99de('0x9a')]=_[_0x99de('0x30')](_0x32fe0b[_0x99de('0x9a')],{'$or':_[_0x99de('0x36')](_0x32fe0b[_0x99de('0x42')],function(_0x3efcc9){var _0x5d64c9={};_0x5d64c9[_0x3efcc9]={'$like':'%'+_0x4531db[_0x99de('0x40')][_0x99de('0x9c')]+'%'};return _0x5d64c9;})});}if(_0x4531db['query'][_0x99de('0x9d')]){var _0x4a9a4d=_0x4531db[_0x99de('0x40')]['$gte'][_0x99de('0x9e')](',');var _0x3f816b={};_0x3f816b[_0x4a9a4d[0x0]]={'$gte':moment(_0x4a9a4d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x32fe0b[_0x99de('0x9a')]=_[_0x99de('0x30')](_0x32fe0b[_0x99de('0x9a')],_0x3f816b);}_0x32fe0b=_[_0x99de('0x30')]({},_0x32fe0b,_0x4531db[_0x99de('0x48')]);return db[_0x99de('0x5f')][_0x99de('0x29')]({'where':_0x32fe0b[_0x99de('0x9a')]})[_0x99de('0x16')](function(_0x2354ef){_0x58608c['count']=_0x2354ef;if(_0x4531db['query'][_0x99de('0x46')]){_0x32fe0b[_0x99de('0x47')]=[{'all':!![]}];}return db[_0x99de('0x5f')][_0x99de('0x9f')](_0x32fe0b);})[_0x99de('0x16')](function(_0x356a79){_0x58608c['rows']=_0x356a79;return _0x58608c;});}})[_0x99de('0x16')](respondWithFilteredResult(_0x5be36a,_0x32fe0b))[_0x99de('0x21')](handleError(_0x5be36a,null));};exports['getMyMessages']=function(_0x21e899,_0xe0f57c){var _0x5ded14={'where':{}},_0x1b2b43={},_0xb36948={'count':0x0,'rows':[]};return db[_0x99de('0x37')]['findOne']({'where':{'id':_0x21e899['params']['id']}})[_0x99de('0x16')](handleEntityNotFound(_0xe0f57c,null))[_0x99de('0x16')](function(_0x13597b){if(_0x13597b){_0x1b2b43[_0x99de('0x41')]=_[_0x99de('0x3f')](db[_0x99de('0x5f')][_0x99de('0x38')]);_0x1b2b43['query']=_['keys'](_0x21e899[_0x99de('0x40')]);_0x1b2b43[_0x99de('0x96')]=_['intersection'](_0x1b2b43[_0x99de('0x41')],_0x1b2b43['query']);_0x5ded14['attributes']=_[_0x99de('0x43')](_0x1b2b43[_0x99de('0x41')],qs[_0x99de('0x44')](_0x21e899[_0x99de('0x40')][_0x99de('0x44')]));_0x5ded14[_0x99de('0x42')]=_0x5ded14[_0x99de('0x42')]['length']?_0x5ded14['attributes']:_0x1b2b43[_0x99de('0x41')];if(!_0x21e899[_0x99de('0x40')][_0x99de('0x97')](_0x99de('0x98'))){_0x5ded14[_0x99de('0x27')]=qs[_0x99de('0x27')](_0x21e899[_0x99de('0x40')]['limit']);_0x5ded14[_0x99de('0x26')]=qs[_0x99de('0x26')](_0x21e899[_0x99de('0x40')]['offset']);}_0x5ded14['order']=qs[_0x99de('0x99')](_0x21e899[_0x99de('0x40')][_0x99de('0x99')]);_0x5ded14[_0x99de('0x9a')]=qs[_0x99de('0x96')](_[_0x99de('0xa0')](_0x21e899['query'],_0x1b2b43['filters']));_0x5ded14[_0x99de('0x9a')][_0x99de('0x9b')]=_0x13597b['id'];if(_0x21e899[_0x99de('0x40')][_0x99de('0x9c')]){_0x5ded14['where']=_[_0x99de('0x30')](_0x5ded14[_0x99de('0x9a')],{'$or':_['map'](_0x5ded14[_0x99de('0x42')],function(_0x454029){var _0x253979={};_0x253979[_0x454029]={'$like':'%'+_0x21e899[_0x99de('0x40')][_0x99de('0x9c')]+'%'};return _0x253979;})});}_0x5ded14[_0x99de('0x9a')]['secret']=![];if(_0x21e899[_0x99de('0x40')]['id']){_0x5ded14[_0x99de('0x9a')]['id']={'$gt':_0x21e899['query']['id']};}_0x5ded14=_[_0x99de('0x30')]({},_0x5ded14,_0x21e899[_0x99de('0x48')]);return db[_0x99de('0x5f')][_0x99de('0x29')]({'where':_0x5ded14[_0x99de('0x9a')]})['then'](function(_0x31237f){_0xb36948[_0x99de('0x29')]=_0x31237f;_0x5ded14[_0x99de('0x47')]=[];if(_0x21e899[_0x99de('0x40')][_0x99de('0xa1')]){_0x5ded14['include'][_0x99de('0xa2')]({'model':db['User'],'as':'User','attributes':['id','fullname',_0x99de('0x84')]});}if(_0x21e899['query'][_0x99de('0x46')]){_0x5ded14[_0x99de('0x47')]=[{'all':!![]}];}return db[_0x99de('0x5f')][_0x99de('0x9f')](_0x5ded14);})[_0x99de('0x16')](function(_0x314dcf){_0xb36948[_0x99de('0xa3')]=_0x314dcf;return _0xb36948;});}})[_0x99de('0x16')](respondWithFilteredResult(_0xe0f57c,_0x5ded14))[_0x99de('0x21')](handleError(_0xe0f57c,null));};exports[_0x99de('0xa4')]=function(_0x577b32,_0x199a7d){return db[_0x99de('0x37')][_0x99de('0x4b')]({'where':{'id':_0x577b32[_0x99de('0x4c')]['id']}})[_0x99de('0x16')](handleEntityNotFound(_0x199a7d,null))[_0x99de('0x16')](function(_0x5dbcb1){if(_0x5dbcb1){return _0x5dbcb1[_0x99de('0xa5')](_0x577b32['body'][_0x99de('0x94')],_['omit'](_0x577b32['body'],[_0x99de('0x94'),'id'])||{})[_0x99de('0xa6')](function(){return db[_0x99de('0xa7')]['findAll']({'attributes':['id',_0x99de('0x2e'),_0x99de('0xa8')],'where':{'id':_0x577b32[_0x99de('0x31')][_0x99de('0x94')]}});})['then'](function(_0x2a6f74){socket[_0x99de('0xa9')](_0x99de('0xaa'),{'id':Number(_0x577b32[_0x99de('0x4c')]['id']),'tags':_0x2a6f74||[]});return{'id':Number(_0x577b32[_0x99de('0x4c')]['id']),'tags':_0x2a6f74||[]};});}})['then'](respondWithResult(_0x199a7d,null))['catch'](handleError(_0x199a7d,null));};exports[_0x99de('0xab')]=function(_0x2d0efd,_0x3f97a1){return db[_0x99de('0x37')][_0x99de('0x4b')]({'where':{'id':_0x2d0efd[_0x99de('0x4c')]['id']}})[_0x99de('0x16')](handleEntityNotFound(_0x3f97a1,null))[_0x99de('0x16')](function(_0x4a36df){if(_0x4a36df){return _0x4a36df[_0x99de('0xab')](_0x2d0efd[_0x99de('0x40')][_0x99de('0x94')]);}})['then'](respondWithStatusCode(_0x3f97a1,null))[_0x99de('0x21')](handleError(_0x3f97a1,null));};exports[_0x99de('0xac')]=function(_0x435321,_0x2a86c5){var _0x37db35=moment()[_0x99de('0xad')]()[_0x99de('0xae')]();var _0x1136c0=path['join'](config[_0x99de('0x73')],_0x99de('0xaf'),_0x99de('0xb0'),_0x99de('0xb1'));var _0x5540c1=path[_0x99de('0x72')](config['root'],_0x99de('0xaf'),_0x99de('0xb0'),_0x99de('0xb2'));var _0x3ede1a=path[_0x99de('0x72')](_0x1136c0,_0x37db35);var _0x7ac006=util[_0x99de('0x77')]('transcript-%d-%s.zip',_0x435321[_0x99de('0x4c')]['id'],_0x37db35);var _0xf2182d=path[_0x99de('0x72')](_0x1136c0,_0x7ac006);var _0x316914=[];_0x316914[_0x99de('0xa2')]({'model':db['User'],'as':_0x99de('0x7b'),'attributes':['id',_0x99de('0x57')],'raw':!![]});_0x316914[_0x99de('0xa2')]({'model':db[_0x99de('0x62')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x435321[_0x99de('0x40')][_0x99de('0xb2')]){_0x316914[_0x99de('0xa2')]({'model':db['Attachment'],'as':_0x99de('0x6d'),'raw':!![]});}var _0xac8593=[{'model':db[_0x99de('0x5f')],'as':_0x99de('0x7a'),'attributes':['id',_0x99de('0x31'),_0x99de('0x87'),_0x99de('0x89'),_0x99de('0xb3'),_0x99de('0xb4')],'include':_0x316914}];_0xac8593[_0x99de('0xa2')]({'model':db[_0x99de('0x50')],'as':_0x99de('0xb5'),'attributes':['id','name']});_0xac8593[_0x99de('0xa2')]({'model':db[_0x99de('0x7b')],'as':'Owner','attributes':['id',_0x99de('0x57')]});return db[_0x99de('0x37')][_0x99de('0x4b')]({'where':{'id':_0x435321[_0x99de('0x4c')]['id']},'include':_0xac8593})['then'](handleEntityNotFound(_0x2a86c5,null))['then'](function(_0x2e01b0){if(_0x2e01b0){var _0x5363f0=_0x2e01b0[_0x99de('0xb6')]({'plain':!![]});fs[_0x99de('0xb7')](_0x3ede1a);var _0x14c5ef={'channel':_0x99de('0xb8'),'account':_0x5363f0['Account'][_0x99de('0x2e')],'agent':_0x5363f0[_0x99de('0xb9')]?_0x5363f0[_0x99de('0xb9')][_0x99de('0x57')]:_0x99de('0xba'),'createdAt':moment(_0x5363f0[_0x99de('0x87')])[_0x99de('0x77')](_0x99de('0xbb'))[_0x99de('0xae')](),'closedAt':_0x5363f0[_0x99de('0x6e')]?moment(_0x5363f0[_0x99de('0xbc')])[_0x99de('0x77')](_0x99de('0xbb'))['toString']():'','disposition':_0x5363f0[_0x99de('0x68')],'chatInfo':{'browser':_0x5363f0['browserName'],'os':_0x5363f0['osName'],'referer':_0x5363f0[_0x99de('0xbd')],'customerIp':_0x5363f0[_0x99de('0xbe')],'customerPort':_0x5363f0[_0x99de('0xbf')]?_0x5363f0[_0x99de('0xbf')]:_0x99de('0xba')},'messages':_(_0x5363f0[_0x99de('0x7a')])[_0x99de('0xc0')]()[_0x99de('0x9c')]({'secret':![]})['map'](function(_0x38fce1){if(_0x38fce1[_0x99de('0x6d')]){var _0x1f46e7=path[_0x99de('0x72')](_0x5540c1,_0x38fce1[_0x99de('0x6d')][_0x99de('0x6b')]);if(fs[_0x99de('0xc1')](_0x1f46e7)){fs[_0x99de('0xc2')](_0x1f46e7)['pipe'](fs['createWriteStream'](path['join'](_0x3ede1a,_0x38fce1[_0x99de('0x6d')][_0x99de('0x6b')])));}}return{'date':moment(_0x38fce1[_0x99de('0x87')])[_0x99de('0x77')](_0x99de('0xbb'))[_0x99de('0xae')](),'sender':_0x38fce1['direction']===_0x99de('0xc3')?_0x38fce1['User']?_0x38fce1[_0x99de('0x7b')][_0x99de('0x57')]:_0x99de('0x7e'):_0x38fce1['Contact']['firstName']+(_0x38fce1[_0x99de('0x63')]['lastName']?'\x20'+_0x38fce1[_0x99de('0x63')][_0x99de('0xc4')]:''),'body':_0x38fce1[_0x99de('0x6d')]?_0x38fce1[_0x99de('0x6d')][_0x99de('0x6b')]:_0x38fce1[_0x99de('0x31')],'direction':_0x38fce1[_0x99de('0x89')]===_0x99de('0xc3')?'A':'C','secret':_0x38fce1['secret'],'read':_0x38fce1[_0x99de('0xb4')],'attachment':_0x38fce1[_0x99de('0x6d')]};})[_0x99de('0xc5')]()};return ejs['renderFile'](path[_0x99de('0x72')](config[_0x99de('0x73')],_0x99de('0xaf'),_0x99de('0xc6'),_0x99de('0xc7')),{'interaction':_0x14c5ef})[_0x99de('0x16')](function(_0x1ca5f4){var _0x3b4b4f=path[_0x99de('0x72')](_0x3ede1a,_0x99de('0xc8')+_0x5363f0['id']+'-'+_0x37db35+'.pdf');var _0x1ede47={'path':_0x3b4b4f,'channel':_0x99de('0xb8'),'interactionId':_0x5363f0['id']};return pdf[_0x99de('0xc9')](_0x1ca5f4,_0x1ede47);})['then'](function(){return new Promise(function(_0x12587e,_0x4d5b76){zipdir(_0x3ede1a,{'saveTo':_0xf2182d},function(_0x2c4b3b,_0x410ad0){if(_0x2c4b3b)return _0x4d5b76(_0x2c4b3b);return _0x12587e(_0x410ad0);});})['then'](function(){return new BPromise(function(_0x28ad32,_0x38bcc9){rimraf(_0x3ede1a,function(_0x10f2f7){if(_0x10f2f7)_0x38bcc9(_0x10f2f7);return _0x28ad32();});});})[_0x99de('0x16')](function(){return _0x2a86c5[_0x99de('0xac')](_0xf2182d,_0x7ac006,function(_0x4e81a2){if(_0x4e81a2){logger['error'](_0x99de('0xca'),_0x4e81a2);}else{fs[_0x99de('0xcb')](_0xf2182d);}});});});}else{return _0x2a86c5[_0x99de('0x22')](0xc8);}})[_0x99de('0x21')](handleError(_0x2a86c5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9a1b209..9a192ef 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 _0xe9ba=['then','Users','map','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','getUsers'];(function(_0x5002da,_0x33154f){var _0x4c79ca=function(_0x19451c){while(--_0x19451c){_0x5002da['push'](_0x5002da['shift']());}};_0x4c79ca(++_0x33154f);}(_0xe9ba,0x1a8));var _0xae9b=function(_0x262c2d,_0x4373cb){_0x262c2d=_0x262c2d-0x0;var _0x444ea3=_0xe9ba[_0x262c2d];return _0x444ea3;};'use strict';var EventEmitter=require(_0xae9b('0x0'));var ChatInteraction=require(_0xae9b('0x1'))['db'][_0xae9b('0x2')];var ChatMessage=require(_0xae9b('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xae9b('0x3')](0x0);var events={'afterCreate':_0xae9b('0x4'),'afterUpdate':_0xae9b('0x5'),'afterDestroy':_0xae9b('0x6')};function emitEvent(_0x41c594){return function(_0x485a27,_0x122bb0,_0xd27ca8){_0x485a27[_0xae9b('0x7')]({'attributes':['id'],'raw':!![]})[_0xae9b('0x8')](function(_0x2337ef){_0x485a27['setDataValue'](_0xae9b('0x9'),_0x2337ef[_0xae9b('0xa')](function(_0x259df9){return{'id':_0x259df9['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x485a27['id'],'direction':'in','read':![]},'raw':!![]});})[_0xae9b('0x8')](function(_0xfafcf7){_0x485a27['setDataValue']('unreadMessages',_0xfafcf7[_0xae9b('0xb')]);ChatInteractionEvents[_0xae9b('0xc')](_0x41c594+':'+_0x485a27['id'],_0x485a27);ChatInteractionEvents[_0xae9b('0xc')](_0x41c594,_0x485a27);_0xd27ca8(null);})[_0xae9b('0xd')](_0xd27ca8(null));};}for(var e in events){if(events[_0xae9b('0xe')](e)){var event=events[e];ChatInteraction[_0xae9b('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x1faf=['then','emit','hasOwnProperty','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','setDataValue','Users'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1faf,0x1f1));var _0xf1fa=function(_0x39b63c,_0x22eedd){_0x39b63c=_0x39b63c-0x0;var _0x25c645=_0x1faf[_0x39b63c];return _0x25c645;};'use strict';var EventEmitter=require(_0xf1fa('0x0'));var ChatInteraction=require(_0xf1fa('0x1'))['db'][_0xf1fa('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xf1fa('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf1fa('0x4')](0x0);var events={'afterCreate':_0xf1fa('0x5'),'afterUpdate':_0xf1fa('0x6'),'afterDestroy':_0xf1fa('0x7')};function emitEvent(_0x359496){return function(_0x2888f5,_0x56f7cb,_0x5131b9){_0x2888f5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x59fea9){_0x2888f5[_0xf1fa('0x8')](_0xf1fa('0x9'),_0x59fea9['map'](function(_0x258dba){return{'id':_0x258dba['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2888f5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1fa('0xa')](function(_0x27212d){_0x2888f5[_0xf1fa('0x8')]('unreadMessages',_0x27212d['length']);ChatInteractionEvents['emit'](_0x359496+':'+_0x2888f5['id'],_0x2888f5);ChatInteractionEvents[_0xf1fa('0xb')](_0x359496,_0x2888f5);_0x5131b9(null);})['catch'](_0x5131b9(null));};}for(var e in events){if(events[_0xf1fa('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ea076fa..f679793 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 _0x1b89=['path','rimraf','exports','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x1b89,0x66));var _0x91b8=function(_0x3cb287,_0x40bcde){_0x3cb287=_0x3cb287-0x0;var _0x156532=_0x1b89[_0x3cb287];return _0x156532;};'use strict';var _=require(_0x91b8('0x0'));var util=require(_0x91b8('0x1'));var logger=require(_0x91b8('0x2'))(_0x91b8('0x3'));var moment=require('moment');var BPromise=require(_0x91b8('0x4'));var rp=require(_0x91b8('0x5'));var fs=require('fs');var path=require(_0x91b8('0x6'));var rimraf=require(_0x91b8('0x7'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x91b8('0x8')]=function(_0x1a4925,_0x49b3e8){return _0x1a4925[_0x91b8('0x9')](_0x91b8('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x183f9b,_0x1b3952,_0x1827af){if(_0x183f9b[_0x91b8('0xb')](_0x91b8('0xc'))){_0x183f9b[_0x91b8('0xd')]=moment()[_0x91b8('0xe')](_0x91b8('0xf'));}_0x1827af(null,_0x183f9b);}},'charset':_0x91b8('0x10'),'collate':_0x91b8('0x11')});}; \ No newline at end of file +var _0x2fc6=['./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x93afc8,_0x1a5c64){var _0xf769e0=function(_0x53e341){while(--_0x53e341){_0x93afc8['push'](_0x93afc8['shift']());}};_0xf769e0(++_0x1a5c64);}(_0x2fc6,0x19d));var _0x62fc=function(_0x24092c,_0x171263){_0x24092c=_0x24092c-0x0;var _0x5f2cfc=_0x2fc6[_0x24092c];return _0x5f2cfc;};'use strict';var _=require(_0x62fc('0x0'));var util=require('util');var logger=require(_0x62fc('0x1'))(_0x62fc('0x2'));var moment=require('moment');var BPromise=require(_0x62fc('0x3'));var rp=require(_0x62fc('0x4'));var fs=require('fs');var path=require(_0x62fc('0x5'));var rimraf=require(_0x62fc('0x6'));var config=require('../../config/environment');var attributes=require(_0x62fc('0x7'));module[_0x62fc('0x8')]=function(_0x328196,_0x401747){return _0x328196[_0x62fc('0x9')](_0x62fc('0xa'),attributes,{'tableName':_0x62fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x544db7,_0x1e82fc,_0x444280){if(_0x544db7['changed'](_0x62fc('0xc'))){_0x544db7[_0x62fc('0xd')]=moment()['format'](_0x62fc('0xe'));}_0x444280(null,_0x544db7);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e5e3db8..e3115b6 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 _0xe33f=['error','code','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','update','body','options','where','attributes','catch','ChatInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe33f,0x17a));var _0xfe33=function(_0x59d100,_0x2a2210){_0x59d100=_0x59d100-0x0;var _0x2773be=_0xe33f[_0x59d100];return _0x2773be;};'use strict';var _=require('lodash');var util=require(_0xfe33('0x0'));var moment=require(_0xfe33('0x1'));var BPromise=require(_0xfe33('0x2'));var rs=require(_0xfe33('0x3'));var fs=require('fs');var Redis=require(_0xfe33('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe33('0x5'));var logger=require(_0xfe33('0x6'))('rpc');var config=require(_0xfe33('0x7'));var jayson=require(_0xfe33('0x8'));var client=jayson[_0xfe33('0x9')]['http']({'port':0x232a});config['redis']=_[_0xfe33('0xa')](config[_0xfe33('0xb')],{'host':_0xfe33('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfe33('0xd'))[_0xfe33('0xe')](socket);function respondWithRpcPromise(_0x291eb8,_0x5cdc73,_0x4641ee){return new BPromise(function(_0x4a1c61,_0x5bd7fe){return client[_0xfe33('0xf')](_0x291eb8,_0x4641ee)[_0xfe33('0x10')](function(_0x6b9d7f){logger[_0xfe33('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x5cdc73,_0xfe33('0x12'));logger[_0xfe33('0x13')](_0xfe33('0x14'),_0x5cdc73,'request\x20sent',JSON[_0xfe33('0x15')](_0x6b9d7f));if(_0x6b9d7f['error']){if(_0x6b9d7f[_0xfe33('0x16')][_0xfe33('0x17')]===0x1f4){logger['error'](_0xfe33('0x18'),_0x5cdc73,_0x6b9d7f[_0xfe33('0x16')][_0xfe33('0x19')]);return _0x5bd7fe(_0x6b9d7f[_0xfe33('0x16')]['message']);}logger['error'](_0xfe33('0x18'),_0x5cdc73,_0x6b9d7f[_0xfe33('0x16')][_0xfe33('0x19')]);return _0x4a1c61(_0x6b9d7f[_0xfe33('0x16')][_0xfe33('0x19')]);}else{logger[_0xfe33('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x5cdc73,_0xfe33('0x12'));_0x4a1c61(_0x6b9d7f[_0xfe33('0x1a')][_0xfe33('0x19')]);}})['catch'](function(_0x20250d){logger[_0xfe33('0x16')](_0xfe33('0x18'),_0x5cdc73,_0x20250d);_0x5bd7fe(_0x20250d);});});}exports[_0xfe33('0x1b')]=function(_0x1e5c23){var _0x21cf11=this;return new Promise(function(_0x2d167c,_0x583e49){return db['ChatInteraction'][_0xfe33('0x1c')](_0x1e5c23[_0xfe33('0x1d')],{'raw':_0x1e5c23[_0xfe33('0x1e')]?_0x1e5c23[_0xfe33('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e5c23[_0xfe33('0x1e')]?_0x1e5c23[_0xfe33('0x1e')][_0xfe33('0x1f')]||null:null,'attributes':_0x1e5c23[_0xfe33('0x1e')]?_0x1e5c23[_0xfe33('0x1e')][_0xfe33('0x20')]||null:null,'limit':_0x1e5c23[_0xfe33('0x1e')]?_0x1e5c23[_0xfe33('0x1e')]['limit']||null:null})[_0xfe33('0x10')](function(_0xddc6a){logger[_0xfe33('0x11')]('UpdateChatInteraction',_0x1e5c23);logger[_0xfe33('0x13')](_0xfe33('0x1b'),_0x1e5c23,JSON[_0xfe33('0x15')](_0xddc6a));_0x2d167c(_0xddc6a);})[_0xfe33('0x21')](function(_0x4d2c38){logger[_0xfe33('0x16')](_0xfe33('0x1b'),_0x4d2c38['message'],_0x1e5c23);_0x583e49(_0x21cf11['error'](0x1f4,_0x4d2c38[_0xfe33('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x3bf189){return new Promise(function(_0x59cbda,_0x10fa53){return db[_0xfe33('0x22')]['find']({'where':_0x3bf189['options']?_0x3bf189[_0xfe33('0x1e')][_0xfe33('0x1f')]||null:null})['then'](function(_0x2914ef){if(_0x2914ef){return _0x2914ef[_0xfe33('0x23')](_0x3bf189[_0xfe33('0x1d')][_0xfe33('0x24')],_[_0xfe33('0x25')](_0x3bf189['body'],[_0xfe33('0x24'),'id'])||{});}})[_0xfe33('0x26')](function(_0x1f6a3f){logger[_0xfe33('0x11')]('AddTags',_0x3bf189);logger[_0xfe33('0x13')](_0xfe33('0x27'),_0x3bf189,JSON['stringify'](_0x1f6a3f));_0x59cbda(_0x1f6a3f);})[_0xfe33('0x21')](function(_0x277cd1){logger[_0xfe33('0x16')](_0xfe33('0x27'),_0x277cd1[_0xfe33('0x19')],_0x3bf189);_0x10fa53(_this['error'](0x1f4,_0x277cd1['message']));});});}; \ No newline at end of file +var _0xefc5=['body','options','where','attributes','limit','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','UpdateChatInteraction','ChatInteraction','update'];(function(_0x3ed5cc,_0x576f9a){var _0x301449=function(_0x11429c){while(--_0x11429c){_0x3ed5cc['push'](_0x3ed5cc['shift']());}};_0x301449(++_0x576f9a);}(_0xefc5,0xef));var _0x5efc=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xefc5[_0xd0cd0b];return _0x59cced;};'use strict';var _=require(_0x5efc('0x0'));var util=require(_0x5efc('0x1'));var moment=require(_0x5efc('0x2'));var BPromise=require('bluebird');var rs=require(_0x5efc('0x3'));var fs=require('fs');var Redis=require(_0x5efc('0x4'));var db=require(_0x5efc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5efc('0x6'))(_0x5efc('0x7'));var config=require(_0x5efc('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5efc('0x9')]=_[_0x5efc('0xa')](config[_0x5efc('0x9')],{'host':_0x5efc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5efc('0x9')]));require(_0x5efc('0xc'))[_0x5efc('0xd')](socket);function respondWithRpcPromise(_0x389002,_0x2bf501,_0x1b54e6){return new BPromise(function(_0x290d9b,_0x3a5fd8){return client[_0x5efc('0xe')](_0x389002,_0x1b54e6)[_0x5efc('0xf')](function(_0x4a1dc6){logger['info'](_0x5efc('0x10'),_0x2bf501,_0x5efc('0x11'));logger[_0x5efc('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2bf501,_0x5efc('0x11'),JSON[_0x5efc('0x13')](_0x4a1dc6));if(_0x4a1dc6[_0x5efc('0x14')]){if(_0x4a1dc6['error'][_0x5efc('0x15')]===0x1f4){logger[_0x5efc('0x14')](_0x5efc('0x10'),_0x2bf501,_0x4a1dc6['error'][_0x5efc('0x16')]);return _0x3a5fd8(_0x4a1dc6[_0x5efc('0x14')][_0x5efc('0x16')]);}logger[_0x5efc('0x14')](_0x5efc('0x10'),_0x2bf501,_0x4a1dc6['error'][_0x5efc('0x16')]);return _0x290d9b(_0x4a1dc6['error'][_0x5efc('0x16')]);}else{logger[_0x5efc('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x2bf501,_0x5efc('0x11'));_0x290d9b(_0x4a1dc6['result']['message']);}})['catch'](function(_0x5c1ade){logger['error'](_0x5efc('0x10'),_0x2bf501,_0x5c1ade);_0x3a5fd8(_0x5c1ade);});});}exports[_0x5efc('0x18')]=function(_0x5dfd11){var _0x248723=this;return new Promise(function(_0x546e40,_0x46879c){return db[_0x5efc('0x19')][_0x5efc('0x1a')](_0x5dfd11[_0x5efc('0x1b')],{'raw':_0x5dfd11['options']?_0x5dfd11[_0x5efc('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dfd11[_0x5efc('0x1c')]?_0x5dfd11[_0x5efc('0x1c')][_0x5efc('0x1d')]||null:null,'attributes':_0x5dfd11[_0x5efc('0x1c')]?_0x5dfd11[_0x5efc('0x1c')][_0x5efc('0x1e')]||null:null,'limit':_0x5dfd11[_0x5efc('0x1c')]?_0x5dfd11[_0x5efc('0x1c')][_0x5efc('0x1f')]||null:null})[_0x5efc('0xf')](function(_0x5da14a){logger[_0x5efc('0x17')](_0x5efc('0x18'),_0x5dfd11);logger[_0x5efc('0x12')]('UpdateChatInteraction',_0x5dfd11,JSON[_0x5efc('0x13')](_0x5da14a));_0x546e40(_0x5da14a);})['catch'](function(_0x3f6d26){logger[_0x5efc('0x14')](_0x5efc('0x18'),_0x3f6d26[_0x5efc('0x16')],_0x5dfd11);_0x46879c(_0x248723[_0x5efc('0x14')](0x1f4,_0x3f6d26[_0x5efc('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x4ffa09){return new Promise(function(_0x5ad668,_0x356ece){return db[_0x5efc('0x19')]['find']({'where':_0x4ffa09[_0x5efc('0x1c')]?_0x4ffa09[_0x5efc('0x1c')][_0x5efc('0x1d')]||null:null})['then'](function(_0x683a35){if(_0x683a35){return _0x683a35[_0x5efc('0x20')](_0x4ffa09[_0x5efc('0x1b')][_0x5efc('0x21')],_[_0x5efc('0x22')](_0x4ffa09[_0x5efc('0x1b')],[_0x5efc('0x21'),'id'])||{});}})[_0x5efc('0x23')](function(_0x2180f7){logger[_0x5efc('0x17')](_0x5efc('0x24'),_0x4ffa09);logger[_0x5efc('0x12')](_0x5efc('0x24'),_0x4ffa09,JSON[_0x5efc('0x13')](_0x2180f7));_0x5ad668(_0x2180f7);})[_0x5efc('0x25')](function(_0x585067){logger[_0x5efc('0x14')](_0x5efc('0x24'),_0x585067[_0x5efc('0x16')],_0x4ffa09);_0x356ece(_this[_0x5efc('0x14')](0x1f4,_0x585067[_0x5efc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 321595c..95f8ed8 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 _0xa16e=['emit','removeListener','register','length','chatInteraction:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa16e,0xcd));var _0xea16=function(_0x425d83,_0x236601){_0x425d83=_0x425d83-0x0;var _0x344b8b=_0xa16e[_0x425d83];return _0x344b8b;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xea16('0x0'),_0xea16('0x1'),_0xea16('0x2')];function createListener(_0x4d9f1a,_0x318918){return function(_0x23376c){_0x318918[_0xea16('0x3')](_0x4d9f1a,_0x23376c);};}function removeListener(_0xe6413e,_0x49e443){return function(){ChatInteractionEvents[_0xea16('0x4')](_0xe6413e,_0x49e443);};}exports[_0xea16('0x5')]=function(_0x2c06b0){for(var _0x491b60=0x0,_0x4bc088=events[_0xea16('0x6')];_0x491b60<_0x4bc088;_0x491b60++){var _0x267e29=events[_0x491b60];var _0x374e4d=createListener(_0xea16('0x7')+_0x267e29,_0x2c06b0);ChatInteractionEvents['on'](_0x267e29,_0x374e4d);}}; \ No newline at end of file +var _0x2168=['register','length','chatInteraction:','save','remove','update','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2168,0x15b));var _0x8216=function(_0x88b5f7,_0x413271){_0x88b5f7=_0x88b5f7-0x0;var _0x52b7cc=_0x2168[_0x88b5f7];return _0x52b7cc;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x8216('0x0'),_0x8216('0x1'),_0x8216('0x2')];function createListener(_0x10dcf5,_0x3b1393){return function(_0x434c3f){_0x3b1393[_0x8216('0x3')](_0x10dcf5,_0x434c3f);};}function removeListener(_0x1b7bca,_0x5c5cb7){return function(){ChatInteractionEvents[_0x8216('0x4')](_0x1b7bca,_0x5c5cb7);};}exports[_0x8216('0x5')]=function(_0x777c10){for(var _0x145f39=0x0,_0x436c67=events[_0x8216('0x6')];_0x145f39<_0x436c67;_0x145f39++){var _0x16edb3=events[_0x145f39];var _0x4d43ed=createListener(_0x8216('0x7')+_0x16edb3,_0x777c10);ChatInteractionEvents['on'](_0x16edb3,_0x4d43ed);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 6787b15..e634715 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 _0x8892=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','post','isAuthenticated','create','/:id/vidaoo','diskStorage','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8892,0xfa));var _0x2889=function(_0x4f2e46,_0x3bd517){_0x4f2e46=_0x4f2e46-0x0;var _0x4f8b04=_0x8892[_0x4f2e46];return _0x4f8b04;};'use strict';var multer=require(_0x2889('0x0'));var util=require('util');var path=require(_0x2889('0x1'));var timeout=require(_0x2889('0x2'));var express=require(_0x2889('0x3'));var router=express[_0x2889('0x4')]();var fs_extra=require(_0x2889('0x5'));var auth=require(_0x2889('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2889('0x7'));var controller=require(_0x2889('0x8'));router[_0x2889('0x9')]('/',auth['isAuthenticated'](),controller[_0x2889('0xa')]);router['get'](_0x2889('0xb'),auth['isAuthenticated'](),controller[_0x2889('0xc')]);router[_0x2889('0x9')](_0x2889('0xd'),auth[_0x2889('0xe')](),controller[_0x2889('0xf')]);router[_0x2889('0x9')](_0x2889('0x10'),auth[_0x2889('0xe')](),controller[_0x2889('0x11')]);router[_0x2889('0x9')](_0x2889('0x12'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x2889('0x13'),auth[_0x2889('0xe')](),controller['getMyMessages']);router[_0x2889('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2889('0x14')]('/',auth[_0x2889('0x15')](),controller[_0x2889('0x16')]);router[_0x2889('0x14')](_0x2889('0x17'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x2889('0x18')]({'destination':function(_0x291089,_0x22a548,_0x415ec5){_0x415ec5(null,path['join'](config[_0x2889('0x19')],'server/files/attachments/'));},'filename':function(_0x2eb0c6,_0x3f1d16,_0xab09bf){_0xab09bf(null,util[_0x2889('0x1a')](_0x2889('0x1b'),Date[_0x2889('0x1c')](),_0x3f1d16[_0x2889('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2889('0x14')](_0x2889('0x1e'),upload[_0x2889('0x1f')]('file'),controller['attachmentUpload']);router[_0x2889('0x14')](_0x2889('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x2889('0x20')]);router['post'](_0x2889('0x21'),auth['isAuthenticated'](),interaction[_0x2889('0x22')](_0x2889('0x23'),_0x2889('0x24')),controller[_0x2889('0x25')]);router[_0x2889('0x26')](_0x2889('0xd'),auth[_0x2889('0x15')](),interaction['tracked']('chat',_0x2889('0x27')),controller[_0x2889('0x28')]);router[_0x2889('0x26')](_0x2889('0x29'),controller[_0x2889('0x2a')]);router[_0x2889('0x26')]('/:id/abandon',auth[_0x2889('0xe')](),controller[_0x2889('0x2b')]);router['put'](_0x2889('0x2c'),controller[_0x2889('0x2d')]);router[_0x2889('0x2e')]('/:id',auth[_0x2889('0x15')](),interaction[_0x2889('0x22')](_0x2889('0x23'),_0x2889('0x2f')),controller[_0x2889('0x30')]);router[_0x2889('0x2e')](_0x2889('0x21'),auth[_0x2889('0x15')](),controller[_0x2889('0x31')]);module['exports']=router; \ No newline at end of file +var _0xff3c=['chatinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/abandon','close','delete'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xff3c,0x12a));var _0xcff3=function(_0xf32741,_0x43ce1c){_0xf32741=_0xf32741-0x0;var _0x9810e5=_0xff3c[_0xf32741];return _0x9810e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcff3('0x0'));var timeout=require(_0xcff3('0x1'));var express=require('express');var router=express[_0xcff3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcff3('0x3'));var interaction=require(_0xcff3('0x4'));var config=require('../../config/environment');var controller=require(_0xcff3('0x5'));router[_0xcff3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcff3('0x6')](_0xcff3('0x7'),auth[_0xcff3('0x8')](),controller[_0xcff3('0x9')]);router['get'](_0xcff3('0xa'),auth[_0xcff3('0xb')](),controller[_0xcff3('0xc')]);router[_0xcff3('0x6')]('/:id/attachment_download',auth[_0xcff3('0xb')](),controller[_0xcff3('0xd')]);router[_0xcff3('0x6')](_0xcff3('0xe'),auth[_0xcff3('0x8')](),controller['getMessages']);router['get'](_0xcff3('0xf'),auth[_0xcff3('0xb')](),controller[_0xcff3('0x10')]);router[_0xcff3('0x6')]('/:id/download',auth[_0xcff3('0x8')](),controller['download']);router['post']('/',auth[_0xcff3('0x8')](),controller[_0xcff3('0x11')]);router[_0xcff3('0x12')](_0xcff3('0x13'),auth[_0xcff3('0x8')](),controller[_0xcff3('0x14')]);var upload=multer({'storage':multer[_0xcff3('0x15')]({'destination':function(_0x48a382,_0x4be9e8,_0x5eb60b){_0x5eb60b(null,path[_0xcff3('0x16')](config[_0xcff3('0x17')],_0xcff3('0x18')));},'filename':function(_0x308718,_0x1970ce,_0x18b57e){_0x18b57e(null,util[_0xcff3('0x19')](_0xcff3('0x1a'),Date[_0xcff3('0x1b')](),_0x1970ce[_0xcff3('0x1c')][_0xcff3('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xcff3('0x1e'),upload[_0xcff3('0x1f')](_0xcff3('0x20')),controller[_0xcff3('0x21')]);router[_0xcff3('0x12')]('/:id/messages',auth[_0xcff3('0xb')](),controller[_0xcff3('0x22')]);router[_0xcff3('0x12')](_0xcff3('0x23'),auth[_0xcff3('0x8')](),interaction[_0xcff3('0x24')](_0xcff3('0x25'),_0xcff3('0x26')),controller[_0xcff3('0x27')]);router[_0xcff3('0x28')](_0xcff3('0xa'),auth[_0xcff3('0x8')](),interaction[_0xcff3('0x24')](_0xcff3('0x25'),'chatinteraction:update'),controller[_0xcff3('0x29')]);router[_0xcff3('0x28')]('/:id/custom_update',controller['customUpdate']);router['put'](_0xcff3('0x2a'),auth[_0xcff3('0xb')](),controller['abandon']);router[_0xcff3('0x28')]('/:id/close',controller[_0xcff3('0x2b')]);router[_0xcff3('0x2c')](_0xcff3('0xa'),auth[_0xcff3('0x8')](),interaction[_0xcff3('0x24')](_0xcff3('0x25'),_0xcff3('0x2d')),controller[_0xcff3('0x2e')]);router[_0xcff3('0x2c')](_0xcff3('0x23'),auth['isAuthenticated'](),controller[_0xcff3('0x2f')]);module[_0xcff3('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7606c30..9533b34 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 _0x2938=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0xe37bb4,_0x21a453){var _0x53b9db=function(_0xd7851){while(--_0xd7851){_0xe37bb4['push'](_0xe37bb4['shift']());}};_0x53b9db(++_0x21a453);}(_0x2938,0xe1));var _0x8293=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2938[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x8293('0x0'));module[_0x8293('0x1')]={'body':{'type':Sequelize[_0x8293('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8293('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8293('0x4')]}}; \ No newline at end of file +var _0xd77d=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0xd77d,0x198));var _0xdd77=function(_0x260ea2,_0x545ddb){_0x260ea2=_0x260ea2-0x0;var _0x3227d0=_0xd77d[_0x260ea2];return _0x3227d0;};'use strict';var Sequelize=require(_0xdd77('0x0'));module[_0xdd77('0x1')]={'body':{'type':Sequelize[_0xdd77('0x2')](_0xdd77('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdd77('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdd77('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 375d322..37dad4b 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 _0xeafe=['sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','ToId','read','-createdAt','all','eml-format','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x31adf9,_0x511868){var _0x4412b5=function(_0x192d84){while(--_0x192d84){_0x31adf9['push'](_0x31adf9['shift']());}};_0x4412b5(++_0x511868);}(_0xeafe,0x1e3));var _0xeeaf=function(_0x394ac6,_0x3cf2e0){_0x394ac6=_0x394ac6-0x0;var _0x58be47=_0xeafe[_0x394ac6];return _0x58be47;};'use strict';var emlformat=require(_0xeeaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeeaf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeeaf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xeeaf('0x3'));var util=require('util');var path=require(_0xeeaf('0x4'));var sox=require(_0xeeaf('0x5'));var csv=require(_0xeeaf('0x6'));var ejs=require(_0xeeaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeeaf('0x8'));var crypto=require(_0xeeaf('0x9'));var jsforce=require(_0xeeaf('0xa'));var deskjs=require(_0xeeaf('0xb'));var toCsv=require(_0xeeaf('0x6'));var querystring=require(_0xeeaf('0xc'));var Papa=require(_0xeeaf('0xd'));var Redis=require(_0xeeaf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xeeaf('0xf'));var as=require(_0xeeaf('0x10'));var hardwareService=require(_0xeeaf('0x11'));var logger=require(_0xeeaf('0x12'))(_0xeeaf('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeeaf('0x14'))['db'];config[_0xeeaf('0x15')]=_['defaults'](config['redis'],{'host':_0xeeaf('0x16'),'port':0x18eb});var socket=require(_0xeeaf('0x17'))(new Redis(config[_0xeeaf('0x15')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x59332e,_0x102b02){_0x102b02=_0x102b02||0xcc;return function(_0x503f30){if(_0x503f30){return _0x59332e['sendStatus'](_0x102b02);}return _0x59332e['status'](_0x102b02)[_0xeeaf('0x18')]();};}function respondWithResult(_0x24ec9a,_0x302c2a){_0x302c2a=_0x302c2a||0xc8;return function(_0x3b0f8c){if(_0x3b0f8c){return _0x24ec9a[_0xeeaf('0x19')](_0x302c2a)[_0xeeaf('0x1a')](_0x3b0f8c);}};}function respondWithFilteredResult(_0x3aa19d,_0x1b1b01){return function(_0x5488c1){if(_0x5488c1){var _0x288139=typeof _0x1b1b01[_0xeeaf('0x1b')]===_0xeeaf('0x1c')&&typeof _0x1b1b01['limit']===_0xeeaf('0x1c');var _0x394f82=_0x5488c1[_0xeeaf('0x1d')];var _0x1082f5=_0x288139?0x0:_0x1b1b01[_0xeeaf('0x1b')];var _0x50ac03=_0x288139?_0x5488c1[_0xeeaf('0x1d')]:_0x1b1b01['offset']+_0x1b1b01['limit'];var _0x378e09;if(_0x50ac03>=_0x394f82){_0x50ac03=_0x394f82;_0x378e09=0xc8;}else{_0x378e09=0xce;}_0x3aa19d[_0xeeaf('0x19')](_0x378e09);return _0x3aa19d[_0xeeaf('0x1e')](_0xeeaf('0x1f'),_0x1082f5+'-'+_0x50ac03+'/'+_0x394f82)[_0xeeaf('0x1a')](_0x5488c1);}return null;};}function patchUpdates(_0x3278ff){return function(_0x3167ff){try{jsonpatch['apply'](_0x3167ff,_0x3278ff,!![]);}catch(_0x58dc67){return BPromise[_0xeeaf('0x20')](_0x58dc67);}return _0x3167ff[_0xeeaf('0x21')]();};}function saveUpdates(_0x435e90,_0x20fa31){return function(_0x1b4fff){if(_0x1b4fff){return _0x1b4fff[_0xeeaf('0x22')](_0x435e90)[_0xeeaf('0x23')](function(_0x262174){return _0x262174;});}return null;};}function removeEntity(_0x4df4c3,_0x5711ce){return function(_0x1fc4d1){if(_0x1fc4d1){return _0x1fc4d1[_0xeeaf('0x24')]()[_0xeeaf('0x23')](function(){_0x4df4c3[_0xeeaf('0x19')](0xcc)[_0xeeaf('0x18')]();});}};}function handleEntityNotFound(_0x5b5171,_0x1f11f1){return function(_0x5ea7be){if(!_0x5ea7be){_0x5b5171[_0xeeaf('0x25')](0x194);}return _0x5ea7be;};}function handleError(_0x176bef,_0x4a9bfe){_0x4a9bfe=_0x4a9bfe||0x1f4;return function(_0x5ef2f6){logger[_0xeeaf('0x26')](_0x5ef2f6['stack']);if(_0x5ef2f6[_0xeeaf('0x27')]){delete _0x5ef2f6[_0xeeaf('0x27')];}_0x176bef[_0xeeaf('0x19')](_0x4a9bfe)[_0xeeaf('0x28')](_0x5ef2f6);};}exports[_0xeeaf('0x29')]=function(_0x4aa86d,_0x2d2bd2){var _0x52c85f={},_0x1adb45={},_0x4f9141={'count':0x0,'rows':[]};var _0x1d311f=_['map'](db['ChatInternalMessage'][_0xeeaf('0x2a')],function(_0x55f06c){return{'name':_0x55f06c[_0xeeaf('0x2b')],'type':_0x55f06c[_0xeeaf('0x2c')][_0xeeaf('0x2d')]};});_0x1adb45[_0xeeaf('0x2e')]=_[_0xeeaf('0x2f')](_0x1d311f,'name');_0x1adb45[_0xeeaf('0x30')]=_[_0xeeaf('0x31')](_0x4aa86d[_0xeeaf('0x30')]);_0x1adb45[_0xeeaf('0x32')]=_[_0xeeaf('0x33')](_0x1adb45['model'],_0x1adb45['query']);_0x52c85f[_0xeeaf('0x34')]=_['intersection'](_0x1adb45[_0xeeaf('0x2e')],qs[_0xeeaf('0x35')](_0x4aa86d['query']['fields']));_0x52c85f[_0xeeaf('0x34')]=_0x52c85f[_0xeeaf('0x34')][_0xeeaf('0x36')]?_0x52c85f[_0xeeaf('0x34')]:_0x1adb45[_0xeeaf('0x2e')];if(!_0x4aa86d['query']['hasOwnProperty']('nolimit')){_0x52c85f[_0xeeaf('0x37')]=qs[_0xeeaf('0x37')](_0x4aa86d[_0xeeaf('0x30')][_0xeeaf('0x37')]);_0x52c85f['offset']=qs[_0xeeaf('0x1b')](_0x4aa86d['query']['offset']);}_0x52c85f[_0xeeaf('0x38')]=qs[_0xeeaf('0x39')](_0x4aa86d[_0xeeaf('0x30')][_0xeeaf('0x39')]);_0x52c85f[_0xeeaf('0x3a')]=qs[_0xeeaf('0x32')](_['pick'](_0x4aa86d[_0xeeaf('0x30')],_0x1adb45[_0xeeaf('0x32')]),_0x1d311f);if(_0x4aa86d[_0xeeaf('0x30')][_0xeeaf('0x3b')]){_0x52c85f[_0xeeaf('0x3a')]=_['merge'](_0x52c85f[_0xeeaf('0x3a')],{'$or':_[_0xeeaf('0x2f')](_0x1d311f,function(_0x424efc){if(_0x424efc[_0xeeaf('0x2c')]!==_0xeeaf('0x3c')){var _0x7d392a={};_0x7d392a[_0x424efc[_0xeeaf('0x27')]]={'$like':'%'+_0x4aa86d[_0xeeaf('0x30')][_0xeeaf('0x3b')]+'%'};return _0x7d392a;}})});}_0x52c85f=_[_0xeeaf('0x3d')]({},_0x52c85f,_0x4aa86d[_0xeeaf('0x3e')]);var _0x2320a0={'where':_0x52c85f[_0xeeaf('0x3a')]};return db[_0xeeaf('0x3f')]['count'](_0x2320a0)[_0xeeaf('0x23')](function(_0x37fcd0){_0x4f9141[_0xeeaf('0x1d')]=_0x37fcd0;if(_0x4aa86d[_0xeeaf('0x30')][_0xeeaf('0x40')]){_0x52c85f[_0xeeaf('0x41')]=[{'all':!![]}];}return db[_0xeeaf('0x3f')][_0xeeaf('0x42')](_0x52c85f);})[_0xeeaf('0x23')](function(_0x1b6775){_0x4f9141[_0xeeaf('0x43')]=_0x1b6775;return _0x4f9141;})[_0xeeaf('0x23')](respondWithFilteredResult(_0x2d2bd2,_0x52c85f))[_0xeeaf('0x44')](handleError(_0x2d2bd2,null));};exports[_0xeeaf('0x45')]=function(_0x4bbb65,_0x1e1995){var _0x58541e={'raw':!![],'where':{'id':_0x4bbb65[_0xeeaf('0x46')]['id']}},_0x41cad5={};_0x41cad5[_0xeeaf('0x2e')]=_[_0xeeaf('0x31')](db['ChatInternalMessage'][_0xeeaf('0x2a')]);_0x41cad5[_0xeeaf('0x30')]=_[_0xeeaf('0x31')](_0x4bbb65['query']);_0x41cad5['filters']=_[_0xeeaf('0x33')](_0x41cad5[_0xeeaf('0x2e')],_0x41cad5['query']);_0x58541e[_0xeeaf('0x34')]=_[_0xeeaf('0x33')](_0x41cad5['model'],qs['fields'](_0x4bbb65[_0xeeaf('0x30')][_0xeeaf('0x35')]));_0x58541e[_0xeeaf('0x34')]=_0x58541e[_0xeeaf('0x34')][_0xeeaf('0x36')]?_0x58541e['attributes']:_0x41cad5[_0xeeaf('0x2e')];if(_0x4bbb65['query'][_0xeeaf('0x40')]){_0x58541e['include']=[{'all':!![]}];}_0x58541e=_[_0xeeaf('0x3d')]({},_0x58541e,_0x4bbb65[_0xeeaf('0x3e')]);return db['ChatInternalMessage'][_0xeeaf('0x47')](_0x58541e)['then'](handleEntityNotFound(_0x1e1995,null))[_0xeeaf('0x23')](respondWithResult(_0x1e1995,null))[_0xeeaf('0x44')](handleError(_0x1e1995,null));};exports[_0xeeaf('0x48')]=function(_0x1da369,_0xbe4f0d){return db[_0xeeaf('0x3f')][_0xeeaf('0x48')](_0x1da369['body'],{})[_0xeeaf('0x23')](respondWithResult(_0xbe4f0d,0xc9))[_0xeeaf('0x44')](handleError(_0xbe4f0d,null));};exports[_0xeeaf('0x22')]=function(_0x5a5ea5,_0xd90447){if(_0x5a5ea5['body']['id']){delete _0x5a5ea5[_0xeeaf('0x49')]['id'];}return db[_0xeeaf('0x3f')]['find']({'where':{'id':_0x5a5ea5[_0xeeaf('0x46')]['id']}})['then'](handleEntityNotFound(_0xd90447,null))[_0xeeaf('0x23')](saveUpdates(_0x5a5ea5['body'],null))[_0xeeaf('0x23')](respondWithResult(_0xd90447,null))[_0xeeaf('0x44')](handleError(_0xd90447,null));};exports[_0xeeaf('0x24')]=function(_0x1be4a0,_0x38a96e){return db[_0xeeaf('0x3f')][_0xeeaf('0x47')]({'where':{'id':_0x1be4a0['params']['id']}})[_0xeeaf('0x23')](handleEntityNotFound(_0x38a96e,null))[_0xeeaf('0x23')](removeEntity(_0x38a96e,null))[_0xeeaf('0x44')](handleError(_0x38a96e,null));};exports[_0xeeaf('0x4a')]=function(_0xb65196,_0x3d7191){return db[_0xeeaf('0x3f')][_0xeeaf('0x4a')]()[_0xeeaf('0x23')](respondWithResult(_0x3d7191,null))['catch'](handleError(_0x3d7191,null));};function wrapUser(_0x26d5ba){return function(_0x1c95e0){var _0x1a629c=_0x26d5ba[_0xeeaf('0x4b')]({'plain':!![]});_0x1a629c['messages']=[];if(_0x1c95e0){_0x1a629c[_0xeeaf('0x4c')]=_0x1c95e0[_0xeeaf('0x4d')];_0x1a629c[_0xeeaf('0x4e')]=_0x1c95e0;}else{_0x1a629c['lastMessageAt']=moment(0x0)['format'](_0xeeaf('0x4f'));_0x1a629c[_0xeeaf('0x4e')]={};}return _0x1a629c;};}exports[_0xeeaf('0x50')]=function(_0x4ea5f6,_0x3fd18b,_0x23f8dd){var _0x2be0e4=[];return db['User']['findAll']({'where':{'role':[_0xeeaf('0x51'),_0xeeaf('0x52'),_0xeeaf('0x53')]},'attributes':['id',_0xeeaf('0x54'),'name',_0xeeaf('0x55'),'userpic','internal',_0xeeaf('0x56'),_0xeeaf('0x57'),'allowmessenger',_0xeeaf('0x58')],'order':qs[_0xeeaf('0x39')](_0xeeaf('0x59')),'include':[{'model':db[_0xeeaf('0x5a')],'as':_0xeeaf('0x5b'),'attributes':['id',_0xeeaf('0x27'),_0xeeaf('0x2c')],'through':{'attributes':[]}}]})[_0xeeaf('0x23')](function(_0x19e658){if(_0x19e658){var _0x3e5d80=_0x4ea5f6[_0xeeaf('0x53')][_0xeeaf('0x4b')]({'plain':!![]});if(!_0x3e5d80)throw new Error(_0xeeaf('0x5c'));if(_0x3e5d80[_0xeeaf('0x55')]===_0xeeaf('0x53')){return db[_0xeeaf('0x5d')][_0xeeaf('0x47')]({'where':{'name':_0xeeaf('0x5e'),'userProfileId':_0x3e5d80[_0xeeaf('0x5f')]},'raw':!![]})['then'](function(_0x3a26aa){if(_0x3a26aa){if(_0x3a26aa[_0xeeaf('0x60')]===0x0){return db[_0xeeaf('0x61')][_0xeeaf('0x42')]({'where':{'sectionId':_0x3a26aa['id']},'raw':!![]})['then'](function(_0x3c8294){var _0x54bd27=[];if(_[_0xeeaf('0x62')](_0x3c8294)){_0x54bd27=_['filter'](_0x19e658,function(_0x3ea501){if(_0x3ea501[_0xeeaf('0x55')]!==_0xeeaf('0x51')){return _0x3ea501;}});return _0x54bd27;}else{for(var _0x4b26a8=0x0;_0x4b26a8<_0x19e658[_0xeeaf('0x36')];_0x4b26a8++){var _0x43288c=_0x19e658[_0x4b26a8];if(_0x43288c[_0xeeaf('0x55')]==='agent'){var _0x5eb79d=_[_0xeeaf('0x47')](_0x3c8294,function(_0x334083){return _0x334083['resourceId']===_0x43288c['id'];});if(_0x5eb79d)_0x54bd27[_0xeeaf('0x63')](_0x43288c);}else{_0x54bd27['push'](_0x43288c);}}return _0x54bd27;}});}else{return _0x19e658;}}else{var _0x452bd0=_[_0xeeaf('0x3b')](_0x19e658,function(_0x34f1fd){if(_0x34f1fd[_0xeeaf('0x55')]!==_0xeeaf('0x51')){return _0x34f1fd;}});return _0x452bd0;}});}else{return _0x19e658;}}})['then'](function(_0x56b569){var _0x129af2=[];if(_0x56b569){_0x2be0e4=_0x56b569;for(var _0x1fba24=0x0;_0x1fba24<_0x56b569[_0xeeaf('0x36')];_0x1fba24+=0x1){_0x2be0e4[_0x1fba24]['messages']=[];_0x129af2[_0xeeaf('0x63')](db[_0xeeaf('0x3f')][_0xeeaf('0x47')]({'where':{'FromId':[_0x4ea5f6[_0xeeaf('0x53')]['id'],_0x56b569[_0x1fba24]['id']],'ToId':[_0x4ea5f6[_0xeeaf('0x53')]['id'],_0x56b569[_0x1fba24]['id']],'ChatGroupId':null},'attributes':['id',_0xeeaf('0x4d'),'FromId',_0xeeaf('0x64'),_0xeeaf('0x65'),_0xeeaf('0x49')],'order':qs['sort'](_0xeeaf('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xeeaf('0x23')](wrapUser(_0x56b569[_0x1fba24])));}return BPromise[_0xeeaf('0x67')](_0x129af2);}return[];})[_0xeeaf('0x23')](function(_0x3dd37c){return{'rows':_0x3dd37c,'count':_0x3dd37c[_0xeeaf('0x36')]};})[_0xeeaf('0x23')](respondWithResult(_0x3fd18b,null))[_0xeeaf('0x44')](handleError(_0x3fd18b,null));}; \ No newline at end of file +var _0xea65=['../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','ChatInternalMessage','includeAll','include','rows','catch','show','find','create','body','params','describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x55976e,_0x37b18c){var _0x27023a=function(_0x2923c9){while(--_0x2923c9){_0x55976e['push'](_0x55976e['shift']());}};_0x27023a(++_0x37b18c);}(_0xea65,0x141));var _0x5ea6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xea65[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ea6('0x0'));var jsonpatch=require(_0x5ea6('0x1'));var rp=require(_0x5ea6('0x2'));var moment=require(_0x5ea6('0x3'));var BPromise=require(_0x5ea6('0x4'));var Mustache=require('mustache');var util=require(_0x5ea6('0x5'));var path=require(_0x5ea6('0x6'));var sox=require(_0x5ea6('0x7'));var csv=require(_0x5ea6('0x8'));var ejs=require(_0x5ea6('0x9'));var fs=require('fs');var fs_extra=require(_0x5ea6('0xa'));var _=require(_0x5ea6('0xb'));var squel=require(_0x5ea6('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ea6('0xd'));var deskjs=require(_0x5ea6('0xe'));var toCsv=require(_0x5ea6('0x8'));var querystring=require(_0x5ea6('0xf'));var Papa=require(_0x5ea6('0x10'));var Redis=require(_0x5ea6('0x11'));var authService=require(_0x5ea6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5ea6('0x13'));var hardwareService=require(_0x5ea6('0x14'));var logger=require(_0x5ea6('0x15'))(_0x5ea6('0x16'));var utils=require(_0x5ea6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5ea6('0x18')]=_[_0x5ea6('0x19')](config[_0x5ea6('0x18')],{'host':_0x5ea6('0x1a'),'port':0x18eb});var socket=require(_0x5ea6('0x1b'))(new Redis(config[_0x5ea6('0x18')]));require(_0x5ea6('0x1c'))['register'](socket);function respondWithStatusCode(_0x570148,_0x1f0906){_0x1f0906=_0x1f0906||0xcc;return function(_0x34b2a0){if(_0x34b2a0){return _0x570148[_0x5ea6('0x1d')](_0x1f0906);}return _0x570148[_0x5ea6('0x1e')](_0x1f0906)['end']();};}function respondWithResult(_0x519a56,_0x286b21){_0x286b21=_0x286b21||0xc8;return function(_0x5e4c57){if(_0x5e4c57){return _0x519a56[_0x5ea6('0x1e')](_0x286b21)['json'](_0x5e4c57);}};}function respondWithFilteredResult(_0x11e712,_0x712c54){return function(_0x532e8b){if(_0x532e8b){var _0x4bbea5=typeof _0x712c54[_0x5ea6('0x1f')]===_0x5ea6('0x20')&&typeof _0x712c54[_0x5ea6('0x21')]===_0x5ea6('0x20');var _0x44abd4=_0x532e8b[_0x5ea6('0x22')];var _0x370b23=_0x4bbea5?0x0:_0x712c54[_0x5ea6('0x1f')];var _0x5d57f8=_0x4bbea5?_0x532e8b[_0x5ea6('0x22')]:_0x712c54[_0x5ea6('0x1f')]+_0x712c54[_0x5ea6('0x21')];var _0x2133c6;if(_0x5d57f8>=_0x44abd4){_0x5d57f8=_0x44abd4;_0x2133c6=0xc8;}else{_0x2133c6=0xce;}_0x11e712['status'](_0x2133c6);return _0x11e712['set'](_0x5ea6('0x23'),_0x370b23+'-'+_0x5d57f8+'/'+_0x44abd4)['json'](_0x532e8b);}return null;};}function patchUpdates(_0x387aae){return function(_0x559e62){try{jsonpatch[_0x5ea6('0x24')](_0x559e62,_0x387aae,!![]);}catch(_0x56c481){return BPromise['reject'](_0x56c481);}return _0x559e62[_0x5ea6('0x25')]();};}function saveUpdates(_0x12229a,_0x624c6f){return function(_0x2016cb){if(_0x2016cb){return _0x2016cb[_0x5ea6('0x26')](_0x12229a)[_0x5ea6('0x27')](function(_0x362b83){return _0x362b83;});}return null;};}function removeEntity(_0x23559a,_0x3bab8c){return function(_0x166958){if(_0x166958){return _0x166958[_0x5ea6('0x28')]()[_0x5ea6('0x27')](function(){_0x23559a[_0x5ea6('0x1e')](0xcc)[_0x5ea6('0x29')]();});}};}function handleEntityNotFound(_0x5a943f,_0x1a1c2e){return function(_0x25c711){if(!_0x25c711){_0x5a943f[_0x5ea6('0x1d')](0x194);}return _0x25c711;};}function handleError(_0x33f9d9,_0x5dd328){_0x5dd328=_0x5dd328||0x1f4;return function(_0x2c4fc8){logger[_0x5ea6('0x2a')](_0x2c4fc8['stack']);if(_0x2c4fc8[_0x5ea6('0x2b')]){delete _0x2c4fc8['name'];}_0x33f9d9[_0x5ea6('0x1e')](_0x5dd328)[_0x5ea6('0x2c')](_0x2c4fc8);};}exports[_0x5ea6('0x2d')]=function(_0x3510d2,_0x8c7431){var _0x4dde76={},_0x545ef9={},_0x2af232={'count':0x0,'rows':[]};var _0xf4f138=_['map'](db['ChatInternalMessage'][_0x5ea6('0x2e')],function(_0x7330a0){return{'name':_0x7330a0['fieldName'],'type':_0x7330a0['type'][_0x5ea6('0x2f')]};});_0x545ef9[_0x5ea6('0x30')]=_[_0x5ea6('0x31')](_0xf4f138,'name');_0x545ef9[_0x5ea6('0x32')]=_[_0x5ea6('0x33')](_0x3510d2[_0x5ea6('0x32')]);_0x545ef9[_0x5ea6('0x34')]=_[_0x5ea6('0x35')](_0x545ef9['model'],_0x545ef9[_0x5ea6('0x32')]);_0x4dde76[_0x5ea6('0x36')]=_[_0x5ea6('0x35')](_0x545ef9['model'],qs[_0x5ea6('0x37')](_0x3510d2[_0x5ea6('0x32')][_0x5ea6('0x37')]));_0x4dde76[_0x5ea6('0x36')]=_0x4dde76[_0x5ea6('0x36')][_0x5ea6('0x38')]?_0x4dde76['attributes']:_0x545ef9[_0x5ea6('0x30')];if(!_0x3510d2['query'][_0x5ea6('0x39')](_0x5ea6('0x3a'))){_0x4dde76[_0x5ea6('0x21')]=qs[_0x5ea6('0x21')](_0x3510d2[_0x5ea6('0x32')][_0x5ea6('0x21')]);_0x4dde76[_0x5ea6('0x1f')]=qs[_0x5ea6('0x1f')](_0x3510d2['query'][_0x5ea6('0x1f')]);}_0x4dde76[_0x5ea6('0x3b')]=qs[_0x5ea6('0x3c')](_0x3510d2[_0x5ea6('0x32')][_0x5ea6('0x3c')]);_0x4dde76[_0x5ea6('0x3d')]=qs[_0x5ea6('0x34')](_[_0x5ea6('0x3e')](_0x3510d2['query'],_0x545ef9[_0x5ea6('0x34')]),_0xf4f138);if(_0x3510d2[_0x5ea6('0x32')][_0x5ea6('0x3f')]){_0x4dde76[_0x5ea6('0x3d')]=_['merge'](_0x4dde76[_0x5ea6('0x3d')],{'$or':_[_0x5ea6('0x31')](_0xf4f138,function(_0x1e71ef){if(_0x1e71ef[_0x5ea6('0x40')]!==_0x5ea6('0x41')){var _0x35684b={};_0x35684b[_0x1e71ef[_0x5ea6('0x2b')]]={'$like':'%'+_0x3510d2[_0x5ea6('0x32')][_0x5ea6('0x3f')]+'%'};return _0x35684b;}})});}_0x4dde76=_['merge']({},_0x4dde76,_0x3510d2[_0x5ea6('0x42')]);var _0x3a480e={'where':_0x4dde76['where']};return db[_0x5ea6('0x43')][_0x5ea6('0x22')](_0x3a480e)['then'](function(_0x35919e){_0x2af232[_0x5ea6('0x22')]=_0x35919e;if(_0x3510d2['query'][_0x5ea6('0x44')]){_0x4dde76[_0x5ea6('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4dde76);})[_0x5ea6('0x27')](function(_0x40717c){_0x2af232[_0x5ea6('0x46')]=_0x40717c;return _0x2af232;})['then'](respondWithFilteredResult(_0x8c7431,_0x4dde76))[_0x5ea6('0x47')](handleError(_0x8c7431,null));};exports[_0x5ea6('0x48')]=function(_0x3ae0f8,_0x2f19ce){var _0x7346cb={'raw':!![],'where':{'id':_0x3ae0f8['params']['id']}},_0x1ad6b1={};_0x1ad6b1[_0x5ea6('0x30')]=_['keys'](db[_0x5ea6('0x43')]['rawAttributes']);_0x1ad6b1[_0x5ea6('0x32')]=_[_0x5ea6('0x33')](_0x3ae0f8['query']);_0x1ad6b1['filters']=_['intersection'](_0x1ad6b1[_0x5ea6('0x30')],_0x1ad6b1['query']);_0x7346cb[_0x5ea6('0x36')]=_['intersection'](_0x1ad6b1['model'],qs[_0x5ea6('0x37')](_0x3ae0f8[_0x5ea6('0x32')][_0x5ea6('0x37')]));_0x7346cb[_0x5ea6('0x36')]=_0x7346cb[_0x5ea6('0x36')][_0x5ea6('0x38')]?_0x7346cb['attributes']:_0x1ad6b1[_0x5ea6('0x30')];if(_0x3ae0f8[_0x5ea6('0x32')][_0x5ea6('0x44')]){_0x7346cb[_0x5ea6('0x45')]=[{'all':!![]}];}_0x7346cb=_['merge']({},_0x7346cb,_0x3ae0f8[_0x5ea6('0x42')]);return db['ChatInternalMessage'][_0x5ea6('0x49')](_0x7346cb)['then'](handleEntityNotFound(_0x2f19ce,null))[_0x5ea6('0x27')](respondWithResult(_0x2f19ce,null))[_0x5ea6('0x47')](handleError(_0x2f19ce,null));};exports['create']=function(_0x129db5,_0x15f92e){return db[_0x5ea6('0x43')][_0x5ea6('0x4a')](_0x129db5[_0x5ea6('0x4b')],{})[_0x5ea6('0x27')](respondWithResult(_0x15f92e,0xc9))['catch'](handleError(_0x15f92e,null));};exports[_0x5ea6('0x26')]=function(_0x5aa76c,_0x475111){if(_0x5aa76c[_0x5ea6('0x4b')]['id']){delete _0x5aa76c['body']['id'];}return db[_0x5ea6('0x43')][_0x5ea6('0x49')]({'where':{'id':_0x5aa76c[_0x5ea6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x475111,null))[_0x5ea6('0x27')](saveUpdates(_0x5aa76c[_0x5ea6('0x4b')],null))[_0x5ea6('0x27')](respondWithResult(_0x475111,null))[_0x5ea6('0x47')](handleError(_0x475111,null));};exports[_0x5ea6('0x28')]=function(_0x53c3a2,_0xd4a4ae){return db['ChatInternalMessage']['find']({'where':{'id':_0x53c3a2[_0x5ea6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd4a4ae,null))['then'](removeEntity(_0xd4a4ae,null))[_0x5ea6('0x47')](handleError(_0xd4a4ae,null));};exports[_0x5ea6('0x4d')]=function(_0x346f6b,_0x1345a9){return db[_0x5ea6('0x43')][_0x5ea6('0x4d')]()[_0x5ea6('0x27')](respondWithResult(_0x1345a9,null))[_0x5ea6('0x47')](handleError(_0x1345a9,null));};function wrapUser(_0xbe33d){return function(_0x2d366d){var _0xfb49a8=_0xbe33d['get']({'plain':!![]});_0xfb49a8[_0x5ea6('0x4e')]=[];if(_0x2d366d){_0xfb49a8[_0x5ea6('0x4f')]=_0x2d366d[_0x5ea6('0x50')];_0xfb49a8['lastMessage']=_0x2d366d;}else{_0xfb49a8[_0x5ea6('0x4f')]=moment(0x0)[_0x5ea6('0x51')](_0x5ea6('0x52'));_0xfb49a8[_0x5ea6('0x53')]={};}return _0xfb49a8;};}exports[_0x5ea6('0x54')]=function(_0x37d282,_0x4fe6dc,_0x4b2e2c){var _0x47e3ef=[];return db[_0x5ea6('0x55')][_0x5ea6('0x56')]({'where':{'role':[_0x5ea6('0x57'),_0x5ea6('0x58'),_0x5ea6('0x59')]},'attributes':['id',_0x5ea6('0x5a'),'name',_0x5ea6('0x5b'),_0x5ea6('0x5c'),_0x5ea6('0x5d'),_0x5ea6('0x5e'),'lastLoginAt',_0x5ea6('0x5f'),_0x5ea6('0x60')],'order':qs[_0x5ea6('0x3c')](_0x5ea6('0x61')),'include':[{'model':db[_0x5ea6('0x62')],'as':_0x5ea6('0x63'),'attributes':['id',_0x5ea6('0x2b'),'type'],'through':{'attributes':[]}}]})[_0x5ea6('0x27')](function(_0x127a74){if(_0x127a74){var _0x47737e=_0x37d282[_0x5ea6('0x59')][_0x5ea6('0x64')]({'plain':!![]});if(!_0x47737e)throw new Error(_0x5ea6('0x65'));if(_0x47737e[_0x5ea6('0x5b')]===_0x5ea6('0x59')){return db[_0x5ea6('0x66')][_0x5ea6('0x49')]({'where':{'name':_0x5ea6('0x67'),'userProfileId':_0x47737e[_0x5ea6('0x68')]},'raw':!![]})[_0x5ea6('0x27')](function(_0x21e11e){if(_0x21e11e){if(_0x21e11e[_0x5ea6('0x69')]===0x0){return db[_0x5ea6('0x6a')]['findAll']({'where':{'sectionId':_0x21e11e['id']},'raw':!![]})[_0x5ea6('0x27')](function(_0x1f5462){var _0x47e004=[];if(_['isEmpty'](_0x1f5462)){_0x47e004=_[_0x5ea6('0x3f')](_0x127a74,function(_0x328a55){if(_0x328a55[_0x5ea6('0x5b')]!==_0x5ea6('0x57')){return _0x328a55;}});return _0x47e004;}else{for(var _0x27f73a=0x0;_0x27f73a<_0x127a74[_0x5ea6('0x38')];_0x27f73a++){var _0x733afc=_0x127a74[_0x27f73a];if(_0x733afc['role']==='agent'){var _0x12d3c3=_[_0x5ea6('0x49')](_0x1f5462,function(_0x5bc98b){return _0x5bc98b[_0x5ea6('0x6b')]===_0x733afc['id'];});if(_0x12d3c3)_0x47e004[_0x5ea6('0x6c')](_0x733afc);}else{_0x47e004['push'](_0x733afc);}}return _0x47e004;}});}else{return _0x127a74;}}else{var _0x440fcb=_[_0x5ea6('0x3f')](_0x127a74,function(_0x4180dd){if(_0x4180dd[_0x5ea6('0x5b')]!==_0x5ea6('0x57')){return _0x4180dd;}});return _0x440fcb;}});}else{return _0x127a74;}}})['then'](function(_0x5e3904){var _0x19eadc=[];if(_0x5e3904){_0x47e3ef=_0x5e3904;for(var _0x2d2f1a=0x0;_0x2d2f1a<_0x5e3904[_0x5ea6('0x38')];_0x2d2f1a+=0x1){_0x47e3ef[_0x2d2f1a][_0x5ea6('0x4e')]=[];_0x19eadc['push'](db['ChatInternalMessage'][_0x5ea6('0x49')]({'where':{'FromId':[_0x37d282[_0x5ea6('0x59')]['id'],_0x5e3904[_0x2d2f1a]['id']],'ToId':[_0x37d282[_0x5ea6('0x59')]['id'],_0x5e3904[_0x2d2f1a]['id']],'ChatGroupId':null},'attributes':['id',_0x5ea6('0x50'),_0x5ea6('0x6d'),_0x5ea6('0x6e'),_0x5ea6('0x6f'),_0x5ea6('0x4b')],'order':qs['sort'](_0x5ea6('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5e3904[_0x2d2f1a])));}return BPromise[_0x5ea6('0x71')](_0x19eadc);}return[];})[_0x5ea6('0x27')](function(_0x4c0049){return{'rows':_0x4c0049,'count':_0x4c0049[_0x5ea6('0x38')]};})[_0x5ea6('0x27')](respondWithResult(_0x4fe6dc,null))[_0x5ea6('0x47')](handleError(_0x4fe6dc,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 93890be..ccedb57 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 _0x03bb=['hook','exports','../../mysqldb','ChatInternalMessage','update','remove','emit','hasOwnProperty'];(function(_0x4f3f1c,_0x2c00d7){var _0x286849=function(_0x17fc8a){while(--_0x17fc8a){_0x4f3f1c['push'](_0x4f3f1c['shift']());}};_0x286849(++_0x2c00d7);}(_0x03bb,0x17a));var _0xb03b=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x03bb[_0x4a599b];return _0x2d53d3;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xb03b('0x0'))['db'][_0xb03b('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb03b('0x2'),'afterDestroy':_0xb03b('0x3')};function emitEvent(_0x30b12c){return function(_0x2ade90,_0x490dba,_0x573865){ChatInternalMessageEvents[_0xb03b('0x4')](_0x30b12c+':'+_0x2ade90['id'],_0x2ade90);ChatInternalMessageEvents[_0xb03b('0x4')](_0x30b12c,_0x2ade90);_0x573865(null);};}for(var e in events){if(events[_0xb03b('0x5')](e)){var event=events[e];ChatInternalMessage[_0xb03b('0x6')](e,emitEvent(event));}}module[_0xb03b('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe1a7=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x258973,_0x501ee6){var _0x287688=function(_0x3e8039){while(--_0x3e8039){_0x258973['push'](_0x258973['shift']());}};_0x287688(++_0x501ee6);}(_0xe1a7,0x87));var _0x7e1a=function(_0x489f47,_0x25ab58){_0x489f47=_0x489f47-0x0;var _0x3b166=_0xe1a7[_0x489f47];return _0x3b166;};'use strict';var EventEmitter=require(_0x7e1a('0x0'));var ChatInternalMessage=require(_0x7e1a('0x1'))['db'][_0x7e1a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7e1a('0x3')](0x0);var events={'afterCreate':_0x7e1a('0x4'),'afterUpdate':_0x7e1a('0x5'),'afterDestroy':_0x7e1a('0x6')};function emitEvent(_0x5cd02c){return function(_0xb25685,_0x4c37b4,_0x54f3f5){ChatInternalMessageEvents[_0x7e1a('0x7')](_0x5cd02c+':'+_0xb25685['id'],_0xb25685);ChatInternalMessageEvents[_0x7e1a('0x7')](_0x5cd02c,_0xb25685);_0x54f3f5(null);};}for(var e in events){if(events[_0x7e1a('0x8')](e)){var event=events[e];ChatInternalMessage[_0x7e1a('0x9')](e,emitEvent(event));}}module[_0x7e1a('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4476b05..6d17e27 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 _0x9aa3=['bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x4e41e8,_0x397929){var _0x6d3de=function(_0x5f02dd){while(--_0x5f02dd){_0x4e41e8['push'](_0x4e41e8['shift']());}};_0x6d3de(++_0x397929);}(_0x9aa3,0x1eb));var _0x39aa=function(_0x479082,_0x40aa61){_0x479082=_0x479082-0x0;var _0x21348a=_0x9aa3[_0x479082];return _0x21348a;};'use strict';var _=require(_0x39aa('0x0'));var util=require(_0x39aa('0x1'));var logger=require(_0x39aa('0x2'))(_0x39aa('0x3'));var moment=require(_0x39aa('0x4'));var BPromise=require(_0x39aa('0x5'));var rp=require(_0x39aa('0x6'));var fs=require('fs');var path=require(_0x39aa('0x7'));var rimraf=require(_0x39aa('0x8'));var config=require('../../config/environment');var attributes=require(_0x39aa('0x9'));module[_0x39aa('0xa')]=function(_0x27ec35,_0x373115){return _0x27ec35[_0x39aa('0xb')](_0x39aa('0xc'),attributes,{'tableName':_0x39aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x39aa('0xe'),'collate':_0x39aa('0xf')});}; \ No newline at end of file +var _0xf16b=['rimraf','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45e0a8,_0x3ee1d0){var _0x3beda9=function(_0x12899d){while(--_0x12899d){_0x45e0a8['push'](_0x45e0a8['shift']());}};_0x3beda9(++_0x3ee1d0);}(_0xf16b,0x13a));var _0xbf16=function(_0x467057,_0x31e452){_0x467057=_0x467057-0x0;var _0xab58e4=_0xf16b[_0x467057];return _0xab58e4;};'use strict';var _=require(_0xbf16('0x0'));var util=require(_0xbf16('0x1'));var logger=require(_0xbf16('0x2'))(_0xbf16('0x3'));var moment=require(_0xbf16('0x4'));var BPromise=require(_0xbf16('0x5'));var rp=require(_0xbf16('0x6'));var fs=require('fs');var path=require(_0xbf16('0x7'));var rimraf=require(_0xbf16('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf16('0x9'));module['exports']=function(_0x598030,_0x28cbe9){return _0x598030['define'](_0xbf16('0xa'),attributes,{'tableName':_0xbf16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf16('0xc'),'collate':_0xbf16('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e9d6dd5..0faf13d 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 _0xd976=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x518148,_0x1404a9){var _0x17f869=function(_0x21c6ef){while(--_0x21c6ef){_0x518148['push'](_0x518148['shift']());}};_0x17f869(++_0x1404a9);}(_0xd976,0x179));var _0x6d97=function(_0x44ff47,_0x52c922){_0x44ff47=_0x44ff47-0x0;var _0x201e11=_0xd976[_0x44ff47];return _0x201e11;};'use strict';var _=require(_0x6d97('0x0'));var util=require('util');var moment=require(_0x6d97('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d97('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d97('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d97('0x4'))('rpc');var config=require(_0x6d97('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d97('0x6')][_0x6d97('0x7')]({'port':0x232a});config[_0x6d97('0x8')]=_[_0x6d97('0x9')](config['redis'],{'host':_0x6d97('0xa'),'port':0x18eb});var socket=require(_0x6d97('0xb'))(new Redis(config[_0x6d97('0x8')]));require(_0x6d97('0xc'))['register'](socket);function respondWithRpcPromise(_0x5cab90,_0x544893,_0x17a529){return new BPromise(function(_0x34780e,_0x1abf57){return client[_0x6d97('0xd')](_0x5cab90,_0x17a529)[_0x6d97('0xe')](function(_0x406c2f){logger[_0x6d97('0xf')](_0x6d97('0x10'),_0x544893,_0x6d97('0x11'));logger['debug'](_0x6d97('0x12'),_0x544893,_0x6d97('0x11'),JSON[_0x6d97('0x13')](_0x406c2f));if(_0x406c2f['error']){if(_0x406c2f[_0x6d97('0x14')][_0x6d97('0x15')]===0x1f4){logger['error'](_0x6d97('0x10'),_0x544893,_0x406c2f[_0x6d97('0x14')]['message']);return _0x1abf57(_0x406c2f[_0x6d97('0x14')][_0x6d97('0x16')]);}logger[_0x6d97('0x14')](_0x6d97('0x10'),_0x544893,_0x406c2f[_0x6d97('0x14')][_0x6d97('0x16')]);return _0x34780e(_0x406c2f['error'][_0x6d97('0x16')]);}else{logger[_0x6d97('0xf')](_0x6d97('0x10'),_0x544893,_0x6d97('0x11'));_0x34780e(_0x406c2f[_0x6d97('0x17')]['message']);}})[_0x6d97('0x18')](function(_0x2e1a8a){logger[_0x6d97('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x544893,_0x2e1a8a);_0x1abf57(_0x2e1a8a);});});} \ No newline at end of file +var _0x024a=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3bc407,_0x57c903){var _0x4963f2=function(_0x56daf6){while(--_0x56daf6){_0x3bc407['push'](_0x3bc407['shift']());}};_0x4963f2(++_0x57c903);}(_0x024a,0x17f));var _0xa024=function(_0xcc4189,_0x5ee71e){_0xcc4189=_0xcc4189-0x0;var _0x56939f=_0x024a[_0xcc4189];return _0x56939f;};'use strict';var _=require(_0xa024('0x0'));var util=require(_0xa024('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa024('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa024('0x3'));var logger=require(_0xa024('0x4'))(_0xa024('0x5'));var config=require('../../config/environment');var jayson=require(_0xa024('0x6'));var client=jayson['client'][_0xa024('0x7')]({'port':0x232a});config[_0xa024('0x8')]=_['defaults'](config[_0xa024('0x8')],{'host':_0xa024('0x9'),'port':0x18eb});var socket=require(_0xa024('0xa'))(new Redis(config[_0xa024('0x8')]));require(_0xa024('0xb'))[_0xa024('0xc')](socket);function respondWithRpcPromise(_0x1fafd3,_0x2ec2e1,_0x40100c){return new BPromise(function(_0x1ed31e,_0x5f0856){return client[_0xa024('0xd')](_0x1fafd3,_0x40100c)['then'](function(_0x105c94){logger[_0xa024('0xe')](_0xa024('0xf'),_0x2ec2e1,_0xa024('0x10'));logger[_0xa024('0x11')](_0xa024('0x12'),_0x2ec2e1,_0xa024('0x10'),JSON[_0xa024('0x13')](_0x105c94));if(_0x105c94[_0xa024('0x14')]){if(_0x105c94[_0xa024('0x14')][_0xa024('0x15')]===0x1f4){logger[_0xa024('0x14')](_0xa024('0xf'),_0x2ec2e1,_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);return _0x5f0856(_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);}logger[_0xa024('0x14')](_0xa024('0xf'),_0x2ec2e1,_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);return _0x1ed31e(_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);}else{logger[_0xa024('0xe')](_0xa024('0xf'),_0x2ec2e1,_0xa024('0x10'));_0x1ed31e(_0x105c94[_0xa024('0x17')][_0xa024('0x16')]);}})[_0xa024('0x18')](function(_0x165fcd){logger[_0xa024('0x14')](_0xa024('0xf'),_0x2ec2e1,_0x165fcd);_0x5f0856(_0x165fcd);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c5140cd..4988219 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 _0x0360=['removeListener','register','length','chatInternalMessage:','update'];(function(_0x174945,_0x2221a9){var _0x4a62d6=function(_0x4e0db8){while(--_0x4e0db8){_0x174945['push'](_0x174945['shift']());}};_0x4a62d6(++_0x2221a9);}(_0x0360,0xae));var _0x0036=function(_0x49da91,_0x423bda){_0x49da91=_0x49da91-0x0;var _0xd6a44e=_0x0360[_0x49da91];return _0xd6a44e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove',_0x0036('0x0')];function createListener(_0x518b1c,_0x4618da){return function(_0x1987e3){_0x4618da['emit'](_0x518b1c,_0x1987e3);};}function removeListener(_0x30ae5f,_0x28c161){return function(){ChatInternalMessageEvents[_0x0036('0x1')](_0x30ae5f,_0x28c161);};}exports[_0x0036('0x2')]=function(_0x57b3f7){for(var _0x128865=0x0,_0x29e43a=events[_0x0036('0x3')];_0x128865<_0x29e43a;_0x128865++){var _0x387e5e=events[_0x128865];var _0x913fd3=createListener(_0x0036('0x4')+_0x387e5e,_0x57b3f7);ChatInternalMessageEvents['on'](_0x387e5e,_0x913fd3);}}; \ No newline at end of file +var _0xf752=['length','save','remove','update','emit','removeListener'];(function(_0x25aa94,_0x4662f4){var _0x451740=function(_0x454ebc){while(--_0x454ebc){_0x25aa94['push'](_0x25aa94['shift']());}};_0x451740(++_0x4662f4);}(_0xf752,0x157));var _0x2f75=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf752[_0x57b54c];return _0x59cc19;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x2f75('0x0'),_0x2f75('0x1'),_0x2f75('0x2')];function createListener(_0x409c97,_0x5aef4b){return function(_0x94e91b){_0x5aef4b[_0x2f75('0x3')](_0x409c97,_0x94e91b);};}function removeListener(_0x4b0d18,_0x442f83){return function(){ChatInternalMessageEvents[_0x2f75('0x4')](_0x4b0d18,_0x442f83);};}exports['register']=function(_0x581adc){for(var _0xa2e52a=0x0,_0x3f0d9a=events[_0x2f75('0x5')];_0xa2e52a<_0x3f0d9a;_0xa2e52a++){var _0x39fa5b=events[_0xa2e52a];var _0x147b85=createListener('chatInternalMessage:'+_0x39fa5b,_0x581adc);ChatInternalMessageEvents['on'](_0x39fa5b,_0x147b85);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 82886eb..a3c19c1 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 _0xeb70=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','post'];(function(_0xe07094,_0x1cd13b){var _0x2d447b=function(_0x417dc5){while(--_0x417dc5){_0xe07094['push'](_0xe07094['shift']());}};_0x2d447b(++_0x1cd13b);}(_0xeb70,0x13f));var _0x0eb7=function(_0x60ebfd,_0x1d617a){_0x60ebfd=_0x60ebfd-0x0;var _0x312588=_0xeb70[_0x60ebfd];return _0x312588;};'use strict';var multer=require(_0x0eb7('0x0'));var util=require(_0x0eb7('0x1'));var path=require(_0x0eb7('0x2'));var timeout=require(_0x0eb7('0x3'));var express=require('express');var router=express[_0x0eb7('0x4')]();var fs_extra=require(_0x0eb7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0eb7('0x6'));var config=require('../../config/environment');var controller=require(_0x0eb7('0x7'));router[_0x0eb7('0x8')]('/',auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xa')]);router['get'](_0x0eb7('0xb'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xc')]);router[_0x0eb7('0x8')](_0x0eb7('0xd'),auth[_0x0eb7('0x9')](),controller[_0x0eb7('0xe')]);router[_0x0eb7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0eb7('0xf')]);router[_0x0eb7('0x10')]('/',auth[_0x0eb7('0x9')](),controller[_0x0eb7('0x11')]);router[_0x0eb7('0x12')](_0x0eb7('0x13'),controller[_0x0eb7('0x14')]);router[_0x0eb7('0x15')](_0x0eb7('0x13'),auth['isAuthenticated'](),controller[_0x0eb7('0x16')]);module[_0x0eb7('0x17')]=router; \ No newline at end of file +var _0x14bc=['describe','getUsers','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x501ad7,_0x2fee71){var _0x89e71=function(_0x25c0ad){while(--_0x25c0ad){_0x501ad7['push'](_0x501ad7['shift']());}};_0x89e71(++_0x2fee71);}(_0x14bc,0x190));var _0xc14b=function(_0x54c7f1,_0x2f5695){_0x54c7f1=_0x54c7f1-0x0;var _0xb75df=_0x14bc[_0x54c7f1];return _0xb75df;};'use strict';var multer=require(_0xc14b('0x0'));var util=require(_0xc14b('0x1'));var path=require(_0xc14b('0x2'));var timeout=require(_0xc14b('0x3'));var express=require(_0xc14b('0x4'));var router=express[_0xc14b('0x5')]();var fs_extra=require(_0xc14b('0x6'));var auth=require(_0xc14b('0x7'));var interaction=require(_0xc14b('0x8'));var config=require(_0xc14b('0x9'));var controller=require(_0xc14b('0xa'));router[_0xc14b('0xb')]('/',auth[_0xc14b('0xc')](),controller[_0xc14b('0xd')]);router[_0xc14b('0xb')]('/describe',auth[_0xc14b('0xc')](),controller[_0xc14b('0xe')]);router[_0xc14b('0xb')]('/users',auth[_0xc14b('0xc')](),controller[_0xc14b('0xf')]);router[_0xc14b('0xb')](_0xc14b('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xc14b('0x11')]('/',auth[_0xc14b('0xc')](),controller[_0xc14b('0x12')]);router[_0xc14b('0x13')]('/:id',controller[_0xc14b('0x14')]);router[_0xc14b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc14b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7416951..5ee69fa 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 _0x2964=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x164c5e,_0x3a74cd){var _0xb30150=function(_0x5c3397){while(--_0x5c3397){_0x164c5e['push'](_0x164c5e['shift']());}};_0xb30150(++_0x3a74cd);}(_0x2964,0x108));var _0x4296=function(_0x6b6243,_0x2ca502){_0x6b6243=_0x6b6243-0x0;var _0x3b2a3f=_0x2964[_0x6b6243];return _0x3b2a3f;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'body':{'type':Sequelize[_0x4296('0x2')](_0x4296('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4296('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4296('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4296('0x5')]('in',_0x4296('0x6')),'defaultValue':_0x4296('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4296('0x7')]},'providerResponse':{'type':Sequelize[_0x4296('0x2')]}}; \ No newline at end of file +var _0x4b0f=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x583745,_0x2d1897){var _0x4ba020=function(_0x288616){while(--_0x288616){_0x583745['push'](_0x583745['shift']());}};_0x4ba020(++_0x2d1897);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x25a1ac,_0x113c18){_0x25a1ac=_0x25a1ac-0x0;var _0x13ea3a=_0x4b0f[_0x25a1ac];return _0x13ea3a;};'use strict';var Sequelize=require('sequelize');module[_0xf4b0('0x0')]={'body':{'type':Sequelize[_0xf4b0('0x1')](_0xf4b0('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf4b0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4b0('0x4')]('in',_0xf4b0('0x5')),'defaultValue':_0xf4b0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf4b0('0x6')]},'providerName':{'type':Sequelize[_0xf4b0('0x7')]},'providerResponse':{'type':Sequelize[_0xf4b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9eb98e5..33f74d7 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 _0x8a78=['message','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','info','[CHATMESSAGE: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','QueryTypes','SELECT','User','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x277a87,_0x47a708){var _0xf75fd=function(_0x5e4b7e){while(--_0x5e4b7e){_0x277a87['push'](_0x277a87['shift']());}};_0xf75fd(++_0x47a708);}(_0x8a78,0x169));var _0x88a7=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x8a78[_0x22b39b];return _0x280e1d;};'use strict';var emlformat=require(_0x88a7('0x0'));var rimraf=require(_0x88a7('0x1'));var zipdir=require(_0x88a7('0x2'));var jsonpatch=require(_0x88a7('0x3'));var rp=require(_0x88a7('0x4'));var moment=require(_0x88a7('0x5'));var BPromise=require(_0x88a7('0x6'));var Mustache=require(_0x88a7('0x7'));var util=require('util');var path=require(_0x88a7('0x8'));var sox=require(_0x88a7('0x9'));var csv=require(_0x88a7('0xa'));var ejs=require(_0x88a7('0xb'));var fs=require('fs');var fs_extra=require(_0x88a7('0xc'));var _=require(_0x88a7('0xd'));var squel=require(_0x88a7('0xe'));var crypto=require(_0x88a7('0xf'));var jsforce=require(_0x88a7('0x10'));var deskjs=require(_0x88a7('0x11'));var toCsv=require(_0x88a7('0xa'));var querystring=require('querystring');var Papa=require(_0x88a7('0x12'));var Redis=require('ioredis');var authService=require(_0x88a7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88a7('0x14'));var logger=require(_0x88a7('0x15'))(_0x88a7('0x16'));var utils=require(_0x88a7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x88a7('0x18')]=_[_0x88a7('0x19')](config['redis'],{'host':_0x88a7('0x1a'),'port':0x18eb});var socket=require(_0x88a7('0x1b'))(new Redis(config[_0x88a7('0x18')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x88a7('0x1c'));var client=jayson[_0x88a7('0x1d')][_0x88a7('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x88a7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x54502c,_0x463ec7,_0x436bf5,_0x437d7d){return new BPromise(function(_0xc2cb4a,_0xbf1eb4){var _0x27c17c=_0x437d7d||client;return _0x27c17c[_0x88a7('0x1f')](_0x54502c,_0x436bf5)[_0x88a7('0x20')](function(_0x130d54){logger['info'](_0x88a7('0x21'),_0x463ec7,_0x88a7('0x22'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x463ec7,_0x88a7('0x22'),JSON[_0x88a7('0x23')](_0x130d54));if(_0x130d54['error']){if(_0x130d54[_0x88a7('0x24')][_0x88a7('0x25')]===0x1f4){logger['error'](_0x88a7('0x21'),_0x463ec7,_0x130d54['error'][_0x88a7('0x26')]);return _0xbf1eb4(_0x130d54[_0x88a7('0x24')][_0x88a7('0x26')]);}logger[_0x88a7('0x24')]('ChatMessage,\x20%s,\x20%s',_0x463ec7,_0x130d54['error']['message']);return _0xc2cb4a(_0x130d54[_0x88a7('0x24')][_0x88a7('0x26')]);}else{logger['info'](_0x88a7('0x21'),_0x463ec7,'request\x20sent');_0xc2cb4a(_0x130d54['result'][_0x88a7('0x26')]);}})[_0x88a7('0x27')](function(_0x33bd93){logger[_0x88a7('0x24')](_0x88a7('0x21'),_0x463ec7,_0x33bd93);_0xbf1eb4(_0x33bd93);});});}function respondWithStatusCode(_0x589b59,_0x76d3c){_0x76d3c=_0x76d3c||0xcc;return function(_0x3f23d2){if(_0x3f23d2){return _0x589b59['sendStatus'](_0x76d3c);}return _0x589b59['status'](_0x76d3c)[_0x88a7('0x28')]();};}function respondWithResult(_0x31a49f,_0x241d71){_0x241d71=_0x241d71||0xc8;return function(_0x28c7e9){if(_0x28c7e9){return _0x31a49f[_0x88a7('0x29')](_0x241d71)[_0x88a7('0x2a')](_0x28c7e9);}};}function respondWithFilteredResult(_0x551d7c,_0x2874f3){return function(_0x41ccf8){if(_0x41ccf8){var _0x357336=typeof _0x2874f3[_0x88a7('0x2b')]==='undefined'&&typeof _0x2874f3[_0x88a7('0x2c')]===_0x88a7('0x2d');var _0x2ba76b=_0x41ccf8[_0x88a7('0x2e')];var _0x392808=_0x357336?0x0:_0x2874f3['offset'];var _0x57f118=_0x357336?_0x41ccf8[_0x88a7('0x2e')]:_0x2874f3[_0x88a7('0x2b')]+_0x2874f3[_0x88a7('0x2c')];var _0x1418f6;if(_0x57f118>=_0x2ba76b){_0x57f118=_0x2ba76b;_0x1418f6=0xc8;}else{_0x1418f6=0xce;}_0x551d7c['status'](_0x1418f6);return _0x551d7c[_0x88a7('0x2f')](_0x88a7('0x30'),_0x392808+'-'+_0x57f118+'/'+_0x2ba76b)['json'](_0x41ccf8);}return null;};}function patchUpdates(_0x34e55b){return function(_0x363949){try{jsonpatch['apply'](_0x363949,_0x34e55b,!![]);}catch(_0x91d11d){return BPromise[_0x88a7('0x31')](_0x91d11d);}return _0x363949[_0x88a7('0x32')]();};}function saveUpdates(_0x469c9e,_0x376cdc){return function(_0x2b302f){if(_0x2b302f){return _0x2b302f[_0x88a7('0x33')](_0x469c9e)['then'](function(_0x294e32){return _0x294e32;});}return null;};}function removeEntity(_0x555b41,_0x3c133b){return function(_0x4b1ad2){if(_0x4b1ad2){return _0x4b1ad2['destroy']()[_0x88a7('0x20')](function(){_0x555b41[_0x88a7('0x29')](0xcc)[_0x88a7('0x28')]();});}};}function handleEntityNotFound(_0x21cde8,_0x52de23){return function(_0x3c0ed4){if(!_0x3c0ed4){_0x21cde8[_0x88a7('0x34')](0x194);}return _0x3c0ed4;};}function handleError(_0x1fe343,_0x2ffc1c){_0x2ffc1c=_0x2ffc1c||0x1f4;return function(_0x172e6a){logger[_0x88a7('0x24')](_0x172e6a[_0x88a7('0x35')]);if(_0x172e6a['name']){delete _0x172e6a[_0x88a7('0x36')];}_0x1fe343[_0x88a7('0x29')](_0x2ffc1c)[_0x88a7('0x37')](_0x172e6a);};}exports[_0x88a7('0x38')]=function(_0x9ef2eb,_0x5ec345){var _0x385d12={},_0x388dd7={},_0x46dda9={'count':0x0,'rows':[]};var _0x2944d1=_[_0x88a7('0x39')](db[_0x88a7('0x3a')]['rawAttributes'],function(_0x8c64b2){return{'name':_0x8c64b2[_0x88a7('0x3b')],'type':_0x8c64b2[_0x88a7('0x3c')][_0x88a7('0x3d')]};});_0x388dd7[_0x88a7('0x3e')]=_[_0x88a7('0x39')](_0x2944d1,_0x88a7('0x36'));_0x388dd7[_0x88a7('0x3f')]=_[_0x88a7('0x40')](_0x9ef2eb['query']);_0x388dd7[_0x88a7('0x41')]=_[_0x88a7('0x42')](_0x388dd7[_0x88a7('0x3e')],_0x388dd7[_0x88a7('0x3f')]);_0x385d12['attributes']=_[_0x88a7('0x42')](_0x388dd7['model'],qs[_0x88a7('0x43')](_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x43')]));_0x385d12[_0x88a7('0x44')]=_0x385d12[_0x88a7('0x44')]['length']?_0x385d12[_0x88a7('0x44')]:_0x388dd7[_0x88a7('0x3e')];if(!_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x45')](_0x88a7('0x46'))){_0x385d12[_0x88a7('0x2c')]=qs['limit'](_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x2c')]);_0x385d12[_0x88a7('0x2b')]=qs['offset'](_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x2b')]);}_0x385d12[_0x88a7('0x47')]=qs[_0x88a7('0x48')](_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x48')]);_0x385d12[_0x88a7('0x49')]=qs['filters'](_[_0x88a7('0x4a')](_0x9ef2eb[_0x88a7('0x3f')],_0x388dd7[_0x88a7('0x41')]),_0x2944d1);if(_0x9ef2eb['query']['filter']){_0x385d12['where']=_[_0x88a7('0x4b')](_0x385d12['where'],{'$or':_['map'](_0x2944d1,function(_0x39aca0){if(_0x39aca0['type']!==_0x88a7('0x4c')){var _0x21246b={};_0x21246b[_0x39aca0[_0x88a7('0x36')]]={'$like':'%'+_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x4d')]+'%'};return _0x21246b;}})});}_0x385d12=_[_0x88a7('0x4b')]({},_0x385d12,_0x9ef2eb[_0x88a7('0x4e')]);var _0xf59847={'where':_0x385d12[_0x88a7('0x49')]};return db[_0x88a7('0x3a')]['count'](_0xf59847)[_0x88a7('0x20')](function(_0x52abd1){_0x46dda9[_0x88a7('0x2e')]=_0x52abd1;if(_0x9ef2eb[_0x88a7('0x3f')][_0x88a7('0x4f')]){_0x385d12[_0x88a7('0x50')]=[{'all':!![]}];}return db[_0x88a7('0x3a')][_0x88a7('0x51')](_0x385d12);})['then'](function(_0x5480bc){_0x46dda9[_0x88a7('0x52')]=_0x5480bc;return _0x46dda9;})[_0x88a7('0x20')](respondWithFilteredResult(_0x5ec345,_0x385d12))[_0x88a7('0x27')](handleError(_0x5ec345,null));};exports[_0x88a7('0x53')]=function(_0x562ba2,_0x53cb15){var _0x2e87cc={'raw':!![],'where':{'id':_0x562ba2[_0x88a7('0x54')]['id']}},_0x470a92={};_0x470a92[_0x88a7('0x3e')]=_[_0x88a7('0x40')](db[_0x88a7('0x3a')][_0x88a7('0x55')]);_0x470a92['query']=_[_0x88a7('0x40')](_0x562ba2[_0x88a7('0x3f')]);_0x470a92['filters']=_[_0x88a7('0x42')](_0x470a92[_0x88a7('0x3e')],_0x470a92[_0x88a7('0x3f')]);_0x2e87cc[_0x88a7('0x44')]=_[_0x88a7('0x42')](_0x470a92[_0x88a7('0x3e')],qs[_0x88a7('0x43')](_0x562ba2[_0x88a7('0x3f')]['fields']));_0x2e87cc[_0x88a7('0x44')]=_0x2e87cc['attributes']['length']?_0x2e87cc[_0x88a7('0x44')]:_0x470a92[_0x88a7('0x3e')];if(_0x562ba2[_0x88a7('0x3f')][_0x88a7('0x4f')]){_0x2e87cc['include']=[{'all':!![]}];}_0x2e87cc=_[_0x88a7('0x4b')]({},_0x2e87cc,_0x562ba2[_0x88a7('0x4e')]);return db[_0x88a7('0x3a')][_0x88a7('0x56')](_0x2e87cc)[_0x88a7('0x20')](handleEntityNotFound(_0x53cb15,null))[_0x88a7('0x20')](respondWithResult(_0x53cb15,null))[_0x88a7('0x27')](handleError(_0x53cb15,null));};exports[_0x88a7('0x57')]=function(_0x3eb39f,_0x553db5){return db[_0x88a7('0x3a')][_0x88a7('0x57')](_0x3eb39f[_0x88a7('0x58')],{})[_0x88a7('0x20')](respondWithResult(_0x553db5,0xc9))[_0x88a7('0x27')](handleError(_0x553db5,null));};exports[_0x88a7('0x33')]=function(_0x3eb141,_0x1707ed){if(_0x3eb141['body']['id']){delete _0x3eb141[_0x88a7('0x58')]['id'];}return db[_0x88a7('0x3a')][_0x88a7('0x56')]({'where':{'id':_0x3eb141[_0x88a7('0x54')]['id']}})['then'](handleEntityNotFound(_0x1707ed,null))['then'](saveUpdates(_0x3eb141['body'],null))['then'](respondWithResult(_0x1707ed,null))[_0x88a7('0x27')](handleError(_0x1707ed,null));};exports[_0x88a7('0x59')]=function(_0x1132dd,_0x1a2ae0){return db[_0x88a7('0x3a')][_0x88a7('0x56')]({'where':{'id':_0x1132dd[_0x88a7('0x54')]['id']}})[_0x88a7('0x20')](handleEntityNotFound(_0x1a2ae0,null))['then'](removeEntity(_0x1a2ae0,null))[_0x88a7('0x27')](handleError(_0x1a2ae0,null));};exports[_0x88a7('0x5a')]=function(_0x2a6fea,_0x1c6097){return db['ChatMessage'][_0x88a7('0x5a')]()[_0x88a7('0x20')](respondWithResult(_0x1c6097,null))['catch'](handleError(_0x1c6097,null));};var interaction_log=require(_0x88a7('0x15'))('chat-interactions');exports[_0x88a7('0x5b')]=function(_0x182ec5,_0x36cd37,_0x25315b){var _0x3085de={'agent':{},'channel':'chat'};if(_0x182ec5['body']['id']){delete _0x182ec5[_0x88a7('0x58')]['id'];}_0x182ec5['body'][_0x88a7('0x5c')]=!![];_0x182ec5[_0x88a7('0x58')]['readAt']=moment()[_0x88a7('0x5d')](_0x88a7('0x5e'));_0x182ec5['body'][_0x88a7('0x5f')]=_0x182ec5['body'][_0x88a7('0x5f')]||_0x182ec5['user']['id'];_0x3085de[_0x88a7('0x60')]['id']=_0x182ec5['body'][_0x88a7('0x5f')];return db['ChatMessage'][_0x88a7('0x56')]({'where':{'id':_0x182ec5[_0x88a7('0x54')]['id'],'UserId':null}})[_0x88a7('0x20')](handleEntityNotFound(_0x36cd37,null))['then'](saveUpdates(_0x182ec5[_0x88a7('0x58')],null))['then'](function(_0x2c7b47){if(_0x2c7b47){_0x3085de['message']=_0x2c7b47[_0x88a7('0x61')]({'plain':!![]});return db[_0x88a7('0x62')][_0x88a7('0x56')]({'where':{'id':_0x2c7b47[_0x88a7('0x63')]}});}return null;})[_0x88a7('0x20')](handleEntityNotFound(_0x36cd37,null))[_0x88a7('0x20')](function(_0x19eb48){if(_0x19eb48){return _0x19eb48[_0x88a7('0x33')]({'UserId':_0x182ec5[_0x88a7('0x58')][_0x88a7('0x5f')],'read1stAt':_[_0x88a7('0x64')](_0x19eb48['read1stAt'])?moment()['format'](_0x88a7('0x5e')):undefined});}return null;})[_0x88a7('0x20')](function(_0x5d8878){if(_0x5d8878){_0x3085de[_0x88a7('0x65')]=_0x5d8878['get']({'plain':!![]});interaction_log[_0x88a7('0x66')](_0x88a7('0x67'),_0x182ec5['user']['id'],_0x182ec5[_0x88a7('0x68')][_0x88a7('0x36')],_0x182ec5[_0x88a7('0x68')][_0x88a7('0x69')],_0x3085de[_0x88a7('0x65')]['id'],_0x182ec5[_0x88a7('0x58')]?JSON[_0x88a7('0x23')](_0x182ec5[_0x88a7('0x58')]):_0x88a7('0x6a'));return respondWithRpcPromise(_0x88a7('0x6b'),_0x88a7('0x6c'),_0x3085de);}return null;})['then'](function(_0x44b0cf){var _0x22c7c8=_0x88a7('0x6d')+_0x44b0cf[_0x88a7('0x26')][_0x88a7('0x6e')];return db['sequelize'][_0x88a7('0x3f')](_0x22c7c8,{'type':db[_0x88a7('0x6f')][_0x88a7('0x70')][_0x88a7('0x71')],'raw':!![]})[_0x88a7('0x20')](function(_0x3a054b){return _0x3a054b;});})[_0x88a7('0x20')](function(_0x5cca0e){if(_0x5cca0e){_0x3085de[_0x88a7('0x26')]['contact']=_0x5cca0e[0x0];if(!_0x182ec5[_0x88a7('0x58')][_0x88a7('0x5f')])return;return db[_0x88a7('0x72')][_0x88a7('0x56')]({'where':{'id':_0x182ec5[_0x88a7('0x58')][_0x88a7('0x5f')],'role':'agent'},'attributes':['id',_0x88a7('0x36'),'fullname',_0x88a7('0x73'),_0x88a7('0x74')],'raw':!![]});}return null;})[_0x88a7('0x20')](function(_0x544ca3){if(!_0x544ca3)return null;_0x3085de[_0x88a7('0x26')]['agent']=_0x544ca3;return _0x3085de;})[_0x88a7('0x20')](function(_0xeb77e){if(_0xeb77e){if(_0x182ec5[_0x88a7('0x58')][_0x88a7('0x75')]){_0x3085de[_0x88a7('0x26')]['interface']=util[_0x88a7('0x5d')](_0x88a7('0x76'),_0x182ec5[_0x88a7('0x68')][_0x88a7('0x36')]);_0x3085de[_0x88a7('0x26')][_0x88a7('0x77')]=_0x3085de[_0x88a7('0x77')];_0x3085de['message'][_0x88a7('0x78')]=_0x3085de[_0x88a7('0x77')];_0x3085de[_0x88a7('0x26')][_0x88a7('0x79')]='accept';return respondWithRpcPromise('EventManager',_0x88a7('0x7a'),{'event':_0x88a7('0x7b'),'message':_[_0x88a7('0x4b')](_0x3085de[_0x88a7('0x26')],JSON[_0x88a7('0x7c')](_0x3085de[_0x88a7('0x65')][_0x88a7('0x7d')]))},client9002)['then'](function(){return _0x3085de;});}return _0x3085de;}return null;})['then'](respondWithResult(_0x36cd37,null))['catch'](handleError(_0x36cd37,null));};var interaction_log=require(_0x88a7('0x15'))(_0x88a7('0x7e'));exports['reject']=function(_0x38ee21,_0x10e1bf,_0x33ff84){var _0x211183={'agent':{},'channel':_0x88a7('0x7f')};if(_0x38ee21[_0x88a7('0x58')]['id']){delete _0x38ee21[_0x88a7('0x58')]['id'];}_0x38ee21['body'][_0x88a7('0x5f')]=_0x38ee21['body'][_0x88a7('0x5f')]||_0x38ee21[_0x88a7('0x68')]['id'];_0x211183['agent']['id']=_0x38ee21[_0x88a7('0x58')]['UserId'];return db[_0x88a7('0x3a')][_0x88a7('0x56')]({'where':{'id':_0x38ee21[_0x88a7('0x54')]['id'],'UserId':null}})[_0x88a7('0x20')](handleEntityNotFound(_0x10e1bf,null))[_0x88a7('0x20')](function(_0x2509fd){if(_0x2509fd){_0x211183[_0x88a7('0x26')]=_0x2509fd[_0x88a7('0x61')]({'plain':!![]});return db[_0x88a7('0x62')][_0x88a7('0x56')]({'where':{'id':_0x2509fd[_0x88a7('0x63')]}});}return null;})[_0x88a7('0x20')](handleEntityNotFound(_0x10e1bf,null))[_0x88a7('0x20')](function(_0x420e3d){if(_0x420e3d){_0x211183[_0x88a7('0x65')]=_0x420e3d[_0x88a7('0x61')]({'plain':!![]});interaction_log[_0x88a7('0x66')](_0x88a7('0x80'),_0x38ee21[_0x88a7('0x68')]['id'],_0x38ee21['user'][_0x88a7('0x36')],_0x38ee21[_0x88a7('0x68')]['role'],_0x211183['interaction']['id'],_0x38ee21[_0x88a7('0x58')]?JSON[_0x88a7('0x23')](_0x38ee21['body']):_0x88a7('0x6a'));return respondWithRpcPromise('RejectMessage',_0x88a7('0x81'),_0x211183);}return null;})['then'](function(_0x563b56){var _0x3dbafa=_0x88a7('0x6d')+_0x563b56[_0x88a7('0x26')][_0x88a7('0x6e')];return db['sequelize'][_0x88a7('0x3f')](_0x3dbafa,{'type':db[_0x88a7('0x6f')][_0x88a7('0x70')][_0x88a7('0x71')],'raw':!![]})[_0x88a7('0x20')](function(_0xefbf64){return _0xefbf64;});})[_0x88a7('0x20')](function(_0x463137){if(_0x463137){_0x211183[_0x88a7('0x26')]['contact']=_0x463137[0x0];if(!_0x38ee21[_0x88a7('0x58')]['UserId'])return;return db[_0x88a7('0x72')]['find']({'where':{'id':_0x38ee21[_0x88a7('0x58')][_0x88a7('0x5f')],'role':'agent'},'attributes':['id',_0x88a7('0x36'),_0x88a7('0x82'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x460c11){if(!_0x460c11)return null;_0x211183[_0x88a7('0x26')][_0x88a7('0x60')]=_0x460c11;return _0x211183;})[_0x88a7('0x20')](function(_0x146356){if(_0x146356){_0x146356['message'][_0x88a7('0x83')]=util[_0x88a7('0x5d')](_0x88a7('0x76'),_0x38ee21['user'][_0x88a7('0x36')]);_0x146356[_0x88a7('0x26')][_0x88a7('0x77')]=_0x211183[_0x88a7('0x77')];_0x146356[_0x88a7('0x26')][_0x88a7('0x78')]=_0x211183[_0x88a7('0x77')];_0x146356[_0x88a7('0x26')]['event']='reject';respondWithRpcPromise(_0x88a7('0x7a'),'EventManager',{'event':_0x88a7('0x84'),'message':_[_0x88a7('0x4b')](_0x211183[_0x88a7('0x26')],JSON['parse'](_0x211183[_0x88a7('0x65')][_0x88a7('0x7d')]))},client9002);return _0x211183;}return null;})['then'](respondWithResult(_0x10e1bf,null))[_0x88a7('0x27')](handleError(_0x10e1bf,null));}; \ No newline at end of file +var _0x6bb3=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','name','send','ChatMessage','rawAttributes','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt'];(function(_0x3de6f7,_0x996459){var _0x1f1db2=function(_0x136ae7){while(--_0x136ae7){_0x3de6f7['push'](_0x3de6f7['shift']());}};_0x1f1db2(++_0x996459);}(_0x6bb3,0x1a9));var _0x36bb=function(_0x30b45f,_0x5703f1){_0x30b45f=_0x30b45f-0x0;var _0x383efd=_0x6bb3[_0x30b45f];return _0x383efd;};'use strict';var emlformat=require(_0x36bb('0x0'));var rimraf=require(_0x36bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36bb('0x2'));var rp=require(_0x36bb('0x3'));var moment=require(_0x36bb('0x4'));var BPromise=require(_0x36bb('0x5'));var Mustache=require(_0x36bb('0x6'));var util=require(_0x36bb('0x7'));var path=require(_0x36bb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x36bb('0x9'));var fs=require('fs');var fs_extra=require(_0x36bb('0xa'));var _=require(_0x36bb('0xb'));var squel=require(_0x36bb('0xc'));var crypto=require(_0x36bb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x36bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x36bb('0xf'));var Papa=require(_0x36bb('0x10'));var Redis=require(_0x36bb('0x11'));var authService=require(_0x36bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x36bb('0x13'));var hardwareService=require(_0x36bb('0x14'));var logger=require(_0x36bb('0x15'))('api');var utils=require(_0x36bb('0x16'));var config=require(_0x36bb('0x17'));var licenseUtil=require(_0x36bb('0x18'));var db=require(_0x36bb('0x19'))['db'];config[_0x36bb('0x1a')]=_[_0x36bb('0x1b')](config['redis'],{'host':_0x36bb('0x1c'),'port':0x18eb});var socket=require(_0x36bb('0x1d'))(new Redis(config[_0x36bb('0x1a')]));require('./chatMessage.socket')[_0x36bb('0x1e')](socket);var jayson=require(_0x36bb('0x1f'));var client=jayson['client'][_0x36bb('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37f8d7,_0x1e3d82,_0x691286,_0x25d8c5){return new BPromise(function(_0x387de4,_0x4a5184){var _0x326241=_0x25d8c5||client;return _0x326241[_0x36bb('0x21')](_0x37f8d7,_0x691286)[_0x36bb('0x22')](function(_0x2804de){logger[_0x36bb('0x23')](_0x36bb('0x24'),_0x1e3d82,_0x36bb('0x25'));logger[_0x36bb('0x26')](_0x36bb('0x27'),_0x1e3d82,'request\x20sent',JSON[_0x36bb('0x28')](_0x2804de));if(_0x2804de[_0x36bb('0x29')]){if(_0x2804de[_0x36bb('0x29')][_0x36bb('0x2a')]===0x1f4){logger[_0x36bb('0x29')](_0x36bb('0x24'),_0x1e3d82,_0x2804de['error']['message']);return _0x4a5184(_0x2804de[_0x36bb('0x29')][_0x36bb('0x2b')]);}logger[_0x36bb('0x29')]('ChatMessage,\x20%s,\x20%s',_0x1e3d82,_0x2804de['error'][_0x36bb('0x2b')]);return _0x387de4(_0x2804de[_0x36bb('0x29')]['message']);}else{logger[_0x36bb('0x23')](_0x36bb('0x24'),_0x1e3d82,_0x36bb('0x25'));_0x387de4(_0x2804de[_0x36bb('0x2c')]['message']);}})['catch'](function(_0xc38292){logger[_0x36bb('0x29')](_0x36bb('0x24'),_0x1e3d82,_0xc38292);_0x4a5184(_0xc38292);});});}function respondWithStatusCode(_0x4a4fa2,_0x3c07f9){_0x3c07f9=_0x3c07f9||0xcc;return function(_0x658084){if(_0x658084){return _0x4a4fa2['sendStatus'](_0x3c07f9);}return _0x4a4fa2[_0x36bb('0x2d')](_0x3c07f9)['end']();};}function respondWithResult(_0xb10cca,_0x2c7090){_0x2c7090=_0x2c7090||0xc8;return function(_0x453def){if(_0x453def){return _0xb10cca[_0x36bb('0x2d')](_0x2c7090)['json'](_0x453def);}};}function respondWithFilteredResult(_0x22d2b1,_0x146712){return function(_0x3cac80){if(_0x3cac80){var _0x50a294=typeof _0x146712[_0x36bb('0x2e')]==='undefined'&&typeof _0x146712[_0x36bb('0x2f')]==='undefined';var _0x54acac=_0x3cac80[_0x36bb('0x30')];var _0x3df7da=_0x50a294?0x0:_0x146712[_0x36bb('0x2e')];var _0x3a91aa=_0x50a294?_0x3cac80['count']:_0x146712['offset']+_0x146712[_0x36bb('0x2f')];var _0x19c50f;if(_0x3a91aa>=_0x54acac){_0x3a91aa=_0x54acac;_0x19c50f=0xc8;}else{_0x19c50f=0xce;}_0x22d2b1[_0x36bb('0x2d')](_0x19c50f);return _0x22d2b1[_0x36bb('0x31')](_0x36bb('0x32'),_0x3df7da+'-'+_0x3a91aa+'/'+_0x54acac)[_0x36bb('0x33')](_0x3cac80);}return null;};}function patchUpdates(_0x19ac3){return function(_0x37d9cc){try{jsonpatch[_0x36bb('0x34')](_0x37d9cc,_0x19ac3,!![]);}catch(_0x2dcd9c){return BPromise[_0x36bb('0x35')](_0x2dcd9c);}return _0x37d9cc[_0x36bb('0x36')]();};}function saveUpdates(_0x4fb936,_0x22ada8){return function(_0x3ccbbc){if(_0x3ccbbc){return _0x3ccbbc[_0x36bb('0x37')](_0x4fb936)['then'](function(_0xa20d10){return _0xa20d10;});}return null;};}function removeEntity(_0x15d1ee,_0x28885a){return function(_0xbe5c4c){if(_0xbe5c4c){return _0xbe5c4c[_0x36bb('0x38')]()[_0x36bb('0x22')](function(){_0x15d1ee[_0x36bb('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f719e,_0xa80fe3){return function(_0x4a7e48){if(!_0x4a7e48){_0x1f719e[_0x36bb('0x39')](0x194);}return _0x4a7e48;};}function handleError(_0x19610c,_0x232eec){_0x232eec=_0x232eec||0x1f4;return function(_0x2c5213){logger[_0x36bb('0x29')](_0x2c5213['stack']);if(_0x2c5213[_0x36bb('0x3a')]){delete _0x2c5213[_0x36bb('0x3a')];}_0x19610c[_0x36bb('0x2d')](_0x232eec)[_0x36bb('0x3b')](_0x2c5213);};}exports['index']=function(_0x13f4c5,_0x5a0af3){var _0x4ee13f={},_0x4171f5={},_0x4fa9e4={'count':0x0,'rows':[]};var _0x427137=_['map'](db[_0x36bb('0x3c')][_0x36bb('0x3d')],function(_0x35f1bb){return{'name':_0x35f1bb['fieldName'],'type':_0x35f1bb['type'][_0x36bb('0x3e')]};});_0x4171f5[_0x36bb('0x3f')]=_[_0x36bb('0x40')](_0x427137,_0x36bb('0x3a'));_0x4171f5[_0x36bb('0x41')]=_['keys'](_0x13f4c5['query']);_0x4171f5['filters']=_[_0x36bb('0x42')](_0x4171f5[_0x36bb('0x3f')],_0x4171f5[_0x36bb('0x41')]);_0x4ee13f['attributes']=_[_0x36bb('0x42')](_0x4171f5[_0x36bb('0x3f')],qs['fields'](_0x13f4c5['query']['fields']));_0x4ee13f[_0x36bb('0x43')]=_0x4ee13f[_0x36bb('0x43')][_0x36bb('0x44')]?_0x4ee13f[_0x36bb('0x43')]:_0x4171f5[_0x36bb('0x3f')];if(!_0x13f4c5[_0x36bb('0x41')][_0x36bb('0x45')](_0x36bb('0x46'))){_0x4ee13f[_0x36bb('0x2f')]=qs[_0x36bb('0x2f')](_0x13f4c5[_0x36bb('0x41')]['limit']);_0x4ee13f[_0x36bb('0x2e')]=qs[_0x36bb('0x2e')](_0x13f4c5[_0x36bb('0x41')][_0x36bb('0x2e')]);}_0x4ee13f['order']=qs[_0x36bb('0x47')](_0x13f4c5[_0x36bb('0x41')][_0x36bb('0x47')]);_0x4ee13f[_0x36bb('0x48')]=qs[_0x36bb('0x49')](_[_0x36bb('0x4a')](_0x13f4c5[_0x36bb('0x41')],_0x4171f5['filters']),_0x427137);if(_0x13f4c5['query'][_0x36bb('0x4b')]){_0x4ee13f[_0x36bb('0x48')]=_[_0x36bb('0x4c')](_0x4ee13f[_0x36bb('0x48')],{'$or':_['map'](_0x427137,function(_0x588067){if(_0x588067[_0x36bb('0x4d')]!==_0x36bb('0x4e')){var _0x3fb77f={};_0x3fb77f[_0x588067[_0x36bb('0x3a')]]={'$like':'%'+_0x13f4c5[_0x36bb('0x41')][_0x36bb('0x4b')]+'%'};return _0x3fb77f;}})});}_0x4ee13f=_['merge']({},_0x4ee13f,_0x13f4c5['options']);var _0x1f7abf={'where':_0x4ee13f[_0x36bb('0x48')]};return db[_0x36bb('0x3c')][_0x36bb('0x30')](_0x1f7abf)[_0x36bb('0x22')](function(_0x14b863){_0x4fa9e4[_0x36bb('0x30')]=_0x14b863;if(_0x13f4c5[_0x36bb('0x41')][_0x36bb('0x4f')]){_0x4ee13f[_0x36bb('0x50')]=[{'all':!![]}];}return db[_0x36bb('0x3c')][_0x36bb('0x51')](_0x4ee13f);})[_0x36bb('0x22')](function(_0x4b1b38){_0x4fa9e4[_0x36bb('0x52')]=_0x4b1b38;return _0x4fa9e4;})['then'](respondWithFilteredResult(_0x5a0af3,_0x4ee13f))[_0x36bb('0x53')](handleError(_0x5a0af3,null));};exports[_0x36bb('0x54')]=function(_0x3e977d,_0x43b0d4){var _0x447882={'raw':!![],'where':{'id':_0x3e977d[_0x36bb('0x55')]['id']}},_0x53a4e3={};_0x53a4e3[_0x36bb('0x3f')]=_[_0x36bb('0x56')](db['ChatMessage']['rawAttributes']);_0x53a4e3[_0x36bb('0x41')]=_[_0x36bb('0x56')](_0x3e977d[_0x36bb('0x41')]);_0x53a4e3[_0x36bb('0x49')]=_[_0x36bb('0x42')](_0x53a4e3[_0x36bb('0x3f')],_0x53a4e3[_0x36bb('0x41')]);_0x447882['attributes']=_[_0x36bb('0x42')](_0x53a4e3[_0x36bb('0x3f')],qs[_0x36bb('0x57')](_0x3e977d['query'][_0x36bb('0x57')]));_0x447882['attributes']=_0x447882[_0x36bb('0x43')]['length']?_0x447882[_0x36bb('0x43')]:_0x53a4e3[_0x36bb('0x3f')];if(_0x3e977d[_0x36bb('0x41')][_0x36bb('0x4f')]){_0x447882[_0x36bb('0x50')]=[{'all':!![]}];}_0x447882=_[_0x36bb('0x4c')]({},_0x447882,_0x3e977d[_0x36bb('0x58')]);return db[_0x36bb('0x3c')]['find'](_0x447882)[_0x36bb('0x22')](handleEntityNotFound(_0x43b0d4,null))[_0x36bb('0x22')](respondWithResult(_0x43b0d4,null))['catch'](handleError(_0x43b0d4,null));};exports[_0x36bb('0x59')]=function(_0x117ee4,_0x4924ec){return db[_0x36bb('0x3c')][_0x36bb('0x59')](_0x117ee4['body'],{})[_0x36bb('0x22')](respondWithResult(_0x4924ec,0xc9))[_0x36bb('0x53')](handleError(_0x4924ec,null));};exports[_0x36bb('0x37')]=function(_0x36a25f,_0x23ff42){if(_0x36a25f[_0x36bb('0x5a')]['id']){delete _0x36a25f['body']['id'];}return db[_0x36bb('0x3c')]['find']({'where':{'id':_0x36a25f[_0x36bb('0x55')]['id']}})[_0x36bb('0x22')](handleEntityNotFound(_0x23ff42,null))[_0x36bb('0x22')](saveUpdates(_0x36a25f[_0x36bb('0x5a')],null))[_0x36bb('0x22')](respondWithResult(_0x23ff42,null))['catch'](handleError(_0x23ff42,null));};exports[_0x36bb('0x38')]=function(_0x56990e,_0x1bea1c){return db[_0x36bb('0x3c')][_0x36bb('0x5b')]({'where':{'id':_0x56990e['params']['id']}})[_0x36bb('0x22')](handleEntityNotFound(_0x1bea1c,null))[_0x36bb('0x22')](removeEntity(_0x1bea1c,null))[_0x36bb('0x53')](handleError(_0x1bea1c,null));};exports[_0x36bb('0x5c')]=function(_0x2e6657,_0x3ab3c9){return db[_0x36bb('0x3c')][_0x36bb('0x5c')]()[_0x36bb('0x22')](respondWithResult(_0x3ab3c9,null))[_0x36bb('0x53')](handleError(_0x3ab3c9,null));};var interaction_log=require('../../config/logger')(_0x36bb('0x5d'));exports[_0x36bb('0x5e')]=function(_0x29d3bb,_0x37bc12,_0x20b412){var _0xc21049={'agent':{},'channel':_0x36bb('0x5f')};if(_0x29d3bb[_0x36bb('0x5a')]['id']){delete _0x29d3bb['body']['id'];}_0x29d3bb['body'][_0x36bb('0x60')]=!![];_0x29d3bb[_0x36bb('0x5a')][_0x36bb('0x61')]=moment()[_0x36bb('0x62')](_0x36bb('0x63'));_0x29d3bb[_0x36bb('0x5a')][_0x36bb('0x64')]=_0x29d3bb[_0x36bb('0x5a')]['UserId']||_0x29d3bb[_0x36bb('0x65')]['id'];_0xc21049[_0x36bb('0x66')]['id']=_0x29d3bb['body'][_0x36bb('0x64')];return db[_0x36bb('0x3c')][_0x36bb('0x5b')]({'where':{'id':_0x29d3bb[_0x36bb('0x55')]['id'],'UserId':null}})[_0x36bb('0x22')](handleEntityNotFound(_0x37bc12,null))[_0x36bb('0x22')](saveUpdates(_0x29d3bb[_0x36bb('0x5a')],null))[_0x36bb('0x22')](function(_0x32ce53){if(_0x32ce53){_0xc21049[_0x36bb('0x2b')]=_0x32ce53[_0x36bb('0x67')]({'plain':!![]});return db[_0x36bb('0x68')][_0x36bb('0x5b')]({'where':{'id':_0x32ce53['ChatInteractionId']}});}return null;})[_0x36bb('0x22')](handleEntityNotFound(_0x37bc12,null))['then'](function(_0x4fedfd){if(_0x4fedfd){return _0x4fedfd[_0x36bb('0x37')]({'UserId':_0x29d3bb['body'][_0x36bb('0x64')],'read1stAt':_[_0x36bb('0x69')](_0x4fedfd[_0x36bb('0x6a')])?moment()[_0x36bb('0x62')](_0x36bb('0x63')):undefined});}return null;})['then'](function(_0x3fa64f){if(_0x3fa64f){_0xc21049[_0x36bb('0x6b')]=_0x3fa64f[_0x36bb('0x67')]({'plain':!![]});interaction_log[_0x36bb('0x23')](_0x36bb('0x6c'),_0x29d3bb[_0x36bb('0x65')]['id'],_0x29d3bb['user'][_0x36bb('0x3a')],_0x29d3bb['user'][_0x36bb('0x6d')],_0xc21049['interaction']['id'],_0x29d3bb['body']?JSON[_0x36bb('0x28')](_0x29d3bb['body']):_0x36bb('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x36bb('0x6f'),_0xc21049);}return null;})[_0x36bb('0x22')](function(_0x502811){var _0x21156e=_0x36bb('0x70')+_0x502811[_0x36bb('0x2b')][_0x36bb('0x71')];return db[_0x36bb('0x72')][_0x36bb('0x41')](_0x21156e,{'type':db['Sequelize'][_0x36bb('0x73')][_0x36bb('0x74')],'raw':!![]})['then'](function(_0x19cb82){return _0x19cb82;});})[_0x36bb('0x22')](function(_0x541722){if(_0x541722){_0xc21049[_0x36bb('0x2b')][_0x36bb('0x75')]=_0x541722[0x0];if(!_0x29d3bb[_0x36bb('0x5a')]['UserId'])return;return db['User'][_0x36bb('0x5b')]({'where':{'id':_0x29d3bb[_0x36bb('0x5a')]['UserId'],'role':_0x36bb('0x66')},'attributes':['id','name',_0x36bb('0x76'),'email',_0x36bb('0x77')],'raw':!![]});}return null;})[_0x36bb('0x22')](function(_0x2e06aa){if(!_0x2e06aa)return null;_0xc21049[_0x36bb('0x2b')][_0x36bb('0x66')]=_0x2e06aa;return _0xc21049;})['then'](function(_0x393515){if(_0x393515){if(_0x29d3bb[_0x36bb('0x5a')][_0x36bb('0x78')]){_0xc21049[_0x36bb('0x2b')][_0x36bb('0x79')]=util[_0x36bb('0x62')]('SIP/%s',_0x29d3bb[_0x36bb('0x65')][_0x36bb('0x3a')]);_0xc21049[_0x36bb('0x2b')][_0x36bb('0x7a')]=_0xc21049[_0x36bb('0x7a')];_0xc21049['message'][_0x36bb('0x7b')]=_0xc21049['channel'];_0xc21049[_0x36bb('0x2b')][_0x36bb('0x7c')]='accept';return respondWithRpcPromise('EventManager',_0x36bb('0x7d'),{'event':_0x36bb('0x7e'),'message':_[_0x36bb('0x4c')](_0xc21049[_0x36bb('0x2b')],JSON[_0x36bb('0x7f')](_0xc21049[_0x36bb('0x6b')][_0x36bb('0x80')]))},client9002)[_0x36bb('0x22')](function(){return _0xc21049;});}return _0xc21049;}return null;})['then'](respondWithResult(_0x37bc12,null))[_0x36bb('0x53')](handleError(_0x37bc12,null));};var interaction_log=require(_0x36bb('0x15'))(_0x36bb('0x5d'));exports['reject']=function(_0xfafa58,_0x555416,_0x2fec8a){var _0x13f40c={'agent':{},'channel':_0x36bb('0x5f')};if(_0xfafa58['body']['id']){delete _0xfafa58['body']['id'];}_0xfafa58['body'][_0x36bb('0x64')]=_0xfafa58[_0x36bb('0x5a')][_0x36bb('0x64')]||_0xfafa58[_0x36bb('0x65')]['id'];_0x13f40c[_0x36bb('0x66')]['id']=_0xfafa58[_0x36bb('0x5a')][_0x36bb('0x64')];return db[_0x36bb('0x3c')][_0x36bb('0x5b')]({'where':{'id':_0xfafa58['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x555416,null))['then'](function(_0x1f800e){if(_0x1f800e){_0x13f40c[_0x36bb('0x2b')]=_0x1f800e[_0x36bb('0x67')]({'plain':!![]});return db[_0x36bb('0x68')][_0x36bb('0x5b')]({'where':{'id':_0x1f800e[_0x36bb('0x81')]}});}return null;})[_0x36bb('0x22')](handleEntityNotFound(_0x555416,null))[_0x36bb('0x22')](function(_0x42bcb5){if(_0x42bcb5){_0x13f40c['interaction']=_0x42bcb5[_0x36bb('0x67')]({'plain':!![]});interaction_log[_0x36bb('0x23')](_0x36bb('0x82'),_0xfafa58[_0x36bb('0x65')]['id'],_0xfafa58['user']['name'],_0xfafa58[_0x36bb('0x65')]['role'],_0x13f40c[_0x36bb('0x6b')]['id'],_0xfafa58[_0x36bb('0x5a')]?JSON[_0x36bb('0x28')](_0xfafa58[_0x36bb('0x5a')]):_0x36bb('0x6e'));return respondWithRpcPromise(_0x36bb('0x83'),'rejectMessage',_0x13f40c);}return null;})[_0x36bb('0x22')](function(_0x27f2cb){var _0x1974ad='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27f2cb[_0x36bb('0x2b')][_0x36bb('0x71')];return db[_0x36bb('0x72')]['query'](_0x1974ad,{'type':db['Sequelize'][_0x36bb('0x73')][_0x36bb('0x74')],'raw':!![]})[_0x36bb('0x22')](function(_0x53e221){return _0x53e221;});})[_0x36bb('0x22')](function(_0x4aac0c){if(_0x4aac0c){_0x13f40c['message']['contact']=_0x4aac0c[0x0];if(!_0xfafa58[_0x36bb('0x5a')][_0x36bb('0x64')])return;return db['User'][_0x36bb('0x5b')]({'where':{'id':_0xfafa58[_0x36bb('0x5a')][_0x36bb('0x64')],'role':'agent'},'attributes':['id',_0x36bb('0x3a'),_0x36bb('0x76'),'email',_0x36bb('0x77')],'raw':!![]});}return null;})[_0x36bb('0x22')](function(_0x14d2f0){if(!_0x14d2f0)return null;_0x13f40c[_0x36bb('0x2b')][_0x36bb('0x66')]=_0x14d2f0;return _0x13f40c;})[_0x36bb('0x22')](function(_0x48e095){if(_0x48e095){_0x48e095[_0x36bb('0x2b')][_0x36bb('0x79')]=util[_0x36bb('0x62')](_0x36bb('0x84'),_0xfafa58[_0x36bb('0x65')][_0x36bb('0x3a')]);_0x48e095[_0x36bb('0x2b')][_0x36bb('0x7a')]=_0x13f40c[_0x36bb('0x7a')];_0x48e095[_0x36bb('0x2b')][_0x36bb('0x7b')]=_0x13f40c[_0x36bb('0x7a')];_0x48e095['message'][_0x36bb('0x7c')]='reject';respondWithRpcPromise('EventManager',_0x36bb('0x7d'),{'event':'rejectmessage','message':_[_0x36bb('0x4c')](_0x13f40c[_0x36bb('0x2b')],JSON[_0x36bb('0x7f')](_0x13f40c[_0x36bb('0x6b')][_0x36bb('0x80')]))},client9002);return _0x13f40c;}return null;})[_0x36bb('0x22')](respondWithResult(_0x555416,null))[_0x36bb('0x53')](handleError(_0x555416,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 97d56ae..10cdcae 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 _0x3cd9=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','ChatMessage'];(function(_0x3fcf93,_0xe1d945){var _0x5424c9=function(_0x3b0c31){while(--_0x3b0c31){_0x3fcf93['push'](_0x3fcf93['shift']());}};_0x5424c9(++_0xe1d945);}(_0x3cd9,0x146));var _0x93cd=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x3cd9[_0x173d7e];return _0x2220d6;};'use strict';var EventEmitter=require(_0x93cd('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x93cd('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x93cd('0x2')](0x0);var events={'afterCreate':_0x93cd('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35888b){return function(_0x41b15f,_0x44e7e7,_0x4b8afd){ChatMessageEvents[_0x93cd('0x4')](_0x35888b+':'+_0x41b15f['id'],_0x41b15f);ChatMessageEvents[_0x93cd('0x4')](_0x35888b,_0x41b15f);_0x4b8afd(null);};}for(var e in events){if(events[_0x93cd('0x5')](e)){var event=events[e];ChatMessage[_0x93cd('0x6')](e,emitEvent(event));}}module[_0x93cd('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xcc3c=['remove','emit','hasOwnProperty','hook','../../mysqldb','ChatMessage','save','update'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xcc3c,0x1cc));var _0xccc3=function(_0x3c0a2e,_0x17072c){_0x3c0a2e=_0x3c0a2e-0x0;var _0x44dbc2=_0xcc3c[_0x3c0a2e];return _0x44dbc2;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xccc3('0x0'))['db'][_0xccc3('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xccc3('0x2'),'afterUpdate':_0xccc3('0x3'),'afterDestroy':_0xccc3('0x4')};function emitEvent(_0x41f078){return function(_0xf9f4d4,_0x167267,_0x3142c0){ChatMessageEvents[_0xccc3('0x5')](_0x41f078+':'+_0xf9f4d4['id'],_0xf9f4d4);ChatMessageEvents[_0xccc3('0x5')](_0x41f078,_0xf9f4d4);_0x3142c0(null);};}for(var e in events){if(events[_0xccc3('0x6')](e)){var event=events[e];ChatMessage[_0xccc3('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c7afd1e..a5c2cda 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 _0xad7a=['FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0xad7a,0x1b1));var _0xaad7=function(_0x247e38,_0x1c9dda){_0x247e38=_0x247e38-0x0;var _0x33c15b=_0xad7a[_0x247e38];return _0x33c15b;};'use strict';var _=require(_0xaad7('0x0'));var util=require(_0xaad7('0x1'));var logger=require(_0xaad7('0x2'))(_0xaad7('0x3'));var moment=require(_0xaad7('0x4'));var BPromise=require(_0xaad7('0x5'));var rp=require(_0xaad7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaad7('0x7'));var config=require(_0xaad7('0x8'));var attributes=require(_0xaad7('0x9'));module[_0xaad7('0xa')]=function(_0xb0cd1f,_0x171abe){return _0xb0cd1f[_0xaad7('0xb')]('ChatMessage',attributes,{'tableName':_0xaad7('0xc'),'paranoid':![],'indexes':[{'name':_0xaad7('0xd'),'fields':[_0xaad7('0xe')],'type':_0xaad7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e6c9f,_0x214b5e,_0x144c85){var _0x5d80a3=_0xb0cd1f[_0xaad7('0x10')];var _0x10900f=_0x2e6c9f['get']({'plain':!![]});if(_0x10900f['direction'][_0xaad7('0x11')]()==='in'||_0x10900f[_0xaad7('0x12')]['toLowerCase']()===_0xaad7('0x13')&&!_0x10900f['secret']&&!_[_0xaad7('0x14')](_0x10900f[_0xaad7('0x15')])){_0x5d80a3[_0xaad7('0x16')][_0xaad7('0x17')]({'where':{'id':_0x10900f[_0xaad7('0x18')]}})[_0xaad7('0x19')](function(_0x4dc42b){if(_0x4dc42b){_0x4dc42b[_0xaad7('0x1a')]({'lastMsgAt':_0x10900f[_0xaad7('0x1b')],'lastMsgDirection':_0x10900f[_0xaad7('0x12')]['toLowerCase']()});}})[_0xaad7('0x1c')](function(_0x598fdd){console[_0xaad7('0x1d')](_0x598fdd);});}_0x144c85();}},'charset':_0xaad7('0x1e'),'collate':_0xaad7('0x1f')});}; \ No newline at end of file +var _0x9f7b=['catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0x9f7b,0xdc));var _0xb9f7=function(_0x26ec3f,_0x3ad343){_0x26ec3f=_0x26ec3f-0x0;var _0x1ea443=_0x9f7b[_0x26ec3f];return _0x1ea443;};'use strict';var _=require('lodash');var util=require(_0xb9f7('0x0'));var logger=require(_0xb9f7('0x1'))(_0xb9f7('0x2'));var moment=require(_0xb9f7('0x3'));var BPromise=require(_0xb9f7('0x4'));var rp=require(_0xb9f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9f7('0x6'));var config=require('../../config/environment');var attributes=require(_0xb9f7('0x7'));module[_0xb9f7('0x8')]=function(_0x522fe6,_0x2d4d39){return _0x522fe6['define'](_0xb9f7('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xb9f7('0xa'),'fields':[_0xb9f7('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x434aa1,_0x87cced,_0xece0b){var _0x1af0e3=_0x522fe6[_0xb9f7('0xc')];var _0xf2d60a=_0x434aa1['get']({'plain':!![]});if(_0xf2d60a[_0xb9f7('0xd')][_0xb9f7('0xe')]()==='in'||_0xf2d60a[_0xb9f7('0xd')][_0xb9f7('0xe')]()===_0xb9f7('0xf')&&!_0xf2d60a[_0xb9f7('0x10')]&&!_[_0xb9f7('0x11')](_0xf2d60a[_0xb9f7('0x12')])){_0x1af0e3['ChatInteraction'][_0xb9f7('0x13')]({'where':{'id':_0xf2d60a['ChatInteractionId']}})[_0xb9f7('0x14')](function(_0x16d697){if(_0x16d697){_0x16d697[_0xb9f7('0x15')]({'lastMsgAt':_0xf2d60a[_0xb9f7('0x16')],'lastMsgDirection':_0xf2d60a[_0xb9f7('0xd')]['toLowerCase']()});}})[_0xb9f7('0x17')](function(_0x23280d){console[_0xb9f7('0x18')](_0x23280d);});}_0xece0b();}},'charset':_0xb9f7('0x19'),'collate':_0xb9f7('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3c475a7..06fa428 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 _0xdae3=['info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s','error','message','result','catch','ChatMessage','body','options','CreateChatMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then'];(function(_0x2b68fd,_0x594330){var _0x367bad=function(_0x5826bc){while(--_0x5826bc){_0x2b68fd['push'](_0x2b68fd['shift']());}};_0x367bad(++_0x594330);}(_0xdae3,0x10e));var _0x3dae=function(_0x19c1d9,_0x530af1){_0x19c1d9=_0x19c1d9-0x0;var _0x298bd2=_0xdae3[_0x19c1d9];return _0x298bd2;};'use strict';var _=require(_0x3dae('0x0'));var util=require(_0x3dae('0x1'));var moment=require(_0x3dae('0x2'));var BPromise=require(_0x3dae('0x3'));var rs=require(_0x3dae('0x4'));var fs=require('fs');var Redis=require(_0x3dae('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3dae('0x6'))(_0x3dae('0x7'));var config=require(_0x3dae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dae('0x9')]['http']({'port':0x232a});config[_0x3dae('0xa')]=_[_0x3dae('0xb')](config[_0x3dae('0xa')],{'host':_0x3dae('0xc'),'port':0x18eb});var socket=require(_0x3dae('0xd'))(new Redis(config['redis']));require(_0x3dae('0xe'))[_0x3dae('0xf')](socket);function respondWithRpcPromise(_0x4f5f9e,_0x535685,_0x554ed4){return new BPromise(function(_0x4e3295,_0x4f0808){return client[_0x3dae('0x10')](_0x4f5f9e,_0x554ed4)[_0x3dae('0x11')](function(_0x512fed){logger[_0x3dae('0x12')]('ChatMessage,\x20%s,\x20%s',_0x535685,'request\x20sent');logger[_0x3dae('0x13')](_0x3dae('0x14'),_0x535685,_0x3dae('0x15'),JSON['stringify'](_0x512fed));if(_0x512fed['error']){if(_0x512fed['error']['code']===0x1f4){logger['error'](_0x3dae('0x16'),_0x535685,_0x512fed[_0x3dae('0x17')][_0x3dae('0x18')]);return _0x4f0808(_0x512fed[_0x3dae('0x17')]['message']);}logger[_0x3dae('0x17')](_0x3dae('0x16'),_0x535685,_0x512fed[_0x3dae('0x17')]['message']);return _0x4e3295(_0x512fed[_0x3dae('0x17')][_0x3dae('0x18')]);}else{logger[_0x3dae('0x12')](_0x3dae('0x16'),_0x535685,_0x3dae('0x15'));_0x4e3295(_0x512fed[_0x3dae('0x19')][_0x3dae('0x18')]);}})[_0x3dae('0x1a')](function(_0x7b1c17){logger['error']('ChatMessage,\x20%s,\x20%s',_0x535685,_0x7b1c17);_0x4f0808(_0x7b1c17);});});}exports['CreateChatMessage']=function(_0x137434){var _0x4e8c31=this;return new Promise(function(_0x155c4b,_0x238190){return db[_0x3dae('0x1b')]['create'](_0x137434[_0x3dae('0x1c')],{'raw':_0x137434[_0x3dae('0x1d')]?_0x137434[_0x3dae('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6b35b){logger['info'](_0x3dae('0x1e'),_0x137434);logger[_0x3dae('0x13')]('CreateChatMessage',_0x137434,JSON[_0x3dae('0x1f')](_0x6b35b));_0x155c4b(_0x6b35b);})[_0x3dae('0x1a')](function(_0x316b61){logger[_0x3dae('0x17')](_0x3dae('0x1e'),_0x316b61['message'],_0x137434);_0x238190(_0x4e8c31[_0x3dae('0x17')](0x1f4,_0x316b61[_0x3dae('0x18')]));});});}; \ No newline at end of file +var _0xff2c=['create','options','raw','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatMessage','ChatMessage'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0xff2c,0x88));var _0xcff2=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xff2c[_0x24fa1a];return _0xc5621f;};'use strict';var _=require('lodash');var util=require(_0xcff2('0x0'));var moment=require('moment');var BPromise=require(_0xcff2('0x1'));var rs=require(_0xcff2('0x2'));var fs=require('fs');var Redis=require(_0xcff2('0x3'));var db=require(_0xcff2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcff2('0x5'))(_0xcff2('0x6'));var config=require(_0xcff2('0x7'));var jayson=require(_0xcff2('0x8'));var client=jayson[_0xcff2('0x9')][_0xcff2('0xa')]({'port':0x232a});config[_0xcff2('0xb')]=_['defaults'](config[_0xcff2('0xb')],{'host':_0xcff2('0xc'),'port':0x18eb});var socket=require(_0xcff2('0xd'))(new Redis(config['redis']));require(_0xcff2('0xe'))[_0xcff2('0xf')](socket);function respondWithRpcPromise(_0x2e47d1,_0x5acdad,_0x54a1d1){return new BPromise(function(_0x2b6550,_0xfa8629){return client[_0xcff2('0x10')](_0x2e47d1,_0x54a1d1)[_0xcff2('0x11')](function(_0x196860){logger[_0xcff2('0x12')](_0xcff2('0x13'),_0x5acdad,_0xcff2('0x14'));logger[_0xcff2('0x15')](_0xcff2('0x16'),_0x5acdad,_0xcff2('0x14'),JSON[_0xcff2('0x17')](_0x196860));if(_0x196860[_0xcff2('0x18')]){if(_0x196860[_0xcff2('0x18')][_0xcff2('0x19')]===0x1f4){logger['error'](_0xcff2('0x13'),_0x5acdad,_0x196860[_0xcff2('0x18')]['message']);return _0xfa8629(_0x196860[_0xcff2('0x18')][_0xcff2('0x1a')]);}logger['error'](_0xcff2('0x13'),_0x5acdad,_0x196860['error']['message']);return _0x2b6550(_0x196860[_0xcff2('0x18')][_0xcff2('0x1a')]);}else{logger[_0xcff2('0x12')](_0xcff2('0x13'),_0x5acdad,_0xcff2('0x14'));_0x2b6550(_0x196860['result']['message']);}})['catch'](function(_0x5a58f4){logger[_0xcff2('0x18')](_0xcff2('0x13'),_0x5acdad,_0x5a58f4);_0xfa8629(_0x5a58f4);});});}exports[_0xcff2('0x1b')]=function(_0x55c2b6){var _0x4d074e=this;return new Promise(function(_0x3fe88e,_0x5213d6){return db[_0xcff2('0x1c')][_0xcff2('0x1d')](_0x55c2b6['body'],{'raw':_0x55c2b6[_0xcff2('0x1e')]?_0x55c2b6[_0xcff2('0x1e')][_0xcff2('0x1f')]===undefined?!![]:![]:!![]})[_0xcff2('0x11')](function(_0x5e985d){logger[_0xcff2('0x12')](_0xcff2('0x1b'),_0x55c2b6);logger[_0xcff2('0x15')](_0xcff2('0x1b'),_0x55c2b6,JSON[_0xcff2('0x17')](_0x5e985d));_0x3fe88e(_0x5e985d);})[_0xcff2('0x20')](function(_0x28cbd1){logger[_0xcff2('0x18')]('CreateChatMessage',_0x28cbd1[_0xcff2('0x1a')],_0x55c2b6);_0x5213d6(_0x4d074e['error'](0x1f4,_0x28cbd1[_0xcff2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0dcc3e0..9f2b8eb 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 _0xd6d6=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2a38d4,_0x43ddc8){var _0x41379e=function(_0xce721f){while(--_0xce721f){_0x2a38d4['push'](_0x2a38d4['shift']());}};_0x41379e(++_0x43ddc8);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1fe49f,_0x4e690a){_0x1fe49f=_0x1fe49f-0x0;var _0x18bdd5=_0xd6d6[_0x1fe49f];return _0x18bdd5;};'use strict';var ChatMessageEvents=require(_0x6d6d('0x0'));var events=[_0x6d6d('0x1'),_0x6d6d('0x2'),_0x6d6d('0x3')];function createListener(_0x536523,_0x2e1aed){return function(_0x3b743d){_0x2e1aed[_0x6d6d('0x4')](_0x536523,_0x3b743d);};}function removeListener(_0x2a838a,_0x5207c9){return function(){ChatMessageEvents[_0x6d6d('0x5')](_0x2a838a,_0x5207c9);};}exports[_0x6d6d('0x6')]=function(_0x5702dc){for(var _0x210ff7=0x0,_0x1bf731=events[_0x6d6d('0x7')];_0x210ff7<_0x1bf731;_0x210ff7++){var _0x18f824=events[_0x210ff7];var _0xd49f57=createListener(_0x6d6d('0x8')+_0x18f824,_0x5702dc);ChatMessageEvents['on'](_0x18f824,_0xd49f57);}}; \ No newline at end of file +var _0x05bc=['update','emit','removeListener','register','length','chatMessage:','save'];(function(_0x4923fd,_0x463a25){var _0x2bb776=function(_0x456f37){while(--_0x456f37){_0x4923fd['push'](_0x4923fd['shift']());}};_0x2bb776(++_0x463a25);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xc05b('0x0'),'remove',_0xc05b('0x1')];function createListener(_0x2762de,_0x59d194){return function(_0x36c0ca){_0x59d194[_0xc05b('0x2')](_0x2762de,_0x36c0ca);};}function removeListener(_0xf971c9,_0x36356e){return function(){ChatMessageEvents[_0xc05b('0x3')](_0xf971c9,_0x36356e);};}exports[_0xc05b('0x4')]=function(_0x2514a1){for(var _0x22c8db=0x0,_0x9c6c57=events[_0xc05b('0x5')];_0x22c8db<_0x9c6c57;_0x22c8db++){var _0x275f0f=events[_0x22c8db];var _0x143ba4=createListener(_0xc05b('0x6')+_0x275f0f,_0x2514a1);ChatMessageEvents['on'](_0x275f0f,_0x143ba4);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 59819e8..b8c1409 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 _0x4c41=['tracked','chat','chatmessage:create','create','put','update','/:id/reject','reject','delete','/:id','destroy','exports','multer','path','express','fs-extra','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x487f47,_0x32b30b){var _0x35988b=function(_0x589ef6){while(--_0x589ef6){_0x487f47['push'](_0x487f47['shift']());}};_0x35988b(++_0x32b30b);}(_0x4c41,0x174));var _0x14c4=function(_0x21ce08,_0xc2b67){_0x21ce08=_0x21ce08-0x0;var _0x347516=_0x4c41[_0x21ce08];return _0x347516;};'use strict';var multer=require(_0x14c4('0x0'));var util=require('util');var path=require(_0x14c4('0x1'));var timeout=require('connect-timeout');var express=require(_0x14c4('0x2'));var router=express['Router']();var fs_extra=require(_0x14c4('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x14c4('0x4'));router[_0x14c4('0x5')]('/',auth[_0x14c4('0x6')](),controller[_0x14c4('0x7')]);router[_0x14c4('0x5')](_0x14c4('0x8'),auth[_0x14c4('0x6')](),controller[_0x14c4('0x9')]);router[_0x14c4('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x14c4('0xa')]);router[_0x14c4('0xb')]('/',auth[_0x14c4('0x6')](),interaction[_0x14c4('0xc')](_0x14c4('0xd'),_0x14c4('0xe')),controller[_0x14c4('0xf')]);router[_0x14c4('0x10')]('/:id',controller[_0x14c4('0x11')]);router[_0x14c4('0x10')]('/:id/accept',auth[_0x14c4('0x6')](),controller['accept']);router[_0x14c4('0x10')](_0x14c4('0x12'),auth['isAuthenticated'](),controller[_0x14c4('0x13')]);router[_0x14c4('0x14')](_0x14c4('0x15'),auth[_0x14c4('0x6')](),controller[_0x14c4('0x16')]);module[_0x14c4('0x17')]=router; \ No newline at end of file +var _0x716c=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x146811,_0x464fb6){var _0x5f2cd7=function(_0x59baf5){while(--_0x59baf5){_0x146811['push'](_0x146811['shift']());}};_0x5f2cd7(++_0x464fb6);}(_0x716c,0xa7));var _0xc716=function(_0x2b3fa2,_0x32c747){_0x2b3fa2=_0x2b3fa2-0x0;var _0x5b6acc=_0x716c[_0x2b3fa2];return _0x5b6acc;};'use strict';var multer=require(_0xc716('0x0'));var util=require(_0xc716('0x1'));var path=require(_0xc716('0x2'));var timeout=require(_0xc716('0x3'));var express=require(_0xc716('0x4'));var router=express[_0xc716('0x5')]();var fs_extra=require(_0xc716('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc716('0x7'));var controller=require(_0xc716('0x8'));router[_0xc716('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc716('0x9')]('/describe',auth[_0xc716('0xa')](),controller[_0xc716('0xb')]);router[_0xc716('0x9')](_0xc716('0xc'),auth[_0xc716('0xa')](),controller[_0xc716('0xd')]);router[_0xc716('0xe')]('/',auth[_0xc716('0xa')](),interaction[_0xc716('0xf')](_0xc716('0x10'),_0xc716('0x11')),controller[_0xc716('0x12')]);router[_0xc716('0x13')](_0xc716('0xc'),controller[_0xc716('0x14')]);router[_0xc716('0x13')](_0xc716('0x15'),auth[_0xc716('0xa')](),controller[_0xc716('0x16')]);router[_0xc716('0x13')](_0xc716('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0xc716('0x18')]('/:id',auth[_0xc716('0xa')](),controller[_0xc716('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 92fb8ca..293840f 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 _0x5f66=['medium','TEXT','exports'];(function(_0x165983,_0x5d33f0){var _0x2bdd01=function(_0x130e80){while(--_0x130e80){_0x165983['push'](_0x165983['shift']());}};_0x2bdd01(++_0x5d33f0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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 +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0x0b0e[_0x3d13bb];return _0x4b5a1b;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c75fca0..aab91d4 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2e089c,_0x320e17){var _0x1560c2=function(_0x98bc8){while(--_0x98bc8){_0x2e089c['push'](_0x2e089c['shift']());}};_0x1560c2(++_0x320e17);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xef0477,_0x153cdf){var _0x3ea869=function(_0x2c8778){while(--_0x2c8778){_0xef0477['push'](_0xef0477['shift']());}};_0x3ea869(++_0x153cdf);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 3d97646..d17828f 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 _0xbc20=['ChatOfflineMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xbc20,0x181));var _0x0bc2=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xbc20[_0x40927b];return _0x2635e8;};'use strict';var EventEmitter=require(_0x0bc2('0x0'));var ChatOfflineMessage=require(_0x0bc2('0x1'))['db'][_0x0bc2('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0bc2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0bc2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d1076){return function(_0x1c455b,_0x2b95d3,_0x564cbf){ChatOfflineMessageEvents[_0x0bc2('0x5')](_0x4d1076+':'+_0x1c455b['id'],_0x1c455b);ChatOfflineMessageEvents['emit'](_0x4d1076,_0x1c455b);_0x564cbf(null);};}for(var e in events){if(events[_0x0bc2('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x0bc2('0x7')](e,emitEvent(event));}}module[_0x0bc2('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3b40=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3b40,0x13a));var _0x03b4=function(_0x3119cb,_0x470a49){_0x3119cb=_0x3119cb-0x0;var _0x19d737=_0x3b40[_0x3119cb];return _0x19d737;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x03b4('0x0'))['db'][_0x03b4('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x03b4('0x2')](0x0);var events={'afterCreate':_0x03b4('0x3'),'afterUpdate':_0x03b4('0x4'),'afterDestroy':_0x03b4('0x5')};function emitEvent(_0x1472c2){return function(_0x39fc5b,_0x24449f,_0x5f47f0){ChatOfflineMessageEvents[_0x03b4('0x6')](_0x1472c2+':'+_0x39fc5b['id'],_0x39fc5b);ChatOfflineMessageEvents['emit'](_0x1472c2,_0x39fc5b);_0x5f47f0(null);};}for(var e in events){if(events[_0x03b4('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x03b4('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 73a2d0b..5650953 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 _0x67b3=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x67b3,0x91));var _0x367b=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x67b3[_0x67f95e];return _0x538f5a;};'use strict';var attributes=require(_0x367b('0x0'));module[_0x367b('0x1')]=function(_0x319029){return _0x319029['define'](_0x367b('0x2'),attributes,{'tableName':_0x367b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x367b('0x4'),'collate':_0x367b('0x5')});}; \ No newline at end of file +var _0x8674=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x8674,0x188));var _0x4867=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x8674[_0x32f7d7];return _0x133d09;};'use strict';var attributes=require(_0x4867('0x0'));module[_0x4867('0x1')]=function(_0x3c8b8a){return _0x3c8b8a[_0x4867('0x2')](_0x4867('0x3'),attributes,{'tableName':_0x4867('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4867('0x5'),'collate':_0x4867('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6a6de6a..e2d8a6d 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 _0x5af9=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch'];(function(_0x339969,_0x51a7c6){var _0xd4165d=function(_0x57c869){while(--_0x57c869){_0x339969['push'](_0x339969['shift']());}};_0xd4165d(++_0x51a7c6);}(_0x5af9,0xdc));var _0x95af=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x5af9[_0x1265ed];return _0x5ac459;};'use strict';var _=require(_0x95af('0x0'));var util=require(_0x95af('0x1'));var moment=require(_0x95af('0x2'));var BPromise=require('bluebird');var rs=require(_0x95af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95af('0x4'));var logger=require(_0x95af('0x5'))(_0x95af('0x6'));var config=require('../../config/environment');var jayson=require(_0x95af('0x7'));var client=jayson[_0x95af('0x8')][_0x95af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15005f,_0x73307d,_0x5266eb){return new BPromise(function(_0xba1a38,_0x3fdf1b){return client[_0x95af('0xa')](_0x15005f,_0x5266eb)[_0x95af('0xb')](function(_0x4dc1de){logger[_0x95af('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x73307d,_0x95af('0xd'));logger[_0x95af('0xe')](_0x95af('0xf'),_0x73307d,_0x95af('0xd'),JSON[_0x95af('0x10')](_0x4dc1de));if(_0x4dc1de[_0x95af('0x11')]){if(_0x4dc1de[_0x95af('0x11')][_0x95af('0x12')]===0x1f4){logger['error'](_0x95af('0x13'),_0x73307d,_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);return _0x3fdf1b(_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);}logger[_0x95af('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x73307d,_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);return _0xba1a38(_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);}else{logger[_0x95af('0xc')](_0x95af('0x13'),_0x73307d,_0x95af('0xd'));_0xba1a38(_0x4dc1de['result'][_0x95af('0x14')]);}})[_0x95af('0x15')](function(_0x1dee5e){logger[_0x95af('0x11')](_0x95af('0x13'),_0x73307d,_0x1dee5e);_0x3fdf1b(_0x1dee5e);});});} \ No newline at end of file +var _0x9fd0=['request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x350a47,_0x1d9f43){var _0x152572=function(_0x53807b){while(--_0x53807b){_0x350a47['push'](_0x350a47['shift']());}};_0x152572(++_0x1d9f43);}(_0x9fd0,0x1c2));var _0x09fd=function(_0x36f80c,_0x443cdc){_0x36f80c=_0x36f80c-0x0;var _0x28b842=_0x9fd0[_0x36f80c];return _0x28b842;};'use strict';var _=require(_0x09fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09fd('0x1'));var fs=require('fs');var Redis=require(_0x09fd('0x2'));var db=require(_0x09fd('0x3'))['db'];var utils=require(_0x09fd('0x4'));var logger=require(_0x09fd('0x5'))(_0x09fd('0x6'));var config=require(_0x09fd('0x7'));var jayson=require(_0x09fd('0x8'));var client=jayson['client'][_0x09fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161604,_0x3d00e4,_0x369e91){return new BPromise(function(_0xced1bc,_0x1b3186){return client[_0x09fd('0xa')](_0x161604,_0x369e91)[_0x09fd('0xb')](function(_0x434d1e){logger['info'](_0x09fd('0xc'),_0x3d00e4,_0x09fd('0xd'));logger['debug'](_0x09fd('0xe'),_0x3d00e4,_0x09fd('0xd'),JSON['stringify'](_0x434d1e));if(_0x434d1e['error']){if(_0x434d1e[_0x09fd('0xf')][_0x09fd('0x10')]===0x1f4){logger['error'](_0x09fd('0xc'),_0x3d00e4,_0x434d1e[_0x09fd('0xf')]['message']);return _0x1b3186(_0x434d1e[_0x09fd('0xf')]['message']);}logger[_0x09fd('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3d00e4,_0x434d1e[_0x09fd('0xf')][_0x09fd('0x11')]);return _0xced1bc(_0x434d1e[_0x09fd('0xf')]['message']);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x3d00e4,_0x09fd('0xd'));_0xced1bc(_0x434d1e[_0x09fd('0x12')][_0x09fd('0x11')]);}})[_0x09fd('0x13')](function(_0x102bae){logger['error'](_0x09fd('0xc'),_0x3d00e4,_0x102bae);_0x1b3186(_0x102bae);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 56be498..bbf0cb0 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 _0x0fe6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x462545,_0x3c0f1b){var _0x680d51=function(_0x22727b){while(--_0x22727b){_0x462545['push'](_0x462545['shift']());}};_0x680d51(++_0x3c0f1b);}(_0x0fe6,0x11d));var _0x60fe=function(_0x46405c,_0x3d9b08){_0x46405c=_0x46405c-0x0;var _0x1d3e43=_0x0fe6[_0x46405c];return _0x1d3e43;};'use strict';var multer=require(_0x60fe('0x0'));var util=require(_0x60fe('0x1'));var path=require(_0x60fe('0x2'));var timeout=require(_0x60fe('0x3'));var express=require(_0x60fe('0x4'));var router=express[_0x60fe('0x5')]();var fs_extra=require(_0x60fe('0x6'));var auth=require(_0x60fe('0x7'));var interaction=require(_0x60fe('0x8'));var config=require(_0x60fe('0x9'));var controller=require(_0x60fe('0xa'));router[_0x60fe('0xb')]('/',auth['isAuthenticated'](),controller[_0x60fe('0xc')]);router['get'](_0x60fe('0xd'),auth[_0x60fe('0xe')](),controller[_0x60fe('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x60fe('0x10')]);router[_0x60fe('0x11')]('/',auth[_0x60fe('0xe')](),controller[_0x60fe('0x12')]);router[_0x60fe('0x13')](_0x60fe('0x14'),auth[_0x60fe('0xe')](),controller['update']);router[_0x60fe('0x15')]('/:id',auth[_0x60fe('0xe')](),controller[_0x60fe('0x16')]);module[_0x60fe('0x17')]=router; \ No newline at end of file +var _0x32db=['/:id','show','post','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','describe'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x32db,0x16e));var _0xb32d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32db[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb32d('0x0'));var util=require('util');var path=require(_0xb32d('0x1'));var timeout=require('connect-timeout');var express=require(_0xb32d('0x2'));var router=express[_0xb32d('0x3')]();var fs_extra=require(_0xb32d('0x4'));var auth=require(_0xb32d('0x5'));var interaction=require(_0xb32d('0x6'));var config=require('../../config/environment');var controller=require(_0xb32d('0x7'));router[_0xb32d('0x8')]('/',auth[_0xb32d('0x9')](),controller[_0xb32d('0xa')]);router[_0xb32d('0x8')]('/describe',auth[_0xb32d('0x9')](),controller[_0xb32d('0xb')]);router[_0xb32d('0x8')](_0xb32d('0xc'),auth['isAuthenticated'](),controller[_0xb32d('0xd')]);router[_0xb32d('0xe')]('/',auth[_0xb32d('0x9')](),controller['create']);router[_0xb32d('0xf')](_0xb32d('0xc'),auth[_0xb32d('0x9')](),controller['update']);router[_0xb32d('0x10')]('/:id',auth[_0xb32d('0x9')](),controller[_0xb32d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5af9afc..4338588 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 _0x6210=['mouseOver','timeout','INTEGER','sequelize','exports','ENUM'];(function(_0x308174,_0x4e7dc4){var _0x59d18d=function(_0x1aa6a5){while(--_0x1aa6a5){_0x308174['push'](_0x308174['shift']());}};_0x59d18d(++_0x4e7dc4);}(_0x6210,0x177));var _0x0621=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x6210[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x0621('0x0'));module[_0x0621('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0621('0x2')](_0x0621('0x3'),_0x0621('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0621('0x5')]}}; \ No newline at end of file +var _0x16cb=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x130927,_0x4630c0){var _0x180b7e=function(_0xf078a6){while(--_0xf078a6){_0x130927['push'](_0x130927['shift']());}};_0x180b7e(++_0x4630c0);}(_0x16cb,0x1cf));var _0xb16c=function(_0xffdd96,_0x5d72a5){_0xffdd96=_0xffdd96-0x0;var _0x6f7980=_0x16cb[_0xffdd96];return _0x6f7980;};'use strict';var Sequelize=require(_0xb16c('0x0'));module[_0xb16c('0x1')]={'name':{'type':Sequelize[_0xb16c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb16c('0x3')](_0xb16c('0x4'),'timeout'),'defaultValue':_0xb16c('0x4')},'selector':{'type':Sequelize[_0xb16c('0x2')]},'timeout':{'type':Sequelize[_0xb16c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e11f10e..95c4e7e 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 _0x60c2=['intersection','length','attributes','includeAll','include','merge','options','ChatProactiveAction','catch','create','body','params','find','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','query','filters'];(function(_0x3460c9,_0x565510){var _0x1d8283=function(_0x8a51bd){while(--_0x8a51bd){_0x3460c9['push'](_0x3460c9['shift']());}};_0x1d8283(++_0x565510);}(_0x60c2,0x8f));var _0x260c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x60c2[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x260c('0x0'));var zipdir=require(_0x260c('0x1'));var jsonpatch=require(_0x260c('0x2'));var rp=require(_0x260c('0x3'));var moment=require(_0x260c('0x4'));var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require(_0x260c('0x9'));var csv=require(_0x260c('0xa'));var ejs=require(_0x260c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x260c('0xc'));var squel=require(_0x260c('0xd'));var crypto=require(_0x260c('0xe'));var jsforce=require(_0x260c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x260c('0xa'));var querystring=require(_0x260c('0x10'));var Papa=require(_0x260c('0x11'));var Redis=require(_0x260c('0x12'));var authService=require(_0x260c('0x13'));var qs=require(_0x260c('0x14'));var as=require(_0x260c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x16'))(_0x260c('0x17'));var utils=require(_0x260c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x19'));var db=require(_0x260c('0x1a'))['db'];function respondWithStatusCode(_0x191490,_0x5aed37){_0x5aed37=_0x5aed37||0xcc;return function(_0xc44e8d){if(_0xc44e8d){return _0x191490[_0x260c('0x1b')](_0x5aed37);}return _0x191490[_0x260c('0x1c')](_0x5aed37)[_0x260c('0x1d')]();};}function respondWithResult(_0x1d3775,_0x53df53){_0x53df53=_0x53df53||0xc8;return function(_0x3930b6){if(_0x3930b6){return _0x1d3775['status'](_0x53df53)[_0x260c('0x1e')](_0x3930b6);}};}function respondWithFilteredResult(_0x5a021c,_0x47edc1){return function(_0xd8b310){if(_0xd8b310){var _0x5299a4=typeof _0x47edc1[_0x260c('0x1f')]===_0x260c('0x20')&&typeof _0x47edc1[_0x260c('0x21')]===_0x260c('0x20');var _0x2bf3b8=_0xd8b310[_0x260c('0x22')];var _0x11e634=_0x5299a4?0x0:_0x47edc1[_0x260c('0x1f')];var _0x201e59=_0x5299a4?_0xd8b310[_0x260c('0x22')]:_0x47edc1[_0x260c('0x1f')]+_0x47edc1['limit'];var _0xd977b;if(_0x201e59>=_0x2bf3b8){_0x201e59=_0x2bf3b8;_0xd977b=0xc8;}else{_0xd977b=0xce;}_0x5a021c['status'](_0xd977b);return _0x5a021c[_0x260c('0x23')](_0x260c('0x24'),_0x11e634+'-'+_0x201e59+'/'+_0x2bf3b8)['json'](_0xd8b310);}return null;};}function patchUpdates(_0x1ccf81){return function(_0xe824db){try{jsonpatch[_0x260c('0x25')](_0xe824db,_0x1ccf81,!![]);}catch(_0x1c53e1){return BPromise[_0x260c('0x26')](_0x1c53e1);}return _0xe824db[_0x260c('0x27')]();};}function saveUpdates(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x28')](_0x4b5b7a)[_0x260c('0x29')](function(_0x58688c){return _0x58688c;});}return null;};}function removeEntity(_0x3f299f,_0x304961){return function(_0x461c8a){if(_0x461c8a){return _0x461c8a[_0x260c('0x2a')]()['then'](function(){_0x3f299f[_0x260c('0x1c')](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x3bdfce,_0x29e10e){return function(_0x4cf0f9){if(!_0x4cf0f9){_0x3bdfce[_0x260c('0x1b')](0x194);}return _0x4cf0f9;};}function handleError(_0x2957e5,_0x480179){_0x480179=_0x480179||0x1f4;return function(_0x5def72){logger[_0x260c('0x2b')](_0x5def72[_0x260c('0x2c')]);if(_0x5def72[_0x260c('0x2d')]){delete _0x5def72[_0x260c('0x2d')];}_0x2957e5[_0x260c('0x1c')](_0x480179)[_0x260c('0x2e')](_0x5def72);};}exports['show']=function(_0xf1ad3e,_0x2e49dd){var _0x16b663={'raw':!![],'where':{'id':_0xf1ad3e['params']['id']}},_0x233a61={};_0x233a61[_0x260c('0x2f')]=_[_0x260c('0x30')](db['ChatProactiveAction'][_0x260c('0x31')]);_0x233a61[_0x260c('0x32')]=_[_0x260c('0x30')](_0xf1ad3e[_0x260c('0x32')]);_0x233a61[_0x260c('0x33')]=_[_0x260c('0x34')](_0x233a61[_0x260c('0x2f')],_0x233a61[_0x260c('0x32')]);_0x16b663['attributes']=_[_0x260c('0x34')](_0x233a61[_0x260c('0x2f')],qs['fields'](_0xf1ad3e[_0x260c('0x32')]['fields']));_0x16b663['attributes']=_0x16b663['attributes'][_0x260c('0x35')]?_0x16b663[_0x260c('0x36')]:_0x233a61['model'];if(_0xf1ad3e[_0x260c('0x32')][_0x260c('0x37')]){_0x16b663[_0x260c('0x38')]=[{'all':!![]}];}_0x16b663=_[_0x260c('0x39')]({},_0x16b663,_0xf1ad3e[_0x260c('0x3a')]);return db[_0x260c('0x3b')]['find'](_0x16b663)[_0x260c('0x29')](handleEntityNotFound(_0x2e49dd,null))[_0x260c('0x29')](respondWithResult(_0x2e49dd,null))[_0x260c('0x3c')](handleError(_0x2e49dd,null));};exports[_0x260c('0x3d')]=function(_0xd12212,_0x220738){return db[_0x260c('0x3b')][_0x260c('0x3d')](_0xd12212[_0x260c('0x3e')],{})['then'](respondWithResult(_0x220738,0xc9))[_0x260c('0x3c')](handleError(_0x220738,null));};exports['update']=function(_0x5362dd,_0x5287ee){if(_0x5362dd['body']['id']){delete _0x5362dd['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x5362dd[_0x260c('0x3f')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x5287ee,null))[_0x260c('0x29')](saveUpdates(_0x5362dd[_0x260c('0x3e')],null))['then'](respondWithResult(_0x5287ee,null))[_0x260c('0x3c')](handleError(_0x5287ee,null));};exports[_0x260c('0x2a')]=function(_0x5f5120,_0x35afd6){return db[_0x260c('0x3b')][_0x260c('0x40')]({'where':{'id':_0x5f5120[_0x260c('0x3f')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x35afd6,null))['then'](removeEntity(_0x35afd6,null))['catch'](handleError(_0x35afd6,null));}; \ No newline at end of file +var _0x212b=['querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','error','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x212b,0x148));var _0xb212=function(_0x1de219,_0x3c742e){_0x1de219=_0x1de219-0x0;var _0x1ab5d7=_0x212b[_0x1de219];return _0x1ab5d7;};'use strict';var emlformat=require(_0xb212('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb212('0x1'));var jsonpatch=require(_0xb212('0x2'));var rp=require(_0xb212('0x3'));var moment=require(_0xb212('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb212('0x5'));var util=require(_0xb212('0x6'));var path=require(_0xb212('0x7'));var sox=require('sox');var csv=require(_0xb212('0x8'));var ejs=require(_0xb212('0x9'));var fs=require('fs');var fs_extra=require(_0xb212('0xa'));var _=require('lodash');var squel=require(_0xb212('0xb'));var crypto=require(_0xb212('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb212('0xd'));var toCsv=require(_0xb212('0x8'));var querystring=require(_0xb212('0xe'));var Papa=require('papaparse');var Redis=require(_0xb212('0xf'));var authService=require(_0xb212('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb212('0x11'))('api');var utils=require(_0xb212('0x12'));var config=require(_0xb212('0x13'));var licenseUtil=require(_0xb212('0x14'));var db=require(_0xb212('0x15'))['db'];function respondWithStatusCode(_0x41eba8,_0x1dd322){_0x1dd322=_0x1dd322||0xcc;return function(_0x11ea42){if(_0x11ea42){return _0x41eba8[_0xb212('0x16')](_0x1dd322);}return _0x41eba8[_0xb212('0x17')](_0x1dd322)[_0xb212('0x18')]();};}function respondWithResult(_0x2b64a7,_0x2f12bf){_0x2f12bf=_0x2f12bf||0xc8;return function(_0x5118f5){if(_0x5118f5){return _0x2b64a7['status'](_0x2f12bf)['json'](_0x5118f5);}};}function respondWithFilteredResult(_0x4baa5b,_0x105d4c){return function(_0x11dcab){if(_0x11dcab){var _0x1b2f6d=typeof _0x105d4c['offset']===_0xb212('0x19')&&typeof _0x105d4c[_0xb212('0x1a')]===_0xb212('0x19');var _0xaffb30=_0x11dcab[_0xb212('0x1b')];var _0x267c58=_0x1b2f6d?0x0:_0x105d4c[_0xb212('0x1c')];var _0xe6b2f8=_0x1b2f6d?_0x11dcab[_0xb212('0x1b')]:_0x105d4c[_0xb212('0x1c')]+_0x105d4c[_0xb212('0x1a')];var _0x30f248;if(_0xe6b2f8>=_0xaffb30){_0xe6b2f8=_0xaffb30;_0x30f248=0xc8;}else{_0x30f248=0xce;}_0x4baa5b[_0xb212('0x17')](_0x30f248);return _0x4baa5b['set']('Content-Range',_0x267c58+'-'+_0xe6b2f8+'/'+_0xaffb30)[_0xb212('0x1d')](_0x11dcab);}return null;};}function patchUpdates(_0x409e51){return function(_0x228a57){try{jsonpatch[_0xb212('0x1e')](_0x228a57,_0x409e51,!![]);}catch(_0x1a374d){return BPromise[_0xb212('0x1f')](_0x1a374d);}return _0x228a57[_0xb212('0x20')]();};}function saveUpdates(_0x19fc16,_0x3b9361){return function(_0x30aaba){if(_0x30aaba){return _0x30aaba[_0xb212('0x21')](_0x19fc16)[_0xb212('0x22')](function(_0x114d8f){return _0x114d8f;});}return null;};}function removeEntity(_0x491c3b,_0x5e0c12){return function(_0x25d40e){if(_0x25d40e){return _0x25d40e[_0xb212('0x23')]()[_0xb212('0x22')](function(){_0x491c3b[_0xb212('0x17')](0xcc)[_0xb212('0x18')]();});}};}function handleEntityNotFound(_0x2b9046,_0x2aafe4){return function(_0x4ca0a2){if(!_0x4ca0a2){_0x2b9046[_0xb212('0x16')](0x194);}return _0x4ca0a2;};}function handleError(_0x48d420,_0xd1180f){_0xd1180f=_0xd1180f||0x1f4;return function(_0x32849a){logger[_0xb212('0x24')](_0x32849a['stack']);if(_0x32849a[_0xb212('0x25')]){delete _0x32849a[_0xb212('0x25')];}_0x48d420[_0xb212('0x17')](_0xd1180f)['send'](_0x32849a);};}exports[_0xb212('0x26')]=function(_0x277812,_0x882231){var _0xdf3d5d={'raw':!![],'where':{'id':_0x277812[_0xb212('0x27')]['id']}},_0xd069d9={};_0xd069d9[_0xb212('0x28')]=_[_0xb212('0x29')](db[_0xb212('0x2a')][_0xb212('0x2b')]);_0xd069d9[_0xb212('0x2c')]=_[_0xb212('0x29')](_0x277812[_0xb212('0x2c')]);_0xd069d9[_0xb212('0x2d')]=_[_0xb212('0x2e')](_0xd069d9['model'],_0xd069d9['query']);_0xdf3d5d[_0xb212('0x2f')]=_[_0xb212('0x2e')](_0xd069d9['model'],qs[_0xb212('0x30')](_0x277812[_0xb212('0x2c')][_0xb212('0x30')]));_0xdf3d5d[_0xb212('0x2f')]=_0xdf3d5d[_0xb212('0x2f')][_0xb212('0x31')]?_0xdf3d5d[_0xb212('0x2f')]:_0xd069d9[_0xb212('0x28')];if(_0x277812['query']['includeAll']){_0xdf3d5d[_0xb212('0x32')]=[{'all':!![]}];}_0xdf3d5d=_[_0xb212('0x33')]({},_0xdf3d5d,_0x277812[_0xb212('0x34')]);return db[_0xb212('0x2a')][_0xb212('0x35')](_0xdf3d5d)[_0xb212('0x22')](handleEntityNotFound(_0x882231,null))[_0xb212('0x22')](respondWithResult(_0x882231,null))[_0xb212('0x36')](handleError(_0x882231,null));};exports[_0xb212('0x37')]=function(_0x249ccb,_0x769ba9){return db[_0xb212('0x2a')][_0xb212('0x37')](_0x249ccb['body'],{})[_0xb212('0x22')](respondWithResult(_0x769ba9,0xc9))[_0xb212('0x36')](handleError(_0x769ba9,null));};exports[_0xb212('0x21')]=function(_0x3f0141,_0x115e11){if(_0x3f0141['body']['id']){delete _0x3f0141[_0xb212('0x38')]['id'];}return db[_0xb212('0x2a')]['find']({'where':{'id':_0x3f0141[_0xb212('0x27')]['id']}})['then'](handleEntityNotFound(_0x115e11,null))[_0xb212('0x22')](saveUpdates(_0x3f0141[_0xb212('0x38')],null))['then'](respondWithResult(_0x115e11,null))[_0xb212('0x36')](handleError(_0x115e11,null));};exports[_0xb212('0x23')]=function(_0x2c8820,_0x2b36a0){return db['ChatProactiveAction'][_0xb212('0x35')]({'where':{'id':_0x2c8820[_0xb212('0x27')]['id']}})['then'](handleEntityNotFound(_0x2b36a0,null))[_0xb212('0x22')](removeEntity(_0x2b36a0,null))['catch'](handleError(_0x2b36a0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 87010af..568487b 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 _0xb86b=['../../config/environment','exports','define','ChatProactiveAction','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb86b,0x158));var _0xbb86=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0xb86b[_0x1ebb10];return _0x20d709;};'use strict';var _=require('lodash');var util=require(_0xbb86('0x0'));var logger=require(_0xbb86('0x1'))(_0xbb86('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbb86('0x3'));var fs=require('fs');var path=require(_0xbb86('0x4'));var rimraf=require(_0xbb86('0x5'));var config=require(_0xbb86('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0xbb86('0x7')]=function(_0x1522c5,_0x47d6f2){return _0x1522c5[_0xbb86('0x8')](_0xbb86('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a84=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','util'];(function(_0x6aa32f,_0x3820f7){var _0x52bfee=function(_0x49814f){while(--_0x49814f){_0x6aa32f['push'](_0x6aa32f['shift']());}};_0x52bfee(++_0x3820f7);}(_0x5a84,0xd0));var _0x45a8=function(_0x154dcb,_0x4072a9){_0x154dcb=_0x154dcb-0x0;var _0x4d3295=_0x5a84[_0x154dcb];return _0x4d3295;};'use strict';var _=require('lodash');var util=require(_0x45a8('0x0'));var logger=require(_0x45a8('0x1'))('api');var moment=require(_0x45a8('0x2'));var BPromise=require(_0x45a8('0x3'));var rp=require(_0x45a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45a8('0x5'));var config=require(_0x45a8('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x45a8('0x7')]=function(_0x4fe006,_0x1f71c0){return _0x4fe006[_0x45a8('0x8')](_0x45a8('0x9'),attributes,{'tableName':_0x45a8('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 e746427..9c0f4b7 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 _0x88fa=['error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x88fa,0x1d3));var _0xa88f=function(_0x37e21b,_0x50b31e){_0x37e21b=_0x37e21b-0x0;var _0x411f61=_0x88fa[_0x37e21b];return _0x411f61;};'use strict';var _=require(_0xa88f('0x0'));var util=require('util');var moment=require(_0xa88f('0x1'));var BPromise=require(_0xa88f('0x2'));var rs=require(_0xa88f('0x3'));var fs=require('fs');var Redis=require(_0xa88f('0x4'));var db=require(_0xa88f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa88f('0x6'));var config=require(_0xa88f('0x7'));var jayson=require(_0xa88f('0x8'));var client=jayson[_0xa88f('0x9')][_0xa88f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5194d6,_0x829bef,_0x3b16ac){return new BPromise(function(_0x5543bd,_0x48cef0){return client[_0xa88f('0xb')](_0x5194d6,_0x3b16ac)[_0xa88f('0xc')](function(_0x22f87e){logger[_0xa88f('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x829bef,_0xa88f('0xe'));logger[_0xa88f('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x829bef,_0xa88f('0xe'),JSON['stringify'](_0x22f87e));if(_0x22f87e[_0xa88f('0x10')]){if(_0x22f87e['error'][_0xa88f('0x11')]===0x1f4){logger[_0xa88f('0x10')](_0xa88f('0x12'),_0x829bef,_0x22f87e[_0xa88f('0x10')][_0xa88f('0x13')]);return _0x48cef0(_0x22f87e['error'][_0xa88f('0x13')]);}logger[_0xa88f('0x10')](_0xa88f('0x12'),_0x829bef,_0x22f87e[_0xa88f('0x10')][_0xa88f('0x13')]);return _0x5543bd(_0x22f87e[_0xa88f('0x10')]['message']);}else{logger[_0xa88f('0xd')](_0xa88f('0x12'),_0x829bef,_0xa88f('0xe'));_0x5543bd(_0x22f87e['result'][_0xa88f('0x13')]);}})[_0xa88f('0x14')](function(_0x4b801f){logger[_0xa88f('0x10')](_0xa88f('0x12'),_0x829bef,_0x4b801f);_0x48cef0(_0x4b801f);});});} \ No newline at end of file +var _0x5453=['error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5453,0x1d0));var _0x3545=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5453[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var moment=require('moment');var BPromise=require(_0x3545('0x2'));var rs=require(_0x3545('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3545('0x4'))['db'];var utils=require(_0x3545('0x5'));var logger=require('../../config/logger')(_0x3545('0x6'));var config=require(_0x3545('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3545('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x793add,_0x3ca4c2,_0x55161a){return new BPromise(function(_0xde8f6e,_0x2e18fb){return client[_0x3545('0x9')](_0x793add,_0x55161a)[_0x3545('0xa')](function(_0x4498d4){logger[_0x3545('0xb')](_0x3545('0xc'),_0x3ca4c2,_0x3545('0xd'));logger[_0x3545('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3ca4c2,_0x3545('0xd'),JSON[_0x3545('0xf')](_0x4498d4));if(_0x4498d4[_0x3545('0x10')]){if(_0x4498d4[_0x3545('0x10')][_0x3545('0x11')]===0x1f4){logger[_0x3545('0x10')](_0x3545('0xc'),_0x3ca4c2,_0x4498d4[_0x3545('0x10')][_0x3545('0x12')]);return _0x2e18fb(_0x4498d4[_0x3545('0x10')][_0x3545('0x12')]);}logger[_0x3545('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x3ca4c2,_0x4498d4['error'][_0x3545('0x12')]);return _0xde8f6e(_0x4498d4[_0x3545('0x10')][_0x3545('0x12')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x3ca4c2,_0x3545('0xd'));_0xde8f6e(_0x4498d4['result'][_0x3545('0x12')]);}})[_0x3545('0x13')](function(_0x5ef2ed){logger[_0x3545('0x10')](_0x3545('0xc'),_0x3ca4c2,_0x5ef2ed);_0x2e18fb(_0x5ef2ed);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a774461..dfdfe2c 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 _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d6e39,_0x9a4e4c){var _0x219494=function(_0x2de8b5){while(--_0x2de8b5){_0x5d6e39['push'](_0x5d6e39['shift']());}};_0x219494(++_0x9a4e4c);}(_0x326f,0xd1));var _0xf326=function(_0xe04e2,_0x2fab1a){_0xe04e2=_0xe04e2-0x0;var _0x5dae9c=_0x326f[_0xe04e2];return _0x5dae9c;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file +var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x71ab,0x64));var _0xb71a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x71ab[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index fb42be6..042b50e 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 _0x3c44=['sequelize','exports','name','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2c5bf3,_0x14ea88){var _0x32b188=function(_0x1bcb56){while(--_0x1bcb56){_0x2c5bf3['push'](_0x2c5bf3['shift']());}};_0x32b188(++_0x14ea88);}(_0x3c44,0x140));var _0x43c4=function(_0x2eb21e,_0x5d3db7){_0x2eb21e=_0x2eb21e-0x0;var _0x279d30=_0x3c44[_0x2eb21e];return _0x279d30;};'use strict';var Sequelize=require(_0x43c4('0x0'));module[_0x43c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x43c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x43c4('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x43c4('0x4')](_0x43c4('0x5'),_0x43c4('0x6'),_0x43c4('0x7'))}}; \ No newline at end of file +var _0x7eba=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x438e20,_0x35e4ed){var _0x3cf994=function(_0x19baac){while(--_0x19baac){_0x438e20['push'](_0x438e20['shift']());}};_0x3cf994(++_0x35e4ed);}(_0x7eba,0x153));var _0xa7eb=function(_0x543733,_0x2799ae){_0x543733=_0x543733-0x0;var _0x1e51c=_0x7eba[_0x543733];return _0x1e51c;};'use strict';var Sequelize=require(_0xa7eb('0x0'));module[_0xa7eb('0x1')]={'name':{'type':Sequelize[_0xa7eb('0x2')],'unique':_0xa7eb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa7eb('0x2')]},'timeout':{'type':Sequelize[_0xa7eb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa7eb('0x5')](_0xa7eb('0x6'),'beepall',_0xa7eb('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index abcb749..01aecde 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 _0x41e6=['addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','TeamId','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','end','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','get','ChatQueues','sendStatus','error','stack','name','send','index','map','fieldName','type','key','where','include','query','findAll','rows','catch','show','model','keys','ChatQueue','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','User','UserId','updatedAt','createdAt','format','%s/%s','chatPause','params','Team','getTeams'];(function(_0x3a48b7,_0x2c74d8){var _0x5c6680=function(_0x1c4e29){while(--_0x1c4e29){_0x3a48b7['push'](_0x3a48b7['shift']());}};_0x5c6680(++_0x2c74d8);}(_0x41e6,0x199));var _0x641e=function(_0x1acc2d,_0x1cfdac){_0x1acc2d=_0x1acc2d-0x0;var _0x1cc820=_0x41e6[_0x1acc2d];return _0x1cc820;};'use strict';var BPromise=require(_0x641e('0x0'));var util=require('util');var _=require(_0x641e('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x641e('0x2'));var logger=require(_0x641e('0x3'))(_0x641e('0x4'));var config=require(_0x641e('0x5'));var db=require(_0x641e('0x6'))['db'];config['redis']=_[_0x641e('0x7')](config[_0x641e('0x8')],{'host':_0x641e('0x9'),'port':0x18eb});var socket=require(_0x641e('0xa'))(new Redis(config[_0x641e('0x8')]));require(_0x641e('0xb'))[_0x641e('0xc')](socket);function respondWithStatusCode(_0x5a290a,_0x4ab63b){_0x4ab63b=_0x4ab63b||0xcc;return function(_0xe40eda){if(_0xe40eda){return _0x5a290a['sendStatus'](_0x4ab63b);}return _0x5a290a['status'](_0x4ab63b)[_0x641e('0xd')]();};}function respondWithResult(_0x3f7dcc,_0x53d183){_0x53d183=_0x53d183||0xc8;return function(_0x55cc7c){if(_0x55cc7c){return _0x3f7dcc[_0x641e('0xe')](_0x53d183)['json'](_0x55cc7c);}};}function respondWithFilteredResult(_0x3fb091,_0x39d109){return function(_0xd4b4bc){if(_0xd4b4bc){var _0xc04898=typeof _0x39d109[_0x641e('0xf')]===_0x641e('0x10')&&typeof _0x39d109[_0x641e('0x11')]==='undefined';var _0x1a3f4c=_0xd4b4bc['count'];var _0x4f8825=_0xc04898?0x0:_0x39d109[_0x641e('0xf')];var _0x5bffc5=_0xc04898?_0xd4b4bc[_0x641e('0x12')]:_0x39d109[_0x641e('0xf')]+_0x39d109[_0x641e('0x11')];var _0x252f2d;if(_0x5bffc5>=_0x1a3f4c){_0x5bffc5=_0x1a3f4c;_0x252f2d=0xc8;}else{_0x252f2d=0xce;}_0x3fb091['status'](_0x252f2d);return _0x3fb091[_0x641e('0x13')](_0x641e('0x14'),_0x4f8825+'-'+_0x5bffc5+'/'+_0x1a3f4c)[_0x641e('0x15')](_0xd4b4bc);}return null;};}function saveUpdates(_0x19640e){return function(_0x4394bc){if(_0x4394bc){return _0x4394bc['update'](_0x19640e)[_0x641e('0x16')](function(_0x4743c2){return _0x4743c2;});}return null;};}function removeEntity(_0x58bad2){return function(_0x44d7a7){if(_0x44d7a7){return _0x44d7a7[_0x641e('0x17')]()[_0x641e('0x16')](function(){var _0x4f3bdc=_0x44d7a7[_0x641e('0x18')]({'plain':!![]});var _0x7eab=_0x641e('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x7eab,'resourceId':_0x4f3bdc['id']}})[_0x641e('0x16')](function(){return _0x44d7a7;});})[_0x641e('0x16')](function(){_0x58bad2[_0x641e('0xe')](0xcc)[_0x641e('0xd')]();});}};}function handleEntityNotFound(_0x586d11){return function(_0x598e28){if(!_0x598e28){_0x586d11[_0x641e('0x1a')](0x194);}return _0x598e28;};}function handleError(_0x1ab37f,_0x34ecfb){_0x34ecfb=_0x34ecfb||0x1f4;return function(_0x6ec6e1){logger[_0x641e('0x1b')](_0x6ec6e1[_0x641e('0x1c')]);if(_0x6ec6e1[_0x641e('0x1d')]){delete _0x6ec6e1['name'];}_0x1ab37f[_0x641e('0xe')](_0x34ecfb)[_0x641e('0x1e')](_0x6ec6e1);};}exports[_0x641e('0x1f')]=function(_0x2b689c,_0x3bd7ab){var _0x276702={};var _0x3f6c8f={'count':0x0,'rows':[]};var _0x4c899b=_[_0x641e('0x20')](db['ChatQueue']['rawAttributes'],function(_0x4b5515){return{'name':_0x4b5515[_0x641e('0x21')],'type':_0x4b5515[_0x641e('0x22')][_0x641e('0x23')]};});_0x276702=qs['getOptions'](_0x4c899b,_0x2b689c);var _0x251e9e={'where':_0x276702[_0x641e('0x24')]};return db['ChatQueue']['count'](_0x251e9e)[_0x641e('0x16')](function(_0x5104e8){_0x3f6c8f[_0x641e('0x12')]=_0x5104e8;_0x276702[_0x641e('0x25')]=qs[_0x641e('0x25')](_0x2b689c[_0x641e('0x26')]);return db['ChatQueue'][_0x641e('0x27')](_0x276702);})[_0x641e('0x16')](function(_0x1238a7){_0x3f6c8f[_0x641e('0x28')]=_0x1238a7;return _0x3f6c8f;})[_0x641e('0x16')](respondWithFilteredResult(_0x3bd7ab,_0x276702))[_0x641e('0x29')](handleError(_0x3bd7ab,null));};exports[_0x641e('0x2a')]=function(_0x39438e,_0xbc42ae){var _0x3faf29={'raw':!![],'where':{'id':_0x39438e['params']['id']}},_0xf318d9={};_0xf318d9[_0x641e('0x2b')]=_[_0x641e('0x2c')](db[_0x641e('0x2d')][_0x641e('0x2e')]);_0xf318d9[_0x641e('0x26')]=_['keys'](_0x39438e['query']);_0xf318d9[_0x641e('0x2f')]=_[_0x641e('0x30')](_0xf318d9[_0x641e('0x2b')],_0xf318d9['query']);_0x3faf29['attributes']=_['intersection'](_0xf318d9[_0x641e('0x2b')],qs[_0x641e('0x31')](_0x39438e[_0x641e('0x26')][_0x641e('0x31')]));_0x3faf29['attributes']=_0x3faf29[_0x641e('0x32')][_0x641e('0x33')]?_0x3faf29[_0x641e('0x32')]:_0xf318d9[_0x641e('0x2b')];if(_0x39438e[_0x641e('0x26')][_0x641e('0x34')]){_0x3faf29[_0x641e('0x25')]=[{'all':!![]}];}_0x3faf29=_[_0x641e('0x35')]({},_0x3faf29,_0x39438e[_0x641e('0x36')]);return db[_0x641e('0x2d')][_0x641e('0x37')](_0x3faf29)[_0x641e('0x16')](handleEntityNotFound(_0xbc42ae,null))[_0x641e('0x16')](respondWithResult(_0xbc42ae,null))[_0x641e('0x29')](handleError(_0xbc42ae,null));};exports[_0x641e('0x38')]=function(_0x13cc3a,_0x22ad08){return db[_0x641e('0x2d')][_0x641e('0x38')](_0x13cc3a[_0x641e('0x39')],{})[_0x641e('0x16')](function(_0x5b1f94){var _0x39d9f3=_0x13cc3a[_0x641e('0x3a')]['get']({'plain':!![]});if(!_0x39d9f3)throw new Error(_0x641e('0x3b'));if(_0x39d9f3[_0x641e('0x3c')]===_0x641e('0x3a')){var _0x5b7760=_0x5b1f94['get']({'plain':!![]});var _0x20caa5=_0x641e('0x19');return db[_0x641e('0x3d')][_0x641e('0x37')]({'where':{'name':_0x20caa5,'userProfileId':_0x39d9f3[_0x641e('0x3e')]},'raw':!![]})[_0x641e('0x16')](function(_0xa4b1df){if(_0xa4b1df&&_0xa4b1df[_0x641e('0x3f')]===0x0){return db[_0x641e('0x40')][_0x641e('0x38')]({'name':_0x5b7760['name'],'resourceId':_0x5b7760['id'],'type':_0xa4b1df['name'],'sectionId':_0xa4b1df['id']},{})[_0x641e('0x16')](function(){return _0x5b1f94;});}else{return _0x5b1f94;}})['catch'](function(_0x3a2a77){logger[_0x641e('0x1b')](_0x641e('0x41'),_0x3a2a77);throw _0x3a2a77;});}return _0x5b1f94;})[_0x641e('0x16')](respondWithResult(_0x22ad08,0xc9))[_0x641e('0x29')](handleError(_0x22ad08,null));};exports['update']=function(_0x51086a,_0x48dd43){if(_0x51086a[_0x641e('0x39')]['id']){delete _0x51086a[_0x641e('0x39')]['id'];}return db[_0x641e('0x2d')][_0x641e('0x37')]({'where':{'id':_0x51086a['params']['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x48dd43,null))[_0x641e('0x16')](saveUpdates(_0x51086a['body'],null))[_0x641e('0x16')](respondWithResult(_0x48dd43,null))['catch'](handleError(_0x48dd43,null));};exports['destroy']=function(_0x40e7e3,_0x211e6b){return db['ChatQueue']['find']({'where':{'id':_0x40e7e3['params']['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x211e6b,null))[_0x641e('0x16')](removeEntity(_0x211e6b,null))[_0x641e('0x29')](handleError(_0x211e6b,null));};exports[_0x641e('0x42')]=function(_0x5399b4,_0x8b0229){return db[_0x641e('0x2d')][_0x641e('0x42')]()[_0x641e('0x16')](respondWithResult(_0x8b0229,null))[_0x641e('0x29')](handleError(_0x8b0229,null));};exports[_0x641e('0x43')]=function(_0x403e82,_0x40ee18){var _0x2ed109={'raw':!![],'where':{}},_0x57aaa0={},_0x20763b;return db['ChatQueue'][_0x641e('0x44')]({'where':{'id':_0x403e82['params']['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x40ee18,null))['then'](function(_0x14548e){if(_0x14548e){_0x20763b=_0x14548e[_0x641e('0x18')]({'plain':!![]});_0x57aaa0['model']=_['keys'](db[_0x641e('0x45')][_0x641e('0x2e')]);_0x57aaa0['query']=_['keys'](_0x403e82['query']);_0x57aaa0['filters']=_[_0x641e('0x30')](_0x57aaa0['model'],_0x57aaa0[_0x641e('0x26')]);_0x2ed109['attributes']=_[_0x641e('0x30')](_0x57aaa0[_0x641e('0x2b')],qs['fields'](_0x403e82[_0x641e('0x26')][_0x641e('0x31')]));_0x2ed109['attributes']=_0x2ed109['attributes']['length']?_0x2ed109['attributes']:_0x57aaa0[_0x641e('0x2b')];if(!_0x403e82['query'][_0x641e('0x46')](_0x641e('0x47'))){_0x2ed109[_0x641e('0x11')]=qs['limit'](_0x403e82[_0x641e('0x26')][_0x641e('0x11')]);_0x2ed109['offset']=qs[_0x641e('0xf')](_0x403e82[_0x641e('0x26')]['offset']);}_0x2ed109[_0x641e('0x48')]=qs[_0x641e('0x49')](_0x403e82[_0x641e('0x26')][_0x641e('0x49')]);_0x2ed109[_0x641e('0x24')]=qs['filters'](_[_0x641e('0x4a')](_0x403e82[_0x641e('0x26')],_0x57aaa0['filters']));_0x2ed109[_0x641e('0x24')][_0x641e('0x4b')]=_0x14548e['id'];if(_0x403e82[_0x641e('0x26')]['filter']){_0x2ed109[_0x641e('0x24')]=_[_0x641e('0x35')](_0x2ed109[_0x641e('0x24')],{'$or':_['map'](_0x2ed109[_0x641e('0x32')],function(_0x4e41d8){var _0x25924b={};_0x25924b[_0x4e41d8]={'$like':'%'+_0x403e82['query'][_0x641e('0x4c')]+'%'};return _0x25924b;})});}_0x2ed109=_[_0x641e('0x35')]({},_0x2ed109,_0x403e82[_0x641e('0x36')]);return db['UserChatQueue'][_0x641e('0x27')](_0x2ed109);}})['then'](function(_0x25870c){if(_0x25870c){return db[_0x641e('0x4d')]['findAndCountAll']({'where':{'id':_['map'](_0x25870c,_0x641e('0x4e')),'role':'agent'},'attributes':['id',_0x641e('0x1d'),'chatPause',_0x641e('0x4f'),_0x641e('0x50')]});}})['then'](function(_0x199e23){if(_0x199e23){return{'count':_0x199e23[_0x641e('0x12')],'rows':_['map'](_0x199e23[_0x641e('0x28')],function(_0x58600a){return{'membername':_0x58600a[_0x641e('0x1d')],'UserId':_0x58600a['id'],'queue_name':_0x20763b[_0x641e('0x1d')],'ChatQueueId':_0x20763b['id'],'interface':util[_0x641e('0x51')](_0x641e('0x52'),'SIP',_0x58600a[_0x641e('0x1d')]),'penalty':0x0,'paused':_0x58600a[_0x641e('0x53')],'createdAt':_0x58600a['createdAt'],'updatedAt':_0x58600a[_0x641e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x641e('0x16')](respondWithFilteredResult(_0x40ee18,_0x2ed109))[_0x641e('0x29')](handleError(_0x40ee18,null));};exports['getTeams']=function(_0x4cbb4f,_0x283c76){var _0x560239={};var _0x1b59b8={};var _0x5de5c3;var _0x5815c5;return db[_0x641e('0x2d')]['findOne']({'where':{'id':_0x4cbb4f[_0x641e('0x54')]['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x283c76,null))[_0x641e('0x16')](function(_0x1139c8){if(_0x1139c8){_0x5de5c3=_0x1139c8;_0x1b59b8[_0x641e('0x2b')]=_[_0x641e('0x2c')](db[_0x641e('0x55')][_0x641e('0x2e')]);_0x1b59b8[_0x641e('0x26')]=_[_0x641e('0x2c')](_0x4cbb4f[_0x641e('0x26')]);_0x1b59b8[_0x641e('0x2f')]=_['intersection'](_0x1b59b8[_0x641e('0x2b')],_0x1b59b8[_0x641e('0x26')]);_0x560239[_0x641e('0x32')]=_['intersection'](_0x1b59b8[_0x641e('0x2b')],qs[_0x641e('0x31')](_0x4cbb4f[_0x641e('0x26')][_0x641e('0x31')]));_0x560239[_0x641e('0x32')]=_0x560239[_0x641e('0x32')][_0x641e('0x33')]?_0x560239[_0x641e('0x32')]:_0x1b59b8[_0x641e('0x2b')];_0x560239['order']=qs[_0x641e('0x49')](_0x4cbb4f[_0x641e('0x26')][_0x641e('0x49')]);_0x560239[_0x641e('0x24')]=qs[_0x641e('0x2f')](_['pick'](_0x4cbb4f[_0x641e('0x26')],_0x1b59b8[_0x641e('0x2f')]));if(_0x4cbb4f[_0x641e('0x26')][_0x641e('0x4c')]){_0x560239['where']=_[_0x641e('0x35')](_0x560239[_0x641e('0x24')],{'$or':_[_0x641e('0x20')](_0x560239[_0x641e('0x32')],function(_0x3b4945){var _0x58ca55={};_0x58ca55[_0x3b4945]={'$like':'%'+_0x4cbb4f[_0x641e('0x26')]['filter']+'%'};return _0x58ca55;})});}_0x560239=_[_0x641e('0x35')]({},_0x560239,_0x4cbb4f[_0x641e('0x36')]);return _0x5de5c3[_0x641e('0x56')](_0x560239);}})[_0x641e('0x16')](function(_0x2ad335){if(_0x2ad335){_0x5815c5=_0x2ad335[_0x641e('0x33')];if(!_0x4cbb4f['query']['hasOwnProperty'](_0x641e('0x47'))){_0x560239[_0x641e('0x11')]=qs[_0x641e('0x11')](_0x4cbb4f[_0x641e('0x26')]['limit']);_0x560239[_0x641e('0xf')]=qs['offset'](_0x4cbb4f[_0x641e('0x26')][_0x641e('0xf')]);}return _0x5de5c3['getTeams'](_0x560239);}})[_0x641e('0x16')](function(_0x1ed5c7){if(_0x1ed5c7){return _0x1ed5c7?{'count':_0x5815c5,'rows':_0x1ed5c7}:null;}})[_0x641e('0x16')](respondWithResult(_0x283c76,null))['catch'](handleError(_0x283c76,null));};exports[_0x641e('0x57')]=function(_0x23fa40,_0x8e25b){var _0x2de13a=_0x23fa40['body'][_0x641e('0x58')];return db['Team'][_0x641e('0x27')]({'where':{'id':_0x2de13a},'attributes':['id'],'include':[{'model':db[_0x641e('0x4d')],'as':_0x641e('0x59'),'attributes':['id',_0x641e('0x1d'),'online',_0x641e('0x5a'),_0x641e('0x5b')],'raw':!![]}]})['then'](function(_0x4d7466){if(_0x4d7466){var _0x4ad15b=_[_0x641e('0x5c')](_0x4d7466,function(_0x5b0644){var _0x24da97=_0x5b0644[_0x641e('0x18')]({'plain':!![]});return _0x24da97[_0x641e('0x59')];});return db[_0x641e('0x2d')][_0x641e('0x37')]({'where':{'id':_0x23fa40[_0x641e('0x54')]['id']}})[_0x641e('0x16')](function(_0x5a45b1){return db[_0x641e('0x5d')][_0x641e('0x5e')](function(_0x3f0ac4){return _0x5a45b1[_0x641e('0x57')](_0x2de13a,{'transaction':_0x3f0ac4})['then'](function(){return BPromise[_0x641e('0x5f')](_0x4ad15b,function(_0x2ea7e8){return db[_0x641e('0x45')][_0x641e('0x60')]({'where':{'UserId':_0x2ea7e8['id'],'ChatQueueId':_0x23fa40[_0x641e('0x54')]['id']},'transaction':_0x3f0ac4});});})[_0x641e('0x16')](function(){_0x4ad15b[_0x641e('0x61')](function(_0x2f6f0a){socket['emit'](_0x641e('0x62'),{'UserId':_0x2f6f0a['id'],'ChatQueueId':_0x5a45b1['id']});});});});});}})[_0x641e('0x16')](respondWithStatusCode(_0x8e25b,null))[_0x641e('0x29')](handleError(_0x8e25b,null));};exports[_0x641e('0x63')]=function(_0x4a77a3,_0x30bcf9){return db[_0x641e('0x55')][_0x641e('0x27')]({'where':{'id':_0x4a77a3[_0x641e('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x641e('0x16')](handleEntityNotFound(_0x30bcf9,null))[_0x641e('0x16')](function(_0x37ee14){var _0x3ebac1=_[_0x641e('0x20')](_0x37ee14,'id');var _0x4ecd6d=[];var _0xb6e915=[];var _0x684fe5=squel['select']();_0x684fe5[_0x641e('0x64')](_0x641e('0x65'))[_0x641e('0x66')](_0x641e('0x67'),'tq')[_0x641e('0x68')](_0x641e('0x69'),'ut',_0x641e('0x6a'))[_0x641e('0x24')](_0x641e('0x6b'),_0x4a77a3['params']['id']);for(var _0x52765b=0x0;_0x52765b<_0x37ee14[_0x641e('0x33')];_0x52765b+=0x1){let _0x27690e=_0x37ee14[_0x52765b];for(var _0x530957=0x0;_0x530957<_0x27690e[_0x641e('0x59')][_0x641e('0x33')];_0x530957+=0x1){let _0x5be4ad=_0x27690e[_0x641e('0x59')][_0x530957];var _0x5773a9=_0x684fe5[_0x641e('0x6c')]();_0x5773a9[_0x641e('0x24')]('ut.UserId\x20=\x20?',_0x5be4ad['id']);_0xb6e915[_0x641e('0x6d')](db[_0x641e('0x5d')][_0x641e('0x26')](_0x5773a9[_0x641e('0x6e')](),{'type':db['sequelize'][_0x641e('0x6f')]['SELECT']})['then'](function(_0x3cf7a2){if(_0x3cf7a2['length']===0x1){return _0x5be4ad['id'];}else{var _0x16b6c1=_['every'](_['map'](_0x3cf7a2,_0x641e('0x70')),function(_0x43ba73){return _['includes'](_0x3ebac1,_0x43ba73);});if(_0x16b6c1){return _0x5be4ad['id'];}}}));}}return BPromise['all'](_0xb6e915)[_0x641e('0x16')](function(_0x54b2d4){_0x4ecd6d=_(_0x4ecd6d)[_0x641e('0x71')](_0x54b2d4)['compact']()[_0x641e('0x72')]();return db['ChatQueue'][_0x641e('0x37')]({'where':{'id':_0x4a77a3[_0x641e('0x54')]['id']}})[_0x641e('0x16')](function(_0x3bb47e){return db[_0x641e('0x5d')][_0x641e('0x5e')](function(_0x212cdb){return _0x3bb47e[_0x641e('0x63')](_0x4a77a3['query'][_0x641e('0x58')],{'transaction':_0x212cdb})[_0x641e('0x16')](function(){if(!_[_0x641e('0x73')](_0x4ecd6d)){return _0x3bb47e[_0x641e('0x74')](_0x4ecd6d,{'transaction':_0x212cdb});}})['then'](function(){_0x4ecd6d[_0x641e('0x61')](function(_0x4c530c){socket[_0x641e('0x75')](_0x641e('0x76'),{'UserId':_0x4c530c,'ChatQueueId':_0x3bb47e['id']});});});});});});})[_0x641e('0x16')](respondWithStatusCode(_0x30bcf9,null))[_0x641e('0x29')](handleError(_0x30bcf9,null));};exports[_0x641e('0x77')]=function(_0x4ae860,_0x1ea625){return db[_0x641e('0x2d')][_0x641e('0x37')]({'where':{'id':_0x4ae860[_0x641e('0x54')]['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x1ea625,null))[_0x641e('0x16')](function(_0x266df9){if(_0x266df9){return _0x266df9[_0x641e('0x77')](_0x4ae860['body']['ids'],_[_0x641e('0x78')](_0x4ae860[_0x641e('0x39')],['ids','id'])||{})[_0x641e('0x79')](function(_0x5f0ac0){for(var _0xe40bd6=0x0;_0xe40bd6<_0x4ae860['body'][_0x641e('0x58')][_0x641e('0x33')];_0xe40bd6+=0x1){socket['emit'](_0x641e('0x62'),{'UserId':Number(_0x4ae860[_0x641e('0x39')][_0x641e('0x58')][_0xe40bd6]),'ChatQueueId':Number(_0x4ae860['params']['id'])});}return _0x5f0ac0;});}})[_0x641e('0x16')](respondWithResult(_0x1ea625,null))[_0x641e('0x29')](handleError(_0x1ea625,null));};exports[_0x641e('0x74')]=function(_0x58bd2d,_0x58f6e4){return db[_0x641e('0x2d')][_0x641e('0x37')]({'where':{'id':_0x58bd2d[_0x641e('0x54')]['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x58f6e4,null))[_0x641e('0x16')](function(_0x25020f){if(_0x25020f){return _0x25020f[_0x641e('0x74')](_0x58bd2d['query']['ids'])[_0x641e('0x16')](function(){if(_[_0x641e('0x7a')](_0x58bd2d['query'][_0x641e('0x58')])){for(var _0x25fbfe=0x0;_0x25fbfe<_0x58bd2d[_0x641e('0x26')][_0x641e('0x58')][_0x641e('0x33')];_0x25fbfe+=0x1){socket[_0x641e('0x75')](_0x641e('0x76'),{'UserId':Number(_0x58bd2d[_0x641e('0x26')]['ids'][_0x25fbfe]),'ChatQueueId':Number(_0x58bd2d[_0x641e('0x54')]['id'])});}}else{socket['emit'](_0x641e('0x76'),{'UserId':Number(_0x58bd2d['query'][_0x641e('0x58')]),'ChatQueueId':Number(_0x58bd2d[_0x641e('0x54')]['id'])});}});}})[_0x641e('0x16')](respondWithStatusCode(_0x58f6e4,null))['catch'](handleError(_0x58f6e4,null));};exports[_0x641e('0x7b')]=function(_0x43582e,_0x185eae){var _0x181973={};var _0x3de5ad={};var _0x4ba526;var _0x2deb04;return db[_0x641e('0x2d')][_0x641e('0x44')]({'where':{'id':_0x43582e[_0x641e('0x54')]['id']}})[_0x641e('0x16')](handleEntityNotFound(_0x185eae,null))[_0x641e('0x16')](function(_0x10e65c){if(_0x10e65c){_0x4ba526=_0x10e65c;_0x3de5ad[_0x641e('0x2b')]=_[_0x641e('0x2c')](db['User'][_0x641e('0x2e')]);_0x3de5ad[_0x641e('0x26')]=_[_0x641e('0x2c')](_0x43582e[_0x641e('0x26')]);_0x3de5ad['filters']=_[_0x641e('0x30')](_0x3de5ad[_0x641e('0x2b')],_0x3de5ad['query']);_0x181973[_0x641e('0x32')]=_[_0x641e('0x30')](_0x3de5ad[_0x641e('0x2b')],qs[_0x641e('0x31')](_0x43582e[_0x641e('0x26')]['fields']));_0x181973['attributes']=_0x181973[_0x641e('0x32')]['length']?_0x181973[_0x641e('0x32')]:_0x3de5ad[_0x641e('0x2b')];_0x181973[_0x641e('0x48')]=qs[_0x641e('0x49')](_0x43582e[_0x641e('0x26')][_0x641e('0x49')]);_0x181973[_0x641e('0x24')]=qs['filters'](_[_0x641e('0x4a')](_0x43582e[_0x641e('0x26')],_0x3de5ad['filters']));if(_0x43582e[_0x641e('0x26')]['filter']){_0x181973[_0x641e('0x24')]=_[_0x641e('0x35')](_0x181973[_0x641e('0x24')],{'$or':_[_0x641e('0x20')](_0x181973['attributes'],function(_0x5c00bf){var _0x562ac7={};_0x562ac7[_0x5c00bf]={'$like':'%'+_0x43582e[_0x641e('0x26')]['filter']+'%'};return _0x562ac7;})});}_0x181973=_[_0x641e('0x35')]({},_0x181973,_0x43582e[_0x641e('0x36')]);return _0x4ba526[_0x641e('0x7b')](_0x181973);}})['then'](function(_0x5b4266){if(_0x5b4266){_0x2deb04=_0x5b4266[_0x641e('0x33')];if(!_0x43582e[_0x641e('0x26')][_0x641e('0x46')](_0x641e('0x47'))){_0x181973[_0x641e('0x11')]=qs[_0x641e('0x11')](_0x43582e['query'][_0x641e('0x11')]);_0x181973['offset']=qs[_0x641e('0xf')](_0x43582e[_0x641e('0x26')]['offset']);}return _0x4ba526[_0x641e('0x7b')](_0x181973);}})[_0x641e('0x16')](function(_0x235b0d){if(_0x235b0d){return _0x235b0d?{'count':_0x2deb04,'rows':_0x235b0d}:null;}})[_0x641e('0x16')](respondWithResult(_0x185eae,null))['catch'](handleError(_0x185eae,null));}; \ No newline at end of file +var _0x94a3=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','ChatQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','include','query','rows','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','hasOwnProperty','order','sort','ChatQueueId','filter','options','findAll','User','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','updatedAt','Team','pick','nolimit','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','union','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','squel','ioredis','../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x94a3,0x6e));var _0x394a=function(_0x40325a,_0x3901ba){_0x40325a=_0x40325a-0x0;var _0x1578a3=_0x94a3[_0x40325a];return _0x1578a3;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x394a('0x0'));var squel=require(_0x394a('0x1'));var Redis=require(_0x394a('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x394a('0x3'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x394a('0x4')]=_['defaults'](config[_0x394a('0x4')],{'host':_0x394a('0x5'),'port':0x18eb});var socket=require(_0x394a('0x6'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x481087,_0x2ecea7){_0x2ecea7=_0x2ecea7||0xcc;return function(_0x10a02f){if(_0x10a02f){return _0x481087[_0x394a('0x7')](_0x2ecea7);}return _0x481087[_0x394a('0x8')](_0x2ecea7)[_0x394a('0x9')]();};}function respondWithResult(_0x1d341c,_0x156a47){_0x156a47=_0x156a47||0xc8;return function(_0x315b5c){if(_0x315b5c){return _0x1d341c[_0x394a('0x8')](_0x156a47)[_0x394a('0xa')](_0x315b5c);}};}function respondWithFilteredResult(_0x5552bd,_0x2d1e5c){return function(_0x340e02){if(_0x340e02){var _0x4639ae=typeof _0x2d1e5c[_0x394a('0xb')]===_0x394a('0xc')&&typeof _0x2d1e5c[_0x394a('0xd')]===_0x394a('0xc');var _0x148e0e=_0x340e02[_0x394a('0xe')];var _0x583bca=_0x4639ae?0x0:_0x2d1e5c[_0x394a('0xb')];var _0x4c9eb9=_0x4639ae?_0x340e02[_0x394a('0xe')]:_0x2d1e5c[_0x394a('0xb')]+_0x2d1e5c[_0x394a('0xd')];var _0x1d58df;if(_0x4c9eb9>=_0x148e0e){_0x4c9eb9=_0x148e0e;_0x1d58df=0xc8;}else{_0x1d58df=0xce;}_0x5552bd['status'](_0x1d58df);return _0x5552bd[_0x394a('0xf')](_0x394a('0x10'),_0x583bca+'-'+_0x4c9eb9+'/'+_0x148e0e)[_0x394a('0xa')](_0x340e02);}return null;};}function saveUpdates(_0x46b4fa){return function(_0x365fd2){if(_0x365fd2){return _0x365fd2[_0x394a('0x11')](_0x46b4fa)[_0x394a('0x12')](function(_0x451692){return _0x451692;});}return null;};}function removeEntity(_0x2c5e30){return function(_0x2f4709){if(_0x2f4709){return _0x2f4709['destroy']()[_0x394a('0x12')](function(){var _0x6d43c2=_0x2f4709[_0x394a('0x13')]({'plain':!![]});var _0x1e8436=_0x394a('0x14');return db[_0x394a('0x15')][_0x394a('0x16')]({'where':{'type':_0x1e8436,'resourceId':_0x6d43c2['id']}})[_0x394a('0x12')](function(){return _0x2f4709;});})[_0x394a('0x12')](function(){_0x2c5e30[_0x394a('0x8')](0xcc)[_0x394a('0x9')]();});}};}function handleEntityNotFound(_0x142313){return function(_0x4f0c56){if(!_0x4f0c56){_0x142313['sendStatus'](0x194);}return _0x4f0c56;};}function handleError(_0x59e36e,_0x35edb6){_0x35edb6=_0x35edb6||0x1f4;return function(_0x3f6e51){logger[_0x394a('0x17')](_0x3f6e51[_0x394a('0x18')]);if(_0x3f6e51[_0x394a('0x19')]){delete _0x3f6e51[_0x394a('0x19')];}_0x59e36e[_0x394a('0x8')](_0x35edb6)[_0x394a('0x1a')](_0x3f6e51);};}exports[_0x394a('0x1b')]=function(_0x2a01ec,_0x5b7257){var _0x3dabbb={};var _0x163ac0={'count':0x0,'rows':[]};var _0x9586a7=_[_0x394a('0x1c')](db['ChatQueue'][_0x394a('0x1d')],function(_0x585720){return{'name':_0x585720[_0x394a('0x1e')],'type':_0x585720[_0x394a('0x1f')][_0x394a('0x20')]};});_0x3dabbb=qs[_0x394a('0x21')](_0x9586a7,_0x2a01ec);var _0x49f787={'where':_0x3dabbb[_0x394a('0x22')]};return db[_0x394a('0x23')][_0x394a('0xe')](_0x49f787)[_0x394a('0x12')](function(_0x1cceee){_0x163ac0[_0x394a('0xe')]=_0x1cceee;_0x3dabbb[_0x394a('0x24')]=qs[_0x394a('0x24')](_0x2a01ec[_0x394a('0x25')]);return db[_0x394a('0x23')]['findAll'](_0x3dabbb);})[_0x394a('0x12')](function(_0x3bf486){_0x163ac0[_0x394a('0x26')]=_0x3bf486;return _0x163ac0;})[_0x394a('0x12')](respondWithFilteredResult(_0x5b7257,_0x3dabbb))['catch'](handleError(_0x5b7257,null));};exports[_0x394a('0x27')]=function(_0x4a2da7,_0x2e491b){var _0x4ae28a={'raw':!![],'where':{'id':_0x4a2da7['params']['id']}},_0x26de76={};_0x26de76[_0x394a('0x28')]=_[_0x394a('0x29')](db[_0x394a('0x23')][_0x394a('0x1d')]);_0x26de76['query']=_['keys'](_0x4a2da7[_0x394a('0x25')]);_0x26de76[_0x394a('0x2a')]=_[_0x394a('0x2b')](_0x26de76[_0x394a('0x28')],_0x26de76[_0x394a('0x25')]);_0x4ae28a[_0x394a('0x2c')]=_[_0x394a('0x2b')](_0x26de76[_0x394a('0x28')],qs[_0x394a('0x2d')](_0x4a2da7[_0x394a('0x25')]['fields']));_0x4ae28a[_0x394a('0x2c')]=_0x4ae28a[_0x394a('0x2c')][_0x394a('0x2e')]?_0x4ae28a[_0x394a('0x2c')]:_0x26de76[_0x394a('0x28')];if(_0x4a2da7[_0x394a('0x25')][_0x394a('0x2f')]){_0x4ae28a[_0x394a('0x24')]=[{'all':!![]}];}_0x4ae28a=_[_0x394a('0x30')]({},_0x4ae28a,_0x4a2da7['options']);return db[_0x394a('0x23')]['find'](_0x4ae28a)[_0x394a('0x12')](handleEntityNotFound(_0x2e491b,null))['then'](respondWithResult(_0x2e491b,null))[_0x394a('0x31')](handleError(_0x2e491b,null));};exports[_0x394a('0x32')]=function(_0xb5cbfa,_0x4eac6e){return db[_0x394a('0x23')]['create'](_0xb5cbfa[_0x394a('0x33')],{})[_0x394a('0x12')](function(_0x368041){var _0x29c6cf=_0xb5cbfa['user']['get']({'plain':!![]});if(!_0x29c6cf)throw new Error(_0x394a('0x34'));if(_0x29c6cf[_0x394a('0x35')]===_0x394a('0x36')){var _0x41946c=_0x368041['get']({'plain':!![]});var _0x169b0d='ChatQueues';return db[_0x394a('0x37')][_0x394a('0x38')]({'where':{'name':_0x169b0d,'userProfileId':_0x29c6cf['userProfileId']},'raw':!![]})[_0x394a('0x12')](function(_0x5e33fb){if(_0x5e33fb&&_0x5e33fb[_0x394a('0x39')]===0x0){return db[_0x394a('0x15')]['create']({'name':_0x41946c[_0x394a('0x19')],'resourceId':_0x41946c['id'],'type':_0x5e33fb[_0x394a('0x19')],'sectionId':_0x5e33fb['id']},{})[_0x394a('0x12')](function(){return _0x368041;});}else{return _0x368041;}})['catch'](function(_0x4dcef1){logger['error'](_0x394a('0x3a'),_0x4dcef1);throw _0x4dcef1;});}return _0x368041;})['then'](respondWithResult(_0x4eac6e,0xc9))[_0x394a('0x31')](handleError(_0x4eac6e,null));};exports['update']=function(_0x545013,_0x48d502){if(_0x545013['body']['id']){delete _0x545013['body']['id'];}return db[_0x394a('0x23')][_0x394a('0x38')]({'where':{'id':_0x545013[_0x394a('0x3b')]['id']}})[_0x394a('0x12')](handleEntityNotFound(_0x48d502,null))['then'](saveUpdates(_0x545013['body'],null))[_0x394a('0x12')](respondWithResult(_0x48d502,null))['catch'](handleError(_0x48d502,null));};exports['destroy']=function(_0x58a64c,_0x7f851c){return db['ChatQueue'][_0x394a('0x38')]({'where':{'id':_0x58a64c[_0x394a('0x3b')]['id']}})[_0x394a('0x12')](handleEntityNotFound(_0x7f851c,null))['then'](removeEntity(_0x7f851c,null))[_0x394a('0x31')](handleError(_0x7f851c,null));};exports[_0x394a('0x3c')]=function(_0x294ed8,_0x1754e8){return db['ChatQueue']['describe']()[_0x394a('0x12')](respondWithResult(_0x1754e8,null))['catch'](handleError(_0x1754e8,null));};exports['getMembers']=function(_0x13fe6e,_0x4ab577){var _0x24f61d={'raw':!![],'where':{}},_0x37515e={},_0x6ca926;return db[_0x394a('0x23')][_0x394a('0x3d')]({'where':{'id':_0x13fe6e[_0x394a('0x3b')]['id']}})[_0x394a('0x12')](handleEntityNotFound(_0x4ab577,null))['then'](function(_0x2ddcf0){if(_0x2ddcf0){_0x6ca926=_0x2ddcf0['get']({'plain':!![]});_0x37515e[_0x394a('0x28')]=_['keys'](db[_0x394a('0x3e')]['rawAttributes']);_0x37515e[_0x394a('0x25')]=_['keys'](_0x13fe6e[_0x394a('0x25')]);_0x37515e[_0x394a('0x2a')]=_['intersection'](_0x37515e[_0x394a('0x28')],_0x37515e[_0x394a('0x25')]);_0x24f61d['attributes']=_['intersection'](_0x37515e[_0x394a('0x28')],qs[_0x394a('0x2d')](_0x13fe6e[_0x394a('0x25')][_0x394a('0x2d')]));_0x24f61d[_0x394a('0x2c')]=_0x24f61d[_0x394a('0x2c')][_0x394a('0x2e')]?_0x24f61d[_0x394a('0x2c')]:_0x37515e['model'];if(!_0x13fe6e['query'][_0x394a('0x3f')]('nolimit')){_0x24f61d[_0x394a('0xd')]=qs[_0x394a('0xd')](_0x13fe6e[_0x394a('0x25')][_0x394a('0xd')]);_0x24f61d['offset']=qs[_0x394a('0xb')](_0x13fe6e[_0x394a('0x25')][_0x394a('0xb')]);}_0x24f61d[_0x394a('0x40')]=qs[_0x394a('0x41')](_0x13fe6e[_0x394a('0x25')][_0x394a('0x41')]);_0x24f61d[_0x394a('0x22')]=qs[_0x394a('0x2a')](_['pick'](_0x13fe6e[_0x394a('0x25')],_0x37515e[_0x394a('0x2a')]));_0x24f61d[_0x394a('0x22')][_0x394a('0x42')]=_0x2ddcf0['id'];if(_0x13fe6e[_0x394a('0x25')][_0x394a('0x43')]){_0x24f61d[_0x394a('0x22')]=_[_0x394a('0x30')](_0x24f61d[_0x394a('0x22')],{'$or':_[_0x394a('0x1c')](_0x24f61d['attributes'],function(_0x18a8da){var _0x30a1e7={};_0x30a1e7[_0x18a8da]={'$like':'%'+_0x13fe6e[_0x394a('0x25')][_0x394a('0x43')]+'%'};return _0x30a1e7;})});}_0x24f61d=_[_0x394a('0x30')]({},_0x24f61d,_0x13fe6e[_0x394a('0x44')]);return db[_0x394a('0x3e')][_0x394a('0x45')](_0x24f61d);}})[_0x394a('0x12')](function(_0x1ce099){if(_0x1ce099){return db[_0x394a('0x46')][_0x394a('0x47')]({'where':{'id':_[_0x394a('0x1c')](_0x1ce099,_0x394a('0x48')),'role':_0x394a('0x49')},'attributes':['id','name',_0x394a('0x4a'),'updatedAt','createdAt']});}})[_0x394a('0x12')](function(_0x48dba2){if(_0x48dba2){return{'count':_0x48dba2['count'],'rows':_[_0x394a('0x1c')](_0x48dba2[_0x394a('0x26')],function(_0x3c69b8){return{'membername':_0x3c69b8[_0x394a('0x19')],'UserId':_0x3c69b8['id'],'queue_name':_0x6ca926[_0x394a('0x19')],'ChatQueueId':_0x6ca926['id'],'interface':util['format'](_0x394a('0x4b'),_0x394a('0x4c'),_0x3c69b8[_0x394a('0x19')]),'penalty':0x0,'paused':_0x3c69b8[_0x394a('0x4a')],'createdAt':_0x3c69b8['createdAt'],'updatedAt':_0x3c69b8[_0x394a('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x394a('0x12')](respondWithFilteredResult(_0x4ab577,_0x24f61d))[_0x394a('0x31')](handleError(_0x4ab577,null));};exports['getTeams']=function(_0x773a87,_0x1a0920){var _0xffe80c={};var _0x1a6b6c={};var _0x4ef0f1;var _0x16524e;return db[_0x394a('0x23')][_0x394a('0x3d')]({'where':{'id':_0x773a87['params']['id']}})[_0x394a('0x12')](handleEntityNotFound(_0x1a0920,null))['then'](function(_0x465ab0){if(_0x465ab0){_0x4ef0f1=_0x465ab0;_0x1a6b6c[_0x394a('0x28')]=_[_0x394a('0x29')](db[_0x394a('0x4e')][_0x394a('0x1d')]);_0x1a6b6c['query']=_[_0x394a('0x29')](_0x773a87[_0x394a('0x25')]);_0x1a6b6c['filters']=_[_0x394a('0x2b')](_0x1a6b6c['model'],_0x1a6b6c[_0x394a('0x25')]);_0xffe80c[_0x394a('0x2c')]=_[_0x394a('0x2b')](_0x1a6b6c[_0x394a('0x28')],qs[_0x394a('0x2d')](_0x773a87[_0x394a('0x25')]['fields']));_0xffe80c[_0x394a('0x2c')]=_0xffe80c[_0x394a('0x2c')][_0x394a('0x2e')]?_0xffe80c['attributes']:_0x1a6b6c[_0x394a('0x28')];_0xffe80c[_0x394a('0x40')]=qs[_0x394a('0x41')](_0x773a87[_0x394a('0x25')]['sort']);_0xffe80c[_0x394a('0x22')]=qs[_0x394a('0x2a')](_[_0x394a('0x4f')](_0x773a87[_0x394a('0x25')],_0x1a6b6c[_0x394a('0x2a')]));if(_0x773a87[_0x394a('0x25')][_0x394a('0x43')]){_0xffe80c[_0x394a('0x22')]=_['merge'](_0xffe80c['where'],{'$or':_[_0x394a('0x1c')](_0xffe80c[_0x394a('0x2c')],function(_0x4275fb){var _0x26bcbd={};_0x26bcbd[_0x4275fb]={'$like':'%'+_0x773a87[_0x394a('0x25')][_0x394a('0x43')]+'%'};return _0x26bcbd;})});}_0xffe80c=_[_0x394a('0x30')]({},_0xffe80c,_0x773a87[_0x394a('0x44')]);return _0x4ef0f1['getTeams'](_0xffe80c);}})[_0x394a('0x12')](function(_0x4a34a5){if(_0x4a34a5){_0x16524e=_0x4a34a5[_0x394a('0x2e')];if(!_0x773a87[_0x394a('0x25')][_0x394a('0x3f')](_0x394a('0x50'))){_0xffe80c['limit']=qs[_0x394a('0xd')](_0x773a87[_0x394a('0x25')][_0x394a('0xd')]);_0xffe80c[_0x394a('0xb')]=qs[_0x394a('0xb')](_0x773a87[_0x394a('0x25')][_0x394a('0xb')]);}return _0x4ef0f1['getTeams'](_0xffe80c);}})[_0x394a('0x12')](function(_0xc87dfa){if(_0xc87dfa){return _0xc87dfa?{'count':_0x16524e,'rows':_0xc87dfa}:null;}})[_0x394a('0x12')](respondWithResult(_0x1a0920,null))['catch'](handleError(_0x1a0920,null));};exports[_0x394a('0x51')]=function(_0x362a69,_0x492fbb){var _0x2a0739=_0x362a69['body'][_0x394a('0x52')];return db['Team'][_0x394a('0x45')]({'where':{'id':_0x2a0739},'attributes':['id'],'include':[{'model':db['User'],'as':_0x394a('0x53'),'attributes':['id',_0x394a('0x19'),_0x394a('0x54'),'voicePause',_0x394a('0x55')],'raw':!![]}]})['then'](function(_0x10c9ab){if(_0x10c9ab){var _0x16457d=_[_0x394a('0x56')](_0x10c9ab,function(_0x26bd5a){var _0xa6193=_0x26bd5a[_0x394a('0x13')]({'plain':!![]});return _0xa6193[_0x394a('0x53')];});return db[_0x394a('0x23')]['find']({'where':{'id':_0x362a69['params']['id']}})[_0x394a('0x12')](function(_0x2a65c9){return db['sequelize'][_0x394a('0x57')](function(_0x1e37e8){return _0x2a65c9[_0x394a('0x51')](_0x2a0739,{'transaction':_0x1e37e8})[_0x394a('0x12')](function(){return BPromise[_0x394a('0x58')](_0x16457d,function(_0x2ed9c2){return db[_0x394a('0x3e')][_0x394a('0x59')]({'where':{'UserId':_0x2ed9c2['id'],'ChatQueueId':_0x362a69[_0x394a('0x3b')]['id']},'transaction':_0x1e37e8});});})[_0x394a('0x12')](function(){_0x16457d['forEach'](function(_0x1a6d02){socket[_0x394a('0x5a')](_0x394a('0x5b'),{'UserId':_0x1a6d02['id'],'ChatQueueId':_0x2a65c9['id']});});});});});}})[_0x394a('0x12')](respondWithStatusCode(_0x492fbb,null))[_0x394a('0x31')](handleError(_0x492fbb,null));};exports[_0x394a('0x5c')]=function(_0x55d3c4,_0x2b85a4){return db['Team'][_0x394a('0x45')]({'where':{'id':_0x55d3c4[_0x394a('0x25')][_0x394a('0x52')]},'attributes':['id'],'include':[{'model':db[_0x394a('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2b85a4,null))[_0x394a('0x12')](function(_0x2ab6b3){var _0x73bdc=_[_0x394a('0x1c')](_0x2ab6b3,'id');var _0x519789=[];var _0x585d9c=[];var _0x5c4188=squel[_0x394a('0x5d')]();_0x5c4188[_0x394a('0x5e')](_0x394a('0x5f'))[_0x394a('0x60')](_0x394a('0x61'),'tq')[_0x394a('0x62')](_0x394a('0x63'),'ut',_0x394a('0x64'))[_0x394a('0x22')]('ChatQueueId\x20=\x20?',_0x55d3c4['params']['id']);for(var _0x43767f=0x0;_0x43767f<_0x2ab6b3['length'];_0x43767f+=0x1){let _0x7d7e41=_0x2ab6b3[_0x43767f];for(var _0x4d7cd9=0x0;_0x4d7cd9<_0x7d7e41[_0x394a('0x53')][_0x394a('0x2e')];_0x4d7cd9+=0x1){let _0x31dca1=_0x7d7e41[_0x394a('0x53')][_0x4d7cd9];var _0x11bb7e=_0x5c4188['clone']();_0x11bb7e[_0x394a('0x22')](_0x394a('0x65'),_0x31dca1['id']);_0x585d9c[_0x394a('0x66')](db['sequelize'][_0x394a('0x25')](_0x11bb7e[_0x394a('0x67')](),{'type':db[_0x394a('0x68')]['QueryTypes'][_0x394a('0x69')]})[_0x394a('0x12')](function(_0x1a4080){if(_0x1a4080[_0x394a('0x2e')]===0x1){return _0x31dca1['id'];}else{var _0x26e9a5=_[_0x394a('0x6a')](_[_0x394a('0x1c')](_0x1a4080,_0x394a('0x6b')),function(_0x193d96){return _['includes'](_0x73bdc,_0x193d96);});if(_0x26e9a5){return _0x31dca1['id'];}}}));}}return BPromise['all'](_0x585d9c)[_0x394a('0x12')](function(_0x11c397){_0x519789=_(_0x519789)[_0x394a('0x6c')](_0x11c397)['compact']()[_0x394a('0x6d')]();return db[_0x394a('0x23')][_0x394a('0x38')]({'where':{'id':_0x55d3c4[_0x394a('0x3b')]['id']}})['then'](function(_0x4a760e){return db[_0x394a('0x68')][_0x394a('0x57')](function(_0x298faa){return _0x4a760e[_0x394a('0x5c')](_0x55d3c4[_0x394a('0x25')][_0x394a('0x52')],{'transaction':_0x298faa})[_0x394a('0x12')](function(){if(!_['isEmpty'](_0x519789)){return _0x4a760e[_0x394a('0x6e')](_0x519789,{'transaction':_0x298faa});}})['then'](function(){_0x519789['forEach'](function(_0x4cfae6){socket[_0x394a('0x5a')](_0x394a('0x6f'),{'UserId':_0x4cfae6,'ChatQueueId':_0x4a760e['id']});});});});});});})[_0x394a('0x12')](respondWithStatusCode(_0x2b85a4,null))[_0x394a('0x31')](handleError(_0x2b85a4,null));};exports[_0x394a('0x70')]=function(_0x3156dc,_0x53292b){return db[_0x394a('0x23')][_0x394a('0x38')]({'where':{'id':_0x3156dc[_0x394a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x53292b,null))['then'](function(_0x5a6640){if(_0x5a6640){return _0x5a6640[_0x394a('0x70')](_0x3156dc[_0x394a('0x33')][_0x394a('0x52')],_[_0x394a('0x71')](_0x3156dc[_0x394a('0x33')],['ids','id'])||{})[_0x394a('0x72')](function(_0x1868fa){for(var _0x5376c7=0x0;_0x5376c7<_0x3156dc['body']['ids'][_0x394a('0x2e')];_0x5376c7+=0x1){socket[_0x394a('0x5a')]('userChatQueue:save',{'UserId':Number(_0x3156dc[_0x394a('0x33')][_0x394a('0x52')][_0x5376c7]),'ChatQueueId':Number(_0x3156dc[_0x394a('0x3b')]['id'])});}return _0x1868fa;});}})[_0x394a('0x12')](respondWithResult(_0x53292b,null))['catch'](handleError(_0x53292b,null));};exports[_0x394a('0x6e')]=function(_0x33e29b,_0x2d2c6d){return db[_0x394a('0x23')][_0x394a('0x38')]({'where':{'id':_0x33e29b[_0x394a('0x3b')]['id']}})[_0x394a('0x12')](handleEntityNotFound(_0x2d2c6d,null))[_0x394a('0x12')](function(_0x387005){if(_0x387005){return _0x387005[_0x394a('0x6e')](_0x33e29b[_0x394a('0x25')][_0x394a('0x52')])[_0x394a('0x12')](function(){if(_[_0x394a('0x73')](_0x33e29b[_0x394a('0x25')][_0x394a('0x52')])){for(var _0x16bc85=0x0;_0x16bc85<_0x33e29b[_0x394a('0x25')][_0x394a('0x52')][_0x394a('0x2e')];_0x16bc85+=0x1){socket[_0x394a('0x5a')]('userChatQueue:remove',{'UserId':Number(_0x33e29b[_0x394a('0x25')]['ids'][_0x16bc85]),'ChatQueueId':Number(_0x33e29b['params']['id'])});}}else{socket[_0x394a('0x5a')](_0x394a('0x6f'),{'UserId':Number(_0x33e29b['query'][_0x394a('0x52')]),'ChatQueueId':Number(_0x33e29b['params']['id'])});}});}})[_0x394a('0x12')](respondWithStatusCode(_0x2d2c6d,null))[_0x394a('0x31')](handleError(_0x2d2c6d,null));};exports[_0x394a('0x74')]=function(_0x56a63d,_0xc0d59b){var _0xcde607={};var _0x3d499c={};var _0x33c279;var _0x3b4334;return db[_0x394a('0x23')]['findOne']({'where':{'id':_0x56a63d[_0x394a('0x3b')]['id']}})[_0x394a('0x12')](handleEntityNotFound(_0xc0d59b,null))['then'](function(_0x1f2160){if(_0x1f2160){_0x33c279=_0x1f2160;_0x3d499c[_0x394a('0x28')]=_['keys'](db[_0x394a('0x46')][_0x394a('0x1d')]);_0x3d499c[_0x394a('0x25')]=_[_0x394a('0x29')](_0x56a63d['query']);_0x3d499c[_0x394a('0x2a')]=_[_0x394a('0x2b')](_0x3d499c[_0x394a('0x28')],_0x3d499c[_0x394a('0x25')]);_0xcde607['attributes']=_[_0x394a('0x2b')](_0x3d499c['model'],qs[_0x394a('0x2d')](_0x56a63d[_0x394a('0x25')][_0x394a('0x2d')]));_0xcde607['attributes']=_0xcde607['attributes'][_0x394a('0x2e')]?_0xcde607[_0x394a('0x2c')]:_0x3d499c[_0x394a('0x28')];_0xcde607[_0x394a('0x40')]=qs['sort'](_0x56a63d[_0x394a('0x25')][_0x394a('0x41')]);_0xcde607[_0x394a('0x22')]=qs[_0x394a('0x2a')](_[_0x394a('0x4f')](_0x56a63d[_0x394a('0x25')],_0x3d499c['filters']));if(_0x56a63d['query'][_0x394a('0x43')]){_0xcde607['where']=_['merge'](_0xcde607[_0x394a('0x22')],{'$or':_[_0x394a('0x1c')](_0xcde607[_0x394a('0x2c')],function(_0x587130){var _0x5a1d74={};_0x5a1d74[_0x587130]={'$like':'%'+_0x56a63d[_0x394a('0x25')][_0x394a('0x43')]+'%'};return _0x5a1d74;})});}_0xcde607=_[_0x394a('0x30')]({},_0xcde607,_0x56a63d[_0x394a('0x44')]);return _0x33c279[_0x394a('0x74')](_0xcde607);}})[_0x394a('0x12')](function(_0x28d447){if(_0x28d447){_0x3b4334=_0x28d447[_0x394a('0x2e')];if(!_0x56a63d[_0x394a('0x25')][_0x394a('0x3f')](_0x394a('0x50'))){_0xcde607['limit']=qs['limit'](_0x56a63d['query'][_0x394a('0xd')]);_0xcde607[_0x394a('0xb')]=qs['offset'](_0x56a63d[_0x394a('0x25')][_0x394a('0xb')]);}return _0x33c279[_0x394a('0x74')](_0xcde607);}})['then'](function(_0x55f028){if(_0x55f028){return _0x55f028?{'count':_0x3b4334,'rows':_0x55f028}:null;}})[_0x394a('0x12')](respondWithResult(_0xc0d59b,null))[_0x394a('0x31')](handleError(_0xc0d59b,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d0f6abf..5affbae 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 _0x560e=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x38a0b2,_0x5f2ac9){var _0x3acb97=function(_0x348927){while(--_0x348927){_0x38a0b2['push'](_0x38a0b2['shift']());}};_0x3acb97(++_0x5f2ac9);}(_0x560e,0x1cc));var _0xe560=function(_0x2b12d9,_0x37f8d4){_0x2b12d9=_0x2b12d9-0x0;var _0x4eb2bf=_0x560e[_0x2b12d9];return _0x4eb2bf;};'use strict';var EventEmitter=require(_0xe560('0x0'));var ChatQueue=require(_0xe560('0x1'))['db'][_0xe560('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe560('0x3')](0x0);var events={'afterCreate':_0xe560('0x4'),'afterUpdate':_0xe560('0x5'),'afterDestroy':_0xe560('0x6')};function emitEvent(_0x118ef4){return function(_0x33ecdb,_0x5ae2d7,_0x460a4e){ChatQueueEvents[_0xe560('0x7')](_0x118ef4+':'+_0x33ecdb['id'],_0x33ecdb);ChatQueueEvents[_0xe560('0x7')](_0x118ef4,_0x33ecdb);_0x460a4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xe560('0x8')](e,emitEvent(event));}}module[_0xe560('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x3a3d=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x24a31e,_0x2f6dd4){var _0x1de563=function(_0x5e8830){while(--_0x5e8830){_0x24a31e['push'](_0x24a31e['shift']());}};_0x1de563(++_0x2f6dd4);}(_0x3a3d,0x174));var _0xd3a3=function(_0x46d4d6,_0x134ae2){_0x46d4d6=_0x46d4d6-0x0;var _0x173a9b=_0x3a3d[_0x46d4d6];return _0x173a9b;};'use strict';var EventEmitter=require(_0xd3a3('0x0'));var ChatQueue=require(_0xd3a3('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd3a3('0x2')](0x0);var events={'afterCreate':_0xd3a3('0x3'),'afterUpdate':'update','afterDestroy':_0xd3a3('0x4')};function emitEvent(_0x4478df){return function(_0x3e9396,_0x369eac,_0x3f1108){ChatQueueEvents[_0xd3a3('0x5')](_0x4478df+':'+_0x3e9396['id'],_0x3e9396);ChatQueueEvents['emit'](_0x4478df,_0x3e9396);_0x3f1108(null);};}for(var e in events){if(events[_0xd3a3('0x6')](e)){var event=events[e];ChatQueue[_0xd3a3('0x7')](e,emitEvent(event));}}module[_0xd3a3('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2524dcd..c8200d9 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 _0xead6=['api','moment','path','../../config/environment','exports','define','ChatQueue','util'];(function(_0x226f4e,_0x1f66cc){var _0x24964f=function(_0x4e6cdf){while(--_0x4e6cdf){_0x226f4e['push'](_0x226f4e['shift']());}};_0x24964f(++_0x1f66cc);}(_0xead6,0x18f));var _0x6ead=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xead6[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x6ead('0x0'));var logger=require('../../config/logger')(_0x6ead('0x1'));var moment=require(_0x6ead('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ead('0x3'));var rimraf=require('rimraf');var config=require(_0x6ead('0x4'));var attributes=require('./chatQueue.attributes');module[_0x6ead('0x5')]=function(_0x5165b0,_0x49c4ca){return _0x5165b0[_0x6ead('0x6')](_0x6ead('0x7'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2aa=['api','moment','bluebird','request-promise','./chatQueue.attributes','exports','ChatQueue','util','../../config/logger'];(function(_0xec74ca,_0x1902ab){var _0xa3c13c=function(_0x490d46){while(--_0x490d46){_0xec74ca['push'](_0xec74ca['shift']());}};_0xa3c13c(++_0x1902ab);}(_0xb2aa,0x16f));var _0xab2a=function(_0x30bff2,_0xf29349){_0x30bff2=_0x30bff2-0x0;var _0x8bdfe2=_0xb2aa[_0x30bff2];return _0x8bdfe2;};'use strict';var _=require('lodash');var util=require(_0xab2a('0x0'));var logger=require(_0xab2a('0x1'))(_0xab2a('0x2'));var moment=require(_0xab2a('0x3'));var BPromise=require(_0xab2a('0x4'));var rp=require(_0xab2a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab2a('0x6'));module[_0xab2a('0x7')]=function(_0x55bb2d,_0x551931){return _0x55bb2d['define'](_0xab2a('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 2361755..f8145e8 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 _0x6eb2=['error','code','message','ChatQueue,\x20%s,\x20%s','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowChatQueue','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1755f9,_0x176a42){var _0x322247=function(_0x3eeb6d){while(--_0x3eeb6d){_0x1755f9['push'](_0x1755f9['shift']());}};_0x322247(++_0x176a42);}(_0x6eb2,0x10a));var _0x26eb=function(_0x179b80,_0x440291){_0x179b80=_0x179b80-0x0;var _0x1e8d03=_0x6eb2[_0x179b80];return _0x1e8d03;};'use strict';var _=require(_0x26eb('0x0'));var util=require('util');var moment=require(_0x26eb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26eb('0x2'));var db=require(_0x26eb('0x3'))['db'];var utils=require(_0x26eb('0x4'));var logger=require(_0x26eb('0x5'))(_0x26eb('0x6'));var config=require(_0x26eb('0x7'));var jayson=require(_0x26eb('0x8'));var client=jayson['client'][_0x26eb('0x9')]({'port':0x232a});config[_0x26eb('0xa')]=_[_0x26eb('0xb')](config[_0x26eb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x26eb('0xc'))(new Redis(config['redis']));require(_0x26eb('0xd'))[_0x26eb('0xe')](socket);function respondWithRpcPromise(_0x57577b,_0x3d010f,_0x352e01){return new BPromise(function(_0x14d022,_0x5db75f){return client[_0x26eb('0xf')](_0x57577b,_0x352e01)[_0x26eb('0x10')](function(_0x26ead1){logger['info']('ChatQueue,\x20%s,\x20%s',_0x3d010f,'request\x20sent');logger[_0x26eb('0x11')](_0x26eb('0x12'),_0x3d010f,_0x26eb('0x13'),JSON[_0x26eb('0x14')](_0x26ead1));if(_0x26ead1[_0x26eb('0x15')]){if(_0x26ead1[_0x26eb('0x15')][_0x26eb('0x16')]===0x1f4){logger[_0x26eb('0x15')]('ChatQueue,\x20%s,\x20%s',_0x3d010f,_0x26ead1[_0x26eb('0x15')][_0x26eb('0x17')]);return _0x5db75f(_0x26ead1[_0x26eb('0x15')]['message']);}logger[_0x26eb('0x15')](_0x26eb('0x18'),_0x3d010f,_0x26ead1[_0x26eb('0x15')][_0x26eb('0x17')]);return _0x14d022(_0x26ead1[_0x26eb('0x15')][_0x26eb('0x17')]);}else{logger[_0x26eb('0x19')]('ChatQueue,\x20%s,\x20%s',_0x3d010f,'request\x20sent');_0x14d022(_0x26ead1[_0x26eb('0x1a')]['message']);}})[_0x26eb('0x1b')](function(_0x34d66c){logger['error'](_0x26eb('0x18'),_0x3d010f,_0x34d66c);_0x5db75f(_0x34d66c);});});}exports[_0x26eb('0x1c')]=function(_0x3522c2){var _0x5bc8f9=this;return new Promise(function(_0x185dff,_0x3eb486){return db[_0x26eb('0x1d')][_0x26eb('0x1e')]({'raw':_0x3522c2['options']?_0x3522c2[_0x26eb('0x1f')][_0x26eb('0x20')]===undefined?!![]:![]:!![],'where':_0x3522c2[_0x26eb('0x1f')]?_0x3522c2[_0x26eb('0x1f')]['where']||null:null,'attributes':_0x3522c2[_0x26eb('0x1f')]?_0x3522c2[_0x26eb('0x1f')][_0x26eb('0x21')]||null:null,'limit':_0x3522c2[_0x26eb('0x1f')]?_0x3522c2[_0x26eb('0x1f')][_0x26eb('0x22')]||null:null,'include':_0x3522c2[_0x26eb('0x1f')]?_0x3522c2[_0x26eb('0x1f')][_0x26eb('0x23')]?_[_0x26eb('0x24')](_0x3522c2[_0x26eb('0x1f')]['include'],function(_0xa93eaf){return{'model':db[_0xa93eaf['model']],'as':_0xa93eaf['as'],'attributes':_0xa93eaf[_0x26eb('0x21')],'include':_0xa93eaf[_0x26eb('0x23')]?_['map'](_0xa93eaf[_0x26eb('0x23')],function(_0x457c8f){return{'model':db[_0x457c8f[_0x26eb('0x25')]],'as':_0x457c8f['as'],'attributes':_0x457c8f[_0x26eb('0x21')],'include':_0x457c8f[_0x26eb('0x23')]?_[_0x26eb('0x24')](_0x457c8f[_0x26eb('0x23')],function(_0x4925f0){return{'model':db[_0x4925f0[_0x26eb('0x25')]],'as':_0x4925f0['as'],'attributes':_0x4925f0['attributes']};}):[]};}):[]};}):[]:[]})[_0x26eb('0x10')](function(_0x52473d){logger[_0x26eb('0x19')](_0x26eb('0x1c'),_0x3522c2);logger[_0x26eb('0x11')](_0x26eb('0x1c'),_0x3522c2,JSON[_0x26eb('0x14')](_0x52473d));_0x185dff(_0x52473d);})[_0x26eb('0x1b')](function(_0x4e58a6){logger[_0x26eb('0x15')](_0x26eb('0x1c'),_0x4e58a6[_0x26eb('0x17')],_0x3522c2);_0x3eb486(_0x5bc8f9[_0x26eb('0x15')](0x1f4,_0x4e58a6[_0x26eb('0x17')]));});});};exports['ShowChatQueue']=function(_0x4ad2d2){var _0x2a94dc=this;return new Promise(function(_0x1842e5,_0x5eeb9b){return db[_0x26eb('0x1d')][_0x26eb('0x26')]({'raw':_0x4ad2d2['options']?_0x4ad2d2['options'][_0x26eb('0x20')]===undefined?!![]:![]:!![],'where':_0x4ad2d2['options']?_0x4ad2d2[_0x26eb('0x1f')][_0x26eb('0x27')]||null:null,'attributes':_0x4ad2d2[_0x26eb('0x1f')]?_0x4ad2d2[_0x26eb('0x1f')]['attributes']||null:null,'include':_0x4ad2d2[_0x26eb('0x1f')]?_0x4ad2d2[_0x26eb('0x1f')][_0x26eb('0x23')]?_['map'](_0x4ad2d2[_0x26eb('0x1f')][_0x26eb('0x23')],function(_0x22e1f8){return{'model':db[_0x22e1f8['model']],'as':_0x22e1f8['as'],'attributes':_0x22e1f8[_0x26eb('0x21')],'include':_0x22e1f8['include']?_[_0x26eb('0x24')](_0x22e1f8[_0x26eb('0x23')],function(_0x381b21){return{'model':db[_0x381b21[_0x26eb('0x25')]],'as':_0x381b21['as'],'attributes':_0x381b21[_0x26eb('0x21')],'include':_0x381b21['include']?_[_0x26eb('0x24')](_0x381b21['include'],function(_0x2e61fe){return{'model':db[_0x2e61fe['model']],'as':_0x2e61fe['as'],'attributes':_0x2e61fe[_0x26eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x26eb('0x10')](function(_0x57c4e0){logger[_0x26eb('0x19')](_0x26eb('0x28'),_0x4ad2d2);logger[_0x26eb('0x11')]('ShowChatQueue',_0x4ad2d2,JSON['stringify'](_0x57c4e0));_0x1842e5(_0x57c4e0);})[_0x26eb('0x1b')](function(_0xa05cca){logger[_0x26eb('0x15')](_0x26eb('0x28'),_0xa05cca[_0x26eb('0x17')],_0x4ad2d2);_0x5eeb9b(_0x2a94dc[_0x26eb('0x15')](0x1f4,_0xa05cca[_0x26eb('0x17')]));});});}; \ No newline at end of file +var _0x2cb0=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2cb0,0x12c));var _0x02cb=function(_0x2880a9,_0x9d6d4a){_0x2880a9=_0x2880a9-0x0;var _0x5360f6=_0x2cb0[_0x2880a9];return _0x5360f6;};'use strict';var _=require(_0x02cb('0x0'));var util=require(_0x02cb('0x1'));var moment=require('moment');var BPromise=require(_0x02cb('0x2'));var rs=require(_0x02cb('0x3'));var fs=require('fs');var Redis=require(_0x02cb('0x4'));var db=require(_0x02cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x02cb('0x6'))(_0x02cb('0x7'));var config=require(_0x02cb('0x8'));var jayson=require(_0x02cb('0x9'));var client=jayson[_0x02cb('0xa')][_0x02cb('0xb')]({'port':0x232a});config[_0x02cb('0xc')]=_[_0x02cb('0xd')](config['redis'],{'host':_0x02cb('0xe'),'port':0x18eb});var socket=require(_0x02cb('0xf'))(new Redis(config[_0x02cb('0xc')]));require(_0x02cb('0x10'))[_0x02cb('0x11')](socket);function respondWithRpcPromise(_0x5a1efb,_0x1735c8,_0x847342){return new BPromise(function(_0x2787a7,_0x59511e){return client[_0x02cb('0x12')](_0x5a1efb,_0x847342)[_0x02cb('0x13')](function(_0x26b7d4){logger[_0x02cb('0x14')]('ChatQueue,\x20%s,\x20%s',_0x1735c8,_0x02cb('0x15'));logger[_0x02cb('0x16')](_0x02cb('0x17'),_0x1735c8,_0x02cb('0x15'),JSON[_0x02cb('0x18')](_0x26b7d4));if(_0x26b7d4[_0x02cb('0x19')]){if(_0x26b7d4['error'][_0x02cb('0x1a')]===0x1f4){logger[_0x02cb('0x19')](_0x02cb('0x1b'),_0x1735c8,_0x26b7d4['error'][_0x02cb('0x1c')]);return _0x59511e(_0x26b7d4[_0x02cb('0x19')][_0x02cb('0x1c')]);}logger[_0x02cb('0x19')](_0x02cb('0x1b'),_0x1735c8,_0x26b7d4['error']['message']);return _0x2787a7(_0x26b7d4[_0x02cb('0x19')][_0x02cb('0x1c')]);}else{logger[_0x02cb('0x14')](_0x02cb('0x1b'),_0x1735c8,'request\x20sent');_0x2787a7(_0x26b7d4[_0x02cb('0x1d')]['message']);}})[_0x02cb('0x1e')](function(_0x4cbb03){logger[_0x02cb('0x19')](_0x02cb('0x1b'),_0x1735c8,_0x4cbb03);_0x59511e(_0x4cbb03);});});}exports[_0x02cb('0x1f')]=function(_0x5c4dbb){var _0x26ac13=this;return new Promise(function(_0x47c161,_0x426b1e){return db[_0x02cb('0x20')][_0x02cb('0x21')]({'raw':_0x5c4dbb[_0x02cb('0x22')]?_0x5c4dbb[_0x02cb('0x22')][_0x02cb('0x23')]===undefined?!![]:![]:!![],'where':_0x5c4dbb['options']?_0x5c4dbb[_0x02cb('0x22')][_0x02cb('0x24')]||null:null,'attributes':_0x5c4dbb[_0x02cb('0x22')]?_0x5c4dbb['options']['attributes']||null:null,'limit':_0x5c4dbb['options']?_0x5c4dbb['options'][_0x02cb('0x25')]||null:null,'include':_0x5c4dbb[_0x02cb('0x22')]?_0x5c4dbb[_0x02cb('0x22')][_0x02cb('0x26')]?_[_0x02cb('0x27')](_0x5c4dbb[_0x02cb('0x22')][_0x02cb('0x26')],function(_0x2ee82f){return{'model':db[_0x2ee82f[_0x02cb('0x28')]],'as':_0x2ee82f['as'],'attributes':_0x2ee82f['attributes'],'include':_0x2ee82f[_0x02cb('0x26')]?_[_0x02cb('0x27')](_0x2ee82f[_0x02cb('0x26')],function(_0x2dbe1d){return{'model':db[_0x2dbe1d[_0x02cb('0x28')]],'as':_0x2dbe1d['as'],'attributes':_0x2dbe1d[_0x02cb('0x29')],'include':_0x2dbe1d[_0x02cb('0x26')]?_[_0x02cb('0x27')](_0x2dbe1d[_0x02cb('0x26')],function(_0x540908){return{'model':db[_0x540908['model']],'as':_0x540908['as'],'attributes':_0x540908[_0x02cb('0x29')]};}):[]};}):[]};}):[]:[]})[_0x02cb('0x13')](function(_0x195700){logger[_0x02cb('0x14')](_0x02cb('0x1f'),_0x5c4dbb);logger['debug'](_0x02cb('0x1f'),_0x5c4dbb,JSON['stringify'](_0x195700));_0x47c161(_0x195700);})[_0x02cb('0x1e')](function(_0x5d99e5){logger[_0x02cb('0x19')](_0x02cb('0x1f'),_0x5d99e5['message'],_0x5c4dbb);_0x426b1e(_0x26ac13['error'](0x1f4,_0x5d99e5[_0x02cb('0x1c')]));});});};exports['ShowChatQueue']=function(_0x56d4a1){var _0x37bce4=this;return new Promise(function(_0x4a00d3,_0x80a436){return db[_0x02cb('0x20')][_0x02cb('0x2a')]({'raw':_0x56d4a1[_0x02cb('0x22')]?_0x56d4a1[_0x02cb('0x22')][_0x02cb('0x23')]===undefined?!![]:![]:!![],'where':_0x56d4a1[_0x02cb('0x22')]?_0x56d4a1[_0x02cb('0x22')][_0x02cb('0x24')]||null:null,'attributes':_0x56d4a1[_0x02cb('0x22')]?_0x56d4a1[_0x02cb('0x22')][_0x02cb('0x29')]||null:null,'include':_0x56d4a1['options']?_0x56d4a1['options'][_0x02cb('0x26')]?_[_0x02cb('0x27')](_0x56d4a1[_0x02cb('0x22')][_0x02cb('0x26')],function(_0x199388){return{'model':db[_0x199388[_0x02cb('0x28')]],'as':_0x199388['as'],'attributes':_0x199388[_0x02cb('0x29')],'include':_0x199388[_0x02cb('0x26')]?_[_0x02cb('0x27')](_0x199388[_0x02cb('0x26')],function(_0x11de05){return{'model':db[_0x11de05[_0x02cb('0x28')]],'as':_0x11de05['as'],'attributes':_0x11de05[_0x02cb('0x29')],'include':_0x11de05[_0x02cb('0x26')]?_[_0x02cb('0x27')](_0x11de05['include'],function(_0x22170b){return{'model':db[_0x22170b[_0x02cb('0x28')]],'as':_0x22170b['as'],'attributes':_0x22170b[_0x02cb('0x29')]};}):[]};}):[]};}):[]:[]})[_0x02cb('0x13')](function(_0x239198){logger[_0x02cb('0x14')]('ShowChatQueue',_0x56d4a1);logger['debug'](_0x02cb('0x2b'),_0x56d4a1,JSON[_0x02cb('0x18')](_0x239198));_0x4a00d3(_0x239198);})[_0x02cb('0x1e')](function(_0x4c599d){logger['error'](_0x02cb('0x2b'),_0x4c599d['message'],_0x56d4a1);_0x80a436(_0x37bce4[_0x02cb('0x19')](0x1f4,_0x4c599d[_0x02cb('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7a2ff79..942c9fc 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 _0x0e85=['update','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x4b5637,_0x47f524){var _0x81ee55=function(_0x30a5cf){while(--_0x30a5cf){_0x4b5637['push'](_0x4b5637['shift']());}};_0x81ee55(++_0x47f524);}(_0x0e85,0x7c));var _0x50e8=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0e85[_0x4a53d];return _0x27410e;};'use strict';var ChatQueueEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatQueueEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatQueueEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0x9bde=['chatQueue:','save','update','emit','removeListener','register','length'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4e8c18,_0x1a1cc3){_0x4e8c18=_0x4e8c18-0x0;var _0x54ebb6=_0x9bde[_0x4e8c18];return _0x54ebb6;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){ChatQueueEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);ChatQueueEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index fee91b7..56a510d 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5e3513,_0xf4c3d5){var _0x2dcd97=function(_0x143f94){while(--_0x143f94){_0x5e3513['push'](_0x5e3513['shift']());}};_0x2dcd97(++_0xf4c3d5);}(_0x55ca,0x126));var _0xa55c=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x55ca[_0x1ef547];return _0x1d697b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0x3c88e1,_0x30e9fe){_0x3c88e1=_0x3c88e1-0x0;var _0x4ae01b=_0x3e74[_0x3c88e1];return _0x4ae01b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 27c4099..5268fba 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 _0xdf4e=['exports','STRING','DATE','moment','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdf4e,0x17a));var _0xedf4=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0xdf4e[_0x5b6cf1];return _0x46278c;};'use strict';var moment=require(_0xedf4('0x0'));var Sequelize=require(_0xedf4('0x1'));module[_0xedf4('0x2')]={'uniqueid':{'type':Sequelize[_0xedf4('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xedf4('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xedf4('0x4')]},'exitAt':{'type':Sequelize[_0xedf4('0x4')]},'reason':{'type':Sequelize[_0xedf4('0x3')]}}; \ No newline at end of file +var _0x3544=['DATE','moment','exports','STRING'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x3544,0x121));var _0x4354=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x3544[_0x1562a2];return _0x39a636;};'use strict';var moment=require(_0x4354('0x0'));var Sequelize=require('sequelize');module[_0x4354('0x1')]={'uniqueid':{'type':Sequelize[_0x4354('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4354('0x3')]},'leaveAt':{'type':Sequelize[_0x4354('0x3')]},'acceptAt':{'type':Sequelize[_0x4354('0x3')]},'exitAt':{'type':Sequelize[_0x4354('0x3')]},'reason':{'type':Sequelize[_0x4354('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b82da3b..67776fc 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 _0xe9ef=['describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params'];(function(_0x219af8,_0x5559b3){var _0x5d6acf=function(_0x33930a){while(--_0x33930a){_0x219af8['push'](_0x219af8['shift']());}};_0x5d6acf(++_0x5559b3);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xe9ef[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0xfe9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe9e('0x1'));var jsonpatch=require(_0xfe9e('0x2'));var rp=require('request-promise');var moment=require(_0xfe9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe9e('0x4'));var util=require(_0xfe9e('0x5'));var path=require(_0xfe9e('0x6'));var sox=require(_0xfe9e('0x7'));var csv=require('to-csv');var ejs=require(_0xfe9e('0x8'));var fs=require('fs');var fs_extra=require(_0xfe9e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe9e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfe9e('0xb'));var toCsv=require(_0xfe9e('0xc'));var querystring=require(_0xfe9e('0xd'));var Papa=require('papaparse');var Redis=require(_0xfe9e('0xe'));var authService=require(_0xfe9e('0xf'));var qs=require(_0xfe9e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe9e('0x11'));var logger=require('../../config/logger')(_0xfe9e('0x12'));var utils=require(_0xfe9e('0x13'));var config=require(_0xfe9e('0x14'));var licenseUtil=require(_0xfe9e('0x15'));var db=require(_0xfe9e('0x16'))['db'];function respondWithStatusCode(_0x32b437,_0x2ba797){_0x2ba797=_0x2ba797||0xcc;return function(_0x3ec8de){if(_0x3ec8de){return _0x32b437[_0xfe9e('0x17')](_0x2ba797);}return _0x32b437['status'](_0x2ba797)[_0xfe9e('0x18')]();};}function respondWithResult(_0x173e46,_0x55ac95){_0x55ac95=_0x55ac95||0xc8;return function(_0x344a80){if(_0x344a80){return _0x173e46[_0xfe9e('0x19')](_0x55ac95)[_0xfe9e('0x1a')](_0x344a80);}};}function respondWithFilteredResult(_0x3f5f68,_0x503d81){return function(_0x4edf71){if(_0x4edf71){var _0x44d746=typeof _0x503d81[_0xfe9e('0x1b')]===_0xfe9e('0x1c')&&typeof _0x503d81[_0xfe9e('0x1d')]==='undefined';var _0x2efc88=_0x4edf71[_0xfe9e('0x1e')];var _0xdf0a3b=_0x44d746?0x0:_0x503d81[_0xfe9e('0x1b')];var _0x495344=_0x44d746?_0x4edf71[_0xfe9e('0x1e')]:_0x503d81[_0xfe9e('0x1b')]+_0x503d81[_0xfe9e('0x1d')];var _0xec283a;if(_0x495344>=_0x2efc88){_0x495344=_0x2efc88;_0xec283a=0xc8;}else{_0xec283a=0xce;}_0x3f5f68[_0xfe9e('0x19')](_0xec283a);return _0x3f5f68['set']('Content-Range',_0xdf0a3b+'-'+_0x495344+'/'+_0x2efc88)[_0xfe9e('0x1a')](_0x4edf71);}return null;};}function patchUpdates(_0x1c956a){return function(_0x17a3df){try{jsonpatch[_0xfe9e('0x1f')](_0x17a3df,_0x1c956a,!![]);}catch(_0x1ad37a){return BPromise[_0xfe9e('0x20')](_0x1ad37a);}return _0x17a3df[_0xfe9e('0x21')]();};}function saveUpdates(_0xb5d636,_0x3c0c92){return function(_0xa7d9d8){if(_0xa7d9d8){return _0xa7d9d8[_0xfe9e('0x22')](_0xb5d636)[_0xfe9e('0x23')](function(_0x5f0311){return _0x5f0311;});}return null;};}function removeEntity(_0xcfe347,_0x269bcb){return function(_0x4e34cb){if(_0x4e34cb){return _0x4e34cb[_0xfe9e('0x24')]()['then'](function(){_0xcfe347[_0xfe9e('0x19')](0xcc)[_0xfe9e('0x18')]();});}};}function handleEntityNotFound(_0x56308e,_0x162ce2){return function(_0x3b5aea){if(!_0x3b5aea){_0x56308e[_0xfe9e('0x17')](0x194);}return _0x3b5aea;};}function handleError(_0x344746,_0x46ec65){_0x46ec65=_0x46ec65||0x1f4;return function(_0x42f89d){logger[_0xfe9e('0x25')](_0x42f89d[_0xfe9e('0x26')]);if(_0x42f89d[_0xfe9e('0x27')]){delete _0x42f89d[_0xfe9e('0x27')];}_0x344746[_0xfe9e('0x19')](_0x46ec65)[_0xfe9e('0x28')](_0x42f89d);};}exports[_0xfe9e('0x29')]=function(_0x4b952a,_0x5687ed){var _0x2ee15b={},_0x116b50={},_0x3f0cf4={'count':0x0,'rows':[]};var _0x11be5f=_['map'](db[_0xfe9e('0x2a')]['rawAttributes'],function(_0x55b08a){return{'name':_0x55b08a['fieldName'],'type':_0x55b08a[_0xfe9e('0x2b')][_0xfe9e('0x2c')]};});_0x116b50[_0xfe9e('0x2d')]=_['map'](_0x11be5f,'name');_0x116b50[_0xfe9e('0x2e')]=_[_0xfe9e('0x2f')](_0x4b952a[_0xfe9e('0x2e')]);_0x116b50[_0xfe9e('0x30')]=_[_0xfe9e('0x31')](_0x116b50['model'],_0x116b50['query']);_0x2ee15b[_0xfe9e('0x32')]=_[_0xfe9e('0x31')](_0x116b50[_0xfe9e('0x2d')],qs[_0xfe9e('0x33')](_0x4b952a[_0xfe9e('0x2e')][_0xfe9e('0x33')]));_0x2ee15b[_0xfe9e('0x32')]=_0x2ee15b[_0xfe9e('0x32')]['length']?_0x2ee15b[_0xfe9e('0x32')]:_0x116b50[_0xfe9e('0x2d')];if(!_0x4b952a[_0xfe9e('0x2e')]['hasOwnProperty'](_0xfe9e('0x34'))){_0x2ee15b[_0xfe9e('0x1d')]=qs['limit'](_0x4b952a['query'][_0xfe9e('0x1d')]);_0x2ee15b[_0xfe9e('0x1b')]=qs[_0xfe9e('0x1b')](_0x4b952a[_0xfe9e('0x2e')][_0xfe9e('0x1b')]);}_0x2ee15b[_0xfe9e('0x35')]=qs[_0xfe9e('0x36')](_0x4b952a['query']['sort']);_0x2ee15b[_0xfe9e('0x37')]=qs[_0xfe9e('0x30')](_[_0xfe9e('0x38')](_0x4b952a[_0xfe9e('0x2e')],_0x116b50[_0xfe9e('0x30')]),_0x11be5f);if(_0x4b952a[_0xfe9e('0x2e')][_0xfe9e('0x39')]){_0x2ee15b['where']=_[_0xfe9e('0x3a')](_0x2ee15b['where'],{'$or':_[_0xfe9e('0x3b')](_0x11be5f,function(_0x5a3c25){if(_0x5a3c25[_0xfe9e('0x2b')]!=='VIRTUAL'){var _0xaff270={};_0xaff270[_0x5a3c25[_0xfe9e('0x27')]]={'$like':'%'+_0x4b952a[_0xfe9e('0x2e')][_0xfe9e('0x39')]+'%'};return _0xaff270;}})});}_0x2ee15b=_[_0xfe9e('0x3a')]({},_0x2ee15b,_0x4b952a[_0xfe9e('0x3c')]);var _0x58e703={'where':_0x2ee15b['where']};return db[_0xfe9e('0x2a')]['count'](_0x58e703)[_0xfe9e('0x23')](function(_0x43abfe){_0x3f0cf4['count']=_0x43abfe;if(_0x4b952a[_0xfe9e('0x2e')][_0xfe9e('0x3d')]){_0x2ee15b[_0xfe9e('0x3e')]=[{'all':!![]}];}return db[_0xfe9e('0x2a')][_0xfe9e('0x3f')](_0x2ee15b);})['then'](function(_0x258156){_0x3f0cf4[_0xfe9e('0x40')]=_0x258156;return _0x3f0cf4;})[_0xfe9e('0x23')](respondWithFilteredResult(_0x5687ed,_0x2ee15b))[_0xfe9e('0x41')](handleError(_0x5687ed,null));};exports[_0xfe9e('0x42')]=function(_0x29c297,_0x160575){var _0x3caf7b={'raw':!![],'where':{'id':_0x29c297['params']['id']}},_0x30d892={};_0x30d892[_0xfe9e('0x2d')]=_[_0xfe9e('0x2f')](db[_0xfe9e('0x2a')][_0xfe9e('0x43')]);_0x30d892[_0xfe9e('0x2e')]=_['keys'](_0x29c297[_0xfe9e('0x2e')]);_0x30d892[_0xfe9e('0x30')]=_[_0xfe9e('0x31')](_0x30d892[_0xfe9e('0x2d')],_0x30d892[_0xfe9e('0x2e')]);_0x3caf7b['attributes']=_[_0xfe9e('0x31')](_0x30d892[_0xfe9e('0x2d')],qs[_0xfe9e('0x33')](_0x29c297[_0xfe9e('0x2e')][_0xfe9e('0x33')]));_0x3caf7b[_0xfe9e('0x32')]=_0x3caf7b['attributes']['length']?_0x3caf7b[_0xfe9e('0x32')]:_0x30d892[_0xfe9e('0x2d')];if(_0x29c297[_0xfe9e('0x2e')][_0xfe9e('0x3d')]){_0x3caf7b[_0xfe9e('0x3e')]=[{'all':!![]}];}_0x3caf7b=_[_0xfe9e('0x3a')]({},_0x3caf7b,_0x29c297['options']);return db['ChatQueueReport'][_0xfe9e('0x44')](_0x3caf7b)[_0xfe9e('0x23')](handleEntityNotFound(_0x160575,null))[_0xfe9e('0x23')](respondWithResult(_0x160575,null))['catch'](handleError(_0x160575,null));};exports[_0xfe9e('0x45')]=function(_0x8682eb,_0xad0a90){return db[_0xfe9e('0x2a')]['create'](_0x8682eb[_0xfe9e('0x46')],{})[_0xfe9e('0x23')](respondWithResult(_0xad0a90,0xc9))[_0xfe9e('0x41')](handleError(_0xad0a90,null));};exports[_0xfe9e('0x22')]=function(_0x1b870a,_0x52e445){if(_0x1b870a[_0xfe9e('0x46')]['id']){delete _0x1b870a[_0xfe9e('0x46')]['id'];}return db[_0xfe9e('0x2a')][_0xfe9e('0x44')]({'where':{'id':_0x1b870a['params']['id']}})['then'](handleEntityNotFound(_0x52e445,null))[_0xfe9e('0x23')](saveUpdates(_0x1b870a[_0xfe9e('0x46')],null))[_0xfe9e('0x23')](respondWithResult(_0x52e445,null))[_0xfe9e('0x41')](handleError(_0x52e445,null));};exports[_0xfe9e('0x24')]=function(_0x3c6c03,_0x3e4acd){return db[_0xfe9e('0x2a')][_0xfe9e('0x44')]({'where':{'id':_0x3c6c03[_0xfe9e('0x47')]['id']}})[_0xfe9e('0x23')](handleEntityNotFound(_0x3e4acd,null))[_0xfe9e('0x23')](removeEntity(_0x3e4acd,null))['catch'](handleError(_0x3e4acd,null));};exports['describe']=function(_0xf25001,_0x563fea){return db['ChatQueueReport'][_0xfe9e('0x48')]()[_0xfe9e('0x23')](respondWithResult(_0x563fea,null))[_0xfe9e('0x41')](handleError(_0x563fea,null));}; \ No newline at end of file +var _0x3079=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','ChatQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1da8a7,_0x2367fd){var _0x419b8a=function(_0x1626cf){while(--_0x1626cf){_0x1da8a7['push'](_0x1da8a7['shift']());}};_0x419b8a(++_0x2367fd);}(_0x3079,0x110));var _0x9307=function(_0x5d278c,_0x38e967){_0x5d278c=_0x5d278c-0x0;var _0x13a35e=_0x3079[_0x5d278c];return _0x13a35e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9307('0x0'));var zipdir=require(_0x9307('0x1'));var jsonpatch=require(_0x9307('0x2'));var rp=require(_0x9307('0x3'));var moment=require('moment');var BPromise=require(_0x9307('0x4'));var Mustache=require(_0x9307('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9307('0x6'));var csv=require(_0x9307('0x7'));var ejs=require(_0x9307('0x8'));var fs=require('fs');var fs_extra=require(_0x9307('0x9'));var _=require(_0x9307('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9307('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9307('0x7'));var querystring=require(_0x9307('0xc'));var Papa=require('papaparse');var Redis=require(_0x9307('0xd'));var authService=require(_0x9307('0xe'));var qs=require(_0x9307('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9307('0x10'))(_0x9307('0x11'));var utils=require(_0x9307('0x12'));var config=require(_0x9307('0x13'));var licenseUtil=require(_0x9307('0x14'));var db=require(_0x9307('0x15'))['db'];function respondWithStatusCode(_0x4bc72d,_0x2bab66){_0x2bab66=_0x2bab66||0xcc;return function(_0x2fc4a5){if(_0x2fc4a5){return _0x4bc72d['sendStatus'](_0x2bab66);}return _0x4bc72d['status'](_0x2bab66)[_0x9307('0x16')]();};}function respondWithResult(_0x3d3671,_0x4a7e80){_0x4a7e80=_0x4a7e80||0xc8;return function(_0x3d9864){if(_0x3d9864){return _0x3d3671[_0x9307('0x17')](_0x4a7e80)['json'](_0x3d9864);}};}function respondWithFilteredResult(_0x108830,_0x231bba){return function(_0x4e79f7){if(_0x4e79f7){var _0x3fc6fd=typeof _0x231bba[_0x9307('0x18')]===_0x9307('0x19')&&typeof _0x231bba['limit']===_0x9307('0x19');var _0x27682a=_0x4e79f7['count'];var _0xbba867=_0x3fc6fd?0x0:_0x231bba[_0x9307('0x18')];var _0x1e8af2=_0x3fc6fd?_0x4e79f7[_0x9307('0x1a')]:_0x231bba[_0x9307('0x18')]+_0x231bba[_0x9307('0x1b')];var _0x5810d7;if(_0x1e8af2>=_0x27682a){_0x1e8af2=_0x27682a;_0x5810d7=0xc8;}else{_0x5810d7=0xce;}_0x108830[_0x9307('0x17')](_0x5810d7);return _0x108830[_0x9307('0x1c')](_0x9307('0x1d'),_0xbba867+'-'+_0x1e8af2+'/'+_0x27682a)['json'](_0x4e79f7);}return null;};}function patchUpdates(_0x2f35c7){return function(_0x3a139e){try{jsonpatch['apply'](_0x3a139e,_0x2f35c7,!![]);}catch(_0x307ab9){return BPromise[_0x9307('0x1e')](_0x307ab9);}return _0x3a139e[_0x9307('0x1f')]();};}function saveUpdates(_0x39bbcc,_0x15e7c4){return function(_0xf39222){if(_0xf39222){return _0xf39222[_0x9307('0x20')](_0x39bbcc)[_0x9307('0x21')](function(_0x2f5f68){return _0x2f5f68;});}return null;};}function removeEntity(_0x29b0c2,_0x3241d9){return function(_0x5d42a0){if(_0x5d42a0){return _0x5d42a0[_0x9307('0x22')]()['then'](function(){_0x29b0c2[_0x9307('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c59ef,_0x5bb98a){return function(_0x4d1a13){if(!_0x4d1a13){_0x2c59ef[_0x9307('0x23')](0x194);}return _0x4d1a13;};}function handleError(_0x366dea,_0xfeffdc){_0xfeffdc=_0xfeffdc||0x1f4;return function(_0x330d48){logger[_0x9307('0x24')](_0x330d48[_0x9307('0x25')]);if(_0x330d48[_0x9307('0x26')]){delete _0x330d48['name'];}_0x366dea[_0x9307('0x17')](_0xfeffdc)['send'](_0x330d48);};}exports[_0x9307('0x27')]=function(_0x1c7e60,_0x10ea72){var _0x5deda1={},_0x4619e5={},_0x5459c1={'count':0x0,'rows':[]};var _0x5440a6=_['map'](db[_0x9307('0x28')]['rawAttributes'],function(_0xfe280b){return{'name':_0xfe280b[_0x9307('0x29')],'type':_0xfe280b[_0x9307('0x2a')][_0x9307('0x2b')]};});_0x4619e5[_0x9307('0x2c')]=_[_0x9307('0x2d')](_0x5440a6,'name');_0x4619e5[_0x9307('0x2e')]=_[_0x9307('0x2f')](_0x1c7e60[_0x9307('0x2e')]);_0x4619e5[_0x9307('0x30')]=_[_0x9307('0x31')](_0x4619e5[_0x9307('0x2c')],_0x4619e5[_0x9307('0x2e')]);_0x5deda1['attributes']=_['intersection'](_0x4619e5[_0x9307('0x2c')],qs[_0x9307('0x32')](_0x1c7e60[_0x9307('0x2e')][_0x9307('0x32')]));_0x5deda1[_0x9307('0x33')]=_0x5deda1[_0x9307('0x33')][_0x9307('0x34')]?_0x5deda1[_0x9307('0x33')]:_0x4619e5[_0x9307('0x2c')];if(!_0x1c7e60[_0x9307('0x2e')]['hasOwnProperty'](_0x9307('0x35'))){_0x5deda1[_0x9307('0x1b')]=qs[_0x9307('0x1b')](_0x1c7e60[_0x9307('0x2e')][_0x9307('0x1b')]);_0x5deda1[_0x9307('0x18')]=qs[_0x9307('0x18')](_0x1c7e60[_0x9307('0x2e')][_0x9307('0x18')]);}_0x5deda1[_0x9307('0x36')]=qs[_0x9307('0x37')](_0x1c7e60[_0x9307('0x2e')][_0x9307('0x37')]);_0x5deda1[_0x9307('0x38')]=qs['filters'](_[_0x9307('0x39')](_0x1c7e60[_0x9307('0x2e')],_0x4619e5[_0x9307('0x30')]),_0x5440a6);if(_0x1c7e60[_0x9307('0x2e')][_0x9307('0x3a')]){_0x5deda1[_0x9307('0x38')]=_[_0x9307('0x3b')](_0x5deda1[_0x9307('0x38')],{'$or':_['map'](_0x5440a6,function(_0x11a404){if(_0x11a404[_0x9307('0x2a')]!==_0x9307('0x3c')){var _0x5a8665={};_0x5a8665[_0x11a404[_0x9307('0x26')]]={'$like':'%'+_0x1c7e60[_0x9307('0x2e')][_0x9307('0x3a')]+'%'};return _0x5a8665;}})});}_0x5deda1=_['merge']({},_0x5deda1,_0x1c7e60[_0x9307('0x3d')]);var _0x356747={'where':_0x5deda1[_0x9307('0x38')]};return db[_0x9307('0x28')]['count'](_0x356747)['then'](function(_0x2a7e00){_0x5459c1[_0x9307('0x1a')]=_0x2a7e00;if(_0x1c7e60[_0x9307('0x2e')]['includeAll']){_0x5deda1['include']=[{'all':!![]}];}return db[_0x9307('0x28')]['findAll'](_0x5deda1);})[_0x9307('0x21')](function(_0x24cff3){_0x5459c1['rows']=_0x24cff3;return _0x5459c1;})[_0x9307('0x21')](respondWithFilteredResult(_0x10ea72,_0x5deda1))[_0x9307('0x3e')](handleError(_0x10ea72,null));};exports[_0x9307('0x3f')]=function(_0x39055e,_0x18a738){var _0x1a63ff={'raw':!![],'where':{'id':_0x39055e[_0x9307('0x40')]['id']}},_0x248d24={};_0x248d24[_0x9307('0x2c')]=_['keys'](db['ChatQueueReport'][_0x9307('0x41')]);_0x248d24[_0x9307('0x2e')]=_[_0x9307('0x2f')](_0x39055e[_0x9307('0x2e')]);_0x248d24[_0x9307('0x30')]=_[_0x9307('0x31')](_0x248d24['model'],_0x248d24['query']);_0x1a63ff[_0x9307('0x33')]=_[_0x9307('0x31')](_0x248d24['model'],qs[_0x9307('0x32')](_0x39055e['query'][_0x9307('0x32')]));_0x1a63ff[_0x9307('0x33')]=_0x1a63ff['attributes'][_0x9307('0x34')]?_0x1a63ff[_0x9307('0x33')]:_0x248d24[_0x9307('0x2c')];if(_0x39055e[_0x9307('0x2e')][_0x9307('0x42')]){_0x1a63ff[_0x9307('0x43')]=[{'all':!![]}];}_0x1a63ff=_[_0x9307('0x3b')]({},_0x1a63ff,_0x39055e[_0x9307('0x3d')]);return db['ChatQueueReport'][_0x9307('0x44')](_0x1a63ff)[_0x9307('0x21')](handleEntityNotFound(_0x18a738,null))[_0x9307('0x21')](respondWithResult(_0x18a738,null))[_0x9307('0x3e')](handleError(_0x18a738,null));};exports[_0x9307('0x45')]=function(_0x4f1615,_0x119cc2){return db['ChatQueueReport']['create'](_0x4f1615[_0x9307('0x46')],{})[_0x9307('0x21')](respondWithResult(_0x119cc2,0xc9))[_0x9307('0x3e')](handleError(_0x119cc2,null));};exports[_0x9307('0x20')]=function(_0x196a8e,_0x48a768){if(_0x196a8e[_0x9307('0x46')]['id']){delete _0x196a8e['body']['id'];}return db[_0x9307('0x28')][_0x9307('0x44')]({'where':{'id':_0x196a8e['params']['id']}})['then'](handleEntityNotFound(_0x48a768,null))[_0x9307('0x21')](saveUpdates(_0x196a8e[_0x9307('0x46')],null))[_0x9307('0x21')](respondWithResult(_0x48a768,null))[_0x9307('0x3e')](handleError(_0x48a768,null));};exports[_0x9307('0x22')]=function(_0x5a5f7c,_0x1aa8cb){return db[_0x9307('0x28')][_0x9307('0x44')]({'where':{'id':_0x5a5f7c[_0x9307('0x40')]['id']}})['then'](handleEntityNotFound(_0x1aa8cb,null))['then'](removeEntity(_0x1aa8cb,null))['catch'](handleError(_0x1aa8cb,null));};exports[_0x9307('0x47')]=function(_0x517e52,_0x48ccb6){return db['ChatQueueReport'][_0x9307('0x47')]()[_0x9307('0x21')](respondWithResult(_0x48ccb6,null))[_0x9307('0x3e')](handleError(_0x48ccb6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 930a80f..5ec6f18 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x36d500,_0x1cab6f){var _0x22604b=function(_0x8d2d83){while(--_0x8d2d83){_0x36d500['push'](_0x36d500['shift']());}};_0x22604b(++_0x1cab6f);}(_0x757a,0xde));var _0xa757=function(_0x334888,_0xbab26d){_0x334888=_0x334888-0x0;var _0xa5a8a7=_0x757a[_0x334888];return _0xa5a8a7;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 5015b27..e52e75b 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 _0xfcfb=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','body','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xfcfb,0x1d4));var _0xbfcf=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xfcfb[_0x512f81];return _0xa15099;};'use strict';var _=require(_0xbfcf('0x0'));var util=require(_0xbfcf('0x1'));var moment=require(_0xbfcf('0x2'));var BPromise=require(_0xbfcf('0x3'));var rs=require(_0xbfcf('0x4'));var fs=require('fs');var Redis=require(_0xbfcf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfcf('0x6'));var logger=require('../../config/logger')(_0xbfcf('0x7'));var config=require(_0xbfcf('0x8'));var jayson=require(_0xbfcf('0x9'));var client=jayson[_0xbfcf('0xa')][_0xbfcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x262b2d,_0x307ad5,_0x4124c6){return new BPromise(function(_0x8d0c4f,_0x2fef6e){return client[_0xbfcf('0xc')](_0x262b2d,_0x4124c6)[_0xbfcf('0xd')](function(_0x401a33){logger[_0xbfcf('0xe')](_0xbfcf('0xf'),_0x307ad5,'request\x20sent');logger['debug'](_0xbfcf('0x10'),_0x307ad5,_0xbfcf('0x11'),JSON[_0xbfcf('0x12')](_0x401a33));if(_0x401a33[_0xbfcf('0x13')]){if(_0x401a33[_0xbfcf('0x13')]['code']===0x1f4){logger[_0xbfcf('0x13')](_0xbfcf('0xf'),_0x307ad5,_0x401a33[_0xbfcf('0x13')][_0xbfcf('0x14')]);return _0x2fef6e(_0x401a33[_0xbfcf('0x13')][_0xbfcf('0x14')]);}logger[_0xbfcf('0x13')](_0xbfcf('0xf'),_0x307ad5,_0x401a33[_0xbfcf('0x13')]['message']);return _0x8d0c4f(_0x401a33[_0xbfcf('0x13')][_0xbfcf('0x14')]);}else{logger[_0xbfcf('0xe')](_0xbfcf('0xf'),_0x307ad5,_0xbfcf('0x11'));_0x8d0c4f(_0x401a33['result'][_0xbfcf('0x14')]);}})[_0xbfcf('0x15')](function(_0xf94bcd){logger[_0xbfcf('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x307ad5,_0xf94bcd);_0x2fef6e(_0xf94bcd);});});}exports[_0xbfcf('0x16')]=function(_0x9046cc){var _0x400be9=this;return new Promise(function(_0x546395,_0x1765b9){return db[_0xbfcf('0x17')][_0xbfcf('0x18')](_0x9046cc['body'],{'raw':_0x9046cc[_0xbfcf('0x19')]?_0x9046cc['options'][_0xbfcf('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xc2c8fd){logger[_0xbfcf('0xe')](_0xbfcf('0x16'),_0x9046cc);logger['debug'](_0xbfcf('0x16'),_0x9046cc,JSON[_0xbfcf('0x12')](_0xc2c8fd));_0x546395(_0xc2c8fd);})[_0xbfcf('0x15')](function(_0x3e2c8c){logger[_0xbfcf('0x13')](_0xbfcf('0x16'),_0x3e2c8c[_0xbfcf('0x14')],_0x9046cc);_0x1765b9(_0x400be9[_0xbfcf('0x13')](0x1f4,_0x3e2c8c[_0xbfcf('0x14')]));});});};exports[_0xbfcf('0x1b')]=function(_0x4eba83){var _0x169e17=this;return new Promise(function(_0x4562b9,_0x295b0f){return db[_0xbfcf('0x17')][_0xbfcf('0x1c')](_0x4eba83[_0xbfcf('0x1d')],{'raw':_0x4eba83[_0xbfcf('0x19')]?_0x4eba83['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eba83['options']?_0x4eba83[_0xbfcf('0x19')][_0xbfcf('0x1e')]||null:null,'attributes':_0x4eba83[_0xbfcf('0x19')]?_0x4eba83[_0xbfcf('0x19')][_0xbfcf('0x1f')]||null:null,'limit':_0x4eba83[_0xbfcf('0x19')]?_0x4eba83['options'][_0xbfcf('0x20')]||null:null})[_0xbfcf('0xd')](function(_0x5d49b7){logger[_0xbfcf('0xe')]('UpdateChatQueueReport',_0x4eba83);logger[_0xbfcf('0x21')]('UpdateChatQueueReport',_0x4eba83,JSON[_0xbfcf('0x12')](_0x5d49b7));_0x4562b9(_0x5d49b7);})['catch'](function(_0x4aca5e){logger['error'](_0xbfcf('0x1b'),_0x4aca5e[_0xbfcf('0x14')],_0x4eba83);_0x295b0f(_0x169e17[_0xbfcf('0x13')](0x1f4,_0x4aca5e[_0xbfcf('0x14')]));});});}; \ No newline at end of file +var _0x864b=['where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','update'];(function(_0x1c8add,_0x13871c){var _0x1b8d30=function(_0x103b06){while(--_0x103b06){_0x1c8add['push'](_0x1c8add['shift']());}};_0x1b8d30(++_0x13871c);}(_0x864b,0x179));var _0xb864=function(_0x288b36,_0x527364){_0x288b36=_0x288b36-0x0;var _0x486645=_0x864b[_0x288b36];return _0x486645;};'use strict';var _=require(_0xb864('0x0'));var util=require(_0xb864('0x1'));var moment=require('moment');var BPromise=require(_0xb864('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb864('0x3'));var db=require(_0xb864('0x4'))['db'];var utils=require(_0xb864('0x5'));var logger=require(_0xb864('0x6'))(_0xb864('0x7'));var config=require(_0xb864('0x8'));var jayson=require(_0xb864('0x9'));var client=jayson['client'][_0xb864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c06e4,_0x1ce4e9,_0x525999){return new BPromise(function(_0x2ae8a3,_0x460a36){return client[_0xb864('0xb')](_0x2c06e4,_0x525999)[_0xb864('0xc')](function(_0x362b82){logger[_0xb864('0xd')](_0xb864('0xe'),_0x1ce4e9,_0xb864('0xf'));logger['debug'](_0xb864('0x10'),_0x1ce4e9,_0xb864('0xf'),JSON[_0xb864('0x11')](_0x362b82));if(_0x362b82['error']){if(_0x362b82[_0xb864('0x12')][_0xb864('0x13')]===0x1f4){logger[_0xb864('0x12')](_0xb864('0xe'),_0x1ce4e9,_0x362b82[_0xb864('0x12')][_0xb864('0x14')]);return _0x460a36(_0x362b82[_0xb864('0x12')]['message']);}logger[_0xb864('0x12')](_0xb864('0xe'),_0x1ce4e9,_0x362b82[_0xb864('0x12')][_0xb864('0x14')]);return _0x2ae8a3(_0x362b82['error'][_0xb864('0x14')]);}else{logger[_0xb864('0xd')](_0xb864('0xe'),_0x1ce4e9,_0xb864('0xf'));_0x2ae8a3(_0x362b82['result'][_0xb864('0x14')]);}})[_0xb864('0x15')](function(_0x228d54){logger['error'](_0xb864('0xe'),_0x1ce4e9,_0x228d54);_0x460a36(_0x228d54);});});}exports[_0xb864('0x16')]=function(_0x3ffa5c){var _0x18f10f=this;return new Promise(function(_0x51bdeb,_0x181a47){return db[_0xb864('0x17')][_0xb864('0x18')](_0x3ffa5c[_0xb864('0x19')],{'raw':_0x3ffa5c[_0xb864('0x1a')]?_0x3ffa5c[_0xb864('0x1a')][_0xb864('0x1b')]===undefined?!![]:![]:!![]})[_0xb864('0xc')](function(_0x5e1f47){logger[_0xb864('0xd')]('CreateChatQueueReport',_0x3ffa5c);logger[_0xb864('0x1c')]('CreateChatQueueReport',_0x3ffa5c,JSON[_0xb864('0x11')](_0x5e1f47));_0x51bdeb(_0x5e1f47);})[_0xb864('0x15')](function(_0x2c4ae3){logger['error']('CreateChatQueueReport',_0x2c4ae3[_0xb864('0x14')],_0x3ffa5c);_0x181a47(_0x18f10f[_0xb864('0x12')](0x1f4,_0x2c4ae3[_0xb864('0x14')]));});});};exports[_0xb864('0x1d')]=function(_0x5f3e76){var _0x110f2b=this;return new Promise(function(_0xcf627d,_0x227f0c){return db[_0xb864('0x17')][_0xb864('0x1e')](_0x5f3e76[_0xb864('0x19')],{'raw':_0x5f3e76[_0xb864('0x1a')]?_0x5f3e76[_0xb864('0x1a')][_0xb864('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f3e76[_0xb864('0x1a')]?_0x5f3e76[_0xb864('0x1a')][_0xb864('0x1f')]||null:null,'attributes':_0x5f3e76[_0xb864('0x1a')]?_0x5f3e76[_0xb864('0x1a')][_0xb864('0x20')]||null:null,'limit':_0x5f3e76['options']?_0x5f3e76['options'][_0xb864('0x21')]||null:null})[_0xb864('0xc')](function(_0x1c70ce){logger[_0xb864('0xd')](_0xb864('0x1d'),_0x5f3e76);logger['debug'](_0xb864('0x1d'),_0x5f3e76,JSON[_0xb864('0x11')](_0x1c70ce));_0xcf627d(_0x1c70ce);})[_0xb864('0x15')](function(_0x568d92){logger['error'](_0xb864('0x1d'),_0x568d92[_0xb864('0x14')],_0x5f3e76);_0x227f0c(_0x110f2b[_0xb864('0x12')](0x1f4,_0x568d92['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 03970fd..b68e106 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 _0x402c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3e76be,_0x4cfd11){var _0x3d76e8=function(_0x12168a){while(--_0x12168a){_0x3e76be['push'](_0x3e76be['shift']());}};_0x3d76e8(++_0x4cfd11);}(_0x402c,0xc3));var _0xc402=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x402c[_0x49a982];return _0x2a0bc9;};'use strict';var multer=require('multer');var util=require(_0xc402('0x0'));var path=require(_0xc402('0x1'));var timeout=require(_0xc402('0x2'));var express=require(_0xc402('0x3'));var router=express[_0xc402('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc402('0x5'));var interaction=require(_0xc402('0x6'));var config=require(_0xc402('0x7'));var controller=require(_0xc402('0x8'));router[_0xc402('0x9')]('/',auth[_0xc402('0xa')](),controller['index']);router['get'](_0xc402('0xb'),auth[_0xc402('0xa')](),controller[_0xc402('0xc')]);router[_0xc402('0x9')](_0xc402('0xd'),auth[_0xc402('0xa')](),controller['show']);router[_0xc402('0xe')]('/',auth[_0xc402('0xa')](),controller[_0xc402('0xf')]);router[_0xc402('0x10')](_0xc402('0xd'),auth[_0xc402('0xa')](),controller[_0xc402('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc402('0x12')]);module[_0xc402('0x13')]=router; \ No newline at end of file +var _0xf5af=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x587d69,_0x470f37){var _0x5a3c15=function(_0x2f3e57){while(--_0x2f3e57){_0x587d69['push'](_0x587d69['shift']());}};_0x5a3c15(++_0x470f37);}(_0xf5af,0x84));var _0xff5a=function(_0xfbbb04,_0x3fc65c){_0xfbbb04=_0xfbbb04-0x0;var _0x4ee2ee=_0xf5af[_0xfbbb04];return _0x4ee2ee;};'use strict';var multer=require(_0xff5a('0x0'));var util=require(_0xff5a('0x1'));var path=require('path');var timeout=require(_0xff5a('0x2'));var express=require(_0xff5a('0x3'));var router=express[_0xff5a('0x4')]();var fs_extra=require(_0xff5a('0x5'));var auth=require(_0xff5a('0x6'));var interaction=require(_0xff5a('0x7'));var config=require(_0xff5a('0x8'));var controller=require(_0xff5a('0x9'));router[_0xff5a('0xa')]('/',auth[_0xff5a('0xb')](),controller['index']);router[_0xff5a('0xa')](_0xff5a('0xc'),auth[_0xff5a('0xb')](),controller[_0xff5a('0xd')]);router[_0xff5a('0xa')](_0xff5a('0xe'),auth[_0xff5a('0xb')](),controller[_0xff5a('0xf')]);router[_0xff5a('0x10')]('/',auth[_0xff5a('0xb')](),controller[_0xff5a('0x11')]);router[_0xff5a('0x12')](_0xff5a('0xe'),auth[_0xff5a('0xb')](),controller[_0xff5a('0x13')]);router['delete'](_0xff5a('0xe'),auth['isAuthenticated'](),controller[_0xff5a('0x14')]);module[_0xff5a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 3950e43..f96498d 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5c68f1,_0x863857){var _0x337364=function(_0x1bb815){while(--_0x1bb815){_0x5c68f1['push'](_0x5c68f1['shift']());}};_0x337364(++_0x863857);}(_0x70e0,0x17b));var _0x070e=function(_0x3c9648,_0x3e7391){_0x3c9648=_0x3c9648-0x0;var _0x26bc44=_0x70e0[_0x3c9648];return _0x26bc44;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6866a56..b2100eb 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 _0x1710=['apply','reject','save','update','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1710,0x158));var _0x0171=function(_0x1e96d3,_0x522dbe){_0x1e96d3=_0x1e96d3-0x0;var _0x1454e0=_0x1710[_0x1e96d3];return _0x1454e0;};'use strict';var emlformat=require(_0x0171('0x0'));var rimraf=require(_0x0171('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0171('0x2'));var rp=require(_0x0171('0x3'));var moment=require('moment');var BPromise=require(_0x0171('0x4'));var Mustache=require(_0x0171('0x5'));var util=require(_0x0171('0x6'));var path=require(_0x0171('0x7'));var sox=require('sox');var csv=require(_0x0171('0x8'));var ejs=require(_0x0171('0x9'));var fs=require('fs');var fs_extra=require(_0x0171('0xa'));var _=require(_0x0171('0xb'));var squel=require(_0x0171('0xc'));var crypto=require(_0x0171('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0171('0xe'));var Papa=require(_0x0171('0xf'));var Redis=require('ioredis');var authService=require(_0x0171('0x10'));var qs=require(_0x0171('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0171('0x12'));var logger=require(_0x0171('0x13'))(_0x0171('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0171('0x15'))['db'];function respondWithStatusCode(_0x57cb3a,_0x150507){_0x150507=_0x150507||0xcc;return function(_0x5bcd6c){if(_0x5bcd6c){return _0x57cb3a[_0x0171('0x16')](_0x150507);}return _0x57cb3a[_0x0171('0x17')](_0x150507)['end']();};}function respondWithResult(_0x16f1a4,_0x422b06){_0x422b06=_0x422b06||0xc8;return function(_0x390b2c){if(_0x390b2c){return _0x16f1a4[_0x0171('0x17')](_0x422b06)[_0x0171('0x18')](_0x390b2c);}};}function respondWithFilteredResult(_0x3f55cb,_0x23a493){return function(_0x5160b5){if(_0x5160b5){var _0x21f26c=typeof _0x23a493['offset']===_0x0171('0x19')&&typeof _0x23a493['limit']==='undefined';var _0x198209=_0x5160b5['count'];var _0x46ffd0=_0x21f26c?0x0:_0x23a493[_0x0171('0x1a')];var _0xd7a90a=_0x21f26c?_0x5160b5[_0x0171('0x1b')]:_0x23a493['offset']+_0x23a493[_0x0171('0x1c')];var _0x4d1e5f;if(_0xd7a90a>=_0x198209){_0xd7a90a=_0x198209;_0x4d1e5f=0xc8;}else{_0x4d1e5f=0xce;}_0x3f55cb[_0x0171('0x17')](_0x4d1e5f);return _0x3f55cb[_0x0171('0x1d')](_0x0171('0x1e'),_0x46ffd0+'-'+_0xd7a90a+'/'+_0x198209)[_0x0171('0x18')](_0x5160b5);}return null;};}function patchUpdates(_0x53d28d){return function(_0x2839d0){try{jsonpatch[_0x0171('0x1f')](_0x2839d0,_0x53d28d,!![]);}catch(_0xa0f8b1){return BPromise[_0x0171('0x20')](_0xa0f8b1);}return _0x2839d0[_0x0171('0x21')]();};}function saveUpdates(_0xb965a5,_0x335ced){return function(_0x4e63c8){if(_0x4e63c8){return _0x4e63c8[_0x0171('0x22')](_0xb965a5)['then'](function(_0x47e900){return _0x47e900;});}return null;};}function removeEntity(_0x1f4aa4,_0xb6baad){return function(_0x5571b0){if(_0x5571b0){return _0x5571b0['destroy']()[_0x0171('0x23')](function(){_0x1f4aa4[_0x0171('0x17')](0xcc)[_0x0171('0x24')]();});}};}function handleEntityNotFound(_0x5e896f,_0x400adb){return function(_0x332ca2){if(!_0x332ca2){_0x5e896f['sendStatus'](0x194);}return _0x332ca2;};}function handleError(_0x4d765d,_0x98bf07){_0x98bf07=_0x98bf07||0x1f4;return function(_0x89e86a){logger[_0x0171('0x25')](_0x89e86a[_0x0171('0x26')]);if(_0x89e86a[_0x0171('0x27')]){delete _0x89e86a[_0x0171('0x27')];}_0x4d765d[_0x0171('0x17')](_0x98bf07)[_0x0171('0x28')](_0x89e86a);};}exports[_0x0171('0x29')]=function(_0x11d646,_0x361eff){var _0x5abc48={},_0x28b109={},_0x19b3e0={'count':0x0,'rows':[]};var _0x195e79=_[_0x0171('0x2a')](db[_0x0171('0x2b')][_0x0171('0x2c')],function(_0x7bfdd6){return{'name':_0x7bfdd6[_0x0171('0x2d')],'type':_0x7bfdd6['type'][_0x0171('0x2e')]};});_0x28b109['model']=_[_0x0171('0x2a')](_0x195e79,_0x0171('0x27'));_0x28b109[_0x0171('0x2f')]=_[_0x0171('0x30')](_0x11d646[_0x0171('0x2f')]);_0x28b109[_0x0171('0x31')]=_[_0x0171('0x32')](_0x28b109['model'],_0x28b109[_0x0171('0x2f')]);_0x5abc48[_0x0171('0x33')]=_[_0x0171('0x32')](_0x28b109[_0x0171('0x34')],qs['fields'](_0x11d646[_0x0171('0x2f')][_0x0171('0x35')]));_0x5abc48[_0x0171('0x33')]=_0x5abc48['attributes'][_0x0171('0x36')]?_0x5abc48[_0x0171('0x33')]:_0x28b109[_0x0171('0x34')];if(!_0x11d646['query'][_0x0171('0x37')](_0x0171('0x38'))){_0x5abc48[_0x0171('0x1c')]=qs[_0x0171('0x1c')](_0x11d646[_0x0171('0x2f')]['limit']);_0x5abc48[_0x0171('0x1a')]=qs['offset'](_0x11d646[_0x0171('0x2f')]['offset']);}_0x5abc48[_0x0171('0x39')]=qs[_0x0171('0x3a')](_0x11d646[_0x0171('0x2f')]['sort']);_0x5abc48[_0x0171('0x3b')]=qs['filters'](_[_0x0171('0x3c')](_0x11d646[_0x0171('0x2f')],_0x28b109[_0x0171('0x31')]),_0x195e79);if(_0x11d646['query']['filter']){_0x5abc48[_0x0171('0x3b')]=_[_0x0171('0x3d')](_0x5abc48[_0x0171('0x3b')],{'$or':_[_0x0171('0x2a')](_0x195e79,function(_0x4af66a){if(_0x4af66a[_0x0171('0x3e')]!==_0x0171('0x3f')){var _0x32c8f3={};_0x32c8f3[_0x4af66a[_0x0171('0x27')]]={'$like':'%'+_0x11d646[_0x0171('0x2f')]['filter']+'%'};return _0x32c8f3;}})});}_0x5abc48=_['merge']({},_0x5abc48,_0x11d646[_0x0171('0x40')]);var _0x22b524={'where':_0x5abc48[_0x0171('0x3b')]};return db[_0x0171('0x2b')][_0x0171('0x1b')](_0x22b524)[_0x0171('0x23')](function(_0x519759){_0x19b3e0[_0x0171('0x1b')]=_0x519759;if(_0x11d646[_0x0171('0x2f')][_0x0171('0x41')]){_0x5abc48[_0x0171('0x42')]=[{'all':!![]}];}return db[_0x0171('0x2b')]['findAll'](_0x5abc48);})['then'](function(_0x51304a){_0x19b3e0[_0x0171('0x43')]=_0x51304a;return _0x19b3e0;})[_0x0171('0x23')](respondWithFilteredResult(_0x361eff,_0x5abc48))[_0x0171('0x44')](handleError(_0x361eff,null));};exports['show']=function(_0x47e4bb,_0x52f067){var _0x179dd4={'raw':!![],'where':{'id':_0x47e4bb[_0x0171('0x45')]['id']}},_0x321c60={};_0x321c60[_0x0171('0x34')]=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x321c60[_0x0171('0x2f')]=_[_0x0171('0x30')](_0x47e4bb[_0x0171('0x2f')]);_0x321c60[_0x0171('0x31')]=_[_0x0171('0x32')](_0x321c60['model'],_0x321c60['query']);_0x179dd4[_0x0171('0x33')]=_[_0x0171('0x32')](_0x321c60[_0x0171('0x34')],qs[_0x0171('0x35')](_0x47e4bb['query'][_0x0171('0x35')]));_0x179dd4['attributes']=_0x179dd4[_0x0171('0x33')][_0x0171('0x36')]?_0x179dd4[_0x0171('0x33')]:_0x321c60[_0x0171('0x34')];if(_0x47e4bb['query'][_0x0171('0x41')]){_0x179dd4[_0x0171('0x42')]=[{'all':!![]}];}_0x179dd4=_[_0x0171('0x3d')]({},_0x179dd4,_0x47e4bb[_0x0171('0x40')]);return db[_0x0171('0x2b')][_0x0171('0x46')](_0x179dd4)[_0x0171('0x23')](handleEntityNotFound(_0x52f067,null))[_0x0171('0x23')](respondWithResult(_0x52f067,null))[_0x0171('0x44')](handleError(_0x52f067,null));};exports[_0x0171('0x47')]=function(_0xda9cb,_0x5bdc1f){return db[_0x0171('0x2b')][_0x0171('0x47')](_0xda9cb[_0x0171('0x48')],{})[_0x0171('0x23')](respondWithResult(_0x5bdc1f,0xc9))[_0x0171('0x44')](handleError(_0x5bdc1f,null));};exports[_0x0171('0x22')]=function(_0x4d4dc1,_0x3c1b7f){if(_0x4d4dc1['body']['id']){delete _0x4d4dc1[_0x0171('0x48')]['id'];}return db['ChatTransferReport'][_0x0171('0x46')]({'where':{'id':_0x4d4dc1[_0x0171('0x45')]['id']}})[_0x0171('0x23')](handleEntityNotFound(_0x3c1b7f,null))[_0x0171('0x23')](saveUpdates(_0x4d4dc1[_0x0171('0x48')],null))[_0x0171('0x23')](respondWithResult(_0x3c1b7f,null))[_0x0171('0x44')](handleError(_0x3c1b7f,null));};exports[_0x0171('0x49')]=function(_0x4722b4,_0x3b4d1a){return db['ChatTransferReport'][_0x0171('0x46')]({'where':{'id':_0x4722b4[_0x0171('0x45')]['id']}})[_0x0171('0x23')](handleEntityNotFound(_0x3b4d1a,null))[_0x0171('0x23')](removeEntity(_0x3b4d1a,null))['catch'](handleError(_0x3b4d1a,null));};exports['describe']=function(_0x4ea5d0,_0x481d31){return db['ChatTransferReport'][_0x0171('0x4a')]()[_0x0171('0x23')](respondWithResult(_0x481d31,null))[_0x0171('0x44')](handleError(_0x481d31,null));}; \ No newline at end of file +var _0x5b9c=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x4ded57,_0x3ce258){var _0x3ad7dc=function(_0x33a15d){while(--_0x33a15d){_0x4ded57['push'](_0x4ded57['shift']());}};_0x3ad7dc(++_0x3ce258);}(_0x5b9c,0x1ad));var _0xc5b9=function(_0x438f79,_0x6d4152){_0x438f79=_0x438f79-0x0;var _0x5ae3a7=_0x5b9c[_0x438f79];return _0x5ae3a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc5b9('0x0'));var rp=require(_0xc5b9('0x1'));var moment=require('moment');var BPromise=require(_0xc5b9('0x2'));var Mustache=require('mustache');var util=require(_0xc5b9('0x3'));var path=require('path');var sox=require(_0xc5b9('0x4'));var csv=require(_0xc5b9('0x5'));var ejs=require(_0xc5b9('0x6'));var fs=require('fs');var fs_extra=require(_0xc5b9('0x7'));var _=require(_0xc5b9('0x8'));var squel=require('squel');var crypto=require(_0xc5b9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc5b9('0xa'));var toCsv=require(_0xc5b9('0x5'));var querystring=require(_0xc5b9('0xb'));var Papa=require(_0xc5b9('0xc'));var Redis=require(_0xc5b9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc5b9('0xe'));var as=require(_0xc5b9('0xf'));var hardwareService=require(_0xc5b9('0x10'));var logger=require(_0xc5b9('0x11'))(_0xc5b9('0x12'));var utils=require(_0xc5b9('0x13'));var config=require(_0xc5b9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5b9('0x15'))['db'];function respondWithStatusCode(_0x284a9f,_0x568e0b){_0x568e0b=_0x568e0b||0xcc;return function(_0x3873c2){if(_0x3873c2){return _0x284a9f[_0xc5b9('0x16')](_0x568e0b);}return _0x284a9f[_0xc5b9('0x17')](_0x568e0b)[_0xc5b9('0x18')]();};}function respondWithResult(_0x591186,_0x2b3229){_0x2b3229=_0x2b3229||0xc8;return function(_0x20b22b){if(_0x20b22b){return _0x591186[_0xc5b9('0x17')](_0x2b3229)[_0xc5b9('0x19')](_0x20b22b);}};}function respondWithFilteredResult(_0x11ac51,_0x5f502f){return function(_0x457ec4){if(_0x457ec4){var _0xd8e719=typeof _0x5f502f[_0xc5b9('0x1a')]===_0xc5b9('0x1b')&&typeof _0x5f502f[_0xc5b9('0x1c')]===_0xc5b9('0x1b');var _0x2695cb=_0x457ec4[_0xc5b9('0x1d')];var _0x2f10b1=_0xd8e719?0x0:_0x5f502f[_0xc5b9('0x1a')];var _0x13ba66=_0xd8e719?_0x457ec4[_0xc5b9('0x1d')]:_0x5f502f[_0xc5b9('0x1a')]+_0x5f502f[_0xc5b9('0x1c')];var _0x519399;if(_0x13ba66>=_0x2695cb){_0x13ba66=_0x2695cb;_0x519399=0xc8;}else{_0x519399=0xce;}_0x11ac51[_0xc5b9('0x17')](_0x519399);return _0x11ac51[_0xc5b9('0x1e')](_0xc5b9('0x1f'),_0x2f10b1+'-'+_0x13ba66+'/'+_0x2695cb)[_0xc5b9('0x19')](_0x457ec4);}return null;};}function patchUpdates(_0x29a74c){return function(_0x26d0a0){try{jsonpatch[_0xc5b9('0x20')](_0x26d0a0,_0x29a74c,!![]);}catch(_0x121589){return BPromise[_0xc5b9('0x21')](_0x121589);}return _0x26d0a0[_0xc5b9('0x22')]();};}function saveUpdates(_0x20dc77,_0x16b914){return function(_0x478216){if(_0x478216){return _0x478216[_0xc5b9('0x23')](_0x20dc77)[_0xc5b9('0x24')](function(_0x1c5f54){return _0x1c5f54;});}return null;};}function removeEntity(_0x1e8c50,_0x58dae7){return function(_0x5166e3){if(_0x5166e3){return _0x5166e3[_0xc5b9('0x25')]()[_0xc5b9('0x24')](function(){_0x1e8c50['status'](0xcc)[_0xc5b9('0x18')]();});}};}function handleEntityNotFound(_0x375498,_0x21266a){return function(_0x5dba90){if(!_0x5dba90){_0x375498[_0xc5b9('0x16')](0x194);}return _0x5dba90;};}function handleError(_0x5846ae,_0x5a9b41){_0x5a9b41=_0x5a9b41||0x1f4;return function(_0x58d9c3){logger[_0xc5b9('0x26')](_0x58d9c3[_0xc5b9('0x27')]);if(_0x58d9c3['name']){delete _0x58d9c3[_0xc5b9('0x28')];}_0x5846ae[_0xc5b9('0x17')](_0x5a9b41)[_0xc5b9('0x29')](_0x58d9c3);};}exports[_0xc5b9('0x2a')]=function(_0x50225a,_0x2d4ad1){var _0xe9010={},_0x3d3ba8={},_0x57ee58={'count':0x0,'rows':[]};var _0x97c0a5=_[_0xc5b9('0x2b')](db['ChatTransferReport'][_0xc5b9('0x2c')],function(_0x41fdae){return{'name':_0x41fdae[_0xc5b9('0x2d')],'type':_0x41fdae[_0xc5b9('0x2e')][_0xc5b9('0x2f')]};});_0x3d3ba8[_0xc5b9('0x30')]=_[_0xc5b9('0x2b')](_0x97c0a5,_0xc5b9('0x28'));_0x3d3ba8[_0xc5b9('0x31')]=_[_0xc5b9('0x32')](_0x50225a['query']);_0x3d3ba8[_0xc5b9('0x33')]=_['intersection'](_0x3d3ba8[_0xc5b9('0x30')],_0x3d3ba8[_0xc5b9('0x31')]);_0xe9010['attributes']=_[_0xc5b9('0x34')](_0x3d3ba8[_0xc5b9('0x30')],qs[_0xc5b9('0x35')](_0x50225a[_0xc5b9('0x31')]['fields']));_0xe9010[_0xc5b9('0x36')]=_0xe9010[_0xc5b9('0x36')][_0xc5b9('0x37')]?_0xe9010['attributes']:_0x3d3ba8[_0xc5b9('0x30')];if(!_0x50225a[_0xc5b9('0x31')][_0xc5b9('0x38')](_0xc5b9('0x39'))){_0xe9010[_0xc5b9('0x1c')]=qs[_0xc5b9('0x1c')](_0x50225a[_0xc5b9('0x31')][_0xc5b9('0x1c')]);_0xe9010[_0xc5b9('0x1a')]=qs[_0xc5b9('0x1a')](_0x50225a['query'][_0xc5b9('0x1a')]);}_0xe9010[_0xc5b9('0x3a')]=qs['sort'](_0x50225a[_0xc5b9('0x31')][_0xc5b9('0x3b')]);_0xe9010['where']=qs[_0xc5b9('0x33')](_[_0xc5b9('0x3c')](_0x50225a[_0xc5b9('0x31')],_0x3d3ba8[_0xc5b9('0x33')]),_0x97c0a5);if(_0x50225a[_0xc5b9('0x31')][_0xc5b9('0x3d')]){_0xe9010['where']=_[_0xc5b9('0x3e')](_0xe9010[_0xc5b9('0x3f')],{'$or':_['map'](_0x97c0a5,function(_0x41869c){if(_0x41869c['type']!==_0xc5b9('0x40')){var _0x302412={};_0x302412[_0x41869c[_0xc5b9('0x28')]]={'$like':'%'+_0x50225a[_0xc5b9('0x31')][_0xc5b9('0x3d')]+'%'};return _0x302412;}})});}_0xe9010=_['merge']({},_0xe9010,_0x50225a[_0xc5b9('0x41')]);var _0x3eb874={'where':_0xe9010['where']};return db[_0xc5b9('0x42')][_0xc5b9('0x1d')](_0x3eb874)[_0xc5b9('0x24')](function(_0x353d7a){_0x57ee58['count']=_0x353d7a;if(_0x50225a[_0xc5b9('0x31')][_0xc5b9('0x43')]){_0xe9010[_0xc5b9('0x44')]=[{'all':!![]}];}return db[_0xc5b9('0x42')][_0xc5b9('0x45')](_0xe9010);})['then'](function(_0x379a6b){_0x57ee58[_0xc5b9('0x46')]=_0x379a6b;return _0x57ee58;})[_0xc5b9('0x24')](respondWithFilteredResult(_0x2d4ad1,_0xe9010))[_0xc5b9('0x47')](handleError(_0x2d4ad1,null));};exports[_0xc5b9('0x48')]=function(_0x54df4b,_0x220500){var _0x8be259={'raw':!![],'where':{'id':_0x54df4b['params']['id']}},_0x445095={};_0x445095[_0xc5b9('0x30')]=_[_0xc5b9('0x32')](db[_0xc5b9('0x42')][_0xc5b9('0x2c')]);_0x445095['query']=_[_0xc5b9('0x32')](_0x54df4b[_0xc5b9('0x31')]);_0x445095['filters']=_[_0xc5b9('0x34')](_0x445095[_0xc5b9('0x30')],_0x445095['query']);_0x8be259[_0xc5b9('0x36')]=_['intersection'](_0x445095[_0xc5b9('0x30')],qs[_0xc5b9('0x35')](_0x54df4b[_0xc5b9('0x31')]['fields']));_0x8be259[_0xc5b9('0x36')]=_0x8be259[_0xc5b9('0x36')][_0xc5b9('0x37')]?_0x8be259[_0xc5b9('0x36')]:_0x445095[_0xc5b9('0x30')];if(_0x54df4b[_0xc5b9('0x31')]['includeAll']){_0x8be259['include']=[{'all':!![]}];}_0x8be259=_[_0xc5b9('0x3e')]({},_0x8be259,_0x54df4b['options']);return db[_0xc5b9('0x42')][_0xc5b9('0x49')](_0x8be259)[_0xc5b9('0x24')](handleEntityNotFound(_0x220500,null))[_0xc5b9('0x24')](respondWithResult(_0x220500,null))['catch'](handleError(_0x220500,null));};exports[_0xc5b9('0x4a')]=function(_0x2afa44,_0x24ffc5){return db[_0xc5b9('0x42')][_0xc5b9('0x4a')](_0x2afa44[_0xc5b9('0x4b')],{})[_0xc5b9('0x24')](respondWithResult(_0x24ffc5,0xc9))[_0xc5b9('0x47')](handleError(_0x24ffc5,null));};exports[_0xc5b9('0x23')]=function(_0x27544c,_0x5baf47){if(_0x27544c[_0xc5b9('0x4b')]['id']){delete _0x27544c['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x27544c['params']['id']}})['then'](handleEntityNotFound(_0x5baf47,null))[_0xc5b9('0x24')](saveUpdates(_0x27544c[_0xc5b9('0x4b')],null))[_0xc5b9('0x24')](respondWithResult(_0x5baf47,null))['catch'](handleError(_0x5baf47,null));};exports[_0xc5b9('0x25')]=function(_0x1b51b4,_0x5c3508){return db[_0xc5b9('0x42')][_0xc5b9('0x49')]({'where':{'id':_0x1b51b4[_0xc5b9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c3508,null))[_0xc5b9('0x24')](removeEntity(_0x5c3508,null))['catch'](handleError(_0x5c3508,null));};exports[_0xc5b9('0x4d')]=function(_0x2deea5,_0x8011de){return db[_0xc5b9('0x42')][_0xc5b9('0x4d')]()[_0xc5b9('0x24')](respondWithResult(_0x8011de,null))[_0xc5b9('0x47')](handleError(_0x8011de,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 70ec0e9..57ee8ce 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 _0xebce=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid'];(function(_0x3b4b14,_0x19bc14){var _0x16b898=function(_0x5de1cd){while(--_0x5de1cd){_0x3b4b14['push'](_0x3b4b14['shift']());}};_0x16b898(++_0x19bc14);}(_0xebce,0x16b));var _0xeebc=function(_0x39c8f2,_0x23df6c){_0x39c8f2=_0x39c8f2-0x0;var _0x445526=_0xebce[_0x39c8f2];return _0x445526;};'use strict';var _=require('lodash');var util=require(_0xeebc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xeebc('0x1'));var BPromise=require(_0xeebc('0x2'));var rp=require(_0xeebc('0x3'));var fs=require('fs');var path=require(_0xeebc('0x4'));var rimraf=require(_0xeebc('0x5'));var config=require(_0xeebc('0x6'));var attributes=require(_0xeebc('0x7'));module[_0xeebc('0x8')]=function(_0x527fb9,_0x114522){return _0x527fb9['define'](_0xeebc('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeebc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09e8=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid'];(function(_0x5d2465,_0x3e2916){var _0x11c10c=function(_0x50eb0b){while(--_0x50eb0b){_0x5d2465['push'](_0x5d2465['shift']());}};_0x11c10c(++_0x3e2916);}(_0x09e8,0x1b0));var _0x809e=function(_0x1c06be,_0x31153c){_0x1c06be=_0x1c06be-0x0;var _0x237925=_0x09e8[_0x1c06be];return _0x237925;};'use strict';var _=require(_0x809e('0x0'));var util=require(_0x809e('0x1'));var logger=require(_0x809e('0x2'))('api');var moment=require(_0x809e('0x3'));var BPromise=require(_0x809e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x809e('0x5'));var config=require(_0x809e('0x6'));var attributes=require(_0x809e('0x7'));module[_0x809e('0x8')]=function(_0x5c6093,_0x27856f){return _0x5c6093[_0x809e('0x9')](_0x809e('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x809e('0xb'),'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 78692aa..d8403fb 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 _0x4be5=['request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x4be5,0xa5));var _0x54be=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x4be5[_0x359bbe];return _0x1b3353;};'use strict';var _=require('lodash');var util=require(_0x54be('0x0'));var moment=require(_0x54be('0x1'));var BPromise=require(_0x54be('0x2'));var rs=require(_0x54be('0x3'));var fs=require('fs');var Redis=require(_0x54be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x54be('0x5'));var logger=require(_0x54be('0x6'))(_0x54be('0x7'));var config=require(_0x54be('0x8'));var jayson=require(_0x54be('0x9'));var client=jayson['client'][_0x54be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32084a,_0x2f4b05,_0x2e3f63){return new BPromise(function(_0x118dd0,_0x31cd8f){return client[_0x54be('0xb')](_0x32084a,_0x2e3f63)[_0x54be('0xc')](function(_0x15554c){logger[_0x54be('0xd')](_0x54be('0xe'),_0x2f4b05,'request\x20sent');logger[_0x54be('0xf')](_0x54be('0x10'),_0x2f4b05,_0x54be('0x11'),JSON[_0x54be('0x12')](_0x15554c));if(_0x15554c[_0x54be('0x13')]){if(_0x15554c[_0x54be('0x13')][_0x54be('0x14')]===0x1f4){logger[_0x54be('0x13')](_0x54be('0xe'),_0x2f4b05,_0x15554c['error'][_0x54be('0x15')]);return _0x31cd8f(_0x15554c[_0x54be('0x13')]['message']);}logger['error'](_0x54be('0xe'),_0x2f4b05,_0x15554c[_0x54be('0x13')]['message']);return _0x118dd0(_0x15554c['error'][_0x54be('0x15')]);}else{logger['info'](_0x54be('0xe'),_0x2f4b05,_0x54be('0x11'));_0x118dd0(_0x15554c['result'][_0x54be('0x15')]);}})['catch'](function(_0x477565){logger[_0x54be('0x13')](_0x54be('0xe'),_0x2f4b05,_0x477565);_0x31cd8f(_0x477565);});});} \ No newline at end of file +var _0xde21=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x2ebe96,_0x554634){var _0x3c64cc=function(_0x44f90c){while(--_0x44f90c){_0x2ebe96['push'](_0x2ebe96['shift']());}};_0x3c64cc(++_0x554634);}(_0xde21,0x128));var _0x1de2=function(_0x4e0944,_0x439b17){_0x4e0944=_0x4e0944-0x0;var _0x3c6010=_0xde21[_0x4e0944];return _0x3c6010;};'use strict';var _=require(_0x1de2('0x0'));var util=require(_0x1de2('0x1'));var moment=require(_0x1de2('0x2'));var BPromise=require('bluebird');var rs=require(_0x1de2('0x3'));var fs=require('fs');var Redis=require(_0x1de2('0x4'));var db=require(_0x1de2('0x5'))['db'];var utils=require(_0x1de2('0x6'));var logger=require(_0x1de2('0x7'))(_0x1de2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1de2('0x9')][_0x1de2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x317d78,_0x2ccd33,_0x42199a){return new BPromise(function(_0x5dac77,_0x482180){return client[_0x1de2('0xb')](_0x317d78,_0x42199a)[_0x1de2('0xc')](function(_0x414747){logger['info'](_0x1de2('0xd'),_0x2ccd33,_0x1de2('0xe'));logger['debug'](_0x1de2('0xf'),_0x2ccd33,'request\x20sent',JSON['stringify'](_0x414747));if(_0x414747[_0x1de2('0x10')]){if(_0x414747[_0x1de2('0x10')]['code']===0x1f4){logger['error'](_0x1de2('0xd'),_0x2ccd33,_0x414747['error'][_0x1de2('0x11')]);return _0x482180(_0x414747[_0x1de2('0x10')][_0x1de2('0x11')]);}logger[_0x1de2('0x10')](_0x1de2('0xd'),_0x2ccd33,_0x414747[_0x1de2('0x10')][_0x1de2('0x11')]);return _0x5dac77(_0x414747[_0x1de2('0x10')][_0x1de2('0x11')]);}else{logger[_0x1de2('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2ccd33,_0x1de2('0xe'));_0x5dac77(_0x414747[_0x1de2('0x13')]['message']);}})[_0x1de2('0x14')](function(_0x28e30f){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2ccd33,_0x28e30f);_0x482180(_0x28e30f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d72f2ec..05308f8 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 _0x95dc=['get','isAuthenticated','describe','show','put','update','delete','/:id','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller'];(function(_0x328358,_0x59c946){var _0x3fc1d0=function(_0x364f29){while(--_0x364f29){_0x328358['push'](_0x328358['shift']());}};_0x3fc1d0(++_0x59c946);}(_0x95dc,0x99));var _0xc95d=function(_0x4ff444,_0x5dbb45){_0x4ff444=_0x4ff444-0x0;var _0x533fbd=_0x95dc[_0x4ff444];return _0x533fbd;};'use strict';var multer=require(_0xc95d('0x0'));var util=require(_0xc95d('0x1'));var path=require(_0xc95d('0x2'));var timeout=require('connect-timeout');var express=require(_0xc95d('0x3'));var router=express[_0xc95d('0x4')]();var fs_extra=require(_0xc95d('0x5'));var auth=require(_0xc95d('0x6'));var interaction=require(_0xc95d('0x7'));var config=require('../../config/environment');var controller=require(_0xc95d('0x8'));router[_0xc95d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc95d('0x9')]('/describe',auth[_0xc95d('0xa')](),controller[_0xc95d('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc95d('0xc')]);router['post']('/',auth[_0xc95d('0xa')](),controller['create']);router[_0xc95d('0xd')]('/:id',auth[_0xc95d('0xa')](),controller[_0xc95d('0xe')]);router[_0xc95d('0xf')](_0xc95d('0x10'),auth[_0xc95d('0xa')](),controller[_0xc95d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcbe5=['show','put','/:id','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get'];(function(_0x590d48,_0x12b03a){var _0x3bcc73=function(_0x335f09){while(--_0x335f09){_0x590d48['push'](_0x590d48['shift']());}};_0x3bcc73(++_0x12b03a);}(_0xcbe5,0xd7));var _0x5cbe=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcbe5[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x5cbe('0x0'));var util=require(_0x5cbe('0x1'));var path=require(_0x5cbe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5cbe('0x3')]();var fs_extra=require(_0x5cbe('0x4'));var auth=require(_0x5cbe('0x5'));var interaction=require(_0x5cbe('0x6'));var config=require(_0x5cbe('0x7'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x5cbe('0x8')](),controller[_0x5cbe('0x9')]);router['get'](_0x5cbe('0xa'),auth[_0x5cbe('0x8')](),controller[_0x5cbe('0xb')]);router[_0x5cbe('0xc')]('/:id',auth[_0x5cbe('0x8')](),controller[_0x5cbe('0xd')]);router['post']('/',auth[_0x5cbe('0x8')](),controller['create']);router[_0x5cbe('0xe')](_0x5cbe('0xf'),auth[_0x5cbe('0x8')](),controller[_0x5cbe('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5cbe('0x11')]);module[_0x5cbe('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 10f0532..6298323 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 _0xc7a8=['#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','name','text','input','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A'];(function(_0x212306,_0x2fd0f5){var _0x55f2a2=function(_0x345de8){while(--_0x345de8){_0x212306['push'](_0x212306['shift']());}};_0x55f2a2(++_0x2fd0f5);}(_0xc7a8,0x165));var _0x8c7a=function(_0x278a5b,_0x326b82){_0x278a5b=_0x278a5b-0x0;var _0x579e7f=_0xc7a8[_0x278a5b];return _0x579e7f;};'use strict';var Sequelize=require(_0x8c7a('0x0'));var rs=require(_0x8c7a('0x1'));module[_0x8c7a('0x2')]={'name':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8c7a('0x3')]},'mapKey':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x4')},'key':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x5')},'customerAlias':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![],'defaultValue':_0x8c7a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![],'defaultValue':_0x8c7a('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8c7a('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8c7a('0x3')]},'animation':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8c7a('0xa')](_0x8c7a('0xb'),'squared'),'defaultValue':_0x8c7a('0xb')},'header_online':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0xc')},'start_chat_button':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0xd')},'offline_chat_button':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8c7a('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8c7a('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x12')},'noteTitle':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x13')},'placeholderMessage':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0x8c7a('0x18'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8c7a('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x8c7a('0x19'),'type':_0x8c7a('0x1a'),'required':!![]},'props':{'title':_0x8c7a('0x19'),'helpText':''}},{'type':_0x8c7a('0x1b'),'props':{'title':_0x8c7a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8c7a('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8c7a('0x1c')](_0x8c7a('0x1d'))?JSON['parse'](this[_0x8c7a('0x1c')]('onlineForm')):{};},'set':function(_0x5266f1){return this[_0x8c7a('0x1e')]('onlineForm',JSON[_0x8c7a('0x1f')](_0x5266f1));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8c7a('0x1b'),'props':{'title':_0x8c7a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8c7a('0x4'),'type':_0x8c7a('0x4')},'variable':null},{'type':_0x8c7a('0x20'),'config':{'placeholder':_0x8c7a('0x21')},'props':{'title':'Comments','helpText':_0x8c7a('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x8c7a('0x1c')](_0x8c7a('0x23'))?JSON[_0x8c7a('0x24')](this[_0x8c7a('0x1c')](_0x8c7a('0x23'))):{};},'set':function(_0x3ce590){return this[_0x8c7a('0x1e')](_0x8c7a('0x23'),JSON[_0x8c7a('0x1f')](_0x3ce590));}},'token':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':function(){return rs[_0x8c7a('0x25')]();}},'autoclose':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x27')},'offlineMessageBody':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8c7a('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8c7a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8c7a('0x10')],'defaultValue':function(){return _0x8c7a('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c7a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8c7a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':_0x8c7a('0x2c')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x8c7a('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8c7a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c7a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x8c7a('0x2e')},'systemAvatar':{'type':Sequelize[_0x8c7a('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c7a('0x8')],'comment':_0x8c7a('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![],'comment':_0x8c7a('0x30'),'set':function(_0x42b0a9){if(!_0x42b0a9)this[_0x8c7a('0x1e')](_0x8c7a('0x31'),null);this['setDataValue']('mandatoryDisposition',_0x42b0a9);}},'vidaooEscalation':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8c7a('0x3')]},'vidaooTopic':{'type':Sequelize[_0x8c7a('0x3')],'allowNull':![],'defaultValue':_0x8c7a('0x32')},'vidaooNote':{'type':Sequelize[_0x8c7a('0x3')],'defaultValue':function(){return _0x8c7a('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8c7a('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8c7a('0x10')]}}; \ No newline at end of file +var _0x3d04=['address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','textarea','Comments','parse','offlineForm','setDataValue','generate','New\x20offline\x20message\x20from\x20websiteName','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','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING'];(function(_0xf8fa35,_0x3981af){var _0xf34f7f=function(_0x4c49d8){while(--_0x4c49d8){_0xf8fa35['push'](_0xf8fa35['shift']());}};_0xf34f7f(++_0x3981af);}(_0x3d04,0x8f));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x43d0('0x0'));var rs=require(_0x43d0('0x1'));module[_0x43d0('0x2')]={'name':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x43d0('0x4')},'description':{'type':Sequelize[_0x43d0('0x3')]},'mapKey':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x5')},'mapKeyOffline':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x5')},'key':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':_0x43d0('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':_0x43d0('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':_0x43d0('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x43d0('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x43d0('0x3')]},'animation':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x43d0('0xb')](_0x43d0('0xc'),'squared'),'defaultValue':_0x43d0('0xc')},'header_online':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x43d0('0xe')},'header_offline':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x43d0('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x43d0('0x11')]},'closingQuestion':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x43d0('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x14')},'closingMessage':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0xe')},'skipMessageButton':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x16')},'ratingType':{'type':Sequelize[_0x43d0('0xb')](_0x43d0('0x17'),_0x43d0('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x43d0('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x43d0('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x43d0('0x1a'),'type':_0x43d0('0x1b'),'required':!![]},'props':{'title':_0x43d0('0x1a'),'helpText':''}},{'type':_0x43d0('0x1c'),'props':{'title':_0x43d0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x43d0('0x5'),'type':_0x43d0('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x43d0('0x1d')](_0x43d0('0x1e'))?JSON['parse'](this['getDataValue'](_0x43d0('0x1e'))):{};},'set':function(_0x48cb8c){return this['setDataValue'](_0x43d0('0x1e'),JSON[_0x43d0('0x19')](_0x48cb8c));}},'offlineForm':{'type':Sequelize[_0x43d0('0x11')],'defaultValue':function(){return JSON[_0x43d0('0x19')]({'items':[{'type':_0x43d0('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x43d0('0x5')},'variable':null},{'type':_0x43d0('0x1f'),'config':{'placeholder':_0x43d0('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x43d0('0x21')](this[_0x43d0('0x1d')](_0x43d0('0x22'))):{};},'set':function(_0x1ac517){return this[_0x43d0('0x23')]('offlineForm',JSON[_0x43d0('0x19')](_0x1ac517));}},'token':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':function(){return rs[_0x43d0('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x43d0('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x43d0('0x3')]},'waitingTitle':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x25')},'offlineMessageBody':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x43d0('0x26')},'skipUnmanaged':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x43d0('0x3')]},'notificationTemplate':{'type':Sequelize[_0x43d0('0x11')],'defaultValue':function(){return _0x43d0('0x27');}},'notificationSound':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x43d0('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x43d0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x29')},'verticalAlignment':{'type':Sequelize[_0x43d0('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x2a')},'messagesAlignment':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x43d0('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x43d0('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x43d0('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43d0('0x9')],'comment':_0x43d0('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![],'comment':_0x43d0('0x2c'),'set':function(_0x47ad65){if(!_0x47ad65)this[_0x43d0('0x23')](_0x43d0('0x2d'),null);this[_0x43d0('0x23')](_0x43d0('0x2e'),_0x47ad65);}},'vidaooEscalation':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':_0x43d0('0x2f')},'vidaooNote':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':function(){return _0x43d0('0x30');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x43d0('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 85215ab..aa4888d 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 _0xb533=['sendStatus','status','offset','limit','undefined','count','Content-Range','json','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','key','map','keys','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','update','describe','addDisposition','ChatWebsiteId','getDispositions','hasOwnProperty','nolimit','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','chat','From\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','customerIp','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','defaults','from','contact','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','Start','startRouting','EventManager','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','timezone','server/files/chat/iframe.ejs','3.12.1','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','redis','socket.io-emitter','client','http','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatWebsite,\x20%s,\x20%s'];(function(_0x41a9b8,_0x3051f1){var _0x5e0120=function(_0x51f2e4){while(--_0x51f2e4){_0x41a9b8['push'](_0x41a9b8['shift']());}};_0x5e0120(++_0x3051f1);}(_0xb533,0x119));var _0x3b53=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb533[_0x32f7d7];return _0x133d09;};'use strict';var Mustache=require(_0x3b53('0x0'));var util=require(_0x3b53('0x1'));var path=require('path');var ejs=require(_0x3b53('0x2'));var fs=require('fs');var fs_extra=require(_0x3b53('0x3'));var _=require('lodash');var querystring=require('querystring');var htmlToText=require(_0x3b53('0x4'));var Redis=require(_0x3b53('0x5'));var jayson=require(_0x3b53('0x6'));var qs=require(_0x3b53('0x7'));var logger=require(_0x3b53('0x8'))(_0x3b53('0x9'));var config=require(_0x3b53('0xa'));var APIBadRequestError=require(_0x3b53('0xb'))[_0x3b53('0xc')];var APINotFoundError=require(_0x3b53('0xb'))[_0x3b53('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0x3b53('0xe')];var APIHandleError=require(_0x3b53('0xb'))[_0x3b53('0xf')];var APIConflictError=require('../../errors/api')['APIConflictError'];var wildcardUtils=require(_0x3b53('0x10'));var URL=require(_0x3b53('0x11'))[_0x3b53('0x12')];var db=require('../../mysqldb')['db'];config[_0x3b53('0x13')]=_['defaults'](config[_0x3b53('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b53('0x14'))(new Redis(config[_0x3b53('0x13')]));require('./chatWebsite.socket')['register'](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3b53('0x15')][_0x3b53('0x16')]({'port':0x232a});var client9003=jayson[_0x3b53('0x15')][_0x3b53('0x16')]({'port':0x232b});var client9001=jayson['client'][_0x3b53('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x1573e5,_0x3869a5,_0x2b531d,_0xd41db0){return new Promise(function(_0x1c8804,_0xb663c1){var _0x54d3ae=_0xd41db0||client;return _0x54d3ae['request'](_0x1573e5,_0x2b531d)[_0x3b53('0x17')](function(_0x10ba94){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3869a5,_0x3b53('0x18'));logger[_0x3b53('0x19')](_0x3b53('0x1a'),_0x3869a5,'request\x20sent',JSON[_0x3b53('0x1b')](_0x10ba94));if(_0x10ba94[_0x3b53('0x1c')]){if(_0x10ba94[_0x3b53('0x1c')][_0x3b53('0x1d')]===0x1f4){logger[_0x3b53('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x3869a5,_0x10ba94[_0x3b53('0x1c')][_0x3b53('0x1e')]);return _0xb663c1(_0x10ba94[_0x3b53('0x1c')][_0x3b53('0x1e')]);}logger[_0x3b53('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x3869a5,_0x10ba94[_0x3b53('0x1c')]['message']);return _0x1c8804(_0x10ba94['error'][_0x3b53('0x1e')]);}else{logger[_0x3b53('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x3869a5,_0x3b53('0x18'));_0x1c8804(_0x10ba94[_0x3b53('0x20')]['message']);}})[_0x3b53('0x21')](function(_0x3075e3){logger[_0x3b53('0x1c')](_0x3b53('0x22'),_0x3869a5,_0x3075e3);_0xb663c1(_0x3075e3);});});}function respondWithStatusCode(_0x289ebd,_0x3ab06e){_0x3ab06e=_0x3ab06e||0xcc;return function(_0x129493){if(_0x129493){return _0x289ebd[_0x3b53('0x23')](_0x3ab06e);}return _0x289ebd['status'](_0x3ab06e)['end']();};}function respondWithResult(_0x9c5517,_0x4aedaa){_0x4aedaa=_0x4aedaa||0xc8;return function(_0x202a80){if(_0x202a80){return _0x9c5517[_0x3b53('0x24')](_0x4aedaa)['json'](_0x202a80);}};}function respondWithFilteredResult(_0x253ca9,_0x8231d2){return function(_0x536832){if(_0x536832){var _0x45b833=typeof _0x8231d2[_0x3b53('0x25')]==='undefined'&&typeof _0x8231d2[_0x3b53('0x26')]===_0x3b53('0x27');var _0x3b83d4=_0x536832[_0x3b53('0x28')];var _0xa6ae13=_0x45b833?0x0:_0x8231d2['offset'];var _0x1262f6=_0x45b833?_0x536832['count']:_0x8231d2[_0x3b53('0x25')]+_0x8231d2[_0x3b53('0x26')];var _0xf0d959;if(_0x1262f6>=_0x3b83d4){_0x1262f6=_0x3b83d4;_0xf0d959=0xc8;}else{_0xf0d959=0xce;}_0x253ca9['status'](_0xf0d959);return _0x253ca9['set'](_0x3b53('0x29'),_0xa6ae13+'-'+_0x1262f6+'/'+_0x3b83d4)[_0x3b53('0x2a')](_0x536832);}return null;};}function saveUpdates(_0x334607){return function(_0x53a338){if(_0x53a338){return _0x53a338['update'](_0x334607)[_0x3b53('0x17')](function(_0x102825){return _0x102825;});}return null;};}function removeEntity(_0x52b5e5){return function(_0x712e47){if(_0x712e47){return _0x712e47[_0x3b53('0x2b')]()[_0x3b53('0x17')](function(){var _0x1a5fe1=_0x712e47[_0x3b53('0x2c')]({'plain':!![]});var _0x1c9459=_0x3b53('0x2d');return db[_0x3b53('0x2e')]['destroy']({'where':{'type':_0x1c9459,'resourceId':_0x1a5fe1['id']}})[_0x3b53('0x17')](function(){return _0x712e47;});})[_0x3b53('0x17')](function(){_0x52b5e5[_0x3b53('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39afc7){return function(_0x442d74){if(!_0x442d74){_0x39afc7['sendStatus'](0x194);}return _0x442d74;};}function handleError(_0x1f2b62,_0x4f1389){_0x4f1389=_0x4f1389||0x1f4;return function(_0x1b929b){logger[_0x3b53('0x1c')](_0x1b929b[_0x3b53('0x2f')]);if(_0x1b929b[_0x3b53('0x30')]){delete _0x1b929b['name'];}_0x1f2b62[_0x3b53('0x24')](_0x4f1389)[_0x3b53('0x31')](_0x1b929b);};}function createInteractionObject(_0x25828d,_0x1e5d8d,_0x5d44df,_0x3c0484){var _0x1aea4a=require(_0x3b53('0x32'));var _0x4e77ad=new _0x1aea4a();var _0x56c851=_0x4e77ad[_0x3b53('0x33')](_0x5d44df[_0x3b53('0x34')])['getResult']();var _0x5686ee=_0x1e5d8d['customerIp'];if(_0x5d44df[_0x3b53('0x35')]){_0x5686ee=_0x5d44df['cf-connecting-ip'];}else if(_0x5d44df[_0x3b53('0x36')]){_0x5686ee=_[_0x3b53('0x37')](_0x5d44df[_0x3b53('0x36')][_0x3b53('0x38')](','));}return{'ContactId':_0x3c0484['id'],'ChatWebsiteId':_0x25828d,'from':(_0x3c0484[_0x3b53('0x39')]||'')+'\x20'+(_0x3c0484[_0x3b53('0x3a')]||''),'customerIp':_0x5686ee,'customerPort':_0x5d44df[_0x3b53('0x3b')]?_0x5d44df[_0x3b53('0x3b')]:null,'referer':_0x1e5d8d[_0x3b53('0x3c')],'browserName':_0x56c851['browser'][_0x3b53('0x30')]&&_0x56c851[_0x3b53('0x3d')][_0x3b53('0x3e')]?util[_0x3b53('0x3f')](_0x3b53('0x40'),_0x56c851[_0x3b53('0x3d')][_0x3b53('0x30')],_0x56c851[_0x3b53('0x3d')][_0x3b53('0x3e')]):'unknown','browserVersion':_0x56c851['browser'][_0x3b53('0x3e')]||'unknown','osName':util[_0x3b53('0x3f')](_0x3b53('0x40'),_0x56c851['os'][_0x3b53('0x30')],_0x56c851['os'][_0x3b53('0x3e')]),'osVersion':_0x56c851['os']['version'],'deviceModel':_0x56c851['device'][_0x3b53('0x41')]&&_0x56c851[_0x3b53('0x42')][_0x3b53('0x43')]?util[_0x3b53('0x3f')](_0x3b53('0x44'),_0x56c851[_0x3b53('0x42')][_0x3b53('0x41')],_0x56c851[_0x3b53('0x42')][_0x3b53('0x43')],_0x56c851[_0x3b53('0x42')][_0x3b53('0x45')]):null,'deviceVendor':_0x56c851[_0x3b53('0x42')][_0x3b53('0x43')],'deviceType':_0x56c851[_0x3b53('0x42')][_0x3b53('0x45')],'formData':JSON[_0x3b53('0x1b')](_0x1e5d8d)};}exports[_0x3b53('0x46')]=function(_0x51fbc8,_0x53c6fb){var _0x473aff={'include':[{'model':db[_0x3b53('0x47')],'as':_0x3b53('0x48')}]},_0x433585={},_0x200d62={'count':0x0,'rows':[]};var _0x3df2a6=_['map'](db[_0x3b53('0x49')]['rawAttributes'],function(_0x2de3f8){return{'name':_0x2de3f8[_0x3b53('0x4a')],'type':_0x2de3f8[_0x3b53('0x45')][_0x3b53('0x4b')]};});_0x433585[_0x3b53('0x41')]=_[_0x3b53('0x4c')](_0x3df2a6,_0x3b53('0x30'));_0x433585['query']=_[_0x3b53('0x4d')](_0x51fbc8[_0x3b53('0x4e')]);_0x433585[_0x3b53('0x4f')]=_['intersection'](_0x433585[_0x3b53('0x41')],_0x433585[_0x3b53('0x4e')]);_0x473aff[_0x3b53('0x50')]=_[_0x3b53('0x51')](_0x433585['model'],qs[_0x3b53('0x52')](_0x51fbc8[_0x3b53('0x4e')][_0x3b53('0x52')]));_0x473aff[_0x3b53('0x50')]=_0x473aff[_0x3b53('0x50')]['length']?_0x473aff[_0x3b53('0x50')]:_0x433585[_0x3b53('0x41')];if(!_0x51fbc8[_0x3b53('0x4e')]['hasOwnProperty']('nolimit')){_0x473aff['limit']=qs[_0x3b53('0x26')](_0x51fbc8['query'][_0x3b53('0x26')]);_0x473aff[_0x3b53('0x25')]=qs[_0x3b53('0x25')](_0x51fbc8[_0x3b53('0x4e')]['offset']);}_0x473aff[_0x3b53('0x53')]=qs[_0x3b53('0x54')](_0x51fbc8[_0x3b53('0x4e')][_0x3b53('0x54')]);_0x473aff['where']=qs['filters'](_[_0x3b53('0x55')](_0x51fbc8[_0x3b53('0x4e')],_0x433585[_0x3b53('0x4f')]),_0x3df2a6);if(_0x51fbc8[_0x3b53('0x4e')][_0x3b53('0x56')]){_0x473aff[_0x3b53('0x57')]=_[_0x3b53('0x58')](_0x473aff[_0x3b53('0x57')],{'$or':_['map'](_0x3df2a6,function(_0x32f3b1){if(_0x32f3b1[_0x3b53('0x45')]!==_0x3b53('0x59')){var _0x36bd53={};_0x36bd53[_0x32f3b1[_0x3b53('0x30')]]={'$like':'%'+_0x51fbc8[_0x3b53('0x4e')][_0x3b53('0x56')]+'%'};return _0x36bd53;}})});}_0x473aff=_[_0x3b53('0x58')]({},_0x473aff,_0x51fbc8[_0x3b53('0x5a')]);var _0x5ded0e={'where':_0x473aff['where']};return db[_0x3b53('0x49')][_0x3b53('0x28')](_0x5ded0e)[_0x3b53('0x17')](function(_0x587147){_0x200d62[_0x3b53('0x28')]=_0x587147;if(_0x51fbc8[_0x3b53('0x4e')][_0x3b53('0x5b')]){_0x473aff[_0x3b53('0x5c')]=[{'all':!![]}];}return db[_0x3b53('0x49')][_0x3b53('0x5d')](_0x473aff);})['then'](function(_0x7f27ba){_0x200d62[_0x3b53('0x5e')]=_0x7f27ba;return _0x200d62;})[_0x3b53('0x17')](respondWithFilteredResult(_0x53c6fb,_0x473aff))['catch'](handleError(_0x53c6fb,null));};exports[_0x3b53('0x5f')]=function(_0x315ac4,_0x5a0765){var _0x4c7cb9={'raw':![],'where':{'id':_0x315ac4[_0x3b53('0x60')]['id']},'include':[{'model':db[_0x3b53('0x47')],'as':_0x3b53('0x48')}]},_0x17fdc4={};_0x17fdc4[_0x3b53('0x41')]=_[_0x3b53('0x4d')](db['ChatWebsite'][_0x3b53('0x61')]);_0x17fdc4[_0x3b53('0x4e')]=_['keys'](_0x315ac4[_0x3b53('0x4e')]);_0x17fdc4[_0x3b53('0x4f')]=_['intersection'](_0x17fdc4[_0x3b53('0x41')],_0x17fdc4[_0x3b53('0x4e')]);_0x4c7cb9[_0x3b53('0x50')]=_['intersection'](_0x17fdc4[_0x3b53('0x41')],qs[_0x3b53('0x52')](_0x315ac4[_0x3b53('0x4e')][_0x3b53('0x52')]));_0x4c7cb9[_0x3b53('0x50')]=_0x4c7cb9['attributes'][_0x3b53('0x62')]?_0x4c7cb9[_0x3b53('0x50')]:_0x17fdc4[_0x3b53('0x41')];if(_0x315ac4[_0x3b53('0x4e')][_0x3b53('0x5b')]){_0x4c7cb9[_0x3b53('0x5c')]=[{'all':!![]}];}_0x4c7cb9=_['merge']({},_0x4c7cb9,_0x315ac4[_0x3b53('0x5a')]);return db['ChatWebsite'][_0x3b53('0x63')](_0x4c7cb9)['then'](handleEntityNotFound(_0x5a0765,null))[_0x3b53('0x17')](respondWithResult(_0x5a0765,null))[_0x3b53('0x21')](handleError(_0x5a0765,null));};exports[_0x3b53('0x64')]=function(_0x2d214f,_0x1ff9ed){var _0x3b42c4=null;_0x2d214f[_0x3b53('0x65')][_0x3b53('0x66')][_0x3b53('0x38')](',')[_0x3b53('0x67')](_0xad01b9=>{if(_0xad01b9[_0x3b53('0x68')]()!==''&&!wildcardUtils[_0x3b53('0x69')](_0xad01b9[_0x3b53('0x68')]())){_0x3b42c4=new APIBadRequestError('\x22'+_0xad01b9[_0x3b53('0x68')]()+_0x3b53('0x6a'));}});if(_0x3b42c4){return handleError(_0x1ff9ed,null)(_0x3b42c4);}return db[_0x3b53('0x49')][_0x3b53('0x64')](_0x2d214f[_0x3b53('0x65')],{})[_0x3b53('0x17')](function(_0x3bd0df){var _0x1da275=_0x2d214f[_0x3b53('0x6b')][_0x3b53('0x2c')]({'plain':!![]});if(!_0x1da275)throw new Error(_0x3b53('0x6c'));if(_0x1da275['role']===_0x3b53('0x6b')){var _0x1fe458=_0x3bd0df['get']({'plain':!![]});var _0x202952=_0x3b53('0x2d');return db[_0x3b53('0x6d')]['find']({'where':{'name':_0x202952,'userProfileId':_0x1da275['userProfileId']},'raw':!![]})[_0x3b53('0x17')](function(_0x481f0c){if(_0x481f0c&&_0x481f0c[_0x3b53('0x6e')]===0x0){return db['UserProfileResource'][_0x3b53('0x64')]({'name':_0x1fe458[_0x3b53('0x30')],'resourceId':_0x1fe458['id'],'type':_0x481f0c[_0x3b53('0x30')],'sectionId':_0x481f0c['id']},{})[_0x3b53('0x17')](function(){return _0x3bd0df;});}else{return _0x3bd0df;}})[_0x3b53('0x21')](function(_0x1a3827){logger[_0x3b53('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a3827);throw _0x1a3827;});}return _0x3bd0df;})[_0x3b53('0x17')](respondWithResult(_0x1ff9ed,0xc9))[_0x3b53('0x21')](handleError(_0x1ff9ed,null));};exports[_0x3b53('0x6f')]=function(_0x79de0c,_0x4e86b8){var _0x39ff51=null;_0x79de0c['body'][_0x3b53('0x66')]['split'](',')[_0x3b53('0x67')](_0xe12475=>{if(_0xe12475[_0x3b53('0x68')]()!==''&&!wildcardUtils[_0x3b53('0x69')](_0xe12475[_0x3b53('0x68')]())){_0x39ff51=new APIBadRequestError('\x22'+_0xe12475[_0x3b53('0x68')]()+_0x3b53('0x6a'));}});if(_0x39ff51){return handleError(_0x4e86b8,null)(_0x39ff51);}if(_0x79de0c['body']['id']){delete _0x79de0c['body']['id'];}return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x79de0c[_0x3b53('0x60')]['id']},'include':[{'model':db[_0x3b53('0x47')],'as':_0x3b53('0x48')}]})[_0x3b53('0x17')](handleEntityNotFound(_0x4e86b8,null))['then'](saveUpdates(_0x79de0c['body'],null))[_0x3b53('0x17')](respondWithResult(_0x4e86b8,null))[_0x3b53('0x21')](handleError(_0x4e86b8,null));};exports[_0x3b53('0x2b')]=function(_0x5778b7,_0x495baa){return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x5778b7['params']['id']}})['then'](handleEntityNotFound(_0x495baa,null))[_0x3b53('0x17')](removeEntity(_0x495baa,null))[_0x3b53('0x21')](handleError(_0x495baa,null));};exports[_0x3b53('0x70')]=function(_0x475890,_0x4ed83b){return db[_0x3b53('0x49')]['describe']()[_0x3b53('0x17')](respondWithResult(_0x4ed83b,null))[_0x3b53('0x21')](handleError(_0x4ed83b,null));};exports[_0x3b53('0x71')]=function(_0x281b46,_0x94e1f8){if(_0x281b46['body']['id']){delete _0x281b46[_0x3b53('0x65')]['id'];}return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x281b46['params']['id']}})['then'](handleEntityNotFound(_0x94e1f8,null))[_0x3b53('0x17')](function(_0x54dca3){if(_0x54dca3){_0x281b46[_0x3b53('0x65')][_0x3b53('0x72')]=_0x54dca3['id'];return db['Disposition']['create'](_0x281b46['body']);}})[_0x3b53('0x17')](respondWithResult(_0x94e1f8,null))[_0x3b53('0x21')](handleError(_0x94e1f8,null));};exports[_0x3b53('0x73')]=function(_0xe372ab,_0x3363a2){var _0x58c443={'raw':![],'where':{}};var _0x12a1fa={};var _0x3d459d={'count':0x0,'rows':[]};return db[_0x3b53('0x49')]['findOne']({'where':{'id':_0xe372ab['params']['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x3363a2,null))[_0x3b53('0x17')](function(_0x1d8b13){if(_0x1d8b13){_0x12a1fa['model']=_[_0x3b53('0x4d')](db['Disposition'][_0x3b53('0x61')]);_0x12a1fa[_0x3b53('0x4e')]=_[_0x3b53('0x4d')](_0xe372ab[_0x3b53('0x4e')]);_0x12a1fa[_0x3b53('0x4f')]=_[_0x3b53('0x51')](_0x12a1fa[_0x3b53('0x41')],_0x12a1fa[_0x3b53('0x4e')]);_0x58c443[_0x3b53('0x50')]=_[_0x3b53('0x51')](_0x12a1fa[_0x3b53('0x41')],qs[_0x3b53('0x52')](_0xe372ab[_0x3b53('0x4e')][_0x3b53('0x52')]));_0x58c443[_0x3b53('0x50')]=_0x58c443['attributes'][_0x3b53('0x62')]?_0x58c443[_0x3b53('0x50')]:_0x12a1fa['model'];if(!_0xe372ab[_0x3b53('0x4e')][_0x3b53('0x74')](_0x3b53('0x75'))){_0x58c443['limit']=qs[_0x3b53('0x26')](_0xe372ab[_0x3b53('0x4e')][_0x3b53('0x26')]);_0x58c443[_0x3b53('0x25')]=qs[_0x3b53('0x25')](_0xe372ab[_0x3b53('0x4e')][_0x3b53('0x25')]);}_0x58c443[_0x3b53('0x53')]=qs[_0x3b53('0x54')](_0xe372ab[_0x3b53('0x4e')][_0x3b53('0x54')]);_0x58c443['where']=qs[_0x3b53('0x4f')](_[_0x3b53('0x55')](_0xe372ab[_0x3b53('0x4e')],_0x12a1fa['filters']));_0x58c443[_0x3b53('0x57')][_0x3b53('0x72')]=_0x1d8b13['id'];if(_0xe372ab[_0x3b53('0x4e')][_0x3b53('0x56')]){_0x58c443['where']=_[_0x3b53('0x58')](_0x58c443[_0x3b53('0x57')],{'$or':_[_0x3b53('0x4c')](_0x58c443['attributes'],function(_0x26e72d){var _0x79eddd={};_0x79eddd[_0x26e72d]={'$like':'%'+_0xe372ab['query']['filter']+'%'};return _0x79eddd;})});}_0x58c443=_[_0x3b53('0x58')]({},_0x58c443,_0xe372ab[_0x3b53('0x5a')]);return db[_0x3b53('0x76')]['count']({'where':_0x58c443[_0x3b53('0x57')]})[_0x3b53('0x17')](function(_0x37e2c6){_0x3d459d[_0x3b53('0x28')]=_0x37e2c6;if(_0xe372ab[_0x3b53('0x4e')]['includeAll']){_0x58c443['include']=[{'all':!![]}];}return db[_0x3b53('0x76')]['findAll'](_0x58c443);})[_0x3b53('0x17')](function(_0x3975fe){_0x3d459d[_0x3b53('0x5e')]=_0x3975fe;return _0x3d459d;});}})[_0x3b53('0x17')](respondWithFilteredResult(_0x3363a2,_0x58c443))[_0x3b53('0x21')](handleError(_0x3363a2,null));};exports['removeDispositions']=function(_0x2ac5eb,_0x497778){return db['ChatWebsite'][_0x3b53('0x63')]({'where':{'id':_0x2ac5eb[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x497778,null))['then'](function(_0x5d5009){if(_0x5d5009){return _0x5d5009[_0x3b53('0x77')](_0x2ac5eb[_0x3b53('0x4e')][_0x3b53('0x78')]);}})[_0x3b53('0x17')](respondWithStatusCode(_0x497778,null))[_0x3b53('0x21')](handleError(_0x497778,null));};exports[_0x3b53('0x79')]=function(_0x4c15a9,_0x244e23){if(_0x4c15a9[_0x3b53('0x65')]['id']){delete _0x4c15a9[_0x3b53('0x65')]['id'];}return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x4c15a9[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x244e23,null))['then'](function(_0x309b62){if(_0x309b62){_0x4c15a9[_0x3b53('0x65')]['ChatWebsiteId']=_0x309b62['id'];return db[_0x3b53('0x7a')][_0x3b53('0x64')](_0x4c15a9[_0x3b53('0x65')]);}})[_0x3b53('0x17')](respondWithResult(_0x244e23,null))[_0x3b53('0x21')](handleError(_0x244e23,null));};exports['getAnswers']=function(_0x44508d,_0x38691c){var _0x528315={'raw':![],'where':{}};var _0x3799a1={};var _0x5cd725={'count':0x0,'rows':[]};return db[_0x3b53('0x49')][_0x3b53('0x7b')]({'where':{'id':_0x44508d[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x38691c,null))[_0x3b53('0x17')](function(_0x1a7b99){if(_0x1a7b99){_0x3799a1['model']=_[_0x3b53('0x4d')](db['CannedAnswer'][_0x3b53('0x61')]);_0x3799a1['query']=_[_0x3b53('0x4d')](_0x44508d[_0x3b53('0x4e')]);_0x3799a1[_0x3b53('0x4f')]=_[_0x3b53('0x51')](_0x3799a1[_0x3b53('0x41')],_0x3799a1[_0x3b53('0x4e')]);_0x528315[_0x3b53('0x50')]=_['intersection'](_0x3799a1['model'],qs[_0x3b53('0x52')](_0x44508d[_0x3b53('0x4e')]['fields']));_0x528315[_0x3b53('0x50')]=_0x528315['attributes']['length']?_0x528315['attributes']:_0x3799a1['model'];if(!_0x44508d[_0x3b53('0x4e')][_0x3b53('0x74')](_0x3b53('0x75'))){_0x528315[_0x3b53('0x26')]=qs[_0x3b53('0x26')](_0x44508d['query'][_0x3b53('0x26')]);_0x528315[_0x3b53('0x25')]=qs['offset'](_0x44508d[_0x3b53('0x4e')][_0x3b53('0x25')]);}_0x528315[_0x3b53('0x53')]=qs[_0x3b53('0x54')](_0x44508d['query'][_0x3b53('0x54')]);_0x528315[_0x3b53('0x57')]=qs[_0x3b53('0x4f')](_[_0x3b53('0x55')](_0x44508d[_0x3b53('0x4e')],_0x3799a1['filters']));_0x528315[_0x3b53('0x57')]['ChatWebsiteId']=_0x1a7b99['id'];if(_0x44508d[_0x3b53('0x4e')][_0x3b53('0x56')]){_0x528315[_0x3b53('0x57')]=_['merge'](_0x528315['where'],{'$or':_[_0x3b53('0x4c')](_0x528315[_0x3b53('0x50')],function(_0x20b582){var _0x2655a0={};_0x2655a0[_0x20b582]={'$like':'%'+_0x44508d[_0x3b53('0x4e')][_0x3b53('0x56')]+'%'};return _0x2655a0;})});}_0x528315=_[_0x3b53('0x58')]({},_0x528315,_0x44508d[_0x3b53('0x5a')]);return db[_0x3b53('0x7a')][_0x3b53('0x28')]({'where':_0x528315[_0x3b53('0x57')]})[_0x3b53('0x17')](function(_0x2152b5){_0x5cd725[_0x3b53('0x28')]=_0x2152b5;if(_0x44508d['query'][_0x3b53('0x5b')]){_0x528315[_0x3b53('0x5c')]=[{'all':!![]}];}return db[_0x3b53('0x7a')]['findAll'](_0x528315);})['then'](function(_0x1baefe){_0x5cd725[_0x3b53('0x5e')]=_0x1baefe;return _0x5cd725;});}})[_0x3b53('0x17')](respondWithFilteredResult(_0x38691c,_0x528315))['catch'](handleError(_0x38691c,null));};exports[_0x3b53('0x7c')]=function(_0x1388fe,_0x496a9c){return db['ChatWebsite'][_0x3b53('0x63')]({'where':{'id':_0x1388fe[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x496a9c,null))[_0x3b53('0x17')](function(_0x30e53d){if(_0x30e53d){return _0x30e53d[_0x3b53('0x7c')](_0x1388fe['query']['ids']);}})['then'](respondWithStatusCode(_0x496a9c,null))[_0x3b53('0x21')](handleError(_0x496a9c,null));};exports['addLogo']=function(_0x2140b9,_0x56c412){_0x2140b9[_0x3b53('0x65')][_0x3b53('0x7d')]=_0x2140b9[_0x3b53('0x7e')][_0x3b53('0x7f')];return db['ChatWebsite'][_0x3b53('0x63')]({'where':{'id':_0x2140b9[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x56c412,null))[_0x3b53('0x17')](saveUpdates(_0x2140b9['body'],null))[_0x3b53('0x17')](respondWithResult(_0x56c412,null))[_0x3b53('0x21')](handleError(_0x56c412,null));};exports[_0x3b53('0x80')]=function(_0x558c34,_0x31dbd8){_0x558c34[_0x3b53('0x65')]['agentAvatar']=_0x558c34[_0x3b53('0x7e')][_0x3b53('0x7f')];return db['ChatWebsite'][_0x3b53('0x63')]({'where':{'id':_0x558c34['params']['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x31dbd8,null))[_0x3b53('0x17')](saveUpdates(_0x558c34[_0x3b53('0x65')],null))[_0x3b53('0x17')](respondWithResult(_0x31dbd8,null))['catch'](handleError(_0x31dbd8,null));};exports[_0x3b53('0x81')]=function(_0x618329,_0x20da54){_0x618329['body'][_0x3b53('0x82')]=_0x618329[_0x3b53('0x7e')][_0x3b53('0x7f')];return db[_0x3b53('0x49')]['find']({'where':{'id':_0x618329[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x20da54,null))['then'](saveUpdates(_0x618329[_0x3b53('0x65')],null))[_0x3b53('0x17')](respondWithResult(_0x20da54,null))['catch'](handleError(_0x20da54,null));};exports[_0x3b53('0x83')]=function(_0x33d735,_0x12f1a7){_0x33d735[_0x3b53('0x65')][_0x3b53('0x84')]=_0x33d735[_0x3b53('0x7e')][_0x3b53('0x7f')];return db[_0x3b53('0x49')]['find']({'where':{'id':_0x33d735[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x12f1a7,null))[_0x3b53('0x17')](saveUpdates(_0x33d735['body'],null))[_0x3b53('0x17')](respondWithResult(_0x12f1a7,null))[_0x3b53('0x21')](handleError(_0x12f1a7,null));};exports[_0x3b53('0x85')]=function(_0x1a50b7,_0x313dd8){var _0x3cca48=path[_0x3b53('0x86')](config['root'],_0x3b53('0x87'));var _0x1d916f={'where':{'id':_0x1a50b7['params']['id']},'attributes':['id',_0x3b53('0x7d')],'raw':!![]};var _0x8a923d=![];return require('../../config/license/util')[_0x3b53('0x88')]()['then'](function(_0x41d819){if(_0x41d819){_0x8a923d=_0x41d819[_0x3b53('0x89')];}})[_0x3b53('0x17')](function(){return db[_0x3b53('0x49')][_0x3b53('0x63')](_0x1d916f);})[_0x3b53('0x17')](handleEntityNotFound(_0x313dd8,null))[_0x3b53('0x17')](function(_0x5c1839){if(_0x5c1839){if(!_[_0x3b53('0x8a')](_0x5c1839['sitepic'])){if(fs[_0x3b53('0x8b')](path[_0x3b53('0x86')](config[_0x3b53('0x8c')],'server/files/images/logos/',_0x5c1839[_0x3b53('0x7d')]))&&_0x8a923d){_0x3cca48=path[_0x3b53('0x86')](config['root'],_0x3b53('0x8d'),_0x5c1839[_0x3b53('0x7d')]);}}return _0x313dd8['download'](_0x3cca48);}})['catch'](handleError(_0x313dd8,null));};exports[_0x3b53('0x8e')]=function(_0x30bdfe,_0xd1090c){var _0x1ee4ee=path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x8f'));var _0x106585={'where':{'id':_0x30bdfe[_0x3b53('0x60')]['id']},'attributes':['id',_0x3b53('0x90')],'raw':!![]};return db[_0x3b53('0x49')][_0x3b53('0x63')](_0x106585)[_0x3b53('0x17')](handleEntityNotFound(_0xd1090c,null))[_0x3b53('0x17')](function(_0x4e0853){if(_0x4e0853){if(!_[_0x3b53('0x8a')](_0x4e0853['agentAvatar'])){if(fs[_0x3b53('0x8b')](path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x91'),_0x4e0853[_0x3b53('0x90')]))){_0x1ee4ee=path[_0x3b53('0x86')](config['root'],_0x3b53('0x91'),_0x4e0853[_0x3b53('0x90')]);}}return _0xd1090c['download'](_0x1ee4ee);}})[_0x3b53('0x21')](handleError(_0xd1090c,null));};exports[_0x3b53('0x92')]=function(_0x4bb0e5,_0x39bbcd){var _0x33c50b=path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x93'));var _0x37b911={'where':{'id':_0x4bb0e5[_0x3b53('0x60')]['id']},'attributes':['id',_0x3b53('0x82'),_0x3b53('0x94')],'raw':!![]};return db[_0x3b53('0x49')][_0x3b53('0x63')](_0x37b911)['then'](handleEntityNotFound(_0x39bbcd,null))[_0x3b53('0x17')](function(_0x147072){if(_0x147072){if(!_[_0x3b53('0x8a')](_0x147072[_0x3b53('0x82')])){if(fs[_0x3b53('0x8b')](path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x91'),_0x147072[_0x3b53('0x82')]))&&_0x147072[_0x3b53('0x94')]){_0x33c50b=path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x91'),_0x147072[_0x3b53('0x82')]);}}return _0x39bbcd[_0x3b53('0x95')](_0x33c50b);}})[_0x3b53('0x21')](handleError(_0x39bbcd,null));};exports[_0x3b53('0x96')]=function(_0x39a03a,_0x455db8){var _0x10b681=path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x97'));var _0x459758={'where':{'id':_0x39a03a[_0x3b53('0x60')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x3b53('0x49')][_0x3b53('0x63')](_0x459758)[_0x3b53('0x17')](handleEntityNotFound(_0x455db8,null))[_0x3b53('0x17')](function(_0x3445a6){if(_0x3445a6){if(!_[_0x3b53('0x8a')](_0x3445a6[_0x3b53('0x84')])){if(fs[_0x3b53('0x8b')](path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x91'),_0x3445a6['systemAvatar']))){_0x10b681=path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0x91'),_0x3445a6[_0x3b53('0x84')]);}}return _0x455db8['download'](_0x10b681);}})['catch'](handleError(_0x455db8,null));};function checkWebsiteInterval(_0x952b54){var _0x10939f=_0x952b54['Interval'];if(!_0x10939f){return Promise[_0x3b53('0x98')](_0x952b54);}var _0x5e53a2=_0x952b54['timezone']||undefined;return _0x10939f[_0x3b53('0x99')](_0x5e53a2)[_0x3b53('0x17')](function(_0x616dd3){if(!_0x616dd3){throw new APIOutOfIntervalError();}return _0x952b54;});}exports[_0x3b53('0x9a')]=function(_0x55710d,_0x39385b){var _0x3f07e2={'body':_0x55710d[_0x3b53('0x65')],'channel':_0x3b53('0x9b')};var _0x24e3b9=[];var _0x282bde=[];var _0x1e4b02={};var _0x3750fd=![];if(_0x55710d[_0x3b53('0x65')]['id']){delete _0x55710d[_0x3b53('0x65')]['id'];}if(_[_0x3b53('0x8a')](_0x55710d['body']['from'])){throw new APIBadRequestError(_0x3b53('0x9c'));}if(_['isNil'](_0x55710d[_0x3b53('0x65')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x3b53('0x9d')](_0x55710d[_0x3b53('0x65')][_0x3b53('0x65')])){throw new APIBadRequestError(_0x3b53('0x9e'));}var _0x17ba64=_0x55710d[_0x3b53('0x65')][_0x3b53('0x9f')]&&_0x55710d[_0x3b53('0x65')][_0x3b53('0x3c')];return db[_0x3b53('0xa0')][_0x3b53('0x70')]()[_0x3b53('0x17')](function(_0x27b443){if(!_0x27b443){throw new Error(_0x3b53('0xa1'));}_0x24e3b9=Object['keys'](_0x27b443)[_0x3b53('0x56')](function(_0x24dcb3){return![_0x3b53('0xa2'),_0x3b53('0xa3')]['includes'](_0x24dcb3);});_0x282bde=Object[_0x3b53('0x4d')](_0x27b443)[_0x3b53('0x56')](function(_0x38da91){return![_0x3b53('0xa2'),_0x3b53('0xa3'),_0x3b53('0xa4'),_0x3b53('0xa5')][_0x3b53('0xa6')](_0x38da91);});if(!_[_0x3b53('0xa6')](_0x282bde,_0x55710d['body']['mapKey'])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x282bde[_0x3b53('0x86')](',\x20'));}_0x1e4b02[_0x55710d['body'][_0x3b53('0xa7')]]=_0x55710d[_0x3b53('0x65')]['from'];})['then'](function(){return db[_0x3b53('0x49')]['find']({'where':{'id':_0x55710d[_0x3b53('0x60')]['id']},'include':[{'model':db[_0x3b53('0xa8')],'as':_0x3b53('0xa9'),'include':[{'model':db[_0x3b53('0xa0')],'as':_0x3b53('0xaa'),'where':_0x1e4b02,'limit':0x1,'order':[[_0x3b53('0xa3'),_0x3b53('0xab')]]}]},{'model':db[_0x3b53('0xac')],'as':_0x3b53('0xad')},{'model':db['Interval'],'as':_0x3b53('0xae'),'include':[{'model':db[_0x3b53('0xae')],'as':_0x3b53('0xaf'),'attributes':['id',_0x3b53('0xb0')],'raw':!![]}]}]});})[_0x3b53('0x17')](function(_0x362f0c){if(!_0x362f0c){throw new APINotFoundError(util[_0x3b53('0x3f')](_0x3b53('0xb1'),_0x55710d[_0x3b53('0x60')]['id']));}if(_0x17ba64){return checkWebsiteInterval(_0x362f0c);}return _0x362f0c;})[_0x3b53('0x17')](function(_0x57cf2b){_0x3f07e2[_0x3b53('0xb2')]=_0x57cf2b;_0x3f07e2[_0x3b53('0xb3')]=_[_0x3b53('0xb4')](_0x57cf2b[_0x3b53('0xad')],[_0x3b53('0xb5')],[_0x3b53('0xb6')]);if(_0x3f07e2[_0x3b53('0xb2')][_0x3b53('0xad')]){delete _0x3f07e2[_0x3b53('0xb2')][_0x3b53('0xad')];}_0x3f07e2[_0x3b53('0xb7')]=_0x57cf2b[_0x3b53('0xa9')]||{'id':_0x57cf2b[_0x3b53('0xa5')]};if(_0x3f07e2[_0x3b53('0xb7')]&&_0x3f07e2['list'][_0x3b53('0xaa')][_0x3b53('0x62')]){return _0x3f07e2[_0x3b53('0xb7')][_0x3b53('0xaa')][0x0];}var _0x59f971=_[_0x3b53('0xb8')](_0x55710d['body'],{'firstName':_0x55710d[_0x3b53('0x65')][_0x3b53('0xb9')],'ListId':_0x57cf2b[_0x3b53('0xa5')]});_0x59f971[_0x55710d[_0x3b53('0x65')][_0x3b53('0xa7')]]=_0x55710d[_0x3b53('0x65')]['from'];return db[_0x3b53('0xa0')]['create'](_0x59f971,{'fields':_0x24e3b9,'raw':!![]});})[_0x3b53('0x17')](function(_0x32cff0){_0x3f07e2[_0x3b53('0xba')]=_0x32cff0;var _0x45335e=createInteractionObject(_0x55710d[_0x3b53('0x60')]['id'],_0x55710d[_0x3b53('0x65')],_0x55710d['headers'],_0x32cff0);var _0x302709={'ChatWebsiteId':_0x55710d[_0x3b53('0x60')]['id']};if(_0x55710d[_0x3b53('0x65')][_0x3b53('0xbb')]){_0x302709[_0x3b53('0xbb')]=_0x55710d[_0x3b53('0x65')][_0x3b53('0xbb')];_0x302709[_0x3b53('0xbc')]=![];return db[_0x3b53('0xbd')][_0x3b53('0x63')]({'where':_0x302709})[_0x3b53('0x17')](function(_0x19b8ea){var _0x19b5e4=_0x55710d[_0x3b53('0x65')][_0x3b53('0x9f')]&&_0x55710d[_0x3b53('0x65')][_0x3b53('0x3c')];if(_0x19b8ea){_0x3750fd=!![];return _0x19b8ea;}else if(!_0x19b5e4&&_0x19b8ea&&_0x19b8ea[_0x3b53('0xbc')]){throw new APIConflictError(_0x3b53('0xbe'));}_0x45335e['threadId']=_0x55710d[_0x3b53('0x65')][_0x3b53('0xbb')];_0x45335e[_0x3b53('0xbf')]=_0x55710d['body'][_0x3b53('0xbf')];return db[_0x3b53('0xbd')]['create'](_0x45335e);});}_0x302709[_0x3b53('0xc0')]=_0x32cff0['id'];if(_0x55710d[_0x3b53('0x65')][_0x3b53('0xc1')]&&_0x55710d[_0x3b53('0x65')][_0x3b53('0xc1')]['id']){_0x302709['id']=_0x55710d['body']['interaction']['id'];return db[_0x3b53('0xbd')][_0x3b53('0x63')]({'where':_0x302709})[_0x3b53('0x17')](function(_0x59fbe3){var _0x2b2064=_0x55710d[_0x3b53('0x65')][_0x3b53('0x9f')]&&_0x55710d[_0x3b53('0x65')]['referer'];if(!_0x2b2064&&_0x59fbe3&&_0x59fbe3['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x59fbe3){_0x3750fd=!![];return _0x59fbe3;}else{return db[_0x3b53('0xbd')][_0x3b53('0x64')](_0x45335e);}});}return db[_0x3b53('0xbd')][_0x3b53('0x64')](_0x45335e);})['then'](function(_0x10df6b){if(!_0x3750fd){return _0x10df6b;}var _0x2f572a={'from':(_0x3f07e2[_0x3b53('0xba')][_0x3b53('0x39')]||'')+'\x20'+(_0x3f07e2['contact']['lastName']||'')};if(_0x55710d[_0x3b53('0x65')][_0x3b53('0xbb')]&&_0x55710d[_0x3b53('0x65')]['messageId']&&_0x55710d[_0x3b53('0x65')][_0x3b53('0xbb')]!=_0x55710d[_0x3b53('0x65')][_0x3b53('0xc2')]){_0x2f572a[_0x3b53('0xbb')]=_0x55710d[_0x3b53('0x65')][_0x3b53('0xc2')];}return _0x10df6b[_0x3b53('0x6f')](_0x2f572a);})[_0x3b53('0x17')](function(_0x13b314){_0x3f07e2['interaction']=_0x13b314['get']({'plain':!![]});_0x3f07e2['interaction'][_0x3b53('0xc3')]=!_0x3750fd;if(_0x3f07e2[_0x3b53('0xc1')][_0x3b53('0xc3')]){if(_0x3f07e2[_0x3b53('0xb2')][_0x3b53('0xc4')]){_0x3f07e2[_0x3b53('0xb3')][_0x3b53('0xc5')]({'id':0x0,'priority':_0x3f07e2[_0x3b53('0xb3')][_0x3b53('0x62')]+0x1,'app':_0x3b53('0xc6'),'appdata':_0x3b53('0xc7'),'interval':_0x3b53('0xc8')});}}return db['ChatMessage'][_0x3b53('0x64')]({'body':_0x55710d[_0x3b53('0x65')]['body'],'ChatWebsiteId':_0x55710d[_0x3b53('0x60')]['id'],'ChatInteractionId':_0x13b314['id'],'direction':'in','ContactId':_0x3f07e2[_0x3b53('0xba')]['id'],'AttachmentId':_0x55710d[_0x3b53('0x65')][_0x3b53('0xc9')]});})[_0x3b53('0x17')](function(_0x4a571a){_0x3f07e2[_0x3b53('0x1e')]=_0x4a571a;if(!_0x3f07e2[_0x3b53('0xc1')]['UserId']){return;}return db[_0x3b53('0xca')][_0x3b53('0x63')]({'attributes':['id','name'],'where':{'id':_0x3f07e2[_0x3b53('0xc1')]['UserId']}});})[_0x3b53('0x17')](function(_0x1d0c31){if(_0x1d0c31){_0x3f07e2[_0x3b53('0xb3')][_0x3b53('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d0c31[_0x3b53('0x30')]+','+(_0x3f07e2['account'][_0x3b53('0xcc')]||0xa),'interval':_0x3b53('0xc8')});_0x3f07e2[_0x3b53('0xcd')]=!![];}if(!_0x3f07e2[_0x3b53('0xc1')][_0x3b53('0xce')]){return;}return db[_0x3b53('0xcf')][_0x3b53('0x63')]({'attributes':['id','name'],'where':{'id':_0x3f07e2['interaction'][_0x3b53('0xce')]}});})[_0x3b53('0x17')](function(_0x30c8e0){if(_0x30c8e0){_0x3f07e2[_0x3b53('0xb3')][_0x3b53('0xcb')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x30c8e0['name']+','+(_0x3f07e2[_0x3b53('0xb2')]['waitForTheAssignedQueue']||0x12c),'interval':_0x3b53('0xc8')});}return respondWithRpcPromise(_0x3b53('0xd0'),_0x3b53('0xd1'),_0x3f07e2);})[_0x3b53('0x17')](function(_0x269102){respondWithRpcPromise(_0x3b53('0xd2'),_0x3b53('0xd2'),{'event':_0x3b53('0x9a'),'message':_0x269102},client9002);return _0x269102;})[_0x3b53('0x17')](respondWithResult(_0x39385b,null))[_0x3b53('0x21')](APIHandleError(_0x39385b));};exports['offline']=function(_0x737b16,_0x15c1e4){var _0x981f85,_0xcbbe02,_0x1cd1c2;var _0x2756b7=[];var _0x13f367={};var _0x529f18=_0x737b16[_0x3b53('0xd3')]||[];var _0x542b71=[];var _0x59ecab;return db[_0x3b53('0xa0')]['describe']()[_0x3b53('0x17')](function(_0x4c3294){if(!_0x4c3294){throw new db[(_0x3b53('0xd4'))][(_0x3b53('0xd5'))](_0x3b53('0xd6'));}_0x2756b7=_[_0x3b53('0xd7')](_[_0x3b53('0x4d')](_0x4c3294),[_0x3b53('0xa2'),_0x3b53('0xa3'),_0x3b53('0xa4'),_0x3b53('0xa5')]);if(_0x737b16[_0x3b53('0x65')]['id']){delete _0x737b16[_0x3b53('0x65')]['id'];}if(_[_0x3b53('0x8a')](_0x737b16[_0x3b53('0x65')][_0x3b53('0xb9')])){throw _0x15c1e4[_0x3b53('0x24')](0x1f4)[_0x3b53('0x31')](new db['Sequelize'][(_0x3b53('0xd5'))](_0x3b53('0xd8')));}if(_[_0x3b53('0x8a')](_0x737b16[_0x3b53('0x65')][_0x3b53('0x65')])||_0x737b16[_0x3b53('0x65')][_0x3b53('0x65')]===''){throw _0x15c1e4[_0x3b53('0x24')](0x1f4)[_0x3b53('0x31')](new db[(_0x3b53('0xd4'))][(_0x3b53('0xd5'))](_0x3b53('0xd9')));}if(_['isNil'](_0x737b16[_0x3b53('0x65')][_0x3b53('0xda')])){throw _0x15c1e4[_0x3b53('0x24')](0x1f4)[_0x3b53('0x31')](new db['Sequelize'][(_0x3b53('0xd5'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2756b7));}if(!_[_0x3b53('0xa6')](_0x2756b7,_0x737b16[_0x3b53('0x65')][_0x3b53('0xda')])){throw _0x15c1e4[_0x3b53('0x24')](0x1f4)['send'](new db[(_0x3b53('0xd4'))]['ValidationError'](_0x3b53('0xdb')+_0x2756b7));}_0x13f367[_0x737b16[_0x3b53('0x65')][_0x3b53('0xda')]]=_0x737b16[_0x3b53('0x65')][_0x3b53('0xb9')];})[_0x3b53('0x17')](function(){return db['ChatWebsite'][_0x3b53('0x63')]({'where':{'id':_0x737b16[_0x3b53('0x60')]['id']},'include':[{'model':db[_0x3b53('0xa8')],'as':_0x3b53('0xa9')},{'model':db['MailAccount'],'as':_0x3b53('0xdc')}]});})[_0x3b53('0x17')](handleEntityNotFound(_0x15c1e4,null))['then'](function(_0x41351b){if(_0x41351b&&_0x41351b[_0x3b53('0xa9')]){_0xcbbe02=_0x41351b;var _0x88b6fb=_['defaults'](_0x737b16[_0x3b53('0x65')],{'firstName':_0x737b16[_0x3b53('0x65')][_0x3b53('0xb9')],'phone':_0x737b16[_0x3b53('0x65')][_0x3b53('0xb9')],'ListId':_0x41351b['ListId']});_0x88b6fb[_0x737b16[_0x3b53('0x65')][_0x3b53('0xda')]]=_0x737b16[_0x3b53('0x65')][_0x3b53('0xb9')];return db[_0x3b53('0xa0')][_0x3b53('0xdd')]({'where':_0x13f367,'defaults':_0x88b6fb});}})[_0x3b53('0xde')](function(_0x204ade){if(_0x204ade){_0x1cd1c2=_0x204ade;var _0x53d1d5=fs[_0x3b53('0xdf')](path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0xe0')),_0x3b53('0xe1'));var _0x43e9d4=ejs[_0x3b53('0xe2')](_0x53d1d5,{'body':_[_0x3b53('0xe3')](_0x737b16[_0x3b53('0x65')][_0x3b53('0x65')]),'bodyTitle':_0xcbbe02['offlineMessageBody']});return db[_0x3b53('0xe4')]['create']({'body':_0x43e9d4,'plainBody':htmlToText[_0x3b53('0xe5')](_0x43e9d4),'ContactId':_0x204ade['id'],'ChatWebsiteId':_0xcbbe02['id']});}})[_0x3b53('0x17')](function(_0x34add5){_0x59ecab=_0x34add5;if(_0x529f18['length']){var _0x13ad9e=_0x529f18[_0x3b53('0x4c')](function(_0x56a128){return{'name':_0x56a128[_0x3b53('0xe6')],'basename':_0x56a128[_0x3b53('0x7f')],'type':_0x56a128[_0x3b53('0xe7')],'ChatOfflineMessageId':_0x34add5['id']};});_0x542b71=_0x13ad9e['map'](_0x55dd9d=>{var _0x431fdf={'filename':_0x55dd9d[_0x3b53('0x30')],'path':path[_0x3b53('0x86')](config[_0x3b53('0x8c')],_0x3b53('0xe8'),'files',_0x3b53('0xe9'),_0x3b53('0xea'),_0x55dd9d['basename'])};return _0x431fdf;});if(!_0xcbbe02[_0x3b53('0xeb')]){return db[_0x3b53('0xec')][_0x3b53('0xed')](function(_0x2302df){return db['Attachment'][_0x3b53('0xee')](_0x13ad9e,{'transaction':_0x2302df});});}}})['then'](function(){if(_0x59ecab){_0x981f85=_0x59ecab;return db[_0x3b53('0xdc')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3b53('0xef')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x3b53('0xf0')],'as':_0x3b53('0xf0'),'raw':!![]}]}]});}})[_0x3b53('0x17')](function(_0xc5f8a3){if(_0xc5f8a3&&_0xc5f8a3['Smtp']&&_0xcbbe02[_0x3b53('0xf1')]&&_0xcbbe02[_0x3b53('0xf2')]){var _0x13caf9=_0xc5f8a3['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x3b53('0xf3'),{'account':_0x13caf9,'message':{'from':util[_0x3b53('0x3f')]('\x22%s\x22\x20<%s>',_0xc5f8a3['name'],_0xc5f8a3['email']||_0xc5f8a3[_0x3b53('0xf4')]['user']),'to':_0xcbbe02[_0x3b53('0xf2')],'subject':_0xcbbe02[_0x3b53('0xf5')],'html':_0x981f85[_0x3b53('0x65')],'attachments':_0x542b71}},client9003)[_0x3b53('0x17')](function(){return _0x981f85;})[_0x3b53('0x21')](function(_0x50091c){logger['error'](_0x50091c);});}})[_0x3b53('0x17')](function(){if(_0xcbbe02&&_0xcbbe02['openNewInteraction']&&_0xcbbe02[_0x3b53('0xf6')]){var _0x10e879=[];if(_0x529f18[_0x3b53('0x62')]){_0x10e879=_0x529f18[_0x3b53('0x4c')](function(_0x7ca889){return{'name':_0x7ca889['originalname'],'basename':_0x7ca889[_0x3b53('0x7f')],'type':_0x7ca889[_0x3b53('0xe7')],'ChatOfflineMessageId':_0x59ecab['id']};});}var _0x419ed0;if(!_[_0x3b53('0x8a')](_0xcbbe02[_0x3b53('0xf7')])){var _0x59c4dd=_['map'](_0x737b16[_0x3b53('0x65')],function(_0x35dadb){return _0x35dadb;});var _0x4dd073=_['toPairsIn'](_0x59c4dd)[0x0];var _0x4af39d=_['mapValues'](_0x4dd073,function(_0x4f53e1){return _0x4f53e1;});_0x419ed0=_0x4af39d[0x1][_0xcbbe02[_0x3b53('0xf7')]];}var _0x385608={'from':_0x1cd1c2['email'],'firstName':_0x1cd1c2[_0x3b53('0x39')],'lastName':_0x1cd1c2[_0x3b53('0x3a')],'mapKey':'email','message':{'from':_0x1cd1c2[_0x3b53('0xf8')],'to':_0xcbbe02[_0x3b53('0xdc')]['email'],'cc':'','subject':_[_0x3b53('0x8a')](_0x419ed0)?_0xcbbe02[_0x3b53('0xf5')]:_0x419ed0,'messageId':'','sentAt':new Date(),'attach':_0x10e879[_0x3b53('0x62')],'attachments':_0x10e879,'originChannel':'Chat','ChatWebsiteId':_0xcbbe02['id'],'ChatOfflineMessageId':_0x981f85['id'],'originTo':_0xcbbe02[_0x3b53('0xdc')][_0x3b53('0xf8')]},'body':_0x981f85[_0x3b53('0x65')]};var _0x161bd9={'account':{'id':_0xcbbe02['MailAccountId']},'body':_0x385608,'log':_0x3b53('0xf9')};return respondWithRpcPromise(_0x3b53('0xf9'),_0x3b53('0xfa'),_0x161bd9,client9001)[_0x3b53('0x17')](function(){return _0x981f85;})[_0x3b53('0x21')](function(_0x3f4ecb){logger[_0x3b53('0x1c')](_0x3f4ecb);});}return;})[_0x3b53('0x17')](function(){if(_0x981f85){return _0x981f85;}})[_0x3b53('0x17')](respondWithResult(_0x15c1e4,null))[_0x3b53('0x21')](function(){for(var _0x1c2161 of _0x529f18){var _0x332c45=path[_0x3b53('0x86')](config['root'],'server',_0x3b53('0xd3'),_0x3b53('0xe9'),_0x3b53('0xea'),_0x1c2161[_0x3b53('0x7f')]);fs_extra[_0x3b53('0xfb')](_0x332c45)[_0x3b53('0x21')](function(_0x42d816){logger[_0x3b53('0x1c')](_0x3b53('0xfc'),_0x332c45,_0x42d816);});}});};exports[_0x3b53('0xfd')]=function(_0x28ca37,_0x4bade5){return db[_0x3b53('0xbd')]['find']({'where':{'id':_0x28ca37['params']['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x4bade5,null))['then'](function(_0x552814){if(_0x552814){return _0x552814[_0x3b53('0xfd')](_0x28ca37[_0x3b53('0x65')][_0x3b53('0x78')],_[_0x3b53('0xfe')](_0x28ca37[_0x3b53('0x65')],[_0x3b53('0x78'),'id'])||{});}})[_0x3b53('0x17')](respondWithResult(_0x4bade5,null))[_0x3b53('0x21')](handleError(_0x4bade5,null));};exports[_0x3b53('0xff')]=function(_0x217eeb,_0x3c5ef6){var _0x25a4e9={'raw':![],'where':{}};var _0x2de685={};var _0x14dd94={'count':0x0,'rows':[]};return db[_0x3b53('0x49')]['findOne']({'where':{'id':_0x217eeb[_0x3b53('0x60')]['id']}})['then'](handleEntityNotFound(_0x3c5ef6,null))[_0x3b53('0x17')](function(_0x46eee2){if(_0x46eee2){_0x2de685[_0x3b53('0x41')]=_['keys'](db['ChatInteraction'][_0x3b53('0x61')]);_0x2de685['query']=_[_0x3b53('0x4d')](_0x217eeb[_0x3b53('0x4e')]);_0x2de685['filters']=_[_0x3b53('0x51')](_0x2de685[_0x3b53('0x41')],_0x2de685[_0x3b53('0x4e')]);_0x25a4e9['attributes']=_[_0x3b53('0x51')](_0x2de685[_0x3b53('0x41')],qs['fields'](_0x217eeb[_0x3b53('0x4e')]['fields']));_0x25a4e9[_0x3b53('0x50')]=_0x25a4e9[_0x3b53('0x50')]['length']?_0x25a4e9[_0x3b53('0x50')]:_0x2de685[_0x3b53('0x41')];if(!_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x74')]('nolimit')){_0x25a4e9['limit']=qs['limit'](_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x26')]);_0x25a4e9['offset']=qs['offset'](_0x217eeb[_0x3b53('0x4e')]['offset']);}_0x25a4e9['order']=qs[_0x3b53('0x54')](_0x217eeb['query'][_0x3b53('0x54')]);_0x25a4e9[_0x3b53('0x57')]=qs[_0x3b53('0x4f')](_['pick'](_0x217eeb[_0x3b53('0x4e')],_0x2de685[_0x3b53('0x4f')]));_0x25a4e9[_0x3b53('0x57')][_0x3b53('0x72')]=_0x46eee2['id'];if(_0x217eeb[_0x3b53('0x4e')]['filter']){_0x25a4e9[_0x3b53('0x57')]=_['merge'](_0x25a4e9[_0x3b53('0x57')],{'$or':_[_0x3b53('0x4c')](_0x25a4e9['attributes'],function(_0x2f510c){var _0x50b6dd={};_0x50b6dd[_0x2f510c]={'$like':'%'+_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x56')]+'%'};return _0x50b6dd;})});}_0x25a4e9=_['merge']({},_0x25a4e9,_0x217eeb[_0x3b53('0x5a')]);return db[_0x3b53('0xbd')][_0x3b53('0x28')]({'where':_0x25a4e9[_0x3b53('0x57')]})['then'](function(_0x4c4c07){_0x14dd94[_0x3b53('0x28')]=_0x4c4c07;if(_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x5b')]){_0x25a4e9[_0x3b53('0x5c')]=[{'model':db[_0x3b53('0xa0')],'as':_0x3b53('0x100'),'required':![]},{'model':db['User'],'as':_0x3b53('0x101'),'attributes':['name',_0x3b53('0x102'),_0x3b53('0x103')],'required':![]},{'model':db[_0x3b53('0x104')],'as':_0x3b53('0x105'),'attributes':['id','name',_0x3b53('0x106')],'where':_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x107')]?{'id':_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x107')]}:undefined,'required':_0x217eeb[_0x3b53('0x4e')][_0x3b53('0x107')]?!![]:![]}];}return db[_0x3b53('0xbd')][_0x3b53('0x5d')](_0x25a4e9);})[_0x3b53('0x17')](function(_0x90a9cb){_0x14dd94['rows']=_0x90a9cb;return _0x14dd94;});}})[_0x3b53('0x17')](respondWithFilteredResult(_0x3c5ef6,_0x25a4e9))['catch'](handleError(_0x3c5ef6,null));};exports[_0x3b53('0x108')]=function(_0x413d24,_0x43cdb5){var _0x102b16=0x0;var _0x3e4aaa=0x0;var _0x2fb786=![];var _0x5c0d00;var _0x9f4ae2;return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x413d24['params']['id']},'include':[{'model':db[_0x3b53('0xae')],'as':_0x3b53('0xae'),'include':[{'model':db[_0x3b53('0xae')],'as':_0x3b53('0xaf'),'attributes':['id','interval']}]}]})[_0x3b53('0x17')](handleEntityNotFound(_0x43cdb5,null))[_0x3b53('0x17')](function(_0x5a9425){if(_0x5a9425){_0x5c0d00=_0x5a9425;return _0x5a9425[_0x3b53('0x109')]({'raw':!![]});}})[_0x3b53('0x17')](function(_0x110cb2){if(_0x5c0d00){if(_0x110cb2){_0x9f4ae2=_0x110cb2;}}return require('../../config/license/util')[_0x3b53('0x88')]();})[_0x3b53('0x17')](function(_0x15df76){if(_0x15df76){_0x3e4aaa=_0x15df76[_0x3b53('0x10a')];_0x2fb786=_0x15df76[_0x3b53('0x89')];}})['then'](function(){return db[_0x3b53('0xbd')][_0x3b53('0x28')]({'where':{'closed':![]}});})[_0x3b53('0x17')](function(_0x52965f){_0x102b16=_0x52965f;if(_0x3e4aaa&&_0x52965f>_0x3e4aaa){return db[_0x3b53('0x10b')]['findOne']({'where':{'id':0x1}})[_0x3b53('0x17')](function(_0x475b5a){if(_0x475b5a){_0x475b5a[_0x3b53('0x10c')]('chatLicenseExceeded');}});}})[_0x3b53('0x17')](function(){var _0x290cdb=_0x5c0d00[_0x3b53('0xae')];var _0x1b49fe=_0x5c0d00[_0x3b53('0x10d')]||undefined;return _0x290cdb?_0x290cdb[_0x3b53('0x99')](_0x1b49fe):!![];})[_0x3b53('0x17')](function(_0xa4167f){var _0x350bd3=fs[_0x3b53('0xdf')](path[_0x3b53('0x86')](config['root'],_0x3b53('0x10e')),_0x3b53('0xe1'));var _0x40b840=_0x3b53('0x10f');var _0x312589=![];var _0x241dc0,_0x105d44;if(_0x413d24[_0x3b53('0x110')][_0x3b53('0x3c')]){_0x241dc0=new URL(_0x413d24['headers'][_0x3b53('0x3c')])[_0x3b53('0x111')];}else if(_0x413d24[_0x3b53('0x110')][_0x3b53('0x111')]){_0x241dc0=new URL(_0x413d24[_0x3b53('0x110')]['origin'])[_0x3b53('0x111')];}else{_0x241dc0=_0x3b53('0x112');}_0x105d44=typeof _0x5c0d00[_0x3b53('0x66')][_0x3b53('0x38')](',')[_0x3b53('0x63')](function(_0x3de22d){return wildcardUtils[_0x3b53('0x113')](_0x3de22d,_0x241dc0);})!==_0x3b53('0x27');var _0x3a03d2={'chatVersion':_0x40b840,'chatWebsiteAddressOrigin':_0x105d44?_0x241dc0:_0x5c0d00[_0x3b53('0x66')],'remote':_0x5c0d00[_0x3b53('0x114')],'query':querystring[_0x3b53('0x1b')](_[_0x3b53('0x58')](_0x5c0d00[_0x3b53('0x2c')]({'plain':!![]}),{'customerIp':_0x413d24[_0x3b53('0x110')][_0x3b53('0x36')]||_0x413d24['headers'][_0x3b53('0x115')]||_0x413d24[_0x3b53('0x116')][_0x3b53('0x117')]||_0x413d24['ip'],'referer':_0x413d24[_0x3b53('0x110')][_0x3b53('0x3c')],'openedInteractions':_0x102b16,'maxInteractions':_0x3e4aaa,'virtual':_0x2fb786[_0x3b53('0x10a')],'online':_0xa4167f,'custom':_0x2fb786,'address':_0x105d44?_0x241dc0:null}))[_0x3b53('0x118')](/'/g,'\x5c\x27')};_0x43cdb5['send'](ejs['render'](Mustache[_0x3b53('0xe2')](_0x350bd3,_0x3a03d2),{'proactiveActions':_0x9f4ae2,'alignment':_0x5c0d00[_0x3b53('0x119')],'verticalAlignment':_0x5c0d00[_0x3b53('0x11a')],'div_color':_0x5c0d00[_0x3b53('0x106')],'labelText':_0x5c0d00[_0x3b53('0x11b')],'text_color':_0x5c0d00[_0x3b53('0x11c')],'text_button_color':_0x5c0d00[_0x3b53('0x11d')],'button_color':_0x5c0d00[_0x3b53('0x11e')],'background_color':_0x5c0d00[_0x3b53('0x11f')],'hideWhenOffline':_0x5c0d00[_0x3b53('0x120')],'intervalId':_0x5c0d00[_0x3b53('0x121')],'isDevelopment':_0x312589,'chatVersion':_0x40b840}));})[_0x3b53('0x21')](handleError(_0x43cdb5,null));};exports[_0x3b53('0x122')]=function(_0x552a26,_0x10d7ed){var _0x22a944=_0x552a26[_0x3b53('0x60')]['id'];var _0x4a543f=_0x552a26[_0x3b53('0x65')];var _0x7fdb39=0xc8;var _0x2a3389=null;return db[_0x3b53('0xec')]['transaction']({'isolationLevel':db['sequelize'][_0x3b53('0x123')][_0x3b53('0x124')][_0x3b53('0x125')]},function(_0x474c28){return db[_0x3b53('0x49')][_0x3b53('0x7b')]({'where':{'id':_0x22a944},'transaction':_0x474c28})['then'](function(_0x3d6095){if(_0x3d6095){return db[_0x3b53('0xac')]['destroy']({'where':{'ChatWebsiteId':_0x22a944},'transaction':_0x474c28})['then'](function(){var _0x8449dc=_[_0x3b53('0x4c')](_0x4a543f,function(_0x4d4354){_0x4d4354[_0x3b53('0x72')]=_0x22a944;return _0x4d4354;});return db['ChatApplication']['bulkCreate'](_0x8449dc,{'transaction':_0x474c28});});}else{_0x7fdb39=0x194;_0x2a3389=[];}});})['then'](function(){if(_0x7fdb39!==0x194){return db['ChatApplication'][_0x3b53('0x126')]({'where':{'ChatWebsiteId':_0x22a944},'order':'priority'})[_0x3b53('0x17')](function(_0x829d39){_0x2a3389=_0x829d39;});}})[_0x3b53('0x21')](function(_0x194cac){_0x7fdb39=0x1f4;logger[_0x3b53('0x1c')](_0x194cac[_0x3b53('0x2f')]);if(_0x194cac[_0x3b53('0x30')]){delete _0x194cac[_0x3b53('0x30')];}_0x2a3389=_0x194cac;})[_0x3b53('0x127')](function(){if(_0x2a3389===null){_0x10d7ed[_0x3b53('0x23')](_0x7fdb39);}else{if(_0x7fdb39===0x1f4){_0x10d7ed[_0x3b53('0x24')](_0x7fdb39)[_0x3b53('0x31')](_0x2a3389);}else{_0x10d7ed[_0x3b53('0x24')](_0x7fdb39)['json'](_0x2a3389);}}});};exports[_0x3b53('0x128')]=function(_0x28132d,_0x5715f9){var _0x4859d9={};var _0x1eea32={};var _0x4688d2;var _0x398a9c;return db[_0x3b53('0x49')][_0x3b53('0x7b')]({'where':{'id':_0x28132d[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x5715f9,null))['then'](function(_0x204b95){if(_0x204b95){_0x4688d2=_0x204b95;_0x1eea32[_0x3b53('0x41')]=_[_0x3b53('0x4d')](db[_0x3b53('0xac')][_0x3b53('0x61')]);_0x1eea32[_0x3b53('0x4e')]=_['keys'](_0x28132d[_0x3b53('0x4e')]);_0x1eea32[_0x3b53('0x4f')]=_[_0x3b53('0x51')](_0x1eea32[_0x3b53('0x41')],_0x1eea32[_0x3b53('0x4e')]);_0x4859d9[_0x3b53('0x50')]=_[_0x3b53('0x51')](_0x1eea32[_0x3b53('0x41')],qs[_0x3b53('0x52')](_0x28132d[_0x3b53('0x4e')][_0x3b53('0x52')]));_0x4859d9['attributes']=_0x4859d9[_0x3b53('0x50')][_0x3b53('0x62')]?_0x4859d9['attributes']:_0x1eea32[_0x3b53('0x41')];_0x4859d9[_0x3b53('0x53')]=qs[_0x3b53('0x54')](_0x28132d[_0x3b53('0x4e')][_0x3b53('0x54')]);_0x4859d9[_0x3b53('0x57')]=qs['filters'](_['pick'](_0x28132d[_0x3b53('0x4e')],_0x1eea32[_0x3b53('0x4f')]));if(_0x28132d[_0x3b53('0x4e')][_0x3b53('0x56')]){_0x4859d9[_0x3b53('0x57')]=_['merge'](_0x4859d9['where'],{'$or':_[_0x3b53('0x4c')](_0x4859d9['attributes'],function(_0x1f001c){var _0x10e9ca={};_0x10e9ca[_0x1f001c]={'$like':'%'+_0x28132d['query'][_0x3b53('0x56')]+'%'};return _0x10e9ca;})});}_0x4859d9=_[_0x3b53('0x58')]({},_0x4859d9,_0x28132d[_0x3b53('0x5a')]);return _0x4688d2[_0x3b53('0x128')](_0x4859d9);}})[_0x3b53('0x17')](function(_0x3aad6c){if(_0x3aad6c){_0x398a9c=_0x3aad6c[_0x3b53('0x62')];if(!_0x28132d[_0x3b53('0x4e')][_0x3b53('0x74')](_0x3b53('0x75'))){_0x4859d9[_0x3b53('0x26')]=qs[_0x3b53('0x26')](_0x28132d[_0x3b53('0x4e')]['limit']);_0x4859d9[_0x3b53('0x25')]=qs['offset'](_0x28132d['query'][_0x3b53('0x25')]);}return _0x4688d2[_0x3b53('0x128')](_0x4859d9);}})[_0x3b53('0x17')](function(_0x2bf4fa){if(_0x2bf4fa){return _0x2bf4fa?{'count':_0x398a9c,'rows':_0x2bf4fa}:null;}})[_0x3b53('0x17')](respondWithResult(_0x5715f9,null))[_0x3b53('0x21')](handleError(_0x5715f9,null));};exports[_0x3b53('0x129')]=function(_0x42a337,_0x1248c8){return db[_0x3b53('0x12a')]['find']({'where':{'id':_0x42a337['params']['id']}})['then'](handleEntityNotFound(_0x1248c8,null))[_0x3b53('0x17')](function(_0x378d71){if(_0x378d71){return _0x378d71['addProactiveActions'](_0x42a337[_0x3b53('0x65')]['ids'],_['omit'](_0x42a337['body'],['ids','id'])||{});}})[_0x3b53('0x17')](respondWithResult(_0x1248c8,null))[_0x3b53('0x21')](handleError(_0x1248c8,null));};exports[_0x3b53('0x109')]=function(_0x288bf7,_0x3b4931){var _0x5b70d8={};var _0x532614={};var _0x2ec130;var _0x62fe70;return db[_0x3b53('0x49')][_0x3b53('0x7b')]({'where':{'id':_0x288bf7[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x3b4931,null))[_0x3b53('0x17')](function(_0x285398){if(_0x285398){_0x2ec130=_0x285398;_0x532614['model']=_['keys'](db[_0x3b53('0x12b')][_0x3b53('0x61')]);_0x532614['query']=_[_0x3b53('0x4d')](_0x288bf7[_0x3b53('0x4e')]);_0x532614[_0x3b53('0x4f')]=_['intersection'](_0x532614[_0x3b53('0x41')],_0x532614[_0x3b53('0x4e')]);_0x5b70d8[_0x3b53('0x50')]=_[_0x3b53('0x51')](_0x532614[_0x3b53('0x41')],qs[_0x3b53('0x52')](_0x288bf7[_0x3b53('0x4e')][_0x3b53('0x52')]));_0x5b70d8['attributes']=_0x5b70d8[_0x3b53('0x50')][_0x3b53('0x62')]?_0x5b70d8[_0x3b53('0x50')]:_0x532614[_0x3b53('0x41')];_0x5b70d8[_0x3b53('0x53')]=qs['sort'](_0x288bf7[_0x3b53('0x4e')]['sort']);_0x5b70d8[_0x3b53('0x57')]=qs[_0x3b53('0x4f')](_['pick'](_0x288bf7[_0x3b53('0x4e')],_0x532614[_0x3b53('0x4f')]));if(_0x288bf7['query']['filter']){_0x5b70d8['where']=_[_0x3b53('0x58')](_0x5b70d8['where'],{'$or':_[_0x3b53('0x4c')](_0x5b70d8[_0x3b53('0x50')],function(_0x31949c){var _0x6dc898={};_0x6dc898[_0x31949c]={'$like':'%'+_0x288bf7[_0x3b53('0x4e')]['filter']+'%'};return _0x6dc898;})});}_0x5b70d8=_[_0x3b53('0x58')]({},_0x5b70d8,_0x288bf7[_0x3b53('0x5a')]);return _0x2ec130[_0x3b53('0x109')](_0x5b70d8);}})['then'](function(_0x53a9a0){if(_0x53a9a0){_0x62fe70=_0x53a9a0[_0x3b53('0x62')];if(!_0x288bf7[_0x3b53('0x4e')][_0x3b53('0x74')](_0x3b53('0x75'))){_0x5b70d8['limit']=qs[_0x3b53('0x26')](_0x288bf7[_0x3b53('0x4e')][_0x3b53('0x26')]);_0x5b70d8[_0x3b53('0x25')]=qs[_0x3b53('0x25')](_0x288bf7[_0x3b53('0x4e')]['offset']);}return _0x2ec130[_0x3b53('0x109')](_0x5b70d8);}})['then'](function(_0x49ae38){if(_0x49ae38){return _0x49ae38?{'count':_0x62fe70,'rows':_0x49ae38}:null;}})['then'](respondWithResult(_0x3b4931,null))[_0x3b53('0x21')](handleError(_0x3b4931,null));};exports['getFields']=function(_0x258bce,_0x4137fd){var _0x5c3714=_0x258bce[_0x3b53('0x4e')][_0x3b53('0x12c')]===_0x3b53('0x12d')?_0x3b53('0x12e'):_0x3b53('0x12f');return db[_0x3b53('0x49')]['find']({'attributes':['id',_0x5c3714],'where':{'id':_0x258bce[_0x3b53('0x60')]['id']}})['then'](handleEntityNotFound(_0x4137fd,null))[_0x3b53('0x17')](function(_0x42e7e5){if(_0x42e7e5){var _0x3eb191=_0x42e7e5[_0x5c3714];var _0x9592dd=_0x3eb191&&_0x3eb191[_0x3b53('0x130')]?_0x3eb191['items']:[];_0x4137fd[_0x3b53('0x31')]({'fromKey':_[_0x3b53('0x8a')](_0x3eb191[_0x3b53('0x131')])?undefined:_0x3eb191['fromKey'],'count':_0x9592dd[_0x3b53('0x62')],'rows':_0x9592dd});}})['catch'](handleError(_0x4137fd,null));};exports[_0x3b53('0x132')]=function(_0x3735b7,_0x120852){var _0x2adf34={'raw':![],'where':{}};var _0x4bd388={};var _0x3d7056={'count':0x0,'rows':[]};return db[_0x3b53('0x49')][_0x3b53('0x7b')]({'where':{'id':_0x3735b7[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x120852,null))[_0x3b53('0x17')](function(_0x3615ec){if(_0x3615ec){_0x4bd388['model']=_[_0x3b53('0x4d')](db[_0x3b53('0xe4')][_0x3b53('0x61')]);_0x4bd388[_0x3b53('0x4e')]=_[_0x3b53('0x4d')](_0x3735b7[_0x3b53('0x4e')]);_0x4bd388[_0x3b53('0x4f')]=_[_0x3b53('0x51')](_0x4bd388['model'],_0x4bd388[_0x3b53('0x4e')]);_0x2adf34['attributes']=_[_0x3b53('0x51')](_0x4bd388[_0x3b53('0x41')],qs[_0x3b53('0x52')](_0x3735b7[_0x3b53('0x4e')]['fields']));_0x2adf34[_0x3b53('0x50')]=_0x2adf34['attributes'][_0x3b53('0x62')]?_0x2adf34[_0x3b53('0x50')]:_0x4bd388[_0x3b53('0x41')];if(!_0x3735b7[_0x3b53('0x4e')][_0x3b53('0x74')](_0x3b53('0x75'))){_0x2adf34['limit']=qs[_0x3b53('0x26')](_0x3735b7[_0x3b53('0x4e')][_0x3b53('0x26')]);_0x2adf34[_0x3b53('0x25')]=qs['offset'](_0x3735b7[_0x3b53('0x4e')][_0x3b53('0x25')]);}_0x2adf34[_0x3b53('0x53')]=qs[_0x3b53('0x54')](_0x3735b7[_0x3b53('0x4e')][_0x3b53('0x54')]);_0x2adf34[_0x3b53('0x57')]=qs[_0x3b53('0x4f')](_[_0x3b53('0x55')](_0x3735b7[_0x3b53('0x4e')],_0x4bd388[_0x3b53('0x4f')]));_0x2adf34[_0x3b53('0x57')][_0x3b53('0x72')]=_0x3615ec['id'];if(_0x3735b7[_0x3b53('0x4e')][_0x3b53('0x56')]){_0x2adf34[_0x3b53('0x57')]=_[_0x3b53('0x58')](_0x2adf34[_0x3b53('0x57')],{'$or':_[_0x3b53('0x4c')](_0x2adf34[_0x3b53('0x50')],function(_0x14a2f4){var _0xd5a8b1={};_0xd5a8b1[_0x14a2f4]={'$like':'%'+_0x3735b7[_0x3b53('0x4e')]['filter']+'%'};return _0xd5a8b1;})});}_0x2adf34=_[_0x3b53('0x58')]({},_0x2adf34,_0x3735b7['options']);return db[_0x3b53('0xe4')][_0x3b53('0x28')]({'where':_0x2adf34['where']})[_0x3b53('0x17')](function(_0x1cdabd){_0x3d7056[_0x3b53('0x28')]=_0x1cdabd;if(_0x3735b7[_0x3b53('0x4e')][_0x3b53('0x5b')]){_0x2adf34[_0x3b53('0x5c')]=[{'all':!![]}];}else{_0x2adf34[_0x3b53('0x5c')]=[{'model':db[_0x3b53('0xa0')],'as':_0x3b53('0x100'),'required':![]},{'model':db[_0x3b53('0x133')],'as':_0x3b53('0x134'),'required':![]}];}return db['ChatOfflineMessage'][_0x3b53('0x5d')](_0x2adf34);})[_0x3b53('0x17')](function(_0x19a2c9){_0x3d7056[_0x3b53('0x5e')]=_0x19a2c9;return _0x3d7056;});}})[_0x3b53('0x17')](respondWithFilteredResult(_0x120852,_0x2adf34))[_0x3b53('0x21')](handleError(_0x120852,null));};exports['addAgents']=function(_0x3f3852,_0x2e973b){return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x3f3852[_0x3b53('0x60')]['id']}})['then'](handleEntityNotFound(_0x2e973b,null))[_0x3b53('0x17')](function(_0x25d074){if(_0x25d074){return _0x25d074[_0x3b53('0x135')](_0x3f3852[_0x3b53('0x65')][_0x3b53('0x78')],_[_0x3b53('0xfe')](_0x3f3852[_0x3b53('0x65')],[_0x3b53('0x78'),'id'])||{})[_0x3b53('0xde')](function(_0xa4287e){for(var _0x4a50d4=0x0;_0x4a50d4<_0x3f3852[_0x3b53('0x65')]['ids'][_0x3b53('0x62')];_0x4a50d4+=0x1){socket[_0x3b53('0x136')](_0x3b53('0x137'),{'UserId':Number(_0x3f3852[_0x3b53('0x65')][_0x3b53('0x78')][_0x4a50d4]),'ChatWebsiteId':Number(_0x3f3852[_0x3b53('0x60')]['id'])});}return _0xa4287e;});}})['then'](respondWithResult(_0x2e973b,null))[_0x3b53('0x21')](handleError(_0x2e973b,null));};exports['removeAgents']=function(_0x5f599f,_0x1954db){return db[_0x3b53('0x49')][_0x3b53('0x63')]({'where':{'id':_0x5f599f[_0x3b53('0x60')]['id']}})['then'](handleEntityNotFound(_0x1954db,null))[_0x3b53('0x17')](function(_0x462b3e){if(_0x462b3e){return _0x462b3e[_0x3b53('0x138')](_0x5f599f[_0x3b53('0x4e')]['ids'])[_0x3b53('0x17')](function(){if(_[_0x3b53('0x139')](_0x5f599f[_0x3b53('0x4e')][_0x3b53('0x78')])){for(var _0x4091b7=0x0;_0x4091b7<_0x5f599f[_0x3b53('0x4e')][_0x3b53('0x78')][_0x3b53('0x62')];_0x4091b7+=0x1){socket['emit'](_0x3b53('0x13a'),{'UserId':Number(_0x5f599f['query'][_0x3b53('0x78')][_0x4091b7]),'ChatWebsiteId':Number(_0x5f599f[_0x3b53('0x60')]['id'])});}}else{socket[_0x3b53('0x136')](_0x3b53('0x13a'),{'UserId':Number(_0x5f599f[_0x3b53('0x4e')][_0x3b53('0x78')]),'ChatWebsiteId':Number(_0x5f599f[_0x3b53('0x60')]['id'])});}});}})[_0x3b53('0x17')](respondWithStatusCode(_0x1954db,null))[_0x3b53('0x21')](handleError(_0x1954db,null));};exports[_0x3b53('0x13b')]=function(_0xecf56a,_0x5c1224){var _0x4e4eab={};var _0x345cc0={};var _0x5be9aa;var _0x3d90b4;return db[_0x3b53('0x49')][_0x3b53('0x7b')]({'where':{'id':_0xecf56a[_0x3b53('0x60')]['id']}})[_0x3b53('0x17')](handleEntityNotFound(_0x5c1224,null))['then'](function(_0x302201){if(_0x302201){_0x5be9aa=_0x302201;_0x345cc0[_0x3b53('0x41')]=_['keys'](db[_0x3b53('0xca')][_0x3b53('0x61')]);_0x345cc0['query']=_[_0x3b53('0x4d')](_0xecf56a[_0x3b53('0x4e')]);_0x345cc0[_0x3b53('0x4f')]=_[_0x3b53('0x51')](_0x345cc0['model'],_0x345cc0[_0x3b53('0x4e')]);_0x4e4eab[_0x3b53('0x50')]=_['intersection'](_0x345cc0[_0x3b53('0x41')],qs[_0x3b53('0x52')](_0xecf56a[_0x3b53('0x4e')][_0x3b53('0x52')]));_0x4e4eab[_0x3b53('0x50')]=_0x4e4eab[_0x3b53('0x50')][_0x3b53('0x62')]?_0x4e4eab[_0x3b53('0x50')]:_0x345cc0[_0x3b53('0x41')];_0x4e4eab[_0x3b53('0x53')]=qs[_0x3b53('0x54')](_0xecf56a['query']['sort']);_0x4e4eab[_0x3b53('0x57')]=qs[_0x3b53('0x4f')](_[_0x3b53('0x55')](_0xecf56a['query'],_0x345cc0[_0x3b53('0x4f')]));if(_0xecf56a[_0x3b53('0x4e')]['filter']){_0x4e4eab[_0x3b53('0x57')]=_[_0x3b53('0x58')](_0x4e4eab[_0x3b53('0x57')],{'$or':_[_0x3b53('0x4c')](_0x4e4eab['attributes'],function(_0xdf5d59){var _0x205940={};_0x205940[_0xdf5d59]={'$like':'%'+_0xecf56a['query'][_0x3b53('0x56')]+'%'};return _0x205940;})});}_0x4e4eab=_['merge']({},_0x4e4eab,_0xecf56a['options']);return _0x5be9aa[_0x3b53('0x13b')](_0x4e4eab);}})[_0x3b53('0x17')](function(_0x26c9c4){if(_0x26c9c4){_0x3d90b4=_0x26c9c4[_0x3b53('0x62')];if(!_0xecf56a[_0x3b53('0x4e')][_0x3b53('0x74')](_0x3b53('0x75'))){_0x4e4eab[_0x3b53('0x26')]=qs[_0x3b53('0x26')](_0xecf56a['query'][_0x3b53('0x26')]);_0x4e4eab[_0x3b53('0x25')]=qs[_0x3b53('0x25')](_0xecf56a[_0x3b53('0x4e')]['offset']);}return _0x5be9aa[_0x3b53('0x13b')](_0x4e4eab);}})[_0x3b53('0x17')](function(_0x27dfcb){if(_0x27dfcb){return _0x27dfcb?{'count':_0x3d90b4,'rows':_0x27dfcb}:null;}})[_0x3b53('0x17')](respondWithResult(_0x5c1224,null))[_0x3b53('0x21')](handleError(_0x5c1224,null));}; \ No newline at end of file +var _0xd8b7=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','getDispositions','Disposition','ChatWebsiteId','include','removeDispositions','ids','addAnswer','findOne','CannedAnswer','hasOwnProperty','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','../../config/license/util','getLicense','existsSync','root','server/files/images/logos/','download','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','customerIp','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','List','list','contact','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','ContactId','interaction','messageId','update','created','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','files','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','MailAccountId','originalname','mimetype','toPairsIn','mapValues','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','color','tag','getSnippet','getProactiveActions','virtual','License','increment','readFileSync','server/files/chat/iframe.ejs','3.12.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','remoteAddress','replace','alignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','querystring','ioredis','jayson/promise','../../config/logger','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','destroy','get','stack','name','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','create','address','forEach','testWildcardValidity','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0xd8b7,0xc7));var _0x7d8b=function(_0x531194,_0x5ce58f){_0x531194=_0x531194-0x0;var _0x37c6b4=_0xd8b7[_0x531194];return _0x37c6b4;};'use strict';var Mustache=require(_0x7d8b('0x0'));var util=require(_0x7d8b('0x1'));var path=require('path');var ejs=require(_0x7d8b('0x2'));var fs=require('fs');var fs_extra=require(_0x7d8b('0x3'));var _=require('lodash');var querystring=require(_0x7d8b('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0x7d8b('0x5'));var jayson=require(_0x7d8b('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x7d8b('0x7'))(_0x7d8b('0x8'));var config=require(_0x7d8b('0x9'));var APIBadRequestError=require('../../errors/api')[_0x7d8b('0xa')];var APINotFoundError=require(_0x7d8b('0xb'))[_0x7d8b('0xc')];var APIOutOfIntervalError=require(_0x7d8b('0xb'))[_0x7d8b('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0x7d8b('0xb'))[_0x7d8b('0xe')];var wildcardUtils=require(_0x7d8b('0xf'));var URL=require('url')[_0x7d8b('0x10')];var db=require(_0x7d8b('0x11'))['db'];config[_0x7d8b('0x12')]=_[_0x7d8b('0x13')](config[_0x7d8b('0x12')],{'host':_0x7d8b('0x14'),'port':0x18eb});var socket=require(_0x7d8b('0x15'))(new Redis(config[_0x7d8b('0x12')]));require('./chatWebsite.socket')[_0x7d8b('0x16')](socket);var client=jayson[_0x7d8b('0x17')]['http']({'port':0x232c});var client9002=jayson[_0x7d8b('0x17')]['http']({'port':0x232a});var client9003=jayson[_0x7d8b('0x17')][_0x7d8b('0x18')]({'port':0x232b});var client9001=jayson[_0x7d8b('0x17')][_0x7d8b('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x57edc4,_0x23cdcd,_0x4b1d2f,_0x25a6aa){return new Promise(function(_0x259c13,_0x514818){var _0x39c8c6=_0x25a6aa||client;return _0x39c8c6[_0x7d8b('0x19')](_0x57edc4,_0x4b1d2f)[_0x7d8b('0x1a')](function(_0x47fea8){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x23cdcd,'request\x20sent');logger[_0x7d8b('0x1b')](_0x7d8b('0x1c'),_0x23cdcd,_0x7d8b('0x1d'),JSON[_0x7d8b('0x1e')](_0x47fea8));if(_0x47fea8[_0x7d8b('0x1f')]){if(_0x47fea8[_0x7d8b('0x1f')][_0x7d8b('0x20')]===0x1f4){logger[_0x7d8b('0x1f')](_0x7d8b('0x21'),_0x23cdcd,_0x47fea8[_0x7d8b('0x1f')][_0x7d8b('0x22')]);return _0x514818(_0x47fea8[_0x7d8b('0x1f')][_0x7d8b('0x22')]);}logger[_0x7d8b('0x1f')](_0x7d8b('0x21'),_0x23cdcd,_0x47fea8[_0x7d8b('0x1f')][_0x7d8b('0x22')]);return _0x259c13(_0x47fea8[_0x7d8b('0x1f')][_0x7d8b('0x22')]);}else{logger[_0x7d8b('0x23')](_0x7d8b('0x21'),_0x23cdcd,'request\x20sent');_0x259c13(_0x47fea8[_0x7d8b('0x24')][_0x7d8b('0x22')]);}})[_0x7d8b('0x25')](function(_0x337749){logger['error'](_0x7d8b('0x21'),_0x23cdcd,_0x337749);_0x514818(_0x337749);});});}function respondWithStatusCode(_0x2e5e63,_0x18f2df){_0x18f2df=_0x18f2df||0xcc;return function(_0x1bd096){if(_0x1bd096){return _0x2e5e63[_0x7d8b('0x26')](_0x18f2df);}return _0x2e5e63['status'](_0x18f2df)[_0x7d8b('0x27')]();};}function respondWithResult(_0x32bdef,_0x25ac5a){_0x25ac5a=_0x25ac5a||0xc8;return function(_0xa8454e){if(_0xa8454e){return _0x32bdef[_0x7d8b('0x28')](_0x25ac5a)['json'](_0xa8454e);}};}function respondWithFilteredResult(_0x53d395,_0x4f2397){return function(_0x4ffa8a){if(_0x4ffa8a){var _0x22f649=typeof _0x4f2397[_0x7d8b('0x29')]===_0x7d8b('0x2a')&&typeof _0x4f2397[_0x7d8b('0x2b')]===_0x7d8b('0x2a');var _0x3e9438=_0x4ffa8a['count'];var _0x498844=_0x22f649?0x0:_0x4f2397[_0x7d8b('0x29')];var _0x3f3171=_0x22f649?_0x4ffa8a[_0x7d8b('0x2c')]:_0x4f2397[_0x7d8b('0x29')]+_0x4f2397[_0x7d8b('0x2b')];var _0x328684;if(_0x3f3171>=_0x3e9438){_0x3f3171=_0x3e9438;_0x328684=0xc8;}else{_0x328684=0xce;}_0x53d395[_0x7d8b('0x28')](_0x328684);return _0x53d395['set'](_0x7d8b('0x2d'),_0x498844+'-'+_0x3f3171+'/'+_0x3e9438)[_0x7d8b('0x2e')](_0x4ffa8a);}return null;};}function saveUpdates(_0x565e48){return function(_0x5443f2){if(_0x5443f2){return _0x5443f2['update'](_0x565e48)['then'](function(_0x50df13){return _0x50df13;});}return null;};}function removeEntity(_0x4be95d){return function(_0x742e74){if(_0x742e74){return _0x742e74[_0x7d8b('0x2f')]()[_0x7d8b('0x1a')](function(){var _0x2f0420=_0x742e74[_0x7d8b('0x30')]({'plain':!![]});var _0x4239c8='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x4239c8,'resourceId':_0x2f0420['id']}})['then'](function(){return _0x742e74;});})[_0x7d8b('0x1a')](function(){_0x4be95d['status'](0xcc)[_0x7d8b('0x27')]();});}};}function handleEntityNotFound(_0x3a178e){return function(_0x1572c6){if(!_0x1572c6){_0x3a178e[_0x7d8b('0x26')](0x194);}return _0x1572c6;};}function handleError(_0x30a9da,_0x38b75d){_0x38b75d=_0x38b75d||0x1f4;return function(_0x32e44c){logger['error'](_0x32e44c[_0x7d8b('0x31')]);if(_0x32e44c[_0x7d8b('0x32')]){delete _0x32e44c[_0x7d8b('0x32')];}_0x30a9da['status'](_0x38b75d)['send'](_0x32e44c);};}function createInteractionObject(_0xd8b754,_0x4020c2,_0x1ee71a,_0x5a22e3){var _0x1b1fe5=require('user-agent-parser');var _0x504b7a=new _0x1b1fe5();var _0x501c89=_0x504b7a[_0x7d8b('0x33')](_0x1ee71a[_0x7d8b('0x34')])[_0x7d8b('0x35')]();var _0x461dd8=_0x4020c2['customerIp'];if(_0x1ee71a[_0x7d8b('0x36')]){_0x461dd8=_0x1ee71a['cf-connecting-ip'];}else if(_0x1ee71a[_0x7d8b('0x37')]){_0x461dd8=_[_0x7d8b('0x38')](_0x1ee71a[_0x7d8b('0x37')][_0x7d8b('0x39')](','));}return{'ContactId':_0x5a22e3['id'],'ChatWebsiteId':_0xd8b754,'from':(_0x5a22e3[_0x7d8b('0x3a')]||'')+'\x20'+(_0x5a22e3[_0x7d8b('0x3b')]||''),'customerIp':_0x461dd8,'customerPort':_0x1ee71a[_0x7d8b('0x3c')]?_0x1ee71a[_0x7d8b('0x3c')]:null,'referer':_0x4020c2[_0x7d8b('0x3d')],'browserName':_0x501c89[_0x7d8b('0x3e')][_0x7d8b('0x32')]&&_0x501c89['browser']['version']?util[_0x7d8b('0x3f')]('%s\x20%s',_0x501c89[_0x7d8b('0x3e')][_0x7d8b('0x32')],_0x501c89[_0x7d8b('0x3e')][_0x7d8b('0x40')]):_0x7d8b('0x41'),'browserVersion':_0x501c89[_0x7d8b('0x3e')][_0x7d8b('0x40')]||'unknown','osName':util[_0x7d8b('0x3f')](_0x7d8b('0x42'),_0x501c89['os'][_0x7d8b('0x32')],_0x501c89['os'][_0x7d8b('0x40')]),'osVersion':_0x501c89['os'][_0x7d8b('0x40')],'deviceModel':_0x501c89[_0x7d8b('0x43')][_0x7d8b('0x44')]&&_0x501c89['device'][_0x7d8b('0x45')]?util['format'](_0x7d8b('0x46'),_0x501c89['device'][_0x7d8b('0x44')],_0x501c89[_0x7d8b('0x43')][_0x7d8b('0x45')],_0x501c89[_0x7d8b('0x43')][_0x7d8b('0x47')]):null,'deviceVendor':_0x501c89['device'][_0x7d8b('0x45')],'deviceType':_0x501c89[_0x7d8b('0x43')][_0x7d8b('0x47')],'formData':JSON[_0x7d8b('0x1e')](_0x4020c2)};}exports[_0x7d8b('0x48')]=function(_0x36137,_0x4e6530){var _0x221bbe={'include':[{'model':db['Pause'],'as':_0x7d8b('0x49')}]},_0xc1e294={},_0x29e006={'count':0x0,'rows':[]};var _0x199627=_[_0x7d8b('0x4a')](db[_0x7d8b('0x4b')][_0x7d8b('0x4c')],function(_0xde661b){return{'name':_0xde661b[_0x7d8b('0x4d')],'type':_0xde661b[_0x7d8b('0x47')][_0x7d8b('0x4e')]};});_0xc1e294[_0x7d8b('0x44')]=_['map'](_0x199627,_0x7d8b('0x32'));_0xc1e294[_0x7d8b('0x4f')]=_[_0x7d8b('0x50')](_0x36137[_0x7d8b('0x4f')]);_0xc1e294[_0x7d8b('0x51')]=_[_0x7d8b('0x52')](_0xc1e294['model'],_0xc1e294['query']);_0x221bbe[_0x7d8b('0x53')]=_['intersection'](_0xc1e294[_0x7d8b('0x44')],qs[_0x7d8b('0x54')](_0x36137['query'][_0x7d8b('0x54')]));_0x221bbe[_0x7d8b('0x53')]=_0x221bbe[_0x7d8b('0x53')][_0x7d8b('0x55')]?_0x221bbe[_0x7d8b('0x53')]:_0xc1e294[_0x7d8b('0x44')];if(!_0x36137[_0x7d8b('0x4f')]['hasOwnProperty'](_0x7d8b('0x56'))){_0x221bbe[_0x7d8b('0x2b')]=qs[_0x7d8b('0x2b')](_0x36137[_0x7d8b('0x4f')]['limit']);_0x221bbe[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0x36137[_0x7d8b('0x4f')][_0x7d8b('0x29')]);}_0x221bbe[_0x7d8b('0x57')]=qs['sort'](_0x36137[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0x221bbe[_0x7d8b('0x59')]=qs[_0x7d8b('0x51')](_[_0x7d8b('0x5a')](_0x36137['query'],_0xc1e294['filters']),_0x199627);if(_0x36137[_0x7d8b('0x4f')][_0x7d8b('0x5b')]){_0x221bbe[_0x7d8b('0x59')]=_[_0x7d8b('0x5c')](_0x221bbe[_0x7d8b('0x59')],{'$or':_['map'](_0x199627,function(_0x4d84db){if(_0x4d84db[_0x7d8b('0x47')]!==_0x7d8b('0x5d')){var _0x5a5517={};_0x5a5517[_0x4d84db[_0x7d8b('0x32')]]={'$like':'%'+_0x36137[_0x7d8b('0x4f')][_0x7d8b('0x5b')]+'%'};return _0x5a5517;}})});}_0x221bbe=_['merge']({},_0x221bbe,_0x36137[_0x7d8b('0x5e')]);var _0x212dc3={'where':_0x221bbe['where']};return db['ChatWebsite']['count'](_0x212dc3)[_0x7d8b('0x1a')](function(_0x299c61){_0x29e006[_0x7d8b('0x2c')]=_0x299c61;if(_0x36137['query'][_0x7d8b('0x5f')]){_0x221bbe['include']=[{'all':!![]}];}return db[_0x7d8b('0x4b')][_0x7d8b('0x60')](_0x221bbe);})[_0x7d8b('0x1a')](function(_0x5756f3){_0x29e006[_0x7d8b('0x61')]=_0x5756f3;return _0x29e006;})[_0x7d8b('0x1a')](respondWithFilteredResult(_0x4e6530,_0x221bbe))[_0x7d8b('0x25')](handleError(_0x4e6530,null));};exports[_0x7d8b('0x62')]=function(_0x404d26,_0x598469){var _0x8708f6={'raw':![],'where':{'id':_0x404d26[_0x7d8b('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x7d8b('0x49')}]},_0x5836c1={};_0x5836c1[_0x7d8b('0x44')]=_[_0x7d8b('0x50')](db[_0x7d8b('0x4b')]['rawAttributes']);_0x5836c1[_0x7d8b('0x4f')]=_[_0x7d8b('0x50')](_0x404d26[_0x7d8b('0x4f')]);_0x5836c1[_0x7d8b('0x51')]=_['intersection'](_0x5836c1[_0x7d8b('0x44')],_0x5836c1[_0x7d8b('0x4f')]);_0x8708f6[_0x7d8b('0x53')]=_[_0x7d8b('0x52')](_0x5836c1[_0x7d8b('0x44')],qs['fields'](_0x404d26[_0x7d8b('0x4f')][_0x7d8b('0x54')]));_0x8708f6[_0x7d8b('0x53')]=_0x8708f6[_0x7d8b('0x53')][_0x7d8b('0x55')]?_0x8708f6[_0x7d8b('0x53')]:_0x5836c1[_0x7d8b('0x44')];if(_0x404d26['query'][_0x7d8b('0x5f')]){_0x8708f6['include']=[{'all':!![]}];}_0x8708f6=_[_0x7d8b('0x5c')]({},_0x8708f6,_0x404d26[_0x7d8b('0x5e')]);return db[_0x7d8b('0x4b')]['find'](_0x8708f6)[_0x7d8b('0x1a')](handleEntityNotFound(_0x598469,null))[_0x7d8b('0x1a')](respondWithResult(_0x598469,null))[_0x7d8b('0x25')](handleError(_0x598469,null));};exports[_0x7d8b('0x64')]=function(_0x25a00f,_0x57e47d){var _0x3c2b9c=null;_0x25a00f['body'][_0x7d8b('0x65')][_0x7d8b('0x39')](',')[_0x7d8b('0x66')](_0x2bea6a=>{if(_0x2bea6a['trim']()!==''&&!wildcardUtils[_0x7d8b('0x67')](_0x2bea6a[_0x7d8b('0x68')]())){_0x3c2b9c=new APIBadRequestError('\x22'+_0x2bea6a['trim']()+_0x7d8b('0x69'));}});if(_0x3c2b9c){return handleError(_0x57e47d,null)(_0x3c2b9c);}return db[_0x7d8b('0x4b')][_0x7d8b('0x64')](_0x25a00f[_0x7d8b('0x6a')],{})[_0x7d8b('0x1a')](function(_0x1df61f){var _0x1286e7=_0x25a00f[_0x7d8b('0x6b')][_0x7d8b('0x30')]({'plain':!![]});if(!_0x1286e7)throw new Error(_0x7d8b('0x6c'));if(_0x1286e7[_0x7d8b('0x6d')]===_0x7d8b('0x6b')){var _0x3e6905=_0x1df61f[_0x7d8b('0x30')]({'plain':!![]});var _0xd4988c='ChatWebsites';return db[_0x7d8b('0x6e')][_0x7d8b('0x6f')]({'where':{'name':_0xd4988c,'userProfileId':_0x1286e7[_0x7d8b('0x70')]},'raw':!![]})[_0x7d8b('0x1a')](function(_0x2d8fa6){if(_0x2d8fa6&&_0x2d8fa6[_0x7d8b('0x71')]===0x0){return db[_0x7d8b('0x72')][_0x7d8b('0x64')]({'name':_0x3e6905[_0x7d8b('0x32')],'resourceId':_0x3e6905['id'],'type':_0x2d8fa6[_0x7d8b('0x32')],'sectionId':_0x2d8fa6['id']},{})[_0x7d8b('0x1a')](function(){return _0x1df61f;});}else{return _0x1df61f;}})['catch'](function(_0x3ef703){logger[_0x7d8b('0x1f')](_0x7d8b('0x73'),_0x3ef703);throw _0x3ef703;});}return _0x1df61f;})['then'](respondWithResult(_0x57e47d,0xc9))[_0x7d8b('0x25')](handleError(_0x57e47d,null));};exports['update']=function(_0x2ccf2f,_0xf76089){var _0x229602=null;_0x2ccf2f[_0x7d8b('0x6a')][_0x7d8b('0x65')][_0x7d8b('0x39')](',')[_0x7d8b('0x66')](_0x267e82=>{if(_0x267e82[_0x7d8b('0x68')]()!==''&&!wildcardUtils[_0x7d8b('0x67')](_0x267e82[_0x7d8b('0x68')]())){_0x229602=new APIBadRequestError('\x22'+_0x267e82[_0x7d8b('0x68')]()+_0x7d8b('0x69'));}});if(_0x229602){return handleError(_0xf76089,null)(_0x229602);}if(_0x2ccf2f[_0x7d8b('0x6a')]['id']){delete _0x2ccf2f[_0x7d8b('0x6a')]['id'];}return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x2ccf2f[_0x7d8b('0x63')]['id']},'include':[{'model':db[_0x7d8b('0x74')],'as':_0x7d8b('0x49')}]})[_0x7d8b('0x1a')](handleEntityNotFound(_0xf76089,null))[_0x7d8b('0x1a')](saveUpdates(_0x2ccf2f[_0x7d8b('0x6a')],null))[_0x7d8b('0x1a')](respondWithResult(_0xf76089,null))['catch'](handleError(_0xf76089,null));};exports[_0x7d8b('0x2f')]=function(_0x2857d1,_0x282284){return db['ChatWebsite']['find']({'where':{'id':_0x2857d1[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x282284,null))[_0x7d8b('0x1a')](removeEntity(_0x282284,null))[_0x7d8b('0x25')](handleError(_0x282284,null));};exports[_0x7d8b('0x75')]=function(_0x57c368,_0x3568a3){return db[_0x7d8b('0x4b')][_0x7d8b('0x75')]()[_0x7d8b('0x1a')](respondWithResult(_0x3568a3,null))[_0x7d8b('0x25')](handleError(_0x3568a3,null));};exports[_0x7d8b('0x76')]=function(_0xb9a30c,_0xbb955c){if(_0xb9a30c[_0x7d8b('0x6a')]['id']){delete _0xb9a30c[_0x7d8b('0x6a')]['id'];}return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0xb9a30c['params']['id']}})['then'](handleEntityNotFound(_0xbb955c,null))['then'](function(_0x57907a){if(_0x57907a){_0xb9a30c[_0x7d8b('0x6a')]['ChatWebsiteId']=_0x57907a['id'];return db['Disposition'][_0x7d8b('0x64')](_0xb9a30c[_0x7d8b('0x6a')]);}})[_0x7d8b('0x1a')](respondWithResult(_0xbb955c,null))[_0x7d8b('0x25')](handleError(_0xbb955c,null));};exports[_0x7d8b('0x77')]=function(_0x5bc895,_0x11419c){var _0x4dba37={'raw':![],'where':{}};var _0x22e4dc={};var _0x355fdb={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5bc895[_0x7d8b('0x63')]['id']}})['then'](handleEntityNotFound(_0x11419c,null))[_0x7d8b('0x1a')](function(_0x2e796f){if(_0x2e796f){_0x22e4dc[_0x7d8b('0x44')]=_['keys'](db[_0x7d8b('0x78')][_0x7d8b('0x4c')]);_0x22e4dc[_0x7d8b('0x4f')]=_[_0x7d8b('0x50')](_0x5bc895[_0x7d8b('0x4f')]);_0x22e4dc[_0x7d8b('0x51')]=_[_0x7d8b('0x52')](_0x22e4dc['model'],_0x22e4dc[_0x7d8b('0x4f')]);_0x4dba37[_0x7d8b('0x53')]=_[_0x7d8b('0x52')](_0x22e4dc['model'],qs['fields'](_0x5bc895['query']['fields']));_0x4dba37[_0x7d8b('0x53')]=_0x4dba37[_0x7d8b('0x53')][_0x7d8b('0x55')]?_0x4dba37[_0x7d8b('0x53')]:_0x22e4dc[_0x7d8b('0x44')];if(!_0x5bc895[_0x7d8b('0x4f')]['hasOwnProperty'](_0x7d8b('0x56'))){_0x4dba37['limit']=qs[_0x7d8b('0x2b')](_0x5bc895['query']['limit']);_0x4dba37[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0x5bc895[_0x7d8b('0x4f')]['offset']);}_0x4dba37['order']=qs[_0x7d8b('0x58')](_0x5bc895[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0x4dba37[_0x7d8b('0x59')]=qs[_0x7d8b('0x51')](_[_0x7d8b('0x5a')](_0x5bc895[_0x7d8b('0x4f')],_0x22e4dc[_0x7d8b('0x51')]));_0x4dba37['where'][_0x7d8b('0x79')]=_0x2e796f['id'];if(_0x5bc895[_0x7d8b('0x4f')][_0x7d8b('0x5b')]){_0x4dba37['where']=_[_0x7d8b('0x5c')](_0x4dba37[_0x7d8b('0x59')],{'$or':_[_0x7d8b('0x4a')](_0x4dba37[_0x7d8b('0x53')],function(_0x4f4594){var _0xc08c0e={};_0xc08c0e[_0x4f4594]={'$like':'%'+_0x5bc895[_0x7d8b('0x4f')]['filter']+'%'};return _0xc08c0e;})});}_0x4dba37=_['merge']({},_0x4dba37,_0x5bc895[_0x7d8b('0x5e')]);return db['Disposition'][_0x7d8b('0x2c')]({'where':_0x4dba37['where']})[_0x7d8b('0x1a')](function(_0x2ec5be){_0x355fdb[_0x7d8b('0x2c')]=_0x2ec5be;if(_0x5bc895[_0x7d8b('0x4f')][_0x7d8b('0x5f')]){_0x4dba37[_0x7d8b('0x7a')]=[{'all':!![]}];}return db[_0x7d8b('0x78')][_0x7d8b('0x60')](_0x4dba37);})[_0x7d8b('0x1a')](function(_0x458fa0){_0x355fdb[_0x7d8b('0x61')]=_0x458fa0;return _0x355fdb;});}})[_0x7d8b('0x1a')](respondWithFilteredResult(_0x11419c,_0x4dba37))[_0x7d8b('0x25')](handleError(_0x11419c,null));};exports[_0x7d8b('0x7b')]=function(_0x509ef7,_0x2470b5){return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x509ef7[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x2470b5,null))['then'](function(_0x6887c0){if(_0x6887c0){return _0x6887c0[_0x7d8b('0x7b')](_0x509ef7[_0x7d8b('0x4f')][_0x7d8b('0x7c')]);}})[_0x7d8b('0x1a')](respondWithStatusCode(_0x2470b5,null))[_0x7d8b('0x25')](handleError(_0x2470b5,null));};exports[_0x7d8b('0x7d')]=function(_0x3b94e4,_0x3c1bb6){if(_0x3b94e4[_0x7d8b('0x6a')]['id']){delete _0x3b94e4[_0x7d8b('0x6a')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x3b94e4['params']['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x3c1bb6,null))['then'](function(_0x13b649){if(_0x13b649){_0x3b94e4['body'][_0x7d8b('0x79')]=_0x13b649['id'];return db['CannedAnswer']['create'](_0x3b94e4[_0x7d8b('0x6a')]);}})[_0x7d8b('0x1a')](respondWithResult(_0x3c1bb6,null))[_0x7d8b('0x25')](handleError(_0x3c1bb6,null));};exports['getAnswers']=function(_0x13e666,_0x2fc009){var _0x580da5={'raw':![],'where':{}};var _0x3a7782={};var _0x1bc13f={'count':0x0,'rows':[]};return db[_0x7d8b('0x4b')][_0x7d8b('0x7e')]({'where':{'id':_0x13e666[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x2fc009,null))[_0x7d8b('0x1a')](function(_0x37ce02){if(_0x37ce02){_0x3a7782[_0x7d8b('0x44')]=_[_0x7d8b('0x50')](db[_0x7d8b('0x7f')][_0x7d8b('0x4c')]);_0x3a7782[_0x7d8b('0x4f')]=_['keys'](_0x13e666[_0x7d8b('0x4f')]);_0x3a7782['filters']=_['intersection'](_0x3a7782[_0x7d8b('0x44')],_0x3a7782['query']);_0x580da5['attributes']=_[_0x7d8b('0x52')](_0x3a7782[_0x7d8b('0x44')],qs['fields'](_0x13e666[_0x7d8b('0x4f')]['fields']));_0x580da5[_0x7d8b('0x53')]=_0x580da5[_0x7d8b('0x53')][_0x7d8b('0x55')]?_0x580da5['attributes']:_0x3a7782[_0x7d8b('0x44')];if(!_0x13e666[_0x7d8b('0x4f')][_0x7d8b('0x80')](_0x7d8b('0x56'))){_0x580da5[_0x7d8b('0x2b')]=qs[_0x7d8b('0x2b')](_0x13e666[_0x7d8b('0x4f')]['limit']);_0x580da5[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0x13e666[_0x7d8b('0x4f')][_0x7d8b('0x29')]);}_0x580da5[_0x7d8b('0x57')]=qs[_0x7d8b('0x58')](_0x13e666[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0x580da5[_0x7d8b('0x59')]=qs['filters'](_[_0x7d8b('0x5a')](_0x13e666['query'],_0x3a7782[_0x7d8b('0x51')]));_0x580da5['where'][_0x7d8b('0x79')]=_0x37ce02['id'];if(_0x13e666[_0x7d8b('0x4f')][_0x7d8b('0x5b')]){_0x580da5[_0x7d8b('0x59')]=_[_0x7d8b('0x5c')](_0x580da5['where'],{'$or':_[_0x7d8b('0x4a')](_0x580da5[_0x7d8b('0x53')],function(_0xed6f21){var _0x373282={};_0x373282[_0xed6f21]={'$like':'%'+_0x13e666[_0x7d8b('0x4f')]['filter']+'%'};return _0x373282;})});}_0x580da5=_[_0x7d8b('0x5c')]({},_0x580da5,_0x13e666[_0x7d8b('0x5e')]);return db['CannedAnswer']['count']({'where':_0x580da5[_0x7d8b('0x59')]})[_0x7d8b('0x1a')](function(_0x3f1ed9){_0x1bc13f['count']=_0x3f1ed9;if(_0x13e666[_0x7d8b('0x4f')]['includeAll']){_0x580da5['include']=[{'all':!![]}];}return db[_0x7d8b('0x7f')]['findAll'](_0x580da5);})[_0x7d8b('0x1a')](function(_0x569569){_0x1bc13f[_0x7d8b('0x61')]=_0x569569;return _0x1bc13f;});}})[_0x7d8b('0x1a')](respondWithFilteredResult(_0x2fc009,_0x580da5))[_0x7d8b('0x25')](handleError(_0x2fc009,null));};exports[_0x7d8b('0x81')]=function(_0x451d29,_0x1883f5){return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x451d29['params']['id']}})['then'](handleEntityNotFound(_0x1883f5,null))[_0x7d8b('0x1a')](function(_0x1f5762){if(_0x1f5762){return _0x1f5762[_0x7d8b('0x81')](_0x451d29[_0x7d8b('0x4f')][_0x7d8b('0x7c')]);}})['then'](respondWithStatusCode(_0x1883f5,null))[_0x7d8b('0x25')](handleError(_0x1883f5,null));};exports['addLogo']=function(_0x3e5490,_0x8c43c9){_0x3e5490['body'][_0x7d8b('0x82')]=_0x3e5490[_0x7d8b('0x83')][_0x7d8b('0x84')];return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x3e5490[_0x7d8b('0x63')]['id']}})['then'](handleEntityNotFound(_0x8c43c9,null))[_0x7d8b('0x1a')](saveUpdates(_0x3e5490[_0x7d8b('0x6a')],null))[_0x7d8b('0x1a')](respondWithResult(_0x8c43c9,null))[_0x7d8b('0x25')](handleError(_0x8c43c9,null));};exports[_0x7d8b('0x85')]=function(_0x1af0cb,_0x4c55eb){_0x1af0cb[_0x7d8b('0x6a')][_0x7d8b('0x86')]=_0x1af0cb['file'][_0x7d8b('0x84')];return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x1af0cb[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x4c55eb,null))[_0x7d8b('0x1a')](saveUpdates(_0x1af0cb[_0x7d8b('0x6a')],null))[_0x7d8b('0x1a')](respondWithResult(_0x4c55eb,null))[_0x7d8b('0x25')](handleError(_0x4c55eb,null));};exports[_0x7d8b('0x87')]=function(_0x1f48c7,_0x3bf93f){_0x1f48c7[_0x7d8b('0x6a')][_0x7d8b('0x88')]=_0x1f48c7['file']['filename'];return db[_0x7d8b('0x4b')]['find']({'where':{'id':_0x1f48c7['params']['id']}})['then'](handleEntityNotFound(_0x3bf93f,null))['then'](saveUpdates(_0x1f48c7[_0x7d8b('0x6a')],null))['then'](respondWithResult(_0x3bf93f,null))['catch'](handleError(_0x3bf93f,null));};exports[_0x7d8b('0x89')]=function(_0x5baa02,_0x96d39b){_0x5baa02[_0x7d8b('0x6a')]['systemAvatar']=_0x5baa02[_0x7d8b('0x83')][_0x7d8b('0x84')];return db['ChatWebsite']['find']({'where':{'id':_0x5baa02[_0x7d8b('0x63')]['id']}})['then'](handleEntityNotFound(_0x96d39b,null))[_0x7d8b('0x1a')](saveUpdates(_0x5baa02[_0x7d8b('0x6a')],null))[_0x7d8b('0x1a')](respondWithResult(_0x96d39b,null))[_0x7d8b('0x25')](handleError(_0x96d39b,null));};exports[_0x7d8b('0x8a')]=function(_0x157de2,_0x57b7ff){var _0x344b26=path[_0x7d8b('0x8b')](config['root'],'server/files/images/logos/default_logo.svg');var _0x2e38e2={'where':{'id':_0x157de2[_0x7d8b('0x63')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1fc937=![];return require(_0x7d8b('0x8c'))[_0x7d8b('0x8d')]()[_0x7d8b('0x1a')](function(_0x5e78ff){if(_0x5e78ff){_0x1fc937=_0x5e78ff['custom'];}})['then'](function(){return db[_0x7d8b('0x4b')]['find'](_0x2e38e2);})[_0x7d8b('0x1a')](handleEntityNotFound(_0x57b7ff,null))[_0x7d8b('0x1a')](function(_0x596165){if(_0x596165){if(!_['isNil'](_0x596165[_0x7d8b('0x82')])){if(fs[_0x7d8b('0x8e')](path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x90'),_0x596165[_0x7d8b('0x82')]))&&_0x1fc937){_0x344b26=path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x90'),_0x596165[_0x7d8b('0x82')]);}}return _0x57b7ff[_0x7d8b('0x91')](_0x344b26);}})['catch'](handleError(_0x57b7ff,null));};exports['getAvatar']=function(_0x1057b0,_0x47d7ab){var _0x5673ac=path['join'](config[_0x7d8b('0x8f')],'server/files/images/avatars/default_avatar.png');var _0x14e486={'where':{'id':_0x1057b0[_0x7d8b('0x63')]['id']},'attributes':['id',_0x7d8b('0x86')],'raw':!![]};return db['ChatWebsite'][_0x7d8b('0x6f')](_0x14e486)['then'](handleEntityNotFound(_0x47d7ab,null))[_0x7d8b('0x1a')](function(_0x89ea7a){if(_0x89ea7a){if(!_[_0x7d8b('0x92')](_0x89ea7a[_0x7d8b('0x86')])){if(fs[_0x7d8b('0x8e')](path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x93'),_0x89ea7a[_0x7d8b('0x86')]))){_0x5673ac=path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x93'),_0x89ea7a[_0x7d8b('0x86')]);}}return _0x47d7ab[_0x7d8b('0x91')](_0x5673ac);}})[_0x7d8b('0x25')](handleError(_0x47d7ab,null));};exports[_0x7d8b('0x94')]=function(_0x4c4a2c,_0x12a77b){var _0x45e6a9=path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],'server/files/images/avatars/customer_avatar.png');var _0x1279e6={'where':{'id':_0x4c4a2c[_0x7d8b('0x63')]['id']},'attributes':['id',_0x7d8b('0x88'),_0x7d8b('0x95')],'raw':!![]};return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')](_0x1279e6)[_0x7d8b('0x1a')](handleEntityNotFound(_0x12a77b,null))[_0x7d8b('0x1a')](function(_0xd16fd5){if(_0xd16fd5){if(!_[_0x7d8b('0x92')](_0xd16fd5[_0x7d8b('0x88')])){if(fs[_0x7d8b('0x8e')](path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x93'),_0xd16fd5[_0x7d8b('0x88')]))&&_0xd16fd5[_0x7d8b('0x95')]){_0x45e6a9=path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x93'),_0xd16fd5[_0x7d8b('0x88')]);}}return _0x12a77b['download'](_0x45e6a9);}})['catch'](handleError(_0x12a77b,null));};exports['getSystemAvatar']=function(_0x31706e,_0x514326){var _0x39640a=path['join'](config[_0x7d8b('0x8f')],_0x7d8b('0x96'));var _0x72a4c4={'where':{'id':_0x31706e[_0x7d8b('0x63')]['id']},'attributes':['id',_0x7d8b('0x97')],'raw':!![]};return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')](_0x72a4c4)[_0x7d8b('0x1a')](handleEntityNotFound(_0x514326,null))[_0x7d8b('0x1a')](function(_0x24793a){if(_0x24793a){if(!_[_0x7d8b('0x92')](_0x24793a[_0x7d8b('0x97')])){if(fs[_0x7d8b('0x8e')](path[_0x7d8b('0x8b')](config['root'],'server/files/images/avatars/',_0x24793a[_0x7d8b('0x97')]))){_0x39640a=path['join'](config[_0x7d8b('0x8f')],_0x7d8b('0x93'),_0x24793a[_0x7d8b('0x97')]);}}return _0x514326['download'](_0x39640a);}})[_0x7d8b('0x25')](handleError(_0x514326,null));};function checkWebsiteInterval(_0x14792f){var _0x1e6df6=_0x14792f[_0x7d8b('0x98')];if(!_0x1e6df6){return Promise[_0x7d8b('0x99')](_0x14792f);}var _0x2a837d=_0x14792f[_0x7d8b('0x9a')]||undefined;return _0x1e6df6[_0x7d8b('0x9b')](_0x2a837d)[_0x7d8b('0x1a')](function(_0x36a086){if(!_0x36a086){throw new APIOutOfIntervalError();}return _0x14792f;});}exports[_0x7d8b('0x9c')]=function(_0x2bbf7e,_0x12966e){var _0x18bc0b={'body':_0x2bbf7e['body'],'channel':_0x7d8b('0x9d')};var _0x165b30=[];var _0x13858b=[];var _0x40582e={};var _0x215e87=![];if(_0x2bbf7e[_0x7d8b('0x6a')]['id']){delete _0x2bbf7e[_0x7d8b('0x6a')]['id'];}if(_[_0x7d8b('0x92')](_0x2bbf7e['body']['from'])){throw new APIBadRequestError(_0x7d8b('0x9e'));}if(_[_0x7d8b('0x92')](_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x9f')])){throw new APIBadRequestError(_0x7d8b('0xa0'));}if(_[_0x7d8b('0xa1')](_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x6a')])){throw new APIBadRequestError(_0x7d8b('0xa2'));}var _0x4af186=_0x2bbf7e['body'][_0x7d8b('0xa3')]&&_0x2bbf7e['body']['referer'];return db['CmContact'][_0x7d8b('0x75')]()[_0x7d8b('0x1a')](function(_0x207301){if(!_0x207301){throw new Error(_0x7d8b('0xa4'));}_0x165b30=Object[_0x7d8b('0x50')](_0x207301)['filter'](function(_0x193747){return![_0x7d8b('0xa5'),_0x7d8b('0xa6')]['includes'](_0x193747);});_0x13858b=Object[_0x7d8b('0x50')](_0x207301)['filter'](function(_0x1e2232){return![_0x7d8b('0xa5'),_0x7d8b('0xa6'),_0x7d8b('0xa7'),_0x7d8b('0xa8')]['includes'](_0x1e2232);});if(!_['includes'](_0x13858b,_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x9f')])){throw new APIBadRequestError(_0x7d8b('0xa9')+_0x13858b[_0x7d8b('0x8b')](',\x20'));}_0x40582e[_0x2bbf7e[_0x7d8b('0x6a')]['mapKey']]=_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xaa')];})[_0x7d8b('0x1a')](function(){return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x2bbf7e[_0x7d8b('0x63')]['id']},'include':[{'model':db[_0x7d8b('0xab')],'as':'List','include':[{'model':db[_0x7d8b('0xac')],'as':_0x7d8b('0xad'),'where':_0x40582e,'limit':0x1,'order':[[_0x7d8b('0xa6'),_0x7d8b('0xae')]]}]},{'model':db[_0x7d8b('0xaf')],'as':_0x7d8b('0xb0')},{'model':db[_0x7d8b('0x98')],'as':_0x7d8b('0x98'),'include':[{'model':db['Interval'],'as':_0x7d8b('0xb1'),'attributes':['id',_0x7d8b('0xb2')],'raw':!![]}]}]});})[_0x7d8b('0x1a')](function(_0x3b7341){if(!_0x3b7341){throw new APINotFoundError(util[_0x7d8b('0x3f')](_0x7d8b('0xb3'),_0x2bbf7e[_0x7d8b('0x63')]['id']));}if(_0x4af186){return checkWebsiteInterval(_0x3b7341);}return _0x3b7341;})[_0x7d8b('0x1a')](function(_0x506970){_0x18bc0b[_0x7d8b('0xb4')]=_0x506970;_0x18bc0b[_0x7d8b('0xb5')]=_[_0x7d8b('0xb6')](_0x506970[_0x7d8b('0xb0')],['priority'],['asc']);if(_0x18bc0b[_0x7d8b('0xb4')]['Applications']){delete _0x18bc0b[_0x7d8b('0xb4')][_0x7d8b('0xb0')];}_0x18bc0b['list']=_0x506970[_0x7d8b('0xb7')]||{'id':_0x506970['ListId']};if(_0x18bc0b[_0x7d8b('0xb8')]&&_0x18bc0b[_0x7d8b('0xb8')]['Contacts'][_0x7d8b('0x55')]){return _0x18bc0b[_0x7d8b('0xb8')][_0x7d8b('0xad')][0x0];}var _0x413546=_['defaults'](_0x2bbf7e[_0x7d8b('0x6a')],{'firstName':_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xaa')],'ListId':_0x506970[_0x7d8b('0xa8')]});_0x413546[_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x9f')]]=_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xaa')];return db[_0x7d8b('0xac')][_0x7d8b('0x64')](_0x413546,{'fields':_0x165b30,'raw':!![]});})['then'](function(_0x27650c){_0x18bc0b[_0x7d8b('0xb9')]=_0x27650c;var _0x1ea9d4=createInteractionObject(_0x2bbf7e[_0x7d8b('0x63')]['id'],_0x2bbf7e[_0x7d8b('0x6a')],_0x2bbf7e[_0x7d8b('0xba')],_0x27650c);var _0xd28d8f={'ChatWebsiteId':_0x2bbf7e[_0x7d8b('0x63')]['id']};if(_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xbb')]){_0xd28d8f[_0x7d8b('0xbb')]=_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xbb')];_0xd28d8f['closed']=![];return db[_0x7d8b('0xbc')][_0x7d8b('0x6f')]({'where':_0xd28d8f})[_0x7d8b('0x1a')](function(_0xc57099){var _0x20014d=_0x2bbf7e['body'][_0x7d8b('0xa3')]&&_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x3d')];if(_0xc57099){_0x215e87=!![];return _0xc57099;}else if(!_0x20014d&&_0xc57099&&_0xc57099[_0x7d8b('0xbd')]){throw new APIConflictError(_0x7d8b('0xbe'));}_0x1ea9d4[_0x7d8b('0xbb')]=_0x2bbf7e[_0x7d8b('0x6a')]['threadId'];_0x1ea9d4['externalUrl']=_0x2bbf7e[_0x7d8b('0x6a')]['externalUrl'];return db[_0x7d8b('0xbc')][_0x7d8b('0x64')](_0x1ea9d4);});}_0xd28d8f[_0x7d8b('0xbf')]=_0x27650c['id'];if(_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xc0')]&&_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xc0')]['id']){_0xd28d8f['id']=_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xc0')]['id'];return db[_0x7d8b('0xbc')][_0x7d8b('0x6f')]({'where':_0xd28d8f})[_0x7d8b('0x1a')](function(_0xf77a9c){var _0x53e1de=_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xa3')]&&_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x3d')];if(!_0x53e1de&&_0xf77a9c&&_0xf77a9c[_0x7d8b('0xbd')]){throw new APIConflictError(_0x7d8b('0xbe'));}else if(_0xf77a9c){_0x215e87=!![];return _0xf77a9c;}else{return db[_0x7d8b('0xbc')][_0x7d8b('0x64')](_0x1ea9d4);}});}return db['ChatInteraction'][_0x7d8b('0x64')](_0x1ea9d4);})[_0x7d8b('0x1a')](function(_0x4ab267){if(!_0x215e87){return _0x4ab267;}var _0x168546={'from':(_0x18bc0b[_0x7d8b('0xb9')]['firstName']||'')+'\x20'+(_0x18bc0b[_0x7d8b('0xb9')][_0x7d8b('0x3b')]||'')};if(_0x2bbf7e['body'][_0x7d8b('0xbb')]&&_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xc1')]&&_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xbb')]!=_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0xc1')]){_0x168546[_0x7d8b('0xbb')]=_0x2bbf7e[_0x7d8b('0x6a')]['messageId'];}return _0x4ab267[_0x7d8b('0xc2')](_0x168546);})['then'](function(_0x1b34af){_0x18bc0b[_0x7d8b('0xc0')]=_0x1b34af[_0x7d8b('0x30')]({'plain':!![]});_0x18bc0b['interaction'][_0x7d8b('0xc3')]=!_0x215e87;if(_0x18bc0b['interaction'][_0x7d8b('0xc3')]){if(_0x18bc0b[_0x7d8b('0xb4')]['autoclose']){_0x18bc0b['applications']['push']({'id':0x0,'priority':_0x18bc0b[_0x7d8b('0xb5')]['length']+0x1,'app':_0x7d8b('0xc4'),'appdata':_0x7d8b('0xc5'),'interval':_0x7d8b('0xc6')});}}return db[_0x7d8b('0xc7')][_0x7d8b('0x64')]({'body':_0x2bbf7e[_0x7d8b('0x6a')][_0x7d8b('0x6a')],'ChatWebsiteId':_0x2bbf7e[_0x7d8b('0x63')]['id'],'ChatInteractionId':_0x1b34af['id'],'direction':'in','ContactId':_0x18bc0b[_0x7d8b('0xb9')]['id'],'AttachmentId':_0x2bbf7e['body']['AttachmentId']});})['then'](function(_0x10eb78){_0x18bc0b[_0x7d8b('0x22')]=_0x10eb78;if(!_0x18bc0b[_0x7d8b('0xc0')][_0x7d8b('0xc8')]){return;}return db[_0x7d8b('0xc9')][_0x7d8b('0x6f')]({'attributes':['id',_0x7d8b('0x32')],'where':{'id':_0x18bc0b[_0x7d8b('0xc0')][_0x7d8b('0xc8')]}});})[_0x7d8b('0x1a')](function(_0x27e0c4){if(_0x27e0c4){_0x18bc0b['applications'][_0x7d8b('0xca')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x27e0c4[_0x7d8b('0x32')]+','+(_0x18bc0b[_0x7d8b('0xb4')][_0x7d8b('0xcb')]||0xa),'interval':_0x7d8b('0xc6')});_0x18bc0b[_0x7d8b('0xcc')]=!![];}if(!_0x18bc0b['interaction']['queueId']){return;}return db[_0x7d8b('0xcd')][_0x7d8b('0x6f')]({'attributes':['id',_0x7d8b('0x32')],'where':{'id':_0x18bc0b[_0x7d8b('0xc0')]['queueId']}});})['then'](function(_0x49c129){if(_0x49c129){_0x18bc0b[_0x7d8b('0xb5')][_0x7d8b('0xca')]({'id':0x0,'priority':0x1,'app':_0x7d8b('0xce'),'appdata':_0x49c129['name']+','+(_0x18bc0b['account'][_0x7d8b('0xcf')]||0x12c),'interval':_0x7d8b('0xc6')});}return respondWithRpcPromise(_0x7d8b('0xd0'),_0x7d8b('0xd1'),_0x18bc0b);})[_0x7d8b('0x1a')](function(_0x2f7c10){respondWithRpcPromise(_0x7d8b('0xd2'),_0x7d8b('0xd2'),{'event':_0x7d8b('0x9c'),'message':_0x2f7c10},client9002);return _0x2f7c10;})[_0x7d8b('0x1a')](respondWithResult(_0x12966e,null))[_0x7d8b('0x25')](APIHandleError(_0x12966e));};exports[_0x7d8b('0xd3')]=function(_0x1392d6,_0x505397){var _0xfd0132,_0x24c605,_0x1cd99f;var _0x51538c=[];var _0x1c293a={};var _0x1399d4=_0x1392d6['files']||[];var _0x16fcd1=[];var _0x2c0cb1;return db[_0x7d8b('0xac')][_0x7d8b('0x75')]()['then'](function(_0x3cbaeb){if(!_0x3cbaeb){throw new db[(_0x7d8b('0xd4'))][(_0x7d8b('0xd5'))](_0x7d8b('0xd6'));}_0x51538c=_[_0x7d8b('0xd7')](_[_0x7d8b('0x50')](_0x3cbaeb),[_0x7d8b('0xa5'),_0x7d8b('0xa6'),'CompanyId',_0x7d8b('0xa8')]);if(_0x1392d6[_0x7d8b('0x6a')]['id']){delete _0x1392d6[_0x7d8b('0x6a')]['id'];}if(_[_0x7d8b('0x92')](_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0xaa')])){throw _0x505397[_0x7d8b('0x28')](0x1f4)[_0x7d8b('0xd8')](new db[(_0x7d8b('0xd4'))][(_0x7d8b('0xd5'))](_0x7d8b('0xd9')));}if(_[_0x7d8b('0x92')](_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0x6a')])||_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0x6a')]===''){throw _0x505397[_0x7d8b('0x28')](0x1f4)[_0x7d8b('0xd8')](new db[(_0x7d8b('0xd4'))][(_0x7d8b('0xd5'))](_0x7d8b('0xda')));}if(_[_0x7d8b('0x92')](_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0xdb')])){throw _0x505397[_0x7d8b('0x28')](0x1f4)['send'](new db[(_0x7d8b('0xd4'))][(_0x7d8b('0xd5'))](_0x7d8b('0xdc')+_0x51538c));}if(!_[_0x7d8b('0xdd')](_0x51538c,_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0xdb')])){throw _0x505397[_0x7d8b('0x28')](0x1f4)[_0x7d8b('0xd8')](new db[(_0x7d8b('0xd4'))][(_0x7d8b('0xd5'))](_0x7d8b('0xde')+_0x51538c));}_0x1c293a[_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0xdb')]]=_0x1392d6[_0x7d8b('0x6a')]['from'];})[_0x7d8b('0x1a')](function(){return db[_0x7d8b('0x4b')]['find']({'where':{'id':_0x1392d6[_0x7d8b('0x63')]['id']},'include':[{'model':db[_0x7d8b('0xab')],'as':_0x7d8b('0xb7')},{'model':db['MailAccount'],'as':_0x7d8b('0xdf')}]});})[_0x7d8b('0x1a')](handleEntityNotFound(_0x505397,null))[_0x7d8b('0x1a')](function(_0x1d44aa){if(_0x1d44aa&&_0x1d44aa[_0x7d8b('0xb7')]){_0x24c605=_0x1d44aa;var _0x45a10e=_['defaults'](_0x1392d6['body'],{'firstName':_0x1392d6[_0x7d8b('0x6a')]['from'],'phone':_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0xaa')],'ListId':_0x1d44aa[_0x7d8b('0xa8')]});_0x45a10e[_0x1392d6[_0x7d8b('0x6a')]['mapKeyOffline']]=_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0xaa')];return db[_0x7d8b('0xac')]['findOrCreate']({'where':_0x1c293a,'defaults':_0x45a10e});}})[_0x7d8b('0xe0')](function(_0x5a2a9f){if(_0x5a2a9f){_0x1cd99f=_0x5a2a9f;var _0x5e5c19=fs['readFileSync'](path['join'](config['root'],_0x7d8b('0xe1')),'utf8');var _0x3b0c52=ejs[_0x7d8b('0xe2')](_0x5e5c19,{'body':_[_0x7d8b('0xe3')](_0x1392d6[_0x7d8b('0x6a')][_0x7d8b('0x6a')]),'bodyTitle':_0x24c605[_0x7d8b('0xe4')]});return db['ChatOfflineMessage'][_0x7d8b('0x64')]({'body':_0x3b0c52,'plainBody':htmlToText['fromString'](_0x3b0c52),'ContactId':_0x5a2a9f['id'],'ChatWebsiteId':_0x24c605['id']});}})[_0x7d8b('0x1a')](function(_0x5b8072){_0x2c0cb1=_0x5b8072;if(_0x1399d4[_0x7d8b('0x55')]){var _0x3de624=_0x1399d4['map'](function(_0x452579){return{'name':_0x452579['originalname'],'basename':_0x452579['filename'],'type':_0x452579['mimetype'],'ChatOfflineMessageId':_0x5b8072['id']};});_0x16fcd1=_0x3de624[_0x7d8b('0x4a')](_0x106928=>{var _0x2f85d1={'filename':_0x106928[_0x7d8b('0x32')],'path':path['join'](config['root'],'server',_0x7d8b('0xe5'),'attachments',_0x7d8b('0xe6'),_0x106928[_0x7d8b('0xe7')])};return _0x2f85d1;});if(!_0x24c605[_0x7d8b('0xe8')]){return db[_0x7d8b('0xe9')][_0x7d8b('0xea')](function(_0xb4192b){return db[_0x7d8b('0xeb')]['bulkCreate'](_0x3de624,{'transaction':_0xb4192b});});}}})['then'](function(){if(_0x2c0cb1){_0xfd0132=_0x2c0cb1;return db[_0x7d8b('0xdf')][_0x7d8b('0x7e')]({'where':{'service':!![]},'include':[{'model':db[_0x7d8b('0xec')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x7d8b('0xed'),'raw':!![]}]}]});}})[_0x7d8b('0x1a')](function(_0xf99f37){if(_0xf99f37&&_0xf99f37[_0x7d8b('0xee')]&&_0x24c605[_0x7d8b('0xef')]&&_0x24c605[_0x7d8b('0xf0')]){var _0xd394ba=_0xf99f37[_0x7d8b('0xf1')]();return respondWithRpcPromise(_0x7d8b('0xf2'),_0x7d8b('0xf3'),{'account':_0xd394ba,'message':{'from':util[_0x7d8b('0x3f')]('\x22%s\x22\x20<%s>',_0xf99f37['name'],_0xf99f37[_0x7d8b('0xf4')]||_0xf99f37[_0x7d8b('0xee')][_0x7d8b('0x6b')]),'to':_0x24c605[_0x7d8b('0xf0')],'subject':_0x24c605['offlineMessageSubject'],'html':_0xfd0132[_0x7d8b('0x6a')],'attachments':_0x16fcd1}},client9003)[_0x7d8b('0x1a')](function(){return _0xfd0132;})[_0x7d8b('0x25')](function(_0x11fcf5){logger['error'](_0x11fcf5);});}})[_0x7d8b('0x1a')](function(){if(_0x24c605&&_0x24c605['openNewInteraction']&&_0x24c605[_0x7d8b('0xf5')]){var _0x47df85=[];if(_0x1399d4[_0x7d8b('0x55')]){_0x47df85=_0x1399d4['map'](function(_0x32c896){return{'name':_0x32c896[_0x7d8b('0xf6')],'basename':_0x32c896['filename'],'type':_0x32c896[_0x7d8b('0xf7')],'ChatOfflineMessageId':_0x2c0cb1['id']};});}var _0x4eb770;if(!_[_0x7d8b('0x92')](_0x24c605['subjectOffline'])){var _0x401c8c=_[_0x7d8b('0x4a')](_0x1392d6[_0x7d8b('0x6a')],function(_0x1ec3d8){return _0x1ec3d8;});var _0x2657f6=_[_0x7d8b('0xf8')](_0x401c8c)[0x0];var _0x65e4a=_[_0x7d8b('0xf9')](_0x2657f6,function(_0x46ccb6){return _0x46ccb6;});_0x4eb770=_0x65e4a[0x1][_0x24c605[_0x7d8b('0xfa')]];}var _0x533557={'from':_0x1cd99f[_0x7d8b('0xf4')],'firstName':_0x1cd99f[_0x7d8b('0x3a')],'lastName':_0x1cd99f[_0x7d8b('0x3b')],'mapKey':_0x7d8b('0xf4'),'message':{'from':_0x1cd99f[_0x7d8b('0xf4')],'to':_0x24c605[_0x7d8b('0xdf')][_0x7d8b('0xf4')],'cc':'','subject':_[_0x7d8b('0x92')](_0x4eb770)?_0x24c605[_0x7d8b('0xfb')]:_0x4eb770,'messageId':'','sentAt':new Date(),'attach':_0x47df85[_0x7d8b('0x55')],'attachments':_0x47df85,'originChannel':_0x7d8b('0xfc'),'ChatWebsiteId':_0x24c605['id'],'ChatOfflineMessageId':_0xfd0132['id'],'originTo':_0x24c605[_0x7d8b('0xdf')]['email']},'body':_0xfd0132[_0x7d8b('0x6a')]};var _0x308022={'account':{'id':_0x24c605[_0x7d8b('0xf5')]},'body':_0x533557,'log':_0x7d8b('0xfd')};return respondWithRpcPromise(_0x7d8b('0xfd'),_0x7d8b('0xfe'),_0x308022,client9001)[_0x7d8b('0x1a')](function(){return _0xfd0132;})['catch'](function(_0x236dcb){logger['error'](_0x236dcb);});}return;})[_0x7d8b('0x1a')](function(){if(_0xfd0132){return _0xfd0132;}})[_0x7d8b('0x1a')](respondWithResult(_0x505397,null))[_0x7d8b('0x25')](function(){for(var _0x2ce4e3 of _0x1399d4){var _0x2a74d2=path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0xff'),_0x7d8b('0xe5'),_0x7d8b('0x100'),_0x7d8b('0xe6'),_0x2ce4e3[_0x7d8b('0x84')]);fs_extra[_0x7d8b('0x101')](_0x2a74d2)['catch'](function(_0x45ac32){logger[_0x7d8b('0x1f')](_0x7d8b('0x102'),_0x2a74d2,_0x45ac32);});}});};exports['addInteraction']=function(_0x3bb7fc,_0x9d869c){return db['ChatInteraction'][_0x7d8b('0x6f')]({'where':{'id':_0x3bb7fc[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x9d869c,null))[_0x7d8b('0x1a')](function(_0x414cc5){if(_0x414cc5){return _0x414cc5[_0x7d8b('0x103')](_0x3bb7fc[_0x7d8b('0x6a')][_0x7d8b('0x7c')],_[_0x7d8b('0x104')](_0x3bb7fc[_0x7d8b('0x6a')],['ids','id'])||{});}})[_0x7d8b('0x1a')](respondWithResult(_0x9d869c,null))[_0x7d8b('0x25')](handleError(_0x9d869c,null));};exports[_0x7d8b('0x105')]=function(_0x484b1c,_0x110cbd){var _0x2f9299={'raw':![],'where':{}};var _0x4c04b4={};var _0xc16242={'count':0x0,'rows':[]};return db[_0x7d8b('0x4b')]['findOne']({'where':{'id':_0x484b1c[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x110cbd,null))[_0x7d8b('0x1a')](function(_0x210733){if(_0x210733){_0x4c04b4[_0x7d8b('0x44')]=_['keys'](db[_0x7d8b('0xbc')][_0x7d8b('0x4c')]);_0x4c04b4['query']=_['keys'](_0x484b1c['query']);_0x4c04b4[_0x7d8b('0x51')]=_[_0x7d8b('0x52')](_0x4c04b4[_0x7d8b('0x44')],_0x4c04b4['query']);_0x2f9299[_0x7d8b('0x53')]=_[_0x7d8b('0x52')](_0x4c04b4[_0x7d8b('0x44')],qs[_0x7d8b('0x54')](_0x484b1c['query']['fields']));_0x2f9299[_0x7d8b('0x53')]=_0x2f9299[_0x7d8b('0x53')][_0x7d8b('0x55')]?_0x2f9299[_0x7d8b('0x53')]:_0x4c04b4[_0x7d8b('0x44')];if(!_0x484b1c['query']['hasOwnProperty']('nolimit')){_0x2f9299[_0x7d8b('0x2b')]=qs[_0x7d8b('0x2b')](_0x484b1c[_0x7d8b('0x4f')][_0x7d8b('0x2b')]);_0x2f9299[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0x484b1c[_0x7d8b('0x4f')][_0x7d8b('0x29')]);}_0x2f9299['order']=qs['sort'](_0x484b1c[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0x2f9299[_0x7d8b('0x59')]=qs[_0x7d8b('0x51')](_[_0x7d8b('0x5a')](_0x484b1c[_0x7d8b('0x4f')],_0x4c04b4[_0x7d8b('0x51')]));_0x2f9299[_0x7d8b('0x59')][_0x7d8b('0x79')]=_0x210733['id'];if(_0x484b1c['query'][_0x7d8b('0x5b')]){_0x2f9299[_0x7d8b('0x59')]=_[_0x7d8b('0x5c')](_0x2f9299[_0x7d8b('0x59')],{'$or':_[_0x7d8b('0x4a')](_0x2f9299[_0x7d8b('0x53')],function(_0x7f17e){var _0x28c2d3={};_0x28c2d3[_0x7f17e]={'$like':'%'+_0x484b1c['query'][_0x7d8b('0x5b')]+'%'};return _0x28c2d3;})});}_0x2f9299=_[_0x7d8b('0x5c')]({},_0x2f9299,_0x484b1c['options']);return db[_0x7d8b('0xbc')][_0x7d8b('0x2c')]({'where':_0x2f9299[_0x7d8b('0x59')]})[_0x7d8b('0x1a')](function(_0x4e70b4){_0xc16242[_0x7d8b('0x2c')]=_0x4e70b4;if(_0x484b1c[_0x7d8b('0x4f')][_0x7d8b('0x5f')]){_0x2f9299[_0x7d8b('0x7a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x7d8b('0xc9')],'as':_0x7d8b('0x106'),'attributes':[_0x7d8b('0x32'),_0x7d8b('0x107'),_0x7d8b('0x108')],'required':![]},{'model':db[_0x7d8b('0x109')],'as':'Tags','attributes':['id','name',_0x7d8b('0x10a')],'where':_0x484b1c[_0x7d8b('0x4f')][_0x7d8b('0x10b')]?{'id':_0x484b1c['query']['tag']}:undefined,'required':_0x484b1c[_0x7d8b('0x4f')][_0x7d8b('0x10b')]?!![]:![]}];}return db[_0x7d8b('0xbc')][_0x7d8b('0x60')](_0x2f9299);})[_0x7d8b('0x1a')](function(_0x27b33e){_0xc16242[_0x7d8b('0x61')]=_0x27b33e;return _0xc16242;});}})[_0x7d8b('0x1a')](respondWithFilteredResult(_0x110cbd,_0x2f9299))['catch'](handleError(_0x110cbd,null));};exports[_0x7d8b('0x10c')]=function(_0x4dbd6,_0xd1b7c3){var _0x7ac840=0x0;var _0x36e391=0x0;var _0x5b56de=![];var _0x11f31c;var _0x47248f;return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'where':{'id':_0x4dbd6[_0x7d8b('0x63')]['id']},'include':[{'model':db['Interval'],'as':_0x7d8b('0x98'),'include':[{'model':db[_0x7d8b('0x98')],'as':'Intervals','attributes':['id',_0x7d8b('0xb2')]}]}]})['then'](handleEntityNotFound(_0xd1b7c3,null))[_0x7d8b('0x1a')](function(_0x3dcb17){if(_0x3dcb17){_0x11f31c=_0x3dcb17;return _0x3dcb17[_0x7d8b('0x10d')]({'raw':!![]});}})[_0x7d8b('0x1a')](function(_0xcd23c8){if(_0x11f31c){if(_0xcd23c8){_0x47248f=_0xcd23c8;}}return require(_0x7d8b('0x8c'))['getLicense']();})['then'](function(_0x3003fc){if(_0x3003fc){_0x36e391=_0x3003fc[_0x7d8b('0x10e')];_0x5b56de=_0x3003fc['custom'];}})[_0x7d8b('0x1a')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x7d8b('0x1a')](function(_0x3cced4){_0x7ac840=_0x3cced4;if(_0x36e391&&_0x3cced4>_0x36e391){return db[_0x7d8b('0x10f')]['findOne']({'where':{'id':0x1}})['then'](function(_0x2604c9){if(_0x2604c9){_0x2604c9[_0x7d8b('0x110')]('chatLicenseExceeded');}});}})[_0x7d8b('0x1a')](function(){var _0x1480ae=_0x11f31c[_0x7d8b('0x98')];var _0x334eba=_0x11f31c[_0x7d8b('0x9a')]||undefined;return _0x1480ae?_0x1480ae[_0x7d8b('0x9b')](_0x334eba):!![];})[_0x7d8b('0x1a')](function(_0x6a9c3b){var _0x552dc8=fs[_0x7d8b('0x111')](path[_0x7d8b('0x8b')](config[_0x7d8b('0x8f')],_0x7d8b('0x112')),'utf8');var _0x20d932=_0x7d8b('0x113');var _0xc2e92a=![];var _0x286d5c,_0x4d3339;if(_0x4dbd6['headers'][_0x7d8b('0x3d')]){_0x286d5c=new URL(_0x4dbd6[_0x7d8b('0xba')][_0x7d8b('0x3d')])['origin'];}else if(_0x4dbd6['headers'][_0x7d8b('0x114')]){_0x286d5c=new URL(_0x4dbd6['headers'][_0x7d8b('0x114')])[_0x7d8b('0x114')];}else{_0x286d5c=_0x7d8b('0x115');}_0x4d3339=typeof _0x11f31c['address'][_0x7d8b('0x39')](',')[_0x7d8b('0x6f')](function(_0x4424eb){return wildcardUtils[_0x7d8b('0x116')](_0x4424eb,_0x286d5c);})!=='undefined';var _0x47ea42={'chatVersion':_0x20d932,'chatWebsiteAddressOrigin':_0x4d3339?_0x286d5c:_0x11f31c['address'],'remote':_0x11f31c[_0x7d8b('0x117')],'query':querystring[_0x7d8b('0x1e')](_[_0x7d8b('0x5c')](_0x11f31c['get']({'plain':!![]}),{'customerIp':_0x4dbd6[_0x7d8b('0xba')][_0x7d8b('0x37')]||_0x4dbd6[_0x7d8b('0xba')]['x-real-ip']||_0x4dbd6['connection'][_0x7d8b('0x118')]||_0x4dbd6['ip'],'referer':_0x4dbd6[_0x7d8b('0xba')][_0x7d8b('0x3d')],'openedInteractions':_0x7ac840,'maxInteractions':_0x36e391,'virtual':_0x5b56de[_0x7d8b('0x10e')],'online':_0x6a9c3b,'custom':_0x5b56de,'address':_0x4d3339?_0x286d5c:null}))[_0x7d8b('0x119')](/'/g,'\x5c\x27')};_0xd1b7c3['send'](ejs[_0x7d8b('0xe2')](Mustache[_0x7d8b('0xe2')](_0x552dc8,_0x47ea42),{'proactiveActions':_0x47248f,'alignment':_0x11f31c[_0x7d8b('0x11a')],'verticalAlignment':_0x11f31c['verticalAlignment'],'div_color':_0x11f31c['color'],'labelText':_0x11f31c[_0x7d8b('0x11b')],'text_color':_0x11f31c[_0x7d8b('0x11c')],'text_button_color':_0x11f31c['textButtonColor'],'button_color':_0x11f31c[_0x7d8b('0x11d')],'background_color':_0x11f31c[_0x7d8b('0x11e')],'hideWhenOffline':_0x11f31c[_0x7d8b('0x11f')],'intervalId':_0x11f31c['IntervalId'],'isDevelopment':_0xc2e92a,'chatVersion':_0x20d932}));})[_0x7d8b('0x25')](handleError(_0xd1b7c3,null));};exports['addApplications']=function(_0x49f4b9,_0x3a94d0){var _0x31548d=_0x49f4b9[_0x7d8b('0x63')]['id'];var _0x74831c=_0x49f4b9[_0x7d8b('0x6a')];var _0x8cebfe=0xc8;var _0x259008=null;return db[_0x7d8b('0xe9')][_0x7d8b('0xea')]({'isolationLevel':db[_0x7d8b('0xe9')][_0x7d8b('0x120')][_0x7d8b('0x121')][_0x7d8b('0x122')]},function(_0xc2cde5){return db[_0x7d8b('0x4b')][_0x7d8b('0x7e')]({'where':{'id':_0x31548d},'transaction':_0xc2cde5})[_0x7d8b('0x1a')](function(_0x760fbb){if(_0x760fbb){return db['ChatApplication'][_0x7d8b('0x2f')]({'where':{'ChatWebsiteId':_0x31548d},'transaction':_0xc2cde5})[_0x7d8b('0x1a')](function(){var _0x48a9ec=_[_0x7d8b('0x4a')](_0x74831c,function(_0x871de7){_0x871de7[_0x7d8b('0x79')]=_0x31548d;return _0x871de7;});return db[_0x7d8b('0xaf')][_0x7d8b('0x123')](_0x48a9ec,{'transaction':_0xc2cde5});});}else{_0x8cebfe=0x194;_0x259008=[];}});})[_0x7d8b('0x1a')](function(){if(_0x8cebfe!==0x194){return db[_0x7d8b('0xaf')][_0x7d8b('0x124')]({'where':{'ChatWebsiteId':_0x31548d},'order':_0x7d8b('0x125')})[_0x7d8b('0x1a')](function(_0x4aebcc){_0x259008=_0x4aebcc;});}})[_0x7d8b('0x25')](function(_0x290396){_0x8cebfe=0x1f4;logger[_0x7d8b('0x1f')](_0x290396[_0x7d8b('0x31')]);if(_0x290396[_0x7d8b('0x32')]){delete _0x290396[_0x7d8b('0x32')];}_0x259008=_0x290396;})[_0x7d8b('0x126')](function(){if(_0x259008===null){_0x3a94d0[_0x7d8b('0x26')](_0x8cebfe);}else{if(_0x8cebfe===0x1f4){_0x3a94d0['status'](_0x8cebfe)[_0x7d8b('0xd8')](_0x259008);}else{_0x3a94d0[_0x7d8b('0x28')](_0x8cebfe)[_0x7d8b('0x2e')](_0x259008);}}});};exports[_0x7d8b('0x127')]=function(_0xb0c755,_0x3d4729){var _0x5cec83={};var _0x4caa74={};var _0x5d2244;var _0x15cc44;return db[_0x7d8b('0x4b')]['findOne']({'where':{'id':_0xb0c755['params']['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x3d4729,null))[_0x7d8b('0x1a')](function(_0x34782f){if(_0x34782f){_0x5d2244=_0x34782f;_0x4caa74[_0x7d8b('0x44')]=_[_0x7d8b('0x50')](db['ChatApplication'][_0x7d8b('0x4c')]);_0x4caa74[_0x7d8b('0x4f')]=_[_0x7d8b('0x50')](_0xb0c755[_0x7d8b('0x4f')]);_0x4caa74[_0x7d8b('0x51')]=_[_0x7d8b('0x52')](_0x4caa74[_0x7d8b('0x44')],_0x4caa74[_0x7d8b('0x4f')]);_0x5cec83[_0x7d8b('0x53')]=_[_0x7d8b('0x52')](_0x4caa74[_0x7d8b('0x44')],qs[_0x7d8b('0x54')](_0xb0c755[_0x7d8b('0x4f')]['fields']));_0x5cec83['attributes']=_0x5cec83['attributes']['length']?_0x5cec83[_0x7d8b('0x53')]:_0x4caa74['model'];_0x5cec83['order']=qs[_0x7d8b('0x58')](_0xb0c755[_0x7d8b('0x4f')]['sort']);_0x5cec83['where']=qs[_0x7d8b('0x51')](_[_0x7d8b('0x5a')](_0xb0c755[_0x7d8b('0x4f')],_0x4caa74[_0x7d8b('0x51')]));if(_0xb0c755[_0x7d8b('0x4f')][_0x7d8b('0x5b')]){_0x5cec83[_0x7d8b('0x59')]=_['merge'](_0x5cec83[_0x7d8b('0x59')],{'$or':_['map'](_0x5cec83[_0x7d8b('0x53')],function(_0x4ade56){var _0x1a3ea5={};_0x1a3ea5[_0x4ade56]={'$like':'%'+_0xb0c755[_0x7d8b('0x4f')][_0x7d8b('0x5b')]+'%'};return _0x1a3ea5;})});}_0x5cec83=_[_0x7d8b('0x5c')]({},_0x5cec83,_0xb0c755[_0x7d8b('0x5e')]);return _0x5d2244[_0x7d8b('0x127')](_0x5cec83);}})[_0x7d8b('0x1a')](function(_0x228eb1){if(_0x228eb1){_0x15cc44=_0x228eb1[_0x7d8b('0x55')];if(!_0xb0c755[_0x7d8b('0x4f')][_0x7d8b('0x80')](_0x7d8b('0x56'))){_0x5cec83['limit']=qs[_0x7d8b('0x2b')](_0xb0c755[_0x7d8b('0x4f')][_0x7d8b('0x2b')]);_0x5cec83[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0xb0c755[_0x7d8b('0x4f')][_0x7d8b('0x29')]);}return _0x5d2244[_0x7d8b('0x127')](_0x5cec83);}})[_0x7d8b('0x1a')](function(_0x5bbeb5){if(_0x5bbeb5){return _0x5bbeb5?{'count':_0x15cc44,'rows':_0x5bbeb5}:null;}})['then'](respondWithResult(_0x3d4729,null))[_0x7d8b('0x25')](handleError(_0x3d4729,null));};exports['addProactiveActions']=function(_0x21d2fb,_0x3f1b6c){return db[_0x7d8b('0x128')][_0x7d8b('0x6f')]({'where':{'id':_0x21d2fb[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x3f1b6c,null))[_0x7d8b('0x1a')](function(_0x83fa72){if(_0x83fa72){return _0x83fa72[_0x7d8b('0x129')](_0x21d2fb[_0x7d8b('0x6a')][_0x7d8b('0x7c')],_[_0x7d8b('0x104')](_0x21d2fb[_0x7d8b('0x6a')],[_0x7d8b('0x7c'),'id'])||{});}})['then'](respondWithResult(_0x3f1b6c,null))[_0x7d8b('0x25')](handleError(_0x3f1b6c,null));};exports[_0x7d8b('0x10d')]=function(_0x12d045,_0x5c78f2){var _0xba7c18={};var _0x207ece={};var _0x1958b6;var _0x23424d;return db[_0x7d8b('0x4b')][_0x7d8b('0x7e')]({'where':{'id':_0x12d045['params']['id']}})['then'](handleEntityNotFound(_0x5c78f2,null))[_0x7d8b('0x1a')](function(_0xeb953d){if(_0xeb953d){_0x1958b6=_0xeb953d;_0x207ece[_0x7d8b('0x44')]=_['keys'](db[_0x7d8b('0x12a')][_0x7d8b('0x4c')]);_0x207ece[_0x7d8b('0x4f')]=_['keys'](_0x12d045['query']);_0x207ece[_0x7d8b('0x51')]=_['intersection'](_0x207ece[_0x7d8b('0x44')],_0x207ece['query']);_0xba7c18[_0x7d8b('0x53')]=_[_0x7d8b('0x52')](_0x207ece[_0x7d8b('0x44')],qs[_0x7d8b('0x54')](_0x12d045[_0x7d8b('0x4f')]['fields']));_0xba7c18[_0x7d8b('0x53')]=_0xba7c18['attributes'][_0x7d8b('0x55')]?_0xba7c18[_0x7d8b('0x53')]:_0x207ece['model'];_0xba7c18[_0x7d8b('0x57')]=qs['sort'](_0x12d045[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0xba7c18[_0x7d8b('0x59')]=qs['filters'](_[_0x7d8b('0x5a')](_0x12d045[_0x7d8b('0x4f')],_0x207ece[_0x7d8b('0x51')]));if(_0x12d045[_0x7d8b('0x4f')]['filter']){_0xba7c18[_0x7d8b('0x59')]=_[_0x7d8b('0x5c')](_0xba7c18[_0x7d8b('0x59')],{'$or':_['map'](_0xba7c18[_0x7d8b('0x53')],function(_0xc84036){var _0x2b494c={};_0x2b494c[_0xc84036]={'$like':'%'+_0x12d045[_0x7d8b('0x4f')][_0x7d8b('0x5b')]+'%'};return _0x2b494c;})});}_0xba7c18=_[_0x7d8b('0x5c')]({},_0xba7c18,_0x12d045['options']);return _0x1958b6['getProactiveActions'](_0xba7c18);}})[_0x7d8b('0x1a')](function(_0x5b9294){if(_0x5b9294){_0x23424d=_0x5b9294[_0x7d8b('0x55')];if(!_0x12d045[_0x7d8b('0x4f')][_0x7d8b('0x80')](_0x7d8b('0x56'))){_0xba7c18[_0x7d8b('0x2b')]=qs[_0x7d8b('0x2b')](_0x12d045[_0x7d8b('0x4f')]['limit']);_0xba7c18[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0x12d045[_0x7d8b('0x4f')][_0x7d8b('0x29')]);}return _0x1958b6[_0x7d8b('0x10d')](_0xba7c18);}})[_0x7d8b('0x1a')](function(_0x2dc496){if(_0x2dc496){return _0x2dc496?{'count':_0x23424d,'rows':_0x2dc496}:null;}})[_0x7d8b('0x1a')](respondWithResult(_0x5c78f2,null))[_0x7d8b('0x25')](handleError(_0x5c78f2,null));};exports[_0x7d8b('0x12b')]=function(_0x57e5ec,_0x595450){var _0x5d2d3d=_0x57e5ec['query']['online']==='false'?_0x7d8b('0x12c'):_0x7d8b('0x12d');return db[_0x7d8b('0x4b')][_0x7d8b('0x6f')]({'attributes':['id',_0x5d2d3d],'where':{'id':_0x57e5ec[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x595450,null))[_0x7d8b('0x1a')](function(_0x40178b){if(_0x40178b){var _0x4d1838=_0x40178b[_0x5d2d3d];var _0x57b4c8=_0x4d1838&&_0x4d1838['items']?_0x4d1838['items']:[];_0x595450['send']({'fromKey':_[_0x7d8b('0x92')](_0x4d1838[_0x7d8b('0x12e')])?undefined:_0x4d1838[_0x7d8b('0x12e')],'count':_0x57b4c8['length'],'rows':_0x57b4c8});}})[_0x7d8b('0x25')](handleError(_0x595450,null));};exports[_0x7d8b('0x12f')]=function(_0x4aac16,_0x1040ba){var _0x4f897b={'raw':![],'where':{}};var _0x4e1816={};var _0x4974f9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7d8b('0x7e')]({'where':{'id':_0x4aac16[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x1040ba,null))[_0x7d8b('0x1a')](function(_0xebdaca){if(_0xebdaca){_0x4e1816[_0x7d8b('0x44')]=_[_0x7d8b('0x50')](db['ChatOfflineMessage'][_0x7d8b('0x4c')]);_0x4e1816[_0x7d8b('0x4f')]=_[_0x7d8b('0x50')](_0x4aac16[_0x7d8b('0x4f')]);_0x4e1816['filters']=_[_0x7d8b('0x52')](_0x4e1816[_0x7d8b('0x44')],_0x4e1816['query']);_0x4f897b[_0x7d8b('0x53')]=_[_0x7d8b('0x52')](_0x4e1816[_0x7d8b('0x44')],qs[_0x7d8b('0x54')](_0x4aac16[_0x7d8b('0x4f')][_0x7d8b('0x54')]));_0x4f897b[_0x7d8b('0x53')]=_0x4f897b['attributes'][_0x7d8b('0x55')]?_0x4f897b['attributes']:_0x4e1816[_0x7d8b('0x44')];if(!_0x4aac16[_0x7d8b('0x4f')]['hasOwnProperty'](_0x7d8b('0x56'))){_0x4f897b['limit']=qs[_0x7d8b('0x2b')](_0x4aac16['query']['limit']);_0x4f897b[_0x7d8b('0x29')]=qs[_0x7d8b('0x29')](_0x4aac16[_0x7d8b('0x4f')]['offset']);}_0x4f897b[_0x7d8b('0x57')]=qs[_0x7d8b('0x58')](_0x4aac16[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0x4f897b['where']=qs[_0x7d8b('0x51')](_[_0x7d8b('0x5a')](_0x4aac16['query'],_0x4e1816['filters']));_0x4f897b['where'][_0x7d8b('0x79')]=_0xebdaca['id'];if(_0x4aac16['query'][_0x7d8b('0x5b')]){_0x4f897b[_0x7d8b('0x59')]=_[_0x7d8b('0x5c')](_0x4f897b[_0x7d8b('0x59')],{'$or':_['map'](_0x4f897b['attributes'],function(_0x4a7d80){var _0x16708c={};_0x16708c[_0x4a7d80]={'$like':'%'+_0x4aac16[_0x7d8b('0x4f')][_0x7d8b('0x5b')]+'%'};return _0x16708c;})});}_0x4f897b=_[_0x7d8b('0x5c')]({},_0x4f897b,_0x4aac16['options']);return db[_0x7d8b('0x130')]['count']({'where':_0x4f897b[_0x7d8b('0x59')]})['then'](function(_0x192da1){_0x4974f9[_0x7d8b('0x2c')]=_0x192da1;if(_0x4aac16[_0x7d8b('0x4f')][_0x7d8b('0x5f')]){_0x4f897b[_0x7d8b('0x7a')]=[{'all':!![]}];}else{_0x4f897b[_0x7d8b('0x7a')]=[{'model':db[_0x7d8b('0xac')],'as':_0x7d8b('0x131'),'required':![]},{'model':db[_0x7d8b('0xeb')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x7d8b('0x60')](_0x4f897b);})[_0x7d8b('0x1a')](function(_0xd11a00){_0x4974f9[_0x7d8b('0x61')]=_0xd11a00;return _0x4974f9;});}})[_0x7d8b('0x1a')](respondWithFilteredResult(_0x1040ba,_0x4f897b))[_0x7d8b('0x25')](handleError(_0x1040ba,null));};exports['addAgents']=function(_0x4468ae,_0x432d06){return db['ChatWebsite'][_0x7d8b('0x6f')]({'where':{'id':_0x4468ae['params']['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x432d06,null))['then'](function(_0x4d4827){if(_0x4d4827){return _0x4d4827[_0x7d8b('0x132')](_0x4468ae[_0x7d8b('0x6a')]['ids'],_['omit'](_0x4468ae[_0x7d8b('0x6a')],['ids','id'])||{})['spread'](function(_0x64ee28){for(var _0x14a830=0x0;_0x14a830<_0x4468ae[_0x7d8b('0x6a')][_0x7d8b('0x7c')][_0x7d8b('0x55')];_0x14a830+=0x1){socket[_0x7d8b('0x133')](_0x7d8b('0x134'),{'UserId':Number(_0x4468ae[_0x7d8b('0x6a')]['ids'][_0x14a830]),'ChatWebsiteId':Number(_0x4468ae['params']['id'])});}return _0x64ee28;});}})[_0x7d8b('0x1a')](respondWithResult(_0x432d06,null))[_0x7d8b('0x25')](handleError(_0x432d06,null));};exports['removeAgents']=function(_0x441e7e,_0x4ddceb){return db[_0x7d8b('0x4b')]['find']({'where':{'id':_0x441e7e['params']['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x4ddceb,null))[_0x7d8b('0x1a')](function(_0x33f3af){if(_0x33f3af){return _0x33f3af[_0x7d8b('0x135')](_0x441e7e[_0x7d8b('0x4f')][_0x7d8b('0x7c')])[_0x7d8b('0x1a')](function(){if(_['isArray'](_0x441e7e[_0x7d8b('0x4f')][_0x7d8b('0x7c')])){for(var _0x1c0436=0x0;_0x1c0436<_0x441e7e[_0x7d8b('0x4f')]['ids'][_0x7d8b('0x55')];_0x1c0436+=0x1){socket[_0x7d8b('0x133')](_0x7d8b('0x136'),{'UserId':Number(_0x441e7e[_0x7d8b('0x4f')][_0x7d8b('0x7c')][_0x1c0436]),'ChatWebsiteId':Number(_0x441e7e['params']['id'])});}}else{socket[_0x7d8b('0x133')]('userChatWebsite:remove',{'UserId':Number(_0x441e7e[_0x7d8b('0x4f')][_0x7d8b('0x7c')]),'ChatWebsiteId':Number(_0x441e7e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4ddceb,null))[_0x7d8b('0x25')](handleError(_0x4ddceb,null));};exports[_0x7d8b('0x137')]=function(_0x3565f7,_0x2d1956){var _0x27d8fd={};var _0x14bbd0={};var _0x1be392;var _0x1184ed;return db[_0x7d8b('0x4b')][_0x7d8b('0x7e')]({'where':{'id':_0x3565f7[_0x7d8b('0x63')]['id']}})[_0x7d8b('0x1a')](handleEntityNotFound(_0x2d1956,null))[_0x7d8b('0x1a')](function(_0x2e5321){if(_0x2e5321){_0x1be392=_0x2e5321;_0x14bbd0[_0x7d8b('0x44')]=_[_0x7d8b('0x50')](db[_0x7d8b('0xc9')][_0x7d8b('0x4c')]);_0x14bbd0[_0x7d8b('0x4f')]=_['keys'](_0x3565f7[_0x7d8b('0x4f')]);_0x14bbd0[_0x7d8b('0x51')]=_['intersection'](_0x14bbd0[_0x7d8b('0x44')],_0x14bbd0['query']);_0x27d8fd[_0x7d8b('0x53')]=_['intersection'](_0x14bbd0['model'],qs['fields'](_0x3565f7[_0x7d8b('0x4f')][_0x7d8b('0x54')]));_0x27d8fd['attributes']=_0x27d8fd[_0x7d8b('0x53')][_0x7d8b('0x55')]?_0x27d8fd[_0x7d8b('0x53')]:_0x14bbd0[_0x7d8b('0x44')];_0x27d8fd[_0x7d8b('0x57')]=qs[_0x7d8b('0x58')](_0x3565f7[_0x7d8b('0x4f')][_0x7d8b('0x58')]);_0x27d8fd[_0x7d8b('0x59')]=qs[_0x7d8b('0x51')](_[_0x7d8b('0x5a')](_0x3565f7['query'],_0x14bbd0[_0x7d8b('0x51')]));if(_0x3565f7[_0x7d8b('0x4f')][_0x7d8b('0x5b')]){_0x27d8fd['where']=_[_0x7d8b('0x5c')](_0x27d8fd[_0x7d8b('0x59')],{'$or':_[_0x7d8b('0x4a')](_0x27d8fd[_0x7d8b('0x53')],function(_0x52e05e){var _0x3e5817={};_0x3e5817[_0x52e05e]={'$like':'%'+_0x3565f7[_0x7d8b('0x4f')][_0x7d8b('0x5b')]+'%'};return _0x3e5817;})});}_0x27d8fd=_[_0x7d8b('0x5c')]({},_0x27d8fd,_0x3565f7[_0x7d8b('0x5e')]);return _0x1be392['getAgents'](_0x27d8fd);}})[_0x7d8b('0x1a')](function(_0x2b6136){if(_0x2b6136){_0x1184ed=_0x2b6136[_0x7d8b('0x55')];if(!_0x3565f7[_0x7d8b('0x4f')][_0x7d8b('0x80')](_0x7d8b('0x56'))){_0x27d8fd[_0x7d8b('0x2b')]=qs[_0x7d8b('0x2b')](_0x3565f7[_0x7d8b('0x4f')][_0x7d8b('0x2b')]);_0x27d8fd[_0x7d8b('0x29')]=qs['offset'](_0x3565f7['query'][_0x7d8b('0x29')]);}return _0x1be392['getAgents'](_0x27d8fd);}})[_0x7d8b('0x1a')](function(_0x141d2d){if(_0x141d2d){return _0x141d2d?{'count':_0x1184ed,'rows':_0x141d2d}:null;}})[_0x7d8b('0x1a')](respondWithResult(_0x2d1956,null))[_0x7d8b('0x25')](handleError(_0x2d1956,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 181ad45..af63daa 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 _0x0851=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x8b3293,_0xada7e6){var _0x2e92a9=function(_0x4be383){while(--_0x4be383){_0x8b3293['push'](_0x8b3293['shift']());}};_0x2e92a9(++_0xada7e6);}(_0x0851,0x8a));var _0x1085=function(_0x300a26,_0x1ad864){_0x300a26=_0x300a26-0x0;var _0x43bccd=_0x0851[_0x300a26];return _0x43bccd;};'use strict';var EventEmitter=require(_0x1085('0x0'));var ChatWebsite=require(_0x1085('0x1'))['db'][_0x1085('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1085('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1085('0x4'),'afterDestroy':_0x1085('0x5')};function emitEvent(_0x2de96f){return function(_0x3cbd88,_0x3b40fb,_0x3a528e){ChatWebsiteEvents[_0x1085('0x6')](_0x2de96f+':'+_0x3cbd88['id'],_0x3cbd88);ChatWebsiteEvents[_0x1085('0x6')](_0x2de96f,_0x3cbd88);_0x3a528e(null);};}for(var e in events){if(events[_0x1085('0x7')](e)){var event=events[e];ChatWebsite[_0x1085('0x8')](e,emitEvent(event));}}module[_0x1085('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf021=['emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf021,0x18f));var _0x1f02=function(_0x31e965,_0xbd1e54){_0x31e965=_0x31e965-0x0;var _0x120351=_0xf021[_0x31e965];return _0x120351;};'use strict';var EventEmitter=require(_0x1f02('0x0'));var ChatWebsite=require(_0x1f02('0x1'))['db'][_0x1f02('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1f02('0x3')](0x0);var events={'afterCreate':_0x1f02('0x4'),'afterUpdate':'update','afterDestroy':_0x1f02('0x5')};function emitEvent(_0x54cd44){return function(_0x2e8594,_0x3164f0,_0x51eff6){ChatWebsiteEvents['emit'](_0x54cd44+':'+_0x2e8594['id'],_0x2e8594);ChatWebsiteEvents[_0x1f02('0x6')](_0x54cd44,_0x2e8594);_0x51eff6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x1f02('0x7')](e,emitEvent(event));}}module[_0x1f02('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4c5a2d0..d3ce412 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 _0xc997=['ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x5df15f,_0x5a3754){var _0x4ef828=function(_0x5ac12e){while(--_0x5ac12e){_0x5df15f['push'](_0x5df15f['shift']());}};_0x4ef828(++_0x5a3754);}(_0xc997,0x198));var _0x7c99=function(_0x42cc9f,_0x5cc832){_0x42cc9f=_0x42cc9f-0x0;var _0x28abfd=_0xc997[_0x42cc9f];return _0x28abfd;};'use strict';var _=require(_0x7c99('0x0'));var util=require('util');var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require(_0x7c99('0x5'));var fs=require('fs');var path=require(_0x7c99('0x6'));var rimraf=require(_0x7c99('0x7'));var config=require(_0x7c99('0x8'));var attributes=require(_0x7c99('0x9'));module[_0x7c99('0xa')]=function(_0x1717d9,_0x5d51d8){return _0x1717d9[_0x7c99('0xb')](_0x7c99('0xc'),attributes,{'tableName':_0x7c99('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4187=['request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','api','moment','bluebird'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x4187,0x133));var _0x7418=function(_0x14e362,_0x40c3ab){_0x14e362=_0x14e362-0x0;var _0x53df45=_0x4187[_0x14e362];return _0x53df45;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7418('0x0'));var moment=require(_0x7418('0x1'));var BPromise=require(_0x7418('0x2'));var rp=require(_0x7418('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7418('0x4'));var config=require(_0x7418('0x5'));var attributes=require(_0x7418('0x6'));module[_0x7418('0x7')]=function(_0x2bde5f,_0x210b13){return _0x2bde5f['define'](_0x7418('0x8'),attributes,{'tableName':_0x7418('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 06102c9..f74b956 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 _0xb133=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22d3e3,_0x2b59ee){var _0x4ba195=function(_0x32a27e){while(--_0x32a27e){_0x22d3e3['push'](_0x22d3e3['shift']());}};_0x4ba195(++_0x2b59ee);}(_0xb133,0x13b));var _0x3b13=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb133[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x3b13('0x0'));var moment=require(_0x3b13('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b13('0x2'));var fs=require('fs');var Redis=require(_0x3b13('0x3'));var db=require(_0x3b13('0x4'))['db'];var utils=require(_0x3b13('0x5'));var logger=require(_0x3b13('0x6'))('rpc');var config=require(_0x3b13('0x7'));var jayson=require(_0x3b13('0x8'));var client=jayson['client'][_0x3b13('0x9')]({'port':0x232a});config['redis']=_[_0x3b13('0xa')](config[_0x3b13('0xb')],{'host':_0x3b13('0xc'),'port':0x18eb});var socket=require(_0x3b13('0xd'))(new Redis(config[_0x3b13('0xb')]));require(_0x3b13('0xe'))[_0x3b13('0xf')](socket);function respondWithRpcPromise(_0x5c3758,_0x529ca4,_0x591d67){return new BPromise(function(_0x535969,_0x51dec9){return client['request'](_0x5c3758,_0x591d67)[_0x3b13('0x10')](function(_0x2b5773){logger[_0x3b13('0x11')](_0x3b13('0x12'),_0x529ca4,_0x3b13('0x13'));logger[_0x3b13('0x14')](_0x3b13('0x15'),_0x529ca4,'request\x20sent',JSON[_0x3b13('0x16')](_0x2b5773));if(_0x2b5773['error']){if(_0x2b5773[_0x3b13('0x17')][_0x3b13('0x18')]===0x1f4){logger[_0x3b13('0x17')](_0x3b13('0x12'),_0x529ca4,_0x2b5773[_0x3b13('0x17')][_0x3b13('0x19')]);return _0x51dec9(_0x2b5773[_0x3b13('0x17')][_0x3b13('0x19')]);}logger[_0x3b13('0x17')](_0x3b13('0x12'),_0x529ca4,_0x2b5773['error'][_0x3b13('0x19')]);return _0x535969(_0x2b5773['error'][_0x3b13('0x19')]);}else{logger[_0x3b13('0x11')](_0x3b13('0x12'),_0x529ca4,_0x3b13('0x13'));_0x535969(_0x2b5773[_0x3b13('0x1a')][_0x3b13('0x19')]);}})[_0x3b13('0x1b')](function(_0x503add){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x529ca4,_0x503add);_0x51dec9(_0x503add);});});} \ No newline at end of file +var _0xa550=['ChatWebsite,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x503923,_0xb36a50){var _0x452bf2=function(_0x17cb98){while(--_0x17cb98){_0x503923['push'](_0x503923['shift']());}};_0x452bf2(++_0xb36a50);}(_0xa550,0x98));var _0x0a55=function(_0x37b07c,_0x5941a1){_0x37b07c=_0x37b07c-0x0;var _0x264672=_0xa550[_0x37b07c];return _0x264672;};'use strict';var _=require('lodash');var util=require(_0x0a55('0x0'));var moment=require(_0x0a55('0x1'));var BPromise=require(_0x0a55('0x2'));var rs=require(_0x0a55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a55('0x4'))['db'];var utils=require(_0x0a55('0x5'));var logger=require(_0x0a55('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a55('0x7'));var client=jayson[_0x0a55('0x8')][_0x0a55('0x9')]({'port':0x232a});config[_0x0a55('0xa')]=_[_0x0a55('0xb')](config[_0x0a55('0xa')],{'host':_0x0a55('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a55('0xa')]));require('./chatWebsite.socket')[_0x0a55('0xd')](socket);function respondWithRpcPromise(_0x45ce91,_0x2e0948,_0x2f6fc7){return new BPromise(function(_0x43f64b,_0xb2b7d8){return client[_0x0a55('0xe')](_0x45ce91,_0x2f6fc7)[_0x0a55('0xf')](function(_0x4ad126){logger[_0x0a55('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x2e0948,_0x0a55('0x11'));logger[_0x0a55('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2e0948,'request\x20sent',JSON[_0x0a55('0x13')](_0x4ad126));if(_0x4ad126[_0x0a55('0x14')]){if(_0x4ad126['error'][_0x0a55('0x15')]===0x1f4){logger[_0x0a55('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2e0948,_0x4ad126[_0x0a55('0x14')][_0x0a55('0x16')]);return _0xb2b7d8(_0x4ad126[_0x0a55('0x14')][_0x0a55('0x16')]);}logger[_0x0a55('0x14')](_0x0a55('0x17'),_0x2e0948,_0x4ad126[_0x0a55('0x14')][_0x0a55('0x16')]);return _0x43f64b(_0x4ad126[_0x0a55('0x14')][_0x0a55('0x16')]);}else{logger[_0x0a55('0x10')](_0x0a55('0x17'),_0x2e0948,'request\x20sent');_0x43f64b(_0x4ad126[_0x0a55('0x18')][_0x0a55('0x16')]);}})['catch'](function(_0x5e4521){logger[_0x0a55('0x14')](_0x0a55('0x17'),_0x2e0948,_0x5e4521);_0xb2b7d8(_0x5e4521);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7cc7ca2..987973d 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 _0x541e=['register','length','./chatWebsite.events','remove','update','emit','removeListener'];(function(_0x482821,_0x4c142d){var _0x3e4aa5=function(_0x6116b1){while(--_0x6116b1){_0x482821['push'](_0x482821['shift']());}};_0x3e4aa5(++_0x4c142d);}(_0x541e,0xc6));var _0xe541=function(_0x541078,_0x5c5aef){_0x541078=_0x541078-0x0;var _0x1518d5=_0x541e[_0x541078];return _0x1518d5;};'use strict';var ChatWebsiteEvents=require(_0xe541('0x0'));var events=['save',_0xe541('0x1'),_0xe541('0x2')];function createListener(_0x5dd4c9,_0xc0b9ba){return function(_0x159d72){_0xc0b9ba[_0xe541('0x3')](_0x5dd4c9,_0x159d72);};}function removeListener(_0xb15bfd,_0x40e5b7){return function(){ChatWebsiteEvents[_0xe541('0x4')](_0xb15bfd,_0x40e5b7);};}exports[_0xe541('0x5')]=function(_0xaab847){for(var _0x574af6=0x0,_0x5e253f=events[_0xe541('0x6')];_0x574af6<_0x5e253f;_0x574af6++){var _0x49f69d=events[_0x574af6];var _0x40128e=createListener('chatWebsite:'+_0x49f69d,_0xaab847);ChatWebsiteEvents['on'](_0x49f69d,_0x40128e);}}; \ No newline at end of file +var _0x17a4=['emit','register','length','chatWebsite:','save','remove','update'];(function(_0x1f76f2,_0xf20812){var _0x26cb60=function(_0x1d4b6b){while(--_0x1d4b6b){_0x1f76f2['push'](_0x1f76f2['shift']());}};_0x26cb60(++_0xf20812);}(_0x17a4,0x15b));var _0x417a=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x17a4[_0xf168d3];return _0x17fb54;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x417a('0x0'),_0x417a('0x1'),_0x417a('0x2')];function createListener(_0x347f73,_0x13511c){return function(_0x1594b6){_0x13511c[_0x417a('0x3')](_0x347f73,_0x1594b6);};}function removeListener(_0x323efb,_0x6cf28b){return function(){ChatWebsiteEvents['removeListener'](_0x323efb,_0x6cf28b);};}exports[_0x417a('0x4')]=function(_0xa626ba){for(var _0x3caaeb=0x0,_0xc2309b=events[_0x417a('0x5')];_0x3caaeb<_0xc2309b;_0x3caaeb++){var _0x24467e=events[_0x3caaeb];var _0x13d2a3=createListener(_0x417a('0x6')+_0x24467e,_0xa626ba);ChatWebsiteEvents['on'](_0x24467e,_0x13d2a3);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index fed0dd3..a869fdc 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc599=['replace','exports','escapeRegExp','URL','localhost','test'];(function(_0x4fd737,_0x27cd51){var _0x25b944=function(_0x2cc749){while(--_0x2cc749){_0x4fd737['push'](_0x4fd737['shift']());}};_0x25b944(++_0x27cd51);}(_0xc599,0x1b2));var _0x9c59=function(_0x4754b9,_0x50664f){_0x4754b9=_0x4754b9-0x0;var _0x2fec82=_0xc599[_0x4754b9];return _0x2fec82;};var escapeRegExp=require('../../../utils/misc')[_0x9c59('0x0')];var URL=require('url')[_0x9c59('0x1')];function testWildcardValidity(_0x3c64d1){var _0xa21af2=!![];try{new URL(_0x3c64d1['replace']('*',_0x9c59('0x2')));}catch(_0x129a0c){_0xa21af2=![];}return _0xa21af2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x9c59('0x3')](_0x3c64d1);}function testWebsiteWithWildcard(_0x2f16df,_0xed605c){var _0x143652;var _0x470ec3=escapeRegExp(_0x2f16df['trim']()['replace'](/\/$/,''))[_0x9c59('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x2f16df[_0x9c59('0x4')]('\x5c*','localhost'));_0x143652=new RegExp(_0x470ec3)[_0x9c59('0x3')](_0xed605c);}catch(_0x458903){_0x143652=![];}return _0x143652;}module[_0x9c59('0x5')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x9af6=['escapeRegExp','url','test','trim','replace','([\x5cw]+)','localhost','../../../utils/misc'];(function(_0x45fa54,_0x204790){var _0x3dd2eb=function(_0x38c6a7){while(--_0x38c6a7){_0x45fa54['push'](_0x45fa54['shift']());}};_0x3dd2eb(++_0x204790);}(_0x9af6,0x1d7));var _0x69af=function(_0x20153e,_0x459a1a){_0x20153e=_0x20153e-0x0;var _0x2c621a=_0x9af6[_0x20153e];return _0x2c621a;};var escapeRegExp=require(_0x69af('0x0'))[_0x69af('0x1')];var URL=require(_0x69af('0x2'))['URL'];function testWildcardValidity(_0x5cdef7){var _0x3c6ca8=!![];try{new URL(_0x5cdef7['replace']('*','localhost'));}catch(_0x185b85){_0x3c6ca8=![];}return _0x3c6ca8&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x69af('0x3')](_0x5cdef7);}function testWebsiteWithWildcard(_0x2b73be,_0x5ba22a){var _0x3848c6;var _0x54e2f1=escapeRegExp(_0x2b73be[_0x69af('0x4')]()[_0x69af('0x5')](/\/$/,''))[_0x69af('0x5')]('\x5c*',_0x69af('0x6'));try{new URL(_0x2b73be[_0x69af('0x5')]('\x5c*',_0x69af('0x7')));_0x3848c6=new RegExp(_0x54e2f1)[_0x69af('0x3')](_0x5ba22a);}catch(_0x37ee87){_0x3848c6=![];}return _0x3848c6;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c260398..87e5e0c 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 _0xd4d0=['addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition'];(function(_0x503185,_0x20d261){var _0xb29eff=function(_0x15e65e){while(--_0x15e65e){_0x503185['push'](_0x503185['shift']());}};_0xb29eff(++_0x20d261);}(_0xd4d0,0xb6));var _0x0d4d=function(_0x5e028b,_0x149511){_0x5e028b=_0x5e028b-0x0;var _0x1f2f05=_0xd4d0[_0x5e028b];return _0x1f2f05;};'use strict';var multer=require(_0x0d4d('0x0'));var util=require(_0x0d4d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d4d('0x2'));var router=express['Router']();var fs_extra=require(_0x0d4d('0x3'));var auth=require(_0x0d4d('0x4'));var interaction=require(_0x0d4d('0x5'));var config=require(_0x0d4d('0x6'));var controller=require(_0x0d4d('0x7'));router[_0x0d4d('0x8')]('/',auth[_0x0d4d('0x9')](),controller[_0x0d4d('0xa')]);router[_0x0d4d('0x8')](_0x0d4d('0xb'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0xc')]);router[_0x0d4d('0x8')](_0x0d4d('0xd'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0xe')]);router['get']('/:id/dispositions',auth[_0x0d4d('0x9')](),controller['getDispositions']);router[_0x0d4d('0x8')](_0x0d4d('0xf'),auth[_0x0d4d('0x9')](),controller['getAnswers']);router[_0x0d4d('0x8')](_0x0d4d('0x10'),controller[_0x0d4d('0x11')]);router[_0x0d4d('0x8')](_0x0d4d('0x12'),controller['getAvatar']);router[_0x0d4d('0x8')](_0x0d4d('0x13'),controller[_0x0d4d('0x14')]);router['get'](_0x0d4d('0x15'),controller[_0x0d4d('0x16')]);router[_0x0d4d('0x8')](_0x0d4d('0x17'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x18')]);router[_0x0d4d('0x8')](_0x0d4d('0x19'),controller[_0x0d4d('0x1a')]);router['get'](_0x0d4d('0x1b'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x1c')]);router[_0x0d4d('0x8')](_0x0d4d('0x1d'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x1e')]);router[_0x0d4d('0x8')](_0x0d4d('0x1f'),controller[_0x0d4d('0x20')]);router[_0x0d4d('0x8')](_0x0d4d('0x21'),auth['isAuthenticated'](),controller[_0x0d4d('0x22')]);router[_0x0d4d('0x8')](_0x0d4d('0x23'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x24')]);router['post']('/',auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x25')]);router[_0x0d4d('0x26')]('/:id/dispositions',auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x27')]);router[_0x0d4d('0x26')](_0x0d4d('0xf'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x28')]);var upload=multer({'storage':multer[_0x0d4d('0x29')]({'destination':function(_0x4c5956,_0x19d579,_0x4a335e){_0x4a335e(null,path[_0x0d4d('0x2a')](config[_0x0d4d('0x2b')],_0x0d4d('0x2c')));},'filename':function(_0x32fab3,_0x2f1011,_0x149ac7){_0x149ac7(null,util[_0x0d4d('0x2d')](_0x0d4d('0x2e'),Date[_0x0d4d('0x2f')](),_0x2f1011[_0x0d4d('0x30')]));}})});router['post']('/:id/logo',upload[_0x0d4d('0x31')](_0x0d4d('0x32')),controller['addLogo']);var upload=multer({'storage':multer[_0x0d4d('0x29')]({'destination':function(_0x88dd8d,_0x24f633,_0x89f6e7){_0x89f6e7(null,path[_0x0d4d('0x2a')](config[_0x0d4d('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x540504,_0x4a311c,_0x474629){_0x474629(null,util[_0x0d4d('0x2d')]('%s-%s',Date[_0x0d4d('0x2f')](),_0x4a311c[_0x0d4d('0x30')]));}})});router[_0x0d4d('0x26')](_0x0d4d('0x12'),upload[_0x0d4d('0x31')](_0x0d4d('0x32')),controller[_0x0d4d('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3aab1e,_0x50c322,_0x4fd851){_0x4fd851(null,path[_0x0d4d('0x2a')](config['root'],_0x0d4d('0x34')));},'filename':function(_0x4e353c,_0x58dbac,_0x59da7a){_0x59da7a(null,util[_0x0d4d('0x2d')]('%s-%s',Date[_0x0d4d('0x2f')](),_0x58dbac[_0x0d4d('0x30')]));}})});router[_0x0d4d('0x26')](_0x0d4d('0x13'),upload[_0x0d4d('0x31')](_0x0d4d('0x32')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x0d4d('0x29')]({'destination':function(_0x410c29,_0x35aca1,_0x141e4b){_0x141e4b(null,path[_0x0d4d('0x2a')](config[_0x0d4d('0x2b')],_0x0d4d('0x34')));},'filename':function(_0x1e55d6,_0x13c875,_0x292a11){_0x292a11(null,util['format'](_0x0d4d('0x2e'),Date['now'](),_0x13c875[_0x0d4d('0x30')]));}})});router[_0x0d4d('0x26')](_0x0d4d('0x15'),upload[_0x0d4d('0x31')](_0x0d4d('0x32')),controller[_0x0d4d('0x35')]);router['post'](_0x0d4d('0x36'),controller[_0x0d4d('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x0d4d('0x29')]({'destination':function(_0x5645af,_0x4e30d6,_0x347aa2){const _0x2e86eb=path[_0x0d4d('0x2a')](config['root'],_0x0d4d('0x38'),_0x0d4d('0x39'),_0x0d4d('0x3a'));fs_extra['ensureDir'](_0x2e86eb,function(){_0x347aa2(null,_0x2e86eb);});},'filename':function(_0x101c85,_0x4a1845,_0x2f327a){const _0x11af41=_0x4a1845[_0x0d4d('0x30')][_0x0d4d('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x597d0=path[_0x0d4d('0x3c')](_0x11af41);const _0x199ca1=Date[_0x0d4d('0x2f')]()+'-'+_0x11af41[_0x0d4d('0x3b')](_0x597d0,'')+_0x597d0;_0x2f327a(null,_0x199ca1);}})});router[_0x0d4d('0x26')](_0x0d4d('0x3d'),offlineUploadMulter['any'](),controller[_0x0d4d('0x3e')]);router[_0x0d4d('0x26')](_0x0d4d('0x17'),auth['isAuthenticated'](),controller[_0x0d4d('0x3f')]);router[_0x0d4d('0x26')](_0x0d4d('0x1b'),auth['isAuthenticated'](),controller[_0x0d4d('0x40')]);router['post'](_0x0d4d('0x1d'),auth['isAuthenticated'](),controller[_0x0d4d('0x41')]);router[_0x0d4d('0x26')](_0x0d4d('0x23'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x42')]);router[_0x0d4d('0x43')](_0x0d4d('0xd'),auth[_0x0d4d('0x9')](),controller['update']);router[_0x0d4d('0x44')](_0x0d4d('0xd'),auth[_0x0d4d('0x9')](),controller['destroy']);router[_0x0d4d('0x44')](_0x0d4d('0x45'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x46')]);router[_0x0d4d('0x44')]('/:id/canned_answers',auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x47')]);router[_0x0d4d('0x44')](_0x0d4d('0x23'),auth[_0x0d4d('0x9')](),controller[_0x0d4d('0x48')]);module[_0x0d4d('0x49')]=router; \ No newline at end of file +var _0x5c4e=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','single','file','addLogo','root','server/files/images/avatars/','format','originalname','addAvatar','addSystemAvatar','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index'];(function(_0x2efe86,_0x4b6c3f){var _0x48e01c=function(_0x5b1412){while(--_0x5b1412){_0x2efe86['push'](_0x2efe86['shift']());}};_0x48e01c(++_0x4b6c3f);}(_0x5c4e,0x198));var _0xe5c4=function(_0x2966ef,_0x1edce9){_0x2966ef=_0x2966ef-0x0;var _0x28870c=_0x5c4e[_0x2966ef];return _0x28870c;};'use strict';var multer=require(_0xe5c4('0x0'));var util=require('util');var path=require(_0xe5c4('0x1'));var timeout=require(_0xe5c4('0x2'));var express=require(_0xe5c4('0x3'));var router=express[_0xe5c4('0x4')]();var fs_extra=require(_0xe5c4('0x5'));var auth=require(_0xe5c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5c4('0x7'));var controller=require(_0xe5c4('0x8'));router[_0xe5c4('0x9')]('/',auth[_0xe5c4('0xa')](),controller[_0xe5c4('0xb')]);router[_0xe5c4('0x9')](_0xe5c4('0xc'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0xd')]);router['get'](_0xe5c4('0xe'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0xf')]);router['get'](_0xe5c4('0x10'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x11')]);router[_0xe5c4('0x9')](_0xe5c4('0x12'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x13')]);router['get'](_0xe5c4('0x14'),controller['getLogo']);router[_0xe5c4('0x9')](_0xe5c4('0x15'),controller[_0xe5c4('0x16')]);router['get'](_0xe5c4('0x17'),controller['getCustomerAvatar']);router['get'](_0xe5c4('0x18'),controller['getSystemAvatar']);router[_0xe5c4('0x9')](_0xe5c4('0x19'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x1a')]);router[_0xe5c4('0x9')]('/:id/snippet',controller['getSnippet']);router[_0xe5c4('0x9')](_0xe5c4('0x1b'),auth['isAuthenticated'](),controller[_0xe5c4('0x1c')]);router[_0xe5c4('0x9')](_0xe5c4('0x1d'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x1e')]);router[_0xe5c4('0x9')]('/:id/fields',controller[_0xe5c4('0x1f')]);router['get'](_0xe5c4('0x20'),auth[_0xe5c4('0xa')](),controller['getOfflineMessages']);router[_0xe5c4('0x9')](_0xe5c4('0x21'),auth[_0xe5c4('0xa')](),controller['getAgents']);router[_0xe5c4('0x22')]('/',auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x23')]);router[_0xe5c4('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe5c4('0x24')]);router[_0xe5c4('0x22')](_0xe5c4('0x12'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x25')]);var upload=multer({'storage':multer[_0xe5c4('0x26')]({'destination':function(_0x2b8b6d,_0x5b29d4,_0x9d535c){_0x9d535c(null,path[_0xe5c4('0x27')](config['root'],_0xe5c4('0x28')));},'filename':function(_0x51a997,_0x3ed6df,_0x4ddcb1){_0x4ddcb1(null,util['format'](_0xe5c4('0x29'),Date[_0xe5c4('0x2a')](),_0x3ed6df['originalname']));}})});router[_0xe5c4('0x22')]('/:id/logo',upload[_0xe5c4('0x2b')](_0xe5c4('0x2c')),controller[_0xe5c4('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5eddbe,_0x58041a,_0x4e6573){_0x4e6573(null,path[_0xe5c4('0x27')](config[_0xe5c4('0x2e')],_0xe5c4('0x2f')));},'filename':function(_0x20e539,_0x807774,_0x3cbd88){_0x3cbd88(null,util[_0xe5c4('0x30')](_0xe5c4('0x29'),Date[_0xe5c4('0x2a')](),_0x807774[_0xe5c4('0x31')]));}})});router['post'](_0xe5c4('0x15'),upload[_0xe5c4('0x2b')]('file'),controller[_0xe5c4('0x32')]);var upload=multer({'storage':multer[_0xe5c4('0x26')]({'destination':function(_0x528122,_0xc7bb6f,_0x15b0ac){_0x15b0ac(null,path[_0xe5c4('0x27')](config[_0xe5c4('0x2e')],'server/files/images/avatars/'));},'filename':function(_0x276e3e,_0x2558de,_0x412cf7){_0x412cf7(null,util[_0xe5c4('0x30')](_0xe5c4('0x29'),Date['now'](),_0x2558de[_0xe5c4('0x31')]));}})});router[_0xe5c4('0x22')](_0xe5c4('0x17'),upload[_0xe5c4('0x2b')](_0xe5c4('0x2c')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe5c4('0x26')]({'destination':function(_0x448c99,_0xf1da42,_0x72d35c){_0x72d35c(null,path[_0xe5c4('0x27')](config[_0xe5c4('0x2e')],_0xe5c4('0x2f')));},'filename':function(_0x345452,_0x2001d6,_0xe459ff){_0xe459ff(null,util['format']('%s-%s',Date[_0xe5c4('0x2a')](),_0x2001d6[_0xe5c4('0x31')]));}})});router[_0xe5c4('0x22')](_0xe5c4('0x18'),upload['single'](_0xe5c4('0x2c')),controller[_0xe5c4('0x33')]);router[_0xe5c4('0x22')]('/:id/notify',controller[_0xe5c4('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xe5c4('0x26')]({'destination':function(_0x3400c1,_0x43d21f,_0xad5dbd){const _0x2ab23b=path['join'](config[_0xe5c4('0x2e')],_0xe5c4('0x35'),_0xe5c4('0x36'),'offline-chat');fs_extra[_0xe5c4('0x37')](_0x2ab23b,function(){_0xad5dbd(null,_0x2ab23b);});},'filename':function(_0x5c915e,_0x2d1b0d,_0x9c7e1){const _0x2652b7=_0x2d1b0d[_0xe5c4('0x31')][_0xe5c4('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x126b7c=path[_0xe5c4('0x39')](_0x2652b7);const _0x458fb9=Date['now']()+'-'+_0x2652b7[_0xe5c4('0x38')](_0x126b7c,'')+_0x126b7c;_0x9c7e1(null,_0x458fb9);}})});router[_0xe5c4('0x22')](_0xe5c4('0x3a'),offlineUploadMulter[_0xe5c4('0x3b')](),controller[_0xe5c4('0x3c')]);router['post'](_0xe5c4('0x19'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x3d')]);router[_0xe5c4('0x22')](_0xe5c4('0x1b'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x3e')]);router[_0xe5c4('0x22')](_0xe5c4('0x1d'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x3f')]);router[_0xe5c4('0x22')](_0xe5c4('0x21'),auth[_0xe5c4('0xa')](),controller['addAgents']);router[_0xe5c4('0x40')](_0xe5c4('0xe'),auth['isAuthenticated'](),controller[_0xe5c4('0x41')]);router[_0xe5c4('0x42')](_0xe5c4('0xe'),auth['isAuthenticated'](),controller[_0xe5c4('0x43')]);router[_0xe5c4('0x42')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xe5c4('0x42')](_0xe5c4('0x12'),auth[_0xe5c4('0xa')](),controller['removeAnswers']);router['delete'](_0xe5c4('0x21'),auth[_0xe5c4('0xa')](),controller[_0xe5c4('0x44')]);module[_0xe5c4('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 2b28d38..2564a65 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 _0xa932=['get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app'];(function(_0x181185,_0x193c0a){var _0x2eeac2=function(_0x733dca){while(--_0x733dca){_0x181185['push'](_0x181185['shift']());}};_0x2eeac2(++_0x193c0a);}(_0xa932,0x117));var _0x2a93=function(_0x2fcf6b,_0xd140ff){_0x2fcf6b=_0x2fcf6b-0x0;var _0x155073=_0xa932[_0x2fcf6b];return _0x155073;};var beaverLogger=require(_0x2a93('0x0'));var express=require(_0x2a93('0x1'));var auth=require(_0x2a93('0x2'));var config=require(_0x2a93('0x3'));var router=express['Router']();var isProduction=config[_0x2a93('0x4')]===_0x2a93('0x5')||![];function clientSideLogs(_0x4692d0,_0x14e173,_0x13f764){var _0x2a58be=_0x4692d0[_0x2a93('0x6')][_0x2a93('0x7')]('client-side-logger');if(!_0x2a58be){throw new Error(_0x2a93('0x8'));}return beaverLogger[_0x2a93('0x9')]({'uri':_0x2a93('0xa'),'logger':_0x2a58be,'enableCors':!isProduction})(_0x4692d0,_0x14e173,_0x13f764);}router['use'](auth[_0x2a93('0xb')](),clientSideLogs);module[_0x2a93('0xc')]=router; \ No newline at end of file +var _0x73b5=['expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','app','get','Client-Side\x20logger\x20not\x20found!'];(function(_0x50a200,_0x107e3b){var _0x209610=function(_0x101ba3){while(--_0x101ba3){_0x50a200['push'](_0x50a200['shift']());}};_0x209610(++_0x107e3b);}(_0x73b5,0x1f3));var _0x573b=function(_0x56a7b5,_0x3cee35){_0x56a7b5=_0x56a7b5-0x0;var _0x238f8c=_0x73b5[_0x56a7b5];return _0x238f8c;};var beaverLogger=require(_0x573b('0x0'));var express=require(_0x573b('0x1'));var auth=require(_0x573b('0x2'));var config=require('../config/environment');var router=express[_0x573b('0x3')]();var isProduction=config[_0x573b('0x4')]==='production'||![];function clientSideLogs(_0x144bab,_0x34fe85,_0xb3ddfb){var _0x433f36=_0x144bab[_0x573b('0x5')][_0x573b('0x6')]('client-side-logger');if(!_0x433f36){throw new Error(_0x573b('0x7'));}return beaverLogger[_0x573b('0x8')]({'uri':_0x573b('0x9'),'logger':_0x433f36,'enableCors':!isProduction})(_0x144bab,_0x34fe85,_0xb3ddfb);}router[_0x573b('0xa')](auth[_0x573b('0xb')](),clientSideLogs);module[_0x573b('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 37500b9..0bed30e 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 _0x2523=['sequelize','AmazonAWS','MicrosoftAzure','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x2523,0x1ae));var _0x3252=function(_0x350281,_0x6e5133){_0x350281=_0x350281-0x0;var _0x1eb3e6=_0x2523[_0x350281];return _0x1eb3e6;};'use strict';var Sequelize=require(_0x3252('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x3252('0x1'),'Google',_0x3252('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x3252('0x3')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x3252('0x3')],'comment':_0x3252('0x4')},'data3':{'type':Sequelize[_0x3252('0x3')],'comment':_0x3252('0x5')},'data4':{'type':Sequelize[_0x3252('0x3')],'comment':_0x3252('0x6')},'data5':{'type':Sequelize[_0x3252('0x7')],'comment':_0x3252('0x8')},'data6':{'type':Sequelize['TEXT'],'comment':_0x3252('0x9')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x8b78=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_secret','TEXT'];(function(_0x415b01,_0x2d427b){var _0x20ee79=function(_0x310391){while(--_0x310391){_0x415b01['push'](_0x415b01['shift']());}};_0x20ee79(++_0x2d427b);}(_0x8b78,0x7a));var _0x88b7=function(_0x572efc,_0x448777){_0x572efc=_0x572efc-0x0;var _0x413052=_0x8b78[_0x572efc];return _0x413052;};'use strict';var Sequelize=require(_0x88b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x88b7('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x88b7('0x2')](_0x88b7('0x3'),_0x88b7('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x88b7('0x5'))},'data1':{'type':Sequelize[_0x88b7('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x88b7('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x88b7('0x1')],'comment':_0x88b7('0x6')},'data4':{'type':Sequelize[_0x88b7('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x88b7('0x7')],'comment':_0x88b7('0x8')},'data6':{'type':Sequelize[_0x88b7('0x7')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x88b7('0x7')],'comment':_0x88b7('0x9')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index cd0d5a7..3299ef3 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 _0x8352=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','CloudProvider','includeAll','findAll','rows','service','MicrosoftAzure','data3','catch','show','keys','rawAttributes','include','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','send','padEnd','slice','map','fieldName','type','model','name','query','intersection'];(function(_0x3f639c,_0x1e281a){var _0x4d899e=function(_0x318a55){while(--_0x318a55){_0x3f639c['push'](_0x3f639c['shift']());}};_0x4d899e(++_0x1e281a);}(_0x8352,0x1c4));var _0x2835=function(_0x945142,_0x35b37c){_0x945142=_0x945142-0x0;var _0x1368cd=_0x8352[_0x945142];return _0x1368cd;};'use strict';var _=require(_0x2835('0x0'));var Redis=require(_0x2835('0x1'));var qs=require(_0x2835('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x2835('0x3'))(_0x2835('0x4'));var db=require(_0x2835('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x2835('0x6')](config[_0x2835('0x7')],{'host':_0x2835('0x8'),'port':0x18eb});var socket=require(_0x2835('0x9'))(new Redis(config[_0x2835('0x7')]));var redis=new Redis(config[_0x2835('0x7')]);function respondWithStatusCode(_0x54c57a,_0x376477){_0x376477=_0x376477||0xcc;return function(_0x1e7c65){if(_0x1e7c65){return _0x54c57a[_0x2835('0xa')](_0x376477);}return _0x54c57a['status'](_0x376477)[_0x2835('0xb')]();};}function respondWithResult(_0x3386a5,_0x3b1db5){_0x3b1db5=_0x3b1db5||0xc8;return function(_0x3b47a5){if(_0x3b47a5){return _0x3386a5[_0x2835('0xc')](_0x3b1db5)[_0x2835('0xd')](_0x3b47a5);}};}function respondWithFilteredResult(_0x4ac920,_0x1f40bd){return function(_0x5b9c72){if(_0x5b9c72){var _0x5eaf7d=typeof _0x1f40bd[_0x2835('0xe')]===_0x2835('0xf')&&typeof _0x1f40bd[_0x2835('0x10')]===_0x2835('0xf');var _0x1e7d50=_0x5b9c72[_0x2835('0x11')];var _0x706328=_0x5eaf7d?0x0:_0x1f40bd[_0x2835('0xe')];var _0x26afa7=_0x5eaf7d?_0x5b9c72[_0x2835('0x11')]:_0x1f40bd[_0x2835('0xe')]+_0x1f40bd[_0x2835('0x10')];var _0x433fff;if(_0x26afa7>=_0x1e7d50){_0x26afa7=_0x1e7d50;_0x433fff=0xc8;}else{_0x433fff=0xce;}_0x4ac920['status'](_0x433fff);return _0x4ac920[_0x2835('0x12')](_0x2835('0x13'),_0x706328+'-'+_0x26afa7+'/'+_0x1e7d50)[_0x2835('0xd')](_0x5b9c72);}return null;};}function saveUpdates(_0x1f63ea){return function(_0x33cfbe){if(_0x33cfbe){return _0x33cfbe[_0x2835('0x14')](_0x1f63ea)['then'](function(_0x20d4b0){return _0x20d4b0;});}return null;};}function removeEntity(_0x3befd5){return function(_0x3f1655){if(_0x3f1655){return _0x3f1655['destroy']()[_0x2835('0x15')](function(){_0x3befd5[_0x2835('0xc')](0xcc)[_0x2835('0xb')]();});}};}function handleEntityNotFound(_0xe0fe9b){return function(_0x173c69){if(!_0x173c69){_0xe0fe9b['sendStatus'](0x194);}return _0x173c69;};}function handleError(_0x1d29c9,_0x4a20b8){_0x4a20b8=_0x4a20b8||0x1f4;return function(_0x50fac5){logger[_0x2835('0x16')](_0x50fac5['stack']);if(_0x50fac5['name']){delete _0x50fac5['name'];}_0x1d29c9[_0x2835('0xc')](_0x4a20b8)[_0x2835('0x17')](_0x50fac5);};}function maskClientSecret(_0x379989){return _[_0x2835('0x18')](_0x379989[_0x2835('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x58f380,_0x54b6f1){var _0x2d9e4f={},_0x96badf={},_0x17e279={'count':0x0,'rows':[]};var _0x967418=_[_0x2835('0x1a')](db['CloudProvider']['rawAttributes'],function(_0x4d949f){return{'name':_0x4d949f[_0x2835('0x1b')],'type':_0x4d949f[_0x2835('0x1c')]['key']};});_0x96badf[_0x2835('0x1d')]=_['map'](_0x967418,_0x2835('0x1e'));_0x96badf[_0x2835('0x1f')]=_['keys'](_0x58f380[_0x2835('0x1f')]);_0x96badf['filters']=_[_0x2835('0x20')](_0x96badf[_0x2835('0x1d')],_0x96badf[_0x2835('0x1f')]);_0x2d9e4f['attributes']=_['intersection'](_0x96badf[_0x2835('0x1d')],qs['fields'](_0x58f380[_0x2835('0x1f')][_0x2835('0x21')]));_0x2d9e4f[_0x2835('0x22')]=_0x2d9e4f[_0x2835('0x22')][_0x2835('0x23')]?_0x2d9e4f[_0x2835('0x22')]:_0x96badf[_0x2835('0x1d')];if(!_0x58f380[_0x2835('0x1f')][_0x2835('0x24')](_0x2835('0x25'))){_0x2d9e4f[_0x2835('0x10')]=qs['limit'](_0x58f380[_0x2835('0x1f')][_0x2835('0x10')]);_0x2d9e4f[_0x2835('0xe')]=qs[_0x2835('0xe')](_0x58f380['query'][_0x2835('0xe')]);}_0x2d9e4f[_0x2835('0x26')]=qs['sort'](_0x58f380['query'][_0x2835('0x27')]);_0x2d9e4f['where']=qs['filters'](_[_0x2835('0x28')](_0x58f380['query'],_0x96badf[_0x2835('0x29')]),_0x967418);if(_0x58f380[_0x2835('0x1f')][_0x2835('0x2a')]){_0x2d9e4f[_0x2835('0x2b')]=_[_0x2835('0x2c')](_0x2d9e4f[_0x2835('0x2b')],{'$or':_[_0x2835('0x1a')](_0x967418,function(_0x4d1fe0){if(_0x4d1fe0[_0x2835('0x1c')]!==_0x2835('0x2d')){var _0x36f67c={};_0x36f67c[_0x4d1fe0[_0x2835('0x1e')]]={'$like':'%'+_0x58f380[_0x2835('0x1f')][_0x2835('0x2a')]+'%'};return _0x36f67c;}})});}_0x2d9e4f=_[_0x2835('0x2c')]({},_0x2d9e4f,_0x58f380[_0x2835('0x2e')]);var _0x5ea484={'where':_0x2d9e4f[_0x2835('0x2b')]};return db[_0x2835('0x2f')][_0x2835('0x11')](_0x5ea484)['then'](function(_0x1f58a9){_0x17e279[_0x2835('0x11')]=_0x1f58a9;if(_0x58f380[_0x2835('0x1f')][_0x2835('0x30')]){_0x2d9e4f['include']=[{'all':!![]}];}return db[_0x2835('0x2f')][_0x2835('0x31')](_0x2d9e4f);})[_0x2835('0x15')](function(_0x2c2105){_0x17e279[_0x2835('0x32')]=_[_0x2835('0x1a')](_0x2c2105,function(_0x40e9ee){if(_0x40e9ee[_0x2835('0x33')]===_0x2835('0x34')){var _0x1b6980=encryptor['decryptString'](_0x40e9ee[_0x2835('0x35')]);_0x40e9ee['data3']=maskClientSecret(_0x1b6980);}return _0x40e9ee;});return _0x17e279;})[_0x2835('0x15')](respondWithFilteredResult(_0x54b6f1,_0x2d9e4f))[_0x2835('0x36')](handleError(_0x54b6f1,null));};exports[_0x2835('0x37')]=function(_0x22f3b6,_0x26b100){var _0x170c81={'raw':!![],'where':{'id':_0x22f3b6['params']['id']}},_0x2aa5e5={};_0x2aa5e5['model']=_[_0x2835('0x38')](db[_0x2835('0x2f')][_0x2835('0x39')]);_0x2aa5e5[_0x2835('0x1f')]=_[_0x2835('0x38')](_0x22f3b6[_0x2835('0x1f')]);_0x2aa5e5[_0x2835('0x29')]=_[_0x2835('0x20')](_0x2aa5e5[_0x2835('0x1d')],_0x2aa5e5[_0x2835('0x1f')]);_0x170c81[_0x2835('0x22')]=_['intersection'](_0x2aa5e5['model'],qs[_0x2835('0x21')](_0x22f3b6[_0x2835('0x1f')][_0x2835('0x21')]));_0x170c81['attributes']=_0x170c81[_0x2835('0x22')]['length']?_0x170c81[_0x2835('0x22')]:_0x2aa5e5['model'];if(_0x22f3b6['query'][_0x2835('0x30')]){_0x170c81[_0x2835('0x3a')]=[{'all':!![]}];}_0x170c81=_[_0x2835('0x2c')]({},_0x170c81,_0x22f3b6[_0x2835('0x2e')]);return db[_0x2835('0x2f')][_0x2835('0x3b')](_0x170c81)[_0x2835('0x15')](handleEntityNotFound(_0x26b100,null))['then'](function(_0x52aac0){if(_0x52aac0[_0x2835('0x33')]===_0x2835('0x34')){var _0x5f0833=encryptor[_0x2835('0x3c')](_0x52aac0[_0x2835('0x35')]);_0x52aac0[_0x2835('0x35')]=maskClientSecret(_0x5f0833);}return _0x52aac0;})['then'](respondWithResult(_0x26b100,null))['catch'](handleError(_0x26b100,null));};exports[_0x2835('0x3d')]=function(_0x209736,_0x439297){if(!_0x209736[_0x2835('0x3e')][_0x2835('0x1e')])throw new Error(_0x2835('0x3f'));if(!_0x209736[_0x2835('0x3e')][_0x2835('0x33')])throw new Error(_0x2835('0x40'));var _0x1c9e20=db[_0x2835('0x2f')][_0x2835('0x39')][_0x2835('0x33')]['values'];if(!_0x1c9e20[_0x2835('0x41')](_0x209736[_0x2835('0x3e')]['service']))throw new Error(_0x2835('0x42')+_0x1c9e20[_0x2835('0x43')](',\x20'));if(_0x209736[_0x2835('0x3e')][_0x2835('0x33')]===_0x2835('0x34')&&_0x209736[_0x2835('0x3e')][_0x2835('0x35')]){_0x209736[_0x2835('0x3e')]['data3']=encryptor[_0x2835('0x44')](_0x209736[_0x2835('0x3e')][_0x2835('0x35')]);}return db['CloudProvider'][_0x2835('0x3d')](_0x209736[_0x2835('0x3e')],{})[_0x2835('0x15')](respondWithResult(_0x439297,0xc9))[_0x2835('0x36')](handleError(_0x439297,null));};exports[_0x2835('0x14')]=function(_0x30f284,_0x1f5fb0){if(_0x30f284[_0x2835('0x3e')]['id']){delete _0x30f284[_0x2835('0x3e')]['id'];}return db[_0x2835('0x2f')]['find']({'where':{'id':_0x30f284[_0x2835('0x45')]['id']}})[_0x2835('0x15')](handleEntityNotFound(_0x1f5fb0,null))[_0x2835('0x15')](function(_0x141694){if(_0x141694[_0x2835('0x33')]==='MicrosoftAzure'&&_0x30f284[_0x2835('0x3e')][_0x2835('0x35')]){_0x30f284[_0x2835('0x3e')][_0x2835('0x35')]=encryptor['encryptString'](_0x30f284['body']['data3']);}return _0x141694;})[_0x2835('0x15')](saveUpdates(_0x30f284[_0x2835('0x3e')],null))[_0x2835('0x15')](respondWithResult(_0x1f5fb0,null))[_0x2835('0x36')](handleError(_0x1f5fb0,null));};exports[_0x2835('0x46')]=function(_0x3b20ed,_0xd77bfe){return db[_0x2835('0x2f')][_0x2835('0x3b')]({'where':{'id':_0x3b20ed[_0x2835('0x45')]['id']}})[_0x2835('0x15')](handleEntityNotFound(_0xd77bfe,null))[_0x2835('0x15')](removeEntity(_0xd77bfe,null))[_0x2835('0x36')](handleError(_0xd77bfe,null));};exports[_0x2835('0x47')]=function(_0x58dcda,_0x4c0d9d){return db[_0x2835('0x2f')][_0x2835('0x48')]({'where':{'id':_0x58dcda['params']['id']},'raw':!![]})[_0x2835('0x15')](function(_0x6c1a51){if(!_0x6c1a51)return _0x4c0d9d[_0x2835('0xa')](0x194);return{'url':oauth[_0x2835('0x49')](_0x6c1a51,_0x58dcda['user']['id'])};})[_0x2835('0x15')](respondWithResult(_0x4c0d9d,null))[_0x2835('0x36')](handleError(_0x4c0d9d,null));};exports[_0x2835('0x4a')]=function(_0x22dc47,_0x56a7ea){var _0x4100fe=_0x22dc47[_0x2835('0x3e')];var _0x4e0724;var _0x1628ba;if(_0x4100fe[_0x2835('0x16')])throw _0x4100fe;redis[_0x2835('0x4b')](_0x4100fe['state'])['then'](function(_0x4f2610){if(!_0x4f2610)throw new Error(_0x2835('0x4c'));_0x4e0724=JSON[_0x2835('0x4d')](_0x4f2610);var _0x200bc1=Buffer[_0x2835('0x4e')](_0x4100fe[_0x2835('0x4f')],'base64')[_0x2835('0x50')](_0x2835('0x51'));_0x1628ba=JSON[_0x2835('0x4d')](_0x200bc1);if(!oauth[_0x2835('0x52')](_0x4100fe[_0x2835('0x53')],_0x4e0724['oauth2Claims']))throw new Error(_0x2835('0x54'));redis[_0x2835('0x55')](_0x4100fe['state']);return oauth[_0x2835('0x56')](_0x4100fe[_0x2835('0x57')],_0x4e0724);})[_0x2835('0x15')](function(_0x3d29d0){_0x4e0724[_0x2835('0x58')]=_0x3d29d0['access_token'];_0x4e0724[_0x2835('0x59')]=_0x3d29d0[_0x2835('0x5a')];return db[_0x2835('0x2f')][_0x2835('0x14')]({'data5':_0x4e0724[_0x2835('0x58')],'data6':_0x4e0724['data6']},{'where':{'id':_0x4e0724['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x4e0724);socket[_0x2835('0x5b')](_0x2835('0x5c'),{'id':_0x1628ba['id']});return;})[_0x2835('0x15')](respondWithStatusCode(_0x56a7ea,null))[_0x2835('0x36')](function(_0x42bc8f){if(_0x1628ba){socket[_0x2835('0x5b')](_0x2835('0x5d'),{'id':_0x1628ba['id']});}if(!_0x4e0724){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x42bc8f);return _0x56a7ea[_0x2835('0xc')](0x1f4)[_0x2835('0x17')](_0x42bc8f[_0x2835('0x5e')]);}logger[_0x2835('0x16')](_0x2835('0x5f'),_0x4e0724['id'],JSON[_0x2835('0x60')](_0x42bc8f));});}; \ No newline at end of file +var _0x4658=['options','find','MicrosoftAzure','catch','create','body','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','error','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','service','decryptString','data3','params'];(function(_0x429826,_0xa7bdd4){var _0x4ec65a=function(_0x1f4ddf){while(--_0x1f4ddf){_0x429826['push'](_0x429826['shift']());}};_0x4ec65a(++_0xa7bdd4);}(_0x4658,0x190));var _0x8465=function(_0x5685e4,_0x2c48a1){_0x5685e4=_0x5685e4-0x0;var _0x421e89=_0x4658[_0x5685e4];return _0x421e89;};'use strict';var _=require('lodash');var Redis=require(_0x8465('0x0'));var qs=require(_0x8465('0x1'));var encryptor=require(_0x8465('0x2'));var config=require(_0x8465('0x3'));var logger=require(_0x8465('0x4'))('api');var db=require(_0x8465('0x5'))['db'];var oauth=require(_0x8465('0x6'));config['redis']=_[_0x8465('0x7')](config[_0x8465('0x8')],{'host':_0x8465('0x9'),'port':0x18eb});var socket=require(_0x8465('0xa'))(new Redis(config[_0x8465('0x8')]));var redis=new Redis(config[_0x8465('0x8')]);function respondWithStatusCode(_0x188b9d,_0xdc14d6){_0xdc14d6=_0xdc14d6||0xcc;return function(_0x2753e3){if(_0x2753e3){return _0x188b9d[_0x8465('0xb')](_0xdc14d6);}return _0x188b9d[_0x8465('0xc')](_0xdc14d6)[_0x8465('0xd')]();};}function respondWithResult(_0x339ab0,_0x3d28b3){_0x3d28b3=_0x3d28b3||0xc8;return function(_0x58f5e1){if(_0x58f5e1){return _0x339ab0[_0x8465('0xc')](_0x3d28b3)['json'](_0x58f5e1);}};}function respondWithFilteredResult(_0x3c3f5a,_0x4cc7b9){return function(_0x4d653d){if(_0x4d653d){var _0x384621=typeof _0x4cc7b9[_0x8465('0xe')]===_0x8465('0xf')&&typeof _0x4cc7b9[_0x8465('0x10')]===_0x8465('0xf');var _0x3c9326=_0x4d653d[_0x8465('0x11')];var _0x24976c=_0x384621?0x0:_0x4cc7b9[_0x8465('0xe')];var _0x5cfa9e=_0x384621?_0x4d653d[_0x8465('0x11')]:_0x4cc7b9[_0x8465('0xe')]+_0x4cc7b9['limit'];var _0x47333f;if(_0x5cfa9e>=_0x3c9326){_0x5cfa9e=_0x3c9326;_0x47333f=0xc8;}else{_0x47333f=0xce;}_0x3c3f5a[_0x8465('0xc')](_0x47333f);return _0x3c3f5a[_0x8465('0x12')]('Content-Range',_0x24976c+'-'+_0x5cfa9e+'/'+_0x3c9326)[_0x8465('0x13')](_0x4d653d);}return null;};}function saveUpdates(_0x2e8f87){return function(_0x2837c8){if(_0x2837c8){return _0x2837c8[_0x8465('0x14')](_0x2e8f87)[_0x8465('0x15')](function(_0xd46fb0){return _0xd46fb0;});}return null;};}function removeEntity(_0x21d584){return function(_0x4b5a09){if(_0x4b5a09){return _0x4b5a09['destroy']()['then'](function(){_0x21d584['status'](0xcc)[_0x8465('0xd')]();});}};}function handleEntityNotFound(_0x5e71aa){return function(_0x49caf2){if(!_0x49caf2){_0x5e71aa[_0x8465('0xb')](0x194);}return _0x49caf2;};}function handleError(_0x53a4f1,_0x42ae17){_0x42ae17=_0x42ae17||0x1f4;return function(_0x4a4df4){logger[_0x8465('0x16')](_0x4a4df4['stack']);if(_0x4a4df4[_0x8465('0x17')]){delete _0x4a4df4[_0x8465('0x17')];}_0x53a4f1[_0x8465('0xc')](_0x42ae17)[_0x8465('0x18')](_0x4a4df4);};}function maskClientSecret(_0x576612){return _[_0x8465('0x19')](_0x576612['slice'](0x0,0x3),0x14,'*');}exports[_0x8465('0x1a')]=function(_0x2a358a,_0x217e09){var _0x2d1415={},_0x2ae883={},_0x2efe82={'count':0x0,'rows':[]};var _0xc23a31=_[_0x8465('0x1b')](db[_0x8465('0x1c')][_0x8465('0x1d')],function(_0x108e08){return{'name':_0x108e08[_0x8465('0x1e')],'type':_0x108e08['type'][_0x8465('0x1f')]};});_0x2ae883[_0x8465('0x20')]=_[_0x8465('0x1b')](_0xc23a31,_0x8465('0x17'));_0x2ae883[_0x8465('0x21')]=_[_0x8465('0x22')](_0x2a358a['query']);_0x2ae883['filters']=_[_0x8465('0x23')](_0x2ae883[_0x8465('0x20')],_0x2ae883[_0x8465('0x21')]);_0x2d1415[_0x8465('0x24')]=_['intersection'](_0x2ae883['model'],qs[_0x8465('0x25')](_0x2a358a[_0x8465('0x21')][_0x8465('0x25')]));_0x2d1415[_0x8465('0x24')]=_0x2d1415[_0x8465('0x24')]['length']?_0x2d1415[_0x8465('0x24')]:_0x2ae883[_0x8465('0x20')];if(!_0x2a358a['query'][_0x8465('0x26')](_0x8465('0x27'))){_0x2d1415[_0x8465('0x10')]=qs['limit'](_0x2a358a[_0x8465('0x21')]['limit']);_0x2d1415[_0x8465('0xe')]=qs[_0x8465('0xe')](_0x2a358a['query'][_0x8465('0xe')]);}_0x2d1415['order']=qs['sort'](_0x2a358a['query'][_0x8465('0x28')]);_0x2d1415[_0x8465('0x29')]=qs[_0x8465('0x2a')](_[_0x8465('0x2b')](_0x2a358a['query'],_0x2ae883['filters']),_0xc23a31);if(_0x2a358a[_0x8465('0x21')][_0x8465('0x2c')]){_0x2d1415['where']=_[_0x8465('0x2d')](_0x2d1415['where'],{'$or':_[_0x8465('0x1b')](_0xc23a31,function(_0x3d4b07){if(_0x3d4b07[_0x8465('0x2e')]!==_0x8465('0x2f')){var _0x3e5ec8={};_0x3e5ec8[_0x3d4b07[_0x8465('0x17')]]={'$like':'%'+_0x2a358a[_0x8465('0x21')]['filter']+'%'};return _0x3e5ec8;}})});}_0x2d1415=_[_0x8465('0x2d')]({},_0x2d1415,_0x2a358a['options']);var _0x530cca={'where':_0x2d1415[_0x8465('0x29')]};return db[_0x8465('0x1c')][_0x8465('0x11')](_0x530cca)[_0x8465('0x15')](function(_0x464559){_0x2efe82[_0x8465('0x11')]=_0x464559;if(_0x2a358a[_0x8465('0x21')][_0x8465('0x30')]){_0x2d1415[_0x8465('0x31')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x2d1415);})[_0x8465('0x15')](function(_0x37a995){_0x2efe82[_0x8465('0x32')]=_[_0x8465('0x1b')](_0x37a995,function(_0x33b064){if(_0x33b064[_0x8465('0x33')]==='MicrosoftAzure'){var _0x2f7f70=encryptor[_0x8465('0x34')](_0x33b064[_0x8465('0x35')]);_0x33b064[_0x8465('0x35')]=maskClientSecret(_0x2f7f70);}return _0x33b064;});return _0x2efe82;})['then'](respondWithFilteredResult(_0x217e09,_0x2d1415))['catch'](handleError(_0x217e09,null));};exports['show']=function(_0x327f91,_0x3187bb){var _0x57df81={'raw':!![],'where':{'id':_0x327f91[_0x8465('0x36')]['id']}},_0x5ea6b2={};_0x5ea6b2[_0x8465('0x20')]=_['keys'](db[_0x8465('0x1c')][_0x8465('0x1d')]);_0x5ea6b2[_0x8465('0x21')]=_[_0x8465('0x22')](_0x327f91['query']);_0x5ea6b2[_0x8465('0x2a')]=_['intersection'](_0x5ea6b2['model'],_0x5ea6b2['query']);_0x57df81[_0x8465('0x24')]=_[_0x8465('0x23')](_0x5ea6b2[_0x8465('0x20')],qs['fields'](_0x327f91['query'][_0x8465('0x25')]));_0x57df81['attributes']=_0x57df81[_0x8465('0x24')]['length']?_0x57df81['attributes']:_0x5ea6b2[_0x8465('0x20')];if(_0x327f91[_0x8465('0x21')][_0x8465('0x30')]){_0x57df81[_0x8465('0x31')]=[{'all':!![]}];}_0x57df81=_[_0x8465('0x2d')]({},_0x57df81,_0x327f91[_0x8465('0x37')]);return db['CloudProvider'][_0x8465('0x38')](_0x57df81)[_0x8465('0x15')](handleEntityNotFound(_0x3187bb,null))[_0x8465('0x15')](function(_0xbab861){if(_0xbab861[_0x8465('0x33')]===_0x8465('0x39')){var _0x4d461d=encryptor[_0x8465('0x34')](_0xbab861[_0x8465('0x35')]);_0xbab861[_0x8465('0x35')]=maskClientSecret(_0x4d461d);}return _0xbab861;})[_0x8465('0x15')](respondWithResult(_0x3187bb,null))[_0x8465('0x3a')](handleError(_0x3187bb,null));};exports[_0x8465('0x3b')]=function(_0x514fce,_0x17701e){if(!_0x514fce[_0x8465('0x3c')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x514fce[_0x8465('0x3c')][_0x8465('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x30d613=db[_0x8465('0x1c')]['rawAttributes']['service']['values'];if(!_0x30d613[_0x8465('0x3d')](_0x514fce[_0x8465('0x3c')]['service']))throw new Error(_0x8465('0x3e')+_0x30d613[_0x8465('0x3f')](',\x20'));if(_0x514fce[_0x8465('0x3c')]['service']===_0x8465('0x39')&&_0x514fce[_0x8465('0x3c')][_0x8465('0x35')]){_0x514fce[_0x8465('0x3c')][_0x8465('0x35')]=encryptor['encryptString'](_0x514fce[_0x8465('0x3c')][_0x8465('0x35')]);}return db[_0x8465('0x1c')][_0x8465('0x3b')](_0x514fce['body'],{})[_0x8465('0x15')](respondWithResult(_0x17701e,0xc9))[_0x8465('0x3a')](handleError(_0x17701e,null));};exports[_0x8465('0x14')]=function(_0x42bccb,_0x5423bd){if(_0x42bccb[_0x8465('0x3c')]['id']){delete _0x42bccb[_0x8465('0x3c')]['id'];}return db[_0x8465('0x1c')][_0x8465('0x38')]({'where':{'id':_0x42bccb['params']['id']}})[_0x8465('0x15')](handleEntityNotFound(_0x5423bd,null))[_0x8465('0x15')](function(_0xe4c2c1){if(_0xe4c2c1[_0x8465('0x33')]===_0x8465('0x39')&&_0x42bccb[_0x8465('0x3c')][_0x8465('0x35')]){_0x42bccb[_0x8465('0x3c')][_0x8465('0x35')]=encryptor[_0x8465('0x40')](_0x42bccb['body'][_0x8465('0x35')]);}return _0xe4c2c1;})[_0x8465('0x15')](saveUpdates(_0x42bccb['body'],null))['then'](respondWithResult(_0x5423bd,null))[_0x8465('0x3a')](handleError(_0x5423bd,null));};exports[_0x8465('0x41')]=function(_0x24710f,_0x38d587){return db['CloudProvider'][_0x8465('0x38')]({'where':{'id':_0x24710f[_0x8465('0x36')]['id']}})[_0x8465('0x15')](handleEntityNotFound(_0x38d587,null))[_0x8465('0x15')](removeEntity(_0x38d587,null))['catch'](handleError(_0x38d587,null));};exports[_0x8465('0x42')]=function(_0x3bae44,_0x140c01){return db[_0x8465('0x1c')][_0x8465('0x43')]({'where':{'id':_0x3bae44[_0x8465('0x36')]['id']},'raw':!![]})[_0x8465('0x15')](function(_0x3cfdb3){if(!_0x3cfdb3)return _0x140c01[_0x8465('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3cfdb3,_0x3bae44[_0x8465('0x44')]['id'])};})[_0x8465('0x15')](respondWithResult(_0x140c01,null))[_0x8465('0x3a')](handleError(_0x140c01,null));};exports[_0x8465('0x45')]=function(_0x33082a,_0x541b50){var _0x4502ae=_0x33082a[_0x8465('0x3c')];var _0x1b8efd;var _0x4bfbc2;if(_0x4502ae[_0x8465('0x16')])throw _0x4502ae;redis['get'](_0x4502ae[_0x8465('0x46')])['then'](function(_0x31466b){if(!_0x31466b)throw new Error(_0x8465('0x47'));_0x1b8efd=JSON[_0x8465('0x48')](_0x31466b);var _0x29c2d9=Buffer[_0x8465('0x49')](_0x4502ae[_0x8465('0x46')],'base64')[_0x8465('0x4a')](_0x8465('0x4b'));_0x4bfbc2=JSON[_0x8465('0x48')](_0x29c2d9);if(!oauth[_0x8465('0x4c')](_0x4502ae[_0x8465('0x4d')],_0x1b8efd[_0x8465('0x4e')]))throw new Error(_0x8465('0x4f'));redis[_0x8465('0x50')](_0x4502ae[_0x8465('0x46')]);return oauth[_0x8465('0x51')](_0x4502ae[_0x8465('0x52')],_0x1b8efd);})[_0x8465('0x15')](function(_0x4f55e1){_0x1b8efd['data5']=_0x4f55e1[_0x8465('0x53')];_0x1b8efd['data6']=_0x4f55e1['refresh_token'];return db['CloudProvider']['update']({'data5':_0x1b8efd[_0x8465('0x54')],'data6':_0x1b8efd[_0x8465('0x55')]},{'where':{'id':_0x1b8efd['id']}});})['then'](function(){oauth[_0x8465('0x56')](_0x1b8efd);socket[_0x8465('0x57')](_0x8465('0x58'),{'id':_0x4bfbc2['id']});return;})['then'](respondWithStatusCode(_0x541b50,null))['catch'](function(_0x5a017f){if(_0x4bfbc2){socket['emit']('microsoftAuthorization:error',{'id':_0x4bfbc2['id']});}if(!_0x1b8efd){logger[_0x8465('0x16')](_0x8465('0x59'),_0x5a017f);return _0x541b50[_0x8465('0xc')](0x1f4)[_0x8465('0x18')](_0x5a017f['message']);}logger[_0x8465('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1b8efd['id'],JSON[_0x8465('0x5a')](_0x5a017f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 15dcd89..41d8560 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 _0x8342=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xba56e0,_0x273f3b){var _0x25fbac=function(_0x4ce25c){while(--_0x4ce25c){_0xba56e0['push'](_0xba56e0['shift']());}};_0x25fbac(++_0x273f3b);}(_0x8342,0x86));var _0x2834=function(_0x493696,_0x1c1d41){_0x493696=_0x493696-0x0;var _0x3c4e2a=_0x8342[_0x493696];return _0x3c4e2a;};'use strict';var _=require(_0x2834('0x0'));var util=require(_0x2834('0x1'));var logger=require(_0x2834('0x2'))(_0x2834('0x3'));var moment=require('moment');var BPromise=require(_0x2834('0x4'));var rp=require(_0x2834('0x5'));var fs=require('fs');var path=require(_0x2834('0x6'));var rimraf=require(_0x2834('0x7'));var config=require(_0x2834('0x8'));var attributes=require(_0x2834('0x9'));module[_0x2834('0xa')]=function(_0x5d0f6c,_0x4b6d10){return _0x5d0f6c[_0x2834('0xb')](_0x2834('0xc'),attributes,{'tableName':_0x2834('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c4a=['../../config/environment','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x5595b,_0x51c232){var _0x27f8e2=function(_0x49fb9c){while(--_0x49fb9c){_0x5595b['push'](_0x5595b['shift']());}};_0x27f8e2(++_0x51c232);}(_0x9c4a,0x1d0));var _0xa9c4=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x9c4a[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0xa9c4('0x0'));var util=require(_0xa9c4('0x1'));var logger=require(_0xa9c4('0x2'))('api');var moment=require(_0xa9c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9c4('0x4'));var fs=require('fs');var path=require(_0xa9c4('0x5'));var rimraf=require('rimraf');var config=require(_0xa9c4('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0xf0c9b5,_0x4e6821){return _0xf0c9b5[_0xa9c4('0x7')](_0xa9c4('0x8'),attributes,{'tableName':_0xa9c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 2e19703..9b231cb 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 _0x4886=['login','key','value','oauth2/','set','payload','issuer','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','findOne','decryptString','POST','data5','access_token','refresh_token','data6','catch','error','authorization_code','{TENANT_ID}','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','map','type','push','data7','/.default','join','Outlook365','Dynamics365','replace','data2','code','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','data4','response_mode','scope','state','nonce'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4886,0x104));var _0x6488=function(_0x566143,_0x5a44f6){_0x566143=_0x566143-0x0;var _0x40f906=_0x4886[_0x566143];return _0x40f906;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x6488('0x0'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x6488('0x1'));var encryptor=require(_0x6488('0x2'));var config=require(_0x6488('0x3'));var logger=require(_0x6488('0x4'))(_0x6488('0x5'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x6488('0x6'))['db'];config[_0x6488('0x7')]=_[_0x6488('0x8')](config[_0x6488('0x7')],{'host':_0x6488('0x9'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x6488('0xa'),_0x6488('0xb'),'offline_access',_0x6488('0xc'),_0x6488('0xd'),_0x6488('0xe')],'Dynamics365':[_0x6488('0xf'),_0x6488('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x6488('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x6488('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x515f51){var _0x167ee1=_[_0x6488('0x13')](AZURE_AUTH_SCOPES[_0x515f51[_0x6488('0x14')]]);if(_0x515f51[_0x6488('0x14')]==='Dynamics365')_0x167ee1[_0x6488('0x15')](_0x515f51[_0x6488('0x16')]+_0x6488('0x17'));return _0x167ee1[_0x6488('0x18')]('\x20');}function getAccessTokenScope(_0x5a4223){if(_0x5a4223[_0x6488('0x14')]===_0x6488('0x19'))return _0x6488('0xc');if(_0x5a4223[_0x6488('0x14')]===_0x6488('0x1a'))return _0x5a4223['data7']+_0x6488('0x17');}function generateMicrosoftAuthorizationUrl(_0x25972c,_0x33bdc5){var _0x407217=MICROSOFT_AUTH_URL[_0x6488('0x1b')]('{TENANT_ID}',_0x25972c[_0x6488('0x1c')]);var _0xe53787=[_0x6488('0x1d'),_0x6488('0x1e')];var _0x3bced2=Buffer[_0x6488('0x1f')](JSON[_0x6488('0x20')]({'id':_0x33bdc5}))[_0x6488('0x21')]('base64');var _0x2b1eca=crypto[_0x6488('0x22')](0x10)['toString'](_0x6488('0x23'));var _0x3bcbb8=getAuthorizationScopes(_0x25972c);var _0x3fea00=[{'key':_0x6488('0x24'),'value':_0x25972c[_0x6488('0x25')]},{'key':_0x6488('0x26'),'value':encodeURIComponent(_0xe53787[_0x6488('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x25972c[_0x6488('0x27')]},{'key':_0x6488('0x28'),'value':'form_post'},{'key':_0x6488('0x29'),'value':encodeURIComponent(_0x3bcbb8)},{'key':_0x6488('0x2a'),'value':_0x3bced2},{'key':_0x6488('0x2b'),'value':_0x2b1eca},{'key':'prompt','value':_0x6488('0x2c')}];var _0x403d3f=_0x407217+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x6488('0x13')](_0x3fea00,function(_0x21de96){return _0x21de96[_0x6488('0x2d')]+'='+_0x21de96[_0x6488('0x2e')];})[_0x6488('0x18')]('&');_0x25972c['oauth2Claims']={'issuer':_0x407217['replace'](_0x6488('0x2f'),''),'audience':_0x25972c[_0x6488('0x25')],'state':_0x3bced2,'nonce':_0x2b1eca};redis[_0x6488('0x30')](_0x3bced2,JSON[_0x6488('0x20')](_0x25972c));return _0x403d3f;}function isValidIdToken(_0x2e09c3,_0x3b8774){try{var _0x5cb5b2=jwt['decode'](_0x2e09c3,{'complete':!![]});var _0x3e42a8=_0x5cb5b2[_0x6488('0x31')];if(_0x3e42a8['iss']!==_0x3b8774[_0x6488('0x32')])return![];if(_0x3e42a8[_0x6488('0x33')]!==_0x3b8774[_0x6488('0x34')])return![];if(_0x3e42a8[_0x6488('0x2b')]!==_0x3b8774[_0x6488('0x2b')])return![];if(moment()[_0x6488('0x35')](moment[_0x6488('0x36')](_0x3e42a8[_0x6488('0x37')])))return![];return!![];}catch(_0xaa10a5){throw _0xaa10a5;}}function refreshOauth2MicrosoftAccessToken(_0x295aa3){return Promise[_0x6488('0x38')]()[_0x6488('0x39')](function(){if(_0x295aa3['data3'])return _0x295aa3;return db[_0x6488('0x3a')][_0x6488('0x3b')]({'where':{'id':_0x295aa3['id']},'raw':!![]});})[_0x6488('0x39')](function(_0x8a988d){var _0x1908e4={'grant_type':'refresh_token','refresh_token':_0x8a988d['data6'],'scope':getAccessTokenScope(_0x8a988d),'redirect_uri':_0x8a988d[_0x6488('0x27')],'client_id':_0x8a988d[_0x6488('0x25')],'client_secret':encryptor[_0x6488('0x3c')](_0x8a988d['data3'])};var _0x331c41={'method':_0x6488('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x6488('0x1b')]('{TENANT_ID}',_0x8a988d[_0x6488('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1908e4,'json':!![]};return rp(_0x331c41);})[_0x6488('0x39')](function(_0x4ae885){_0x295aa3[_0x6488('0x3e')]=_0x4ae885[_0x6488('0x3f')];_0x295aa3['data6']=_0x4ae885[_0x6488('0x40')];return db[_0x6488('0x3a')]['update']({'data5':_0x295aa3[_0x6488('0x3e')],'data6':_0x295aa3[_0x6488('0x41')]},{'where':{'id':_0x295aa3['id']}});})[_0x6488('0x39')](function(){return _0x295aa3;})[_0x6488('0x42')](function(_0x5b4fe5){logger[_0x6488('0x43')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x295aa3['id'],_0x5b4fe5);});}function getOauth2MicrosoftAccessToken(_0x3c83d1,_0x48386a){var _0x230312={'grant_type':_0x6488('0x44'),'code':_0x3c83d1,'scope':getAccessTokenScope(_0x48386a),'redirect_uri':_0x48386a[_0x6488('0x27')],'client_id':_0x48386a[_0x6488('0x25')],'client_secret':encryptor[_0x6488('0x3c')](_0x48386a['data3'])};var _0x1f9c35={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x6488('0x45'),_0x48386a[_0x6488('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x230312,'json':!![]};return rp(_0x1f9c35);}function startRefreshInterval(_0x39c25a){var _0x480f50=schedule[_0x6488('0x46')];if(_0x480f50[_0x39c25a['id']])clearInterval(_0x480f50[_0x39c25a['id']]);_0x480f50[_0x39c25a['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x39c25a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x480f50;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x6488('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6488('0x39')](function(_0x406162){var _0x1dd0f3=_0x406162[_0x6488('0x13')](function(_0x43cf72){return refreshOauth2MicrosoftAccessToken(_0x43cf72)['then'](function(_0x30173a){startRefreshInterval(_0x30173a);});});return Promise[_0x6488('0x48')](_0x1dd0f3);})[_0x6488('0x42')](function(_0xf33c44){var _0x58f980=_0xf33c44?util[_0x6488('0x49')](_0xf33c44,{'showHidden':![],'depth':null}):'';logger[_0x6488('0x43')](_0x6488('0x4a'),_0x58f980);});}module[_0x6488('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x5361=['lodash','jsonwebtoken','moment','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','type','Dynamics365','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','data2','code','id_token','from','base64','randomBytes','toString','hex','response_type','redirect_uri','data4','response_mode','form_post','scope','prompt','login','map','key','oauth2Claims','data1','set','stringify','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','data3','{TENANT_ID}','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports'];(function(_0x4b9369,_0x493488){var _0x918fb2=function(_0x1ab7d3){while(--_0x1ab7d3){_0x4b9369['push'](_0x4b9369['shift']());}};_0x918fb2(++_0x493488);}(_0x5361,0x19a));var _0x1536=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5361[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x1536('0x0'));var crypto=require('crypto');var jwt=require(_0x1536('0x1'));var moment=require(_0x1536('0x2'));var Redis=require(_0x1536('0x3'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x1536('0x4'));var config=require(_0x1536('0x5'));var logger=require(_0x1536('0x6'))(_0x1536('0x7'));var schedule=require(_0x1536('0x8'));var db=require(_0x1536('0x9'))['db'];config['redis']=_[_0x1536('0xa')](config[_0x1536('0xb')],{'host':_0x1536('0xc'),'port':0x18eb});var redis=new Redis(config[_0x1536('0xb')]);var MICROSOFT_AUTH_URL=_0x1536('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1536('0xe'),_0x1536('0xf'),_0x1536('0x10'),_0x1536('0x11'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x1536('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1536('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x1536('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x1536('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x37b90c){var _0x254c09=_['map'](AZURE_AUTH_SCOPES[_0x37b90c[_0x1536('0x15')]]);if(_0x37b90c[_0x1536('0x15')]===_0x1536('0x16'))_0x254c09['push'](_0x37b90c[_0x1536('0x17')]+_0x1536('0x18'));return _0x254c09[_0x1536('0x19')]('\x20');}function getAccessTokenScope(_0x2a7fe4){if(_0x2a7fe4[_0x1536('0x15')]===_0x1536('0x1a'))return _0x1536('0x1b');if(_0x2a7fe4['type']===_0x1536('0x16'))return _0x2a7fe4[_0x1536('0x17')]+_0x1536('0x18');}function generateMicrosoftAuthorizationUrl(_0x9639f9,_0x27813b){var _0x32485f=MICROSOFT_AUTH_URL[_0x1536('0x1c')]('{TENANT_ID}',_0x9639f9[_0x1536('0x1d')]);var _0x1b679c=[_0x1536('0x1e'),_0x1536('0x1f')];var _0x19d819=Buffer[_0x1536('0x20')](JSON['stringify']({'id':_0x27813b}))['toString'](_0x1536('0x21'));var _0xbc6c27=crypto[_0x1536('0x22')](0x10)[_0x1536('0x23')](_0x1536('0x24'));var _0xbf59c6=getAuthorizationScopes(_0x9639f9);var _0x1bd1b2=[{'key':'client_id','value':_0x9639f9['data1']},{'key':_0x1536('0x25'),'value':encodeURIComponent(_0x1b679c[_0x1536('0x19')]('\x20'))},{'key':_0x1536('0x26'),'value':_0x9639f9[_0x1536('0x27')]},{'key':_0x1536('0x28'),'value':_0x1536('0x29')},{'key':_0x1536('0x2a'),'value':encodeURIComponent(_0xbf59c6)},{'key':'state','value':_0x19d819},{'key':'nonce','value':_0xbc6c27},{'key':_0x1536('0x2b'),'value':_0x1536('0x2c')}];var _0x162f2e=_0x32485f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1536('0x2d')](_0x1bd1b2,function(_0x391a82){return _0x391a82[_0x1536('0x2e')]+'='+_0x391a82['value'];})['join']('&');_0x9639f9[_0x1536('0x2f')]={'issuer':_0x32485f[_0x1536('0x1c')]('oauth2/',''),'audience':_0x9639f9[_0x1536('0x30')],'state':_0x19d819,'nonce':_0xbc6c27};redis[_0x1536('0x31')](_0x19d819,JSON[_0x1536('0x32')](_0x9639f9));return _0x162f2e;}function isValidIdToken(_0xab4845,_0x4ecad4){try{var _0x129bda=jwt['decode'](_0xab4845,{'complete':!![]});var _0x3d1b68=_0x129bda[_0x1536('0x33')];if(_0x3d1b68[_0x1536('0x34')]!==_0x4ecad4[_0x1536('0x35')])return![];if(_0x3d1b68[_0x1536('0x36')]!==_0x4ecad4[_0x1536('0x37')])return![];if(_0x3d1b68[_0x1536('0x38')]!==_0x4ecad4['nonce'])return![];if(moment()[_0x1536('0x39')](moment[_0x1536('0x3a')](_0x3d1b68[_0x1536('0x3b')])))return![];return!![];}catch(_0xe9bd6d){throw _0xe9bd6d;}}function refreshOauth2MicrosoftAccessToken(_0x5522cd){return Promise[_0x1536('0x3c')]()[_0x1536('0x3d')](function(){if(_0x5522cd['data3'])return _0x5522cd;return db[_0x1536('0x3e')][_0x1536('0x3f')]({'where':{'id':_0x5522cd['id']},'raw':!![]});})[_0x1536('0x3d')](function(_0x27d360){var _0x2fa337={'grant_type':_0x1536('0x40'),'refresh_token':_0x27d360[_0x1536('0x41')],'scope':getAccessTokenScope(_0x27d360),'redirect_uri':_0x27d360[_0x1536('0x27')],'client_id':_0x27d360['data1'],'client_secret':encryptor['decryptString'](_0x27d360[_0x1536('0x42')])};var _0x465424={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1536('0x1c')](_0x1536('0x43'),_0x27d360['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2fa337,'json':!![]};return rp(_0x465424);})[_0x1536('0x3d')](function(_0x15f152){_0x5522cd[_0x1536('0x44')]=_0x15f152[_0x1536('0x45')];_0x5522cd[_0x1536('0x41')]=_0x15f152[_0x1536('0x40')];return db[_0x1536('0x3e')][_0x1536('0x46')]({'data5':_0x5522cd[_0x1536('0x44')],'data6':_0x5522cd[_0x1536('0x41')]},{'where':{'id':_0x5522cd['id']}});})[_0x1536('0x3d')](function(){return _0x5522cd;})[_0x1536('0x47')](function(_0x2b1487){logger['error'](_0x1536('0x48'),_0x5522cd['id'],_0x2b1487);});}function getOauth2MicrosoftAccessToken(_0x220382,_0x3fb6cd){var _0x2882c6={'grant_type':_0x1536('0x49'),'code':_0x220382,'scope':getAccessTokenScope(_0x3fb6cd),'redirect_uri':_0x3fb6cd[_0x1536('0x27')],'client_id':_0x3fb6cd[_0x1536('0x30')],'client_secret':encryptor[_0x1536('0x4a')](_0x3fb6cd[_0x1536('0x42')])};var _0xf535b3={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1536('0x1c')](_0x1536('0x43'),_0x3fb6cd[_0x1536('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2882c6,'json':!![]};return rp(_0xf535b3);}function startRefreshInterval(_0x2dd113){var _0x37b0c8=schedule[_0x1536('0x4b')];if(_0x37b0c8[_0x2dd113['id']])clearInterval(_0x37b0c8[_0x2dd113['id']]);_0x37b0c8[_0x2dd113['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1536('0x4c')](this,{'id':_0x2dd113['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1536('0x4b')]=_0x37b0c8;}function startAllRefreshIntervals(){return db[_0x1536('0x3e')][_0x1536('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x986bf7){var _0x49bded=_0x986bf7[_0x1536('0x2d')](function(_0x56bd04){return refreshOauth2MicrosoftAccessToken(_0x56bd04)['then'](function(_0x2ffc37){startRefreshInterval(_0x2ffc37);});});return Promise[_0x1536('0x4e')](_0x49bded);})[_0x1536('0x47')](function(_0x25964d){var _0x563e42=_0x25964d?util['inspect'](_0x25964d,{'showHidden':![],'depth':null}):'';logger[_0x1536('0x4f')](_0x1536('0x50'),_0x563e42);});}module[_0x1536('0x51')]={'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 5e64036..4e2801d 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 _0x8ed7=['jayson/promise','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0x8ed7,0x8b));var _0x78ed=function(_0x3a0661,_0x429adc){_0x3a0661=_0x3a0661-0x0;var _0x1ea7e4=_0x8ed7[_0x3a0661];return _0x1ea7e4;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var moment=require(_0x78ed('0x1'));var BPromise=require(_0x78ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ed('0x3'))['db'];var utils=require(_0x78ed('0x4'));var logger=require(_0x78ed('0x5'))(_0x78ed('0x6'));var config=require(_0x78ed('0x7'));var jayson=require(_0x78ed('0x8'));var client=jayson[_0x78ed('0x9')][_0x78ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fc5e7,_0x54c783,_0x232d7b){return new BPromise(function(_0x5197a3,_0x1c0ec8){return client['request'](_0x1fc5e7,_0x232d7b)[_0x78ed('0xb')](function(_0x550763){logger['info'](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));logger['debug'](_0x78ed('0xe'),_0x54c783,_0x78ed('0xd'),JSON['stringify'](_0x550763));if(_0x550763[_0x78ed('0xf')]){if(_0x550763['error'][_0x78ed('0x10')]===0x1f4){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x550763[_0x78ed('0xf')][_0x78ed('0x11')]);return _0x1c0ec8(_0x550763[_0x78ed('0xf')]['message']);}logger[_0x78ed('0xf')]('CloudProvider,\x20%s,\x20%s',_0x54c783,_0x550763['error']['message']);return _0x5197a3(_0x550763['error']['message']);}else{logger[_0x78ed('0x12')](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));_0x5197a3(_0x550763[_0x78ed('0x13')][_0x78ed('0x11')]);}})[_0x78ed('0x14')](function(_0x336ae1){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x336ae1);_0x1c0ec8(_0x336ae1);});});} \ No newline at end of file +var _0xa064=['stringify','error','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x35852a,_0x563430){var _0x439c4f=function(_0xa47fbe){while(--_0xa47fbe){_0x35852a['push'](_0x35852a['shift']());}};_0x439c4f(++_0x563430);}(_0xa064,0x192));var _0x4a06=function(_0xf04b83,_0x399c28){_0xf04b83=_0xf04b83-0x0;var _0x3d15eb=_0xa064[_0xf04b83];return _0x3d15eb;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var moment=require(_0x4a06('0x2'));var BPromise=require(_0x4a06('0x3'));var rs=require(_0x4a06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a06('0x5'));var logger=require('../../config/logger')(_0x4a06('0x6'));var config=require(_0x4a06('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a06('0x8')][_0x4a06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d4e3,_0x3b01cc,_0x454574){return new BPromise(function(_0x4c966b,_0x5e3342){return client[_0x4a06('0xa')](_0x55d4e3,_0x454574)[_0x4a06('0xb')](function(_0x3a8db5){logger[_0x4a06('0xc')]('CloudProvider,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));logger[_0x4a06('0xe')](_0x4a06('0xf'),_0x3b01cc,_0x4a06('0xd'),JSON[_0x4a06('0x10')](_0x3a8db5));if(_0x3a8db5[_0x4a06('0x11')]){if(_0x3a8db5[_0x4a06('0x11')]['code']===0x1f4){logger[_0x4a06('0x11')]('CloudProvider,\x20%s,\x20%s',_0x3b01cc,_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);return _0x5e3342(_0x3a8db5[_0x4a06('0x11')]['message']);}logger[_0x4a06('0x11')](_0x4a06('0x13'),_0x3b01cc,_0x3a8db5[_0x4a06('0x11')]['message']);return _0x4c966b(_0x3a8db5[_0x4a06('0x11')][_0x4a06('0x12')]);}else{logger[_0x4a06('0xc')]('CloudProvider,\x20%s,\x20%s',_0x3b01cc,_0x4a06('0xd'));_0x4c966b(_0x3a8db5[_0x4a06('0x14')][_0x4a06('0x12')]);}})[_0x4a06('0x15')](function(_0x15b067){logger['error'](_0x4a06('0x13'),_0x3b01cc,_0x15b067);_0x5e3342(_0x15b067);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b71d4f7..1b8e769 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x5eb979,_0x4ab81e){var _0x164fdb=function(_0x393b1c){while(--_0x393b1c){_0x5eb979['push'](_0x5eb979['shift']());}};_0x164fdb(++_0x4ab81e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x572385,_0x38208e){var _0x27b7ca=function(_0x4423c4){while(--_0x4423c4){_0x572385['push'](_0x572385['shift']());}};_0x27b7ca(++_0x38208e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7585452..8e3b2af 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 _0x7b00=['exports','STRING','sequelize'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x7b00,0xa4));var _0x07b0=function(_0x4e5c91,_0x298f64){_0x4e5c91=_0x4e5c91-0x0;var _0x5d40e7=_0x7b00[_0x4e5c91];return _0x5d40e7;};'use strict';var Sequelize=require(_0x07b0('0x0'));module[_0x07b0('0x1')]={'name':{'type':Sequelize[_0x07b0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x07b0('0x2')]},'companyId':{'type':Sequelize[_0x07b0('0x2')]},'website':{'type':Sequelize[_0x07b0('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x07b0('0x2')]},'type':{'type':Sequelize[_0x07b0('0x2')]},'street':{'type':Sequelize[_0x07b0('0x2')]},'postalCode':{'type':Sequelize[_0x07b0('0x2')]},'city':{'type':Sequelize[_0x07b0('0x2')]},'country':{'type':Sequelize[_0x07b0('0x2')]},'email':{'type':Sequelize[_0x07b0('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x07b0('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x07b0('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x07b0('0x2')]},'description':{'type':Sequelize[_0x07b0('0x2')]}}; \ No newline at end of file +var _0x2a5e=['sequelize','name','STRING'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x2a5e,0xf6));var _0xe2a5=function(_0x122cd4,_0x3ed93d){_0x122cd4=_0x122cd4-0x0;var _0x170dcb=_0x2a5e[_0x122cd4];return _0x170dcb;};'use strict';var Sequelize=require(_0xe2a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe2a5('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe2a5('0x2')]},'companyId':{'type':Sequelize[_0xe2a5('0x2')]},'website':{'type':Sequelize[_0xe2a5('0x2')]},'phone':{'type':Sequelize[_0xe2a5('0x2')]},'fax':{'type':Sequelize[_0xe2a5('0x2')]},'type':{'type':Sequelize[_0xe2a5('0x2')]},'street':{'type':Sequelize[_0xe2a5('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe2a5('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe2a5('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xe2a5('0x2')]},'sPostalCode':{'type':Sequelize[_0xe2a5('0x2')]},'sCity':{'type':Sequelize[_0xe2a5('0x2')]},'sCountry':{'type':Sequelize[_0xe2a5('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 7f103e6..d3f6424 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 _0x99ff=['limit','count','set','Content-Range','json','apply','reject','update','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','destroy','describe','CmContact','addContacts','ids','getContacts','hasOwnProperty','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x442d3c,_0x18bf15){var _0x48c5a4=function(_0x4191f4){while(--_0x4191f4){_0x442d3c['push'](_0x442d3c['shift']());}};_0x48c5a4(++_0x18bf15);}(_0x99ff,0xe2));var _0xf99f=function(_0x507357,_0x2c9a2f){_0x507357=_0x507357-0x0;var _0x164653=_0x99ff[_0x507357];return _0x164653;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf99f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf99f('0x1'));var moment=require('moment');var BPromise=require(_0xf99f('0x2'));var Mustache=require(_0xf99f('0x3'));var util=require(_0xf99f('0x4'));var path=require(_0xf99f('0x5'));var sox=require(_0xf99f('0x6'));var csv=require(_0xf99f('0x7'));var ejs=require(_0xf99f('0x8'));var fs=require('fs');var fs_extra=require(_0xf99f('0x9'));var _=require(_0xf99f('0xa'));var squel=require('squel');var crypto=require(_0xf99f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf99f('0x7'));var querystring=require(_0xf99f('0xc'));var Papa=require(_0xf99f('0xd'));var Redis=require(_0xf99f('0xe'));var authService=require(_0xf99f('0xf'));var qs=require(_0xf99f('0x10'));var as=require(_0xf99f('0x11'));var hardwareService=require(_0xf99f('0x12'));var logger=require(_0xf99f('0x13'))(_0xf99f('0x14'));var utils=require(_0xf99f('0x15'));var config=require(_0xf99f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf99f('0x17'))['db'];function respondWithStatusCode(_0x5ae492,_0x2fe925){_0x2fe925=_0x2fe925||0xcc;return function(_0xdb3b3a){if(_0xdb3b3a){return _0x5ae492[_0xf99f('0x18')](_0x2fe925);}return _0x5ae492[_0xf99f('0x19')](_0x2fe925)[_0xf99f('0x1a')]();};}function respondWithResult(_0x21c15f,_0x3eaa1c){_0x3eaa1c=_0x3eaa1c||0xc8;return function(_0x4dd8e8){if(_0x4dd8e8){return _0x21c15f['status'](_0x3eaa1c)['json'](_0x4dd8e8);}};}function respondWithFilteredResult(_0x19561c,_0x173884){return function(_0x37007e){if(_0x37007e){var _0x869220=typeof _0x173884[_0xf99f('0x1b')]===_0xf99f('0x1c')&&typeof _0x173884[_0xf99f('0x1d')]===_0xf99f('0x1c');var _0xc5ab54=_0x37007e[_0xf99f('0x1e')];var _0x18f7d1=_0x869220?0x0:_0x173884[_0xf99f('0x1b')];var _0x5f0181=_0x869220?_0x37007e[_0xf99f('0x1e')]:_0x173884[_0xf99f('0x1b')]+_0x173884[_0xf99f('0x1d')];var _0x5012f2;if(_0x5f0181>=_0xc5ab54){_0x5f0181=_0xc5ab54;_0x5012f2=0xc8;}else{_0x5012f2=0xce;}_0x19561c[_0xf99f('0x19')](_0x5012f2);return _0x19561c[_0xf99f('0x1f')](_0xf99f('0x20'),_0x18f7d1+'-'+_0x5f0181+'/'+_0xc5ab54)[_0xf99f('0x21')](_0x37007e);}return null;};}function patchUpdates(_0x23ced8){return function(_0x276413){try{jsonpatch[_0xf99f('0x22')](_0x276413,_0x23ced8,!![]);}catch(_0x262670){return BPromise[_0xf99f('0x23')](_0x262670);}return _0x276413['save']();};}function saveUpdates(_0x506500,_0x5ad4a6){return function(_0x38f4d1){if(_0x38f4d1){return _0x38f4d1[_0xf99f('0x24')](_0x506500)[_0xf99f('0x25')](function(_0x1ab25c){return _0x1ab25c;});}return null;};}function removeEntity(_0x421c17,_0x4094f8){return function(_0x12ed07){if(_0x12ed07){return _0x12ed07['destroy']()['then'](function(){var _0x1beb6c=_0x12ed07[_0xf99f('0x26')]({'plain':!![]});var _0x25996e=_0xf99f('0x27');return db[_0xf99f('0x28')]['destroy']({'where':{'type':_0x25996e,'resourceId':_0x1beb6c['id']}})[_0xf99f('0x25')](function(){return _0x12ed07;});})[_0xf99f('0x25')](function(){_0x421c17[_0xf99f('0x19')](0xcc)[_0xf99f('0x1a')]();});}};}function handleEntityNotFound(_0x5c0210,_0x5d1f41){return function(_0x9b5b08){if(!_0x9b5b08){_0x5c0210[_0xf99f('0x18')](0x194);}return _0x9b5b08;};}function handleError(_0x8b1ea2,_0x3d64c7){_0x3d64c7=_0x3d64c7||0x1f4;return function(_0x3cb85a){logger[_0xf99f('0x29')](_0x3cb85a[_0xf99f('0x2a')]);if(_0x3cb85a[_0xf99f('0x2b')]){delete _0x3cb85a[_0xf99f('0x2b')];}_0x8b1ea2['status'](_0x3d64c7)[_0xf99f('0x2c')](_0x3cb85a);};}exports[_0xf99f('0x2d')]=function(_0x345318,_0xbff334){var _0xc7e108={},_0x218e99={},_0xd4e917={'count':0x0,'rows':[]};return db[_0xf99f('0x2e')]['describe']()[_0xf99f('0x25')](function(_0x504f5e){_0x218e99['model']=_[_0xf99f('0x2f')](_0x504f5e);_0x218e99[_0xf99f('0x30')]=_[_0xf99f('0x2f')](_0x345318[_0xf99f('0x30')]);_0x218e99[_0xf99f('0x31')]=_[_0xf99f('0x32')](_0x218e99[_0xf99f('0x33')],_0x218e99['query']);_0xc7e108[_0xf99f('0x34')]=_[_0xf99f('0x32')](_0x218e99[_0xf99f('0x33')],qs[_0xf99f('0x35')](_0x345318[_0xf99f('0x30')][_0xf99f('0x35')]));_0xc7e108['attributes']=_0xc7e108['attributes'][_0xf99f('0x36')]?_0xc7e108[_0xf99f('0x34')]:_0x218e99[_0xf99f('0x33')];if(!_0x345318['query']['hasOwnProperty'](_0xf99f('0x37'))){_0xc7e108['limit']=qs['limit'](_0x345318[_0xf99f('0x30')]['limit']);_0xc7e108[_0xf99f('0x1b')]=qs['offset'](_0x345318[_0xf99f('0x30')][_0xf99f('0x1b')]);}_0xc7e108[_0xf99f('0x38')]=qs[_0xf99f('0x39')](_0x345318[_0xf99f('0x30')][_0xf99f('0x39')]);_0xc7e108[_0xf99f('0x3a')]=qs[_0xf99f('0x31')](_[_0xf99f('0x3b')](_0x345318['query'],_0x218e99[_0xf99f('0x31')]),_0x504f5e);if(_0x345318['query'][_0xf99f('0x3c')]){_0xc7e108[_0xf99f('0x3a')]=_[_0xf99f('0x3d')](_0xc7e108['where'],{'$or':_[_0xf99f('0x3e')](_0xc7e108[_0xf99f('0x34')],function(_0x44ae76){var _0x38549a={};_0x38549a[_0x44ae76]={'$like':'%'+_0x345318['query'][_0xf99f('0x3c')]+'%'};return _0x38549a;})});}_0xc7e108=_[_0xf99f('0x3d')]({},_0xc7e108,_0x345318[_0xf99f('0x3f')]);var _0x3c1a8f={'where':_0xc7e108['where']};return db[_0xf99f('0x2e')][_0xf99f('0x1e')](_0x3c1a8f)[_0xf99f('0x25')](function(_0xcf37c8){_0xd4e917[_0xf99f('0x1e')]=_0xcf37c8;if(_0x345318[_0xf99f('0x30')][_0xf99f('0x40')]){_0xc7e108[_0xf99f('0x41')]=[{'all':!![]}];}return db[_0xf99f('0x2e')][_0xf99f('0x42')](_0xc7e108);})[_0xf99f('0x25')](function(_0x365922){_0xd4e917[_0xf99f('0x43')]=_0x365922;return _0xd4e917;})['then'](respondWithFilteredResult(_0xbff334,_0xc7e108))[_0xf99f('0x44')](handleError(_0xbff334,null));})[_0xf99f('0x44')](handleError(_0xbff334,null));};exports[_0xf99f('0x45')]=function(_0x47de92,_0x35c252){var _0x36325c={'raw':![],'where':{'id':_0x47de92[_0xf99f('0x46')]['id']}},_0xcab6a9={};_0xcab6a9[_0xf99f('0x33')]=_['keys'](db[_0xf99f('0x2e')][_0xf99f('0x47')]);_0xcab6a9[_0xf99f('0x30')]=_[_0xf99f('0x2f')](_0x47de92[_0xf99f('0x30')]);_0xcab6a9[_0xf99f('0x31')]=_['intersection'](_0xcab6a9[_0xf99f('0x33')],_0xcab6a9[_0xf99f('0x30')]);_0x36325c[_0xf99f('0x34')]=_[_0xf99f('0x32')](_0xcab6a9[_0xf99f('0x33')],qs[_0xf99f('0x35')](_0x47de92[_0xf99f('0x30')][_0xf99f('0x35')]));_0x36325c[_0xf99f('0x34')]=_0x36325c[_0xf99f('0x34')][_0xf99f('0x36')]?_0x36325c[_0xf99f('0x34')]:_0xcab6a9[_0xf99f('0x33')];if(_0x47de92[_0xf99f('0x30')]['includeAll']){_0x36325c['include']=[{'all':!![]}];}_0x36325c=_[_0xf99f('0x3d')]({},_0x36325c,_0x47de92['options']);return db[_0xf99f('0x2e')][_0xf99f('0x48')](_0x36325c)[_0xf99f('0x25')](handleEntityNotFound(_0x35c252,null))[_0xf99f('0x25')](respondWithResult(_0x35c252,null))[_0xf99f('0x44')](handleError(_0x35c252,null));};exports[_0xf99f('0x49')]=function(_0x1d0ea6,_0x49bd5c){return db[_0xf99f('0x2e')][_0xf99f('0x49')](_0x1d0ea6[_0xf99f('0x4a')],{})[_0xf99f('0x25')](function(_0xef1309){var _0x53a67d=_0x1d0ea6[_0xf99f('0x4b')][_0xf99f('0x26')]({'plain':!![]});if(!_0x53a67d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53a67d[_0xf99f('0x4c')]===_0xf99f('0x4b')){var _0x2d9825=_0xef1309[_0xf99f('0x26')]({'plain':!![]});var _0x36cc4f=_0xf99f('0x27');return db[_0xf99f('0x4d')][_0xf99f('0x48')]({'where':{'name':_0x36cc4f,'userProfileId':_0x53a67d['userProfileId']},'raw':!![]})[_0xf99f('0x25')](function(_0x358c0c){if(_0x358c0c&&_0x358c0c['autoAssociation']===0x0){return db[_0xf99f('0x28')][_0xf99f('0x49')]({'name':_0x2d9825[_0xf99f('0x2b')],'resourceId':_0x2d9825['id'],'type':_0x358c0c[_0xf99f('0x2b')],'sectionId':_0x358c0c['id']},{})[_0xf99f('0x25')](function(){return _0xef1309;});}else{return _0xef1309;}})['catch'](function(_0x5a9527){logger[_0xf99f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a9527);throw _0x5a9527;});}return _0xef1309;})['then'](respondWithResult(_0x49bd5c,0xc9))[_0xf99f('0x44')](handleError(_0x49bd5c,null));};exports[_0xf99f('0x24')]=function(_0x453428,_0x419f9e){if(_0x453428['body']['id']){delete _0x453428['body']['id'];}return db[_0xf99f('0x2e')][_0xf99f('0x48')]({'where':{'id':_0x453428[_0xf99f('0x46')]['id']}})[_0xf99f('0x25')](handleEntityNotFound(_0x419f9e,null))[_0xf99f('0x25')](saveUpdates(_0x453428[_0xf99f('0x4a')],null))['then'](respondWithResult(_0x419f9e,null))[_0xf99f('0x44')](handleError(_0x419f9e,null));};exports[_0xf99f('0x4e')]=function(_0x1bafe0,_0x869a9a){return db[_0xf99f('0x2e')][_0xf99f('0x48')]({'where':{'id':_0x1bafe0[_0xf99f('0x46')]['id']}})['then'](handleEntityNotFound(_0x869a9a,null))[_0xf99f('0x25')](removeEntity(_0x869a9a,null))[_0xf99f('0x44')](handleError(_0x869a9a,null));};exports[_0xf99f('0x4f')]=function(_0x4fd5cf,_0xa5c1bb){return db['CmCompany']['describe']()[_0xf99f('0x25')](respondWithResult(_0xa5c1bb,null))[_0xf99f('0x44')](handleError(_0xa5c1bb,null));};exports['addContacts']=function(_0x17451e,_0x2886d0,_0x373a94){return db[_0xf99f('0x50')]['find']({'where':{'id':_0x17451e[_0xf99f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2886d0,null))[_0xf99f('0x25')](function(_0x5aae0f){if(_0x5aae0f){return _0x5aae0f[_0xf99f('0x51')](_0x17451e[_0xf99f('0x4a')]['ids'],_['omit'](_0x17451e['body'],[_0xf99f('0x52'),'id'])||{});}})[_0xf99f('0x25')](respondWithResult(_0x2886d0,null))[_0xf99f('0x44')](handleError(_0x2886d0,null));};exports['getContacts']=function(_0x4b326c,_0x3d2fc4,_0x103e5f){var _0x2655f8={};var _0x4b23fe={};var _0x16cd64;var _0x4bde04;return db['CmCompany']['findOne']({'where':{'id':_0x4b326c[_0xf99f('0x46')]['id']}})[_0xf99f('0x25')](handleEntityNotFound(_0x3d2fc4,null))[_0xf99f('0x25')](function(_0x23d2b8){if(_0x23d2b8){_0x16cd64=_0x23d2b8;_0x4b23fe[_0xf99f('0x33')]=_[_0xf99f('0x2f')](db[_0xf99f('0x50')][_0xf99f('0x47')]);_0x4b23fe[_0xf99f('0x30')]=_[_0xf99f('0x2f')](_0x4b326c[_0xf99f('0x30')]);_0x4b23fe[_0xf99f('0x31')]=_['intersection'](_0x4b23fe[_0xf99f('0x33')],_0x4b23fe[_0xf99f('0x30')]);_0x2655f8[_0xf99f('0x34')]=_['intersection'](_0x4b23fe[_0xf99f('0x33')],qs[_0xf99f('0x35')](_0x4b326c[_0xf99f('0x30')][_0xf99f('0x35')]));_0x2655f8[_0xf99f('0x34')]=_0x2655f8[_0xf99f('0x34')][_0xf99f('0x36')]?_0x2655f8['attributes']:_0x4b23fe[_0xf99f('0x33')];_0x2655f8[_0xf99f('0x38')]=qs[_0xf99f('0x39')](_0x4b326c[_0xf99f('0x30')][_0xf99f('0x39')]);_0x2655f8[_0xf99f('0x3a')]=qs['filters'](_[_0xf99f('0x3b')](_0x4b326c[_0xf99f('0x30')],_0x4b23fe['filters']));if(_0x4b326c[_0xf99f('0x30')][_0xf99f('0x3c')]){_0x2655f8[_0xf99f('0x3a')]=_[_0xf99f('0x3d')](_0x2655f8['where'],{'$or':_[_0xf99f('0x3e')](_0x2655f8[_0xf99f('0x34')],function(_0x359ef3){var _0x11c359={};_0x11c359[_0x359ef3]={'$like':'%'+_0x4b326c[_0xf99f('0x30')][_0xf99f('0x3c')]+'%'};return _0x11c359;})});}_0x2655f8=_['merge']({},_0x2655f8,_0x4b326c[_0xf99f('0x3f')]);return _0x16cd64[_0xf99f('0x53')](_0x2655f8);}})['then'](function(_0x2189c4){if(_0x2189c4){_0x4bde04=_0x2189c4[_0xf99f('0x36')];if(!_0x4b326c[_0xf99f('0x30')][_0xf99f('0x54')](_0xf99f('0x37'))){_0x2655f8[_0xf99f('0x1d')]=qs['limit'](_0x4b326c[_0xf99f('0x30')][_0xf99f('0x1d')]);_0x2655f8['offset']=qs['offset'](_0x4b326c[_0xf99f('0x30')][_0xf99f('0x1b')]);}return _0x16cd64['getContacts'](_0x2655f8);}})[_0xf99f('0x25')](function(_0x3a12ca){if(_0x3a12ca){return _0x3a12ca?{'count':_0x4bde04,'rows':_0x3a12ca}:null;}})[_0xf99f('0x25')](respondWithResult(_0x3d2fc4,null))[_0xf99f('0x44')](handleError(_0x3d2fc4,null));}; \ No newline at end of file +var _0x64e1=['sort','where','filters','merge','filter','options','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','pick','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','describe','keys','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','order'];(function(_0x368113,_0x244119){var _0x475e26=function(_0x301a02){while(--_0x301a02){_0x368113['push'](_0x368113['shift']());}};_0x475e26(++_0x244119);}(_0x64e1,0xcc));var _0x164e=function(_0x718030,_0x3b25c9){_0x718030=_0x718030-0x0;var _0x13b085=_0x64e1[_0x718030];return _0x13b085;};'use strict';var emlformat=require(_0x164e('0x0'));var rimraf=require(_0x164e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x164e('0x2'));var rp=require(_0x164e('0x3'));var moment=require('moment');var BPromise=require(_0x164e('0x4'));var Mustache=require(_0x164e('0x5'));var util=require(_0x164e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x164e('0x7'));var ejs=require(_0x164e('0x8'));var fs=require('fs');var fs_extra=require(_0x164e('0x9'));var _=require(_0x164e('0xa'));var squel=require(_0x164e('0xb'));var crypto=require(_0x164e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x164e('0x7'));var querystring=require(_0x164e('0xd'));var Papa=require(_0x164e('0xe'));var Redis=require(_0x164e('0xf'));var authService=require(_0x164e('0x10'));var qs=require(_0x164e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x164e('0x12'))(_0x164e('0x13'));var utils=require(_0x164e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x164e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305214,_0x28cb79){_0x28cb79=_0x28cb79||0xcc;return function(_0xd114a6){if(_0xd114a6){return _0x305214[_0x164e('0x16')](_0x28cb79);}return _0x305214[_0x164e('0x17')](_0x28cb79)[_0x164e('0x18')]();};}function respondWithResult(_0x245c29,_0x4adbb0){_0x4adbb0=_0x4adbb0||0xc8;return function(_0x2206a1){if(_0x2206a1){return _0x245c29[_0x164e('0x17')](_0x4adbb0)[_0x164e('0x19')](_0x2206a1);}};}function respondWithFilteredResult(_0x4d89b7,_0x3b2233){return function(_0x361859){if(_0x361859){var _0x25fbae=typeof _0x3b2233[_0x164e('0x1a')]===_0x164e('0x1b')&&typeof _0x3b2233[_0x164e('0x1c')]==='undefined';var _0x42fc9f=_0x361859[_0x164e('0x1d')];var _0x4e3c95=_0x25fbae?0x0:_0x3b2233[_0x164e('0x1a')];var _0x4f3501=_0x25fbae?_0x361859[_0x164e('0x1d')]:_0x3b2233[_0x164e('0x1a')]+_0x3b2233[_0x164e('0x1c')];var _0x5a06ea;if(_0x4f3501>=_0x42fc9f){_0x4f3501=_0x42fc9f;_0x5a06ea=0xc8;}else{_0x5a06ea=0xce;}_0x4d89b7['status'](_0x5a06ea);return _0x4d89b7[_0x164e('0x1e')](_0x164e('0x1f'),_0x4e3c95+'-'+_0x4f3501+'/'+_0x42fc9f)[_0x164e('0x19')](_0x361859);}return null;};}function patchUpdates(_0x202bf6){return function(_0x397ac9){try{jsonpatch[_0x164e('0x20')](_0x397ac9,_0x202bf6,!![]);}catch(_0x46e5d8){return BPromise[_0x164e('0x21')](_0x46e5d8);}return _0x397ac9[_0x164e('0x22')]();};}function saveUpdates(_0x4fb8b7,_0x186902){return function(_0x55cd93){if(_0x55cd93){return _0x55cd93[_0x164e('0x23')](_0x4fb8b7)['then'](function(_0x2f922a){return _0x2f922a;});}return null;};}function removeEntity(_0xcd3ae6,_0xa30a5d){return function(_0x2a69d3){if(_0x2a69d3){return _0x2a69d3[_0x164e('0x24')]()[_0x164e('0x25')](function(){var _0x242055=_0x2a69d3[_0x164e('0x26')]({'plain':!![]});var _0xc8bd89=_0x164e('0x27');return db[_0x164e('0x28')][_0x164e('0x24')]({'where':{'type':_0xc8bd89,'resourceId':_0x242055['id']}})[_0x164e('0x25')](function(){return _0x2a69d3;});})[_0x164e('0x25')](function(){_0xcd3ae6[_0x164e('0x17')](0xcc)[_0x164e('0x18')]();});}};}function handleEntityNotFound(_0x587777,_0x151160){return function(_0x4fdc48){if(!_0x4fdc48){_0x587777[_0x164e('0x16')](0x194);}return _0x4fdc48;};}function handleError(_0x259ad0,_0x495268){_0x495268=_0x495268||0x1f4;return function(_0x31db0c){logger[_0x164e('0x29')](_0x31db0c[_0x164e('0x2a')]);if(_0x31db0c['name']){delete _0x31db0c[_0x164e('0x2b')];}_0x259ad0[_0x164e('0x17')](_0x495268)['send'](_0x31db0c);};}exports[_0x164e('0x2c')]=function(_0x50e310,_0x2c9b86){var _0x209131={},_0xea448b={},_0x574bd0={'count':0x0,'rows':[]};return db[_0x164e('0x2d')][_0x164e('0x2e')]()[_0x164e('0x25')](function(_0x143bab){_0xea448b['model']=_[_0x164e('0x2f')](_0x143bab);_0xea448b['query']=_[_0x164e('0x2f')](_0x50e310['query']);_0xea448b['filters']=_[_0x164e('0x30')](_0xea448b['model'],_0xea448b['query']);_0x209131[_0x164e('0x31')]=_[_0x164e('0x30')](_0xea448b[_0x164e('0x32')],qs[_0x164e('0x33')](_0x50e310[_0x164e('0x34')][_0x164e('0x33')]));_0x209131[_0x164e('0x31')]=_0x209131[_0x164e('0x31')][_0x164e('0x35')]?_0x209131['attributes']:_0xea448b[_0x164e('0x32')];if(!_0x50e310[_0x164e('0x34')][_0x164e('0x36')](_0x164e('0x37'))){_0x209131[_0x164e('0x1c')]=qs[_0x164e('0x1c')](_0x50e310['query']['limit']);_0x209131[_0x164e('0x1a')]=qs[_0x164e('0x1a')](_0x50e310['query']['offset']);}_0x209131[_0x164e('0x38')]=qs[_0x164e('0x39')](_0x50e310[_0x164e('0x34')]['sort']);_0x209131[_0x164e('0x3a')]=qs[_0x164e('0x3b')](_['pick'](_0x50e310['query'],_0xea448b['filters']),_0x143bab);if(_0x50e310['query']['filter']){_0x209131[_0x164e('0x3a')]=_[_0x164e('0x3c')](_0x209131[_0x164e('0x3a')],{'$or':_['map'](_0x209131[_0x164e('0x31')],function(_0x5dc6d6){var _0x452e26={};_0x452e26[_0x5dc6d6]={'$like':'%'+_0x50e310['query'][_0x164e('0x3d')]+'%'};return _0x452e26;})});}_0x209131=_[_0x164e('0x3c')]({},_0x209131,_0x50e310[_0x164e('0x3e')]);var _0x408a72={'where':_0x209131[_0x164e('0x3a')]};return db[_0x164e('0x2d')][_0x164e('0x1d')](_0x408a72)[_0x164e('0x25')](function(_0x19d189){_0x574bd0[_0x164e('0x1d')]=_0x19d189;if(_0x50e310[_0x164e('0x34')]['includeAll']){_0x209131[_0x164e('0x3f')]=[{'all':!![]}];}return db[_0x164e('0x2d')][_0x164e('0x40')](_0x209131);})[_0x164e('0x25')](function(_0x6e5db8){_0x574bd0['rows']=_0x6e5db8;return _0x574bd0;})[_0x164e('0x25')](respondWithFilteredResult(_0x2c9b86,_0x209131))['catch'](handleError(_0x2c9b86,null));})['catch'](handleError(_0x2c9b86,null));};exports['show']=function(_0xb6d10e,_0x302ea3){var _0x35b96b={'raw':![],'where':{'id':_0xb6d10e[_0x164e('0x41')]['id']}},_0x31af1a={};_0x31af1a[_0x164e('0x32')]=_['keys'](db[_0x164e('0x2d')][_0x164e('0x42')]);_0x31af1a['query']=_['keys'](_0xb6d10e[_0x164e('0x34')]);_0x31af1a[_0x164e('0x3b')]=_['intersection'](_0x31af1a['model'],_0x31af1a[_0x164e('0x34')]);_0x35b96b[_0x164e('0x31')]=_[_0x164e('0x30')](_0x31af1a[_0x164e('0x32')],qs[_0x164e('0x33')](_0xb6d10e[_0x164e('0x34')]['fields']));_0x35b96b[_0x164e('0x31')]=_0x35b96b[_0x164e('0x31')][_0x164e('0x35')]?_0x35b96b[_0x164e('0x31')]:_0x31af1a[_0x164e('0x32')];if(_0xb6d10e['query'][_0x164e('0x43')]){_0x35b96b[_0x164e('0x3f')]=[{'all':!![]}];}_0x35b96b=_['merge']({},_0x35b96b,_0xb6d10e['options']);return db['CmCompany'][_0x164e('0x44')](_0x35b96b)[_0x164e('0x25')](handleEntityNotFound(_0x302ea3,null))[_0x164e('0x25')](respondWithResult(_0x302ea3,null))[_0x164e('0x45')](handleError(_0x302ea3,null));};exports[_0x164e('0x46')]=function(_0x3e626d,_0x4f8f26){return db[_0x164e('0x2d')][_0x164e('0x46')](_0x3e626d[_0x164e('0x47')],{})[_0x164e('0x25')](function(_0x1ab498){var _0x3badc2=_0x3e626d[_0x164e('0x48')]['get']({'plain':!![]});if(!_0x3badc2)throw new Error(_0x164e('0x49'));if(_0x3badc2[_0x164e('0x4a')]===_0x164e('0x48')){var _0x5398b1=_0x1ab498['get']({'plain':!![]});var _0x5ea807='Companies';return db[_0x164e('0x4b')][_0x164e('0x44')]({'where':{'name':_0x5ea807,'userProfileId':_0x3badc2[_0x164e('0x4c')]},'raw':!![]})[_0x164e('0x25')](function(_0x56ac68){if(_0x56ac68&&_0x56ac68[_0x164e('0x4d')]===0x0){return db[_0x164e('0x28')]['create']({'name':_0x5398b1[_0x164e('0x2b')],'resourceId':_0x5398b1['id'],'type':_0x56ac68[_0x164e('0x2b')],'sectionId':_0x56ac68['id']},{})['then'](function(){return _0x1ab498;});}else{return _0x1ab498;}})[_0x164e('0x45')](function(_0x35165c){logger[_0x164e('0x29')](_0x164e('0x4e'),_0x35165c);throw _0x35165c;});}return _0x1ab498;})['then'](respondWithResult(_0x4f8f26,0xc9))[_0x164e('0x45')](handleError(_0x4f8f26,null));};exports[_0x164e('0x23')]=function(_0x13bc4b,_0x282c68){if(_0x13bc4b[_0x164e('0x47')]['id']){delete _0x13bc4b['body']['id'];}return db[_0x164e('0x2d')][_0x164e('0x44')]({'where':{'id':_0x13bc4b[_0x164e('0x41')]['id']}})[_0x164e('0x25')](handleEntityNotFound(_0x282c68,null))[_0x164e('0x25')](saveUpdates(_0x13bc4b[_0x164e('0x47')],null))[_0x164e('0x25')](respondWithResult(_0x282c68,null))[_0x164e('0x45')](handleError(_0x282c68,null));};exports['destroy']=function(_0x186575,_0x2b71aa){return db[_0x164e('0x2d')][_0x164e('0x44')]({'where':{'id':_0x186575[_0x164e('0x41')]['id']}})[_0x164e('0x25')](handleEntityNotFound(_0x2b71aa,null))[_0x164e('0x25')](removeEntity(_0x2b71aa,null))[_0x164e('0x45')](handleError(_0x2b71aa,null));};exports[_0x164e('0x2e')]=function(_0x5ee403,_0x5a2010){return db['CmCompany'][_0x164e('0x2e')]()[_0x164e('0x25')](respondWithResult(_0x5a2010,null))[_0x164e('0x45')](handleError(_0x5a2010,null));};exports[_0x164e('0x4f')]=function(_0x352307,_0xd2254c,_0x512f67){return db['CmContact']['find']({'where':{'id':_0x352307[_0x164e('0x41')]['id']}})[_0x164e('0x25')](handleEntityNotFound(_0xd2254c,null))[_0x164e('0x25')](function(_0x4d52fa){if(_0x4d52fa){return _0x4d52fa[_0x164e('0x4f')](_0x352307['body'][_0x164e('0x50')],_[_0x164e('0x51')](_0x352307[_0x164e('0x47')],[_0x164e('0x50'),'id'])||{});}})[_0x164e('0x25')](respondWithResult(_0xd2254c,null))[_0x164e('0x45')](handleError(_0xd2254c,null));};exports[_0x164e('0x52')]=function(_0x5cd8be,_0x39c1e2,_0x28082b){var _0x3fc8db={};var _0x21d265={};var _0x53bf3b;var _0x38d6d3;return db[_0x164e('0x2d')][_0x164e('0x53')]({'where':{'id':_0x5cd8be[_0x164e('0x41')]['id']}})[_0x164e('0x25')](handleEntityNotFound(_0x39c1e2,null))['then'](function(_0x58ec7f){if(_0x58ec7f){_0x53bf3b=_0x58ec7f;_0x21d265[_0x164e('0x32')]=_[_0x164e('0x2f')](db[_0x164e('0x54')][_0x164e('0x42')]);_0x21d265[_0x164e('0x34')]=_[_0x164e('0x2f')](_0x5cd8be[_0x164e('0x34')]);_0x21d265[_0x164e('0x3b')]=_[_0x164e('0x30')](_0x21d265[_0x164e('0x32')],_0x21d265[_0x164e('0x34')]);_0x3fc8db[_0x164e('0x31')]=_[_0x164e('0x30')](_0x21d265[_0x164e('0x32')],qs['fields'](_0x5cd8be['query'][_0x164e('0x33')]));_0x3fc8db[_0x164e('0x31')]=_0x3fc8db[_0x164e('0x31')][_0x164e('0x35')]?_0x3fc8db[_0x164e('0x31')]:_0x21d265['model'];_0x3fc8db[_0x164e('0x38')]=qs[_0x164e('0x39')](_0x5cd8be[_0x164e('0x34')][_0x164e('0x39')]);_0x3fc8db[_0x164e('0x3a')]=qs[_0x164e('0x3b')](_[_0x164e('0x55')](_0x5cd8be[_0x164e('0x34')],_0x21d265[_0x164e('0x3b')]));if(_0x5cd8be[_0x164e('0x34')][_0x164e('0x3d')]){_0x3fc8db[_0x164e('0x3a')]=_[_0x164e('0x3c')](_0x3fc8db[_0x164e('0x3a')],{'$or':_[_0x164e('0x56')](_0x3fc8db[_0x164e('0x31')],function(_0x359c99){var _0x27d6df={};_0x27d6df[_0x359c99]={'$like':'%'+_0x5cd8be['query'][_0x164e('0x3d')]+'%'};return _0x27d6df;})});}_0x3fc8db=_[_0x164e('0x3c')]({},_0x3fc8db,_0x5cd8be[_0x164e('0x3e')]);return _0x53bf3b[_0x164e('0x52')](_0x3fc8db);}})[_0x164e('0x25')](function(_0x2a7652){if(_0x2a7652){_0x38d6d3=_0x2a7652[_0x164e('0x35')];if(!_0x5cd8be['query'][_0x164e('0x36')](_0x164e('0x37'))){_0x3fc8db['limit']=qs[_0x164e('0x1c')](_0x5cd8be['query'][_0x164e('0x1c')]);_0x3fc8db[_0x164e('0x1a')]=qs[_0x164e('0x1a')](_0x5cd8be[_0x164e('0x34')][_0x164e('0x1a')]);}return _0x53bf3b['getContacts'](_0x3fc8db);}})['then'](function(_0x4514f3){if(_0x4514f3){return _0x4514f3?{'count':_0x38d6d3,'rows':_0x4514f3}:null;}})[_0x164e('0x25')](respondWithResult(_0x39c1e2,null))[_0x164e('0x45')](handleError(_0x39c1e2,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5c2c9ce..9726357 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 _0xd39f=['cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmCompany.attributes','exports'];(function(_0x4fa1d2,_0x5b071b){var _0x5d2fa8=function(_0x36e3d8){while(--_0x36e3d8){_0x4fa1d2['push'](_0x4fa1d2['shift']());}};_0x5d2fa8(++_0x5b071b);}(_0xd39f,0x1eb));var _0xfd39=function(_0x2defe7,_0x29d104){_0x2defe7=_0x2defe7-0x0;var _0x49993f=_0xd39f[_0x2defe7];return _0x49993f;};'use strict';var _=require(_0xfd39('0x0'));var util=require(_0xfd39('0x1'));var logger=require(_0xfd39('0x2'))('api');var moment=require(_0xfd39('0x3'));var BPromise=require(_0xfd39('0x4'));var rp=require(_0xfd39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd39('0x6'));var attributes=require(_0xfd39('0x7'));module[_0xfd39('0x8')]=function(_0x205439,_0x34046a){return _0x205439['define']('CmCompany',attributes,{'tableName':_0xfd39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c4b=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x46de76,_0xe99c27){var _0x2d8b7b=function(_0x31c360){while(--_0x31c360){_0x46de76['push'](_0x46de76['shift']());}};_0x2d8b7b(++_0xe99c27);}(_0x9c4b,0x102));var _0xb9c4=function(_0x1dee0c,_0x13b016){_0x1dee0c=_0x1dee0c-0x0;var _0x12d97e=_0x9c4b[_0x1dee0c];return _0x12d97e;};'use strict';var _=require(_0xb9c4('0x0'));var util=require(_0xb9c4('0x1'));var logger=require(_0xb9c4('0x2'))(_0xb9c4('0x3'));var moment=require(_0xb9c4('0x4'));var BPromise=require(_0xb9c4('0x5'));var rp=require(_0xb9c4('0x6'));var fs=require('fs');var path=require(_0xb9c4('0x7'));var rimraf=require('rimraf');var config=require(_0xb9c4('0x8'));var attributes=require(_0xb9c4('0x9'));module[_0xb9c4('0xa')]=function(_0x5994b9,_0x25eb94){return _0x5994b9[_0xb9c4('0xb')](_0xb9c4('0xc'),attributes,{'tableName':_0xb9c4('0xd'),'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 b58b068..8992048 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 _0xc5ea=['error','message','CmCompany,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xc5ea,0x194));var _0xac5e=function(_0x264960,_0x36a3f2){_0x264960=_0x264960-0x0;var _0x580987=_0xc5ea[_0x264960];return _0x580987;};'use strict';var _=require('lodash');var util=require(_0xac5e('0x0'));var moment=require(_0xac5e('0x1'));var BPromise=require(_0xac5e('0x2'));var rs=require(_0xac5e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac5e('0x4'))['db'];var utils=require(_0xac5e('0x5'));var logger=require(_0xac5e('0x6'))(_0xac5e('0x7'));var config=require(_0xac5e('0x8'));var jayson=require(_0xac5e('0x9'));var client=jayson[_0xac5e('0xa')][_0xac5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a0023,_0x2ba769,_0x24c33d){return new BPromise(function(_0x22d638,_0x22f91a){return client[_0xac5e('0xc')](_0x3a0023,_0x24c33d)['then'](function(_0x2ad9ad){logger[_0xac5e('0xd')]('CmCompany,\x20%s,\x20%s',_0x2ba769,'request\x20sent');logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x2ba769,_0xac5e('0xe'),JSON[_0xac5e('0xf')](_0x2ad9ad));if(_0x2ad9ad['error']){if(_0x2ad9ad[_0xac5e('0x10')]['code']===0x1f4){logger[_0xac5e('0x10')]('CmCompany,\x20%s,\x20%s',_0x2ba769,_0x2ad9ad['error'][_0xac5e('0x11')]);return _0x22f91a(_0x2ad9ad[_0xac5e('0x10')][_0xac5e('0x11')]);}logger[_0xac5e('0x10')](_0xac5e('0x12'),_0x2ba769,_0x2ad9ad[_0xac5e('0x10')][_0xac5e('0x11')]);return _0x22d638(_0x2ad9ad[_0xac5e('0x10')][_0xac5e('0x11')]);}else{logger[_0xac5e('0xd')](_0xac5e('0x12'),_0x2ba769,_0xac5e('0xe'));_0x22d638(_0x2ad9ad[_0xac5e('0x13')][_0xac5e('0x11')]);}})[_0xac5e('0x14')](function(_0x3c8a10){logger[_0xac5e('0x10')](_0xac5e('0x12'),_0x2ba769,_0x3c8a10);_0x22f91a(_0x3c8a10);});});} \ No newline at end of file +var _0xf2f2=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x31a2d1,_0x56b703){var _0x377212=function(_0x1284f8){while(--_0x1284f8){_0x31a2d1['push'](_0x31a2d1['shift']());}};_0x377212(++_0x56b703);}(_0xf2f2,0x167));var _0x2f2f=function(_0x269e23,_0x14d11c){_0x269e23=_0x269e23-0x0;var _0x69ad53=_0xf2f2[_0x269e23];return _0x69ad53;};'use strict';var _=require('lodash');var util=require(_0x2f2f('0x0'));var moment=require(_0x2f2f('0x1'));var BPromise=require(_0x2f2f('0x2'));var rs=require(_0x2f2f('0x3'));var fs=require('fs');var Redis=require(_0x2f2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f2f('0x5'));var logger=require(_0x2f2f('0x6'))(_0x2f2f('0x7'));var config=require(_0x2f2f('0x8'));var jayson=require(_0x2f2f('0x9'));var client=jayson['client'][_0x2f2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e9480,_0x5b2656,_0x12be84){return new BPromise(function(_0x5e9531,_0x514e3b){return client[_0x2f2f('0xb')](_0x1e9480,_0x12be84)[_0x2f2f('0xc')](function(_0x186491){logger[_0x2f2f('0xd')](_0x2f2f('0xe'),_0x5b2656,_0x2f2f('0xf'));logger[_0x2f2f('0x10')](_0x2f2f('0x11'),_0x5b2656,_0x2f2f('0xf'),JSON[_0x2f2f('0x12')](_0x186491));if(_0x186491[_0x2f2f('0x13')]){if(_0x186491[_0x2f2f('0x13')]['code']===0x1f4){logger[_0x2f2f('0x13')](_0x2f2f('0xe'),_0x5b2656,_0x186491[_0x2f2f('0x13')][_0x2f2f('0x14')]);return _0x514e3b(_0x186491[_0x2f2f('0x13')][_0x2f2f('0x14')]);}logger[_0x2f2f('0x13')](_0x2f2f('0xe'),_0x5b2656,_0x186491[_0x2f2f('0x13')]['message']);return _0x5e9531(_0x186491[_0x2f2f('0x13')][_0x2f2f('0x14')]);}else{logger[_0x2f2f('0xd')](_0x2f2f('0xe'),_0x5b2656,_0x2f2f('0xf'));_0x5e9531(_0x186491['result'][_0x2f2f('0x14')]);}})[_0x2f2f('0x15')](function(_0x106f1f){logger[_0x2f2f('0x13')](_0x2f2f('0xe'),_0x5b2656,_0x106f1f);_0x514e3b(_0x106f1f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4f04043..5fcb47d 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 _0x7f9e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1f978b,_0x4e6ba2){var _0x41d373=function(_0x59e9ea){while(--_0x59e9ea){_0x1f978b['push'](_0x1f978b['shift']());}};_0x41d373(++_0x4e6ba2);}(_0x7f9e,0x90));var _0xe7f9=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x7f9e[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0xe7f9('0x0'));var util=require(_0xe7f9('0x1'));var path=require(_0xe7f9('0x2'));var timeout=require(_0xe7f9('0x3'));var express=require('express');var router=express[_0xe7f9('0x4')]();var fs_extra=require(_0xe7f9('0x5'));var auth=require(_0xe7f9('0x6'));var interaction=require(_0xe7f9('0x7'));var config=require(_0xe7f9('0x8'));var controller=require(_0xe7f9('0x9'));router[_0xe7f9('0xa')]('/',auth[_0xe7f9('0xb')](),controller['index']);router[_0xe7f9('0xa')]('/describe',auth[_0xe7f9('0xb')](),controller[_0xe7f9('0xc')]);router['get'](_0xe7f9('0xd'),auth[_0xe7f9('0xb')](),controller[_0xe7f9('0xe')]);router[_0xe7f9('0xa')](_0xe7f9('0xf'),auth['isAuthenticated'](),controller[_0xe7f9('0x10')]);router[_0xe7f9('0x11')]('/',auth[_0xe7f9('0xb')](),controller[_0xe7f9('0x12')]);router[_0xe7f9('0x11')](_0xe7f9('0xf'),auth['isAuthenticated'](),controller[_0xe7f9('0x13')]);router[_0xe7f9('0x14')]('/:id',auth[_0xe7f9('0xb')](),controller[_0xe7f9('0x15')]);router[_0xe7f9('0x16')](_0xe7f9('0xd'),auth[_0xe7f9('0xb')](),controller[_0xe7f9('0x17')]);module[_0xe7f9('0x18')]=router; \ No newline at end of file +var _0xe562=['/:id/contacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','isAuthenticated','describe','get','/:id','show','getContacts','post'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe562,0xf5));var _0x2e56=function(_0x4749de,_0x3dd428){_0x4749de=_0x4749de-0x0;var _0x316cc1=_0xe562[_0x4749de];return _0x316cc1;};'use strict';var multer=require(_0x2e56('0x0'));var util=require(_0x2e56('0x1'));var path=require(_0x2e56('0x2'));var timeout=require(_0x2e56('0x3'));var express=require(_0x2e56('0x4'));var router=express[_0x2e56('0x5')]();var fs_extra=require(_0x2e56('0x6'));var auth=require(_0x2e56('0x7'));var interaction=require(_0x2e56('0x8'));var config=require(_0x2e56('0x9'));var controller=require(_0x2e56('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x2e56('0xb')]);router['get']('/describe',auth[_0x2e56('0xc')](),controller[_0x2e56('0xd')]);router[_0x2e56('0xe')](_0x2e56('0xf'),auth[_0x2e56('0xc')](),controller[_0x2e56('0x10')]);router[_0x2e56('0xe')]('/:id/contacts',auth[_0x2e56('0xc')](),controller[_0x2e56('0x11')]);router[_0x2e56('0x12')]('/',auth[_0x2e56('0xc')](),controller['create']);router[_0x2e56('0x12')](_0x2e56('0x13'),auth[_0x2e56('0xc')](),controller['addContacts']);router[_0x2e56('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2e56('0x15')](_0x2e56('0xf'),auth[_0x2e56('0xc')](),controller[_0x2e56('0x16')]);module[_0x2e56('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 054725c..57aff73 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 _0x468f=['exports','STRING','NOW','sequelize'];(function(_0x489b1f,_0x56af4a){var _0x5e5b1d=function(_0x358221){while(--_0x358221){_0x489b1f['push'](_0x489b1f['shift']());}};_0x5e5b1d(++_0x56af4a);}(_0x468f,0xeb));var _0xf468=function(_0x22b005,_0x2a6515){_0x22b005=_0x22b005-0x0;var _0x58bd11=_0x468f[_0x22b005];return _0x58bd11;};'use strict';var _=require('lodash');var Sequelize=require(_0xf468('0x0'));module[_0xf468('0x1')]={'firstName':{'type':Sequelize[_0xf468('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf468('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf468('0x2')]},'city':{'type':Sequelize[_0xf468('0x2')]},'country':{'type':Sequelize[_0xf468('0x2')]},'dateOfBirth':{'type':Sequelize[_0xf468('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xf468('0x2')]},'mobile':{'type':Sequelize[_0xf468('0x2')]},'fax':{'type':Sequelize[_0xf468('0x2')]},'email':{'type':Sequelize[_0xf468('0x2')]},'url':{'type':Sequelize[_0xf468('0x2')]},'facebook':{'type':Sequelize[_0xf468('0x2')]},'fb_data':{'type':Sequelize[_0xf468('0x2')]},'twitter':{'type':Sequelize[_0xf468('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xf468('0x2')]},'viber':{'type':Sequelize[_0xf468('0x2')]},'line':{'type':Sequelize[_0xf468('0x2')]},'wechat':{'type':Sequelize[_0xf468('0x2')]},'telegram':{'type':Sequelize[_0xf468('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xf468('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xf468('0x3')]},'dialTimezone':{'type':Sequelize[_0xf468('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb210=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x12d9d2,_0x41e830){var _0x14acd6=function(_0x22462f){while(--_0x22462f){_0x12d9d2['push'](_0x12d9d2['shift']());}};_0x14acd6(++_0x41e830);}(_0xb210,0x1c8));var _0x0b21=function(_0x1f3a20,_0x7c46de){_0x1f3a20=_0x1f3a20-0x0;var _0x5d5cf5=_0xb210[_0x1f3a20];return _0x5d5cf5;};'use strict';var _=require(_0x0b21('0x0'));var Sequelize=require('sequelize');module[_0x0b21('0x1')]={'firstName':{'type':Sequelize[_0x0b21('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0b21('0x2')]},'street':{'type':Sequelize[_0x0b21('0x2')]},'postalCode':{'type':Sequelize[_0x0b21('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0b21('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0b21('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0b21('0x2')]},'fax':{'type':Sequelize[_0x0b21('0x2')]},'email':{'type':Sequelize[_0x0b21('0x2')]},'url':{'type':Sequelize[_0x0b21('0x2')]},'facebook':{'type':Sequelize[_0x0b21('0x2')]},'fb_data':{'type':Sequelize[_0x0b21('0x2')]},'twitter':{'type':Sequelize[_0x0b21('0x2')]},'skype':{'type':Sequelize[_0x0b21('0x2')]},'teams':{'type':Sequelize[_0x0b21('0x2')]},'viber':{'type':Sequelize[_0x0b21('0x2')]},'line':{'type':Sequelize[_0x0b21('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x0b21('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x0b21('0x2')]},'priority':{'type':Sequelize[_0x0b21('0x4')](0x2)[_0x0b21('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0b21('0x6')],'defaultValue':Sequelize[_0x0b21('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x0b21('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 6a4977d..4db2044 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 _0x3c63=['length','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','push','where','ListId','findOrCreate','contact','all','show','Tag','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','cf_%d','pickBy','format','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','fields','attributes','sort','pick','filter','options','setTags','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','order','ContactId','includeAll','include','rows','CmHopperFinal','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','send','upload','createReadStream','parse','meta','User','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','exit','getJourney','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','source','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','chat','Website','Account','closed','closedAt','thirdDisposition','key','Tags','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','externalUrl','threadId','startCase','Interaction','Owner','flatten','sortBy','reverse','slice','moment','util','path','lodash','squel','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','end','sendStatus','error','name','index','describe','getOptions','findAll','user','catch','destroy','CmContact','find','params','tags','keys','startsWith','columnName','displayName','query','analytics','CmCustomField','cf_','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body'];(function(_0xe96487,_0x36c816){var _0x500779=function(_0x97b53f){while(--_0x97b53f){_0xe96487['push'](_0xe96487['shift']());}};_0x500779(++_0x36c816);}(_0x3c63,0x1c0));var _0x33c6=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x3c63[_0x47aa64];return _0x549c7a;};'use strict';var moment=require(_0x33c6('0x0'));var BPromise=require('bluebird');var util=require(_0x33c6('0x1'));var path=require(_0x33c6('0x2'));var fs=require('fs');var _=require(_0x33c6('0x3'));var squel=require(_0x33c6('0x4'));var Papa=require('papaparse');var Redis=require(_0x33c6('0x5'));var contacts=require(_0x33c6('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x33c6('0x7'))(_0x33c6('0x8'));var config=require(_0x33c6('0x9'));var shared=require(_0x33c6('0xa'));var db=require('../../mysqldb')['db'];config[_0x33c6('0xb')]=_[_0x33c6('0xc')](config['redis'],{'host':_0x33c6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33c6('0xb')]));require(_0x33c6('0xe'))[_0x33c6('0xf')](socket);function respondWithResult(_0x345f10,_0xe20be6){_0xe20be6=_0xe20be6||0xc8;return function(_0x25b1b3){if(_0x25b1b3){return _0x345f10[_0x33c6('0x10')](_0xe20be6)['json'](_0x25b1b3);}};}function respondWithFilteredResult(_0x25cbe1,_0x27b773){return function(_0x1ed86f){if(_0x1ed86f){var _0x394e9d=typeof _0x27b773[_0x33c6('0x11')]===_0x33c6('0x12')&&typeof _0x27b773[_0x33c6('0x13')]===_0x33c6('0x12');var _0x122750=_0x1ed86f['count'];var _0x5a1be6=_0x394e9d?0x0:_0x27b773[_0x33c6('0x11')];var _0xa94506=_0x394e9d?_0x1ed86f[_0x33c6('0x14')]:_0x27b773[_0x33c6('0x11')]+_0x27b773[_0x33c6('0x13')];var _0x291ec0;if(_0xa94506>=_0x122750){_0xa94506=_0x122750;_0x291ec0=0xc8;}else{_0x291ec0=0xce;}_0x25cbe1[_0x33c6('0x10')](_0x291ec0);return _0x25cbe1[_0x33c6('0x15')](_0x33c6('0x16'),_0x5a1be6+'-'+_0xa94506+'/'+_0x122750)[_0x33c6('0x17')](_0x1ed86f);}return null;};}function saveUpdates(_0x1867c2){return function(_0x19f0f6){if(_0x19f0f6){return _0x19f0f6[_0x33c6('0x18')](_0x1867c2)[_0x33c6('0x19')](function(_0x58f8e3){return _0x58f8e3;});}return null;};}function removeEntity(_0x37bed2){return function(_0x31cda1){if(_0x31cda1){return _0x31cda1['destroy']()['then'](function(){_0x37bed2[_0x33c6('0x10')](0xcc)[_0x33c6('0x1a')]();});}};}function handleEntityNotFound(_0x170ae3){return function(_0x348ccb){if(!_0x348ccb){_0x170ae3[_0x33c6('0x1b')](0x194);}return _0x348ccb;};}function handleError(_0x10e66b,_0x48ed25){_0x48ed25=_0x48ed25||0x1f4;return function(_0x2b09e8){logger[_0x33c6('0x1c')](_0x2b09e8['stack']);if(_0x2b09e8[_0x33c6('0x1d')]){delete _0x2b09e8[_0x33c6('0x1d')];}_0x10e66b[_0x33c6('0x10')](_0x48ed25)['send'](_0x2b09e8);};}exports[_0x33c6('0x1e')]=function(_0x2629d0,_0x24aa33){var _0x38cd68={};return contacts[_0x33c6('0x1f')]()[_0x33c6('0x19')](function(_0x49471e){_0x38cd68=qs[_0x33c6('0x20')](_0x49471e,_0x2629d0);return contacts[_0x33c6('0x21')](_0x2629d0['query'],_0x2629d0[_0x33c6('0x22')],_0x38cd68,_0x49471e);})['then'](respondWithFilteredResult(_0x24aa33,_0x38cd68))[_0x33c6('0x23')](handleError(_0x24aa33,null));};exports[_0x33c6('0x24')]=function(_0x4c2aa9,_0x57cf25){return db[_0x33c6('0x25')][_0x33c6('0x26')]({'where':{'id':_0x4c2aa9[_0x33c6('0x27')]['id']}})[_0x33c6('0x19')](handleEntityNotFound(_0x57cf25,null))[_0x33c6('0x19')](removeEntity(_0x57cf25,null))['catch'](handleError(_0x57cf25,null));};exports[_0x33c6('0x1f')]=function(_0x5243cd,_0x5ef1f5){return db[_0x33c6('0x25')][_0x33c6('0x1f')]()['then'](function(_0x35d6c2){delete _0x35d6c2[_0x33c6('0x28')];for(var _0x44834c=0x0;_0x44834c0x0){return new Promise(function(_0x46fae3){var _0x4d4fee=[];for(var _0x3cb914=0x0;_0x3cb914<_0x532537[_0x33c6('0x3a')];_0x3cb914++){_0x4d4fee[_0x33c6('0x60')](insertAdditionalPhones(_0x532537[_0x3cb914][_0x33c6('0x64')],_0x532537[_0x3cb914][_0x33c6('0x5c')]));}Promise[_0x33c6('0x65')](_0x4d4fee)[_0x33c6('0x19')](function(){_0x46fae3(0x1);});})[_0x33c6('0x19')](function(){return{'success':_0x26f30b,'failure':_0x298d03,'duplicates':_0x4109c7};});}else{return{'success':_0x26f30b,'failure':_0x298d03,'duplicates':_0x4109c7};}}})[_0x33c6('0x19')](respondWithResult(_0x3ba84b,0xc9))['catch'](handleError(_0x3ba84b,null));};exports[_0x33c6('0x66')]=function(_0x2d6b1e,_0x157fc3){var _0x20fdf2;return db[_0x33c6('0x25')][_0x33c6('0x1f')]()[_0x33c6('0x19')](function(_0x45a217){return db[_0x33c6('0x25')]['find']({'where':{'id':_0x2d6b1e[_0x33c6('0x27')]['id']},'include':[{'model':db[_0x33c6('0x67')],'as':'Tags','attributes':['id','name',_0x33c6('0x68')],'required':_0x2d6b1e['query'][_0x33c6('0x69')]?!![]:![]},{'model':db[_0x33c6('0x6a')],'as':_0x33c6('0x6b'),'where':{'CmContactId':_0x2d6b1e[_0x33c6('0x27')]['id']},'required':![],'include':[{'model':db[_0x33c6('0x6c')],'as':_0x33c6('0x6d')}]}],'order':[db[_0x33c6('0x6e')][_0x33c6('0x6f')](_0x33c6('0x70'))],'attributes':_['keys'](_0x45a217)});})['then'](function(_0x19d8b6){if(!_[_0x33c6('0x59')](_0x19d8b6)){_0x20fdf2=_0x19d8b6['get']({'plain':!![]});var _0x571372={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19d8b6&&_0x19d8b6[_0x33c6('0x62')]){if(_0x19d8b6['ListId']){_0x571372[_0x33c6('0x61')][_0x33c6('0x71')][_0x33c6('0x60')]({'ListId':{'$ne':_0x19d8b6[_0x33c6('0x62')]}});}}return db[_0x33c6('0x2f')][_0x33c6('0x21')](_0x571372);}})[_0x33c6('0x19')](function(_0x58e729){if(!_['isNil'](_0x58e729)){return _[_0x33c6('0x72')](_0x20fdf2,_[_0x33c6('0x73')](_0x58e729,function(_0x527f10){return util['format'](_0x33c6('0x74'),_0x527f10['id']);}));}})[_0x33c6('0x19')](handleEntityNotFound(_0x157fc3,null))[_0x33c6('0x19')](respondWithResult(_0x157fc3,null))[_0x33c6('0x23')](handleError(_0x157fc3,null));};exports[_0x33c6('0x18')]=function(_0x23e996,_0x25130d){var _0x3f246e;if(_0x23e996['body']['id']){delete _0x23e996['body']['id'];}if(!_['isNil'](_0x23e996[_0x33c6('0x39')][_0x33c6('0x58')])){var _0x5c2ddd=_0x23e996[_0x33c6('0x39')][_0x33c6('0x58')];if(!_['isNil'](shared['timezones'][_0x5c2ddd]))_0x23e996[_0x33c6('0x39')][_0x33c6('0x5b')]=shared[_0x33c6('0x5a')][_0x5c2ddd][_0x33c6('0x5b')];}return db[_0x33c6('0x25')][_0x33c6('0x26')]({'where':{'id':_0x23e996[_0x33c6('0x27')]['id']}})[_0x33c6('0x19')](handleEntityNotFound(_0x25130d,null))['then'](saveUpdates(_0x23e996[_0x33c6('0x39')],null))[_0x33c6('0x19')](function(_0x57fcbe){_0x3f246e=_0x57fcbe;var _0x4ae5c5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x57fcbe&&_0x57fcbe[_0x33c6('0x62')]){if(_0x57fcbe['ListId']){_0x4ae5c5[_0x33c6('0x61')]['$and'][_0x33c6('0x60')]({'ListId':{'$ne':_0x57fcbe['ListId']}});}}return db['CmCustomField']['findAll'](_0x4ae5c5);})[_0x33c6('0x19')](function(_0x56ebd5){if(_0x56ebd5){return _[_0x33c6('0x72')](_[_0x33c6('0x75')](_0x23e996['body'],function(_0x5906cf,_0x329b6a){return _[_0x33c6('0x2a')](_0x329b6a,_0x33c6('0x30'));}),_['map'](_0x56ebd5,function(_0x365ab3){return util[_0x33c6('0x76')](_0x33c6('0x74'),_0x365ab3['id']);}));}})[_0x33c6('0x19')](function(_0x50b0c7){if(_0x50b0c7&&!_['isEmpty'](_0x50b0c7)){var _0x316d8c=squel[_0x33c6('0x18')]()['table']('cm_contacts')[_0x33c6('0x77')](_0x50b0c7)[_0x33c6('0x61')](_0x33c6('0x78'),_0x23e996[_0x33c6('0x27')]['id'])[_0x33c6('0x79')]();return db[_0x33c6('0x6e')]['query'](_0x316d8c[_0x33c6('0x7a')],{'replacements':_0x316d8c[_0x33c6('0x33')]});}})['then'](function(){if(_0x23e996[_0x33c6('0x39')]['phone']&&_0x3f246e){return db[_0x33c6('0x3f')][_0x33c6('0x18')]({'phone':_0x23e996[_0x33c6('0x39')][_0x33c6('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x3f246e['id']}});}})[_0x33c6('0x19')](function(){return _0x3f246e;})['then'](respondWithResult(_0x25130d,null))['catch'](handleError(_0x25130d,null));};exports[_0x33c6('0x7c')]=function(_0x578f07,_0x2ef105){var _0x4739cc={};var _0x35068c={};var _0x473745;var _0x6bcdb0;return db[_0x33c6('0x25')][_0x33c6('0x7d')]({'where':{'id':_0x578f07['params']['id']}})[_0x33c6('0x19')](handleEntityNotFound(_0x2ef105,null))[_0x33c6('0x19')](function(_0x17bcc9){if(_0x17bcc9){_0x473745=_0x17bcc9;_0x35068c[_0x33c6('0x7e')]=_[_0x33c6('0x29')](db[_0x33c6('0x67')][_0x33c6('0x7f')]);_0x35068c['query']=_['keys'](_0x578f07[_0x33c6('0x2d')]);_0x35068c[_0x33c6('0x80')]=_[_0x33c6('0x81')](_0x35068c[_0x33c6('0x7e')],_0x35068c[_0x33c6('0x2d')]);_0x4739cc['attributes']=_[_0x33c6('0x81')](_0x35068c[_0x33c6('0x7e')],qs[_0x33c6('0x82')](_0x578f07['query'][_0x33c6('0x82')]));_0x4739cc[_0x33c6('0x83')]=_0x4739cc[_0x33c6('0x83')][_0x33c6('0x3a')]?_0x4739cc[_0x33c6('0x83')]:_0x35068c['model'];_0x4739cc['order']=qs[_0x33c6('0x84')](_0x578f07[_0x33c6('0x2d')][_0x33c6('0x84')]);_0x4739cc[_0x33c6('0x61')]=qs[_0x33c6('0x80')](_[_0x33c6('0x85')](_0x578f07['query'],_0x35068c[_0x33c6('0x80')]));if(_0x578f07[_0x33c6('0x2d')][_0x33c6('0x86')]){_0x4739cc['where']=_[_0x33c6('0x38')](_0x4739cc[_0x33c6('0x61')],{'$or':_[_0x33c6('0x73')](_0x4739cc['attributes'],function(_0x260107){var _0x5cc06a={};_0x5cc06a[_0x260107]={'$like':'%'+_0x578f07[_0x33c6('0x2d')][_0x33c6('0x86')]+'%'};return _0x5cc06a;})});}_0x4739cc=_[_0x33c6('0x38')]({},_0x4739cc,_0x578f07[_0x33c6('0x87')]);return _0x473745['getTags'](_0x4739cc);}})[_0x33c6('0x19')](function(_0x3037c5){if(_0x3037c5){_0x6bcdb0=_0x3037c5[_0x33c6('0x3a')];if(!_0x578f07[_0x33c6('0x2d')][_0x33c6('0x37')]('nolimit')){_0x4739cc[_0x33c6('0x13')]=qs[_0x33c6('0x13')](_0x578f07[_0x33c6('0x2d')][_0x33c6('0x13')]);_0x4739cc['offset']=qs[_0x33c6('0x11')](_0x578f07[_0x33c6('0x2d')][_0x33c6('0x11')]);}return _0x473745[_0x33c6('0x7c')](_0x4739cc);}})[_0x33c6('0x19')](function(_0x7ec66c){if(_0x7ec66c){return _0x7ec66c?{'count':_0x6bcdb0,'rows':_0x7ec66c}:null;}})[_0x33c6('0x19')](respondWithResult(_0x2ef105,null))[_0x33c6('0x23')](handleError(_0x2ef105,null));};exports[_0x33c6('0x88')]=function(_0x19a212,_0x112edf){if(_0x19a212[_0x33c6('0x39')]['id']){delete _0x19a212[_0x33c6('0x39')]['id'];}return db[_0x33c6('0x25')][_0x33c6('0x7d')]({'where':{'id':_0x19a212[_0x33c6('0x27')]['id']}})['then'](handleEntityNotFound(_0x112edf,null))[_0x33c6('0x19')](function(_0x23fa2e){if(_0x23fa2e){return _0x23fa2e[_0x33c6('0x88')](_0x19a212['body']['ids']||[]);}return null;})[_0x33c6('0x19')](respondWithResult(_0x112edf,null))[_0x33c6('0x23')](handleError(_0x112edf,null));};exports['setAdditionalPhones']=function(_0x5268a6,_0x421a4a){var _0x369f30=[];_0x369f30[_0x33c6('0x60')](addAdditionalPhones(_0x5268a6['body']));Promise[_0x33c6('0x65')](_0x369f30)['then'](function(){_0x369f30=[];_0x369f30['push'](deleteCmHopperPhones(_0x5268a6[_0x33c6('0x39')]['id']));_0x369f30['push'](addCmHopperPhones(_0x5268a6[_0x33c6('0x39')]['id']));Promise[_0x33c6('0x65')](_0x369f30)[_0x33c6('0x19')](function(){return[0x1];})[_0x33c6('0x19')](respondWithResult(_0x421a4a,null));});};function addAdditionalPhones(_0x1b80c0){var _0x21a239;return new Promise(function(_0x3d5861){return db[_0x33c6('0x6a')][_0x33c6('0x24')]({'where':{'CmContactId':_0x1b80c0['id']}})[_0x33c6('0x19')](function(){db['ContactItemType'][_0x33c6('0x21')]({'raw':!![],'attributes':['id',_0x33c6('0x89')]})['then'](function(_0x1621b3){var _0x249aa9=[];for(var _0x1c0d22=0x0;_0x1c0d22<_0x1b80c0[_0x33c6('0x8a')][_0x33c6('0x3a')];_0x1c0d22++){var _0x5ea8d8=_0x1b80c0[_0x33c6('0x8b')]?_['isNil'](_0x1b80c0[_0x33c6('0x8b')][_0x1c0d22])?'':_0x1b80c0[_0x33c6('0x8b')][_0x1c0d22]:_0x1b80c0[_0x33c6('0x8a')][_0x1c0d22][_0x33c6('0x8c')]?_0x1b80c0['items'][_0x1c0d22][_0x33c6('0x8c')]:'';var _0x40818a=_[_0x33c6('0x59')](_0x1b80c0['items'][_0x1c0d22]['description'])?'':_0x1b80c0[_0x33c6('0x8a')][_0x1c0d22][_0x33c6('0x8d')];var _0x328963=_0x5ea8d8+':'+_0x1b80c0[_0x33c6('0x8a')][_0x1c0d22][_0x33c6('0x7b')]+'§'+_0x40818a;if(_[_0x33c6('0x59')](_0x21a239))_0x21a239=_0x328963;else _0x21a239+=';'+_0x328963;var _0x56f73b=null;var _0x3505bc=null;if(_0x1b80c0[_0x33c6('0x8b')]){if(!_[_0x33c6('0x59')](_0x1b80c0[_0x33c6('0x8b')][_0x1c0d22])){_0x3505bc=_['find'](_0x1621b3,function(_0x169b48){return _0x169b48['id']===_0x1b80c0[_0x33c6('0x8b')][_0x1c0d22];});if(!_[_0x33c6('0x59')](_0x3505bc)){_0x56f73b=_0x3505bc['OrderBy'];}}}else{if(!_[_0x33c6('0x59')](_0x1b80c0[_0x33c6('0x8a')][_0x1c0d22])){_0x3505bc=_['find'](_0x1621b3,function(_0xb165b7){return _0xb165b7['id']===_0x1b80c0['items'][_0x1c0d22][_0x33c6('0x8c')];});if(!_[_0x33c6('0x59')](_0x3505bc)){_0x56f73b=_0x1c0d22;}}}if(_[_0x33c6('0x59')](_0x56f73b)){_0x56f73b=0x64;}_0x249aa9[_0x33c6('0x60')](addAdditionalPhone(_0x1b80c0['id'],_0x1b80c0['items'][_0x1c0d22][_0x33c6('0x7b')],_0x1b80c0[_0x33c6('0x8b')]?_[_0x33c6('0x59')](_0x1b80c0['item_types'][_0x1c0d22])?null:_0x1b80c0[_0x33c6('0x8b')][_0x1c0d22]:_0x1b80c0['items'][_0x1c0d22][_0x33c6('0x8c')]?_0x1b80c0['items'][_0x1c0d22][_0x33c6('0x8c')]:null,_0x56f73b,_0x40818a));}Promise[_0x33c6('0x65')](_0x249aa9)[_0x33c6('0x19')](function(){db[_0x33c6('0x25')]['update']({'AdditionalPhones':_0x21a239},{'where':{'id':_0x1b80c0['id']}})[_0x33c6('0x19')](function(){_0x3d5861(0x1);});});});});});}function addAdditionalPhone(_0x971165,_0x25b1ac,_0x4e8f86,_0x4d37d5,_0x17c9f1){return db['CmContactHasItem'][_0x33c6('0x26')]({'where':{'CmContactId':_0x971165,'item':_0x25b1ac}})[_0x33c6('0x19')](function(_0x21d248){if(_0x21d248)logger[_0x33c6('0x34')](_0x33c6('0x8e'),_0x21d248);else{db[_0x33c6('0x6a')][_0x33c6('0x43')]({'CmContactId':_0x971165,'item':_0x25b1ac,'ItemTypeId':_0x4e8f86,'OrderBy':_0x4d37d5,'ItemClass':_0x33c6('0x8f'),'description':_0x17c9f1});}});}function deleteCmHopperPhones(_0x53b844){return new Promise(function(_0x41497e){return db[_0x33c6('0x3f')][_0x33c6('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x53b844}})[_0x33c6('0x19')](function(_0x143334){db['CmHopperAdditionalPhone'][_0x33c6('0x24')]({'where':{'CmHopperId':{'$in':_[_0x33c6('0x73')](_0x143334,'id')}}});})[_0x33c6('0x19')](function(){_0x41497e(0x1);});});}function addCmHopperPhones(_0x3213fc){return new Promise(function(_0x436e3b){return db[_0x33c6('0x3f')][_0x33c6('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3213fc}})[_0x33c6('0x19')](function(_0x39aa0d){var _0x13a00d=[];_['map'](_0x39aa0d,function(_0x295a31){_0x13a00d[_0x33c6('0x60')](createCmHopperPhone(_0x3213fc,_0x295a31['id']));});Promise[_0x33c6('0x65')](_0x13a00d)[_0x33c6('0x19')](function(){_0x436e3b(0x1);});});});}function createCmHopperPhone(_0x4fb21d,_0x1b1a0a){return new Promise(function(_0x1ba890){db['CmContactHasItem'][_0x33c6('0x21')]({'raw':!![],'attributes':[_0x33c6('0x90'),'OrderBy'],'where':{'CmContactId':_0x4fb21d,'ItemClass':_0x33c6('0x8f')},'include':[{'model':db[_0x33c6('0x6c')],'attributes':[_0x33c6('0x89')],'as':_0x33c6('0x6d')}],'order':['OrderBy',db[_0x33c6('0x6e')][_0x33c6('0x6f')](_0x33c6('0x91'))]})[_0x33c6('0x19')](function(_0x3688b1){var _0x131521=0x1;var _0xa4b8e3=_[_0x33c6('0x73')](_0x3688b1,function(_0x3969b5){_0x3969b5[_0x33c6('0x92')]=_0x1b1a0a;_0x3969b5[_0x33c6('0x7b')]=_0x3969b5[_0x33c6('0x90')];_0x3969b5[_0x33c6('0x89')]=_0x131521;delete _0x3969b5[_0x33c6('0x93')];_0x131521=_0x131521+0x1;return _0x3969b5;});return db[_0x33c6('0x94')]['bulkCreate'](_0xa4b8e3,{});})[_0x33c6('0x19')](function(){_0x1ba890(0x1);});});}function insertAdditionalPhones(_0x38e6ac,_0x50ecb1){return new Promise(function(_0x505107){var _0x17a2e5=[];for(var _0x3e710f=0x0;_0x3e710f<_0x50ecb1['length'];_0x3e710f++){var _0x27c114=_0x50ecb1[_0x3e710f];_0x17a2e5['push'](parseContactItemType(_0x27c114));}Promise[_0x33c6('0x65')](_0x17a2e5)['then'](function(){var _0x5f407a={'id':_0x38e6ac['id'],'items':_0x50ecb1};return addAdditionalPhones(_0x5f407a)[_0x33c6('0x19')](function(){return addCmHopperPhones(_0x38e6ac['id']);});})[_0x33c6('0x19')](function(){_0x505107(_0x38e6ac);});});}function parseContactItemType(_0x4cfa55){return new Promise(function(_0x1d3f1b){if(_0x4cfa55[_0x33c6('0x37')]('ItemTypeId')){_0x1d3f1b(_0x4cfa55);}else{return db[_0x33c6('0x6c')]['find']({'where':{'name':_0x4cfa55['ItemType']}})['then'](function(_0x2252fd){if(_['isNil'](_0x2252fd))_0x4cfa55[_0x33c6('0x8c')]=null;else _0x4cfa55[_0x33c6('0x8c')]=_0x2252fd['id'];_0x1d3f1b(_0x4cfa55);});}});}exports[_0x33c6('0x95')]=function(_0x1d7e3a,_0x54c1bc){return db['CmContactHasItem'][_0x33c6('0x21')]({'raw':!![],'where':{'CmContactId':_0x1d7e3a[_0x33c6('0x27')]['id'],'ItemClass':_0x33c6('0x8f')},'include':[{'model':db[_0x33c6('0x6c')],'as':'ItemType'}],'order':[['OrderBy'],[db['sequelize'][_0x33c6('0x6f')](_0x33c6('0x91'))]]})[_0x33c6('0x19')](function(_0x16cea1){return _0x16cea1;})[_0x33c6('0x19')](respondWithResult(_0x54c1bc,null))[_0x33c6('0x23')](handleError(_0x54c1bc,null));};exports['duplicateAdditionalPhones']=function(_0x3afd93,_0x2da6fe){return db['CmContactHasItem'][_0x33c6('0x21')]({'raw':!![],'where':{'CmContactId':_0x3afd93['body'][_0x33c6('0x96')]}})[_0x33c6('0x19')](function(_0x54b765){var _0x323420=_[_0x33c6('0x73')](_0x54b765,function(_0x4f2f15){_0x4f2f15['CmContactId']=_0x3afd93['body'][_0x33c6('0x97')];return _0x4f2f15;});return db['CmContactHasItem'][_0x33c6('0x5d')](_0x323420,{});})[_0x33c6('0x19')](function(){return addCmHopperPhones(_0x3afd93[_0x33c6('0x39')][_0x33c6('0x97')]);})[_0x33c6('0x19')](function(){return['ok'];})[_0x33c6('0x19')](respondWithResult(_0x2da6fe,null))[_0x33c6('0x23')](handleError(_0x2da6fe,null));};exports[_0x33c6('0x98')]=function(_0x4aeef3,_0xfcdd51){var _0x2faa27=[];_0x2faa27[_0x33c6('0x60')](createCmHopperPhone(_0x4aeef3['body']['id'],_0x4aeef3[_0x33c6('0x39')][_0x33c6('0x99')]));Promise[_0x33c6('0x65')](_0x2faa27)[_0x33c6('0x19')](function(){return[0x1];})[_0x33c6('0x19')](respondWithResult(_0xfcdd51,null));};exports[_0x33c6('0x9a')]=function(_0xa455a0,_0x8c3de5){var _0x3c11a7={'raw':![],'where':{}};var _0x91b354={};var _0x1b3025={'count':0x0,'rows':[]};return db['CmContact'][_0x33c6('0x7d')]({'where':{'id':_0xa455a0[_0x33c6('0x27')]['id']}})[_0x33c6('0x19')](handleEntityNotFound(_0x8c3de5,null))['then'](function(_0x18c712){if(_0x18c712){_0x91b354['model']=_[_0x33c6('0x29')](db[_0x33c6('0x3f')][_0x33c6('0x7f')]);_0x91b354[_0x33c6('0x2d')]=_[_0x33c6('0x29')](_0xa455a0[_0x33c6('0x2d')]);_0x91b354['filters']=_['intersection'](_0x91b354[_0x33c6('0x7e')],_0x91b354['query']);_0x3c11a7['attributes']=_[_0x33c6('0x81')](_0x91b354['model'],qs[_0x33c6('0x82')](_0xa455a0[_0x33c6('0x2d')][_0x33c6('0x82')]));_0x3c11a7[_0x33c6('0x83')]=_0x3c11a7[_0x33c6('0x83')][_0x33c6('0x3a')]?_0x3c11a7[_0x33c6('0x83')]:_0x91b354[_0x33c6('0x7e')];if(!_0xa455a0['query'][_0x33c6('0x37')](_0x33c6('0x9b'))){_0x3c11a7['limit']=qs[_0x33c6('0x13')](_0xa455a0[_0x33c6('0x2d')]['limit']);_0x3c11a7[_0x33c6('0x11')]=qs[_0x33c6('0x11')](_0xa455a0['query']['offset']);}_0x3c11a7[_0x33c6('0x9c')]=qs['sort'](_0xa455a0[_0x33c6('0x2d')][_0x33c6('0x84')]);_0x3c11a7[_0x33c6('0x61')]=qs[_0x33c6('0x80')](_[_0x33c6('0x85')](_0xa455a0[_0x33c6('0x2d')],_0x91b354[_0x33c6('0x80')]));_0x3c11a7[_0x33c6('0x61')][_0x33c6('0x9d')]=_0x18c712['id'];if(_0xa455a0[_0x33c6('0x2d')][_0x33c6('0x86')]){_0x3c11a7[_0x33c6('0x61')]=_[_0x33c6('0x38')](_0x3c11a7[_0x33c6('0x61')],{'$or':_[_0x33c6('0x73')](_0x3c11a7['attributes'],function(_0x234ddc){var _0x1587ee={};_0x1587ee[_0x234ddc]={'$like':'%'+_0xa455a0['query']['filter']+'%'};return _0x1587ee;})});}_0x3c11a7=_[_0x33c6('0x38')]({},_0x3c11a7,_0xa455a0['options']);return db['CmHopper'][_0x33c6('0x14')]({'where':_0x3c11a7[_0x33c6('0x61')]})['then'](function(_0x45cca3){_0x1b3025['count']=_0x45cca3;if(_0xa455a0[_0x33c6('0x2d')][_0x33c6('0x9e')]){_0x3c11a7[_0x33c6('0x9f')]=[{'all':!![]}];}return db[_0x33c6('0x3f')][_0x33c6('0x21')](_0x3c11a7);})[_0x33c6('0x19')](function(_0xcd6e21){_0x1b3025[_0x33c6('0xa0')]=_0xcd6e21;return _0x1b3025;});}})[_0x33c6('0x19')](respondWithFilteredResult(_0x8c3de5,_0x3c11a7))[_0x33c6('0x23')](handleError(_0x8c3de5,null));};exports['getHopperHistories']=function(_0x5d05fe,_0x1c40cc){var _0x186f50={'raw':!![],'where':{}};var _0x13d50e={};var _0x27d090={'count':0x0,'rows':[]};return db['CmContact'][_0x33c6('0x7d')]({'where':{'id':_0x5d05fe[_0x33c6('0x27')]['id']}})[_0x33c6('0x19')](handleEntityNotFound(_0x1c40cc,null))[_0x33c6('0x19')](function(_0x4bb04c){if(_0x4bb04c){_0x13d50e[_0x33c6('0x7e')]=_[_0x33c6('0x29')](db[_0x33c6('0x4e')]['rawAttributes']);_0x13d50e[_0x33c6('0x2d')]=_[_0x33c6('0x29')](_0x5d05fe[_0x33c6('0x2d')]);_0x13d50e[_0x33c6('0x80')]=_[_0x33c6('0x81')](_0x13d50e['model'],_0x13d50e[_0x33c6('0x2d')]);_0x186f50['attributes']=_[_0x33c6('0x81')](_0x13d50e[_0x33c6('0x7e')],qs[_0x33c6('0x82')](_0x5d05fe[_0x33c6('0x2d')][_0x33c6('0x82')]));_0x186f50[_0x33c6('0x83')]=_0x186f50[_0x33c6('0x83')][_0x33c6('0x3a')]?_0x186f50['attributes']:_0x13d50e['model'];if(!_0x5d05fe[_0x33c6('0x2d')]['hasOwnProperty']('nolimit')){_0x186f50['limit']=qs[_0x33c6('0x13')](_0x5d05fe[_0x33c6('0x2d')]['limit']);_0x186f50[_0x33c6('0x11')]=qs['offset'](_0x5d05fe[_0x33c6('0x2d')][_0x33c6('0x11')]);}_0x186f50[_0x33c6('0x9c')]=qs[_0x33c6('0x84')](_0x5d05fe['query'][_0x33c6('0x84')]);_0x186f50[_0x33c6('0x61')]=qs[_0x33c6('0x80')](_[_0x33c6('0x85')](_0x5d05fe[_0x33c6('0x2d')],_0x13d50e[_0x33c6('0x80')]));_0x186f50['where']['ContactId']=_0x4bb04c['id'];if(_0x5d05fe[_0x33c6('0x2d')][_0x33c6('0x86')]){_0x186f50[_0x33c6('0x61')]=_[_0x33c6('0x38')](_0x186f50[_0x33c6('0x61')],{'$or':_[_0x33c6('0x73')](_0x186f50[_0x33c6('0x83')],function(_0x1e36fc){var _0x55f245={};_0x55f245[_0x1e36fc]={'$like':'%'+_0x5d05fe[_0x33c6('0x2d')][_0x33c6('0x86')]+'%'};return _0x55f245;})});}_0x186f50=_[_0x33c6('0x38')]({},_0x186f50,_0x5d05fe[_0x33c6('0x87')]);return db[_0x33c6('0x4e')][_0x33c6('0x14')]({'where':_0x186f50[_0x33c6('0x61')]})[_0x33c6('0x19')](function(_0x2e7872){_0x27d090[_0x33c6('0x14')]=_0x2e7872;if(_0x5d05fe[_0x33c6('0x2d')][_0x33c6('0x9e')]){_0x186f50['include']=[{'all':!![]}];}return db[_0x33c6('0x4e')][_0x33c6('0x21')](_0x186f50);})[_0x33c6('0x19')](function(_0x46458c){_0x27d090['rows']=_0x46458c;return _0x27d090;});}})[_0x33c6('0x19')](respondWithFilteredResult(_0x1c40cc,_0x186f50))[_0x33c6('0x23')](handleError(_0x1c40cc,null));};exports['getHopperFinals']=function(_0x2f1dba,_0x136de8){var _0x5cfdac={'raw':!![],'where':{}};var _0x966bf={};var _0xc127b0={'count':0x0,'rows':[]};return db[_0x33c6('0x25')][_0x33c6('0x7d')]({'where':{'id':_0x2f1dba['params']['id']}})['then'](handleEntityNotFound(_0x136de8,null))['then'](function(_0x794083){if(_0x794083){_0x966bf[_0x33c6('0x7e')]=_['keys'](db[_0x33c6('0xa1')][_0x33c6('0x7f')]);_0x966bf[_0x33c6('0x2d')]=_['keys'](_0x2f1dba[_0x33c6('0x2d')]);_0x966bf['filters']=_[_0x33c6('0x81')](_0x966bf[_0x33c6('0x7e')],_0x966bf[_0x33c6('0x2d')]);_0x5cfdac['attributes']=_[_0x33c6('0x81')](_0x966bf[_0x33c6('0x7e')],qs[_0x33c6('0x82')](_0x2f1dba['query'][_0x33c6('0x82')]));_0x5cfdac[_0x33c6('0x83')]=_0x5cfdac[_0x33c6('0x83')][_0x33c6('0x3a')]?_0x5cfdac[_0x33c6('0x83')]:_0x966bf[_0x33c6('0x7e')];if(!_0x2f1dba['query'][_0x33c6('0x37')](_0x33c6('0x9b'))){_0x5cfdac['limit']=qs['limit'](_0x2f1dba[_0x33c6('0x2d')][_0x33c6('0x13')]);_0x5cfdac[_0x33c6('0x11')]=qs[_0x33c6('0x11')](_0x2f1dba['query'][_0x33c6('0x11')]);}_0x5cfdac[_0x33c6('0x9c')]=qs['sort'](_0x2f1dba[_0x33c6('0x2d')]['sort']);_0x5cfdac[_0x33c6('0x61')]=qs[_0x33c6('0x80')](_[_0x33c6('0x85')](_0x2f1dba[_0x33c6('0x2d')],_0x966bf[_0x33c6('0x80')]));_0x5cfdac[_0x33c6('0x61')]['ContactId']=_0x794083['id'];if(_0x2f1dba[_0x33c6('0x2d')][_0x33c6('0x86')]){_0x5cfdac['where']=_[_0x33c6('0x38')](_0x5cfdac[_0x33c6('0x61')],{'$or':_[_0x33c6('0x73')](_0x5cfdac['attributes'],function(_0x25ab7d){var _0x3cbcf4={};_0x3cbcf4[_0x25ab7d]={'$like':'%'+_0x2f1dba[_0x33c6('0x2d')][_0x33c6('0x86')]+'%'};return _0x3cbcf4;})});}_0x5cfdac=_['merge']({},_0x5cfdac,_0x2f1dba[_0x33c6('0x87')]);return db[_0x33c6('0xa1')][_0x33c6('0x14')]({'where':_0x5cfdac[_0x33c6('0x61')]})['then'](function(_0x129b70){_0xc127b0['count']=_0x129b70;if(_0x2f1dba[_0x33c6('0x2d')][_0x33c6('0x9e')]){_0x5cfdac[_0x33c6('0x9f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x33c6('0x21')](_0x5cfdac);})[_0x33c6('0x19')](function(_0x53e14b){_0xc127b0[_0x33c6('0xa0')]=_0x53e14b;return _0xc127b0;});}})[_0x33c6('0x19')](respondWithFilteredResult(_0x136de8,_0x5cfdac))[_0x33c6('0x23')](handleError(_0x136de8,null));};exports[_0x33c6('0xa2')]=function(_0xeb3204,_0x10cdd9){var _0x15ca2a={'raw':!![],'where':{}};var _0x461896={};var _0x4b06c3={'count':0x0,'rows':[]};return db[_0x33c6('0x25')][_0x33c6('0x7d')]({'where':{'id':_0xeb3204['params']['id']}})[_0x33c6('0x19')](handleEntityNotFound(_0x10cdd9,null))['then'](function(_0x1bbdba){if(_0x1bbdba){_0x461896['model']=_[_0x33c6('0x29')](db['JscriptySessionReport'][_0x33c6('0x7f')]);_0x461896[_0x33c6('0x2d')]=_[_0x33c6('0x29')](_0xeb3204[_0x33c6('0x2d')]);_0x461896[_0x33c6('0x80')]=_['intersection'](_0x461896[_0x33c6('0x7e')],_0x461896[_0x33c6('0x2d')]);_0x15ca2a['attributes']=_['intersection'](_0x461896[_0x33c6('0x7e')],qs[_0x33c6('0x82')](_0xeb3204['query']['fields']));_0x15ca2a[_0x33c6('0x83')]=_0x15ca2a[_0x33c6('0x83')]['length']?_0x15ca2a[_0x33c6('0x83')]:_0x461896[_0x33c6('0x7e')];if(!_0xeb3204[_0x33c6('0x2d')][_0x33c6('0x37')](_0x33c6('0x9b'))){_0x15ca2a[_0x33c6('0x13')]=qs['limit'](_0xeb3204[_0x33c6('0x2d')][_0x33c6('0x13')]);_0x15ca2a[_0x33c6('0x11')]=qs[_0x33c6('0x11')](_0xeb3204[_0x33c6('0x2d')][_0x33c6('0x11')]);}_0x15ca2a['order']=qs[_0x33c6('0x84')](_0xeb3204['query'][_0x33c6('0x84')]);_0x15ca2a[_0x33c6('0x61')]=qs[_0x33c6('0x80')](_[_0x33c6('0x85')](_0xeb3204['query'],_0x461896[_0x33c6('0x80')]));_0x15ca2a[_0x33c6('0x61')][_0x33c6('0x9d')]=_0x1bbdba['id'];if(_0xeb3204[_0x33c6('0x2d')]['filter']){_0x15ca2a[_0x33c6('0x61')]=_['merge'](_0x15ca2a['where'],{'$or':_[_0x33c6('0x73')](_0x15ca2a[_0x33c6('0x83')],function(_0x11b0b8){var _0x40e0cd={};_0x40e0cd[_0x11b0b8]={'$like':'%'+_0xeb3204[_0x33c6('0x2d')][_0x33c6('0x86')]+'%'};return _0x40e0cd;})});}_0x15ca2a=_[_0x33c6('0x38')]({},_0x15ca2a,_0xeb3204[_0x33c6('0x87')]);return db[_0x33c6('0x53')][_0x33c6('0x14')]({'where':_0x15ca2a['where']})[_0x33c6('0x19')](function(_0x34dc5e){_0x4b06c3['count']=_0x34dc5e;if(_0xeb3204[_0x33c6('0x2d')][_0x33c6('0x9e')]){_0x15ca2a['include']=[{'all':!![]}];}return db[_0x33c6('0x53')][_0x33c6('0x21')](_0x15ca2a);})[_0x33c6('0x19')](function(_0x4dc593){_0x4b06c3['rows']=_0x4dc593;return _0x4b06c3;});}})[_0x33c6('0x19')](respondWithFilteredResult(_0x10cdd9,_0x15ca2a))[_0x33c6('0x23')](handleError(_0x10cdd9,null));};exports['uploadCsv']=function(_0x3b26ad,_0x298e15){try{if(!_0x3b26ad[_0x33c6('0x39')][_0x33c6('0x62')]){throw new Error(_0x33c6('0xa3'));}if(!_0x3b26ad[_0x33c6('0x39')][_0x33c6('0xa4')]){throw new Error(_0x33c6('0xa5'));}if(!_0x3b26ad[_0x33c6('0x39')][_0x33c6('0xa6')]){throw new Error(_0x33c6('0xa7'));}if(!_0x3b26ad['body'][_0x33c6('0xa8')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4672ae=_0x3b26ad['body'][_0x33c6('0xa4')][_0x33c6('0xa9')](',');var _0x13968a=_0x3b26ad[_0x33c6('0x39')][_0x33c6('0xa6')]['split'](',');if(!_0x4672ae['length']||!_0x13968a[_0x33c6('0x3a')]||_0x4672ae[_0x33c6('0x3a')]!==_0x13968a['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x3b26ad['body'][_0x33c6('0x82')]=_['zipObject'](_0x4672ae,_0x13968a);if(!_0x3b26ad[_0x33c6('0x39')][_0x33c6('0x82')]['phone']){throw new Error(_0x33c6('0xaa'));}if(!_0x3b26ad[_0x33c6('0x39')][_0x33c6('0x82')][_0x33c6('0xab')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x448fc6=path[_0x33c6('0x57')](config['root'],_0x33c6('0xac'),_0x3b26ad[_0x33c6('0xad')][_0x33c6('0xae')]);fs[_0x33c6('0xaf')](_0x448fc6,parseInt(_0x33c6('0xb0'),0x8));var _0x41b8cc=require(_0x33c6('0xb1'))[_0x33c6('0xb2')](path[_0x33c6('0x57')](__dirname,'../../components/import/cm/csv'),[_0x448fc6,_0x3b26ad[_0x33c6('0x39')]['binding_keys'],_0x3b26ad[_0x33c6('0x39')][_0x33c6('0xa6')],_0x3b26ad['body'][_0x33c6('0x62')],_0x3b26ad['body'][_0x33c6('0xb3')],_0x3b26ad[_0x33c6('0x39')][_0x33c6('0x5f')],_0x3b26ad[_0x33c6('0x39')][_0x33c6('0xa8')]]);return _0x298e15['status'](0xc8)['json']({'message':_0x33c6('0xb4'),'pid':_0x41b8cc['pid']});}catch(_0x222246){return _0x298e15[_0x33c6('0x10')](0x1f4)[_0x33c6('0xb5')](_0x222246);}};exports[_0x33c6('0xb6')]=function(_0x548a1a,_0x45c410){var _0x3819c8=fs[_0x33c6('0xb7')](_0x548a1a[_0x33c6('0xad')][_0x33c6('0x2')]);Papa[_0x33c6('0xb8')](_0x3819c8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x14958a){return _0x45c410['status'](0xc8)[_0x33c6('0x17')]({'file':_0x548a1a[_0x33c6('0xad')],'fields':_0x14958a[_0x33c6('0xb9')][_0x33c6('0x82')]});}});};exports['import']=function(_0x7fa710,_0x2b15d1){return db[_0x33c6('0xba')][_0x33c6('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x33c6('0x19')](function(_0x26803e){var _0x3631a6=![];if(!_0x7fa710[_0x33c6('0x39')]['ListId']){throw new Error(_0x33c6('0xa3'));}if(!_0x7fa710[_0x33c6('0x39')]['binding'][_0x33c6('0x7b')]){throw new Error(_0x33c6('0xaa'));}if(!_0x7fa710[_0x33c6('0x39')]['binding'][_0x33c6('0xab')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x7fa710[_0x33c6('0x39')][_0x33c6('0xa8')]){throw new Error(_0x33c6('0xbb'));}var _0x108b64=require(_0x33c6('0xb1'))[_0x33c6('0xb2')](path['join'](__dirname,_0x33c6('0xbc')),[_0x7fa710[_0x33c6('0x27')]['id'],JSON[_0x33c6('0xbd')](_0x7fa710[_0x33c6('0x39')]),JSON['stringify'](_0x26803e)]);_0x108b64['on']('message',function(){_0x3631a6=!![];return _0x2b15d1[_0x33c6('0x10')](0xc8)['json']({'message':_0x33c6('0xbe'),'pid':_0x108b64[_0x33c6('0xbf')]});});_0x108b64['on']('exit',function(_0x3c673b){if(_0x3c673b&&!_0x3631a6){return _0x2b15d1[_0x33c6('0x10')](0x1f4)['json']({'message':_0x33c6('0xc0'),'pid':_0x108b64[_0x33c6('0xbf')]});}});})['catch'](handleError(_0x2b15d1,null));};exports['importUpdates']=function(_0xd3d647,_0x8a70a4){return db[_0x33c6('0xba')][_0x33c6('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x33c6('0x19')](function(_0x59e4a1){var _0x1d34f7=![];if(!_0xd3d647[_0x33c6('0x39')][_0x33c6('0x62')]){throw new Error(_0x33c6('0xa3'));}if(!_0xd3d647[_0x33c6('0x39')][_0x33c6('0xc1')][_0x33c6('0x7b')]){throw new Error(_0x33c6('0xaa'));}if(!_0xd3d647[_0x33c6('0x39')][_0x33c6('0xc1')][_0x33c6('0xab')]){throw new Error(_0x33c6('0xc2'));}if(!_0xd3d647['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1b3618=require(_0x33c6('0xb1'))[_0x33c6('0xb2')](path[_0x33c6('0x57')](__dirname,_0x33c6('0xc3')),[_0xd3d647['params']['id'],JSON[_0x33c6('0xbd')](_0xd3d647[_0x33c6('0x39')]),JSON[_0x33c6('0xbd')](_0x59e4a1)]);_0x1b3618['on']('message',function(){_0x1d34f7=!![];return _0x8a70a4[_0x33c6('0x10')](0xc8)[_0x33c6('0x17')]({'message':_0x33c6('0xbe'),'pid':_0x1b3618[_0x33c6('0xbf')]});});_0x1b3618['on'](_0x33c6('0xc4'),function(_0x321254){if(_0x321254&&!_0x1d34f7){return _0x8a70a4[_0x33c6('0x10')](0x1f4)[_0x33c6('0x17')]({'message':_0x33c6('0xc0'),'pid':_0x1b3618[_0x33c6('0xbf')]});}});})['catch'](handleError(_0x8a70a4,null));};exports[_0x33c6('0xc5')]=function(_0x53fecc,_0x2b27cf){var _0x266392=['mail','chat',_0x33c6('0xc6'),_0x33c6('0xc7'),_0x33c6('0xc8'),_0x33c6('0xc9'),_0x33c6('0xca')];var _0x3f6579={'offset':0x0,'order':qs['sort'](_0x33c6('0xcb'))},_0x564abc={'count':0x0,'rows':[]};Promise[_0x33c6('0xcc')]()[_0x33c6('0x19')](function(){if(_0x53fecc[_0x33c6('0x2d')][_0x33c6('0xcd')]){if(!_[_0x33c6('0xce')](_0x266392,_0x53fecc[_0x33c6('0x2d')][_0x33c6('0xcd')][_0x33c6('0xcf')]())){throw new Error(_0x33c6('0xd0'));}_0x266392=[_0x53fecc['query'][_0x33c6('0xcd')][_0x33c6('0xcf')]()];}if(_0x53fecc[_0x33c6('0x2d')][_0x33c6('0xd1')]){try{var _0x4275db=JSON[_0x33c6('0xb8')](_0x53fecc[_0x33c6('0x2d')][_0x33c6('0xd1')]);if(!moment(_0x4275db[_0x33c6('0x40')])['isValid']()){throw new Error(_0x33c6('0xd2'));}if(!moment(_0x4275db['to'])[_0x33c6('0xd3')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x5b3d3b){throw new Error(_0x33c6('0xd4'));}}if(!_0x53fecc[_0x33c6('0x2d')]['hasOwnProperty']('nolimit')){_0x3f6579[_0x33c6('0x13')]=qs[_0x33c6('0x13')](_0x53fecc[_0x33c6('0x2d')]['limit']||0xa);_0x3f6579[_0x33c6('0x11')]=qs['offset'](_0x53fecc[_0x33c6('0x2d')]['offset']);}var _0x179cd6=_0x266392[_0x33c6('0x73')](function(_0xd3dfef){if(_0xd3dfef===_0x33c6('0xca')){var _0xe29d4b={'attributes':['id','uniqueid','type',_0x33c6('0xd5'),'destination',_0x33c6('0xd6'),_0x33c6('0xd7'),'endtime',_0x33c6('0xd8'),_0x33c6('0xd9'),_0x33c6('0xda'),_0x33c6('0xdb'),_0x33c6('0xdc'),_0x33c6('0xdd'),_0x33c6('0xde')],'where':{'ContactId':_0x53fecc['params']['id']},'include':[{'model':db['User'],'as':_0x33c6('0xba'),'attributes':['id',_0x33c6('0x1d'),_0x33c6('0xdf'),_0x33c6('0x31')]}],'order':[[_0x33c6('0xda'),'DESC']]};if(_0x53fecc[_0x33c6('0x2d')][_0x33c6('0xd1')]){_0xe29d4b[_0x33c6('0x61')][_0x33c6('0xda')]={'$gte':_0x4275db[_0x33c6('0x40')],'$lte':_0x4275db['to']};}return db[_0x33c6('0x50')][_0x33c6('0xe0')](_0xe29d4b)[_0x33c6('0x19')](function(_0x363025){_0x564abc[_0x33c6('0x14')]+=_0x363025[_0x33c6('0x14')];return _[_0x33c6('0x73')](_0x363025[_0x33c6('0xa0')],function(_0x1d1621){var _0x4b4265=_0x1d1621[_0x33c6('0x3b')]({'plain':!![]});_0x4b4265[_0x33c6('0xcd')]=_0xd3dfef;if(_0x4b4265['User']){_0x4b4265[_0x33c6('0xba')]={'id':_0x4b4265[_0x33c6('0xba')]['id'],'name':_0x4b4265[_0x33c6('0xba')]['name'],'fullname':_0x4b4265[_0x33c6('0xba')][_0x33c6('0xdf')],'alias':_0x4b4265[_0x33c6('0xba')]['alias']};}return _0x4b4265;});});}else{var _0x2511a2=_['startCase'](_0xd3dfef)+(_0xd3dfef===_0x33c6('0xe1')?_0x33c6('0xe2'):_0x33c6('0xe3'));var _0x5e71d6={'attributes':['id',_0x33c6('0xe4'),_0x33c6('0xe5'),_0x33c6('0xda'),'note','disposition','secondDisposition',_0x33c6('0xe6'),_0x33c6('0xde'),_0x2511a2+'Id'],'where':{'ContactId':_0x53fecc[_0x33c6('0x27')]['id']},'include':[{'model':db[_0x2511a2],'as':_0x33c6('0xe3'),'attributes':['id',_0x33c6('0x1d'),_0x33c6('0xe7')]},{'model':db[_0x33c6('0xba')],'as':'Owner','attributes':['id',_0x33c6('0x1d'),'fullname']},{'model':db[_0x33c6('0x67')],'as':_0x33c6('0xe8'),'attributes':['id',_0x33c6('0x1d'),_0x33c6('0x68')],'through':{'attributes':[]}}],'order':[[_0x33c6('0xda'),_0x33c6('0xe9')]]};if(_0x53fecc[_0x33c6('0x2d')][_0x33c6('0xd1')]){_0x5e71d6['where']['createdAt']={'$gte':_0x4275db['from'],'$lte':_0x4275db['to']};}switch(_0xd3dfef){case _0x33c6('0xe1'):_0x5e71d6[_0x33c6('0x83')]['push'](_0x33c6('0xea'),_0x33c6('0xeb'),_0x33c6('0xec'),_0x33c6('0xed'),_0x33c6('0xee'),_0x33c6('0xef'),_0x33c6('0xf0'),_0x33c6('0xf1'),_0x33c6('0xf2'));break;case _0x33c6('0xf3'):_0x5e71d6[_0x33c6('0x83')][_0x33c6('0x60')]('subject','substatus');break;case _0x33c6('0xc7'):_0x5e71d6['attributes'][_0x33c6('0x60')](_0x33c6('0xf4'),_0x33c6('0xf5'));break;}return db[_[_0x33c6('0xf6')](_0xd3dfef)+_0x33c6('0xf7')]['findAndCountAll'](_0x5e71d6)[_0x33c6('0x19')](function(_0x109c65){_0x564abc[_0x33c6('0x14')]+=_0x109c65[_0x33c6('0x14')];return _[_0x33c6('0x73')](_0x109c65[_0x33c6('0xa0')],function(_0x51991e){var _0x5712a4=_0x51991e[_0x33c6('0x3b')]({'plain':!![]});_0x5712a4[_0x33c6('0xcd')]=_0xd3dfef;if(_0x5712a4[_0x33c6('0xf8')]){_0x5712a4[_0x33c6('0xf8')]={'id':_0x5712a4[_0x33c6('0xf8')]['id'],'name':_0x5712a4[_0x33c6('0xf8')]['name'],'fullname':_0x5712a4[_0x33c6('0xf8')][_0x33c6('0xdf')]};}return _0x5712a4;});});}});return Promise['all'](_0x179cd6);})['then'](function(_0x4bea51){return _(_0x4bea51)[_0x33c6('0xf9')]()[_0x33c6('0xfa')](_0x33c6('0xda'))[_0x33c6('0xfb')]()['value']();})[_0x33c6('0x19')](function(_0x1f97c2){_0x564abc[_0x33c6('0xa0')]=_0x3f6579[_0x33c6('0x13')]?_0x1f97c2[_0x33c6('0xfc')](_0x3f6579['offset'],_0x3f6579[_0x33c6('0x11')]+_0x3f6579[_0x33c6('0x13')]):_0x1f97c2;return _0x564abc;})[_0x33c6('0x19')](respondWithFilteredResult(_0x2b27cf,_0x3f6579))[_0x33c6('0x23')](handleError(_0x2b27cf,null));}; \ No newline at end of file +var _0x7b06=['ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','defaults','redis','socket.io-emitter','register','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','status','end','sendStatus','name','send','index','getOptions','catch','find','params','describe','tags','keys','length','cf_','displayName','query','analytics','CmCustomField','findAll','columnName','alias','custom','type','values','forEach','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','CmContact','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','isNil','timezones','additionalPhones','each','duplicates','where','$or','push','ListId','spread','hasOwnProperty','all','show','Tag','color','tag','Phones','ContactItemType','literal','Phones.OrderBy','$and','omit','format','dialTimezone','utcOffset','pickBy','map','cf_%d','isEmpty','setFields','toParam','sequelize','text','phone','getTags','findOne','filters','intersection','attributes','model','fields','order','sort','filter','merge','options','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','CmHopper','ItemType','`ItemType`.OrderBy','item','ItemType.OrderBy','bulkCreate','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','pick','ContactId','includeAll','rows','include','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','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\x20firstName\x20column\x20specified','server/files/tmp','file','chmodSync','0777','../../components/import/cm/csv','binding_keys','pid','meta','import','User','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','firstName','child_process','fork','getJourney','mail','chat','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','note','createdAt','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','Owner','Tags','browserName','deviceModel','osName','ratingMessage'];(function(_0x4251fc,_0x45a6be){var _0x43f5b0=function(_0x783a5){while(--_0x783a5){_0x4251fc['push'](_0x4251fc['shift']());}};_0x43f5b0(++_0x45a6be);}(_0x7b06,0x106));var _0x67b0=function(_0x4afdce,_0x2d1a6a){_0x4afdce=_0x4afdce-0x0;var _0x5a163f=_0x7b06[_0x4afdce];return _0x5a163f;};'use strict';var moment=require(_0x67b0('0x0'));var BPromise=require('bluebird');var util=require(_0x67b0('0x1'));var path=require(_0x67b0('0x2'));var fs=require('fs');var _=require(_0x67b0('0x3'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x67b0('0x4'));var contacts=require(_0x67b0('0x5'));var qs=require(_0x67b0('0x6'));var logger=require(_0x67b0('0x7'))(_0x67b0('0x8'));var config=require(_0x67b0('0x9'));var shared=require(_0x67b0('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x67b0('0xb')](config[_0x67b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x67b0('0xd'))(new Redis(config[_0x67b0('0xc')]));require('./cmContact.socket')[_0x67b0('0xe')](socket);function respondWithResult(_0x458539,_0x1441ab){_0x1441ab=_0x1441ab||0xc8;return function(_0x56245c){if(_0x56245c){return _0x458539['status'](_0x1441ab)[_0x67b0('0xf')](_0x56245c);}};}function respondWithFilteredResult(_0x1749a1,_0x2113f4){return function(_0xe38ac8){if(_0xe38ac8){var _0x35cab7=typeof _0x2113f4['offset']===_0x67b0('0x10')&&typeof _0x2113f4[_0x67b0('0x11')]===_0x67b0('0x10');var _0x4121dc=_0xe38ac8[_0x67b0('0x12')];var _0x1e4903=_0x35cab7?0x0:_0x2113f4[_0x67b0('0x13')];var _0x38ca68=_0x35cab7?_0xe38ac8[_0x67b0('0x12')]:_0x2113f4[_0x67b0('0x13')]+_0x2113f4[_0x67b0('0x11')];var _0x589786;if(_0x38ca68>=_0x4121dc){_0x38ca68=_0x4121dc;_0x589786=0xc8;}else{_0x589786=0xce;}_0x1749a1['status'](_0x589786);return _0x1749a1[_0x67b0('0x14')](_0x67b0('0x15'),_0x1e4903+'-'+_0x38ca68+'/'+_0x4121dc)['json'](_0xe38ac8);}return null;};}function saveUpdates(_0x17962b){return function(_0x3d67f6){if(_0x3d67f6){return _0x3d67f6[_0x67b0('0x16')](_0x17962b)[_0x67b0('0x17')](function(_0x26e1b5){return _0x26e1b5;});}return null;};}function removeEntity(_0x51b7c3){return function(_0x55ef96){if(_0x55ef96){return _0x55ef96[_0x67b0('0x18')]()[_0x67b0('0x17')](function(){_0x51b7c3[_0x67b0('0x19')](0xcc)[_0x67b0('0x1a')]();});}};}function handleEntityNotFound(_0x217046){return function(_0x333dfa){if(!_0x333dfa){_0x217046[_0x67b0('0x1b')](0x194);}return _0x333dfa;};}function handleError(_0x1fc99b,_0x293197){_0x293197=_0x293197||0x1f4;return function(_0xac55e2){logger['error'](_0xac55e2['stack']);if(_0xac55e2[_0x67b0('0x1c')]){delete _0xac55e2[_0x67b0('0x1c')];}_0x1fc99b['status'](_0x293197)[_0x67b0('0x1d')](_0xac55e2);};}exports[_0x67b0('0x1e')]=function(_0x4582dd,_0x46d678){var _0x2f7e68={};return contacts['describe']()['then'](function(_0x24c5d8){_0x2f7e68=qs[_0x67b0('0x1f')](_0x24c5d8,_0x4582dd);return contacts['findAll'](_0x4582dd['query'],_0x4582dd['user'],_0x2f7e68,_0x24c5d8);})[_0x67b0('0x17')](respondWithFilteredResult(_0x46d678,_0x2f7e68))[_0x67b0('0x20')](handleError(_0x46d678,null));};exports[_0x67b0('0x18')]=function(_0x2f66f6,_0x4772e9){return db['CmContact'][_0x67b0('0x21')]({'where':{'id':_0x2f66f6[_0x67b0('0x22')]['id']}})[_0x67b0('0x17')](handleEntityNotFound(_0x4772e9,null))[_0x67b0('0x17')](removeEntity(_0x4772e9,null))[_0x67b0('0x20')](handleError(_0x4772e9,null));};exports[_0x67b0('0x23')]=function(_0x1b6c97,_0x96bd71){return db['CmContact'][_0x67b0('0x23')]()[_0x67b0('0x17')](function(_0x6427a4){delete _0x6427a4[_0x67b0('0x24')];for(var _0x4ce243=0x0;_0x4ce2430x0){return new Promise(function(_0xc0f918){var _0x2b59b4=[];for(var _0x4fc352=0x0;_0x4fc352<_0x5063e8[_0x67b0('0x26')];_0x4fc352++){_0x2b59b4['push'](insertAdditionalPhones(_0x5063e8[_0x4fc352]['contact'],_0x5063e8[_0x4fc352]['additionalPhones']));}Promise[_0x67b0('0x5d')](_0x2b59b4)[_0x67b0('0x17')](function(){_0xc0f918(0x1);});})['then'](function(){return{'success':_0x5b0e6f,'failure':_0x5db313,'duplicates':_0xde6266};});}else{return{'success':_0x5b0e6f,'failure':_0x5db313,'duplicates':_0xde6266};}}})['then'](respondWithResult(_0x2b59a1,0xc9))['catch'](handleError(_0x2b59a1,null));};exports[_0x67b0('0x5e')]=function(_0x39701c,_0x2ff9c0){var _0x272a3c;return db[_0x67b0('0x3e')][_0x67b0('0x23')]()[_0x67b0('0x17')](function(_0x199857){return db['CmContact'][_0x67b0('0x21')]({'where':{'id':_0x39701c[_0x67b0('0x22')]['id']},'include':[{'model':db[_0x67b0('0x5f')],'as':'Tags','attributes':['id',_0x67b0('0x1c'),_0x67b0('0x60')],'required':_0x39701c['query'][_0x67b0('0x61')]?!![]:![]},{'model':db[_0x67b0('0x49')],'as':_0x67b0('0x62'),'where':{'CmContactId':_0x39701c[_0x67b0('0x22')]['id']},'required':![],'include':[{'model':db[_0x67b0('0x63')],'as':'ItemType'}]}],'order':[db['sequelize'][_0x67b0('0x64')](_0x67b0('0x65'))],'attributes':_[_0x67b0('0x25')](_0x199857)});})[_0x67b0('0x17')](function(_0x5dd6f6){if(!_['isNil'](_0x5dd6f6)){_0x272a3c=_0x5dd6f6[_0x67b0('0x35')]({'plain':!![]});var _0x18fa1f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5dd6f6&&_0x5dd6f6['ListId']){if(_0x5dd6f6['ListId']){_0x18fa1f[_0x67b0('0x57')][_0x67b0('0x66')]['push']({'ListId':{'$ne':_0x5dd6f6[_0x67b0('0x5a')]}});}}return db['CmCustomField'][_0x67b0('0x2c')](_0x18fa1f);}})[_0x67b0('0x17')](function(_0x535d24){if(!_[_0x67b0('0x52')](_0x535d24)){return _[_0x67b0('0x67')](_0x272a3c,_['map'](_0x535d24,function(_0x1e9b86){return util[_0x67b0('0x68')]('cf_%d',_0x1e9b86['id']);}));}})[_0x67b0('0x17')](handleEntityNotFound(_0x2ff9c0,null))[_0x67b0('0x17')](respondWithResult(_0x2ff9c0,null))[_0x67b0('0x20')](handleError(_0x2ff9c0,null));};exports[_0x67b0('0x16')]=function(_0x48ff25,_0xca7818){var _0xd5a0c6;if(_0x48ff25[_0x67b0('0x33')]['id']){delete _0x48ff25[_0x67b0('0x33')]['id'];}if(!_[_0x67b0('0x52')](_0x48ff25['body'][_0x67b0('0x69')])){var _0x1793c4=_0x48ff25['body'][_0x67b0('0x69')];if(!_['isNil'](shared['timezones'][_0x1793c4]))_0x48ff25[_0x67b0('0x33')][_0x67b0('0x6a')]=shared['timezones'][_0x1793c4][_0x67b0('0x6a')];}return db[_0x67b0('0x3e')]['find']({'where':{'id':_0x48ff25['params']['id']}})[_0x67b0('0x17')](handleEntityNotFound(_0xca7818,null))[_0x67b0('0x17')](saveUpdates(_0x48ff25[_0x67b0('0x33')],null))[_0x67b0('0x17')](function(_0x55d3f1){_0xd5a0c6=_0x55d3f1;var _0xf42e99={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x55d3f1&&_0x55d3f1[_0x67b0('0x5a')]){if(_0x55d3f1[_0x67b0('0x5a')]){_0xf42e99[_0x67b0('0x57')][_0x67b0('0x66')][_0x67b0('0x59')]({'ListId':{'$ne':_0x55d3f1[_0x67b0('0x5a')]}});}}return db[_0x67b0('0x2b')][_0x67b0('0x2c')](_0xf42e99);})[_0x67b0('0x17')](function(_0x252685){if(_0x252685){return _[_0x67b0('0x67')](_[_0x67b0('0x6b')](_0x48ff25[_0x67b0('0x33')],function(_0x3f01f2,_0x3df275){return _['startsWith'](_0x3df275,'cf_');}),_[_0x67b0('0x6c')](_0x252685,function(_0x5b30a5){return util[_0x67b0('0x68')](_0x67b0('0x6d'),_0x5b30a5['id']);}));}})['then'](function(_0x1ebbc9){if(_0x1ebbc9&&!_[_0x67b0('0x6e')](_0x1ebbc9)){var _0x5e300d=squel[_0x67b0('0x16')]()['table']('cm_contacts')[_0x67b0('0x6f')](_0x1ebbc9)[_0x67b0('0x57')]('id\x20=\x20?',_0x48ff25['params']['id'])[_0x67b0('0x70')]();return db[_0x67b0('0x71')][_0x67b0('0x29')](_0x5e300d[_0x67b0('0x72')],{'replacements':_0x5e300d[_0x67b0('0x31')]});}})[_0x67b0('0x17')](function(){if(_0x48ff25[_0x67b0('0x33')][_0x67b0('0x73')]&&_0xd5a0c6){return db['CmHopper'][_0x67b0('0x16')]({'phone':_0x48ff25['body'][_0x67b0('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0xd5a0c6['id']}});}})[_0x67b0('0x17')](function(){return _0xd5a0c6;})[_0x67b0('0x17')](respondWithResult(_0xca7818,null))['catch'](handleError(_0xca7818,null));};exports[_0x67b0('0x74')]=function(_0x553a60,_0x28ffec){var _0x4e14ed={};var _0x3bef4e={};var _0x51f7d0;var _0x5e8fb1;return db[_0x67b0('0x3e')][_0x67b0('0x75')]({'where':{'id':_0x553a60[_0x67b0('0x22')]['id']}})['then'](handleEntityNotFound(_0x28ffec,null))['then'](function(_0x2ef0dc){if(_0x2ef0dc){_0x51f7d0=_0x2ef0dc;_0x3bef4e['model']=_[_0x67b0('0x25')](db['Tag']['rawAttributes']);_0x3bef4e[_0x67b0('0x29')]=_[_0x67b0('0x25')](_0x553a60[_0x67b0('0x29')]);_0x3bef4e[_0x67b0('0x76')]=_[_0x67b0('0x77')](_0x3bef4e['model'],_0x3bef4e[_0x67b0('0x29')]);_0x4e14ed[_0x67b0('0x78')]=_[_0x67b0('0x77')](_0x3bef4e[_0x67b0('0x79')],qs[_0x67b0('0x7a')](_0x553a60[_0x67b0('0x29')][_0x67b0('0x7a')]));_0x4e14ed[_0x67b0('0x78')]=_0x4e14ed[_0x67b0('0x78')][_0x67b0('0x26')]?_0x4e14ed['attributes']:_0x3bef4e[_0x67b0('0x79')];_0x4e14ed[_0x67b0('0x7b')]=qs[_0x67b0('0x7c')](_0x553a60[_0x67b0('0x29')]['sort']);_0x4e14ed[_0x67b0('0x57')]=qs[_0x67b0('0x76')](_['pick'](_0x553a60['query'],_0x3bef4e[_0x67b0('0x76')]));if(_0x553a60['query'][_0x67b0('0x7d')]){_0x4e14ed[_0x67b0('0x57')]=_[_0x67b0('0x7e')](_0x4e14ed[_0x67b0('0x57')],{'$or':_[_0x67b0('0x6c')](_0x4e14ed[_0x67b0('0x78')],function(_0x2a4635){var _0x137681={};_0x137681[_0x2a4635]={'$like':'%'+_0x553a60[_0x67b0('0x29')]['filter']+'%'};return _0x137681;})});}_0x4e14ed=_['merge']({},_0x4e14ed,_0x553a60[_0x67b0('0x7f')]);return _0x51f7d0['getTags'](_0x4e14ed);}})[_0x67b0('0x17')](function(_0x39e8bf){if(_0x39e8bf){_0x5e8fb1=_0x39e8bf[_0x67b0('0x26')];if(!_0x553a60[_0x67b0('0x29')][_0x67b0('0x5c')]('nolimit')){_0x4e14ed['limit']=qs['limit'](_0x553a60['query'][_0x67b0('0x11')]);_0x4e14ed[_0x67b0('0x13')]=qs[_0x67b0('0x13')](_0x553a60[_0x67b0('0x29')]['offset']);}return _0x51f7d0['getTags'](_0x4e14ed);}})[_0x67b0('0x17')](function(_0x35fb80){if(_0x35fb80){return _0x35fb80?{'count':_0x5e8fb1,'rows':_0x35fb80}:null;}})[_0x67b0('0x17')](respondWithResult(_0x28ffec,null))[_0x67b0('0x20')](handleError(_0x28ffec,null));};exports[_0x67b0('0x80')]=function(_0x13f625,_0x2fad23){if(_0x13f625[_0x67b0('0x33')]['id']){delete _0x13f625[_0x67b0('0x33')]['id'];}return db[_0x67b0('0x3e')][_0x67b0('0x75')]({'where':{'id':_0x13f625[_0x67b0('0x22')]['id']}})['then'](handleEntityNotFound(_0x2fad23,null))[_0x67b0('0x17')](function(_0x2fbd37){if(_0x2fbd37){return _0x2fbd37[_0x67b0('0x80')](_0x13f625[_0x67b0('0x33')]['ids']||[]);}return null;})[_0x67b0('0x17')](respondWithResult(_0x2fad23,null))[_0x67b0('0x20')](handleError(_0x2fad23,null));};exports[_0x67b0('0x81')]=function(_0x129e57,_0x25196b){var _0x5adaf7=[];_0x5adaf7[_0x67b0('0x59')](addAdditionalPhones(_0x129e57[_0x67b0('0x33')]));Promise['all'](_0x5adaf7)[_0x67b0('0x17')](function(){_0x5adaf7=[];_0x5adaf7[_0x67b0('0x59')](deleteCmHopperPhones(_0x129e57[_0x67b0('0x33')]['id']));_0x5adaf7[_0x67b0('0x59')](addCmHopperPhones(_0x129e57['body']['id']));Promise[_0x67b0('0x5d')](_0x5adaf7)[_0x67b0('0x17')](function(){return[0x1];})[_0x67b0('0x17')](respondWithResult(_0x25196b,null));});};function addAdditionalPhones(_0x3ba201){var _0x3d32bc;return new Promise(function(_0x5e561d){return db[_0x67b0('0x49')]['destroy']({'where':{'CmContactId':_0x3ba201['id']}})[_0x67b0('0x17')](function(){db['ContactItemType'][_0x67b0('0x2c')]({'raw':!![],'attributes':['id',_0x67b0('0x82')]})[_0x67b0('0x17')](function(_0x56a7cb){var _0x2406af=[];for(var _0x1d0c4b=0x0;_0x1d0c4b<_0x3ba201[_0x67b0('0x83')]['length'];_0x1d0c4b++){var _0x55b67a=_0x3ba201[_0x67b0('0x84')]?_[_0x67b0('0x52')](_0x3ba201[_0x67b0('0x84')][_0x1d0c4b])?'':_0x3ba201[_0x67b0('0x84')][_0x1d0c4b]:_0x3ba201[_0x67b0('0x83')][_0x1d0c4b]['ItemTypeId']?_0x3ba201[_0x67b0('0x83')][_0x1d0c4b][_0x67b0('0x85')]:'';var _0x46275f=_['isNil'](_0x3ba201['items'][_0x1d0c4b][_0x67b0('0x86')])?'':_0x3ba201[_0x67b0('0x83')][_0x1d0c4b]['description'];var _0x13fcf2=_0x55b67a+':'+_0x3ba201['items'][_0x1d0c4b][_0x67b0('0x73')]+'§'+_0x46275f;if(_[_0x67b0('0x52')](_0x3d32bc))_0x3d32bc=_0x13fcf2;else _0x3d32bc+=';'+_0x13fcf2;var _0x27e2d6=null;var _0x12a137=null;if(_0x3ba201[_0x67b0('0x84')]){if(!_['isNil'](_0x3ba201[_0x67b0('0x84')][_0x1d0c4b])){_0x12a137=_[_0x67b0('0x21')](_0x56a7cb,function(_0x412f2c){return _0x412f2c['id']===_0x3ba201[_0x67b0('0x84')][_0x1d0c4b];});if(!_['isNil'](_0x12a137)){_0x27e2d6=_0x12a137['OrderBy'];}}}else{if(!_[_0x67b0('0x52')](_0x3ba201['items'][_0x1d0c4b])){_0x12a137=_[_0x67b0('0x21')](_0x56a7cb,function(_0x3cecf4){return _0x3cecf4['id']===_0x3ba201['items'][_0x1d0c4b][_0x67b0('0x85')];});if(!_[_0x67b0('0x52')](_0x12a137)){_0x27e2d6=_0x1d0c4b;}}}if(_[_0x67b0('0x52')](_0x27e2d6)){_0x27e2d6=0x64;}_0x2406af[_0x67b0('0x59')](addAdditionalPhone(_0x3ba201['id'],_0x3ba201['items'][_0x1d0c4b][_0x67b0('0x73')],_0x3ba201[_0x67b0('0x84')]?_[_0x67b0('0x52')](_0x3ba201['item_types'][_0x1d0c4b])?null:_0x3ba201[_0x67b0('0x84')][_0x1d0c4b]:_0x3ba201[_0x67b0('0x83')][_0x1d0c4b][_0x67b0('0x85')]?_0x3ba201[_0x67b0('0x83')][_0x1d0c4b]['ItemTypeId']:null,_0x27e2d6,_0x46275f));}Promise['all'](_0x2406af)[_0x67b0('0x17')](function(){db[_0x67b0('0x3e')][_0x67b0('0x16')]({'AdditionalPhones':_0x3d32bc},{'where':{'id':_0x3ba201['id']}})['then'](function(){_0x5e561d(0x1);});});});});});}function addAdditionalPhone(_0x42ce26,_0x1f7426,_0x38c8ac,_0x2e4ec1,_0x5aab8d){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x42ce26,'item':_0x1f7426}})[_0x67b0('0x17')](function(_0x296c23){if(_0x296c23)logger['info'](_0x67b0('0x87'),_0x296c23);else{db['CmContactHasItem'][_0x67b0('0x3f')]({'CmContactId':_0x42ce26,'item':_0x1f7426,'ItemTypeId':_0x38c8ac,'OrderBy':_0x2e4ec1,'ItemClass':_0x67b0('0x88'),'description':_0x5aab8d});}});}function deleteCmHopperPhones(_0x67dcbd){return new Promise(function(_0x19736f){return db['CmHopper'][_0x67b0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x67dcbd}})[_0x67b0('0x17')](function(_0x2759f6){db[_0x67b0('0x89')][_0x67b0('0x18')]({'where':{'CmHopperId':{'$in':_[_0x67b0('0x6c')](_0x2759f6,'id')}}});})[_0x67b0('0x17')](function(){_0x19736f(0x1);});});}function addCmHopperPhones(_0xfe5add){return new Promise(function(_0x52a8d5){return db[_0x67b0('0x8a')][_0x67b0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xfe5add}})[_0x67b0('0x17')](function(_0xb52af9){var _0x135c5b=[];_['map'](_0xb52af9,function(_0x370c36){_0x135c5b[_0x67b0('0x59')](createCmHopperPhone(_0xfe5add,_0x370c36['id']));});Promise[_0x67b0('0x5d')](_0x135c5b)[_0x67b0('0x17')](function(){_0x52a8d5(0x1);});});});}function createCmHopperPhone(_0x46c558,_0x17cf1c){return new Promise(function(_0x1e1d6b){db[_0x67b0('0x49')][_0x67b0('0x2c')]({'raw':!![],'attributes':['item',_0x67b0('0x82')],'where':{'CmContactId':_0x46c558,'ItemClass':_0x67b0('0x88')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x67b0('0x8b')}],'order':[_0x67b0('0x82'),db[_0x67b0('0x71')][_0x67b0('0x64')](_0x67b0('0x8c'))]})[_0x67b0('0x17')](function(_0x4120fd){var _0x568d20=0x1;var _0x14fba5=_[_0x67b0('0x6c')](_0x4120fd,function(_0x2e297f){_0x2e297f['CmHopperId']=_0x17cf1c;_0x2e297f[_0x67b0('0x73')]=_0x2e297f[_0x67b0('0x8d')];_0x2e297f[_0x67b0('0x82')]=_0x568d20;delete _0x2e297f[_0x67b0('0x8e')];_0x568d20=_0x568d20+0x1;return _0x2e297f;});return db[_0x67b0('0x89')][_0x67b0('0x8f')](_0x14fba5,{});})[_0x67b0('0x17')](function(){_0x1e1d6b(0x1);});});}function insertAdditionalPhones(_0x2ad70b,_0x5a5d1b){return new Promise(function(_0x2805f4){var _0x28f1ce=[];for(var _0x104a26=0x0;_0x104a26<_0x5a5d1b[_0x67b0('0x26')];_0x104a26++){var _0x33964a=_0x5a5d1b[_0x104a26];_0x28f1ce[_0x67b0('0x59')](parseContactItemType(_0x33964a));}Promise[_0x67b0('0x5d')](_0x28f1ce)[_0x67b0('0x17')](function(){var _0x260813={'id':_0x2ad70b['id'],'items':_0x5a5d1b};return addAdditionalPhones(_0x260813)[_0x67b0('0x17')](function(){return addCmHopperPhones(_0x2ad70b['id']);});})[_0x67b0('0x17')](function(){_0x2805f4(_0x2ad70b);});});}function parseContactItemType(_0x2d366c){return new Promise(function(_0x3e7035){if(_0x2d366c[_0x67b0('0x5c')](_0x67b0('0x85'))){_0x3e7035(_0x2d366c);}else{return db[_0x67b0('0x63')][_0x67b0('0x21')]({'where':{'name':_0x2d366c['ItemType']}})['then'](function(_0x2be753){if(_[_0x67b0('0x52')](_0x2be753))_0x2d366c[_0x67b0('0x85')]=null;else _0x2d366c[_0x67b0('0x85')]=_0x2be753['id'];_0x3e7035(_0x2d366c);});}});}exports[_0x67b0('0x90')]=function(_0x1c1569,_0x57a04f){return db[_0x67b0('0x49')][_0x67b0('0x2c')]({'raw':!![],'where':{'CmContactId':_0x1c1569[_0x67b0('0x22')]['id'],'ItemClass':_0x67b0('0x88')},'include':[{'model':db[_0x67b0('0x63')],'as':_0x67b0('0x8b')}],'order':[['OrderBy'],[db[_0x67b0('0x71')][_0x67b0('0x64')]('`ItemType`.OrderBy')]]})[_0x67b0('0x17')](function(_0x2fb9a0){return _0x2fb9a0;})[_0x67b0('0x17')](respondWithResult(_0x57a04f,null))[_0x67b0('0x20')](handleError(_0x57a04f,null));};exports['duplicateAdditionalPhones']=function(_0x1bfa2d,_0x7e7b7f){return db[_0x67b0('0x49')]['findAll']({'raw':!![],'where':{'CmContactId':_0x1bfa2d[_0x67b0('0x33')][_0x67b0('0x91')]}})[_0x67b0('0x17')](function(_0x277492){var _0x364e16=_[_0x67b0('0x6c')](_0x277492,function(_0x476a4e){_0x476a4e[_0x67b0('0x92')]=_0x1bfa2d[_0x67b0('0x33')][_0x67b0('0x93')];return _0x476a4e;});return db[_0x67b0('0x49')][_0x67b0('0x8f')](_0x364e16,{});})['then'](function(){return addCmHopperPhones(_0x1bfa2d[_0x67b0('0x33')][_0x67b0('0x93')]);})[_0x67b0('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x7e7b7f,null))[_0x67b0('0x20')](handleError(_0x7e7b7f,null));};exports[_0x67b0('0x94')]=function(_0x630933,_0x1d2227){var _0xf23972=[];_0xf23972[_0x67b0('0x59')](createCmHopperPhone(_0x630933['body']['id'],_0x630933['body'][_0x67b0('0x95')]));Promise['all'](_0xf23972)[_0x67b0('0x17')](function(){return[0x1];})[_0x67b0('0x17')](respondWithResult(_0x1d2227,null));};exports[_0x67b0('0x96')]=function(_0xb51ae5,_0x40ce30){var _0x557e32={'raw':![],'where':{}};var _0xeef656={};var _0x6fba86={'count':0x0,'rows':[]};return db['CmContact'][_0x67b0('0x75')]({'where':{'id':_0xb51ae5[_0x67b0('0x22')]['id']}})[_0x67b0('0x17')](handleEntityNotFound(_0x40ce30,null))['then'](function(_0x4281a0){if(_0x4281a0){_0xeef656[_0x67b0('0x79')]=_['keys'](db[_0x67b0('0x8a')]['rawAttributes']);_0xeef656[_0x67b0('0x29')]=_[_0x67b0('0x25')](_0xb51ae5[_0x67b0('0x29')]);_0xeef656[_0x67b0('0x76')]=_['intersection'](_0xeef656[_0x67b0('0x79')],_0xeef656['query']);_0x557e32[_0x67b0('0x78')]=_[_0x67b0('0x77')](_0xeef656[_0x67b0('0x79')],qs[_0x67b0('0x7a')](_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x7a')]));_0x557e32[_0x67b0('0x78')]=_0x557e32[_0x67b0('0x78')][_0x67b0('0x26')]?_0x557e32[_0x67b0('0x78')]:_0xeef656[_0x67b0('0x79')];if(!_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x5c')](_0x67b0('0x97'))){_0x557e32['limit']=qs[_0x67b0('0x11')](_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x11')]);_0x557e32[_0x67b0('0x13')]=qs[_0x67b0('0x13')](_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x13')]);}_0x557e32['order']=qs[_0x67b0('0x7c')](_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x7c')]);_0x557e32[_0x67b0('0x57')]=qs[_0x67b0('0x76')](_[_0x67b0('0x98')](_0xb51ae5[_0x67b0('0x29')],_0xeef656[_0x67b0('0x76')]));_0x557e32[_0x67b0('0x57')][_0x67b0('0x99')]=_0x4281a0['id'];if(_0xb51ae5['query'][_0x67b0('0x7d')]){_0x557e32['where']=_['merge'](_0x557e32[_0x67b0('0x57')],{'$or':_[_0x67b0('0x6c')](_0x557e32[_0x67b0('0x78')],function(_0xdc1bcf){var _0x122567={};_0x122567[_0xdc1bcf]={'$like':'%'+_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x7d')]+'%'};return _0x122567;})});}_0x557e32=_['merge']({},_0x557e32,_0xb51ae5[_0x67b0('0x7f')]);return db[_0x67b0('0x8a')][_0x67b0('0x12')]({'where':_0x557e32[_0x67b0('0x57')]})[_0x67b0('0x17')](function(_0x3d904e){_0x6fba86['count']=_0x3d904e;if(_0xb51ae5[_0x67b0('0x29')][_0x67b0('0x9a')]){_0x557e32['include']=[{'all':!![]}];}return db['CmHopper'][_0x67b0('0x2c')](_0x557e32);})[_0x67b0('0x17')](function(_0x2230a9){_0x6fba86[_0x67b0('0x9b')]=_0x2230a9;return _0x6fba86;});}})[_0x67b0('0x17')](respondWithFilteredResult(_0x40ce30,_0x557e32))[_0x67b0('0x20')](handleError(_0x40ce30,null));};exports['getHopperHistories']=function(_0xfce4c,_0x27a8c3){var _0x5a66c1={'raw':!![],'where':{}};var _0x3c04d9={};var _0x2f98e6={'count':0x0,'rows':[]};return db[_0x67b0('0x3e')][_0x67b0('0x75')]({'where':{'id':_0xfce4c[_0x67b0('0x22')]['id']}})[_0x67b0('0x17')](handleEntityNotFound(_0x27a8c3,null))[_0x67b0('0x17')](function(_0x1072f9){if(_0x1072f9){_0x3c04d9['model']=_[_0x67b0('0x25')](db[_0x67b0('0x4a')]['rawAttributes']);_0x3c04d9['query']=_['keys'](_0xfce4c[_0x67b0('0x29')]);_0x3c04d9[_0x67b0('0x76')]=_[_0x67b0('0x77')](_0x3c04d9[_0x67b0('0x79')],_0x3c04d9[_0x67b0('0x29')]);_0x5a66c1[_0x67b0('0x78')]=_[_0x67b0('0x77')](_0x3c04d9['model'],qs[_0x67b0('0x7a')](_0xfce4c['query'][_0x67b0('0x7a')]));_0x5a66c1[_0x67b0('0x78')]=_0x5a66c1[_0x67b0('0x78')]['length']?_0x5a66c1[_0x67b0('0x78')]:_0x3c04d9[_0x67b0('0x79')];if(!_0xfce4c[_0x67b0('0x29')][_0x67b0('0x5c')](_0x67b0('0x97'))){_0x5a66c1[_0x67b0('0x11')]=qs['limit'](_0xfce4c[_0x67b0('0x29')][_0x67b0('0x11')]);_0x5a66c1[_0x67b0('0x13')]=qs[_0x67b0('0x13')](_0xfce4c['query'][_0x67b0('0x13')]);}_0x5a66c1[_0x67b0('0x7b')]=qs[_0x67b0('0x7c')](_0xfce4c[_0x67b0('0x29')][_0x67b0('0x7c')]);_0x5a66c1[_0x67b0('0x57')]=qs['filters'](_['pick'](_0xfce4c[_0x67b0('0x29')],_0x3c04d9[_0x67b0('0x76')]));_0x5a66c1[_0x67b0('0x57')][_0x67b0('0x99')]=_0x1072f9['id'];if(_0xfce4c[_0x67b0('0x29')]['filter']){_0x5a66c1[_0x67b0('0x57')]=_[_0x67b0('0x7e')](_0x5a66c1['where'],{'$or':_[_0x67b0('0x6c')](_0x5a66c1[_0x67b0('0x78')],function(_0x23f91d){var _0x4e8367={};_0x4e8367[_0x23f91d]={'$like':'%'+_0xfce4c[_0x67b0('0x29')]['filter']+'%'};return _0x4e8367;})});}_0x5a66c1=_[_0x67b0('0x7e')]({},_0x5a66c1,_0xfce4c[_0x67b0('0x7f')]);return db[_0x67b0('0x4a')][_0x67b0('0x12')]({'where':_0x5a66c1[_0x67b0('0x57')]})[_0x67b0('0x17')](function(_0x1f2cdd){_0x2f98e6[_0x67b0('0x12')]=_0x1f2cdd;if(_0xfce4c[_0x67b0('0x29')][_0x67b0('0x9a')]){_0x5a66c1[_0x67b0('0x9c')]=[{'all':!![]}];}return db[_0x67b0('0x4a')]['findAll'](_0x5a66c1);})[_0x67b0('0x17')](function(_0x49c35a){_0x2f98e6[_0x67b0('0x9b')]=_0x49c35a;return _0x2f98e6;});}})[_0x67b0('0x17')](respondWithFilteredResult(_0x27a8c3,_0x5a66c1))[_0x67b0('0x20')](handleError(_0x27a8c3,null));};exports[_0x67b0('0x9d')]=function(_0x50488b,_0x1f05a6){var _0xdee3a4={'raw':!![],'where':{}};var _0x5d152d={};var _0x1bcb46={'count':0x0,'rows':[]};return db[_0x67b0('0x3e')][_0x67b0('0x75')]({'where':{'id':_0x50488b['params']['id']}})[_0x67b0('0x17')](handleEntityNotFound(_0x1f05a6,null))[_0x67b0('0x17')](function(_0x4fdeaf){if(_0x4fdeaf){_0x5d152d[_0x67b0('0x79')]=_[_0x67b0('0x25')](db[_0x67b0('0x9e')]['rawAttributes']);_0x5d152d['query']=_[_0x67b0('0x25')](_0x50488b[_0x67b0('0x29')]);_0x5d152d['filters']=_['intersection'](_0x5d152d[_0x67b0('0x79')],_0x5d152d[_0x67b0('0x29')]);_0xdee3a4['attributes']=_[_0x67b0('0x77')](_0x5d152d['model'],qs[_0x67b0('0x7a')](_0x50488b[_0x67b0('0x29')][_0x67b0('0x7a')]));_0xdee3a4[_0x67b0('0x78')]=_0xdee3a4[_0x67b0('0x78')][_0x67b0('0x26')]?_0xdee3a4['attributes']:_0x5d152d[_0x67b0('0x79')];if(!_0x50488b[_0x67b0('0x29')][_0x67b0('0x5c')](_0x67b0('0x97'))){_0xdee3a4[_0x67b0('0x11')]=qs['limit'](_0x50488b[_0x67b0('0x29')][_0x67b0('0x11')]);_0xdee3a4[_0x67b0('0x13')]=qs[_0x67b0('0x13')](_0x50488b[_0x67b0('0x29')]['offset']);}_0xdee3a4[_0x67b0('0x7b')]=qs[_0x67b0('0x7c')](_0x50488b[_0x67b0('0x29')][_0x67b0('0x7c')]);_0xdee3a4['where']=qs[_0x67b0('0x76')](_[_0x67b0('0x98')](_0x50488b[_0x67b0('0x29')],_0x5d152d[_0x67b0('0x76')]));_0xdee3a4[_0x67b0('0x57')]['ContactId']=_0x4fdeaf['id'];if(_0x50488b[_0x67b0('0x29')][_0x67b0('0x7d')]){_0xdee3a4['where']=_['merge'](_0xdee3a4[_0x67b0('0x57')],{'$or':_[_0x67b0('0x6c')](_0xdee3a4[_0x67b0('0x78')],function(_0x57db51){var _0x367a5e={};_0x367a5e[_0x57db51]={'$like':'%'+_0x50488b[_0x67b0('0x29')]['filter']+'%'};return _0x367a5e;})});}_0xdee3a4=_[_0x67b0('0x7e')]({},_0xdee3a4,_0x50488b[_0x67b0('0x7f')]);return db[_0x67b0('0x9e')][_0x67b0('0x12')]({'where':_0xdee3a4['where']})[_0x67b0('0x17')](function(_0x3de922){_0x1bcb46['count']=_0x3de922;if(_0x50488b[_0x67b0('0x29')][_0x67b0('0x9a')]){_0xdee3a4[_0x67b0('0x9c')]=[{'all':!![]}];}return db[_0x67b0('0x9e')][_0x67b0('0x2c')](_0xdee3a4);})[_0x67b0('0x17')](function(_0x347def){_0x1bcb46['rows']=_0x347def;return _0x1bcb46;});}})[_0x67b0('0x17')](respondWithFilteredResult(_0x1f05a6,_0xdee3a4))['catch'](handleError(_0x1f05a6,null));};exports[_0x67b0('0x9f')]=function(_0x32ce61,_0x5d62b1){var _0x168917={'raw':!![],'where':{}};var _0x41a74d={};var _0x2b5b31={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x32ce61[_0x67b0('0x22')]['id']}})[_0x67b0('0x17')](handleEntityNotFound(_0x5d62b1,null))[_0x67b0('0x17')](function(_0x3a0ddf){if(_0x3a0ddf){_0x41a74d['model']=_['keys'](db[_0x67b0('0x4f')]['rawAttributes']);_0x41a74d[_0x67b0('0x29')]=_[_0x67b0('0x25')](_0x32ce61[_0x67b0('0x29')]);_0x41a74d[_0x67b0('0x76')]=_[_0x67b0('0x77')](_0x41a74d[_0x67b0('0x79')],_0x41a74d[_0x67b0('0x29')]);_0x168917[_0x67b0('0x78')]=_[_0x67b0('0x77')](_0x41a74d[_0x67b0('0x79')],qs[_0x67b0('0x7a')](_0x32ce61[_0x67b0('0x29')][_0x67b0('0x7a')]));_0x168917[_0x67b0('0x78')]=_0x168917[_0x67b0('0x78')][_0x67b0('0x26')]?_0x168917[_0x67b0('0x78')]:_0x41a74d[_0x67b0('0x79')];if(!_0x32ce61[_0x67b0('0x29')][_0x67b0('0x5c')](_0x67b0('0x97'))){_0x168917[_0x67b0('0x11')]=qs['limit'](_0x32ce61[_0x67b0('0x29')]['limit']);_0x168917[_0x67b0('0x13')]=qs[_0x67b0('0x13')](_0x32ce61[_0x67b0('0x29')][_0x67b0('0x13')]);}_0x168917['order']=qs[_0x67b0('0x7c')](_0x32ce61[_0x67b0('0x29')]['sort']);_0x168917[_0x67b0('0x57')]=qs[_0x67b0('0x76')](_[_0x67b0('0x98')](_0x32ce61['query'],_0x41a74d[_0x67b0('0x76')]));_0x168917[_0x67b0('0x57')][_0x67b0('0x99')]=_0x3a0ddf['id'];if(_0x32ce61[_0x67b0('0x29')]['filter']){_0x168917['where']=_[_0x67b0('0x7e')](_0x168917[_0x67b0('0x57')],{'$or':_[_0x67b0('0x6c')](_0x168917[_0x67b0('0x78')],function(_0x2e7c66){var _0x373f25={};_0x373f25[_0x2e7c66]={'$like':'%'+_0x32ce61[_0x67b0('0x29')][_0x67b0('0x7d')]+'%'};return _0x373f25;})});}_0x168917=_['merge']({},_0x168917,_0x32ce61[_0x67b0('0x7f')]);return db[_0x67b0('0x4f')][_0x67b0('0x12')]({'where':_0x168917[_0x67b0('0x57')]})[_0x67b0('0x17')](function(_0x4d0f90){_0x2b5b31[_0x67b0('0x12')]=_0x4d0f90;if(_0x32ce61['query']['includeAll']){_0x168917[_0x67b0('0x9c')]=[{'all':!![]}];}return db[_0x67b0('0x4f')][_0x67b0('0x2c')](_0x168917);})[_0x67b0('0x17')](function(_0x25c188){_0x2b5b31[_0x67b0('0x9b')]=_0x25c188;return _0x2b5b31;});}})['then'](respondWithFilteredResult(_0x5d62b1,_0x168917))[_0x67b0('0x20')](handleError(_0x5d62b1,null));};exports[_0x67b0('0xa0')]=function(_0x4e2933,_0x4c4230){try{if(!_0x4e2933[_0x67b0('0x33')][_0x67b0('0x5a')]){throw new Error(_0x67b0('0xa1'));}if(!_0x4e2933[_0x67b0('0x33')]['binding_keys']){throw new Error(_0x67b0('0xa2'));}if(!_0x4e2933['body'][_0x67b0('0xa3')]){throw new Error(_0x67b0('0xa4'));}if(!_0x4e2933[_0x67b0('0x33')][_0x67b0('0xa5')]){throw new Error(_0x67b0('0xa6'));}var _0x533619=_0x4e2933['body']['binding_keys'][_0x67b0('0xa7')](',');var _0x440bf5=_0x4e2933['body'][_0x67b0('0xa3')]['split'](',');if(!_0x533619[_0x67b0('0x26')]||!_0x440bf5[_0x67b0('0x26')]||_0x533619[_0x67b0('0x26')]!==_0x440bf5[_0x67b0('0x26')]){throw new Error(_0x67b0('0xa8'));}_0x4e2933['body']['fields']=_[_0x67b0('0xa9')](_0x533619,_0x440bf5);if(!_0x4e2933[_0x67b0('0x33')][_0x67b0('0x7a')][_0x67b0('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4e2933[_0x67b0('0x33')][_0x67b0('0x7a')]['firstName']){throw new Error(_0x67b0('0xaa'));}var _0x39a133=path[_0x67b0('0x38')](config['root'],_0x67b0('0xab'),_0x4e2933[_0x67b0('0xac')]['filename']);fs[_0x67b0('0xad')](_0x39a133,parseInt(_0x67b0('0xae'),0x8));var _0x569878=require('child_process')['fork'](path[_0x67b0('0x38')](__dirname,_0x67b0('0xaf')),[_0x39a133,_0x4e2933[_0x67b0('0x33')][_0x67b0('0xb0')],_0x4e2933[_0x67b0('0x33')][_0x67b0('0xa3')],_0x4e2933[_0x67b0('0x33')][_0x67b0('0x5a')],_0x4e2933['body']['CompanyId'],_0x4e2933[_0x67b0('0x33')]['duplicates'],_0x4e2933[_0x67b0('0x33')][_0x67b0('0xa5')]]);return _0x4c4230['status'](0xc8)[_0x67b0('0xf')]({'message':'File\x20uploaded\x20correctly!','pid':_0x569878[_0x67b0('0xb1')]});}catch(_0x353731){return _0x4c4230[_0x67b0('0x19')](0x1f4)[_0x67b0('0x1d')](_0x353731);}};exports['upload']=function(_0x56fd42,_0x4f067d){var _0x2efe27=fs['createReadStream'](_0x56fd42['file'][_0x67b0('0x2')]);Papa['parse'](_0x2efe27,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x23ea17){return _0x4f067d[_0x67b0('0x19')](0xc8)[_0x67b0('0xf')]({'file':_0x56fd42['file'],'fields':_0x23ea17[_0x67b0('0xb2')][_0x67b0('0x7a')]});}});};exports[_0x67b0('0xb3')]=function(_0x5e2f0b,_0x2a23d7){return db[_0x67b0('0xb4')][_0x67b0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x67b0('0x17')](function(_0x5195dd){var _0x1237fa=![];if(!_0x5e2f0b[_0x67b0('0x33')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x5e2f0b[_0x67b0('0x33')][_0x67b0('0xb5')][_0x67b0('0x73')]){throw new Error(_0x67b0('0xb6'));}if(!_0x5e2f0b[_0x67b0('0x33')]['binding']['firstName']){throw new Error(_0x67b0('0xaa'));}if(!_0x5e2f0b[_0x67b0('0x33')][_0x67b0('0xa5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x206f6e=require('child_process')['fork'](path[_0x67b0('0x38')](__dirname,_0x67b0('0xb7')),[_0x5e2f0b[_0x67b0('0x22')]['id'],JSON[_0x67b0('0xb8')](_0x5e2f0b[_0x67b0('0x33')]),JSON[_0x67b0('0xb8')](_0x5195dd)]);_0x206f6e['on'](_0x67b0('0xb9'),function(){_0x1237fa=!![];return _0x2a23d7[_0x67b0('0x19')](0xc8)[_0x67b0('0xf')]({'message':_0x67b0('0xba'),'pid':_0x206f6e[_0x67b0('0xb1')]});});_0x206f6e['on'](_0x67b0('0xbb'),function(_0x44657f){if(_0x44657f&&!_0x1237fa){return _0x2a23d7['status'](0x1f4)[_0x67b0('0xf')]({'message':_0x67b0('0xbc'),'pid':_0x206f6e[_0x67b0('0xb1')]});}});})[_0x67b0('0x20')](handleError(_0x2a23d7,null));};exports['importUpdates']=function(_0x57af8e,_0x40f96f){return db[_0x67b0('0xb4')][_0x67b0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x67b0('0x17')](function(_0x577aa5){var _0x4917cb=![];if(!_0x57af8e[_0x67b0('0x33')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x57af8e[_0x67b0('0x33')][_0x67b0('0xb5')][_0x67b0('0x73')]){throw new Error(_0x67b0('0xb6'));}if(!_0x57af8e['body'][_0x67b0('0xb5')][_0x67b0('0xbd')]){throw new Error(_0x67b0('0xaa'));}if(!_0x57af8e[_0x67b0('0x33')][_0x67b0('0xa5')]){throw new Error(_0x67b0('0xa6'));}var _0x228258=require(_0x67b0('0xbe'))[_0x67b0('0xbf')](path[_0x67b0('0x38')](__dirname,'../../components/import/cm/csvUpdates'),[_0x57af8e[_0x67b0('0x22')]['id'],JSON['stringify'](_0x57af8e[_0x67b0('0x33')]),JSON[_0x67b0('0xb8')](_0x577aa5)]);_0x228258['on'](_0x67b0('0xb9'),function(){_0x4917cb=!![];return _0x40f96f[_0x67b0('0x19')](0xc8)[_0x67b0('0xf')]({'message':_0x67b0('0xba'),'pid':_0x228258[_0x67b0('0xb1')]});});_0x228258['on']('exit',function(_0x27674e){if(_0x27674e&&!_0x4917cb){return _0x40f96f[_0x67b0('0x19')](0x1f4)[_0x67b0('0xf')]({'message':'error\x20child\x20process','pid':_0x228258[_0x67b0('0xb1')]});}});})[_0x67b0('0x20')](handleError(_0x40f96f,null));};exports[_0x67b0('0xc0')]=function(_0x220b38,_0x32c182){var _0x99d7b5=[_0x67b0('0xc1'),_0x67b0('0xc2'),'sms','openchannel',_0x67b0('0xc3'),_0x67b0('0xc4'),_0x67b0('0xc5')];var _0x231823={'offset':0x0,'order':qs[_0x67b0('0x7c')](_0x67b0('0xc6'))},_0x2afa90={'count':0x0,'rows':[]};Promise['resolve']()[_0x67b0('0x17')](function(){if(_0x220b38['query'][_0x67b0('0xc7')]){if(!_[_0x67b0('0xc8')](_0x99d7b5,_0x220b38[_0x67b0('0x29')][_0x67b0('0xc7')][_0x67b0('0xc9')]())){throw new Error(_0x67b0('0xca'));}_0x99d7b5=[_0x220b38[_0x67b0('0x29')][_0x67b0('0xc7')]['toLowerCase']()];}if(_0x220b38[_0x67b0('0x29')]['range']){try{var _0x2454c9=JSON[_0x67b0('0xcb')](_0x220b38['query'][_0x67b0('0xcc')]);if(!moment(_0x2454c9[_0x67b0('0x34')])[_0x67b0('0xcd')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x2454c9['to'])[_0x67b0('0xcd')]()){throw new Error(_0x67b0('0xce'));}}catch(_0x48476f){throw new Error(_0x67b0('0xcf'));}}if(!_0x220b38[_0x67b0('0x29')][_0x67b0('0x5c')](_0x67b0('0x97'))){_0x231823[_0x67b0('0x11')]=qs[_0x67b0('0x11')](_0x220b38[_0x67b0('0x29')]['limit']||0xa);_0x231823['offset']=qs[_0x67b0('0x13')](_0x220b38[_0x67b0('0x29')][_0x67b0('0x13')]);}var _0x47ef74=_0x99d7b5[_0x67b0('0x6c')](function(_0xf916bb){if(_0xf916bb===_0x67b0('0xc5')){var _0x5ca274={'attributes':['id',_0x67b0('0xd0'),_0x67b0('0x30'),_0x67b0('0xd1'),'destination',_0x67b0('0xd2'),_0x67b0('0xd3'),_0x67b0('0xd4'),'duration',_0x67b0('0xd5'),_0x67b0('0xd6'),'userDisposition','userSecondDisposition',_0x67b0('0xd7'),_0x67b0('0xd8')],'where':{'ContactId':_0x220b38['params']['id']},'include':[{'model':db[_0x67b0('0xb4')],'as':_0x67b0('0xb4'),'attributes':['id',_0x67b0('0x1c'),_0x67b0('0xd9'),'alias']}],'order':[[_0x67b0('0xd6'),_0x67b0('0xda')]]};if(_0x220b38[_0x67b0('0x29')][_0x67b0('0xcc')]){_0x5ca274[_0x67b0('0x57')][_0x67b0('0xd6')]={'$gte':_0x2454c9[_0x67b0('0x34')],'$lte':_0x2454c9['to']};}return db[_0x67b0('0xdb')][_0x67b0('0xdc')](_0x5ca274)[_0x67b0('0x17')](function(_0x5334c5){_0x2afa90[_0x67b0('0x12')]+=_0x5334c5[_0x67b0('0x12')];return _[_0x67b0('0x6c')](_0x5334c5[_0x67b0('0x9b')],function(_0x452fe6){var _0x397c94=_0x452fe6[_0x67b0('0x35')]({'plain':!![]});_0x397c94[_0x67b0('0xc7')]=_0xf916bb;if(_0x397c94['User']){_0x397c94['User']={'id':_0x397c94[_0x67b0('0xb4')]['id'],'name':_0x397c94['User'][_0x67b0('0x1c')],'fullname':_0x397c94[_0x67b0('0xb4')]['fullname'],'alias':_0x397c94[_0x67b0('0xb4')]['alias']};}return _0x397c94;});});}else{var _0xc63a06=_[_0x67b0('0xdd')](_0xf916bb)+(_0xf916bb===_0x67b0('0xc2')?'Website':'Account');var _0x31be10={'attributes':['id',_0x67b0('0xde'),_0x67b0('0xdf'),_0x67b0('0xd6'),_0x67b0('0xd5'),_0x67b0('0xe0'),_0x67b0('0xe1'),_0x67b0('0xe2'),'UserId',_0xc63a06+'Id'],'where':{'ContactId':_0x220b38['params']['id']},'include':[{'model':db[_0xc63a06],'as':_0x67b0('0xe3'),'attributes':['id',_0x67b0('0x1c'),'key']},{'model':db[_0x67b0('0xb4')],'as':_0x67b0('0xe4'),'attributes':['id',_0x67b0('0x1c'),'fullname']},{'model':db[_0x67b0('0x5f')],'as':_0x67b0('0xe5'),'attributes':['id','name',_0x67b0('0x60')],'through':{'attributes':[]}}],'order':[[_0x67b0('0xd6'),_0x67b0('0xda')]]};if(_0x220b38[_0x67b0('0x29')][_0x67b0('0xcc')]){_0x31be10['where']['createdAt']={'$gte':_0x2454c9['from'],'$lte':_0x2454c9['to']};}switch(_0xf916bb){case _0x67b0('0xc2'):_0x31be10['attributes']['push'](_0x67b0('0xe6'),'customerIp','customerPort',_0x67b0('0xe7'),_0x67b0('0xe8'),_0x67b0('0xe9'),_0x67b0('0xea'),_0x67b0('0xeb'),_0x67b0('0xec'));break;case _0x67b0('0xc1'):_0x31be10[_0x67b0('0x78')][_0x67b0('0x59')](_0x67b0('0xed'),_0x67b0('0xee'));break;case _0x67b0('0xef'):_0x31be10[_0x67b0('0x78')][_0x67b0('0x59')](_0x67b0('0xf0'),_0x67b0('0xf1'));break;}return db[_[_0x67b0('0xdd')](_0xf916bb)+_0x67b0('0xf2')][_0x67b0('0xdc')](_0x31be10)[_0x67b0('0x17')](function(_0x24a49f){_0x2afa90[_0x67b0('0x12')]+=_0x24a49f[_0x67b0('0x12')];return _['map'](_0x24a49f[_0x67b0('0x9b')],function(_0x15adba){var _0xef8f69=_0x15adba['get']({'plain':!![]});_0xef8f69[_0x67b0('0xc7')]=_0xf916bb;if(_0xef8f69['Owner']){_0xef8f69[_0x67b0('0xe4')]={'id':_0xef8f69[_0x67b0('0xe4')]['id'],'name':_0xef8f69[_0x67b0('0xe4')]['name'],'fullname':_0xef8f69[_0x67b0('0xe4')][_0x67b0('0xd9')]};}return _0xef8f69;});});}});return Promise[_0x67b0('0x5d')](_0x47ef74);})[_0x67b0('0x17')](function(_0x630c42){return _(_0x630c42)[_0x67b0('0xf3')]()[_0x67b0('0xf4')](_0x67b0('0xd6'))[_0x67b0('0xf5')]()[_0x67b0('0xf6')]();})[_0x67b0('0x17')](function(_0x4004b7){_0x2afa90[_0x67b0('0x9b')]=_0x231823[_0x67b0('0x11')]?_0x4004b7[_0x67b0('0xf7')](_0x231823[_0x67b0('0x13')],_0x231823[_0x67b0('0x13')]+_0x231823[_0x67b0('0x11')]):_0x4004b7;return _0x2afa90;})['then'](respondWithFilteredResult(_0x32c182,_0x231823))[_0x67b0('0x20')](handleError(_0x32c182,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index b37555e..afd0a78 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 _0xd7bc=['../../mysqldb','CmContact','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xd7bc,0x13a));var _0xcd7b=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xd7bc[_0x254d9f];return _0x1eedb9;};'use strict';var EventEmitter=require(_0xcd7b('0x0'));var CmContact=require(_0xcd7b('0x1'))['db'][_0xcd7b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xcd7b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd7b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e5b51){return function(_0x25abce,_0x458d29,_0x205773){CmContactEvents[_0xcd7b('0x5')](_0x5e5b51+':'+_0x25abce['id'],_0x25abce);CmContactEvents[_0xcd7b('0x5')](_0x5e5b51,_0x25abce);_0x205773(null);};}for(var e in events){if(events[_0xcd7b('0x6')](e)){var event=events[e];CmContact[_0xcd7b('0x7')](e,emitEvent(event));}}module[_0xcd7b('0x8')]=CmContactEvents; \ No newline at end of file +var _0x9bcc=['../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x23bdbb,_0x1abd08){var _0x3a5ba2=function(_0x3390e1){while(--_0x3390e1){_0x23bdbb['push'](_0x23bdbb['shift']());}};_0x3a5ba2(++_0x1abd08);}(_0x9bcc,0x1b7));var _0xc9bc=function(_0x1f41ac,_0x443aa4){_0x1f41ac=_0x1f41ac-0x0;var _0x3c98a5=_0x9bcc[_0x1f41ac];return _0x3c98a5;};'use strict';var EventEmitter=require(_0xc9bc('0x0'));var CmContact=require(_0xc9bc('0x1'))['db'][_0xc9bc('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc9bc('0x3')](0x0);var events={'afterCreate':_0xc9bc('0x4'),'afterUpdate':_0xc9bc('0x5'),'afterDestroy':_0xc9bc('0x6')};function emitEvent(_0xc8f954){return function(_0x1ba2a3,_0x57dc13,_0x5af220){CmContactEvents[_0xc9bc('0x7')](_0xc8f954+':'+_0x1ba2a3['id'],_0x1ba2a3);CmContactEvents[_0xc9bc('0x7')](_0xc8f954,_0x1ba2a3);_0x5af220(null);};}for(var e in events){if(events[_0xc9bc('0x8')](e)){var event=events[e];CmContact[_0xc9bc('0x9')](e,emitEvent(event));}}module[_0xc9bc('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c89b6f4..d4a0579 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 _0xa2f6=['get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','isEmpty','length','destroy','ContactId','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','resolve','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','dialCheckDuplicateType','always','onlyIfOpen','CmList','Lists','map','findAll','outbound','BlackLists','all','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models'];(function(_0x1c3a76,_0x12b560){var _0x1ecf90=function(_0x2e9c22){while(--_0x2e9c22){_0x1c3a76['push'](_0x1c3a76['shift']());}};_0x1ecf90(++_0x12b560);}(_0xa2f6,0x1a4));var _0x6a2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa2f6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a2f('0x0'));var util=require('util');var logger=require(_0x6a2f('0x1'))(_0x6a2f('0x2'));var moment=require(_0x6a2f('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x6a2f('0x4'));function getTimezoneCallbackAt(_0x1e54ca,_0x4f1d2f,_0x17eda8,_0x544ff7){var _0x4f2862=_0x544ff7?_0x6a2f('0x5'):_0x6a2f('0x6');var _0x2db96d=_0x17eda8[_0x6a2f('0x7')]?_0x17eda8[_0x6a2f('0x7')]:moment()[_0x6a2f('0x8')](_0x6a2f('0x9'));if(_[_0x6a2f('0xa')](_0x17eda8['dialTimezone'])){return Promise[_0x6a2f('0xb')](_0x2db96d);}return _0x1e54ca[_0x4f2862][_0x6a2f('0xc')]({'where':{'id':_0x4f1d2f}})[_0x6a2f('0xd')](function(_0x4bd6b6){if(_[_0x6a2f('0xa')](_0x4bd6b6)||_[_0x6a2f('0xa')](_0x4bd6b6[_0x6a2f('0xe')])){return Promise[_0x6a2f('0xb')](_0x2db96d);}var _0x43d6d1=shared[_0x6a2f('0xf')];var _0x1abac3=_0x43d6d1[_0x4bd6b6[_0x6a2f('0xe')]];var _0x213af1=_0x43d6d1[_0x17eda8['dialTimezone']];if(_['isNil'](_0x1abac3)&&_[_0x6a2f('0xa')](_0x213af1)){return Promise[_0x6a2f('0xb')](_0x2db96d);}var _0x4d360b=_0x1abac3[_0x6a2f('0x10')]-_0x213af1[_0x6a2f('0x10')];var _0x5af4b6=_0x17eda8['scheduledat']?_0x17eda8['scheduledat']:moment();_0x2db96d=moment(_0x5af4b6)[_0x6a2f('0x11')](_0x4d360b,_0x6a2f('0x12'))[_0x6a2f('0x8')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0x6a2f('0xb')](_0x2db96d);});}function getNewHopperPayload(_0x37ecab){return{'phone':_0x37ecab[_0x6a2f('0x13')],'ContactId':_0x37ecab['id'],'ListId':_0x37ecab[_0x6a2f('0x14')],'scheduledat':_0x37ecab['scheduledat']?_0x37ecab[_0x6a2f('0x7')]:moment()[_0x6a2f('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x37ecab['priority']?_0x37ecab[_0x6a2f('0x15')]:0x2,'callback':_0x37ecab[_0x6a2f('0x16')]?!![]:![],'callbackuniqueid':_0x37ecab[_0x6a2f('0x16')]?_0x37ecab[_0x6a2f('0x16')]:undefined,'callbackat':_0x37ecab[_0x6a2f('0x16')]?moment()[_0x6a2f('0x8')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x5ba054,_0x8b879a,_0x61f129,_0x181097){var _0x1d98fe={'phone':_0x61f129['phone']};var _0x36a1e8={'calleridnum':_0x61f129[_0x6a2f('0x13')]};if(_0x181097){Object[_0x6a2f('0x17')](_0x1d98fe,{'CampaignId':_0x8b879a['id']});Object[_0x6a2f('0x17')](_0x36a1e8,{'CampaignId':_0x8b879a['id']});}else{Object[_0x6a2f('0x17')](_0x1d98fe,{'VoiceQueueId':_0x8b879a['id']});Object[_0x6a2f('0x17')](_0x36a1e8,{'VoiceQueueId':_0x8b879a['id']});}return _0x5ba054[_0x6a2f('0x18')][_0x6a2f('0xc')]({'where':_0x1d98fe})[_0x6a2f('0xd')](function(_0x392115){if(_0x392115){throw new Error(_0x6a2f('0x19')+_0x61f129[_0x6a2f('0x13')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x8b879a['id']);}return _0x5ba054[_0x6a2f('0x1a')]['findOne']({'where':_0x36a1e8});})[_0x6a2f('0xd')](function(_0x32e71b){if(_0x32e71b){throw new Error(_0x6a2f('0x1b')+_0x61f129[_0x6a2f('0x13')]+_0x6a2f('0x1c')+_0x8b879a['id']);}var _0xa93fdb=getNewHopperPayload(_0x61f129);if(_0x181097){_0xa93fdb[_0x6a2f('0x1d')]=_0x8b879a['id'];}else{_0xa93fdb['VoiceQueueId']=_0x8b879a['id'];}return _0x5ba054[_0x6a2f('0x18')]['create'](_0xa93fdb);});}function handleOnlyIfOpenCheckDuplicate(_0x89d697,_0x1f2c67,_0x507249,_0x15e218){var _0x33a1aa={'phone':_0x507249[_0x6a2f('0x13')]};if(_0x15e218){Object[_0x6a2f('0x17')](_0x33a1aa,{'CampaignId':_0x1f2c67['id']});}else{Object[_0x6a2f('0x17')](_0x33a1aa,{'VoiceQueueId':_0x1f2c67['id']});}return _0x89d697[_0x6a2f('0x18')][_0x6a2f('0xc')]({'where':_0x33a1aa})[_0x6a2f('0xd')](function(_0xca4be5){if(_0xca4be5){throw new Error(_0x6a2f('0x1e')+_0x507249[_0x6a2f('0x13')]+_0x6a2f('0x1c')+_0x1f2c67['id']);}var _0x42ef42=getNewHopperPayload(_0x507249);if(_0x15e218){_0x42ef42[_0x6a2f('0x1d')]=_0x1f2c67['id'];}else{_0x42ef42[_0x6a2f('0x1f')]=_0x1f2c67['id'];}return _0x89d697[_0x6a2f('0x18')]['create'](_0x42ef42);});}function handleNeverCheckDuplicate(_0x510b8a,_0x2be7c9,_0x19d56c){var _0x1b9627=getNewHopperPayload(_0x19d56c);_0x1b9627['VoiceQueueId']=_0x2be7c9['id'];return _0x510b8a['CmHopper'][_0x6a2f('0x20')](_0x1b9627);}function handleCheckDuplicate(_0x11ac10,_0x318571,_0x908b25,_0x5de275){return getTimezoneCallbackAt(_0x11ac10,_0x318571,_0x908b25,_0x5de275)['then'](function(_0x376d17){_0x908b25[_0x6a2f('0x7')]=_0x376d17;switch(_0x318571[_0x6a2f('0x21')]){case _0x6a2f('0x22'):return handleAlwaysCheckDuplicate(_0x11ac10,_0x318571,_0x908b25,_0x5de275);case _0x6a2f('0x23'):return handleOnlyIfOpenCheckDuplicate(_0x11ac10,_0x318571,_0x908b25,_0x5de275);default:return handleNeverCheckDuplicate(_0x11ac10,_0x318571,_0x908b25);}});}function createHopperForVoiceQueues(_0x2df5d9,_0x5f2ab8){return _0x2df5d9['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x6a2f('0x21'),_0x6a2f('0xe')],'include':[{'model':_0x2df5d9[_0x6a2f('0x24')],'as':'Lists','where':{'id':_0x5f2ab8[_0x6a2f('0x14')]}}],'raw':!![]})['then'](function(_0x2ce425){var _0x328b21=_0x2ce425['map'](function(_0x5b8692){return handleCheckDuplicate(_0x2df5d9,_0x5b8692,_0x5f2ab8,![]);});return Promise['all'](_0x328b21);});}function createHopperForCampaigns(_0xdb3e78,_0x51c1f2){return _0xdb3e78[_0x6a2f('0x5')]['findAll']({'attributes':['id',_0x6a2f('0x21'),_0x6a2f('0xe')],'include':[{'model':_0xdb3e78[_0x6a2f('0x24')],'as':_0x6a2f('0x25'),'where':{'id':_0x51c1f2[_0x6a2f('0x14')]}}],'raw':!![]})['then'](function(_0x2da9f9){var _0x472a34=_0x2da9f9[_0x6a2f('0x26')](function(_0x598418){return handleCheckDuplicate(_0xdb3e78,_0x598418,_0x51c1f2,!![]);});return Promise['all'](_0x472a34);});}function createHopperBlackForVoiceQueues(_0x187a25,_0x3885be){return _0x187a25['VoiceQueue'][_0x6a2f('0x27')]({'where':{'type':_0x6a2f('0x28')},'attributes':['id'],'include':[{'model':_0x187a25[_0x6a2f('0x24')],'as':_0x6a2f('0x29'),'where':{'id':_0x3885be[_0x6a2f('0x14')]}}],'raw':!![]})['then'](function(_0x2ec043){var _0x11cb56=_0x2ec043[_0x6a2f('0x26')](function(_0x1e87ba){return _0x187a25['CmHopperBlack'][_0x6a2f('0x20')]({'phone':_0x3885be[_0x6a2f('0x13')],'ContactId':_0x3885be['id'],'ListId':_0x3885be['ListId'],'VoiceQueueId':_0x1e87ba['id']});});return Promise[_0x6a2f('0x2a')](_0x11cb56);});}function createHopperBlackForCampaigns(_0x4fc949,_0x3acf18){return _0x4fc949['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x4fc949[_0x6a2f('0x24')],'as':'BlackLists','where':{'id':_0x3acf18[_0x6a2f('0x14')]}}],'raw':!![]})[_0x6a2f('0xd')](function(_0x1e84aa){var _0x5b5379=_0x1e84aa[_0x6a2f('0x26')](function(_0x51ba71){return _0x4fc949[_0x6a2f('0x2b')][_0x6a2f('0x20')]({'phone':_0x3acf18[_0x6a2f('0x13')],'ContactId':_0x3acf18['id'],'ListId':_0x3acf18[_0x6a2f('0x14')],'CampaignId':_0x51ba71['id']});});return Promise[_0x6a2f('0x2a')](_0x5b5379);});}module[_0x6a2f('0x2c')]=function(_0x2fa68b){return _0x2fa68b[_0x6a2f('0x2d')](_0x6a2f('0x2e'),attributes,{'tableName':_0x6a2f('0x2f'),'paranoid':!![],'indexes':[{'name':_0x6a2f('0x13'),'fields':[_0x6a2f('0x13')]},{'name':_0x6a2f('0x30'),'fields':['firstName',_0x6a2f('0x31'),_0x6a2f('0x13'),'mobile',_0x6a2f('0x32'),_0x6a2f('0x33')],'type':_0x6a2f('0x34')}],'timestamps':!![],'charset':_0x6a2f('0x35'),'collate':_0x6a2f('0x36'),'hooks':{'afterCreate':function(_0x169066,_0x1018cc,_0x39621d){var _0x530a50=_0x2fa68b[_0x6a2f('0x37')];var _0x4eb5d2=_0x169066[_0x6a2f('0x38')]({'plain':!![]});if(!_0x4eb5d2[_0x6a2f('0x14')]){logger[_0x6a2f('0x39')](_0x6a2f('0x3a')+_0x4eb5d2['id']);return _0x39621d();}if(!_0x4eb5d2['phone']){return _0x39621d();}return createHopperForVoiceQueues(_0x530a50,_0x4eb5d2)[_0x6a2f('0xd')](function(){return createHopperBlackForVoiceQueues(_0x530a50,_0x4eb5d2);})[_0x6a2f('0xd')](function(){return createHopperForCampaigns(_0x530a50,_0x4eb5d2);})['then'](function(){return createHopperBlackForCampaigns(_0x530a50,_0x4eb5d2);})[_0x6a2f('0xd')](function(){return _0x39621d();})[_0x6a2f('0x3b')](function(_0x75441d){logger[_0x6a2f('0x39')](_0x6a2f('0x3c'),_0x75441d['message']);_0x39621d();});},'afterDestroy':function(_0x144cfc,_0x299e9d,_0x387e40){var _0x282c83=_0x2fa68b[_0x6a2f('0x37')];var _0x4e8c6e=_0x144cfc[_0x6a2f('0x38')]({'plain':!![]});return _0x282c83[_0x6a2f('0x18')]['findAll']({'raw':!![],'where':{'ListId':_0x4e8c6e[_0x6a2f('0x14')],'ContactId':_0x4e8c6e['id']}})[_0x6a2f('0xd')](function(_0x1467a2){if(!_[_0x6a2f('0x3d')](_0x1467a2)){var _0x54b71b=[];for(var _0x138495=0x0;_0x138495<_0x1467a2[_0x6a2f('0x3e')];_0x138495+=0x1){var _0x252be2=_0x282c83[_0x6a2f('0x18')][_0x6a2f('0x3f')]({'where':{'ListId':_0x1467a2[_0x138495][_0x6a2f('0x14')],'ContactId':_0x1467a2[_0x138495][_0x6a2f('0x40')],'VoiceQueueId':_0x1467a2[_0x138495]['VoiceQueueId'],'CampaignId':_0x1467a2[_0x138495][_0x6a2f('0x1d')]}});_0x54b71b['push'](_0x252be2);}return Promise['all'](_0x54b71b);}})[_0x6a2f('0xd')](function(_0x108b0f){logger['info'](_0x6a2f('0x41'),util['inspect'](_0x108b0f,{'showHidden':![],'depth':null}));_0x387e40();})[_0x6a2f('0x3b')](function(_0x3210cd){logger[_0x6a2f('0x39')](_0x6a2f('0x42'),util[_0x6a2f('0x43')](_0x3210cd,{'showHidden':![],'depth':null}));_0x387e40(_0x3210cd);});}}});}; \ No newline at end of file +var _0xaa1f=['mobile','fax','email','FULLTEXT','utf8mb4','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','get','isEmpty','destroy','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','catch','[CmContact][afterDestroy][Error]','api','moment','./cmContact.attributes','VoiceQueue','scheduledat','format','isNil','dialTimezone','resolve','then','timezones','utcOffset','add','YYYY-MM-DD\x20HH:mm:ss','ListId','priority','callbackUniqueid','phone','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','onlyIfOpen','findAll','Lists','map','all','Campaign','outbound','CmList','CmHopperBlack','exports','define','fti_cm_contacts','firstName','lastName'];(function(_0x5be717,_0x4ce895){var _0x4e8130=function(_0x2fbe25){while(--_0x2fbe25){_0x5be717['push'](_0x5be717['shift']());}};_0x4e8130(++_0x4ce895);}(_0xaa1f,0xd0));var _0xfaa1=function(_0x56daf7,_0x3d4f62){_0x56daf7=_0x56daf7-0x0;var _0xa84514=_0xaa1f[_0x56daf7];return _0xa84514;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfaa1('0x0'));var moment=require(_0xfaa1('0x1'));var shared=require('../../config/environment/shared');var attributes=require(_0xfaa1('0x2'));function getTimezoneCallbackAt(_0x489973,_0x49ba47,_0x462f90,_0x478533){var _0x1e453f=_0x478533?'Campaign':_0xfaa1('0x3');var _0x17043a=_0x462f90[_0xfaa1('0x4')]?_0x462f90[_0xfaa1('0x4')]:moment()[_0xfaa1('0x5')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0xfaa1('0x6')](_0x462f90[_0xfaa1('0x7')])){return Promise[_0xfaa1('0x8')](_0x17043a);}return _0x489973[_0x1e453f]['findOne']({'where':{'id':_0x49ba47}})[_0xfaa1('0x9')](function(_0x2f55c0){if(_[_0xfaa1('0x6')](_0x2f55c0)||_[_0xfaa1('0x6')](_0x2f55c0[_0xfaa1('0x7')])){return Promise[_0xfaa1('0x8')](_0x17043a);}var _0x33b9a7=shared[_0xfaa1('0xa')];var _0x376d15=_0x33b9a7[_0x2f55c0['dialTimezone']];var _0x1abea5=_0x33b9a7[_0x462f90[_0xfaa1('0x7')]];if(_[_0xfaa1('0x6')](_0x376d15)&&_[_0xfaa1('0x6')](_0x1abea5)){return Promise[_0xfaa1('0x8')](_0x17043a);}var _0x4f0cd4=_0x376d15['utcOffset']-_0x1abea5[_0xfaa1('0xb')];var _0x333453=_0x462f90['scheduledat']?_0x462f90['scheduledat']:moment();_0x17043a=moment(_0x333453)[_0xfaa1('0xc')](_0x4f0cd4,'minutes')[_0xfaa1('0x5')](_0xfaa1('0xd'));return Promise[_0xfaa1('0x8')](_0x17043a);});}function getNewHopperPayload(_0x76282c){return{'phone':_0x76282c['phone'],'ContactId':_0x76282c['id'],'ListId':_0x76282c[_0xfaa1('0xe')],'scheduledat':_0x76282c[_0xfaa1('0x4')]?_0x76282c[_0xfaa1('0x4')]:moment()[_0xfaa1('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x76282c[_0xfaa1('0xf')]?_0x76282c[_0xfaa1('0xf')]:0x2,'callback':_0x76282c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x76282c[_0xfaa1('0x10')]?_0x76282c[_0xfaa1('0x10')]:undefined,'callbackat':_0x76282c[_0xfaa1('0x10')]?moment()[_0xfaa1('0x5')](_0xfaa1('0xd')):undefined};}function handleAlwaysCheckDuplicate(_0x38400f,_0x2e3575,_0x389026,_0x4a4dc6){var _0x7dc186={'phone':_0x389026[_0xfaa1('0x11')]};var _0x4dfdb7={'calleridnum':_0x389026[_0xfaa1('0x11')]};if(_0x4a4dc6){Object[_0xfaa1('0x12')](_0x7dc186,{'CampaignId':_0x2e3575['id']});Object['assign'](_0x4dfdb7,{'CampaignId':_0x2e3575['id']});}else{Object[_0xfaa1('0x12')](_0x7dc186,{'VoiceQueueId':_0x2e3575['id']});Object[_0xfaa1('0x12')](_0x4dfdb7,{'VoiceQueueId':_0x2e3575['id']});}return _0x38400f[_0xfaa1('0x13')][_0xfaa1('0x14')]({'where':_0x7dc186})[_0xfaa1('0x9')](function(_0x52b73b){if(_0x52b73b){throw new Error(_0xfaa1('0x15')+_0x389026[_0xfaa1('0x11')]+_0xfaa1('0x16')+_0x2e3575['id']);}return _0x38400f[_0xfaa1('0x17')][_0xfaa1('0x14')]({'where':_0x4dfdb7});})[_0xfaa1('0x9')](function(_0x31b03c){if(_0x31b03c){throw new Error(_0xfaa1('0x18')+_0x389026[_0xfaa1('0x11')]+_0xfaa1('0x16')+_0x2e3575['id']);}var _0x256aa4=getNewHopperPayload(_0x389026);if(_0x4a4dc6){_0x256aa4[_0xfaa1('0x19')]=_0x2e3575['id'];}else{_0x256aa4[_0xfaa1('0x1a')]=_0x2e3575['id'];}return _0x38400f['CmHopper'][_0xfaa1('0x1b')](_0x256aa4);});}function handleOnlyIfOpenCheckDuplicate(_0x1b4a14,_0x7ddd2b,_0x1805c5,_0x39fe79){var _0x5e8bcd={'phone':_0x1805c5[_0xfaa1('0x11')]};if(_0x39fe79){Object[_0xfaa1('0x12')](_0x5e8bcd,{'CampaignId':_0x7ddd2b['id']});}else{Object[_0xfaa1('0x12')](_0x5e8bcd,{'VoiceQueueId':_0x7ddd2b['id']});}return _0x1b4a14[_0xfaa1('0x13')][_0xfaa1('0x14')]({'where':_0x5e8bcd})[_0xfaa1('0x9')](function(_0x553634){if(_0x553634){throw new Error(_0xfaa1('0x1c')+_0x1805c5['phone']+_0xfaa1('0x16')+_0x7ddd2b['id']);}var _0x3eb26c=getNewHopperPayload(_0x1805c5);if(_0x39fe79){_0x3eb26c['CampaignId']=_0x7ddd2b['id'];}else{_0x3eb26c[_0xfaa1('0x1a')]=_0x7ddd2b['id'];}return _0x1b4a14['CmHopper'][_0xfaa1('0x1b')](_0x3eb26c);});}function handleNeverCheckDuplicate(_0x534ac9,_0x43d199,_0x44745e){var _0x79881=getNewHopperPayload(_0x44745e);_0x79881[_0xfaa1('0x1a')]=_0x43d199['id'];return _0x534ac9[_0xfaa1('0x13')]['create'](_0x79881);}function handleCheckDuplicate(_0xa560c8,_0x399a3f,_0x2be871,_0x545b3e){return getTimezoneCallbackAt(_0xa560c8,_0x399a3f,_0x2be871,_0x545b3e)['then'](function(_0x35010e){_0x2be871[_0xfaa1('0x4')]=_0x35010e;switch(_0x399a3f[_0xfaa1('0x1d')]){case'always':return handleAlwaysCheckDuplicate(_0xa560c8,_0x399a3f,_0x2be871,_0x545b3e);case _0xfaa1('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0xa560c8,_0x399a3f,_0x2be871,_0x545b3e);default:return handleNeverCheckDuplicate(_0xa560c8,_0x399a3f,_0x2be871);}});}function createHopperForVoiceQueues(_0x324073,_0x359166){return _0x324073[_0xfaa1('0x3')][_0xfaa1('0x1f')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0xfaa1('0x7')],'include':[{'model':_0x324073['CmList'],'as':_0xfaa1('0x20'),'where':{'id':_0x359166[_0xfaa1('0xe')]}}],'raw':!![]})[_0xfaa1('0x9')](function(_0x2f6eaf){var _0x4efca7=_0x2f6eaf[_0xfaa1('0x21')](function(_0x50e800){return handleCheckDuplicate(_0x324073,_0x50e800,_0x359166,![]);});return Promise[_0xfaa1('0x22')](_0x4efca7);});}function createHopperForCampaigns(_0x2baff2,_0x234a8d){return _0x2baff2[_0xfaa1('0x23')][_0xfaa1('0x1f')]({'attributes':['id',_0xfaa1('0x1d'),'dialTimezone'],'include':[{'model':_0x2baff2['CmList'],'as':_0xfaa1('0x20'),'where':{'id':_0x234a8d['ListId']}}],'raw':!![]})[_0xfaa1('0x9')](function(_0x33c81a){var _0x1c10e0=_0x33c81a['map'](function(_0x1c064b){return handleCheckDuplicate(_0x2baff2,_0x1c064b,_0x234a8d,!![]);});return Promise[_0xfaa1('0x22')](_0x1c10e0);});}function createHopperBlackForVoiceQueues(_0xe070fa,_0x22087d){return _0xe070fa[_0xfaa1('0x3')][_0xfaa1('0x1f')]({'where':{'type':_0xfaa1('0x24')},'attributes':['id'],'include':[{'model':_0xe070fa[_0xfaa1('0x25')],'as':'BlackLists','where':{'id':_0x22087d[_0xfaa1('0xe')]}}],'raw':!![]})[_0xfaa1('0x9')](function(_0x3b3208){var _0x573ab0=_0x3b3208[_0xfaa1('0x21')](function(_0x108124){return _0xe070fa[_0xfaa1('0x26')][_0xfaa1('0x1b')]({'phone':_0x22087d[_0xfaa1('0x11')],'ContactId':_0x22087d['id'],'ListId':_0x22087d[_0xfaa1('0xe')],'VoiceQueueId':_0x108124['id']});});return Promise[_0xfaa1('0x22')](_0x573ab0);});}function createHopperBlackForCampaigns(_0x27ad0a,_0xfe1a29){return _0x27ad0a[_0xfaa1('0x23')]['findAll']({'attributes':['id'],'include':[{'model':_0x27ad0a[_0xfaa1('0x25')],'as':'BlackLists','where':{'id':_0xfe1a29['ListId']}}],'raw':!![]})[_0xfaa1('0x9')](function(_0x199b47){var _0x2c7af4=_0x199b47[_0xfaa1('0x21')](function(_0x39eb96){return _0x27ad0a['CmHopperBlack'][_0xfaa1('0x1b')]({'phone':_0xfe1a29[_0xfaa1('0x11')],'ContactId':_0xfe1a29['id'],'ListId':_0xfe1a29[_0xfaa1('0xe')],'CampaignId':_0x39eb96['id']});});return Promise[_0xfaa1('0x22')](_0x2c7af4);});}module[_0xfaa1('0x27')]=function(_0x23f641){return _0x23f641[_0xfaa1('0x28')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xfaa1('0x11'),'fields':[_0xfaa1('0x11')]},{'name':_0xfaa1('0x29'),'fields':[_0xfaa1('0x2a'),_0xfaa1('0x2b'),'phone',_0xfaa1('0x2c'),_0xfaa1('0x2d'),_0xfaa1('0x2e')],'type':_0xfaa1('0x2f')}],'timestamps':!![],'charset':_0xfaa1('0x30'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x18b2a0,_0x3ef6de,_0x47fd9c){var _0x473649=_0x23f641[_0xfaa1('0x31')];var _0x182182=_0x18b2a0['get']({'plain':!![]});if(!_0x182182[_0xfaa1('0xe')]){logger[_0xfaa1('0x32')](_0xfaa1('0x33')+_0x182182['id']);return _0x47fd9c();}if(!_0x182182[_0xfaa1('0x11')]){return _0x47fd9c();}return createHopperForVoiceQueues(_0x473649,_0x182182)[_0xfaa1('0x9')](function(){return createHopperBlackForVoiceQueues(_0x473649,_0x182182);})['then'](function(){return createHopperForCampaigns(_0x473649,_0x182182);})[_0xfaa1('0x9')](function(){return createHopperBlackForCampaigns(_0x473649,_0x182182);})[_0xfaa1('0x9')](function(){return _0x47fd9c();})['catch'](function(_0x5e3474){logger[_0xfaa1('0x32')](_0xfaa1('0x34'),_0x5e3474[_0xfaa1('0x35')]);_0x47fd9c();});},'afterDestroy':function(_0x4a1d85,_0x4afd33,_0x475c6f){var _0x59b2c3=_0x23f641[_0xfaa1('0x31')];var _0x1dea83=_0x4a1d85[_0xfaa1('0x36')]({'plain':!![]});return _0x59b2c3[_0xfaa1('0x13')][_0xfaa1('0x1f')]({'raw':!![],'where':{'ListId':_0x1dea83['ListId'],'ContactId':_0x1dea83['id']}})['then'](function(_0x12b705){if(!_[_0xfaa1('0x37')](_0x12b705)){var _0x1a0505=[];for(var _0x37015f=0x0;_0x37015f<_0x12b705['length'];_0x37015f+=0x1){var _0xfb35bf=_0x59b2c3[_0xfaa1('0x13')][_0xfaa1('0x38')]({'where':{'ListId':_0x12b705[_0x37015f][_0xfaa1('0xe')],'ContactId':_0x12b705[_0x37015f][_0xfaa1('0x39')],'VoiceQueueId':_0x12b705[_0x37015f][_0xfaa1('0x1a')],'CampaignId':_0x12b705[_0x37015f][_0xfaa1('0x19')]}});_0x1a0505['push'](_0xfb35bf);}return Promise[_0xfaa1('0x22')](_0x1a0505);}})[_0xfaa1('0x9')](function(_0x410722){logger[_0xfaa1('0x3a')](_0xfaa1('0x3b'),util[_0xfaa1('0x3c')](_0x410722,{'showHidden':![],'depth':null}));_0x475c6f();})[_0xfaa1('0x3d')](function(_0x56409d){logger['error'](_0xfaa1('0x3e'),util[_0xfaa1('0x3c')](_0x56409d,{'showHidden':![],'depth':null}));_0x475c6f(_0x56409d);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 792b5b4..cc95ccf 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(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x473c19,_0xfef948){var _0x2de17e=function(_0x28c217){while(--_0x28c217){_0x473c19['push'](_0x473c19['shift']());}};_0x2de17e(++_0xfef948);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 95d7734..4f86c20 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 _0x31c2=['sequelize','STRING','INTEGER','PHONE'];(function(_0x194ff7,_0x4bd014){var _0x4f9b77=function(_0x587333){while(--_0x587333){_0x194ff7['push'](_0x194ff7['shift']());}};_0x4f9b77(++_0x4bd014);}(_0x31c2,0x98));var _0x231c=function(_0xb51f17,_0x13fbc4){_0xb51f17=_0xb51f17-0x0;var _0x5efde8=_0x31c2[_0xb51f17];return _0x5efde8;};'use strict';var Sequelize=require(_0x231c('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x231c('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x231c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x231c('0x3')},'OrderBy':{'type':Sequelize[_0x231c('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x231c('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x7b05=['STRING','sequelize','exports','INTEGER'];(function(_0x3c114e,_0x15b5c7){var _0x2083bf=function(_0x2baa57){while(--_0x2baa57){_0x3c114e['push'](_0x3c114e['shift']());}};_0x2083bf(++_0x15b5c7);}(_0x7b05,0x91));var _0x57b0=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x7b05[_0x39fd11];return _0x302799;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'CmContactId':{'type':Sequelize[_0x57b0('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x57b0('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 35bc225..083b769 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 _0x3430=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','name','send','index','map','CmContactHasItem','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x4dfd8a,_0x476a02){var _0x5aeac9=function(_0x3aa276){while(--_0x3aa276){_0x4dfd8a['push'](_0x4dfd8a['shift']());}};_0x5aeac9(++_0x476a02);}(_0x3430,0x1bf));var _0x0343=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x3430[_0x2ed8f3];return _0x525a55;};'use strict';var emlformat=require(_0x0343('0x0'));var rimraf=require(_0x0343('0x1'));var zipdir=require(_0x0343('0x2'));var jsonpatch=require(_0x0343('0x3'));var rp=require(_0x0343('0x4'));var moment=require('moment');var BPromise=require(_0x0343('0x5'));var Mustache=require(_0x0343('0x6'));var util=require(_0x0343('0x7'));var path=require('path');var sox=require(_0x0343('0x8'));var csv=require('to-csv');var ejs=require(_0x0343('0x9'));var fs=require('fs');var fs_extra=require(_0x0343('0xa'));var _=require('lodash');var squel=require(_0x0343('0xb'));var crypto=require(_0x0343('0xc'));var jsforce=require(_0x0343('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0343('0xe'));var querystring=require(_0x0343('0xf'));var Papa=require('papaparse');var Redis=require(_0x0343('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0343('0x11'));var hardwareService=require(_0x0343('0x12'));var logger=require(_0x0343('0x13'))(_0x0343('0x14'));var utils=require('../../config/utils');var config=require(_0x0343('0x15'));var licenseUtil=require(_0x0343('0x16'));var db=require(_0x0343('0x17'))['db'];function respondWithStatusCode(_0x4d8450,_0x3a4a45){_0x3a4a45=_0x3a4a45||0xcc;return function(_0x56e121){if(_0x56e121){return _0x4d8450[_0x0343('0x18')](_0x3a4a45);}return _0x4d8450[_0x0343('0x19')](_0x3a4a45)[_0x0343('0x1a')]();};}function respondWithResult(_0x35d3e1,_0x52bb78){_0x52bb78=_0x52bb78||0xc8;return function(_0x2e3c85){if(_0x2e3c85){return _0x35d3e1[_0x0343('0x19')](_0x52bb78)[_0x0343('0x1b')](_0x2e3c85);}};}function respondWithFilteredResult(_0x3ba9ba,_0x59a6c4){return function(_0x1bf6e3){if(_0x1bf6e3){var _0x36e939=typeof _0x59a6c4['offset']===_0x0343('0x1c')&&typeof _0x59a6c4[_0x0343('0x1d')]==='undefined';var _0x25fb84=_0x1bf6e3['count'];var _0x2de5e2=_0x36e939?0x0:_0x59a6c4['offset'];var _0x13b1b8=_0x36e939?_0x1bf6e3[_0x0343('0x1e')]:_0x59a6c4[_0x0343('0x1f')]+_0x59a6c4[_0x0343('0x1d')];var _0x38dc02;if(_0x13b1b8>=_0x25fb84){_0x13b1b8=_0x25fb84;_0x38dc02=0xc8;}else{_0x38dc02=0xce;}_0x3ba9ba['status'](_0x38dc02);return _0x3ba9ba[_0x0343('0x20')](_0x0343('0x21'),_0x2de5e2+'-'+_0x13b1b8+'/'+_0x25fb84)[_0x0343('0x1b')](_0x1bf6e3);}return null;};}function patchUpdates(_0xe2460c){return function(_0x2fcadb){try{jsonpatch[_0x0343('0x22')](_0x2fcadb,_0xe2460c,!![]);}catch(_0x257ca6){return BPromise['reject'](_0x257ca6);}return _0x2fcadb[_0x0343('0x23')]();};}function saveUpdates(_0x17a378,_0x11a167){return function(_0x3de1b4){if(_0x3de1b4){return _0x3de1b4[_0x0343('0x24')](_0x17a378)[_0x0343('0x25')](function(_0x1ee265){return _0x1ee265;});}return null;};}function removeEntity(_0x53de9e,_0x13f4ab){return function(_0x31100e){if(_0x31100e){return _0x31100e['destroy']()[_0x0343('0x25')](function(){var _0x334f98=_0x31100e[_0x0343('0x26')]({'plain':!![]});var _0x3c8e53=_0x0343('0x27');return db[_0x0343('0x28')][_0x0343('0x29')]({'where':{'type':_0x3c8e53,'resourceId':_0x334f98['id']}})[_0x0343('0x25')](function(){return _0x31100e;});})[_0x0343('0x25')](function(){_0x53de9e[_0x0343('0x19')](0xcc)[_0x0343('0x1a')]();});}};}function handleEntityNotFound(_0x27dc51,_0x3adb02){return function(_0x5b6088){if(!_0x5b6088){_0x27dc51[_0x0343('0x18')](0x194);}return _0x5b6088;};}function handleError(_0xa1cd34,_0x3dd7a9){_0x3dd7a9=_0x3dd7a9||0x1f4;return function(_0x5d467a){logger[_0x0343('0x2a')](_0x5d467a['stack']);if(_0x5d467a[_0x0343('0x2b')]){delete _0x5d467a[_0x0343('0x2b')];}_0xa1cd34[_0x0343('0x19')](_0x3dd7a9)[_0x0343('0x2c')](_0x5d467a);};}exports[_0x0343('0x2d')]=function(_0x33ece9,_0x34877c){var _0x24a8cc={},_0x429ac2={},_0xb84952={'count':0x0,'rows':[]};var _0x133dce=_[_0x0343('0x2e')](db[_0x0343('0x2f')][_0x0343('0x30')],function(_0x3a9845){return{'name':_0x3a9845['fieldName'],'type':_0x3a9845['type'][_0x0343('0x31')]};});_0x429ac2[_0x0343('0x32')]=_['map'](_0x133dce,_0x0343('0x2b'));_0x429ac2[_0x0343('0x33')]=_[_0x0343('0x34')](_0x33ece9[_0x0343('0x33')]);_0x429ac2[_0x0343('0x35')]=_[_0x0343('0x36')](_0x429ac2[_0x0343('0x32')],_0x429ac2[_0x0343('0x33')]);_0x24a8cc['attributes']=_['intersection'](_0x429ac2[_0x0343('0x32')],qs[_0x0343('0x37')](_0x33ece9['query'][_0x0343('0x37')]));_0x24a8cc[_0x0343('0x38')]=_0x24a8cc['attributes'][_0x0343('0x39')]?_0x24a8cc[_0x0343('0x38')]:_0x429ac2[_0x0343('0x32')];if(!_0x33ece9[_0x0343('0x33')][_0x0343('0x3a')](_0x0343('0x3b'))){_0x24a8cc[_0x0343('0x1d')]=qs['limit'](_0x33ece9[_0x0343('0x33')][_0x0343('0x1d')]);_0x24a8cc[_0x0343('0x1f')]=qs[_0x0343('0x1f')](_0x33ece9['query']['offset']);}_0x24a8cc[_0x0343('0x3c')]=qs[_0x0343('0x3d')](_0x33ece9['query'][_0x0343('0x3d')]);_0x24a8cc[_0x0343('0x3e')]=qs[_0x0343('0x35')](_[_0x0343('0x3f')](_0x33ece9[_0x0343('0x33')],_0x429ac2['filters']),_0x133dce);if(_0x33ece9['query'][_0x0343('0x40')]){_0x24a8cc[_0x0343('0x3e')]=_[_0x0343('0x41')](_0x24a8cc[_0x0343('0x3e')],{'$or':_['map'](_0x133dce,function(_0x135729){if(_0x135729[_0x0343('0x42')]!==_0x0343('0x43')){var _0x32ba4c={};_0x32ba4c[_0x135729[_0x0343('0x2b')]]={'$like':'%'+_0x33ece9['query']['filter']+'%'};return _0x32ba4c;}})});}_0x24a8cc=_[_0x0343('0x41')]({},_0x24a8cc,_0x33ece9[_0x0343('0x44')]);var _0x4f321f={'where':_0x24a8cc[_0x0343('0x3e')]};return db[_0x0343('0x2f')][_0x0343('0x1e')](_0x4f321f)[_0x0343('0x25')](function(_0x4cfc4c){_0xb84952[_0x0343('0x1e')]=_0x4cfc4c;if(_0x33ece9['query'][_0x0343('0x45')]){_0x24a8cc[_0x0343('0x46')]=[{'all':!![]}];}return db[_0x0343('0x2f')]['findAll'](_0x24a8cc);})[_0x0343('0x25')](function(_0x5e7343){_0xb84952[_0x0343('0x47')]=_0x5e7343;return _0xb84952;})[_0x0343('0x25')](respondWithFilteredResult(_0x34877c,_0x24a8cc))[_0x0343('0x48')](handleError(_0x34877c,null));};exports[_0x0343('0x49')]=function(_0x4cdf40,_0xbdc33b){var _0x5c0879={'raw':!![],'where':{'id':_0x4cdf40[_0x0343('0x4a')]['id']}},_0x1e803d={};_0x1e803d[_0x0343('0x32')]=_[_0x0343('0x34')](db[_0x0343('0x2f')][_0x0343('0x30')]);_0x1e803d[_0x0343('0x33')]=_[_0x0343('0x34')](_0x4cdf40[_0x0343('0x33')]);_0x1e803d[_0x0343('0x35')]=_[_0x0343('0x36')](_0x1e803d[_0x0343('0x32')],_0x1e803d['query']);_0x5c0879['attributes']=_[_0x0343('0x36')](_0x1e803d[_0x0343('0x32')],qs['fields'](_0x4cdf40['query'][_0x0343('0x37')]));_0x5c0879[_0x0343('0x38')]=_0x5c0879['attributes'][_0x0343('0x39')]?_0x5c0879[_0x0343('0x38')]:_0x1e803d[_0x0343('0x32')];if(_0x4cdf40[_0x0343('0x33')]['includeAll']){_0x5c0879['include']=[{'all':!![]}];}_0x5c0879=_[_0x0343('0x41')]({},_0x5c0879,_0x4cdf40[_0x0343('0x44')]);return db[_0x0343('0x2f')][_0x0343('0x4b')](_0x5c0879)[_0x0343('0x25')](handleEntityNotFound(_0xbdc33b,null))[_0x0343('0x25')](respondWithResult(_0xbdc33b,null))[_0x0343('0x48')](handleError(_0xbdc33b,null));};exports[_0x0343('0x4c')]=function(_0x1637fd,_0x155929){return db[_0x0343('0x2f')][_0x0343('0x4c')](_0x1637fd[_0x0343('0x4d')],{})[_0x0343('0x25')](function(_0x302a90){var _0x39a038=_0x1637fd['user'][_0x0343('0x26')]({'plain':!![]});if(!_0x39a038)throw new Error(_0x0343('0x4e'));if(_0x39a038[_0x0343('0x4f')]===_0x0343('0x50')){var _0x405460=_0x302a90[_0x0343('0x26')]({'plain':!![]});var _0xe790b7='CmContactHasItems';return db[_0x0343('0x51')]['find']({'where':{'name':_0xe790b7,'userProfileId':_0x39a038[_0x0343('0x52')]},'raw':!![]})['then'](function(_0x5c0f13){if(_0x5c0f13&&_0x5c0f13['autoAssociation']===0x0){return db['UserProfileResource'][_0x0343('0x4c')]({'name':_0x405460['name'],'resourceId':_0x405460['id'],'type':_0x5c0f13[_0x0343('0x2b')],'sectionId':_0x5c0f13['id']},{})[_0x0343('0x25')](function(){return _0x302a90;});}else{return _0x302a90;}})['catch'](function(_0xd07c67){logger[_0x0343('0x2a')](_0x0343('0x53'),_0xd07c67);throw _0xd07c67;});}return _0x302a90;})[_0x0343('0x25')](respondWithResult(_0x155929,0xc9))[_0x0343('0x48')](handleError(_0x155929,null));};exports['update']=function(_0x574ec8,_0x5e2c56){if(_0x574ec8[_0x0343('0x4d')]['id']){delete _0x574ec8[_0x0343('0x4d')]['id'];}return db[_0x0343('0x2f')][_0x0343('0x4b')]({'where':{'id':_0x574ec8[_0x0343('0x4a')]['id']}})[_0x0343('0x25')](handleEntityNotFound(_0x5e2c56,null))['then'](saveUpdates(_0x574ec8[_0x0343('0x4d')],null))['then'](respondWithResult(_0x5e2c56,null))[_0x0343('0x48')](handleError(_0x5e2c56,null));};exports['destroy']=function(_0x53f778,_0xef7095){return db[_0x0343('0x2f')]['find']({'where':{'id':_0x53f778[_0x0343('0x4a')]['id']}})['then'](handleEntityNotFound(_0xef7095,null))[_0x0343('0x25')](removeEntity(_0xef7095,null))[_0x0343('0x48')](handleError(_0xef7095,null));}; \ No newline at end of file +var _0x9a79=['apply','reject','update','then','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','CmContactHasItem','rows','catch','params','includeAll','include','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set'];(function(_0x3fc0e7,_0x2b971e){var _0x1e2d2f=function(_0x9e392a){while(--_0x9e392a){_0x3fc0e7['push'](_0x3fc0e7['shift']());}};_0x1e2d2f(++_0x2b971e);}(_0x9a79,0x1b7));var _0x99a7=function(_0x32bdd4,_0x143a69){_0x32bdd4=_0x32bdd4-0x0;var _0x4b54d3=_0x9a79[_0x32bdd4];return _0x4b54d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x99a7('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x99a7('0x1'));var Mustache=require(_0x99a7('0x2'));var util=require(_0x99a7('0x3'));var path=require(_0x99a7('0x4'));var sox=require(_0x99a7('0x5'));var csv=require('to-csv');var ejs=require(_0x99a7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x99a7('0x7'));var crypto=require(_0x99a7('0x8'));var jsforce=require(_0x99a7('0x9'));var deskjs=require(_0x99a7('0xa'));var toCsv=require(_0x99a7('0xb'));var querystring=require('querystring');var Papa=require(_0x99a7('0xc'));var Redis=require('ioredis');var authService=require(_0x99a7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x99a7('0xe'));var hardwareService=require(_0x99a7('0xf'));var logger=require(_0x99a7('0x10'))('api');var utils=require(_0x99a7('0x11'));var config=require(_0x99a7('0x12'));var licenseUtil=require(_0x99a7('0x13'));var db=require(_0x99a7('0x14'))['db'];function respondWithStatusCode(_0x4a6f0f,_0x430102){_0x430102=_0x430102||0xcc;return function(_0x2b5d05){if(_0x2b5d05){return _0x4a6f0f[_0x99a7('0x15')](_0x430102);}return _0x4a6f0f[_0x99a7('0x16')](_0x430102)[_0x99a7('0x17')]();};}function respondWithResult(_0xff2809,_0x59f104){_0x59f104=_0x59f104||0xc8;return function(_0x56955a){if(_0x56955a){return _0xff2809[_0x99a7('0x16')](_0x59f104)[_0x99a7('0x18')](_0x56955a);}};}function respondWithFilteredResult(_0x3363d3,_0x4f016a){return function(_0x56f6d9){if(_0x56f6d9){var _0x7c2099=typeof _0x4f016a[_0x99a7('0x19')]===_0x99a7('0x1a')&&typeof _0x4f016a['limit']===_0x99a7('0x1a');var _0x41efac=_0x56f6d9['count'];var _0x137820=_0x7c2099?0x0:_0x4f016a[_0x99a7('0x19')];var _0x54204b=_0x7c2099?_0x56f6d9[_0x99a7('0x1b')]:_0x4f016a[_0x99a7('0x19')]+_0x4f016a['limit'];var _0x16a935;if(_0x54204b>=_0x41efac){_0x54204b=_0x41efac;_0x16a935=0xc8;}else{_0x16a935=0xce;}_0x3363d3[_0x99a7('0x16')](_0x16a935);return _0x3363d3[_0x99a7('0x1c')]('Content-Range',_0x137820+'-'+_0x54204b+'/'+_0x41efac)[_0x99a7('0x18')](_0x56f6d9);}return null;};}function patchUpdates(_0x1e0ac1){return function(_0x4bf6cc){try{jsonpatch[_0x99a7('0x1d')](_0x4bf6cc,_0x1e0ac1,!![]);}catch(_0x5f5a86){return BPromise[_0x99a7('0x1e')](_0x5f5a86);}return _0x4bf6cc['save']();};}function saveUpdates(_0x8feb67,_0x4e40ae){return function(_0x5c2498){if(_0x5c2498){return _0x5c2498[_0x99a7('0x1f')](_0x8feb67)['then'](function(_0x3704d3){return _0x3704d3;});}return null;};}function removeEntity(_0x24542f,_0xb7d28){return function(_0x176ea7){if(_0x176ea7){return _0x176ea7['destroy']()[_0x99a7('0x20')](function(){var _0x51477d=_0x176ea7['get']({'plain':!![]});var _0xd03169=_0x99a7('0x21');return db[_0x99a7('0x22')][_0x99a7('0x23')]({'where':{'type':_0xd03169,'resourceId':_0x51477d['id']}})[_0x99a7('0x20')](function(){return _0x176ea7;});})['then'](function(){_0x24542f['status'](0xcc)[_0x99a7('0x17')]();});}};}function handleEntityNotFound(_0x8d6195,_0x5dbda6){return function(_0x349f84){if(!_0x349f84){_0x8d6195[_0x99a7('0x15')](0x194);}return _0x349f84;};}function handleError(_0x27d615,_0x4a302d){_0x4a302d=_0x4a302d||0x1f4;return function(_0x479197){logger[_0x99a7('0x24')](_0x479197[_0x99a7('0x25')]);if(_0x479197[_0x99a7('0x26')]){delete _0x479197[_0x99a7('0x26')];}_0x27d615[_0x99a7('0x16')](_0x4a302d)[_0x99a7('0x27')](_0x479197);};}exports[_0x99a7('0x28')]=function(_0x2fef38,_0x399db8){var _0x1069cf={},_0x92056={},_0xe9c32={'count':0x0,'rows':[]};var _0x1865e2=_[_0x99a7('0x29')](db['CmContactHasItem'][_0x99a7('0x2a')],function(_0x4f46f5){return{'name':_0x4f46f5['fieldName'],'type':_0x4f46f5['type']['key']};});_0x92056[_0x99a7('0x2b')]=_[_0x99a7('0x29')](_0x1865e2,_0x99a7('0x26'));_0x92056[_0x99a7('0x2c')]=_[_0x99a7('0x2d')](_0x2fef38[_0x99a7('0x2c')]);_0x92056[_0x99a7('0x2e')]=_['intersection'](_0x92056[_0x99a7('0x2b')],_0x92056['query']);_0x1069cf[_0x99a7('0x2f')]=_[_0x99a7('0x30')](_0x92056[_0x99a7('0x2b')],qs[_0x99a7('0x31')](_0x2fef38['query'][_0x99a7('0x31')]));_0x1069cf[_0x99a7('0x2f')]=_0x1069cf['attributes'][_0x99a7('0x32')]?_0x1069cf['attributes']:_0x92056['model'];if(!_0x2fef38[_0x99a7('0x2c')][_0x99a7('0x33')](_0x99a7('0x34'))){_0x1069cf['limit']=qs[_0x99a7('0x35')](_0x2fef38[_0x99a7('0x2c')][_0x99a7('0x35')]);_0x1069cf[_0x99a7('0x19')]=qs['offset'](_0x2fef38[_0x99a7('0x2c')]['offset']);}_0x1069cf[_0x99a7('0x36')]=qs[_0x99a7('0x37')](_0x2fef38['query']['sort']);_0x1069cf['where']=qs[_0x99a7('0x2e')](_[_0x99a7('0x38')](_0x2fef38[_0x99a7('0x2c')],_0x92056['filters']),_0x1865e2);if(_0x2fef38['query'][_0x99a7('0x39')]){_0x1069cf[_0x99a7('0x3a')]=_[_0x99a7('0x3b')](_0x1069cf['where'],{'$or':_[_0x99a7('0x29')](_0x1865e2,function(_0xd88ca8){if(_0xd88ca8[_0x99a7('0x3c')]!==_0x99a7('0x3d')){var _0x34b35b={};_0x34b35b[_0xd88ca8['name']]={'$like':'%'+_0x2fef38[_0x99a7('0x2c')][_0x99a7('0x39')]+'%'};return _0x34b35b;}})});}_0x1069cf=_[_0x99a7('0x3b')]({},_0x1069cf,_0x2fef38[_0x99a7('0x3e')]);var _0x42221c={'where':_0x1069cf[_0x99a7('0x3a')]};return db[_0x99a7('0x3f')][_0x99a7('0x1b')](_0x42221c)[_0x99a7('0x20')](function(_0x2c29ad){_0xe9c32[_0x99a7('0x1b')]=_0x2c29ad;if(_0x2fef38[_0x99a7('0x2c')]['includeAll']){_0x1069cf['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x1069cf);})[_0x99a7('0x20')](function(_0xbafaf4){_0xe9c32[_0x99a7('0x40')]=_0xbafaf4;return _0xe9c32;})['then'](respondWithFilteredResult(_0x399db8,_0x1069cf))[_0x99a7('0x41')](handleError(_0x399db8,null));};exports['show']=function(_0x1167a7,_0x50273f){var _0xa2ffe4={'raw':!![],'where':{'id':_0x1167a7[_0x99a7('0x42')]['id']}},_0x47b659={};_0x47b659['model']=_[_0x99a7('0x2d')](db[_0x99a7('0x3f')]['rawAttributes']);_0x47b659[_0x99a7('0x2c')]=_[_0x99a7('0x2d')](_0x1167a7['query']);_0x47b659[_0x99a7('0x2e')]=_[_0x99a7('0x30')](_0x47b659['model'],_0x47b659[_0x99a7('0x2c')]);_0xa2ffe4[_0x99a7('0x2f')]=_[_0x99a7('0x30')](_0x47b659[_0x99a7('0x2b')],qs[_0x99a7('0x31')](_0x1167a7[_0x99a7('0x2c')][_0x99a7('0x31')]));_0xa2ffe4['attributes']=_0xa2ffe4['attributes'][_0x99a7('0x32')]?_0xa2ffe4['attributes']:_0x47b659[_0x99a7('0x2b')];if(_0x1167a7[_0x99a7('0x2c')][_0x99a7('0x43')]){_0xa2ffe4[_0x99a7('0x44')]=[{'all':!![]}];}_0xa2ffe4=_[_0x99a7('0x3b')]({},_0xa2ffe4,_0x1167a7[_0x99a7('0x3e')]);return db[_0x99a7('0x3f')]['find'](_0xa2ffe4)[_0x99a7('0x20')](handleEntityNotFound(_0x50273f,null))[_0x99a7('0x20')](respondWithResult(_0x50273f,null))[_0x99a7('0x41')](handleError(_0x50273f,null));};exports['create']=function(_0xdc9dde,_0x37e1cd){return db[_0x99a7('0x3f')]['create'](_0xdc9dde[_0x99a7('0x45')],{})['then'](function(_0x40ac32){var _0x1c569b=_0xdc9dde['user'][_0x99a7('0x46')]({'plain':!![]});if(!_0x1c569b)throw new Error(_0x99a7('0x47'));if(_0x1c569b[_0x99a7('0x48')]===_0x99a7('0x49')){var _0x5e033a=_0x40ac32['get']({'plain':!![]});var _0x3613d7='CmContactHasItems';return db['UserProfileSection']['find']({'where':{'name':_0x3613d7,'userProfileId':_0x1c569b[_0x99a7('0x4a')]},'raw':!![]})[_0x99a7('0x20')](function(_0xebd9ca){if(_0xebd9ca&&_0xebd9ca['autoAssociation']===0x0){return db['UserProfileResource'][_0x99a7('0x4b')]({'name':_0x5e033a[_0x99a7('0x26')],'resourceId':_0x5e033a['id'],'type':_0xebd9ca['name'],'sectionId':_0xebd9ca['id']},{})['then'](function(){return _0x40ac32;});}else{return _0x40ac32;}})['catch'](function(_0x47272e){logger[_0x99a7('0x24')](_0x99a7('0x4c'),_0x47272e);throw _0x47272e;});}return _0x40ac32;})[_0x99a7('0x20')](respondWithResult(_0x37e1cd,0xc9))[_0x99a7('0x41')](handleError(_0x37e1cd,null));};exports[_0x99a7('0x1f')]=function(_0x5c1bd4,_0x4ae241){if(_0x5c1bd4['body']['id']){delete _0x5c1bd4['body']['id'];}return db[_0x99a7('0x3f')][_0x99a7('0x4d')]({'where':{'id':_0x5c1bd4[_0x99a7('0x42')]['id']}})[_0x99a7('0x20')](handleEntityNotFound(_0x4ae241,null))[_0x99a7('0x20')](saveUpdates(_0x5c1bd4[_0x99a7('0x45')],null))[_0x99a7('0x20')](respondWithResult(_0x4ae241,null))[_0x99a7('0x41')](handleError(_0x4ae241,null));};exports[_0x99a7('0x23')]=function(_0x27b306,_0x315f07){return db[_0x99a7('0x3f')][_0x99a7('0x4d')]({'where':{'id':_0x27b306[_0x99a7('0x42')]['id']}})[_0x99a7('0x20')](handleEntityNotFound(_0x315f07,null))[_0x99a7('0x20')](removeEntity(_0x315f07,null))[_0x99a7('0x41')](handleError(_0x315f07,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2a296fb..e9a333a 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 _0xef87=['rimraf','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','path'];(function(_0x7d4647,_0x1c19f0){var _0x21d775=function(_0x11508f){while(--_0x11508f){_0x7d4647['push'](_0x7d4647['shift']());}};_0x21d775(++_0x1c19f0);}(_0xef87,0x1ab));var _0x7ef8=function(_0xf9f713,_0x5e1624){_0xf9f713=_0xf9f713-0x0;var _0x3e9bb6=_0xef87[_0xf9f713];return _0x3e9bb6;};'use strict';var _=require(_0x7ef8('0x0'));var util=require(_0x7ef8('0x1'));var logger=require(_0x7ef8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7ef8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ef8('0x4'));var rimraf=require(_0x7ef8('0x5'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x7ef8('0x6')]=function(_0x54b6a3,_0x260e0c){return _0x54b6a3['define'](_0x7ef8('0x7'),attributes,{'tableName':_0x7ef8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea44=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x47971f,_0x24f07e){var _0x1e8c49=function(_0x3af2e8){while(--_0x3af2e8){_0x47971f['push'](_0x47971f['shift']());}};_0x1e8c49(++_0x24f07e);}(_0xea44,0x12b));var _0x4ea4=function(_0x5c5da3,_0x23951a){_0x5c5da3=_0x5c5da3-0x0;var _0x1167bd=_0xea44[_0x5c5da3];return _0x1167bd;};'use strict';var _=require('lodash');var util=require(_0x4ea4('0x0'));var logger=require(_0x4ea4('0x1'))(_0x4ea4('0x2'));var moment=require(_0x4ea4('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ea4('0x4'));var fs=require('fs');var path=require(_0x4ea4('0x5'));var rimraf=require(_0x4ea4('0x6'));var config=require(_0x4ea4('0x7'));var attributes=require(_0x4ea4('0x8'));module[_0x4ea4('0x9')]=function(_0x327ccc,_0x3134df){return _0x327ccc[_0x4ea4('0xa')](_0x4ea4('0xb'),attributes,{'tableName':_0x4ea4('0xc'),'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 a8e4bac..127c09a 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 _0x8dad=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x5db7b8,_0x3faaeb){var _0x521eb5=function(_0x17ee00){while(--_0x17ee00){_0x5db7b8['push'](_0x5db7b8['shift']());}};_0x521eb5(++_0x3faaeb);}(_0x8dad,0x82));var _0xd8da=function(_0x31617d,_0x28084f){_0x31617d=_0x31617d-0x0;var _0x3eda04=_0x8dad[_0x31617d];return _0x3eda04;};'use strict';var _=require(_0xd8da('0x0'));var util=require(_0xd8da('0x1'));var moment=require(_0xd8da('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8da('0x3'));var fs=require('fs');var Redis=require(_0xd8da('0x4'));var db=require(_0xd8da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8da('0x6'))(_0xd8da('0x7'));var config=require(_0xd8da('0x8'));var jayson=require(_0xd8da('0x9'));var client=jayson[_0xd8da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x294d74,_0x516896,_0x125f1f){return new BPromise(function(_0x1b7e1a,_0x3ab2e3){return client[_0xd8da('0xb')](_0x294d74,_0x125f1f)['then'](function(_0x7227c2){logger[_0xd8da('0xc')](_0xd8da('0xd'),_0x516896,'request\x20sent');logger[_0xd8da('0xe')](_0xd8da('0xf'),_0x516896,'request\x20sent',JSON[_0xd8da('0x10')](_0x7227c2));if(_0x7227c2[_0xd8da('0x11')]){if(_0x7227c2[_0xd8da('0x11')][_0xd8da('0x12')]===0x1f4){logger[_0xd8da('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x516896,_0x7227c2[_0xd8da('0x11')][_0xd8da('0x13')]);return _0x3ab2e3(_0x7227c2['error']['message']);}logger[_0xd8da('0x11')](_0xd8da('0xd'),_0x516896,_0x7227c2['error'][_0xd8da('0x13')]);return _0x1b7e1a(_0x7227c2[_0xd8da('0x11')][_0xd8da('0x13')]);}else{logger[_0xd8da('0xc')](_0xd8da('0xd'),_0x516896,_0xd8da('0x14'));_0x1b7e1a(_0x7227c2[_0xd8da('0x15')]['message']);}})['catch'](function(_0x5ed482){logger[_0xd8da('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x516896,_0x5ed482);_0x3ab2e3(_0x5ed482);});});} \ No newline at end of file +var _0x57b2=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then'];(function(_0x101a61,_0x43011c){var _0x51d456=function(_0x2be688){while(--_0x2be688){_0x101a61['push'](_0x101a61['shift']());}};_0x51d456(++_0x43011c);}(_0x57b2,0xda));var _0x257b=function(_0x488174,_0x18080f){_0x488174=_0x488174-0x0;var _0x58fef1=_0x57b2[_0x488174];return _0x58fef1;};'use strict';var _=require(_0x257b('0x0'));var util=require(_0x257b('0x1'));var moment=require(_0x257b('0x2'));var BPromise=require(_0x257b('0x3'));var rs=require(_0x257b('0x4'));var fs=require('fs');var Redis=require(_0x257b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x257b('0x6'));var logger=require(_0x257b('0x7'))(_0x257b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1adf73,_0x4a5c36,_0x873b77){return new BPromise(function(_0xa58e13,_0x19f8dc){return client['request'](_0x1adf73,_0x873b77)[_0x257b('0x9')](function(_0x45eca9){logger['info'](_0x257b('0xa'),_0x4a5c36,_0x257b('0xb'));logger[_0x257b('0xc')](_0x257b('0xd'),_0x4a5c36,_0x257b('0xb'),JSON[_0x257b('0xe')](_0x45eca9));if(_0x45eca9[_0x257b('0xf')]){if(_0x45eca9[_0x257b('0xf')][_0x257b('0x10')]===0x1f4){logger[_0x257b('0xf')](_0x257b('0xa'),_0x4a5c36,_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);return _0x19f8dc(_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);}logger['error'](_0x257b('0xa'),_0x4a5c36,_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);return _0xa58e13(_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4a5c36,_0x257b('0xb'));_0xa58e13(_0x45eca9['result'][_0x257b('0x11')]);}})[_0x257b('0x12')](function(_0x317e86){logger[_0x257b('0xf')](_0x257b('0xa'),_0x4a5c36,_0x317e86);_0x19f8dc(_0x317e86);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 357d5be..e60fa90 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 _0x7af9=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post'];(function(_0x47a1eb,_0x1128d8){var _0x3bcec6=function(_0x222d70){while(--_0x222d70){_0x47a1eb['push'](_0x47a1eb['shift']());}};_0x3bcec6(++_0x1128d8);}(_0x7af9,0x7c));var _0x97af=function(_0x1caacf,_0x1732dd){_0x1caacf=_0x1caacf-0x0;var _0x257fb9=_0x7af9[_0x1caacf];return _0x257fb9;};'use strict';var multer=require(_0x97af('0x0'));var util=require(_0x97af('0x1'));var path=require(_0x97af('0x2'));var timeout=require(_0x97af('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97af('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x97af('0x5'));var config=require('../../config/environment');var controller=require(_0x97af('0x6'));router['get']('/',auth[_0x97af('0x7')](),controller[_0x97af('0x8')]);router['get'](_0x97af('0x9'),auth[_0x97af('0x7')](),controller[_0x97af('0xa')]);router[_0x97af('0xb')]('/',auth[_0x97af('0x7')](),controller['create']);router[_0x97af('0xc')](_0x97af('0x9'),auth['isAuthenticated'](),controller[_0x97af('0xd')]);router[_0x97af('0xe')]('/:id',auth[_0x97af('0x7')](),controller[_0x97af('0xf')]);module[_0x97af('0x10')]=router; \ No newline at end of file +var _0x64b7=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x64b7,0x78));var _0x764b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x64b7[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x764b('0x0'));var util=require(_0x764b('0x1'));var path=require(_0x764b('0x2'));var timeout=require(_0x764b('0x3'));var express=require(_0x764b('0x4'));var router=express['Router']();var fs_extra=require(_0x764b('0x5'));var auth=require(_0x764b('0x6'));var interaction=require(_0x764b('0x7'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x764b('0x8')]('/',auth[_0x764b('0x9')](),controller[_0x764b('0xa')]);router[_0x764b('0x8')](_0x764b('0xb'),auth[_0x764b('0x9')](),controller[_0x764b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x764b('0xd')]);router[_0x764b('0xe')](_0x764b('0xb'),auth[_0x764b('0x9')](),controller[_0x764b('0xf')]);router[_0x764b('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x764b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a83dadd..55c4ce0 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 _0xee79=['alias','setDataValue','name','STRING','TEXT','long','getDataValue','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xee79,0x10e));var _0x9ee7=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xee79[_0x5aabcb];return _0x4b6e71;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9ee7('0x0'));module[_0x9ee7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x32a09a){return this['getDataValue'](_0x9ee7('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x47a867){this[_0x9ee7('0x3')](_0x9ee7('0x2'),_0x47a867?_0x47a867:this['getDataValue'](_0x9ee7('0x4')));}},'type':{'type':Sequelize[_0x9ee7('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x9ee7('0x6')](_0x9ee7('0x7')),'get':function(){if(this[_0x9ee7('0x8')]('type')===_0x9ee7('0x9')){return JSON[_0x9ee7('0xa')](this[_0x9ee7('0x8')](_0x9ee7('0xb')));}else{return this[_0x9ee7('0x8')](_0x9ee7('0xb'));}},'set':function(_0x4a733d){if(Array[_0x9ee7('0xc')](_0x4a733d)){this[_0x9ee7('0x3')](_0x9ee7('0xb'),JSON[_0x9ee7('0xd')](_0x4a733d));}else{this[_0x9ee7('0x3')]('values',_0x4a733d);}}},'required':{'type':Sequelize[_0x9ee7('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x9ee7('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x9ee7('0xf')](_0x9ee7('0x10'))}}; \ No newline at end of file +var _0xf652=['name','STRING','long','type','parse','values','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','alias'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf652,0x83));var _0x2f65=function(_0x2f8a44,_0x4e81cd){_0x2f8a44=_0x2f8a44-0x0;var _0x4703d6=_0xf652[_0x2f8a44];return _0x4703d6;};'use strict';var Sequelize=require(_0x2f65('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2f65('0x1')],'get':function(_0x19cfea){return this[_0x2f65('0x2')](_0x2f65('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x385da2){this['setDataValue']('alias',_0x385da2?_0x385da2:this['getDataValue'](_0x2f65('0x4')));}},'type':{'type':Sequelize[_0x2f65('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x2f65('0x6')),'get':function(){if(this[_0x2f65('0x2')](_0x2f65('0x7'))==='select'){return JSON[_0x2f65('0x8')](this['getDataValue'](_0x2f65('0x9')));}else{return this['getDataValue'](_0x2f65('0x9'));}},'set':function(_0x2739c0){if(Array['isArray'](_0x2739c0)){this[_0x2f65('0xa')](_0x2f65('0x9'),JSON[_0x2f65('0xb')](_0x2739c0));}else{this[_0x2f65('0xa')](_0x2f65('0x9'),_0x2739c0);}}},'required':{'type':Sequelize[_0x2f65('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x2f65('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2f65('0xd')](_0x2f65('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7937f7a..b58b9fb 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 _0x0c6e=['catch','show','params','find','update','body','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x3b04f9,_0x5b6562){var _0x2c774f=function(_0xd7bb75){while(--_0xd7bb75){_0x3b04f9['push'](_0x3b04f9['shift']());}};_0x2c774f(++_0x5b6562);}(_0x0c6e,0x6f));var _0xe0c6=function(_0x582917,_0x2dbe84){_0x582917=_0x582917-0x0;var _0x5bba2b=_0x0c6e[_0x582917];return _0x5bba2b;};'use strict';var emlformat=require(_0xe0c6('0x0'));var rimraf=require(_0xe0c6('0x1'));var zipdir=require(_0xe0c6('0x2'));var jsonpatch=require(_0xe0c6('0x3'));var rp=require('request-promise');var moment=require(_0xe0c6('0x4'));var BPromise=require(_0xe0c6('0x5'));var Mustache=require('mustache');var util=require(_0xe0c6('0x6'));var path=require(_0xe0c6('0x7'));var sox=require('sox');var csv=require(_0xe0c6('0x8'));var ejs=require(_0xe0c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe0c6('0xa'));var _=require(_0xe0c6('0xb'));var squel=require(_0xe0c6('0xc'));var crypto=require(_0xe0c6('0xd'));var jsforce=require(_0xe0c6('0xe'));var deskjs=require(_0xe0c6('0xf'));var toCsv=require(_0xe0c6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe0c6('0x10'));var authService=require(_0xe0c6('0x11'));var qs=require(_0xe0c6('0x12'));var as=require(_0xe0c6('0x13'));var hardwareService=require(_0xe0c6('0x14'));var logger=require(_0xe0c6('0x15'))(_0xe0c6('0x16'));var utils=require(_0xe0c6('0x17'));var config=require(_0xe0c6('0x18'));var licenseUtil=require(_0xe0c6('0x19'));var db=require(_0xe0c6('0x1a'))['db'];function respondWithStatusCode(_0x58c863,_0x592f62){_0x592f62=_0x592f62||0xcc;return function(_0x1790e0){if(_0x1790e0){return _0x58c863['sendStatus'](_0x592f62);}return _0x58c863[_0xe0c6('0x1b')](_0x592f62)[_0xe0c6('0x1c')]();};}function respondWithResult(_0x50574b,_0xa1115b){_0xa1115b=_0xa1115b||0xc8;return function(_0x4839a1){if(_0x4839a1){return _0x50574b[_0xe0c6('0x1b')](_0xa1115b)[_0xe0c6('0x1d')](_0x4839a1);}};}function respondWithFilteredResult(_0x1a5b74,_0x2eaeda){return function(_0xe5bd93){if(_0xe5bd93){var _0x1efa94=typeof _0x2eaeda['offset']===_0xe0c6('0x1e')&&typeof _0x2eaeda[_0xe0c6('0x1f')]===_0xe0c6('0x1e');var _0x39e221=_0xe5bd93[_0xe0c6('0x20')];var _0x8e8783=_0x1efa94?0x0:_0x2eaeda['offset'];var _0x3ae014=_0x1efa94?_0xe5bd93['count']:_0x2eaeda[_0xe0c6('0x21')]+_0x2eaeda[_0xe0c6('0x1f')];var _0x335146;if(_0x3ae014>=_0x39e221){_0x3ae014=_0x39e221;_0x335146=0xc8;}else{_0x335146=0xce;}_0x1a5b74[_0xe0c6('0x1b')](_0x335146);return _0x1a5b74['set'](_0xe0c6('0x22'),_0x8e8783+'-'+_0x3ae014+'/'+_0x39e221)[_0xe0c6('0x1d')](_0xe5bd93);}return null;};}function patchUpdates(_0x30c416){return function(_0x23fcdf){try{jsonpatch[_0xe0c6('0x23')](_0x23fcdf,_0x30c416,!![]);}catch(_0x32a1f4){return BPromise[_0xe0c6('0x24')](_0x32a1f4);}return _0x23fcdf['save']();};}function saveUpdates(_0x1a4c70,_0x5a2784){return function(_0x4d882e){if(_0x4d882e){return _0x4d882e['update'](_0x1a4c70)[_0xe0c6('0x25')](function(_0x9f77cd){return _0x9f77cd;});}return null;};}function removeEntity(_0x1e25b5,_0x1e2eba){return function(_0x133ec1){if(_0x133ec1){return _0x133ec1[_0xe0c6('0x26')]()[_0xe0c6('0x25')](function(){_0x1e25b5[_0xe0c6('0x1b')](0xcc)[_0xe0c6('0x1c')]();});}};}function handleEntityNotFound(_0x5939fe,_0x257eb7){return function(_0x46d155){if(!_0x46d155){_0x5939fe[_0xe0c6('0x27')](0x194);}return _0x46d155;};}function handleError(_0xc206b,_0x409a38){_0x409a38=_0x409a38||0x1f4;return function(_0x2d7262){logger[_0xe0c6('0x28')](_0x2d7262[_0xe0c6('0x29')]);if(_0x2d7262[_0xe0c6('0x2a')]){delete _0x2d7262[_0xe0c6('0x2a')];}_0xc206b[_0xe0c6('0x1b')](_0x409a38)[_0xe0c6('0x2b')](_0x2d7262);};}exports['index']=function(_0x5005d1,_0x56bfd5){var _0xe2f549={},_0x2ad4f6={},_0x5f9de9={'count':0x0,'rows':[]};var _0x86018c=_[_0xe0c6('0x2c')](db[_0xe0c6('0x2d')][_0xe0c6('0x2e')],function(_0x12d723){return{'name':_0x12d723[_0xe0c6('0x2f')],'type':_0x12d723[_0xe0c6('0x30')]['key']};});_0x2ad4f6[_0xe0c6('0x31')]=_[_0xe0c6('0x32')](_[_0xe0c6('0x2c')](_0x86018c,_0xe0c6('0x2a')),[_0xe0c6('0x2a')]);_0x2ad4f6[_0xe0c6('0x33')]=_[_0xe0c6('0x34')](_0x5005d1[_0xe0c6('0x33')]);_0x2ad4f6['filters']=_[_0xe0c6('0x35')](_0x2ad4f6[_0xe0c6('0x31')],_0x2ad4f6[_0xe0c6('0x33')]);_0xe2f549[_0xe0c6('0x36')]=_[_0xe0c6('0x35')](_0x2ad4f6[_0xe0c6('0x31')],qs[_0xe0c6('0x37')](_0x5005d1['query'][_0xe0c6('0x37')]));_0xe2f549['attributes']=_0xe2f549[_0xe0c6('0x36')][_0xe0c6('0x38')]?_0xe2f549['attributes']:_0x2ad4f6['model'];if(!_0x5005d1[_0xe0c6('0x33')][_0xe0c6('0x39')](_0xe0c6('0x3a'))){_0xe2f549['limit']=qs[_0xe0c6('0x1f')](_0x5005d1[_0xe0c6('0x33')]['limit']);_0xe2f549['offset']=qs[_0xe0c6('0x21')](_0x5005d1[_0xe0c6('0x33')][_0xe0c6('0x21')]);}_0xe2f549[_0xe0c6('0x3b')]=qs[_0xe0c6('0x3c')](_0x5005d1['query'][_0xe0c6('0x3c')]);_0xe2f549[_0xe0c6('0x3d')]=qs[_0xe0c6('0x3e')](_[_0xe0c6('0x3f')](_0x5005d1[_0xe0c6('0x33')],_0x2ad4f6['filters']),_0x86018c);if(_0x5005d1[_0xe0c6('0x33')][_0xe0c6('0x40')]){_0xe2f549['where']=_[_0xe0c6('0x41')](_0xe2f549[_0xe0c6('0x3d')],{'$or':_['map'](_0x86018c,function(_0x7ce3b0){if(_0x7ce3b0[_0xe0c6('0x30')]!==_0xe0c6('0x42')){var _0x49fc2f={};_0x49fc2f[_0x7ce3b0['name']]={'$like':'%'+_0x5005d1[_0xe0c6('0x33')]['filter']+'%'};return _0x49fc2f;}})});}_0xe2f549=_['merge']({},_0xe2f549,_0x5005d1[_0xe0c6('0x43')]);var _0x113ba8={'where':_0xe2f549[_0xe0c6('0x3d')]};return db[_0xe0c6('0x2d')]['count'](_0x113ba8)[_0xe0c6('0x25')](function(_0x229ef5){_0x5f9de9[_0xe0c6('0x20')]=_0x229ef5;if(_0x5005d1[_0xe0c6('0x33')][_0xe0c6('0x44')]){_0xe2f549[_0xe0c6('0x45')]=[{'all':!![]}];}return db[_0xe0c6('0x2d')]['findAll'](_0xe2f549);})['then'](function(_0x49b823){_0x5f9de9[_0xe0c6('0x46')]=_0x49b823;return _0x5f9de9;})['then'](respondWithFilteredResult(_0x56bfd5,_0xe2f549))[_0xe0c6('0x47')](handleError(_0x56bfd5,null));};exports[_0xe0c6('0x48')]=function(_0x1a438f,_0x522587){var _0x431add={'raw':!![],'where':{'id':_0x1a438f[_0xe0c6('0x49')]['id']}},_0x219833={};_0x219833[_0xe0c6('0x31')]=_['keys'](db[_0xe0c6('0x2d')][_0xe0c6('0x2e')]);_0x219833[_0xe0c6('0x33')]=_[_0xe0c6('0x34')](_0x1a438f[_0xe0c6('0x33')]);_0x219833['filters']=_[_0xe0c6('0x35')](_0x219833[_0xe0c6('0x31')],_0x219833[_0xe0c6('0x33')]);_0x431add['attributes']=_[_0xe0c6('0x35')](_0x219833[_0xe0c6('0x31')],qs[_0xe0c6('0x37')](_0x1a438f[_0xe0c6('0x33')]['fields']));_0x431add['attributes']=_0x431add[_0xe0c6('0x36')][_0xe0c6('0x38')]?_0x431add['attributes']:_0x219833['model'];if(_0x1a438f[_0xe0c6('0x33')][_0xe0c6('0x44')]){_0x431add[_0xe0c6('0x45')]=[{'all':!![]}];}_0x431add=_[_0xe0c6('0x41')]({},_0x431add,_0x1a438f[_0xe0c6('0x43')]);return db[_0xe0c6('0x2d')][_0xe0c6('0x4a')](_0x431add)[_0xe0c6('0x25')](handleEntityNotFound(_0x522587,null))[_0xe0c6('0x25')](respondWithResult(_0x522587,null))[_0xe0c6('0x47')](handleError(_0x522587,null));};exports[_0xe0c6('0x4b')]=function(_0x1fc65f,_0x319aa2){if(_0x1fc65f[_0xe0c6('0x4c')]['id']){delete _0x1fc65f[_0xe0c6('0x4c')]['id'];}return db[_0xe0c6('0x2d')][_0xe0c6('0x4a')]({'where':{'id':_0x1fc65f[_0xe0c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x319aa2,null))[_0xe0c6('0x25')](saveUpdates(_0x1fc65f[_0xe0c6('0x4c')],null))[_0xe0c6('0x25')](respondWithResult(_0x319aa2,null))[_0xe0c6('0x47')](handleError(_0x319aa2,null));};exports['destroy']=function(_0x555255,_0x3b2e7b){return db[_0xe0c6('0x2d')][_0xe0c6('0x4a')]({'where':{'id':_0x555255[_0xe0c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b2e7b,null))[_0xe0c6('0x25')](removeEntity(_0x3b2e7b,null))['catch'](handleError(_0x3b2e7b,null));};exports[_0xe0c6('0x4d')]=function(_0x4a5ab8,_0x41ecb5){var _0x2cfe05;return db[_0xe0c6('0x4e')][_0xe0c6('0x4f')](function(_0xed38f7){return db[_0xe0c6('0x2d')][_0xe0c6('0x4d')](_0x4a5ab8[_0xe0c6('0x4c')],{'transaction':_0xed38f7})[_0xe0c6('0x25')](function(_0x81591d){_0x2cfe05=_0x81591d;var _0x575987={'type':db[_0xe0c6('0x50')]['TEXT'],'transaction':_0xed38f7};switch(_0x4a5ab8[_0xe0c6('0x4c')][_0xe0c6('0x30')]){case _0xe0c6('0x51'):_0x575987[_0xe0c6('0x30')]=db[_0xe0c6('0x50')][_0xe0c6('0x52')];break;case _0xe0c6('0x53'):_0x575987[_0xe0c6('0x30')]=db[_0xe0c6('0x50')][_0xe0c6('0x54')];break;case _0xe0c6('0x55'):_0x575987[_0xe0c6('0x30')]=db[_0xe0c6('0x50')][_0xe0c6('0x56')];_0x575987[_0xe0c6('0x57')]=![];break;default:}return db[_0xe0c6('0x4e')][_0xe0c6('0x58')]['addColumn']('cm_contacts',util[_0xe0c6('0x59')](_0xe0c6('0x5a'),_0x2cfe05['id']),_0x575987);})[_0xe0c6('0x25')](function(){return _0x2cfe05;});})[_0xe0c6('0x25')](respondWithResult(_0x41ecb5,0xc9))[_0xe0c6('0x47')](handleError(_0x41ecb5,null));}; \ No newline at end of file +var _0x7249=['length','query','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','CmCustomField','includeAll','include','findAll','rows','catch','show','keys','update','body','find','params','create','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','filters','attributes','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7249,0x12c));var _0x9724=function(_0x4bc501,_0x42397e){_0x4bc501=_0x4bc501-0x0;var _0xa35812=_0x7249[_0x4bc501];return _0xa35812;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9724('0x0'));var zipdir=require(_0x9724('0x1'));var jsonpatch=require(_0x9724('0x2'));var rp=require(_0x9724('0x3'));var moment=require(_0x9724('0x4'));var BPromise=require(_0x9724('0x5'));var Mustache=require(_0x9724('0x6'));var util=require(_0x9724('0x7'));var path=require('path');var sox=require(_0x9724('0x8'));var csv=require('to-csv');var ejs=require(_0x9724('0x9'));var fs=require('fs');var fs_extra=require(_0x9724('0xa'));var _=require(_0x9724('0xb'));var squel=require(_0x9724('0xc'));var crypto=require(_0x9724('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9724('0xe'));var toCsv=require(_0x9724('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9724('0x10'));var authService=require(_0x9724('0x11'));var qs=require(_0x9724('0x12'));var as=require(_0x9724('0x13'));var hardwareService=require(_0x9724('0x14'));var logger=require(_0x9724('0x15'))(_0x9724('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9724('0x17'));var db=require(_0x9724('0x18'))['db'];function respondWithStatusCode(_0x1ad394,_0x2babc6){_0x2babc6=_0x2babc6||0xcc;return function(_0x1d2138){if(_0x1d2138){return _0x1ad394[_0x9724('0x19')](_0x2babc6);}return _0x1ad394[_0x9724('0x1a')](_0x2babc6)[_0x9724('0x1b')]();};}function respondWithResult(_0xf63367,_0x4d0fa3){_0x4d0fa3=_0x4d0fa3||0xc8;return function(_0xc2bc90){if(_0xc2bc90){return _0xf63367[_0x9724('0x1a')](_0x4d0fa3)['json'](_0xc2bc90);}};}function respondWithFilteredResult(_0x480641,_0x32ba22){return function(_0x3b923b){if(_0x3b923b){var _0x96ec58=typeof _0x32ba22[_0x9724('0x1c')]===_0x9724('0x1d')&&typeof _0x32ba22[_0x9724('0x1e')]===_0x9724('0x1d');var _0x259cf4=_0x3b923b[_0x9724('0x1f')];var _0x3dd2ca=_0x96ec58?0x0:_0x32ba22[_0x9724('0x1c')];var _0x1d515f=_0x96ec58?_0x3b923b['count']:_0x32ba22[_0x9724('0x1c')]+_0x32ba22[_0x9724('0x1e')];var _0x62f290;if(_0x1d515f>=_0x259cf4){_0x1d515f=_0x259cf4;_0x62f290=0xc8;}else{_0x62f290=0xce;}_0x480641[_0x9724('0x1a')](_0x62f290);return _0x480641[_0x9724('0x20')](_0x9724('0x21'),_0x3dd2ca+'-'+_0x1d515f+'/'+_0x259cf4)[_0x9724('0x22')](_0x3b923b);}return null;};}function patchUpdates(_0x177809){return function(_0x3e803d){try{jsonpatch['apply'](_0x3e803d,_0x177809,!![]);}catch(_0x111380){return BPromise['reject'](_0x111380);}return _0x3e803d[_0x9724('0x23')]();};}function saveUpdates(_0x1af39a,_0x31bb2f){return function(_0x35aea3){if(_0x35aea3){return _0x35aea3['update'](_0x1af39a)[_0x9724('0x24')](function(_0x16e37d){return _0x16e37d;});}return null;};}function removeEntity(_0xd206fe,_0x4839be){return function(_0x47d4cc){if(_0x47d4cc){return _0x47d4cc[_0x9724('0x25')]()['then'](function(){_0xd206fe[_0x9724('0x1a')](0xcc)[_0x9724('0x1b')]();});}};}function handleEntityNotFound(_0x5cc68f,_0xb3f56a){return function(_0x28de99){if(!_0x28de99){_0x5cc68f[_0x9724('0x19')](0x194);}return _0x28de99;};}function handleError(_0x4e856e,_0x8c86dd){_0x8c86dd=_0x8c86dd||0x1f4;return function(_0x2ed7a4){logger['error'](_0x2ed7a4['stack']);if(_0x2ed7a4[_0x9724('0x26')]){delete _0x2ed7a4[_0x9724('0x26')];}_0x4e856e[_0x9724('0x1a')](_0x8c86dd)[_0x9724('0x27')](_0x2ed7a4);};}exports[_0x9724('0x28')]=function(_0xeee2cf,_0x443adb){var _0x51876e={},_0x5a87af={},_0x2629c0={'count':0x0,'rows':[]};var _0x3df1a7=_[_0x9724('0x29')](db['CmCustomField'][_0x9724('0x2a')],function(_0x55e39f){return{'name':_0x55e39f[_0x9724('0x2b')],'type':_0x55e39f[_0x9724('0x2c')][_0x9724('0x2d')]};});_0x5a87af[_0x9724('0x2e')]=_[_0x9724('0x2f')](_[_0x9724('0x29')](_0x3df1a7,_0x9724('0x26')),[_0x9724('0x26')]);_0x5a87af['query']=_['keys'](_0xeee2cf['query']);_0x5a87af[_0x9724('0x30')]=_['intersection'](_0x5a87af[_0x9724('0x2e')],_0x5a87af['query']);_0x51876e[_0x9724('0x31')]=_[_0x9724('0x32')](_0x5a87af[_0x9724('0x2e')],qs[_0x9724('0x33')](_0xeee2cf['query']['fields']));_0x51876e['attributes']=_0x51876e[_0x9724('0x31')][_0x9724('0x34')]?_0x51876e[_0x9724('0x31')]:_0x5a87af[_0x9724('0x2e')];if(!_0xeee2cf[_0x9724('0x35')][_0x9724('0x36')]('nolimit')){_0x51876e['limit']=qs[_0x9724('0x1e')](_0xeee2cf[_0x9724('0x35')]['limit']);_0x51876e[_0x9724('0x1c')]=qs[_0x9724('0x1c')](_0xeee2cf[_0x9724('0x35')][_0x9724('0x1c')]);}_0x51876e[_0x9724('0x37')]=qs['sort'](_0xeee2cf[_0x9724('0x35')][_0x9724('0x38')]);_0x51876e[_0x9724('0x39')]=qs[_0x9724('0x30')](_[_0x9724('0x3a')](_0xeee2cf[_0x9724('0x35')],_0x5a87af[_0x9724('0x30')]),_0x3df1a7);if(_0xeee2cf['query'][_0x9724('0x3b')]){_0x51876e[_0x9724('0x39')]=_[_0x9724('0x3c')](_0x51876e['where'],{'$or':_['map'](_0x3df1a7,function(_0x288141){if(_0x288141['type']!==_0x9724('0x3d')){var _0x338ffc={};_0x338ffc[_0x288141[_0x9724('0x26')]]={'$like':'%'+_0xeee2cf[_0x9724('0x35')][_0x9724('0x3b')]+'%'};return _0x338ffc;}})});}_0x51876e=_[_0x9724('0x3c')]({},_0x51876e,_0xeee2cf[_0x9724('0x3e')]);var _0x11ba24={'where':_0x51876e['where']};return db[_0x9724('0x3f')]['count'](_0x11ba24)[_0x9724('0x24')](function(_0x5a86ca){_0x2629c0[_0x9724('0x1f')]=_0x5a86ca;if(_0xeee2cf[_0x9724('0x35')][_0x9724('0x40')]){_0x51876e[_0x9724('0x41')]=[{'all':!![]}];}return db[_0x9724('0x3f')][_0x9724('0x42')](_0x51876e);})[_0x9724('0x24')](function(_0x303d90){_0x2629c0[_0x9724('0x43')]=_0x303d90;return _0x2629c0;})['then'](respondWithFilteredResult(_0x443adb,_0x51876e))[_0x9724('0x44')](handleError(_0x443adb,null));};exports[_0x9724('0x45')]=function(_0x59edba,_0x2c1161){var _0x3ddae2={'raw':!![],'where':{'id':_0x59edba['params']['id']}},_0x158380={};_0x158380['model']=_[_0x9724('0x46')](db[_0x9724('0x3f')][_0x9724('0x2a')]);_0x158380['query']=_[_0x9724('0x46')](_0x59edba[_0x9724('0x35')]);_0x158380[_0x9724('0x30')]=_[_0x9724('0x32')](_0x158380[_0x9724('0x2e')],_0x158380[_0x9724('0x35')]);_0x3ddae2['attributes']=_[_0x9724('0x32')](_0x158380[_0x9724('0x2e')],qs[_0x9724('0x33')](_0x59edba['query'][_0x9724('0x33')]));_0x3ddae2[_0x9724('0x31')]=_0x3ddae2[_0x9724('0x31')][_0x9724('0x34')]?_0x3ddae2['attributes']:_0x158380[_0x9724('0x2e')];if(_0x59edba[_0x9724('0x35')][_0x9724('0x40')]){_0x3ddae2['include']=[{'all':!![]}];}_0x3ddae2=_[_0x9724('0x3c')]({},_0x3ddae2,_0x59edba[_0x9724('0x3e')]);return db[_0x9724('0x3f')]['find'](_0x3ddae2)[_0x9724('0x24')](handleEntityNotFound(_0x2c1161,null))['then'](respondWithResult(_0x2c1161,null))[_0x9724('0x44')](handleError(_0x2c1161,null));};exports[_0x9724('0x47')]=function(_0x343159,_0x31cb8a){if(_0x343159[_0x9724('0x48')]['id']){delete _0x343159['body']['id'];}return db[_0x9724('0x3f')][_0x9724('0x49')]({'where':{'id':_0x343159[_0x9724('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31cb8a,null))['then'](saveUpdates(_0x343159['body'],null))[_0x9724('0x24')](respondWithResult(_0x31cb8a,null))[_0x9724('0x44')](handleError(_0x31cb8a,null));};exports['destroy']=function(_0x2c16ee,_0x4a4418){return db[_0x9724('0x3f')][_0x9724('0x49')]({'where':{'id':_0x2c16ee[_0x9724('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a4418,null))[_0x9724('0x24')](removeEntity(_0x4a4418,null))[_0x9724('0x44')](handleError(_0x4a4418,null));};exports[_0x9724('0x4b')]=function(_0x1efc21,_0x2095c7){var _0x3dc76c;return db['sequelize'][_0x9724('0x4c')](function(_0x563c4e){return db['CmCustomField'][_0x9724('0x4b')](_0x1efc21['body'],{'transaction':_0x563c4e})[_0x9724('0x24')](function(_0x430e28){_0x3dc76c=_0x430e28;var _0x3ea1c6={'type':db[_0x9724('0x4d')][_0x9724('0x4e')],'transaction':_0x563c4e};switch(_0x1efc21[_0x9724('0x48')][_0x9724('0x2c')]){case _0x9724('0x4f'):_0x3ea1c6['type']=db[_0x9724('0x4d')][_0x9724('0x4e')];break;case _0x9724('0x50'):_0x3ea1c6[_0x9724('0x2c')]=db[_0x9724('0x4d')][_0x9724('0x51')];break;case'switch':_0x3ea1c6[_0x9724('0x2c')]=db[_0x9724('0x4d')][_0x9724('0x52')];_0x3ea1c6[_0x9724('0x53')]=![];break;default:}return db['sequelize'][_0x9724('0x54')][_0x9724('0x55')](_0x9724('0x56'),util[_0x9724('0x57')]('cf_%d',_0x3dc76c['id']),_0x3ea1c6);})['then'](function(){return _0x3dc76c;});})[_0x9724('0x24')](respondWithResult(_0x2095c7,0xc9))['catch'](handleError(_0x2095c7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7af82d1..0d51d97 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 _0x037c=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x037c,0x199));var _0xc037=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x037c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc037('0x0'));var util=require(_0xc037('0x1'));var logger=require(_0xc037('0x2'))(_0xc037('0x3'));var moment=require(_0xc037('0x4'));var BPromise=require(_0xc037('0x5'));var rp=require(_0xc037('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc037('0x7'));var attributes=require(_0xc037('0x8'));module['exports']=function(_0x548afc,_0x41119b){return _0x548afc[_0xc037('0x9')](_0xc037('0xa'),attributes,{'tableName':_0xc037('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f5f=['CmCustomField','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x541a9e,_0x5789b1){var _0x4833f8=function(_0x50c31a){while(--_0x50c31a){_0x541a9e['push'](_0x541a9e['shift']());}};_0x4833f8(++_0x5789b1);}(_0x1f5f,0x157));var _0xf1f5=function(_0x2f4c0a,_0x4fe586){_0x2f4c0a=_0x2f4c0a-0x0;var _0xa66779=_0x1f5f[_0x2f4c0a];return _0xa66779;};'use strict';var _=require(_0xf1f5('0x0'));var util=require(_0xf1f5('0x1'));var logger=require(_0xf1f5('0x2'))(_0xf1f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf1f5('0x4'));var fs=require('fs');var path=require(_0xf1f5('0x5'));var rimraf=require(_0xf1f5('0x6'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xf1f5('0x7')]=function(_0x9dc2a8,_0x3cdb41){return _0x9dc2a8['define'](_0xf1f5('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 2ab0d71..0843617 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 _0xbccd=['CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xbccd,0x1ab));var _0xdbcc=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xbccd[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0xdbcc('0x0'));var moment=require('moment');var BPromise=require(_0xdbcc('0x1'));var rs=require(_0xdbcc('0x2'));var fs=require('fs');var Redis=require(_0xdbcc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbcc('0x4'))(_0xdbcc('0x5'));var config=require(_0xdbcc('0x6'));var jayson=require(_0xdbcc('0x7'));var client=jayson[_0xdbcc('0x8')][_0xdbcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcd48de,_0x2bcf12,_0x3fd05d){return new BPromise(function(_0x25dcaf,_0x102be3){return client[_0xdbcc('0xa')](_0xcd48de,_0x3fd05d)['then'](function(_0x54ebb8){logger[_0xdbcc('0xb')](_0xdbcc('0xc'),_0x2bcf12,'request\x20sent');logger[_0xdbcc('0xd')](_0xdbcc('0xe'),_0x2bcf12,_0xdbcc('0xf'),JSON['stringify'](_0x54ebb8));if(_0x54ebb8['error']){if(_0x54ebb8[_0xdbcc('0x10')][_0xdbcc('0x11')]===0x1f4){logger[_0xdbcc('0x10')](_0xdbcc('0xc'),_0x2bcf12,_0x54ebb8['error'][_0xdbcc('0x12')]);return _0x102be3(_0x54ebb8['error'][_0xdbcc('0x12')]);}logger['error'](_0xdbcc('0xc'),_0x2bcf12,_0x54ebb8['error'][_0xdbcc('0x12')]);return _0x25dcaf(_0x54ebb8[_0xdbcc('0x10')]['message']);}else{logger['info'](_0xdbcc('0xc'),_0x2bcf12,'request\x20sent');_0x25dcaf(_0x54ebb8[_0xdbcc('0x13')]['message']);}})[_0xdbcc('0x14')](function(_0x26a43a){logger['error'](_0xdbcc('0xc'),_0x2bcf12,_0x26a43a);_0x102be3(_0x26a43a);});});} \ No newline at end of file +var _0xe1e5=['request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe1e5,0x16f));var _0x5e1e=function(_0x509b99,_0x3ff1f0){_0x509b99=_0x509b99-0x0;var _0x383d46=_0xe1e5[_0x509b99];return _0x383d46;};'use strict';var _=require(_0x5e1e('0x0'));var util=require(_0x5e1e('0x1'));var moment=require('moment');var BPromise=require(_0x5e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e1e('0x3'));var db=require(_0x5e1e('0x4'))['db'];var utils=require(_0x5e1e('0x5'));var logger=require(_0x5e1e('0x6'))(_0x5e1e('0x7'));var config=require(_0x5e1e('0x8'));var jayson=require(_0x5e1e('0x9'));var client=jayson[_0x5e1e('0xa')][_0x5e1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x349220,_0x3d4d58,_0x412fe4){return new BPromise(function(_0x80c9d8,_0x4e3de9){return client[_0x5e1e('0xc')](_0x349220,_0x412fe4)[_0x5e1e('0xd')](function(_0x3ea425){logger['info'](_0x5e1e('0xe'),_0x3d4d58,'request\x20sent');logger[_0x5e1e('0xf')](_0x5e1e('0x10'),_0x3d4d58,_0x5e1e('0x11'),JSON[_0x5e1e('0x12')](_0x3ea425));if(_0x3ea425[_0x5e1e('0x13')]){if(_0x3ea425[_0x5e1e('0x13')]['code']===0x1f4){logger['error'](_0x5e1e('0xe'),_0x3d4d58,_0x3ea425[_0x5e1e('0x13')][_0x5e1e('0x14')]);return _0x4e3de9(_0x3ea425['error'][_0x5e1e('0x14')]);}logger[_0x5e1e('0x13')]('CmCustomField,\x20%s,\x20%s',_0x3d4d58,_0x3ea425[_0x5e1e('0x13')][_0x5e1e('0x14')]);return _0x80c9d8(_0x3ea425[_0x5e1e('0x13')][_0x5e1e('0x14')]);}else{logger[_0x5e1e('0x15')]('CmCustomField,\x20%s,\x20%s',_0x3d4d58,_0x5e1e('0x11'));_0x80c9d8(_0x3ea425[_0x5e1e('0x16')]['message']);}})[_0x5e1e('0x17')](function(_0x37db54){logger[_0x5e1e('0x13')](_0x5e1e('0xe'),_0x3d4d58,_0x37db54);_0x4e3de9(_0x37db54);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4cc1da2..f8d8afa 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 _0x0578=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','get','/:id','show','create','put','destroy','exports','multer','util'];(function(_0x31f1a6,_0xf3f520){var _0x39fc68=function(_0x4025a6){while(--_0x4025a6){_0x31f1a6['push'](_0x31f1a6['shift']());}};_0x39fc68(++_0xf3f520);}(_0x0578,0x1b8));var _0x8057=function(_0x3bfeed,_0x122544){_0x3bfeed=_0x3bfeed-0x0;var _0x4e070f=_0x0578[_0x3bfeed];return _0x4e070f;};'use strict';var multer=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var path=require(_0x8057('0x2'));var timeout=require(_0x8057('0x3'));var express=require(_0x8057('0x4'));var router=express['Router']();var fs_extra=require(_0x8057('0x5'));var auth=require(_0x8057('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8057('0x7'));var controller=require(_0x8057('0x8'));router['get']('/',auth[_0x8057('0x9')](),controller['index']);router[_0x8057('0xa')](_0x8057('0xb'),auth['isAuthenticated'](),controller[_0x8057('0xc')]);router['post']('/',auth[_0x8057('0x9')](),controller[_0x8057('0xd')]);router[_0x8057('0xe')](_0x8057('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8057('0xb'),auth[_0x8057('0x9')](),controller[_0x8057('0xf')]);module[_0x8057('0x10')]=router; \ No newline at end of file +var _0xe574=['get','isAuthenticated','index','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x331478,_0x401d65){var _0x52eac9=function(_0x400141){while(--_0x400141){_0x331478['push'](_0x331478['shift']());}};_0x52eac9(++_0x401d65);}(_0xe574,0x100));var _0x4e57=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe574[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x4e57('0x0'));var util=require('util');var path=require(_0x4e57('0x1'));var timeout=require(_0x4e57('0x2'));var express=require(_0x4e57('0x3'));var router=express[_0x4e57('0x4')]();var fs_extra=require(_0x4e57('0x5'));var auth=require(_0x4e57('0x6'));var interaction=require(_0x4e57('0x7'));var config=require(_0x4e57('0x8'));var controller=require(_0x4e57('0x9'));router[_0x4e57('0xa')]('/',auth[_0x4e57('0xb')](),controller[_0x4e57('0xc')]);router['get']('/:id',auth[_0x4e57('0xb')](),controller['show']);router['post']('/',auth[_0x4e57('0xb')](),controller[_0x4e57('0xd')]);router[_0x4e57('0xe')](_0x4e57('0xf'),auth[_0x4e57('0xb')](),controller['update']);router[_0x4e57('0x10')](_0x4e57('0xf'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x11')]);module[_0x4e57('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index d6f971d..95abf94 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 _0xf601=['STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x2626ab,_0x493048){var _0x2b5c3d=function(_0xe13683){while(--_0xe13683){_0x2626ab['push'](_0x2626ab['shift']());}};_0x2b5c3d(++_0x493048);}(_0xf601,0xa7));var _0x1f60=function(_0x3b4058,_0x506b3d){_0x3b4058=_0x3b4058-0x0;var _0xb9e639=_0xf601[_0x3b4058];return _0xb9e639;};'use strict';var moment=require(_0x1f60('0x0'));var Sequelize=require(_0x1f60('0x1'));module[_0x1f60('0x2')]={'phone':{'type':Sequelize[_0x1f60('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x1f60('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1f60('0x5')],'defaultValue':moment()[_0x1f60('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1f60('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1f60('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1f60('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1f60('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1f60('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1f60('0x7')],'unique':_0x1f60('0x9')},'ListId':{'type':Sequelize[_0x1f60('0x7')],'unique':_0x1f60('0x9')},'UserId':{'type':Sequelize[_0x1f60('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x1f60('0x7')],'unique':_0x1f60('0x9')},'CampaignId':{'type':Sequelize[_0x1f60('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1f60('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1f60('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1f60('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x1f60('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x5ee2=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','STRING','BOOLEAN'];(function(_0x4cfd5e,_0x5d90be){var _0x34570a=function(_0x45ee3b){while(--_0x45ee3b){_0x4cfd5e['push'](_0x4cfd5e['shift']());}};_0x34570a(++_0x5d90be);}(_0x5ee2,0x8d));var _0x25ee=function(_0x21e73e,_0x106e9b){_0x21e73e=_0x21e73e-0x0;var _0x4f8ddc=_0x5ee2[_0x21e73e];return _0x4f8ddc;};'use strict';var moment=require('moment');var Sequelize=require(_0x25ee('0x0'));module['exports']={'phone':{'type':Sequelize[_0x25ee('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x25ee('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x25ee('0x3')],'defaultValue':moment()[_0x25ee('0x4')](_0x25ee('0x5'))},'countbusyretry':{'type':Sequelize[_0x25ee('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x25ee('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x25ee('0x3')]},'priority':{'type':Sequelize[_0x25ee('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x25ee('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x25ee('0x6')],'unique':_0x25ee('0x7')},'ListId':{'type':Sequelize[_0x25ee('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x25ee('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x25ee('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x25ee('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x25ee('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x25ee('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x25ee('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x25ee('0x3')],'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 0cc42f4..35623a9 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 _0x885a=['key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','dialActive','getPreviewRecall','transaction','recallme','Contact','Queue','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','then','error','stack','name','index','CmHopper','rawAttributes','type'];(function(_0x26a33a,_0x21c459){var _0x2cd414=function(_0x49eca3){while(--_0x49eca3){_0x26a33a['push'](_0x26a33a['shift']());}};_0x2cd414(++_0x21c459);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var moment=require('moment');var _=require(_0xa885('0x0'));var qs=require(_0xa885('0x1'));var logger=require(_0xa885('0x2'))(_0xa885('0x3'));var shared=require('../../config/environment');var db=require(_0xa885('0x4'))['db'];function respondWithResult(_0x1c41b5,_0x2386ec){_0x2386ec=_0x2386ec||0xc8;return function(_0x106e16){if(_0x106e16){return _0x1c41b5[_0xa885('0x5')](_0x2386ec)[_0xa885('0x6')](_0x106e16);}};}function respondWithFilteredResult(_0x5dfd7e,_0x7ac6bd){return function(_0x1200c7){if(_0x1200c7){var _0x31fd77=typeof _0x7ac6bd['offset']===_0xa885('0x7')&&typeof _0x7ac6bd[_0xa885('0x8')]===_0xa885('0x7');var _0x5e49d0=_0x1200c7[_0xa885('0x9')];var _0x299f57=_0x31fd77?0x0:_0x7ac6bd[_0xa885('0xa')];var _0x745710=_0x31fd77?_0x1200c7[_0xa885('0x9')]:_0x7ac6bd[_0xa885('0xa')]+_0x7ac6bd[_0xa885('0x8')];var _0x571c0d;if(_0x745710>=_0x5e49d0){_0x745710=_0x5e49d0;_0x571c0d=0xc8;}else{_0x571c0d=0xce;}_0x5dfd7e[_0xa885('0x5')](_0x571c0d);return _0x5dfd7e[_0xa885('0xb')](_0xa885('0xc'),_0x299f57+'-'+_0x745710+'/'+_0x5e49d0)[_0xa885('0x6')](_0x1200c7);}return null;};}function saveUpdates(_0x412b2a,_0x3e9c7a){return function(_0x4585d9){if(_0x4585d9){return _0x4585d9['update'](_0x412b2a)[_0xa885('0xd')](function(_0x1d789f){return _0x1d789f;});}return null;};}function handleEntityNotFound(_0x27b24a,_0x12d81c){return function(_0x33ce2e){if(!_0x33ce2e){_0x27b24a['sendStatus'](0x194);}return _0x33ce2e;};}function handleError(_0x1c9687,_0x2ca5c5){_0x2ca5c5=_0x2ca5c5||0x1f4;return function(_0x5296e6){logger[_0xa885('0xe')](_0x5296e6[_0xa885('0xf')]);if(_0x5296e6['name']){delete _0x5296e6[_0xa885('0x10')];}_0x1c9687[_0xa885('0x5')](_0x2ca5c5)['send'](_0x5296e6);};}exports[_0xa885('0x11')]=function(_0x543e7a,_0x2e9290){var _0x3960ea={},_0x8c26c={},_0x4e4d51={'count':0x0,'rows':[]};var _0x289b76=_['map'](db[_0xa885('0x12')][_0xa885('0x13')],function(_0x113043){return{'name':_0x113043['fieldName'],'type':_0x113043[_0xa885('0x14')][_0xa885('0x15')]};});_0x8c26c[_0xa885('0x16')]=_['map'](_0x289b76,_0xa885('0x10'));_0x8c26c[_0xa885('0x17')]=_[_0xa885('0x18')](_0x543e7a['query']);_0x8c26c[_0xa885('0x19')]=_['intersection'](_0x8c26c[_0xa885('0x16')],_0x8c26c[_0xa885('0x17')]);_0x8c26c['filters']=_[_0xa885('0x1a')](_0x8c26c[_0xa885('0x19')],[_0xa885('0x1b'),'$or',_0xa885('0x1c'),_0xa885('0x1d'),'$lt',_0xa885('0x1e'),'$ne',_0xa885('0x1f'),'$not',_0xa885('0x20'),_0xa885('0x21'),_0xa885('0x22'),_0xa885('0x23'),_0xa885('0x24'),_0xa885('0x25'),_0xa885('0x26'),_0xa885('0x27'),'$like','$overlap','$contains','$contained',_0xa885('0x28')]);_0x3960ea[_0xa885('0x29')]=_[_0xa885('0x2a')](_0x8c26c[_0xa885('0x16')],qs[_0xa885('0x2b')](_0x543e7a[_0xa885('0x17')]['fields']));_0x3960ea[_0xa885('0x29')]=_0x3960ea['attributes'][_0xa885('0x2c')]?_0x3960ea['attributes']:_0x8c26c[_0xa885('0x16')];if(!_0x543e7a['query'][_0xa885('0x2d')](_0xa885('0x2e'))){_0x3960ea[_0xa885('0x8')]=qs['limit'](_0x543e7a[_0xa885('0x17')][_0xa885('0x8')]);_0x3960ea['offset']=qs[_0xa885('0xa')](_0x543e7a['query'][_0xa885('0xa')]);}_0x3960ea[_0xa885('0x2f')]=qs[_0xa885('0x30')](_0x543e7a['query'][_0xa885('0x30')]);_0x3960ea[_0xa885('0x31')]=qs[_0xa885('0x19')](_['pick'](_0x543e7a[_0xa885('0x17')],_0x8c26c[_0xa885('0x19')]),_0x289b76);if(_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]){_0x3960ea[_0xa885('0x31')]=_[_0xa885('0x33')](_0x3960ea[_0xa885('0x31')],{'$or':_[_0xa885('0x34')](_0x289b76,function(_0x5235af){if(_0x5235af['type']!==_0xa885('0x35')){var _0x1d43b5={};_0x1d43b5[_0x5235af[_0xa885('0x10')]]={'$like':'%'+_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]+'%'};return _0x1d43b5;}})});}_0x3960ea=_[_0xa885('0x33')]({},_0x3960ea,_0x543e7a[_0xa885('0x36')]);var _0x337e55={'where':_0x3960ea[_0xa885('0x31')]};return db['CmHopper']['count'](_0x337e55)[_0xa885('0xd')](function(_0x576c78){_0x4e4d51['count']=_0x576c78;if(_0x543e7a[_0xa885('0x17')]['includeAll']){_0x3960ea[_0xa885('0x37')]=[{'all':!![]}];}return db[_0xa885('0x12')][_0xa885('0x38')](_0x3960ea);})[_0xa885('0xd')](function(_0x2d433e){_0x4e4d51[_0xa885('0x39')]=_0x2d433e;return _0x4e4d51;})[_0xa885('0xd')](respondWithFilteredResult(_0x2e9290,_0x3960ea))[_0xa885('0x3a')](handleError(_0x2e9290,null));};exports[_0xa885('0x3b')]=function(_0x2f48a9,_0x531586){var _0x30759d={'raw':!![],'where':{'id':_0x2f48a9[_0xa885('0x3c')]['id']}},_0x4012b3={};_0x4012b3[_0xa885('0x16')]=_[_0xa885('0x18')](db['CmHopper']['rawAttributes']);_0x4012b3[_0xa885('0x17')]=_[_0xa885('0x18')](_0x2f48a9[_0xa885('0x17')]);_0x4012b3[_0xa885('0x19')]=_[_0xa885('0x2a')](_0x4012b3['model'],_0x4012b3[_0xa885('0x17')]);_0x30759d[_0xa885('0x29')]=_['intersection'](_0x4012b3['model'],qs[_0xa885('0x2b')](_0x2f48a9[_0xa885('0x17')]['fields']));_0x30759d['attributes']=_0x30759d[_0xa885('0x29')][_0xa885('0x2c')]?_0x30759d[_0xa885('0x29')]:_0x4012b3[_0xa885('0x16')];if(_0x2f48a9[_0xa885('0x17')][_0xa885('0x3d')]){_0x30759d[_0xa885('0x37')]=[{'all':!![]}];}_0x30759d=_[_0xa885('0x33')]({},_0x30759d,_0x2f48a9[_0xa885('0x36')]);return db[_0xa885('0x12')][_0xa885('0x3e')](_0x30759d)['then'](handleEntityNotFound(_0x531586,null))[_0xa885('0xd')](respondWithResult(_0x531586,null))[_0xa885('0x3a')](handleError(_0x531586,null));};exports[_0xa885('0x3f')]=function(_0x49c6a7,_0x47f3b4){return db[_0xa885('0x12')][_0xa885('0x3f')](_0x49c6a7[_0xa885('0x40')],{})['then'](respondWithResult(_0x47f3b4,0xc9))[_0xa885('0x3a')](handleError(_0x47f3b4,null));};exports['update']=function(_0x2d4bb5,_0x245fe9){if(_0x2d4bb5['body']['id']){delete _0x2d4bb5[_0xa885('0x40')]['id'];}return db[_0xa885('0x12')][_0xa885('0x3e')]({'where':{'id':_0x2d4bb5[_0xa885('0x3c')]['id']}})[_0xa885('0xd')](handleEntityNotFound(_0x245fe9,null))['then'](saveUpdates(_0x2d4bb5[_0xa885('0x40')],null))[_0xa885('0xd')](respondWithResult(_0x245fe9,null))[_0xa885('0x3a')](handleError(_0x245fe9,null));};exports['describe']=function(_0x4d146e,_0x52fbeb){return db[_0xa885('0x12')][_0xa885('0x41')]()[_0xa885('0xd')](respondWithResult(_0x52fbeb,null))[_0xa885('0x3a')](handleError(_0x52fbeb,null));};exports[_0xa885('0x42')]=function(_0x49aa9b,_0x43245c){var _0x476532;var _0x4397d6=_0x49aa9b[_0xa885('0x3c')]['id'];return db[_0xa885('0x12')]['find']({'where':{'id':_0x49aa9b['params']['id']}})['then'](handleEntityNotFound(_0x43245c,null))[_0xa885('0xd')](function(_0x289716){if(_0x289716){return _0x289716[_0xa885('0x42')]()[_0xa885('0xd')](function(_0x164d9d){return _0x164d9d;});}})[_0xa885('0xd')](function(_0x35e931){_0x476532=_0x35e931;if(_0x35e931){if(_0x35e931['VoiceQueueId']||_0x35e931[_0xa885('0x43')]){return db[_0x35e931[_0xa885('0x44')]?_0xa885('0x45'):_0xa885('0x46')][_0xa885('0x3e')]({'where':{'id':_0x35e931[_0xa885('0x44')]?_0x35e931[_0xa885('0x44')]:_0x35e931['CampaignId']},'attributes':['id',_0xa885('0x10')],'raw':!![]});}}})[_0xa885('0xd')](function(_0x1fde66){var _0x55ea83={};if(_0x1fde66){_[_0xa885('0x33')](_0x55ea83,_[_0xa885('0x47')](_0x476532[_0xa885('0x48')],[_0xa885('0x49'),_0xa885('0x4a'),'id']));_0x55ea83[_0xa885('0x4b')]=0x15;_0x55ea83[_0xa885('0x4c')]=_0xa885('0x4d');_0x55ea83['campaign']=_0x1fde66[_0xa885('0x10')];_0x55ea83[_0xa885('0x4e')]=_0x49aa9b[_0xa885('0x4f')]['name'];_0x55ea83[_0xa885('0x50')]=_0x49aa9b[_0xa885('0x4f')]['id'];_0x55ea83[_0xa885('0x4d')]=!![];_0x55ea83[_0xa885('0x51')]=moment()[_0xa885('0x52')](_0xa885('0x53'));_0x55ea83['calleridnum']=_0x476532[_0xa885('0x54')];_0x55ea83[_0xa885('0x55')]=_0x476532[_0xa885('0x44')]?'queue':_0xa885('0x56');return db[_0xa885('0x57')][_0xa885('0x3e')]({'where':{'id':_0x55ea83[_0xa885('0x58')]},'attributes':[_0xa885('0x59'),_0xa885('0x5a')]})[_0xa885('0xd')](function(_0x288bbc){if(!_[_0xa885('0x5b')](_0x43245c)&&!_['isNil'](_0x288bbc[_0xa885('0x59')])){_0x55ea83[_0xa885('0x5c')]=_0x288bbc['firstName'];if(!_['isNil'](_0x288bbc[_0xa885('0x5a')])){_0x55ea83[_0xa885('0x5c')]+='\x20'+_0x288bbc['lastName'];}}})[_0xa885('0x5d')](function(){return db[_0xa885('0x5e')][_0xa885('0x3f')](_0x55ea83);});}})[_0xa885('0xd')](function(_0x1e3576){return db[_0xa885('0x5f')][_0xa885('0x42')]({'where':{'CmHopperId':_0x4397d6}});})['then'](function(){return _0x43245c[_0xa885('0x5')](0xcc)[_0xa885('0x60')]();})['catch'](handleError(_0x43245c,null));};exports[_0xa885('0x61')]=function(_0x48ded4,_0x117cfe){var _0x5698d6=[];return db[_0xa885('0x57')][_0xa885('0x41')]()[_0xa885('0xd')](function(_0x22eb32){_0x5698d6=_['keys'](_0x22eb32);return _0x48ded4[_0xa885('0x4f')][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa885('0x64'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xa885('0xd')](function(_0xb066be){if(_0xb066be&&_0xb066be['length']){return db[_0xa885('0x65')]['transaction'](function(_0x36c7ba){var _0x2f053a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0xb066be,'id')},'$or':[{'UserId':null},{'UserId':_0x48ded4[_0xa885('0x4f')]['id']}]};var _0x3bc750={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb066be)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xa885('0x34')]('id')[_0xa885('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x48ded4['user']['id']}]};var _0x55d5d0={'$or':[_0x2f053a,_0x3bc750]};var _0x3c9df4=[];if(_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]&&_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]===_0xa885('0x68')){if(!_[_0xa885('0x69')](_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')])){_0x55d5d0['id']={'$in':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[['priority',_0xa885('0x6b')],[_0xa885('0x6c'),_0xb066be[0x0][_0xa885('0x64')]===_0xa885('0x6b')?_0xa885('0x6d'):'ASC'],db[_0xa885('0x65')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa885('0x6d')]];}else{if(!_[_0xa885('0x69')](_0x48ded4['body']['hopperIds'])){_0x55d5d0['id']={'$notIn':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[[_0xa885('0x6e'),'DESC'],['scheduledAt',_0xb066be[0x0][_0xa885('0x64')]],db[_0xa885('0x65')][_0xa885('0x6f')](_0xa885('0x70')),['id','ASC']];}return db[_0xa885('0x12')][_0xa885('0x71')]({'attributes':['id',_0xa885('0x72'),'phone','recallme'],'where':_0x55d5d0,'order':_0x3c9df4,'transaction':_0x36c7ba,'lock':_0x36c7ba[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':'Contact','attributes':_0x5698d6,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id',_0xa885('0x10')]}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':'Queue','attributes':['id',_0xa885('0x10'),_0xa885('0x78')]}]})['then'](function(_0x314d83){if(_0x314d83){return _0x314d83['update']({'UserId':_0x48ded4[_0xa885('0x4f')]['id']},{'transaction':_0x36c7ba});}});});}})[_0xa885('0xd')](handleEntityNotFound(_0x117cfe,null))[_0xa885('0xd')](respondWithResult(_0x117cfe,null))[_0xa885('0x3a')](handleError(_0x117cfe,null));};exports[_0xa885('0x79')]=function(_0x29ed6e,_0x1ca586,_0x3aa8bc){var _0x490d15=[];var _0x55413d=_0x29ed6e[_0xa885('0x3c')]['id'];var _0xb1eac6=_0x29ed6e['user']['id'];return db[_0xa885('0x57')][_0xa885('0x41')]()['then'](function(_0x425374){_0x490d15=_['keys'](_0x425374);return db[_0xa885('0x65')][_0xa885('0x7a')](function(_0x37ef1b){const _0x26950f={'id':_0x55413d};return db['CmHopper']['findOne']({'attributes':['id',_0xa885('0x72'),_0xa885('0x7b')],'where':_0x26950f,'transaction':_0x37ef1b,'lock':_0x37ef1b[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':_0xa885('0x7c'),'attributes':_0x490d15,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id','name']}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':_0xa885('0x7d'),'attributes':['id','name',_0xa885('0x78')]}]})[_0xa885('0xd')](function(_0x50a7ef){if(_0x50a7ef){return _0x50a7ef['update']({'UserId':_0xb1eac6},{'transaction':_0x37ef1b});}});});})[_0xa885('0xd')](handleEntityNotFound(_0x1ca586,null))[_0xa885('0xd')](respondWithResult(_0x1ca586,null))[_0xa885('0x3a')](handleError(_0x1ca586,null));};exports[_0xa885('0x7e')]=function(_0x243d5e,_0x4bd60c){return _0x243d5e['user'][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':_0xa885('0x7f')},'attributes':['id'],'raw':!![]})[_0xa885('0xd')](function(_0x56bd37){if(_0x56bd37&&_0x56bd37['length']){return db['CmHopper'][_0xa885('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa885('0x52')](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0x56bd37,'id')},'$or':[{'UserId':null},{'UserId':_0x243d5e[_0xa885('0x4f')]['id']}]}});}return 0x0;})[_0xa885('0xd')](function(_0x220614){if(!_['isNil'](_0x220614)&&_['isNumber'](_0x220614)){return _0x4bd60c[_0xa885('0x5')](0xc8)['json']({'contacts':_0x220614});}else{logger[_0xa885('0xe')](_0xa885('0x80'),_0xa885('0x7e'),0x194,_0xa885('0x81'));_0x4bd60c['sendStatus'](0x194);}})[_0xa885('0x3a')](handleError(_0x4bd60c,null));};exports[_0xa885('0x82')]=function(_0x2ff728,_0x5a6f1f){var _0xe5881c=shared[_0xa885('0x83')];var _0x9cda91=[];_['map'](_0xe5881c,function(_0x1d51ac){_0x9cda91[_0xa885('0x84')]({'id':_0x1d51ac[_0xa885('0x10')],'name':_0x1d51ac[_0xa885('0x10')],'utcOffset':_0x1d51ac[_0xa885('0x85')]});});return _0x5a6f1f[_0xa885('0x5')](0xc8)['json']({'tz':_0x9cda91});};exports[_0xa885('0x86')]=function(_0x40a85d,_0x3be76a){var _0x1689c8=shared['timezones'];var _0x3c088d={};if(!_[_0xa885('0x5b')](_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']]))_0x3c088d=_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']];return _0x3be76a[_0xa885('0x5')](0xc8)[_0xa885('0x6')](_0x3c088d);}; \ No newline at end of file +var _0x85d0=['$between','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','keys','includeAll','options','find','create','body','describe','destroy','VoiceQueueId','CampaignId','createdAt','state','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','LOCK','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','update','then','error','stack','name','send','index','CmHopper','rawAttributes','fieldName','type','model','map','query','intersection','filters','concat','$or','$gt','$gte','$lte','$ne','$eq','$not'];(function(_0x2d001b,_0xd2859f){var _0x16a5f3=function(_0x4d9d2b){while(--_0x4d9d2b){_0x2d001b['push'](_0x2d001b['shift']());}};_0x16a5f3(++_0xd2859f);}(_0x85d0,0x164));var _0x085d=function(_0x529ab4,_0x5ef4e4){_0x529ab4=_0x529ab4-0x0;var _0x5cf10c=_0x85d0[_0x529ab4];return _0x5cf10c;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x085d('0x0'));var shared=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];function respondWithResult(_0x313db8,_0x231765){_0x231765=_0x231765||0xc8;return function(_0x19ae4c){if(_0x19ae4c){return _0x313db8['status'](_0x231765)[_0x085d('0x3')](_0x19ae4c);}};}function respondWithFilteredResult(_0x5c917f,_0x364f09){return function(_0x9acc97){if(_0x9acc97){var _0x2a6902=typeof _0x364f09['offset']===_0x085d('0x4')&&typeof _0x364f09[_0x085d('0x5')]===_0x085d('0x4');var _0x3129a8=_0x9acc97[_0x085d('0x6')];var _0x6450ab=_0x2a6902?0x0:_0x364f09[_0x085d('0x7')];var _0x985cb3=_0x2a6902?_0x9acc97[_0x085d('0x6')]:_0x364f09['offset']+_0x364f09[_0x085d('0x5')];var _0x19b205;if(_0x985cb3>=_0x3129a8){_0x985cb3=_0x3129a8;_0x19b205=0xc8;}else{_0x19b205=0xce;}_0x5c917f[_0x085d('0x8')](_0x19b205);return _0x5c917f[_0x085d('0x9')]('Content-Range',_0x6450ab+'-'+_0x985cb3+'/'+_0x3129a8)[_0x085d('0x3')](_0x9acc97);}return null;};}function saveUpdates(_0x2bd6ae,_0x5c6c27){return function(_0x2e0714){if(_0x2e0714){return _0x2e0714[_0x085d('0xa')](_0x2bd6ae)[_0x085d('0xb')](function(_0x6b21d1){return _0x6b21d1;});}return null;};}function handleEntityNotFound(_0x5a5252,_0x4b87b9){return function(_0x19ce18){if(!_0x19ce18){_0x5a5252['sendStatus'](0x194);}return _0x19ce18;};}function handleError(_0x536f36,_0x267374){_0x267374=_0x267374||0x1f4;return function(_0x334263){logger[_0x085d('0xc')](_0x334263[_0x085d('0xd')]);if(_0x334263[_0x085d('0xe')]){delete _0x334263['name'];}_0x536f36[_0x085d('0x8')](_0x267374)[_0x085d('0xf')](_0x334263);};}exports[_0x085d('0x10')]=function(_0x1b0a6c,_0x3e566f){var _0x1c9de6={},_0x5c046e={},_0x6f7604={'count':0x0,'rows':[]};var _0x1195d5=_['map'](db[_0x085d('0x11')][_0x085d('0x12')],function(_0x159291){return{'name':_0x159291[_0x085d('0x13')],'type':_0x159291[_0x085d('0x14')]['key']};});_0x5c046e[_0x085d('0x15')]=_[_0x085d('0x16')](_0x1195d5,_0x085d('0xe'));_0x5c046e[_0x085d('0x17')]=_['keys'](_0x1b0a6c['query']);_0x5c046e['filters']=_[_0x085d('0x18')](_0x5c046e[_0x085d('0x15')],_0x5c046e[_0x085d('0x17')]);_0x5c046e[_0x085d('0x19')]=_[_0x085d('0x1a')](_0x5c046e[_0x085d('0x19')],['$and',_0x085d('0x1b'),_0x085d('0x1c'),_0x085d('0x1d'),'$lt',_0x085d('0x1e'),_0x085d('0x1f'),_0x085d('0x20'),_0x085d('0x21'),_0x085d('0x22'),'$notBetween','$in','$notIn',_0x085d('0x23'),_0x085d('0x24'),_0x085d('0x25'),'$notILike',_0x085d('0x23'),_0x085d('0x26'),_0x085d('0x27'),'$contained',_0x085d('0x28')]);_0x1c9de6[_0x085d('0x29')]=_[_0x085d('0x18')](_0x5c046e[_0x085d('0x15')],qs['fields'](_0x1b0a6c[_0x085d('0x17')][_0x085d('0x2a')]));_0x1c9de6['attributes']=_0x1c9de6[_0x085d('0x29')][_0x085d('0x2b')]?_0x1c9de6['attributes']:_0x5c046e[_0x085d('0x15')];if(!_0x1b0a6c[_0x085d('0x17')][_0x085d('0x2c')]('nolimit')){_0x1c9de6[_0x085d('0x5')]=qs[_0x085d('0x5')](_0x1b0a6c[_0x085d('0x17')]['limit']);_0x1c9de6[_0x085d('0x7')]=qs['offset'](_0x1b0a6c[_0x085d('0x17')][_0x085d('0x7')]);}_0x1c9de6[_0x085d('0x2d')]=qs[_0x085d('0x2e')](_0x1b0a6c['query'][_0x085d('0x2e')]);_0x1c9de6[_0x085d('0x2f')]=qs[_0x085d('0x19')](_[_0x085d('0x30')](_0x1b0a6c['query'],_0x5c046e['filters']),_0x1195d5);if(_0x1b0a6c[_0x085d('0x17')][_0x085d('0x31')]){_0x1c9de6[_0x085d('0x2f')]=_[_0x085d('0x32')](_0x1c9de6[_0x085d('0x2f')],{'$or':_[_0x085d('0x16')](_0x1195d5,function(_0x165eff){if(_0x165eff[_0x085d('0x14')]!==_0x085d('0x33')){var _0x596862={};_0x596862[_0x165eff[_0x085d('0xe')]]={'$like':'%'+_0x1b0a6c[_0x085d('0x17')]['filter']+'%'};return _0x596862;}})});}_0x1c9de6=_[_0x085d('0x32')]({},_0x1c9de6,_0x1b0a6c['options']);var _0x1cc755={'where':_0x1c9de6[_0x085d('0x2f')]};return db['CmHopper'][_0x085d('0x6')](_0x1cc755)[_0x085d('0xb')](function(_0x26d1f2){_0x6f7604[_0x085d('0x6')]=_0x26d1f2;if(_0x1b0a6c[_0x085d('0x17')]['includeAll']){_0x1c9de6[_0x085d('0x34')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1c9de6);})[_0x085d('0xb')](function(_0x32bf4f){_0x6f7604[_0x085d('0x35')]=_0x32bf4f;return _0x6f7604;})[_0x085d('0xb')](respondWithFilteredResult(_0x3e566f,_0x1c9de6))[_0x085d('0x36')](handleError(_0x3e566f,null));};exports['show']=function(_0x10d5cf,_0x47e1e8){var _0x3a8646={'raw':!![],'where':{'id':_0x10d5cf[_0x085d('0x37')]['id']}},_0x65ec6d={};_0x65ec6d['model']=_[_0x085d('0x38')](db['CmHopper'][_0x085d('0x12')]);_0x65ec6d[_0x085d('0x17')]=_['keys'](_0x10d5cf[_0x085d('0x17')]);_0x65ec6d[_0x085d('0x19')]=_[_0x085d('0x18')](_0x65ec6d['model'],_0x65ec6d['query']);_0x3a8646[_0x085d('0x29')]=_[_0x085d('0x18')](_0x65ec6d[_0x085d('0x15')],qs[_0x085d('0x2a')](_0x10d5cf[_0x085d('0x17')][_0x085d('0x2a')]));_0x3a8646[_0x085d('0x29')]=_0x3a8646[_0x085d('0x29')][_0x085d('0x2b')]?_0x3a8646[_0x085d('0x29')]:_0x65ec6d['model'];if(_0x10d5cf['query'][_0x085d('0x39')]){_0x3a8646[_0x085d('0x34')]=[{'all':!![]}];}_0x3a8646=_[_0x085d('0x32')]({},_0x3a8646,_0x10d5cf[_0x085d('0x3a')]);return db[_0x085d('0x11')][_0x085d('0x3b')](_0x3a8646)[_0x085d('0xb')](handleEntityNotFound(_0x47e1e8,null))[_0x085d('0xb')](respondWithResult(_0x47e1e8,null))[_0x085d('0x36')](handleError(_0x47e1e8,null));};exports[_0x085d('0x3c')]=function(_0x20a4ef,_0x4d5167){return db[_0x085d('0x11')][_0x085d('0x3c')](_0x20a4ef[_0x085d('0x3d')],{})[_0x085d('0xb')](respondWithResult(_0x4d5167,0xc9))[_0x085d('0x36')](handleError(_0x4d5167,null));};exports['update']=function(_0x13ba2d,_0x544729){if(_0x13ba2d[_0x085d('0x3d')]['id']){delete _0x13ba2d['body']['id'];}return db['CmHopper'][_0x085d('0x3b')]({'where':{'id':_0x13ba2d[_0x085d('0x37')]['id']}})[_0x085d('0xb')](handleEntityNotFound(_0x544729,null))[_0x085d('0xb')](saveUpdates(_0x13ba2d[_0x085d('0x3d')],null))['then'](respondWithResult(_0x544729,null))['catch'](handleError(_0x544729,null));};exports['describe']=function(_0x580b91,_0x5aeb4a){return db[_0x085d('0x11')][_0x085d('0x3e')]()['then'](respondWithResult(_0x5aeb4a,null))[_0x085d('0x36')](handleError(_0x5aeb4a,null));};exports['destroy']=function(_0x5df4cf,_0x415a4b){var _0x20cdcb;var _0x1da4b8=_0x5df4cf[_0x085d('0x37')]['id'];return db['CmHopper'][_0x085d('0x3b')]({'where':{'id':_0x5df4cf['params']['id']}})[_0x085d('0xb')](handleEntityNotFound(_0x415a4b,null))[_0x085d('0xb')](function(_0x5d6f22){if(_0x5d6f22){return _0x5d6f22[_0x085d('0x3f')]()[_0x085d('0xb')](function(_0x298f6f){return _0x298f6f;});}})[_0x085d('0xb')](function(_0x58955e){_0x20cdcb=_0x58955e;if(_0x58955e){if(_0x58955e[_0x085d('0x40')]||_0x58955e['CampaignId']){return db[_0x58955e[_0x085d('0x40')]?'VoiceQueue':'Campaign'][_0x085d('0x3b')]({'where':{'id':_0x58955e[_0x085d('0x40')]?_0x58955e[_0x085d('0x40')]:_0x58955e[_0x085d('0x41')]},'attributes':['id',_0x085d('0xe')],'raw':!![]});}}})[_0x085d('0xb')](function(_0x1c3081){var _0x1bac21={};if(_0x1c3081){_['merge'](_0x1bac21,_['omit'](_0x20cdcb['dataValues'],[_0x085d('0x42'),'updatedAt','id']));_0x1bac21[_0x085d('0x43')]=0x15;_0x1bac21['statedesc']=_0x085d('0x44');_0x1bac21[_0x085d('0x45')]=_0x1c3081[_0x085d('0xe')];_0x1bac21[_0x085d('0x46')]=_0x5df4cf['user']['name'];_0x1bac21[_0x085d('0x47')]=_0x5df4cf[_0x085d('0x48')]['id'];_0x1bac21['deleted']=!![];_0x1bac21[_0x085d('0x49')]=moment()[_0x085d('0x4a')](_0x085d('0x4b'));_0x1bac21[_0x085d('0x4c')]=_0x20cdcb[_0x085d('0x4d')];_0x1bac21[_0x085d('0x4e')]=_0x20cdcb[_0x085d('0x40')]?_0x085d('0x4f'):'ivr';return db[_0x085d('0x50')]['find']({'where':{'id':_0x1bac21[_0x085d('0x51')]},'attributes':['firstName',_0x085d('0x52')]})['then'](function(_0x402157){if(!_[_0x085d('0x53')](_0x415a4b)&&!_['isNil'](_0x402157['firstName'])){_0x1bac21[_0x085d('0x54')]=_0x402157[_0x085d('0x55')];if(!_[_0x085d('0x53')](_0x402157[_0x085d('0x52')])){_0x1bac21[_0x085d('0x54')]+='\x20'+_0x402157[_0x085d('0x52')];}}})[_0x085d('0x56')](function(){return db[_0x085d('0x57')][_0x085d('0x3c')](_0x1bac21);});}})[_0x085d('0xb')](function(_0x289303){return db[_0x085d('0x58')][_0x085d('0x3f')]({'where':{'CmHopperId':_0x1da4b8}});})[_0x085d('0xb')](function(){return _0x415a4b['status'](0xcc)['end']();})[_0x085d('0x36')](handleError(_0x415a4b,null));};exports[_0x085d('0x59')]=function(_0x4b606d,_0x5b89e1){var _0x4e695e=[];return db[_0x085d('0x50')][_0x085d('0x3e')]()['then'](function(_0x210f01){_0x4e695e=_[_0x085d('0x38')](_0x210f01);return _0x4b606d[_0x085d('0x48')]['getVoiceQueues']({'where':{'type':_0x085d('0x5a'),'dialActive':!![],'dialMethod':_0x085d('0x5b')},'attributes':['id',_0x085d('0x5c'),_0x085d('0x5d')],'raw':!![]});})['then'](function(_0x3fc07e){if(_0x3fc07e&&_0x3fc07e[_0x085d('0x2b')]){return db['sequelize'][_0x085d('0x5e')](function(_0x375779){var _0x1a7ddc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3fc07e,'id')},'$or':[{'UserId':null},{'UserId':_0x4b606d[_0x085d('0x48')]['id']}]};var _0x586569={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc07e)['filter']([_0x085d('0x5d'),0x0])['map']('id')[_0x085d('0x5f')]()},'$or':[{'UserId':null},{'UserId':_0x4b606d[_0x085d('0x48')]['id']}]};var _0x50fe13={'$or':[_0x1a7ddc,_0x586569]};var _0x1f23f2=[];if(_0x4b606d[_0x085d('0x3d')]['direction']&&_0x4b606d[_0x085d('0x3d')][_0x085d('0x60')]===_0x085d('0x61')){if(!_[_0x085d('0x62')](_0x4b606d['body']['hopperIds'])){_0x50fe13['id']={'$in':_0x4b606d[_0x085d('0x3d')][_0x085d('0x63')]};}_0x1f23f2=[[_0x085d('0x64'),_0x085d('0x65')],['scheduledAt',_0x3fc07e[0x0]['dialOrderByScheduledAt']==='ASC'?_0x085d('0x66'):'ASC'],db['sequelize'][_0x085d('0x67')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x085d('0x66')]];}else{if(!_[_0x085d('0x62')](_0x4b606d[_0x085d('0x3d')][_0x085d('0x63')])){_0x50fe13['id']={'$notIn':_0x4b606d['body'][_0x085d('0x63')]};}_0x1f23f2=[[_0x085d('0x64'),_0x085d('0x66')],[_0x085d('0x68'),_0x3fc07e[0x0][_0x085d('0x5c')]],db[_0x085d('0x69')][_0x085d('0x67')](_0x085d('0x6a')),['id',_0x085d('0x65')]];}return db[_0x085d('0x11')]['findOne']({'attributes':['id','scheduledat',_0x085d('0x4d'),_0x085d('0x6b')],'where':_0x50fe13,'order':_0x1f23f2,'transaction':_0x375779,'lock':_0x375779['LOCK'][_0x085d('0x6c')],'include':[{'model':db[_0x085d('0x50')],'as':_0x085d('0x6d'),'attributes':_0x4e695e,'include':[{'model':db[_0x085d('0x6e')],'as':_0x085d('0x6f'),'attributes':['id',_0x085d('0xe')]}]},{'model':db[_0x085d('0x70')],'as':_0x085d('0x71'),'attributes':['id',_0x085d('0xe')]},{'model':db[_0x085d('0x72')],'as':_0x085d('0x73'),'attributes':['id',_0x085d('0xe'),_0x085d('0x74')]}]})[_0x085d('0xb')](function(_0xf17978){if(_0xf17978){return _0xf17978[_0x085d('0xa')]({'UserId':_0x4b606d[_0x085d('0x48')]['id']},{'transaction':_0x375779});}});});}})['then'](handleEntityNotFound(_0x5b89e1,null))[_0x085d('0xb')](respondWithResult(_0x5b89e1,null))[_0x085d('0x36')](handleError(_0x5b89e1,null));};exports[_0x085d('0x75')]=function(_0x53d5ba,_0x326e94,_0x4de098){var _0x53fd1b=[];var _0x261ac7=_0x53d5ba[_0x085d('0x37')]['id'];var _0x4ba7a8=_0x53d5ba[_0x085d('0x48')]['id'];return db[_0x085d('0x50')][_0x085d('0x3e')]()[_0x085d('0xb')](function(_0x2f21c0){_0x53fd1b=_['keys'](_0x2f21c0);return db[_0x085d('0x69')][_0x085d('0x5e')](function(_0x5ada01){const _0x52cc7b={'id':_0x261ac7};return db[_0x085d('0x11')]['findOne']({'attributes':['id',_0x085d('0x76'),_0x085d('0x6b')],'where':_0x52cc7b,'transaction':_0x5ada01,'lock':_0x5ada01[_0x085d('0x77')][_0x085d('0x6c')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x53fd1b,'include':[{'model':db[_0x085d('0x6e')],'as':_0x085d('0x6f'),'attributes':['id',_0x085d('0xe')]}]},{'model':db['CmList'],'as':_0x085d('0x71'),'attributes':['id','name']},{'model':db[_0x085d('0x72')],'as':_0x085d('0x73'),'attributes':['id',_0x085d('0xe'),'dialActive']}]})[_0x085d('0xb')](function(_0x5994ec){if(_0x5994ec){return _0x5994ec[_0x085d('0xa')]({'UserId':_0x4ba7a8},{'transaction':_0x5ada01});}});});})[_0x085d('0xb')](handleEntityNotFound(_0x326e94,null))[_0x085d('0xb')](respondWithResult(_0x326e94,null))['catch'](handleError(_0x326e94,null));};exports['getOpenContacts']=function(_0x1c62e5,_0x2bc093){return _0x1c62e5[_0x085d('0x48')][_0x085d('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x143289){if(_0x143289&&_0x143289[_0x085d('0x2b')]){return db[_0x085d('0x11')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x085d('0x4b'))},'VoiceQueueId':{'$in':_[_0x085d('0x16')](_0x143289,'id')},'$or':[{'UserId':null},{'UserId':_0x1c62e5[_0x085d('0x48')]['id']}]}});}return 0x0;})['then'](function(_0x16f6e7){if(!_['isNil'](_0x16f6e7)&&_[_0x085d('0x79')](_0x16f6e7)){return _0x2bc093[_0x085d('0x8')](0xc8)['json']({'contacts':_0x16f6e7});}else{logger[_0x085d('0xc')](_0x085d('0x7a'),_0x085d('0x7b'),0x194,'entity\x20not\x20found');_0x2bc093[_0x085d('0x7c')](0x194);}})[_0x085d('0x36')](handleError(_0x2bc093,null));};exports[_0x085d('0x7d')]=function(_0x18809c,_0x2de70b){var _0x562711=shared[_0x085d('0x7e')];var _0x11a937=[];_[_0x085d('0x16')](_0x562711,function(_0x4f866b){_0x11a937[_0x085d('0x7f')]({'id':_0x4f866b[_0x085d('0xe')],'name':_0x4f866b[_0x085d('0xe')],'utcOffset':_0x4f866b[_0x085d('0x80')]});});return _0x2de70b[_0x085d('0x8')](0xc8)[_0x085d('0x3')]({'tz':_0x11a937});};exports[_0x085d('0x81')]=function(_0x32cbca,_0x57706d){var _0x1f3144=shared['timezones'];var _0x4a4e8e={};if(!_[_0x085d('0x53')](_0x1f3144[_0x32cbca[_0x085d('0x3d')]['id']]))_0x4a4e8e=_0x1f3144[_0x32cbca[_0x085d('0x3d')]['id']];return _0x57706d[_0x085d('0x8')](0xc8)[_0x085d('0x3')](_0x4a4e8e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index fd8a5d7..012d5d9 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 _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x3f4d2b,_0x22ab7d){var _0x37fdc5=function(_0x1f0467){while(--_0x1f0467){_0x3f4d2b['push'](_0x3f4d2b['shift']());}};_0x37fdc5(++_0x22ab7d);}(_0xfcf0,0x138));var _0x0fcf=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xfcf0[_0x37c8ef];return _0x5eaee9;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xc')]},{'name':_0x0fcf('0xd'),'fields':['phone']},{'name':_0x0fcf('0xe'),'fields':[_0x0fcf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x3fac3a,_0x3522ad){var _0x18fff1=function(_0x21b45f){while(--_0x21b45f){_0x3fac3a['push'](_0x3fac3a['shift']());}};_0x18fff1(++_0x3522ad);}(_0x7096,0x10c));var _0x6709=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7096[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 6882660..6b1e7af 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 _0xaf73=['phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','util','moment','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','model','map','attributes','then','debug','stringify','error','ShowCmHopper','catch','message','info','CreateCmHopper','UpdateCmHopper','update','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','UserId','includes','push','all','length','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','CountReScheduled','GetContactRecallMe','GetContactByPhone','findOne'];(function(_0x59f6e2,_0x5deb55){var _0x30b2f5=function(_0x85d9ba){while(--_0x85d9ba){_0x59f6e2['push'](_0x59f6e2['shift']());}};_0x30b2f5(++_0x5deb55);}(_0xaf73,0x188));var _0x3af7=function(_0x2f205f,_0x20c7c6){_0x2f205f=_0x2f205f-0x0;var _0xaa58ff=_0xaf73[_0x2f205f];return _0xaa58ff;};'use strict';var _=require(_0x3af7('0x0'));var util=require(_0x3af7('0x1'));var moment=require(_0x3af7('0x2'));var BPromise=require('bluebird');var db=require(_0x3af7('0x3'))['db'];var logger=require(_0x3af7('0x4'))('rpc');exports[_0x3af7('0x5')]=function(_0x2c3bb2){var _0x5a6a39=this;return new Promise(function(_0x1afca6,_0x3ce45f){return db[_0x3af7('0x6')][_0x3af7('0x7')]({'raw':_0x2c3bb2[_0x3af7('0x8')]?_0x2c3bb2['options'][_0x3af7('0x9')]===undefined?!![]:![]:!![],'where':_0x2c3bb2[_0x3af7('0x8')]?_0x2c3bb2[_0x3af7('0x8')][_0x3af7('0xa')]||null:null,'attributes':_0x2c3bb2['options']?_0x2c3bb2[_0x3af7('0x8')]['attributes']||null:null,'limit':_0x2c3bb2[_0x3af7('0x8')]?_0x2c3bb2['options'][_0x3af7('0xb')]||null:null,'include':_0x2c3bb2[_0x3af7('0x8')]?_0x2c3bb2[_0x3af7('0x8')][_0x3af7('0xc')]?_['map'](_0x2c3bb2[_0x3af7('0x8')][_0x3af7('0xc')],function(_0x5afbf2){return{'model':db[_0x5afbf2[_0x3af7('0xd')]],'as':_0x5afbf2['as'],'attributes':_0x5afbf2['attributes'],'include':_0x5afbf2[_0x3af7('0xc')]?_[_0x3af7('0xe')](_0x5afbf2[_0x3af7('0xc')],function(_0xe6d20a){return{'model':db[_0xe6d20a[_0x3af7('0xd')]],'as':_0xe6d20a['as'],'attributes':_0xe6d20a[_0x3af7('0xf')],'include':_0xe6d20a[_0x3af7('0xc')]?_[_0x3af7('0xe')](_0xe6d20a[_0x3af7('0xc')],function(_0x360d67){return{'model':db[_0x360d67['model']],'as':_0x360d67['as'],'attributes':_0x360d67['attributes']};}):[]};}):[]};}):[]:[]})[_0x3af7('0x10')](function(_0x2c4bfd){logger['info'](_0x3af7('0x5'),_0x2c3bb2);logger[_0x3af7('0x11')](_0x3af7('0x5'),_0x2c3bb2,JSON[_0x3af7('0x12')](_0x2c4bfd));_0x1afca6(_0x2c4bfd);})['catch'](function(_0x4d31cc){logger['error'](_0x3af7('0x5'),_0x4d31cc['message'],_0x2c3bb2);_0x3ce45f(_0x5a6a39[_0x3af7('0x13')](0x1f4,_0x4d31cc['message']));});});};exports[_0x3af7('0x14')]=function(_0x16ecfe){var _0x418c14=this;return new Promise(function(_0xacb376,_0xa13503){return db[_0x3af7('0x6')]['find']({'raw':_0x16ecfe[_0x3af7('0x8')]?_0x16ecfe[_0x3af7('0x8')][_0x3af7('0x9')]===undefined?!![]:![]:!![],'where':_0x16ecfe[_0x3af7('0x8')]?_0x16ecfe[_0x3af7('0x8')][_0x3af7('0xa')]||null:null,'attributes':_0x16ecfe[_0x3af7('0x8')]?_0x16ecfe[_0x3af7('0x8')][_0x3af7('0xf')]||null:null,'include':_0x16ecfe['options']?_0x16ecfe['options'][_0x3af7('0xc')]?_[_0x3af7('0xe')](_0x16ecfe['options'][_0x3af7('0xc')],function(_0x10701c){return{'model':db[_0x10701c[_0x3af7('0xd')]],'as':_0x10701c['as'],'attributes':_0x10701c[_0x3af7('0xf')],'include':_0x10701c[_0x3af7('0xc')]?_['map'](_0x10701c[_0x3af7('0xc')],function(_0x678640){return{'model':db[_0x678640[_0x3af7('0xd')]],'as':_0x678640['as'],'attributes':_0x678640['attributes'],'include':_0x678640[_0x3af7('0xc')]?_['map'](_0x678640[_0x3af7('0xc')],function(_0x4252cf){return{'model':db[_0x4252cf[_0x3af7('0xd')]],'as':_0x4252cf['as'],'attributes':_0x4252cf[_0x3af7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x3af7('0x10')](function(_0x16c96e){logger['info']('ShowCmHopper',_0x16ecfe);logger[_0x3af7('0x11')](_0x3af7('0x14'),_0x16ecfe,JSON[_0x3af7('0x12')](_0x16c96e));_0xacb376(_0x16c96e);})[_0x3af7('0x15')](function(_0x5ec016){logger[_0x3af7('0x13')](_0x3af7('0x14'),_0x5ec016[_0x3af7('0x16')],_0x16ecfe);_0xa13503(_0x418c14['error'](0x1f4,_0x5ec016['message']));});});};exports['CreateCmHopper']=function(_0x4c0e4d){var _0xd14946=this;return new Promise(function(_0x32169d,_0x53a298){return db[_0x3af7('0x6')]['create'](_0x4c0e4d['body'],{'raw':_0x4c0e4d[_0x3af7('0x8')]?_0x4c0e4d[_0x3af7('0x8')][_0x3af7('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x5219fa){logger[_0x3af7('0x17')](_0x3af7('0x18'),_0x4c0e4d);logger['debug'](_0x3af7('0x18'),_0x4c0e4d,JSON[_0x3af7('0x12')](_0x5219fa));_0x32169d(_0x5219fa);})[_0x3af7('0x15')](function(_0xbe85a7){logger[_0x3af7('0x13')](_0x3af7('0x18'),_0xbe85a7['message'],_0x4c0e4d);_0x53a298(_0xd14946['error'](0x1f4,_0xbe85a7[_0x3af7('0x16')]));});});};exports[_0x3af7('0x19')]=function(_0x15c185){var _0x504ccd=this;return new Promise(function(_0x497d74,_0x9c01bd){return db[_0x3af7('0x6')][_0x3af7('0x1a')](_0x15c185[_0x3af7('0x1b')],{'raw':_0x15c185[_0x3af7('0x8')]?_0x15c185[_0x3af7('0x8')][_0x3af7('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c185[_0x3af7('0x8')]?_0x15c185['options'][_0x3af7('0xa')]||null:null,'attributes':_0x15c185[_0x3af7('0x8')]?_0x15c185[_0x3af7('0x8')]['attributes']||null:null,'limit':_0x15c185[_0x3af7('0x8')]?_0x15c185[_0x3af7('0x8')]['limit']||null:null})[_0x3af7('0x10')](function(_0x41c17d){logger[_0x3af7('0x17')]('UpdateCmHopper',_0x15c185);logger[_0x3af7('0x17')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x3af7('0x12')](_0x15c185[_0x3af7('0x8')][_0x3af7('0xa')]),_0x15c185[_0x3af7('0x1b')][_0x3af7('0x1c')]);logger[_0x3af7('0x11')](_0x3af7('0x19'),_0x15c185,JSON[_0x3af7('0x12')](_0x41c17d));_0x497d74(_0x41c17d);})[_0x3af7('0x15')](function(_0xcab2dd){logger[_0x3af7('0x13')]('UpdateCmHopper',_0xcab2dd[_0x3af7('0x16')],_0x15c185);_0x9c01bd(_0x504ccd[_0x3af7('0x13')](0x1f4,_0xcab2dd['message']));});});};exports[_0x3af7('0x1d')]=function(_0x472eda){var _0x29b21c=this;return new Promise(function(_0x3fac88,_0x52af20){return db[_0x3af7('0x6')][_0x3af7('0x1e')]({'where':_0x472eda[_0x3af7('0x8')]?_0x472eda[_0x3af7('0x8')]['where']||null:null})[_0x3af7('0x10')](function(_0x1c8036){logger[_0x3af7('0x17')](_0x3af7('0x1d'),_0x472eda);logger[_0x3af7('0x11')]('DestroyCmHopper',_0x472eda,JSON[_0x3af7('0x12')](_0x1c8036));_0x3fac88(_0x1c8036);})[_0x3af7('0x15')](function(_0x57f6be){logger['error']('DestroyCmHopper',_0x57f6be['message'],_0x472eda);_0x52af20(_0x29b21c[_0x3af7('0x13')](0x1f4,_0x57f6be[_0x3af7('0x16')]));});});};exports[_0x3af7('0x1f')]=function(_0x1ba913){var _0x3b01ad=this;return new Promise(function(_0x50e161,_0x2fe8d5){return db[_0x3af7('0x20')][_0x3af7('0x21')]()[_0x3af7('0x10')](function(_0x2c66fd){return db[_0x3af7('0x22')]['transaction'](function(_0x2661ce){return db[_0x3af7('0x6')][_0x3af7('0x7')]({'where':_0x1ba913['options']?_0x1ba913[_0x3af7('0x8')][_0x3af7('0xa')]||null:null,'attributes':_0x1ba913['options']?_0x1ba913[_0x3af7('0x8')][_0x3af7('0xf')]||null:null,'limit':_0x1ba913[_0x3af7('0x8')]?_0x1ba913['options'][_0x3af7('0xb')]||null:null,'order':_0x1ba913[_0x3af7('0x8')]?_0x1ba913[_0x3af7('0x8')]['order']||null:null,'transaction':_0x2661ce,'lock':_0x2661ce[_0x3af7('0x23')][_0x3af7('0x24')],'include':[{'model':db[_0x3af7('0x20')],'as':_0x3af7('0x25'),'attributes':_[_0x3af7('0x26')](_0x2c66fd)},{'model':db[_0x3af7('0x27')],'as':_0x3af7('0x28'),'attributes':['id',_0x3af7('0x29'),_0x3af7('0x2a')]}]})[_0x3af7('0x10')](function(_0x12f10a){var _0x418d3a=[];var _0xee652b=[];for(var _0x2f4555=0x0;_0x2f4555<_0x12f10a['length'];_0x2f4555+=0x1){var _0x15b1c8=_0x12f10a[_0x2f4555][_0x3af7('0x2b')];if(_0x15b1c8===null){_0x418d3a['push'](_0x12f10a[_0x2f4555][_0x3af7('0x1a')](_0x1ba913[_0x3af7('0x1b')],{'transaction':_0x2661ce}));}else if(!_0xee652b[_0x3af7('0x2c')](_0x15b1c8)){_0xee652b[_0x3af7('0x2d')](_0x15b1c8);_0x418d3a[_0x3af7('0x2d')](_0x12f10a[_0x2f4555]['update'](_0x1ba913['body'],{'transaction':_0x2661ce}));}}return BPromise[_0x3af7('0x2e')](_0x418d3a);});})[_0x3af7('0x10')](function(_0x58cee0){logger[_0x3af7('0x17')](_0x3af7('0x1f'),_0x1ba913);if(_0x58cee0[_0x3af7('0x2f')]>0x0){logger[_0x3af7('0x17')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x58cee0[0x0][_0x3af7('0x30')]['id'],_0x58cee0[0x0][_0x3af7('0x30')][_0x3af7('0x31')],_0x58cee0[0x0]['dataValues'][_0x3af7('0x1c')]);}logger[_0x3af7('0x11')](_0x3af7('0x1f'),_0x1ba913,JSON[_0x3af7('0x12')](_0x58cee0));_0x50e161(_0x58cee0);})[_0x3af7('0x15')](function(_0x3000e2){logger[_0x3af7('0x13')](_0x3af7('0x1f'),_0x3000e2[_0x3af7('0x16')],_0x1ba913);_0x2fe8d5(_0x3b01ad['error'](0x1f4,_0x3000e2[_0x3af7('0x16')]));});});});};exports[_0x3af7('0x32')]=function(_0x51bc23){var _0x5aff97=this;return new Promise(function(_0x469ea5,_0x17ffec){return db[_0x3af7('0x22')][_0x3af7('0x33')](function(_0x32b2fe){return db[_0x3af7('0x34')][_0x3af7('0x35')](_0x51bc23[_0x3af7('0x1b')],{'raw':_0x51bc23[_0x3af7('0x8')]?_0x51bc23[_0x3af7('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x32b2fe})['then'](function(){logger[_0x3af7('0x17')](_0x3af7('0x36'),JSON[_0x3af7('0x12')](_0x51bc23['options'][_0x3af7('0xa')]),_0x51bc23[_0x3af7('0x8')][_0x3af7('0xa')][_0x3af7('0x1c')]);return db[_0x3af7('0x6')][_0x3af7('0x1e')]({'where':_0x51bc23[_0x3af7('0x8')]?_0x51bc23['options']['where']||null:null,'transaction':_0x32b2fe});});})[_0x3af7('0x10')](function(_0x431865){logger[_0x3af7('0x17')](_0x3af7('0x32'),_0x51bc23);logger[_0x3af7('0x11')]('MoveContactManagedDialer',_0x51bc23,JSON[_0x3af7('0x12')](_0x431865));_0x469ea5(_0x431865);})[_0x3af7('0x15')](function(_0x42f60d){logger[_0x3af7('0x13')](_0x3af7('0x32'),_0x42f60d['message'],_0x51bc23);_0x17ffec(_0x5aff97[_0x3af7('0x13')](0x1f4,_0x42f60d[_0x3af7('0x16')]));});});};exports['CountReScheduled']=function(_0x400e1c){var _0x5a8bbe=this;return new Promise(function(_0x426456,_0x5d324d){return db[_0x3af7('0x6')][_0x3af7('0x7')]({'raw':_0x400e1c[_0x3af7('0x8')]?_0x400e1c['options']['raw']===undefined?!![]:![]:!![],'where':_0x400e1c[_0x3af7('0x8')]?_0x400e1c[_0x3af7('0x8')][_0x3af7('0xa')]||null:null,'attributes':[[db[_0x3af7('0x22')]['fn']('COUNT',db[_0x3af7('0x22')]['fn']('IF',db['sequelize'][_0x3af7('0x37')](_0x3af7('0x38')+util[_0x3af7('0x39')](_0x3af7('0x3a'),moment()['format'](_0x3af7('0x3b')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x3af7('0x10')](function(_0x17b185){logger['info']('CountReScheduled',_0x400e1c);logger[_0x3af7('0x11')](_0x3af7('0x3c'),_0x400e1c,JSON[_0x3af7('0x12')](_0x17b185));_0x426456(_0x17b185);})[_0x3af7('0x15')](function(_0x4587f7){logger[_0x3af7('0x13')](_0x3af7('0x3c'),_0x4587f7[_0x3af7('0x16')],_0x400e1c);_0x5d324d(_0x5a8bbe['error'](0x1f4,_0x4587f7[_0x3af7('0x16')]));});});};exports[_0x3af7('0x3d')]=function(_0x6cf01a){var _0x2dc445=this;return new Promise(function(_0x532119,_0x580f28){return db[_0x3af7('0x20')][_0x3af7('0x21')]()['then'](function(){return db[_0x3af7('0x22')][_0x3af7('0x33')](function(_0x8e695d){return db[_0x3af7('0x6')][_0x3af7('0x7')]({'where':_0x6cf01a['options']?_0x6cf01a[_0x3af7('0x8')][_0x3af7('0xa')]||null:null,'attributes':_0x6cf01a[_0x3af7('0x8')]?_0x6cf01a[_0x3af7('0x8')][_0x3af7('0xf')]||null:null,'limit':0x1,'order':_0x6cf01a[_0x3af7('0x8')]?_0x6cf01a[_0x3af7('0x8')]['order']||null:null,'group':db[_0x3af7('0x6')][_0x3af7('0x2b')],'transaction':_0x8e695d,'lock':_0x8e695d['LOCK'][_0x3af7('0x24')],'include':_0x6cf01a['options']?_0x6cf01a[_0x3af7('0x8')]['include']?_['map'](_0x6cf01a[_0x3af7('0x8')]['include'],function(_0x28a8b5){return{'model':db[_0x28a8b5['model']],'as':_0x28a8b5['as'],'attributes':_0x28a8b5[_0x3af7('0xf')],'include':_0x28a8b5[_0x3af7('0xc')]?_[_0x3af7('0xe')](_0x28a8b5['include'],function(_0x1e6263){return{'model':db[_0x1e6263['model']],'as':_0x1e6263['as'],'attributes':_0x1e6263[_0x3af7('0xf')],'include':_0x1e6263['include']?_[_0x3af7('0xe')](_0x1e6263['include'],function(_0x790835){return{'model':db[_0x790835['model']],'as':_0x790835['as'],'attributes':_0x790835[_0x3af7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x3af7('0x10')](function(_0x6116f1){var _0x8f1197=[];for(var _0x14b8ac=0x0;_0x14b8ac<_0x6116f1[_0x3af7('0x2f')];_0x14b8ac+=0x1){_0x8f1197['push'](_0x6116f1[_0x14b8ac][_0x3af7('0x1a')](_0x6cf01a[_0x3af7('0x1b')],{'transaction':_0x8e695d}));}return BPromise['all'](_0x8f1197);});})[_0x3af7('0x10')](function(_0x4a7dfd){logger[_0x3af7('0x17')]('GetContactRecallMe',_0x6cf01a);logger[_0x3af7('0x11')](_0x3af7('0x3d'),_0x6cf01a,JSON[_0x3af7('0x12')](_0x4a7dfd));_0x532119(_0x4a7dfd);})[_0x3af7('0x15')](function(_0xeb9210){logger['error']('GetContactRecallMe',_0xeb9210['message'],_0x6cf01a);_0x580f28(_0x2dc445[_0x3af7('0x13')](0x1f4,_0xeb9210[_0x3af7('0x16')]));});});});};exports['GetCmHopperPreview']=function(_0x57bb2e){var _0x41e648=this;return new Promise(function(_0x1e0935,_0xe88e5b){db[_0x3af7('0x20')][_0x3af7('0x21')]()[_0x3af7('0x10')](function(_0x2cc7b1){return db['CmHopper'][_0x3af7('0x7')]({'raw':_0x57bb2e[_0x3af7('0x8')]?_0x57bb2e[_0x3af7('0x8')][_0x3af7('0x9')]===undefined?!![]:![]:!![],'where':_0x57bb2e[_0x3af7('0x8')]?_0x57bb2e[_0x3af7('0x8')][_0x3af7('0xa')]||null:null,'attributes':_0x57bb2e[_0x3af7('0x8')]?_0x57bb2e[_0x3af7('0x8')][_0x3af7('0xf')]||null:null,'limit':_0x57bb2e[_0x3af7('0x8')]?_0x57bb2e[_0x3af7('0x8')][_0x3af7('0xb')]||null:null,'include':_0x57bb2e[_0x3af7('0x8')]?_0x57bb2e[_0x3af7('0x8')]['include']?_['map'](_0x57bb2e['options'][_0x3af7('0xc')],function(_0x4bda2e){return{'model':db[_0x4bda2e[_0x3af7('0xd')]],'as':_0x4bda2e['as'],'attributes':_0x4bda2e['as']===_0x3af7('0x25')?_[_0x3af7('0x26')](_0x2cc7b1):_0x4bda2e[_0x3af7('0xf')],'include':_0x4bda2e[_0x3af7('0xc')]?_[_0x3af7('0xe')](_0x4bda2e['include'],function(_0x37af66){return{'model':db[_0x37af66[_0x3af7('0xd')]],'as':_0x37af66['as'],'attributes':_0x37af66[_0x3af7('0xf')],'include':_0x37af66[_0x3af7('0xc')]?_[_0x3af7('0xe')](_0x37af66[_0x3af7('0xc')],function(_0x5a5916){return{'model':db[_0x5a5916[_0x3af7('0xd')]],'as':_0x5a5916['as'],'attributes':_0x5a5916[_0x3af7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x3af7('0x10')](function(_0x4fee48){logger[_0x3af7('0x17')]('GetCmHopper',_0x57bb2e);logger['debug'](_0x3af7('0x5'),_0x57bb2e,JSON['stringify'](_0x4fee48));_0x1e0935(_0x4fee48);})['catch'](function(_0x1a19ba){logger[_0x3af7('0x13')](_0x3af7('0x5'),_0x1a19ba[_0x3af7('0x16')],_0x57bb2e);_0xe88e5b(_0x41e648['error'](0x1f4,_0x1a19ba['message']));});});});};exports[_0x3af7('0x3e')]=function(_0x342958){var _0x31d32a=this;return new Promise(function(_0x474b66,_0x5a4906){return db[_0x3af7('0x20')][_0x3af7('0x3f')]({'raw':!![],'where':{'phone':_0x342958[_0x3af7('0x8')][_0x3af7('0xa')][_0x3af7('0x40')]},'attributes':['id',_0x3af7('0x41')],'order':[['id','DESC']]})[_0x3af7('0x10')](function(_0x39a8d3){logger['info'](_0x3af7('0x42'),_0x342958);logger[_0x3af7('0x11')]('getContactByPhone',_0x342958,JSON['stringify'](_0x39a8d3));_0x474b66(_0x39a8d3);})['catch'](function(_0x10cb4b){logger[_0x3af7('0x13')](_0x3af7('0x42'),_0x10cb4b[_0x3af7('0x16')],_0x342958);_0x5a4906(_0x31d32a[_0x3af7('0x13')](0x1f4,_0x10cb4b[_0x3af7('0x16')]));});});};exports[_0x3af7('0x43')]=function(_0x2f1219){var _0x505f22=this;return new Promise(function(_0x39c459,_0x657067){return db[_0x3af7('0x22')][_0x3af7('0x33')](function(_0x50c7e0){var _0x4c5f1e=_0x2f1219[_0x3af7('0x8')]&&_0x2f1219[_0x3af7('0x8')][_0x3af7('0xa')]?_0x2f1219[_0x3af7('0x8')][_0x3af7('0xa')]:{};return db[_0x3af7('0x6')][_0x3af7('0x1a')](_0x2f1219[_0x3af7('0x1b')],{'where':_0x4c5f1e,'transaction':_0x50c7e0})['then'](function(_0x184182){logger[_0x3af7('0x17')](_0x3af7('0x43'),_0x2f1219);logger[_0x3af7('0x11')]('ResetActiveCalls',_0x2f1219,JSON[_0x3af7('0x12')](_0x184182));_0x39c459(_0x184182);})[_0x3af7('0x15')](function(_0x1bdbaf){logger[_0x3af7('0x13')]('ResetActiveCalls',_0x1bdbaf[_0x3af7('0x16')],_0x2f1219);_0x657067(_0x505f22[_0x3af7('0x13')](0x1f4,_0x1bdbaf['message']));});});});};exports[_0x3af7('0x44')]=function(_0x3d2317){var _0x419504=this;var _0x2d31db=_0x3d2317[_0x3af7('0x1b')][_0x3af7('0xa')][_0x3af7('0x45')];var _0x4b49f8=_0x3d2317['body'][_0x3af7('0xa')][_0x3af7('0x46')];var _0x32407a=_0x3d2317[_0x3af7('0x1b')][_0x3af7('0xa')][_0x3af7('0x47')];return new Promise(function(_0x1daa29,_0x538ce8){return db['CmHopper'][_0x3af7('0x7')]({'where':{'voiceQueueId':{'$in':_0x2d31db},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x3af7('0x48')+_0x4b49f8+_0x3af7('0x49')),'$gt':db[_0x3af7('0x22')][_0x3af7('0x37')](_0x3af7('0x4a'))}},'UserId':{'$in':_0x32407a}},'include':[{'model':db[_0x3af7('0x20')],'as':_0x3af7('0x25')},{'model':db[_0x3af7('0x27')],'as':_0x3af7('0x28'),'attributes':['id',_0x3af7('0x29'),_0x3af7('0x2a')]},{'model':db[_0x3af7('0x4b')],'as':'List'}]})[_0x3af7('0x10')](function(_0x10ec8e){if(_0x10ec8e[_0x3af7('0x2f')]>0x0){return db[_0x3af7('0x22')]['transaction'](function(_0x361a52){return db[_0x3af7('0x6')][_0x3af7('0x1a')]({'recallmeNotifiedDate':db['sequelize'][_0x3af7('0x37')](_0x3af7('0x4a'))},{'where':{'id':{'$in':_[_0x3af7('0xe')](_0x10ec8e,'id')}},'transaction':_0x361a52})['then'](function(){_0x1daa29(_0x10ec8e);})[_0x3af7('0x15')](function(_0x536084){logger[_0x3af7('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x536084[_0x3af7('0x16')],_0x3d2317);_0x538ce8(_0x419504['error'](0x1f4,_0x536084[_0x3af7('0x16')]));});})[_0x3af7('0x15')](function(_0x511722){logger[_0x3af7('0x13')](_0x3af7('0x44'),_0x511722[_0x3af7('0x16')],_0x3d2317);_0x538ce8(_0x419504[_0x3af7('0x13')](0x1f4,_0x511722[_0x3af7('0x16')]));});}else{_0x1daa29(_0x10ec8e);}});});}; \ No newline at end of file +var _0x4361=['order','UPDATE','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','dataValues','ContactId','active','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','LOCK','length','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','NOW()','util','moment','../../mysqldb','GetCmHopper','CmHopper','options','where','attributes','include','map','model','info','debug','error','message','ShowCmHopper','find','raw','then','stringify','catch','CreateCmHopper','create','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll'];(function(_0x8ebaf5,_0x1d1923){var _0x23dba2=function(_0x4ef8a1){while(--_0x4ef8a1){_0x8ebaf5['push'](_0x8ebaf5['shift']());}};_0x23dba2(++_0x1d1923);}(_0x4361,0x1ea));var _0x1436=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x4361[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require(_0x1436('0x0'));var moment=require(_0x1436('0x1'));var BPromise=require('bluebird');var db=require(_0x1436('0x2'))['db'];var logger=require('../../config/logger')('rpc');exports[_0x1436('0x3')]=function(_0x2371da){var _0x130829=this;return new Promise(function(_0x37b169,_0x1adde9){return db[_0x1436('0x4')]['findAll']({'raw':_0x2371da[_0x1436('0x5')]?_0x2371da['options']['raw']===undefined?!![]:![]:!![],'where':_0x2371da[_0x1436('0x5')]?_0x2371da[_0x1436('0x5')][_0x1436('0x6')]||null:null,'attributes':_0x2371da[_0x1436('0x5')]?_0x2371da[_0x1436('0x5')][_0x1436('0x7')]||null:null,'limit':_0x2371da[_0x1436('0x5')]?_0x2371da[_0x1436('0x5')]['limit']||null:null,'include':_0x2371da[_0x1436('0x5')]?_0x2371da[_0x1436('0x5')][_0x1436('0x8')]?_[_0x1436('0x9')](_0x2371da['options']['include'],function(_0x5f3546){return{'model':db[_0x5f3546[_0x1436('0xa')]],'as':_0x5f3546['as'],'attributes':_0x5f3546[_0x1436('0x7')],'include':_0x5f3546[_0x1436('0x8')]?_[_0x1436('0x9')](_0x5f3546['include'],function(_0x30b1a5){return{'model':db[_0x30b1a5[_0x1436('0xa')]],'as':_0x30b1a5['as'],'attributes':_0x30b1a5['attributes'],'include':_0x30b1a5[_0x1436('0x8')]?_[_0x1436('0x9')](_0x30b1a5[_0x1436('0x8')],function(_0x439bdc){return{'model':db[_0x439bdc['model']],'as':_0x439bdc['as'],'attributes':_0x439bdc[_0x1436('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9be666){logger[_0x1436('0xb')](_0x1436('0x3'),_0x2371da);logger[_0x1436('0xc')](_0x1436('0x3'),_0x2371da,JSON['stringify'](_0x9be666));_0x37b169(_0x9be666);})['catch'](function(_0xc27f2){logger[_0x1436('0xd')](_0x1436('0x3'),_0xc27f2[_0x1436('0xe')],_0x2371da);_0x1adde9(_0x130829[_0x1436('0xd')](0x1f4,_0xc27f2['message']));});});};exports[_0x1436('0xf')]=function(_0xf37d85){var _0x2255b1=this;return new Promise(function(_0xdaa0f8,_0x31391f){return db['CmHopper'][_0x1436('0x10')]({'raw':_0xf37d85[_0x1436('0x5')]?_0xf37d85[_0x1436('0x5')][_0x1436('0x11')]===undefined?!![]:![]:!![],'where':_0xf37d85[_0x1436('0x5')]?_0xf37d85[_0x1436('0x5')][_0x1436('0x6')]||null:null,'attributes':_0xf37d85[_0x1436('0x5')]?_0xf37d85[_0x1436('0x5')][_0x1436('0x7')]||null:null,'include':_0xf37d85['options']?_0xf37d85[_0x1436('0x5')]['include']?_[_0x1436('0x9')](_0xf37d85[_0x1436('0x5')]['include'],function(_0x582c37){return{'model':db[_0x582c37[_0x1436('0xa')]],'as':_0x582c37['as'],'attributes':_0x582c37['attributes'],'include':_0x582c37[_0x1436('0x8')]?_[_0x1436('0x9')](_0x582c37[_0x1436('0x8')],function(_0x361c3b){return{'model':db[_0x361c3b[_0x1436('0xa')]],'as':_0x361c3b['as'],'attributes':_0x361c3b[_0x1436('0x7')],'include':_0x361c3b[_0x1436('0x8')]?_['map'](_0x361c3b[_0x1436('0x8')],function(_0x10b3b9){return{'model':db[_0x10b3b9[_0x1436('0xa')]],'as':_0x10b3b9['as'],'attributes':_0x10b3b9[_0x1436('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1436('0x12')](function(_0x40d570){logger['info'](_0x1436('0xf'),_0xf37d85);logger[_0x1436('0xc')]('ShowCmHopper',_0xf37d85,JSON[_0x1436('0x13')](_0x40d570));_0xdaa0f8(_0x40d570);})[_0x1436('0x14')](function(_0x3bfaad){logger[_0x1436('0xd')](_0x1436('0xf'),_0x3bfaad[_0x1436('0xe')],_0xf37d85);_0x31391f(_0x2255b1[_0x1436('0xd')](0x1f4,_0x3bfaad['message']));});});};exports[_0x1436('0x15')]=function(_0x1c2168){var _0x80d868=this;return new Promise(function(_0x1b206a,_0x2e0f15){return db[_0x1436('0x4')][_0x1436('0x16')](_0x1c2168[_0x1436('0x17')],{'raw':_0x1c2168[_0x1436('0x5')]?_0x1c2168[_0x1436('0x5')][_0x1436('0x11')]===undefined?!![]:![]:!![]})[_0x1436('0x12')](function(_0x30585c){logger[_0x1436('0xb')]('CreateCmHopper',_0x1c2168);logger['debug'](_0x1436('0x15'),_0x1c2168,JSON[_0x1436('0x13')](_0x30585c));_0x1b206a(_0x30585c);})[_0x1436('0x14')](function(_0x4fc76c){logger[_0x1436('0xd')]('CreateCmHopper',_0x4fc76c[_0x1436('0xe')],_0x1c2168);_0x2e0f15(_0x80d868[_0x1436('0xd')](0x1f4,_0x4fc76c[_0x1436('0xe')]));});});};exports[_0x1436('0x18')]=function(_0x20233a){var _0x1c30f6=this;return new Promise(function(_0x2346cf,_0x547a60){return db['CmHopper'][_0x1436('0x19')](_0x20233a[_0x1436('0x17')],{'raw':_0x20233a[_0x1436('0x5')]?_0x20233a['options'][_0x1436('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20233a[_0x1436('0x5')]?_0x20233a[_0x1436('0x5')][_0x1436('0x6')]||null:null,'attributes':_0x20233a[_0x1436('0x5')]?_0x20233a[_0x1436('0x5')]['attributes']||null:null,'limit':_0x20233a[_0x1436('0x5')]?_0x20233a['options'][_0x1436('0x1a')]||null:null})['then'](function(_0xfc0dd9){logger[_0x1436('0xb')](_0x1436('0x18'),_0x20233a);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1436('0x13')](_0x20233a['options']['where']),_0x20233a[_0x1436('0x17')]['active']);logger[_0x1436('0xc')](_0x1436('0x18'),_0x20233a,JSON[_0x1436('0x13')](_0xfc0dd9));_0x2346cf(_0xfc0dd9);})[_0x1436('0x14')](function(_0x335527){logger[_0x1436('0xd')](_0x1436('0x18'),_0x335527['message'],_0x20233a);_0x547a60(_0x1c30f6['error'](0x1f4,_0x335527['message']));});});};exports[_0x1436('0x1b')]=function(_0x56868d){var _0xe4aad3=this;return new Promise(function(_0x3c2e97,_0x3ed6d1){return db[_0x1436('0x4')][_0x1436('0x1c')]({'where':_0x56868d[_0x1436('0x5')]?_0x56868d[_0x1436('0x5')]['where']||null:null})[_0x1436('0x12')](function(_0x430cf2){logger[_0x1436('0xb')](_0x1436('0x1b'),_0x56868d);logger[_0x1436('0xc')](_0x1436('0x1b'),_0x56868d,JSON[_0x1436('0x13')](_0x430cf2));_0x3c2e97(_0x430cf2);})[_0x1436('0x14')](function(_0x3f0b1e){logger['error'](_0x1436('0x1b'),_0x3f0b1e[_0x1436('0xe')],_0x56868d);_0x3ed6d1(_0xe4aad3[_0x1436('0xd')](0x1f4,_0x3f0b1e['message']));});});};exports[_0x1436('0x1d')]=function(_0x494efb){var _0x494afa=this;return new Promise(function(_0x11f80e,_0x2c7c1b){return db[_0x1436('0x1e')][_0x1436('0x1f')]()[_0x1436('0x12')](function(_0x409480){return db[_0x1436('0x20')][_0x1436('0x21')](function(_0x94a0d2){return db[_0x1436('0x4')][_0x1436('0x22')]({'where':_0x494efb['options']?_0x494efb['options'][_0x1436('0x6')]||null:null,'attributes':_0x494efb[_0x1436('0x5')]?_0x494efb[_0x1436('0x5')][_0x1436('0x7')]||null:null,'limit':_0x494efb[_0x1436('0x5')]?_0x494efb[_0x1436('0x5')]['limit']||null:null,'order':_0x494efb[_0x1436('0x5')]?_0x494efb[_0x1436('0x5')][_0x1436('0x23')]||null:null,'transaction':_0x94a0d2,'lock':_0x94a0d2['LOCK'][_0x1436('0x24')],'include':[{'model':db[_0x1436('0x1e')],'as':_0x1436('0x25'),'attributes':_[_0x1436('0x26')](_0x409480)},{'model':db[_0x1436('0x27')],'as':_0x1436('0x28'),'attributes':['id',_0x1436('0x29'),_0x1436('0x2a')]}]})[_0x1436('0x12')](function(_0x9d0fed){var _0x22f4e4=[];var _0x2bddfe=[];for(var _0xcfafcb=0x0;_0xcfafcb<_0x9d0fed['length'];_0xcfafcb+=0x1){var _0x5bbc8b=_0x9d0fed[_0xcfafcb][_0x1436('0x2b')];if(_0x5bbc8b===null){_0x22f4e4[_0x1436('0x2c')](_0x9d0fed[_0xcfafcb][_0x1436('0x19')](_0x494efb[_0x1436('0x17')],{'transaction':_0x94a0d2}));}else if(!_0x2bddfe[_0x1436('0x2d')](_0x5bbc8b)){_0x2bddfe['push'](_0x5bbc8b);_0x22f4e4['push'](_0x9d0fed[_0xcfafcb][_0x1436('0x19')](_0x494efb[_0x1436('0x17')],{'transaction':_0x94a0d2}));}}return BPromise[_0x1436('0x2e')](_0x22f4e4);});})[_0x1436('0x12')](function(_0x32dd60){logger[_0x1436('0xb')](_0x1436('0x1d'),_0x494efb);if(_0x32dd60['length']>0x0){logger[_0x1436('0xb')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x32dd60[0x0][_0x1436('0x2f')]['id'],_0x32dd60[0x0][_0x1436('0x2f')][_0x1436('0x30')],_0x32dd60[0x0]['dataValues'][_0x1436('0x31')]);}logger[_0x1436('0xc')](_0x1436('0x1d'),_0x494efb,JSON[_0x1436('0x13')](_0x32dd60));_0x11f80e(_0x32dd60);})[_0x1436('0x14')](function(_0x2b5412){logger[_0x1436('0xd')](_0x1436('0x1d'),_0x2b5412[_0x1436('0xe')],_0x494efb);_0x2c7c1b(_0x494afa[_0x1436('0xd')](0x1f4,_0x2b5412[_0x1436('0xe')]));});});});};exports[_0x1436('0x32')]=function(_0xccc242){var _0x45e504=this;return new Promise(function(_0x3a2d79,_0x2c3871){return db[_0x1436('0x20')][_0x1436('0x21')](function(_0x56575b){return db['CmHopperFinal']['create'](_0xccc242[_0x1436('0x17')],{'raw':_0xccc242[_0x1436('0x5')]?_0xccc242['options'][_0x1436('0x11')]===undefined?!![]:![]:!![],'transaction':_0x56575b})[_0x1436('0x12')](function(){logger[_0x1436('0xb')](_0x1436('0x33'),JSON[_0x1436('0x13')](_0xccc242[_0x1436('0x5')][_0x1436('0x6')]),_0xccc242[_0x1436('0x5')][_0x1436('0x6')][_0x1436('0x31')]);return db[_0x1436('0x4')]['destroy']({'where':_0xccc242[_0x1436('0x5')]?_0xccc242[_0x1436('0x5')][_0x1436('0x6')]||null:null,'transaction':_0x56575b});});})[_0x1436('0x12')](function(_0x1b24c3){logger[_0x1436('0xb')](_0x1436('0x32'),_0xccc242);logger[_0x1436('0xc')]('MoveContactManagedDialer',_0xccc242,JSON[_0x1436('0x13')](_0x1b24c3));_0x3a2d79(_0x1b24c3);})[_0x1436('0x14')](function(_0x4f538c){logger[_0x1436('0xd')](_0x1436('0x32'),_0x4f538c['message'],_0xccc242);_0x2c3871(_0x45e504['error'](0x1f4,_0x4f538c[_0x1436('0xe')]));});});};exports[_0x1436('0x34')]=function(_0x37bd5f){var _0x5a9e9a=this;return new Promise(function(_0x39ecfc,_0x45e089){return db[_0x1436('0x4')][_0x1436('0x22')]({'raw':_0x37bd5f[_0x1436('0x5')]?_0x37bd5f[_0x1436('0x5')][_0x1436('0x11')]===undefined?!![]:![]:!![],'where':_0x37bd5f[_0x1436('0x5')]?_0x37bd5f[_0x1436('0x5')][_0x1436('0x6')]||null:null,'attributes':[[db[_0x1436('0x20')]['fn']('COUNT',db[_0x1436('0x20')]['fn']('IF',db[_0x1436('0x20')][_0x1436('0x35')](_0x1436('0x36')+util[_0x1436('0x37')]('\x22%s\x22',moment()[_0x1436('0x37')](_0x1436('0x38')))+_0x1436('0x39')))),'contactsRescheduled']]})[_0x1436('0x12')](function(_0x4e48e4){logger['info']('CountReScheduled',_0x37bd5f);logger[_0x1436('0xc')]('CountReScheduled',_0x37bd5f,JSON[_0x1436('0x13')](_0x4e48e4));_0x39ecfc(_0x4e48e4);})['catch'](function(_0x41b11c){logger[_0x1436('0xd')](_0x1436('0x34'),_0x41b11c[_0x1436('0xe')],_0x37bd5f);_0x45e089(_0x5a9e9a['error'](0x1f4,_0x41b11c[_0x1436('0xe')]));});});};exports[_0x1436('0x3a')]=function(_0x6db320){var _0x48ad3e=this;return new Promise(function(_0x5eae40,_0x33da95){return db[_0x1436('0x1e')]['describe']()[_0x1436('0x12')](function(){return db[_0x1436('0x20')][_0x1436('0x21')](function(_0x3f2c2e){return db[_0x1436('0x4')]['findAll']({'where':_0x6db320[_0x1436('0x5')]?_0x6db320[_0x1436('0x5')][_0x1436('0x6')]||null:null,'attributes':_0x6db320[_0x1436('0x5')]?_0x6db320[_0x1436('0x5')][_0x1436('0x7')]||null:null,'limit':0x1,'order':_0x6db320[_0x1436('0x5')]?_0x6db320[_0x1436('0x5')][_0x1436('0x23')]||null:null,'group':db[_0x1436('0x4')][_0x1436('0x2b')],'transaction':_0x3f2c2e,'lock':_0x3f2c2e[_0x1436('0x3b')][_0x1436('0x24')],'include':_0x6db320[_0x1436('0x5')]?_0x6db320['options'][_0x1436('0x8')]?_['map'](_0x6db320[_0x1436('0x5')]['include'],function(_0xd0b719){return{'model':db[_0xd0b719['model']],'as':_0xd0b719['as'],'attributes':_0xd0b719['attributes'],'include':_0xd0b719[_0x1436('0x8')]?_[_0x1436('0x9')](_0xd0b719['include'],function(_0x34820e){return{'model':db[_0x34820e['model']],'as':_0x34820e['as'],'attributes':_0x34820e[_0x1436('0x7')],'include':_0x34820e[_0x1436('0x8')]?_[_0x1436('0x9')](_0x34820e[_0x1436('0x8')],function(_0x510409){return{'model':db[_0x510409[_0x1436('0xa')]],'as':_0x510409['as'],'attributes':_0x510409['attributes']};}):[]};}):[]};}):[]:[]})[_0x1436('0x12')](function(_0x2bb201){var _0x59d14a=[];for(var _0x4aee1b=0x0;_0x4aee1b<_0x2bb201[_0x1436('0x3c')];_0x4aee1b+=0x1){_0x59d14a[_0x1436('0x2c')](_0x2bb201[_0x4aee1b][_0x1436('0x19')](_0x6db320[_0x1436('0x17')],{'transaction':_0x3f2c2e}));}return BPromise['all'](_0x59d14a);});})['then'](function(_0x2ad1b3){logger[_0x1436('0xb')](_0x1436('0x3a'),_0x6db320);logger[_0x1436('0xc')]('GetContactRecallMe',_0x6db320,JSON[_0x1436('0x13')](_0x2ad1b3));_0x5eae40(_0x2ad1b3);})[_0x1436('0x14')](function(_0x2c0106){logger[_0x1436('0xd')](_0x1436('0x3a'),_0x2c0106[_0x1436('0xe')],_0x6db320);_0x33da95(_0x48ad3e[_0x1436('0xd')](0x1f4,_0x2c0106[_0x1436('0xe')]));});});});};exports[_0x1436('0x3d')]=function(_0x5b9c34){var _0x2ad930=this;return new Promise(function(_0x326f1b,_0x3c2187){db['CmContact']['describe']()[_0x1436('0x12')](function(_0x11398f){return db[_0x1436('0x4')][_0x1436('0x22')]({'raw':_0x5b9c34[_0x1436('0x5')]?_0x5b9c34['options'][_0x1436('0x11')]===undefined?!![]:![]:!![],'where':_0x5b9c34['options']?_0x5b9c34[_0x1436('0x5')][_0x1436('0x6')]||null:null,'attributes':_0x5b9c34[_0x1436('0x5')]?_0x5b9c34[_0x1436('0x5')]['attributes']||null:null,'limit':_0x5b9c34[_0x1436('0x5')]?_0x5b9c34['options'][_0x1436('0x1a')]||null:null,'include':_0x5b9c34[_0x1436('0x5')]?_0x5b9c34[_0x1436('0x5')]['include']?_[_0x1436('0x9')](_0x5b9c34[_0x1436('0x5')]['include'],function(_0x2261bd){return{'model':db[_0x2261bd['model']],'as':_0x2261bd['as'],'attributes':_0x2261bd['as']===_0x1436('0x25')?_[_0x1436('0x26')](_0x11398f):_0x2261bd[_0x1436('0x7')],'include':_0x2261bd[_0x1436('0x8')]?_['map'](_0x2261bd[_0x1436('0x8')],function(_0x1235d5){return{'model':db[_0x1235d5['model']],'as':_0x1235d5['as'],'attributes':_0x1235d5['attributes'],'include':_0x1235d5[_0x1436('0x8')]?_[_0x1436('0x9')](_0x1235d5[_0x1436('0x8')],function(_0x1f6b3e){return{'model':db[_0x1f6b3e[_0x1436('0xa')]],'as':_0x1f6b3e['as'],'attributes':_0x1f6b3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x1436('0x12')](function(_0x4fb310){logger[_0x1436('0xb')](_0x1436('0x3'),_0x5b9c34);logger[_0x1436('0xc')](_0x1436('0x3'),_0x5b9c34,JSON[_0x1436('0x13')](_0x4fb310));_0x326f1b(_0x4fb310);})[_0x1436('0x14')](function(_0x3d0f95){logger[_0x1436('0xd')](_0x1436('0x3'),_0x3d0f95[_0x1436('0xe')],_0x5b9c34);_0x3c2187(_0x2ad930[_0x1436('0xd')](0x1f4,_0x3d0f95['message']));});});});};exports[_0x1436('0x3e')]=function(_0x1e6633){var _0x110fd6=this;return new Promise(function(_0x1b79f2,_0xef06b2){return db['CmContact'][_0x1436('0x3f')]({'raw':!![],'where':{'phone':_0x1e6633['options'][_0x1436('0x6')][_0x1436('0x40')]},'attributes':['id',_0x1436('0x41')],'order':[['id','DESC']]})[_0x1436('0x12')](function(_0x5cf964){logger['info'](_0x1436('0x42'),_0x1e6633);logger[_0x1436('0xc')]('getContactByPhone',_0x1e6633,JSON[_0x1436('0x13')](_0x5cf964));_0x1b79f2(_0x5cf964);})[_0x1436('0x14')](function(_0x5206c7){logger[_0x1436('0xd')]('getContactByPhone',_0x5206c7[_0x1436('0xe')],_0x1e6633);_0xef06b2(_0x110fd6[_0x1436('0xd')](0x1f4,_0x5206c7[_0x1436('0xe')]));});});};exports[_0x1436('0x43')]=function(_0x1e03c5){var _0x1d688c=this;return new Promise(function(_0x584169,_0x56bec4){return db[_0x1436('0x20')]['transaction'](function(_0x4a6ce4){var _0x171822=_0x1e03c5[_0x1436('0x5')]&&_0x1e03c5[_0x1436('0x5')][_0x1436('0x6')]?_0x1e03c5[_0x1436('0x5')][_0x1436('0x6')]:{};return db[_0x1436('0x4')]['update'](_0x1e03c5[_0x1436('0x17')],{'where':_0x171822,'transaction':_0x4a6ce4})[_0x1436('0x12')](function(_0xd74c6a){logger[_0x1436('0xb')]('ResetActiveCalls',_0x1e03c5);logger[_0x1436('0xc')](_0x1436('0x43'),_0x1e03c5,JSON['stringify'](_0xd74c6a));_0x584169(_0xd74c6a);})[_0x1436('0x14')](function(_0x15f5f4){logger[_0x1436('0xd')](_0x1436('0x43'),_0x15f5f4[_0x1436('0xe')],_0x1e03c5);_0x56bec4(_0x1d688c[_0x1436('0xd')](0x1f4,_0x15f5f4[_0x1436('0xe')]));});});});};exports[_0x1436('0x44')]=function(_0x1e5cd3){var _0xb94502=this;var _0x494241=_0x1e5cd3[_0x1436('0x17')]['where'][_0x1436('0x45')];var _0x43722d=_0x1e5cd3['body'][_0x1436('0x6')]['interval'];var _0x4a9147=_0x1e5cd3[_0x1436('0x17')][_0x1436('0x6')][_0x1436('0x46')];return new Promise(function(_0x2de013,_0x2802fb){return db[_0x1436('0x4')][_0x1436('0x22')]({'where':{'voiceQueueId':{'$in':_0x494241},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1436('0x20')]['literal'](_0x1436('0x47')+_0x43722d+'\x20MINUTE'),'$gt':db[_0x1436('0x20')][_0x1436('0x35')]('NOW()')}},'UserId':{'$in':_0x4a9147}},'include':[{'model':db[_0x1436('0x1e')],'as':'Contact'},{'model':db[_0x1436('0x27')],'as':_0x1436('0x28'),'attributes':['id',_0x1436('0x29'),_0x1436('0x2a')]},{'model':db[_0x1436('0x48')],'as':_0x1436('0x49')}]})[_0x1436('0x12')](function(_0x15730a){if(_0x15730a[_0x1436('0x3c')]>0x0){return db[_0x1436('0x20')][_0x1436('0x21')](function(_0x5bd53a){return db[_0x1436('0x4')][_0x1436('0x19')]({'recallmeNotifiedDate':db[_0x1436('0x20')][_0x1436('0x35')](_0x1436('0x4a'))},{'where':{'id':{'$in':_[_0x1436('0x9')](_0x15730a,'id')}},'transaction':_0x5bd53a})[_0x1436('0x12')](function(){_0x2de013(_0x15730a);})[_0x1436('0x14')](function(_0x2de649){logger[_0x1436('0xd')](_0x1436('0x44'),_0x2de649[_0x1436('0xe')],_0x1e5cd3);_0x2802fb(_0xb94502[_0x1436('0xd')](0x1f4,_0x2de649[_0x1436('0xe')]));});})[_0x1436('0x14')](function(_0x9a71ee){logger[_0x1436('0xd')](_0x1436('0x44'),_0x9a71ee[_0x1436('0xe')],_0x1e5cd3);_0x2802fb(_0xb94502[_0x1436('0xd')](0x1f4,_0x9a71ee['message']));});}else{_0x2de013(_0x15730a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 64b58f3..3e02b1b 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 _0x5c04=['isAuthenticated','index','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','getPreview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c04,0x145));var _0x45c0=function(_0xd354a6,_0x23fd06){_0xd354a6=_0xd354a6-0x0;var _0x3be746=_0x5c04[_0xd354a6];return _0x3be746;};'use strict';var express=require(_0x45c0('0x0'));var router=express[_0x45c0('0x1')]();var auth=require(_0x45c0('0x2'));var controller=require(_0x45c0('0x3'));router[_0x45c0('0x4')]('/',auth[_0x45c0('0x5')](),controller[_0x45c0('0x6')]);router[_0x45c0('0x4')]('/describe',auth[_0x45c0('0x5')](),controller['describe']);router[_0x45c0('0x4')](_0x45c0('0x7'),auth[_0x45c0('0x5')](),controller['getOpenContacts']);router['get'](_0x45c0('0x8'),auth['isAuthenticated'](),controller[_0x45c0('0x9')]);router[_0x45c0('0x4')](_0x45c0('0xa'),auth['isAuthenticated'](),controller[_0x45c0('0xb')]);router[_0x45c0('0x4')](_0x45c0('0xc'),auth[_0x45c0('0x5')](),controller[_0x45c0('0xd')]);router[_0x45c0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x45c0('0xe')]('/preview',auth[_0x45c0('0x5')](),controller[_0x45c0('0xf')]);router['post'](_0x45c0('0x10'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x45c0('0x11')](_0x45c0('0xa'),auth['isAuthenticated'](),controller[_0x45c0('0x12')]);router[_0x45c0('0x13')](_0x45c0('0xa'),auth[_0x45c0('0x5')](),controller[_0x45c0('0x14')]);module[_0x45c0('0x15')]=router; \ No newline at end of file +var _0x5eb8=['isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','getTimezone','put','update','destroy','exports','../../components/auth/service','./cmHopper.controller'];(function(_0x27597a,_0x177139){var _0x3b6097=function(_0x225bd8){while(--_0x225bd8){_0x27597a['push'](_0x27597a['shift']());}};_0x3b6097(++_0x177139);}(_0x5eb8,0xcd));var _0x85eb=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0x5eb8[_0x3311ae];return _0x107949;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x85eb('0x0'));var controller=require(_0x85eb('0x1'));router['get']('/',auth[_0x85eb('0x2')](),controller[_0x85eb('0x3')]);router[_0x85eb('0x4')](_0x85eb('0x5'),auth['isAuthenticated'](),controller[_0x85eb('0x6')]);router[_0x85eb('0x4')](_0x85eb('0x7'),auth['isAuthenticated'](),controller[_0x85eb('0x8')]);router[_0x85eb('0x4')](_0x85eb('0x9'),auth['isAuthenticated'](),controller[_0x85eb('0xa')]);router[_0x85eb('0x4')](_0x85eb('0xb'),auth['isAuthenticated'](),controller[_0x85eb('0xc')]);router[_0x85eb('0x4')](_0x85eb('0xd'),auth[_0x85eb('0x2')](),controller[_0x85eb('0xe')]);router[_0x85eb('0xf')]('/',auth[_0x85eb('0x2')](),controller[_0x85eb('0x10')]);router['post']('/preview',auth[_0x85eb('0x2')](),controller[_0x85eb('0x11')]);router[_0x85eb('0xf')]('/timezone',auth[_0x85eb('0x2')](),controller[_0x85eb('0x12')]);router[_0x85eb('0x13')]('/:id',auth[_0x85eb('0x2')](),controller[_0x85eb('0x14')]);router['delete'](_0x85eb('0xb'),auth[_0x85eb('0x2')](),controller[_0x85eb('0x15')]);module[_0x85eb('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 6b5402c..61254d5 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 _0x3b3e=['sequelize','exports','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x16af88,_0x1c6a15){var _0x376ddd=function(_0x13300f){while(--_0x13300f){_0x16af88['push'](_0x16af88['shift']());}};_0x376ddd(++_0x1c6a15);}(_0x3b3e,0x195));var _0xe3b3=function(_0x1117a4,_0x41cf10){_0x1117a4=_0x1117a4-0x0;var _0x469b8e=_0x3b3e[_0x1117a4];return _0x469b8e;};'use strict';var moment=require('moment');var Sequelize=require(_0xe3b3('0x0'));module[_0xe3b3('0x1')]={'CmHopperId':{'type':Sequelize[_0xe3b3('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe3b3('0x3')],'defaultValue':moment()['format'](_0xe3b3('0x4'))},'countbusyretry':{'type':Sequelize[_0xe3b3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe3b3('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe3b3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe3b3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe3b3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa8ac=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x73fc24,_0x5c9786){var _0x7e758b=function(_0x18a367){while(--_0x18a367){_0x73fc24['push'](_0x73fc24['shift']());}};_0x7e758b(++_0x5c9786);}(_0xa8ac,0xbf));var _0xca8a=function(_0x2f1dbf,_0xf653d7){_0x2f1dbf=_0x2f1dbf-0x0;var _0x51ad7a=_0xa8ac[_0x2f1dbf];return _0x51ad7a;};'use strict';var moment=require('moment');var Sequelize=require(_0xca8a('0x0'));module[_0xca8a('0x1')]={'CmHopperId':{'type':Sequelize[_0xca8a('0x2')]},'phone':{'type':Sequelize[_0xca8a('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xca8a('0x4')](_0xca8a('0x5'))},'countbusyretry':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca8a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca8a('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 21792ad..a160723 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 _0x133d=['VIRTUAL','options','rows','catch','show','params','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x133d,0x64));var _0xd133=function(_0x5ae93d,_0x48a929){_0x5ae93d=_0x5ae93d-0x0;var _0x3bc344=_0x133d[_0x5ae93d];return _0x3bc344;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd133('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd133('0x1'));var rp=require(_0xd133('0x2'));var moment=require('moment');var BPromise=require(_0xd133('0x3'));var Mustache=require(_0xd133('0x4'));var util=require(_0xd133('0x5'));var path=require(_0xd133('0x6'));var sox=require(_0xd133('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd133('0x8'));var _=require(_0xd133('0x9'));var squel=require(_0xd133('0xa'));var crypto=require(_0xd133('0xb'));var jsforce=require(_0xd133('0xc'));var deskjs=require(_0xd133('0xd'));var toCsv=require(_0xd133('0xe'));var querystring=require(_0xd133('0xf'));var Papa=require(_0xd133('0x10'));var Redis=require(_0xd133('0x11'));var authService=require(_0xd133('0x12'));var qs=require(_0xd133('0x13'));var as=require(_0xd133('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd133('0x15'));var utils=require('../../config/utils');var config=require(_0xd133('0x16'));var licenseUtil=require(_0xd133('0x17'));var db=require(_0xd133('0x18'))['db'];function respondWithStatusCode(_0x1d744a,_0x336597){_0x336597=_0x336597||0xcc;return function(_0x188ec5){if(_0x188ec5){return _0x1d744a[_0xd133('0x19')](_0x336597);}return _0x1d744a[_0xd133('0x1a')](_0x336597)[_0xd133('0x1b')]();};}function respondWithResult(_0x3298ae,_0xa3c514){_0xa3c514=_0xa3c514||0xc8;return function(_0xa6c542){if(_0xa6c542){return _0x3298ae['status'](_0xa3c514)['json'](_0xa6c542);}};}function respondWithFilteredResult(_0xa3b27b,_0x41ff70){return function(_0x12e19d){if(_0x12e19d){var _0x11a653=typeof _0x41ff70[_0xd133('0x1c')]===_0xd133('0x1d')&&typeof _0x41ff70[_0xd133('0x1e')]===_0xd133('0x1d');var _0x35de74=_0x12e19d[_0xd133('0x1f')];var _0x125614=_0x11a653?0x0:_0x41ff70['offset'];var _0x43bbde=_0x11a653?_0x12e19d[_0xd133('0x1f')]:_0x41ff70[_0xd133('0x1c')]+_0x41ff70[_0xd133('0x1e')];var _0x3e2f6f;if(_0x43bbde>=_0x35de74){_0x43bbde=_0x35de74;_0x3e2f6f=0xc8;}else{_0x3e2f6f=0xce;}_0xa3b27b[_0xd133('0x1a')](_0x3e2f6f);return _0xa3b27b[_0xd133('0x20')](_0xd133('0x21'),_0x125614+'-'+_0x43bbde+'/'+_0x35de74)[_0xd133('0x22')](_0x12e19d);}return null;};}function patchUpdates(_0x1f6044){return function(_0x1588fd){try{jsonpatch['apply'](_0x1588fd,_0x1f6044,!![]);}catch(_0x3312f3){return BPromise[_0xd133('0x23')](_0x3312f3);}return _0x1588fd['save']();};}function saveUpdates(_0x2c9222,_0x218012){return function(_0x34bec9){if(_0x34bec9){return _0x34bec9['update'](_0x2c9222)['then'](function(_0x320557){return _0x320557;});}return null;};}function removeEntity(_0x199914,_0x27aa6d){return function(_0x2ac8ad){if(_0x2ac8ad){return _0x2ac8ad[_0xd133('0x24')]()[_0xd133('0x25')](function(){var _0x20f5b7=_0x2ac8ad[_0xd133('0x26')]({'plain':!![]});var _0xf8d673=_0xd133('0x27');return db[_0xd133('0x28')][_0xd133('0x24')]({'where':{'type':_0xf8d673,'resourceId':_0x20f5b7['id']}})[_0xd133('0x25')](function(){return _0x2ac8ad;});})[_0xd133('0x25')](function(){_0x199914[_0xd133('0x1a')](0xcc)[_0xd133('0x1b')]();});}};}function handleEntityNotFound(_0x1d2e5f,_0x5c88b4){return function(_0x36afdd){if(!_0x36afdd){_0x1d2e5f[_0xd133('0x19')](0x194);}return _0x36afdd;};}function handleError(_0xe44b36,_0x5814fa){_0x5814fa=_0x5814fa||0x1f4;return function(_0x2aa224){logger['error'](_0x2aa224[_0xd133('0x29')]);if(_0x2aa224[_0xd133('0x2a')]){delete _0x2aa224[_0xd133('0x2a')];}_0xe44b36['status'](_0x5814fa)[_0xd133('0x2b')](_0x2aa224);};}exports[_0xd133('0x2c')]=function(_0x4a1e4e,_0x2a92){var _0x2d28dc={},_0x5ef666={},_0x2442f2={'count':0x0,'rows':[]};var _0x43f6e7=_['map'](db[_0xd133('0x2d')][_0xd133('0x2e')],function(_0x313b39){return{'name':_0x313b39[_0xd133('0x2f')],'type':_0x313b39[_0xd133('0x30')][_0xd133('0x31')]};});_0x5ef666[_0xd133('0x32')]=_[_0xd133('0x33')](_0x43f6e7,_0xd133('0x2a'));_0x5ef666[_0xd133('0x34')]=_[_0xd133('0x35')](_0x4a1e4e['query']);_0x5ef666['filters']=_[_0xd133('0x36')](_0x5ef666[_0xd133('0x32')],_0x5ef666[_0xd133('0x34')]);_0x2d28dc['attributes']=_[_0xd133('0x36')](_0x5ef666[_0xd133('0x32')],qs['fields'](_0x4a1e4e['query'][_0xd133('0x37')]));_0x2d28dc[_0xd133('0x38')]=_0x2d28dc[_0xd133('0x38')][_0xd133('0x39')]?_0x2d28dc['attributes']:_0x5ef666[_0xd133('0x32')];if(!_0x4a1e4e[_0xd133('0x34')]['hasOwnProperty'](_0xd133('0x3a'))){_0x2d28dc['limit']=qs[_0xd133('0x1e')](_0x4a1e4e['query'][_0xd133('0x1e')]);_0x2d28dc[_0xd133('0x1c')]=qs[_0xd133('0x1c')](_0x4a1e4e[_0xd133('0x34')][_0xd133('0x1c')]);}_0x2d28dc[_0xd133('0x3b')]=qs[_0xd133('0x3c')](_0x4a1e4e[_0xd133('0x34')]['sort']);_0x2d28dc[_0xd133('0x3d')]=qs[_0xd133('0x3e')](_[_0xd133('0x3f')](_0x4a1e4e[_0xd133('0x34')],_0x5ef666[_0xd133('0x3e')]),_0x43f6e7);if(_0x4a1e4e[_0xd133('0x34')][_0xd133('0x40')]){_0x2d28dc[_0xd133('0x3d')]=_[_0xd133('0x41')](_0x2d28dc[_0xd133('0x3d')],{'$or':_['map'](_0x43f6e7,function(_0x5ae4bd){if(_0x5ae4bd[_0xd133('0x30')]!==_0xd133('0x42')){var _0x3ec984={};_0x3ec984[_0x5ae4bd[_0xd133('0x2a')]]={'$like':'%'+_0x4a1e4e['query'][_0xd133('0x40')]+'%'};return _0x3ec984;}})});}_0x2d28dc=_[_0xd133('0x41')]({},_0x2d28dc,_0x4a1e4e[_0xd133('0x43')]);var _0x2fd8b7={'where':_0x2d28dc[_0xd133('0x3d')]};return db[_0xd133('0x2d')]['count'](_0x2fd8b7)[_0xd133('0x25')](function(_0x4cdd23){_0x2442f2[_0xd133('0x1f')]=_0x4cdd23;if(_0x4a1e4e[_0xd133('0x34')]['includeAll']){_0x2d28dc['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x2d28dc);})[_0xd133('0x25')](function(_0x30730d){_0x2442f2[_0xd133('0x44')]=_0x30730d;return _0x2442f2;})[_0xd133('0x25')](respondWithFilteredResult(_0x2a92,_0x2d28dc))[_0xd133('0x45')](handleError(_0x2a92,null));};exports[_0xd133('0x46')]=function(_0x3f0cbc,_0x4d6f4c){var _0x5a5eb6={'raw':!![],'where':{'id':_0x3f0cbc[_0xd133('0x47')]['id']}},_0x1d85d2={};_0x1d85d2[_0xd133('0x32')]=_[_0xd133('0x35')](db[_0xd133('0x2d')][_0xd133('0x2e')]);_0x1d85d2[_0xd133('0x34')]=_['keys'](_0x3f0cbc[_0xd133('0x34')]);_0x1d85d2[_0xd133('0x3e')]=_[_0xd133('0x36')](_0x1d85d2[_0xd133('0x32')],_0x1d85d2[_0xd133('0x34')]);_0x5a5eb6[_0xd133('0x38')]=_[_0xd133('0x36')](_0x1d85d2[_0xd133('0x32')],qs[_0xd133('0x37')](_0x3f0cbc[_0xd133('0x34')][_0xd133('0x37')]));_0x5a5eb6[_0xd133('0x38')]=_0x5a5eb6[_0xd133('0x38')]['length']?_0x5a5eb6[_0xd133('0x38')]:_0x1d85d2[_0xd133('0x32')];if(_0x3f0cbc[_0xd133('0x34')][_0xd133('0x48')]){_0x5a5eb6[_0xd133('0x49')]=[{'all':!![]}];}_0x5a5eb6=_[_0xd133('0x41')]({},_0x5a5eb6,_0x3f0cbc[_0xd133('0x43')]);return db[_0xd133('0x2d')][_0xd133('0x4a')](_0x5a5eb6)['then'](handleEntityNotFound(_0x4d6f4c,null))[_0xd133('0x25')](respondWithResult(_0x4d6f4c,null))['catch'](handleError(_0x4d6f4c,null));};exports[_0xd133('0x4b')]=function(_0x7c9dd4,_0x538d2b){return db[_0xd133('0x2d')]['create'](_0x7c9dd4[_0xd133('0x4c')],{})['then'](function(_0x514096){var _0x451baf=_0x7c9dd4[_0xd133('0x4d')][_0xd133('0x26')]({'plain':!![]});if(!_0x451baf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x451baf[_0xd133('0x4e')]===_0xd133('0x4d')){var _0x5b775e=_0x514096['get']({'plain':!![]});var _0x635edd=_0xd133('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x635edd,'userProfileId':_0x451baf[_0xd133('0x4f')]},'raw':!![]})[_0xd133('0x25')](function(_0x53b516){if(_0x53b516&&_0x53b516[_0xd133('0x50')]===0x0){return db[_0xd133('0x28')][_0xd133('0x4b')]({'name':_0x5b775e['name'],'resourceId':_0x5b775e['id'],'type':_0x53b516[_0xd133('0x2a')],'sectionId':_0x53b516['id']},{})[_0xd133('0x25')](function(){return _0x514096;});}else{return _0x514096;}})['catch'](function(_0x111f39){logger[_0xd133('0x51')](_0xd133('0x52'),_0x111f39);throw _0x111f39;});}return _0x514096;})[_0xd133('0x25')](respondWithResult(_0x538d2b,0xc9))[_0xd133('0x45')](handleError(_0x538d2b,null));};exports['update']=function(_0x12e58d,_0x8e3200){if(_0x12e58d[_0xd133('0x4c')]['id']){delete _0x12e58d[_0xd133('0x4c')]['id'];}return db[_0xd133('0x2d')][_0xd133('0x4a')]({'where':{'id':_0x12e58d['params']['id']}})[_0xd133('0x25')](handleEntityNotFound(_0x8e3200,null))[_0xd133('0x25')](saveUpdates(_0x12e58d[_0xd133('0x4c')],null))[_0xd133('0x25')](respondWithResult(_0x8e3200,null))[_0xd133('0x45')](handleError(_0x8e3200,null));};exports[_0xd133('0x24')]=function(_0x2587a3,_0x199e9f){return db[_0xd133('0x2d')][_0xd133('0x4a')]({'where':{'id':_0x2587a3['params']['id']}})[_0xd133('0x25')](handleEntityNotFound(_0x199e9f,null))[_0xd133('0x25')](removeEntity(_0x199e9f,null))[_0xd133('0x45')](handleError(_0x199e9f,null));}; \ No newline at end of file +var _0xa791=['sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','get','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x10b434,_0x521745){var _0x31050b=function(_0x5c72e7){while(--_0x5c72e7){_0x10b434['push'](_0x10b434['shift']());}};_0x31050b(++_0x521745);}(_0xa791,0x1e3));var _0x1a79=function(_0x1e530e,_0x25278b){_0x1e530e=_0x1e530e-0x0;var _0x3922bb=_0xa791[_0x1e530e];return _0x3922bb;};'use strict';var emlformat=require(_0x1a79('0x0'));var rimraf=require(_0x1a79('0x1'));var zipdir=require(_0x1a79('0x2'));var jsonpatch=require(_0x1a79('0x3'));var rp=require('request-promise');var moment=require(_0x1a79('0x4'));var BPromise=require(_0x1a79('0x5'));var Mustache=require(_0x1a79('0x6'));var util=require(_0x1a79('0x7'));var path=require(_0x1a79('0x8'));var sox=require(_0x1a79('0x9'));var csv=require(_0x1a79('0xa'));var ejs=require(_0x1a79('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1a79('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a79('0xd'));var deskjs=require(_0x1a79('0xe'));var toCsv=require(_0x1a79('0xa'));var querystring=require(_0x1a79('0xf'));var Papa=require(_0x1a79('0x10'));var Redis=require('ioredis');var authService=require(_0x1a79('0x11'));var qs=require(_0x1a79('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a79('0x13'));var logger=require(_0x1a79('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1a79('0x15'));var licenseUtil=require(_0x1a79('0x16'));var db=require(_0x1a79('0x17'))['db'];function respondWithStatusCode(_0x2f65b4,_0x9ab003){_0x9ab003=_0x9ab003||0xcc;return function(_0x2c6a66){if(_0x2c6a66){return _0x2f65b4['sendStatus'](_0x9ab003);}return _0x2f65b4[_0x1a79('0x18')](_0x9ab003)[_0x1a79('0x19')]();};}function respondWithResult(_0x23435b,_0x42412a){_0x42412a=_0x42412a||0xc8;return function(_0x4e7e8d){if(_0x4e7e8d){return _0x23435b[_0x1a79('0x18')](_0x42412a)[_0x1a79('0x1a')](_0x4e7e8d);}};}function respondWithFilteredResult(_0x215f57,_0x3c4e6c){return function(_0x581468){if(_0x581468){var _0x5a2bd6=typeof _0x3c4e6c[_0x1a79('0x1b')]==='undefined'&&typeof _0x3c4e6c[_0x1a79('0x1c')]===_0x1a79('0x1d');var _0x226fc1=_0x581468[_0x1a79('0x1e')];var _0x206332=_0x5a2bd6?0x0:_0x3c4e6c[_0x1a79('0x1b')];var _0x4f187b=_0x5a2bd6?_0x581468['count']:_0x3c4e6c[_0x1a79('0x1b')]+_0x3c4e6c['limit'];var _0x5ce22f;if(_0x4f187b>=_0x226fc1){_0x4f187b=_0x226fc1;_0x5ce22f=0xc8;}else{_0x5ce22f=0xce;}_0x215f57[_0x1a79('0x18')](_0x5ce22f);return _0x215f57[_0x1a79('0x1f')]('Content-Range',_0x206332+'-'+_0x4f187b+'/'+_0x226fc1)['json'](_0x581468);}return null;};}function patchUpdates(_0x13a7c8){return function(_0x5219a8){try{jsonpatch[_0x1a79('0x20')](_0x5219a8,_0x13a7c8,!![]);}catch(_0x1c4d67){return BPromise[_0x1a79('0x21')](_0x1c4d67);}return _0x5219a8['save']();};}function saveUpdates(_0x536b54,_0x1c571e){return function(_0x1efcdd){if(_0x1efcdd){return _0x1efcdd[_0x1a79('0x22')](_0x536b54)[_0x1a79('0x23')](function(_0x9e1917){return _0x9e1917;});}return null;};}function removeEntity(_0x459a50,_0x1bc916){return function(_0x462914){if(_0x462914){return _0x462914[_0x1a79('0x24')]()[_0x1a79('0x23')](function(){var _0x5d6bc7=_0x462914['get']({'plain':!![]});var _0x1ce51b='CmHopperAdditionalPhones';return db[_0x1a79('0x25')][_0x1a79('0x24')]({'where':{'type':_0x1ce51b,'resourceId':_0x5d6bc7['id']}})['then'](function(){return _0x462914;});})[_0x1a79('0x23')](function(){_0x459a50['status'](0xcc)[_0x1a79('0x19')]();});}};}function handleEntityNotFound(_0x4ef401,_0x380aab){return function(_0x5863f5){if(!_0x5863f5){_0x4ef401[_0x1a79('0x26')](0x194);}return _0x5863f5;};}function handleError(_0x598dc4,_0x3304d1){_0x3304d1=_0x3304d1||0x1f4;return function(_0x86c447){logger[_0x1a79('0x27')](_0x86c447[_0x1a79('0x28')]);if(_0x86c447[_0x1a79('0x29')]){delete _0x86c447['name'];}_0x598dc4[_0x1a79('0x18')](_0x3304d1)[_0x1a79('0x2a')](_0x86c447);};}exports[_0x1a79('0x2b')]=function(_0x15a2b2,_0x3df5cb){var _0x39b1c5={},_0x1c1a5c={},_0x288213={'count':0x0,'rows':[]};var _0x1ad2b0=_[_0x1a79('0x2c')](db['CmHopperAdditionalPhone'][_0x1a79('0x2d')],function(_0x4dc956){return{'name':_0x4dc956[_0x1a79('0x2e')],'type':_0x4dc956[_0x1a79('0x2f')][_0x1a79('0x30')]};});_0x1c1a5c['model']=_[_0x1a79('0x2c')](_0x1ad2b0,_0x1a79('0x29'));_0x1c1a5c[_0x1a79('0x31')]=_['keys'](_0x15a2b2[_0x1a79('0x31')]);_0x1c1a5c['filters']=_['intersection'](_0x1c1a5c[_0x1a79('0x32')],_0x1c1a5c[_0x1a79('0x31')]);_0x39b1c5[_0x1a79('0x33')]=_[_0x1a79('0x34')](_0x1c1a5c[_0x1a79('0x32')],qs[_0x1a79('0x35')](_0x15a2b2[_0x1a79('0x31')][_0x1a79('0x35')]));_0x39b1c5[_0x1a79('0x33')]=_0x39b1c5[_0x1a79('0x33')][_0x1a79('0x36')]?_0x39b1c5[_0x1a79('0x33')]:_0x1c1a5c[_0x1a79('0x32')];if(!_0x15a2b2['query'][_0x1a79('0x37')](_0x1a79('0x38'))){_0x39b1c5[_0x1a79('0x1c')]=qs[_0x1a79('0x1c')](_0x15a2b2[_0x1a79('0x31')][_0x1a79('0x1c')]);_0x39b1c5['offset']=qs[_0x1a79('0x1b')](_0x15a2b2[_0x1a79('0x31')][_0x1a79('0x1b')]);}_0x39b1c5['order']=qs['sort'](_0x15a2b2[_0x1a79('0x31')][_0x1a79('0x39')]);_0x39b1c5[_0x1a79('0x3a')]=qs['filters'](_['pick'](_0x15a2b2[_0x1a79('0x31')],_0x1c1a5c[_0x1a79('0x3b')]),_0x1ad2b0);if(_0x15a2b2[_0x1a79('0x31')][_0x1a79('0x3c')]){_0x39b1c5[_0x1a79('0x3a')]=_[_0x1a79('0x3d')](_0x39b1c5['where'],{'$or':_[_0x1a79('0x2c')](_0x1ad2b0,function(_0x340d64){if(_0x340d64[_0x1a79('0x2f')]!==_0x1a79('0x3e')){var _0xc6c107={};_0xc6c107[_0x340d64[_0x1a79('0x29')]]={'$like':'%'+_0x15a2b2['query'][_0x1a79('0x3c')]+'%'};return _0xc6c107;}})});}_0x39b1c5=_[_0x1a79('0x3d')]({},_0x39b1c5,_0x15a2b2[_0x1a79('0x3f')]);var _0x5d42ce={'where':_0x39b1c5[_0x1a79('0x3a')]};return db[_0x1a79('0x40')][_0x1a79('0x1e')](_0x5d42ce)['then'](function(_0x312dc8){_0x288213[_0x1a79('0x1e')]=_0x312dc8;if(_0x15a2b2[_0x1a79('0x31')][_0x1a79('0x41')]){_0x39b1c5[_0x1a79('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x1a79('0x43')](_0x39b1c5);})[_0x1a79('0x23')](function(_0x4cc802){_0x288213[_0x1a79('0x44')]=_0x4cc802;return _0x288213;})[_0x1a79('0x23')](respondWithFilteredResult(_0x3df5cb,_0x39b1c5))[_0x1a79('0x45')](handleError(_0x3df5cb,null));};exports['show']=function(_0x241785,_0x51aac5){var _0x545b6f={'raw':!![],'where':{'id':_0x241785[_0x1a79('0x46')]['id']}},_0x52d7ce={};_0x52d7ce[_0x1a79('0x32')]=_[_0x1a79('0x47')](db[_0x1a79('0x40')][_0x1a79('0x2d')]);_0x52d7ce[_0x1a79('0x31')]=_[_0x1a79('0x47')](_0x241785[_0x1a79('0x31')]);_0x52d7ce['filters']=_[_0x1a79('0x34')](_0x52d7ce[_0x1a79('0x32')],_0x52d7ce[_0x1a79('0x31')]);_0x545b6f[_0x1a79('0x33')]=_[_0x1a79('0x34')](_0x52d7ce[_0x1a79('0x32')],qs['fields'](_0x241785[_0x1a79('0x31')][_0x1a79('0x35')]));_0x545b6f[_0x1a79('0x33')]=_0x545b6f[_0x1a79('0x33')]['length']?_0x545b6f[_0x1a79('0x33')]:_0x52d7ce[_0x1a79('0x32')];if(_0x241785[_0x1a79('0x31')][_0x1a79('0x41')]){_0x545b6f[_0x1a79('0x42')]=[{'all':!![]}];}_0x545b6f=_[_0x1a79('0x3d')]({},_0x545b6f,_0x241785[_0x1a79('0x3f')]);return db[_0x1a79('0x40')][_0x1a79('0x48')](_0x545b6f)['then'](handleEntityNotFound(_0x51aac5,null))[_0x1a79('0x23')](respondWithResult(_0x51aac5,null))['catch'](handleError(_0x51aac5,null));};exports[_0x1a79('0x49')]=function(_0x31cf6c,_0xc88068){return db[_0x1a79('0x40')][_0x1a79('0x49')](_0x31cf6c[_0x1a79('0x4a')],{})['then'](function(_0x3ba5bb){var _0x59fe95=_0x31cf6c[_0x1a79('0x4b')][_0x1a79('0x4c')]({'plain':!![]});if(!_0x59fe95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59fe95['role']===_0x1a79('0x4b')){var _0x2c4598=_0x3ba5bb[_0x1a79('0x4c')]({'plain':!![]});var _0x3b9d61=_0x1a79('0x4d');return db[_0x1a79('0x4e')][_0x1a79('0x48')]({'where':{'name':_0x3b9d61,'userProfileId':_0x59fe95[_0x1a79('0x4f')]},'raw':!![]})['then'](function(_0x243637){if(_0x243637&&_0x243637[_0x1a79('0x50')]===0x0){return db[_0x1a79('0x25')][_0x1a79('0x49')]({'name':_0x2c4598[_0x1a79('0x29')],'resourceId':_0x2c4598['id'],'type':_0x243637[_0x1a79('0x29')],'sectionId':_0x243637['id']},{})[_0x1a79('0x23')](function(){return _0x3ba5bb;});}else{return _0x3ba5bb;}})[_0x1a79('0x45')](function(_0x2d6b08){logger[_0x1a79('0x27')](_0x1a79('0x51'),_0x2d6b08);throw _0x2d6b08;});}return _0x3ba5bb;})['then'](respondWithResult(_0xc88068,0xc9))[_0x1a79('0x45')](handleError(_0xc88068,null));};exports['update']=function(_0x1f9767,_0x29f5a2){if(_0x1f9767[_0x1a79('0x4a')]['id']){delete _0x1f9767[_0x1a79('0x4a')]['id'];}return db[_0x1a79('0x40')][_0x1a79('0x48')]({'where':{'id':_0x1f9767[_0x1a79('0x46')]['id']}})['then'](handleEntityNotFound(_0x29f5a2,null))['then'](saveUpdates(_0x1f9767[_0x1a79('0x4a')],null))['then'](respondWithResult(_0x29f5a2,null))[_0x1a79('0x45')](handleError(_0x29f5a2,null));};exports['destroy']=function(_0xa1161d,_0x13401b){return db[_0x1a79('0x40')][_0x1a79('0x48')]({'where':{'id':_0xa1161d[_0x1a79('0x46')]['id']}})[_0x1a79('0x23')](handleEntityNotFound(_0x13401b,null))[_0x1a79('0x23')](removeEntity(_0x13401b,null))[_0x1a79('0x45')](handleError(_0x13401b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index eebcd76..272e44c 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 _0xff0a=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x2081b6,_0x184f20){var _0x44482e=function(_0x362bc5){while(--_0x362bc5){_0x2081b6['push'](_0x2081b6['shift']());}};_0x44482e(++_0x184f20);}(_0xff0a,0x186));var _0xaff0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xff0a[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xaff0('0x0'));var util=require(_0xaff0('0x1'));var logger=require(_0xaff0('0x2'))(_0xaff0('0x3'));var moment=require(_0xaff0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaff0('0x5'));var config=require(_0xaff0('0x6'));var attributes=require(_0xaff0('0x7'));module[_0xaff0('0x8')]=function(_0x50eda9,_0x3d64ec){return _0x50eda9[_0xaff0('0x9')](_0xaff0('0xa'),attributes,{'tableName':_0xaff0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6af2=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','cm_hopper_additional_phones','lodash','api','moment','request-promise','path'];(function(_0x59117e,_0x444da3){var _0x59cf49=function(_0x53f9ba){while(--_0x53f9ba){_0x59117e['push'](_0x59117e['shift']());}};_0x59cf49(++_0x444da3);}(_0x6af2,0x1e1));var _0x26af=function(_0x46af28,_0x5ead17){_0x46af28=_0x46af28-0x0;var _0x3334b3=_0x6af2[_0x46af28];return _0x3334b3;};'use strict';var _=require(_0x26af('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26af('0x1'));var moment=require(_0x26af('0x2'));var BPromise=require('bluebird');var rp=require(_0x26af('0x3'));var fs=require('fs');var path=require(_0x26af('0x4'));var rimraf=require('rimraf');var config=require(_0x26af('0x5'));var attributes=require(_0x26af('0x6'));module[_0x26af('0x7')]=function(_0x1bbb31,_0x4fbefe){return _0x1bbb31['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x26af('0x8'),'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 1bee443..5c475ca 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 _0xf405=['entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','ASC','duration','waitTime','isNil','scheduledat','minutes','add','createdAt','updatedAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x14dc65,_0x493fff){var _0x398b0f=function(_0x3a6261){while(--_0x3a6261){_0x14dc65['push'](_0x14dc65['shift']());}};_0x398b0f(++_0x493fff);}(_0xf405,0x12c));var _0x5f40=function(_0x1d0c09,_0x49cdf4){_0x1d0c09=_0x1d0c09-0x0;var _0x8146bc=_0xf405[_0x1d0c09];return _0x8146bc;};'use strict';var _=require(_0x5f40('0x0'));var util=require(_0x5f40('0x1'));var moment=require(_0x5f40('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f40('0x3'));var fs=require('fs');var Redis=require(_0x5f40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f40('0x5'));var logger=require(_0x5f40('0x6'))(_0x5f40('0x7'));var config=require(_0x5f40('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20d02a,_0x116bce,_0x1aeefa){return new BPromise(function(_0x58d68d,_0x547140){return client['request'](_0x20d02a,_0x1aeefa)[_0x5f40('0x9')](function(_0x4e3066){logger[_0x5f40('0xa')](_0x5f40('0xb'),_0x116bce,_0x5f40('0xc'));logger['debug'](_0x5f40('0xd'),_0x116bce,'request\x20sent',JSON[_0x5f40('0xe')](_0x4e3066));if(_0x4e3066[_0x5f40('0xf')]){if(_0x4e3066[_0x5f40('0xf')]['code']===0x1f4){logger[_0x5f40('0xf')](_0x5f40('0xb'),_0x116bce,_0x4e3066['error']['message']);return _0x547140(_0x4e3066[_0x5f40('0xf')][_0x5f40('0x10')]);}logger[_0x5f40('0xf')](_0x5f40('0xb'),_0x116bce,_0x4e3066['error'][_0x5f40('0x10')]);return _0x58d68d(_0x4e3066[_0x5f40('0xf')]['message']);}else{logger[_0x5f40('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x116bce,_0x5f40('0xc'));_0x58d68d(_0x4e3066[_0x5f40('0x11')]['message']);}})[_0x5f40('0x12')](function(_0x52c6d3){logger[_0x5f40('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x116bce,_0x52c6d3);_0x547140(_0x52c6d3);});});}exports['VerifyAdditionalPhones']=function(_0x2e3557){var _0x509147=this;return new Promise(function(_0x532490,_0x1428d7){return db[_0x5f40('0x13')][_0x5f40('0x14')]({'raw':!![],'where':{'ContactId':_0x2e3557['body'][_0x5f40('0x15')],'ListId':_0x2e3557[_0x5f40('0x16')][_0x5f40('0x17')],'VoiceQueueId':_0x2e3557[_0x5f40('0x16')][_0x5f40('0x18')]===undefined?null:_0x2e3557[_0x5f40('0x16')][_0x5f40('0x18')],'CampaignId':_0x2e3557[_0x5f40('0x16')][_0x5f40('0x19')]===undefined?null:_0x2e3557[_0x5f40('0x16')][_0x5f40('0x19')]}})[_0x5f40('0x9')](function(_0x60cc18){if(_0x60cc18!=null){return db[_0x5f40('0x1a')][_0x5f40('0x14')]({'raw':!![],'where':{'CmHopperId':_0x60cc18['id'],'OrderBy':{'$gt':_0x60cc18[_0x5f40('0x1b')]}},'order':[['OrderBy','ASC']]})[_0x5f40('0x9')](function(_0x4a284a){var _0x35d252=0x0;if(_0x4a284a){if(_0x4a284a[_0x5f40('0x1c')]+_0x4a284a[_0x5f40('0x1d')]+_0x4a284a[_0x5f40('0x1e')]+_0x4a284a[_0x5f40('0x1f')]+_0x4a284a[_0x5f40('0x20')]+_0x4a284a[_0x5f40('0x21')]+_0x4a284a[_0x5f40('0x22')]+_0x4a284a[_0x5f40('0x23')]<_0x2e3557[_0x5f40('0x24')]['dialGlobalMaxRetry'])_0x35d252=0x1;_0x532490({'additional':_0x35d252});}else{return db['CmHopperAdditionalPhone'][_0x5f40('0x14')]({'raw':!![],'where':{'CmHopperId':_0x60cc18['id']},'order':[[_0x5f40('0x1b'),'ASC']]})[_0x5f40('0x9')](function(_0x570934){var _0x14be94=0x0;if(_0x570934){if(_0x570934[_0x5f40('0x1c')]+_0x570934[_0x5f40('0x1d')]+_0x570934['countnoanswerretry']+_0x570934[_0x5f40('0x1f')]+_0x570934[_0x5f40('0x20')]+_0x570934[_0x5f40('0x21')]+_0x570934[_0x5f40('0x22')]+_0x570934[_0x5f40('0x23')]<_0x2e3557[_0x5f40('0x24')][_0x5f40('0x25')])_0x14be94=0x1;_0x532490({'additional':_0x14be94});}else{_0x532490({'additional':0x0});}})[_0x5f40('0x12')](function(_0x291db2){logger[_0x5f40('0xf')](_0x5f40('0x26'),_0x291db2[_0x5f40('0x10')]);_0x1428d7(_0x509147[_0x5f40('0xf')](0x1f4,_0x291db2[_0x5f40('0x10')]));});}})[_0x5f40('0x12')](function(_0x279d2b){logger[_0x5f40('0xf')](_0x5f40('0x26'),_0x279d2b[_0x5f40('0x10')]);_0x1428d7(_0x509147[_0x5f40('0xf')](0x1f4,_0x279d2b[_0x5f40('0x10')]));});}else _0x532490({'additional':0x0});});});};exports[_0x5f40('0x27')]=function(_0x5735b4){var _0x25a4f1=this;return new Promise(function(_0x5819e7,_0x2d6c89){return db[_0x5f40('0x13')][_0x5f40('0x14')]({'raw':!![],'where':{'ContactId':_0x5735b4['body'][_0x5f40('0x15')],'ListId':_0x5735b4[_0x5f40('0x16')][_0x5f40('0x17')],'VoiceQueueId':_0x5735b4[_0x5f40('0x16')][_0x5f40('0x18')]===undefined?null:_0x5735b4[_0x5f40('0x16')][_0x5f40('0x18')],'CampaignId':_0x5735b4['body'][_0x5f40('0x19')]===undefined?null:_0x5735b4[_0x5f40('0x16')][_0x5f40('0x19')]}})[_0x5f40('0x9')](function(_0x3fb23e){if(_0x3fb23e!=null){return db[_0x5f40('0x1a')][_0x5f40('0x14')]({'raw':!![],'where':{'CmHopperId':_0x3fb23e['id'],'OrderBy':{'$gte':_0x3fb23e[_0x5f40('0x1b')]}},'order':[[_0x5f40('0x1b'),_0x5f40('0x28')]]})[_0x5f40('0x9')](function(_0x521b82){if(_0x521b82)return activateAdditionalPhone(_0x3fb23e,_0x5735b4[_0x5f40('0x16')],_0x521b82,_0x5735b4[_0x5f40('0x29')],_0x5735b4[_0x5f40('0x2a')])[_0x5f40('0x9')](function(_0x5ec860){_0x5819e7(_0x5ec860);});else{return db['CmHopperAdditionalPhone'][_0x5f40('0x14')]({'raw':!![],'where':{'CmHopperId':_0x3fb23e['id']},'order':[[_0x5f40('0x1b'),'ASC']]})['then'](function(_0x28b114){if(_0x28b114)return activateAdditionalPhone(_0x3fb23e,_0x5735b4[_0x5f40('0x16')],_0x28b114,_0x5735b4[_0x5f40('0x29')],_0x5735b4['waitTime'])[_0x5f40('0x9')](function(_0x354d8e){_0x5819e7(_0x354d8e);});else{_0x5819e7({'id':_0x3fb23e['id'],'phone':''});}})[_0x5f40('0x12')](function(_0x1b0b76){logger[_0x5f40('0xf')](_0x5f40('0x26'),_0x1b0b76[_0x5f40('0x10')]);_0x2d6c89(_0x25a4f1[_0x5f40('0xf')](0x1f4,_0x1b0b76[_0x5f40('0x10')]));});}})[_0x5f40('0x12')](function(_0x254d5d){logger[_0x5f40('0xf')]('VerifyAdditionalPhones',_0x254d5d[_0x5f40('0x10')]);_0x2d6c89(_0x25a4f1[_0x5f40('0xf')](0x1f4,_0x254d5d['message']));});}else _0x5819e7(0x1);});});};function activateAdditionalPhone(_0x123225,_0x247db6,_0x17aadb,_0x52e00d,_0x5a329b){return new Promise(function(_0x5ec8dc,_0x163ce0){var _0x7a6d01;if(_[_0x5f40('0x2b')](_0x17aadb[_0x5f40('0x2c')])){_0x17aadb[_0x5f40('0x2c')]=moment();}if(moment()>moment(_0x17aadb['scheduledat'])){_0x7a6d01=moment()['add'](_0x5a329b||0x3,_0x5f40('0x2d'));}else{if(_0x17aadb[_0x5f40('0x1b')]==0x0){_0x7a6d01=moment(_0x17aadb[_0x5f40('0x2c')]);}else{_0x7a6d01=moment()[_0x5f40('0x2e')](_0x5a329b||0x3,_0x5f40('0x2d'));}}if(_['isNil'](_0x7a6d01)){_0x7a6d01=moment()[_0x5f40('0x2e')](_0x5a329b||0x3,_0x5f40('0x2d'));}var _0x664204={'phone':_0x123225['phone'],'active':0x0,'OrderBy':_[_0x5f40('0x2b')](_0x123225[_0x5f40('0x1b')])?0x0:_0x123225[_0x5f40('0x1b')],'scheduledat':moment()['add'](_0x52e00d||0x1,'minutes'),'countbusyretry':_0x247db6[_0x5f40('0x1c')],'countcongestionretry':_0x247db6[_0x5f40('0x1d')],'countnoanswerretry':_0x247db6['countnoanswerretry'],'countnosuchnumberretry':_0x247db6[_0x5f40('0x1f')],'countdropretry':_0x247db6[_0x5f40('0x20')],'countabandonedretry':_0x247db6[_0x5f40('0x21')],'countmachineretry':_0x247db6[_0x5f40('0x22')],'countagentrejectretry':_0x247db6[_0x5f40('0x23')],'createdAt':_0x247db6[_0x5f40('0x2f')],'updatedAt':_0x247db6[_0x5f40('0x30')]};var _0x84d511={'CmHopperId':_0x123225['id'],'phone':_0x17aadb[_0x5f40('0x31')],'active':0x0,'OrderBy':_[_0x5f40('0x2b')](_0x17aadb[_0x5f40('0x1b')])?0x0:_0x17aadb['OrderBy'],'scheduledat':_0x7a6d01,'countbusyretry':_0x17aadb[_0x5f40('0x1c')],'countcongestionretry':_0x17aadb['countcongestionretry'],'countnoanswerretry':_0x17aadb['countnoanswerretry'],'countnosuchnumberretry':_0x17aadb[_0x5f40('0x1f')],'countdropretry':_0x17aadb[_0x5f40('0x20')],'countabandonedretry':_0x17aadb[_0x5f40('0x21')],'countmachineretry':_0x17aadb[_0x5f40('0x22')],'countagentrejectretry':_0x17aadb[_0x5f40('0x23')],'createdAt':_0x17aadb[_0x5f40('0x2f')],'updatedAt':_0x17aadb['updatedAt']};return db[_0x5f40('0x32')][_0x5f40('0x33')](function(_0x53ef41){return db[_0x5f40('0x1a')][_0x5f40('0x34')](_0x664204,{'where':{'id':_0x17aadb['id']}},{'transaction':_0x53ef41})['then'](function(){return db['CmHopper']['update'](_0x84d511,{'where':{'id':_0x123225['id']}},{'transaction':_0x53ef41});});})['then'](function(_0xe1ffb4){_0x5ec8dc({'id':_0x123225['id'],'phone':_0x17aadb['phone']});})[_0x5f40('0x12')](function(_0x1da4b5){logger[_0x5f40('0xf')](_0x5f40('0x35'),_0x1da4b5[_0x5f40('0x10')]);_0x163ce0({'error':_0x1da4b5[_0x5f40('0x10')]});});});}exports[_0x5f40('0x36')]=function(_0x203588){var _0x3ca500=this;return new Promise(function(_0x5e1955,_0xdd9068){return db['CmHopper'][_0x5f40('0x34')](_0x203588['body'][_0x5f40('0x37')],{'where':{'id':_0x203588['body']['id']}})[_0x5f40('0x9')](function(_0x309db6){_0x5e1955(_0x309db6);})['catch'](function(_0x2458ae){logger['error'](_0x5f40('0x36'),_0x2458ae[_0x5f40('0x10')]);_0xdd9068(_0x3ca500[_0x5f40('0xf')](0x1f4,_0x2458ae['message']));});});}; \ No newline at end of file +var _0xfbaf=['ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countnoanswerretry','countabandonedretry','countmachineretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','activateAdditionalPhone','update','IncrementPreviewCounters','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body'];(function(_0x497ef1,_0x2e1dc3){var _0x20feae=function(_0x9fca32){while(--_0x9fca32){_0x497ef1['push'](_0x497ef1['shift']());}};_0x20feae(++_0x2e1dc3);}(_0xfbaf,0x17c));var _0xffba=function(_0x59865a,_0x28fecb){_0x59865a=_0x59865a-0x0;var _0x19f209=_0xfbaf[_0x59865a];return _0x19f209;};'use strict';var _=require('lodash');var util=require(_0xffba('0x0'));var moment=require(_0xffba('0x1'));var BPromise=require('bluebird');var rs=require(_0xffba('0x2'));var fs=require('fs');var Redis=require(_0xffba('0x3'));var db=require(_0xffba('0x4'))['db'];var utils=require(_0xffba('0x5'));var logger=require('../../config/logger')(_0xffba('0x6'));var config=require(_0xffba('0x7'));var jayson=require(_0xffba('0x8'));var client=jayson[_0xffba('0x9')][_0xffba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b9f6c,_0x124d5b,_0x1af407){return new BPromise(function(_0x462106,_0x30fca2){return client[_0xffba('0xb')](_0x6b9f6c,_0x1af407)[_0xffba('0xc')](function(_0x1e03de){logger[_0xffba('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x124d5b,'request\x20sent');logger[_0xffba('0xe')](_0xffba('0xf'),_0x124d5b,_0xffba('0x10'),JSON['stringify'](_0x1e03de));if(_0x1e03de['error']){if(_0x1e03de[_0xffba('0x11')]['code']===0x1f4){logger[_0xffba('0x11')](_0xffba('0x12'),_0x124d5b,_0x1e03de[_0xffba('0x11')][_0xffba('0x13')]);return _0x30fca2(_0x1e03de[_0xffba('0x11')][_0xffba('0x13')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x124d5b,_0x1e03de[_0xffba('0x11')][_0xffba('0x13')]);return _0x462106(_0x1e03de[_0xffba('0x11')][_0xffba('0x13')]);}else{logger[_0xffba('0xd')](_0xffba('0x12'),_0x124d5b,'request\x20sent');_0x462106(_0x1e03de[_0xffba('0x14')]['message']);}})[_0xffba('0x15')](function(_0x3b06b2){logger[_0xffba('0x11')](_0xffba('0x12'),_0x124d5b,_0x3b06b2);_0x30fca2(_0x3b06b2);});});}exports[_0xffba('0x16')]=function(_0xde9b71){var _0x3c3a9c=this;return new Promise(function(_0x29554e,_0x537a26){return db[_0xffba('0x17')][_0xffba('0x18')]({'raw':!![],'where':{'ContactId':_0xde9b71[_0xffba('0x19')][_0xffba('0x1a')],'ListId':_0xde9b71[_0xffba('0x19')][_0xffba('0x1b')],'VoiceQueueId':_0xde9b71['body'][_0xffba('0x1c')]===undefined?null:_0xde9b71['body'][_0xffba('0x1c')],'CampaignId':_0xde9b71[_0xffba('0x19')][_0xffba('0x1d')]===undefined?null:_0xde9b71[_0xffba('0x19')][_0xffba('0x1d')]}})[_0xffba('0xc')](function(_0x29ca47){if(_0x29ca47!=null){return db[_0xffba('0x1e')][_0xffba('0x18')]({'raw':!![],'where':{'CmHopperId':_0x29ca47['id'],'OrderBy':{'$gt':_0x29ca47[_0xffba('0x1f')]}},'order':[[_0xffba('0x1f'),'ASC']]})[_0xffba('0xc')](function(_0x8cb740){var _0x9a56a3=0x0;if(_0x8cb740){if(_0x8cb740[_0xffba('0x20')]+_0x8cb740[_0xffba('0x21')]+_0x8cb740['countnoanswerretry']+_0x8cb740[_0xffba('0x22')]+_0x8cb740[_0xffba('0x23')]+_0x8cb740['countabandonedretry']+_0x8cb740['countmachineretry']+_0x8cb740[_0xffba('0x24')]<_0xde9b71[_0xffba('0x25')][_0xffba('0x26')])_0x9a56a3=0x1;_0x29554e({'additional':_0x9a56a3});}else{return db[_0xffba('0x1e')][_0xffba('0x18')]({'raw':!![],'where':{'CmHopperId':_0x29ca47['id']},'order':[[_0xffba('0x1f'),_0xffba('0x27')]]})[_0xffba('0xc')](function(_0x2d2c07){var _0x261c9d=0x0;if(_0x2d2c07){if(_0x2d2c07[_0xffba('0x20')]+_0x2d2c07['countcongestionretry']+_0x2d2c07[_0xffba('0x28')]+_0x2d2c07[_0xffba('0x22')]+_0x2d2c07[_0xffba('0x23')]+_0x2d2c07[_0xffba('0x29')]+_0x2d2c07[_0xffba('0x2a')]+_0x2d2c07['countagentrejectretry']<_0xde9b71['entity']['dialGlobalMaxRetry'])_0x261c9d=0x1;_0x29554e({'additional':_0x261c9d});}else{_0x29554e({'additional':0x0});}})[_0xffba('0x15')](function(_0x2d7e69){logger[_0xffba('0x11')]('VerifyAdditionalPhones',_0x2d7e69['message']);_0x537a26(_0x3c3a9c[_0xffba('0x11')](0x1f4,_0x2d7e69['message']));});}})['catch'](function(_0x1b744b){logger[_0xffba('0x11')](_0xffba('0x16'),_0x1b744b[_0xffba('0x13')]);_0x537a26(_0x3c3a9c[_0xffba('0x11')](0x1f4,_0x1b744b[_0xffba('0x13')]));});}else _0x29554e({'additional':0x0});});});};exports[_0xffba('0x2b')]=function(_0x4d70fa){var _0x44cdd3=this;return new Promise(function(_0x32fa94,_0x2c88ad){return db[_0xffba('0x17')][_0xffba('0x18')]({'raw':!![],'where':{'ContactId':_0x4d70fa[_0xffba('0x19')]['ContactId'],'ListId':_0x4d70fa[_0xffba('0x19')][_0xffba('0x1b')],'VoiceQueueId':_0x4d70fa['body'][_0xffba('0x1c')]===undefined?null:_0x4d70fa[_0xffba('0x19')][_0xffba('0x1c')],'CampaignId':_0x4d70fa[_0xffba('0x19')][_0xffba('0x1d')]===undefined?null:_0x4d70fa[_0xffba('0x19')][_0xffba('0x1d')]}})['then'](function(_0x464c69){if(_0x464c69!=null){return db[_0xffba('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x464c69['id'],'OrderBy':{'$gte':_0x464c69[_0xffba('0x1f')]}},'order':[[_0xffba('0x1f'),_0xffba('0x27')]]})[_0xffba('0xc')](function(_0x2292d0){if(_0x2292d0)return activateAdditionalPhone(_0x464c69,_0x4d70fa[_0xffba('0x19')],_0x2292d0,_0x4d70fa[_0xffba('0x2c')],_0x4d70fa['waitTime'])['then'](function(_0x1c616f){_0x32fa94(_0x1c616f);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x464c69['id']},'order':[['OrderBy',_0xffba('0x27')]]})[_0xffba('0xc')](function(_0x43cdae){if(_0x43cdae)return activateAdditionalPhone(_0x464c69,_0x4d70fa[_0xffba('0x19')],_0x43cdae,_0x4d70fa[_0xffba('0x2c')],_0x4d70fa[_0xffba('0x2d')])[_0xffba('0xc')](function(_0x500968){_0x32fa94(_0x500968);});else{_0x32fa94({'id':_0x464c69['id'],'phone':''});}})['catch'](function(_0x3988e6){logger['error']('VerifyAdditionalPhones',_0x3988e6[_0xffba('0x13')]);_0x2c88ad(_0x44cdd3[_0xffba('0x11')](0x1f4,_0x3988e6['message']));});}})[_0xffba('0x15')](function(_0x1540f7){logger['error']('VerifyAdditionalPhones',_0x1540f7['message']);_0x2c88ad(_0x44cdd3[_0xffba('0x11')](0x1f4,_0x1540f7[_0xffba('0x13')]));});}else _0x32fa94(0x1);});});};function activateAdditionalPhone(_0xbd1e4d,_0x2f2861,_0x10fbf3,_0x2409dc,_0xbcef50){return new Promise(function(_0x1a69fe,_0x36f7df){var _0x38bb48;if(_['isNil'](_0x10fbf3[_0xffba('0x2e')])){_0x10fbf3[_0xffba('0x2e')]=moment();}if(moment()>moment(_0x10fbf3[_0xffba('0x2e')])){_0x38bb48=moment()[_0xffba('0x2f')](_0xbcef50||0x3,'minutes');}else{if(_0x10fbf3[_0xffba('0x1f')]==0x0){_0x38bb48=moment(_0x10fbf3['scheduledat']);}else{_0x38bb48=moment()['add'](_0xbcef50||0x3,_0xffba('0x30'));}}if(_[_0xffba('0x31')](_0x38bb48)){_0x38bb48=moment()[_0xffba('0x2f')](_0xbcef50||0x3,_0xffba('0x30'));}var _0x1b0916={'phone':_0xbd1e4d[_0xffba('0x32')],'active':0x0,'OrderBy':_[_0xffba('0x31')](_0xbd1e4d[_0xffba('0x1f')])?0x0:_0xbd1e4d['OrderBy'],'scheduledat':moment()[_0xffba('0x2f')](_0x2409dc||0x1,_0xffba('0x30')),'countbusyretry':_0x2f2861[_0xffba('0x20')],'countcongestionretry':_0x2f2861[_0xffba('0x21')],'countnoanswerretry':_0x2f2861[_0xffba('0x28')],'countnosuchnumberretry':_0x2f2861[_0xffba('0x22')],'countdropretry':_0x2f2861[_0xffba('0x23')],'countabandonedretry':_0x2f2861[_0xffba('0x29')],'countmachineretry':_0x2f2861['countmachineretry'],'countagentrejectretry':_0x2f2861[_0xffba('0x24')],'createdAt':_0x2f2861[_0xffba('0x33')],'updatedAt':_0x2f2861['updatedAt']};var _0x3c9141={'CmHopperId':_0xbd1e4d['id'],'phone':_0x10fbf3[_0xffba('0x32')],'active':0x0,'OrderBy':_[_0xffba('0x31')](_0x10fbf3[_0xffba('0x1f')])?0x0:_0x10fbf3[_0xffba('0x1f')],'scheduledat':_0x38bb48,'countbusyretry':_0x10fbf3[_0xffba('0x20')],'countcongestionretry':_0x10fbf3[_0xffba('0x21')],'countnoanswerretry':_0x10fbf3[_0xffba('0x28')],'countnosuchnumberretry':_0x10fbf3[_0xffba('0x22')],'countdropretry':_0x10fbf3['countdropretry'],'countabandonedretry':_0x10fbf3['countabandonedretry'],'countmachineretry':_0x10fbf3['countmachineretry'],'countagentrejectretry':_0x10fbf3[_0xffba('0x24')],'createdAt':_0x10fbf3[_0xffba('0x33')],'updatedAt':_0x10fbf3[_0xffba('0x34')]};return db[_0xffba('0x35')][_0xffba('0x36')](function(_0x585dd4){return db[_0xffba('0x1e')]['update'](_0x1b0916,{'where':{'id':_0x10fbf3['id']}},{'transaction':_0x585dd4})[_0xffba('0xc')](function(){return db[_0xffba('0x17')]['update'](_0x3c9141,{'where':{'id':_0xbd1e4d['id']}},{'transaction':_0x585dd4});});})[_0xffba('0xc')](function(_0xb0314d){_0x1a69fe({'id':_0xbd1e4d['id'],'phone':_0x10fbf3[_0xffba('0x32')]});})['catch'](function(_0x4a10dc){logger['error'](_0xffba('0x37'),_0x4a10dc[_0xffba('0x13')]);_0x36f7df({'error':_0x4a10dc[_0xffba('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x238357){var _0x43887b=this;return new Promise(function(_0x4d3bcd,_0x3abede){return db[_0xffba('0x17')][_0xffba('0x38')](_0x238357['body']['field'],{'where':{'id':_0x238357[_0xffba('0x19')]['id']}})['then'](function(_0x268717){_0x4d3bcd(_0x268717);})[_0xffba('0x15')](function(_0x34028f){logger['error'](_0xffba('0x39'),_0x34028f[_0xffba('0x13')]);_0x3abede(_0x43887b[_0xffba('0x11')](0x1f4,_0x34028f[_0xffba('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 0d3c1ab..5cd804e 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 _0xd134=['create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','isAuthenticated','show','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd134,0x1bf));var _0x4d13=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xd134[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x4d13('0x0'));var util=require(_0x4d13('0x1'));var path=require(_0x4d13('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d13('0x3'));var router=express[_0x4d13('0x4')]();var fs_extra=require(_0x4d13('0x5'));var auth=require(_0x4d13('0x6'));var interaction=require(_0x4d13('0x7'));var config=require(_0x4d13('0x8'));var controller=require(_0x4d13('0x9'));router[_0x4d13('0xa')]('/',auth['isAuthenticated'](),controller[_0x4d13('0xb')]);router['get']('/:id',auth[_0x4d13('0xc')](),controller[_0x4d13('0xd')]);router[_0x4d13('0xe')]('/',auth[_0x4d13('0xc')](),controller[_0x4d13('0xf')]);router[_0x4d13('0x10')](_0x4d13('0x11'),auth[_0x4d13('0xc')](),controller[_0x4d13('0x12')]);router['delete'](_0x4d13('0x11'),auth[_0x4d13('0xc')](),controller[_0x4d13('0x13')]);module[_0x4d13('0x14')]=router; \ No newline at end of file +var _0x9c1e=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x197198,_0x323ad8){var _0x4e644e=function(_0x348d2e){while(--_0x348d2e){_0x197198['push'](_0x197198['shift']());}};_0x4e644e(++_0x323ad8);}(_0x9c1e,0x153));var _0xe9c1=function(_0x32ba7b,_0x5aae75){_0x32ba7b=_0x32ba7b-0x0;var _0x18fea0=_0x9c1e[_0x32ba7b];return _0x18fea0;};'use strict';var multer=require(_0xe9c1('0x0'));var util=require(_0xe9c1('0x1'));var path=require(_0xe9c1('0x2'));var timeout=require(_0xe9c1('0x3'));var express=require(_0xe9c1('0x4'));var router=express['Router']();var fs_extra=require(_0xe9c1('0x5'));var auth=require(_0xe9c1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe9c1('0x7'));var controller=require(_0xe9c1('0x8'));router[_0xe9c1('0x9')]('/',auth[_0xe9c1('0xa')](),controller[_0xe9c1('0xb')]);router['get'](_0xe9c1('0xc'),auth[_0xe9c1('0xa')](),controller['show']);router[_0xe9c1('0xd')]('/',auth[_0xe9c1('0xa')](),controller[_0xe9c1('0xe')]);router[_0xe9c1('0xf')]('/:id',auth[_0xe9c1('0xa')](),controller[_0xe9c1('0x10')]);router[_0xe9c1('0x11')](_0xe9c1('0xc'),auth['isAuthenticated'](),controller[_0xe9c1('0x12')]);module[_0xe9c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d18699e..54e96b2 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 _0xfcf0=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfcf0,0x138));var _0x0fcf=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xfcf0[_0x24392f];return _0x591e33;};'use strict';var moment=require(_0x0fcf('0x0'));var Sequelize=require(_0x0fcf('0x1'));module['exports']={'phone':{'type':Sequelize[_0x0fcf('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0fcf('0x3')],'unique':_0x0fcf('0x4')},'ListId':{'type':Sequelize[_0x0fcf('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x0fcf('0x3')],'unique':_0x0fcf('0x4')}}; \ No newline at end of file +var _0xc319=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x5000b7,_0x43ee94){var _0x47fe7d=function(_0x2352b9){while(--_0x2352b9){_0x5000b7['push'](_0x5000b7['shift']());}};_0x47fe7d(++_0x43ee94);}(_0xc319,0x12e));var _0x9c31=function(_0x23dc9d,_0x26087d){_0x23dc9d=_0x23dc9d-0x0;var _0x48fa0a=_0xc319[_0x23dc9d];return _0x48fa0a;};'use strict';var moment=require(_0x9c31('0x0'));var Sequelize=require(_0x9c31('0x1'));module[_0x9c31('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9c31('0x3')],'unique':_0x9c31('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9c31('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9c31('0x3')],'unique':_0x9c31('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 751b151..fc1e3eb 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 _0xeda7=['update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','CmHopperBlack','includeAll','findAll','rows','catch','params','find','body','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','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xeda7,0x196));var _0x7eda=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xeda7[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0x7eda('0x0'));var rimraf=require(_0x7eda('0x1'));var zipdir=require(_0x7eda('0x2'));var jsonpatch=require(_0x7eda('0x3'));var rp=require(_0x7eda('0x4'));var moment=require(_0x7eda('0x5'));var BPromise=require(_0x7eda('0x6'));var Mustache=require(_0x7eda('0x7'));var util=require(_0x7eda('0x8'));var path=require(_0x7eda('0x9'));var sox=require(_0x7eda('0xa'));var csv=require(_0x7eda('0xb'));var ejs=require(_0x7eda('0xc'));var fs=require('fs');var fs_extra=require(_0x7eda('0xd'));var _=require(_0x7eda('0xe'));var squel=require(_0x7eda('0xf'));var crypto=require(_0x7eda('0x10'));var jsforce=require(_0x7eda('0x11'));var deskjs=require(_0x7eda('0x12'));var toCsv=require(_0x7eda('0xb'));var querystring=require('querystring');var Papa=require(_0x7eda('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7eda('0x14'));var as=require(_0x7eda('0x15'));var hardwareService=require(_0x7eda('0x16'));var logger=require(_0x7eda('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7eda('0x18'));var licenseUtil=require(_0x7eda('0x19'));var db=require(_0x7eda('0x1a'))['db'];function respondWithStatusCode(_0x165fce,_0x5cd373){_0x5cd373=_0x5cd373||0xcc;return function(_0x1e7404){if(_0x1e7404){return _0x165fce['sendStatus'](_0x5cd373);}return _0x165fce[_0x7eda('0x1b')](_0x5cd373)[_0x7eda('0x1c')]();};}function respondWithResult(_0x1353e7,_0x145c81){_0x145c81=_0x145c81||0xc8;return function(_0x3de1be){if(_0x3de1be){return _0x1353e7[_0x7eda('0x1b')](_0x145c81)[_0x7eda('0x1d')](_0x3de1be);}};}function respondWithFilteredResult(_0x237d47,_0x6eaeeb){return function(_0x4a8fa2){if(_0x4a8fa2){var _0x4d13db=typeof _0x6eaeeb[_0x7eda('0x1e')]==='undefined'&&typeof _0x6eaeeb['limit']===_0x7eda('0x1f');var _0x44c83e=_0x4a8fa2[_0x7eda('0x20')];var _0x8a1a07=_0x4d13db?0x0:_0x6eaeeb[_0x7eda('0x1e')];var _0x4c8420=_0x4d13db?_0x4a8fa2['count']:_0x6eaeeb['offset']+_0x6eaeeb[_0x7eda('0x21')];var _0x558ecb;if(_0x4c8420>=_0x44c83e){_0x4c8420=_0x44c83e;_0x558ecb=0xc8;}else{_0x558ecb=0xce;}_0x237d47[_0x7eda('0x1b')](_0x558ecb);return _0x237d47[_0x7eda('0x22')](_0x7eda('0x23'),_0x8a1a07+'-'+_0x4c8420+'/'+_0x44c83e)[_0x7eda('0x1d')](_0x4a8fa2);}return null;};}function patchUpdates(_0x51443d){return function(_0x11158){try{jsonpatch[_0x7eda('0x24')](_0x11158,_0x51443d,!![]);}catch(_0x3d73ce){return BPromise[_0x7eda('0x25')](_0x3d73ce);}return _0x11158['save']();};}function saveUpdates(_0x5f0965,_0x1dddc1){return function(_0x58c409){if(_0x58c409){return _0x58c409[_0x7eda('0x26')](_0x5f0965)[_0x7eda('0x27')](function(_0x557fec){return _0x557fec;});}return null;};}function removeEntity(_0x2a62e7,_0x1519ee){return function(_0x1c064d){if(_0x1c064d){return _0x1c064d[_0x7eda('0x28')]()[_0x7eda('0x27')](function(){_0x2a62e7['status'](0xcc)[_0x7eda('0x1c')]();});}};}function handleEntityNotFound(_0x2ca61d,_0x1a4950){return function(_0x5ae8ff){if(!_0x5ae8ff){_0x2ca61d[_0x7eda('0x29')](0x194);}return _0x5ae8ff;};}function handleError(_0xd23184,_0xefbea1){_0xefbea1=_0xefbea1||0x1f4;return function(_0x76f1b2){logger[_0x7eda('0x2a')](_0x76f1b2[_0x7eda('0x2b')]);if(_0x76f1b2[_0x7eda('0x2c')]){delete _0x76f1b2[_0x7eda('0x2c')];}_0xd23184[_0x7eda('0x1b')](_0xefbea1)[_0x7eda('0x2d')](_0x76f1b2);};}exports['index']=function(_0x3a77f6,_0x3e1a08){var _0x300e20={},_0x2c5af0={},_0x5661fe={'count':0x0,'rows':[]};var _0x28aa9f=_[_0x7eda('0x2e')](db['CmHopperBlack'][_0x7eda('0x2f')],function(_0x4655a9){return{'name':_0x4655a9['fieldName'],'type':_0x4655a9[_0x7eda('0x30')][_0x7eda('0x31')]};});_0x2c5af0[_0x7eda('0x32')]=_[_0x7eda('0x2e')](_0x28aa9f,_0x7eda('0x2c'));_0x2c5af0[_0x7eda('0x33')]=_[_0x7eda('0x34')](_0x3a77f6[_0x7eda('0x33')]);_0x2c5af0[_0x7eda('0x35')]=_[_0x7eda('0x36')](_0x2c5af0['model'],_0x2c5af0[_0x7eda('0x33')]);_0x300e20['attributes']=_[_0x7eda('0x36')](_0x2c5af0[_0x7eda('0x32')],qs[_0x7eda('0x37')](_0x3a77f6[_0x7eda('0x33')]['fields']));_0x300e20[_0x7eda('0x38')]=_0x300e20[_0x7eda('0x38')][_0x7eda('0x39')]?_0x300e20['attributes']:_0x2c5af0[_0x7eda('0x32')];if(!_0x3a77f6[_0x7eda('0x33')][_0x7eda('0x3a')]('nolimit')){_0x300e20[_0x7eda('0x21')]=qs[_0x7eda('0x21')](_0x3a77f6[_0x7eda('0x33')][_0x7eda('0x21')]);_0x300e20['offset']=qs[_0x7eda('0x1e')](_0x3a77f6[_0x7eda('0x33')]['offset']);}_0x300e20[_0x7eda('0x3b')]=qs[_0x7eda('0x3c')](_0x3a77f6[_0x7eda('0x33')][_0x7eda('0x3c')]);_0x300e20['where']=qs[_0x7eda('0x35')](_[_0x7eda('0x3d')](_0x3a77f6['query'],_0x2c5af0['filters']),_0x28aa9f);if(_0x3a77f6[_0x7eda('0x33')][_0x7eda('0x3e')]){_0x300e20['where']=_[_0x7eda('0x3f')](_0x300e20[_0x7eda('0x40')],{'$or':_[_0x7eda('0x2e')](_0x28aa9f,function(_0x1f879c){if(_0x1f879c['type']!=='VIRTUAL'){var _0x3b78d7={};_0x3b78d7[_0x1f879c[_0x7eda('0x2c')]]={'$like':'%'+_0x3a77f6[_0x7eda('0x33')][_0x7eda('0x3e')]+'%'};return _0x3b78d7;}})});}_0x300e20=_['merge']({},_0x300e20,_0x3a77f6[_0x7eda('0x41')]);var _0xcf604d={'where':_0x300e20[_0x7eda('0x40')]};return db[_0x7eda('0x42')][_0x7eda('0x20')](_0xcf604d)[_0x7eda('0x27')](function(_0x478a92){_0x5661fe[_0x7eda('0x20')]=_0x478a92;if(_0x3a77f6[_0x7eda('0x33')][_0x7eda('0x43')]){_0x300e20['include']=[{'all':!![]}];}return db[_0x7eda('0x42')][_0x7eda('0x44')](_0x300e20);})[_0x7eda('0x27')](function(_0x317d94){_0x5661fe[_0x7eda('0x45')]=_0x317d94;return _0x5661fe;})[_0x7eda('0x27')](respondWithFilteredResult(_0x3e1a08,_0x300e20))[_0x7eda('0x46')](handleError(_0x3e1a08,null));};exports['show']=function(_0x4b4d37,_0x85f223){var _0xa45a33={'raw':!![],'where':{'id':_0x4b4d37[_0x7eda('0x47')]['id']}},_0x425a16={};_0x425a16[_0x7eda('0x32')]=_[_0x7eda('0x34')](db[_0x7eda('0x42')][_0x7eda('0x2f')]);_0x425a16[_0x7eda('0x33')]=_[_0x7eda('0x34')](_0x4b4d37[_0x7eda('0x33')]);_0x425a16[_0x7eda('0x35')]=_[_0x7eda('0x36')](_0x425a16[_0x7eda('0x32')],_0x425a16['query']);_0xa45a33[_0x7eda('0x38')]=_[_0x7eda('0x36')](_0x425a16[_0x7eda('0x32')],qs['fields'](_0x4b4d37[_0x7eda('0x33')]['fields']));_0xa45a33[_0x7eda('0x38')]=_0xa45a33[_0x7eda('0x38')][_0x7eda('0x39')]?_0xa45a33[_0x7eda('0x38')]:_0x425a16['model'];if(_0x4b4d37[_0x7eda('0x33')][_0x7eda('0x43')]){_0xa45a33['include']=[{'all':!![]}];}_0xa45a33=_[_0x7eda('0x3f')]({},_0xa45a33,_0x4b4d37['options']);return db[_0x7eda('0x42')][_0x7eda('0x48')](_0xa45a33)[_0x7eda('0x27')](handleEntityNotFound(_0x85f223,null))[_0x7eda('0x27')](respondWithResult(_0x85f223,null))['catch'](handleError(_0x85f223,null));};exports['update']=function(_0x306fc5,_0x250287){if(_0x306fc5[_0x7eda('0x49')]['id']){delete _0x306fc5[_0x7eda('0x49')]['id'];}return db[_0x7eda('0x42')][_0x7eda('0x48')]({'where':{'id':_0x306fc5[_0x7eda('0x47')]['id']}})[_0x7eda('0x27')](handleEntityNotFound(_0x250287,null))[_0x7eda('0x27')](saveUpdates(_0x306fc5[_0x7eda('0x49')],null))[_0x7eda('0x27')](respondWithResult(_0x250287,null))['catch'](handleError(_0x250287,null));};exports[_0x7eda('0x28')]=function(_0x335a3,_0x239399){return db[_0x7eda('0x42')][_0x7eda('0x48')]({'where':{'id':_0x335a3[_0x7eda('0x47')]['id']}})['then'](handleEntityNotFound(_0x239399,null))[_0x7eda('0x27')](removeEntity(_0x239399,null))[_0x7eda('0x46')](handleError(_0x239399,null));};exports['describe']=function(_0x47530d,_0x4238e4){return db[_0x7eda('0x42')]['describe']()[_0x7eda('0x27')](respondWithResult(_0x4238e4,null))['catch'](handleError(_0x4238e4,null));}; \ No newline at end of file +var _0xd2a3=['show','params','length','options','find','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','CmHopperBlack','includeAll','include','findAll','rows'];(function(_0x427f14,_0xefee2f){var _0x25c1a6=function(_0x2651de){while(--_0x2651de){_0x427f14['push'](_0x427f14['shift']());}};_0x25c1a6(++_0xefee2f);}(_0xd2a3,0x17f));var _0x3d2a=function(_0x360f38,_0x23461d){_0x360f38=_0x360f38-0x0;var _0x561b93=_0xd2a3[_0x360f38];return _0x561b93;};'use strict';var emlformat=require(_0x3d2a('0x0'));var rimraf=require(_0x3d2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d2a('0x2'));var rp=require(_0x3d2a('0x3'));var moment=require(_0x3d2a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d2a('0x5'));var util=require(_0x3d2a('0x6'));var path=require(_0x3d2a('0x7'));var sox=require(_0x3d2a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d2a('0x9'));var _=require('lodash');var squel=require(_0x3d2a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d2a('0xb'));var toCsv=require(_0x3d2a('0xc'));var querystring=require(_0x3d2a('0xd'));var Papa=require('papaparse');var Redis=require(_0x3d2a('0xe'));var authService=require(_0x3d2a('0xf'));var qs=require(_0x3d2a('0x10'));var as=require(_0x3d2a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d2a('0x12'))(_0x3d2a('0x13'));var utils=require('../../config/utils');var config=require(_0x3d2a('0x14'));var licenseUtil=require(_0x3d2a('0x15'));var db=require(_0x3d2a('0x16'))['db'];function respondWithStatusCode(_0x4e8ec9,_0x57e427){_0x57e427=_0x57e427||0xcc;return function(_0x26c84c){if(_0x26c84c){return _0x4e8ec9[_0x3d2a('0x17')](_0x57e427);}return _0x4e8ec9[_0x3d2a('0x18')](_0x57e427)[_0x3d2a('0x19')]();};}function respondWithResult(_0x29f4bf,_0x3e5b25){_0x3e5b25=_0x3e5b25||0xc8;return function(_0x181d35){if(_0x181d35){return _0x29f4bf[_0x3d2a('0x18')](_0x3e5b25)[_0x3d2a('0x1a')](_0x181d35);}};}function respondWithFilteredResult(_0x2ce2fa,_0x219165){return function(_0x36aa57){if(_0x36aa57){var _0x5b9cb2=typeof _0x219165[_0x3d2a('0x1b')]===_0x3d2a('0x1c')&&typeof _0x219165[_0x3d2a('0x1d')]===_0x3d2a('0x1c');var _0x2ea16d=_0x36aa57[_0x3d2a('0x1e')];var _0x3bb5a5=_0x5b9cb2?0x0:_0x219165[_0x3d2a('0x1b')];var _0x5522b9=_0x5b9cb2?_0x36aa57[_0x3d2a('0x1e')]:_0x219165[_0x3d2a('0x1b')]+_0x219165[_0x3d2a('0x1d')];var _0x192ae1;if(_0x5522b9>=_0x2ea16d){_0x5522b9=_0x2ea16d;_0x192ae1=0xc8;}else{_0x192ae1=0xce;}_0x2ce2fa[_0x3d2a('0x18')](_0x192ae1);return _0x2ce2fa[_0x3d2a('0x1f')]('Content-Range',_0x3bb5a5+'-'+_0x5522b9+'/'+_0x2ea16d)[_0x3d2a('0x1a')](_0x36aa57);}return null;};}function patchUpdates(_0x356a66){return function(_0x584b51){try{jsonpatch[_0x3d2a('0x20')](_0x584b51,_0x356a66,!![]);}catch(_0x49b085){return BPromise[_0x3d2a('0x21')](_0x49b085);}return _0x584b51[_0x3d2a('0x22')]();};}function saveUpdates(_0x3d3977,_0x435979){return function(_0xcdf4fb){if(_0xcdf4fb){return _0xcdf4fb[_0x3d2a('0x23')](_0x3d3977)[_0x3d2a('0x24')](function(_0x4645fb){return _0x4645fb;});}return null;};}function removeEntity(_0x3f9812,_0x5bcdca){return function(_0x1b2afd){if(_0x1b2afd){return _0x1b2afd[_0x3d2a('0x25')]()['then'](function(){_0x3f9812['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5afac4,_0x1d07b5){return function(_0x5a3ccf){if(!_0x5a3ccf){_0x5afac4[_0x3d2a('0x17')](0x194);}return _0x5a3ccf;};}function handleError(_0x82eae2,_0xba41cc){_0xba41cc=_0xba41cc||0x1f4;return function(_0x5962f0){logger[_0x3d2a('0x26')](_0x5962f0[_0x3d2a('0x27')]);if(_0x5962f0[_0x3d2a('0x28')]){delete _0x5962f0['name'];}_0x82eae2[_0x3d2a('0x18')](_0xba41cc)[_0x3d2a('0x29')](_0x5962f0);};}exports[_0x3d2a('0x2a')]=function(_0x4a426a,_0x3eeb00){var _0x21ad24={},_0x295738={},_0x3de49d={'count':0x0,'rows':[]};var _0x35076a=_['map'](db['CmHopperBlack'][_0x3d2a('0x2b')],function(_0x8d56db){return{'name':_0x8d56db[_0x3d2a('0x2c')],'type':_0x8d56db[_0x3d2a('0x2d')]['key']};});_0x295738['model']=_[_0x3d2a('0x2e')](_0x35076a,_0x3d2a('0x28'));_0x295738[_0x3d2a('0x2f')]=_[_0x3d2a('0x30')](_0x4a426a[_0x3d2a('0x2f')]);_0x295738['filters']=_['intersection'](_0x295738[_0x3d2a('0x31')],_0x295738[_0x3d2a('0x2f')]);_0x21ad24[_0x3d2a('0x32')]=_[_0x3d2a('0x33')](_0x295738[_0x3d2a('0x31')],qs[_0x3d2a('0x34')](_0x4a426a[_0x3d2a('0x2f')]['fields']));_0x21ad24['attributes']=_0x21ad24[_0x3d2a('0x32')]['length']?_0x21ad24[_0x3d2a('0x32')]:_0x295738[_0x3d2a('0x31')];if(!_0x4a426a[_0x3d2a('0x2f')][_0x3d2a('0x35')]('nolimit')){_0x21ad24[_0x3d2a('0x1d')]=qs[_0x3d2a('0x1d')](_0x4a426a[_0x3d2a('0x2f')][_0x3d2a('0x1d')]);_0x21ad24[_0x3d2a('0x1b')]=qs[_0x3d2a('0x1b')](_0x4a426a[_0x3d2a('0x2f')][_0x3d2a('0x1b')]);}_0x21ad24[_0x3d2a('0x36')]=qs[_0x3d2a('0x37')](_0x4a426a['query'][_0x3d2a('0x37')]);_0x21ad24[_0x3d2a('0x38')]=qs[_0x3d2a('0x39')](_[_0x3d2a('0x3a')](_0x4a426a[_0x3d2a('0x2f')],_0x295738['filters']),_0x35076a);if(_0x4a426a[_0x3d2a('0x2f')]['filter']){_0x21ad24['where']=_[_0x3d2a('0x3b')](_0x21ad24[_0x3d2a('0x38')],{'$or':_[_0x3d2a('0x2e')](_0x35076a,function(_0x38f3b8){if(_0x38f3b8[_0x3d2a('0x2d')]!==_0x3d2a('0x3c')){var _0x169d2e={};_0x169d2e[_0x38f3b8['name']]={'$like':'%'+_0x4a426a[_0x3d2a('0x2f')][_0x3d2a('0x3d')]+'%'};return _0x169d2e;}})});}_0x21ad24=_[_0x3d2a('0x3b')]({},_0x21ad24,_0x4a426a['options']);var _0x19e1c4={'where':_0x21ad24[_0x3d2a('0x38')]};return db[_0x3d2a('0x3e')][_0x3d2a('0x1e')](_0x19e1c4)[_0x3d2a('0x24')](function(_0xec29b8){_0x3de49d[_0x3d2a('0x1e')]=_0xec29b8;if(_0x4a426a[_0x3d2a('0x2f')][_0x3d2a('0x3f')]){_0x21ad24[_0x3d2a('0x40')]=[{'all':!![]}];}return db[_0x3d2a('0x3e')][_0x3d2a('0x41')](_0x21ad24);})[_0x3d2a('0x24')](function(_0x2be6c4){_0x3de49d[_0x3d2a('0x42')]=_0x2be6c4;return _0x3de49d;})[_0x3d2a('0x24')](respondWithFilteredResult(_0x3eeb00,_0x21ad24))['catch'](handleError(_0x3eeb00,null));};exports[_0x3d2a('0x43')]=function(_0x16658e,_0x30328c){var _0x35d265={'raw':!![],'where':{'id':_0x16658e[_0x3d2a('0x44')]['id']}},_0x1079b1={};_0x1079b1['model']=_[_0x3d2a('0x30')](db['CmHopperBlack'][_0x3d2a('0x2b')]);_0x1079b1[_0x3d2a('0x2f')]=_['keys'](_0x16658e[_0x3d2a('0x2f')]);_0x1079b1[_0x3d2a('0x39')]=_[_0x3d2a('0x33')](_0x1079b1[_0x3d2a('0x31')],_0x1079b1[_0x3d2a('0x2f')]);_0x35d265[_0x3d2a('0x32')]=_['intersection'](_0x1079b1[_0x3d2a('0x31')],qs[_0x3d2a('0x34')](_0x16658e[_0x3d2a('0x2f')][_0x3d2a('0x34')]));_0x35d265[_0x3d2a('0x32')]=_0x35d265[_0x3d2a('0x32')][_0x3d2a('0x45')]?_0x35d265[_0x3d2a('0x32')]:_0x1079b1['model'];if(_0x16658e[_0x3d2a('0x2f')]['includeAll']){_0x35d265[_0x3d2a('0x40')]=[{'all':!![]}];}_0x35d265=_['merge']({},_0x35d265,_0x16658e[_0x3d2a('0x46')]);return db[_0x3d2a('0x3e')][_0x3d2a('0x47')](_0x35d265)[_0x3d2a('0x24')](handleEntityNotFound(_0x30328c,null))[_0x3d2a('0x24')](respondWithResult(_0x30328c,null))[_0x3d2a('0x48')](handleError(_0x30328c,null));};exports['update']=function(_0x45954e,_0x10155a){if(_0x45954e[_0x3d2a('0x49')]['id']){delete _0x45954e[_0x3d2a('0x49')]['id'];}return db[_0x3d2a('0x3e')][_0x3d2a('0x47')]({'where':{'id':_0x45954e['params']['id']}})[_0x3d2a('0x24')](handleEntityNotFound(_0x10155a,null))[_0x3d2a('0x24')](saveUpdates(_0x45954e[_0x3d2a('0x49')],null))[_0x3d2a('0x24')](respondWithResult(_0x10155a,null))['catch'](handleError(_0x10155a,null));};exports[_0x3d2a('0x25')]=function(_0x248203,_0x29f705){return db[_0x3d2a('0x3e')]['find']({'where':{'id':_0x248203[_0x3d2a('0x44')]['id']}})[_0x3d2a('0x24')](handleEntityNotFound(_0x29f705,null))[_0x3d2a('0x24')](removeEntity(_0x29f705,null))['catch'](handleError(_0x29f705,null));};exports['describe']=function(_0x193e05,_0x3b315e){return db[_0x3d2a('0x3e')][_0x3d2a('0x4a')]()[_0x3d2a('0x24')](respondWithResult(_0x3b315e,null))[_0x3d2a('0x48')](handleError(_0x3b315e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index aee0d90..3bc9238 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 _0x53a1=['./cmHopperBlack.attributes','CmHopperBlack','lodash','util','api','moment','bluebird','request-promise'];(function(_0x14b822,_0x3f0325){var _0x465ae6=function(_0x570b4d){while(--_0x570b4d){_0x14b822['push'](_0x14b822['shift']());}};_0x465ae6(++_0x3f0325);}(_0x53a1,0x7a));var _0x153a=function(_0x2af99e,_0x3b12b2){_0x2af99e=_0x2af99e-0x0;var _0x167bef=_0x53a1[_0x2af99e];return _0x167bef;};'use strict';var _=require(_0x153a('0x0'));var util=require(_0x153a('0x1'));var logger=require('../../config/logger')(_0x153a('0x2'));var moment=require(_0x153a('0x3'));var BPromise=require(_0x153a('0x4'));var rp=require(_0x153a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x153a('0x6'));module['exports']=function(_0x443b63,_0x240655){return _0x443b63['define'](_0x153a('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbe9=['CmHopperBlack','../../config/logger','moment','request-promise','path','./cmHopperBlack.attributes','exports'];(function(_0x4ff7c5,_0xec3c3c){var _0x35b7a9=function(_0x1ea710){while(--_0x1ea710){_0x4ff7c5['push'](_0x4ff7c5['shift']());}};_0x35b7a9(++_0xec3c3c);}(_0xbbe9,0x1eb));var _0x9bbe=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xbbe9[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9bbe('0x0'))('api');var moment=require(_0x9bbe('0x1'));var BPromise=require('bluebird');var rp=require(_0x9bbe('0x2'));var fs=require('fs');var path=require(_0x9bbe('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9bbe('0x4'));module[_0x9bbe('0x5')]=function(_0x1aa1c7,_0x5c17e3){return _0x1aa1c7['define'](_0x9bbe('0x6'),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 8800ea7..80ffe95 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 _0x59ce=['include','model','attributes','map','UpdateCmHopperBlack','CmHopperBlack','update','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','options','raw','where','limit'];(function(_0x3c7b91,_0x5b3e20){var _0x3bc225=function(_0x6b0dc3){while(--_0x6b0dc3){_0x3c7b91['push'](_0x3c7b91['shift']());}};_0x3bc225(++_0x5b3e20);}(_0x59ce,0x118));var _0xe59c=function(_0x552e27,_0x2efccc){_0x552e27=_0x552e27-0x0;var _0x1d6e64=_0x59ce[_0x552e27];return _0x1d6e64;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var moment=require(_0xe59c('0x2'));var BPromise=require(_0xe59c('0x3'));var rs=require(_0xe59c('0x4'));var fs=require('fs');var Redis=require(_0xe59c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe59c('0x6'))('rpc');var config=require(_0xe59c('0x7'));var jayson=require(_0xe59c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf879de,_0x2f24c1,_0x37ae0c){return new BPromise(function(_0x41ddbd,_0x13ad89){return client[_0xe59c('0x9')](_0xf879de,_0x37ae0c)[_0xe59c('0xa')](function(_0x42562b){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2f24c1,_0xe59c('0xb'));logger[_0xe59c('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2f24c1,_0xe59c('0xb'),JSON[_0xe59c('0xd')](_0x42562b));if(_0x42562b[_0xe59c('0xe')]){if(_0x42562b[_0xe59c('0xe')][_0xe59c('0xf')]===0x1f4){logger[_0xe59c('0xe')](_0xe59c('0x10'),_0x2f24c1,_0x42562b['error'][_0xe59c('0x11')]);return _0x13ad89(_0x42562b[_0xe59c('0xe')][_0xe59c('0x11')]);}logger[_0xe59c('0xe')](_0xe59c('0x10'),_0x2f24c1,_0x42562b[_0xe59c('0xe')][_0xe59c('0x11')]);return _0x41ddbd(_0x42562b[_0xe59c('0xe')]['message']);}else{logger[_0xe59c('0x12')](_0xe59c('0x10'),_0x2f24c1,_0xe59c('0xb'));_0x41ddbd(_0x42562b[_0xe59c('0x13')][_0xe59c('0x11')]);}})[_0xe59c('0x14')](function(_0x200094){logger['error'](_0xe59c('0x10'),_0x2f24c1,_0x200094);_0x13ad89(_0x200094);});});}exports[_0xe59c('0x15')]=function(_0xc3fb79){var _0x35e1b0=this;return new Promise(function(_0x52a2bc,_0x345d36){return db['CmHopperBlack']['findAll']({'raw':_0xc3fb79[_0xe59c('0x16')]?_0xc3fb79['options'][_0xe59c('0x17')]===undefined?!![]:![]:!![],'where':_0xc3fb79[_0xe59c('0x16')]?_0xc3fb79[_0xe59c('0x16')][_0xe59c('0x18')]||null:null,'attributes':_0xc3fb79[_0xe59c('0x16')]?_0xc3fb79[_0xe59c('0x16')]['attributes']||null:null,'limit':_0xc3fb79[_0xe59c('0x16')]?_0xc3fb79['options'][_0xe59c('0x19')]||null:null,'include':_0xc3fb79[_0xe59c('0x16')]?_0xc3fb79[_0xe59c('0x16')][_0xe59c('0x1a')]?_['map'](_0xc3fb79[_0xe59c('0x16')]['include'],function(_0x34fb9e){return{'model':db[_0x34fb9e[_0xe59c('0x1b')]],'as':_0x34fb9e['as'],'attributes':_0x34fb9e['attributes'],'include':_0x34fb9e[_0xe59c('0x1a')]?_['map'](_0x34fb9e[_0xe59c('0x1a')],function(_0xc2215a){return{'model':db[_0xc2215a[_0xe59c('0x1b')]],'as':_0xc2215a['as'],'attributes':_0xc2215a[_0xe59c('0x1c')],'include':_0xc2215a[_0xe59c('0x1a')]?_[_0xe59c('0x1d')](_0xc2215a[_0xe59c('0x1a')],function(_0x46bc1b){return{'model':db[_0x46bc1b[_0xe59c('0x1b')]],'as':_0x46bc1b['as'],'attributes':_0x46bc1b[_0xe59c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe59c('0xa')](function(_0x152481){logger[_0xe59c('0x12')](_0xe59c('0x15'),_0xc3fb79);logger[_0xe59c('0xc')](_0xe59c('0x15'),_0xc3fb79,JSON['stringify'](_0x152481));_0x52a2bc(_0x152481);})[_0xe59c('0x14')](function(_0x5dfa55){logger[_0xe59c('0xe')](_0xe59c('0x15'),_0x5dfa55[_0xe59c('0x11')],_0xc3fb79);_0x345d36(_0x35e1b0[_0xe59c('0xe')](0x1f4,_0x5dfa55[_0xe59c('0x11')]));});});};exports[_0xe59c('0x1e')]=function(_0x3566a2){var _0x52d463=this;return new Promise(function(_0x1d7062,_0x13559f){return db[_0xe59c('0x1f')][_0xe59c('0x20')](_0x3566a2['body'],{'raw':_0x3566a2[_0xe59c('0x16')]?_0x3566a2[_0xe59c('0x16')][_0xe59c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3566a2[_0xe59c('0x16')]?_0x3566a2[_0xe59c('0x16')][_0xe59c('0x18')]||null:null,'attributes':_0x3566a2[_0xe59c('0x16')]?_0x3566a2[_0xe59c('0x16')][_0xe59c('0x1c')]||null:null,'limit':_0x3566a2['options']?_0x3566a2['options'][_0xe59c('0x19')]||null:null})[_0xe59c('0xa')](function(_0xd97e10){logger[_0xe59c('0x12')](_0xe59c('0x1e'),_0x3566a2);logger[_0xe59c('0xc')](_0xe59c('0x1e'),_0x3566a2,JSON['stringify'](_0xd97e10));_0x1d7062(_0xd97e10);})[_0xe59c('0x14')](function(_0x3337d7){logger['error'](_0xe59c('0x1e'),_0x3337d7[_0xe59c('0x11')],_0x3566a2);_0x13559f(_0x52d463[_0xe59c('0xe')](0x1f4,_0x3337d7[_0xe59c('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x28b4c9){var _0x27e1a5=this;return new Promise(function(_0x422b40,_0x44da42){return db[_0xe59c('0x1f')]['destroy']({'where':_0x28b4c9['options']?_0x28b4c9[_0xe59c('0x16')]['where']||null:null})[_0xe59c('0xa')](function(_0x42c6ce){logger[_0xe59c('0x12')](_0xe59c('0x21'),_0x28b4c9);logger[_0xe59c('0xc')](_0xe59c('0x21'),_0x28b4c9,JSON[_0xe59c('0xd')](_0x42c6ce));_0x422b40(_0x42c6ce);})[_0xe59c('0x14')](function(_0x2d471f){logger[_0xe59c('0xe')]('DestroyCmHopperBlack',_0x2d471f[_0xe59c('0x11')],_0x28b4c9);_0x44da42(_0x27e1a5[_0xe59c('0xe')](0x1f4,_0x2d471f[_0xe59c('0x11')]));});});}; \ No newline at end of file +var _0xeb3c=['request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s'];(function(_0x41ed37,_0xbcd1d4){var _0x13f7ea=function(_0x270235){while(--_0x270235){_0x41ed37['push'](_0x41ed37['shift']());}};_0x13f7ea(++_0xbcd1d4);}(_0xeb3c,0xfb));var _0xceb3=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xeb3c[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0xceb3('0x0'));var util=require(_0xceb3('0x1'));var moment=require(_0xceb3('0x2'));var BPromise=require(_0xceb3('0x3'));var rs=require(_0xceb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xceb3('0x6'))('rpc');var config=require(_0xceb3('0x7'));var jayson=require(_0xceb3('0x8'));var client=jayson[_0xceb3('0x9')][_0xceb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1b9e,_0x20b20a,_0x3e86bf){return new BPromise(function(_0x499086,_0x2479bb){return client[_0xceb3('0xb')](_0x4e1b9e,_0x3e86bf)[_0xceb3('0xc')](function(_0x4e842){logger[_0xceb3('0xd')](_0xceb3('0xe'),_0x20b20a,_0xceb3('0xf'));logger[_0xceb3('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x20b20a,_0xceb3('0xf'),JSON[_0xceb3('0x11')](_0x4e842));if(_0x4e842[_0xceb3('0x12')]){if(_0x4e842[_0xceb3('0x12')][_0xceb3('0x13')]===0x1f4){logger[_0xceb3('0x12')](_0xceb3('0xe'),_0x20b20a,_0x4e842[_0xceb3('0x12')][_0xceb3('0x14')]);return _0x2479bb(_0x4e842[_0xceb3('0x12')]['message']);}logger[_0xceb3('0x12')](_0xceb3('0xe'),_0x20b20a,_0x4e842[_0xceb3('0x12')][_0xceb3('0x14')]);return _0x499086(_0x4e842[_0xceb3('0x12')][_0xceb3('0x14')]);}else{logger[_0xceb3('0xd')](_0xceb3('0xe'),_0x20b20a,_0xceb3('0xf'));_0x499086(_0x4e842[_0xceb3('0x15')][_0xceb3('0x14')]);}})[_0xceb3('0x16')](function(_0x3be131){logger[_0xceb3('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x20b20a,_0x3be131);_0x2479bb(_0x3be131);});});}exports[_0xceb3('0x17')]=function(_0x1b28e1){var _0x4183c8=this;return new Promise(function(_0x20791e,_0x2c98e7){return db[_0xceb3('0x18')][_0xceb3('0x19')]({'raw':_0x1b28e1['options']?_0x1b28e1['options'][_0xceb3('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b28e1[_0xceb3('0x1b')]?_0x1b28e1[_0xceb3('0x1b')][_0xceb3('0x1c')]||null:null,'attributes':_0x1b28e1[_0xceb3('0x1b')]?_0x1b28e1['options'][_0xceb3('0x1d')]||null:null,'limit':_0x1b28e1[_0xceb3('0x1b')]?_0x1b28e1[_0xceb3('0x1b')][_0xceb3('0x1e')]||null:null,'include':_0x1b28e1[_0xceb3('0x1b')]?_0x1b28e1[_0xceb3('0x1b')][_0xceb3('0x1f')]?_[_0xceb3('0x20')](_0x1b28e1[_0xceb3('0x1b')]['include'],function(_0x3fcb3b){return{'model':db[_0x3fcb3b[_0xceb3('0x21')]],'as':_0x3fcb3b['as'],'attributes':_0x3fcb3b[_0xceb3('0x1d')],'include':_0x3fcb3b[_0xceb3('0x1f')]?_[_0xceb3('0x20')](_0x3fcb3b[_0xceb3('0x1f')],function(_0x278f01){return{'model':db[_0x278f01[_0xceb3('0x21')]],'as':_0x278f01['as'],'attributes':_0x278f01[_0xceb3('0x1d')],'include':_0x278f01[_0xceb3('0x1f')]?_[_0xceb3('0x20')](_0x278f01[_0xceb3('0x1f')],function(_0x43444f){return{'model':db[_0x43444f[_0xceb3('0x21')]],'as':_0x43444f['as'],'attributes':_0x43444f['attributes']};}):[]};}):[]};}):[]:[]})[_0xceb3('0xc')](function(_0x196ef0){logger[_0xceb3('0xd')]('GetCmHopperBlack',_0x1b28e1);logger[_0xceb3('0x10')](_0xceb3('0x17'),_0x1b28e1,JSON[_0xceb3('0x11')](_0x196ef0));_0x20791e(_0x196ef0);})[_0xceb3('0x16')](function(_0x5656fd){logger[_0xceb3('0x12')](_0xceb3('0x17'),_0x5656fd['message'],_0x1b28e1);_0x2c98e7(_0x4183c8[_0xceb3('0x12')](0x1f4,_0x5656fd[_0xceb3('0x14')]));});});};exports[_0xceb3('0x22')]=function(_0x3e6d35){var _0x1c4a20=this;return new Promise(function(_0x42b7d0,_0x236535){return db[_0xceb3('0x18')]['update'](_0x3e6d35[_0xceb3('0x23')],{'raw':_0x3e6d35['options']?_0x3e6d35[_0xceb3('0x1b')][_0xceb3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6d35['options']?_0x3e6d35[_0xceb3('0x1b')][_0xceb3('0x1c')]||null:null,'attributes':_0x3e6d35['options']?_0x3e6d35[_0xceb3('0x1b')][_0xceb3('0x1d')]||null:null,'limit':_0x3e6d35['options']?_0x3e6d35['options'][_0xceb3('0x1e')]||null:null})[_0xceb3('0xc')](function(_0x1f6477){logger[_0xceb3('0xd')]('UpdateCmHopperBlack',_0x3e6d35);logger['debug']('UpdateCmHopperBlack',_0x3e6d35,JSON[_0xceb3('0x11')](_0x1f6477));_0x42b7d0(_0x1f6477);})[_0xceb3('0x16')](function(_0x362e77){logger['error'](_0xceb3('0x22'),_0x362e77[_0xceb3('0x14')],_0x3e6d35);_0x236535(_0x1c4a20[_0xceb3('0x12')](0x1f4,_0x362e77[_0xceb3('0x14')]));});});};exports[_0xceb3('0x24')]=function(_0x23f662){var _0x596f10=this;return new Promise(function(_0x385c30,_0x56294f){return db[_0xceb3('0x18')][_0xceb3('0x25')]({'where':_0x23f662[_0xceb3('0x1b')]?_0x23f662['options'][_0xceb3('0x1c')]||null:null})[_0xceb3('0xc')](function(_0x1e1d33){logger[_0xceb3('0xd')](_0xceb3('0x24'),_0x23f662);logger[_0xceb3('0x10')](_0xceb3('0x24'),_0x23f662,JSON[_0xceb3('0x11')](_0x1e1d33));_0x385c30(_0x1e1d33);})[_0xceb3('0x16')](function(_0x34c367){logger[_0xceb3('0x12')](_0xceb3('0x24'),_0x34c367[_0xceb3('0x14')],_0x23f662);_0x56294f(_0x596f10[_0xceb3('0x12')](0x1f4,_0x34c367[_0xceb3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 12fc4f6..05d166e 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 _0xed1c=['describe','/:id','show','put','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x1ba5e4,_0x23dc70){var _0xf2f3d1=function(_0x28e802){while(--_0x28e802){_0x1ba5e4['push'](_0x1ba5e4['shift']());}};_0xf2f3d1(++_0x23dc70);}(_0xed1c,0xe4));var _0xced1=function(_0x344db8,_0x4c46ab){_0x344db8=_0x344db8-0x0;var _0x5676c4=_0xed1c[_0x344db8];return _0x5676c4;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/:id',auth[_0xced1('0x7')](),controller['update']);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file +var _0x187d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x131dff,_0x8e081b){var _0x4b547e=function(_0x35cc86){while(--_0x35cc86){_0x131dff['push'](_0x131dff['shift']());}};_0x4b547e(++_0x8e081b);}(_0x187d,0x93));var _0xd187=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x187d[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0x13')]);module[_0xd187('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 49856ad..c6e2440 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 _0xcc34=['INTEGER','DATE','STRING','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports'];(function(_0x45961c,_0x500675){var _0x6f9967=function(_0x42c06a){while(--_0x42c06a){_0x45961c['push'](_0x45961c['shift']());}};_0x6f9967(++_0x500675);}(_0xcc34,0x126));var _0x4cc3=function(_0x40de1c,_0x2febf0){_0x40de1c=_0x40de1c-0x0;var _0x4c1029=_0xcc34[_0x40de1c];return _0x4c1029;};'use strict';var Sequelize=require(_0x4cc3('0x0'));var moment=require(_0x4cc3('0x1'));module[_0x4cc3('0x2')]={'state':{'type':Sequelize[_0x4cc3('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x4cc3('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x4cc3('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4cc3('0x5')]},'starttime':{'type':Sequelize[_0x4cc3('0x4')]},'responsetime':{'type':Sequelize[_0x4cc3('0x4')]},'answertime':{'type':Sequelize[_0x4cc3('0x4')]},'droptime':{'type':Sequelize[_0x4cc3('0x4')]},'endtime':{'type':Sequelize[_0x4cc3('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4cc3('0x5')]},'campaign':{'type':Sequelize[_0x4cc3('0x5')]},'campaigntype':{'type':Sequelize[_0x4cc3('0x5')]},'membername':{'type':Sequelize[_0x4cc3('0x5')]},'reason':{'type':Sequelize[_0x4cc3('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4cc3('0x5')]},'dispositionat':{'type':Sequelize[_0x4cc3('0x4')],'set':function(_0x134455){var _0x2b2d35=this['getDataValue'](_0x4cc3('0x6'));if(_0x2b2d35&&_0x134455){this[_0x4cc3('0x7')](_0x4cc3('0x8'),moment(_0x134455)[_0x4cc3('0x9')](moment(_0x2b2d35),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x4cc3('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4cc3('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4cc3('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x4cc3('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x4cc3('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4cc3('0x4')]},'recallme':{'type':Sequelize[_0x4cc3('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f59=['INTEGER','STRING','DATE','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','exports'];(function(_0x44bf90,_0x1c9a46){var _0x3dfc9d=function(_0x189531){while(--_0x189531){_0x44bf90['push'](_0x44bf90['shift']());}};_0x3dfc9d(++_0x1c9a46);}(_0x5f59,0x17a));var _0x95f5=function(_0x229c21,_0x1f1241){_0x229c21=_0x229c21-0x0;var _0x2d5b4f=_0x5f59[_0x229c21];return _0x2d5b4f;};'use strict';var Sequelize=require(_0x95f5('0x0'));var moment=require('moment');module[_0x95f5('0x1')]={'state':{'type':Sequelize[_0x95f5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x95f5('0x3')]},'scheduledat':{'type':Sequelize[_0x95f5('0x4')]},'countbusyretry':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x95f5('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x95f5('0x3')]},'calleridname':{'type':Sequelize[_0x95f5('0x3')]},'starttime':{'type':Sequelize[_0x95f5('0x4')]},'responsetime':{'type':Sequelize[_0x95f5('0x4')]},'answertime':{'type':Sequelize[_0x95f5('0x4')]},'droptime':{'type':Sequelize[_0x95f5('0x4')]},'endtime':{'type':Sequelize[_0x95f5('0x4')]},'ringtime':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x95f5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x95f5('0x3')]},'secondDisposition':{'type':Sequelize[_0x95f5('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x95f5('0x4')],'set':function(_0x32ac76){var _0x40a098=this['getDataValue'](_0x95f5('0x5'));if(_0x40a098&&_0x32ac76){this[_0x95f5('0x6')](_0x95f5('0x7'),moment(_0x32ac76)['diff'](moment(_0x40a098),_0x95f5('0x8')));}}},'amd':{'type':Sequelize[_0x95f5('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x95f5('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x95f5('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x95f5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x95f5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x95f5('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x95f5('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x95f5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x95f5('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 302879c..a70cf2e 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 _0x4975=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','CmHopperFinal','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','select'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4975,0x86));var _0x5497=function(_0x223644,_0x1d2e02){_0x223644=_0x223644-0x0;var _0x5339c8=_0x4975[_0x223644];return _0x5339c8;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['CmHopperFinal'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['describe']()[_0x5497('0x24')](respondWithResult(_0x466287,null))[_0x5497('0x40')](handleError(_0x466287,null));};exports[_0x5497('0x23')]=function(_0x52a189,_0x3e4da2){if(_0x52a189['body'][_0x5497('0x46')]){delete _0x52a189[_0x5497('0x47')][_0x5497('0x46')];}return db['CmHopperFinal'][_0x5497('0x44')]({'where':{'uniqueid':_0x52a189[_0x5497('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e4da2,null))[_0x5497('0x24')](saveUpdates(_0x52a189['body'],null))[_0x5497('0x24')](respondWithResult(_0x3e4da2,null))['catch'](handleError(_0x3e4da2,null));};exports[_0x5497('0x48')]=function(_0x400860,_0x26fd9f,_0xf07541){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x400860[_0x5497('0x42')]['id']},'attributes':[[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize'][_0x5497('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x50')))),_0x5497('0x51')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x52')))),_0x5497('0x53')],[db['sequelize']['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x56')))),_0x5497('0x57')]]})[_0x5497('0x24')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x24')](respondWithResult(_0x26fd9f,null))[_0x5497('0x40')](handleError(_0x26fd9f,null));};exports[_0x5497('0x58')]=function(_0x573f93,_0x18b30c,_0x3b0350){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'CampaignId':_0x573f93['params']['id']},'attributes':[[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x5b')))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x51')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x53')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x56')))),_0x5497('0x57')]]})['then'](handleEntityNotFound(_0x18b30c,null))[_0x5497('0x24')](respondWithResult(_0x18b30c,null))[_0x5497('0x40')](handleError(_0x18b30c,null));};exports[_0x5497('0x5c')]=function(_0x4ef195,_0x5794ff,_0x589008){return db[_0x5497('0x5d')][_0x5497('0x44')]({'where':{'id':_0x4ef195['params']['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x5794ff,null))[_0x5497('0x24')](function(_0x21c715){var _0x286af8;if(_0x21c715){_0x286af8=squel['insert']()[_0x5497('0x5e')](_0x5497('0x5f'))[_0x5497('0x60')](['phone',_0x5497('0x61'),_0x5497('0x62'),'ListId',_0x5497('0x63'),_0x5497('0x64'),_0x5497('0x65')],squel['select']()['field'](_0x5497('0x66'),_0x5497('0x67'))[_0x5497('0x68')](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x6d'),_0x5497('0x63'))[_0x5497('0x68')]('NOW()',_0x5497('0x64'))[_0x5497('0x68')]('NOW()',_0x5497('0x65'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4ef195[_0x5497('0x47')][_0x5497('0x73')]['toString']())[_0x5497('0x37')](_0x5497('0x74'))[_0x5497('0x37')](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x67'))['from'](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195[_0x5497('0x42')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5497('0x76'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id']['toString']())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x286af8);}return[];})[_0x5497('0x24')](respondWithResult(_0x5794ff,null))[_0x5497('0x40')](handleError(_0x5794ff,null));};exports[_0x5497('0x79')]=function(_0x4c41c4,_0x1515f1,_0x4118ec){return db[_0x5497('0x7a')][_0x5497('0x44')]({'where':{'id':_0x4c41c4[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x1515f1,null))['then'](function(_0x1ef7fc){var _0x5903b7;if(_0x1ef7fc){_0x5903b7=squel[_0x5497('0x7b')]()[_0x5497('0x5e')](_0x5497('0x5f'))['fromQuery'](['phone',_0x5497('0x61'),_0x5497('0x62'),_0x5497('0x6c'),_0x5497('0x7c'),_0x5497('0x64'),_0x5497('0x65')],squel[_0x5497('0x7d')]()[_0x5497('0x68')]('ANY_VALUE(calleridnum)','phone')['field'](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x7e'),_0x5497('0x7c'))[_0x5497('0x68')](_0x5497('0x69'),'createdAt')['field']('NOW()','updatedAt')['from'](_0x5497('0x6f'))['where'](_0x5497('0x7f'),_0x4c41c4['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4c41c4[_0x5497('0x47')][_0x5497('0x73')][_0x5497('0x71')]())['where'](_0x5497('0x74'))['where'](_0x5497('0x75'),squel[_0x5497('0x7d')]()[_0x5497('0x68')](_0x5497('0x67'))[_0x5497('0x6e')](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]()))['where'](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x76'))['from'](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x5903b7);}return[];})[_0x5497('0x24')](respondWithResult(_0x1515f1,null))[_0x5497('0x40')](handleError(_0x1515f1,null));};exports['checkContactHopper']=function(_0x37c17e,_0x163b5b,_0x3a31be){return db[_0x5497('0x80')][_0x5497('0x81')]({'where':{'VoiceQueueId':_0x37c17e['body'][_0x5497('0x63')],'CampaignId':_0x37c17e[_0x5497('0x47')]['CampaignId'],'ContactId':_0x37c17e['body'][_0x5497('0x62')]}})[_0x5497('0x24')](handleEntityNotFound(_0x163b5b,null))[_0x5497('0x24')](function(_0x14f693){if(_0x14f693){return _0x14f693;}return null;})[_0x5497('0x24')](respondWithResult(_0x163b5b,null))['catch'](handleError(_0x163b5b,null));}; \ No newline at end of file +var _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0xb04f6b,_0x1ade6){var _0x571dcb=function(_0x47f9e1){while(--_0x47f9e1){_0xb04f6b['push'](_0xb04f6b['shift']());}};_0x571dcb(++_0x1ade6);}(_0x4819,0xcd));var _0x9481=function(_0x273fd1,_0x388bbe){_0x273fd1=_0x273fd1-0x0;var _0x5d3dbf=_0x4819[_0x273fd1];return _0x5d3dbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8a4bdac..5395ec4 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 _0x83af=['path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36f52f,_0x4d600c){var _0xbee6b9=function(_0x21d03d){while(--_0x21d03d){_0x36f52f['push'](_0x36f52f['shift']());}};_0xbee6b9(++_0x4d600c);}(_0x83af,0x199));var _0xf83a=function(_0x32ed89,_0x11d953){_0x32ed89=_0x32ed89-0x0;var _0x262961=_0x83af[_0x32ed89];return _0x262961;};'use strict';var _=require(_0xf83a('0x0'));var util=require(_0xf83a('0x1'));var logger=require(_0xf83a('0x2'))(_0xf83a('0x3'));var moment=require(_0xf83a('0x4'));var BPromise=require(_0xf83a('0x5'));var rp=require(_0xf83a('0x6'));var fs=require('fs');var path=require(_0xf83a('0x7'));var rimraf=require(_0xf83a('0x8'));var config=require(_0xf83a('0x9'));var attributes=require('./cmHopperFinal.attributes');module[_0xf83a('0xa')]=function(_0x28bc9f,_0x232fac){return _0x28bc9f[_0xf83a('0xb')](_0xf83a('0xc'),attributes,{'tableName':_0xf83a('0xd'),'paranoid':![],'indexes':[{'name':_0xf83a('0xe'),'fields':[_0xf83a('0xe')]},{'name':_0xf83a('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb31=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xcb31,0xaa));var _0x1cb3=function(_0x3a48bd,_0x40f6cc){_0x3a48bd=_0x3a48bd-0x0;var _0xbe522b=_0xcb31[_0x3a48bd];return _0xbe522b;};'use strict';var _=require(_0x1cb3('0x0'));var util=require(_0x1cb3('0x1'));var logger=require(_0x1cb3('0x2'))(_0x1cb3('0x3'));var moment=require(_0x1cb3('0x4'));var BPromise=require(_0x1cb3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1cb3('0x6'));var config=require(_0x1cb3('0x7'));var attributes=require(_0x1cb3('0x8'));module[_0x1cb3('0x9')]=function(_0x5c8b8b,_0x14a5c0){return _0x5c8b8b[_0x1cb3('0xa')](_0x1cb3('0xb'),attributes,{'tableName':_0x1cb3('0xc'),'paranoid':![],'indexes':[{'name':_0x1cb3('0xd'),'fields':['calleridnum']},{'name':_0x1cb3('0xe'),'fields':[_0x1cb3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index f37d519..6e7ce0a 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(_0x4d2c4a,_0x3c34ab){var _0x58fac6=function(_0x50dc9d){while(--_0x50dc9d){_0x4d2c4a['push'](_0x4d2c4a['shift']());}};_0x58fac6(++_0x3c34ab);}(_0xb10b,0x12a));var _0xbb10=function(_0x221ca3,_0xb25dd3){_0x221ca3=_0x221ca3-0x0;var _0x5974e4=_0xb10b[_0x221ca3];return _0x5974e4;};'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(_0x57d95e,_0x1cd099){var _0x5a78f3=function(_0x4eecae){while(--_0x4eecae){_0x57d95e['push'](_0x57d95e['shift']());}};_0x5a78f3(++_0x1cd099);}(_0x7a54,0x106));var _0x47a5=function(_0x52c1ea,_0x4c21ce){_0x52c1ea=_0x52c1ea-0x0;var _0x341bf9=_0x7a54[_0x52c1ea];return _0x341bf9;};'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 4507b5b..05fedf2 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 _0xa72a=['isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x29fc7d,_0x10ed4f){var _0x56b887=function(_0x4d9141){while(--_0x4d9141){_0x29fc7d['push'](_0x29fc7d['shift']());}};_0x56b887(++_0x10ed4f);}(_0xa72a,0xc8));var _0xaa72=function(_0x40ae18,_0x271674){_0x40ae18=_0x40ae18-0x0;var _0x3a6f2c=_0xa72a[_0x40ae18];return _0x3a6f2c;};'use strict';var multer=require(_0xaa72('0x0'));var util=require('util');var path=require(_0xaa72('0x1'));var timeout=require(_0xaa72('0x2'));var express=require(_0xaa72('0x3'));var router=express['Router']();var fs_extra=require(_0xaa72('0x4'));var auth=require(_0xaa72('0x5'));var interaction=require(_0xaa72('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xaa72('0x7')]('/',auth[_0xaa72('0x8')](),controller['index']);router['get'](_0xaa72('0x9'),auth['isAuthenticated'](),controller[_0xaa72('0xa')]);router[_0xaa72('0x7')](_0xaa72('0xb'),auth['isAuthenticated'](),controller[_0xaa72('0xc')]);router[_0xaa72('0x7')](_0xaa72('0xd'),auth[_0xaa72('0x8')](),controller[_0xaa72('0xe')]);router[_0xaa72('0x7')](_0xaa72('0xf'),auth['isAuthenticated'](),controller[_0xaa72('0x10')]);router['post'](_0xaa72('0x11'),auth['isAuthenticated'](),controller[_0xaa72('0x12')]);router[_0xaa72('0x13')](_0xaa72('0x14'),auth[_0xaa72('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xaa72('0x13')](_0xaa72('0x15'),auth[_0xaa72('0x8')](),controller[_0xaa72('0x16')]);router[_0xaa72('0x17')]('/:id',auth[_0xaa72('0x8')](),controller[_0xaa72('0x18')]);module[_0xaa72('0x19')]=router; \ No newline at end of file +var _0x849a=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x849a,0x1ba));var _0xa849=function(_0x243522,_0x36c4f7){_0x243522=_0x243522-0x0;var _0x5299ac=_0x849a[_0x243522];return _0x5299ac;};'use strict';var multer=require(_0xa849('0x0'));var util=require(_0xa849('0x1'));var path=require(_0xa849('0x2'));var timeout=require(_0xa849('0x3'));var express=require(_0xa849('0x4'));var router=express['Router']();var fs_extra=require(_0xa849('0x5'));var auth=require(_0xa849('0x6'));var interaction=require(_0xa849('0x7'));var config=require(_0xa849('0x8'));var controller=require(_0xa849('0x9'));router[_0xa849('0xa')]('/',auth[_0xa849('0xb')](),controller[_0xa849('0xc')]);router['get'](_0xa849('0xd'),auth['isAuthenticated'](),controller[_0xa849('0xe')]);router[_0xa849('0xa')]('/:id',auth[_0xa849('0xb')](),controller[_0xa849('0xf')]);router[_0xa849('0xa')](_0xa849('0x10'),auth[_0xa849('0xb')](),controller[_0xa849('0x11')]);router[_0xa849('0xa')](_0xa849('0x12'),auth[_0xa849('0xb')](),controller[_0xa849('0x13')]);router[_0xa849('0x14')](_0xa849('0x15'),auth[_0xa849('0xb')](),controller[_0xa849('0x16')]);router[_0xa849('0x14')](_0xa849('0x17'),auth[_0xa849('0xb')](),controller[_0xa849('0x18')]);router[_0xa849('0x14')](_0xa849('0x19'),auth[_0xa849('0xb')](),controller[_0xa849('0x1a')]);router['put'](_0xa849('0x1b'),auth[_0xa849('0xb')](),controller[_0xa849('0x1c')]);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 34cd1ea..8666c52 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 _0x9797=['BOOLEAN','sequelize','exports','INTEGER','DATE','STRING'];(function(_0x4df182,_0x5c8c0d){var _0x4ca05f=function(_0x282410){while(--_0x282410){_0x4df182['push'](_0x4df182['shift']());}};_0x4ca05f(++_0x5c8c0d);}(_0x9797,0x1c9));var _0x7979=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0x9797[_0x4cefc3];return _0x1cc779;};'use strict';var Sequelize=require(_0x7979('0x0'));module[_0x7979('0x1')]={'state':{'type':Sequelize[_0x7979('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7979('0x3')]},'countbusyretry':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x7979('0x4')]},'calleridnum':{'type':Sequelize[_0x7979('0x4')]},'calleridname':{'type':Sequelize[_0x7979('0x4')]},'starttime':{'type':Sequelize[_0x7979('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x7979('0x3')]},'droptime':{'type':Sequelize[_0x7979('0x3')]},'endtime':{'type':Sequelize[_0x7979('0x3')]},'ringtime':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7979('0x4')]},'campaign':{'type':Sequelize[_0x7979('0x4')]},'campaigntype':{'type':Sequelize[_0x7979('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x7979('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7979('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7979('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7979('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7979('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x7979('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7979('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfed6=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x10202c,_0x3127ce){var _0x2c8731=function(_0x4dd5c4){while(--_0x4dd5c4){_0x10202c['push'](_0x10202c['shift']());}};_0x2c8731(++_0x3127ce);}(_0xfed6,0x14a));var _0x6fed=function(_0x404767,_0x318248){_0x404767=_0x404767-0x0;var _0x14ad1b=_0xfed6[_0x404767];return _0x14ad1b;};'use strict';var Sequelize=require(_0x6fed('0x0'));module[_0x6fed('0x1')]={'state':{'type':Sequelize[_0x6fed('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6fed('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6fed('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6fed('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6fed('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6fed('0x3')]},'starttime':{'type':Sequelize[_0x6fed('0x4')]},'responsetime':{'type':Sequelize[_0x6fed('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6fed('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6fed('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6fed('0x3')]},'membername':{'type':Sequelize[_0x6fed('0x3')]},'reason':{'type':Sequelize[_0x6fed('0x3')]},'amd':{'type':Sequelize[_0x6fed('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x6fed('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6fed('0x4')]},'recallme':{'type':Sequelize[_0x6fed('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6fed('0x4')]},'edited':{'type':Sequelize[_0x6fed('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6fed('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6fed('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 34be3ad..63892b7 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 _0xb4d1=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','filters'];(function(_0x424d85,_0x2dfac4){var _0x223bc1=function(_0x29b962){while(--_0x29b962){_0x424d85['push'](_0x424d85['shift']());}};_0x223bc1(++_0x2dfac4);}(_0xb4d1,0xf4));var _0x1b4d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb4d1[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x1b4d('0x0'));var rimraf=require(_0x1b4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b4d('0x2'));var rp=require(_0x1b4d('0x3'));var moment=require(_0x1b4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1b4d('0x5'));var util=require(_0x1b4d('0x6'));var path=require(_0x1b4d('0x7'));var sox=require(_0x1b4d('0x8'));var csv=require('to-csv');var ejs=require(_0x1b4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b4d('0xa'));var squel=require(_0x1b4d('0xb'));var crypto=require(_0x1b4d('0xc'));var jsforce=require(_0x1b4d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1b4d('0xe'));var querystring=require(_0x1b4d('0xf'));var Papa=require(_0x1b4d('0x10'));var Redis=require(_0x1b4d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1b4d('0x12'));var as=require(_0x1b4d('0x13'));var hardwareService=require(_0x1b4d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1b4d('0x15'));var config=require(_0x1b4d('0x16'));var licenseUtil=require(_0x1b4d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369227,_0x50638f){_0x50638f=_0x50638f||0xcc;return function(_0x405f14){if(_0x405f14){return _0x369227[_0x1b4d('0x18')](_0x50638f);}return _0x369227['status'](_0x50638f)[_0x1b4d('0x19')]();};}function respondWithResult(_0x353eee,_0x231dcc){_0x231dcc=_0x231dcc||0xc8;return function(_0x1c66ea){if(_0x1c66ea){return _0x353eee[_0x1b4d('0x1a')](_0x231dcc)[_0x1b4d('0x1b')](_0x1c66ea);}};}function respondWithFilteredResult(_0x8a1a4b,_0x2135d4){return function(_0xcaebd2){if(_0xcaebd2){var _0x5d27a2=typeof _0x2135d4[_0x1b4d('0x1c')]===_0x1b4d('0x1d')&&typeof _0x2135d4['limit']===_0x1b4d('0x1d');var _0x417e5d=_0xcaebd2['count'];var _0x28d186=_0x5d27a2?0x0:_0x2135d4['offset'];var _0x1da7ea=_0x5d27a2?_0xcaebd2[_0x1b4d('0x1e')]:_0x2135d4[_0x1b4d('0x1c')]+_0x2135d4[_0x1b4d('0x1f')];var _0x1a7ba4;if(_0x1da7ea>=_0x417e5d){_0x1da7ea=_0x417e5d;_0x1a7ba4=0xc8;}else{_0x1a7ba4=0xce;}_0x8a1a4b['status'](_0x1a7ba4);return _0x8a1a4b['set'](_0x1b4d('0x20'),_0x28d186+'-'+_0x1da7ea+'/'+_0x417e5d)[_0x1b4d('0x1b')](_0xcaebd2);}return null;};}function patchUpdates(_0x268b1a){return function(_0x2264d3){try{jsonpatch[_0x1b4d('0x21')](_0x2264d3,_0x268b1a,!![]);}catch(_0x51ada8){return BPromise[_0x1b4d('0x22')](_0x51ada8);}return _0x2264d3[_0x1b4d('0x23')]();};}function saveUpdates(_0xde2c30,_0x503196){return function(_0x5b7f3a){if(_0x5b7f3a){return _0x5b7f3a[_0x1b4d('0x24')](_0xde2c30)[_0x1b4d('0x25')](function(_0x46f45e){return _0x46f45e;});}return null;};}function removeEntity(_0xdc8af1,_0x2ebd43){return function(_0x32c550){if(_0x32c550){return _0x32c550[_0x1b4d('0x26')]()[_0x1b4d('0x25')](function(){_0xdc8af1['status'](0xcc)[_0x1b4d('0x19')]();});}};}function handleEntityNotFound(_0x45ef3e,_0x2fd0dd){return function(_0x2d3205){if(!_0x2d3205){_0x45ef3e[_0x1b4d('0x18')](0x194);}return _0x2d3205;};}function handleError(_0x21e54c,_0x1f3840){_0x1f3840=_0x1f3840||0x1f4;return function(_0x2261f2){logger[_0x1b4d('0x27')](_0x2261f2[_0x1b4d('0x28')]);if(_0x2261f2[_0x1b4d('0x29')]){delete _0x2261f2[_0x1b4d('0x29')];}_0x21e54c['status'](_0x1f3840)[_0x1b4d('0x2a')](_0x2261f2);};}exports[_0x1b4d('0x2b')]=function(_0x4b36fe,_0x584cbc){var _0xed0c70={},_0x4daf8a={},_0x3a3e0e={'count':0x0,'rows':[]};var _0x2b60a2=_[_0x1b4d('0x2c')](db[_0x1b4d('0x2d')][_0x1b4d('0x2e')],function(_0x413594){return{'name':_0x413594['fieldName'],'type':_0x413594[_0x1b4d('0x2f')][_0x1b4d('0x30')]};});_0x4daf8a[_0x1b4d('0x31')]=_[_0x1b4d('0x2c')](_0x2b60a2,'name');_0x4daf8a['query']=_[_0x1b4d('0x32')](_0x4b36fe['query']);_0x4daf8a['filters']=_[_0x1b4d('0x33')](_0x4daf8a[_0x1b4d('0x31')],_0x4daf8a[_0x1b4d('0x34')]);_0xed0c70[_0x1b4d('0x35')]=_[_0x1b4d('0x33')](_0x4daf8a['model'],qs[_0x1b4d('0x36')](_0x4b36fe[_0x1b4d('0x34')]['fields']));_0xed0c70['attributes']=_0xed0c70[_0x1b4d('0x35')]['length']?_0xed0c70[_0x1b4d('0x35')]:_0x4daf8a[_0x1b4d('0x31')];if(!_0x4b36fe[_0x1b4d('0x34')][_0x1b4d('0x37')](_0x1b4d('0x38'))){_0xed0c70[_0x1b4d('0x1f')]=qs[_0x1b4d('0x1f')](_0x4b36fe[_0x1b4d('0x34')][_0x1b4d('0x1f')]);_0xed0c70['offset']=qs[_0x1b4d('0x1c')](_0x4b36fe['query'][_0x1b4d('0x1c')]);}_0xed0c70[_0x1b4d('0x39')]=qs['sort'](_0x4b36fe[_0x1b4d('0x34')]['sort']);_0xed0c70[_0x1b4d('0x3a')]=qs[_0x1b4d('0x3b')](_[_0x1b4d('0x3c')](_0x4b36fe['query'],_0x4daf8a[_0x1b4d('0x3b')]),_0x2b60a2);if(_0x4b36fe[_0x1b4d('0x34')][_0x1b4d('0x3d')]){_0xed0c70[_0x1b4d('0x3a')]=_[_0x1b4d('0x3e')](_0xed0c70[_0x1b4d('0x3a')],{'$or':_[_0x1b4d('0x2c')](_0x2b60a2,function(_0x6eb206){if(_0x6eb206[_0x1b4d('0x2f')]!==_0x1b4d('0x3f')){var _0x469533={};_0x469533[_0x6eb206['name']]={'$like':'%'+_0x4b36fe[_0x1b4d('0x34')]['filter']+'%'};return _0x469533;}})});}_0xed0c70=_[_0x1b4d('0x3e')]({},_0xed0c70,_0x4b36fe[_0x1b4d('0x40')]);var _0x18a929={'where':_0xed0c70[_0x1b4d('0x3a')]};return db[_0x1b4d('0x2d')][_0x1b4d('0x1e')](_0x18a929)['then'](function(_0x3db176){_0x3a3e0e[_0x1b4d('0x1e')]=_0x3db176;if(_0x4b36fe[_0x1b4d('0x34')][_0x1b4d('0x41')]){_0xed0c70['include']=[{'all':!![]}];}return db[_0x1b4d('0x2d')][_0x1b4d('0x42')](_0xed0c70);})['then'](function(_0x55bdc0){_0x3a3e0e[_0x1b4d('0x43')]=_0x55bdc0;return _0x3a3e0e;})['then'](respondWithFilteredResult(_0x584cbc,_0xed0c70))[_0x1b4d('0x44')](handleError(_0x584cbc,null));};exports['show']=function(_0x40e31e,_0x15567a){var _0x592724={'raw':!![],'where':{'id':_0x40e31e[_0x1b4d('0x45')]['id']}},_0x4b2715={};_0x4b2715[_0x1b4d('0x31')]=_[_0x1b4d('0x32')](db[_0x1b4d('0x2d')][_0x1b4d('0x2e')]);_0x4b2715[_0x1b4d('0x34')]=_[_0x1b4d('0x32')](_0x40e31e[_0x1b4d('0x34')]);_0x4b2715[_0x1b4d('0x3b')]=_[_0x1b4d('0x33')](_0x4b2715[_0x1b4d('0x31')],_0x4b2715[_0x1b4d('0x34')]);_0x592724[_0x1b4d('0x35')]=_['intersection'](_0x4b2715[_0x1b4d('0x31')],qs['fields'](_0x40e31e[_0x1b4d('0x34')]['fields']));_0x592724[_0x1b4d('0x35')]=_0x592724[_0x1b4d('0x35')]['length']?_0x592724['attributes']:_0x4b2715['model'];if(_0x40e31e[_0x1b4d('0x34')]['includeAll']){_0x592724[_0x1b4d('0x46')]=[{'all':!![]}];}_0x592724=_[_0x1b4d('0x3e')]({},_0x592724,_0x40e31e[_0x1b4d('0x40')]);return db[_0x1b4d('0x2d')][_0x1b4d('0x47')](_0x592724)[_0x1b4d('0x25')](handleEntityNotFound(_0x15567a,null))[_0x1b4d('0x25')](respondWithResult(_0x15567a,null))[_0x1b4d('0x44')](handleError(_0x15567a,null));};exports[_0x1b4d('0x48')]=function(_0x264af9,_0x4093ff){return db[_0x1b4d('0x2d')][_0x1b4d('0x48')](_0x264af9['body'],{})[_0x1b4d('0x25')](respondWithResult(_0x4093ff,0xc9))[_0x1b4d('0x44')](handleError(_0x4093ff,null));};exports[_0x1b4d('0x49')]=function(_0x14d90c,_0x5bc8e4){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x5bc8e4,null))[_0x1b4d('0x44')](handleError(_0x5bc8e4,null));};exports[_0x1b4d('0x24')]=function(_0x5f1b4b,_0x391b7a){if(_0x5f1b4b[_0x1b4d('0x4a')]['uniqueid']){delete _0x5f1b4b[_0x1b4d('0x4a')][_0x1b4d('0x4b')];}return db['CmHopperHistory'][_0x1b4d('0x47')]({'where':{'uniqueid':_0x5f1b4b[_0x1b4d('0x45')]['id']}})[_0x1b4d('0x25')](handleEntityNotFound(_0x391b7a,null))[_0x1b4d('0x25')](saveUpdates(_0x5f1b4b[_0x1b4d('0x4a')],null))['then'](respondWithResult(_0x391b7a,null))['catch'](handleError(_0x391b7a,null));}; \ No newline at end of file +var _0x0353=['key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','describe','update','uniqueid','body','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','reject','save','then','destroy','error','stack','name','send','CmHopperHistory','rawAttributes','fieldName'];(function(_0x205e26,_0x387734){var _0x260777=function(_0x11bc6a){while(--_0x11bc6a){_0x205e26['push'](_0x205e26['shift']());}};_0x260777(++_0x387734);}(_0x0353,0x188));var _0x3035=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x0353[_0x421196];return _0x2738af;};'use strict';var emlformat=require(_0x3035('0x0'));var rimraf=require(_0x3035('0x1'));var zipdir=require(_0x3035('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3035('0x3'));var util=require(_0x3035('0x4'));var path=require(_0x3035('0x5'));var sox=require(_0x3035('0x6'));var csv=require(_0x3035('0x7'));var ejs=require(_0x3035('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3035('0x9'));var squel=require(_0x3035('0xa'));var crypto=require(_0x3035('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3035('0xc'));var toCsv=require(_0x3035('0x7'));var querystring=require(_0x3035('0xd'));var Papa=require('papaparse');var Redis=require(_0x3035('0xe'));var authService=require(_0x3035('0xf'));var qs=require(_0x3035('0x10'));var as=require(_0x3035('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3035('0x12'))('api');var utils=require(_0x3035('0x13'));var config=require(_0x3035('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3035('0x15'))['db'];function respondWithStatusCode(_0x32be64,_0xaed09c){_0xaed09c=_0xaed09c||0xcc;return function(_0x509dd7){if(_0x509dd7){return _0x32be64['sendStatus'](_0xaed09c);}return _0x32be64['status'](_0xaed09c)[_0x3035('0x16')]();};}function respondWithResult(_0x2dcb2c,_0x288a4a){_0x288a4a=_0x288a4a||0xc8;return function(_0x3e306a){if(_0x3e306a){return _0x2dcb2c[_0x3035('0x17')](_0x288a4a)[_0x3035('0x18')](_0x3e306a);}};}function respondWithFilteredResult(_0x39202b,_0x518ec0){return function(_0x3b4453){if(_0x3b4453){var _0x22188d=typeof _0x518ec0[_0x3035('0x19')]===_0x3035('0x1a')&&typeof _0x518ec0[_0x3035('0x1b')]===_0x3035('0x1a');var _0x525a0f=_0x3b4453[_0x3035('0x1c')];var _0x1368cf=_0x22188d?0x0:_0x518ec0[_0x3035('0x19')];var _0x56b2e4=_0x22188d?_0x3b4453[_0x3035('0x1c')]:_0x518ec0['offset']+_0x518ec0[_0x3035('0x1b')];var _0x21970f;if(_0x56b2e4>=_0x525a0f){_0x56b2e4=_0x525a0f;_0x21970f=0xc8;}else{_0x21970f=0xce;}_0x39202b[_0x3035('0x17')](_0x21970f);return _0x39202b['set']('Content-Range',_0x1368cf+'-'+_0x56b2e4+'/'+_0x525a0f)[_0x3035('0x18')](_0x3b4453);}return null;};}function patchUpdates(_0x591bca){return function(_0x3a766b){try{jsonpatch['apply'](_0x3a766b,_0x591bca,!![]);}catch(_0x374110){return BPromise[_0x3035('0x1d')](_0x374110);}return _0x3a766b[_0x3035('0x1e')]();};}function saveUpdates(_0xb8617d,_0x4a2a41){return function(_0x4e32ae){if(_0x4e32ae){return _0x4e32ae['update'](_0xb8617d)[_0x3035('0x1f')](function(_0x57ea2d){return _0x57ea2d;});}return null;};}function removeEntity(_0x588747,_0x4585a9){return function(_0x12fb32){if(_0x12fb32){return _0x12fb32[_0x3035('0x20')]()[_0x3035('0x1f')](function(){_0x588747[_0x3035('0x17')](0xcc)[_0x3035('0x16')]();});}};}function handleEntityNotFound(_0x2968f4,_0x1fe4ac){return function(_0x397e23){if(!_0x397e23){_0x2968f4['sendStatus'](0x194);}return _0x397e23;};}function handleError(_0x5b1d23,_0x214f15){_0x214f15=_0x214f15||0x1f4;return function(_0x47a336){logger[_0x3035('0x21')](_0x47a336[_0x3035('0x22')]);if(_0x47a336[_0x3035('0x23')]){delete _0x47a336[_0x3035('0x23')];}_0x5b1d23[_0x3035('0x17')](_0x214f15)[_0x3035('0x24')](_0x47a336);};}exports['index']=function(_0x70e487,_0x39cb6c){var _0x515600={},_0x41eda2={},_0x3a794a={'count':0x0,'rows':[]};var _0x2ef755=_['map'](db[_0x3035('0x25')][_0x3035('0x26')],function(_0x42b687){return{'name':_0x42b687[_0x3035('0x27')],'type':_0x42b687['type'][_0x3035('0x28')]};});_0x41eda2[_0x3035('0x29')]=_['map'](_0x2ef755,'name');_0x41eda2[_0x3035('0x2a')]=_['keys'](_0x70e487['query']);_0x41eda2[_0x3035('0x2b')]=_[_0x3035('0x2c')](_0x41eda2[_0x3035('0x29')],_0x41eda2[_0x3035('0x2a')]);_0x515600['attributes']=_[_0x3035('0x2c')](_0x41eda2[_0x3035('0x29')],qs['fields'](_0x70e487[_0x3035('0x2a')]['fields']));_0x515600[_0x3035('0x2d')]=_0x515600['attributes'][_0x3035('0x2e')]?_0x515600[_0x3035('0x2d')]:_0x41eda2[_0x3035('0x29')];if(!_0x70e487[_0x3035('0x2a')][_0x3035('0x2f')]('nolimit')){_0x515600[_0x3035('0x1b')]=qs[_0x3035('0x1b')](_0x70e487[_0x3035('0x2a')][_0x3035('0x1b')]);_0x515600['offset']=qs[_0x3035('0x19')](_0x70e487[_0x3035('0x2a')][_0x3035('0x19')]);}_0x515600[_0x3035('0x30')]=qs[_0x3035('0x31')](_0x70e487['query'][_0x3035('0x31')]);_0x515600[_0x3035('0x32')]=qs[_0x3035('0x2b')](_[_0x3035('0x33')](_0x70e487[_0x3035('0x2a')],_0x41eda2[_0x3035('0x2b')]),_0x2ef755);if(_0x70e487['query'][_0x3035('0x34')]){_0x515600[_0x3035('0x32')]=_[_0x3035('0x35')](_0x515600[_0x3035('0x32')],{'$or':_[_0x3035('0x36')](_0x2ef755,function(_0x28fe04){if(_0x28fe04[_0x3035('0x37')]!==_0x3035('0x38')){var _0x36b8b7={};_0x36b8b7[_0x28fe04[_0x3035('0x23')]]={'$like':'%'+_0x70e487[_0x3035('0x2a')][_0x3035('0x34')]+'%'};return _0x36b8b7;}})});}_0x515600=_[_0x3035('0x35')]({},_0x515600,_0x70e487['options']);var _0x1d1b74={'where':_0x515600[_0x3035('0x32')]};return db[_0x3035('0x25')][_0x3035('0x1c')](_0x1d1b74)[_0x3035('0x1f')](function(_0x51dc16){_0x3a794a[_0x3035('0x1c')]=_0x51dc16;if(_0x70e487[_0x3035('0x2a')][_0x3035('0x39')]){_0x515600[_0x3035('0x3a')]=[{'all':!![]}];}return db[_0x3035('0x25')][_0x3035('0x3b')](_0x515600);})['then'](function(_0x4ae53e){_0x3a794a[_0x3035('0x3c')]=_0x4ae53e;return _0x3a794a;})[_0x3035('0x1f')](respondWithFilteredResult(_0x39cb6c,_0x515600))[_0x3035('0x3d')](handleError(_0x39cb6c,null));};exports[_0x3035('0x3e')]=function(_0x1f7225,_0x4cb7b0){var _0x232fa2={'raw':!![],'where':{'id':_0x1f7225[_0x3035('0x3f')]['id']}},_0xd194c8={};_0xd194c8[_0x3035('0x29')]=_['keys'](db['CmHopperHistory'][_0x3035('0x26')]);_0xd194c8[_0x3035('0x2a')]=_[_0x3035('0x40')](_0x1f7225[_0x3035('0x2a')]);_0xd194c8[_0x3035('0x2b')]=_['intersection'](_0xd194c8[_0x3035('0x29')],_0xd194c8['query']);_0x232fa2[_0x3035('0x2d')]=_[_0x3035('0x2c')](_0xd194c8['model'],qs[_0x3035('0x41')](_0x1f7225[_0x3035('0x2a')][_0x3035('0x41')]));_0x232fa2['attributes']=_0x232fa2[_0x3035('0x2d')][_0x3035('0x2e')]?_0x232fa2[_0x3035('0x2d')]:_0xd194c8[_0x3035('0x29')];if(_0x1f7225['query'][_0x3035('0x39')]){_0x232fa2['include']=[{'all':!![]}];}_0x232fa2=_[_0x3035('0x35')]({},_0x232fa2,_0x1f7225['options']);return db[_0x3035('0x25')][_0x3035('0x42')](_0x232fa2)[_0x3035('0x1f')](handleEntityNotFound(_0x4cb7b0,null))[_0x3035('0x1f')](respondWithResult(_0x4cb7b0,null))['catch'](handleError(_0x4cb7b0,null));};exports['create']=function(_0x3f13f8,_0x52e6ac){return db[_0x3035('0x25')][_0x3035('0x43')](_0x3f13f8['body'],{})['then'](respondWithResult(_0x52e6ac,0xc9))[_0x3035('0x3d')](handleError(_0x52e6ac,null));};exports[_0x3035('0x44')]=function(_0x27139f,_0x2dd686){return db['CmHopperHistory'][_0x3035('0x44')]()['then'](respondWithResult(_0x2dd686,null))[_0x3035('0x3d')](handleError(_0x2dd686,null));};exports[_0x3035('0x45')]=function(_0x436aec,_0x27d79b){if(_0x436aec['body'][_0x3035('0x46')]){delete _0x436aec[_0x3035('0x47')][_0x3035('0x46')];}return db[_0x3035('0x25')]['find']({'where':{'uniqueid':_0x436aec[_0x3035('0x3f')]['id']}})[_0x3035('0x1f')](handleEntityNotFound(_0x27d79b,null))['then'](saveUpdates(_0x436aec[_0x3035('0x47')],null))[_0x3035('0x1f')](respondWithResult(_0x27d79b,null))['catch'](handleError(_0x27d79b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 574c567..7487f58 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 _0x5d4e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x1c9e1d,_0x17a946){var _0x8199cd=function(_0x563f0b){while(--_0x563f0b){_0x1c9e1d['push'](_0x1c9e1d['shift']());}};_0x8199cd(++_0x17a946);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe5d4('0x0'));var logger=require(_0xe5d4('0x1'))(_0xe5d4('0x2'));var moment=require(_0xe5d4('0x3'));var BPromise=require(_0xe5d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5d4('0x5'));var rimraf=require(_0xe5d4('0x6'));var config=require(_0xe5d4('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xe5d4('0x8')]=function(_0x518138,_0x59cfd9){return _0x518138['define'](_0xe5d4('0x9'),attributes,{'tableName':_0xe5d4('0xa'),'paranoid':![],'indexes':[{'name':_0xe5d4('0xb'),'fields':[_0xe5d4('0xb')]},{'name':_0xe5d4('0xc'),'fields':[_0xe5d4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69d4=['uniqueid','lodash','util','api','moment','bluebird','path','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x69d4,0x83));var _0x469d=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x69d4[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var logger=require('../../config/logger')(_0x469d('0x2'));var moment=require(_0x469d('0x3'));var BPromise=require(_0x469d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x469d('0x5'));var rimraf=require('rimraf');var config=require(_0x469d('0x6'));var attributes=require(_0x469d('0x7'));module[_0x469d('0x8')]=function(_0x336101,_0x3d0ec8){return _0x336101[_0x469d('0x9')]('CmHopperHistory',attributes,{'tableName':_0x469d('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x469d('0xb')]},{'name':_0x469d('0xc'),'fields':[_0x469d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index acb0f6e..a75a544 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 _0x9189=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','name','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','result','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal'];(function(_0x1c57f2,_0x1e0788){var _0x3c06cb=function(_0x2620a0){while(--_0x2620a0){_0x1c57f2['push'](_0x1c57f2['shift']());}};_0x3c06cb(++_0x1e0788);}(_0x9189,0x1b0));var _0x9918=function(_0x1b33d9,_0x5c7527){_0x1b33d9=_0x1b33d9-0x0;var _0x44b63f=_0x9189[_0x1b33d9];return _0x44b63f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9918('0x0'));var BPromise=require(_0x9918('0x1'));var rs=require(_0x9918('0x2'));var fs=require('fs');var Redis=require(_0x9918('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9918('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9918('0x5'));var jayson=require(_0x9918('0x6'));var client=jayson['client'][_0x9918('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cb556,_0x7b8770,_0x5c926e){return new BPromise(function(_0x5a0552,_0x50a534){return client[_0x9918('0x8')](_0x3cb556,_0x5c926e)[_0x9918('0x9')](function(_0x553c75){logger[_0x9918('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x7b8770,_0x9918('0xb'));logger[_0x9918('0xc')](_0x9918('0xd'),_0x7b8770,_0x9918('0xb'),JSON[_0x9918('0xe')](_0x553c75));if(_0x553c75[_0x9918('0xf')]){if(_0x553c75[_0x9918('0xf')]['code']===0x1f4){logger[_0x9918('0xf')](_0x9918('0x10'),_0x7b8770,_0x553c75['error']['message']);return _0x50a534(_0x553c75[_0x9918('0xf')]['message']);}logger['error'](_0x9918('0x10'),_0x7b8770,_0x553c75[_0x9918('0xf')]['message']);return _0x5a0552(_0x553c75[_0x9918('0xf')]['message']);}else{logger[_0x9918('0xa')](_0x9918('0x10'),_0x7b8770,_0x9918('0xb'));_0x5a0552(_0x553c75[_0x9918('0x11')][_0x9918('0x12')]);}})[_0x9918('0x13')](function(_0x1a676f){logger[_0x9918('0xf')](_0x9918('0x10'),_0x7b8770,_0x1a676f);_0x50a534(_0x1a676f);});});}exports[_0x9918('0x14')]=function(_0x45f368){var _0x2a915c=this;return new Promise(function(_0x1a9452,_0x132c22){return db[_0x9918('0x15')][_0x9918('0x16')](_0x45f368[_0x9918('0x17')],{'raw':_0x45f368[_0x9918('0x18')]?_0x45f368[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![]})[_0x9918('0x9')](function(_0x20be15){logger[_0x9918('0xa')](_0x9918('0x14'),_0x45f368);logger[_0x9918('0xc')](_0x9918('0x14'),_0x45f368,JSON['stringify'](_0x20be15));_0x1a9452(_0x20be15);})[_0x9918('0x13')](function(_0x1f0bca){logger[_0x9918('0xf')]('CreateCmHopperHistory',_0x1f0bca[_0x9918('0x12')],_0x45f368);_0x132c22(_0x2a915c[_0x9918('0xf')](0x1f4,_0x1f0bca[_0x9918('0x12')]));});});};exports[_0x9918('0x1a')]=function(_0x44691e){var _0x19f897=this;return new Promise(function(_0x1bd2cd,_0x216cc1){return db[_0x9918('0x15')][_0x9918('0x1b')]({'raw':_0x44691e[_0x9918('0x18')]?_0x44691e[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![],'where':_0x44691e['options']?_0x44691e[_0x9918('0x18')][_0x9918('0x1c')]||null:null,'attributes':[[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')][_0x9918('0x1f')]('id')),_0x9918('0x20')],[db[_0x9918('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9918('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9918('0x21')],[db['sequelize']['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x9918('0x22')))),_0x9918('0x23')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x25')))),_0x9918('0x26')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x27'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')]['literal'](_0x9918('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x9918('0x1d')]['fn'](_0x9918('0x27'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x29')))),_0x9918('0x2a')]]})[_0x9918('0x9')](function(_0x287459){logger['info'](_0x9918('0x1a'),_0x44691e);logger[_0x9918('0xc')](_0x9918('0x1a'),_0x44691e,JSON[_0x9918('0xe')](_0x287459));_0x1bd2cd(_0x287459);})[_0x9918('0x13')](function(_0x24e0f9){logger[_0x9918('0xf')](_0x9918('0x1a'),_0x24e0f9['message'],_0x44691e);_0x216cc1(_0x19f897['error'](0x1f4,_0x24e0f9[_0x9918('0x12')]));});});};exports[_0x9918('0x2b')]=function(_0x27ffb6){var _0xa43337=this;return new Promise(function(_0x58971e,_0x44e397){return db['CmHopperHistory'][_0x9918('0x1b')]({'raw':_0x27ffb6[_0x9918('0x18')]?_0x27ffb6[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![],'where':_0x27ffb6['options']?_0x27ffb6['options'][_0x9918('0x1c')]||null:null,'attributes':[[_0x9918('0x2c'),'name'],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x9918('0x2d')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x9918('0x2e')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x2f')))),_0x9918('0x30')],[db[_0x9918('0x1d')]['fn']('COUNT',db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0x9918('0x31')],[db[_0x9918('0x1d')]['fn']('COUNT',db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x32')))),_0x9918('0x33')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9918('0x35')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x36')))),_0x9918('0x37')],[db['sequelize']['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x9918('0x38')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x9918('0x39')],[db['sequelize']['fn']('COUNT',db[_0x9918('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x9918('0x3a')))),_0x9918('0x3b')],[db[_0x9918('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x9918('0x24')](_0x9918('0x3c')))),_0x9918('0x3d')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')]['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x3e')))),_0x9918('0x3b')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x3f')))),'outboundReCallsDay']],'group':[_0x9918('0x2c')]})[_0x9918('0x9')](function(_0x458c00){logger[_0x9918('0xa')](_0x9918('0x2b'),_0x27ffb6);logger[_0x9918('0xc')](_0x9918('0x2b'),_0x27ffb6,JSON['stringify'](_0x458c00));_0x58971e(_0x458c00);})['catch'](function(_0x30cde2){logger[_0x9918('0xf')]('GetVoiceQueueHopperHistory',_0x30cde2[_0x9918('0x12')],_0x27ffb6);_0x44e397(_0xa43337[_0x9918('0xf')](0x1f4,_0x30cde2[_0x9918('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x390d56){var _0x1ec4f0=this;return new Promise(function(_0x22b1b0,_0x16b75c){return db['CmHopperHistory'][_0x9918('0x1b')]({'raw':_0x390d56[_0x9918('0x18')]?_0x390d56[_0x9918('0x18')][_0x9918('0x19')]===undefined?!![]:![]:!![],'where':_0x390d56[_0x9918('0x18')]?_0x390d56[_0x9918('0x18')][_0x9918('0x1c')]||null:null,'attributes':[[_0x9918('0x2c'),_0x9918('0x40')],[db[_0x9918('0x1d')]['fn'](_0x9918('0x1e'),db[_0x9918('0x1d')][_0x9918('0x1f')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x9918('0x1e'),db['sequelize']['fn']('IF',db[_0x9918('0x1d')][_0x9918('0x24')](_0x9918('0x2f')))),_0x9918('0x41')]],'group':['campaign']})[_0x9918('0x9')](function(_0x23a6be){logger[_0x9918('0xa')]('GetCampaignHopperHistory',_0x390d56);logger[_0x9918('0xc')]('GetCampaignHopperHistory',_0x390d56,JSON[_0x9918('0xe')](_0x23a6be));_0x22b1b0(_0x23a6be);})['catch'](function(_0x48c79e){logger[_0x9918('0xf')](_0x9918('0x42'),_0x48c79e[_0x9918('0x12')],_0x390d56);_0x16b75c(_0x1ec4f0[_0x9918('0xf')](0x1f4,_0x48c79e[_0x9918('0x12')]));});});}; \ No newline at end of file +var _0x6836=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null'];(function(_0x24ea0d,_0x220ee4){var _0x37dd84=function(_0x17d34e){while(--_0x17d34e){_0x24ea0d['push'](_0x24ea0d['shift']());}};_0x37dd84(++_0x220ee4);}(_0x6836,0x1c0));var _0x6683=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6836[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var moment=require(_0x6683('0x2'));var BPromise=require('bluebird');var rs=require(_0x6683('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6683('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6683('0x5'))('rpc');var config=require(_0x6683('0x6'));var jayson=require(_0x6683('0x7'));var client=jayson[_0x6683('0x8')][_0x6683('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d2235,_0xb31219,_0x2c7cb0){return new BPromise(function(_0x3d5224,_0x4673ea){return client[_0x6683('0xa')](_0x4d2235,_0x2c7cb0)[_0x6683('0xb')](function(_0x5ccb97){logger['info'](_0x6683('0xc'),_0xb31219,_0x6683('0xd'));logger[_0x6683('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb31219,_0x6683('0xd'),JSON['stringify'](_0x5ccb97));if(_0x5ccb97[_0x6683('0xf')]){if(_0x5ccb97[_0x6683('0xf')][_0x6683('0x10')]===0x1f4){logger[_0x6683('0xf')](_0x6683('0xc'),_0xb31219,_0x5ccb97[_0x6683('0xf')][_0x6683('0x11')]);return _0x4673ea(_0x5ccb97[_0x6683('0xf')]['message']);}logger[_0x6683('0xf')](_0x6683('0xc'),_0xb31219,_0x5ccb97[_0x6683('0xf')][_0x6683('0x11')]);return _0x3d5224(_0x5ccb97[_0x6683('0xf')]['message']);}else{logger[_0x6683('0x12')](_0x6683('0xc'),_0xb31219,_0x6683('0xd'));_0x3d5224(_0x5ccb97[_0x6683('0x13')][_0x6683('0x11')]);}})[_0x6683('0x14')](function(_0x286695){logger[_0x6683('0xf')](_0x6683('0xc'),_0xb31219,_0x286695);_0x4673ea(_0x286695);});});}exports[_0x6683('0x15')]=function(_0x4cad41){var _0x3afbec=this;return new Promise(function(_0x1be466,_0x1b5f32){return db[_0x6683('0x16')]['create'](_0x4cad41[_0x6683('0x17')],{'raw':_0x4cad41[_0x6683('0x18')]?_0x4cad41[_0x6683('0x18')][_0x6683('0x19')]===undefined?!![]:![]:!![]})[_0x6683('0xb')](function(_0x2d3775){logger[_0x6683('0x12')](_0x6683('0x15'),_0x4cad41);logger[_0x6683('0xe')](_0x6683('0x15'),_0x4cad41,JSON[_0x6683('0x1a')](_0x2d3775));_0x1be466(_0x2d3775);})[_0x6683('0x14')](function(_0x34680f){logger[_0x6683('0xf')](_0x6683('0x15'),_0x34680f[_0x6683('0x11')],_0x4cad41);_0x1b5f32(_0x3afbec['error'](0x1f4,_0x34680f[_0x6683('0x11')]));});});};exports[_0x6683('0x1b')]=function(_0x49c1ce){var _0x3250e5=this;return new Promise(function(_0x4579d9,_0x457b3c){return db['CmHopperHistory'][_0x6683('0x1c')]({'raw':_0x49c1ce[_0x6683('0x18')]?_0x49c1ce[_0x6683('0x18')][_0x6683('0x19')]===undefined?!![]:![]:!![],'where':_0x49c1ce['options']?_0x49c1ce[_0x6683('0x18')][_0x6683('0x1d')]||null:null,'attributes':[[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize'][_0x6683('0x20')]('id')),_0x6683('0x21')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x23')))),_0x6683('0x24')],[db['sequelize']['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6683('0x1e')]['fn']('COUNT',db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x6683('0x1e')]['fn'](_0x6683('0x27'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x28')))),_0x6683('0x29')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x27'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x2a')))),_0x6683('0x2b')]]})[_0x6683('0xb')](function(_0x4d58ef){logger[_0x6683('0x12')]('AvgHandleTime',_0x49c1ce);logger['debug'](_0x6683('0x1b'),_0x49c1ce,JSON[_0x6683('0x1a')](_0x4d58ef));_0x4579d9(_0x4d58ef);})[_0x6683('0x14')](function(_0x31e0a7){logger[_0x6683('0xf')](_0x6683('0x1b'),_0x31e0a7[_0x6683('0x11')],_0x49c1ce);_0x457b3c(_0x3250e5[_0x6683('0xf')](0x1f4,_0x31e0a7['message']));});});};exports[_0x6683('0x2c')]=function(_0x3161c9){var _0x27ff1e=this;return new Promise(function(_0x50e98c,_0x4f572b){return db[_0x6683('0x16')]['findAll']({'raw':_0x3161c9[_0x6683('0x18')]?_0x3161c9[_0x6683('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3161c9[_0x6683('0x18')]?_0x3161c9[_0x6683('0x18')][_0x6683('0x1d')]||null:null,'attributes':[[_0x6683('0x2d'),_0x6683('0x2e')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x2f')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x30')))),_0x6683('0x31')],[db['sequelize']['fn']('COUNT',db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x23')))),_0x6683('0x32')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x6683('0x33')],[db[_0x6683('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x34')))),_0x6683('0x35')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x36')))),_0x6683('0x37')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x38')))),_0x6683('0x39')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x3a')))),_0x6683('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x3e')))),_0x6683('0x3f')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x40')))),_0x6683('0x41')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x42')))),_0x6683('0x3f')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x43')))),_0x6683('0x44')]],'group':[_0x6683('0x2d')]})[_0x6683('0xb')](function(_0x41d082){logger[_0x6683('0x12')](_0x6683('0x2c'),_0x3161c9);logger['debug'](_0x6683('0x2c'),_0x3161c9,JSON['stringify'](_0x41d082));_0x50e98c(_0x41d082);})[_0x6683('0x14')](function(_0x5e66e3){logger[_0x6683('0xf')](_0x6683('0x2c'),_0x5e66e3['message'],_0x3161c9);_0x4f572b(_0x27ff1e[_0x6683('0xf')](0x1f4,_0x5e66e3[_0x6683('0x11')]));});});};exports[_0x6683('0x45')]=function(_0x15cddc){var _0x347522=this;return new Promise(function(_0x40bcc8,_0x45499e){return db[_0x6683('0x16')][_0x6683('0x1c')]({'raw':_0x15cddc['options']?_0x15cddc[_0x6683('0x18')][_0x6683('0x19')]===undefined?!![]:![]:!![],'where':_0x15cddc[_0x6683('0x18')]?_0x15cddc[_0x6683('0x18')][_0x6683('0x1d')]||null:null,'attributes':[[_0x6683('0x2d'),_0x6683('0x2e')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')][_0x6683('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x23')))),_0x6683('0x46')]],'group':[_0x6683('0x2d')]})[_0x6683('0xb')](function(_0x44b050){logger[_0x6683('0x12')](_0x6683('0x45'),_0x15cddc);logger[_0x6683('0xe')](_0x6683('0x45'),_0x15cddc,JSON[_0x6683('0x1a')](_0x44b050));_0x40bcc8(_0x44b050);})[_0x6683('0x14')](function(_0x3d5be5){logger['error'](_0x6683('0x45'),_0x3d5be5[_0x6683('0x11')],_0x15cddc);_0x45499e(_0x347522[_0x6683('0xf')](0x1f4,_0x3d5be5[_0x6683('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index df445ed..165e374 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 _0x1186=['/describe','/:id','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x272420,_0x199f8a){var _0x5dffe5=function(_0x17929a){while(--_0x17929a){_0x272420['push'](_0x272420['shift']());}};_0x5dffe5(++_0x199f8a);}(_0x1186,0xa8));var _0x6118=function(_0x351ba4,_0x432cdd){_0x351ba4=_0x351ba4-0x0;var _0x1c5282=_0x1186[_0x351ba4];return _0x1c5282;};'use strict';var multer=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var path=require(_0x6118('0x2'));var timeout=require('connect-timeout');var express=require(_0x6118('0x3'));var router=express[_0x6118('0x4')]();var fs_extra=require(_0x6118('0x5'));var auth=require(_0x6118('0x6'));var interaction=require(_0x6118('0x7'));var config=require(_0x6118('0x8'));var controller=require('./cmHopperHistory.controller');router[_0x6118('0x9')]('/',auth[_0x6118('0xa')](),controller[_0x6118('0xb')]);router[_0x6118('0x9')](_0x6118('0xc'),auth[_0x6118('0xa')](),controller['describe']);router[_0x6118('0x9')](_0x6118('0xd'),auth[_0x6118('0xa')](),controller['show']);router[_0x6118('0xe')]('/',auth[_0x6118('0xa')](),controller[_0x6118('0xf')]);router[_0x6118('0x10')](_0x6118('0xd'),auth[_0x6118('0xa')](),controller['update']);module[_0x6118('0x11')]=router; \ No newline at end of file +var _0x3293=['path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','multer','util'];(function(_0x5310ff,_0xcb5dbe){var _0x1b72df=function(_0x586b1f){while(--_0x586b1f){_0x5310ff['push'](_0x5310ff['shift']());}};_0x1b72df(++_0xcb5dbe);}(_0x3293,0xb9));var _0x3329=function(_0x19a96a,_0x7e84fc){_0x19a96a=_0x19a96a-0x0;var _0x47fc50=_0x3293[_0x19a96a];return _0x47fc50;};'use strict';var multer=require(_0x3329('0x0'));var util=require(_0x3329('0x1'));var path=require(_0x3329('0x2'));var timeout=require(_0x3329('0x3'));var express=require(_0x3329('0x4'));var router=express[_0x3329('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3329('0x6'));var config=require('../../config/environment');var controller=require(_0x3329('0x7'));router[_0x3329('0x8')]('/',auth[_0x3329('0x9')](),controller[_0x3329('0xa')]);router[_0x3329('0x8')](_0x3329('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3329('0x8')](_0x3329('0xc'),auth['isAuthenticated'](),controller[_0x3329('0xd')]);router[_0x3329('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3329('0xf')](_0x3329('0xc'),auth['isAuthenticated'](),controller[_0x3329('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index fc36c4e..77a0f15 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 _0xec46=['sequelize','exports','STRING','name'];(function(_0x4323e4,_0x61cd53){var _0x350273=function(_0x290aa3){while(--_0x290aa3){_0x4323e4['push'](_0x4323e4['shift']());}};_0x350273(++_0x61cd53);}(_0xec46,0x19c));var _0x6ec4=function(_0x56d1f2,_0x4c3f0b){_0x56d1f2=_0x56d1f2-0x0;var _0xd987ea=_0xec46[_0x56d1f2];return _0xd987ea;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'name':{'type':Sequelize[_0x6ec4('0x2')],'unique':_0x6ec4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0851=['STRING','name','sequelize','exports'];(function(_0x3fbb7a,_0x11b0f9){var _0x124f95=function(_0x3ce281){while(--_0x3ce281){_0x3fbb7a['push'](_0x3fbb7a['shift']());}};_0x124f95(++_0x11b0f9);}(_0x0851,0x8a));var _0x1085=function(_0x2c5987,_0x101621){_0x2c5987=_0x2c5987-0x0;var _0x55773d=_0x0851[_0x2c5987];return _0x55773d;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')],'unique':_0x1085('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x1085('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d9d7878..a52ae75 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 _0xe2b7=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','hasOwnProperty','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','select','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','addAgents','spread','removeAgents','userCmList:remove','getAgents','User','info','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xe2b7,0x8c));var _0x7e2b=function(_0x43ee1a,_0x4dd6b4){_0x43ee1a=_0x43ee1a-0x0;var _0x2ff77a=_0xe2b7[_0x43ee1a];return _0x2ff77a;};'use strict';var emlformat=require(_0x7e2b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e2b('0x1'));var rp=require('request-promise');var moment=require(_0x7e2b('0x2'));var BPromise=require(_0x7e2b('0x3'));var Mustache=require(_0x7e2b('0x4'));var util=require(_0x7e2b('0x5'));var path=require('path');var sox=require(_0x7e2b('0x6'));var csv=require('to-csv');var ejs=require(_0x7e2b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e2b('0x8'));var squel=require(_0x7e2b('0x9'));var crypto=require(_0x7e2b('0xa'));var jsforce=require(_0x7e2b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7e2b('0xc'));var querystring=require('querystring');var Papa=require(_0x7e2b('0xd'));var Redis=require(_0x7e2b('0xe'));var authService=require(_0x7e2b('0xf'));var qs=require(_0x7e2b('0x10'));var as=require(_0x7e2b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7e2b('0x12'));var utils=require('../../config/utils');var config=require(_0x7e2b('0x13'));var licenseUtil=require(_0x7e2b('0x14'));var db=require(_0x7e2b('0x15'))['db'];var csv_results;config[_0x7e2b('0x16')]=_[_0x7e2b('0x17')](config[_0x7e2b('0x16')],{'host':_0x7e2b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e2b('0x16')]));require(_0x7e2b('0x19'))[_0x7e2b('0x1a')](socket);function respondWithStatusCode(_0x552794,_0x4855cd){_0x4855cd=_0x4855cd||0xcc;return function(_0x482772){if(_0x482772){return _0x552794[_0x7e2b('0x1b')](_0x4855cd);}return _0x552794[_0x7e2b('0x1c')](_0x4855cd)[_0x7e2b('0x1d')]();};}function respondWithResult(_0x3ce9b3,_0x1cc67c){_0x1cc67c=_0x1cc67c||0xc8;return function(_0x29172b){if(_0x29172b){return _0x3ce9b3['status'](_0x1cc67c)[_0x7e2b('0x1e')](_0x29172b);}};}function respondWithFilteredResult(_0x434740,_0x3f14cd){return function(_0x1a4c15){if(_0x1a4c15){var _0x40300c=typeof _0x3f14cd[_0x7e2b('0x1f')]===_0x7e2b('0x20')&&typeof _0x3f14cd[_0x7e2b('0x21')]===_0x7e2b('0x20');var _0x568ffe=_0x1a4c15[_0x7e2b('0x22')];var _0x393cb2=_0x40300c?0x0:_0x3f14cd[_0x7e2b('0x1f')];var _0x6bf17c=_0x40300c?_0x1a4c15[_0x7e2b('0x22')]:_0x3f14cd[_0x7e2b('0x1f')]+_0x3f14cd[_0x7e2b('0x21')];var _0xf16536;if(_0x6bf17c>=_0x568ffe){_0x6bf17c=_0x568ffe;_0xf16536=0xc8;}else{_0xf16536=0xce;}_0x434740[_0x7e2b('0x1c')](_0xf16536);return _0x434740[_0x7e2b('0x23')](_0x7e2b('0x24'),_0x393cb2+'-'+_0x6bf17c+'/'+_0x568ffe)[_0x7e2b('0x1e')](_0x1a4c15);}return null;};}function patchUpdates(_0x2f7b56){return function(_0xecb7f2){try{jsonpatch[_0x7e2b('0x25')](_0xecb7f2,_0x2f7b56,!![]);}catch(_0x4f4b94){return BPromise[_0x7e2b('0x26')](_0x4f4b94);}return _0xecb7f2[_0x7e2b('0x27')]();};}function saveUpdates(_0xee1d8f,_0x44b89f){return function(_0x3415f1){if(_0x3415f1){return _0x3415f1[_0x7e2b('0x28')](_0xee1d8f)[_0x7e2b('0x29')](function(_0x48f67a){return _0x48f67a;});}return null;};}function removeEntity(_0x41f28e,_0x5675b4){return function(_0x537979){if(_0x537979){return _0x537979[_0x7e2b('0x2a')]()[_0x7e2b('0x29')](function(){var _0x31bb4a=_0x537979[_0x7e2b('0x2b')]({'plain':!![]});var _0x547488='Lists';return db[_0x7e2b('0x2c')]['destroy']({'where':{'type':_0x547488,'resourceId':_0x31bb4a['id']}})[_0x7e2b('0x29')](function(){return _0x537979;});})['then'](function(){_0x41f28e[_0x7e2b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19524e,_0x4b0411){return function(_0x5e42fa){if(!_0x5e42fa){_0x19524e[_0x7e2b('0x1b')](0x194);}return _0x5e42fa;};}function handleError(_0x3501fc,_0x25937c){_0x25937c=_0x25937c||0x1f4;return function(_0x2215c0){logger[_0x7e2b('0x2d')](_0x2215c0[_0x7e2b('0x2e')]);if(_0x2215c0['name']){delete _0x2215c0[_0x7e2b('0x2f')];}_0x3501fc[_0x7e2b('0x1c')](_0x25937c)[_0x7e2b('0x30')](_0x2215c0);};}exports[_0x7e2b('0x31')]=function(_0x3860df,_0x3214f7){var _0x4b870d={},_0xddfd49={},_0x985fc4={'count':0x0,'rows':[]};var _0x342df2=_[_0x7e2b('0x32')](db[_0x7e2b('0x33')][_0x7e2b('0x34')],function(_0x2f86c7){return{'name':_0x2f86c7[_0x7e2b('0x35')],'type':_0x2f86c7[_0x7e2b('0x36')][_0x7e2b('0x37')]};});_0xddfd49[_0x7e2b('0x38')]=_[_0x7e2b('0x32')](_0x342df2,'name');_0xddfd49['query']=_[_0x7e2b('0x39')](_0x3860df[_0x7e2b('0x3a')]);_0xddfd49[_0x7e2b('0x3b')]=_['intersection'](_0xddfd49[_0x7e2b('0x38')],_0xddfd49[_0x7e2b('0x3a')]);_0x4b870d[_0x7e2b('0x3c')]=_[_0x7e2b('0x3d')](_0xddfd49[_0x7e2b('0x38')],qs[_0x7e2b('0x3e')](_0x3860df['query']['fields']));_0x4b870d[_0x7e2b('0x3c')]=_0x4b870d[_0x7e2b('0x3c')][_0x7e2b('0x3f')]?_0x4b870d['attributes']:_0xddfd49[_0x7e2b('0x38')];if(!_0x3860df[_0x7e2b('0x3a')]['hasOwnProperty'](_0x7e2b('0x40'))){_0x4b870d['limit']=qs['limit'](_0x3860df[_0x7e2b('0x3a')]['limit']);_0x4b870d[_0x7e2b('0x1f')]=qs['offset'](_0x3860df['query'][_0x7e2b('0x1f')]);}_0x4b870d[_0x7e2b('0x41')]=qs[_0x7e2b('0x42')](_0x3860df[_0x7e2b('0x3a')]['sort']);_0x4b870d['where']=qs[_0x7e2b('0x3b')](_[_0x7e2b('0x43')](_0x3860df[_0x7e2b('0x3a')],_0xddfd49['filters']),_0x342df2);if(_0x3860df['query'][_0x7e2b('0x44')]){_0x4b870d[_0x7e2b('0x45')]=_['merge'](_0x4b870d[_0x7e2b('0x45')],{'$or':_[_0x7e2b('0x32')](_0x342df2,function(_0x446079){if(_0x446079['type']!=='VIRTUAL'){var _0x147a9f={};_0x147a9f[_0x446079[_0x7e2b('0x2f')]]={'$like':'%'+_0x3860df[_0x7e2b('0x3a')]['filter']+'%'};return _0x147a9f;}})});}_0x4b870d=_[_0x7e2b('0x46')]({},_0x4b870d,_0x3860df[_0x7e2b('0x47')]);var _0x319729={'where':_0x4b870d[_0x7e2b('0x45')]};return db[_0x7e2b('0x33')]['count'](_0x319729)[_0x7e2b('0x29')](function(_0xb33dcc){_0x985fc4[_0x7e2b('0x22')]=_0xb33dcc;if(_0x3860df['query'][_0x7e2b('0x48')]){_0x4b870d[_0x7e2b('0x49')]=[{'all':!![]}];}return db[_0x7e2b('0x33')][_0x7e2b('0x4a')](_0x4b870d);})[_0x7e2b('0x29')](function(_0x3610be){_0x985fc4[_0x7e2b('0x4b')]=_0x3610be;return _0x985fc4;})[_0x7e2b('0x29')](respondWithFilteredResult(_0x3214f7,_0x4b870d))[_0x7e2b('0x4c')](handleError(_0x3214f7,null));};exports[_0x7e2b('0x4d')]=function(_0x26f7d0,_0xc0238d){var _0x15f897={'raw':![],'where':{'id':_0x26f7d0[_0x7e2b('0x4e')]['id']}},_0x392563={};_0x392563[_0x7e2b('0x38')]=_[_0x7e2b('0x39')](db[_0x7e2b('0x33')][_0x7e2b('0x34')]);_0x392563['query']=_[_0x7e2b('0x39')](_0x26f7d0[_0x7e2b('0x3a')]);_0x392563[_0x7e2b('0x3b')]=_[_0x7e2b('0x3d')](_0x392563[_0x7e2b('0x38')],_0x392563[_0x7e2b('0x3a')]);_0x15f897[_0x7e2b('0x3c')]=_['intersection'](_0x392563[_0x7e2b('0x38')],qs['fields'](_0x26f7d0[_0x7e2b('0x3a')][_0x7e2b('0x3e')]));_0x15f897[_0x7e2b('0x3c')]=_0x15f897[_0x7e2b('0x3c')][_0x7e2b('0x3f')]?_0x15f897[_0x7e2b('0x3c')]:_0x392563[_0x7e2b('0x38')];if(_0x26f7d0['query'][_0x7e2b('0x48')]){_0x15f897[_0x7e2b('0x49')]=[{'all':!![]}];}_0x15f897=_[_0x7e2b('0x46')]({},_0x15f897,_0x26f7d0[_0x7e2b('0x47')]);return db['CmList'][_0x7e2b('0x4f')](_0x15f897)[_0x7e2b('0x29')](handleEntityNotFound(_0xc0238d,null))['then'](respondWithResult(_0xc0238d,null))[_0x7e2b('0x4c')](handleError(_0xc0238d,null));};exports[_0x7e2b('0x50')]=function(_0x5dd1d0,_0x4089d3){return db['CmList'][_0x7e2b('0x50')](_0x5dd1d0[_0x7e2b('0x51')],{})['then'](function(_0x25ad23){var _0x1a4789=_0x5dd1d0[_0x7e2b('0x52')][_0x7e2b('0x2b')]({'plain':!![]});if(!_0x1a4789)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a4789['role']===_0x7e2b('0x52')){var _0x5e39cc=_0x25ad23[_0x7e2b('0x2b')]({'plain':!![]});var _0x1f9898=_0x7e2b('0x53');return db['UserProfileSection'][_0x7e2b('0x4f')]({'where':{'name':_0x1f9898,'userProfileId':_0x1a4789[_0x7e2b('0x54')]},'raw':!![]})[_0x7e2b('0x29')](function(_0x4ffa04){if(_0x4ffa04&&_0x4ffa04[_0x7e2b('0x55')]===0x0){return db[_0x7e2b('0x2c')]['create']({'name':_0x5e39cc[_0x7e2b('0x2f')],'resourceId':_0x5e39cc['id'],'type':_0x4ffa04['name'],'sectionId':_0x4ffa04['id']},{})[_0x7e2b('0x29')](function(){return _0x25ad23;});}else{return _0x25ad23;}})[_0x7e2b('0x4c')](function(_0x525f32){logger['error'](_0x7e2b('0x56'),_0x525f32);throw _0x525f32;});}return _0x25ad23;})['then'](respondWithResult(_0x4089d3,0xc9))[_0x7e2b('0x4c')](handleError(_0x4089d3,null));};exports[_0x7e2b('0x28')]=function(_0x1dd141,_0x4492a6){if(_0x1dd141[_0x7e2b('0x51')]['id']){delete _0x1dd141['body']['id'];}return db[_0x7e2b('0x33')]['find']({'where':{'id':_0x1dd141['params']['id']}})['then'](handleEntityNotFound(_0x4492a6,null))['then'](saveUpdates(_0x1dd141[_0x7e2b('0x51')],null))[_0x7e2b('0x29')](respondWithResult(_0x4492a6,null))['catch'](handleError(_0x4492a6,null));};exports[_0x7e2b('0x2a')]=function(_0x43edb3,_0x1466a9){return db['CmList'][_0x7e2b('0x4f')]({'where':{'id':_0x43edb3[_0x7e2b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1466a9,null))[_0x7e2b('0x29')](removeEntity(_0x1466a9,null))[_0x7e2b('0x4c')](handleError(_0x1466a9,null));};exports[_0x7e2b('0x57')]=function(_0x5556f8,_0x4f72cf){return db['CmList'][_0x7e2b('0x57')]()[_0x7e2b('0x29')](respondWithResult(_0x4f72cf,null))[_0x7e2b('0x4c')](handleError(_0x4f72cf,null));};exports[_0x7e2b('0x58')]=function(_0x26657f,_0x30746b,_0x3cb44f){if(_0x26657f[_0x7e2b('0x51')]['id']){delete _0x26657f[_0x7e2b('0x51')]['id'];}return db[_0x7e2b('0x33')][_0x7e2b('0x4f')]({'where':{'id':_0x26657f['params']['id']}})['then'](handleEntityNotFound(_0x30746b,null))[_0x7e2b('0x29')](function(_0x3df5c2){if(_0x3df5c2){_0x26657f[_0x7e2b('0x51')][_0x7e2b('0x59')]=_0x3df5c2['id'];return db['Disposition'][_0x7e2b('0x50')](_0x26657f[_0x7e2b('0x51')]);}})[_0x7e2b('0x29')](respondWithResult(_0x30746b,null))['catch'](handleError(_0x30746b,null));};exports[_0x7e2b('0x5a')]=function(_0x124935,_0x23c5e7,_0x3dfb4e){var _0xf91145={'raw':![],'where':{}};var _0xaeb6d1={};var _0x1e2b3c={'count':0x0,'rows':[]};return db[_0x7e2b('0x33')]['findOne']({'where':{'id':_0x124935['params']['id']}})['then'](handleEntityNotFound(_0x23c5e7,null))[_0x7e2b('0x29')](function(_0xfcbdb5){if(_0xfcbdb5){_0xaeb6d1[_0x7e2b('0x38')]=_[_0x7e2b('0x39')](db[_0x7e2b('0x5b')][_0x7e2b('0x34')]);_0xaeb6d1[_0x7e2b('0x3a')]=_[_0x7e2b('0x39')](_0x124935['query']);_0xaeb6d1['filters']=_['intersection'](_0xaeb6d1[_0x7e2b('0x38')],_0xaeb6d1[_0x7e2b('0x3a')]);_0xf91145[_0x7e2b('0x3c')]=_[_0x7e2b('0x3d')](_0xaeb6d1[_0x7e2b('0x38')],qs[_0x7e2b('0x3e')](_0x124935[_0x7e2b('0x3a')][_0x7e2b('0x3e')]));_0xf91145[_0x7e2b('0x3c')]=_0xf91145[_0x7e2b('0x3c')][_0x7e2b('0x3f')]?_0xf91145['attributes']:_0xaeb6d1['model'];if(!_0x124935[_0x7e2b('0x3a')][_0x7e2b('0x5c')](_0x7e2b('0x40'))){_0xf91145[_0x7e2b('0x21')]=qs[_0x7e2b('0x21')](_0x124935[_0x7e2b('0x3a')][_0x7e2b('0x21')]);_0xf91145[_0x7e2b('0x1f')]=qs[_0x7e2b('0x1f')](_0x124935[_0x7e2b('0x3a')][_0x7e2b('0x1f')]);}_0xf91145[_0x7e2b('0x41')]=qs[_0x7e2b('0x42')](_0x124935['query'][_0x7e2b('0x42')]);_0xf91145[_0x7e2b('0x45')]=qs[_0x7e2b('0x3b')](_[_0x7e2b('0x43')](_0x124935[_0x7e2b('0x3a')],_0xaeb6d1[_0x7e2b('0x3b')]));_0xf91145['where'][_0x7e2b('0x59')]=_0xfcbdb5['id'];if(_0x124935[_0x7e2b('0x3a')]['filter']){_0xf91145[_0x7e2b('0x45')]=_[_0x7e2b('0x46')](_0xf91145['where'],{'$or':_[_0x7e2b('0x32')](_0xf91145['attributes'],function(_0x31e48f){var _0x3d6f9b={};_0x3d6f9b[_0x31e48f]={'$like':'%'+_0x124935[_0x7e2b('0x3a')][_0x7e2b('0x44')]+'%'};return _0x3d6f9b;})});}_0xf91145=_[_0x7e2b('0x46')]({},_0xf91145,_0x124935[_0x7e2b('0x47')]);return db[_0x7e2b('0x5b')][_0x7e2b('0x22')]({'where':_0xf91145[_0x7e2b('0x45')]})['then'](function(_0x12f3d4){_0x1e2b3c[_0x7e2b('0x22')]=_0x12f3d4;if(_0x124935[_0x7e2b('0x3a')][_0x7e2b('0x48')]){_0xf91145['include']=[{'all':!![]}];}return db['Disposition'][_0x7e2b('0x4a')](_0xf91145);})[_0x7e2b('0x29')](function(_0x41a4f4){_0x1e2b3c[_0x7e2b('0x4b')]=_0x41a4f4;return _0x1e2b3c;});}})[_0x7e2b('0x29')](respondWithFilteredResult(_0x23c5e7,_0xf91145))[_0x7e2b('0x4c')](handleError(_0x23c5e7,null));};exports[_0x7e2b('0x5d')]=function(_0x23b729,_0x4955ed,_0x162a28){return db['CmList']['find']({'where':{'id':_0x23b729[_0x7e2b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4955ed,null))[_0x7e2b('0x29')](function(_0x497a46){if(_0x497a46){return _0x497a46['removeDispositions'](_0x23b729[_0x7e2b('0x3a')][_0x7e2b('0x5e')]);}})[_0x7e2b('0x29')](respondWithStatusCode(_0x4955ed,null))['catch'](handleError(_0x4955ed,null));};exports[_0x7e2b('0x5f')]=function(_0xe7b96f,_0x39ca8b,_0x2fe54a){return db['CmList'][_0x7e2b('0x4f')]({'where':{'id':_0xe7b96f[_0x7e2b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39ca8b,null))[_0x7e2b('0x29')](function(_0x41f967){if(_0x41f967){var _0xe868e3=[];var _0x46aa94={'success':[],'errors':[]};return db[_0x7e2b('0x60')]['describe']()[_0x7e2b('0x29')](function(_0x5e0e02){if(_0xe7b96f['body'][_0x7e2b('0x61')]&&_[_0x7e2b('0x62')](_0xe7b96f[_0x7e2b('0x51')]['tags'])){if(_0xe7b96f[_0x7e2b('0x51')][_0x7e2b('0x61')][_0x7e2b('0x3f')]){_0xe7b96f[_0x7e2b('0x51')][_0x7e2b('0x61')]=_0xe7b96f[_0x7e2b('0x51')][_0x7e2b('0x61')]['join'](';')+';';}else{_0xe7b96f['body']['tags']=null;}}else{_0xe7b96f[_0x7e2b('0x51')]['tags']=null;}if(_0xe7b96f[_0x7e2b('0x51')]&&_[_0x7e2b('0x62')](_0xe7b96f['body'])){for(var _0x8e4ce7=0x0;_0x8e4ce7<_0xe7b96f[_0x7e2b('0x51')][_0x7e2b('0x3f')];_0x8e4ce7+=0x1){_0xe7b96f[_0x7e2b('0x51')][_0x8e4ce7]['ListId']=_0xe7b96f[_0x7e2b('0x4e')]['id'];_0xe868e3[_0x7e2b('0x63')](_0xe7b96f[_0x7e2b('0x51')][_0x8e4ce7]);}return BPromise[_0x7e2b('0x64')](_0xe868e3,function(_0x2caf56){return db[_0x7e2b('0x60')][_0x7e2b('0x50')](_[_0x7e2b('0x65')](_0x2caf56,[_0x7e2b('0x5e'),'id'])||{},{'fields':_[_0x7e2b('0x39')](_0x5e0e02),'raw':!![]})[_0x7e2b('0x29')](function(_0xf4bcae){_0x46aa94['success'][_0x7e2b('0x63')](_0xf4bcae['dataValues']);})[_0x7e2b('0x4c')](function(_0x4a8fde){_0x46aa94[_0x7e2b('0x66')][_0x7e2b('0x63')]({'data':_0x2caf56,'error':_0x4a8fde[_0x7e2b('0x67')]});});})[_0x7e2b('0x29')](function(_0x14ef21){return _0x46aa94;})[_0x7e2b('0x4c')](function(_0x115878){return _0x115878;});}else{_0x39ca8b[_0x7e2b('0x1c')](0x190)[_0x7e2b('0x1e')]({'message':_0x7e2b('0x68')});}});}})[_0x7e2b('0x29')](respondWithResult(_0x39ca8b,null))[_0x7e2b('0x4c')](handleError(_0x39ca8b,null));};exports[_0x7e2b('0x69')]=function(_0x334986,_0xbb9eea,_0x353760){var _0x12809c;return db[_0x7e2b('0x33')][_0x7e2b('0x4f')]({'where':{'id':_0x334986[_0x7e2b('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x7e2b('0x6a')}]})[_0x7e2b('0x29')](handleEntityNotFound(_0xbb9eea,null))[_0x7e2b('0x29')](function(_0x32c678){if(_0x32c678){_0x12809c=_0x32c678;return db['CmContact'][_0x7e2b('0x34')];}})[_0x7e2b('0x29')](function(_0x3c0851){if(_0x3c0851){var _0x1ae494={};var _0x1e39de={};_0x1e39de['model']=_['concat'](_[_0x7e2b('0x39')](_0x3c0851),_[_0x7e2b('0x32')](_0x12809c['CustomFields'],function(_0x555ccf){return util[_0x7e2b('0x6b')]('cf_%d',_0x555ccf['id']);}));_0x1e39de[_0x7e2b('0x3a')]=_[_0x7e2b('0x39')](_0x334986[_0x7e2b('0x3a')]);_0x1e39de['filters']=_[_0x7e2b('0x3d')](_0x1e39de[_0x7e2b('0x38')],_0x1e39de[_0x7e2b('0x3a')]);_0x1ae494[_0x7e2b('0x3c')]=_[_0x7e2b('0x3d')](_0x1e39de[_0x7e2b('0x38')],qs['fields'](_0x334986[_0x7e2b('0x3a')][_0x7e2b('0x3e')]));_0x1ae494[_0x7e2b('0x3c')]=_0x1ae494[_0x7e2b('0x3c')][_0x7e2b('0x3f')]?_0x1ae494[_0x7e2b('0x3c')]:_0x1e39de[_0x7e2b('0x38')];if(!_0x334986[_0x7e2b('0x3a')]['hasOwnProperty'](_0x7e2b('0x40'))){_0x1ae494[_0x7e2b('0x21')]=qs[_0x7e2b('0x21')](_0x334986[_0x7e2b('0x3a')]['limit']);_0x1ae494[_0x7e2b('0x1f')]=qs['offset'](_0x334986['query'][_0x7e2b('0x1f')]);}_0x1ae494[_0x7e2b('0x41')]=qs[_0x7e2b('0x42')](_0x334986[_0x7e2b('0x3a')][_0x7e2b('0x42')]);_0x1ae494['where']=qs[_0x7e2b('0x3b')](_[_0x7e2b('0x43')](_0x334986[_0x7e2b('0x3a')],_0x1e39de[_0x7e2b('0x3b')]));_0x1ae494['raw']=!![];if(_0x334986[_0x7e2b('0x3a')][_0x7e2b('0x44')]){_0x1ae494['where']=_[_0x7e2b('0x46')](_0x1ae494[_0x7e2b('0x45')],{'$or':_['map'](_0x1ae494[_0x7e2b('0x3c')],function(_0x100e46){var _0x1465cd={};_0x1465cd[_0x100e46]={'$like':'%'+_0x334986[_0x7e2b('0x3a')][_0x7e2b('0x44')]+'%'};return _0x1465cd;})});}_0x1ae494=_[_0x7e2b('0x46')]({},_0x1ae494,_0x334986[_0x7e2b('0x47')]);return _0x12809c[_0x7e2b('0x69')](_0x1ae494);}})[_0x7e2b('0x29')](respondWithResult(_0xbb9eea,null))[_0x7e2b('0x4c')](handleError(_0xbb9eea,null));};exports[_0x7e2b('0x6c')]=function(_0x4ceb6d,_0x50ae40,_0x15e897){var _0x27e4c1;var _0x323b38;var _0x100ba6;var _0x4660a8=_0x4ceb6d[_0x7e2b('0x4e')]['id'];csv_results=[];return db[_0x7e2b('0x6d')][_0x7e2b('0x4a')]({'attributes':['id',_0x7e2b('0x2f')],'raw':!![],'order':[_0x7e2b('0x6e')]})['then'](function(_0x3a81b9){_0x27e4c1=_0x3a81b9;var _0x59d953=_[_0x7e2b('0x39')](db[_0x7e2b('0x60')]['rawAttributes']);return db[_0x7e2b('0x6f')]['findAll']({'raw':!![],'attributes':['id',_0x7e2b('0x70')]})[_0x7e2b('0x29')](function(_0x3b639c){_0x323b38=_0x3b639c;var _0x37f273=squel['select']()[_0x7e2b('0x3e')](_0x59d953)[_0x7e2b('0x71')](_0x7e2b('0x72'),'c')[_0x7e2b('0x45')](_0x7e2b('0x73'),_0x4660a8)[_0x7e2b('0x45')](_0x7e2b('0x74'))[_0x7e2b('0x75')]();for(var _0x2a306e=0x0;_0x2a306e<_0x323b38[_0x7e2b('0x3f')];_0x2a306e++){_0x37f273[_0x7e2b('0x76')]('c.cf_'+_0x323b38[_0x2a306e]['id'],'customField_'+_0x323b38[_0x2a306e][_0x7e2b('0x70')]);}for(var _0x2a306e=0x0;_0x2a306e<_0x27e4c1[_0x7e2b('0x3f')];_0x2a306e++){_0x37f273[_0x7e2b('0x76')](squel[_0x7e2b('0x77')]()[_0x7e2b('0x76')](_0x7e2b('0x78'))[_0x7e2b('0x71')](_0x7e2b('0x79'))[_0x7e2b('0x45')]('ItemTypeId\x20=\x20?',_0x27e4c1[_0x2a306e]['id'])[_0x7e2b('0x45')](_0x7e2b('0x7a')),_0x7e2b('0x7b')+_0x27e4c1[_0x2a306e][_0x7e2b('0x2f')]);_0x37f273[_0x7e2b('0x76')](squel[_0x7e2b('0x77')]()[_0x7e2b('0x76')](_0x7e2b('0x7c'))[_0x7e2b('0x71')]('cm_contact_has_items')[_0x7e2b('0x45')](_0x7e2b('0x7d'),_0x27e4c1[_0x2a306e]['id'])[_0x7e2b('0x45')](_0x7e2b('0x7a')),_0x7e2b('0x7e')+_0x27e4c1[_0x2a306e][_0x7e2b('0x2f')]);}var _0x2b0b61=[];_0x2b0b61[_0x7e2b('0x63')](_0x37f273[_0x7e2b('0x7f')]());BPromise['each'](_0x2b0b61,handleQuery)[_0x7e2b('0x29')](function(_0x7ec4ee){handleQuery(_0x37f273[_0x7e2b('0x7f')]());var _0x2d7174=csv_results[0x0];if(!_[_0x7e2b('0x80')](_0x2d7174)){var _0x2a2aad=toCsv(_0x2d7174);var _0x483e43=Date[_0x7e2b('0x81')]();fs[_0x7e2b('0x82')](util[_0x7e2b('0x6b')](_0x7e2b('0x83'),_0x4660a8,_0x483e43),_0x2a2aad);_0x50ae40[_0x7e2b('0x84')]('Content-disposition',_0x7e2b('0x85')+util[_0x7e2b('0x6b')](_0x7e2b('0x86'),_0x4660a8,_0x483e43));_0x50ae40[_0x7e2b('0x84')](_0x7e2b('0x87'),_0x7e2b('0x88'));return _0x50ae40[_0x7e2b('0x89')](util[_0x7e2b('0x6b')](_0x7e2b('0x83'),_0x4660a8,_0x483e43));}else{return _0x50ae40[_0x7e2b('0x1b')](0xcc);}});});});};exports['addCustomField']=function(_0x99ba4,_0x2a4aa7,_0x4cf71b){var _0x194f26;delete _0x99ba4[_0x7e2b('0x51')]['id'];return db[_0x7e2b('0x33')][_0x7e2b('0x8a')]({'where':{'id':_0x99ba4[_0x7e2b('0x4e')]['id']}})[_0x7e2b('0x29')](handleEntityNotFound(_0x2a4aa7,null))[_0x7e2b('0x29')](function(_0x199b96){if(_0x199b96){return db[_0x7e2b('0x8b')][_0x7e2b('0x8c')](function(_0x26719e){return db[_0x7e2b('0x6f')][_0x7e2b('0x50')](_0x99ba4['body'],{'transaction':_0x26719e})[_0x7e2b('0x29')](function(_0x5b5ca9){_0x194f26=_0x5b5ca9;return _0x199b96[_0x7e2b('0x8d')](_0x5b5ca9,{'transaction':_0x26719e});})['then'](function(){var _0x2a2d80={'type':db[_0x7e2b('0x8e')]['TEXT'],'transaction':_0x26719e};switch(_0x99ba4[_0x7e2b('0x51')][_0x7e2b('0x36')]){case _0x7e2b('0x8f'):_0x2a2d80['type']=db[_0x7e2b('0x8e')]['TEXT'];break;case _0x7e2b('0x90'):_0x2a2d80['type']=db['Sequelize'][_0x7e2b('0x91')];break;case'switch':_0x2a2d80[_0x7e2b('0x36')]=db[_0x7e2b('0x8e')][_0x7e2b('0x92')];_0x2a2d80[_0x7e2b('0x93')]=![];break;default:}return db[_0x7e2b('0x8b')][_0x7e2b('0x94')][_0x7e2b('0x95')](_0x7e2b('0x72'),util['format'](_0x7e2b('0x96'),_0x194f26['id']),_0x2a2d80);})[_0x7e2b('0x29')](function(){return _0x194f26;});});}})[_0x7e2b('0x29')](respondWithResult(_0x2a4aa7,null))[_0x7e2b('0x4c')](handleError(_0x2a4aa7,null));};exports['getCustomFields']=function(_0x1f1073,_0x5f3b92,_0x3c405c){var _0x1b89aa={};var _0x73eb7c={};var _0x311869;var _0x326f8d;return db[_0x7e2b('0x33')]['findOne']({'where':{'id':_0x1f1073['params']['id']}})[_0x7e2b('0x29')](handleEntityNotFound(_0x5f3b92,null))[_0x7e2b('0x29')](function(_0x24dfea){if(_0x24dfea){_0x311869=_0x24dfea;_0x73eb7c[_0x7e2b('0x38')]=_[_0x7e2b('0x39')](db[_0x7e2b('0x6f')][_0x7e2b('0x34')]);_0x73eb7c[_0x7e2b('0x3a')]=_[_0x7e2b('0x39')](_0x1f1073[_0x7e2b('0x3a')]);_0x73eb7c[_0x7e2b('0x3b')]=_[_0x7e2b('0x3d')](_0x73eb7c['model'],_0x73eb7c[_0x7e2b('0x3a')]);_0x1b89aa[_0x7e2b('0x3c')]=_[_0x7e2b('0x3d')](_0x73eb7c['model'],qs[_0x7e2b('0x3e')](_0x1f1073['query'][_0x7e2b('0x3e')]));_0x1b89aa[_0x7e2b('0x3c')]=_0x1b89aa[_0x7e2b('0x3c')][_0x7e2b('0x3f')]?_0x1b89aa[_0x7e2b('0x3c')]:_0x73eb7c[_0x7e2b('0x38')];_0x1b89aa[_0x7e2b('0x41')]=qs[_0x7e2b('0x42')](_0x1f1073[_0x7e2b('0x3a')][_0x7e2b('0x42')]);_0x1b89aa[_0x7e2b('0x45')]=qs[_0x7e2b('0x3b')](_['pick'](_0x1f1073[_0x7e2b('0x3a')],_0x73eb7c[_0x7e2b('0x3b')]));_0x1b89aa[_0x7e2b('0x45')]=_[_0x7e2b('0x46')](_0x1b89aa[_0x7e2b('0x45')],{'$or':[{'ListId':_0x24dfea['id']},{'ListId':null}]});if(_0x1f1073[_0x7e2b('0x3a')][_0x7e2b('0x44')]){_0x1b89aa[_0x7e2b('0x45')]=_[_0x7e2b('0x46')](_0x1b89aa[_0x7e2b('0x45')],{'$or':_[_0x7e2b('0x32')](_0x1b89aa[_0x7e2b('0x3c')],function(_0x2511e8){var _0x9299f1={};_0x9299f1[_0x2511e8]={'$like':'%'+_0x1f1073[_0x7e2b('0x3a')]['filter']+'%'};return _0x9299f1;})});}_0x1b89aa=_[_0x7e2b('0x46')]({},_0x1b89aa,_0x1f1073[_0x7e2b('0x47')]);return db['CmCustomField'][_0x7e2b('0x97')](_0x1b89aa);}})['then'](respondWithResult(_0x5f3b92,null))[_0x7e2b('0x4c')](handleError(_0x5f3b92,null));};exports['getGlobalCustomFields']=function(_0x5bcc23,_0x51176b){return db[_0x7e2b('0x6f')][_0x7e2b('0x97')]({'where':{'ListId':null}})[_0x7e2b('0x29')](handleEntityNotFound(_0x51176b,null))[_0x7e2b('0x29')](function(_0x10f88d){return _0x10f88d;})['then'](respondWithResult(_0x51176b,null))['catch'](handleError(_0x51176b,null));};exports[_0x7e2b('0x98')]=function(_0x1c699d,_0x57a156,_0x34f711){return db[_0x7e2b('0x33')][_0x7e2b('0x4f')]({'where':{'id':_0x1c699d['params']['id']}})[_0x7e2b('0x29')](handleEntityNotFound(_0x57a156,null))[_0x7e2b('0x29')](function(_0x6aa5f0){if(_0x6aa5f0){return _0x6aa5f0[_0x7e2b('0x98')](_0x1c699d[_0x7e2b('0x51')][_0x7e2b('0x5e')],_[_0x7e2b('0x65')](_0x1c699d[_0x7e2b('0x51')],[_0x7e2b('0x5e'),'id'])||{})[_0x7e2b('0x99')](function(_0x5e6b8c){for(var _0x44c671=0x0;_0x44c671<_0x1c699d[_0x7e2b('0x51')][_0x7e2b('0x5e')][_0x7e2b('0x3f')];_0x44c671+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x1c699d['body']['ids'][_0x44c671]),'CmListId':Number(_0x1c699d[_0x7e2b('0x4e')]['id'])});}return _0x5e6b8c;});}})[_0x7e2b('0x29')](respondWithResult(_0x57a156,null))[_0x7e2b('0x4c')](handleError(_0x57a156,null));};exports[_0x7e2b('0x9a')]=function(_0x1b27d1,_0x32c277,_0xf3412){return db[_0x7e2b('0x33')]['find']({'where':{'id':_0x1b27d1['params']['id']}})['then'](handleEntityNotFound(_0x32c277,null))[_0x7e2b('0x29')](function(_0x3234a8){if(_0x3234a8){return _0x3234a8[_0x7e2b('0x9a')](_0x1b27d1[_0x7e2b('0x3a')][_0x7e2b('0x5e')])[_0x7e2b('0x29')](function(){if(_[_0x7e2b('0x62')](_0x1b27d1['query'][_0x7e2b('0x5e')])){for(var _0x48b3be=0x0;_0x48b3be<_0x1b27d1[_0x7e2b('0x3a')][_0x7e2b('0x5e')][_0x7e2b('0x3f')];_0x48b3be+=0x1){socket['emit'](_0x7e2b('0x9b'),{'UserId':Number(_0x1b27d1[_0x7e2b('0x3a')][_0x7e2b('0x5e')][_0x48b3be]),'CmListId':Number(_0x1b27d1[_0x7e2b('0x4e')]['id'])});}}else{socket['emit'](_0x7e2b('0x9b'),{'UserId':Number(_0x1b27d1[_0x7e2b('0x3a')][_0x7e2b('0x5e')]),'CmListId':Number(_0x1b27d1[_0x7e2b('0x4e')]['id'])});}});}})[_0x7e2b('0x29')](respondWithStatusCode(_0x32c277,null))[_0x7e2b('0x4c')](handleError(_0x32c277,null));};exports[_0x7e2b('0x9c')]=function(_0x2637f2,_0x49cb19,_0x526fd1){var _0x5a0b31={};var _0x54f488={};var _0x43aeff;var _0x18424a;return db[_0x7e2b('0x33')][_0x7e2b('0x8a')]({'where':{'id':_0x2637f2[_0x7e2b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49cb19,null))[_0x7e2b('0x29')](function(_0x13812e){if(_0x13812e){_0x43aeff=_0x13812e;_0x54f488[_0x7e2b('0x38')]=_[_0x7e2b('0x39')](db[_0x7e2b('0x9d')][_0x7e2b('0x34')]);_0x54f488[_0x7e2b('0x3a')]=_[_0x7e2b('0x39')](_0x2637f2['query']);_0x54f488[_0x7e2b('0x3b')]=_['intersection'](_0x54f488[_0x7e2b('0x38')],_0x54f488[_0x7e2b('0x3a')]);_0x5a0b31[_0x7e2b('0x3c')]=_['intersection'](_0x54f488[_0x7e2b('0x38')],qs[_0x7e2b('0x3e')](_0x2637f2[_0x7e2b('0x3a')][_0x7e2b('0x3e')]));_0x5a0b31[_0x7e2b('0x3c')]=_0x5a0b31[_0x7e2b('0x3c')]['length']?_0x5a0b31[_0x7e2b('0x3c')]:_0x54f488[_0x7e2b('0x38')];_0x5a0b31[_0x7e2b('0x41')]=qs['sort'](_0x2637f2['query'][_0x7e2b('0x42')]);_0x5a0b31[_0x7e2b('0x45')]=qs[_0x7e2b('0x3b')](_[_0x7e2b('0x43')](_0x2637f2[_0x7e2b('0x3a')],_0x54f488[_0x7e2b('0x3b')]));if(_0x2637f2['query'][_0x7e2b('0x44')]){_0x5a0b31['where']=_[_0x7e2b('0x46')](_0x5a0b31[_0x7e2b('0x45')],{'$or':_['map'](_0x5a0b31['attributes'],function(_0xe89e83){var _0x2edb02={};_0x2edb02[_0xe89e83]={'$like':'%'+_0x2637f2[_0x7e2b('0x3a')][_0x7e2b('0x44')]+'%'};return _0x2edb02;})});}_0x5a0b31=_[_0x7e2b('0x46')]({},_0x5a0b31,_0x2637f2[_0x7e2b('0x47')]);return _0x43aeff[_0x7e2b('0x9c')](_0x5a0b31);}})[_0x7e2b('0x29')](function(_0x211f8e){if(_0x211f8e){_0x18424a=_0x211f8e[_0x7e2b('0x3f')];if(!_0x2637f2['query'][_0x7e2b('0x5c')](_0x7e2b('0x40'))){_0x5a0b31[_0x7e2b('0x21')]=qs[_0x7e2b('0x21')](_0x2637f2[_0x7e2b('0x3a')]['limit']);_0x5a0b31[_0x7e2b('0x1f')]=qs[_0x7e2b('0x1f')](_0x2637f2['query']['offset']);}return _0x43aeff[_0x7e2b('0x9c')](_0x5a0b31);}})['then'](function(_0x39ef42){if(_0x39ef42){return _0x39ef42?{'count':_0x18424a,'rows':_0x39ef42}:null;}})[_0x7e2b('0x29')](respondWithResult(_0x49cb19,null))[_0x7e2b('0x4c')](handleError(_0x49cb19,null));};function handleQuery(_0x35d1d6){logger[_0x7e2b('0x9e')](_0x35d1d6);return db[_0x7e2b('0x8b')][_0x7e2b('0x3a')](_0x35d1d6)[_0x7e2b('0x99')](function(_0x214f41){csv_results[_0x7e2b('0x63')](_0x214f41);})['catch'](function(_0x4513b3){logger[_0x7e2b('0x2d')](_0x4513b3[_0x7e2b('0x67')]);});} \ No newline at end of file +var _0x5b9b=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','ListId','removeDispositions','ids','addContacts','tags','isArray','join','push','each','CmContact','omit','success','dataValues','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','pick','getContacts','ContactItemType','OrderBy','select','c.deletedAt\x20is\x20null','distinct','field','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','from','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','User','info','message','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0x54c243,_0x47474d){var _0x579850=function(_0x5e48fe){while(--_0x5e48fe){_0x54c243['push'](_0x54c243['shift']());}};_0x579850(++_0x47474d);}(_0x5b9b,0x142));var _0xb5b9=function(_0x33578b,_0x3cf39f){_0x33578b=_0x33578b-0x0;var _0x171112=_0x5b9b[_0x33578b];return _0x171112;};'use strict';var emlformat=require(_0xb5b9('0x0'));var rimraf=require(_0xb5b9('0x1'));var zipdir=require(_0xb5b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5b9('0x3'));var moment=require(_0xb5b9('0x4'));var BPromise=require(_0xb5b9('0x5'));var Mustache=require(_0xb5b9('0x6'));var util=require('util');var path=require(_0xb5b9('0x7'));var sox=require(_0xb5b9('0x8'));var csv=require(_0xb5b9('0x9'));var ejs=require(_0xb5b9('0xa'));var fs=require('fs');var fs_extra=require(_0xb5b9('0xb'));var _=require(_0xb5b9('0xc'));var squel=require(_0xb5b9('0xd'));var crypto=require(_0xb5b9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb5b9('0xf'));var toCsv=require(_0xb5b9('0x9'));var querystring=require('querystring');var Papa=require(_0xb5b9('0x10'));var Redis=require(_0xb5b9('0x11'));var authService=require(_0xb5b9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb5b9('0x13'));var hardwareService=require(_0xb5b9('0x14'));var logger=require('../../config/logger')(_0xb5b9('0x15'));var utils=require(_0xb5b9('0x16'));var config=require(_0xb5b9('0x17'));var licenseUtil=require(_0xb5b9('0x18'));var db=require(_0xb5b9('0x19'))['db'];var csv_results;config[_0xb5b9('0x1a')]=_[_0xb5b9('0x1b')](config[_0xb5b9('0x1a')],{'host':_0xb5b9('0x1c'),'port':0x18eb});var socket=require(_0xb5b9('0x1d'))(new Redis(config[_0xb5b9('0x1a')]));require(_0xb5b9('0x1e'))[_0xb5b9('0x1f')](socket);function respondWithStatusCode(_0x1d162a,_0x5933a8){_0x5933a8=_0x5933a8||0xcc;return function(_0x9fe3df){if(_0x9fe3df){return _0x1d162a[_0xb5b9('0x20')](_0x5933a8);}return _0x1d162a['status'](_0x5933a8)[_0xb5b9('0x21')]();};}function respondWithResult(_0x5baf67,_0x3815be){_0x3815be=_0x3815be||0xc8;return function(_0x1c92d2){if(_0x1c92d2){return _0x5baf67[_0xb5b9('0x22')](_0x3815be)[_0xb5b9('0x23')](_0x1c92d2);}};}function respondWithFilteredResult(_0x2ff33b,_0x34f8b3){return function(_0x1370ec){if(_0x1370ec){var _0x2bc8be=typeof _0x34f8b3[_0xb5b9('0x24')]===_0xb5b9('0x25')&&typeof _0x34f8b3[_0xb5b9('0x26')]===_0xb5b9('0x25');var _0x496aae=_0x1370ec[_0xb5b9('0x27')];var _0x25be7b=_0x2bc8be?0x0:_0x34f8b3[_0xb5b9('0x24')];var _0x3b86d2=_0x2bc8be?_0x1370ec['count']:_0x34f8b3[_0xb5b9('0x24')]+_0x34f8b3[_0xb5b9('0x26')];var _0x2a1ab9;if(_0x3b86d2>=_0x496aae){_0x3b86d2=_0x496aae;_0x2a1ab9=0xc8;}else{_0x2a1ab9=0xce;}_0x2ff33b[_0xb5b9('0x22')](_0x2a1ab9);return _0x2ff33b[_0xb5b9('0x28')](_0xb5b9('0x29'),_0x25be7b+'-'+_0x3b86d2+'/'+_0x496aae)[_0xb5b9('0x23')](_0x1370ec);}return null;};}function patchUpdates(_0x5ee75b){return function(_0x5aefe5){try{jsonpatch[_0xb5b9('0x2a')](_0x5aefe5,_0x5ee75b,!![]);}catch(_0x45886d){return BPromise[_0xb5b9('0x2b')](_0x45886d);}return _0x5aefe5[_0xb5b9('0x2c')]();};}function saveUpdates(_0x41f696,_0x312e22){return function(_0x69401f){if(_0x69401f){return _0x69401f['update'](_0x41f696)[_0xb5b9('0x2d')](function(_0x55693d){return _0x55693d;});}return null;};}function removeEntity(_0x556d8b,_0x4af004){return function(_0x21e9a6){if(_0x21e9a6){return _0x21e9a6[_0xb5b9('0x2e')]()[_0xb5b9('0x2d')](function(){var _0x388cda=_0x21e9a6[_0xb5b9('0x2f')]({'plain':!![]});var _0x4f10ed=_0xb5b9('0x30');return db[_0xb5b9('0x31')][_0xb5b9('0x2e')]({'where':{'type':_0x4f10ed,'resourceId':_0x388cda['id']}})[_0xb5b9('0x2d')](function(){return _0x21e9a6;});})['then'](function(){_0x556d8b[_0xb5b9('0x22')](0xcc)[_0xb5b9('0x21')]();});}};}function handleEntityNotFound(_0x20d84c,_0x3c6eed){return function(_0x402d4f){if(!_0x402d4f){_0x20d84c[_0xb5b9('0x20')](0x194);}return _0x402d4f;};}function handleError(_0x3022c9,_0x17869f){_0x17869f=_0x17869f||0x1f4;return function(_0x3903f0){logger[_0xb5b9('0x32')](_0x3903f0[_0xb5b9('0x33')]);if(_0x3903f0[_0xb5b9('0x34')]){delete _0x3903f0[_0xb5b9('0x34')];}_0x3022c9[_0xb5b9('0x22')](_0x17869f)['send'](_0x3903f0);};}exports[_0xb5b9('0x35')]=function(_0x5b83ec,_0x336248){var _0x57b443={},_0x25aadf={},_0x1bd5de={'count':0x0,'rows':[]};var _0xb174bc=_[_0xb5b9('0x36')](db[_0xb5b9('0x37')][_0xb5b9('0x38')],function(_0xd721a8){return{'name':_0xd721a8[_0xb5b9('0x39')],'type':_0xd721a8[_0xb5b9('0x3a')][_0xb5b9('0x3b')]};});_0x25aadf[_0xb5b9('0x3c')]=_['map'](_0xb174bc,'name');_0x25aadf[_0xb5b9('0x3d')]=_[_0xb5b9('0x3e')](_0x5b83ec[_0xb5b9('0x3d')]);_0x25aadf[_0xb5b9('0x3f')]=_[_0xb5b9('0x40')](_0x25aadf['model'],_0x25aadf[_0xb5b9('0x3d')]);_0x57b443['attributes']=_[_0xb5b9('0x40')](_0x25aadf['model'],qs[_0xb5b9('0x41')](_0x5b83ec[_0xb5b9('0x3d')][_0xb5b9('0x41')]));_0x57b443[_0xb5b9('0x42')]=_0x57b443[_0xb5b9('0x42')]['length']?_0x57b443[_0xb5b9('0x42')]:_0x25aadf[_0xb5b9('0x3c')];if(!_0x5b83ec[_0xb5b9('0x3d')][_0xb5b9('0x43')](_0xb5b9('0x44'))){_0x57b443[_0xb5b9('0x26')]=qs[_0xb5b9('0x26')](_0x5b83ec['query'][_0xb5b9('0x26')]);_0x57b443['offset']=qs['offset'](_0x5b83ec[_0xb5b9('0x3d')][_0xb5b9('0x24')]);}_0x57b443[_0xb5b9('0x45')]=qs[_0xb5b9('0x46')](_0x5b83ec['query'][_0xb5b9('0x46')]);_0x57b443[_0xb5b9('0x47')]=qs[_0xb5b9('0x3f')](_['pick'](_0x5b83ec[_0xb5b9('0x3d')],_0x25aadf[_0xb5b9('0x3f')]),_0xb174bc);if(_0x5b83ec[_0xb5b9('0x3d')][_0xb5b9('0x48')]){_0x57b443[_0xb5b9('0x47')]=_[_0xb5b9('0x49')](_0x57b443['where'],{'$or':_[_0xb5b9('0x36')](_0xb174bc,function(_0x4d57ea){if(_0x4d57ea[_0xb5b9('0x3a')]!==_0xb5b9('0x4a')){var _0x4e8201={};_0x4e8201[_0x4d57ea[_0xb5b9('0x34')]]={'$like':'%'+_0x5b83ec[_0xb5b9('0x3d')]['filter']+'%'};return _0x4e8201;}})});}_0x57b443=_[_0xb5b9('0x49')]({},_0x57b443,_0x5b83ec[_0xb5b9('0x4b')]);var _0x596ada={'where':_0x57b443[_0xb5b9('0x47')]};return db['CmList']['count'](_0x596ada)[_0xb5b9('0x2d')](function(_0x282d32){_0x1bd5de[_0xb5b9('0x27')]=_0x282d32;if(_0x5b83ec[_0xb5b9('0x3d')]['includeAll']){_0x57b443[_0xb5b9('0x4c')]=[{'all':!![]}];}return db[_0xb5b9('0x37')][_0xb5b9('0x4d')](_0x57b443);})[_0xb5b9('0x2d')](function(_0x45c6cc){_0x1bd5de[_0xb5b9('0x4e')]=_0x45c6cc;return _0x1bd5de;})[_0xb5b9('0x2d')](respondWithFilteredResult(_0x336248,_0x57b443))[_0xb5b9('0x4f')](handleError(_0x336248,null));};exports['show']=function(_0x300e5e,_0x38b087){var _0x12bb3c={'raw':![],'where':{'id':_0x300e5e[_0xb5b9('0x50')]['id']}},_0x417114={};_0x417114['model']=_['keys'](db[_0xb5b9('0x37')][_0xb5b9('0x38')]);_0x417114[_0xb5b9('0x3d')]=_['keys'](_0x300e5e[_0xb5b9('0x3d')]);_0x417114['filters']=_[_0xb5b9('0x40')](_0x417114[_0xb5b9('0x3c')],_0x417114[_0xb5b9('0x3d')]);_0x12bb3c['attributes']=_[_0xb5b9('0x40')](_0x417114[_0xb5b9('0x3c')],qs[_0xb5b9('0x41')](_0x300e5e[_0xb5b9('0x3d')][_0xb5b9('0x41')]));_0x12bb3c[_0xb5b9('0x42')]=_0x12bb3c[_0xb5b9('0x42')][_0xb5b9('0x51')]?_0x12bb3c[_0xb5b9('0x42')]:_0x417114[_0xb5b9('0x3c')];if(_0x300e5e['query'][_0xb5b9('0x52')]){_0x12bb3c[_0xb5b9('0x4c')]=[{'all':!![]}];}_0x12bb3c=_[_0xb5b9('0x49')]({},_0x12bb3c,_0x300e5e[_0xb5b9('0x4b')]);return db['CmList']['find'](_0x12bb3c)[_0xb5b9('0x2d')](handleEntityNotFound(_0x38b087,null))[_0xb5b9('0x2d')](respondWithResult(_0x38b087,null))[_0xb5b9('0x4f')](handleError(_0x38b087,null));};exports[_0xb5b9('0x53')]=function(_0x3252a5,_0x45ac2c){return db[_0xb5b9('0x37')][_0xb5b9('0x53')](_0x3252a5[_0xb5b9('0x54')],{})['then'](function(_0x4ae25f){var _0x543bdb=_0x3252a5[_0xb5b9('0x55')]['get']({'plain':!![]});if(!_0x543bdb)throw new Error(_0xb5b9('0x56'));if(_0x543bdb[_0xb5b9('0x57')]===_0xb5b9('0x55')){var _0x231efa=_0x4ae25f[_0xb5b9('0x2f')]({'plain':!![]});var _0xeb0fa4=_0xb5b9('0x30');return db['UserProfileSection'][_0xb5b9('0x58')]({'where':{'name':_0xeb0fa4,'userProfileId':_0x543bdb[_0xb5b9('0x59')]},'raw':!![]})[_0xb5b9('0x2d')](function(_0x522298){if(_0x522298&&_0x522298[_0xb5b9('0x5a')]===0x0){return db[_0xb5b9('0x31')][_0xb5b9('0x53')]({'name':_0x231efa[_0xb5b9('0x34')],'resourceId':_0x231efa['id'],'type':_0x522298['name'],'sectionId':_0x522298['id']},{})[_0xb5b9('0x2d')](function(){return _0x4ae25f;});}else{return _0x4ae25f;}})[_0xb5b9('0x4f')](function(_0x30807e){logger[_0xb5b9('0x32')](_0xb5b9('0x5b'),_0x30807e);throw _0x30807e;});}return _0x4ae25f;})['then'](respondWithResult(_0x45ac2c,0xc9))[_0xb5b9('0x4f')](handleError(_0x45ac2c,null));};exports[_0xb5b9('0x5c')]=function(_0x4dd538,_0x3db163){if(_0x4dd538[_0xb5b9('0x54')]['id']){delete _0x4dd538[_0xb5b9('0x54')]['id'];}return db['CmList'][_0xb5b9('0x58')]({'where':{'id':_0x4dd538['params']['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x3db163,null))['then'](saveUpdates(_0x4dd538[_0xb5b9('0x54')],null))[_0xb5b9('0x2d')](respondWithResult(_0x3db163,null))[_0xb5b9('0x4f')](handleError(_0x3db163,null));};exports[_0xb5b9('0x2e')]=function(_0x59b712,_0x3c13a7){return db[_0xb5b9('0x37')][_0xb5b9('0x58')]({'where':{'id':_0x59b712['params']['id']}})['then'](handleEntityNotFound(_0x3c13a7,null))[_0xb5b9('0x2d')](removeEntity(_0x3c13a7,null))[_0xb5b9('0x4f')](handleError(_0x3c13a7,null));};exports[_0xb5b9('0x5d')]=function(_0x15cec7,_0x23358a){return db[_0xb5b9('0x37')][_0xb5b9('0x5d')]()[_0xb5b9('0x2d')](respondWithResult(_0x23358a,null))['catch'](handleError(_0x23358a,null));};exports[_0xb5b9('0x5e')]=function(_0x38323d,_0x1fb671,_0x111b02){if(_0x38323d[_0xb5b9('0x54')]['id']){delete _0x38323d[_0xb5b9('0x54')]['id'];}return db[_0xb5b9('0x37')][_0xb5b9('0x58')]({'where':{'id':_0x38323d['params']['id']}})['then'](handleEntityNotFound(_0x1fb671,null))[_0xb5b9('0x2d')](function(_0x5dc8d5){if(_0x5dc8d5){_0x38323d[_0xb5b9('0x54')]['ListId']=_0x5dc8d5['id'];return db[_0xb5b9('0x5f')][_0xb5b9('0x53')](_0x38323d[_0xb5b9('0x54')]);}})[_0xb5b9('0x2d')](respondWithResult(_0x1fb671,null))[_0xb5b9('0x4f')](handleError(_0x1fb671,null));};exports[_0xb5b9('0x60')]=function(_0x5e282b,_0x459dd8,_0x219357){var _0x2da7c3={'raw':![],'where':{}};var _0x2b539d={};var _0x3bfeec={'count':0x0,'rows':[]};return db[_0xb5b9('0x37')][_0xb5b9('0x61')]({'where':{'id':_0x5e282b[_0xb5b9('0x50')]['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x459dd8,null))[_0xb5b9('0x2d')](function(_0x394912){if(_0x394912){_0x2b539d[_0xb5b9('0x3c')]=_[_0xb5b9('0x3e')](db[_0xb5b9('0x5f')][_0xb5b9('0x38')]);_0x2b539d[_0xb5b9('0x3d')]=_[_0xb5b9('0x3e')](_0x5e282b[_0xb5b9('0x3d')]);_0x2b539d[_0xb5b9('0x3f')]=_['intersection'](_0x2b539d[_0xb5b9('0x3c')],_0x2b539d[_0xb5b9('0x3d')]);_0x2da7c3['attributes']=_[_0xb5b9('0x40')](_0x2b539d[_0xb5b9('0x3c')],qs[_0xb5b9('0x41')](_0x5e282b[_0xb5b9('0x3d')][_0xb5b9('0x41')]));_0x2da7c3[_0xb5b9('0x42')]=_0x2da7c3[_0xb5b9('0x42')][_0xb5b9('0x51')]?_0x2da7c3[_0xb5b9('0x42')]:_0x2b539d['model'];if(!_0x5e282b[_0xb5b9('0x3d')]['hasOwnProperty'](_0xb5b9('0x44'))){_0x2da7c3[_0xb5b9('0x26')]=qs[_0xb5b9('0x26')](_0x5e282b['query'][_0xb5b9('0x26')]);_0x2da7c3[_0xb5b9('0x24')]=qs['offset'](_0x5e282b[_0xb5b9('0x3d')][_0xb5b9('0x24')]);}_0x2da7c3[_0xb5b9('0x45')]=qs['sort'](_0x5e282b[_0xb5b9('0x3d')]['sort']);_0x2da7c3[_0xb5b9('0x47')]=qs[_0xb5b9('0x3f')](_['pick'](_0x5e282b[_0xb5b9('0x3d')],_0x2b539d['filters']));_0x2da7c3[_0xb5b9('0x47')][_0xb5b9('0x62')]=_0x394912['id'];if(_0x5e282b['query'][_0xb5b9('0x48')]){_0x2da7c3[_0xb5b9('0x47')]=_['merge'](_0x2da7c3[_0xb5b9('0x47')],{'$or':_[_0xb5b9('0x36')](_0x2da7c3[_0xb5b9('0x42')],function(_0x423a78){var _0x45734d={};_0x45734d[_0x423a78]={'$like':'%'+_0x5e282b[_0xb5b9('0x3d')][_0xb5b9('0x48')]+'%'};return _0x45734d;})});}_0x2da7c3=_[_0xb5b9('0x49')]({},_0x2da7c3,_0x5e282b[_0xb5b9('0x4b')]);return db['Disposition']['count']({'where':_0x2da7c3[_0xb5b9('0x47')]})['then'](function(_0x1f929e){_0x3bfeec[_0xb5b9('0x27')]=_0x1f929e;if(_0x5e282b[_0xb5b9('0x3d')][_0xb5b9('0x52')]){_0x2da7c3[_0xb5b9('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0xb5b9('0x4d')](_0x2da7c3);})[_0xb5b9('0x2d')](function(_0x50164c){_0x3bfeec[_0xb5b9('0x4e')]=_0x50164c;return _0x3bfeec;});}})[_0xb5b9('0x2d')](respondWithFilteredResult(_0x459dd8,_0x2da7c3))[_0xb5b9('0x4f')](handleError(_0x459dd8,null));};exports[_0xb5b9('0x63')]=function(_0xdc8804,_0x185d1f,_0xe71ac9){return db[_0xb5b9('0x37')][_0xb5b9('0x58')]({'where':{'id':_0xdc8804[_0xb5b9('0x50')]['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x185d1f,null))[_0xb5b9('0x2d')](function(_0x278757){if(_0x278757){return _0x278757[_0xb5b9('0x63')](_0xdc8804[_0xb5b9('0x3d')][_0xb5b9('0x64')]);}})[_0xb5b9('0x2d')](respondWithStatusCode(_0x185d1f,null))[_0xb5b9('0x4f')](handleError(_0x185d1f,null));};exports[_0xb5b9('0x65')]=function(_0x3fe4a6,_0x339563,_0x2b1cd8){return db['CmList']['find']({'where':{'id':_0x3fe4a6['params']['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x339563,null))['then'](function(_0xa3f9c1){if(_0xa3f9c1){var _0x2d9f32=[];var _0x2fe0be={'success':[],'errors':[]};return db['CmContact'][_0xb5b9('0x5d')]()[_0xb5b9('0x2d')](function(_0x1692c2){if(_0x3fe4a6[_0xb5b9('0x54')][_0xb5b9('0x66')]&&_[_0xb5b9('0x67')](_0x3fe4a6[_0xb5b9('0x54')][_0xb5b9('0x66')])){if(_0x3fe4a6[_0xb5b9('0x54')][_0xb5b9('0x66')][_0xb5b9('0x51')]){_0x3fe4a6[_0xb5b9('0x54')][_0xb5b9('0x66')]=_0x3fe4a6['body'][_0xb5b9('0x66')][_0xb5b9('0x68')](';')+';';}else{_0x3fe4a6[_0xb5b9('0x54')][_0xb5b9('0x66')]=null;}}else{_0x3fe4a6[_0xb5b9('0x54')][_0xb5b9('0x66')]=null;}if(_0x3fe4a6['body']&&_['isArray'](_0x3fe4a6[_0xb5b9('0x54')])){for(var _0x600ba=0x0;_0x600ba<_0x3fe4a6['body']['length'];_0x600ba+=0x1){_0x3fe4a6[_0xb5b9('0x54')][_0x600ba]['ListId']=_0x3fe4a6['params']['id'];_0x2d9f32[_0xb5b9('0x69')](_0x3fe4a6[_0xb5b9('0x54')][_0x600ba]);}return BPromise[_0xb5b9('0x6a')](_0x2d9f32,function(_0x14c8e8){return db[_0xb5b9('0x6b')][_0xb5b9('0x53')](_[_0xb5b9('0x6c')](_0x14c8e8,[_0xb5b9('0x64'),'id'])||{},{'fields':_[_0xb5b9('0x3e')](_0x1692c2),'raw':!![]})[_0xb5b9('0x2d')](function(_0x44e94e){_0x2fe0be[_0xb5b9('0x6d')][_0xb5b9('0x69')](_0x44e94e[_0xb5b9('0x6e')]);})[_0xb5b9('0x4f')](function(_0x13a395){_0x2fe0be['errors'][_0xb5b9('0x69')]({'data':_0x14c8e8,'error':_0x13a395['message']});});})[_0xb5b9('0x2d')](function(_0x52e5bb){return _0x2fe0be;})['catch'](function(_0xdebf8b){return _0xdebf8b;});}else{_0x339563['status'](0x190)['json']({'message':_0xb5b9('0x6f')});}});}})[_0xb5b9('0x2d')](respondWithResult(_0x339563,null))['catch'](handleError(_0x339563,null));};exports['getContacts']=function(_0x19a9d7,_0x43691a,_0xb58d7){var _0x172be0;return db['CmList'][_0xb5b9('0x58')]({'where':{'id':_0x19a9d7[_0xb5b9('0x50')]['id']},'include':[{'model':db[_0xb5b9('0x70')],'as':_0xb5b9('0x71')}]})['then'](handleEntityNotFound(_0x43691a,null))[_0xb5b9('0x2d')](function(_0x2df0ef){if(_0x2df0ef){_0x172be0=_0x2df0ef;return db[_0xb5b9('0x6b')][_0xb5b9('0x38')];}})[_0xb5b9('0x2d')](function(_0x3d5c6b){if(_0x3d5c6b){var _0x5e0bf8={};var _0x15501e={};_0x15501e[_0xb5b9('0x3c')]=_[_0xb5b9('0x72')](_[_0xb5b9('0x3e')](_0x3d5c6b),_[_0xb5b9('0x36')](_0x172be0[_0xb5b9('0x71')],function(_0x278492){return util[_0xb5b9('0x73')](_0xb5b9('0x74'),_0x278492['id']);}));_0x15501e['query']=_['keys'](_0x19a9d7[_0xb5b9('0x3d')]);_0x15501e['filters']=_[_0xb5b9('0x40')](_0x15501e[_0xb5b9('0x3c')],_0x15501e['query']);_0x5e0bf8[_0xb5b9('0x42')]=_[_0xb5b9('0x40')](_0x15501e['model'],qs[_0xb5b9('0x41')](_0x19a9d7[_0xb5b9('0x3d')][_0xb5b9('0x41')]));_0x5e0bf8[_0xb5b9('0x42')]=_0x5e0bf8[_0xb5b9('0x42')][_0xb5b9('0x51')]?_0x5e0bf8[_0xb5b9('0x42')]:_0x15501e[_0xb5b9('0x3c')];if(!_0x19a9d7['query'][_0xb5b9('0x43')]('nolimit')){_0x5e0bf8[_0xb5b9('0x26')]=qs[_0xb5b9('0x26')](_0x19a9d7[_0xb5b9('0x3d')][_0xb5b9('0x26')]);_0x5e0bf8[_0xb5b9('0x24')]=qs['offset'](_0x19a9d7[_0xb5b9('0x3d')]['offset']);}_0x5e0bf8[_0xb5b9('0x45')]=qs['sort'](_0x19a9d7['query']['sort']);_0x5e0bf8[_0xb5b9('0x47')]=qs[_0xb5b9('0x3f')](_[_0xb5b9('0x75')](_0x19a9d7[_0xb5b9('0x3d')],_0x15501e['filters']));_0x5e0bf8['raw']=!![];if(_0x19a9d7['query']['filter']){_0x5e0bf8[_0xb5b9('0x47')]=_[_0xb5b9('0x49')](_0x5e0bf8[_0xb5b9('0x47')],{'$or':_[_0xb5b9('0x36')](_0x5e0bf8[_0xb5b9('0x42')],function(_0x11a195){var _0x3f1140={};_0x3f1140[_0x11a195]={'$like':'%'+_0x19a9d7['query']['filter']+'%'};return _0x3f1140;})});}_0x5e0bf8=_[_0xb5b9('0x49')]({},_0x5e0bf8,_0x19a9d7[_0xb5b9('0x4b')]);return _0x172be0[_0xb5b9('0x76')](_0x5e0bf8);}})['then'](respondWithResult(_0x43691a,null))[_0xb5b9('0x4f')](handleError(_0x43691a,null));};exports['getContactsCsv']=function(_0x2b0a53,_0x256b66,_0xec82c0){var _0x20b006;var _0x2fe901;var _0x1ee498;var _0x36dd06=_0x2b0a53['params']['id'];csv_results=[];return db[_0xb5b9('0x77')]['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0xb5b9('0x78')]})['then'](function(_0x5b1bef){_0x20b006=_0x5b1bef;var _0x1e53d4=_['keys'](db[_0xb5b9('0x6b')][_0xb5b9('0x38')]);return db[_0xb5b9('0x70')][_0xb5b9('0x4d')]({'raw':!![],'attributes':['id','alias']})[_0xb5b9('0x2d')](function(_0x2cb599){_0x2fe901=_0x2cb599;var _0xb1a89d=squel[_0xb5b9('0x79')]()[_0xb5b9('0x41')](_0x1e53d4)['from']('cm_contacts','c')[_0xb5b9('0x47')]('c.ListId\x20=\x20?',_0x36dd06)[_0xb5b9('0x47')](_0xb5b9('0x7a'))[_0xb5b9('0x7b')]();for(var _0x236db4=0x0;_0x236db4<_0x2fe901[_0xb5b9('0x51')];_0x236db4++){_0xb1a89d[_0xb5b9('0x7c')]('c.cf_'+_0x2fe901[_0x236db4]['id'],_0xb5b9('0x7d')+_0x2fe901[_0x236db4][_0xb5b9('0x7e')]);}for(var _0x236db4=0x0;_0x236db4<_0x20b006[_0xb5b9('0x51')];_0x236db4++){_0xb1a89d[_0xb5b9('0x7c')](squel[_0xb5b9('0x79')]()[_0xb5b9('0x7c')](_0xb5b9('0x7f'))['from'](_0xb5b9('0x80'))[_0xb5b9('0x47')](_0xb5b9('0x81'),_0x20b006[_0x236db4]['id'])[_0xb5b9('0x47')](_0xb5b9('0x82')),'additionalPhone_'+_0x20b006[_0x236db4][_0xb5b9('0x34')]);_0xb1a89d[_0xb5b9('0x7c')](squel[_0xb5b9('0x79')]()[_0xb5b9('0x7c')](_0xb5b9('0x83'))[_0xb5b9('0x84')]('cm_contact_has_items')[_0xb5b9('0x47')]('ItemTypeId\x20=\x20?',_0x20b006[_0x236db4]['id'])[_0xb5b9('0x47')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x20b006[_0x236db4][_0xb5b9('0x34')]);}var _0x24733d=[];_0x24733d[_0xb5b9('0x69')](_0xb1a89d[_0xb5b9('0x85')]());BPromise[_0xb5b9('0x6a')](_0x24733d,handleQuery)[_0xb5b9('0x2d')](function(_0x46846f){handleQuery(_0xb1a89d[_0xb5b9('0x85')]());var _0x33cb1e=csv_results[0x0];if(!_[_0xb5b9('0x86')](_0x33cb1e)){var _0x3b1f69=toCsv(_0x33cb1e);var _0xdb37c=Date[_0xb5b9('0x87')]();fs['writeFileSync'](util[_0xb5b9('0x73')](_0xb5b9('0x88'),_0x36dd06,_0xdb37c),_0x3b1f69);_0x256b66[_0xb5b9('0x89')](_0xb5b9('0x8a'),'attachment;\x20filename='+util[_0xb5b9('0x73')](_0xb5b9('0x8b'),_0x36dd06,_0xdb37c));_0x256b66['setHeader'](_0xb5b9('0x8c'),_0xb5b9('0x8d'));return _0x256b66['download'](util[_0xb5b9('0x73')]('/tmp/list_%d_%s.csv',_0x36dd06,_0xdb37c));}else{return _0x256b66[_0xb5b9('0x20')](0xcc);}});});});};exports[_0xb5b9('0x8e')]=function(_0xd9f0b0,_0x5ded11,_0x6f576e){var _0x346868;delete _0xd9f0b0[_0xb5b9('0x54')]['id'];return db[_0xb5b9('0x37')]['findOne']({'where':{'id':_0xd9f0b0[_0xb5b9('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ded11,null))['then'](function(_0xd0c780){if(_0xd0c780){return db[_0xb5b9('0x8f')]['transaction'](function(_0x2d50dc){return db[_0xb5b9('0x70')]['create'](_0xd9f0b0[_0xb5b9('0x54')],{'transaction':_0x2d50dc})[_0xb5b9('0x2d')](function(_0x163cbe){_0x346868=_0x163cbe;return _0xd0c780[_0xb5b9('0x90')](_0x163cbe,{'transaction':_0x2d50dc});})[_0xb5b9('0x2d')](function(){var _0x22452c={'type':db[_0xb5b9('0x91')][_0xb5b9('0x92')],'transaction':_0x2d50dc};switch(_0xd9f0b0[_0xb5b9('0x54')][_0xb5b9('0x3a')]){case _0xb5b9('0x93'):_0x22452c['type']=db[_0xb5b9('0x91')][_0xb5b9('0x92')];break;case'number':_0x22452c[_0xb5b9('0x3a')]=db[_0xb5b9('0x91')][_0xb5b9('0x94')];break;case _0xb5b9('0x95'):_0x22452c[_0xb5b9('0x3a')]=db[_0xb5b9('0x91')]['BOOLEAN'];_0x22452c[_0xb5b9('0x96')]=![];break;default:}return db[_0xb5b9('0x8f')][_0xb5b9('0x97')][_0xb5b9('0x98')]('cm_contacts',util[_0xb5b9('0x73')](_0xb5b9('0x99'),_0x346868['id']),_0x22452c);})[_0xb5b9('0x2d')](function(){return _0x346868;});});}})[_0xb5b9('0x2d')](respondWithResult(_0x5ded11,null))[_0xb5b9('0x4f')](handleError(_0x5ded11,null));};exports['getCustomFields']=function(_0x38411f,_0x288b09,_0x550a4a){var _0x801564={};var _0x3e0370={};var _0x2d95c0;var _0x1f1597;return db[_0xb5b9('0x37')]['findOne']({'where':{'id':_0x38411f[_0xb5b9('0x50')]['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x288b09,null))[_0xb5b9('0x2d')](function(_0x32cf51){if(_0x32cf51){_0x2d95c0=_0x32cf51;_0x3e0370[_0xb5b9('0x3c')]=_[_0xb5b9('0x3e')](db[_0xb5b9('0x70')]['rawAttributes']);_0x3e0370[_0xb5b9('0x3d')]=_[_0xb5b9('0x3e')](_0x38411f['query']);_0x3e0370['filters']=_[_0xb5b9('0x40')](_0x3e0370[_0xb5b9('0x3c')],_0x3e0370[_0xb5b9('0x3d')]);_0x801564[_0xb5b9('0x42')]=_[_0xb5b9('0x40')](_0x3e0370[_0xb5b9('0x3c')],qs[_0xb5b9('0x41')](_0x38411f[_0xb5b9('0x3d')][_0xb5b9('0x41')]));_0x801564[_0xb5b9('0x42')]=_0x801564[_0xb5b9('0x42')]['length']?_0x801564['attributes']:_0x3e0370[_0xb5b9('0x3c')];_0x801564[_0xb5b9('0x45')]=qs['sort'](_0x38411f[_0xb5b9('0x3d')]['sort']);_0x801564[_0xb5b9('0x47')]=qs[_0xb5b9('0x3f')](_[_0xb5b9('0x75')](_0x38411f[_0xb5b9('0x3d')],_0x3e0370[_0xb5b9('0x3f')]));_0x801564[_0xb5b9('0x47')]=_[_0xb5b9('0x49')](_0x801564[_0xb5b9('0x47')],{'$or':[{'ListId':_0x32cf51['id']},{'ListId':null}]});if(_0x38411f[_0xb5b9('0x3d')][_0xb5b9('0x48')]){_0x801564[_0xb5b9('0x47')]=_['merge'](_0x801564[_0xb5b9('0x47')],{'$or':_[_0xb5b9('0x36')](_0x801564['attributes'],function(_0x33f8da){var _0x20dd48={};_0x20dd48[_0x33f8da]={'$like':'%'+_0x38411f[_0xb5b9('0x3d')][_0xb5b9('0x48')]+'%'};return _0x20dd48;})});}_0x801564=_[_0xb5b9('0x49')]({},_0x801564,_0x38411f[_0xb5b9('0x4b')]);return db['CmCustomField'][_0xb5b9('0x9a')](_0x801564);}})[_0xb5b9('0x2d')](respondWithResult(_0x288b09,null))[_0xb5b9('0x4f')](handleError(_0x288b09,null));};exports[_0xb5b9('0x9b')]=function(_0x39082c,_0x3b50d8){return db[_0xb5b9('0x70')]['findAndCountAll']({'where':{'ListId':null}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x3b50d8,null))['then'](function(_0x323311){return _0x323311;})[_0xb5b9('0x2d')](respondWithResult(_0x3b50d8,null))[_0xb5b9('0x4f')](handleError(_0x3b50d8,null));};exports[_0xb5b9('0x9c')]=function(_0x13592b,_0x1cf259,_0x496f29){return db[_0xb5b9('0x37')][_0xb5b9('0x58')]({'where':{'id':_0x13592b[_0xb5b9('0x50')]['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x1cf259,null))['then'](function(_0x37237f){if(_0x37237f){return _0x37237f['addAgents'](_0x13592b[_0xb5b9('0x54')][_0xb5b9('0x64')],_[_0xb5b9('0x6c')](_0x13592b[_0xb5b9('0x54')],['ids','id'])||{})[_0xb5b9('0x9d')](function(_0x399494){for(var _0x5c8da5=0x0;_0x5c8da5<_0x13592b[_0xb5b9('0x54')]['ids'][_0xb5b9('0x51')];_0x5c8da5+=0x1){socket[_0xb5b9('0x9e')](_0xb5b9('0x9f'),{'UserId':Number(_0x13592b[_0xb5b9('0x54')][_0xb5b9('0x64')][_0x5c8da5]),'CmListId':Number(_0x13592b['params']['id'])});}return _0x399494;});}})[_0xb5b9('0x2d')](respondWithResult(_0x1cf259,null))[_0xb5b9('0x4f')](handleError(_0x1cf259,null));};exports[_0xb5b9('0xa0')]=function(_0x56330d,_0x198b12,_0x42b778){return db[_0xb5b9('0x37')]['find']({'where':{'id':_0x56330d['params']['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x198b12,null))[_0xb5b9('0x2d')](function(_0x377813){if(_0x377813){return _0x377813['removeAgents'](_0x56330d[_0xb5b9('0x3d')][_0xb5b9('0x64')])[_0xb5b9('0x2d')](function(){if(_[_0xb5b9('0x67')](_0x56330d[_0xb5b9('0x3d')][_0xb5b9('0x64')])){for(var _0x324790=0x0;_0x324790<_0x56330d[_0xb5b9('0x3d')][_0xb5b9('0x64')]['length'];_0x324790+=0x1){socket[_0xb5b9('0x9e')]('userCmList:remove',{'UserId':Number(_0x56330d[_0xb5b9('0x3d')]['ids'][_0x324790]),'CmListId':Number(_0x56330d[_0xb5b9('0x50')]['id'])});}}else{socket[_0xb5b9('0x9e')]('userCmList:remove',{'UserId':Number(_0x56330d[_0xb5b9('0x3d')]['ids']),'CmListId':Number(_0x56330d[_0xb5b9('0x50')]['id'])});}});}})[_0xb5b9('0x2d')](respondWithStatusCode(_0x198b12,null))['catch'](handleError(_0x198b12,null));};exports[_0xb5b9('0xa1')]=function(_0x51cf54,_0x1f216c,_0x4cfc9b){var _0x1ee9c7={};var _0xb00351={};var _0x42902b;var _0x868fa0;return db[_0xb5b9('0x37')]['findOne']({'where':{'id':_0x51cf54[_0xb5b9('0x50')]['id']}})[_0xb5b9('0x2d')](handleEntityNotFound(_0x1f216c,null))[_0xb5b9('0x2d')](function(_0xdbbfd){if(_0xdbbfd){_0x42902b=_0xdbbfd;_0xb00351[_0xb5b9('0x3c')]=_[_0xb5b9('0x3e')](db[_0xb5b9('0xa2')][_0xb5b9('0x38')]);_0xb00351['query']=_[_0xb5b9('0x3e')](_0x51cf54[_0xb5b9('0x3d')]);_0xb00351[_0xb5b9('0x3f')]=_[_0xb5b9('0x40')](_0xb00351['model'],_0xb00351[_0xb5b9('0x3d')]);_0x1ee9c7[_0xb5b9('0x42')]=_[_0xb5b9('0x40')](_0xb00351[_0xb5b9('0x3c')],qs['fields'](_0x51cf54[_0xb5b9('0x3d')][_0xb5b9('0x41')]));_0x1ee9c7[_0xb5b9('0x42')]=_0x1ee9c7[_0xb5b9('0x42')][_0xb5b9('0x51')]?_0x1ee9c7['attributes']:_0xb00351[_0xb5b9('0x3c')];_0x1ee9c7['order']=qs[_0xb5b9('0x46')](_0x51cf54['query']['sort']);_0x1ee9c7[_0xb5b9('0x47')]=qs[_0xb5b9('0x3f')](_[_0xb5b9('0x75')](_0x51cf54[_0xb5b9('0x3d')],_0xb00351[_0xb5b9('0x3f')]));if(_0x51cf54['query'][_0xb5b9('0x48')]){_0x1ee9c7[_0xb5b9('0x47')]=_['merge'](_0x1ee9c7[_0xb5b9('0x47')],{'$or':_[_0xb5b9('0x36')](_0x1ee9c7[_0xb5b9('0x42')],function(_0xf7f848){var _0x53ff68={};_0x53ff68[_0xf7f848]={'$like':'%'+_0x51cf54[_0xb5b9('0x3d')][_0xb5b9('0x48')]+'%'};return _0x53ff68;})});}_0x1ee9c7=_[_0xb5b9('0x49')]({},_0x1ee9c7,_0x51cf54[_0xb5b9('0x4b')]);return _0x42902b[_0xb5b9('0xa1')](_0x1ee9c7);}})[_0xb5b9('0x2d')](function(_0x16c488){if(_0x16c488){_0x868fa0=_0x16c488[_0xb5b9('0x51')];if(!_0x51cf54[_0xb5b9('0x3d')][_0xb5b9('0x43')](_0xb5b9('0x44'))){_0x1ee9c7[_0xb5b9('0x26')]=qs['limit'](_0x51cf54[_0xb5b9('0x3d')][_0xb5b9('0x26')]);_0x1ee9c7[_0xb5b9('0x24')]=qs[_0xb5b9('0x24')](_0x51cf54[_0xb5b9('0x3d')]['offset']);}return _0x42902b['getAgents'](_0x1ee9c7);}})[_0xb5b9('0x2d')](function(_0x53e487){if(_0x53e487){return _0x53e487?{'count':_0x868fa0,'rows':_0x53e487}:null;}})[_0xb5b9('0x2d')](respondWithResult(_0x1f216c,null))['catch'](handleError(_0x1f216c,null));};function handleQuery(_0x21c151){logger[_0xb5b9('0xa3')](_0x21c151);return db[_0xb5b9('0x8f')]['query'](_0x21c151)['spread'](function(_0x24fa74){csv_results[_0xb5b9('0x69')](_0x24fa74);})[_0xb5b9('0x4f')](function(_0x1e77bb){logger[_0xb5b9('0x32')](_0x1e77bb[_0xb5b9('0xa4')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0403564..9f0204c 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(_0x3aec7a,_0xa70ae3){_0x3aec7a=_0x3aec7a-0x0;var _0x1bd042=_0xe14b[_0x3aec7a];return _0x1bd042;};'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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5fc3[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 230ed47..2cc7477 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 _0xa74f=['cm_lists','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x588a23,_0x416b18){var _0x2efaae=function(_0x508c63){while(--_0x508c63){_0x588a23['push'](_0x588a23['shift']());}};_0x2efaae(++_0x416b18);}(_0xa74f,0x9a));var _0xfa74=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xa74f[_0x3bfdde];return _0x3f752a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x208518,_0xbadb13){var _0x1eb1f6=function(_0x403e24){while(--_0x403e24){_0x208518['push'](_0x208518['shift']());}};_0x1eb1f6(++_0xbadb13);}(_0x2dae,0xc3));var _0xe2da=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x2dae[_0x10c16d];return _0x5896f4;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 76a9bc9..1a37f39 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 _0xa488=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x1606bf,_0x430140){var _0x4c6493=function(_0x4a4d62){while(--_0x4a4d62){_0x1606bf['push'](_0x1606bf['shift']());}};_0x4c6493(++_0x430140);}(_0xa488,0xb3));var _0x8a48=function(_0x23b2b4,_0x1af875){_0x23b2b4=_0x23b2b4-0x0;var _0x4918ae=_0xa488[_0x23b2b4];return _0x4918ae;};'use strict';var _=require(_0x8a48('0x0'));var util=require(_0x8a48('0x1'));var moment=require(_0x8a48('0x2'));var BPromise=require(_0x8a48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a48('0x4'));var db=require(_0x8a48('0x5'))['db'];var utils=require(_0x8a48('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a48('0x7'));var jayson=require(_0x8a48('0x8'));var client=jayson[_0x8a48('0x9')][_0x8a48('0xa')]({'port':0x232a});config[_0x8a48('0xb')]=_[_0x8a48('0xc')](config[_0x8a48('0xb')],{'host':_0x8a48('0xd'),'port':0x18eb});var socket=require(_0x8a48('0xe'))(new Redis(config[_0x8a48('0xb')]));require(_0x8a48('0xf'))['register'](socket);function respondWithRpcPromise(_0x50baf9,_0x3960e1,_0x4c4e35){return new BPromise(function(_0x2f21c2,_0x40e76e){return client[_0x8a48('0x10')](_0x50baf9,_0x4c4e35)['then'](function(_0x4e3982){logger[_0x8a48('0x11')](_0x8a48('0x12'),_0x3960e1,_0x8a48('0x13'));logger['debug'](_0x8a48('0x14'),_0x3960e1,'request\x20sent',JSON['stringify'](_0x4e3982));if(_0x4e3982[_0x8a48('0x15')]){if(_0x4e3982[_0x8a48('0x15')][_0x8a48('0x16')]===0x1f4){logger[_0x8a48('0x15')](_0x8a48('0x12'),_0x3960e1,_0x4e3982[_0x8a48('0x15')][_0x8a48('0x17')]);return _0x40e76e(_0x4e3982['error']['message']);}logger[_0x8a48('0x15')]('CmList,\x20%s,\x20%s',_0x3960e1,_0x4e3982[_0x8a48('0x15')][_0x8a48('0x17')]);return _0x2f21c2(_0x4e3982['error'][_0x8a48('0x17')]);}else{logger[_0x8a48('0x11')](_0x8a48('0x12'),_0x3960e1,_0x8a48('0x13'));_0x2f21c2(_0x4e3982['result']['message']);}})[_0x8a48('0x18')](function(_0x46417d){logger[_0x8a48('0x15')](_0x8a48('0x12'),_0x3960e1,_0x46417d);_0x40e76e(_0x46417d);});});} \ No newline at end of file +var _0x446d=['localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x21f874,_0x1c5440){var _0x2f26b4=function(_0xfa5b44){while(--_0xfa5b44){_0x21f874['push'](_0x21f874['shift']());}};_0x2f26b4(++_0x1c5440);}(_0x446d,0x13c));var _0xd446=function(_0x3f787e,_0x951303){_0x3f787e=_0x3f787e-0x0;var _0x26242d=_0x446d[_0x3f787e];return _0x26242d;};'use strict';var _=require(_0xd446('0x0'));var util=require(_0xd446('0x1'));var moment=require(_0xd446('0x2'));var BPromise=require(_0xd446('0x3'));var rs=require(_0xd446('0x4'));var fs=require('fs');var Redis=require(_0xd446('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd446('0x6'));var logger=require('../../config/logger')(_0xd446('0x7'));var config=require(_0xd446('0x8'));var jayson=require(_0xd446('0x9'));var client=jayson[_0xd446('0xa')][_0xd446('0xb')]({'port':0x232a});config[_0xd446('0xc')]=_[_0xd446('0xd')](config['redis'],{'host':_0xd446('0xe'),'port':0x18eb});var socket=require(_0xd446('0xf'))(new Redis(config['redis']));require(_0xd446('0x10'))[_0xd446('0x11')](socket);function respondWithRpcPromise(_0x4f11e4,_0x1e3393,_0x34baed){return new BPromise(function(_0x1960d0,_0xfe5770){return client[_0xd446('0x12')](_0x4f11e4,_0x34baed)[_0xd446('0x13')](function(_0x574814){logger[_0xd446('0x14')](_0xd446('0x15'),_0x1e3393,_0xd446('0x16'));logger[_0xd446('0x17')](_0xd446('0x18'),_0x1e3393,_0xd446('0x16'),JSON[_0xd446('0x19')](_0x574814));if(_0x574814[_0xd446('0x1a')]){if(_0x574814[_0xd446('0x1a')]['code']===0x1f4){logger['error'](_0xd446('0x15'),_0x1e3393,_0x574814['error'][_0xd446('0x1b')]);return _0xfe5770(_0x574814[_0xd446('0x1a')][_0xd446('0x1b')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1e3393,_0x574814[_0xd446('0x1a')]['message']);return _0x1960d0(_0x574814[_0xd446('0x1a')]['message']);}else{logger['info']('CmList,\x20%s,\x20%s',_0x1e3393,_0xd446('0x16'));_0x1960d0(_0x574814[_0xd446('0x1c')]['message']);}})[_0xd446('0x1d')](function(_0x379fcd){logger['error'](_0xd446('0x15'),_0x1e3393,_0x379fcd);_0xfe5770(_0x379fcd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 9253587..ef5713e 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 _0x10e9=['cmList:','remove','update','emit','removeListener','register','length'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x10e9,0x1ba));var _0x910e=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x10e9[_0x40b493];return _0x548365;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x910e('0x0'),_0x910e('0x1')];function createListener(_0x1dba0a,_0x5235b7){return function(_0x15a94c){_0x5235b7[_0x910e('0x2')](_0x1dba0a,_0x15a94c);};}function removeListener(_0x527669,_0x26bfbc){return function(){CmListEvents[_0x910e('0x3')](_0x527669,_0x26bfbc);};}exports[_0x910e('0x4')]=function(_0x27afec){for(var _0x7f40a1=0x0,_0x1dedeb=events[_0x910e('0x5')];_0x7f40a1<_0x1dedeb;_0x7f40a1++){var _0x19f7bb=events[_0x7f40a1];var _0x7d5a04=createListener(_0x910e('0x6')+_0x19f7bb,_0x27afec);CmListEvents['on'](_0x19f7bb,_0x7d5a04);}}; \ No newline at end of file +var _0xdc6d=['update','emit','removeListener','register','./cmList.events','save','remove'];(function(_0x47bc56,_0x3f0423){var _0x5c4f5f=function(_0x13ac23){while(--_0x13ac23){_0x47bc56['push'](_0x47bc56['shift']());}};_0x5c4f5f(++_0x3f0423);}(_0xdc6d,0x1bd));var _0xddc6=function(_0x216c53,_0x135d35){_0x216c53=_0x216c53-0x0;var _0x3b95d1=_0xdc6d[_0x216c53];return _0x3b95d1;};'use strict';var CmListEvents=require(_0xddc6('0x0'));var events=[_0xddc6('0x1'),_0xddc6('0x2'),_0xddc6('0x3')];function createListener(_0x2199f6,_0x4a9bc7){return function(_0x3c5690){_0x4a9bc7[_0xddc6('0x4')](_0x2199f6,_0x3c5690);};}function removeListener(_0x37fc8e,_0x1124bc){return function(){CmListEvents[_0xddc6('0x5')](_0x37fc8e,_0x1124bc);};}exports[_0xddc6('0x6')]=function(_0x3c0445){for(var _0x1e40fd=0x0,_0x221ee9=events['length'];_0x1e40fd<_0x221ee9;_0x1e40fd++){var _0x5d40fe=events[_0x1e40fd];var _0x245402=createListener('cmList:'+_0x5d40fe,_0x3c0445);CmListEvents['on'](_0x5d40fe,_0x245402);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9666b90..cba3629 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 _0xa671=['index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create','post','addContacts','addAgents','put','update','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x2e72ab,_0x1f4e39){var _0x581706=function(_0x102cc4){while(--_0x102cc4){_0x2e72ab['push'](_0x2e72ab['shift']());}};_0x581706(++_0x1f4e39);}(_0xa671,0x1a4));var _0x1a67=function(_0x13fdf5,_0x219c79){_0x13fdf5=_0x13fdf5-0x0;var _0x875d04=_0xa671[_0x13fdf5];return _0x875d04;};'use strict';var multer=require('multer');var util=require(_0x1a67('0x0'));var path=require(_0x1a67('0x1'));var timeout=require(_0x1a67('0x2'));var express=require(_0x1a67('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a67('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1a67('0x5'));var controller=require(_0x1a67('0x6'));router[_0x1a67('0x7')]('/',auth[_0x1a67('0x8')](),controller[_0x1a67('0x9')]);router['get'](_0x1a67('0xa'),auth[_0x1a67('0x8')](),controller[_0x1a67('0xb')]);router[_0x1a67('0x7')](_0x1a67('0xc'),auth[_0x1a67('0x8')](),controller[_0x1a67('0xd')]);router[_0x1a67('0x7')](_0x1a67('0xe'),auth[_0x1a67('0x8')](),controller[_0x1a67('0xf')]);router[_0x1a67('0x7')](_0x1a67('0x10'),auth[_0x1a67('0x8')](),controller['getDispositions']);router[_0x1a67('0x7')](_0x1a67('0x11'),auth[_0x1a67('0x8')](),controller['getContacts']);router['get'](_0x1a67('0x12'),auth['isAuthenticated'](),controller[_0x1a67('0x13')]);router['get'](_0x1a67('0x14'),auth['isAuthenticated'](),controller[_0x1a67('0x15')]);router['get'](_0x1a67('0x16'),auth[_0x1a67('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x1a67('0x17')]);router[_0x1a67('0x18')](_0x1a67('0x10'),auth[_0x1a67('0x8')](),controller['addDisposition']);router[_0x1a67('0x18')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x1a67('0x19')]);router[_0x1a67('0x18')](_0x1a67('0x14'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x1a67('0x18')](_0x1a67('0x16'),auth[_0x1a67('0x8')](),controller[_0x1a67('0x1a')]);router[_0x1a67('0x1b')](_0x1a67('0xe'),auth[_0x1a67('0x8')](),controller[_0x1a67('0x1c')]);router[_0x1a67('0x1d')](_0x1a67('0xe'),auth[_0x1a67('0x8')](),controller['destroy']);router[_0x1a67('0x1d')](_0x1a67('0x10'),auth['isAuthenticated'](),controller[_0x1a67('0x1e')]);router[_0x1a67('0x1d')]('/:id/users',auth[_0x1a67('0x8')](),controller[_0x1a67('0x1f')]);module[_0x1a67('0x20')]=router; \ No newline at end of file +var _0xa639=['/:id/fields','getCustomFields','/:id/users','getAgents','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/describe','describe','get','/global_fields','show','getDispositions','/:id/contacts','/:id/contacts/csv'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa639,0x187));var _0x9a63=function(_0x4080f4,_0x5a2562){_0x4080f4=_0x4080f4-0x0;var _0x5e6dd4=_0xa639[_0x4080f4];return _0x5e6dd4;};'use strict';var multer=require(_0x9a63('0x0'));var util=require(_0x9a63('0x1'));var path=require(_0x9a63('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a63('0x3'));var router=express[_0x9a63('0x4')]();var fs_extra=require(_0x9a63('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a63('0x6'));var controller=require('./cmList.controller');router['get']('/',auth[_0x9a63('0x7')](),controller[_0x9a63('0x8')]);router['get'](_0x9a63('0x9'),auth[_0x9a63('0x7')](),controller[_0x9a63('0xa')]);router[_0x9a63('0xb')](_0x9a63('0xc'),auth[_0x9a63('0x7')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0x9a63('0x7')](),controller[_0x9a63('0xd')]);router[_0x9a63('0xb')]('/:id/dispositions',auth[_0x9a63('0x7')](),controller[_0x9a63('0xe')]);router[_0x9a63('0xb')](_0x9a63('0xf'),auth[_0x9a63('0x7')](),controller['getContacts']);router[_0x9a63('0xb')](_0x9a63('0x10'),auth[_0x9a63('0x7')](),controller['getContactsCsv']);router['get'](_0x9a63('0x11'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x12')]);router[_0x9a63('0xb')](_0x9a63('0x13'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x14')]);router['post']('/',auth[_0x9a63('0x7')](),controller[_0x9a63('0x15')]);router['post'](_0x9a63('0x16'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x17')]);router['post'](_0x9a63('0xf'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x18')]);router['post']('/:id/fields',auth[_0x9a63('0x7')](),controller[_0x9a63('0x19')]);router['post'](_0x9a63('0x13'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x1a')]);router[_0x9a63('0x1b')](_0x9a63('0x1c'),auth['isAuthenticated'](),controller[_0x9a63('0x1d')]);router['delete'](_0x9a63('0x1c'),auth[_0x9a63('0x7')](),controller['destroy']);router[_0x9a63('0x1e')](_0x9a63('0x16'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x1f')]);router[_0x9a63('0x1e')](_0x9a63('0x13'),auth[_0x9a63('0x7')](),controller[_0x9a63('0x20')]);module[_0x9a63('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index af18058..edf282b 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 _0x6ee5=['exports','STRING','sequelize'];(function(_0x5c517f,_0x5ac8eb){var _0x3933e6=function(_0x410fb4){while(--_0x410fb4){_0x5c517f['push'](_0x5c517f['shift']());}};_0x3933e6(++_0x5ac8eb);}(_0x6ee5,0x1a3));var _0x56ee=function(_0x26eb3d,_0x15d60c){_0x26eb3d=_0x26eb3d-0x0;var _0xb837e=_0x6ee5[_0x26eb3d];return _0xb837e;};'use strict';var Sequelize=require(_0x56ee('0x0'));module[_0x56ee('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b08c1){return this['getDataValue']('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x56ee('0x2')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x95e4=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x38833f,_0x3aea52){var _0x34144a=function(_0x3fda8d){while(--_0x3fda8d){_0x38833f['push'](_0x38833f['shift']());}};_0x34144a(++_0x3aea52);}(_0x95e4,0x117));var _0x495e=function(_0x38874d,_0x32485d){_0x38874d=_0x38874d-0x0;var _0x4dd0d6=_0x95e4[_0x38874d];return _0x4dd0d6;};'use strict';var Sequelize=require(_0x495e('0x0'));module[_0x495e('0x1')]={'name':{'type':Sequelize[_0x495e('0x2')],'get':function(_0x3940ae){return this[_0x495e('0x3')](_0x495e('0x4'));}},'field':{'type':Sequelize[_0x495e('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x495e('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x495e('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 54e9e9a..71fdfc1 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(_0x34255e,_0x2f3f79){var _0x1d7d1f=function(_0x39094a){while(--_0x39094a){_0x34255e['push'](_0x34255e['shift']());}};_0x1d7d1f(++_0x2f3f79);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3b452a,_0x396265){var _0x36403b=function(_0x272bac){while(--_0x272bac){_0x3b452a['push'](_0x3b452a['shift']());}};_0x36403b(++_0x396265);}(_0x7a54,0x106));var _0x47a5=function(_0xe70690,_0x13dcbb){_0xe70690=_0xe70690-0x0;var _0x145c02=_0x7a54[_0xe70690];return _0x145c02;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index faa247c..afc2a9a 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 _0xe8e2=['exports','define','Condition','tools_conditions','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xe8e2,0x190));var _0x2e8e=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xe8e2[_0x44bcb0];return _0xfaf881;};'use strict';var _=require('lodash');var util=require(_0x2e8e('0x0'));var logger=require('../../config/logger')(_0x2e8e('0x1'));var moment=require(_0x2e8e('0x2'));var BPromise=require(_0x2e8e('0x3'));var rp=require(_0x2e8e('0x4'));var fs=require('fs');var path=require(_0x2e8e('0x5'));var rimraf=require(_0x2e8e('0x6'));var config=require(_0x2e8e('0x7'));var attributes=require('./condition.attributes');module[_0x2e8e('0x8')]=function(_0x60c9be,_0x5a8f13){return _0x60c9be[_0x2e8e('0x9')](_0x2e8e('0xa'),attributes,{'tableName':_0x2e8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40df=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3add33,_0x371dff){var _0x32b53d=function(_0x349392){while(--_0x349392){_0x3add33['push'](_0x3add33['shift']());}};_0x32b53d(++_0x371dff);}(_0x40df,0xe4));var _0xf40d=function(_0x4c953b,_0x5cd20d){_0x4c953b=_0x4c953b-0x0;var _0x1d4a5f=_0x40df[_0x4c953b];return _0x1d4a5f;};'use strict';var _=require(_0xf40d('0x0'));var util=require('util');var logger=require(_0xf40d('0x1'))(_0xf40d('0x2'));var moment=require(_0xf40d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf40d('0x4'));var fs=require('fs');var path=require(_0xf40d('0x5'));var rimraf=require(_0xf40d('0x6'));var config=require(_0xf40d('0x7'));var attributes=require(_0xf40d('0x8'));module[_0xf40d('0x9')]=function(_0x5baeb3,_0x29e505){return _0x5baeb3[_0xf40d('0xa')](_0xf40d('0xb'),attributes,{'tableName':_0xf40d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index ddf80f0..adb4b5a 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 _0x13d7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x203282,_0x5f019f){var _0x18d688=function(_0x4c1cee){while(--_0x4c1cee){_0x203282['push'](_0x203282['shift']());}};_0x18d688(++_0x5f019f);}(_0x13d7,0x1ad));var _0x713d=function(_0x4d15ee,_0x31ec26){_0x4d15ee=_0x4d15ee-0x0;var _0x366020=_0x13d7[_0x4d15ee];return _0x366020;};'use strict';var _=require(_0x713d('0x0'));var util=require('util');var moment=require(_0x713d('0x1'));var BPromise=require(_0x713d('0x2'));var rs=require(_0x713d('0x3'));var fs=require('fs');var Redis=require(_0x713d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x713d('0x5'));var logger=require(_0x713d('0x6'))(_0x713d('0x7'));var config=require(_0x713d('0x8'));var jayson=require(_0x713d('0x9'));var client=jayson[_0x713d('0xa')][_0x713d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6ead,_0x25e77f,_0x2d60dd){return new BPromise(function(_0x5ab338,_0x11e03e){return client[_0x713d('0xc')](_0x3a6ead,_0x2d60dd)[_0x713d('0xd')](function(_0x442a07){logger[_0x713d('0xe')](_0x713d('0xf'),_0x25e77f,_0x713d('0x10'));logger[_0x713d('0x11')](_0x713d('0x12'),_0x25e77f,_0x713d('0x10'),JSON[_0x713d('0x13')](_0x442a07));if(_0x442a07[_0x713d('0x14')]){if(_0x442a07[_0x713d('0x14')][_0x713d('0x15')]===0x1f4){logger[_0x713d('0x14')](_0x713d('0xf'),_0x25e77f,_0x442a07[_0x713d('0x14')][_0x713d('0x16')]);return _0x11e03e(_0x442a07[_0x713d('0x14')][_0x713d('0x16')]);}logger[_0x713d('0x14')]('Condition,\x20%s,\x20%s',_0x25e77f,_0x442a07['error'][_0x713d('0x16')]);return _0x5ab338(_0x442a07[_0x713d('0x14')][_0x713d('0x16')]);}else{logger['info'](_0x713d('0xf'),_0x25e77f,_0x713d('0x10'));_0x5ab338(_0x442a07[_0x713d('0x17')][_0x713d('0x16')]);}})['catch'](function(_0x5332dc){logger[_0x713d('0x14')](_0x713d('0xf'),_0x25e77f,_0x5332dc);_0x11e03e(_0x5332dc);});});} \ No newline at end of file +var _0xd897=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x2c5b5e,_0x5efb91){var _0x5b6deb=function(_0x169b2b){while(--_0x169b2b){_0x2c5b5e['push'](_0x2c5b5e['shift']());}};_0x5b6deb(++_0x5efb91);}(_0xd897,0xeb));var _0x7d89=function(_0x50b196,_0x9f29){_0x50b196=_0x50b196-0x0;var _0x2ffc55=_0xd897[_0x50b196];return _0x2ffc55;};'use strict';var _=require('lodash');var util=require(_0x7d89('0x0'));var moment=require(_0x7d89('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d89('0x2'));var db=require(_0x7d89('0x3'))['db'];var utils=require(_0x7d89('0x4'));var logger=require(_0x7d89('0x5'))(_0x7d89('0x6'));var config=require(_0x7d89('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xea2214,_0x364de2,_0x3b94e7){return new BPromise(function(_0x239d89,_0x1390f6){return client[_0x7d89('0x8')](_0xea2214,_0x3b94e7)['then'](function(_0x439289){logger[_0x7d89('0x9')](_0x7d89('0xa'),_0x364de2,'request\x20sent');logger[_0x7d89('0xb')](_0x7d89('0xc'),_0x364de2,_0x7d89('0xd'),JSON['stringify'](_0x439289));if(_0x439289['error']){if(_0x439289['error'][_0x7d89('0xe')]===0x1f4){logger[_0x7d89('0xf')](_0x7d89('0xa'),_0x364de2,_0x439289['error']['message']);return _0x1390f6(_0x439289[_0x7d89('0xf')]['message']);}logger['error'](_0x7d89('0xa'),_0x364de2,_0x439289[_0x7d89('0xf')][_0x7d89('0x10')]);return _0x239d89(_0x439289[_0x7d89('0xf')][_0x7d89('0x10')]);}else{logger[_0x7d89('0x9')](_0x7d89('0xa'),_0x364de2,_0x7d89('0xd'));_0x239d89(_0x439289['result'][_0x7d89('0x10')]);}})[_0x7d89('0x11')](function(_0x29cdf2){logger[_0x7d89('0xf')](_0x7d89('0xa'),_0x364de2,_0x29cdf2);_0x1390f6(_0x29cdf2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5ef664f..892c98d 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 _0x5ca5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5ca5,0x9b));var _0x55ca=function(_0x8deb39,_0x15dd7d){_0x8deb39=_0x8deb39-0x0;var _0x319446=_0x5ca5[_0x8deb39];return _0x319446;};'use strict';var multer=require(_0x55ca('0x0'));var util=require(_0x55ca('0x1'));var path=require(_0x55ca('0x2'));var timeout=require(_0x55ca('0x3'));var express=require(_0x55ca('0x4'));var router=express[_0x55ca('0x5')]();var fs_extra=require(_0x55ca('0x6'));var auth=require(_0x55ca('0x7'));var interaction=require(_0x55ca('0x8'));var config=require(_0x55ca('0x9'));var controller=require(_0x55ca('0xa'));router[_0x55ca('0xb')](_0x55ca('0xc'),auth[_0x55ca('0xd')](),controller[_0x55ca('0xe')]);router[_0x55ca('0xf')](_0x55ca('0xc'),auth['isAuthenticated'](),controller[_0x55ca('0x10')]);module[_0x55ca('0x11')]=router; \ No newline at end of file +var _0xdba0=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','exports','multer','path'];(function(_0x129b52,_0x29a8f3){var _0x5e0266=function(_0x4ffc13){while(--_0x4ffc13){_0x129b52['push'](_0x129b52['shift']());}};_0x5e0266(++_0x29a8f3);}(_0xdba0,0xa7));var _0x0dba=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0xdba0[_0x369534];return _0x524bf9;};'use strict';var multer=require(_0x0dba('0x0'));var util=require('util');var path=require(_0x0dba('0x1'));var timeout=require(_0x0dba('0x2'));var express=require(_0x0dba('0x3'));var router=express['Router']();var fs_extra=require(_0x0dba('0x4'));var auth=require(_0x0dba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dba('0x6'));var controller=require('./condition.controller');router[_0x0dba('0x7')](_0x0dba('0x8'),auth[_0x0dba('0x9')](),controller[_0x0dba('0xa')]);router[_0x0dba('0xb')](_0x0dba('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x0dba('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index d8b67f5..4d821ff 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 _0xdf31=['INTEGER','sequelize','exports','STRING'];(function(_0x2e80b3,_0x1f73e2){var _0x1269b5=function(_0x322d9a){while(--_0x322d9a){_0x2e80b3['push'](_0x2e80b3['shift']());}};_0x1269b5(++_0x1f73e2);}(_0xdf31,0x13d));var _0x1df3=function(_0x1f3bdd,_0x5a979f){_0x1f3bdd=_0x1f3bdd-0x0;var _0x967e44=_0xdf31[_0x1f3bdd];return _0x967e44;};'use strict';var Sequelize=require(_0x1df3('0x0'));module[_0x1df3('0x1')]={'name':{'type':Sequelize[_0x1df3('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x1df3('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1df3('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0c7c=['sequelize','exports','STRING','INTEGER'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x0c7c,0x134));var _0xc0c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c7c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0c7('0x0'));module[_0xc0c7('0x1')]={'name':{'type':Sequelize[_0xc0c7('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xc0c7('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc0c7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index ad51e24..c82dcd2 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 _0x0424=['rows','catch','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x3b6380,_0x4946af){var _0xfecf30=function(_0x354ed9){while(--_0x354ed9){_0x3b6380['push'](_0x3b6380['shift']());}};_0xfecf30(++_0x4946af);}(_0x0424,0x159));var _0x4042=function(_0x29cf89,_0x10ce1f){_0x29cf89=_0x29cf89-0x0;var _0x34ac61=_0x0424[_0x29cf89];return _0x34ac61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){var _0x2c5fcf=_0x1daee8[_0x4042('0x25')]({'plain':!![]});var _0x5d5c6d=_0x4042('0x26');return db[_0x4042('0x27')][_0x4042('0x28')]({'where':{'type':_0x5d5c6d,'resourceId':_0x2c5fcf['id']}})[_0x4042('0x24')](function(){return _0x1daee8;});})[_0x4042('0x24')](function(){_0x6d12a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8d48,_0x1acdf2){return function(_0x26542c){if(!_0x26542c){_0x1d8d48[_0x4042('0x17')](0x194);}return _0x26542c;};}function handleError(_0x332fe3,_0x473a0d){_0x473a0d=_0x473a0d||0x1f4;return function(_0x5eb84b){logger[_0x4042('0x29')](_0x5eb84b[_0x4042('0x2a')]);if(_0x5eb84b['name']){delete _0x5eb84b[_0x4042('0x2b')];}_0x332fe3[_0x4042('0x18')](_0x473a0d)[_0x4042('0x2c')](_0x5eb84b);};}exports['index']=function(_0x56d49a,_0x3d1f48){var _0x43bd1c={},_0x59773f={},_0x3e9304={'count':0x0,'rows':[]};var _0xc42d70=_[_0x4042('0x2d')](db[_0x4042('0x2e')][_0x4042('0x2f')],function(_0x349c74){return{'name':_0x349c74[_0x4042('0x30')],'type':_0x349c74[_0x4042('0x31')][_0x4042('0x32')]};});_0x59773f['model']=_[_0x4042('0x2d')](_0xc42d70,_0x4042('0x2b'));_0x59773f['query']=_[_0x4042('0x33')](_0x56d49a[_0x4042('0x34')]);_0x59773f['filters']=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],_0x59773f[_0x4042('0x34')]);_0x43bd1c[_0x4042('0x37')]=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],qs[_0x4042('0x38')](_0x56d49a[_0x4042('0x34')][_0x4042('0x38')]));_0x43bd1c[_0x4042('0x37')]=_0x43bd1c[_0x4042('0x37')][_0x4042('0x39')]?_0x43bd1c[_0x4042('0x37')]:_0x59773f[_0x4042('0x36')];if(!_0x56d49a[_0x4042('0x34')][_0x4042('0x3a')](_0x4042('0x3b'))){_0x43bd1c[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1d')]);_0x43bd1c['offset']=qs[_0x4042('0x1b')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1b')]);}_0x43bd1c[_0x4042('0x3c')]=qs['sort'](_0x56d49a[_0x4042('0x34')][_0x4042('0x3d')]);_0x43bd1c[_0x4042('0x3e')]=qs[_0x4042('0x3f')](_[_0x4042('0x40')](_0x56d49a[_0x4042('0x34')],_0x59773f[_0x4042('0x3f')]),_0xc42d70);if(_0x56d49a[_0x4042('0x34')][_0x4042('0x41')]){_0x43bd1c[_0x4042('0x3e')]=_['merge'](_0x43bd1c[_0x4042('0x3e')],{'$or':_[_0x4042('0x2d')](_0xc42d70,function(_0x2f07d8){if(_0x2f07d8[_0x4042('0x31')]!==_0x4042('0x42')){var _0x112e88={};_0x112e88[_0x2f07d8[_0x4042('0x2b')]]={'$like':'%'+_0x56d49a[_0x4042('0x34')]['filter']+'%'};return _0x112e88;}})});}_0x43bd1c=_['merge']({},_0x43bd1c,_0x56d49a[_0x4042('0x43')]);var _0x16468f={'where':_0x43bd1c[_0x4042('0x3e')]};return db[_0x4042('0x2e')][_0x4042('0x1e')](_0x16468f)[_0x4042('0x24')](function(_0xdfb5cb){_0x3e9304[_0x4042('0x1e')]=_0xdfb5cb;if(_0x56d49a[_0x4042('0x34')][_0x4042('0x44')]){_0x43bd1c[_0x4042('0x45')]=[{'all':!![]}];}return db[_0x4042('0x2e')]['findAll'](_0x43bd1c);})['then'](function(_0x929884){_0x3e9304[_0x4042('0x46')]=_0x929884;return _0x3e9304;})['then'](respondWithFilteredResult(_0x3d1f48,_0x43bd1c))[_0x4042('0x47')](handleError(_0x3d1f48,null));};exports['show']=function(_0x25c516,_0x411354){var _0x32ba6f={'raw':!![],'where':{'id':_0x25c516[_0x4042('0x48')]['id']}},_0x4ece0d={};_0x4ece0d[_0x4042('0x36')]=_['keys'](db[_0x4042('0x2e')][_0x4042('0x2f')]);_0x4ece0d[_0x4042('0x34')]=_[_0x4042('0x33')](_0x25c516[_0x4042('0x34')]);_0x4ece0d['filters']=_['intersection'](_0x4ece0d['model'],_0x4ece0d[_0x4042('0x34')]);_0x32ba6f[_0x4042('0x37')]=_['intersection'](_0x4ece0d['model'],qs['fields'](_0x25c516[_0x4042('0x34')]['fields']));_0x32ba6f['attributes']=_0x32ba6f[_0x4042('0x37')][_0x4042('0x39')]?_0x32ba6f[_0x4042('0x37')]:_0x4ece0d[_0x4042('0x36')];if(_0x25c516[_0x4042('0x34')][_0x4042('0x44')]){_0x32ba6f[_0x4042('0x45')]=[{'all':!![]}];}_0x32ba6f=_[_0x4042('0x49')]({},_0x32ba6f,_0x25c516[_0x4042('0x43')]);return db['ContactItemType']['find'](_0x32ba6f)['then'](handleEntityNotFound(_0x411354,null))['then'](respondWithResult(_0x411354,null))[_0x4042('0x47')](handleError(_0x411354,null));};exports[_0x4042('0x4a')]=function(_0xd898ea,_0x250434){return db[_0x4042('0x2e')][_0x4042('0x4a')](_0xd898ea[_0x4042('0x4b')],{})[_0x4042('0x24')](function(_0x4a14bd){var _0x24071a=_0xd898ea[_0x4042('0x4c')][_0x4042('0x25')]({'plain':!![]});if(!_0x24071a)throw new Error(_0x4042('0x4d'));if(_0x24071a[_0x4042('0x4e')]===_0x4042('0x4c')){var _0xf5f38a=_0x4a14bd['get']({'plain':!![]});var _0x5ed001='ContactItemTypes';return db[_0x4042('0x4f')][_0x4042('0x50')]({'where':{'name':_0x5ed001,'userProfileId':_0x24071a['userProfileId']},'raw':!![]})[_0x4042('0x24')](function(_0xa5323d){if(_0xa5323d&&_0xa5323d['autoAssociation']===0x0){return db['UserProfileResource'][_0x4042('0x4a')]({'name':_0xf5f38a[_0x4042('0x2b')],'resourceId':_0xf5f38a['id'],'type':_0xa5323d[_0x4042('0x2b')],'sectionId':_0xa5323d['id']},{})[_0x4042('0x24')](function(){return _0x4a14bd;});}else{return _0x4a14bd;}})[_0x4042('0x47')](function(_0x478645){logger[_0x4042('0x29')](_0x4042('0x51'),_0x478645);throw _0x478645;});}return _0x4a14bd;})[_0x4042('0x24')](respondWithResult(_0x250434,0xc9))[_0x4042('0x47')](handleError(_0x250434,null));};exports[_0x4042('0x23')]=function(_0xfdd409,_0x3876ce){if(_0xfdd409['body']['id']){delete _0xfdd409['body']['id'];}return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0xfdd409[_0x4042('0x48')]['id']}})['then'](handleEntityNotFound(_0x3876ce,null))[_0x4042('0x24')](saveUpdates(_0xfdd409['body'],null))[_0x4042('0x24')](respondWithResult(_0x3876ce,null))['catch'](handleError(_0x3876ce,null));};exports[_0x4042('0x28')]=function(_0x1cba67,_0x22b633){return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0x1cba67[_0x4042('0x48')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x22b633,null))[_0x4042('0x24')](db[_0x4042('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1cba67[_0x4042('0x48')]['id']}}))[_0x4042('0x24')](removeEntity(_0x22b633,null))[_0x4042('0x47')](handleError(_0x22b633,null));}; \ No newline at end of file +var _0xe5af=['rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','error','CmContactHasItem'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3a8077,_0x13fd8f){_0x3a8077=_0x3a8077-0x0;var _0x3301d8=_0xe5af[_0x3a8077];return _0x3301d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5a('0x0'));var zipdir=require(_0xfe5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5a('0x2'));var moment=require(_0xfe5a('0x3'));var BPromise=require(_0xfe5a('0x4'));var Mustache=require('mustache');var util=require(_0xfe5a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfe5a('0x6'));var ejs=require(_0xfe5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe5a('0x14'))['db'];function respondWithStatusCode(_0x9d1f4f,_0x20b206){_0x20b206=_0x20b206||0xcc;return function(_0x374ded){if(_0x374ded){return _0x9d1f4f[_0xfe5a('0x15')](_0x20b206);}return _0x9d1f4f['status'](_0x20b206)[_0xfe5a('0x16')]();};}function respondWithResult(_0x17bbbe,_0x42969b){_0x42969b=_0x42969b||0xc8;return function(_0x362115){if(_0x362115){return _0x17bbbe[_0xfe5a('0x17')](_0x42969b)[_0xfe5a('0x18')](_0x362115);}};}function respondWithFilteredResult(_0x375380,_0xeb454){return function(_0x111d4d){if(_0x111d4d){var _0x18c57b=typeof _0xeb454[_0xfe5a('0x19')]===_0xfe5a('0x1a')&&typeof _0xeb454[_0xfe5a('0x1b')]===_0xfe5a('0x1a');var _0x3edcab=_0x111d4d[_0xfe5a('0x1c')];var _0x5bf597=_0x18c57b?0x0:_0xeb454[_0xfe5a('0x19')];var _0x456707=_0x18c57b?_0x111d4d['count']:_0xeb454[_0xfe5a('0x19')]+_0xeb454[_0xfe5a('0x1b')];var _0x39d905;if(_0x456707>=_0x3edcab){_0x456707=_0x3edcab;_0x39d905=0xc8;}else{_0x39d905=0xce;}_0x375380['status'](_0x39d905);return _0x375380['set'](_0xfe5a('0x1d'),_0x5bf597+'-'+_0x456707+'/'+_0x3edcab)[_0xfe5a('0x18')](_0x111d4d);}return null;};}function patchUpdates(_0xded538){return function(_0x3b3022){try{jsonpatch[_0xfe5a('0x1e')](_0x3b3022,_0xded538,!![]);}catch(_0x355869){return BPromise['reject'](_0x355869);}return _0x3b3022[_0xfe5a('0x1f')]();};}function saveUpdates(_0x592521,_0x3dfa57){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0xfe5a('0x20')](_0x592521)['then'](function(_0x4bbef1){return _0x4bbef1;});}return null;};}function removeEntity(_0x247be4,_0x3e55fd){return function(_0x494df3){if(_0x494df3){return _0x494df3[_0xfe5a('0x21')]()[_0xfe5a('0x22')](function(){var _0x578d3e=_0x494df3[_0xfe5a('0x23')]({'plain':!![]});var _0x3a4f3c=_0xfe5a('0x24');return db[_0xfe5a('0x25')]['destroy']({'where':{'type':_0x3a4f3c,'resourceId':_0x578d3e['id']}})[_0xfe5a('0x22')](function(){return _0x494df3;});})[_0xfe5a('0x22')](function(){_0x247be4[_0xfe5a('0x17')](0xcc)[_0xfe5a('0x16')]();});}};}function handleEntityNotFound(_0x36bf20,_0x222490){return function(_0xdbf1e0){if(!_0xdbf1e0){_0x36bf20[_0xfe5a('0x15')](0x194);}return _0xdbf1e0;};}function handleError(_0x55d89e,_0x4df546){_0x4df546=_0x4df546||0x1f4;return function(_0x712b44){logger['error'](_0x712b44[_0xfe5a('0x26')]);if(_0x712b44[_0xfe5a('0x27')]){delete _0x712b44[_0xfe5a('0x27')];}_0x55d89e['status'](_0x4df546)['send'](_0x712b44);};}exports['index']=function(_0x32d31e,_0x582f2d){var _0x51d1f4={},_0x498b64={},_0x3b6e4d={'count':0x0,'rows':[]};var _0x14c66d=_[_0xfe5a('0x28')](db[_0xfe5a('0x29')][_0xfe5a('0x2a')],function(_0x286f27){return{'name':_0x286f27[_0xfe5a('0x2b')],'type':_0x286f27[_0xfe5a('0x2c')][_0xfe5a('0x2d')]};});_0x498b64[_0xfe5a('0x2e')]=_[_0xfe5a('0x28')](_0x14c66d,'name');_0x498b64[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x32d31e['query']);_0x498b64[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x498b64[_0xfe5a('0x2e')],_0x498b64[_0xfe5a('0x2f')]);_0x51d1f4[_0xfe5a('0x33')]=_['intersection'](_0x498b64['model'],qs[_0xfe5a('0x34')](_0x32d31e['query'][_0xfe5a('0x34')]));_0x51d1f4[_0xfe5a('0x33')]=_0x51d1f4[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x51d1f4['attributes']:_0x498b64[_0xfe5a('0x2e')];if(!_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x36')]('nolimit')){_0x51d1f4[_0xfe5a('0x1b')]=qs[_0xfe5a('0x1b')](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x1b')]);_0x51d1f4['offset']=qs[_0xfe5a('0x19')](_0x32d31e['query'][_0xfe5a('0x19')]);}_0x51d1f4[_0xfe5a('0x37')]=qs['sort'](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x38')]);_0x51d1f4[_0xfe5a('0x39')]=qs[_0xfe5a('0x31')](_['pick'](_0x32d31e[_0xfe5a('0x2f')],_0x498b64[_0xfe5a('0x31')]),_0x14c66d);if(_0x32d31e[_0xfe5a('0x2f')]['filter']){_0x51d1f4[_0xfe5a('0x39')]=_[_0xfe5a('0x3a')](_0x51d1f4[_0xfe5a('0x39')],{'$or':_[_0xfe5a('0x28')](_0x14c66d,function(_0xec56ad){if(_0xec56ad[_0xfe5a('0x2c')]!==_0xfe5a('0x3b')){var _0x243271={};_0x243271[_0xec56ad[_0xfe5a('0x27')]]={'$like':'%'+_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3c')]+'%'};return _0x243271;}})});}_0x51d1f4=_['merge']({},_0x51d1f4,_0x32d31e[_0xfe5a('0x3d')]);var _0x315396={'where':_0x51d1f4[_0xfe5a('0x39')]};return db[_0xfe5a('0x29')][_0xfe5a('0x1c')](_0x315396)[_0xfe5a('0x22')](function(_0x3475fb){_0x3b6e4d['count']=_0x3475fb;if(_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x51d1f4['include']=[{'all':!![]}];}return db['ContactItemType'][_0xfe5a('0x3f')](_0x51d1f4);})['then'](function(_0x54096d){_0x3b6e4d[_0xfe5a('0x40')]=_0x54096d;return _0x3b6e4d;})[_0xfe5a('0x22')](respondWithFilteredResult(_0x582f2d,_0x51d1f4))['catch'](handleError(_0x582f2d,null));};exports[_0xfe5a('0x41')]=function(_0x5a9c92,_0x5112a9){var _0x1dbb2c={'raw':!![],'where':{'id':_0x5a9c92[_0xfe5a('0x42')]['id']}},_0x1a92ef={};_0x1a92ef[_0xfe5a('0x2e')]=_[_0xfe5a('0x30')](db['ContactItemType'][_0xfe5a('0x2a')]);_0x1a92ef[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x5a9c92[_0xfe5a('0x2f')]);_0x1a92ef[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],_0x1a92ef[_0xfe5a('0x2f')]);_0x1dbb2c[_0xfe5a('0x33')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],qs[_0xfe5a('0x34')](_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x34')]));_0x1dbb2c['attributes']=_0x1dbb2c[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x1dbb2c['attributes']:_0x1a92ef['model'];if(_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x1dbb2c[_0xfe5a('0x43')]=[{'all':!![]}];}_0x1dbb2c=_[_0xfe5a('0x3a')]({},_0x1dbb2c,_0x5a9c92[_0xfe5a('0x3d')]);return db[_0xfe5a('0x29')][_0xfe5a('0x44')](_0x1dbb2c)['then'](handleEntityNotFound(_0x5112a9,null))[_0xfe5a('0x22')](respondWithResult(_0x5112a9,null))['catch'](handleError(_0x5112a9,null));};exports[_0xfe5a('0x45')]=function(_0x5a807e,_0x433562){return db[_0xfe5a('0x29')][_0xfe5a('0x45')](_0x5a807e[_0xfe5a('0x46')],{})['then'](function(_0x394073){var _0x3f8447=_0x5a807e['user'][_0xfe5a('0x23')]({'plain':!![]});if(!_0x3f8447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8447['role']===_0xfe5a('0x47')){var _0x4e02c9=_0x394073[_0xfe5a('0x23')]({'plain':!![]});var _0x4536ba=_0xfe5a('0x24');return db[_0xfe5a('0x48')]['find']({'where':{'name':_0x4536ba,'userProfileId':_0x3f8447[_0xfe5a('0x49')]},'raw':!![]})['then'](function(_0x34247f){if(_0x34247f&&_0x34247f[_0xfe5a('0x4a')]===0x0){return db[_0xfe5a('0x25')]['create']({'name':_0x4e02c9[_0xfe5a('0x27')],'resourceId':_0x4e02c9['id'],'type':_0x34247f[_0xfe5a('0x27')],'sectionId':_0x34247f['id']},{})['then'](function(){return _0x394073;});}else{return _0x394073;}})[_0xfe5a('0x4b')](function(_0x42f2e2){logger[_0xfe5a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42f2e2);throw _0x42f2e2;});}return _0x394073;})[_0xfe5a('0x22')](respondWithResult(_0x433562,0xc9))[_0xfe5a('0x4b')](handleError(_0x433562,null));};exports[_0xfe5a('0x20')]=function(_0x4d3bd8,_0x36395a){if(_0x4d3bd8[_0xfe5a('0x46')]['id']){delete _0x4d3bd8['body']['id'];}return db[_0xfe5a('0x29')]['find']({'where':{'id':_0x4d3bd8[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x36395a,null))[_0xfe5a('0x22')](saveUpdates(_0x4d3bd8[_0xfe5a('0x46')],null))[_0xfe5a('0x22')](respondWithResult(_0x36395a,null))[_0xfe5a('0x4b')](handleError(_0x36395a,null));};exports[_0xfe5a('0x21')]=function(_0x3432d1,_0x127a9f){return db[_0xfe5a('0x29')][_0xfe5a('0x44')]({'where':{'id':_0x3432d1[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x127a9f,null))[_0xfe5a('0x22')](db[_0xfe5a('0x4d')][_0xfe5a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3432d1['params']['id']}}))[_0xfe5a('0x22')](removeEntity(_0x127a9f,null))[_0xfe5a('0x4b')](handleError(_0x127a9f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2803d2f..1cccfbf 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 _0xdf87=['tools_contact_item_types','util','moment','request-promise','../../config/environment','./contactItemType.attributes','define','ContactItemType'];(function(_0x5d998b,_0x465063){var _0x7062e0=function(_0x22d455){while(--_0x22d455){_0x5d998b['push'](_0x5d998b['shift']());}};_0x7062e0(++_0x465063);}(_0xdf87,0xb9));var _0x7df8=function(_0x39d7b6,_0x5b695a){_0x39d7b6=_0x39d7b6-0x0;var _0x11a804=_0xdf87[_0x39d7b6];return _0x11a804;};'use strict';var _=require('lodash');var util=require(_0x7df8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7df8('0x1'));var BPromise=require('bluebird');var rp=require(_0x7df8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7df8('0x3'));var attributes=require(_0x7df8('0x4'));module['exports']=function(_0xd81118,_0x46035f){return _0xd81118[_0x7df8('0x5')](_0x7df8('0x6'),attributes,{'tableName':_0x7df8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf8=['./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x344e99,_0x530098){var _0x172d28=function(_0x1e68f4){while(--_0x1e68f4){_0x344e99['push'](_0x344e99['shift']());}};_0x172d28(++_0x530098);}(_0xdbf8,0x78));var _0x8dbf=function(_0x2e2157,_0x36d949){_0x2e2157=_0x2e2157-0x0;var _0x5cc22d=_0xdbf8[_0x2e2157];return _0x5cc22d;};'use strict';var _=require(_0x8dbf('0x0'));var util=require(_0x8dbf('0x1'));var logger=require(_0x8dbf('0x2'))(_0x8dbf('0x3'));var moment=require(_0x8dbf('0x4'));var BPromise=require(_0x8dbf('0x5'));var rp=require(_0x8dbf('0x6'));var fs=require('fs');var path=require(_0x8dbf('0x7'));var rimraf=require(_0x8dbf('0x8'));var config=require(_0x8dbf('0x9'));var attributes=require(_0x8dbf('0xa'));module['exports']=function(_0x1d0a54,_0x413684){return _0x1d0a54['define'](_0x8dbf('0xb'),attributes,{'tableName':_0x8dbf('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 1990eec..602a72f 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 _0x58b6=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','request','ContactItemType,\x20%s,\x20%s'];(function(_0x574de6,_0x558a28){var _0x4008d9=function(_0xd5b327){while(--_0xd5b327){_0x574de6['push'](_0x574de6['shift']());}};_0x4008d9(++_0x558a28);}(_0x58b6,0x138));var _0x658b=function(_0x13fb96,_0x42cc97){_0x13fb96=_0x13fb96-0x0;var _0x228619=_0x58b6[_0x13fb96];return _0x228619;};'use strict';var _=require(_0x658b('0x0'));var util=require(_0x658b('0x1'));var moment=require(_0x658b('0x2'));var BPromise=require(_0x658b('0x3'));var rs=require(_0x658b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x658b('0x5'))(_0x658b('0x6'));var config=require(_0x658b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x658b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a3dc6,_0x709fe0,_0x2605b2){return new BPromise(function(_0x100b83,_0xfd9f90){return client[_0x658b('0x9')](_0x5a3dc6,_0x2605b2)['then'](function(_0x37d0f1){logger['info'](_0x658b('0xa'),_0x709fe0,_0x658b('0xb'));logger[_0x658b('0xc')](_0x658b('0xd'),_0x709fe0,_0x658b('0xb'),JSON['stringify'](_0x37d0f1));if(_0x37d0f1[_0x658b('0xe')]){if(_0x37d0f1[_0x658b('0xe')][_0x658b('0xf')]===0x1f4){logger[_0x658b('0xe')](_0x658b('0xa'),_0x709fe0,_0x37d0f1['error'][_0x658b('0x10')]);return _0xfd9f90(_0x37d0f1['error'][_0x658b('0x10')]);}logger[_0x658b('0xe')]('ContactItemType,\x20%s,\x20%s',_0x709fe0,_0x37d0f1[_0x658b('0xe')][_0x658b('0x10')]);return _0x100b83(_0x37d0f1[_0x658b('0xe')][_0x658b('0x10')]);}else{logger[_0x658b('0x11')](_0x658b('0xa'),_0x709fe0,_0x658b('0xb'));_0x100b83(_0x37d0f1[_0x658b('0x12')][_0x658b('0x10')]);}})['catch'](function(_0x12bfb7){logger[_0x658b('0xe')](_0x658b('0xa'),_0x709fe0,_0x12bfb7);_0xfd9f90(_0x12bfb7);});});} \ No newline at end of file +var _0x6802=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0xdfcf22,_0x322509){var _0x59b62f=function(_0x3a745f){while(--_0x3a745f){_0xdfcf22['push'](_0xdfcf22['shift']());}};_0x59b62f(++_0x322509);}(_0x6802,0x123));var _0x2680=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x6802[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x2680('0x0'));var util=require(_0x2680('0x1'));var moment=require(_0x2680('0x2'));var BPromise=require('bluebird');var rs=require(_0x2680('0x3'));var fs=require('fs');var Redis=require(_0x2680('0x4'));var db=require(_0x2680('0x5'))['db'];var utils=require(_0x2680('0x6'));var logger=require('../../config/logger')(_0x2680('0x7'));var config=require(_0x2680('0x8'));var jayson=require(_0x2680('0x9'));var client=jayson[_0x2680('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17c55,_0x2cfabe,_0x3de846){return new BPromise(function(_0x158221,_0x11df40){return client[_0x2680('0xb')](_0x17c55,_0x3de846)['then'](function(_0xb63161){logger['info'](_0x2680('0xc'),_0x2cfabe,_0x2680('0xd'));logger[_0x2680('0xe')](_0x2680('0xf'),_0x2cfabe,_0x2680('0xd'),JSON[_0x2680('0x10')](_0xb63161));if(_0xb63161['error']){if(_0xb63161[_0x2680('0x11')][_0x2680('0x12')]===0x1f4){logger['error'](_0x2680('0xc'),_0x2cfabe,_0xb63161['error']['message']);return _0x11df40(_0xb63161['error']['message']);}logger[_0x2680('0x11')](_0x2680('0xc'),_0x2cfabe,_0xb63161['error'][_0x2680('0x13')]);return _0x158221(_0xb63161[_0x2680('0x11')][_0x2680('0x13')]);}else{logger['info'](_0x2680('0xc'),_0x2cfabe,_0x2680('0xd'));_0x158221(_0xb63161[_0x2680('0x14')]['message']);}})['catch'](function(_0x23130f){logger[_0x2680('0x11')](_0x2680('0xc'),_0x2cfabe,_0x23130f);_0x11df40(_0x23130f);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e520b84..788acd5 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 _0x837b=['post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x837b,0xd5));var _0xb837=function(_0x5cf52f,_0x2304cc){_0x5cf52f=_0x5cf52f-0x0;var _0x5b4b76=_0x837b[_0x5cf52f];return _0x5b4b76;};'use strict';var multer=require(_0xb837('0x0'));var util=require(_0xb837('0x1'));var path=require(_0xb837('0x2'));var timeout=require(_0xb837('0x3'));var express=require('express');var router=express[_0xb837('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb837('0x5'));var interaction=require(_0xb837('0x6'));var config=require(_0xb837('0x7'));var controller=require('./contactItemType.controller');router[_0xb837('0x8')]('/',auth[_0xb837('0x9')](),controller['index']);router[_0xb837('0x8')](_0xb837('0xa'),auth[_0xb837('0x9')](),controller['show']);router[_0xb837('0xb')]('/',auth[_0xb837('0x9')](),controller[_0xb837('0xc')]);router[_0xb837('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb837('0xe')](_0xb837('0xa'),auth[_0xb837('0x9')](),controller['destroy']);module[_0xb837('0xf')]=router; \ No newline at end of file +var _0xbfb1=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index'];(function(_0x1e059c,_0x47ba64){var _0x41ca6a=function(_0x1f832d){while(--_0x1f832d){_0x1e059c['push'](_0x1e059c['shift']());}};_0x41ca6a(++_0x47ba64);}(_0xbfb1,0xf2));var _0x1bfb=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0xbfb1[_0x30780e];return _0x5b9129;};'use strict';var multer=require(_0x1bfb('0x0'));var util=require(_0x1bfb('0x1'));var path=require(_0x1bfb('0x2'));var timeout=require(_0x1bfb('0x3'));var express=require(_0x1bfb('0x4'));var router=express[_0x1bfb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1bfb('0x6'));var controller=require('./contactItemType.controller');router[_0x1bfb('0x7')]('/',auth[_0x1bfb('0x8')](),controller[_0x1bfb('0x9')]);router[_0x1bfb('0x7')](_0x1bfb('0xa'),auth[_0x1bfb('0x8')](),controller['show']);router[_0x1bfb('0xb')]('/',auth['isAuthenticated'](),controller[_0x1bfb('0xc')]);router[_0x1bfb('0xd')](_0x1bfb('0xa'),auth['isAuthenticated'](),controller[_0x1bfb('0xe')]);router[_0x1bfb('0xf')](_0x1bfb('0xa'),auth[_0x1bfb('0x8')](),controller[_0x1bfb('0x10')]);module[_0x1bfb('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9c5a7c7..cc20db5 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(_0x2d812f,_0xf98128){var _0x130ce3=function(_0x52f8f2){while(--_0x52f8f2){_0x2d812f['push'](_0x2d812f['shift']());}};_0x130ce3(++_0xf98128);}(_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(_0x26d93d,_0x1ead21){var _0xccbd33=function(_0x3049d8){while(--_0x3049d8){_0x26d93d['push'](_0x26d93d['shift']());}};_0xccbd33(++_0x1ead21);}(_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 ce18e9f..0881870 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 _0x7381=['where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','filters','pick'];(function(_0x1f9bd7,_0x5b5ba5){var _0x2a20a3=function(_0x36b007){while(--_0x36b007){_0x1f9bd7['push'](_0x1f9bd7['shift']());}};_0x2a20a3(++_0x5b5ba5);}(_0x7381,0xc1));var _0x1738=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x7381[_0x13b392];return _0x39db24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1738('0x0'));var zipdir=require(_0x1738('0x1'));var jsonpatch=require(_0x1738('0x2'));var rp=require(_0x1738('0x3'));var moment=require('moment');var BPromise=require(_0x1738('0x4'));var Mustache=require(_0x1738('0x5'));var util=require(_0x1738('0x6'));var path=require('path');var sox=require(_0x1738('0x7'));var csv=require(_0x1738('0x8'));var ejs=require(_0x1738('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1738('0xa'));var crypto=require(_0x1738('0xb'));var jsforce=require(_0x1738('0xc'));var deskjs=require(_0x1738('0xd'));var toCsv=require(_0x1738('0x8'));var querystring=require(_0x1738('0xe'));var Papa=require(_0x1738('0xf'));var Redis=require(_0x1738('0x10'));var authService=require(_0x1738('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1738('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1738('0x13'));var config=require(_0x1738('0x14'));var licenseUtil=require(_0x1738('0x15'));var db=require('../../mysqldb')['db'];config[_0x1738('0x16')]=_[_0x1738('0x17')](config[_0x1738('0x16')],{'host':_0x1738('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1738('0x19'))[_0x1738('0x1a')](socket);function respondWithStatusCode(_0x10a455,_0x4bfb97){_0x4bfb97=_0x4bfb97||0xcc;return function(_0x48f9ff){if(_0x48f9ff){return _0x10a455[_0x1738('0x1b')](_0x4bfb97);}return _0x10a455[_0x1738('0x1c')](_0x4bfb97)[_0x1738('0x1d')]();};}function respondWithResult(_0x54ed39,_0x5d82fd){_0x5d82fd=_0x5d82fd||0xc8;return function(_0x534040){if(_0x534040){return _0x54ed39[_0x1738('0x1c')](_0x5d82fd)[_0x1738('0x1e')](_0x534040);}};}function respondWithFilteredResult(_0x146e1c,_0x13f12b){return function(_0xc6e5f4){if(_0xc6e5f4){var _0xc8dd08=typeof _0x13f12b['offset']===_0x1738('0x1f')&&typeof _0x13f12b[_0x1738('0x20')]===_0x1738('0x1f');var _0x5846b2=_0xc6e5f4['count'];var _0x505c5e=_0xc8dd08?0x0:_0x13f12b[_0x1738('0x21')];var _0xaf4ea2=_0xc8dd08?_0xc6e5f4[_0x1738('0x22')]:_0x13f12b[_0x1738('0x21')]+_0x13f12b[_0x1738('0x20')];var _0x57ada9;if(_0xaf4ea2>=_0x5846b2){_0xaf4ea2=_0x5846b2;_0x57ada9=0xc8;}else{_0x57ada9=0xce;}_0x146e1c[_0x1738('0x1c')](_0x57ada9);return _0x146e1c[_0x1738('0x23')](_0x1738('0x24'),_0x505c5e+'-'+_0xaf4ea2+'/'+_0x5846b2)[_0x1738('0x1e')](_0xc6e5f4);}return null;};}function patchUpdates(_0x4a7022){return function(_0x3a567f){try{jsonpatch['apply'](_0x3a567f,_0x4a7022,!![]);}catch(_0x131272){return BPromise[_0x1738('0x25')](_0x131272);}return _0x3a567f[_0x1738('0x26')]();};}function saveUpdates(_0x5f07f9,_0x5f1545){return function(_0x30ddc2){if(_0x30ddc2){return _0x30ddc2[_0x1738('0x27')](_0x5f07f9)[_0x1738('0x28')](function(_0x85b763){return _0x85b763;});}return null;};}function removeEntity(_0x4d8418,_0x5bfdfb){return function(_0x2d1062){if(_0x2d1062){return _0x2d1062[_0x1738('0x29')]()[_0x1738('0x28')](function(){var _0x98f45d=_0x2d1062[_0x1738('0x2a')]({'plain':!![]});var _0x24e6cb=_0x1738('0x2b');return db[_0x1738('0x2c')]['destroy']({'where':{'type':_0x24e6cb,'resourceId':_0x98f45d['id']}})[_0x1738('0x28')](function(){return _0x2d1062;});})[_0x1738('0x28')](function(){_0x4d8418['status'](0xcc)[_0x1738('0x1d')]();});}};}function handleEntityNotFound(_0x1b286f,_0x582b74){return function(_0x52b4b2){if(!_0x52b4b2){_0x1b286f['sendStatus'](0x194);}return _0x52b4b2;};}function handleError(_0x8d306f,_0x230b04){_0x230b04=_0x230b04||0x1f4;return function(_0x3efa77){logger[_0x1738('0x2d')](_0x3efa77[_0x1738('0x2e')]);if(_0x3efa77[_0x1738('0x2f')]){delete _0x3efa77['name'];}_0x8d306f[_0x1738('0x1c')](_0x230b04)[_0x1738('0x30')](_0x3efa77);};}exports[_0x1738('0x31')]=function(_0x573b8b,_0x113ebc){var _0x20dea9={},_0x128bec={},_0x45c585={'count':0x0,'rows':[]};var _0x37ce98=_[_0x1738('0x32')](db[_0x1738('0x33')][_0x1738('0x34')],function(_0x1744e8){return{'name':_0x1744e8[_0x1738('0x35')],'type':_0x1744e8[_0x1738('0x36')][_0x1738('0x37')]};});_0x128bec[_0x1738('0x38')]=_[_0x1738('0x32')](_0x37ce98,_0x1738('0x2f'));_0x128bec[_0x1738('0x39')]=_[_0x1738('0x3a')](_0x573b8b['query']);_0x128bec['filters']=_['intersection'](_0x128bec[_0x1738('0x38')],_0x128bec[_0x1738('0x39')]);_0x20dea9['attributes']=_['intersection'](_0x128bec[_0x1738('0x38')],qs[_0x1738('0x3b')](_0x573b8b[_0x1738('0x39')][_0x1738('0x3b')]));_0x20dea9[_0x1738('0x3c')]=_0x20dea9[_0x1738('0x3c')][_0x1738('0x3d')]?_0x20dea9[_0x1738('0x3c')]:_0x128bec[_0x1738('0x38')];if(!_0x573b8b[_0x1738('0x39')][_0x1738('0x3e')]('nolimit')){_0x20dea9[_0x1738('0x20')]=qs[_0x1738('0x20')](_0x573b8b[_0x1738('0x39')][_0x1738('0x20')]);_0x20dea9[_0x1738('0x21')]=qs[_0x1738('0x21')](_0x573b8b[_0x1738('0x39')]['offset']);}_0x20dea9[_0x1738('0x3f')]=qs[_0x1738('0x40')](_0x573b8b[_0x1738('0x39')][_0x1738('0x40')]);_0x20dea9['where']=qs[_0x1738('0x41')](_[_0x1738('0x42')](_0x573b8b['query'],_0x128bec[_0x1738('0x41')]),_0x37ce98);if(_0x573b8b[_0x1738('0x39')]['filter']){_0x20dea9[_0x1738('0x43')]=_['merge'](_0x20dea9[_0x1738('0x43')],{'$or':_[_0x1738('0x32')](_0x37ce98,function(_0x43c0a4){if(_0x43c0a4['type']!==_0x1738('0x44')){var _0x3bd130={};_0x3bd130[_0x43c0a4[_0x1738('0x2f')]]={'$like':'%'+_0x573b8b[_0x1738('0x39')][_0x1738('0x45')]+'%'};return _0x3bd130;}})});}_0x20dea9=_[_0x1738('0x46')]({},_0x20dea9,_0x573b8b[_0x1738('0x47')]);var _0x370147={'where':_0x20dea9[_0x1738('0x43')]};return db[_0x1738('0x33')][_0x1738('0x22')](_0x370147)[_0x1738('0x28')](function(_0x4a1e8d){_0x45c585[_0x1738('0x22')]=_0x4a1e8d;if(_0x573b8b[_0x1738('0x39')]['includeAll']){_0x20dea9[_0x1738('0x48')]=[{'all':!![]}];}return db[_0x1738('0x33')][_0x1738('0x49')](_0x20dea9);})[_0x1738('0x28')](function(_0x2ec35e){_0x45c585[_0x1738('0x4a')]=_0x2ec35e;return _0x45c585;})[_0x1738('0x28')](respondWithFilteredResult(_0x113ebc,_0x20dea9))[_0x1738('0x4b')](handleError(_0x113ebc,null));};exports[_0x1738('0x4c')]=function(_0x2433fc,_0x1c3924){var _0x147ec8={'raw':![],'where':{'id':_0x2433fc[_0x1738('0x4d')]['id']}},_0x101846={};_0x101846[_0x1738('0x38')]=_[_0x1738('0x3a')](db[_0x1738('0x33')][_0x1738('0x34')]);_0x101846[_0x1738('0x39')]=_[_0x1738('0x3a')](_0x2433fc[_0x1738('0x39')]);_0x101846[_0x1738('0x41')]=_[_0x1738('0x4e')](_0x101846[_0x1738('0x38')],_0x101846[_0x1738('0x39')]);_0x147ec8['attributes']=_[_0x1738('0x4e')](_0x101846[_0x1738('0x38')],qs[_0x1738('0x3b')](_0x2433fc['query'][_0x1738('0x3b')]));_0x147ec8['attributes']=_0x147ec8[_0x1738('0x3c')][_0x1738('0x3d')]?_0x147ec8[_0x1738('0x3c')]:_0x101846['model'];if(_0x2433fc[_0x1738('0x39')][_0x1738('0x4f')]){_0x147ec8['include']=[{'all':!![]}];}_0x147ec8=_[_0x1738('0x46')]({},_0x147ec8,_0x2433fc[_0x1738('0x47')]);return db[_0x1738('0x33')][_0x1738('0x50')](_0x147ec8)[_0x1738('0x28')](handleEntityNotFound(_0x1c3924,null))[_0x1738('0x28')](respondWithResult(_0x1c3924,null))[_0x1738('0x4b')](handleError(_0x1c3924,null));};exports[_0x1738('0x51')]=function(_0x3618a4,_0x25a7a6){return db[_0x1738('0x33')][_0x1738('0x51')](_0x3618a4[_0x1738('0x52')],{})[_0x1738('0x28')](function(_0x2f5f47){var _0x5ecd70=_0x3618a4[_0x1738('0x53')][_0x1738('0x2a')]({'plain':!![]});if(!_0x5ecd70)throw new Error(_0x1738('0x54'));if(_0x5ecd70['role']==='user'){var _0x466789=_0x2f5f47[_0x1738('0x2a')]({'plain':!![]});var _0x4c0b9d='CustomDashboards';return db[_0x1738('0x55')]['find']({'where':{'name':_0x4c0b9d,'userProfileId':_0x5ecd70[_0x1738('0x56')]},'raw':!![]})[_0x1738('0x28')](function(_0x25592a){if(_0x25592a&&_0x25592a[_0x1738('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x466789[_0x1738('0x2f')],'resourceId':_0x466789['id'],'type':_0x25592a['name'],'sectionId':_0x25592a['id']},{})[_0x1738('0x28')](function(){return _0x2f5f47;});}else{return _0x2f5f47;}})[_0x1738('0x4b')](function(_0x29e6dc){logger[_0x1738('0x2d')](_0x1738('0x58'),_0x29e6dc);throw _0x29e6dc;});}return _0x2f5f47;})['then'](respondWithResult(_0x25a7a6,0xc9))[_0x1738('0x4b')](handleError(_0x25a7a6,null));};exports[_0x1738('0x59')]=function(_0xb0bc1b,_0x5e4cc9){var _0x41e9d6={'where':{'id':_0xb0bc1b['params']['id']}},_0x51af6f={};_0x51af6f[_0x1738('0x38')]=_[_0x1738('0x3a')](db[_0x1738('0x33')][_0x1738('0x34')]);_0x41e9d6[_0x1738('0x3c')]=_[_0x1738('0x4e')](_0x51af6f[_0x1738('0x38')],qs['fields'](_0xb0bc1b[_0x1738('0x39')][_0x1738('0x3b')]));_0x41e9d6[_0x1738('0x3c')]=_0x41e9d6[_0x1738('0x3c')][_0x1738('0x3d')]?_0x41e9d6[_0x1738('0x3c')]:_0x51af6f['model'];if(_0xb0bc1b[_0x1738('0x39')]['includeAll']){_0x41e9d6['include']=[{'all':!![]}];}_0x41e9d6=_['merge']({},_0x41e9d6,_0xb0bc1b[_0x1738('0x47')]);return db['Dashboard'][_0x1738('0x50')](_0x41e9d6)[_0x1738('0x28')](handleEntityNotFound(_0x5e4cc9,null))[_0x1738('0x28')](function(_0x5023f9){if(_0x5023f9){var _0x18f6fe=_0x5023f9[_0x1738('0x2a')]({'plain':!![]});_0x18f6fe=qs[_0x1738('0x5a')](_0x18f6fe,['id',_0x1738('0x5b'),_0x1738('0x5c')]);_0xb0bc1b['body']=_[_0x1738('0x5a')](_0xb0bc1b['body'],['id',_0x1738('0x5b'),_0x1738('0x5c')]);return db[_0x1738('0x33')][_0x1738('0x51')](_[_0x1738('0x46')](_0x18f6fe,_0xb0bc1b[_0x1738('0x52')]),{'include':_0xb0bc1b['query'][_0x1738('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x3ab34e){var _0x35356a=_0xb0bc1b[_0x1738('0x53')][_0x1738('0x2a')]({'plain':!![]});if(!_0x35356a)throw new Error(_0x1738('0x54'));if(_0x35356a['role']==='user'){var _0x76e9b3=_0x3ab34e[_0x1738('0x2a')]({'plain':!![]});var _0x35c1e0=_0x1738('0x2b');return db[_0x1738('0x55')][_0x1738('0x50')]({'where':{'name':_0x35c1e0,'userProfileId':_0x35356a['userProfileId']},'raw':!![]})[_0x1738('0x28')](function(_0x12e407){if(_0x12e407&&_0x12e407[_0x1738('0x57')]===0x0){return db[_0x1738('0x2c')]['create']({'name':_0x76e9b3['name'],'resourceId':_0x76e9b3['id'],'type':_0x12e407['name'],'sectionId':_0x12e407['id']},{})[_0x1738('0x28')](function(){return _0x3ab34e;});}else{return _0x3ab34e;}})[_0x1738('0x4b')](function(_0x345dfe){logger[_0x1738('0x2d')](_0x1738('0x58'),_0x345dfe);throw _0x345dfe;});}return _0x3ab34e;});}})[_0x1738('0x28')](respondWithResult(_0x5e4cc9,0xc9))[_0x1738('0x4b')](handleError(_0x5e4cc9,null));};exports['update']=function(_0x3d8854,_0x59f1fc){if(_0x3d8854[_0x1738('0x52')]['id']){delete _0x3d8854[_0x1738('0x52')]['id'];}return db[_0x1738('0x33')][_0x1738('0x50')]({'where':{'id':_0x3d8854[_0x1738('0x4d')]['id']}})[_0x1738('0x28')](handleEntityNotFound(_0x59f1fc,null))[_0x1738('0x28')](saveUpdates(_0x3d8854[_0x1738('0x52')],null))[_0x1738('0x28')](respondWithResult(_0x59f1fc,null))[_0x1738('0x4b')](handleError(_0x59f1fc,null));};exports[_0x1738('0x29')]=function(_0x1823dd,_0x58c471){return db['Dashboard']['find']({'where':{'id':_0x1823dd['params']['id']}})[_0x1738('0x28')](handleEntityNotFound(_0x58c471,null))[_0x1738('0x28')](removeEntity(_0x58c471,null))[_0x1738('0x4b')](handleError(_0x58c471,null));};function widgetAttributes(_0x183f1b){try{switch(_0x183f1b[_0x1738('0x36')]){case _0x1738('0x5d'):return[{'name':'attrUrl','value':_0x183f1b[_0x1738('0x5e')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x0]?_0x183f1b[_0x1738('0x5f')][0x0][_0x1738('0x60')]:undefined)||'https://'}];case _0x1738('0x61'):return[{'name':_0x1738('0x62'),'value':_0x183f1b[_0x1738('0x62')]||(_0x183f1b['attrs']&&_0x183f1b[_0x1738('0x5f')][0x0]?_0x183f1b['attrs'][0x0][_0x1738('0x60')]:undefined)||''}];case _0x1738('0x63'):return[{'name':_0x1738('0x64'),'value':_0x183f1b[_0x1738('0x64')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x0]?_0x183f1b[_0x1738('0x5f')][0x0][_0x1738('0x60')]:undefined)||_0x1738('0x65')},{'name':_0x1738('0x66'),'value':_0x183f1b[_0x1738('0x66')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x1]?_0x183f1b['attrs'][0x1][_0x1738('0x60')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x183f1b[_0x1738('0x67')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b['attrs'][0x2]?_0x183f1b[_0x1738('0x5f')][0x2][_0x1738('0x60')]:undefined)||0xc}];case _0x1738('0x68'):return[{'name':'attrMetric','value':_0x183f1b[_0x1738('0x69')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x0]?_0x183f1b[_0x1738('0x5f')][0x0][_0x1738('0x60')]:undefined)||_0x1738('0x6a')},{'name':'attrVoiceQueues','value':_0x183f1b[_0x1738('0x6b')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x1]?_0x183f1b['attrs'][0x1]['value']:undefined)||[]},{'name':_0x1738('0x67'),'value':_0x183f1b[_0x1738('0x67')]||(_0x183f1b['attrs']&&_0x183f1b['attrs'][0x2]?_0x183f1b[_0x1738('0x5f')][0x2][_0x1738('0x60')]:undefined)||0x14},{'name':_0x1738('0x6c'),'value':_0x183f1b[_0x1738('0x6c')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x3]?_0x183f1b[_0x1738('0x5f')][0x3]['value']:undefined)||'voice'},{'name':_0x1738('0x6d'),'value':_0x183f1b[_0x1738('0x6d')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x4]?_0x183f1b[_0x1738('0x5f')][0x4][_0x1738('0x60')]:undefined)||''},{'name':_0x1738('0x6e'),'value':_0x183f1b[_0x1738('0x6e')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x5]?_0x183f1b[_0x1738('0x5f')][0x5]['value']:undefined)||''},{'name':_0x1738('0x6f'),'value':_0x183f1b[_0x1738('0x6f')]||(_0x183f1b['attrs']&&_0x183f1b[_0x1738('0x5f')][0x6]?_0x183f1b[_0x1738('0x5f')][0x6][_0x1738('0x60')]:undefined)||''},{'name':_0x1738('0x70'),'value':_0x183f1b[_0x1738('0x70')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x7]?_0x183f1b[_0x1738('0x5f')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x183f1b[_0x1738('0x71')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x8]?_0x183f1b[_0x1738('0x5f')][0x8]['value']:undefined)||''},{'name':_0x1738('0x72'),'value':_0x183f1b[_0x1738('0x72')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x9]?_0x183f1b[_0x1738('0x5f')][0x9][_0x1738('0x60')]:undefined)||''}];case _0x1738('0x73'):case _0x1738('0x74'):return[{'name':_0x1738('0x75'),'value':_0x183f1b[_0x1738('0x75')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x0]?_0x183f1b['attrs'][0x0]['value']:undefined)||_0x1738('0x6a')},{'name':_0x1738('0x76'),'value':_0x183f1b[_0x1738('0x76')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x1]?_0x183f1b[_0x1738('0x5f')][0x1]['value']:undefined)||null},{'name':_0x1738('0x77'),'value':_0x183f1b[_0x1738('0x77')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x2]?_0x183f1b['attrs'][0x2][_0x1738('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x183f1b[_0x1738('0x6b')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x3]?_0x183f1b['attrs'][0x3]['value']:undefined)||[]},{'name':_0x1738('0x6c'),'value':_0x183f1b[_0x1738('0x6c')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x4]?_0x183f1b['attrs'][0x4][_0x1738('0x60')]:undefined)||_0x1738('0x78')},{'name':_0x1738('0x6d'),'value':_0x183f1b[_0x1738('0x6d')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x5]?_0x183f1b['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x183f1b[_0x1738('0x6e')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x6]?_0x183f1b[_0x1738('0x5f')][0x6][_0x1738('0x60')]:undefined)||''},{'name':_0x1738('0x6f'),'value':_0x183f1b['attrSmsAccounts']||(_0x183f1b['attrs']&&_0x183f1b[_0x1738('0x5f')][0x7]?_0x183f1b['attrs'][0x7][_0x1738('0x60')]:undefined)||''},{'name':_0x1738('0x70'),'value':_0x183f1b[_0x1738('0x70')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x8]?_0x183f1b[_0x1738('0x5f')][0x8][_0x1738('0x60')]:undefined)||''},{'name':_0x1738('0x71'),'value':_0x183f1b[_0x1738('0x71')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b['attrs'][0x9]?_0x183f1b[_0x1738('0x5f')][0x9][_0x1738('0x60')]:undefined)||''},{'name':_0x1738('0x72'),'value':_0x183f1b[_0x1738('0x72')]||(_0x183f1b['attrs']&&_0x183f1b[_0x1738('0x5f')][0xa]?_0x183f1b['attrs'][0xa][_0x1738('0x60')]:undefined)||''}];case'web-report':return[{'name':_0x1738('0x79'),'type':_0x183f1b['reportType']||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b['attrs'][0x0]?_0x183f1b[_0x1738('0x5f')][0x0][_0x1738('0x36')]:undefined)||null,'value':_0x183f1b[_0x1738('0x79')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x0]?_0x183f1b['attrs'][0x0][_0x1738('0x60')]:undefined)||null},{'name':_0x1738('0x7a'),'value':_0x183f1b[_0x1738('0x7a')]||(_0x183f1b[_0x1738('0x5f')]&&_0x183f1b[_0x1738('0x5f')][0x1]?_0x183f1b[_0x1738('0x5f')][0x1][_0x1738('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x26ed35){logger['error'](_0x1738('0x7b'),JSON[_0x1738('0x7c')](_0x26ed35));return[];}}exports[_0x1738('0x7d')]=function(_0x555986,_0x2b356c,_0x403ab2){if(_0x555986[_0x1738('0x52')]['id']){delete _0x555986[_0x1738('0x52')]['id'];}return db[_0x1738('0x33')][_0x1738('0x50')]({'where':{'id':_0x555986[_0x1738('0x4d')]['id']}})[_0x1738('0x28')](handleEntityNotFound(_0x2b356c,null))[_0x1738('0x28')](function(_0x47491d){if(_0x47491d){_0x555986[_0x1738('0x52')][_0x1738('0x7e')]=_0x47491d['id'];_0x555986['body']['attrs']=widgetAttributes(_0x555986[_0x1738('0x52')]);return db[_0x1738('0x7f')]['create'](_0x555986[_0x1738('0x52')]);}})[_0x1738('0x28')](respondWithResult(_0x2b356c,null))['catch'](handleError(_0x2b356c,null));};exports[_0x1738('0x80')]=function(_0x572153,_0x1ee488,_0x54828c){var _0x394980={};var _0x3682f8={};var _0xa011a;var _0xb27490;return db['Dashboard'][_0x1738('0x81')]({'where':{'id':_0x572153[_0x1738('0x4d')]['id']}})[_0x1738('0x28')](handleEntityNotFound(_0x1ee488,null))[_0x1738('0x28')](function(_0x145b26){if(_0x145b26){_0xa011a=_0x145b26;_0x3682f8[_0x1738('0x38')]=_[_0x1738('0x3a')](db['DashboardItem'][_0x1738('0x34')]);_0x3682f8[_0x1738('0x39')]=_[_0x1738('0x3a')](_0x572153['query']);_0x3682f8[_0x1738('0x41')]=_[_0x1738('0x4e')](_0x3682f8[_0x1738('0x38')],_0x3682f8[_0x1738('0x39')]);_0x394980['attributes']=_[_0x1738('0x4e')](_0x3682f8[_0x1738('0x38')],qs[_0x1738('0x3b')](_0x572153[_0x1738('0x39')][_0x1738('0x3b')]));_0x394980[_0x1738('0x3c')]=_0x394980[_0x1738('0x3c')]['length']?_0x394980['attributes']:_0x3682f8[_0x1738('0x38')];_0x394980[_0x1738('0x3f')]=qs['sort'](_0x572153[_0x1738('0x39')][_0x1738('0x40')]);_0x394980['where']=qs[_0x1738('0x41')](_[_0x1738('0x42')](_0x572153['query'],_0x3682f8['filters']));if(_0x572153['query'][_0x1738('0x45')]){_0x394980[_0x1738('0x43')]=_[_0x1738('0x46')](_0x394980[_0x1738('0x43')],{'$or':_[_0x1738('0x32')](_0x394980[_0x1738('0x3c')],function(_0xba16b2){var _0x26adfe={};_0x26adfe[_0xba16b2]={'$like':'%'+_0x572153[_0x1738('0x39')]['filter']+'%'};return _0x26adfe;})});}_0x394980=_[_0x1738('0x46')]({},_0x394980,_0x572153[_0x1738('0x47')]);return _0xa011a[_0x1738('0x80')](_0x394980);}})[_0x1738('0x28')](function(_0x53c24b){if(_0x53c24b){_0xb27490=_0x53c24b[_0x1738('0x3d')];if(!_0x572153[_0x1738('0x39')][_0x1738('0x3e')]('nolimit')){_0x394980[_0x1738('0x20')]=qs[_0x1738('0x20')](_0x572153['query']['limit']);_0x394980[_0x1738('0x21')]=qs[_0x1738('0x21')](_0x572153['query'][_0x1738('0x21')]);}return _0xa011a['getItems'](_0x394980);}})[_0x1738('0x28')](function(_0x3340f1){if(_0x3340f1){return _0x3340f1?{'count':_0xb27490,'rows':_0x3340f1}:null;}})[_0x1738('0x28')](respondWithResult(_0x1ee488,null))[_0x1738('0x4b')](handleError(_0x1ee488,null));}; \ No newline at end of file +var _0x8890=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','findOne','DashboardItem','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','user','UserProfileSection','userProfileId','autoAssociation','catch','clone','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x8890,0x124));var _0x0889=function(_0x378a32,_0x46a860){_0x378a32=_0x378a32-0x0;var _0x2b44c6=_0x8890[_0x378a32];return _0x2b44c6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0889('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0889('0x1'));var moment=require(_0x0889('0x2'));var BPromise=require(_0x0889('0x3'));var Mustache=require(_0x0889('0x4'));var util=require(_0x0889('0x5'));var path=require(_0x0889('0x6'));var sox=require(_0x0889('0x7'));var csv=require('to-csv');var ejs=require(_0x0889('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0889('0x9'));var squel=require(_0x0889('0xa'));var crypto=require(_0x0889('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0889('0xc'));var querystring=require(_0x0889('0xd'));var Papa=require('papaparse');var Redis=require(_0x0889('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0889('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0889('0x10'));var logger=require('../../config/logger')(_0x0889('0x11'));var utils=require(_0x0889('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0889('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0889('0x14')](config[_0x0889('0x15')],{'host':_0x0889('0x16'),'port':0x18eb});var socket=require(_0x0889('0x17'))(new Redis(config[_0x0889('0x15')]));require('./dashboard.socket')[_0x0889('0x18')](socket);function respondWithStatusCode(_0x4a6971,_0x3660a1){_0x3660a1=_0x3660a1||0xcc;return function(_0x409152){if(_0x409152){return _0x4a6971[_0x0889('0x19')](_0x3660a1);}return _0x4a6971[_0x0889('0x1a')](_0x3660a1)[_0x0889('0x1b')]();};}function respondWithResult(_0x30b556,_0x5361c5){_0x5361c5=_0x5361c5||0xc8;return function(_0xf2ede6){if(_0xf2ede6){return _0x30b556[_0x0889('0x1a')](_0x5361c5)[_0x0889('0x1c')](_0xf2ede6);}};}function respondWithFilteredResult(_0x329a4e,_0x30ec53){return function(_0x56cea9){if(_0x56cea9){var _0x1f420f=typeof _0x30ec53[_0x0889('0x1d')]===_0x0889('0x1e')&&typeof _0x30ec53['limit']===_0x0889('0x1e');var _0x988ba6=_0x56cea9[_0x0889('0x1f')];var _0xf05710=_0x1f420f?0x0:_0x30ec53[_0x0889('0x1d')];var _0x27bfb7=_0x1f420f?_0x56cea9[_0x0889('0x1f')]:_0x30ec53[_0x0889('0x1d')]+_0x30ec53[_0x0889('0x20')];var _0x463118;if(_0x27bfb7>=_0x988ba6){_0x27bfb7=_0x988ba6;_0x463118=0xc8;}else{_0x463118=0xce;}_0x329a4e[_0x0889('0x1a')](_0x463118);return _0x329a4e[_0x0889('0x21')](_0x0889('0x22'),_0xf05710+'-'+_0x27bfb7+'/'+_0x988ba6)[_0x0889('0x1c')](_0x56cea9);}return null;};}function patchUpdates(_0x7a2f80){return function(_0x33a49e){try{jsonpatch['apply'](_0x33a49e,_0x7a2f80,!![]);}catch(_0x38868e){return BPromise[_0x0889('0x23')](_0x38868e);}return _0x33a49e[_0x0889('0x24')]();};}function saveUpdates(_0x30acc5,_0x232323){return function(_0x175f88){if(_0x175f88){return _0x175f88['update'](_0x30acc5)[_0x0889('0x25')](function(_0x11b2c3){return _0x11b2c3;});}return null;};}function removeEntity(_0x4d89c5,_0x2a6b80){return function(_0x31b1f7){if(_0x31b1f7){return _0x31b1f7[_0x0889('0x26')]()['then'](function(){var _0x43192d=_0x31b1f7[_0x0889('0x27')]({'plain':!![]});var _0x34ab89=_0x0889('0x28');return db[_0x0889('0x29')][_0x0889('0x26')]({'where':{'type':_0x34ab89,'resourceId':_0x43192d['id']}})[_0x0889('0x25')](function(){return _0x31b1f7;});})[_0x0889('0x25')](function(){_0x4d89c5[_0x0889('0x1a')](0xcc)[_0x0889('0x1b')]();});}};}function handleEntityNotFound(_0x18f555,_0x559910){return function(_0x3a72ba){if(!_0x3a72ba){_0x18f555[_0x0889('0x19')](0x194);}return _0x3a72ba;};}function handleError(_0x257299,_0x1d05cf){_0x1d05cf=_0x1d05cf||0x1f4;return function(_0x593e97){logger[_0x0889('0x2a')](_0x593e97[_0x0889('0x2b')]);if(_0x593e97[_0x0889('0x2c')]){delete _0x593e97[_0x0889('0x2c')];}_0x257299[_0x0889('0x1a')](_0x1d05cf)['send'](_0x593e97);};}exports['index']=function(_0x4ca0e2,_0x124c82){var _0x5e71ce={},_0x2a1e78={},_0x45a2f8={'count':0x0,'rows':[]};var _0x2de950=_[_0x0889('0x2d')](db[_0x0889('0x2e')][_0x0889('0x2f')],function(_0x19b157){return{'name':_0x19b157[_0x0889('0x30')],'type':_0x19b157[_0x0889('0x31')][_0x0889('0x32')]};});_0x2a1e78['model']=_[_0x0889('0x2d')](_0x2de950,'name');_0x2a1e78[_0x0889('0x33')]=_[_0x0889('0x34')](_0x4ca0e2['query']);_0x2a1e78[_0x0889('0x35')]=_[_0x0889('0x36')](_0x2a1e78[_0x0889('0x37')],_0x2a1e78[_0x0889('0x33')]);_0x5e71ce[_0x0889('0x38')]=_['intersection'](_0x2a1e78[_0x0889('0x37')],qs[_0x0889('0x39')](_0x4ca0e2['query'][_0x0889('0x39')]));_0x5e71ce[_0x0889('0x38')]=_0x5e71ce[_0x0889('0x38')]['length']?_0x5e71ce[_0x0889('0x38')]:_0x2a1e78[_0x0889('0x37')];if(!_0x4ca0e2[_0x0889('0x33')][_0x0889('0x3a')](_0x0889('0x3b'))){_0x5e71ce['limit']=qs[_0x0889('0x20')](_0x4ca0e2[_0x0889('0x33')]['limit']);_0x5e71ce['offset']=qs[_0x0889('0x1d')](_0x4ca0e2[_0x0889('0x33')][_0x0889('0x1d')]);}_0x5e71ce[_0x0889('0x3c')]=qs['sort'](_0x4ca0e2[_0x0889('0x33')][_0x0889('0x3d')]);_0x5e71ce[_0x0889('0x3e')]=qs[_0x0889('0x35')](_[_0x0889('0x3f')](_0x4ca0e2['query'],_0x2a1e78[_0x0889('0x35')]),_0x2de950);if(_0x4ca0e2[_0x0889('0x33')]['filter']){_0x5e71ce[_0x0889('0x3e')]=_[_0x0889('0x40')](_0x5e71ce['where'],{'$or':_[_0x0889('0x2d')](_0x2de950,function(_0x4ba9b0){if(_0x4ba9b0[_0x0889('0x31')]!==_0x0889('0x41')){var _0x4f241b={};_0x4f241b[_0x4ba9b0[_0x0889('0x2c')]]={'$like':'%'+_0x4ca0e2['query'][_0x0889('0x42')]+'%'};return _0x4f241b;}})});}_0x5e71ce=_[_0x0889('0x40')]({},_0x5e71ce,_0x4ca0e2[_0x0889('0x43')]);var _0x5e56a8={'where':_0x5e71ce[_0x0889('0x3e')]};return db[_0x0889('0x2e')][_0x0889('0x1f')](_0x5e56a8)[_0x0889('0x25')](function(_0x305f1f){_0x45a2f8['count']=_0x305f1f;if(_0x4ca0e2['query'][_0x0889('0x44')]){_0x5e71ce[_0x0889('0x45')]=[{'all':!![]}];}return db[_0x0889('0x2e')][_0x0889('0x46')](_0x5e71ce);})['then'](function(_0x52a40d){_0x45a2f8[_0x0889('0x47')]=_0x52a40d;return _0x45a2f8;})[_0x0889('0x25')](respondWithFilteredResult(_0x124c82,_0x5e71ce))['catch'](handleError(_0x124c82,null));};exports[_0x0889('0x48')]=function(_0x2f4902,_0x1f534c){var _0x103e2a={'raw':![],'where':{'id':_0x2f4902[_0x0889('0x49')]['id']}},_0x562f72={};_0x562f72[_0x0889('0x37')]=_[_0x0889('0x34')](db[_0x0889('0x2e')][_0x0889('0x2f')]);_0x562f72[_0x0889('0x33')]=_[_0x0889('0x34')](_0x2f4902[_0x0889('0x33')]);_0x562f72[_0x0889('0x35')]=_[_0x0889('0x36')](_0x562f72[_0x0889('0x37')],_0x562f72[_0x0889('0x33')]);_0x103e2a['attributes']=_[_0x0889('0x36')](_0x562f72[_0x0889('0x37')],qs[_0x0889('0x39')](_0x2f4902['query'][_0x0889('0x39')]));_0x103e2a[_0x0889('0x38')]=_0x103e2a[_0x0889('0x38')][_0x0889('0x4a')]?_0x103e2a['attributes']:_0x562f72[_0x0889('0x37')];if(_0x2f4902['query']['includeAll']){_0x103e2a[_0x0889('0x45')]=[{'all':!![]}];}_0x103e2a=_['merge']({},_0x103e2a,_0x2f4902['options']);return db[_0x0889('0x2e')][_0x0889('0x4b')](_0x103e2a)['then'](handleEntityNotFound(_0x1f534c,null))[_0x0889('0x25')](respondWithResult(_0x1f534c,null))['catch'](handleError(_0x1f534c,null));};exports[_0x0889('0x4c')]=function(_0x110ca6,_0x3a68f4){return db['Dashboard'][_0x0889('0x4c')](_0x110ca6['body'],{})[_0x0889('0x25')](function(_0xaa2d8f){var _0x4517cc=_0x110ca6[_0x0889('0x4d')][_0x0889('0x27')]({'plain':!![]});if(!_0x4517cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4517cc['role']===_0x0889('0x4d')){var _0x36a8d8=_0xaa2d8f[_0x0889('0x27')]({'plain':!![]});var _0xc71075=_0x0889('0x28');return db[_0x0889('0x4e')][_0x0889('0x4b')]({'where':{'name':_0xc71075,'userProfileId':_0x4517cc[_0x0889('0x4f')]},'raw':!![]})[_0x0889('0x25')](function(_0x332d70){if(_0x332d70&&_0x332d70[_0x0889('0x50')]===0x0){return db['UserProfileResource'][_0x0889('0x4c')]({'name':_0x36a8d8[_0x0889('0x2c')],'resourceId':_0x36a8d8['id'],'type':_0x332d70[_0x0889('0x2c')],'sectionId':_0x332d70['id']},{})[_0x0889('0x25')](function(){return _0xaa2d8f;});}else{return _0xaa2d8f;}})['catch'](function(_0x455b80){logger[_0x0889('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x455b80);throw _0x455b80;});}return _0xaa2d8f;})[_0x0889('0x25')](respondWithResult(_0x3a68f4,0xc9))[_0x0889('0x51')](handleError(_0x3a68f4,null));};exports[_0x0889('0x52')]=function(_0x2122df,_0x4a6a37){var _0xd609e3={'where':{'id':_0x2122df[_0x0889('0x49')]['id']}},_0x45e01e={};_0x45e01e['model']=_[_0x0889('0x34')](db[_0x0889('0x2e')]['rawAttributes']);_0xd609e3['attributes']=_[_0x0889('0x36')](_0x45e01e[_0x0889('0x37')],qs[_0x0889('0x39')](_0x2122df[_0x0889('0x33')][_0x0889('0x39')]));_0xd609e3['attributes']=_0xd609e3[_0x0889('0x38')][_0x0889('0x4a')]?_0xd609e3[_0x0889('0x38')]:_0x45e01e['model'];if(_0x2122df[_0x0889('0x33')][_0x0889('0x44')]){_0xd609e3[_0x0889('0x45')]=[{'all':!![]}];}_0xd609e3=_[_0x0889('0x40')]({},_0xd609e3,_0x2122df['options']);return db[_0x0889('0x2e')]['find'](_0xd609e3)[_0x0889('0x25')](handleEntityNotFound(_0x4a6a37,null))[_0x0889('0x25')](function(_0x222796){if(_0x222796){var _0x21c11a=_0x222796[_0x0889('0x27')]({'plain':!![]});_0x21c11a=qs[_0x0889('0x53')](_0x21c11a,['id',_0x0889('0x54'),'updatedAt']);_0x2122df[_0x0889('0x55')]=_[_0x0889('0x53')](_0x2122df[_0x0889('0x55')],['id','createdAt',_0x0889('0x56')]);return db[_0x0889('0x2e')][_0x0889('0x4c')](_[_0x0889('0x40')](_0x21c11a,_0x2122df['body']),{'include':_0x2122df[_0x0889('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x0889('0x25')](function(_0x122bc5){var _0x4e65dc=_0x2122df[_0x0889('0x4d')]['get']({'plain':!![]});if(!_0x4e65dc)throw new Error(_0x0889('0x57'));if(_0x4e65dc[_0x0889('0x58')]===_0x0889('0x4d')){var _0x20365e=_0x122bc5[_0x0889('0x27')]({'plain':!![]});var _0x20fa46=_0x0889('0x28');return db[_0x0889('0x4e')]['find']({'where':{'name':_0x20fa46,'userProfileId':_0x4e65dc[_0x0889('0x4f')]},'raw':!![]})[_0x0889('0x25')](function(_0x45e0d0){if(_0x45e0d0&&_0x45e0d0[_0x0889('0x50')]===0x0){return db[_0x0889('0x29')][_0x0889('0x4c')]({'name':_0x20365e['name'],'resourceId':_0x20365e['id'],'type':_0x45e0d0[_0x0889('0x2c')],'sectionId':_0x45e0d0['id']},{})['then'](function(){return _0x122bc5;});}else{return _0x122bc5;}})['catch'](function(_0x27ad8a){logger['error'](_0x0889('0x59'),_0x27ad8a);throw _0x27ad8a;});}return _0x122bc5;});}})[_0x0889('0x25')](respondWithResult(_0x4a6a37,0xc9))[_0x0889('0x51')](handleError(_0x4a6a37,null));};exports['update']=function(_0x344bdd,_0x363dc2){if(_0x344bdd[_0x0889('0x55')]['id']){delete _0x344bdd[_0x0889('0x55')]['id'];}return db['Dashboard'][_0x0889('0x4b')]({'where':{'id':_0x344bdd[_0x0889('0x49')]['id']}})[_0x0889('0x25')](handleEntityNotFound(_0x363dc2,null))[_0x0889('0x25')](saveUpdates(_0x344bdd[_0x0889('0x55')],null))[_0x0889('0x25')](respondWithResult(_0x363dc2,null))[_0x0889('0x51')](handleError(_0x363dc2,null));};exports[_0x0889('0x26')]=function(_0x532142,_0x3e7eaf){return db[_0x0889('0x2e')]['find']({'where':{'id':_0x532142[_0x0889('0x49')]['id']}})[_0x0889('0x25')](handleEntityNotFound(_0x3e7eaf,null))[_0x0889('0x25')](removeEntity(_0x3e7eaf,null))[_0x0889('0x51')](handleError(_0x3e7eaf,null));};function widgetAttributes(_0x2b8cbc){try{switch(_0x2b8cbc[_0x0889('0x31')]){case _0x0889('0x5a'):return[{'name':_0x0889('0x5b'),'value':_0x2b8cbc['attrUrl']||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x0]?_0x2b8cbc[_0x0889('0x5c')][0x0][_0x0889('0x5d')]:undefined)||_0x0889('0x5e')}];case _0x0889('0x5f'):return[{'name':'attrPath','value':_0x2b8cbc[_0x0889('0x60')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x0]?_0x2b8cbc[_0x0889('0x5c')][0x0][_0x0889('0x5d')]:undefined)||''}];case _0x0889('0x61'):return[{'name':_0x0889('0x62'),'value':_0x2b8cbc[_0x0889('0x62')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x0]?_0x2b8cbc[_0x0889('0x5c')][0x0][_0x0889('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x0889('0x63'),'value':_0x2b8cbc[_0x0889('0x63')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x1]?_0x2b8cbc[_0x0889('0x5c')][0x1][_0x0889('0x5d')]:undefined)||_0x0889('0x64')},{'name':_0x0889('0x65'),'value':_0x2b8cbc['attrFontSize']||(_0x2b8cbc['attrs']&&_0x2b8cbc[_0x0889('0x5c')][0x2]?_0x2b8cbc['attrs'][0x2][_0x0889('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0x0889('0x66'),'value':_0x2b8cbc[_0x0889('0x66')]||(_0x2b8cbc['attrs']&&_0x2b8cbc['attrs'][0x0]?_0x2b8cbc[_0x0889('0x5c')][0x0][_0x0889('0x5d')]:undefined)||_0x0889('0x67')},{'name':'attrVoiceQueues','value':_0x2b8cbc[_0x0889('0x68')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x1]?_0x2b8cbc['attrs'][0x1]['value']:undefined)||[]},{'name':_0x0889('0x65'),'value':_0x2b8cbc[_0x0889('0x65')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc['attrs'][0x2]?_0x2b8cbc['attrs'][0x2][_0x0889('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x2b8cbc[_0x0889('0x69')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x3]?_0x2b8cbc[_0x0889('0x5c')][0x3]['value']:undefined)||_0x0889('0x6a')},{'name':_0x0889('0x6b'),'value':_0x2b8cbc[_0x0889('0x6b')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x4]?_0x2b8cbc[_0x0889('0x5c')][0x4][_0x0889('0x5d')]:undefined)||''},{'name':_0x0889('0x6c'),'value':_0x2b8cbc[_0x0889('0x6c')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc['attrs'][0x5]?_0x2b8cbc[_0x0889('0x5c')][0x5][_0x0889('0x5d')]:undefined)||''},{'name':_0x0889('0x6d'),'value':_0x2b8cbc[_0x0889('0x6d')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x6]?_0x2b8cbc[_0x0889('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2b8cbc[_0x0889('0x6e')]||(_0x2b8cbc['attrs']&&_0x2b8cbc[_0x0889('0x5c')][0x7]?_0x2b8cbc[_0x0889('0x5c')][0x7][_0x0889('0x5d')]:undefined)||''},{'name':_0x0889('0x6f'),'value':_0x2b8cbc[_0x0889('0x6f')]||(_0x2b8cbc['attrs']&&_0x2b8cbc[_0x0889('0x5c')][0x8]?_0x2b8cbc['attrs'][0x8][_0x0889('0x5d')]:undefined)||''},{'name':_0x0889('0x70'),'value':_0x2b8cbc['attrChatWebsites']||(_0x2b8cbc['attrs']&&_0x2b8cbc[_0x0889('0x5c')][0x9]?_0x2b8cbc[_0x0889('0x5c')][0x9][_0x0889('0x5d')]:undefined)||''}];case _0x0889('0x71'):case'pie-chart':return[{'name':_0x0889('0x72'),'value':_0x2b8cbc[_0x0889('0x72')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x0]?_0x2b8cbc[_0x0889('0x5c')][0x0][_0x0889('0x5d')]:undefined)||_0x0889('0x67')},{'name':_0x0889('0x73'),'value':_0x2b8cbc[_0x0889('0x73')]||(_0x2b8cbc['attrs']&&_0x2b8cbc['attrs'][0x1]?_0x2b8cbc['attrs'][0x1][_0x0889('0x5d')]:undefined)||null},{'name':_0x0889('0x74'),'value':_0x2b8cbc[_0x0889('0x74')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc['attrs'][0x2]?_0x2b8cbc[_0x0889('0x5c')][0x2][_0x0889('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2b8cbc[_0x0889('0x68')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x3]?_0x2b8cbc[_0x0889('0x5c')][0x3][_0x0889('0x5d')]:undefined)||[]},{'name':'attrChannel','value':_0x2b8cbc[_0x0889('0x69')]||(_0x2b8cbc['attrs']&&_0x2b8cbc['attrs'][0x4]?_0x2b8cbc[_0x0889('0x5c')][0x4][_0x0889('0x5d')]:undefined)||'voice'},{'name':_0x0889('0x6b'),'value':_0x2b8cbc['attrEmailAccounts']||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x5]?_0x2b8cbc['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2b8cbc[_0x0889('0x6c')]||(_0x2b8cbc['attrs']&&_0x2b8cbc['attrs'][0x6]?_0x2b8cbc[_0x0889('0x5c')][0x6]['value']:undefined)||''},{'name':_0x0889('0x6d'),'value':_0x2b8cbc[_0x0889('0x6d')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc['attrs'][0x7]?_0x2b8cbc['attrs'][0x7]['value']:undefined)||''},{'name':_0x0889('0x6e'),'value':_0x2b8cbc[_0x0889('0x6e')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x8]?_0x2b8cbc[_0x0889('0x5c')][0x8][_0x0889('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2b8cbc[_0x0889('0x6f')]||(_0x2b8cbc['attrs']&&_0x2b8cbc[_0x0889('0x5c')][0x9]?_0x2b8cbc[_0x0889('0x5c')][0x9][_0x0889('0x5d')]:undefined)||''},{'name':_0x0889('0x70'),'value':_0x2b8cbc['attrChatWebsites']||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0xa]?_0x2b8cbc[_0x0889('0x5c')][0xa][_0x0889('0x5d')]:undefined)||''}];case _0x0889('0x75'):return[{'name':_0x0889('0x76'),'type':_0x2b8cbc[_0x0889('0x77')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x0]?_0x2b8cbc['attrs'][0x0]['type']:undefined)||null,'value':_0x2b8cbc[_0x0889('0x76')]||(_0x2b8cbc['attrs']&&_0x2b8cbc[_0x0889('0x5c')][0x0]?_0x2b8cbc[_0x0889('0x5c')][0x0][_0x0889('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x2b8cbc[_0x0889('0x78')]||(_0x2b8cbc[_0x0889('0x5c')]&&_0x2b8cbc[_0x0889('0x5c')][0x1]?_0x2b8cbc[_0x0889('0x5c')][0x1][_0x0889('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x465fd2){logger['error'](_0x0889('0x79'),JSON[_0x0889('0x7a')](_0x465fd2));return[];}}exports['addItem']=function(_0x4dd010,_0xddcd05,_0xf29bef){if(_0x4dd010[_0x0889('0x55')]['id']){delete _0x4dd010['body']['id'];}return db['Dashboard'][_0x0889('0x4b')]({'where':{'id':_0x4dd010[_0x0889('0x49')]['id']}})[_0x0889('0x25')](handleEntityNotFound(_0xddcd05,null))[_0x0889('0x25')](function(_0x520ec0){if(_0x520ec0){_0x4dd010[_0x0889('0x55')][_0x0889('0x7b')]=_0x520ec0['id'];_0x4dd010[_0x0889('0x55')][_0x0889('0x5c')]=widgetAttributes(_0x4dd010[_0x0889('0x55')]);return db['DashboardItem'][_0x0889('0x4c')](_0x4dd010[_0x0889('0x55')]);}})[_0x0889('0x25')](respondWithResult(_0xddcd05,null))[_0x0889('0x51')](handleError(_0xddcd05,null));};exports[_0x0889('0x7c')]=function(_0x376972,_0x492fbd,_0x7d6a47){var _0x88ea53={};var _0x73b7c8={};var _0x240124;var _0x54d9ca;return db[_0x0889('0x2e')][_0x0889('0x7d')]({'where':{'id':_0x376972[_0x0889('0x49')]['id']}})[_0x0889('0x25')](handleEntityNotFound(_0x492fbd,null))[_0x0889('0x25')](function(_0x21d789){if(_0x21d789){_0x240124=_0x21d789;_0x73b7c8[_0x0889('0x37')]=_[_0x0889('0x34')](db[_0x0889('0x7e')][_0x0889('0x2f')]);_0x73b7c8['query']=_[_0x0889('0x34')](_0x376972[_0x0889('0x33')]);_0x73b7c8[_0x0889('0x35')]=_[_0x0889('0x36')](_0x73b7c8[_0x0889('0x37')],_0x73b7c8[_0x0889('0x33')]);_0x88ea53['attributes']=_[_0x0889('0x36')](_0x73b7c8[_0x0889('0x37')],qs[_0x0889('0x39')](_0x376972[_0x0889('0x33')][_0x0889('0x39')]));_0x88ea53[_0x0889('0x38')]=_0x88ea53[_0x0889('0x38')][_0x0889('0x4a')]?_0x88ea53[_0x0889('0x38')]:_0x73b7c8[_0x0889('0x37')];_0x88ea53[_0x0889('0x3c')]=qs[_0x0889('0x3d')](_0x376972[_0x0889('0x33')][_0x0889('0x3d')]);_0x88ea53[_0x0889('0x3e')]=qs[_0x0889('0x35')](_['pick'](_0x376972['query'],_0x73b7c8[_0x0889('0x35')]));if(_0x376972[_0x0889('0x33')][_0x0889('0x42')]){_0x88ea53['where']=_[_0x0889('0x40')](_0x88ea53[_0x0889('0x3e')],{'$or':_[_0x0889('0x2d')](_0x88ea53[_0x0889('0x38')],function(_0x516067){var _0x3bdecd={};_0x3bdecd[_0x516067]={'$like':'%'+_0x376972['query']['filter']+'%'};return _0x3bdecd;})});}_0x88ea53=_[_0x0889('0x40')]({},_0x88ea53,_0x376972[_0x0889('0x43')]);return _0x240124[_0x0889('0x7c')](_0x88ea53);}})[_0x0889('0x25')](function(_0x4a0b81){if(_0x4a0b81){_0x54d9ca=_0x4a0b81[_0x0889('0x4a')];if(!_0x376972[_0x0889('0x33')][_0x0889('0x3a')](_0x0889('0x3b'))){_0x88ea53[_0x0889('0x20')]=qs['limit'](_0x376972['query']['limit']);_0x88ea53['offset']=qs['offset'](_0x376972[_0x0889('0x33')][_0x0889('0x1d')]);}return _0x240124[_0x0889('0x7c')](_0x88ea53);}})['then'](function(_0x3237e9){if(_0x3237e9){return _0x3237e9?{'count':_0x54d9ca,'rows':_0x3237e9}:null;}})['then'](respondWithResult(_0x492fbd,null))[_0x0889('0x51')](handleError(_0x492fbd,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index bcd82c0..65e8e2d 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 _0xb495=['emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x59537e,_0x29188d){var _0x955a8a=function(_0x59e3df){while(--_0x59e3df){_0x59537e['push'](_0x59537e['shift']());}};_0x955a8a(++_0x29188d);}(_0xb495,0xc1));var _0x5b49=function(_0x791fac,_0x34322b){_0x791fac=_0x791fac-0x0;var _0x407734=_0xb495[_0x791fac];return _0x407734;};'use strict';var EventEmitter=require(_0x5b49('0x0'));var Dashboard=require(_0x5b49('0x1'))['db'][_0x5b49('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5b49('0x3')](0x0);var events={'afterCreate':_0x5b49('0x4'),'afterUpdate':_0x5b49('0x5'),'afterDestroy':_0x5b49('0x6')};function emitEvent(_0x264c9c){return function(_0x42ebaf,_0x48a6f9,_0x397271){DashboardEvents[_0x5b49('0x7')](_0x264c9c+':'+_0x42ebaf['id'],_0x42ebaf);DashboardEvents['emit'](_0x264c9c,_0x42ebaf);_0x397271(null);};}for(var e in events){if(events[_0x5b49('0x8')](e)){var event=events[e];Dashboard[_0x5b49('0x9')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xaf6a=['update','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0xe6bf39,_0x409cc8){var _0x7d2c7c=function(_0x1ff5d0){while(--_0x1ff5d0){_0xe6bf39['push'](_0xe6bf39['shift']());}};_0x7d2c7c(++_0x409cc8);}(_0xaf6a,0x1e4));var _0xaaf6=function(_0x2af946,_0x3d6088){_0x2af946=_0x2af946-0x0;var _0x3ae43d=_0xaf6a[_0x2af946];return _0x3ae43d;};'use strict';var EventEmitter=require(_0xaaf6('0x0'));var Dashboard=require(_0xaaf6('0x1'))['db'][_0xaaf6('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xaaf6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaaf6('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf284ea){return function(_0x12b128,_0x961c97,_0x4f231c){DashboardEvents[_0xaaf6('0x5')](_0xf284ea+':'+_0x12b128['id'],_0x12b128);DashboardEvents[_0xaaf6('0x5')](_0xf284ea,_0x12b128);_0x4f231c(null);};}for(var e in events){if(events[_0xaaf6('0x6')](e)){var event=events[e];Dashboard[_0xaaf6('0x7')](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 0bcfc19..167b57e 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 _0x90db=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard'];(function(_0x20500e,_0x5f0a59){var _0x314597=function(_0x2af2f8){while(--_0x2af2f8){_0x20500e['push'](_0x20500e['shift']());}};_0x314597(++_0x5f0a59);}(_0x90db,0x179));var _0xb90d=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x90db[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var logger=require(_0xb90d('0x2'))(_0xb90d('0x3'));var moment=require(_0xb90d('0x4'));var BPromise=require(_0xb90d('0x5'));var rp=require(_0xb90d('0x6'));var fs=require('fs');var path=require(_0xb90d('0x7'));var rimraf=require(_0xb90d('0x8'));var config=require('../../config/environment');var attributes=require(_0xb90d('0x9'));module[_0xb90d('0xa')]=function(_0x25d832,_0x439531){return _0x25d832[_0xb90d('0xb')](_0xb90d('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15df=['util','api','moment','bluebird','request-promise','path','./dashboard.attributes','exports','define','dashboards','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x15df,0x6d));var _0xf15d=function(_0x217dc5,_0x548101){_0x217dc5=_0x217dc5-0x0;var _0x462d01=_0x15df[_0x217dc5];return _0x462d01;};'use strict';var _=require(_0xf15d('0x0'));var util=require(_0xf15d('0x1'));var logger=require('../../config/logger')(_0xf15d('0x2'));var moment=require(_0xf15d('0x3'));var BPromise=require(_0xf15d('0x4'));var rp=require(_0xf15d('0x5'));var fs=require('fs');var path=require(_0xf15d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf15d('0x7'));module[_0xf15d('0x8')]=function(_0x1670de,_0x31cce3){return _0x1670de[_0xf15d('0x9')]('Dashboard',attributes,{'tableName':_0xf15d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index efd7343..34fbd69 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 _0x51af=['register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x4f586c,_0x58ca1e){var _0x52fed4=function(_0x2b4a04){while(--_0x2b4a04){_0x4f586c['push'](_0x4f586c['shift']());}};_0x52fed4(++_0x58ca1e);}(_0x51af,0x1ac));var _0xf51a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x51af[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf51a('0x0'));var BPromise=require('bluebird');var rs=require(_0xf51a('0x1'));var fs=require('fs');var Redis=require(_0xf51a('0x2'));var db=require(_0xf51a('0x3'))['db'];var utils=require(_0xf51a('0x4'));var logger=require(_0xf51a('0x5'))(_0xf51a('0x6'));var config=require(_0xf51a('0x7'));var jayson=require(_0xf51a('0x8'));var client=jayson[_0xf51a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xf51a('0xa')](config[_0xf51a('0xb')],{'host':_0xf51a('0xc'),'port':0x18eb});var socket=require(_0xf51a('0xd'))(new Redis(config['redis']));require('./dashboard.socket')[_0xf51a('0xe')](socket);function respondWithRpcPromise(_0x5a9d22,_0x507921,_0x520c47){return new BPromise(function(_0x1db4c1,_0x1c5cc9){return client['request'](_0x5a9d22,_0x520c47)[_0xf51a('0xf')](function(_0x5f402d){logger[_0xf51a('0x10')](_0xf51a('0x11'),_0x507921,_0xf51a('0x12'));logger[_0xf51a('0x13')](_0xf51a('0x14'),_0x507921,_0xf51a('0x12'),JSON[_0xf51a('0x15')](_0x5f402d));if(_0x5f402d[_0xf51a('0x16')]){if(_0x5f402d[_0xf51a('0x16')]['code']===0x1f4){logger[_0xf51a('0x16')]('Dashboard,\x20%s,\x20%s',_0x507921,_0x5f402d[_0xf51a('0x16')][_0xf51a('0x17')]);return _0x1c5cc9(_0x5f402d[_0xf51a('0x16')][_0xf51a('0x17')]);}logger[_0xf51a('0x16')](_0xf51a('0x11'),_0x507921,_0x5f402d[_0xf51a('0x16')][_0xf51a('0x17')]);return _0x1db4c1(_0x5f402d['error'][_0xf51a('0x17')]);}else{logger[_0xf51a('0x10')](_0xf51a('0x11'),_0x507921,'request\x20sent');_0x1db4c1(_0x5f402d[_0xf51a('0x18')]['message']);}})[_0xf51a('0x19')](function(_0x44ea9c){logger[_0xf51a('0x16')](_0xf51a('0x11'),_0x507921,_0x44ea9c);_0x1c5cc9(_0x44ea9c);});});} \ No newline at end of file +var _0x53c7=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x145e2c,_0x5e1036){var _0x34a8d3=function(_0x4e48ea){while(--_0x4e48ea){_0x145e2c['push'](_0x145e2c['shift']());}};_0x34a8d3(++_0x5e1036);}(_0x53c7,0x1a1));var _0x753c=function(_0x312929,_0x2e47d6){_0x312929=_0x312929-0x0;var _0x1b4644=_0x53c7[_0x312929];return _0x1b4644;};'use strict';var _=require(_0x753c('0x0'));var util=require(_0x753c('0x1'));var moment=require(_0x753c('0x2'));var BPromise=require(_0x753c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x753c('0x4'));var db=require(_0x753c('0x5'))['db'];var utils=require(_0x753c('0x6'));var logger=require(_0x753c('0x7'))(_0x753c('0x8'));var config=require(_0x753c('0x9'));var jayson=require(_0x753c('0xa'));var client=jayson[_0x753c('0xb')][_0x753c('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x753c('0xd')],{'host':_0x753c('0xe'),'port':0x18eb});var socket=require(_0x753c('0xf'))(new Redis(config[_0x753c('0xd')]));require(_0x753c('0x10'))[_0x753c('0x11')](socket);function respondWithRpcPromise(_0x57192e,_0xd41d9,_0x202753){return new BPromise(function(_0xf3df0f,_0x3114a2){return client[_0x753c('0x12')](_0x57192e,_0x202753)[_0x753c('0x13')](function(_0x1bdfbc){logger[_0x753c('0x14')](_0x753c('0x15'),_0xd41d9,_0x753c('0x16'));logger[_0x753c('0x17')](_0x753c('0x18'),_0xd41d9,_0x753c('0x16'),JSON[_0x753c('0x19')](_0x1bdfbc));if(_0x1bdfbc[_0x753c('0x1a')]){if(_0x1bdfbc['error']['code']===0x1f4){logger[_0x753c('0x1a')](_0x753c('0x15'),_0xd41d9,_0x1bdfbc['error'][_0x753c('0x1b')]);return _0x3114a2(_0x1bdfbc[_0x753c('0x1a')][_0x753c('0x1b')]);}logger[_0x753c('0x1a')](_0x753c('0x15'),_0xd41d9,_0x1bdfbc[_0x753c('0x1a')]['message']);return _0xf3df0f(_0x1bdfbc[_0x753c('0x1a')]['message']);}else{logger['info'](_0x753c('0x15'),_0xd41d9,_0x753c('0x16'));_0xf3df0f(_0x1bdfbc[_0x753c('0x1c')]['message']);}})[_0x753c('0x1d')](function(_0xf223df){logger[_0x753c('0x1a')](_0x753c('0x15'),_0xd41d9,_0xf223df);_0x3114a2(_0xf223df);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8c5de88..03b658c 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 _0xa2f0=['remove','update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x19ae7a,_0x5d3b51){var _0x30d82e=function(_0x332ecc){while(--_0x332ecc){_0x19ae7a['push'](_0x19ae7a['shift']());}};_0x30d82e(++_0x5d3b51);}(_0xa2f0,0x166));var _0x0a2f=function(_0x500d0c,_0x2e91a1){_0x500d0c=_0x500d0c-0x0;var _0x96ec02=_0xa2f0[_0x500d0c];return _0x96ec02;};'use strict';var DashboardEvents=require(_0x0a2f('0x0'));var events=[_0x0a2f('0x1'),_0x0a2f('0x2'),_0x0a2f('0x3')];function createListener(_0x2ec6e5,_0x2bdde0){return function(_0x4f04d8){_0x2bdde0[_0x0a2f('0x4')](_0x2ec6e5,_0x4f04d8);};}function removeListener(_0x5b8e18,_0x14f51f){return function(){DashboardEvents['removeListener'](_0x5b8e18,_0x14f51f);};}exports[_0x0a2f('0x5')]=function(_0x529902){for(var _0xcf62c9=0x0,_0x5a7726=events[_0x0a2f('0x6')];_0xcf62c9<_0x5a7726;_0xcf62c9++){var _0x43808b=events[_0xcf62c9];var _0x4f0e3d=createListener(_0x0a2f('0x7')+_0x43808b,_0x529902);DashboardEvents['on'](_0x43808b,_0x4f0e3d);}}; \ No newline at end of file +var _0xd62f=['length','dashboard:','remove','update','emit','register'];(function(_0x276dbd,_0x32a3f7){var _0x28b035=function(_0x571893){while(--_0x571893){_0x276dbd['push'](_0x276dbd['shift']());}};_0x28b035(++_0x32a3f7);}(_0xd62f,0xc2));var _0xfd62=function(_0x25f3b7,_0x33c2f6){_0x25f3b7=_0x25f3b7-0x0;var _0x3b12d8=_0xd62f[_0x25f3b7];return _0x3b12d8;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xfd62('0x0'),_0xfd62('0x1')];function createListener(_0x3a9a4b,_0x2146ab){return function(_0xd83709){_0x2146ab[_0xfd62('0x2')](_0x3a9a4b,_0xd83709);};}function removeListener(_0x1319e4,_0x13685b){return function(){DashboardEvents['removeListener'](_0x1319e4,_0x13685b);};}exports[_0xfd62('0x3')]=function(_0x5d2b7a){for(var _0x370486=0x0,_0x2691d3=events[_0xfd62('0x4')];_0x370486<_0x2691d3;_0x370486++){var _0x5ead51=events[_0x370486];var _0x11d08=createListener(_0xfd62('0x5')+_0x5ead51,_0x5d2b7a);DashboardEvents['on'](_0x5ead51,_0x11d08);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6f2fc06..fd08926 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 _0xa187=['./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','create','addItem','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5680a8,_0x3a5ebd){var _0x4901c5=function(_0x5a4bb1){while(--_0x5a4bb1){_0x5680a8['push'](_0x5680a8['shift']());}};_0x4901c5(++_0x3a5ebd);}(_0xa187,0xad));var _0x7a18=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xa187[_0x5a7e3c];return _0x59252b;};'use strict';var multer=require(_0x7a18('0x0'));var util=require('util');var path=require(_0x7a18('0x1'));var timeout=require(_0x7a18('0x2'));var express=require(_0x7a18('0x3'));var router=express[_0x7a18('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a18('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a18('0x6'));var controller=require(_0x7a18('0x7'));router[_0x7a18('0x8')]('/',auth[_0x7a18('0x9')](),controller['index']);router[_0x7a18('0x8')](_0x7a18('0xa'),auth[_0x7a18('0x9')](),controller[_0x7a18('0xb')]);router[_0x7a18('0x8')](_0x7a18('0xc'),auth[_0x7a18('0x9')](),controller[_0x7a18('0xd')]);router[_0x7a18('0xe')]('/',auth[_0x7a18('0x9')](),controller[_0x7a18('0xf')]);router[_0x7a18('0xe')]('/:id/clone',auth[_0x7a18('0x9')](),controller['clone']);router[_0x7a18('0xe')](_0x7a18('0xc'),auth['isAuthenticated'](),controller[_0x7a18('0x10')]);router[_0x7a18('0x11')](_0x7a18('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7a18('0x12')](_0x7a18('0xa'),auth[_0x7a18('0x9')](),controller['destroy']);module[_0x7a18('0x13')]=router; \ No newline at end of file +var _0x4879=['delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','addItem','put'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x4879,0x1e6));var _0x9487=function(_0x332c03,_0x1bb8e6){_0x332c03=_0x332c03-0x0;var _0x16b2b8=_0x4879[_0x332c03];return _0x16b2b8;};'use strict';var multer=require('multer');var util=require(_0x9487('0x0'));var path=require(_0x9487('0x1'));var timeout=require(_0x9487('0x2'));var express=require(_0x9487('0x3'));var router=express['Router']();var fs_extra=require(_0x9487('0x4'));var auth=require(_0x9487('0x5'));var interaction=require(_0x9487('0x6'));var config=require(_0x9487('0x7'));var controller=require('./dashboard.controller');router[_0x9487('0x8')]('/',auth['isAuthenticated'](),controller[_0x9487('0x9')]);router[_0x9487('0x8')](_0x9487('0xa'),auth[_0x9487('0xb')](),controller[_0x9487('0xc')]);router[_0x9487('0x8')](_0x9487('0xd'),auth[_0x9487('0xb')](),controller[_0x9487('0xe')]);router[_0x9487('0xf')]('/',auth[_0x9487('0xb')](),controller['create']);router[_0x9487('0xf')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x9487('0xf')](_0x9487('0xd'),auth[_0x9487('0xb')](),controller[_0x9487('0x10')]);router[_0x9487('0x11')](_0x9487('0xa'),auth[_0x9487('0xb')](),controller['update']);router[_0x9487('0x12')]('/:id',auth[_0x9487('0xb')](),controller[_0x9487('0x13')]);module[_0x9487('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cc15968..c87bf50 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 _0x2675=['parse','attrs','setDataValue','stringify','INTEGER','sequelize','STRING','long'];(function(_0x3b39db,_0x5c0826){var _0x25ae42=function(_0x4d049a){while(--_0x4d049a){_0x3b39db['push'](_0x3b39db['shift']());}};_0x25ae42(++_0x5c0826);}(_0x2675,0x75));var _0x5267=function(_0x46eac2,_0x2b24f7){_0x46eac2=_0x46eac2-0x0;var _0x32827a=_0x2675[_0x46eac2];return _0x32827a;};'use strict';var Sequelize=require(_0x5267('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5267('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5267('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5267('0x2')),'get':function(){try{return JSON[_0x5267('0x3')](this['getDataValue'](_0x5267('0x4')));}catch(_0xf2b350){return[];}},'set':function(_0x4bd042){try{this[_0x5267('0x5')](_0x5267('0x4'),JSON[_0x5267('0x6')](_0x4bd042));}catch(_0x527c16){this[_0x5267('0x5')](_0x5267('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5267('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5267('0x7')]},'col':{'type':Sequelize[_0x5267('0x7')]},'background':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5267('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5d17,0x114));var _0x75d1=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0x5d17[_0x2e68db];return _0x12df4c;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 833b363..0cddf1f 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 _0x812d=['attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie2','attrSmsAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','DashboardItem','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','end','status','json','limit','offset','count','apply','save','then','destroy','error','stack','name','send','params','keys','query','filters','intersection','model','fields','attributes','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','clock'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x812d,0x6e));var _0xd812=function(_0x340cf4,_0x3b9c91){_0x340cf4=_0x340cf4-0x0;var _0x32637a=_0x812d[_0x340cf4];return _0x32637a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd812('0x0'));var zipdir=require(_0xd812('0x1'));var jsonpatch=require(_0xd812('0x2'));var rp=require(_0xd812('0x3'));var moment=require(_0xd812('0x4'));var BPromise=require(_0xd812('0x5'));var Mustache=require(_0xd812('0x6'));var util=require(_0xd812('0x7'));var path=require('path');var sox=require(_0xd812('0x8'));var csv=require(_0xd812('0x9'));var ejs=require(_0xd812('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd812('0xb'));var crypto=require(_0xd812('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd812('0xd'));var toCsv=require(_0xd812('0x9'));var querystring=require('querystring');var Papa=require(_0xd812('0xe'));var Redis=require(_0xd812('0xf'));var authService=require(_0xd812('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd812('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd812('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd812('0x13'));var db=require(_0xd812('0x14'))['db'];config[_0xd812('0x15')]=_['defaults'](config[_0xd812('0x15')],{'host':_0xd812('0x16'),'port':0x18eb});var socket=require(_0xd812('0x17'))(new Redis(config[_0xd812('0x15')]));require(_0xd812('0x18'))[_0xd812('0x19')](socket);function respondWithStatusCode(_0x2bc66b,_0x30feb1){_0x30feb1=_0x30feb1||0xcc;return function(_0x529bf0){if(_0x529bf0){return _0x2bc66b['sendStatus'](_0x30feb1);}return _0x2bc66b['status'](_0x30feb1)[_0xd812('0x1a')]();};}function respondWithResult(_0x51a0dd,_0x4f2bfe){_0x4f2bfe=_0x4f2bfe||0xc8;return function(_0x1c82da){if(_0x1c82da){return _0x51a0dd[_0xd812('0x1b')](_0x4f2bfe)[_0xd812('0x1c')](_0x1c82da);}};}function respondWithFilteredResult(_0x24c4e4,_0x16200a){return function(_0x320d2d){if(_0x320d2d){var _0x1bc06f=typeof _0x16200a['offset']==='undefined'&&typeof _0x16200a[_0xd812('0x1d')]==='undefined';var _0x359e6b=_0x320d2d['count'];var _0x4e3e5a=_0x1bc06f?0x0:_0x16200a[_0xd812('0x1e')];var _0x3efbd2=_0x1bc06f?_0x320d2d[_0xd812('0x1f')]:_0x16200a[_0xd812('0x1e')]+_0x16200a[_0xd812('0x1d')];var _0x4dba22;if(_0x3efbd2>=_0x359e6b){_0x3efbd2=_0x359e6b;_0x4dba22=0xc8;}else{_0x4dba22=0xce;}_0x24c4e4['status'](_0x4dba22);return _0x24c4e4['set']('Content-Range',_0x4e3e5a+'-'+_0x3efbd2+'/'+_0x359e6b)[_0xd812('0x1c')](_0x320d2d);}return null;};}function patchUpdates(_0x442aa5){return function(_0x4b4434){try{jsonpatch[_0xd812('0x20')](_0x4b4434,_0x442aa5,!![]);}catch(_0x55e061){return BPromise['reject'](_0x55e061);}return _0x4b4434[_0xd812('0x21')]();};}function saveUpdates(_0x4522b4,_0x44c6b0){return function(_0x4091f9){if(_0x4091f9){return _0x4091f9['update'](_0x4522b4)[_0xd812('0x22')](function(_0x2d51f6){return _0x2d51f6;});}return null;};}function removeEntity(_0x584669,_0x40266e){return function(_0x1ebfa7){if(_0x1ebfa7){return _0x1ebfa7[_0xd812('0x23')]()[_0xd812('0x22')](function(){_0x584669['status'](0xcc)[_0xd812('0x1a')]();});}};}function handleEntityNotFound(_0x1aed5d,_0x2ec043){return function(_0xace11f){if(!_0xace11f){_0x1aed5d['sendStatus'](0x194);}return _0xace11f;};}function handleError(_0x517bf3,_0x48d208){_0x48d208=_0x48d208||0x1f4;return function(_0x59d8e4){logger[_0xd812('0x24')](_0x59d8e4[_0xd812('0x25')]);if(_0x59d8e4['name']){delete _0x59d8e4[_0xd812('0x26')];}_0x517bf3[_0xd812('0x1b')](_0x48d208)[_0xd812('0x27')](_0x59d8e4);};}exports['show']=function(_0x282e93,_0x19b5e6){var _0x2a39d6={'raw':![],'where':{'id':_0x282e93[_0xd812('0x28')]['id']}},_0x5e114e={};_0x5e114e['model']=_[_0xd812('0x29')](db['DashboardItem']['rawAttributes']);_0x5e114e['query']=_[_0xd812('0x29')](_0x282e93[_0xd812('0x2a')]);_0x5e114e[_0xd812('0x2b')]=_[_0xd812('0x2c')](_0x5e114e['model'],_0x5e114e[_0xd812('0x2a')]);_0x2a39d6['attributes']=_[_0xd812('0x2c')](_0x5e114e[_0xd812('0x2d')],qs[_0xd812('0x2e')](_0x282e93['query'][_0xd812('0x2e')]));_0x2a39d6[_0xd812('0x2f')]=_0x2a39d6[_0xd812('0x2f')][_0xd812('0x30')]?_0x2a39d6[_0xd812('0x2f')]:_0x5e114e[_0xd812('0x2d')];if(_0x282e93[_0xd812('0x2a')]['includeAll']){_0x2a39d6[_0xd812('0x31')]=[{'all':!![]}];}_0x2a39d6=_[_0xd812('0x32')]({},_0x2a39d6,_0x282e93[_0xd812('0x33')]);return db['DashboardItem'][_0xd812('0x34')](_0x2a39d6)[_0xd812('0x22')](handleEntityNotFound(_0x19b5e6,null))['then'](respondWithResult(_0x19b5e6,null))[_0xd812('0x35')](handleError(_0x19b5e6,null));};exports['destroy']=function(_0x437114,_0x2a8c52){return db['DashboardItem']['find']({'where':{'id':_0x437114['params']['id']}})['then'](handleEntityNotFound(_0x2a8c52,null))[_0xd812('0x22')](removeEntity(_0x2a8c52,null))['catch'](handleError(_0x2a8c52,null));};function widgetAttributes(_0x517bd5){try{switch(_0x517bd5[_0xd812('0x36')]){case _0xd812('0x37'):return[{'name':_0xd812('0x38'),'value':_0x517bd5[_0xd812('0x38')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x0]?_0x517bd5[_0xd812('0x39')][0x0][_0xd812('0x3a')]:undefined)||_0xd812('0x3b')}];case _0xd812('0x3c'):return[{'name':'attrPath','value':_0x517bd5['attrPath']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x0]?_0x517bd5[_0xd812('0x39')][0x0]['value']:undefined)||''}];case _0xd812('0x3d'):return[{'name':_0xd812('0x3e'),'value':_0x517bd5['attrHourFormat']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x0]?_0x517bd5[_0xd812('0x39')][0x0][_0xd812('0x3a')]:undefined)||_0xd812('0x3f')},{'name':_0xd812('0x40'),'value':_0x517bd5['attrTimezone']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5['attrs'][0x1]?_0x517bd5[_0xd812('0x39')][0x1][_0xd812('0x3a')]:undefined)||'0.00'},{'name':_0xd812('0x41'),'value':_0x517bd5[_0xd812('0x41')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5['attrs'][0x2]?_0x517bd5[_0xd812('0x39')][0x2][_0xd812('0x3a')]:undefined)||0xc}];case'counter':return[{'name':_0xd812('0x42'),'value':_0x517bd5[_0xd812('0x42')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x0]?_0x517bd5['attrs'][0x0][_0xd812('0x3a')]:undefined)||_0xd812('0x43')},{'name':_0xd812('0x44'),'value':_0x517bd5[_0xd812('0x44')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5['attrs'][0x1]?_0x517bd5['attrs'][0x1][_0xd812('0x3a')]:undefined)||[]},{'name':_0xd812('0x41'),'value':_0x517bd5[_0xd812('0x41')]||(_0x517bd5['attrs']&&_0x517bd5[_0xd812('0x39')][0x2]?_0x517bd5[_0xd812('0x39')][0x2][_0xd812('0x3a')]:undefined)||0x14},{'name':_0xd812('0x45'),'value':_0x517bd5['attrChannel']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x3]?_0x517bd5['attrs'][0x3][_0xd812('0x3a')]:undefined)||_0xd812('0x46')},{'name':_0xd812('0x47'),'value':_0x517bd5[_0xd812('0x47')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x4]?_0x517bd5[_0xd812('0x39')][0x4]['value']:undefined)||''},{'name':_0xd812('0x48'),'value':_0x517bd5[_0xd812('0x48')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5['attrs'][0x5]?_0x517bd5[_0xd812('0x39')][0x5][_0xd812('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x517bd5['attrSmsAccounts']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x6]?_0x517bd5['attrs'][0x6][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x49'),'value':_0x517bd5[_0xd812('0x49')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x7]?_0x517bd5[_0xd812('0x39')][0x7][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x4a'),'value':_0x517bd5[_0xd812('0x4a')]||(_0x517bd5['attrs']&&_0x517bd5['attrs'][0x8]?_0x517bd5[_0xd812('0x39')][0x8][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x4b'),'value':_0x517bd5[_0xd812('0x4b')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x9]?_0x517bd5[_0xd812('0x39')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x517bd5['attrSerie1']||(_0x517bd5['attrs']&&_0x517bd5['attrs'][0x0]?_0x517bd5[_0xd812('0x39')][0x0]['value']:undefined)||'total'},{'name':_0xd812('0x4c'),'value':_0x517bd5[_0xd812('0x4c')]||(_0x517bd5['attrs']&&_0x517bd5[_0xd812('0x39')][0x1]?_0x517bd5['attrs'][0x1][_0xd812('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x517bd5['attrSerie3']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5['attrs'][0x2]?_0x517bd5['attrs'][0x2][_0xd812('0x3a')]:undefined)||null},{'name':_0xd812('0x44'),'value':_0x517bd5[_0xd812('0x44')]||(_0x517bd5['attrs']&&_0x517bd5['attrs'][0x3]?_0x517bd5[_0xd812('0x39')][0x3][_0xd812('0x3a')]:undefined)||[]},{'name':'attrChannel','value':_0x517bd5[_0xd812('0x45')]||(_0x517bd5['attrs']&&_0x517bd5[_0xd812('0x39')][0x4]?_0x517bd5[_0xd812('0x39')][0x4][_0xd812('0x3a')]:undefined)||'voice'},{'name':_0xd812('0x47'),'value':_0x517bd5[_0xd812('0x47')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x5]?_0x517bd5['attrs'][0x5][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x48'),'value':_0x517bd5[_0xd812('0x48')]||(_0x517bd5['attrs']&&_0x517bd5[_0xd812('0x39')][0x6]?_0x517bd5[_0xd812('0x39')][0x6][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x4d'),'value':_0x517bd5[_0xd812('0x4d')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x7]?_0x517bd5[_0xd812('0x39')][0x7][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x49'),'value':_0x517bd5[_0xd812('0x49')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x8]?_0x517bd5[_0xd812('0x39')][0x8][_0xd812('0x3a')]:undefined)||''},{'name':_0xd812('0x4a'),'value':_0x517bd5[_0xd812('0x4a')]||(_0x517bd5['attrs']&&_0x517bd5['attrs'][0x9]?_0x517bd5['attrs'][0x9][_0xd812('0x3a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x517bd5[_0xd812('0x4b')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0xa]?_0x517bd5['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xd812('0x4e'),'type':_0x517bd5['reportType']||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5['attrs'][0x0]?_0x517bd5[_0xd812('0x39')][0x0][_0xd812('0x36')]:undefined)||null,'value':_0x517bd5[_0xd812('0x4e')]||(_0x517bd5['attrs']&&_0x517bd5[_0xd812('0x39')][0x0]?_0x517bd5[_0xd812('0x39')][0x0][_0xd812('0x3a')]:undefined)||null},{'name':_0xd812('0x4f'),'value':_0x517bd5[_0xd812('0x4f')]||(_0x517bd5[_0xd812('0x39')]&&_0x517bd5[_0xd812('0x39')][0x1]?_0x517bd5[_0xd812('0x39')][0x1][_0xd812('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x503124){logger[_0xd812('0x24')](_0xd812('0x50'),JSON[_0xd812('0x51')](_0x503124));return[];}}exports[_0xd812('0x52')]=function(_0x48465f,_0x10128b){if(_0x48465f[_0xd812('0x53')]){_0x48465f[_0xd812('0x53')][_0xd812('0x39')]=widgetAttributes(_0x48465f[_0xd812('0x53')]);}return db[_0xd812('0x54')][_0xd812('0x52')](_0x48465f[_0xd812('0x53')],{})[_0xd812('0x22')](respondWithResult(_0x10128b,0xc9))[_0xd812('0x35')](handleError(_0x10128b,null));};exports[_0xd812('0x55')]=function(_0x3bc122,_0x55a737){if(_0x3bc122[_0xd812('0x53')]['id']){delete _0x3bc122[_0xd812('0x53')]['id'];}_0x3bc122['body'][_0xd812('0x39')]=widgetAttributes(_0x3bc122[_0xd812('0x53')]);return db['DashboardItem'][_0xd812('0x34')]({'where':{'id':_0x3bc122[_0xd812('0x28')]['id']}})[_0xd812('0x22')](handleEntityNotFound(_0x55a737,null))['then'](saveUpdates(_0x3bc122[_0xd812('0x53')],null))['then'](respondWithResult(_0x55a737,null))['catch'](handleError(_0x55a737,null));}; \ No newline at end of file +var _0x00f0=['error','stack','name','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','params','catch','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','DashboardItem','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','end','sendStatus'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x00f0,0xec));var _0x000f=function(_0x5add5a,_0x24676c){_0x5add5a=_0x5add5a-0x0;var _0x5d0a9e=_0x00f0[_0x5add5a];return _0x5d0a9e;};'use strict';var emlformat=require(_0x000f('0x0'));var rimraf=require(_0x000f('0x1'));var zipdir=require(_0x000f('0x2'));var jsonpatch=require(_0x000f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x000f('0x4'));var Mustache=require('mustache');var util=require(_0x000f('0x5'));var path=require('path');var sox=require(_0x000f('0x6'));var csv=require(_0x000f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x000f('0x8'));var _=require(_0x000f('0x9'));var squel=require(_0x000f('0xa'));var crypto=require(_0x000f('0xb'));var jsforce=require(_0x000f('0xc'));var deskjs=require(_0x000f('0xd'));var toCsv=require(_0x000f('0x7'));var querystring=require(_0x000f('0xe'));var Papa=require(_0x000f('0xf'));var Redis=require(_0x000f('0x10'));var authService=require(_0x000f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x000f('0x12'));var logger=require(_0x000f('0x13'))('api');var utils=require(_0x000f('0x14'));var config=require(_0x000f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x000f('0x16')]=_[_0x000f('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x000f('0x18'))(new Redis(config[_0x000f('0x16')]));require(_0x000f('0x19'))[_0x000f('0x1a')](socket);function respondWithStatusCode(_0x4a7ed8,_0x393ef5){_0x393ef5=_0x393ef5||0xcc;return function(_0x53626f){if(_0x53626f){return _0x4a7ed8['sendStatus'](_0x393ef5);}return _0x4a7ed8[_0x000f('0x1b')](_0x393ef5)['end']();};}function respondWithResult(_0x1870b3,_0xa6cee6){_0xa6cee6=_0xa6cee6||0xc8;return function(_0x1b8baf){if(_0x1b8baf){return _0x1870b3[_0x000f('0x1b')](_0xa6cee6)[_0x000f('0x1c')](_0x1b8baf);}};}function respondWithFilteredResult(_0x1fb6e9,_0x9cbc29){return function(_0x86ac21){if(_0x86ac21){var _0x916e22=typeof _0x9cbc29[_0x000f('0x1d')]===_0x000f('0x1e')&&typeof _0x9cbc29[_0x000f('0x1f')]===_0x000f('0x1e');var _0x4f0d93=_0x86ac21[_0x000f('0x20')];var _0x26aad4=_0x916e22?0x0:_0x9cbc29['offset'];var _0x2cdb5c=_0x916e22?_0x86ac21['count']:_0x9cbc29['offset']+_0x9cbc29[_0x000f('0x1f')];var _0x1b1ad9;if(_0x2cdb5c>=_0x4f0d93){_0x2cdb5c=_0x4f0d93;_0x1b1ad9=0xc8;}else{_0x1b1ad9=0xce;}_0x1fb6e9[_0x000f('0x1b')](_0x1b1ad9);return _0x1fb6e9['set']('Content-Range',_0x26aad4+'-'+_0x2cdb5c+'/'+_0x4f0d93)[_0x000f('0x1c')](_0x86ac21);}return null;};}function patchUpdates(_0x860334){return function(_0x59151b){try{jsonpatch[_0x000f('0x21')](_0x59151b,_0x860334,!![]);}catch(_0x5ae592){return BPromise[_0x000f('0x22')](_0x5ae592);}return _0x59151b['save']();};}function saveUpdates(_0x2a0ce4,_0x2ed720){return function(_0x27b644){if(_0x27b644){return _0x27b644[_0x000f('0x23')](_0x2a0ce4)[_0x000f('0x24')](function(_0x2b2b22){return _0x2b2b22;});}return null;};}function removeEntity(_0x5ed9ec,_0x461d33){return function(_0x157e9f){if(_0x157e9f){return _0x157e9f[_0x000f('0x25')]()['then'](function(){_0x5ed9ec[_0x000f('0x1b')](0xcc)[_0x000f('0x26')]();});}};}function handleEntityNotFound(_0x1d541b,_0x513a56){return function(_0xcc2797){if(!_0xcc2797){_0x1d541b[_0x000f('0x27')](0x194);}return _0xcc2797;};}function handleError(_0x1099f7,_0x4a776b){_0x4a776b=_0x4a776b||0x1f4;return function(_0x11c2a2){logger[_0x000f('0x28')](_0x11c2a2[_0x000f('0x29')]);if(_0x11c2a2[_0x000f('0x2a')]){delete _0x11c2a2['name'];}_0x1099f7[_0x000f('0x1b')](_0x4a776b)['send'](_0x11c2a2);};}exports[_0x000f('0x2b')]=function(_0x12c748,_0x3cd2c2){var _0x3d8553={'raw':![],'where':{'id':_0x12c748['params']['id']}},_0x1532c8={};_0x1532c8[_0x000f('0x2c')]=_[_0x000f('0x2d')](db['DashboardItem'][_0x000f('0x2e')]);_0x1532c8[_0x000f('0x2f')]=_[_0x000f('0x2d')](_0x12c748[_0x000f('0x2f')]);_0x1532c8[_0x000f('0x30')]=_[_0x000f('0x31')](_0x1532c8[_0x000f('0x2c')],_0x1532c8[_0x000f('0x2f')]);_0x3d8553['attributes']=_[_0x000f('0x31')](_0x1532c8['model'],qs['fields'](_0x12c748[_0x000f('0x2f')][_0x000f('0x32')]));_0x3d8553[_0x000f('0x33')]=_0x3d8553[_0x000f('0x33')][_0x000f('0x34')]?_0x3d8553[_0x000f('0x33')]:_0x1532c8['model'];if(_0x12c748[_0x000f('0x2f')]['includeAll']){_0x3d8553['include']=[{'all':!![]}];}_0x3d8553=_[_0x000f('0x35')]({},_0x3d8553,_0x12c748[_0x000f('0x36')]);return db['DashboardItem']['find'](_0x3d8553)[_0x000f('0x24')](handleEntityNotFound(_0x3cd2c2,null))['then'](respondWithResult(_0x3cd2c2,null))['catch'](handleError(_0x3cd2c2,null));};exports[_0x000f('0x25')]=function(_0x4186af,_0x1910d9){return db['DashboardItem']['find']({'where':{'id':_0x4186af[_0x000f('0x37')]['id']}})[_0x000f('0x24')](handleEntityNotFound(_0x1910d9,null))[_0x000f('0x24')](removeEntity(_0x1910d9,null))[_0x000f('0x38')](handleError(_0x1910d9,null));};function widgetAttributes(_0x574a21){try{switch(_0x574a21['type']){case _0x000f('0x39'):return[{'name':_0x000f('0x3a'),'value':_0x574a21['attrUrl']||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x0]?_0x574a21[_0x000f('0x3b')][0x0][_0x000f('0x3c')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x574a21[_0x000f('0x3d')]||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x0]?_0x574a21[_0x000f('0x3b')][0x0][_0x000f('0x3c')]:undefined)||''}];case _0x000f('0x3e'):return[{'name':_0x000f('0x3f'),'value':_0x574a21['attrHourFormat']||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x0]?_0x574a21[_0x000f('0x3b')][0x0]['value']:undefined)||_0x000f('0x40')},{'name':'attrTimezone','value':_0x574a21['attrTimezone']||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x1]?_0x574a21[_0x000f('0x3b')][0x1][_0x000f('0x3c')]:undefined)||_0x000f('0x41')},{'name':_0x000f('0x42'),'value':_0x574a21[_0x000f('0x42')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x2]?_0x574a21['attrs'][0x2][_0x000f('0x3c')]:undefined)||0xc}];case'counter':return[{'name':_0x000f('0x43'),'value':_0x574a21[_0x000f('0x43')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x0]?_0x574a21[_0x000f('0x3b')][0x0]['value']:undefined)||_0x000f('0x44')},{'name':_0x000f('0x45'),'value':_0x574a21[_0x000f('0x45')]||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x1]?_0x574a21[_0x000f('0x3b')][0x1]['value']:undefined)||[]},{'name':_0x000f('0x42'),'value':_0x574a21[_0x000f('0x42')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x2]?_0x574a21[_0x000f('0x3b')][0x2][_0x000f('0x3c')]:undefined)||0x14},{'name':_0x000f('0x46'),'value':_0x574a21['attrChannel']||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x3]?_0x574a21[_0x000f('0x3b')][0x3][_0x000f('0x3c')]:undefined)||_0x000f('0x47')},{'name':_0x000f('0x48'),'value':_0x574a21[_0x000f('0x48')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x4]?_0x574a21[_0x000f('0x3b')][0x4][_0x000f('0x3c')]:undefined)||''},{'name':_0x000f('0x49'),'value':_0x574a21[_0x000f('0x49')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x5]?_0x574a21[_0x000f('0x3b')][0x5][_0x000f('0x3c')]:undefined)||''},{'name':_0x000f('0x4a'),'value':_0x574a21[_0x000f('0x4a')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x6]?_0x574a21[_0x000f('0x3b')][0x6][_0x000f('0x3c')]:undefined)||''},{'name':_0x000f('0x4b'),'value':_0x574a21[_0x000f('0x4b')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x7]?_0x574a21['attrs'][0x7]['value']:undefined)||''},{'name':_0x000f('0x4c'),'value':_0x574a21[_0x000f('0x4c')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x8]?_0x574a21[_0x000f('0x3b')][0x8][_0x000f('0x3c')]:undefined)||''},{'name':_0x000f('0x4d'),'value':_0x574a21[_0x000f('0x4d')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x9]?_0x574a21[_0x000f('0x3b')][0x9][_0x000f('0x3c')]:undefined)||''}];case _0x000f('0x4e'):case'pie-chart':return[{'name':_0x000f('0x4f'),'value':_0x574a21['attrSerie1']||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x0]?_0x574a21['attrs'][0x0]['value']:undefined)||_0x000f('0x44')},{'name':_0x000f('0x50'),'value':_0x574a21[_0x000f('0x50')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x1]?_0x574a21['attrs'][0x1][_0x000f('0x3c')]:undefined)||null},{'name':_0x000f('0x51'),'value':_0x574a21[_0x000f('0x51')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x2]?_0x574a21['attrs'][0x2][_0x000f('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x574a21[_0x000f('0x45')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x3]?_0x574a21['attrs'][0x3][_0x000f('0x3c')]:undefined)||[]},{'name':'attrChannel','value':_0x574a21['attrChannel']||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x4]?_0x574a21['attrs'][0x4][_0x000f('0x3c')]:undefined)||_0x000f('0x47')},{'name':_0x000f('0x48'),'value':_0x574a21['attrEmailAccounts']||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x5]?_0x574a21[_0x000f('0x3b')][0x5][_0x000f('0x3c')]:undefined)||''},{'name':_0x000f('0x49'),'value':_0x574a21[_0x000f('0x49')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x6]?_0x574a21[_0x000f('0x3b')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x574a21[_0x000f('0x4a')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x7]?_0x574a21[_0x000f('0x3b')][0x7][_0x000f('0x3c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x574a21[_0x000f('0x4b')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x8]?_0x574a21[_0x000f('0x3b')][0x8][_0x000f('0x3c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x574a21[_0x000f('0x4c')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0x9]?_0x574a21[_0x000f('0x3b')][0x9][_0x000f('0x3c')]:undefined)||''},{'name':_0x000f('0x4d'),'value':_0x574a21[_0x000f('0x4d')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21[_0x000f('0x3b')][0xa]?_0x574a21[_0x000f('0x3b')][0xa][_0x000f('0x3c')]:undefined)||''}];case _0x000f('0x52'):return[{'name':'attrReport','type':_0x574a21[_0x000f('0x53')]||(_0x574a21['attrs']&&_0x574a21[_0x000f('0x3b')][0x0]?_0x574a21[_0x000f('0x3b')][0x0][_0x000f('0x54')]:undefined)||null,'value':_0x574a21[_0x000f('0x55')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x0]?_0x574a21[_0x000f('0x3b')][0x0][_0x000f('0x3c')]:undefined)||null},{'name':'attrRefresh','value':_0x574a21[_0x000f('0x56')]||(_0x574a21[_0x000f('0x3b')]&&_0x574a21['attrs'][0x1]?_0x574a21['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x210839){logger[_0x000f('0x28')](_0x000f('0x57'),JSON['stringify'](_0x210839));return[];}}exports[_0x000f('0x58')]=function(_0x2a1c1c,_0x8e76b0){if(_0x2a1c1c[_0x000f('0x59')]){_0x2a1c1c[_0x000f('0x59')][_0x000f('0x3b')]=widgetAttributes(_0x2a1c1c['body']);}return db[_0x000f('0x5a')][_0x000f('0x58')](_0x2a1c1c[_0x000f('0x59')],{})['then'](respondWithResult(_0x8e76b0,0xc9))[_0x000f('0x38')](handleError(_0x8e76b0,null));};exports['update']=function(_0x53ccc3,_0x1deede){if(_0x53ccc3[_0x000f('0x59')]['id']){delete _0x53ccc3[_0x000f('0x59')]['id'];}_0x53ccc3['body'][_0x000f('0x3b')]=widgetAttributes(_0x53ccc3['body']);return db['DashboardItem'][_0x000f('0x5b')]({'where':{'id':_0x53ccc3[_0x000f('0x37')]['id']}})['then'](handleEntityNotFound(_0x1deede,null))['then'](saveUpdates(_0x53ccc3['body'],null))[_0x000f('0x24')](respondWithResult(_0x1deede,null))[_0x000f('0x38')](handleError(_0x1deede,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 380cc68..ed6df6f 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 _0xbd87=['save','update','remove','emit','hook','exports','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd87,0x84));var _0x7bd8=function(_0x12d93a,_0x460b08){_0x12d93a=_0x12d93a-0x0;var _0x5e0913=_0xbd87[_0x12d93a];return _0x5e0913;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x7bd8('0x0'))['db'][_0x7bd8('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7bd8('0x2')](0x0);var events={'afterCreate':_0x7bd8('0x3'),'afterUpdate':_0x7bd8('0x4'),'afterDestroy':_0x7bd8('0x5')};function emitEvent(_0xb9588a){return function(_0x345087,_0x2e06a0,_0x34d94e){DashboardItemEvents['emit'](_0xb9588a+':'+_0x345087['id'],_0x345087);DashboardItemEvents[_0x7bd8('0x6')](_0xb9588a,_0x345087);_0x34d94e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x7bd8('0x7')](e,emitEvent(event));}}module[_0x7bd8('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x2b07=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x22e349,_0x889e6c){var _0x18bf72=function(_0x1437a7){while(--_0x1437a7){_0x22e349['push'](_0x22e349['shift']());}};_0x18bf72(++_0x889e6c);}(_0x2b07,0x7c));var _0x72b0=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x2b07[_0x3635ce];return _0x97ecd0;};'use strict';var EventEmitter=require(_0x72b0('0x0'));var DashboardItem=require(_0x72b0('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x72b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72b0('0x3'),'afterDestroy':_0x72b0('0x4')};function emitEvent(_0x1cbdbf){return function(_0x1bbbc2,_0x3f185f,_0x119fa7){DashboardItemEvents[_0x72b0('0x5')](_0x1cbdbf+':'+_0x1bbbc2['id'],_0x1bbbc2);DashboardItemEvents[_0x72b0('0x5')](_0x1cbdbf,_0x1bbbc2);_0x119fa7(null);};}for(var e in events){if(events[_0x72b0('0x6')](e)){var event=events[e];DashboardItem[_0x72b0('0x7')](e,emitEvent(event));}}module[_0x72b0('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 86e437b..ef75183 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 _0x4350=['../../config/environment','./dashboardItem.attributes','exports','dashboard_items','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4350,0x1d0));var _0x0435=function(_0x576d98,_0x5c392a){_0x576d98=_0x576d98-0x0;var _0x3b445e=_0x4350[_0x576d98];return _0x3b445e;};'use strict';var _=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var logger=require('../../config/logger')(_0x0435('0x2'));var moment=require('moment');var BPromise=require(_0x0435('0x3'));var rp=require(_0x0435('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var attributes=require(_0x0435('0x7'));module[_0x0435('0x8')]=function(_0x58a62d,_0x580eeb){return _0x58a62d['define']('DashboardItem',attributes,{'tableName':_0x0435('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ea5=['dashboard_items','lodash','api','moment','bluebird','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x5b5d1e,_0x4f8c66){var _0x1b8e60=function(_0x3d3ce8){while(--_0x3d3ce8){_0x5b5d1e['push'](_0x5b5d1e['shift']());}};_0x1b8e60(++_0x4f8c66);}(_0x4ea5,0xd3));var _0x54ea=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4ea5[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x54ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x54ea('0x1'));var moment=require(_0x54ea('0x2'));var BPromise=require(_0x54ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54ea('0x4'));var attributes=require(_0x54ea('0x5'));module[_0x54ea('0x6')]=function(_0x40e2f9,_0x37b25d){return _0x40e2f9[_0x54ea('0x7')](_0x54ea('0x8'),attributes,{'tableName':_0x54ea('0x9'),'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 8008aa1..d665660 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 _0x2f03=['message','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x2f03,0x16e));var _0x32f0=function(_0x1dbf65,_0x12fffd){_0x1dbf65=_0x1dbf65-0x0;var _0x8b3ddc=_0x2f03[_0x1dbf65];return _0x8b3ddc;};'use strict';var _=require('lodash');var util=require(_0x32f0('0x0'));var moment=require(_0x32f0('0x1'));var BPromise=require('bluebird');var rs=require(_0x32f0('0x2'));var fs=require('fs');var Redis=require(_0x32f0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x32f0('0x4'));var logger=require(_0x32f0('0x5'))(_0x32f0('0x6'));var config=require('../../config/environment');var jayson=require(_0x32f0('0x7'));var client=jayson[_0x32f0('0x8')][_0x32f0('0x9')]({'port':0x232a});config[_0x32f0('0xa')]=_[_0x32f0('0xb')](config['redis'],{'host':_0x32f0('0xc'),'port':0x18eb});var socket=require(_0x32f0('0xd'))(new Redis(config[_0x32f0('0xa')]));require(_0x32f0('0xe'))[_0x32f0('0xf')](socket);function respondWithRpcPromise(_0x473662,_0x50e3d9,_0x3c64cb){return new BPromise(function(_0xa0562b,_0x432ab6){return client[_0x32f0('0x10')](_0x473662,_0x3c64cb)[_0x32f0('0x11')](function(_0x427e71){logger[_0x32f0('0x12')]('DashboardItem,\x20%s,\x20%s',_0x50e3d9,_0x32f0('0x13'));logger[_0x32f0('0x14')](_0x32f0('0x15'),_0x50e3d9,_0x32f0('0x13'),JSON[_0x32f0('0x16')](_0x427e71));if(_0x427e71[_0x32f0('0x17')]){if(_0x427e71[_0x32f0('0x17')][_0x32f0('0x18')]===0x1f4){logger[_0x32f0('0x17')](_0x32f0('0x19'),_0x50e3d9,_0x427e71[_0x32f0('0x17')][_0x32f0('0x1a')]);return _0x432ab6(_0x427e71[_0x32f0('0x17')][_0x32f0('0x1a')]);}logger[_0x32f0('0x17')](_0x32f0('0x19'),_0x50e3d9,_0x427e71['error'][_0x32f0('0x1a')]);return _0xa0562b(_0x427e71[_0x32f0('0x17')][_0x32f0('0x1a')]);}else{logger[_0x32f0('0x12')](_0x32f0('0x19'),_0x50e3d9,_0x32f0('0x13'));_0xa0562b(_0x427e71['result'][_0x32f0('0x1a')]);}})[_0x32f0('0x1b')](function(_0x52db96){logger[_0x32f0('0x17')](_0x32f0('0x19'),_0x50e3d9,_0x52db96);_0x432ab6(_0x52db96);});});} \ No newline at end of file +var _0x1407=['register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x1407,0x11f));var _0x7140=function(_0x90454c,_0xae7b50){_0x90454c=_0x90454c-0x0;var _0x2a59ff=_0x1407[_0x90454c];return _0x2a59ff;};'use strict';var _=require(_0x7140('0x0'));var util=require(_0x7140('0x1'));var moment=require(_0x7140('0x2'));var BPromise=require(_0x7140('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7140('0x4'));var db=require(_0x7140('0x5'))['db'];var utils=require(_0x7140('0x6'));var logger=require('../../config/logger')(_0x7140('0x7'));var config=require(_0x7140('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7140('0x9')]['http']({'port':0x232a});config[_0x7140('0xa')]=_['defaults'](config[_0x7140('0xa')],{'host':_0x7140('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7140('0xa')]));require('./dashboardItem.socket')[_0x7140('0xc')](socket);function respondWithRpcPromise(_0x219d9e,_0x1ce43f,_0x15e302){return new BPromise(function(_0x3b14f7,_0x487f12){return client[_0x7140('0xd')](_0x219d9e,_0x15e302)['then'](function(_0x226a64){logger['info'](_0x7140('0xe'),_0x1ce43f,_0x7140('0xf'));logger[_0x7140('0x10')](_0x7140('0x11'),_0x1ce43f,_0x7140('0xf'),JSON[_0x7140('0x12')](_0x226a64));if(_0x226a64[_0x7140('0x13')]){if(_0x226a64[_0x7140('0x13')][_0x7140('0x14')]===0x1f4){logger[_0x7140('0x13')](_0x7140('0xe'),_0x1ce43f,_0x226a64[_0x7140('0x13')][_0x7140('0x15')]);return _0x487f12(_0x226a64['error'][_0x7140('0x15')]);}logger[_0x7140('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1ce43f,_0x226a64[_0x7140('0x13')][_0x7140('0x15')]);return _0x3b14f7(_0x226a64[_0x7140('0x13')][_0x7140('0x15')]);}else{logger['info'](_0x7140('0xe'),_0x1ce43f,'request\x20sent');_0x3b14f7(_0x226a64['result']['message']);}})[_0x7140('0x16')](function(_0x96778b){logger[_0x7140('0x13')](_0x7140('0xe'),_0x1ce43f,_0x96778b);_0x487f12(_0x96778b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 90d5138..d7a8685 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 _0x0ce0=['./dashboardItem.events','remove','update','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ce0,0x84));var _0x00ce=function(_0x97be3d,_0x3f3bd2){_0x97be3d=_0x97be3d-0x0;var _0x47ddc4=_0x0ce0[_0x97be3d];return _0x47ddc4;};'use strict';var DashboardItemEvents=require(_0x00ce('0x0'));var events=['save',_0x00ce('0x1'),_0x00ce('0x2')];function createListener(_0x3cd244,_0x25f1d4){return function(_0x57b7f5){_0x25f1d4[_0x00ce('0x3')](_0x3cd244,_0x57b7f5);};}function removeListener(_0x9feaae,_0x16ef5c){return function(){DashboardItemEvents[_0x00ce('0x4')](_0x9feaae,_0x16ef5c);};}exports['register']=function(_0x34acf4){for(var _0x3b0dae=0x0,_0x131e5a=events[_0x00ce('0x5')];_0x3b0dae<_0x131e5a;_0x3b0dae++){var _0x6bf1d1=events[_0x3b0dae];var _0x1d23fd=createListener('dashboardItem:'+_0x6bf1d1,_0x34acf4);DashboardItemEvents['on'](_0x6bf1d1,_0x1d23fd);}}; \ No newline at end of file +var _0xf891=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register','length'];(function(_0x568830,_0x31b329){var _0x247092=function(_0x1e41dc){while(--_0x1e41dc){_0x568830['push'](_0x568830['shift']());}};_0x247092(++_0x31b329);}(_0xf891,0xa3));var _0x1f89=function(_0x516332,_0x3c5f75){_0x516332=_0x516332-0x0;var _0x13d2ca=_0xf891[_0x516332];return _0x13d2ca;};'use strict';var DashboardItemEvents=require(_0x1f89('0x0'));var events=[_0x1f89('0x1'),_0x1f89('0x2'),_0x1f89('0x3')];function createListener(_0x44bb39,_0x190d52){return function(_0x354730){_0x190d52[_0x1f89('0x4')](_0x44bb39,_0x354730);};}function removeListener(_0x4ec02f,_0x4f8a46){return function(){DashboardItemEvents[_0x1f89('0x5')](_0x4ec02f,_0x4f8a46);};}exports[_0x1f89('0x6')]=function(_0x57dfb6){for(var _0x1080f8=0x0,_0x490644=events[_0x1f89('0x7')];_0x1080f8<_0x490644;_0x1080f8++){var _0x35e7d8=events[_0x1080f8];var _0x533680=createListener(_0x1f89('0x8')+_0x35e7d8,_0x57dfb6);DashboardItemEvents['on'](_0x35e7d8,_0x533680);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3766ab4..d7e8b3e 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 _0xb115=['update','delete','/:id','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','put'];(function(_0x343467,_0x24316c){var _0x8e0aac=function(_0x52178d){while(--_0x52178d){_0x343467['push'](_0x343467['shift']());}};_0x8e0aac(++_0x24316c);}(_0xb115,0xe5));var _0x5b11=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb115[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5b11('0x0'));var express=require(_0x5b11('0x1'));var router=express[_0x5b11('0x2')]();var fs_extra=require(_0x5b11('0x3'));var auth=require(_0x5b11('0x4'));var interaction=require(_0x5b11('0x5'));var config=require(_0x5b11('0x6'));var controller=require(_0x5b11('0x7'));router['get']('/:id',auth[_0x5b11('0x8')](),controller['show']);router[_0x5b11('0x9')]('/',auth[_0x5b11('0x8')](),controller['create']);router[_0x5b11('0xa')]('/:id',auth[_0x5b11('0x8')](),controller[_0x5b11('0xb')]);router[_0x5b11('0xc')](_0x5b11('0xd'),auth[_0x5b11('0x8')](),controller[_0x5b11('0xe')]);module[_0x5b11('0xf')]=router; \ No newline at end of file +var _0x8252=['util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','post','put','update','destroy','multer'];(function(_0x23c97e,_0x3d90fd){var _0x448b29=function(_0x3cafcb){while(--_0x3cafcb){_0x23c97e['push'](_0x23c97e['shift']());}};_0x448b29(++_0x3d90fd);}(_0x8252,0xdc));var _0x2825=function(_0x240ce9,_0x40d13a){_0x240ce9=_0x240ce9-0x0;var _0x5ecabd=_0x8252[_0x240ce9];return _0x5ecabd;};'use strict';var multer=require(_0x2825('0x0'));var util=require(_0x2825('0x1'));var path=require('path');var timeout=require(_0x2825('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2825('0x3'));var auth=require(_0x2825('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2825('0x5'));var controller=require('./dashboardItem.controller');router['get'](_0x2825('0x6'),auth[_0x2825('0x7')](),controller[_0x2825('0x8')]);router[_0x2825('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2825('0xa')](_0x2825('0x6'),auth['isAuthenticated'](),controller[_0x2825('0xb')]);router['delete'](_0x2825('0x6'),auth['isAuthenticated'](),controller[_0x2825('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 34323c5..3e7b30d 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 _0x156e=['exports','second','third','first','STRING','sequelize'];(function(_0x366e77,_0x585230){var _0x44e4d1=function(_0x5db1d1){while(--_0x5db1d1){_0x366e77['push'](_0x366e77['shift']());}};_0x44e4d1(++_0x585230);}(_0x156e,0x143));var _0xe156=function(_0x34bacb,_0xa8b67f){_0x34bacb=_0x34bacb-0x0;var _0x4d15a6=_0x156e[_0x34bacb];return _0x4d15a6;};'use strict';var Sequelize=require(_0xe156('0x0'));module[_0xe156('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xe156('0x2'),_0xe156('0x3')),'allowNull':![],'defaultValue':_0xe156('0x4')},'description':{'type':Sequelize[_0xe156('0x5')]}}; \ No newline at end of file +var _0x1002=['first','second','exports','STRING'];(function(_0x490181,_0xeba743){var _0x276b7b=function(_0x428170){while(--_0x428170){_0x490181['push'](_0x490181['shift']());}};_0x276b7b(++_0xeba743);}(_0x1002,0x16e));var _0x2100=function(_0x3c00f1,_0x2551c9){_0x3c00f1=_0x3c00f1-0x0;var _0x5eeeee=_0x1002[_0x3c00f1];return _0x5eeeee;};'use strict';var Sequelize=require('sequelize');module[_0x2100('0x0')]={'name':{'type':Sequelize[_0x2100('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x2100('0x2'),_0x2100('0x3'),'third'),'allowNull':![],'defaultValue':_0x2100('0x2')},'description':{'type':Sequelize[_0x2100('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 57e3902..b11cb60 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 _0x6c45=['params','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show'];(function(_0x362aa5,_0x48c420){var _0x1c69a7=function(_0x15a566){while(--_0x15a566){_0x362aa5['push'](_0x362aa5['shift']());}};_0x1c69a7(++_0x48c420);}(_0x6c45,0x1f2));var _0x56c4=function(_0x41e16c,_0x17e020){_0x41e16c=_0x41e16c-0x0;var _0x2f157e=_0x6c45[_0x41e16c];return _0x2f157e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56c4('0x0'));var zipdir=require(_0x56c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56c4('0x2'));var moment=require(_0x56c4('0x3'));var BPromise=require(_0x56c4('0x4'));var Mustache=require(_0x56c4('0x5'));var util=require(_0x56c4('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x56c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56c4('0x8'));var squel=require(_0x56c4('0x9'));var crypto=require('crypto');var jsforce=require(_0x56c4('0xa'));var deskjs=require(_0x56c4('0xb'));var toCsv=require(_0x56c4('0xc'));var querystring=require(_0x56c4('0xd'));var Papa=require(_0x56c4('0xe'));var Redis=require('ioredis');var authService=require(_0x56c4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x56c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56c4('0x11'))(_0x56c4('0x12'));var utils=require('../../config/utils');var config=require(_0x56c4('0x13'));var licenseUtil=require(_0x56c4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x329174,_0x3280ec){_0x3280ec=_0x3280ec||0xcc;return function(_0x4872b2){if(_0x4872b2){return _0x329174[_0x56c4('0x15')](_0x3280ec);}return _0x329174['status'](_0x3280ec)[_0x56c4('0x16')]();};}function respondWithResult(_0x186692,_0x443930){_0x443930=_0x443930||0xc8;return function(_0x424b5c){if(_0x424b5c){return _0x186692[_0x56c4('0x17')](_0x443930)['json'](_0x424b5c);}};}function respondWithFilteredResult(_0x262cd9,_0xbfae86){return function(_0x73e4d5){if(_0x73e4d5){var _0x280193=typeof _0xbfae86[_0x56c4('0x18')]===_0x56c4('0x19')&&typeof _0xbfae86[_0x56c4('0x1a')]===_0x56c4('0x19');var _0x1cc63b=_0x73e4d5[_0x56c4('0x1b')];var _0x1d8151=_0x280193?0x0:_0xbfae86[_0x56c4('0x18')];var _0x41d763=_0x280193?_0x73e4d5['count']:_0xbfae86[_0x56c4('0x18')]+_0xbfae86['limit'];var _0x12e05e;if(_0x41d763>=_0x1cc63b){_0x41d763=_0x1cc63b;_0x12e05e=0xc8;}else{_0x12e05e=0xce;}_0x262cd9[_0x56c4('0x17')](_0x12e05e);return _0x262cd9['set'](_0x56c4('0x1c'),_0x1d8151+'-'+_0x41d763+'/'+_0x1cc63b)[_0x56c4('0x1d')](_0x73e4d5);}return null;};}function patchUpdates(_0x4fe204){return function(_0x649db9){try{jsonpatch[_0x56c4('0x1e')](_0x649db9,_0x4fe204,!![]);}catch(_0x4d8cc4){return BPromise[_0x56c4('0x1f')](_0x4d8cc4);}return _0x649db9[_0x56c4('0x20')]();};}function saveUpdates(_0x518311,_0x3c34ad){return function(_0x381bdd){if(_0x381bdd){return _0x381bdd[_0x56c4('0x21')](_0x518311)[_0x56c4('0x22')](function(_0x27e985){return _0x27e985;});}return null;};}function removeEntity(_0x50ffde,_0x274e80){return function(_0x1dfc32){if(_0x1dfc32){return _0x1dfc32[_0x56c4('0x23')]()[_0x56c4('0x22')](function(){var _0x163190=_0x1dfc32[_0x56c4('0x24')]({'plain':!![]});var _0x23da42=_0x56c4('0x25');return db[_0x56c4('0x26')][_0x56c4('0x23')]({'where':{'type':_0x23da42,'resourceId':_0x163190['id']}})['then'](function(){return _0x1dfc32;});})['then'](function(){_0x50ffde[_0x56c4('0x17')](0xcc)[_0x56c4('0x16')]();});}};}function handleEntityNotFound(_0x166e20,_0x2334df){return function(_0x5c4369){if(!_0x5c4369){_0x166e20[_0x56c4('0x15')](0x194);}return _0x5c4369;};}function handleError(_0x5a9414,_0x3f374e){_0x3f374e=_0x3f374e||0x1f4;return function(_0x47b678){logger[_0x56c4('0x27')](_0x47b678[_0x56c4('0x28')]);if(_0x47b678[_0x56c4('0x29')]){delete _0x47b678[_0x56c4('0x29')];}_0x5a9414['status'](_0x3f374e)[_0x56c4('0x2a')](_0x47b678);};}exports[_0x56c4('0x2b')]=function(_0x2821b9,_0x10968e){var _0x25e1ea={},_0x23e3bc={},_0x24966a={'count':0x0,'rows':[]};var _0x27094e=_[_0x56c4('0x2c')](db[_0x56c4('0x2d')][_0x56c4('0x2e')],function(_0x51e46c){return{'name':_0x51e46c[_0x56c4('0x2f')],'type':_0x51e46c[_0x56c4('0x30')][_0x56c4('0x31')]};});_0x23e3bc['model']=_[_0x56c4('0x2c')](_0x27094e,'name');_0x23e3bc['query']=_[_0x56c4('0x32')](_0x2821b9[_0x56c4('0x33')]);_0x23e3bc[_0x56c4('0x34')]=_['intersection'](_0x23e3bc['model'],_0x23e3bc['query']);_0x25e1ea['attributes']=_[_0x56c4('0x35')](_0x23e3bc[_0x56c4('0x36')],qs[_0x56c4('0x37')](_0x2821b9['query'][_0x56c4('0x37')]));_0x25e1ea['attributes']=_0x25e1ea[_0x56c4('0x38')][_0x56c4('0x39')]?_0x25e1ea[_0x56c4('0x38')]:_0x23e3bc[_0x56c4('0x36')];if(!_0x2821b9[_0x56c4('0x33')][_0x56c4('0x3a')]('nolimit')){_0x25e1ea['limit']=qs['limit'](_0x2821b9[_0x56c4('0x33')][_0x56c4('0x1a')]);_0x25e1ea[_0x56c4('0x18')]=qs[_0x56c4('0x18')](_0x2821b9[_0x56c4('0x33')][_0x56c4('0x18')]);}_0x25e1ea['order']=qs[_0x56c4('0x3b')](_0x2821b9[_0x56c4('0x33')][_0x56c4('0x3b')]);_0x25e1ea[_0x56c4('0x3c')]=qs[_0x56c4('0x34')](_[_0x56c4('0x3d')](_0x2821b9[_0x56c4('0x33')],_0x23e3bc[_0x56c4('0x34')]),_0x27094e);if(_0x2821b9[_0x56c4('0x33')][_0x56c4('0x3e')]){_0x25e1ea[_0x56c4('0x3c')]=_[_0x56c4('0x3f')](_0x25e1ea[_0x56c4('0x3c')],{'$or':_['map'](_0x27094e,function(_0x2fca50){if(_0x2fca50['type']!=='VIRTUAL'){var _0x4e94d6={};_0x4e94d6[_0x2fca50[_0x56c4('0x29')]]={'$like':'%'+_0x2821b9[_0x56c4('0x33')]['filter']+'%'};return _0x4e94d6;}})});}_0x25e1ea=_[_0x56c4('0x3f')]({},_0x25e1ea,_0x2821b9['options']);var _0x2b7076={'where':_0x25e1ea[_0x56c4('0x3c')]};return db['Disposition'][_0x56c4('0x1b')](_0x2b7076)['then'](function(_0x4d3a33){_0x24966a['count']=_0x4d3a33;if(_0x2821b9[_0x56c4('0x33')][_0x56c4('0x40')]){_0x25e1ea['include']=[{'all':!![]}];}return db[_0x56c4('0x2d')][_0x56c4('0x41')](_0x25e1ea);})['then'](function(_0x2f4277){_0x24966a[_0x56c4('0x42')]=_0x2f4277;return _0x24966a;})['then'](respondWithFilteredResult(_0x10968e,_0x25e1ea))[_0x56c4('0x43')](handleError(_0x10968e,null));};exports[_0x56c4('0x44')]=function(_0x5a64c7,_0x36c56a){var _0x36ab5b={'raw':!![],'where':{'id':_0x5a64c7[_0x56c4('0x45')]['id']}},_0x31f858={};_0x31f858[_0x56c4('0x36')]=_[_0x56c4('0x32')](db[_0x56c4('0x2d')]['rawAttributes']);_0x31f858[_0x56c4('0x33')]=_[_0x56c4('0x32')](_0x5a64c7[_0x56c4('0x33')]);_0x31f858['filters']=_[_0x56c4('0x35')](_0x31f858[_0x56c4('0x36')],_0x31f858[_0x56c4('0x33')]);_0x36ab5b[_0x56c4('0x38')]=_[_0x56c4('0x35')](_0x31f858[_0x56c4('0x36')],qs[_0x56c4('0x37')](_0x5a64c7[_0x56c4('0x33')][_0x56c4('0x37')]));_0x36ab5b[_0x56c4('0x38')]=_0x36ab5b[_0x56c4('0x38')][_0x56c4('0x39')]?_0x36ab5b[_0x56c4('0x38')]:_0x31f858[_0x56c4('0x36')];if(_0x5a64c7['query'][_0x56c4('0x40')]){_0x36ab5b[_0x56c4('0x46')]=[{'all':!![]}];}_0x36ab5b=_[_0x56c4('0x3f')]({},_0x36ab5b,_0x5a64c7[_0x56c4('0x47')]);return db[_0x56c4('0x2d')][_0x56c4('0x48')](_0x36ab5b)[_0x56c4('0x22')](handleEntityNotFound(_0x36c56a,null))['then'](respondWithResult(_0x36c56a,null))[_0x56c4('0x43')](handleError(_0x36c56a,null));};exports[_0x56c4('0x49')]=function(_0x1dc75b,_0x73ecee){return db[_0x56c4('0x2d')][_0x56c4('0x49')](_0x1dc75b[_0x56c4('0x4a')],{})[_0x56c4('0x22')](function(_0x2398fd){var _0x44551c=_0x1dc75b['user'][_0x56c4('0x24')]({'plain':!![]});if(!_0x44551c)throw new Error(_0x56c4('0x4b'));if(_0x44551c[_0x56c4('0x4c')]===_0x56c4('0x4d')){var _0x381813=_0x2398fd[_0x56c4('0x24')]({'plain':!![]});var _0x202dd0=_0x56c4('0x25');return db[_0x56c4('0x4e')][_0x56c4('0x48')]({'where':{'name':_0x202dd0,'userProfileId':_0x44551c[_0x56c4('0x4f')]},'raw':!![]})[_0x56c4('0x22')](function(_0x1872c6){if(_0x1872c6&&_0x1872c6['autoAssociation']===0x0){return db['UserProfileResource'][_0x56c4('0x49')]({'name':_0x381813[_0x56c4('0x29')],'resourceId':_0x381813['id'],'type':_0x1872c6[_0x56c4('0x29')],'sectionId':_0x1872c6['id']},{})[_0x56c4('0x22')](function(){return _0x2398fd;});}else{return _0x2398fd;}})['catch'](function(_0x3100d7){logger[_0x56c4('0x27')](_0x56c4('0x50'),_0x3100d7);throw _0x3100d7;});}return _0x2398fd;})['then'](respondWithResult(_0x73ecee,0xc9))['catch'](handleError(_0x73ecee,null));};exports[_0x56c4('0x21')]=function(_0x480117,_0x19f7bc){if(_0x480117[_0x56c4('0x4a')]['id']){delete _0x480117[_0x56c4('0x4a')]['id'];}return db['Disposition'][_0x56c4('0x48')]({'where':{'id':_0x480117[_0x56c4('0x45')]['id']}})['then'](handleEntityNotFound(_0x19f7bc,null))[_0x56c4('0x22')](saveUpdates(_0x480117['body'],null))[_0x56c4('0x22')](respondWithResult(_0x19f7bc,null))[_0x56c4('0x43')](handleError(_0x19f7bc,null));};exports['destroy']=function(_0xd2fa93,_0x338b58){return db['Disposition'][_0x56c4('0x48')]({'where':{'id':_0xd2fa93[_0x56c4('0x45')]['id']}})[_0x56c4('0x22')](handleEntityNotFound(_0x338b58,null))[_0x56c4('0x22')](removeEntity(_0x338b58,null))[_0x56c4('0x43')](handleError(_0x338b58,null));}; \ No newline at end of file +var _0xdcd0=['get','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','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','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','Disposition','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user'];(function(_0x19e163,_0x140024){var _0x5c9659=function(_0xf10d1b){while(--_0xf10d1b){_0x19e163['push'](_0x19e163['shift']());}};_0x5c9659(++_0x140024);}(_0xdcd0,0x18e));var _0x0dcd=function(_0x5db671,_0x2e6368){_0x5db671=_0x5db671-0x0;var _0x3c5d15=_0xdcd0[_0x5db671];return _0x3c5d15;};'use strict';var emlformat=require(_0x0dcd('0x0'));var rimraf=require(_0x0dcd('0x1'));var zipdir=require(_0x0dcd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dcd('0x3'));var moment=require(_0x0dcd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0dcd('0x5'));var util=require(_0x0dcd('0x6'));var path=require(_0x0dcd('0x7'));var sox=require('sox');var csv=require(_0x0dcd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0dcd('0x9'));var _=require(_0x0dcd('0xa'));var squel=require(_0x0dcd('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0dcd('0xc'));var toCsv=require(_0x0dcd('0x8'));var querystring=require(_0x0dcd('0xd'));var Papa=require(_0x0dcd('0xe'));var Redis=require(_0x0dcd('0xf'));var authService=require(_0x0dcd('0x10'));var qs=require(_0x0dcd('0x11'));var as=require(_0x0dcd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0dcd('0x13'));var utils=require(_0x0dcd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0dcd('0x15'));var db=require(_0x0dcd('0x16'))['db'];function respondWithStatusCode(_0x2bf667,_0x2181f2){_0x2181f2=_0x2181f2||0xcc;return function(_0x205315){if(_0x205315){return _0x2bf667[_0x0dcd('0x17')](_0x2181f2);}return _0x2bf667[_0x0dcd('0x18')](_0x2181f2)[_0x0dcd('0x19')]();};}function respondWithResult(_0x77ad5f,_0x983603){_0x983603=_0x983603||0xc8;return function(_0x175e35){if(_0x175e35){return _0x77ad5f[_0x0dcd('0x18')](_0x983603)[_0x0dcd('0x1a')](_0x175e35);}};}function respondWithFilteredResult(_0x579327,_0x325ca2){return function(_0x3a5402){if(_0x3a5402){var _0x4e09d5=typeof _0x325ca2[_0x0dcd('0x1b')]==='undefined'&&typeof _0x325ca2[_0x0dcd('0x1c')]==='undefined';var _0x529170=_0x3a5402['count'];var _0x105c01=_0x4e09d5?0x0:_0x325ca2[_0x0dcd('0x1b')];var _0x538db0=_0x4e09d5?_0x3a5402[_0x0dcd('0x1d')]:_0x325ca2[_0x0dcd('0x1b')]+_0x325ca2[_0x0dcd('0x1c')];var _0x19d5c5;if(_0x538db0>=_0x529170){_0x538db0=_0x529170;_0x19d5c5=0xc8;}else{_0x19d5c5=0xce;}_0x579327[_0x0dcd('0x18')](_0x19d5c5);return _0x579327[_0x0dcd('0x1e')](_0x0dcd('0x1f'),_0x105c01+'-'+_0x538db0+'/'+_0x529170)['json'](_0x3a5402);}return null;};}function patchUpdates(_0x26e880){return function(_0x462b7a){try{jsonpatch[_0x0dcd('0x20')](_0x462b7a,_0x26e880,!![]);}catch(_0x2a6b74){return BPromise[_0x0dcd('0x21')](_0x2a6b74);}return _0x462b7a[_0x0dcd('0x22')]();};}function saveUpdates(_0x191bb3,_0x43b51f){return function(_0x1b12d5){if(_0x1b12d5){return _0x1b12d5['update'](_0x191bb3)[_0x0dcd('0x23')](function(_0x298ad8){return _0x298ad8;});}return null;};}function removeEntity(_0x1bd0e7,_0x20d312){return function(_0x321fe1){if(_0x321fe1){return _0x321fe1[_0x0dcd('0x24')]()[_0x0dcd('0x23')](function(){var _0x202d56=_0x321fe1['get']({'plain':!![]});var _0x3654d4='Dispositions';return db[_0x0dcd('0x25')]['destroy']({'where':{'type':_0x3654d4,'resourceId':_0x202d56['id']}})[_0x0dcd('0x23')](function(){return _0x321fe1;});})['then'](function(){_0x1bd0e7[_0x0dcd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22adba,_0x446037){return function(_0x4c8873){if(!_0x4c8873){_0x22adba[_0x0dcd('0x17')](0x194);}return _0x4c8873;};}function handleError(_0x4755fb,_0x4c9ada){_0x4c9ada=_0x4c9ada||0x1f4;return function(_0x1bd7c7){logger[_0x0dcd('0x26')](_0x1bd7c7[_0x0dcd('0x27')]);if(_0x1bd7c7[_0x0dcd('0x28')]){delete _0x1bd7c7[_0x0dcd('0x28')];}_0x4755fb['status'](_0x4c9ada)['send'](_0x1bd7c7);};}exports[_0x0dcd('0x29')]=function(_0x5db232,_0x3bd447){var _0x42cbf2={},_0x4ee47b={},_0x3d80c7={'count':0x0,'rows':[]};var _0x439131=_[_0x0dcd('0x2a')](db[_0x0dcd('0x2b')]['rawAttributes'],function(_0xb88563){return{'name':_0xb88563['fieldName'],'type':_0xb88563[_0x0dcd('0x2c')]['key']};});_0x4ee47b[_0x0dcd('0x2d')]=_[_0x0dcd('0x2a')](_0x439131,_0x0dcd('0x28'));_0x4ee47b[_0x0dcd('0x2e')]=_[_0x0dcd('0x2f')](_0x5db232[_0x0dcd('0x2e')]);_0x4ee47b[_0x0dcd('0x30')]=_[_0x0dcd('0x31')](_0x4ee47b['model'],_0x4ee47b['query']);_0x42cbf2[_0x0dcd('0x32')]=_[_0x0dcd('0x31')](_0x4ee47b[_0x0dcd('0x2d')],qs[_0x0dcd('0x33')](_0x5db232[_0x0dcd('0x2e')][_0x0dcd('0x33')]));_0x42cbf2[_0x0dcd('0x32')]=_0x42cbf2[_0x0dcd('0x32')][_0x0dcd('0x34')]?_0x42cbf2[_0x0dcd('0x32')]:_0x4ee47b[_0x0dcd('0x2d')];if(!_0x5db232['query'][_0x0dcd('0x35')]('nolimit')){_0x42cbf2[_0x0dcd('0x1c')]=qs[_0x0dcd('0x1c')](_0x5db232[_0x0dcd('0x2e')][_0x0dcd('0x1c')]);_0x42cbf2[_0x0dcd('0x1b')]=qs['offset'](_0x5db232[_0x0dcd('0x2e')][_0x0dcd('0x1b')]);}_0x42cbf2[_0x0dcd('0x36')]=qs[_0x0dcd('0x37')](_0x5db232['query']['sort']);_0x42cbf2[_0x0dcd('0x38')]=qs[_0x0dcd('0x30')](_['pick'](_0x5db232[_0x0dcd('0x2e')],_0x4ee47b[_0x0dcd('0x30')]),_0x439131);if(_0x5db232['query']['filter']){_0x42cbf2[_0x0dcd('0x38')]=_[_0x0dcd('0x39')](_0x42cbf2['where'],{'$or':_[_0x0dcd('0x2a')](_0x439131,function(_0x460a76){if(_0x460a76['type']!==_0x0dcd('0x3a')){var _0x2fa5c1={};_0x2fa5c1[_0x460a76['name']]={'$like':'%'+_0x5db232[_0x0dcd('0x2e')]['filter']+'%'};return _0x2fa5c1;}})});}_0x42cbf2=_['merge']({},_0x42cbf2,_0x5db232[_0x0dcd('0x3b')]);var _0x4db7c2={'where':_0x42cbf2[_0x0dcd('0x38')]};return db[_0x0dcd('0x2b')][_0x0dcd('0x1d')](_0x4db7c2)[_0x0dcd('0x23')](function(_0x1c4d20){_0x3d80c7[_0x0dcd('0x1d')]=_0x1c4d20;if(_0x5db232[_0x0dcd('0x2e')][_0x0dcd('0x3c')]){_0x42cbf2[_0x0dcd('0x3d')]=[{'all':!![]}];}return db['Disposition'][_0x0dcd('0x3e')](_0x42cbf2);})[_0x0dcd('0x23')](function(_0x38ba79){_0x3d80c7[_0x0dcd('0x3f')]=_0x38ba79;return _0x3d80c7;})[_0x0dcd('0x23')](respondWithFilteredResult(_0x3bd447,_0x42cbf2))[_0x0dcd('0x40')](handleError(_0x3bd447,null));};exports[_0x0dcd('0x41')]=function(_0x5efb42,_0x75791e){var _0x2de58b={'raw':!![],'where':{'id':_0x5efb42[_0x0dcd('0x42')]['id']}},_0x32bb73={};_0x32bb73[_0x0dcd('0x2d')]=_[_0x0dcd('0x2f')](db[_0x0dcd('0x2b')]['rawAttributes']);_0x32bb73['query']=_[_0x0dcd('0x2f')](_0x5efb42['query']);_0x32bb73[_0x0dcd('0x30')]=_[_0x0dcd('0x31')](_0x32bb73[_0x0dcd('0x2d')],_0x32bb73[_0x0dcd('0x2e')]);_0x2de58b[_0x0dcd('0x32')]=_[_0x0dcd('0x31')](_0x32bb73[_0x0dcd('0x2d')],qs[_0x0dcd('0x33')](_0x5efb42['query'][_0x0dcd('0x33')]));_0x2de58b[_0x0dcd('0x32')]=_0x2de58b[_0x0dcd('0x32')][_0x0dcd('0x34')]?_0x2de58b['attributes']:_0x32bb73[_0x0dcd('0x2d')];if(_0x5efb42[_0x0dcd('0x2e')][_0x0dcd('0x3c')]){_0x2de58b[_0x0dcd('0x3d')]=[{'all':!![]}];}_0x2de58b=_['merge']({},_0x2de58b,_0x5efb42[_0x0dcd('0x3b')]);return db[_0x0dcd('0x2b')][_0x0dcd('0x43')](_0x2de58b)[_0x0dcd('0x23')](handleEntityNotFound(_0x75791e,null))['then'](respondWithResult(_0x75791e,null))[_0x0dcd('0x40')](handleError(_0x75791e,null));};exports['create']=function(_0x58fee8,_0x5f155e){return db[_0x0dcd('0x2b')][_0x0dcd('0x44')](_0x58fee8['body'],{})[_0x0dcd('0x23')](function(_0x3287af){var _0x5126a3=_0x58fee8[_0x0dcd('0x45')][_0x0dcd('0x46')]({'plain':!![]});if(!_0x5126a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5126a3[_0x0dcd('0x47')]===_0x0dcd('0x45')){var _0x1e5df6=_0x3287af['get']({'plain':!![]});var _0xa77d54=_0x0dcd('0x48');return db[_0x0dcd('0x49')]['find']({'where':{'name':_0xa77d54,'userProfileId':_0x5126a3[_0x0dcd('0x4a')]},'raw':!![]})[_0x0dcd('0x23')](function(_0x433508){if(_0x433508&&_0x433508[_0x0dcd('0x4b')]===0x0){return db[_0x0dcd('0x25')]['create']({'name':_0x1e5df6[_0x0dcd('0x28')],'resourceId':_0x1e5df6['id'],'type':_0x433508[_0x0dcd('0x28')],'sectionId':_0x433508['id']},{})[_0x0dcd('0x23')](function(){return _0x3287af;});}else{return _0x3287af;}})[_0x0dcd('0x40')](function(_0x294944){logger[_0x0dcd('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x294944);throw _0x294944;});}return _0x3287af;})[_0x0dcd('0x23')](respondWithResult(_0x5f155e,0xc9))[_0x0dcd('0x40')](handleError(_0x5f155e,null));};exports[_0x0dcd('0x4c')]=function(_0xe5edbf,_0x38e763){if(_0xe5edbf[_0x0dcd('0x4d')]['id']){delete _0xe5edbf[_0x0dcd('0x4d')]['id'];}return db['Disposition'][_0x0dcd('0x43')]({'where':{'id':_0xe5edbf[_0x0dcd('0x42')]['id']}})['then'](handleEntityNotFound(_0x38e763,null))[_0x0dcd('0x23')](saveUpdates(_0xe5edbf[_0x0dcd('0x4d')],null))[_0x0dcd('0x23')](respondWithResult(_0x38e763,null))['catch'](handleError(_0x38e763,null));};exports[_0x0dcd('0x24')]=function(_0x233ef2,_0x583899){return db['Disposition'][_0x0dcd('0x43')]({'where':{'id':_0x233ef2[_0x0dcd('0x42')]['id']}})[_0x0dcd('0x23')](handleEntityNotFound(_0x583899,null))[_0x0dcd('0x23')](removeEntity(_0x583899,null))[_0x0dcd('0x40')](handleError(_0x583899,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 8a8a6df..1ba581f 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 _0xc877=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xc877,0x18b));var _0x7c87=function(_0x1d6faf,_0x25e7e6){_0x1d6faf=_0x1d6faf-0x0;var _0x5efa5b=_0xc877[_0x1d6faf];return _0x5efa5b;};'use strict';var _=require(_0x7c87('0x0'));var util=require(_0x7c87('0x1'));var logger=require(_0x7c87('0x2'))(_0x7c87('0x3'));var moment=require(_0x7c87('0x4'));var BPromise=require(_0x7c87('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c87('0x6'));var rimraf=require(_0x7c87('0x7'));var config=require(_0x7c87('0x8'));var attributes=require(_0x7c87('0x9'));module[_0x7c87('0xa')]=function(_0xffe766,_0x5942a7){return _0xffe766[_0x7c87('0xb')](_0x7c87('0xc'),attributes,{'tableName':_0x7c87('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7c87('0xe'),'fields':[_0x7c87('0xf'),'ListId']},{'unique':!![],'name':_0x7c87('0x10'),'fields':[_0x7c87('0xf'),_0x7c87('0x11')]},{'unique':!![],'name':_0x7c87('0x12'),'fields':[_0x7c87('0xf'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x7c87('0xf'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x7c87('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x7c87('0x13'),'fields':['name',_0x7c87('0x14')]},{'unique':!![],'name':_0x7c87('0x15'),'fields':[_0x7c87('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7d1=['define','Disposition','name_voice','ListId','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','bluebird','path','rimraf','./disposition.attributes','exports'];(function(_0x25b0bb,_0x53c5a6){var _0x416761=function(_0x5e42cb){while(--_0x5e42cb){_0x25b0bb['push'](_0x25b0bb['shift']());}};_0x416761(++_0x53c5a6);}(_0xf7d1,0x99));var _0x1f7d=function(_0x5087c6,_0x46dc83){_0x5087c6=_0x5087c6-0x0;var _0x2b91ca=_0xf7d1[_0x5087c6];return _0x2b91ca;};'use strict';var _=require(_0x1f7d('0x0'));var util=require('util');var logger=require(_0x1f7d('0x1'))(_0x1f7d('0x2'));var moment=require('moment');var BPromise=require(_0x1f7d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f7d('0x4'));var rimraf=require(_0x1f7d('0x5'));var config=require('../../config/environment');var attributes=require(_0x1f7d('0x6'));module[_0x1f7d('0x7')]=function(_0x35c8a9,_0x1f3c96){return _0x35c8a9[_0x1f7d('0x8')](_0x1f7d('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x1f7d('0xa'),'fields':['name',_0x1f7d('0xb')]},{'unique':!![],'name':'name_chat','fields':[_0x1f7d('0xc'),_0x1f7d('0xd')]},{'unique':!![],'name':_0x1f7d('0xe'),'fields':[_0x1f7d('0xc'),_0x1f7d('0xf')]},{'unique':!![],'name':_0x1f7d('0x10'),'fields':[_0x1f7d('0xc'),_0x1f7d('0x11')]},{'unique':!![],'name':_0x1f7d('0x12'),'fields':[_0x1f7d('0xc'),_0x1f7d('0x13')]},{'unique':!![],'name':_0x1f7d('0x14'),'fields':[_0x1f7d('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0x1f7d('0x15'),'fields':[_0x1f7d('0xc'),_0x1f7d('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d91425e..a562764 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(_0x1058e9,_0x1745dc){var _0x68d59c=function(_0x263ae1){while(--_0x263ae1){_0x1058e9['push'](_0x1058e9['shift']());}};_0x68d59c(++_0x1745dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0xe53c8c,_0x2590ef){var _0x9a4996=function(_0x4f0c40){while(--_0x4f0c40){_0xe53c8c['push'](_0xe53c8c['shift']());}};_0x9a4996(++_0x2590ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 8a98d2f..f1c7802 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 _0xc0a1=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x3bb8eb,_0x2efe48){var _0x505c94=function(_0xff6579){while(--_0xff6579){_0x3bb8eb['push'](_0x3bb8eb['shift']());}};_0x505c94(++_0x2efe48);}(_0xc0a1,0xf7));var _0x1c0a=function(_0x2a59e0,_0xc12ff){_0x2a59e0=_0x2a59e0-0x0;var _0x48813a=_0xc0a1[_0x2a59e0];return _0x48813a;};'use strict';var multer=require(_0x1c0a('0x0'));var util=require(_0x1c0a('0x1'));var path=require('path');var timeout=require(_0x1c0a('0x2'));var express=require('express');var router=express[_0x1c0a('0x3')]();var fs_extra=require(_0x1c0a('0x4'));var auth=require(_0x1c0a('0x5'));var interaction=require(_0x1c0a('0x6'));var config=require(_0x1c0a('0x7'));var controller=require(_0x1c0a('0x8'));router[_0x1c0a('0x9')]('/',auth[_0x1c0a('0xa')](),controller[_0x1c0a('0xb')]);router[_0x1c0a('0x9')](_0x1c0a('0xc'),auth[_0x1c0a('0xa')](),controller[_0x1c0a('0xd')]);router[_0x1c0a('0xe')]('/',auth['isAuthenticated'](),controller[_0x1c0a('0xf')]);router[_0x1c0a('0x10')](_0x1c0a('0xc'),auth[_0x1c0a('0xa')](),controller[_0x1c0a('0x11')]);router[_0x1c0a('0x12')](_0x1c0a('0xc'),auth[_0x1c0a('0xa')](),controller[_0x1c0a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc666=['../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x1430fc,_0x23dd72){var _0x5610ea=function(_0x5a192c){while(--_0x5a192c){_0x1430fc['push'](_0x1430fc['shift']());}};_0x5610ea(++_0x23dd72);}(_0xc666,0xa6));var _0x6c66=function(_0x282c40,_0x56c069){_0x282c40=_0x282c40-0x0;var _0x1d9042=_0xc666[_0x282c40];return _0x1d9042;};'use strict';var multer=require(_0x6c66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6c66('0x1'));var express=require(_0x6c66('0x2'));var router=express[_0x6c66('0x3')]();var fs_extra=require(_0x6c66('0x4'));var auth=require(_0x6c66('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c66('0x6'));var controller=require(_0x6c66('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6c66('0x8')]('/:id',auth[_0x6c66('0x9')](),controller[_0x6c66('0xa')]);router[_0x6c66('0xb')]('/',auth[_0x6c66('0x9')](),controller[_0x6c66('0xc')]);router[_0x6c66('0xd')](_0x6c66('0xe'),auth[_0x6c66('0x9')](),controller[_0x6c66('0xf')]);router[_0x6c66('0x10')](_0x6c66('0xe'),auth[_0x6c66('0x9')](),controller[_0x6c66('0x11')]);module[_0x6c66('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8dfbcb0..20a7030 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 _0xd101=['KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','SIP','DADHI'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd101,0xc1));var _0x1d10=function(_0x82e632,_0x4359da){_0x82e632=_0x82e632-0x0;var _0x1d19ac=_0xd101[_0x82e632];return _0x1d19ac;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d10('0x1')]},'ecm':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x3'),'no'),'defaultValue':_0x1d10('0x3')},'headerinfo':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':_0x1d10('0x4')},'localstationid':{'type':Sequelize[_0x1d10('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa')),'defaultValue':_0x1d10('0x6')},'maxrate':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa')),'defaultValue':_0x1d10('0xa')},'modem':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1d10('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1d10('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1d10('0x2')](_0x1d10('0xc'),'IAX',_0x1d10('0xd'),_0x1d10('0xe')),'defaultValue':_0x1d10('0xc')},'key':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1d10('0xf')],'defaultValue':function(){return _0x1d10('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1d10('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d10('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x1d10('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1d10('0x11')],'defaultValue':![],'comment':_0x1d10('0x13'),'set':function(_0x4528a6){if(!_0x4528a6)this['setDataValue'](_0x1d10('0x14'),null);this[_0x1d10('0x15')](_0x1d10('0x16'),_0x4528a6);}}}; \ No newline at end of file +var _0xf767=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x4bd771,_0x5e42a3){var _0x11476d=function(_0x8fc44c){while(--_0x8fc44c){_0x4bd771['push'](_0x4bd771['shift']());}};_0x11476d(++_0x5e42a3);}(_0xf767,0x76));var _0x7f76=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xf767[_0x26f1b2];return _0x1624a4;};'use strict';var Sequelize=require('sequelize');module[_0x7f76('0x0')]={'name':{'type':Sequelize[_0x7f76('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f76('0x1')]},'ecm':{'type':Sequelize[_0x7f76('0x2')](_0x7f76('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':_0x7f76('0x4')},'localstationid':{'type':Sequelize[_0x7f76('0x1')],'unique':_0x7f76('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x7f76('0x6'),_0x7f76('0x7'),_0x7f76('0x8'),_0x7f76('0x9'),_0x7f76('0xa'),'14400'),'defaultValue':_0x7f76('0x7')},'maxrate':{'type':Sequelize[_0x7f76('0x2')](_0x7f76('0x6'),_0x7f76('0x7'),'7200',_0x7f76('0x9'),'12000',_0x7f76('0xb')),'defaultValue':_0x7f76('0xb')},'modem':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':_0x7f76('0xc')},'gateway':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7f76('0x2')](_0x7f76('0xd'),_0x7f76('0xe'),_0x7f76('0xf'),_0x7f76('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x7f76('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7f76('0x11');}},'notificationSound':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f76('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f76('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':![],'comment':_0x7f76('0x14'),'set':function(_0x431076){if(!_0x431076)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x431076);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4bbd4a9..879352a 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 _0xf2ee=['split','format','CmList','List','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','pick','CannedAnswer','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','color','tag','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','sendStatus','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','push','ecm','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','sequelize','bulkCreate','VoiceExtension','tech','key','TrunkId','ListId','findById','getMessages','FaxMessage','$gte'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xf2ee,0xdb));var _0xef2e=function(_0x874b99,_0x36f347){_0x874b99=_0x874b99-0x0;var _0xe6ef04=_0xf2ee[_0x874b99];return _0xe6ef04;};'use strict';var emlformat=require(_0xef2e('0x0'));var rimraf=require(_0xef2e('0x1'));var zipdir=require(_0xef2e('0x2'));var jsonpatch=require(_0xef2e('0x3'));var rp=require(_0xef2e('0x4'));var moment=require('moment');var BPromise=require(_0xef2e('0x5'));var Mustache=require(_0xef2e('0x6'));var util=require(_0xef2e('0x7'));var path=require(_0xef2e('0x8'));var sox=require(_0xef2e('0x9'));var csv=require(_0xef2e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef2e('0xb'));var _=require(_0xef2e('0xc'));var squel=require('squel');var crypto=require(_0xef2e('0xd'));var jsforce=require(_0xef2e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef2e('0xf'));var Papa=require(_0xef2e('0x10'));var Redis=require(_0xef2e('0x11'));var authService=require(_0xef2e('0x12'));var qs=require(_0xef2e('0x13'));var as=require(_0xef2e('0x14'));var hardwareService=require(_0xef2e('0x15'));var logger=require(_0xef2e('0x16'))(_0xef2e('0x17'));var utils=require(_0xef2e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xef2e('0x19'));var db=require('../../mysqldb')['db'];config[_0xef2e('0x1a')]=_[_0xef2e('0x1b')](config['redis'],{'host':_0xef2e('0x1c'),'port':0x18eb});var socket=require(_0xef2e('0x1d'))(new Redis(config[_0xef2e('0x1a')]));require(_0xef2e('0x1e'))['register'](socket);var jayson=require(_0xef2e('0x1f'));var client=jayson['client'][_0xef2e('0x20')]({'port':0x232c});var client9002=jayson[_0xef2e('0x21')][_0xef2e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2c57a2,_0x43232f,_0x499a0c,_0x29b309){return new BPromise(function(_0x32a144,_0x3d32b6){var _0x27b5ed=_0x29b309||client;return _0x27b5ed[_0xef2e('0x22')](_0x2c57a2,_0x499a0c)[_0xef2e('0x23')](function(_0x228bc3){logger[_0xef2e('0x24')](_0xef2e('0x25'),_0x43232f,'request\x20sent');logger[_0xef2e('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x43232f,_0xef2e('0x27'),JSON[_0xef2e('0x28')](_0x228bc3));if(_0x228bc3[_0xef2e('0x29')]){if(_0x228bc3['error'][_0xef2e('0x2a')]===0x1f4){logger[_0xef2e('0x29')](_0xef2e('0x25'),_0x43232f,_0x228bc3['error']['message']);return _0x3d32b6(_0x228bc3[_0xef2e('0x29')]['message']);}logger['error'](_0xef2e('0x25'),_0x43232f,_0x228bc3[_0xef2e('0x29')]['message']);return _0x32a144(_0x228bc3[_0xef2e('0x29')][_0xef2e('0x2b')]);}else{logger[_0xef2e('0x24')]('FaxAccount,\x20%s,\x20%s',_0x43232f,_0xef2e('0x27'));_0x32a144(_0x228bc3[_0xef2e('0x2c')][_0xef2e('0x2b')]);}})[_0xef2e('0x2d')](function(_0x548eff){logger['error']('FaxAccount,\x20%s,\x20%s',_0x43232f,_0x548eff);_0x3d32b6(_0x548eff);});});}function respondWithStatusCode(_0x2caa45,_0xc86cfc){_0xc86cfc=_0xc86cfc||0xcc;return function(_0x1ee33b){if(_0x1ee33b){return _0x2caa45['sendStatus'](_0xc86cfc);}return _0x2caa45[_0xef2e('0x2e')](_0xc86cfc)['end']();};}function respondWithResult(_0x44579,_0x595c12){_0x595c12=_0x595c12||0xc8;return function(_0xd04213){if(_0xd04213){return _0x44579[_0xef2e('0x2e')](_0x595c12)[_0xef2e('0x2f')](_0xd04213);}};}function respondWithFilteredResult(_0x153aef,_0x27aa59){return function(_0x23e479){if(_0x23e479){var _0xffe200=typeof _0x27aa59[_0xef2e('0x30')]==='undefined'&&typeof _0x27aa59[_0xef2e('0x31')]===_0xef2e('0x32');var _0x3c8922=_0x23e479[_0xef2e('0x33')];var _0x28a3e0=_0xffe200?0x0:_0x27aa59[_0xef2e('0x30')];var _0x272e42=_0xffe200?_0x23e479['count']:_0x27aa59[_0xef2e('0x30')]+_0x27aa59[_0xef2e('0x31')];var _0x404ded;if(_0x272e42>=_0x3c8922){_0x272e42=_0x3c8922;_0x404ded=0xc8;}else{_0x404ded=0xce;}_0x153aef[_0xef2e('0x2e')](_0x404ded);return _0x153aef[_0xef2e('0x34')](_0xef2e('0x35'),_0x28a3e0+'-'+_0x272e42+'/'+_0x3c8922)['json'](_0x23e479);}return null;};}function patchUpdates(_0x1735aa){return function(_0x486154){try{jsonpatch[_0xef2e('0x36')](_0x486154,_0x1735aa,!![]);}catch(_0xf93a3d){return BPromise['reject'](_0xf93a3d);}return _0x486154[_0xef2e('0x37')]();};}function saveUpdates(_0x40dd4a,_0x3de92c){return function(_0x5d1c6c){if(_0x5d1c6c){return _0x5d1c6c['update'](_0x40dd4a)[_0xef2e('0x23')](function(_0x384bb9){return _0x384bb9;});}return null;};}function removeEntity(_0x216488,_0x4e8711){return function(_0x1ee453){if(_0x1ee453){return _0x1ee453[_0xef2e('0x38')]()['then'](function(){var _0x5b1ab1=_0x1ee453[_0xef2e('0x39')]({'plain':!![]});var _0x430842='FaxAccounts';return db[_0xef2e('0x3a')]['destroy']({'where':{'type':_0x430842,'resourceId':_0x5b1ab1['id']}})[_0xef2e('0x23')](function(){return _0x1ee453;});})[_0xef2e('0x23')](function(){_0x216488[_0xef2e('0x2e')](0xcc)[_0xef2e('0x3b')]();});}};}function handleEntityNotFound(_0x166e64,_0x4cab77){return function(_0x41fef6){if(!_0x41fef6){_0x166e64['sendStatus'](0x194);}return _0x41fef6;};}function handleError(_0xa770e1,_0x1cc728){_0x1cc728=_0x1cc728||0x1f4;return function(_0x4da806){logger[_0xef2e('0x29')](_0x4da806[_0xef2e('0x3c')]);if(_0x4da806[_0xef2e('0x3d')]){delete _0x4da806[_0xef2e('0x3d')];}_0xa770e1['status'](_0x1cc728)[_0xef2e('0x3e')](_0x4da806);};}exports[_0xef2e('0x3f')]=function(_0x13fd41,_0x29a25c){var _0x1bcd58={'include':[{'model':db[_0xef2e('0x40')],'as':_0xef2e('0x41')}]},_0x16f32b={},_0xeb9036={'count':0x0,'rows':[]};var _0x5c4fe7=_['map'](db[_0xef2e('0x42')]['rawAttributes'],function(_0x518245){return{'name':_0x518245['fieldName'],'type':_0x518245['type']['key']};});_0x16f32b[_0xef2e('0x43')]=_[_0xef2e('0x44')](_0x5c4fe7,_0xef2e('0x3d'));_0x16f32b['query']=_[_0xef2e('0x45')](_0x13fd41[_0xef2e('0x46')]);_0x16f32b[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x16f32b[_0xef2e('0x43')],_0x16f32b[_0xef2e('0x46')]);_0x1bcd58[_0xef2e('0x49')]=_[_0xef2e('0x48')](_0x16f32b['model'],qs[_0xef2e('0x4a')](_0x13fd41[_0xef2e('0x46')]['fields']));_0x1bcd58[_0xef2e('0x49')]=_0x1bcd58[_0xef2e('0x49')][_0xef2e('0x4b')]?_0x1bcd58[_0xef2e('0x49')]:_0x16f32b[_0xef2e('0x43')];if(!_0x13fd41[_0xef2e('0x46')][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x1bcd58[_0xef2e('0x31')]=qs[_0xef2e('0x31')](_0x13fd41[_0xef2e('0x46')][_0xef2e('0x31')]);_0x1bcd58[_0xef2e('0x30')]=qs['offset'](_0x13fd41[_0xef2e('0x46')][_0xef2e('0x30')]);}_0x1bcd58[_0xef2e('0x4e')]=qs[_0xef2e('0x4f')](_0x13fd41['query'][_0xef2e('0x4f')]);_0x1bcd58[_0xef2e('0x50')]=qs[_0xef2e('0x47')](_['pick'](_0x13fd41[_0xef2e('0x46')],_0x16f32b[_0xef2e('0x47')]),_0x5c4fe7);if(_0x13fd41[_0xef2e('0x46')][_0xef2e('0x51')]){_0x1bcd58[_0xef2e('0x50')]=_['merge'](_0x1bcd58['where'],{'$or':_[_0xef2e('0x44')](_0x5c4fe7,function(_0x36cafd){if(_0x36cafd[_0xef2e('0x52')]!==_0xef2e('0x53')){var _0x1739e1={};_0x1739e1[_0x36cafd['name']]={'$like':'%'+_0x13fd41[_0xef2e('0x46')][_0xef2e('0x51')]+'%'};return _0x1739e1;}})});}_0x1bcd58=_[_0xef2e('0x54')]({},_0x1bcd58,_0x13fd41[_0xef2e('0x55')]);var _0x2e4ef4={'where':_0x1bcd58['where']};return db['FaxAccount'][_0xef2e('0x33')](_0x2e4ef4)[_0xef2e('0x23')](function(_0x53b064){_0xeb9036['count']=_0x53b064;if(_0x13fd41[_0xef2e('0x46')][_0xef2e('0x56')]){_0x1bcd58[_0xef2e('0x57')]=[{'all':!![]}];}return db[_0xef2e('0x42')][_0xef2e('0x58')](_0x1bcd58);})['then'](function(_0x36c3f6){_0xeb9036[_0xef2e('0x59')]=_0x36c3f6;return _0xeb9036;})['then'](respondWithFilteredResult(_0x29a25c,_0x1bcd58))['catch'](handleError(_0x29a25c,null));};exports[_0xef2e('0x5a')]=function(_0x161f75,_0x3b90fd){var _0x14dede={'raw':![],'where':{'id':_0x161f75[_0xef2e('0x5b')]['id']},'include':[{'model':db[_0xef2e('0x40')],'as':_0xef2e('0x41')}]},_0x1ea3ba={};_0x1ea3ba[_0xef2e('0x43')]=_[_0xef2e('0x45')](db['FaxAccount'][_0xef2e('0x5c')]);_0x1ea3ba['query']=_['keys'](_0x161f75['query']);_0x1ea3ba[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x1ea3ba[_0xef2e('0x43')],_0x1ea3ba[_0xef2e('0x46')]);_0x14dede['attributes']=_[_0xef2e('0x48')](_0x1ea3ba[_0xef2e('0x43')],qs[_0xef2e('0x4a')](_0x161f75[_0xef2e('0x46')][_0xef2e('0x4a')]));_0x14dede[_0xef2e('0x49')]=_0x14dede[_0xef2e('0x49')][_0xef2e('0x4b')]?_0x14dede[_0xef2e('0x49')]:_0x1ea3ba[_0xef2e('0x43')];if(_0x161f75[_0xef2e('0x46')][_0xef2e('0x56')]){_0x14dede[_0xef2e('0x57')]=[{'all':!![]}];}_0x14dede=_[_0xef2e('0x54')]({},_0x14dede,_0x161f75[_0xef2e('0x55')]);return db[_0xef2e('0x42')][_0xef2e('0x5d')](_0x14dede)['then'](handleEntityNotFound(_0x3b90fd,null))[_0xef2e('0x23')](respondWithResult(_0x3b90fd,null))[_0xef2e('0x2d')](handleError(_0x3b90fd,null));};exports['create']=function(_0x42ca24,_0x421cf5){return db[_0xef2e('0x42')][_0xef2e('0x5e')](_0x42ca24[_0xef2e('0x5f')],{})[_0xef2e('0x23')](function(_0x4a55a0){var _0x4a9613=_0x42ca24[_0xef2e('0x60')][_0xef2e('0x39')]({'plain':!![]});if(!_0x4a9613)throw new Error(_0xef2e('0x61'));if(_0x4a9613[_0xef2e('0x62')]==='user'){var _0x47510d=_0x4a55a0[_0xef2e('0x39')]({'plain':!![]});var _0x2122cc=_0xef2e('0x63');return db[_0xef2e('0x64')][_0xef2e('0x5d')]({'where':{'name':_0x2122cc,'userProfileId':_0x4a9613['userProfileId']},'raw':!![]})[_0xef2e('0x23')](function(_0x2e00cc){if(_0x2e00cc&&_0x2e00cc['autoAssociation']===0x0){return db[_0xef2e('0x3a')][_0xef2e('0x5e')]({'name':_0x47510d[_0xef2e('0x3d')],'resourceId':_0x47510d['id'],'type':_0x2e00cc[_0xef2e('0x3d')],'sectionId':_0x2e00cc['id']},{})[_0xef2e('0x23')](function(){return _0x4a55a0;});}else{return _0x4a55a0;}})['catch'](function(_0x2f979a){logger['error'](_0xef2e('0x65'),_0x2f979a);throw _0x2f979a;});}return _0x4a55a0;})[_0xef2e('0x23')](respondWithResult(_0x421cf5,0xc9))['catch'](handleError(_0x421cf5,null));};exports[_0xef2e('0x66')]=function(_0x1ce031,_0x398b8e){if(_0x1ce031[_0xef2e('0x5f')]['id']){delete _0x1ce031[_0xef2e('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x1ce031[_0xef2e('0x5b')]['id']},'include':[{'model':db[_0xef2e('0x40')],'as':'mandatoryDispositionPause'}]})[_0xef2e('0x23')](handleEntityNotFound(_0x398b8e,null))['then'](saveUpdates(_0x1ce031[_0xef2e('0x5f')],null))['then'](respondWithResult(_0x398b8e,null))[_0xef2e('0x2d')](handleError(_0x398b8e,null));};exports[_0xef2e('0x38')]=function(_0x5e12d9,_0x54efe3){return db['FaxAccount']['find']({'where':{'id':_0x5e12d9[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x54efe3,null))['then'](removeEntity(_0x54efe3,null))[_0xef2e('0x2d')](handleError(_0x54efe3,null));};exports['describe']=function(_0x40ae81,_0x1856fc){return db[_0xef2e('0x42')][_0xef2e('0x67')]()[_0xef2e('0x23')](respondWithResult(_0x1856fc,null))[_0xef2e('0x2d')](handleError(_0x1856fc,null));};exports[_0xef2e('0x68')]=function(_0x39a2ad,_0xd5584,_0x5bfa44){if(_0x39a2ad[_0xef2e('0x5f')]['id']){delete _0x39a2ad[_0xef2e('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x39a2ad['params']['id']}})['then'](handleEntityNotFound(_0xd5584,null))[_0xef2e('0x23')](function(_0x67987e){if(_0x67987e){_0x39a2ad['body'][_0xef2e('0x69')]=_0x67987e['id'];return db[_0xef2e('0x6a')]['create'](_0x39a2ad[_0xef2e('0x5f')]);}})[_0xef2e('0x23')](respondWithResult(_0xd5584,null))[_0xef2e('0x2d')](handleError(_0xd5584,null));};exports[_0xef2e('0x6b')]=function(_0x38e5a1,_0x3dd8b8,_0x204212){var _0x17c276={'raw':![],'where':{}};var _0x5225c7={};var _0x4c35fd={'count':0x0,'rows':[]};return db[_0xef2e('0x42')][_0xef2e('0x6c')]({'where':{'id':_0x38e5a1[_0xef2e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3dd8b8,null))['then'](function(_0x3fbb67){if(_0x3fbb67){_0x5225c7[_0xef2e('0x43')]=_[_0xef2e('0x45')](db[_0xef2e('0x6a')][_0xef2e('0x5c')]);_0x5225c7[_0xef2e('0x46')]=_[_0xef2e('0x45')](_0x38e5a1['query']);_0x5225c7['filters']=_['intersection'](_0x5225c7['model'],_0x5225c7[_0xef2e('0x46')]);_0x17c276[_0xef2e('0x49')]=_[_0xef2e('0x48')](_0x5225c7[_0xef2e('0x43')],qs[_0xef2e('0x4a')](_0x38e5a1['query'][_0xef2e('0x4a')]));_0x17c276[_0xef2e('0x49')]=_0x17c276[_0xef2e('0x49')]['length']?_0x17c276[_0xef2e('0x49')]:_0x5225c7[_0xef2e('0x43')];if(!_0x38e5a1[_0xef2e('0x46')][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x17c276['limit']=qs[_0xef2e('0x31')](_0x38e5a1[_0xef2e('0x46')][_0xef2e('0x31')]);_0x17c276[_0xef2e('0x30')]=qs['offset'](_0x38e5a1[_0xef2e('0x46')]['offset']);}_0x17c276['order']=qs['sort'](_0x38e5a1['query'][_0xef2e('0x4f')]);_0x17c276[_0xef2e('0x50')]=qs[_0xef2e('0x47')](_['pick'](_0x38e5a1[_0xef2e('0x46')],_0x5225c7['filters']));_0x17c276['where'][_0xef2e('0x69')]=_0x3fbb67['id'];if(_0x38e5a1['query'][_0xef2e('0x51')]){_0x17c276['where']=_[_0xef2e('0x54')](_0x17c276['where'],{'$or':_[_0xef2e('0x44')](_0x17c276['attributes'],function(_0x2c9928){var _0x400b60={};_0x400b60[_0x2c9928]={'$like':'%'+_0x38e5a1['query'][_0xef2e('0x51')]+'%'};return _0x400b60;})});}_0x17c276=_[_0xef2e('0x54')]({},_0x17c276,_0x38e5a1[_0xef2e('0x55')]);return db[_0xef2e('0x6a')][_0xef2e('0x33')]({'where':_0x17c276[_0xef2e('0x50')]})[_0xef2e('0x23')](function(_0x250999){_0x4c35fd[_0xef2e('0x33')]=_0x250999;if(_0x38e5a1[_0xef2e('0x46')]['includeAll']){_0x17c276[_0xef2e('0x57')]=[{'all':!![]}];}return db[_0xef2e('0x6a')][_0xef2e('0x58')](_0x17c276);})[_0xef2e('0x23')](function(_0x30992b){_0x4c35fd[_0xef2e('0x59')]=_0x30992b;return _0x4c35fd;});}})[_0xef2e('0x23')](respondWithFilteredResult(_0x3dd8b8,_0x17c276))[_0xef2e('0x2d')](handleError(_0x3dd8b8,null));};exports[_0xef2e('0x6d')]=function(_0x57d0df,_0x38e86f,_0x4617bd){return db[_0xef2e('0x42')][_0xef2e('0x5d')]({'where':{'id':_0x57d0df[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x38e86f,null))[_0xef2e('0x23')](function(_0xdaf70d){if(_0xdaf70d){return _0xdaf70d[_0xef2e('0x6d')](_0x57d0df[_0xef2e('0x46')][_0xef2e('0x6e')]);}})[_0xef2e('0x23')](respondWithStatusCode(_0x38e86f,null))[_0xef2e('0x2d')](handleError(_0x38e86f,null));};exports[_0xef2e('0x6f')]=function(_0x1abf33,_0x2243b2,_0x4f93cd){if(_0x1abf33[_0xef2e('0x5f')]['id']){delete _0x1abf33['body']['id'];}return db[_0xef2e('0x42')][_0xef2e('0x5d')]({'where':{'id':_0x1abf33[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x2243b2,null))[_0xef2e('0x23')](function(_0x5b7db5){if(_0x5b7db5){_0x1abf33[_0xef2e('0x5f')][_0xef2e('0x69')]=_0x5b7db5['id'];return db['CannedAnswer'][_0xef2e('0x5e')](_0x1abf33[_0xef2e('0x5f')]);}})[_0xef2e('0x23')](respondWithResult(_0x2243b2,null))[_0xef2e('0x2d')](handleError(_0x2243b2,null));};exports[_0xef2e('0x70')]=function(_0x554082,_0x1dfcb8,_0x20dc8e){var _0x57c882={'raw':![],'where':{}};var _0x29a1f8={};var _0x1a0c69={'count':0x0,'rows':[]};return db[_0xef2e('0x42')][_0xef2e('0x6c')]({'where':{'id':_0x554082[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x1dfcb8,null))[_0xef2e('0x23')](function(_0x4e5dd4){if(_0x4e5dd4){_0x29a1f8[_0xef2e('0x43')]=_[_0xef2e('0x45')](db['CannedAnswer'][_0xef2e('0x5c')]);_0x29a1f8[_0xef2e('0x46')]=_[_0xef2e('0x45')](_0x554082[_0xef2e('0x46')]);_0x29a1f8[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x29a1f8[_0xef2e('0x43')],_0x29a1f8[_0xef2e('0x46')]);_0x57c882[_0xef2e('0x49')]=_[_0xef2e('0x48')](_0x29a1f8[_0xef2e('0x43')],qs[_0xef2e('0x4a')](_0x554082[_0xef2e('0x46')][_0xef2e('0x4a')]));_0x57c882[_0xef2e('0x49')]=_0x57c882[_0xef2e('0x49')]['length']?_0x57c882['attributes']:_0x29a1f8[_0xef2e('0x43')];if(!_0x554082[_0xef2e('0x46')][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x57c882['limit']=qs[_0xef2e('0x31')](_0x554082['query'][_0xef2e('0x31')]);_0x57c882[_0xef2e('0x30')]=qs[_0xef2e('0x30')](_0x554082[_0xef2e('0x46')][_0xef2e('0x30')]);}_0x57c882['order']=qs[_0xef2e('0x4f')](_0x554082[_0xef2e('0x46')]['sort']);_0x57c882[_0xef2e('0x50')]=qs[_0xef2e('0x47')](_[_0xef2e('0x71')](_0x554082[_0xef2e('0x46')],_0x29a1f8[_0xef2e('0x47')]));_0x57c882['where'][_0xef2e('0x69')]=_0x4e5dd4['id'];if(_0x554082[_0xef2e('0x46')][_0xef2e('0x51')]){_0x57c882['where']=_[_0xef2e('0x54')](_0x57c882[_0xef2e('0x50')],{'$or':_[_0xef2e('0x44')](_0x57c882[_0xef2e('0x49')],function(_0x2e1eef){var _0x52badf={};_0x52badf[_0x2e1eef]={'$like':'%'+_0x554082[_0xef2e('0x46')][_0xef2e('0x51')]+'%'};return _0x52badf;})});}_0x57c882=_[_0xef2e('0x54')]({},_0x57c882,_0x554082[_0xef2e('0x55')]);return db[_0xef2e('0x72')][_0xef2e('0x33')]({'where':_0x57c882[_0xef2e('0x50')]})[_0xef2e('0x23')](function(_0x395a01){_0x1a0c69[_0xef2e('0x33')]=_0x395a01;if(_0x554082['query'][_0xef2e('0x56')]){_0x57c882[_0xef2e('0x57')]=[{'all':!![]}];}return db[_0xef2e('0x72')][_0xef2e('0x58')](_0x57c882);})['then'](function(_0xae24d){_0x1a0c69[_0xef2e('0x59')]=_0xae24d;return _0x1a0c69;});}})[_0xef2e('0x23')](respondWithFilteredResult(_0x1dfcb8,_0x57c882))['catch'](handleError(_0x1dfcb8,null));};exports['removeAnswers']=function(_0x5ef0ce,_0x3fa2b6,_0x2b551c){return db[_0xef2e('0x42')][_0xef2e('0x5d')]({'where':{'id':_0x5ef0ce[_0xef2e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3fa2b6,null))['then'](function(_0x29c7e6){if(_0x29c7e6){return _0x29c7e6['removeAnswers'](_0x5ef0ce[_0xef2e('0x46')]['ids']);}})[_0xef2e('0x23')](respondWithStatusCode(_0x3fa2b6,null))['catch'](handleError(_0x3fa2b6,null));};exports[_0xef2e('0x73')]=function(_0x387f51,_0x3522d1,_0x5517f5){return db[_0xef2e('0x74')][_0xef2e('0x5d')]({'where':{'id':_0x387f51[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x3522d1,null))[_0xef2e('0x23')](function(_0xe4ee66){if(_0xe4ee66){return _0xe4ee66[_0xef2e('0x73')](_0x387f51[_0xef2e('0x5f')][_0xef2e('0x6e')],_[_0xef2e('0x75')](_0x387f51[_0xef2e('0x5f')],[_0xef2e('0x6e'),'id'])||{});}})[_0xef2e('0x23')](respondWithResult(_0x3522d1,null))[_0xef2e('0x2d')](handleError(_0x3522d1,null));};exports[_0xef2e('0x76')]=function(_0x10c0b4,_0x3176ef,_0x457748){var _0x1fdd72={'raw':![],'where':{}};var _0x36da50={};var _0x20ee4d={'count':0x0,'rows':[]};return db[_0xef2e('0x42')][_0xef2e('0x6c')]({'where':{'id':_0x10c0b4[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x3176ef,null))[_0xef2e('0x23')](function(_0x6660ad){if(_0x6660ad){_0x36da50[_0xef2e('0x43')]=_[_0xef2e('0x45')](db['FaxInteraction']['rawAttributes']);_0x36da50[_0xef2e('0x46')]=_['keys'](_0x10c0b4['query']);_0x36da50[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x36da50[_0xef2e('0x43')],_0x36da50[_0xef2e('0x46')]);_0x1fdd72['attributes']=_[_0xef2e('0x48')](_0x36da50[_0xef2e('0x43')],qs[_0xef2e('0x4a')](_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x4a')]));_0x1fdd72['attributes']=_0x1fdd72['attributes']['length']?_0x1fdd72[_0xef2e('0x49')]:_0x36da50[_0xef2e('0x43')];if(!_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x1fdd72[_0xef2e('0x31')]=qs[_0xef2e('0x31')](_0x10c0b4['query'][_0xef2e('0x31')]);_0x1fdd72['offset']=qs[_0xef2e('0x30')](_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x30')]);}_0x1fdd72[_0xef2e('0x4e')]=qs['sort'](_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x4f')]);_0x1fdd72[_0xef2e('0x50')]=qs[_0xef2e('0x47')](_[_0xef2e('0x71')](_0x10c0b4['query'],_0x36da50[_0xef2e('0x47')]));_0x1fdd72[_0xef2e('0x50')][_0xef2e('0x69')]=_0x6660ad['id'];if(_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x51')]){_0x1fdd72['where']=_[_0xef2e('0x54')](_0x1fdd72[_0xef2e('0x50')],{'$or':_[_0xef2e('0x44')](_0x1fdd72[_0xef2e('0x49')],function(_0x16957a){var _0x3a7581={};_0x3a7581[_0x16957a]={'$like':'%'+_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x51')]+'%'};return _0x3a7581;})});}_0x1fdd72=_[_0xef2e('0x54')]({},_0x1fdd72,_0x10c0b4[_0xef2e('0x55')]);return db[_0xef2e('0x74')][_0xef2e('0x33')]({'where':_0x1fdd72[_0xef2e('0x50')]})['then'](function(_0x49dba4){_0x20ee4d[_0xef2e('0x33')]=_0x49dba4;if(_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x56')]){_0x1fdd72[_0xef2e('0x57')]=[{'model':db[_0xef2e('0x77')],'as':_0xef2e('0x78'),'required':![]},{'model':db[_0xef2e('0x79')],'as':'Owner','attributes':[_0xef2e('0x3d'),'fullname',_0xef2e('0x7a')],'required':![]},{'model':db[_0xef2e('0x7b')],'as':'Tags','attributes':['id','name',_0xef2e('0x7c')],'where':_0x10c0b4[_0xef2e('0x46')][_0xef2e('0x7d')]?{'id':_0x10c0b4['query'][_0xef2e('0x7d')]}:undefined,'required':_0x10c0b4['query'][_0xef2e('0x7d')]?!![]:![]}];}return db[_0xef2e('0x74')][_0xef2e('0x58')](_0x1fdd72);})[_0xef2e('0x23')](function(_0x837fc){_0x20ee4d[_0xef2e('0x59')]=_0x837fc;return _0x20ee4d;});}})[_0xef2e('0x23')](respondWithFilteredResult(_0x3176ef,_0x1fdd72))[_0xef2e('0x2d')](handleError(_0x3176ef,null));};exports['addApplications']=function(_0x40491d,_0x149fd9){var _0x459545=_0x40491d[_0xef2e('0x5b')]['id'];var _0x571689=_0x40491d['body'];var _0x4755ae=0xc8;var _0x3642a2=null;return db['sequelize'][_0xef2e('0x7e')]({'isolationLevel':db['sequelize']['Transaction'][_0xef2e('0x7f')][_0xef2e('0x80')]},function(_0x65c303){return db['FaxAccount'][_0xef2e('0x6c')]({'where':{'id':_0x459545},'transaction':_0x65c303})[_0xef2e('0x23')](function(_0x2b5145){if(_0x2b5145){return db['FaxApplication'][_0xef2e('0x38')]({'where':{'FaxAccountId':_0x459545},'transaction':_0x65c303})[_0xef2e('0x23')](function(){var _0x4490ac=_[_0xef2e('0x44')](_0x571689,function(_0x5b486b){_0x5b486b[_0xef2e('0x69')]=_0x459545;return _0x5b486b;});return db[_0xef2e('0x81')]['bulkCreate'](_0x4490ac,{'transaction':_0x65c303});});}else{_0x4755ae=0x194;_0x3642a2=[];}});})[_0xef2e('0x23')](function(){if(_0x4755ae!==0x194){return db[_0xef2e('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x459545},'order':_0xef2e('0x82')})[_0xef2e('0x23')](function(_0x4dff30){_0x3642a2=_0x4dff30;});}})[_0xef2e('0x2d')](function(_0x3d50ba){_0x4755ae=0x1f4;logger[_0xef2e('0x29')](_0x3d50ba['stack']);if(_0x3d50ba[_0xef2e('0x3d')]){delete _0x3d50ba[_0xef2e('0x3d')];}_0x3642a2=_0x3d50ba;})['finally'](function(){if(_0x3642a2===null){_0x149fd9[_0xef2e('0x83')](_0x4755ae);}else{if(_0x4755ae===0x1f4){_0x149fd9[_0xef2e('0x2e')](_0x4755ae)[_0xef2e('0x3e')](_0x3642a2);}else{_0x149fd9[_0xef2e('0x2e')](_0x4755ae)['json'](_0x3642a2);}}});};exports[_0xef2e('0x84')]=function(_0xc59049,_0x13884,_0x27e48c){var _0x5f19f5={};var _0x3b5a3d={};var _0x19a8e3;var _0x1bbe19;return db[_0xef2e('0x42')][_0xef2e('0x6c')]({'where':{'id':_0xc59049[_0xef2e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13884,null))[_0xef2e('0x23')](function(_0x42e8e2){if(_0x42e8e2){_0x19a8e3=_0x42e8e2;_0x3b5a3d[_0xef2e('0x43')]=_[_0xef2e('0x45')](db[_0xef2e('0x81')][_0xef2e('0x5c')]);_0x3b5a3d[_0xef2e('0x46')]=_['keys'](_0xc59049['query']);_0x3b5a3d[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x3b5a3d['model'],_0x3b5a3d['query']);_0x5f19f5[_0xef2e('0x49')]=_[_0xef2e('0x48')](_0x3b5a3d[_0xef2e('0x43')],qs['fields'](_0xc59049[_0xef2e('0x46')][_0xef2e('0x4a')]));_0x5f19f5[_0xef2e('0x49')]=_0x5f19f5[_0xef2e('0x49')][_0xef2e('0x4b')]?_0x5f19f5['attributes']:_0x3b5a3d[_0xef2e('0x43')];_0x5f19f5[_0xef2e('0x4e')]=qs[_0xef2e('0x4f')](_0xc59049[_0xef2e('0x46')][_0xef2e('0x4f')]);_0x5f19f5[_0xef2e('0x50')]=qs['filters'](_['pick'](_0xc59049[_0xef2e('0x46')],_0x3b5a3d[_0xef2e('0x47')]));if(_0xc59049[_0xef2e('0x46')]['filter']){_0x5f19f5[_0xef2e('0x50')]=_[_0xef2e('0x54')](_0x5f19f5['where'],{'$or':_[_0xef2e('0x44')](_0x5f19f5[_0xef2e('0x49')],function(_0x33797c){var _0x47681a={};_0x47681a[_0x33797c]={'$like':'%'+_0xc59049[_0xef2e('0x46')][_0xef2e('0x51')]+'%'};return _0x47681a;})});}_0x5f19f5=_['merge']({},_0x5f19f5,_0xc59049[_0xef2e('0x55')]);return _0x19a8e3['getApplications'](_0x5f19f5);}})[_0xef2e('0x23')](function(_0x4f2bdf){if(_0x4f2bdf){_0x1bbe19=_0x4f2bdf['length'];if(!_0xc59049[_0xef2e('0x46')][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x5f19f5[_0xef2e('0x31')]=qs[_0xef2e('0x31')](_0xc59049['query'][_0xef2e('0x31')]);_0x5f19f5[_0xef2e('0x30')]=qs[_0xef2e('0x30')](_0xc59049[_0xef2e('0x46')][_0xef2e('0x30')]);}return _0x19a8e3[_0xef2e('0x84')](_0x5f19f5);}})[_0xef2e('0x23')](function(_0x53c822){if(_0x53c822){return _0x53c822?{'count':_0x1bbe19,'rows':_0x53c822}:null;}})[_0xef2e('0x23')](respondWithResult(_0x13884,null))[_0xef2e('0x2d')](handleError(_0x13884,null));};function Extension(_0x4682e8,_0x2eeaef,_0x80ee39,_0x60d0be){this[_0xef2e('0x85')]=_0xef2e('0x86');this[_0xef2e('0x87')]=_0x4682e8[_0xef2e('0x88')];this[_0xef2e('0x89')]=_0x60d0be;this[_0xef2e('0x52')]=_0xef2e('0x8a');this[_0xef2e('0x8b')]='Fax\x20Extension';this[_0xef2e('0x69')]=_0x4682e8['id'];this[_0xef2e('0x82')]=_0x2eeaef;this['appdata']=_0x80ee39;}function createExtensionsReciveFax(_0x303bb2){var _0x4655a5=0x1;var _0x2a6ef5=[];_0x2a6ef5['push'](new Extension(_0x303bb2,_0x4655a5,'','Answer'));_0x4655a5+=0x1;_0x2a6ef5[_0xef2e('0x8c')](new Extension(_0x303bb2,_0x4655a5,'CDR(type)=inbound-fax','Set'));_0x4655a5+=0x1;for(var _0xc3dbd0 in _0x303bb2){if(_0x303bb2[_0xef2e('0x4c')](_0xc3dbd0)&&(_0xc3dbd0===_0xef2e('0x8d')||_0xc3dbd0===_0xef2e('0x88')||_0xc3dbd0==='gateway'||_0xc3dbd0===_0xef2e('0x8e')||_0xc3dbd0===_0xef2e('0x8f')||_0xc3dbd0===_0xef2e('0x90')||_0xc3dbd0==='minrate'||_0xc3dbd0===_0xef2e('0x91')||_0xc3dbd0===_0xef2e('0x92'))){_0x2a6ef5[_0xef2e('0x8c')](new Extension(_0x303bb2,_0x4655a5,_0xef2e('0x93')+_0xc3dbd0+')='+_0x303bb2[_0xc3dbd0],'Set'));_0x4655a5+=0x1;}}_0x2a6ef5[_0xef2e('0x8c')](new Extension(_0x303bb2,_0x4655a5,'6','Wait'));_0x4655a5+=0x1;_0x2a6ef5[_0xef2e('0x8c')](new Extension(_0x303bb2,_0x4655a5,_0xef2e('0x94'),'ReceiveFax'));_0x4655a5=0x0;return _0x2a6ef5;}exports[_0xef2e('0x95')]=function(_0x2d54e7,_0x385132,_0x378866){var _0x2bf7bb;return db[_0xef2e('0x96')][_0xef2e('0x7e')](function(_0x43e5f2){return db[_0xef2e('0x42')][_0xef2e('0x5e')](_0x2d54e7[_0xef2e('0x5f')],{'transaction':_0x43e5f2})[_0xef2e('0x23')](function(_0x16d9b0){_0x2bf7bb=_0x16d9b0['get']({'plain':!![]});return db['VoiceExtension'][_0xef2e('0x97')](createExtensionsReciveFax(_0x2bf7bb),{'transaction':_0x43e5f2});});})[_0xef2e('0x23')](function(){return _0x2bf7bb;})[_0xef2e('0x23')](respondWithResult(_0x385132,null))[_0xef2e('0x2d')](handleError(_0x385132,null));};exports['updateAccountApplications']=function(_0x1b81c5,_0x101e15,_0x19da27){var _0x4130f3;return db[_0xef2e('0x96')][_0xef2e('0x7e')](function(_0x1e465d){return db[_0xef2e('0x42')][_0xef2e('0x66')](_0x1b81c5[_0xef2e('0x5f')],{'where':{'id':_0x1b81c5[_0xef2e('0x5f')]['id']},'transaction':_0x1e465d})[_0xef2e('0x23')](function(_0x261f4b){return db[_0xef2e('0x98')][_0xef2e('0x38')]({'where':{'FaxAccountId':_0x1b81c5[_0xef2e('0x5f')]['id']},'transaction':_0x1e465d})[_0xef2e('0x23')](function(_0x55563b){return db[_0xef2e('0x98')]['bulkCreate'](createExtensionsReciveFax(_[_0xef2e('0x75')](_0x1b81c5[_0xef2e('0x5f')],[_0xef2e('0x99'),_0xef2e('0x9a'),'createdAt','updatedAt',_0xef2e('0x9b'),_0xef2e('0x9c')])),{'transaction':_0x1e465d});});});})[_0xef2e('0x23')](function(){return db['FaxAccount'][_0xef2e('0x9d')](_0x1b81c5['body']['id']);})['then'](respondWithResult(_0x101e15,null))[_0xef2e('0x2d')](handleError(_0x101e15,null));};exports[_0xef2e('0x9e')]=function(_0x45c1cc,_0x4e61b4,_0x4d214e){var _0x49dc9b={'raw':!![],'where':{}};var _0x2eef1b={};var _0x305355={'count':0x0,'rows':[]};return db[_0xef2e('0x42')][_0xef2e('0x6c')]({'where':{'id':_0x45c1cc[_0xef2e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4e61b4,null))[_0xef2e('0x23')](function(_0xff833f){if(_0xff833f){_0x2eef1b[_0xef2e('0x43')]=_[_0xef2e('0x45')](db[_0xef2e('0x9f')][_0xef2e('0x5c')]);_0x2eef1b[_0xef2e('0x46')]=_[_0xef2e('0x45')](_0x45c1cc[_0xef2e('0x46')]);_0x2eef1b[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x2eef1b[_0xef2e('0x43')],_0x2eef1b[_0xef2e('0x46')]);_0x49dc9b[_0xef2e('0x49')]=_[_0xef2e('0x48')](_0x2eef1b[_0xef2e('0x43')],qs[_0xef2e('0x4a')](_0x45c1cc[_0xef2e('0x46')]['fields']));_0x49dc9b[_0xef2e('0x49')]=_0x49dc9b['attributes'][_0xef2e('0x4b')]?_0x49dc9b[_0xef2e('0x49')]:_0x2eef1b[_0xef2e('0x43')];if(!_0x45c1cc['query'][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x49dc9b[_0xef2e('0x31')]=qs[_0xef2e('0x31')](_0x45c1cc[_0xef2e('0x46')]['limit']);_0x49dc9b[_0xef2e('0x30')]=qs[_0xef2e('0x30')](_0x45c1cc['query']['offset']);}_0x49dc9b[_0xef2e('0x4e')]=qs[_0xef2e('0x4f')](_0x45c1cc['query'][_0xef2e('0x4f')]);_0x49dc9b['where']=qs[_0xef2e('0x47')](_[_0xef2e('0x71')](_0x45c1cc[_0xef2e('0x46')],_0x2eef1b[_0xef2e('0x47')]));_0x49dc9b[_0xef2e('0x50')][_0xef2e('0x69')]=_0xff833f['id'];if(_0x45c1cc['query'][_0xef2e('0x51')]){_0x49dc9b['where']=_['merge'](_0x49dc9b['where'],{'$or':_[_0xef2e('0x44')](_0x49dc9b[_0xef2e('0x49')],function(_0x35a085){var _0xca883={};_0xca883[_0x35a085]={'$like':'%'+_0x45c1cc[_0xef2e('0x46')][_0xef2e('0x51')]+'%'};return _0xca883;})});}if(_0x45c1cc[_0xef2e('0x46')][_0xef2e('0xa0')]){var _0x107b5a=_0x45c1cc[_0xef2e('0x46')]['$gte'][_0xef2e('0xa1')](',');var _0x139800={};_0x139800[_0x107b5a[0x0]]={'$gte':moment(_0x107b5a[0x1])[_0xef2e('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49dc9b[_0xef2e('0x50')]=_[_0xef2e('0x54')](_0x49dc9b['where'],_0x139800);}_0x49dc9b=_[_0xef2e('0x54')]({},_0x49dc9b,_0x45c1cc[_0xef2e('0x55')]);return db[_0xef2e('0x9f')]['count']({'where':_0x49dc9b[_0xef2e('0x50')]})[_0xef2e('0x23')](function(_0x33fef1){_0x305355['count']=_0x33fef1;if(_0x45c1cc[_0xef2e('0x46')][_0xef2e('0x56')]){_0x49dc9b[_0xef2e('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0xef2e('0x58')](_0x49dc9b);})[_0xef2e('0x23')](function(_0x1b8e95){_0x305355['rows']=_0x1b8e95;return _0x305355;});}})[_0xef2e('0x23')](respondWithFilteredResult(_0x4e61b4,_0x49dc9b))['catch'](handleError(_0x4e61b4,null));};exports['send']=function(_0x1a1638,_0x1a5e94,_0x426984){var _0x44507e,_0x34d006={},_0x1eb355;if(_0x1a1638[_0xef2e('0x5f')]['to']){_0x1eb355=_0x1a1638[_0xef2e('0x5f')]['to'][0x0];}return db[_0xef2e('0x42')]['find']({'where':{'id':_0x1a1638[_0xef2e('0x5b')]['id']},'include':[{'model':db[_0xef2e('0xa3')],'as':_0xef2e('0xa4'),'include':[{'model':db[_0xef2e('0x77')],'as':_0xef2e('0xa5'),'where':{'fax':_0x1eb355},'limit':0x1,'order':[[_0xef2e('0xa6'),_0xef2e('0xa7')]]}]}]})[_0xef2e('0x23')](handleEntityNotFound(_0x1a5e94,null))[_0xef2e('0x23')](function(_0x327ecc){_0x44507e=_0x327ecc;if(_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')]&&_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][_0xef2e('0x4b')]){for(var _0x559526=0x0;_0x559526<_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][_0xef2e('0x4b')];_0x559526+=0x1){_0x1a1638[_0xef2e('0x5f')]['attachments'][_0x559526]={'filename':_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][_0x559526][_0xef2e('0x3d')],'id':_0x1a1638[_0xef2e('0x5f')]['attachments'][_0x559526]['id'],'path':path[_0xef2e('0xa9')](config['root'],_0xef2e('0xaa'),_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][_0x559526]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0xef2e('0xab'),{'FaxAccountId':_['isNil'](_0x1a1638[_0xef2e('0x5b')]['id'])?undefined:_0x1a1638[_0xef2e('0x5b')]['id'],'path':_[_0xef2e('0xac')](_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][0x0][_0xef2e('0x8')])?undefined:_0x1a1638['body'][_0xef2e('0xa8')][0x0][_0xef2e('0x8')],'fax':_[_0xef2e('0xac')](_0x1a1638['body']['to'][0x0])?undefined:_0x1a1638[_0xef2e('0x5f')]['to'][0x0]},client9002);})[_0xef2e('0x23')](function(){if(_0x44507e){if(_[_0xef2e('0xac')](_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xad')])){_0x1a1638['body']['from']=util['format'](_0xef2e('0xae'),_0x44507e[_0xef2e('0x3d')],_0x44507e['fax']);}if(_0x44507e[_0xef2e('0xa4')]){if(_0x44507e[_0xef2e('0xa4')][_0xef2e('0xa5')][_0xef2e('0x4b')]){return _0x44507e['List'][_0xef2e('0xa5')][0x0];}else{return db[_0xef2e('0x77')][_0xef2e('0x5e')](_[_0xef2e('0x1b')](_0x1a1638[_0xef2e('0x5f')],{'firstName':_0x1a1638[_0xef2e('0x5f')]['to'][0x0],'phone':_0x1a1638[_0xef2e('0x5f')]['to'][0x0],'fax':_0x1a1638[_0xef2e('0x5f')]['to'][0x0],'ListId':_0x44507e[_0xef2e('0x9c')]}));}}else{throw new Error(_0xef2e('0xaf'));}}else{throw new Error(_0xef2e('0xb0'));}})[_0xef2e('0x23')](function(_0x4fa265){if(_0x4fa265){return db[_0xef2e('0x74')]['find']({'where':{'ContactId':_0x4fa265['id'],'closed':![],'FaxAccountId':_0x44507e['id']}})[_0xef2e('0x23')](function(_0x51dcd3){if(_0x51dcd3){return[_0x51dcd3,![]];}return db[_0xef2e('0x74')][_0xef2e('0x5e')]({'UserId':_0x1a1638[_0xef2e('0x60')]['id'],'ContactId':_0x4fa265['id'],'FaxAccountId':_0x44507e['id'],'fax':_0x1a1638[_0xef2e('0x5f')]['to'][0x0],'firstMsgDirection':_0xef2e('0xb1'),'Messages':[_[_0xef2e('0x54')](_0x1a1638[_0xef2e('0x5f')],{'read':![],'body':_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][0x0][_0xef2e('0xb2')],'FaxAccountId':_0x44507e['id'],'UserId':_0x1a1638[_0xef2e('0x60')]['id'],'ContactId':_0x4fa265['id'],'AttachmentId':_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0xa98f0){return[_0xa98f0,!![]];});});}else{throw new Error(_0xef2e('0xb3'));}})[_0xef2e('0xb4')](function(_0x2171d0,_0x2cfb1e){if(_0x2cfb1e){return _0x2171d0;}return db[_0xef2e('0x9f')][_0xef2e('0x5e')]({'direction':'out','read':![],'body':_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][0x0]['filename'],'FaxAccountId':_0x44507e['id'],'FaxInteractionId':_0x2171d0['id'],'UserId':_0x1a1638[_0xef2e('0x60')]['id'],'ContactId':_0x2171d0[_0xef2e('0xb5')],'AttachmentId':_0x1a1638['body'][_0xef2e('0xa8')][0x0]['id']})['then'](function(_0x3a8ec7){_0x2171d0[_0xef2e('0xb6')]['Messages']=[];_0x2171d0['dataValues']['Messages'][_0xef2e('0x8c')](_0x3a8ec7['dataValues']);return _0x2171d0;});})[_0xef2e('0x23')](function(_0x4ec424){respondWithRpcPromise('SendFax',_0xef2e('0xb7'),{'FaxAccountId':_[_0xef2e('0xac')](_0x1a1638['params']['id'])?undefined:_0x1a1638[_0xef2e('0x5b')]['id'],'path':_['isNil'](_0x1a1638[_0xef2e('0x5f')]['attachments'][0x0]['path'])?undefined:_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][0x0][_0xef2e('0x8')],'fax':_[_0xef2e('0xac')](_0x1a1638[_0xef2e('0x5f')]['to'][0x0])?undefined:_0x1a1638[_0xef2e('0x5f')]['to'][0x0],'AttachmentId':_0x1a1638[_0xef2e('0x5f')][_0xef2e('0xa8')][0x0]['id']},client9002)['then'](function(_0xa0e69c){logger[_0xef2e('0x24')](_0xef2e('0xb8'),_0xa0e69c);})[_0xef2e('0x2d')](function(_0x4b4997){logger['info'](_0xef2e('0xb8'),_0x4b4997);});return _0x4ec424;})[_0xef2e('0x23')](respondWithResult(_0x1a5e94,null))[_0xef2e('0x2d')](handleError(_0x1a5e94,null));};exports[_0xef2e('0xb9')]=function(_0x193489,_0x449eeb,_0x3e1bb2){return db['FaxAccount']['find']({'where':{'id':_0x193489[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x449eeb,null))[_0xef2e('0x23')](function(_0x5831d0){if(_0x5831d0){return _0x5831d0[_0xef2e('0xb9')](_0x193489[_0xef2e('0x5f')][_0xef2e('0x6e')],_[_0xef2e('0x75')](_0x193489[_0xef2e('0x5f')],[_0xef2e('0x6e'),'id'])||{})[_0xef2e('0xb4')](function(_0x2632b9){for(var _0x280dbf=0x0;_0x280dbf<_0x193489[_0xef2e('0x5f')][_0xef2e('0x6e')]['length'];_0x280dbf+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x193489[_0xef2e('0x5f')][_0xef2e('0x6e')][_0x280dbf]),'FaxAccountId':Number(_0x193489[_0xef2e('0x5b')]['id'])});}return _0x2632b9;});}})[_0xef2e('0x23')](respondWithResult(_0x449eeb,null))['catch'](handleError(_0x449eeb,null));};exports[_0xef2e('0xba')]=function(_0x1891f9,_0x382366,_0x2f8fc6){return db[_0xef2e('0x42')][_0xef2e('0x5d')]({'where':{'id':_0x1891f9[_0xef2e('0x5b')]['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x382366,null))[_0xef2e('0x23')](function(_0x35fdc5){if(_0x35fdc5){return _0x35fdc5[_0xef2e('0xba')](_0x1891f9[_0xef2e('0x46')][_0xef2e('0x6e')])[_0xef2e('0x23')](function(){if(_['isArray'](_0x1891f9['query'][_0xef2e('0x6e')])){for(var _0x4c9f20=0x0;_0x4c9f20<_0x1891f9[_0xef2e('0x46')]['ids'][_0xef2e('0x4b')];_0x4c9f20+=0x1){socket[_0xef2e('0xbb')](_0xef2e('0xbc'),{'UserId':Number(_0x1891f9[_0xef2e('0x46')]['ids'][_0x4c9f20]),'FaxAccountId':Number(_0x1891f9['params']['id'])});}}else{socket[_0xef2e('0xbb')](_0xef2e('0xbc'),{'UserId':Number(_0x1891f9[_0xef2e('0x46')][_0xef2e('0x6e')]),'FaxAccountId':Number(_0x1891f9[_0xef2e('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x382366,null))['catch'](handleError(_0x382366,null));};exports[_0xef2e('0xbd')]=function(_0x55d312,_0x2d9b0c,_0x37fac5){var _0x2f658a={};var _0x19f39c={};var _0x8fc4e0;var _0x48b4ab;return db[_0xef2e('0x42')]['findOne']({'where':{'id':_0x55d312['params']['id']}})[_0xef2e('0x23')](handleEntityNotFound(_0x2d9b0c,null))[_0xef2e('0x23')](function(_0x14227e){if(_0x14227e){_0x8fc4e0=_0x14227e;_0x19f39c[_0xef2e('0x43')]=_[_0xef2e('0x45')](db[_0xef2e('0x79')][_0xef2e('0x5c')]);_0x19f39c[_0xef2e('0x46')]=_[_0xef2e('0x45')](_0x55d312[_0xef2e('0x46')]);_0x19f39c[_0xef2e('0x47')]=_[_0xef2e('0x48')](_0x19f39c[_0xef2e('0x43')],_0x19f39c[_0xef2e('0x46')]);_0x2f658a[_0xef2e('0x49')]=_[_0xef2e('0x48')](_0x19f39c['model'],qs[_0xef2e('0x4a')](_0x55d312['query'][_0xef2e('0x4a')]));_0x2f658a[_0xef2e('0x49')]=_0x2f658a[_0xef2e('0x49')][_0xef2e('0x4b')]?_0x2f658a[_0xef2e('0x49')]:_0x19f39c['model'];_0x2f658a[_0xef2e('0x4e')]=qs[_0xef2e('0x4f')](_0x55d312['query'][_0xef2e('0x4f')]);_0x2f658a['where']=qs['filters'](_['pick'](_0x55d312[_0xef2e('0x46')],_0x19f39c[_0xef2e('0x47')]));if(_0x55d312[_0xef2e('0x46')][_0xef2e('0x51')]){_0x2f658a[_0xef2e('0x50')]=_[_0xef2e('0x54')](_0x2f658a[_0xef2e('0x50')],{'$or':_['map'](_0x2f658a[_0xef2e('0x49')],function(_0x18b787){var _0x3869c4={};_0x3869c4[_0x18b787]={'$like':'%'+_0x55d312[_0xef2e('0x46')]['filter']+'%'};return _0x3869c4;})});}_0x2f658a=_['merge']({},_0x2f658a,_0x55d312[_0xef2e('0x55')]);return _0x8fc4e0['getAgents'](_0x2f658a);}})[_0xef2e('0x23')](function(_0x3848b6){if(_0x3848b6){_0x48b4ab=_0x3848b6['length'];if(!_0x55d312['query'][_0xef2e('0x4c')](_0xef2e('0x4d'))){_0x2f658a[_0xef2e('0x31')]=qs[_0xef2e('0x31')](_0x55d312['query'][_0xef2e('0x31')]);_0x2f658a['offset']=qs['offset'](_0x55d312['query'][_0xef2e('0x30')]);}return _0x8fc4e0['getAgents'](_0x2f658a);}})[_0xef2e('0x23')](function(_0x35c591){if(_0x35c591){return _0x35c591?{'count':_0x48b4ab,'rows':_0x35c591}:null;}})['then'](respondWithResult(_0x2d9b0c,null))[_0xef2e('0x2d')](handleError(_0x2d9b0c,null));}; \ No newline at end of file +var _0xf40d=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','FaxAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','show','Pause','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','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','rawAttributes','order','Disposition','ids','addAnswer','nolimit','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf40d,0x187));var _0xdf40=function(_0x3a4a8e,_0x37717c){_0x3a4a8e=_0x3a4a8e-0x0;var _0x3bab51=_0xf40d[_0x3a4a8e];return _0x3bab51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf40('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf40('0x1'));var moment=require(_0xdf40('0x2'));var BPromise=require(_0xdf40('0x3'));var Mustache=require(_0xdf40('0x4'));var util=require('util');var path=require(_0xdf40('0x5'));var sox=require(_0xdf40('0x6'));var csv=require(_0xdf40('0x7'));var ejs=require(_0xdf40('0x8'));var fs=require('fs');var fs_extra=require(_0xdf40('0x9'));var _=require(_0xdf40('0xa'));var squel=require(_0xdf40('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf40('0xc'));var deskjs=require(_0xdf40('0xd'));var toCsv=require(_0xdf40('0x7'));var querystring=require('querystring');var Papa=require(_0xdf40('0xe'));var Redis=require(_0xdf40('0xf'));var authService=require(_0xdf40('0x10'));var qs=require(_0xdf40('0x11'));var as=require(_0xdf40('0x12'));var hardwareService=require(_0xdf40('0x13'));var logger=require('../../config/logger')(_0xdf40('0x14'));var utils=require('../../config/utils');var config=require(_0xdf40('0x15'));var licenseUtil=require(_0xdf40('0x16'));var db=require(_0xdf40('0x17'))['db'];config[_0xdf40('0x18')]=_['defaults'](config[_0xdf40('0x18')],{'host':_0xdf40('0x19'),'port':0x18eb});var socket=require(_0xdf40('0x1a'))(new Redis(config[_0xdf40('0x18')]));require(_0xdf40('0x1b'))[_0xdf40('0x1c')](socket);var jayson=require(_0xdf40('0x1d'));var client=jayson['client'][_0xdf40('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xdf40('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3d31d8,_0x2d7be0,_0x2a9f52,_0x11ba60){return new BPromise(function(_0x31c810,_0x309e00){var _0x25ba65=_0x11ba60||client;return _0x25ba65[_0xdf40('0x1f')](_0x3d31d8,_0x2a9f52)['then'](function(_0x58bc67){logger[_0xdf40('0x20')]('FaxAccount,\x20%s,\x20%s',_0x2d7be0,_0xdf40('0x21'));logger[_0xdf40('0x22')](_0xdf40('0x23'),_0x2d7be0,_0xdf40('0x21'),JSON[_0xdf40('0x24')](_0x58bc67));if(_0x58bc67['error']){if(_0x58bc67['error'][_0xdf40('0x25')]===0x1f4){logger[_0xdf40('0x26')](_0xdf40('0x27'),_0x2d7be0,_0x58bc67['error'][_0xdf40('0x28')]);return _0x309e00(_0x58bc67[_0xdf40('0x26')]['message']);}logger[_0xdf40('0x26')](_0xdf40('0x27'),_0x2d7be0,_0x58bc67[_0xdf40('0x26')][_0xdf40('0x28')]);return _0x31c810(_0x58bc67[_0xdf40('0x26')][_0xdf40('0x28')]);}else{logger['info'](_0xdf40('0x27'),_0x2d7be0,'request\x20sent');_0x31c810(_0x58bc67[_0xdf40('0x29')][_0xdf40('0x28')]);}})[_0xdf40('0x2a')](function(_0x464db1){logger[_0xdf40('0x26')](_0xdf40('0x27'),_0x2d7be0,_0x464db1);_0x309e00(_0x464db1);});});}function respondWithStatusCode(_0xc36962,_0x35743a){_0x35743a=_0x35743a||0xcc;return function(_0x250b49){if(_0x250b49){return _0xc36962[_0xdf40('0x2b')](_0x35743a);}return _0xc36962[_0xdf40('0x2c')](_0x35743a)['end']();};}function respondWithResult(_0x49dc9c,_0x4d67af){_0x4d67af=_0x4d67af||0xc8;return function(_0x59a219){if(_0x59a219){return _0x49dc9c[_0xdf40('0x2c')](_0x4d67af)[_0xdf40('0x2d')](_0x59a219);}};}function respondWithFilteredResult(_0x1a6d5d,_0xb87ab){return function(_0xe8b228){if(_0xe8b228){var _0x4b1b34=typeof _0xb87ab[_0xdf40('0x2e')]==='undefined'&&typeof _0xb87ab['limit']===_0xdf40('0x2f');var _0x7b2e=_0xe8b228[_0xdf40('0x30')];var _0x5d32a3=_0x4b1b34?0x0:_0xb87ab[_0xdf40('0x2e')];var _0x305aad=_0x4b1b34?_0xe8b228[_0xdf40('0x30')]:_0xb87ab[_0xdf40('0x2e')]+_0xb87ab[_0xdf40('0x31')];var _0x48476a;if(_0x305aad>=_0x7b2e){_0x305aad=_0x7b2e;_0x48476a=0xc8;}else{_0x48476a=0xce;}_0x1a6d5d[_0xdf40('0x2c')](_0x48476a);return _0x1a6d5d['set'](_0xdf40('0x32'),_0x5d32a3+'-'+_0x305aad+'/'+_0x7b2e)['json'](_0xe8b228);}return null;};}function patchUpdates(_0x21e9c4){return function(_0x1b9fb1){try{jsonpatch[_0xdf40('0x33')](_0x1b9fb1,_0x21e9c4,!![]);}catch(_0x3ec417){return BPromise[_0xdf40('0x34')](_0x3ec417);}return _0x1b9fb1[_0xdf40('0x35')]();};}function saveUpdates(_0x153ddf,_0x10fd76){return function(_0x447b85){if(_0x447b85){return _0x447b85[_0xdf40('0x36')](_0x153ddf)['then'](function(_0x514bf1){return _0x514bf1;});}return null;};}function removeEntity(_0x51e23c,_0x1cace6){return function(_0x345356){if(_0x345356){return _0x345356[_0xdf40('0x37')]()[_0xdf40('0x38')](function(){var _0x51afcc=_0x345356['get']({'plain':!![]});var _0x44a146=_0xdf40('0x39');return db[_0xdf40('0x3a')][_0xdf40('0x37')]({'where':{'type':_0x44a146,'resourceId':_0x51afcc['id']}})[_0xdf40('0x38')](function(){return _0x345356;});})['then'](function(){_0x51e23c[_0xdf40('0x2c')](0xcc)[_0xdf40('0x3b')]();});}};}function handleEntityNotFound(_0x2db2c3,_0x363e5c){return function(_0x4e568a){if(!_0x4e568a){_0x2db2c3[_0xdf40('0x2b')](0x194);}return _0x4e568a;};}function handleError(_0x5786f4,_0x5f164f){_0x5f164f=_0x5f164f||0x1f4;return function(_0x4477e5){logger[_0xdf40('0x26')](_0x4477e5[_0xdf40('0x3c')]);if(_0x4477e5[_0xdf40('0x3d')]){delete _0x4477e5[_0xdf40('0x3d')];}_0x5786f4['status'](_0x5f164f)['send'](_0x4477e5);};}exports[_0xdf40('0x3e')]=function(_0x56b7ec,_0x448ec3){var _0x1aed0a={'include':[{'model':db['Pause'],'as':_0xdf40('0x3f')}]},_0x28e82f={},_0x5c853a={'count':0x0,'rows':[]};var _0x1127bc=_[_0xdf40('0x40')](db['FaxAccount']['rawAttributes'],function(_0x4ab488){return{'name':_0x4ab488[_0xdf40('0x41')],'type':_0x4ab488[_0xdf40('0x42')][_0xdf40('0x43')]};});_0x28e82f[_0xdf40('0x44')]=_['map'](_0x1127bc,_0xdf40('0x3d'));_0x28e82f[_0xdf40('0x45')]=_[_0xdf40('0x46')](_0x56b7ec[_0xdf40('0x45')]);_0x28e82f[_0xdf40('0x47')]=_['intersection'](_0x28e82f[_0xdf40('0x44')],_0x28e82f[_0xdf40('0x45')]);_0x1aed0a['attributes']=_[_0xdf40('0x48')](_0x28e82f['model'],qs['fields'](_0x56b7ec[_0xdf40('0x45')][_0xdf40('0x49')]));_0x1aed0a['attributes']=_0x1aed0a['attributes'][_0xdf40('0x4a')]?_0x1aed0a[_0xdf40('0x4b')]:_0x28e82f[_0xdf40('0x44')];if(!_0x56b7ec['query'][_0xdf40('0x4c')]('nolimit')){_0x1aed0a[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x56b7ec[_0xdf40('0x45')][_0xdf40('0x31')]);_0x1aed0a[_0xdf40('0x2e')]=qs['offset'](_0x56b7ec['query']['offset']);}_0x1aed0a['order']=qs[_0xdf40('0x4d')](_0x56b7ec[_0xdf40('0x45')][_0xdf40('0x4d')]);_0x1aed0a[_0xdf40('0x4e')]=qs[_0xdf40('0x47')](_[_0xdf40('0x4f')](_0x56b7ec[_0xdf40('0x45')],_0x28e82f[_0xdf40('0x47')]),_0x1127bc);if(_0x56b7ec[_0xdf40('0x45')][_0xdf40('0x50')]){_0x1aed0a[_0xdf40('0x4e')]=_[_0xdf40('0x51')](_0x1aed0a['where'],{'$or':_[_0xdf40('0x40')](_0x1127bc,function(_0x388a88){if(_0x388a88[_0xdf40('0x42')]!==_0xdf40('0x52')){var _0x3a6864={};_0x3a6864[_0x388a88['name']]={'$like':'%'+_0x56b7ec[_0xdf40('0x45')][_0xdf40('0x50')]+'%'};return _0x3a6864;}})});}_0x1aed0a=_['merge']({},_0x1aed0a,_0x56b7ec[_0xdf40('0x53')]);var _0x18aea1={'where':_0x1aed0a[_0xdf40('0x4e')]};return db[_0xdf40('0x54')][_0xdf40('0x30')](_0x18aea1)[_0xdf40('0x38')](function(_0x512103){_0x5c853a['count']=_0x512103;if(_0x56b7ec[_0xdf40('0x45')][_0xdf40('0x55')]){_0x1aed0a[_0xdf40('0x56')]=[{'all':!![]}];}return db[_0xdf40('0x54')][_0xdf40('0x57')](_0x1aed0a);})[_0xdf40('0x38')](function(_0x4bad3e){_0x5c853a[_0xdf40('0x58')]=_0x4bad3e;return _0x5c853a;})[_0xdf40('0x38')](respondWithFilteredResult(_0x448ec3,_0x1aed0a))[_0xdf40('0x2a')](handleError(_0x448ec3,null));};exports[_0xdf40('0x59')]=function(_0x5b0148,_0x2447e9){var _0x57ddc0={'raw':![],'where':{'id':_0x5b0148['params']['id']},'include':[{'model':db[_0xdf40('0x5a')],'as':_0xdf40('0x3f')}]},_0x1a7be1={};_0x1a7be1[_0xdf40('0x44')]=_['keys'](db[_0xdf40('0x54')]['rawAttributes']);_0x1a7be1[_0xdf40('0x45')]=_[_0xdf40('0x46')](_0x5b0148[_0xdf40('0x45')]);_0x1a7be1['filters']=_[_0xdf40('0x48')](_0x1a7be1['model'],_0x1a7be1[_0xdf40('0x45')]);_0x57ddc0[_0xdf40('0x4b')]=_[_0xdf40('0x48')](_0x1a7be1[_0xdf40('0x44')],qs['fields'](_0x5b0148[_0xdf40('0x45')][_0xdf40('0x49')]));_0x57ddc0[_0xdf40('0x4b')]=_0x57ddc0['attributes'][_0xdf40('0x4a')]?_0x57ddc0[_0xdf40('0x4b')]:_0x1a7be1[_0xdf40('0x44')];if(_0x5b0148[_0xdf40('0x45')][_0xdf40('0x55')]){_0x57ddc0[_0xdf40('0x56')]=[{'all':!![]}];}_0x57ddc0=_['merge']({},_0x57ddc0,_0x5b0148['options']);return db[_0xdf40('0x54')]['find'](_0x57ddc0)[_0xdf40('0x38')](handleEntityNotFound(_0x2447e9,null))[_0xdf40('0x38')](respondWithResult(_0x2447e9,null))[_0xdf40('0x2a')](handleError(_0x2447e9,null));};exports[_0xdf40('0x5b')]=function(_0x468880,_0x5d5431){return db[_0xdf40('0x54')][_0xdf40('0x5b')](_0x468880[_0xdf40('0x5c')],{})[_0xdf40('0x38')](function(_0x592208){var _0x1457b4=_0x468880[_0xdf40('0x5d')]['get']({'plain':!![]});if(!_0x1457b4)throw new Error(_0xdf40('0x5e'));if(_0x1457b4[_0xdf40('0x5f')]===_0xdf40('0x5d')){var _0x5558cf=_0x592208['get']({'plain':!![]});var _0x2b035e='FaxAccounts';return db[_0xdf40('0x60')][_0xdf40('0x61')]({'where':{'name':_0x2b035e,'userProfileId':_0x1457b4[_0xdf40('0x62')]},'raw':!![]})[_0xdf40('0x38')](function(_0x5cca09){if(_0x5cca09&&_0x5cca09[_0xdf40('0x63')]===0x0){return db[_0xdf40('0x3a')][_0xdf40('0x5b')]({'name':_0x5558cf[_0xdf40('0x3d')],'resourceId':_0x5558cf['id'],'type':_0x5cca09[_0xdf40('0x3d')],'sectionId':_0x5cca09['id']},{})[_0xdf40('0x38')](function(){return _0x592208;});}else{return _0x592208;}})['catch'](function(_0x421ed2){logger[_0xdf40('0x26')](_0xdf40('0x64'),_0x421ed2);throw _0x421ed2;});}return _0x592208;})['then'](respondWithResult(_0x5d5431,0xc9))[_0xdf40('0x2a')](handleError(_0x5d5431,null));};exports[_0xdf40('0x36')]=function(_0x3733f3,_0x28d921){if(_0x3733f3['body']['id']){delete _0x3733f3[_0xdf40('0x5c')]['id'];}return db[_0xdf40('0x54')]['find']({'where':{'id':_0x3733f3[_0xdf40('0x65')]['id']},'include':[{'model':db[_0xdf40('0x5a')],'as':_0xdf40('0x3f')}]})[_0xdf40('0x38')](handleEntityNotFound(_0x28d921,null))['then'](saveUpdates(_0x3733f3[_0xdf40('0x5c')],null))[_0xdf40('0x38')](respondWithResult(_0x28d921,null))[_0xdf40('0x2a')](handleError(_0x28d921,null));};exports[_0xdf40('0x37')]=function(_0x8e18bb,_0x564fb5){return db[_0xdf40('0x54')][_0xdf40('0x61')]({'where':{'id':_0x8e18bb['params']['id']}})['then'](handleEntityNotFound(_0x564fb5,null))[_0xdf40('0x38')](removeEntity(_0x564fb5,null))[_0xdf40('0x2a')](handleError(_0x564fb5,null));};exports['describe']=function(_0x148555,_0x29673f){return db[_0xdf40('0x54')][_0xdf40('0x66')]()[_0xdf40('0x38')](respondWithResult(_0x29673f,null))['catch'](handleError(_0x29673f,null));};exports[_0xdf40('0x67')]=function(_0x2e41f2,_0x1f90a8,_0x47873d){if(_0x2e41f2[_0xdf40('0x5c')]['id']){delete _0x2e41f2[_0xdf40('0x5c')]['id'];}return db[_0xdf40('0x54')][_0xdf40('0x61')]({'where':{'id':_0x2e41f2[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x1f90a8,null))[_0xdf40('0x38')](function(_0x525b7a){if(_0x525b7a){_0x2e41f2[_0xdf40('0x5c')][_0xdf40('0x68')]=_0x525b7a['id'];return db['Disposition'][_0xdf40('0x5b')](_0x2e41f2[_0xdf40('0x5c')]);}})[_0xdf40('0x38')](respondWithResult(_0x1f90a8,null))[_0xdf40('0x2a')](handleError(_0x1f90a8,null));};exports[_0xdf40('0x69')]=function(_0x1204b9,_0x46a5a9,_0x13c39b){var _0x5acf41={'raw':![],'where':{}};var _0x24e4bc={};var _0x69b7d0={'count':0x0,'rows':[]};return db[_0xdf40('0x54')][_0xdf40('0x6a')]({'where':{'id':_0x1204b9[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x46a5a9,null))[_0xdf40('0x38')](function(_0x150eb8){if(_0x150eb8){_0x24e4bc[_0xdf40('0x44')]=_[_0xdf40('0x46')](db['Disposition'][_0xdf40('0x6b')]);_0x24e4bc['query']=_[_0xdf40('0x46')](_0x1204b9[_0xdf40('0x45')]);_0x24e4bc[_0xdf40('0x47')]=_[_0xdf40('0x48')](_0x24e4bc['model'],_0x24e4bc[_0xdf40('0x45')]);_0x5acf41[_0xdf40('0x4b')]=_[_0xdf40('0x48')](_0x24e4bc[_0xdf40('0x44')],qs[_0xdf40('0x49')](_0x1204b9['query'][_0xdf40('0x49')]));_0x5acf41[_0xdf40('0x4b')]=_0x5acf41[_0xdf40('0x4b')]['length']?_0x5acf41['attributes']:_0x24e4bc[_0xdf40('0x44')];if(!_0x1204b9[_0xdf40('0x45')][_0xdf40('0x4c')]('nolimit')){_0x5acf41[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x1204b9[_0xdf40('0x45')][_0xdf40('0x31')]);_0x5acf41[_0xdf40('0x2e')]=qs[_0xdf40('0x2e')](_0x1204b9[_0xdf40('0x45')][_0xdf40('0x2e')]);}_0x5acf41[_0xdf40('0x6c')]=qs[_0xdf40('0x4d')](_0x1204b9[_0xdf40('0x45')]['sort']);_0x5acf41['where']=qs[_0xdf40('0x47')](_['pick'](_0x1204b9['query'],_0x24e4bc['filters']));_0x5acf41[_0xdf40('0x4e')][_0xdf40('0x68')]=_0x150eb8['id'];if(_0x1204b9[_0xdf40('0x45')][_0xdf40('0x50')]){_0x5acf41['where']=_[_0xdf40('0x51')](_0x5acf41[_0xdf40('0x4e')],{'$or':_['map'](_0x5acf41[_0xdf40('0x4b')],function(_0x2d21d4){var _0x2f334e={};_0x2f334e[_0x2d21d4]={'$like':'%'+_0x1204b9[_0xdf40('0x45')][_0xdf40('0x50')]+'%'};return _0x2f334e;})});}_0x5acf41=_[_0xdf40('0x51')]({},_0x5acf41,_0x1204b9[_0xdf40('0x53')]);return db[_0xdf40('0x6d')]['count']({'where':_0x5acf41['where']})[_0xdf40('0x38')](function(_0x18080f){_0x69b7d0['count']=_0x18080f;if(_0x1204b9[_0xdf40('0x45')][_0xdf40('0x55')]){_0x5acf41[_0xdf40('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xdf40('0x57')](_0x5acf41);})['then'](function(_0x324f6e){_0x69b7d0[_0xdf40('0x58')]=_0x324f6e;return _0x69b7d0;});}})[_0xdf40('0x38')](respondWithFilteredResult(_0x46a5a9,_0x5acf41))[_0xdf40('0x2a')](handleError(_0x46a5a9,null));};exports['removeDispositions']=function(_0x757b0,_0xb79c2a,_0x2c2c20){return db[_0xdf40('0x54')][_0xdf40('0x61')]({'where':{'id':_0x757b0[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0xb79c2a,null))[_0xdf40('0x38')](function(_0x5db96a){if(_0x5db96a){return _0x5db96a['removeDispositions'](_0x757b0['query'][_0xdf40('0x6e')]);}})[_0xdf40('0x38')](respondWithStatusCode(_0xb79c2a,null))[_0xdf40('0x2a')](handleError(_0xb79c2a,null));};exports[_0xdf40('0x6f')]=function(_0x4d6c73,_0x140aa4,_0x2bd4cc){if(_0x4d6c73[_0xdf40('0x5c')]['id']){delete _0x4d6c73[_0xdf40('0x5c')]['id'];}return db[_0xdf40('0x54')][_0xdf40('0x61')]({'where':{'id':_0x4d6c73['params']['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x140aa4,null))[_0xdf40('0x38')](function(_0xa1de78){if(_0xa1de78){_0x4d6c73[_0xdf40('0x5c')][_0xdf40('0x68')]=_0xa1de78['id'];return db['CannedAnswer'][_0xdf40('0x5b')](_0x4d6c73['body']);}})['then'](respondWithResult(_0x140aa4,null))[_0xdf40('0x2a')](handleError(_0x140aa4,null));};exports['getAnswers']=function(_0x22cb61,_0x463e99,_0x4ac17f){var _0x1a0dd5={'raw':![],'where':{}};var _0x116dcb={};var _0x437735={'count':0x0,'rows':[]};return db[_0xdf40('0x54')]['findOne']({'where':{'id':_0x22cb61[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x463e99,null))[_0xdf40('0x38')](function(_0x539a9b){if(_0x539a9b){_0x116dcb[_0xdf40('0x44')]=_['keys'](db['CannedAnswer'][_0xdf40('0x6b')]);_0x116dcb[_0xdf40('0x45')]=_[_0xdf40('0x46')](_0x22cb61['query']);_0x116dcb[_0xdf40('0x47')]=_['intersection'](_0x116dcb[_0xdf40('0x44')],_0x116dcb[_0xdf40('0x45')]);_0x1a0dd5[_0xdf40('0x4b')]=_['intersection'](_0x116dcb['model'],qs[_0xdf40('0x49')](_0x22cb61[_0xdf40('0x45')]['fields']));_0x1a0dd5[_0xdf40('0x4b')]=_0x1a0dd5[_0xdf40('0x4b')][_0xdf40('0x4a')]?_0x1a0dd5[_0xdf40('0x4b')]:_0x116dcb[_0xdf40('0x44')];if(!_0x22cb61[_0xdf40('0x45')][_0xdf40('0x4c')](_0xdf40('0x70'))){_0x1a0dd5[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x22cb61[_0xdf40('0x45')][_0xdf40('0x31')]);_0x1a0dd5[_0xdf40('0x2e')]=qs[_0xdf40('0x2e')](_0x22cb61['query']['offset']);}_0x1a0dd5['order']=qs['sort'](_0x22cb61[_0xdf40('0x45')][_0xdf40('0x4d')]);_0x1a0dd5[_0xdf40('0x4e')]=qs[_0xdf40('0x47')](_[_0xdf40('0x4f')](_0x22cb61[_0xdf40('0x45')],_0x116dcb['filters']));_0x1a0dd5['where'][_0xdf40('0x68')]=_0x539a9b['id'];if(_0x22cb61[_0xdf40('0x45')][_0xdf40('0x50')]){_0x1a0dd5['where']=_['merge'](_0x1a0dd5['where'],{'$or':_['map'](_0x1a0dd5['attributes'],function(_0x14db7e){var _0x55c300={};_0x55c300[_0x14db7e]={'$like':'%'+_0x22cb61['query'][_0xdf40('0x50')]+'%'};return _0x55c300;})});}_0x1a0dd5=_[_0xdf40('0x51')]({},_0x1a0dd5,_0x22cb61[_0xdf40('0x53')]);return db['CannedAnswer']['count']({'where':_0x1a0dd5[_0xdf40('0x4e')]})['then'](function(_0x9c761f){_0x437735['count']=_0x9c761f;if(_0x22cb61[_0xdf40('0x45')][_0xdf40('0x55')]){_0x1a0dd5[_0xdf40('0x56')]=[{'all':!![]}];}return db[_0xdf40('0x71')]['findAll'](_0x1a0dd5);})[_0xdf40('0x38')](function(_0x37cfda){_0x437735[_0xdf40('0x58')]=_0x37cfda;return _0x437735;});}})['then'](respondWithFilteredResult(_0x463e99,_0x1a0dd5))[_0xdf40('0x2a')](handleError(_0x463e99,null));};exports[_0xdf40('0x72')]=function(_0x284b92,_0x49b5bf,_0x458fc9){return db['FaxAccount']['find']({'where':{'id':_0x284b92[_0xdf40('0x65')]['id']}})['then'](handleEntityNotFound(_0x49b5bf,null))[_0xdf40('0x38')](function(_0x3c66cb){if(_0x3c66cb){return _0x3c66cb[_0xdf40('0x72')](_0x284b92[_0xdf40('0x45')]['ids']);}})[_0xdf40('0x38')](respondWithStatusCode(_0x49b5bf,null))[_0xdf40('0x2a')](handleError(_0x49b5bf,null));};exports[_0xdf40('0x73')]=function(_0x56c418,_0x45b2e5,_0x2e5bf2){return db[_0xdf40('0x74')][_0xdf40('0x61')]({'where':{'id':_0x56c418[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x45b2e5,null))[_0xdf40('0x38')](function(_0x249e0f){if(_0x249e0f){return _0x249e0f[_0xdf40('0x73')](_0x56c418[_0xdf40('0x5c')][_0xdf40('0x6e')],_[_0xdf40('0x75')](_0x56c418[_0xdf40('0x5c')],[_0xdf40('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x45b2e5,null))['catch'](handleError(_0x45b2e5,null));};exports[_0xdf40('0x76')]=function(_0x4ca798,_0x34b73f,_0x41b8fe){var _0x48abab={'raw':![],'where':{}};var _0x13fcdd={};var _0x5da98d={'count':0x0,'rows':[]};return db[_0xdf40('0x54')][_0xdf40('0x6a')]({'where':{'id':_0x4ca798['params']['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x34b73f,null))['then'](function(_0x4b5f49){if(_0x4b5f49){_0x13fcdd[_0xdf40('0x44')]=_[_0xdf40('0x46')](db[_0xdf40('0x74')][_0xdf40('0x6b')]);_0x13fcdd[_0xdf40('0x45')]=_[_0xdf40('0x46')](_0x4ca798[_0xdf40('0x45')]);_0x13fcdd[_0xdf40('0x47')]=_[_0xdf40('0x48')](_0x13fcdd[_0xdf40('0x44')],_0x13fcdd[_0xdf40('0x45')]);_0x48abab[_0xdf40('0x4b')]=_[_0xdf40('0x48')](_0x13fcdd[_0xdf40('0x44')],qs[_0xdf40('0x49')](_0x4ca798['query'][_0xdf40('0x49')]));_0x48abab[_0xdf40('0x4b')]=_0x48abab[_0xdf40('0x4b')][_0xdf40('0x4a')]?_0x48abab[_0xdf40('0x4b')]:_0x13fcdd['model'];if(!_0x4ca798[_0xdf40('0x45')][_0xdf40('0x4c')](_0xdf40('0x70'))){_0x48abab[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x4ca798[_0xdf40('0x45')][_0xdf40('0x31')]);_0x48abab[_0xdf40('0x2e')]=qs[_0xdf40('0x2e')](_0x4ca798[_0xdf40('0x45')][_0xdf40('0x2e')]);}_0x48abab[_0xdf40('0x6c')]=qs[_0xdf40('0x4d')](_0x4ca798[_0xdf40('0x45')][_0xdf40('0x4d')]);_0x48abab[_0xdf40('0x4e')]=qs[_0xdf40('0x47')](_[_0xdf40('0x4f')](_0x4ca798[_0xdf40('0x45')],_0x13fcdd[_0xdf40('0x47')]));_0x48abab[_0xdf40('0x4e')][_0xdf40('0x68')]=_0x4b5f49['id'];if(_0x4ca798[_0xdf40('0x45')][_0xdf40('0x50')]){_0x48abab[_0xdf40('0x4e')]=_[_0xdf40('0x51')](_0x48abab[_0xdf40('0x4e')],{'$or':_[_0xdf40('0x40')](_0x48abab[_0xdf40('0x4b')],function(_0x220a54){var _0x23e905={};_0x23e905[_0x220a54]={'$like':'%'+_0x4ca798[_0xdf40('0x45')][_0xdf40('0x50')]+'%'};return _0x23e905;})});}_0x48abab=_[_0xdf40('0x51')]({},_0x48abab,_0x4ca798[_0xdf40('0x53')]);return db[_0xdf40('0x74')][_0xdf40('0x30')]({'where':_0x48abab['where']})[_0xdf40('0x38')](function(_0x3b6d85){_0x5da98d[_0xdf40('0x30')]=_0x3b6d85;if(_0x4ca798[_0xdf40('0x45')][_0xdf40('0x55')]){_0x48abab[_0xdf40('0x56')]=[{'model':db['CmContact'],'as':_0xdf40('0x77'),'required':![]},{'model':db[_0xdf40('0x78')],'as':_0xdf40('0x79'),'attributes':[_0xdf40('0x3d'),'fullname',_0xdf40('0x7a')],'required':![]},{'model':db[_0xdf40('0x7b')],'as':_0xdf40('0x7c'),'attributes':['id',_0xdf40('0x3d'),_0xdf40('0x7d')],'where':_0x4ca798[_0xdf40('0x45')][_0xdf40('0x7e')]?{'id':_0x4ca798[_0xdf40('0x45')][_0xdf40('0x7e')]}:undefined,'required':_0x4ca798[_0xdf40('0x45')][_0xdf40('0x7e')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x48abab);})['then'](function(_0xf0cc4){_0x5da98d['rows']=_0xf0cc4;return _0x5da98d;});}})[_0xdf40('0x38')](respondWithFilteredResult(_0x34b73f,_0x48abab))['catch'](handleError(_0x34b73f,null));};exports[_0xdf40('0x7f')]=function(_0x55e569,_0x4f90c2){var _0x59abb4=_0x55e569[_0xdf40('0x65')]['id'];var _0x5510f0=_0x55e569['body'];var _0x277efd=0xc8;var _0x4c914e=null;return db[_0xdf40('0x80')]['transaction']({'isolationLevel':db[_0xdf40('0x80')][_0xdf40('0x81')][_0xdf40('0x82')][_0xdf40('0x83')]},function(_0x248aab){return db[_0xdf40('0x54')][_0xdf40('0x6a')]({'where':{'id':_0x59abb4},'transaction':_0x248aab})[_0xdf40('0x38')](function(_0x405a73){if(_0x405a73){return db[_0xdf40('0x84')][_0xdf40('0x37')]({'where':{'FaxAccountId':_0x59abb4},'transaction':_0x248aab})['then'](function(){var _0x22bd4f=_[_0xdf40('0x40')](_0x5510f0,function(_0x1decd1){_0x1decd1[_0xdf40('0x68')]=_0x59abb4;return _0x1decd1;});return db[_0xdf40('0x84')][_0xdf40('0x85')](_0x22bd4f,{'transaction':_0x248aab});});}else{_0x277efd=0x194;_0x4c914e=[];}});})['then'](function(){if(_0x277efd!==0x194){return db[_0xdf40('0x84')][_0xdf40('0x86')]({'where':{'FaxAccountId':_0x59abb4},'order':_0xdf40('0x87')})[_0xdf40('0x38')](function(_0x3f7a81){_0x4c914e=_0x3f7a81;});}})[_0xdf40('0x2a')](function(_0x59fd5a){_0x277efd=0x1f4;logger['error'](_0x59fd5a[_0xdf40('0x3c')]);if(_0x59fd5a[_0xdf40('0x3d')]){delete _0x59fd5a['name'];}_0x4c914e=_0x59fd5a;})[_0xdf40('0x88')](function(){if(_0x4c914e===null){_0x4f90c2[_0xdf40('0x2b')](_0x277efd);}else{if(_0x277efd===0x1f4){_0x4f90c2[_0xdf40('0x2c')](_0x277efd)[_0xdf40('0x89')](_0x4c914e);}else{_0x4f90c2[_0xdf40('0x2c')](_0x277efd)[_0xdf40('0x2d')](_0x4c914e);}}});};exports[_0xdf40('0x8a')]=function(_0x1897c4,_0x433360,_0x1b11ec){var _0x304667={};var _0x20b712={};var _0xd8b776;var _0x320eeb;return db[_0xdf40('0x54')][_0xdf40('0x6a')]({'where':{'id':_0x1897c4['params']['id']}})['then'](handleEntityNotFound(_0x433360,null))[_0xdf40('0x38')](function(_0x539e0c){if(_0x539e0c){_0xd8b776=_0x539e0c;_0x20b712[_0xdf40('0x44')]=_[_0xdf40('0x46')](db['FaxApplication']['rawAttributes']);_0x20b712['query']=_[_0xdf40('0x46')](_0x1897c4[_0xdf40('0x45')]);_0x20b712['filters']=_['intersection'](_0x20b712[_0xdf40('0x44')],_0x20b712[_0xdf40('0x45')]);_0x304667['attributes']=_[_0xdf40('0x48')](_0x20b712[_0xdf40('0x44')],qs[_0xdf40('0x49')](_0x1897c4[_0xdf40('0x45')][_0xdf40('0x49')]));_0x304667[_0xdf40('0x4b')]=_0x304667[_0xdf40('0x4b')][_0xdf40('0x4a')]?_0x304667[_0xdf40('0x4b')]:_0x20b712[_0xdf40('0x44')];_0x304667['order']=qs[_0xdf40('0x4d')](_0x1897c4[_0xdf40('0x45')]['sort']);_0x304667[_0xdf40('0x4e')]=qs[_0xdf40('0x47')](_[_0xdf40('0x4f')](_0x1897c4[_0xdf40('0x45')],_0x20b712['filters']));if(_0x1897c4[_0xdf40('0x45')][_0xdf40('0x50')]){_0x304667[_0xdf40('0x4e')]=_[_0xdf40('0x51')](_0x304667[_0xdf40('0x4e')],{'$or':_[_0xdf40('0x40')](_0x304667[_0xdf40('0x4b')],function(_0x51ea63){var _0x2a7931={};_0x2a7931[_0x51ea63]={'$like':'%'+_0x1897c4[_0xdf40('0x45')][_0xdf40('0x50')]+'%'};return _0x2a7931;})});}_0x304667=_[_0xdf40('0x51')]({},_0x304667,_0x1897c4['options']);return _0xd8b776[_0xdf40('0x8a')](_0x304667);}})[_0xdf40('0x38')](function(_0x4ab9f4){if(_0x4ab9f4){_0x320eeb=_0x4ab9f4[_0xdf40('0x4a')];if(!_0x1897c4[_0xdf40('0x45')][_0xdf40('0x4c')](_0xdf40('0x70'))){_0x304667[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x1897c4['query'][_0xdf40('0x31')]);_0x304667[_0xdf40('0x2e')]=qs[_0xdf40('0x2e')](_0x1897c4[_0xdf40('0x45')][_0xdf40('0x2e')]);}return _0xd8b776['getApplications'](_0x304667);}})['then'](function(_0x2c359b){if(_0x2c359b){return _0x2c359b?{'count':_0x320eeb,'rows':_0x2c359b}:null;}})[_0xdf40('0x38')](respondWithResult(_0x433360,null))[_0xdf40('0x2a')](handleError(_0x433360,null));};function Extension(_0x415b44,_0x3f12fb,_0x1d6154,_0x41043c){this[_0xdf40('0x8b')]=_0xdf40('0x8c');this[_0xdf40('0x8d')]=_0x415b44[_0xdf40('0x8e')];this[_0xdf40('0x8f')]=_0x41043c;this[_0xdf40('0x42')]=_0xdf40('0x90');this[_0xdf40('0x91')]=_0xdf40('0x92');this[_0xdf40('0x68')]=_0x415b44['id'];this[_0xdf40('0x87')]=_0x3f12fb;this[_0xdf40('0x93')]=_0x1d6154;}function createExtensionsReciveFax(_0x879f0f){var _0x5cc525=0x1;var _0x5b771e=[];_0x5b771e['push'](new Extension(_0x879f0f,_0x5cc525,'','Answer'));_0x5cc525+=0x1;_0x5b771e[_0xdf40('0x94')](new Extension(_0x879f0f,_0x5cc525,'CDR(type)=inbound-fax',_0xdf40('0x95')));_0x5cc525+=0x1;for(var _0x531c4e in _0x879f0f){if(_0x879f0f['hasOwnProperty'](_0x531c4e)&&(_0x531c4e===_0xdf40('0x96')||_0x531c4e===_0xdf40('0x8e')||_0x531c4e==='gateway'||_0x531c4e===_0xdf40('0x97')||_0x531c4e===_0xdf40('0x98')||_0x531c4e===_0xdf40('0x99')||_0x531c4e===_0xdf40('0x9a')||_0x531c4e===_0xdf40('0x9b')||_0x531c4e===_0xdf40('0x9c'))){_0x5b771e[_0xdf40('0x94')](new Extension(_0x879f0f,_0x5cc525,_0xdf40('0x9d')+_0x531c4e+')='+_0x879f0f[_0x531c4e],'Set'));_0x5cc525+=0x1;}}_0x5b771e['push'](new Extension(_0x879f0f,_0x5cc525,'6','Wait'));_0x5cc525+=0x1;_0x5b771e['push'](new Extension(_0x879f0f,_0x5cc525,_0xdf40('0x9e'),_0xdf40('0x9f')));_0x5cc525=0x0;return _0x5b771e;}exports[_0xdf40('0xa0')]=function(_0x4d76f9,_0x59ee3e,_0x5b6cd3){var _0x1aed61;return db[_0xdf40('0x80')][_0xdf40('0xa1')](function(_0x1c2ba9){return db['FaxAccount'][_0xdf40('0x5b')](_0x4d76f9[_0xdf40('0x5c')],{'transaction':_0x1c2ba9})[_0xdf40('0x38')](function(_0x22d31e){_0x1aed61=_0x22d31e['get']({'plain':!![]});return db[_0xdf40('0xa2')][_0xdf40('0x85')](createExtensionsReciveFax(_0x1aed61),{'transaction':_0x1c2ba9});});})[_0xdf40('0x38')](function(){return _0x1aed61;})[_0xdf40('0x38')](respondWithResult(_0x59ee3e,null))[_0xdf40('0x2a')](handleError(_0x59ee3e,null));};exports[_0xdf40('0xa3')]=function(_0x1a60b2,_0x129d84,_0x575db2){var _0x309ab4;return db[_0xdf40('0x80')]['transaction'](function(_0x158b5f){return db['FaxAccount'][_0xdf40('0x36')](_0x1a60b2[_0xdf40('0x5c')],{'where':{'id':_0x1a60b2[_0xdf40('0x5c')]['id']},'transaction':_0x158b5f})['then'](function(_0x491923){return db[_0xdf40('0xa2')][_0xdf40('0x37')]({'where':{'FaxAccountId':_0x1a60b2[_0xdf40('0x5c')]['id']},'transaction':_0x158b5f})['then'](function(_0x301369){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xdf40('0x75')](_0x1a60b2[_0xdf40('0x5c')],[_0xdf40('0xa4'),'key',_0xdf40('0xa5'),_0xdf40('0xa6'),_0xdf40('0xa7'),_0xdf40('0xa8')])),{'transaction':_0x158b5f});});});})[_0xdf40('0x38')](function(){return db[_0xdf40('0x54')][_0xdf40('0xa9')](_0x1a60b2[_0xdf40('0x5c')]['id']);})['then'](respondWithResult(_0x129d84,null))[_0xdf40('0x2a')](handleError(_0x129d84,null));};exports['getMessages']=function(_0x5ac017,_0x393735,_0x3e10d6){var _0x9ce226={'raw':!![],'where':{}};var _0x897782={};var _0x57b00d={'count':0x0,'rows':[]};return db[_0xdf40('0x54')][_0xdf40('0x6a')]({'where':{'id':_0x5ac017[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x393735,null))[_0xdf40('0x38')](function(_0x3aa738){if(_0x3aa738){_0x897782['model']=_[_0xdf40('0x46')](db[_0xdf40('0xaa')][_0xdf40('0x6b')]);_0x897782[_0xdf40('0x45')]=_['keys'](_0x5ac017[_0xdf40('0x45')]);_0x897782[_0xdf40('0x47')]=_['intersection'](_0x897782[_0xdf40('0x44')],_0x897782['query']);_0x9ce226[_0xdf40('0x4b')]=_[_0xdf40('0x48')](_0x897782[_0xdf40('0x44')],qs['fields'](_0x5ac017[_0xdf40('0x45')][_0xdf40('0x49')]));_0x9ce226['attributes']=_0x9ce226[_0xdf40('0x4b')][_0xdf40('0x4a')]?_0x9ce226[_0xdf40('0x4b')]:_0x897782[_0xdf40('0x44')];if(!_0x5ac017[_0xdf40('0x45')]['hasOwnProperty'](_0xdf40('0x70'))){_0x9ce226[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x5ac017[_0xdf40('0x45')]['limit']);_0x9ce226[_0xdf40('0x2e')]=qs[_0xdf40('0x2e')](_0x5ac017['query']['offset']);}_0x9ce226['order']=qs[_0xdf40('0x4d')](_0x5ac017['query'][_0xdf40('0x4d')]);_0x9ce226[_0xdf40('0x4e')]=qs[_0xdf40('0x47')](_[_0xdf40('0x4f')](_0x5ac017[_0xdf40('0x45')],_0x897782[_0xdf40('0x47')]));_0x9ce226[_0xdf40('0x4e')][_0xdf40('0x68')]=_0x3aa738['id'];if(_0x5ac017[_0xdf40('0x45')]['filter']){_0x9ce226[_0xdf40('0x4e')]=_['merge'](_0x9ce226[_0xdf40('0x4e')],{'$or':_[_0xdf40('0x40')](_0x9ce226[_0xdf40('0x4b')],function(_0x48c264){var _0x59658f={};_0x59658f[_0x48c264]={'$like':'%'+_0x5ac017['query'][_0xdf40('0x50')]+'%'};return _0x59658f;})});}if(_0x5ac017['query']['$gte']){var _0x3c72ed=_0x5ac017[_0xdf40('0x45')][_0xdf40('0xab')][_0xdf40('0xac')](',');var _0x439400={};_0x439400[_0x3c72ed[0x0]]={'$gte':moment(_0x3c72ed[0x1])['format'](_0xdf40('0xad'))};_0x9ce226[_0xdf40('0x4e')]=_[_0xdf40('0x51')](_0x9ce226[_0xdf40('0x4e')],_0x439400);}_0x9ce226=_[_0xdf40('0x51')]({},_0x9ce226,_0x5ac017[_0xdf40('0x53')]);return db[_0xdf40('0xaa')][_0xdf40('0x30')]({'where':_0x9ce226[_0xdf40('0x4e')]})[_0xdf40('0x38')](function(_0x29ba5c){_0x57b00d[_0xdf40('0x30')]=_0x29ba5c;if(_0x5ac017['query'][_0xdf40('0x55')]){_0x9ce226['include']=[{'all':!![]}];}return db['FaxMessage'][_0xdf40('0x57')](_0x9ce226);})['then'](function(_0x2d1c14){_0x57b00d[_0xdf40('0x58')]=_0x2d1c14;return _0x57b00d;});}})[_0xdf40('0x38')](respondWithFilteredResult(_0x393735,_0x9ce226))[_0xdf40('0x2a')](handleError(_0x393735,null));};exports[_0xdf40('0x89')]=function(_0x552e8c,_0xb55865,_0x502f2a){var _0x5b7cba,_0x153ff5={},_0x29a333;if(_0x552e8c[_0xdf40('0x5c')]['to']){_0x29a333=_0x552e8c['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x552e8c[_0xdf40('0x65')]['id']},'include':[{'model':db[_0xdf40('0xae')],'as':_0xdf40('0xaf'),'include':[{'model':db[_0xdf40('0xb0')],'as':_0xdf40('0xb1'),'where':{'fax':_0x29a333},'limit':0x1,'order':[[_0xdf40('0xa6'),'DESC']]}]}]})[_0xdf40('0x38')](handleEntityNotFound(_0xb55865,null))[_0xdf40('0x38')](function(_0x43c4c2){_0x5b7cba=_0x43c4c2;if(_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')]&&_0x552e8c['body'][_0xdf40('0xb2')]['length']){for(var _0x10d178=0x0;_0x10d178<_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][_0xdf40('0x4a')];_0x10d178+=0x1){_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][_0x10d178]={'filename':_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][_0x10d178][_0xdf40('0x3d')],'id':_0x552e8c['body'][_0xdf40('0xb2')][_0x10d178]['id'],'path':path[_0xdf40('0xb3')](config[_0xdf40('0xb4')],_0xdf40('0xb5'),_0x552e8c[_0xdf40('0x5c')]['attachments'][_0x10d178][_0xdf40('0xb6')])};}}return respondWithRpcPromise(_0xdf40('0xb7'),_0xdf40('0xb7'),{'FaxAccountId':_[_0xdf40('0xb8')](_0x552e8c[_0xdf40('0x65')]['id'])?undefined:_0x552e8c[_0xdf40('0x65')]['id'],'path':_[_0xdf40('0xb8')](_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0][_0xdf40('0x5')])?undefined:_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0][_0xdf40('0x5')],'fax':_[_0xdf40('0xb8')](_0x552e8c[_0xdf40('0x5c')]['to'][0x0])?undefined:_0x552e8c['body']['to'][0x0]},client9002);})['then'](function(){if(_0x5b7cba){if(_['isNil'](_0x552e8c['body'][_0xdf40('0xb9')])){_0x552e8c['body'][_0xdf40('0xb9')]=util[_0xdf40('0xba')]('\x22%s\x22\x20<%s>',_0x5b7cba['name'],_0x5b7cba[_0xdf40('0xbb')]);}if(_0x5b7cba['List']){if(_0x5b7cba[_0xdf40('0xaf')][_0xdf40('0xb1')][_0xdf40('0x4a')]){return _0x5b7cba['List'][_0xdf40('0xb1')][0x0];}else{return db[_0xdf40('0xb0')]['create'](_[_0xdf40('0xbc')](_0x552e8c['body'],{'firstName':_0x552e8c[_0xdf40('0x5c')]['to'][0x0],'phone':_0x552e8c['body']['to'][0x0],'fax':_0x552e8c[_0xdf40('0x5c')]['to'][0x0],'ListId':_0x5b7cba['ListId']}));}}else{throw new Error(_0xdf40('0xbd'));}}else{throw new Error(_0xdf40('0xbe'));}})[_0xdf40('0x38')](function(_0x2b357a){if(_0x2b357a){return db[_0xdf40('0x74')][_0xdf40('0x61')]({'where':{'ContactId':_0x2b357a['id'],'closed':![],'FaxAccountId':_0x5b7cba['id']}})['then'](function(_0x5c0b5f){if(_0x5c0b5f){return[_0x5c0b5f,![]];}return db[_0xdf40('0x74')]['create']({'UserId':_0x552e8c[_0xdf40('0x5d')]['id'],'ContactId':_0x2b357a['id'],'FaxAccountId':_0x5b7cba['id'],'fax':_0x552e8c[_0xdf40('0x5c')]['to'][0x0],'firstMsgDirection':_0xdf40('0xbf'),'Messages':[_[_0xdf40('0x51')](_0x552e8c[_0xdf40('0x5c')],{'read':![],'body':_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0][_0xdf40('0xc0')],'FaxAccountId':_0x5b7cba['id'],'UserId':_0x552e8c[_0xdf40('0x5d')]['id'],'ContactId':_0x2b357a['id'],'AttachmentId':_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0]['id']})]},{'include':[{'model':db[_0xdf40('0xaa')],'as':'Messages'}]})[_0xdf40('0x38')](function(_0x3576f2){return[_0x3576f2,!![]];});});}else{throw new Error(_0xdf40('0xc1'));}})[_0xdf40('0xc2')](function(_0x428431,_0x59de76){if(_0x59de76){return _0x428431;}return db[_0xdf40('0xaa')][_0xdf40('0x5b')]({'direction':_0xdf40('0xbf'),'read':![],'body':_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0][_0xdf40('0xc0')],'FaxAccountId':_0x5b7cba['id'],'FaxInteractionId':_0x428431['id'],'UserId':_0x552e8c[_0xdf40('0x5d')]['id'],'ContactId':_0x428431[_0xdf40('0xc3')],'AttachmentId':_0x552e8c[_0xdf40('0x5c')]['attachments'][0x0]['id']})[_0xdf40('0x38')](function(_0x283f3d){_0x428431[_0xdf40('0xc4')][_0xdf40('0xc5')]=[];_0x428431['dataValues'][_0xdf40('0xc5')][_0xdf40('0x94')](_0x283f3d[_0xdf40('0xc4')]);return _0x428431;});})[_0xdf40('0x38')](function(_0x88a865){respondWithRpcPromise(_0xdf40('0xc6'),_0xdf40('0xc6'),{'FaxAccountId':_[_0xdf40('0xb8')](_0x552e8c['params']['id'])?undefined:_0x552e8c[_0xdf40('0x65')]['id'],'path':_[_0xdf40('0xb8')](_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0]['path'])?undefined:_0x552e8c['body']['attachments'][0x0][_0xdf40('0x5')],'fax':_[_0xdf40('0xb8')](_0x552e8c[_0xdf40('0x5c')]['to'][0x0])?undefined:_0x552e8c[_0xdf40('0x5c')]['to'][0x0],'AttachmentId':_0x552e8c[_0xdf40('0x5c')][_0xdf40('0xb2')][0x0]['id']},client9002)[_0xdf40('0x38')](function(_0x18ba50){logger[_0xdf40('0x20')](_0xdf40('0xc7'),_0x18ba50);})[_0xdf40('0x2a')](function(_0x841f87){logger[_0xdf40('0x20')](_0xdf40('0xc7'),_0x841f87);});return _0x88a865;})[_0xdf40('0x38')](respondWithResult(_0xb55865,null))[_0xdf40('0x2a')](handleError(_0xb55865,null));};exports['addAgents']=function(_0x1ec039,_0x31a03e,_0x41e7a2){return db[_0xdf40('0x54')]['find']({'where':{'id':_0x1ec039['params']['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x31a03e,null))['then'](function(_0x502951){if(_0x502951){return _0x502951[_0xdf40('0xc8')](_0x1ec039[_0xdf40('0x5c')]['ids'],_[_0xdf40('0x75')](_0x1ec039['body'],[_0xdf40('0x6e'),'id'])||{})['spread'](function(_0x573f1f){for(var _0x278f64=0x0;_0x278f64<_0x1ec039['body']['ids'][_0xdf40('0x4a')];_0x278f64+=0x1){socket[_0xdf40('0xc9')](_0xdf40('0xca'),{'UserId':Number(_0x1ec039['body'][_0xdf40('0x6e')][_0x278f64]),'FaxAccountId':Number(_0x1ec039[_0xdf40('0x65')]['id'])});}return _0x573f1f;});}})[_0xdf40('0x38')](respondWithResult(_0x31a03e,null))[_0xdf40('0x2a')](handleError(_0x31a03e,null));};exports[_0xdf40('0xcb')]=function(_0x53afa0,_0x1087d9,_0xb97f0){return db[_0xdf40('0x54')]['find']({'where':{'id':_0x53afa0[_0xdf40('0x65')]['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x1087d9,null))[_0xdf40('0x38')](function(_0x18c10a){if(_0x18c10a){return _0x18c10a[_0xdf40('0xcb')](_0x53afa0[_0xdf40('0x45')][_0xdf40('0x6e')])['then'](function(){if(_['isArray'](_0x53afa0[_0xdf40('0x45')][_0xdf40('0x6e')])){for(var _0x1421a3=0x0;_0x1421a3<_0x53afa0['query'][_0xdf40('0x6e')][_0xdf40('0x4a')];_0x1421a3+=0x1){socket[_0xdf40('0xc9')](_0xdf40('0xcc'),{'UserId':Number(_0x53afa0[_0xdf40('0x45')][_0xdf40('0x6e')][_0x1421a3]),'FaxAccountId':Number(_0x53afa0[_0xdf40('0x65')]['id'])});}}else{socket['emit'](_0xdf40('0xcc'),{'UserId':Number(_0x53afa0[_0xdf40('0x45')]['ids']),'FaxAccountId':Number(_0x53afa0['params']['id'])});}});}})[_0xdf40('0x38')](respondWithStatusCode(_0x1087d9,null))[_0xdf40('0x2a')](handleError(_0x1087d9,null));};exports['getAgents']=function(_0x480470,_0x33c29b,_0x194108){var _0x38e7f5={};var _0x222676={};var _0x28aaff;var _0x255255;return db[_0xdf40('0x54')]['findOne']({'where':{'id':_0x480470['params']['id']}})[_0xdf40('0x38')](handleEntityNotFound(_0x33c29b,null))[_0xdf40('0x38')](function(_0x5a5a60){if(_0x5a5a60){_0x28aaff=_0x5a5a60;_0x222676[_0xdf40('0x44')]=_[_0xdf40('0x46')](db[_0xdf40('0x78')][_0xdf40('0x6b')]);_0x222676[_0xdf40('0x45')]=_['keys'](_0x480470[_0xdf40('0x45')]);_0x222676[_0xdf40('0x47')]=_[_0xdf40('0x48')](_0x222676[_0xdf40('0x44')],_0x222676['query']);_0x38e7f5[_0xdf40('0x4b')]=_[_0xdf40('0x48')](_0x222676[_0xdf40('0x44')],qs[_0xdf40('0x49')](_0x480470[_0xdf40('0x45')][_0xdf40('0x49')]));_0x38e7f5[_0xdf40('0x4b')]=_0x38e7f5[_0xdf40('0x4b')][_0xdf40('0x4a')]?_0x38e7f5['attributes']:_0x222676[_0xdf40('0x44')];_0x38e7f5[_0xdf40('0x6c')]=qs['sort'](_0x480470['query']['sort']);_0x38e7f5[_0xdf40('0x4e')]=qs[_0xdf40('0x47')](_[_0xdf40('0x4f')](_0x480470[_0xdf40('0x45')],_0x222676[_0xdf40('0x47')]));if(_0x480470[_0xdf40('0x45')][_0xdf40('0x50')]){_0x38e7f5[_0xdf40('0x4e')]=_[_0xdf40('0x51')](_0x38e7f5[_0xdf40('0x4e')],{'$or':_[_0xdf40('0x40')](_0x38e7f5[_0xdf40('0x4b')],function(_0x2862c9){var _0x2e47d6={};_0x2e47d6[_0x2862c9]={'$like':'%'+_0x480470[_0xdf40('0x45')][_0xdf40('0x50')]+'%'};return _0x2e47d6;})});}_0x38e7f5=_[_0xdf40('0x51')]({},_0x38e7f5,_0x480470[_0xdf40('0x53')]);return _0x28aaff['getAgents'](_0x38e7f5);}})['then'](function(_0x542346){if(_0x542346){_0x255255=_0x542346[_0xdf40('0x4a')];if(!_0x480470[_0xdf40('0x45')][_0xdf40('0x4c')](_0xdf40('0x70'))){_0x38e7f5[_0xdf40('0x31')]=qs[_0xdf40('0x31')](_0x480470['query'][_0xdf40('0x31')]);_0x38e7f5[_0xdf40('0x2e')]=qs['offset'](_0x480470[_0xdf40('0x45')]['offset']);}return _0x28aaff[_0xdf40('0xcd')](_0x38e7f5);}})['then'](function(_0x272379){if(_0x272379){return _0x272379?{'count':_0x255255,'rows':_0x272379}:null;}})[_0xdf40('0x38')](respondWithResult(_0x33c29b,null))[_0xdf40('0x2a')](handleError(_0x33c29b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 246cab9..c950241 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 _0x8066=['save','emit','hasOwnProperty','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x419233,_0x347b77){var _0x456004=function(_0x457b19){while(--_0x457b19){_0x419233['push'](_0x419233['shift']());}};_0x456004(++_0x347b77);}(_0x8066,0x192));var _0x6806=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8066[_0x44bcb0];return _0xfaf881;};'use strict';var EventEmitter=require(_0x6806('0x0'));var FaxAccount=require(_0x6806('0x1'))['db'][_0x6806('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6806('0x3')](0x0);var events={'afterCreate':_0x6806('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47a07a){return function(_0x151056,_0x4ae092,_0xf4be5c){FaxAccountEvents[_0x6806('0x5')](_0x47a07a+':'+_0x151056['id'],_0x151056);FaxAccountEvents[_0x6806('0x5')](_0x47a07a,_0x151056);_0xf4be5c(null);};}for(var e in events){if(events[_0x6806('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x0595=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0595,0xcc));var _0x5059=function(_0x1c6504,_0x1f6128){_0x1c6504=_0x1c6504-0x0;var _0x53669f=_0x0595[_0x1c6504];return _0x53669f;};'use strict';var EventEmitter=require(_0x5059('0x0'));var FaxAccount=require(_0x5059('0x1'))['db'][_0x5059('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5059('0x3')](0x0);var events={'afterCreate':_0x5059('0x4'),'afterUpdate':_0x5059('0x5'),'afterDestroy':_0x5059('0x6')};function emitEvent(_0xb89468){return function(_0x2d4d71,_0x3f1ef1,_0x53d81a){FaxAccountEvents[_0x5059('0x7')](_0xb89468+':'+_0x2d4d71['id'],_0x2d4d71);FaxAccountEvents[_0x5059('0x7')](_0xb89468,_0x2d4d71);_0x53d81a(null);};}for(var e in events){if(events[_0x5059('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x5059('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 4fbfbd5..79b9fcf 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 _0x3a8a=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x48d427,_0x46e157){var _0x546ec9=function(_0x4f2d9d){while(--_0x4f2d9d){_0x48d427['push'](_0x48d427['shift']());}};_0x546ec9(++_0x46e157);}(_0x3a8a,0x8b));var _0xa3a8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3a8a[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3a8('0x0'))('api');var moment=require(_0xa3a8('0x1'));var BPromise=require(_0xa3a8('0x2'));var rp=require(_0xa3a8('0x3'));var fs=require('fs');var path=require(_0xa3a8('0x4'));var rimraf=require(_0xa3a8('0x5'));var config=require(_0xa3a8('0x6'));var attributes=require(_0xa3a8('0x7'));module[_0xa3a8('0x8')]=function(_0x3adfea,_0x567a34){return _0x3adfea[_0xa3a8('0x9')](_0xa3a8('0xa'),attributes,{'tableName':_0xa3a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf64d=['exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxAccount.attributes'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xf64d,0x142));var _0xdf64=function(_0xb6da2d,_0x9dbbba){_0xb6da2d=_0xb6da2d-0x0;var _0x155572=_0xf64d[_0xb6da2d];return _0x155572;};'use strict';var _=require(_0xdf64('0x0'));var util=require(_0xdf64('0x1'));var logger=require(_0xdf64('0x2'))(_0xdf64('0x3'));var moment=require(_0xdf64('0x4'));var BPromise=require(_0xdf64('0x5'));var rp=require(_0xdf64('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdf64('0x7'));module[_0xdf64('0x8')]=function(_0x130e86,_0x22e28c){return _0x130e86['define'](_0xdf64('0x9'),attributes,{'tableName':_0xdf64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 3dcc313..d2d1ed4 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 _0xa65f=['Contacts','DESC','get','applications','Applications','orderBy','priority','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','name','UserId','agent','waitForTheAssignedAgent','queueId','queue','Start','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','body','fax','describe','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','find','account','List','CmContact'];(function(_0x3b29ce,_0x13de5f){var _0x57b233=function(_0x5e4248){while(--_0x5e4248){_0x3b29ce['push'](_0x3b29ce['shift']());}};_0x57b233(++_0x13de5f);}(_0xa65f,0x78));var _0xfa65=function(_0x58ef8a,_0x4bdc28){_0x58ef8a=_0x58ef8a-0x0;var _0x553ac1=_0xa65f[_0x58ef8a];return _0x553ac1;};'use strict';var _=require(_0xfa65('0x0'));var util=require(_0xfa65('0x1'));var moment=require('moment');var BPromise=require(_0xfa65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa65('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa65('0x4'));var logger=require(_0xfa65('0x5'))(_0xfa65('0x6'));var config=require(_0xfa65('0x7'));var jayson=require(_0xfa65('0x8'));var client=jayson[_0xfa65('0x9')][_0xfa65('0xa')]({'port':0x232c});config[_0xfa65('0xb')]=_['defaults'](config['redis'],{'host':_0xfa65('0xc'),'port':0x18eb});var socket=require(_0xfa65('0xd'))(new Redis(config[_0xfa65('0xb')]));require(_0xfa65('0xe'))[_0xfa65('0xf')](socket);function respondWithRpcPromise(_0x9d2d19,_0x7908be,_0xb2ebf){return new BPromise(function(_0xf8203f,_0x2a789f){return client[_0xfa65('0x10')](_0x9d2d19,_0xb2ebf)[_0xfa65('0x11')](function(_0x178440){logger[_0xfa65('0x12')]('FaxAccount,\x20%s,\x20%s',_0x7908be,_0xfa65('0x13'));logger[_0xfa65('0x14')](_0xfa65('0x15'),_0x7908be,_0xfa65('0x13'),JSON[_0xfa65('0x16')](_0x178440));if(_0x178440[_0xfa65('0x17')]){if(_0x178440[_0xfa65('0x17')]['code']===0x1f4){logger['error'](_0xfa65('0x18'),_0x7908be,_0x178440[_0xfa65('0x17')][_0xfa65('0x19')]);return _0x2a789f(_0x178440[_0xfa65('0x17')]['message']);}logger[_0xfa65('0x17')]('FaxAccount,\x20%s,\x20%s',_0x7908be,_0x178440['error'][_0xfa65('0x19')]);return _0xf8203f(_0x178440[_0xfa65('0x17')][_0xfa65('0x19')]);}else{logger[_0xfa65('0x12')](_0xfa65('0x18'),_0x7908be,'request\x20sent');_0xf8203f(_0x178440[_0xfa65('0x1a')][_0xfa65('0x19')]);}})[_0xfa65('0x1b')](function(_0x644a38){logger[_0xfa65('0x17')]('FaxAccount,\x20%s,\x20%s',_0x7908be,_0x644a38);_0x2a789f(_0x644a38);});});}exports[_0xfa65('0x1c')]=function(_0xad02be){var _0x15830d=this;return new Promise(function(_0x1b6ef2,_0xadaba9){return db[_0xfa65('0x1d')][_0xfa65('0x1e')]({'raw':_0xad02be['options']?_0xad02be[_0xfa65('0x1f')][_0xfa65('0x20')]===undefined?!![]:![]:!![],'where':_0xad02be[_0xfa65('0x1f')]?_0xad02be[_0xfa65('0x1f')][_0xfa65('0x21')]||null:null,'attributes':_0xad02be[_0xfa65('0x1f')]?_0xad02be[_0xfa65('0x1f')][_0xfa65('0x22')]||null:null,'limit':_0xad02be[_0xfa65('0x1f')]?_0xad02be['options'][_0xfa65('0x23')]||null:null,'include':_0xad02be['options']?_0xad02be['options'][_0xfa65('0x24')]?_[_0xfa65('0x25')](_0xad02be['options'][_0xfa65('0x24')],function(_0x2216cd){return{'model':db[_0x2216cd['model']],'as':_0x2216cd['as'],'attributes':_0x2216cd[_0xfa65('0x22')],'include':_0x2216cd[_0xfa65('0x24')]?_[_0xfa65('0x25')](_0x2216cd['include'],function(_0x7701c3){return{'model':db[_0x7701c3['model']],'as':_0x7701c3['as'],'attributes':_0x7701c3[_0xfa65('0x22')],'include':_0x7701c3[_0xfa65('0x24')]?_[_0xfa65('0x25')](_0x7701c3['include'],function(_0x347999){return{'model':db[_0x347999[_0xfa65('0x26')]],'as':_0x347999['as'],'attributes':_0x347999[_0xfa65('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfa65('0x11')](function(_0x3738f2){logger[_0xfa65('0x12')](_0xfa65('0x1c'),_0xad02be);logger[_0xfa65('0x14')](_0xfa65('0x1c'),_0xad02be,JSON['stringify'](_0x3738f2));_0x1b6ef2(_0x3738f2);})[_0xfa65('0x1b')](function(_0x18165f){logger['error']('GetFaxAccount',_0x18165f['message'],_0xad02be);_0xadaba9(_0x15830d[_0xfa65('0x17')](0x1f4,_0x18165f['message']));});});};exports['NotifyFaxAccount']=function(_0x7d2e19,_0x26a124,_0x5a9ff5){var _0x33b09e=this;return new Promise(function(_0x3026b7,_0x549204){var _0x494507={'body':_0x7d2e19[_0xfa65('0x27')],'channel':_0xfa65('0x28')};var _0x341e38=[];var _0x2127dd=[];var _0x1668ac={};return db['CmContact'][_0xfa65('0x29')]()['then'](function(_0x260727){if(!_0x260727){throw new db['Sequelize'][(_0xfa65('0x2a'))](_0xfa65('0x2b'));}_0x341e38=_['difference'](_[_0xfa65('0x2c')](_0x260727),[_0xfa65('0x2d'),'updatedAt']);_0x2127dd=_['difference'](_[_0xfa65('0x2c')](_0x260727),[_0xfa65('0x2d'),_0xfa65('0x2e'),_0xfa65('0x2f'),_0xfa65('0x30')]);if(_0x7d2e19['body']['id']){delete _0x7d2e19['body']['id'];}if(_[_0xfa65('0x31')](_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x32')])){throw new db[(_0xfa65('0x33'))][(_0xfa65('0x2a'))](_0xfa65('0x34'));}if(_[_0xfa65('0x31')](_0x7d2e19[_0xfa65('0x27')]['body'])||_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x27')]===''){throw new db[(_0xfa65('0x33'))][(_0xfa65('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfa65('0x31')](_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x35')])){throw new db[(_0xfa65('0x33'))][(_0xfa65('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2127dd);}if(!_['includes'](_0x2127dd,_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x35')])){throw new db[(_0xfa65('0x33'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2127dd);}_0x1668ac[_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x35')]]=_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x32')];})[_0xfa65('0x11')](function(){return db[_0xfa65('0x1d')][_0xfa65('0x36')]({'where':{'id':_0x7d2e19[_0xfa65('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xfa65('0x38'),'include':[{'model':db[_0xfa65('0x39')],'as':_0xfa65('0x3a'),'where':_0x1668ac,'limit':0x1,'order':[[_0xfa65('0x2e'),_0xfa65('0x3b')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xfa65('0x11')](function(_0x160918){if(_0x160918&&_0x160918[_0xfa65('0x38')]){var _0x393894=_0x160918[_0xfa65('0x3c')]({'plain':!![]});_0x494507[_0xfa65('0x37')]=_0x393894;_0x494507[_0xfa65('0x3d')]=_0x393894[_0xfa65('0x3e')];_0x494507['list']=_0x393894['List'];_0x494507['applications']=_[_0xfa65('0x3f')](_0x494507[_0xfa65('0x3d')],[_0xfa65('0x40')],[_0xfa65('0x41')]);if(_0x494507['account']['Applications']){delete _0x494507[_0xfa65('0x37')][_0xfa65('0x3e')];}if(_0x494507[_0xfa65('0x37')]['List']&&_0x494507[_0xfa65('0x37')][_0xfa65('0x38')][_0xfa65('0x3a')][_0xfa65('0x42')]){return _0x494507[_0xfa65('0x37')][_0xfa65('0x38')][_0xfa65('0x3a')][0x0];}var _0x2fd8e2=_[_0xfa65('0x43')](_0x7d2e19[_0xfa65('0x27')],{'firstName':_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x32')],'ListId':_0x393894[_0xfa65('0x30')]});_0x2fd8e2[_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x35')]]=_0x7d2e19['body'][_0xfa65('0x32')];return db['CmContact'][_0xfa65('0x44')](_0x2fd8e2,{'fields':_0x341e38,'raw':!![]});}})[_0xfa65('0x11')](function(_0x10ad47){_0x494507[_0xfa65('0x45')]=_0x10ad47;if(_0x10ad47){var _0x51b193={'ContactId':_0x10ad47['id'],'FaxAccountId':_0x7d2e19[_0xfa65('0x37')]['id'],'fax':_0x10ad47[_0xfa65('0x28')]};return db[_0xfa65('0x46')][_0xfa65('0x36')]({'where':{'ContactId':_0x10ad47['id'],'closed':![],'FaxAccountId':_0x7d2e19['account']['id']}})[_0xfa65('0x11')](function(_0x4f3e5c){if(_0x4f3e5c){return[_0x4f3e5c,![]];}return db[_0xfa65('0x46')][_0xfa65('0x44')](_0x51b193)[_0xfa65('0x11')](function(_0xc5d222){return[_0xc5d222,!![]];});});}else{throw new Error(_0xfa65('0x47'));}})[_0xfa65('0x48')](function(_0x5ae3b5,_0x1e14df){var _0x3f5f6a=_0x5ae3b5[_0xfa65('0x3c')]({'plain':!![]});if(_0x1e14df){if(_0x494507['account'][_0xfa65('0x49')]){_0x494507['applications'][_0xfa65('0x4a')]({'id':0x0,'priority':_0x494507['applications']['length']+0x1,'app':_0xfa65('0x4b'),'appdata':_0xfa65('0x4c'),'interval':_0xfa65('0x4d')});}_0x3f5f6a[_0xfa65('0x4e')]=!![];}else{_0x3f5f6a[_0xfa65('0x4e')]=![];}_0x494507['interaction']=_0x3f5f6a;return db[_0xfa65('0x4f')][_0xfa65('0x44')]({'body':_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x27')],'FaxAccountId':_0x7d2e19[_0xfa65('0x37')]['id'],'FaxInteractionId':_0x5ae3b5['id'],'direction':'in','ContactId':_0x5ae3b5['ContactId'],'AttachmentId':_0x7d2e19[_0xfa65('0x27')][_0xfa65('0x50')]});})[_0xfa65('0x11')](function(_0x731775){_0x494507[_0xfa65('0x19')]=_0x731775;if(!_0x494507[_0xfa65('0x51')]['UserId'])return;return db['User'][_0xfa65('0x36')]({'attributes':['id',_0xfa65('0x52')],'where':{'id':_0x494507[_0xfa65('0x51')][_0xfa65('0x53')]}});})[_0xfa65('0x11')](function(_0x599459){if(_0x599459){_0x494507[_0xfa65('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xfa65('0x54'),'appdata':_0x599459[_0xfa65('0x52')]+','+(_0x494507['account'][_0xfa65('0x55')]||0xa),'interval':_0xfa65('0x4d')});}if(!_0x494507[_0xfa65('0x51')][_0xfa65('0x56')])return;return db['FaxQueue'][_0xfa65('0x36')]({'attributes':['id','name'],'where':{'id':_0x494507['interaction']['queueId']}});})[_0xfa65('0x11')](function(_0x29a128){if(_0x29a128){_0x494507[_0xfa65('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0xfa65('0x57'),'appdata':_0x29a128['name']+','+(_0x494507[_0xfa65('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':_0xfa65('0x4d')});}return respondWithRpcPromise(_0xfa65('0x58'),'startRouting',_0x494507);})[_0xfa65('0x11')](function(_0x1964ce){_0x3026b7(_0x1964ce);})[_0xfa65('0x1b')](function(_0x10eca2){_0x549204(_0x33b09e[_0xfa65('0x17')](0x1f4,_0x10eca2[_0xfa65('0x19')]));});});}; \ No newline at end of file +var _0x628c=['account','CmList','List','Contacts','DESC','Applications','get','applications','orderBy','priority','asc','length','create','FaxInteraction','spread','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','queueId','queue','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','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','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find'];(function(_0x5b3530,_0x11a7f8){var _0x8d2ac8=function(_0x3383bd){while(--_0x3383bd){_0x5b3530['push'](_0x5b3530['shift']());}};_0x8d2ac8(++_0x11a7f8);}(_0x628c,0x18d));var _0xc628=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x628c[_0x3dc538];return _0x72c2fd;};'use strict';var _=require('lodash');var util=require(_0xc628('0x0'));var moment=require(_0xc628('0x1'));var BPromise=require(_0xc628('0x2'));var rs=require(_0xc628('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc628('0x4'))['db'];var utils=require(_0xc628('0x5'));var logger=require(_0xc628('0x6'))(_0xc628('0x7'));var config=require('../../config/environment');var jayson=require(_0xc628('0x8'));var client=jayson[_0xc628('0x9')][_0xc628('0xa')]({'port':0x232c});config[_0xc628('0xb')]=_[_0xc628('0xc')](config[_0xc628('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc628('0xd'))(new Redis(config['redis']));require(_0xc628('0xe'))[_0xc628('0xf')](socket);function respondWithRpcPromise(_0x52583f,_0x34bdb7,_0x141f51){return new BPromise(function(_0x269055,_0x355020){return client['request'](_0x52583f,_0x141f51)[_0xc628('0x10')](function(_0x6faa26){logger[_0xc628('0x11')](_0xc628('0x12'),_0x34bdb7,_0xc628('0x13'));logger[_0xc628('0x14')](_0xc628('0x15'),_0x34bdb7,_0xc628('0x13'),JSON['stringify'](_0x6faa26));if(_0x6faa26[_0xc628('0x16')]){if(_0x6faa26['error'][_0xc628('0x17')]===0x1f4){logger['error'](_0xc628('0x12'),_0x34bdb7,_0x6faa26[_0xc628('0x16')][_0xc628('0x18')]);return _0x355020(_0x6faa26[_0xc628('0x16')][_0xc628('0x18')]);}logger[_0xc628('0x16')](_0xc628('0x12'),_0x34bdb7,_0x6faa26[_0xc628('0x16')]['message']);return _0x269055(_0x6faa26[_0xc628('0x16')]['message']);}else{logger[_0xc628('0x11')]('FaxAccount,\x20%s,\x20%s',_0x34bdb7,'request\x20sent');_0x269055(_0x6faa26[_0xc628('0x19')][_0xc628('0x18')]);}})['catch'](function(_0x38b913){logger[_0xc628('0x16')](_0xc628('0x12'),_0x34bdb7,_0x38b913);_0x355020(_0x38b913);});});}exports[_0xc628('0x1a')]=function(_0x5cad5d){var _0x5d6daa=this;return new Promise(function(_0xf292ac,_0x29b3c9){return db[_0xc628('0x1b')][_0xc628('0x1c')]({'raw':_0x5cad5d[_0xc628('0x1d')]?_0x5cad5d[_0xc628('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5cad5d[_0xc628('0x1d')]?_0x5cad5d[_0xc628('0x1d')][_0xc628('0x1e')]||null:null,'attributes':_0x5cad5d[_0xc628('0x1d')]?_0x5cad5d[_0xc628('0x1d')][_0xc628('0x1f')]||null:null,'limit':_0x5cad5d[_0xc628('0x1d')]?_0x5cad5d[_0xc628('0x1d')][_0xc628('0x20')]||null:null,'include':_0x5cad5d[_0xc628('0x1d')]?_0x5cad5d[_0xc628('0x1d')][_0xc628('0x21')]?_[_0xc628('0x22')](_0x5cad5d[_0xc628('0x1d')][_0xc628('0x21')],function(_0x453e37){return{'model':db[_0x453e37[_0xc628('0x23')]],'as':_0x453e37['as'],'attributes':_0x453e37[_0xc628('0x1f')],'include':_0x453e37[_0xc628('0x21')]?_[_0xc628('0x22')](_0x453e37[_0xc628('0x21')],function(_0x5db6d5){return{'model':db[_0x5db6d5[_0xc628('0x23')]],'as':_0x5db6d5['as'],'attributes':_0x5db6d5[_0xc628('0x1f')],'include':_0x5db6d5[_0xc628('0x21')]?_['map'](_0x5db6d5[_0xc628('0x21')],function(_0x6ddef){return{'model':db[_0x6ddef[_0xc628('0x23')]],'as':_0x6ddef['as'],'attributes':_0x6ddef[_0xc628('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc628('0x10')](function(_0x10bb84){logger[_0xc628('0x11')](_0xc628('0x1a'),_0x5cad5d);logger[_0xc628('0x14')](_0xc628('0x1a'),_0x5cad5d,JSON['stringify'](_0x10bb84));_0xf292ac(_0x10bb84);})[_0xc628('0x24')](function(_0x42dfa4){logger['error']('GetFaxAccount',_0x42dfa4['message'],_0x5cad5d);_0x29b3c9(_0x5d6daa['error'](0x1f4,_0x42dfa4[_0xc628('0x18')]));});});};exports[_0xc628('0x25')]=function(_0x4cf949,_0x52f489,_0x1b7fdd){var _0x3e966d=this;return new Promise(function(_0x35c565,_0x45765d){var _0x3d9540={'body':_0x4cf949[_0xc628('0x26')],'channel':_0xc628('0x27')};var _0x1ff6e5=[];var _0x3cb882=[];var _0x5ab1ed={};return db[_0xc628('0x28')][_0xc628('0x29')]()[_0xc628('0x10')](function(_0x3f2676){if(!_0x3f2676){throw new db[(_0xc628('0x2a'))][(_0xc628('0x2b'))]('no\x20available\x20attributes');}_0x1ff6e5=_[_0xc628('0x2c')](_[_0xc628('0x2d')](_0x3f2676),[_0xc628('0x2e'),_0xc628('0x2f')]);_0x3cb882=_[_0xc628('0x2c')](_['keys'](_0x3f2676),[_0xc628('0x2e'),_0xc628('0x2f'),_0xc628('0x30'),_0xc628('0x31')]);if(_0x4cf949[_0xc628('0x26')]['id']){delete _0x4cf949[_0xc628('0x26')]['id'];}if(_[_0xc628('0x32')](_0x4cf949[_0xc628('0x26')][_0xc628('0x33')])){throw new db[(_0xc628('0x2a'))]['ValidationError'](_0xc628('0x34'));}if(_[_0xc628('0x32')](_0x4cf949[_0xc628('0x26')][_0xc628('0x26')])||_0x4cf949[_0xc628('0x26')]['body']===''){throw new db[(_0xc628('0x2a'))][(_0xc628('0x2b'))](_0xc628('0x35'));}if(_[_0xc628('0x32')](_0x4cf949['body'][_0xc628('0x36')])){throw new db[(_0xc628('0x2a'))][(_0xc628('0x2b'))](_0xc628('0x37')+_0x3cb882);}if(!_[_0xc628('0x38')](_0x3cb882,_0x4cf949[_0xc628('0x26')]['mapKey'])){throw new db[(_0xc628('0x2a'))][(_0xc628('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb882);}_0x5ab1ed[_0x4cf949[_0xc628('0x26')]['mapKey']]=_0x4cf949[_0xc628('0x26')][_0xc628('0x33')];})[_0xc628('0x10')](function(){return db[_0xc628('0x1b')][_0xc628('0x39')]({'where':{'id':_0x4cf949[_0xc628('0x3a')]['id']},'include':[{'model':db[_0xc628('0x3b')],'as':_0xc628('0x3c'),'include':[{'model':db[_0xc628('0x28')],'as':_0xc628('0x3d'),'where':_0x5ab1ed,'limit':0x1,'order':[[_0xc628('0x2f'),_0xc628('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0xc628('0x3f')}]});})[_0xc628('0x10')](function(_0x444fb1){if(_0x444fb1&&_0x444fb1[_0xc628('0x3c')]){var _0x1ca7b3=_0x444fb1[_0xc628('0x40')]({'plain':!![]});_0x3d9540[_0xc628('0x3a')]=_0x1ca7b3;_0x3d9540[_0xc628('0x41')]=_0x1ca7b3[_0xc628('0x3f')];_0x3d9540['list']=_0x1ca7b3[_0xc628('0x3c')];_0x3d9540[_0xc628('0x41')]=_[_0xc628('0x42')](_0x3d9540[_0xc628('0x41')],[_0xc628('0x43')],[_0xc628('0x44')]);if(_0x3d9540[_0xc628('0x3a')][_0xc628('0x3f')]){delete _0x3d9540[_0xc628('0x3a')]['Applications'];}if(_0x3d9540['account']['List']&&_0x3d9540[_0xc628('0x3a')][_0xc628('0x3c')][_0xc628('0x3d')][_0xc628('0x45')]){return _0x3d9540[_0xc628('0x3a')][_0xc628('0x3c')]['Contacts'][0x0];}var _0x390f31=_['defaults'](_0x4cf949[_0xc628('0x26')],{'firstName':_0x4cf949[_0xc628('0x26')][_0xc628('0x33')],'ListId':_0x1ca7b3[_0xc628('0x31')]});_0x390f31[_0x4cf949['body'][_0xc628('0x36')]]=_0x4cf949[_0xc628('0x26')]['from'];return db[_0xc628('0x28')][_0xc628('0x46')](_0x390f31,{'fields':_0x1ff6e5,'raw':!![]});}})['then'](function(_0x2b7016){_0x3d9540['contact']=_0x2b7016;if(_0x2b7016){var _0x1d2bea={'ContactId':_0x2b7016['id'],'FaxAccountId':_0x4cf949[_0xc628('0x3a')]['id'],'fax':_0x2b7016[_0xc628('0x27')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2b7016['id'],'closed':![],'FaxAccountId':_0x4cf949['account']['id']}})[_0xc628('0x10')](function(_0xddd628){if(_0xddd628){return[_0xddd628,![]];}return db[_0xc628('0x47')][_0xc628('0x46')](_0x1d2bea)['then'](function(_0x2a98f7){return[_0x2a98f7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc628('0x48')](function(_0x2843f2,_0x504e42){var _0x3a5e00=_0x2843f2['get']({'plain':!![]});if(_0x504e42){if(_0x3d9540[_0xc628('0x3a')]['autoclose']){_0x3d9540[_0xc628('0x41')][_0xc628('0x49')]({'id':0x0,'priority':_0x3d9540[_0xc628('0x41')][_0xc628('0x45')]+0x1,'app':_0xc628('0x4a'),'appdata':_0xc628('0x4b'),'interval':_0xc628('0x4c')});}_0x3a5e00[_0xc628('0x4d')]=!![];}else{_0x3a5e00[_0xc628('0x4d')]=![];}_0x3d9540[_0xc628('0x4e')]=_0x3a5e00;return db[_0xc628('0x4f')][_0xc628('0x46')]({'body':_0x4cf949[_0xc628('0x26')][_0xc628('0x26')],'FaxAccountId':_0x4cf949[_0xc628('0x3a')]['id'],'FaxInteractionId':_0x2843f2['id'],'direction':'in','ContactId':_0x2843f2[_0xc628('0x50')],'AttachmentId':_0x4cf949[_0xc628('0x26')][_0xc628('0x51')]});})[_0xc628('0x10')](function(_0x2467d9){_0x3d9540[_0xc628('0x18')]=_0x2467d9;if(!_0x3d9540[_0xc628('0x4e')]['UserId'])return;return db[_0xc628('0x52')][_0xc628('0x39')]({'attributes':['id',_0xc628('0x53')],'where':{'id':_0x3d9540['interaction'][_0xc628('0x54')]}});})[_0xc628('0x10')](function(_0x5cd6e6){if(_0x5cd6e6){_0x3d9540[_0xc628('0x41')][_0xc628('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5cd6e6[_0xc628('0x53')]+','+(_0x3d9540[_0xc628('0x3a')][_0xc628('0x56')]||0xa),'interval':'*,*,*,*'});}if(!_0x3d9540['interaction'][_0xc628('0x57')])return;return db['FaxQueue'][_0xc628('0x39')]({'attributes':['id',_0xc628('0x53')],'where':{'id':_0x3d9540[_0xc628('0x4e')][_0xc628('0x57')]}});})['then'](function(_0x201077){if(_0x201077){_0x3d9540[_0xc628('0x41')][_0xc628('0x55')]({'id':0x0,'priority':0x1,'app':_0xc628('0x58'),'appdata':_0x201077[_0xc628('0x53')]+','+(_0x3d9540[_0xc628('0x3a')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc628('0x4c')});}return respondWithRpcPromise(_0xc628('0x59'),_0xc628('0x5a'),_0x3d9540);})[_0xc628('0x10')](function(_0x1b1acd){_0x35c565(_0x1b1acd);})[_0xc628('0x24')](function(_0xad543a){_0x45765d(_0x3e966d[_0xc628('0x16')](0x1f4,_0xad543a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index eb4bcc2..705bc19 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 _0xd8bd=['save','update','register','length','./faxAccount.events'];(function(_0x34955c,_0x42c240){var _0x250437=function(_0x2626f){while(--_0x2626f){_0x34955c['push'](_0x34955c['shift']());}};_0x250437(++_0x42c240);}(_0xd8bd,0x1ad));var _0xdd8b=function(_0x5aa13f,_0x3c7af4){_0x5aa13f=_0x5aa13f-0x0;var _0x2dcd86=_0xd8bd[_0x5aa13f];return _0x2dcd86;};'use strict';var FaxAccountEvents=require(_0xdd8b('0x0'));var events=[_0xdd8b('0x1'),'remove',_0xdd8b('0x2')];function createListener(_0x5e8820,_0xed5e53){return function(_0x359a41){_0xed5e53['emit'](_0x5e8820,_0x359a41);};}function removeListener(_0x536362,_0x2ef3eb){return function(){FaxAccountEvents['removeListener'](_0x536362,_0x2ef3eb);};}exports[_0xdd8b('0x3')]=function(_0x2c573a){for(var _0x4dc663=0x0,_0x146237=events[_0xdd8b('0x4')];_0x4dc663<_0x146237;_0x4dc663++){var _0x508528=events[_0x4dc663];var _0x2e4c40=createListener('faxAccount:'+_0x508528,_0x2c573a);FaxAccountEvents['on'](_0x508528,_0x2e4c40);}}; \ No newline at end of file +var _0x1c76=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x54a022,_0x186069){var _0x5d547e=function(_0x319c12){while(--_0x319c12){_0x54a022['push'](_0x54a022['shift']());}};_0x5d547e(++_0x186069);}(_0x1c76,0x17e));var _0x61c7=function(_0x2c0533,_0x48ba01){_0x2c0533=_0x2c0533-0x0;var _0x314ff9=_0x1c76[_0x2c0533];return _0x314ff9;};'use strict';var FaxAccountEvents=require(_0x61c7('0x0'));var events=[_0x61c7('0x1'),_0x61c7('0x2'),_0x61c7('0x3')];function createListener(_0x4db26a,_0x98d5c5){return function(_0x4fd1b4){_0x98d5c5[_0x61c7('0x4')](_0x4db26a,_0x4fd1b4);};}function removeListener(_0x384a84,_0x437ab4){return function(){FaxAccountEvents[_0x61c7('0x5')](_0x384a84,_0x437ab4);};}exports[_0x61c7('0x6')]=function(_0x36e793){for(var _0x435f1a=0x0,_0x5622ce=events[_0x61c7('0x7')];_0x435f1a<_0x5622ce;_0x435f1a++){var _0x53a316=events[_0x435f1a];var _0x1edcaf=createListener(_0x61c7('0x8')+_0x53a316,_0x36e793);FaxAccountEvents['on'](_0x53a316,_0x1edcaf);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index af61019..1f0f3a0 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 _0xc591=['getApplications','/:id/messages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications'];(function(_0x140b5f,_0x294a2c){var _0x4920d0=function(_0x196d28){while(--_0x196d28){_0x140b5f['push'](_0x140b5f['shift']());}};_0x4920d0(++_0x294a2c);}(_0xc591,0x15f));var _0x1c59=function(_0x106db6,_0xd6decc){_0x106db6=_0x106db6-0x0;var _0x4dc175=_0xc591[_0x106db6];return _0x4dc175;};'use strict';var multer=require(_0x1c59('0x0'));var util=require(_0x1c59('0x1'));var path=require(_0x1c59('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1c59('0x3'));var auth=require(_0x1c59('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1c59('0x5'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0x1c59('0x6')](),controller['index']);router[_0x1c59('0x7')](_0x1c59('0x8'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x9')]);router[_0x1c59('0x7')](_0x1c59('0xa'),auth[_0x1c59('0x6')](),controller[_0x1c59('0xb')]);router[_0x1c59('0x7')]('/:id/dispositions',auth[_0x1c59('0x6')](),controller[_0x1c59('0xc')]);router['get'](_0x1c59('0xd'),auth[_0x1c59('0x6')](),controller[_0x1c59('0xe')]);router[_0x1c59('0x7')](_0x1c59('0xf'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x10')]);router[_0x1c59('0x7')](_0x1c59('0x11'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x12')]);router['get'](_0x1c59('0x13'),auth[_0x1c59('0x6')](),controller['getMessages']);router[_0x1c59('0x7')](_0x1c59('0x14'),auth[_0x1c59('0x6')](),controller['getAgents']);router[_0x1c59('0x15')]('/',auth[_0x1c59('0x6')](),controller[_0x1c59('0x16')]);router[_0x1c59('0x15')]('/:id/dispositions',auth[_0x1c59('0x6')](),controller[_0x1c59('0x17')]);router[_0x1c59('0x15')](_0x1c59('0xd'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x18')]);router[_0x1c59('0x15')](_0x1c59('0xf'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x19')]);router[_0x1c59('0x15')](_0x1c59('0x11'),auth['isAuthenticated'](),controller[_0x1c59('0x1a')]);router[_0x1c59('0x15')](_0x1c59('0x1b'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x1c')]);router[_0x1c59('0x15')]('/updateaccountapplications',auth[_0x1c59('0x6')](),controller[_0x1c59('0x1d')]);router[_0x1c59('0x15')](_0x1c59('0x1e'),auth['isAuthenticated'](),controller[_0x1c59('0x1f')]);router[_0x1c59('0x15')](_0x1c59('0x14'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x20')]);router[_0x1c59('0x21')](_0x1c59('0xa'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x22')]);router['delete'](_0x1c59('0xa'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x23')]);router[_0x1c59('0x24')]('/:id/dispositions',auth[_0x1c59('0x6')](),controller[_0x1c59('0x25')]);router['delete'](_0x1c59('0xd'),auth['isAuthenticated'](),controller[_0x1c59('0x26')]);router['delete'](_0x1c59('0x14'),auth[_0x1c59('0x6')](),controller[_0x1c59('0x27')]);module[_0x1c59('0x28')]=router; \ No newline at end of file +var _0x43c7=['getMessages','/:id/users','getAgents','create','post','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x43c7,0xc1));var _0x743c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x43c7[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x743c('0x0'));var util=require('util');var path=require(_0x743c('0x1'));var timeout=require(_0x743c('0x2'));var express=require(_0x743c('0x3'));var router=express[_0x743c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x743c('0x5'));var interaction=require(_0x743c('0x6'));var config=require(_0x743c('0x7'));var controller=require(_0x743c('0x8'));router[_0x743c('0x9')]('/',auth[_0x743c('0xa')](),controller['index']);router[_0x743c('0x9')](_0x743c('0xb'),auth[_0x743c('0xa')](),controller[_0x743c('0xc')]);router[_0x743c('0x9')](_0x743c('0xd'),auth[_0x743c('0xa')](),controller['show']);router['get']('/:id/dispositions',auth[_0x743c('0xa')](),controller[_0x743c('0xe')]);router[_0x743c('0x9')](_0x743c('0xf'),auth[_0x743c('0xa')](),controller[_0x743c('0x10')]);router[_0x743c('0x9')](_0x743c('0x11'),auth['isAuthenticated'](),controller[_0x743c('0x12')]);router[_0x743c('0x9')](_0x743c('0x13'),auth[_0x743c('0xa')](),controller[_0x743c('0x14')]);router[_0x743c('0x9')](_0x743c('0x15'),auth[_0x743c('0xa')](),controller[_0x743c('0x16')]);router[_0x743c('0x9')](_0x743c('0x17'),auth[_0x743c('0xa')](),controller[_0x743c('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0x743c('0x19')]);router[_0x743c('0x1a')]('/:id/dispositions',auth[_0x743c('0xa')](),controller['addDisposition']);router['post'](_0x743c('0xf'),auth[_0x743c('0xa')](),controller[_0x743c('0x1b')]);router['post']('/:id/interactions',auth[_0x743c('0xa')](),controller['addInteraction']);router[_0x743c('0x1a')](_0x743c('0x13'),auth[_0x743c('0xa')](),controller[_0x743c('0x1c')]);router[_0x743c('0x1a')](_0x743c('0x1d'),auth[_0x743c('0xa')](),controller[_0x743c('0x1e')]);router['post'](_0x743c('0x1f'),auth[_0x743c('0xa')](),controller[_0x743c('0x20')]);router[_0x743c('0x1a')]('/:id/send',auth[_0x743c('0xa')](),controller['send']);router['post'](_0x743c('0x17'),auth[_0x743c('0xa')](),controller[_0x743c('0x21')]);router[_0x743c('0x22')]('/:id',auth[_0x743c('0xa')](),controller[_0x743c('0x23')]);router[_0x743c('0x24')](_0x743c('0xd'),auth[_0x743c('0xa')](),controller[_0x743c('0x25')]);router[_0x743c('0x24')](_0x743c('0x26'),auth[_0x743c('0xa')](),controller[_0x743c('0x27')]);router[_0x743c('0x24')](_0x743c('0xf'),auth['isAuthenticated'](),controller[_0x743c('0x28')]);router[_0x743c('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x743c('0x29')]);module[_0x743c('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 3807310..5b738e9 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 _0x50c2=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x3528f5,_0x58733a){var _0x584204=function(_0x1a52d5){while(--_0x1a52d5){_0x3528f5['push'](_0x3528f5['shift']());}};_0x584204(++_0x58733a);}(_0x50c2,0x127));var _0x250c=function(_0x948313,_0x5c8c9a){_0x948313=_0x948313-0x0;var _0x407863=_0x50c2[_0x948313];return _0x407863;};'use strict';var Sequelize=require('sequelize');module[_0x250c('0x0')]={'priority':{'type':Sequelize[_0x250c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x250c('0x2')],'allowNull':![],'defaultValue':_0x250c('0x3')},'appdata':{'type':Sequelize[_0x250c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3adf=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x1994bd,_0xc58820){var _0x1a0030=function(_0xf53ef8){while(--_0xf53ef8){_0x1994bd['push'](_0x1994bd['shift']());}};_0x1a0030(++_0xc58820);}(_0x3adf,0x17f));var _0xf3ad=function(_0x5cd4e1,_0x4d7035){_0x5cd4e1=_0x5cd4e1-0x0;var _0x2ac465=_0x3adf[_0x5cd4e1];return _0x2ac465;};'use strict';var Sequelize=require('sequelize');module[_0xf3ad('0x0')]={'priority':{'type':Sequelize[_0xf3ad('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf3ad('0x2')],'allowNull':![],'defaultValue':_0xf3ad('0x3')},'appdata':{'type':Sequelize[_0xf3ad('0x4')]()},'description':{'type':Sequelize[_0xf3ad('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf3ad('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6114157..200617a 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 _0x9485=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','include','options','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x161bc5,_0x3094db){var _0x29f58b=function(_0x4c5f15){while(--_0x4c5f15){_0x161bc5['push'](_0x161bc5['shift']());}};_0x29f58b(++_0x3094db);}(_0x9485,0x1c6));var _0x5948=function(_0x6c24c0,_0x1351ce){_0x6c24c0=_0x6c24c0-0x0;var _0x156cf9=_0x9485[_0x6c24c0];return _0x156cf9;};'use strict';var emlformat=require(_0x5948('0x0'));var rimraf=require(_0x5948('0x1'));var zipdir=require(_0x5948('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5948('0x3'));var moment=require(_0x5948('0x4'));var BPromise=require(_0x5948('0x5'));var Mustache=require(_0x5948('0x6'));var util=require(_0x5948('0x7'));var path=require(_0x5948('0x8'));var sox=require(_0x5948('0x9'));var csv=require(_0x5948('0xa'));var ejs=require(_0x5948('0xb'));var fs=require('fs');var fs_extra=require(_0x5948('0xc'));var _=require(_0x5948('0xd'));var squel=require(_0x5948('0xe'));var crypto=require(_0x5948('0xf'));var jsforce=require(_0x5948('0x10'));var deskjs=require(_0x5948('0x11'));var toCsv=require(_0x5948('0xa'));var querystring=require('querystring');var Papa=require(_0x5948('0x12'));var Redis=require(_0x5948('0x13'));var authService=require(_0x5948('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5948('0x15'));var hardwareService=require(_0x5948('0x16'));var logger=require(_0x5948('0x17'))('api');var utils=require(_0x5948('0x18'));var config=require(_0x5948('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5054a1,_0x5ba262){_0x5ba262=_0x5ba262||0xcc;return function(_0x681b){if(_0x681b){return _0x5054a1['sendStatus'](_0x5ba262);}return _0x5054a1[_0x5948('0x1a')](_0x5ba262)[_0x5948('0x1b')]();};}function respondWithResult(_0x2049e5,_0xc36be){_0xc36be=_0xc36be||0xc8;return function(_0x51ccb8){if(_0x51ccb8){return _0x2049e5[_0x5948('0x1a')](_0xc36be)['json'](_0x51ccb8);}};}function respondWithFilteredResult(_0x10b50a,_0x52205c){return function(_0x5e202c){if(_0x5e202c){var _0x540acc=typeof _0x52205c[_0x5948('0x1c')]===_0x5948('0x1d')&&typeof _0x52205c[_0x5948('0x1e')]===_0x5948('0x1d');var _0x2068e0=_0x5e202c[_0x5948('0x1f')];var _0x295273=_0x540acc?0x0:_0x52205c[_0x5948('0x1c')];var _0x5ecadc=_0x540acc?_0x5e202c['count']:_0x52205c[_0x5948('0x1c')]+_0x52205c[_0x5948('0x1e')];var _0x1138fd;if(_0x5ecadc>=_0x2068e0){_0x5ecadc=_0x2068e0;_0x1138fd=0xc8;}else{_0x1138fd=0xce;}_0x10b50a[_0x5948('0x1a')](_0x1138fd);return _0x10b50a[_0x5948('0x20')](_0x5948('0x21'),_0x295273+'-'+_0x5ecadc+'/'+_0x2068e0)['json'](_0x5e202c);}return null;};}function patchUpdates(_0x405d87){return function(_0x2cef54){try{jsonpatch[_0x5948('0x22')](_0x2cef54,_0x405d87,!![]);}catch(_0x49f8c6){return BPromise[_0x5948('0x23')](_0x49f8c6);}return _0x2cef54[_0x5948('0x24')]();};}function saveUpdates(_0x55ba71,_0x307880){return function(_0x1ce13e){if(_0x1ce13e){return _0x1ce13e['update'](_0x55ba71)[_0x5948('0x25')](function(_0x4b99e4){return _0x4b99e4;});}return null;};}function removeEntity(_0x141edd,_0x251c79){return function(_0x5f0563){if(_0x5f0563){return _0x5f0563[_0x5948('0x26')]()[_0x5948('0x25')](function(){_0x141edd['status'](0xcc)[_0x5948('0x1b')]();});}};}function handleEntityNotFound(_0x3d4b7d,_0x24871f){return function(_0x4f0c5d){if(!_0x4f0c5d){_0x3d4b7d['sendStatus'](0x194);}return _0x4f0c5d;};}function handleError(_0x2da8e1,_0x46f2f1){_0x46f2f1=_0x46f2f1||0x1f4;return function(_0x542a31){logger[_0x5948('0x27')](_0x542a31[_0x5948('0x28')]);if(_0x542a31[_0x5948('0x29')]){delete _0x542a31[_0x5948('0x29')];}_0x2da8e1[_0x5948('0x1a')](_0x46f2f1)['send'](_0x542a31);};}exports[_0x5948('0x2a')]=function(_0x5b1c3d,_0x145377){var _0x104f91={},_0x51987={},_0x2bdcae={'count':0x0,'rows':[]};var _0x4ebb65=_[_0x5948('0x2b')](db[_0x5948('0x2c')][_0x5948('0x2d')],function(_0xf6b6fc){return{'name':_0xf6b6fc[_0x5948('0x2e')],'type':_0xf6b6fc[_0x5948('0x2f')][_0x5948('0x30')]};});_0x51987['model']=_[_0x5948('0x2b')](_0x4ebb65,'name');_0x51987[_0x5948('0x31')]=_[_0x5948('0x32')](_0x5b1c3d[_0x5948('0x31')]);_0x51987[_0x5948('0x33')]=_[_0x5948('0x34')](_0x51987[_0x5948('0x35')],_0x51987[_0x5948('0x31')]);_0x104f91['attributes']=_[_0x5948('0x34')](_0x51987['model'],qs[_0x5948('0x36')](_0x5b1c3d[_0x5948('0x31')]['fields']));_0x104f91[_0x5948('0x37')]=_0x104f91[_0x5948('0x37')][_0x5948('0x38')]?_0x104f91[_0x5948('0x37')]:_0x51987[_0x5948('0x35')];if(!_0x5b1c3d[_0x5948('0x31')][_0x5948('0x39')](_0x5948('0x3a'))){_0x104f91[_0x5948('0x1e')]=qs[_0x5948('0x1e')](_0x5b1c3d['query'][_0x5948('0x1e')]);_0x104f91[_0x5948('0x1c')]=qs[_0x5948('0x1c')](_0x5b1c3d['query']['offset']);}_0x104f91[_0x5948('0x3b')]=qs[_0x5948('0x3c')](_0x5b1c3d['query'][_0x5948('0x3c')]);_0x104f91[_0x5948('0x3d')]=qs[_0x5948('0x33')](_[_0x5948('0x3e')](_0x5b1c3d[_0x5948('0x31')],_0x51987[_0x5948('0x33')]),_0x4ebb65);if(_0x5b1c3d[_0x5948('0x31')]['filter']){_0x104f91[_0x5948('0x3d')]=_[_0x5948('0x3f')](_0x104f91[_0x5948('0x3d')],{'$or':_['map'](_0x4ebb65,function(_0xabd3cf){if(_0xabd3cf['type']!==_0x5948('0x40')){var _0x11fc0c={};_0x11fc0c[_0xabd3cf['name']]={'$like':'%'+_0x5b1c3d[_0x5948('0x31')][_0x5948('0x41')]+'%'};return _0x11fc0c;}})});}_0x104f91=_[_0x5948('0x3f')]({},_0x104f91,_0x5b1c3d['options']);var _0x65187e={'where':_0x104f91[_0x5948('0x3d')]};return db[_0x5948('0x2c')]['count'](_0x65187e)[_0x5948('0x25')](function(_0xa423ec){_0x2bdcae['count']=_0xa423ec;if(_0x5b1c3d[_0x5948('0x31')][_0x5948('0x42')]){_0x104f91['include']=[{'all':!![]}];}return db[_0x5948('0x2c')]['findAll'](_0x104f91);})[_0x5948('0x25')](function(_0x635544){_0x2bdcae[_0x5948('0x43')]=_0x635544;return _0x2bdcae;})[_0x5948('0x25')](respondWithFilteredResult(_0x145377,_0x104f91))[_0x5948('0x44')](handleError(_0x145377,null));};exports[_0x5948('0x45')]=function(_0x1b884d,_0x52a29e){var _0xd5a4a8={'raw':!![],'where':{'id':_0x1b884d[_0x5948('0x46')]['id']}},_0x7a700={};_0x7a700[_0x5948('0x35')]=_[_0x5948('0x32')](db[_0x5948('0x2c')][_0x5948('0x2d')]);_0x7a700[_0x5948('0x31')]=_[_0x5948('0x32')](_0x1b884d[_0x5948('0x31')]);_0x7a700[_0x5948('0x33')]=_[_0x5948('0x34')](_0x7a700[_0x5948('0x35')],_0x7a700['query']);_0xd5a4a8['attributes']=_['intersection'](_0x7a700[_0x5948('0x35')],qs[_0x5948('0x36')](_0x1b884d[_0x5948('0x31')][_0x5948('0x36')]));_0xd5a4a8[_0x5948('0x37')]=_0xd5a4a8[_0x5948('0x37')]['length']?_0xd5a4a8[_0x5948('0x37')]:_0x7a700[_0x5948('0x35')];if(_0x1b884d[_0x5948('0x31')][_0x5948('0x42')]){_0xd5a4a8[_0x5948('0x47')]=[{'all':!![]}];}_0xd5a4a8=_[_0x5948('0x3f')]({},_0xd5a4a8,_0x1b884d[_0x5948('0x48')]);return db['FaxApplication'][_0x5948('0x49')](_0xd5a4a8)[_0x5948('0x25')](handleEntityNotFound(_0x52a29e,null))[_0x5948('0x25')](respondWithResult(_0x52a29e,null))['catch'](handleError(_0x52a29e,null));};exports[_0x5948('0x4a')]=function(_0x2f3b3e,_0x4e4c0e){return db[_0x5948('0x2c')][_0x5948('0x4a')](_0x2f3b3e['body'],{})[_0x5948('0x25')](respondWithResult(_0x4e4c0e,0xc9))['catch'](handleError(_0x4e4c0e,null));};exports[_0x5948('0x4b')]=function(_0x36b2b5,_0x27a19a){if(_0x36b2b5[_0x5948('0x4c')]['id']){delete _0x36b2b5[_0x5948('0x4c')]['id'];}return db[_0x5948('0x2c')][_0x5948('0x49')]({'where':{'id':_0x36b2b5[_0x5948('0x46')]['id']}})[_0x5948('0x25')](handleEntityNotFound(_0x27a19a,null))[_0x5948('0x25')](saveUpdates(_0x36b2b5[_0x5948('0x4c')],null))['then'](respondWithResult(_0x27a19a,null))[_0x5948('0x44')](handleError(_0x27a19a,null));};exports['destroy']=function(_0x221361,_0x507516){return db[_0x5948('0x2c')][_0x5948('0x49')]({'where':{'id':_0x221361[_0x5948('0x46')]['id']}})[_0x5948('0x25')](handleEntityNotFound(_0x507516,null))['then'](removeEntity(_0x507516,null))[_0x5948('0x44')](handleError(_0x507516,null));}; \ No newline at end of file +var _0x353d=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filters','filter','merge','options','where','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x37f7c8,_0x27a25d){var _0x583047=function(_0x52005f){while(--_0x52005f){_0x37f7c8['push'](_0x37f7c8['shift']());}};_0x583047(++_0x27a25d);}(_0x353d,0x1c8));var _0xd353=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x353d[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xd353('0x0'));var rimraf=require(_0xd353('0x1'));var zipdir=require(_0xd353('0x2'));var jsonpatch=require(_0xd353('0x3'));var rp=require(_0xd353('0x4'));var moment=require(_0xd353('0x5'));var BPromise=require(_0xd353('0x6'));var Mustache=require(_0xd353('0x7'));var util=require(_0xd353('0x8'));var path=require(_0xd353('0x9'));var sox=require(_0xd353('0xa'));var csv=require('to-csv');var ejs=require(_0xd353('0xb'));var fs=require('fs');var fs_extra=require(_0xd353('0xc'));var _=require(_0xd353('0xd'));var squel=require(_0xd353('0xe'));var crypto=require('crypto');var jsforce=require(_0xd353('0xf'));var deskjs=require(_0xd353('0x10'));var toCsv=require(_0xd353('0x11'));var querystring=require(_0xd353('0x12'));var Papa=require(_0xd353('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd353('0x14'));var as=require(_0xd353('0x15'));var hardwareService=require(_0xd353('0x16'));var logger=require(_0xd353('0x17'))(_0xd353('0x18'));var utils=require(_0xd353('0x19'));var config=require(_0xd353('0x1a'));var licenseUtil=require(_0xd353('0x1b'));var db=require(_0xd353('0x1c'))['db'];function respondWithStatusCode(_0x17e146,_0x102528){_0x102528=_0x102528||0xcc;return function(_0x34e54b){if(_0x34e54b){return _0x17e146[_0xd353('0x1d')](_0x102528);}return _0x17e146[_0xd353('0x1e')](_0x102528)[_0xd353('0x1f')]();};}function respondWithResult(_0x1ec429,_0x3927b5){_0x3927b5=_0x3927b5||0xc8;return function(_0x2d9bf6){if(_0x2d9bf6){return _0x1ec429[_0xd353('0x1e')](_0x3927b5)[_0xd353('0x20')](_0x2d9bf6);}};}function respondWithFilteredResult(_0xc18755,_0xf77ef0){return function(_0xf2eb41){if(_0xf2eb41){var _0x430436=typeof _0xf77ef0[_0xd353('0x21')]===_0xd353('0x22')&&typeof _0xf77ef0[_0xd353('0x23')]===_0xd353('0x22');var _0x47aa4d=_0xf2eb41['count'];var _0x33de9f=_0x430436?0x0:_0xf77ef0[_0xd353('0x21')];var _0x503ea8=_0x430436?_0xf2eb41[_0xd353('0x24')]:_0xf77ef0[_0xd353('0x21')]+_0xf77ef0[_0xd353('0x23')];var _0x475512;if(_0x503ea8>=_0x47aa4d){_0x503ea8=_0x47aa4d;_0x475512=0xc8;}else{_0x475512=0xce;}_0xc18755[_0xd353('0x1e')](_0x475512);return _0xc18755['set']('Content-Range',_0x33de9f+'-'+_0x503ea8+'/'+_0x47aa4d)[_0xd353('0x20')](_0xf2eb41);}return null;};}function patchUpdates(_0x2f3c2a){return function(_0x2e3a0e){try{jsonpatch[_0xd353('0x25')](_0x2e3a0e,_0x2f3c2a,!![]);}catch(_0x2a9a40){return BPromise[_0xd353('0x26')](_0x2a9a40);}return _0x2e3a0e[_0xd353('0x27')]();};}function saveUpdates(_0x43ee81,_0x44bbf4){return function(_0x4de5fd){if(_0x4de5fd){return _0x4de5fd[_0xd353('0x28')](_0x43ee81)['then'](function(_0x55519f){return _0x55519f;});}return null;};}function removeEntity(_0x358873,_0x36c142){return function(_0x51c085){if(_0x51c085){return _0x51c085[_0xd353('0x29')]()[_0xd353('0x2a')](function(){_0x358873[_0xd353('0x1e')](0xcc)[_0xd353('0x1f')]();});}};}function handleEntityNotFound(_0x491bda,_0x4b1ad6){return function(_0xe8035){if(!_0xe8035){_0x491bda['sendStatus'](0x194);}return _0xe8035;};}function handleError(_0x4d1e14,_0x139b28){_0x139b28=_0x139b28||0x1f4;return function(_0xff9b4c){logger[_0xd353('0x2b')](_0xff9b4c[_0xd353('0x2c')]);if(_0xff9b4c[_0xd353('0x2d')]){delete _0xff9b4c[_0xd353('0x2d')];}_0x4d1e14[_0xd353('0x1e')](_0x139b28)[_0xd353('0x2e')](_0xff9b4c);};}exports[_0xd353('0x2f')]=function(_0x13ee53,_0x1d9719){var _0xf4c7b6={},_0x4a7908={},_0x59a6a4={'count':0x0,'rows':[]};var _0x42ddfd=_[_0xd353('0x30')](db[_0xd353('0x31')][_0xd353('0x32')],function(_0x149372){return{'name':_0x149372[_0xd353('0x33')],'type':_0x149372[_0xd353('0x34')]['key']};});_0x4a7908['model']=_[_0xd353('0x30')](_0x42ddfd,_0xd353('0x2d'));_0x4a7908[_0xd353('0x35')]=_['keys'](_0x13ee53[_0xd353('0x35')]);_0x4a7908['filters']=_[_0xd353('0x36')](_0x4a7908['model'],_0x4a7908[_0xd353('0x35')]);_0xf4c7b6[_0xd353('0x37')]=_['intersection'](_0x4a7908[_0xd353('0x38')],qs[_0xd353('0x39')](_0x13ee53[_0xd353('0x35')]['fields']));_0xf4c7b6[_0xd353('0x37')]=_0xf4c7b6[_0xd353('0x37')][_0xd353('0x3a')]?_0xf4c7b6[_0xd353('0x37')]:_0x4a7908[_0xd353('0x38')];if(!_0x13ee53['query'][_0xd353('0x3b')]('nolimit')){_0xf4c7b6[_0xd353('0x23')]=qs[_0xd353('0x23')](_0x13ee53[_0xd353('0x35')][_0xd353('0x23')]);_0xf4c7b6[_0xd353('0x21')]=qs[_0xd353('0x21')](_0x13ee53['query']['offset']);}_0xf4c7b6[_0xd353('0x3c')]=qs[_0xd353('0x3d')](_0x13ee53['query'][_0xd353('0x3d')]);_0xf4c7b6['where']=qs['filters'](_[_0xd353('0x3e')](_0x13ee53['query'],_0x4a7908[_0xd353('0x3f')]),_0x42ddfd);if(_0x13ee53[_0xd353('0x35')][_0xd353('0x40')]){_0xf4c7b6['where']=_[_0xd353('0x41')](_0xf4c7b6['where'],{'$or':_[_0xd353('0x30')](_0x42ddfd,function(_0x831ecc){if(_0x831ecc[_0xd353('0x34')]!=='VIRTUAL'){var _0x181abf={};_0x181abf[_0x831ecc['name']]={'$like':'%'+_0x13ee53[_0xd353('0x35')][_0xd353('0x40')]+'%'};return _0x181abf;}})});}_0xf4c7b6=_['merge']({},_0xf4c7b6,_0x13ee53[_0xd353('0x42')]);var _0x47baa4={'where':_0xf4c7b6[_0xd353('0x43')]};return db['FaxApplication'][_0xd353('0x24')](_0x47baa4)[_0xd353('0x2a')](function(_0x4d90fe){_0x59a6a4[_0xd353('0x24')]=_0x4d90fe;if(_0x13ee53[_0xd353('0x35')][_0xd353('0x44')]){_0xf4c7b6[_0xd353('0x45')]=[{'all':!![]}];}return db[_0xd353('0x31')][_0xd353('0x46')](_0xf4c7b6);})[_0xd353('0x2a')](function(_0x2ad29c){_0x59a6a4[_0xd353('0x47')]=_0x2ad29c;return _0x59a6a4;})[_0xd353('0x2a')](respondWithFilteredResult(_0x1d9719,_0xf4c7b6))[_0xd353('0x48')](handleError(_0x1d9719,null));};exports['show']=function(_0x3798d5,_0x4ea7e0){var _0x1c70dc={'raw':!![],'where':{'id':_0x3798d5[_0xd353('0x49')]['id']}},_0x4fc8ea={};_0x4fc8ea[_0xd353('0x38')]=_[_0xd353('0x4a')](db['FaxApplication'][_0xd353('0x32')]);_0x4fc8ea[_0xd353('0x35')]=_[_0xd353('0x4a')](_0x3798d5['query']);_0x4fc8ea[_0xd353('0x3f')]=_[_0xd353('0x36')](_0x4fc8ea[_0xd353('0x38')],_0x4fc8ea[_0xd353('0x35')]);_0x1c70dc['attributes']=_[_0xd353('0x36')](_0x4fc8ea['model'],qs[_0xd353('0x39')](_0x3798d5[_0xd353('0x35')][_0xd353('0x39')]));_0x1c70dc[_0xd353('0x37')]=_0x1c70dc[_0xd353('0x37')][_0xd353('0x3a')]?_0x1c70dc['attributes']:_0x4fc8ea[_0xd353('0x38')];if(_0x3798d5[_0xd353('0x35')]['includeAll']){_0x1c70dc['include']=[{'all':!![]}];}_0x1c70dc=_[_0xd353('0x41')]({},_0x1c70dc,_0x3798d5[_0xd353('0x42')]);return db[_0xd353('0x31')][_0xd353('0x4b')](_0x1c70dc)[_0xd353('0x2a')](handleEntityNotFound(_0x4ea7e0,null))[_0xd353('0x2a')](respondWithResult(_0x4ea7e0,null))[_0xd353('0x48')](handleError(_0x4ea7e0,null));};exports[_0xd353('0x4c')]=function(_0xeaf752,_0x34d67a){return db[_0xd353('0x31')][_0xd353('0x4c')](_0xeaf752[_0xd353('0x4d')],{})[_0xd353('0x2a')](respondWithResult(_0x34d67a,0xc9))[_0xd353('0x48')](handleError(_0x34d67a,null));};exports[_0xd353('0x28')]=function(_0x30d5a3,_0x52c852){if(_0x30d5a3[_0xd353('0x4d')]['id']){delete _0x30d5a3[_0xd353('0x4d')]['id'];}return db[_0xd353('0x31')]['find']({'where':{'id':_0x30d5a3[_0xd353('0x49')]['id']}})[_0xd353('0x2a')](handleEntityNotFound(_0x52c852,null))[_0xd353('0x2a')](saveUpdates(_0x30d5a3[_0xd353('0x4d')],null))[_0xd353('0x2a')](respondWithResult(_0x52c852,null))[_0xd353('0x48')](handleError(_0x52c852,null));};exports['destroy']=function(_0x2fd2d6,_0x1dcfb1){return db[_0xd353('0x31')][_0xd353('0x4b')]({'where':{'id':_0x2fd2d6[_0xd353('0x49')]['id']}})[_0xd353('0x2a')](handleEntityNotFound(_0x1dcfb1,null))[_0xd353('0x2a')](removeEntity(_0x1dcfb1,null))[_0xd353('0x48')](handleError(_0x1dcfb1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ddc8a75..2795adc 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 _0x6d4d=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxApplication.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6d4d,0xae));var _0xd6d4=function(_0x11b34c,_0x3927d1){_0x11b34c=_0x11b34c-0x0;var _0x3fc1d3=_0x6d4d[_0x11b34c];return _0x3fc1d3;};'use strict';var _=require(_0xd6d4('0x0'));var util=require(_0xd6d4('0x1'));var logger=require(_0xd6d4('0x2'))('api');var moment=require(_0xd6d4('0x3'));var BPromise=require(_0xd6d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6d4('0x5'));var rimraf=require('rimraf');var config=require(_0xd6d4('0x6'));var attributes=require(_0xd6d4('0x7'));module[_0xd6d4('0x8')]=function(_0xad68f7,_0x51b363){return _0xad68f7[_0xd6d4('0x9')](_0xd6d4('0xa'),attributes,{'tableName':_0xd6d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6d4('0xc'),'collate':_0xd6d4('0xd')});}; \ No newline at end of file +var _0x00e9=['utf8mb4_unicode_ci','lodash','api','path','rimraf','./faxApplication.attributes','exports','utf8mb4'];(function(_0xa6a35,_0x10c265){var _0x31d7d5=function(_0x41cf19){while(--_0x41cf19){_0xa6a35['push'](_0xa6a35['shift']());}};_0x31d7d5(++_0x10c265);}(_0x00e9,0x89));var _0x900e=function(_0x2450f6,_0x3bad82){_0x2450f6=_0x2450f6-0x0;var _0x3dca10=_0x00e9[_0x2450f6];return _0x3dca10;};'use strict';var _=require(_0x900e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x900e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x900e('0x2'));var rimraf=require(_0x900e('0x3'));var config=require('../../config/environment');var attributes=require(_0x900e('0x4'));module[_0x900e('0x5')]=function(_0x111c5d,_0x28ca5a){return _0x111c5d['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x900e('0x6'),'collate':_0x900e('0x7')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 9e95084..cef51fb 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 _0x7378=['FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x49446d,_0x116bff){var _0x2bb11b=function(_0x2dd19c){while(--_0x2dd19c){_0x49446d['push'](_0x49446d['shift']());}};_0x2bb11b(++_0x116bff);}(_0x7378,0xbd));var _0x8737=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7378[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x8737('0x0'));var moment=require(_0x8737('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8737('0x2'));var db=require(_0x8737('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8737('0x4'))(_0x8737('0x5'));var config=require(_0x8737('0x6'));var jayson=require(_0x8737('0x7'));var client=jayson[_0x8737('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b1cdd,_0x2d536c,_0x4de10b){return new BPromise(function(_0x10530a,_0xfc04dc){return client[_0x8737('0x9')](_0x1b1cdd,_0x4de10b)['then'](function(_0x3a1fbc){logger[_0x8737('0xa')](_0x8737('0xb'),_0x2d536c,'request\x20sent');logger[_0x8737('0xc')](_0x8737('0xd'),_0x2d536c,_0x8737('0xe'),JSON[_0x8737('0xf')](_0x3a1fbc));if(_0x3a1fbc['error']){if(_0x3a1fbc[_0x8737('0x10')]['code']===0x1f4){logger[_0x8737('0x10')](_0x8737('0xb'),_0x2d536c,_0x3a1fbc[_0x8737('0x10')][_0x8737('0x11')]);return _0xfc04dc(_0x3a1fbc[_0x8737('0x10')]['message']);}logger['error'](_0x8737('0xb'),_0x2d536c,_0x3a1fbc['error'][_0x8737('0x11')]);return _0x10530a(_0x3a1fbc['error'][_0x8737('0x11')]);}else{logger[_0x8737('0xa')](_0x8737('0xb'),_0x2d536c,_0x8737('0xe'));_0x10530a(_0x3a1fbc[_0x8737('0x12')][_0x8737('0x11')]);}})['catch'](function(_0x2b27ac){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2d536c,_0x2b27ac);_0xfc04dc(_0x2b27ac);});});}exports[_0x8737('0x13')]=function(_0x522d5e){var _0x1873e4=this;return new Promise(function(_0xa0c78d,_0x237843){return db[_0x8737('0x14')]['update'](_0x522d5e[_0x8737('0x15')],{'raw':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')][_0x8737('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['where']||null:null,'attributes':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['attributes']||null:null,'limit':_0x522d5e[_0x8737('0x16')]?_0x522d5e[_0x8737('0x16')]['limit']||null:null})['then'](function(_0x4ebfe5){logger[_0x8737('0xa')]('UpdateFaxApplication',_0x522d5e);logger[_0x8737('0xc')]('UpdateFaxApplication',_0x522d5e,JSON['stringify'](_0x4ebfe5));_0xa0c78d(_0x4ebfe5);})[_0x8737('0x18')](function(_0x281593){logger[_0x8737('0x10')](_0x8737('0x13'),_0x281593[_0x8737('0x11')],_0x522d5e);_0x237843(_0x1873e4[_0x8737('0x10')](0x1f4,_0x281593[_0x8737('0x11')]));});});}; \ No newline at end of file +var _0xb6a3=['raw','where','attributes','limit','then','UpdateFaxApplication','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','update','body','options'];(function(_0x1dfa23,_0x19e069){var _0x134989=function(_0xa3f08f){while(--_0xa3f08f){_0x1dfa23['push'](_0x1dfa23['shift']());}};_0x134989(++_0x19e069);}(_0xb6a3,0x1d8));var _0x3b6a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb6a3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3b6a('0x0'));var util=require(_0x3b6a('0x1'));var moment=require(_0x3b6a('0x2'));var BPromise=require(_0x3b6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b6a('0x4'));var db=require(_0x3b6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b6a('0x6'))(_0x3b6a('0x7'));var config=require(_0x3b6a('0x8'));var jayson=require(_0x3b6a('0x9'));var client=jayson[_0x3b6a('0xa')][_0x3b6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24652d,_0x116498,_0x13dd64){return new BPromise(function(_0x3eb3e4,_0x20dd8c){return client[_0x3b6a('0xc')](_0x24652d,_0x13dd64)['then'](function(_0xc2655b){logger['info'](_0x3b6a('0xd'),_0x116498,_0x3b6a('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x116498,'request\x20sent',JSON[_0x3b6a('0xf')](_0xc2655b));if(_0xc2655b['error']){if(_0xc2655b['error'][_0x3b6a('0x10')]===0x1f4){logger[_0x3b6a('0x11')]('FaxApplication,\x20%s,\x20%s',_0x116498,_0xc2655b[_0x3b6a('0x11')]['message']);return _0x20dd8c(_0xc2655b[_0x3b6a('0x11')][_0x3b6a('0x12')]);}logger[_0x3b6a('0x11')]('FaxApplication,\x20%s,\x20%s',_0x116498,_0xc2655b[_0x3b6a('0x11')]['message']);return _0x3eb3e4(_0xc2655b[_0x3b6a('0x11')][_0x3b6a('0x12')]);}else{logger['info'](_0x3b6a('0xd'),_0x116498,_0x3b6a('0xe'));_0x3eb3e4(_0xc2655b[_0x3b6a('0x13')]['message']);}})[_0x3b6a('0x14')](function(_0x5294ff){logger['error']('FaxApplication,\x20%s,\x20%s',_0x116498,_0x5294ff);_0x20dd8c(_0x5294ff);});});}exports['UpdateFaxApplication']=function(_0x3cf80){var _0x42c4f3=this;return new Promise(function(_0x119855,_0x44579d){return db['FaxApplication'][_0x3b6a('0x15')](_0x3cf80[_0x3b6a('0x16')],{'raw':_0x3cf80[_0x3b6a('0x17')]?_0x3cf80[_0x3b6a('0x17')][_0x3b6a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cf80[_0x3b6a('0x17')]?_0x3cf80[_0x3b6a('0x17')][_0x3b6a('0x19')]||null:null,'attributes':_0x3cf80['options']?_0x3cf80[_0x3b6a('0x17')][_0x3b6a('0x1a')]||null:null,'limit':_0x3cf80['options']?_0x3cf80['options'][_0x3b6a('0x1b')]||null:null})[_0x3b6a('0x1c')](function(_0x496655){logger['info'](_0x3b6a('0x1d'),_0x3cf80);logger[_0x3b6a('0x1e')](_0x3b6a('0x1d'),_0x3cf80,JSON[_0x3b6a('0xf')](_0x496655));_0x119855(_0x496655);})[_0x3b6a('0x14')](function(_0x182444){logger[_0x3b6a('0x11')]('UpdateFaxApplication',_0x182444[_0x3b6a('0x12')],_0x3cf80);_0x44579d(_0x42c4f3['error'](0x1f4,_0x182444[_0x3b6a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1f6a56a..e2f6a7e 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34a14d,_0xc49d24){_0x34a14d=_0x34a14d-0x0;var _0x2015f2=_0x0b0e[_0x34a14d];return _0x2015f2;};'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 _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xb688,0xcf));var _0x8b68=function(_0x381b84,_0x55d045){_0x381b84=_0x381b84-0x0;var _0x5b11dc=_0xb688[_0x381b84];return _0x5b11dc;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 8d878ca..4cec42d 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 _0x5fdc=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3c0207,_0xf7f1c7){_0x3c0207=_0x3c0207-0x0;var _0x47fc05=_0x5fdc[_0x3c0207];return _0x47fc05;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'closed':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc5fd('0x3')]},'disposition':{'type':Sequelize[_0xc5fd('0x4')]},'secondDisposition':{'type':Sequelize[_0xc5fd('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc5fd('0x4')]},'note':{'type':Sequelize[_0xc5fd('0x4')]},'read1stAt':{'type':Sequelize[_0xc5fd('0x3')]},'fax':{'type':Sequelize[_0xc5fd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc5fd('0x5')]('in',_0xc5fd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc5fd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc5fd('0x5')]('in',_0xc5fd('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7708=['sequelize','exports','DATE','STRING','out','ENUM','INTEGER'];(function(_0x118fcb,_0x529f8d){var _0xbc3033=function(_0x160e39){while(--_0x160e39){_0x118fcb['push'](_0x118fcb['shift']());}};_0xbc3033(++_0x529f8d);}(_0x7708,0x188));var _0x8770=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7708[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8770('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8770('0x2')]},'fax':{'type':Sequelize[_0x8770('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8770('0x5')]('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x8770('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index badf7d0..4701497 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 _0xdca9=['FaxInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','Tag','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createWriteStream','resolve','log','err','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','limit','count','set','then','destroy','end','sendStatus','error','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','user','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','create','catch','update','body','find','describe','FaxMessage','addMessage','ids','getMessages','nolimit','order','sort','pick','where'];(function(_0x5b88be,_0x568ffd){var _0x9fa4ad=function(_0x6aeec9){while(--_0x6aeec9){_0x5b88be['push'](_0x5b88be['shift']());}};_0x9fa4ad(++_0x568ffd);}(_0xdca9,0x8d));var _0x9dca=function(_0x2882cf,_0x5beb85){_0x2882cf=_0x2882cf-0x0;var _0x501894=_0xdca9[_0x2882cf];return _0x501894;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9dca('0x0'));var moment=require(_0x9dca('0x1'));var BPromise=require(_0x9dca('0x2'));var util=require('util');var path=require(_0x9dca('0x3'));var fs=require('fs');var _=require(_0x9dca('0x4'));var Redis=require(_0x9dca('0x5'));var interaction=require(_0x9dca('0x6'));var qs=require(_0x9dca('0x7'));var logger=require(_0x9dca('0x8'))(_0x9dca('0x9'));var config=require(_0x9dca('0xa'));var db=require(_0x9dca('0xb'))['db'];config['redis']=_[_0x9dca('0xc')](config[_0x9dca('0xd')],{'host':_0x9dca('0xe'),'port':0x18eb});var socket=require(_0x9dca('0xf'))(new Redis(config[_0x9dca('0xd')]));require(_0x9dca('0x10'))[_0x9dca('0x11')](socket);function respondWithStatusCode(_0x418068,_0x3b0d4f){_0x3b0d4f=_0x3b0d4f||0xcc;return function(_0xc99131){if(_0xc99131){return _0x418068['sendStatus'](_0x3b0d4f);}return _0x418068[_0x9dca('0x12')](_0x3b0d4f)['end']();};}function respondWithResult(_0xbd5c32,_0x509c0a){_0x509c0a=_0x509c0a||0xc8;return function(_0x48dd0d){if(_0x48dd0d){return _0xbd5c32['status'](_0x509c0a)[_0x9dca('0x13')](_0x48dd0d);}};}function respondWithFilteredResult(_0x30cf2d,_0x485fa2){return function(_0x3a50b1){if(_0x3a50b1){var _0x464298=typeof _0x485fa2[_0x9dca('0x14')]==='undefined'&&typeof _0x485fa2[_0x9dca('0x15')]==='undefined';var _0x59387d=_0x3a50b1[_0x9dca('0x16')];var _0x28598e=_0x464298?0x0:_0x485fa2[_0x9dca('0x14')];var _0x35699c=_0x464298?_0x3a50b1['count']:_0x485fa2[_0x9dca('0x14')]+_0x485fa2[_0x9dca('0x15')];var _0x2c89d1;if(_0x35699c>=_0x59387d){_0x35699c=_0x59387d;_0x2c89d1=0xc8;}else{_0x2c89d1=0xce;}_0x30cf2d[_0x9dca('0x12')](_0x2c89d1);return _0x30cf2d[_0x9dca('0x17')]('Content-Range',_0x28598e+'-'+_0x35699c+'/'+_0x59387d)[_0x9dca('0x13')](_0x3a50b1);}return null;};}function saveUpdates(_0x26e24f){return function(_0x252d62){if(_0x252d62){return _0x252d62['update'](_0x26e24f)[_0x9dca('0x18')](function(_0x117fc7){return _0x117fc7;});}return null;};}function removeEntity(_0x194b09){return function(_0x578634){if(_0x578634){return _0x578634[_0x9dca('0x19')]()[_0x9dca('0x18')](function(){_0x194b09[_0x9dca('0x12')](0xcc)[_0x9dca('0x1a')]();});}};}function handleEntityNotFound(_0x4cd18d){return function(_0xcb8b19){if(!_0xcb8b19){_0x4cd18d[_0x9dca('0x1b')](0x194);}return _0xcb8b19;};}function handleError(_0x3f5951,_0x2c9263){_0x2c9263=_0x2c9263||0x1f4;return function(_0x52c9d0){logger[_0x9dca('0x1c')](_0x52c9d0[_0x9dca('0x1d')]);if(_0x52c9d0[_0x9dca('0x1e')]){delete _0x52c9d0[_0x9dca('0x1e')];}_0x3f5951[_0x9dca('0x12')](_0x2c9263)[_0x9dca('0x1f')](_0x52c9d0);};}exports[_0x9dca('0x20')]=function(_0x3a4b44,_0x5539be){var _0x50d10d={};var _0x2f6de1=_['map'](db[_0x9dca('0x21')][_0x9dca('0x22')],function(_0x360c9c){return{'name':_0x360c9c[_0x9dca('0x23')],'type':_0x360c9c[_0x9dca('0x24')][_0x9dca('0x25')]};});_0x50d10d=qs[_0x9dca('0x26')](_0x2f6de1,_0x3a4b44);return interaction['findAll'](_0x9dca('0x27'),_0x3a4b44[_0x9dca('0x28')],_0x3a4b44[_0x9dca('0x29')],_0x50d10d,_0x2f6de1)['then'](respondWithFilteredResult(_0x5539be,_0x50d10d))['catch'](handleError(_0x5539be,null));};exports['show']=function(_0x2e3278,_0x5b86aa){var _0x47b70b={'raw':![],'where':{'id':_0x2e3278[_0x9dca('0x2a')]['id']}},_0x3a45d7={};_0x3a45d7[_0x9dca('0x2b')]=_['keys'](db[_0x9dca('0x21')]['rawAttributes']);_0x3a45d7[_0x9dca('0x28')]=_[_0x9dca('0x2c')](_0x2e3278[_0x9dca('0x28')]);_0x3a45d7[_0x9dca('0x2d')]=_[_0x9dca('0x2e')](_0x3a45d7[_0x9dca('0x2b')],_0x3a45d7[_0x9dca('0x28')]);_0x47b70b['attributes']=_[_0x9dca('0x2e')](_0x3a45d7[_0x9dca('0x2b')],qs['fields'](_0x2e3278[_0x9dca('0x28')][_0x9dca('0x2f')]));_0x47b70b[_0x9dca('0x30')]=_0x47b70b[_0x9dca('0x30')][_0x9dca('0x31')]?_0x47b70b[_0x9dca('0x30')]:_0x3a45d7[_0x9dca('0x2b')];if(_0x2e3278[_0x9dca('0x28')][_0x9dca('0x32')]){_0x47b70b[_0x9dca('0x33')]=[{'all':!![]}];}_0x47b70b=_[_0x9dca('0x34')]({},_0x47b70b,_0x2e3278[_0x9dca('0x35')]);return db[_0x9dca('0x21')]['find'](_0x47b70b)[_0x9dca('0x18')](handleEntityNotFound(_0x5b86aa,null))['then'](respondWithResult(_0x5b86aa,null))['catch'](handleError(_0x5b86aa,null));};exports[_0x9dca('0x36')]=function(_0x31d3fd,_0x5af9b9){return db[_0x9dca('0x21')][_0x9dca('0x36')](_0x31d3fd['body'],{})[_0x9dca('0x18')](respondWithResult(_0x5af9b9,0xc9))[_0x9dca('0x37')](handleError(_0x5af9b9,null));};exports[_0x9dca('0x38')]=function(_0x1580e5,_0x497f0e){if(_0x1580e5['body']['id']){delete _0x1580e5[_0x9dca('0x39')]['id'];}return db['FaxInteraction'][_0x9dca('0x3a')]({'where':{'id':_0x1580e5['params']['id']}})[_0x9dca('0x18')](handleEntityNotFound(_0x497f0e,null))['then'](saveUpdates(_0x1580e5[_0x9dca('0x39')],null))['then'](respondWithResult(_0x497f0e,null))[_0x9dca('0x37')](handleError(_0x497f0e,null));};exports['destroy']=function(_0x1b62b6,_0x30e28d){return db[_0x9dca('0x21')]['find']({'where':{'id':_0x1b62b6[_0x9dca('0x2a')]['id']}})['then'](handleEntityNotFound(_0x30e28d,null))[_0x9dca('0x18')](removeEntity(_0x30e28d,null))['catch'](handleError(_0x30e28d,null));};exports[_0x9dca('0x3b')]=function(_0x26d73e,_0x424157){return db['FaxInteraction'][_0x9dca('0x3b')]()['then'](respondWithResult(_0x424157,null))[_0x9dca('0x37')](handleError(_0x424157,null));};exports['addMessage']=function(_0x34f743,_0x370e4f){return db[_0x9dca('0x3c')][_0x9dca('0x3a')]({'where':{'id':_0x34f743[_0x9dca('0x2a')]['id']}})[_0x9dca('0x18')](handleEntityNotFound(_0x370e4f,null))[_0x9dca('0x18')](function(_0x56adf9){if(_0x56adf9){return _0x56adf9[_0x9dca('0x3d')](_0x34f743[_0x9dca('0x39')][_0x9dca('0x3e')],_['omit'](_0x34f743['body'],['ids','id'])||{});}})[_0x9dca('0x18')](respondWithResult(_0x370e4f,null))[_0x9dca('0x37')](handleError(_0x370e4f,null));};exports[_0x9dca('0x3f')]=function(_0x2517c5,_0x2c22d1){var _0x37baea={'raw':![],'where':{}};var _0x332c9e={};var _0x5bc76d={'count':0x0,'rows':[]};return db[_0x9dca('0x21')]['findOne']({'where':{'id':_0x2517c5[_0x9dca('0x2a')]['id']}})[_0x9dca('0x18')](handleEntityNotFound(_0x2c22d1,null))[_0x9dca('0x18')](function(_0x482b67){if(_0x482b67){_0x332c9e[_0x9dca('0x2b')]=_['keys'](db[_0x9dca('0x3c')]['rawAttributes']);_0x332c9e['query']=_[_0x9dca('0x2c')](_0x2517c5[_0x9dca('0x28')]);_0x332c9e['filters']=_['intersection'](_0x332c9e['model'],_0x332c9e['query']);_0x37baea[_0x9dca('0x30')]=_[_0x9dca('0x2e')](_0x332c9e[_0x9dca('0x2b')],qs[_0x9dca('0x2f')](_0x2517c5[_0x9dca('0x28')][_0x9dca('0x2f')]));_0x37baea['attributes']=_0x37baea[_0x9dca('0x30')][_0x9dca('0x31')]?_0x37baea[_0x9dca('0x30')]:_0x332c9e[_0x9dca('0x2b')];if(!_0x2517c5['query']['hasOwnProperty'](_0x9dca('0x40'))){_0x37baea['limit']=qs[_0x9dca('0x15')](_0x2517c5[_0x9dca('0x28')][_0x9dca('0x15')]);_0x37baea[_0x9dca('0x14')]=qs[_0x9dca('0x14')](_0x2517c5['query'][_0x9dca('0x14')]);}_0x37baea[_0x9dca('0x41')]=qs[_0x9dca('0x42')](_0x2517c5[_0x9dca('0x28')][_0x9dca('0x42')]);_0x37baea['where']=qs[_0x9dca('0x2d')](_[_0x9dca('0x43')](_0x2517c5[_0x9dca('0x28')],_0x332c9e['filters']));_0x37baea[_0x9dca('0x44')][_0x9dca('0x45')]=_0x482b67['id'];if(_0x2517c5[_0x9dca('0x28')][_0x9dca('0x46')]){_0x37baea[_0x9dca('0x44')]=_[_0x9dca('0x34')](_0x37baea['where'],{'$or':_[_0x9dca('0x47')](_0x37baea[_0x9dca('0x30')],function(_0x4766fd){var _0x419416={};_0x419416[_0x4766fd]={'$like':'%'+_0x2517c5[_0x9dca('0x28')]['filter']+'%'};return _0x419416;})});}if(_0x2517c5['query'][_0x9dca('0x48')]){var _0x4267a5=_0x2517c5['query']['$gte'][_0x9dca('0x49')](',');var _0x27b5cc={};_0x27b5cc[_0x4267a5[0x0]]={'$gte':moment(_0x4267a5[0x1])[_0x9dca('0x4a')](_0x9dca('0x4b'))};_0x37baea[_0x9dca('0x44')]=_['merge'](_0x37baea[_0x9dca('0x44')],_0x27b5cc);}_0x37baea=_[_0x9dca('0x34')]({},_0x37baea,_0x2517c5[_0x9dca('0x35')]);return db['FaxMessage']['count']({'where':_0x37baea[_0x9dca('0x44')]})[_0x9dca('0x18')](function(_0x57e8b1){_0x5bc76d[_0x9dca('0x16')]=_0x57e8b1;if(_0x2517c5[_0x9dca('0x28')][_0x9dca('0x32')]){_0x37baea[_0x9dca('0x33')]=[{'all':!![]}];}return db[_0x9dca('0x3c')][_0x9dca('0x4c')](_0x37baea);})[_0x9dca('0x18')](function(_0xd4a95d){_0x5bc76d['rows']=_0xd4a95d;return _0x5bc76d;});}})[_0x9dca('0x18')](respondWithFilteredResult(_0x2c22d1,_0x37baea))[_0x9dca('0x37')](handleError(_0x2c22d1,null));};exports[_0x9dca('0x4d')]=function(_0x31e532,_0x57c8b6){return db[_0x9dca('0x21')][_0x9dca('0x3a')]({'where':{'id':_0x31e532[_0x9dca('0x2a')]['id']}})['then'](handleEntityNotFound(_0x57c8b6,null))['then'](function(_0x372932){if(_0x372932){return _0x372932[_0x9dca('0x4e')](_0x31e532[_0x9dca('0x39')]['ids'],_[_0x9dca('0x4f')](_0x31e532[_0x9dca('0x39')],[_0x9dca('0x3e'),'id'])||{})[_0x9dca('0x50')](function(){return db[_0x9dca('0x51')][_0x9dca('0x4c')]({'attributes':['id',_0x9dca('0x1e'),'color'],'where':{'id':_0x31e532[_0x9dca('0x39')][_0x9dca('0x3e')]}});})[_0x9dca('0x18')](function(_0x502b00){socket['emit'](_0x9dca('0x52'),{'id':Number(_0x31e532[_0x9dca('0x2a')]['id']),'tags':_0x502b00||[]});return{'id':Number(_0x31e532[_0x9dca('0x2a')]['id']),'tags':_0x502b00||[]};});}})[_0x9dca('0x18')](respondWithResult(_0x57c8b6,null))[_0x9dca('0x37')](handleError(_0x57c8b6,null));};exports[_0x9dca('0x53')]=function(_0x3a9494,_0x475dc0){return db[_0x9dca('0x21')][_0x9dca('0x3a')]({'where':{'id':_0x3a9494[_0x9dca('0x2a')]['id']}})['then'](handleEntityNotFound(_0x475dc0,null))['then'](function(_0x3fccaa){if(_0x3fccaa){return _0x3fccaa['removeTags'](_0x3a9494[_0x9dca('0x28')][_0x9dca('0x3e')]);}})['then'](respondWithStatusCode(_0x475dc0,null))[_0x9dca('0x37')](handleError(_0x475dc0,null));};exports[_0x9dca('0x54')]=function(_0x2885d0,_0x4865ea){var _0x5ddda3=moment()[_0x9dca('0x55')]()[_0x9dca('0x56')]();var _0x33abec=path[_0x9dca('0x57')](config['root'],_0x9dca('0x58'),_0x9dca('0x59'),_0x9dca('0x5a'));var _0x843dfb=path['join'](config['root'],_0x9dca('0x58'),_0x9dca('0x59'),_0x9dca('0x5b'));var _0x6360e5=path['join'](_0x33abec,_0x5ddda3);var _0x5d0330=util[_0x9dca('0x4a')](_0x9dca('0x5c'),_0x2885d0[_0x9dca('0x2a')]['id'],_0x5ddda3);var _0x2e832f=path['join'](_0x33abec,_0x5d0330);var _0x313447=[];_0x313447[_0x9dca('0x5d')]({'model':db[_0x9dca('0x5e')],'as':_0x9dca('0x5e'),'raw':!![]});var _0xece528=[{'model':db[_0x9dca('0x3c')],'as':_0x9dca('0x5f'),'attributes':['id',_0x9dca('0x39'),_0x9dca('0x60')],'include':_0x313447}];return db[_0x9dca('0x21')]['find']({'where':{'id':_0x2885d0[_0x9dca('0x2a')]['id']},'include':_0xece528})['then'](handleEntityNotFound(_0x4865ea,null))[_0x9dca('0x18')](function(_0x5a8092){if(_0x5a8092&&_0x5a8092[_0x9dca('0x5f')]){var _0x15e5d7=_0x5a8092[_0x9dca('0x61')]({'plain':!![]});fs[_0x9dca('0x62')](_0x6360e5);for(var _0x39d8a0=0x0;_0x39d8a0<_0x15e5d7[_0x9dca('0x5f')]['length'];_0x39d8a0++){var _0x1bacd5=_0x15e5d7['Messages'][_0x39d8a0][_0x9dca('0x5e')];if(_0x1bacd5){var _0x378a76=path[_0x9dca('0x57')](_0x843dfb,_0x1bacd5[_0x9dca('0x63')]);if(fs[_0x9dca('0x64')](_0x378a76)){fs['createReadStream'](_0x378a76)['pipe'](fs[_0x9dca('0x65')](path[_0x9dca('0x57')](_0x6360e5,_0x1bacd5['basename'])));}}}return BPromise[_0x9dca('0x66')]()['then'](function(){return new BPromise(function(_0x4d1da2,_0x4e6114){zipdir(_0x6360e5,{'saveTo':_0x2e832f},function(_0x303845,_0xfc4668){if(_0x303845)return _0x4e6114(_0x303845);return _0x4d1da2(_0xfc4668);});})[_0x9dca('0x18')](function(){return new BPromise(function(_0x8c43eb,_0x3ea3df){rimraf(_0x6360e5,function(_0xe0a621){if(_0xe0a621)_0x3ea3df(_0xe0a621);return _0x8c43eb();});});})[_0x9dca('0x18')](function(){return _0x4865ea[_0x9dca('0x54')](_0x2e832f,_0x5d0330,function(_0x16ad45){if(_0x16ad45){console[_0x9dca('0x67')](_0x9dca('0x68'),_0x16ad45);}else{fs['unlinkSync'](_0x2e832f);}});});});}else{return _0x4865ea[_0x9dca('0x1b')](0xc8);}})[_0x9dca('0x37')](handleError(_0x4865ea,null));}; \ No newline at end of file +var _0x75be=['addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','undefined','limit','offset','count','then','destroy','error','stack','name','index','map','FaxInteraction','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','filter','where','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75be,0x7f));var _0xe75b=function(_0x4e996f,_0x4baca6){_0x4e996f=_0x4e996f-0x0;var _0x36127d=_0x75be[_0x4e996f];return _0x36127d;};'use strict';var rimraf=require(_0xe75b('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xe75b('0x1'));var util=require(_0xe75b('0x2'));var path=require(_0xe75b('0x3'));var fs=require('fs');var _=require(_0xe75b('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xe75b('0x5'));var logger=require(_0xe75b('0x6'))(_0xe75b('0x7'));var config=require(_0xe75b('0x8'));var db=require(_0xe75b('0x9'))['db'];config['redis']=_[_0xe75b('0xa')](config[_0xe75b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe75b('0xc'))(new Redis(config['redis']));require(_0xe75b('0xd'))['register'](socket);function respondWithStatusCode(_0x6860f7,_0x2b2d5e){_0x2b2d5e=_0x2b2d5e||0xcc;return function(_0x56418f){if(_0x56418f){return _0x6860f7[_0xe75b('0xe')](_0x2b2d5e);}return _0x6860f7[_0xe75b('0xf')](_0x2b2d5e)[_0xe75b('0x10')]();};}function respondWithResult(_0x3e6cfe,_0xe009f0){_0xe009f0=_0xe009f0||0xc8;return function(_0x28cd5f){if(_0x28cd5f){return _0x3e6cfe[_0xe75b('0xf')](_0xe009f0)[_0xe75b('0x11')](_0x28cd5f);}};}function respondWithFilteredResult(_0x36d733,_0x52f339){return function(_0x1ea71a){if(_0x1ea71a){var _0x3c8abd=typeof _0x52f339['offset']===_0xe75b('0x12')&&typeof _0x52f339[_0xe75b('0x13')]===_0xe75b('0x12');var _0x40c6e1=_0x1ea71a['count'];var _0x114d6d=_0x3c8abd?0x0:_0x52f339[_0xe75b('0x14')];var _0x532a39=_0x3c8abd?_0x1ea71a[_0xe75b('0x15')]:_0x52f339['offset']+_0x52f339['limit'];var _0x1b1327;if(_0x532a39>=_0x40c6e1){_0x532a39=_0x40c6e1;_0x1b1327=0xc8;}else{_0x1b1327=0xce;}_0x36d733[_0xe75b('0xf')](_0x1b1327);return _0x36d733['set']('Content-Range',_0x114d6d+'-'+_0x532a39+'/'+_0x40c6e1)[_0xe75b('0x11')](_0x1ea71a);}return null;};}function saveUpdates(_0xc648e8){return function(_0xd4497d){if(_0xd4497d){return _0xd4497d['update'](_0xc648e8)[_0xe75b('0x16')](function(_0x216689){return _0x216689;});}return null;};}function removeEntity(_0x396519){return function(_0x3f0077){if(_0x3f0077){return _0x3f0077[_0xe75b('0x17')]()[_0xe75b('0x16')](function(){_0x396519[_0xe75b('0xf')](0xcc)[_0xe75b('0x10')]();});}};}function handleEntityNotFound(_0x540106){return function(_0x44037e){if(!_0x44037e){_0x540106[_0xe75b('0xe')](0x194);}return _0x44037e;};}function handleError(_0x367a2f,_0x8cd82b){_0x8cd82b=_0x8cd82b||0x1f4;return function(_0x2d403c){logger[_0xe75b('0x18')](_0x2d403c[_0xe75b('0x19')]);if(_0x2d403c[_0xe75b('0x1a')]){delete _0x2d403c['name'];}_0x367a2f[_0xe75b('0xf')](_0x8cd82b)['send'](_0x2d403c);};}exports[_0xe75b('0x1b')]=function(_0x35e079,_0x31d019){var _0x5b31c9={};var _0x1fd436=_[_0xe75b('0x1c')](db[_0xe75b('0x1d')]['rawAttributes'],function(_0x3e1b38){return{'name':_0x3e1b38['fieldName'],'type':_0x3e1b38[_0xe75b('0x1e')][_0xe75b('0x1f')]};});_0x5b31c9=qs[_0xe75b('0x20')](_0x1fd436,_0x35e079);return interaction[_0xe75b('0x21')](_0xe75b('0x22'),_0x35e079[_0xe75b('0x23')],_0x35e079[_0xe75b('0x24')],_0x5b31c9,_0x1fd436)['then'](respondWithFilteredResult(_0x31d019,_0x5b31c9))[_0xe75b('0x25')](handleError(_0x31d019,null));};exports[_0xe75b('0x26')]=function(_0x5584ab,_0x42f0eb){var _0x2da88c={'raw':![],'where':{'id':_0x5584ab[_0xe75b('0x27')]['id']}},_0xc046cc={};_0xc046cc[_0xe75b('0x28')]=_[_0xe75b('0x29')](db[_0xe75b('0x1d')][_0xe75b('0x2a')]);_0xc046cc[_0xe75b('0x23')]=_[_0xe75b('0x29')](_0x5584ab[_0xe75b('0x23')]);_0xc046cc[_0xe75b('0x2b')]=_['intersection'](_0xc046cc['model'],_0xc046cc[_0xe75b('0x23')]);_0x2da88c['attributes']=_[_0xe75b('0x2c')](_0xc046cc[_0xe75b('0x28')],qs['fields'](_0x5584ab[_0xe75b('0x23')][_0xe75b('0x2d')]));_0x2da88c[_0xe75b('0x2e')]=_0x2da88c[_0xe75b('0x2e')]['length']?_0x2da88c[_0xe75b('0x2e')]:_0xc046cc['model'];if(_0x5584ab[_0xe75b('0x23')]['includeAll']){_0x2da88c['include']=[{'all':!![]}];}_0x2da88c=_['merge']({},_0x2da88c,_0x5584ab[_0xe75b('0x2f')]);return db['FaxInteraction'][_0xe75b('0x30')](_0x2da88c)[_0xe75b('0x16')](handleEntityNotFound(_0x42f0eb,null))['then'](respondWithResult(_0x42f0eb,null))['catch'](handleError(_0x42f0eb,null));};exports[_0xe75b('0x31')]=function(_0x399bbf,_0x3ffe41){return db[_0xe75b('0x1d')][_0xe75b('0x31')](_0x399bbf[_0xe75b('0x32')],{})[_0xe75b('0x16')](respondWithResult(_0x3ffe41,0xc9))[_0xe75b('0x25')](handleError(_0x3ffe41,null));};exports['update']=function(_0x3836f7,_0x23661a){if(_0x3836f7['body']['id']){delete _0x3836f7[_0xe75b('0x32')]['id'];}return db[_0xe75b('0x1d')][_0xe75b('0x30')]({'where':{'id':_0x3836f7[_0xe75b('0x27')]['id']}})['then'](handleEntityNotFound(_0x23661a,null))[_0xe75b('0x16')](saveUpdates(_0x3836f7[_0xe75b('0x32')],null))[_0xe75b('0x16')](respondWithResult(_0x23661a,null))[_0xe75b('0x25')](handleError(_0x23661a,null));};exports[_0xe75b('0x17')]=function(_0x22085e,_0x36e93a){return db[_0xe75b('0x1d')]['find']({'where':{'id':_0x22085e['params']['id']}})[_0xe75b('0x16')](handleEntityNotFound(_0x36e93a,null))[_0xe75b('0x16')](removeEntity(_0x36e93a,null))[_0xe75b('0x25')](handleError(_0x36e93a,null));};exports['describe']=function(_0x5410b9,_0x59ef5e){return db[_0xe75b('0x1d')][_0xe75b('0x33')]()[_0xe75b('0x16')](respondWithResult(_0x59ef5e,null))[_0xe75b('0x25')](handleError(_0x59ef5e,null));};exports[_0xe75b('0x34')]=function(_0x4be4f4,_0x19fbe5){return db[_0xe75b('0x35')][_0xe75b('0x30')]({'where':{'id':_0x4be4f4[_0xe75b('0x27')]['id']}})[_0xe75b('0x16')](handleEntityNotFound(_0x19fbe5,null))[_0xe75b('0x16')](function(_0xca2c48){if(_0xca2c48){return _0xca2c48[_0xe75b('0x34')](_0x4be4f4['body'][_0xe75b('0x36')],_[_0xe75b('0x37')](_0x4be4f4['body'],[_0xe75b('0x36'),'id'])||{});}})['then'](respondWithResult(_0x19fbe5,null))['catch'](handleError(_0x19fbe5,null));};exports['getMessages']=function(_0x26d5d4,_0x47f64f){var _0x16bd7e={'raw':![],'where':{}};var _0xb04ec8={};var _0x45c5ce={'count':0x0,'rows':[]};return db[_0xe75b('0x1d')][_0xe75b('0x38')]({'where':{'id':_0x26d5d4['params']['id']}})['then'](handleEntityNotFound(_0x47f64f,null))[_0xe75b('0x16')](function(_0x10b56f){if(_0x10b56f){_0xb04ec8[_0xe75b('0x28')]=_[_0xe75b('0x29')](db[_0xe75b('0x35')][_0xe75b('0x2a')]);_0xb04ec8[_0xe75b('0x23')]=_[_0xe75b('0x29')](_0x26d5d4['query']);_0xb04ec8['filters']=_[_0xe75b('0x2c')](_0xb04ec8[_0xe75b('0x28')],_0xb04ec8['query']);_0x16bd7e[_0xe75b('0x2e')]=_['intersection'](_0xb04ec8[_0xe75b('0x28')],qs[_0xe75b('0x2d')](_0x26d5d4[_0xe75b('0x23')][_0xe75b('0x2d')]));_0x16bd7e[_0xe75b('0x2e')]=_0x16bd7e[_0xe75b('0x2e')]['length']?_0x16bd7e[_0xe75b('0x2e')]:_0xb04ec8[_0xe75b('0x28')];if(!_0x26d5d4[_0xe75b('0x23')][_0xe75b('0x39')](_0xe75b('0x3a'))){_0x16bd7e[_0xe75b('0x13')]=qs[_0xe75b('0x13')](_0x26d5d4['query'][_0xe75b('0x13')]);_0x16bd7e[_0xe75b('0x14')]=qs[_0xe75b('0x14')](_0x26d5d4['query'][_0xe75b('0x14')]);}_0x16bd7e[_0xe75b('0x3b')]=qs[_0xe75b('0x3c')](_0x26d5d4[_0xe75b('0x23')][_0xe75b('0x3c')]);_0x16bd7e['where']=qs[_0xe75b('0x2b')](_['pick'](_0x26d5d4[_0xe75b('0x23')],_0xb04ec8['filters']));_0x16bd7e['where']['FaxInteractionId']=_0x10b56f['id'];if(_0x26d5d4['query'][_0xe75b('0x3d')]){_0x16bd7e[_0xe75b('0x3e')]=_[_0xe75b('0x3f')](_0x16bd7e[_0xe75b('0x3e')],{'$or':_[_0xe75b('0x1c')](_0x16bd7e[_0xe75b('0x2e')],function(_0x2a2357){var _0x4d5b1d={};_0x4d5b1d[_0x2a2357]={'$like':'%'+_0x26d5d4[_0xe75b('0x23')][_0xe75b('0x3d')]+'%'};return _0x4d5b1d;})});}if(_0x26d5d4[_0xe75b('0x23')][_0xe75b('0x40')]){var _0x30ded3=_0x26d5d4[_0xe75b('0x23')][_0xe75b('0x40')][_0xe75b('0x41')](',');var _0x1ae61d={};_0x1ae61d[_0x30ded3[0x0]]={'$gte':moment(_0x30ded3[0x1])[_0xe75b('0x42')](_0xe75b('0x43'))};_0x16bd7e[_0xe75b('0x3e')]=_[_0xe75b('0x3f')](_0x16bd7e['where'],_0x1ae61d);}_0x16bd7e=_['merge']({},_0x16bd7e,_0x26d5d4[_0xe75b('0x2f')]);return db['FaxMessage'][_0xe75b('0x15')]({'where':_0x16bd7e[_0xe75b('0x3e')]})[_0xe75b('0x16')](function(_0x1e89a0){_0x45c5ce[_0xe75b('0x15')]=_0x1e89a0;if(_0x26d5d4[_0xe75b('0x23')]['includeAll']){_0x16bd7e[_0xe75b('0x44')]=[{'all':!![]}];}return db[_0xe75b('0x35')][_0xe75b('0x21')](_0x16bd7e);})[_0xe75b('0x16')](function(_0x3670e0){_0x45c5ce['rows']=_0x3670e0;return _0x45c5ce;});}})[_0xe75b('0x16')](respondWithFilteredResult(_0x47f64f,_0x16bd7e))[_0xe75b('0x25')](handleError(_0x47f64f,null));};exports[_0xe75b('0x45')]=function(_0x3da451,_0x495447){return db[_0xe75b('0x1d')][_0xe75b('0x30')]({'where':{'id':_0x3da451[_0xe75b('0x27')]['id']}})[_0xe75b('0x16')](handleEntityNotFound(_0x495447,null))[_0xe75b('0x16')](function(_0x5dacff){if(_0x5dacff){return _0x5dacff[_0xe75b('0x46')](_0x3da451[_0xe75b('0x32')][_0xe75b('0x36')],_['omit'](_0x3da451[_0xe75b('0x32')],[_0xe75b('0x36'),'id'])||{})[_0xe75b('0x47')](function(){return db[_0xe75b('0x48')][_0xe75b('0x21')]({'attributes':['id',_0xe75b('0x1a'),_0xe75b('0x49')],'where':{'id':_0x3da451[_0xe75b('0x32')][_0xe75b('0x36')]}});})[_0xe75b('0x16')](function(_0x32742e){socket['emit'](_0xe75b('0x4a'),{'id':Number(_0x3da451[_0xe75b('0x27')]['id']),'tags':_0x32742e||[]});return{'id':Number(_0x3da451[_0xe75b('0x27')]['id']),'tags':_0x32742e||[]};});}})[_0xe75b('0x16')](respondWithResult(_0x495447,null))['catch'](handleError(_0x495447,null));};exports[_0xe75b('0x4b')]=function(_0x1f74d1,_0xdd3931){return db[_0xe75b('0x1d')]['find']({'where':{'id':_0x1f74d1[_0xe75b('0x27')]['id']}})[_0xe75b('0x16')](handleEntityNotFound(_0xdd3931,null))[_0xe75b('0x16')](function(_0x118dca){if(_0x118dca){return _0x118dca[_0xe75b('0x4b')](_0x1f74d1[_0xe75b('0x23')]['ids']);}})['then'](respondWithStatusCode(_0xdd3931,null))['catch'](handleError(_0xdd3931,null));};exports[_0xe75b('0x4c')]=function(_0x5e26a8,_0x1e9a1d){var _0x5e0ecc=moment()[_0xe75b('0x4d')]()[_0xe75b('0x4e')]();var _0x636286=path[_0xe75b('0x4f')](config['root'],_0xe75b('0x50'),_0xe75b('0x51'),'tmp');var _0x179aba=path['join'](config['root'],_0xe75b('0x50'),_0xe75b('0x51'),_0xe75b('0x52'));var _0x1fe3e2=path['join'](_0x636286,_0x5e0ecc);var _0xccee4f=util[_0xe75b('0x42')](_0xe75b('0x53'),_0x5e26a8[_0xe75b('0x27')]['id'],_0x5e0ecc);var _0x32324d=path[_0xe75b('0x4f')](_0x636286,_0xccee4f);var _0x35e24a=[];_0x35e24a[_0xe75b('0x54')]({'model':db[_0xe75b('0x55')],'as':_0xe75b('0x55'),'raw':!![]});var _0x22e01f=[{'model':db[_0xe75b('0x35')],'as':_0xe75b('0x56'),'attributes':['id',_0xe75b('0x32'),'createdAt'],'include':_0x35e24a}];return db[_0xe75b('0x1d')][_0xe75b('0x30')]({'where':{'id':_0x5e26a8['params']['id']},'include':_0x22e01f})['then'](handleEntityNotFound(_0x1e9a1d,null))[_0xe75b('0x16')](function(_0xc183ef){if(_0xc183ef&&_0xc183ef[_0xe75b('0x56')]){var _0x5f3675=_0xc183ef[_0xe75b('0x57')]({'plain':!![]});fs[_0xe75b('0x58')](_0x1fe3e2);for(var _0x87ff3b=0x0;_0x87ff3b<_0x5f3675['Messages']['length'];_0x87ff3b++){var _0x5a4857=_0x5f3675[_0xe75b('0x56')][_0x87ff3b]['Attachment'];if(_0x5a4857){var _0x2a9d2e=path['join'](_0x179aba,_0x5a4857[_0xe75b('0x59')]);if(fs[_0xe75b('0x5a')](_0x2a9d2e)){fs[_0xe75b('0x5b')](_0x2a9d2e)[_0xe75b('0x5c')](fs[_0xe75b('0x5d')](path[_0xe75b('0x4f')](_0x1fe3e2,_0x5a4857[_0xe75b('0x59')])));}}}return BPromise[_0xe75b('0x5e')]()[_0xe75b('0x16')](function(){return new BPromise(function(_0x51d5d0,_0x4e155c){zipdir(_0x1fe3e2,{'saveTo':_0x32324d},function(_0x4e5bbd,_0x3c1963){if(_0x4e5bbd)return _0x4e155c(_0x4e5bbd);return _0x51d5d0(_0x3c1963);});})[_0xe75b('0x16')](function(){return new BPromise(function(_0x16c4c0,_0x298e8c){rimraf(_0x1fe3e2,function(_0x2b22a3){if(_0x2b22a3)_0x298e8c(_0x2b22a3);return _0x16c4c0();});});})[_0xe75b('0x16')](function(){return _0x1e9a1d[_0xe75b('0x4c')](_0x32324d,_0xccee4f,function(_0x572a83){if(_0x572a83){console[_0xe75b('0x5f')](_0xe75b('0x60'),_0x572a83);}else{fs[_0xe75b('0x61')](_0x32324d);}});});});}else{return _0x1e9a1d['sendStatus'](0xc8);}})['catch'](handleError(_0x1e9a1d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index af76e8f..c539d19 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 _0x0a8b=['setMaxListeners','save','update','remove','getUsers','then','Users','map','setDataValue','length','emit','hasOwnProperty','hook','exports','FaxInteraction'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x0a8b,0xc2));var _0xb0a8=function(_0x28a09a,_0x207774){_0x28a09a=_0x28a09a-0x0;var _0x1bb99e=_0x0a8b[_0x28a09a];return _0x1bb99e;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xb0a8('0x0')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb0a8('0x1')](0x0);var events={'afterCreate':_0xb0a8('0x2'),'afterUpdate':_0xb0a8('0x3'),'afterDestroy':_0xb0a8('0x4')};function emitEvent(_0x15e987){return function(_0x559e05,_0x43908a,_0x4fe09a){_0x559e05[_0xb0a8('0x5')]({'attributes':['id'],'raw':!![]})[_0xb0a8('0x6')](function(_0x4899ac){_0x559e05['setDataValue'](_0xb0a8('0x7'),_0x4899ac[_0xb0a8('0x8')](function(_0x4cea31){return{'id':_0x4cea31['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x559e05['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb0a8('0x6')](function(_0x3a9caf){_0x559e05[_0xb0a8('0x9')]('unreadMessages',_0x3a9caf[_0xb0a8('0xa')]);FaxInteractionEvents['emit'](_0x15e987+':'+_0x559e05['id'],_0x559e05);FaxInteractionEvents[_0xb0a8('0xb')](_0x15e987,_0x559e05);_0x4fe09a(null);})['catch'](_0x4fe09a(null));};}for(var e in events){if(events[_0xb0a8('0xc')](e)){var event=events[e];FaxInteraction[_0xb0a8('0xd')](e,emitEvent(event));}}module[_0xb0a8('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x911c=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x911c,0xe5));var _0xc911=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x911c[_0x54bac5];return _0xc15971;};'use strict';var EventEmitter=require(_0xc911('0x0'));var FaxInteraction=require(_0xc911('0x1'))['db'][_0xc911('0x2')];var FaxMessage=require(_0xc911('0x1'))['db'][_0xc911('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc911('0x4')](0x0);var events={'afterCreate':_0xc911('0x5'),'afterUpdate':_0xc911('0x6'),'afterDestroy':'remove'};function emitEvent(_0x288157){return function(_0x12b41c,_0x58ec26,_0x1f5b83){_0x12b41c[_0xc911('0x7')]({'attributes':['id'],'raw':!![]})[_0xc911('0x8')](function(_0x331899){_0x12b41c[_0xc911('0x9')](_0xc911('0xa'),_0x331899[_0xc911('0xb')](function(_0x3761fd){return{'id':_0x3761fd['id']};}));return FaxMessage[_0xc911('0xc')]({'where':{'FaxInteractionId':_0x12b41c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5b1e06){_0x12b41c[_0xc911('0x9')](_0xc911('0xd'),_0x5b1e06['length']);FaxInteractionEvents[_0xc911('0xe')](_0x288157+':'+_0x12b41c['id'],_0x12b41c);FaxInteractionEvents[_0xc911('0xe')](_0x288157,_0x12b41c);_0x1f5b83(null);})[_0xc911('0xf')](_0x1f5b83(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xc911('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 572d138..57a876c 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 _0x346a=['path','../../config/environment','./faxInteraction.attributes','define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird'];(function(_0x1f84a5,_0x1db62f){var _0x4dc630=function(_0x4a3d8d){while(--_0x4a3d8d){_0x1f84a5['push'](_0x1f84a5['shift']());}};_0x4dc630(++_0x1db62f);}(_0x346a,0x74));var _0xa346=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x346a[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xa346('0x0'));var util=require(_0xa346('0x1'));var logger=require('../../config/logger')(_0xa346('0x2'));var moment=require('moment');var BPromise=require(_0xa346('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa346('0x4'));var rimraf=require('rimraf');var config=require(_0xa346('0x5'));var attributes=require(_0xa346('0x6'));module['exports']=function(_0x216aa0,_0x153a42){return _0x216aa0[_0xa346('0x7')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x451ecf,_0x1d14a0,_0x432dc6){if(_0x451ecf['changed'](_0xa346('0x8'))){_0x451ecf[_0xa346('0x9')]=moment()[_0xa346('0xa')](_0xa346('0xb'));}_0x432dc6(null,_0x451ecf);}}});}; \ No newline at end of file +var _0x02fe=['exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x295987,_0x46b20f){var _0x23a148=function(_0x1e9888){while(--_0x1e9888){_0x295987['push'](_0x295987['shift']());}};_0x23a148(++_0x46b20f);}(_0x02fe,0x1b8));var _0xe02f=function(_0x40bff5,_0x2273c8){_0x40bff5=_0x40bff5-0x0;var _0x1f2558=_0x02fe[_0x40bff5];return _0x1f2558;};'use strict';var _=require('lodash');var util=require(_0xe02f('0x0'));var logger=require(_0xe02f('0x1'))(_0xe02f('0x2'));var moment=require(_0xe02f('0x3'));var BPromise=require(_0xe02f('0x4'));var rp=require(_0xe02f('0x5'));var fs=require('fs');var path=require(_0xe02f('0x6'));var rimraf=require(_0xe02f('0x7'));var config=require(_0xe02f('0x8'));var attributes=require(_0xe02f('0x9'));module[_0xe02f('0xa')]=function(_0x12a5a3,_0x172a56){return _0x12a5a3[_0xe02f('0xb')](_0xe02f('0xc'),attributes,{'tableName':_0xe02f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x485ea1,_0x24fb5c,_0x4f5a16){if(_0x485ea1[_0xe02f('0xe')](_0xe02f('0xf'))){_0x485ea1[_0xe02f('0x10')]=moment()[_0xe02f('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f5a16(null,_0x485ea1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a59331c..ddc2df9 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 _0x2c5f=['request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x1e68de,_0x3dc2d9){var _0x2a674b=function(_0x5f5ab5){while(--_0x5f5ab5){_0x1e68de['push'](_0x1e68de['shift']());}};_0x2a674b(++_0x3dc2d9);}(_0x2c5f,0xdd));var _0xf2c5=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x2c5f[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0xf2c5('0x0'));var util=require('util');var moment=require(_0xf2c5('0x1'));var BPromise=require(_0xf2c5('0x2'));var rs=require(_0xf2c5('0x3'));var fs=require('fs');var Redis=require(_0xf2c5('0x4'));var db=require(_0xf2c5('0x5'))['db'];var utils=require(_0xf2c5('0x6'));var logger=require(_0xf2c5('0x7'))(_0xf2c5('0x8'));var config=require(_0xf2c5('0x9'));var jayson=require(_0xf2c5('0xa'));var client=jayson[_0xf2c5('0xb')][_0xf2c5('0xc')]({'port':0x232a});config[_0xf2c5('0xd')]=_[_0xf2c5('0xe')](config[_0xf2c5('0xd')],{'host':_0xf2c5('0xf'),'port':0x18eb});var socket=require(_0xf2c5('0x10'))(new Redis(config[_0xf2c5('0xd')]));require(_0xf2c5('0x11'))[_0xf2c5('0x12')](socket);function respondWithRpcPromise(_0x6dfeb3,_0x5017cf,_0x193908){return new BPromise(function(_0x4e2248,_0x5e518c){return client[_0xf2c5('0x13')](_0x6dfeb3,_0x193908)[_0xf2c5('0x14')](function(_0x5c3ddc){logger[_0xf2c5('0x15')](_0xf2c5('0x16'),_0x5017cf,_0xf2c5('0x17'));logger[_0xf2c5('0x18')](_0xf2c5('0x19'),_0x5017cf,_0xf2c5('0x17'),JSON[_0xf2c5('0x1a')](_0x5c3ddc));if(_0x5c3ddc[_0xf2c5('0x1b')]){if(_0x5c3ddc[_0xf2c5('0x1b')][_0xf2c5('0x1c')]===0x1f4){logger['error'](_0xf2c5('0x16'),_0x5017cf,_0x5c3ddc['error'][_0xf2c5('0x1d')]);return _0x5e518c(_0x5c3ddc['error'][_0xf2c5('0x1d')]);}logger[_0xf2c5('0x1b')](_0xf2c5('0x16'),_0x5017cf,_0x5c3ddc[_0xf2c5('0x1b')][_0xf2c5('0x1d')]);return _0x4e2248(_0x5c3ddc[_0xf2c5('0x1b')]['message']);}else{logger[_0xf2c5('0x15')](_0xf2c5('0x16'),_0x5017cf,_0xf2c5('0x17'));_0x4e2248(_0x5c3ddc[_0xf2c5('0x1e')][_0xf2c5('0x1d')]);}})[_0xf2c5('0x1f')](function(_0x4eec48){logger[_0xf2c5('0x1b')]('FaxInteraction,\x20%s,\x20%s',_0x5017cf,_0x4eec48);_0x5e518c(_0x4eec48);});});}exports['UpdateFaxInteraction']=function(_0x38bdd2){var _0x517d3c=this;return new Promise(function(_0x2db1a5,_0x3aad0f){return db['FaxInteraction'][_0xf2c5('0x20')](_0x38bdd2['body'],{'raw':_0x38bdd2[_0xf2c5('0x21')]?_0x38bdd2[_0xf2c5('0x21')][_0xf2c5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38bdd2[_0xf2c5('0x21')]?_0x38bdd2[_0xf2c5('0x21')][_0xf2c5('0x23')]||null:null,'attributes':_0x38bdd2[_0xf2c5('0x21')]?_0x38bdd2[_0xf2c5('0x21')][_0xf2c5('0x24')]||null:null,'limit':_0x38bdd2['options']?_0x38bdd2['options'][_0xf2c5('0x25')]||null:null})[_0xf2c5('0x14')](function(_0x1e197f){logger[_0xf2c5('0x15')](_0xf2c5('0x26'),_0x38bdd2);logger[_0xf2c5('0x18')](_0xf2c5('0x26'),_0x38bdd2,JSON[_0xf2c5('0x1a')](_0x1e197f));_0x2db1a5(_0x1e197f);})[_0xf2c5('0x1f')](function(_0x2a73e6){logger[_0xf2c5('0x1b')](_0xf2c5('0x26'),_0x2a73e6['message'],_0x38bdd2);_0x3aad0f(_0x517d3c['error'](0x1f4,_0x2a73e6[_0xf2c5('0x1d')]));});});};exports[_0xf2c5('0x27')]=function(_0x21b2e2){return new Promise(function(_0x29a9ac,_0x47fceb){return db[_0xf2c5('0x28')][_0xf2c5('0x29')]({'where':_0x21b2e2[_0xf2c5('0x21')]?_0x21b2e2[_0xf2c5('0x21')][_0xf2c5('0x23')]||null:null})[_0xf2c5('0x14')](function(_0x535032){if(_0x535032){return _0x535032[_0xf2c5('0x2a')](_0x21b2e2[_0xf2c5('0x2b')][_0xf2c5('0x2c')],_[_0xf2c5('0x2d')](_0x21b2e2[_0xf2c5('0x2b')],[_0xf2c5('0x2c'),'id'])||{});}})[_0xf2c5('0x2e')](function(_0x55a48e){logger['info'](_0xf2c5('0x2f'),_0x21b2e2);logger['debug'](_0xf2c5('0x2f'),_0x21b2e2,JSON[_0xf2c5('0x1a')](_0x55a48e));_0x29a9ac(_0x55a48e);})[_0xf2c5('0x1f')](function(_0xf6ae25){logger[_0xf2c5('0x1b')](_0xf2c5('0x2f'),_0xf6ae25[_0xf2c5('0x1d')],_0x21b2e2);_0x47fceb(_this[_0xf2c5('0x1b')](0x1f4,_0xf6ae25[_0xf2c5('0x1d')]));});});}; \ No newline at end of file +var _0xc857=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxInteraction','body','options','where','attributes','UpdateFaxInteraction'];(function(_0xeb1fc5,_0x103712){var _0x57a5ce=function(_0x59292a){while(--_0x59292a){_0xeb1fc5['push'](_0xeb1fc5['shift']());}};_0x57a5ce(++_0x103712);}(_0xc857,0xcc));var _0x7c85=function(_0x4d025c,_0x4b4d12){_0x4d025c=_0x4d025c-0x0;var _0x1d0c6a=_0xc857[_0x4d025c];return _0x1d0c6a;};'use strict';var _=require(_0x7c85('0x0'));var util=require(_0x7c85('0x1'));var moment=require(_0x7c85('0x2'));var BPromise=require(_0x7c85('0x3'));var rs=require(_0x7c85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c85('0x5'))['db'];var utils=require(_0x7c85('0x6'));var logger=require(_0x7c85('0x7'))(_0x7c85('0x8'));var config=require(_0x7c85('0x9'));var jayson=require(_0x7c85('0xa'));var client=jayson[_0x7c85('0xb')][_0x7c85('0xc')]({'port':0x232a});config['redis']=_[_0x7c85('0xd')](config[_0x7c85('0xe')],{'host':_0x7c85('0xf'),'port':0x18eb});var socket=require(_0x7c85('0x10'))(new Redis(config[_0x7c85('0xe')]));require(_0x7c85('0x11'))['register'](socket);function respondWithRpcPromise(_0x522d91,_0x33b33b,_0x3324a8){return new BPromise(function(_0x280124,_0x6c1438){return client[_0x7c85('0x12')](_0x522d91,_0x3324a8)[_0x7c85('0x13')](function(_0x4dab91){logger[_0x7c85('0x14')](_0x7c85('0x15'),_0x33b33b,_0x7c85('0x16'));logger[_0x7c85('0x17')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x33b33b,_0x7c85('0x16'),JSON[_0x7c85('0x18')](_0x4dab91));if(_0x4dab91[_0x7c85('0x19')]){if(_0x4dab91[_0x7c85('0x19')][_0x7c85('0x1a')]===0x1f4){logger[_0x7c85('0x19')](_0x7c85('0x15'),_0x33b33b,_0x4dab91[_0x7c85('0x19')][_0x7c85('0x1b')]);return _0x6c1438(_0x4dab91[_0x7c85('0x19')][_0x7c85('0x1b')]);}logger['error'](_0x7c85('0x15'),_0x33b33b,_0x4dab91[_0x7c85('0x19')][_0x7c85('0x1b')]);return _0x280124(_0x4dab91[_0x7c85('0x19')][_0x7c85('0x1b')]);}else{logger[_0x7c85('0x14')](_0x7c85('0x15'),_0x33b33b,_0x7c85('0x16'));_0x280124(_0x4dab91[_0x7c85('0x1c')][_0x7c85('0x1b')]);}})[_0x7c85('0x1d')](function(_0x25a69a){logger[_0x7c85('0x19')](_0x7c85('0x15'),_0x33b33b,_0x25a69a);_0x6c1438(_0x25a69a);});});}exports['UpdateFaxInteraction']=function(_0x28fd0e){var _0x4debff=this;return new Promise(function(_0xf259df,_0x4d5dda){return db[_0x7c85('0x1e')]['update'](_0x28fd0e[_0x7c85('0x1f')],{'raw':_0x28fd0e[_0x7c85('0x20')]?_0x28fd0e[_0x7c85('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fd0e['options']?_0x28fd0e[_0x7c85('0x20')][_0x7c85('0x21')]||null:null,'attributes':_0x28fd0e[_0x7c85('0x20')]?_0x28fd0e[_0x7c85('0x20')][_0x7c85('0x22')]||null:null,'limit':_0x28fd0e[_0x7c85('0x20')]?_0x28fd0e[_0x7c85('0x20')]['limit']||null:null})[_0x7c85('0x13')](function(_0xb20f63){logger[_0x7c85('0x14')](_0x7c85('0x23'),_0x28fd0e);logger[_0x7c85('0x17')](_0x7c85('0x23'),_0x28fd0e,JSON[_0x7c85('0x18')](_0xb20f63));_0xf259df(_0xb20f63);})[_0x7c85('0x1d')](function(_0x38a24d){logger[_0x7c85('0x19')]('UpdateFaxInteraction',_0x38a24d[_0x7c85('0x1b')],_0x28fd0e);_0x4d5dda(_0x4debff[_0x7c85('0x19')](0x1f4,_0x38a24d[_0x7c85('0x1b')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2ed1eb){return new Promise(function(_0x4fd5e6,_0x3836c3){return db['FaxInteraction']['find']({'where':_0x2ed1eb[_0x7c85('0x20')]?_0x2ed1eb[_0x7c85('0x20')][_0x7c85('0x21')]||null:null})[_0x7c85('0x13')](function(_0x59fa10){if(_0x59fa10){return _0x59fa10[_0x7c85('0x24')](_0x2ed1eb[_0x7c85('0x1f')][_0x7c85('0x25')],_['omit'](_0x2ed1eb[_0x7c85('0x1f')],[_0x7c85('0x25'),'id'])||{});}})[_0x7c85('0x26')](function(_0x272ab6){logger[_0x7c85('0x14')]('AddTags',_0x2ed1eb);logger['debug']('AddTags',_0x2ed1eb,JSON[_0x7c85('0x18')](_0x272ab6));_0x4fd5e6(_0x272ab6);})[_0x7c85('0x1d')](function(_0x5a57b8){logger[_0x7c85('0x19')](_0x7c85('0x27'),_0x5a57b8[_0x7c85('0x1b')],_0x2ed1eb);_0x3836c3(_this[_0x7c85('0x19')](0x1f4,_0x5a57b8[_0x7c85('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 82b645c..1df5039 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 _0xca04=['emit','removeListener','register','length','./faxInteraction.events','save','remove'];(function(_0x57743e,_0x4dfb43){var _0x22c153=function(_0x3e5b48){while(--_0x3e5b48){_0x57743e['push'](_0x57743e['shift']());}};_0x22c153(++_0x4dfb43);}(_0xca04,0x131));var _0x4ca0=function(_0x34c372,_0x11ede1){_0x34c372=_0x34c372-0x0;var _0x5253db=_0xca04[_0x34c372];return _0x5253db;};'use strict';var FaxInteractionEvents=require(_0x4ca0('0x0'));var events=[_0x4ca0('0x1'),_0x4ca0('0x2'),'update'];function createListener(_0xdffcac,_0x130686){return function(_0x2f2e6e){_0x130686[_0x4ca0('0x3')](_0xdffcac,_0x2f2e6e);};}function removeListener(_0x1d8b8f,_0x294f20){return function(){FaxInteractionEvents[_0x4ca0('0x4')](_0x1d8b8f,_0x294f20);};}exports[_0x4ca0('0x5')]=function(_0x438ae9){for(var _0x1f1892=0x0,_0x47a818=events[_0x4ca0('0x6')];_0x1f1892<_0x47a818;_0x1f1892++){var _0x2b8fad=events[_0x1f1892];var _0x576c95=createListener('faxInteraction:'+_0x2b8fad,_0x438ae9);FaxInteractionEvents['on'](_0x2b8fad,_0x576c95);}}; \ No newline at end of file +var _0xed5e=['save','remove','update','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x141de0,_0x18bb1e){var _0x576794=function(_0x447c63){while(--_0x447c63){_0x141de0['push'](_0x141de0['shift']());}};_0x576794(++_0x18bb1e);}(_0xed5e,0x117));var _0xeed5=function(_0x52a903,_0x3bab0f){_0x52a903=_0x52a903-0x0;var _0x14a58e=_0xed5e[_0x52a903];return _0x14a58e;};'use strict';var FaxInteractionEvents=require(_0xeed5('0x0'));var events=[_0xeed5('0x1'),_0xeed5('0x2'),_0xeed5('0x3')];function createListener(_0x29739d,_0x3bc976){return function(_0x3b7b2f){_0x3bc976['emit'](_0x29739d,_0x3b7b2f);};}function removeListener(_0x29873c,_0x1888da){return function(){FaxInteractionEvents[_0xeed5('0x4')](_0x29873c,_0x1888da);};}exports[_0xeed5('0x5')]=function(_0x4fee3d){for(var _0x4ca229=0x0,_0x25e092=events[_0xeed5('0x6')];_0x4ca229<_0x25e092;_0x4ca229++){var _0x2cb6f9=events[_0x4ca229];var _0x1fb836=createListener(_0xeed5('0x7')+_0x2cb6f9,_0x4fee3d);FaxInteractionEvents['on'](_0x2cb6f9,_0x1fb836);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0a8b966..d94ed66 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 _0xa91c=['index','/describe','get','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x5cf7cf,_0x1e61c5){var _0x662b75=function(_0x5c1a13){while(--_0x5c1a13){_0x5cf7cf['push'](_0x5cf7cf['shift']());}};_0x662b75(++_0x1e61c5);}(_0xa91c,0x68));var _0xca91=function(_0x4a25e3,_0xffc2aa){_0x4a25e3=_0x4a25e3-0x0;var _0xc2ac02=_0xa91c[_0x4a25e3];return _0xc2ac02;};'use strict';var multer=require('multer');var util=require(_0xca91('0x0'));var path=require(_0xca91('0x1'));var timeout=require(_0xca91('0x2'));var express=require(_0xca91('0x3'));var router=express[_0xca91('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xca91('0x5'));var config=require(_0xca91('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xca91('0x7')](),controller[_0xca91('0x8')]);router['get'](_0xca91('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xca91('0xa')](_0xca91('0xb'),auth[_0xca91('0x7')](),controller[_0xca91('0xc')]);router[_0xca91('0xa')](_0xca91('0xd'),auth[_0xca91('0x7')](),controller['getMessages']);router[_0xca91('0xa')](_0xca91('0xe'),auth[_0xca91('0x7')](),controller[_0xca91('0xf')]);router[_0xca91('0x10')]('/',auth[_0xca91('0x7')](),controller['create']);router[_0xca91('0x10')](_0xca91('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xca91('0x10')](_0xca91('0x11'),auth[_0xca91('0x7')](),interaction[_0xca91('0x12')](_0xca91('0x13'),_0xca91('0x14')),controller[_0xca91('0x15')]);router[_0xca91('0x16')](_0xca91('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xca91('0x13'),_0xca91('0x17')),controller['update']);router[_0xca91('0x18')](_0xca91('0xb'),auth[_0xca91('0x7')](),interaction[_0xca91('0x12')](_0xca91('0x13'),_0xca91('0x19')),controller['destroy']);router['delete'](_0xca91('0x11'),auth[_0xca91('0x7')](),controller[_0xca91('0x1a')]);module[_0xca91('0x1b')]=router; \ No newline at end of file +var _0x2df9=['post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x2df9,0x14d));var _0x92df=function(_0x3d4fa6,_0x5d2c63){_0x3d4fa6=_0x3d4fa6-0x0;var _0x5f46fd=_0x2df9[_0x3d4fa6];return _0x5f46fd;};'use strict';var multer=require(_0x92df('0x0'));var util=require(_0x92df('0x1'));var path=require(_0x92df('0x2'));var timeout=require(_0x92df('0x3'));var express=require(_0x92df('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x92df('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x92df('0x6'));var controller=require(_0x92df('0x7'));router['get']('/',auth[_0x92df('0x8')](),controller[_0x92df('0x9')]);router[_0x92df('0xa')](_0x92df('0xb'),auth[_0x92df('0x8')](),controller[_0x92df('0xc')]);router[_0x92df('0xa')](_0x92df('0xd'),auth[_0x92df('0x8')](),controller[_0x92df('0xe')]);router['get'](_0x92df('0xf'),auth[_0x92df('0x8')](),controller[_0x92df('0x10')]);router['get'](_0x92df('0x11'),auth[_0x92df('0x8')](),controller[_0x92df('0x12')]);router[_0x92df('0x13')]('/',auth['isAuthenticated'](),controller[_0x92df('0x14')]);router[_0x92df('0x13')](_0x92df('0xf'),auth[_0x92df('0x8')](),controller[_0x92df('0x15')]);router['post']('/:id/tags',auth[_0x92df('0x8')](),interaction['tracked'](_0x92df('0x16'),_0x92df('0x17')),controller[_0x92df('0x18')]);router[_0x92df('0x19')](_0x92df('0xd'),auth[_0x92df('0x8')](),interaction[_0x92df('0x1a')]('fax',_0x92df('0x1b')),controller['update']);router[_0x92df('0x1c')](_0x92df('0xd'),auth[_0x92df('0x8')](),interaction[_0x92df('0x1a')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0x92df('0x1c')](_0x92df('0x1d'),auth[_0x92df('0x8')](),controller[_0x92df('0x1e')]);module[_0x92df('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bdb05f6..2e54ae2 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 _0xb821=['TEXT','ENUM','DATE','exports'];(function(_0x2baee8,_0xb53c09){var _0x4fcae0=function(_0x119ff8){while(--_0x119ff8){_0x2baee8['push'](_0x2baee8['shift']());}};_0x4fcae0(++_0xb53c09);}(_0xb821,0xa7));var _0x1b82=function(_0xe3858,_0x3d917e){_0xe3858=_0xe3858-0x0;var _0x567600=_0xb821[_0xe3858];return _0x567600;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'body':{'type':Sequelize[_0x1b82('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1b82('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1b82('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1b82('0x3')]}}; \ No newline at end of file +var _0x5ad3=['exports','TEXT','medium','ENUM','out','DATE','sequelize'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x1dd78b,_0x213fd9){_0x1dd78b=_0x1dd78b-0x0;var _0x2d9bf6=_0x5ad3[_0x1dd78b];return _0x2d9bf6;};'use strict';var Sequelize=require(_0x35ad('0x0'));module[_0x35ad('0x1')]={'body':{'type':Sequelize[_0x35ad('0x2')](_0x35ad('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x35ad('0x4')]('in',_0x35ad('0x5')),'defaultValue':_0x35ad('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x35ad('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x35ad('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 12a33c5..2254054 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 _0x8967=['request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','end','status','json','offset','undefined','count','apply','reject','save','destroy','then','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','update','body','describe','fax-interactions','accept','readAt','format','UserId','user','FaxInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','create','CmContact','isNil','fax','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http'];(function(_0x543fb8,_0xbabd87){var _0x5a8504=function(_0x24149b){while(--_0x24149b){_0x543fb8['push'](_0x543fb8['shift']());}};_0x5a8504(++_0xbabd87);}(_0x8967,0x19b));var _0x7896=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x8967[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7896('0x0'));var zipdir=require(_0x7896('0x1'));var jsonpatch=require(_0x7896('0x2'));var rp=require('request-promise');var moment=require(_0x7896('0x3'));var BPromise=require(_0x7896('0x4'));var Mustache=require('mustache');var util=require(_0x7896('0x5'));var path=require(_0x7896('0x6'));var sox=require(_0x7896('0x7'));var csv=require(_0x7896('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7896('0x9'));var _=require(_0x7896('0xa'));var squel=require(_0x7896('0xb'));var crypto=require(_0x7896('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7896('0xd'));var toCsv=require(_0x7896('0x8'));var querystring=require(_0x7896('0xe'));var Papa=require('papaparse');var Redis=require(_0x7896('0xf'));var authService=require(_0x7896('0x10'));var qs=require(_0x7896('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7896('0x12'))(_0x7896('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7896('0x14'));var db=require(_0x7896('0x15'))['db'];config[_0x7896('0x16')]=_[_0x7896('0x17')](config[_0x7896('0x16')],{'host':_0x7896('0x18'),'port':0x18eb});var socket=require(_0x7896('0x19'))(new Redis(config['redis']));require(_0x7896('0x1a'))[_0x7896('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7896('0x1c')][_0x7896('0x1d')]({'port':0x232c});var client9002=jayson[_0x7896('0x1c')][_0x7896('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x51ade0,_0x52d039,_0xaa817f,_0x45f949){return new BPromise(function(_0x33b670,_0x53ab34){var _0x1a3c0a=_0x45f949||client;return _0x1a3c0a[_0x7896('0x1e')](_0x51ade0,_0xaa817f)['then'](function(_0x729f5f){logger[_0x7896('0x1f')](_0x7896('0x20'),_0x52d039,_0x7896('0x21'));logger[_0x7896('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x52d039,_0x7896('0x21'),JSON['stringify'](_0x729f5f));if(_0x729f5f[_0x7896('0x23')]){if(_0x729f5f[_0x7896('0x23')][_0x7896('0x24')]===0x1f4){logger[_0x7896('0x23')](_0x7896('0x20'),_0x52d039,_0x729f5f[_0x7896('0x23')][_0x7896('0x25')]);return _0x53ab34(_0x729f5f[_0x7896('0x23')]['message']);}logger['error'](_0x7896('0x20'),_0x52d039,_0x729f5f[_0x7896('0x23')][_0x7896('0x25')]);return _0x33b670(_0x729f5f[_0x7896('0x23')]['message']);}else{logger['info'](_0x7896('0x20'),_0x52d039,'request\x20sent');_0x33b670(_0x729f5f[_0x7896('0x26')][_0x7896('0x25')]);}})[_0x7896('0x27')](function(_0x444ac7){logger[_0x7896('0x23')](_0x7896('0x20'),_0x52d039,_0x444ac7);_0x53ab34(_0x444ac7);});});}function respondWithStatusCode(_0x8358c0,_0x4c3f66){_0x4c3f66=_0x4c3f66||0xcc;return function(_0x597387){if(_0x597387){return _0x8358c0['sendStatus'](_0x4c3f66);}return _0x8358c0['status'](_0x4c3f66)[_0x7896('0x28')]();};}function respondWithResult(_0x5d7ec4,_0x3048a6){_0x3048a6=_0x3048a6||0xc8;return function(_0x53d1c4){if(_0x53d1c4){return _0x5d7ec4[_0x7896('0x29')](_0x3048a6)[_0x7896('0x2a')](_0x53d1c4);}};}function respondWithFilteredResult(_0x494a6e,_0xd39e2f){return function(_0x5aabe6){if(_0x5aabe6){var _0x236c99=typeof _0xd39e2f[_0x7896('0x2b')]==='undefined'&&typeof _0xd39e2f['limit']===_0x7896('0x2c');var _0x57d1d0=_0x5aabe6[_0x7896('0x2d')];var _0x2d9c86=_0x236c99?0x0:_0xd39e2f[_0x7896('0x2b')];var _0x3832c1=_0x236c99?_0x5aabe6[_0x7896('0x2d')]:_0xd39e2f[_0x7896('0x2b')]+_0xd39e2f['limit'];var _0x5d54e8;if(_0x3832c1>=_0x57d1d0){_0x3832c1=_0x57d1d0;_0x5d54e8=0xc8;}else{_0x5d54e8=0xce;}_0x494a6e[_0x7896('0x29')](_0x5d54e8);return _0x494a6e['set']('Content-Range',_0x2d9c86+'-'+_0x3832c1+'/'+_0x57d1d0)[_0x7896('0x2a')](_0x5aabe6);}return null;};}function patchUpdates(_0x974575){return function(_0x244b3a){try{jsonpatch[_0x7896('0x2e')](_0x244b3a,_0x974575,!![]);}catch(_0x32757f){return BPromise[_0x7896('0x2f')](_0x32757f);}return _0x244b3a[_0x7896('0x30')]();};}function saveUpdates(_0x738658,_0x1f94c2){return function(_0x1b9bb1){if(_0x1b9bb1){return _0x1b9bb1['update'](_0x738658)['then'](function(_0x162fb1){return _0x162fb1;});}return null;};}function removeEntity(_0x439931,_0x5f0ce7){return function(_0x241507){if(_0x241507){return _0x241507[_0x7896('0x31')]()[_0x7896('0x32')](function(){_0x439931[_0x7896('0x29')](0xcc)[_0x7896('0x28')]();});}};}function handleEntityNotFound(_0x1f9417,_0x2ad597){return function(_0x12d527){if(!_0x12d527){_0x1f9417[_0x7896('0x33')](0x194);}return _0x12d527;};}function handleError(_0x2c1182,_0x217fab){_0x217fab=_0x217fab||0x1f4;return function(_0x114624){logger[_0x7896('0x23')](_0x114624[_0x7896('0x34')]);if(_0x114624['name']){delete _0x114624[_0x7896('0x35')];}_0x2c1182[_0x7896('0x29')](_0x217fab)[_0x7896('0x36')](_0x114624);};}exports[_0x7896('0x37')]=function(_0x1200bb,_0x574f4d){var _0x4901e0={},_0xbb87ef={},_0xbb049a={'count':0x0,'rows':[]};var _0x959594=_['map'](db[_0x7896('0x38')][_0x7896('0x39')],function(_0xfbfe95){return{'name':_0xfbfe95[_0x7896('0x3a')],'type':_0xfbfe95[_0x7896('0x3b')][_0x7896('0x3c')]};});_0xbb87ef[_0x7896('0x3d')]=_['map'](_0x959594,_0x7896('0x35'));_0xbb87ef[_0x7896('0x3e')]=_[_0x7896('0x3f')](_0x1200bb['query']);_0xbb87ef['filters']=_['intersection'](_0xbb87ef[_0x7896('0x3d')],_0xbb87ef[_0x7896('0x3e')]);_0x4901e0[_0x7896('0x40')]=_[_0x7896('0x41')](_0xbb87ef[_0x7896('0x3d')],qs[_0x7896('0x42')](_0x1200bb[_0x7896('0x3e')][_0x7896('0x42')]));_0x4901e0[_0x7896('0x40')]=_0x4901e0[_0x7896('0x40')][_0x7896('0x43')]?_0x4901e0['attributes']:_0xbb87ef[_0x7896('0x3d')];if(!_0x1200bb['query'][_0x7896('0x44')](_0x7896('0x45'))){_0x4901e0[_0x7896('0x46')]=qs[_0x7896('0x46')](_0x1200bb['query']['limit']);_0x4901e0['offset']=qs[_0x7896('0x2b')](_0x1200bb[_0x7896('0x3e')][_0x7896('0x2b')]);}_0x4901e0[_0x7896('0x47')]=qs[_0x7896('0x48')](_0x1200bb[_0x7896('0x3e')]['sort']);_0x4901e0[_0x7896('0x49')]=qs[_0x7896('0x4a')](_[_0x7896('0x4b')](_0x1200bb[_0x7896('0x3e')],_0xbb87ef['filters']),_0x959594);if(_0x1200bb['query']['filter']){_0x4901e0[_0x7896('0x49')]=_[_0x7896('0x4c')](_0x4901e0[_0x7896('0x49')],{'$or':_['map'](_0x959594,function(_0x2804bd){if(_0x2804bd['type']!==_0x7896('0x4d')){var _0x184493={};_0x184493[_0x2804bd['name']]={'$like':'%'+_0x1200bb[_0x7896('0x3e')][_0x7896('0x4e')]+'%'};return _0x184493;}})});}_0x4901e0=_[_0x7896('0x4c')]({},_0x4901e0,_0x1200bb['options']);var _0x432da7={'where':_0x4901e0['where']};return db['FaxMessage'][_0x7896('0x2d')](_0x432da7)[_0x7896('0x32')](function(_0xb9ccb8){_0xbb049a['count']=_0xb9ccb8;if(_0x1200bb['query'][_0x7896('0x4f')]){_0x4901e0[_0x7896('0x50')]=[{'all':!![]}];}return db[_0x7896('0x38')][_0x7896('0x51')](_0x4901e0);})[_0x7896('0x32')](function(_0x3000e5){_0xbb049a[_0x7896('0x52')]=_0x3000e5;return _0xbb049a;})['then'](respondWithFilteredResult(_0x574f4d,_0x4901e0))[_0x7896('0x27')](handleError(_0x574f4d,null));};exports[_0x7896('0x53')]=function(_0x6acff7,_0x4900b7){var _0x472563={'raw':!![],'where':{'id':_0x6acff7[_0x7896('0x54')]['id']}},_0x5633f4={};_0x5633f4[_0x7896('0x3d')]=_[_0x7896('0x3f')](db[_0x7896('0x38')][_0x7896('0x39')]);_0x5633f4[_0x7896('0x3e')]=_[_0x7896('0x3f')](_0x6acff7[_0x7896('0x3e')]);_0x5633f4['filters']=_[_0x7896('0x41')](_0x5633f4[_0x7896('0x3d')],_0x5633f4[_0x7896('0x3e')]);_0x472563[_0x7896('0x40')]=_[_0x7896('0x41')](_0x5633f4[_0x7896('0x3d')],qs[_0x7896('0x42')](_0x6acff7['query'][_0x7896('0x42')]));_0x472563[_0x7896('0x40')]=_0x472563[_0x7896('0x40')][_0x7896('0x43')]?_0x472563['attributes']:_0x5633f4['model'];if(_0x6acff7[_0x7896('0x3e')][_0x7896('0x4f')]){_0x472563[_0x7896('0x50')]=[{'all':!![]}];}_0x472563=_[_0x7896('0x4c')]({},_0x472563,_0x6acff7[_0x7896('0x55')]);return db['FaxMessage'][_0x7896('0x56')](_0x472563)[_0x7896('0x32')](handleEntityNotFound(_0x4900b7,null))['then'](respondWithResult(_0x4900b7,null))[_0x7896('0x27')](handleError(_0x4900b7,null));};exports[_0x7896('0x57')]=function(_0x311f12,_0x19832d){if(_0x311f12[_0x7896('0x58')]['id']){delete _0x311f12[_0x7896('0x58')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x311f12[_0x7896('0x54')]['id']}})[_0x7896('0x32')](handleEntityNotFound(_0x19832d,null))['then'](saveUpdates(_0x311f12[_0x7896('0x58')],null))[_0x7896('0x32')](respondWithResult(_0x19832d,null))[_0x7896('0x27')](handleError(_0x19832d,null));};exports['destroy']=function(_0x43eed6,_0x189d55){return db[_0x7896('0x38')][_0x7896('0x56')]({'where':{'id':_0x43eed6['params']['id']}})[_0x7896('0x32')](handleEntityNotFound(_0x189d55,null))['then'](removeEntity(_0x189d55,null))[_0x7896('0x27')](handleError(_0x189d55,null));};exports[_0x7896('0x59')]=function(_0x127ea5,_0x291a80){return db[_0x7896('0x38')][_0x7896('0x59')]()[_0x7896('0x32')](respondWithResult(_0x291a80,null))[_0x7896('0x27')](handleError(_0x291a80,null));};var interaction_log=require(_0x7896('0x12'))(_0x7896('0x5a'));exports[_0x7896('0x5b')]=function(_0x42a89d,_0x37a3d0,_0x416359){var _0xc4e3c={'agent':{},'channel':'fax'};if(_0x42a89d[_0x7896('0x58')]['id']){delete _0x42a89d['body']['id'];}_0x42a89d[_0x7896('0x58')]['read']=!![];_0x42a89d[_0x7896('0x58')][_0x7896('0x5c')]=moment()[_0x7896('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x42a89d[_0x7896('0x58')][_0x7896('0x5e')]=_0x42a89d['body'][_0x7896('0x5e')]||_0x42a89d[_0x7896('0x5f')]['id'];_0xc4e3c['agent']['id']=_0x42a89d[_0x7896('0x58')][_0x7896('0x5e')];return db[_0x7896('0x38')][_0x7896('0x56')]({'where':{'id':_0x42a89d['params']['id'],'UserId':null}})[_0x7896('0x32')](handleEntityNotFound(_0x37a3d0,null))[_0x7896('0x32')](saveUpdates(_0x42a89d[_0x7896('0x58')],null))[_0x7896('0x32')](function(_0xc64acb){if(_0xc64acb){_0xc4e3c[_0x7896('0x25')]=_0xc64acb['get']({'plain':!![]});return db[_0x7896('0x60')][_0x7896('0x56')]({'where':{'id':_0xc64acb['FaxInteractionId']}});}return null;})[_0x7896('0x32')](handleEntityNotFound(_0x37a3d0,null))[_0x7896('0x32')](function(_0x508221){if(_0x508221){return _0x508221[_0x7896('0x57')]({'UserId':_0x42a89d[_0x7896('0x58')][_0x7896('0x5e')],'read1stAt':_['isNil'](_0x508221[_0x7896('0x61')])?moment()[_0x7896('0x5d')](_0x7896('0x62')):undefined});}return null;})['then'](function(_0x510aab){if(_0x510aab){_0xc4e3c[_0x7896('0x63')]=_0x510aab[_0x7896('0x64')]({'plain':!![]});interaction_log[_0x7896('0x1f')](_0x7896('0x65'),_0x42a89d['user']['id'],_0x42a89d[_0x7896('0x5f')][_0x7896('0x35')],_0x42a89d[_0x7896('0x5f')][_0x7896('0x66')],_0xc4e3c['interaction']['id'],_0x42a89d['body']?JSON['stringify'](_0x42a89d[_0x7896('0x58')]):_0x7896('0x67'));return respondWithRpcPromise('AcceptMessage',_0x7896('0x68'),_0xc4e3c);}return null;})[_0x7896('0x32')](function(_0x3f12af){var _0x4afee6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f12af[_0x7896('0x25')][_0x7896('0x69')];return db[_0x7896('0x6a')][_0x7896('0x3e')](_0x4afee6,{'type':db[_0x7896('0x6b')][_0x7896('0x6c')][_0x7896('0x6d')],'raw':!![]})[_0x7896('0x32')](function(_0x53df53){return _0x53df53;});})['then'](function(_0xb06d3a){if(_0xb06d3a){_0xc4e3c[_0x7896('0x25')][_0x7896('0x6e')]=_0xb06d3a[0x0];if(!_0x42a89d[_0x7896('0x58')][_0x7896('0x5e')])return;return db[_0x7896('0x6f')][_0x7896('0x56')]({'where':{'id':_0x42a89d[_0x7896('0x58')]['UserId'],'role':_0x7896('0x70')},'attributes':['id',_0x7896('0x35'),_0x7896('0x71'),_0x7896('0x72'),_0x7896('0x73')],'raw':!![]});}return null;})[_0x7896('0x32')](function(_0x106d09){if(!_0x106d09)return null;_0xc4e3c[_0x7896('0x25')][_0x7896('0x70')]=_0x106d09;return _0xc4e3c;})['then'](function(_0x22b964){if(_0x22b964){if(_0x42a89d[_0x7896('0x58')][_0x7896('0x74')]){_0xc4e3c[_0x7896('0x25')][_0x7896('0x75')]=util[_0x7896('0x5d')](_0x7896('0x76'),_0x42a89d[_0x7896('0x5f')][_0x7896('0x35')]);_0xc4e3c[_0x7896('0x25')][_0x7896('0x77')]=_0xc4e3c[_0x7896('0x77')];_0xc4e3c[_0x7896('0x25')][_0x7896('0x78')]=_0xc4e3c[_0x7896('0x77')];_0xc4e3c[_0x7896('0x25')][_0x7896('0x79')]='accept';return respondWithRpcPromise(_0x7896('0x7a'),_0x7896('0x7a'),{'event':'acceptmessage','message':_0xc4e3c[_0x7896('0x25')]},client9002)[_0x7896('0x32')](function(){return _0xc4e3c;});}return _0xc4e3c;}return null;})[_0x7896('0x32')](respondWithResult(_0x37a3d0,null))[_0x7896('0x27')](handleError(_0x37a3d0,null));};var interaction_log=require(_0x7896('0x12'))('fax-interactions');exports[_0x7896('0x2f')]=function(_0x200877,_0x488968,_0x2bf39c){var _0x284492={'agent':{},'channel':'fax'};if(_0x200877[_0x7896('0x58')]['id']){delete _0x200877[_0x7896('0x58')]['id'];}_0x200877[_0x7896('0x58')]['UserId']=_0x200877[_0x7896('0x58')][_0x7896('0x5e')]||_0x200877[_0x7896('0x5f')]['id'];_0x284492[_0x7896('0x70')]['id']=_0x200877[_0x7896('0x58')]['UserId'];return db[_0x7896('0x38')][_0x7896('0x56')]({'where':{'id':_0x200877[_0x7896('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x488968,null))['then'](function(_0x2f69f9){if(_0x2f69f9){_0x284492[_0x7896('0x25')]=_0x2f69f9[_0x7896('0x64')]({'plain':!![]});return db[_0x7896('0x60')][_0x7896('0x56')]({'where':{'id':_0x2f69f9[_0x7896('0x7b')]}});}return null;})[_0x7896('0x32')](handleEntityNotFound(_0x488968,null))[_0x7896('0x32')](function(_0x10fd7b){if(_0x10fd7b){_0x284492[_0x7896('0x63')]=_0x10fd7b[_0x7896('0x64')]({'plain':!![]});interaction_log[_0x7896('0x1f')](_0x7896('0x7c'),_0x200877[_0x7896('0x5f')]['id'],_0x200877['user'][_0x7896('0x35')],_0x200877[_0x7896('0x5f')][_0x7896('0x66')],_0x284492[_0x7896('0x63')]['id'],_0x200877[_0x7896('0x58')]?JSON[_0x7896('0x7d')](_0x200877[_0x7896('0x58')]):_0x7896('0x67'));return respondWithRpcPromise(_0x7896('0x7e'),_0x7896('0x7f'),_0x284492);}return null;})[_0x7896('0x32')](function(_0x489912){var _0x1a9d08=_0x7896('0x80')+_0x489912[_0x7896('0x25')][_0x7896('0x69')];return db['sequelize']['query'](_0x1a9d08,{'type':db['Sequelize']['QueryTypes'][_0x7896('0x6d')],'raw':!![]})['then'](function(_0x26e24e){return _0x26e24e;});})[_0x7896('0x32')](function(_0x4cbd65){if(_0x4cbd65){_0x284492[_0x7896('0x25')]['contact']=_0x4cbd65[0x0];if(!_0x200877['body'][_0x7896('0x5e')])return;return db['User'][_0x7896('0x56')]({'where':{'id':_0x200877['body'][_0x7896('0x5e')],'role':_0x7896('0x70')},'attributes':['id','name',_0x7896('0x71'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4bfbe3){if(!_0x4bfbe3)return null;_0x284492[_0x7896('0x25')][_0x7896('0x70')]=_0x4bfbe3;return _0x284492;})['then'](function(_0x53de28){if(_0x53de28){_0x53de28[_0x7896('0x25')][_0x7896('0x75')]=util[_0x7896('0x5d')](_0x7896('0x76'),_0x200877[_0x7896('0x5f')][_0x7896('0x35')]);_0x53de28[_0x7896('0x25')][_0x7896('0x77')]=_0x284492['channel'];_0x53de28['message']['motionChannel']=_0x284492[_0x7896('0x77')];_0x53de28[_0x7896('0x25')]['event']=_0x7896('0x2f');respondWithRpcPromise(_0x7896('0x7a'),_0x7896('0x7a'),{'event':_0x7896('0x81'),'message':_0x53de28[_0x7896('0x25')]},client9002);return _0x284492;}return null;})[_0x7896('0x32')](respondWithResult(_0x488968,null))['catch'](handleError(_0x488968,null));};exports[_0x7896('0x82')]=function(_0x56e79d,_0x3c23da){var _0x38276e;return db[_0x7896('0x38')][_0x7896('0x82')](_0x56e79d['body'],{})[_0x7896('0x32')](function(_0x5b4b3c){_0x38276e=_0x5b4b3c;return db[_0x7896('0x83')]['findOne']({'where':{'id':_0x38276e[_0x7896('0x69')]}});})[_0x7896('0x32')](function(_0x4c8fb2){if(_[_0x7896('0x84')](_0x4c8fb2)){return;}else{_0x38276e[_0x7896('0x85')]=_0x4c8fb2[_0x7896('0x85')];return db[_0x7896('0x86')][_0x7896('0x87')]({'where':{'id':_0x38276e[_0x7896('0x88')]}});}})[_0x7896('0x32')](function(_0x26ae3b){return respondWithRpcPromise(_0x7896('0x89'),_0x7896('0x89'),{'FaxAccountId':_[_0x7896('0x84')](_0x56e79d[_0x7896('0x58')])?undefined:_0x56e79d[_0x7896('0x58')][_0x7896('0x8a')],'path':_[_0x7896('0x84')](_0x26ae3b)?undefined:util[_0x7896('0x5d')](_0x7896('0x8b'),_0x26ae3b[_0x7896('0x8c')]),'fax':_[_0x7896('0x84')](_0x38276e[_0x7896('0x85')])?undefined:_0x38276e[_0x7896('0x85')],'AttachmentId':_0x38276e[_0x7896('0x88')]},client9002);})[_0x7896('0x32')](respondWithResult(_0x3c23da,0xc9))[_0x7896('0x27')](handleError(_0x3c23da,null));};exports[_0x7896('0x8d')]=function(_0x1227cc,_0x54cb7f){var _0x16ad90=path[_0x7896('0x8e')](config[_0x7896('0x8f')],_0x7896('0x90'),_0x7896('0x91'),_0x7896('0x92'));return db[_0x7896('0x38')][_0x7896('0x56')]({'where':{'id':_0x1227cc['params']['id']},'include':[{'model':db[_0x7896('0x86')],'as':'Attachment'}]})[_0x7896('0x32')](handleEntityNotFound(_0x54cb7f,null))[_0x7896('0x32')](function(_0x58f524){if(_0x58f524){return _0x54cb7f['download'](path[_0x7896('0x8e')](_0x16ad90,_0x58f524[_0x7896('0x86')][_0x7896('0x8c')]));}})['catch'](handleError(_0x54cb7f,null));}; \ No newline at end of file +var _0x943f=['SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','FaxMessage','include','findAll','rows','show','params','fields','find','body','describe','accept','fax','read','readAt','format','UserId','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE: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','Sequelize','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax-interactions','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','QueryTypes','email','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId'];(function(_0x16e644,_0x139432){var _0x2a1086=function(_0x3bd809){while(--_0x3bd809){_0x16e644['push'](_0x16e644['shift']());}};_0x2a1086(++_0x139432);}(_0x943f,0x129));var _0xf943=function(_0x18a7a3,_0x144fe0){_0x18a7a3=_0x18a7a3-0x0;var _0x26f4f1=_0x943f[_0x18a7a3];return _0x26f4f1;};'use strict';var emlformat=require(_0xf943('0x0'));var rimraf=require(_0xf943('0x1'));var zipdir=require(_0xf943('0x2'));var jsonpatch=require(_0xf943('0x3'));var rp=require('request-promise');var moment=require(_0xf943('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf943('0x5'));var util=require(_0xf943('0x6'));var path=require(_0xf943('0x7'));var sox=require(_0xf943('0x8'));var csv=require(_0xf943('0x9'));var ejs=require(_0xf943('0xa'));var fs=require('fs');var fs_extra=require(_0xf943('0xb'));var _=require(_0xf943('0xc'));var squel=require(_0xf943('0xd'));var crypto=require(_0xf943('0xe'));var jsforce=require(_0xf943('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf943('0x9'));var querystring=require(_0xf943('0x10'));var Papa=require(_0xf943('0x11'));var Redis=require(_0xf943('0x12'));var authService=require(_0xf943('0x13'));var qs=require(_0xf943('0x14'));var as=require(_0xf943('0x15'));var hardwareService=require(_0xf943('0x16'));var logger=require(_0xf943('0x17'))(_0xf943('0x18'));var utils=require(_0xf943('0x19'));var config=require(_0xf943('0x1a'));var licenseUtil=require(_0xf943('0x1b'));var db=require(_0xf943('0x1c'))['db'];config[_0xf943('0x1d')]=_[_0xf943('0x1e')](config['redis'],{'host':_0xf943('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf943('0x1d')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xf943('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xf943('0x21')][_0xf943('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x13069e,_0x523b4b,_0x42c402,_0x47a874){return new BPromise(function(_0x39e9c4,_0xb6b599){var _0x2b1f17=_0x47a874||client;return _0x2b1f17[_0xf943('0x23')](_0x13069e,_0x42c402)['then'](function(_0x3dff7f){logger[_0xf943('0x24')](_0xf943('0x25'),_0x523b4b,_0xf943('0x26'));logger[_0xf943('0x27')](_0xf943('0x28'),_0x523b4b,_0xf943('0x26'),JSON[_0xf943('0x29')](_0x3dff7f));if(_0x3dff7f[_0xf943('0x2a')]){if(_0x3dff7f[_0xf943('0x2a')]['code']===0x1f4){logger[_0xf943('0x2a')](_0xf943('0x25'),_0x523b4b,_0x3dff7f['error'][_0xf943('0x2b')]);return _0xb6b599(_0x3dff7f[_0xf943('0x2a')][_0xf943('0x2b')]);}logger[_0xf943('0x2a')](_0xf943('0x25'),_0x523b4b,_0x3dff7f['error'][_0xf943('0x2b')]);return _0x39e9c4(_0x3dff7f['error'][_0xf943('0x2b')]);}else{logger[_0xf943('0x24')](_0xf943('0x25'),_0x523b4b,_0xf943('0x26'));_0x39e9c4(_0x3dff7f[_0xf943('0x2c')][_0xf943('0x2b')]);}})[_0xf943('0x2d')](function(_0x6a67d6){logger['error'](_0xf943('0x25'),_0x523b4b,_0x6a67d6);_0xb6b599(_0x6a67d6);});});}function respondWithStatusCode(_0x2d8dd5,_0x82473e){_0x82473e=_0x82473e||0xcc;return function(_0x5cd1ce){if(_0x5cd1ce){return _0x2d8dd5['sendStatus'](_0x82473e);}return _0x2d8dd5['status'](_0x82473e)[_0xf943('0x2e')]();};}function respondWithResult(_0x363955,_0x1d15dc){_0x1d15dc=_0x1d15dc||0xc8;return function(_0x3af844){if(_0x3af844){return _0x363955[_0xf943('0x2f')](_0x1d15dc)['json'](_0x3af844);}};}function respondWithFilteredResult(_0x66a9b0,_0x33847b){return function(_0x461c16){if(_0x461c16){var _0x381ed1=typeof _0x33847b[_0xf943('0x30')]===_0xf943('0x31')&&typeof _0x33847b[_0xf943('0x32')]===_0xf943('0x31');var _0x41e6be=_0x461c16[_0xf943('0x33')];var _0x42d2fe=_0x381ed1?0x0:_0x33847b[_0xf943('0x30')];var _0x34ad05=_0x381ed1?_0x461c16[_0xf943('0x33')]:_0x33847b[_0xf943('0x30')]+_0x33847b['limit'];var _0x4da3a4;if(_0x34ad05>=_0x41e6be){_0x34ad05=_0x41e6be;_0x4da3a4=0xc8;}else{_0x4da3a4=0xce;}_0x66a9b0['status'](_0x4da3a4);return _0x66a9b0[_0xf943('0x34')]('Content-Range',_0x42d2fe+'-'+_0x34ad05+'/'+_0x41e6be)['json'](_0x461c16);}return null;};}function patchUpdates(_0x3bce13){return function(_0x43aebe){try{jsonpatch[_0xf943('0x35')](_0x43aebe,_0x3bce13,!![]);}catch(_0x41dec8){return BPromise[_0xf943('0x36')](_0x41dec8);}return _0x43aebe[_0xf943('0x37')]();};}function saveUpdates(_0x3154e5,_0x3bb9be){return function(_0x34eb05){if(_0x34eb05){return _0x34eb05[_0xf943('0x38')](_0x3154e5)[_0xf943('0x39')](function(_0x596444){return _0x596444;});}return null;};}function removeEntity(_0x1d8b9b,_0x2d5e70){return function(_0x427fab){if(_0x427fab){return _0x427fab[_0xf943('0x3a')]()[_0xf943('0x39')](function(){_0x1d8b9b[_0xf943('0x2f')](0xcc)[_0xf943('0x2e')]();});}};}function handleEntityNotFound(_0x2c4bef,_0x4301b4){return function(_0x556550){if(!_0x556550){_0x2c4bef[_0xf943('0x3b')](0x194);}return _0x556550;};}function handleError(_0x5731e2,_0x37c1e9){_0x37c1e9=_0x37c1e9||0x1f4;return function(_0x46c0ee){logger[_0xf943('0x2a')](_0x46c0ee['stack']);if(_0x46c0ee[_0xf943('0x3c')]){delete _0x46c0ee[_0xf943('0x3c')];}_0x5731e2[_0xf943('0x2f')](_0x37c1e9)[_0xf943('0x3d')](_0x46c0ee);};}exports['index']=function(_0x373753,_0x1ee419){var _0x5e2418={},_0x1b202d={},_0x19fb49={'count':0x0,'rows':[]};var _0x2087d6=_[_0xf943('0x3e')](db['FaxMessage'][_0xf943('0x3f')],function(_0x569d3d){return{'name':_0x569d3d[_0xf943('0x40')],'type':_0x569d3d['type'][_0xf943('0x41')]};});_0x1b202d['model']=_[_0xf943('0x3e')](_0x2087d6,_0xf943('0x3c'));_0x1b202d[_0xf943('0x42')]=_[_0xf943('0x43')](_0x373753[_0xf943('0x42')]);_0x1b202d[_0xf943('0x44')]=_['intersection'](_0x1b202d[_0xf943('0x45')],_0x1b202d[_0xf943('0x42')]);_0x5e2418[_0xf943('0x46')]=_[_0xf943('0x47')](_0x1b202d['model'],qs['fields'](_0x373753[_0xf943('0x42')]['fields']));_0x5e2418[_0xf943('0x46')]=_0x5e2418['attributes'][_0xf943('0x48')]?_0x5e2418[_0xf943('0x46')]:_0x1b202d[_0xf943('0x45')];if(!_0x373753['query'][_0xf943('0x49')](_0xf943('0x4a'))){_0x5e2418[_0xf943('0x32')]=qs['limit'](_0x373753['query']['limit']);_0x5e2418[_0xf943('0x30')]=qs[_0xf943('0x30')](_0x373753[_0xf943('0x42')][_0xf943('0x30')]);}_0x5e2418['order']=qs[_0xf943('0x4b')](_0x373753[_0xf943('0x42')][_0xf943('0x4b')]);_0x5e2418[_0xf943('0x4c')]=qs['filters'](_['pick'](_0x373753[_0xf943('0x42')],_0x1b202d[_0xf943('0x44')]),_0x2087d6);if(_0x373753[_0xf943('0x42')][_0xf943('0x4d')]){_0x5e2418[_0xf943('0x4c')]=_[_0xf943('0x4e')](_0x5e2418['where'],{'$or':_[_0xf943('0x3e')](_0x2087d6,function(_0x163eff){if(_0x163eff[_0xf943('0x4f')]!==_0xf943('0x50')){var _0x138287={};_0x138287[_0x163eff[_0xf943('0x3c')]]={'$like':'%'+_0x373753[_0xf943('0x42')][_0xf943('0x4d')]+'%'};return _0x138287;}})});}_0x5e2418=_[_0xf943('0x4e')]({},_0x5e2418,_0x373753[_0xf943('0x51')]);var _0x2ce0cd={'where':_0x5e2418[_0xf943('0x4c')]};return db[_0xf943('0x52')][_0xf943('0x33')](_0x2ce0cd)[_0xf943('0x39')](function(_0x4b2690){_0x19fb49[_0xf943('0x33')]=_0x4b2690;if(_0x373753[_0xf943('0x42')]['includeAll']){_0x5e2418[_0xf943('0x53')]=[{'all':!![]}];}return db[_0xf943('0x52')][_0xf943('0x54')](_0x5e2418);})['then'](function(_0x3ec6df){_0x19fb49[_0xf943('0x55')]=_0x3ec6df;return _0x19fb49;})[_0xf943('0x39')](respondWithFilteredResult(_0x1ee419,_0x5e2418))[_0xf943('0x2d')](handleError(_0x1ee419,null));};exports[_0xf943('0x56')]=function(_0x544cce,_0x539b0c){var _0x3cf204={'raw':!![],'where':{'id':_0x544cce[_0xf943('0x57')]['id']}},_0x460efb={};_0x460efb[_0xf943('0x45')]=_['keys'](db[_0xf943('0x52')][_0xf943('0x3f')]);_0x460efb[_0xf943('0x42')]=_[_0xf943('0x43')](_0x544cce[_0xf943('0x42')]);_0x460efb[_0xf943('0x44')]=_[_0xf943('0x47')](_0x460efb[_0xf943('0x45')],_0x460efb[_0xf943('0x42')]);_0x3cf204['attributes']=_[_0xf943('0x47')](_0x460efb[_0xf943('0x45')],qs[_0xf943('0x58')](_0x544cce[_0xf943('0x42')][_0xf943('0x58')]));_0x3cf204[_0xf943('0x46')]=_0x3cf204[_0xf943('0x46')][_0xf943('0x48')]?_0x3cf204['attributes']:_0x460efb[_0xf943('0x45')];if(_0x544cce[_0xf943('0x42')]['includeAll']){_0x3cf204['include']=[{'all':!![]}];}_0x3cf204=_['merge']({},_0x3cf204,_0x544cce['options']);return db[_0xf943('0x52')][_0xf943('0x59')](_0x3cf204)[_0xf943('0x39')](handleEntityNotFound(_0x539b0c,null))[_0xf943('0x39')](respondWithResult(_0x539b0c,null))['catch'](handleError(_0x539b0c,null));};exports['update']=function(_0x4929d0,_0x15030f){if(_0x4929d0['body']['id']){delete _0x4929d0['body']['id'];}return db['FaxMessage'][_0xf943('0x59')]({'where':{'id':_0x4929d0[_0xf943('0x57')]['id']}})[_0xf943('0x39')](handleEntityNotFound(_0x15030f,null))[_0xf943('0x39')](saveUpdates(_0x4929d0[_0xf943('0x5a')],null))[_0xf943('0x39')](respondWithResult(_0x15030f,null))[_0xf943('0x2d')](handleError(_0x15030f,null));};exports[_0xf943('0x3a')]=function(_0x4454ae,_0x51a4a4){return db['FaxMessage'][_0xf943('0x59')]({'where':{'id':_0x4454ae[_0xf943('0x57')]['id']}})['then'](handleEntityNotFound(_0x51a4a4,null))[_0xf943('0x39')](removeEntity(_0x51a4a4,null))[_0xf943('0x2d')](handleError(_0x51a4a4,null));};exports[_0xf943('0x5b')]=function(_0x331092,_0x3c0e26){return db[_0xf943('0x52')]['describe']()[_0xf943('0x39')](respondWithResult(_0x3c0e26,null))[_0xf943('0x2d')](handleError(_0x3c0e26,null));};var interaction_log=require(_0xf943('0x17'))('fax-interactions');exports[_0xf943('0x5c')]=function(_0xb6f13c,_0x5d70fb,_0x1b9dcc){var _0x4bd0f5={'agent':{},'channel':_0xf943('0x5d')};if(_0xb6f13c[_0xf943('0x5a')]['id']){delete _0xb6f13c[_0xf943('0x5a')]['id'];}_0xb6f13c[_0xf943('0x5a')][_0xf943('0x5e')]=!![];_0xb6f13c[_0xf943('0x5a')][_0xf943('0x5f')]=moment()[_0xf943('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0xb6f13c[_0xf943('0x5a')][_0xf943('0x61')]=_0xb6f13c[_0xf943('0x5a')]['UserId']||_0xb6f13c['user']['id'];_0x4bd0f5['agent']['id']=_0xb6f13c[_0xf943('0x5a')][_0xf943('0x61')];return db[_0xf943('0x52')][_0xf943('0x59')]({'where':{'id':_0xb6f13c[_0xf943('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d70fb,null))[_0xf943('0x39')](saveUpdates(_0xb6f13c[_0xf943('0x5a')],null))['then'](function(_0x452560){if(_0x452560){_0x4bd0f5[_0xf943('0x2b')]=_0x452560[_0xf943('0x62')]({'plain':!![]});return db[_0xf943('0x63')][_0xf943('0x59')]({'where':{'id':_0x452560['FaxInteractionId']}});}return null;})[_0xf943('0x39')](handleEntityNotFound(_0x5d70fb,null))[_0xf943('0x39')](function(_0x4b3b1b){if(_0x4b3b1b){return _0x4b3b1b[_0xf943('0x38')]({'UserId':_0xb6f13c[_0xf943('0x5a')][_0xf943('0x61')],'read1stAt':_[_0xf943('0x64')](_0x4b3b1b[_0xf943('0x65')])?moment()[_0xf943('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf943('0x39')](function(_0x2a4108){if(_0x2a4108){_0x4bd0f5[_0xf943('0x66')]=_0x2a4108[_0xf943('0x62')]({'plain':!![]});interaction_log[_0xf943('0x24')](_0xf943('0x67'),_0xb6f13c[_0xf943('0x68')]['id'],_0xb6f13c[_0xf943('0x68')][_0xf943('0x3c')],_0xb6f13c['user'][_0xf943('0x69')],_0x4bd0f5[_0xf943('0x66')]['id'],_0xb6f13c[_0xf943('0x5a')]?JSON[_0xf943('0x29')](_0xb6f13c[_0xf943('0x5a')]):'null');return respondWithRpcPromise(_0xf943('0x6a'),'acceptMessage',_0x4bd0f5);}return null;})[_0xf943('0x39')](function(_0x34bcf1){var _0x1e5f99=_0xf943('0x6b')+_0x34bcf1[_0xf943('0x2b')][_0xf943('0x6c')];return db[_0xf943('0x6d')][_0xf943('0x42')](_0x1e5f99,{'type':db[_0xf943('0x6e')]['QueryTypes'][_0xf943('0x6f')],'raw':!![]})[_0xf943('0x39')](function(_0x5a97b0){return _0x5a97b0;});})['then'](function(_0x1c3c41){if(_0x1c3c41){_0x4bd0f5['message'][_0xf943('0x70')]=_0x1c3c41[0x0];if(!_0xb6f13c[_0xf943('0x5a')][_0xf943('0x61')])return;return db[_0xf943('0x71')]['find']({'where':{'id':_0xb6f13c[_0xf943('0x5a')]['UserId'],'role':_0xf943('0x72')},'attributes':['id',_0xf943('0x3c'),_0xf943('0x73'),'email',_0xf943('0x74')],'raw':!![]});}return null;})[_0xf943('0x39')](function(_0x5ee287){if(!_0x5ee287)return null;_0x4bd0f5[_0xf943('0x2b')][_0xf943('0x72')]=_0x5ee287;return _0x4bd0f5;})[_0xf943('0x39')](function(_0x3a0324){if(_0x3a0324){if(_0xb6f13c[_0xf943('0x5a')][_0xf943('0x75')]){_0x4bd0f5['message'][_0xf943('0x76')]=util[_0xf943('0x60')](_0xf943('0x77'),_0xb6f13c[_0xf943('0x68')][_0xf943('0x3c')]);_0x4bd0f5[_0xf943('0x2b')][_0xf943('0x78')]=_0x4bd0f5[_0xf943('0x78')];_0x4bd0f5[_0xf943('0x2b')][_0xf943('0x79')]=_0x4bd0f5[_0xf943('0x78')];_0x4bd0f5['message']['event']=_0xf943('0x5c');return respondWithRpcPromise(_0xf943('0x7a'),_0xf943('0x7a'),{'event':_0xf943('0x7b'),'message':_0x4bd0f5[_0xf943('0x2b')]},client9002)[_0xf943('0x39')](function(){return _0x4bd0f5;});}return _0x4bd0f5;}return null;})[_0xf943('0x39')](respondWithResult(_0x5d70fb,null))[_0xf943('0x2d')](handleError(_0x5d70fb,null));};var interaction_log=require(_0xf943('0x17'))(_0xf943('0x7c'));exports[_0xf943('0x36')]=function(_0x5bb772,_0x24e154,_0x163ea6){var _0x4578cd={'agent':{},'channel':_0xf943('0x5d')};if(_0x5bb772['body']['id']){delete _0x5bb772[_0xf943('0x5a')]['id'];}_0x5bb772[_0xf943('0x5a')][_0xf943('0x61')]=_0x5bb772[_0xf943('0x5a')]['UserId']||_0x5bb772['user']['id'];_0x4578cd['agent']['id']=_0x5bb772[_0xf943('0x5a')][_0xf943('0x61')];return db[_0xf943('0x52')]['find']({'where':{'id':_0x5bb772['params']['id'],'UserId':null}})[_0xf943('0x39')](handleEntityNotFound(_0x24e154,null))[_0xf943('0x39')](function(_0x36ea93){if(_0x36ea93){_0x4578cd['message']=_0x36ea93['get']({'plain':!![]});return db[_0xf943('0x63')][_0xf943('0x59')]({'where':{'id':_0x36ea93[_0xf943('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x24e154,null))[_0xf943('0x39')](function(_0x19266a){if(_0x19266a){_0x4578cd[_0xf943('0x66')]=_0x19266a[_0xf943('0x62')]({'plain':!![]});interaction_log[_0xf943('0x24')](_0xf943('0x7e'),_0x5bb772['user']['id'],_0x5bb772[_0xf943('0x68')][_0xf943('0x3c')],_0x5bb772[_0xf943('0x68')][_0xf943('0x69')],_0x4578cd[_0xf943('0x66')]['id'],_0x5bb772['body']?JSON[_0xf943('0x29')](_0x5bb772[_0xf943('0x5a')]):_0xf943('0x7f'));return respondWithRpcPromise('RejectMessage',_0xf943('0x80'),_0x4578cd);}return null;})[_0xf943('0x39')](function(_0x35e197){var _0x135228=_0xf943('0x6b')+_0x35e197[_0xf943('0x2b')][_0xf943('0x6c')];return db[_0xf943('0x6d')][_0xf943('0x42')](_0x135228,{'type':db[_0xf943('0x6e')][_0xf943('0x81')][_0xf943('0x6f')],'raw':!![]})['then'](function(_0x549a6){return _0x549a6;});})[_0xf943('0x39')](function(_0xf9c126){if(_0xf9c126){_0x4578cd['message'][_0xf943('0x70')]=_0xf9c126[0x0];if(!_0x5bb772[_0xf943('0x5a')]['UserId'])return;return db[_0xf943('0x71')]['find']({'where':{'id':_0x5bb772[_0xf943('0x5a')][_0xf943('0x61')],'role':'agent'},'attributes':['id',_0xf943('0x3c'),_0xf943('0x73'),_0xf943('0x82'),_0xf943('0x74')],'raw':!![]});}return null;})['then'](function(_0xe99fe1){if(!_0xe99fe1)return null;_0x4578cd['message'][_0xf943('0x72')]=_0xe99fe1;return _0x4578cd;})[_0xf943('0x39')](function(_0x203916){if(_0x203916){_0x203916['message'][_0xf943('0x76')]=util[_0xf943('0x60')](_0xf943('0x77'),_0x5bb772[_0xf943('0x68')][_0xf943('0x3c')]);_0x203916[_0xf943('0x2b')][_0xf943('0x78')]=_0x4578cd[_0xf943('0x78')];_0x203916[_0xf943('0x2b')][_0xf943('0x79')]=_0x4578cd[_0xf943('0x78')];_0x203916[_0xf943('0x2b')][_0xf943('0x83')]=_0xf943('0x36');respondWithRpcPromise(_0xf943('0x7a'),_0xf943('0x7a'),{'event':_0xf943('0x84'),'message':_0x203916[_0xf943('0x2b')]},client9002);return _0x4578cd;}return null;})['then'](respondWithResult(_0x24e154,null))[_0xf943('0x2d')](handleError(_0x24e154,null));};exports['create']=function(_0xe5057a,_0x55eacb){var _0x3b6943;return db['FaxMessage'][_0xf943('0x85')](_0xe5057a[_0xf943('0x5a')],{})[_0xf943('0x39')](function(_0x3bb401){_0x3b6943=_0x3bb401;return db[_0xf943('0x86')][_0xf943('0x87')]({'where':{'id':_0x3b6943[_0xf943('0x6c')]}});})['then'](function(_0x47332c){if(_[_0xf943('0x64')](_0x47332c)){return;}else{_0x3b6943[_0xf943('0x5d')]=_0x47332c[_0xf943('0x5d')];return db[_0xf943('0x88')][_0xf943('0x87')]({'where':{'id':_0x3b6943[_0xf943('0x89')]}});}})[_0xf943('0x39')](function(_0x5799b3){return respondWithRpcPromise(_0xf943('0x8a'),_0xf943('0x8a'),{'FaxAccountId':_[_0xf943('0x64')](_0xe5057a[_0xf943('0x5a')])?undefined:_0xe5057a[_0xf943('0x5a')][_0xf943('0x8b')],'path':_[_0xf943('0x64')](_0x5799b3)?undefined:util[_0xf943('0x60')](_0xf943('0x8c'),_0x5799b3[_0xf943('0x8d')]),'fax':_[_0xf943('0x64')](_0x3b6943[_0xf943('0x5d')])?undefined:_0x3b6943['fax'],'AttachmentId':_0x3b6943[_0xf943('0x89')]},client9002);})[_0xf943('0x39')](respondWithResult(_0x55eacb,0xc9))[_0xf943('0x2d')](handleError(_0x55eacb,null));};exports[_0xf943('0x8e')]=function(_0x219a20,_0x18e521){var _0x49bec0=path[_0xf943('0x8f')](config[_0xf943('0x90')],'server','files','attachments');return db[_0xf943('0x52')]['find']({'where':{'id':_0x219a20['params']['id']},'include':[{'model':db[_0xf943('0x88')],'as':_0xf943('0x88')}]})[_0xf943('0x39')](handleEntityNotFound(_0x18e521,null))['then'](function(_0x147909){if(_0x147909){return _0x18e521[_0xf943('0x8e')](path[_0xf943('0x8f')](_0x49bec0,_0x147909[_0xf943('0x88')][_0xf943('0x8d')]));}})['catch'](handleError(_0x18e521,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a05aa83..7af55eb 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 _0x812d=['setMaxListeners','save','update','remove','emit','exports','../../mysqldb','FaxMessage'];(function(_0x22b8c5,_0x4a7a60){var _0x1dc487=function(_0x8cf128){while(--_0x8cf128){_0x22b8c5['push'](_0x22b8c5['shift']());}};_0x1dc487(++_0x4a7a60);}(_0x812d,0x6e));var _0xd812=function(_0x3899ac,_0x26ff96){_0x3899ac=_0x3899ac-0x0;var _0x7a5232=_0x812d[_0x3899ac];return _0x7a5232;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xd812('0x0'))['db'][_0xd812('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd812('0x2')](0x0);var events={'afterCreate':_0xd812('0x3'),'afterUpdate':_0xd812('0x4'),'afterDestroy':_0xd812('0x5')};function emitEvent(_0x15181f){return function(_0x2fba72,_0x47efde,_0x39c083){FaxMessageEvents[_0xd812('0x6')](_0x15181f+':'+_0x2fba72['id'],_0x2fba72);FaxMessageEvents[_0xd812('0x6')](_0x15181f,_0x2fba72);_0x39c083(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xd812('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x99a0=['hook','events','../../mysqldb','remove','emit','hasOwnProperty'];(function(_0x98560e,_0x58a18d){var _0x31ac2b=function(_0x1f9078){while(--_0x1f9078){_0x98560e['push'](_0x98560e['shift']());}};_0x31ac2b(++_0x58a18d);}(_0x99a0,0x121));var _0x099a=function(_0x5b7611,_0x49289a){_0x5b7611=_0x5b7611-0x0;var _0x494e35=_0x99a0[_0x5b7611];return _0x494e35;};'use strict';var EventEmitter=require(_0x099a('0x0'));var FaxMessage=require(_0x099a('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x099a('0x2')};function emitEvent(_0x2b5e88){return function(_0x5d6b40,_0x21d681,_0x1d3f16){FaxMessageEvents[_0x099a('0x3')](_0x2b5e88+':'+_0x5d6b40['id'],_0x5d6b40);FaxMessageEvents[_0x099a('0x3')](_0x2b5e88,_0x5d6b40);_0x1d3f16(null);};}for(var e in events){if(events[_0x099a('0x4')](e)){var event=events[e];FaxMessage[_0x099a('0x5')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b86053f..5e624b9 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 _0x7cf2=['rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x4e0b68,_0x521aea){var _0x4e889c=function(_0x436e2d){while(--_0x436e2d){_0x4e0b68['push'](_0x4e0b68['shift']());}};_0x4e889c(++_0x521aea);}(_0x7cf2,0x156));var _0x27cf=function(_0x2eee25,_0x53460d){_0x2eee25=_0x2eee25-0x0;var _0x1cb8c4=_0x7cf2[_0x2eee25];return _0x1cb8c4;};'use strict';var _=require(_0x27cf('0x0'));var util=require('util');var logger=require(_0x27cf('0x1'))(_0x27cf('0x2'));var moment=require(_0x27cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x27cf('0x4'));var fs=require('fs');var path=require(_0x27cf('0x5'));var rimraf=require(_0x27cf('0x6'));var config=require(_0x27cf('0x7'));var attributes=require(_0x27cf('0x8'));module[_0x27cf('0x9')]=function(_0x1e0a23,_0x96a277){return _0x1e0a23[_0x27cf('0xa')](_0x27cf('0xb'),attributes,{'tableName':_0x27cf('0xc'),'paranoid':![],'indexes':[{'name':_0x27cf('0xd'),'fields':['body'],'type':_0x27cf('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12e3ea,_0x94d94d,_0x470a59){var _0x2486db=_0x1e0a23[_0x27cf('0xf')];var _0x2cf11b=_0x12e3ea[_0x27cf('0x10')]({'plain':!![]});if(_0x2cf11b[_0x27cf('0x11')][_0x27cf('0x12')]()==='in'||_0x2cf11b[_0x27cf('0x11')][_0x27cf('0x12')]()===_0x27cf('0x13')&&!_0x2cf11b['secret']&&!_['isNil'](_0x2cf11b[_0x27cf('0x14')])){_0x2486db[_0x27cf('0x15')][_0x27cf('0x16')]({'where':{'id':_0x2cf11b[_0x27cf('0x17')]}})[_0x27cf('0x18')](function(_0x2bf504){if(_0x2bf504){_0x2bf504[_0x27cf('0x19')]({'lastMsgAt':_0x2cf11b['createdAt'],'lastMsgDirection':_0x2cf11b['direction'][_0x27cf('0x12')]()});}})['catch'](function(_0x5b5a17){console[_0x27cf('0x1a')](_0x5b5a17);});}_0x470a59();}},'charset':_0x27cf('0x1b'),'collate':_0x27cf('0x1c')});}; \ No newline at end of file +var _0x03bd=['define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','catch','error','utf8mb4','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0x03bd,0x1df));var _0xd03b=function(_0x565858,_0x204cec){_0x565858=_0x565858-0x0;var _0xe1f9d0=_0x03bd[_0x565858];return _0xe1f9d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd03b('0x0'))(_0xd03b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd03b('0x2'));var fs=require('fs');var path=require(_0xd03b('0x3'));var rimraf=require(_0xd03b('0x4'));var config=require(_0xd03b('0x5'));var attributes=require(_0xd03b('0x6'));module['exports']=function(_0x48bba9,_0x445a6f){return _0x48bba9[_0xd03b('0x7')](_0xd03b('0x8'),attributes,{'tableName':_0xd03b('0x9'),'paranoid':![],'indexes':[{'name':_0xd03b('0xa'),'fields':[_0xd03b('0xb')],'type':_0xd03b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ac8e3,_0xf5982a,_0x42f006){var _0x44cd49=_0x48bba9[_0xd03b('0xd')];var _0x3f3955=_0x3ac8e3['get']({'plain':!![]});if(_0x3f3955[_0xd03b('0xe')][_0xd03b('0xf')]()==='in'||_0x3f3955[_0xd03b('0xe')][_0xd03b('0xf')]()===_0xd03b('0x10')&&!_0x3f3955[_0xd03b('0x11')]&&!_[_0xd03b('0x12')](_0x3f3955[_0xd03b('0x13')])){_0x44cd49[_0xd03b('0x14')]['findOne']({'where':{'id':_0x3f3955[_0xd03b('0x15')]}})[_0xd03b('0x16')](function(_0x516d8f){if(_0x516d8f){_0x516d8f['update']({'lastMsgAt':_0x3f3955[_0xd03b('0x17')],'lastMsgDirection':_0x3f3955[_0xd03b('0xe')][_0xd03b('0xf')]()});}})[_0xd03b('0x18')](function(_0x3d9c85){console[_0xd03b('0x19')](_0x3d9c85);});}_0x42f006();}},'charset':_0xd03b('0x1a'),'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 5eb47ff..523a357 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x61789e,_0x169e96){var _0x15401c=function(_0x3a381c){while(--_0x3a381c){_0x61789e['push'](_0x61789e['shift']());}};_0x15401c(++_0x169e96);}(_0x55e0,0xdc));var _0x055e=function(_0x2c5456,_0x20c4af){_0x2c5456=_0x2c5456-0x0;var _0x4f1db7=_0x55e0[_0x2c5456];return _0x4f1db7;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file +var _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fd1,0x155));var _0x15fd=function(_0x3b3727,_0x408dac){_0x3b3727=_0x3b3727-0x0;var _0x3dde01=_0x5fd1[_0x3b3727];return _0x3dde01;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index de923b6..66b27f9 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 _0x7c71=['save','update','emit','removeListener','length','faxMessage:','./faxMessage.events'];(function(_0x403d77,_0x5ca92a){var _0x2c4243=function(_0x3532bd){while(--_0x3532bd){_0x403d77['push'](_0x403d77['shift']());}};_0x2c4243(++_0x5ca92a);}(_0x7c71,0x14f));var _0x17c7=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x7c71[_0x15b380];return _0x232c5c;};'use strict';var FaxMessageEvents=require(_0x17c7('0x0'));var events=[_0x17c7('0x1'),'remove',_0x17c7('0x2')];function createListener(_0x360593,_0x31ab94){return function(_0x203c03){_0x31ab94[_0x17c7('0x3')](_0x360593,_0x203c03);};}function removeListener(_0xfaa7d4,_0x3043dc){return function(){FaxMessageEvents[_0x17c7('0x4')](_0xfaa7d4,_0x3043dc);};}exports['register']=function(_0x19d6f2){for(var _0x38147c=0x0,_0x2ca89b=events[_0x17c7('0x5')];_0x38147c<_0x2ca89b;_0x38147c++){var _0x3873ba=events[_0x38147c];var _0x45e590=createListener(_0x17c7('0x6')+_0x3873ba,_0x19d6f2);FaxMessageEvents['on'](_0x3873ba,_0x45e590);}}; \ No newline at end of file +var _0x0779=['emit','removeListener','register','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x56a106,_0xf77dad){var _0x502388=function(_0x22908f){while(--_0x22908f){_0x56a106['push'](_0x56a106['shift']());}};_0x502388(++_0xf77dad);}(_0x0779,0xac));var _0x9077=function(_0x4198ee,_0x133736){_0x4198ee=_0x4198ee-0x0;var _0x1b7320=_0x0779[_0x4198ee];return _0x1b7320;};'use strict';var FaxMessageEvents=require(_0x9077('0x0'));var events=[_0x9077('0x1'),_0x9077('0x2'),_0x9077('0x3')];function createListener(_0x480280,_0x1098c2){return function(_0x2ba21c){_0x1098c2[_0x9077('0x4')](_0x480280,_0x2ba21c);};}function removeListener(_0x590d17,_0x20a757){return function(){FaxMessageEvents[_0x9077('0x5')](_0x590d17,_0x20a757);};}exports[_0x9077('0x6')]=function(_0x530e97){for(var _0x418871=0x0,_0x86cfea=events['length'];_0x418871<_0x86cfea;_0x418871++){var _0x48e616=events[_0x418871];var _0x44b556=createListener(_0x9077('0x7')+_0x48e616,_0x530e97);FaxMessageEvents['on'](_0x48e616,_0x44b556);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3085fee..e7a9cb2 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 _0x4483=['download','post','tracked','fax','faxmessage:create','/:id','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download'];(function(_0x21d06e,_0x317080){var _0x146e0c=function(_0x3157e3){while(--_0x3157e3){_0x21d06e['push'](_0x21d06e['shift']());}};_0x146e0c(++_0x317080);}(_0x4483,0x1a3));var _0x3448=function(_0x3baa9b,_0x52e3c9){_0x3baa9b=_0x3baa9b-0x0;var _0x18b213=_0x4483[_0x3baa9b];return _0x18b213;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')]('/',auth[_0x3448('0xa')](),interaction[_0x3448('0x12')](_0x3448('0x13'),_0x3448('0x14')),controller['create']);router['put'](_0x3448('0x15'),auth[_0x3448('0xa')](),controller['update']);router[_0x3448('0x16')](_0x3448('0x17'),auth[_0x3448('0xa')](),controller['accept']);router[_0x3448('0x16')](_0x3448('0x18'),auth['isAuthenticated'](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')](_0x3448('0x15'),auth['isAuthenticated'](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0x41bb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','connect-timeout'];(function(_0x57592e,_0x1b3940){var _0x2081f6=function(_0x453fed){while(--_0x453fed){_0x57592e['push'](_0x57592e['shift']());}};_0x2081f6(++_0x1b3940);}(_0x41bb,0xc5));var _0xb41b=function(_0x40391d,_0xac993b){_0x40391d=_0x40391d-0x0;var _0x429a6e=_0x41bb[_0x40391d];return _0x429a6e;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0x8')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router['post']('/',auth[_0xb41b('0x9')](),interaction['tracked'](_0xb41b('0xf'),_0xb41b('0x10')),controller[_0xb41b('0x11')]);router[_0xb41b('0x12')](_0xb41b('0xb'),auth['isAuthenticated'](),controller[_0xb41b('0x13')]);router[_0xb41b('0x12')](_0xb41b('0x14'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xb41b('0x16')]);router[_0xb41b('0x17')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 527fb0b..277ef3d 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 _0x87f9=['name','INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0x865e28,_0x3de135){var _0x3c97d9=function(_0x731417){while(--_0x731417){_0x865e28['push'](_0x865e28['shift']());}};_0x3c97d9(++_0x3de135);}(_0x87f9,0x1a2));var _0x987f=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x87f9[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require('sequelize');module[_0x987f('0x0')]={'name':{'type':Sequelize[_0x987f('0x1')],'unique':_0x987f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x987f('0x1')]},'timeout':{'type':Sequelize[_0x987f('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x987f('0x4'),'beepall',_0x987f('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x987f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0fe0=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0fe0,0x6f));var _0x00fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fe0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x00fe('0x0'));module[_0x00fe('0x1')]={'name':{'type':Sequelize[_0x00fe('0x2')],'unique':_0x00fe('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x00fe('0x2')]},'timeout':{'type':Sequelize[_0x00fe('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x00fe('0x5')](_0x00fe('0x6'),_0x00fe('0x7'),_0x00fe('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x00fe('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f3fe289..4edb786 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 _0xa5c1=['sort','pick','filter','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','SIP','faxPause','createdAt','getTeams','hasOwnProperty','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','removeAgents','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','count','limit','set','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','order'];(function(_0x447a3c,_0x243aa2){var _0x44cb87=function(_0x571872){while(--_0x571872){_0x447a3c['push'](_0x447a3c['shift']());}};_0x44cb87(++_0x243aa2);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x1dbb6b,_0xc0a0bf){_0x1dbb6b=_0x1dbb6b-0x0;var _0x64a78b=_0xa5c1[_0x1dbb6b];return _0x64a78b;};'use strict';var BPromise=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var _=require(_0x1a5c('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x1a5c('0x3'));var logger=require('../../config/logger')(_0x1a5c('0x4'));var config=require(_0x1a5c('0x5'));var db=require(_0x1a5c('0x6'))['db'];config[_0x1a5c('0x7')]=_[_0x1a5c('0x8')](config[_0x1a5c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a5c('0x9'))(new Redis(config['redis']));require(_0x1a5c('0xa'))[_0x1a5c('0xb')](socket);function respondWithStatusCode(_0x1702ce,_0x5666c3){_0x5666c3=_0x5666c3||0xcc;return function(_0x39fe5c){if(_0x39fe5c){return _0x1702ce['sendStatus'](_0x5666c3);}return _0x1702ce[_0x1a5c('0xc')](_0x5666c3)[_0x1a5c('0xd')]();};}function respondWithResult(_0x5097cf,_0x1323be){_0x1323be=_0x1323be||0xc8;return function(_0x1ac373){if(_0x1ac373){return _0x5097cf['status'](_0x1323be)[_0x1a5c('0xe')](_0x1ac373);}};}function respondWithFilteredResult(_0x3f7368,_0x591c3d){return function(_0x3f14af){if(_0x3f14af){var _0x3e344e=typeof _0x591c3d[_0x1a5c('0xf')]===_0x1a5c('0x10')&&typeof _0x591c3d['limit']===_0x1a5c('0x10');var _0x3ff425=_0x3f14af['count'];var _0x157ebb=_0x3e344e?0x0:_0x591c3d[_0x1a5c('0xf')];var _0x5cfdb9=_0x3e344e?_0x3f14af[_0x1a5c('0x11')]:_0x591c3d[_0x1a5c('0xf')]+_0x591c3d[_0x1a5c('0x12')];var _0x170112;if(_0x5cfdb9>=_0x3ff425){_0x5cfdb9=_0x3ff425;_0x170112=0xc8;}else{_0x170112=0xce;}_0x3f7368['status'](_0x170112);return _0x3f7368[_0x1a5c('0x13')]('Content-Range',_0x157ebb+'-'+_0x5cfdb9+'/'+_0x3ff425)[_0x1a5c('0xe')](_0x3f14af);}return null;};}function saveUpdates(_0x44648a){return function(_0x57cb61){if(_0x57cb61){return _0x57cb61['update'](_0x44648a)['then'](function(_0x32e177){return _0x32e177;});}return null;};}function removeEntity(_0x2e6a6f){return function(_0x18551c){if(_0x18551c){return _0x18551c[_0x1a5c('0x14')]()[_0x1a5c('0x15')](function(){var _0x57edcd=_0x18551c[_0x1a5c('0x16')]({'plain':!![]});var _0x505162=_0x1a5c('0x17');return db[_0x1a5c('0x18')][_0x1a5c('0x14')]({'where':{'type':_0x505162,'resourceId':_0x57edcd['id']}})['then'](function(){return _0x18551c;});})[_0x1a5c('0x15')](function(){_0x2e6a6f[_0x1a5c('0xc')](0xcc)[_0x1a5c('0xd')]();});}};}function handleEntityNotFound(_0x3502cb){return function(_0x144abf){if(!_0x144abf){_0x3502cb['sendStatus'](0x194);}return _0x144abf;};}function handleError(_0x11964c,_0xbd916e){_0xbd916e=_0xbd916e||0x1f4;return function(_0x8e81fa){logger[_0x1a5c('0x19')](_0x8e81fa[_0x1a5c('0x1a')]);if(_0x8e81fa[_0x1a5c('0x1b')]){delete _0x8e81fa[_0x1a5c('0x1b')];}_0x11964c[_0x1a5c('0xc')](_0xbd916e)[_0x1a5c('0x1c')](_0x8e81fa);};}exports[_0x1a5c('0x1d')]=function(_0x38244c,_0x323272){var _0x4c6520={};var _0x15e334={'count':0x0,'rows':[]};var _0x501397=_[_0x1a5c('0x1e')](db['FaxQueue'][_0x1a5c('0x1f')],function(_0x4323f8){return{'name':_0x4323f8[_0x1a5c('0x20')],'type':_0x4323f8[_0x1a5c('0x21')][_0x1a5c('0x22')]};});_0x4c6520=qs[_0x1a5c('0x23')](_0x501397,_0x38244c);var _0x157376={'where':_0x4c6520[_0x1a5c('0x24')]};return db[_0x1a5c('0x25')][_0x1a5c('0x11')](_0x157376)[_0x1a5c('0x15')](function(_0x4e2fe3){_0x15e334[_0x1a5c('0x11')]=_0x4e2fe3;_0x4c6520[_0x1a5c('0x26')]=qs[_0x1a5c('0x26')](_0x38244c[_0x1a5c('0x27')]);return db[_0x1a5c('0x25')][_0x1a5c('0x28')](_0x4c6520);})[_0x1a5c('0x15')](function(_0x1a2bec){_0x15e334[_0x1a5c('0x29')]=_0x1a2bec;return _0x15e334;})['then'](respondWithFilteredResult(_0x323272,_0x4c6520))[_0x1a5c('0x2a')](handleError(_0x323272,null));};exports[_0x1a5c('0x2b')]=function(_0x257013,_0x131215){var _0x5cce0c={'raw':!![],'where':{'id':_0x257013[_0x1a5c('0x2c')]['id']}},_0x10532b={};_0x10532b[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db[_0x1a5c('0x25')][_0x1a5c('0x1f')]);_0x10532b[_0x1a5c('0x27')]=_['keys'](_0x257013[_0x1a5c('0x27')]);_0x10532b[_0x1a5c('0x2f')]=_['intersection'](_0x10532b[_0x1a5c('0x2d')],_0x10532b[_0x1a5c('0x27')]);_0x5cce0c[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x10532b['model'],qs[_0x1a5c('0x32')](_0x257013[_0x1a5c('0x27')]['fields']));_0x5cce0c[_0x1a5c('0x30')]=_0x5cce0c[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x5cce0c[_0x1a5c('0x30')]:_0x10532b[_0x1a5c('0x2d')];if(_0x257013[_0x1a5c('0x27')][_0x1a5c('0x34')]){_0x5cce0c[_0x1a5c('0x26')]=[{'all':!![]}];}_0x5cce0c=_[_0x1a5c('0x35')]({},_0x5cce0c,_0x257013[_0x1a5c('0x36')]);return db['FaxQueue'][_0x1a5c('0x37')](_0x5cce0c)[_0x1a5c('0x15')](handleEntityNotFound(_0x131215,null))['then'](respondWithResult(_0x131215,null))[_0x1a5c('0x2a')](handleError(_0x131215,null));};exports[_0x1a5c('0x38')]=function(_0x4ba8cf,_0x4abca8){return db[_0x1a5c('0x25')][_0x1a5c('0x38')](_0x4ba8cf[_0x1a5c('0x39')],{})[_0x1a5c('0x15')](function(_0x562ff5){var _0x52ff6c=_0x4ba8cf[_0x1a5c('0x3a')][_0x1a5c('0x16')]({'plain':!![]});if(!_0x52ff6c)throw new Error(_0x1a5c('0x3b'));if(_0x52ff6c['role']===_0x1a5c('0x3a')){var _0x32fc23=_0x562ff5[_0x1a5c('0x16')]({'plain':!![]});var _0x216ba0=_0x1a5c('0x17');return db[_0x1a5c('0x3c')][_0x1a5c('0x37')]({'where':{'name':_0x216ba0,'userProfileId':_0x52ff6c[_0x1a5c('0x3d')]},'raw':!![]})['then'](function(_0x4cb0e8){if(_0x4cb0e8&&_0x4cb0e8['autoAssociation']===0x0){return db[_0x1a5c('0x18')]['create']({'name':_0x32fc23[_0x1a5c('0x1b')],'resourceId':_0x32fc23['id'],'type':_0x4cb0e8[_0x1a5c('0x1b')],'sectionId':_0x4cb0e8['id']},{})[_0x1a5c('0x15')](function(){return _0x562ff5;});}else{return _0x562ff5;}})[_0x1a5c('0x2a')](function(_0x1072d5){logger[_0x1a5c('0x19')](_0x1a5c('0x3e'),_0x1072d5);throw _0x1072d5;});}return _0x562ff5;})['then'](respondWithResult(_0x4abca8,0xc9))[_0x1a5c('0x2a')](handleError(_0x4abca8,null));};exports[_0x1a5c('0x3f')]=function(_0x2fef3e,_0x5e9d4c){if(_0x2fef3e[_0x1a5c('0x39')]['id']){delete _0x2fef3e[_0x1a5c('0x39')]['id'];}return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x2fef3e[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x5e9d4c,null))['then'](saveUpdates(_0x2fef3e[_0x1a5c('0x39')],null))[_0x1a5c('0x15')](respondWithResult(_0x5e9d4c,null))['catch'](handleError(_0x5e9d4c,null));};exports['destroy']=function(_0x56dceb,_0x3de0fa){return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x56dceb[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x3de0fa,null))[_0x1a5c('0x15')](removeEntity(_0x3de0fa,null))[_0x1a5c('0x2a')](handleError(_0x3de0fa,null));};exports[_0x1a5c('0x40')]=function(_0x33f03a,_0x120bdd){return db[_0x1a5c('0x25')][_0x1a5c('0x40')]()[_0x1a5c('0x15')](respondWithResult(_0x120bdd,null))['catch'](handleError(_0x120bdd,null));};exports[_0x1a5c('0x41')]=function(_0x20bad9,_0x3e03f5){var _0x11f4c2={'raw':!![],'where':{}},_0x3244c5={},_0x46d8bb;return db[_0x1a5c('0x25')][_0x1a5c('0x42')]({'where':{'id':_0x20bad9[_0x1a5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3e03f5,null))['then'](function(_0x511c19){if(_0x511c19){_0x46d8bb=_0x511c19[_0x1a5c('0x16')]({'plain':!![]});_0x3244c5[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db['UserFaxQueue'][_0x1a5c('0x1f')]);_0x3244c5[_0x1a5c('0x27')]=_[_0x1a5c('0x2e')](_0x20bad9[_0x1a5c('0x27')]);_0x3244c5[_0x1a5c('0x2f')]=_['intersection'](_0x3244c5[_0x1a5c('0x2d')],_0x3244c5['query']);_0x11f4c2[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x3244c5[_0x1a5c('0x2d')],qs[_0x1a5c('0x32')](_0x20bad9['query'][_0x1a5c('0x32')]));_0x11f4c2[_0x1a5c('0x30')]=_0x11f4c2[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x11f4c2[_0x1a5c('0x30')]:_0x3244c5[_0x1a5c('0x2d')];if(!_0x20bad9[_0x1a5c('0x27')]['hasOwnProperty'](_0x1a5c('0x43'))){_0x11f4c2[_0x1a5c('0x12')]=qs['limit'](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x12')]);_0x11f4c2[_0x1a5c('0xf')]=qs[_0x1a5c('0xf')](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0xf')]);}_0x11f4c2[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x11f4c2[_0x1a5c('0x24')]=qs[_0x1a5c('0x2f')](_[_0x1a5c('0x46')](_0x20bad9[_0x1a5c('0x27')],_0x3244c5[_0x1a5c('0x2f')]));_0x11f4c2[_0x1a5c('0x24')]['FaxQueueId']=_0x511c19['id'];if(_0x20bad9[_0x1a5c('0x27')]['filter']){_0x11f4c2[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x11f4c2[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x11f4c2[_0x1a5c('0x30')],function(_0xc19a6f){var _0x290e41={};_0x290e41[_0xc19a6f]={'$like':'%'+_0x20bad9[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x290e41;})});}_0x11f4c2=_[_0x1a5c('0x35')]({},_0x11f4c2,_0x20bad9['options']);return db[_0x1a5c('0x48')][_0x1a5c('0x28')](_0x11f4c2);}})[_0x1a5c('0x15')](function(_0x3c0268){if(_0x3c0268){return db[_0x1a5c('0x49')][_0x1a5c('0x4a')]({'where':{'id':_[_0x1a5c('0x1e')](_0x3c0268,_0x1a5c('0x4b')),'role':_0x1a5c('0x4c')},'attributes':['id',_0x1a5c('0x1b'),'faxPause',_0x1a5c('0x4d'),'createdAt']});}})['then'](function(_0x4bcbb7){if(_0x4bcbb7){return{'count':_0x4bcbb7[_0x1a5c('0x11')],'rows':_[_0x1a5c('0x1e')](_0x4bcbb7[_0x1a5c('0x29')],function(_0x50a2e5){return{'membername':_0x50a2e5[_0x1a5c('0x1b')],'UserId':_0x50a2e5['id'],'queue_name':_0x46d8bb[_0x1a5c('0x1b')],'FaxQueueId':_0x46d8bb['id'],'interface':util['format']('%s/%s',_0x1a5c('0x4e'),_0x50a2e5[_0x1a5c('0x1b')]),'penalty':0x0,'paused':_0x50a2e5[_0x1a5c('0x4f')],'createdAt':_0x50a2e5[_0x1a5c('0x50')],'updatedAt':_0x50a2e5[_0x1a5c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a5c('0x15')](respondWithFilteredResult(_0x3e03f5,_0x11f4c2))['catch'](handleError(_0x3e03f5,null));};exports['getTeams']=function(_0x288821,_0x4cc324){var _0x190d24={};var _0x2d71f7={};var _0x50ae82;var _0x2c00b4;return db['FaxQueue'][_0x1a5c('0x42')]({'where':{'id':_0x288821[_0x1a5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4cc324,null))[_0x1a5c('0x15')](function(_0x17c53b){if(_0x17c53b){_0x50ae82=_0x17c53b;_0x2d71f7[_0x1a5c('0x2d')]=_['keys'](db['Team']['rawAttributes']);_0x2d71f7[_0x1a5c('0x27')]=_[_0x1a5c('0x2e')](_0x288821['query']);_0x2d71f7[_0x1a5c('0x2f')]=_['intersection'](_0x2d71f7['model'],_0x2d71f7['query']);_0x190d24['attributes']=_[_0x1a5c('0x31')](_0x2d71f7[_0x1a5c('0x2d')],qs[_0x1a5c('0x32')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x32')]));_0x190d24[_0x1a5c('0x30')]=_0x190d24[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x190d24['attributes']:_0x2d71f7[_0x1a5c('0x2d')];_0x190d24[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x190d24['where']=qs[_0x1a5c('0x2f')](_['pick'](_0x288821['query'],_0x2d71f7[_0x1a5c('0x2f')]));if(_0x288821[_0x1a5c('0x27')][_0x1a5c('0x47')]){_0x190d24[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x190d24[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x190d24[_0x1a5c('0x30')],function(_0x16235f){var _0x39c226={};_0x39c226[_0x16235f]={'$like':'%'+_0x288821[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x39c226;})});}_0x190d24=_[_0x1a5c('0x35')]({},_0x190d24,_0x288821['options']);return _0x50ae82[_0x1a5c('0x51')](_0x190d24);}})[_0x1a5c('0x15')](function(_0x29bd89){if(_0x29bd89){_0x2c00b4=_0x29bd89[_0x1a5c('0x33')];if(!_0x288821['query'][_0x1a5c('0x52')](_0x1a5c('0x43'))){_0x190d24[_0x1a5c('0x12')]=qs[_0x1a5c('0x12')](_0x288821[_0x1a5c('0x27')][_0x1a5c('0x12')]);_0x190d24[_0x1a5c('0xf')]=qs['offset'](_0x288821[_0x1a5c('0x27')][_0x1a5c('0xf')]);}return _0x50ae82['getTeams'](_0x190d24);}})[_0x1a5c('0x15')](function(_0x3694a7){if(_0x3694a7){return _0x3694a7?{'count':_0x2c00b4,'rows':_0x3694a7}:null;}})['then'](respondWithResult(_0x4cc324,null))[_0x1a5c('0x2a')](handleError(_0x4cc324,null));};exports[_0x1a5c('0x53')]=function(_0x51483c,_0x2c8caa){var _0x5a1e2d=_0x51483c[_0x1a5c('0x39')]['ids'];return db[_0x1a5c('0x54')][_0x1a5c('0x28')]({'where':{'id':_0x5a1e2d},'attributes':['id'],'include':[{'model':db[_0x1a5c('0x49')],'as':_0x1a5c('0x55'),'attributes':['id',_0x1a5c('0x1b'),_0x1a5c('0x56'),_0x1a5c('0x57'),_0x1a5c('0x58')],'raw':!![]}]})[_0x1a5c('0x15')](function(_0x5db4e1){if(_0x5db4e1){var _0x3ba5be=_[_0x1a5c('0x59')](_0x5db4e1,function(_0x3531f7){var _0x110a81=_0x3531f7[_0x1a5c('0x16')]({'plain':!![]});return _0x110a81[_0x1a5c('0x55')];});return db[_0x1a5c('0x25')][_0x1a5c('0x37')]({'where':{'id':_0x51483c[_0x1a5c('0x2c')]['id']}})['then'](function(_0x49304d){return db[_0x1a5c('0x5a')]['transaction'](function(_0x2bb9b3){return _0x49304d[_0x1a5c('0x53')](_0x5a1e2d,{'transaction':_0x2bb9b3})[_0x1a5c('0x15')](function(){return BPromise[_0x1a5c('0x5b')](_0x3ba5be,function(_0x558e21){return db[_0x1a5c('0x48')][_0x1a5c('0x5c')]({'where':{'UserId':_0x558e21['id'],'FaxQueueId':_0x51483c[_0x1a5c('0x2c')]['id']},'transaction':_0x2bb9b3});});})[_0x1a5c('0x15')](function(){_0x3ba5be[_0x1a5c('0x5d')](function(_0x55a65a){socket['emit'](_0x1a5c('0x5e'),{'UserId':_0x55a65a['id'],'FaxQueueId':_0x49304d['id']});});});});});}})[_0x1a5c('0x15')](respondWithStatusCode(_0x2c8caa,null))[_0x1a5c('0x2a')](handleError(_0x2c8caa,null));};exports['removeTeams']=function(_0x15d2ab,_0x4da8cd){return db[_0x1a5c('0x54')][_0x1a5c('0x28')]({'where':{'id':_0x15d2ab[_0x1a5c('0x27')][_0x1a5c('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x1a5c('0x49')],'as':_0x1a5c('0x55'),'attributes':['id'],'raw':!![]}]})[_0x1a5c('0x15')](handleEntityNotFound(_0x4da8cd,null))[_0x1a5c('0x15')](function(_0x43bd88){var _0x490c84=_[_0x1a5c('0x1e')](_0x43bd88,'id');var _0x10438b=[];var _0x12aa40=[];var _0x16dd12=squel[_0x1a5c('0x60')]();_0x16dd12['field'](_0x1a5c('0x61'))[_0x1a5c('0x62')]('team_has_fax_queues','tq')[_0x1a5c('0x63')](_0x1a5c('0x64'),'ut',_0x1a5c('0x65'))[_0x1a5c('0x24')](_0x1a5c('0x66'),_0x15d2ab['params']['id']);for(var _0x3e56e8=0x0;_0x3e56e8<_0x43bd88[_0x1a5c('0x33')];_0x3e56e8+=0x1){let _0x3802e3=_0x43bd88[_0x3e56e8];for(var _0x29d4ec=0x0;_0x29d4ec<_0x3802e3[_0x1a5c('0x55')][_0x1a5c('0x33')];_0x29d4ec+=0x1){let _0x1caa4b=_0x3802e3[_0x1a5c('0x55')][_0x29d4ec];var _0xeaa5e8=_0x16dd12[_0x1a5c('0x67')]();_0xeaa5e8[_0x1a5c('0x24')]('ut.UserId\x20=\x20?',_0x1caa4b['id']);_0x12aa40['push'](db[_0x1a5c('0x5a')][_0x1a5c('0x27')](_0xeaa5e8[_0x1a5c('0x68')](),{'type':db[_0x1a5c('0x5a')]['QueryTypes'][_0x1a5c('0x69')]})[_0x1a5c('0x15')](function(_0x182b5b){if(_0x182b5b[_0x1a5c('0x33')]===0x1){return _0x1caa4b['id'];}else{var _0x3447a9=_[_0x1a5c('0x6a')](_['map'](_0x182b5b,'TeamId'),function(_0x108276){return _[_0x1a5c('0x6b')](_0x490c84,_0x108276);});if(_0x3447a9){return _0x1caa4b['id'];}}}));}}return BPromise[_0x1a5c('0x6c')](_0x12aa40)[_0x1a5c('0x15')](function(_0x25fc67){_0x10438b=_(_0x10438b)[_0x1a5c('0x6d')](_0x25fc67)[_0x1a5c('0x6e')]()[_0x1a5c('0x6f')]();return db['FaxQueue'][_0x1a5c('0x37')]({'where':{'id':_0x15d2ab[_0x1a5c('0x2c')]['id']}})['then'](function(_0x3d4d37){return db[_0x1a5c('0x5a')][_0x1a5c('0x70')](function(_0x359d08){return _0x3d4d37[_0x1a5c('0x71')](_0x15d2ab['query']['ids'],{'transaction':_0x359d08})[_0x1a5c('0x15')](function(){if(!_[_0x1a5c('0x72')](_0x10438b)){return _0x3d4d37['removeAgents'](_0x10438b,{'transaction':_0x359d08});}})[_0x1a5c('0x15')](function(){_0x10438b[_0x1a5c('0x5d')](function(_0x467c1c){socket[_0x1a5c('0x73')](_0x1a5c('0x74'),{'UserId':_0x467c1c,'FaxQueueId':_0x3d4d37['id']});});});});});});})['then'](respondWithStatusCode(_0x4da8cd,null))[_0x1a5c('0x2a')](handleError(_0x4da8cd,null));};exports[_0x1a5c('0x75')]=function(_0x21cbe2,_0x166cd9){return db[_0x1a5c('0x25')]['find']({'where':{'id':_0x21cbe2[_0x1a5c('0x2c')]['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x166cd9,null))[_0x1a5c('0x15')](function(_0x54c34b){if(_0x54c34b){return _0x54c34b[_0x1a5c('0x75')](_0x21cbe2[_0x1a5c('0x39')][_0x1a5c('0x5f')],_['omit'](_0x21cbe2[_0x1a5c('0x39')],[_0x1a5c('0x5f'),'id'])||{})['spread'](function(_0x39c7f0){for(var _0x5bc8d0=0x0;_0x5bc8d0<_0x21cbe2[_0x1a5c('0x39')]['ids'][_0x1a5c('0x33')];_0x5bc8d0+=0x1){socket['emit'](_0x1a5c('0x5e'),{'UserId':Number(_0x21cbe2[_0x1a5c('0x39')]['ids'][_0x5bc8d0]),'FaxQueueId':Number(_0x21cbe2[_0x1a5c('0x2c')]['id'])});}return _0x39c7f0;});}})[_0x1a5c('0x15')](respondWithResult(_0x166cd9,null))[_0x1a5c('0x2a')](handleError(_0x166cd9,null));};exports[_0x1a5c('0x76')]=function(_0x3e3223,_0x104f24){return db[_0x1a5c('0x25')][_0x1a5c('0x37')]({'where':{'id':_0x3e3223['params']['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x104f24,null))['then'](function(_0x3b4a80){if(_0x3b4a80){return _0x3b4a80[_0x1a5c('0x76')](_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')])[_0x1a5c('0x15')](function(){if(_[_0x1a5c('0x77')](_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')])){for(var _0x26049a=0x0;_0x26049a<_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')]['length'];_0x26049a+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3e3223['query'][_0x1a5c('0x5f')][_0x26049a]),'FaxQueueId':Number(_0x3e3223[_0x1a5c('0x2c')]['id'])});}}else{socket[_0x1a5c('0x73')](_0x1a5c('0x74'),{'UserId':Number(_0x3e3223[_0x1a5c('0x27')][_0x1a5c('0x5f')]),'FaxQueueId':Number(_0x3e3223[_0x1a5c('0x2c')]['id'])});}});}})[_0x1a5c('0x15')](respondWithStatusCode(_0x104f24,null))[_0x1a5c('0x2a')](handleError(_0x104f24,null));};exports[_0x1a5c('0x78')]=function(_0x1aa9a4,_0x1e1716){var _0x2ead60={};var _0x15e72e={};var _0xbf5b38;var _0x347b04;return db[_0x1a5c('0x25')][_0x1a5c('0x42')]({'where':{'id':_0x1aa9a4['params']['id']}})[_0x1a5c('0x15')](handleEntityNotFound(_0x1e1716,null))[_0x1a5c('0x15')](function(_0x45260b){if(_0x45260b){_0xbf5b38=_0x45260b;_0x15e72e[_0x1a5c('0x2d')]=_[_0x1a5c('0x2e')](db['User'][_0x1a5c('0x1f')]);_0x15e72e['query']=_[_0x1a5c('0x2e')](_0x1aa9a4[_0x1a5c('0x27')]);_0x15e72e[_0x1a5c('0x2f')]=_[_0x1a5c('0x31')](_0x15e72e['model'],_0x15e72e[_0x1a5c('0x27')]);_0x2ead60[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x15e72e['model'],qs[_0x1a5c('0x32')](_0x1aa9a4['query'][_0x1a5c('0x32')]));_0x2ead60['attributes']=_0x2ead60[_0x1a5c('0x30')][_0x1a5c('0x33')]?_0x2ead60[_0x1a5c('0x30')]:_0x15e72e['model'];_0x2ead60[_0x1a5c('0x44')]=qs[_0x1a5c('0x45')](_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x45')]);_0x2ead60[_0x1a5c('0x24')]=qs[_0x1a5c('0x2f')](_[_0x1a5c('0x46')](_0x1aa9a4[_0x1a5c('0x27')],_0x15e72e[_0x1a5c('0x2f')]));if(_0x1aa9a4['query']['filter']){_0x2ead60[_0x1a5c('0x24')]=_[_0x1a5c('0x35')](_0x2ead60[_0x1a5c('0x24')],{'$or':_[_0x1a5c('0x1e')](_0x2ead60[_0x1a5c('0x30')],function(_0x53d920){var _0x2f34fc={};_0x2f34fc[_0x53d920]={'$like':'%'+_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x47')]+'%'};return _0x2f34fc;})});}_0x2ead60=_['merge']({},_0x2ead60,_0x1aa9a4[_0x1a5c('0x36')]);return _0xbf5b38[_0x1a5c('0x78')](_0x2ead60);}})[_0x1a5c('0x15')](function(_0x565608){if(_0x565608){_0x347b04=_0x565608['length'];if(!_0x1aa9a4[_0x1a5c('0x27')][_0x1a5c('0x52')](_0x1a5c('0x43'))){_0x2ead60[_0x1a5c('0x12')]=qs[_0x1a5c('0x12')](_0x1aa9a4['query']['limit']);_0x2ead60[_0x1a5c('0xf')]=qs['offset'](_0x1aa9a4['query'][_0x1a5c('0xf')]);}return _0xbf5b38[_0x1a5c('0x78')](_0x2ead60);}})[_0x1a5c('0x15')](function(_0x18dfb8){if(_0x18dfb8){return _0x18dfb8?{'count':_0x347b04,'rows':_0x18dfb8}:null;}})[_0x1a5c('0x15')](respondWithResult(_0x1e1716,null))[_0x1a5c('0x2a')](handleError(_0x1e1716,null));}; \ No newline at end of file +var _0xfd2e=['sendStatus','status','end','json','offset','undefined','count','set','Content-Range','then','destroy','get','FaxQueues','error','name','send','index','map','FaxQueue','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','length','nolimit','limit','order','sort','pick','filter','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','voicePause','interface','sequelize','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','forEach','userFaxQueue:remove','addAgents','removeAgents','isArray','getAgents','bluebird','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket'];(function(_0xc4615a,_0x4defb0){var _0x5e60f9=function(_0x1204e5){while(--_0x1204e5){_0xc4615a['push'](_0xc4615a['shift']());}};_0x5e60f9(++_0x4defb0);}(_0xfd2e,0x6e));var _0xefd2=function(_0x10e2b3,_0x50b33a){_0x10e2b3=_0x10e2b3-0x0;var _0x3f78e8=_0xfd2e[_0x10e2b3];return _0x3f78e8;};'use strict';var BPromise=require(_0xefd2('0x0'));var util=require('util');var _=require(_0xefd2('0x1'));var squel=require('squel');var Redis=require(_0xefd2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xefd2('0x3'))(_0xefd2('0x4'));var config=require(_0xefd2('0x5'));var db=require(_0xefd2('0x6'))['db'];config[_0xefd2('0x7')]=_['defaults'](config['redis'],{'host':_0xefd2('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xefd2('0x9'))['register'](socket);function respondWithStatusCode(_0x440d11,_0x2cfcf2){_0x2cfcf2=_0x2cfcf2||0xcc;return function(_0x4483e5){if(_0x4483e5){return _0x440d11[_0xefd2('0xa')](_0x2cfcf2);}return _0x440d11[_0xefd2('0xb')](_0x2cfcf2)[_0xefd2('0xc')]();};}function respondWithResult(_0x602f0,_0x490a6d){_0x490a6d=_0x490a6d||0xc8;return function(_0x2d8eff){if(_0x2d8eff){return _0x602f0[_0xefd2('0xb')](_0x490a6d)[_0xefd2('0xd')](_0x2d8eff);}};}function respondWithFilteredResult(_0x14de17,_0x63d2e5){return function(_0x8a2723){if(_0x8a2723){var _0x11aab0=typeof _0x63d2e5[_0xefd2('0xe')]==='undefined'&&typeof _0x63d2e5['limit']===_0xefd2('0xf');var _0x4ddfd2=_0x8a2723['count'];var _0x87493c=_0x11aab0?0x0:_0x63d2e5[_0xefd2('0xe')];var _0x1150ec=_0x11aab0?_0x8a2723[_0xefd2('0x10')]:_0x63d2e5[_0xefd2('0xe')]+_0x63d2e5['limit'];var _0x1a35b7;if(_0x1150ec>=_0x4ddfd2){_0x1150ec=_0x4ddfd2;_0x1a35b7=0xc8;}else{_0x1a35b7=0xce;}_0x14de17[_0xefd2('0xb')](_0x1a35b7);return _0x14de17[_0xefd2('0x11')](_0xefd2('0x12'),_0x87493c+'-'+_0x1150ec+'/'+_0x4ddfd2)[_0xefd2('0xd')](_0x8a2723);}return null;};}function saveUpdates(_0x471e3b){return function(_0x58eed0){if(_0x58eed0){return _0x58eed0['update'](_0x471e3b)[_0xefd2('0x13')](function(_0x111d7b){return _0x111d7b;});}return null;};}function removeEntity(_0x1d7240){return function(_0x471175){if(_0x471175){return _0x471175[_0xefd2('0x14')]()['then'](function(){var _0x129ada=_0x471175[_0xefd2('0x15')]({'plain':!![]});var _0x33c88f=_0xefd2('0x16');return db['UserProfileResource'][_0xefd2('0x14')]({'where':{'type':_0x33c88f,'resourceId':_0x129ada['id']}})[_0xefd2('0x13')](function(){return _0x471175;});})[_0xefd2('0x13')](function(){_0x1d7240[_0xefd2('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x292b2d){return function(_0xb5b076){if(!_0xb5b076){_0x292b2d[_0xefd2('0xa')](0x194);}return _0xb5b076;};}function handleError(_0x25196e,_0x2aaa1b){_0x2aaa1b=_0x2aaa1b||0x1f4;return function(_0x3cbff0){logger[_0xefd2('0x17')](_0x3cbff0['stack']);if(_0x3cbff0['name']){delete _0x3cbff0[_0xefd2('0x18')];}_0x25196e[_0xefd2('0xb')](_0x2aaa1b)[_0xefd2('0x19')](_0x3cbff0);};}exports[_0xefd2('0x1a')]=function(_0x1d294c,_0x470684){var _0x42e4e6={};var _0x35ea40={'count':0x0,'rows':[]};var _0x159a53=_[_0xefd2('0x1b')](db[_0xefd2('0x1c')]['rawAttributes'],function(_0x348019){return{'name':_0x348019[_0xefd2('0x1d')],'type':_0x348019[_0xefd2('0x1e')][_0xefd2('0x1f')]};});_0x42e4e6=qs[_0xefd2('0x20')](_0x159a53,_0x1d294c);var _0x22629a={'where':_0x42e4e6[_0xefd2('0x21')]};return db['FaxQueue'][_0xefd2('0x10')](_0x22629a)[_0xefd2('0x13')](function(_0x25f25a){_0x35ea40[_0xefd2('0x10')]=_0x25f25a;_0x42e4e6[_0xefd2('0x22')]=qs['include'](_0x1d294c[_0xefd2('0x23')]);return db[_0xefd2('0x1c')]['findAll'](_0x42e4e6);})[_0xefd2('0x13')](function(_0xaccd28){_0x35ea40[_0xefd2('0x24')]=_0xaccd28;return _0x35ea40;})[_0xefd2('0x13')](respondWithFilteredResult(_0x470684,_0x42e4e6))[_0xefd2('0x25')](handleError(_0x470684,null));};exports[_0xefd2('0x26')]=function(_0x5b9f03,_0x1202a2){var _0xe3f882={'raw':!![],'where':{'id':_0x5b9f03[_0xefd2('0x27')]['id']}},_0x18f86f={};_0x18f86f['model']=_[_0xefd2('0x28')](db[_0xefd2('0x1c')][_0xefd2('0x29')]);_0x18f86f[_0xefd2('0x23')]=_[_0xefd2('0x28')](_0x5b9f03[_0xefd2('0x23')]);_0x18f86f[_0xefd2('0x2a')]=_[_0xefd2('0x2b')](_0x18f86f[_0xefd2('0x2c')],_0x18f86f[_0xefd2('0x23')]);_0xe3f882[_0xefd2('0x2d')]=_['intersection'](_0x18f86f[_0xefd2('0x2c')],qs[_0xefd2('0x2e')](_0x5b9f03['query'][_0xefd2('0x2e')]));_0xe3f882[_0xefd2('0x2d')]=_0xe3f882['attributes']['length']?_0xe3f882[_0xefd2('0x2d')]:_0x18f86f['model'];if(_0x5b9f03[_0xefd2('0x23')][_0xefd2('0x2f')]){_0xe3f882[_0xefd2('0x22')]=[{'all':!![]}];}_0xe3f882=_[_0xefd2('0x30')]({},_0xe3f882,_0x5b9f03[_0xefd2('0x31')]);return db['FaxQueue'][_0xefd2('0x32')](_0xe3f882)[_0xefd2('0x13')](handleEntityNotFound(_0x1202a2,null))[_0xefd2('0x13')](respondWithResult(_0x1202a2,null))[_0xefd2('0x25')](handleError(_0x1202a2,null));};exports[_0xefd2('0x33')]=function(_0x1f189c,_0x175aac){return db[_0xefd2('0x1c')][_0xefd2('0x33')](_0x1f189c[_0xefd2('0x34')],{})[_0xefd2('0x13')](function(_0x3e832a){var _0x11cbfb=_0x1f189c[_0xefd2('0x35')][_0xefd2('0x15')]({'plain':!![]});if(!_0x11cbfb)throw new Error(_0xefd2('0x36'));if(_0x11cbfb[_0xefd2('0x37')]===_0xefd2('0x35')){var _0x155772=_0x3e832a[_0xefd2('0x15')]({'plain':!![]});var _0x3b61bd='FaxQueues';return db[_0xefd2('0x38')]['find']({'where':{'name':_0x3b61bd,'userProfileId':_0x11cbfb[_0xefd2('0x39')]},'raw':!![]})['then'](function(_0x5586ba){if(_0x5586ba&&_0x5586ba[_0xefd2('0x3a')]===0x0){return db[_0xefd2('0x3b')][_0xefd2('0x33')]({'name':_0x155772[_0xefd2('0x18')],'resourceId':_0x155772['id'],'type':_0x5586ba[_0xefd2('0x18')],'sectionId':_0x5586ba['id']},{})['then'](function(){return _0x3e832a;});}else{return _0x3e832a;}})['catch'](function(_0x235f52){logger['error'](_0xefd2('0x3c'),_0x235f52);throw _0x235f52;});}return _0x3e832a;})[_0xefd2('0x13')](respondWithResult(_0x175aac,0xc9))['catch'](handleError(_0x175aac,null));};exports[_0xefd2('0x3d')]=function(_0xc43985,_0x3602ed){if(_0xc43985[_0xefd2('0x34')]['id']){delete _0xc43985['body']['id'];}return db[_0xefd2('0x1c')][_0xefd2('0x32')]({'where':{'id':_0xc43985['params']['id']}})[_0xefd2('0x13')](handleEntityNotFound(_0x3602ed,null))['then'](saveUpdates(_0xc43985[_0xefd2('0x34')],null))['then'](respondWithResult(_0x3602ed,null))['catch'](handleError(_0x3602ed,null));};exports[_0xefd2('0x14')]=function(_0x404b2f,_0x54e2c5){return db[_0xefd2('0x1c')]['find']({'where':{'id':_0x404b2f[_0xefd2('0x27')]['id']}})['then'](handleEntityNotFound(_0x54e2c5,null))[_0xefd2('0x13')](removeEntity(_0x54e2c5,null))[_0xefd2('0x25')](handleError(_0x54e2c5,null));};exports[_0xefd2('0x3e')]=function(_0x4cca71,_0x240590){return db[_0xefd2('0x1c')]['describe']()['then'](respondWithResult(_0x240590,null))[_0xefd2('0x25')](handleError(_0x240590,null));};exports[_0xefd2('0x3f')]=function(_0x4fad61,_0x212875){var _0x471965={'raw':!![],'where':{}},_0x18c4ed={},_0x159917;return db['FaxQueue'][_0xefd2('0x40')]({'where':{'id':_0x4fad61[_0xefd2('0x27')]['id']}})[_0xefd2('0x13')](handleEntityNotFound(_0x212875,null))['then'](function(_0x1b85dd){if(_0x1b85dd){_0x159917=_0x1b85dd['get']({'plain':!![]});_0x18c4ed[_0xefd2('0x2c')]=_['keys'](db[_0xefd2('0x41')][_0xefd2('0x29')]);_0x18c4ed['query']=_[_0xefd2('0x28')](_0x4fad61[_0xefd2('0x23')]);_0x18c4ed[_0xefd2('0x2a')]=_['intersection'](_0x18c4ed['model'],_0x18c4ed[_0xefd2('0x23')]);_0x471965['attributes']=_[_0xefd2('0x2b')](_0x18c4ed[_0xefd2('0x2c')],qs[_0xefd2('0x2e')](_0x4fad61['query']['fields']));_0x471965['attributes']=_0x471965[_0xefd2('0x2d')][_0xefd2('0x42')]?_0x471965[_0xefd2('0x2d')]:_0x18c4ed[_0xefd2('0x2c')];if(!_0x4fad61[_0xefd2('0x23')]['hasOwnProperty'](_0xefd2('0x43'))){_0x471965[_0xefd2('0x44')]=qs[_0xefd2('0x44')](_0x4fad61[_0xefd2('0x23')][_0xefd2('0x44')]);_0x471965[_0xefd2('0xe')]=qs[_0xefd2('0xe')](_0x4fad61[_0xefd2('0x23')][_0xefd2('0xe')]);}_0x471965[_0xefd2('0x45')]=qs[_0xefd2('0x46')](_0x4fad61[_0xefd2('0x23')][_0xefd2('0x46')]);_0x471965[_0xefd2('0x21')]=qs[_0xefd2('0x2a')](_[_0xefd2('0x47')](_0x4fad61[_0xefd2('0x23')],_0x18c4ed[_0xefd2('0x2a')]));_0x471965[_0xefd2('0x21')]['FaxQueueId']=_0x1b85dd['id'];if(_0x4fad61[_0xefd2('0x23')][_0xefd2('0x48')]){_0x471965[_0xefd2('0x21')]=_[_0xefd2('0x30')](_0x471965['where'],{'$or':_[_0xefd2('0x1b')](_0x471965[_0xefd2('0x2d')],function(_0x1037c4){var _0x421906={};_0x421906[_0x1037c4]={'$like':'%'+_0x4fad61[_0xefd2('0x23')][_0xefd2('0x48')]+'%'};return _0x421906;})});}_0x471965=_[_0xefd2('0x30')]({},_0x471965,_0x4fad61[_0xefd2('0x31')]);return db[_0xefd2('0x41')][_0xefd2('0x49')](_0x471965);}})[_0xefd2('0x13')](function(_0x5c475d){if(_0x5c475d){return db[_0xefd2('0x4a')][_0xefd2('0x4b')]({'where':{'id':_[_0xefd2('0x1b')](_0x5c475d,_0xefd2('0x4c')),'role':_0xefd2('0x4d')},'attributes':['id',_0xefd2('0x18'),_0xefd2('0x4e'),_0xefd2('0x4f'),_0xefd2('0x50')]});}})[_0xefd2('0x13')](function(_0x35325d){if(_0x35325d){return{'count':_0x35325d[_0xefd2('0x10')],'rows':_[_0xefd2('0x1b')](_0x35325d[_0xefd2('0x24')],function(_0x52b1ef){return{'membername':_0x52b1ef[_0xefd2('0x18')],'UserId':_0x52b1ef['id'],'queue_name':_0x159917[_0xefd2('0x18')],'FaxQueueId':_0x159917['id'],'interface':util['format'](_0xefd2('0x51'),_0xefd2('0x52'),_0x52b1ef[_0xefd2('0x18')]),'penalty':0x0,'paused':_0x52b1ef['faxPause'],'createdAt':_0x52b1ef['createdAt'],'updatedAt':_0x52b1ef[_0xefd2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xefd2('0x13')](respondWithFilteredResult(_0x212875,_0x471965))['catch'](handleError(_0x212875,null));};exports[_0xefd2('0x53')]=function(_0x35a63e,_0x395501){var _0x5cb14c={};var _0x4c02a8={};var _0x468670;var _0x61ed2a;return db['FaxQueue'][_0xefd2('0x40')]({'where':{'id':_0x35a63e[_0xefd2('0x27')]['id']}})[_0xefd2('0x13')](handleEntityNotFound(_0x395501,null))[_0xefd2('0x13')](function(_0x5b43ba){if(_0x5b43ba){_0x468670=_0x5b43ba;_0x4c02a8[_0xefd2('0x2c')]=_['keys'](db['Team']['rawAttributes']);_0x4c02a8[_0xefd2('0x23')]=_[_0xefd2('0x28')](_0x35a63e[_0xefd2('0x23')]);_0x4c02a8['filters']=_['intersection'](_0x4c02a8['model'],_0x4c02a8['query']);_0x5cb14c[_0xefd2('0x2d')]=_[_0xefd2('0x2b')](_0x4c02a8[_0xefd2('0x2c')],qs[_0xefd2('0x2e')](_0x35a63e[_0xefd2('0x23')][_0xefd2('0x2e')]));_0x5cb14c['attributes']=_0x5cb14c[_0xefd2('0x2d')][_0xefd2('0x42')]?_0x5cb14c['attributes']:_0x4c02a8[_0xefd2('0x2c')];_0x5cb14c['order']=qs[_0xefd2('0x46')](_0x35a63e[_0xefd2('0x23')][_0xefd2('0x46')]);_0x5cb14c['where']=qs['filters'](_['pick'](_0x35a63e['query'],_0x4c02a8[_0xefd2('0x2a')]));if(_0x35a63e[_0xefd2('0x23')][_0xefd2('0x48')]){_0x5cb14c[_0xefd2('0x21')]=_[_0xefd2('0x30')](_0x5cb14c[_0xefd2('0x21')],{'$or':_['map'](_0x5cb14c[_0xefd2('0x2d')],function(_0x1f33af){var _0x4df5da={};_0x4df5da[_0x1f33af]={'$like':'%'+_0x35a63e[_0xefd2('0x23')][_0xefd2('0x48')]+'%'};return _0x4df5da;})});}_0x5cb14c=_[_0xefd2('0x30')]({},_0x5cb14c,_0x35a63e[_0xefd2('0x31')]);return _0x468670[_0xefd2('0x53')](_0x5cb14c);}})[_0xefd2('0x13')](function(_0x1aeb24){if(_0x1aeb24){_0x61ed2a=_0x1aeb24[_0xefd2('0x42')];if(!_0x35a63e[_0xefd2('0x23')][_0xefd2('0x54')](_0xefd2('0x43'))){_0x5cb14c[_0xefd2('0x44')]=qs[_0xefd2('0x44')](_0x35a63e['query'][_0xefd2('0x44')]);_0x5cb14c[_0xefd2('0xe')]=qs[_0xefd2('0xe')](_0x35a63e['query'][_0xefd2('0xe')]);}return _0x468670[_0xefd2('0x53')](_0x5cb14c);}})[_0xefd2('0x13')](function(_0x931fb5){if(_0x931fb5){return _0x931fb5?{'count':_0x61ed2a,'rows':_0x931fb5}:null;}})[_0xefd2('0x13')](respondWithResult(_0x395501,null))[_0xefd2('0x25')](handleError(_0x395501,null));};exports[_0xefd2('0x55')]=function(_0x21e23c,_0x1dd716){var _0x5c70d0=_0x21e23c[_0xefd2('0x34')][_0xefd2('0x56')];return db[_0xefd2('0x57')]['findAll']({'where':{'id':_0x5c70d0},'attributes':['id'],'include':[{'model':db[_0xefd2('0x4a')],'as':_0xefd2('0x58'),'attributes':['id',_0xefd2('0x18'),'online',_0xefd2('0x59'),_0xefd2('0x5a')],'raw':!![]}]})['then'](function(_0x4b567e){if(_0x4b567e){var _0x3b28c9=_['flatMap'](_0x4b567e,function(_0x20804f){var _0x553d87=_0x20804f[_0xefd2('0x15')]({'plain':!![]});return _0x553d87[_0xefd2('0x58')];});return db[_0xefd2('0x1c')][_0xefd2('0x32')]({'where':{'id':_0x21e23c[_0xefd2('0x27')]['id']}})['then'](function(_0x3368f0){return db[_0xefd2('0x5b')]['transaction'](function(_0x4504dc){return _0x3368f0[_0xefd2('0x55')](_0x5c70d0,{'transaction':_0x4504dc})[_0xefd2('0x13')](function(){return BPromise['each'](_0x3b28c9,function(_0x4ceb8a){return db[_0xefd2('0x41')][_0xefd2('0x5c')]({'where':{'UserId':_0x4ceb8a['id'],'FaxQueueId':_0x21e23c[_0xefd2('0x27')]['id']},'transaction':_0x4504dc});});})[_0xefd2('0x13')](function(){_0x3b28c9['forEach'](function(_0x2fe134){socket[_0xefd2('0x5d')](_0xefd2('0x5e'),{'UserId':_0x2fe134['id'],'FaxQueueId':_0x3368f0['id']});});});});});}})['then'](respondWithStatusCode(_0x1dd716,null))[_0xefd2('0x25')](handleError(_0x1dd716,null));};exports[_0xefd2('0x5f')]=function(_0xc45f3e,_0x493537){return db[_0xefd2('0x57')][_0xefd2('0x49')]({'where':{'id':_0xc45f3e['query'][_0xefd2('0x56')]},'attributes':['id'],'include':[{'model':db[_0xefd2('0x4a')],'as':_0xefd2('0x58'),'attributes':['id'],'raw':!![]}]})[_0xefd2('0x13')](handleEntityNotFound(_0x493537,null))['then'](function(_0x1ad0a5){var _0x147d62=_[_0xefd2('0x1b')](_0x1ad0a5,'id');var _0x537896=[];var _0x1725c2=[];var _0xe47b3=squel[_0xefd2('0x60')]();_0xe47b3[_0xefd2('0x61')]('tq.TeamId')[_0xefd2('0x62')]('team_has_fax_queues','tq')[_0xefd2('0x63')]('user_has_teams','ut',_0xefd2('0x64'))[_0xefd2('0x21')](_0xefd2('0x65'),_0xc45f3e[_0xefd2('0x27')]['id']);for(var _0x188758=0x0;_0x188758<_0x1ad0a5[_0xefd2('0x42')];_0x188758+=0x1){let _0x4032c3=_0x1ad0a5[_0x188758];for(var _0x4c1a5c=0x0;_0x4c1a5c<_0x4032c3[_0xefd2('0x58')][_0xefd2('0x42')];_0x4c1a5c+=0x1){let _0x4f5673=_0x4032c3['Agents'][_0x4c1a5c];var _0xf99410=_0xe47b3['clone']();_0xf99410[_0xefd2('0x21')]('ut.UserId\x20=\x20?',_0x4f5673['id']);_0x1725c2[_0xefd2('0x66')](db[_0xefd2('0x5b')][_0xefd2('0x23')](_0xf99410[_0xefd2('0x67')](),{'type':db[_0xefd2('0x5b')][_0xefd2('0x68')][_0xefd2('0x69')]})[_0xefd2('0x13')](function(_0x526220){if(_0x526220['length']===0x1){return _0x4f5673['id'];}else{var _0x3b4825=_[_0xefd2('0x6a')](_[_0xefd2('0x1b')](_0x526220,_0xefd2('0x6b')),function(_0x372e67){return _['includes'](_0x147d62,_0x372e67);});if(_0x3b4825){return _0x4f5673['id'];}}}));}}return BPromise[_0xefd2('0x6c')](_0x1725c2)['then'](function(_0x1ba2b0){_0x537896=_(_0x537896)[_0xefd2('0x6d')](_0x1ba2b0)[_0xefd2('0x6e')]()[_0xefd2('0x6f')]();return db[_0xefd2('0x1c')][_0xefd2('0x32')]({'where':{'id':_0xc45f3e[_0xefd2('0x27')]['id']}})[_0xefd2('0x13')](function(_0x5e151e){return db[_0xefd2('0x5b')][_0xefd2('0x70')](function(_0x4909f0){return _0x5e151e[_0xefd2('0x5f')](_0xc45f3e[_0xefd2('0x23')]['ids'],{'transaction':_0x4909f0})[_0xefd2('0x13')](function(){if(!_[_0xefd2('0x71')](_0x537896)){return _0x5e151e['removeAgents'](_0x537896,{'transaction':_0x4909f0});}})[_0xefd2('0x13')](function(){_0x537896[_0xefd2('0x72')](function(_0x31241f){socket['emit'](_0xefd2('0x73'),{'UserId':_0x31241f,'FaxQueueId':_0x5e151e['id']});});});});});});})[_0xefd2('0x13')](respondWithStatusCode(_0x493537,null))[_0xefd2('0x25')](handleError(_0x493537,null));};exports[_0xefd2('0x74')]=function(_0x224936,_0x14f20f){return db[_0xefd2('0x1c')][_0xefd2('0x32')]({'where':{'id':_0x224936[_0xefd2('0x27')]['id']}})['then'](handleEntityNotFound(_0x14f20f,null))[_0xefd2('0x13')](function(_0x3fbcba){if(_0x3fbcba){return _0x3fbcba[_0xefd2('0x74')](_0x224936['body'][_0xefd2('0x56')],_['omit'](_0x224936[_0xefd2('0x34')],[_0xefd2('0x56'),'id'])||{})['spread'](function(_0x39ffc1){for(var _0x389d59=0x0;_0x389d59<_0x224936['body'][_0xefd2('0x56')][_0xefd2('0x42')];_0x389d59+=0x1){socket[_0xefd2('0x5d')](_0xefd2('0x5e'),{'UserId':Number(_0x224936[_0xefd2('0x34')]['ids'][_0x389d59]),'FaxQueueId':Number(_0x224936[_0xefd2('0x27')]['id'])});}return _0x39ffc1;});}})[_0xefd2('0x13')](respondWithResult(_0x14f20f,null))['catch'](handleError(_0x14f20f,null));};exports[_0xefd2('0x75')]=function(_0x37e0dd,_0x3405dc){return db[_0xefd2('0x1c')][_0xefd2('0x32')]({'where':{'id':_0x37e0dd[_0xefd2('0x27')]['id']}})[_0xefd2('0x13')](handleEntityNotFound(_0x3405dc,null))[_0xefd2('0x13')](function(_0x620673){if(_0x620673){return _0x620673[_0xefd2('0x75')](_0x37e0dd['query'][_0xefd2('0x56')])[_0xefd2('0x13')](function(){if(_[_0xefd2('0x76')](_0x37e0dd[_0xefd2('0x23')][_0xefd2('0x56')])){for(var _0x202150=0x0;_0x202150<_0x37e0dd[_0xefd2('0x23')][_0xefd2('0x56')]['length'];_0x202150+=0x1){socket[_0xefd2('0x5d')](_0xefd2('0x73'),{'UserId':Number(_0x37e0dd['query'][_0xefd2('0x56')][_0x202150]),'FaxQueueId':Number(_0x37e0dd[_0xefd2('0x27')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x37e0dd[_0xefd2('0x23')][_0xefd2('0x56')]),'FaxQueueId':Number(_0x37e0dd[_0xefd2('0x27')]['id'])});}});}})[_0xefd2('0x13')](respondWithStatusCode(_0x3405dc,null))['catch'](handleError(_0x3405dc,null));};exports[_0xefd2('0x77')]=function(_0x1e50c0,_0x5b804e){var _0x401fba={};var _0x3051f6={};var _0x8500b2;var _0x5ada72;return db[_0xefd2('0x1c')][_0xefd2('0x40')]({'where':{'id':_0x1e50c0['params']['id']}})[_0xefd2('0x13')](handleEntityNotFound(_0x5b804e,null))[_0xefd2('0x13')](function(_0x150d6a){if(_0x150d6a){_0x8500b2=_0x150d6a;_0x3051f6['model']=_[_0xefd2('0x28')](db[_0xefd2('0x4a')]['rawAttributes']);_0x3051f6[_0xefd2('0x23')]=_['keys'](_0x1e50c0[_0xefd2('0x23')]);_0x3051f6[_0xefd2('0x2a')]=_[_0xefd2('0x2b')](_0x3051f6[_0xefd2('0x2c')],_0x3051f6[_0xefd2('0x23')]);_0x401fba[_0xefd2('0x2d')]=_['intersection'](_0x3051f6['model'],qs[_0xefd2('0x2e')](_0x1e50c0['query'][_0xefd2('0x2e')]));_0x401fba['attributes']=_0x401fba[_0xefd2('0x2d')][_0xefd2('0x42')]?_0x401fba[_0xefd2('0x2d')]:_0x3051f6[_0xefd2('0x2c')];_0x401fba[_0xefd2('0x45')]=qs['sort'](_0x1e50c0['query'][_0xefd2('0x46')]);_0x401fba['where']=qs[_0xefd2('0x2a')](_[_0xefd2('0x47')](_0x1e50c0[_0xefd2('0x23')],_0x3051f6[_0xefd2('0x2a')]));if(_0x1e50c0[_0xefd2('0x23')][_0xefd2('0x48')]){_0x401fba[_0xefd2('0x21')]=_[_0xefd2('0x30')](_0x401fba[_0xefd2('0x21')],{'$or':_[_0xefd2('0x1b')](_0x401fba['attributes'],function(_0x53ce21){var _0x1c7e46={};_0x1c7e46[_0x53ce21]={'$like':'%'+_0x1e50c0[_0xefd2('0x23')][_0xefd2('0x48')]+'%'};return _0x1c7e46;})});}_0x401fba=_['merge']({},_0x401fba,_0x1e50c0['options']);return _0x8500b2[_0xefd2('0x77')](_0x401fba);}})[_0xefd2('0x13')](function(_0x3ec1a9){if(_0x3ec1a9){_0x5ada72=_0x3ec1a9['length'];if(!_0x1e50c0[_0xefd2('0x23')][_0xefd2('0x54')](_0xefd2('0x43'))){_0x401fba['limit']=qs[_0xefd2('0x44')](_0x1e50c0[_0xefd2('0x23')]['limit']);_0x401fba[_0xefd2('0xe')]=qs['offset'](_0x1e50c0[_0xefd2('0x23')][_0xefd2('0xe')]);}return _0x8500b2['getAgents'](_0x401fba);}})[_0xefd2('0x13')](function(_0x1b905d){if(_0x1b905d){return _0x1b905d?{'count':_0x5ada72,'rows':_0x1b905d}:null;}})[_0xefd2('0x13')](respondWithResult(_0x5b804e,null))['catch'](handleError(_0x5b804e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 973780b..134e4ce 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 _0xd738=['emit','exports','events','FaxQueue','update','remove'];(function(_0x5eeef1,_0x40559b){var _0x1fe0ae=function(_0x5c115d){while(--_0x5c115d){_0x5eeef1['push'](_0x5eeef1['shift']());}};_0x1fe0ae(++_0x40559b);}(_0xd738,0xb0));var _0x8d73=function(_0x19ffdc,_0x16fc07){_0x19ffdc=_0x19ffdc-0x0;var _0x48e505=_0xd738[_0x19ffdc];return _0x48e505;};'use strict';var EventEmitter=require(_0x8d73('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x8d73('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d73('0x2'),'afterDestroy':_0x8d73('0x3')};function emitEvent(_0x265489){return function(_0x528d16,_0x773e47,_0x44f048){FaxQueueEvents[_0x8d73('0x4')](_0x265489+':'+_0x528d16['id'],_0x528d16);FaxQueueEvents[_0x8d73('0x4')](_0x265489,_0x528d16);_0x44f048(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8d73('0x5')]=FaxQueueEvents; \ No newline at end of file +var _0x9f80=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x46bfa3,_0xdefa25){var _0x4ec304=function(_0x42a092){while(--_0x42a092){_0x46bfa3['push'](_0x46bfa3['shift']());}};_0x4ec304(++_0xdefa25);}(_0x9f80,0x1a7));var _0x09f8=function(_0x954247,_0x49f28d){_0x954247=_0x954247-0x0;var _0x4ded8d=_0x9f80[_0x954247];return _0x4ded8d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x09f8('0x0'))['db'][_0x09f8('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x09f8('0x2')](0x0);var events={'afterCreate':_0x09f8('0x3'),'afterUpdate':_0x09f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2317d2){return function(_0x5a3033,_0x2fedee,_0x2f7383){FaxQueueEvents['emit'](_0x2317d2+':'+_0x5a3033['id'],_0x5a3033);FaxQueueEvents[_0x09f8('0x5')](_0x2317d2,_0x5a3033);_0x2f7383(null);};}for(var e in events){if(events[_0x09f8('0x6')](e)){var event=events[e];FaxQueue[_0x09f8('0x7')](e,emitEvent(event));}}module[_0x09f8('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 c742b1a..7d517d2 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 _0xfe6a=['path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xfe6a,0x1db));var _0xafe6=function(_0x46b842,_0x2af2bd){_0x46b842=_0x46b842-0x0;var _0x27197f=_0xfe6a[_0x46b842];return _0x27197f;};'use strict';var _=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var logger=require(_0xafe6('0x2'))('api');var moment=require(_0xafe6('0x3'));var BPromise=require(_0xafe6('0x4'));var rp=require(_0xafe6('0x5'));var fs=require('fs');var path=require(_0xafe6('0x6'));var rimraf=require('rimraf');var config=require(_0xafe6('0x7'));var attributes=require(_0xafe6('0x8'));module[_0xafe6('0x9')]=function(_0x29b32e,_0xb27498){return _0x29b32e[_0xafe6('0xa')](_0xafe6('0xb'),attributes,{'tableName':_0xafe6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2607=['./faxQueue.attributes','exports','FaxQueue','fax_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37a222,_0x421220){var _0x552aa2=function(_0x3a07cd){while(--_0x3a07cd){_0x37a222['push'](_0x37a222['shift']());}};_0x552aa2(++_0x421220);}(_0x2607,0x154));var _0x7260=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x2607[_0x17928f];return _0x500b63;};'use strict';var _=require('lodash');var util=require(_0x7260('0x0'));var logger=require(_0x7260('0x1'))('api');var moment=require(_0x7260('0x2'));var BPromise=require(_0x7260('0x3'));var rp=require(_0x7260('0x4'));var fs=require('fs');var path=require(_0x7260('0x5'));var rimraf=require(_0x7260('0x6'));var config=require(_0x7260('0x7'));var attributes=require(_0x7260('0x8'));module[_0x7260('0x9')]=function(_0x471d9d,_0x228d06){return _0x471d9d['define'](_0x7260('0xa'),attributes,{'tableName':_0x7260('0xb'),'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 69ab43e..490186a 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 _0x4ec1=['code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x4ec1,0xbb));var _0x14ec=function(_0x204b54,_0x170b87){_0x204b54=_0x204b54-0x0;var _0x36c26b=_0x4ec1[_0x204b54];return _0x36c26b;};'use strict';var _=require('lodash');var util=require(_0x14ec('0x0'));var moment=require(_0x14ec('0x1'));var BPromise=require(_0x14ec('0x2'));var rs=require(_0x14ec('0x3'));var fs=require('fs');var Redis=require(_0x14ec('0x4'));var db=require(_0x14ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14ec('0x6'))('rpc');var config=require(_0x14ec('0x7'));var jayson=require(_0x14ec('0x8'));var client=jayson[_0x14ec('0x9')][_0x14ec('0xa')]({'port':0x232a});config[_0x14ec('0xb')]=_[_0x14ec('0xc')](config['redis'],{'host':_0x14ec('0xd'),'port':0x18eb});var socket=require(_0x14ec('0xe'))(new Redis(config[_0x14ec('0xb')]));require(_0x14ec('0xf'))[_0x14ec('0x10')](socket);function respondWithRpcPromise(_0x58fa00,_0x16be25,_0x449d0e){return new BPromise(function(_0x15fe3f,_0x2ff09a){return client[_0x14ec('0x11')](_0x58fa00,_0x449d0e)['then'](function(_0x3de913){logger[_0x14ec('0x12')]('FaxQueue,\x20%s,\x20%s',_0x16be25,_0x14ec('0x13'));logger['debug'](_0x14ec('0x14'),_0x16be25,_0x14ec('0x13'),JSON[_0x14ec('0x15')](_0x3de913));if(_0x3de913[_0x14ec('0x16')]){if(_0x3de913[_0x14ec('0x16')][_0x14ec('0x17')]===0x1f4){logger[_0x14ec('0x16')](_0x14ec('0x18'),_0x16be25,_0x3de913['error'][_0x14ec('0x19')]);return _0x2ff09a(_0x3de913[_0x14ec('0x16')][_0x14ec('0x19')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x16be25,_0x3de913[_0x14ec('0x16')][_0x14ec('0x19')]);return _0x15fe3f(_0x3de913[_0x14ec('0x16')][_0x14ec('0x19')]);}else{logger[_0x14ec('0x12')](_0x14ec('0x18'),_0x16be25,_0x14ec('0x13'));_0x15fe3f(_0x3de913[_0x14ec('0x1a')][_0x14ec('0x19')]);}})[_0x14ec('0x1b')](function(_0x4467c4){logger['error'](_0x14ec('0x18'),_0x16be25,_0x4467c4);_0x2ff09a(_0x4467c4);});});}exports[_0x14ec('0x1c')]=function(_0x29d6c3){var _0x5acc51=this;return new Promise(function(_0x7f0531,_0x289d00){return db[_0x14ec('0x1d')][_0x14ec('0x1e')]({'raw':_0x29d6c3[_0x14ec('0x1f')]?_0x29d6c3[_0x14ec('0x1f')][_0x14ec('0x20')]===undefined?!![]:![]:!![],'where':_0x29d6c3[_0x14ec('0x1f')]?_0x29d6c3['options'][_0x14ec('0x21')]||null:null,'attributes':_0x29d6c3['options']?_0x29d6c3['options'][_0x14ec('0x22')]||null:null,'limit':_0x29d6c3[_0x14ec('0x1f')]?_0x29d6c3[_0x14ec('0x1f')][_0x14ec('0x23')]||null:null,'include':_0x29d6c3[_0x14ec('0x1f')]?_0x29d6c3[_0x14ec('0x1f')][_0x14ec('0x24')]?_[_0x14ec('0x25')](_0x29d6c3[_0x14ec('0x1f')][_0x14ec('0x24')],function(_0x2f494b){return{'model':db[_0x2f494b['model']],'as':_0x2f494b['as'],'attributes':_0x2f494b[_0x14ec('0x22')],'include':_0x2f494b['include']?_[_0x14ec('0x25')](_0x2f494b[_0x14ec('0x24')],function(_0x30c409){return{'model':db[_0x30c409[_0x14ec('0x26')]],'as':_0x30c409['as'],'attributes':_0x30c409['attributes'],'include':_0x30c409[_0x14ec('0x24')]?_[_0x14ec('0x25')](_0x30c409[_0x14ec('0x24')],function(_0x3118ec){return{'model':db[_0x3118ec['model']],'as':_0x3118ec['as'],'attributes':_0x3118ec[_0x14ec('0x22')]};}):[]};}):[]};}):[]:[]})[_0x14ec('0x27')](function(_0x36b641){logger['info'](_0x14ec('0x1c'),_0x29d6c3);logger[_0x14ec('0x28')](_0x14ec('0x1c'),_0x29d6c3,JSON[_0x14ec('0x15')](_0x36b641));_0x7f0531(_0x36b641);})[_0x14ec('0x1b')](function(_0x4ef6ef){logger['error'](_0x14ec('0x1c'),_0x4ef6ef[_0x14ec('0x19')],_0x29d6c3);_0x289d00(_0x5acc51[_0x14ec('0x16')](0x1f4,_0x4ef6ef[_0x14ec('0x19')]));});});};exports[_0x14ec('0x29')]=function(_0x2283ff){var _0x34feba=this;return new Promise(function(_0x66b0c7,_0x2fa899){return db[_0x14ec('0x1d')]['find']({'raw':_0x2283ff[_0x14ec('0x1f')]?_0x2283ff[_0x14ec('0x1f')][_0x14ec('0x20')]===undefined?!![]:![]:!![],'where':_0x2283ff[_0x14ec('0x1f')]?_0x2283ff['options'][_0x14ec('0x21')]||null:null,'attributes':_0x2283ff['options']?_0x2283ff[_0x14ec('0x1f')]['attributes']||null:null,'include':_0x2283ff[_0x14ec('0x1f')]?_0x2283ff[_0x14ec('0x1f')][_0x14ec('0x24')]?_['map'](_0x2283ff['options'][_0x14ec('0x24')],function(_0x3386af){return{'model':db[_0x3386af[_0x14ec('0x26')]],'as':_0x3386af['as'],'attributes':_0x3386af['attributes'],'include':_0x3386af[_0x14ec('0x24')]?_[_0x14ec('0x25')](_0x3386af['include'],function(_0xc4770){return{'model':db[_0xc4770[_0x14ec('0x26')]],'as':_0xc4770['as'],'attributes':_0xc4770[_0x14ec('0x22')],'include':_0xc4770[_0x14ec('0x24')]?_[_0x14ec('0x25')](_0xc4770[_0x14ec('0x24')],function(_0x5dbe8b){return{'model':db[_0x5dbe8b[_0x14ec('0x26')]],'as':_0x5dbe8b['as'],'attributes':_0x5dbe8b[_0x14ec('0x22')]};}):[]};}):[]};}):[]:[]})[_0x14ec('0x27')](function(_0x2c9a44){logger['info'](_0x14ec('0x29'),_0x2283ff);logger['debug'](_0x14ec('0x29'),_0x2283ff,JSON[_0x14ec('0x15')](_0x2c9a44));_0x66b0c7(_0x2c9a44);})[_0x14ec('0x1b')](function(_0x365dde){logger[_0x14ec('0x16')](_0x14ec('0x29'),_0x365dde['message'],_0x2283ff);_0x2fa899(_0x34feba['error'](0x1f4,_0x365dde['message']));});});}; \ No newline at end of file +var _0x99c4=['find','where','ShowFaxQueue','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','options','raw','limit','include','model','attributes','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x99c4,0x123));var _0x499c=function(_0x31ddef,_0x4230ff){_0x31ddef=_0x31ddef-0x0;var _0x350c51=_0x99c4[_0x31ddef];return _0x350c51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x499c('0x0'));var BPromise=require(_0x499c('0x1'));var rs=require(_0x499c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x499c('0x3'));var logger=require(_0x499c('0x4'))(_0x499c('0x5'));var config=require('../../config/environment');var jayson=require(_0x499c('0x6'));var client=jayson[_0x499c('0x7')][_0x499c('0x8')]({'port':0x232a});config[_0x499c('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x499c('0xa'))(new Redis(config['redis']));require(_0x499c('0xb'))['register'](socket);function respondWithRpcPromise(_0x502736,_0x263850,_0x16bdb6){return new BPromise(function(_0x273e0f,_0x1654c4){return client[_0x499c('0xc')](_0x502736,_0x16bdb6)[_0x499c('0xd')](function(_0x599a71){logger[_0x499c('0xe')]('FaxQueue,\x20%s,\x20%s',_0x263850,_0x499c('0xf'));logger[_0x499c('0x10')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x263850,_0x499c('0xf'),JSON[_0x499c('0x11')](_0x599a71));if(_0x599a71[_0x499c('0x12')]){if(_0x599a71[_0x499c('0x12')][_0x499c('0x13')]===0x1f4){logger['error'](_0x499c('0x14'),_0x263850,_0x599a71[_0x499c('0x12')][_0x499c('0x15')]);return _0x1654c4(_0x599a71[_0x499c('0x12')][_0x499c('0x15')]);}logger[_0x499c('0x12')]('FaxQueue,\x20%s,\x20%s',_0x263850,_0x599a71[_0x499c('0x12')][_0x499c('0x15')]);return _0x273e0f(_0x599a71[_0x499c('0x12')][_0x499c('0x15')]);}else{logger[_0x499c('0xe')](_0x499c('0x14'),_0x263850,_0x499c('0xf'));_0x273e0f(_0x599a71[_0x499c('0x16')][_0x499c('0x15')]);}})[_0x499c('0x17')](function(_0x2e4d88){logger[_0x499c('0x12')](_0x499c('0x14'),_0x263850,_0x2e4d88);_0x1654c4(_0x2e4d88);});});}exports[_0x499c('0x18')]=function(_0x8a4d4){var _0x51d191=this;return new Promise(function(_0x3f39d3,_0x30b4b6){return db[_0x499c('0x19')]['findAll']({'raw':_0x8a4d4[_0x499c('0x1a')]?_0x8a4d4[_0x499c('0x1a')][_0x499c('0x1b')]===undefined?!![]:![]:!![],'where':_0x8a4d4['options']?_0x8a4d4[_0x499c('0x1a')]['where']||null:null,'attributes':_0x8a4d4[_0x499c('0x1a')]?_0x8a4d4['options']['attributes']||null:null,'limit':_0x8a4d4[_0x499c('0x1a')]?_0x8a4d4[_0x499c('0x1a')][_0x499c('0x1c')]||null:null,'include':_0x8a4d4[_0x499c('0x1a')]?_0x8a4d4[_0x499c('0x1a')][_0x499c('0x1d')]?_['map'](_0x8a4d4[_0x499c('0x1a')]['include'],function(_0xb5f5b1){return{'model':db[_0xb5f5b1[_0x499c('0x1e')]],'as':_0xb5f5b1['as'],'attributes':_0xb5f5b1[_0x499c('0x1f')],'include':_0xb5f5b1[_0x499c('0x1d')]?_['map'](_0xb5f5b1[_0x499c('0x1d')],function(_0x13e92f){return{'model':db[_0x13e92f['model']],'as':_0x13e92f['as'],'attributes':_0x13e92f[_0x499c('0x1f')],'include':_0x13e92f['include']?_[_0x499c('0x20')](_0x13e92f['include'],function(_0x529ab6){return{'model':db[_0x529ab6[_0x499c('0x1e')]],'as':_0x529ab6['as'],'attributes':_0x529ab6['attributes']};}):[]};}):[]};}):[]:[]})[_0x499c('0xd')](function(_0x20f884){logger[_0x499c('0xe')](_0x499c('0x18'),_0x8a4d4);logger['debug'](_0x499c('0x18'),_0x8a4d4,JSON[_0x499c('0x11')](_0x20f884));_0x3f39d3(_0x20f884);})[_0x499c('0x17')](function(_0x2d0bde){logger[_0x499c('0x12')](_0x499c('0x18'),_0x2d0bde[_0x499c('0x15')],_0x8a4d4);_0x30b4b6(_0x51d191[_0x499c('0x12')](0x1f4,_0x2d0bde['message']));});});};exports['ShowFaxQueue']=function(_0x2b13d1){var _0x32450b=this;return new Promise(function(_0x220c57,_0x2be718){return db[_0x499c('0x19')][_0x499c('0x21')]({'raw':_0x2b13d1['options']?_0x2b13d1['options'][_0x499c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b13d1[_0x499c('0x1a')]?_0x2b13d1[_0x499c('0x1a')][_0x499c('0x22')]||null:null,'attributes':_0x2b13d1[_0x499c('0x1a')]?_0x2b13d1[_0x499c('0x1a')][_0x499c('0x1f')]||null:null,'include':_0x2b13d1[_0x499c('0x1a')]?_0x2b13d1['options'][_0x499c('0x1d')]?_[_0x499c('0x20')](_0x2b13d1['options'][_0x499c('0x1d')],function(_0x436873){return{'model':db[_0x436873[_0x499c('0x1e')]],'as':_0x436873['as'],'attributes':_0x436873[_0x499c('0x1f')],'include':_0x436873['include']?_[_0x499c('0x20')](_0x436873[_0x499c('0x1d')],function(_0xfade84){return{'model':db[_0xfade84['model']],'as':_0xfade84['as'],'attributes':_0xfade84[_0x499c('0x1f')],'include':_0xfade84[_0x499c('0x1d')]?_[_0x499c('0x20')](_0xfade84['include'],function(_0x204644){return{'model':db[_0x204644[_0x499c('0x1e')]],'as':_0x204644['as'],'attributes':_0x204644[_0x499c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x499c('0xd')](function(_0x126dbf){logger['info'](_0x499c('0x23'),_0x2b13d1);logger[_0x499c('0x10')](_0x499c('0x23'),_0x2b13d1,JSON[_0x499c('0x11')](_0x126dbf));_0x220c57(_0x126dbf);})[_0x499c('0x17')](function(_0xe7a305){logger['error'](_0x499c('0x23'),_0xe7a305[_0x499c('0x15')],_0x2b13d1);_0x2be718(_0x32450b[_0x499c('0x12')](0x1f4,_0xe7a305[_0x499c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dcbde3f..2498107 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 _0x4d1b=['removeListener','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0xa193de,_0x276446){var _0xd9e427=function(_0x1aedbc){while(--_0x1aedbc){_0xa193de['push'](_0xa193de['shift']());}};_0xd9e427(++_0x276446);}(_0x4d1b,0x128));var _0xb4d1=function(_0x53361f,_0x3b2cb6){_0x53361f=_0x53361f-0x0;var _0x279237=_0x4d1b[_0x53361f];return _0x279237;};'use strict';var FaxQueueEvents=require(_0xb4d1('0x0'));var events=[_0xb4d1('0x1'),'remove',_0xb4d1('0x2')];function createListener(_0x5e3980,_0x3c542d){return function(_0xff7ed6){_0x3c542d[_0xb4d1('0x3')](_0x5e3980,_0xff7ed6);};}function removeListener(_0x2ce643,_0x1c279e){return function(){FaxQueueEvents[_0xb4d1('0x4')](_0x2ce643,_0x1c279e);};}exports['register']=function(_0x2f59d0){for(var _0x4d0f39=0x0,_0x5c02c7=events['length'];_0x4d0f39<_0x5c02c7;_0x4d0f39++){var _0x102ced=events[_0x4d0f39];var _0x4cab1d=createListener(_0xb4d1('0x5')+_0x102ced,_0x2f59d0);FaxQueueEvents['on'](_0x102ced,_0x4cab1d);}}; \ No newline at end of file +var _0x0d07=['removeListener','register','length','faxQueue:','save','remove','update','emit'];(function(_0x51a200,_0x1972d1){var _0x1a6e65=function(_0xf88cd7){while(--_0xf88cd7){_0x51a200['push'](_0x51a200['shift']());}};_0x1a6e65(++_0x1972d1);}(_0x0d07,0x9c));var _0x70d0=function(_0x21537e,_0x37de4e){_0x21537e=_0x21537e-0x0;var _0x6c9836=_0x0d07[_0x21537e];return _0x6c9836;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x70d0('0x0'),_0x70d0('0x1'),_0x70d0('0x2')];function createListener(_0x3b501c,_0x260e19){return function(_0x2139af){_0x260e19[_0x70d0('0x3')](_0x3b501c,_0x2139af);};}function removeListener(_0x55b063,_0x454687){return function(){FaxQueueEvents[_0x70d0('0x4')](_0x55b063,_0x454687);};}exports[_0x70d0('0x5')]=function(_0x13c906){for(var _0xc2bda6=0x0,_0x2aac60=events[_0x70d0('0x6')];_0xc2bda6<_0x2aac60;_0xc2bda6++){var _0x5ee16c=events[_0xc2bda6];var _0x33cc7b=createListener(_0x70d0('0x7')+_0x5ee16c,_0x13c906);FaxQueueEvents['on'](_0x5ee16c,_0x33cc7b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 0370ffd..ab6bd2b 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 _0x9a5a=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','removeTeams','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9a5a,0x194));var _0xa9a5=function(_0x38fa4b,_0x1b2bd3){_0x38fa4b=_0x38fa4b-0x0;var _0x596918=_0x9a5a[_0x38fa4b];return _0x596918;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0xa')](_0xa9a5('0x10'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x11')]);router[_0xa9a5('0xa')](_0xa9a5('0x12'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xa9a5('0x13'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x14')]);router[_0xa9a5('0x15')]('/',auth[_0xa9a5('0xd')](),controller['create']);router[_0xa9a5('0x15')](_0xa9a5('0x12'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x16')]);router[_0xa9a5('0x15')](_0xa9a5('0x13'),auth['isAuthenticated'](),controller[_0xa9a5('0x17')]);router[_0xa9a5('0x18')](_0xa9a5('0x19'),auth[_0xa9a5('0xd')](),controller['update']);router[_0xa9a5('0x1a')](_0xa9a5('0x19'),auth[_0xa9a5('0xd')](),controller['destroy']);router[_0xa9a5('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa9a5('0x1b')]);router[_0xa9a5('0x1a')]('/:id/users',auth[_0xa9a5('0xd')](),controller['removeAgents']);module[_0xa9a5('0x1c')]=router; \ No newline at end of file +var _0x77a9=['../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x13dbda,_0x584ee2){var _0x5e96d9=function(_0x57ce9c){while(--_0x57ce9c){_0x13dbda['push'](_0x13dbda['shift']());}};_0x5e96d9(++_0x584ee2);}(_0x77a9,0x19e));var _0x977a=function(_0x3e0674,_0x4db90b){_0x3e0674=_0x3e0674-0x0;var _0x2c204a=_0x77a9[_0x3e0674];return _0x2c204a;};'use strict';var multer=require(_0x977a('0x0'));var util=require('util');var path=require(_0x977a('0x1'));var timeout=require('connect-timeout');var express=require(_0x977a('0x2'));var router=express[_0x977a('0x3')]();var fs_extra=require(_0x977a('0x4'));var auth=require(_0x977a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x977a('0x6'));var controller=require(_0x977a('0x7'));router[_0x977a('0x8')]('/',auth[_0x977a('0x9')](),controller[_0x977a('0xa')]);router['get']('/describe',auth[_0x977a('0x9')](),controller[_0x977a('0xb')]);router['get'](_0x977a('0xc'),auth[_0x977a('0x9')](),controller[_0x977a('0xd')]);router[_0x977a('0x8')](_0x977a('0xe'),auth[_0x977a('0x9')](),controller[_0x977a('0xf')]);router[_0x977a('0x8')](_0x977a('0x10'),auth[_0x977a('0x9')](),controller['getTeams']);router[_0x977a('0x8')](_0x977a('0x11'),auth[_0x977a('0x9')](),controller[_0x977a('0x12')]);router[_0x977a('0x13')]('/',auth[_0x977a('0x9')](),controller[_0x977a('0x14')]);router[_0x977a('0x13')](_0x977a('0x10'),auth[_0x977a('0x9')](),controller['addTeams']);router[_0x977a('0x13')]('/:id/users',auth[_0x977a('0x9')](),controller[_0x977a('0x15')]);router['put'](_0x977a('0xc'),auth[_0x977a('0x9')](),controller[_0x977a('0x16')]);router[_0x977a('0x17')]('/:id',auth[_0x977a('0x9')](),controller[_0x977a('0x18')]);router[_0x977a('0x17')]('/:id/teams',auth[_0x977a('0x9')](),controller[_0x977a('0x19')]);router['delete'](_0x977a('0x11'),auth['isAuthenticated'](),controller[_0x977a('0x1a')]);module[_0x977a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5d21cad..dff2dc3 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 _0x10a9=['DATE','moment','sequelize','exports','STRING'];(function(_0x2704be,_0x2555d4){var _0x21d7b5=function(_0x5f2a1b){while(--_0x5f2a1b){_0x2704be['push'](_0x2704be['shift']());}};_0x21d7b5(++_0x2555d4);}(_0x10a9,0x6f));var _0x910a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x10a9[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x910a('0x0'));var Sequelize=require(_0x910a('0x1'));module[_0x910a('0x2')]={'uniqueid':{'type':Sequelize[_0x910a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x910a('0x3')]},'joinAt':{'type':Sequelize[_0x910a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x910a('0x4')]},'exitAt':{'type':Sequelize[_0x910a('0x4')]},'reason':{'type':Sequelize[_0x910a('0x3')]}}; \ No newline at end of file +var _0x80d1=['exports','STRING','DATE','moment','sequelize'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x80d1,0xb7));var _0x180d=function(_0x1e3537,_0x40e9ff){_0x1e3537=_0x1e3537-0x0;var _0x5386d6=_0x80d1[_0x1e3537];return _0x5386d6;};'use strict';var moment=require(_0x180d('0x0'));var Sequelize=require(_0x180d('0x1'));module[_0x180d('0x2')]={'uniqueid':{'type':Sequelize[_0x180d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x180d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x180d('0x4')]},'acceptAt':{'type':Sequelize[_0x180d('0x4')]},'exitAt':{'type':Sequelize[_0x180d('0x4')]},'reason':{'type':Sequelize[_0x180d('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f817dad..b73713d 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 _0xb43b=['apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set'];(function(_0x46b31f,_0x42f4c4){var _0x4774f6=function(_0x3daf0c){while(--_0x3daf0c){_0x46b31f['push'](_0x46b31f['shift']());}};_0x4774f6(++_0x42f4c4);}(_0xb43b,0xbf));var _0xbb43=function(_0x2cad3d,_0xf6aecf){_0x2cad3d=_0x2cad3d-0x0;var _0x161fef=_0xb43b[_0x2cad3d];return _0x161fef;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x1'));var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require(_0xbb43('0x9'));var csv=require(_0xbb43('0xa'));var ejs=require(_0xbb43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xa'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=typeof _0x199726[_0xbb43('0x1a')]===_0xbb43('0x1b')&&typeof _0x199726[_0xbb43('0x1c')]===_0xbb43('0x1b');var _0x209c9c=_0x32425c[_0xbb43('0x1d')];var _0x4c223b=_0x15182b?0x0:_0x199726[_0xbb43('0x1a')];var _0x4cb0b2=_0x15182b?_0x32425c[_0xbb43('0x1d')]:_0x199726['offset']+_0x199726[_0xbb43('0x1c')];var _0x5f4b4f;if(_0x4cb0b2>=_0x209c9c){_0x4cb0b2=_0x209c9c;_0x5f4b4f=0xc8;}else{_0x5f4b4f=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x5f4b4f);return _0x4ac25c[_0xbb43('0x1e')]('Content-Range',_0x4c223b+'-'+_0x4cb0b2+'/'+_0x209c9c)[_0xbb43('0x19')](_0x32425c);}return null;};}function patchUpdates(_0x6cdc26){return function(_0x398ce5){try{jsonpatch[_0xbb43('0x1f')](_0x398ce5,_0x6cdc26,!![]);}catch(_0x22c5d1){return BPromise[_0xbb43('0x20')](_0x22c5d1);}return _0x398ce5[_0xbb43('0x21')]();};}function saveUpdates(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')](_0x1e83cd)[_0xbb43('0x23')](function(_0x36992f){return _0x36992f;});}return null;};}function removeEntity(_0x37beb0,_0x500af4){return function(_0x28b3e4){if(_0x28b3e4){return _0x28b3e4[_0xbb43('0x24')]()['then'](function(){_0x37beb0[_0xbb43('0x17')](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0x25279b,_0x5e526d){return function(_0x4ea4c5){if(!_0x4ea4c5){_0x25279b[_0xbb43('0x25')](0x194);}return _0x4ea4c5;};}function handleError(_0x16da8a,_0x5b21b6){_0x5b21b6=_0x5b21b6||0x1f4;return function(_0x48ef60){logger[_0xbb43('0x26')](_0x48ef60[_0xbb43('0x27')]);if(_0x48ef60[_0xbb43('0x28')]){delete _0x48ef60[_0xbb43('0x28')];}_0x16da8a[_0xbb43('0x17')](_0x5b21b6)[_0xbb43('0x29')](_0x48ef60);};}exports[_0xbb43('0x2a')]=function(_0x1a6e2b,_0x5d613c){var _0x2a4766={},_0x170e7a={},_0x821beb={'count':0x0,'rows':[]};var _0x293d66=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')],function(_0x48986d){return{'name':_0x48986d[_0xbb43('0x2e')],'type':_0x48986d[_0xbb43('0x2f')][_0xbb43('0x30')]};});_0x170e7a['model']=_[_0xbb43('0x2b')](_0x293d66,_0xbb43('0x28'));_0x170e7a[_0xbb43('0x31')]=_[_0xbb43('0x32')](_0x1a6e2b[_0xbb43('0x31')]);_0x170e7a[_0xbb43('0x33')]=_[_0xbb43('0x34')](_0x170e7a[_0xbb43('0x35')],_0x170e7a[_0xbb43('0x31')]);_0x2a4766['attributes']=_['intersection'](_0x170e7a['model'],qs['fields'](_0x1a6e2b[_0xbb43('0x31')][_0xbb43('0x36')]));_0x2a4766[_0xbb43('0x37')]=_0x2a4766[_0xbb43('0x37')][_0xbb43('0x38')]?_0x2a4766[_0xbb43('0x37')]:_0x170e7a[_0xbb43('0x35')];if(!_0x1a6e2b[_0xbb43('0x31')]['hasOwnProperty'](_0xbb43('0x39'))){_0x2a4766[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x1a6e2b[_0xbb43('0x31')]['limit']);_0x2a4766[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x1a6e2b[_0xbb43('0x31')][_0xbb43('0x1a')]);}_0x2a4766['order']=qs[_0xbb43('0x3a')](_0x1a6e2b['query'][_0xbb43('0x3a')]);_0x2a4766[_0xbb43('0x3b')]=qs[_0xbb43('0x33')](_[_0xbb43('0x3c')](_0x1a6e2b[_0xbb43('0x31')],_0x170e7a[_0xbb43('0x33')]),_0x293d66);if(_0x1a6e2b[_0xbb43('0x31')][_0xbb43('0x3d')]){_0x2a4766[_0xbb43('0x3b')]=_[_0xbb43('0x3e')](_0x2a4766[_0xbb43('0x3b')],{'$or':_[_0xbb43('0x2b')](_0x293d66,function(_0x4f1d19){if(_0x4f1d19[_0xbb43('0x2f')]!==_0xbb43('0x3f')){var _0x363e1a={};_0x363e1a[_0x4f1d19[_0xbb43('0x28')]]={'$like':'%'+_0x1a6e2b[_0xbb43('0x31')][_0xbb43('0x3d')]+'%'};return _0x363e1a;}})});}_0x2a4766=_[_0xbb43('0x3e')]({},_0x2a4766,_0x1a6e2b[_0xbb43('0x40')]);var _0x92d7cf={'where':_0x2a4766[_0xbb43('0x3b')]};return db[_0xbb43('0x2c')][_0xbb43('0x1d')](_0x92d7cf)[_0xbb43('0x23')](function(_0x3a3371){_0x821beb[_0xbb43('0x1d')]=_0x3a3371;if(_0x1a6e2b['query'][_0xbb43('0x41')]){_0x2a4766[_0xbb43('0x42')]=[{'all':!![]}];}return db[_0xbb43('0x2c')][_0xbb43('0x43')](_0x2a4766);})[_0xbb43('0x23')](function(_0x4b32c9){_0x821beb['rows']=_0x4b32c9;return _0x821beb;})[_0xbb43('0x23')](respondWithFilteredResult(_0x5d613c,_0x2a4766))[_0xbb43('0x44')](handleError(_0x5d613c,null));};exports['show']=function(_0x54c3d6,_0x444275){var _0x1eb63f={'raw':!![],'where':{'id':_0x54c3d6[_0xbb43('0x45')]['id']}},_0x26aa10={};_0x26aa10[_0xbb43('0x35')]=_['keys'](db['FaxQueueReport'][_0xbb43('0x2d')]);_0x26aa10[_0xbb43('0x31')]=_[_0xbb43('0x32')](_0x54c3d6[_0xbb43('0x31')]);_0x26aa10[_0xbb43('0x33')]=_[_0xbb43('0x34')](_0x26aa10[_0xbb43('0x35')],_0x26aa10[_0xbb43('0x31')]);_0x1eb63f[_0xbb43('0x37')]=_[_0xbb43('0x34')](_0x26aa10['model'],qs['fields'](_0x54c3d6[_0xbb43('0x31')][_0xbb43('0x36')]));_0x1eb63f['attributes']=_0x1eb63f[_0xbb43('0x37')][_0xbb43('0x38')]?_0x1eb63f[_0xbb43('0x37')]:_0x26aa10[_0xbb43('0x35')];if(_0x54c3d6[_0xbb43('0x31')][_0xbb43('0x41')]){_0x1eb63f[_0xbb43('0x42')]=[{'all':!![]}];}_0x1eb63f=_['merge']({},_0x1eb63f,_0x54c3d6[_0xbb43('0x40')]);return db[_0xbb43('0x2c')]['find'](_0x1eb63f)[_0xbb43('0x23')](handleEntityNotFound(_0x444275,null))[_0xbb43('0x23')](respondWithResult(_0x444275,null))['catch'](handleError(_0x444275,null));};exports[_0xbb43('0x46')]=function(_0x3ef11f,_0xd1f32b){return db[_0xbb43('0x2c')][_0xbb43('0x46')](_0x3ef11f[_0xbb43('0x47')],{})[_0xbb43('0x23')](respondWithResult(_0xd1f32b,0xc9))[_0xbb43('0x44')](handleError(_0xd1f32b,null));};exports[_0xbb43('0x22')]=function(_0x2f044f,_0x38cc4d){if(_0x2f044f[_0xbb43('0x47')]['id']){delete _0x2f044f['body']['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x2f044f[_0xbb43('0x45')]['id']}})[_0xbb43('0x23')](handleEntityNotFound(_0x38cc4d,null))['then'](saveUpdates(_0x2f044f[_0xbb43('0x47')],null))['then'](respondWithResult(_0x38cc4d,null))[_0xbb43('0x44')](handleError(_0x38cc4d,null));};exports['destroy']=function(_0x21f78b,_0x322a77){return db[_0xbb43('0x2c')]['find']({'where':{'id':_0x21f78b[_0xbb43('0x45')]['id']}})[_0xbb43('0x23')](handleEntityNotFound(_0x322a77,null))[_0xbb43('0x23')](removeEntity(_0x322a77,null))['catch'](handleError(_0x322a77,null));};exports[_0xbb43('0x49')]=function(_0x3b53b9,_0x4c3830){return db[_0xbb43('0x2c')]['describe']()[_0xbb43('0x23')](respondWithResult(_0x4c3830,null))[_0xbb43('0x44')](handleError(_0x4c3830,null));}; \ No newline at end of file +var _0x3fb7=['where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','catch','params','keys','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','then','destroy','error','stack','name','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1725e0,_0x778515){var _0x16984d=function(_0x5edeff){while(--_0x5edeff){_0x1725e0['push'](_0x1725e0['shift']());}};_0x16984d(++_0x778515);}(_0x3fb7,0x189));var _0x73fb=function(_0x3120dc,_0x25b67d){_0x3120dc=_0x3120dc-0x0;var _0x40b337=_0x3fb7[_0x3120dc];return _0x40b337;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x73fb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73fb('0x1'));var rp=require(_0x73fb('0x2'));var moment=require('moment');var BPromise=require(_0x73fb('0x3'));var Mustache=require('mustache');var util=require(_0x73fb('0x4'));var path=require(_0x73fb('0x5'));var sox=require(_0x73fb('0x6'));var csv=require(_0x73fb('0x7'));var ejs=require(_0x73fb('0x8'));var fs=require('fs');var fs_extra=require(_0x73fb('0x9'));var _=require(_0x73fb('0xa'));var squel=require(_0x73fb('0xb'));var crypto=require(_0x73fb('0xc'));var jsforce=require(_0x73fb('0xd'));var deskjs=require(_0x73fb('0xe'));var toCsv=require(_0x73fb('0x7'));var querystring=require(_0x73fb('0xf'));var Papa=require(_0x73fb('0x10'));var Redis=require(_0x73fb('0x11'));var authService=require(_0x73fb('0x12'));var qs=require(_0x73fb('0x13'));var as=require(_0x73fb('0x14'));var hardwareService=require(_0x73fb('0x15'));var logger=require(_0x73fb('0x16'))(_0x73fb('0x17'));var utils=require(_0x73fb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x73fb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fc7ac,_0x1f7626){_0x1f7626=_0x1f7626||0xcc;return function(_0x45c502){if(_0x45c502){return _0x3fc7ac[_0x73fb('0x1a')](_0x1f7626);}return _0x3fc7ac[_0x73fb('0x1b')](_0x1f7626)[_0x73fb('0x1c')]();};}function respondWithResult(_0x394ac5,_0x10d931){_0x10d931=_0x10d931||0xc8;return function(_0x743f1a){if(_0x743f1a){return _0x394ac5[_0x73fb('0x1b')](_0x10d931)[_0x73fb('0x1d')](_0x743f1a);}};}function respondWithFilteredResult(_0xa0b4dd,_0x2161ac){return function(_0x4986c3){if(_0x4986c3){var _0x1f679b=typeof _0x2161ac['offset']==='undefined'&&typeof _0x2161ac[_0x73fb('0x1e')]===_0x73fb('0x1f');var _0x4f4dda=_0x4986c3[_0x73fb('0x20')];var _0x1c9fa3=_0x1f679b?0x0:_0x2161ac[_0x73fb('0x21')];var _0x3ea9dd=_0x1f679b?_0x4986c3['count']:_0x2161ac['offset']+_0x2161ac[_0x73fb('0x1e')];var _0x460ae9;if(_0x3ea9dd>=_0x4f4dda){_0x3ea9dd=_0x4f4dda;_0x460ae9=0xc8;}else{_0x460ae9=0xce;}_0xa0b4dd[_0x73fb('0x1b')](_0x460ae9);return _0xa0b4dd['set'](_0x73fb('0x22'),_0x1c9fa3+'-'+_0x3ea9dd+'/'+_0x4f4dda)[_0x73fb('0x1d')](_0x4986c3);}return null;};}function patchUpdates(_0x25b409){return function(_0x41b334){try{jsonpatch[_0x73fb('0x23')](_0x41b334,_0x25b409,!![]);}catch(_0x204abf){return BPromise['reject'](_0x204abf);}return _0x41b334[_0x73fb('0x24')]();};}function saveUpdates(_0x474aaa,_0x2ff0f3){return function(_0x4d9d9c){if(_0x4d9d9c){return _0x4d9d9c['update'](_0x474aaa)[_0x73fb('0x25')](function(_0x2ae708){return _0x2ae708;});}return null;};}function removeEntity(_0x5486ff,_0x26b839){return function(_0x12c139){if(_0x12c139){return _0x12c139[_0x73fb('0x26')]()[_0x73fb('0x25')](function(){_0x5486ff[_0x73fb('0x1b')](0xcc)[_0x73fb('0x1c')]();});}};}function handleEntityNotFound(_0x801c4d,_0x222b87){return function(_0x3d213f){if(!_0x3d213f){_0x801c4d['sendStatus'](0x194);}return _0x3d213f;};}function handleError(_0x4a9ba2,_0x405e36){_0x405e36=_0x405e36||0x1f4;return function(_0x30b88){logger[_0x73fb('0x27')](_0x30b88[_0x73fb('0x28')]);if(_0x30b88[_0x73fb('0x29')]){delete _0x30b88[_0x73fb('0x29')];}_0x4a9ba2[_0x73fb('0x1b')](_0x405e36)['send'](_0x30b88);};}exports[_0x73fb('0x2a')]=function(_0x281449,_0x1bba66){var _0x46034e={},_0x23d6c0={},_0xc3894e={'count':0x0,'rows':[]};var _0x1f8f34=_[_0x73fb('0x2b')](db['FaxQueueReport'][_0x73fb('0x2c')],function(_0x8dec15){return{'name':_0x8dec15['fieldName'],'type':_0x8dec15['type'][_0x73fb('0x2d')]};});_0x23d6c0[_0x73fb('0x2e')]=_[_0x73fb('0x2b')](_0x1f8f34,_0x73fb('0x29'));_0x23d6c0[_0x73fb('0x2f')]=_['keys'](_0x281449[_0x73fb('0x2f')]);_0x23d6c0[_0x73fb('0x30')]=_[_0x73fb('0x31')](_0x23d6c0[_0x73fb('0x2e')],_0x23d6c0[_0x73fb('0x2f')]);_0x46034e[_0x73fb('0x32')]=_[_0x73fb('0x31')](_0x23d6c0[_0x73fb('0x2e')],qs[_0x73fb('0x33')](_0x281449[_0x73fb('0x2f')]['fields']));_0x46034e[_0x73fb('0x32')]=_0x46034e[_0x73fb('0x32')][_0x73fb('0x34')]?_0x46034e[_0x73fb('0x32')]:_0x23d6c0[_0x73fb('0x2e')];if(!_0x281449['query'][_0x73fb('0x35')](_0x73fb('0x36'))){_0x46034e['limit']=qs[_0x73fb('0x1e')](_0x281449['query'][_0x73fb('0x1e')]);_0x46034e['offset']=qs['offset'](_0x281449[_0x73fb('0x2f')][_0x73fb('0x21')]);}_0x46034e[_0x73fb('0x37')]=qs['sort'](_0x281449[_0x73fb('0x2f')][_0x73fb('0x38')]);_0x46034e[_0x73fb('0x39')]=qs[_0x73fb('0x30')](_[_0x73fb('0x3a')](_0x281449[_0x73fb('0x2f')],_0x23d6c0['filters']),_0x1f8f34);if(_0x281449['query'][_0x73fb('0x3b')]){_0x46034e[_0x73fb('0x39')]=_[_0x73fb('0x3c')](_0x46034e[_0x73fb('0x39')],{'$or':_[_0x73fb('0x2b')](_0x1f8f34,function(_0xe38a72){if(_0xe38a72['type']!==_0x73fb('0x3d')){var _0x4ec4e7={};_0x4ec4e7[_0xe38a72[_0x73fb('0x29')]]={'$like':'%'+_0x281449[_0x73fb('0x2f')][_0x73fb('0x3b')]+'%'};return _0x4ec4e7;}})});}_0x46034e=_['merge']({},_0x46034e,_0x281449[_0x73fb('0x3e')]);var _0x2a8709={'where':_0x46034e['where']};return db[_0x73fb('0x3f')][_0x73fb('0x20')](_0x2a8709)[_0x73fb('0x25')](function(_0x417636){_0xc3894e[_0x73fb('0x20')]=_0x417636;if(_0x281449[_0x73fb('0x2f')][_0x73fb('0x40')]){_0x46034e[_0x73fb('0x41')]=[{'all':!![]}];}return db[_0x73fb('0x3f')][_0x73fb('0x42')](_0x46034e);})[_0x73fb('0x25')](function(_0x43da49){_0xc3894e['rows']=_0x43da49;return _0xc3894e;})['then'](respondWithFilteredResult(_0x1bba66,_0x46034e))[_0x73fb('0x43')](handleError(_0x1bba66,null));};exports['show']=function(_0x10258f,_0x110c30){var _0x325902={'raw':!![],'where':{'id':_0x10258f[_0x73fb('0x44')]['id']}},_0x2854fb={};_0x2854fb[_0x73fb('0x2e')]=_[_0x73fb('0x45')](db[_0x73fb('0x3f')]['rawAttributes']);_0x2854fb[_0x73fb('0x2f')]=_['keys'](_0x10258f['query']);_0x2854fb['filters']=_[_0x73fb('0x31')](_0x2854fb['model'],_0x2854fb[_0x73fb('0x2f')]);_0x325902[_0x73fb('0x32')]=_[_0x73fb('0x31')](_0x2854fb['model'],qs[_0x73fb('0x33')](_0x10258f[_0x73fb('0x2f')][_0x73fb('0x33')]));_0x325902['attributes']=_0x325902[_0x73fb('0x32')][_0x73fb('0x34')]?_0x325902['attributes']:_0x2854fb[_0x73fb('0x2e')];if(_0x10258f[_0x73fb('0x2f')]['includeAll']){_0x325902[_0x73fb('0x41')]=[{'all':!![]}];}_0x325902=_[_0x73fb('0x3c')]({},_0x325902,_0x10258f[_0x73fb('0x3e')]);return db['FaxQueueReport'][_0x73fb('0x46')](_0x325902)['then'](handleEntityNotFound(_0x110c30,null))[_0x73fb('0x25')](respondWithResult(_0x110c30,null))[_0x73fb('0x43')](handleError(_0x110c30,null));};exports[_0x73fb('0x47')]=function(_0x522e2a,_0x3c0e2f){return db[_0x73fb('0x3f')][_0x73fb('0x47')](_0x522e2a[_0x73fb('0x48')],{})[_0x73fb('0x25')](respondWithResult(_0x3c0e2f,0xc9))[_0x73fb('0x43')](handleError(_0x3c0e2f,null));};exports[_0x73fb('0x49')]=function(_0xe9556c,_0x33487f){if(_0xe9556c['body']['id']){delete _0xe9556c['body']['id'];}return db[_0x73fb('0x3f')][_0x73fb('0x46')]({'where':{'id':_0xe9556c[_0x73fb('0x44')]['id']}})[_0x73fb('0x25')](handleEntityNotFound(_0x33487f,null))[_0x73fb('0x25')](saveUpdates(_0xe9556c['body'],null))[_0x73fb('0x25')](respondWithResult(_0x33487f,null))[_0x73fb('0x43')](handleError(_0x33487f,null));};exports[_0x73fb('0x26')]=function(_0x160222,_0x257a93){return db[_0x73fb('0x3f')][_0x73fb('0x46')]({'where':{'id':_0x160222[_0x73fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x257a93,null))[_0x73fb('0x25')](removeEntity(_0x257a93,null))['catch'](handleError(_0x257a93,null));};exports[_0x73fb('0x4a')]=function(_0x2bcbc9,_0x49824e){return db[_0x73fb('0x3f')]['describe']()[_0x73fb('0x25')](respondWithResult(_0x49824e,null))[_0x73fb('0x43')](handleError(_0x49824e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2aa384c..68cf4f7 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x33c166,_0x36329b){var _0x168b23=function(_0x28eba7){while(--_0x28eba7){_0x33c166['push'](_0x33c166['shift']());}};_0x168b23(++_0x36329b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x17bccc,_0x4cc003){_0x17bccc=_0x17bccc-0x0;var _0x16e5fe=_0x7fbe[_0x17bccc];return _0x16e5fe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x474009,_0x53229e){_0x474009=_0x474009-0x0;var _0x27a998=_0x1cb9[_0x474009];return _0x27a998;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 78c90b2..76b3692 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 _0x243b=['error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','raw','info','debug','UpdateFaxQueueReport','body','options','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','stringify'];(function(_0x187645,_0x197db4){var _0x5bf6b2=function(_0x5dfc12){while(--_0x5dfc12){_0x187645['push'](_0x187645['shift']());}};_0x5bf6b2(++_0x197db4);}(_0x243b,0x13c));var _0xb243=function(_0x146cb6,_0x4f7f06){_0x146cb6=_0x146cb6-0x0;var _0x4038ca=_0x243b[_0x146cb6];return _0x4038ca;};'use strict';var _=require(_0xb243('0x0'));var util=require(_0xb243('0x1'));var moment=require(_0xb243('0x2'));var BPromise=require(_0xb243('0x3'));var rs=require(_0xb243('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb243('0x5'));var logger=require(_0xb243('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb243('0x7'));var client=jayson[_0xb243('0x8')][_0xb243('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5df71c,_0x9fa8f5,_0x1679e3){return new BPromise(function(_0x5c086f,_0x358799){return client[_0xb243('0xa')](_0x5df71c,_0x1679e3)[_0xb243('0xb')](function(_0x50d7d7){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x9fa8f5,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x9fa8f5,_0xb243('0xc'),JSON[_0xb243('0xd')](_0x50d7d7));if(_0x50d7d7[_0xb243('0xe')]){if(_0x50d7d7['error'][_0xb243('0xf')]===0x1f4){logger['error'](_0xb243('0x10'),_0x9fa8f5,_0x50d7d7[_0xb243('0xe')]['message']);return _0x358799(_0x50d7d7[_0xb243('0xe')][_0xb243('0x11')]);}logger[_0xb243('0xe')](_0xb243('0x10'),_0x9fa8f5,_0x50d7d7[_0xb243('0xe')][_0xb243('0x11')]);return _0x5c086f(_0x50d7d7[_0xb243('0xe')][_0xb243('0x11')]);}else{logger['info'](_0xb243('0x10'),_0x9fa8f5,_0xb243('0xc'));_0x5c086f(_0x50d7d7[_0xb243('0x12')]['message']);}})[_0xb243('0x13')](function(_0xd5849f){logger[_0xb243('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x9fa8f5,_0xd5849f);_0x358799(_0xd5849f);});});}exports[_0xb243('0x14')]=function(_0x1111ce){var _0x5049be=this;return new Promise(function(_0x3ff1c9,_0x47e52e){return db[_0xb243('0x15')][_0xb243('0x16')](_0x1111ce['body'],{'raw':_0x1111ce['options']?_0x1111ce['options'][_0xb243('0x17')]===undefined?!![]:![]:!![]})[_0xb243('0xb')](function(_0x1d8358){logger[_0xb243('0x18')](_0xb243('0x14'),_0x1111ce);logger[_0xb243('0x19')](_0xb243('0x14'),_0x1111ce,JSON[_0xb243('0xd')](_0x1d8358));_0x3ff1c9(_0x1d8358);})[_0xb243('0x13')](function(_0x52189e){logger['error'](_0xb243('0x14'),_0x52189e[_0xb243('0x11')],_0x1111ce);_0x47e52e(_0x5049be[_0xb243('0xe')](0x1f4,_0x52189e['message']));});});};exports[_0xb243('0x1a')]=function(_0x46ae32){var _0x2f82dc=this;return new Promise(function(_0x206c45,_0x342aab){return db[_0xb243('0x15')]['update'](_0x46ae32[_0xb243('0x1b')],{'raw':_0x46ae32[_0xb243('0x1c')]?_0x46ae32[_0xb243('0x1c')][_0xb243('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46ae32[_0xb243('0x1c')]?_0x46ae32['options']['where']||null:null,'attributes':_0x46ae32[_0xb243('0x1c')]?_0x46ae32[_0xb243('0x1c')][_0xb243('0x1d')]||null:null,'limit':_0x46ae32['options']?_0x46ae32[_0xb243('0x1c')]['limit']||null:null})[_0xb243('0xb')](function(_0x446904){logger['info'](_0xb243('0x1a'),_0x46ae32);logger[_0xb243('0x19')](_0xb243('0x1a'),_0x46ae32,JSON['stringify'](_0x446904));_0x206c45(_0x446904);})[_0xb243('0x13')](function(_0x5c81a9){logger[_0xb243('0xe')](_0xb243('0x1a'),_0x5c81a9[_0xb243('0x11')],_0x46ae32);_0x342aab(_0x2f82dc['error'](0x1f4,_0x5c81a9[_0xb243('0x11')]));});});}; \ No newline at end of file +var _0xa75d=['where','attributes','limit','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','update'];(function(_0x3dd2ea,_0x305d97){var _0x37395c=function(_0x724d5d){while(--_0x724d5d){_0x3dd2ea['push'](_0x3dd2ea['shift']());}};_0x37395c(++_0x305d97);}(_0xa75d,0x184));var _0xda75=function(_0x238f2c,_0x46d772){_0x238f2c=_0x238f2c-0x0;var _0x3d0b63=_0xa75d[_0x238f2c];return _0x3d0b63;};'use strict';var _=require(_0xda75('0x0'));var util=require('util');var moment=require(_0xda75('0x1'));var BPromise=require(_0xda75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda75('0x3'))['db'];var utils=require(_0xda75('0x4'));var logger=require('../../config/logger')(_0xda75('0x5'));var config=require(_0xda75('0x6'));var jayson=require(_0xda75('0x7'));var client=jayson[_0xda75('0x8')][_0xda75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcdb097,_0x4701b2,_0x193bb3){return new BPromise(function(_0x287675,_0x3d6d40){return client[_0xda75('0xa')](_0xcdb097,_0x193bb3)[_0xda75('0xb')](function(_0x3b652c){logger[_0xda75('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x4701b2,'request\x20sent');logger['debug'](_0xda75('0xd'),_0x4701b2,_0xda75('0xe'),JSON['stringify'](_0x3b652c));if(_0x3b652c['error']){if(_0x3b652c['error']['code']===0x1f4){logger['error'](_0xda75('0xf'),_0x4701b2,_0x3b652c[_0xda75('0x10')]['message']);return _0x3d6d40(_0x3b652c[_0xda75('0x10')]['message']);}logger['error'](_0xda75('0xf'),_0x4701b2,_0x3b652c[_0xda75('0x10')][_0xda75('0x11')]);return _0x287675(_0x3b652c[_0xda75('0x10')][_0xda75('0x11')]);}else{logger['info'](_0xda75('0xf'),_0x4701b2,_0xda75('0xe'));_0x287675(_0x3b652c['result'][_0xda75('0x11')]);}})[_0xda75('0x12')](function(_0x2ede78){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x4701b2,_0x2ede78);_0x3d6d40(_0x2ede78);});});}exports[_0xda75('0x13')]=function(_0x433417){var _0x2a63f7=this;return new Promise(function(_0x423511,_0x51306e){return db[_0xda75('0x14')][_0xda75('0x15')](_0x433417[_0xda75('0x16')],{'raw':_0x433417['options']?_0x433417[_0xda75('0x17')][_0xda75('0x18')]===undefined?!![]:![]:!![]})[_0xda75('0xb')](function(_0x1783b5){logger[_0xda75('0xc')](_0xda75('0x13'),_0x433417);logger[_0xda75('0x19')](_0xda75('0x13'),_0x433417,JSON['stringify'](_0x1783b5));_0x423511(_0x1783b5);})[_0xda75('0x12')](function(_0x22f179){logger[_0xda75('0x10')](_0xda75('0x13'),_0x22f179[_0xda75('0x11')],_0x433417);_0x51306e(_0x2a63f7['error'](0x1f4,_0x22f179['message']));});});};exports[_0xda75('0x1a')]=function(_0x3e4510){var _0x34dcdb=this;return new Promise(function(_0x4c44eb,_0x515ade){return db[_0xda75('0x14')][_0xda75('0x1b')](_0x3e4510[_0xda75('0x16')],{'raw':_0x3e4510[_0xda75('0x17')]?_0x3e4510['options'][_0xda75('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e4510[_0xda75('0x17')]?_0x3e4510[_0xda75('0x17')][_0xda75('0x1c')]||null:null,'attributes':_0x3e4510[_0xda75('0x17')]?_0x3e4510[_0xda75('0x17')][_0xda75('0x1d')]||null:null,'limit':_0x3e4510['options']?_0x3e4510[_0xda75('0x17')][_0xda75('0x1e')]||null:null})[_0xda75('0xb')](function(_0x2cd78f){logger[_0xda75('0xc')](_0xda75('0x1a'),_0x3e4510);logger[_0xda75('0x19')](_0xda75('0x1a'),_0x3e4510,JSON[_0xda75('0x1f')](_0x2cd78f));_0x4c44eb(_0x2cd78f);})[_0xda75('0x12')](function(_0x462acb){logger[_0xda75('0x10')](_0xda75('0x1a'),_0x462acb[_0xda75('0x11')],_0x3e4510);_0x515ade(_0x34dcdb[_0xda75('0x10')](0x1f4,_0x462acb[_0xda75('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5a1651a..5a4bb04 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 _0x15cd=['../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x15cd,0x1dd));var _0xd15c=function(_0x2ced4f,_0x3e2bec){_0x2ced4f=_0x2ced4f-0x0;var _0x4cf01a=_0x15cd[_0x2ced4f];return _0x4cf01a;};'use strict';var multer=require(_0xd15c('0x0'));var util=require(_0xd15c('0x1'));var path=require(_0xd15c('0x2'));var timeout=require(_0xd15c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd15c('0x4'));var auth=require(_0xd15c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd15c('0x6'));var controller=require(_0xd15c('0x7'));router[_0xd15c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd15c('0x9')]);router[_0xd15c('0x8')](_0xd15c('0xa'),auth[_0xd15c('0xb')](),controller[_0xd15c('0xc')]);router['get'](_0xd15c('0xd'),auth[_0xd15c('0xb')](),controller[_0xd15c('0xe')]);router[_0xd15c('0xf')]('/',auth['isAuthenticated'](),controller[_0xd15c('0x10')]);router[_0xd15c('0x11')](_0xd15c('0xd'),auth[_0xd15c('0xb')](),controller['update']);router[_0xd15c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd15c('0x13')]);module[_0xd15c('0x14')]=router; \ No newline at end of file +var _0xdcc9=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x2cd1e4,_0x23d906){var _0x167374=function(_0x496435){while(--_0x496435){_0x2cd1e4['push'](_0x2cd1e4['shift']());}};_0x167374(++_0x23d906);}(_0xdcc9,0x1e5));var _0x9dcc=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xdcc9[_0x3e8270];return _0x1ccde9;};'use strict';var multer=require(_0x9dcc('0x0'));var util=require(_0x9dcc('0x1'));var path=require(_0x9dcc('0x2'));var timeout=require(_0x9dcc('0x3'));var express=require(_0x9dcc('0x4'));var router=express['Router']();var fs_extra=require(_0x9dcc('0x5'));var auth=require(_0x9dcc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9dcc('0x7'));var controller=require('./faxQueueReport.controller');router[_0x9dcc('0x8')]('/',auth[_0x9dcc('0x9')](),controller[_0x9dcc('0xa')]);router[_0x9dcc('0x8')](_0x9dcc('0xb'),auth[_0x9dcc('0x9')](),controller[_0x9dcc('0xc')]);router[_0x9dcc('0x8')](_0x9dcc('0xd'),auth[_0x9dcc('0x9')](),controller[_0x9dcc('0xe')]);router[_0x9dcc('0xf')]('/',auth['isAuthenticated'](),controller[_0x9dcc('0x10')]);router['put'](_0x9dcc('0xd'),auth[_0x9dcc('0x9')](),controller[_0x9dcc('0x11')]);router[_0x9dcc('0x12')]('/:id',auth[_0x9dcc('0x9')](),controller[_0x9dcc('0x13')]);module[_0x9dcc('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 36a54f6..49cf9d1 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1c94b9,_0x3f0e45){_0x1c94b9=_0x1c94b9-0x0;var _0x4f0629=_0xb43b[_0x1c94b9];return _0x4f0629;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x237d29,_0x439645){var _0x1e73ad=function(_0x441d06){while(--_0x441d06){_0x237d29['push'](_0x237d29['shift']());}};_0x1e73ad(++_0x439645);}(_0x34e8,0x12c));var _0x834e=function(_0x5c79e6,_0x2d1a7e){_0x5c79e6=_0x5c79e6-0x0;var _0x2e4ea7=_0x34e8[_0x5c79e6];return _0x2e4ea7;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 71873ac..845d456 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 _0x3693=['stack','name','index','FaxTransferReport','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus'];(function(_0x2dd182,_0x3f30a5){var _0x2d1df4=function(_0x577d08){while(--_0x577d08){_0x2dd182['push'](_0x2dd182['shift']());}};_0x2d1df4(++_0x3f30a5);}(_0x3693,0x6d));var _0x3369=function(_0x384b3a,_0x290ab4){_0x384b3a=_0x384b3a-0x0;var _0x5b9193=_0x3693[_0x384b3a];return _0x5b9193;};'use strict';var emlformat=require(_0x3369('0x0'));var rimraf=require(_0x3369('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3369('0x2'));var rp=require(_0x3369('0x3'));var moment=require(_0x3369('0x4'));var BPromise=require(_0x3369('0x5'));var Mustache=require(_0x3369('0x6'));var util=require(_0x3369('0x7'));var path=require(_0x3369('0x8'));var sox=require(_0x3369('0x9'));var csv=require(_0x3369('0xa'));var ejs=require(_0x3369('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3369('0xc'));var squel=require('squel');var crypto=require(_0x3369('0xd'));var jsforce=require(_0x3369('0xe'));var deskjs=require(_0x3369('0xf'));var toCsv=require(_0x3369('0xa'));var querystring=require('querystring');var Papa=require(_0x3369('0x10'));var Redis=require(_0x3369('0x11'));var authService=require(_0x3369('0x12'));var qs=require(_0x3369('0x13'));var as=require(_0x3369('0x14'));var hardwareService=require(_0x3369('0x15'));var logger=require(_0x3369('0x16'))(_0x3369('0x17'));var utils=require(_0x3369('0x18'));var config=require(_0x3369('0x19'));var licenseUtil=require(_0x3369('0x1a'));var db=require(_0x3369('0x1b'))['db'];function respondWithStatusCode(_0x9ac33a,_0x4c87e5){_0x4c87e5=_0x4c87e5||0xcc;return function(_0x4c6e4e){if(_0x4c6e4e){return _0x9ac33a['sendStatus'](_0x4c87e5);}return _0x9ac33a[_0x3369('0x1c')](_0x4c87e5)[_0x3369('0x1d')]();};}function respondWithResult(_0x20c78e,_0x394df1){_0x394df1=_0x394df1||0xc8;return function(_0x6d8e1f){if(_0x6d8e1f){return _0x20c78e[_0x3369('0x1c')](_0x394df1)[_0x3369('0x1e')](_0x6d8e1f);}};}function respondWithFilteredResult(_0x3cc0a8,_0x140bb4){return function(_0x5cb80f){if(_0x5cb80f){var _0x59704d=typeof _0x140bb4['offset']==='undefined'&&typeof _0x140bb4[_0x3369('0x1f')]==='undefined';var _0x3e88dc=_0x5cb80f[_0x3369('0x20')];var _0x54104d=_0x59704d?0x0:_0x140bb4[_0x3369('0x21')];var _0x5303a3=_0x59704d?_0x5cb80f['count']:_0x140bb4['offset']+_0x140bb4[_0x3369('0x1f')];var _0x5830a9;if(_0x5303a3>=_0x3e88dc){_0x5303a3=_0x3e88dc;_0x5830a9=0xc8;}else{_0x5830a9=0xce;}_0x3cc0a8[_0x3369('0x1c')](_0x5830a9);return _0x3cc0a8['set'](_0x3369('0x22'),_0x54104d+'-'+_0x5303a3+'/'+_0x3e88dc)[_0x3369('0x1e')](_0x5cb80f);}return null;};}function patchUpdates(_0x917db2){return function(_0x525991){try{jsonpatch[_0x3369('0x23')](_0x525991,_0x917db2,!![]);}catch(_0x3b4722){return BPromise['reject'](_0x3b4722);}return _0x525991[_0x3369('0x24')]();};}function saveUpdates(_0x53058a,_0x47f544){return function(_0xc01270){if(_0xc01270){return _0xc01270[_0x3369('0x25')](_0x53058a)[_0x3369('0x26')](function(_0x1cc874){return _0x1cc874;});}return null;};}function removeEntity(_0x3d30e0,_0x92d189){return function(_0x1fd38d){if(_0x1fd38d){return _0x1fd38d[_0x3369('0x27')]()[_0x3369('0x26')](function(){_0x3d30e0[_0x3369('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7550,_0x3761b8){return function(_0x23a4dc){if(!_0x23a4dc){_0x1c7550[_0x3369('0x28')](0x194);}return _0x23a4dc;};}function handleError(_0x154905,_0x5cff23){_0x5cff23=_0x5cff23||0x1f4;return function(_0x4e9663){logger['error'](_0x4e9663[_0x3369('0x29')]);if(_0x4e9663[_0x3369('0x2a')]){delete _0x4e9663['name'];}_0x154905['status'](_0x5cff23)['send'](_0x4e9663);};}exports[_0x3369('0x2b')]=function(_0x1f35cc,_0x3f0740){var _0x54c3e7={},_0x4f22bb={},_0x122da7={'count':0x0,'rows':[]};var _0x4d9213=_['map'](db[_0x3369('0x2c')]['rawAttributes'],function(_0x4d7b75){return{'name':_0x4d7b75['fieldName'],'type':_0x4d7b75[_0x3369('0x2d')][_0x3369('0x2e')]};});_0x4f22bb[_0x3369('0x2f')]=_[_0x3369('0x30')](_0x4d9213,_0x3369('0x2a'));_0x4f22bb['query']=_['keys'](_0x1f35cc[_0x3369('0x31')]);_0x4f22bb[_0x3369('0x32')]=_[_0x3369('0x33')](_0x4f22bb[_0x3369('0x2f')],_0x4f22bb[_0x3369('0x31')]);_0x54c3e7['attributes']=_[_0x3369('0x33')](_0x4f22bb[_0x3369('0x2f')],qs[_0x3369('0x34')](_0x1f35cc[_0x3369('0x31')][_0x3369('0x34')]));_0x54c3e7[_0x3369('0x35')]=_0x54c3e7['attributes'][_0x3369('0x36')]?_0x54c3e7[_0x3369('0x35')]:_0x4f22bb[_0x3369('0x2f')];if(!_0x1f35cc[_0x3369('0x31')][_0x3369('0x37')](_0x3369('0x38'))){_0x54c3e7[_0x3369('0x1f')]=qs[_0x3369('0x1f')](_0x1f35cc[_0x3369('0x31')][_0x3369('0x1f')]);_0x54c3e7['offset']=qs[_0x3369('0x21')](_0x1f35cc[_0x3369('0x31')][_0x3369('0x21')]);}_0x54c3e7['order']=qs[_0x3369('0x39')](_0x1f35cc[_0x3369('0x31')][_0x3369('0x39')]);_0x54c3e7[_0x3369('0x3a')]=qs[_0x3369('0x32')](_['pick'](_0x1f35cc['query'],_0x4f22bb[_0x3369('0x32')]),_0x4d9213);if(_0x1f35cc[_0x3369('0x31')]['filter']){_0x54c3e7[_0x3369('0x3a')]=_[_0x3369('0x3b')](_0x54c3e7[_0x3369('0x3a')],{'$or':_[_0x3369('0x30')](_0x4d9213,function(_0x29fc96){if(_0x29fc96[_0x3369('0x2d')]!==_0x3369('0x3c')){var _0x387809={};_0x387809[_0x29fc96[_0x3369('0x2a')]]={'$like':'%'+_0x1f35cc[_0x3369('0x31')][_0x3369('0x3d')]+'%'};return _0x387809;}})});}_0x54c3e7=_[_0x3369('0x3b')]({},_0x54c3e7,_0x1f35cc[_0x3369('0x3e')]);var _0xbde241={'where':_0x54c3e7[_0x3369('0x3a')]};return db[_0x3369('0x2c')][_0x3369('0x20')](_0xbde241)[_0x3369('0x26')](function(_0x12c0c1){_0x122da7['count']=_0x12c0c1;if(_0x1f35cc[_0x3369('0x31')][_0x3369('0x3f')]){_0x54c3e7['include']=[{'all':!![]}];}return db[_0x3369('0x2c')]['findAll'](_0x54c3e7);})[_0x3369('0x26')](function(_0x1d8a44){_0x122da7[_0x3369('0x40')]=_0x1d8a44;return _0x122da7;})[_0x3369('0x26')](respondWithFilteredResult(_0x3f0740,_0x54c3e7))[_0x3369('0x41')](handleError(_0x3f0740,null));};exports[_0x3369('0x42')]=function(_0x4e6d99,_0x21267f){var _0xc6a999={'raw':!![],'where':{'id':_0x4e6d99['params']['id']}},_0x145f86={};_0x145f86['model']=_[_0x3369('0x43')](db['FaxTransferReport'][_0x3369('0x44')]);_0x145f86[_0x3369('0x31')]=_[_0x3369('0x43')](_0x4e6d99['query']);_0x145f86[_0x3369('0x32')]=_[_0x3369('0x33')](_0x145f86[_0x3369('0x2f')],_0x145f86[_0x3369('0x31')]);_0xc6a999['attributes']=_[_0x3369('0x33')](_0x145f86[_0x3369('0x2f')],qs[_0x3369('0x34')](_0x4e6d99['query'][_0x3369('0x34')]));_0xc6a999[_0x3369('0x35')]=_0xc6a999[_0x3369('0x35')][_0x3369('0x36')]?_0xc6a999[_0x3369('0x35')]:_0x145f86[_0x3369('0x2f')];if(_0x4e6d99[_0x3369('0x31')][_0x3369('0x3f')]){_0xc6a999[_0x3369('0x45')]=[{'all':!![]}];}_0xc6a999=_[_0x3369('0x3b')]({},_0xc6a999,_0x4e6d99[_0x3369('0x3e')]);return db[_0x3369('0x2c')][_0x3369('0x46')](_0xc6a999)[_0x3369('0x26')](handleEntityNotFound(_0x21267f,null))[_0x3369('0x26')](respondWithResult(_0x21267f,null))[_0x3369('0x41')](handleError(_0x21267f,null));};exports['create']=function(_0x56cca0,_0x34c972){return db[_0x3369('0x2c')][_0x3369('0x47')](_0x56cca0['body'],{})[_0x3369('0x26')](respondWithResult(_0x34c972,0xc9))['catch'](handleError(_0x34c972,null));};exports[_0x3369('0x25')]=function(_0x28b9ae,_0x1e02a7){if(_0x28b9ae['body']['id']){delete _0x28b9ae[_0x3369('0x48')]['id'];}return db[_0x3369('0x2c')][_0x3369('0x46')]({'where':{'id':_0x28b9ae[_0x3369('0x49')]['id']}})[_0x3369('0x26')](handleEntityNotFound(_0x1e02a7,null))[_0x3369('0x26')](saveUpdates(_0x28b9ae['body'],null))[_0x3369('0x26')](respondWithResult(_0x1e02a7,null))[_0x3369('0x41')](handleError(_0x1e02a7,null));};exports[_0x3369('0x27')]=function(_0x38edc3,_0x4470f6){return db[_0x3369('0x2c')]['find']({'where':{'id':_0x38edc3['params']['id']}})[_0x3369('0x26')](handleEntityNotFound(_0x4470f6,null))[_0x3369('0x26')](removeEntity(_0x4470f6,null))[_0x3369('0x41')](handleError(_0x4470f6,null));};exports['describe']=function(_0x1aad34,_0x114c08){return db[_0x3369('0x2c')][_0x3369('0x4a')]()[_0x3369('0x26')](respondWithResult(_0x114c08,null))[_0x3369('0x41')](handleError(_0x114c08,null));}; \ No newline at end of file +var _0x3083=['catch','show','params','include','create','body','find','destroy','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','name','index','map','FaxTransferReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x5ecb57,_0x5d5c83){var _0x1dc4a0=function(_0x5682a0){while(--_0x5682a0){_0x5ecb57['push'](_0x5ecb57['shift']());}};_0x1dc4a0(++_0x5d5c83);}(_0x3083,0x1b9));var _0x3308=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x3083[_0x30c649];return _0x3edfb9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3308('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3308('0x1'));var rp=require(_0x3308('0x2'));var moment=require('moment');var BPromise=require(_0x3308('0x3'));var Mustache=require(_0x3308('0x4'));var util=require(_0x3308('0x5'));var path=require(_0x3308('0x6'));var sox=require(_0x3308('0x7'));var csv=require('to-csv');var ejs=require(_0x3308('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3308('0x9'));var squel=require('squel');var crypto=require(_0x3308('0xa'));var jsforce=require(_0x3308('0xb'));var deskjs=require(_0x3308('0xc'));var toCsv=require(_0x3308('0xd'));var querystring=require(_0x3308('0xe'));var Papa=require(_0x3308('0xf'));var Redis=require(_0x3308('0x10'));var authService=require(_0x3308('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3308('0x12'));var hardwareService=require(_0x3308('0x13'));var logger=require(_0x3308('0x14'))(_0x3308('0x15'));var utils=require(_0x3308('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b89c9,_0x2e7046){_0x2e7046=_0x2e7046||0xcc;return function(_0x23d0aa){if(_0x23d0aa){return _0x4b89c9[_0x3308('0x17')](_0x2e7046);}return _0x4b89c9[_0x3308('0x18')](_0x2e7046)[_0x3308('0x19')]();};}function respondWithResult(_0x50fbf8,_0x11c309){_0x11c309=_0x11c309||0xc8;return function(_0x505e9b){if(_0x505e9b){return _0x50fbf8[_0x3308('0x18')](_0x11c309)[_0x3308('0x1a')](_0x505e9b);}};}function respondWithFilteredResult(_0x4c683e,_0x5bb9e0){return function(_0x1eeeca){if(_0x1eeeca){var _0x1d337e=typeof _0x5bb9e0[_0x3308('0x1b')]===_0x3308('0x1c')&&typeof _0x5bb9e0[_0x3308('0x1d')]===_0x3308('0x1c');var _0x14469f=_0x1eeeca['count'];var _0x3bee94=_0x1d337e?0x0:_0x5bb9e0[_0x3308('0x1b')];var _0x3b5829=_0x1d337e?_0x1eeeca[_0x3308('0x1e')]:_0x5bb9e0['offset']+_0x5bb9e0[_0x3308('0x1d')];var _0x89de65;if(_0x3b5829>=_0x14469f){_0x3b5829=_0x14469f;_0x89de65=0xc8;}else{_0x89de65=0xce;}_0x4c683e[_0x3308('0x18')](_0x89de65);return _0x4c683e[_0x3308('0x1f')]('Content-Range',_0x3bee94+'-'+_0x3b5829+'/'+_0x14469f)[_0x3308('0x1a')](_0x1eeeca);}return null;};}function patchUpdates(_0xbde3ae){return function(_0x19a13f){try{jsonpatch[_0x3308('0x20')](_0x19a13f,_0xbde3ae,!![]);}catch(_0x194893){return BPromise['reject'](_0x194893);}return _0x19a13f['save']();};}function saveUpdates(_0x532caf,_0x4469eb){return function(_0x312c8e){if(_0x312c8e){return _0x312c8e[_0x3308('0x21')](_0x532caf)[_0x3308('0x22')](function(_0x17db64){return _0x17db64;});}return null;};}function removeEntity(_0x14e90c,_0x37a279){return function(_0x8cda90){if(_0x8cda90){return _0x8cda90['destroy']()['then'](function(){_0x14e90c[_0x3308('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271ab6,_0x362e2c){return function(_0x4c40a5){if(!_0x4c40a5){_0x271ab6[_0x3308('0x17')](0x194);}return _0x4c40a5;};}function handleError(_0x107013,_0x31930f){_0x31930f=_0x31930f||0x1f4;return function(_0x26af11){logger[_0x3308('0x23')](_0x26af11['stack']);if(_0x26af11[_0x3308('0x24')]){delete _0x26af11[_0x3308('0x24')];}_0x107013[_0x3308('0x18')](_0x31930f)['send'](_0x26af11);};}exports[_0x3308('0x25')]=function(_0x588b25,_0x150d8){var _0x3af822={},_0x3da998={},_0x1a344c={'count':0x0,'rows':[]};var _0x1890e9=_[_0x3308('0x26')](db[_0x3308('0x27')][_0x3308('0x28')],function(_0x13926b){return{'name':_0x13926b[_0x3308('0x29')],'type':_0x13926b['type'][_0x3308('0x2a')]};});_0x3da998['model']=_[_0x3308('0x26')](_0x1890e9,'name');_0x3da998['query']=_[_0x3308('0x2b')](_0x588b25[_0x3308('0x2c')]);_0x3da998[_0x3308('0x2d')]=_[_0x3308('0x2e')](_0x3da998[_0x3308('0x2f')],_0x3da998[_0x3308('0x2c')]);_0x3af822['attributes']=_['intersection'](_0x3da998[_0x3308('0x2f')],qs[_0x3308('0x30')](_0x588b25[_0x3308('0x2c')]['fields']));_0x3af822[_0x3308('0x31')]=_0x3af822[_0x3308('0x31')][_0x3308('0x32')]?_0x3af822[_0x3308('0x31')]:_0x3da998['model'];if(!_0x588b25[_0x3308('0x2c')]['hasOwnProperty'](_0x3308('0x33'))){_0x3af822[_0x3308('0x1d')]=qs[_0x3308('0x1d')](_0x588b25[_0x3308('0x2c')]['limit']);_0x3af822['offset']=qs[_0x3308('0x1b')](_0x588b25[_0x3308('0x2c')][_0x3308('0x1b')]);}_0x3af822[_0x3308('0x34')]=qs[_0x3308('0x35')](_0x588b25['query'][_0x3308('0x35')]);_0x3af822['where']=qs[_0x3308('0x2d')](_['pick'](_0x588b25[_0x3308('0x2c')],_0x3da998[_0x3308('0x2d')]),_0x1890e9);if(_0x588b25[_0x3308('0x2c')][_0x3308('0x36')]){_0x3af822[_0x3308('0x37')]=_[_0x3308('0x38')](_0x3af822[_0x3308('0x37')],{'$or':_[_0x3308('0x26')](_0x1890e9,function(_0x520095){if(_0x520095[_0x3308('0x39')]!==_0x3308('0x3a')){var _0x48ca17={};_0x48ca17[_0x520095[_0x3308('0x24')]]={'$like':'%'+_0x588b25[_0x3308('0x2c')][_0x3308('0x36')]+'%'};return _0x48ca17;}})});}_0x3af822=_[_0x3308('0x38')]({},_0x3af822,_0x588b25[_0x3308('0x3b')]);var _0x212dc8={'where':_0x3af822['where']};return db[_0x3308('0x27')]['count'](_0x212dc8)[_0x3308('0x22')](function(_0x3bc019){_0x1a344c[_0x3308('0x1e')]=_0x3bc019;if(_0x588b25[_0x3308('0x2c')][_0x3308('0x3c')]){_0x3af822['include']=[{'all':!![]}];}return db[_0x3308('0x27')][_0x3308('0x3d')](_0x3af822);})[_0x3308('0x22')](function(_0x2bebef){_0x1a344c[_0x3308('0x3e')]=_0x2bebef;return _0x1a344c;})[_0x3308('0x22')](respondWithFilteredResult(_0x150d8,_0x3af822))[_0x3308('0x3f')](handleError(_0x150d8,null));};exports[_0x3308('0x40')]=function(_0x53b6da,_0x26e802){var _0x211c3b={'raw':!![],'where':{'id':_0x53b6da[_0x3308('0x41')]['id']}},_0x27d32f={};_0x27d32f[_0x3308('0x2f')]=_[_0x3308('0x2b')](db[_0x3308('0x27')]['rawAttributes']);_0x27d32f[_0x3308('0x2c')]=_[_0x3308('0x2b')](_0x53b6da[_0x3308('0x2c')]);_0x27d32f[_0x3308('0x2d')]=_['intersection'](_0x27d32f[_0x3308('0x2f')],_0x27d32f['query']);_0x211c3b[_0x3308('0x31')]=_['intersection'](_0x27d32f[_0x3308('0x2f')],qs[_0x3308('0x30')](_0x53b6da[_0x3308('0x2c')][_0x3308('0x30')]));_0x211c3b[_0x3308('0x31')]=_0x211c3b[_0x3308('0x31')]['length']?_0x211c3b['attributes']:_0x27d32f[_0x3308('0x2f')];if(_0x53b6da[_0x3308('0x2c')][_0x3308('0x3c')]){_0x211c3b[_0x3308('0x42')]=[{'all':!![]}];}_0x211c3b=_[_0x3308('0x38')]({},_0x211c3b,_0x53b6da[_0x3308('0x3b')]);return db[_0x3308('0x27')]['find'](_0x211c3b)[_0x3308('0x22')](handleEntityNotFound(_0x26e802,null))[_0x3308('0x22')](respondWithResult(_0x26e802,null))['catch'](handleError(_0x26e802,null));};exports[_0x3308('0x43')]=function(_0x24d57b,_0x3ae77d){return db[_0x3308('0x27')][_0x3308('0x43')](_0x24d57b[_0x3308('0x44')],{})[_0x3308('0x22')](respondWithResult(_0x3ae77d,0xc9))[_0x3308('0x3f')](handleError(_0x3ae77d,null));};exports[_0x3308('0x21')]=function(_0x5c36c1,_0x5eb6e6){if(_0x5c36c1[_0x3308('0x44')]['id']){delete _0x5c36c1['body']['id'];}return db['FaxTransferReport'][_0x3308('0x45')]({'where':{'id':_0x5c36c1[_0x3308('0x41')]['id']}})[_0x3308('0x22')](handleEntityNotFound(_0x5eb6e6,null))[_0x3308('0x22')](saveUpdates(_0x5c36c1[_0x3308('0x44')],null))[_0x3308('0x22')](respondWithResult(_0x5eb6e6,null))[_0x3308('0x3f')](handleError(_0x5eb6e6,null));};exports[_0x3308('0x46')]=function(_0x11058d,_0x2ff1e4){return db[_0x3308('0x27')][_0x3308('0x45')]({'where':{'id':_0x11058d[_0x3308('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ff1e4,null))[_0x3308('0x22')](removeEntity(_0x2ff1e4,null))['catch'](handleError(_0x2ff1e4,null));};exports[_0x3308('0x47')]=function(_0x2c32df,_0xc530d0){return db[_0x3308('0x27')][_0x3308('0x47')]()['then'](respondWithResult(_0xc530d0,null))['catch'](handleError(_0xc530d0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 53cf8d0..fa5bde4 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 _0x8549=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8549,0xd3));var _0x9854=function(_0x283f0b,_0xc24c28){_0x283f0b=_0x283f0b-0x0;var _0xac64b6=_0x8549[_0x283f0b];return _0xac64b6;};'use strict';var _=require(_0x9854('0x0'));var util=require('util');var logger=require(_0x9854('0x1'))(_0x9854('0x2'));var moment=require(_0x9854('0x3'));var BPromise=require(_0x9854('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9854('0x5'));var config=require(_0x9854('0x6'));var attributes=require(_0x9854('0x7'));module[_0x9854('0x8')]=function(_0x547381,_0xdb6dc){return _0x547381[_0x9854('0x9')](_0x9854('0xa'),attributes,{'tableName':_0x9854('0xb'),'paranoid':![],'indexes':[{'name':_0x9854('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x33d0=['bluebird','request-promise','path','rimraf','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33d0,0x7f));var _0x033d=function(_0x3b76f0,_0x5043ac){_0x3b76f0=_0x3b76f0-0x0;var _0x1afd7f=_0x33d0[_0x3b76f0];return _0x1afd7f;};'use strict';var _=require(_0x033d('0x0'));var util=require(_0x033d('0x1'));var logger=require(_0x033d('0x2'))(_0x033d('0x3'));var moment=require(_0x033d('0x4'));var BPromise=require(_0x033d('0x5'));var rp=require(_0x033d('0x6'));var fs=require('fs');var path=require(_0x033d('0x7'));var rimraf=require(_0x033d('0x8'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x53006f,_0x429d66){return _0x53006f[_0x033d('0x9')](_0x033d('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x033d('0xb'),'fields':[_0x033d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1207d85..206f40e 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 _0xb90a=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb90a,0xaa));var _0xab90=function(_0x5c56c1,_0x3c1325){_0x5c56c1=_0x5c56c1-0x0;var _0x49a58e=_0xb90a[_0x5c56c1];return _0x49a58e;};'use strict';var _=require(_0xab90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab90('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab90('0x2'));var db=require(_0xab90('0x3'))['db'];var utils=require(_0xab90('0x4'));var logger=require(_0xab90('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab90('0x6'));var client=jayson[_0xab90('0x7')][_0xab90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a4f88,_0x1359c4,_0x25d4a1){return new BPromise(function(_0x361522,_0xdabb41){return client[_0xab90('0x9')](_0x1a4f88,_0x25d4a1)[_0xab90('0xa')](function(_0x18389b){logger[_0xab90('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x1359c4,_0xab90('0xc'));logger['debug'](_0xab90('0xd'),_0x1359c4,_0xab90('0xc'),JSON['stringify'](_0x18389b));if(_0x18389b[_0xab90('0xe')]){if(_0x18389b[_0xab90('0xe')][_0xab90('0xf')]===0x1f4){logger[_0xab90('0xe')](_0xab90('0x10'),_0x1359c4,_0x18389b[_0xab90('0xe')][_0xab90('0x11')]);return _0xdabb41(_0x18389b['error'][_0xab90('0x11')]);}logger[_0xab90('0xe')](_0xab90('0x10'),_0x1359c4,_0x18389b['error'][_0xab90('0x11')]);return _0x361522(_0x18389b[_0xab90('0xe')][_0xab90('0x11')]);}else{logger[_0xab90('0xb')](_0xab90('0x10'),_0x1359c4,_0xab90('0xc'));_0x361522(_0x18389b['result'][_0xab90('0x11')]);}})[_0xab90('0x12')](function(_0x10d713){logger['error'](_0xab90('0x10'),_0x1359c4,_0x10d713);_0xdabb41(_0x10d713);});});} \ No newline at end of file +var _0x83cf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45e2e8,_0x35a5dc){var _0x94a634=function(_0x1b4dda){while(--_0x1b4dda){_0x45e2e8['push'](_0x45e2e8['shift']());}};_0x94a634(++_0x35a5dc);}(_0x83cf,0x8e));var _0xf83c=function(_0x1e070d,_0x15d110){_0x1e070d=_0x1e070d-0x0;var _0x4bf1f4=_0x83cf[_0x1e070d];return _0x4bf1f4;};'use strict';var _=require(_0xf83c('0x0'));var util=require(_0xf83c('0x1'));var moment=require(_0xf83c('0x2'));var BPromise=require(_0xf83c('0x3'));var rs=require(_0xf83c('0x4'));var fs=require('fs');var Redis=require(_0xf83c('0x5'));var db=require(_0xf83c('0x6'))['db'];var utils=require(_0xf83c('0x7'));var logger=require(_0xf83c('0x8'))(_0xf83c('0x9'));var config=require(_0xf83c('0xa'));var jayson=require(_0xf83c('0xb'));var client=jayson[_0xf83c('0xc')][_0xf83c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x7c45dd,_0x191f08,_0x28658a){return new BPromise(function(_0x50fdd6,_0x1368a1){return client[_0xf83c('0xe')](_0x7c45dd,_0x28658a)[_0xf83c('0xf')](function(_0x402b80){logger['info'](_0xf83c('0x10'),_0x191f08,_0xf83c('0x11'));logger['debug'](_0xf83c('0x12'),_0x191f08,_0xf83c('0x11'),JSON[_0xf83c('0x13')](_0x402b80));if(_0x402b80[_0xf83c('0x14')]){if(_0x402b80[_0xf83c('0x14')][_0xf83c('0x15')]===0x1f4){logger[_0xf83c('0x14')](_0xf83c('0x10'),_0x191f08,_0x402b80[_0xf83c('0x14')][_0xf83c('0x16')]);return _0x1368a1(_0x402b80[_0xf83c('0x14')][_0xf83c('0x16')]);}logger[_0xf83c('0x14')](_0xf83c('0x10'),_0x191f08,_0x402b80[_0xf83c('0x14')]['message']);return _0x50fdd6(_0x402b80[_0xf83c('0x14')]['message']);}else{logger['info'](_0xf83c('0x10'),_0x191f08,_0xf83c('0x11'));_0x50fdd6(_0x402b80[_0xf83c('0x17')][_0xf83c('0x16')]);}})[_0xf83c('0x18')](function(_0x59f8f8){logger[_0xf83c('0x14')](_0xf83c('0x10'),_0x191f08,_0x59f8f8);_0x1368a1(_0x59f8f8);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 531f52a..3042f94 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 _0xf60a=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','show','post','isAuthenticated','/:id','delete','destroy','multer'];(function(_0x1d760b,_0x47f9fe){var _0x18fb17=function(_0x312def){while(--_0x312def){_0x1d760b['push'](_0x1d760b['shift']());}};_0x18fb17(++_0x47f9fe);}(_0xf60a,0xc2));var _0xaf60=function(_0xf219b,_0x1ad38e){_0xf219b=_0xf219b-0x0;var _0x4db27e=_0xf60a[_0xf219b];return _0x4db27e;};'use strict';var multer=require(_0xaf60('0x0'));var util=require('util');var path=require(_0xaf60('0x1'));var timeout=require(_0xaf60('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf60('0x3'));var interaction=require(_0xaf60('0x4'));var config=require(_0xaf60('0x5'));var controller=require('./faxTransferReport.controller');router[_0xaf60('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf60('0x7'),auth['isAuthenticated'](),controller[_0xaf60('0x8')]);router[_0xaf60('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xaf60('0x9')]);router[_0xaf60('0xa')]('/',auth[_0xaf60('0xb')](),controller['create']);router['put'](_0xaf60('0xc'),auth[_0xaf60('0xb')](),controller['update']);router[_0xaf60('0xd')](_0xaf60('0xc'),auth[_0xaf60('0xb')](),controller[_0xaf60('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7988=['get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index'];(function(_0x54b40c,_0x599882){var _0x493b38=function(_0x70c6c9){while(--_0x70c6c9){_0x54b40c['push'](_0x54b40c['shift']());}};_0x493b38(++_0x599882);}(_0x7988,0x1ee));var _0x8798=function(_0x4a4751,_0x2b4e4e){_0x4a4751=_0x4a4751-0x0;var _0x30db8e=_0x7988[_0x4a4751];return _0x30db8e;};'use strict';var multer=require(_0x8798('0x0'));var util=require(_0x8798('0x1'));var path=require('path');var timeout=require(_0x8798('0x2'));var express=require(_0x8798('0x3'));var router=express[_0x8798('0x4')]();var fs_extra=require(_0x8798('0x5'));var auth=require(_0x8798('0x6'));var interaction=require(_0x8798('0x7'));var config=require(_0x8798('0x8'));var controller=require(_0x8798('0x9'));router['get']('/',auth[_0x8798('0xa')](),controller[_0x8798('0xb')]);router[_0x8798('0xc')](_0x8798('0xd'),auth[_0x8798('0xa')](),controller['describe']);router[_0x8798('0xc')](_0x8798('0xe'),auth[_0x8798('0xa')](),controller[_0x8798('0xf')]);router[_0x8798('0x10')]('/',auth['isAuthenticated'](),controller[_0x8798('0x11')]);router[_0x8798('0x12')](_0x8798('0xe'),auth['isAuthenticated'](),controller[_0x8798('0x13')]);router[_0x8798('0x14')](_0x8798('0xe'),auth['isAuthenticated'](),controller[_0x8798('0x15')]);module[_0x8798('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 96ad609..2254edd 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 _0x0984=['../../components/auth/service','./intDeskAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','destroy','multer','util','path','connect-timeout','express'];(function(_0x811094,_0x2ca567){var _0x779048=function(_0x5f093f){while(--_0x5f093f){_0x811094['push'](_0x811094['shift']());}};_0x779048(++_0x2ca567);}(_0x0984,0x163));var _0x4098=function(_0x281e4b,_0x13cc6a){_0x281e4b=_0x281e4b-0x0;var _0x53b735=_0x0984[_0x281e4b];return _0x53b735;};'use strict';var multer=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var path=require(_0x4098('0x2'));var timeout=require(_0x4098('0x3'));var express=require(_0x4098('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4098('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4098('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4098('0x7')]);router[_0x4098('0x8')](_0x4098('0x9'),auth[_0x4098('0xa')](),controller['show']);router[_0x4098('0x8')](_0x4098('0xb'),auth[_0x4098('0xa')](),controller['getConfigurations']);router[_0x4098('0x8')](_0x4098('0xc'),auth[_0x4098('0xa')](),controller[_0x4098('0xd')]);router[_0x4098('0xe')]('/',auth[_0x4098('0xa')](),controller['create']);router[_0x4098('0xe')](_0x4098('0xb'),auth['isAuthenticated'](),controller[_0x4098('0xf')]);router[_0x4098('0x10')](_0x4098('0x9'),auth[_0x4098('0xa')](),controller['update']);router['delete'](_0x4098('0x9'),auth[_0x4098('0xa')](),controller[_0x4098('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7246=['isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x1039e7,_0x3d6ee9){var _0x133c53=function(_0x260390){while(--_0x260390){_0x1039e7['push'](_0x1039e7['shift']());}};_0x133c53(++_0x3d6ee9);}(_0x7246,0x172));var _0x6724=function(_0x2dbaa3,_0x592a7d){_0x2dbaa3=_0x2dbaa3-0x0;var _0x5e11aa=_0x7246[_0x2dbaa3];return _0x5e11aa;};'use strict';var multer=require(_0x6724('0x0'));var util=require('util');var path=require(_0x6724('0x1'));var timeout=require(_0x6724('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6724('0x3'));var auth=require(_0x6724('0x4'));var interaction=require(_0x6724('0x5'));var config=require(_0x6724('0x6'));var controller=require(_0x6724('0x7'));router['get']('/',auth[_0x6724('0x8')](),controller[_0x6724('0x9')]);router['get'](_0x6724('0xa'),auth[_0x6724('0x8')](),controller['show']);router[_0x6724('0xb')](_0x6724('0xc'),auth[_0x6724('0x8')](),controller[_0x6724('0xd')]);router['get'](_0x6724('0xe'),auth[_0x6724('0x8')](),controller[_0x6724('0xf')]);router['post']('/',auth[_0x6724('0x8')](),controller[_0x6724('0x10')]);router['post'](_0x6724('0xc'),auth[_0x6724('0x8')](),controller['addConfiguration']);router[_0x6724('0x11')](_0x6724('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6724('0x12')](_0x6724('0xa'),auth[_0x6724('0x8')](),controller[_0x6724('0x13')]);module[_0x6724('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8814d69..721fb6b 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 _0xce3d=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x508434,_0x4bbd70){var _0x2da9a3=function(_0x1e6fbc){while(--_0x1e6fbc){_0x508434['push'](_0x508434['shift']());}};_0x2da9a3(++_0x4bbd70);}(_0xce3d,0x142));var _0xdce3=function(_0x3f186c,_0x407d8c){_0x3f186c=_0x3f186c-0x0;var _0x16f766=_0xce3d[_0x3f186c];return _0x16f766;};'use strict';var Sequelize=require(_0xdce3('0x0'));module[_0xdce3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdce3('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdce3('0x2')]},'authType':{'type':Sequelize[_0xdce3('0x3')](_0xdce3('0x4')),'defaultValue':_0xdce3('0x4')},'password':{'type':Sequelize[_0xdce3('0x2')]},'consumerKey':{'type':Sequelize[_0xdce3('0x2')]},'consumerSecret':{'type':Sequelize[_0xdce3('0x2')]},'token':{'type':Sequelize[_0xdce3('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xdce3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdce3('0x3')]('integrationTab',_0xdce3('0x5')),'defaultValue':_0xdce3('0x6')}}; \ No newline at end of file +var _0x2f1f=['ENUM','basic','newTab','integrationTab','exports','STRING'];(function(_0x4f346e,_0x21ebf6){var _0x12adfa=function(_0x5b5601){while(--_0x5b5601){_0x4f346e['push'](_0x4f346e['shift']());}};_0x12adfa(++_0x21ebf6);}(_0x2f1f,0xc4));var _0xf2f1=function(_0x25f4ed,_0x35a71f){_0x25f4ed=_0x25f4ed-0x0;var _0x22363e=_0x2f1f[_0x25f4ed];return _0x22363e;};'use strict';var Sequelize=require('sequelize');module[_0xf2f1('0x0')]={'name':{'type':Sequelize[_0xf2f1('0x1')]},'description':{'type':Sequelize[_0xf2f1('0x1')]},'username':{'type':Sequelize[_0xf2f1('0x1')]},'remoteUri':{'type':Sequelize[_0xf2f1('0x1')]},'authType':{'type':Sequelize[_0xf2f1('0x2')](_0xf2f1('0x3')),'defaultValue':_0xf2f1('0x3')},'password':{'type':Sequelize[_0xf2f1('0x1')]},'consumerKey':{'type':Sequelize[_0xf2f1('0x1')]},'consumerSecret':{'type':Sequelize[_0xf2f1('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xf2f1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf2f1('0x2')]('integrationTab',_0xf2f1('0x4')),'defaultValue':_0xf2f1('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1b678fc..67f94cc 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 _0x1421=['slice','substring','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','concat','_embedded','entries','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','DeskAccount','includeAll','include','findAll','show','params','rawAttributes','intersection','options','find','catch','create','body','update','getConfigurations','findOne','DeskConfiguration','order','pick','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','tokenSecret'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x1421,0xf2));var _0x1142=function(_0x52f3de,_0x4ce3d3){_0x52f3de=_0x52f3de-0x0;var _0x5d4460=_0x1421[_0x52f3de];return _0x5d4460;};'use strict';var emlformat=require(_0x1142('0x0'));var rimraf=require(_0x1142('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1142('0x2'));var rp=require(_0x1142('0x3'));var moment=require(_0x1142('0x4'));var BPromise=require(_0x1142('0x5'));var Mustache=require(_0x1142('0x6'));var util=require(_0x1142('0x7'));var path=require(_0x1142('0x8'));var sox=require(_0x1142('0x9'));var csv=require('to-csv');var ejs=require(_0x1142('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1142('0xb'));var squel=require(_0x1142('0xc'));var crypto=require('crypto');var jsforce=require(_0x1142('0xd'));var deskjs=require(_0x1142('0xe'));var toCsv=require(_0x1142('0xf'));var querystring=require(_0x1142('0x10'));var Papa=require(_0x1142('0x11'));var Redis=require('ioredis');var authService=require(_0x1142('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1142('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1142('0x14'))(_0x1142('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1142('0x16'));var db=require(_0x1142('0x17'))['db'];var integrations=require(_0x1142('0x18'));function respondWithStatusCode(_0x1efa3c,_0x39f847){_0x39f847=_0x39f847||0xcc;return function(_0xf4d8b6){if(_0xf4d8b6){return _0x1efa3c[_0x1142('0x19')](_0x39f847);}return _0x1efa3c['status'](_0x39f847)[_0x1142('0x1a')]();};}function respondWithResult(_0x51ac4a,_0x39a4e1){_0x39a4e1=_0x39a4e1||0xc8;return function(_0x2113b3){if(_0x2113b3){return _0x51ac4a[_0x1142('0x1b')](_0x39a4e1)[_0x1142('0x1c')](_0x2113b3);}};}function respondWithFilteredResult(_0xaef46f,_0x113c4f){return function(_0xaac5ec){if(_0xaac5ec){var _0x3a4b58=typeof _0x113c4f[_0x1142('0x1d')]==='undefined'&&typeof _0x113c4f['limit']==='undefined';var _0x585db3=_0xaac5ec['count'];var _0x1fec8e=_0x3a4b58?0x0:_0x113c4f[_0x1142('0x1d')];var _0x1af13a=_0x3a4b58?_0xaac5ec[_0x1142('0x1e')]:_0x113c4f[_0x1142('0x1d')]+_0x113c4f[_0x1142('0x1f')];var _0x3da4a8;if(_0x1af13a>=_0x585db3){_0x1af13a=_0x585db3;_0x3da4a8=0xc8;}else{_0x3da4a8=0xce;}_0xaef46f['status'](_0x3da4a8);return _0xaef46f[_0x1142('0x20')](_0x1142('0x21'),_0x1fec8e+'-'+_0x1af13a+'/'+_0x585db3)['json'](_0xaac5ec);}return null;};}function patchUpdates(_0x156195){return function(_0x13ffcb){try{jsonpatch[_0x1142('0x22')](_0x13ffcb,_0x156195,!![]);}catch(_0x5e8131){return BPromise[_0x1142('0x23')](_0x5e8131);}return _0x13ffcb[_0x1142('0x24')]();};}function saveUpdates(_0x340cb4,_0x561016){return function(_0x294ccf){if(_0x294ccf){return _0x294ccf['update'](_0x340cb4)[_0x1142('0x25')](function(_0x3302d0){return _0x3302d0;});}return null;};}function removeEntity(_0x264363,_0x56cab3){return function(_0x3a2e30){if(_0x3a2e30){return _0x3a2e30[_0x1142('0x26')]()[_0x1142('0x25')](function(){_0x264363[_0x1142('0x1b')](0xcc)[_0x1142('0x1a')]();});}};}function handleEntityNotFound(_0x21ccfd,_0x112415){return function(_0x392091){if(!_0x392091){_0x21ccfd[_0x1142('0x19')](0x194);}return _0x392091;};}function handleError(_0x32e506,_0x219ac8){_0x219ac8=_0x219ac8||0x1f4;return function(_0x4728db){logger['error'](_0x4728db['stack']);if(_0x4728db[_0x1142('0x27')]){delete _0x4728db[_0x1142('0x27')];}_0x32e506[_0x1142('0x1b')](_0x219ac8)[_0x1142('0x28')](_0x4728db);};}exports[_0x1142('0x29')]=function(_0x5284ef,_0x576fe6){var _0xaf5a4e={},_0x2151b8={},_0x4771f3={'count':0x0,'rows':[]};var _0x28e6d5=_[_0x1142('0x2a')](db['DeskAccount']['rawAttributes'],function(_0xe3e7c1){return{'name':_0xe3e7c1[_0x1142('0x2b')],'type':_0xe3e7c1[_0x1142('0x2c')][_0x1142('0x2d')]};});_0x2151b8[_0x1142('0x2e')]=_[_0x1142('0x2a')](_0x28e6d5,_0x1142('0x27'));_0x2151b8[_0x1142('0x2f')]=_[_0x1142('0x30')](_0x5284ef[_0x1142('0x2f')]);_0x2151b8[_0x1142('0x31')]=_['intersection'](_0x2151b8[_0x1142('0x2e')],_0x2151b8[_0x1142('0x2f')]);_0xaf5a4e[_0x1142('0x32')]=_['intersection'](_0x2151b8[_0x1142('0x2e')],qs['fields'](_0x5284ef[_0x1142('0x2f')][_0x1142('0x33')]));_0xaf5a4e['attributes']=_0xaf5a4e[_0x1142('0x32')][_0x1142('0x34')]?_0xaf5a4e[_0x1142('0x32')]:_0x2151b8[_0x1142('0x2e')];if(!_0x5284ef[_0x1142('0x2f')][_0x1142('0x35')](_0x1142('0x36'))){_0xaf5a4e[_0x1142('0x1f')]=qs['limit'](_0x5284ef[_0x1142('0x2f')][_0x1142('0x1f')]);_0xaf5a4e[_0x1142('0x1d')]=qs[_0x1142('0x1d')](_0x5284ef[_0x1142('0x2f')]['offset']);}_0xaf5a4e['order']=qs['sort'](_0x5284ef[_0x1142('0x2f')][_0x1142('0x37')]);_0xaf5a4e['where']=qs[_0x1142('0x31')](_['pick'](_0x5284ef[_0x1142('0x2f')],_0x2151b8[_0x1142('0x31')]),_0x28e6d5);if(_0x5284ef['query'][_0x1142('0x38')]){_0xaf5a4e[_0x1142('0x39')]=_['merge'](_0xaf5a4e[_0x1142('0x39')],{'$or':_[_0x1142('0x2a')](_0x28e6d5,function(_0x4b9790){if(_0x4b9790[_0x1142('0x2c')]!==_0x1142('0x3a')){var _0x4a04e1={};_0x4a04e1[_0x4b9790[_0x1142('0x27')]]={'$like':'%'+_0x5284ef[_0x1142('0x2f')][_0x1142('0x38')]+'%'};return _0x4a04e1;}})});}_0xaf5a4e=_[_0x1142('0x3b')]({},_0xaf5a4e,_0x5284ef['options']);var _0xe6cc85={'where':_0xaf5a4e[_0x1142('0x39')]};return db[_0x1142('0x3c')][_0x1142('0x1e')](_0xe6cc85)['then'](function(_0x14a81a){_0x4771f3[_0x1142('0x1e')]=_0x14a81a;if(_0x5284ef[_0x1142('0x2f')][_0x1142('0x3d')]){_0xaf5a4e[_0x1142('0x3e')]=[{'all':!![]}];}return db[_0x1142('0x3c')][_0x1142('0x3f')](_0xaf5a4e);})[_0x1142('0x25')](function(_0x4e06ae){_0x4771f3['rows']=_0x4e06ae;return _0x4771f3;})['then'](respondWithFilteredResult(_0x576fe6,_0xaf5a4e))['catch'](handleError(_0x576fe6,null));};exports[_0x1142('0x40')]=function(_0x5343df,_0x147613){var _0x2271af={'raw':![],'where':{'id':_0x5343df[_0x1142('0x41')]['id']}},_0x539e25={};_0x539e25[_0x1142('0x2e')]=_[_0x1142('0x30')](db[_0x1142('0x3c')][_0x1142('0x42')]);_0x539e25[_0x1142('0x2f')]=_[_0x1142('0x30')](_0x5343df[_0x1142('0x2f')]);_0x539e25[_0x1142('0x31')]=_[_0x1142('0x43')](_0x539e25['model'],_0x539e25['query']);_0x2271af[_0x1142('0x32')]=_[_0x1142('0x43')](_0x539e25[_0x1142('0x2e')],qs[_0x1142('0x33')](_0x5343df[_0x1142('0x2f')][_0x1142('0x33')]));_0x2271af[_0x1142('0x32')]=_0x2271af[_0x1142('0x32')]['length']?_0x2271af['attributes']:_0x539e25['model'];if(_0x5343df[_0x1142('0x2f')]['includeAll']){_0x2271af[_0x1142('0x3e')]=[{'all':!![]}];}_0x2271af=_[_0x1142('0x3b')]({},_0x2271af,_0x5343df[_0x1142('0x44')]);return db[_0x1142('0x3c')][_0x1142('0x45')](_0x2271af)[_0x1142('0x25')](handleEntityNotFound(_0x147613,null))[_0x1142('0x25')](respondWithResult(_0x147613,null))[_0x1142('0x46')](handleError(_0x147613,null));};exports[_0x1142('0x47')]=function(_0x3cdda3,_0x39768f){return db[_0x1142('0x3c')][_0x1142('0x47')](_0x3cdda3[_0x1142('0x48')],{})['then'](respondWithResult(_0x39768f,0xc9))[_0x1142('0x46')](handleError(_0x39768f,null));};exports[_0x1142('0x49')]=function(_0x58d294,_0x45a27b){if(_0x58d294['body']['id']){delete _0x58d294[_0x1142('0x48')]['id'];}return db['DeskAccount'][_0x1142('0x45')]({'where':{'id':_0x58d294[_0x1142('0x41')]['id']}})[_0x1142('0x25')](handleEntityNotFound(_0x45a27b,null))[_0x1142('0x25')](saveUpdates(_0x58d294[_0x1142('0x48')],null))[_0x1142('0x25')](respondWithResult(_0x45a27b,null))[_0x1142('0x46')](handleError(_0x45a27b,null));};exports[_0x1142('0x26')]=function(_0x1e2b2a,_0x1a0ff8){return db[_0x1142('0x3c')][_0x1142('0x45')]({'where':{'id':_0x1e2b2a[_0x1142('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a0ff8,null))[_0x1142('0x25')](removeEntity(_0x1a0ff8,null))[_0x1142('0x46')](handleError(_0x1a0ff8,null));};exports[_0x1142('0x4a')]=function(_0x26a717,_0x1336d0,_0x29a2ad){var _0xace180={};var _0x2f731b={};var _0x36d3ff;var _0x25bcbc;return db[_0x1142('0x3c')][_0x1142('0x4b')]({'where':{'id':_0x26a717[_0x1142('0x41')]['id']}})[_0x1142('0x25')](handleEntityNotFound(_0x1336d0,null))[_0x1142('0x25')](function(_0x26a1f5){if(_0x26a1f5){_0x36d3ff=_0x26a1f5;_0x2f731b[_0x1142('0x2e')]=_[_0x1142('0x30')](db[_0x1142('0x4c')][_0x1142('0x42')]);_0x2f731b['query']=_['keys'](_0x26a717[_0x1142('0x2f')]);_0x2f731b[_0x1142('0x31')]=_[_0x1142('0x43')](_0x2f731b['model'],_0x2f731b[_0x1142('0x2f')]);_0xace180['attributes']=_['intersection'](_0x2f731b[_0x1142('0x2e')],qs['fields'](_0x26a717[_0x1142('0x2f')][_0x1142('0x33')]));_0xace180[_0x1142('0x32')]=_0xace180['attributes'][_0x1142('0x34')]?_0xace180[_0x1142('0x32')]:_0x2f731b['model'];_0xace180[_0x1142('0x4d')]=qs[_0x1142('0x37')](_0x26a717[_0x1142('0x2f')][_0x1142('0x37')]);_0xace180[_0x1142('0x39')]=qs[_0x1142('0x31')](_[_0x1142('0x4e')](_0x26a717[_0x1142('0x2f')],_0x2f731b[_0x1142('0x31')]));if(_0x26a717[_0x1142('0x2f')][_0x1142('0x38')]){_0xace180[_0x1142('0x39')]=_[_0x1142('0x3b')](_0xace180[_0x1142('0x39')],{'$or':_['map'](_0xace180['attributes'],function(_0x307aba){var _0x320090={};_0x320090[_0x307aba]={'$like':'%'+_0x26a717['query'][_0x1142('0x38')]+'%'};return _0x320090;})});}_0xace180=_[_0x1142('0x3b')]({},_0xace180,_0x26a717[_0x1142('0x44')]);return _0x36d3ff['getConfigurations'](_0xace180);}})[_0x1142('0x25')](function(_0x2e5ec5){if(_0x2e5ec5){_0x25bcbc=_0x2e5ec5['length'];if(!_0x26a717['query'][_0x1142('0x35')]('nolimit')){_0xace180[_0x1142('0x1f')]=qs[_0x1142('0x1f')](_0x26a717[_0x1142('0x2f')][_0x1142('0x1f')]);_0xace180[_0x1142('0x1d')]=qs[_0x1142('0x1d')](_0x26a717[_0x1142('0x2f')]['offset']);}return _0x36d3ff['getConfigurations'](_0xace180);}})['then'](function(_0x351720){if(_0x351720){return _0x351720?{'count':_0x25bcbc,'rows':_0x351720}:null;}})[_0x1142('0x25')](respondWithResult(_0x1336d0,null))[_0x1142('0x46')](handleError(_0x1336d0,null));};exports['addConfiguration']=function(_0x3bd665,_0xa4c086,_0x3f2533){if(_0x3bd665[_0x1142('0x48')]['id']){delete _0x3bd665[_0x1142('0x48')]['id'];}return db[_0x1142('0x3c')][_0x1142('0x4b')]({'where':{'id':_0x3bd665['params']['id']}})[_0x1142('0x25')](handleEntityNotFound(_0xa4c086,null))[_0x1142('0x25')](function(_0x238de3){if(_0x238de3){_0x3bd665['body'][_0x1142('0x4f')]=_0x238de3['id'];_0x3bd665[_0x1142('0x48')][_0x1142('0x50')]=integrations[_0x1142('0x51')](_0x3bd665[_0x1142('0x48')]['channel'],_0x3bd665[_0x1142('0x48')]['type']);_0x3bd665['body'][_0x1142('0x52')]=integrations[_0x1142('0x53')](_0x3bd665[_0x1142('0x48')][_0x1142('0x54')],_0x3bd665[_0x1142('0x48')][_0x1142('0x2c')]);return db['DeskConfiguration']['create'](_0x3bd665[_0x1142('0x48')],{'include':[{'model':db[_0x1142('0x55')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x1142('0x25')](respondWithResult(_0xa4c086,null))['catch'](handleError(_0xa4c086,null));};exports[_0x1142('0x56')]=function(_0x3561ee,_0x125a2d,_0x5f3b7c){var _0x4ec016=[{'name':_0x1142('0x57'),'label':_0x1142('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x28b41c='';return db['DeskAccount'][_0x1142('0x4b')]({'where':{'id':_0x3561ee['params']['id']},'attributes':['id',_0x1142('0x58'),_0x1142('0x59'),_0x1142('0x5a'),_0x1142('0x5b'),_0x1142('0x5c'),'consumerSecret','token',_0x1142('0x5d')]})[_0x1142('0x25')](handleEntityNotFound(_0x125a2d,null))[_0x1142('0x25')](function(_0x444b97){if(_0x444b97){_0x28b41c=_0x444b97[_0x1142('0x58')];var _0x3d4718=_0x28b41c[_0x1142('0x5e')](-0x1);if(_0x3d4718==='/'){_0x28b41c=_0x28b41c[_0x1142('0x5f')](0x0,_0x28b41c[_0x1142('0x60')](_0x3d4718));}var _0x4b2b4c={'method':_0x1142('0x61'),'uri':util[_0x1142('0x62')]('%s/custom_fields',_0x28b41c),'headers':{'Content-Type':_0x1142('0x63'),'Accept':'application/json'},'json':!![]};if(_0x444b97['authType']===_0x1142('0x64')){_0x4b2b4c['headers'][_0x1142('0x65')]=util[_0x1142('0x62')](_0x1142('0x66'),new Buffer(util[_0x1142('0x62')](_0x1142('0x67'),_0x444b97['username'],_0x444b97[_0x1142('0x5b')]))['toString']('base64'));}return rp(_0x4b2b4c)['then'](function(_0x1f466c){return _0x4ec016[_0x1142('0x68')](_[_0x1142('0x2a')](_0x1f466c[_0x1142('0x69')][_0x1142('0x6a')],function(_0x33c93c){return{'id':_0x33c93c['name'],'name':_0x33c93c['name'],'type':_0x33c93c[_0x1142('0x2c')],'active':_0x33c93c['active'],'label':_0x33c93c[_0x1142('0x6b')],'custom':!![]};}));});}})[_0x1142('0x25')](function(_0x60da){return{'count':_0x60da[_0x1142('0x34')],'rows':_0x60da};})[_0x1142('0x25')](respondWithResult(_0x125a2d,null))[_0x1142('0x46')](function(_0x4718f1){var _0x95be5a=_0x3561ee[_0x1142('0x2f')][_0x1142('0x6c')]?0x1f4:_0x4718f1[_0x1142('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x95be5a,JSON[_0x1142('0x6e')](_0x4718f1));delete _0x4718f1[_0x1142('0x27')];if(_0x95be5a===0x191){_0x95be5a=0x190;}_0x125a2d[_0x1142('0x1b')](_0x95be5a)[_0x1142('0x28')](_0x3561ee[_0x1142('0x2f')][_0x1142('0x6c')]?{'message':_0x1142('0x6f'),'statusCode':_0x4718f1[_0x1142('0x6d')]}:_0x4718f1);});}; \ No newline at end of file +var _0x254b=['headers','username','base64','entries','label','statusCode','stringify','send','test','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','index','DeskAccount','rawAttributes','fieldName','key','map','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','DeskConfiguration','order','options','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerKey','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json'];(function(_0x883c6c,_0x2adaa2){var _0x123f5a=function(_0xfd9b21){while(--_0xfd9b21){_0x883c6c['push'](_0x883c6c['shift']());}};_0x123f5a(++_0x2adaa2);}(_0x254b,0x157));var _0xb254=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x254b[_0x173452];return _0xee3fd0;};'use strict';var emlformat=require(_0xb254('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb254('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb254('0x2'));var moment=require(_0xb254('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb254('0x4'));var util=require('util');var path=require(_0xb254('0x5'));var sox=require(_0xb254('0x6'));var csv=require(_0xb254('0x7'));var ejs=require(_0xb254('0x8'));var fs=require('fs');var fs_extra=require(_0xb254('0x9'));var _=require(_0xb254('0xa'));var squel=require(_0xb254('0xb'));var crypto=require('crypto');var jsforce=require(_0xb254('0xc'));var deskjs=require(_0xb254('0xd'));var toCsv=require(_0xb254('0x7'));var querystring=require('querystring');var Papa=require(_0xb254('0xe'));var Redis=require(_0xb254('0xf'));var authService=require(_0xb254('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb254('0x11'));var hardwareService=require(_0xb254('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb254('0x13'));var config=require(_0xb254('0x14'));var licenseUtil=require(_0xb254('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb254('0x16'));function respondWithStatusCode(_0x3745fc,_0x5dffab){_0x5dffab=_0x5dffab||0xcc;return function(_0x4bde6d){if(_0x4bde6d){return _0x3745fc[_0xb254('0x17')](_0x5dffab);}return _0x3745fc['status'](_0x5dffab)['end']();};}function respondWithResult(_0x4d6ed8,_0x3d2eaf){_0x3d2eaf=_0x3d2eaf||0xc8;return function(_0x137627){if(_0x137627){return _0x4d6ed8[_0xb254('0x18')](_0x3d2eaf)['json'](_0x137627);}};}function respondWithFilteredResult(_0x1c04ba,_0x5ecd03){return function(_0x2e33fb){if(_0x2e33fb){var _0x452ce3=typeof _0x5ecd03['offset']===_0xb254('0x19')&&typeof _0x5ecd03[_0xb254('0x1a')]===_0xb254('0x19');var _0xbd9b71=_0x2e33fb['count'];var _0x510012=_0x452ce3?0x0:_0x5ecd03[_0xb254('0x1b')];var _0x48e0a0=_0x452ce3?_0x2e33fb[_0xb254('0x1c')]:_0x5ecd03[_0xb254('0x1b')]+_0x5ecd03[_0xb254('0x1a')];var _0x133eac;if(_0x48e0a0>=_0xbd9b71){_0x48e0a0=_0xbd9b71;_0x133eac=0xc8;}else{_0x133eac=0xce;}_0x1c04ba[_0xb254('0x18')](_0x133eac);return _0x1c04ba[_0xb254('0x1d')](_0xb254('0x1e'),_0x510012+'-'+_0x48e0a0+'/'+_0xbd9b71)[_0xb254('0x1f')](_0x2e33fb);}return null;};}function patchUpdates(_0x452d73){return function(_0x136ae5){try{jsonpatch[_0xb254('0x20')](_0x136ae5,_0x452d73,!![]);}catch(_0x225535){return BPromise[_0xb254('0x21')](_0x225535);}return _0x136ae5[_0xb254('0x22')]();};}function saveUpdates(_0x47e91e,_0x294ce6){return function(_0x118817){if(_0x118817){return _0x118817[_0xb254('0x23')](_0x47e91e)['then'](function(_0x172d6f){return _0x172d6f;});}return null;};}function removeEntity(_0x190d5e,_0x5889f1){return function(_0x3cf626){if(_0x3cf626){return _0x3cf626[_0xb254('0x24')]()[_0xb254('0x25')](function(){_0x190d5e['status'](0xcc)[_0xb254('0x26')]();});}};}function handleEntityNotFound(_0x56650d,_0x2a47cf){return function(_0x5d4532){if(!_0x5d4532){_0x56650d['sendStatus'](0x194);}return _0x5d4532;};}function handleError(_0x312a8a,_0x405738){_0x405738=_0x405738||0x1f4;return function(_0x5c7e05){logger[_0xb254('0x27')](_0x5c7e05[_0xb254('0x28')]);if(_0x5c7e05['name']){delete _0x5c7e05['name'];}_0x312a8a[_0xb254('0x18')](_0x405738)['send'](_0x5c7e05);};}exports[_0xb254('0x29')]=function(_0xc8c479,_0x524ff9){var _0xa8a450={},_0x2f2d97={},_0x1a6a72={'count':0x0,'rows':[]};var _0x464e62=_['map'](db[_0xb254('0x2a')][_0xb254('0x2b')],function(_0x53fe35){return{'name':_0x53fe35[_0xb254('0x2c')],'type':_0x53fe35['type'][_0xb254('0x2d')]};});_0x2f2d97['model']=_[_0xb254('0x2e')](_0x464e62,_0xb254('0x2f'));_0x2f2d97[_0xb254('0x30')]=_[_0xb254('0x31')](_0xc8c479['query']);_0x2f2d97[_0xb254('0x32')]=_['intersection'](_0x2f2d97[_0xb254('0x33')],_0x2f2d97[_0xb254('0x30')]);_0xa8a450[_0xb254('0x34')]=_[_0xb254('0x35')](_0x2f2d97[_0xb254('0x33')],qs['fields'](_0xc8c479[_0xb254('0x30')][_0xb254('0x36')]));_0xa8a450['attributes']=_0xa8a450[_0xb254('0x34')][_0xb254('0x37')]?_0xa8a450['attributes']:_0x2f2d97[_0xb254('0x33')];if(!_0xc8c479[_0xb254('0x30')][_0xb254('0x38')](_0xb254('0x39'))){_0xa8a450[_0xb254('0x1a')]=qs[_0xb254('0x1a')](_0xc8c479[_0xb254('0x30')]['limit']);_0xa8a450['offset']=qs[_0xb254('0x1b')](_0xc8c479[_0xb254('0x30')][_0xb254('0x1b')]);}_0xa8a450['order']=qs[_0xb254('0x3a')](_0xc8c479[_0xb254('0x30')][_0xb254('0x3a')]);_0xa8a450['where']=qs[_0xb254('0x32')](_[_0xb254('0x3b')](_0xc8c479[_0xb254('0x30')],_0x2f2d97[_0xb254('0x32')]),_0x464e62);if(_0xc8c479[_0xb254('0x30')]['filter']){_0xa8a450[_0xb254('0x3c')]=_[_0xb254('0x3d')](_0xa8a450[_0xb254('0x3c')],{'$or':_[_0xb254('0x2e')](_0x464e62,function(_0x3d5ea2){if(_0x3d5ea2[_0xb254('0x3e')]!==_0xb254('0x3f')){var _0x6b5c50={};_0x6b5c50[_0x3d5ea2[_0xb254('0x2f')]]={'$like':'%'+_0xc8c479[_0xb254('0x30')][_0xb254('0x40')]+'%'};return _0x6b5c50;}})});}_0xa8a450=_[_0xb254('0x3d')]({},_0xa8a450,_0xc8c479['options']);var _0x3b6f10={'where':_0xa8a450['where']};return db[_0xb254('0x2a')][_0xb254('0x1c')](_0x3b6f10)[_0xb254('0x25')](function(_0x291ebd){_0x1a6a72[_0xb254('0x1c')]=_0x291ebd;if(_0xc8c479[_0xb254('0x30')][_0xb254('0x41')]){_0xa8a450[_0xb254('0x42')]=[{'all':!![]}];}return db[_0xb254('0x2a')][_0xb254('0x43')](_0xa8a450);})['then'](function(_0x490735){_0x1a6a72[_0xb254('0x44')]=_0x490735;return _0x1a6a72;})[_0xb254('0x25')](respondWithFilteredResult(_0x524ff9,_0xa8a450))[_0xb254('0x45')](handleError(_0x524ff9,null));};exports['show']=function(_0xcaa50d,_0x27a801){var _0x2675f8={'raw':![],'where':{'id':_0xcaa50d[_0xb254('0x46')]['id']}},_0x54dd52={};_0x54dd52['model']=_[_0xb254('0x31')](db[_0xb254('0x2a')]['rawAttributes']);_0x54dd52[_0xb254('0x30')]=_[_0xb254('0x31')](_0xcaa50d['query']);_0x54dd52[_0xb254('0x32')]=_['intersection'](_0x54dd52[_0xb254('0x33')],_0x54dd52['query']);_0x2675f8[_0xb254('0x34')]=_[_0xb254('0x35')](_0x54dd52['model'],qs[_0xb254('0x36')](_0xcaa50d[_0xb254('0x30')][_0xb254('0x36')]));_0x2675f8['attributes']=_0x2675f8[_0xb254('0x34')][_0xb254('0x37')]?_0x2675f8[_0xb254('0x34')]:_0x54dd52[_0xb254('0x33')];if(_0xcaa50d[_0xb254('0x30')][_0xb254('0x41')]){_0x2675f8[_0xb254('0x42')]=[{'all':!![]}];}_0x2675f8=_['merge']({},_0x2675f8,_0xcaa50d['options']);return db[_0xb254('0x2a')][_0xb254('0x47')](_0x2675f8)['then'](handleEntityNotFound(_0x27a801,null))[_0xb254('0x25')](respondWithResult(_0x27a801,null))[_0xb254('0x45')](handleError(_0x27a801,null));};exports[_0xb254('0x48')]=function(_0x9dc11d,_0x40588d){return db[_0xb254('0x2a')]['create'](_0x9dc11d[_0xb254('0x49')],{})['then'](respondWithResult(_0x40588d,0xc9))[_0xb254('0x45')](handleError(_0x40588d,null));};exports[_0xb254('0x23')]=function(_0x2f2ed0,_0x59e99b){if(_0x2f2ed0[_0xb254('0x49')]['id']){delete _0x2f2ed0[_0xb254('0x49')]['id'];}return db[_0xb254('0x2a')][_0xb254('0x47')]({'where':{'id':_0x2f2ed0[_0xb254('0x46')]['id']}})[_0xb254('0x25')](handleEntityNotFound(_0x59e99b,null))[_0xb254('0x25')](saveUpdates(_0x2f2ed0[_0xb254('0x49')],null))[_0xb254('0x25')](respondWithResult(_0x59e99b,null))[_0xb254('0x45')](handleError(_0x59e99b,null));};exports[_0xb254('0x24')]=function(_0x254263,_0x3a1cb4){return db[_0xb254('0x2a')][_0xb254('0x47')]({'where':{'id':_0x254263['params']['id']}})[_0xb254('0x25')](handleEntityNotFound(_0x3a1cb4,null))[_0xb254('0x25')](removeEntity(_0x3a1cb4,null))[_0xb254('0x45')](handleError(_0x3a1cb4,null));};exports[_0xb254('0x4a')]=function(_0xdb6e33,_0x47e8c8,_0xe8b518){var _0xee485d={};var _0x142ee1={};var _0x5e8f9f;var _0x3ab176;return db['DeskAccount'][_0xb254('0x4b')]({'where':{'id':_0xdb6e33[_0xb254('0x46')]['id']}})[_0xb254('0x25')](handleEntityNotFound(_0x47e8c8,null))['then'](function(_0x4bf971){if(_0x4bf971){_0x5e8f9f=_0x4bf971;_0x142ee1[_0xb254('0x33')]=_['keys'](db[_0xb254('0x4c')][_0xb254('0x2b')]);_0x142ee1[_0xb254('0x30')]=_[_0xb254('0x31')](_0xdb6e33[_0xb254('0x30')]);_0x142ee1['filters']=_[_0xb254('0x35')](_0x142ee1[_0xb254('0x33')],_0x142ee1[_0xb254('0x30')]);_0xee485d[_0xb254('0x34')]=_[_0xb254('0x35')](_0x142ee1['model'],qs[_0xb254('0x36')](_0xdb6e33['query'][_0xb254('0x36')]));_0xee485d[_0xb254('0x34')]=_0xee485d['attributes'][_0xb254('0x37')]?_0xee485d[_0xb254('0x34')]:_0x142ee1[_0xb254('0x33')];_0xee485d[_0xb254('0x4d')]=qs[_0xb254('0x3a')](_0xdb6e33[_0xb254('0x30')][_0xb254('0x3a')]);_0xee485d[_0xb254('0x3c')]=qs[_0xb254('0x32')](_[_0xb254('0x3b')](_0xdb6e33[_0xb254('0x30')],_0x142ee1[_0xb254('0x32')]));if(_0xdb6e33['query'][_0xb254('0x40')]){_0xee485d[_0xb254('0x3c')]=_[_0xb254('0x3d')](_0xee485d['where'],{'$or':_['map'](_0xee485d['attributes'],function(_0x201c41){var _0x5d5e2c={};_0x5d5e2c[_0x201c41]={'$like':'%'+_0xdb6e33[_0xb254('0x30')]['filter']+'%'};return _0x5d5e2c;})});}_0xee485d=_['merge']({},_0xee485d,_0xdb6e33[_0xb254('0x4e')]);return _0x5e8f9f[_0xb254('0x4a')](_0xee485d);}})[_0xb254('0x25')](function(_0x27db67){if(_0x27db67){_0x3ab176=_0x27db67[_0xb254('0x37')];if(!_0xdb6e33['query'][_0xb254('0x38')](_0xb254('0x39'))){_0xee485d[_0xb254('0x1a')]=qs[_0xb254('0x1a')](_0xdb6e33[_0xb254('0x30')][_0xb254('0x1a')]);_0xee485d[_0xb254('0x1b')]=qs[_0xb254('0x1b')](_0xdb6e33[_0xb254('0x30')][_0xb254('0x1b')]);}return _0x5e8f9f['getConfigurations'](_0xee485d);}})[_0xb254('0x25')](function(_0x31d2eb){if(_0x31d2eb){return _0x31d2eb?{'count':_0x3ab176,'rows':_0x31d2eb}:null;}})['then'](respondWithResult(_0x47e8c8,null))['catch'](handleError(_0x47e8c8,null));};exports[_0xb254('0x4f')]=function(_0x1650a0,_0x43c929,_0x392af5){if(_0x1650a0['body']['id']){delete _0x1650a0[_0xb254('0x49')]['id'];}return db[_0xb254('0x2a')][_0xb254('0x4b')]({'where':{'id':_0x1650a0[_0xb254('0x46')]['id']}})[_0xb254('0x25')](handleEntityNotFound(_0x43c929,null))[_0xb254('0x25')](function(_0x48148e){if(_0x48148e){_0x1650a0[_0xb254('0x49')][_0xb254('0x50')]=_0x48148e['id'];_0x1650a0[_0xb254('0x49')]['Subjects']=integrations[_0xb254('0x51')](_0x1650a0[_0xb254('0x49')][_0xb254('0x52')],_0x1650a0[_0xb254('0x49')][_0xb254('0x3e')]);_0x1650a0[_0xb254('0x49')][_0xb254('0x53')]=integrations[_0xb254('0x54')](_0x1650a0[_0xb254('0x49')][_0xb254('0x52')],_0x1650a0[_0xb254('0x49')][_0xb254('0x3e')]);return db[_0xb254('0x4c')][_0xb254('0x48')](_0x1650a0[_0xb254('0x49')],{'include':[{'model':db[_0xb254('0x55')],'as':_0xb254('0x56')},{'model':db[_0xb254('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x43c929,null))[_0xb254('0x45')](handleError(_0x43c929,null));};exports[_0xb254('0x57')]=function(_0x71ffcc,_0x1b76e2,_0x1777cf){var _0xc4720d=[{'name':_0xb254('0x58'),'label':_0xb254('0x58'),'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 _0xedee3b='';return db[_0xb254('0x2a')]['findOne']({'where':{'id':_0x71ffcc[_0xb254('0x46')]['id']},'attributes':['id',_0xb254('0x59'),_0xb254('0x5a'),'username',_0xb254('0x5b'),_0xb254('0x5c'),'consumerSecret','token',_0xb254('0x5d')]})[_0xb254('0x25')](handleEntityNotFound(_0x1b76e2,null))[_0xb254('0x25')](function(_0x141674){if(_0x141674){_0xedee3b=_0x141674[_0xb254('0x59')];var _0x7334cf=_0xedee3b[_0xb254('0x5e')](-0x1);if(_0x7334cf==='/'){_0xedee3b=_0xedee3b[_0xb254('0x5f')](0x0,_0xedee3b[_0xb254('0x60')](_0x7334cf));}var _0x13d532={'method':_0xb254('0x61'),'uri':util[_0xb254('0x62')](_0xb254('0x63'),_0xedee3b),'headers':{'Content-Type':_0xb254('0x64'),'Accept':_0xb254('0x64')},'json':!![]};if(_0x141674[_0xb254('0x5a')]==='basic'){_0x13d532[_0xb254('0x65')]['Authorization']=util[_0xb254('0x62')]('Basic\x20%s',new Buffer(util[_0xb254('0x62')]('%s:%s',_0x141674[_0xb254('0x66')],_0x141674[_0xb254('0x5b')]))['toString'](_0xb254('0x67')));}return rp(_0x13d532)['then'](function(_0x2f7c22){return _0xc4720d['concat'](_[_0xb254('0x2e')](_0x2f7c22['_embedded'][_0xb254('0x68')],function(_0x5b6bfe){return{'id':_0x5b6bfe['name'],'name':_0x5b6bfe['name'],'type':_0x5b6bfe[_0xb254('0x3e')],'active':_0x5b6bfe['active'],'label':_0x5b6bfe[_0xb254('0x69')],'custom':!![]};}));});}})[_0xb254('0x25')](function(_0x4234fa){return{'count':_0x4234fa[_0xb254('0x37')],'rows':_0x4234fa};})[_0xb254('0x25')](respondWithResult(_0x1b76e2,null))[_0xb254('0x45')](function(_0x4de6a5){var _0x18d7c8=_0x71ffcc[_0xb254('0x30')]['test']?0x1f4:_0x4de6a5[_0xb254('0x6a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb254('0x57'),_0x18d7c8,JSON[_0xb254('0x6b')](_0x4de6a5));delete _0x4de6a5[_0xb254('0x2f')];if(_0x18d7c8===0x191){_0x18d7c8=0x190;}_0x1b76e2[_0xb254('0x18')](_0x18d7c8)[_0xb254('0x6c')](_0x71ffcc[_0xb254('0x30')][_0xb254('0x6d')]?{'message':_0xb254('0x6e'),'statusCode':_0x4de6a5[_0xb254('0x6a')]}:_0x4de6a5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9961e63..8a3f62c 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 _0x4f63=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','api'];(function(_0x1a8e9d,_0x34808a){var _0x5a9810=function(_0x5d6717){while(--_0x5d6717){_0x1a8e9d['push'](_0x1a8e9d['shift']());}};_0x5a9810(++_0x34808a);}(_0x4f63,0xdb));var _0x34f6=function(_0x4eb9b7,_0x2b6622){_0x4eb9b7=_0x4eb9b7-0x0;var _0x3d8db5=_0x4f63[_0x4eb9b7];return _0x3d8db5;};'use strict';var _=require(_0x34f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x34f6('0x1'));var moment=require('moment');var BPromise=require(_0x34f6('0x2'));var rp=require(_0x34f6('0x3'));var fs=require('fs');var path=require(_0x34f6('0x4'));var rimraf=require(_0x34f6('0x5'));var config=require(_0x34f6('0x6'));var attributes=require(_0x34f6('0x7'));var integrations=require(_0x34f6('0x8'));module[_0x34f6('0x9')]=function(_0x359178,_0x789182){return _0x359178[_0x34f6('0xa')](_0x34f6('0xb'),attributes,{'tableName':_0x34f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae7=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x2045eb,_0x160626){var _0x5b1afe=function(_0xf2a479){while(--_0xf2a479){_0x2045eb['push'](_0x2045eb['shift']());}};_0x5b1afe(++_0x160626);}(_0x6ae7,0xfd));var _0x76ae=function(_0x3d43a6,_0x278e31){_0x3d43a6=_0x3d43a6-0x0;var _0x412a18=_0x6ae7[_0x3d43a6];return _0x412a18;};'use strict';var _=require('lodash');var util=require(_0x76ae('0x0'));var logger=require(_0x76ae('0x1'))('api');var moment=require(_0x76ae('0x2'));var BPromise=require(_0x76ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76ae('0x4'));var config=require(_0x76ae('0x5'));var attributes=require(_0x76ae('0x6'));var integrations=require(_0x76ae('0x7'));module[_0x76ae('0x8')]=function(_0x14fe2d,_0x4ed53f){return _0x14fe2d[_0x76ae('0x9')](_0x76ae('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 180d059..b6c5a78 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 _0x68bd=['../../config/utils','rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','DeskAccount','findAll','options','attributes','limit','include','map','model','GetDeskAccount','debug','ShowDeskAccount','where','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x55f2c0,_0x464ade){var _0x17d047=function(_0x44280e){while(--_0x44280e){_0x55f2c0['push'](_0x55f2c0['shift']());}};_0x17d047(++_0x464ade);}(_0x68bd,0x166));var _0xd68b=function(_0x684f8d,_0x35f431){_0x684f8d=_0x684f8d-0x0;var _0x1487d4=_0x68bd[_0x684f8d];return _0x1487d4;};'use strict';var _=require(_0xd68b('0x0'));var util=require(_0xd68b('0x1'));var moment=require('moment');var BPromise=require(_0xd68b('0x2'));var rs=require(_0xd68b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd68b('0x4'))['db'];var utils=require(_0xd68b('0x5'));var logger=require('../../config/logger')(_0xd68b('0x6'));var config=require('../../config/environment');var jayson=require(_0xd68b('0x7'));var client=jayson['client'][_0xd68b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3948d9,_0x41ea06,_0x14d4d9){return new BPromise(function(_0x3e408e,_0x59b942){return client[_0xd68b('0x9')](_0x3948d9,_0x14d4d9)[_0xd68b('0xa')](function(_0x1820ca){logger[_0xd68b('0xb')](_0xd68b('0xc'),_0x41ea06,_0xd68b('0xd'));logger['debug'](_0xd68b('0xe'),_0x41ea06,'request\x20sent',JSON[_0xd68b('0xf')](_0x1820ca));if(_0x1820ca['error']){if(_0x1820ca[_0xd68b('0x10')][_0xd68b('0x11')]===0x1f4){logger[_0xd68b('0x10')](_0xd68b('0xc'),_0x41ea06,_0x1820ca['error'][_0xd68b('0x12')]);return _0x59b942(_0x1820ca['error'][_0xd68b('0x12')]);}logger[_0xd68b('0x10')]('DeskAccount,\x20%s,\x20%s',_0x41ea06,_0x1820ca['error'][_0xd68b('0x12')]);return _0x3e408e(_0x1820ca[_0xd68b('0x10')]['message']);}else{logger[_0xd68b('0xb')]('DeskAccount,\x20%s,\x20%s',_0x41ea06,_0xd68b('0xd'));_0x3e408e(_0x1820ca[_0xd68b('0x13')][_0xd68b('0x12')]);}})['catch'](function(_0x1fc625){logger['error'](_0xd68b('0xc'),_0x41ea06,_0x1fc625);_0x59b942(_0x1fc625);});});}exports['GetDeskAccount']=function(_0x736745){var _0x4dc168=this;return new Promise(function(_0x2170f6,_0x3cc7b8){return db[_0xd68b('0x14')][_0xd68b('0x15')]({'raw':_0x736745[_0xd68b('0x16')]?_0x736745['options']['raw']===undefined?!![]:![]:!![],'where':_0x736745[_0xd68b('0x16')]?_0x736745['options']['where']||null:null,'attributes':_0x736745[_0xd68b('0x16')]?_0x736745[_0xd68b('0x16')][_0xd68b('0x17')]||null:null,'limit':_0x736745['options']?_0x736745[_0xd68b('0x16')][_0xd68b('0x18')]||null:null,'include':_0x736745['options']?_0x736745[_0xd68b('0x16')][_0xd68b('0x19')]?_[_0xd68b('0x1a')](_0x736745[_0xd68b('0x16')]['include'],function(_0x277c5c){return{'model':db[_0x277c5c[_0xd68b('0x1b')]],'as':_0x277c5c['as'],'attributes':_0x277c5c[_0xd68b('0x17')],'include':_0x277c5c['include']?_[_0xd68b('0x1a')](_0x277c5c[_0xd68b('0x19')],function(_0x4c1662){return{'model':db[_0x4c1662['model']],'as':_0x4c1662['as'],'attributes':_0x4c1662[_0xd68b('0x17')],'include':_0x4c1662[_0xd68b('0x19')]?_['map'](_0x4c1662[_0xd68b('0x19')],function(_0x1d1a02){return{'model':db[_0x1d1a02[_0xd68b('0x1b')]],'as':_0x1d1a02['as'],'attributes':_0x1d1a02['attributes']};}):[]};}):[]};}):[]:[]})[_0xd68b('0xa')](function(_0x52a78e){logger[_0xd68b('0xb')](_0xd68b('0x1c'),_0x736745);logger[_0xd68b('0x1d')](_0xd68b('0x1c'),_0x736745,JSON[_0xd68b('0xf')](_0x52a78e));_0x2170f6(_0x52a78e);})['catch'](function(_0x5142dc){logger['error'](_0xd68b('0x1c'),_0x5142dc[_0xd68b('0x12')],_0x736745);_0x3cc7b8(_0x4dc168[_0xd68b('0x10')](0x1f4,_0x5142dc[_0xd68b('0x12')]));});});};exports[_0xd68b('0x1e')]=function(_0x3627bb){var _0x24e2db=this;return new Promise(function(_0x9ee424,_0x1cf083){return db['DeskAccount']['find']({'raw':_0x3627bb[_0xd68b('0x16')]?_0x3627bb[_0xd68b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3627bb['options']?_0x3627bb[_0xd68b('0x16')][_0xd68b('0x1f')]||null:null,'attributes':_0x3627bb[_0xd68b('0x16')]?_0x3627bb[_0xd68b('0x16')]['attributes']||null:null,'include':_0x3627bb[_0xd68b('0x16')]?_0x3627bb['options'][_0xd68b('0x19')]?_[_0xd68b('0x1a')](_0x3627bb[_0xd68b('0x16')]['include'],function(_0x4d0ed0){return{'model':db[_0x4d0ed0[_0xd68b('0x1b')]],'as':_0x4d0ed0['as'],'attributes':_0x4d0ed0[_0xd68b('0x17')],'include':_0x4d0ed0['include']?_['map'](_0x4d0ed0['include'],function(_0x499d31){return{'model':db[_0x499d31['model']],'as':_0x499d31['as'],'attributes':_0x499d31['attributes'],'include':_0x499d31[_0xd68b('0x19')]?_[_0xd68b('0x1a')](_0x499d31[_0xd68b('0x19')],function(_0x38245b){return{'model':db[_0x38245b[_0xd68b('0x1b')]],'as':_0x38245b['as'],'attributes':_0x38245b['attributes']};}):[]};}):[]};}):[]:[]})[_0xd68b('0xa')](function(_0x409c0d){logger['info']('ShowDeskAccount',_0x3627bb);logger[_0xd68b('0x1d')](_0xd68b('0x1e'),_0x3627bb,JSON[_0xd68b('0xf')](_0x409c0d));_0x9ee424(_0x409c0d);})[_0xd68b('0x20')](function(_0x517955){logger[_0xd68b('0x10')](_0xd68b('0x1e'),_0x517955[_0xd68b('0x12')],_0x3627bb);_0x1cf083(_0x24e2db['error'](0x1f4,_0x517955[_0xd68b('0x12')]));});});}; \ No newline at end of file +var _0xcb82=['ShowDeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','raw','options','where','include','map','model','attributes','then'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0xcb82,0xe9));var _0x2cb8=function(_0x5a50d8,_0x313b1c){_0x5a50d8=_0x5a50d8-0x0;var _0x1b5263=_0xcb82[_0x5a50d8];return _0x1b5263;};'use strict';var _=require(_0x2cb8('0x0'));var util=require('util');var moment=require(_0x2cb8('0x1'));var BPromise=require(_0x2cb8('0x2'));var rs=require(_0x2cb8('0x3'));var fs=require('fs');var Redis=require(_0x2cb8('0x4'));var db=require(_0x2cb8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cb8('0x6'))('rpc');var config=require(_0x2cb8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2cb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d29f4,_0x2ea45a,_0x1e1b12){return new BPromise(function(_0x3aa05f,_0x42af01){return client['request'](_0x4d29f4,_0x1e1b12)['then'](function(_0x275b2a){logger[_0x2cb8('0x9')]('DeskAccount,\x20%s,\x20%s',_0x2ea45a,_0x2cb8('0xa'));logger[_0x2cb8('0xb')](_0x2cb8('0xc'),_0x2ea45a,_0x2cb8('0xa'),JSON[_0x2cb8('0xd')](_0x275b2a));if(_0x275b2a[_0x2cb8('0xe')]){if(_0x275b2a[_0x2cb8('0xe')][_0x2cb8('0xf')]===0x1f4){logger[_0x2cb8('0xe')](_0x2cb8('0x10'),_0x2ea45a,_0x275b2a['error'][_0x2cb8('0x11')]);return _0x42af01(_0x275b2a['error'][_0x2cb8('0x11')]);}logger[_0x2cb8('0xe')](_0x2cb8('0x10'),_0x2ea45a,_0x275b2a[_0x2cb8('0xe')][_0x2cb8('0x11')]);return _0x3aa05f(_0x275b2a[_0x2cb8('0xe')][_0x2cb8('0x11')]);}else{logger[_0x2cb8('0x9')]('DeskAccount,\x20%s,\x20%s',_0x2ea45a,_0x2cb8('0xa'));_0x3aa05f(_0x275b2a[_0x2cb8('0x12')][_0x2cb8('0x11')]);}})[_0x2cb8('0x13')](function(_0x2309e9){logger[_0x2cb8('0xe')](_0x2cb8('0x10'),_0x2ea45a,_0x2309e9);_0x42af01(_0x2309e9);});});}exports[_0x2cb8('0x14')]=function(_0x16fe5e){var _0x3f80c4=this;return new Promise(function(_0x47791f,_0x239466){return db[_0x2cb8('0x15')][_0x2cb8('0x16')]({'raw':_0x16fe5e['options']?_0x16fe5e['options'][_0x2cb8('0x17')]===undefined?!![]:![]:!![],'where':_0x16fe5e[_0x2cb8('0x18')]?_0x16fe5e['options'][_0x2cb8('0x19')]||null:null,'attributes':_0x16fe5e[_0x2cb8('0x18')]?_0x16fe5e['options']['attributes']||null:null,'limit':_0x16fe5e[_0x2cb8('0x18')]?_0x16fe5e[_0x2cb8('0x18')]['limit']||null:null,'include':_0x16fe5e['options']?_0x16fe5e[_0x2cb8('0x18')][_0x2cb8('0x1a')]?_[_0x2cb8('0x1b')](_0x16fe5e[_0x2cb8('0x18')][_0x2cb8('0x1a')],function(_0x307e34){return{'model':db[_0x307e34[_0x2cb8('0x1c')]],'as':_0x307e34['as'],'attributes':_0x307e34[_0x2cb8('0x1d')],'include':_0x307e34[_0x2cb8('0x1a')]?_[_0x2cb8('0x1b')](_0x307e34[_0x2cb8('0x1a')],function(_0x2f6aa1){return{'model':db[_0x2f6aa1[_0x2cb8('0x1c')]],'as':_0x2f6aa1['as'],'attributes':_0x2f6aa1[_0x2cb8('0x1d')],'include':_0x2f6aa1[_0x2cb8('0x1a')]?_[_0x2cb8('0x1b')](_0x2f6aa1[_0x2cb8('0x1a')],function(_0x2b82c0){return{'model':db[_0x2b82c0['model']],'as':_0x2b82c0['as'],'attributes':_0x2b82c0[_0x2cb8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2cb8('0x1e')](function(_0x2106b3){logger['info'](_0x2cb8('0x14'),_0x16fe5e);logger[_0x2cb8('0xb')](_0x2cb8('0x14'),_0x16fe5e,JSON['stringify'](_0x2106b3));_0x47791f(_0x2106b3);})['catch'](function(_0x5f4a22){logger[_0x2cb8('0xe')](_0x2cb8('0x14'),_0x5f4a22[_0x2cb8('0x11')],_0x16fe5e);_0x239466(_0x3f80c4[_0x2cb8('0xe')](0x1f4,_0x5f4a22[_0x2cb8('0x11')]));});});};exports[_0x2cb8('0x1f')]=function(_0x4da543){var _0x5e8b3a=this;return new Promise(function(_0x4ba991,_0x2d3644){return db[_0x2cb8('0x15')][_0x2cb8('0x20')]({'raw':_0x4da543['options']?_0x4da543['options']['raw']===undefined?!![]:![]:!![],'where':_0x4da543[_0x2cb8('0x18')]?_0x4da543[_0x2cb8('0x18')][_0x2cb8('0x19')]||null:null,'attributes':_0x4da543[_0x2cb8('0x18')]?_0x4da543[_0x2cb8('0x18')][_0x2cb8('0x1d')]||null:null,'include':_0x4da543[_0x2cb8('0x18')]?_0x4da543[_0x2cb8('0x18')][_0x2cb8('0x1a')]?_['map'](_0x4da543[_0x2cb8('0x18')][_0x2cb8('0x1a')],function(_0x2420cc){return{'model':db[_0x2420cc[_0x2cb8('0x1c')]],'as':_0x2420cc['as'],'attributes':_0x2420cc['attributes'],'include':_0x2420cc[_0x2cb8('0x1a')]?_[_0x2cb8('0x1b')](_0x2420cc['include'],function(_0x11a871){return{'model':db[_0x11a871[_0x2cb8('0x1c')]],'as':_0x11a871['as'],'attributes':_0x11a871[_0x2cb8('0x1d')],'include':_0x11a871['include']?_[_0x2cb8('0x1b')](_0x11a871[_0x2cb8('0x1a')],function(_0x1d44d7){return{'model':db[_0x1d44d7[_0x2cb8('0x1c')]],'as':_0x1d44d7['as'],'attributes':_0x1d44d7[_0x2cb8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fa3a3){logger[_0x2cb8('0x9')](_0x2cb8('0x1f'),_0x4da543);logger[_0x2cb8('0xb')](_0x2cb8('0x1f'),_0x4da543,JSON['stringify'](_0x4fa3a3));_0x4ba991(_0x4fa3a3);})['catch'](function(_0x47fc0f){logger[_0x2cb8('0xe')](_0x2cb8('0x1f'),_0x47fc0f[_0x2cb8('0x11')],_0x4da543);_0x2d3644(_0x5e8b3a[_0x2cb8('0xe')](0x1f4,_0x47fc0f[_0x2cb8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2114831..38b5d30 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a9a0e,_0x3b3a1f){var _0x2d7f97=function(_0x281932){while(--_0x281932){_0x5a9a0e['push'](_0x5a9a0e['shift']());}};_0x2d7f97(++_0x3b3a1f);}(_0x008c,0x188));var _0xc008=function(_0x72cc4f,_0x38df3b){_0x72cc4f=_0x72cc4f-0x0;var _0x3c14d5=_0x008c[_0x72cc4f];return _0x3c14d5;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0xe405bd,_0x200bc3){var _0x269fff=function(_0x49080e){while(--_0x49080e){_0xe405bd['push'](_0xe405bd['shift']());}};_0x269fff(++_0x200bc3);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index fdd4cc0..83b656a 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 _0xe5f9=['exports','STRING','sequelize'];(function(_0x76c5c7,_0x3feb64){var _0x323ba9=function(_0x52a05f){while(--_0x52a05f){_0x76c5c7['push'](_0x76c5c7['shift']());}};_0x323ba9(++_0x3feb64);}(_0xe5f9,0x8c));var _0x9e5f=function(_0x18a813,_0x391eb9){_0x18a813=_0x18a813-0x0;var _0xcafafc=_0xe5f9[_0x18a813];return _0xcafafc;};'use strict';var Sequelize=require(_0x9e5f('0x0'));module[_0x9e5f('0x1')]={'name':{'type':Sequelize[_0x9e5f('0x2')]},'description':{'type':Sequelize[_0x9e5f('0x2')]}}; \ No newline at end of file +var _0x1dce=['sequelize','STRING'];(function(_0x36288c,_0x13a5ae){var _0x24fb77=function(_0x152faa){while(--_0x152faa){_0x36288c['push'](_0x36288c['shift']());}};_0x24fb77(++_0x13a5ae);}(_0x1dce,0xfa));var _0xe1dc=function(_0x2103e1,_0x4c706e){_0x2103e1=_0x2103e1-0x0;var _0x56af92=_0x1dce[_0x2103e1];return _0x56af92;};'use strict';var Sequelize=require(_0xe1dc('0x0'));module['exports']={'name':{'type':Sequelize[_0xe1dc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 08494db..82fab66 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 _0x4585=['save','then','sendStatus','error','stack','name','send','index','DeskConfiguration','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','update','destroy','getFields','findOne','DeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x5c63dd,_0x47fe21){var _0xd44abd=function(_0x204fc5){while(--_0x204fc5){_0x5c63dd['push'](_0x5c63dd['shift']());}};_0xd44abd(++_0x47fe21);}(_0x4585,0x18c));var _0x5458=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4585[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x5458('0x0'));var rimraf=require(_0x5458('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5458('0x2'));var rp=require(_0x5458('0x3'));var moment=require('moment');var BPromise=require(_0x5458('0x4'));var Mustache=require(_0x5458('0x5'));var util=require(_0x5458('0x6'));var path=require(_0x5458('0x7'));var sox=require(_0x5458('0x8'));var csv=require(_0x5458('0x9'));var ejs=require(_0x5458('0xa'));var fs=require('fs');var fs_extra=require(_0x5458('0xb'));var _=require(_0x5458('0xc'));var squel=require(_0x5458('0xd'));var crypto=require('crypto');var jsforce=require(_0x5458('0xe'));var deskjs=require(_0x5458('0xf'));var toCsv=require(_0x5458('0x9'));var querystring=require(_0x5458('0x10'));var Papa=require(_0x5458('0x11'));var Redis=require(_0x5458('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5458('0x13'));var as=require(_0x5458('0x14'));var hardwareService=require(_0x5458('0x15'));var logger=require(_0x5458('0x16'))(_0x5458('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5458('0x18'));var db=require(_0x5458('0x19'))['db'];function respondWithStatusCode(_0x1429a0,_0x1abb0b){_0x1abb0b=_0x1abb0b||0xcc;return function(_0xe61b13){if(_0xe61b13){return _0x1429a0['sendStatus'](_0x1abb0b);}return _0x1429a0['status'](_0x1abb0b)['end']();};}function respondWithResult(_0x832ef6,_0x2d9977){_0x2d9977=_0x2d9977||0xc8;return function(_0x412ab9){if(_0x412ab9){return _0x832ef6[_0x5458('0x1a')](_0x2d9977)['json'](_0x412ab9);}};}function respondWithFilteredResult(_0xbdca1b,_0x112624){return function(_0x48f7a4){if(_0x48f7a4){var _0xd517d2=typeof _0x112624[_0x5458('0x1b')]===_0x5458('0x1c')&&typeof _0x112624['limit']===_0x5458('0x1c');var _0x3199e8=_0x48f7a4[_0x5458('0x1d')];var _0x3d05ea=_0xd517d2?0x0:_0x112624[_0x5458('0x1b')];var _0x4f290b=_0xd517d2?_0x48f7a4[_0x5458('0x1d')]:_0x112624[_0x5458('0x1b')]+_0x112624['limit'];var _0x4b6e33;if(_0x4f290b>=_0x3199e8){_0x4f290b=_0x3199e8;_0x4b6e33=0xc8;}else{_0x4b6e33=0xce;}_0xbdca1b[_0x5458('0x1a')](_0x4b6e33);return _0xbdca1b[_0x5458('0x1e')](_0x5458('0x1f'),_0x3d05ea+'-'+_0x4f290b+'/'+_0x3199e8)['json'](_0x48f7a4);}return null;};}function patchUpdates(_0x32af75){return function(_0x5f17ac){try{jsonpatch[_0x5458('0x20')](_0x5f17ac,_0x32af75,!![]);}catch(_0x1fa3eb){return BPromise[_0x5458('0x21')](_0x1fa3eb);}return _0x5f17ac[_0x5458('0x22')]();};}function saveUpdates(_0x160717,_0x56f781){return function(_0x1c2d53){if(_0x1c2d53){return _0x1c2d53['update'](_0x160717)[_0x5458('0x23')](function(_0x2e3d2a){return _0x2e3d2a;});}return null;};}function removeEntity(_0x5b0f6f,_0x445e52){return function(_0x143f6d){if(_0x143f6d){return _0x143f6d['destroy']()[_0x5458('0x23')](function(){_0x5b0f6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dce87,_0x309229){return function(_0x282be8){if(!_0x282be8){_0x3dce87[_0x5458('0x24')](0x194);}return _0x282be8;};}function handleError(_0x17a7a1,_0x2aed9e){_0x2aed9e=_0x2aed9e||0x1f4;return function(_0x1ceb19){logger[_0x5458('0x25')](_0x1ceb19[_0x5458('0x26')]);if(_0x1ceb19[_0x5458('0x27')]){delete _0x1ceb19[_0x5458('0x27')];}_0x17a7a1[_0x5458('0x1a')](_0x2aed9e)[_0x5458('0x28')](_0x1ceb19);};}exports[_0x5458('0x29')]=function(_0xe94dc6,_0x6298c5){var _0x3e7f91={},_0x32a5a0={},_0x2bc1e1={'count':0x0,'rows':[]};var _0x27f0d4=_['map'](db[_0x5458('0x2a')]['rawAttributes'],function(_0x20347b){return{'name':_0x20347b[_0x5458('0x2b')],'type':_0x20347b[_0x5458('0x2c')][_0x5458('0x2d')]};});_0x32a5a0[_0x5458('0x2e')]=_['map'](_0x27f0d4,'name');_0x32a5a0['query']=_[_0x5458('0x2f')](_0xe94dc6[_0x5458('0x30')]);_0x32a5a0[_0x5458('0x31')]=_[_0x5458('0x32')](_0x32a5a0[_0x5458('0x2e')],_0x32a5a0[_0x5458('0x30')]);_0x3e7f91['attributes']=_[_0x5458('0x32')](_0x32a5a0[_0x5458('0x2e')],qs[_0x5458('0x33')](_0xe94dc6[_0x5458('0x30')][_0x5458('0x33')]));_0x3e7f91[_0x5458('0x34')]=_0x3e7f91[_0x5458('0x34')][_0x5458('0x35')]?_0x3e7f91[_0x5458('0x34')]:_0x32a5a0[_0x5458('0x2e')];if(!_0xe94dc6[_0x5458('0x30')][_0x5458('0x36')]('nolimit')){_0x3e7f91[_0x5458('0x37')]=qs[_0x5458('0x37')](_0xe94dc6[_0x5458('0x30')][_0x5458('0x37')]);_0x3e7f91[_0x5458('0x1b')]=qs[_0x5458('0x1b')](_0xe94dc6[_0x5458('0x30')]['offset']);}_0x3e7f91['order']=qs[_0x5458('0x38')](_0xe94dc6['query'][_0x5458('0x38')]);_0x3e7f91[_0x5458('0x39')]=qs[_0x5458('0x31')](_[_0x5458('0x3a')](_0xe94dc6[_0x5458('0x30')],_0x32a5a0['filters']),_0x27f0d4);if(_0xe94dc6[_0x5458('0x30')][_0x5458('0x3b')]){_0x3e7f91[_0x5458('0x39')]=_[_0x5458('0x3c')](_0x3e7f91[_0x5458('0x39')],{'$or':_[_0x5458('0x3d')](_0x27f0d4,function(_0x3cdd08){if(_0x3cdd08[_0x5458('0x2c')]!=='VIRTUAL'){var _0x2e96f3={};_0x2e96f3[_0x3cdd08[_0x5458('0x27')]]={'$like':'%'+_0xe94dc6['query']['filter']+'%'};return _0x2e96f3;}})});}_0x3e7f91=_['merge']({},_0x3e7f91,_0xe94dc6['options']);var _0x39b12a={'where':_0x3e7f91['where']};return db['DeskConfiguration'][_0x5458('0x1d')](_0x39b12a)[_0x5458('0x23')](function(_0x5a5db1){_0x2bc1e1[_0x5458('0x1d')]=_0x5a5db1;if(_0xe94dc6['query'][_0x5458('0x3e')]){_0x3e7f91[_0x5458('0x3f')]=[{'all':!![]}];}return db[_0x5458('0x2a')]['findAll'](_0x3e7f91);})['then'](function(_0x210d95){_0x2bc1e1[_0x5458('0x40')]=_0x210d95;return _0x2bc1e1;})[_0x5458('0x23')](respondWithFilteredResult(_0x6298c5,_0x3e7f91))[_0x5458('0x41')](handleError(_0x6298c5,null));};exports[_0x5458('0x42')]=function(_0x520add,_0x13706c){var _0x4b9828={'raw':![],'where':{'id':_0x520add[_0x5458('0x43')]['id']}},_0x3cb243={};_0x3cb243[_0x5458('0x2e')]=_[_0x5458('0x2f')](db['DeskConfiguration'][_0x5458('0x44')]);_0x3cb243[_0x5458('0x30')]=_[_0x5458('0x2f')](_0x520add[_0x5458('0x30')]);_0x3cb243[_0x5458('0x31')]=_['intersection'](_0x3cb243[_0x5458('0x2e')],_0x3cb243[_0x5458('0x30')]);_0x4b9828[_0x5458('0x34')]=_[_0x5458('0x32')](_0x3cb243['model'],qs[_0x5458('0x33')](_0x520add[_0x5458('0x30')][_0x5458('0x33')]));_0x4b9828[_0x5458('0x34')]=_0x4b9828['attributes'][_0x5458('0x35')]?_0x4b9828[_0x5458('0x34')]:_0x3cb243['model'];if(_0x520add[_0x5458('0x30')]['includeAll']){_0x4b9828[_0x5458('0x3f')]=[{'all':!![]}];}_0x4b9828=_[_0x5458('0x3c')]({},_0x4b9828,_0x520add[_0x5458('0x45')]);return db['DeskConfiguration'][_0x5458('0x46')](_0x4b9828)['then'](handleEntityNotFound(_0x13706c,null))[_0x5458('0x23')](respondWithResult(_0x13706c,null))['catch'](handleError(_0x13706c,null));};exports[_0x5458('0x47')]=function(_0x1298ba,_0x41b99a){return db['DeskConfiguration'][_0x5458('0x47')](_0x1298ba[_0x5458('0x48')],{})['then'](respondWithResult(_0x41b99a,0xc9))[_0x5458('0x41')](handleError(_0x41b99a,null));};exports[_0x5458('0x49')]=function(_0x5f2aab,_0x58dd8e){if(_0x5f2aab['body']['id']){delete _0x5f2aab['body']['id'];}return db[_0x5458('0x2a')]['find']({'where':{'id':_0x5f2aab['params']['id']}})['then'](handleEntityNotFound(_0x58dd8e,null))[_0x5458('0x23')](saveUpdates(_0x5f2aab['body'],null))[_0x5458('0x23')](respondWithResult(_0x58dd8e,null))[_0x5458('0x41')](handleError(_0x58dd8e,null));};exports[_0x5458('0x4a')]=function(_0x49b26c,_0x28102d){return db[_0x5458('0x2a')][_0x5458('0x46')]({'where':{'id':_0x49b26c[_0x5458('0x43')]['id']}})['then'](handleEntityNotFound(_0x28102d,null))[_0x5458('0x23')](removeEntity(_0x28102d,null))['catch'](handleError(_0x28102d,null));};exports[_0x5458('0x4b')]=function(_0x1327d9,_0x19ae30,_0x3f5a49){var _0x2632e8={};var _0x5342a9={};var _0x2d5d73;var _0x4c18ee;return db[_0x5458('0x2a')][_0x5458('0x4c')]({'where':{'id':_0x1327d9['params']['id']}})['then'](handleEntityNotFound(_0x19ae30,null))[_0x5458('0x23')](function(_0x349f4a){if(_0x349f4a){_0x2d5d73=_0x349f4a;_0x5342a9['model']=_[_0x5458('0x2f')](db[_0x5458('0x4d')][_0x5458('0x44')]);_0x5342a9[_0x5458('0x30')]=_[_0x5458('0x2f')](_0x1327d9[_0x5458('0x30')]);_0x5342a9[_0x5458('0x31')]=_[_0x5458('0x32')](_0x5342a9['model'],_0x5342a9['query']);_0x2632e8[_0x5458('0x34')]=_[_0x5458('0x32')](_0x5342a9[_0x5458('0x2e')],qs[_0x5458('0x33')](_0x1327d9[_0x5458('0x30')]['fields']));_0x2632e8['attributes']=_0x2632e8[_0x5458('0x34')][_0x5458('0x35')]?_0x2632e8['attributes']:_0x5342a9[_0x5458('0x2e')];_0x2632e8[_0x5458('0x4e')]=qs[_0x5458('0x38')](_0x1327d9[_0x5458('0x30')][_0x5458('0x38')]);_0x2632e8[_0x5458('0x39')]=qs[_0x5458('0x31')](_[_0x5458('0x3a')](_0x1327d9['query'],_0x5342a9['filters']));if(_0x1327d9[_0x5458('0x30')][_0x5458('0x3b')]){_0x2632e8[_0x5458('0x39')]=_['merge'](_0x2632e8[_0x5458('0x39')],{'$or':_[_0x5458('0x3d')](_0x2632e8[_0x5458('0x34')],function(_0x503caa){var _0x122b84={};_0x122b84[_0x503caa]={'$like':'%'+_0x1327d9['query'][_0x5458('0x3b')]+'%'};return _0x122b84;})});}_0x2632e8=_['merge']({},_0x2632e8,_0x1327d9[_0x5458('0x45')]);return _0x2d5d73[_0x5458('0x4b')](_0x2632e8);}})['then'](function(_0x1ae7e6){if(_0x1ae7e6){_0x4c18ee=_0x1ae7e6[_0x5458('0x35')];if(!_0x1327d9[_0x5458('0x30')]['hasOwnProperty'](_0x5458('0x4f'))){_0x2632e8[_0x5458('0x37')]=qs[_0x5458('0x37')](_0x1327d9[_0x5458('0x30')][_0x5458('0x37')]);_0x2632e8[_0x5458('0x1b')]=qs['offset'](_0x1327d9[_0x5458('0x30')][_0x5458('0x1b')]);}return _0x2d5d73[_0x5458('0x4b')](_0x2632e8);}})['then'](function(_0x5b7cd0){if(_0x5b7cd0){return _0x5b7cd0?{'count':_0x4c18ee,'rows':_0x5b7cd0}:null;}})[_0x5458('0x23')](respondWithResult(_0x19ae30,null))['catch'](handleError(_0x19ae30,null));};exports['getSubjects']=function(_0x26d764,_0xa4397e,_0x834e7c){var _0x3e0a90={};var _0x211085={};var _0x134618;var _0x4146b6;return db[_0x5458('0x2a')][_0x5458('0x4c')]({'where':{'id':_0x26d764[_0x5458('0x43')]['id']}})[_0x5458('0x23')](handleEntityNotFound(_0xa4397e,null))['then'](function(_0x34f9d6){if(_0x34f9d6){_0x134618=_0x34f9d6;_0x211085[_0x5458('0x2e')]=_['keys'](db[_0x5458('0x4d')][_0x5458('0x44')]);_0x211085['query']=_[_0x5458('0x2f')](_0x26d764[_0x5458('0x30')]);_0x211085[_0x5458('0x31')]=_[_0x5458('0x32')](_0x211085[_0x5458('0x2e')],_0x211085[_0x5458('0x30')]);_0x3e0a90['attributes']=_[_0x5458('0x32')](_0x211085[_0x5458('0x2e')],qs[_0x5458('0x33')](_0x26d764[_0x5458('0x30')]['fields']));_0x3e0a90[_0x5458('0x34')]=_0x3e0a90[_0x5458('0x34')]['length']?_0x3e0a90[_0x5458('0x34')]:_0x211085[_0x5458('0x2e')];_0x3e0a90['order']=qs[_0x5458('0x38')](_0x26d764['query'][_0x5458('0x38')]);_0x3e0a90[_0x5458('0x39')]=qs[_0x5458('0x31')](_[_0x5458('0x3a')](_0x26d764[_0x5458('0x30')],_0x211085[_0x5458('0x31')]));if(_0x26d764[_0x5458('0x30')]['filter']){_0x3e0a90[_0x5458('0x39')]=_[_0x5458('0x3c')](_0x3e0a90[_0x5458('0x39')],{'$or':_[_0x5458('0x3d')](_0x3e0a90[_0x5458('0x34')],function(_0x256692){var _0x57056e={};_0x57056e[_0x256692]={'$like':'%'+_0x26d764[_0x5458('0x30')][_0x5458('0x3b')]+'%'};return _0x57056e;})});}_0x3e0a90=_['merge']({},_0x3e0a90,_0x26d764[_0x5458('0x45')]);return _0x134618[_0x5458('0x50')](_0x3e0a90);}})[_0x5458('0x23')](function(_0x25db69){if(_0x25db69){_0x4146b6=_0x25db69['length'];if(!_0x26d764['query'][_0x5458('0x36')](_0x5458('0x4f'))){_0x3e0a90[_0x5458('0x37')]=qs[_0x5458('0x37')](_0x26d764[_0x5458('0x30')]['limit']);_0x3e0a90['offset']=qs['offset'](_0x26d764[_0x5458('0x30')][_0x5458('0x1b')]);}return _0x134618['getSubjects'](_0x3e0a90);}})[_0x5458('0x23')](function(_0x5d716d){if(_0x5d716d){return _0x5d716d?{'count':_0x4146b6,'rows':_0x5d716d}:null;}})[_0x5458('0x23')](respondWithResult(_0xa4397e,null))['catch'](handleError(_0xa4397e,null));};exports[_0x5458('0x51')]=function(_0x35eec9,_0xc08f77,_0x374d0b){var _0x3c32f9={};var _0x2d38c1={};var _0x453522;var _0x289580;return db[_0x5458('0x2a')][_0x5458('0x4c')]({'where':{'id':_0x35eec9['params']['id']}})['then'](handleEntityNotFound(_0xc08f77,null))['then'](function(_0x1ea817){if(_0x1ea817){_0x453522=_0x1ea817;_0x2d38c1[_0x5458('0x2e')]=_[_0x5458('0x2f')](db[_0x5458('0x4d')][_0x5458('0x44')]);_0x2d38c1[_0x5458('0x30')]=_[_0x5458('0x2f')](_0x35eec9[_0x5458('0x30')]);_0x2d38c1[_0x5458('0x31')]=_[_0x5458('0x32')](_0x2d38c1['model'],_0x2d38c1[_0x5458('0x30')]);_0x3c32f9[_0x5458('0x34')]=_['intersection'](_0x2d38c1[_0x5458('0x2e')],qs[_0x5458('0x33')](_0x35eec9[_0x5458('0x30')][_0x5458('0x33')]));_0x3c32f9['attributes']=_0x3c32f9['attributes'][_0x5458('0x35')]?_0x3c32f9[_0x5458('0x34')]:_0x2d38c1[_0x5458('0x2e')];_0x3c32f9[_0x5458('0x4e')]=qs[_0x5458('0x38')](_0x35eec9[_0x5458('0x30')][_0x5458('0x38')]);_0x3c32f9[_0x5458('0x39')]=qs[_0x5458('0x31')](_['pick'](_0x35eec9[_0x5458('0x30')],_0x2d38c1['filters']));if(_0x35eec9[_0x5458('0x30')][_0x5458('0x3b')]){_0x3c32f9['where']=_[_0x5458('0x3c')](_0x3c32f9['where'],{'$or':_[_0x5458('0x3d')](_0x3c32f9[_0x5458('0x34')],function(_0x340b96){var _0x3aec3b={};_0x3aec3b[_0x340b96]={'$like':'%'+_0x35eec9['query']['filter']+'%'};return _0x3aec3b;})});}_0x3c32f9=_[_0x5458('0x3c')]({},_0x3c32f9,_0x35eec9[_0x5458('0x45')]);return _0x453522[_0x5458('0x51')](_0x3c32f9);}})['then'](function(_0x42254e){if(_0x42254e){_0x289580=_0x42254e['length'];if(!_0x35eec9[_0x5458('0x30')][_0x5458('0x36')](_0x5458('0x4f'))){_0x3c32f9[_0x5458('0x37')]=qs[_0x5458('0x37')](_0x35eec9[_0x5458('0x30')][_0x5458('0x37')]);_0x3c32f9[_0x5458('0x1b')]=qs[_0x5458('0x1b')](_0x35eec9[_0x5458('0x30')]['offset']);}return _0x453522[_0x5458('0x51')](_0x3c32f9);}})[_0x5458('0x23')](function(_0x3e8498){if(_0x3e8498){return _0x3e8498?{'count':_0x289580,'rows':_0x3e8498}:null;}})[_0x5458('0x23')](respondWithResult(_0xc08f77,null))[_0x5458('0x41')](handleError(_0xc08f77,null));};exports[_0x5458('0x52')]=function(_0x43ae26,_0xe0b607,_0x51f9d9){var _0xba1ff0={};var _0x274dd9={};var _0x19dcad;var _0x42fb9d;return db[_0x5458('0x2a')][_0x5458('0x4c')]({'where':{'id':_0x43ae26['params']['id']}})[_0x5458('0x23')](handleEntityNotFound(_0xe0b607,null))[_0x5458('0x23')](function(_0x17960e){if(_0x17960e){_0x19dcad=_0x17960e;_0x274dd9[_0x5458('0x2e')]=_['keys'](db[_0x5458('0x53')][_0x5458('0x44')]);_0x274dd9[_0x5458('0x30')]=_[_0x5458('0x2f')](_0x43ae26[_0x5458('0x30')]);_0x274dd9[_0x5458('0x31')]=_[_0x5458('0x32')](_0x274dd9[_0x5458('0x2e')],_0x274dd9[_0x5458('0x30')]);_0xba1ff0[_0x5458('0x34')]=_[_0x5458('0x32')](_0x274dd9[_0x5458('0x2e')],qs[_0x5458('0x33')](_0x43ae26[_0x5458('0x30')][_0x5458('0x33')]));_0xba1ff0[_0x5458('0x34')]=_0xba1ff0[_0x5458('0x34')][_0x5458('0x35')]?_0xba1ff0[_0x5458('0x34')]:_0x274dd9[_0x5458('0x2e')];_0xba1ff0[_0x5458('0x4e')]=qs[_0x5458('0x38')](_0x43ae26['query'][_0x5458('0x38')]);_0xba1ff0[_0x5458('0x39')]=qs[_0x5458('0x31')](_['pick'](_0x43ae26[_0x5458('0x30')],_0x274dd9[_0x5458('0x31')]));if(_0x43ae26['query'][_0x5458('0x3b')]){_0xba1ff0[_0x5458('0x39')]=_[_0x5458('0x3c')](_0xba1ff0[_0x5458('0x39')],{'$or':_['map'](_0xba1ff0['attributes'],function(_0x3db98a){var _0x4f40ff={};_0x4f40ff[_0x3db98a]={'$like':'%'+_0x43ae26[_0x5458('0x30')][_0x5458('0x3b')]+'%'};return _0x4f40ff;})});}_0xba1ff0=_['merge']({},_0xba1ff0,_0x43ae26[_0x5458('0x45')]);return _0x19dcad[_0x5458('0x52')](_0xba1ff0);}})[_0x5458('0x23')](function(_0x25d23c){if(_0x25d23c){_0x42fb9d=_0x25d23c['length'];if(!_0x43ae26[_0x5458('0x30')][_0x5458('0x36')]('nolimit')){_0xba1ff0['limit']=qs[_0x5458('0x37')](_0x43ae26[_0x5458('0x30')][_0x5458('0x37')]);_0xba1ff0[_0x5458('0x1b')]=qs[_0x5458('0x1b')](_0x43ae26[_0x5458('0x30')]['offset']);}return _0x19dcad['getTags'](_0xba1ff0);}})[_0x5458('0x23')](function(_0x5aa8c5){if(_0x5aa8c5){return _0x5aa8c5?{'count':_0x42fb9d,'rows':_0x5aa8c5}:null;}})[_0x5458('0x23')](respondWithResult(_0xe0b607,null))[_0x5458('0x41')](handleError(_0xe0b607,null));};exports[_0x5458('0x54')]=function(_0x368a5b,_0x981850,_0x4a11f5){if(_0x368a5b[_0x5458('0x48')]['id']){delete _0x368a5b[_0x5458('0x48')]['id'];}return db[_0x5458('0x2a')][_0x5458('0x4c')]({'where':{'id':_0x368a5b['params']['id']}})['then'](handleEntityNotFound(_0x981850,null))[_0x5458('0x23')](function(_0x516f36){if(_0x516f36){return _0x516f36[_0x5458('0x54')](_0x368a5b[_0x5458('0x48')][_0x5458('0x55')]||[]);}return null;})[_0x5458('0x23')](respondWithResult(_0x981850,null))[_0x5458('0x41')](handleError(_0x981850,null));}; \ No newline at end of file +var _0x6891=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','getFields','findOne','rawAttributes','order','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2d8b1a,_0x8d00aa){var _0x41fddf=function(_0x50c0bd){while(--_0x50c0bd){_0x2d8b1a['push'](_0x2d8b1a['shift']());}};_0x41fddf(++_0x8d00aa);}(_0x6891,0x122));var _0x1689=function(_0x1dd7d8,_0x9ba9c9){_0x1dd7d8=_0x1dd7d8-0x0;var _0x81acc9=_0x6891[_0x1dd7d8];return _0x81acc9;};'use strict';var emlformat=require(_0x1689('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1689('0x1'));var jsonpatch=require(_0x1689('0x2'));var rp=require(_0x1689('0x3'));var moment=require(_0x1689('0x4'));var BPromise=require(_0x1689('0x5'));var Mustache=require('mustache');var util=require(_0x1689('0x6'));var path=require(_0x1689('0x7'));var sox=require(_0x1689('0x8'));var csv=require(_0x1689('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1689('0xa'));var _=require(_0x1689('0xb'));var squel=require(_0x1689('0xc'));var crypto=require(_0x1689('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1689('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1689('0xf'));var Papa=require(_0x1689('0x10'));var Redis=require(_0x1689('0x11'));var authService=require(_0x1689('0x12'));var qs=require(_0x1689('0x13'));var as=require(_0x1689('0x14'));var hardwareService=require(_0x1689('0x15'));var logger=require(_0x1689('0x16'))('api');var utils=require(_0x1689('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1689('0x18'));var db=require(_0x1689('0x19'))['db'];function respondWithStatusCode(_0x52b844,_0x2ad491){_0x2ad491=_0x2ad491||0xcc;return function(_0x5b6ba7){if(_0x5b6ba7){return _0x52b844[_0x1689('0x1a')](_0x2ad491);}return _0x52b844[_0x1689('0x1b')](_0x2ad491)[_0x1689('0x1c')]();};}function respondWithResult(_0x45780c,_0x49fd54){_0x49fd54=_0x49fd54||0xc8;return function(_0x5befc1){if(_0x5befc1){return _0x45780c[_0x1689('0x1b')](_0x49fd54)[_0x1689('0x1d')](_0x5befc1);}};}function respondWithFilteredResult(_0x5a9784,_0x2a2f1c){return function(_0x2ae68b){if(_0x2ae68b){var _0x944566=typeof _0x2a2f1c[_0x1689('0x1e')]===_0x1689('0x1f')&&typeof _0x2a2f1c[_0x1689('0x20')]===_0x1689('0x1f');var _0x4b7b5e=_0x2ae68b[_0x1689('0x21')];var _0x1b73ad=_0x944566?0x0:_0x2a2f1c[_0x1689('0x1e')];var _0x3e14c5=_0x944566?_0x2ae68b[_0x1689('0x21')]:_0x2a2f1c['offset']+_0x2a2f1c[_0x1689('0x20')];var _0xff4533;if(_0x3e14c5>=_0x4b7b5e){_0x3e14c5=_0x4b7b5e;_0xff4533=0xc8;}else{_0xff4533=0xce;}_0x5a9784[_0x1689('0x1b')](_0xff4533);return _0x5a9784['set']('Content-Range',_0x1b73ad+'-'+_0x3e14c5+'/'+_0x4b7b5e)[_0x1689('0x1d')](_0x2ae68b);}return null;};}function patchUpdates(_0x25e533){return function(_0x27ab23){try{jsonpatch[_0x1689('0x22')](_0x27ab23,_0x25e533,!![]);}catch(_0x5ba884){return BPromise[_0x1689('0x23')](_0x5ba884);}return _0x27ab23[_0x1689('0x24')]();};}function saveUpdates(_0x4a7e79,_0xcf211e){return function(_0x357196){if(_0x357196){return _0x357196['update'](_0x4a7e79)[_0x1689('0x25')](function(_0xd62561){return _0xd62561;});}return null;};}function removeEntity(_0x55a213,_0x1bc82a){return function(_0x504dca){if(_0x504dca){return _0x504dca[_0x1689('0x26')]()['then'](function(){_0x55a213[_0x1689('0x1b')](0xcc)[_0x1689('0x1c')]();});}};}function handleEntityNotFound(_0x3c6404,_0x3da34c){return function(_0x46bdc0){if(!_0x46bdc0){_0x3c6404[_0x1689('0x1a')](0x194);}return _0x46bdc0;};}function handleError(_0xaf1e66,_0x4d06d8){_0x4d06d8=_0x4d06d8||0x1f4;return function(_0x15288b){logger[_0x1689('0x27')](_0x15288b[_0x1689('0x28')]);if(_0x15288b[_0x1689('0x29')]){delete _0x15288b[_0x1689('0x29')];}_0xaf1e66[_0x1689('0x1b')](_0x4d06d8)['send'](_0x15288b);};}exports['index']=function(_0x47034a,_0x37f156){var _0x51e77c={},_0x545b5a={},_0x1a3bd7={'count':0x0,'rows':[]};var _0x40ee62=_[_0x1689('0x2a')](db[_0x1689('0x2b')]['rawAttributes'],function(_0x8db1e4){return{'name':_0x8db1e4[_0x1689('0x2c')],'type':_0x8db1e4[_0x1689('0x2d')][_0x1689('0x2e')]};});_0x545b5a[_0x1689('0x2f')]=_[_0x1689('0x2a')](_0x40ee62,_0x1689('0x29'));_0x545b5a[_0x1689('0x30')]=_[_0x1689('0x31')](_0x47034a[_0x1689('0x30')]);_0x545b5a[_0x1689('0x32')]=_[_0x1689('0x33')](_0x545b5a[_0x1689('0x2f')],_0x545b5a[_0x1689('0x30')]);_0x51e77c[_0x1689('0x34')]=_[_0x1689('0x33')](_0x545b5a[_0x1689('0x2f')],qs[_0x1689('0x35')](_0x47034a[_0x1689('0x30')][_0x1689('0x35')]));_0x51e77c[_0x1689('0x34')]=_0x51e77c[_0x1689('0x34')][_0x1689('0x36')]?_0x51e77c[_0x1689('0x34')]:_0x545b5a[_0x1689('0x2f')];if(!_0x47034a[_0x1689('0x30')][_0x1689('0x37')](_0x1689('0x38'))){_0x51e77c[_0x1689('0x20')]=qs['limit'](_0x47034a[_0x1689('0x30')][_0x1689('0x20')]);_0x51e77c[_0x1689('0x1e')]=qs[_0x1689('0x1e')](_0x47034a[_0x1689('0x30')][_0x1689('0x1e')]);}_0x51e77c['order']=qs[_0x1689('0x39')](_0x47034a['query']['sort']);_0x51e77c[_0x1689('0x3a')]=qs[_0x1689('0x32')](_[_0x1689('0x3b')](_0x47034a[_0x1689('0x30')],_0x545b5a[_0x1689('0x32')]),_0x40ee62);if(_0x47034a[_0x1689('0x30')]['filter']){_0x51e77c[_0x1689('0x3a')]=_[_0x1689('0x3c')](_0x51e77c['where'],{'$or':_[_0x1689('0x2a')](_0x40ee62,function(_0x3c1c39){if(_0x3c1c39[_0x1689('0x2d')]!==_0x1689('0x3d')){var _0x3459df={};_0x3459df[_0x3c1c39[_0x1689('0x29')]]={'$like':'%'+_0x47034a['query'][_0x1689('0x3e')]+'%'};return _0x3459df;}})});}_0x51e77c=_[_0x1689('0x3c')]({},_0x51e77c,_0x47034a[_0x1689('0x3f')]);var _0x59fb25={'where':_0x51e77c[_0x1689('0x3a')]};return db[_0x1689('0x2b')]['count'](_0x59fb25)[_0x1689('0x25')](function(_0x2bf228){_0x1a3bd7[_0x1689('0x21')]=_0x2bf228;if(_0x47034a['query'][_0x1689('0x40')]){_0x51e77c[_0x1689('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x1689('0x42')](_0x51e77c);})[_0x1689('0x25')](function(_0x2c597b){_0x1a3bd7[_0x1689('0x43')]=_0x2c597b;return _0x1a3bd7;})[_0x1689('0x25')](respondWithFilteredResult(_0x37f156,_0x51e77c))[_0x1689('0x44')](handleError(_0x37f156,null));};exports[_0x1689('0x45')]=function(_0x3d1e8c,_0xcd2fd2){var _0x13dc87={'raw':![],'where':{'id':_0x3d1e8c['params']['id']}},_0x18ea41={};_0x18ea41[_0x1689('0x2f')]=_[_0x1689('0x31')](db[_0x1689('0x2b')]['rawAttributes']);_0x18ea41[_0x1689('0x30')]=_[_0x1689('0x31')](_0x3d1e8c['query']);_0x18ea41['filters']=_['intersection'](_0x18ea41[_0x1689('0x2f')],_0x18ea41[_0x1689('0x30')]);_0x13dc87['attributes']=_[_0x1689('0x33')](_0x18ea41[_0x1689('0x2f')],qs[_0x1689('0x35')](_0x3d1e8c['query'][_0x1689('0x35')]));_0x13dc87[_0x1689('0x34')]=_0x13dc87[_0x1689('0x34')][_0x1689('0x36')]?_0x13dc87['attributes']:_0x18ea41[_0x1689('0x2f')];if(_0x3d1e8c['query'][_0x1689('0x40')]){_0x13dc87[_0x1689('0x41')]=[{'all':!![]}];}_0x13dc87=_[_0x1689('0x3c')]({},_0x13dc87,_0x3d1e8c[_0x1689('0x3f')]);return db[_0x1689('0x2b')][_0x1689('0x46')](_0x13dc87)[_0x1689('0x25')](handleEntityNotFound(_0xcd2fd2,null))[_0x1689('0x25')](respondWithResult(_0xcd2fd2,null))[_0x1689('0x44')](handleError(_0xcd2fd2,null));};exports['create']=function(_0x38e7ba,_0xcc21c){return db['DeskConfiguration'][_0x1689('0x47')](_0x38e7ba[_0x1689('0x48')],{})['then'](respondWithResult(_0xcc21c,0xc9))[_0x1689('0x44')](handleError(_0xcc21c,null));};exports[_0x1689('0x49')]=function(_0x5a07e6,_0x35f8ff){if(_0x5a07e6[_0x1689('0x48')]['id']){delete _0x5a07e6[_0x1689('0x48')]['id'];}return db[_0x1689('0x2b')][_0x1689('0x46')]({'where':{'id':_0x5a07e6[_0x1689('0x4a')]['id']}})[_0x1689('0x25')](handleEntityNotFound(_0x35f8ff,null))[_0x1689('0x25')](saveUpdates(_0x5a07e6[_0x1689('0x48')],null))['then'](respondWithResult(_0x35f8ff,null))[_0x1689('0x44')](handleError(_0x35f8ff,null));};exports[_0x1689('0x26')]=function(_0x4a71e8,_0x4f1ecf){return db[_0x1689('0x2b')][_0x1689('0x46')]({'where':{'id':_0x4a71e8['params']['id']}})[_0x1689('0x25')](handleEntityNotFound(_0x4f1ecf,null))[_0x1689('0x25')](removeEntity(_0x4f1ecf,null))['catch'](handleError(_0x4f1ecf,null));};exports[_0x1689('0x4b')]=function(_0x57e70f,_0x568e04,_0x1d80ba){var _0x2f0b53={};var _0x1423c9={};var _0xaced8b;var _0x3f5b62;return db['DeskConfiguration'][_0x1689('0x4c')]({'where':{'id':_0x57e70f['params']['id']}})[_0x1689('0x25')](handleEntityNotFound(_0x568e04,null))['then'](function(_0x245fed){if(_0x245fed){_0xaced8b=_0x245fed;_0x1423c9[_0x1689('0x2f')]=_['keys'](db['DeskField'][_0x1689('0x4d')]);_0x1423c9[_0x1689('0x30')]=_[_0x1689('0x31')](_0x57e70f['query']);_0x1423c9[_0x1689('0x32')]=_['intersection'](_0x1423c9[_0x1689('0x2f')],_0x1423c9[_0x1689('0x30')]);_0x2f0b53[_0x1689('0x34')]=_[_0x1689('0x33')](_0x1423c9[_0x1689('0x2f')],qs[_0x1689('0x35')](_0x57e70f[_0x1689('0x30')][_0x1689('0x35')]));_0x2f0b53[_0x1689('0x34')]=_0x2f0b53[_0x1689('0x34')][_0x1689('0x36')]?_0x2f0b53[_0x1689('0x34')]:_0x1423c9[_0x1689('0x2f')];_0x2f0b53[_0x1689('0x4e')]=qs[_0x1689('0x39')](_0x57e70f[_0x1689('0x30')][_0x1689('0x39')]);_0x2f0b53[_0x1689('0x3a')]=qs[_0x1689('0x32')](_[_0x1689('0x3b')](_0x57e70f['query'],_0x1423c9[_0x1689('0x32')]));if(_0x57e70f[_0x1689('0x30')][_0x1689('0x3e')]){_0x2f0b53['where']=_[_0x1689('0x3c')](_0x2f0b53['where'],{'$or':_[_0x1689('0x2a')](_0x2f0b53[_0x1689('0x34')],function(_0x2e72ba){var _0x1c187b={};_0x1c187b[_0x2e72ba]={'$like':'%'+_0x57e70f[_0x1689('0x30')][_0x1689('0x3e')]+'%'};return _0x1c187b;})});}_0x2f0b53=_['merge']({},_0x2f0b53,_0x57e70f[_0x1689('0x3f')]);return _0xaced8b[_0x1689('0x4b')](_0x2f0b53);}})[_0x1689('0x25')](function(_0x5e0043){if(_0x5e0043){_0x3f5b62=_0x5e0043['length'];if(!_0x57e70f['query'][_0x1689('0x37')](_0x1689('0x38'))){_0x2f0b53[_0x1689('0x20')]=qs[_0x1689('0x20')](_0x57e70f['query'][_0x1689('0x20')]);_0x2f0b53['offset']=qs[_0x1689('0x1e')](_0x57e70f[_0x1689('0x30')][_0x1689('0x1e')]);}return _0xaced8b[_0x1689('0x4b')](_0x2f0b53);}})['then'](function(_0x12e1b5){if(_0x12e1b5){return _0x12e1b5?{'count':_0x3f5b62,'rows':_0x12e1b5}:null;}})[_0x1689('0x25')](respondWithResult(_0x568e04,null))['catch'](handleError(_0x568e04,null));};exports['getSubjects']=function(_0x2e4585,_0x4b89ea,_0x2b9017){var _0x55c852={};var _0x230912={};var _0x38447b;var _0x3d9384;return db[_0x1689('0x2b')][_0x1689('0x4c')]({'where':{'id':_0x2e4585['params']['id']}})['then'](handleEntityNotFound(_0x4b89ea,null))['then'](function(_0x4a3728){if(_0x4a3728){_0x38447b=_0x4a3728;_0x230912[_0x1689('0x2f')]=_['keys'](db['DeskField']['rawAttributes']);_0x230912['query']=_[_0x1689('0x31')](_0x2e4585[_0x1689('0x30')]);_0x230912['filters']=_[_0x1689('0x33')](_0x230912['model'],_0x230912[_0x1689('0x30')]);_0x55c852['attributes']=_[_0x1689('0x33')](_0x230912[_0x1689('0x2f')],qs['fields'](_0x2e4585[_0x1689('0x30')][_0x1689('0x35')]));_0x55c852[_0x1689('0x34')]=_0x55c852['attributes'][_0x1689('0x36')]?_0x55c852['attributes']:_0x230912[_0x1689('0x2f')];_0x55c852[_0x1689('0x4e')]=qs[_0x1689('0x39')](_0x2e4585[_0x1689('0x30')][_0x1689('0x39')]);_0x55c852[_0x1689('0x3a')]=qs[_0x1689('0x32')](_['pick'](_0x2e4585['query'],_0x230912[_0x1689('0x32')]));if(_0x2e4585[_0x1689('0x30')][_0x1689('0x3e')]){_0x55c852['where']=_['merge'](_0x55c852[_0x1689('0x3a')],{'$or':_['map'](_0x55c852[_0x1689('0x34')],function(_0x1da5e9){var _0x5e229d={};_0x5e229d[_0x1da5e9]={'$like':'%'+_0x2e4585['query']['filter']+'%'};return _0x5e229d;})});}_0x55c852=_[_0x1689('0x3c')]({},_0x55c852,_0x2e4585['options']);return _0x38447b['getSubjects'](_0x55c852);}})[_0x1689('0x25')](function(_0x4c0cdc){if(_0x4c0cdc){_0x3d9384=_0x4c0cdc[_0x1689('0x36')];if(!_0x2e4585['query'][_0x1689('0x37')](_0x1689('0x38'))){_0x55c852[_0x1689('0x20')]=qs['limit'](_0x2e4585['query']['limit']);_0x55c852[_0x1689('0x1e')]=qs[_0x1689('0x1e')](_0x2e4585[_0x1689('0x30')]['offset']);}return _0x38447b[_0x1689('0x4f')](_0x55c852);}})[_0x1689('0x25')](function(_0xdb3560){if(_0xdb3560){return _0xdb3560?{'count':_0x3d9384,'rows':_0xdb3560}:null;}})[_0x1689('0x25')](respondWithResult(_0x4b89ea,null))[_0x1689('0x44')](handleError(_0x4b89ea,null));};exports[_0x1689('0x50')]=function(_0x33c30a,_0x12b043,_0x130c4c){var _0x273c23={};var _0x264248={};var _0x4e2a82;var _0x520f5c;return db['DeskConfiguration'][_0x1689('0x4c')]({'where':{'id':_0x33c30a[_0x1689('0x4a')]['id']}})[_0x1689('0x25')](handleEntityNotFound(_0x12b043,null))['then'](function(_0x560463){if(_0x560463){_0x4e2a82=_0x560463;_0x264248[_0x1689('0x2f')]=_[_0x1689('0x31')](db[_0x1689('0x51')]['rawAttributes']);_0x264248['query']=_[_0x1689('0x31')](_0x33c30a[_0x1689('0x30')]);_0x264248['filters']=_[_0x1689('0x33')](_0x264248[_0x1689('0x2f')],_0x264248[_0x1689('0x30')]);_0x273c23[_0x1689('0x34')]=_[_0x1689('0x33')](_0x264248[_0x1689('0x2f')],qs['fields'](_0x33c30a[_0x1689('0x30')]['fields']));_0x273c23[_0x1689('0x34')]=_0x273c23[_0x1689('0x34')][_0x1689('0x36')]?_0x273c23['attributes']:_0x264248[_0x1689('0x2f')];_0x273c23[_0x1689('0x4e')]=qs[_0x1689('0x39')](_0x33c30a[_0x1689('0x30')]['sort']);_0x273c23[_0x1689('0x3a')]=qs[_0x1689('0x32')](_[_0x1689('0x3b')](_0x33c30a[_0x1689('0x30')],_0x264248[_0x1689('0x32')]));if(_0x33c30a[_0x1689('0x30')][_0x1689('0x3e')]){_0x273c23['where']=_[_0x1689('0x3c')](_0x273c23['where'],{'$or':_[_0x1689('0x2a')](_0x273c23[_0x1689('0x34')],function(_0x195531){var _0x1be4d2={};_0x1be4d2[_0x195531]={'$like':'%'+_0x33c30a['query'][_0x1689('0x3e')]+'%'};return _0x1be4d2;})});}_0x273c23=_['merge']({},_0x273c23,_0x33c30a[_0x1689('0x3f')]);return _0x4e2a82[_0x1689('0x50')](_0x273c23);}})[_0x1689('0x25')](function(_0x1d0991){if(_0x1d0991){_0x520f5c=_0x1d0991[_0x1689('0x36')];if(!_0x33c30a[_0x1689('0x30')][_0x1689('0x37')]('nolimit')){_0x273c23[_0x1689('0x20')]=qs[_0x1689('0x20')](_0x33c30a[_0x1689('0x30')][_0x1689('0x20')]);_0x273c23[_0x1689('0x1e')]=qs['offset'](_0x33c30a[_0x1689('0x30')]['offset']);}return _0x4e2a82[_0x1689('0x50')](_0x273c23);}})[_0x1689('0x25')](function(_0x67f4c1){if(_0x67f4c1){return _0x67f4c1?{'count':_0x520f5c,'rows':_0x67f4c1}:null;}})[_0x1689('0x25')](respondWithResult(_0x12b043,null))['catch'](handleError(_0x12b043,null));};exports[_0x1689('0x52')]=function(_0x5e8893,_0x1d1457,_0x531fd1){var _0x1c32d9={};var _0x58fc26={};var _0x310c01;var _0x2f2691;return db[_0x1689('0x2b')][_0x1689('0x4c')]({'where':{'id':_0x5e8893['params']['id']}})[_0x1689('0x25')](handleEntityNotFound(_0x1d1457,null))[_0x1689('0x25')](function(_0x28e7eb){if(_0x28e7eb){_0x310c01=_0x28e7eb;_0x58fc26[_0x1689('0x2f')]=_['keys'](db[_0x1689('0x53')][_0x1689('0x4d')]);_0x58fc26[_0x1689('0x30')]=_[_0x1689('0x31')](_0x5e8893[_0x1689('0x30')]);_0x58fc26['filters']=_[_0x1689('0x33')](_0x58fc26['model'],_0x58fc26['query']);_0x1c32d9[_0x1689('0x34')]=_[_0x1689('0x33')](_0x58fc26[_0x1689('0x2f')],qs[_0x1689('0x35')](_0x5e8893[_0x1689('0x30')]['fields']));_0x1c32d9['attributes']=_0x1c32d9['attributes'][_0x1689('0x36')]?_0x1c32d9[_0x1689('0x34')]:_0x58fc26[_0x1689('0x2f')];_0x1c32d9[_0x1689('0x4e')]=qs[_0x1689('0x39')](_0x5e8893[_0x1689('0x30')][_0x1689('0x39')]);_0x1c32d9[_0x1689('0x3a')]=qs[_0x1689('0x32')](_[_0x1689('0x3b')](_0x5e8893[_0x1689('0x30')],_0x58fc26[_0x1689('0x32')]));if(_0x5e8893[_0x1689('0x30')][_0x1689('0x3e')]){_0x1c32d9[_0x1689('0x3a')]=_['merge'](_0x1c32d9[_0x1689('0x3a')],{'$or':_['map'](_0x1c32d9['attributes'],function(_0x2f5eed){var _0x5a704e={};_0x5a704e[_0x2f5eed]={'$like':'%'+_0x5e8893[_0x1689('0x30')][_0x1689('0x3e')]+'%'};return _0x5a704e;})});}_0x1c32d9=_['merge']({},_0x1c32d9,_0x5e8893['options']);return _0x310c01[_0x1689('0x52')](_0x1c32d9);}})['then'](function(_0xb7bf6f){if(_0xb7bf6f){_0x2f2691=_0xb7bf6f[_0x1689('0x36')];if(!_0x5e8893['query'][_0x1689('0x37')](_0x1689('0x38'))){_0x1c32d9[_0x1689('0x20')]=qs[_0x1689('0x20')](_0x5e8893[_0x1689('0x30')]['limit']);_0x1c32d9['offset']=qs[_0x1689('0x1e')](_0x5e8893[_0x1689('0x30')][_0x1689('0x1e')]);}return _0x310c01['getTags'](_0x1c32d9);}})[_0x1689('0x25')](function(_0x2356bd){if(_0x2356bd){return _0x2356bd?{'count':_0x2f2691,'rows':_0x2356bd}:null;}})[_0x1689('0x25')](respondWithResult(_0x1d1457,null))['catch'](handleError(_0x1d1457,null));};exports[_0x1689('0x54')]=function(_0x438cef,_0x129d42,_0x216e2d){if(_0x438cef[_0x1689('0x48')]['id']){delete _0x438cef['body']['id'];}return db['DeskConfiguration'][_0x1689('0x4c')]({'where':{'id':_0x438cef['params']['id']}})[_0x1689('0x25')](handleEntityNotFound(_0x129d42,null))[_0x1689('0x25')](function(_0x25f5b3){if(_0x25f5b3){return _0x25f5b3['setTags'](_0x438cef['body'][_0x1689('0x55')]||[]);}return null;})[_0x1689('0x25')](respondWithResult(_0x129d42,null))[_0x1689('0x44')](handleError(_0x129d42,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 004dbf1..60b3091 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 _0x3f83=['../../config/logger','api','moment','bluebird','request-promise','rimraf','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x459947,_0x50180f){var _0x30fedb=function(_0x8bc2c2){while(--_0x8bc2c2){_0x459947['push'](_0x459947['shift']());}};_0x30fedb(++_0x50180f);}(_0x3f83,0x153));var _0x33f8=function(_0xacad3a,_0x224222){_0xacad3a=_0xacad3a-0x0;var _0x2a8aef=_0x3f83[_0xacad3a];return _0x2a8aef;};'use strict';var _=require(_0x33f8('0x0'));var util=require(_0x33f8('0x1'));var logger=require(_0x33f8('0x2'))(_0x33f8('0x3'));var moment=require(_0x33f8('0x4'));var BPromise=require(_0x33f8('0x5'));var rp=require(_0x33f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33f8('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x557da2,_0xccac){return _0x557da2[_0x33f8('0x8')](_0x33f8('0x9'),attributes,{'tableName':_0x33f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb872=['exports','DeskConfiguration','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xb872,0x16d));var _0x2b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb872[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2b87('0x0'));var logger=require(_0x2b87('0x1'))('api');var moment=require(_0x2b87('0x2'));var BPromise=require(_0x2b87('0x3'));var rp=require(_0x2b87('0x4'));var fs=require('fs');var path=require(_0x2b87('0x5'));var rimraf=require(_0x2b87('0x6'));var config=require(_0x2b87('0x7'));var attributes=require(_0x2b87('0x8'));module[_0x2b87('0x9')]=function(_0x5bdcc2,_0x1985f0){return _0x5bdcc2['define'](_0x2b87('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 02ef4f2..bea9aa6 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 _0xd159=['rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xd159,0x19d));var _0x9d15=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd159[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x9d15('0x0'));var util=require(_0x9d15('0x1'));var moment=require(_0x9d15('0x2'));var BPromise=require(_0x9d15('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d15('0x4'));var db=require(_0x9d15('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d15('0x6'))(_0x9d15('0x7'));var config=require(_0x9d15('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d15('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x414cba,_0x849cd1,_0x23a702){return new BPromise(function(_0x5b1a6e,_0xcaa861){return client[_0x9d15('0xa')](_0x414cba,_0x23a702)[_0x9d15('0xb')](function(_0x2b51f7){logger[_0x9d15('0xc')](_0x9d15('0xd'),_0x849cd1,_0x9d15('0xe'));logger[_0x9d15('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x849cd1,_0x9d15('0xe'),JSON['stringify'](_0x2b51f7));if(_0x2b51f7[_0x9d15('0x10')]){if(_0x2b51f7[_0x9d15('0x10')][_0x9d15('0x11')]===0x1f4){logger[_0x9d15('0x10')](_0x9d15('0xd'),_0x849cd1,_0x2b51f7[_0x9d15('0x10')][_0x9d15('0x12')]);return _0xcaa861(_0x2b51f7[_0x9d15('0x10')]['message']);}logger[_0x9d15('0x10')](_0x9d15('0xd'),_0x849cd1,_0x2b51f7['error'][_0x9d15('0x12')]);return _0x5b1a6e(_0x2b51f7['error'][_0x9d15('0x12')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x849cd1,'request\x20sent');_0x5b1a6e(_0x2b51f7['result'][_0x9d15('0x12')]);}})[_0x9d15('0x13')](function(_0x5e4ba5){logger[_0x9d15('0x10')](_0x9d15('0xd'),_0x849cd1,_0x5e4ba5);_0xcaa861(_0x5e4ba5);});});} \ No newline at end of file +var _0xd868=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x347b87,_0x324e3f){var _0x580d22=function(_0x7a2b81){while(--_0x7a2b81){_0x347b87['push'](_0x347b87['shift']());}};_0x580d22(++_0x324e3f);}(_0xd868,0x1ec));var _0x8d86=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd868[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x8d86('0x0'));var util=require('util');var moment=require(_0x8d86('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d86('0x2'));var db=require(_0x8d86('0x3'))['db'];var utils=require(_0x8d86('0x4'));var logger=require('../../config/logger')(_0x8d86('0x5'));var config=require(_0x8d86('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8d86('0x7')][_0x8d86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb683e,_0x1f06bf,_0x36b372){return new BPromise(function(_0x42dd2a,_0x349572){return client[_0x8d86('0x9')](_0xb683e,_0x36b372)[_0x8d86('0xa')](function(_0x4127b4){logger[_0x8d86('0xb')](_0x8d86('0xc'),_0x1f06bf,_0x8d86('0xd'));logger[_0x8d86('0xe')](_0x8d86('0xf'),_0x1f06bf,_0x8d86('0xd'),JSON[_0x8d86('0x10')](_0x4127b4));if(_0x4127b4[_0x8d86('0x11')]){if(_0x4127b4['error'][_0x8d86('0x12')]===0x1f4){logger[_0x8d86('0x11')](_0x8d86('0xc'),_0x1f06bf,_0x4127b4['error']['message']);return _0x349572(_0x4127b4[_0x8d86('0x11')][_0x8d86('0x13')]);}logger[_0x8d86('0x11')](_0x8d86('0xc'),_0x1f06bf,_0x4127b4[_0x8d86('0x11')][_0x8d86('0x13')]);return _0x42dd2a(_0x4127b4['error'][_0x8d86('0x13')]);}else{logger[_0x8d86('0xb')](_0x8d86('0xc'),_0x1f06bf,_0x8d86('0xd'));_0x42dd2a(_0x4127b4['result'][_0x8d86('0x13')]);}})[_0x8d86('0x14')](function(_0x1650f2){logger['error'](_0x8d86('0xc'),_0x1f06bf,_0x1650f2);_0x349572(_0x1650f2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6ec0f19..88b61d1 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 _0x2eba=['update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','post','create'];(function(_0x41384e,_0x1154ad){var _0x37629d=function(_0x4178af){while(--_0x4178af){_0x41384e['push'](_0x41384e['shift']());}};_0x37629d(++_0x1154ad);}(_0x2eba,0xc7));var _0xa2eb=function(_0x79d706,_0x4e5e39){_0x79d706=_0x79d706-0x0;var _0x3c8c3d=_0x2eba[_0x79d706];return _0x3c8c3d;};'use strict';var multer=require('multer');var util=require(_0xa2eb('0x0'));var path=require(_0xa2eb('0x1'));var timeout=require(_0xa2eb('0x2'));var express=require(_0xa2eb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa2eb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa2eb('0x5'));var controller=require(_0xa2eb('0x6'));router[_0xa2eb('0x7')]('/',auth[_0xa2eb('0x8')](),controller['index']);router['get']('/:id',auth[_0xa2eb('0x8')](),controller['show']);router[_0xa2eb('0x9')]('/',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xa')]);router['put']('/:id',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xb')]);router[_0xa2eb('0xc')]('/:id',auth[_0xa2eb('0x8')](),controller[_0xa2eb('0xd')]);module['exports']=router; \ No newline at end of file +var _0x685b=['connect-timeout','express','fs-extra','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','/:id','put','update','delete','destroy','exports','multer','util','path'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x685b,0xbd));var _0xb685=function(_0x34f273,_0x37a8c3){_0x34f273=_0x34f273-0x0;var _0x1f2544=_0x685b[_0x34f273];return _0x1f2544;};'use strict';var multer=require(_0xb685('0x0'));var util=require(_0xb685('0x1'));var path=require(_0xb685('0x2'));var timeout=require(_0xb685('0x3'));var express=require(_0xb685('0x4'));var router=express['Router']();var fs_extra=require(_0xb685('0x5'));var auth=require(_0xb685('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb685('0x7'));router[_0xb685('0x8')]('/',auth[_0xb685('0x9')](),controller['index']);router[_0xb685('0x8')](_0xb685('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb685('0x9')](),controller['create']);router[_0xb685('0xb')]('/:id',auth[_0xb685('0x9')](),controller[_0xb685('0xc')]);router[_0xb685('0xd')](_0xb685('0xa'),auth['isAuthenticated'](),controller[_0xb685('0xe')]);module[_0xb685('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 46b8437..64f8981 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 _0xac2d=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','string'];(function(_0x45403d,_0x278688){var _0x45c73b=function(_0x874fe){while(--_0x874fe){_0x45403d['push'](_0x45403d['shift']());}};_0x45c73b(++_0x278688);}(_0xac2d,0x86));var _0xdac2=function(_0x303c27,_0x3fb9cb){_0x303c27=_0x303c27-0x0;var _0x448f51=_0xac2d[_0x303c27];return _0x448f51;};'use strict';var Sequelize=require(_0xdac2('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xdac2('0x1'),'variable',_0xdac2('0x2'),_0xdac2('0x3'),_0xdac2('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdac2('0x5')]},'key':{'type':Sequelize[_0xdac2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xdac2('0x1'),_0xdac2('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xdac2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdac2('0x5')]},'customField':{'type':Sequelize[_0xdac2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdac2('0x5')]}}; \ No newline at end of file +var _0x57d5=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x5e0d25,_0x2d4f){var _0x439ed5=function(_0x2a6cd9){while(--_0x2a6cd9){_0x5e0d25['push'](_0x5e0d25['shift']());}};_0x439ed5(++_0x2d4f);}(_0x57d5,0x1f4));var _0x557d=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x57d5[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x557d('0x0'));module[_0x557d('0x1')]={'type':{'type':Sequelize[_0x557d('0x2')](_0x557d('0x3'),_0x557d('0x4'),_0x557d('0x5'),_0x557d('0x6'),'picklist'),'defaultValue':_0x557d('0x3')},'content':{'type':Sequelize[_0x557d('0x7')]},'key':{'type':Sequelize[_0x557d('0x7')]},'keyType':{'type':Sequelize[_0x557d('0x2')](_0x557d('0x3'),_0x557d('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x557d('0x7')]},'idField':{'type':Sequelize[_0x557d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7a5cbc0..c954b48 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 _0x8daf=['ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','error','name','send','index','DeskField','rawAttributes','fieldName','type','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','map','VIRTUAL','merge','count','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','destroy','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x46ec35,_0x152885){var _0x236fa8=function(_0x2ca7e8){while(--_0x2ca7e8){_0x46ec35['push'](_0x46ec35['shift']());}};_0x236fa8(++_0x152885);}(_0x8daf,0x15c));var _0xf8da=function(_0x22a9b7,_0x58e5d4){_0x22a9b7=_0x22a9b7-0x0;var _0x8a8568=_0x8daf[_0x22a9b7];return _0x8a8568;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf8da('0x0'));var moment=require(_0xf8da('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xf8da('0x2'));var util=require(_0xf8da('0x3'));var path=require(_0xf8da('0x4'));var sox=require(_0xf8da('0x5'));var csv=require(_0xf8da('0x6'));var ejs=require(_0xf8da('0x7'));var fs=require('fs');var fs_extra=require(_0xf8da('0x8'));var _=require(_0xf8da('0x9'));var squel=require(_0xf8da('0xa'));var crypto=require('crypto');var jsforce=require(_0xf8da('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf8da('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8da('0xc'));var authService=require(_0xf8da('0xd'));var qs=require(_0xf8da('0xe'));var as=require(_0xf8da('0xf'));var hardwareService=require(_0xf8da('0x10'));var logger=require(_0xf8da('0x11'))(_0xf8da('0x12'));var utils=require(_0xf8da('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf8da('0x14'));var db=require(_0xf8da('0x15'))['db'];function respondWithStatusCode(_0x3a436d,_0x1cfce2){_0x1cfce2=_0x1cfce2||0xcc;return function(_0x5cd714){if(_0x5cd714){return _0x3a436d[_0xf8da('0x16')](_0x1cfce2);}return _0x3a436d['status'](_0x1cfce2)[_0xf8da('0x17')]();};}function respondWithResult(_0x1a93ab,_0x259b96){_0x259b96=_0x259b96||0xc8;return function(_0x3e5413){if(_0x3e5413){return _0x1a93ab[_0xf8da('0x18')](_0x259b96)['json'](_0x3e5413);}};}function respondWithFilteredResult(_0x387c8e,_0x4296ff){return function(_0x36cee8){if(_0x36cee8){var _0x3fa368=typeof _0x4296ff[_0xf8da('0x19')]===_0xf8da('0x1a')&&typeof _0x4296ff[_0xf8da('0x1b')]==='undefined';var _0x1c9486=_0x36cee8['count'];var _0x5dc9db=_0x3fa368?0x0:_0x4296ff[_0xf8da('0x19')];var _0x2611c2=_0x3fa368?_0x36cee8['count']:_0x4296ff[_0xf8da('0x19')]+_0x4296ff[_0xf8da('0x1b')];var _0x30e1;if(_0x2611c2>=_0x1c9486){_0x2611c2=_0x1c9486;_0x30e1=0xc8;}else{_0x30e1=0xce;}_0x387c8e[_0xf8da('0x18')](_0x30e1);return _0x387c8e[_0xf8da('0x1c')](_0xf8da('0x1d'),_0x5dc9db+'-'+_0x2611c2+'/'+_0x1c9486)[_0xf8da('0x1e')](_0x36cee8);}return null;};}function patchUpdates(_0xfe5c73){return function(_0x5acd3f){try{jsonpatch[_0xf8da('0x1f')](_0x5acd3f,_0xfe5c73,!![]);}catch(_0x22adc7){return BPromise['reject'](_0x22adc7);}return _0x5acd3f[_0xf8da('0x20')]();};}function saveUpdates(_0x5361e7,_0x4ca909){return function(_0x5a295f){if(_0x5a295f){return _0x5a295f[_0xf8da('0x21')](_0x5361e7)[_0xf8da('0x22')](function(_0x2255b8){return _0x2255b8;});}return null;};}function removeEntity(_0x389391,_0x493d6c){return function(_0x4f7ceb){if(_0x4f7ceb){return _0x4f7ceb['destroy']()['then'](function(){_0x389391[_0xf8da('0x18')](0xcc)[_0xf8da('0x17')]();});}};}function handleEntityNotFound(_0x43934c,_0x2b403d){return function(_0x4b8d17){if(!_0x4b8d17){_0x43934c[_0xf8da('0x16')](0x194);}return _0x4b8d17;};}function handleError(_0x2ca340,_0x4326b1){_0x4326b1=_0x4326b1||0x1f4;return function(_0x550590){logger[_0xf8da('0x23')](_0x550590['stack']);if(_0x550590[_0xf8da('0x24')]){delete _0x550590[_0xf8da('0x24')];}_0x2ca340[_0xf8da('0x18')](_0x4326b1)[_0xf8da('0x25')](_0x550590);};}exports[_0xf8da('0x26')]=function(_0x3da568,_0x35544b){var _0x424f5d={},_0x51014c={},_0xd5780a={'count':0x0,'rows':[]};var _0x552ed3=_['map'](db[_0xf8da('0x27')][_0xf8da('0x28')],function(_0x16d7e9){return{'name':_0x16d7e9[_0xf8da('0x29')],'type':_0x16d7e9[_0xf8da('0x2a')]['key']};});_0x51014c[_0xf8da('0x2b')]=_['map'](_0x552ed3,'name');_0x51014c['query']=_['keys'](_0x3da568['query']);_0x51014c[_0xf8da('0x2c')]=_['intersection'](_0x51014c[_0xf8da('0x2b')],_0x51014c[_0xf8da('0x2d')]);_0x424f5d[_0xf8da('0x2e')]=_['intersection'](_0x51014c['model'],qs[_0xf8da('0x2f')](_0x3da568[_0xf8da('0x2d')][_0xf8da('0x2f')]));_0x424f5d[_0xf8da('0x2e')]=_0x424f5d[_0xf8da('0x2e')][_0xf8da('0x30')]?_0x424f5d['attributes']:_0x51014c[_0xf8da('0x2b')];if(!_0x3da568[_0xf8da('0x2d')][_0xf8da('0x31')](_0xf8da('0x32'))){_0x424f5d[_0xf8da('0x1b')]=qs[_0xf8da('0x1b')](_0x3da568['query'][_0xf8da('0x1b')]);_0x424f5d[_0xf8da('0x19')]=qs[_0xf8da('0x19')](_0x3da568[_0xf8da('0x2d')]['offset']);}_0x424f5d[_0xf8da('0x33')]=qs['sort'](_0x3da568[_0xf8da('0x2d')]['sort']);_0x424f5d[_0xf8da('0x34')]=qs['filters'](_[_0xf8da('0x35')](_0x3da568[_0xf8da('0x2d')],_0x51014c[_0xf8da('0x2c')]),_0x552ed3);if(_0x3da568[_0xf8da('0x2d')][_0xf8da('0x36')]){_0x424f5d[_0xf8da('0x34')]=_['merge'](_0x424f5d[_0xf8da('0x34')],{'$or':_[_0xf8da('0x37')](_0x552ed3,function(_0x235756){if(_0x235756['type']!==_0xf8da('0x38')){var _0x3eb5b1={};_0x3eb5b1[_0x235756[_0xf8da('0x24')]]={'$like':'%'+_0x3da568['query'][_0xf8da('0x36')]+'%'};return _0x3eb5b1;}})});}_0x424f5d=_[_0xf8da('0x39')]({},_0x424f5d,_0x3da568['options']);var _0x236244={'where':_0x424f5d[_0xf8da('0x34')]};return db[_0xf8da('0x27')]['count'](_0x236244)[_0xf8da('0x22')](function(_0xec8256){_0xd5780a[_0xf8da('0x3a')]=_0xec8256;if(_0x3da568[_0xf8da('0x2d')][_0xf8da('0x3b')]){_0x424f5d[_0xf8da('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0xf8da('0x3d')](_0x424f5d);})[_0xf8da('0x22')](function(_0x55c307){_0xd5780a['rows']=_0x55c307;return _0xd5780a;})[_0xf8da('0x22')](respondWithFilteredResult(_0x35544b,_0x424f5d))[_0xf8da('0x3e')](handleError(_0x35544b,null));};exports[_0xf8da('0x3f')]=function(_0x72f494,_0x555822){var _0x246192={'raw':!![],'where':{'id':_0x72f494[_0xf8da('0x40')]['id']}},_0x2807f9={};_0x2807f9[_0xf8da('0x2b')]=_['keys'](db['DeskField'][_0xf8da('0x28')]);_0x2807f9['query']=_[_0xf8da('0x41')](_0x72f494['query']);_0x2807f9[_0xf8da('0x2c')]=_[_0xf8da('0x42')](_0x2807f9[_0xf8da('0x2b')],_0x2807f9[_0xf8da('0x2d')]);_0x246192[_0xf8da('0x2e')]=_[_0xf8da('0x42')](_0x2807f9[_0xf8da('0x2b')],qs['fields'](_0x72f494[_0xf8da('0x2d')][_0xf8da('0x2f')]));_0x246192['attributes']=_0x246192[_0xf8da('0x2e')][_0xf8da('0x30')]?_0x246192['attributes']:_0x2807f9[_0xf8da('0x2b')];if(_0x72f494[_0xf8da('0x2d')][_0xf8da('0x3b')]){_0x246192[_0xf8da('0x3c')]=[{'all':!![]}];}_0x246192=_[_0xf8da('0x39')]({},_0x246192,_0x72f494['options']);return db['DeskField'][_0xf8da('0x43')](_0x246192)['then'](handleEntityNotFound(_0x555822,null))[_0xf8da('0x22')](respondWithResult(_0x555822,null))['catch'](handleError(_0x555822,null));};exports[_0xf8da('0x44')]=function(_0x3970b8,_0x1703a1){return db[_0xf8da('0x27')][_0xf8da('0x44')](_0x3970b8[_0xf8da('0x45')],{})[_0xf8da('0x22')](respondWithResult(_0x1703a1,0xc9))[_0xf8da('0x3e')](handleError(_0x1703a1,null));};exports['update']=function(_0x26db7f,_0x3decc8){if(_0x26db7f['body']['id']){delete _0x26db7f[_0xf8da('0x45')]['id'];}return db[_0xf8da('0x27')][_0xf8da('0x43')]({'where':{'id':_0x26db7f[_0xf8da('0x40')]['id']}})[_0xf8da('0x22')](handleEntityNotFound(_0x3decc8,null))['then'](saveUpdates(_0x26db7f['body'],null))['then'](respondWithResult(_0x3decc8,null))['catch'](handleError(_0x3decc8,null));};exports[_0xf8da('0x46')]=function(_0x2f8d1a,_0x5c9c5a){return db['DeskField'][_0xf8da('0x43')]({'where':{'id':_0x2f8d1a[_0xf8da('0x40')]['id']}})[_0xf8da('0x22')](handleEntityNotFound(_0x5c9c5a,null))[_0xf8da('0x22')](removeEntity(_0x5c9c5a,null))[_0xf8da('0x3e')](handleError(_0x5c9c5a,null));}; \ No newline at end of file +var _0xf0b0=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x851610,_0xbf3039){var _0x29bb95=function(_0x48a753){while(--_0x48a753){_0x851610['push'](_0x851610['shift']());}};_0x29bb95(++_0xbf3039);}(_0xf0b0,0xc8));var _0x0f0b=function(_0x2ef11e,_0x1cc535){_0x2ef11e=_0x2ef11e-0x0;var _0x28225b=_0xf0b0[_0x2ef11e];return _0x28225b;};'use strict';var emlformat=require(_0x0f0b('0x0'));var rimraf=require(_0x0f0b('0x1'));var zipdir=require(_0x0f0b('0x2'));var jsonpatch=require(_0x0f0b('0x3'));var rp=require(_0x0f0b('0x4'));var moment=require(_0x0f0b('0x5'));var BPromise=require(_0x0f0b('0x6'));var Mustache=require(_0x0f0b('0x7'));var util=require(_0x0f0b('0x8'));var path=require('path');var sox=require(_0x0f0b('0x9'));var csv=require('to-csv');var ejs=require(_0x0f0b('0xa'));var fs=require('fs');var fs_extra=require(_0x0f0b('0xb'));var _=require(_0x0f0b('0xc'));var squel=require(_0x0f0b('0xd'));var crypto=require(_0x0f0b('0xe'));var jsforce=require(_0x0f0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0f0b('0x10'));var querystring=require(_0x0f0b('0x11'));var Papa=require(_0x0f0b('0x12'));var Redis=require(_0x0f0b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0f0b('0x14'));var as=require(_0x0f0b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0f0b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f0b('0x17'));var db=require(_0x0f0b('0x18'))['db'];function respondWithStatusCode(_0x521096,_0x3871ea){_0x3871ea=_0x3871ea||0xcc;return function(_0x204dce){if(_0x204dce){return _0x521096[_0x0f0b('0x19')](_0x3871ea);}return _0x521096[_0x0f0b('0x1a')](_0x3871ea)[_0x0f0b('0x1b')]();};}function respondWithResult(_0xaa1453,_0x19dcfb){_0x19dcfb=_0x19dcfb||0xc8;return function(_0x8cfef5){if(_0x8cfef5){return _0xaa1453[_0x0f0b('0x1a')](_0x19dcfb)[_0x0f0b('0x1c')](_0x8cfef5);}};}function respondWithFilteredResult(_0x1cb8ff,_0xd548a7){return function(_0x1b83e8){if(_0x1b83e8){var _0x45fd81=typeof _0xd548a7[_0x0f0b('0x1d')]===_0x0f0b('0x1e')&&typeof _0xd548a7[_0x0f0b('0x1f')]===_0x0f0b('0x1e');var _0x27412f=_0x1b83e8[_0x0f0b('0x20')];var _0xe8bb7e=_0x45fd81?0x0:_0xd548a7[_0x0f0b('0x1d')];var _0x13a875=_0x45fd81?_0x1b83e8[_0x0f0b('0x20')]:_0xd548a7['offset']+_0xd548a7[_0x0f0b('0x1f')];var _0x5a2a81;if(_0x13a875>=_0x27412f){_0x13a875=_0x27412f;_0x5a2a81=0xc8;}else{_0x5a2a81=0xce;}_0x1cb8ff[_0x0f0b('0x1a')](_0x5a2a81);return _0x1cb8ff[_0x0f0b('0x21')](_0x0f0b('0x22'),_0xe8bb7e+'-'+_0x13a875+'/'+_0x27412f)[_0x0f0b('0x1c')](_0x1b83e8);}return null;};}function patchUpdates(_0x3920f8){return function(_0x5dabc2){try{jsonpatch['apply'](_0x5dabc2,_0x3920f8,!![]);}catch(_0x609bbd){return BPromise['reject'](_0x609bbd);}return _0x5dabc2['save']();};}function saveUpdates(_0x497c67,_0x1b0c11){return function(_0x44fd9d){if(_0x44fd9d){return _0x44fd9d[_0x0f0b('0x23')](_0x497c67)[_0x0f0b('0x24')](function(_0x562374){return _0x562374;});}return null;};}function removeEntity(_0x1e4076,_0x423ddf){return function(_0x182fc6){if(_0x182fc6){return _0x182fc6[_0x0f0b('0x25')]()['then'](function(){_0x1e4076['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe86660,_0x422750){return function(_0x37374e){if(!_0x37374e){_0xe86660[_0x0f0b('0x19')](0x194);}return _0x37374e;};}function handleError(_0x188d53,_0x5c6883){_0x5c6883=_0x5c6883||0x1f4;return function(_0x5094f7){logger[_0x0f0b('0x26')](_0x5094f7[_0x0f0b('0x27')]);if(_0x5094f7[_0x0f0b('0x28')]){delete _0x5094f7[_0x0f0b('0x28')];}_0x188d53['status'](_0x5c6883)[_0x0f0b('0x29')](_0x5094f7);};}exports[_0x0f0b('0x2a')]=function(_0x2b6409,_0x280f69){var _0x75cc84={},_0x3ccbb7={},_0x661fe4={'count':0x0,'rows':[]};var _0x3fe2f0=_[_0x0f0b('0x2b')](db[_0x0f0b('0x2c')]['rawAttributes'],function(_0x56869d){return{'name':_0x56869d[_0x0f0b('0x2d')],'type':_0x56869d[_0x0f0b('0x2e')][_0x0f0b('0x2f')]};});_0x3ccbb7[_0x0f0b('0x30')]=_[_0x0f0b('0x2b')](_0x3fe2f0,'name');_0x3ccbb7[_0x0f0b('0x31')]=_['keys'](_0x2b6409[_0x0f0b('0x31')]);_0x3ccbb7[_0x0f0b('0x32')]=_[_0x0f0b('0x33')](_0x3ccbb7[_0x0f0b('0x30')],_0x3ccbb7[_0x0f0b('0x31')]);_0x75cc84['attributes']=_[_0x0f0b('0x33')](_0x3ccbb7[_0x0f0b('0x30')],qs[_0x0f0b('0x34')](_0x2b6409[_0x0f0b('0x31')]['fields']));_0x75cc84[_0x0f0b('0x35')]=_0x75cc84['attributes'][_0x0f0b('0x36')]?_0x75cc84[_0x0f0b('0x35')]:_0x3ccbb7[_0x0f0b('0x30')];if(!_0x2b6409[_0x0f0b('0x31')][_0x0f0b('0x37')]('nolimit')){_0x75cc84[_0x0f0b('0x1f')]=qs['limit'](_0x2b6409[_0x0f0b('0x31')][_0x0f0b('0x1f')]);_0x75cc84['offset']=qs[_0x0f0b('0x1d')](_0x2b6409[_0x0f0b('0x31')][_0x0f0b('0x1d')]);}_0x75cc84[_0x0f0b('0x38')]=qs[_0x0f0b('0x39')](_0x2b6409[_0x0f0b('0x31')][_0x0f0b('0x39')]);_0x75cc84[_0x0f0b('0x3a')]=qs[_0x0f0b('0x32')](_['pick'](_0x2b6409[_0x0f0b('0x31')],_0x3ccbb7[_0x0f0b('0x32')]),_0x3fe2f0);if(_0x2b6409[_0x0f0b('0x31')][_0x0f0b('0x3b')]){_0x75cc84['where']=_[_0x0f0b('0x3c')](_0x75cc84[_0x0f0b('0x3a')],{'$or':_[_0x0f0b('0x2b')](_0x3fe2f0,function(_0x52efad){if(_0x52efad[_0x0f0b('0x2e')]!=='VIRTUAL'){var _0x118d5e={};_0x118d5e[_0x52efad[_0x0f0b('0x28')]]={'$like':'%'+_0x2b6409['query'][_0x0f0b('0x3b')]+'%'};return _0x118d5e;}})});}_0x75cc84=_[_0x0f0b('0x3c')]({},_0x75cc84,_0x2b6409['options']);var _0x3c591a={'where':_0x75cc84[_0x0f0b('0x3a')]};return db['DeskField']['count'](_0x3c591a)[_0x0f0b('0x24')](function(_0x40bb46){_0x661fe4[_0x0f0b('0x20')]=_0x40bb46;if(_0x2b6409[_0x0f0b('0x31')][_0x0f0b('0x3d')]){_0x75cc84[_0x0f0b('0x3e')]=[{'all':!![]}];}return db[_0x0f0b('0x2c')][_0x0f0b('0x3f')](_0x75cc84);})['then'](function(_0x5e2974){_0x661fe4[_0x0f0b('0x40')]=_0x5e2974;return _0x661fe4;})[_0x0f0b('0x24')](respondWithFilteredResult(_0x280f69,_0x75cc84))[_0x0f0b('0x41')](handleError(_0x280f69,null));};exports[_0x0f0b('0x42')]=function(_0x310679,_0x5a1091){var _0x354795={'raw':!![],'where':{'id':_0x310679[_0x0f0b('0x43')]['id']}},_0x2f2e85={};_0x2f2e85[_0x0f0b('0x30')]=_[_0x0f0b('0x44')](db['DeskField'][_0x0f0b('0x45')]);_0x2f2e85[_0x0f0b('0x31')]=_[_0x0f0b('0x44')](_0x310679[_0x0f0b('0x31')]);_0x2f2e85[_0x0f0b('0x32')]=_[_0x0f0b('0x33')](_0x2f2e85['model'],_0x2f2e85[_0x0f0b('0x31')]);_0x354795[_0x0f0b('0x35')]=_[_0x0f0b('0x33')](_0x2f2e85['model'],qs[_0x0f0b('0x34')](_0x310679[_0x0f0b('0x31')]['fields']));_0x354795[_0x0f0b('0x35')]=_0x354795[_0x0f0b('0x35')]['length']?_0x354795[_0x0f0b('0x35')]:_0x2f2e85['model'];if(_0x310679[_0x0f0b('0x31')][_0x0f0b('0x3d')]){_0x354795[_0x0f0b('0x3e')]=[{'all':!![]}];}_0x354795=_[_0x0f0b('0x3c')]({},_0x354795,_0x310679[_0x0f0b('0x46')]);return db['DeskField'][_0x0f0b('0x47')](_0x354795)[_0x0f0b('0x24')](handleEntityNotFound(_0x5a1091,null))[_0x0f0b('0x24')](respondWithResult(_0x5a1091,null))[_0x0f0b('0x41')](handleError(_0x5a1091,null));};exports[_0x0f0b('0x48')]=function(_0x4becf2,_0x293391){return db[_0x0f0b('0x2c')]['create'](_0x4becf2[_0x0f0b('0x49')],{})['then'](respondWithResult(_0x293391,0xc9))[_0x0f0b('0x41')](handleError(_0x293391,null));};exports[_0x0f0b('0x23')]=function(_0x512259,_0x45392c){if(_0x512259['body']['id']){delete _0x512259[_0x0f0b('0x49')]['id'];}return db[_0x0f0b('0x2c')][_0x0f0b('0x47')]({'where':{'id':_0x512259[_0x0f0b('0x43')]['id']}})[_0x0f0b('0x24')](handleEntityNotFound(_0x45392c,null))['then'](saveUpdates(_0x512259[_0x0f0b('0x49')],null))['then'](respondWithResult(_0x45392c,null))[_0x0f0b('0x41')](handleError(_0x45392c,null));};exports[_0x0f0b('0x25')]=function(_0xa2ec3a,_0x4c207a){return db[_0x0f0b('0x2c')][_0x0f0b('0x47')]({'where':{'id':_0xa2ec3a['params']['id']}})[_0x0f0b('0x24')](handleEntityNotFound(_0x4c207a,null))[_0x0f0b('0x24')](removeEntity(_0x4c207a,null))[_0x0f0b('0x41')](handleError(_0x4c207a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d47461a..5431899 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 _0x117c=['DeskField','int_desk_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x24d7a9,_0x652371){var _0x1d5966=function(_0x4c8997){while(--_0x4c8997){_0x24d7a9['push'](_0x24d7a9['shift']());}};_0x1d5966(++_0x652371);}(_0x117c,0xf3));var _0xc117=function(_0x335bb1,_0x5aa97e){_0x335bb1=_0x335bb1-0x0;var _0x4c2fc7=_0x117c[_0x335bb1];return _0x4c2fc7;};'use strict';var _=require(_0xc117('0x0'));var util=require(_0xc117('0x1'));var logger=require(_0xc117('0x2'))(_0xc117('0x3'));var moment=require(_0xc117('0x4'));var BPromise=require(_0xc117('0x5'));var rp=require(_0xc117('0x6'));var fs=require('fs');var path=require(_0xc117('0x7'));var rimraf=require(_0xc117('0x8'));var config=require(_0xc117('0x9'));var attributes=require('./intDeskField.attributes');module[_0xc117('0xa')]=function(_0x4fca2d,_0x18b51b){return _0x4fca2d[_0xc117('0xb')](_0xc117('0xc'),attributes,{'tableName':_0xc117('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xc117('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff1=['rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','api','moment','path'];(function(_0x4dfeb6,_0x25ca56){var _0x2b2962=function(_0x23446e){while(--_0x23446e){_0x4dfeb6['push'](_0x4dfeb6['shift']());}};_0x2b2962(++_0x25ca56);}(_0x8ff1,0x126));var _0x18ff=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8ff1[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x18ff('0x0'));var util=require(_0x18ff('0x1'));var logger=require('../../config/logger')(_0x18ff('0x2'));var moment=require(_0x18ff('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x18ff('0x4'));var rimraf=require(_0x18ff('0x5'));var config=require(_0x18ff('0x6'));var attributes=require(_0x18ff('0x7'));module[_0x18ff('0x8')]=function(_0x44e890,_0xaaf956){return _0x44e890['define'](_0x18ff('0x9'),attributes,{'tableName':_0x18ff('0xa'),'paranoid':![],'indexes':[{'name':_0x18ff('0xb'),'fields':[_0x18ff('0xc'),'FieldId'],'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 047619b..80e3fa9 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 _0x7179=['code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x6c6382,_0x12923f){var _0x1d2bf5=function(_0x57ef96){while(--_0x57ef96){_0x6c6382['push'](_0x6c6382['shift']());}};_0x1d2bf5(++_0x12923f);}(_0x7179,0xb7));var _0x9717=function(_0x4a2125,_0x3b7b21){_0x4a2125=_0x4a2125-0x0;var _0x3de7a9=_0x7179[_0x4a2125];return _0x3de7a9;};'use strict';var _=require(_0x9717('0x0'));var util=require(_0x9717('0x1'));var moment=require(_0x9717('0x2'));var BPromise=require('bluebird');var rs=require(_0x9717('0x3'));var fs=require('fs');var Redis=require(_0x9717('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9717('0x5'));var logger=require(_0x9717('0x6'))(_0x9717('0x7'));var config=require(_0x9717('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52f3fb,_0x56c242,_0x4d3615){return new BPromise(function(_0x5b66c1,_0x41fd52){return client[_0x9717('0x9')](_0x52f3fb,_0x4d3615)['then'](function(_0x2ed790){logger[_0x9717('0xa')](_0x9717('0xb'),_0x56c242,_0x9717('0xc'));logger[_0x9717('0xd')](_0x9717('0xe'),_0x56c242,_0x9717('0xc'),JSON[_0x9717('0xf')](_0x2ed790));if(_0x2ed790['error']){if(_0x2ed790[_0x9717('0x10')][_0x9717('0x11')]===0x1f4){logger[_0x9717('0x10')](_0x9717('0xb'),_0x56c242,_0x2ed790[_0x9717('0x10')][_0x9717('0x12')]);return _0x41fd52(_0x2ed790[_0x9717('0x10')][_0x9717('0x12')]);}logger[_0x9717('0x10')](_0x9717('0xb'),_0x56c242,_0x2ed790[_0x9717('0x10')]['message']);return _0x5b66c1(_0x2ed790[_0x9717('0x10')]['message']);}else{logger['info'](_0x9717('0xb'),_0x56c242,_0x9717('0xc'));_0x5b66c1(_0x2ed790['result'][_0x9717('0x12')]);}})[_0x9717('0x13')](function(_0x2a79f8){logger[_0x9717('0x10')](_0x9717('0xb'),_0x56c242,_0x2a79f8);_0x41fd52(_0x2a79f8);});});} \ No newline at end of file +var _0x1bae=['moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x14ff4f,_0x3f1ed5){var _0x44358d=function(_0x348aa5){while(--_0x348aa5){_0x14ff4f['push'](_0x14ff4f['shift']());}};_0x44358d(++_0x3f1ed5);}(_0x1bae,0x155));var _0xe1ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1bae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe1ba('0x0'));var util=require('util');var moment=require(_0xe1ba('0x1'));var BPromise=require(_0xe1ba('0x2'));var rs=require(_0xe1ba('0x3'));var fs=require('fs');var Redis=require(_0xe1ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe1ba('0x5'));var config=require('../../config/environment');var jayson=require(_0xe1ba('0x6'));var client=jayson[_0xe1ba('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a6b1,_0x2f1896,_0x3f89f7){return new BPromise(function(_0x1df057,_0x3252f9){return client['request'](_0x3a6b1,_0x3f89f7)[_0xe1ba('0x8')](function(_0x19c75a){logger[_0xe1ba('0x9')](_0xe1ba('0xa'),_0x2f1896,_0xe1ba('0xb'));logger[_0xe1ba('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2f1896,_0xe1ba('0xb'),JSON['stringify'](_0x19c75a));if(_0x19c75a[_0xe1ba('0xd')]){if(_0x19c75a[_0xe1ba('0xd')][_0xe1ba('0xe')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x2f1896,_0x19c75a[_0xe1ba('0xd')][_0xe1ba('0xf')]);return _0x3252f9(_0x19c75a[_0xe1ba('0xd')]['message']);}logger[_0xe1ba('0xd')](_0xe1ba('0xa'),_0x2f1896,_0x19c75a['error']['message']);return _0x1df057(_0x19c75a[_0xe1ba('0xd')][_0xe1ba('0xf')]);}else{logger['info'](_0xe1ba('0xa'),_0x2f1896,_0xe1ba('0xb'));_0x1df057(_0x19c75a[_0xe1ba('0x10')][_0xe1ba('0xf')]);}})[_0xe1ba('0x11')](function(_0x1fd62e){logger[_0xe1ba('0xd')](_0xe1ba('0xa'),_0x2f1896,_0x1fd62e);_0x3252f9(_0x1fd62e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3cc6d09..cabe71b 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 _0x990e=['update','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','getConfigurations','getFields','post','addConfiguration'];(function(_0x2406b4,_0x2f9771){var _0x7f3752=function(_0x583971){while(--_0x583971){_0x2406b4['push'](_0x2406b4['shift']());}};_0x7f3752(++_0x2f9771);}(_0x990e,0x1a1));var _0xe990=function(_0x2a7998,_0x1b7a07){_0x2a7998=_0x2a7998-0x0;var _0x436f68=_0x990e[_0x2a7998];return _0x436f68;};'use strict';var multer=require(_0xe990('0x0'));var util=require('util');var path=require(_0xe990('0x1'));var timeout=require(_0xe990('0x2'));var express=require('express');var router=express[_0xe990('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe990('0x4'));var config=require(_0xe990('0x5'));var controller=require(_0xe990('0x6'));router[_0xe990('0x7')]('/',auth[_0xe990('0x8')](),controller[_0xe990('0x9')]);router['get'](_0xe990('0xa'),auth[_0xe990('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xe990('0x8')](),controller[_0xe990('0xb')]);router[_0xe990('0x7')]('/:id/fields',auth[_0xe990('0x8')](),controller[_0xe990('0xc')]);router['post']('/',auth[_0xe990('0x8')](),controller['create']);router[_0xe990('0xd')]('/:id/configurations',auth[_0xe990('0x8')](),controller[_0xe990('0xe')]);router['put'](_0xe990('0xa'),auth['isAuthenticated'](),controller[_0xe990('0xf')]);router['delete']('/:id',auth[_0xe990('0x8')](),controller[_0xe990('0x10')]);module[_0xe990('0x11')]=router; \ No newline at end of file +var _0x7410=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','exports','multer','connect-timeout'];(function(_0x4e2b76,_0x2413f5){var _0xc4186c=function(_0x35d551){while(--_0x35d551){_0x4e2b76['push'](_0x4e2b76['shift']());}};_0xc4186c(++_0x2413f5);}(_0x7410,0x1b6));var _0x0741=function(_0x3b7b9d,_0x126053){_0x3b7b9d=_0x3b7b9d-0x0;var _0x414d79=_0x7410[_0x3b7b9d];return _0x414d79;};'use strict';var multer=require(_0x0741('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0741('0x1'));var express=require('express');var router=express[_0x0741('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0741('0x3'));var interaction=require(_0x0741('0x4'));var config=require(_0x0741('0x5'));var controller=require(_0x0741('0x6'));router[_0x0741('0x7')]('/',auth[_0x0741('0x8')](),controller[_0x0741('0x9')]);router[_0x0741('0x7')](_0x0741('0xa'),auth[_0x0741('0x8')](),controller[_0x0741('0xb')]);router['get']('/:id/configurations',auth[_0x0741('0x8')](),controller[_0x0741('0xc')]);router[_0x0741('0x7')](_0x0741('0xd'),auth['isAuthenticated'](),controller[_0x0741('0xe')]);router[_0x0741('0xf')]('/',auth[_0x0741('0x8')](),controller[_0x0741('0x10')]);router[_0x0741('0xf')](_0x0741('0x11'),auth[_0x0741('0x8')](),controller[_0x0741('0x12')]);router[_0x0741('0x13')](_0x0741('0xa'),auth[_0x0741('0x8')](),controller[_0x0741('0x14')]);router['delete'](_0x0741('0xa'),auth[_0x0741('0x8')](),controller['destroy']);module[_0x0741('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 94b30a5..e42624d 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 _0xcd05=['STRING','sequelize'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xcd05,0x163));var _0x5cd0=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xcd05[_0x3a9635];return _0x10d08c;};'use strict';var Sequelize=require(_0x5cd0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5cd0('0x1')]},'remoteUri':{'type':Sequelize[_0x5cd0('0x1')]},'tenantId':{'type':Sequelize[_0x5cd0('0x1')]},'clientId':{'type':Sequelize[_0x5cd0('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5cd0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5cd0('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2cd3=['BOOLEAN','sequelize','STRING'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x2cd3,0xf1));var _0x32cd=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x2cd3[_0xadde88];return _0x3b8eb6;};'use strict';var Sequelize=require(_0x32cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x32cd('0x1')]},'username':{'type':Sequelize[_0x32cd('0x1')]},'password':{'type':Sequelize[_0x32cd('0x1')]},'remoteUri':{'type':Sequelize[_0x32cd('0x1')]},'tenantId':{'type':Sequelize[_0x32cd('0x1')]},'clientId':{'type':Sequelize[_0x32cd('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x32cd('0x1')]},'modernAuthentication':{'type':Sequelize[_0x32cd('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3daf9dd..4eeb0cd 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 _0xe37a=['params','keys','rawAttributes','create','body','find','Dynamics365Configuration','order','pick','getConfigurations','nolimit','findOne','AccountId','getSubjects','getDescriptions','channel','Dynamics365Field','Subjects','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','error','name','send','index','map','Dynamics365Account','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x134e96,_0x3298a6){var _0x3ab009=function(_0x5be510){while(--_0x5be510){_0x134e96['push'](_0x134e96['shift']());}};_0x3ab009(++_0x3298a6);}(_0xe37a,0x14d));var _0xae37=function(_0x2a7530,_0xe33b7a){_0x2a7530=_0x2a7530-0x0;var _0xd07720=_0xe37a[_0x2a7530];return _0xd07720;};'use strict';var rp=require(_0xae37('0x0'));var util=require(_0xae37('0x1'));var _=require(_0xae37('0x2'));var qs=require(_0xae37('0x3'));var logger=require(_0xae37('0x4'))(_0xae37('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x332cb0,_0x594282){_0x594282=_0x594282||0xc8;return function(_0x20ff05){if(_0x20ff05){return _0x332cb0[_0xae37('0x6')](_0x594282)[_0xae37('0x7')](_0x20ff05);}};}function respondWithFilteredResult(_0x3e2adc,_0x4b0b54){return function(_0x370c7d){if(_0x370c7d){var _0x20fd13=typeof _0x4b0b54[_0xae37('0x8')]===_0xae37('0x9')&&typeof _0x4b0b54[_0xae37('0xa')]==='undefined';var _0x307a79=_0x370c7d[_0xae37('0xb')];var _0xc6f230=_0x20fd13?0x0:_0x4b0b54['offset'];var _0x3f46ee=_0x20fd13?_0x370c7d['count']:_0x4b0b54[_0xae37('0x8')]+_0x4b0b54[_0xae37('0xa')];var _0x1681a0;if(_0x3f46ee>=_0x307a79){_0x3f46ee=_0x307a79;_0x1681a0=0xc8;}else{_0x1681a0=0xce;}_0x3e2adc[_0xae37('0x6')](_0x1681a0);return _0x3e2adc[_0xae37('0xc')](_0xae37('0xd'),_0xc6f230+'-'+_0x3f46ee+'/'+_0x307a79)[_0xae37('0x7')](_0x370c7d);}return null;};}function saveUpdates(_0x2879f6){return function(_0x198da5){if(_0x198da5){return _0x198da5['update'](_0x2879f6)[_0xae37('0xe')](function(_0x3940aa){return _0x3940aa;});}return null;};}function removeEntity(_0x37f52f){return function(_0x5a0eff){if(_0x5a0eff){return _0x5a0eff[_0xae37('0xf')]()[_0xae37('0xe')](function(){_0x37f52f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x573cfe){return function(_0x493f8b){if(!_0x493f8b){_0x573cfe[_0xae37('0x10')](0x194);}return _0x493f8b;};}function handleError(_0x3db85d,_0x34b9a1){_0x34b9a1=_0x34b9a1||0x1f4;return function(_0x157ce3){logger[_0xae37('0x11')](_0x157ce3['stack']);if(_0x157ce3[_0xae37('0x12')]){delete _0x157ce3[_0xae37('0x12')];}_0x3db85d[_0xae37('0x6')](_0x34b9a1)[_0xae37('0x13')](_0x157ce3);};}exports[_0xae37('0x14')]=function(_0x50c9e3,_0x4c8674){var _0x3524dd={},_0x1b0c17={},_0x3e3f9d={'count':0x0,'rows':[]};var _0x416b21=_[_0xae37('0x15')](db[_0xae37('0x16')]['rawAttributes'],function(_0x112131){return{'name':_0x112131['fieldName'],'type':_0x112131[_0xae37('0x17')][_0xae37('0x18')]};});_0x1b0c17[_0xae37('0x19')]=_['map'](_0x416b21,'name');_0x1b0c17[_0xae37('0x1a')]=_['keys'](_0x50c9e3['query']);_0x1b0c17[_0xae37('0x1b')]=_[_0xae37('0x1c')](_0x1b0c17[_0xae37('0x19')],_0x1b0c17['query']);_0x3524dd[_0xae37('0x1d')]=_['intersection'](_0x1b0c17[_0xae37('0x19')],qs[_0xae37('0x1e')](_0x50c9e3[_0xae37('0x1a')]['fields']));_0x3524dd['attributes']=_0x3524dd[_0xae37('0x1d')][_0xae37('0x1f')]?_0x3524dd[_0xae37('0x1d')]:_0x1b0c17[_0xae37('0x19')];if(!_0x50c9e3[_0xae37('0x1a')][_0xae37('0x20')]('nolimit')){_0x3524dd[_0xae37('0xa')]=qs[_0xae37('0xa')](_0x50c9e3['query'][_0xae37('0xa')]);_0x3524dd[_0xae37('0x8')]=qs[_0xae37('0x8')](_0x50c9e3[_0xae37('0x1a')][_0xae37('0x8')]);}_0x3524dd['order']=qs[_0xae37('0x21')](_0x50c9e3['query'][_0xae37('0x21')]);_0x3524dd['where']=qs[_0xae37('0x1b')](_['pick'](_0x50c9e3['query'],_0x1b0c17[_0xae37('0x1b')]),_0x416b21);if(_0x50c9e3['query'][_0xae37('0x22')]){_0x3524dd['where']=_[_0xae37('0x23')](_0x3524dd[_0xae37('0x24')],{'$or':_[_0xae37('0x15')](_0x416b21,function(_0x58b6db){if(_0x58b6db[_0xae37('0x17')]!==_0xae37('0x25')){var _0x270d42={};_0x270d42[_0x58b6db['name']]={'$like':'%'+_0x50c9e3[_0xae37('0x1a')][_0xae37('0x22')]+'%'};return _0x270d42;}})});}_0x3524dd=_[_0xae37('0x23')]({},_0x3524dd,_0x50c9e3[_0xae37('0x26')]);var _0x31c85f={'where':_0x3524dd[_0xae37('0x24')]};return db[_0xae37('0x16')][_0xae37('0xb')](_0x31c85f)['then'](function(_0x942d2){_0x3e3f9d[_0xae37('0xb')]=_0x942d2;if(_0x50c9e3[_0xae37('0x1a')][_0xae37('0x27')]){_0x3524dd[_0xae37('0x28')]=[{'all':!![]}];}return db[_0xae37('0x16')][_0xae37('0x29')](_0x3524dd);})[_0xae37('0xe')](function(_0x587771){_0x3e3f9d[_0xae37('0x2a')]=_0x587771;return _0x3e3f9d;})[_0xae37('0xe')](respondWithFilteredResult(_0x4c8674,_0x3524dd))[_0xae37('0x2b')](handleError(_0x4c8674,null));};exports[_0xae37('0x2c')]=function(_0xbf1e85,_0xabf47e){var _0x49c4e3={'raw':![],'where':{'id':_0xbf1e85[_0xae37('0x2d')]['id']}},_0x1110cf={};_0x1110cf[_0xae37('0x19')]=_[_0xae37('0x2e')](db[_0xae37('0x16')][_0xae37('0x2f')]);_0x1110cf[_0xae37('0x1a')]=_[_0xae37('0x2e')](_0xbf1e85['query']);_0x1110cf[_0xae37('0x1b')]=_[_0xae37('0x1c')](_0x1110cf[_0xae37('0x19')],_0x1110cf['query']);_0x49c4e3['attributes']=_[_0xae37('0x1c')](_0x1110cf['model'],qs[_0xae37('0x1e')](_0xbf1e85[_0xae37('0x1a')][_0xae37('0x1e')]));_0x49c4e3['attributes']=_0x49c4e3[_0xae37('0x1d')][_0xae37('0x1f')]?_0x49c4e3['attributes']:_0x1110cf['model'];if(_0xbf1e85[_0xae37('0x1a')][_0xae37('0x27')]){_0x49c4e3[_0xae37('0x28')]=[{'all':!![]}];}_0x49c4e3=_['merge']({},_0x49c4e3,_0xbf1e85[_0xae37('0x26')]);return db[_0xae37('0x16')]['find'](_0x49c4e3)['then'](handleEntityNotFound(_0xabf47e,null))['then'](respondWithResult(_0xabf47e,null))[_0xae37('0x2b')](handleError(_0xabf47e,null));};exports[_0xae37('0x30')]=function(_0x2bd400,_0xe542b5){return db[_0xae37('0x16')][_0xae37('0x30')](_0x2bd400['body'],{})[_0xae37('0xe')](respondWithResult(_0xe542b5,0xc9))[_0xae37('0x2b')](handleError(_0xe542b5,null));};exports['update']=function(_0x2e7b6f,_0x58b0a9){if(_0x2e7b6f[_0xae37('0x31')]['id']){delete _0x2e7b6f[_0xae37('0x31')]['id'];}return db[_0xae37('0x16')][_0xae37('0x32')]({'where':{'id':_0x2e7b6f[_0xae37('0x2d')]['id']}})[_0xae37('0xe')](handleEntityNotFound(_0x58b0a9,null))[_0xae37('0xe')](saveUpdates(_0x2e7b6f['body'],null))[_0xae37('0xe')](respondWithResult(_0x58b0a9,null))[_0xae37('0x2b')](handleError(_0x58b0a9,null));};exports[_0xae37('0xf')]=function(_0x4601c1,_0x286daa){return db[_0xae37('0x16')][_0xae37('0x32')]({'where':{'id':_0x4601c1[_0xae37('0x2d')]['id']}})['then'](handleEntityNotFound(_0x286daa,null))[_0xae37('0xe')](removeEntity(_0x286daa,null))[_0xae37('0x2b')](handleError(_0x286daa,null));};exports['getConfigurations']=function(_0x5289e8,_0x597e4d){var _0x505367={};var _0x24beeb={};var _0x969206;var _0x156b1c;return db[_0xae37('0x16')]['findOne']({'where':{'id':_0x5289e8[_0xae37('0x2d')]['id']}})[_0xae37('0xe')](handleEntityNotFound(_0x597e4d,null))[_0xae37('0xe')](function(_0xd711d3){if(_0xd711d3){_0x969206=_0xd711d3;_0x24beeb['model']=_[_0xae37('0x2e')](db[_0xae37('0x33')][_0xae37('0x2f')]);_0x24beeb[_0xae37('0x1a')]=_['keys'](_0x5289e8[_0xae37('0x1a')]);_0x24beeb['filters']=_[_0xae37('0x1c')](_0x24beeb[_0xae37('0x19')],_0x24beeb[_0xae37('0x1a')]);_0x505367[_0xae37('0x1d')]=_[_0xae37('0x1c')](_0x24beeb[_0xae37('0x19')],qs[_0xae37('0x1e')](_0x5289e8[_0xae37('0x1a')][_0xae37('0x1e')]));_0x505367['attributes']=_0x505367[_0xae37('0x1d')]['length']?_0x505367[_0xae37('0x1d')]:_0x24beeb[_0xae37('0x19')];_0x505367[_0xae37('0x34')]=qs['sort'](_0x5289e8[_0xae37('0x1a')][_0xae37('0x21')]);_0x505367['where']=qs['filters'](_[_0xae37('0x35')](_0x5289e8[_0xae37('0x1a')],_0x24beeb[_0xae37('0x1b')]));if(_0x5289e8['query'][_0xae37('0x22')]){_0x505367[_0xae37('0x24')]=_[_0xae37('0x23')](_0x505367[_0xae37('0x24')],{'$or':_['map'](_0x505367[_0xae37('0x1d')],function(_0x3de8d4){var _0x551d6d={};_0x551d6d[_0x3de8d4]={'$like':'%'+_0x5289e8['query']['filter']+'%'};return _0x551d6d;})});}_0x505367=_[_0xae37('0x23')]({},_0x505367,_0x5289e8[_0xae37('0x26')]);return _0x969206[_0xae37('0x36')](_0x505367);}})[_0xae37('0xe')](function(_0x2fe63e){if(_0x2fe63e){_0x156b1c=_0x2fe63e['length'];if(!_0x5289e8[_0xae37('0x1a')][_0xae37('0x20')](_0xae37('0x37'))){_0x505367['limit']=qs[_0xae37('0xa')](_0x5289e8[_0xae37('0x1a')][_0xae37('0xa')]);_0x505367['offset']=qs['offset'](_0x5289e8[_0xae37('0x1a')]['offset']);}return _0x969206[_0xae37('0x36')](_0x505367);}})[_0xae37('0xe')](function(_0xea3857){if(_0xea3857){return _0xea3857?{'count':_0x156b1c,'rows':_0xea3857}:null;}})[_0xae37('0xe')](respondWithResult(_0x597e4d,null))['catch'](handleError(_0x597e4d,null));};exports['addConfiguration']=function(_0x3aac17,_0x418bfc){if(_0x3aac17[_0xae37('0x31')]['id']){delete _0x3aac17[_0xae37('0x31')]['id'];}return db['Dynamics365Account'][_0xae37('0x38')]({'where':{'id':_0x3aac17[_0xae37('0x2d')]['id']}})[_0xae37('0xe')](handleEntityNotFound(_0x418bfc,null))[_0xae37('0xe')](function(_0x50138a){if(_0x50138a){_0x3aac17[_0xae37('0x31')][_0xae37('0x39')]=_0x50138a['id'];_0x3aac17['body']['Subjects']=integrations[_0xae37('0x3a')](_0x3aac17[_0xae37('0x31')]['channel'],_0x3aac17[_0xae37('0x31')]['type']);_0x3aac17[_0xae37('0x31')]['Descriptions']=integrations[_0xae37('0x3b')](_0x3aac17[_0xae37('0x31')][_0xae37('0x3c')],_0x3aac17[_0xae37('0x31')]['type']);return db[_0xae37('0x33')][_0xae37('0x30')](_0x3aac17[_0xae37('0x31')],{'include':[{'model':db[_0xae37('0x3d')],'as':_0xae37('0x3e')},{'model':db[_0xae37('0x3d')],'as':_0xae37('0x3f')}]});}return null;})[_0xae37('0xe')](respondWithResult(_0x418bfc,null))[_0xae37('0x2b')](handleError(_0x418bfc,null));};function sanitizeRemoteUri(_0x57d822){var _0x3d723b=_0x57d822[_0xae37('0x40')](-0x1);if(_0x3d723b==='/')return _0x57d822[_0xae37('0x41')](0x0,_0x57d822[_0xae37('0x42')](_0x3d723b));return _0x57d822;}function getWebApiUrl(_0x36765d){return util[_0xae37('0x43')](_0xae37('0x44'),_0x36765d);}exports['getFields']=function(_0x25c047,_0x3a537a){var _0x36f1eb=_0x25c047[_0xae37('0x1a')][_0xae37('0x45')];var _0x1ee168=_0x36f1eb===_0xae37('0x46')?_0xae37('0x47'):_0xae37('0x48');var _0x9ae56f='';var _0x13588e='';var _0x199a4a='';var _0x33d0fb='';var _0x5a719c='';var _0x411a5e='';var _0xfb6f98='';var _0x28979c='';var _0xf190ad=[_0xae37('0x49'),_0xae37('0x4a'),_0xae37('0x4b'),'ownerid','caseorigincode',_0xae37('0x4c'),_0xae37('0x4d'),_0xae37('0x4e'),'directioncode',_0xae37('0x4f')];var _0x1e8add=[_0xae37('0x50'),'accountidyominame',_0xae37('0x51'),'billedserviceunits',_0xae37('0x52'),_0xae37('0x53'),_0xae37('0x54'),'contractidname',_0xae37('0x55'),_0xae37('0x56'),_0xae37('0x57'),_0xae37('0x58'),_0xae37('0x59'),_0xae37('0x5a'),_0xae37('0x5b'),'customeridname',_0xae37('0x5c'),_0xae37('0x5d'),_0xae37('0x5e'),_0xae37('0x5f'),_0xae37('0x60'),_0xae37('0x61'),_0xae37('0x62'),'exchangerate',_0xae37('0x63'),'followupby',_0xae37('0x64'),_0xae37('0x65'),_0xae37('0x66'),_0xae37('0x67'),'masteridname',_0xae37('0x68'),_0xae37('0x69'),_0xae37('0x6a'),_0xae37('0x6b'),_0xae37('0x6c'),_0xae37('0x6d'),'modifiedonbehalfbyyominame',_0xae37('0x6e'),_0xae37('0x6f'),_0xae37('0x70'),_0xae37('0x71'),_0xae37('0x72'),_0xae37('0x73'),'owneridtype',_0xae37('0x74'),_0xae37('0x75'),_0xae37('0x76'),_0xae37('0x77'),'prioritycodename',_0xae37('0x78'),_0xae37('0x79'),'resolveby',_0xae37('0x7a'),_0xae37('0x7b'),_0xae37('0x7c'),_0xae37('0x7d'),_0xae37('0x7e'),_0xae37('0x7f'),_0xae37('0x80'),_0xae37('0x81'),_0xae37('0x82'),_0xae37('0x83'),_0xae37('0x84'),_0xae37('0x85'),_0xae37('0x86'),_0xae37('0x87'),_0xae37('0x88'),'utcconversiontimezonecode','versionnumber'];var _0x2ec64d=_0xf190ad[_0xae37('0x89')](_0x1e8add);return db[_0xae37('0x16')][_0xae37('0x38')]({'where':{'id':_0x25c047[_0xae37('0x2d')]['id']},'attributes':['id',_0xae37('0x8a'),_0xae37('0x8b'),_0xae37('0x8c'),'tenantId',_0xae37('0x8d'),_0xae37('0x8e'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0xae37('0x8f'),'attributes':['id',_0xae37('0x90'),_0xae37('0x91')]}]})[_0xae37('0xe')](handleEntityNotFound(_0x3a537a,null))[_0xae37('0xe')](function(_0x3bf922){if(_0x3bf922){if(_0x3bf922[_0xae37('0x92')]){_0x3bf922[_0xae37('0x93')]=_0x3bf922[_0xae37('0x8f')][_0xae37('0x90')];_0x28979c=sanitizeRemoteUri(_0x3bf922['CloudProvider'][_0xae37('0x91')]);_0xfb6f98=getWebApiUrl(_0x28979c);return _0x3bf922;}_0x28979c=sanitizeRemoteUri(_0x3bf922[_0xae37('0x8c')]);_0xfb6f98=getWebApiUrl(_0x28979c);var _0xf792b={'method':_0xae37('0x94'),'uri':_0xae37('0x95')+_0x3bf922['tenantId']+_0xae37('0x96'),'form':{'client_id':_0x3bf922[_0xae37('0x8d')],'resource':_0x28979c,'username':_0x3bf922['username'],'password':_0x3bf922[_0xae37('0x8b')],'grant_type':_0xae37('0x8b'),'client_secret':_0x3bf922['clientSecret']},'json':!![]};return rp(_0xf792b);}})['then'](function(_0x1d262d){_0x411a5e=_0x1d262d['access_token'];var _0x5a0bc3={'method':_0xae37('0x97'),'uri':encodeURI(_0xfb6f98+_0xae37('0x98')+_0x1ee168+'\x27'),'headers':{'Authorization':_0xae37('0x99')+_0x411a5e,'If-None-Match':null,'OData-Version':_0xae37('0x9a')},'json':!![]};return rp(_0x5a0bc3);})[_0xae37('0xe')](function(_0x21f826){var _0x811e1b=_0x21f826[_0xae37('0x9b')][0x0];var _0x288ad9=_0x811e1b[_0xae37('0x9c')];var _0x17bc15={'method':_0xae37('0x97'),'uri':_0xfb6f98+'EntityDefinitions('+_0x288ad9+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xae37('0x99')+_0x411a5e,'If-None-Match':null,'OData-Version':_0xae37('0x9a')},'json':!![]};return rp(_0x17bc15);})['then'](function(_0xd9ae5){_0x9ae56f=_0xd9ae5;_0x13588e=_0x9ae56f['Attributes'];_0x13588e=_[_0xae37('0x9d')](_0x13588e,function(_0x6225cc){return!_0x2ec64d[_0xae37('0x9e')](_0x6225cc[_0xae37('0x9f')]);});var _0x24d361=[];var _0x5c90f5=[];_0x13588e[_0xae37('0xa0')](function(_0x46350a){if(_0x46350a[_0xae37('0xa1')]){var _0x57e53c=_0x46350a['@odata.type'][_0xae37('0x41')](_0x46350a[_0xae37('0xa1')][_0xae37('0x42')]('.')+0x1);if(_0x57e53c===_0xae37('0xa2')){_0x24d361[_0xae37('0xa3')](getSelectList(_0xfb6f98,_0x36f1eb,_0x5c90f5,_0x9ae56f[_0xae37('0x9c')],_0x46350a[_0xae37('0x9c')],_0x411a5e));}}});return Promise[_0xae37('0xa4')](_0x24d361);})[_0xae37('0xe')](function(_0x9e4ee5){_0x199a4a=_0x9e4ee5[0x0];var _0xb99f31=[];var _0x1ab9a6=[];_0x13588e[_0xae37('0xa0')](function(_0x2c2124){if(!_['isNil'](_0x2c2124[_0xae37('0xa1')])){var _0xb8ba14=_0x2c2124['@odata.type'][_0xae37('0x41')](_0x2c2124[_0xae37('0xa1')][_0xae37('0x42')]('.')+0x1);if(_0xb8ba14===_0xae37('0xa5')){_0xb99f31['push'](getBooleanList(_0xfb6f98,_0x36f1eb,_0x1ab9a6,_0x9ae56f[_0xae37('0x9c')],_0x2c2124['MetadataId'],_0x411a5e));}}});return Promise['all'](_0xb99f31);})[_0xae37('0xe')](function(_0x42db3a){_0x33d0fb=_0x42db3a[0x0];var _0x1090ab=[];var _0x32d8d9=[];_0x13588e['forEach'](function(_0x42a9fd){if(_0x42a9fd[_0xae37('0xa1')]){var _0x55b497=_0x42a9fd[_0xae37('0xa1')][_0xae37('0x41')](_0x42a9fd[_0xae37('0xa1')][_0xae37('0x42')]('.')+0x1);if(_0x55b497===_0xae37('0xa6')||_0x55b497==='DoubleAttributeMetadata'||_0x55b497===_0xae37('0xa7')||_0x55b497===_0xae37('0xa8')||_0x55b497===_0xae37('0xa9')||_0x55b497===_0xae37('0xaa')||_0x55b497==='StatusAttributeMetadata'||_0x55b497==='EntityNameAttributeMetadata'||_0x55b497===_0xae37('0xab')||_0x55b497===_0xae37('0xac')){_0x1090ab[_0xae37('0xa3')](getInputList(_0xfb6f98,_0x36f1eb,_0x55b497,_0x32d8d9,_0x9ae56f['MetadataId'],_0x42a9fd[_0xae37('0x9c')],_0x411a5e));}}});return Promise[_0xae37('0xa4')](_0x1090ab);})['then'](function(_0x2c3a8c){_0x5a719c=_0x2c3a8c[0x0];var _0x73fad9=_0x199a4a[_0xae37('0x89')](_0x33d0fb)[_0xae37('0x89')](_0x5a719c);var _0x251957={'count':_0x73fad9[_0xae37('0x1f')],'rows':_0x73fad9};return _0x251957;})[_0xae37('0xe')](respondWithResult(_0x3a537a,null))[_0xae37('0x2b')](function(_0x1c6acc){var _0x45616c=_0x25c047[_0xae37('0x1a')]['test']?0x1f4:_0x1c6acc[_0xae37('0xad')]||0x1f4;logger['error'](_0x1c6acc[_0xae37('0xae')]);delete _0x1c6acc['name'];if(_0x45616c===0x191){_0x45616c=0x190;}_0x3a537a['status'](_0x45616c)[_0xae37('0x13')](_0x25c047['query'][_0xae37('0xaf')]?{'message':_0xae37('0xb0'),'statusCode':_0x1c6acc[_0xae37('0xad')]}:_0x1c6acc);});};function getSelectList(_0x56e657,_0x12d0fc,_0x4263ae,_0x1ee5fa,_0x271279,_0x163b03){var _0x539b09={'method':_0xae37('0x97'),'uri':_0x56e657+_0xae37('0xb1')+_0x1ee5fa+_0xae37('0xb2')+_0x271279+_0xae37('0xb3')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x163b03,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x539b09)[_0xae37('0xe')](function(_0x2384f3){var _0x48f477=[];var _0x408957=_0x2384f3[_0xae37('0xb4')]['Options'];_0x408957['forEach'](function(_0x39fb83){_0x48f477[_0xae37('0xa3')]({'name':_0x39fb83[_0xae37('0xb5')][_0xae37('0xb6')]['Label'],'value':String(_0x39fb83[_0xae37('0xb7')])});});var _0x194f13={'id':_0x12d0fc+'_'+_0x2384f3['LogicalName'],'name':_0x2384f3[_0xae37('0xb8')][_0xae37('0xb6')][_0xae37('0xb5')],'custom':![],'options':_0x48f477};_0x4263ae['push'](_0x194f13);return _0x4263ae;});}function getBooleanList(_0x1d01de,_0x9631b7,_0x36cd50,_0x5c103f,_0x369b00,_0x282cde){var _0x21bfa3={'method':_0xae37('0x97'),'uri':_0x1d01de+_0xae37('0xb1')+_0x5c103f+_0xae37('0xb2')+_0x369b00+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xae37('0x99')+_0x282cde,'If-None-Match':null,'OData-Version':_0xae37('0x9a')},'json':!![]};return rp(_0x21bfa3)[_0xae37('0xe')](function(_0x2d20d0){var _0x190c7c=[];_0x190c7c['push']({'name':_0x2d20d0['OptionSet']['TrueOption'][_0xae37('0xb5')][_0xae37('0xb6')]['Label'],'value':_0xae37('0xb9')},{'name':_0x2d20d0[_0xae37('0xb4')][_0xae37('0xba')][_0xae37('0xb5')][_0xae37('0xb6')][_0xae37('0xb5')],'value':'false'});var _0x1168f3={'id':_0x9631b7+'_'+_0x2d20d0[_0xae37('0x9f')],'name':_0x2d20d0[_0xae37('0xb8')][_0xae37('0xb6')][_0xae37('0xb5')],'custom':![],'options':_0x190c7c};_0x36cd50['push'](_0x1168f3);return _0x36cd50;});}function getInputList(_0x48d2da,_0xac7a27,_0x434c81,_0x3ec5fa,_0x522a84,_0x128482,_0x407f32){var _0x1dc6ab={'method':_0xae37('0x97'),'uri':_0x48d2da+_0xae37('0xb1')+_0x522a84+_0xae37('0xb2')+_0x128482+_0xae37('0xbb')+_0x434c81+_0xae37('0xbc'),'headers':{'Authorization':_0xae37('0x99')+_0x407f32,'If-None-Match':null,'OData-Version':_0xae37('0x9a')},'json':!![]};return rp(_0x1dc6ab)[_0xae37('0xe')](function(_0x37390b){var _0x39b802={'id':_0xac7a27+'_'+_0x37390b[_0xae37('0x9f')],'name':_0x37390b[_0xae37('0xb8')][_0xae37('0xb6')]?_0x37390b[_0xae37('0xb8')]['UserLocalizedLabel'][_0xae37('0xb5')]:_0x37390b['LogicalName'],'custom':![],'options':[]};_0x3ec5fa['push'](_0x39b802);return _0x3ec5fa;});} \ No newline at end of file +var _0x66ce=['statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Label','DisplayName','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','destroy','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','clientId','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','isNil','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test'];(function(_0x2a7268,_0x1d3bb){var _0x62c89d=function(_0x23a71d){while(--_0x23a71d){_0x2a7268['push'](_0x2a7268['shift']());}};_0x62c89d(++_0x1d3bb);}(_0x66ce,0x181));var _0xe66c=function(_0x23b946,_0x2653e1){_0x23b946=_0x23b946-0x0;var _0xcfad4f=_0x66ce[_0x23b946];return _0xcfad4f;};'use strict';var rp=require(_0xe66c('0x0'));var util=require('util');var _=require(_0xe66c('0x1'));var qs=require(_0xe66c('0x2'));var logger=require(_0xe66c('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0xe66c('0x4'));function respondWithResult(_0x732e12,_0x5525a1){_0x5525a1=_0x5525a1||0xc8;return function(_0x46a727){if(_0x46a727){return _0x732e12[_0xe66c('0x5')](_0x5525a1)[_0xe66c('0x6')](_0x46a727);}};}function respondWithFilteredResult(_0x3959e8,_0x251a89){return function(_0x37d226){if(_0x37d226){var _0x135bc8=typeof _0x251a89[_0xe66c('0x7')]==='undefined'&&typeof _0x251a89[_0xe66c('0x8')]===_0xe66c('0x9');var _0x3b4bd1=_0x37d226['count'];var _0x5b9737=_0x135bc8?0x0:_0x251a89[_0xe66c('0x7')];var _0x3c4952=_0x135bc8?_0x37d226[_0xe66c('0xa')]:_0x251a89[_0xe66c('0x7')]+_0x251a89[_0xe66c('0x8')];var _0x522259;if(_0x3c4952>=_0x3b4bd1){_0x3c4952=_0x3b4bd1;_0x522259=0xc8;}else{_0x522259=0xce;}_0x3959e8[_0xe66c('0x5')](_0x522259);return _0x3959e8[_0xe66c('0xb')](_0xe66c('0xc'),_0x5b9737+'-'+_0x3c4952+'/'+_0x3b4bd1)[_0xe66c('0x6')](_0x37d226);}return null;};}function saveUpdates(_0x446a9d){return function(_0x7d2c12){if(_0x7d2c12){return _0x7d2c12[_0xe66c('0xd')](_0x446a9d)[_0xe66c('0xe')](function(_0x20b93c){return _0x20b93c;});}return null;};}function removeEntity(_0x5d7b57){return function(_0x3f0c21){if(_0x3f0c21){return _0x3f0c21['destroy']()[_0xe66c('0xe')](function(){_0x5d7b57[_0xe66c('0x5')](0xcc)[_0xe66c('0xf')]();});}};}function handleEntityNotFound(_0xec1a60){return function(_0x3ffdce){if(!_0x3ffdce){_0xec1a60[_0xe66c('0x10')](0x194);}return _0x3ffdce;};}function handleError(_0xbf3fcb,_0x5cd624){_0x5cd624=_0x5cd624||0x1f4;return function(_0xaf62e8){logger[_0xe66c('0x11')](_0xaf62e8[_0xe66c('0x12')]);if(_0xaf62e8[_0xe66c('0x13')]){delete _0xaf62e8[_0xe66c('0x13')];}_0xbf3fcb[_0xe66c('0x5')](_0x5cd624)[_0xe66c('0x14')](_0xaf62e8);};}exports['index']=function(_0xf12916,_0x5e920c){var _0x3b421a={},_0xe96d50={},_0xf16cda={'count':0x0,'rows':[]};var _0x52277e=_[_0xe66c('0x15')](db[_0xe66c('0x16')][_0xe66c('0x17')],function(_0x13b744){return{'name':_0x13b744[_0xe66c('0x18')],'type':_0x13b744[_0xe66c('0x19')][_0xe66c('0x1a')]};});_0xe96d50[_0xe66c('0x1b')]=_[_0xe66c('0x15')](_0x52277e,_0xe66c('0x13'));_0xe96d50['query']=_[_0xe66c('0x1c')](_0xf12916[_0xe66c('0x1d')]);_0xe96d50[_0xe66c('0x1e')]=_[_0xe66c('0x1f')](_0xe96d50['model'],_0xe96d50[_0xe66c('0x1d')]);_0x3b421a['attributes']=_[_0xe66c('0x1f')](_0xe96d50[_0xe66c('0x1b')],qs[_0xe66c('0x20')](_0xf12916['query']['fields']));_0x3b421a['attributes']=_0x3b421a[_0xe66c('0x21')][_0xe66c('0x22')]?_0x3b421a['attributes']:_0xe96d50[_0xe66c('0x1b')];if(!_0xf12916[_0xe66c('0x1d')][_0xe66c('0x23')](_0xe66c('0x24'))){_0x3b421a[_0xe66c('0x8')]=qs[_0xe66c('0x8')](_0xf12916[_0xe66c('0x1d')][_0xe66c('0x8')]);_0x3b421a['offset']=qs['offset'](_0xf12916[_0xe66c('0x1d')][_0xe66c('0x7')]);}_0x3b421a[_0xe66c('0x25')]=qs['sort'](_0xf12916[_0xe66c('0x1d')][_0xe66c('0x26')]);_0x3b421a['where']=qs[_0xe66c('0x1e')](_[_0xe66c('0x27')](_0xf12916[_0xe66c('0x1d')],_0xe96d50[_0xe66c('0x1e')]),_0x52277e);if(_0xf12916[_0xe66c('0x1d')]['filter']){_0x3b421a[_0xe66c('0x28')]=_[_0xe66c('0x29')](_0x3b421a[_0xe66c('0x28')],{'$or':_[_0xe66c('0x15')](_0x52277e,function(_0x2c1b9f){if(_0x2c1b9f[_0xe66c('0x19')]!==_0xe66c('0x2a')){var _0x1d8ec7={};_0x1d8ec7[_0x2c1b9f['name']]={'$like':'%'+_0xf12916[_0xe66c('0x1d')][_0xe66c('0x2b')]+'%'};return _0x1d8ec7;}})});}_0x3b421a=_['merge']({},_0x3b421a,_0xf12916['options']);var _0x4ab4be={'where':_0x3b421a[_0xe66c('0x28')]};return db['Dynamics365Account'][_0xe66c('0xa')](_0x4ab4be)[_0xe66c('0xe')](function(_0x411666){_0xf16cda['count']=_0x411666;if(_0xf12916['query'][_0xe66c('0x2c')]){_0x3b421a[_0xe66c('0x2d')]=[{'all':!![]}];}return db[_0xe66c('0x16')][_0xe66c('0x2e')](_0x3b421a);})['then'](function(_0xe4b750){_0xf16cda[_0xe66c('0x2f')]=_0xe4b750;return _0xf16cda;})[_0xe66c('0xe')](respondWithFilteredResult(_0x5e920c,_0x3b421a))['catch'](handleError(_0x5e920c,null));};exports[_0xe66c('0x30')]=function(_0x5bcceb,_0x167634){var _0x46a292={'raw':![],'where':{'id':_0x5bcceb[_0xe66c('0x31')]['id']}},_0x3258ea={};_0x3258ea[_0xe66c('0x1b')]=_[_0xe66c('0x1c')](db[_0xe66c('0x16')][_0xe66c('0x17')]);_0x3258ea[_0xe66c('0x1d')]=_[_0xe66c('0x1c')](_0x5bcceb[_0xe66c('0x1d')]);_0x3258ea[_0xe66c('0x1e')]=_[_0xe66c('0x1f')](_0x3258ea['model'],_0x3258ea['query']);_0x46a292[_0xe66c('0x21')]=_[_0xe66c('0x1f')](_0x3258ea[_0xe66c('0x1b')],qs[_0xe66c('0x20')](_0x5bcceb[_0xe66c('0x1d')][_0xe66c('0x20')]));_0x46a292[_0xe66c('0x21')]=_0x46a292['attributes'][_0xe66c('0x22')]?_0x46a292[_0xe66c('0x21')]:_0x3258ea[_0xe66c('0x1b')];if(_0x5bcceb[_0xe66c('0x1d')][_0xe66c('0x2c')]){_0x46a292[_0xe66c('0x2d')]=[{'all':!![]}];}_0x46a292=_[_0xe66c('0x29')]({},_0x46a292,_0x5bcceb[_0xe66c('0x32')]);return db[_0xe66c('0x16')][_0xe66c('0x33')](_0x46a292)[_0xe66c('0xe')](handleEntityNotFound(_0x167634,null))[_0xe66c('0xe')](respondWithResult(_0x167634,null))[_0xe66c('0x34')](handleError(_0x167634,null));};exports[_0xe66c('0x35')]=function(_0x5f16e4,_0x1ff03e){return db[_0xe66c('0x16')][_0xe66c('0x35')](_0x5f16e4[_0xe66c('0x36')],{})[_0xe66c('0xe')](respondWithResult(_0x1ff03e,0xc9))[_0xe66c('0x34')](handleError(_0x1ff03e,null));};exports[_0xe66c('0xd')]=function(_0x51a5a4,_0x12212f){if(_0x51a5a4['body']['id']){delete _0x51a5a4[_0xe66c('0x36')]['id'];}return db[_0xe66c('0x16')][_0xe66c('0x33')]({'where':{'id':_0x51a5a4[_0xe66c('0x31')]['id']}})['then'](handleEntityNotFound(_0x12212f,null))['then'](saveUpdates(_0x51a5a4[_0xe66c('0x36')],null))[_0xe66c('0xe')](respondWithResult(_0x12212f,null))[_0xe66c('0x34')](handleError(_0x12212f,null));};exports[_0xe66c('0x37')]=function(_0x4bec40,_0x165212){return db[_0xe66c('0x16')][_0xe66c('0x33')]({'where':{'id':_0x4bec40[_0xe66c('0x31')]['id']}})[_0xe66c('0xe')](handleEntityNotFound(_0x165212,null))[_0xe66c('0xe')](removeEntity(_0x165212,null))[_0xe66c('0x34')](handleError(_0x165212,null));};exports[_0xe66c('0x38')]=function(_0x534f7c,_0x93fb27){var _0xfcb1d7={};var _0x512386={};var _0x2ff848;var _0xe6d333;return db[_0xe66c('0x16')]['findOne']({'where':{'id':_0x534f7c[_0xe66c('0x31')]['id']}})[_0xe66c('0xe')](handleEntityNotFound(_0x93fb27,null))[_0xe66c('0xe')](function(_0x5efefd){if(_0x5efefd){_0x2ff848=_0x5efefd;_0x512386[_0xe66c('0x1b')]=_['keys'](db[_0xe66c('0x39')][_0xe66c('0x17')]);_0x512386[_0xe66c('0x1d')]=_[_0xe66c('0x1c')](_0x534f7c['query']);_0x512386['filters']=_['intersection'](_0x512386[_0xe66c('0x1b')],_0x512386[_0xe66c('0x1d')]);_0xfcb1d7[_0xe66c('0x21')]=_[_0xe66c('0x1f')](_0x512386[_0xe66c('0x1b')],qs[_0xe66c('0x20')](_0x534f7c[_0xe66c('0x1d')][_0xe66c('0x20')]));_0xfcb1d7[_0xe66c('0x21')]=_0xfcb1d7[_0xe66c('0x21')][_0xe66c('0x22')]?_0xfcb1d7['attributes']:_0x512386[_0xe66c('0x1b')];_0xfcb1d7[_0xe66c('0x25')]=qs[_0xe66c('0x26')](_0x534f7c['query']['sort']);_0xfcb1d7[_0xe66c('0x28')]=qs['filters'](_[_0xe66c('0x27')](_0x534f7c['query'],_0x512386['filters']));if(_0x534f7c[_0xe66c('0x1d')][_0xe66c('0x2b')]){_0xfcb1d7[_0xe66c('0x28')]=_[_0xe66c('0x29')](_0xfcb1d7['where'],{'$or':_[_0xe66c('0x15')](_0xfcb1d7[_0xe66c('0x21')],function(_0x42e190){var _0xca7ef2={};_0xca7ef2[_0x42e190]={'$like':'%'+_0x534f7c[_0xe66c('0x1d')][_0xe66c('0x2b')]+'%'};return _0xca7ef2;})});}_0xfcb1d7=_[_0xe66c('0x29')]({},_0xfcb1d7,_0x534f7c[_0xe66c('0x32')]);return _0x2ff848[_0xe66c('0x38')](_0xfcb1d7);}})[_0xe66c('0xe')](function(_0x2d411c){if(_0x2d411c){_0xe6d333=_0x2d411c[_0xe66c('0x22')];if(!_0x534f7c[_0xe66c('0x1d')]['hasOwnProperty'](_0xe66c('0x24'))){_0xfcb1d7[_0xe66c('0x8')]=qs['limit'](_0x534f7c[_0xe66c('0x1d')][_0xe66c('0x8')]);_0xfcb1d7['offset']=qs[_0xe66c('0x7')](_0x534f7c[_0xe66c('0x1d')]['offset']);}return _0x2ff848[_0xe66c('0x38')](_0xfcb1d7);}})[_0xe66c('0xe')](function(_0x3c9d11){if(_0x3c9d11){return _0x3c9d11?{'count':_0xe6d333,'rows':_0x3c9d11}:null;}})[_0xe66c('0xe')](respondWithResult(_0x93fb27,null))['catch'](handleError(_0x93fb27,null));};exports['addConfiguration']=function(_0xccc771,_0x41e53d){if(_0xccc771[_0xe66c('0x36')]['id']){delete _0xccc771['body']['id'];}return db[_0xe66c('0x16')][_0xe66c('0x3a')]({'where':{'id':_0xccc771[_0xe66c('0x31')]['id']}})[_0xe66c('0xe')](handleEntityNotFound(_0x41e53d,null))[_0xe66c('0xe')](function(_0x47c8e9){if(_0x47c8e9){_0xccc771['body'][_0xe66c('0x3b')]=_0x47c8e9['id'];_0xccc771[_0xe66c('0x36')][_0xe66c('0x3c')]=integrations[_0xe66c('0x3d')](_0xccc771[_0xe66c('0x36')]['channel'],_0xccc771[_0xe66c('0x36')][_0xe66c('0x19')]);_0xccc771['body']['Descriptions']=integrations[_0xe66c('0x3e')](_0xccc771[_0xe66c('0x36')][_0xe66c('0x3f')],_0xccc771[_0xe66c('0x36')][_0xe66c('0x19')]);return db['Dynamics365Configuration'][_0xe66c('0x35')](_0xccc771[_0xe66c('0x36')],{'include':[{'model':db[_0xe66c('0x40')],'as':_0xe66c('0x3c')},{'model':db['Dynamics365Field'],'as':_0xe66c('0x41')}]});}return null;})[_0xe66c('0xe')](respondWithResult(_0x41e53d,null))[_0xe66c('0x34')](handleError(_0x41e53d,null));};function sanitizeRemoteUri(_0x40b4ab){var _0x50bdd4=_0x40b4ab[_0xe66c('0x42')](-0x1);if(_0x50bdd4==='/')return _0x40b4ab[_0xe66c('0x43')](0x0,_0x40b4ab[_0xe66c('0x44')](_0x50bdd4));return _0x40b4ab;}function getWebApiUrl(_0xfb86b5){return util[_0xe66c('0x45')](_0xe66c('0x46'),_0xfb86b5);}exports[_0xe66c('0x47')]=function(_0x5d0482,_0x40c174){var _0x218dc8=_0x5d0482[_0xe66c('0x1d')]['ticketType'];var _0x43e1ca=_0x218dc8===_0xe66c('0x48')?'Incident':_0xe66c('0x49');var _0x228d3b='';var _0x1b478c='';var _0x3ac87a='';var _0x1a2976='';var _0x588389='';var _0x356ba0='';var _0x326a05='';var _0x2e6a21='';var _0x8bf966=[_0xe66c('0x4a'),_0xe66c('0x4b'),_0xe66c('0x4c'),_0xe66c('0x4d'),_0xe66c('0x4e'),_0xe66c('0x4f'),_0xe66c('0x50'),_0xe66c('0x51'),_0xe66c('0x52'),_0xe66c('0x53')];var _0x3f411c=['accountidname',_0xe66c('0x54'),'actualserviceunits',_0xe66c('0x55'),_0xe66c('0x56'),_0xe66c('0x57'),'contractdetailidname',_0xe66c('0x58'),_0xe66c('0x59'),_0xe66c('0x5a'),'createdbyname',_0xe66c('0x5b'),_0xe66c('0x5c'),_0xe66c('0x5d'),_0xe66c('0x5e'),_0xe66c('0x5f'),_0xe66c('0x60'),_0xe66c('0x61'),'emailaddress',_0xe66c('0x62'),_0xe66c('0x63'),_0xe66c('0x64'),'escalatedon',_0xe66c('0x65'),_0xe66c('0x66'),_0xe66c('0x67'),_0xe66c('0x68'),_0xe66c('0x69'),_0xe66c('0x6a'),_0xe66c('0x6b'),_0xe66c('0x6c'),_0xe66c('0x6d'),_0xe66c('0x6e'),_0xe66c('0x6f'),_0xe66c('0x70'),'modifiedon',_0xe66c('0x71'),_0xe66c('0x72'),_0xe66c('0x73'),'msdyn_iotalertname',_0xe66c('0x74'),_0xe66c('0x75'),_0xe66c('0x76'),_0xe66c('0x77'),_0xe66c('0x78'),'owneridyominame',_0xe66c('0x79'),'primarycontactidname',_0xe66c('0x7a'),_0xe66c('0x7b'),'productidname',_0xe66c('0x7c'),_0xe66c('0x7d'),_0xe66c('0x7e'),'responseby',_0xe66c('0x7f'),_0xe66c('0x80'),'sentimentvalue',_0xe66c('0x81'),_0xe66c('0x82'),_0xe66c('0x83'),'statecode',_0xe66c('0x84'),_0xe66c('0x85'),_0xe66c('0x86'),_0xe66c('0x87'),_0xe66c('0x88'),_0xe66c('0x89'),'utcconversiontimezonecode','versionnumber'];var _0x121e85=_0x8bf966[_0xe66c('0x8a')](_0x3f411c);return db['Dynamics365Account'][_0xe66c('0x3a')]({'where':{'id':_0x5d0482[_0xe66c('0x31')]['id']},'attributes':['id',_0xe66c('0x8b'),'password',_0xe66c('0x8c'),_0xe66c('0x8d'),'clientId','clientSecret',_0xe66c('0x8e')],'include':[{'model':db[_0xe66c('0x8f')],'as':'CloudProvider','attributes':['id',_0xe66c('0x90'),_0xe66c('0x91')]}]})[_0xe66c('0xe')](handleEntityNotFound(_0x40c174,null))[_0xe66c('0xe')](function(_0x5eae11){if(_0x5eae11){if(_0x5eae11[_0xe66c('0x8e')]){_0x5eae11[_0xe66c('0x92')]=_0x5eae11[_0xe66c('0x8f')][_0xe66c('0x90')];_0x2e6a21=sanitizeRemoteUri(_0x5eae11[_0xe66c('0x8f')][_0xe66c('0x91')]);_0x326a05=getWebApiUrl(_0x2e6a21);return _0x5eae11;}_0x2e6a21=sanitizeRemoteUri(_0x5eae11['remoteUri']);_0x326a05=getWebApiUrl(_0x2e6a21);var _0x2e1b9c={'method':_0xe66c('0x93'),'uri':'https://login.microsoftonline.com/'+_0x5eae11[_0xe66c('0x8d')]+'/oauth2/token','form':{'client_id':_0x5eae11[_0xe66c('0x94')],'resource':_0x2e6a21,'username':_0x5eae11[_0xe66c('0x8b')],'password':_0x5eae11[_0xe66c('0x95')],'grant_type':'password','client_secret':_0x5eae11[_0xe66c('0x96')]},'json':!![]};return rp(_0x2e1b9c);}})[_0xe66c('0xe')](function(_0x56c770){_0x356ba0=_0x56c770[_0xe66c('0x92')];var _0xf81fe4={'method':_0xe66c('0x97'),'uri':encodeURI(_0x326a05+_0xe66c('0x98')+_0x43e1ca+'\x27'),'headers':{'Authorization':_0xe66c('0x99')+_0x356ba0,'If-None-Match':null,'OData-Version':_0xe66c('0x9a')},'json':!![]};return rp(_0xf81fe4);})[_0xe66c('0xe')](function(_0xac9f4f){var _0x55e3f0=_0xac9f4f['value'][0x0];var _0x44c82d=_0x55e3f0[_0xe66c('0x9b')];var _0x13ffe6={'method':_0xe66c('0x97'),'uri':_0x326a05+_0xe66c('0x9c')+_0x44c82d+_0xe66c('0x9d'),'headers':{'Authorization':_0xe66c('0x99')+_0x356ba0,'If-None-Match':null,'OData-Version':_0xe66c('0x9a')},'json':!![]};return rp(_0x13ffe6);})[_0xe66c('0xe')](function(_0x11eeb0){_0x228d3b=_0x11eeb0;_0x1b478c=_0x228d3b[_0xe66c('0x9e')];_0x1b478c=_['remove'](_0x1b478c,function(_0x33d830){return!_0x121e85[_0xe66c('0x9f')](_0x33d830[_0xe66c('0xa0')]);});var _0x18a100=[];var _0x45e706=[];_0x1b478c['forEach'](function(_0x236838){if(_0x236838[_0xe66c('0xa1')]){var _0xf9ebd9=_0x236838['@odata.type'][_0xe66c('0x43')](_0x236838[_0xe66c('0xa1')]['lastIndexOf']('.')+0x1);if(_0xf9ebd9===_0xe66c('0xa2')){_0x18a100[_0xe66c('0xa3')](getSelectList(_0x326a05,_0x218dc8,_0x45e706,_0x228d3b['MetadataId'],_0x236838[_0xe66c('0x9b')],_0x356ba0));}}});return Promise[_0xe66c('0xa4')](_0x18a100);})[_0xe66c('0xe')](function(_0x4f0be){_0x3ac87a=_0x4f0be[0x0];var _0x5b134f=[];var _0x196345=[];_0x1b478c['forEach'](function(_0x41c236){if(!_[_0xe66c('0xa5')](_0x41c236[_0xe66c('0xa1')])){var _0x7488df=_0x41c236[_0xe66c('0xa1')][_0xe66c('0x43')](_0x41c236[_0xe66c('0xa1')][_0xe66c('0x44')]('.')+0x1);if(_0x7488df==='BooleanAttributeMetadata'){_0x5b134f['push'](getBooleanList(_0x326a05,_0x218dc8,_0x196345,_0x228d3b[_0xe66c('0x9b')],_0x41c236[_0xe66c('0x9b')],_0x356ba0));}}});return Promise['all'](_0x5b134f);})[_0xe66c('0xe')](function(_0x3f92bf){_0x1a2976=_0x3f92bf[0x0];var _0x491e09=[];var _0x46fbce=[];_0x1b478c[_0xe66c('0xa6')](function(_0x36b597){if(_0x36b597[_0xe66c('0xa1')]){var _0x585981=_0x36b597[_0xe66c('0xa1')][_0xe66c('0x43')](_0x36b597[_0xe66c('0xa1')][_0xe66c('0x44')]('.')+0x1);if(_0x585981==='StringAttributeMetadata'||_0x585981===_0xe66c('0xa7')||_0x585981===_0xe66c('0xa8')||_0x585981===_0xe66c('0xa9')||_0x585981===_0xe66c('0xaa')||_0x585981===_0xe66c('0xab')||_0x585981===_0xe66c('0xac')||_0x585981==='EntityNameAttributeMetadata'||_0x585981===_0xe66c('0xad')||_0x585981===_0xe66c('0xae')){_0x491e09[_0xe66c('0xa3')](getInputList(_0x326a05,_0x218dc8,_0x585981,_0x46fbce,_0x228d3b[_0xe66c('0x9b')],_0x36b597[_0xe66c('0x9b')],_0x356ba0));}}});return Promise['all'](_0x491e09);})[_0xe66c('0xe')](function(_0x43bf27){_0x588389=_0x43bf27[0x0];var _0x1e8905=_0x3ac87a[_0xe66c('0x8a')](_0x1a2976)[_0xe66c('0x8a')](_0x588389);var _0x2d4c03={'count':_0x1e8905[_0xe66c('0x22')],'rows':_0x1e8905};return _0x2d4c03;})['then'](respondWithResult(_0x40c174,null))[_0xe66c('0x34')](function(_0x155b42){var _0x1753f1=_0x5d0482['query'][_0xe66c('0xaf')]?0x1f4:_0x155b42[_0xe66c('0xb0')]||0x1f4;logger[_0xe66c('0x11')](_0x155b42['stack']);delete _0x155b42['name'];if(_0x1753f1===0x191){_0x1753f1=0x190;}_0x40c174[_0xe66c('0x5')](_0x1753f1)['send'](_0x5d0482['query'][_0xe66c('0xaf')]?{'message':_0xe66c('0xb1'),'statusCode':_0x155b42[_0xe66c('0xb0')]}:_0x155b42);});};function getSelectList(_0x38288a,_0xb7a3e3,_0x348386,_0x5afd6f,_0x1694bf,_0x20a100){var _0x136a30={'method':_0xe66c('0x97'),'uri':_0x38288a+'EntityDefinitions('+_0x5afd6f+_0xe66c('0xb2')+_0x1694bf+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xe66c('0xb3'),'headers':{'Authorization':_0xe66c('0x99')+_0x20a100,'If-None-Match':null,'OData-Version':_0xe66c('0x9a')},'json':!![]};return rp(_0x136a30)[_0xe66c('0xe')](function(_0x51b449){var _0x295f5f=[];var _0x420474=_0x51b449[_0xe66c('0xb4')]['Options'];_0x420474[_0xe66c('0xa6')](function(_0x17aa8c){_0x295f5f['push']({'name':_0x17aa8c['Label'][_0xe66c('0xb5')][_0xe66c('0xb6')],'value':String(_0x17aa8c['Value'])});});var _0x5657bb={'id':_0xb7a3e3+'_'+_0x51b449['LogicalName'],'name':_0x51b449[_0xe66c('0xb7')][_0xe66c('0xb5')][_0xe66c('0xb6')],'custom':![],'options':_0x295f5f};_0x348386[_0xe66c('0xa3')](_0x5657bb);return _0x348386;});}function getBooleanList(_0xdb4808,_0x464a51,_0x3235d8,_0x1ea719,_0x1ff8ec,_0x3d295c){var _0x12cee1={'method':'GET','uri':_0xdb4808+_0xe66c('0x9c')+_0x1ea719+_0xe66c('0xb2')+_0x1ff8ec+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe66c('0x99')+_0x3d295c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12cee1)[_0xe66c('0xe')](function(_0x1abfa9){var _0x34dbcb=[];_0x34dbcb[_0xe66c('0xa3')]({'name':_0x1abfa9[_0xe66c('0xb4')]['TrueOption'][_0xe66c('0xb6')][_0xe66c('0xb5')][_0xe66c('0xb6')],'value':_0xe66c('0xb8')},{'name':_0x1abfa9['OptionSet']['FalseOption'][_0xe66c('0xb6')]['UserLocalizedLabel'][_0xe66c('0xb6')],'value':'false'});var _0x5021d4={'id':_0x464a51+'_'+_0x1abfa9[_0xe66c('0xa0')],'name':_0x1abfa9[_0xe66c('0xb7')][_0xe66c('0xb5')]['Label'],'custom':![],'options':_0x34dbcb};_0x3235d8['push'](_0x5021d4);return _0x3235d8;});}function getInputList(_0xc46cc7,_0x33fed6,_0x505dea,_0x2b60cc,_0x4e4684,_0x59d4b1,_0x3afa18){var _0x106705={'method':_0xe66c('0x97'),'uri':_0xc46cc7+_0xe66c('0x9c')+_0x4e4684+_0xe66c('0xb2')+_0x59d4b1+_0xe66c('0xb9')+_0x505dea+_0xe66c('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x3afa18,'If-None-Match':null,'OData-Version':_0xe66c('0x9a')},'json':!![]};return rp(_0x106705)[_0xe66c('0xe')](function(_0x7eaf55){var _0x2a2c28={'id':_0x33fed6+'_'+_0x7eaf55[_0xe66c('0xa0')],'name':_0x7eaf55[_0xe66c('0xb7')][_0xe66c('0xb5')]?_0x7eaf55[_0xe66c('0xb7')][_0xe66c('0xb5')]['Label']:_0x7eaf55[_0xe66c('0xa0')],'custom':![],'options':[]};_0x2b60cc[_0xe66c('0xa3')](_0x2a2c28);return _0x2b60cc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 25218a7..3da1f21 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x4f9aad,_0x596ac1){var _0x355f6d=function(_0x2075ff){while(--_0x2075ff){_0x4f9aad['push'](_0x4f9aad['shift']());}};_0x355f6d(++_0x596ac1);}(_0xe706,0xa3));var _0x6e70=function(_0x2d69a4,_0x32935e){_0x2d69a4=_0x2d69a4-0x0;var _0xe0705b=_0xe706[_0x2d69a4];return _0xe0705b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x2eb7d8,_0x1268c7){var _0x565f1b=function(_0x10bc56){while(--_0x10bc56){_0x2eb7d8['push'](_0x2eb7d8['shift']());}};_0x565f1b(++_0x1268c7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xcb91[_0x3a78a0];return _0x48e917;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('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 97a36cf..fa27277 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 _0x5cf7=['info','request\x20sent','debug','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','ShowDynamics365Account','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x5cf7,0xc0));var _0x75cf=function(_0x6b5a30,_0x52921b){_0x6b5a30=_0x6b5a30-0x0;var _0x5e78e7=_0x5cf7[_0x6b5a30];return _0x5e78e7;};'use strict';var _=require(_0x75cf('0x0'));var util=require(_0x75cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75cf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75cf('0x3'))['db'];var utils=require(_0x75cf('0x4'));var logger=require(_0x75cf('0x5'))(_0x75cf('0x6'));var config=require(_0x75cf('0x7'));var jayson=require(_0x75cf('0x8'));var client=jayson['client'][_0x75cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x227568,_0x299e03,_0x5b429c){return new BPromise(function(_0x54bef9,_0x4f3419){return client[_0x75cf('0xa')](_0x227568,_0x5b429c)[_0x75cf('0xb')](function(_0x5f7a){logger[_0x75cf('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x299e03,_0x75cf('0xd'));logger[_0x75cf('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x299e03,_0x75cf('0xd'),JSON['stringify'](_0x5f7a));if(_0x5f7a[_0x75cf('0xf')]){if(_0x5f7a[_0x75cf('0xf')][_0x75cf('0x10')]===0x1f4){logger[_0x75cf('0xf')](_0x75cf('0x11'),_0x299e03,_0x5f7a['error']['message']);return _0x4f3419(_0x5f7a[_0x75cf('0xf')][_0x75cf('0x12')]);}logger[_0x75cf('0xf')](_0x75cf('0x11'),_0x299e03,_0x5f7a[_0x75cf('0xf')][_0x75cf('0x12')]);return _0x54bef9(_0x5f7a[_0x75cf('0xf')][_0x75cf('0x12')]);}else{logger[_0x75cf('0xc')](_0x75cf('0x11'),_0x299e03,_0x75cf('0xd'));_0x54bef9(_0x5f7a[_0x75cf('0x13')][_0x75cf('0x12')]);}})[_0x75cf('0x14')](function(_0x510e27){logger['error'](_0x75cf('0x11'),_0x299e03,_0x510e27);_0x4f3419(_0x510e27);});});}exports[_0x75cf('0x15')]=function(_0x3a11da){var _0x94f912=this;return new Promise(function(_0x24e52b,_0x22f70){return db[_0x75cf('0x16')][_0x75cf('0x17')]({'raw':_0x3a11da[_0x75cf('0x18')]?_0x3a11da[_0x75cf('0x18')][_0x75cf('0x19')]===undefined?!![]:![]:!![],'where':_0x3a11da[_0x75cf('0x18')]?_0x3a11da[_0x75cf('0x18')][_0x75cf('0x1a')]||null:null,'attributes':_0x3a11da[_0x75cf('0x18')]?_0x3a11da[_0x75cf('0x18')]['attributes']||null:null,'limit':_0x3a11da['options']?_0x3a11da[_0x75cf('0x18')][_0x75cf('0x1b')]||null:null,'include':_0x3a11da['options']?_0x3a11da[_0x75cf('0x18')][_0x75cf('0x1c')]?_[_0x75cf('0x1d')](_0x3a11da[_0x75cf('0x18')][_0x75cf('0x1c')],function(_0x8413fc){return{'model':db[_0x8413fc[_0x75cf('0x1e')]],'as':_0x8413fc['as'],'attributes':_0x8413fc[_0x75cf('0x1f')],'include':_0x8413fc[_0x75cf('0x1c')]?_[_0x75cf('0x1d')](_0x8413fc[_0x75cf('0x1c')],function(_0x1689bd){return{'model':db[_0x1689bd['model']],'as':_0x1689bd['as'],'attributes':_0x1689bd[_0x75cf('0x1f')],'include':_0x1689bd['include']?_['map'](_0x1689bd['include'],function(_0x4a9bbb){return{'model':db[_0x4a9bbb[_0x75cf('0x1e')]],'as':_0x4a9bbb['as'],'attributes':_0x4a9bbb[_0x75cf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b6b8){logger[_0x75cf('0xc')](_0x75cf('0x15'),_0x3a11da);logger['debug']('GetDynamics365Account',_0x3a11da,JSON['stringify'](_0x32b6b8));_0x24e52b(_0x32b6b8);})[_0x75cf('0x14')](function(_0x16d2d8){logger[_0x75cf('0xf')](_0x75cf('0x15'),_0x16d2d8[_0x75cf('0x12')],_0x3a11da);_0x22f70(_0x94f912[_0x75cf('0xf')](0x1f4,_0x16d2d8[_0x75cf('0x12')]));});});};exports[_0x75cf('0x20')]=function(_0x1bb73e){var _0xcab7c3=this;return new Promise(function(_0x3f12a3,_0x4c7ce9){return db['Dynamics365Account']['find']({'raw':_0x1bb73e[_0x75cf('0x18')]?_0x1bb73e[_0x75cf('0x18')][_0x75cf('0x19')]===undefined?!![]:![]:!![],'where':_0x1bb73e[_0x75cf('0x18')]?_0x1bb73e[_0x75cf('0x18')]['where']||null:null,'attributes':_0x1bb73e[_0x75cf('0x18')]?_0x1bb73e[_0x75cf('0x18')][_0x75cf('0x1f')]||null:null,'include':_0x1bb73e['options']?_0x1bb73e['options'][_0x75cf('0x1c')]?_[_0x75cf('0x1d')](_0x1bb73e[_0x75cf('0x18')][_0x75cf('0x1c')],function(_0x1b8880){return{'model':db[_0x1b8880[_0x75cf('0x1e')]],'as':_0x1b8880['as'],'attributes':_0x1b8880[_0x75cf('0x1f')],'include':_0x1b8880[_0x75cf('0x1c')]?_[_0x75cf('0x1d')](_0x1b8880[_0x75cf('0x1c')],function(_0x35ea24){return{'model':db[_0x35ea24[_0x75cf('0x1e')]],'as':_0x35ea24['as'],'attributes':_0x35ea24[_0x75cf('0x1f')],'include':_0x35ea24[_0x75cf('0x1c')]?_['map'](_0x35ea24[_0x75cf('0x1c')],function(_0x440e3d){return{'model':db[_0x440e3d[_0x75cf('0x1e')]],'as':_0x440e3d['as'],'attributes':_0x440e3d[_0x75cf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c131b){logger[_0x75cf('0xc')](_0x75cf('0x20'),_0x1bb73e);logger[_0x75cf('0xe')](_0x75cf('0x20'),_0x1bb73e,JSON[_0x75cf('0x21')](_0x2c131b));_0x3f12a3(_0x2c131b);})[_0x75cf('0x14')](function(_0x13b0d2){logger[_0x75cf('0xf')]('ShowDynamics365Account',_0x13b0d2[_0x75cf('0x12')],_0x1bb73e);_0x4c7ce9(_0xcab7c3[_0x75cf('0xf')](0x1f4,_0x13b0d2['message']));});});}; \ No newline at end of file +var _0xc7ed=['model','attributes','debug','stringify','ShowDynamics365Account','Dynamics365Account','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','limit','map','include'];(function(_0x4abbb9,_0x240ab3){var _0x59a9f9=function(_0x7dd67b){while(--_0x7dd67b){_0x4abbb9['push'](_0x4abbb9['shift']());}};_0x59a9f9(++_0x240ab3);}(_0xc7ed,0x1b8));var _0xdc7e=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0xc7ed[_0x3ae34a];return _0x4c9edc;};'use strict';var _=require(_0xdc7e('0x0'));var util=require('util');var moment=require(_0xdc7e('0x1'));var BPromise=require(_0xdc7e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc7e('0x3'));var db=require(_0xdc7e('0x4'))['db'];var utils=require(_0xdc7e('0x5'));var logger=require('../../config/logger')(_0xdc7e('0x6'));var config=require('../../config/environment');var jayson=require(_0xdc7e('0x7'));var client=jayson[_0xdc7e('0x8')][_0xdc7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bf716,_0x40c530,_0x9a520){return new BPromise(function(_0x291284,_0x6cee01){return client[_0xdc7e('0xa')](_0x5bf716,_0x9a520)[_0xdc7e('0xb')](function(_0x434687){logger[_0xdc7e('0xc')](_0xdc7e('0xd'),_0x40c530,_0xdc7e('0xe'));logger['debug'](_0xdc7e('0xf'),_0x40c530,_0xdc7e('0xe'),JSON['stringify'](_0x434687));if(_0x434687[_0xdc7e('0x10')]){if(_0x434687[_0xdc7e('0x10')][_0xdc7e('0x11')]===0x1f4){logger[_0xdc7e('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x40c530,_0x434687[_0xdc7e('0x10')][_0xdc7e('0x12')]);return _0x6cee01(_0x434687[_0xdc7e('0x10')][_0xdc7e('0x12')]);}logger[_0xdc7e('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x40c530,_0x434687[_0xdc7e('0x10')][_0xdc7e('0x12')]);return _0x291284(_0x434687['error'][_0xdc7e('0x12')]);}else{logger[_0xdc7e('0xc')](_0xdc7e('0xd'),_0x40c530,'request\x20sent');_0x291284(_0x434687[_0xdc7e('0x13')][_0xdc7e('0x12')]);}})[_0xdc7e('0x14')](function(_0x11affa){logger['error'](_0xdc7e('0xd'),_0x40c530,_0x11affa);_0x6cee01(_0x11affa);});});}exports[_0xdc7e('0x15')]=function(_0x3df0f3){var _0x2a95a2=this;return new Promise(function(_0x6cb0c1,_0x199657){return db['Dynamics365Account'][_0xdc7e('0x16')]({'raw':_0x3df0f3['options']?_0x3df0f3[_0xdc7e('0x17')][_0xdc7e('0x18')]===undefined?!![]:![]:!![],'where':_0x3df0f3['options']?_0x3df0f3[_0xdc7e('0x17')]['where']||null:null,'attributes':_0x3df0f3['options']?_0x3df0f3['options']['attributes']||null:null,'limit':_0x3df0f3[_0xdc7e('0x17')]?_0x3df0f3['options'][_0xdc7e('0x19')]||null:null,'include':_0x3df0f3['options']?_0x3df0f3[_0xdc7e('0x17')]['include']?_[_0xdc7e('0x1a')](_0x3df0f3[_0xdc7e('0x17')][_0xdc7e('0x1b')],function(_0x58ca12){return{'model':db[_0x58ca12[_0xdc7e('0x1c')]],'as':_0x58ca12['as'],'attributes':_0x58ca12[_0xdc7e('0x1d')],'include':_0x58ca12[_0xdc7e('0x1b')]?_['map'](_0x58ca12[_0xdc7e('0x1b')],function(_0x33d748){return{'model':db[_0x33d748['model']],'as':_0x33d748['as'],'attributes':_0x33d748[_0xdc7e('0x1d')],'include':_0x33d748[_0xdc7e('0x1b')]?_[_0xdc7e('0x1a')](_0x33d748[_0xdc7e('0x1b')],function(_0xa21df0){return{'model':db[_0xa21df0[_0xdc7e('0x1c')]],'as':_0xa21df0['as'],'attributes':_0xa21df0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40e787){logger['info']('GetDynamics365Account',_0x3df0f3);logger[_0xdc7e('0x1e')](_0xdc7e('0x15'),_0x3df0f3,JSON[_0xdc7e('0x1f')](_0x40e787));_0x6cb0c1(_0x40e787);})[_0xdc7e('0x14')](function(_0x340c33){logger[_0xdc7e('0x10')]('GetDynamics365Account',_0x340c33[_0xdc7e('0x12')],_0x3df0f3);_0x199657(_0x2a95a2[_0xdc7e('0x10')](0x1f4,_0x340c33[_0xdc7e('0x12')]));});});};exports[_0xdc7e('0x20')]=function(_0x223a1c){var _0x3fd62a=this;return new Promise(function(_0x10d875,_0x1c980f){return db[_0xdc7e('0x21')][_0xdc7e('0x22')]({'raw':_0x223a1c[_0xdc7e('0x17')]?_0x223a1c[_0xdc7e('0x17')][_0xdc7e('0x18')]===undefined?!![]:![]:!![],'where':_0x223a1c[_0xdc7e('0x17')]?_0x223a1c[_0xdc7e('0x17')][_0xdc7e('0x23')]||null:null,'attributes':_0x223a1c['options']?_0x223a1c[_0xdc7e('0x17')][_0xdc7e('0x1d')]||null:null,'include':_0x223a1c[_0xdc7e('0x17')]?_0x223a1c[_0xdc7e('0x17')][_0xdc7e('0x1b')]?_[_0xdc7e('0x1a')](_0x223a1c['options'][_0xdc7e('0x1b')],function(_0x1b32e5){return{'model':db[_0x1b32e5['model']],'as':_0x1b32e5['as'],'attributes':_0x1b32e5['attributes'],'include':_0x1b32e5[_0xdc7e('0x1b')]?_['map'](_0x1b32e5['include'],function(_0x565049){return{'model':db[_0x565049[_0xdc7e('0x1c')]],'as':_0x565049['as'],'attributes':_0x565049[_0xdc7e('0x1d')],'include':_0x565049[_0xdc7e('0x1b')]?_['map'](_0x565049[_0xdc7e('0x1b')],function(_0x1074dc){return{'model':db[_0x1074dc[_0xdc7e('0x1c')]],'as':_0x1074dc['as'],'attributes':_0x1074dc[_0xdc7e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc7e('0xb')](function(_0x4db19c){logger[_0xdc7e('0xc')](_0xdc7e('0x20'),_0x223a1c);logger[_0xdc7e('0x1e')](_0xdc7e('0x20'),_0x223a1c,JSON[_0xdc7e('0x1f')](_0x4db19c));_0x10d875(_0x4db19c);})[_0xdc7e('0x14')](function(_0x9d62e3){logger[_0xdc7e('0x10')](_0xdc7e('0x20'),_0x9d62e3[_0xdc7e('0x12')],_0x223a1c);_0x1c980f(_0x3fd62a['error'](0x1f4,_0x9d62e3['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 37e4327..6c82788 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 _0x4893=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2d88b6,_0x47d87d){var _0x24bb58=function(_0x2456e7){while(--_0x2456e7){_0x2d88b6['push'](_0x2d88b6['shift']());}};_0x24bb58(++_0x47d87d);}(_0x4893,0x118));var _0x3489=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x4893[_0x2d61b2];return _0x12df89;};'use strict';var multer=require(_0x3489('0x0'));var util=require(_0x3489('0x1'));var path=require('path');var timeout=require(_0x3489('0x2'));var express=require('express');var router=express[_0x3489('0x3')]();var fs_extra=require(_0x3489('0x4'));var auth=require(_0x3489('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3489('0x6'));var controller=require(_0x3489('0x7'));router[_0x3489('0x8')]('/',auth[_0x3489('0x9')](),controller['index']);router['get'](_0x3489('0xa'),auth[_0x3489('0x9')](),controller[_0x3489('0xb')]);router[_0x3489('0x8')](_0x3489('0xc'),auth[_0x3489('0x9')](),controller[_0x3489('0xd')]);router[_0x3489('0x8')](_0x3489('0xe'),auth['isAuthenticated'](),controller[_0x3489('0xf')]);router['get'](_0x3489('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x3489('0x9')](),controller[_0x3489('0x11')]);router['put']('/:id',auth[_0x3489('0x9')](),controller[_0x3489('0x12')]);router[_0x3489('0x13')](_0x3489('0xa'),auth[_0x3489('0x9')](),controller[_0x3489('0x14')]);module[_0x3489('0x15')]=router; \ No newline at end of file +var _0x6a47=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','get','/:id/fields'];(function(_0x455eb6,_0x5ab9b4){var _0x1633a8=function(_0x317a9b){while(--_0x317a9b){_0x455eb6['push'](_0x455eb6['shift']());}};_0x1633a8(++_0x5ab9b4);}(_0x6a47,0x112));var _0x76a4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6a47[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var path=require(_0x76a4('0x2'));var timeout=require(_0x76a4('0x3'));var express=require(_0x76a4('0x4'));var router=express['Router']();var fs_extra=require(_0x76a4('0x5'));var auth=require(_0x76a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x76a4('0x7'));var controller=require(_0x76a4('0x8'));router['get']('/',auth[_0x76a4('0x9')](),controller[_0x76a4('0xa')]);router['get'](_0x76a4('0xb'),auth[_0x76a4('0x9')](),controller['show']);router[_0x76a4('0xc')](_0x76a4('0xd'),auth[_0x76a4('0x9')](),controller['getFields']);router[_0x76a4('0xc')](_0x76a4('0xe'),auth[_0x76a4('0x9')](),controller[_0x76a4('0xf')]);router[_0x76a4('0xc')](_0x76a4('0x10'),auth[_0x76a4('0x9')](),controller[_0x76a4('0x11')]);router[_0x76a4('0x12')]('/',auth['isAuthenticated'](),controller[_0x76a4('0x13')]);router[_0x76a4('0x14')](_0x76a4('0xb'),auth['isAuthenticated'](),controller[_0x76a4('0x15')]);router[_0x76a4('0x16')]('/:id',auth[_0x76a4('0x9')](),controller[_0x76a4('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6d188c4..b65b020 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 _0xd755=['ENUM','incident','contact','BOOLEAN','sequelize','exports','STRING'];(function(_0x33f5c8,_0x5202bb){var _0x4ea43f=function(_0x16be2b){while(--_0x16be2b){_0x33f5c8['push'](_0x33f5c8['shift']());}};_0x4ea43f(++_0x5202bb);}(_0xd755,0x14d));var _0x5d75=function(_0x214642,_0xc9fac6){_0x214642=_0x214642-0x0;var _0x4ec937=_0xd755[_0x214642];return _0x4ec937;};'use strict';var Sequelize=require(_0x5d75('0x0'));module[_0x5d75('0x1')]={'name':{'type':Sequelize[_0x5d75('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x4'),'phonecall'),'defaultValue':_0x5d75('0x4')},'moduleCreate':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x5'),'nothing'),'defaultValue':_0x5d75('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5d75('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5d75('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x88b8=['STRING','incident','phonecall','contact','nothing','BOOLEAN','sequelize'];(function(_0x690f82,_0x239b13){var _0x1f9630=function(_0xd91f13){while(--_0xd91f13){_0x690f82['push'](_0x690f82['shift']());}};_0x1f9630(++_0x239b13);}(_0x88b8,0x1db));var _0x888b=function(_0x278f93,_0x5d74c6){_0x278f93=_0x278f93-0x0;var _0x47d224=_0x88b8[_0x278f93];return _0x47d224;};'use strict';var Sequelize=require(_0x888b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x888b('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x888b('0x2'),_0x888b('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x888b('0x4'),_0x888b('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x888b('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x888b('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 c05e74e..658a2d6 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 _0x3ea8=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','then','include','findAll','rows','show','params','includeAll','find','catch','body','getFields','findOne','pick','filter','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','lodash'];(function(_0x155adf,_0x5f02f3){var _0xd8b384=function(_0x457160){while(--_0x457160){_0x155adf['push'](_0x155adf['shift']());}};_0xd8b384(++_0x5f02f3);}(_0x3ea8,0x128));var _0x83ea=function(_0x136593,_0x12b201){_0x136593=_0x136593-0x0;var _0x12c299=_0x3ea8[_0x136593];return _0x12c299;};'use strict';var emlformat=require(_0x83ea('0x0'));var rimraf=require(_0x83ea('0x1'));var zipdir=require(_0x83ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83ea('0x3'));var moment=require(_0x83ea('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83ea('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x83ea('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83ea('0x7'));var squel=require('squel');var crypto=require(_0x83ea('0x8'));var jsforce=require(_0x83ea('0x9'));var deskjs=require(_0x83ea('0xa'));var toCsv=require(_0x83ea('0x6'));var querystring=require(_0x83ea('0xb'));var Papa=require(_0x83ea('0xc'));var Redis=require('ioredis');var authService=require(_0x83ea('0xd'));var qs=require(_0x83ea('0xe'));var as=require(_0x83ea('0xf'));var hardwareService=require(_0x83ea('0x10'));var logger=require('../../config/logger')(_0x83ea('0x11'));var utils=require('../../config/utils');var config=require(_0x83ea('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x83ea('0x13'))['db'];function respondWithStatusCode(_0x3d8021,_0x2629fe){_0x2629fe=_0x2629fe||0xcc;return function(_0x4ba857){if(_0x4ba857){return _0x3d8021[_0x83ea('0x14')](_0x2629fe);}return _0x3d8021[_0x83ea('0x15')](_0x2629fe)[_0x83ea('0x16')]();};}function respondWithResult(_0x22fb7a,_0x4f48ef){_0x4f48ef=_0x4f48ef||0xc8;return function(_0x1d9ede){if(_0x1d9ede){return _0x22fb7a[_0x83ea('0x15')](_0x4f48ef)[_0x83ea('0x17')](_0x1d9ede);}};}function respondWithFilteredResult(_0xda78fd,_0x249b98){return function(_0x13828b){if(_0x13828b){var _0x5adcfb=typeof _0x249b98['offset']===_0x83ea('0x18')&&typeof _0x249b98[_0x83ea('0x19')]===_0x83ea('0x18');var _0x2c1d6d=_0x13828b['count'];var _0x2edfe5=_0x5adcfb?0x0:_0x249b98['offset'];var _0x5e2ffc=_0x5adcfb?_0x13828b[_0x83ea('0x1a')]:_0x249b98[_0x83ea('0x1b')]+_0x249b98[_0x83ea('0x19')];var _0xd2b808;if(_0x5e2ffc>=_0x2c1d6d){_0x5e2ffc=_0x2c1d6d;_0xd2b808=0xc8;}else{_0xd2b808=0xce;}_0xda78fd[_0x83ea('0x15')](_0xd2b808);return _0xda78fd[_0x83ea('0x1c')]('Content-Range',_0x2edfe5+'-'+_0x5e2ffc+'/'+_0x2c1d6d)['json'](_0x13828b);}return null;};}function patchUpdates(_0x216597){return function(_0xd1bac6){try{jsonpatch[_0x83ea('0x1d')](_0xd1bac6,_0x216597,!![]);}catch(_0x297da4){return BPromise[_0x83ea('0x1e')](_0x297da4);}return _0xd1bac6[_0x83ea('0x1f')]();};}function saveUpdates(_0x1bd7c6,_0x53158c){return function(_0x43078c){if(_0x43078c){return _0x43078c[_0x83ea('0x20')](_0x1bd7c6)['then'](function(_0x448cd9){return _0x448cd9;});}return null;};}function removeEntity(_0x280031,_0x28642c){return function(_0x301125){if(_0x301125){return _0x301125[_0x83ea('0x21')]()['then'](function(){_0x280031['status'](0xcc)[_0x83ea('0x16')]();});}};}function handleEntityNotFound(_0xa4139c,_0x1f6952){return function(_0xa85620){if(!_0xa85620){_0xa4139c['sendStatus'](0x194);}return _0xa85620;};}function handleError(_0x298ba7,_0xa0ab34){_0xa0ab34=_0xa0ab34||0x1f4;return function(_0x1afce4){logger[_0x83ea('0x22')](_0x1afce4['stack']);if(_0x1afce4['name']){delete _0x1afce4[_0x83ea('0x23')];}_0x298ba7[_0x83ea('0x15')](_0xa0ab34)['send'](_0x1afce4);};}exports[_0x83ea('0x24')]=function(_0x5780ae,_0x1517ab){var _0x21f7c8={},_0x35ae35={},_0x190fdd={'count':0x0,'rows':[]};var _0x26506f=_[_0x83ea('0x25')](db[_0x83ea('0x26')][_0x83ea('0x27')],function(_0x79e7bf){return{'name':_0x79e7bf[_0x83ea('0x28')],'type':_0x79e7bf[_0x83ea('0x29')][_0x83ea('0x2a')]};});_0x35ae35[_0x83ea('0x2b')]=_['map'](_0x26506f,'name');_0x35ae35['query']=_[_0x83ea('0x2c')](_0x5780ae[_0x83ea('0x2d')]);_0x35ae35['filters']=_[_0x83ea('0x2e')](_0x35ae35['model'],_0x35ae35['query']);_0x21f7c8[_0x83ea('0x2f')]=_['intersection'](_0x35ae35['model'],qs[_0x83ea('0x30')](_0x5780ae['query'][_0x83ea('0x30')]));_0x21f7c8[_0x83ea('0x2f')]=_0x21f7c8[_0x83ea('0x2f')][_0x83ea('0x31')]?_0x21f7c8[_0x83ea('0x2f')]:_0x35ae35['model'];if(!_0x5780ae[_0x83ea('0x2d')][_0x83ea('0x32')](_0x83ea('0x33'))){_0x21f7c8[_0x83ea('0x19')]=qs[_0x83ea('0x19')](_0x5780ae[_0x83ea('0x2d')][_0x83ea('0x19')]);_0x21f7c8[_0x83ea('0x1b')]=qs[_0x83ea('0x1b')](_0x5780ae[_0x83ea('0x2d')][_0x83ea('0x1b')]);}_0x21f7c8[_0x83ea('0x34')]=qs['sort'](_0x5780ae['query'][_0x83ea('0x35')]);_0x21f7c8[_0x83ea('0x36')]=qs[_0x83ea('0x37')](_['pick'](_0x5780ae[_0x83ea('0x2d')],_0x35ae35[_0x83ea('0x37')]),_0x26506f);if(_0x5780ae[_0x83ea('0x2d')]['filter']){_0x21f7c8[_0x83ea('0x36')]=_[_0x83ea('0x38')](_0x21f7c8[_0x83ea('0x36')],{'$or':_[_0x83ea('0x25')](_0x26506f,function(_0x23bf89){if(_0x23bf89['type']!==_0x83ea('0x39')){var _0x47e3e2={};_0x47e3e2[_0x23bf89[_0x83ea('0x23')]]={'$like':'%'+_0x5780ae[_0x83ea('0x2d')]['filter']+'%'};return _0x47e3e2;}})});}_0x21f7c8=_['merge']({},_0x21f7c8,_0x5780ae[_0x83ea('0x3a')]);var _0x43455a={'where':_0x21f7c8[_0x83ea('0x36')]};return db[_0x83ea('0x26')]['count'](_0x43455a)[_0x83ea('0x3b')](function(_0x32f9f0){_0x190fdd['count']=_0x32f9f0;if(_0x5780ae[_0x83ea('0x2d')]['includeAll']){_0x21f7c8[_0x83ea('0x3c')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x83ea('0x3d')](_0x21f7c8);})[_0x83ea('0x3b')](function(_0x145ecf){_0x190fdd[_0x83ea('0x3e')]=_0x145ecf;return _0x190fdd;})[_0x83ea('0x3b')](respondWithFilteredResult(_0x1517ab,_0x21f7c8))['catch'](handleError(_0x1517ab,null));};exports[_0x83ea('0x3f')]=function(_0x580cd9,_0x388062){var _0x1ac760={'raw':![],'where':{'id':_0x580cd9[_0x83ea('0x40')]['id']}},_0x367c4b={};_0x367c4b['model']=_[_0x83ea('0x2c')](db[_0x83ea('0x26')][_0x83ea('0x27')]);_0x367c4b['query']=_[_0x83ea('0x2c')](_0x580cd9[_0x83ea('0x2d')]);_0x367c4b[_0x83ea('0x37')]=_[_0x83ea('0x2e')](_0x367c4b[_0x83ea('0x2b')],_0x367c4b[_0x83ea('0x2d')]);_0x1ac760[_0x83ea('0x2f')]=_['intersection'](_0x367c4b[_0x83ea('0x2b')],qs[_0x83ea('0x30')](_0x580cd9[_0x83ea('0x2d')][_0x83ea('0x30')]));_0x1ac760[_0x83ea('0x2f')]=_0x1ac760[_0x83ea('0x2f')]['length']?_0x1ac760['attributes']:_0x367c4b[_0x83ea('0x2b')];if(_0x580cd9[_0x83ea('0x2d')][_0x83ea('0x41')]){_0x1ac760['include']=[{'all':!![]}];}_0x1ac760=_[_0x83ea('0x38')]({},_0x1ac760,_0x580cd9[_0x83ea('0x3a')]);return db[_0x83ea('0x26')][_0x83ea('0x42')](_0x1ac760)['then'](handleEntityNotFound(_0x388062,null))['then'](respondWithResult(_0x388062,null))[_0x83ea('0x43')](handleError(_0x388062,null));};exports['create']=function(_0x1e3fdc,_0x4ef425){return db[_0x83ea('0x26')]['create'](_0x1e3fdc[_0x83ea('0x44')],{})[_0x83ea('0x3b')](respondWithResult(_0x4ef425,0xc9))['catch'](handleError(_0x4ef425,null));};exports[_0x83ea('0x20')]=function(_0x139085,_0x176ceb){if(_0x139085[_0x83ea('0x44')]['id']){delete _0x139085[_0x83ea('0x44')]['id'];}return db[_0x83ea('0x26')]['find']({'where':{'id':_0x139085['params']['id']}})[_0x83ea('0x3b')](handleEntityNotFound(_0x176ceb,null))[_0x83ea('0x3b')](saveUpdates(_0x139085[_0x83ea('0x44')],null))['then'](respondWithResult(_0x176ceb,null))[_0x83ea('0x43')](handleError(_0x176ceb,null));};exports['destroy']=function(_0x31d25d,_0x368277){return db[_0x83ea('0x26')]['find']({'where':{'id':_0x31d25d['params']['id']}})[_0x83ea('0x3b')](handleEntityNotFound(_0x368277,null))[_0x83ea('0x3b')](removeEntity(_0x368277,null))[_0x83ea('0x43')](handleError(_0x368277,null));};exports[_0x83ea('0x45')]=function(_0x5813ab,_0x334e30,_0x45ff19){var _0x335ea6={};var _0x1f7b0a={};var _0x54074d;var _0x7cc5d3;return db[_0x83ea('0x26')][_0x83ea('0x46')]({'where':{'id':_0x5813ab[_0x83ea('0x40')]['id']}})['then'](handleEntityNotFound(_0x334e30,null))['then'](function(_0x11f9f6){if(_0x11f9f6){_0x54074d=_0x11f9f6;_0x1f7b0a[_0x83ea('0x2b')]=_[_0x83ea('0x2c')](db['Dynamics365Field'][_0x83ea('0x27')]);_0x1f7b0a[_0x83ea('0x2d')]=_[_0x83ea('0x2c')](_0x5813ab[_0x83ea('0x2d')]);_0x1f7b0a[_0x83ea('0x37')]=_[_0x83ea('0x2e')](_0x1f7b0a[_0x83ea('0x2b')],_0x1f7b0a[_0x83ea('0x2d')]);_0x335ea6[_0x83ea('0x2f')]=_[_0x83ea('0x2e')](_0x1f7b0a[_0x83ea('0x2b')],qs['fields'](_0x5813ab[_0x83ea('0x2d')][_0x83ea('0x30')]));_0x335ea6['attributes']=_0x335ea6['attributes']['length']?_0x335ea6[_0x83ea('0x2f')]:_0x1f7b0a[_0x83ea('0x2b')];_0x335ea6[_0x83ea('0x34')]=qs[_0x83ea('0x35')](_0x5813ab['query'][_0x83ea('0x35')]);_0x335ea6['where']=qs[_0x83ea('0x37')](_[_0x83ea('0x47')](_0x5813ab[_0x83ea('0x2d')],_0x1f7b0a[_0x83ea('0x37')]));if(_0x5813ab[_0x83ea('0x2d')][_0x83ea('0x48')]){_0x335ea6[_0x83ea('0x36')]=_['merge'](_0x335ea6[_0x83ea('0x36')],{'$or':_[_0x83ea('0x25')](_0x335ea6[_0x83ea('0x2f')],function(_0x5adfa0){var _0x2b76c4={};_0x2b76c4[_0x5adfa0]={'$like':'%'+_0x5813ab[_0x83ea('0x2d')]['filter']+'%'};return _0x2b76c4;})});}_0x335ea6=_[_0x83ea('0x38')]({},_0x335ea6,_0x5813ab[_0x83ea('0x3a')]);return _0x54074d[_0x83ea('0x45')](_0x335ea6);}})[_0x83ea('0x3b')](function(_0x9950d3){if(_0x9950d3){_0x7cc5d3=_0x9950d3[_0x83ea('0x31')];if(!_0x5813ab[_0x83ea('0x2d')][_0x83ea('0x32')]('nolimit')){_0x335ea6[_0x83ea('0x19')]=qs[_0x83ea('0x19')](_0x5813ab[_0x83ea('0x2d')]['limit']);_0x335ea6[_0x83ea('0x1b')]=qs[_0x83ea('0x1b')](_0x5813ab[_0x83ea('0x2d')][_0x83ea('0x1b')]);}return _0x54074d[_0x83ea('0x45')](_0x335ea6);}})[_0x83ea('0x3b')](function(_0x4ac39c){if(_0x4ac39c){return _0x4ac39c?{'count':_0x7cc5d3,'rows':_0x4ac39c}:null;}})[_0x83ea('0x3b')](respondWithResult(_0x334e30,null))['catch'](handleError(_0x334e30,null));};exports[_0x83ea('0x49')]=function(_0xc47de2,_0x36ff1b,_0x3bfa4d){var _0x379397={};var _0x2c4d54={};var _0x2dd064;var _0xb5e19b;return db[_0x83ea('0x26')][_0x83ea('0x46')]({'where':{'id':_0xc47de2[_0x83ea('0x40')]['id']}})[_0x83ea('0x3b')](handleEntityNotFound(_0x36ff1b,null))[_0x83ea('0x3b')](function(_0x45f778){if(_0x45f778){_0x2dd064=_0x45f778;_0x2c4d54[_0x83ea('0x2b')]=_[_0x83ea('0x2c')](db[_0x83ea('0x4a')][_0x83ea('0x27')]);_0x2c4d54[_0x83ea('0x2d')]=_['keys'](_0xc47de2['query']);_0x2c4d54[_0x83ea('0x37')]=_[_0x83ea('0x2e')](_0x2c4d54[_0x83ea('0x2b')],_0x2c4d54[_0x83ea('0x2d')]);_0x379397[_0x83ea('0x2f')]=_[_0x83ea('0x2e')](_0x2c4d54['model'],qs[_0x83ea('0x30')](_0xc47de2[_0x83ea('0x2d')]['fields']));_0x379397[_0x83ea('0x2f')]=_0x379397[_0x83ea('0x2f')][_0x83ea('0x31')]?_0x379397['attributes']:_0x2c4d54[_0x83ea('0x2b')];_0x379397['order']=qs['sort'](_0xc47de2['query'][_0x83ea('0x35')]);_0x379397[_0x83ea('0x36')]=qs[_0x83ea('0x37')](_['pick'](_0xc47de2[_0x83ea('0x2d')],_0x2c4d54['filters']));if(_0xc47de2['query'][_0x83ea('0x48')]){_0x379397[_0x83ea('0x36')]=_[_0x83ea('0x38')](_0x379397[_0x83ea('0x36')],{'$or':_[_0x83ea('0x25')](_0x379397['attributes'],function(_0x6568af){var _0x470e5c={};_0x470e5c[_0x6568af]={'$like':'%'+_0xc47de2['query'][_0x83ea('0x48')]+'%'};return _0x470e5c;})});}_0x379397=_['merge']({},_0x379397,_0xc47de2[_0x83ea('0x3a')]);return _0x2dd064[_0x83ea('0x49')](_0x379397);}})[_0x83ea('0x3b')](function(_0x408168){if(_0x408168){_0xb5e19b=_0x408168['length'];if(!_0xc47de2[_0x83ea('0x2d')]['hasOwnProperty'](_0x83ea('0x33'))){_0x379397[_0x83ea('0x19')]=qs[_0x83ea('0x19')](_0xc47de2[_0x83ea('0x2d')][_0x83ea('0x19')]);_0x379397['offset']=qs[_0x83ea('0x1b')](_0xc47de2[_0x83ea('0x2d')][_0x83ea('0x1b')]);}return _0x2dd064[_0x83ea('0x49')](_0x379397);}})['then'](function(_0x394b37){if(_0x394b37){return _0x394b37?{'count':_0xb5e19b,'rows':_0x394b37}:null;}})[_0x83ea('0x3b')](respondWithResult(_0x36ff1b,null))[_0x83ea('0x43')](handleError(_0x36ff1b,null));};exports[_0x83ea('0x4b')]=function(_0x23c005,_0x43c836,_0x4fa6de){var _0xda4de9={};var _0x6ff10f={};var _0x51597d;var _0x48a18b;return db['Dynamics365Configuration'][_0x83ea('0x46')]({'where':{'id':_0x23c005[_0x83ea('0x40')]['id']}})[_0x83ea('0x3b')](handleEntityNotFound(_0x43c836,null))[_0x83ea('0x3b')](function(_0x3d8416){if(_0x3d8416){_0x51597d=_0x3d8416;_0x6ff10f[_0x83ea('0x2b')]=_[_0x83ea('0x2c')](db['Dynamics365Field'][_0x83ea('0x27')]);_0x6ff10f['query']=_[_0x83ea('0x2c')](_0x23c005[_0x83ea('0x2d')]);_0x6ff10f[_0x83ea('0x37')]=_['intersection'](_0x6ff10f[_0x83ea('0x2b')],_0x6ff10f['query']);_0xda4de9[_0x83ea('0x2f')]=_[_0x83ea('0x2e')](_0x6ff10f[_0x83ea('0x2b')],qs[_0x83ea('0x30')](_0x23c005['query'][_0x83ea('0x30')]));_0xda4de9[_0x83ea('0x2f')]=_0xda4de9[_0x83ea('0x2f')]['length']?_0xda4de9[_0x83ea('0x2f')]:_0x6ff10f[_0x83ea('0x2b')];_0xda4de9['order']=qs[_0x83ea('0x35')](_0x23c005[_0x83ea('0x2d')][_0x83ea('0x35')]);_0xda4de9['where']=qs[_0x83ea('0x37')](_['pick'](_0x23c005[_0x83ea('0x2d')],_0x6ff10f[_0x83ea('0x37')]));if(_0x23c005[_0x83ea('0x2d')][_0x83ea('0x48')]){_0xda4de9[_0x83ea('0x36')]=_[_0x83ea('0x38')](_0xda4de9['where'],{'$or':_['map'](_0xda4de9[_0x83ea('0x2f')],function(_0x19c806){var _0x26f15a={};_0x26f15a[_0x19c806]={'$like':'%'+_0x23c005[_0x83ea('0x2d')]['filter']+'%'};return _0x26f15a;})});}_0xda4de9=_['merge']({},_0xda4de9,_0x23c005[_0x83ea('0x3a')]);return _0x51597d[_0x83ea('0x4b')](_0xda4de9);}})[_0x83ea('0x3b')](function(_0x5d2ee1){if(_0x5d2ee1){_0x48a18b=_0x5d2ee1['length'];if(!_0x23c005['query'][_0x83ea('0x32')](_0x83ea('0x33'))){_0xda4de9['limit']=qs[_0x83ea('0x19')](_0x23c005[_0x83ea('0x2d')][_0x83ea('0x19')]);_0xda4de9[_0x83ea('0x1b')]=qs['offset'](_0x23c005[_0x83ea('0x2d')][_0x83ea('0x1b')]);}return _0x51597d[_0x83ea('0x4b')](_0xda4de9);}})[_0x83ea('0x3b')](function(_0x50144e){if(_0x50144e){return _0x50144e?{'count':_0x48a18b,'rows':_0x50144e}:null;}})[_0x83ea('0x3b')](respondWithResult(_0x43c836,null))['catch'](handleError(_0x43c836,null));}; \ No newline at end of file +var _0x02f6=['count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Dynamics365Configuration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getFields','findOne','Dynamics365Field','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','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','sendStatus','end','status','offset','undefined','limit'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x02f6,0xd4));var _0x602f=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x02f6[_0x580647];return _0x5f0792;};'use strict';var emlformat=require(_0x602f('0x0'));var rimraf=require(_0x602f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x602f('0x2'));var rp=require(_0x602f('0x3'));var moment=require('moment');var BPromise=require(_0x602f('0x4'));var Mustache=require(_0x602f('0x5'));var util=require(_0x602f('0x6'));var path=require(_0x602f('0x7'));var sox=require(_0x602f('0x8'));var csv=require(_0x602f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x602f('0xa'));var _=require('lodash');var squel=require(_0x602f('0xb'));var crypto=require(_0x602f('0xc'));var jsforce=require(_0x602f('0xd'));var deskjs=require(_0x602f('0xe'));var toCsv=require(_0x602f('0x9'));var querystring=require(_0x602f('0xf'));var Papa=require(_0x602f('0x10'));var Redis=require(_0x602f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x602f('0x12'));var as=require(_0x602f('0x13'));var hardwareService=require(_0x602f('0x14'));var logger=require(_0x602f('0x15'))('api');var utils=require(_0x602f('0x16'));var config=require(_0x602f('0x17'));var licenseUtil=require(_0x602f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44dcb9,_0x363046){_0x363046=_0x363046||0xcc;return function(_0x2d3c7e){if(_0x2d3c7e){return _0x44dcb9[_0x602f('0x19')](_0x363046);}return _0x44dcb9['status'](_0x363046)[_0x602f('0x1a')]();};}function respondWithResult(_0x58dccf,_0x50a356){_0x50a356=_0x50a356||0xc8;return function(_0x32c92d){if(_0x32c92d){return _0x58dccf[_0x602f('0x1b')](_0x50a356)['json'](_0x32c92d);}};}function respondWithFilteredResult(_0x20e2cf,_0x245711){return function(_0x289024){if(_0x289024){var _0x3d2642=typeof _0x245711[_0x602f('0x1c')]===_0x602f('0x1d')&&typeof _0x245711[_0x602f('0x1e')]==='undefined';var _0xf2e8b7=_0x289024['count'];var _0x27047c=_0x3d2642?0x0:_0x245711[_0x602f('0x1c')];var _0x38570e=_0x3d2642?_0x289024[_0x602f('0x1f')]:_0x245711[_0x602f('0x1c')]+_0x245711['limit'];var _0x1a8a47;if(_0x38570e>=_0xf2e8b7){_0x38570e=_0xf2e8b7;_0x1a8a47=0xc8;}else{_0x1a8a47=0xce;}_0x20e2cf['status'](_0x1a8a47);return _0x20e2cf['set'](_0x602f('0x20'),_0x27047c+'-'+_0x38570e+'/'+_0xf2e8b7)['json'](_0x289024);}return null;};}function patchUpdates(_0x252571){return function(_0x30b969){try{jsonpatch[_0x602f('0x21')](_0x30b969,_0x252571,!![]);}catch(_0x34dcfb){return BPromise[_0x602f('0x22')](_0x34dcfb);}return _0x30b969[_0x602f('0x23')]();};}function saveUpdates(_0x341dda,_0x559dc3){return function(_0x4ae384){if(_0x4ae384){return _0x4ae384[_0x602f('0x24')](_0x341dda)[_0x602f('0x25')](function(_0x13fb7f){return _0x13fb7f;});}return null;};}function removeEntity(_0x3797db,_0x51c93a){return function(_0x3d3edb){if(_0x3d3edb){return _0x3d3edb[_0x602f('0x26')]()[_0x602f('0x25')](function(){_0x3797db['status'](0xcc)[_0x602f('0x1a')]();});}};}function handleEntityNotFound(_0xdef098,_0x3cf909){return function(_0x3e8648){if(!_0x3e8648){_0xdef098[_0x602f('0x19')](0x194);}return _0x3e8648;};}function handleError(_0xe6226d,_0x9ea828){_0x9ea828=_0x9ea828||0x1f4;return function(_0x28cb21){logger[_0x602f('0x27')](_0x28cb21[_0x602f('0x28')]);if(_0x28cb21[_0x602f('0x29')]){delete _0x28cb21['name'];}_0xe6226d[_0x602f('0x1b')](_0x9ea828)[_0x602f('0x2a')](_0x28cb21);};}exports['index']=function(_0x19d018,_0x175cc0){var _0x543dc5={},_0x5668b7={},_0x13708a={'count':0x0,'rows':[]};var _0x5de0b1=_['map'](db[_0x602f('0x2b')]['rawAttributes'],function(_0x222dd6){return{'name':_0x222dd6[_0x602f('0x2c')],'type':_0x222dd6[_0x602f('0x2d')][_0x602f('0x2e')]};});_0x5668b7[_0x602f('0x2f')]=_[_0x602f('0x30')](_0x5de0b1,_0x602f('0x29'));_0x5668b7[_0x602f('0x31')]=_['keys'](_0x19d018[_0x602f('0x31')]);_0x5668b7[_0x602f('0x32')]=_[_0x602f('0x33')](_0x5668b7[_0x602f('0x2f')],_0x5668b7[_0x602f('0x31')]);_0x543dc5[_0x602f('0x34')]=_[_0x602f('0x33')](_0x5668b7[_0x602f('0x2f')],qs[_0x602f('0x35')](_0x19d018['query'][_0x602f('0x35')]));_0x543dc5[_0x602f('0x34')]=_0x543dc5[_0x602f('0x34')][_0x602f('0x36')]?_0x543dc5[_0x602f('0x34')]:_0x5668b7[_0x602f('0x2f')];if(!_0x19d018[_0x602f('0x31')][_0x602f('0x37')]('nolimit')){_0x543dc5[_0x602f('0x1e')]=qs['limit'](_0x19d018[_0x602f('0x31')][_0x602f('0x1e')]);_0x543dc5[_0x602f('0x1c')]=qs[_0x602f('0x1c')](_0x19d018[_0x602f('0x31')][_0x602f('0x1c')]);}_0x543dc5['order']=qs[_0x602f('0x38')](_0x19d018[_0x602f('0x31')][_0x602f('0x38')]);_0x543dc5[_0x602f('0x39')]=qs[_0x602f('0x32')](_[_0x602f('0x3a')](_0x19d018[_0x602f('0x31')],_0x5668b7[_0x602f('0x32')]),_0x5de0b1);if(_0x19d018[_0x602f('0x31')][_0x602f('0x3b')]){_0x543dc5[_0x602f('0x39')]=_[_0x602f('0x3c')](_0x543dc5[_0x602f('0x39')],{'$or':_[_0x602f('0x30')](_0x5de0b1,function(_0x54fca0){if(_0x54fca0[_0x602f('0x2d')]!=='VIRTUAL'){var _0x43bf44={};_0x43bf44[_0x54fca0[_0x602f('0x29')]]={'$like':'%'+_0x19d018[_0x602f('0x31')][_0x602f('0x3b')]+'%'};return _0x43bf44;}})});}_0x543dc5=_[_0x602f('0x3c')]({},_0x543dc5,_0x19d018[_0x602f('0x3d')]);var _0x42a7da={'where':_0x543dc5[_0x602f('0x39')]};return db[_0x602f('0x2b')][_0x602f('0x1f')](_0x42a7da)['then'](function(_0x5aa1){_0x13708a[_0x602f('0x1f')]=_0x5aa1;if(_0x19d018[_0x602f('0x31')][_0x602f('0x3e')]){_0x543dc5[_0x602f('0x3f')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x602f('0x40')](_0x543dc5);})[_0x602f('0x25')](function(_0x5a7670){_0x13708a[_0x602f('0x41')]=_0x5a7670;return _0x13708a;})['then'](respondWithFilteredResult(_0x175cc0,_0x543dc5))[_0x602f('0x42')](handleError(_0x175cc0,null));};exports[_0x602f('0x43')]=function(_0x122d00,_0x320a33){var _0x346f53={'raw':![],'where':{'id':_0x122d00[_0x602f('0x44')]['id']}},_0xd3c3ec={};_0xd3c3ec['model']=_[_0x602f('0x45')](db[_0x602f('0x2b')][_0x602f('0x46')]);_0xd3c3ec[_0x602f('0x31')]=_[_0x602f('0x45')](_0x122d00[_0x602f('0x31')]);_0xd3c3ec['filters']=_[_0x602f('0x33')](_0xd3c3ec[_0x602f('0x2f')],_0xd3c3ec[_0x602f('0x31')]);_0x346f53[_0x602f('0x34')]=_['intersection'](_0xd3c3ec['model'],qs['fields'](_0x122d00['query']['fields']));_0x346f53['attributes']=_0x346f53[_0x602f('0x34')][_0x602f('0x36')]?_0x346f53[_0x602f('0x34')]:_0xd3c3ec[_0x602f('0x2f')];if(_0x122d00[_0x602f('0x31')]['includeAll']){_0x346f53[_0x602f('0x3f')]=[{'all':!![]}];}_0x346f53=_[_0x602f('0x3c')]({},_0x346f53,_0x122d00['options']);return db[_0x602f('0x2b')][_0x602f('0x47')](_0x346f53)[_0x602f('0x25')](handleEntityNotFound(_0x320a33,null))[_0x602f('0x25')](respondWithResult(_0x320a33,null))[_0x602f('0x42')](handleError(_0x320a33,null));};exports[_0x602f('0x48')]=function(_0x1ac7d0,_0x55cbec){return db[_0x602f('0x2b')]['create'](_0x1ac7d0[_0x602f('0x49')],{})[_0x602f('0x25')](respondWithResult(_0x55cbec,0xc9))[_0x602f('0x42')](handleError(_0x55cbec,null));};exports[_0x602f('0x24')]=function(_0x472dd2,_0x394c25){if(_0x472dd2['body']['id']){delete _0x472dd2[_0x602f('0x49')]['id'];}return db[_0x602f('0x2b')][_0x602f('0x47')]({'where':{'id':_0x472dd2[_0x602f('0x44')]['id']}})[_0x602f('0x25')](handleEntityNotFound(_0x394c25,null))['then'](saveUpdates(_0x472dd2[_0x602f('0x49')],null))[_0x602f('0x25')](respondWithResult(_0x394c25,null))[_0x602f('0x42')](handleError(_0x394c25,null));};exports[_0x602f('0x26')]=function(_0x2d75d4,_0x287d07){return db['Dynamics365Configuration'][_0x602f('0x47')]({'where':{'id':_0x2d75d4[_0x602f('0x44')]['id']}})[_0x602f('0x25')](handleEntityNotFound(_0x287d07,null))[_0x602f('0x25')](removeEntity(_0x287d07,null))[_0x602f('0x42')](handleError(_0x287d07,null));};exports[_0x602f('0x4a')]=function(_0x467072,_0x141fcf,_0x5c929b){var _0x10d4f3={};var _0x3c0c5c={};var _0x3067d0;var _0x802305;return db[_0x602f('0x2b')][_0x602f('0x4b')]({'where':{'id':_0x467072['params']['id']}})[_0x602f('0x25')](handleEntityNotFound(_0x141fcf,null))[_0x602f('0x25')](function(_0x43fd23){if(_0x43fd23){_0x3067d0=_0x43fd23;_0x3c0c5c[_0x602f('0x2f')]=_[_0x602f('0x45')](db[_0x602f('0x4c')]['rawAttributes']);_0x3c0c5c['query']=_[_0x602f('0x45')](_0x467072['query']);_0x3c0c5c[_0x602f('0x32')]=_['intersection'](_0x3c0c5c[_0x602f('0x2f')],_0x3c0c5c[_0x602f('0x31')]);_0x10d4f3[_0x602f('0x34')]=_['intersection'](_0x3c0c5c['model'],qs[_0x602f('0x35')](_0x467072[_0x602f('0x31')][_0x602f('0x35')]));_0x10d4f3[_0x602f('0x34')]=_0x10d4f3[_0x602f('0x34')][_0x602f('0x36')]?_0x10d4f3['attributes']:_0x3c0c5c[_0x602f('0x2f')];_0x10d4f3[_0x602f('0x4d')]=qs[_0x602f('0x38')](_0x467072[_0x602f('0x31')][_0x602f('0x38')]);_0x10d4f3[_0x602f('0x39')]=qs[_0x602f('0x32')](_[_0x602f('0x3a')](_0x467072[_0x602f('0x31')],_0x3c0c5c[_0x602f('0x32')]));if(_0x467072[_0x602f('0x31')][_0x602f('0x3b')]){_0x10d4f3[_0x602f('0x39')]=_[_0x602f('0x3c')](_0x10d4f3[_0x602f('0x39')],{'$or':_['map'](_0x10d4f3[_0x602f('0x34')],function(_0x18ae09){var _0x1cde3d={};_0x1cde3d[_0x18ae09]={'$like':'%'+_0x467072[_0x602f('0x31')][_0x602f('0x3b')]+'%'};return _0x1cde3d;})});}_0x10d4f3=_[_0x602f('0x3c')]({},_0x10d4f3,_0x467072[_0x602f('0x3d')]);return _0x3067d0[_0x602f('0x4a')](_0x10d4f3);}})['then'](function(_0x5bb800){if(_0x5bb800){_0x802305=_0x5bb800[_0x602f('0x36')];if(!_0x467072['query'][_0x602f('0x37')](_0x602f('0x4e'))){_0x10d4f3['limit']=qs[_0x602f('0x1e')](_0x467072[_0x602f('0x31')]['limit']);_0x10d4f3[_0x602f('0x1c')]=qs['offset'](_0x467072[_0x602f('0x31')][_0x602f('0x1c')]);}return _0x3067d0[_0x602f('0x4a')](_0x10d4f3);}})[_0x602f('0x25')](function(_0x46b70f){if(_0x46b70f){return _0x46b70f?{'count':_0x802305,'rows':_0x46b70f}:null;}})[_0x602f('0x25')](respondWithResult(_0x141fcf,null))[_0x602f('0x42')](handleError(_0x141fcf,null));};exports[_0x602f('0x4f')]=function(_0x1f8225,_0x4979a9,_0x35b236){var _0x1b6852={};var _0x35657d={};var _0x3527b4;var _0x4de178;return db[_0x602f('0x2b')][_0x602f('0x4b')]({'where':{'id':_0x1f8225['params']['id']}})['then'](handleEntityNotFound(_0x4979a9,null))['then'](function(_0xd21879){if(_0xd21879){_0x3527b4=_0xd21879;_0x35657d['model']=_['keys'](db[_0x602f('0x4c')][_0x602f('0x46')]);_0x35657d[_0x602f('0x31')]=_[_0x602f('0x45')](_0x1f8225[_0x602f('0x31')]);_0x35657d[_0x602f('0x32')]=_['intersection'](_0x35657d[_0x602f('0x2f')],_0x35657d[_0x602f('0x31')]);_0x1b6852[_0x602f('0x34')]=_[_0x602f('0x33')](_0x35657d[_0x602f('0x2f')],qs[_0x602f('0x35')](_0x1f8225[_0x602f('0x31')]['fields']));_0x1b6852['attributes']=_0x1b6852['attributes'][_0x602f('0x36')]?_0x1b6852[_0x602f('0x34')]:_0x35657d[_0x602f('0x2f')];_0x1b6852['order']=qs['sort'](_0x1f8225[_0x602f('0x31')]['sort']);_0x1b6852[_0x602f('0x39')]=qs[_0x602f('0x32')](_[_0x602f('0x3a')](_0x1f8225[_0x602f('0x31')],_0x35657d[_0x602f('0x32')]));if(_0x1f8225[_0x602f('0x31')][_0x602f('0x3b')]){_0x1b6852[_0x602f('0x39')]=_['merge'](_0x1b6852['where'],{'$or':_[_0x602f('0x30')](_0x1b6852[_0x602f('0x34')],function(_0x3e4389){var _0x4ed17b={};_0x4ed17b[_0x3e4389]={'$like':'%'+_0x1f8225[_0x602f('0x31')][_0x602f('0x3b')]+'%'};return _0x4ed17b;})});}_0x1b6852=_[_0x602f('0x3c')]({},_0x1b6852,_0x1f8225[_0x602f('0x3d')]);return _0x3527b4[_0x602f('0x4f')](_0x1b6852);}})[_0x602f('0x25')](function(_0x53d59f){if(_0x53d59f){_0x4de178=_0x53d59f[_0x602f('0x36')];if(!_0x1f8225[_0x602f('0x31')][_0x602f('0x37')](_0x602f('0x4e'))){_0x1b6852[_0x602f('0x1e')]=qs['limit'](_0x1f8225[_0x602f('0x31')][_0x602f('0x1e')]);_0x1b6852[_0x602f('0x1c')]=qs[_0x602f('0x1c')](_0x1f8225['query'][_0x602f('0x1c')]);}return _0x3527b4[_0x602f('0x4f')](_0x1b6852);}})[_0x602f('0x25')](function(_0x7c556e){if(_0x7c556e){return _0x7c556e?{'count':_0x4de178,'rows':_0x7c556e}:null;}})[_0x602f('0x25')](respondWithResult(_0x4979a9,null))[_0x602f('0x42')](handleError(_0x4979a9,null));};exports[_0x602f('0x50')]=function(_0x317750,_0x4dd59b,_0xe96623){var _0xf9ab19={};var _0x1c2adb={};var _0x20f79d;var _0x4ceee8;return db[_0x602f('0x2b')][_0x602f('0x4b')]({'where':{'id':_0x317750[_0x602f('0x44')]['id']}})[_0x602f('0x25')](handleEntityNotFound(_0x4dd59b,null))[_0x602f('0x25')](function(_0x50f5d6){if(_0x50f5d6){_0x20f79d=_0x50f5d6;_0x1c2adb['model']=_['keys'](db[_0x602f('0x4c')][_0x602f('0x46')]);_0x1c2adb['query']=_[_0x602f('0x45')](_0x317750[_0x602f('0x31')]);_0x1c2adb['filters']=_[_0x602f('0x33')](_0x1c2adb[_0x602f('0x2f')],_0x1c2adb[_0x602f('0x31')]);_0xf9ab19['attributes']=_[_0x602f('0x33')](_0x1c2adb['model'],qs[_0x602f('0x35')](_0x317750[_0x602f('0x31')]['fields']));_0xf9ab19['attributes']=_0xf9ab19[_0x602f('0x34')][_0x602f('0x36')]?_0xf9ab19['attributes']:_0x1c2adb['model'];_0xf9ab19[_0x602f('0x4d')]=qs['sort'](_0x317750[_0x602f('0x31')][_0x602f('0x38')]);_0xf9ab19[_0x602f('0x39')]=qs[_0x602f('0x32')](_[_0x602f('0x3a')](_0x317750[_0x602f('0x31')],_0x1c2adb[_0x602f('0x32')]));if(_0x317750[_0x602f('0x31')][_0x602f('0x3b')]){_0xf9ab19[_0x602f('0x39')]=_[_0x602f('0x3c')](_0xf9ab19[_0x602f('0x39')],{'$or':_[_0x602f('0x30')](_0xf9ab19[_0x602f('0x34')],function(_0xa16d2a){var _0x1e09d7={};_0x1e09d7[_0xa16d2a]={'$like':'%'+_0x317750['query']['filter']+'%'};return _0x1e09d7;})});}_0xf9ab19=_[_0x602f('0x3c')]({},_0xf9ab19,_0x317750['options']);return _0x20f79d[_0x602f('0x50')](_0xf9ab19);}})['then'](function(_0x1acf56){if(_0x1acf56){_0x4ceee8=_0x1acf56['length'];if(!_0x317750[_0x602f('0x31')][_0x602f('0x37')](_0x602f('0x4e'))){_0xf9ab19[_0x602f('0x1e')]=qs[_0x602f('0x1e')](_0x317750['query']['limit']);_0xf9ab19['offset']=qs['offset'](_0x317750[_0x602f('0x31')][_0x602f('0x1c')]);}return _0x20f79d[_0x602f('0x50')](_0xf9ab19);}})[_0x602f('0x25')](function(_0x3b58da){if(_0x3b58da){return _0x3b58da?{'count':_0x4ceee8,'rows':_0x3b58da}:null;}})[_0x602f('0x25')](respondWithResult(_0x4dd59b,null))[_0x602f('0x42')](handleError(_0x4dd59b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3c16a25..6656c6d 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 _0x81bd=['../../config/environment','./intDynamics365Configuration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x196e35,_0x76fe38){var _0x360fdb=function(_0x18851b){while(--_0x18851b){_0x196e35['push'](_0x196e35['shift']());}};_0x360fdb(++_0x76fe38);}(_0x81bd,0x7c));var _0xd81b=function(_0x2b43ba,_0x3510f1){_0x2b43ba=_0x2b43ba-0x0;var _0x26d41e=_0x81bd[_0x2b43ba];return _0x26d41e;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54995e,_0x3fbd7d){var _0x3ef36a=function(_0x2b942c){while(--_0x2b942c){_0x54995e['push'](_0x54995e['shift']());}};_0x3ef36a(++_0x3fbd7d);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb4e6[_0x3f3f40];return _0x403b7a;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 57ea909..f66b3d7 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 _0x9b49=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x1d47c3,_0x856818){var _0x220130=function(_0x1dddd6){while(--_0x1dddd6){_0x1d47c3['push'](_0x1d47c3['shift']());}};_0x220130(++_0x856818);}(_0x9b49,0x1f4));var _0x99b4=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x9b49[_0xdd82b4];return _0x549bb2;};'use strict';var _=require(_0x99b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x99b4('0x1'));var fs=require('fs');var Redis=require(_0x99b4('0x2'));var db=require(_0x99b4('0x3'))['db'];var utils=require(_0x99b4('0x4'));var logger=require(_0x99b4('0x5'))('rpc');var config=require(_0x99b4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x99b4('0x7')][_0x99b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16a400,_0x490a98,_0x4970e2){return new BPromise(function(_0x266893,_0x2ffc69){return client[_0x99b4('0x9')](_0x16a400,_0x4970e2)[_0x99b4('0xa')](function(_0x335426){logger[_0x99b4('0xb')](_0x99b4('0xc'),_0x490a98,_0x99b4('0xd'));logger[_0x99b4('0xe')](_0x99b4('0xf'),_0x490a98,_0x99b4('0xd'),JSON[_0x99b4('0x10')](_0x335426));if(_0x335426[_0x99b4('0x11')]){if(_0x335426[_0x99b4('0x11')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x490a98,_0x335426[_0x99b4('0x11')][_0x99b4('0x12')]);return _0x2ffc69(_0x335426[_0x99b4('0x11')][_0x99b4('0x12')]);}logger[_0x99b4('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x490a98,_0x335426[_0x99b4('0x11')][_0x99b4('0x12')]);return _0x266893(_0x335426[_0x99b4('0x11')]['message']);}else{logger[_0x99b4('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x490a98,_0x99b4('0xd'));_0x266893(_0x335426[_0x99b4('0x13')][_0x99b4('0x12')]);}})[_0x99b4('0x14')](function(_0x2b9be6){logger[_0x99b4('0x11')](_0x99b4('0xc'),_0x490a98,_0x2b9be6);_0x2ffc69(_0x2b9be6);});});} \ No newline at end of file +var _0x18fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x18fa,0x1b8));var _0xa18f=function(_0x240a3a,_0xfe39d6){_0x240a3a=_0x240a3a-0x0;var _0x51a893=_0x18fa[_0x240a3a];return _0x51a893;};'use strict';var _=require('lodash');var util=require(_0xa18f('0x0'));var moment=require('moment');var BPromise=require(_0xa18f('0x1'));var rs=require(_0xa18f('0x2'));var fs=require('fs');var Redis=require(_0xa18f('0x3'));var db=require(_0xa18f('0x4'))['db'];var utils=require(_0xa18f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa18f('0x6'));var client=jayson[_0xa18f('0x7')][_0xa18f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ed97a,_0x3b673b,_0x3e2f2d){return new BPromise(function(_0x6f780a,_0xe96027){return client[_0xa18f('0x9')](_0x1ed97a,_0x3e2f2d)[_0xa18f('0xa')](function(_0x2ab2af){logger[_0xa18f('0xb')](_0xa18f('0xc'),_0x3b673b,'request\x20sent');logger[_0xa18f('0xd')](_0xa18f('0xe'),_0x3b673b,_0xa18f('0xf'),JSON[_0xa18f('0x10')](_0x2ab2af));if(_0x2ab2af['error']){if(_0x2ab2af[_0xa18f('0x11')][_0xa18f('0x12')]===0x1f4){logger['error'](_0xa18f('0xc'),_0x3b673b,_0x2ab2af[_0xa18f('0x11')][_0xa18f('0x13')]);return _0xe96027(_0x2ab2af[_0xa18f('0x11')][_0xa18f('0x13')]);}logger['error'](_0xa18f('0xc'),_0x3b673b,_0x2ab2af['error'][_0xa18f('0x13')]);return _0x6f780a(_0x2ab2af['error'][_0xa18f('0x13')]);}else{logger[_0xa18f('0xb')](_0xa18f('0xc'),_0x3b673b,_0xa18f('0xf'));_0x6f780a(_0x2ab2af[_0xa18f('0x14')]['message']);}})[_0xa18f('0x15')](function(_0x532088){logger[_0xa18f('0x11')](_0xa18f('0xc'),_0x3b673b,_0x532088);_0xe96027(_0x532088);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b196f5c..02f0560 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 _0x5d70=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intDynamics365Field.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x322177,_0x4a29c4){var _0x357c57=function(_0x5114c9){while(--_0x5114c9){_0x322177['push'](_0x322177['shift']());}};_0x357c57(++_0x4a29c4);}(_0x5d70,0x6d));var _0x05d7=function(_0xa141a0,_0x3fb938){_0xa141a0=_0xa141a0-0x0;var _0x2e0c6d=_0x5d70[_0xa141a0];return _0x2e0c6d;};'use strict';var multer=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var path=require(_0x05d7('0x2'));var timeout=require(_0x05d7('0x3'));var express=require(_0x05d7('0x4'));var router=express[_0x05d7('0x5')]();var fs_extra=require(_0x05d7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x05d7('0x7'));router[_0x05d7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x05d7('0x9'),auth[_0x05d7('0xa')](),controller['show']);router[_0x05d7('0xb')]('/',auth[_0x05d7('0xa')](),controller[_0x05d7('0xc')]);router[_0x05d7('0xd')](_0x05d7('0x9'),auth[_0x05d7('0xa')](),controller[_0x05d7('0xe')]);router[_0x05d7('0xf')](_0x05d7('0x9'),auth[_0x05d7('0xa')](),controller[_0x05d7('0x10')]);module[_0x05d7('0x11')]=router; \ No newline at end of file +var _0xac5e=['multer','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x138470,_0x1ba858){var _0x351467=function(_0x429f19){while(--_0x429f19){_0x138470['push'](_0x138470['shift']());}};_0x351467(++_0x1ba858);}(_0xac5e,0x1ad));var _0xeac5=function(_0x450514,_0x2f779b){_0x450514=_0x450514-0x0;var _0x3356fc=_0xac5e[_0x450514];return _0x3356fc;};'use strict';var multer=require(_0xeac5('0x0'));var util=require('util');var path=require(_0xeac5('0x1'));var timeout=require('connect-timeout');var express=require(_0xeac5('0x2'));var router=express[_0xeac5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeac5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeac5('0x5'));var controller=require('./intDynamics365Field.controller');router[_0xeac5('0x6')]('/',auth[_0xeac5('0x7')](),controller['index']);router['get'](_0xeac5('0x8'),auth[_0xeac5('0x7')](),controller[_0xeac5('0x9')]);router[_0xeac5('0xa')]('/',auth[_0xeac5('0x7')](),controller['create']);router[_0xeac5('0xb')]('/:id',auth[_0xeac5('0x7')](),controller[_0xeac5('0xc')]);router['delete'](_0xeac5('0x8'),auth[_0xeac5('0x7')](),controller['destroy']);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 febf9f8..acf1ab5 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 _0x25cd=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x16e95e,_0x36f949){var _0x222d8c=function(_0x440d41){while(--_0x440d41){_0x16e95e['push'](_0x16e95e['shift']());}};_0x222d8c(++_0x36f949);}(_0x25cd,0x11d));var _0xd25c=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x25cd[_0x1385dc];return _0x2f6469;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd25c('0x0')](_0xd25c('0x1'),_0xd25c('0x2'),_0xd25c('0x3'),_0xd25c('0x4'),_0xd25c('0x5')),'defaultValue':_0xd25c('0x1')},'content':{'type':Sequelize[_0xd25c('0x6')]},'key':{'type':Sequelize[_0xd25c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd25c('0x1'),_0xd25c('0x2'),_0xd25c('0x3'))},'keyContent':{'type':Sequelize[_0xd25c('0x6')]},'idField':{'type':Sequelize[_0xd25c('0x6')]},'nameField':{'type':Sequelize[_0xd25c('0x6')]},'customField':{'type':Sequelize[_0xd25c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd25c('0x6')]}}; \ No newline at end of file +var _0xe0de=['ENUM','variable','BOOLEAN','customVariable','keyValue','string','STRING'];(function(_0x4dca20,_0x54277b){var _0x43124a=function(_0x354808){while(--_0x354808){_0x4dca20['push'](_0x4dca20['shift']());}};_0x43124a(++_0x54277b);}(_0xe0de,0xa4));var _0xee0d=function(_0x161b80,_0x3417a5){_0x161b80=_0x161b80-0x0;var _0x17ffcb=_0xe0de[_0x161b80];return _0x17ffcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xee0d('0x0'),_0xee0d('0x1'),'picklist'),'defaultValue':_0xee0d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xee0d('0x3')]},'keyType':{'type':Sequelize[_0xee0d('0x4')]('string',_0xee0d('0x5'),_0xee0d('0x0'))},'keyContent':{'type':Sequelize[_0xee0d('0x3')]},'idField':{'type':Sequelize[_0xee0d('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xee0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee0d('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d14eb20..5911421 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 _0x2f35=['create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find'];(function(_0x5993a9,_0x26bc1f){var _0x377c73=function(_0x1614bb){while(--_0x1614bb){_0x5993a9['push'](_0x5993a9['shift']());}};_0x377c73(++_0x26bc1f);}(_0x2f35,0xd7));var _0x52f3=function(_0x16df8f,_0x3dbe15){_0x16df8f=_0x16df8f-0x0;var _0x56ffee=_0x2f35[_0x16df8f];return _0x56ffee;};'use strict';var emlformat=require(_0x52f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52f3('0x1'));var jsonpatch=require(_0x52f3('0x2'));var rp=require(_0x52f3('0x3'));var moment=require(_0x52f3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x52f3('0x5'));var util=require(_0x52f3('0x6'));var path=require('path');var sox=require(_0x52f3('0x7'));var csv=require('to-csv');var ejs=require(_0x52f3('0x8'));var fs=require('fs');var fs_extra=require(_0x52f3('0x9'));var _=require(_0x52f3('0xa'));var squel=require(_0x52f3('0xb'));var crypto=require('crypto');var jsforce=require(_0x52f3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x52f3('0xd'));var Redis=require(_0x52f3('0xe'));var authService=require(_0x52f3('0xf'));var qs=require(_0x52f3('0x10'));var as=require(_0x52f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52f3('0x12'))(_0x52f3('0x13'));var utils=require(_0x52f3('0x14'));var config=require(_0x52f3('0x15'));var licenseUtil=require(_0x52f3('0x16'));var db=require(_0x52f3('0x17'))['db'];function respondWithStatusCode(_0x16ccec,_0x2327ca){_0x2327ca=_0x2327ca||0xcc;return function(_0x4df72a){if(_0x4df72a){return _0x16ccec['sendStatus'](_0x2327ca);}return _0x16ccec[_0x52f3('0x18')](_0x2327ca)[_0x52f3('0x19')]();};}function respondWithResult(_0x317697,_0x493f29){_0x493f29=_0x493f29||0xc8;return function(_0x403094){if(_0x403094){return _0x317697[_0x52f3('0x18')](_0x493f29)[_0x52f3('0x1a')](_0x403094);}};}function respondWithFilteredResult(_0x275cf8,_0x5f0a36){return function(_0x5aaef2){if(_0x5aaef2){var _0x360133=typeof _0x5f0a36[_0x52f3('0x1b')]==='undefined'&&typeof _0x5f0a36[_0x52f3('0x1c')]===_0x52f3('0x1d');var _0x26c47c=_0x5aaef2[_0x52f3('0x1e')];var _0x74aaf0=_0x360133?0x0:_0x5f0a36['offset'];var _0x21da89=_0x360133?_0x5aaef2['count']:_0x5f0a36[_0x52f3('0x1b')]+_0x5f0a36[_0x52f3('0x1c')];var _0x3bf0ff;if(_0x21da89>=_0x26c47c){_0x21da89=_0x26c47c;_0x3bf0ff=0xc8;}else{_0x3bf0ff=0xce;}_0x275cf8[_0x52f3('0x18')](_0x3bf0ff);return _0x275cf8['set'](_0x52f3('0x1f'),_0x74aaf0+'-'+_0x21da89+'/'+_0x26c47c)[_0x52f3('0x1a')](_0x5aaef2);}return null;};}function patchUpdates(_0x43e4b7){return function(_0x426b54){try{jsonpatch['apply'](_0x426b54,_0x43e4b7,!![]);}catch(_0x4e7005){return BPromise['reject'](_0x4e7005);}return _0x426b54[_0x52f3('0x20')]();};}function saveUpdates(_0x574ee3,_0x695225){return function(_0x2624e8){if(_0x2624e8){return _0x2624e8[_0x52f3('0x21')](_0x574ee3)[_0x52f3('0x22')](function(_0x4365d0){return _0x4365d0;});}return null;};}function removeEntity(_0x52dc8b,_0x4103bc){return function(_0x13673f){if(_0x13673f){return _0x13673f[_0x52f3('0x23')]()[_0x52f3('0x22')](function(){_0x52dc8b[_0x52f3('0x18')](0xcc)[_0x52f3('0x19')]();});}};}function handleEntityNotFound(_0x4ace4b,_0x53629d){return function(_0x29cc8c){if(!_0x29cc8c){_0x4ace4b['sendStatus'](0x194);}return _0x29cc8c;};}function handleError(_0x506903,_0x23603b){_0x23603b=_0x23603b||0x1f4;return function(_0x2e5043){logger[_0x52f3('0x24')](_0x2e5043[_0x52f3('0x25')]);if(_0x2e5043[_0x52f3('0x26')]){delete _0x2e5043[_0x52f3('0x26')];}_0x506903[_0x52f3('0x18')](_0x23603b)[_0x52f3('0x27')](_0x2e5043);};}exports[_0x52f3('0x28')]=function(_0x32ed33,_0x4aeb30){var _0xf0e773={},_0x3c52c6={},_0x28b2bc={'count':0x0,'rows':[]};var _0x2799d2=_['map'](db[_0x52f3('0x29')][_0x52f3('0x2a')],function(_0x5ce7bd){return{'name':_0x5ce7bd[_0x52f3('0x2b')],'type':_0x5ce7bd[_0x52f3('0x2c')]['key']};});_0x3c52c6[_0x52f3('0x2d')]=_[_0x52f3('0x2e')](_0x2799d2,_0x52f3('0x26'));_0x3c52c6[_0x52f3('0x2f')]=_['keys'](_0x32ed33[_0x52f3('0x2f')]);_0x3c52c6[_0x52f3('0x30')]=_[_0x52f3('0x31')](_0x3c52c6['model'],_0x3c52c6['query']);_0xf0e773['attributes']=_['intersection'](_0x3c52c6[_0x52f3('0x2d')],qs[_0x52f3('0x32')](_0x32ed33[_0x52f3('0x2f')][_0x52f3('0x32')]));_0xf0e773['attributes']=_0xf0e773['attributes'][_0x52f3('0x33')]?_0xf0e773[_0x52f3('0x34')]:_0x3c52c6[_0x52f3('0x2d')];if(!_0x32ed33['query'][_0x52f3('0x35')]('nolimit')){_0xf0e773[_0x52f3('0x1c')]=qs['limit'](_0x32ed33[_0x52f3('0x2f')][_0x52f3('0x1c')]);_0xf0e773[_0x52f3('0x1b')]=qs[_0x52f3('0x1b')](_0x32ed33[_0x52f3('0x2f')][_0x52f3('0x1b')]);}_0xf0e773['order']=qs[_0x52f3('0x36')](_0x32ed33['query']['sort']);_0xf0e773[_0x52f3('0x37')]=qs[_0x52f3('0x30')](_[_0x52f3('0x38')](_0x32ed33[_0x52f3('0x2f')],_0x3c52c6[_0x52f3('0x30')]),_0x2799d2);if(_0x32ed33[_0x52f3('0x2f')][_0x52f3('0x39')]){_0xf0e773[_0x52f3('0x37')]=_[_0x52f3('0x3a')](_0xf0e773[_0x52f3('0x37')],{'$or':_['map'](_0x2799d2,function(_0x4172e4){if(_0x4172e4[_0x52f3('0x2c')]!==_0x52f3('0x3b')){var _0x28baec={};_0x28baec[_0x4172e4['name']]={'$like':'%'+_0x32ed33['query'][_0x52f3('0x39')]+'%'};return _0x28baec;}})});}_0xf0e773=_[_0x52f3('0x3a')]({},_0xf0e773,_0x32ed33[_0x52f3('0x3c')]);var _0x26799a={'where':_0xf0e773['where']};return db[_0x52f3('0x29')][_0x52f3('0x1e')](_0x26799a)['then'](function(_0x99712b){_0x28b2bc[_0x52f3('0x1e')]=_0x99712b;if(_0x32ed33[_0x52f3('0x2f')][_0x52f3('0x3d')]){_0xf0e773['include']=[{'all':!![]}];}return db[_0x52f3('0x29')]['findAll'](_0xf0e773);})[_0x52f3('0x22')](function(_0x1bc291){_0x28b2bc[_0x52f3('0x3e')]=_0x1bc291;return _0x28b2bc;})[_0x52f3('0x22')](respondWithFilteredResult(_0x4aeb30,_0xf0e773))[_0x52f3('0x3f')](handleError(_0x4aeb30,null));};exports[_0x52f3('0x40')]=function(_0xdd4028,_0x541c1d){var _0x343ca7={'raw':!![],'where':{'id':_0xdd4028[_0x52f3('0x41')]['id']}},_0x4008cb={};_0x4008cb[_0x52f3('0x2d')]=_[_0x52f3('0x42')](db['Dynamics365Field'][_0x52f3('0x2a')]);_0x4008cb[_0x52f3('0x2f')]=_[_0x52f3('0x42')](_0xdd4028[_0x52f3('0x2f')]);_0x4008cb[_0x52f3('0x30')]=_[_0x52f3('0x31')](_0x4008cb[_0x52f3('0x2d')],_0x4008cb['query']);_0x343ca7[_0x52f3('0x34')]=_['intersection'](_0x4008cb[_0x52f3('0x2d')],qs[_0x52f3('0x32')](_0xdd4028['query']['fields']));_0x343ca7[_0x52f3('0x34')]=_0x343ca7['attributes'][_0x52f3('0x33')]?_0x343ca7[_0x52f3('0x34')]:_0x4008cb['model'];if(_0xdd4028['query'][_0x52f3('0x3d')]){_0x343ca7[_0x52f3('0x43')]=[{'all':!![]}];}_0x343ca7=_[_0x52f3('0x3a')]({},_0x343ca7,_0xdd4028['options']);return db[_0x52f3('0x29')][_0x52f3('0x44')](_0x343ca7)[_0x52f3('0x22')](handleEntityNotFound(_0x541c1d,null))[_0x52f3('0x22')](respondWithResult(_0x541c1d,null))[_0x52f3('0x3f')](handleError(_0x541c1d,null));};exports[_0x52f3('0x45')]=function(_0x54f7a6,_0x558b94){return db[_0x52f3('0x29')][_0x52f3('0x45')](_0x54f7a6[_0x52f3('0x46')],{})[_0x52f3('0x22')](respondWithResult(_0x558b94,0xc9))['catch'](handleError(_0x558b94,null));};exports[_0x52f3('0x21')]=function(_0x5273a8,_0x3a047f){if(_0x5273a8[_0x52f3('0x46')]['id']){delete _0x5273a8[_0x52f3('0x46')]['id'];}return db[_0x52f3('0x29')][_0x52f3('0x44')]({'where':{'id':_0x5273a8[_0x52f3('0x41')]['id']}})[_0x52f3('0x22')](handleEntityNotFound(_0x3a047f,null))['then'](saveUpdates(_0x5273a8['body'],null))[_0x52f3('0x22')](respondWithResult(_0x3a047f,null))[_0x52f3('0x3f')](handleError(_0x3a047f,null));};exports[_0x52f3('0x23')]=function(_0x4db2e2,_0x314003){return db[_0x52f3('0x29')][_0x52f3('0x44')]({'where':{'id':_0x4db2e2[_0x52f3('0x41')]['id']}})[_0x52f3('0x22')](handleEntityNotFound(_0x314003,null))['then'](removeEntity(_0x314003,null))[_0x52f3('0x3f')](handleError(_0x314003,null));}; \ No newline at end of file +var _0xd665=['params','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','index','map','Dynamics365Field','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','show','find','create','body'];(function(_0x56557f,_0xc4df7a){var _0x28ae74=function(_0x140cca){while(--_0x140cca){_0x56557f['push'](_0x56557f['shift']());}};_0x28ae74(++_0xc4df7a);}(_0xd665,0x8b));var _0x5d66=function(_0x40248b,_0x46d07f){_0x40248b=_0x40248b-0x0;var _0x5989b6=_0xd665[_0x40248b];return _0x5989b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d66('0x0'));var zipdir=require(_0x5d66('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d66('0x2'));var moment=require(_0x5d66('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5d66('0x4'));var path=require(_0x5d66('0x5'));var sox=require('sox');var csv=require(_0x5d66('0x6'));var ejs=require(_0x5d66('0x7'));var fs=require('fs');var fs_extra=require(_0x5d66('0x8'));var _=require(_0x5d66('0x9'));var squel=require('squel');var crypto=require(_0x5d66('0xa'));var jsforce=require(_0x5d66('0xb'));var deskjs=require(_0x5d66('0xc'));var toCsv=require(_0x5d66('0x6'));var querystring=require(_0x5d66('0xd'));var Papa=require('papaparse');var Redis=require(_0x5d66('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d66('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d66('0x10'))(_0x5d66('0x11'));var utils=require(_0x5d66('0x12'));var config=require(_0x5d66('0x13'));var licenseUtil=require(_0x5d66('0x14'));var db=require(_0x5d66('0x15'))['db'];function respondWithStatusCode(_0x2645f2,_0x1138f8){_0x1138f8=_0x1138f8||0xcc;return function(_0x5231d7){if(_0x5231d7){return _0x2645f2[_0x5d66('0x16')](_0x1138f8);}return _0x2645f2[_0x5d66('0x17')](_0x1138f8)[_0x5d66('0x18')]();};}function respondWithResult(_0x5617b,_0x335158){_0x335158=_0x335158||0xc8;return function(_0x2aef74){if(_0x2aef74){return _0x5617b[_0x5d66('0x17')](_0x335158)[_0x5d66('0x19')](_0x2aef74);}};}function respondWithFilteredResult(_0x5bd03f,_0x2341cd){return function(_0x5a4462){if(_0x5a4462){var _0x31f840=typeof _0x2341cd[_0x5d66('0x1a')]===_0x5d66('0x1b')&&typeof _0x2341cd[_0x5d66('0x1c')]===_0x5d66('0x1b');var _0x3c8c87=_0x5a4462[_0x5d66('0x1d')];var _0x1681d6=_0x31f840?0x0:_0x2341cd[_0x5d66('0x1a')];var _0x51945e=_0x31f840?_0x5a4462[_0x5d66('0x1d')]:_0x2341cd[_0x5d66('0x1a')]+_0x2341cd[_0x5d66('0x1c')];var _0x3ea857;if(_0x51945e>=_0x3c8c87){_0x51945e=_0x3c8c87;_0x3ea857=0xc8;}else{_0x3ea857=0xce;}_0x5bd03f[_0x5d66('0x17')](_0x3ea857);return _0x5bd03f[_0x5d66('0x1e')]('Content-Range',_0x1681d6+'-'+_0x51945e+'/'+_0x3c8c87)[_0x5d66('0x19')](_0x5a4462);}return null;};}function patchUpdates(_0x397118){return function(_0x156571){try{jsonpatch['apply'](_0x156571,_0x397118,!![]);}catch(_0x583d16){return BPromise[_0x5d66('0x1f')](_0x583d16);}return _0x156571[_0x5d66('0x20')]();};}function saveUpdates(_0x12d708,_0xf405e4){return function(_0x3c9141){if(_0x3c9141){return _0x3c9141[_0x5d66('0x21')](_0x12d708)[_0x5d66('0x22')](function(_0x214f6c){return _0x214f6c;});}return null;};}function removeEntity(_0x16b57b,_0x4129d2){return function(_0xd0ff90){if(_0xd0ff90){return _0xd0ff90[_0x5d66('0x23')]()[_0x5d66('0x22')](function(){_0x16b57b['status'](0xcc)[_0x5d66('0x18')]();});}};}function handleEntityNotFound(_0x348b58,_0x5c9704){return function(_0x1e3bd0){if(!_0x1e3bd0){_0x348b58['sendStatus'](0x194);}return _0x1e3bd0;};}function handleError(_0x243805,_0x15fa98){_0x15fa98=_0x15fa98||0x1f4;return function(_0x4021d1){logger[_0x5d66('0x24')](_0x4021d1['stack']);if(_0x4021d1['name']){delete _0x4021d1[_0x5d66('0x25')];}_0x243805[_0x5d66('0x17')](_0x15fa98)['send'](_0x4021d1);};}exports[_0x5d66('0x26')]=function(_0x30e2ab,_0x2d4967){var _0xd15a4a={},_0x3f5de5={},_0x46a74c={'count':0x0,'rows':[]};var _0x4988cc=_[_0x5d66('0x27')](db[_0x5d66('0x28')][_0x5d66('0x29')],function(_0x182e35){return{'name':_0x182e35[_0x5d66('0x2a')],'type':_0x182e35['type']['key']};});_0x3f5de5[_0x5d66('0x2b')]=_[_0x5d66('0x27')](_0x4988cc,_0x5d66('0x25'));_0x3f5de5['query']=_[_0x5d66('0x2c')](_0x30e2ab[_0x5d66('0x2d')]);_0x3f5de5[_0x5d66('0x2e')]=_[_0x5d66('0x2f')](_0x3f5de5[_0x5d66('0x2b')],_0x3f5de5[_0x5d66('0x2d')]);_0xd15a4a['attributes']=_[_0x5d66('0x2f')](_0x3f5de5[_0x5d66('0x2b')],qs[_0x5d66('0x30')](_0x30e2ab[_0x5d66('0x2d')][_0x5d66('0x30')]));_0xd15a4a[_0x5d66('0x31')]=_0xd15a4a[_0x5d66('0x31')][_0x5d66('0x32')]?_0xd15a4a[_0x5d66('0x31')]:_0x3f5de5[_0x5d66('0x2b')];if(!_0x30e2ab[_0x5d66('0x2d')][_0x5d66('0x33')](_0x5d66('0x34'))){_0xd15a4a[_0x5d66('0x1c')]=qs[_0x5d66('0x1c')](_0x30e2ab[_0x5d66('0x2d')]['limit']);_0xd15a4a[_0x5d66('0x1a')]=qs[_0x5d66('0x1a')](_0x30e2ab['query'][_0x5d66('0x1a')]);}_0xd15a4a[_0x5d66('0x35')]=qs['sort'](_0x30e2ab[_0x5d66('0x2d')][_0x5d66('0x36')]);_0xd15a4a['where']=qs[_0x5d66('0x2e')](_[_0x5d66('0x37')](_0x30e2ab['query'],_0x3f5de5[_0x5d66('0x2e')]),_0x4988cc);if(_0x30e2ab[_0x5d66('0x2d')][_0x5d66('0x38')]){_0xd15a4a[_0x5d66('0x39')]=_[_0x5d66('0x3a')](_0xd15a4a[_0x5d66('0x39')],{'$or':_['map'](_0x4988cc,function(_0xfd4060){if(_0xfd4060[_0x5d66('0x3b')]!=='VIRTUAL'){var _0x1da52e={};_0x1da52e[_0xfd4060[_0x5d66('0x25')]]={'$like':'%'+_0x30e2ab[_0x5d66('0x2d')][_0x5d66('0x38')]+'%'};return _0x1da52e;}})});}_0xd15a4a=_[_0x5d66('0x3a')]({},_0xd15a4a,_0x30e2ab[_0x5d66('0x3c')]);var _0x44ff4d={'where':_0xd15a4a[_0x5d66('0x39')]};return db[_0x5d66('0x28')][_0x5d66('0x1d')](_0x44ff4d)[_0x5d66('0x22')](function(_0x521a39){_0x46a74c[_0x5d66('0x1d')]=_0x521a39;if(_0x30e2ab[_0x5d66('0x2d')][_0x5d66('0x3d')]){_0xd15a4a['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0xd15a4a);})[_0x5d66('0x22')](function(_0x3ce252){_0x46a74c[_0x5d66('0x3e')]=_0x3ce252;return _0x46a74c;})['then'](respondWithFilteredResult(_0x2d4967,_0xd15a4a))[_0x5d66('0x3f')](handleError(_0x2d4967,null));};exports[_0x5d66('0x40')]=function(_0x154773,_0x2a20a2){var _0x28439b={'raw':!![],'where':{'id':_0x154773['params']['id']}},_0x3fc729={};_0x3fc729[_0x5d66('0x2b')]=_[_0x5d66('0x2c')](db[_0x5d66('0x28')][_0x5d66('0x29')]);_0x3fc729['query']=_[_0x5d66('0x2c')](_0x154773[_0x5d66('0x2d')]);_0x3fc729['filters']=_[_0x5d66('0x2f')](_0x3fc729['model'],_0x3fc729['query']);_0x28439b[_0x5d66('0x31')]=_[_0x5d66('0x2f')](_0x3fc729['model'],qs['fields'](_0x154773[_0x5d66('0x2d')][_0x5d66('0x30')]));_0x28439b['attributes']=_0x28439b[_0x5d66('0x31')][_0x5d66('0x32')]?_0x28439b[_0x5d66('0x31')]:_0x3fc729[_0x5d66('0x2b')];if(_0x154773[_0x5d66('0x2d')][_0x5d66('0x3d')]){_0x28439b['include']=[{'all':!![]}];}_0x28439b=_[_0x5d66('0x3a')]({},_0x28439b,_0x154773['options']);return db[_0x5d66('0x28')][_0x5d66('0x41')](_0x28439b)['then'](handleEntityNotFound(_0x2a20a2,null))[_0x5d66('0x22')](respondWithResult(_0x2a20a2,null))[_0x5d66('0x3f')](handleError(_0x2a20a2,null));};exports[_0x5d66('0x42')]=function(_0x56b4de,_0x2a18ed){return db[_0x5d66('0x28')][_0x5d66('0x42')](_0x56b4de[_0x5d66('0x43')],{})['then'](respondWithResult(_0x2a18ed,0xc9))[_0x5d66('0x3f')](handleError(_0x2a18ed,null));};exports[_0x5d66('0x21')]=function(_0x189b4c,_0x95b713){if(_0x189b4c['body']['id']){delete _0x189b4c[_0x5d66('0x43')]['id'];}return db[_0x5d66('0x28')]['find']({'where':{'id':_0x189b4c[_0x5d66('0x44')]['id']}})['then'](handleEntityNotFound(_0x95b713,null))[_0x5d66('0x22')](saveUpdates(_0x189b4c[_0x5d66('0x43')],null))['then'](respondWithResult(_0x95b713,null))[_0x5d66('0x3f')](handleError(_0x95b713,null));};exports[_0x5d66('0x23')]=function(_0x1a6101,_0x1debc8){return db[_0x5d66('0x28')][_0x5d66('0x41')]({'where':{'id':_0x1a6101[_0x5d66('0x44')]['id']}})[_0x5d66('0x22')](handleEntityNotFound(_0x1debc8,null))['then'](removeEntity(_0x1debc8,null))[_0x5d66('0x3f')](handleError(_0x1debc8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 24b5172..9f2c703 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 _0x35a0=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x4c1881,_0x323217){var _0x4e9528=function(_0x316527){while(--_0x316527){_0x4c1881['push'](_0x4c1881['shift']());}};_0x4e9528(++_0x323217);}(_0x35a0,0x1b9));var _0x035a=function(_0x5efaca,_0x39d68a){_0x5efaca=_0x5efaca-0x0;var _0x4ccdeb=_0x35a0[_0x5efaca];return _0x4ccdeb;};'use strict';var _=require(_0x035a('0x0'));var util=require(_0x035a('0x1'));var logger=require(_0x035a('0x2'))('api');var moment=require(_0x035a('0x3'));var BPromise=require('bluebird');var rp=require(_0x035a('0x4'));var fs=require('fs');var path=require(_0x035a('0x5'));var rimraf=require(_0x035a('0x6'));var config=require(_0x035a('0x7'));var attributes=require(_0x035a('0x8'));module['exports']=function(_0x408235,_0x422ac5){return _0x408235[_0x035a('0x9')](_0x035a('0xa'),attributes,{'tableName':_0x035a('0xb'),'paranoid':![],'indexes':[{'name':_0x035a('0xc'),'fields':[_0x035a('0xd'),_0x035a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3092=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x3092,0x144));var _0x2309=function(_0x263b0e,_0xc6479f){_0x263b0e=_0x263b0e-0x0;var _0x113fee=_0x3092[_0x263b0e];return _0x113fee;};'use strict';var _=require(_0x2309('0x0'));var util=require(_0x2309('0x1'));var logger=require(_0x2309('0x2'))(_0x2309('0x3'));var moment=require(_0x2309('0x4'));var BPromise=require(_0x2309('0x5'));var rp=require(_0x2309('0x6'));var fs=require('fs');var path=require(_0x2309('0x7'));var rimraf=require(_0x2309('0x8'));var config=require(_0x2309('0x9'));var attributes=require(_0x2309('0xa'));module[_0x2309('0xb')]=function(_0x4799f0,_0x910dcb){return _0x4799f0['define'](_0x2309('0xc'),attributes,{'tableName':_0x2309('0xd'),'paranoid':![],'indexes':[{'name':_0x2309('0xe'),'fields':[_0x2309('0xf'),_0x2309('0x10')],'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 8cd35ce..dbddcd4 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 _0xaf18=['result','message','catch','Dynamics365Field,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x4fe9b8,_0x1322ca){var _0x2a3e99=function(_0x3d03a3){while(--_0x3d03a3){_0x4fe9b8['push'](_0x4fe9b8['shift']());}};_0x2a3e99(++_0x1322ca);}(_0xaf18,0x88));var _0x8af1=function(_0x51dc89,_0x3a05d6){_0x51dc89=_0x51dc89-0x0;var _0x3a7c3a=_0xaf18[_0x51dc89];return _0x3a7c3a;};'use strict';var _=require(_0x8af1('0x0'));var util=require(_0x8af1('0x1'));var moment=require(_0x8af1('0x2'));var BPromise=require(_0x8af1('0x3'));var rs=require(_0x8af1('0x4'));var fs=require('fs');var Redis=require(_0x8af1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8af1('0x6'));var logger=require(_0x8af1('0x7'))(_0x8af1('0x8'));var config=require('../../config/environment');var jayson=require(_0x8af1('0x9'));var client=jayson[_0x8af1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x282766,_0x13857e,_0x38a8ed){return new BPromise(function(_0x311044,_0x7b3eea){return client[_0x8af1('0xb')](_0x282766,_0x38a8ed)[_0x8af1('0xc')](function(_0x3ef578){logger[_0x8af1('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x13857e,_0x8af1('0xe'));logger[_0x8af1('0xf')](_0x8af1('0x10'),_0x13857e,_0x8af1('0xe'),JSON['stringify'](_0x3ef578));if(_0x3ef578[_0x8af1('0x11')]){if(_0x3ef578[_0x8af1('0x11')]['code']===0x1f4){logger[_0x8af1('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x13857e,_0x3ef578['error']['message']);return _0x7b3eea(_0x3ef578[_0x8af1('0x11')]['message']);}logger[_0x8af1('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x13857e,_0x3ef578[_0x8af1('0x11')]['message']);return _0x311044(_0x3ef578[_0x8af1('0x11')]['message']);}else{logger[_0x8af1('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x13857e,_0x8af1('0xe'));_0x311044(_0x3ef578[_0x8af1('0x12')][_0x8af1('0x13')]);}})[_0x8af1('0x14')](function(_0x1003ea){logger[_0x8af1('0x11')](_0x8af1('0x15'),_0x13857e,_0x1003ea);_0x7b3eea(_0x1003ea);});});} \ No newline at end of file +var _0x06d9=['jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2fa2b5,_0x458e15){var _0x6202f5=function(_0xa59b38){while(--_0xa59b38){_0x2fa2b5['push'](_0x2fa2b5['shift']());}};_0x6202f5(++_0x458e15);}(_0x06d9,0x93));var _0x906d=function(_0x2c5703,_0x1f1cd9){_0x2c5703=_0x2c5703-0x0;var _0xef1d09=_0x06d9[_0x2c5703];return _0xef1d09;};'use strict';var _=require(_0x906d('0x0'));var util=require('util');var moment=require(_0x906d('0x1'));var BPromise=require('bluebird');var rs=require(_0x906d('0x2'));var fs=require('fs');var Redis=require(_0x906d('0x3'));var db=require(_0x906d('0x4'))['db'];var utils=require(_0x906d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x906d('0x6'));var jayson=require(_0x906d('0x7'));var client=jayson[_0x906d('0x8')][_0x906d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1216c5,_0x56ff7c,_0x11ef5b){return new BPromise(function(_0x32fded,_0x57be83){return client[_0x906d('0xa')](_0x1216c5,_0x11ef5b)[_0x906d('0xb')](function(_0x54f171){logger[_0x906d('0xc')](_0x906d('0xd'),_0x56ff7c,_0x906d('0xe'));logger[_0x906d('0xf')](_0x906d('0x10'),_0x56ff7c,_0x906d('0xe'),JSON[_0x906d('0x11')](_0x54f171));if(_0x54f171['error']){if(_0x54f171[_0x906d('0x12')]['code']===0x1f4){logger[_0x906d('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x56ff7c,_0x54f171[_0x906d('0x12')][_0x906d('0x13')]);return _0x57be83(_0x54f171[_0x906d('0x12')][_0x906d('0x13')]);}logger[_0x906d('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x56ff7c,_0x54f171[_0x906d('0x12')]['message']);return _0x32fded(_0x54f171['error'][_0x906d('0x13')]);}else{logger[_0x906d('0xc')](_0x906d('0xd'),_0x56ff7c,_0x906d('0xe'));_0x32fded(_0x54f171[_0x906d('0x14')][_0x906d('0x13')]);}})[_0x906d('0x15')](function(_0x3a13c8){logger[_0x906d('0x12')](_0x906d('0xd'),_0x56ff7c,_0x3a13c8);_0x57be83(_0x3a13c8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b60e2d4..e6a8182 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 _0x4b52=['get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x55eec1,_0x27e7fc){var _0x550115=function(_0x2154e9){while(--_0x2154e9){_0x55eec1['push'](_0x55eec1['shift']());}};_0x550115(++_0x27e7fc);}(_0x4b52,0x8b));var _0x24b5=function(_0x376af3,_0x116e68){_0x376af3=_0x376af3-0x0;var _0x4752c8=_0x4b52[_0x376af3];return _0x4752c8;};'use strict';var multer=require('multer');var util=require(_0x24b5('0x0'));var path=require(_0x24b5('0x1'));var timeout=require(_0x24b5('0x2'));var express=require(_0x24b5('0x3'));var router=express[_0x24b5('0x4')]();var fs_extra=require(_0x24b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x24b5('0x6'));var config=require(_0x24b5('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x24b5('0x8')]('/',auth[_0x24b5('0x9')](),controller['index']);router['get'](_0x24b5('0xa'),auth[_0x24b5('0x9')](),controller[_0x24b5('0xb')]);router[_0x24b5('0x8')](_0x24b5('0xc'),auth[_0x24b5('0x9')](),controller['getConfigurations']);router[_0x24b5('0x8')](_0x24b5('0xd'),auth[_0x24b5('0x9')](),controller['getFields']);router[_0x24b5('0xe')]('/',auth['isAuthenticated'](),controller[_0x24b5('0xf')]);router[_0x24b5('0xe')](_0x24b5('0xc'),auth['isAuthenticated'](),controller[_0x24b5('0x10')]);router[_0x24b5('0x11')](_0x24b5('0xa'),auth[_0x24b5('0x9')](),controller[_0x24b5('0x12')]);router[_0x24b5('0x13')](_0x24b5('0xa'),auth['isAuthenticated'](),controller[_0x24b5('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa00c=['util','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','exports'];(function(_0x165b87,_0x3f4ce1){var _0x2b5d24=function(_0x50bf3e){while(--_0x50bf3e){_0x165b87['push'](_0x165b87['shift']());}};_0x2b5d24(++_0x3f4ce1);}(_0xa00c,0x7e));var _0xca00=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa00c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xca00('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca00('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xca00('0x2'));var config=require(_0xca00('0x3'));var controller=require('./intFreshdeskAccount.controller');router[_0xca00('0x4')]('/',auth[_0xca00('0x5')](),controller[_0xca00('0x6')]);router['get']('/:id',auth[_0xca00('0x5')](),controller['show']);router[_0xca00('0x4')](_0xca00('0x7'),auth[_0xca00('0x5')](),controller[_0xca00('0x8')]);router['get'](_0xca00('0x9'),auth[_0xca00('0x5')](),controller[_0xca00('0xa')]);router[_0xca00('0xb')]('/',auth[_0xca00('0x5')](),controller[_0xca00('0xc')]);router[_0xca00('0xb')](_0xca00('0x7'),auth[_0xca00('0x5')](),controller['addConfiguration']);router[_0xca00('0xd')](_0xca00('0xe'),auth['isAuthenticated'](),controller[_0xca00('0xf')]);router['delete'](_0xca00('0xe'),auth[_0xca00('0x5')](),controller[_0xca00('0x10')]);module[_0xca00('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2770234..110e595 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 _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x382799,_0x2cf85b){var _0x5737ec=function(_0xa8efdc){while(--_0xa8efdc){_0x382799['push'](_0x382799['shift']());}};_0x5737ec(++_0x2cf85b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x2b9cec,_0x17cf22){_0x2b9cec=_0x2b9cec-0x0;var _0x9759e6=_0xb03e[_0x2b9cec];return _0x9759e6;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x1236ef,_0x4cbada){var _0x41ffbb=function(_0x92a494){while(--_0x92a494){_0x1236ef['push'](_0x1236ef['shift']());}};_0x41ffbb(++_0x4cbada);}(_0x02ce,0x1ac));var _0xe02c=function(_0x234d10,_0x29ee98){_0x234d10=_0x234d10-0x0;var _0x17a4cf=_0x02ce[_0x234d10];return _0x17a4cf;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f46bb65..6256c92 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 _0xd4bd=['custom_dropdown','label','choices','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','options','catch','create','update','body','find','getConfigurations','nolimit','addConfiguration','findOne','AccountId','channel','FreshdeskConfiguration','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','includes','default'];(function(_0x597b14,_0x4eadc8){var _0x32dd31=function(_0x388ba3){while(--_0x388ba3){_0x597b14['push'](_0x597b14['shift']());}};_0x32dd31(++_0x4eadc8);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x524b2a,_0x13e281){_0x524b2a=_0x524b2a-0x0;var _0x176cc5=_0xd4bd[_0x524b2a];return _0x176cc5;};'use strict';var emlformat=require(_0xdd4b('0x0'));var rimraf=require(_0xdd4b('0x1'));var zipdir=require(_0xdd4b('0x2'));var jsonpatch=require(_0xdd4b('0x3'));var rp=require(_0xdd4b('0x4'));var moment=require('moment');var BPromise=require(_0xdd4b('0x5'));var Mustache=require(_0xdd4b('0x6'));var util=require(_0xdd4b('0x7'));var path=require(_0xdd4b('0x8'));var sox=require(_0xdd4b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd4b('0xa'));var _=require('lodash');var squel=require(_0xdd4b('0xb'));var crypto=require(_0xdd4b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd4b('0xd'));var querystring=require(_0xdd4b('0xe'));var Papa=require('papaparse');var Redis=require(_0xdd4b('0xf'));var authService=require(_0xdd4b('0x10'));var qs=require(_0xdd4b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd4b('0x12'));var logger=require(_0xdd4b('0x13'))(_0xdd4b('0x14'));var utils=require(_0xdd4b('0x15'));var config=require(_0xdd4b('0x16'));var licenseUtil=require(_0xdd4b('0x17'));var db=require(_0xdd4b('0x18'))['db'];var integrations=require(_0xdd4b('0x19'));function respondWithStatusCode(_0x594339,_0x2a88ab){_0x2a88ab=_0x2a88ab||0xcc;return function(_0x5119cb){if(_0x5119cb){return _0x594339[_0xdd4b('0x1a')](_0x2a88ab);}return _0x594339[_0xdd4b('0x1b')](_0x2a88ab)[_0xdd4b('0x1c')]();};}function respondWithResult(_0x5dc694,_0x327f9e){_0x327f9e=_0x327f9e||0xc8;return function(_0x293397){if(_0x293397){return _0x5dc694['status'](_0x327f9e)['json'](_0x293397);}};}function respondWithFilteredResult(_0x3a7f2a,_0x368842){return function(_0x39f053){if(_0x39f053){var _0x38c850=typeof _0x368842[_0xdd4b('0x1d')]===_0xdd4b('0x1e')&&typeof _0x368842[_0xdd4b('0x1f')]==='undefined';var _0xcc5385=_0x39f053[_0xdd4b('0x20')];var _0xec67fb=_0x38c850?0x0:_0x368842['offset'];var _0x3c7e37=_0x38c850?_0x39f053['count']:_0x368842['offset']+_0x368842[_0xdd4b('0x1f')];var _0x476540;if(_0x3c7e37>=_0xcc5385){_0x3c7e37=_0xcc5385;_0x476540=0xc8;}else{_0x476540=0xce;}_0x3a7f2a['status'](_0x476540);return _0x3a7f2a[_0xdd4b('0x21')](_0xdd4b('0x22'),_0xec67fb+'-'+_0x3c7e37+'/'+_0xcc5385)[_0xdd4b('0x23')](_0x39f053);}return null;};}function patchUpdates(_0x1fbbe7){return function(_0x14a011){try{jsonpatch[_0xdd4b('0x24')](_0x14a011,_0x1fbbe7,!![]);}catch(_0x22af7f){return BPromise['reject'](_0x22af7f);}return _0x14a011['save']();};}function saveUpdates(_0x2325fe,_0x26c32b){return function(_0x3ec51e){if(_0x3ec51e){return _0x3ec51e['update'](_0x2325fe)[_0xdd4b('0x25')](function(_0x1ba012){return _0x1ba012;});}return null;};}function removeEntity(_0x1b55b5,_0x333a3f){return function(_0x10e7ee){if(_0x10e7ee){return _0x10e7ee[_0xdd4b('0x26')]()['then'](function(){_0x1b55b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6bfcb,_0x304f46){return function(_0x559007){if(!_0x559007){_0xd6bfcb['sendStatus'](0x194);}return _0x559007;};}function handleError(_0x2d4f73,_0x24fa06){_0x24fa06=_0x24fa06||0x1f4;return function(_0x2512bd){logger[_0xdd4b('0x27')](_0x2512bd[_0xdd4b('0x28')]);if(_0x2512bd['name']){delete _0x2512bd[_0xdd4b('0x29')];}_0x2d4f73[_0xdd4b('0x1b')](_0x24fa06)[_0xdd4b('0x2a')](_0x2512bd);};}exports[_0xdd4b('0x2b')]=function(_0x32489f,_0x14a40f){var _0x4de481={},_0x420597={},_0x3c841a={'count':0x0,'rows':[]};var _0x5da4c=_[_0xdd4b('0x2c')](db[_0xdd4b('0x2d')][_0xdd4b('0x2e')],function(_0x448f34){return{'name':_0x448f34[_0xdd4b('0x2f')],'type':_0x448f34[_0xdd4b('0x30')][_0xdd4b('0x31')]};});_0x420597[_0xdd4b('0x32')]=_[_0xdd4b('0x2c')](_0x5da4c,_0xdd4b('0x29'));_0x420597[_0xdd4b('0x33')]=_[_0xdd4b('0x34')](_0x32489f[_0xdd4b('0x33')]);_0x420597['filters']=_['intersection'](_0x420597[_0xdd4b('0x32')],_0x420597[_0xdd4b('0x33')]);_0x4de481[_0xdd4b('0x35')]=_['intersection'](_0x420597[_0xdd4b('0x32')],qs[_0xdd4b('0x36')](_0x32489f['query']['fields']));_0x4de481[_0xdd4b('0x35')]=_0x4de481['attributes'][_0xdd4b('0x37')]?_0x4de481['attributes']:_0x420597['model'];if(!_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x38')]('nolimit')){_0x4de481[_0xdd4b('0x1f')]=qs[_0xdd4b('0x1f')](_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x1f')]);_0x4de481[_0xdd4b('0x1d')]=qs[_0xdd4b('0x1d')](_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x1d')]);}_0x4de481[_0xdd4b('0x39')]=qs[_0xdd4b('0x3a')](_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x3a')]);_0x4de481[_0xdd4b('0x3b')]=qs[_0xdd4b('0x3c')](_[_0xdd4b('0x3d')](_0x32489f['query'],_0x420597[_0xdd4b('0x3c')]),_0x5da4c);if(_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x3e')]){_0x4de481[_0xdd4b('0x3b')]=_[_0xdd4b('0x3f')](_0x4de481[_0xdd4b('0x3b')],{'$or':_[_0xdd4b('0x2c')](_0x5da4c,function(_0x3626ee){if(_0x3626ee[_0xdd4b('0x30')]!==_0xdd4b('0x40')){var _0x3c17f4={};_0x3c17f4[_0x3626ee['name']]={'$like':'%'+_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x3e')]+'%'};return _0x3c17f4;}})});}_0x4de481=_[_0xdd4b('0x3f')]({},_0x4de481,_0x32489f['options']);var _0x3c7cf5={'where':_0x4de481[_0xdd4b('0x3b')]};return db[_0xdd4b('0x2d')][_0xdd4b('0x20')](_0x3c7cf5)[_0xdd4b('0x25')](function(_0x234948){_0x3c841a['count']=_0x234948;if(_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x41')]){_0x4de481[_0xdd4b('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xdd4b('0x43')](_0x4de481);})[_0xdd4b('0x25')](function(_0x9b8c73){_0x3c841a[_0xdd4b('0x44')]=_0x9b8c73;return _0x3c841a;})[_0xdd4b('0x25')](respondWithFilteredResult(_0x14a40f,_0x4de481))['catch'](handleError(_0x14a40f,null));};exports[_0xdd4b('0x45')]=function(_0x44bf64,_0x53d98a){var _0x333bed={'raw':![],'where':{'id':_0x44bf64[_0xdd4b('0x46')]['id']}},_0x4f5baa={};_0x4f5baa['model']=_['keys'](db[_0xdd4b('0x2d')][_0xdd4b('0x2e')]);_0x4f5baa[_0xdd4b('0x33')]=_[_0xdd4b('0x34')](_0x44bf64['query']);_0x4f5baa[_0xdd4b('0x3c')]=_[_0xdd4b('0x47')](_0x4f5baa[_0xdd4b('0x32')],_0x4f5baa[_0xdd4b('0x33')]);_0x333bed[_0xdd4b('0x35')]=_[_0xdd4b('0x47')](_0x4f5baa[_0xdd4b('0x32')],qs['fields'](_0x44bf64['query'][_0xdd4b('0x36')]));_0x333bed['attributes']=_0x333bed[_0xdd4b('0x35')][_0xdd4b('0x37')]?_0x333bed[_0xdd4b('0x35')]:_0x4f5baa[_0xdd4b('0x32')];if(_0x44bf64[_0xdd4b('0x33')]['includeAll']){_0x333bed[_0xdd4b('0x42')]=[{'all':!![]}];}_0x333bed=_[_0xdd4b('0x3f')]({},_0x333bed,_0x44bf64[_0xdd4b('0x48')]);return db[_0xdd4b('0x2d')]['find'](_0x333bed)[_0xdd4b('0x25')](handleEntityNotFound(_0x53d98a,null))[_0xdd4b('0x25')](respondWithResult(_0x53d98a,null))[_0xdd4b('0x49')](handleError(_0x53d98a,null));};exports['create']=function(_0x401152,_0x3655e9){return db['FreshdeskAccount'][_0xdd4b('0x4a')](_0x401152['body'],{})[_0xdd4b('0x25')](respondWithResult(_0x3655e9,0xc9))[_0xdd4b('0x49')](handleError(_0x3655e9,null));};exports[_0xdd4b('0x4b')]=function(_0x3121ee,_0x3233ab){if(_0x3121ee[_0xdd4b('0x4c')]['id']){delete _0x3121ee[_0xdd4b('0x4c')]['id'];}return db[_0xdd4b('0x2d')][_0xdd4b('0x4d')]({'where':{'id':_0x3121ee['params']['id']}})[_0xdd4b('0x25')](handleEntityNotFound(_0x3233ab,null))[_0xdd4b('0x25')](saveUpdates(_0x3121ee[_0xdd4b('0x4c')],null))['then'](respondWithResult(_0x3233ab,null))[_0xdd4b('0x49')](handleError(_0x3233ab,null));};exports[_0xdd4b('0x26')]=function(_0x539f05,_0xcbbf7f){return db[_0xdd4b('0x2d')][_0xdd4b('0x4d')]({'where':{'id':_0x539f05[_0xdd4b('0x46')]['id']}})[_0xdd4b('0x25')](handleEntityNotFound(_0xcbbf7f,null))[_0xdd4b('0x25')](removeEntity(_0xcbbf7f,null))[_0xdd4b('0x49')](handleError(_0xcbbf7f,null));};exports[_0xdd4b('0x4e')]=function(_0xda3cc4,_0xe79da3,_0x488722){var _0x3d79d5={};var _0x5ec06b={};var _0x1b0321;var _0x14b7e7;return db[_0xdd4b('0x2d')]['findOne']({'where':{'id':_0xda3cc4['params']['id']}})['then'](handleEntityNotFound(_0xe79da3,null))[_0xdd4b('0x25')](function(_0x23e373){if(_0x23e373){_0x1b0321=_0x23e373;_0x5ec06b[_0xdd4b('0x32')]=_[_0xdd4b('0x34')](db['FreshdeskConfiguration'][_0xdd4b('0x2e')]);_0x5ec06b[_0xdd4b('0x33')]=_[_0xdd4b('0x34')](_0xda3cc4[_0xdd4b('0x33')]);_0x5ec06b['filters']=_[_0xdd4b('0x47')](_0x5ec06b[_0xdd4b('0x32')],_0x5ec06b[_0xdd4b('0x33')]);_0x3d79d5[_0xdd4b('0x35')]=_[_0xdd4b('0x47')](_0x5ec06b[_0xdd4b('0x32')],qs[_0xdd4b('0x36')](_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x36')]));_0x3d79d5[_0xdd4b('0x35')]=_0x3d79d5[_0xdd4b('0x35')][_0xdd4b('0x37')]?_0x3d79d5['attributes']:_0x5ec06b[_0xdd4b('0x32')];_0x3d79d5[_0xdd4b('0x39')]=qs[_0xdd4b('0x3a')](_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x3a')]);_0x3d79d5[_0xdd4b('0x3b')]=qs['filters'](_['pick'](_0xda3cc4[_0xdd4b('0x33')],_0x5ec06b[_0xdd4b('0x3c')]));if(_0xda3cc4[_0xdd4b('0x33')]['filter']){_0x3d79d5[_0xdd4b('0x3b')]=_[_0xdd4b('0x3f')](_0x3d79d5['where'],{'$or':_[_0xdd4b('0x2c')](_0x3d79d5[_0xdd4b('0x35')],function(_0x55b214){var _0x50e6f4={};_0x50e6f4[_0x55b214]={'$like':'%'+_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x3e')]+'%'};return _0x50e6f4;})});}_0x3d79d5=_[_0xdd4b('0x3f')]({},_0x3d79d5,_0xda3cc4[_0xdd4b('0x48')]);return _0x1b0321[_0xdd4b('0x4e')](_0x3d79d5);}})['then'](function(_0x53ad78){if(_0x53ad78){_0x14b7e7=_0x53ad78[_0xdd4b('0x37')];if(!_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x38')](_0xdd4b('0x4f'))){_0x3d79d5[_0xdd4b('0x1f')]=qs[_0xdd4b('0x1f')](_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x1f')]);_0x3d79d5[_0xdd4b('0x1d')]=qs[_0xdd4b('0x1d')](_0xda3cc4[_0xdd4b('0x33')]['offset']);}return _0x1b0321[_0xdd4b('0x4e')](_0x3d79d5);}})[_0xdd4b('0x25')](function(_0x11d189){if(_0x11d189){return _0x11d189?{'count':_0x14b7e7,'rows':_0x11d189}:null;}})[_0xdd4b('0x25')](respondWithResult(_0xe79da3,null))[_0xdd4b('0x49')](handleError(_0xe79da3,null));};exports[_0xdd4b('0x50')]=function(_0x3cb994,_0x414974,_0x5435d4){if(_0x3cb994[_0xdd4b('0x4c')]['id']){delete _0x3cb994['body']['id'];}return db[_0xdd4b('0x2d')][_0xdd4b('0x51')]({'where':{'id':_0x3cb994[_0xdd4b('0x46')]['id']}})['then'](handleEntityNotFound(_0x414974,null))[_0xdd4b('0x25')](function(_0x181c82){if(_0x181c82){_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x52')]=_0x181c82['id'];_0x3cb994[_0xdd4b('0x4c')]['Subjects']=integrations['getSubjects'](_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x53')],_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x30')]);_0x3cb994[_0xdd4b('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x53')],_0x3cb994['body'][_0xdd4b('0x30')]);return db[_0xdd4b('0x54')][_0xdd4b('0x4a')](_0x3cb994[_0xdd4b('0x4c')],{'include':[{'model':db[_0xdd4b('0x55')],'as':_0xdd4b('0x56')},{'model':db[_0xdd4b('0x55')],'as':_0xdd4b('0x57')}]});}return null;})[_0xdd4b('0x25')](respondWithResult(_0x414974,null))[_0xdd4b('0x49')](handleError(_0x414974,null));};exports[_0xdd4b('0x58')]=function(_0x42afdd,_0x1cf885,_0x50eebf){var _0x51f666='';return db[_0xdd4b('0x2d')][_0xdd4b('0x51')]({'where':{'id':_0x42afdd[_0xdd4b('0x46')]['id']},'attributes':['id',_0xdd4b('0x59'),_0xdd4b('0x5a')]})['then'](handleEntityNotFound(_0x1cf885,null))[_0xdd4b('0x25')](function(_0x4e3c67){if(_0x4e3c67){_0x51f666=_0x4e3c67[_0xdd4b('0x59')];var _0x3e9afe=_0x51f666[_0xdd4b('0x5b')](-0x1);if(_0x3e9afe==='/'){_0x51f666=_0x51f666[_0xdd4b('0x5c')](0x0,_0x51f666[_0xdd4b('0x5d')](_0x3e9afe));}return rp({'method':'GET','uri':util[_0xdd4b('0x5e')]('%s/%s',_0x51f666,_0xdd4b('0x5f')),'headers':{'Authorization':util['format'](_0xdd4b('0x60'),new Buffer(util[_0xdd4b('0x5e')](_0xdd4b('0x61'),_0x4e3c67['apiKey']))[_0xdd4b('0x62')](_0xdd4b('0x63')))},'json':!![]});}})[_0xdd4b('0x25')](function(_0x3bc6ab){if(_0x3bc6ab){var _0x422fcd=[_0xdd4b('0x64'),_0xdd4b('0x65'),_0xdd4b('0x66'),'description',_0xdd4b('0x1b'),_0xdd4b('0x67'),_0xdd4b('0x68'),_0xdd4b('0x69'),_0xdd4b('0x6a'),_0xdd4b('0x68'),'company'];_['remove'](_0x3bc6ab,function(_0x5b6938){return _0x422fcd[_0xdd4b('0x6b')](_0x5b6938[_0xdd4b('0x29')])||!_0x5b6938[_0xdd4b('0x6c')]&&_0x5b6938[_0xdd4b('0x30')]!=='custom_text'&&_0x5b6938[_0xdd4b('0x30')]!==_0xdd4b('0x6d');});return{'count':_0x3bc6ab['length'],'rows':_[_0xdd4b('0x2c')](_0x3bc6ab,function(_0x4b3eda){return{'id':_0x4b3eda['name'],'name':_0x4b3eda[_0xdd4b('0x6e')],'custom':!_0x4b3eda[_0xdd4b('0x6c')],'options':_0x4b3eda[_0xdd4b('0x6f')]?_['map'](_0x4b3eda[_0xdd4b('0x6f')],function(_0x16b714){return{'name':_['capitalize'](_0x16b714),'value':_0x16b714};}):[]};})};}})[_0xdd4b('0x25')](respondWithResult(_0x1cf885,null))[_0xdd4b('0x49')](function(_0x32169e){var _0x402362=_0x42afdd[_0xdd4b('0x33')][_0xdd4b('0x70')]?0x1f4:_0x32169e[_0xdd4b('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xdd4b('0x58'),_0x402362,JSON['stringify'](_0x32169e));delete _0x32169e['name'];if(_0x402362===0x191){_0x402362=0x190;}_0x1cf885[_0xdd4b('0x1b')](_0x402362)[_0xdd4b('0x2a')](_0x42afdd[_0xdd4b('0x33')][_0xdd4b('0x70')]?{'message':_0xdd4b('0x72'),'statusCode':_0x32169e[_0xdd4b('0x71')]}:_0x32169e);});}; \ No newline at end of file +var _0x87ae=['substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','capitalize','test','statusCode','error','send','Wrong\x20credentials','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','sendStatus','stack','map','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','params','length','find','catch','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice'];(function(_0x2003d0,_0x27a2b1){var _0xa12f02=function(_0x58c486){while(--_0x58c486){_0x2003d0['push'](_0x2003d0['shift']());}};_0xa12f02(++_0x27a2b1);}(_0x87ae,0xf5));var _0xe87a=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x87ae[_0xbc4560];return _0x298cfb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe87a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe87a('0x1'));var BPromise=require(_0xe87a('0x2'));var Mustache=require(_0xe87a('0x3'));var util=require('util');var path=require(_0xe87a('0x4'));var sox=require(_0xe87a('0x5'));var csv=require(_0xe87a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe87a('0x7'));var squel=require(_0xe87a('0x8'));var crypto=require('crypto');var jsforce=require(_0xe87a('0x9'));var deskjs=require(_0xe87a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xb'));var Papa=require(_0xe87a('0xc'));var Redis=require('ioredis');var authService=require(_0xe87a('0xd'));var qs=require(_0xe87a('0xe'));var as=require(_0xe87a('0xf'));var hardwareService=require(_0xe87a('0x10'));var logger=require(_0xe87a('0x11'))(_0xe87a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe87a('0x13'));var db=require(_0xe87a('0x14'))['db'];var integrations=require(_0xe87a('0x15'));function respondWithStatusCode(_0x4db185,_0x1a725a){_0x1a725a=_0x1a725a||0xcc;return function(_0x18d01d){if(_0x18d01d){return _0x4db185['sendStatus'](_0x1a725a);}return _0x4db185[_0xe87a('0x16')](_0x1a725a)[_0xe87a('0x17')]();};}function respondWithResult(_0x136340,_0x5032c5){_0x5032c5=_0x5032c5||0xc8;return function(_0x5d1374){if(_0x5d1374){return _0x136340['status'](_0x5032c5)['json'](_0x5d1374);}};}function respondWithFilteredResult(_0x44474f,_0x1fa2cd){return function(_0xd2ca53){if(_0xd2ca53){var _0x175626=typeof _0x1fa2cd['offset']===_0xe87a('0x18')&&typeof _0x1fa2cd[_0xe87a('0x19')]==='undefined';var _0x5f31e3=_0xd2ca53[_0xe87a('0x1a')];var _0x5c9acf=_0x175626?0x0:_0x1fa2cd[_0xe87a('0x1b')];var _0xac5b46=_0x175626?_0xd2ca53[_0xe87a('0x1a')]:_0x1fa2cd['offset']+_0x1fa2cd[_0xe87a('0x19')];var _0x58ecfa;if(_0xac5b46>=_0x5f31e3){_0xac5b46=_0x5f31e3;_0x58ecfa=0xc8;}else{_0x58ecfa=0xce;}_0x44474f[_0xe87a('0x16')](_0x58ecfa);return _0x44474f[_0xe87a('0x1c')](_0xe87a('0x1d'),_0x5c9acf+'-'+_0xac5b46+'/'+_0x5f31e3)[_0xe87a('0x1e')](_0xd2ca53);}return null;};}function patchUpdates(_0x104f67){return function(_0x5be8f6){try{jsonpatch[_0xe87a('0x1f')](_0x5be8f6,_0x104f67,!![]);}catch(_0x46e943){return BPromise['reject'](_0x46e943);}return _0x5be8f6['save']();};}function saveUpdates(_0x42ba03,_0x363c6a){return function(_0x13268e){if(_0x13268e){return _0x13268e[_0xe87a('0x20')](_0x42ba03)[_0xe87a('0x21')](function(_0x46731f){return _0x46731f;});}return null;};}function removeEntity(_0x56eba0,_0x59d9f7){return function(_0x54e386){if(_0x54e386){return _0x54e386['destroy']()[_0xe87a('0x21')](function(){_0x56eba0['status'](0xcc)[_0xe87a('0x17')]();});}};}function handleEntityNotFound(_0x59dc1a,_0x19f21e){return function(_0xfb831e){if(!_0xfb831e){_0x59dc1a[_0xe87a('0x22')](0x194);}return _0xfb831e;};}function handleError(_0x16ee69,_0x294d8b){_0x294d8b=_0x294d8b||0x1f4;return function(_0x3f5241){logger['error'](_0x3f5241[_0xe87a('0x23')]);if(_0x3f5241['name']){delete _0x3f5241['name'];}_0x16ee69[_0xe87a('0x16')](_0x294d8b)['send'](_0x3f5241);};}exports['index']=function(_0x58a2b8,_0x17c895){var _0x6feaf6={},_0x36d4cc={},_0x4eae3f={'count':0x0,'rows':[]};var _0x565d01=_[_0xe87a('0x24')](db['FreshdeskAccount']['rawAttributes'],function(_0x3a5dc4){return{'name':_0x3a5dc4[_0xe87a('0x25')],'type':_0x3a5dc4[_0xe87a('0x26')][_0xe87a('0x27')]};});_0x36d4cc[_0xe87a('0x28')]=_['map'](_0x565d01,_0xe87a('0x29'));_0x36d4cc['query']=_[_0xe87a('0x2a')](_0x58a2b8['query']);_0x36d4cc[_0xe87a('0x2b')]=_[_0xe87a('0x2c')](_0x36d4cc[_0xe87a('0x28')],_0x36d4cc[_0xe87a('0x2d')]);_0x6feaf6[_0xe87a('0x2e')]=_[_0xe87a('0x2c')](_0x36d4cc[_0xe87a('0x28')],qs[_0xe87a('0x2f')](_0x58a2b8[_0xe87a('0x2d')][_0xe87a('0x2f')]));_0x6feaf6['attributes']=_0x6feaf6['attributes']['length']?_0x6feaf6[_0xe87a('0x2e')]:_0x36d4cc['model'];if(!_0x58a2b8[_0xe87a('0x2d')][_0xe87a('0x30')]('nolimit')){_0x6feaf6[_0xe87a('0x19')]=qs['limit'](_0x58a2b8['query'][_0xe87a('0x19')]);_0x6feaf6[_0xe87a('0x1b')]=qs[_0xe87a('0x1b')](_0x58a2b8[_0xe87a('0x2d')]['offset']);}_0x6feaf6[_0xe87a('0x31')]=qs[_0xe87a('0x32')](_0x58a2b8['query'][_0xe87a('0x32')]);_0x6feaf6[_0xe87a('0x33')]=qs['filters'](_[_0xe87a('0x34')](_0x58a2b8[_0xe87a('0x2d')],_0x36d4cc[_0xe87a('0x2b')]),_0x565d01);if(_0x58a2b8[_0xe87a('0x2d')][_0xe87a('0x35')]){_0x6feaf6['where']=_[_0xe87a('0x36')](_0x6feaf6['where'],{'$or':_[_0xe87a('0x24')](_0x565d01,function(_0x4e66d1){if(_0x4e66d1['type']!==_0xe87a('0x37')){var _0x31963a={};_0x31963a[_0x4e66d1[_0xe87a('0x29')]]={'$like':'%'+_0x58a2b8[_0xe87a('0x2d')][_0xe87a('0x35')]+'%'};return _0x31963a;}})});}_0x6feaf6=_[_0xe87a('0x36')]({},_0x6feaf6,_0x58a2b8[_0xe87a('0x38')]);var _0x7448e7={'where':_0x6feaf6[_0xe87a('0x33')]};return db[_0xe87a('0x39')][_0xe87a('0x1a')](_0x7448e7)[_0xe87a('0x21')](function(_0x127694){_0x4eae3f[_0xe87a('0x1a')]=_0x127694;if(_0x58a2b8['query'][_0xe87a('0x3a')]){_0x6feaf6[_0xe87a('0x3b')]=[{'all':!![]}];}return db[_0xe87a('0x39')][_0xe87a('0x3c')](_0x6feaf6);})['then'](function(_0x590a49){_0x4eae3f['rows']=_0x590a49;return _0x4eae3f;})[_0xe87a('0x21')](respondWithFilteredResult(_0x17c895,_0x6feaf6))['catch'](handleError(_0x17c895,null));};exports['show']=function(_0x3bcee7,_0x5eb62e){var _0x5b1f55={'raw':![],'where':{'id':_0x3bcee7[_0xe87a('0x3d')]['id']}},_0x1450b3={};_0x1450b3['model']=_[_0xe87a('0x2a')](db['FreshdeskAccount']['rawAttributes']);_0x1450b3['query']=_[_0xe87a('0x2a')](_0x3bcee7[_0xe87a('0x2d')]);_0x1450b3['filters']=_[_0xe87a('0x2c')](_0x1450b3[_0xe87a('0x28')],_0x1450b3[_0xe87a('0x2d')]);_0x5b1f55['attributes']=_['intersection'](_0x1450b3['model'],qs['fields'](_0x3bcee7[_0xe87a('0x2d')]['fields']));_0x5b1f55[_0xe87a('0x2e')]=_0x5b1f55[_0xe87a('0x2e')][_0xe87a('0x3e')]?_0x5b1f55[_0xe87a('0x2e')]:_0x1450b3['model'];if(_0x3bcee7[_0xe87a('0x2d')][_0xe87a('0x3a')]){_0x5b1f55['include']=[{'all':!![]}];}_0x5b1f55=_[_0xe87a('0x36')]({},_0x5b1f55,_0x3bcee7[_0xe87a('0x38')]);return db[_0xe87a('0x39')][_0xe87a('0x3f')](_0x5b1f55)[_0xe87a('0x21')](handleEntityNotFound(_0x5eb62e,null))[_0xe87a('0x21')](respondWithResult(_0x5eb62e,null))[_0xe87a('0x40')](handleError(_0x5eb62e,null));};exports[_0xe87a('0x41')]=function(_0x2aa508,_0x5e25ce){return db[_0xe87a('0x39')][_0xe87a('0x41')](_0x2aa508[_0xe87a('0x42')],{})[_0xe87a('0x21')](respondWithResult(_0x5e25ce,0xc9))['catch'](handleError(_0x5e25ce,null));};exports[_0xe87a('0x20')]=function(_0x28c00b,_0x363050){if(_0x28c00b[_0xe87a('0x42')]['id']){delete _0x28c00b[_0xe87a('0x42')]['id'];}return db[_0xe87a('0x39')][_0xe87a('0x3f')]({'where':{'id':_0x28c00b[_0xe87a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x363050,null))[_0xe87a('0x21')](saveUpdates(_0x28c00b[_0xe87a('0x42')],null))[_0xe87a('0x21')](respondWithResult(_0x363050,null))['catch'](handleError(_0x363050,null));};exports[_0xe87a('0x43')]=function(_0xc43c4a,_0xe032c8){return db[_0xe87a('0x39')][_0xe87a('0x3f')]({'where':{'id':_0xc43c4a[_0xe87a('0x3d')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0xe032c8,null))[_0xe87a('0x21')](removeEntity(_0xe032c8,null))[_0xe87a('0x40')](handleError(_0xe032c8,null));};exports[_0xe87a('0x44')]=function(_0x1ec3f5,_0x1f4272,_0x59ef9d){var _0x369bec={};var _0x9c063a={};var _0x35e125;var _0x1bbd2e;return db[_0xe87a('0x39')][_0xe87a('0x45')]({'where':{'id':_0x1ec3f5[_0xe87a('0x3d')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0x1f4272,null))[_0xe87a('0x21')](function(_0x5ee0b9){if(_0x5ee0b9){_0x35e125=_0x5ee0b9;_0x9c063a['model']=_[_0xe87a('0x2a')](db[_0xe87a('0x46')]['rawAttributes']);_0x9c063a[_0xe87a('0x2d')]=_[_0xe87a('0x2a')](_0x1ec3f5['query']);_0x9c063a[_0xe87a('0x2b')]=_[_0xe87a('0x2c')](_0x9c063a['model'],_0x9c063a[_0xe87a('0x2d')]);_0x369bec[_0xe87a('0x2e')]=_[_0xe87a('0x2c')](_0x9c063a[_0xe87a('0x28')],qs['fields'](_0x1ec3f5['query'][_0xe87a('0x2f')]));_0x369bec[_0xe87a('0x2e')]=_0x369bec['attributes'][_0xe87a('0x3e')]?_0x369bec['attributes']:_0x9c063a[_0xe87a('0x28')];_0x369bec['order']=qs[_0xe87a('0x32')](_0x1ec3f5['query'][_0xe87a('0x32')]);_0x369bec['where']=qs[_0xe87a('0x2b')](_[_0xe87a('0x34')](_0x1ec3f5[_0xe87a('0x2d')],_0x9c063a[_0xe87a('0x2b')]));if(_0x1ec3f5[_0xe87a('0x2d')][_0xe87a('0x35')]){_0x369bec[_0xe87a('0x33')]=_[_0xe87a('0x36')](_0x369bec[_0xe87a('0x33')],{'$or':_[_0xe87a('0x24')](_0x369bec[_0xe87a('0x2e')],function(_0x5947ba){var _0x228ba1={};_0x228ba1[_0x5947ba]={'$like':'%'+_0x1ec3f5[_0xe87a('0x2d')][_0xe87a('0x35')]+'%'};return _0x228ba1;})});}_0x369bec=_[_0xe87a('0x36')]({},_0x369bec,_0x1ec3f5[_0xe87a('0x38')]);return _0x35e125[_0xe87a('0x44')](_0x369bec);}})[_0xe87a('0x21')](function(_0xd847af){if(_0xd847af){_0x1bbd2e=_0xd847af[_0xe87a('0x3e')];if(!_0x1ec3f5[_0xe87a('0x2d')][_0xe87a('0x30')](_0xe87a('0x47'))){_0x369bec[_0xe87a('0x19')]=qs[_0xe87a('0x19')](_0x1ec3f5[_0xe87a('0x2d')][_0xe87a('0x19')]);_0x369bec['offset']=qs[_0xe87a('0x1b')](_0x1ec3f5['query'][_0xe87a('0x1b')]);}return _0x35e125['getConfigurations'](_0x369bec);}})[_0xe87a('0x21')](function(_0x537795){if(_0x537795){return _0x537795?{'count':_0x1bbd2e,'rows':_0x537795}:null;}})[_0xe87a('0x21')](respondWithResult(_0x1f4272,null))[_0xe87a('0x40')](handleError(_0x1f4272,null));};exports[_0xe87a('0x48')]=function(_0x1754f0,_0x4827b0,_0x46d400){if(_0x1754f0[_0xe87a('0x42')]['id']){delete _0x1754f0[_0xe87a('0x42')]['id'];}return db[_0xe87a('0x39')][_0xe87a('0x45')]({'where':{'id':_0x1754f0['params']['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0x4827b0,null))[_0xe87a('0x21')](function(_0x2c0fe3){if(_0x2c0fe3){_0x1754f0[_0xe87a('0x42')][_0xe87a('0x49')]=_0x2c0fe3['id'];_0x1754f0['body'][_0xe87a('0x4a')]=integrations[_0xe87a('0x4b')](_0x1754f0[_0xe87a('0x42')][_0xe87a('0x4c')],_0x1754f0[_0xe87a('0x42')][_0xe87a('0x26')]);_0x1754f0[_0xe87a('0x42')][_0xe87a('0x4d')]=integrations['getDescriptions'](_0x1754f0[_0xe87a('0x42')][_0xe87a('0x4c')],_0x1754f0['body'][_0xe87a('0x26')]);return db[_0xe87a('0x46')]['create'](_0x1754f0['body'],{'include':[{'model':db[_0xe87a('0x4e')],'as':_0xe87a('0x4a')},{'model':db[_0xe87a('0x4e')],'as':_0xe87a('0x4d')}]});}return null;})['then'](respondWithResult(_0x4827b0,null))[_0xe87a('0x40')](handleError(_0x4827b0,null));};exports[_0xe87a('0x4f')]=function(_0x3c15bb,_0x5e93c0,_0x165aef){var _0x4d26fe='';return db[_0xe87a('0x39')][_0xe87a('0x45')]({'where':{'id':_0x3c15bb[_0xe87a('0x3d')]['id']},'attributes':['id',_0xe87a('0x50'),'apiKey']})[_0xe87a('0x21')](handleEntityNotFound(_0x5e93c0,null))['then'](function(_0x562ad7){if(_0x562ad7){_0x4d26fe=_0x562ad7[_0xe87a('0x50')];var _0x3903f7=_0x4d26fe[_0xe87a('0x51')](-0x1);if(_0x3903f7==='/'){_0x4d26fe=_0x4d26fe[_0xe87a('0x52')](0x0,_0x4d26fe[_0xe87a('0x53')](_0x3903f7));}return rp({'method':_0xe87a('0x54'),'uri':util[_0xe87a('0x55')](_0xe87a('0x56'),_0x4d26fe,_0xe87a('0x57')),'headers':{'Authorization':util[_0xe87a('0x55')]('Basic\x20%s',new Buffer(util[_0xe87a('0x55')]('%s:X',_0x562ad7[_0xe87a('0x58')]))[_0xe87a('0x59')](_0xe87a('0x5a')))},'json':!![]});}})[_0xe87a('0x21')](function(_0x39d749){if(_0x39d749){var _0xa39f55=[_0xe87a('0x5b'),'subject',_0xe87a('0x5c'),_0xe87a('0x5d'),_0xe87a('0x16'),_0xe87a('0x5e'),_0xe87a('0x5f'),_0xe87a('0x60'),_0xe87a('0x61'),_0xe87a('0x5f'),_0xe87a('0x62')];_['remove'](_0x39d749,function(_0xf16ceb){return _0xa39f55[_0xe87a('0x63')](_0xf16ceb[_0xe87a('0x29')])||!_0xf16ceb[_0xe87a('0x64')]&&_0xf16ceb[_0xe87a('0x26')]!==_0xe87a('0x65')&&_0xf16ceb[_0xe87a('0x26')]!==_0xe87a('0x66');});return{'count':_0x39d749[_0xe87a('0x3e')],'rows':_[_0xe87a('0x24')](_0x39d749,function(_0x3f45e7){return{'id':_0x3f45e7[_0xe87a('0x29')],'name':_0x3f45e7['label'],'custom':!_0x3f45e7[_0xe87a('0x64')],'options':_0x3f45e7['choices']?_[_0xe87a('0x24')](_0x3f45e7['choices'],function(_0x5a94b1){return{'name':_[_0xe87a('0x67')](_0x5a94b1),'value':_0x5a94b1};}):[]};})};}})[_0xe87a('0x21')](respondWithResult(_0x5e93c0,null))[_0xe87a('0x40')](function(_0x1a3d32){var _0x81a349=_0x3c15bb[_0xe87a('0x2d')][_0xe87a('0x68')]?0x1f4:_0x1a3d32[_0xe87a('0x69')]||0x1f4;logger[_0xe87a('0x6a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x81a349,JSON['stringify'](_0x1a3d32));delete _0x1a3d32[_0xe87a('0x29')];if(_0x81a349===0x191){_0x81a349=0x190;}_0x5e93c0[_0xe87a('0x16')](_0x81a349)[_0xe87a('0x6b')](_0x3c15bb[_0xe87a('0x2d')][_0xe87a('0x68')]?{'message':_0xe87a('0x6c'),'statusCode':_0x1a3d32[_0xe87a('0x69')]}:_0x1a3d32);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5b1d2a1..2d5b02a 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 _0xdf17=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x397e32,_0x4d64e2){var _0x27b16d=function(_0xc77f7d){while(--_0xc77f7d){_0x397e32['push'](_0x397e32['shift']());}};_0x27b16d(++_0x4d64e2);}(_0xdf17,0x177));var _0x7df1=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xdf17[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x7df1('0x0'));var util=require(_0x7df1('0x1'));var logger=require(_0x7df1('0x2'))(_0x7df1('0x3'));var moment=require(_0x7df1('0x4'));var BPromise=require(_0x7df1('0x5'));var rp=require(_0x7df1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7df1('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x7df1('0x8'));module[_0x7df1('0x9')]=function(_0x11fa19,_0x4cee39){return _0x11fa19[_0x7df1('0xa')](_0x7df1('0xb'),attributes,{'tableName':_0x7df1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5697=['api','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x285159,_0x434500){var _0x3ade27=function(_0x47e9ba){while(--_0x47e9ba){_0x285159['push'](_0x285159['shift']());}};_0x3ade27(++_0x434500);}(_0x5697,0x123));var _0x7569=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x5697[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0x7569('0x0'));var util=require(_0x7569('0x1'));var logger=require(_0x7569('0x2'))(_0x7569('0x3'));var moment=require('moment');var BPromise=require(_0x7569('0x4'));var rp=require(_0x7569('0x5'));var fs=require('fs');var path=require(_0x7569('0x6'));var rimraf=require('rimraf');var config=require(_0x7569('0x7'));var attributes=require(_0x7569('0x8'));var integrations=require(_0x7569('0x9'));module[_0x7569('0xa')]=function(_0x11183e,_0x5b9a9d){return _0x11183e[_0x7569('0xb')](_0x7569('0xc'),attributes,{'tableName':_0x7569('0xd'),'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 cf3616b..5a23938 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 _0xdbb3=['error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','include','model','attributes','map','ShowFreshdeskAccount','find','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x156696,_0x3a9a2e){var _0x5ab7c4=function(_0x26179a){while(--_0x26179a){_0x156696['push'](_0x156696['shift']());}};_0x5ab7c4(++_0x3a9a2e);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbb3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var moment=require(_0x3dbb('0x2'));var BPromise=require(_0x3dbb('0x3'));var rs=require(_0x3dbb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dbb('0x5'))['db'];var utils=require(_0x3dbb('0x6'));var logger=require(_0x3dbb('0x7'))('rpc');var config=require(_0x3dbb('0x8'));var jayson=require(_0x3dbb('0x9'));var client=jayson[_0x3dbb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b72b0,_0x380291,_0x48e970){return new BPromise(function(_0x440257,_0x4dd7bf){return client[_0x3dbb('0xb')](_0x1b72b0,_0x48e970)[_0x3dbb('0xc')](function(_0xa185b4){logger[_0x3dbb('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x380291,_0x3dbb('0xe'));logger[_0x3dbb('0xf')](_0x3dbb('0x10'),_0x380291,_0x3dbb('0xe'),JSON[_0x3dbb('0x11')](_0xa185b4));if(_0xa185b4['error']){if(_0xa185b4[_0x3dbb('0x12')][_0x3dbb('0x13')]===0x1f4){logger['error'](_0x3dbb('0x14'),_0x380291,_0xa185b4['error'][_0x3dbb('0x15')]);return _0x4dd7bf(_0xa185b4[_0x3dbb('0x12')][_0x3dbb('0x15')]);}logger[_0x3dbb('0x12')](_0x3dbb('0x14'),_0x380291,_0xa185b4[_0x3dbb('0x12')][_0x3dbb('0x15')]);return _0x440257(_0xa185b4[_0x3dbb('0x12')][_0x3dbb('0x15')]);}else{logger[_0x3dbb('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x380291,_0x3dbb('0xe'));_0x440257(_0xa185b4[_0x3dbb('0x16')][_0x3dbb('0x15')]);}})['catch'](function(_0x108028){logger[_0x3dbb('0x12')](_0x3dbb('0x14'),_0x380291,_0x108028);_0x4dd7bf(_0x108028);});});}exports[_0x3dbb('0x17')]=function(_0x3a5c81){var _0x21c12a=this;return new Promise(function(_0x3050c1,_0x313bfd){return db[_0x3dbb('0x18')]['findAll']({'raw':_0x3a5c81[_0x3dbb('0x19')]?_0x3a5c81[_0x3dbb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3a5c81[_0x3dbb('0x19')]?_0x3a5c81[_0x3dbb('0x19')][_0x3dbb('0x1a')]||null:null,'attributes':_0x3a5c81['options']?_0x3a5c81[_0x3dbb('0x19')]['attributes']||null:null,'limit':_0x3a5c81[_0x3dbb('0x19')]?_0x3a5c81[_0x3dbb('0x19')][_0x3dbb('0x1b')]||null:null,'include':_0x3a5c81['options']?_0x3a5c81[_0x3dbb('0x19')][_0x3dbb('0x1c')]?_['map'](_0x3a5c81[_0x3dbb('0x19')][_0x3dbb('0x1c')],function(_0xa5862d){return{'model':db[_0xa5862d[_0x3dbb('0x1d')]],'as':_0xa5862d['as'],'attributes':_0xa5862d[_0x3dbb('0x1e')],'include':_0xa5862d[_0x3dbb('0x1c')]?_[_0x3dbb('0x1f')](_0xa5862d['include'],function(_0x8a0fca){return{'model':db[_0x8a0fca['model']],'as':_0x8a0fca['as'],'attributes':_0x8a0fca[_0x3dbb('0x1e')],'include':_0x8a0fca[_0x3dbb('0x1c')]?_[_0x3dbb('0x1f')](_0x8a0fca['include'],function(_0x27f38b){return{'model':db[_0x27f38b['model']],'as':_0x27f38b['as'],'attributes':_0x27f38b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dbb('0xc')](function(_0x49da3a){logger[_0x3dbb('0xd')]('GetFreshdeskAccount',_0x3a5c81);logger[_0x3dbb('0xf')](_0x3dbb('0x17'),_0x3a5c81,JSON[_0x3dbb('0x11')](_0x49da3a));_0x3050c1(_0x49da3a);})['catch'](function(_0x2e9731){logger[_0x3dbb('0x12')](_0x3dbb('0x17'),_0x2e9731[_0x3dbb('0x15')],_0x3a5c81);_0x313bfd(_0x21c12a[_0x3dbb('0x12')](0x1f4,_0x2e9731[_0x3dbb('0x15')]));});});};exports[_0x3dbb('0x20')]=function(_0xf09e4d){var _0x333d0e=this;return new Promise(function(_0x166b60,_0x58566c){return db[_0x3dbb('0x18')][_0x3dbb('0x21')]({'raw':_0xf09e4d[_0x3dbb('0x19')]?_0xf09e4d[_0x3dbb('0x19')][_0x3dbb('0x22')]===undefined?!![]:![]:!![],'where':_0xf09e4d[_0x3dbb('0x19')]?_0xf09e4d[_0x3dbb('0x19')][_0x3dbb('0x1a')]||null:null,'attributes':_0xf09e4d['options']?_0xf09e4d[_0x3dbb('0x19')]['attributes']||null:null,'include':_0xf09e4d['options']?_0xf09e4d['options'][_0x3dbb('0x1c')]?_[_0x3dbb('0x1f')](_0xf09e4d[_0x3dbb('0x19')][_0x3dbb('0x1c')],function(_0x1672ed){return{'model':db[_0x1672ed[_0x3dbb('0x1d')]],'as':_0x1672ed['as'],'attributes':_0x1672ed[_0x3dbb('0x1e')],'include':_0x1672ed[_0x3dbb('0x1c')]?_[_0x3dbb('0x1f')](_0x1672ed[_0x3dbb('0x1c')],function(_0x4ad106){return{'model':db[_0x4ad106[_0x3dbb('0x1d')]],'as':_0x4ad106['as'],'attributes':_0x4ad106[_0x3dbb('0x1e')],'include':_0x4ad106['include']?_[_0x3dbb('0x1f')](_0x4ad106[_0x3dbb('0x1c')],function(_0x401ea7){return{'model':db[_0x401ea7[_0x3dbb('0x1d')]],'as':_0x401ea7['as'],'attributes':_0x401ea7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dbb('0xc')](function(_0x1dcbe2){logger[_0x3dbb('0xd')](_0x3dbb('0x20'),_0xf09e4d);logger[_0x3dbb('0xf')](_0x3dbb('0x20'),_0xf09e4d,JSON['stringify'](_0x1dcbe2));_0x166b60(_0x1dcbe2);})[_0x3dbb('0x23')](function(_0xf2856d){logger['error'](_0x3dbb('0x20'),_0xf2856d[_0x3dbb('0x15')],_0xf09e4d);_0x58566c(_0x333d0e[_0x3dbb('0x12')](0x1f4,_0xf2856d['message']));});});}; \ No newline at end of file +var _0x3051=['jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','attributes','include','model','map','ShowFreshdeskAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x3051,0x85));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1305('0x0'));var rs=require(_0x1305('0x1'));var fs=require('fs');var Redis=require(_0x1305('0x2'));var db=require(_0x1305('0x3'))['db'];var utils=require(_0x1305('0x4'));var logger=require('../../config/logger')(_0x1305('0x5'));var config=require(_0x1305('0x6'));var jayson=require(_0x1305('0x7'));var client=jayson[_0x1305('0x8')][_0x1305('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdf301d,_0x9e00e4,_0x389525){return new BPromise(function(_0x30cbd8,_0x43d290){return client[_0x1305('0xa')](_0xdf301d,_0x389525)[_0x1305('0xb')](function(_0x51e699){logger[_0x1305('0xc')](_0x1305('0xd'),_0x9e00e4,_0x1305('0xe'));logger[_0x1305('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x9e00e4,_0x1305('0xe'),JSON[_0x1305('0x10')](_0x51e699));if(_0x51e699['error']){if(_0x51e699[_0x1305('0x11')][_0x1305('0x12')]===0x1f4){logger['error'](_0x1305('0xd'),_0x9e00e4,_0x51e699[_0x1305('0x11')][_0x1305('0x13')]);return _0x43d290(_0x51e699[_0x1305('0x11')][_0x1305('0x13')]);}logger[_0x1305('0x11')](_0x1305('0xd'),_0x9e00e4,_0x51e699[_0x1305('0x11')][_0x1305('0x13')]);return _0x30cbd8(_0x51e699[_0x1305('0x11')][_0x1305('0x13')]);}else{logger[_0x1305('0xc')](_0x1305('0xd'),_0x9e00e4,_0x1305('0xe'));_0x30cbd8(_0x51e699[_0x1305('0x14')][_0x1305('0x13')]);}})[_0x1305('0x15')](function(_0x145e16){logger[_0x1305('0x11')](_0x1305('0xd'),_0x9e00e4,_0x145e16);_0x43d290(_0x145e16);});});}exports[_0x1305('0x16')]=function(_0x52d079){var _0x1f68c8=this;return new Promise(function(_0x1e7359,_0x58994b){return db[_0x1305('0x17')][_0x1305('0x18')]({'raw':_0x52d079['options']?_0x52d079[_0x1305('0x19')][_0x1305('0x1a')]===undefined?!![]:![]:!![],'where':_0x52d079['options']?_0x52d079[_0x1305('0x19')][_0x1305('0x1b')]||null:null,'attributes':_0x52d079[_0x1305('0x19')]?_0x52d079[_0x1305('0x19')]['attributes']||null:null,'limit':_0x52d079[_0x1305('0x19')]?_0x52d079['options'][_0x1305('0x1c')]||null:null,'include':_0x52d079[_0x1305('0x19')]?_0x52d079[_0x1305('0x19')]['include']?_['map'](_0x52d079[_0x1305('0x19')]['include'],function(_0x6b5ef9){return{'model':db[_0x6b5ef9['model']],'as':_0x6b5ef9['as'],'attributes':_0x6b5ef9[_0x1305('0x1d')],'include':_0x6b5ef9['include']?_['map'](_0x6b5ef9[_0x1305('0x1e')],function(_0xcb9f50){return{'model':db[_0xcb9f50[_0x1305('0x1f')]],'as':_0xcb9f50['as'],'attributes':_0xcb9f50['attributes'],'include':_0xcb9f50['include']?_[_0x1305('0x20')](_0xcb9f50['include'],function(_0x123c04){return{'model':db[_0x123c04[_0x1305('0x1f')]],'as':_0x123c04['as'],'attributes':_0x123c04['attributes']};}):[]};}):[]};}):[]:[]})[_0x1305('0xb')](function(_0x2c9c6d){logger[_0x1305('0xc')](_0x1305('0x16'),_0x52d079);logger['debug']('GetFreshdeskAccount',_0x52d079,JSON[_0x1305('0x10')](_0x2c9c6d));_0x1e7359(_0x2c9c6d);})[_0x1305('0x15')](function(_0x31d5d0){logger[_0x1305('0x11')](_0x1305('0x16'),_0x31d5d0[_0x1305('0x13')],_0x52d079);_0x58994b(_0x1f68c8[_0x1305('0x11')](0x1f4,_0x31d5d0['message']));});});};exports[_0x1305('0x21')]=function(_0x2505cf){var _0x1d3dda=this;return new Promise(function(_0x23296a,_0x1416e3){return db['FreshdeskAccount'][_0x1305('0x22')]({'raw':_0x2505cf['options']?_0x2505cf[_0x1305('0x19')][_0x1305('0x1a')]===undefined?!![]:![]:!![],'where':_0x2505cf['options']?_0x2505cf[_0x1305('0x19')][_0x1305('0x1b')]||null:null,'attributes':_0x2505cf[_0x1305('0x19')]?_0x2505cf[_0x1305('0x19')][_0x1305('0x1d')]||null:null,'include':_0x2505cf['options']?_0x2505cf['options'][_0x1305('0x1e')]?_[_0x1305('0x20')](_0x2505cf[_0x1305('0x19')][_0x1305('0x1e')],function(_0x421018){return{'model':db[_0x421018[_0x1305('0x1f')]],'as':_0x421018['as'],'attributes':_0x421018[_0x1305('0x1d')],'include':_0x421018['include']?_[_0x1305('0x20')](_0x421018['include'],function(_0x3bcdad){return{'model':db[_0x3bcdad['model']],'as':_0x3bcdad['as'],'attributes':_0x3bcdad['attributes'],'include':_0x3bcdad[_0x1305('0x1e')]?_['map'](_0x3bcdad[_0x1305('0x1e')],function(_0x465a34){return{'model':db[_0x465a34['model']],'as':_0x465a34['as'],'attributes':_0x465a34['attributes']};}):[]};}):[]};}):[]:[]})[_0x1305('0xb')](function(_0x5432a5){logger[_0x1305('0xc')](_0x1305('0x21'),_0x2505cf);logger[_0x1305('0xf')](_0x1305('0x21'),_0x2505cf,JSON[_0x1305('0x10')](_0x5432a5));_0x23296a(_0x5432a5);})[_0x1305('0x15')](function(_0x2919f0){logger['error']('ShowFreshdeskAccount',_0x2919f0[_0x1305('0x13')],_0x2505cf);_0x1416e3(_0x1d3dda[_0x1305('0x11')](0x1f4,_0x2919f0[_0x1305('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9178b4f..9a4a436 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 _0xffb4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','update','delete','exports','multer','util'];(function(_0x30943b,_0x3f20fd){var _0x44cc19=function(_0x28f654){while(--_0x28f654){_0x30943b['push'](_0x30943b['shift']());}};_0x44cc19(++_0x3f20fd);}(_0xffb4,0x102));var _0x4ffb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xffb4[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x4ffb('0x0'));var util=require(_0x4ffb('0x1'));var path=require('path');var timeout=require(_0x4ffb('0x2'));var express=require(_0x4ffb('0x3'));var router=express[_0x4ffb('0x4')]();var fs_extra=require(_0x4ffb('0x5'));var auth=require(_0x4ffb('0x6'));var interaction=require(_0x4ffb('0x7'));var config=require(_0x4ffb('0x8'));var controller=require(_0x4ffb('0x9'));router[_0x4ffb('0xa')]('/',auth[_0x4ffb('0xb')](),controller[_0x4ffb('0xc')]);router[_0x4ffb('0xa')](_0x4ffb('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4ffb('0xa')](_0x4ffb('0xe'),auth[_0x4ffb('0xb')](),controller[_0x4ffb('0xf')]);router[_0x4ffb('0xa')](_0x4ffb('0x10'),auth['isAuthenticated'](),controller[_0x4ffb('0x11')]);router[_0x4ffb('0xa')](_0x4ffb('0x12'),auth[_0x4ffb('0xb')](),controller['getDescriptions']);router['get'](_0x4ffb('0x13'),auth[_0x4ffb('0xb')](),controller[_0x4ffb('0x14')]);router[_0x4ffb('0x15')]('/',auth[_0x4ffb('0xb')](),controller[_0x4ffb('0x16')]);router[_0x4ffb('0x15')]('/:id/tags',auth[_0x4ffb('0xb')](),controller['setTags']);router['put'](_0x4ffb('0xd'),auth[_0x4ffb('0xb')](),controller[_0x4ffb('0x17')]);router[_0x4ffb('0x18')](_0x4ffb('0xd'),auth[_0x4ffb('0xb')](),controller['destroy']);module[_0x4ffb('0x19')]=router; \ No newline at end of file +var _0xf04e=['getTags','post','setTags','put','/:id','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x4d0e8b,_0x25837e){var _0x1163d3=function(_0x417a53){while(--_0x417a53){_0x4d0e8b['push'](_0x4d0e8b['shift']());}};_0x1163d3(++_0x25837e);}(_0xf04e,0x1a8));var _0xef04=function(_0x4db4d9,_0xe426ee){_0x4db4d9=_0x4db4d9-0x0;var _0x89cd7=_0xf04e[_0x4db4d9];return _0x89cd7;};'use strict';var multer=require('multer');var util=require(_0xef04('0x0'));var path=require(_0xef04('0x1'));var timeout=require('connect-timeout');var express=require(_0xef04('0x2'));var router=express[_0xef04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef04('0x4'));var interaction=require(_0xef04('0x5'));var config=require(_0xef04('0x6'));var controller=require(_0xef04('0x7'));router[_0xef04('0x8')]('/',auth['isAuthenticated'](),controller[_0xef04('0x9')]);router[_0xef04('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xef04('0xa')]);router[_0xef04('0x8')]('/:id/fields',auth[_0xef04('0xb')](),controller[_0xef04('0xc')]);router[_0xef04('0x8')](_0xef04('0xd'),auth[_0xef04('0xb')](),controller[_0xef04('0xe')]);router[_0xef04('0x8')](_0xef04('0xf'),auth[_0xef04('0xb')](),controller[_0xef04('0x10')]);router[_0xef04('0x8')](_0xef04('0x11'),auth[_0xef04('0xb')](),controller[_0xef04('0x12')]);router[_0xef04('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xef04('0x11'),auth[_0xef04('0xb')](),controller[_0xef04('0x14')]);router[_0xef04('0x15')](_0xef04('0x16'),auth['isAuthenticated'](),controller[_0xef04('0x17')]);router[_0xef04('0x18')](_0xef04('0x16'),auth[_0xef04('0xb')](),controller['destroy']);module[_0xef04('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8865ef2..51d9f3c 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 _0x5abe=['exports','STRING','sequelize'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5abe,0x68));var _0xe5ab=function(_0x1ea155,_0x410622){_0x1ea155=_0x1ea155-0x0;var _0x3f252a=_0x5abe[_0x1ea155];return _0x3f252a;};'use strict';var Sequelize=require(_0xe5ab('0x0'));module[_0xe5ab('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5ab('0x2')]}}; \ No newline at end of file +var _0xcf09=['STRING','sequelize','exports'];(function(_0x3b3e3a,_0x5b21a5){var _0x578fff=function(_0x53af86){while(--_0x53af86){_0x3b3e3a['push'](_0x3b3e3a['shift']());}};_0x578fff(++_0x5b21a5);}(_0xcf09,0x97));var _0x9cf0=function(_0x233412,_0x3dafc0){_0x233412=_0x233412-0x0;var _0x3e315b=_0xcf09[_0x233412];return _0x3e315b;};'use strict';var Sequelize=require(_0x9cf0('0x0'));module[_0x9cf0('0x1')]={'name':{'type':Sequelize[_0x9cf0('0x2')]},'description':{'type':Sequelize[_0x9cf0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ffbc211..77caf8e 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 _0x0d02=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x340b1b,_0x4f21b6){var _0x41b74e=function(_0x221a59){while(--_0x221a59){_0x340b1b['push'](_0x340b1b['shift']());}};_0x41b74e(++_0x4f21b6);}(_0x0d02,0xa4));var _0x20d0=function(_0x150ba2,_0x5d283c){_0x150ba2=_0x150ba2-0x0;var _0x3cdcc4=_0x0d02[_0x150ba2];return _0x3cdcc4;};'use strict';var emlformat=require(_0x20d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20d0('0x1'));var jsonpatch=require(_0x20d0('0x2'));var rp=require(_0x20d0('0x3'));var moment=require('moment');var BPromise=require(_0x20d0('0x4'));var Mustache=require(_0x20d0('0x5'));var util=require('util');var path=require('path');var sox=require(_0x20d0('0x6'));var csv=require(_0x20d0('0x7'));var ejs=require(_0x20d0('0x8'));var fs=require('fs');var fs_extra=require(_0x20d0('0x9'));var _=require(_0x20d0('0xa'));var squel=require(_0x20d0('0xb'));var crypto=require(_0x20d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x20d0('0xd'));var toCsv=require(_0x20d0('0x7'));var querystring=require(_0x20d0('0xe'));var Papa=require(_0x20d0('0xf'));var Redis=require('ioredis');var authService=require(_0x20d0('0x10'));var qs=require(_0x20d0('0x11'));var as=require(_0x20d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20d0('0x13'))(_0x20d0('0x14'));var utils=require(_0x20d0('0x15'));var config=require(_0x20d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x20d0('0x17'))['db'];function respondWithStatusCode(_0x2938a9,_0x5a72ee){_0x5a72ee=_0x5a72ee||0xcc;return function(_0x4c51f8){if(_0x4c51f8){return _0x2938a9[_0x20d0('0x18')](_0x5a72ee);}return _0x2938a9['status'](_0x5a72ee)[_0x20d0('0x19')]();};}function respondWithResult(_0x23a05c,_0x4a96bf){_0x4a96bf=_0x4a96bf||0xc8;return function(_0x5358f1){if(_0x5358f1){return _0x23a05c['status'](_0x4a96bf)['json'](_0x5358f1);}};}function respondWithFilteredResult(_0x286a34,_0x2b4a00){return function(_0x1ecfd4){if(_0x1ecfd4){var _0x5530cb=typeof _0x2b4a00[_0x20d0('0x1a')]===_0x20d0('0x1b')&&typeof _0x2b4a00[_0x20d0('0x1c')]===_0x20d0('0x1b');var _0x4e88bb=_0x1ecfd4[_0x20d0('0x1d')];var _0x5377f9=_0x5530cb?0x0:_0x2b4a00[_0x20d0('0x1a')];var _0x54e33d=_0x5530cb?_0x1ecfd4[_0x20d0('0x1d')]:_0x2b4a00['offset']+_0x2b4a00[_0x20d0('0x1c')];var _0x26c808;if(_0x54e33d>=_0x4e88bb){_0x54e33d=_0x4e88bb;_0x26c808=0xc8;}else{_0x26c808=0xce;}_0x286a34[_0x20d0('0x1e')](_0x26c808);return _0x286a34[_0x20d0('0x1f')](_0x20d0('0x20'),_0x5377f9+'-'+_0x54e33d+'/'+_0x4e88bb)[_0x20d0('0x21')](_0x1ecfd4);}return null;};}function patchUpdates(_0x7c64cb){return function(_0x26b362){try{jsonpatch[_0x20d0('0x22')](_0x26b362,_0x7c64cb,!![]);}catch(_0xb18fc9){return BPromise[_0x20d0('0x23')](_0xb18fc9);}return _0x26b362[_0x20d0('0x24')]();};}function saveUpdates(_0x117c85,_0x418e2b){return function(_0x8eb124){if(_0x8eb124){return _0x8eb124[_0x20d0('0x25')](_0x117c85)['then'](function(_0x40ea8c){return _0x40ea8c;});}return null;};}function removeEntity(_0x58ec24,_0x4c8fea){return function(_0x386b84){if(_0x386b84){return _0x386b84[_0x20d0('0x26')]()[_0x20d0('0x27')](function(){_0x58ec24['status'](0xcc)[_0x20d0('0x19')]();});}};}function handleEntityNotFound(_0x431cae,_0xb3cb33){return function(_0x294bc5){if(!_0x294bc5){_0x431cae[_0x20d0('0x18')](0x194);}return _0x294bc5;};}function handleError(_0x1482cd,_0x581b52){_0x581b52=_0x581b52||0x1f4;return function(_0x16fac3){logger[_0x20d0('0x28')](_0x16fac3[_0x20d0('0x29')]);if(_0x16fac3['name']){delete _0x16fac3['name'];}_0x1482cd[_0x20d0('0x1e')](_0x581b52)[_0x20d0('0x2a')](_0x16fac3);};}exports[_0x20d0('0x2b')]=function(_0x3cf47a,_0x18abd3){var _0x119b4c={},_0x3cb363={},_0x5290fe={'count':0x0,'rows':[]};var _0x555106=_['map'](db[_0x20d0('0x2c')][_0x20d0('0x2d')],function(_0x3210c7){return{'name':_0x3210c7[_0x20d0('0x2e')],'type':_0x3210c7[_0x20d0('0x2f')]['key']};});_0x3cb363[_0x20d0('0x30')]=_[_0x20d0('0x31')](_0x555106,_0x20d0('0x32'));_0x3cb363[_0x20d0('0x33')]=_[_0x20d0('0x34')](_0x3cf47a[_0x20d0('0x33')]);_0x3cb363[_0x20d0('0x35')]=_[_0x20d0('0x36')](_0x3cb363['model'],_0x3cb363[_0x20d0('0x33')]);_0x119b4c[_0x20d0('0x37')]=_[_0x20d0('0x36')](_0x3cb363['model'],qs[_0x20d0('0x38')](_0x3cf47a[_0x20d0('0x33')][_0x20d0('0x38')]));_0x119b4c['attributes']=_0x119b4c[_0x20d0('0x37')][_0x20d0('0x39')]?_0x119b4c['attributes']:_0x3cb363[_0x20d0('0x30')];if(!_0x3cf47a[_0x20d0('0x33')][_0x20d0('0x3a')]('nolimit')){_0x119b4c['limit']=qs[_0x20d0('0x1c')](_0x3cf47a[_0x20d0('0x33')][_0x20d0('0x1c')]);_0x119b4c[_0x20d0('0x1a')]=qs[_0x20d0('0x1a')](_0x3cf47a[_0x20d0('0x33')][_0x20d0('0x1a')]);}_0x119b4c[_0x20d0('0x3b')]=qs[_0x20d0('0x3c')](_0x3cf47a[_0x20d0('0x33')]['sort']);_0x119b4c[_0x20d0('0x3d')]=qs[_0x20d0('0x35')](_[_0x20d0('0x3e')](_0x3cf47a[_0x20d0('0x33')],_0x3cb363[_0x20d0('0x35')]),_0x555106);if(_0x3cf47a[_0x20d0('0x33')][_0x20d0('0x3f')]){_0x119b4c[_0x20d0('0x3d')]=_[_0x20d0('0x40')](_0x119b4c[_0x20d0('0x3d')],{'$or':_[_0x20d0('0x31')](_0x555106,function(_0x9ee82d){if(_0x9ee82d['type']!==_0x20d0('0x41')){var _0x3dbdbe={};_0x3dbdbe[_0x9ee82d[_0x20d0('0x32')]]={'$like':'%'+_0x3cf47a[_0x20d0('0x33')][_0x20d0('0x3f')]+'%'};return _0x3dbdbe;}})});}_0x119b4c=_[_0x20d0('0x40')]({},_0x119b4c,_0x3cf47a[_0x20d0('0x42')]);var _0x24b55f={'where':_0x119b4c[_0x20d0('0x3d')]};return db['FreshdeskConfiguration'][_0x20d0('0x1d')](_0x24b55f)['then'](function(_0x31abe6){_0x5290fe['count']=_0x31abe6;if(_0x3cf47a[_0x20d0('0x33')]['includeAll']){_0x119b4c[_0x20d0('0x43')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x20d0('0x44')](_0x119b4c);})[_0x20d0('0x27')](function(_0xaa1fa4){_0x5290fe[_0x20d0('0x45')]=_0xaa1fa4;return _0x5290fe;})[_0x20d0('0x27')](respondWithFilteredResult(_0x18abd3,_0x119b4c))[_0x20d0('0x46')](handleError(_0x18abd3,null));};exports[_0x20d0('0x47')]=function(_0x28db45,_0x150fc0){var _0x38e4da={'raw':![],'where':{'id':_0x28db45[_0x20d0('0x48')]['id']}},_0x5d9119={};_0x5d9119[_0x20d0('0x30')]=_[_0x20d0('0x34')](db['FreshdeskConfiguration'][_0x20d0('0x2d')]);_0x5d9119[_0x20d0('0x33')]=_['keys'](_0x28db45[_0x20d0('0x33')]);_0x5d9119[_0x20d0('0x35')]=_[_0x20d0('0x36')](_0x5d9119['model'],_0x5d9119['query']);_0x38e4da[_0x20d0('0x37')]=_[_0x20d0('0x36')](_0x5d9119[_0x20d0('0x30')],qs[_0x20d0('0x38')](_0x28db45['query'][_0x20d0('0x38')]));_0x38e4da[_0x20d0('0x37')]=_0x38e4da[_0x20d0('0x37')][_0x20d0('0x39')]?_0x38e4da['attributes']:_0x5d9119[_0x20d0('0x30')];if(_0x28db45[_0x20d0('0x33')][_0x20d0('0x49')]){_0x38e4da['include']=[{'all':!![]}];}_0x38e4da=_[_0x20d0('0x40')]({},_0x38e4da,_0x28db45['options']);return db[_0x20d0('0x2c')][_0x20d0('0x4a')](_0x38e4da)['then'](handleEntityNotFound(_0x150fc0,null))[_0x20d0('0x27')](respondWithResult(_0x150fc0,null))['catch'](handleError(_0x150fc0,null));};exports['create']=function(_0x3177cd,_0xd30332){return db[_0x20d0('0x2c')][_0x20d0('0x4b')](_0x3177cd[_0x20d0('0x4c')],{})['then'](respondWithResult(_0xd30332,0xc9))[_0x20d0('0x46')](handleError(_0xd30332,null));};exports[_0x20d0('0x25')]=function(_0xe33c00,_0x33a9aa){if(_0xe33c00['body']['id']){delete _0xe33c00[_0x20d0('0x4c')]['id'];}return db[_0x20d0('0x2c')][_0x20d0('0x4a')]({'where':{'id':_0xe33c00['params']['id']}})[_0x20d0('0x27')](handleEntityNotFound(_0x33a9aa,null))[_0x20d0('0x27')](saveUpdates(_0xe33c00[_0x20d0('0x4c')],null))['then'](respondWithResult(_0x33a9aa,null))[_0x20d0('0x46')](handleError(_0x33a9aa,null));};exports[_0x20d0('0x26')]=function(_0x413294,_0x4a87a9){return db[_0x20d0('0x2c')]['find']({'where':{'id':_0x413294[_0x20d0('0x48')]['id']}})[_0x20d0('0x27')](handleEntityNotFound(_0x4a87a9,null))['then'](removeEntity(_0x4a87a9,null))['catch'](handleError(_0x4a87a9,null));};exports[_0x20d0('0x4d')]=function(_0x151b04,_0x1f5815,_0x1c50f3){var _0x14b07c={};var _0x465d49={};var _0x293219;var _0x49c39b;return db[_0x20d0('0x2c')][_0x20d0('0x4e')]({'where':{'id':_0x151b04[_0x20d0('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f5815,null))[_0x20d0('0x27')](function(_0x18a027){if(_0x18a027){_0x293219=_0x18a027;_0x465d49[_0x20d0('0x30')]=_[_0x20d0('0x34')](db[_0x20d0('0x4f')]['rawAttributes']);_0x465d49['query']=_['keys'](_0x151b04[_0x20d0('0x33')]);_0x465d49[_0x20d0('0x35')]=_['intersection'](_0x465d49[_0x20d0('0x30')],_0x465d49['query']);_0x14b07c[_0x20d0('0x37')]=_[_0x20d0('0x36')](_0x465d49[_0x20d0('0x30')],qs[_0x20d0('0x38')](_0x151b04['query'][_0x20d0('0x38')]));_0x14b07c['attributes']=_0x14b07c[_0x20d0('0x37')][_0x20d0('0x39')]?_0x14b07c['attributes']:_0x465d49[_0x20d0('0x30')];_0x14b07c[_0x20d0('0x3b')]=qs[_0x20d0('0x3c')](_0x151b04[_0x20d0('0x33')][_0x20d0('0x3c')]);_0x14b07c['where']=qs[_0x20d0('0x35')](_['pick'](_0x151b04['query'],_0x465d49['filters']));if(_0x151b04[_0x20d0('0x33')]['filter']){_0x14b07c['where']=_[_0x20d0('0x40')](_0x14b07c[_0x20d0('0x3d')],{'$or':_[_0x20d0('0x31')](_0x14b07c[_0x20d0('0x37')],function(_0x326032){var _0x49b67b={};_0x49b67b[_0x326032]={'$like':'%'+_0x151b04[_0x20d0('0x33')]['filter']+'%'};return _0x49b67b;})});}_0x14b07c=_['merge']({},_0x14b07c,_0x151b04[_0x20d0('0x42')]);return _0x293219[_0x20d0('0x4d')](_0x14b07c);}})['then'](function(_0x5735d4){if(_0x5735d4){_0x49c39b=_0x5735d4[_0x20d0('0x39')];if(!_0x151b04['query'][_0x20d0('0x3a')](_0x20d0('0x50'))){_0x14b07c[_0x20d0('0x1c')]=qs[_0x20d0('0x1c')](_0x151b04[_0x20d0('0x33')][_0x20d0('0x1c')]);_0x14b07c[_0x20d0('0x1a')]=qs['offset'](_0x151b04[_0x20d0('0x33')][_0x20d0('0x1a')]);}return _0x293219[_0x20d0('0x4d')](_0x14b07c);}})['then'](function(_0x2790de){if(_0x2790de){return _0x2790de?{'count':_0x49c39b,'rows':_0x2790de}:null;}})[_0x20d0('0x27')](respondWithResult(_0x1f5815,null))[_0x20d0('0x46')](handleError(_0x1f5815,null));};exports[_0x20d0('0x51')]=function(_0x55aad5,_0x40b050,_0x16420a){var _0x14e6ea={};var _0x3fa141={};var _0x22e36d;var _0x122c1e;return db[_0x20d0('0x2c')][_0x20d0('0x4e')]({'where':{'id':_0x55aad5['params']['id']}})[_0x20d0('0x27')](handleEntityNotFound(_0x40b050,null))[_0x20d0('0x27')](function(_0x58d53c){if(_0x58d53c){_0x22e36d=_0x58d53c;_0x3fa141[_0x20d0('0x30')]=_['keys'](db[_0x20d0('0x4f')][_0x20d0('0x2d')]);_0x3fa141[_0x20d0('0x33')]=_[_0x20d0('0x34')](_0x55aad5[_0x20d0('0x33')]);_0x3fa141[_0x20d0('0x35')]=_['intersection'](_0x3fa141[_0x20d0('0x30')],_0x3fa141[_0x20d0('0x33')]);_0x14e6ea[_0x20d0('0x37')]=_['intersection'](_0x3fa141[_0x20d0('0x30')],qs['fields'](_0x55aad5[_0x20d0('0x33')][_0x20d0('0x38')]));_0x14e6ea['attributes']=_0x14e6ea[_0x20d0('0x37')]['length']?_0x14e6ea[_0x20d0('0x37')]:_0x3fa141[_0x20d0('0x30')];_0x14e6ea['order']=qs['sort'](_0x55aad5['query']['sort']);_0x14e6ea[_0x20d0('0x3d')]=qs[_0x20d0('0x35')](_[_0x20d0('0x3e')](_0x55aad5['query'],_0x3fa141['filters']));if(_0x55aad5[_0x20d0('0x33')][_0x20d0('0x3f')]){_0x14e6ea['where']=_[_0x20d0('0x40')](_0x14e6ea[_0x20d0('0x3d')],{'$or':_[_0x20d0('0x31')](_0x14e6ea[_0x20d0('0x37')],function(_0x3485b1){var _0x5defe3={};_0x5defe3[_0x3485b1]={'$like':'%'+_0x55aad5[_0x20d0('0x33')]['filter']+'%'};return _0x5defe3;})});}_0x14e6ea=_[_0x20d0('0x40')]({},_0x14e6ea,_0x55aad5[_0x20d0('0x42')]);return _0x22e36d[_0x20d0('0x51')](_0x14e6ea);}})[_0x20d0('0x27')](function(_0xd12ed8){if(_0xd12ed8){_0x122c1e=_0xd12ed8['length'];if(!_0x55aad5[_0x20d0('0x33')][_0x20d0('0x3a')]('nolimit')){_0x14e6ea['limit']=qs[_0x20d0('0x1c')](_0x55aad5[_0x20d0('0x33')]['limit']);_0x14e6ea[_0x20d0('0x1a')]=qs[_0x20d0('0x1a')](_0x55aad5[_0x20d0('0x33')][_0x20d0('0x1a')]);}return _0x22e36d[_0x20d0('0x51')](_0x14e6ea);}})[_0x20d0('0x27')](function(_0x4dd449){if(_0x4dd449){return _0x4dd449?{'count':_0x122c1e,'rows':_0x4dd449}:null;}})['then'](respondWithResult(_0x40b050,null))[_0x20d0('0x46')](handleError(_0x40b050,null));};exports[_0x20d0('0x52')]=function(_0x897276,_0x2d87d7,_0x473b5){var _0x53bb92={};var _0x455a43={};var _0xe7efed;var _0x212c07;return db[_0x20d0('0x2c')][_0x20d0('0x4e')]({'where':{'id':_0x897276['params']['id']}})[_0x20d0('0x27')](handleEntityNotFound(_0x2d87d7,null))[_0x20d0('0x27')](function(_0x31e53a){if(_0x31e53a){_0xe7efed=_0x31e53a;_0x455a43[_0x20d0('0x30')]=_[_0x20d0('0x34')](db[_0x20d0('0x4f')][_0x20d0('0x2d')]);_0x455a43[_0x20d0('0x33')]=_[_0x20d0('0x34')](_0x897276[_0x20d0('0x33')]);_0x455a43[_0x20d0('0x35')]=_[_0x20d0('0x36')](_0x455a43['model'],_0x455a43[_0x20d0('0x33')]);_0x53bb92[_0x20d0('0x37')]=_[_0x20d0('0x36')](_0x455a43[_0x20d0('0x30')],qs['fields'](_0x897276[_0x20d0('0x33')][_0x20d0('0x38')]));_0x53bb92[_0x20d0('0x37')]=_0x53bb92[_0x20d0('0x37')][_0x20d0('0x39')]?_0x53bb92[_0x20d0('0x37')]:_0x455a43[_0x20d0('0x30')];_0x53bb92['order']=qs['sort'](_0x897276[_0x20d0('0x33')]['sort']);_0x53bb92['where']=qs[_0x20d0('0x35')](_[_0x20d0('0x3e')](_0x897276[_0x20d0('0x33')],_0x455a43['filters']));if(_0x897276[_0x20d0('0x33')][_0x20d0('0x3f')]){_0x53bb92[_0x20d0('0x3d')]=_[_0x20d0('0x40')](_0x53bb92[_0x20d0('0x3d')],{'$or':_[_0x20d0('0x31')](_0x53bb92['attributes'],function(_0x48143f){var _0x43b002={};_0x43b002[_0x48143f]={'$like':'%'+_0x897276[_0x20d0('0x33')]['filter']+'%'};return _0x43b002;})});}_0x53bb92=_[_0x20d0('0x40')]({},_0x53bb92,_0x897276[_0x20d0('0x42')]);return _0xe7efed['getDescriptions'](_0x53bb92);}})[_0x20d0('0x27')](function(_0x21532e){if(_0x21532e){_0x212c07=_0x21532e[_0x20d0('0x39')];if(!_0x897276[_0x20d0('0x33')][_0x20d0('0x3a')](_0x20d0('0x50'))){_0x53bb92[_0x20d0('0x1c')]=qs['limit'](_0x897276[_0x20d0('0x33')][_0x20d0('0x1c')]);_0x53bb92[_0x20d0('0x1a')]=qs[_0x20d0('0x1a')](_0x897276[_0x20d0('0x33')][_0x20d0('0x1a')]);}return _0xe7efed[_0x20d0('0x52')](_0x53bb92);}})[_0x20d0('0x27')](function(_0x90508a){if(_0x90508a){return _0x90508a?{'count':_0x212c07,'rows':_0x90508a}:null;}})[_0x20d0('0x27')](respondWithResult(_0x2d87d7,null))['catch'](handleError(_0x2d87d7,null));};exports[_0x20d0('0x53')]=function(_0x43f3f7,_0x174d59,_0x31fad6){var _0x2c2dd={};var _0x127d30={};var _0x181111;var _0x21be18;return db['FreshdeskConfiguration'][_0x20d0('0x4e')]({'where':{'id':_0x43f3f7[_0x20d0('0x48')]['id']}})['then'](handleEntityNotFound(_0x174d59,null))['then'](function(_0x21b10f){if(_0x21b10f){_0x181111=_0x21b10f;_0x127d30[_0x20d0('0x30')]=_[_0x20d0('0x34')](db[_0x20d0('0x54')][_0x20d0('0x2d')]);_0x127d30['query']=_[_0x20d0('0x34')](_0x43f3f7['query']);_0x127d30[_0x20d0('0x35')]=_[_0x20d0('0x36')](_0x127d30['model'],_0x127d30['query']);_0x2c2dd['attributes']=_[_0x20d0('0x36')](_0x127d30[_0x20d0('0x30')],qs[_0x20d0('0x38')](_0x43f3f7[_0x20d0('0x33')][_0x20d0('0x38')]));_0x2c2dd[_0x20d0('0x37')]=_0x2c2dd[_0x20d0('0x37')][_0x20d0('0x39')]?_0x2c2dd[_0x20d0('0x37')]:_0x127d30[_0x20d0('0x30')];_0x2c2dd[_0x20d0('0x3b')]=qs[_0x20d0('0x3c')](_0x43f3f7[_0x20d0('0x33')][_0x20d0('0x3c')]);_0x2c2dd[_0x20d0('0x3d')]=qs[_0x20d0('0x35')](_[_0x20d0('0x3e')](_0x43f3f7['query'],_0x127d30[_0x20d0('0x35')]));if(_0x43f3f7[_0x20d0('0x33')][_0x20d0('0x3f')]){_0x2c2dd[_0x20d0('0x3d')]=_[_0x20d0('0x40')](_0x2c2dd[_0x20d0('0x3d')],{'$or':_[_0x20d0('0x31')](_0x2c2dd[_0x20d0('0x37')],function(_0x1351d2){var _0x4c03c4={};_0x4c03c4[_0x1351d2]={'$like':'%'+_0x43f3f7[_0x20d0('0x33')][_0x20d0('0x3f')]+'%'};return _0x4c03c4;})});}_0x2c2dd=_['merge']({},_0x2c2dd,_0x43f3f7['options']);return _0x181111['getTags'](_0x2c2dd);}})[_0x20d0('0x27')](function(_0x1244c3){if(_0x1244c3){_0x21be18=_0x1244c3[_0x20d0('0x39')];if(!_0x43f3f7[_0x20d0('0x33')]['hasOwnProperty'](_0x20d0('0x50'))){_0x2c2dd[_0x20d0('0x1c')]=qs[_0x20d0('0x1c')](_0x43f3f7['query'][_0x20d0('0x1c')]);_0x2c2dd['offset']=qs[_0x20d0('0x1a')](_0x43f3f7['query'][_0x20d0('0x1a')]);}return _0x181111['getTags'](_0x2c2dd);}})['then'](function(_0x152e66){if(_0x152e66){return _0x152e66?{'count':_0x21be18,'rows':_0x152e66}:null;}})['then'](respondWithResult(_0x174d59,null))[_0x20d0('0x46')](handleError(_0x174d59,null));};exports[_0x20d0('0x55')]=function(_0x4bdbca,_0x55771f,_0x3f8a45){if(_0x4bdbca['body']['id']){delete _0x4bdbca[_0x20d0('0x4c')]['id'];}return db[_0x20d0('0x2c')]['findOne']({'where':{'id':_0x4bdbca['params']['id']}})[_0x20d0('0x27')](handleEntityNotFound(_0x55771f,null))['then'](function(_0x55399d){if(_0x55399d){return _0x55399d[_0x20d0('0x55')](_0x4bdbca[_0x20d0('0x4c')][_0x20d0('0x56')]||[]);}return null;})['then'](respondWithResult(_0x55771f,null))[_0x20d0('0x46')](handleError(_0x55771f,null));}; \ No newline at end of file +var _0x155d=['getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','pick','VIRTUAL','filter','merge','include','findAll','show','rawAttributes','options','find','create','body','params','catch','getFields','findOne','FreshdeskField','sort','where','hasOwnProperty','getSubjects','order'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x155d,0x1b7));var _0xd155=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x155d[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd155('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd155('0x1'));var rp=require(_0xd155('0x2'));var moment=require('moment');var BPromise=require(_0xd155('0x3'));var Mustache=require(_0xd155('0x4'));var util=require('util');var path=require(_0xd155('0x5'));var sox=require('sox');var csv=require(_0xd155('0x6'));var ejs=require(_0xd155('0x7'));var fs=require('fs');var fs_extra=require(_0xd155('0x8'));var _=require(_0xd155('0x9'));var squel=require(_0xd155('0xa'));var crypto=require(_0xd155('0xb'));var jsforce=require(_0xd155('0xc'));var deskjs=require(_0xd155('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd155('0xe'));var Papa=require(_0xd155('0xf'));var Redis=require(_0xd155('0x10'));var authService=require(_0xd155('0x11'));var qs=require(_0xd155('0x12'));var as=require(_0xd155('0x13'));var hardwareService=require(_0xd155('0x14'));var logger=require(_0xd155('0x15'))(_0xd155('0x16'));var utils=require(_0xd155('0x17'));var config=require(_0xd155('0x18'));var licenseUtil=require(_0xd155('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2255ee,_0x35ee57){_0x35ee57=_0x35ee57||0xcc;return function(_0x12cf84){if(_0x12cf84){return _0x2255ee[_0xd155('0x1a')](_0x35ee57);}return _0x2255ee[_0xd155('0x1b')](_0x35ee57)[_0xd155('0x1c')]();};}function respondWithResult(_0x2f92f7,_0x41d05a){_0x41d05a=_0x41d05a||0xc8;return function(_0x2a87b5){if(_0x2a87b5){return _0x2f92f7[_0xd155('0x1b')](_0x41d05a)[_0xd155('0x1d')](_0x2a87b5);}};}function respondWithFilteredResult(_0x17c1c2,_0x211452){return function(_0x2a44fd){if(_0x2a44fd){var _0x2bc1fc=typeof _0x211452[_0xd155('0x1e')]===_0xd155('0x1f')&&typeof _0x211452[_0xd155('0x20')]===_0xd155('0x1f');var _0x1ebcf8=_0x2a44fd[_0xd155('0x21')];var _0x5c1b63=_0x2bc1fc?0x0:_0x211452[_0xd155('0x1e')];var _0x278c1d=_0x2bc1fc?_0x2a44fd[_0xd155('0x21')]:_0x211452[_0xd155('0x1e')]+_0x211452[_0xd155('0x20')];var _0x2dd404;if(_0x278c1d>=_0x1ebcf8){_0x278c1d=_0x1ebcf8;_0x2dd404=0xc8;}else{_0x2dd404=0xce;}_0x17c1c2[_0xd155('0x1b')](_0x2dd404);return _0x17c1c2[_0xd155('0x22')](_0xd155('0x23'),_0x5c1b63+'-'+_0x278c1d+'/'+_0x1ebcf8)[_0xd155('0x1d')](_0x2a44fd);}return null;};}function patchUpdates(_0x1c70e4){return function(_0x4ea74d){try{jsonpatch[_0xd155('0x24')](_0x4ea74d,_0x1c70e4,!![]);}catch(_0x4fb205){return BPromise[_0xd155('0x25')](_0x4fb205);}return _0x4ea74d[_0xd155('0x26')]();};}function saveUpdates(_0x3909a2,_0x36b383){return function(_0x1edc15){if(_0x1edc15){return _0x1edc15[_0xd155('0x27')](_0x3909a2)[_0xd155('0x28')](function(_0x3ca4fe){return _0x3ca4fe;});}return null;};}function removeEntity(_0x56cff9,_0x310ea7){return function(_0x366e20){if(_0x366e20){return _0x366e20[_0xd155('0x29')]()['then'](function(){_0x56cff9[_0xd155('0x1b')](0xcc)[_0xd155('0x1c')]();});}};}function handleEntityNotFound(_0x20204e,_0x115d60){return function(_0x29c194){if(!_0x29c194){_0x20204e['sendStatus'](0x194);}return _0x29c194;};}function handleError(_0x1caa2e,_0x2a2fae){_0x2a2fae=_0x2a2fae||0x1f4;return function(_0x17d73c){logger[_0xd155('0x2a')](_0x17d73c[_0xd155('0x2b')]);if(_0x17d73c[_0xd155('0x2c')]){delete _0x17d73c[_0xd155('0x2c')];}_0x1caa2e[_0xd155('0x1b')](_0x2a2fae)[_0xd155('0x2d')](_0x17d73c);};}exports[_0xd155('0x2e')]=function(_0x30055a,_0x37d54f){var _0x5df736={},_0x2e3b1c={},_0x279606={'count':0x0,'rows':[]};var _0x3ab71c=_['map'](db[_0xd155('0x2f')]['rawAttributes'],function(_0x47f409){return{'name':_0x47f409[_0xd155('0x30')],'type':_0x47f409[_0xd155('0x31')][_0xd155('0x32')]};});_0x2e3b1c[_0xd155('0x33')]=_[_0xd155('0x34')](_0x3ab71c,_0xd155('0x2c'));_0x2e3b1c[_0xd155('0x35')]=_[_0xd155('0x36')](_0x30055a['query']);_0x2e3b1c[_0xd155('0x37')]=_['intersection'](_0x2e3b1c[_0xd155('0x33')],_0x2e3b1c[_0xd155('0x35')]);_0x5df736['attributes']=_[_0xd155('0x38')](_0x2e3b1c['model'],qs[_0xd155('0x39')](_0x30055a[_0xd155('0x35')][_0xd155('0x39')]));_0x5df736[_0xd155('0x3a')]=_0x5df736[_0xd155('0x3a')][_0xd155('0x3b')]?_0x5df736[_0xd155('0x3a')]:_0x2e3b1c[_0xd155('0x33')];if(!_0x30055a[_0xd155('0x35')]['hasOwnProperty'](_0xd155('0x3c'))){_0x5df736['limit']=qs['limit'](_0x30055a[_0xd155('0x35')][_0xd155('0x20')]);_0x5df736[_0xd155('0x1e')]=qs['offset'](_0x30055a[_0xd155('0x35')]['offset']);}_0x5df736['order']=qs['sort'](_0x30055a[_0xd155('0x35')]['sort']);_0x5df736['where']=qs[_0xd155('0x37')](_[_0xd155('0x3d')](_0x30055a['query'],_0x2e3b1c[_0xd155('0x37')]),_0x3ab71c);if(_0x30055a['query']['filter']){_0x5df736['where']=_['merge'](_0x5df736['where'],{'$or':_[_0xd155('0x34')](_0x3ab71c,function(_0x3b710e){if(_0x3b710e[_0xd155('0x31')]!==_0xd155('0x3e')){var _0x3e990b={};_0x3e990b[_0x3b710e['name']]={'$like':'%'+_0x30055a[_0xd155('0x35')][_0xd155('0x3f')]+'%'};return _0x3e990b;}})});}_0x5df736=_[_0xd155('0x40')]({},_0x5df736,_0x30055a['options']);var _0x30bb63={'where':_0x5df736['where']};return db[_0xd155('0x2f')][_0xd155('0x21')](_0x30bb63)[_0xd155('0x28')](function(_0x498570){_0x279606[_0xd155('0x21')]=_0x498570;if(_0x30055a[_0xd155('0x35')]['includeAll']){_0x5df736[_0xd155('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xd155('0x42')](_0x5df736);})[_0xd155('0x28')](function(_0x37e7bb){_0x279606['rows']=_0x37e7bb;return _0x279606;})[_0xd155('0x28')](respondWithFilteredResult(_0x37d54f,_0x5df736))['catch'](handleError(_0x37d54f,null));};exports[_0xd155('0x43')]=function(_0x20e630,_0x192de5){var _0x4ae063={'raw':![],'where':{'id':_0x20e630['params']['id']}},_0x1d1126={};_0x1d1126[_0xd155('0x33')]=_[_0xd155('0x36')](db[_0xd155('0x2f')][_0xd155('0x44')]);_0x1d1126['query']=_[_0xd155('0x36')](_0x20e630[_0xd155('0x35')]);_0x1d1126[_0xd155('0x37')]=_[_0xd155('0x38')](_0x1d1126[_0xd155('0x33')],_0x1d1126[_0xd155('0x35')]);_0x4ae063[_0xd155('0x3a')]=_[_0xd155('0x38')](_0x1d1126[_0xd155('0x33')],qs[_0xd155('0x39')](_0x20e630['query'][_0xd155('0x39')]));_0x4ae063['attributes']=_0x4ae063[_0xd155('0x3a')][_0xd155('0x3b')]?_0x4ae063[_0xd155('0x3a')]:_0x1d1126[_0xd155('0x33')];if(_0x20e630[_0xd155('0x35')]['includeAll']){_0x4ae063[_0xd155('0x41')]=[{'all':!![]}];}_0x4ae063=_[_0xd155('0x40')]({},_0x4ae063,_0x20e630[_0xd155('0x45')]);return db[_0xd155('0x2f')][_0xd155('0x46')](_0x4ae063)['then'](handleEntityNotFound(_0x192de5,null))[_0xd155('0x28')](respondWithResult(_0x192de5,null))['catch'](handleError(_0x192de5,null));};exports['create']=function(_0x3ed042,_0x3b72e2){return db['FreshdeskConfiguration'][_0xd155('0x47')](_0x3ed042[_0xd155('0x48')],{})[_0xd155('0x28')](respondWithResult(_0x3b72e2,0xc9))['catch'](handleError(_0x3b72e2,null));};exports[_0xd155('0x27')]=function(_0x29417b,_0x42eeb3){if(_0x29417b[_0xd155('0x48')]['id']){delete _0x29417b[_0xd155('0x48')]['id'];}return db[_0xd155('0x2f')][_0xd155('0x46')]({'where':{'id':_0x29417b[_0xd155('0x49')]['id']}})[_0xd155('0x28')](handleEntityNotFound(_0x42eeb3,null))[_0xd155('0x28')](saveUpdates(_0x29417b[_0xd155('0x48')],null))[_0xd155('0x28')](respondWithResult(_0x42eeb3,null))[_0xd155('0x4a')](handleError(_0x42eeb3,null));};exports['destroy']=function(_0x9ed1b4,_0x4e9acf){return db['FreshdeskConfiguration'][_0xd155('0x46')]({'where':{'id':_0x9ed1b4[_0xd155('0x49')]['id']}})[_0xd155('0x28')](handleEntityNotFound(_0x4e9acf,null))['then'](removeEntity(_0x4e9acf,null))[_0xd155('0x4a')](handleError(_0x4e9acf,null));};exports[_0xd155('0x4b')]=function(_0xdf1514,_0x5de10a,_0x38f50f){var _0x2222f6={};var _0xb063c6={};var _0x4a62ac;var _0x143083;return db[_0xd155('0x2f')][_0xd155('0x4c')]({'where':{'id':_0xdf1514[_0xd155('0x49')]['id']}})[_0xd155('0x28')](handleEntityNotFound(_0x5de10a,null))['then'](function(_0x50a2d5){if(_0x50a2d5){_0x4a62ac=_0x50a2d5;_0xb063c6['model']=_['keys'](db[_0xd155('0x4d')][_0xd155('0x44')]);_0xb063c6[_0xd155('0x35')]=_['keys'](_0xdf1514[_0xd155('0x35')]);_0xb063c6[_0xd155('0x37')]=_[_0xd155('0x38')](_0xb063c6['model'],_0xb063c6['query']);_0x2222f6[_0xd155('0x3a')]=_['intersection'](_0xb063c6[_0xd155('0x33')],qs[_0xd155('0x39')](_0xdf1514[_0xd155('0x35')][_0xd155('0x39')]));_0x2222f6['attributes']=_0x2222f6[_0xd155('0x3a')][_0xd155('0x3b')]?_0x2222f6[_0xd155('0x3a')]:_0xb063c6[_0xd155('0x33')];_0x2222f6['order']=qs[_0xd155('0x4e')](_0xdf1514['query'][_0xd155('0x4e')]);_0x2222f6[_0xd155('0x4f')]=qs[_0xd155('0x37')](_['pick'](_0xdf1514['query'],_0xb063c6['filters']));if(_0xdf1514[_0xd155('0x35')][_0xd155('0x3f')]){_0x2222f6[_0xd155('0x4f')]=_['merge'](_0x2222f6[_0xd155('0x4f')],{'$or':_['map'](_0x2222f6['attributes'],function(_0x4612a0){var _0x30ab51={};_0x30ab51[_0x4612a0]={'$like':'%'+_0xdf1514[_0xd155('0x35')][_0xd155('0x3f')]+'%'};return _0x30ab51;})});}_0x2222f6=_[_0xd155('0x40')]({},_0x2222f6,_0xdf1514[_0xd155('0x45')]);return _0x4a62ac[_0xd155('0x4b')](_0x2222f6);}})[_0xd155('0x28')](function(_0x2f11b0){if(_0x2f11b0){_0x143083=_0x2f11b0['length'];if(!_0xdf1514['query'][_0xd155('0x50')]('nolimit')){_0x2222f6[_0xd155('0x20')]=qs[_0xd155('0x20')](_0xdf1514[_0xd155('0x35')][_0xd155('0x20')]);_0x2222f6['offset']=qs[_0xd155('0x1e')](_0xdf1514[_0xd155('0x35')]['offset']);}return _0x4a62ac[_0xd155('0x4b')](_0x2222f6);}})[_0xd155('0x28')](function(_0x1a06b2){if(_0x1a06b2){return _0x1a06b2?{'count':_0x143083,'rows':_0x1a06b2}:null;}})[_0xd155('0x28')](respondWithResult(_0x5de10a,null))[_0xd155('0x4a')](handleError(_0x5de10a,null));};exports[_0xd155('0x51')]=function(_0x4444f3,_0xfc36ee,_0x4ca66a){var _0x2ad6d7={};var _0x482a79={};var _0x570a90;var _0x31b490;return db[_0xd155('0x2f')][_0xd155('0x4c')]({'where':{'id':_0x4444f3[_0xd155('0x49')]['id']}})[_0xd155('0x28')](handleEntityNotFound(_0xfc36ee,null))[_0xd155('0x28')](function(_0x4a6260){if(_0x4a6260){_0x570a90=_0x4a6260;_0x482a79[_0xd155('0x33')]=_['keys'](db[_0xd155('0x4d')][_0xd155('0x44')]);_0x482a79[_0xd155('0x35')]=_['keys'](_0x4444f3['query']);_0x482a79[_0xd155('0x37')]=_['intersection'](_0x482a79[_0xd155('0x33')],_0x482a79[_0xd155('0x35')]);_0x2ad6d7['attributes']=_['intersection'](_0x482a79[_0xd155('0x33')],qs['fields'](_0x4444f3[_0xd155('0x35')][_0xd155('0x39')]));_0x2ad6d7[_0xd155('0x3a')]=_0x2ad6d7[_0xd155('0x3a')][_0xd155('0x3b')]?_0x2ad6d7[_0xd155('0x3a')]:_0x482a79[_0xd155('0x33')];_0x2ad6d7[_0xd155('0x52')]=qs['sort'](_0x4444f3[_0xd155('0x35')][_0xd155('0x4e')]);_0x2ad6d7[_0xd155('0x4f')]=qs[_0xd155('0x37')](_['pick'](_0x4444f3[_0xd155('0x35')],_0x482a79[_0xd155('0x37')]));if(_0x4444f3[_0xd155('0x35')][_0xd155('0x3f')]){_0x2ad6d7[_0xd155('0x4f')]=_[_0xd155('0x40')](_0x2ad6d7[_0xd155('0x4f')],{'$or':_['map'](_0x2ad6d7[_0xd155('0x3a')],function(_0x514c54){var _0xab5546={};_0xab5546[_0x514c54]={'$like':'%'+_0x4444f3[_0xd155('0x35')][_0xd155('0x3f')]+'%'};return _0xab5546;})});}_0x2ad6d7=_[_0xd155('0x40')]({},_0x2ad6d7,_0x4444f3[_0xd155('0x45')]);return _0x570a90['getSubjects'](_0x2ad6d7);}})[_0xd155('0x28')](function(_0x52366c){if(_0x52366c){_0x31b490=_0x52366c['length'];if(!_0x4444f3['query']['hasOwnProperty'](_0xd155('0x3c'))){_0x2ad6d7['limit']=qs[_0xd155('0x20')](_0x4444f3['query'][_0xd155('0x20')]);_0x2ad6d7[_0xd155('0x1e')]=qs[_0xd155('0x1e')](_0x4444f3[_0xd155('0x35')]['offset']);}return _0x570a90[_0xd155('0x51')](_0x2ad6d7);}})['then'](function(_0x485b4e){if(_0x485b4e){return _0x485b4e?{'count':_0x31b490,'rows':_0x485b4e}:null;}})[_0xd155('0x28')](respondWithResult(_0xfc36ee,null))[_0xd155('0x4a')](handleError(_0xfc36ee,null));};exports[_0xd155('0x53')]=function(_0x567b14,_0x387651,_0x3dddcc){var _0x38a473={};var _0x550204={};var _0x1846de;var _0x26dd11;return db[_0xd155('0x2f')][_0xd155('0x4c')]({'where':{'id':_0x567b14[_0xd155('0x49')]['id']}})['then'](handleEntityNotFound(_0x387651,null))[_0xd155('0x28')](function(_0x39d095){if(_0x39d095){_0x1846de=_0x39d095;_0x550204[_0xd155('0x33')]=_[_0xd155('0x36')](db[_0xd155('0x4d')]['rawAttributes']);_0x550204[_0xd155('0x35')]=_[_0xd155('0x36')](_0x567b14[_0xd155('0x35')]);_0x550204[_0xd155('0x37')]=_[_0xd155('0x38')](_0x550204['model'],_0x550204[_0xd155('0x35')]);_0x38a473[_0xd155('0x3a')]=_[_0xd155('0x38')](_0x550204[_0xd155('0x33')],qs['fields'](_0x567b14[_0xd155('0x35')][_0xd155('0x39')]));_0x38a473[_0xd155('0x3a')]=_0x38a473[_0xd155('0x3a')][_0xd155('0x3b')]?_0x38a473[_0xd155('0x3a')]:_0x550204['model'];_0x38a473[_0xd155('0x52')]=qs[_0xd155('0x4e')](_0x567b14[_0xd155('0x35')][_0xd155('0x4e')]);_0x38a473[_0xd155('0x4f')]=qs[_0xd155('0x37')](_[_0xd155('0x3d')](_0x567b14[_0xd155('0x35')],_0x550204[_0xd155('0x37')]));if(_0x567b14[_0xd155('0x35')][_0xd155('0x3f')]){_0x38a473[_0xd155('0x4f')]=_[_0xd155('0x40')](_0x38a473[_0xd155('0x4f')],{'$or':_[_0xd155('0x34')](_0x38a473[_0xd155('0x3a')],function(_0x2daee4){var _0x51b84c={};_0x51b84c[_0x2daee4]={'$like':'%'+_0x567b14[_0xd155('0x35')][_0xd155('0x3f')]+'%'};return _0x51b84c;})});}_0x38a473=_[_0xd155('0x40')]({},_0x38a473,_0x567b14[_0xd155('0x45')]);return _0x1846de[_0xd155('0x53')](_0x38a473);}})[_0xd155('0x28')](function(_0x23e199){if(_0x23e199){_0x26dd11=_0x23e199[_0xd155('0x3b')];if(!_0x567b14[_0xd155('0x35')][_0xd155('0x50')](_0xd155('0x3c'))){_0x38a473['limit']=qs['limit'](_0x567b14[_0xd155('0x35')][_0xd155('0x20')]);_0x38a473[_0xd155('0x1e')]=qs['offset'](_0x567b14['query']['offset']);}return _0x1846de[_0xd155('0x53')](_0x38a473);}})[_0xd155('0x28')](function(_0x99139){if(_0x99139){return _0x99139?{'count':_0x26dd11,'rows':_0x99139}:null;}})['then'](respondWithResult(_0x387651,null))[_0xd155('0x4a')](handleError(_0x387651,null));};exports[_0xd155('0x54')]=function(_0xd5df3,_0x5a4da7,_0x4cdf84){var _0x35cb89={};var _0x36b54c={};var _0x466fee;var _0x5493e8;return db['FreshdeskConfiguration'][_0xd155('0x4c')]({'where':{'id':_0xd5df3[_0xd155('0x49')]['id']}})[_0xd155('0x28')](handleEntityNotFound(_0x5a4da7,null))[_0xd155('0x28')](function(_0x32dbac){if(_0x32dbac){_0x466fee=_0x32dbac;_0x36b54c[_0xd155('0x33')]=_[_0xd155('0x36')](db['Tag']['rawAttributes']);_0x36b54c[_0xd155('0x35')]=_[_0xd155('0x36')](_0xd5df3['query']);_0x36b54c[_0xd155('0x37')]=_['intersection'](_0x36b54c[_0xd155('0x33')],_0x36b54c[_0xd155('0x35')]);_0x35cb89['attributes']=_[_0xd155('0x38')](_0x36b54c['model'],qs[_0xd155('0x39')](_0xd5df3['query'][_0xd155('0x39')]));_0x35cb89[_0xd155('0x3a')]=_0x35cb89['attributes']['length']?_0x35cb89[_0xd155('0x3a')]:_0x36b54c['model'];_0x35cb89['order']=qs[_0xd155('0x4e')](_0xd5df3[_0xd155('0x35')]['sort']);_0x35cb89[_0xd155('0x4f')]=qs[_0xd155('0x37')](_[_0xd155('0x3d')](_0xd5df3[_0xd155('0x35')],_0x36b54c['filters']));if(_0xd5df3['query'][_0xd155('0x3f')]){_0x35cb89['where']=_[_0xd155('0x40')](_0x35cb89['where'],{'$or':_['map'](_0x35cb89[_0xd155('0x3a')],function(_0x4ac29b){var _0x20772e={};_0x20772e[_0x4ac29b]={'$like':'%'+_0xd5df3[_0xd155('0x35')][_0xd155('0x3f')]+'%'};return _0x20772e;})});}_0x35cb89=_['merge']({},_0x35cb89,_0xd5df3['options']);return _0x466fee[_0xd155('0x54')](_0x35cb89);}})[_0xd155('0x28')](function(_0x1667c9){if(_0x1667c9){_0x5493e8=_0x1667c9[_0xd155('0x3b')];if(!_0xd5df3[_0xd155('0x35')]['hasOwnProperty']('nolimit')){_0x35cb89[_0xd155('0x20')]=qs['limit'](_0xd5df3[_0xd155('0x35')][_0xd155('0x20')]);_0x35cb89[_0xd155('0x1e')]=qs['offset'](_0xd5df3[_0xd155('0x35')][_0xd155('0x1e')]);}return _0x466fee[_0xd155('0x54')](_0x35cb89);}})[_0xd155('0x28')](function(_0x25fd8c){if(_0x25fd8c){return _0x25fd8c?{'count':_0x5493e8,'rows':_0x25fd8c}:null;}})[_0xd155('0x28')](respondWithResult(_0x5a4da7,null))['catch'](handleError(_0x5a4da7,null));};exports[_0xd155('0x55')]=function(_0xa16bca,_0x2a8529,_0x46ac2c){if(_0xa16bca[_0xd155('0x48')]['id']){delete _0xa16bca['body']['id'];}return db[_0xd155('0x2f')][_0xd155('0x4c')]({'where':{'id':_0xa16bca[_0xd155('0x49')]['id']}})[_0xd155('0x28')](handleEntityNotFound(_0x2a8529,null))[_0xd155('0x28')](function(_0x50e469){if(_0x50e469){return _0x50e469['setTags'](_0xa16bca[_0xd155('0x48')][_0xd155('0x56')]||[]);}return null;})['then'](respondWithResult(_0x2a8529,null))['catch'](handleError(_0x2a8529,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 571c912..248e914 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 _0x1aa2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','int_freshdesk_configurations'];(function(_0x32fe62,_0xb26880){var _0x3a441a=function(_0xf75257){while(--_0xf75257){_0x32fe62['push'](_0x32fe62['shift']());}};_0x3a441a(++_0xb26880);}(_0x1aa2,0x6e));var _0x21aa=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x1aa2[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0x21aa('0x0'));var util=require(_0x21aa('0x1'));var logger=require(_0x21aa('0x2'))(_0x21aa('0x3'));var moment=require(_0x21aa('0x4'));var BPromise=require('bluebird');var rp=require(_0x21aa('0x5'));var fs=require('fs');var path=require(_0x21aa('0x6'));var rimraf=require(_0x21aa('0x7'));var config=require('../../config/environment');var attributes=require(_0x21aa('0x8'));module[_0x21aa('0x9')]=function(_0x10d288,_0x184c80){return _0x10d288['define']('FreshdeskConfiguration',attributes,{'tableName':_0x21aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d68=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','request-promise','path','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0d68,0xdc));var _0x80d6=function(_0x58622,_0xb8f0a5){_0x58622=_0x58622-0x0;var _0x56e713=_0x0d68[_0x58622];return _0x56e713;};'use strict';var _=require(_0x80d6('0x0'));var util=require('util');var logger=require(_0x80d6('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x80d6('0x2'));var fs=require('fs');var path=require(_0x80d6('0x3'));var rimraf=require('rimraf');var config=require(_0x80d6('0x4'));var attributes=require(_0x80d6('0x5'));module['exports']=function(_0x146efa,_0x1e21df){return _0x146efa[_0x80d6('0x6')](_0x80d6('0x7'),attributes,{'tableName':_0x80d6('0x8'),'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 21ae239..063e2bf 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 _0xe9cd=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x6b050a,_0xbdbd75){var _0x2b2e98=function(_0x506ae2){while(--_0x506ae2){_0x6b050a['push'](_0x6b050a['shift']());}};_0x2b2e98(++_0xbdbd75);}(_0xe9cd,0xfd));var _0xde9c=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe9cd[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xde9c('0x0'));var util=require(_0xde9c('0x1'));var moment=require(_0xde9c('0x2'));var BPromise=require(_0xde9c('0x3'));var rs=require(_0xde9c('0x4'));var fs=require('fs');var Redis=require(_0xde9c('0x5'));var db=require(_0xde9c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xde9c('0x7'))(_0xde9c('0x8'));var config=require(_0xde9c('0x9'));var jayson=require(_0xde9c('0xa'));var client=jayson['client'][_0xde9c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab130,_0x2c76ee,_0x6270d9){return new BPromise(function(_0x3bafbd,_0x4e6ac3){return client[_0xde9c('0xc')](_0x5ab130,_0x6270d9)[_0xde9c('0xd')](function(_0x37e369){logger[_0xde9c('0xe')](_0xde9c('0xf'),_0x2c76ee,_0xde9c('0x10'));logger[_0xde9c('0x11')](_0xde9c('0x12'),_0x2c76ee,_0xde9c('0x10'),JSON[_0xde9c('0x13')](_0x37e369));if(_0x37e369[_0xde9c('0x14')]){if(_0x37e369['error'][_0xde9c('0x15')]===0x1f4){logger[_0xde9c('0x14')](_0xde9c('0xf'),_0x2c76ee,_0x37e369[_0xde9c('0x14')][_0xde9c('0x16')]);return _0x4e6ac3(_0x37e369[_0xde9c('0x14')]['message']);}logger[_0xde9c('0x14')](_0xde9c('0xf'),_0x2c76ee,_0x37e369[_0xde9c('0x14')][_0xde9c('0x16')]);return _0x3bafbd(_0x37e369[_0xde9c('0x14')][_0xde9c('0x16')]);}else{logger['info'](_0xde9c('0xf'),_0x2c76ee,_0xde9c('0x10'));_0x3bafbd(_0x37e369[_0xde9c('0x17')]['message']);}})[_0xde9c('0x18')](function(_0x4f0880){logger[_0xde9c('0x14')](_0xde9c('0xf'),_0x2c76ee,_0x4f0880);_0x4e6ac3(_0x4f0880);});});} \ No newline at end of file +var _0xaa2e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash'];(function(_0x50c1e6,_0x32372b){var _0xe79388=function(_0x1dacc8){while(--_0x1dacc8){_0x50c1e6['push'](_0x50c1e6['shift']());}};_0xe79388(++_0x32372b);}(_0xaa2e,0x107));var _0xeaa2=function(_0x47c190,_0x26d079){_0x47c190=_0x47c190-0x0;var _0x43acc2=_0xaa2e[_0x47c190];return _0x43acc2;};'use strict';var _=require(_0xeaa2('0x0'));var util=require(_0xeaa2('0x1'));var moment=require(_0xeaa2('0x2'));var BPromise=require(_0xeaa2('0x3'));var rs=require(_0xeaa2('0x4'));var fs=require('fs');var Redis=require(_0xeaa2('0x5'));var db=require(_0xeaa2('0x6'))['db'];var utils=require(_0xeaa2('0x7'));var logger=require(_0xeaa2('0x8'))('rpc');var config=require(_0xeaa2('0x9'));var jayson=require(_0xeaa2('0xa'));var client=jayson[_0xeaa2('0xb')][_0xeaa2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e97cd,_0x1e35fc,_0x3821ee){return new BPromise(function(_0x232b49,_0x547402){return client[_0xeaa2('0xd')](_0x2e97cd,_0x3821ee)[_0xeaa2('0xe')](function(_0x48157d){logger[_0xeaa2('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e35fc,_0xeaa2('0x10'));logger[_0xeaa2('0x11')](_0xeaa2('0x12'),_0x1e35fc,'request\x20sent',JSON['stringify'](_0x48157d));if(_0x48157d[_0xeaa2('0x13')]){if(_0x48157d[_0xeaa2('0x13')][_0xeaa2('0x14')]===0x1f4){logger[_0xeaa2('0x13')](_0xeaa2('0x15'),_0x1e35fc,_0x48157d[_0xeaa2('0x13')][_0xeaa2('0x16')]);return _0x547402(_0x48157d[_0xeaa2('0x13')][_0xeaa2('0x16')]);}logger[_0xeaa2('0x13')](_0xeaa2('0x15'),_0x1e35fc,_0x48157d[_0xeaa2('0x13')][_0xeaa2('0x16')]);return _0x232b49(_0x48157d[_0xeaa2('0x13')][_0xeaa2('0x16')]);}else{logger['info'](_0xeaa2('0x15'),_0x1e35fc,_0xeaa2('0x10'));_0x232b49(_0x48157d[_0xeaa2('0x17')][_0xeaa2('0x16')]);}})['catch'](function(_0x31e561){logger[_0xeaa2('0x13')](_0xeaa2('0x15'),_0x1e35fc,_0x31e561);_0x547402(_0x31e561);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f04cc35..179956f 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 _0xd556=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index'];(function(_0x45ca67,_0x5da408){var _0x2ecfe8=function(_0x45b982){while(--_0x45b982){_0x45ca67['push'](_0x45ca67['shift']());}};_0x2ecfe8(++_0x5da408);}(_0xd556,0xd1));var _0x6d55=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd556[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x6d55('0x0'));var util=require(_0x6d55('0x1'));var path=require(_0x6d55('0x2'));var timeout=require(_0x6d55('0x3'));var express=require('express');var router=express[_0x6d55('0x4')]();var fs_extra=require(_0x6d55('0x5'));var auth=require(_0x6d55('0x6'));var interaction=require(_0x6d55('0x7'));var config=require('../../config/environment');var controller=require(_0x6d55('0x8'));router[_0x6d55('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d55('0xa')]);router[_0x6d55('0x9')](_0x6d55('0xb'),auth[_0x6d55('0xc')](),controller[_0x6d55('0xd')]);router[_0x6d55('0xe')]('/',auth[_0x6d55('0xc')](),controller['create']);router[_0x6d55('0xf')]('/:id',auth[_0x6d55('0xc')](),controller[_0x6d55('0x10')]);router[_0x6d55('0x11')]('/:id',auth[_0x6d55('0xc')](),controller[_0x6d55('0x12')]);module[_0x6d55('0x13')]=router; \ No newline at end of file +var _0x4d6a=['express','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3bdac8,_0x468be4){var _0x37a4f8=function(_0x58a238){while(--_0x58a238){_0x3bdac8['push'](_0x3bdac8['shift']());}};_0x37a4f8(++_0x468be4);}(_0x4d6a,0x1c8));var _0xa4d6=function(_0x1515e2,_0x375e7e){_0x1515e2=_0x1515e2-0x0;var _0x4bee5c=_0x4d6a[_0x1515e2];return _0x4bee5c;};'use strict';var multer=require(_0xa4d6('0x0'));var util=require(_0xa4d6('0x1'));var path=require(_0xa4d6('0x2'));var timeout=require(_0xa4d6('0x3'));var express=require(_0xa4d6('0x4'));var router=express['Router']();var fs_extra=require(_0xa4d6('0x5'));var auth=require(_0xa4d6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4d6('0x7'));router[_0xa4d6('0x8')]('/',auth[_0xa4d6('0x9')](),controller[_0xa4d6('0xa')]);router[_0xa4d6('0x8')]('/:id',auth[_0xa4d6('0x9')](),controller[_0xa4d6('0xb')]);router[_0xa4d6('0xc')]('/',auth[_0xa4d6('0x9')](),controller[_0xa4d6('0xd')]);router[_0xa4d6('0xe')](_0xa4d6('0xf'),auth['isAuthenticated'](),controller[_0xa4d6('0x10')]);router[_0xa4d6('0x11')](_0xa4d6('0xf'),auth[_0xa4d6('0x9')](),controller[_0xa4d6('0x12')]);module[_0xa4d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 59df11e..2f405ea 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 _0xb7f3=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','variable'];(function(_0x46aa81,_0x47ad46){var _0x2d5924=function(_0x5b7681){while(--_0x5b7681){_0x46aa81['push'](_0x46aa81['shift']());}};_0x2d5924(++_0x47ad46);}(_0xb7f3,0x12c));var _0x3b7f=function(_0x458c9b,_0x329529){_0x458c9b=_0x458c9b-0x0;var _0x1e83b6=_0xb7f3[_0x458c9b];return _0x1e83b6;};'use strict';var Sequelize=require(_0x3b7f('0x0'));module[_0x3b7f('0x1')]={'type':{'type':Sequelize[_0x3b7f('0x2')]('string',_0x3b7f('0x3'),'customVariable',_0x3b7f('0x4'),_0x3b7f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3b7f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3b7f('0x2')]('string',_0x3b7f('0x3'),_0x3b7f('0x7'))},'keyContent':{'type':Sequelize[_0x3b7f('0x6')]},'idField':{'type':Sequelize[_0x3b7f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b7f('0x6')]}}; \ No newline at end of file +var _0x230b=['STRING','customVariable','sequelize','ENUM','variable','picklist','string'];(function(_0x21a499,_0x4e59ae){var _0x168908=function(_0x2deec0){while(--_0x2deec0){_0x21a499['push'](_0x21a499['shift']());}};_0x168908(++_0x4e59ae);}(_0x230b,0x13d));var _0xb230=function(_0x44ff74,_0x5bdd96){_0x44ff74=_0x44ff74-0x0;var _0x2f9c9f=_0x230b[_0x44ff74];return _0x2f9c9f;};'use strict';var Sequelize=require(_0xb230('0x0'));module['exports']={'type':{'type':Sequelize[_0xb230('0x1')]('string',_0xb230('0x2'),'customVariable','keyValue',_0xb230('0x3')),'defaultValue':_0xb230('0x4')},'content':{'type':Sequelize[_0xb230('0x5')]},'key':{'type':Sequelize[_0xb230('0x5')]},'keyType':{'type':Sequelize[_0xb230('0x1')](_0xb230('0x4'),_0xb230('0x2'),_0xb230('0x6'))},'keyContent':{'type':Sequelize[_0xb230('0x5')]},'idField':{'type':Sequelize[_0xb230('0x5')]},'nameField':{'type':Sequelize[_0xb230('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'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 708b3ec..37d29b7 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 _0x8ce3=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','FreshdeskField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x8ce3,0xc3));var _0x38ce=function(_0xf244e0,_0x20556c){_0xf244e0=_0xf244e0-0x0;var _0xe94095=_0x8ce3[_0xf244e0];return _0xe94095;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x43b479,_0x5b330c){return function(_0x4a7e8e){if(!_0x4a7e8e){_0x43b479[_0x38ce('0x1b')](0x194);}return _0x4a7e8e;};}function handleError(_0x28ab4c,_0x142d72){_0x142d72=_0x142d72||0x1f4;return function(_0x21d4e7){logger[_0x38ce('0x2b')](_0x21d4e7[_0x38ce('0x2c')]);if(_0x21d4e7[_0x38ce('0x2d')]){delete _0x21d4e7[_0x38ce('0x2d')];}_0x28ab4c[_0x38ce('0x1c')](_0x142d72)[_0x38ce('0x2e')](_0x21d4e7);};}exports[_0x38ce('0x2f')]=function(_0x381703,_0x50692a){var _0x1212dd={},_0x1538a0={},_0x5b4a7a={'count':0x0,'rows':[]};var _0x229ac2=_[_0x38ce('0x30')](db['FreshdeskField'][_0x38ce('0x31')],function(_0x282ee4){return{'name':_0x282ee4['fieldName'],'type':_0x282ee4[_0x38ce('0x32')]['key']};});_0x1538a0[_0x38ce('0x33')]=_[_0x38ce('0x30')](_0x229ac2,_0x38ce('0x2d'));_0x1538a0[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x381703[_0x38ce('0x34')]);_0x1538a0[_0x38ce('0x36')]=_[_0x38ce('0x37')](_0x1538a0['model'],_0x1538a0['query']);_0x1212dd[_0x38ce('0x38')]=_[_0x38ce('0x37')](_0x1538a0[_0x38ce('0x33')],qs[_0x38ce('0x39')](_0x381703[_0x38ce('0x34')]['fields']));_0x1212dd[_0x38ce('0x38')]=_0x1212dd[_0x38ce('0x38')][_0x38ce('0x3a')]?_0x1212dd[_0x38ce('0x38')]:_0x1538a0[_0x38ce('0x33')];if(!_0x381703[_0x38ce('0x34')][_0x38ce('0x3b')]('nolimit')){_0x1212dd[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0x381703['query'][_0x38ce('0x20')]);_0x1212dd[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0x381703[_0x38ce('0x34')][_0x38ce('0x1f')]);}_0x1212dd[_0x38ce('0x3c')]=qs[_0x38ce('0x3d')](_0x381703[_0x38ce('0x34')]['sort']);_0x1212dd[_0x38ce('0x3e')]=qs[_0x38ce('0x36')](_[_0x38ce('0x3f')](_0x381703[_0x38ce('0x34')],_0x1538a0['filters']),_0x229ac2);if(_0x381703[_0x38ce('0x34')]['filter']){_0x1212dd[_0x38ce('0x3e')]=_[_0x38ce('0x40')](_0x1212dd[_0x38ce('0x3e')],{'$or':_[_0x38ce('0x30')](_0x229ac2,function(_0x43d629){if(_0x43d629[_0x38ce('0x32')]!=='VIRTUAL'){var _0x1c3fd5={};_0x1c3fd5[_0x43d629['name']]={'$like':'%'+_0x381703[_0x38ce('0x34')][_0x38ce('0x41')]+'%'};return _0x1c3fd5;}})});}_0x1212dd=_[_0x38ce('0x40')]({},_0x1212dd,_0x381703[_0x38ce('0x42')]);var _0x277e94={'where':_0x1212dd[_0x38ce('0x3e')]};return db['FreshdeskField'][_0x38ce('0x22')](_0x277e94)[_0x38ce('0x29')](function(_0x318ff8){_0x5b4a7a[_0x38ce('0x22')]=_0x318ff8;if(_0x381703[_0x38ce('0x34')][_0x38ce('0x43')]){_0x1212dd['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x38ce('0x44')](_0x1212dd);})[_0x38ce('0x29')](function(_0x174c86){_0x5b4a7a[_0x38ce('0x45')]=_0x174c86;return _0x5b4a7a;})[_0x38ce('0x29')](respondWithFilteredResult(_0x50692a,_0x1212dd))[_0x38ce('0x46')](handleError(_0x50692a,null));};exports[_0x38ce('0x47')]=function(_0x570a3d,_0x43b4fc){var _0x30cfe3={'raw':!![],'where':{'id':_0x570a3d[_0x38ce('0x48')]['id']}},_0x5a689b={};_0x5a689b[_0x38ce('0x33')]=_[_0x38ce('0x35')](db['FreshdeskField'][_0x38ce('0x31')]);_0x5a689b[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x570a3d[_0x38ce('0x34')]);_0x5a689b[_0x38ce('0x36')]=_[_0x38ce('0x37')](_0x5a689b['model'],_0x5a689b[_0x38ce('0x34')]);_0x30cfe3[_0x38ce('0x38')]=_[_0x38ce('0x37')](_0x5a689b[_0x38ce('0x33')],qs[_0x38ce('0x39')](_0x570a3d[_0x38ce('0x34')]['fields']));_0x30cfe3[_0x38ce('0x38')]=_0x30cfe3[_0x38ce('0x38')]['length']?_0x30cfe3['attributes']:_0x5a689b['model'];if(_0x570a3d[_0x38ce('0x34')][_0x38ce('0x43')]){_0x30cfe3['include']=[{'all':!![]}];}_0x30cfe3=_['merge']({},_0x30cfe3,_0x570a3d[_0x38ce('0x42')]);return db['FreshdeskField'][_0x38ce('0x49')](_0x30cfe3)['then'](handleEntityNotFound(_0x43b4fc,null))[_0x38ce('0x29')](respondWithResult(_0x43b4fc,null))[_0x38ce('0x46')](handleError(_0x43b4fc,null));};exports['create']=function(_0x1d9ef8,_0x17a8cf){return db['FreshdeskField'][_0x38ce('0x4a')](_0x1d9ef8[_0x38ce('0x4b')],{})[_0x38ce('0x29')](respondWithResult(_0x17a8cf,0xc9))[_0x38ce('0x46')](handleError(_0x17a8cf,null));};exports[_0x38ce('0x28')]=function(_0x25a299,_0x58cc6f){if(_0x25a299[_0x38ce('0x4b')]['id']){delete _0x25a299[_0x38ce('0x4b')]['id'];}return db['FreshdeskField'][_0x38ce('0x49')]({'where':{'id':_0x25a299[_0x38ce('0x48')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x58cc6f,null))[_0x38ce('0x29')](saveUpdates(_0x25a299[_0x38ce('0x4b')],null))[_0x38ce('0x29')](respondWithResult(_0x58cc6f,null))[_0x38ce('0x46')](handleError(_0x58cc6f,null));};exports['destroy']=function(_0x3e1522,_0x34a118){return db[_0x38ce('0x4c')][_0x38ce('0x49')]({'where':{'id':_0x3e1522[_0x38ce('0x48')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x34a118,null))['then'](removeEntity(_0x34a118,null))['catch'](handleError(_0x34a118,null));}; \ No newline at end of file +var _0xbf6e=['rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','FreshdeskField','includeAll','include','rows','catch','show','keys','intersection','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map'];(function(_0x4ecbea,_0x3fde83){var _0x24fd84=function(_0x46cab3){while(--_0x46cab3){_0x4ecbea['push'](_0x4ecbea['shift']());}};_0x24fd84(++_0x3fde83);}(_0xbf6e,0x149));var _0xebf6=function(_0x18226e,_0x4c502e){_0x18226e=_0x18226e-0x0;var _0x59d69c=_0xbf6e[_0x18226e];return _0x59d69c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x1534b2,_0x3b58cb){return function(_0x4dadf7){if(!_0x4dadf7){_0x1534b2['sendStatus'](0x194);}return _0x4dadf7;};}function handleError(_0x2605a2,_0x4dc5be){_0x4dc5be=_0x4dc5be||0x1f4;return function(_0x230d84){logger[_0xebf6('0x29')](_0x230d84['stack']);if(_0x230d84['name']){delete _0x230d84[_0xebf6('0x2a')];}_0x2605a2[_0xebf6('0x1a')](_0x4dc5be)[_0xebf6('0x2b')](_0x230d84);};}exports[_0xebf6('0x2c')]=function(_0xedaaeb,_0x2dc0cf){var _0x7976d={},_0x7551ce={},_0x4c3495={'count':0x0,'rows':[]};var _0x37cd67=_[_0xebf6('0x2d')](db['FreshdeskField'][_0xebf6('0x2e')],function(_0x28bbea){return{'name':_0x28bbea['fieldName'],'type':_0x28bbea[_0xebf6('0x2f')][_0xebf6('0x30')]};});_0x7551ce[_0xebf6('0x31')]=_[_0xebf6('0x2d')](_0x37cd67,_0xebf6('0x2a'));_0x7551ce[_0xebf6('0x32')]=_['keys'](_0xedaaeb[_0xebf6('0x32')]);_0x7551ce[_0xebf6('0x33')]=_['intersection'](_0x7551ce['model'],_0x7551ce[_0xebf6('0x32')]);_0x7976d[_0xebf6('0x34')]=_['intersection'](_0x7551ce[_0xebf6('0x31')],qs[_0xebf6('0x35')](_0xedaaeb['query'][_0xebf6('0x35')]));_0x7976d[_0xebf6('0x34')]=_0x7976d[_0xebf6('0x34')]['length']?_0x7976d[_0xebf6('0x34')]:_0x7551ce[_0xebf6('0x31')];if(!_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x36')]('nolimit')){_0x7976d['limit']=qs[_0xebf6('0x1f')](_0xedaaeb[_0xebf6('0x32')]['limit']);_0x7976d[_0xebf6('0x1d')]=qs[_0xebf6('0x1d')](_0xedaaeb['query'][_0xebf6('0x1d')]);}_0x7976d[_0xebf6('0x37')]=qs[_0xebf6('0x38')](_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x38')]);_0x7976d['where']=qs[_0xebf6('0x33')](_['pick'](_0xedaaeb[_0xebf6('0x32')],_0x7551ce['filters']),_0x37cd67);if(_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x39')]){_0x7976d[_0xebf6('0x3a')]=_[_0xebf6('0x3b')](_0x7976d[_0xebf6('0x3a')],{'$or':_[_0xebf6('0x2d')](_0x37cd67,function(_0x5eb1ea){if(_0x5eb1ea[_0xebf6('0x2f')]!==_0xebf6('0x3c')){var _0x3cd9a0={};_0x3cd9a0[_0x5eb1ea[_0xebf6('0x2a')]]={'$like':'%'+_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x39')]+'%'};return _0x3cd9a0;}})});}_0x7976d=_['merge']({},_0x7976d,_0xedaaeb[_0xebf6('0x3d')]);var _0x2782a5={'where':_0x7976d[_0xebf6('0x3a')]};return db[_0xebf6('0x3e')][_0xebf6('0x20')](_0x2782a5)[_0xebf6('0x27')](function(_0x4887a8){_0x4c3495['count']=_0x4887a8;if(_0xedaaeb['query'][_0xebf6('0x3f')]){_0x7976d[_0xebf6('0x40')]=[{'all':!![]}];}return db[_0xebf6('0x3e')]['findAll'](_0x7976d);})[_0xebf6('0x27')](function(_0x1c3809){_0x4c3495[_0xebf6('0x41')]=_0x1c3809;return _0x4c3495;})['then'](respondWithFilteredResult(_0x2dc0cf,_0x7976d))[_0xebf6('0x42')](handleError(_0x2dc0cf,null));};exports[_0xebf6('0x43')]=function(_0x53ccc8,_0x3813a5){var _0x1de50e={'raw':!![],'where':{'id':_0x53ccc8['params']['id']}},_0x17c4af={};_0x17c4af[_0xebf6('0x31')]=_['keys'](db['FreshdeskField'][_0xebf6('0x2e')]);_0x17c4af[_0xebf6('0x32')]=_[_0xebf6('0x44')](_0x53ccc8[_0xebf6('0x32')]);_0x17c4af['filters']=_[_0xebf6('0x45')](_0x17c4af['model'],_0x17c4af[_0xebf6('0x32')]);_0x1de50e[_0xebf6('0x34')]=_[_0xebf6('0x45')](_0x17c4af[_0xebf6('0x31')],qs[_0xebf6('0x35')](_0x53ccc8['query']['fields']));_0x1de50e[_0xebf6('0x34')]=_0x1de50e[_0xebf6('0x34')][_0xebf6('0x46')]?_0x1de50e[_0xebf6('0x34')]:_0x17c4af['model'];if(_0x53ccc8[_0xebf6('0x32')][_0xebf6('0x3f')]){_0x1de50e[_0xebf6('0x40')]=[{'all':!![]}];}_0x1de50e=_[_0xebf6('0x3b')]({},_0x1de50e,_0x53ccc8[_0xebf6('0x3d')]);return db[_0xebf6('0x3e')][_0xebf6('0x47')](_0x1de50e)['then'](handleEntityNotFound(_0x3813a5,null))[_0xebf6('0x27')](respondWithResult(_0x3813a5,null))[_0xebf6('0x42')](handleError(_0x3813a5,null));};exports[_0xebf6('0x48')]=function(_0x42e3e1,_0x166664){return db[_0xebf6('0x3e')][_0xebf6('0x48')](_0x42e3e1['body'],{})[_0xebf6('0x27')](respondWithResult(_0x166664,0xc9))['catch'](handleError(_0x166664,null));};exports[_0xebf6('0x26')]=function(_0x31d8ba,_0x5d84ac){if(_0x31d8ba[_0xebf6('0x49')]['id']){delete _0x31d8ba['body']['id'];}return db[_0xebf6('0x3e')][_0xebf6('0x47')]({'where':{'id':_0x31d8ba[_0xebf6('0x4a')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x5d84ac,null))[_0xebf6('0x27')](saveUpdates(_0x31d8ba['body'],null))[_0xebf6('0x27')](respondWithResult(_0x5d84ac,null))[_0xebf6('0x42')](handleError(_0x5d84ac,null));};exports['destroy']=function(_0x1f98fd,_0x2765f2){return db[_0xebf6('0x3e')][_0xebf6('0x47')]({'where':{'id':_0x1f98fd[_0xebf6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2765f2,null))[_0xebf6('0x27')](removeEntity(_0x2765f2,null))[_0xebf6('0x42')](handleError(_0x2765f2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index be054a9..6aceb7c 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 _0x06a5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x257d76,_0x37b436){var _0x2892ed=function(_0x1428ed){while(--_0x1428ed){_0x257d76['push'](_0x257d76['shift']());}};_0x2892ed(++_0x37b436);}(_0x06a5,0xfd));var _0x506a=function(_0x575228,_0x3f9bc1){_0x575228=_0x575228-0x0;var _0x4cb11e=_0x06a5[_0x575228];return _0x4cb11e;};'use strict';var _=require(_0x506a('0x0'));var util=require('util');var logger=require(_0x506a('0x1'))('api');var moment=require(_0x506a('0x2'));var BPromise=require(_0x506a('0x3'));var rp=require(_0x506a('0x4'));var fs=require('fs');var path=require(_0x506a('0x5'));var rimraf=require(_0x506a('0x6'));var config=require(_0x506a('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x506a('0x8')]=function(_0xc2490c,_0x4c60d5){return _0xc2490c[_0x506a('0x9')](_0x506a('0xa'),attributes,{'tableName':_0x506a('0xb'),'paranoid':![],'indexes':[{'name':_0x506a('0xc'),'fields':[_0x506a('0xd'),_0x506a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e9=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','api'];(function(_0x35c82d,_0x2b99ef){var _0x25ab97=function(_0x8295a5){while(--_0x8295a5){_0x35c82d['push'](_0x35c82d['shift']());}};_0x25ab97(++_0x2b99ef);}(_0x34e9,0x102));var _0x934e=function(_0x579531,_0x2516b4){_0x579531=_0x579531-0x0;var _0x129082=_0x34e9[_0x579531];return _0x129082;};'use strict';var _=require(_0x934e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x934e('0x1'));var moment=require(_0x934e('0x2'));var BPromise=require(_0x934e('0x3'));var rp=require(_0x934e('0x4'));var fs=require('fs');var path=require(_0x934e('0x5'));var rimraf=require(_0x934e('0x6'));var config=require('../../config/environment');var attributes=require(_0x934e('0x7'));module['exports']=function(_0x24e20b,_0x546fbe){return _0x24e20b[_0x934e('0x8')](_0x934e('0x9'),attributes,{'tableName':_0x934e('0xa'),'paranoid':![],'indexes':[{'name':_0x934e('0xb'),'fields':['idField',_0x934e('0xc')],'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 6ab288a..9ac9b9c 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 _0x2908=['rpc','../../config/environment','jayson/promise','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2b70dd,_0x5de33a){var _0x34e98a=function(_0x4a86b2){while(--_0x4a86b2){_0x2b70dd['push'](_0x2b70dd['shift']());}};_0x34e98a(++_0x5de33a);}(_0x2908,0x6d));var _0x8290=function(_0x412ef5,_0x1b7e06){_0x412ef5=_0x412ef5-0x0;var _0x2dcfe2=_0x2908[_0x412ef5];return _0x2dcfe2;};'use strict';var _=require(_0x8290('0x0'));var util=require(_0x8290('0x1'));var moment=require('moment');var BPromise=require(_0x8290('0x2'));var rs=require(_0x8290('0x3'));var fs=require('fs');var Redis=require(_0x8290('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8290('0x5'));var config=require(_0x8290('0x6'));var jayson=require(_0x8290('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x243404,_0x43fa23,_0x30d9c7){return new BPromise(function(_0x50cdc0,_0xc80ecc){return client[_0x8290('0x8')](_0x243404,_0x30d9c7)[_0x8290('0x9')](function(_0xb59cb){logger['info'](_0x8290('0xa'),_0x43fa23,_0x8290('0xb'));logger[_0x8290('0xc')](_0x8290('0xd'),_0x43fa23,_0x8290('0xb'),JSON[_0x8290('0xe')](_0xb59cb));if(_0xb59cb['error']){if(_0xb59cb[_0x8290('0xf')][_0x8290('0x10')]===0x1f4){logger[_0x8290('0xf')](_0x8290('0xa'),_0x43fa23,_0xb59cb[_0x8290('0xf')][_0x8290('0x11')]);return _0xc80ecc(_0xb59cb[_0x8290('0xf')][_0x8290('0x11')]);}logger[_0x8290('0xf')](_0x8290('0xa'),_0x43fa23,_0xb59cb['error'][_0x8290('0x11')]);return _0x50cdc0(_0xb59cb[_0x8290('0xf')]['message']);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x43fa23,_0x8290('0xb'));_0x50cdc0(_0xb59cb[_0x8290('0x12')][_0x8290('0x11')]);}})['catch'](function(_0x2e8ad1){logger[_0x8290('0xf')](_0x8290('0xa'),_0x43fa23,_0x2e8ad1);_0xc80ecc(_0x2e8ad1);});});} \ No newline at end of file +var _0xb8cf=['error','code','FreshdeskField,\x20%s,\x20%s','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/environment','client','request','then','info','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b4236,_0x314c37){var _0x5171a2=function(_0x6d79a5){while(--_0x6d79a5){_0x4b4236['push'](_0x4b4236['shift']());}};_0x5171a2(++_0x314c37);}(_0xb8cf,0xf3));var _0xfb8c=function(_0xb270e8,_0x3bdb5d){_0xb270e8=_0xb270e8-0x0;var _0x23f30e=_0xb8cf[_0xb270e8];return _0x23f30e;};'use strict';var _=require(_0xfb8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfb8c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb8c('0x2'));var db=require(_0xfb8c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfb8c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xfb8c('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x241239,_0x594d94,_0xc504bf){return new BPromise(function(_0x4d2b68,_0x39fe76){return client[_0xfb8c('0x6')](_0x241239,_0xc504bf)[_0xfb8c('0x7')](function(_0x7fa1b3){logger[_0xfb8c('0x8')]('FreshdeskField,\x20%s,\x20%s',_0x594d94,'request\x20sent');logger['debug'](_0xfb8c('0x9'),_0x594d94,_0xfb8c('0xa'),JSON[_0xfb8c('0xb')](_0x7fa1b3));if(_0x7fa1b3[_0xfb8c('0xc')]){if(_0x7fa1b3[_0xfb8c('0xc')][_0xfb8c('0xd')]===0x1f4){logger['error'](_0xfb8c('0xe'),_0x594d94,_0x7fa1b3[_0xfb8c('0xc')][_0xfb8c('0xf')]);return _0x39fe76(_0x7fa1b3[_0xfb8c('0xc')][_0xfb8c('0xf')]);}logger[_0xfb8c('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x594d94,_0x7fa1b3[_0xfb8c('0xc')]['message']);return _0x4d2b68(_0x7fa1b3['error'][_0xfb8c('0xf')]);}else{logger[_0xfb8c('0x8')](_0xfb8c('0xe'),_0x594d94,'request\x20sent');_0x4d2b68(_0x7fa1b3[_0xfb8c('0x10')]['message']);}})['catch'](function(_0x49d8e9){logger[_0xfb8c('0xc')](_0xfb8c('0xe'),_0x594d94,_0x49d8e9);_0x39fe76(_0x49d8e9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f8eff1a..79a3fdd 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 _0x3f8c=['index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x104));var _0xc3f8=function(_0x37dfe4,_0xf84fd4){_0x37dfe4=_0x37dfe4-0x0;var _0x53bc65=_0x3f8c[_0x37dfe4];return _0x53bc65;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xc3f8('0x4')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x4')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller['show']);router[_0xc3f8('0x4')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);router[_0xc3f8('0x4')](_0xc3f8('0xa'),auth[_0xc3f8('0x5')](),controller['getFields']);router[_0xc3f8('0xb')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0xc')]);router[_0xc3f8('0xb')]('/:id/configurations',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0xd')]);router[_0xc3f8('0xe')](_0xc3f8('0x7'),auth['isAuthenticated'](),controller[_0xc3f8('0xf')]);router[_0xc3f8('0x10')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x11')]);module[_0xc3f8('0x12')]=router; \ No newline at end of file +var _0xd87e=['post','create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields'];(function(_0x5880a,_0x30497b){var _0x48e826=function(_0x3abb9c){while(--_0x3abb9c){_0x5880a['push'](_0x5880a['shift']());}};_0x48e826(++_0x30497b);}(_0xd87e,0x1bf));var _0xed87=function(_0x306c19,_0x2f73ea){_0x306c19=_0x306c19-0x0;var _0x4e36d7=_0xd87e[_0x306c19];return _0x4e36d7;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);router[_0xed87('0xb')](_0xed87('0xd'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')]('/',auth['isAuthenticated'](),controller[_0xed87('0x10')]);router[_0xed87('0xf')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0x11')]);router['put']('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0x12')]);router[_0xed87('0x13')](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bcf020d..f36fa0f 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 _0xb016=['remoteUri','sequelize','exports','STRING'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0xb016,0x159));var _0x6b01=function(_0x2c1210,_0x5c271b){_0x2c1210=_0x2c1210-0x0;var _0x5d0d15=_0xb016[_0x2c1210];return _0x5d0d15;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6b01('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x6b01('0x2')]},'remoteUri':{'type':Sequelize[_0x6b01('0x2')],'unique':_0x6b01('0x3')},'serverUrl':{'type':Sequelize[_0x6b01('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8aad=['STRING','username','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8aad,0x146));var _0xd8aa=function(_0x491cad,_0x341229){_0x491cad=_0x491cad-0x0;var _0x4bbdea=_0x8aad[_0x491cad];return _0x4bbdea;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'apiKey':{'type':Sequelize[_0xd8aa('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2e58ed3..448a58e 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 _0xd542=['getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesAccount','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','rawAttributes','find','catch','create','body','params','getConfigurations','findOne','order','pick','options','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','Subjects','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode'];(function(_0x1c7167,_0x153013){var _0x105a08=function(_0x5ae6e9){while(--_0x5ae6e9){_0x1c7167['push'](_0x1c7167['shift']());}};_0x105a08(++_0x153013);}(_0xd542,0x145));var _0x2d54=function(_0x410e07,_0x1a46f8){_0x410e07=_0x410e07-0x0;var _0x111258=_0xd542[_0x410e07];return _0x111258;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d54('0x0'));var zipdir=require(_0x2d54('0x1'));var jsonpatch=require(_0x2d54('0x2'));var rp=require(_0x2d54('0x3'));var moment=require(_0x2d54('0x4'));var BPromise=require(_0x2d54('0x5'));var Mustache=require(_0x2d54('0x6'));var util=require(_0x2d54('0x7'));var path=require(_0x2d54('0x8'));var sox=require(_0x2d54('0x9'));var csv=require(_0x2d54('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d54('0xb'));var _=require('lodash');var squel=require(_0x2d54('0xc'));var crypto=require(_0x2d54('0xd'));var jsforce=require(_0x2d54('0xe'));var deskjs=require(_0x2d54('0xf'));var toCsv=require(_0x2d54('0xa'));var querystring=require(_0x2d54('0x10'));var Papa=require(_0x2d54('0x11'));var Redis=require(_0x2d54('0x12'));var authService=require(_0x2d54('0x13'));var qs=require(_0x2d54('0x14'));var as=require(_0x2d54('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d54('0x16'))(_0x2d54('0x17'));var utils=require('../../config/utils');var config=require(_0x2d54('0x18'));var licenseUtil=require(_0x2d54('0x19'));var db=require(_0x2d54('0x1a'))['db'];var integrations=require(_0x2d54('0x1b'));function respondWithStatusCode(_0x27f483,_0x146652){_0x146652=_0x146652||0xcc;return function(_0x418642){if(_0x418642){return _0x27f483[_0x2d54('0x1c')](_0x146652);}return _0x27f483[_0x2d54('0x1d')](_0x146652)[_0x2d54('0x1e')]();};}function respondWithResult(_0x3789d1,_0x23e3bf){_0x23e3bf=_0x23e3bf||0xc8;return function(_0x21092a){if(_0x21092a){return _0x3789d1[_0x2d54('0x1d')](_0x23e3bf)[_0x2d54('0x1f')](_0x21092a);}};}function respondWithFilteredResult(_0x26b458,_0x1543c4){return function(_0x7d9499){if(_0x7d9499){var _0x317b2d=typeof _0x1543c4[_0x2d54('0x20')]===_0x2d54('0x21')&&typeof _0x1543c4[_0x2d54('0x22')]===_0x2d54('0x21');var _0x5a6575=_0x7d9499[_0x2d54('0x23')];var _0x107dfb=_0x317b2d?0x0:_0x1543c4[_0x2d54('0x20')];var _0x55cd4f=_0x317b2d?_0x7d9499[_0x2d54('0x23')]:_0x1543c4[_0x2d54('0x20')]+_0x1543c4[_0x2d54('0x22')];var _0x2dc4b2;if(_0x55cd4f>=_0x5a6575){_0x55cd4f=_0x5a6575;_0x2dc4b2=0xc8;}else{_0x2dc4b2=0xce;}_0x26b458['status'](_0x2dc4b2);return _0x26b458[_0x2d54('0x24')](_0x2d54('0x25'),_0x107dfb+'-'+_0x55cd4f+'/'+_0x5a6575)['json'](_0x7d9499);}return null;};}function patchUpdates(_0xce403e){return function(_0x23a1d5){try{jsonpatch[_0x2d54('0x26')](_0x23a1d5,_0xce403e,!![]);}catch(_0x2ae86c){return BPromise[_0x2d54('0x27')](_0x2ae86c);}return _0x23a1d5[_0x2d54('0x28')]();};}function saveUpdates(_0x46abce,_0x5aa911){return function(_0x30e1fc){if(_0x30e1fc){return _0x30e1fc[_0x2d54('0x29')](_0x46abce)[_0x2d54('0x2a')](function(_0x53cdc0){return _0x53cdc0;});}return null;};}function removeEntity(_0x407f4a,_0x588987){return function(_0x2cbfa5){if(_0x2cbfa5){return _0x2cbfa5[_0x2d54('0x2b')]()['then'](function(){_0x407f4a[_0x2d54('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x580c2b,_0x1d787b){return function(_0x2a1bef){if(!_0x2a1bef){_0x580c2b[_0x2d54('0x1c')](0x194);}return _0x2a1bef;};}function handleError(_0x26b8d0,_0x3bace4){_0x3bace4=_0x3bace4||0x1f4;return function(_0x382b7d){logger[_0x2d54('0x2c')](_0x382b7d[_0x2d54('0x2d')]);if(_0x382b7d[_0x2d54('0x2e')]){delete _0x382b7d[_0x2d54('0x2e')];}_0x26b8d0[_0x2d54('0x1d')](_0x3bace4)[_0x2d54('0x2f')](_0x382b7d);};}exports[_0x2d54('0x30')]=function(_0x4d8e93,_0x83dc88){var _0x37de2a={},_0x56d1b5={},_0x38eacf={'count':0x0,'rows':[]};var _0x13b69a=_['map'](db[_0x2d54('0x31')]['rawAttributes'],function(_0x4ad80a){return{'name':_0x4ad80a[_0x2d54('0x32')],'type':_0x4ad80a[_0x2d54('0x33')][_0x2d54('0x34')]};});_0x56d1b5['model']=_[_0x2d54('0x35')](_0x13b69a,_0x2d54('0x2e'));_0x56d1b5[_0x2d54('0x36')]=_[_0x2d54('0x37')](_0x4d8e93[_0x2d54('0x36')]);_0x56d1b5['filters']=_[_0x2d54('0x38')](_0x56d1b5[_0x2d54('0x39')],_0x56d1b5[_0x2d54('0x36')]);_0x37de2a['attributes']=_[_0x2d54('0x38')](_0x56d1b5['model'],qs[_0x2d54('0x3a')](_0x4d8e93[_0x2d54('0x36')]['fields']));_0x37de2a[_0x2d54('0x3b')]=_0x37de2a[_0x2d54('0x3b')][_0x2d54('0x3c')]?_0x37de2a['attributes']:_0x56d1b5[_0x2d54('0x39')];if(!_0x4d8e93['query'][_0x2d54('0x3d')](_0x2d54('0x3e'))){_0x37de2a['limit']=qs[_0x2d54('0x22')](_0x4d8e93[_0x2d54('0x36')][_0x2d54('0x22')]);_0x37de2a[_0x2d54('0x20')]=qs[_0x2d54('0x20')](_0x4d8e93[_0x2d54('0x36')][_0x2d54('0x20')]);}_0x37de2a['order']=qs[_0x2d54('0x3f')](_0x4d8e93['query'][_0x2d54('0x3f')]);_0x37de2a['where']=qs['filters'](_['pick'](_0x4d8e93['query'],_0x56d1b5[_0x2d54('0x40')]),_0x13b69a);if(_0x4d8e93[_0x2d54('0x36')]['filter']){_0x37de2a[_0x2d54('0x41')]=_[_0x2d54('0x42')](_0x37de2a[_0x2d54('0x41')],{'$or':_[_0x2d54('0x35')](_0x13b69a,function(_0xa6d72e){if(_0xa6d72e[_0x2d54('0x33')]!==_0x2d54('0x43')){var _0x24bb3d={};_0x24bb3d[_0xa6d72e['name']]={'$like':'%'+_0x4d8e93['query'][_0x2d54('0x44')]+'%'};return _0x24bb3d;}})});}_0x37de2a=_[_0x2d54('0x42')]({},_0x37de2a,_0x4d8e93['options']);var _0x12eefa={'where':_0x37de2a[_0x2d54('0x41')]};return db['FreshsalesAccount'][_0x2d54('0x23')](_0x12eefa)['then'](function(_0x4193ee){_0x38eacf[_0x2d54('0x23')]=_0x4193ee;if(_0x4d8e93[_0x2d54('0x36')][_0x2d54('0x45')]){_0x37de2a['include']=[{'all':!![]}];}return db[_0x2d54('0x31')][_0x2d54('0x46')](_0x37de2a);})[_0x2d54('0x2a')](function(_0x1948b2){_0x38eacf[_0x2d54('0x47')]=_0x1948b2;return _0x38eacf;})[_0x2d54('0x2a')](respondWithFilteredResult(_0x83dc88,_0x37de2a))['catch'](handleError(_0x83dc88,null));};exports[_0x2d54('0x48')]=function(_0x2a3f6d,_0x3b4333){var _0x50764f={'raw':![],'where':{'id':_0x2a3f6d['params']['id']}},_0x37b375={};_0x37b375[_0x2d54('0x39')]=_[_0x2d54('0x37')](db['FreshsalesAccount'][_0x2d54('0x49')]);_0x37b375[_0x2d54('0x36')]=_[_0x2d54('0x37')](_0x2a3f6d[_0x2d54('0x36')]);_0x37b375['filters']=_[_0x2d54('0x38')](_0x37b375[_0x2d54('0x39')],_0x37b375[_0x2d54('0x36')]);_0x50764f[_0x2d54('0x3b')]=_[_0x2d54('0x38')](_0x37b375[_0x2d54('0x39')],qs['fields'](_0x2a3f6d[_0x2d54('0x36')][_0x2d54('0x3a')]));_0x50764f[_0x2d54('0x3b')]=_0x50764f[_0x2d54('0x3b')][_0x2d54('0x3c')]?_0x50764f[_0x2d54('0x3b')]:_0x37b375[_0x2d54('0x39')];if(_0x2a3f6d[_0x2d54('0x36')][_0x2d54('0x45')]){_0x50764f['include']=[{'all':!![]}];}_0x50764f=_[_0x2d54('0x42')]({},_0x50764f,_0x2a3f6d['options']);return db[_0x2d54('0x31')][_0x2d54('0x4a')](_0x50764f)[_0x2d54('0x2a')](handleEntityNotFound(_0x3b4333,null))[_0x2d54('0x2a')](respondWithResult(_0x3b4333,null))[_0x2d54('0x4b')](handleError(_0x3b4333,null));};exports[_0x2d54('0x4c')]=function(_0xf79043,_0x2500ed){return db[_0x2d54('0x31')][_0x2d54('0x4c')](_0xf79043[_0x2d54('0x4d')],{})[_0x2d54('0x2a')](respondWithResult(_0x2500ed,0xc9))[_0x2d54('0x4b')](handleError(_0x2500ed,null));};exports[_0x2d54('0x29')]=function(_0x384c5f,_0x5424d8){if(_0x384c5f[_0x2d54('0x4d')]['id']){delete _0x384c5f[_0x2d54('0x4d')]['id'];}return db[_0x2d54('0x31')][_0x2d54('0x4a')]({'where':{'id':_0x384c5f[_0x2d54('0x4e')]['id']}})[_0x2d54('0x2a')](handleEntityNotFound(_0x5424d8,null))[_0x2d54('0x2a')](saveUpdates(_0x384c5f[_0x2d54('0x4d')],null))['then'](respondWithResult(_0x5424d8,null))['catch'](handleError(_0x5424d8,null));};exports[_0x2d54('0x2b')]=function(_0x260734,_0x380fdd){return db[_0x2d54('0x31')]['find']({'where':{'id':_0x260734[_0x2d54('0x4e')]['id']}})[_0x2d54('0x2a')](handleEntityNotFound(_0x380fdd,null))[_0x2d54('0x2a')](removeEntity(_0x380fdd,null))[_0x2d54('0x4b')](handleError(_0x380fdd,null));};exports[_0x2d54('0x4f')]=function(_0x4bd12a,_0x2adb8f,_0x333875){var _0x1693a5={};var _0x185ebb={};var _0x48bdc4;var _0x21c0c8;return db[_0x2d54('0x31')][_0x2d54('0x50')]({'where':{'id':_0x4bd12a['params']['id']}})[_0x2d54('0x2a')](handleEntityNotFound(_0x2adb8f,null))[_0x2d54('0x2a')](function(_0x1857d7){if(_0x1857d7){_0x48bdc4=_0x1857d7;_0x185ebb['model']=_['keys'](db['FreshsalesConfiguration'][_0x2d54('0x49')]);_0x185ebb[_0x2d54('0x36')]=_[_0x2d54('0x37')](_0x4bd12a[_0x2d54('0x36')]);_0x185ebb['filters']=_[_0x2d54('0x38')](_0x185ebb[_0x2d54('0x39')],_0x185ebb[_0x2d54('0x36')]);_0x1693a5[_0x2d54('0x3b')]=_[_0x2d54('0x38')](_0x185ebb[_0x2d54('0x39')],qs[_0x2d54('0x3a')](_0x4bd12a[_0x2d54('0x36')][_0x2d54('0x3a')]));_0x1693a5[_0x2d54('0x3b')]=_0x1693a5[_0x2d54('0x3b')][_0x2d54('0x3c')]?_0x1693a5[_0x2d54('0x3b')]:_0x185ebb[_0x2d54('0x39')];_0x1693a5[_0x2d54('0x51')]=qs[_0x2d54('0x3f')](_0x4bd12a[_0x2d54('0x36')][_0x2d54('0x3f')]);_0x1693a5['where']=qs[_0x2d54('0x40')](_[_0x2d54('0x52')](_0x4bd12a[_0x2d54('0x36')],_0x185ebb[_0x2d54('0x40')]));if(_0x4bd12a[_0x2d54('0x36')]['filter']){_0x1693a5[_0x2d54('0x41')]=_[_0x2d54('0x42')](_0x1693a5[_0x2d54('0x41')],{'$or':_[_0x2d54('0x35')](_0x1693a5['attributes'],function(_0x131eb8){var _0x30fa6c={};_0x30fa6c[_0x131eb8]={'$like':'%'+_0x4bd12a[_0x2d54('0x36')][_0x2d54('0x44')]+'%'};return _0x30fa6c;})});}_0x1693a5=_[_0x2d54('0x42')]({},_0x1693a5,_0x4bd12a[_0x2d54('0x53')]);return _0x48bdc4[_0x2d54('0x4f')](_0x1693a5);}})[_0x2d54('0x2a')](function(_0x4ca9e2){if(_0x4ca9e2){_0x21c0c8=_0x4ca9e2[_0x2d54('0x3c')];if(!_0x4bd12a['query'][_0x2d54('0x3d')](_0x2d54('0x3e'))){_0x1693a5['limit']=qs[_0x2d54('0x22')](_0x4bd12a[_0x2d54('0x36')][_0x2d54('0x22')]);_0x1693a5[_0x2d54('0x20')]=qs[_0x2d54('0x20')](_0x4bd12a[_0x2d54('0x36')][_0x2d54('0x20')]);}return _0x48bdc4['getConfigurations'](_0x1693a5);}})[_0x2d54('0x2a')](function(_0x182980){if(_0x182980){return _0x182980?{'count':_0x21c0c8,'rows':_0x182980}:null;}})[_0x2d54('0x2a')](respondWithResult(_0x2adb8f,null))['catch'](handleError(_0x2adb8f,null));};exports[_0x2d54('0x54')]=function(_0x201216,_0x45c994,_0x36c7c8){if(_0x201216[_0x2d54('0x4d')]['id']){delete _0x201216['body']['id'];}return db['FreshsalesAccount'][_0x2d54('0x50')]({'where':{'id':_0x201216[_0x2d54('0x4e')]['id']}})[_0x2d54('0x2a')](handleEntityNotFound(_0x45c994,null))['then'](function(_0x54e67e){if(_0x54e67e){_0x201216[_0x2d54('0x4d')]['AccountId']=_0x54e67e['id'];_0x201216['body']['Subjects']=integrations[_0x2d54('0x55')](_0x201216[_0x2d54('0x4d')]['channel'],_0x201216[_0x2d54('0x4d')][_0x2d54('0x33')]);_0x201216['body'][_0x2d54('0x56')]=integrations[_0x2d54('0x57')](_0x201216[_0x2d54('0x4d')][_0x2d54('0x58')],_0x201216[_0x2d54('0x4d')]['type']);return db['FreshsalesConfiguration'][_0x2d54('0x4c')](_0x201216['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x2d54('0x59')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x2d54('0x2a')](respondWithResult(_0x45c994,null))[_0x2d54('0x4b')](handleError(_0x45c994,null));};exports['getFields']=function(_0x2c1d0,_0x1d84f6,_0x31fa66){var _0x450f69='';var _0x58b949='';return db[_0x2d54('0x31')][_0x2d54('0x50')]({'where':{'id':_0x2c1d0[_0x2d54('0x4e')]['id']},'attributes':['id','username',_0x2d54('0x5a'),'apiKey']})[_0x2d54('0x2a')](handleEntityNotFound(_0x1d84f6,null))['then'](function(_0x38f3fc){if(_0x38f3fc){_0x58b949=_0x38f3fc['username'];_0x450f69=_0x38f3fc[_0x2d54('0x5a')];var _0x2b9aeb=_0x38f3fc[_0x2d54('0x5a')][_0x2d54('0x5b')](-0x1);if(_0x2b9aeb==='/'){_0x450f69=_0x450f69[_0x2d54('0x5c')](0x0,_0x450f69[_0x2d54('0x5d')](_0x2b9aeb));}return rp({'method':_0x2d54('0x5e'),'uri':util[_0x2d54('0x5f')](_0x2d54('0x60'),_0x450f69,_0x2d54('0x61')),'headers':{'Authorization':_0x2d54('0x62')+_0x38f3fc['apiKey']},'json':!![]});}})[_0x2d54('0x2a')](function(_0x4bf367){if(_0x4bf367){var _0xcce708=_0x4bf367[_0x2d54('0x63')];var _0x6154e4=![];var _0xc3899e=null;for(_0xc3899e=0x0;_0xc3899e<_0xcce708['length'];_0xc3899e++){if(_0xcce708[_0xc3899e]['email']===_0x58b949){_0x6154e4=!![];}}if(_0x6154e4){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2d54('0x64')});}}})['then'](respondWithResult(_0x1d84f6,null))[_0x2d54('0x4b')](function(_0x11f622){var _0x115d6e=_0x2c1d0[_0x2d54('0x36')][_0x2d54('0x65')]?0x1f4:_0x11f622[_0x2d54('0x66')]||0x1f4;logger[_0x2d54('0x2c')](_0x2d54('0x67'),_0x2d54('0x68'),_0x115d6e,JSON[_0x2d54('0x69')](_0x11f622));delete _0x11f622[_0x2d54('0x2e')];if(_0x115d6e===0x191){_0x115d6e=0x190;}_0x1d84f6[_0x2d54('0x1d')](_0x115d6e)[_0x2d54('0x2f')](_0x2c1d0[_0x2d54('0x36')][_0x2d54('0x65')]?{'message':_0x2d54('0x6a'),'statusCode':_0x11f622[_0x2d54('0x66')]}:_0x11f622);});}; \ No newline at end of file +var _0xb387=['error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','options','includeAll','include','rows','catch','show','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','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','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','end'];(function(_0x2fc948,_0xb49c6e){var _0x5926b7=function(_0x345259){while(--_0x345259){_0x2fc948['push'](_0x2fc948['shift']());}};_0x5926b7(++_0xb49c6e);}(_0xb387,0x167));var _0x7b38=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xb387[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require(_0x7b38('0x0'));var rimraf=require(_0x7b38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b38('0x2'));var rp=require(_0x7b38('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b38('0x4'));var path=require(_0x7b38('0x5'));var sox=require('sox');var csv=require(_0x7b38('0x6'));var ejs=require(_0x7b38('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7b38('0x8'));var crypto=require(_0x7b38('0x9'));var jsforce=require(_0x7b38('0xa'));var deskjs=require(_0x7b38('0xb'));var toCsv=require(_0x7b38('0x6'));var querystring=require('querystring');var Papa=require(_0x7b38('0xc'));var Redis=require('ioredis');var authService=require(_0x7b38('0xd'));var qs=require(_0x7b38('0xe'));var as=require(_0x7b38('0xf'));var hardwareService=require(_0x7b38('0x10'));var logger=require(_0x7b38('0x11'))(_0x7b38('0x12'));var utils=require(_0x7b38('0x13'));var config=require(_0x7b38('0x14'));var licenseUtil=require(_0x7b38('0x15'));var db=require(_0x7b38('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x492c18,_0x1582c4){_0x1582c4=_0x1582c4||0xcc;return function(_0x505996){if(_0x505996){return _0x492c18[_0x7b38('0x17')](_0x1582c4);}return _0x492c18[_0x7b38('0x18')](_0x1582c4)['end']();};}function respondWithResult(_0x577f6e,_0xcb2d7b){_0xcb2d7b=_0xcb2d7b||0xc8;return function(_0x269169){if(_0x269169){return _0x577f6e[_0x7b38('0x18')](_0xcb2d7b)[_0x7b38('0x19')](_0x269169);}};}function respondWithFilteredResult(_0x410d41,_0x28b6ca){return function(_0x56a860){if(_0x56a860){var _0x206729=typeof _0x28b6ca[_0x7b38('0x1a')]===_0x7b38('0x1b')&&typeof _0x28b6ca[_0x7b38('0x1c')]===_0x7b38('0x1b');var _0x490aff=_0x56a860['count'];var _0x1f344e=_0x206729?0x0:_0x28b6ca['offset'];var _0x16d549=_0x206729?_0x56a860[_0x7b38('0x1d')]:_0x28b6ca[_0x7b38('0x1a')]+_0x28b6ca[_0x7b38('0x1c')];var _0x1f0e11;if(_0x16d549>=_0x490aff){_0x16d549=_0x490aff;_0x1f0e11=0xc8;}else{_0x1f0e11=0xce;}_0x410d41['status'](_0x1f0e11);return _0x410d41['set']('Content-Range',_0x1f344e+'-'+_0x16d549+'/'+_0x490aff)[_0x7b38('0x19')](_0x56a860);}return null;};}function patchUpdates(_0x3a5c44){return function(_0x24f772){try{jsonpatch[_0x7b38('0x1e')](_0x24f772,_0x3a5c44,!![]);}catch(_0x672e00){return BPromise[_0x7b38('0x1f')](_0x672e00);}return _0x24f772[_0x7b38('0x20')]();};}function saveUpdates(_0x4c13b4,_0x443eeb){return function(_0x536a5d){if(_0x536a5d){return _0x536a5d[_0x7b38('0x21')](_0x4c13b4)['then'](function(_0x355922){return _0x355922;});}return null;};}function removeEntity(_0x5dfe22,_0xdd6004){return function(_0x22d8c0){if(_0x22d8c0){return _0x22d8c0[_0x7b38('0x22')]()[_0x7b38('0x23')](function(){_0x5dfe22['status'](0xcc)[_0x7b38('0x24')]();});}};}function handleEntityNotFound(_0x4e0c5a,_0xb8714c){return function(_0x579485){if(!_0x579485){_0x4e0c5a['sendStatus'](0x194);}return _0x579485;};}function handleError(_0x1eb8ce,_0x41b409){_0x41b409=_0x41b409||0x1f4;return function(_0x801020){logger[_0x7b38('0x25')](_0x801020['stack']);if(_0x801020[_0x7b38('0x26')]){delete _0x801020[_0x7b38('0x26')];}_0x1eb8ce[_0x7b38('0x18')](_0x41b409)['send'](_0x801020);};}exports[_0x7b38('0x27')]=function(_0x36c4df,_0x1de963){var _0x4d1eab={},_0xb10de9={},_0x2d907f={'count':0x0,'rows':[]};var _0x56c487=_[_0x7b38('0x28')](db[_0x7b38('0x29')][_0x7b38('0x2a')],function(_0x40804c){return{'name':_0x40804c[_0x7b38('0x2b')],'type':_0x40804c['type'][_0x7b38('0x2c')]};});_0xb10de9[_0x7b38('0x2d')]=_['map'](_0x56c487,'name');_0xb10de9['query']=_[_0x7b38('0x2e')](_0x36c4df[_0x7b38('0x2f')]);_0xb10de9[_0x7b38('0x30')]=_['intersection'](_0xb10de9['model'],_0xb10de9[_0x7b38('0x2f')]);_0x4d1eab['attributes']=_[_0x7b38('0x31')](_0xb10de9[_0x7b38('0x2d')],qs[_0x7b38('0x32')](_0x36c4df[_0x7b38('0x2f')][_0x7b38('0x32')]));_0x4d1eab[_0x7b38('0x33')]=_0x4d1eab[_0x7b38('0x33')][_0x7b38('0x34')]?_0x4d1eab[_0x7b38('0x33')]:_0xb10de9[_0x7b38('0x2d')];if(!_0x36c4df['query'][_0x7b38('0x35')]('nolimit')){_0x4d1eab['limit']=qs[_0x7b38('0x1c')](_0x36c4df[_0x7b38('0x2f')][_0x7b38('0x1c')]);_0x4d1eab[_0x7b38('0x1a')]=qs['offset'](_0x36c4df[_0x7b38('0x2f')][_0x7b38('0x1a')]);}_0x4d1eab[_0x7b38('0x36')]=qs[_0x7b38('0x37')](_0x36c4df['query'][_0x7b38('0x37')]);_0x4d1eab['where']=qs[_0x7b38('0x30')](_[_0x7b38('0x38')](_0x36c4df[_0x7b38('0x2f')],_0xb10de9[_0x7b38('0x30')]),_0x56c487);if(_0x36c4df[_0x7b38('0x2f')][_0x7b38('0x39')]){_0x4d1eab['where']=_[_0x7b38('0x3a')](_0x4d1eab[_0x7b38('0x3b')],{'$or':_[_0x7b38('0x28')](_0x56c487,function(_0x422255){if(_0x422255[_0x7b38('0x3c')]!=='VIRTUAL'){var _0x59dda8={};_0x59dda8[_0x422255[_0x7b38('0x26')]]={'$like':'%'+_0x36c4df[_0x7b38('0x2f')][_0x7b38('0x39')]+'%'};return _0x59dda8;}})});}_0x4d1eab=_[_0x7b38('0x3a')]({},_0x4d1eab,_0x36c4df[_0x7b38('0x3d')]);var _0x5d13a9={'where':_0x4d1eab['where']};return db[_0x7b38('0x29')][_0x7b38('0x1d')](_0x5d13a9)[_0x7b38('0x23')](function(_0x44baac){_0x2d907f['count']=_0x44baac;if(_0x36c4df['query'][_0x7b38('0x3e')]){_0x4d1eab[_0x7b38('0x3f')]=[{'all':!![]}];}return db[_0x7b38('0x29')]['findAll'](_0x4d1eab);})['then'](function(_0x8ed1e0){_0x2d907f[_0x7b38('0x40')]=_0x8ed1e0;return _0x2d907f;})['then'](respondWithFilteredResult(_0x1de963,_0x4d1eab))[_0x7b38('0x41')](handleError(_0x1de963,null));};exports[_0x7b38('0x42')]=function(_0x18fa50,_0x56209d){var _0x4ee35f={'raw':![],'where':{'id':_0x18fa50['params']['id']}},_0x581ca0={};_0x581ca0[_0x7b38('0x2d')]=_['keys'](db[_0x7b38('0x29')]['rawAttributes']);_0x581ca0[_0x7b38('0x2f')]=_['keys'](_0x18fa50[_0x7b38('0x2f')]);_0x581ca0['filters']=_[_0x7b38('0x31')](_0x581ca0[_0x7b38('0x2d')],_0x581ca0[_0x7b38('0x2f')]);_0x4ee35f[_0x7b38('0x33')]=_[_0x7b38('0x31')](_0x581ca0['model'],qs[_0x7b38('0x32')](_0x18fa50[_0x7b38('0x2f')]['fields']));_0x4ee35f[_0x7b38('0x33')]=_0x4ee35f[_0x7b38('0x33')][_0x7b38('0x34')]?_0x4ee35f[_0x7b38('0x33')]:_0x581ca0[_0x7b38('0x2d')];if(_0x18fa50['query'][_0x7b38('0x3e')]){_0x4ee35f[_0x7b38('0x3f')]=[{'all':!![]}];}_0x4ee35f=_[_0x7b38('0x3a')]({},_0x4ee35f,_0x18fa50[_0x7b38('0x3d')]);return db[_0x7b38('0x29')][_0x7b38('0x43')](_0x4ee35f)[_0x7b38('0x23')](handleEntityNotFound(_0x56209d,null))[_0x7b38('0x23')](respondWithResult(_0x56209d,null))[_0x7b38('0x41')](handleError(_0x56209d,null));};exports[_0x7b38('0x44')]=function(_0x5ae828,_0x3e6387){return db[_0x7b38('0x29')][_0x7b38('0x44')](_0x5ae828[_0x7b38('0x45')],{})['then'](respondWithResult(_0x3e6387,0xc9))[_0x7b38('0x41')](handleError(_0x3e6387,null));};exports[_0x7b38('0x21')]=function(_0x3992c8,_0x3b0aff){if(_0x3992c8['body']['id']){delete _0x3992c8[_0x7b38('0x45')]['id'];}return db[_0x7b38('0x29')]['find']({'where':{'id':_0x3992c8[_0x7b38('0x46')]['id']}})[_0x7b38('0x23')](handleEntityNotFound(_0x3b0aff,null))[_0x7b38('0x23')](saveUpdates(_0x3992c8['body'],null))[_0x7b38('0x23')](respondWithResult(_0x3b0aff,null))[_0x7b38('0x41')](handleError(_0x3b0aff,null));};exports[_0x7b38('0x22')]=function(_0x12c5df,_0x4fbc8f){return db[_0x7b38('0x29')][_0x7b38('0x43')]({'where':{'id':_0x12c5df[_0x7b38('0x46')]['id']}})[_0x7b38('0x23')](handleEntityNotFound(_0x4fbc8f,null))['then'](removeEntity(_0x4fbc8f,null))[_0x7b38('0x41')](handleError(_0x4fbc8f,null));};exports[_0x7b38('0x47')]=function(_0x4b5183,_0x33c987,_0x27a3c8){var _0xce10e0={};var _0x38525e={};var _0x571a4a;var _0x214125;return db['FreshsalesAccount'][_0x7b38('0x48')]({'where':{'id':_0x4b5183[_0x7b38('0x46')]['id']}})[_0x7b38('0x23')](handleEntityNotFound(_0x33c987,null))['then'](function(_0x20ac0a){if(_0x20ac0a){_0x571a4a=_0x20ac0a;_0x38525e['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x38525e[_0x7b38('0x2f')]=_[_0x7b38('0x2e')](_0x4b5183['query']);_0x38525e['filters']=_[_0x7b38('0x31')](_0x38525e[_0x7b38('0x2d')],_0x38525e['query']);_0xce10e0[_0x7b38('0x33')]=_[_0x7b38('0x31')](_0x38525e['model'],qs[_0x7b38('0x32')](_0x4b5183[_0x7b38('0x2f')][_0x7b38('0x32')]));_0xce10e0[_0x7b38('0x33')]=_0xce10e0['attributes'][_0x7b38('0x34')]?_0xce10e0[_0x7b38('0x33')]:_0x38525e[_0x7b38('0x2d')];_0xce10e0[_0x7b38('0x36')]=qs[_0x7b38('0x37')](_0x4b5183['query'][_0x7b38('0x37')]);_0xce10e0[_0x7b38('0x3b')]=qs['filters'](_[_0x7b38('0x38')](_0x4b5183['query'],_0x38525e[_0x7b38('0x30')]));if(_0x4b5183['query']['filter']){_0xce10e0[_0x7b38('0x3b')]=_['merge'](_0xce10e0[_0x7b38('0x3b')],{'$or':_[_0x7b38('0x28')](_0xce10e0[_0x7b38('0x33')],function(_0x107e98){var _0x44da23={};_0x44da23[_0x107e98]={'$like':'%'+_0x4b5183[_0x7b38('0x2f')][_0x7b38('0x39')]+'%'};return _0x44da23;})});}_0xce10e0=_[_0x7b38('0x3a')]({},_0xce10e0,_0x4b5183[_0x7b38('0x3d')]);return _0x571a4a[_0x7b38('0x47')](_0xce10e0);}})['then'](function(_0x364272){if(_0x364272){_0x214125=_0x364272['length'];if(!_0x4b5183['query'][_0x7b38('0x35')](_0x7b38('0x49'))){_0xce10e0[_0x7b38('0x1c')]=qs[_0x7b38('0x1c')](_0x4b5183[_0x7b38('0x2f')][_0x7b38('0x1c')]);_0xce10e0[_0x7b38('0x1a')]=qs[_0x7b38('0x1a')](_0x4b5183[_0x7b38('0x2f')][_0x7b38('0x1a')]);}return _0x571a4a[_0x7b38('0x47')](_0xce10e0);}})[_0x7b38('0x23')](function(_0x2d268a){if(_0x2d268a){return _0x2d268a?{'count':_0x214125,'rows':_0x2d268a}:null;}})[_0x7b38('0x23')](respondWithResult(_0x33c987,null))[_0x7b38('0x41')](handleError(_0x33c987,null));};exports[_0x7b38('0x4a')]=function(_0x5a7375,_0x45f3cf,_0x383b24){if(_0x5a7375[_0x7b38('0x45')]['id']){delete _0x5a7375[_0x7b38('0x45')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x5a7375[_0x7b38('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f3cf,null))['then'](function(_0x3b3ae2){if(_0x3b3ae2){_0x5a7375[_0x7b38('0x45')][_0x7b38('0x4b')]=_0x3b3ae2['id'];_0x5a7375[_0x7b38('0x45')]['Subjects']=integrations[_0x7b38('0x4c')](_0x5a7375[_0x7b38('0x45')][_0x7b38('0x4d')],_0x5a7375[_0x7b38('0x45')][_0x7b38('0x3c')]);_0x5a7375[_0x7b38('0x45')][_0x7b38('0x4e')]=integrations[_0x7b38('0x4f')](_0x5a7375[_0x7b38('0x45')]['channel'],_0x5a7375[_0x7b38('0x45')][_0x7b38('0x3c')]);return db['FreshsalesConfiguration']['create'](_0x5a7375[_0x7b38('0x45')],{'include':[{'model':db[_0x7b38('0x50')],'as':_0x7b38('0x51')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x7b38('0x23')](respondWithResult(_0x45f3cf,null))[_0x7b38('0x41')](handleError(_0x45f3cf,null));};exports['getFields']=function(_0x412c58,_0x444bae,_0x4601f5){var _0x3cb9e6='';var _0x2820df='';return db[_0x7b38('0x29')][_0x7b38('0x48')]({'where':{'id':_0x412c58[_0x7b38('0x46')]['id']},'attributes':['id','username',_0x7b38('0x52'),_0x7b38('0x53')]})['then'](handleEntityNotFound(_0x444bae,null))[_0x7b38('0x23')](function(_0x368739){if(_0x368739){_0x2820df=_0x368739['username'];_0x3cb9e6=_0x368739[_0x7b38('0x52')];var _0x268bfb=_0x368739[_0x7b38('0x52')][_0x7b38('0x54')](-0x1);if(_0x268bfb==='/'){_0x3cb9e6=_0x3cb9e6[_0x7b38('0x55')](0x0,_0x3cb9e6[_0x7b38('0x56')](_0x268bfb));}return rp({'method':_0x7b38('0x57'),'uri':util['format'](_0x7b38('0x58'),_0x3cb9e6,_0x7b38('0x59')),'headers':{'Authorization':_0x7b38('0x5a')+_0x368739[_0x7b38('0x53')]},'json':!![]});}})['then'](function(_0x109641){if(_0x109641){var _0x18431f=_0x109641[_0x7b38('0x5b')];var _0x194c1a=![];var _0x5982a7=null;for(_0x5982a7=0x0;_0x5982a7<_0x18431f[_0x7b38('0x34')];_0x5982a7++){if(_0x18431f[_0x5982a7][_0x7b38('0x5c')]===_0x2820df){_0x194c1a=!![];}}if(_0x194c1a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7b38('0x5d')});}}})['then'](respondWithResult(_0x444bae,null))['catch'](function(_0x4f4d91){var _0x5219cf=_0x412c58[_0x7b38('0x2f')][_0x7b38('0x5e')]?0x1f4:_0x4f4d91[_0x7b38('0x5f')]||0x1f4;logger[_0x7b38('0x25')](_0x7b38('0x60'),'getFields',_0x5219cf,JSON[_0x7b38('0x61')](_0x4f4d91));delete _0x4f4d91[_0x7b38('0x26')];if(_0x5219cf===0x191){_0x5219cf=0x190;}_0x444bae[_0x7b38('0x18')](_0x5219cf)[_0x7b38('0x62')](_0x412c58['query'][_0x7b38('0x5e')]?{'message':'Wrong\x20credentials','statusCode':_0x4f4d91[_0x7b38('0x5f')]}:_0x4f4d91);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c7dede6..7c68e55 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 _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x54cd98,_0x3029e6){var _0x4abd09=function(_0x10e689){while(--_0x10e689){_0x54cd98['push'](_0x54cd98['shift']());}};_0x4abd09(++_0x3029e6);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3c8952,_0x5979fd){_0x3c8952=_0x3c8952-0x0;var _0x55a5ac=_0xe5af[_0x3c8952];return _0x55a5ac;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x2566df,_0x38c433){var _0x5b002a=function(_0x51640a){while(--_0x51640a){_0x2566df['push'](_0x2566df['shift']());}};_0x5b002a(++_0x38c433);}(_0x7880,0x1f4));var _0x0788=function(_0x1875c8,_0x4e5f7a){_0x1875c8=_0x1875c8-0x0;var _0x28ed91=_0x7880[_0x1875c8];return _0x28ed91;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));var integrations=require(_0x0788('0x9'));module[_0x0788('0xa')]=function(_0x775629,_0x3f9cb8){return _0x775629[_0x0788('0xb')](_0x0788('0xc'),attributes,{'tableName':_0x0788('0xd'),'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 9b1fa0a..3915bba 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 _0x7b84=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','attributes','limit','map','model','include','GetFreshsalesAccount','ShowFreshsalesAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7b84,0x17c));var _0x47b8=function(_0x41700f,_0x43012f){_0x41700f=_0x41700f-0x0;var _0x432652=_0x7b84[_0x41700f];return _0x432652;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['GetFreshsalesAccount']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['FreshsalesAccount']['findAll']({'raw':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1b')]||null:null,'attributes':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1c')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'include':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')]['include']?_[_0x47b8('0x1e')](_0x4f7317[_0x47b8('0x1a')]['include'],function(_0x22e7dd){return{'model':db[_0x22e7dd[_0x47b8('0x1f')]],'as':_0x22e7dd['as'],'attributes':_0x22e7dd[_0x47b8('0x1c')],'include':_0x22e7dd[_0x47b8('0x20')]?_['map'](_0x22e7dd[_0x47b8('0x20')],function(_0x332c23){return{'model':db[_0x332c23[_0x47b8('0x1f')]],'as':_0x332c23['as'],'attributes':_0x332c23[_0x47b8('0x1c')],'include':_0x332c23[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x332c23[_0x47b8('0x20')],function(_0x568c1e){return{'model':db[_0x568c1e[_0x47b8('0x1f')]],'as':_0x568c1e['as'],'attributes':_0x568c1e[_0x47b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x195a66){logger[_0x47b8('0xf')](_0x47b8('0x21'),_0x4f7317);logger[_0x47b8('0x12')]('GetFreshsalesAccount',_0x4f7317,JSON[_0x47b8('0x14')](_0x195a66));_0x36faf1(_0x195a66);})['catch'](function(_0x2c89fc){logger[_0x47b8('0x15')](_0x47b8('0x21'),_0x2c89fc[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195['error'](0x1f4,_0x2c89fc[_0x47b8('0x17')]));});});};exports[_0x47b8('0x22')]=function(_0x402e7c){var _0x1b6c0a=this;return new Promise(function(_0x132f37,_0x197cb5){return db['FreshsalesAccount']['find']({'raw':_0x402e7c['options']?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x23')]===undefined?!![]:![]:!![],'where':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c['options']['where']||null:null,'attributes':_0x402e7c['options']?_0x402e7c['options'][_0x47b8('0x1c')]||null:null,'include':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')],function(_0x460dcc){return{'model':db[_0x460dcc[_0x47b8('0x1f')]],'as':_0x460dcc['as'],'attributes':_0x460dcc['attributes'],'include':_0x460dcc['include']?_[_0x47b8('0x1e')](_0x460dcc[_0x47b8('0x20')],function(_0x531dd2){return{'model':db[_0x531dd2['model']],'as':_0x531dd2['as'],'attributes':_0x531dd2[_0x47b8('0x1c')],'include':_0x531dd2[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x531dd2['include'],function(_0x240ab6){return{'model':db[_0x240ab6[_0x47b8('0x1f')]],'as':_0x240ab6['as'],'attributes':_0x240ab6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1892){logger['info'](_0x47b8('0x22'),_0x402e7c);logger[_0x47b8('0x12')](_0x47b8('0x22'),_0x402e7c,JSON[_0x47b8('0x14')](_0x4f1892));_0x132f37(_0x4f1892);})[_0x47b8('0x19')](function(_0x3c24c1){logger['error']('ShowFreshsalesAccount',_0x3c24c1[_0x47b8('0x17')],_0x402e7c);_0x197cb5(_0x1b6c0a[_0x47b8('0x15')](0x1f4,_0x3c24c1[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','lodash','util'];(function(_0x108452,_0x18577e){var _0x2ede86=function(_0x2e0a17){while(--_0x2e0a17){_0x108452['push'](_0x108452['shift']());}};_0x2ede86(++_0x18577e);}(_0xdb28,0x106));var _0x8db2=function(_0x2ddff1,_0x1ea307){_0x2ddff1=_0x2ddff1-0x0;var _0x5148aa=_0xdb28[_0x2ddff1];return _0x5148aa;};'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')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['FreshsalesAccount'][_0x8db2('0x17')]({'raw':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x19')]===undefined?!![]:![]:!![],'where':_0x3fddc2['options']?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1a')]||null:null,'attributes':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1b')]||null:null,'limit':_0x3fddc2['options']?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1c')]||null:null,'include':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x3fddc2[_0x8db2('0x18')]['include'],function(_0x256202){return{'model':db[_0x256202['model']],'as':_0x256202['as'],'attributes':_0x256202['attributes'],'include':_0x256202['include']?_['map'](_0x256202[_0x8db2('0x1d')],function(_0x29b5cd){return{'model':db[_0x29b5cd[_0x8db2('0x1f')]],'as':_0x29b5cd['as'],'attributes':_0x29b5cd[_0x8db2('0x1b')],'include':_0x29b5cd[_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x29b5cd['include'],function(_0x3544ba){return{'model':db[_0x3544ba[_0x8db2('0x1f')]],'as':_0x3544ba['as'],'attributes':_0x3544ba[_0x8db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0xc')](function(_0x483aee){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')](_0x8db2('0x16'),_0x3fddc2,JSON[_0x8db2('0x10')](_0x483aee));_0x46ce14(_0x483aee);})[_0x8db2('0x15')](function(_0xa54ea3){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0xa54ea3['message'],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0xa54ea3['message']));});});};exports['ShowFreshsalesAccount']=function(_0x302188){var _0x25ed2c=this;return new Promise(function(_0xcc8a66,_0x49b2b3){return db[_0x8db2('0x20')]['find']({'raw':_0x302188[_0x8db2('0x18')]?_0x302188[_0x8db2('0x18')][_0x8db2('0x19')]===undefined?!![]:![]:!![],'where':_0x302188['options']?_0x302188['options'][_0x8db2('0x1a')]||null:null,'attributes':_0x302188[_0x8db2('0x18')]?_0x302188['options']['attributes']||null:null,'include':_0x302188[_0x8db2('0x18')]?_0x302188[_0x8db2('0x18')][_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x302188[_0x8db2('0x18')][_0x8db2('0x1d')],function(_0x101711){return{'model':db[_0x101711[_0x8db2('0x1f')]],'as':_0x101711['as'],'attributes':_0x101711[_0x8db2('0x1b')],'include':_0x101711[_0x8db2('0x1d')]?_['map'](_0x101711[_0x8db2('0x1d')],function(_0x304a72){return{'model':db[_0x304a72['model']],'as':_0x304a72['as'],'attributes':_0x304a72[_0x8db2('0x1b')],'include':_0x304a72[_0x8db2('0x1d')]?_['map'](_0x304a72['include'],function(_0x3c1983){return{'model':db[_0x3c1983['model']],'as':_0x3c1983['as'],'attributes':_0x3c1983[_0x8db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0xc')](function(_0x26717d){logger[_0x8db2('0x14')]('ShowFreshsalesAccount',_0x302188);logger[_0x8db2('0xf')]('ShowFreshsalesAccount',_0x302188,JSON[_0x8db2('0x10')](_0x26717d));_0xcc8a66(_0x26717d);})[_0x8db2('0x15')](function(_0x2c8bc9){logger[_0x8db2('0x11')]('ShowFreshsalesAccount',_0x2c8bc9['message'],_0x302188);_0x49b2b3(_0x25ed2c[_0x8db2('0x11')](0x1f4,_0x2c8bc9[_0x8db2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 03999c5..94559c9 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 _0x408a=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer'];(function(_0x2cabb9,_0x232e2e){var _0x4672dd=function(_0x232b73){while(--_0x232b73){_0x2cabb9['push'](_0x2cabb9['shift']());}};_0x4672dd(++_0x232e2e);}(_0x408a,0xd7));var _0xa408=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x408a[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xa408('0x0'));var util=require(_0xa408('0x1'));var path=require(_0xa408('0x2'));var timeout=require(_0xa408('0x3'));var express=require(_0xa408('0x4'));var router=express[_0xa408('0x5')]();var fs_extra=require(_0xa408('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa408('0x7'));var config=require('../../config/environment');var controller=require(_0xa408('0x8'));router[_0xa408('0x9')]('/',auth[_0xa408('0xa')](),controller['index']);router[_0xa408('0x9')](_0xa408('0xb'),auth[_0xa408('0xa')](),controller[_0xa408('0xc')]);router[_0xa408('0x9')](_0xa408('0xd'),auth[_0xa408('0xa')](),controller[_0xa408('0xe')]);router['get'](_0xa408('0xf'),auth[_0xa408('0xa')](),controller[_0xa408('0x10')]);router[_0xa408('0x9')](_0xa408('0x11'),auth[_0xa408('0xa')](),controller[_0xa408('0x12')]);router[_0xa408('0x13')]('/',auth[_0xa408('0xa')](),controller['create']);router['put']('/:id',auth[_0xa408('0xa')](),controller[_0xa408('0x14')]);router[_0xa408('0x15')]('/:id',auth[_0xa408('0xa')](),controller[_0xa408('0x16')]);module[_0xa408('0x17')]=router; \ No newline at end of file +var _0x1382=['/:id/descriptions','getDescriptions','/:id/fields','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','show'];(function(_0xdb5754,_0x4160c5){var _0xf463cc=function(_0x58ee00){while(--_0x58ee00){_0xdb5754['push'](_0xdb5754['shift']());}};_0xf463cc(++_0x4160c5);}(_0x1382,0x97));var _0x2138=function(_0x3cf113,_0x1ead5f){_0x3cf113=_0x3cf113-0x0;var _0x5d74e5=_0x1382[_0x3cf113];return _0x5d74e5;};'use strict';var multer=require(_0x2138('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2138('0x1'));var router=express['Router']();var fs_extra=require(_0x2138('0x2'));var auth=require(_0x2138('0x3'));var interaction=require(_0x2138('0x4'));var config=require(_0x2138('0x5'));var controller=require(_0x2138('0x6'));router[_0x2138('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2138('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2138('0x8')]);router[_0x2138('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x2138('0x7')](_0x2138('0x9'),auth['isAuthenticated'](),controller[_0x2138('0xa')]);router[_0x2138('0x7')](_0x2138('0xb'),auth[_0x2138('0xc')](),controller['getFields']);router[_0x2138('0xd')]('/',auth[_0x2138('0xc')](),controller[_0x2138('0xe')]);router[_0x2138('0xf')](_0x2138('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x2138('0x11')](_0x2138('0x10'),auth['isAuthenticated'](),controller[_0x2138('0x12')]);module[_0x2138('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index e244ae5..1e583f8 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 _0x36f6=['STRING','sequelize'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0x36f6,0x1eb));var _0x636f=function(_0x48aaca,_0x140945){_0x48aaca=_0x48aaca-0x0;var _0xac5ed9=_0x36f6[_0x48aaca];return _0xac5ed9;};'use strict';var Sequelize=require(_0x636f('0x0'));module['exports']={'name':{'type':Sequelize[_0x636f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4091=['sequelize','STRING'];(function(_0x358153,_0x2d2f57){var _0x4b44ff=function(_0x1ae52b){while(--_0x1ae52b){_0x358153['push'](_0x358153['shift']());}};_0x4b44ff(++_0x2d2f57);}(_0x4091,0xba));var _0x1409=function(_0x4f357d,_0x3dae2d){_0x4f357d=_0x4f357d-0x0;var _0x21af41=_0x4091[_0x4f357d];return _0x21af41;};'use strict';var Sequelize=require(_0x1409('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1409('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 229e688..f0e9ff8 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 _0x4082=['rows','catch','show','params','find','create','body','getSubjects','FreshsalesField','sort','getDescriptions','findOne','getFields','request-promise','mustache','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x43fbe0,_0x513326){var _0x15477a=function(_0x566e9b){while(--_0x566e9b){_0x43fbe0['push'](_0x43fbe0['shift']());}};_0x15477a(++_0x513326);}(_0x4082,0xa9));var _0x2408=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4082[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2408('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2408('0x1'));var util=require('util');var path=require('path');var sox=require(_0x2408('0x2'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2408('0x3'));var _=require(_0x2408('0x4'));var squel=require('squel');var crypto=require(_0x2408('0x5'));var jsforce=require(_0x2408('0x6'));var deskjs=require(_0x2408('0x7'));var toCsv=require(_0x2408('0x8'));var querystring=require(_0x2408('0x9'));var Papa=require(_0x2408('0xa'));var Redis=require(_0x2408('0xb'));var authService=require(_0x2408('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2408('0xd'));var hardwareService=require(_0x2408('0xe'));var logger=require(_0x2408('0xf'))(_0x2408('0x10'));var utils=require(_0x2408('0x11'));var config=require(_0x2408('0x12'));var licenseUtil=require(_0x2408('0x13'));var db=require(_0x2408('0x14'))['db'];function respondWithStatusCode(_0x3b8f4c,_0x22f22b){_0x22f22b=_0x22f22b||0xcc;return function(_0x47c51b){if(_0x47c51b){return _0x3b8f4c[_0x2408('0x15')](_0x22f22b);}return _0x3b8f4c[_0x2408('0x16')](_0x22f22b)['end']();};}function respondWithResult(_0x8f95ac,_0x2ca8cd){_0x2ca8cd=_0x2ca8cd||0xc8;return function(_0x595a3c){if(_0x595a3c){return _0x8f95ac[_0x2408('0x16')](_0x2ca8cd)['json'](_0x595a3c);}};}function respondWithFilteredResult(_0x20e425,_0x3325d4){return function(_0xb75850){if(_0xb75850){var _0x399e55=typeof _0x3325d4[_0x2408('0x17')]===_0x2408('0x18')&&typeof _0x3325d4['limit']===_0x2408('0x18');var _0x52fb78=_0xb75850[_0x2408('0x19')];var _0x5cc463=_0x399e55?0x0:_0x3325d4[_0x2408('0x17')];var _0xf25661=_0x399e55?_0xb75850['count']:_0x3325d4[_0x2408('0x17')]+_0x3325d4['limit'];var _0x26960b;if(_0xf25661>=_0x52fb78){_0xf25661=_0x52fb78;_0x26960b=0xc8;}else{_0x26960b=0xce;}_0x20e425[_0x2408('0x16')](_0x26960b);return _0x20e425[_0x2408('0x1a')](_0x2408('0x1b'),_0x5cc463+'-'+_0xf25661+'/'+_0x52fb78)[_0x2408('0x1c')](_0xb75850);}return null;};}function patchUpdates(_0x5bffcb){return function(_0x3bc523){try{jsonpatch[_0x2408('0x1d')](_0x3bc523,_0x5bffcb,!![]);}catch(_0x329ebe){return BPromise[_0x2408('0x1e')](_0x329ebe);}return _0x3bc523[_0x2408('0x1f')]();};}function saveUpdates(_0x4cee7a,_0x56ee56){return function(_0x5e4896){if(_0x5e4896){return _0x5e4896['update'](_0x4cee7a)[_0x2408('0x20')](function(_0x283298){return _0x283298;});}return null;};}function removeEntity(_0x5a9ea3,_0x1e0ec0){return function(_0x4a285d){if(_0x4a285d){return _0x4a285d[_0x2408('0x21')]()[_0x2408('0x20')](function(){_0x5a9ea3[_0x2408('0x16')](0xcc)[_0x2408('0x22')]();});}};}function handleEntityNotFound(_0x3a352b,_0x48d970){return function(_0x47d464){if(!_0x47d464){_0x3a352b[_0x2408('0x15')](0x194);}return _0x47d464;};}function handleError(_0x2797c6,_0x24c44b){_0x24c44b=_0x24c44b||0x1f4;return function(_0x10919c){logger[_0x2408('0x23')](_0x10919c['stack']);if(_0x10919c[_0x2408('0x24')]){delete _0x10919c[_0x2408('0x24')];}_0x2797c6[_0x2408('0x16')](_0x24c44b)[_0x2408('0x25')](_0x10919c);};}exports[_0x2408('0x26')]=function(_0x3b0ef6,_0x1b0218){var _0x3b5bc2={},_0x38e66c={},_0x317663={'count':0x0,'rows':[]};var _0xdc38df=_[_0x2408('0x27')](db[_0x2408('0x28')][_0x2408('0x29')],function(_0x4a80d2){return{'name':_0x4a80d2[_0x2408('0x2a')],'type':_0x4a80d2['type']['key']};});_0x38e66c[_0x2408('0x2b')]=_[_0x2408('0x27')](_0xdc38df,'name');_0x38e66c['query']=_[_0x2408('0x2c')](_0x3b0ef6[_0x2408('0x2d')]);_0x38e66c['filters']=_[_0x2408('0x2e')](_0x38e66c[_0x2408('0x2b')],_0x38e66c[_0x2408('0x2d')]);_0x3b5bc2[_0x2408('0x2f')]=_[_0x2408('0x2e')](_0x38e66c[_0x2408('0x2b')],qs[_0x2408('0x30')](_0x3b0ef6[_0x2408('0x2d')][_0x2408('0x30')]));_0x3b5bc2[_0x2408('0x2f')]=_0x3b5bc2['attributes'][_0x2408('0x31')]?_0x3b5bc2[_0x2408('0x2f')]:_0x38e66c[_0x2408('0x2b')];if(!_0x3b0ef6[_0x2408('0x2d')][_0x2408('0x32')](_0x2408('0x33'))){_0x3b5bc2[_0x2408('0x34')]=qs[_0x2408('0x34')](_0x3b0ef6['query'][_0x2408('0x34')]);_0x3b5bc2['offset']=qs[_0x2408('0x17')](_0x3b0ef6['query'][_0x2408('0x17')]);}_0x3b5bc2[_0x2408('0x35')]=qs['sort'](_0x3b0ef6[_0x2408('0x2d')]['sort']);_0x3b5bc2[_0x2408('0x36')]=qs['filters'](_[_0x2408('0x37')](_0x3b0ef6[_0x2408('0x2d')],_0x38e66c[_0x2408('0x38')]),_0xdc38df);if(_0x3b0ef6[_0x2408('0x2d')][_0x2408('0x39')]){_0x3b5bc2['where']=_[_0x2408('0x3a')](_0x3b5bc2[_0x2408('0x36')],{'$or':_[_0x2408('0x27')](_0xdc38df,function(_0x5488c8){if(_0x5488c8[_0x2408('0x3b')]!==_0x2408('0x3c')){var _0xacbe69={};_0xacbe69[_0x5488c8[_0x2408('0x24')]]={'$like':'%'+_0x3b0ef6[_0x2408('0x2d')]['filter']+'%'};return _0xacbe69;}})});}_0x3b5bc2=_[_0x2408('0x3a')]({},_0x3b5bc2,_0x3b0ef6[_0x2408('0x3d')]);var _0x565558={'where':_0x3b5bc2[_0x2408('0x36')]};return db[_0x2408('0x28')][_0x2408('0x19')](_0x565558)[_0x2408('0x20')](function(_0x120c2a){_0x317663[_0x2408('0x19')]=_0x120c2a;if(_0x3b0ef6[_0x2408('0x2d')][_0x2408('0x3e')]){_0x3b5bc2[_0x2408('0x3f')]=[{'all':!![]}];}return db[_0x2408('0x28')][_0x2408('0x40')](_0x3b5bc2);})[_0x2408('0x20')](function(_0x15729a){_0x317663[_0x2408('0x41')]=_0x15729a;return _0x317663;})[_0x2408('0x20')](respondWithFilteredResult(_0x1b0218,_0x3b5bc2))[_0x2408('0x42')](handleError(_0x1b0218,null));};exports[_0x2408('0x43')]=function(_0x2603ca,_0x200c96){var _0x493b6c={'raw':![],'where':{'id':_0x2603ca[_0x2408('0x44')]['id']}},_0x10228f={};_0x10228f[_0x2408('0x2b')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x10228f[_0x2408('0x2d')]=_['keys'](_0x2603ca[_0x2408('0x2d')]);_0x10228f[_0x2408('0x38')]=_[_0x2408('0x2e')](_0x10228f[_0x2408('0x2b')],_0x10228f[_0x2408('0x2d')]);_0x493b6c['attributes']=_[_0x2408('0x2e')](_0x10228f[_0x2408('0x2b')],qs[_0x2408('0x30')](_0x2603ca[_0x2408('0x2d')][_0x2408('0x30')]));_0x493b6c[_0x2408('0x2f')]=_0x493b6c['attributes']['length']?_0x493b6c[_0x2408('0x2f')]:_0x10228f[_0x2408('0x2b')];if(_0x2603ca['query'][_0x2408('0x3e')]){_0x493b6c['include']=[{'all':!![]}];}_0x493b6c=_[_0x2408('0x3a')]({},_0x493b6c,_0x2603ca[_0x2408('0x3d')]);return db[_0x2408('0x28')][_0x2408('0x45')](_0x493b6c)[_0x2408('0x20')](handleEntityNotFound(_0x200c96,null))[_0x2408('0x20')](respondWithResult(_0x200c96,null))[_0x2408('0x42')](handleError(_0x200c96,null));};exports[_0x2408('0x46')]=function(_0x95c943,_0x3bda93){return db[_0x2408('0x28')][_0x2408('0x46')](_0x95c943['body'],{})[_0x2408('0x20')](respondWithResult(_0x3bda93,0xc9))[_0x2408('0x42')](handleError(_0x3bda93,null));};exports['update']=function(_0x13d1b6,_0xde4dff){if(_0x13d1b6[_0x2408('0x47')]['id']){delete _0x13d1b6[_0x2408('0x47')]['id'];}return db[_0x2408('0x28')][_0x2408('0x45')]({'where':{'id':_0x13d1b6[_0x2408('0x44')]['id']}})['then'](handleEntityNotFound(_0xde4dff,null))[_0x2408('0x20')](saveUpdates(_0x13d1b6[_0x2408('0x47')],null))['then'](respondWithResult(_0xde4dff,null))[_0x2408('0x42')](handleError(_0xde4dff,null));};exports[_0x2408('0x21')]=function(_0x1d18fc,_0x331b38){return db[_0x2408('0x28')][_0x2408('0x45')]({'where':{'id':_0x1d18fc[_0x2408('0x44')]['id']}})['then'](handleEntityNotFound(_0x331b38,null))['then'](removeEntity(_0x331b38,null))['catch'](handleError(_0x331b38,null));};exports[_0x2408('0x48')]=function(_0x2f1a12,_0x285517,_0x296777){var _0x3d278d={};var _0x5ea12d={};var _0x211d06;var _0x2ee074;return db[_0x2408('0x28')]['findOne']({'where':{'id':_0x2f1a12['params']['id']}})['then'](handleEntityNotFound(_0x285517,null))[_0x2408('0x20')](function(_0x575592){if(_0x575592){_0x211d06=_0x575592;_0x5ea12d[_0x2408('0x2b')]=_['keys'](db[_0x2408('0x49')]['rawAttributes']);_0x5ea12d['query']=_[_0x2408('0x2c')](_0x2f1a12[_0x2408('0x2d')]);_0x5ea12d[_0x2408('0x38')]=_[_0x2408('0x2e')](_0x5ea12d['model'],_0x5ea12d[_0x2408('0x2d')]);_0x3d278d[_0x2408('0x2f')]=_['intersection'](_0x5ea12d[_0x2408('0x2b')],qs['fields'](_0x2f1a12[_0x2408('0x2d')][_0x2408('0x30')]));_0x3d278d[_0x2408('0x2f')]=_0x3d278d['attributes'][_0x2408('0x31')]?_0x3d278d[_0x2408('0x2f')]:_0x5ea12d[_0x2408('0x2b')];_0x3d278d[_0x2408('0x35')]=qs[_0x2408('0x4a')](_0x2f1a12[_0x2408('0x2d')]['sort']);_0x3d278d[_0x2408('0x36')]=qs['filters'](_[_0x2408('0x37')](_0x2f1a12[_0x2408('0x2d')],_0x5ea12d[_0x2408('0x38')]));if(_0x2f1a12[_0x2408('0x2d')][_0x2408('0x39')]){_0x3d278d['where']=_['merge'](_0x3d278d[_0x2408('0x36')],{'$or':_[_0x2408('0x27')](_0x3d278d['attributes'],function(_0x35c611){var _0x46d613={};_0x46d613[_0x35c611]={'$like':'%'+_0x2f1a12[_0x2408('0x2d')][_0x2408('0x39')]+'%'};return _0x46d613;})});}_0x3d278d=_[_0x2408('0x3a')]({},_0x3d278d,_0x2f1a12['options']);return _0x211d06[_0x2408('0x48')](_0x3d278d);}})[_0x2408('0x20')](function(_0x33eb48){if(_0x33eb48){_0x2ee074=_0x33eb48['length'];if(!_0x2f1a12[_0x2408('0x2d')][_0x2408('0x32')](_0x2408('0x33'))){_0x3d278d[_0x2408('0x34')]=qs[_0x2408('0x34')](_0x2f1a12['query'][_0x2408('0x34')]);_0x3d278d[_0x2408('0x17')]=qs[_0x2408('0x17')](_0x2f1a12[_0x2408('0x2d')][_0x2408('0x17')]);}return _0x211d06[_0x2408('0x48')](_0x3d278d);}})[_0x2408('0x20')](function(_0x447c66){if(_0x447c66){return _0x447c66?{'count':_0x2ee074,'rows':_0x447c66}:null;}})[_0x2408('0x20')](respondWithResult(_0x285517,null))[_0x2408('0x42')](handleError(_0x285517,null));};exports[_0x2408('0x4b')]=function(_0x3e6fee,_0x4674d7,_0xf5941d){var _0x3bebfd={};var _0x5defcc={};var _0x517ecf;var _0x3024d0;return db[_0x2408('0x28')][_0x2408('0x4c')]({'where':{'id':_0x3e6fee[_0x2408('0x44')]['id']}})[_0x2408('0x20')](handleEntityNotFound(_0x4674d7,null))['then'](function(_0x1e7fdf){if(_0x1e7fdf){_0x517ecf=_0x1e7fdf;_0x5defcc['model']=_[_0x2408('0x2c')](db[_0x2408('0x49')]['rawAttributes']);_0x5defcc['query']=_[_0x2408('0x2c')](_0x3e6fee[_0x2408('0x2d')]);_0x5defcc[_0x2408('0x38')]=_[_0x2408('0x2e')](_0x5defcc[_0x2408('0x2b')],_0x5defcc[_0x2408('0x2d')]);_0x3bebfd[_0x2408('0x2f')]=_[_0x2408('0x2e')](_0x5defcc[_0x2408('0x2b')],qs[_0x2408('0x30')](_0x3e6fee['query'][_0x2408('0x30')]));_0x3bebfd[_0x2408('0x2f')]=_0x3bebfd['attributes'][_0x2408('0x31')]?_0x3bebfd['attributes']:_0x5defcc[_0x2408('0x2b')];_0x3bebfd['order']=qs['sort'](_0x3e6fee[_0x2408('0x2d')][_0x2408('0x4a')]);_0x3bebfd[_0x2408('0x36')]=qs[_0x2408('0x38')](_[_0x2408('0x37')](_0x3e6fee[_0x2408('0x2d')],_0x5defcc[_0x2408('0x38')]));if(_0x3e6fee[_0x2408('0x2d')]['filter']){_0x3bebfd[_0x2408('0x36')]=_['merge'](_0x3bebfd[_0x2408('0x36')],{'$or':_['map'](_0x3bebfd[_0x2408('0x2f')],function(_0x1130f1){var _0x31b096={};_0x31b096[_0x1130f1]={'$like':'%'+_0x3e6fee['query'][_0x2408('0x39')]+'%'};return _0x31b096;})});}_0x3bebfd=_[_0x2408('0x3a')]({},_0x3bebfd,_0x3e6fee[_0x2408('0x3d')]);return _0x517ecf['getDescriptions'](_0x3bebfd);}})[_0x2408('0x20')](function(_0x5bb01d){if(_0x5bb01d){_0x3024d0=_0x5bb01d[_0x2408('0x31')];if(!_0x3e6fee[_0x2408('0x2d')][_0x2408('0x32')](_0x2408('0x33'))){_0x3bebfd[_0x2408('0x34')]=qs['limit'](_0x3e6fee[_0x2408('0x2d')][_0x2408('0x34')]);_0x3bebfd[_0x2408('0x17')]=qs[_0x2408('0x17')](_0x3e6fee['query']['offset']);}return _0x517ecf['getDescriptions'](_0x3bebfd);}})['then'](function(_0x44b5fb){if(_0x44b5fb){return _0x44b5fb?{'count':_0x3024d0,'rows':_0x44b5fb}:null;}})[_0x2408('0x20')](respondWithResult(_0x4674d7,null))[_0x2408('0x42')](handleError(_0x4674d7,null));};exports[_0x2408('0x4d')]=function(_0x4c4bb7,_0x59a600,_0x1f278a){var _0x5a0b05={};var _0x40352b={};var _0x769415;var _0x1d811d;return db[_0x2408('0x28')]['findOne']({'where':{'id':_0x4c4bb7['params']['id']}})['then'](handleEntityNotFound(_0x59a600,null))[_0x2408('0x20')](function(_0x5dc63c){if(_0x5dc63c){_0x769415=_0x5dc63c;_0x40352b[_0x2408('0x2b')]=_[_0x2408('0x2c')](db[_0x2408('0x49')][_0x2408('0x29')]);_0x40352b[_0x2408('0x2d')]=_[_0x2408('0x2c')](_0x4c4bb7[_0x2408('0x2d')]);_0x40352b[_0x2408('0x38')]=_[_0x2408('0x2e')](_0x40352b[_0x2408('0x2b')],_0x40352b[_0x2408('0x2d')]);_0x5a0b05[_0x2408('0x2f')]=_[_0x2408('0x2e')](_0x40352b[_0x2408('0x2b')],qs[_0x2408('0x30')](_0x4c4bb7[_0x2408('0x2d')][_0x2408('0x30')]));_0x5a0b05[_0x2408('0x2f')]=_0x5a0b05['attributes'][_0x2408('0x31')]?_0x5a0b05[_0x2408('0x2f')]:_0x40352b[_0x2408('0x2b')];_0x5a0b05['order']=qs['sort'](_0x4c4bb7['query'][_0x2408('0x4a')]);_0x5a0b05[_0x2408('0x36')]=qs[_0x2408('0x38')](_['pick'](_0x4c4bb7[_0x2408('0x2d')],_0x40352b[_0x2408('0x38')]));if(_0x4c4bb7[_0x2408('0x2d')]['filter']){_0x5a0b05[_0x2408('0x36')]=_[_0x2408('0x3a')](_0x5a0b05['where'],{'$or':_[_0x2408('0x27')](_0x5a0b05[_0x2408('0x2f')],function(_0x594ff3){var _0xce7a85={};_0xce7a85[_0x594ff3]={'$like':'%'+_0x4c4bb7[_0x2408('0x2d')]['filter']+'%'};return _0xce7a85;})});}_0x5a0b05=_[_0x2408('0x3a')]({},_0x5a0b05,_0x4c4bb7[_0x2408('0x3d')]);return _0x769415[_0x2408('0x4d')](_0x5a0b05);}})[_0x2408('0x20')](function(_0x253877){if(_0x253877){_0x1d811d=_0x253877[_0x2408('0x31')];if(!_0x4c4bb7['query'][_0x2408('0x32')](_0x2408('0x33'))){_0x5a0b05['limit']=qs[_0x2408('0x34')](_0x4c4bb7[_0x2408('0x2d')][_0x2408('0x34')]);_0x5a0b05[_0x2408('0x17')]=qs[_0x2408('0x17')](_0x4c4bb7[_0x2408('0x2d')]['offset']);}return _0x769415[_0x2408('0x4d')](_0x5a0b05);}})[_0x2408('0x20')](function(_0x2c515e){if(_0x2c515e){return _0x2c515e?{'count':_0x1d811d,'rows':_0x2c515e}:null;}})[_0x2408('0x20')](respondWithResult(_0x59a600,null))[_0x2408('0x42')](handleError(_0x59a600,null));}; \ No newline at end of file +var _0x5036=['sendStatus','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','show','params','length','find','create','catch','body','getSubjects','findOne','FreshsalesField','pick','getDescriptions','filter','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x27a1bb,_0xf2caf5){var _0x163448=function(_0x1cd2ff){while(--_0x1cd2ff){_0x27a1bb['push'](_0x27a1bb['shift']());}};_0x163448(++_0xf2caf5);}(_0x5036,0x164));var _0x6503=function(_0x1163a0,_0xfed5f4){_0x1163a0=_0x1163a0-0x0;var _0x1af53e=_0x5036[_0x1163a0];return _0x1af53e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6503('0x0'));var zipdir=require(_0x6503('0x1'));var jsonpatch=require(_0x6503('0x2'));var rp=require(_0x6503('0x3'));var moment=require('moment');var BPromise=require(_0x6503('0x4'));var Mustache=require(_0x6503('0x5'));var util=require('util');var path=require(_0x6503('0x6'));var sox=require(_0x6503('0x7'));var csv=require(_0x6503('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6503('0x9'));var _=require('lodash');var squel=require(_0x6503('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6503('0xb'));var toCsv=require(_0x6503('0x8'));var querystring=require(_0x6503('0xc'));var Papa=require(_0x6503('0xd'));var Redis=require(_0x6503('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6503('0xf'));var hardwareService=require(_0x6503('0x10'));var logger=require(_0x6503('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6503('0x12'));var db=require(_0x6503('0x13'))['db'];function respondWithStatusCode(_0x26373f,_0x5bb225){_0x5bb225=_0x5bb225||0xcc;return function(_0xeddd86){if(_0xeddd86){return _0x26373f['sendStatus'](_0x5bb225);}return _0x26373f[_0x6503('0x14')](_0x5bb225)['end']();};}function respondWithResult(_0x18f71d,_0x57a246){_0x57a246=_0x57a246||0xc8;return function(_0x1d4bb4){if(_0x1d4bb4){return _0x18f71d[_0x6503('0x14')](_0x57a246)[_0x6503('0x15')](_0x1d4bb4);}};}function respondWithFilteredResult(_0x36edf1,_0x54b89d){return function(_0x152b8e){if(_0x152b8e){var _0x336adf=typeof _0x54b89d[_0x6503('0x16')]==='undefined'&&typeof _0x54b89d[_0x6503('0x17')]===_0x6503('0x18');var _0xb6e27f=_0x152b8e['count'];var _0x21fd59=_0x336adf?0x0:_0x54b89d[_0x6503('0x16')];var _0x249c3b=_0x336adf?_0x152b8e['count']:_0x54b89d['offset']+_0x54b89d['limit'];var _0x3606b4;if(_0x249c3b>=_0xb6e27f){_0x249c3b=_0xb6e27f;_0x3606b4=0xc8;}else{_0x3606b4=0xce;}_0x36edf1[_0x6503('0x14')](_0x3606b4);return _0x36edf1[_0x6503('0x19')](_0x6503('0x1a'),_0x21fd59+'-'+_0x249c3b+'/'+_0xb6e27f)[_0x6503('0x15')](_0x152b8e);}return null;};}function patchUpdates(_0x323642){return function(_0x23b8fa){try{jsonpatch[_0x6503('0x1b')](_0x23b8fa,_0x323642,!![]);}catch(_0x56d5cc){return BPromise[_0x6503('0x1c')](_0x56d5cc);}return _0x23b8fa[_0x6503('0x1d')]();};}function saveUpdates(_0x3ea845,_0x5eeaff){return function(_0x418f0d){if(_0x418f0d){return _0x418f0d[_0x6503('0x1e')](_0x3ea845)[_0x6503('0x1f')](function(_0x5c875f){return _0x5c875f;});}return null;};}function removeEntity(_0x9298c,_0x4ee194){return function(_0x124fc6){if(_0x124fc6){return _0x124fc6[_0x6503('0x20')]()[_0x6503('0x1f')](function(){_0x9298c[_0x6503('0x14')](0xcc)[_0x6503('0x21')]();});}};}function handleEntityNotFound(_0x38eb34,_0x1097b3){return function(_0x24ef61){if(!_0x24ef61){_0x38eb34[_0x6503('0x22')](0x194);}return _0x24ef61;};}function handleError(_0x3d1d4f,_0x1df025){_0x1df025=_0x1df025||0x1f4;return function(_0xd47799){logger['error'](_0xd47799[_0x6503('0x23')]);if(_0xd47799[_0x6503('0x24')]){delete _0xd47799['name'];}_0x3d1d4f[_0x6503('0x14')](_0x1df025)[_0x6503('0x25')](_0xd47799);};}exports[_0x6503('0x26')]=function(_0xe5ba6b,_0x18a95f){var _0x2953c1={},_0x4f2f58={},_0x93438e={'count':0x0,'rows':[]};var _0x380a14=_['map'](db[_0x6503('0x27')][_0x6503('0x28')],function(_0x4f44f2){return{'name':_0x4f44f2[_0x6503('0x29')],'type':_0x4f44f2['type'][_0x6503('0x2a')]};});_0x4f2f58[_0x6503('0x2b')]=_[_0x6503('0x2c')](_0x380a14,'name');_0x4f2f58[_0x6503('0x2d')]=_[_0x6503('0x2e')](_0xe5ba6b['query']);_0x4f2f58[_0x6503('0x2f')]=_['intersection'](_0x4f2f58[_0x6503('0x2b')],_0x4f2f58[_0x6503('0x2d')]);_0x2953c1[_0x6503('0x30')]=_[_0x6503('0x31')](_0x4f2f58[_0x6503('0x2b')],qs[_0x6503('0x32')](_0xe5ba6b[_0x6503('0x2d')][_0x6503('0x32')]));_0x2953c1[_0x6503('0x30')]=_0x2953c1[_0x6503('0x30')]['length']?_0x2953c1[_0x6503('0x30')]:_0x4f2f58[_0x6503('0x2b')];if(!_0xe5ba6b[_0x6503('0x2d')][_0x6503('0x33')](_0x6503('0x34'))){_0x2953c1[_0x6503('0x17')]=qs[_0x6503('0x17')](_0xe5ba6b[_0x6503('0x2d')][_0x6503('0x17')]);_0x2953c1[_0x6503('0x16')]=qs[_0x6503('0x16')](_0xe5ba6b['query'][_0x6503('0x16')]);}_0x2953c1[_0x6503('0x35')]=qs[_0x6503('0x36')](_0xe5ba6b[_0x6503('0x2d')][_0x6503('0x36')]);_0x2953c1[_0x6503('0x37')]=qs[_0x6503('0x2f')](_['pick'](_0xe5ba6b[_0x6503('0x2d')],_0x4f2f58[_0x6503('0x2f')]),_0x380a14);if(_0xe5ba6b[_0x6503('0x2d')]['filter']){_0x2953c1[_0x6503('0x37')]=_[_0x6503('0x38')](_0x2953c1[_0x6503('0x37')],{'$or':_[_0x6503('0x2c')](_0x380a14,function(_0xc09b95){if(_0xc09b95[_0x6503('0x39')]!==_0x6503('0x3a')){var _0xae007c={};_0xae007c[_0xc09b95[_0x6503('0x24')]]={'$like':'%'+_0xe5ba6b[_0x6503('0x2d')]['filter']+'%'};return _0xae007c;}})});}_0x2953c1=_[_0x6503('0x38')]({},_0x2953c1,_0xe5ba6b[_0x6503('0x3b')]);var _0x1fb1ec={'where':_0x2953c1[_0x6503('0x37')]};return db[_0x6503('0x27')]['count'](_0x1fb1ec)[_0x6503('0x1f')](function(_0x4a7ed2){_0x93438e[_0x6503('0x3c')]=_0x4a7ed2;if(_0xe5ba6b['query'][_0x6503('0x3d')]){_0x2953c1['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x6503('0x3e')](_0x2953c1);})['then'](function(_0xfac615){_0x93438e[_0x6503('0x3f')]=_0xfac615;return _0x93438e;})['then'](respondWithFilteredResult(_0x18a95f,_0x2953c1))['catch'](handleError(_0x18a95f,null));};exports[_0x6503('0x40')]=function(_0x37326f,_0x310dc0){var _0x5dc6b4={'raw':![],'where':{'id':_0x37326f[_0x6503('0x41')]['id']}},_0x4a2b07={};_0x4a2b07[_0x6503('0x2b')]=_['keys'](db[_0x6503('0x27')][_0x6503('0x28')]);_0x4a2b07['query']=_[_0x6503('0x2e')](_0x37326f[_0x6503('0x2d')]);_0x4a2b07[_0x6503('0x2f')]=_[_0x6503('0x31')](_0x4a2b07[_0x6503('0x2b')],_0x4a2b07[_0x6503('0x2d')]);_0x5dc6b4[_0x6503('0x30')]=_[_0x6503('0x31')](_0x4a2b07['model'],qs['fields'](_0x37326f['query'][_0x6503('0x32')]));_0x5dc6b4[_0x6503('0x30')]=_0x5dc6b4[_0x6503('0x30')][_0x6503('0x42')]?_0x5dc6b4[_0x6503('0x30')]:_0x4a2b07[_0x6503('0x2b')];if(_0x37326f[_0x6503('0x2d')][_0x6503('0x3d')]){_0x5dc6b4['include']=[{'all':!![]}];}_0x5dc6b4=_[_0x6503('0x38')]({},_0x5dc6b4,_0x37326f[_0x6503('0x3b')]);return db[_0x6503('0x27')][_0x6503('0x43')](_0x5dc6b4)[_0x6503('0x1f')](handleEntityNotFound(_0x310dc0,null))[_0x6503('0x1f')](respondWithResult(_0x310dc0,null))['catch'](handleError(_0x310dc0,null));};exports[_0x6503('0x44')]=function(_0x153c39,_0x36578c){return db[_0x6503('0x27')][_0x6503('0x44')](_0x153c39['body'],{})[_0x6503('0x1f')](respondWithResult(_0x36578c,0xc9))[_0x6503('0x45')](handleError(_0x36578c,null));};exports[_0x6503('0x1e')]=function(_0xf6d951,_0x2bceb7){if(_0xf6d951[_0x6503('0x46')]['id']){delete _0xf6d951[_0x6503('0x46')]['id'];}return db['FreshsalesConfiguration'][_0x6503('0x43')]({'where':{'id':_0xf6d951['params']['id']}})[_0x6503('0x1f')](handleEntityNotFound(_0x2bceb7,null))['then'](saveUpdates(_0xf6d951[_0x6503('0x46')],null))[_0x6503('0x1f')](respondWithResult(_0x2bceb7,null))['catch'](handleError(_0x2bceb7,null));};exports[_0x6503('0x20')]=function(_0x17c869,_0x453000){return db['FreshsalesConfiguration'][_0x6503('0x43')]({'where':{'id':_0x17c869['params']['id']}})['then'](handleEntityNotFound(_0x453000,null))[_0x6503('0x1f')](removeEntity(_0x453000,null))[_0x6503('0x45')](handleError(_0x453000,null));};exports[_0x6503('0x47')]=function(_0x4fa676,_0x14e89f,_0xff58fe){var _0x5d56c3={};var _0x3ea373={};var _0x126618;var _0x53ce45;return db[_0x6503('0x27')][_0x6503('0x48')]({'where':{'id':_0x4fa676[_0x6503('0x41')]['id']}})[_0x6503('0x1f')](handleEntityNotFound(_0x14e89f,null))[_0x6503('0x1f')](function(_0x37c565){if(_0x37c565){_0x126618=_0x37c565;_0x3ea373[_0x6503('0x2b')]=_[_0x6503('0x2e')](db[_0x6503('0x49')][_0x6503('0x28')]);_0x3ea373[_0x6503('0x2d')]=_[_0x6503('0x2e')](_0x4fa676[_0x6503('0x2d')]);_0x3ea373[_0x6503('0x2f')]=_[_0x6503('0x31')](_0x3ea373[_0x6503('0x2b')],_0x3ea373[_0x6503('0x2d')]);_0x5d56c3[_0x6503('0x30')]=_[_0x6503('0x31')](_0x3ea373[_0x6503('0x2b')],qs['fields'](_0x4fa676['query'][_0x6503('0x32')]));_0x5d56c3[_0x6503('0x30')]=_0x5d56c3[_0x6503('0x30')][_0x6503('0x42')]?_0x5d56c3[_0x6503('0x30')]:_0x3ea373[_0x6503('0x2b')];_0x5d56c3[_0x6503('0x35')]=qs[_0x6503('0x36')](_0x4fa676['query']['sort']);_0x5d56c3[_0x6503('0x37')]=qs[_0x6503('0x2f')](_[_0x6503('0x4a')](_0x4fa676['query'],_0x3ea373[_0x6503('0x2f')]));if(_0x4fa676[_0x6503('0x2d')]['filter']){_0x5d56c3[_0x6503('0x37')]=_[_0x6503('0x38')](_0x5d56c3[_0x6503('0x37')],{'$or':_[_0x6503('0x2c')](_0x5d56c3['attributes'],function(_0x42c632){var _0x557ffe={};_0x557ffe[_0x42c632]={'$like':'%'+_0x4fa676[_0x6503('0x2d')]['filter']+'%'};return _0x557ffe;})});}_0x5d56c3=_[_0x6503('0x38')]({},_0x5d56c3,_0x4fa676['options']);return _0x126618[_0x6503('0x47')](_0x5d56c3);}})['then'](function(_0x330845){if(_0x330845){_0x53ce45=_0x330845[_0x6503('0x42')];if(!_0x4fa676[_0x6503('0x2d')]['hasOwnProperty'](_0x6503('0x34'))){_0x5d56c3[_0x6503('0x17')]=qs[_0x6503('0x17')](_0x4fa676['query'][_0x6503('0x17')]);_0x5d56c3[_0x6503('0x16')]=qs[_0x6503('0x16')](_0x4fa676[_0x6503('0x2d')]['offset']);}return _0x126618[_0x6503('0x47')](_0x5d56c3);}})[_0x6503('0x1f')](function(_0x162639){if(_0x162639){return _0x162639?{'count':_0x53ce45,'rows':_0x162639}:null;}})[_0x6503('0x1f')](respondWithResult(_0x14e89f,null))[_0x6503('0x45')](handleError(_0x14e89f,null));};exports[_0x6503('0x4b')]=function(_0x3093dc,_0x3f3740,_0x5e3887){var _0x1d6ee3={};var _0xb0b202={};var _0x324818;var _0x510a95;return db['FreshsalesConfiguration'][_0x6503('0x48')]({'where':{'id':_0x3093dc['params']['id']}})[_0x6503('0x1f')](handleEntityNotFound(_0x3f3740,null))[_0x6503('0x1f')](function(_0x44ea85){if(_0x44ea85){_0x324818=_0x44ea85;_0xb0b202[_0x6503('0x2b')]=_[_0x6503('0x2e')](db[_0x6503('0x49')][_0x6503('0x28')]);_0xb0b202[_0x6503('0x2d')]=_[_0x6503('0x2e')](_0x3093dc[_0x6503('0x2d')]);_0xb0b202['filters']=_[_0x6503('0x31')](_0xb0b202[_0x6503('0x2b')],_0xb0b202[_0x6503('0x2d')]);_0x1d6ee3[_0x6503('0x30')]=_['intersection'](_0xb0b202['model'],qs[_0x6503('0x32')](_0x3093dc['query'][_0x6503('0x32')]));_0x1d6ee3[_0x6503('0x30')]=_0x1d6ee3[_0x6503('0x30')][_0x6503('0x42')]?_0x1d6ee3[_0x6503('0x30')]:_0xb0b202[_0x6503('0x2b')];_0x1d6ee3[_0x6503('0x35')]=qs[_0x6503('0x36')](_0x3093dc[_0x6503('0x2d')][_0x6503('0x36')]);_0x1d6ee3[_0x6503('0x37')]=qs[_0x6503('0x2f')](_[_0x6503('0x4a')](_0x3093dc['query'],_0xb0b202[_0x6503('0x2f')]));if(_0x3093dc[_0x6503('0x2d')][_0x6503('0x4c')]){_0x1d6ee3[_0x6503('0x37')]=_[_0x6503('0x38')](_0x1d6ee3[_0x6503('0x37')],{'$or':_[_0x6503('0x2c')](_0x1d6ee3['attributes'],function(_0x20a21c){var _0x4d9a45={};_0x4d9a45[_0x20a21c]={'$like':'%'+_0x3093dc[_0x6503('0x2d')][_0x6503('0x4c')]+'%'};return _0x4d9a45;})});}_0x1d6ee3=_[_0x6503('0x38')]({},_0x1d6ee3,_0x3093dc[_0x6503('0x3b')]);return _0x324818[_0x6503('0x4b')](_0x1d6ee3);}})['then'](function(_0x12c9bd){if(_0x12c9bd){_0x510a95=_0x12c9bd['length'];if(!_0x3093dc[_0x6503('0x2d')]['hasOwnProperty']('nolimit')){_0x1d6ee3[_0x6503('0x17')]=qs['limit'](_0x3093dc[_0x6503('0x2d')][_0x6503('0x17')]);_0x1d6ee3['offset']=qs[_0x6503('0x16')](_0x3093dc[_0x6503('0x2d')]['offset']);}return _0x324818[_0x6503('0x4b')](_0x1d6ee3);}})[_0x6503('0x1f')](function(_0x3e57e5){if(_0x3e57e5){return _0x3e57e5?{'count':_0x510a95,'rows':_0x3e57e5}:null;}})[_0x6503('0x1f')](respondWithResult(_0x3f3740,null))[_0x6503('0x45')](handleError(_0x3f3740,null));};exports['getFields']=function(_0x5df73c,_0x1ea0a6,_0x44b8ca){var _0x101f5a={};var _0x3a128b={};var _0x3eab47;var _0x4099b4;return db[_0x6503('0x27')][_0x6503('0x48')]({'where':{'id':_0x5df73c[_0x6503('0x41')]['id']}})[_0x6503('0x1f')](handleEntityNotFound(_0x1ea0a6,null))[_0x6503('0x1f')](function(_0x453de8){if(_0x453de8){_0x3eab47=_0x453de8;_0x3a128b[_0x6503('0x2b')]=_[_0x6503('0x2e')](db[_0x6503('0x49')][_0x6503('0x28')]);_0x3a128b[_0x6503('0x2d')]=_[_0x6503('0x2e')](_0x5df73c[_0x6503('0x2d')]);_0x3a128b[_0x6503('0x2f')]=_[_0x6503('0x31')](_0x3a128b[_0x6503('0x2b')],_0x3a128b[_0x6503('0x2d')]);_0x101f5a[_0x6503('0x30')]=_[_0x6503('0x31')](_0x3a128b[_0x6503('0x2b')],qs['fields'](_0x5df73c[_0x6503('0x2d')][_0x6503('0x32')]));_0x101f5a['attributes']=_0x101f5a[_0x6503('0x30')][_0x6503('0x42')]?_0x101f5a[_0x6503('0x30')]:_0x3a128b[_0x6503('0x2b')];_0x101f5a['order']=qs['sort'](_0x5df73c[_0x6503('0x2d')]['sort']);_0x101f5a[_0x6503('0x37')]=qs[_0x6503('0x2f')](_[_0x6503('0x4a')](_0x5df73c[_0x6503('0x2d')],_0x3a128b[_0x6503('0x2f')]));if(_0x5df73c[_0x6503('0x2d')][_0x6503('0x4c')]){_0x101f5a[_0x6503('0x37')]=_[_0x6503('0x38')](_0x101f5a[_0x6503('0x37')],{'$or':_[_0x6503('0x2c')](_0x101f5a['attributes'],function(_0x357cb2){var _0x1782af={};_0x1782af[_0x357cb2]={'$like':'%'+_0x5df73c[_0x6503('0x2d')]['filter']+'%'};return _0x1782af;})});}_0x101f5a=_[_0x6503('0x38')]({},_0x101f5a,_0x5df73c[_0x6503('0x3b')]);return _0x3eab47[_0x6503('0x4d')](_0x101f5a);}})[_0x6503('0x1f')](function(_0x24c13a){if(_0x24c13a){_0x4099b4=_0x24c13a[_0x6503('0x42')];if(!_0x5df73c['query'][_0x6503('0x33')](_0x6503('0x34'))){_0x101f5a[_0x6503('0x17')]=qs[_0x6503('0x17')](_0x5df73c[_0x6503('0x2d')][_0x6503('0x17')]);_0x101f5a[_0x6503('0x16')]=qs[_0x6503('0x16')](_0x5df73c[_0x6503('0x2d')][_0x6503('0x16')]);}return _0x3eab47['getFields'](_0x101f5a);}})[_0x6503('0x1f')](function(_0x58ead9){if(_0x58ead9){return _0x58ead9?{'count':_0x4099b4,'rows':_0x58ead9}:null;}})['then'](respondWithResult(_0x1ea0a6,null))[_0x6503('0x45')](handleError(_0x1ea0a6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index bdcdc48..ea5b9ed 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 _0xd7a0=['rimraf','exports','int_freshsales_configurations','util','../../config/logger','api','bluebird'];(function(_0x429e04,_0x3a7b57){var _0x2ea574=function(_0x1699d0){while(--_0x1699d0){_0x429e04['push'](_0x429e04['shift']());}};_0x2ea574(++_0x3a7b57);}(_0xd7a0,0x11b));var _0x0d7a=function(_0x5eccca,_0x511b6d){_0x5eccca=_0x5eccca-0x0;var _0x27140e=_0xd7a0[_0x5eccca];return _0x27140e;};'use strict';var _=require('lodash');var util=require(_0x0d7a('0x0'));var logger=require(_0x0d7a('0x1'))(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d7a('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0d7a('0x5')]=function(_0x5d39bc,_0x1aaa0f){return _0x5d39bc['define']('FreshsalesConfiguration',attributes,{'tableName':_0x0d7a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x245e=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x245e,0xdb));var _0xe245=function(_0x2d77e1,_0x14d925){_0x2d77e1=_0x2d77e1-0x0;var _0x2846e8=_0x245e[_0x2d77e1];return _0x2846e8;};'use strict';var _=require(_0xe245('0x0'));var util=require('util');var logger=require(_0xe245('0x1'))(_0xe245('0x2'));var moment=require(_0xe245('0x3'));var BPromise=require(_0xe245('0x4'));var rp=require(_0xe245('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe245('0x6'));var attributes=require(_0xe245('0x7'));module[_0xe245('0x8')]=function(_0x5c1c87,_0x2cc9f4){return _0x5c1c87[_0xe245('0x9')](_0xe245('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index e84175d..28e93a0 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 _0x1d60=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d7ad6,_0x89d50e){var _0x347b9b=function(_0x295224){while(--_0x295224){_0x2d7ad6['push'](_0x2d7ad6['shift']());}};_0x347b9b(++_0x89d50e);}(_0x1d60,0x173));var _0x01d6=function(_0x4f5f80,_0x14cc01){_0x4f5f80=_0x4f5f80-0x0;var _0x55d824=_0x1d60[_0x4f5f80];return _0x55d824;};'use strict';var _=require('lodash');var util=require(_0x01d6('0x0'));var moment=require(_0x01d6('0x1'));var BPromise=require(_0x01d6('0x2'));var rs=require(_0x01d6('0x3'));var fs=require('fs');var Redis=require(_0x01d6('0x4'));var db=require(_0x01d6('0x5'))['db'];var utils=require(_0x01d6('0x6'));var logger=require('../../config/logger')(_0x01d6('0x7'));var config=require(_0x01d6('0x8'));var jayson=require(_0x01d6('0x9'));var client=jayson['client'][_0x01d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x529e20,_0x27ab13,_0x121c99){return new BPromise(function(_0xe66308,_0x2cad56){return client[_0x01d6('0xb')](_0x529e20,_0x121c99)[_0x01d6('0xc')](function(_0x26c65a){logger['info'](_0x01d6('0xd'),_0x27ab13,_0x01d6('0xe'));logger[_0x01d6('0xf')](_0x01d6('0x10'),_0x27ab13,_0x01d6('0xe'),JSON[_0x01d6('0x11')](_0x26c65a));if(_0x26c65a[_0x01d6('0x12')]){if(_0x26c65a[_0x01d6('0x12')][_0x01d6('0x13')]===0x1f4){logger[_0x01d6('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27ab13,_0x26c65a[_0x01d6('0x12')]['message']);return _0x2cad56(_0x26c65a['error'][_0x01d6('0x14')]);}logger[_0x01d6('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27ab13,_0x26c65a[_0x01d6('0x12')][_0x01d6('0x14')]);return _0xe66308(_0x26c65a[_0x01d6('0x12')][_0x01d6('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x27ab13,'request\x20sent');_0xe66308(_0x26c65a[_0x01d6('0x15')][_0x01d6('0x14')]);}})[_0x01d6('0x16')](function(_0x3cd744){logger[_0x01d6('0x12')](_0x01d6('0xd'),_0x27ab13,_0x3cd744);_0x2cad56(_0x3cd744);});});} \ No newline at end of file +var _0xb598=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb598,0x14b));var _0x8b59=function(_0x21d825,_0x5026f0){_0x21d825=_0x21d825-0x0;var _0x44deb2=_0xb598[_0x21d825];return _0x44deb2;};'use strict';var _=require(_0x8b59('0x0'));var util=require(_0x8b59('0x1'));var moment=require('moment');var BPromise=require(_0x8b59('0x2'));var rs=require(_0x8b59('0x3'));var fs=require('fs');var Redis=require(_0x8b59('0x4'));var db=require(_0x8b59('0x5'))['db'];var utils=require(_0x8b59('0x6'));var logger=require(_0x8b59('0x7'))('rpc');var config=require(_0x8b59('0x8'));var jayson=require(_0x8b59('0x9'));var client=jayson[_0x8b59('0xa')][_0x8b59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x89725,_0x18f8d7,_0x51dcfe){return new BPromise(function(_0x1db6d2,_0x5b7e5a){return client[_0x8b59('0xc')](_0x89725,_0x51dcfe)[_0x8b59('0xd')](function(_0x4ebf10){logger['info'](_0x8b59('0xe'),_0x18f8d7,'request\x20sent');logger[_0x8b59('0xf')](_0x8b59('0x10'),_0x18f8d7,_0x8b59('0x11'),JSON[_0x8b59('0x12')](_0x4ebf10));if(_0x4ebf10[_0x8b59('0x13')]){if(_0x4ebf10[_0x8b59('0x13')][_0x8b59('0x14')]===0x1f4){logger[_0x8b59('0x13')](_0x8b59('0xe'),_0x18f8d7,_0x4ebf10[_0x8b59('0x13')]['message']);return _0x5b7e5a(_0x4ebf10[_0x8b59('0x13')][_0x8b59('0x15')]);}logger[_0x8b59('0x13')](_0x8b59('0xe'),_0x18f8d7,_0x4ebf10[_0x8b59('0x13')][_0x8b59('0x15')]);return _0x1db6d2(_0x4ebf10[_0x8b59('0x13')][_0x8b59('0x15')]);}else{logger[_0x8b59('0x16')](_0x8b59('0xe'),_0x18f8d7,'request\x20sent');_0x1db6d2(_0x4ebf10['result'][_0x8b59('0x15')]);}})[_0x8b59('0x17')](function(_0x3507a0){logger[_0x8b59('0x13')](_0x8b59('0xe'),_0x18f8d7,_0x3507a0);_0x5b7e5a(_0x3507a0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 69c9647..abd3439 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 _0xf874=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf874,0xed));var _0x4f87=function(_0x62a361,_0x15b95b){_0x62a361=_0x62a361-0x0;var _0x5802d0=_0xf874[_0x62a361];return _0x5802d0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f87('0x0'));var timeout=require(_0x4f87('0x1'));var express=require(_0x4f87('0x2'));var router=express[_0x4f87('0x3')]();var fs_extra=require(_0x4f87('0x4'));var auth=require(_0x4f87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4f87('0x6'));var controller=require(_0x4f87('0x7'));router[_0x4f87('0x8')]('/',auth[_0x4f87('0x9')](),controller[_0x4f87('0xa')]);router[_0x4f87('0x8')]('/:id',auth[_0x4f87('0x9')](),controller[_0x4f87('0xb')]);router['post']('/',auth[_0x4f87('0x9')](),controller[_0x4f87('0xc')]);router['put'](_0x4f87('0xd'),auth[_0x4f87('0x9')](),controller[_0x4f87('0xe')]);router[_0x4f87('0xf')](_0x4f87('0xd'),auth[_0x4f87('0x9')](),controller[_0x4f87('0x10')]);module['exports']=router; \ No newline at end of file +var _0xac7f=['/:id','isAuthenticated','post','create','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0x574a9f,_0x147792){var _0x5f003e=function(_0x1c9ffb){while(--_0x1c9ffb){_0x574a9f['push'](_0x574a9f['shift']());}};_0x5f003e(++_0x147792);}(_0xac7f,0x1e2));var _0xfac7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xac7f[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xfac7('0x0'));var util=require('util');var path=require(_0xfac7('0x1'));var timeout=require(_0xfac7('0x2'));var express=require(_0xfac7('0x3'));var router=express['Router']();var fs_extra=require(_0xfac7('0x4'));var auth=require(_0xfac7('0x5'));var interaction=require(_0xfac7('0x6'));var config=require(_0xfac7('0x7'));var controller=require(_0xfac7('0x8'));router[_0xfac7('0x9')]('/',auth['isAuthenticated'](),controller[_0xfac7('0xa')]);router['get'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['show']);router[_0xfac7('0xd')]('/',auth[_0xfac7('0xc')](),controller[_0xfac7('0xe')]);router['put'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['update']);router['delete'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller[_0xfac7('0xf')]);module[_0xfac7('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 8e68e2b..5a62c19 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 _0x788c=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x46c5c6,_0x214300){var _0x2f703a=function(_0x269408){while(--_0x269408){_0x46c5c6['push'](_0x46c5c6['shift']());}};_0x2f703a(++_0x214300);}(_0x788c,0x173));var _0xc788=function(_0x11cfc5,_0x49fb19){_0x11cfc5=_0x11cfc5-0x0;var _0x182210=_0x788c[_0x11cfc5];return _0x182210;};'use strict';var Sequelize=require(_0xc788('0x0'));module[_0xc788('0x1')]={'type':{'type':Sequelize[_0xc788('0x2')](_0xc788('0x3'),_0xc788('0x4'),_0xc788('0x5'),_0xc788('0x6'),_0xc788('0x7')),'defaultValue':_0xc788('0x3')},'content':{'type':Sequelize[_0xc788('0x8')]},'key':{'type':Sequelize[_0xc788('0x8')]},'keyType':{'type':Sequelize[_0xc788('0x2')](_0xc788('0x3'),_0xc788('0x4'),_0xc788('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc788('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc788('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51f6=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x30a07e,_0x2354e5){var _0x173ced=function(_0x4e404c){while(--_0x4e404c){_0x30a07e['push'](_0x30a07e['shift']());}};_0x173ced(++_0x2354e5);}(_0x51f6,0xde));var _0x651f=function(_0x2ab1e8,_0x3a025b){_0x2ab1e8=_0x2ab1e8-0x0;var _0x2d0462=_0x51f6[_0x2ab1e8];return _0x2d0462;};'use strict';var Sequelize=require('sequelize');module[_0x651f('0x0')]={'type':{'type':Sequelize[_0x651f('0x1')](_0x651f('0x2'),_0x651f('0x3'),_0x651f('0x4'),_0x651f('0x5'),_0x651f('0x6')),'defaultValue':_0x651f('0x2')},'content':{'type':Sequelize[_0x651f('0x7')]},'key':{'type':Sequelize[_0x651f('0x7')]},'keyType':{'type':Sequelize[_0x651f('0x1')]('string',_0x651f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x651f('0x7')]},'idField':{'type':Sequelize[_0x651f('0x7')]},'nameField':{'type':Sequelize[_0x651f('0x7')]},'customField':{'type':Sequelize[_0x651f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x651f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d0d2a60..bff7b9c 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 _0x3c8b=['model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key'];(function(_0x3438e0,_0x1f4440){var _0x42ae72=function(_0x42bc87){while(--_0x42bc87){_0x3438e0['push'](_0x3438e0['shift']());}};_0x42ae72(++_0x1f4440);}(_0x3c8b,0x64));var _0xb3c8=function(_0x1653ae,_0x59f179){_0x1653ae=_0x1653ae-0x0;var _0x984ae5=_0x3c8b[_0x1653ae];return _0x984ae5;};'use strict';var emlformat=require(_0xb3c8('0x0'));var rimraf=require(_0xb3c8('0x1'));var zipdir=require(_0xb3c8('0x2'));var jsonpatch=require(_0xb3c8('0x3'));var rp=require('request-promise');var moment=require(_0xb3c8('0x4'));var BPromise=require(_0xb3c8('0x5'));var Mustache=require('mustache');var util=require(_0xb3c8('0x6'));var path=require(_0xb3c8('0x7'));var sox=require(_0xb3c8('0x8'));var csv=require(_0xb3c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3c8('0xa'));var squel=require(_0xb3c8('0xb'));var crypto=require(_0xb3c8('0xc'));var jsforce=require(_0xb3c8('0xd'));var deskjs=require(_0xb3c8('0xe'));var toCsv=require(_0xb3c8('0x9'));var querystring=require(_0xb3c8('0xf'));var Papa=require(_0xb3c8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb3c8('0x11'));var hardwareService=require(_0xb3c8('0x12'));var logger=require('../../config/logger')(_0xb3c8('0x13'));var utils=require('../../config/utils');var config=require(_0xb3c8('0x14'));var licenseUtil=require(_0xb3c8('0x15'));var db=require(_0xb3c8('0x16'))['db'];function respondWithStatusCode(_0x91de73,_0x579e74){_0x579e74=_0x579e74||0xcc;return function(_0x270321){if(_0x270321){return _0x91de73[_0xb3c8('0x17')](_0x579e74);}return _0x91de73['status'](_0x579e74)[_0xb3c8('0x18')]();};}function respondWithResult(_0x3e7614,_0x2a2603){_0x2a2603=_0x2a2603||0xc8;return function(_0x301482){if(_0x301482){return _0x3e7614['status'](_0x2a2603)[_0xb3c8('0x19')](_0x301482);}};}function respondWithFilteredResult(_0x274559,_0x4b251f){return function(_0xb3a949){if(_0xb3a949){var _0x16d0f5=typeof _0x4b251f[_0xb3c8('0x1a')]===_0xb3c8('0x1b')&&typeof _0x4b251f[_0xb3c8('0x1c')]===_0xb3c8('0x1b');var _0x569f3d=_0xb3a949[_0xb3c8('0x1d')];var _0x32de7b=_0x16d0f5?0x0:_0x4b251f[_0xb3c8('0x1a')];var _0x128782=_0x16d0f5?_0xb3a949['count']:_0x4b251f[_0xb3c8('0x1a')]+_0x4b251f[_0xb3c8('0x1c')];var _0xed4daa;if(_0x128782>=_0x569f3d){_0x128782=_0x569f3d;_0xed4daa=0xc8;}else{_0xed4daa=0xce;}_0x274559[_0xb3c8('0x1e')](_0xed4daa);return _0x274559['set'](_0xb3c8('0x1f'),_0x32de7b+'-'+_0x128782+'/'+_0x569f3d)[_0xb3c8('0x19')](_0xb3a949);}return null;};}function patchUpdates(_0xdad422){return function(_0x3c6fe8){try{jsonpatch[_0xb3c8('0x20')](_0x3c6fe8,_0xdad422,!![]);}catch(_0x56b39c){return BPromise[_0xb3c8('0x21')](_0x56b39c);}return _0x3c6fe8[_0xb3c8('0x22')]();};}function saveUpdates(_0x247c60,_0x1e48fc){return function(_0x3fd182){if(_0x3fd182){return _0x3fd182[_0xb3c8('0x23')](_0x247c60)['then'](function(_0x497ce7){return _0x497ce7;});}return null;};}function removeEntity(_0x4f18e5,_0x1cdc43){return function(_0x232ab6){if(_0x232ab6){return _0x232ab6[_0xb3c8('0x24')]()[_0xb3c8('0x25')](function(){_0x4f18e5[_0xb3c8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ca59,_0x3770d9){return function(_0x3a373a){if(!_0x3a373a){_0x43ca59['sendStatus'](0x194);}return _0x3a373a;};}function handleError(_0x3b3c50,_0x56fb4e){_0x56fb4e=_0x56fb4e||0x1f4;return function(_0x58142e){logger[_0xb3c8('0x26')](_0x58142e[_0xb3c8('0x27')]);if(_0x58142e[_0xb3c8('0x28')]){delete _0x58142e[_0xb3c8('0x28')];}_0x3b3c50[_0xb3c8('0x1e')](_0x56fb4e)['send'](_0x58142e);};}exports[_0xb3c8('0x29')]=function(_0x5d8a14,_0x1de2f5){var _0x1fdf22={},_0x4f003c={},_0x4887f4={'count':0x0,'rows':[]};var _0x5b66d4=_[_0xb3c8('0x2a')](db[_0xb3c8('0x2b')][_0xb3c8('0x2c')],function(_0x505035){return{'name':_0x505035[_0xb3c8('0x2d')],'type':_0x505035[_0xb3c8('0x2e')][_0xb3c8('0x2f')]};});_0x4f003c[_0xb3c8('0x30')]=_['map'](_0x5b66d4,_0xb3c8('0x28'));_0x4f003c[_0xb3c8('0x31')]=_[_0xb3c8('0x32')](_0x5d8a14['query']);_0x4f003c[_0xb3c8('0x33')]=_['intersection'](_0x4f003c[_0xb3c8('0x30')],_0x4f003c['query']);_0x1fdf22['attributes']=_[_0xb3c8('0x34')](_0x4f003c['model'],qs[_0xb3c8('0x35')](_0x5d8a14[_0xb3c8('0x31')]['fields']));_0x1fdf22['attributes']=_0x1fdf22[_0xb3c8('0x36')]['length']?_0x1fdf22[_0xb3c8('0x36')]:_0x4f003c['model'];if(!_0x5d8a14[_0xb3c8('0x31')][_0xb3c8('0x37')](_0xb3c8('0x38'))){_0x1fdf22['limit']=qs[_0xb3c8('0x1c')](_0x5d8a14[_0xb3c8('0x31')][_0xb3c8('0x1c')]);_0x1fdf22['offset']=qs[_0xb3c8('0x1a')](_0x5d8a14[_0xb3c8('0x31')][_0xb3c8('0x1a')]);}_0x1fdf22[_0xb3c8('0x39')]=qs['sort'](_0x5d8a14[_0xb3c8('0x31')][_0xb3c8('0x3a')]);_0x1fdf22[_0xb3c8('0x3b')]=qs[_0xb3c8('0x33')](_['pick'](_0x5d8a14[_0xb3c8('0x31')],_0x4f003c['filters']),_0x5b66d4);if(_0x5d8a14['query'][_0xb3c8('0x3c')]){_0x1fdf22[_0xb3c8('0x3b')]=_['merge'](_0x1fdf22[_0xb3c8('0x3b')],{'$or':_[_0xb3c8('0x2a')](_0x5b66d4,function(_0x46945e){if(_0x46945e[_0xb3c8('0x2e')]!==_0xb3c8('0x3d')){var _0x43052b={};_0x43052b[_0x46945e['name']]={'$like':'%'+_0x5d8a14[_0xb3c8('0x31')][_0xb3c8('0x3c')]+'%'};return _0x43052b;}})});}_0x1fdf22=_[_0xb3c8('0x3e')]({},_0x1fdf22,_0x5d8a14[_0xb3c8('0x3f')]);var _0x3f1579={'where':_0x1fdf22[_0xb3c8('0x3b')]};return db[_0xb3c8('0x2b')][_0xb3c8('0x1d')](_0x3f1579)[_0xb3c8('0x25')](function(_0x99382b){_0x4887f4['count']=_0x99382b;if(_0x5d8a14['query'][_0xb3c8('0x40')]){_0x1fdf22[_0xb3c8('0x41')]=[{'all':!![]}];}return db[_0xb3c8('0x2b')][_0xb3c8('0x42')](_0x1fdf22);})[_0xb3c8('0x25')](function(_0x544beb){_0x4887f4[_0xb3c8('0x43')]=_0x544beb;return _0x4887f4;})[_0xb3c8('0x25')](respondWithFilteredResult(_0x1de2f5,_0x1fdf22))[_0xb3c8('0x44')](handleError(_0x1de2f5,null));};exports[_0xb3c8('0x45')]=function(_0x569079,_0x5d7fec){var _0x3fd090={'raw':!![],'where':{'id':_0x569079['params']['id']}},_0x59eeab={};_0x59eeab[_0xb3c8('0x30')]=_[_0xb3c8('0x32')](db[_0xb3c8('0x2b')][_0xb3c8('0x2c')]);_0x59eeab[_0xb3c8('0x31')]=_[_0xb3c8('0x32')](_0x569079[_0xb3c8('0x31')]);_0x59eeab['filters']=_[_0xb3c8('0x34')](_0x59eeab[_0xb3c8('0x30')],_0x59eeab[_0xb3c8('0x31')]);_0x3fd090[_0xb3c8('0x36')]=_[_0xb3c8('0x34')](_0x59eeab[_0xb3c8('0x30')],qs['fields'](_0x569079['query'][_0xb3c8('0x35')]));_0x3fd090[_0xb3c8('0x36')]=_0x3fd090[_0xb3c8('0x36')]['length']?_0x3fd090[_0xb3c8('0x36')]:_0x59eeab['model'];if(_0x569079[_0xb3c8('0x31')]['includeAll']){_0x3fd090['include']=[{'all':!![]}];}_0x3fd090=_['merge']({},_0x3fd090,_0x569079['options']);return db['FreshsalesField'][_0xb3c8('0x46')](_0x3fd090)['then'](handleEntityNotFound(_0x5d7fec,null))[_0xb3c8('0x25')](respondWithResult(_0x5d7fec,null))['catch'](handleError(_0x5d7fec,null));};exports[_0xb3c8('0x47')]=function(_0xa06571,_0x5ca7a2){return db[_0xb3c8('0x2b')]['create'](_0xa06571[_0xb3c8('0x48')],{})[_0xb3c8('0x25')](respondWithResult(_0x5ca7a2,0xc9))['catch'](handleError(_0x5ca7a2,null));};exports['update']=function(_0x5d474e,_0x37c87e){if(_0x5d474e[_0xb3c8('0x48')]['id']){delete _0x5d474e[_0xb3c8('0x48')]['id'];}return db[_0xb3c8('0x2b')][_0xb3c8('0x46')]({'where':{'id':_0x5d474e[_0xb3c8('0x49')]['id']}})[_0xb3c8('0x25')](handleEntityNotFound(_0x37c87e,null))['then'](saveUpdates(_0x5d474e[_0xb3c8('0x48')],null))[_0xb3c8('0x25')](respondWithResult(_0x37c87e,null))['catch'](handleError(_0x37c87e,null));};exports['destroy']=function(_0x4b00c4,_0x5952dc){return db[_0xb3c8('0x2b')][_0xb3c8('0x46')]({'where':{'id':_0x4b00c4[_0xb3c8('0x49')]['id']}})[_0xb3c8('0x25')](handleEntityNotFound(_0x5952dc,null))[_0xb3c8('0x25')](removeEntity(_0x5952dc,null))[_0xb3c8('0x44')](handleError(_0x5952dc,null));}; \ No newline at end of file +var _0x7796=['body','find','rimraf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','FreshsalesField','rows','catch','show','params','rawAttributes','includeAll','include','create'];(function(_0x4a7d35,_0x30b4d3){var _0x2a15cc=function(_0x1dd8ef){while(--_0x1dd8ef){_0x4a7d35['push'](_0x4a7d35['shift']());}};_0x2a15cc(++_0x30b4d3);}(_0x7796,0x12a));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6779('0x0'));var zipdir=require(_0x6779('0x1'));var jsonpatch=require(_0x6779('0x2'));var rp=require('request-promise');var moment=require(_0x6779('0x3'));var BPromise=require(_0x6779('0x4'));var Mustache=require(_0x6779('0x5'));var util=require(_0x6779('0x6'));var path=require(_0x6779('0x7'));var sox=require(_0x6779('0x8'));var csv=require(_0x6779('0x9'));var ejs=require(_0x6779('0xa'));var fs=require('fs');var fs_extra=require(_0x6779('0xb'));var _=require(_0x6779('0xc'));var squel=require('squel');var crypto=require(_0x6779('0xd'));var jsforce=require(_0x6779('0xe'));var deskjs=require(_0x6779('0xf'));var toCsv=require(_0x6779('0x9'));var querystring=require(_0x6779('0x10'));var Papa=require(_0x6779('0x11'));var Redis=require(_0x6779('0x12'));var authService=require(_0x6779('0x13'));var qs=require(_0x6779('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6779('0x15'));var logger=require(_0x6779('0x16'))(_0x6779('0x17'));var utils=require(_0x6779('0x18'));var config=require(_0x6779('0x19'));var licenseUtil=require(_0x6779('0x1a'));var db=require(_0x6779('0x1b'))['db'];function respondWithStatusCode(_0x3fcffa,_0x127423){_0x127423=_0x127423||0xcc;return function(_0x40b650){if(_0x40b650){return _0x3fcffa['sendStatus'](_0x127423);}return _0x3fcffa[_0x6779('0x1c')](_0x127423)[_0x6779('0x1d')]();};}function respondWithResult(_0x427091,_0x5860e3){_0x5860e3=_0x5860e3||0xc8;return function(_0x26b16e){if(_0x26b16e){return _0x427091[_0x6779('0x1c')](_0x5860e3)[_0x6779('0x1e')](_0x26b16e);}};}function respondWithFilteredResult(_0x442c49,_0x2cfa9d){return function(_0x48668b){if(_0x48668b){var _0x997b74=typeof _0x2cfa9d['offset']===_0x6779('0x1f')&&typeof _0x2cfa9d[_0x6779('0x20')]==='undefined';var _0x31d5a9=_0x48668b['count'];var _0x238649=_0x997b74?0x0:_0x2cfa9d[_0x6779('0x21')];var _0x5b7542=_0x997b74?_0x48668b[_0x6779('0x22')]:_0x2cfa9d[_0x6779('0x21')]+_0x2cfa9d[_0x6779('0x20')];var _0x2c8f2f;if(_0x5b7542>=_0x31d5a9){_0x5b7542=_0x31d5a9;_0x2c8f2f=0xc8;}else{_0x2c8f2f=0xce;}_0x442c49[_0x6779('0x1c')](_0x2c8f2f);return _0x442c49[_0x6779('0x23')](_0x6779('0x24'),_0x238649+'-'+_0x5b7542+'/'+_0x31d5a9)['json'](_0x48668b);}return null;};}function patchUpdates(_0xad5fcf){return function(_0x3bad4c){try{jsonpatch['apply'](_0x3bad4c,_0xad5fcf,!![]);}catch(_0x3566d9){return BPromise[_0x6779('0x25')](_0x3566d9);}return _0x3bad4c['save']();};}function saveUpdates(_0x1a8f13,_0x3dbcd4){return function(_0xfd9e27){if(_0xfd9e27){return _0xfd9e27['update'](_0x1a8f13)[_0x6779('0x26')](function(_0x29f8ef){return _0x29f8ef;});}return null;};}function removeEntity(_0x23ca58,_0x5b2b40){return function(_0x5a2d92){if(_0x5a2d92){return _0x5a2d92[_0x6779('0x27')]()[_0x6779('0x26')](function(){_0x23ca58[_0x6779('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x418da8,_0x2dfdaa){return function(_0x2628e8){if(!_0x2628e8){_0x418da8[_0x6779('0x28')](0x194);}return _0x2628e8;};}function handleError(_0x456eb6,_0x3bf1a6){_0x3bf1a6=_0x3bf1a6||0x1f4;return function(_0x501359){logger['error'](_0x501359[_0x6779('0x29')]);if(_0x501359['name']){delete _0x501359[_0x6779('0x2a')];}_0x456eb6['status'](_0x3bf1a6)[_0x6779('0x2b')](_0x501359);};}exports[_0x6779('0x2c')]=function(_0x5bcc23,_0x153faa){var _0x9b3890={},_0xba5eec={},_0x35bf76={'count':0x0,'rows':[]};var _0x55a08e=_[_0x6779('0x2d')](db['FreshsalesField']['rawAttributes'],function(_0x19113c){return{'name':_0x19113c[_0x6779('0x2e')],'type':_0x19113c[_0x6779('0x2f')][_0x6779('0x30')]};});_0xba5eec[_0x6779('0x31')]=_[_0x6779('0x2d')](_0x55a08e,'name');_0xba5eec[_0x6779('0x32')]=_[_0x6779('0x33')](_0x5bcc23[_0x6779('0x32')]);_0xba5eec['filters']=_[_0x6779('0x34')](_0xba5eec[_0x6779('0x31')],_0xba5eec[_0x6779('0x32')]);_0x9b3890[_0x6779('0x35')]=_[_0x6779('0x34')](_0xba5eec[_0x6779('0x31')],qs[_0x6779('0x36')](_0x5bcc23[_0x6779('0x32')]['fields']));_0x9b3890[_0x6779('0x35')]=_0x9b3890[_0x6779('0x35')][_0x6779('0x37')]?_0x9b3890[_0x6779('0x35')]:_0xba5eec[_0x6779('0x31')];if(!_0x5bcc23[_0x6779('0x32')][_0x6779('0x38')]('nolimit')){_0x9b3890[_0x6779('0x20')]=qs[_0x6779('0x20')](_0x5bcc23['query'][_0x6779('0x20')]);_0x9b3890[_0x6779('0x21')]=qs['offset'](_0x5bcc23['query'][_0x6779('0x21')]);}_0x9b3890[_0x6779('0x39')]=qs[_0x6779('0x3a')](_0x5bcc23['query'][_0x6779('0x3a')]);_0x9b3890[_0x6779('0x3b')]=qs[_0x6779('0x3c')](_['pick'](_0x5bcc23[_0x6779('0x32')],_0xba5eec['filters']),_0x55a08e);if(_0x5bcc23[_0x6779('0x32')][_0x6779('0x3d')]){_0x9b3890[_0x6779('0x3b')]=_[_0x6779('0x3e')](_0x9b3890[_0x6779('0x3b')],{'$or':_[_0x6779('0x2d')](_0x55a08e,function(_0x53608c){if(_0x53608c[_0x6779('0x2f')]!=='VIRTUAL'){var _0x148867={};_0x148867[_0x53608c[_0x6779('0x2a')]]={'$like':'%'+_0x5bcc23[_0x6779('0x32')][_0x6779('0x3d')]+'%'};return _0x148867;}})});}_0x9b3890=_[_0x6779('0x3e')]({},_0x9b3890,_0x5bcc23['options']);var _0x54f2f9={'where':_0x9b3890['where']};return db[_0x6779('0x3f')][_0x6779('0x22')](_0x54f2f9)[_0x6779('0x26')](function(_0x407ad4){_0x35bf76[_0x6779('0x22')]=_0x407ad4;if(_0x5bcc23[_0x6779('0x32')]['includeAll']){_0x9b3890['include']=[{'all':!![]}];}return db[_0x6779('0x3f')]['findAll'](_0x9b3890);})['then'](function(_0x8e0e62){_0x35bf76[_0x6779('0x40')]=_0x8e0e62;return _0x35bf76;})['then'](respondWithFilteredResult(_0x153faa,_0x9b3890))[_0x6779('0x41')](handleError(_0x153faa,null));};exports[_0x6779('0x42')]=function(_0x3b1eaa,_0x198b8f){var _0x38a826={'raw':!![],'where':{'id':_0x3b1eaa[_0x6779('0x43')]['id']}},_0x5b8144={};_0x5b8144[_0x6779('0x31')]=_[_0x6779('0x33')](db[_0x6779('0x3f')][_0x6779('0x44')]);_0x5b8144[_0x6779('0x32')]=_[_0x6779('0x33')](_0x3b1eaa['query']);_0x5b8144['filters']=_['intersection'](_0x5b8144[_0x6779('0x31')],_0x5b8144[_0x6779('0x32')]);_0x38a826['attributes']=_['intersection'](_0x5b8144['model'],qs[_0x6779('0x36')](_0x3b1eaa['query'][_0x6779('0x36')]));_0x38a826[_0x6779('0x35')]=_0x38a826['attributes'][_0x6779('0x37')]?_0x38a826['attributes']:_0x5b8144[_0x6779('0x31')];if(_0x3b1eaa[_0x6779('0x32')][_0x6779('0x45')]){_0x38a826[_0x6779('0x46')]=[{'all':!![]}];}_0x38a826=_[_0x6779('0x3e')]({},_0x38a826,_0x3b1eaa['options']);return db[_0x6779('0x3f')]['find'](_0x38a826)[_0x6779('0x26')](handleEntityNotFound(_0x198b8f,null))[_0x6779('0x26')](respondWithResult(_0x198b8f,null))[_0x6779('0x41')](handleError(_0x198b8f,null));};exports['create']=function(_0x2b7bf0,_0x256b7f){return db['FreshsalesField'][_0x6779('0x47')](_0x2b7bf0[_0x6779('0x48')],{})[_0x6779('0x26')](respondWithResult(_0x256b7f,0xc9))['catch'](handleError(_0x256b7f,null));};exports['update']=function(_0x2f2320,_0x3457e7){if(_0x2f2320[_0x6779('0x48')]['id']){delete _0x2f2320[_0x6779('0x48')]['id'];}return db[_0x6779('0x3f')]['find']({'where':{'id':_0x2f2320[_0x6779('0x43')]['id']}})[_0x6779('0x26')](handleEntityNotFound(_0x3457e7,null))[_0x6779('0x26')](saveUpdates(_0x2f2320[_0x6779('0x48')],null))[_0x6779('0x26')](respondWithResult(_0x3457e7,null))[_0x6779('0x41')](handleError(_0x3457e7,null));};exports['destroy']=function(_0x418c47,_0x4567f2){return db[_0x6779('0x3f')][_0x6779('0x49')]({'where':{'id':_0x418c47[_0x6779('0x43')]['id']}})[_0x6779('0x26')](handleEntityNotFound(_0x4567f2,null))[_0x6779('0x26')](removeEntity(_0x4567f2,null))['catch'](handleError(_0x4567f2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 81290d2..8744ae0 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 _0xd914=['rimraf','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xd8497f,_0x56fe20){var _0x1163c1=function(_0xaed758){while(--_0xaed758){_0xd8497f['push'](_0xd8497f['shift']());}};_0x1163c1(++_0x56fe20);}(_0xd914,0x17f));var _0x4d91=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0xd914[_0x1bc762];return _0x40f70c;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[{'name':_0x4d91('0xc'),'fields':[_0x4d91('0xd'),_0x4d91('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4813=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','freshsales_unique_index','FieldId'];(function(_0x1462e6,_0x548b61){var _0xc130d0=function(_0x2dbfbc){while(--_0x2dbfbc){_0x1462e6['push'](_0x1462e6['shift']());}};_0xc130d0(++_0x548b61);}(_0x4813,0xdc));var _0x3481=function(_0x311fa0,_0xa06b58){_0x311fa0=_0x311fa0-0x0;var _0x3553ad=_0x4813[_0x311fa0];return _0x3553ad;};'use strict';var _=require(_0x3481('0x0'));var util=require('util');var logger=require(_0x3481('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3481('0x2'));var rp=require(_0x3481('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3481('0x4'));var config=require(_0x3481('0x5'));var attributes=require(_0x3481('0x6'));module[_0x3481('0x7')]=function(_0x42114d,_0x322ab3){return _0x42114d[_0x3481('0x8')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x3481('0x9'),'fields':['idField',_0x3481('0xa')],'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 e5fa94d..e0eff95 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5ee0ef,_0x34f2b1){var _0x144aab=function(_0x39f698){while(--_0x39f698){_0x5ee0ef['push'](_0x5ee0ef['shift']());}};_0x144aab(++_0x34f2b1);}(_0x33af,0xec));var _0xf33a=function(_0x1c490a,_0x217f34){_0x1c490a=_0x1c490a-0x0;var _0x1e0b1d=_0x33af[_0x1c490a];return _0x1e0b1d;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0x46ed=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 6ac9c2d..20692fb 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4f49a7,_0x1606f8){var _0x2687d0=function(_0x3fef6c){while(--_0x3fef6c){_0x4f49a7['push'](_0x4f49a7['shift']());}};_0x2687d0(++_0x1606f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x399d1c,_0x2c79ea){var _0x92e8c6=function(_0xd526e9){while(--_0xd526e9){_0x399d1c['push'](_0x399d1c['shift']());}};_0x92e8c6(++_0x2c79ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0bee23d..bcf89ec 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 _0x3ece=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x3ece,0x10e));var _0xe3ec=function(_0x406274,_0x1b729e){_0x406274=_0x406274-0x0;var _0x2e37bd=_0x3ece[_0x406274];return _0x2e37bd;};'use strict';var Sequelize=require(_0xe3ec('0x0'));module[_0xe3ec('0x1')]={'name':{'type':Sequelize[_0xe3ec('0x2')]},'description':{'type':Sequelize[_0xe3ec('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe3ec('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe3ec('0x2')]},'clientId':{'type':Sequelize[_0xe3ec('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xe3ec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe3ec('0x4')](_0xe3ec('0x5'),_0xe3ec('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc2f4=['exports','STRING','username','ENUM','integrationTab','sequelize'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc2f4,0x107));var _0x4c2f=function(_0x5459c1,_0x36f6f0){_0x5459c1=_0x5459c1-0x0;var _0x3f99b5=_0xc2f4[_0x5459c1];return _0x3f99b5;};'use strict';var Sequelize=require(_0x4c2f('0x0'));module[_0x4c2f('0x1')]={'name':{'type':Sequelize[_0x4c2f('0x2')]},'description':{'type':Sequelize[_0x4c2f('0x2')]},'username':{'type':Sequelize[_0x4c2f('0x2')],'unique':_0x4c2f('0x3')},'remoteUri':{'type':Sequelize[_0x4c2f('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4c2f('0x2')]},'clientSecret':{'type':Sequelize[_0x4c2f('0x2')]},'securityToken':{'type':Sequelize[_0x4c2f('0x2')]},'serverUrl':{'type':Sequelize[_0x4c2f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4c2f('0x4')](_0x4c2f('0x5'),'newTab'),'defaultValue':_0x4c2f('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8097771..6bb3992 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 _0x7b3d=['../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','Description','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','True','false','test','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2cae9a,_0x19779b){var _0x1a63a0=function(_0x3a1970){while(--_0x3a1970){_0x2cae9a['push'](_0x2cae9a['shift']());}};_0x1a63a0(++_0x19779b);}(_0x7b3d,0x1cf));var _0xd7b3=function(_0x2f9fbd,_0x4a19fe){_0x2f9fbd=_0x2f9fbd-0x0;var _0x2a8041=_0x7b3d[_0x2f9fbd];return _0x2a8041;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7b3('0x0'));var zipdir=require(_0xd7b3('0x1'));var jsonpatch=require(_0xd7b3('0x2'));var rp=require(_0xd7b3('0x3'));var moment=require(_0xd7b3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd7b3('0x5'));var util=require('util');var path=require(_0xd7b3('0x6'));var sox=require(_0xd7b3('0x7'));var csv=require(_0xd7b3('0x8'));var ejs=require(_0xd7b3('0x9'));var fs=require('fs');var fs_extra=require(_0xd7b3('0xa'));var _=require(_0xd7b3('0xb'));var squel=require('squel');var crypto=require(_0xd7b3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd7b3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd7b3('0xe'));var Papa=require(_0xd7b3('0xf'));var Redis=require(_0xd7b3('0x10'));var authService=require(_0xd7b3('0x11'));var qs=require(_0xd7b3('0x12'));var as=require(_0xd7b3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7b3('0x14'))('api');var utils=require(_0xd7b3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd7b3('0x16'))['db'];var integrations=require(_0xd7b3('0x17'));function respondWithStatusCode(_0x390d65,_0x59e32a){_0x59e32a=_0x59e32a||0xcc;return function(_0x51aec9){if(_0x51aec9){return _0x390d65[_0xd7b3('0x18')](_0x59e32a);}return _0x390d65[_0xd7b3('0x19')](_0x59e32a)['end']();};}function respondWithResult(_0x331597,_0x42baf0){_0x42baf0=_0x42baf0||0xc8;return function(_0x59fd67){if(_0x59fd67){return _0x331597[_0xd7b3('0x19')](_0x42baf0)[_0xd7b3('0x1a')](_0x59fd67);}};}function respondWithFilteredResult(_0x2ba2f3,_0x22be79){return function(_0x239a42){if(_0x239a42){var _0x1b364b=typeof _0x22be79[_0xd7b3('0x1b')]===_0xd7b3('0x1c')&&typeof _0x22be79[_0xd7b3('0x1d')]===_0xd7b3('0x1c');var _0x5c1cea=_0x239a42['count'];var _0x4936ff=_0x1b364b?0x0:_0x22be79[_0xd7b3('0x1b')];var _0x49b9e5=_0x1b364b?_0x239a42['count']:_0x22be79['offset']+_0x22be79[_0xd7b3('0x1d')];var _0x40faae;if(_0x49b9e5>=_0x5c1cea){_0x49b9e5=_0x5c1cea;_0x40faae=0xc8;}else{_0x40faae=0xce;}_0x2ba2f3[_0xd7b3('0x19')](_0x40faae);return _0x2ba2f3[_0xd7b3('0x1e')](_0xd7b3('0x1f'),_0x4936ff+'-'+_0x49b9e5+'/'+_0x5c1cea)['json'](_0x239a42);}return null;};}function patchUpdates(_0x387dd4){return function(_0x557e56){try{jsonpatch[_0xd7b3('0x20')](_0x557e56,_0x387dd4,!![]);}catch(_0x47668b){return BPromise[_0xd7b3('0x21')](_0x47668b);}return _0x557e56[_0xd7b3('0x22')]();};}function saveUpdates(_0x5a64b9,_0x4839c6){return function(_0x56632b){if(_0x56632b){return _0x56632b['update'](_0x5a64b9)[_0xd7b3('0x23')](function(_0xd366b4){return _0xd366b4;});}return null;};}function removeEntity(_0x35725f,_0x55b778){return function(_0x5bb263){if(_0x5bb263){return _0x5bb263[_0xd7b3('0x24')]()[_0xd7b3('0x23')](function(){_0x35725f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x410cc6,_0x181566){return function(_0x194071){if(!_0x194071){_0x410cc6['sendStatus'](0x194);}return _0x194071;};}function handleError(_0x5e3363,_0x24894b){_0x24894b=_0x24894b||0x1f4;return function(_0x3c0356){logger[_0xd7b3('0x25')](_0x3c0356[_0xd7b3('0x26')]);if(_0x3c0356[_0xd7b3('0x27')]){delete _0x3c0356['name'];}_0x5e3363[_0xd7b3('0x19')](_0x24894b)['send'](_0x3c0356);};}exports[_0xd7b3('0x28')]=function(_0xe409d4,_0x5b8e33){var _0x120893={},_0x10f3a0={},_0x5c7e2f={'count':0x0,'rows':[]};var _0x311c26=_[_0xd7b3('0x29')](db[_0xd7b3('0x2a')][_0xd7b3('0x2b')],function(_0xb1b40c){return{'name':_0xb1b40c[_0xd7b3('0x2c')],'type':_0xb1b40c[_0xd7b3('0x2d')]['key']};});_0x10f3a0[_0xd7b3('0x2e')]=_['map'](_0x311c26,'name');_0x10f3a0['query']=_[_0xd7b3('0x2f')](_0xe409d4[_0xd7b3('0x30')]);_0x10f3a0['filters']=_[_0xd7b3('0x31')](_0x10f3a0['model'],_0x10f3a0[_0xd7b3('0x30')]);_0x120893['attributes']=_[_0xd7b3('0x31')](_0x10f3a0[_0xd7b3('0x2e')],qs[_0xd7b3('0x32')](_0xe409d4['query'][_0xd7b3('0x32')]));_0x120893[_0xd7b3('0x33')]=_0x120893[_0xd7b3('0x33')][_0xd7b3('0x34')]?_0x120893[_0xd7b3('0x33')]:_0x10f3a0['model'];if(!_0xe409d4[_0xd7b3('0x30')]['hasOwnProperty'](_0xd7b3('0x35'))){_0x120893[_0xd7b3('0x1d')]=qs[_0xd7b3('0x1d')](_0xe409d4['query']['limit']);_0x120893[_0xd7b3('0x1b')]=qs[_0xd7b3('0x1b')](_0xe409d4[_0xd7b3('0x30')][_0xd7b3('0x1b')]);}_0x120893[_0xd7b3('0x36')]=qs[_0xd7b3('0x37')](_0xe409d4['query'][_0xd7b3('0x37')]);_0x120893[_0xd7b3('0x38')]=qs[_0xd7b3('0x39')](_[_0xd7b3('0x3a')](_0xe409d4['query'],_0x10f3a0[_0xd7b3('0x39')]),_0x311c26);if(_0xe409d4[_0xd7b3('0x30')][_0xd7b3('0x3b')]){_0x120893[_0xd7b3('0x38')]=_[_0xd7b3('0x3c')](_0x120893[_0xd7b3('0x38')],{'$or':_[_0xd7b3('0x29')](_0x311c26,function(_0x4a0222){if(_0x4a0222[_0xd7b3('0x2d')]!==_0xd7b3('0x3d')){var _0x29215f={};_0x29215f[_0x4a0222[_0xd7b3('0x27')]]={'$like':'%'+_0xe409d4[_0xd7b3('0x30')][_0xd7b3('0x3b')]+'%'};return _0x29215f;}})});}_0x120893=_[_0xd7b3('0x3c')]({},_0x120893,_0xe409d4[_0xd7b3('0x3e')]);var _0x304431={'where':_0x120893[_0xd7b3('0x38')]};return db[_0xd7b3('0x2a')][_0xd7b3('0x3f')](_0x304431)[_0xd7b3('0x23')](function(_0x13b49d){_0x5c7e2f['count']=_0x13b49d;if(_0xe409d4[_0xd7b3('0x30')][_0xd7b3('0x40')]){_0x120893[_0xd7b3('0x41')]=[{'all':!![]}];}return db[_0xd7b3('0x2a')][_0xd7b3('0x42')](_0x120893);})['then'](function(_0x48a700){_0x5c7e2f[_0xd7b3('0x43')]=_0x48a700;return _0x5c7e2f;})[_0xd7b3('0x23')](respondWithFilteredResult(_0x5b8e33,_0x120893))[_0xd7b3('0x44')](handleError(_0x5b8e33,null));};exports[_0xd7b3('0x45')]=function(_0x48a7e5,_0x1243b3){var _0x10d2c4={'raw':![],'where':{'id':_0x48a7e5[_0xd7b3('0x46')]['id']}},_0x59ef64={};_0x59ef64[_0xd7b3('0x2e')]=_[_0xd7b3('0x2f')](db['SalesforceAccount'][_0xd7b3('0x2b')]);_0x59ef64[_0xd7b3('0x30')]=_[_0xd7b3('0x2f')](_0x48a7e5[_0xd7b3('0x30')]);_0x59ef64[_0xd7b3('0x39')]=_[_0xd7b3('0x31')](_0x59ef64['model'],_0x59ef64[_0xd7b3('0x30')]);_0x10d2c4['attributes']=_[_0xd7b3('0x31')](_0x59ef64[_0xd7b3('0x2e')],qs['fields'](_0x48a7e5['query'][_0xd7b3('0x32')]));_0x10d2c4[_0xd7b3('0x33')]=_0x10d2c4['attributes'][_0xd7b3('0x34')]?_0x10d2c4[_0xd7b3('0x33')]:_0x59ef64['model'];if(_0x48a7e5[_0xd7b3('0x30')][_0xd7b3('0x40')]){_0x10d2c4[_0xd7b3('0x41')]=[{'all':!![]}];}_0x10d2c4=_[_0xd7b3('0x3c')]({},_0x10d2c4,_0x48a7e5[_0xd7b3('0x3e')]);return db[_0xd7b3('0x2a')][_0xd7b3('0x47')](_0x10d2c4)[_0xd7b3('0x23')](handleEntityNotFound(_0x1243b3,null))[_0xd7b3('0x23')](respondWithResult(_0x1243b3,null))[_0xd7b3('0x44')](handleError(_0x1243b3,null));};exports[_0xd7b3('0x48')]=function(_0x3675cc,_0x5ea04c){return db[_0xd7b3('0x2a')][_0xd7b3('0x48')](_0x3675cc['body'],{})['then'](respondWithResult(_0x5ea04c,0xc9))['catch'](handleError(_0x5ea04c,null));};exports[_0xd7b3('0x49')]=function(_0x410cfb,_0xa61f38){if(_0x410cfb[_0xd7b3('0x4a')]['id']){delete _0x410cfb[_0xd7b3('0x4a')]['id'];}return db[_0xd7b3('0x2a')][_0xd7b3('0x47')]({'where':{'id':_0x410cfb[_0xd7b3('0x46')]['id']}})[_0xd7b3('0x23')](handleEntityNotFound(_0xa61f38,null))[_0xd7b3('0x23')](saveUpdates(_0x410cfb[_0xd7b3('0x4a')],null))[_0xd7b3('0x23')](respondWithResult(_0xa61f38,null))['catch'](handleError(_0xa61f38,null));};exports[_0xd7b3('0x24')]=function(_0x3978a4,_0x9487d6){return db[_0xd7b3('0x2a')][_0xd7b3('0x47')]({'where':{'id':_0x3978a4[_0xd7b3('0x46')]['id']}})[_0xd7b3('0x23')](handleEntityNotFound(_0x9487d6,null))[_0xd7b3('0x23')](removeEntity(_0x9487d6,null))[_0xd7b3('0x44')](handleError(_0x9487d6,null));};exports[_0xd7b3('0x4b')]=function(_0x41c3e1,_0x293a5d,_0x5e2d65){var _0x451e11={};var _0x823e4c={};var _0x1fdb69;var _0x187bc3;return db[_0xd7b3('0x2a')][_0xd7b3('0x4c')]({'where':{'id':_0x41c3e1[_0xd7b3('0x46')]['id']}})['then'](handleEntityNotFound(_0x293a5d,null))[_0xd7b3('0x23')](function(_0x3acc67){if(_0x3acc67){_0x1fdb69=_0x3acc67;_0x823e4c[_0xd7b3('0x2e')]=_[_0xd7b3('0x2f')](db['SalesforceConfiguration'][_0xd7b3('0x2b')]);_0x823e4c[_0xd7b3('0x30')]=_[_0xd7b3('0x2f')](_0x41c3e1['query']);_0x823e4c[_0xd7b3('0x39')]=_[_0xd7b3('0x31')](_0x823e4c[_0xd7b3('0x2e')],_0x823e4c[_0xd7b3('0x30')]);_0x451e11[_0xd7b3('0x33')]=_['intersection'](_0x823e4c[_0xd7b3('0x2e')],qs['fields'](_0x41c3e1[_0xd7b3('0x30')]['fields']));_0x451e11[_0xd7b3('0x33')]=_0x451e11[_0xd7b3('0x33')]['length']?_0x451e11[_0xd7b3('0x33')]:_0x823e4c['model'];_0x451e11[_0xd7b3('0x36')]=qs['sort'](_0x41c3e1[_0xd7b3('0x30')]['sort']);_0x451e11[_0xd7b3('0x38')]=qs[_0xd7b3('0x39')](_[_0xd7b3('0x3a')](_0x41c3e1['query'],_0x823e4c[_0xd7b3('0x39')]));if(_0x41c3e1['query']['filter']){_0x451e11[_0xd7b3('0x38')]=_[_0xd7b3('0x3c')](_0x451e11['where'],{'$or':_[_0xd7b3('0x29')](_0x451e11[_0xd7b3('0x33')],function(_0x3cad6b){var _0x44b11a={};_0x44b11a[_0x3cad6b]={'$like':'%'+_0x41c3e1[_0xd7b3('0x30')][_0xd7b3('0x3b')]+'%'};return _0x44b11a;})});}_0x451e11=_[_0xd7b3('0x3c')]({},_0x451e11,_0x41c3e1[_0xd7b3('0x3e')]);return _0x1fdb69['getConfigurations'](_0x451e11);}})['then'](function(_0x5a54ed){if(_0x5a54ed){_0x187bc3=_0x5a54ed[_0xd7b3('0x34')];if(!_0x41c3e1[_0xd7b3('0x30')]['hasOwnProperty'](_0xd7b3('0x35'))){_0x451e11[_0xd7b3('0x1d')]=qs[_0xd7b3('0x1d')](_0x41c3e1['query']['limit']);_0x451e11[_0xd7b3('0x1b')]=qs['offset'](_0x41c3e1['query'][_0xd7b3('0x1b')]);}return _0x1fdb69[_0xd7b3('0x4b')](_0x451e11);}})[_0xd7b3('0x23')](function(_0x3a4d17){if(_0x3a4d17){return _0x3a4d17?{'count':_0x187bc3,'rows':_0x3a4d17}:null;}})[_0xd7b3('0x23')](respondWithResult(_0x293a5d,null))[_0xd7b3('0x44')](handleError(_0x293a5d,null));};exports['addConfiguration']=function(_0x350314,_0x26e21e,_0x40081d){if(_0x350314['body']['id']){delete _0x350314['body']['id'];}return db[_0xd7b3('0x2a')]['findOne']({'where':{'id':_0x350314['params']['id']}})[_0xd7b3('0x23')](handleEntityNotFound(_0x26e21e,null))[_0xd7b3('0x23')](function(_0x4d37c8){if(_0x4d37c8){_0x350314[_0xd7b3('0x4a')][_0xd7b3('0x4d')]=_0x4d37c8['id'];_0x350314[_0xd7b3('0x4a')][_0xd7b3('0x4e')]=integrations[_0xd7b3('0x4f')](_0x350314['body'][_0xd7b3('0x50')],_0x350314[_0xd7b3('0x4a')][_0xd7b3('0x2d')]);_0x350314[_0xd7b3('0x4a')][_0xd7b3('0x51')]=integrations[_0xd7b3('0x52')](_0x350314[_0xd7b3('0x4a')][_0xd7b3('0x50')],_0x350314[_0xd7b3('0x4a')][_0xd7b3('0x2d')]);return db[_0xd7b3('0x53')][_0xd7b3('0x48')](_0x350314['body'],{'include':[{'model':db[_0xd7b3('0x54')],'as':'Subjects'},{'model':db[_0xd7b3('0x54')],'as':_0xd7b3('0x51')}]});}return null;})['then'](respondWithResult(_0x26e21e,null))[_0xd7b3('0x44')](handleError(_0x26e21e,null));};exports[_0xd7b3('0x55')]=function(_0x56bad9,_0x1bde2d,_0x281edc){var _0x592d08;var _0x2806e9='';var _0x566da4=_0xd7b3('0x56');return db[_0xd7b3('0x2a')][_0xd7b3('0x4c')]({'where':{'id':_0x56bad9[_0xd7b3('0x46')]['id']},'attributes':['id',_0xd7b3('0x57'),'clientId','clientSecret','username',_0xd7b3('0x58'),_0xd7b3('0x59')]})['then'](handleEntityNotFound(_0x1bde2d,null))[_0xd7b3('0x23')](function(_0xc725c1){if(_0xc725c1){_0x2806e9=_0xc725c1[_0xd7b3('0x57')];var _0x3c7fa6=_0x2806e9[_0xd7b3('0x5a')](-0x1);if(_0x3c7fa6==='/'){_0x2806e9=_0x2806e9[_0xd7b3('0x5b')](0x0,_0x2806e9[_0xd7b3('0x5c')](_0x3c7fa6));}_0x592d08=new jsforce[(_0xd7b3('0x5d'))]({'oauth2':{'loginUrl':_0x2806e9,'clientId':_0xc725c1[_0xd7b3('0x5e')],'clientSecret':_0xc725c1[_0xd7b3('0x5f')]}});return _0x592d08[_0xd7b3('0x60')](_0xc725c1[_0xd7b3('0x61')],_0xc725c1['password'][_0xd7b3('0x62')](_0xc725c1[_0xd7b3('0x59')]));}})[_0xd7b3('0x23')](function(_0x15deef){if(_0x15deef){if(!_[_0xd7b3('0x63')](_0x56bad9['query'][_0xd7b3('0x64')])){_0x566da4=_0x56bad9[_0xd7b3('0x30')][_0xd7b3('0x64')];}return _0x592d08[_0xd7b3('0x65')](_0x566da4)[_0xd7b3('0x66')]();}})['then'](function(_0x174891){var _0x4eb922=['OwnerId',_0xd7b3('0x67'),_0xd7b3('0x68'),'IsRecurrence','Subject',_0xd7b3('0x69')];var _0x37e320=['string','int',_0xd7b3('0x6a'),_0xd7b3('0x6b'),_0xd7b3('0x6c'),_0xd7b3('0x6d'),_0xd7b3('0x6e')];if(_0x174891){_['remove'](_0x174891['fields'],function(_0x25bb3f){return _0x4eb922[_0xd7b3('0x6f')](_0x25bb3f['name'])||!_0x37e320[_0xd7b3('0x6f')](_0x25bb3f[_0xd7b3('0x2d')]);});return{'count':_0x174891['fields']['length'],'rows':_['map'](_0x174891[_0xd7b3('0x32')],function(_0xfa196a){return{'id':_0xfa196a[_0xd7b3('0x27')],'name':_0xfa196a[_0xd7b3('0x70')],'custom':_0xfa196a[_0xd7b3('0x71')],'options':_0xfa196a[_0xd7b3('0x72')][_0xd7b3('0x34')]>0x0?_[_0xd7b3('0x29')](_0xfa196a[_0xd7b3('0x72')],function(_0x1672c1){return{'name':_0x1672c1[_0xd7b3('0x70')],'value':_0x1672c1['value']};}):_0xfa196a[_0xd7b3('0x2d')]==_0xd7b3('0x6b')?[{'name':_0xd7b3('0x73'),'value':'true'},{'name':'False','value':_0xd7b3('0x74')}]:[]};})};}})[_0xd7b3('0x23')](respondWithResult(_0x1bde2d,null))[_0xd7b3('0x44')](function(_0x295a9f){var _0x447bc1=_0x56bad9[_0xd7b3('0x30')][_0xd7b3('0x75')]?0x1f4:_0x295a9f['statusCode']||0x1f4;logger[_0xd7b3('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xd7b3('0x55'),_0x447bc1,JSON[_0xd7b3('0x76')](_0x295a9f));delete _0x295a9f['name'];if(_0x447bc1===0x191){_0x447bc1=0x190;}_0x1bde2d[_0xd7b3('0x19')](_0x447bc1)['send'](_0x56bad9[_0xd7b3('0x30')][_0xd7b3('0x75')]?{'message':_0xd7b3('0x77'),'statusCode':_0x295a9f[_0xd7b3('0x78')]}:_0x295a9f);});}; \ No newline at end of file +var _0x5f65=['password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','login','ticketType','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','value','True','true','False','false','statusCode','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','limit','count','offset','apply','reject','save','destroy','then','sendStatus','error','name','send','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','length','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','clientId','clientSecret','username'];(function(_0x3476f2,_0x130c1d){var _0x39f17c=function(_0x985505){while(--_0x985505){_0x3476f2['push'](_0x3476f2['shift']());}};_0x39f17c(++_0x130c1d);}(_0x5f65,0x9e));var _0x55f6=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5f65[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x55f6('0x0'));var rimraf=require(_0x55f6('0x1'));var zipdir=require(_0x55f6('0x2'));var jsonpatch=require(_0x55f6('0x3'));var rp=require('request-promise');var moment=require(_0x55f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55f6('0x5'));var util=require('util');var path=require(_0x55f6('0x6'));var sox=require(_0x55f6('0x7'));var csv=require(_0x55f6('0x8'));var ejs=require(_0x55f6('0x9'));var fs=require('fs');var fs_extra=require(_0x55f6('0xa'));var _=require(_0x55f6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x55f6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x55f6('0x8'));var querystring=require(_0x55f6('0xd'));var Papa=require('papaparse');var Redis=require(_0x55f6('0xe'));var authService=require(_0x55f6('0xf'));var qs=require(_0x55f6('0x10'));var as=require(_0x55f6('0x11'));var hardwareService=require(_0x55f6('0x12'));var logger=require(_0x55f6('0x13'))(_0x55f6('0x14'));var utils=require(_0x55f6('0x15'));var config=require(_0x55f6('0x16'));var licenseUtil=require(_0x55f6('0x17'));var db=require(_0x55f6('0x18'))['db'];var integrations=require(_0x55f6('0x19'));function respondWithStatusCode(_0x36f5da,_0x4d3a0f){_0x4d3a0f=_0x4d3a0f||0xcc;return function(_0x24f00d){if(_0x24f00d){return _0x36f5da['sendStatus'](_0x4d3a0f);}return _0x36f5da['status'](_0x4d3a0f)[_0x55f6('0x1a')]();};}function respondWithResult(_0x213ea7,_0x3cb96b){_0x3cb96b=_0x3cb96b||0xc8;return function(_0x15bfc2){if(_0x15bfc2){return _0x213ea7[_0x55f6('0x1b')](_0x3cb96b)[_0x55f6('0x1c')](_0x15bfc2);}};}function respondWithFilteredResult(_0x2bc664,_0x463230){return function(_0x5ed1f1){if(_0x5ed1f1){var _0x335ceb=typeof _0x463230['offset']==='undefined'&&typeof _0x463230[_0x55f6('0x1d')]==='undefined';var _0x5a2d6b=_0x5ed1f1[_0x55f6('0x1e')];var _0x167ba2=_0x335ceb?0x0:_0x463230[_0x55f6('0x1f')];var _0x388e12=_0x335ceb?_0x5ed1f1['count']:_0x463230['offset']+_0x463230[_0x55f6('0x1d')];var _0x219bdd;if(_0x388e12>=_0x5a2d6b){_0x388e12=_0x5a2d6b;_0x219bdd=0xc8;}else{_0x219bdd=0xce;}_0x2bc664[_0x55f6('0x1b')](_0x219bdd);return _0x2bc664['set']('Content-Range',_0x167ba2+'-'+_0x388e12+'/'+_0x5a2d6b)[_0x55f6('0x1c')](_0x5ed1f1);}return null;};}function patchUpdates(_0x4e2b9e){return function(_0x3f0c9e){try{jsonpatch[_0x55f6('0x20')](_0x3f0c9e,_0x4e2b9e,!![]);}catch(_0x26e186){return BPromise[_0x55f6('0x21')](_0x26e186);}return _0x3f0c9e[_0x55f6('0x22')]();};}function saveUpdates(_0x47570d,_0x569aa0){return function(_0x5230cb){if(_0x5230cb){return _0x5230cb['update'](_0x47570d)['then'](function(_0x1013b5){return _0x1013b5;});}return null;};}function removeEntity(_0x3ec28a,_0x39e665){return function(_0x13e000){if(_0x13e000){return _0x13e000[_0x55f6('0x23')]()[_0x55f6('0x24')](function(){_0x3ec28a['status'](0xcc)[_0x55f6('0x1a')]();});}};}function handleEntityNotFound(_0x55ac62,_0x57a16f){return function(_0x4e1d27){if(!_0x4e1d27){_0x55ac62[_0x55f6('0x25')](0x194);}return _0x4e1d27;};}function handleError(_0x5f2a0d,_0x2d5e27){_0x2d5e27=_0x2d5e27||0x1f4;return function(_0x2e636f){logger[_0x55f6('0x26')](_0x2e636f['stack']);if(_0x2e636f[_0x55f6('0x27')]){delete _0x2e636f[_0x55f6('0x27')];}_0x5f2a0d['status'](_0x2d5e27)[_0x55f6('0x28')](_0x2e636f);};}exports['index']=function(_0x25c0d7,_0x3b3f16){var _0x59f074={},_0x3ebfa0={},_0x8632d1={'count':0x0,'rows':[]};var _0x211fcd=_[_0x55f6('0x29')](db[_0x55f6('0x2a')][_0x55f6('0x2b')],function(_0x3ebc46){return{'name':_0x3ebc46['fieldName'],'type':_0x3ebc46[_0x55f6('0x2c')][_0x55f6('0x2d')]};});_0x3ebfa0[_0x55f6('0x2e')]=_[_0x55f6('0x29')](_0x211fcd,_0x55f6('0x27'));_0x3ebfa0[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x25c0d7[_0x55f6('0x2f')]);_0x3ebfa0[_0x55f6('0x31')]=_[_0x55f6('0x32')](_0x3ebfa0[_0x55f6('0x2e')],_0x3ebfa0[_0x55f6('0x2f')]);_0x59f074[_0x55f6('0x33')]=_[_0x55f6('0x32')](_0x3ebfa0[_0x55f6('0x2e')],qs[_0x55f6('0x34')](_0x25c0d7[_0x55f6('0x2f')][_0x55f6('0x34')]));_0x59f074[_0x55f6('0x33')]=_0x59f074['attributes']['length']?_0x59f074[_0x55f6('0x33')]:_0x3ebfa0[_0x55f6('0x2e')];if(!_0x25c0d7[_0x55f6('0x2f')][_0x55f6('0x35')](_0x55f6('0x36'))){_0x59f074['limit']=qs[_0x55f6('0x1d')](_0x25c0d7['query'][_0x55f6('0x1d')]);_0x59f074[_0x55f6('0x1f')]=qs['offset'](_0x25c0d7[_0x55f6('0x2f')]['offset']);}_0x59f074[_0x55f6('0x37')]=qs[_0x55f6('0x38')](_0x25c0d7[_0x55f6('0x2f')][_0x55f6('0x38')]);_0x59f074[_0x55f6('0x39')]=qs[_0x55f6('0x31')](_[_0x55f6('0x3a')](_0x25c0d7[_0x55f6('0x2f')],_0x3ebfa0['filters']),_0x211fcd);if(_0x25c0d7[_0x55f6('0x2f')][_0x55f6('0x3b')]){_0x59f074[_0x55f6('0x39')]=_[_0x55f6('0x3c')](_0x59f074[_0x55f6('0x39')],{'$or':_[_0x55f6('0x29')](_0x211fcd,function(_0xdf6b80){if(_0xdf6b80['type']!==_0x55f6('0x3d')){var _0x88afd8={};_0x88afd8[_0xdf6b80['name']]={'$like':'%'+_0x25c0d7[_0x55f6('0x2f')][_0x55f6('0x3b')]+'%'};return _0x88afd8;}})});}_0x59f074=_[_0x55f6('0x3c')]({},_0x59f074,_0x25c0d7['options']);var _0x41aa70={'where':_0x59f074[_0x55f6('0x39')]};return db['SalesforceAccount'][_0x55f6('0x1e')](_0x41aa70)[_0x55f6('0x24')](function(_0x5d80c5){_0x8632d1[_0x55f6('0x1e')]=_0x5d80c5;if(_0x25c0d7[_0x55f6('0x2f')]['includeAll']){_0x59f074[_0x55f6('0x3e')]=[{'all':!![]}];}return db[_0x55f6('0x2a')][_0x55f6('0x3f')](_0x59f074);})['then'](function(_0x3f7037){_0x8632d1[_0x55f6('0x40')]=_0x3f7037;return _0x8632d1;})[_0x55f6('0x24')](respondWithFilteredResult(_0x3b3f16,_0x59f074))['catch'](handleError(_0x3b3f16,null));};exports[_0x55f6('0x41')]=function(_0x4a78ad,_0x9b94f3){var _0x26f520={'raw':![],'where':{'id':_0x4a78ad[_0x55f6('0x42')]['id']}},_0x5262bb={};_0x5262bb[_0x55f6('0x2e')]=_[_0x55f6('0x30')](db['SalesforceAccount'][_0x55f6('0x2b')]);_0x5262bb[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x4a78ad[_0x55f6('0x2f')]);_0x5262bb[_0x55f6('0x31')]=_[_0x55f6('0x32')](_0x5262bb[_0x55f6('0x2e')],_0x5262bb[_0x55f6('0x2f')]);_0x26f520[_0x55f6('0x33')]=_[_0x55f6('0x32')](_0x5262bb[_0x55f6('0x2e')],qs['fields'](_0x4a78ad[_0x55f6('0x2f')][_0x55f6('0x34')]));_0x26f520[_0x55f6('0x33')]=_0x26f520[_0x55f6('0x33')]['length']?_0x26f520['attributes']:_0x5262bb['model'];if(_0x4a78ad[_0x55f6('0x2f')][_0x55f6('0x43')]){_0x26f520[_0x55f6('0x3e')]=[{'all':!![]}];}_0x26f520=_[_0x55f6('0x3c')]({},_0x26f520,_0x4a78ad[_0x55f6('0x44')]);return db[_0x55f6('0x2a')][_0x55f6('0x45')](_0x26f520)['then'](handleEntityNotFound(_0x9b94f3,null))['then'](respondWithResult(_0x9b94f3,null))[_0x55f6('0x46')](handleError(_0x9b94f3,null));};exports[_0x55f6('0x47')]=function(_0x3abbd3,_0x4ea3e4){return db[_0x55f6('0x2a')][_0x55f6('0x47')](_0x3abbd3[_0x55f6('0x48')],{})[_0x55f6('0x24')](respondWithResult(_0x4ea3e4,0xc9))[_0x55f6('0x46')](handleError(_0x4ea3e4,null));};exports['update']=function(_0xf76ead,_0x5cd281){if(_0xf76ead['body']['id']){delete _0xf76ead[_0x55f6('0x48')]['id'];}return db[_0x55f6('0x2a')]['find']({'where':{'id':_0xf76ead[_0x55f6('0x42')]['id']}})[_0x55f6('0x24')](handleEntityNotFound(_0x5cd281,null))[_0x55f6('0x24')](saveUpdates(_0xf76ead[_0x55f6('0x48')],null))['then'](respondWithResult(_0x5cd281,null))[_0x55f6('0x46')](handleError(_0x5cd281,null));};exports[_0x55f6('0x23')]=function(_0x391890,_0x2708b4){return db[_0x55f6('0x2a')][_0x55f6('0x45')]({'where':{'id':_0x391890[_0x55f6('0x42')]['id']}})[_0x55f6('0x24')](handleEntityNotFound(_0x2708b4,null))[_0x55f6('0x24')](removeEntity(_0x2708b4,null))[_0x55f6('0x46')](handleError(_0x2708b4,null));};exports[_0x55f6('0x49')]=function(_0x401361,_0x113b92,_0x469d52){var _0x1600af={};var _0x5b01eb={};var _0x7c2926;var _0x1b1618;return db[_0x55f6('0x2a')][_0x55f6('0x4a')]({'where':{'id':_0x401361[_0x55f6('0x42')]['id']}})[_0x55f6('0x24')](handleEntityNotFound(_0x113b92,null))[_0x55f6('0x24')](function(_0x38f9a0){if(_0x38f9a0){_0x7c2926=_0x38f9a0;_0x5b01eb[_0x55f6('0x2e')]=_[_0x55f6('0x30')](db[_0x55f6('0x4b')][_0x55f6('0x2b')]);_0x5b01eb[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x401361['query']);_0x5b01eb[_0x55f6('0x31')]=_[_0x55f6('0x32')](_0x5b01eb[_0x55f6('0x2e')],_0x5b01eb[_0x55f6('0x2f')]);_0x1600af[_0x55f6('0x33')]=_['intersection'](_0x5b01eb[_0x55f6('0x2e')],qs[_0x55f6('0x34')](_0x401361['query'][_0x55f6('0x34')]));_0x1600af[_0x55f6('0x33')]=_0x1600af['attributes'][_0x55f6('0x4c')]?_0x1600af[_0x55f6('0x33')]:_0x5b01eb['model'];_0x1600af[_0x55f6('0x37')]=qs[_0x55f6('0x38')](_0x401361[_0x55f6('0x2f')][_0x55f6('0x38')]);_0x1600af['where']=qs[_0x55f6('0x31')](_[_0x55f6('0x3a')](_0x401361['query'],_0x5b01eb[_0x55f6('0x31')]));if(_0x401361[_0x55f6('0x2f')][_0x55f6('0x3b')]){_0x1600af[_0x55f6('0x39')]=_[_0x55f6('0x3c')](_0x1600af[_0x55f6('0x39')],{'$or':_['map'](_0x1600af['attributes'],function(_0x2f9b13){var _0x53ab4b={};_0x53ab4b[_0x2f9b13]={'$like':'%'+_0x401361[_0x55f6('0x2f')][_0x55f6('0x3b')]+'%'};return _0x53ab4b;})});}_0x1600af=_[_0x55f6('0x3c')]({},_0x1600af,_0x401361[_0x55f6('0x44')]);return _0x7c2926[_0x55f6('0x49')](_0x1600af);}})[_0x55f6('0x24')](function(_0x52d4b3){if(_0x52d4b3){_0x1b1618=_0x52d4b3[_0x55f6('0x4c')];if(!_0x401361[_0x55f6('0x2f')]['hasOwnProperty']('nolimit')){_0x1600af[_0x55f6('0x1d')]=qs[_0x55f6('0x1d')](_0x401361['query'][_0x55f6('0x1d')]);_0x1600af[_0x55f6('0x1f')]=qs[_0x55f6('0x1f')](_0x401361['query'][_0x55f6('0x1f')]);}return _0x7c2926[_0x55f6('0x49')](_0x1600af);}})[_0x55f6('0x24')](function(_0x5c0138){if(_0x5c0138){return _0x5c0138?{'count':_0x1b1618,'rows':_0x5c0138}:null;}})[_0x55f6('0x24')](respondWithResult(_0x113b92,null))['catch'](handleError(_0x113b92,null));};exports[_0x55f6('0x4d')]=function(_0x3ab686,_0x378a42,_0x46f2f8){if(_0x3ab686[_0x55f6('0x48')]['id']){delete _0x3ab686['body']['id'];}return db[_0x55f6('0x2a')][_0x55f6('0x4a')]({'where':{'id':_0x3ab686[_0x55f6('0x42')]['id']}})['then'](handleEntityNotFound(_0x378a42,null))['then'](function(_0x3fee3d){if(_0x3fee3d){_0x3ab686['body']['AccountId']=_0x3fee3d['id'];_0x3ab686[_0x55f6('0x48')][_0x55f6('0x4e')]=integrations[_0x55f6('0x4f')](_0x3ab686[_0x55f6('0x48')][_0x55f6('0x50')],_0x3ab686[_0x55f6('0x48')]['type']);_0x3ab686[_0x55f6('0x48')][_0x55f6('0x51')]=integrations[_0x55f6('0x52')](_0x3ab686[_0x55f6('0x48')]['channel'],_0x3ab686[_0x55f6('0x48')][_0x55f6('0x2c')]);return db[_0x55f6('0x4b')]['create'](_0x3ab686[_0x55f6('0x48')],{'include':[{'model':db[_0x55f6('0x53')],'as':_0x55f6('0x4e')},{'model':db[_0x55f6('0x53')],'as':_0x55f6('0x51')}]});}return null;})[_0x55f6('0x24')](respondWithResult(_0x378a42,null))[_0x55f6('0x46')](handleError(_0x378a42,null));};exports['getFields']=function(_0x26764c,_0x468a6d,_0x3a8b38){var _0xff90d;var _0x2b3b40='';var _0x49b167=_0x55f6('0x54');return db[_0x55f6('0x2a')][_0x55f6('0x4a')]({'where':{'id':_0x26764c[_0x55f6('0x42')]['id']},'attributes':['id','remoteUri',_0x55f6('0x55'),_0x55f6('0x56'),_0x55f6('0x57'),_0x55f6('0x58'),_0x55f6('0x59')]})[_0x55f6('0x24')](handleEntityNotFound(_0x468a6d,null))[_0x55f6('0x24')](function(_0x4f4fc1){if(_0x4f4fc1){_0x2b3b40=_0x4f4fc1[_0x55f6('0x5a')];var _0x53d088=_0x2b3b40[_0x55f6('0x5b')](-0x1);if(_0x53d088==='/'){_0x2b3b40=_0x2b3b40[_0x55f6('0x5c')](0x0,_0x2b3b40[_0x55f6('0x5d')](_0x53d088));}_0xff90d=new jsforce[(_0x55f6('0x5e'))]({'oauth2':{'loginUrl':_0x2b3b40,'clientId':_0x4f4fc1[_0x55f6('0x55')],'clientSecret':_0x4f4fc1[_0x55f6('0x56')]}});return _0xff90d[_0x55f6('0x5f')](_0x4f4fc1['username'],_0x4f4fc1['password']['concat'](_0x4f4fc1['securityToken']));}})[_0x55f6('0x24')](function(_0x165d39){if(_0x165d39){if(!_['isNil'](_0x26764c[_0x55f6('0x2f')][_0x55f6('0x60')])){_0x49b167=_0x26764c[_0x55f6('0x2f')][_0x55f6('0x60')];}return _0xff90d['sobject'](_0x49b167)[_0x55f6('0x61')]();}})['then'](function(_0x5064fa){var _0xbd8987=['OwnerId',_0x55f6('0x62'),_0x55f6('0x63'),_0x55f6('0x64'),_0x55f6('0x65'),'Description'];var _0x2615eb=[_0x55f6('0x66'),_0x55f6('0x67'),_0x55f6('0x68'),_0x55f6('0x69'),_0x55f6('0x6a'),_0x55f6('0x6b'),_0x55f6('0x6c')];if(_0x5064fa){_[_0x55f6('0x6d')](_0x5064fa[_0x55f6('0x34')],function(_0x1c7754){return _0xbd8987['includes'](_0x1c7754[_0x55f6('0x27')])||!_0x2615eb[_0x55f6('0x6e')](_0x1c7754[_0x55f6('0x2c')]);});return{'count':_0x5064fa['fields'][_0x55f6('0x4c')],'rows':_[_0x55f6('0x29')](_0x5064fa[_0x55f6('0x34')],function(_0x469e63){return{'id':_0x469e63[_0x55f6('0x27')],'name':_0x469e63['label'],'custom':_0x469e63[_0x55f6('0x6f')],'options':_0x469e63[_0x55f6('0x70')][_0x55f6('0x4c')]>0x0?_[_0x55f6('0x29')](_0x469e63[_0x55f6('0x70')],function(_0x2c7e84){return{'name':_0x2c7e84['label'],'value':_0x2c7e84[_0x55f6('0x71')]};}):_0x469e63[_0x55f6('0x2c')]==_0x55f6('0x69')?[{'name':_0x55f6('0x72'),'value':_0x55f6('0x73')},{'name':_0x55f6('0x74'),'value':_0x55f6('0x75')}]:[]};})};}})[_0x55f6('0x24')](respondWithResult(_0x468a6d,null))[_0x55f6('0x46')](function(_0x5179b5){var _0x46dd09=_0x26764c[_0x55f6('0x2f')]['test']?0x1f4:_0x5179b5[_0x55f6('0x76')]||0x1f4;logger[_0x55f6('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x55f6('0x77'),_0x46dd09,JSON[_0x55f6('0x78')](_0x5179b5));delete _0x5179b5[_0x55f6('0x27')];if(_0x46dd09===0x191){_0x46dd09=0x190;}_0x468a6d['status'](_0x46dd09)[_0x55f6('0x28')](_0x26764c['query'][_0x55f6('0x79')]?{'message':_0x55f6('0x7a'),'statusCode':_0x5179b5[_0x55f6('0x76')]}:_0x5179b5);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1086ddf..39f8978 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 _0x97da=['path','rimraf','../../config/environment','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x372489,_0x358eb7){var _0x5628a8=function(_0x296cbb){while(--_0x296cbb){_0x372489['push'](_0x372489['shift']());}};_0x5628a8(++_0x358eb7);}(_0x97da,0x164));var _0xa97d=function(_0x22f0fe,_0x24d1a1){_0x22f0fe=_0x22f0fe-0x0;var _0x7c5ea3=_0x97da[_0x22f0fe];return _0x7c5ea3;};'use strict';var _=require(_0xa97d('0x0'));var util=require('util');var logger=require(_0xa97d('0x1'))(_0xa97d('0x2'));var moment=require('moment');var BPromise=require(_0xa97d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa97d('0x4'));var rimraf=require(_0xa97d('0x5'));var config=require(_0xa97d('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x455ffb,_0x3cff27){return _0x455ffb[_0xa97d('0x7')](_0xa97d('0x8'),attributes,{'tableName':_0xa97d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa391=['define','int_salesforce_accounts','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xa391,0x1ee));var _0x1a39=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa391[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x1a39('0x0'));var logger=require('../../config/logger')(_0x1a39('0x1'));var moment=require(_0x1a39('0x2'));var BPromise=require(_0x1a39('0x3'));var rp=require(_0x1a39('0x4'));var fs=require('fs');var path=require(_0x1a39('0x5'));var rimraf=require('rimraf');var config=require(_0x1a39('0x6'));var attributes=require(_0x1a39('0x7'));var integrations=require(_0x1a39('0x8'));module[_0x1a39('0x9')]=function(_0x408465,_0x1a94b8){return _0x408465[_0x1a39('0xa')]('SalesforceAccount',attributes,{'tableName':_0x1a39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d03f067..bece735 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 _0xcecf=['findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','ShowSalesforceAccount','SalesforceAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetSalesforceAccount'];(function(_0x407375,_0x34e5e5){var _0x35aa99=function(_0x2b77b8){while(--_0x2b77b8){_0x407375['push'](_0x407375['shift']());}};_0x35aa99(++_0x34e5e5);}(_0xcecf,0xbd));var _0xfcec=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcecf[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcec('0x0'));var BPromise=require(_0xfcec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcec('0x2'));var db=require(_0xfcec('0x3'))['db'];var utils=require(_0xfcec('0x4'));var logger=require(_0xfcec('0x5'))('rpc');var config=require(_0xfcec('0x6'));var jayson=require(_0xfcec('0x7'));var client=jayson[_0xfcec('0x8')][_0xfcec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13d73c,_0x5b014c,_0x30678f){return new BPromise(function(_0x57ed95,_0xc342f8){return client[_0xfcec('0xa')](_0x13d73c,_0x30678f)['then'](function(_0xe6c3db){logger[_0xfcec('0xb')](_0xfcec('0xc'),_0x5b014c,_0xfcec('0xd'));logger[_0xfcec('0xe')](_0xfcec('0xf'),_0x5b014c,_0xfcec('0xd'),JSON['stringify'](_0xe6c3db));if(_0xe6c3db['error']){if(_0xe6c3db['error'][_0xfcec('0x10')]===0x1f4){logger[_0xfcec('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x5b014c,_0xe6c3db[_0xfcec('0x11')][_0xfcec('0x12')]);return _0xc342f8(_0xe6c3db[_0xfcec('0x11')][_0xfcec('0x12')]);}logger[_0xfcec('0x11')](_0xfcec('0xc'),_0x5b014c,_0xe6c3db['error']['message']);return _0x57ed95(_0xe6c3db['error'][_0xfcec('0x12')]);}else{logger[_0xfcec('0xb')](_0xfcec('0xc'),_0x5b014c,_0xfcec('0xd'));_0x57ed95(_0xe6c3db['result'][_0xfcec('0x12')]);}})[_0xfcec('0x13')](function(_0x35347b){logger[_0xfcec('0x11')](_0xfcec('0xc'),_0x5b014c,_0x35347b);_0xc342f8(_0x35347b);});});}exports[_0xfcec('0x14')]=function(_0x3d372b){var _0x58d0e1=this;return new Promise(function(_0x296c23,_0x1d48ba){return db['SalesforceAccount'][_0xfcec('0x15')]({'raw':_0x3d372b[_0xfcec('0x16')]?_0x3d372b[_0xfcec('0x16')][_0xfcec('0x17')]===undefined?!![]:![]:!![],'where':_0x3d372b[_0xfcec('0x16')]?_0x3d372b[_0xfcec('0x16')][_0xfcec('0x18')]||null:null,'attributes':_0x3d372b[_0xfcec('0x16')]?_0x3d372b[_0xfcec('0x16')][_0xfcec('0x19')]||null:null,'limit':_0x3d372b[_0xfcec('0x16')]?_0x3d372b[_0xfcec('0x16')][_0xfcec('0x1a')]||null:null,'include':_0x3d372b['options']?_0x3d372b['options'][_0xfcec('0x1b')]?_['map'](_0x3d372b[_0xfcec('0x16')][_0xfcec('0x1b')],function(_0x33c937){return{'model':db[_0x33c937[_0xfcec('0x1c')]],'as':_0x33c937['as'],'attributes':_0x33c937[_0xfcec('0x19')],'include':_0x33c937[_0xfcec('0x1b')]?_[_0xfcec('0x1d')](_0x33c937[_0xfcec('0x1b')],function(_0x5b6c32){return{'model':db[_0x5b6c32[_0xfcec('0x1c')]],'as':_0x5b6c32['as'],'attributes':_0x5b6c32[_0xfcec('0x19')],'include':_0x5b6c32['include']?_[_0xfcec('0x1d')](_0x5b6c32['include'],function(_0x58d4d0){return{'model':db[_0x58d4d0[_0xfcec('0x1c')]],'as':_0x58d4d0['as'],'attributes':_0x58d4d0[_0xfcec('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfcec('0x1e')](function(_0x42709b){logger[_0xfcec('0xb')](_0xfcec('0x14'),_0x3d372b);logger[_0xfcec('0xe')](_0xfcec('0x14'),_0x3d372b,JSON[_0xfcec('0x1f')](_0x42709b));_0x296c23(_0x42709b);})['catch'](function(_0x6d22f1){logger[_0xfcec('0x11')](_0xfcec('0x14'),_0x6d22f1[_0xfcec('0x12')],_0x3d372b);_0x1d48ba(_0x58d0e1['error'](0x1f4,_0x6d22f1[_0xfcec('0x12')]));});});};exports[_0xfcec('0x20')]=function(_0xa4937){var _0x2f621d=this;return new Promise(function(_0x1feed4,_0x2a2d3f){return db[_0xfcec('0x21')][_0xfcec('0x22')]({'raw':_0xa4937[_0xfcec('0x16')]?_0xa4937[_0xfcec('0x16')][_0xfcec('0x17')]===undefined?!![]:![]:!![],'where':_0xa4937[_0xfcec('0x16')]?_0xa4937[_0xfcec('0x16')]['where']||null:null,'attributes':_0xa4937[_0xfcec('0x16')]?_0xa4937[_0xfcec('0x16')][_0xfcec('0x19')]||null:null,'include':_0xa4937[_0xfcec('0x16')]?_0xa4937[_0xfcec('0x16')][_0xfcec('0x1b')]?_[_0xfcec('0x1d')](_0xa4937['options'][_0xfcec('0x1b')],function(_0x106104){return{'model':db[_0x106104[_0xfcec('0x1c')]],'as':_0x106104['as'],'attributes':_0x106104[_0xfcec('0x19')],'include':_0x106104[_0xfcec('0x1b')]?_[_0xfcec('0x1d')](_0x106104[_0xfcec('0x1b')],function(_0x548fb7){return{'model':db[_0x548fb7[_0xfcec('0x1c')]],'as':_0x548fb7['as'],'attributes':_0x548fb7['attributes'],'include':_0x548fb7[_0xfcec('0x1b')]?_[_0xfcec('0x1d')](_0x548fb7[_0xfcec('0x1b')],function(_0x52f3cc){return{'model':db[_0x52f3cc['model']],'as':_0x52f3cc['as'],'attributes':_0x52f3cc[_0xfcec('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfcec('0x1e')](function(_0x4248bc){logger['info']('ShowSalesforceAccount',_0xa4937);logger[_0xfcec('0xe')]('ShowSalesforceAccount',_0xa4937,JSON[_0xfcec('0x1f')](_0x4248bc));_0x1feed4(_0x4248bc);})[_0xfcec('0x13')](function(_0x47f068){logger[_0xfcec('0x11')](_0xfcec('0x20'),_0x47f068[_0xfcec('0x12')],_0xa4937);_0x2a2d3f(_0x2f621d['error'](0x1f4,_0x47f068[_0xfcec('0x12')]));});});}; \ No newline at end of file +var _0x5564=['where','attributes','limit','map','include','model','info','catch','ShowSalesforceAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','findAll','options','raw'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x5564,0x1ca));var _0x4556=function(_0x843b8f,_0x2fc32b){_0x843b8f=_0x843b8f-0x0;var _0x416cb9=_0x5564[_0x843b8f];return _0x416cb9;};'use strict';var _=require(_0x4556('0x0'));var util=require(_0x4556('0x1'));var moment=require(_0x4556('0x2'));var BPromise=require('bluebird');var rs=require(_0x4556('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4556('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4556('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4556('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36cca7,_0x16c482,_0x132252){return new BPromise(function(_0x1ff54d,_0x336e62){return client[_0x4556('0x7')](_0x36cca7,_0x132252)[_0x4556('0x8')](function(_0x1d9769){logger['info'](_0x4556('0x9'),_0x16c482,_0x4556('0xa'));logger[_0x4556('0xb')](_0x4556('0xc'),_0x16c482,'request\x20sent',JSON[_0x4556('0xd')](_0x1d9769));if(_0x1d9769[_0x4556('0xe')]){if(_0x1d9769[_0x4556('0xe')][_0x4556('0xf')]===0x1f4){logger[_0x4556('0xe')](_0x4556('0x9'),_0x16c482,_0x1d9769[_0x4556('0xe')][_0x4556('0x10')]);return _0x336e62(_0x1d9769[_0x4556('0xe')][_0x4556('0x10')]);}logger[_0x4556('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x16c482,_0x1d9769['error']['message']);return _0x1ff54d(_0x1d9769[_0x4556('0xe')][_0x4556('0x10')]);}else{logger['info'](_0x4556('0x9'),_0x16c482,'request\x20sent');_0x1ff54d(_0x1d9769[_0x4556('0x11')][_0x4556('0x10')]);}})['catch'](function(_0x557478){logger[_0x4556('0xe')](_0x4556('0x9'),_0x16c482,_0x557478);_0x336e62(_0x557478);});});}exports[_0x4556('0x12')]=function(_0x3d88b1){var _0x4a87f5=this;return new Promise(function(_0xc012c6,_0x16bf6e){return db['SalesforceAccount'][_0x4556('0x13')]({'raw':_0x3d88b1[_0x4556('0x14')]?_0x3d88b1['options'][_0x4556('0x15')]===undefined?!![]:![]:!![],'where':_0x3d88b1['options']?_0x3d88b1[_0x4556('0x14')][_0x4556('0x16')]||null:null,'attributes':_0x3d88b1[_0x4556('0x14')]?_0x3d88b1[_0x4556('0x14')][_0x4556('0x17')]||null:null,'limit':_0x3d88b1[_0x4556('0x14')]?_0x3d88b1[_0x4556('0x14')][_0x4556('0x18')]||null:null,'include':_0x3d88b1[_0x4556('0x14')]?_0x3d88b1['options']['include']?_[_0x4556('0x19')](_0x3d88b1[_0x4556('0x14')][_0x4556('0x1a')],function(_0x2e142d){return{'model':db[_0x2e142d[_0x4556('0x1b')]],'as':_0x2e142d['as'],'attributes':_0x2e142d['attributes'],'include':_0x2e142d['include']?_[_0x4556('0x19')](_0x2e142d[_0x4556('0x1a')],function(_0x2c19bd){return{'model':db[_0x2c19bd[_0x4556('0x1b')]],'as':_0x2c19bd['as'],'attributes':_0x2c19bd[_0x4556('0x17')],'include':_0x2c19bd[_0x4556('0x1a')]?_[_0x4556('0x19')](_0x2c19bd[_0x4556('0x1a')],function(_0x2d3781){return{'model':db[_0x2d3781[_0x4556('0x1b')]],'as':_0x2d3781['as'],'attributes':_0x2d3781[_0x4556('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x370313){logger[_0x4556('0x1c')](_0x4556('0x12'),_0x3d88b1);logger[_0x4556('0xb')](_0x4556('0x12'),_0x3d88b1,JSON[_0x4556('0xd')](_0x370313));_0xc012c6(_0x370313);})[_0x4556('0x1d')](function(_0x3cce78){logger[_0x4556('0xe')](_0x4556('0x12'),_0x3cce78['message'],_0x3d88b1);_0x16bf6e(_0x4a87f5[_0x4556('0xe')](0x1f4,_0x3cce78[_0x4556('0x10')]));});});};exports[_0x4556('0x1e')]=function(_0x2b3fa5){var _0x55c20b=this;return new Promise(function(_0x2ce0dd,_0x4ed1d5){return db['SalesforceAccount'][_0x4556('0x1f')]({'raw':_0x2b3fa5[_0x4556('0x14')]?_0x2b3fa5[_0x4556('0x14')][_0x4556('0x15')]===undefined?!![]:![]:!![],'where':_0x2b3fa5['options']?_0x2b3fa5[_0x4556('0x14')][_0x4556('0x16')]||null:null,'attributes':_0x2b3fa5[_0x4556('0x14')]?_0x2b3fa5[_0x4556('0x14')][_0x4556('0x17')]||null:null,'include':_0x2b3fa5[_0x4556('0x14')]?_0x2b3fa5[_0x4556('0x14')][_0x4556('0x1a')]?_[_0x4556('0x19')](_0x2b3fa5[_0x4556('0x14')][_0x4556('0x1a')],function(_0x48571f){return{'model':db[_0x48571f['model']],'as':_0x48571f['as'],'attributes':_0x48571f[_0x4556('0x17')],'include':_0x48571f[_0x4556('0x1a')]?_['map'](_0x48571f[_0x4556('0x1a')],function(_0x451b4a){return{'model':db[_0x451b4a['model']],'as':_0x451b4a['as'],'attributes':_0x451b4a[_0x4556('0x17')],'include':_0x451b4a['include']?_['map'](_0x451b4a['include'],function(_0x203463){return{'model':db[_0x203463[_0x4556('0x1b')]],'as':_0x203463['as'],'attributes':_0x203463[_0x4556('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x340feb){logger[_0x4556('0x1c')](_0x4556('0x1e'),_0x2b3fa5);logger[_0x4556('0xb')](_0x4556('0x1e'),_0x2b3fa5,JSON[_0x4556('0xd')](_0x340feb));_0x2ce0dd(_0x340feb);})['catch'](function(_0x34a3fd){logger[_0x4556('0xe')](_0x4556('0x1e'),_0x34a3fd['message'],_0x2b3fa5);_0x4ed1d5(_0x55c20b[_0x4556('0xe')](0x1f4,_0x34a3fd['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b5260ff..72c8974 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x3ce51e,_0x4679d4){var _0x1e366f=function(_0x3196d4){while(--_0x3196d4){_0x3ce51e['push'](_0x3ce51e['shift']());}};_0x1e366f(++_0x4679d4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0x0b0e[_0xd1a252];return _0x560ee1;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 094fac5..fc3dc40 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 _0xe495=['Case','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xe495,0x166));var _0x5e49=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xe495[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x5e49('0x0'));module[_0x5e49('0x1')]={'name':{'type':Sequelize[_0x5e49('0x2')]},'description':{'type':Sequelize[_0x5e49('0x2')]},'ticketType':{'type':Sequelize[_0x5e49('0x3')](_0x5e49('0x4'),_0x5e49('0x5')),'defaultValue':_0x5e49('0x4')},'moduleSearch':{'type':Sequelize[_0x5e49('0x3')]('contact_lead',_0x5e49('0x6'),_0x5e49('0x7'),_0x5e49('0x8'),_0x5e49('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x5e49('0x3')](_0x5e49('0xa'),_0x5e49('0x6'),_0x5e49('0x7'),_0x5e49('0x9')),'defaultValue':_0x5e49('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x5e49('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x5e49('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe099=['ENUM','Task','Case','contact_lead','lead','nothing','contact','account','STRING'];(function(_0x4121e9,_0x276fb1){var _0x46e1f2=function(_0x3d99af){while(--_0x3d99af){_0x4121e9['push'](_0x4121e9['shift']());}};_0x46e1f2(++_0x276fb1);}(_0xe099,0xe9));var _0x9e09=function(_0x5cc7d6,_0x4788ef){_0x5cc7d6=_0x5cc7d6-0x0;var _0x4752ee=_0xe099[_0x5cc7d6];return _0x4752ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9e09('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9e09('0x1')](_0x9e09('0x2'),_0x9e09('0x3')),'defaultValue':_0x9e09('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x9e09('0x4'),'contact',_0x9e09('0x5'),'account_contact_lead','account'),'defaultValue':_0x9e09('0x4')},'moduleCreate':{'type':Sequelize[_0x9e09('0x1')](_0x9e09('0x6'),_0x9e09('0x7'),_0x9e09('0x5'),_0x9e09('0x8')),'defaultValue':_0x9e09('0x5')},'leadId':{'type':Sequelize[_0x9e09('0x0')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x9e09('0x0')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index db7c1b3..fea17e9 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 _0x4677=['findAll','rows','catch','params','find','create','body','findOne','pick','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x3e5c96,_0x2d7111){var _0x92c369=function(_0x13a969){while(--_0x13a969){_0x3e5c96['push'](_0x3e5c96['shift']());}};_0x92c369(++_0x2d7111);}(_0x4677,0x155));var _0x7467=function(_0x37a1ff,_0x2e87b1){_0x37a1ff=_0x37a1ff-0x0;var _0x1ea3e9=_0x4677[_0x37a1ff];return _0x1ea3e9;};'use strict';var emlformat=require(_0x7467('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7467('0x1'));var jsonpatch=require(_0x7467('0x2'));var rp=require(_0x7467('0x3'));var moment=require('moment');var BPromise=require(_0x7467('0x4'));var Mustache=require(_0x7467('0x5'));var util=require(_0x7467('0x6'));var path=require(_0x7467('0x7'));var sox=require(_0x7467('0x8'));var csv=require(_0x7467('0x9'));var ejs=require(_0x7467('0xa'));var fs=require('fs');var fs_extra=require(_0x7467('0xb'));var _=require(_0x7467('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7467('0xd'));var deskjs=require(_0x7467('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7467('0xf'));var Papa=require(_0x7467('0x10'));var Redis=require('ioredis');var authService=require(_0x7467('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7467('0x12'));var hardwareService=require(_0x7467('0x13'));var logger=require(_0x7467('0x14'))('api');var utils=require(_0x7467('0x15'));var config=require(_0x7467('0x16'));var licenseUtil=require(_0x7467('0x17'));var db=require(_0x7467('0x18'))['db'];function respondWithStatusCode(_0x5a38d4,_0x3ac326){_0x3ac326=_0x3ac326||0xcc;return function(_0x50551c){if(_0x50551c){return _0x5a38d4[_0x7467('0x19')](_0x3ac326);}return _0x5a38d4[_0x7467('0x1a')](_0x3ac326)[_0x7467('0x1b')]();};}function respondWithResult(_0x3bf3d3,_0x575770){_0x575770=_0x575770||0xc8;return function(_0x125b6b){if(_0x125b6b){return _0x3bf3d3[_0x7467('0x1a')](_0x575770)[_0x7467('0x1c')](_0x125b6b);}};}function respondWithFilteredResult(_0x535b34,_0x1b0a19){return function(_0x221438){if(_0x221438){var _0x2c4bf9=typeof _0x1b0a19['offset']===_0x7467('0x1d')&&typeof _0x1b0a19[_0x7467('0x1e')]===_0x7467('0x1d');var _0x590705=_0x221438[_0x7467('0x1f')];var _0x5824d7=_0x2c4bf9?0x0:_0x1b0a19[_0x7467('0x20')];var _0x3609d7=_0x2c4bf9?_0x221438[_0x7467('0x1f')]:_0x1b0a19[_0x7467('0x20')]+_0x1b0a19[_0x7467('0x1e')];var _0x24e39a;if(_0x3609d7>=_0x590705){_0x3609d7=_0x590705;_0x24e39a=0xc8;}else{_0x24e39a=0xce;}_0x535b34[_0x7467('0x1a')](_0x24e39a);return _0x535b34[_0x7467('0x21')](_0x7467('0x22'),_0x5824d7+'-'+_0x3609d7+'/'+_0x590705)[_0x7467('0x1c')](_0x221438);}return null;};}function patchUpdates(_0x12e38d){return function(_0x3400d2){try{jsonpatch[_0x7467('0x23')](_0x3400d2,_0x12e38d,!![]);}catch(_0x477d92){return BPromise['reject'](_0x477d92);}return _0x3400d2[_0x7467('0x24')]();};}function saveUpdates(_0x6b5a97,_0x2d06cf){return function(_0x17b6b7){if(_0x17b6b7){return _0x17b6b7[_0x7467('0x25')](_0x6b5a97)['then'](function(_0x30a5ef){return _0x30a5ef;});}return null;};}function removeEntity(_0x4ff571,_0x3a665b){return function(_0x811f5a){if(_0x811f5a){return _0x811f5a[_0x7467('0x26')]()[_0x7467('0x27')](function(){_0x4ff571[_0x7467('0x1a')](0xcc)[_0x7467('0x1b')]();});}};}function handleEntityNotFound(_0x4a053d,_0xb54680){return function(_0x59ad1){if(!_0x59ad1){_0x4a053d['sendStatus'](0x194);}return _0x59ad1;};}function handleError(_0x489b75,_0x3f3d5d){_0x3f3d5d=_0x3f3d5d||0x1f4;return function(_0x342578){logger[_0x7467('0x28')](_0x342578[_0x7467('0x29')]);if(_0x342578['name']){delete _0x342578[_0x7467('0x2a')];}_0x489b75[_0x7467('0x1a')](_0x3f3d5d)['send'](_0x342578);};}exports[_0x7467('0x2b')]=function(_0x1b9c9a,_0x1e80ab){var _0x219c32={},_0x3753c6={},_0x4fe944={'count':0x0,'rows':[]};var _0x51b247=_['map'](db[_0x7467('0x2c')][_0x7467('0x2d')],function(_0x5572c5){return{'name':_0x5572c5[_0x7467('0x2e')],'type':_0x5572c5[_0x7467('0x2f')][_0x7467('0x30')]};});_0x3753c6[_0x7467('0x31')]=_[_0x7467('0x32')](_0x51b247,_0x7467('0x2a'));_0x3753c6['query']=_[_0x7467('0x33')](_0x1b9c9a[_0x7467('0x34')]);_0x3753c6[_0x7467('0x35')]=_['intersection'](_0x3753c6[_0x7467('0x31')],_0x3753c6[_0x7467('0x34')]);_0x219c32[_0x7467('0x36')]=_[_0x7467('0x37')](_0x3753c6[_0x7467('0x31')],qs[_0x7467('0x38')](_0x1b9c9a[_0x7467('0x34')][_0x7467('0x38')]));_0x219c32['attributes']=_0x219c32[_0x7467('0x36')][_0x7467('0x39')]?_0x219c32[_0x7467('0x36')]:_0x3753c6[_0x7467('0x31')];if(!_0x1b9c9a[_0x7467('0x34')][_0x7467('0x3a')](_0x7467('0x3b'))){_0x219c32[_0x7467('0x1e')]=qs[_0x7467('0x1e')](_0x1b9c9a[_0x7467('0x34')][_0x7467('0x1e')]);_0x219c32[_0x7467('0x20')]=qs[_0x7467('0x20')](_0x1b9c9a[_0x7467('0x34')][_0x7467('0x20')]);}_0x219c32[_0x7467('0x3c')]=qs[_0x7467('0x3d')](_0x1b9c9a[_0x7467('0x34')][_0x7467('0x3d')]);_0x219c32['where']=qs[_0x7467('0x35')](_['pick'](_0x1b9c9a[_0x7467('0x34')],_0x3753c6['filters']),_0x51b247);if(_0x1b9c9a[_0x7467('0x34')][_0x7467('0x3e')]){_0x219c32['where']=_['merge'](_0x219c32[_0x7467('0x3f')],{'$or':_[_0x7467('0x32')](_0x51b247,function(_0x2d9b44){if(_0x2d9b44[_0x7467('0x2f')]!==_0x7467('0x40')){var _0x52923b={};_0x52923b[_0x2d9b44[_0x7467('0x2a')]]={'$like':'%'+_0x1b9c9a[_0x7467('0x34')][_0x7467('0x3e')]+'%'};return _0x52923b;}})});}_0x219c32=_[_0x7467('0x41')]({},_0x219c32,_0x1b9c9a[_0x7467('0x42')]);var _0x1dca98={'where':_0x219c32[_0x7467('0x3f')]};return db[_0x7467('0x2c')][_0x7467('0x1f')](_0x1dca98)[_0x7467('0x27')](function(_0x169335){_0x4fe944['count']=_0x169335;if(_0x1b9c9a[_0x7467('0x34')][_0x7467('0x43')]){_0x219c32[_0x7467('0x44')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7467('0x45')](_0x219c32);})[_0x7467('0x27')](function(_0x23a26d){_0x4fe944[_0x7467('0x46')]=_0x23a26d;return _0x4fe944;})['then'](respondWithFilteredResult(_0x1e80ab,_0x219c32))[_0x7467('0x47')](handleError(_0x1e80ab,null));};exports['show']=function(_0x5d6184,_0x1f67b9){var _0x2cf32c={'raw':![],'where':{'id':_0x5d6184[_0x7467('0x48')]['id']}},_0x506a6e={};_0x506a6e['model']=_['keys'](db[_0x7467('0x2c')][_0x7467('0x2d')]);_0x506a6e['query']=_[_0x7467('0x33')](_0x5d6184[_0x7467('0x34')]);_0x506a6e[_0x7467('0x35')]=_[_0x7467('0x37')](_0x506a6e['model'],_0x506a6e[_0x7467('0x34')]);_0x2cf32c[_0x7467('0x36')]=_[_0x7467('0x37')](_0x506a6e[_0x7467('0x31')],qs['fields'](_0x5d6184[_0x7467('0x34')][_0x7467('0x38')]));_0x2cf32c[_0x7467('0x36')]=_0x2cf32c[_0x7467('0x36')]['length']?_0x2cf32c['attributes']:_0x506a6e[_0x7467('0x31')];if(_0x5d6184[_0x7467('0x34')][_0x7467('0x43')]){_0x2cf32c[_0x7467('0x44')]=[{'all':!![]}];}_0x2cf32c=_['merge']({},_0x2cf32c,_0x5d6184[_0x7467('0x42')]);return db[_0x7467('0x2c')][_0x7467('0x49')](_0x2cf32c)[_0x7467('0x27')](handleEntityNotFound(_0x1f67b9,null))[_0x7467('0x27')](respondWithResult(_0x1f67b9,null))['catch'](handleError(_0x1f67b9,null));};exports['create']=function(_0x59a55e,_0x357966){return db['SalesforceConfiguration'][_0x7467('0x4a')](_0x59a55e['body'],{})[_0x7467('0x27')](respondWithResult(_0x357966,0xc9))['catch'](handleError(_0x357966,null));};exports[_0x7467('0x25')]=function(_0x963830,_0x2ea1fd){if(_0x963830[_0x7467('0x4b')]['id']){delete _0x963830[_0x7467('0x4b')]['id'];}return db[_0x7467('0x2c')]['find']({'where':{'id':_0x963830['params']['id']}})[_0x7467('0x27')](handleEntityNotFound(_0x2ea1fd,null))[_0x7467('0x27')](saveUpdates(_0x963830[_0x7467('0x4b')],null))[_0x7467('0x27')](respondWithResult(_0x2ea1fd,null))['catch'](handleError(_0x2ea1fd,null));};exports[_0x7467('0x26')]=function(_0x22ba12,_0x215f60){return db[_0x7467('0x2c')][_0x7467('0x49')]({'where':{'id':_0x22ba12['params']['id']}})[_0x7467('0x27')](handleEntityNotFound(_0x215f60,null))['then'](removeEntity(_0x215f60,null))['catch'](handleError(_0x215f60,null));};exports['getFields']=function(_0x53f412,_0x60069f,_0x5b914f){var _0x396dc3={};var _0x149574={};var _0x364137;var _0x10f2c3;return db[_0x7467('0x2c')][_0x7467('0x4c')]({'where':{'id':_0x53f412['params']['id']}})[_0x7467('0x27')](handleEntityNotFound(_0x60069f,null))[_0x7467('0x27')](function(_0x2af6f2){if(_0x2af6f2){_0x364137=_0x2af6f2;_0x149574[_0x7467('0x31')]=_[_0x7467('0x33')](db['SalesforceField']['rawAttributes']);_0x149574['query']=_[_0x7467('0x33')](_0x53f412[_0x7467('0x34')]);_0x149574['filters']=_[_0x7467('0x37')](_0x149574['model'],_0x149574[_0x7467('0x34')]);_0x396dc3[_0x7467('0x36')]=_[_0x7467('0x37')](_0x149574[_0x7467('0x31')],qs['fields'](_0x53f412[_0x7467('0x34')][_0x7467('0x38')]));_0x396dc3['attributes']=_0x396dc3[_0x7467('0x36')][_0x7467('0x39')]?_0x396dc3['attributes']:_0x149574[_0x7467('0x31')];_0x396dc3['order']=qs[_0x7467('0x3d')](_0x53f412[_0x7467('0x34')][_0x7467('0x3d')]);_0x396dc3[_0x7467('0x3f')]=qs[_0x7467('0x35')](_[_0x7467('0x4d')](_0x53f412[_0x7467('0x34')],_0x149574[_0x7467('0x35')]));if(_0x53f412[_0x7467('0x34')][_0x7467('0x3e')]){_0x396dc3[_0x7467('0x3f')]=_[_0x7467('0x41')](_0x396dc3[_0x7467('0x3f')],{'$or':_[_0x7467('0x32')](_0x396dc3['attributes'],function(_0x29d323){var _0x40a562={};_0x40a562[_0x29d323]={'$like':'%'+_0x53f412['query'][_0x7467('0x3e')]+'%'};return _0x40a562;})});}_0x396dc3=_[_0x7467('0x41')]({},_0x396dc3,_0x53f412[_0x7467('0x42')]);return _0x364137[_0x7467('0x4e')](_0x396dc3);}})[_0x7467('0x27')](function(_0x59a097){if(_0x59a097){_0x10f2c3=_0x59a097[_0x7467('0x39')];if(!_0x53f412['query'][_0x7467('0x3a')](_0x7467('0x3b'))){_0x396dc3[_0x7467('0x1e')]=qs[_0x7467('0x1e')](_0x53f412[_0x7467('0x34')][_0x7467('0x1e')]);_0x396dc3['offset']=qs[_0x7467('0x20')](_0x53f412[_0x7467('0x34')]['offset']);}return _0x364137[_0x7467('0x4e')](_0x396dc3);}})[_0x7467('0x27')](function(_0x440f6a){if(_0x440f6a){return _0x440f6a?{'count':_0x10f2c3,'rows':_0x440f6a}:null;}})[_0x7467('0x27')](respondWithResult(_0x60069f,null))['catch'](handleError(_0x60069f,null));};exports[_0x7467('0x4f')]=function(_0x1b9dd1,_0x227c1e,_0x3626f9){var _0x14ef93={};var _0x2b6632={};var _0x5417b6;var _0x3ef255;return db['SalesforceConfiguration'][_0x7467('0x4c')]({'where':{'id':_0x1b9dd1[_0x7467('0x48')]['id']}})[_0x7467('0x27')](handleEntityNotFound(_0x227c1e,null))[_0x7467('0x27')](function(_0x23720a){if(_0x23720a){_0x5417b6=_0x23720a;_0x2b6632[_0x7467('0x31')]=_['keys'](db[_0x7467('0x50')][_0x7467('0x2d')]);_0x2b6632[_0x7467('0x34')]=_['keys'](_0x1b9dd1['query']);_0x2b6632[_0x7467('0x35')]=_[_0x7467('0x37')](_0x2b6632[_0x7467('0x31')],_0x2b6632[_0x7467('0x34')]);_0x14ef93[_0x7467('0x36')]=_['intersection'](_0x2b6632[_0x7467('0x31')],qs[_0x7467('0x38')](_0x1b9dd1[_0x7467('0x34')]['fields']));_0x14ef93[_0x7467('0x36')]=_0x14ef93['attributes'][_0x7467('0x39')]?_0x14ef93[_0x7467('0x36')]:_0x2b6632[_0x7467('0x31')];_0x14ef93[_0x7467('0x3c')]=qs[_0x7467('0x3d')](_0x1b9dd1[_0x7467('0x34')][_0x7467('0x3d')]);_0x14ef93[_0x7467('0x3f')]=qs[_0x7467('0x35')](_[_0x7467('0x4d')](_0x1b9dd1['query'],_0x2b6632[_0x7467('0x35')]));if(_0x1b9dd1[_0x7467('0x34')][_0x7467('0x3e')]){_0x14ef93[_0x7467('0x3f')]=_[_0x7467('0x41')](_0x14ef93[_0x7467('0x3f')],{'$or':_[_0x7467('0x32')](_0x14ef93['attributes'],function(_0x55c9be){var _0x5e96bc={};_0x5e96bc[_0x55c9be]={'$like':'%'+_0x1b9dd1[_0x7467('0x34')][_0x7467('0x3e')]+'%'};return _0x5e96bc;})});}_0x14ef93=_['merge']({},_0x14ef93,_0x1b9dd1['options']);return _0x5417b6[_0x7467('0x4f')](_0x14ef93);}})[_0x7467('0x27')](function(_0x404614){if(_0x404614){_0x3ef255=_0x404614[_0x7467('0x39')];if(!_0x1b9dd1[_0x7467('0x34')]['hasOwnProperty'](_0x7467('0x3b'))){_0x14ef93[_0x7467('0x1e')]=qs[_0x7467('0x1e')](_0x1b9dd1[_0x7467('0x34')][_0x7467('0x1e')]);_0x14ef93[_0x7467('0x20')]=qs[_0x7467('0x20')](_0x1b9dd1[_0x7467('0x34')][_0x7467('0x20')]);}return _0x5417b6[_0x7467('0x4f')](_0x14ef93);}})[_0x7467('0x27')](function(_0x462d4b){if(_0x462d4b){return _0x462d4b?{'count':_0x3ef255,'rows':_0x462d4b}:null;}})['then'](respondWithResult(_0x227c1e,null))[_0x7467('0x47')](handleError(_0x227c1e,null));};exports[_0x7467('0x51')]=function(_0x430805,_0x5d73ab,_0x36e4f0){var _0x571266={};var _0x44950b={};var _0x831370;var _0x2c1b9e;return db[_0x7467('0x2c')]['findOne']({'where':{'id':_0x430805[_0x7467('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d73ab,null))[_0x7467('0x27')](function(_0x2fa158){if(_0x2fa158){_0x831370=_0x2fa158;_0x44950b[_0x7467('0x31')]=_['keys'](db[_0x7467('0x50')][_0x7467('0x2d')]);_0x44950b[_0x7467('0x34')]=_['keys'](_0x430805[_0x7467('0x34')]);_0x44950b['filters']=_[_0x7467('0x37')](_0x44950b['model'],_0x44950b[_0x7467('0x34')]);_0x571266[_0x7467('0x36')]=_[_0x7467('0x37')](_0x44950b[_0x7467('0x31')],qs[_0x7467('0x38')](_0x430805[_0x7467('0x34')][_0x7467('0x38')]));_0x571266[_0x7467('0x36')]=_0x571266[_0x7467('0x36')][_0x7467('0x39')]?_0x571266['attributes']:_0x44950b[_0x7467('0x31')];_0x571266[_0x7467('0x3c')]=qs[_0x7467('0x3d')](_0x430805['query'][_0x7467('0x3d')]);_0x571266[_0x7467('0x3f')]=qs[_0x7467('0x35')](_[_0x7467('0x4d')](_0x430805[_0x7467('0x34')],_0x44950b['filters']));if(_0x430805[_0x7467('0x34')][_0x7467('0x3e')]){_0x571266[_0x7467('0x3f')]=_[_0x7467('0x41')](_0x571266['where'],{'$or':_[_0x7467('0x32')](_0x571266[_0x7467('0x36')],function(_0x47f43d){var _0x88974e={};_0x88974e[_0x47f43d]={'$like':'%'+_0x430805[_0x7467('0x34')]['filter']+'%'};return _0x88974e;})});}_0x571266=_[_0x7467('0x41')]({},_0x571266,_0x430805[_0x7467('0x42')]);return _0x831370[_0x7467('0x51')](_0x571266);}})[_0x7467('0x27')](function(_0x387851){if(_0x387851){_0x2c1b9e=_0x387851[_0x7467('0x39')];if(!_0x430805[_0x7467('0x34')][_0x7467('0x3a')]('nolimit')){_0x571266[_0x7467('0x1e')]=qs[_0x7467('0x1e')](_0x430805['query'][_0x7467('0x1e')]);_0x571266['offset']=qs[_0x7467('0x20')](_0x430805[_0x7467('0x34')][_0x7467('0x20')]);}return _0x831370[_0x7467('0x51')](_0x571266);}})[_0x7467('0x27')](function(_0x2ee78f){if(_0x2ee78f){return _0x2ee78f?{'count':_0x2c1b9e,'rows':_0x2ee78f}:null;}})[_0x7467('0x27')](respondWithResult(_0x5d73ab,null))[_0x7467('0x47')](handleError(_0x5d73ab,null));}; \ No newline at end of file +var _0xe476=['to-csv','ejs','fs-extra','lodash','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','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','SalesforceConfiguration','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','findOne','getFields','nolimit','getSubjects','SalesforceField','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x4eba5c,_0x59a4c7){var _0xf8e41d=function(_0x26775d){while(--_0x26775d){_0x4eba5c['push'](_0x4eba5c['shift']());}};_0xf8e41d(++_0x59a4c7);}(_0xe476,0x95));var _0x6e47=function(_0x1f68c3,_0xe02329){_0x1f68c3=_0x1f68c3-0x0;var _0x17b4af=_0xe476[_0x1f68c3];return _0x17b4af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e47('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e47('0x1'));var moment=require(_0x6e47('0x2'));var BPromise=require(_0x6e47('0x3'));var Mustache=require(_0x6e47('0x4'));var util=require(_0x6e47('0x5'));var path=require('path');var sox=require(_0x6e47('0x6'));var csv=require(_0x6e47('0x7'));var ejs=require(_0x6e47('0x8'));var fs=require('fs');var fs_extra=require(_0x6e47('0x9'));var _=require(_0x6e47('0xa'));var squel=require('squel');var crypto=require(_0x6e47('0xb'));var jsforce=require(_0x6e47('0xc'));var deskjs=require(_0x6e47('0xd'));var toCsv=require(_0x6e47('0x7'));var querystring=require(_0x6e47('0xe'));var Papa=require(_0x6e47('0xf'));var Redis=require(_0x6e47('0x10'));var authService=require(_0x6e47('0x11'));var qs=require(_0x6e47('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e47('0x13'));var logger=require('../../config/logger')(_0x6e47('0x14'));var utils=require(_0x6e47('0x15'));var config=require(_0x6e47('0x16'));var licenseUtil=require(_0x6e47('0x17'));var db=require(_0x6e47('0x18'))['db'];function respondWithStatusCode(_0x48d0b6,_0x37d5c1){_0x37d5c1=_0x37d5c1||0xcc;return function(_0x17c50c){if(_0x17c50c){return _0x48d0b6['sendStatus'](_0x37d5c1);}return _0x48d0b6[_0x6e47('0x19')](_0x37d5c1)[_0x6e47('0x1a')]();};}function respondWithResult(_0x444299,_0x5ea9ea){_0x5ea9ea=_0x5ea9ea||0xc8;return function(_0x577aaf){if(_0x577aaf){return _0x444299[_0x6e47('0x19')](_0x5ea9ea)[_0x6e47('0x1b')](_0x577aaf);}};}function respondWithFilteredResult(_0x500eed,_0x3bda94){return function(_0x37ad4c){if(_0x37ad4c){var _0x41f9ff=typeof _0x3bda94['offset']===_0x6e47('0x1c')&&typeof _0x3bda94[_0x6e47('0x1d')]==='undefined';var _0x4d50da=_0x37ad4c[_0x6e47('0x1e')];var _0x1b7b94=_0x41f9ff?0x0:_0x3bda94[_0x6e47('0x1f')];var _0x22444f=_0x41f9ff?_0x37ad4c[_0x6e47('0x1e')]:_0x3bda94[_0x6e47('0x1f')]+_0x3bda94[_0x6e47('0x1d')];var _0x5d4566;if(_0x22444f>=_0x4d50da){_0x22444f=_0x4d50da;_0x5d4566=0xc8;}else{_0x5d4566=0xce;}_0x500eed['status'](_0x5d4566);return _0x500eed[_0x6e47('0x20')](_0x6e47('0x21'),_0x1b7b94+'-'+_0x22444f+'/'+_0x4d50da)[_0x6e47('0x1b')](_0x37ad4c);}return null;};}function patchUpdates(_0x315bc1){return function(_0x3fa5db){try{jsonpatch[_0x6e47('0x22')](_0x3fa5db,_0x315bc1,!![]);}catch(_0x1b0a7f){return BPromise[_0x6e47('0x23')](_0x1b0a7f);}return _0x3fa5db[_0x6e47('0x24')]();};}function saveUpdates(_0x1e29cc,_0x20736e){return function(_0x41b9ee){if(_0x41b9ee){return _0x41b9ee[_0x6e47('0x25')](_0x1e29cc)[_0x6e47('0x26')](function(_0x46669f){return _0x46669f;});}return null;};}function removeEntity(_0xf22445,_0x3b4c15){return function(_0x32a3d7){if(_0x32a3d7){return _0x32a3d7[_0x6e47('0x27')]()[_0x6e47('0x26')](function(){_0xf22445['status'](0xcc)[_0x6e47('0x1a')]();});}};}function handleEntityNotFound(_0x5e25c6,_0x18c85e){return function(_0x2ca6e6){if(!_0x2ca6e6){_0x5e25c6['sendStatus'](0x194);}return _0x2ca6e6;};}function handleError(_0x53a21f,_0x2cc7be){_0x2cc7be=_0x2cc7be||0x1f4;return function(_0x528e1e){logger[_0x6e47('0x28')](_0x528e1e['stack']);if(_0x528e1e[_0x6e47('0x29')]){delete _0x528e1e[_0x6e47('0x29')];}_0x53a21f[_0x6e47('0x19')](_0x2cc7be)[_0x6e47('0x2a')](_0x528e1e);};}exports['index']=function(_0x2a3207,_0x23c0a3){var _0x48deff={},_0x102519={},_0x2ae2e5={'count':0x0,'rows':[]};var _0x2ca622=_[_0x6e47('0x2b')](db[_0x6e47('0x2c')][_0x6e47('0x2d')],function(_0xb95015){return{'name':_0xb95015['fieldName'],'type':_0xb95015['type']['key']};});_0x102519['model']=_[_0x6e47('0x2b')](_0x2ca622,'name');_0x102519[_0x6e47('0x2e')]=_[_0x6e47('0x2f')](_0x2a3207[_0x6e47('0x2e')]);_0x102519[_0x6e47('0x30')]=_[_0x6e47('0x31')](_0x102519[_0x6e47('0x32')],_0x102519[_0x6e47('0x2e')]);_0x48deff['attributes']=_[_0x6e47('0x31')](_0x102519[_0x6e47('0x32')],qs[_0x6e47('0x33')](_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x33')]));_0x48deff[_0x6e47('0x34')]=_0x48deff[_0x6e47('0x34')][_0x6e47('0x35')]?_0x48deff['attributes']:_0x102519[_0x6e47('0x32')];if(!_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x36')]('nolimit')){_0x48deff['limit']=qs['limit'](_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x1d')]);_0x48deff[_0x6e47('0x1f')]=qs[_0x6e47('0x1f')](_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x1f')]);}_0x48deff[_0x6e47('0x37')]=qs[_0x6e47('0x38')](_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x38')]);_0x48deff[_0x6e47('0x39')]=qs[_0x6e47('0x30')](_[_0x6e47('0x3a')](_0x2a3207['query'],_0x102519['filters']),_0x2ca622);if(_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x3b')]){_0x48deff[_0x6e47('0x39')]=_[_0x6e47('0x3c')](_0x48deff[_0x6e47('0x39')],{'$or':_[_0x6e47('0x2b')](_0x2ca622,function(_0x526f6b){if(_0x526f6b['type']!==_0x6e47('0x3d')){var _0x2e0488={};_0x2e0488[_0x526f6b[_0x6e47('0x29')]]={'$like':'%'+_0x2a3207['query'][_0x6e47('0x3b')]+'%'};return _0x2e0488;}})});}_0x48deff=_[_0x6e47('0x3c')]({},_0x48deff,_0x2a3207[_0x6e47('0x3e')]);var _0x1dc355={'where':_0x48deff[_0x6e47('0x39')]};return db[_0x6e47('0x2c')][_0x6e47('0x1e')](_0x1dc355)['then'](function(_0x4a8c06){_0x2ae2e5[_0x6e47('0x1e')]=_0x4a8c06;if(_0x2a3207[_0x6e47('0x2e')][_0x6e47('0x3f')]){_0x48deff[_0x6e47('0x40')]=[{'all':!![]}];}return db[_0x6e47('0x2c')]['findAll'](_0x48deff);})['then'](function(_0x10685e){_0x2ae2e5[_0x6e47('0x41')]=_0x10685e;return _0x2ae2e5;})['then'](respondWithFilteredResult(_0x23c0a3,_0x48deff))[_0x6e47('0x42')](handleError(_0x23c0a3,null));};exports[_0x6e47('0x43')]=function(_0x56646a,_0x2b8c92){var _0x33972a={'raw':![],'where':{'id':_0x56646a[_0x6e47('0x44')]['id']}},_0x456f07={};_0x456f07['model']=_['keys'](db[_0x6e47('0x2c')]['rawAttributes']);_0x456f07['query']=_[_0x6e47('0x2f')](_0x56646a[_0x6e47('0x2e')]);_0x456f07['filters']=_['intersection'](_0x456f07[_0x6e47('0x32')],_0x456f07[_0x6e47('0x2e')]);_0x33972a['attributes']=_['intersection'](_0x456f07[_0x6e47('0x32')],qs[_0x6e47('0x33')](_0x56646a[_0x6e47('0x2e')][_0x6e47('0x33')]));_0x33972a[_0x6e47('0x34')]=_0x33972a[_0x6e47('0x34')][_0x6e47('0x35')]?_0x33972a[_0x6e47('0x34')]:_0x456f07[_0x6e47('0x32')];if(_0x56646a[_0x6e47('0x2e')][_0x6e47('0x3f')]){_0x33972a['include']=[{'all':!![]}];}_0x33972a=_[_0x6e47('0x3c')]({},_0x33972a,_0x56646a[_0x6e47('0x3e')]);return db[_0x6e47('0x2c')]['find'](_0x33972a)[_0x6e47('0x26')](handleEntityNotFound(_0x2b8c92,null))[_0x6e47('0x26')](respondWithResult(_0x2b8c92,null))['catch'](handleError(_0x2b8c92,null));};exports[_0x6e47('0x45')]=function(_0x3ba3a1,_0xfcc329){return db[_0x6e47('0x2c')][_0x6e47('0x45')](_0x3ba3a1[_0x6e47('0x46')],{})['then'](respondWithResult(_0xfcc329,0xc9))['catch'](handleError(_0xfcc329,null));};exports[_0x6e47('0x25')]=function(_0x186a6e,_0x89b1f9){if(_0x186a6e[_0x6e47('0x46')]['id']){delete _0x186a6e[_0x6e47('0x46')]['id'];}return db[_0x6e47('0x2c')]['find']({'where':{'id':_0x186a6e[_0x6e47('0x44')]['id']}})[_0x6e47('0x26')](handleEntityNotFound(_0x89b1f9,null))[_0x6e47('0x26')](saveUpdates(_0x186a6e[_0x6e47('0x46')],null))[_0x6e47('0x26')](respondWithResult(_0x89b1f9,null))[_0x6e47('0x42')](handleError(_0x89b1f9,null));};exports['destroy']=function(_0x4c07cc,_0x116aea){return db['SalesforceConfiguration'][_0x6e47('0x47')]({'where':{'id':_0x4c07cc[_0x6e47('0x44')]['id']}})['then'](handleEntityNotFound(_0x116aea,null))[_0x6e47('0x26')](removeEntity(_0x116aea,null))[_0x6e47('0x42')](handleError(_0x116aea,null));};exports['getFields']=function(_0x24d666,_0x4d4ac6,_0x179c23){var _0x9b244d={};var _0x3de4c5={};var _0x1b794d;var _0x113eda;return db[_0x6e47('0x2c')][_0x6e47('0x48')]({'where':{'id':_0x24d666[_0x6e47('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4ac6,null))['then'](function(_0x29d4e2){if(_0x29d4e2){_0x1b794d=_0x29d4e2;_0x3de4c5['model']=_[_0x6e47('0x2f')](db['SalesforceField'][_0x6e47('0x2d')]);_0x3de4c5['query']=_[_0x6e47('0x2f')](_0x24d666[_0x6e47('0x2e')]);_0x3de4c5['filters']=_[_0x6e47('0x31')](_0x3de4c5[_0x6e47('0x32')],_0x3de4c5['query']);_0x9b244d[_0x6e47('0x34')]=_[_0x6e47('0x31')](_0x3de4c5[_0x6e47('0x32')],qs[_0x6e47('0x33')](_0x24d666[_0x6e47('0x2e')][_0x6e47('0x33')]));_0x9b244d[_0x6e47('0x34')]=_0x9b244d[_0x6e47('0x34')][_0x6e47('0x35')]?_0x9b244d[_0x6e47('0x34')]:_0x3de4c5[_0x6e47('0x32')];_0x9b244d[_0x6e47('0x37')]=qs[_0x6e47('0x38')](_0x24d666[_0x6e47('0x2e')][_0x6e47('0x38')]);_0x9b244d[_0x6e47('0x39')]=qs['filters'](_[_0x6e47('0x3a')](_0x24d666[_0x6e47('0x2e')],_0x3de4c5[_0x6e47('0x30')]));if(_0x24d666[_0x6e47('0x2e')]['filter']){_0x9b244d[_0x6e47('0x39')]=_[_0x6e47('0x3c')](_0x9b244d[_0x6e47('0x39')],{'$or':_[_0x6e47('0x2b')](_0x9b244d[_0x6e47('0x34')],function(_0x123735){var _0x55d2ec={};_0x55d2ec[_0x123735]={'$like':'%'+_0x24d666[_0x6e47('0x2e')][_0x6e47('0x3b')]+'%'};return _0x55d2ec;})});}_0x9b244d=_[_0x6e47('0x3c')]({},_0x9b244d,_0x24d666[_0x6e47('0x3e')]);return _0x1b794d[_0x6e47('0x49')](_0x9b244d);}})[_0x6e47('0x26')](function(_0x849cda){if(_0x849cda){_0x113eda=_0x849cda[_0x6e47('0x35')];if(!_0x24d666[_0x6e47('0x2e')]['hasOwnProperty'](_0x6e47('0x4a'))){_0x9b244d[_0x6e47('0x1d')]=qs[_0x6e47('0x1d')](_0x24d666[_0x6e47('0x2e')]['limit']);_0x9b244d['offset']=qs['offset'](_0x24d666[_0x6e47('0x2e')]['offset']);}return _0x1b794d['getFields'](_0x9b244d);}})[_0x6e47('0x26')](function(_0x1e20db){if(_0x1e20db){return _0x1e20db?{'count':_0x113eda,'rows':_0x1e20db}:null;}})['then'](respondWithResult(_0x4d4ac6,null))[_0x6e47('0x42')](handleError(_0x4d4ac6,null));};exports[_0x6e47('0x4b')]=function(_0x26ade2,_0x3b49a2,_0x8f349e){var _0x39e5fe={};var _0x45d227={};var _0x5eb554;var _0x374d83;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x26ade2[_0x6e47('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b49a2,null))[_0x6e47('0x26')](function(_0x21d093){if(_0x21d093){_0x5eb554=_0x21d093;_0x45d227[_0x6e47('0x32')]=_[_0x6e47('0x2f')](db[_0x6e47('0x4c')]['rawAttributes']);_0x45d227[_0x6e47('0x2e')]=_['keys'](_0x26ade2['query']);_0x45d227[_0x6e47('0x30')]=_[_0x6e47('0x31')](_0x45d227[_0x6e47('0x32')],_0x45d227[_0x6e47('0x2e')]);_0x39e5fe[_0x6e47('0x34')]=_[_0x6e47('0x31')](_0x45d227[_0x6e47('0x32')],qs[_0x6e47('0x33')](_0x26ade2['query'][_0x6e47('0x33')]));_0x39e5fe[_0x6e47('0x34')]=_0x39e5fe[_0x6e47('0x34')][_0x6e47('0x35')]?_0x39e5fe[_0x6e47('0x34')]:_0x45d227[_0x6e47('0x32')];_0x39e5fe[_0x6e47('0x37')]=qs[_0x6e47('0x38')](_0x26ade2[_0x6e47('0x2e')][_0x6e47('0x38')]);_0x39e5fe[_0x6e47('0x39')]=qs[_0x6e47('0x30')](_['pick'](_0x26ade2[_0x6e47('0x2e')],_0x45d227[_0x6e47('0x30')]));if(_0x26ade2[_0x6e47('0x2e')]['filter']){_0x39e5fe[_0x6e47('0x39')]=_[_0x6e47('0x3c')](_0x39e5fe[_0x6e47('0x39')],{'$or':_['map'](_0x39e5fe[_0x6e47('0x34')],function(_0x46b2b0){var _0x83cca3={};_0x83cca3[_0x46b2b0]={'$like':'%'+_0x26ade2[_0x6e47('0x2e')][_0x6e47('0x3b')]+'%'};return _0x83cca3;})});}_0x39e5fe=_[_0x6e47('0x3c')]({},_0x39e5fe,_0x26ade2[_0x6e47('0x3e')]);return _0x5eb554[_0x6e47('0x4b')](_0x39e5fe);}})[_0x6e47('0x26')](function(_0x11c786){if(_0x11c786){_0x374d83=_0x11c786[_0x6e47('0x35')];if(!_0x26ade2[_0x6e47('0x2e')][_0x6e47('0x36')](_0x6e47('0x4a'))){_0x39e5fe[_0x6e47('0x1d')]=qs[_0x6e47('0x1d')](_0x26ade2[_0x6e47('0x2e')]['limit']);_0x39e5fe[_0x6e47('0x1f')]=qs[_0x6e47('0x1f')](_0x26ade2[_0x6e47('0x2e')][_0x6e47('0x1f')]);}return _0x5eb554['getSubjects'](_0x39e5fe);}})[_0x6e47('0x26')](function(_0x3628dc){if(_0x3628dc){return _0x3628dc?{'count':_0x374d83,'rows':_0x3628dc}:null;}})[_0x6e47('0x26')](respondWithResult(_0x3b49a2,null))[_0x6e47('0x42')](handleError(_0x3b49a2,null));};exports[_0x6e47('0x4d')]=function(_0x4deac6,_0x144a42,_0x4caef8){var _0x219dd2={};var _0x25ae37={};var _0x15fc47;var _0xea11dc;return db[_0x6e47('0x2c')][_0x6e47('0x48')]({'where':{'id':_0x4deac6['params']['id']}})['then'](handleEntityNotFound(_0x144a42,null))[_0x6e47('0x26')](function(_0x2be691){if(_0x2be691){_0x15fc47=_0x2be691;_0x25ae37[_0x6e47('0x32')]=_[_0x6e47('0x2f')](db[_0x6e47('0x4c')][_0x6e47('0x2d')]);_0x25ae37['query']=_[_0x6e47('0x2f')](_0x4deac6[_0x6e47('0x2e')]);_0x25ae37['filters']=_['intersection'](_0x25ae37['model'],_0x25ae37[_0x6e47('0x2e')]);_0x219dd2[_0x6e47('0x34')]=_[_0x6e47('0x31')](_0x25ae37['model'],qs[_0x6e47('0x33')](_0x4deac6[_0x6e47('0x2e')][_0x6e47('0x33')]));_0x219dd2[_0x6e47('0x34')]=_0x219dd2['attributes'][_0x6e47('0x35')]?_0x219dd2[_0x6e47('0x34')]:_0x25ae37[_0x6e47('0x32')];_0x219dd2[_0x6e47('0x37')]=qs['sort'](_0x4deac6[_0x6e47('0x2e')][_0x6e47('0x38')]);_0x219dd2['where']=qs[_0x6e47('0x30')](_[_0x6e47('0x3a')](_0x4deac6[_0x6e47('0x2e')],_0x25ae37['filters']));if(_0x4deac6['query'][_0x6e47('0x3b')]){_0x219dd2[_0x6e47('0x39')]=_[_0x6e47('0x3c')](_0x219dd2[_0x6e47('0x39')],{'$or':_['map'](_0x219dd2[_0x6e47('0x34')],function(_0x5c83fb){var _0x34f3ea={};_0x34f3ea[_0x5c83fb]={'$like':'%'+_0x4deac6['query'][_0x6e47('0x3b')]+'%'};return _0x34f3ea;})});}_0x219dd2=_[_0x6e47('0x3c')]({},_0x219dd2,_0x4deac6[_0x6e47('0x3e')]);return _0x15fc47[_0x6e47('0x4d')](_0x219dd2);}})[_0x6e47('0x26')](function(_0x232b51){if(_0x232b51){_0xea11dc=_0x232b51[_0x6e47('0x35')];if(!_0x4deac6['query'][_0x6e47('0x36')](_0x6e47('0x4a'))){_0x219dd2[_0x6e47('0x1d')]=qs[_0x6e47('0x1d')](_0x4deac6['query'][_0x6e47('0x1d')]);_0x219dd2[_0x6e47('0x1f')]=qs[_0x6e47('0x1f')](_0x4deac6['query']['offset']);}return _0x15fc47[_0x6e47('0x4d')](_0x219dd2);}})[_0x6e47('0x26')](function(_0x330236){if(_0x330236){return _0x330236?{'count':_0xea11dc,'rows':_0x330236}:null;}})[_0x6e47('0x26')](respondWithResult(_0x144a42,null))[_0x6e47('0x42')](handleError(_0x144a42,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0c4d60f..259afd8 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 _0x8026=['rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x8026,0x172));var _0x6802=function(_0x56a7bc,_0x41d6f6){_0x56a7bc=_0x56a7bc-0x0;var _0x4f5883=_0x8026[_0x56a7bc];return _0x4f5883;};'use strict';var _=require('lodash');var util=require(_0x6802('0x0'));var logger=require(_0x6802('0x1'))(_0x6802('0x2'));var moment=require(_0x6802('0x3'));var BPromise=require(_0x6802('0x4'));var rp=require(_0x6802('0x5'));var fs=require('fs');var path=require(_0x6802('0x6'));var rimraf=require(_0x6802('0x7'));var config=require(_0x6802('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x6802('0x9')]=function(_0x3d3d21,_0x66f77c){return _0x3d3d21[_0x6802('0xa')](_0x6802('0xb'),attributes,{'tableName':_0x6802('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a6=['moment','bluebird','path','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x07a6,0x11f));var _0x607a=function(_0x14c4f2,_0x4df4b1){_0x14c4f2=_0x14c4f2-0x0;var _0x255998=_0x07a6[_0x14c4f2];return _0x255998;};'use strict';var _=require('lodash');var util=require(_0x607a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x607a('0x1'));var BPromise=require(_0x607a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x607a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x607a('0x4'));module[_0x607a('0x5')]=function(_0x1d94fa,_0x530d70){return _0x1d94fa[_0x607a('0x6')]('SalesforceConfiguration',attributes,{'tableName':_0x607a('0x7'),'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 6c98393..80405ee 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 _0x55a9=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x1ac9df,_0x4c9de2){var _0x288fb5=function(_0x3f3b2d){while(--_0x3f3b2d){_0x1ac9df['push'](_0x1ac9df['shift']());}};_0x288fb5(++_0x4c9de2);}(_0x55a9,0x190));var _0x955a=function(_0x4d73bb,_0x30853f){_0x4d73bb=_0x4d73bb-0x0;var _0x9eec7=_0x55a9[_0x4d73bb];return _0x9eec7;};'use strict';var _=require(_0x955a('0x0'));var util=require(_0x955a('0x1'));var moment=require('moment');var BPromise=require(_0x955a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x955a('0x3'));var db=require(_0x955a('0x4'))['db'];var utils=require(_0x955a('0x5'));var logger=require(_0x955a('0x6'))(_0x955a('0x7'));var config=require(_0x955a('0x8'));var jayson=require(_0x955a('0x9'));var client=jayson['client'][_0x955a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd7b3cf,_0x2d4154,_0x1c29e7){return new BPromise(function(_0x2e8ffa,_0x5963d8){return client['request'](_0xd7b3cf,_0x1c29e7)[_0x955a('0xb')](function(_0x5bf2d4){logger[_0x955a('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d4154,_0x955a('0xd'));logger[_0x955a('0xe')](_0x955a('0xf'),_0x2d4154,_0x955a('0xd'),JSON[_0x955a('0x10')](_0x5bf2d4));if(_0x5bf2d4['error']){if(_0x5bf2d4[_0x955a('0x11')][_0x955a('0x12')]===0x1f4){logger[_0x955a('0x11')](_0x955a('0x13'),_0x2d4154,_0x5bf2d4[_0x955a('0x11')][_0x955a('0x14')]);return _0x5963d8(_0x5bf2d4[_0x955a('0x11')]['message']);}logger[_0x955a('0x11')](_0x955a('0x13'),_0x2d4154,_0x5bf2d4[_0x955a('0x11')][_0x955a('0x14')]);return _0x2e8ffa(_0x5bf2d4[_0x955a('0x11')][_0x955a('0x14')]);}else{logger[_0x955a('0xc')](_0x955a('0x13'),_0x2d4154,_0x955a('0xd'));_0x2e8ffa(_0x5bf2d4[_0x955a('0x15')][_0x955a('0x14')]);}})[_0x955a('0x16')](function(_0x1be1cb){logger[_0x955a('0x11')](_0x955a('0x13'),_0x2d4154,_0x1be1cb);_0x5963d8(_0x1be1cb);});});} \ No newline at end of file +var _0x02a9=['http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x4180c6,_0x642cf3){var _0xe0e5aa=function(_0x37f4e8){while(--_0x37f4e8){_0x4180c6['push'](_0x4180c6['shift']());}};_0xe0e5aa(++_0x642cf3);}(_0x02a9,0x92));var _0x902a=function(_0x22c88e,_0x208a63){_0x22c88e=_0x22c88e-0x0;var _0x2e0251=_0x02a9[_0x22c88e];return _0x2e0251;};'use strict';var _=require(_0x902a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x902a('0x1'));var db=require(_0x902a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x902a('0x3'))(_0x902a('0x4'));var config=require('../../config/environment');var jayson=require(_0x902a('0x5'));var client=jayson[_0x902a('0x6')][_0x902a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x129dca,_0x589100,_0x3f09ae){return new BPromise(function(_0x42c7c5,_0x5d77c7){return client[_0x902a('0x8')](_0x129dca,_0x3f09ae)[_0x902a('0x9')](function(_0x2a2664){logger['info'](_0x902a('0xa'),_0x589100,_0x902a('0xb'));logger['debug'](_0x902a('0xc'),_0x589100,_0x902a('0xb'),JSON['stringify'](_0x2a2664));if(_0x2a2664[_0x902a('0xd')]){if(_0x2a2664[_0x902a('0xd')][_0x902a('0xe')]===0x1f4){logger[_0x902a('0xd')](_0x902a('0xa'),_0x589100,_0x2a2664[_0x902a('0xd')][_0x902a('0xf')]);return _0x5d77c7(_0x2a2664['error'][_0x902a('0xf')]);}logger[_0x902a('0xd')](_0x902a('0xa'),_0x589100,_0x2a2664[_0x902a('0xd')]['message']);return _0x42c7c5(_0x2a2664['error'][_0x902a('0xf')]);}else{logger['info'](_0x902a('0xa'),_0x589100,'request\x20sent');_0x42c7c5(_0x2a2664['result'][_0x902a('0xf')]);}})[_0x902a('0x10')](function(_0x5cc10f){logger[_0x902a('0xd')](_0x902a('0xa'),_0x589100,_0x5cc10f);_0x5d77c7(_0x5cc10f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2349bed..68611de 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 _0x0fd9=['../../components/auth/service','./intSalesforceField.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4bf811,_0x149608){var _0x99fcd3=function(_0x146afd){while(--_0x146afd){_0x4bf811['push'](_0x4bf811['shift']());}};_0x99fcd3(++_0x149608);}(_0x0fd9,0x139));var _0x90fd=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x0fd9[_0x1e91eb];return _0x2af75a;};'use strict';var multer=require(_0x90fd('0x0'));var util=require(_0x90fd('0x1'));var path=require(_0x90fd('0x2'));var timeout=require(_0x90fd('0x3'));var express=require(_0x90fd('0x4'));var router=express[_0x90fd('0x5')]();var fs_extra=require(_0x90fd('0x6'));var auth=require(_0x90fd('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x90fd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x90fd('0x9')]);router[_0x90fd('0xa')](_0x90fd('0xb'),auth[_0x90fd('0xc')](),controller[_0x90fd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')](_0x90fd('0xb'),auth[_0x90fd('0xc')](),controller[_0x90fd('0x10')]);router[_0x90fd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x90fd('0x12')]);module[_0x90fd('0x13')]=router; \ No newline at end of file +var _0xc9e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xc9e5,0xea));var _0x5c9e=function(_0x404f9d,_0x259493){_0x404f9d=_0x404f9d-0x0;var _0x5b0f75=_0xc9e5[_0x404f9d];return _0x5b0f75;};'use strict';var multer=require(_0x5c9e('0x0'));var util=require('util');var path=require(_0x5c9e('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c9e('0x2'));var router=express['Router']();var fs_extra=require(_0x5c9e('0x3'));var auth=require(_0x5c9e('0x4'));var interaction=require(_0x5c9e('0x5'));var config=require(_0x5c9e('0x6'));var controller=require(_0x5c9e('0x7'));router[_0x5c9e('0x8')]('/',auth[_0x5c9e('0x9')](),controller[_0x5c9e('0xa')]);router[_0x5c9e('0x8')](_0x5c9e('0xb'),auth[_0x5c9e('0x9')](),controller[_0x5c9e('0xc')]);router['post']('/',auth[_0x5c9e('0x9')](),controller[_0x5c9e('0xd')]);router['put'](_0x5c9e('0xb'),auth[_0x5c9e('0x9')](),controller['update']);router[_0x5c9e('0xe')]('/:id',auth[_0x5c9e('0x9')](),controller[_0x5c9e('0xf')]);module[_0x5c9e('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 2c94e64..b14d2a1 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 _0x4c89=['variable','picklist','STRING','ENUM','sequelize','string'];(function(_0x502704,_0x18c99c){var _0xfa218f=function(_0x46f938){while(--_0x46f938){_0x502704['push'](_0x502704['shift']());}};_0xfa218f(++_0x18c99c);}(_0x4c89,0x1ea));var _0x94c8=function(_0x44a393,_0x4e55d0){_0x44a393=_0x44a393-0x0;var _0x2e7269=_0x4c89[_0x44a393];return _0x2e7269;};'use strict';var Sequelize=require(_0x94c8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x94c8('0x1'),_0x94c8('0x2'),'customVariable','keyValue',_0x94c8('0x3')),'defaultValue':_0x94c8('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x94c8('0x4')]},'keyType':{'type':Sequelize[_0x94c8('0x5')]('string',_0x94c8('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x94c8('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x94c8('0x4')]}}; \ No newline at end of file +var _0xb99a=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x5c07dc,_0x17917c){var _0x427449=function(_0x3ef70c){while(--_0x3ef70c){_0x5c07dc['push'](_0x5c07dc['shift']());}};_0x427449(++_0x17917c);}(_0xb99a,0xdd));var _0xab99=function(_0x4e9f31,_0x427de8){_0x4e9f31=_0x4e9f31-0x0;var _0x5e48e3=_0xb99a[_0x4e9f31];return _0x5e48e3;};'use strict';var Sequelize=require(_0xab99('0x0'));module[_0xab99('0x1')]={'type':{'type':Sequelize[_0xab99('0x2')](_0xab99('0x3'),_0xab99('0x4'),_0xab99('0x5'),_0xab99('0x6'),_0xab99('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab99('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xab99('0x3'),'variable',_0xab99('0x5'))},'keyContent':{'type':Sequelize[_0xab99('0x8')]},'idField':{'type':Sequelize[_0xab99('0x8')]},'variableName':{'type':Sequelize[_0xab99('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8d74a94..d0290df 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 _0xd12b=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SalesforceField','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x225ffd,_0x6c0721){var _0xdd67a=function(_0x526bc3){while(--_0x526bc3){_0x225ffd['push'](_0x225ffd['shift']());}};_0xdd67a(++_0x6c0721);}(_0xd12b,0x17e));var _0xbd12=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xd12b[_0x687ddc];return _0x441991;};'use strict';var emlformat=require(_0xbd12('0x0'));var rimraf=require(_0xbd12('0x1'));var zipdir=require(_0xbd12('0x2'));var jsonpatch=require(_0xbd12('0x3'));var rp=require(_0xbd12('0x4'));var moment=require(_0xbd12('0x5'));var BPromise=require(_0xbd12('0x6'));var Mustache=require('mustache');var util=require(_0xbd12('0x7'));var path=require(_0xbd12('0x8'));var sox=require(_0xbd12('0x9'));var csv=require(_0xbd12('0xa'));var ejs=require(_0xbd12('0xb'));var fs=require('fs');var fs_extra=require(_0xbd12('0xc'));var _=require(_0xbd12('0xd'));var squel=require(_0xbd12('0xe'));var crypto=require(_0xbd12('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbd12('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbd12('0x11'));var Papa=require(_0xbd12('0x12'));var Redis=require(_0xbd12('0x13'));var authService=require(_0xbd12('0x14'));var qs=require(_0xbd12('0x15'));var as=require(_0xbd12('0x16'));var hardwareService=require(_0xbd12('0x17'));var logger=require('../../config/logger')(_0xbd12('0x18'));var utils=require('../../config/utils');var config=require(_0xbd12('0x19'));var licenseUtil=require(_0xbd12('0x1a'));var db=require(_0xbd12('0x1b'))['db'];function respondWithStatusCode(_0x49ac18,_0x2c4be9){_0x2c4be9=_0x2c4be9||0xcc;return function(_0x53ddbc){if(_0x53ddbc){return _0x49ac18['sendStatus'](_0x2c4be9);}return _0x49ac18[_0xbd12('0x1c')](_0x2c4be9)['end']();};}function respondWithResult(_0x296f36,_0x485e57){_0x485e57=_0x485e57||0xc8;return function(_0x517058){if(_0x517058){return _0x296f36[_0xbd12('0x1c')](_0x485e57)[_0xbd12('0x1d')](_0x517058);}};}function respondWithFilteredResult(_0x272a95,_0x55a36e){return function(_0x30ac77){if(_0x30ac77){var _0x30835c=typeof _0x55a36e[_0xbd12('0x1e')]===_0xbd12('0x1f')&&typeof _0x55a36e[_0xbd12('0x20')]===_0xbd12('0x1f');var _0x1fbef9=_0x30ac77[_0xbd12('0x21')];var _0x1861d0=_0x30835c?0x0:_0x55a36e[_0xbd12('0x1e')];var _0x29f245=_0x30835c?_0x30ac77[_0xbd12('0x21')]:_0x55a36e[_0xbd12('0x1e')]+_0x55a36e['limit'];var _0x15aaa5;if(_0x29f245>=_0x1fbef9){_0x29f245=_0x1fbef9;_0x15aaa5=0xc8;}else{_0x15aaa5=0xce;}_0x272a95[_0xbd12('0x1c')](_0x15aaa5);return _0x272a95[_0xbd12('0x22')](_0xbd12('0x23'),_0x1861d0+'-'+_0x29f245+'/'+_0x1fbef9)[_0xbd12('0x1d')](_0x30ac77);}return null;};}function patchUpdates(_0x662d31){return function(_0x3f702e){try{jsonpatch['apply'](_0x3f702e,_0x662d31,!![]);}catch(_0x58d6c2){return BPromise[_0xbd12('0x24')](_0x58d6c2);}return _0x3f702e[_0xbd12('0x25')]();};}function saveUpdates(_0x2f7b2b,_0x549b76){return function(_0x409eb2){if(_0x409eb2){return _0x409eb2[_0xbd12('0x26')](_0x2f7b2b)[_0xbd12('0x27')](function(_0x3556ec){return _0x3556ec;});}return null;};}function removeEntity(_0x509f1f,_0x1e9281){return function(_0x1e8b82){if(_0x1e8b82){return _0x1e8b82[_0xbd12('0x28')]()['then'](function(){_0x509f1f[_0xbd12('0x1c')](0xcc)[_0xbd12('0x29')]();});}};}function handleEntityNotFound(_0x10946f,_0x596373){return function(_0x172b23){if(!_0x172b23){_0x10946f[_0xbd12('0x2a')](0x194);}return _0x172b23;};}function handleError(_0x541951,_0x14d0bf){_0x14d0bf=_0x14d0bf||0x1f4;return function(_0x37028a){logger[_0xbd12('0x2b')](_0x37028a[_0xbd12('0x2c')]);if(_0x37028a['name']){delete _0x37028a[_0xbd12('0x2d')];}_0x541951[_0xbd12('0x1c')](_0x14d0bf)[_0xbd12('0x2e')](_0x37028a);};}exports[_0xbd12('0x2f')]=function(_0x5764f6,_0x3ad45c){var _0x4a2276={},_0x261b0e={},_0x57b44c={'count':0x0,'rows':[]};var _0xfcaeb=_[_0xbd12('0x30')](db[_0xbd12('0x31')]['rawAttributes'],function(_0x46a19c){return{'name':_0x46a19c['fieldName'],'type':_0x46a19c[_0xbd12('0x32')][_0xbd12('0x33')]};});_0x261b0e[_0xbd12('0x34')]=_[_0xbd12('0x30')](_0xfcaeb,'name');_0x261b0e[_0xbd12('0x35')]=_[_0xbd12('0x36')](_0x5764f6[_0xbd12('0x35')]);_0x261b0e[_0xbd12('0x37')]=_['intersection'](_0x261b0e['model'],_0x261b0e[_0xbd12('0x35')]);_0x4a2276[_0xbd12('0x38')]=_[_0xbd12('0x39')](_0x261b0e['model'],qs[_0xbd12('0x3a')](_0x5764f6[_0xbd12('0x35')][_0xbd12('0x3a')]));_0x4a2276[_0xbd12('0x38')]=_0x4a2276[_0xbd12('0x38')][_0xbd12('0x3b')]?_0x4a2276[_0xbd12('0x38')]:_0x261b0e[_0xbd12('0x34')];if(!_0x5764f6['query'][_0xbd12('0x3c')](_0xbd12('0x3d'))){_0x4a2276[_0xbd12('0x20')]=qs[_0xbd12('0x20')](_0x5764f6['query'][_0xbd12('0x20')]);_0x4a2276[_0xbd12('0x1e')]=qs[_0xbd12('0x1e')](_0x5764f6[_0xbd12('0x35')][_0xbd12('0x1e')]);}_0x4a2276['order']=qs[_0xbd12('0x3e')](_0x5764f6[_0xbd12('0x35')]['sort']);_0x4a2276['where']=qs[_0xbd12('0x37')](_[_0xbd12('0x3f')](_0x5764f6[_0xbd12('0x35')],_0x261b0e[_0xbd12('0x37')]),_0xfcaeb);if(_0x5764f6[_0xbd12('0x35')][_0xbd12('0x40')]){_0x4a2276[_0xbd12('0x41')]=_[_0xbd12('0x42')](_0x4a2276[_0xbd12('0x41')],{'$or':_[_0xbd12('0x30')](_0xfcaeb,function(_0x1a24b4){if(_0x1a24b4[_0xbd12('0x32')]!==_0xbd12('0x43')){var _0x588bdd={};_0x588bdd[_0x1a24b4[_0xbd12('0x2d')]]={'$like':'%'+_0x5764f6[_0xbd12('0x35')]['filter']+'%'};return _0x588bdd;}})});}_0x4a2276=_[_0xbd12('0x42')]({},_0x4a2276,_0x5764f6[_0xbd12('0x44')]);var _0x5397ae={'where':_0x4a2276[_0xbd12('0x41')]};return db[_0xbd12('0x31')][_0xbd12('0x21')](_0x5397ae)[_0xbd12('0x27')](function(_0x4c7398){_0x57b44c['count']=_0x4c7398;if(_0x5764f6[_0xbd12('0x35')][_0xbd12('0x45')]){_0x4a2276['include']=[{'all':!![]}];}return db[_0xbd12('0x31')]['findAll'](_0x4a2276);})[_0xbd12('0x27')](function(_0x4410cc){_0x57b44c['rows']=_0x4410cc;return _0x57b44c;})[_0xbd12('0x27')](respondWithFilteredResult(_0x3ad45c,_0x4a2276))[_0xbd12('0x46')](handleError(_0x3ad45c,null));};exports[_0xbd12('0x47')]=function(_0x3ef1a1,_0x371f97){var _0x296136={'raw':!![],'where':{'id':_0x3ef1a1[_0xbd12('0x48')]['id']}},_0x385a0d={};_0x385a0d[_0xbd12('0x34')]=_[_0xbd12('0x36')](db[_0xbd12('0x31')][_0xbd12('0x49')]);_0x385a0d[_0xbd12('0x35')]=_[_0xbd12('0x36')](_0x3ef1a1[_0xbd12('0x35')]);_0x385a0d[_0xbd12('0x37')]=_[_0xbd12('0x39')](_0x385a0d[_0xbd12('0x34')],_0x385a0d['query']);_0x296136[_0xbd12('0x38')]=_[_0xbd12('0x39')](_0x385a0d[_0xbd12('0x34')],qs[_0xbd12('0x3a')](_0x3ef1a1[_0xbd12('0x35')][_0xbd12('0x3a')]));_0x296136[_0xbd12('0x38')]=_0x296136['attributes'][_0xbd12('0x3b')]?_0x296136['attributes']:_0x385a0d[_0xbd12('0x34')];if(_0x3ef1a1['query'][_0xbd12('0x45')]){_0x296136[_0xbd12('0x4a')]=[{'all':!![]}];}_0x296136=_[_0xbd12('0x42')]({},_0x296136,_0x3ef1a1['options']);return db[_0xbd12('0x31')][_0xbd12('0x4b')](_0x296136)[_0xbd12('0x27')](handleEntityNotFound(_0x371f97,null))[_0xbd12('0x27')](respondWithResult(_0x371f97,null))[_0xbd12('0x46')](handleError(_0x371f97,null));};exports[_0xbd12('0x4c')]=function(_0x4b8038,_0x159f77){return db[_0xbd12('0x31')]['create'](_0x4b8038[_0xbd12('0x4d')],{})[_0xbd12('0x27')](respondWithResult(_0x159f77,0xc9))['catch'](handleError(_0x159f77,null));};exports[_0xbd12('0x26')]=function(_0x22bc4d,_0x5def7d){if(_0x22bc4d[_0xbd12('0x4d')]['id']){delete _0x22bc4d[_0xbd12('0x4d')]['id'];}return db[_0xbd12('0x31')][_0xbd12('0x4b')]({'where':{'id':_0x22bc4d[_0xbd12('0x48')]['id']}})['then'](handleEntityNotFound(_0x5def7d,null))[_0xbd12('0x27')](saveUpdates(_0x22bc4d['body'],null))[_0xbd12('0x27')](respondWithResult(_0x5def7d,null))[_0xbd12('0x46')](handleError(_0x5def7d,null));};exports['destroy']=function(_0x20bbfc,_0x513dc2){return db[_0xbd12('0x31')][_0xbd12('0x4b')]({'where':{'id':_0x20bbfc[_0xbd12('0x48')]['id']}})[_0xbd12('0x27')](handleEntityNotFound(_0x513dc2,null))[_0xbd12('0x27')](removeEntity(_0x513dc2,null))[_0xbd12('0x46')](handleError(_0x513dc2,null));}; \ No newline at end of file +var _0x8375=['show','params','length','find','create','body','catch','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','save','destroy','end','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8375,0x123));var _0x5837=function(_0x5c9f8b,_0xd023bd){_0x5c9f8b=_0x5c9f8b-0x0;var _0x5b2ee8=_0x8375[_0x5c9f8b];return _0x5b2ee8;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5837('0x1'));var rp=require('request-promise');var moment=require(_0x5837('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5837('0x3'));var util=require(_0x5837('0x4'));var path=require(_0x5837('0x5'));var sox=require(_0x5837('0x6'));var csv=require(_0x5837('0x7'));var ejs=require(_0x5837('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5837('0x9'));var squel=require(_0x5837('0xa'));var crypto=require(_0x5837('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5837('0xc'));var toCsv=require(_0x5837('0x7'));var querystring=require(_0x5837('0xd'));var Papa=require(_0x5837('0xe'));var Redis=require('ioredis');var authService=require(_0x5837('0xf'));var qs=require(_0x5837('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5837('0x11'));var logger=require(_0x5837('0x12'))(_0x5837('0x13'));var utils=require(_0x5837('0x14'));var config=require(_0x5837('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53e07e,_0x28ba09){_0x28ba09=_0x28ba09||0xcc;return function(_0x4b4eaa){if(_0x4b4eaa){return _0x53e07e[_0x5837('0x16')](_0x28ba09);}return _0x53e07e[_0x5837('0x17')](_0x28ba09)['end']();};}function respondWithResult(_0x3f77a3,_0x446a65){_0x446a65=_0x446a65||0xc8;return function(_0x3bdba5){if(_0x3bdba5){return _0x3f77a3[_0x5837('0x17')](_0x446a65)['json'](_0x3bdba5);}};}function respondWithFilteredResult(_0xacb101,_0x2ab125){return function(_0x213306){if(_0x213306){var _0x5e4a42=typeof _0x2ab125[_0x5837('0x18')]===_0x5837('0x19')&&typeof _0x2ab125[_0x5837('0x1a')]===_0x5837('0x19');var _0x13b359=_0x213306[_0x5837('0x1b')];var _0x104ed6=_0x5e4a42?0x0:_0x2ab125[_0x5837('0x18')];var _0x35fdb4=_0x5e4a42?_0x213306[_0x5837('0x1b')]:_0x2ab125['offset']+_0x2ab125[_0x5837('0x1a')];var _0x4d45a0;if(_0x35fdb4>=_0x13b359){_0x35fdb4=_0x13b359;_0x4d45a0=0xc8;}else{_0x4d45a0=0xce;}_0xacb101[_0x5837('0x17')](_0x4d45a0);return _0xacb101['set'](_0x5837('0x1c'),_0x104ed6+'-'+_0x35fdb4+'/'+_0x13b359)['json'](_0x213306);}return null;};}function patchUpdates(_0x5dea79){return function(_0x4affa6){try{jsonpatch[_0x5837('0x1d')](_0x4affa6,_0x5dea79,!![]);}catch(_0x3805a6){return BPromise['reject'](_0x3805a6);}return _0x4affa6[_0x5837('0x1e')]();};}function saveUpdates(_0x35a810,_0x439f58){return function(_0x11f2a1){if(_0x11f2a1){return _0x11f2a1['update'](_0x35a810)['then'](function(_0x5c5f1c){return _0x5c5f1c;});}return null;};}function removeEntity(_0x4564e4,_0x2b3294){return function(_0x4b0fb3){if(_0x4b0fb3){return _0x4b0fb3[_0x5837('0x1f')]()['then'](function(){_0x4564e4[_0x5837('0x17')](0xcc)[_0x5837('0x20')]();});}};}function handleEntityNotFound(_0x2faed4,_0x5eee33){return function(_0x43089d){if(!_0x43089d){_0x2faed4['sendStatus'](0x194);}return _0x43089d;};}function handleError(_0x2820fd,_0x15d750){_0x15d750=_0x15d750||0x1f4;return function(_0x1a3aa5){logger[_0x5837('0x21')](_0x1a3aa5[_0x5837('0x22')]);if(_0x1a3aa5[_0x5837('0x23')]){delete _0x1a3aa5['name'];}_0x2820fd[_0x5837('0x17')](_0x15d750)[_0x5837('0x24')](_0x1a3aa5);};}exports['index']=function(_0x28559f,_0x5a5627){var _0x14a9a2={},_0x378f7c={},_0x1b2798={'count':0x0,'rows':[]};var _0x4fd20d=_[_0x5837('0x25')](db[_0x5837('0x26')][_0x5837('0x27')],function(_0x4aa9e4){return{'name':_0x4aa9e4[_0x5837('0x28')],'type':_0x4aa9e4[_0x5837('0x29')][_0x5837('0x2a')]};});_0x378f7c[_0x5837('0x2b')]=_[_0x5837('0x25')](_0x4fd20d,_0x5837('0x23'));_0x378f7c['query']=_[_0x5837('0x2c')](_0x28559f[_0x5837('0x2d')]);_0x378f7c['filters']=_[_0x5837('0x2e')](_0x378f7c[_0x5837('0x2b')],_0x378f7c['query']);_0x14a9a2['attributes']=_[_0x5837('0x2e')](_0x378f7c['model'],qs[_0x5837('0x2f')](_0x28559f['query'][_0x5837('0x2f')]));_0x14a9a2[_0x5837('0x30')]=_0x14a9a2[_0x5837('0x30')]['length']?_0x14a9a2['attributes']:_0x378f7c[_0x5837('0x2b')];if(!_0x28559f[_0x5837('0x2d')][_0x5837('0x31')](_0x5837('0x32'))){_0x14a9a2[_0x5837('0x1a')]=qs[_0x5837('0x1a')](_0x28559f[_0x5837('0x2d')][_0x5837('0x1a')]);_0x14a9a2[_0x5837('0x18')]=qs['offset'](_0x28559f['query'][_0x5837('0x18')]);}_0x14a9a2[_0x5837('0x33')]=qs['sort'](_0x28559f[_0x5837('0x2d')][_0x5837('0x34')]);_0x14a9a2['where']=qs[_0x5837('0x35')](_[_0x5837('0x36')](_0x28559f[_0x5837('0x2d')],_0x378f7c['filters']),_0x4fd20d);if(_0x28559f[_0x5837('0x2d')][_0x5837('0x37')]){_0x14a9a2[_0x5837('0x38')]=_[_0x5837('0x39')](_0x14a9a2[_0x5837('0x38')],{'$or':_[_0x5837('0x25')](_0x4fd20d,function(_0xa26b91){if(_0xa26b91[_0x5837('0x29')]!==_0x5837('0x3a')){var _0x11b7fb={};_0x11b7fb[_0xa26b91[_0x5837('0x23')]]={'$like':'%'+_0x28559f[_0x5837('0x2d')][_0x5837('0x37')]+'%'};return _0x11b7fb;}})});}_0x14a9a2=_[_0x5837('0x39')]({},_0x14a9a2,_0x28559f[_0x5837('0x3b')]);var _0x998a12={'where':_0x14a9a2[_0x5837('0x38')]};return db['SalesforceField'][_0x5837('0x1b')](_0x998a12)[_0x5837('0x3c')](function(_0x221109){_0x1b2798['count']=_0x221109;if(_0x28559f[_0x5837('0x2d')]['includeAll']){_0x14a9a2[_0x5837('0x3d')]=[{'all':!![]}];}return db['SalesforceField'][_0x5837('0x3e')](_0x14a9a2);})[_0x5837('0x3c')](function(_0x41eaab){_0x1b2798[_0x5837('0x3f')]=_0x41eaab;return _0x1b2798;})[_0x5837('0x3c')](respondWithFilteredResult(_0x5a5627,_0x14a9a2))['catch'](handleError(_0x5a5627,null));};exports[_0x5837('0x40')]=function(_0x31d797,_0x5f2613){var _0x2aeef4={'raw':!![],'where':{'id':_0x31d797[_0x5837('0x41')]['id']}},_0x33cd13={};_0x33cd13[_0x5837('0x2b')]=_[_0x5837('0x2c')](db[_0x5837('0x26')][_0x5837('0x27')]);_0x33cd13['query']=_[_0x5837('0x2c')](_0x31d797[_0x5837('0x2d')]);_0x33cd13[_0x5837('0x35')]=_[_0x5837('0x2e')](_0x33cd13['model'],_0x33cd13[_0x5837('0x2d')]);_0x2aeef4[_0x5837('0x30')]=_[_0x5837('0x2e')](_0x33cd13[_0x5837('0x2b')],qs[_0x5837('0x2f')](_0x31d797[_0x5837('0x2d')][_0x5837('0x2f')]));_0x2aeef4['attributes']=_0x2aeef4['attributes'][_0x5837('0x42')]?_0x2aeef4['attributes']:_0x33cd13['model'];if(_0x31d797['query']['includeAll']){_0x2aeef4[_0x5837('0x3d')]=[{'all':!![]}];}_0x2aeef4=_[_0x5837('0x39')]({},_0x2aeef4,_0x31d797[_0x5837('0x3b')]);return db[_0x5837('0x26')][_0x5837('0x43')](_0x2aeef4)[_0x5837('0x3c')](handleEntityNotFound(_0x5f2613,null))[_0x5837('0x3c')](respondWithResult(_0x5f2613,null))['catch'](handleError(_0x5f2613,null));};exports[_0x5837('0x44')]=function(_0x173ecb,_0x41502d){return db[_0x5837('0x26')]['create'](_0x173ecb[_0x5837('0x45')],{})['then'](respondWithResult(_0x41502d,0xc9))['catch'](handleError(_0x41502d,null));};exports['update']=function(_0x3a462c,_0xe1c36f){if(_0x3a462c[_0x5837('0x45')]['id']){delete _0x3a462c[_0x5837('0x45')]['id'];}return db['SalesforceField'][_0x5837('0x43')]({'where':{'id':_0x3a462c[_0x5837('0x41')]['id']}})[_0x5837('0x3c')](handleEntityNotFound(_0xe1c36f,null))[_0x5837('0x3c')](saveUpdates(_0x3a462c[_0x5837('0x45')],null))[_0x5837('0x3c')](respondWithResult(_0xe1c36f,null))[_0x5837('0x46')](handleError(_0xe1c36f,null));};exports[_0x5837('0x1f')]=function(_0x5ec34d,_0x314936){return db[_0x5837('0x26')][_0x5837('0x43')]({'where':{'id':_0x5ec34d[_0x5837('0x41')]['id']}})['then'](handleEntityNotFound(_0x314936,null))['then'](removeEntity(_0x314936,null))[_0x5837('0x46')](handleError(_0x314936,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2ed5701..8d8eaf9 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 _0x0466=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','util','moment','rimraf'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0x0466,0x10b));var _0x6046=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0466[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x6046('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6046('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6046('0x2'));var config=require('../../config/environment');var attributes=require(_0x6046('0x3'));module[_0x6046('0x4')]=function(_0x97216d,_0x2c4f49){return _0x97216d[_0x6046('0x5')](_0x6046('0x6'),attributes,{'tableName':_0x6046('0x7'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x6046('0x8'),_0x6046('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd819=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xd819,0xb0));var _0x9d81=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0xd819[_0x17dab8];return _0x336fb5;};'use strict';var _=require(_0x9d81('0x0'));var util=require(_0x9d81('0x1'));var logger=require(_0x9d81('0x2'))(_0x9d81('0x3'));var moment=require('moment');var BPromise=require(_0x9d81('0x4'));var rp=require(_0x9d81('0x5'));var fs=require('fs');var path=require(_0x9d81('0x6'));var rimraf=require(_0x9d81('0x7'));var config=require(_0x9d81('0x8'));var attributes=require(_0x9d81('0x9'));module[_0x9d81('0xa')]=function(_0x32d24a,_0x3ed73c){return _0x32d24a[_0x9d81('0xb')]('SalesforceField',attributes,{'tableName':_0x9d81('0xc'),'paranoid':![],'indexes':[{'name':_0x9d81('0xd'),'fields':[_0x9d81('0xe'),_0x9d81('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index be23cdb..9980892 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 _0x9762=['../../config/environment','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x420740,_0x485ce1){var _0x33f1aa=function(_0x2749e1){while(--_0x2749e1){_0x420740['push'](_0x420740['shift']());}};_0x33f1aa(++_0x485ce1);}(_0x9762,0x1d4));var _0x2976=function(_0x172b39,_0x303689){_0x172b39=_0x172b39-0x0;var _0x1ea343=_0x9762[_0x172b39];return _0x1ea343;};'use strict';var _=require(_0x2976('0x0'));var util=require(_0x2976('0x1'));var moment=require('moment');var BPromise=require(_0x2976('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2976('0x3'));var db=require(_0x2976('0x4'))['db'];var utils=require(_0x2976('0x5'));var logger=require('../../config/logger')(_0x2976('0x6'));var config=require(_0x2976('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2976('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e3756,_0x41c7f8,_0x17f7e0){return new BPromise(function(_0x5ed7a2,_0x1d4957){return client['request'](_0x3e3756,_0x17f7e0)[_0x2976('0x9')](function(_0x4fad2f){logger[_0x2976('0xa')](_0x2976('0xb'),_0x41c7f8,_0x2976('0xc'));logger[_0x2976('0xd')](_0x2976('0xe'),_0x41c7f8,_0x2976('0xc'),JSON['stringify'](_0x4fad2f));if(_0x4fad2f['error']){if(_0x4fad2f[_0x2976('0xf')][_0x2976('0x10')]===0x1f4){logger[_0x2976('0xf')](_0x2976('0xb'),_0x41c7f8,_0x4fad2f[_0x2976('0xf')][_0x2976('0x11')]);return _0x1d4957(_0x4fad2f['error'][_0x2976('0x11')]);}logger[_0x2976('0xf')](_0x2976('0xb'),_0x41c7f8,_0x4fad2f['error'][_0x2976('0x11')]);return _0x5ed7a2(_0x4fad2f[_0x2976('0xf')][_0x2976('0x11')]);}else{logger[_0x2976('0xa')](_0x2976('0xb'),_0x41c7f8,_0x2976('0xc'));_0x5ed7a2(_0x4fad2f['result'][_0x2976('0x11')]);}})[_0x2976('0x12')](function(_0x43d4bb){logger[_0x2976('0xf')](_0x2976('0xb'),_0x41c7f8,_0x43d4bb);_0x1d4957(_0x43d4bb);});});} \ No newline at end of file +var _0x7606=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x7606,0xe9));var _0x6760=function(_0x3ce1fd,_0x5add51){_0x3ce1fd=_0x3ce1fd-0x0;var _0x35c34b=_0x7606[_0x3ce1fd];return _0x35c34b;};'use strict';var _=require(_0x6760('0x0'));var util=require(_0x6760('0x1'));var moment=require(_0x6760('0x2'));var BPromise=require(_0x6760('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6760('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6760('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6760('0x6'));var client=jayson[_0x6760('0x7')][_0x6760('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x249a77,_0x33c921,_0x35a26d){return new BPromise(function(_0x1ed760,_0x402380){return client[_0x6760('0x9')](_0x249a77,_0x35a26d)[_0x6760('0xa')](function(_0x2bfa96){logger[_0x6760('0xb')](_0x6760('0xc'),_0x33c921,'request\x20sent');logger[_0x6760('0xd')](_0x6760('0xe'),_0x33c921,_0x6760('0xf'),JSON['stringify'](_0x2bfa96));if(_0x2bfa96['error']){if(_0x2bfa96[_0x6760('0x10')][_0x6760('0x11')]===0x1f4){logger[_0x6760('0x10')](_0x6760('0xc'),_0x33c921,_0x2bfa96[_0x6760('0x10')][_0x6760('0x12')]);return _0x402380(_0x2bfa96[_0x6760('0x10')][_0x6760('0x12')]);}logger[_0x6760('0x10')](_0x6760('0xc'),_0x33c921,_0x2bfa96[_0x6760('0x10')]['message']);return _0x1ed760(_0x2bfa96[_0x6760('0x10')][_0x6760('0x12')]);}else{logger['info'](_0x6760('0xc'),_0x33c921,_0x6760('0xf'));_0x1ed760(_0x2bfa96[_0x6760('0x13')][_0x6760('0x12')]);}})[_0x6760('0x14')](function(_0x2d8b5f){logger['error'](_0x6760('0xc'),_0x33c921,_0x2d8b5f);_0x402380(_0x2d8b5f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 698a58f..343f578 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 _0xd7c4=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','post','addConfiguration','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0xd7c4,0x1ae));var _0x4d7c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7c4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4d7c('0x0'));var util=require(_0x4d7c('0x1'));var path=require(_0x4d7c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d7c('0x3'));var router=express[_0x4d7c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d7c('0x5'));var interaction=require(_0x4d7c('0x6'));var config=require(_0x4d7c('0x7'));var controller=require(_0x4d7c('0x8'));router[_0x4d7c('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d7c('0xa')]);router[_0x4d7c('0x9')](_0x4d7c('0xb'),auth[_0x4d7c('0xc')](),controller[_0x4d7c('0xd')]);router['get'](_0x4d7c('0xe'),auth[_0x4d7c('0xc')](),controller[_0x4d7c('0xf')]);router[_0x4d7c('0x9')]('/:id/fields',auth[_0x4d7c('0xc')](),controller['getFields']);router[_0x4d7c('0x10')]('/',auth[_0x4d7c('0xc')](),controller['create']);router['post'](_0x4d7c('0xe'),auth[_0x4d7c('0xc')](),controller[_0x4d7c('0x11')]);router[_0x4d7c('0x12')](_0x4d7c('0xb'),auth[_0x4d7c('0xc')](),controller[_0x4d7c('0x13')]);router['delete'](_0x4d7c('0xb'),auth[_0x4d7c('0xc')](),controller[_0x4d7c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbefe=['./intServicenowAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a23e5,_0x235f58){var _0x4f4e67=function(_0x43c602){while(--_0x43c602){_0x5a23e5['push'](_0x5a23e5['shift']());}};_0x4f4e67(++_0x235f58);}(_0xbefe,0x168));var _0xebef=function(_0x171b2f,_0x337677){_0x171b2f=_0x171b2f-0x0;var _0x4678d8=_0xbefe[_0x171b2f];return _0x4678d8;};'use strict';var multer=require('multer');var util=require(_0xebef('0x0'));var path=require('path');var timeout=require(_0xebef('0x1'));var express=require(_0xebef('0x2'));var router=express[_0xebef('0x3')]();var fs_extra=require(_0xebef('0x4'));var auth=require(_0xebef('0x5'));var interaction=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var controller=require(_0xebef('0x8'));router['get']('/',auth[_0xebef('0x9')](),controller[_0xebef('0xa')]);router[_0xebef('0xb')]('/:id',auth[_0xebef('0x9')](),controller[_0xebef('0xc')]);router['get']('/:id/configurations',auth[_0xebef('0x9')](),controller[_0xebef('0xd')]);router[_0xebef('0xb')](_0xebef('0xe'),auth[_0xebef('0x9')](),controller[_0xebef('0xf')]);router[_0xebef('0x10')]('/',auth[_0xebef('0x9')](),controller['create']);router[_0xebef('0x10')](_0xebef('0x11'),auth[_0xebef('0x9')](),controller[_0xebef('0x12')]);router[_0xebef('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xebef('0x14'),auth[_0xebef('0x9')](),controller[_0xebef('0x15')]);module[_0xebef('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index dad76db..c3504bb 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 _0x768b=['exports','STRING','username','sequelize'];(function(_0x480b12,_0x40d227){var _0x1a04f5=function(_0x53b717){while(--_0x53b717){_0x480b12['push'](_0x480b12['shift']());}};_0x1a04f5(++_0x40d227);}(_0x768b,0x1c7));var _0xb768=function(_0x55d2d8,_0x166e37){_0x55d2d8=_0x55d2d8-0x0;var _0x2874e5=_0x768b[_0x55d2d8];return _0x2874e5;};'use strict';var Sequelize=require(_0xb768('0x0'));module[_0xb768('0x1')]={'name':{'type':Sequelize[_0xb768('0x2')]},'description':{'type':Sequelize[_0xb768('0x2')]},'username':{'type':Sequelize[_0xb768('0x2')],'unique':_0xb768('0x3')},'password':{'type':Sequelize[_0xb768('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb768('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xb768('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x19c1=['STRING','username','sequelize'];(function(_0x338dfb,_0x3be96c){var _0x3bb601=function(_0x5226ab){while(--_0x5226ab){_0x338dfb['push'](_0x338dfb['shift']());}};_0x3bb601(++_0x3be96c);}(_0x19c1,0x11f));var _0x119c=function(_0x1fc179,_0x53d593){_0x1fc179=_0x1fc179-0x0;var _0x35d1ba=_0x19c1[_0x1fc179];return _0x35d1ba;};'use strict';var Sequelize=require(_0x119c('0x0'));module['exports']={'name':{'type':Sequelize[_0x119c('0x1')]},'description':{'type':Sequelize[_0x119c('0x1')]},'username':{'type':Sequelize[_0x119c('0x1')],'unique':_0x119c('0x2')},'password':{'type':Sequelize[_0x119c('0x1')]},'email':{'type':Sequelize[_0x119c('0x1')]},'remoteUri':{'type':Sequelize[_0x119c('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1201aa2..f2fae03 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 _0x0dbb=['send','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','parent','caused_by','watch_list','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','business_duration','group_list','work_end','reopened_time','caller_id','work_notes','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','due_date','escalation','correlation_id','category','findOne','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','forEach','internalType','label','push','log','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','ServiceNow\x20error:\x20','test','statusCode','boolean','True','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name'];(function(_0x569f5f,_0x1c6c5c){var _0x3e8e2e=function(_0x46344f){while(--_0x46344f){_0x569f5f['push'](_0x569f5f['shift']());}};_0x3e8e2e(++_0x1c6c5c);}(_0x0dbb,0x8b));var _0xb0db=function(_0xeb6241,_0xb9eaa1){_0xeb6241=_0xeb6241-0x0;var _0x86b961=_0x0dbb[_0xeb6241];return _0x86b961;};'use strict';var emlformat=require(_0xb0db('0x0'));var rimraf=require(_0xb0db('0x1'));var zipdir=require(_0xb0db('0x2'));var jsonpatch=require(_0xb0db('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb0db('0x4'));var Mustache=require(_0xb0db('0x5'));var util=require(_0xb0db('0x6'));var path=require(_0xb0db('0x7'));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(_0xb0db('0x8'));var squel=require(_0xb0db('0x9'));var crypto=require(_0xb0db('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb0db('0xb'));var toCsv=require(_0xb0db('0xc'));var querystring=require(_0xb0db('0xd'));var Papa=require(_0xb0db('0xe'));var Redis=require(_0xb0db('0xf'));var authService=require(_0xb0db('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb0db('0x11'));var hardwareService=require(_0xb0db('0x12'));var logger=require(_0xb0db('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb0db('0x14'));var licenseUtil=require(_0xb0db('0x15'));var db=require(_0xb0db('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x325de4,_0x332285){_0x332285=_0x332285||0xcc;return function(_0x10fd8f){if(_0x10fd8f){return _0x325de4[_0xb0db('0x17')](_0x332285);}return _0x325de4[_0xb0db('0x18')](_0x332285)[_0xb0db('0x19')]();};}function respondWithResult(_0x25fb15,_0x59dce8){_0x59dce8=_0x59dce8||0xc8;return function(_0x38496c){if(_0x38496c){return _0x25fb15[_0xb0db('0x18')](_0x59dce8)[_0xb0db('0x1a')](_0x38496c);}};}function respondWithFilteredResult(_0x5810ce,_0x76360d){return function(_0x386944){if(_0x386944){var _0x3502e9=typeof _0x76360d[_0xb0db('0x1b')]===_0xb0db('0x1c')&&typeof _0x76360d['limit']==='undefined';var _0x5a7c24=_0x386944[_0xb0db('0x1d')];var _0x2db30d=_0x3502e9?0x0:_0x76360d['offset'];var _0x2fb6e0=_0x3502e9?_0x386944['count']:_0x76360d['offset']+_0x76360d[_0xb0db('0x1e')];var _0x289cc5;if(_0x2fb6e0>=_0x5a7c24){_0x2fb6e0=_0x5a7c24;_0x289cc5=0xc8;}else{_0x289cc5=0xce;}_0x5810ce[_0xb0db('0x18')](_0x289cc5);return _0x5810ce[_0xb0db('0x1f')](_0xb0db('0x20'),_0x2db30d+'-'+_0x2fb6e0+'/'+_0x5a7c24)['json'](_0x386944);}return null;};}function patchUpdates(_0x24f426){return function(_0x531dfa){try{jsonpatch[_0xb0db('0x21')](_0x531dfa,_0x24f426,!![]);}catch(_0x5cce19){return BPromise[_0xb0db('0x22')](_0x5cce19);}return _0x531dfa['save']();};}function saveUpdates(_0x11f3e2,_0x155bcd){return function(_0x22cf55){if(_0x22cf55){return _0x22cf55[_0xb0db('0x23')](_0x11f3e2)[_0xb0db('0x24')](function(_0x3062a3){return _0x3062a3;});}return null;};}function removeEntity(_0x1d568e,_0x193dd8){return function(_0x505e2b){if(_0x505e2b){return _0x505e2b[_0xb0db('0x25')]()[_0xb0db('0x24')](function(){_0x1d568e[_0xb0db('0x18')](0xcc)[_0xb0db('0x19')]();});}};}function handleEntityNotFound(_0x13ac58,_0x26d147){return function(_0x54fd6e){if(!_0x54fd6e){_0x13ac58[_0xb0db('0x17')](0x194);}return _0x54fd6e;};}function handleError(_0x7246c7,_0xa832ef){_0xa832ef=_0xa832ef||0x1f4;return function(_0x4a1384){logger[_0xb0db('0x26')](_0x4a1384[_0xb0db('0x27')]);if(_0x4a1384[_0xb0db('0x28')]){delete _0x4a1384['name'];}_0x7246c7[_0xb0db('0x18')](_0xa832ef)[_0xb0db('0x29')](_0x4a1384);};}exports[_0xb0db('0x2a')]=function(_0xce9a52,_0x3de3b0){var _0x2180e1={},_0x11226b={},_0x3b8e80={'count':0x0,'rows':[]};var _0x59fd94=_['map'](db[_0xb0db('0x2b')][_0xb0db('0x2c')],function(_0x1f6296){return{'name':_0x1f6296[_0xb0db('0x2d')],'type':_0x1f6296[_0xb0db('0x2e')][_0xb0db('0x2f')]};});_0x11226b['model']=_[_0xb0db('0x30')](_0x59fd94,_0xb0db('0x28'));_0x11226b[_0xb0db('0x31')]=_[_0xb0db('0x32')](_0xce9a52[_0xb0db('0x31')]);_0x11226b[_0xb0db('0x33')]=_[_0xb0db('0x34')](_0x11226b[_0xb0db('0x35')],_0x11226b[_0xb0db('0x31')]);_0x2180e1[_0xb0db('0x36')]=_[_0xb0db('0x34')](_0x11226b[_0xb0db('0x35')],qs['fields'](_0xce9a52['query'][_0xb0db('0x37')]));_0x2180e1['attributes']=_0x2180e1[_0xb0db('0x36')][_0xb0db('0x38')]?_0x2180e1[_0xb0db('0x36')]:_0x11226b[_0xb0db('0x35')];if(!_0xce9a52['query']['hasOwnProperty']('nolimit')){_0x2180e1['limit']=qs['limit'](_0xce9a52[_0xb0db('0x31')]['limit']);_0x2180e1[_0xb0db('0x1b')]=qs['offset'](_0xce9a52['query']['offset']);}_0x2180e1[_0xb0db('0x39')]=qs[_0xb0db('0x3a')](_0xce9a52[_0xb0db('0x31')][_0xb0db('0x3a')]);_0x2180e1['where']=qs[_0xb0db('0x33')](_[_0xb0db('0x3b')](_0xce9a52['query'],_0x11226b['filters']),_0x59fd94);if(_0xce9a52[_0xb0db('0x31')][_0xb0db('0x3c')]){_0x2180e1[_0xb0db('0x3d')]=_[_0xb0db('0x3e')](_0x2180e1['where'],{'$or':_[_0xb0db('0x30')](_0x59fd94,function(_0x4b9829){if(_0x4b9829[_0xb0db('0x2e')]!==_0xb0db('0x3f')){var _0xe4b8c6={};_0xe4b8c6[_0x4b9829[_0xb0db('0x28')]]={'$like':'%'+_0xce9a52[_0xb0db('0x31')]['filter']+'%'};return _0xe4b8c6;}})});}_0x2180e1=_[_0xb0db('0x3e')]({},_0x2180e1,_0xce9a52[_0xb0db('0x40')]);var _0x1d09c8={'where':_0x2180e1[_0xb0db('0x3d')]};return db[_0xb0db('0x2b')][_0xb0db('0x1d')](_0x1d09c8)[_0xb0db('0x24')](function(_0x269cda){_0x3b8e80['count']=_0x269cda;if(_0xce9a52[_0xb0db('0x31')][_0xb0db('0x41')]){_0x2180e1[_0xb0db('0x42')]=[{'all':!![]}];}return db[_0xb0db('0x2b')][_0xb0db('0x43')](_0x2180e1);})[_0xb0db('0x24')](function(_0xae9b81){_0x3b8e80[_0xb0db('0x44')]=_0xae9b81;return _0x3b8e80;})['then'](respondWithFilteredResult(_0x3de3b0,_0x2180e1))['catch'](handleError(_0x3de3b0,null));};exports[_0xb0db('0x45')]=function(_0x8586a4,_0x43a31a){var _0x682c5b={'raw':![],'where':{'id':_0x8586a4[_0xb0db('0x46')]['id']}},_0x4d7a9b={};_0x4d7a9b['model']=_[_0xb0db('0x32')](db[_0xb0db('0x2b')][_0xb0db('0x2c')]);_0x4d7a9b[_0xb0db('0x31')]=_[_0xb0db('0x32')](_0x8586a4[_0xb0db('0x31')]);_0x4d7a9b[_0xb0db('0x33')]=_[_0xb0db('0x34')](_0x4d7a9b[_0xb0db('0x35')],_0x4d7a9b['query']);_0x682c5b['attributes']=_['intersection'](_0x4d7a9b[_0xb0db('0x35')],qs[_0xb0db('0x37')](_0x8586a4['query'][_0xb0db('0x37')]));_0x682c5b[_0xb0db('0x36')]=_0x682c5b[_0xb0db('0x36')]['length']?_0x682c5b[_0xb0db('0x36')]:_0x4d7a9b[_0xb0db('0x35')];if(_0x8586a4['query']['includeAll']){_0x682c5b[_0xb0db('0x42')]=[{'all':!![]}];}_0x682c5b=_[_0xb0db('0x3e')]({},_0x682c5b,_0x8586a4[_0xb0db('0x40')]);return db[_0xb0db('0x2b')][_0xb0db('0x47')](_0x682c5b)[_0xb0db('0x24')](handleEntityNotFound(_0x43a31a,null))[_0xb0db('0x24')](respondWithResult(_0x43a31a,null))[_0xb0db('0x48')](handleError(_0x43a31a,null));};exports[_0xb0db('0x49')]=function(_0x388321,_0x18d986){return db[_0xb0db('0x2b')][_0xb0db('0x49')](_0x388321[_0xb0db('0x4a')],{})[_0xb0db('0x24')](respondWithResult(_0x18d986,0xc9))[_0xb0db('0x48')](handleError(_0x18d986,null));};exports[_0xb0db('0x23')]=function(_0x1b279a,_0x2f1e4d){if(_0x1b279a[_0xb0db('0x4a')]['id']){delete _0x1b279a[_0xb0db('0x4a')]['id'];}return db[_0xb0db('0x2b')][_0xb0db('0x47')]({'where':{'id':_0x1b279a['params']['id']}})[_0xb0db('0x24')](handleEntityNotFound(_0x2f1e4d,null))[_0xb0db('0x24')](saveUpdates(_0x1b279a[_0xb0db('0x4a')],null))[_0xb0db('0x24')](respondWithResult(_0x2f1e4d,null))[_0xb0db('0x48')](handleError(_0x2f1e4d,null));};exports[_0xb0db('0x25')]=function(_0x208c78,_0x49ff91){return db['ServicenowAccount'][_0xb0db('0x47')]({'where':{'id':_0x208c78['params']['id']}})['then'](handleEntityNotFound(_0x49ff91,null))['then'](removeEntity(_0x49ff91,null))[_0xb0db('0x48')](handleError(_0x49ff91,null));};exports[_0xb0db('0x4b')]=function(_0x28ae0c,_0x2f4bfe,_0x5a10ec){var _0x514396={};var _0x1d9629={};var _0x4831f1;var _0x5499ab;return db['ServicenowAccount']['findOne']({'where':{'id':_0x28ae0c[_0xb0db('0x46')]['id']}})[_0xb0db('0x24')](handleEntityNotFound(_0x2f4bfe,null))[_0xb0db('0x24')](function(_0xd2474){if(_0xd2474){_0x4831f1=_0xd2474;_0x1d9629[_0xb0db('0x35')]=_['keys'](db[_0xb0db('0x4c')][_0xb0db('0x2c')]);_0x1d9629[_0xb0db('0x31')]=_[_0xb0db('0x32')](_0x28ae0c[_0xb0db('0x31')]);_0x1d9629['filters']=_[_0xb0db('0x34')](_0x1d9629[_0xb0db('0x35')],_0x1d9629[_0xb0db('0x31')]);_0x514396[_0xb0db('0x36')]=_[_0xb0db('0x34')](_0x1d9629[_0xb0db('0x35')],qs['fields'](_0x28ae0c[_0xb0db('0x31')]['fields']));_0x514396[_0xb0db('0x36')]=_0x514396[_0xb0db('0x36')][_0xb0db('0x38')]?_0x514396[_0xb0db('0x36')]:_0x1d9629[_0xb0db('0x35')];_0x514396[_0xb0db('0x39')]=qs[_0xb0db('0x3a')](_0x28ae0c['query'][_0xb0db('0x3a')]);_0x514396[_0xb0db('0x3d')]=qs[_0xb0db('0x33')](_[_0xb0db('0x3b')](_0x28ae0c[_0xb0db('0x31')],_0x1d9629[_0xb0db('0x33')]));if(_0x28ae0c[_0xb0db('0x31')][_0xb0db('0x3c')]){_0x514396[_0xb0db('0x3d')]=_[_0xb0db('0x3e')](_0x514396[_0xb0db('0x3d')],{'$or':_[_0xb0db('0x30')](_0x514396['attributes'],function(_0x378d0e){var _0x50239b={};_0x50239b[_0x378d0e]={'$like':'%'+_0x28ae0c['query']['filter']+'%'};return _0x50239b;})});}_0x514396=_['merge']({},_0x514396,_0x28ae0c[_0xb0db('0x40')]);return _0x4831f1['getConfigurations'](_0x514396);}})[_0xb0db('0x24')](function(_0x38d9f8){if(_0x38d9f8){_0x5499ab=_0x38d9f8[_0xb0db('0x38')];if(!_0x28ae0c['query'][_0xb0db('0x4d')](_0xb0db('0x4e'))){_0x514396['limit']=qs[_0xb0db('0x1e')](_0x28ae0c[_0xb0db('0x31')]['limit']);_0x514396['offset']=qs[_0xb0db('0x1b')](_0x28ae0c[_0xb0db('0x31')][_0xb0db('0x1b')]);}return _0x4831f1['getConfigurations'](_0x514396);}})[_0xb0db('0x24')](function(_0x541a0d){if(_0x541a0d){return _0x541a0d?{'count':_0x5499ab,'rows':_0x541a0d}:null;}})['then'](respondWithResult(_0x2f4bfe,null))[_0xb0db('0x48')](handleError(_0x2f4bfe,null));};exports[_0xb0db('0x4f')]=function(_0x3a4241,_0x7020b8,_0x4a6762){if(_0x3a4241[_0xb0db('0x4a')]['id']){delete _0x3a4241['body']['id'];}return db[_0xb0db('0x2b')]['findOne']({'where':{'id':_0x3a4241[_0xb0db('0x46')]['id']}})[_0xb0db('0x24')](handleEntityNotFound(_0x7020b8,null))[_0xb0db('0x24')](function(_0x36dcba){if(_0x36dcba){_0x3a4241[_0xb0db('0x4a')]['AccountId']=_0x36dcba['id'];_0x3a4241['body'][_0xb0db('0x50')]=integrations['getSubjects'](_0x3a4241[_0xb0db('0x4a')][_0xb0db('0x51')],_0x3a4241[_0xb0db('0x4a')]['type']);_0x3a4241[_0xb0db('0x4a')][_0xb0db('0x52')]=integrations[_0xb0db('0x53')](_0x3a4241[_0xb0db('0x4a')]['channel'],_0x3a4241[_0xb0db('0x4a')][_0xb0db('0x2e')]);return db[_0xb0db('0x4c')][_0xb0db('0x49')](_0x3a4241[_0xb0db('0x4a')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xb0db('0x54')],'as':_0xb0db('0x52')}]});}return null;})[_0xb0db('0x24')](respondWithResult(_0x7020b8,null))[_0xb0db('0x48')](handleError(_0x7020b8,null));};exports[_0xb0db('0x55')]=function(_0x2ed35c,_0x4032f9,_0x5c5d77){var _0xc2a054=[_0xb0db('0x56'),_0xb0db('0x57'),_0xb0db('0x58'),'subcategory',_0xb0db('0x59'),'notify',_0xb0db('0x5a'),_0xb0db('0x5b'),'category'];var _0x2942ba=[_0xb0db('0x5c'),'made_sla',_0xb0db('0x5d'),_0xb0db('0x5e'),'upon_reject','sys_updated_on',_0xb0db('0x5f'),'hold_reason',_0xb0db('0x60'),_0xb0db('0x61'),'resolved_by',_0xb0db('0x62'),_0xb0db('0x63'),_0xb0db('0x64'),_0xb0db('0x65'),'sys_domain',_0xb0db('0x66'),_0xb0db('0x67'),_0xb0db('0x58'),_0xb0db('0x39'),_0xb0db('0x68'),_0xb0db('0x69'),'cmdb_ci',_0xb0db('0x6a'),_0xb0db('0x6b'),_0xb0db('0x6c'),_0xb0db('0x6d'),_0xb0db('0x6e'),_0xb0db('0x6f'),_0xb0db('0x70'),_0xb0db('0x71'),_0xb0db('0x72'),'expected_start','opened_at',_0xb0db('0x73'),_0xb0db('0x74'),_0xb0db('0x75'),_0xb0db('0x76'),'resolved_at',_0xb0db('0x77'),'approval_set','subcategory',_0xb0db('0x78'),'short_description','close_code',_0xb0db('0x79'),'delivery_task',_0xb0db('0x7a'),'assignment_group',_0xb0db('0x7b'),_0xb0db('0x7c'),_0xb0db('0x7d'),_0xb0db('0x7e'),_0xb0db('0x7f'),_0xb0db('0x80'),_0xb0db('0x81'),_0xb0db('0x82'),_0xb0db('0x83'),'parent_incident','sys_id',_0xb0db('0x84'),_0xb0db('0x85'),_0xb0db('0x5a'),_0xb0db('0x86'),_0xb0db('0x87'),'company',_0xb0db('0x88'),_0xb0db('0x89'),_0xb0db('0x8a'),_0xb0db('0x5b'),_0xb0db('0x8b'),_0xb0db('0x8c'),_0xb0db('0x8d'),'comments_and_work_notes',_0xb0db('0x8e'),'sys_mod_count','reopen_count','sys_tags',_0xb0db('0x8f'),'upon_approval',_0xb0db('0x90'),'location',_0xb0db('0x91')];var _0x3187fb='';var _0x1b236c='';var _0x2f82be=[];var _0x4a6d7c='';var _0x5d506d='';var _0x20c09a=[];var _0x43f771='';var _0x25ffb7='';var _0x2cc590={};var _0x21d324='';return db[_0xb0db('0x2b')][_0xb0db('0x92')]({'where':{'id':_0x2ed35c[_0xb0db('0x46')]['id']},'attributes':['id',_0xb0db('0x93'),_0xb0db('0x94'),_0xb0db('0x95'),_0xb0db('0x96'),'serverUrl']})[_0xb0db('0x24')](handleEntityNotFound(_0x4032f9,null))['then'](function(_0x59e6ba){if(_0x59e6ba){_0x21d324=_0x59e6ba[_0xb0db('0x96')];var _0x23d605=_0x21d324[_0xb0db('0x97')](-0x1);if(_0x23d605==='/'){_0x21d324=_0x21d324[_0xb0db('0x98')](0x0,_0x21d324[_0xb0db('0x99')](_0x23d605));}_0x25ffb7=util[_0xb0db('0x9a')](_0xb0db('0x9b'),_0x21d324);_0x43f771=util['format'](_0xb0db('0x9c'),_0x21d324);_0x2cc590={'user':_0x59e6ba['username'],'pass':_0x59e6ba['password']};var _0x4f00a6={'method':_0xb0db('0x9d'),'uri':_0x25ffb7+_0xb0db('0x9e'),'auth':_0x2cc590,'json':!![]};return rp(_0x4f00a6);}})[_0xb0db('0x24')](function(_0x1eb141){if(_0x1eb141[_0xb0db('0x9f')]['length']>0x0){_0x3187fb=_0x1eb141[_0xb0db('0x9f')];}console['log']('incident\x20table\x20objects',_0x3187fb);_0x20c09a=[];_0x1b236c=Object[_0xb0db('0xa0')]([],_0x3187fb);_['remove'](_0x1b236c,function(_0x1d0f8e){return!_0xc2a054['includes'](_0x1d0f8e[_0xb0db('0x28')]);});_0x1b236c[_0xb0db('0xa1')](function(_0x186a21){var _0x4997de=createFieldObject(_0x43f771,_0x2cc590,_0x186a21[_0xb0db('0xa2')],_0x186a21[_0xb0db('0x28')],_0x186a21[_0xb0db('0xa3')],![]);_0x20c09a[_0xb0db('0xa4')](_0x4997de);});return Promise['all'](_0x20c09a);})[_0xb0db('0x24')](function(_0x3b3d44){_0x2f82be=_0x3b3d44;_0x4a6d7c=Object[_0xb0db('0xa0')]([],_0x3187fb);console[_0xb0db('0xa5')](_0xb0db('0xa6'),_0x3187fb);_[_0xb0db('0xa7')](_0x4a6d7c,function(_0x161f08){return _0x2942ba[_0xb0db('0xa8')](_0x161f08[_0xb0db('0x28')]);});console['log'](_0xb0db('0xa9'),_0x4a6d7c);_0x20c09a=[];_0x4a6d7c[_0xb0db('0xa1')](function(_0x314d63){var _0x5d9a53=createFieldObject(_0x43f771,_0x2cc590,_0x314d63[_0xb0db('0xa2')],_0x314d63[_0xb0db('0x28')],_0x314d63['label'],!![]);_0x20c09a[_0xb0db('0xa4')](_0x5d9a53);});return Promise[_0xb0db('0xaa')](_0x20c09a);})['then'](function(_0x31158d){_0x5d506d=_0x31158d;var _0x57d9be=_0x2f82be['concat'](_0x5d506d);return{'count':_0x57d9be[_0xb0db('0x38')],'rows':_0x57d9be};})[_0xb0db('0x24')](respondWithResult(_0x4032f9,null))[_0xb0db('0x48')](function(_0x2261df){console[_0xb0db('0xa5')](_0xb0db('0xab')+_0x2261df);var _0x41b913=_0x2ed35c[_0xb0db('0x31')][_0xb0db('0xac')]?0x1f4:_0x2261df[_0xb0db('0xad')]||0x1f4;logger['error'](_0x2261df['stack']);delete _0x2261df[_0xb0db('0x28')];if(_0x41b913===0x191){_0x41b913=0x190;}_0x4032f9[_0xb0db('0x18')](_0x41b913)[_0xb0db('0x29')](_0x2ed35c[_0xb0db('0x31')][_0xb0db('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x2261df['statusCode']}:_0x2261df);});};function createFieldObject(_0x7c2b96,_0x3315a6,_0x191843,_0x568093,_0x5683e4,_0x26e200){return new Promise(function(_0x1683b7,_0x1e7fad){var _0x2d8101={'id':_0x568093,'name':_0x5683e4,'custom':_0x26e200};if(_0x191843===_0xb0db('0xae')){_0x2d8101[_0xb0db('0x40')]=[{'name':_0xb0db('0xaf'),'value':'true'},{'name':_0xb0db('0xb0'),'value':_0xb0db('0xb1')}];_0x1683b7(_0x2d8101);}else{var _0x29b821={'method':_0xb0db('0x9d'),'uri':_0x7c2b96+'sys_choice?sysparm_query=name=incident^element='+_0x568093,'auth':_0x3315a6,'json':!![]};return rp(_0x29b821)[_0xb0db('0x24')](function(_0x7f7da2){var _0xcb06e4=[];if(_0x7f7da2['result'][_0xb0db('0x38')]>0x0){_0x7f7da2[_0xb0db('0x9f')][_0xb0db('0xa1')](function(_0x16574d){if(_0x16574d[_0xb0db('0xb2')]===_0xb0db('0xb1')){var _0x16f939={'name':_0x16574d[_0xb0db('0xa3')],'value':_0x16574d[_0xb0db('0xb3')]};_0xcb06e4[_0xb0db('0xa4')](_0x16f939);}});}_0x2d8101[_0xb0db('0x40')]=_0xcb06e4;if(_0x2d8101[_0xb0db('0x40')][_0xb0db('0x38')]>0x0){_0x1683b7(_0x2d8101);}else{if(_0x26e200==![]){_0x1683b7();}else{_0x1683b7(_0x2d8101);}}});}});} \ No newline at end of file +var _0x6cf8=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','error','name','send','map','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','rows','show','params','rawAttributes','length','options','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','nolimit','AccountId','channel','getDescriptions','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','impact','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','approval','sys_mod_count','reopen_count','escalation','upon_approval','location','username','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x1dc4b0,_0xbf6bd7){var _0x26ee42=function(_0x358da5){while(--_0x358da5){_0x1dc4b0['push'](_0x1dc4b0['shift']());}};_0x26ee42(++_0xbf6bd7);}(_0x6cf8,0x152));var _0x86cf=function(_0x5e095f,_0x58fe92){_0x5e095f=_0x5e095f-0x0;var _0x3814b0=_0x6cf8[_0x5e095f];return _0x3814b0;};'use strict';var emlformat=require(_0x86cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x86cf('0x1'));var jsonpatch=require(_0x86cf('0x2'));var rp=require('request-promise');var moment=require(_0x86cf('0x3'));var BPromise=require(_0x86cf('0x4'));var Mustache=require(_0x86cf('0x5'));var util=require(_0x86cf('0x6'));var path=require('path');var sox=require(_0x86cf('0x7'));var csv=require(_0x86cf('0x8'));var ejs=require(_0x86cf('0x9'));var fs=require('fs');var fs_extra=require(_0x86cf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x86cf('0xb'));var jsforce=require(_0x86cf('0xc'));var deskjs=require(_0x86cf('0xd'));var toCsv=require(_0x86cf('0x8'));var querystring=require(_0x86cf('0xe'));var Papa=require(_0x86cf('0xf'));var Redis=require(_0x86cf('0x10'));var authService=require(_0x86cf('0x11'));var qs=require(_0x86cf('0x12'));var as=require(_0x86cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x86cf('0x14'));var utils=require(_0x86cf('0x15'));var config=require(_0x86cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x86cf('0x17'))['db'];var integrations=require(_0x86cf('0x18'));function respondWithStatusCode(_0x42d0dc,_0x5abc27){_0x5abc27=_0x5abc27||0xcc;return function(_0x3c22dc){if(_0x3c22dc){return _0x42d0dc['sendStatus'](_0x5abc27);}return _0x42d0dc['status'](_0x5abc27)[_0x86cf('0x19')]();};}function respondWithResult(_0x35c6b4,_0x2978ce){_0x2978ce=_0x2978ce||0xc8;return function(_0x1d7867){if(_0x1d7867){return _0x35c6b4[_0x86cf('0x1a')](_0x2978ce)[_0x86cf('0x1b')](_0x1d7867);}};}function respondWithFilteredResult(_0x986c53,_0x49960a){return function(_0x5f3ee1){if(_0x5f3ee1){var _0xa35bd2=typeof _0x49960a['offset']===_0x86cf('0x1c')&&typeof _0x49960a[_0x86cf('0x1d')]==='undefined';var _0x234226=_0x5f3ee1[_0x86cf('0x1e')];var _0x39258a=_0xa35bd2?0x0:_0x49960a[_0x86cf('0x1f')];var _0x3b1139=_0xa35bd2?_0x5f3ee1[_0x86cf('0x1e')]:_0x49960a[_0x86cf('0x1f')]+_0x49960a['limit'];var _0x54505a;if(_0x3b1139>=_0x234226){_0x3b1139=_0x234226;_0x54505a=0xc8;}else{_0x54505a=0xce;}_0x986c53[_0x86cf('0x1a')](_0x54505a);return _0x986c53[_0x86cf('0x20')](_0x86cf('0x21'),_0x39258a+'-'+_0x3b1139+'/'+_0x234226)[_0x86cf('0x1b')](_0x5f3ee1);}return null;};}function patchUpdates(_0x5db944){return function(_0x1d0bbd){try{jsonpatch['apply'](_0x1d0bbd,_0x5db944,!![]);}catch(_0x5aa37d){return BPromise['reject'](_0x5aa37d);}return _0x1d0bbd[_0x86cf('0x22')]();};}function saveUpdates(_0x2865fa,_0x1328f3){return function(_0x55075b){if(_0x55075b){return _0x55075b[_0x86cf('0x23')](_0x2865fa)[_0x86cf('0x24')](function(_0x56438e){return _0x56438e;});}return null;};}function removeEntity(_0x139279,_0x16bda7){return function(_0x28a5f2){if(_0x28a5f2){return _0x28a5f2[_0x86cf('0x25')]()['then'](function(){_0x139279[_0x86cf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x928acc,_0x39d7d5){return function(_0x291057){if(!_0x291057){_0x928acc[_0x86cf('0x26')](0x194);}return _0x291057;};}function handleError(_0x2200af,_0x58ed25){_0x58ed25=_0x58ed25||0x1f4;return function(_0x3a2e94){logger[_0x86cf('0x27')](_0x3a2e94['stack']);if(_0x3a2e94['name']){delete _0x3a2e94[_0x86cf('0x28')];}_0x2200af[_0x86cf('0x1a')](_0x58ed25)[_0x86cf('0x29')](_0x3a2e94);};}exports['index']=function(_0x980332,_0x4e97b4){var _0x354fff={},_0x429007={},_0x31f4aa={'count':0x0,'rows':[]};var _0x491be2=_[_0x86cf('0x2a')](db[_0x86cf('0x2b')]['rawAttributes'],function(_0x52da47){return{'name':_0x52da47[_0x86cf('0x2c')],'type':_0x52da47[_0x86cf('0x2d')]['key']};});_0x429007[_0x86cf('0x2e')]=_[_0x86cf('0x2a')](_0x491be2,_0x86cf('0x28'));_0x429007[_0x86cf('0x2f')]=_[_0x86cf('0x30')](_0x980332[_0x86cf('0x2f')]);_0x429007[_0x86cf('0x31')]=_[_0x86cf('0x32')](_0x429007[_0x86cf('0x2e')],_0x429007[_0x86cf('0x2f')]);_0x354fff['attributes']=_['intersection'](_0x429007[_0x86cf('0x2e')],qs[_0x86cf('0x33')](_0x980332[_0x86cf('0x2f')][_0x86cf('0x33')]));_0x354fff[_0x86cf('0x34')]=_0x354fff[_0x86cf('0x34')]['length']?_0x354fff['attributes']:_0x429007['model'];if(!_0x980332['query'][_0x86cf('0x35')]('nolimit')){_0x354fff['limit']=qs[_0x86cf('0x1d')](_0x980332['query'][_0x86cf('0x1d')]);_0x354fff[_0x86cf('0x1f')]=qs[_0x86cf('0x1f')](_0x980332[_0x86cf('0x2f')][_0x86cf('0x1f')]);}_0x354fff[_0x86cf('0x36')]=qs[_0x86cf('0x37')](_0x980332['query']['sort']);_0x354fff['where']=qs['filters'](_[_0x86cf('0x38')](_0x980332['query'],_0x429007[_0x86cf('0x31')]),_0x491be2);if(_0x980332['query'][_0x86cf('0x39')]){_0x354fff['where']=_['merge'](_0x354fff[_0x86cf('0x3a')],{'$or':_[_0x86cf('0x2a')](_0x491be2,function(_0x2ecf6b){if(_0x2ecf6b[_0x86cf('0x2d')]!=='VIRTUAL'){var _0x1267ec={};_0x1267ec[_0x2ecf6b[_0x86cf('0x28')]]={'$like':'%'+_0x980332[_0x86cf('0x2f')][_0x86cf('0x39')]+'%'};return _0x1267ec;}})});}_0x354fff=_[_0x86cf('0x3b')]({},_0x354fff,_0x980332['options']);var _0x20d8f={'where':_0x354fff[_0x86cf('0x3a')]};return db[_0x86cf('0x2b')][_0x86cf('0x1e')](_0x20d8f)[_0x86cf('0x24')](function(_0x799428){_0x31f4aa[_0x86cf('0x1e')]=_0x799428;if(_0x980332['query'][_0x86cf('0x3c')]){_0x354fff[_0x86cf('0x3d')]=[{'all':!![]}];}return db[_0x86cf('0x2b')]['findAll'](_0x354fff);})[_0x86cf('0x24')](function(_0x1ca08b){_0x31f4aa[_0x86cf('0x3e')]=_0x1ca08b;return _0x31f4aa;})[_0x86cf('0x24')](respondWithFilteredResult(_0x4e97b4,_0x354fff))['catch'](handleError(_0x4e97b4,null));};exports[_0x86cf('0x3f')]=function(_0x15a4f1,_0x22f2ca){var _0xb28376={'raw':![],'where':{'id':_0x15a4f1[_0x86cf('0x40')]['id']}},_0x2e0f36={};_0x2e0f36[_0x86cf('0x2e')]=_[_0x86cf('0x30')](db['ServicenowAccount'][_0x86cf('0x41')]);_0x2e0f36[_0x86cf('0x2f')]=_['keys'](_0x15a4f1[_0x86cf('0x2f')]);_0x2e0f36[_0x86cf('0x31')]=_[_0x86cf('0x32')](_0x2e0f36['model'],_0x2e0f36[_0x86cf('0x2f')]);_0xb28376[_0x86cf('0x34')]=_[_0x86cf('0x32')](_0x2e0f36['model'],qs[_0x86cf('0x33')](_0x15a4f1[_0x86cf('0x2f')][_0x86cf('0x33')]));_0xb28376[_0x86cf('0x34')]=_0xb28376[_0x86cf('0x34')][_0x86cf('0x42')]?_0xb28376[_0x86cf('0x34')]:_0x2e0f36[_0x86cf('0x2e')];if(_0x15a4f1['query'][_0x86cf('0x3c')]){_0xb28376[_0x86cf('0x3d')]=[{'all':!![]}];}_0xb28376=_[_0x86cf('0x3b')]({},_0xb28376,_0x15a4f1[_0x86cf('0x43')]);return db[_0x86cf('0x2b')][_0x86cf('0x44')](_0xb28376)[_0x86cf('0x24')](handleEntityNotFound(_0x22f2ca,null))[_0x86cf('0x24')](respondWithResult(_0x22f2ca,null))[_0x86cf('0x45')](handleError(_0x22f2ca,null));};exports['create']=function(_0x2f846a,_0x56591c){return db[_0x86cf('0x2b')][_0x86cf('0x46')](_0x2f846a[_0x86cf('0x47')],{})['then'](respondWithResult(_0x56591c,0xc9))['catch'](handleError(_0x56591c,null));};exports['update']=function(_0x3c531d,_0xf653fd){if(_0x3c531d[_0x86cf('0x47')]['id']){delete _0x3c531d[_0x86cf('0x47')]['id'];}return db[_0x86cf('0x2b')][_0x86cf('0x44')]({'where':{'id':_0x3c531d[_0x86cf('0x40')]['id']}})['then'](handleEntityNotFound(_0xf653fd,null))[_0x86cf('0x24')](saveUpdates(_0x3c531d[_0x86cf('0x47')],null))[_0x86cf('0x24')](respondWithResult(_0xf653fd,null))[_0x86cf('0x45')](handleError(_0xf653fd,null));};exports['destroy']=function(_0x3d52c2,_0x3ec94c){return db[_0x86cf('0x2b')][_0x86cf('0x44')]({'where':{'id':_0x3d52c2[_0x86cf('0x40')]['id']}})[_0x86cf('0x24')](handleEntityNotFound(_0x3ec94c,null))[_0x86cf('0x24')](removeEntity(_0x3ec94c,null))['catch'](handleError(_0x3ec94c,null));};exports[_0x86cf('0x48')]=function(_0x37bccd,_0x244c78,_0x3f47b6){var _0x4e1386={};var _0x22e693={};var _0x561cdf;var _0x39dbff;return db['ServicenowAccount'][_0x86cf('0x49')]({'where':{'id':_0x37bccd[_0x86cf('0x40')]['id']}})[_0x86cf('0x24')](handleEntityNotFound(_0x244c78,null))[_0x86cf('0x24')](function(_0x14637e){if(_0x14637e){_0x561cdf=_0x14637e;_0x22e693[_0x86cf('0x2e')]=_[_0x86cf('0x30')](db[_0x86cf('0x4a')][_0x86cf('0x41')]);_0x22e693['query']=_['keys'](_0x37bccd[_0x86cf('0x2f')]);_0x22e693['filters']=_['intersection'](_0x22e693[_0x86cf('0x2e')],_0x22e693[_0x86cf('0x2f')]);_0x4e1386['attributes']=_[_0x86cf('0x32')](_0x22e693['model'],qs[_0x86cf('0x33')](_0x37bccd['query'][_0x86cf('0x33')]));_0x4e1386[_0x86cf('0x34')]=_0x4e1386[_0x86cf('0x34')]['length']?_0x4e1386['attributes']:_0x22e693[_0x86cf('0x2e')];_0x4e1386[_0x86cf('0x36')]=qs[_0x86cf('0x37')](_0x37bccd[_0x86cf('0x2f')][_0x86cf('0x37')]);_0x4e1386[_0x86cf('0x3a')]=qs[_0x86cf('0x31')](_['pick'](_0x37bccd['query'],_0x22e693[_0x86cf('0x31')]));if(_0x37bccd[_0x86cf('0x2f')][_0x86cf('0x39')]){_0x4e1386[_0x86cf('0x3a')]=_['merge'](_0x4e1386[_0x86cf('0x3a')],{'$or':_['map'](_0x4e1386[_0x86cf('0x34')],function(_0x4df28b){var _0x449e1a={};_0x449e1a[_0x4df28b]={'$like':'%'+_0x37bccd[_0x86cf('0x2f')][_0x86cf('0x39')]+'%'};return _0x449e1a;})});}_0x4e1386=_[_0x86cf('0x3b')]({},_0x4e1386,_0x37bccd[_0x86cf('0x43')]);return _0x561cdf[_0x86cf('0x48')](_0x4e1386);}})[_0x86cf('0x24')](function(_0x187d8e){if(_0x187d8e){_0x39dbff=_0x187d8e[_0x86cf('0x42')];if(!_0x37bccd[_0x86cf('0x2f')][_0x86cf('0x35')](_0x86cf('0x4b'))){_0x4e1386[_0x86cf('0x1d')]=qs[_0x86cf('0x1d')](_0x37bccd['query'][_0x86cf('0x1d')]);_0x4e1386[_0x86cf('0x1f')]=qs[_0x86cf('0x1f')](_0x37bccd['query']['offset']);}return _0x561cdf[_0x86cf('0x48')](_0x4e1386);}})[_0x86cf('0x24')](function(_0x539d88){if(_0x539d88){return _0x539d88?{'count':_0x39dbff,'rows':_0x539d88}:null;}})[_0x86cf('0x24')](respondWithResult(_0x244c78,null))[_0x86cf('0x45')](handleError(_0x244c78,null));};exports['addConfiguration']=function(_0x3c3cf1,_0x4ae7e0,_0x85fb1){if(_0x3c3cf1[_0x86cf('0x47')]['id']){delete _0x3c3cf1[_0x86cf('0x47')]['id'];}return db[_0x86cf('0x2b')]['findOne']({'where':{'id':_0x3c3cf1[_0x86cf('0x40')]['id']}})[_0x86cf('0x24')](handleEntityNotFound(_0x4ae7e0,null))[_0x86cf('0x24')](function(_0x3f2a74){if(_0x3f2a74){_0x3c3cf1[_0x86cf('0x47')][_0x86cf('0x4c')]=_0x3f2a74['id'];_0x3c3cf1[_0x86cf('0x47')]['Subjects']=integrations['getSubjects'](_0x3c3cf1[_0x86cf('0x47')][_0x86cf('0x4d')],_0x3c3cf1[_0x86cf('0x47')][_0x86cf('0x2d')]);_0x3c3cf1[_0x86cf('0x47')]['Descriptions']=integrations[_0x86cf('0x4e')](_0x3c3cf1['body'][_0x86cf('0x4d')],_0x3c3cf1[_0x86cf('0x47')][_0x86cf('0x2d')]);return db[_0x86cf('0x4a')][_0x86cf('0x46')](_0x3c3cf1[_0x86cf('0x47')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x86cf('0x4f')}]});}return null;})['then'](respondWithResult(_0x4ae7e0,null))['catch'](handleError(_0x4ae7e0,null));};exports[_0x86cf('0x50')]=function(_0x224ae9,_0xa07f5e,_0x1b803d){var _0x23b0ca=[_0x86cf('0x51'),'hold_reason',_0x86cf('0x52'),_0x86cf('0x53'),_0x86cf('0x54'),_0x86cf('0x55'),_0x86cf('0x56'),_0x86cf('0x57'),_0x86cf('0x58')];var _0x3c45e4=[_0x86cf('0x59'),_0x86cf('0x51'),_0x86cf('0x5a'),_0x86cf('0x5b'),_0x86cf('0x5c'),_0x86cf('0x5d'),_0x86cf('0x5e'),_0x86cf('0x5f'),'approval_history','number',_0x86cf('0x60'),_0x86cf('0x61'),_0x86cf('0x62'),_0x86cf('0x63'),_0x86cf('0x64'),_0x86cf('0x65'),'state','sys_created_by',_0x86cf('0x52'),'order',_0x86cf('0x66'),_0x86cf('0x67'),'cmdb_ci','delivery_plan',_0x86cf('0x68'),'active',_0x86cf('0x69'),'business_service',_0x86cf('0x6a'),_0x86cf('0x6b'),_0x86cf('0x6c'),'time_worked',_0x86cf('0x6d'),_0x86cf('0x6e'),_0x86cf('0x6f'),_0x86cf('0x70'),_0x86cf('0x71'),_0x86cf('0x72'),'resolved_at',_0x86cf('0x73'),'approval_set',_0x86cf('0x53'),'work_notes',_0x86cf('0x74'),'close_code','correlation_display',_0x86cf('0x75'),'work_start',_0x86cf('0x76'),_0x86cf('0x77'),_0x86cf('0x78'),_0x86cf('0x79'),_0x86cf('0x7a'),'notify',_0x86cf('0x7b'),_0x86cf('0x7c'),_0x86cf('0x7d'),_0x86cf('0x7e'),_0x86cf('0x7f'),_0x86cf('0x80'),'contact_type',_0x86cf('0x81'),_0x86cf('0x56'),_0x86cf('0x82'),_0x86cf('0x83'),_0x86cf('0x84'),'reassignment_count',_0x86cf('0x85'),_0x86cf('0x86'),_0x86cf('0x57'),_0x86cf('0x87'),'sla_due',_0x86cf('0x88'),'comments_and_work_notes','due_date',_0x86cf('0x89'),_0x86cf('0x8a'),'sys_tags',_0x86cf('0x8b'),_0x86cf('0x8c'),'correlation_id',_0x86cf('0x8d'),_0x86cf('0x58')];var _0x5a8376='';var _0x5bd090='';var _0x285b48=[];var _0x19603d='';var _0x24b6fc='';var _0x595deb=[];var _0x3ff600='';var _0x8f4cb4='';var _0x29ce90={};var _0x2c1fde='';return db['ServicenowAccount'][_0x86cf('0x49')]({'where':{'id':_0x224ae9['params']['id']},'attributes':['id',_0x86cf('0x8e'),'password','email','remoteUri',_0x86cf('0x8f')]})[_0x86cf('0x24')](handleEntityNotFound(_0xa07f5e,null))['then'](function(_0x4c5ef0){if(_0x4c5ef0){_0x2c1fde=_0x4c5ef0[_0x86cf('0x90')];var _0x28ba02=_0x2c1fde[_0x86cf('0x91')](-0x1);if(_0x28ba02==='/'){_0x2c1fde=_0x2c1fde['substring'](0x0,_0x2c1fde[_0x86cf('0x92')](_0x28ba02));}_0x8f4cb4=util[_0x86cf('0x93')](_0x86cf('0x94'),_0x2c1fde);_0x3ff600=util['format']('%s/api/now/table/',_0x2c1fde);_0x29ce90={'user':_0x4c5ef0[_0x86cf('0x8e')],'pass':_0x4c5ef0[_0x86cf('0x95')]};var _0x180593={'method':_0x86cf('0x96'),'uri':_0x8f4cb4+_0x86cf('0x97'),'auth':_0x29ce90,'json':!![]};return rp(_0x180593);}})[_0x86cf('0x24')](function(_0x237b2e){if(_0x237b2e['result'][_0x86cf('0x42')]>0x0){_0x5a8376=_0x237b2e[_0x86cf('0x98')];}console[_0x86cf('0x99')](_0x86cf('0x9a'),_0x5a8376);_0x595deb=[];_0x5bd090=Object['assign']([],_0x5a8376);_[_0x86cf('0x9b')](_0x5bd090,function(_0xd3aa6d){return!_0x23b0ca[_0x86cf('0x9c')](_0xd3aa6d['name']);});_0x5bd090[_0x86cf('0x9d')](function(_0x102ad7){var _0x5c8e48=createFieldObject(_0x3ff600,_0x29ce90,_0x102ad7[_0x86cf('0x9e')],_0x102ad7[_0x86cf('0x28')],_0x102ad7[_0x86cf('0x9f')],![]);_0x595deb['push'](_0x5c8e48);});return Promise[_0x86cf('0xa0')](_0x595deb);})[_0x86cf('0x24')](function(_0x3e3b1d){_0x285b48=_0x3e3b1d;_0x19603d=Object[_0x86cf('0xa1')]([],_0x5a8376);console[_0x86cf('0x99')](_0x86cf('0xa2'),_0x5a8376);_[_0x86cf('0x9b')](_0x19603d,function(_0x237320){return _0x3c45e4[_0x86cf('0x9c')](_0x237320[_0x86cf('0x28')]);});console[_0x86cf('0x99')](_0x86cf('0xa3'),_0x19603d);_0x595deb=[];_0x19603d[_0x86cf('0x9d')](function(_0x20e8b5){var _0x128bc3=createFieldObject(_0x3ff600,_0x29ce90,_0x20e8b5[_0x86cf('0x9e')],_0x20e8b5['name'],_0x20e8b5[_0x86cf('0x9f')],!![]);_0x595deb[_0x86cf('0xa4')](_0x128bc3);});return Promise[_0x86cf('0xa0')](_0x595deb);})[_0x86cf('0x24')](function(_0x394132){_0x24b6fc=_0x394132;var _0x3b113b=_0x285b48[_0x86cf('0xa5')](_0x24b6fc);return{'count':_0x3b113b[_0x86cf('0x42')],'rows':_0x3b113b};})[_0x86cf('0x24')](respondWithResult(_0xa07f5e,null))[_0x86cf('0x45')](function(_0x599bb3){console[_0x86cf('0x99')](_0x86cf('0xa6')+_0x599bb3);var _0x58e58b=_0x224ae9['query'][_0x86cf('0xa7')]?0x1f4:_0x599bb3[_0x86cf('0xa8')]||0x1f4;logger[_0x86cf('0x27')](_0x599bb3['stack']);delete _0x599bb3['name'];if(_0x58e58b===0x191){_0x58e58b=0x190;}_0xa07f5e[_0x86cf('0x1a')](_0x58e58b)[_0x86cf('0x29')](_0x224ae9['query'][_0x86cf('0xa7')]?{'message':_0x86cf('0xa9'),'statusCode':_0x599bb3[_0x86cf('0xa8')]}:_0x599bb3);});};function createFieldObject(_0x48583a,_0x3a6540,_0x133048,_0x3bb3e3,_0x320956,_0x2dfb18){return new Promise(function(_0xdeebc,_0x401d88){var _0x212e2c={'id':_0x3bb3e3,'name':_0x320956,'custom':_0x2dfb18};if(_0x133048===_0x86cf('0xaa')){_0x212e2c[_0x86cf('0x43')]=[{'name':_0x86cf('0xab'),'value':'true'},{'name':_0x86cf('0xac'),'value':'false'}];_0xdeebc(_0x212e2c);}else{var _0x1c6492={'method':_0x86cf('0x96'),'uri':_0x48583a+_0x86cf('0xad')+_0x3bb3e3,'auth':_0x3a6540,'json':!![]};return rp(_0x1c6492)['then'](function(_0x399e5a){var _0x32405c=[];if(_0x399e5a[_0x86cf('0x98')][_0x86cf('0x42')]>0x0){_0x399e5a[_0x86cf('0x98')][_0x86cf('0x9d')](function(_0x1f6c24){if(_0x1f6c24[_0x86cf('0xae')]===_0x86cf('0xaf')){var _0x999705={'name':_0x1f6c24[_0x86cf('0x9f')],'value':_0x1f6c24['value']};_0x32405c[_0x86cf('0xa4')](_0x999705);}});}_0x212e2c[_0x86cf('0x43')]=_0x32405c;if(_0x212e2c[_0x86cf('0x43')]['length']>0x0){_0xdeebc(_0x212e2c);}else{if(_0x2dfb18==![]){_0xdeebc();}else{_0xdeebc(_0x212e2c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2479944..c5f8220 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x597b1b,_0x235df7){var _0x3898dc=function(_0x4450a3){while(--_0x4450a3){_0x597b1b['push'](_0x597b1b['shift']());}};_0x3898dc(++_0x235df7);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0xfdbd[_0x390143];return _0x11361b;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x53ec,0x192));var _0xc53e=function(_0x2cb984,_0x365f50){_0x2cb984=_0x2cb984-0x0;var _0x2f73e6=_0x53ec[_0x2cb984];return _0x2f73e6;};'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'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('ServicenowAccount',attributes,{'tableName':_0xc53e('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 bf5dca4..94bf32a 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 _0x5499=['find','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','request\x20sent','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowServicenowAccount'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x5499,0x14b));var _0x9549=function(_0x245efb,_0x2c636b){_0x245efb=_0x245efb-0x0;var _0x59ee7b=_0x5499[_0x245efb];return _0x59ee7b;};'use strict';var _=require(_0x9549('0x0'));var util=require('util');var moment=require(_0x9549('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9549('0x2'));var db=require(_0x9549('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9549('0x4'))(_0x9549('0x5'));var config=require('../../config/environment');var jayson=require(_0x9549('0x6'));var client=jayson[_0x9549('0x7')][_0x9549('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x531992,_0x287e14,_0x51db6f){return new BPromise(function(_0x23369b,_0x38433b){return client['request'](_0x531992,_0x51db6f)[_0x9549('0x9')](function(_0x4454b5){logger[_0x9549('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x287e14,'request\x20sent');logger[_0x9549('0xb')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x287e14,_0x9549('0xc'),JSON['stringify'](_0x4454b5));if(_0x4454b5[_0x9549('0xd')]){if(_0x4454b5['error'][_0x9549('0xe')]===0x1f4){logger[_0x9549('0xd')](_0x9549('0xf'),_0x287e14,_0x4454b5[_0x9549('0xd')][_0x9549('0x10')]);return _0x38433b(_0x4454b5[_0x9549('0xd')][_0x9549('0x10')]);}logger[_0x9549('0xd')](_0x9549('0xf'),_0x287e14,_0x4454b5['error']['message']);return _0x23369b(_0x4454b5[_0x9549('0xd')][_0x9549('0x10')]);}else{logger[_0x9549('0xa')](_0x9549('0xf'),_0x287e14,'request\x20sent');_0x23369b(_0x4454b5[_0x9549('0x11')]['message']);}})[_0x9549('0x12')](function(_0x43188c){logger[_0x9549('0xd')](_0x9549('0xf'),_0x287e14,_0x43188c);_0x38433b(_0x43188c);});});}exports[_0x9549('0x13')]=function(_0x1e2985){var _0x572c73=this;return new Promise(function(_0x12d1a7,_0x38aeb0){return db[_0x9549('0x14')][_0x9549('0x15')]({'raw':_0x1e2985['options']?_0x1e2985[_0x9549('0x16')][_0x9549('0x17')]===undefined?!![]:![]:!![],'where':_0x1e2985[_0x9549('0x16')]?_0x1e2985[_0x9549('0x16')][_0x9549('0x18')]||null:null,'attributes':_0x1e2985[_0x9549('0x16')]?_0x1e2985[_0x9549('0x16')][_0x9549('0x19')]||null:null,'limit':_0x1e2985['options']?_0x1e2985[_0x9549('0x16')][_0x9549('0x1a')]||null:null,'include':_0x1e2985[_0x9549('0x16')]?_0x1e2985[_0x9549('0x16')]['include']?_[_0x9549('0x1b')](_0x1e2985['options'][_0x9549('0x1c')],function(_0x5d280a){return{'model':db[_0x5d280a[_0x9549('0x1d')]],'as':_0x5d280a['as'],'attributes':_0x5d280a[_0x9549('0x19')],'include':_0x5d280a['include']?_[_0x9549('0x1b')](_0x5d280a[_0x9549('0x1c')],function(_0x3fa044){return{'model':db[_0x3fa044[_0x9549('0x1d')]],'as':_0x3fa044['as'],'attributes':_0x3fa044['attributes'],'include':_0x3fa044[_0x9549('0x1c')]?_[_0x9549('0x1b')](_0x3fa044[_0x9549('0x1c')],function(_0x3dc42d){return{'model':db[_0x3dc42d[_0x9549('0x1d')]],'as':_0x3dc42d['as'],'attributes':_0x3dc42d[_0x9549('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9549('0x9')](function(_0x326eb5){logger[_0x9549('0xa')](_0x9549('0x13'),_0x1e2985);logger[_0x9549('0xb')](_0x9549('0x13'),_0x1e2985,JSON[_0x9549('0x1e')](_0x326eb5));_0x12d1a7(_0x326eb5);})['catch'](function(_0x1ffc16){logger['error'](_0x9549('0x13'),_0x1ffc16[_0x9549('0x10')],_0x1e2985);_0x38aeb0(_0x572c73['error'](0x1f4,_0x1ffc16[_0x9549('0x10')]));});});};exports[_0x9549('0x1f')]=function(_0x14dae2){var _0x3f60da=this;return new Promise(function(_0x120047,_0x5d31cd){return db[_0x9549('0x14')][_0x9549('0x20')]({'raw':_0x14dae2[_0x9549('0x16')]?_0x14dae2[_0x9549('0x16')][_0x9549('0x17')]===undefined?!![]:![]:!![],'where':_0x14dae2[_0x9549('0x16')]?_0x14dae2[_0x9549('0x16')][_0x9549('0x18')]||null:null,'attributes':_0x14dae2[_0x9549('0x16')]?_0x14dae2['options']['attributes']||null:null,'include':_0x14dae2[_0x9549('0x16')]?_0x14dae2[_0x9549('0x16')][_0x9549('0x1c')]?_[_0x9549('0x1b')](_0x14dae2['options'][_0x9549('0x1c')],function(_0x2b10a0){return{'model':db[_0x2b10a0['model']],'as':_0x2b10a0['as'],'attributes':_0x2b10a0[_0x9549('0x19')],'include':_0x2b10a0[_0x9549('0x1c')]?_[_0x9549('0x1b')](_0x2b10a0[_0x9549('0x1c')],function(_0x532687){return{'model':db[_0x532687[_0x9549('0x1d')]],'as':_0x532687['as'],'attributes':_0x532687[_0x9549('0x19')],'include':_0x532687[_0x9549('0x1c')]?_['map'](_0x532687[_0x9549('0x1c')],function(_0x6943a){return{'model':db[_0x6943a['model']],'as':_0x6943a['as'],'attributes':_0x6943a[_0x9549('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xea3a49){logger['info'](_0x9549('0x1f'),_0x14dae2);logger[_0x9549('0xb')](_0x9549('0x1f'),_0x14dae2,JSON['stringify'](_0xea3a49));_0x120047(_0xea3a49);})['catch'](function(_0x125d76){logger[_0x9549('0xd')](_0x9549('0x1f'),_0x125d76[_0x9549('0x10')],_0x14dae2);_0x5d31cd(_0x3f60da[_0x9549('0xd')](0x1f4,_0x125d76[_0x9549('0x10')]));});});}; \ No newline at end of file +var _0xadd8=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent'];(function(_0x373fe,_0x552cb1){var _0xcd0aa4=function(_0x51a89a){while(--_0x51a89a){_0x373fe['push'](_0x373fe['shift']());}};_0xcd0aa4(++_0x552cb1);}(_0xadd8,0x180));var _0x8add=function(_0x426f40,_0x50dce7){_0x426f40=_0x426f40-0x0;var _0x20563f=_0xadd8[_0x426f40];return _0x20563f;};'use strict';var _=require('lodash');var util=require(_0x8add('0x0'));var moment=require(_0x8add('0x1'));var BPromise=require('bluebird');var rs=require(_0x8add('0x2'));var fs=require('fs');var Redis=require(_0x8add('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8add('0x4'))(_0x8add('0x5'));var config=require(_0x8add('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8add('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x58c245,_0x1d6537,_0x12dbd2){return new BPromise(function(_0x4e29fc,_0x48261a){return client[_0x8add('0x8')](_0x58c245,_0x12dbd2)[_0x8add('0x9')](function(_0x4a64bd){logger[_0x8add('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x1d6537,_0x8add('0xb'));logger[_0x8add('0xc')](_0x8add('0xd'),_0x1d6537,_0x8add('0xb'),JSON['stringify'](_0x4a64bd));if(_0x4a64bd[_0x8add('0xe')]){if(_0x4a64bd[_0x8add('0xe')][_0x8add('0xf')]===0x1f4){logger[_0x8add('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x1d6537,_0x4a64bd[_0x8add('0xe')][_0x8add('0x10')]);return _0x48261a(_0x4a64bd['error'][_0x8add('0x10')]);}logger[_0x8add('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x1d6537,_0x4a64bd['error'][_0x8add('0x10')]);return _0x4e29fc(_0x4a64bd[_0x8add('0xe')]['message']);}else{logger['info'](_0x8add('0x11'),_0x1d6537,_0x8add('0xb'));_0x4e29fc(_0x4a64bd[_0x8add('0x12')][_0x8add('0x10')]);}})['catch'](function(_0x35ffcf){logger[_0x8add('0xe')](_0x8add('0x11'),_0x1d6537,_0x35ffcf);_0x48261a(_0x35ffcf);});});}exports['GetServicenowAccount']=function(_0x440740){var _0x255de5=this;return new Promise(function(_0x550493,_0x4412bf){return db[_0x8add('0x13')]['findAll']({'raw':_0x440740[_0x8add('0x14')]?_0x440740['options'][_0x8add('0x15')]===undefined?!![]:![]:!![],'where':_0x440740[_0x8add('0x14')]?_0x440740[_0x8add('0x14')][_0x8add('0x16')]||null:null,'attributes':_0x440740[_0x8add('0x14')]?_0x440740[_0x8add('0x14')][_0x8add('0x17')]||null:null,'limit':_0x440740[_0x8add('0x14')]?_0x440740[_0x8add('0x14')][_0x8add('0x18')]||null:null,'include':_0x440740[_0x8add('0x14')]?_0x440740[_0x8add('0x14')][_0x8add('0x19')]?_[_0x8add('0x1a')](_0x440740[_0x8add('0x14')][_0x8add('0x19')],function(_0x2cd5e3){return{'model':db[_0x2cd5e3[_0x8add('0x1b')]],'as':_0x2cd5e3['as'],'attributes':_0x2cd5e3[_0x8add('0x17')],'include':_0x2cd5e3[_0x8add('0x19')]?_[_0x8add('0x1a')](_0x2cd5e3[_0x8add('0x19')],function(_0xe1c6bc){return{'model':db[_0xe1c6bc['model']],'as':_0xe1c6bc['as'],'attributes':_0xe1c6bc[_0x8add('0x17')],'include':_0xe1c6bc[_0x8add('0x19')]?_[_0x8add('0x1a')](_0xe1c6bc[_0x8add('0x19')],function(_0x27f4a5){return{'model':db[_0x27f4a5[_0x8add('0x1b')]],'as':_0x27f4a5['as'],'attributes':_0x27f4a5[_0x8add('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8add('0x9')](function(_0xee37a2){logger[_0x8add('0xa')](_0x8add('0x1c'),_0x440740);logger[_0x8add('0xc')](_0x8add('0x1c'),_0x440740,JSON[_0x8add('0x1d')](_0xee37a2));_0x550493(_0xee37a2);})['catch'](function(_0x429c37){logger[_0x8add('0xe')]('GetServicenowAccount',_0x429c37[_0x8add('0x10')],_0x440740);_0x4412bf(_0x255de5['error'](0x1f4,_0x429c37[_0x8add('0x10')]));});});};exports[_0x8add('0x1e')]=function(_0x4ee773){var _0x485ad5=this;return new Promise(function(_0x2b9da6,_0x59b09f){return db[_0x8add('0x13')][_0x8add('0x1f')]({'raw':_0x4ee773[_0x8add('0x14')]?_0x4ee773[_0x8add('0x14')][_0x8add('0x15')]===undefined?!![]:![]:!![],'where':_0x4ee773[_0x8add('0x14')]?_0x4ee773['options'][_0x8add('0x16')]||null:null,'attributes':_0x4ee773['options']?_0x4ee773['options'][_0x8add('0x17')]||null:null,'include':_0x4ee773['options']?_0x4ee773[_0x8add('0x14')][_0x8add('0x19')]?_[_0x8add('0x1a')](_0x4ee773[_0x8add('0x14')][_0x8add('0x19')],function(_0x31a609){return{'model':db[_0x31a609['model']],'as':_0x31a609['as'],'attributes':_0x31a609[_0x8add('0x17')],'include':_0x31a609[_0x8add('0x19')]?_['map'](_0x31a609[_0x8add('0x19')],function(_0x1cf6da){return{'model':db[_0x1cf6da[_0x8add('0x1b')]],'as':_0x1cf6da['as'],'attributes':_0x1cf6da[_0x8add('0x17')],'include':_0x1cf6da['include']?_[_0x8add('0x1a')](_0x1cf6da[_0x8add('0x19')],function(_0x2846ac){return{'model':db[_0x2846ac[_0x8add('0x1b')]],'as':_0x2846ac['as'],'attributes':_0x2846ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x8add('0x9')](function(_0x2e0429){logger['info'](_0x8add('0x1e'),_0x4ee773);logger[_0x8add('0xc')](_0x8add('0x1e'),_0x4ee773,JSON['stringify'](_0x2e0429));_0x2b9da6(_0x2e0429);})[_0x8add('0x20')](function(_0x51c6e4){logger[_0x8add('0xe')]('ShowServicenowAccount',_0x51c6e4[_0x8add('0x10')],_0x4ee773);_0x59b09f(_0x485ad5[_0x8add('0xe')](0x1f4,_0x51c6e4['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5630e6a..cbd065c 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 _0xa250=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x53135c,_0x36638e){var _0x3606cc=function(_0x36826c){while(--_0x36826c){_0x53135c['push'](_0x53135c['shift']());}};_0x3606cc(++_0x36638e);}(_0xa250,0xc9));var _0x0a25=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0xa250[_0x12c076];return _0x2ddd18;};'use strict';var multer=require(_0x0a25('0x0'));var util=require(_0x0a25('0x1'));var path=require(_0x0a25('0x2'));var timeout=require(_0x0a25('0x3'));var express=require(_0x0a25('0x4'));var router=express[_0x0a25('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a25('0x6'));var interaction=require(_0x0a25('0x7'));var config=require(_0x0a25('0x8'));var controller=require(_0x0a25('0x9'));router[_0x0a25('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0a25('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0a25('0xa')](_0x0a25('0xb'),auth[_0x0a25('0xc')](),controller[_0x0a25('0xd')]);router['get']('/:id/subjects',auth[_0x0a25('0xc')](),controller[_0x0a25('0xe')]);router['get'](_0x0a25('0xf'),auth[_0x0a25('0xc')](),controller[_0x0a25('0x10')]);router[_0x0a25('0x11')]('/',auth[_0x0a25('0xc')](),controller[_0x0a25('0x12')]);router['put'](_0x0a25('0x13'),auth[_0x0a25('0xc')](),controller[_0x0a25('0x14')]);router[_0x0a25('0x15')](_0x0a25('0x13'),auth[_0x0a25('0xc')](),controller[_0x0a25('0x16')]);module['exports']=router; \ No newline at end of file +var _0x77cc=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','util'];(function(_0x3a9e96,_0x3babd8){var _0xbeef8e=function(_0x3355d7){while(--_0x3355d7){_0x3a9e96['push'](_0x3a9e96['shift']());}};_0xbeef8e(++_0x3babd8);}(_0x77cc,0x1e3));var _0xc77c=function(_0x2cee34,_0x7e21a9){_0x2cee34=_0x2cee34-0x0;var _0x5a369e=_0x77cc[_0x2cee34];return _0x5a369e;};'use strict';var multer=require('multer');var util=require(_0xc77c('0x0'));var path=require(_0xc77c('0x1'));var timeout=require(_0xc77c('0x2'));var express=require(_0xc77c('0x3'));var router=express[_0xc77c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc77c('0x5'));var config=require(_0xc77c('0x6'));var controller=require(_0xc77c('0x7'));router[_0xc77c('0x8')]('/',auth[_0xc77c('0x9')](),controller['index']);router['get'](_0xc77c('0xa'),auth[_0xc77c('0x9')](),controller[_0xc77c('0xb')]);router['get'](_0xc77c('0xc'),auth[_0xc77c('0x9')](),controller[_0xc77c('0xd')]);router[_0xc77c('0x8')](_0xc77c('0xe'),auth[_0xc77c('0x9')](),controller['getSubjects']);router[_0xc77c('0x8')](_0xc77c('0xf'),auth[_0xc77c('0x9')](),controller[_0xc77c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc77c('0x11')]);router['put']('/:id',auth[_0xc77c('0x9')](),controller[_0xc77c('0x12')]);router[_0xc77c('0x13')](_0xc77c('0xa'),auth[_0xc77c('0x9')](),controller[_0xc77c('0x14')]);module[_0xc77c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2a39d62..db7915d 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 _0xaf25=['sequelize'];(function(_0x1f62e4,_0x24435f){var _0x50014b=function(_0x1b4685){while(--_0x1b4685){_0x1f62e4['push'](_0x1f62e4['shift']());}};_0x50014b(++_0x24435f);}(_0xaf25,0x9e));var _0x5af2=function(_0x32dcf1,_0x462ca4){_0x32dcf1=_0x32dcf1-0x0;var _0x115671=_0xaf25[_0x32dcf1];return _0x115671;};'use strict';var Sequelize=require(_0x5af2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x373e=['exports','STRING','sequelize'];(function(_0x5bc710,_0x5c0f96){var _0x4fd9a4=function(_0x1e4783){while(--_0x1e4783){_0x5bc710['push'](_0x5bc710['shift']());}};_0x4fd9a4(++_0x5c0f96);}(_0x373e,0xf8));var _0xe373=function(_0x38dfb2,_0x45f838){_0x38dfb2=_0x38dfb2-0x0;var _0x11fb6a=_0x373e[_0x38dfb2];return _0x11fb6a;};'use strict';var Sequelize=require(_0xe373('0x0'));module[_0xe373('0x1')]={'name':{'type':Sequelize[_0xe373('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3db70ba..3352bc6 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 _0xf0e6=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','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','destroy','getFields','findOne','ServicenowField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel'];(function(_0x2e22ed,_0x31f093){var _0x441f17=function(_0x4fc4af){while(--_0x4fc4af){_0x2e22ed['push'](_0x2e22ed['shift']());}};_0x441f17(++_0x31f093);}(_0xf0e6,0x176));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6f0e('0x0'));var rimraf=require(_0x6f0e('0x1'));var zipdir=require(_0x6f0e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f0e('0x3'));var moment=require(_0x6f0e('0x4'));var BPromise=require(_0x6f0e('0x5'));var Mustache=require('mustache');var util=require(_0x6f0e('0x6'));var path=require(_0x6f0e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f0e('0x8'));var _=require(_0x6f0e('0x9'));var squel=require(_0x6f0e('0xa'));var crypto=require(_0x6f0e('0xb'));var jsforce=require(_0x6f0e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f0e('0xd'));var querystring=require(_0x6f0e('0xe'));var Papa=require(_0x6f0e('0xf'));var Redis=require(_0x6f0e('0x10'));var authService=require(_0x6f0e('0x11'));var qs=require(_0x6f0e('0x12'));var as=require(_0x6f0e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f0e('0x14'))(_0x6f0e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f0e('0x16'));var db=require(_0x6f0e('0x17'))['db'];function respondWithStatusCode(_0x4ad20a,_0x4f7940){_0x4f7940=_0x4f7940||0xcc;return function(_0x1138a5){if(_0x1138a5){return _0x4ad20a['sendStatus'](_0x4f7940);}return _0x4ad20a[_0x6f0e('0x18')](_0x4f7940)[_0x6f0e('0x19')]();};}function respondWithResult(_0x3fae59,_0x39d889){_0x39d889=_0x39d889||0xc8;return function(_0x486f32){if(_0x486f32){return _0x3fae59[_0x6f0e('0x18')](_0x39d889)['json'](_0x486f32);}};}function respondWithFilteredResult(_0xa759c6,_0x33f4c4){return function(_0x2808fe){if(_0x2808fe){var _0x410aaf=typeof _0x33f4c4[_0x6f0e('0x1a')]===_0x6f0e('0x1b')&&typeof _0x33f4c4[_0x6f0e('0x1c')]==='undefined';var _0x5432f7=_0x2808fe[_0x6f0e('0x1d')];var _0x413326=_0x410aaf?0x0:_0x33f4c4[_0x6f0e('0x1a')];var _0x402551=_0x410aaf?_0x2808fe[_0x6f0e('0x1d')]:_0x33f4c4[_0x6f0e('0x1a')]+_0x33f4c4[_0x6f0e('0x1c')];var _0x1afda6;if(_0x402551>=_0x5432f7){_0x402551=_0x5432f7;_0x1afda6=0xc8;}else{_0x1afda6=0xce;}_0xa759c6[_0x6f0e('0x18')](_0x1afda6);return _0xa759c6[_0x6f0e('0x1e')](_0x6f0e('0x1f'),_0x413326+'-'+_0x402551+'/'+_0x5432f7)['json'](_0x2808fe);}return null;};}function patchUpdates(_0x370440){return function(_0x1ec774){try{jsonpatch['apply'](_0x1ec774,_0x370440,!![]);}catch(_0x220aaa){return BPromise[_0x6f0e('0x20')](_0x220aaa);}return _0x1ec774[_0x6f0e('0x21')]();};}function saveUpdates(_0x2df6cf,_0x3015f1){return function(_0x27b7fa){if(_0x27b7fa){return _0x27b7fa[_0x6f0e('0x22')](_0x2df6cf)['then'](function(_0x1e75bb){return _0x1e75bb;});}return null;};}function removeEntity(_0x1b3643,_0x3b1cd6){return function(_0x46495e){if(_0x46495e){return _0x46495e['destroy']()[_0x6f0e('0x23')](function(){_0x1b3643[_0x6f0e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7631,_0x53247d){return function(_0x87f08f){if(!_0x87f08f){_0x5b7631['sendStatus'](0x194);}return _0x87f08f;};}function handleError(_0x53070a,_0x41fd60){_0x41fd60=_0x41fd60||0x1f4;return function(_0x4419c9){logger[_0x6f0e('0x24')](_0x4419c9['stack']);if(_0x4419c9[_0x6f0e('0x25')]){delete _0x4419c9[_0x6f0e('0x25')];}_0x53070a[_0x6f0e('0x18')](_0x41fd60)['send'](_0x4419c9);};}exports[_0x6f0e('0x26')]=function(_0x3c2b6a,_0x9faf1f){var _0x261958={},_0x498af9={},_0x2aa293={'count':0x0,'rows':[]};var _0x15a5cf=_[_0x6f0e('0x27')](db[_0x6f0e('0x28')][_0x6f0e('0x29')],function(_0x214e1b){return{'name':_0x214e1b[_0x6f0e('0x2a')],'type':_0x214e1b[_0x6f0e('0x2b')]['key']};});_0x498af9[_0x6f0e('0x2c')]=_['map'](_0x15a5cf,_0x6f0e('0x25'));_0x498af9[_0x6f0e('0x2d')]=_['keys'](_0x3c2b6a[_0x6f0e('0x2d')]);_0x498af9[_0x6f0e('0x2e')]=_[_0x6f0e('0x2f')](_0x498af9[_0x6f0e('0x2c')],_0x498af9['query']);_0x261958[_0x6f0e('0x30')]=_[_0x6f0e('0x2f')](_0x498af9['model'],qs[_0x6f0e('0x31')](_0x3c2b6a['query'][_0x6f0e('0x31')]));_0x261958[_0x6f0e('0x30')]=_0x261958[_0x6f0e('0x30')][_0x6f0e('0x32')]?_0x261958[_0x6f0e('0x30')]:_0x498af9[_0x6f0e('0x2c')];if(!_0x3c2b6a['query'][_0x6f0e('0x33')](_0x6f0e('0x34'))){_0x261958[_0x6f0e('0x1c')]=qs['limit'](_0x3c2b6a[_0x6f0e('0x2d')][_0x6f0e('0x1c')]);_0x261958['offset']=qs[_0x6f0e('0x1a')](_0x3c2b6a[_0x6f0e('0x2d')][_0x6f0e('0x1a')]);}_0x261958[_0x6f0e('0x35')]=qs['sort'](_0x3c2b6a[_0x6f0e('0x2d')][_0x6f0e('0x36')]);_0x261958[_0x6f0e('0x37')]=qs[_0x6f0e('0x2e')](_['pick'](_0x3c2b6a[_0x6f0e('0x2d')],_0x498af9['filters']),_0x15a5cf);if(_0x3c2b6a[_0x6f0e('0x2d')][_0x6f0e('0x38')]){_0x261958[_0x6f0e('0x37')]=_[_0x6f0e('0x39')](_0x261958['where'],{'$or':_[_0x6f0e('0x27')](_0x15a5cf,function(_0x4bc98c){if(_0x4bc98c[_0x6f0e('0x2b')]!=='VIRTUAL'){var _0x4c8b9e={};_0x4c8b9e[_0x4bc98c[_0x6f0e('0x25')]]={'$like':'%'+_0x3c2b6a[_0x6f0e('0x2d')][_0x6f0e('0x38')]+'%'};return _0x4c8b9e;}})});}_0x261958=_['merge']({},_0x261958,_0x3c2b6a['options']);var _0x49482c={'where':_0x261958[_0x6f0e('0x37')]};return db['ServicenowConfiguration'][_0x6f0e('0x1d')](_0x49482c)[_0x6f0e('0x23')](function(_0x33e007){_0x2aa293['count']=_0x33e007;if(_0x3c2b6a['query'][_0x6f0e('0x3a')]){_0x261958[_0x6f0e('0x3b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x6f0e('0x3c')](_0x261958);})[_0x6f0e('0x23')](function(_0x3dd2e0){_0x2aa293[_0x6f0e('0x3d')]=_0x3dd2e0;return _0x2aa293;})[_0x6f0e('0x23')](respondWithFilteredResult(_0x9faf1f,_0x261958))[_0x6f0e('0x3e')](handleError(_0x9faf1f,null));};exports[_0x6f0e('0x3f')]=function(_0x4056a1,_0x21d4b5){var _0x213cc7={'raw':![],'where':{'id':_0x4056a1[_0x6f0e('0x40')]['id']}},_0xca186={};_0xca186[_0x6f0e('0x2c')]=_[_0x6f0e('0x41')](db[_0x6f0e('0x28')][_0x6f0e('0x29')]);_0xca186['query']=_['keys'](_0x4056a1[_0x6f0e('0x2d')]);_0xca186[_0x6f0e('0x2e')]=_[_0x6f0e('0x2f')](_0xca186[_0x6f0e('0x2c')],_0xca186[_0x6f0e('0x2d')]);_0x213cc7[_0x6f0e('0x30')]=_[_0x6f0e('0x2f')](_0xca186['model'],qs['fields'](_0x4056a1[_0x6f0e('0x2d')]['fields']));_0x213cc7['attributes']=_0x213cc7[_0x6f0e('0x30')][_0x6f0e('0x32')]?_0x213cc7[_0x6f0e('0x30')]:_0xca186['model'];if(_0x4056a1[_0x6f0e('0x2d')][_0x6f0e('0x3a')]){_0x213cc7[_0x6f0e('0x3b')]=[{'all':!![]}];}_0x213cc7=_[_0x6f0e('0x39')]({},_0x213cc7,_0x4056a1[_0x6f0e('0x42')]);return db['ServicenowConfiguration']['find'](_0x213cc7)[_0x6f0e('0x23')](handleEntityNotFound(_0x21d4b5,null))['then'](respondWithResult(_0x21d4b5,null))[_0x6f0e('0x3e')](handleError(_0x21d4b5,null));};exports[_0x6f0e('0x43')]=function(_0x206e06,_0x544856){return db[_0x6f0e('0x28')][_0x6f0e('0x43')](_0x206e06[_0x6f0e('0x44')],{})[_0x6f0e('0x23')](respondWithResult(_0x544856,0xc9))['catch'](handleError(_0x544856,null));};exports[_0x6f0e('0x22')]=function(_0x311c91,_0x59d253){if(_0x311c91[_0x6f0e('0x44')]['id']){delete _0x311c91['body']['id'];}return db[_0x6f0e('0x28')][_0x6f0e('0x45')]({'where':{'id':_0x311c91[_0x6f0e('0x40')]['id']}})[_0x6f0e('0x23')](handleEntityNotFound(_0x59d253,null))[_0x6f0e('0x23')](saveUpdates(_0x311c91[_0x6f0e('0x44')],null))[_0x6f0e('0x23')](respondWithResult(_0x59d253,null))[_0x6f0e('0x3e')](handleError(_0x59d253,null));};exports[_0x6f0e('0x46')]=function(_0x3068df,_0x3e2f46){return db['ServicenowConfiguration'][_0x6f0e('0x45')]({'where':{'id':_0x3068df['params']['id']}})['then'](handleEntityNotFound(_0x3e2f46,null))[_0x6f0e('0x23')](removeEntity(_0x3e2f46,null))[_0x6f0e('0x3e')](handleError(_0x3e2f46,null));};exports[_0x6f0e('0x47')]=function(_0x59b189,_0x54afb6,_0x519e4a){var _0x44e9ce={};var _0x465d8c={};var _0x2338b3;var _0x1dcb17;return db[_0x6f0e('0x28')][_0x6f0e('0x48')]({'where':{'id':_0x59b189[_0x6f0e('0x40')]['id']}})[_0x6f0e('0x23')](handleEntityNotFound(_0x54afb6,null))[_0x6f0e('0x23')](function(_0x5dd40e){if(_0x5dd40e){_0x2338b3=_0x5dd40e;_0x465d8c[_0x6f0e('0x2c')]=_[_0x6f0e('0x41')](db[_0x6f0e('0x49')][_0x6f0e('0x29')]);_0x465d8c[_0x6f0e('0x2d')]=_[_0x6f0e('0x41')](_0x59b189[_0x6f0e('0x2d')]);_0x465d8c[_0x6f0e('0x2e')]=_[_0x6f0e('0x2f')](_0x465d8c[_0x6f0e('0x2c')],_0x465d8c[_0x6f0e('0x2d')]);_0x44e9ce['attributes']=_[_0x6f0e('0x2f')](_0x465d8c['model'],qs[_0x6f0e('0x31')](_0x59b189[_0x6f0e('0x2d')]['fields']));_0x44e9ce[_0x6f0e('0x30')]=_0x44e9ce['attributes']['length']?_0x44e9ce['attributes']:_0x465d8c[_0x6f0e('0x2c')];_0x44e9ce['order']=qs['sort'](_0x59b189[_0x6f0e('0x2d')][_0x6f0e('0x36')]);_0x44e9ce[_0x6f0e('0x37')]=qs['filters'](_['pick'](_0x59b189[_0x6f0e('0x2d')],_0x465d8c[_0x6f0e('0x2e')]));if(_0x59b189[_0x6f0e('0x2d')][_0x6f0e('0x38')]){_0x44e9ce[_0x6f0e('0x37')]=_[_0x6f0e('0x39')](_0x44e9ce[_0x6f0e('0x37')],{'$or':_[_0x6f0e('0x27')](_0x44e9ce[_0x6f0e('0x30')],function(_0x3b8f82){var _0x2395cb={};_0x2395cb[_0x3b8f82]={'$like':'%'+_0x59b189['query'][_0x6f0e('0x38')]+'%'};return _0x2395cb;})});}_0x44e9ce=_[_0x6f0e('0x39')]({},_0x44e9ce,_0x59b189[_0x6f0e('0x42')]);return _0x2338b3[_0x6f0e('0x47')](_0x44e9ce);}})[_0x6f0e('0x23')](function(_0x159190){if(_0x159190){_0x1dcb17=_0x159190['length'];if(!_0x59b189[_0x6f0e('0x2d')]['hasOwnProperty']('nolimit')){_0x44e9ce[_0x6f0e('0x1c')]=qs[_0x6f0e('0x1c')](_0x59b189['query'][_0x6f0e('0x1c')]);_0x44e9ce[_0x6f0e('0x1a')]=qs[_0x6f0e('0x1a')](_0x59b189[_0x6f0e('0x2d')][_0x6f0e('0x1a')]);}return _0x2338b3[_0x6f0e('0x47')](_0x44e9ce);}})['then'](function(_0x17a1c7){if(_0x17a1c7){return _0x17a1c7?{'count':_0x1dcb17,'rows':_0x17a1c7}:null;}})[_0x6f0e('0x23')](respondWithResult(_0x54afb6,null))[_0x6f0e('0x3e')](handleError(_0x54afb6,null));};exports[_0x6f0e('0x4a')]=function(_0x30b0c3,_0x2dd483,_0x2f5677){var _0x1c3bca={};var _0x367e10={};var _0x2d933c;var _0x2300d2;return db[_0x6f0e('0x28')]['findOne']({'where':{'id':_0x30b0c3['params']['id']}})[_0x6f0e('0x23')](handleEntityNotFound(_0x2dd483,null))['then'](function(_0x1a321f){if(_0x1a321f){_0x2d933c=_0x1a321f;_0x367e10[_0x6f0e('0x2c')]=_[_0x6f0e('0x41')](db[_0x6f0e('0x49')][_0x6f0e('0x29')]);_0x367e10[_0x6f0e('0x2d')]=_[_0x6f0e('0x41')](_0x30b0c3['query']);_0x367e10[_0x6f0e('0x2e')]=_[_0x6f0e('0x2f')](_0x367e10[_0x6f0e('0x2c')],_0x367e10[_0x6f0e('0x2d')]);_0x1c3bca[_0x6f0e('0x30')]=_[_0x6f0e('0x2f')](_0x367e10[_0x6f0e('0x2c')],qs[_0x6f0e('0x31')](_0x30b0c3['query'][_0x6f0e('0x31')]));_0x1c3bca[_0x6f0e('0x30')]=_0x1c3bca[_0x6f0e('0x30')][_0x6f0e('0x32')]?_0x1c3bca['attributes']:_0x367e10[_0x6f0e('0x2c')];_0x1c3bca[_0x6f0e('0x35')]=qs['sort'](_0x30b0c3['query']['sort']);_0x1c3bca['where']=qs['filters'](_[_0x6f0e('0x4b')](_0x30b0c3[_0x6f0e('0x2d')],_0x367e10[_0x6f0e('0x2e')]));if(_0x30b0c3[_0x6f0e('0x2d')][_0x6f0e('0x38')]){_0x1c3bca[_0x6f0e('0x37')]=_[_0x6f0e('0x39')](_0x1c3bca[_0x6f0e('0x37')],{'$or':_[_0x6f0e('0x27')](_0x1c3bca[_0x6f0e('0x30')],function(_0x9918b6){var _0x47b591={};_0x47b591[_0x9918b6]={'$like':'%'+_0x30b0c3[_0x6f0e('0x2d')][_0x6f0e('0x38')]+'%'};return _0x47b591;})});}_0x1c3bca=_['merge']({},_0x1c3bca,_0x30b0c3['options']);return _0x2d933c[_0x6f0e('0x4a')](_0x1c3bca);}})[_0x6f0e('0x23')](function(_0x54cd75){if(_0x54cd75){_0x2300d2=_0x54cd75[_0x6f0e('0x32')];if(!_0x30b0c3['query'][_0x6f0e('0x33')](_0x6f0e('0x34'))){_0x1c3bca[_0x6f0e('0x1c')]=qs[_0x6f0e('0x1c')](_0x30b0c3[_0x6f0e('0x2d')]['limit']);_0x1c3bca[_0x6f0e('0x1a')]=qs[_0x6f0e('0x1a')](_0x30b0c3['query'][_0x6f0e('0x1a')]);}return _0x2d933c[_0x6f0e('0x4a')](_0x1c3bca);}})[_0x6f0e('0x23')](function(_0x2f5bb0){if(_0x2f5bb0){return _0x2f5bb0?{'count':_0x2300d2,'rows':_0x2f5bb0}:null;}})[_0x6f0e('0x23')](respondWithResult(_0x2dd483,null))['catch'](handleError(_0x2dd483,null));};exports[_0x6f0e('0x4c')]=function(_0x23c000,_0x4c4820,_0x30dedc){var _0x3b1505={};var _0x1d7682={};var _0x504d71;var _0x100539;return db[_0x6f0e('0x28')][_0x6f0e('0x48')]({'where':{'id':_0x23c000[_0x6f0e('0x40')]['id']}})[_0x6f0e('0x23')](handleEntityNotFound(_0x4c4820,null))[_0x6f0e('0x23')](function(_0x20d275){if(_0x20d275){_0x504d71=_0x20d275;_0x1d7682[_0x6f0e('0x2c')]=_['keys'](db['ServicenowField'][_0x6f0e('0x29')]);_0x1d7682[_0x6f0e('0x2d')]=_['keys'](_0x23c000[_0x6f0e('0x2d')]);_0x1d7682[_0x6f0e('0x2e')]=_[_0x6f0e('0x2f')](_0x1d7682[_0x6f0e('0x2c')],_0x1d7682[_0x6f0e('0x2d')]);_0x3b1505[_0x6f0e('0x30')]=_[_0x6f0e('0x2f')](_0x1d7682[_0x6f0e('0x2c')],qs[_0x6f0e('0x31')](_0x23c000[_0x6f0e('0x2d')][_0x6f0e('0x31')]));_0x3b1505[_0x6f0e('0x30')]=_0x3b1505[_0x6f0e('0x30')][_0x6f0e('0x32')]?_0x3b1505[_0x6f0e('0x30')]:_0x1d7682[_0x6f0e('0x2c')];_0x3b1505['order']=qs[_0x6f0e('0x36')](_0x23c000[_0x6f0e('0x2d')][_0x6f0e('0x36')]);_0x3b1505['where']=qs['filters'](_[_0x6f0e('0x4b')](_0x23c000['query'],_0x1d7682[_0x6f0e('0x2e')]));if(_0x23c000['query'][_0x6f0e('0x38')]){_0x3b1505[_0x6f0e('0x37')]=_[_0x6f0e('0x39')](_0x3b1505['where'],{'$or':_[_0x6f0e('0x27')](_0x3b1505['attributes'],function(_0x13d4f1){var _0x1bc461={};_0x1bc461[_0x13d4f1]={'$like':'%'+_0x23c000['query'][_0x6f0e('0x38')]+'%'};return _0x1bc461;})});}_0x3b1505=_['merge']({},_0x3b1505,_0x23c000[_0x6f0e('0x42')]);return _0x504d71[_0x6f0e('0x4c')](_0x3b1505);}})[_0x6f0e('0x23')](function(_0x29141a){if(_0x29141a){_0x100539=_0x29141a['length'];if(!_0x23c000[_0x6f0e('0x2d')][_0x6f0e('0x33')]('nolimit')){_0x3b1505[_0x6f0e('0x1c')]=qs[_0x6f0e('0x1c')](_0x23c000['query'][_0x6f0e('0x1c')]);_0x3b1505[_0x6f0e('0x1a')]=qs[_0x6f0e('0x1a')](_0x23c000[_0x6f0e('0x2d')]['offset']);}return _0x504d71[_0x6f0e('0x4c')](_0x3b1505);}})[_0x6f0e('0x23')](function(_0x1dfa9f){if(_0x1dfa9f){return _0x1dfa9f?{'count':_0x100539,'rows':_0x1dfa9f}:null;}})[_0x6f0e('0x23')](respondWithResult(_0x4c4820,null))[_0x6f0e('0x3e')](handleError(_0x4c4820,null));}; \ No newline at end of file +var _0xe11e=['../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','end','error','stack','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ServicenowField','getFields','hasOwnProperty','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x63a3c4,_0x1bef2e){var _0x7fa2b0=function(_0x1131d9){while(--_0x1131d9){_0x63a3c4['push'](_0x63a3c4['shift']());}};_0x7fa2b0(++_0x1bef2e);}(_0xe11e,0x8d));var _0xee11=function(_0x3bd2de,_0x3a1dfd){_0x3bd2de=_0x3bd2de-0x0;var _0x59e9b0=_0xe11e[_0x3bd2de];return _0x59e9b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee11('0x0'));var rp=require(_0xee11('0x1'));var moment=require(_0xee11('0x2'));var BPromise=require(_0xee11('0x3'));var Mustache=require(_0xee11('0x4'));var util=require('util');var path=require('path');var sox=require(_0xee11('0x5'));var csv=require(_0xee11('0x6'));var ejs=require(_0xee11('0x7'));var fs=require('fs');var fs_extra=require(_0xee11('0x8'));var _=require(_0xee11('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee11('0xa'));var deskjs=require(_0xee11('0xb'));var toCsv=require(_0xee11('0x6'));var querystring=require(_0xee11('0xc'));var Papa=require(_0xee11('0xd'));var Redis=require(_0xee11('0xe'));var authService=require(_0xee11('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee11('0x10'));var logger=require('../../config/logger')(_0xee11('0x11'));var utils=require(_0xee11('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xee11('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x342dcd,_0xc4524a){_0xc4524a=_0xc4524a||0xcc;return function(_0x5d9cfc){if(_0x5d9cfc){return _0x342dcd[_0xee11('0x14')](_0xc4524a);}return _0x342dcd[_0xee11('0x15')](_0xc4524a)['end']();};}function respondWithResult(_0x199b52,_0x18e262){_0x18e262=_0x18e262||0xc8;return function(_0x5a6c68){if(_0x5a6c68){return _0x199b52[_0xee11('0x15')](_0x18e262)[_0xee11('0x16')](_0x5a6c68);}};}function respondWithFilteredResult(_0x5b29ad,_0x336e50){return function(_0x30d807){if(_0x30d807){var _0x54f6d2=typeof _0x336e50[_0xee11('0x17')]==='undefined'&&typeof _0x336e50[_0xee11('0x18')]===_0xee11('0x19');var _0x2e2a07=_0x30d807[_0xee11('0x1a')];var _0x459f45=_0x54f6d2?0x0:_0x336e50[_0xee11('0x17')];var _0x1bbe05=_0x54f6d2?_0x30d807['count']:_0x336e50[_0xee11('0x17')]+_0x336e50[_0xee11('0x18')];var _0x7f7a19;if(_0x1bbe05>=_0x2e2a07){_0x1bbe05=_0x2e2a07;_0x7f7a19=0xc8;}else{_0x7f7a19=0xce;}_0x5b29ad[_0xee11('0x15')](_0x7f7a19);return _0x5b29ad[_0xee11('0x1b')]('Content-Range',_0x459f45+'-'+_0x1bbe05+'/'+_0x2e2a07)[_0xee11('0x16')](_0x30d807);}return null;};}function patchUpdates(_0x229f66){return function(_0x59e399){try{jsonpatch[_0xee11('0x1c')](_0x59e399,_0x229f66,!![]);}catch(_0x30a5d3){return BPromise['reject'](_0x30a5d3);}return _0x59e399[_0xee11('0x1d')]();};}function saveUpdates(_0x900ea4,_0x49718a){return function(_0x1ac6ae){if(_0x1ac6ae){return _0x1ac6ae[_0xee11('0x1e')](_0x900ea4)[_0xee11('0x1f')](function(_0x336c5f){return _0x336c5f;});}return null;};}function removeEntity(_0x3bcf28,_0x2aef5a){return function(_0x995909){if(_0x995909){return _0x995909[_0xee11('0x20')]()[_0xee11('0x1f')](function(){_0x3bcf28[_0xee11('0x15')](0xcc)[_0xee11('0x21')]();});}};}function handleEntityNotFound(_0x3d1846,_0x5e39ef){return function(_0x31e384){if(!_0x31e384){_0x3d1846[_0xee11('0x14')](0x194);}return _0x31e384;};}function handleError(_0x3a5dad,_0x175932){_0x175932=_0x175932||0x1f4;return function(_0x594da9){logger[_0xee11('0x22')](_0x594da9[_0xee11('0x23')]);if(_0x594da9['name']){delete _0x594da9['name'];}_0x3a5dad['status'](_0x175932)[_0xee11('0x24')](_0x594da9);};}exports[_0xee11('0x25')]=function(_0x1ddf34,_0x4815d4){var _0xf8b15d={},_0x2a41ee={},_0x37ccfa={'count':0x0,'rows':[]};var _0x115495=_[_0xee11('0x26')](db[_0xee11('0x27')][_0xee11('0x28')],function(_0xa43e1){return{'name':_0xa43e1[_0xee11('0x29')],'type':_0xa43e1[_0xee11('0x2a')][_0xee11('0x2b')]};});_0x2a41ee['model']=_['map'](_0x115495,_0xee11('0x2c'));_0x2a41ee[_0xee11('0x2d')]=_[_0xee11('0x2e')](_0x1ddf34['query']);_0x2a41ee[_0xee11('0x2f')]=_[_0xee11('0x30')](_0x2a41ee[_0xee11('0x31')],_0x2a41ee[_0xee11('0x2d')]);_0xf8b15d['attributes']=_['intersection'](_0x2a41ee[_0xee11('0x31')],qs[_0xee11('0x32')](_0x1ddf34[_0xee11('0x2d')][_0xee11('0x32')]));_0xf8b15d[_0xee11('0x33')]=_0xf8b15d['attributes'][_0xee11('0x34')]?_0xf8b15d[_0xee11('0x33')]:_0x2a41ee[_0xee11('0x31')];if(!_0x1ddf34[_0xee11('0x2d')]['hasOwnProperty'](_0xee11('0x35'))){_0xf8b15d[_0xee11('0x18')]=qs[_0xee11('0x18')](_0x1ddf34[_0xee11('0x2d')][_0xee11('0x18')]);_0xf8b15d['offset']=qs['offset'](_0x1ddf34[_0xee11('0x2d')][_0xee11('0x17')]);}_0xf8b15d[_0xee11('0x36')]=qs[_0xee11('0x37')](_0x1ddf34[_0xee11('0x2d')][_0xee11('0x37')]);_0xf8b15d[_0xee11('0x38')]=qs['filters'](_[_0xee11('0x39')](_0x1ddf34[_0xee11('0x2d')],_0x2a41ee[_0xee11('0x2f')]),_0x115495);if(_0x1ddf34['query']['filter']){_0xf8b15d['where']=_[_0xee11('0x3a')](_0xf8b15d['where'],{'$or':_['map'](_0x115495,function(_0x1caca5){if(_0x1caca5[_0xee11('0x2a')]!==_0xee11('0x3b')){var _0x2eb3b8={};_0x2eb3b8[_0x1caca5[_0xee11('0x2c')]]={'$like':'%'+_0x1ddf34[_0xee11('0x2d')][_0xee11('0x3c')]+'%'};return _0x2eb3b8;}})});}_0xf8b15d=_[_0xee11('0x3a')]({},_0xf8b15d,_0x1ddf34[_0xee11('0x3d')]);var _0x1e57b0={'where':_0xf8b15d[_0xee11('0x38')]};return db[_0xee11('0x27')][_0xee11('0x1a')](_0x1e57b0)[_0xee11('0x1f')](function(_0x2929e2){_0x37ccfa['count']=_0x2929e2;if(_0x1ddf34[_0xee11('0x2d')][_0xee11('0x3e')]){_0xf8b15d[_0xee11('0x3f')]=[{'all':!![]}];}return db[_0xee11('0x27')][_0xee11('0x40')](_0xf8b15d);})['then'](function(_0x26975e){_0x37ccfa[_0xee11('0x41')]=_0x26975e;return _0x37ccfa;})[_0xee11('0x1f')](respondWithFilteredResult(_0x4815d4,_0xf8b15d))[_0xee11('0x42')](handleError(_0x4815d4,null));};exports[_0xee11('0x43')]=function(_0x29bf6f,_0x2b5425){var _0x5eac6e={'raw':![],'where':{'id':_0x29bf6f[_0xee11('0x44')]['id']}},_0x4282cd={};_0x4282cd[_0xee11('0x31')]=_['keys'](db[_0xee11('0x27')]['rawAttributes']);_0x4282cd['query']=_[_0xee11('0x2e')](_0x29bf6f[_0xee11('0x2d')]);_0x4282cd[_0xee11('0x2f')]=_['intersection'](_0x4282cd[_0xee11('0x31')],_0x4282cd[_0xee11('0x2d')]);_0x5eac6e[_0xee11('0x33')]=_[_0xee11('0x30')](_0x4282cd[_0xee11('0x31')],qs[_0xee11('0x32')](_0x29bf6f[_0xee11('0x2d')][_0xee11('0x32')]));_0x5eac6e[_0xee11('0x33')]=_0x5eac6e[_0xee11('0x33')][_0xee11('0x34')]?_0x5eac6e[_0xee11('0x33')]:_0x4282cd[_0xee11('0x31')];if(_0x29bf6f[_0xee11('0x2d')][_0xee11('0x3e')]){_0x5eac6e[_0xee11('0x3f')]=[{'all':!![]}];}_0x5eac6e=_[_0xee11('0x3a')]({},_0x5eac6e,_0x29bf6f[_0xee11('0x3d')]);return db['ServicenowConfiguration'][_0xee11('0x45')](_0x5eac6e)[_0xee11('0x1f')](handleEntityNotFound(_0x2b5425,null))['then'](respondWithResult(_0x2b5425,null))['catch'](handleError(_0x2b5425,null));};exports[_0xee11('0x46')]=function(_0xbebe07,_0xa5c37c){return db[_0xee11('0x27')][_0xee11('0x46')](_0xbebe07[_0xee11('0x47')],{})[_0xee11('0x1f')](respondWithResult(_0xa5c37c,0xc9))[_0xee11('0x42')](handleError(_0xa5c37c,null));};exports[_0xee11('0x1e')]=function(_0x59885d,_0x90421a){if(_0x59885d[_0xee11('0x47')]['id']){delete _0x59885d[_0xee11('0x47')]['id'];}return db[_0xee11('0x27')]['find']({'where':{'id':_0x59885d[_0xee11('0x44')]['id']}})[_0xee11('0x1f')](handleEntityNotFound(_0x90421a,null))[_0xee11('0x1f')](saveUpdates(_0x59885d[_0xee11('0x47')],null))[_0xee11('0x1f')](respondWithResult(_0x90421a,null))[_0xee11('0x42')](handleError(_0x90421a,null));};exports[_0xee11('0x20')]=function(_0x5e4287,_0x55d4cb){return db['ServicenowConfiguration'][_0xee11('0x45')]({'where':{'id':_0x5e4287[_0xee11('0x44')]['id']}})[_0xee11('0x1f')](handleEntityNotFound(_0x55d4cb,null))[_0xee11('0x1f')](removeEntity(_0x55d4cb,null))[_0xee11('0x42')](handleError(_0x55d4cb,null));};exports['getFields']=function(_0x43c963,_0x1de53c,_0x42845a){var _0x31889e={};var _0x12b500={};var _0xaa8d17;var _0x4f8484;return db['ServicenowConfiguration'][_0xee11('0x48')]({'where':{'id':_0x43c963[_0xee11('0x44')]['id']}})[_0xee11('0x1f')](handleEntityNotFound(_0x1de53c,null))[_0xee11('0x1f')](function(_0x4a76a9){if(_0x4a76a9){_0xaa8d17=_0x4a76a9;_0x12b500[_0xee11('0x31')]=_[_0xee11('0x2e')](db[_0xee11('0x49')]['rawAttributes']);_0x12b500['query']=_[_0xee11('0x2e')](_0x43c963[_0xee11('0x2d')]);_0x12b500[_0xee11('0x2f')]=_[_0xee11('0x30')](_0x12b500[_0xee11('0x31')],_0x12b500[_0xee11('0x2d')]);_0x31889e['attributes']=_['intersection'](_0x12b500[_0xee11('0x31')],qs['fields'](_0x43c963['query'][_0xee11('0x32')]));_0x31889e[_0xee11('0x33')]=_0x31889e[_0xee11('0x33')]['length']?_0x31889e[_0xee11('0x33')]:_0x12b500['model'];_0x31889e[_0xee11('0x36')]=qs[_0xee11('0x37')](_0x43c963['query'][_0xee11('0x37')]);_0x31889e[_0xee11('0x38')]=qs[_0xee11('0x2f')](_['pick'](_0x43c963['query'],_0x12b500[_0xee11('0x2f')]));if(_0x43c963[_0xee11('0x2d')]['filter']){_0x31889e[_0xee11('0x38')]=_[_0xee11('0x3a')](_0x31889e[_0xee11('0x38')],{'$or':_[_0xee11('0x26')](_0x31889e[_0xee11('0x33')],function(_0x2c4650){var _0x4f89b6={};_0x4f89b6[_0x2c4650]={'$like':'%'+_0x43c963[_0xee11('0x2d')]['filter']+'%'};return _0x4f89b6;})});}_0x31889e=_['merge']({},_0x31889e,_0x43c963['options']);return _0xaa8d17[_0xee11('0x4a')](_0x31889e);}})['then'](function(_0x22be2a){if(_0x22be2a){_0x4f8484=_0x22be2a['length'];if(!_0x43c963[_0xee11('0x2d')][_0xee11('0x4b')]('nolimit')){_0x31889e[_0xee11('0x18')]=qs[_0xee11('0x18')](_0x43c963['query'][_0xee11('0x18')]);_0x31889e['offset']=qs[_0xee11('0x17')](_0x43c963[_0xee11('0x2d')][_0xee11('0x17')]);}return _0xaa8d17[_0xee11('0x4a')](_0x31889e);}})[_0xee11('0x1f')](function(_0x383d66){if(_0x383d66){return _0x383d66?{'count':_0x4f8484,'rows':_0x383d66}:null;}})['then'](respondWithResult(_0x1de53c,null))[_0xee11('0x42')](handleError(_0x1de53c,null));};exports[_0xee11('0x4c')]=function(_0xb34c04,_0x550498,_0x2cc37d){var _0x5ef957={};var _0x21c767={};var _0x10bf4e;var _0xc3c5b4;return db['ServicenowConfiguration'][_0xee11('0x48')]({'where':{'id':_0xb34c04[_0xee11('0x44')]['id']}})[_0xee11('0x1f')](handleEntityNotFound(_0x550498,null))[_0xee11('0x1f')](function(_0x235e07){if(_0x235e07){_0x10bf4e=_0x235e07;_0x21c767[_0xee11('0x31')]=_['keys'](db[_0xee11('0x49')][_0xee11('0x28')]);_0x21c767[_0xee11('0x2d')]=_['keys'](_0xb34c04[_0xee11('0x2d')]);_0x21c767[_0xee11('0x2f')]=_[_0xee11('0x30')](_0x21c767[_0xee11('0x31')],_0x21c767[_0xee11('0x2d')]);_0x5ef957['attributes']=_['intersection'](_0x21c767[_0xee11('0x31')],qs[_0xee11('0x32')](_0xb34c04[_0xee11('0x2d')][_0xee11('0x32')]));_0x5ef957[_0xee11('0x33')]=_0x5ef957[_0xee11('0x33')][_0xee11('0x34')]?_0x5ef957['attributes']:_0x21c767[_0xee11('0x31')];_0x5ef957[_0xee11('0x36')]=qs[_0xee11('0x37')](_0xb34c04[_0xee11('0x2d')][_0xee11('0x37')]);_0x5ef957[_0xee11('0x38')]=qs['filters'](_['pick'](_0xb34c04[_0xee11('0x2d')],_0x21c767[_0xee11('0x2f')]));if(_0xb34c04[_0xee11('0x2d')]['filter']){_0x5ef957[_0xee11('0x38')]=_[_0xee11('0x3a')](_0x5ef957[_0xee11('0x38')],{'$or':_[_0xee11('0x26')](_0x5ef957['attributes'],function(_0x2b396d){var _0x316792={};_0x316792[_0x2b396d]={'$like':'%'+_0xb34c04[_0xee11('0x2d')][_0xee11('0x3c')]+'%'};return _0x316792;})});}_0x5ef957=_['merge']({},_0x5ef957,_0xb34c04[_0xee11('0x3d')]);return _0x10bf4e[_0xee11('0x4c')](_0x5ef957);}})[_0xee11('0x1f')](function(_0x1b8edc){if(_0x1b8edc){_0xc3c5b4=_0x1b8edc['length'];if(!_0xb34c04[_0xee11('0x2d')]['hasOwnProperty']('nolimit')){_0x5ef957[_0xee11('0x18')]=qs[_0xee11('0x18')](_0xb34c04['query'][_0xee11('0x18')]);_0x5ef957[_0xee11('0x17')]=qs[_0xee11('0x17')](_0xb34c04[_0xee11('0x2d')][_0xee11('0x17')]);}return _0x10bf4e[_0xee11('0x4c')](_0x5ef957);}})[_0xee11('0x1f')](function(_0x449f03){if(_0x449f03){return _0x449f03?{'count':_0xc3c5b4,'rows':_0x449f03}:null;}})[_0xee11('0x1f')](respondWithResult(_0x550498,null))[_0xee11('0x42')](handleError(_0x550498,null));};exports[_0xee11('0x4d')]=function(_0x54ef79,_0x3fe213,_0x268a85){var _0x25af82={};var _0x40a1d9={};var _0x112a09;var _0x29d5cb;return db[_0xee11('0x27')]['findOne']({'where':{'id':_0x54ef79[_0xee11('0x44')]['id']}})[_0xee11('0x1f')](handleEntityNotFound(_0x3fe213,null))[_0xee11('0x1f')](function(_0x2aae92){if(_0x2aae92){_0x112a09=_0x2aae92;_0x40a1d9[_0xee11('0x31')]=_[_0xee11('0x2e')](db[_0xee11('0x49')][_0xee11('0x28')]);_0x40a1d9[_0xee11('0x2d')]=_[_0xee11('0x2e')](_0x54ef79['query']);_0x40a1d9['filters']=_[_0xee11('0x30')](_0x40a1d9[_0xee11('0x31')],_0x40a1d9[_0xee11('0x2d')]);_0x25af82[_0xee11('0x33')]=_[_0xee11('0x30')](_0x40a1d9[_0xee11('0x31')],qs[_0xee11('0x32')](_0x54ef79[_0xee11('0x2d')][_0xee11('0x32')]));_0x25af82[_0xee11('0x33')]=_0x25af82[_0xee11('0x33')]['length']?_0x25af82[_0xee11('0x33')]:_0x40a1d9[_0xee11('0x31')];_0x25af82[_0xee11('0x36')]=qs['sort'](_0x54ef79[_0xee11('0x2d')][_0xee11('0x37')]);_0x25af82[_0xee11('0x38')]=qs[_0xee11('0x2f')](_[_0xee11('0x39')](_0x54ef79[_0xee11('0x2d')],_0x40a1d9[_0xee11('0x2f')]));if(_0x54ef79[_0xee11('0x2d')][_0xee11('0x3c')]){_0x25af82['where']=_[_0xee11('0x3a')](_0x25af82[_0xee11('0x38')],{'$or':_[_0xee11('0x26')](_0x25af82[_0xee11('0x33')],function(_0x1c327b){var _0x31c643={};_0x31c643[_0x1c327b]={'$like':'%'+_0x54ef79[_0xee11('0x2d')]['filter']+'%'};return _0x31c643;})});}_0x25af82=_['merge']({},_0x25af82,_0x54ef79[_0xee11('0x3d')]);return _0x112a09['getDescriptions'](_0x25af82);}})[_0xee11('0x1f')](function(_0x20cbd5){if(_0x20cbd5){_0x29d5cb=_0x20cbd5[_0xee11('0x34')];if(!_0x54ef79[_0xee11('0x2d')][_0xee11('0x4b')]('nolimit')){_0x25af82[_0xee11('0x18')]=qs[_0xee11('0x18')](_0x54ef79[_0xee11('0x2d')]['limit']);_0x25af82[_0xee11('0x17')]=qs[_0xee11('0x17')](_0x54ef79[_0xee11('0x2d')]['offset']);}return _0x112a09[_0xee11('0x4d')](_0x25af82);}})[_0xee11('0x1f')](function(_0x319aed){if(_0x319aed){return _0x319aed?{'count':_0x29d5cb,'rows':_0x319aed}:null;}})[_0xee11('0x1f')](respondWithResult(_0x3fe213,null))[_0xee11('0x42')](handleError(_0x3fe213,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 761a9d5..5a31a37 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 _0x6b47=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x56610f,_0x41c027){var _0xdb1b27=function(_0x31b82c){while(--_0x31b82c){_0x56610f['push'](_0x56610f['shift']());}};_0xdb1b27(++_0x41c027);}(_0x6b47,0xe9));var _0x76b4=function(_0x25fded,_0x34216e){_0x25fded=_0x25fded-0x0;var _0x269156=_0x6b47[_0x25fded];return _0x269156;};'use strict';var _=require('lodash');var util=require(_0x76b4('0x0'));var logger=require('../../config/logger')(_0x76b4('0x1'));var moment=require(_0x76b4('0x2'));var BPromise=require(_0x76b4('0x3'));var rp=require(_0x76b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76b4('0x5'));var config=require(_0x76b4('0x6'));var attributes=require(_0x76b4('0x7'));module[_0x76b4('0x8')]=function(_0x292e27,_0x49fc2a){return _0x292e27[_0x76b4('0x9')](_0x76b4('0xa'),attributes,{'tableName':_0x76b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d62=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x370e6d,_0x1e18b3){var _0x1494c8=function(_0xbbf571){while(--_0xbbf571){_0x370e6d['push'](_0x370e6d['shift']());}};_0x1494c8(++_0x1e18b3);}(_0x9d62,0xaf));var _0x29d6=function(_0x48c73e,_0x3f184a){_0x48c73e=_0x48c73e-0x0;var _0x24b177=_0x9d62[_0x48c73e];return _0x24b177;};'use strict';var _=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var logger=require(_0x29d6('0x2'))(_0x29d6('0x3'));var moment=require(_0x29d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x29d6('0x5'));var fs=require('fs');var path=require(_0x29d6('0x6'));var rimraf=require(_0x29d6('0x7'));var config=require(_0x29d6('0x8'));var attributes=require(_0x29d6('0x9'));module['exports']=function(_0x2962a9,_0x468e41){return _0x2962a9[_0x29d6('0xa')](_0x29d6('0xb'),attributes,{'tableName':_0x29d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index f8bac71..03255a2 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 _0x6873=['code','message','ServicenowConfiguration,\x20%s,\x20%s','info','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','error'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0x6873,0x124));var _0x3687=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0x6873[_0x87506e];return _0x5496a4;};'use strict';var _=require('lodash');var util=require(_0x3687('0x0'));var moment=require(_0x3687('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3687('0x2'));var db=require(_0x3687('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3687('0x4'))(_0x3687('0x5'));var config=require('../../config/environment');var jayson=require(_0x3687('0x6'));var client=jayson[_0x3687('0x7')][_0x3687('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf29ea9,_0x137f49,_0x15edd1){return new BPromise(function(_0xc58ed3,_0x1f5394){return client['request'](_0xf29ea9,_0x15edd1)[_0x3687('0x9')](function(_0x2911a0){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x137f49,_0x3687('0xa'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x137f49,'request\x20sent',JSON['stringify'](_0x2911a0));if(_0x2911a0[_0x3687('0xb')]){if(_0x2911a0['error'][_0x3687('0xc')]===0x1f4){logger[_0x3687('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x137f49,_0x2911a0['error'][_0x3687('0xd')]);return _0x1f5394(_0x2911a0[_0x3687('0xb')]['message']);}logger[_0x3687('0xb')](_0x3687('0xe'),_0x137f49,_0x2911a0[_0x3687('0xb')][_0x3687('0xd')]);return _0xc58ed3(_0x2911a0['error']['message']);}else{logger[_0x3687('0xf')](_0x3687('0xe'),_0x137f49,_0x3687('0xa'));_0xc58ed3(_0x2911a0['result'][_0x3687('0xd')]);}})['catch'](function(_0x210f5d){logger[_0x3687('0xb')](_0x3687('0xe'),_0x137f49,_0x210f5d);_0x1f5394(_0x210f5d);});});} \ No newline at end of file +var _0xca96=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug'];(function(_0x413341,_0x27b394){var _0x2cc5df=function(_0x2323d9){while(--_0x2323d9){_0x413341['push'](_0x413341['shift']());}};_0x2cc5df(++_0x27b394);}(_0xca96,0x10f));var _0x6ca9=function(_0x88240e,_0x386334){_0x88240e=_0x88240e-0x0;var _0x293fcc=_0xca96[_0x88240e];return _0x293fcc;};'use strict';var _=require('lodash');var util=require(_0x6ca9('0x0'));var moment=require('moment');var BPromise=require(_0x6ca9('0x1'));var rs=require(_0x6ca9('0x2'));var fs=require('fs');var Redis=require(_0x6ca9('0x3'));var db=require(_0x6ca9('0x4'))['db'];var utils=require(_0x6ca9('0x5'));var logger=require('../../config/logger')(_0x6ca9('0x6'));var config=require(_0x6ca9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6ca9('0x8')][_0x6ca9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x83baf3,_0x1b595e,_0x79d698){return new BPromise(function(_0x3b8ab2,_0x588307){return client[_0x6ca9('0xa')](_0x83baf3,_0x79d698)[_0x6ca9('0xb')](function(_0x5a2d48){logger[_0x6ca9('0xc')](_0x6ca9('0xd'),_0x1b595e,'request\x20sent');logger[_0x6ca9('0xe')](_0x6ca9('0xf'),_0x1b595e,_0x6ca9('0x10'),JSON[_0x6ca9('0x11')](_0x5a2d48));if(_0x5a2d48[_0x6ca9('0x12')]){if(_0x5a2d48[_0x6ca9('0x12')][_0x6ca9('0x13')]===0x1f4){logger[_0x6ca9('0x12')](_0x6ca9('0xd'),_0x1b595e,_0x5a2d48[_0x6ca9('0x12')]['message']);return _0x588307(_0x5a2d48[_0x6ca9('0x12')][_0x6ca9('0x14')]);}logger[_0x6ca9('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1b595e,_0x5a2d48[_0x6ca9('0x12')]['message']);return _0x3b8ab2(_0x5a2d48[_0x6ca9('0x12')][_0x6ca9('0x14')]);}else{logger['info'](_0x6ca9('0xd'),_0x1b595e,_0x6ca9('0x10'));_0x3b8ab2(_0x5a2d48['result'][_0x6ca9('0x14')]);}})[_0x6ca9('0x15')](function(_0x57fde9){logger[_0x6ca9('0x12')](_0x6ca9('0xd'),_0x1b595e,_0x57fde9);_0x588307(_0x57fde9);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 8581b88..33cdc04 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 _0x2a09=['connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','util','path'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x2a09,0x1ae));var _0x92a0=function(_0x4c111a,_0x15980a){_0x4c111a=_0x4c111a-0x0;var _0xb54bb9=_0x2a09[_0x4c111a];return _0xb54bb9;};'use strict';var multer=require('multer');var util=require(_0x92a0('0x0'));var path=require(_0x92a0('0x1'));var timeout=require(_0x92a0('0x2'));var express=require(_0x92a0('0x3'));var router=express[_0x92a0('0x4')]();var fs_extra=require(_0x92a0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x92a0('0x6'));var controller=require(_0x92a0('0x7'));router[_0x92a0('0x8')]('/',auth[_0x92a0('0x9')](),controller[_0x92a0('0xa')]);router['get'](_0x92a0('0xb'),auth[_0x92a0('0x9')](),controller[_0x92a0('0xc')]);router[_0x92a0('0xd')]('/',auth['isAuthenticated'](),controller[_0x92a0('0xe')]);router[_0x92a0('0xf')](_0x92a0('0xb'),auth[_0x92a0('0x9')](),controller['update']);router[_0x92a0('0x10')]('/:id',auth[_0x92a0('0x9')](),controller['destroy']);module[_0x92a0('0x11')]=router; \ No newline at end of file +var _0x2472=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','/:id','show','post','create','put','delete','destroy','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2472,0x139));var _0x2247=function(_0x355350,_0x119e0c){_0x355350=_0x355350-0x0;var _0x5db5f4=_0x2472[_0x355350];return _0x5db5f4;};'use strict';var multer=require('multer');var util=require(_0x2247('0x0'));var path=require('path');var timeout=require(_0x2247('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2247('0x2'));var auth=require(_0x2247('0x3'));var interaction=require(_0x2247('0x4'));var config=require(_0x2247('0x5'));var controller=require(_0x2247('0x6'));router['get']('/',auth[_0x2247('0x7')](),controller['index']);router['get'](_0x2247('0x8'),auth[_0x2247('0x7')](),controller[_0x2247('0x9')]);router[_0x2247('0xa')]('/',auth[_0x2247('0x7')](),controller[_0x2247('0xb')]);router[_0x2247('0xc')](_0x2247('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x2247('0xd')](_0x2247('0x8'),auth[_0x2247('0x7')](),controller[_0x2247('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c482306..648f867 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 _0x014f=['variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string'];(function(_0x5b5ed9,_0x555c9e){var _0x179b2e=function(_0x1f32b8){while(--_0x1f32b8){_0x5b5ed9['push'](_0x5b5ed9['shift']());}};_0x179b2e(++_0x555c9e);}(_0x014f,0x1d3));var _0xf014=function(_0x19dae1,_0x24a8aa){_0x19dae1=_0x19dae1-0x0;var _0x45c880=_0x014f[_0x19dae1];return _0x45c880;};'use strict';var Sequelize=require(_0xf014('0x0'));module[_0xf014('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf014('0x2'),_0xf014('0x3'),'customVariable',_0xf014('0x4'),_0xf014('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf014('0x6')]},'keyType':{'type':Sequelize[_0xf014('0x7')](_0xf014('0x2'),_0xf014('0x3'),_0xf014('0x8'))},'keyContent':{'type':Sequelize[_0xf014('0x6')]},'idField':{'type':Sequelize[_0xf014('0x6')]},'nameField':{'type':Sequelize[_0xf014('0x6')]},'customField':{'type':Sequelize[_0xf014('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf014('0x6')]}}; \ No newline at end of file +var _0x7a05=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x7a05,0x19f));var _0x57a0=function(_0x4e94cb,_0x5a7d32){_0x4e94cb=_0x4e94cb-0x0;var _0x24a3c1=_0x7a05[_0x4e94cb];return _0x24a3c1;};'use strict';var Sequelize=require(_0x57a0('0x0'));module['exports']={'type':{'type':Sequelize[_0x57a0('0x1')](_0x57a0('0x2'),'variable',_0x57a0('0x3'),'keyValue',_0x57a0('0x4')),'defaultValue':_0x57a0('0x2')},'content':{'type':Sequelize[_0x57a0('0x5')]},'key':{'type':Sequelize[_0x57a0('0x5')]},'keyType':{'type':Sequelize[_0x57a0('0x1')](_0x57a0('0x2'),_0x57a0('0x6'),_0x57a0('0x3'))},'keyContent':{'type':Sequelize[_0x57a0('0x5')]},'idField':{'type':Sequelize[_0x57a0('0x5')]},'nameField':{'type':Sequelize[_0x57a0('0x5')]},'customField':{'type':Sequelize[_0x57a0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x57a0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c55ebab..e216dab 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 _0xdd8f=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','catch','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x480fc2,_0x482fba){var _0x540a95=function(_0x4b5a56){while(--_0x4b5a56){_0x480fc2['push'](_0x480fc2['shift']());}};_0x540a95(++_0x482fba);}(_0xdd8f,0x81));var _0xfdd8=function(_0x3ef103,_0x39eaf4){_0x3ef103=_0x3ef103-0x0;var _0x298c6d=_0xdd8f[_0x3ef103];return _0x298c6d;};'use strict';var emlformat=require(_0xfdd8('0x0'));var rimraf=require(_0xfdd8('0x1'));var zipdir=require(_0xfdd8('0x2'));var jsonpatch=require(_0xfdd8('0x3'));var rp=require(_0xfdd8('0x4'));var moment=require(_0xfdd8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfdd8('0x6'));var util=require(_0xfdd8('0x7'));var path=require(_0xfdd8('0x8'));var sox=require(_0xfdd8('0x9'));var csv=require(_0xfdd8('0xa'));var ejs=require(_0xfdd8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfdd8('0xc'));var crypto=require(_0xfdd8('0xd'));var jsforce=require(_0xfdd8('0xe'));var deskjs=require(_0xfdd8('0xf'));var toCsv=require(_0xfdd8('0xa'));var querystring=require(_0xfdd8('0x10'));var Papa=require(_0xfdd8('0x11'));var Redis=require(_0xfdd8('0x12'));var authService=require(_0xfdd8('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdd8('0x14'));var logger=require(_0xfdd8('0x15'))(_0xfdd8('0x16'));var utils=require(_0xfdd8('0x17'));var config=require(_0xfdd8('0x18'));var licenseUtil=require(_0xfdd8('0x19'));var db=require(_0xfdd8('0x1a'))['db'];function respondWithStatusCode(_0x124003,_0x46384c){_0x46384c=_0x46384c||0xcc;return function(_0x2b2f8a){if(_0x2b2f8a){return _0x124003[_0xfdd8('0x1b')](_0x46384c);}return _0x124003['status'](_0x46384c)[_0xfdd8('0x1c')]();};}function respondWithResult(_0x1f3f2e,_0x574aeb){_0x574aeb=_0x574aeb||0xc8;return function(_0x83df50){if(_0x83df50){return _0x1f3f2e[_0xfdd8('0x1d')](_0x574aeb)[_0xfdd8('0x1e')](_0x83df50);}};}function respondWithFilteredResult(_0x19134a,_0x4215e0){return function(_0x386b66){if(_0x386b66){var _0x1748c5=typeof _0x4215e0[_0xfdd8('0x1f')]==='undefined'&&typeof _0x4215e0[_0xfdd8('0x20')]===_0xfdd8('0x21');var _0x273246=_0x386b66['count'];var _0xd0fa2b=_0x1748c5?0x0:_0x4215e0[_0xfdd8('0x1f')];var _0xfabe19=_0x1748c5?_0x386b66[_0xfdd8('0x22')]:_0x4215e0[_0xfdd8('0x1f')]+_0x4215e0[_0xfdd8('0x20')];var _0x37c6fa;if(_0xfabe19>=_0x273246){_0xfabe19=_0x273246;_0x37c6fa=0xc8;}else{_0x37c6fa=0xce;}_0x19134a[_0xfdd8('0x1d')](_0x37c6fa);return _0x19134a[_0xfdd8('0x23')](_0xfdd8('0x24'),_0xd0fa2b+'-'+_0xfabe19+'/'+_0x273246)[_0xfdd8('0x1e')](_0x386b66);}return null;};}function patchUpdates(_0x57dd71){return function(_0x507d32){try{jsonpatch[_0xfdd8('0x25')](_0x507d32,_0x57dd71,!![]);}catch(_0x45fd0b){return BPromise['reject'](_0x45fd0b);}return _0x507d32[_0xfdd8('0x26')]();};}function saveUpdates(_0x461860,_0x3c3d0e){return function(_0x5583e5){if(_0x5583e5){return _0x5583e5[_0xfdd8('0x27')](_0x461860)[_0xfdd8('0x28')](function(_0x1e3a3b){return _0x1e3a3b;});}return null;};}function removeEntity(_0x439dc7,_0x2a4e88){return function(_0x46d5e4){if(_0x46d5e4){return _0x46d5e4[_0xfdd8('0x29')]()['then'](function(){_0x439dc7[_0xfdd8('0x1d')](0xcc)[_0xfdd8('0x1c')]();});}};}function handleEntityNotFound(_0x3c175b,_0x2ad2e2){return function(_0x23e7a5){if(!_0x23e7a5){_0x3c175b[_0xfdd8('0x1b')](0x194);}return _0x23e7a5;};}function handleError(_0x573a43,_0x3de12e){_0x3de12e=_0x3de12e||0x1f4;return function(_0x2cbbbf){logger[_0xfdd8('0x2a')](_0x2cbbbf[_0xfdd8('0x2b')]);if(_0x2cbbbf[_0xfdd8('0x2c')]){delete _0x2cbbbf['name'];}_0x573a43[_0xfdd8('0x1d')](_0x3de12e)['send'](_0x2cbbbf);};}exports[_0xfdd8('0x2d')]=function(_0x5added,_0x135a13){var _0xbe5cf0={},_0x907266={},_0x5b620d={'count':0x0,'rows':[]};var _0xd3edbd=_[_0xfdd8('0x2e')](db[_0xfdd8('0x2f')][_0xfdd8('0x30')],function(_0x3eb5aa){return{'name':_0x3eb5aa[_0xfdd8('0x31')],'type':_0x3eb5aa[_0xfdd8('0x32')][_0xfdd8('0x33')]};});_0x907266[_0xfdd8('0x34')]=_['map'](_0xd3edbd,_0xfdd8('0x2c'));_0x907266[_0xfdd8('0x35')]=_[_0xfdd8('0x36')](_0x5added[_0xfdd8('0x35')]);_0x907266[_0xfdd8('0x37')]=_[_0xfdd8('0x38')](_0x907266[_0xfdd8('0x34')],_0x907266[_0xfdd8('0x35')]);_0xbe5cf0[_0xfdd8('0x39')]=_['intersection'](_0x907266[_0xfdd8('0x34')],qs[_0xfdd8('0x3a')](_0x5added[_0xfdd8('0x35')][_0xfdd8('0x3a')]));_0xbe5cf0[_0xfdd8('0x39')]=_0xbe5cf0[_0xfdd8('0x39')][_0xfdd8('0x3b')]?_0xbe5cf0['attributes']:_0x907266[_0xfdd8('0x34')];if(!_0x5added[_0xfdd8('0x35')][_0xfdd8('0x3c')](_0xfdd8('0x3d'))){_0xbe5cf0[_0xfdd8('0x20')]=qs['limit'](_0x5added[_0xfdd8('0x35')][_0xfdd8('0x20')]);_0xbe5cf0[_0xfdd8('0x1f')]=qs[_0xfdd8('0x1f')](_0x5added[_0xfdd8('0x35')][_0xfdd8('0x1f')]);}_0xbe5cf0[_0xfdd8('0x3e')]=qs[_0xfdd8('0x3f')](_0x5added[_0xfdd8('0x35')][_0xfdd8('0x3f')]);_0xbe5cf0['where']=qs['filters'](_[_0xfdd8('0x40')](_0x5added['query'],_0x907266['filters']),_0xd3edbd);if(_0x5added[_0xfdd8('0x35')][_0xfdd8('0x41')]){_0xbe5cf0[_0xfdd8('0x42')]=_['merge'](_0xbe5cf0[_0xfdd8('0x42')],{'$or':_[_0xfdd8('0x2e')](_0xd3edbd,function(_0x354006){if(_0x354006[_0xfdd8('0x32')]!==_0xfdd8('0x43')){var _0x58e705={};_0x58e705[_0x354006['name']]={'$like':'%'+_0x5added[_0xfdd8('0x35')][_0xfdd8('0x41')]+'%'};return _0x58e705;}})});}_0xbe5cf0=_['merge']({},_0xbe5cf0,_0x5added[_0xfdd8('0x44')]);var _0x5dd703={'where':_0xbe5cf0[_0xfdd8('0x42')]};return db['ServicenowField'][_0xfdd8('0x22')](_0x5dd703)[_0xfdd8('0x28')](function(_0x41eb93){_0x5b620d[_0xfdd8('0x22')]=_0x41eb93;if(_0x5added[_0xfdd8('0x35')][_0xfdd8('0x45')]){_0xbe5cf0[_0xfdd8('0x46')]=[{'all':!![]}];}return db[_0xfdd8('0x2f')]['findAll'](_0xbe5cf0);})[_0xfdd8('0x28')](function(_0x239a1d){_0x5b620d['rows']=_0x239a1d;return _0x5b620d;})[_0xfdd8('0x28')](respondWithFilteredResult(_0x135a13,_0xbe5cf0))[_0xfdd8('0x47')](handleError(_0x135a13,null));};exports['show']=function(_0x3361bd,_0x574376){var _0x160f2c={'raw':!![],'where':{'id':_0x3361bd[_0xfdd8('0x48')]['id']}},_0x2b293c={};_0x2b293c[_0xfdd8('0x34')]=_[_0xfdd8('0x36')](db[_0xfdd8('0x2f')][_0xfdd8('0x30')]);_0x2b293c['query']=_[_0xfdd8('0x36')](_0x3361bd[_0xfdd8('0x35')]);_0x2b293c[_0xfdd8('0x37')]=_[_0xfdd8('0x38')](_0x2b293c['model'],_0x2b293c[_0xfdd8('0x35')]);_0x160f2c[_0xfdd8('0x39')]=_[_0xfdd8('0x38')](_0x2b293c['model'],qs[_0xfdd8('0x3a')](_0x3361bd[_0xfdd8('0x35')][_0xfdd8('0x3a')]));_0x160f2c[_0xfdd8('0x39')]=_0x160f2c[_0xfdd8('0x39')][_0xfdd8('0x3b')]?_0x160f2c['attributes']:_0x2b293c[_0xfdd8('0x34')];if(_0x3361bd[_0xfdd8('0x35')][_0xfdd8('0x45')]){_0x160f2c[_0xfdd8('0x46')]=[{'all':!![]}];}_0x160f2c=_[_0xfdd8('0x49')]({},_0x160f2c,_0x3361bd[_0xfdd8('0x44')]);return db[_0xfdd8('0x2f')][_0xfdd8('0x4a')](_0x160f2c)[_0xfdd8('0x28')](handleEntityNotFound(_0x574376,null))[_0xfdd8('0x28')](respondWithResult(_0x574376,null))[_0xfdd8('0x47')](handleError(_0x574376,null));};exports['create']=function(_0x5a3d99,_0x555883){return db[_0xfdd8('0x2f')][_0xfdd8('0x4b')](_0x5a3d99[_0xfdd8('0x4c')],{})['then'](respondWithResult(_0x555883,0xc9))[_0xfdd8('0x47')](handleError(_0x555883,null));};exports[_0xfdd8('0x27')]=function(_0x17ab23,_0x1dd3e3){if(_0x17ab23[_0xfdd8('0x4c')]['id']){delete _0x17ab23[_0xfdd8('0x4c')]['id'];}return db[_0xfdd8('0x2f')][_0xfdd8('0x4a')]({'where':{'id':_0x17ab23[_0xfdd8('0x48')]['id']}})[_0xfdd8('0x28')](handleEntityNotFound(_0x1dd3e3,null))[_0xfdd8('0x28')](saveUpdates(_0x17ab23[_0xfdd8('0x4c')],null))[_0xfdd8('0x28')](respondWithResult(_0x1dd3e3,null))[_0xfdd8('0x47')](handleError(_0x1dd3e3,null));};exports['destroy']=function(_0x5eb57c,_0x2e1c56){return db[_0xfdd8('0x2f')][_0xfdd8('0x4a')]({'where':{'id':_0x5eb57c[_0xfdd8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e1c56,null))[_0xfdd8('0x28')](removeEntity(_0x2e1c56,null))[_0xfdd8('0x47')](handleError(_0x2e1c56,null));}; \ No newline at end of file +var _0x5134=['sort','where','filter','merge','VIRTUAL','options','include','findAll','params','intersection','includeAll','find','catch','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x5134,0x163));var _0x4513=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x5134[_0x31c19c];return _0x1a87f7;};'use strict';var emlformat=require(_0x4513('0x0'));var rimraf=require(_0x4513('0x1'));var zipdir=require(_0x4513('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4513('0x3'));var BPromise=require(_0x4513('0x4'));var Mustache=require(_0x4513('0x5'));var util=require(_0x4513('0x6'));var path=require(_0x4513('0x7'));var sox=require(_0x4513('0x8'));var csv=require(_0x4513('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4513('0xa'));var _=require('lodash');var squel=require(_0x4513('0xb'));var crypto=require('crypto');var jsforce=require(_0x4513('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4513('0x9'));var querystring=require(_0x4513('0xd'));var Papa=require('papaparse');var Redis=require(_0x4513('0xe'));var authService=require(_0x4513('0xf'));var qs=require(_0x4513('0x10'));var as=require(_0x4513('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4513('0x12'));var utils=require('../../config/utils');var config=require(_0x4513('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4513('0x14'))['db'];function respondWithStatusCode(_0x2cc3ad,_0x4f158b){_0x4f158b=_0x4f158b||0xcc;return function(_0x4f1159){if(_0x4f1159){return _0x2cc3ad['sendStatus'](_0x4f158b);}return _0x2cc3ad[_0x4513('0x15')](_0x4f158b)[_0x4513('0x16')]();};}function respondWithResult(_0x3da21c,_0xa29ba0){_0xa29ba0=_0xa29ba0||0xc8;return function(_0x2cf3b7){if(_0x2cf3b7){return _0x3da21c['status'](_0xa29ba0)[_0x4513('0x17')](_0x2cf3b7);}};}function respondWithFilteredResult(_0x1d2d71,_0x1bdb89){return function(_0x2321e4){if(_0x2321e4){var _0x6ba863=typeof _0x1bdb89[_0x4513('0x18')]===_0x4513('0x19')&&typeof _0x1bdb89[_0x4513('0x1a')]===_0x4513('0x19');var _0x30351d=_0x2321e4[_0x4513('0x1b')];var _0x23fa75=_0x6ba863?0x0:_0x1bdb89[_0x4513('0x18')];var _0x1427e9=_0x6ba863?_0x2321e4[_0x4513('0x1b')]:_0x1bdb89[_0x4513('0x18')]+_0x1bdb89['limit'];var _0x74f47e;if(_0x1427e9>=_0x30351d){_0x1427e9=_0x30351d;_0x74f47e=0xc8;}else{_0x74f47e=0xce;}_0x1d2d71[_0x4513('0x15')](_0x74f47e);return _0x1d2d71[_0x4513('0x1c')](_0x4513('0x1d'),_0x23fa75+'-'+_0x1427e9+'/'+_0x30351d)[_0x4513('0x17')](_0x2321e4);}return null;};}function patchUpdates(_0x156f37){return function(_0x51e310){try{jsonpatch['apply'](_0x51e310,_0x156f37,!![]);}catch(_0x5558ae){return BPromise['reject'](_0x5558ae);}return _0x51e310[_0x4513('0x1e')]();};}function saveUpdates(_0x356e9b,_0x58bf0a){return function(_0x2b9657){if(_0x2b9657){return _0x2b9657[_0x4513('0x1f')](_0x356e9b)[_0x4513('0x20')](function(_0x391b47){return _0x391b47;});}return null;};}function removeEntity(_0x281749,_0x30f373){return function(_0x2f9266){if(_0x2f9266){return _0x2f9266['destroy']()[_0x4513('0x20')](function(){_0x281749[_0x4513('0x15')](0xcc)[_0x4513('0x16')]();});}};}function handleEntityNotFound(_0x14fc36,_0x6cc6b4){return function(_0x340ee9){if(!_0x340ee9){_0x14fc36[_0x4513('0x21')](0x194);}return _0x340ee9;};}function handleError(_0x286715,_0x4e876e){_0x4e876e=_0x4e876e||0x1f4;return function(_0x2b5116){logger[_0x4513('0x22')](_0x2b5116[_0x4513('0x23')]);if(_0x2b5116[_0x4513('0x24')]){delete _0x2b5116[_0x4513('0x24')];}_0x286715[_0x4513('0x15')](_0x4e876e)['send'](_0x2b5116);};}exports[_0x4513('0x25')]=function(_0x1cc5be,_0x2c9d32){var _0x47d660={},_0x519657={},_0x514cff={'count':0x0,'rows':[]};var _0x2beee1=_[_0x4513('0x26')](db[_0x4513('0x27')][_0x4513('0x28')],function(_0x44bb5a){return{'name':_0x44bb5a[_0x4513('0x29')],'type':_0x44bb5a[_0x4513('0x2a')][_0x4513('0x2b')]};});_0x519657['model']=_[_0x4513('0x26')](_0x2beee1,'name');_0x519657[_0x4513('0x2c')]=_[_0x4513('0x2d')](_0x1cc5be['query']);_0x519657[_0x4513('0x2e')]=_['intersection'](_0x519657[_0x4513('0x2f')],_0x519657[_0x4513('0x2c')]);_0x47d660[_0x4513('0x30')]=_['intersection'](_0x519657[_0x4513('0x2f')],qs[_0x4513('0x31')](_0x1cc5be[_0x4513('0x2c')][_0x4513('0x31')]));_0x47d660[_0x4513('0x30')]=_0x47d660[_0x4513('0x30')][_0x4513('0x32')]?_0x47d660[_0x4513('0x30')]:_0x519657[_0x4513('0x2f')];if(!_0x1cc5be[_0x4513('0x2c')][_0x4513('0x33')](_0x4513('0x34'))){_0x47d660[_0x4513('0x1a')]=qs['limit'](_0x1cc5be[_0x4513('0x2c')]['limit']);_0x47d660[_0x4513('0x18')]=qs['offset'](_0x1cc5be[_0x4513('0x2c')][_0x4513('0x18')]);}_0x47d660['order']=qs[_0x4513('0x35')](_0x1cc5be[_0x4513('0x2c')][_0x4513('0x35')]);_0x47d660[_0x4513('0x36')]=qs[_0x4513('0x2e')](_['pick'](_0x1cc5be[_0x4513('0x2c')],_0x519657[_0x4513('0x2e')]),_0x2beee1);if(_0x1cc5be[_0x4513('0x2c')][_0x4513('0x37')]){_0x47d660[_0x4513('0x36')]=_[_0x4513('0x38')](_0x47d660[_0x4513('0x36')],{'$or':_[_0x4513('0x26')](_0x2beee1,function(_0x52a980){if(_0x52a980['type']!==_0x4513('0x39')){var _0x633fad={};_0x633fad[_0x52a980['name']]={'$like':'%'+_0x1cc5be[_0x4513('0x2c')][_0x4513('0x37')]+'%'};return _0x633fad;}})});}_0x47d660=_['merge']({},_0x47d660,_0x1cc5be[_0x4513('0x3a')]);var _0x3834a0={'where':_0x47d660['where']};return db['ServicenowField'][_0x4513('0x1b')](_0x3834a0)['then'](function(_0x3823f8){_0x514cff[_0x4513('0x1b')]=_0x3823f8;if(_0x1cc5be[_0x4513('0x2c')]['includeAll']){_0x47d660[_0x4513('0x3b')]=[{'all':!![]}];}return db[_0x4513('0x27')][_0x4513('0x3c')](_0x47d660);})['then'](function(_0x4f21ae){_0x514cff['rows']=_0x4f21ae;return _0x514cff;})[_0x4513('0x20')](respondWithFilteredResult(_0x2c9d32,_0x47d660))['catch'](handleError(_0x2c9d32,null));};exports['show']=function(_0x4a3717,_0xaddb14){var _0x17fb9b={'raw':!![],'where':{'id':_0x4a3717[_0x4513('0x3d')]['id']}},_0x1634b0={};_0x1634b0['model']=_[_0x4513('0x2d')](db['ServicenowField'][_0x4513('0x28')]);_0x1634b0[_0x4513('0x2c')]=_[_0x4513('0x2d')](_0x4a3717[_0x4513('0x2c')]);_0x1634b0[_0x4513('0x2e')]=_[_0x4513('0x3e')](_0x1634b0['model'],_0x1634b0[_0x4513('0x2c')]);_0x17fb9b[_0x4513('0x30')]=_[_0x4513('0x3e')](_0x1634b0['model'],qs[_0x4513('0x31')](_0x4a3717[_0x4513('0x2c')]['fields']));_0x17fb9b['attributes']=_0x17fb9b['attributes'][_0x4513('0x32')]?_0x17fb9b[_0x4513('0x30')]:_0x1634b0[_0x4513('0x2f')];if(_0x4a3717[_0x4513('0x2c')][_0x4513('0x3f')]){_0x17fb9b[_0x4513('0x3b')]=[{'all':!![]}];}_0x17fb9b=_[_0x4513('0x38')]({},_0x17fb9b,_0x4a3717[_0x4513('0x3a')]);return db[_0x4513('0x27')][_0x4513('0x40')](_0x17fb9b)[_0x4513('0x20')](handleEntityNotFound(_0xaddb14,null))['then'](respondWithResult(_0xaddb14,null))[_0x4513('0x41')](handleError(_0xaddb14,null));};exports['create']=function(_0x26cbf9,_0x1090ba){return db[_0x4513('0x27')]['create'](_0x26cbf9[_0x4513('0x42')],{})[_0x4513('0x20')](respondWithResult(_0x1090ba,0xc9))['catch'](handleError(_0x1090ba,null));};exports[_0x4513('0x1f')]=function(_0x2a8bea,_0x25daef){if(_0x2a8bea[_0x4513('0x42')]['id']){delete _0x2a8bea['body']['id'];}return db[_0x4513('0x27')][_0x4513('0x40')]({'where':{'id':_0x2a8bea[_0x4513('0x3d')]['id']}})[_0x4513('0x20')](handleEntityNotFound(_0x25daef,null))['then'](saveUpdates(_0x2a8bea[_0x4513('0x42')],null))[_0x4513('0x20')](respondWithResult(_0x25daef,null))['catch'](handleError(_0x25daef,null));};exports[_0x4513('0x43')]=function(_0x55fabc,_0x58d433){return db[_0x4513('0x27')][_0x4513('0x40')]({'where':{'id':_0x55fabc['params']['id']}})['then'](handleEntityNotFound(_0x58d433,null))[_0x4513('0x20')](removeEntity(_0x58d433,null))[_0x4513('0x41')](handleError(_0x58d433,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index af473c6..a62642b 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 _0x52ba=['api','request-promise','path','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x52ba,0x14f));var _0xa52b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x52ba[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xa52b('0x0'));var util=require(_0xa52b('0x1'));var logger=require(_0xa52b('0x2'))(_0xa52b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa52b('0x4'));var fs=require('fs');var path=require(_0xa52b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa52b('0x6'));module[_0xa52b('0x7')]=function(_0x6387c7,_0x3bbc99){return _0x6387c7[_0xa52b('0x8')]('ServicenowField',attributes,{'tableName':_0xa52b('0x9'),'paranoid':![],'indexes':[{'name':_0xa52b('0xa'),'fields':[_0xa52b('0xb'),_0xa52b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a2b=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','../../config/logger'];(function(_0x549cfe,_0x33ab70){var _0x30993d=function(_0x15eb67){while(--_0x15eb67){_0x549cfe['push'](_0x549cfe['shift']());}};_0x30993d(++_0x33ab70);}(_0x1a2b,0x11b));var _0xb1a2=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x1a2b[_0x102e37];return _0x35a07c;};'use strict';var _=require('lodash');var util=require(_0xb1a2('0x0'));var logger=require(_0xb1a2('0x1'))(_0xb1a2('0x2'));var moment=require(_0xb1a2('0x3'));var BPromise=require(_0xb1a2('0x4'));var rp=require(_0xb1a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1a2('0x6'));var config=require(_0xb1a2('0x7'));var attributes=require(_0xb1a2('0x8'));module[_0xb1a2('0x9')]=function(_0x4be9f4,_0x5c4409){return _0x4be9f4[_0xb1a2('0xa')](_0xb1a2('0xb'),attributes,{'tableName':_0xb1a2('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xb1a2('0xd'),_0xb1a2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 7cedb66..732f87a 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 _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(_0x404c55,_0x531224){var _0x5f187f=function(_0x573fce){while(--_0x573fce){_0x404c55['push'](_0x404c55['shift']());}};_0x5f187f(++_0x531224);}(_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 +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x517d8b,_0x574a6c){var _0x58b4ca=function(_0x2d0392){while(--_0x2d0392){_0x517d8b['push'](_0x517d8b['shift']());}};_0x58b4ca(++_0x574a6c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x567c4b,_0xa08fcc){_0x567c4b=_0x567c4b-0x0;var _0x237f64=_0xb43b[_0x567c4b];return _0x237f64;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ca303a5..1101a05 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x13c59b,_0x1bfd15){var _0x126d0e=function(_0x548659){while(--_0x548659){_0x13c59b['push'](_0x13c59b['shift']());}};_0x126d0e(++_0x1bfd15);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1006c3,_0x37f590){var _0x588071=function(_0x309be1){while(--_0x309be1){_0x1006c3['push'](_0x1006c3['shift']());}};_0x588071(++_0x37f590);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3f729f0..4f01723 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(_0x27ec06,_0x2ae1a1){var _0x32a51f=function(_0x24f8db){while(--_0x24f8db){_0x27ec06['push'](_0x27ec06['shift']());}};_0x32a51f(++_0x2ae1a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x1a7f72,_0x34dcd1){var _0x1974e6=function(_0x59d989){while(--_0x59d989){_0x1a7f72['push'](_0x1a7f72['shift']());}};_0x1974e6(++_0x34dcd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 3323552..745d794 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 _0x1651=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','find','create','body','SugarcrmConfiguration','filter','options','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x1651,0x1c0));var _0x1165=function(_0x330e48,_0x31587d){_0x330e48=_0x330e48-0x0;var _0xc51463=_0x1651[_0x330e48];return _0xc51463;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1165('0x0'));var rp=require(_0x1165('0x1'));var moment=require(_0x1165('0x2'));var BPromise=require(_0x1165('0x3'));var Mustache=require('mustache');var util=require(_0x1165('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x1165('0x5'));var ejs=require(_0x1165('0x6'));var fs=require('fs');var fs_extra=require(_0x1165('0x7'));var _=require(_0x1165('0x8'));var squel=require(_0x1165('0x9'));var crypto=require(_0x1165('0xa'));var jsforce=require(_0x1165('0xb'));var deskjs=require(_0x1165('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1165('0xd'));var Redis=require(_0x1165('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1165('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1165('0x10'));var logger=require('../../config/logger')(_0x1165('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1165('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x546ae5,_0x5d4e80){_0x5d4e80=_0x5d4e80||0xcc;return function(_0x18527e){if(_0x18527e){return _0x546ae5[_0x1165('0x13')](_0x5d4e80);}return _0x546ae5[_0x1165('0x14')](_0x5d4e80)[_0x1165('0x15')]();};}function respondWithResult(_0x3acf5b,_0x3fbaa3){_0x3fbaa3=_0x3fbaa3||0xc8;return function(_0x4336a7){if(_0x4336a7){return _0x3acf5b['status'](_0x3fbaa3)[_0x1165('0x16')](_0x4336a7);}};}function respondWithFilteredResult(_0x121273,_0x35f3aa){return function(_0x3d61b7){if(_0x3d61b7){var _0x494984=typeof _0x35f3aa[_0x1165('0x17')]===_0x1165('0x18')&&typeof _0x35f3aa[_0x1165('0x19')]===_0x1165('0x18');var _0x364f18=_0x3d61b7[_0x1165('0x1a')];var _0x1e108b=_0x494984?0x0:_0x35f3aa[_0x1165('0x17')];var _0xdca3c1=_0x494984?_0x3d61b7[_0x1165('0x1a')]:_0x35f3aa[_0x1165('0x17')]+_0x35f3aa[_0x1165('0x19')];var _0x283ec1;if(_0xdca3c1>=_0x364f18){_0xdca3c1=_0x364f18;_0x283ec1=0xc8;}else{_0x283ec1=0xce;}_0x121273[_0x1165('0x14')](_0x283ec1);return _0x121273['set']('Content-Range',_0x1e108b+'-'+_0xdca3c1+'/'+_0x364f18)[_0x1165('0x16')](_0x3d61b7);}return null;};}function patchUpdates(_0x83e2ab){return function(_0x51c763){try{jsonpatch[_0x1165('0x1b')](_0x51c763,_0x83e2ab,!![]);}catch(_0x344e6d){return BPromise[_0x1165('0x1c')](_0x344e6d);}return _0x51c763[_0x1165('0x1d')]();};}function saveUpdates(_0x21e129,_0x4eccd2){return function(_0x2d13b7){if(_0x2d13b7){return _0x2d13b7[_0x1165('0x1e')](_0x21e129)[_0x1165('0x1f')](function(_0x34837e){return _0x34837e;});}return null;};}function removeEntity(_0x24a320,_0x418c51){return function(_0x57db8a){if(_0x57db8a){return _0x57db8a[_0x1165('0x20')]()[_0x1165('0x1f')](function(){_0x24a320[_0x1165('0x14')](0xcc)[_0x1165('0x15')]();});}};}function handleEntityNotFound(_0x52a030,_0x3c5ef1){return function(_0x1bae07){if(!_0x1bae07){_0x52a030['sendStatus'](0x194);}return _0x1bae07;};}function handleError(_0xfa0a42,_0x93891b){_0x93891b=_0x93891b||0x1f4;return function(_0x5207db){logger[_0x1165('0x21')](_0x5207db[_0x1165('0x22')]);if(_0x5207db['name']){delete _0x5207db['name'];}_0xfa0a42['status'](_0x93891b)[_0x1165('0x23')](_0x5207db);};}exports[_0x1165('0x24')]=function(_0x42bfee,_0x3de1ed){var _0x39505b={},_0x2660cb={},_0x1c615a={'count':0x0,'rows':[]};var _0x128eb4=_[_0x1165('0x25')](db[_0x1165('0x26')][_0x1165('0x27')],function(_0x220c7a){return{'name':_0x220c7a[_0x1165('0x28')],'type':_0x220c7a[_0x1165('0x29')][_0x1165('0x2a')]};});_0x2660cb['model']=_[_0x1165('0x25')](_0x128eb4,_0x1165('0x2b'));_0x2660cb[_0x1165('0x2c')]=_[_0x1165('0x2d')](_0x42bfee[_0x1165('0x2c')]);_0x2660cb[_0x1165('0x2e')]=_[_0x1165('0x2f')](_0x2660cb[_0x1165('0x30')],_0x2660cb[_0x1165('0x2c')]);_0x39505b[_0x1165('0x31')]=_[_0x1165('0x2f')](_0x2660cb['model'],qs[_0x1165('0x32')](_0x42bfee[_0x1165('0x2c')]['fields']));_0x39505b[_0x1165('0x31')]=_0x39505b[_0x1165('0x31')][_0x1165('0x33')]?_0x39505b['attributes']:_0x2660cb['model'];if(!_0x42bfee[_0x1165('0x2c')][_0x1165('0x34')](_0x1165('0x35'))){_0x39505b[_0x1165('0x19')]=qs[_0x1165('0x19')](_0x42bfee[_0x1165('0x2c')][_0x1165('0x19')]);_0x39505b[_0x1165('0x17')]=qs[_0x1165('0x17')](_0x42bfee[_0x1165('0x2c')]['offset']);}_0x39505b[_0x1165('0x36')]=qs['sort'](_0x42bfee[_0x1165('0x2c')][_0x1165('0x37')]);_0x39505b['where']=qs[_0x1165('0x2e')](_[_0x1165('0x38')](_0x42bfee['query'],_0x2660cb[_0x1165('0x2e')]),_0x128eb4);if(_0x42bfee[_0x1165('0x2c')]['filter']){_0x39505b['where']=_[_0x1165('0x39')](_0x39505b[_0x1165('0x3a')],{'$or':_[_0x1165('0x25')](_0x128eb4,function(_0x501dc6){if(_0x501dc6[_0x1165('0x29')]!==_0x1165('0x3b')){var _0x2e3b14={};_0x2e3b14[_0x501dc6[_0x1165('0x2b')]]={'$like':'%'+_0x42bfee[_0x1165('0x2c')]['filter']+'%'};return _0x2e3b14;}})});}_0x39505b=_[_0x1165('0x39')]({},_0x39505b,_0x42bfee['options']);var _0x1842d6={'where':_0x39505b['where']};return db[_0x1165('0x26')][_0x1165('0x1a')](_0x1842d6)[_0x1165('0x1f')](function(_0x5536e6){_0x1c615a[_0x1165('0x1a')]=_0x5536e6;if(_0x42bfee[_0x1165('0x2c')]['includeAll']){_0x39505b[_0x1165('0x3c')]=[{'all':!![]}];}return db[_0x1165('0x26')][_0x1165('0x3d')](_0x39505b);})['then'](function(_0x5cf161){_0x1c615a[_0x1165('0x3e')]=_0x5cf161;return _0x1c615a;})[_0x1165('0x1f')](respondWithFilteredResult(_0x3de1ed,_0x39505b))[_0x1165('0x3f')](handleError(_0x3de1ed,null));};exports[_0x1165('0x40')]=function(_0x11664f,_0x509bd5){var _0x478d20={'raw':![],'where':{'id':_0x11664f[_0x1165('0x41')]['id']}},_0x10a140={};_0x10a140[_0x1165('0x30')]=_['keys'](db['SugarcrmAccount'][_0x1165('0x27')]);_0x10a140[_0x1165('0x2c')]=_['keys'](_0x11664f[_0x1165('0x2c')]);_0x10a140[_0x1165('0x2e')]=_['intersection'](_0x10a140[_0x1165('0x30')],_0x10a140['query']);_0x478d20[_0x1165('0x31')]=_[_0x1165('0x2f')](_0x10a140[_0x1165('0x30')],qs[_0x1165('0x32')](_0x11664f[_0x1165('0x2c')][_0x1165('0x32')]));_0x478d20[_0x1165('0x31')]=_0x478d20[_0x1165('0x31')][_0x1165('0x33')]?_0x478d20['attributes']:_0x10a140[_0x1165('0x30')];if(_0x11664f[_0x1165('0x2c')]['includeAll']){_0x478d20[_0x1165('0x3c')]=[{'all':!![]}];}_0x478d20=_[_0x1165('0x39')]({},_0x478d20,_0x11664f['options']);return db['SugarcrmAccount'][_0x1165('0x42')](_0x478d20)[_0x1165('0x1f')](handleEntityNotFound(_0x509bd5,null))['then'](respondWithResult(_0x509bd5,null))[_0x1165('0x3f')](handleError(_0x509bd5,null));};exports['create']=function(_0x98492,_0x376cad){return db[_0x1165('0x26')][_0x1165('0x43')](_0x98492[_0x1165('0x44')],{})[_0x1165('0x1f')](respondWithResult(_0x376cad,0xc9))['catch'](handleError(_0x376cad,null));};exports[_0x1165('0x1e')]=function(_0x324934,_0x1d517b){if(_0x324934[_0x1165('0x44')]['id']){delete _0x324934[_0x1165('0x44')]['id'];}return db[_0x1165('0x26')][_0x1165('0x42')]({'where':{'id':_0x324934[_0x1165('0x41')]['id']}})[_0x1165('0x1f')](handleEntityNotFound(_0x1d517b,null))[_0x1165('0x1f')](saveUpdates(_0x324934['body'],null))['then'](respondWithResult(_0x1d517b,null))['catch'](handleError(_0x1d517b,null));};exports['destroy']=function(_0x45e8e8,_0x5b2b4d){return db[_0x1165('0x26')][_0x1165('0x42')]({'where':{'id':_0x45e8e8[_0x1165('0x41')]['id']}})[_0x1165('0x1f')](handleEntityNotFound(_0x5b2b4d,null))[_0x1165('0x1f')](removeEntity(_0x5b2b4d,null))[_0x1165('0x3f')](handleError(_0x5b2b4d,null));};exports['getConfigurations']=function(_0x1103ff,_0x5e8f7c,_0x1bd889){var _0x3353bc={};var _0x2b34b1={};var _0x2b8802;var _0x13cf93;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1103ff[_0x1165('0x41')]['id']}})[_0x1165('0x1f')](handleEntityNotFound(_0x5e8f7c,null))[_0x1165('0x1f')](function(_0x37a625){if(_0x37a625){_0x2b8802=_0x37a625;_0x2b34b1['model']=_[_0x1165('0x2d')](db[_0x1165('0x45')][_0x1165('0x27')]);_0x2b34b1['query']=_[_0x1165('0x2d')](_0x1103ff['query']);_0x2b34b1[_0x1165('0x2e')]=_[_0x1165('0x2f')](_0x2b34b1[_0x1165('0x30')],_0x2b34b1['query']);_0x3353bc['attributes']=_[_0x1165('0x2f')](_0x2b34b1['model'],qs[_0x1165('0x32')](_0x1103ff['query'][_0x1165('0x32')]));_0x3353bc['attributes']=_0x3353bc[_0x1165('0x31')][_0x1165('0x33')]?_0x3353bc[_0x1165('0x31')]:_0x2b34b1['model'];_0x3353bc[_0x1165('0x36')]=qs[_0x1165('0x37')](_0x1103ff[_0x1165('0x2c')][_0x1165('0x37')]);_0x3353bc[_0x1165('0x3a')]=qs['filters'](_[_0x1165('0x38')](_0x1103ff[_0x1165('0x2c')],_0x2b34b1[_0x1165('0x2e')]));if(_0x1103ff[_0x1165('0x2c')]['filter']){_0x3353bc[_0x1165('0x3a')]=_[_0x1165('0x39')](_0x3353bc[_0x1165('0x3a')],{'$or':_[_0x1165('0x25')](_0x3353bc[_0x1165('0x31')],function(_0x480e29){var _0xb0d5e9={};_0xb0d5e9[_0x480e29]={'$like':'%'+_0x1103ff[_0x1165('0x2c')][_0x1165('0x46')]+'%'};return _0xb0d5e9;})});}_0x3353bc=_[_0x1165('0x39')]({},_0x3353bc,_0x1103ff[_0x1165('0x47')]);return _0x2b8802['getConfigurations'](_0x3353bc);}})[_0x1165('0x1f')](function(_0x404f42){if(_0x404f42){_0x13cf93=_0x404f42[_0x1165('0x33')];if(!_0x1103ff[_0x1165('0x2c')][_0x1165('0x34')](_0x1165('0x35'))){_0x3353bc[_0x1165('0x19')]=qs[_0x1165('0x19')](_0x1103ff[_0x1165('0x2c')]['limit']);_0x3353bc[_0x1165('0x17')]=qs['offset'](_0x1103ff[_0x1165('0x2c')][_0x1165('0x17')]);}return _0x2b8802[_0x1165('0x48')](_0x3353bc);}})[_0x1165('0x1f')](function(_0x5f4f68){if(_0x5f4f68){return _0x5f4f68?{'count':_0x13cf93,'rows':_0x5f4f68}:null;}})[_0x1165('0x1f')](respondWithResult(_0x5e8f7c,null))[_0x1165('0x3f')](handleError(_0x5e8f7c,null));};exports[_0x1165('0x49')]=function(_0x320c0c,_0x396f38,_0x149bf8){if(_0x320c0c['body']['id']){delete _0x320c0c['body']['id'];}return db[_0x1165('0x26')][_0x1165('0x4a')]({'where':{'id':_0x320c0c[_0x1165('0x41')]['id']}})[_0x1165('0x1f')](handleEntityNotFound(_0x396f38,null))['then'](function(_0x3d5ccb){if(_0x3d5ccb){_0x320c0c['body'][_0x1165('0x4b')]=_0x3d5ccb['id'];_0x320c0c[_0x1165('0x44')][_0x1165('0x4c')]=integrations['getSubjects'](_0x320c0c['body'][_0x1165('0x4d')],_0x320c0c[_0x1165('0x44')][_0x1165('0x29')]);_0x320c0c[_0x1165('0x44')][_0x1165('0x4e')]=integrations[_0x1165('0x4f')](_0x320c0c[_0x1165('0x44')][_0x1165('0x4d')],_0x320c0c[_0x1165('0x44')]['type']);return db['SugarcrmConfiguration'][_0x1165('0x43')](_0x320c0c['body'],{'include':[{'model':db[_0x1165('0x50')],'as':'Subjects'},{'model':db[_0x1165('0x50')],'as':_0x1165('0x4e')}]});}return null;})['then'](respondWithResult(_0x396f38,null))['catch'](handleError(_0x396f38,null));};exports[_0x1165('0x51')]=function(_0x5d710b,_0xfee233,_0x7c4b25){var _0x260ed6='';var _0x2523d6=['id',_0x1165('0x2b'),_0x1165('0x52'),_0x1165('0x53'),'description','date_start','duration_hours',_0x1165('0x54'),_0x1165('0x55'),'parent_type',_0x1165('0x56'),_0x1165('0x57')];return db[_0x1165('0x26')][_0x1165('0x4a')]({'where':{'id':_0x5d710b[_0x1165('0x41')]['id']},'attributes':['id',_0x1165('0x58'),_0x1165('0x59'),_0x1165('0x5a')]})[_0x1165('0x1f')](handleEntityNotFound(_0xfee233,null))[_0x1165('0x1f')](function(_0xc593c2){if(_0xc593c2){_0x260ed6=_0xc593c2[_0x1165('0x5a')];var _0x171187=_0x260ed6[_0x1165('0x5b')](-0x1);if(_0x171187==='/'){_0x260ed6=_0x260ed6[_0x1165('0x5c')](0x0,_0x260ed6[_0x1165('0x5d')](_0x171187));}return rp({'method':_0x1165('0x5e'),'uri':util[_0x1165('0x5f')](_0x1165('0x60'),_0x260ed6,_0x1165('0x61')),'json':!![],'form':{'method':_0x1165('0x62'),'input_type':_0x1165('0x63'),'response_type':_0x1165('0x63'),'rest_data':JSON[_0x1165('0x64')]({'user_auth':{'user_name':_0xc593c2[_0x1165('0x58')],'password':_0xc593c2[_0x1165('0x59')],'encryption':_0x1165('0x65')},'application':_0x1165('0x66')})}});}})['then'](function(_0x16487c){if(_0x16487c&&_0x16487c[_0x1165('0x2b')]!==_0x1165('0x67')&&_0x16487c[_0x1165('0x2b')]!=='Password\x20Expired'){return rp({'method':_0x1165('0x5e'),'uri':util[_0x1165('0x5f')](_0x1165('0x60'),_0x260ed6,_0x1165('0x61')),'json':!![],'form':{'method':_0x1165('0x68'),'input_type':_0x1165('0x63'),'response_type':'JSON','rest_data':JSON[_0x1165('0x64')]({'session':_0x16487c['id'],'module_name':_0x1165('0x69')})}})[_0x1165('0x1f')](function(_0x20cbb4){if(_0x20cbb4){var _0x5bc146=_[_0x1165('0x6a')](_0x20cbb4['module_fields']);_['remove'](_0x5bc146,function(_0x1a9425){return _0x2523d6['includes'](_0x1a9425[_0x1165('0x2b')]);});return{'count':_0x5bc146['length'],'rows':_[_0x1165('0x25')](_0x5bc146,function(_0x3ec472){return{'id':_0x3ec472['name'],'name':_0x3ec472[_0x1165('0x6b')],'custom':_[_0x1165('0x6c')](_0x3ec472[_0x1165('0x2b')],'_c')?!![]:![],'options':_0x3ec472[_0x1165('0x47')]?_['map'](_[_0x1165('0x6a')](_0x3ec472['options']),function(_0x2c65c1){return{'name':_0x2c65c1[_0x1165('0x6d')],'value':_0x2c65c1[_0x1165('0x2b')]};}):[]};})};}})[_0x1165('0x1f')](respondWithResult(_0xfee233,null))[_0x1165('0x3f')](function(_0x18e7f5){var _0x505afd=_0x5d710b[_0x1165('0x2c')][_0x1165('0x6e')]?0x1f4:_0x18e7f5['statusCode']||0x1f4;logger[_0x1165('0x21')](_0x1165('0x6f'),_0x1165('0x51'),_0x505afd,JSON['stringify'](_0x18e7f5));delete _0x18e7f5[_0x1165('0x2b')];if(_0x505afd===0x191){_0x505afd=0x190;}_0xfee233[_0x1165('0x14')](_0x505afd)['send'](_0x5d710b['query']['test']?{'message':_0x1165('0x70'),'statusCode':_0x18e7f5[_0x1165('0x71')]}:_0x18e7f5);});}else{var _0x5405a7=0x1f4;_0xfee233[_0x1165('0x14')](_0x5405a7)['send']({'message':_0x1165('0x70'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x605c=['%s%s','/service/v4_1/rest.php','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','stringify','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','include','rows','show','params','keys','includeAll','find','catch','create','body','destroy','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_name','username','remoteUri','slice','substring','lastIndexOf','POST','format'];(function(_0x3e3011,_0xba9e52){var _0x439a0d=function(_0x151a9d){while(--_0x151a9d){_0x3e3011['push'](_0x3e3011['shift']());}};_0x439a0d(++_0xba9e52);}(_0x605c,0x1db));var _0xc605=function(_0x4f0e99,_0x584ac4){_0x4f0e99=_0x4f0e99-0x0;var _0x2131df=_0x605c[_0x4f0e99];return _0x2131df;};'use strict';var emlformat=require(_0xc605('0x0'));var rimraf=require(_0xc605('0x1'));var zipdir=require(_0xc605('0x2'));var jsonpatch=require(_0xc605('0x3'));var rp=require(_0xc605('0x4'));var moment=require('moment');var BPromise=require(_0xc605('0x5'));var Mustache=require('mustache');var util=require(_0xc605('0x6'));var path=require('path');var sox=require(_0xc605('0x7'));var csv=require(_0xc605('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc605('0x9'));var _=require(_0xc605('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc605('0xb'));var deskjs=require(_0xc605('0xc'));var toCsv=require(_0xc605('0x8'));var querystring=require(_0xc605('0xd'));var Papa=require(_0xc605('0xe'));var Redis=require('ioredis');var authService=require(_0xc605('0xf'));var qs=require(_0xc605('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc605('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc605('0x12'));var config=require(_0xc605('0x13'));var licenseUtil=require(_0xc605('0x14'));var db=require(_0xc605('0x15'))['db'];var integrations=require(_0xc605('0x16'));function respondWithStatusCode(_0x4db01e,_0x59d594){_0x59d594=_0x59d594||0xcc;return function(_0x6092){if(_0x6092){return _0x4db01e['sendStatus'](_0x59d594);}return _0x4db01e[_0xc605('0x17')](_0x59d594)[_0xc605('0x18')]();};}function respondWithResult(_0x47cc15,_0x1776d5){_0x1776d5=_0x1776d5||0xc8;return function(_0x59d86a){if(_0x59d86a){return _0x47cc15[_0xc605('0x17')](_0x1776d5)['json'](_0x59d86a);}};}function respondWithFilteredResult(_0x595e56,_0x631cfe){return function(_0x5c0aaa){if(_0x5c0aaa){var _0xa06de2=typeof _0x631cfe[_0xc605('0x19')]===_0xc605('0x1a')&&typeof _0x631cfe['limit']===_0xc605('0x1a');var _0x2c6140=_0x5c0aaa['count'];var _0x4276a6=_0xa06de2?0x0:_0x631cfe[_0xc605('0x19')];var _0x594ed4=_0xa06de2?_0x5c0aaa['count']:_0x631cfe['offset']+_0x631cfe['limit'];var _0x2f1ea4;if(_0x594ed4>=_0x2c6140){_0x594ed4=_0x2c6140;_0x2f1ea4=0xc8;}else{_0x2f1ea4=0xce;}_0x595e56[_0xc605('0x17')](_0x2f1ea4);return _0x595e56[_0xc605('0x1b')]('Content-Range',_0x4276a6+'-'+_0x594ed4+'/'+_0x2c6140)[_0xc605('0x1c')](_0x5c0aaa);}return null;};}function patchUpdates(_0xca061e){return function(_0xb0b0f1){try{jsonpatch[_0xc605('0x1d')](_0xb0b0f1,_0xca061e,!![]);}catch(_0x54b1b3){return BPromise[_0xc605('0x1e')](_0x54b1b3);}return _0xb0b0f1[_0xc605('0x1f')]();};}function saveUpdates(_0x59bb86,_0x1d202e){return function(_0x974246){if(_0x974246){return _0x974246[_0xc605('0x20')](_0x59bb86)[_0xc605('0x21')](function(_0x3b6fbc){return _0x3b6fbc;});}return null;};}function removeEntity(_0x35713d,_0x1619ba){return function(_0x546c6a){if(_0x546c6a){return _0x546c6a['destroy']()[_0xc605('0x21')](function(){_0x35713d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f3ed1,_0x38f4a4){return function(_0x91acd7){if(!_0x91acd7){_0x4f3ed1[_0xc605('0x22')](0x194);}return _0x91acd7;};}function handleError(_0x54522a,_0x1d86a1){_0x1d86a1=_0x1d86a1||0x1f4;return function(_0x4a60c2){logger[_0xc605('0x23')](_0x4a60c2[_0xc605('0x24')]);if(_0x4a60c2[_0xc605('0x25')]){delete _0x4a60c2[_0xc605('0x25')];}_0x54522a[_0xc605('0x17')](_0x1d86a1)[_0xc605('0x26')](_0x4a60c2);};}exports[_0xc605('0x27')]=function(_0x279c7b,_0x5a7c2f){var _0x21b8ff={},_0x30fbda={},_0x1c0d17={'count':0x0,'rows':[]};var _0x5be9b8=_['map'](db[_0xc605('0x28')][_0xc605('0x29')],function(_0x54db99){return{'name':_0x54db99[_0xc605('0x2a')],'type':_0x54db99[_0xc605('0x2b')][_0xc605('0x2c')]};});_0x30fbda[_0xc605('0x2d')]=_[_0xc605('0x2e')](_0x5be9b8,_0xc605('0x25'));_0x30fbda[_0xc605('0x2f')]=_['keys'](_0x279c7b[_0xc605('0x2f')]);_0x30fbda['filters']=_[_0xc605('0x30')](_0x30fbda[_0xc605('0x2d')],_0x30fbda['query']);_0x21b8ff[_0xc605('0x31')]=_[_0xc605('0x30')](_0x30fbda['model'],qs[_0xc605('0x32')](_0x279c7b[_0xc605('0x2f')][_0xc605('0x32')]));_0x21b8ff[_0xc605('0x31')]=_0x21b8ff[_0xc605('0x31')][_0xc605('0x33')]?_0x21b8ff[_0xc605('0x31')]:_0x30fbda['model'];if(!_0x279c7b[_0xc605('0x2f')][_0xc605('0x34')](_0xc605('0x35'))){_0x21b8ff[_0xc605('0x36')]=qs[_0xc605('0x36')](_0x279c7b[_0xc605('0x2f')]['limit']);_0x21b8ff['offset']=qs[_0xc605('0x19')](_0x279c7b[_0xc605('0x2f')][_0xc605('0x19')]);}_0x21b8ff[_0xc605('0x37')]=qs[_0xc605('0x38')](_0x279c7b[_0xc605('0x2f')][_0xc605('0x38')]);_0x21b8ff[_0xc605('0x39')]=qs['filters'](_[_0xc605('0x3a')](_0x279c7b[_0xc605('0x2f')],_0x30fbda[_0xc605('0x3b')]),_0x5be9b8);if(_0x279c7b[_0xc605('0x2f')][_0xc605('0x3c')]){_0x21b8ff[_0xc605('0x39')]=_['merge'](_0x21b8ff[_0xc605('0x39')],{'$or':_[_0xc605('0x2e')](_0x5be9b8,function(_0x486679){if(_0x486679[_0xc605('0x2b')]!==_0xc605('0x3d')){var _0x234b94={};_0x234b94[_0x486679['name']]={'$like':'%'+_0x279c7b[_0xc605('0x2f')][_0xc605('0x3c')]+'%'};return _0x234b94;}})});}_0x21b8ff=_[_0xc605('0x3e')]({},_0x21b8ff,_0x279c7b[_0xc605('0x3f')]);var _0x454da4={'where':_0x21b8ff['where']};return db[_0xc605('0x28')][_0xc605('0x40')](_0x454da4)['then'](function(_0x59ff23){_0x1c0d17[_0xc605('0x40')]=_0x59ff23;if(_0x279c7b[_0xc605('0x2f')]['includeAll']){_0x21b8ff[_0xc605('0x41')]=[{'all':!![]}];}return db[_0xc605('0x28')]['findAll'](_0x21b8ff);})[_0xc605('0x21')](function(_0x397e66){_0x1c0d17[_0xc605('0x42')]=_0x397e66;return _0x1c0d17;})[_0xc605('0x21')](respondWithFilteredResult(_0x5a7c2f,_0x21b8ff))['catch'](handleError(_0x5a7c2f,null));};exports[_0xc605('0x43')]=function(_0x142e1f,_0x353e1e){var _0x388b23={'raw':![],'where':{'id':_0x142e1f[_0xc605('0x44')]['id']}},_0x1105c5={};_0x1105c5[_0xc605('0x2d')]=_['keys'](db[_0xc605('0x28')][_0xc605('0x29')]);_0x1105c5[_0xc605('0x2f')]=_[_0xc605('0x45')](_0x142e1f[_0xc605('0x2f')]);_0x1105c5[_0xc605('0x3b')]=_['intersection'](_0x1105c5[_0xc605('0x2d')],_0x1105c5[_0xc605('0x2f')]);_0x388b23['attributes']=_[_0xc605('0x30')](_0x1105c5[_0xc605('0x2d')],qs[_0xc605('0x32')](_0x142e1f[_0xc605('0x2f')][_0xc605('0x32')]));_0x388b23[_0xc605('0x31')]=_0x388b23[_0xc605('0x31')][_0xc605('0x33')]?_0x388b23[_0xc605('0x31')]:_0x1105c5['model'];if(_0x142e1f[_0xc605('0x2f')][_0xc605('0x46')]){_0x388b23[_0xc605('0x41')]=[{'all':!![]}];}_0x388b23=_[_0xc605('0x3e')]({},_0x388b23,_0x142e1f[_0xc605('0x3f')]);return db[_0xc605('0x28')][_0xc605('0x47')](_0x388b23)[_0xc605('0x21')](handleEntityNotFound(_0x353e1e,null))[_0xc605('0x21')](respondWithResult(_0x353e1e,null))[_0xc605('0x48')](handleError(_0x353e1e,null));};exports[_0xc605('0x49')]=function(_0x42cfe7,_0x26638f){return db['SugarcrmAccount']['create'](_0x42cfe7[_0xc605('0x4a')],{})[_0xc605('0x21')](respondWithResult(_0x26638f,0xc9))['catch'](handleError(_0x26638f,null));};exports[_0xc605('0x20')]=function(_0x285505,_0x36995b){if(_0x285505[_0xc605('0x4a')]['id']){delete _0x285505['body']['id'];}return db['SugarcrmAccount'][_0xc605('0x47')]({'where':{'id':_0x285505[_0xc605('0x44')]['id']}})[_0xc605('0x21')](handleEntityNotFound(_0x36995b,null))['then'](saveUpdates(_0x285505[_0xc605('0x4a')],null))[_0xc605('0x21')](respondWithResult(_0x36995b,null))[_0xc605('0x48')](handleError(_0x36995b,null));};exports[_0xc605('0x4b')]=function(_0x308215,_0xc175b5){return db[_0xc605('0x28')][_0xc605('0x47')]({'where':{'id':_0x308215[_0xc605('0x44')]['id']}})['then'](handleEntityNotFound(_0xc175b5,null))[_0xc605('0x21')](removeEntity(_0xc175b5,null))[_0xc605('0x48')](handleError(_0xc175b5,null));};exports[_0xc605('0x4c')]=function(_0x5171e0,_0x5841bf,_0x1f00db){var _0x16e9bc={};var _0x58b424={};var _0x361f32;var _0x5af099;return db[_0xc605('0x28')][_0xc605('0x4d')]({'where':{'id':_0x5171e0[_0xc605('0x44')]['id']}})['then'](handleEntityNotFound(_0x5841bf,null))[_0xc605('0x21')](function(_0x40a6c3){if(_0x40a6c3){_0x361f32=_0x40a6c3;_0x58b424['model']=_[_0xc605('0x45')](db['SugarcrmConfiguration'][_0xc605('0x29')]);_0x58b424[_0xc605('0x2f')]=_['keys'](_0x5171e0['query']);_0x58b424[_0xc605('0x3b')]=_[_0xc605('0x30')](_0x58b424['model'],_0x58b424['query']);_0x16e9bc[_0xc605('0x31')]=_[_0xc605('0x30')](_0x58b424[_0xc605('0x2d')],qs[_0xc605('0x32')](_0x5171e0[_0xc605('0x2f')][_0xc605('0x32')]));_0x16e9bc[_0xc605('0x31')]=_0x16e9bc[_0xc605('0x31')]['length']?_0x16e9bc[_0xc605('0x31')]:_0x58b424['model'];_0x16e9bc['order']=qs['sort'](_0x5171e0[_0xc605('0x2f')][_0xc605('0x38')]);_0x16e9bc[_0xc605('0x39')]=qs[_0xc605('0x3b')](_[_0xc605('0x3a')](_0x5171e0['query'],_0x58b424['filters']));if(_0x5171e0[_0xc605('0x2f')]['filter']){_0x16e9bc['where']=_[_0xc605('0x3e')](_0x16e9bc['where'],{'$or':_[_0xc605('0x2e')](_0x16e9bc[_0xc605('0x31')],function(_0x3e0a41){var _0x5a3e62={};_0x5a3e62[_0x3e0a41]={'$like':'%'+_0x5171e0['query'][_0xc605('0x3c')]+'%'};return _0x5a3e62;})});}_0x16e9bc=_[_0xc605('0x3e')]({},_0x16e9bc,_0x5171e0[_0xc605('0x3f')]);return _0x361f32[_0xc605('0x4c')](_0x16e9bc);}})['then'](function(_0x53f974){if(_0x53f974){_0x5af099=_0x53f974['length'];if(!_0x5171e0['query']['hasOwnProperty'](_0xc605('0x35'))){_0x16e9bc['limit']=qs['limit'](_0x5171e0[_0xc605('0x2f')][_0xc605('0x36')]);_0x16e9bc[_0xc605('0x19')]=qs[_0xc605('0x19')](_0x5171e0[_0xc605('0x2f')]['offset']);}return _0x361f32[_0xc605('0x4c')](_0x16e9bc);}})[_0xc605('0x21')](function(_0x12862f){if(_0x12862f){return _0x12862f?{'count':_0x5af099,'rows':_0x12862f}:null;}})[_0xc605('0x21')](respondWithResult(_0x5841bf,null))[_0xc605('0x48')](handleError(_0x5841bf,null));};exports[_0xc605('0x4e')]=function(_0x43bef0,_0x5248ea,_0x4d661c){if(_0x43bef0['body']['id']){delete _0x43bef0[_0xc605('0x4a')]['id'];}return db[_0xc605('0x28')][_0xc605('0x4d')]({'where':{'id':_0x43bef0[_0xc605('0x44')]['id']}})[_0xc605('0x21')](handleEntityNotFound(_0x5248ea,null))[_0xc605('0x21')](function(_0x4c78f1){if(_0x4c78f1){_0x43bef0[_0xc605('0x4a')]['AccountId']=_0x4c78f1['id'];_0x43bef0[_0xc605('0x4a')][_0xc605('0x4f')]=integrations['getSubjects'](_0x43bef0[_0xc605('0x4a')][_0xc605('0x50')],_0x43bef0[_0xc605('0x4a')][_0xc605('0x2b')]);_0x43bef0[_0xc605('0x4a')][_0xc605('0x51')]=integrations['getDescriptions'](_0x43bef0[_0xc605('0x4a')][_0xc605('0x50')],_0x43bef0['body'][_0xc605('0x2b')]);return db['SugarcrmConfiguration'][_0xc605('0x49')](_0x43bef0[_0xc605('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0xc605('0x4f')},{'model':db['SugarcrmField'],'as':_0xc605('0x51')}]});}return null;})['then'](respondWithResult(_0x5248ea,null))['catch'](handleError(_0x5248ea,null));};exports[_0xc605('0x52')]=function(_0xb75136,_0xcbb98e,_0x54c886){var _0x4a339e='';var _0x48b3fa=['id',_0xc605('0x25'),_0xc605('0x53'),'created_by',_0xc605('0x54'),_0xc605('0x55'),_0xc605('0x56'),'duration_minutes','parent_id','parent_type',_0xc605('0x57'),'direction'];return db[_0xc605('0x28')][_0xc605('0x4d')]({'where':{'id':_0xb75136[_0xc605('0x44')]['id']},'attributes':['id',_0xc605('0x58'),'password',_0xc605('0x59')]})[_0xc605('0x21')](handleEntityNotFound(_0xcbb98e,null))['then'](function(_0x591821){if(_0x591821){_0x4a339e=_0x591821[_0xc605('0x59')];var _0x277b3b=_0x4a339e[_0xc605('0x5a')](-0x1);if(_0x277b3b==='/'){_0x4a339e=_0x4a339e[_0xc605('0x5b')](0x0,_0x4a339e[_0xc605('0x5c')](_0x277b3b));}return rp({'method':_0xc605('0x5d'),'uri':util[_0xc605('0x5e')](_0xc605('0x5f'),_0x4a339e,_0xc605('0x60')),'json':!![],'form':{'method':'login','input_type':_0xc605('0x61'),'response_type':_0xc605('0x61'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x591821[_0xc605('0x58')],'password':_0x591821[_0xc605('0x62')],'encryption':_0xc605('0x63')},'application':_0xc605('0x64')})}});}})[_0xc605('0x21')](function(_0x36722c){if(_0x36722c&&_0x36722c[_0xc605('0x25')]!=='Invalid\x20Login'&&_0x36722c[_0xc605('0x25')]!==_0xc605('0x65')){return rp({'method':'POST','uri':util['format'](_0xc605('0x5f'),_0x4a339e,_0xc605('0x60')),'json':!![],'form':{'method':_0xc605('0x66'),'input_type':_0xc605('0x61'),'response_type':_0xc605('0x61'),'rest_data':JSON[_0xc605('0x67')]({'session':_0x36722c['id'],'module_name':'Calls'})}})[_0xc605('0x21')](function(_0x5ed2b3){if(_0x5ed2b3){var _0x3118b3=_[_0xc605('0x68')](_0x5ed2b3[_0xc605('0x69')]);_[_0xc605('0x6a')](_0x3118b3,function(_0x3b1a7a){return _0x48b3fa[_0xc605('0x6b')](_0x3b1a7a[_0xc605('0x25')]);});return{'count':_0x3118b3[_0xc605('0x33')],'rows':_[_0xc605('0x2e')](_0x3118b3,function(_0x1012be){return{'id':_0x1012be['name'],'name':_0x1012be[_0xc605('0x6c')],'custom':_[_0xc605('0x6d')](_0x1012be[_0xc605('0x25')],'_c')?!![]:![],'options':_0x1012be[_0xc605('0x3f')]?_[_0xc605('0x2e')](_[_0xc605('0x68')](_0x1012be[_0xc605('0x3f')]),function(_0x13adbf){return{'name':_0x13adbf[_0xc605('0x6e')],'value':_0x13adbf['name']};}):[]};})};}})[_0xc605('0x21')](respondWithResult(_0xcbb98e,null))[_0xc605('0x48')](function(_0x5991e4){var _0x3a158a=_0xb75136[_0xc605('0x2f')][_0xc605('0x6f')]?0x1f4:_0x5991e4[_0xc605('0x70')]||0x1f4;logger[_0xc605('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3a158a,JSON[_0xc605('0x67')](_0x5991e4));delete _0x5991e4[_0xc605('0x25')];if(_0x3a158a===0x191){_0x3a158a=0x190;}_0xcbb98e[_0xc605('0x17')](_0x3a158a)['send'](_0xb75136[_0xc605('0x2f')][_0xc605('0x6f')]?{'message':_0xc605('0x71'),'statusCode':_0x5991e4[_0xc605('0x70')]}:_0x5991e4);});}else{var _0x12f7c6=0x1f4;_0xcbb98e[_0xc605('0x17')](_0x12f7c6)['send']({'message':_0xc605('0x71'),'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 3b687fe..4adae81 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 _0x9976=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x4b2396,_0x2cbb20){var _0x20ee80=function(_0x3b565a){while(--_0x3b565a){_0x4b2396['push'](_0x4b2396['shift']());}};_0x20ee80(++_0x2cbb20);}(_0x9976,0x113));var _0x6997=function(_0x5a642e,_0x128a76){_0x5a642e=_0x5a642e-0x0;var _0x56cff5=_0x9976[_0x5a642e];return _0x56cff5;};'use strict';var _=require('lodash');var util=require(_0x6997('0x0'));var logger=require(_0x6997('0x1'))('api');var moment=require(_0x6997('0x2'));var BPromise=require(_0x6997('0x3'));var rp=require(_0x6997('0x4'));var fs=require('fs');var path=require(_0x6997('0x5'));var rimraf=require(_0x6997('0x6'));var config=require(_0x6997('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x6997('0x8'));module['exports']=function(_0x50f7db,_0x4329a6){return _0x50f7db['define'](_0x6997('0x9'),attributes,{'tableName':_0x6997('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb99e=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0xb99e,0xcc));var _0xeb99=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb99e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xeb99('0x0'));var util=require(_0xeb99('0x1'));var logger=require(_0xeb99('0x2'))('api');var moment=require(_0xeb99('0x3'));var BPromise=require(_0xeb99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb99('0x5'));var rimraf=require(_0xeb99('0x6'));var config=require(_0xeb99('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xeb99('0x8'));module['exports']=function(_0x340622,_0x2b3735){return _0x340622[_0xeb99('0x9')](_0xeb99('0xa'),attributes,{'tableName':_0xeb99('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 1ea719f..9b214e5 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 _0x5f71=['catch','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','GetSugarcrmAccount','options','raw','where','attributes','include','map','model','debug','stringify'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5f71,0x1e5));var _0x15f7=function(_0x123025,_0x448a82){_0x123025=_0x123025-0x0;var _0x2a928a=_0x5f71[_0x123025];return _0x2a928a;};'use strict';var _=require(_0x15f7('0x0'));var util=require(_0x15f7('0x1'));var moment=require(_0x15f7('0x2'));var BPromise=require(_0x15f7('0x3'));var rs=require(_0x15f7('0x4'));var fs=require('fs');var Redis=require(_0x15f7('0x5'));var db=require(_0x15f7('0x6'))['db'];var utils=require(_0x15f7('0x7'));var logger=require(_0x15f7('0x8'))(_0x15f7('0x9'));var config=require(_0x15f7('0xa'));var jayson=require(_0x15f7('0xb'));var client=jayson[_0x15f7('0xc')][_0x15f7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5e4f67,_0x38d248,_0x34b3c0){return new BPromise(function(_0x4a6b59,_0x1d195c){return client[_0x15f7('0xe')](_0x5e4f67,_0x34b3c0)[_0x15f7('0xf')](function(_0x347380){logger[_0x15f7('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x38d248,'request\x20sent');logger['debug'](_0x15f7('0x11'),_0x38d248,'request\x20sent',JSON['stringify'](_0x347380));if(_0x347380[_0x15f7('0x12')]){if(_0x347380[_0x15f7('0x12')][_0x15f7('0x13')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x38d248,_0x347380[_0x15f7('0x12')][_0x15f7('0x14')]);return _0x1d195c(_0x347380[_0x15f7('0x12')][_0x15f7('0x14')]);}logger['error'](_0x15f7('0x15'),_0x38d248,_0x347380[_0x15f7('0x12')]['message']);return _0x4a6b59(_0x347380[_0x15f7('0x12')][_0x15f7('0x14')]);}else{logger[_0x15f7('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x38d248,'request\x20sent');_0x4a6b59(_0x347380[_0x15f7('0x16')]['message']);}})['catch'](function(_0x4b8135){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x38d248,_0x4b8135);_0x1d195c(_0x4b8135);});});}exports[_0x15f7('0x17')]=function(_0x1ef28d){var _0xb08817=this;return new Promise(function(_0x5af650,_0x199c41){return db['SugarcrmAccount']['findAll']({'raw':_0x1ef28d['options']?_0x1ef28d[_0x15f7('0x18')][_0x15f7('0x19')]===undefined?!![]:![]:!![],'where':_0x1ef28d['options']?_0x1ef28d[_0x15f7('0x18')][_0x15f7('0x1a')]||null:null,'attributes':_0x1ef28d['options']?_0x1ef28d[_0x15f7('0x18')][_0x15f7('0x1b')]||null:null,'limit':_0x1ef28d[_0x15f7('0x18')]?_0x1ef28d['options']['limit']||null:null,'include':_0x1ef28d[_0x15f7('0x18')]?_0x1ef28d[_0x15f7('0x18')][_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x1ef28d[_0x15f7('0x18')][_0x15f7('0x1c')],function(_0x32503e){return{'model':db[_0x32503e['model']],'as':_0x32503e['as'],'attributes':_0x32503e['attributes'],'include':_0x32503e[_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x32503e['include'],function(_0x3ff77b){return{'model':db[_0x3ff77b['model']],'as':_0x3ff77b['as'],'attributes':_0x3ff77b[_0x15f7('0x1b')],'include':_0x3ff77b[_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x3ff77b[_0x15f7('0x1c')],function(_0x6afb2a){return{'model':db[_0x6afb2a[_0x15f7('0x1e')]],'as':_0x6afb2a['as'],'attributes':_0x6afb2a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ef446){logger[_0x15f7('0x10')](_0x15f7('0x17'),_0x1ef28d);logger[_0x15f7('0x1f')](_0x15f7('0x17'),_0x1ef28d,JSON[_0x15f7('0x20')](_0x3ef446));_0x5af650(_0x3ef446);})[_0x15f7('0x21')](function(_0x2cb4cd){logger[_0x15f7('0x12')](_0x15f7('0x17'),_0x2cb4cd[_0x15f7('0x14')],_0x1ef28d);_0x199c41(_0xb08817[_0x15f7('0x12')](0x1f4,_0x2cb4cd['message']));});});};exports['ShowSugarcrmAccount']=function(_0x45e1c4){var _0x3ef944=this;return new Promise(function(_0x2ee461,_0x1e4e85){return db[_0x15f7('0x22')][_0x15f7('0x23')]({'raw':_0x45e1c4['options']?_0x45e1c4[_0x15f7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45e1c4[_0x15f7('0x18')]?_0x45e1c4[_0x15f7('0x18')][_0x15f7('0x1a')]||null:null,'attributes':_0x45e1c4[_0x15f7('0x18')]?_0x45e1c4['options']['attributes']||null:null,'include':_0x45e1c4[_0x15f7('0x18')]?_0x45e1c4['options'][_0x15f7('0x1c')]?_['map'](_0x45e1c4[_0x15f7('0x18')]['include'],function(_0xe018d3){return{'model':db[_0xe018d3[_0x15f7('0x1e')]],'as':_0xe018d3['as'],'attributes':_0xe018d3['attributes'],'include':_0xe018d3['include']?_[_0x15f7('0x1d')](_0xe018d3[_0x15f7('0x1c')],function(_0x2cd95a){return{'model':db[_0x2cd95a[_0x15f7('0x1e')]],'as':_0x2cd95a['as'],'attributes':_0x2cd95a[_0x15f7('0x1b')],'include':_0x2cd95a[_0x15f7('0x1c')]?_['map'](_0x2cd95a['include'],function(_0x22440d){return{'model':db[_0x22440d[_0x15f7('0x1e')]],'as':_0x22440d['as'],'attributes':_0x22440d['attributes']};}):[]};}):[]};}):[]:[]})[_0x15f7('0xf')](function(_0xc8536e){logger['info'](_0x15f7('0x24'),_0x45e1c4);logger[_0x15f7('0x1f')](_0x15f7('0x24'),_0x45e1c4,JSON[_0x15f7('0x20')](_0xc8536e));_0x2ee461(_0xc8536e);})[_0x15f7('0x21')](function(_0x5c587b){logger[_0x15f7('0x12')](_0x15f7('0x24'),_0x5c587b[_0x15f7('0x14')],_0x45e1c4);_0x1e4e85(_0x3ef944[_0x15f7('0x12')](0x1f4,_0x5c587b[_0x15f7('0x14')]));});});}; \ No newline at end of file +var _0x2650=['request\x20sent','stringify','error','message','result','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','GetSugarcrmAccount','debug','catch','ShowSugarcrmAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x5e6a3e,_0x298659){var _0x530c52=function(_0x27ac64){while(--_0x27ac64){_0x5e6a3e['push'](_0x5e6a3e['shift']());}};_0x530c52(++_0x298659);}(_0x2650,0x117));var _0x0265=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2650[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x0265('0x0'));var util=require('util');var moment=require(_0x0265('0x1'));var BPromise=require(_0x0265('0x2'));var rs=require(_0x0265('0x3'));var fs=require('fs');var Redis=require(_0x0265('0x4'));var db=require(_0x0265('0x5'))['db'];var utils=require(_0x0265('0x6'));var logger=require(_0x0265('0x7'))(_0x0265('0x8'));var config=require(_0x0265('0x9'));var jayson=require(_0x0265('0xa'));var client=jayson[_0x0265('0xb')][_0x0265('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b37f2,_0x593d18,_0x61b3a9){return new BPromise(function(_0x47bfaf,_0x4276e6){return client[_0x0265('0xd')](_0x5b37f2,_0x61b3a9)[_0x0265('0xe')](function(_0x204253){logger[_0x0265('0xf')](_0x0265('0x10'),_0x593d18,_0x0265('0x11'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x593d18,_0x0265('0x11'),JSON[_0x0265('0x12')](_0x204253));if(_0x204253[_0x0265('0x13')]){if(_0x204253[_0x0265('0x13')]['code']===0x1f4){logger['error'](_0x0265('0x10'),_0x593d18,_0x204253[_0x0265('0x13')][_0x0265('0x14')]);return _0x4276e6(_0x204253[_0x0265('0x13')][_0x0265('0x14')]);}logger[_0x0265('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x593d18,_0x204253[_0x0265('0x13')]['message']);return _0x47bfaf(_0x204253['error'][_0x0265('0x14')]);}else{logger[_0x0265('0xf')](_0x0265('0x10'),_0x593d18,_0x0265('0x11'));_0x47bfaf(_0x204253[_0x0265('0x15')][_0x0265('0x14')]);}})['catch'](function(_0x2f314c){logger[_0x0265('0x13')](_0x0265('0x10'),_0x593d18,_0x2f314c);_0x4276e6(_0x2f314c);});});}exports['GetSugarcrmAccount']=function(_0x401af){var _0x2da7d2=this;return new Promise(function(_0xcd749,_0x24af56){return db[_0x0265('0x16')][_0x0265('0x17')]({'raw':_0x401af[_0x0265('0x18')]?_0x401af['options']['raw']===undefined?!![]:![]:!![],'where':_0x401af['options']?_0x401af[_0x0265('0x18')][_0x0265('0x19')]||null:null,'attributes':_0x401af[_0x0265('0x18')]?_0x401af[_0x0265('0x18')][_0x0265('0x1a')]||null:null,'limit':_0x401af[_0x0265('0x18')]?_0x401af[_0x0265('0x18')][_0x0265('0x1b')]||null:null,'include':_0x401af[_0x0265('0x18')]?_0x401af[_0x0265('0x18')][_0x0265('0x1c')]?_[_0x0265('0x1d')](_0x401af['options']['include'],function(_0x5e1c76){return{'model':db[_0x5e1c76[_0x0265('0x1e')]],'as':_0x5e1c76['as'],'attributes':_0x5e1c76[_0x0265('0x1a')],'include':_0x5e1c76[_0x0265('0x1c')]?_[_0x0265('0x1d')](_0x5e1c76[_0x0265('0x1c')],function(_0x354f17){return{'model':db[_0x354f17[_0x0265('0x1e')]],'as':_0x354f17['as'],'attributes':_0x354f17[_0x0265('0x1a')],'include':_0x354f17[_0x0265('0x1c')]?_['map'](_0x354f17['include'],function(_0x583d41){return{'model':db[_0x583d41['model']],'as':_0x583d41['as'],'attributes':_0x583d41[_0x0265('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0265('0xe')](function(_0x5cdfdd){logger['info'](_0x0265('0x1f'),_0x401af);logger[_0x0265('0x20')]('GetSugarcrmAccount',_0x401af,JSON[_0x0265('0x12')](_0x5cdfdd));_0xcd749(_0x5cdfdd);})[_0x0265('0x21')](function(_0x54266d){logger[_0x0265('0x13')](_0x0265('0x1f'),_0x54266d['message'],_0x401af);_0x24af56(_0x2da7d2[_0x0265('0x13')](0x1f4,_0x54266d[_0x0265('0x14')]));});});};exports[_0x0265('0x22')]=function(_0x28f4bd){var _0xde5a88=this;return new Promise(function(_0x48c3d8,_0x2cb42f){return db[_0x0265('0x16')][_0x0265('0x23')]({'raw':_0x28f4bd[_0x0265('0x18')]?_0x28f4bd['options'][_0x0265('0x24')]===undefined?!![]:![]:!![],'where':_0x28f4bd[_0x0265('0x18')]?_0x28f4bd['options'][_0x0265('0x19')]||null:null,'attributes':_0x28f4bd['options']?_0x28f4bd[_0x0265('0x18')][_0x0265('0x1a')]||null:null,'include':_0x28f4bd[_0x0265('0x18')]?_0x28f4bd[_0x0265('0x18')][_0x0265('0x1c')]?_[_0x0265('0x1d')](_0x28f4bd[_0x0265('0x18')]['include'],function(_0x122d40){return{'model':db[_0x122d40['model']],'as':_0x122d40['as'],'attributes':_0x122d40[_0x0265('0x1a')],'include':_0x122d40[_0x0265('0x1c')]?_[_0x0265('0x1d')](_0x122d40[_0x0265('0x1c')],function(_0x380e10){return{'model':db[_0x380e10[_0x0265('0x1e')]],'as':_0x380e10['as'],'attributes':_0x380e10[_0x0265('0x1a')],'include':_0x380e10['include']?_[_0x0265('0x1d')](_0x380e10[_0x0265('0x1c')],function(_0x323394){return{'model':db[_0x323394[_0x0265('0x1e')]],'as':_0x323394['as'],'attributes':_0x323394[_0x0265('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0265('0xe')](function(_0x6b320e){logger[_0x0265('0xf')](_0x0265('0x22'),_0x28f4bd);logger[_0x0265('0x20')](_0x0265('0x22'),_0x28f4bd,JSON[_0x0265('0x12')](_0x6b320e));_0x48c3d8(_0x6b320e);})[_0x0265('0x21')](function(_0x39e553){logger[_0x0265('0x13')](_0x0265('0x22'),_0x39e553[_0x0265('0x14')],_0x28f4bd);_0x2cb42f(_0xde5a88[_0x0265('0x13')](0x1f4,_0x39e553[_0x0265('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 87a6308..78f777a 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 _0x9599=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9599,0x107));var _0x9959=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x9599[_0x152449];return _0x5b58b2;};'use strict';var multer=require(_0x9959('0x0'));var util=require(_0x9959('0x1'));var path=require('path');var timeout=require(_0x9959('0x2'));var express=require(_0x9959('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9959('0x4'));var interaction=require(_0x9959('0x5'));var config=require(_0x9959('0x6'));var controller=require(_0x9959('0x7'));router[_0x9959('0x8')]('/',auth[_0x9959('0x9')](),controller['index']);router['get'](_0x9959('0xa'),auth['isAuthenticated'](),controller[_0x9959('0xb')]);router[_0x9959('0x8')](_0x9959('0xc'),auth[_0x9959('0x9')](),controller[_0x9959('0xd')]);router['get'](_0x9959('0xe'),auth[_0x9959('0x9')](),controller['getSubjects']);router[_0x9959('0x8')](_0x9959('0xf'),auth[_0x9959('0x9')](),controller[_0x9959('0x10')]);router['post']('/',auth[_0x9959('0x9')](),controller[_0x9959('0x11')]);router['put'](_0x9959('0xa'),auth[_0x9959('0x9')](),controller[_0x9959('0x12')]);router[_0x9959('0x13')](_0x9959('0xa'),auth[_0x9959('0x9')](),controller[_0x9959('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9699=['./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x663c20,_0x451f0b){var _0x5cfc0f=function(_0x85a3c3){while(--_0x85a3c3){_0x663c20['push'](_0x663c20['shift']());}};_0x5cfc0f(++_0x451f0b);}(_0x9699,0x1b0));var _0x9969=function(_0x117b16,_0x594c7b){_0x117b16=_0x117b16-0x0;var _0x5e45ff=_0x9699[_0x117b16];return _0x5e45ff;};'use strict';var multer=require(_0x9969('0x0'));var util=require(_0x9969('0x1'));var path=require(_0x9969('0x2'));var timeout=require(_0x9969('0x3'));var express=require('express');var router=express[_0x9969('0x4')]();var fs_extra=require(_0x9969('0x5'));var auth=require(_0x9969('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9969('0x7'));var controller=require(_0x9969('0x8'));router[_0x9969('0x9')]('/',auth[_0x9969('0xa')](),controller['index']);router[_0x9969('0x9')](_0x9969('0xb'),auth[_0x9969('0xa')](),controller[_0x9969('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x9969('0xd')]);router['get']('/:id/subjects',auth[_0x9969('0xa')](),controller[_0x9969('0xe')]);router[_0x9969('0x9')](_0x9969('0xf'),auth[_0x9969('0xa')](),controller[_0x9969('0x10')]);router['post']('/',auth[_0x9969('0xa')](),controller[_0x9969('0x11')]);router[_0x9969('0x12')](_0x9969('0xb'),auth[_0x9969('0xa')](),controller['update']);router[_0x9969('0x13')](_0x9969('0xb'),auth[_0x9969('0xa')](),controller[_0x9969('0x14')]);module[_0x9969('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 bb7dabf..a150af5 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 _0x3530=['STRING','sequelize','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3530,0x1e1));var _0x0353=function(_0x4c19cd,_0xd03980){_0x4c19cd=_0x4c19cd-0x0;var _0x1892da=_0x3530[_0x4c19cd];return _0x1892da;};'use strict';var Sequelize=require(_0x0353('0x0'));module[_0x0353('0x1')]={'name':{'type':Sequelize[_0x0353('0x2')]},'description':{'type':Sequelize[_0x0353('0x2')]}}; \ No newline at end of file +var _0xde8c=['sequelize','exports','STRING'];(function(_0x5c1899,_0xfc35dd){var _0x11aea4=function(_0x2abc42){while(--_0x2abc42){_0x5c1899['push'](_0x5c1899['shift']());}};_0x11aea4(++_0xfc35dd);}(_0xde8c,0x15c));var _0xcde8=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xde8c[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0xcde8('0x0'));module[_0xcde8('0x1')]={'name':{'type':Sequelize[_0xcde8('0x2')]},'description':{'type':Sequelize[_0xcde8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 28ea377..2ef97ad 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 _0xc273=['merge','options','includeAll','include','findAll','rows','catch','params','create','body','update','find','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','end','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x388e70,_0x5c7f65){var _0x384459=function(_0x4c70ca){while(--_0x4c70ca){_0x388e70['push'](_0x388e70['shift']());}};_0x384459(++_0x5c7f65);}(_0xc273,0xf8));var _0x3c27=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0xc273[_0x2f89c0];return _0x164223;};'use strict';var emlformat=require(_0x3c27('0x0'));var rimraf=require(_0x3c27('0x1'));var zipdir=require(_0x3c27('0x2'));var jsonpatch=require(_0x3c27('0x3'));var rp=require(_0x3c27('0x4'));var moment=require(_0x3c27('0x5'));var BPromise=require(_0x3c27('0x6'));var Mustache=require(_0x3c27('0x7'));var util=require(_0x3c27('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3c27('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c27('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c27('0xb'));var toCsv=require(_0x3c27('0x9'));var querystring=require(_0x3c27('0xc'));var Papa=require(_0x3c27('0xd'));var Redis=require('ioredis');var authService=require(_0x3c27('0xe'));var qs=require(_0x3c27('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c27('0x10'));var logger=require(_0x3c27('0x11'))('api');var utils=require(_0x3c27('0x12'));var config=require(_0x3c27('0x13'));var licenseUtil=require(_0x3c27('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3358ea,_0x465d6f){_0x465d6f=_0x465d6f||0xcc;return function(_0x2713a2){if(_0x2713a2){return _0x3358ea[_0x3c27('0x15')](_0x465d6f);}return _0x3358ea['status'](_0x465d6f)['end']();};}function respondWithResult(_0x529e60,_0x29be31){_0x29be31=_0x29be31||0xc8;return function(_0x7652be){if(_0x7652be){return _0x529e60['status'](_0x29be31)[_0x3c27('0x16')](_0x7652be);}};}function respondWithFilteredResult(_0x55ee9a,_0x30519f){return function(_0x10b3cc){if(_0x10b3cc){var _0x5d6be1=typeof _0x30519f[_0x3c27('0x17')]===_0x3c27('0x18')&&typeof _0x30519f[_0x3c27('0x19')]===_0x3c27('0x18');var _0x20f1ee=_0x10b3cc[_0x3c27('0x1a')];var _0x4408b6=_0x5d6be1?0x0:_0x30519f[_0x3c27('0x17')];var _0x3f67ae=_0x5d6be1?_0x10b3cc[_0x3c27('0x1a')]:_0x30519f['offset']+_0x30519f['limit'];var _0x513be1;if(_0x3f67ae>=_0x20f1ee){_0x3f67ae=_0x20f1ee;_0x513be1=0xc8;}else{_0x513be1=0xce;}_0x55ee9a[_0x3c27('0x1b')](_0x513be1);return _0x55ee9a[_0x3c27('0x1c')](_0x3c27('0x1d'),_0x4408b6+'-'+_0x3f67ae+'/'+_0x20f1ee)[_0x3c27('0x16')](_0x10b3cc);}return null;};}function patchUpdates(_0x5aaa41){return function(_0x882639){try{jsonpatch[_0x3c27('0x1e')](_0x882639,_0x5aaa41,!![]);}catch(_0x4378af){return BPromise[_0x3c27('0x1f')](_0x4378af);}return _0x882639[_0x3c27('0x20')]();};}function saveUpdates(_0x338790,_0x5baf42){return function(_0x38c67c){if(_0x38c67c){return _0x38c67c['update'](_0x338790)['then'](function(_0x520e1b){return _0x520e1b;});}return null;};}function removeEntity(_0x3357c1,_0x44fde2){return function(_0xd1b286){if(_0xd1b286){return _0xd1b286[_0x3c27('0x21')]()[_0x3c27('0x22')](function(){_0x3357c1[_0x3c27('0x1b')](0xcc)[_0x3c27('0x23')]();});}};}function handleEntityNotFound(_0x7b8a35,_0x2f4cf8){return function(_0x162b23){if(!_0x162b23){_0x7b8a35[_0x3c27('0x15')](0x194);}return _0x162b23;};}function handleError(_0x45119c,_0x1bda53){_0x1bda53=_0x1bda53||0x1f4;return function(_0x14a4bd){logger['error'](_0x14a4bd[_0x3c27('0x24')]);if(_0x14a4bd[_0x3c27('0x25')]){delete _0x14a4bd[_0x3c27('0x25')];}_0x45119c[_0x3c27('0x1b')](_0x1bda53)['send'](_0x14a4bd);};}exports[_0x3c27('0x26')]=function(_0x30bf72,_0x524a6e){var _0x1fa3f7={},_0x15ccaa={},_0x557260={'count':0x0,'rows':[]};var _0x387f1b=_[_0x3c27('0x27')](db[_0x3c27('0x28')][_0x3c27('0x29')],function(_0x4e73db){return{'name':_0x4e73db[_0x3c27('0x2a')],'type':_0x4e73db[_0x3c27('0x2b')]['key']};});_0x15ccaa['model']=_[_0x3c27('0x27')](_0x387f1b,_0x3c27('0x25'));_0x15ccaa['query']=_[_0x3c27('0x2c')](_0x30bf72[_0x3c27('0x2d')]);_0x15ccaa[_0x3c27('0x2e')]=_[_0x3c27('0x2f')](_0x15ccaa['model'],_0x15ccaa[_0x3c27('0x2d')]);_0x1fa3f7[_0x3c27('0x30')]=_[_0x3c27('0x2f')](_0x15ccaa[_0x3c27('0x31')],qs['fields'](_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x32')]));_0x1fa3f7[_0x3c27('0x30')]=_0x1fa3f7[_0x3c27('0x30')][_0x3c27('0x33')]?_0x1fa3f7['attributes']:_0x15ccaa[_0x3c27('0x31')];if(!_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x34')](_0x3c27('0x35'))){_0x1fa3f7[_0x3c27('0x19')]=qs['limit'](_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x19')]);_0x1fa3f7['offset']=qs[_0x3c27('0x17')](_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x17')]);}_0x1fa3f7[_0x3c27('0x36')]=qs[_0x3c27('0x37')](_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x37')]);_0x1fa3f7['where']=qs[_0x3c27('0x2e')](_[_0x3c27('0x38')](_0x30bf72[_0x3c27('0x2d')],_0x15ccaa['filters']),_0x387f1b);if(_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x39')]){_0x1fa3f7['where']=_['merge'](_0x1fa3f7[_0x3c27('0x3a')],{'$or':_[_0x3c27('0x27')](_0x387f1b,function(_0x1691f9){if(_0x1691f9[_0x3c27('0x2b')]!==_0x3c27('0x3b')){var _0x542ed3={};_0x542ed3[_0x1691f9[_0x3c27('0x25')]]={'$like':'%'+_0x30bf72['query'][_0x3c27('0x39')]+'%'};return _0x542ed3;}})});}_0x1fa3f7=_[_0x3c27('0x3c')]({},_0x1fa3f7,_0x30bf72[_0x3c27('0x3d')]);var _0x25a6f9={'where':_0x1fa3f7['where']};return db[_0x3c27('0x28')][_0x3c27('0x1a')](_0x25a6f9)[_0x3c27('0x22')](function(_0x5e4f8e){_0x557260['count']=_0x5e4f8e;if(_0x30bf72[_0x3c27('0x2d')][_0x3c27('0x3e')]){_0x1fa3f7[_0x3c27('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x3c27('0x40')](_0x1fa3f7);})[_0x3c27('0x22')](function(_0x408f87){_0x557260[_0x3c27('0x41')]=_0x408f87;return _0x557260;})[_0x3c27('0x22')](respondWithFilteredResult(_0x524a6e,_0x1fa3f7))[_0x3c27('0x42')](handleError(_0x524a6e,null));};exports['show']=function(_0x36dce0,_0x17a3a0){var _0x532c82={'raw':![],'where':{'id':_0x36dce0[_0x3c27('0x43')]['id']}},_0x25f9f2={};_0x25f9f2['model']=_['keys'](db[_0x3c27('0x28')][_0x3c27('0x29')]);_0x25f9f2[_0x3c27('0x2d')]=_[_0x3c27('0x2c')](_0x36dce0[_0x3c27('0x2d')]);_0x25f9f2['filters']=_[_0x3c27('0x2f')](_0x25f9f2[_0x3c27('0x31')],_0x25f9f2[_0x3c27('0x2d')]);_0x532c82['attributes']=_[_0x3c27('0x2f')](_0x25f9f2['model'],qs['fields'](_0x36dce0[_0x3c27('0x2d')][_0x3c27('0x32')]));_0x532c82['attributes']=_0x532c82['attributes'][_0x3c27('0x33')]?_0x532c82[_0x3c27('0x30')]:_0x25f9f2['model'];if(_0x36dce0[_0x3c27('0x2d')][_0x3c27('0x3e')]){_0x532c82[_0x3c27('0x3f')]=[{'all':!![]}];}_0x532c82=_['merge']({},_0x532c82,_0x36dce0[_0x3c27('0x3d')]);return db[_0x3c27('0x28')]['find'](_0x532c82)[_0x3c27('0x22')](handleEntityNotFound(_0x17a3a0,null))[_0x3c27('0x22')](respondWithResult(_0x17a3a0,null))[_0x3c27('0x42')](handleError(_0x17a3a0,null));};exports[_0x3c27('0x44')]=function(_0x140633,_0x349c73){return db[_0x3c27('0x28')][_0x3c27('0x44')](_0x140633[_0x3c27('0x45')],{})[_0x3c27('0x22')](respondWithResult(_0x349c73,0xc9))[_0x3c27('0x42')](handleError(_0x349c73,null));};exports[_0x3c27('0x46')]=function(_0x5199cc,_0x8da329){if(_0x5199cc[_0x3c27('0x45')]['id']){delete _0x5199cc[_0x3c27('0x45')]['id'];}return db[_0x3c27('0x28')][_0x3c27('0x47')]({'where':{'id':_0x5199cc[_0x3c27('0x43')]['id']}})[_0x3c27('0x22')](handleEntityNotFound(_0x8da329,null))[_0x3c27('0x22')](saveUpdates(_0x5199cc['body'],null))[_0x3c27('0x22')](respondWithResult(_0x8da329,null))['catch'](handleError(_0x8da329,null));};exports[_0x3c27('0x21')]=function(_0x2d203a,_0x4f3b32){return db[_0x3c27('0x28')][_0x3c27('0x47')]({'where':{'id':_0x2d203a[_0x3c27('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f3b32,null))[_0x3c27('0x22')](removeEntity(_0x4f3b32,null))[_0x3c27('0x42')](handleError(_0x4f3b32,null));};exports[_0x3c27('0x48')]=function(_0x1c44eb,_0x41932e,_0x5f1caa){var _0x5e9466={};var _0x124212={};var _0x98eb4f;var _0x296472;return db['SugarcrmConfiguration'][_0x3c27('0x49')]({'where':{'id':_0x1c44eb[_0x3c27('0x43')]['id']}})['then'](handleEntityNotFound(_0x41932e,null))[_0x3c27('0x22')](function(_0x3fb3aa){if(_0x3fb3aa){_0x98eb4f=_0x3fb3aa;_0x124212[_0x3c27('0x31')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x124212[_0x3c27('0x2d')]=_['keys'](_0x1c44eb[_0x3c27('0x2d')]);_0x124212[_0x3c27('0x2e')]=_[_0x3c27('0x2f')](_0x124212[_0x3c27('0x31')],_0x124212[_0x3c27('0x2d')]);_0x5e9466['attributes']=_[_0x3c27('0x2f')](_0x124212[_0x3c27('0x31')],qs[_0x3c27('0x32')](_0x1c44eb[_0x3c27('0x2d')][_0x3c27('0x32')]));_0x5e9466[_0x3c27('0x30')]=_0x5e9466['attributes'][_0x3c27('0x33')]?_0x5e9466['attributes']:_0x124212['model'];_0x5e9466[_0x3c27('0x36')]=qs[_0x3c27('0x37')](_0x1c44eb[_0x3c27('0x2d')][_0x3c27('0x37')]);_0x5e9466[_0x3c27('0x3a')]=qs[_0x3c27('0x2e')](_[_0x3c27('0x38')](_0x1c44eb[_0x3c27('0x2d')],_0x124212[_0x3c27('0x2e')]));if(_0x1c44eb[_0x3c27('0x2d')][_0x3c27('0x39')]){_0x5e9466[_0x3c27('0x3a')]=_[_0x3c27('0x3c')](_0x5e9466[_0x3c27('0x3a')],{'$or':_['map'](_0x5e9466[_0x3c27('0x30')],function(_0x585d14){var _0x313064={};_0x313064[_0x585d14]={'$like':'%'+_0x1c44eb[_0x3c27('0x2d')][_0x3c27('0x39')]+'%'};return _0x313064;})});}_0x5e9466=_[_0x3c27('0x3c')]({},_0x5e9466,_0x1c44eb[_0x3c27('0x3d')]);return _0x98eb4f['getFields'](_0x5e9466);}})[_0x3c27('0x22')](function(_0x5a1c0e){if(_0x5a1c0e){_0x296472=_0x5a1c0e['length'];if(!_0x1c44eb['query']['hasOwnProperty'](_0x3c27('0x35'))){_0x5e9466[_0x3c27('0x19')]=qs[_0x3c27('0x19')](_0x1c44eb[_0x3c27('0x2d')]['limit']);_0x5e9466[_0x3c27('0x17')]=qs[_0x3c27('0x17')](_0x1c44eb[_0x3c27('0x2d')]['offset']);}return _0x98eb4f[_0x3c27('0x48')](_0x5e9466);}})[_0x3c27('0x22')](function(_0x4cfd70){if(_0x4cfd70){return _0x4cfd70?{'count':_0x296472,'rows':_0x4cfd70}:null;}})[_0x3c27('0x22')](respondWithResult(_0x41932e,null))[_0x3c27('0x42')](handleError(_0x41932e,null));};exports[_0x3c27('0x4a')]=function(_0x215ac7,_0x266c4a,_0x45a077){var _0x15fd97={};var _0x508251={};var _0x2aacdc;var _0x31d804;return db[_0x3c27('0x28')]['findOne']({'where':{'id':_0x215ac7[_0x3c27('0x43')]['id']}})['then'](handleEntityNotFound(_0x266c4a,null))['then'](function(_0x3eb991){if(_0x3eb991){_0x2aacdc=_0x3eb991;_0x508251[_0x3c27('0x31')]=_[_0x3c27('0x2c')](db[_0x3c27('0x4b')][_0x3c27('0x29')]);_0x508251['query']=_[_0x3c27('0x2c')](_0x215ac7[_0x3c27('0x2d')]);_0x508251[_0x3c27('0x2e')]=_[_0x3c27('0x2f')](_0x508251[_0x3c27('0x31')],_0x508251[_0x3c27('0x2d')]);_0x15fd97['attributes']=_[_0x3c27('0x2f')](_0x508251[_0x3c27('0x31')],qs['fields'](_0x215ac7['query'][_0x3c27('0x32')]));_0x15fd97[_0x3c27('0x30')]=_0x15fd97[_0x3c27('0x30')]['length']?_0x15fd97[_0x3c27('0x30')]:_0x508251['model'];_0x15fd97[_0x3c27('0x36')]=qs[_0x3c27('0x37')](_0x215ac7[_0x3c27('0x2d')]['sort']);_0x15fd97[_0x3c27('0x3a')]=qs['filters'](_['pick'](_0x215ac7[_0x3c27('0x2d')],_0x508251['filters']));if(_0x215ac7[_0x3c27('0x2d')][_0x3c27('0x39')]){_0x15fd97[_0x3c27('0x3a')]=_[_0x3c27('0x3c')](_0x15fd97[_0x3c27('0x3a')],{'$or':_[_0x3c27('0x27')](_0x15fd97[_0x3c27('0x30')],function(_0x42c7c5){var _0x607ad2={};_0x607ad2[_0x42c7c5]={'$like':'%'+_0x215ac7['query'][_0x3c27('0x39')]+'%'};return _0x607ad2;})});}_0x15fd97=_['merge']({},_0x15fd97,_0x215ac7['options']);return _0x2aacdc[_0x3c27('0x4a')](_0x15fd97);}})[_0x3c27('0x22')](function(_0x1290a5){if(_0x1290a5){_0x31d804=_0x1290a5[_0x3c27('0x33')];if(!_0x215ac7[_0x3c27('0x2d')][_0x3c27('0x34')](_0x3c27('0x35'))){_0x15fd97['limit']=qs[_0x3c27('0x19')](_0x215ac7[_0x3c27('0x2d')]['limit']);_0x15fd97[_0x3c27('0x17')]=qs[_0x3c27('0x17')](_0x215ac7[_0x3c27('0x2d')]['offset']);}return _0x2aacdc['getSubjects'](_0x15fd97);}})[_0x3c27('0x22')](function(_0x5551a8){if(_0x5551a8){return _0x5551a8?{'count':_0x31d804,'rows':_0x5551a8}:null;}})[_0x3c27('0x22')](respondWithResult(_0x266c4a,null))[_0x3c27('0x42')](handleError(_0x266c4a,null));};exports[_0x3c27('0x4c')]=function(_0x4d9d05,_0x58c7e6,_0x4ec219){var _0x2a63bb={};var _0x2ef7ca={};var _0xbd4a58;var _0x15ce1a;return db[_0x3c27('0x28')][_0x3c27('0x49')]({'where':{'id':_0x4d9d05['params']['id']}})[_0x3c27('0x22')](handleEntityNotFound(_0x58c7e6,null))['then'](function(_0x25d892){if(_0x25d892){_0xbd4a58=_0x25d892;_0x2ef7ca[_0x3c27('0x31')]=_['keys'](db[_0x3c27('0x4b')][_0x3c27('0x29')]);_0x2ef7ca['query']=_[_0x3c27('0x2c')](_0x4d9d05[_0x3c27('0x2d')]);_0x2ef7ca['filters']=_[_0x3c27('0x2f')](_0x2ef7ca[_0x3c27('0x31')],_0x2ef7ca[_0x3c27('0x2d')]);_0x2a63bb['attributes']=_[_0x3c27('0x2f')](_0x2ef7ca[_0x3c27('0x31')],qs[_0x3c27('0x32')](_0x4d9d05[_0x3c27('0x2d')]['fields']));_0x2a63bb['attributes']=_0x2a63bb[_0x3c27('0x30')][_0x3c27('0x33')]?_0x2a63bb[_0x3c27('0x30')]:_0x2ef7ca['model'];_0x2a63bb[_0x3c27('0x36')]=qs[_0x3c27('0x37')](_0x4d9d05[_0x3c27('0x2d')][_0x3c27('0x37')]);_0x2a63bb[_0x3c27('0x3a')]=qs[_0x3c27('0x2e')](_['pick'](_0x4d9d05['query'],_0x2ef7ca[_0x3c27('0x2e')]));if(_0x4d9d05[_0x3c27('0x2d')][_0x3c27('0x39')]){_0x2a63bb[_0x3c27('0x3a')]=_[_0x3c27('0x3c')](_0x2a63bb[_0x3c27('0x3a')],{'$or':_[_0x3c27('0x27')](_0x2a63bb[_0x3c27('0x30')],function(_0x38a5fb){var _0x33a686={};_0x33a686[_0x38a5fb]={'$like':'%'+_0x4d9d05['query']['filter']+'%'};return _0x33a686;})});}_0x2a63bb=_['merge']({},_0x2a63bb,_0x4d9d05[_0x3c27('0x3d')]);return _0xbd4a58[_0x3c27('0x4c')](_0x2a63bb);}})['then'](function(_0x5bc010){if(_0x5bc010){_0x15ce1a=_0x5bc010[_0x3c27('0x33')];if(!_0x4d9d05[_0x3c27('0x2d')]['hasOwnProperty'](_0x3c27('0x35'))){_0x2a63bb[_0x3c27('0x19')]=qs['limit'](_0x4d9d05['query'][_0x3c27('0x19')]);_0x2a63bb['offset']=qs['offset'](_0x4d9d05[_0x3c27('0x2d')][_0x3c27('0x17')]);}return _0xbd4a58['getDescriptions'](_0x2a63bb);}})[_0x3c27('0x22')](function(_0x30f59a){if(_0x30f59a){return _0x30f59a?{'count':_0x15ce1a,'rows':_0x30f59a}:null;}})[_0x3c27('0x22')](respondWithResult(_0x58c7e6,null))['catch'](handleError(_0x58c7e6,null));}; \ No newline at end of file +var _0x6006=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../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','json','reject','then','destroy','error','send','index','rawAttributes','fieldName','key','model','map','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','update','getFields','findOne','SugarcrmField','length','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x6006,0x1de));var _0x6600=function(_0x2e9f44,_0x454029){_0x2e9f44=_0x2e9f44-0x0;var _0x2f8ed8=_0x6006[_0x2e9f44];return _0x2f8ed8;};'use strict';var emlformat=require(_0x6600('0x0'));var rimraf=require(_0x6600('0x1'));var zipdir=require(_0x6600('0x2'));var jsonpatch=require(_0x6600('0x3'));var rp=require(_0x6600('0x4'));var moment=require(_0x6600('0x5'));var BPromise=require(_0x6600('0x6'));var Mustache=require('mustache');var util=require(_0x6600('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6600('0x8'));var ejs=require(_0x6600('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6600('0xa'));var squel=require(_0x6600('0xb'));var crypto=require(_0x6600('0xc'));var jsforce=require(_0x6600('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6600('0xe'));var Papa=require('papaparse');var Redis=require(_0x6600('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6600('0x10'));var as=require(_0x6600('0x11'));var hardwareService=require(_0x6600('0x12'));var logger=require('../../config/logger')(_0x6600('0x13'));var utils=require(_0x6600('0x14'));var config=require(_0x6600('0x15'));var licenseUtil=require(_0x6600('0x16'));var db=require(_0x6600('0x17'))['db'];function respondWithStatusCode(_0x2a9761,_0x4c11d3){_0x4c11d3=_0x4c11d3||0xcc;return function(_0x4ba831){if(_0x4ba831){return _0x2a9761[_0x6600('0x18')](_0x4c11d3);}return _0x2a9761[_0x6600('0x19')](_0x4c11d3)[_0x6600('0x1a')]();};}function respondWithResult(_0x5d66ae,_0x25f0f4){_0x25f0f4=_0x25f0f4||0xc8;return function(_0x32e555){if(_0x32e555){return _0x5d66ae['status'](_0x25f0f4)['json'](_0x32e555);}};}function respondWithFilteredResult(_0x2e7ae1,_0xc246f2){return function(_0x322bcf){if(_0x322bcf){var _0x56dac9=typeof _0xc246f2[_0x6600('0x1b')]===_0x6600('0x1c')&&typeof _0xc246f2[_0x6600('0x1d')]===_0x6600('0x1c');var _0x333fc1=_0x322bcf[_0x6600('0x1e')];var _0x565b6c=_0x56dac9?0x0:_0xc246f2[_0x6600('0x1b')];var _0x112e6a=_0x56dac9?_0x322bcf[_0x6600('0x1e')]:_0xc246f2[_0x6600('0x1b')]+_0xc246f2[_0x6600('0x1d')];var _0x25ad66;if(_0x112e6a>=_0x333fc1){_0x112e6a=_0x333fc1;_0x25ad66=0xc8;}else{_0x25ad66=0xce;}_0x2e7ae1[_0x6600('0x19')](_0x25ad66);return _0x2e7ae1[_0x6600('0x1f')](_0x6600('0x20'),_0x565b6c+'-'+_0x112e6a+'/'+_0x333fc1)[_0x6600('0x21')](_0x322bcf);}return null;};}function patchUpdates(_0x1f3ba6){return function(_0x2de722){try{jsonpatch['apply'](_0x2de722,_0x1f3ba6,!![]);}catch(_0x5cf4e2){return BPromise[_0x6600('0x22')](_0x5cf4e2);}return _0x2de722['save']();};}function saveUpdates(_0x89c3fa,_0x14bc44){return function(_0x281869){if(_0x281869){return _0x281869['update'](_0x89c3fa)[_0x6600('0x23')](function(_0x5ebd3e){return _0x5ebd3e;});}return null;};}function removeEntity(_0x167d61,_0x33e49c){return function(_0x57b101){if(_0x57b101){return _0x57b101[_0x6600('0x24')]()['then'](function(){_0x167d61[_0x6600('0x19')](0xcc)[_0x6600('0x1a')]();});}};}function handleEntityNotFound(_0x1cdf5a,_0x16198c){return function(_0x41d087){if(!_0x41d087){_0x1cdf5a['sendStatus'](0x194);}return _0x41d087;};}function handleError(_0x2e4129,_0x4189a2){_0x4189a2=_0x4189a2||0x1f4;return function(_0x48d60e){logger[_0x6600('0x25')](_0x48d60e['stack']);if(_0x48d60e['name']){delete _0x48d60e['name'];}_0x2e4129[_0x6600('0x19')](_0x4189a2)[_0x6600('0x26')](_0x48d60e);};}exports[_0x6600('0x27')]=function(_0x514538,_0x56052c){var _0x2ca9a0={},_0x4c773a={},_0x51c207={'count':0x0,'rows':[]};var _0x436462=_['map'](db['SugarcrmConfiguration'][_0x6600('0x28')],function(_0x52eee3){return{'name':_0x52eee3[_0x6600('0x29')],'type':_0x52eee3['type'][_0x6600('0x2a')]};});_0x4c773a[_0x6600('0x2b')]=_[_0x6600('0x2c')](_0x436462,_0x6600('0x2d'));_0x4c773a[_0x6600('0x2e')]=_['keys'](_0x514538[_0x6600('0x2e')]);_0x4c773a['filters']=_[_0x6600('0x2f')](_0x4c773a[_0x6600('0x2b')],_0x4c773a['query']);_0x2ca9a0['attributes']=_[_0x6600('0x2f')](_0x4c773a[_0x6600('0x2b')],qs['fields'](_0x514538[_0x6600('0x2e')][_0x6600('0x30')]));_0x2ca9a0[_0x6600('0x31')]=_0x2ca9a0[_0x6600('0x31')]['length']?_0x2ca9a0[_0x6600('0x31')]:_0x4c773a['model'];if(!_0x514538['query'][_0x6600('0x32')](_0x6600('0x33'))){_0x2ca9a0[_0x6600('0x1d')]=qs[_0x6600('0x1d')](_0x514538[_0x6600('0x2e')][_0x6600('0x1d')]);_0x2ca9a0[_0x6600('0x1b')]=qs[_0x6600('0x1b')](_0x514538['query']['offset']);}_0x2ca9a0[_0x6600('0x34')]=qs[_0x6600('0x35')](_0x514538['query']['sort']);_0x2ca9a0[_0x6600('0x36')]=qs['filters'](_['pick'](_0x514538['query'],_0x4c773a[_0x6600('0x37')]),_0x436462);if(_0x514538[_0x6600('0x2e')][_0x6600('0x38')]){_0x2ca9a0[_0x6600('0x36')]=_[_0x6600('0x39')](_0x2ca9a0[_0x6600('0x36')],{'$or':_[_0x6600('0x2c')](_0x436462,function(_0x529e6a){if(_0x529e6a[_0x6600('0x3a')]!==_0x6600('0x3b')){var _0x8386ff={};_0x8386ff[_0x529e6a[_0x6600('0x2d')]]={'$like':'%'+_0x514538[_0x6600('0x2e')][_0x6600('0x38')]+'%'};return _0x8386ff;}})});}_0x2ca9a0=_['merge']({},_0x2ca9a0,_0x514538['options']);var _0x663c14={'where':_0x2ca9a0['where']};return db[_0x6600('0x3c')][_0x6600('0x1e')](_0x663c14)[_0x6600('0x23')](function(_0x37c826){_0x51c207[_0x6600('0x1e')]=_0x37c826;if(_0x514538[_0x6600('0x2e')][_0x6600('0x3d')]){_0x2ca9a0[_0x6600('0x3e')]=[{'all':!![]}];}return db[_0x6600('0x3c')][_0x6600('0x3f')](_0x2ca9a0);})[_0x6600('0x23')](function(_0x21a295){_0x51c207[_0x6600('0x40')]=_0x21a295;return _0x51c207;})[_0x6600('0x23')](respondWithFilteredResult(_0x56052c,_0x2ca9a0))['catch'](handleError(_0x56052c,null));};exports[_0x6600('0x41')]=function(_0x5d0d32,_0x11c545){var _0x155d70={'raw':![],'where':{'id':_0x5d0d32[_0x6600('0x42')]['id']}},_0x518f88={};_0x518f88['model']=_[_0x6600('0x43')](db['SugarcrmConfiguration']['rawAttributes']);_0x518f88[_0x6600('0x2e')]=_[_0x6600('0x43')](_0x5d0d32[_0x6600('0x2e')]);_0x518f88[_0x6600('0x37')]=_[_0x6600('0x2f')](_0x518f88[_0x6600('0x2b')],_0x518f88[_0x6600('0x2e')]);_0x155d70[_0x6600('0x31')]=_[_0x6600('0x2f')](_0x518f88[_0x6600('0x2b')],qs[_0x6600('0x30')](_0x5d0d32[_0x6600('0x2e')][_0x6600('0x30')]));_0x155d70['attributes']=_0x155d70[_0x6600('0x31')]['length']?_0x155d70[_0x6600('0x31')]:_0x518f88[_0x6600('0x2b')];if(_0x5d0d32[_0x6600('0x2e')]['includeAll']){_0x155d70[_0x6600('0x3e')]=[{'all':!![]}];}_0x155d70=_[_0x6600('0x39')]({},_0x155d70,_0x5d0d32[_0x6600('0x44')]);return db[_0x6600('0x3c')][_0x6600('0x45')](_0x155d70)[_0x6600('0x23')](handleEntityNotFound(_0x11c545,null))['then'](respondWithResult(_0x11c545,null))['catch'](handleError(_0x11c545,null));};exports[_0x6600('0x46')]=function(_0x2c9f98,_0x1e7894){return db[_0x6600('0x3c')][_0x6600('0x46')](_0x2c9f98[_0x6600('0x47')],{})[_0x6600('0x23')](respondWithResult(_0x1e7894,0xc9))[_0x6600('0x48')](handleError(_0x1e7894,null));};exports[_0x6600('0x49')]=function(_0x1c894b,_0x44acbf){if(_0x1c894b[_0x6600('0x47')]['id']){delete _0x1c894b['body']['id'];}return db[_0x6600('0x3c')][_0x6600('0x45')]({'where':{'id':_0x1c894b[_0x6600('0x42')]['id']}})[_0x6600('0x23')](handleEntityNotFound(_0x44acbf,null))[_0x6600('0x23')](saveUpdates(_0x1c894b[_0x6600('0x47')],null))[_0x6600('0x23')](respondWithResult(_0x44acbf,null))[_0x6600('0x48')](handleError(_0x44acbf,null));};exports[_0x6600('0x24')]=function(_0x554186,_0x1bd6c2){return db[_0x6600('0x3c')][_0x6600('0x45')]({'where':{'id':_0x554186['params']['id']}})['then'](handleEntityNotFound(_0x1bd6c2,null))[_0x6600('0x23')](removeEntity(_0x1bd6c2,null))['catch'](handleError(_0x1bd6c2,null));};exports[_0x6600('0x4a')]=function(_0x50c01d,_0x53d4b0,_0x1dd662){var _0x3d8137={};var _0x56f005={};var _0x297c3d;var _0x1096a4;return db[_0x6600('0x3c')][_0x6600('0x4b')]({'where':{'id':_0x50c01d['params']['id']}})[_0x6600('0x23')](handleEntityNotFound(_0x53d4b0,null))['then'](function(_0x23cd8d){if(_0x23cd8d){_0x297c3d=_0x23cd8d;_0x56f005[_0x6600('0x2b')]=_[_0x6600('0x43')](db[_0x6600('0x4c')][_0x6600('0x28')]);_0x56f005[_0x6600('0x2e')]=_['keys'](_0x50c01d[_0x6600('0x2e')]);_0x56f005['filters']=_[_0x6600('0x2f')](_0x56f005[_0x6600('0x2b')],_0x56f005[_0x6600('0x2e')]);_0x3d8137['attributes']=_[_0x6600('0x2f')](_0x56f005['model'],qs['fields'](_0x50c01d[_0x6600('0x2e')][_0x6600('0x30')]));_0x3d8137[_0x6600('0x31')]=_0x3d8137[_0x6600('0x31')][_0x6600('0x4d')]?_0x3d8137[_0x6600('0x31')]:_0x56f005[_0x6600('0x2b')];_0x3d8137[_0x6600('0x34')]=qs[_0x6600('0x35')](_0x50c01d['query'][_0x6600('0x35')]);_0x3d8137['where']=qs[_0x6600('0x37')](_[_0x6600('0x4e')](_0x50c01d[_0x6600('0x2e')],_0x56f005[_0x6600('0x37')]));if(_0x50c01d['query']['filter']){_0x3d8137[_0x6600('0x36')]=_[_0x6600('0x39')](_0x3d8137['where'],{'$or':_[_0x6600('0x2c')](_0x3d8137[_0x6600('0x31')],function(_0x580c3b){var _0x58b280={};_0x58b280[_0x580c3b]={'$like':'%'+_0x50c01d[_0x6600('0x2e')][_0x6600('0x38')]+'%'};return _0x58b280;})});}_0x3d8137=_[_0x6600('0x39')]({},_0x3d8137,_0x50c01d[_0x6600('0x44')]);return _0x297c3d[_0x6600('0x4a')](_0x3d8137);}})[_0x6600('0x23')](function(_0x594c32){if(_0x594c32){_0x1096a4=_0x594c32[_0x6600('0x4d')];if(!_0x50c01d['query'][_0x6600('0x32')](_0x6600('0x33'))){_0x3d8137[_0x6600('0x1d')]=qs['limit'](_0x50c01d[_0x6600('0x2e')][_0x6600('0x1d')]);_0x3d8137[_0x6600('0x1b')]=qs[_0x6600('0x1b')](_0x50c01d['query'][_0x6600('0x1b')]);}return _0x297c3d['getFields'](_0x3d8137);}})[_0x6600('0x23')](function(_0x2bb632){if(_0x2bb632){return _0x2bb632?{'count':_0x1096a4,'rows':_0x2bb632}:null;}})[_0x6600('0x23')](respondWithResult(_0x53d4b0,null))[_0x6600('0x48')](handleError(_0x53d4b0,null));};exports[_0x6600('0x4f')]=function(_0xeeadee,_0x1cf00b,_0x586404){var _0x3d0106={};var _0x2489c3={};var _0x48769c;var _0x32f4a9;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0xeeadee['params']['id']}})[_0x6600('0x23')](handleEntityNotFound(_0x1cf00b,null))[_0x6600('0x23')](function(_0x586ef3){if(_0x586ef3){_0x48769c=_0x586ef3;_0x2489c3[_0x6600('0x2b')]=_[_0x6600('0x43')](db[_0x6600('0x4c')][_0x6600('0x28')]);_0x2489c3[_0x6600('0x2e')]=_[_0x6600('0x43')](_0xeeadee[_0x6600('0x2e')]);_0x2489c3[_0x6600('0x37')]=_[_0x6600('0x2f')](_0x2489c3[_0x6600('0x2b')],_0x2489c3[_0x6600('0x2e')]);_0x3d0106[_0x6600('0x31')]=_[_0x6600('0x2f')](_0x2489c3['model'],qs[_0x6600('0x30')](_0xeeadee[_0x6600('0x2e')][_0x6600('0x30')]));_0x3d0106[_0x6600('0x31')]=_0x3d0106[_0x6600('0x31')]['length']?_0x3d0106[_0x6600('0x31')]:_0x2489c3['model'];_0x3d0106[_0x6600('0x34')]=qs[_0x6600('0x35')](_0xeeadee[_0x6600('0x2e')][_0x6600('0x35')]);_0x3d0106['where']=qs[_0x6600('0x37')](_[_0x6600('0x4e')](_0xeeadee[_0x6600('0x2e')],_0x2489c3['filters']));if(_0xeeadee[_0x6600('0x2e')]['filter']){_0x3d0106[_0x6600('0x36')]=_[_0x6600('0x39')](_0x3d0106[_0x6600('0x36')],{'$or':_[_0x6600('0x2c')](_0x3d0106[_0x6600('0x31')],function(_0x206224){var _0x187d36={};_0x187d36[_0x206224]={'$like':'%'+_0xeeadee[_0x6600('0x2e')][_0x6600('0x38')]+'%'};return _0x187d36;})});}_0x3d0106=_[_0x6600('0x39')]({},_0x3d0106,_0xeeadee[_0x6600('0x44')]);return _0x48769c['getSubjects'](_0x3d0106);}})['then'](function(_0x19251f){if(_0x19251f){_0x32f4a9=_0x19251f['length'];if(!_0xeeadee[_0x6600('0x2e')][_0x6600('0x32')](_0x6600('0x33'))){_0x3d0106[_0x6600('0x1d')]=qs[_0x6600('0x1d')](_0xeeadee[_0x6600('0x2e')][_0x6600('0x1d')]);_0x3d0106[_0x6600('0x1b')]=qs[_0x6600('0x1b')](_0xeeadee[_0x6600('0x2e')][_0x6600('0x1b')]);}return _0x48769c[_0x6600('0x4f')](_0x3d0106);}})['then'](function(_0x54ece0){if(_0x54ece0){return _0x54ece0?{'count':_0x32f4a9,'rows':_0x54ece0}:null;}})[_0x6600('0x23')](respondWithResult(_0x1cf00b,null))[_0x6600('0x48')](handleError(_0x1cf00b,null));};exports[_0x6600('0x50')]=function(_0x107026,_0x35c8ea,_0x3cd6e9){var _0x212bd2={};var _0x232de0={};var _0x5a34e4;var _0x6596c2;return db[_0x6600('0x3c')]['findOne']({'where':{'id':_0x107026['params']['id']}})[_0x6600('0x23')](handleEntityNotFound(_0x35c8ea,null))[_0x6600('0x23')](function(_0x5c098a){if(_0x5c098a){_0x5a34e4=_0x5c098a;_0x232de0[_0x6600('0x2b')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x232de0[_0x6600('0x2e')]=_[_0x6600('0x43')](_0x107026[_0x6600('0x2e')]);_0x232de0['filters']=_[_0x6600('0x2f')](_0x232de0['model'],_0x232de0[_0x6600('0x2e')]);_0x212bd2['attributes']=_['intersection'](_0x232de0[_0x6600('0x2b')],qs['fields'](_0x107026[_0x6600('0x2e')][_0x6600('0x30')]));_0x212bd2[_0x6600('0x31')]=_0x212bd2['attributes'][_0x6600('0x4d')]?_0x212bd2[_0x6600('0x31')]:_0x232de0[_0x6600('0x2b')];_0x212bd2[_0x6600('0x34')]=qs[_0x6600('0x35')](_0x107026[_0x6600('0x2e')][_0x6600('0x35')]);_0x212bd2[_0x6600('0x36')]=qs[_0x6600('0x37')](_[_0x6600('0x4e')](_0x107026[_0x6600('0x2e')],_0x232de0[_0x6600('0x37')]));if(_0x107026[_0x6600('0x2e')][_0x6600('0x38')]){_0x212bd2[_0x6600('0x36')]=_[_0x6600('0x39')](_0x212bd2[_0x6600('0x36')],{'$or':_[_0x6600('0x2c')](_0x212bd2[_0x6600('0x31')],function(_0x262e89){var _0x331016={};_0x331016[_0x262e89]={'$like':'%'+_0x107026[_0x6600('0x2e')][_0x6600('0x38')]+'%'};return _0x331016;})});}_0x212bd2=_['merge']({},_0x212bd2,_0x107026[_0x6600('0x44')]);return _0x5a34e4[_0x6600('0x50')](_0x212bd2);}})[_0x6600('0x23')](function(_0x5367ad){if(_0x5367ad){_0x6596c2=_0x5367ad[_0x6600('0x4d')];if(!_0x107026[_0x6600('0x2e')][_0x6600('0x32')](_0x6600('0x33'))){_0x212bd2[_0x6600('0x1d')]=qs['limit'](_0x107026[_0x6600('0x2e')][_0x6600('0x1d')]);_0x212bd2[_0x6600('0x1b')]=qs['offset'](_0x107026[_0x6600('0x2e')][_0x6600('0x1b')]);}return _0x5a34e4[_0x6600('0x50')](_0x212bd2);}})[_0x6600('0x23')](function(_0x28f898){if(_0x28f898){return _0x28f898?{'count':_0x6596c2,'rows':_0x28f898}:null;}})[_0x6600('0x23')](respondWithResult(_0x35c8ea,null))[_0x6600('0x48')](handleError(_0x35c8ea,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e04806c..4947980 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 _0xf1ce=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x192218,_0x1c5c87){var _0x1f3af0=function(_0x429258){while(--_0x429258){_0x192218['push'](_0x192218['shift']());}};_0x1f3af0(++_0x1c5c87);}(_0xf1ce,0x125));var _0xef1c=function(_0x56d880,_0x17e3ce){_0x56d880=_0x56d880-0x0;var _0x4c1965=_0xf1ce[_0x56d880];return _0x4c1965;};'use strict';var _=require(_0xef1c('0x0'));var util=require(_0xef1c('0x1'));var logger=require(_0xef1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xef1c('0x3'));var rp=require(_0xef1c('0x4'));var fs=require('fs');var path=require(_0xef1c('0x5'));var rimraf=require('rimraf');var config=require(_0xef1c('0x6'));var attributes=require(_0xef1c('0x7'));module[_0xef1c('0x8')]=function(_0x2603cc,_0x5b6cae){return _0x2603cc[_0xef1c('0x9')](_0xef1c('0xa'),attributes,{'tableName':_0xef1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4d9=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2dfb87,_0x2feb86){var _0x9898ab=function(_0x5b46da){while(--_0x5b46da){_0x2dfb87['push'](_0x2dfb87['shift']());}};_0x9898ab(++_0x2feb86);}(_0xf4d9,0xae));var _0x9f4d=function(_0x3a52f3,_0xe7c00a){_0x3a52f3=_0x3a52f3-0x0;var _0x1d282a=_0xf4d9[_0x3a52f3];return _0x1d282a;};'use strict';var _=require(_0x9f4d('0x0'));var util=require(_0x9f4d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9f4d('0x2'));var BPromise=require(_0x9f4d('0x3'));var rp=require(_0x9f4d('0x4'));var fs=require('fs');var path=require(_0x9f4d('0x5'));var rimraf=require('rimraf');var config=require(_0x9f4d('0x6'));var attributes=require(_0x9f4d('0x7'));module[_0x9f4d('0x8')]=function(_0x49cc5a,_0x5af7ed){return _0x49cc5a['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','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 65dce27..3d444e5 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 _0x098a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x098a,0x1c9));var _0xa098=function(_0x1770b3,_0x8cd87b){_0x1770b3=_0x1770b3-0x0;var _0x5e367f=_0x098a[_0x1770b3];return _0x5e367f;};'use strict';var _=require(_0xa098('0x0'));var util=require(_0xa098('0x1'));var moment=require(_0xa098('0x2'));var BPromise=require(_0xa098('0x3'));var rs=require(_0xa098('0x4'));var fs=require('fs');var Redis=require(_0xa098('0x5'));var db=require(_0xa098('0x6'))['db'];var utils=require(_0xa098('0x7'));var logger=require('../../config/logger')(_0xa098('0x8'));var config=require(_0xa098('0x9'));var jayson=require(_0xa098('0xa'));var client=jayson[_0xa098('0xb')][_0xa098('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x63aea5,_0x3a1aa9,_0x2cc967){return new BPromise(function(_0x4b6956,_0x493294){return client[_0xa098('0xd')](_0x63aea5,_0x2cc967)['then'](function(_0x443bf3){logger['info'](_0xa098('0xe'),_0x3a1aa9,_0xa098('0xf'));logger['debug'](_0xa098('0x10'),_0x3a1aa9,_0xa098('0xf'),JSON[_0xa098('0x11')](_0x443bf3));if(_0x443bf3[_0xa098('0x12')]){if(_0x443bf3[_0xa098('0x12')][_0xa098('0x13')]===0x1f4){logger[_0xa098('0x12')](_0xa098('0xe'),_0x3a1aa9,_0x443bf3[_0xa098('0x12')][_0xa098('0x14')]);return _0x493294(_0x443bf3[_0xa098('0x12')][_0xa098('0x14')]);}logger[_0xa098('0x12')](_0xa098('0xe'),_0x3a1aa9,_0x443bf3['error']['message']);return _0x4b6956(_0x443bf3[_0xa098('0x12')][_0xa098('0x14')]);}else{logger[_0xa098('0x15')](_0xa098('0xe'),_0x3a1aa9,'request\x20sent');_0x4b6956(_0x443bf3[_0xa098('0x16')]['message']);}})['catch'](function(_0x23dcf1){logger[_0xa098('0x12')](_0xa098('0xe'),_0x3a1aa9,_0x23dcf1);_0x493294(_0x23dcf1);});});} \ No newline at end of file +var _0x33ff=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x4a7f7c,_0x345029){var _0x66e958=function(_0x45d130){while(--_0x45d130){_0x4a7f7c['push'](_0x4a7f7c['shift']());}};_0x66e958(++_0x345029);}(_0x33ff,0x167));var _0xf33f=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x33ff[_0x162780];return _0x1ea2dc;};'use strict';var _=require('lodash');var util=require(_0xf33f('0x0'));var moment=require(_0xf33f('0x1'));var BPromise=require(_0xf33f('0x2'));var rs=require(_0xf33f('0x3'));var fs=require('fs');var Redis=require(_0xf33f('0x4'));var db=require(_0xf33f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf33f('0x6'))(_0xf33f('0x7'));var config=require(_0xf33f('0x8'));var jayson=require(_0xf33f('0x9'));var client=jayson[_0xf33f('0xa')][_0xf33f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3ba5,_0x38821b,_0x2354bc){return new BPromise(function(_0x5b695d,_0x58e502){return client[_0xf33f('0xc')](_0x2d3ba5,_0x2354bc)[_0xf33f('0xd')](function(_0x34d254){logger[_0xf33f('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x38821b,'request\x20sent');logger[_0xf33f('0xf')](_0xf33f('0x10'),_0x38821b,_0xf33f('0x11'),JSON[_0xf33f('0x12')](_0x34d254));if(_0x34d254[_0xf33f('0x13')]){if(_0x34d254[_0xf33f('0x13')]['code']===0x1f4){logger[_0xf33f('0x13')](_0xf33f('0x14'),_0x38821b,_0x34d254[_0xf33f('0x13')]['message']);return _0x58e502(_0x34d254[_0xf33f('0x13')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x38821b,_0x34d254[_0xf33f('0x13')][_0xf33f('0x15')]);return _0x5b695d(_0x34d254[_0xf33f('0x13')][_0xf33f('0x15')]);}else{logger[_0xf33f('0xe')](_0xf33f('0x14'),_0x38821b,_0xf33f('0x11'));_0x5b695d(_0x34d254[_0xf33f('0x16')][_0xf33f('0x15')]);}})[_0xf33f('0x17')](function(_0x554300){logger[_0xf33f('0x13')](_0xf33f('0x14'),_0x38821b,_0x554300);_0x58e502(_0x554300);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index efb0547..0436da6 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 _0x5eae=['Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','post','create','destroy','exports','multer','path','connect-timeout','express'];(function(_0x220023,_0x13d821){var _0x26dee9=function(_0x347f50){while(--_0x347f50){_0x220023['push'](_0x220023['shift']());}};_0x26dee9(++_0x13d821);}(_0x5eae,0x8c));var _0xe5ea=function(_0x2b065a,_0x57d5e7){_0x2b065a=_0x2b065a-0x0;var _0x40abc9=_0x5eae[_0x2b065a];return _0x40abc9;};'use strict';var multer=require(_0xe5ea('0x0'));var util=require('util');var path=require(_0xe5ea('0x1'));var timeout=require(_0xe5ea('0x2'));var express=require(_0xe5ea('0x3'));var router=express[_0xe5ea('0x4')]();var fs_extra=require(_0xe5ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe5ea('0x6'));var config=require('../../config/environment');var controller=require(_0xe5ea('0x7'));router['get']('/',auth[_0xe5ea('0x8')](),controller[_0xe5ea('0x9')]);router[_0xe5ea('0xa')](_0xe5ea('0xb'),auth[_0xe5ea('0x8')](),controller['show']);router[_0xe5ea('0xc')]('/',auth['isAuthenticated'](),controller[_0xe5ea('0xd')]);router['put'](_0xe5ea('0xb'),auth[_0xe5ea('0x8')](),controller['update']);router['delete'](_0xe5ea('0xb'),auth[_0xe5ea('0x8')](),controller[_0xe5ea('0xe')]);module[_0xe5ea('0xf')]=router; \ No newline at end of file +var _0xf0b1=['destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x53a2e6,_0xcaff5c){var _0x4f13ac=function(_0x2c4954){while(--_0x2c4954){_0x53a2e6['push'](_0x53a2e6['shift']());}};_0x4f13ac(++_0xcaff5c);}(_0xf0b1,0x189));var _0x1f0b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf0b1[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x1f0b('0x0'));var path=require(_0x1f0b('0x1'));var timeout=require(_0x1f0b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1f0b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1f0b('0x4'));var config=require('../../config/environment');var controller=require(_0x1f0b('0x5'));router[_0x1f0b('0x6')]('/',auth[_0x1f0b('0x7')](),controller[_0x1f0b('0x8')]);router['get'](_0x1f0b('0x9'),auth[_0x1f0b('0x7')](),controller[_0x1f0b('0xa')]);router[_0x1f0b('0xb')]('/',auth[_0x1f0b('0x7')](),controller['create']);router[_0x1f0b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1f0b('0xd')]);router[_0x1f0b('0xe')](_0x1f0b('0x9'),auth[_0x1f0b('0x7')](),controller[_0x1f0b('0xf')]);module[_0x1f0b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 58a50bd..d78ff38 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 _0x51a8=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x141766,_0x2ca08e){var _0x28d693=function(_0x1acbee){while(--_0x1acbee){_0x141766['push'](_0x141766['shift']());}};_0x28d693(++_0x2ca08e);}(_0x51a8,0x15b));var _0x851a=function(_0x3f32d2,_0x45cc35){_0x3f32d2=_0x3f32d2-0x0;var _0x4b1333=_0x51a8[_0x3f32d2];return _0x4b1333;};'use strict';var Sequelize=require(_0x851a('0x0'));module[_0x851a('0x1')]={'type':{'type':Sequelize[_0x851a('0x2')](_0x851a('0x3'),_0x851a('0x4'),'customVariable',_0x851a('0x5'),_0x851a('0x6')),'defaultValue':_0x851a('0x3')},'content':{'type':Sequelize[_0x851a('0x7')]},'key':{'type':Sequelize[_0x851a('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x851a('0x3'),_0x851a('0x4'),_0x851a('0x8'))},'keyContent':{'type':Sequelize[_0x851a('0x7')]},'idField':{'type':Sequelize[_0x851a('0x7')]},'nameField':{'type':Sequelize[_0x851a('0x7')]},'customField':{'type':Sequelize[_0x851a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4728=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x27c28c,_0x49ba23){var _0x1f5669=function(_0x257683){while(--_0x257683){_0x27c28c['push'](_0x27c28c['shift']());}};_0x1f5669(++_0x49ba23);}(_0x4728,0x78));var _0x8472=function(_0x2001f5,_0xf957a1){_0x2001f5=_0x2001f5-0x0;var _0x3d94d6=_0x4728[_0x2001f5];return _0x3d94d6;};'use strict';var Sequelize=require(_0x8472('0x0'));module[_0x8472('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8472('0x2'),_0x8472('0x3'),_0x8472('0x4'),'keyValue',_0x8472('0x5')),'defaultValue':_0x8472('0x2')},'content':{'type':Sequelize[_0x8472('0x6')]},'key':{'type':Sequelize[_0x8472('0x6')]},'keyType':{'type':Sequelize[_0x8472('0x7')]('string',_0x8472('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8472('0x6')]},'idField':{'type':Sequelize[_0x8472('0x6')]},'nameField':{'type':Sequelize[_0x8472('0x6')]},'customField':{'type':Sequelize[_0x8472('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c38a51c..01835bd 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 _0xc3d7=['findAll','rows','catch','params','length','include','merge','find','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll'];(function(_0x5d24a8,_0x46a289){var _0x58d6a8=function(_0x2fd1c2){while(--_0x2fd1c2){_0x5d24a8['push'](_0x5d24a8['shift']());}};_0x58d6a8(++_0x46a289);}(_0xc3d7,0xeb));var _0x7c3d=function(_0x1ff0d9,_0xa476dd){_0x1ff0d9=_0x1ff0d9-0x0;var _0x5d46dd=_0xc3d7[_0x1ff0d9];return _0x5d46dd;};'use strict';var emlformat=require(_0x7c3d('0x0'));var rimraf=require(_0x7c3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c3d('0x2'));var rp=require(_0x7c3d('0x3'));var moment=require('moment');var BPromise=require(_0x7c3d('0x4'));var Mustache=require(_0x7c3d('0x5'));var util=require(_0x7c3d('0x6'));var path=require(_0x7c3d('0x7'));var sox=require(_0x7c3d('0x8'));var csv=require(_0x7c3d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c3d('0xa'));var _=require(_0x7c3d('0xb'));var squel=require(_0x7c3d('0xc'));var crypto=require(_0x7c3d('0xd'));var jsforce=require(_0x7c3d('0xe'));var deskjs=require(_0x7c3d('0xf'));var toCsv=require(_0x7c3d('0x9'));var querystring=require(_0x7c3d('0x10'));var Papa=require(_0x7c3d('0x11'));var Redis=require(_0x7c3d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c3d('0x13'));var hardwareService=require(_0x7c3d('0x14'));var logger=require(_0x7c3d('0x15'))(_0x7c3d('0x16'));var utils=require(_0x7c3d('0x17'));var config=require(_0x7c3d('0x18'));var licenseUtil=require(_0x7c3d('0x19'));var db=require(_0x7c3d('0x1a'))['db'];function respondWithStatusCode(_0x34b1ff,_0x330d28){_0x330d28=_0x330d28||0xcc;return function(_0x61f7f8){if(_0x61f7f8){return _0x34b1ff['sendStatus'](_0x330d28);}return _0x34b1ff[_0x7c3d('0x1b')](_0x330d28)['end']();};}function respondWithResult(_0x579b16,_0x1e6450){_0x1e6450=_0x1e6450||0xc8;return function(_0x15acb0){if(_0x15acb0){return _0x579b16['status'](_0x1e6450)[_0x7c3d('0x1c')](_0x15acb0);}};}function respondWithFilteredResult(_0x432e6d,_0x353455){return function(_0x1a8c95){if(_0x1a8c95){var _0x24930b=typeof _0x353455[_0x7c3d('0x1d')]===_0x7c3d('0x1e')&&typeof _0x353455[_0x7c3d('0x1f')]==='undefined';var _0x2389b1=_0x1a8c95[_0x7c3d('0x20')];var _0x46ddf9=_0x24930b?0x0:_0x353455[_0x7c3d('0x1d')];var _0x3734db=_0x24930b?_0x1a8c95[_0x7c3d('0x20')]:_0x353455[_0x7c3d('0x1d')]+_0x353455[_0x7c3d('0x1f')];var _0x16f7c5;if(_0x3734db>=_0x2389b1){_0x3734db=_0x2389b1;_0x16f7c5=0xc8;}else{_0x16f7c5=0xce;}_0x432e6d['status'](_0x16f7c5);return _0x432e6d[_0x7c3d('0x21')](_0x7c3d('0x22'),_0x46ddf9+'-'+_0x3734db+'/'+_0x2389b1)['json'](_0x1a8c95);}return null;};}function patchUpdates(_0x216144){return function(_0x1e21b9){try{jsonpatch[_0x7c3d('0x23')](_0x1e21b9,_0x216144,!![]);}catch(_0x40d700){return BPromise[_0x7c3d('0x24')](_0x40d700);}return _0x1e21b9[_0x7c3d('0x25')]();};}function saveUpdates(_0xcf0c3d,_0x227962){return function(_0x257b8d){if(_0x257b8d){return _0x257b8d[_0x7c3d('0x26')](_0xcf0c3d)['then'](function(_0x481f5b){return _0x481f5b;});}return null;};}function removeEntity(_0x3a6db2,_0x40e0b1){return function(_0x55be55){if(_0x55be55){return _0x55be55['destroy']()[_0x7c3d('0x27')](function(){_0x3a6db2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f594,_0x277320){return function(_0x5ccb0d){if(!_0x5ccb0d){_0x28f594['sendStatus'](0x194);}return _0x5ccb0d;};}function handleError(_0x17c403,_0x558e02){_0x558e02=_0x558e02||0x1f4;return function(_0x23dc70){logger[_0x7c3d('0x28')](_0x23dc70[_0x7c3d('0x29')]);if(_0x23dc70[_0x7c3d('0x2a')]){delete _0x23dc70[_0x7c3d('0x2a')];}_0x17c403[_0x7c3d('0x1b')](_0x558e02)[_0x7c3d('0x2b')](_0x23dc70);};}exports[_0x7c3d('0x2c')]=function(_0x5db01b,_0x3a9c55){var _0x5974a7={},_0x3e0d1d={},_0x1408ad={'count':0x0,'rows':[]};var _0x202f3b=_[_0x7c3d('0x2d')](db[_0x7c3d('0x2e')][_0x7c3d('0x2f')],function(_0x178974){return{'name':_0x178974[_0x7c3d('0x30')],'type':_0x178974['type']['key']};});_0x3e0d1d[_0x7c3d('0x31')]=_[_0x7c3d('0x2d')](_0x202f3b,_0x7c3d('0x2a'));_0x3e0d1d[_0x7c3d('0x32')]=_[_0x7c3d('0x33')](_0x5db01b[_0x7c3d('0x32')]);_0x3e0d1d[_0x7c3d('0x34')]=_[_0x7c3d('0x35')](_0x3e0d1d[_0x7c3d('0x31')],_0x3e0d1d[_0x7c3d('0x32')]);_0x5974a7['attributes']=_['intersection'](_0x3e0d1d[_0x7c3d('0x31')],qs['fields'](_0x5db01b['query'][_0x7c3d('0x36')]));_0x5974a7['attributes']=_0x5974a7[_0x7c3d('0x37')]['length']?_0x5974a7[_0x7c3d('0x37')]:_0x3e0d1d[_0x7c3d('0x31')];if(!_0x5db01b[_0x7c3d('0x32')][_0x7c3d('0x38')]('nolimit')){_0x5974a7[_0x7c3d('0x1f')]=qs[_0x7c3d('0x1f')](_0x5db01b['query'][_0x7c3d('0x1f')]);_0x5974a7[_0x7c3d('0x1d')]=qs[_0x7c3d('0x1d')](_0x5db01b['query'][_0x7c3d('0x1d')]);}_0x5974a7[_0x7c3d('0x39')]=qs[_0x7c3d('0x3a')](_0x5db01b[_0x7c3d('0x32')]['sort']);_0x5974a7[_0x7c3d('0x3b')]=qs[_0x7c3d('0x34')](_[_0x7c3d('0x3c')](_0x5db01b[_0x7c3d('0x32')],_0x3e0d1d['filters']),_0x202f3b);if(_0x5db01b[_0x7c3d('0x32')][_0x7c3d('0x3d')]){_0x5974a7[_0x7c3d('0x3b')]=_['merge'](_0x5974a7[_0x7c3d('0x3b')],{'$or':_['map'](_0x202f3b,function(_0x3896c0){if(_0x3896c0['type']!==_0x7c3d('0x3e')){var _0x124a92={};_0x124a92[_0x3896c0[_0x7c3d('0x2a')]]={'$like':'%'+_0x5db01b[_0x7c3d('0x32')][_0x7c3d('0x3d')]+'%'};return _0x124a92;}})});}_0x5974a7=_['merge']({},_0x5974a7,_0x5db01b[_0x7c3d('0x3f')]);var _0x313beb={'where':_0x5974a7[_0x7c3d('0x3b')]};return db[_0x7c3d('0x2e')][_0x7c3d('0x20')](_0x313beb)['then'](function(_0x5cc3ef){_0x1408ad[_0x7c3d('0x20')]=_0x5cc3ef;if(_0x5db01b[_0x7c3d('0x32')][_0x7c3d('0x40')]){_0x5974a7['include']=[{'all':!![]}];}return db[_0x7c3d('0x2e')][_0x7c3d('0x41')](_0x5974a7);})['then'](function(_0x4ac8b6){_0x1408ad[_0x7c3d('0x42')]=_0x4ac8b6;return _0x1408ad;})[_0x7c3d('0x27')](respondWithFilteredResult(_0x3a9c55,_0x5974a7))[_0x7c3d('0x43')](handleError(_0x3a9c55,null));};exports['show']=function(_0x4cfe3c,_0x538c08){var _0xcef230={'raw':!![],'where':{'id':_0x4cfe3c[_0x7c3d('0x44')]['id']}},_0x195764={};_0x195764[_0x7c3d('0x31')]=_[_0x7c3d('0x33')](db['SugarcrmField']['rawAttributes']);_0x195764['query']=_['keys'](_0x4cfe3c[_0x7c3d('0x32')]);_0x195764[_0x7c3d('0x34')]=_[_0x7c3d('0x35')](_0x195764[_0x7c3d('0x31')],_0x195764[_0x7c3d('0x32')]);_0xcef230[_0x7c3d('0x37')]=_[_0x7c3d('0x35')](_0x195764['model'],qs['fields'](_0x4cfe3c[_0x7c3d('0x32')][_0x7c3d('0x36')]));_0xcef230[_0x7c3d('0x37')]=_0xcef230[_0x7c3d('0x37')][_0x7c3d('0x45')]?_0xcef230[_0x7c3d('0x37')]:_0x195764[_0x7c3d('0x31')];if(_0x4cfe3c[_0x7c3d('0x32')][_0x7c3d('0x40')]){_0xcef230[_0x7c3d('0x46')]=[{'all':!![]}];}_0xcef230=_[_0x7c3d('0x47')]({},_0xcef230,_0x4cfe3c[_0x7c3d('0x3f')]);return db[_0x7c3d('0x2e')][_0x7c3d('0x48')](_0xcef230)[_0x7c3d('0x27')](handleEntityNotFound(_0x538c08,null))['then'](respondWithResult(_0x538c08,null))[_0x7c3d('0x43')](handleError(_0x538c08,null));};exports['create']=function(_0x406952,_0x1e27d6){return db[_0x7c3d('0x2e')]['create'](_0x406952['body'],{})[_0x7c3d('0x27')](respondWithResult(_0x1e27d6,0xc9))[_0x7c3d('0x43')](handleError(_0x1e27d6,null));};exports[_0x7c3d('0x26')]=function(_0x2f8873,_0x4597cc){if(_0x2f8873[_0x7c3d('0x49')]['id']){delete _0x2f8873[_0x7c3d('0x49')]['id'];}return db[_0x7c3d('0x2e')]['find']({'where':{'id':_0x2f8873['params']['id']}})[_0x7c3d('0x27')](handleEntityNotFound(_0x4597cc,null))[_0x7c3d('0x27')](saveUpdates(_0x2f8873['body'],null))[_0x7c3d('0x27')](respondWithResult(_0x4597cc,null))['catch'](handleError(_0x4597cc,null));};exports[_0x7c3d('0x4a')]=function(_0x5c8226,_0x4d148b){return db[_0x7c3d('0x2e')]['find']({'where':{'id':_0x5c8226[_0x7c3d('0x44')]['id']}})[_0x7c3d('0x27')](handleEntityNotFound(_0x4d148b,null))[_0x7c3d('0x27')](removeEntity(_0x4d148b,null))[_0x7c3d('0x43')](handleError(_0x4d148b,null));}; \ No newline at end of file +var _0xde03=['attributes','fields','model','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','query','filters','intersection'];(function(_0x42622c,_0xd40cfa){var _0x2dafdf=function(_0x55a235){while(--_0x55a235){_0x42622c['push'](_0x42622c['shift']());}};_0x2dafdf(++_0xd40cfa);}(_0xde03,0x184));var _0x3de0=function(_0x21e505,_0x1f73e3){_0x21e505=_0x21e505-0x0;var _0x53c924=_0xde03[_0x21e505];return _0x53c924;};'use strict';var emlformat=require(_0x3de0('0x0'));var rimraf=require(_0x3de0('0x1'));var zipdir=require(_0x3de0('0x2'));var jsonpatch=require(_0x3de0('0x3'));var rp=require(_0x3de0('0x4'));var moment=require('moment');var BPromise=require(_0x3de0('0x5'));var Mustache=require(_0x3de0('0x6'));var util=require(_0x3de0('0x7'));var path=require(_0x3de0('0x8'));var sox=require(_0x3de0('0x9'));var csv=require(_0x3de0('0xa'));var ejs=require(_0x3de0('0xb'));var fs=require('fs');var fs_extra=require(_0x3de0('0xc'));var _=require('lodash');var squel=require(_0x3de0('0xd'));var crypto=require('crypto');var jsforce=require(_0x3de0('0xe'));var deskjs=require(_0x3de0('0xf'));var toCsv=require(_0x3de0('0xa'));var querystring=require('querystring');var Papa=require(_0x3de0('0x10'));var Redis=require(_0x3de0('0x11'));var authService=require(_0x3de0('0x12'));var qs=require(_0x3de0('0x13'));var as=require(_0x3de0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3de0('0x15'))(_0x3de0('0x16'));var utils=require(_0x3de0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3de0('0x18'))['db'];function respondWithStatusCode(_0x3ae120,_0x232cf9){_0x232cf9=_0x232cf9||0xcc;return function(_0x5628bb){if(_0x5628bb){return _0x3ae120[_0x3de0('0x19')](_0x232cf9);}return _0x3ae120['status'](_0x232cf9)[_0x3de0('0x1a')]();};}function respondWithResult(_0x3de1f1,_0x34d758){_0x34d758=_0x34d758||0xc8;return function(_0xf7aa10){if(_0xf7aa10){return _0x3de1f1[_0x3de0('0x1b')](_0x34d758)['json'](_0xf7aa10);}};}function respondWithFilteredResult(_0x2f760f,_0x98a284){return function(_0x44620e){if(_0x44620e){var _0x5f47bc=typeof _0x98a284[_0x3de0('0x1c')]===_0x3de0('0x1d')&&typeof _0x98a284[_0x3de0('0x1e')]===_0x3de0('0x1d');var _0x89230e=_0x44620e[_0x3de0('0x1f')];var _0x225f2a=_0x5f47bc?0x0:_0x98a284[_0x3de0('0x1c')];var _0x2037bd=_0x5f47bc?_0x44620e[_0x3de0('0x1f')]:_0x98a284[_0x3de0('0x1c')]+_0x98a284[_0x3de0('0x1e')];var _0x2bd15c;if(_0x2037bd>=_0x89230e){_0x2037bd=_0x89230e;_0x2bd15c=0xc8;}else{_0x2bd15c=0xce;}_0x2f760f['status'](_0x2bd15c);return _0x2f760f[_0x3de0('0x20')]('Content-Range',_0x225f2a+'-'+_0x2037bd+'/'+_0x89230e)[_0x3de0('0x21')](_0x44620e);}return null;};}function patchUpdates(_0x50c283){return function(_0x279cd2){try{jsonpatch[_0x3de0('0x22')](_0x279cd2,_0x50c283,!![]);}catch(_0x256672){return BPromise['reject'](_0x256672);}return _0x279cd2[_0x3de0('0x23')]();};}function saveUpdates(_0x1d9a92,_0x15af37){return function(_0x3b3443){if(_0x3b3443){return _0x3b3443[_0x3de0('0x24')](_0x1d9a92)[_0x3de0('0x25')](function(_0x14fe52){return _0x14fe52;});}return null;};}function removeEntity(_0x426c9e,_0x4b583e){return function(_0x165b98){if(_0x165b98){return _0x165b98['destroy']()['then'](function(){_0x426c9e[_0x3de0('0x1b')](0xcc)[_0x3de0('0x1a')]();});}};}function handleEntityNotFound(_0x33bb4f,_0x40206e){return function(_0x4bebb3){if(!_0x4bebb3){_0x33bb4f[_0x3de0('0x19')](0x194);}return _0x4bebb3;};}function handleError(_0x447f34,_0x851294){_0x851294=_0x851294||0x1f4;return function(_0x2ec907){logger['error'](_0x2ec907[_0x3de0('0x26')]);if(_0x2ec907['name']){delete _0x2ec907[_0x3de0('0x27')];}_0x447f34[_0x3de0('0x1b')](_0x851294)[_0x3de0('0x28')](_0x2ec907);};}exports[_0x3de0('0x29')]=function(_0x4b1fbf,_0x5cfcec){var _0x5beac7={},_0x140375={},_0x3b9445={'count':0x0,'rows':[]};var _0x37d550=_[_0x3de0('0x2a')](db[_0x3de0('0x2b')][_0x3de0('0x2c')],function(_0x41ec6e){return{'name':_0x41ec6e[_0x3de0('0x2d')],'type':_0x41ec6e[_0x3de0('0x2e')]['key']};});_0x140375['model']=_[_0x3de0('0x2a')](_0x37d550,_0x3de0('0x27'));_0x140375[_0x3de0('0x2f')]=_['keys'](_0x4b1fbf['query']);_0x140375[_0x3de0('0x30')]=_[_0x3de0('0x31')](_0x140375['model'],_0x140375[_0x3de0('0x2f')]);_0x5beac7[_0x3de0('0x32')]=_[_0x3de0('0x31')](_0x140375['model'],qs['fields'](_0x4b1fbf[_0x3de0('0x2f')][_0x3de0('0x33')]));_0x5beac7['attributes']=_0x5beac7['attributes']['length']?_0x5beac7['attributes']:_0x140375[_0x3de0('0x34')];if(!_0x4b1fbf[_0x3de0('0x2f')]['hasOwnProperty']('nolimit')){_0x5beac7[_0x3de0('0x1e')]=qs[_0x3de0('0x1e')](_0x4b1fbf[_0x3de0('0x2f')][_0x3de0('0x1e')]);_0x5beac7[_0x3de0('0x1c')]=qs[_0x3de0('0x1c')](_0x4b1fbf[_0x3de0('0x2f')][_0x3de0('0x1c')]);}_0x5beac7[_0x3de0('0x35')]=qs['sort'](_0x4b1fbf[_0x3de0('0x2f')]['sort']);_0x5beac7[_0x3de0('0x36')]=qs[_0x3de0('0x30')](_[_0x3de0('0x37')](_0x4b1fbf[_0x3de0('0x2f')],_0x140375[_0x3de0('0x30')]),_0x37d550);if(_0x4b1fbf[_0x3de0('0x2f')]['filter']){_0x5beac7['where']=_[_0x3de0('0x38')](_0x5beac7[_0x3de0('0x36')],{'$or':_[_0x3de0('0x2a')](_0x37d550,function(_0x22382c){if(_0x22382c[_0x3de0('0x2e')]!==_0x3de0('0x39')){var _0x46167e={};_0x46167e[_0x22382c[_0x3de0('0x27')]]={'$like':'%'+_0x4b1fbf[_0x3de0('0x2f')][_0x3de0('0x3a')]+'%'};return _0x46167e;}})});}_0x5beac7=_['merge']({},_0x5beac7,_0x4b1fbf[_0x3de0('0x3b')]);var _0x128faa={'where':_0x5beac7[_0x3de0('0x36')]};return db['SugarcrmField'][_0x3de0('0x1f')](_0x128faa)['then'](function(_0x5c6b1f){_0x3b9445['count']=_0x5c6b1f;if(_0x4b1fbf[_0x3de0('0x2f')][_0x3de0('0x3c')]){_0x5beac7[_0x3de0('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x3de0('0x3e')](_0x5beac7);})[_0x3de0('0x25')](function(_0x140697){_0x3b9445[_0x3de0('0x3f')]=_0x140697;return _0x3b9445;})['then'](respondWithFilteredResult(_0x5cfcec,_0x5beac7))['catch'](handleError(_0x5cfcec,null));};exports[_0x3de0('0x40')]=function(_0x318331,_0x236b0f){var _0x23b32d={'raw':!![],'where':{'id':_0x318331[_0x3de0('0x41')]['id']}},_0x1cc7bf={};_0x1cc7bf[_0x3de0('0x34')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x1cc7bf[_0x3de0('0x2f')]=_[_0x3de0('0x42')](_0x318331[_0x3de0('0x2f')]);_0x1cc7bf[_0x3de0('0x30')]=_['intersection'](_0x1cc7bf[_0x3de0('0x34')],_0x1cc7bf[_0x3de0('0x2f')]);_0x23b32d[_0x3de0('0x32')]=_['intersection'](_0x1cc7bf['model'],qs[_0x3de0('0x33')](_0x318331[_0x3de0('0x2f')][_0x3de0('0x33')]));_0x23b32d[_0x3de0('0x32')]=_0x23b32d['attributes'][_0x3de0('0x43')]?_0x23b32d['attributes']:_0x1cc7bf[_0x3de0('0x34')];if(_0x318331['query'][_0x3de0('0x3c')]){_0x23b32d['include']=[{'all':!![]}];}_0x23b32d=_['merge']({},_0x23b32d,_0x318331[_0x3de0('0x3b')]);return db[_0x3de0('0x2b')][_0x3de0('0x44')](_0x23b32d)[_0x3de0('0x25')](handleEntityNotFound(_0x236b0f,null))[_0x3de0('0x25')](respondWithResult(_0x236b0f,null))[_0x3de0('0x45')](handleError(_0x236b0f,null));};exports['create']=function(_0xe7ae68,_0x2630e4){return db[_0x3de0('0x2b')][_0x3de0('0x46')](_0xe7ae68[_0x3de0('0x47')],{})['then'](respondWithResult(_0x2630e4,0xc9))[_0x3de0('0x45')](handleError(_0x2630e4,null));};exports[_0x3de0('0x24')]=function(_0x189770,_0xd56844){if(_0x189770[_0x3de0('0x47')]['id']){delete _0x189770[_0x3de0('0x47')]['id'];}return db['SugarcrmField'][_0x3de0('0x44')]({'where':{'id':_0x189770[_0x3de0('0x41')]['id']}})[_0x3de0('0x25')](handleEntityNotFound(_0xd56844,null))[_0x3de0('0x25')](saveUpdates(_0x189770[_0x3de0('0x47')],null))['then'](respondWithResult(_0xd56844,null))['catch'](handleError(_0xd56844,null));};exports[_0x3de0('0x48')]=function(_0x5d0027,_0x9c1931){return db[_0x3de0('0x2b')][_0x3de0('0x44')]({'where':{'id':_0x5d0027[_0x3de0('0x41')]['id']}})[_0x3de0('0x25')](handleEntityNotFound(_0x9c1931,null))['then'](removeEntity(_0x9c1931,null))['catch'](handleError(_0x9c1931,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index aa55d59..db0b85e 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 _0x99d4=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','lodash','util','api','moment'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x99d4,0xb7));var _0x499d=function(_0x20bb7e,_0x3e94c2){_0x20bb7e=_0x20bb7e-0x0;var _0x2f4ba7=_0x99d4[_0x20bb7e];return _0x2f4ba7;};'use strict';var _=require(_0x499d('0x0'));var util=require(_0x499d('0x1'));var logger=require('../../config/logger')(_0x499d('0x2'));var moment=require(_0x499d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x499d('0x4'));var rimraf=require(_0x499d('0x5'));var config=require(_0x499d('0x6'));var attributes=require(_0x499d('0x7'));module[_0x499d('0x8')]=function(_0x350f3f,_0x4fdbaf){return _0x350f3f['define'](_0x499d('0x9'),attributes,{'tableName':_0x499d('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe30=['../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbe30,0x1c2));var _0x0be3=function(_0xcc1cc6,_0x3bfd4b){_0xcc1cc6=_0xcc1cc6-0x0;var _0x374289=_0xbe30[_0xcc1cc6];return _0x374289;};'use strict';var _=require('lodash');var util=require(_0x0be3('0x0'));var logger=require(_0x0be3('0x1'))(_0x0be3('0x2'));var moment=require(_0x0be3('0x3'));var BPromise=require(_0x0be3('0x4'));var rp=require(_0x0be3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0be3('0x6'));var attributes=require(_0x0be3('0x7'));module['exports']=function(_0x1051a3,_0x4414ba){return _0x1051a3[_0x0be3('0x8')](_0x0be3('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x0be3('0xa'),_0x0be3('0xb')],'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 0fd3980..7bada83 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 _0xaefb=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x37ef15,_0x459c47){var _0x2b8160=function(_0x3f6dab){while(--_0x3f6dab){_0x37ef15['push'](_0x37ef15['shift']());}};_0x2b8160(++_0x459c47);}(_0xaefb,0xc6));var _0xbaef=function(_0x23516c,_0x16ea34){_0x23516c=_0x23516c-0x0;var _0x591310=_0xaefb[_0x23516c];return _0x591310;};'use strict';var _=require(_0xbaef('0x0'));var util=require('util');var moment=require(_0xbaef('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbaef('0x2'));var db=require(_0xbaef('0x3'))['db'];var utils=require(_0xbaef('0x4'));var logger=require('../../config/logger')(_0xbaef('0x5'));var config=require(_0xbaef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbaef('0x7')][_0xbaef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a09c4,_0x22372f,_0x3ff904){return new BPromise(function(_0x2c1a18,_0x570b08){return client['request'](_0x4a09c4,_0x3ff904)[_0xbaef('0x9')](function(_0xacc64b){logger[_0xbaef('0xa')](_0xbaef('0xb'),_0x22372f,_0xbaef('0xc'));logger[_0xbaef('0xd')](_0xbaef('0xe'),_0x22372f,_0xbaef('0xc'),JSON[_0xbaef('0xf')](_0xacc64b));if(_0xacc64b[_0xbaef('0x10')]){if(_0xacc64b[_0xbaef('0x10')][_0xbaef('0x11')]===0x1f4){logger[_0xbaef('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x22372f,_0xacc64b[_0xbaef('0x10')]['message']);return _0x570b08(_0xacc64b['error']['message']);}logger[_0xbaef('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x22372f,_0xacc64b[_0xbaef('0x10')][_0xbaef('0x12')]);return _0x2c1a18(_0xacc64b[_0xbaef('0x10')]['message']);}else{logger[_0xbaef('0xa')](_0xbaef('0xb'),_0x22372f,_0xbaef('0xc'));_0x2c1a18(_0xacc64b[_0xbaef('0x13')][_0xbaef('0x12')]);}})[_0xbaef('0x14')](function(_0x20fcce){logger[_0xbaef('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x22372f,_0x20fcce);_0x570b08(_0x20fcce);});});} \ No newline at end of file +var _0x53a5=['then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x46a094,_0x2a3537){var _0x46f029=function(_0x75e21e){while(--_0x75e21e){_0x46a094['push'](_0x46a094['shift']());}};_0x46f029(++_0x2a3537);}(_0x53a5,0x18c));var _0x553a=function(_0x5860bc,_0x3571ec){_0x5860bc=_0x5860bc-0x0;var _0x2f53e0=_0x53a5[_0x5860bc];return _0x2f53e0;};'use strict';var _=require(_0x553a('0x0'));var util=require(_0x553a('0x1'));var moment=require(_0x553a('0x2'));var BPromise=require(_0x553a('0x3'));var rs=require(_0x553a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x553a('0x5'))['db'];var utils=require(_0x553a('0x6'));var logger=require(_0x553a('0x7'))('rpc');var config=require(_0x553a('0x8'));var jayson=require(_0x553a('0x9'));var client=jayson['client'][_0x553a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d32f,_0x38368f,_0x1b8447){return new BPromise(function(_0x5abf65,_0x3e04e2){return client[_0x553a('0xb')](_0x9d32f,_0x1b8447)[_0x553a('0xc')](function(_0x1f1d98){logger[_0x553a('0xd')](_0x553a('0xe'),_0x38368f,'request\x20sent');logger[_0x553a('0xf')](_0x553a('0x10'),_0x38368f,_0x553a('0x11'),JSON[_0x553a('0x12')](_0x1f1d98));if(_0x1f1d98[_0x553a('0x13')]){if(_0x1f1d98[_0x553a('0x13')][_0x553a('0x14')]===0x1f4){logger[_0x553a('0x13')](_0x553a('0xe'),_0x38368f,_0x1f1d98[_0x553a('0x13')][_0x553a('0x15')]);return _0x3e04e2(_0x1f1d98[_0x553a('0x13')][_0x553a('0x15')]);}logger[_0x553a('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x38368f,_0x1f1d98['error'][_0x553a('0x15')]);return _0x5abf65(_0x1f1d98['error'][_0x553a('0x15')]);}else{logger[_0x553a('0xd')](_0x553a('0xe'),_0x38368f,_0x553a('0x11'));_0x5abf65(_0x1f1d98[_0x553a('0x16')]['message']);}})[_0x553a('0x17')](function(_0x3350e5){logger[_0x553a('0x13')](_0x553a('0xe'),_0x38368f,_0x3350e5);_0x3e04e2(_0x3350e5);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 37ee0c6..9b6540c 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 _0x544f=['isAuthenticated','/:id','post','create','/:id/configurations','addConfiguration','put','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x237972,_0x1b0de8){var _0x3e06cc=function(_0x3da55a){while(--_0x3da55a){_0x237972['push'](_0x237972['shift']());}};_0x3e06cc(++_0x1b0de8);}(_0x544f,0x14c));var _0xf544=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x544f[_0x264b9b];return _0x4c7a0e;};'use strict';var multer=require(_0xf544('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf544('0x1'));var express=require(_0xf544('0x2'));var router=express[_0xf544('0x3')]();var fs_extra=require(_0xf544('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xf544('0x7')]('/',auth[_0xf544('0x8')](),controller['index']);router[_0xf544('0x7')](_0xf544('0x9'),auth[_0xf544('0x8')](),controller['show']);router[_0xf544('0x7')]('/:id/configurations',auth[_0xf544('0x8')](),controller['getConfigurations']);router[_0xf544('0x7')]('/:id/fields',auth[_0xf544('0x8')](),controller['getFields']);router[_0xf544('0xa')]('/',auth[_0xf544('0x8')](),controller[_0xf544('0xb')]);router[_0xf544('0xa')](_0xf544('0xc'),auth[_0xf544('0x8')](),controller[_0xf544('0xd')]);router[_0xf544('0xe')]('/:id',auth[_0xf544('0x8')](),controller[_0xf544('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf544('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5d70=['getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields'];(function(_0x479988,_0x17b763){var _0x17610c=function(_0x1dc420){while(--_0x1dc420){_0x479988['push'](_0x479988['shift']());}};_0x17610c(++_0x17b763);}(_0x5d70,0x8d));var _0x05d7=function(_0x56e912,_0x3bba93){_0x56e912=_0x56e912-0x0;var _0x2e7e8c=_0x5d70[_0x56e912];return _0x2e7e8c;};'use strict';var multer=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var path=require('path');var timeout=require(_0x05d7('0x2'));var express=require(_0x05d7('0x3'));var router=express[_0x05d7('0x4')]();var fs_extra=require(_0x05d7('0x5'));var auth=require(_0x05d7('0x6'));var interaction=require(_0x05d7('0x7'));var config=require('../../config/environment');var controller=require(_0x05d7('0x8'));router[_0x05d7('0x9')]('/',auth[_0x05d7('0xa')](),controller[_0x05d7('0xb')]);router['get']('/:id',auth[_0x05d7('0xa')](),controller[_0x05d7('0xc')]);router[_0x05d7('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x05d7('0xd')]);router[_0x05d7('0x9')](_0x05d7('0xe'),auth[_0x05d7('0xa')](),controller[_0x05d7('0xf')]);router[_0x05d7('0x10')]('/',auth[_0x05d7('0xa')](),controller[_0x05d7('0x11')]);router[_0x05d7('0x10')](_0x05d7('0x12'),auth[_0x05d7('0xa')](),controller[_0x05d7('0x13')]);router[_0x05d7('0x14')](_0x05d7('0x15'),auth[_0x05d7('0xa')](),controller[_0x05d7('0x16')]);router[_0x05d7('0x17')](_0x05d7('0x15'),auth[_0x05d7('0xa')](),controller[_0x05d7('0x18')]);module[_0x05d7('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e800a56..6ff7874 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 _0x1225=['STRING','HelpDesk','sequelize','exports'];(function(_0x56cf5c,_0x310970){var _0x8ab5e5=function(_0x250195){while(--_0x250195){_0x56cf5c['push'](_0x56cf5c['shift']());}};_0x8ab5e5(++_0x310970);}(_0x1225,0x1da));var _0x5122=function(_0x203322,_0x476d9e){_0x203322=_0x203322-0x0;var _0x40f2ca=_0x1225[_0x203322];return _0x40f2ca;};'use strict';var Sequelize=require(_0x5122('0x0'));module[_0x5122('0x1')]={'name':{'type':Sequelize[_0x5122('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5122('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5122('0x2')],'allowNull':![],'defaultValue':_0x5122('0x3')},'remoteUri':{'type':Sequelize[_0x5122('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5122('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8997=['exports','STRING','HelpDesk','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8997,0x19b));var _0x7899=function(_0x4e826b,_0x294c62){_0x4e826b=_0x4e826b-0x0;var _0x22b48d=_0x8997[_0x4e826b];return _0x22b48d;};'use strict';var Sequelize=require(_0x7899('0x0'));module[_0x7899('0x1')]={'name':{'type':Sequelize[_0x7899('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7899('0x2')]},'username':{'type':Sequelize[_0x7899('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7899('0x2')],'allowNull':![],'defaultValue':_0x7899('0x3')},'remoteUri':{'type':Sequelize['STRING'],'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 2507e1d..1361419 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 _0xc80c=['merge','options','includeAll','include','VtigerAccount','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','username','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','login','result','token','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','value','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xc80c,0x120));var _0xcc80=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xc80c[_0x26f702];return _0x11417d;};'use strict';var emlformat=require(_0xcc80('0x0'));var rimraf=require(_0xcc80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc80('0x2'));var rp=require('request-promise');var moment=require(_0xcc80('0x3'));var BPromise=require(_0xcc80('0x4'));var Mustache=require('mustache');var util=require(_0xcc80('0x5'));var path=require(_0xcc80('0x6'));var sox=require(_0xcc80('0x7'));var csv=require(_0xcc80('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc80('0x9'));var _=require(_0xcc80('0xa'));var squel=require(_0xcc80('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc80('0xc'));var deskjs=require(_0xcc80('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcc80('0xe'));var Papa=require(_0xcc80('0xf'));var Redis=require('ioredis');var authService=require(_0xcc80('0x10'));var qs=require(_0xcc80('0x11'));var as=require(_0xcc80('0x12'));var hardwareService=require(_0xcc80('0x13'));var logger=require(_0xcc80('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc80('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4985f,_0x47ccde){_0x47ccde=_0x47ccde||0xcc;return function(_0x5f2bce){if(_0x5f2bce){return _0x4985f[_0xcc80('0x16')](_0x47ccde);}return _0x4985f[_0xcc80('0x17')](_0x47ccde)[_0xcc80('0x18')]();};}function respondWithResult(_0x31d257,_0x95c260){_0x95c260=_0x95c260||0xc8;return function(_0x3544f2){if(_0x3544f2){return _0x31d257[_0xcc80('0x17')](_0x95c260)[_0xcc80('0x19')](_0x3544f2);}};}function respondWithFilteredResult(_0x1baf35,_0x575a25){return function(_0x1a1583){if(_0x1a1583){var _0x31bd9e=typeof _0x575a25[_0xcc80('0x1a')]==='undefined'&&typeof _0x575a25[_0xcc80('0x1b')]===_0xcc80('0x1c');var _0x4dcc35=_0x1a1583[_0xcc80('0x1d')];var _0x436f50=_0x31bd9e?0x0:_0x575a25['offset'];var _0x514e63=_0x31bd9e?_0x1a1583[_0xcc80('0x1d')]:_0x575a25[_0xcc80('0x1a')]+_0x575a25[_0xcc80('0x1b')];var _0x2b9ebc;if(_0x514e63>=_0x4dcc35){_0x514e63=_0x4dcc35;_0x2b9ebc=0xc8;}else{_0x2b9ebc=0xce;}_0x1baf35[_0xcc80('0x17')](_0x2b9ebc);return _0x1baf35['set'](_0xcc80('0x1e'),_0x436f50+'-'+_0x514e63+'/'+_0x4dcc35)[_0xcc80('0x19')](_0x1a1583);}return null;};}function patchUpdates(_0x2909f9){return function(_0x82a71b){try{jsonpatch[_0xcc80('0x1f')](_0x82a71b,_0x2909f9,!![]);}catch(_0x9398cf){return BPromise['reject'](_0x9398cf);}return _0x82a71b[_0xcc80('0x20')]();};}function saveUpdates(_0x3a1742,_0x405a61){return function(_0x54d2e8){if(_0x54d2e8){return _0x54d2e8['update'](_0x3a1742)[_0xcc80('0x21')](function(_0x15fa8c){return _0x15fa8c;});}return null;};}function removeEntity(_0x351472,_0x30265d){return function(_0xc7f840){if(_0xc7f840){return _0xc7f840[_0xcc80('0x22')]()[_0xcc80('0x21')](function(){_0x351472['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x383b1a,_0x3d4bf0){return function(_0x2c133){if(!_0x2c133){_0x383b1a[_0xcc80('0x16')](0x194);}return _0x2c133;};}function handleError(_0x43da26,_0x16f6c8){_0x16f6c8=_0x16f6c8||0x1f4;return function(_0x1164ba){logger[_0xcc80('0x23')](_0x1164ba[_0xcc80('0x24')]);if(_0x1164ba['name']){delete _0x1164ba[_0xcc80('0x25')];}_0x43da26[_0xcc80('0x17')](_0x16f6c8)[_0xcc80('0x26')](_0x1164ba);};}exports[_0xcc80('0x27')]=function(_0x3ce3b6,_0xcb9a6b){var _0x13ed7f={},_0x43f198={},_0x5c540e={'count':0x0,'rows':[]};var _0x1f15fd=_[_0xcc80('0x28')](db['VtigerAccount'][_0xcc80('0x29')],function(_0x11e941){return{'name':_0x11e941['fieldName'],'type':_0x11e941['type'][_0xcc80('0x2a')]};});_0x43f198['model']=_[_0xcc80('0x28')](_0x1f15fd,_0xcc80('0x25'));_0x43f198[_0xcc80('0x2b')]=_[_0xcc80('0x2c')](_0x3ce3b6[_0xcc80('0x2b')]);_0x43f198[_0xcc80('0x2d')]=_[_0xcc80('0x2e')](_0x43f198[_0xcc80('0x2f')],_0x43f198[_0xcc80('0x2b')]);_0x13ed7f[_0xcc80('0x30')]=_[_0xcc80('0x2e')](_0x43f198[_0xcc80('0x2f')],qs[_0xcc80('0x31')](_0x3ce3b6['query'][_0xcc80('0x31')]));_0x13ed7f[_0xcc80('0x30')]=_0x13ed7f['attributes']['length']?_0x13ed7f[_0xcc80('0x30')]:_0x43f198[_0xcc80('0x2f')];if(!_0x3ce3b6[_0xcc80('0x2b')][_0xcc80('0x32')]('nolimit')){_0x13ed7f[_0xcc80('0x1b')]=qs[_0xcc80('0x1b')](_0x3ce3b6[_0xcc80('0x2b')][_0xcc80('0x1b')]);_0x13ed7f[_0xcc80('0x1a')]=qs[_0xcc80('0x1a')](_0x3ce3b6[_0xcc80('0x2b')][_0xcc80('0x1a')]);}_0x13ed7f[_0xcc80('0x33')]=qs['sort'](_0x3ce3b6[_0xcc80('0x2b')][_0xcc80('0x34')]);_0x13ed7f[_0xcc80('0x35')]=qs['filters'](_[_0xcc80('0x36')](_0x3ce3b6[_0xcc80('0x2b')],_0x43f198['filters']),_0x1f15fd);if(_0x3ce3b6[_0xcc80('0x2b')][_0xcc80('0x37')]){_0x13ed7f[_0xcc80('0x35')]=_['merge'](_0x13ed7f['where'],{'$or':_['map'](_0x1f15fd,function(_0x529796){if(_0x529796[_0xcc80('0x38')]!=='VIRTUAL'){var _0x3dac27={};_0x3dac27[_0x529796[_0xcc80('0x25')]]={'$like':'%'+_0x3ce3b6['query']['filter']+'%'};return _0x3dac27;}})});}_0x13ed7f=_[_0xcc80('0x39')]({},_0x13ed7f,_0x3ce3b6[_0xcc80('0x3a')]);var _0x4f03d4={'where':_0x13ed7f['where']};return db['VtigerAccount'][_0xcc80('0x1d')](_0x4f03d4)[_0xcc80('0x21')](function(_0x254c1c){_0x5c540e[_0xcc80('0x1d')]=_0x254c1c;if(_0x3ce3b6[_0xcc80('0x2b')][_0xcc80('0x3b')]){_0x13ed7f[_0xcc80('0x3c')]=[{'all':!![]}];}return db[_0xcc80('0x3d')][_0xcc80('0x3e')](_0x13ed7f);})[_0xcc80('0x21')](function(_0x46dcd6){_0x5c540e[_0xcc80('0x3f')]=_0x46dcd6;return _0x5c540e;})[_0xcc80('0x21')](respondWithFilteredResult(_0xcb9a6b,_0x13ed7f))[_0xcc80('0x40')](handleError(_0xcb9a6b,null));};exports[_0xcc80('0x41')]=function(_0x2fdf7d,_0x518cfd){var _0x2bdf9a={'raw':![],'where':{'id':_0x2fdf7d[_0xcc80('0x42')]['id']}},_0x1d6e80={};_0x1d6e80[_0xcc80('0x2f')]=_[_0xcc80('0x2c')](db['VtigerAccount']['rawAttributes']);_0x1d6e80['query']=_['keys'](_0x2fdf7d[_0xcc80('0x2b')]);_0x1d6e80[_0xcc80('0x2d')]=_[_0xcc80('0x2e')](_0x1d6e80[_0xcc80('0x2f')],_0x1d6e80[_0xcc80('0x2b')]);_0x2bdf9a[_0xcc80('0x30')]=_[_0xcc80('0x2e')](_0x1d6e80[_0xcc80('0x2f')],qs[_0xcc80('0x31')](_0x2fdf7d[_0xcc80('0x2b')][_0xcc80('0x31')]));_0x2bdf9a[_0xcc80('0x30')]=_0x2bdf9a['attributes'][_0xcc80('0x43')]?_0x2bdf9a['attributes']:_0x1d6e80[_0xcc80('0x2f')];if(_0x2fdf7d['query'][_0xcc80('0x3b')]){_0x2bdf9a['include']=[{'all':!![]}];}_0x2bdf9a=_[_0xcc80('0x39')]({},_0x2bdf9a,_0x2fdf7d[_0xcc80('0x3a')]);return db[_0xcc80('0x3d')][_0xcc80('0x44')](_0x2bdf9a)[_0xcc80('0x21')](handleEntityNotFound(_0x518cfd,null))[_0xcc80('0x21')](respondWithResult(_0x518cfd,null))[_0xcc80('0x40')](handleError(_0x518cfd,null));};exports['create']=function(_0x1442e8,_0x2d4f60){return db[_0xcc80('0x3d')][_0xcc80('0x45')](_0x1442e8[_0xcc80('0x46')],{})[_0xcc80('0x21')](respondWithResult(_0x2d4f60,0xc9))[_0xcc80('0x40')](handleError(_0x2d4f60,null));};exports['update']=function(_0x25b84f,_0x400110){if(_0x25b84f['body']['id']){delete _0x25b84f[_0xcc80('0x46')]['id'];}return db[_0xcc80('0x3d')][_0xcc80('0x44')]({'where':{'id':_0x25b84f[_0xcc80('0x42')]['id']}})[_0xcc80('0x21')](handleEntityNotFound(_0x400110,null))[_0xcc80('0x21')](saveUpdates(_0x25b84f[_0xcc80('0x46')],null))[_0xcc80('0x21')](respondWithResult(_0x400110,null))[_0xcc80('0x40')](handleError(_0x400110,null));};exports['destroy']=function(_0x2ad59a,_0x21d221){return db[_0xcc80('0x3d')][_0xcc80('0x44')]({'where':{'id':_0x2ad59a[_0xcc80('0x42')]['id']}})[_0xcc80('0x21')](handleEntityNotFound(_0x21d221,null))[_0xcc80('0x21')](removeEntity(_0x21d221,null))[_0xcc80('0x40')](handleError(_0x21d221,null));};exports[_0xcc80('0x47')]=function(_0x52f6cf,_0x27416f,_0x41e830){var _0x33d3d4={};var _0x235331={};var _0x1fc2ed;var _0x1193b8;return db[_0xcc80('0x3d')][_0xcc80('0x48')]({'where':{'id':_0x52f6cf[_0xcc80('0x42')]['id']}})[_0xcc80('0x21')](handleEntityNotFound(_0x27416f,null))[_0xcc80('0x21')](function(_0x12dd2f){if(_0x12dd2f){_0x1fc2ed=_0x12dd2f;_0x235331[_0xcc80('0x2f')]=_[_0xcc80('0x2c')](db[_0xcc80('0x49')][_0xcc80('0x29')]);_0x235331[_0xcc80('0x2b')]=_['keys'](_0x52f6cf[_0xcc80('0x2b')]);_0x235331[_0xcc80('0x2d')]=_[_0xcc80('0x2e')](_0x235331[_0xcc80('0x2f')],_0x235331['query']);_0x33d3d4[_0xcc80('0x30')]=_[_0xcc80('0x2e')](_0x235331[_0xcc80('0x2f')],qs[_0xcc80('0x31')](_0x52f6cf['query'][_0xcc80('0x31')]));_0x33d3d4['attributes']=_0x33d3d4[_0xcc80('0x30')]['length']?_0x33d3d4[_0xcc80('0x30')]:_0x235331[_0xcc80('0x2f')];_0x33d3d4['order']=qs['sort'](_0x52f6cf[_0xcc80('0x2b')][_0xcc80('0x34')]);_0x33d3d4[_0xcc80('0x35')]=qs[_0xcc80('0x2d')](_[_0xcc80('0x36')](_0x52f6cf['query'],_0x235331[_0xcc80('0x2d')]));if(_0x52f6cf['query'][_0xcc80('0x37')]){_0x33d3d4[_0xcc80('0x35')]=_[_0xcc80('0x39')](_0x33d3d4[_0xcc80('0x35')],{'$or':_[_0xcc80('0x28')](_0x33d3d4[_0xcc80('0x30')],function(_0x3a0019){var _0x3704fa={};_0x3704fa[_0x3a0019]={'$like':'%'+_0x52f6cf[_0xcc80('0x2b')][_0xcc80('0x37')]+'%'};return _0x3704fa;})});}_0x33d3d4=_[_0xcc80('0x39')]({},_0x33d3d4,_0x52f6cf[_0xcc80('0x3a')]);return _0x1fc2ed[_0xcc80('0x47')](_0x33d3d4);}})['then'](function(_0x12f3ae){if(_0x12f3ae){_0x1193b8=_0x12f3ae[_0xcc80('0x43')];if(!_0x52f6cf[_0xcc80('0x2b')]['hasOwnProperty'](_0xcc80('0x4a'))){_0x33d3d4['limit']=qs['limit'](_0x52f6cf[_0xcc80('0x2b')][_0xcc80('0x1b')]);_0x33d3d4[_0xcc80('0x1a')]=qs[_0xcc80('0x1a')](_0x52f6cf[_0xcc80('0x2b')][_0xcc80('0x1a')]);}return _0x1fc2ed[_0xcc80('0x47')](_0x33d3d4);}})['then'](function(_0x48695f){if(_0x48695f){return _0x48695f?{'count':_0x1193b8,'rows':_0x48695f}:null;}})[_0xcc80('0x21')](respondWithResult(_0x27416f,null))[_0xcc80('0x40')](handleError(_0x27416f,null));};exports[_0xcc80('0x4b')]=function(_0x2007ce,_0x115ee1,_0x56ed12){if(_0x2007ce['body']['id']){delete _0x2007ce['body']['id'];}return db[_0xcc80('0x3d')][_0xcc80('0x48')]({'where':{'id':_0x2007ce[_0xcc80('0x42')]['id']}})[_0xcc80('0x21')](handleEntityNotFound(_0x115ee1,null))[_0xcc80('0x21')](function(_0x52a450){if(_0x52a450){_0x2007ce[_0xcc80('0x46')][_0xcc80('0x4c')]=_0x52a450['id'];_0x2007ce[_0xcc80('0x46')][_0xcc80('0x4d')]=integrations['getSubjects'](_0x2007ce[_0xcc80('0x46')][_0xcc80('0x4e')],_0x2007ce['body'][_0xcc80('0x38')]);_0x2007ce[_0xcc80('0x46')][_0xcc80('0x4f')]=integrations[_0xcc80('0x50')](_0x2007ce[_0xcc80('0x46')][_0xcc80('0x4e')],_0x2007ce['body'][_0xcc80('0x38')]);return db[_0xcc80('0x49')][_0xcc80('0x45')](_0x2007ce[_0xcc80('0x46')],{'include':[{'model':db[_0xcc80('0x51')],'as':_0xcc80('0x4d')},{'model':db[_0xcc80('0x51')],'as':_0xcc80('0x4f')}]});}return null;})[_0xcc80('0x21')](respondWithResult(_0x115ee1,null))[_0xcc80('0x40')](handleError(_0x115ee1,null));};var md5=require('md5');exports['getFields']=function(_0x1d196b,_0x1e7dc7,_0x215033){var _0x236799=null;var _0x453d6f=null;var _0x4d9777=null;var _0xc44ffd=null;var _0x593044='';return db[_0xcc80('0x3d')][_0xcc80('0x48')]({'where':{'id':_0x1d196b['params']['id']},'attributes':['id',_0xcc80('0x25'),_0xcc80('0x52'),'description',_0xcc80('0x53'),_0xcc80('0x54'),_0xcc80('0x55'),_0xcc80('0x56')]})[_0xcc80('0x21')](handleEntityNotFound(_0x1e7dc7,null))[_0xcc80('0x21')](function(_0x5982dd){if(_0x5982dd){_0x236799=_0x5982dd[_0xcc80('0x52')];_0x453d6f=_0x5982dd[_0xcc80('0x56')];_0x4d9777=_0x5982dd[_0xcc80('0x53')];_0x593044=_0x5982dd['remoteUri'];var _0x443bad=_0x593044[_0xcc80('0x57')](-0x1);if(_0x443bad==='/'){_0x593044=_0x593044['substring'](0x0,_0x593044[_0xcc80('0x58')](_0x443bad));}_0xc44ffd=util[_0xcc80('0x59')](_0xcc80('0x5a'),_0x593044);var _0x2074b4={'method':'GET','uri':_0xc44ffd,'qs':{'operation':_0xcc80('0x5b'),'username':_0x5982dd[_0xcc80('0x52')]},'json':!![]};return rp(_0x2074b4);}})['then'](function(_0x4c3231){if(_0x4c3231[_0xcc80('0x5c')]){var _0x57e9f7={'method':'POST','uri':_0xc44ffd,'form':{'operation':_0xcc80('0x5d'),'username':_0x236799,'accessKey':md5(_0x4c3231[_0xcc80('0x5e')][_0xcc80('0x5f')]+_0x453d6f)},'json':!![]};return rp(_0x57e9f7);}})[_0xcc80('0x21')](function(_0xd518f2){if(_0xd518f2[_0xcc80('0x5c')]){var _0x2d5039={'method':'GET','uri':_0xc44ffd,'qs':{'operation':'describe','username':_0x236799,'sessionName':_0xd518f2[_0xcc80('0x5e')][_0xcc80('0x60')],'elementType':_0x4d9777},'json':!![]};return rp(_0x2d5039);}})['then'](function(_0x55bfcb){if(_0x55bfcb[_0xcc80('0x5c')]){var _0x794e7d=['autogenerated',_0xcc80('0x61'),_0xcc80('0x62')];_[_0xcc80('0x63')](_0x55bfcb[_0xcc80('0x5e')]['fields'],function(_0x3ad516){return _0x794e7d[_0xcc80('0x64')](_0x3ad516[_0xcc80('0x38')]['name']);});_[_0xcc80('0x63')](_0x55bfcb[_0xcc80('0x5e')][_0xcc80('0x31')],function(_0x45e4af){return _0x45e4af[_0xcc80('0x65')]===_0xcc80('0x66');});return{'count':_0x55bfcb['result'][_0xcc80('0x31')][_0xcc80('0x43')],'rows':_[_0xcc80('0x28')](_0x55bfcb[_0xcc80('0x5e')][_0xcc80('0x31')],function(_0x4a245d){return{'id':_0x4a245d[_0xcc80('0x25')],'name':_0x4a245d[_0xcc80('0x67')],'custom':_[_0xcc80('0x68')](_0x4a245d['name'],_0xcc80('0x69'))?!![]:![],'options':_0x4a245d[_0xcc80('0x38')][_0xcc80('0x25')]===_0xcc80('0x6a')&&_0x4a245d[_0xcc80('0x38')]['picklistValues'][_0xcc80('0x43')]>0x0?_[_0xcc80('0x28')](_0x4a245d['type']['picklistValues'],function(_0x16bccc){return{'name':_0x16bccc[_0xcc80('0x67')],'value':_0x16bccc[_0xcc80('0x6b')]};}):[]};})};}})['then'](respondWithResult(_0x1e7dc7,null))['catch'](function(_0x420f43){console[_0xcc80('0x6c')](_0xcc80('0x6d')+_0x420f43);var _0x16b464=_0x1d196b[_0xcc80('0x2b')][_0xcc80('0x6e')]?0x1f4:_0x420f43[_0xcc80('0x6f')]||0x1f4;logger[_0xcc80('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xcc80('0x70'),_0x16b464,JSON[_0xcc80('0x71')](_0x420f43));delete _0x420f43[_0xcc80('0x25')];if(_0x16b464===0x191){_0x16b464=0x190;}_0x1e7dc7['status'](_0x16b464)[_0xcc80('0x26')](_0x1d196b[_0xcc80('0x2b')][_0xcc80('0x6e')]?{'message':_0xcc80('0x72'),'statusCode':_0x420f43[_0xcc80('0x6f')]}:_0x420f43);});}; \ No newline at end of file +var _0x405a=['owner','remove','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','md5','username','moduleName','serverUrl','accessKey','remoteUri','substring','lastIndexOf','format','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated'];(function(_0x37cbb0,_0x1e7ac8){var _0x439f6b=function(_0x26af14){while(--_0x26af14){_0x37cbb0['push'](_0x37cbb0['shift']());}};_0x439f6b(++_0x1e7ac8);}(_0x405a,0x89));var _0xa405=function(_0x1fa873,_0x1319ab){_0x1fa873=_0x1fa873-0x0;var _0x599fbc=_0x405a[_0x1fa873];return _0x599fbc;};'use strict';var emlformat=require(_0xa405('0x0'));var rimraf=require(_0xa405('0x1'));var zipdir=require(_0xa405('0x2'));var jsonpatch=require(_0xa405('0x3'));var rp=require(_0xa405('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa405('0x5'));var util=require(_0xa405('0x6'));var path=require('path');var sox=require(_0xa405('0x7'));var csv=require(_0xa405('0x8'));var ejs=require(_0xa405('0x9'));var fs=require('fs');var fs_extra=require(_0xa405('0xa'));var _=require(_0xa405('0xb'));var squel=require(_0xa405('0xc'));var crypto=require(_0xa405('0xd'));var jsforce=require(_0xa405('0xe'));var deskjs=require(_0xa405('0xf'));var toCsv=require(_0xa405('0x8'));var querystring=require(_0xa405('0x10'));var Papa=require(_0xa405('0x11'));var Redis=require(_0xa405('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa405('0x13'));var as=require(_0xa405('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa405('0x15'))(_0xa405('0x16'));var utils=require(_0xa405('0x17'));var config=require(_0xa405('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa405('0x19'))['db'];var integrations=require(_0xa405('0x1a'));function respondWithStatusCode(_0xd4d6f6,_0x21b282){_0x21b282=_0x21b282||0xcc;return function(_0x56d0fd){if(_0x56d0fd){return _0xd4d6f6[_0xa405('0x1b')](_0x21b282);}return _0xd4d6f6['status'](_0x21b282)[_0xa405('0x1c')]();};}function respondWithResult(_0x12b4ba,_0x34bb52){_0x34bb52=_0x34bb52||0xc8;return function(_0x40b9f1){if(_0x40b9f1){return _0x12b4ba['status'](_0x34bb52)[_0xa405('0x1d')](_0x40b9f1);}};}function respondWithFilteredResult(_0x27db2d,_0x2b806a){return function(_0x4ea47f){if(_0x4ea47f){var _0x4977d3=typeof _0x2b806a['offset']===_0xa405('0x1e')&&typeof _0x2b806a[_0xa405('0x1f')]===_0xa405('0x1e');var _0x476461=_0x4ea47f[_0xa405('0x20')];var _0x26bb8a=_0x4977d3?0x0:_0x2b806a[_0xa405('0x21')];var _0x503c4d=_0x4977d3?_0x4ea47f['count']:_0x2b806a[_0xa405('0x21')]+_0x2b806a[_0xa405('0x1f')];var _0x633a31;if(_0x503c4d>=_0x476461){_0x503c4d=_0x476461;_0x633a31=0xc8;}else{_0x633a31=0xce;}_0x27db2d[_0xa405('0x22')](_0x633a31);return _0x27db2d[_0xa405('0x23')](_0xa405('0x24'),_0x26bb8a+'-'+_0x503c4d+'/'+_0x476461)['json'](_0x4ea47f);}return null;};}function patchUpdates(_0x87bd08){return function(_0x507294){try{jsonpatch[_0xa405('0x25')](_0x507294,_0x87bd08,!![]);}catch(_0x2b76f0){return BPromise[_0xa405('0x26')](_0x2b76f0);}return _0x507294[_0xa405('0x27')]();};}function saveUpdates(_0x1b6649,_0x2be0e8){return function(_0x408c65){if(_0x408c65){return _0x408c65[_0xa405('0x28')](_0x1b6649)[_0xa405('0x29')](function(_0x1a65fa){return _0x1a65fa;});}return null;};}function removeEntity(_0x3e8c71,_0x779aa0){return function(_0x301bc1){if(_0x301bc1){return _0x301bc1[_0xa405('0x2a')]()[_0xa405('0x29')](function(){_0x3e8c71[_0xa405('0x22')](0xcc)[_0xa405('0x1c')]();});}};}function handleEntityNotFound(_0xa6d236,_0x4d7167){return function(_0x52bc2f){if(!_0x52bc2f){_0xa6d236['sendStatus'](0x194);}return _0x52bc2f;};}function handleError(_0x5edcfb,_0x1f1dfb){_0x1f1dfb=_0x1f1dfb||0x1f4;return function(_0x480849){logger[_0xa405('0x2b')](_0x480849[_0xa405('0x2c')]);if(_0x480849[_0xa405('0x2d')]){delete _0x480849[_0xa405('0x2d')];}_0x5edcfb[_0xa405('0x22')](_0x1f1dfb)[_0xa405('0x2e')](_0x480849);};}exports[_0xa405('0x2f')]=function(_0x10b13e,_0x228e6d){var _0x2b1e8d={},_0x3a685b={},_0x5714f1={'count':0x0,'rows':[]};var _0x2eca33=_[_0xa405('0x30')](db[_0xa405('0x31')][_0xa405('0x32')],function(_0x4c90da){return{'name':_0x4c90da[_0xa405('0x33')],'type':_0x4c90da[_0xa405('0x34')][_0xa405('0x35')]};});_0x3a685b[_0xa405('0x36')]=_[_0xa405('0x30')](_0x2eca33,_0xa405('0x2d'));_0x3a685b[_0xa405('0x37')]=_[_0xa405('0x38')](_0x10b13e[_0xa405('0x37')]);_0x3a685b[_0xa405('0x39')]=_[_0xa405('0x3a')](_0x3a685b[_0xa405('0x36')],_0x3a685b[_0xa405('0x37')]);_0x2b1e8d[_0xa405('0x3b')]=_[_0xa405('0x3a')](_0x3a685b[_0xa405('0x36')],qs[_0xa405('0x3c')](_0x10b13e[_0xa405('0x37')][_0xa405('0x3c')]));_0x2b1e8d[_0xa405('0x3b')]=_0x2b1e8d[_0xa405('0x3b')][_0xa405('0x3d')]?_0x2b1e8d[_0xa405('0x3b')]:_0x3a685b[_0xa405('0x36')];if(!_0x10b13e[_0xa405('0x37')][_0xa405('0x3e')]('nolimit')){_0x2b1e8d[_0xa405('0x1f')]=qs[_0xa405('0x1f')](_0x10b13e[_0xa405('0x37')][_0xa405('0x1f')]);_0x2b1e8d['offset']=qs[_0xa405('0x21')](_0x10b13e['query'][_0xa405('0x21')]);}_0x2b1e8d['order']=qs[_0xa405('0x3f')](_0x10b13e[_0xa405('0x37')][_0xa405('0x3f')]);_0x2b1e8d[_0xa405('0x40')]=qs['filters'](_[_0xa405('0x41')](_0x10b13e[_0xa405('0x37')],_0x3a685b[_0xa405('0x39')]),_0x2eca33);if(_0x10b13e[_0xa405('0x37')][_0xa405('0x42')]){_0x2b1e8d[_0xa405('0x40')]=_[_0xa405('0x43')](_0x2b1e8d[_0xa405('0x40')],{'$or':_['map'](_0x2eca33,function(_0x3b9ccb){if(_0x3b9ccb[_0xa405('0x34')]!==_0xa405('0x44')){var _0x210af1={};_0x210af1[_0x3b9ccb[_0xa405('0x2d')]]={'$like':'%'+_0x10b13e[_0xa405('0x37')][_0xa405('0x42')]+'%'};return _0x210af1;}})});}_0x2b1e8d=_['merge']({},_0x2b1e8d,_0x10b13e[_0xa405('0x45')]);var _0x37a22d={'where':_0x2b1e8d[_0xa405('0x40')]};return db['VtigerAccount'][_0xa405('0x20')](_0x37a22d)['then'](function(_0x3d8ec6){_0x5714f1[_0xa405('0x20')]=_0x3d8ec6;if(_0x10b13e[_0xa405('0x37')][_0xa405('0x46')]){_0x2b1e8d[_0xa405('0x47')]=[{'all':!![]}];}return db[_0xa405('0x31')][_0xa405('0x48')](_0x2b1e8d);})[_0xa405('0x29')](function(_0x36ed39){_0x5714f1[_0xa405('0x49')]=_0x36ed39;return _0x5714f1;})[_0xa405('0x29')](respondWithFilteredResult(_0x228e6d,_0x2b1e8d))[_0xa405('0x4a')](handleError(_0x228e6d,null));};exports[_0xa405('0x4b')]=function(_0x697d5d,_0x24091d){var _0x163a23={'raw':![],'where':{'id':_0x697d5d[_0xa405('0x4c')]['id']}},_0x58a32d={};_0x58a32d['model']=_[_0xa405('0x38')](db[_0xa405('0x31')][_0xa405('0x32')]);_0x58a32d[_0xa405('0x37')]=_[_0xa405('0x38')](_0x697d5d[_0xa405('0x37')]);_0x58a32d['filters']=_[_0xa405('0x3a')](_0x58a32d[_0xa405('0x36')],_0x58a32d[_0xa405('0x37')]);_0x163a23[_0xa405('0x3b')]=_[_0xa405('0x3a')](_0x58a32d[_0xa405('0x36')],qs[_0xa405('0x3c')](_0x697d5d[_0xa405('0x37')]['fields']));_0x163a23[_0xa405('0x3b')]=_0x163a23[_0xa405('0x3b')][_0xa405('0x3d')]?_0x163a23[_0xa405('0x3b')]:_0x58a32d[_0xa405('0x36')];if(_0x697d5d[_0xa405('0x37')][_0xa405('0x46')]){_0x163a23['include']=[{'all':!![]}];}_0x163a23=_[_0xa405('0x43')]({},_0x163a23,_0x697d5d[_0xa405('0x45')]);return db[_0xa405('0x31')][_0xa405('0x4d')](_0x163a23)[_0xa405('0x29')](handleEntityNotFound(_0x24091d,null))[_0xa405('0x29')](respondWithResult(_0x24091d,null))[_0xa405('0x4a')](handleError(_0x24091d,null));};exports[_0xa405('0x4e')]=function(_0x48f928,_0x420518){return db[_0xa405('0x31')][_0xa405('0x4e')](_0x48f928['body'],{})['then'](respondWithResult(_0x420518,0xc9))[_0xa405('0x4a')](handleError(_0x420518,null));};exports['update']=function(_0x13af0f,_0x43e9dd){if(_0x13af0f[_0xa405('0x4f')]['id']){delete _0x13af0f[_0xa405('0x4f')]['id'];}return db['VtigerAccount'][_0xa405('0x4d')]({'where':{'id':_0x13af0f[_0xa405('0x4c')]['id']}})[_0xa405('0x29')](handleEntityNotFound(_0x43e9dd,null))[_0xa405('0x29')](saveUpdates(_0x13af0f[_0xa405('0x4f')],null))['then'](respondWithResult(_0x43e9dd,null))['catch'](handleError(_0x43e9dd,null));};exports[_0xa405('0x2a')]=function(_0x3c8eb3,_0x8305b5){return db[_0xa405('0x31')][_0xa405('0x4d')]({'where':{'id':_0x3c8eb3[_0xa405('0x4c')]['id']}})[_0xa405('0x29')](handleEntityNotFound(_0x8305b5,null))[_0xa405('0x29')](removeEntity(_0x8305b5,null))['catch'](handleError(_0x8305b5,null));};exports[_0xa405('0x50')]=function(_0x7b00d4,_0x4d6ab8,_0x28c143){var _0x2db237={};var _0x3e0b58={};var _0x187a56;var _0x2fd216;return db['VtigerAccount'][_0xa405('0x51')]({'where':{'id':_0x7b00d4[_0xa405('0x4c')]['id']}})[_0xa405('0x29')](handleEntityNotFound(_0x4d6ab8,null))[_0xa405('0x29')](function(_0x104787){if(_0x104787){_0x187a56=_0x104787;_0x3e0b58[_0xa405('0x36')]=_[_0xa405('0x38')](db[_0xa405('0x52')][_0xa405('0x32')]);_0x3e0b58[_0xa405('0x37')]=_[_0xa405('0x38')](_0x7b00d4[_0xa405('0x37')]);_0x3e0b58[_0xa405('0x39')]=_[_0xa405('0x3a')](_0x3e0b58[_0xa405('0x36')],_0x3e0b58['query']);_0x2db237['attributes']=_['intersection'](_0x3e0b58[_0xa405('0x36')],qs[_0xa405('0x3c')](_0x7b00d4[_0xa405('0x37')]['fields']));_0x2db237[_0xa405('0x3b')]=_0x2db237[_0xa405('0x3b')][_0xa405('0x3d')]?_0x2db237['attributes']:_0x3e0b58['model'];_0x2db237['order']=qs[_0xa405('0x3f')](_0x7b00d4[_0xa405('0x37')][_0xa405('0x3f')]);_0x2db237['where']=qs['filters'](_[_0xa405('0x41')](_0x7b00d4[_0xa405('0x37')],_0x3e0b58[_0xa405('0x39')]));if(_0x7b00d4['query'][_0xa405('0x42')]){_0x2db237[_0xa405('0x40')]=_[_0xa405('0x43')](_0x2db237[_0xa405('0x40')],{'$or':_[_0xa405('0x30')](_0x2db237[_0xa405('0x3b')],function(_0x4dafd3){var _0x131187={};_0x131187[_0x4dafd3]={'$like':'%'+_0x7b00d4['query'][_0xa405('0x42')]+'%'};return _0x131187;})});}_0x2db237=_['merge']({},_0x2db237,_0x7b00d4[_0xa405('0x45')]);return _0x187a56['getConfigurations'](_0x2db237);}})[_0xa405('0x29')](function(_0x5c4c0f){if(_0x5c4c0f){_0x2fd216=_0x5c4c0f['length'];if(!_0x7b00d4[_0xa405('0x37')]['hasOwnProperty']('nolimit')){_0x2db237[_0xa405('0x1f')]=qs[_0xa405('0x1f')](_0x7b00d4[_0xa405('0x37')]['limit']);_0x2db237[_0xa405('0x21')]=qs['offset'](_0x7b00d4[_0xa405('0x37')]['offset']);}return _0x187a56[_0xa405('0x50')](_0x2db237);}})[_0xa405('0x29')](function(_0x4c47b0){if(_0x4c47b0){return _0x4c47b0?{'count':_0x2fd216,'rows':_0x4c47b0}:null;}})[_0xa405('0x29')](respondWithResult(_0x4d6ab8,null))['catch'](handleError(_0x4d6ab8,null));};exports[_0xa405('0x53')]=function(_0x4596bc,_0x2ec7e5,_0x6b5daa){if(_0x4596bc[_0xa405('0x4f')]['id']){delete _0x4596bc[_0xa405('0x4f')]['id'];}return db[_0xa405('0x31')]['findOne']({'where':{'id':_0x4596bc[_0xa405('0x4c')]['id']}})[_0xa405('0x29')](handleEntityNotFound(_0x2ec7e5,null))[_0xa405('0x29')](function(_0x367843){if(_0x367843){_0x4596bc[_0xa405('0x4f')][_0xa405('0x54')]=_0x367843['id'];_0x4596bc[_0xa405('0x4f')][_0xa405('0x55')]=integrations[_0xa405('0x56')](_0x4596bc[_0xa405('0x4f')]['channel'],_0x4596bc[_0xa405('0x4f')][_0xa405('0x34')]);_0x4596bc[_0xa405('0x4f')][_0xa405('0x57')]=integrations['getDescriptions'](_0x4596bc[_0xa405('0x4f')]['channel'],_0x4596bc[_0xa405('0x4f')][_0xa405('0x34')]);return db[_0xa405('0x52')]['create'](_0x4596bc['body'],{'include':[{'model':db['VtigerField'],'as':_0xa405('0x55')},{'model':db['VtigerField'],'as':_0xa405('0x57')}]});}return null;})[_0xa405('0x29')](respondWithResult(_0x2ec7e5,null))[_0xa405('0x4a')](handleError(_0x2ec7e5,null));};var md5=require(_0xa405('0x58'));exports['getFields']=function(_0x452eaa,_0x4deb84,_0x279d1a){var _0x30229d=null;var _0x2a7d6b=null;var _0x71a8e8=null;var _0x17ffa8=null;var _0x2a00db='';return db[_0xa405('0x31')][_0xa405('0x51')]({'where':{'id':_0x452eaa[_0xa405('0x4c')]['id']},'attributes':['id','name',_0xa405('0x59'),'description',_0xa405('0x5a'),'remoteUri',_0xa405('0x5b'),'accessKey']})['then'](handleEntityNotFound(_0x4deb84,null))[_0xa405('0x29')](function(_0x5bd7b8){if(_0x5bd7b8){_0x30229d=_0x5bd7b8[_0xa405('0x59')];_0x2a7d6b=_0x5bd7b8[_0xa405('0x5c')];_0x71a8e8=_0x5bd7b8[_0xa405('0x5a')];_0x2a00db=_0x5bd7b8[_0xa405('0x5d')];var _0x18a117=_0x2a00db['slice'](-0x1);if(_0x18a117==='/'){_0x2a00db=_0x2a00db[_0xa405('0x5e')](0x0,_0x2a00db[_0xa405('0x5f')](_0x18a117));}_0x17ffa8=util[_0xa405('0x60')]('%s/webservice.php',_0x2a00db);var _0x14e4c0={'method':_0xa405('0x61'),'uri':_0x17ffa8,'qs':{'operation':_0xa405('0x62'),'username':_0x5bd7b8[_0xa405('0x59')]},'json':!![]};return rp(_0x14e4c0);}})[_0xa405('0x29')](function(_0x17de59){if(_0x17de59['success']){var _0x137ccb={'method':_0xa405('0x63'),'uri':_0x17ffa8,'form':{'operation':_0xa405('0x64'),'username':_0x30229d,'accessKey':md5(_0x17de59[_0xa405('0x65')][_0xa405('0x66')]+_0x2a7d6b)},'json':!![]};return rp(_0x137ccb);}})['then'](function(_0x3967d3){if(_0x3967d3[_0xa405('0x67')]){var _0x1c0e74={'method':_0xa405('0x61'),'uri':_0x17ffa8,'qs':{'operation':_0xa405('0x68'),'username':_0x30229d,'sessionName':_0x3967d3['result'][_0xa405('0x69')],'elementType':_0x71a8e8},'json':!![]};return rp(_0x1c0e74);}})[_0xa405('0x29')](function(_0x2b9974){if(_0x2b9974[_0xa405('0x67')]){var _0x128d95=[_0xa405('0x6a'),'reference',_0xa405('0x6b')];_['remove'](_0x2b9974[_0xa405('0x65')]['fields'],function(_0x10a0f6){return _0x128d95['includes'](_0x10a0f6[_0xa405('0x34')][_0xa405('0x2d')]);});_[_0xa405('0x6c')](_0x2b9974[_0xa405('0x65')]['fields'],function(_0x19315d){return _0x19315d['editable']===_0xa405('0x6d');});return{'count':_0x2b9974[_0xa405('0x65')]['fields'][_0xa405('0x3d')],'rows':_[_0xa405('0x30')](_0x2b9974['result'][_0xa405('0x3c')],function(_0x32485e){return{'id':_0x32485e[_0xa405('0x2d')],'name':_0x32485e[_0xa405('0x6e')],'custom':_['startsWith'](_0x32485e[_0xa405('0x2d')],_0xa405('0x6f'))?!![]:![],'options':_0x32485e[_0xa405('0x34')]['name']===_0xa405('0x70')&&_0x32485e['type'][_0xa405('0x71')][_0xa405('0x3d')]>0x0?_['map'](_0x32485e[_0xa405('0x34')][_0xa405('0x71')],function(_0x1eb663){return{'name':_0x1eb663[_0xa405('0x6e')],'value':_0x1eb663[_0xa405('0x72')]};}):[]};})};}})[_0xa405('0x29')](respondWithResult(_0x4deb84,null))['catch'](function(_0x33c155){console[_0xa405('0x73')](_0xa405('0x74')+_0x33c155);var _0x3f61cf=_0x452eaa['query']['test']?0x1f4:_0x33c155[_0xa405('0x75')]||0x1f4;logger['error'](_0xa405('0x76'),_0xa405('0x77'),_0x3f61cf,JSON[_0xa405('0x78')](_0x33c155));delete _0x33c155['name'];if(_0x3f61cf===0x191){_0x3f61cf=0x190;}_0x4deb84[_0xa405('0x22')](_0x3f61cf)[_0xa405('0x2e')](_0x452eaa[_0xa405('0x37')]['test']?{'message':_0xa405('0x79'),'statusCode':_0x33c155[_0xa405('0x75')]}:_0x33c155);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e7e9ee8..f4e7f57 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 _0x0b65=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x47645f,_0x629091){var _0x40a4ed=function(_0x10e2f3){while(--_0x10e2f3){_0x47645f['push'](_0x47645f['shift']());}};_0x40a4ed(++_0x629091);}(_0x0b65,0x186));var _0x50b6=function(_0x2d690f,_0x17e6b2){_0x2d690f=_0x2d690f-0x0;var _0x21a6bd=_0x0b65[_0x2d690f];return _0x21a6bd;};'use strict';var _=require('lodash');var util=require(_0x50b6('0x0'));var logger=require(_0x50b6('0x1'))(_0x50b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x50b6('0x3'));var fs=require('fs');var path=require(_0x50b6('0x4'));var rimraf=require(_0x50b6('0x5'));var config=require(_0x50b6('0x6'));var attributes=require(_0x50b6('0x7'));var integrations=require(_0x50b6('0x8'));module[_0x50b6('0x9')]=function(_0x27c227,_0x13c4f4){return _0x27c227[_0x50b6('0xa')]('VtigerAccount',attributes,{'tableName':_0x50b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18da=['lodash','util','../../config/logger','api','request-promise','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0xd086de,_0x5403a0){var _0x2c0308=function(_0x32d1ac){while(--_0x32d1ac){_0xd086de['push'](_0xd086de['shift']());}};_0x2c0308(++_0x5403a0);}(_0x18da,0x78));var _0xa18d=function(_0x595790,_0x42f649){_0x595790=_0x595790-0x0;var _0x386928=_0x18da[_0x595790];return _0x386928;};'use strict';var _=require(_0xa18d('0x0'));var util=require(_0xa18d('0x1'));var logger=require(_0xa18d('0x2'))(_0xa18d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa18d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa18d('0x5'));module[_0xa18d('0x6')]=function(_0x5c568e,_0xc41a2e){return _0x5c568e[_0xa18d('0x7')](_0xa18d('0x8'),attributes,{'tableName':_0xa18d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index f0816ac..ab6756e 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 _0xee5b=['map','model','attributes','catch','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include'];(function(_0x5623cb,_0x20b099){var _0x368ce6=function(_0x3439ad){while(--_0x3439ad){_0x5623cb['push'](_0x5623cb['shift']());}};_0x368ce6(++_0x20b099);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1cd075,_0x4669d3){_0x1cd075=_0x1cd075-0x0;var _0x53aa00=_0xee5b[_0x1cd075];return _0x53aa00;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});};exports[_0xbee5('0x20')]=function(_0x2ccb91){var _0x59c2e4=this;return new Promise(function(_0x22df5f,_0x5b10a6){return db[_0xbee5('0x16')]['find']({'raw':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91['options'][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccb91['options']?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')]['attributes']||null:null,'include':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x2ccb91['options'][_0xbee5('0x1b')],function(_0x28f8e3){return{'model':db[_0x28f8e3[_0xbee5('0x1d')]],'as':_0x28f8e3['as'],'attributes':_0x28f8e3[_0xbee5('0x1e')],'include':_0x28f8e3['include']?_[_0xbee5('0x1c')](_0x28f8e3[_0xbee5('0x1b')],function(_0x3e854){return{'model':db[_0x3e854[_0xbee5('0x1d')]],'as':_0x3e854['as'],'attributes':_0x3e854['attributes'],'include':_0x3e854[_0xbee5('0x1b')]?_['map'](_0x3e854[_0xbee5('0x1b')],function(_0x58a2e3){return{'model':db[_0x58a2e3['model']],'as':_0x58a2e3['as'],'attributes':_0x58a2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee5('0xa')](function(_0x315523){logger[_0xbee5('0xb')](_0xbee5('0x20'),_0x2ccb91);logger[_0xbee5('0xd')](_0xbee5('0x20'),_0x2ccb91,JSON[_0xbee5('0x10')](_0x315523));_0x22df5f(_0x315523);})[_0xbee5('0x1f')](function(_0x58452a){logger[_0xbee5('0x11')]('ShowVtigerAccount',_0x58452a[_0xbee5('0x13')],_0x2ccb91);_0x5b10a6(_0x59c2e4[_0xbee5('0x11')](0x1f4,_0x58452a[_0xbee5('0x13')]));});});}; \ 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(_0x2c2f1f,_0x475246){var _0xe98b9b=function(_0x26d6ad){while(--_0x26d6ad){_0x2c2f1f['push'](_0x2c2f1f['shift']());}};_0xe98b9b(++_0x475246);}(_0xf45e,0x115));var _0xef45=function(_0x12812e,_0x4d418c){_0x12812e=_0x12812e-0x0;var _0x210fc8=_0xf45e[_0x12812e];return _0x210fc8;};'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 731fce5..c4bdc20 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 _0x0f0e=['fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','connect-timeout','express','Router'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x0f0e,0x107));var _0xe0f0=function(_0x180862,_0x9273b1){_0x180862=_0x180862-0x0;var _0xf78dad=_0x0f0e[_0x180862];return _0xf78dad;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe0f0('0x0'));var express=require(_0xe0f0('0x1'));var router=express[_0xe0f0('0x2')]();var fs_extra=require(_0xe0f0('0x3'));var auth=require(_0xe0f0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xe0f0('0x5')]('/',auth['isAuthenticated'](),controller[_0xe0f0('0x6')]);router[_0xe0f0('0x5')](_0xe0f0('0x7'),auth[_0xe0f0('0x8')](),controller[_0xe0f0('0x9')]);router[_0xe0f0('0x5')]('/:id/fields',auth[_0xe0f0('0x8')](),controller[_0xe0f0('0xa')]);router[_0xe0f0('0x5')](_0xe0f0('0xb'),auth[_0xe0f0('0x8')](),controller[_0xe0f0('0xc')]);router[_0xe0f0('0x5')](_0xe0f0('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xe0f0('0xe')]);router[_0xe0f0('0xf')](_0xe0f0('0x7'),auth[_0xe0f0('0x8')](),controller[_0xe0f0('0x10')]);router[_0xe0f0('0x11')](_0xe0f0('0x7'),auth[_0xe0f0('0x8')](),controller[_0xe0f0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa0f6=['get','/:id','show','getDescriptions','post','create','delete','exports','util','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xa0f6,0x116));var _0x6a0f=function(_0x1495c0,_0x2af3bf){_0x1495c0=_0x1495c0-0x0;var _0x36bbfe=_0xa0f6[_0x1495c0];return _0x36bbfe;};'use strict';var multer=require('multer');var util=require(_0x6a0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a0f('0x1'));var router=express[_0x6a0f('0x2')]();var fs_extra=require(_0x6a0f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6a0f('0x4'));var controller=require(_0x6a0f('0x5'));router['get']('/',auth[_0x6a0f('0x6')](),controller['index']);router[_0x6a0f('0x7')](_0x6a0f('0x8'),auth[_0x6a0f('0x6')](),controller[_0x6a0f('0x9')]);router['get']('/:id/fields',auth[_0x6a0f('0x6')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x6a0f('0x6')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x6a0f('0x6')](),controller[_0x6a0f('0xa')]);router[_0x6a0f('0xb')]('/',auth['isAuthenticated'](),controller[_0x6a0f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6a0f('0xd')]('/:id',auth[_0x6a0f('0x6')](),controller['destroy']);module[_0x6a0f('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4ef6494..4c427fa 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 _0xdf59=['exports','STRING'];(function(_0x3c3b57,_0x5c6241){var _0x630592=function(_0x527535){while(--_0x527535){_0x3c3b57['push'](_0x3c3b57['shift']());}};_0x630592(++_0x5c6241);}(_0xdf59,0x9e));var _0x9df5=function(_0x2fdc4f,_0xd5a393){_0x2fdc4f=_0x2fdc4f-0x0;var _0x389302=_0xdf59[_0x2fdc4f];return _0x389302;};'use strict';var Sequelize=require('sequelize');module[_0x9df5('0x0')]={'name':{'type':Sequelize[_0x9df5('0x1')]},'description':{'type':Sequelize[_0x9df5('0x1')]}}; \ No newline at end of file +var _0x9ab2=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ab2,0x131));var _0x29ab=function(_0x21463b,_0x5b5c2){_0x21463b=_0x21463b-0x0;var _0x212b05=_0x9ab2[_0x21463b];return _0x212b05;};'use strict';var Sequelize=require(_0x29ab('0x0'));module[_0x29ab('0x1')]={'name':{'type':Sequelize[_0x29ab('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0f11fc9..032f5bd 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 _0x0641=['request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','end','error','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x41da6a,_0xb6ad1c){var _0x2cbd52=function(_0x42d34e){while(--_0x42d34e){_0x41da6a['push'](_0x41da6a['shift']());}};_0x2cbd52(++_0xb6ad1c);}(_0x0641,0x140));var _0x1064=function(_0x429a06,_0x394001){_0x429a06=_0x429a06-0x0;var _0x2f68b4=_0x0641[_0x429a06];return _0x2f68b4;};'use strict';var emlformat=require(_0x1064('0x0'));var rimraf=require(_0x1064('0x1'));var zipdir=require(_0x1064('0x2'));var jsonpatch=require(_0x1064('0x3'));var rp=require(_0x1064('0x4'));var moment=require(_0x1064('0x5'));var BPromise=require(_0x1064('0x6'));var Mustache=require(_0x1064('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1064('0x8'));var fs=require('fs');var fs_extra=require(_0x1064('0x9'));var _=require(_0x1064('0xa'));var squel=require(_0x1064('0xb'));var crypto=require(_0x1064('0xc'));var jsforce=require(_0x1064('0xd'));var deskjs=require(_0x1064('0xe'));var toCsv=require(_0x1064('0xf'));var querystring=require(_0x1064('0x10'));var Papa=require(_0x1064('0x11'));var Redis=require('ioredis');var authService=require(_0x1064('0x12'));var qs=require(_0x1064('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1064('0x14'));var logger=require(_0x1064('0x15'))('api');var utils=require(_0x1064('0x16'));var config=require(_0x1064('0x17'));var licenseUtil=require(_0x1064('0x18'));var db=require(_0x1064('0x19'))['db'];function respondWithStatusCode(_0x1834dd,_0x58500b){_0x58500b=_0x58500b||0xcc;return function(_0x42f31b){if(_0x42f31b){return _0x1834dd[_0x1064('0x1a')](_0x58500b);}return _0x1834dd[_0x1064('0x1b')](_0x58500b)['end']();};}function respondWithResult(_0x4af2c1,_0x593253){_0x593253=_0x593253||0xc8;return function(_0x588fc7){if(_0x588fc7){return _0x4af2c1[_0x1064('0x1b')](_0x593253)[_0x1064('0x1c')](_0x588fc7);}};}function respondWithFilteredResult(_0x51cb1a,_0x5aa31d){return function(_0x421cc5){if(_0x421cc5){var _0xd7e2e7=typeof _0x5aa31d[_0x1064('0x1d')]===_0x1064('0x1e')&&typeof _0x5aa31d[_0x1064('0x1f')]===_0x1064('0x1e');var _0x4f76f2=_0x421cc5['count'];var _0x3987c1=_0xd7e2e7?0x0:_0x5aa31d[_0x1064('0x1d')];var _0x14362d=_0xd7e2e7?_0x421cc5[_0x1064('0x20')]:_0x5aa31d[_0x1064('0x1d')]+_0x5aa31d[_0x1064('0x1f')];var _0x35bfd0;if(_0x14362d>=_0x4f76f2){_0x14362d=_0x4f76f2;_0x35bfd0=0xc8;}else{_0x35bfd0=0xce;}_0x51cb1a[_0x1064('0x1b')](_0x35bfd0);return _0x51cb1a[_0x1064('0x21')]('Content-Range',_0x3987c1+'-'+_0x14362d+'/'+_0x4f76f2)['json'](_0x421cc5);}return null;};}function patchUpdates(_0x320c5c){return function(_0x7c487a){try{jsonpatch['apply'](_0x7c487a,_0x320c5c,!![]);}catch(_0x2e1bbd){return BPromise[_0x1064('0x22')](_0x2e1bbd);}return _0x7c487a[_0x1064('0x23')]();};}function saveUpdates(_0xa8a70a,_0x40aaa1){return function(_0x55e62e){if(_0x55e62e){return _0x55e62e['update'](_0xa8a70a)[_0x1064('0x24')](function(_0x2e51d2){return _0x2e51d2;});}return null;};}function removeEntity(_0x3a71ab,_0x258b01){return function(_0x45724a){if(_0x45724a){return _0x45724a[_0x1064('0x25')]()[_0x1064('0x24')](function(){_0x3a71ab[_0x1064('0x1b')](0xcc)[_0x1064('0x26')]();});}};}function handleEntityNotFound(_0x20d962,_0x5e662d){return function(_0xa29c4a){if(!_0xa29c4a){_0x20d962['sendStatus'](0x194);}return _0xa29c4a;};}function handleError(_0x4f0fae,_0x2b5d5c){_0x2b5d5c=_0x2b5d5c||0x1f4;return function(_0xfee31){logger[_0x1064('0x27')](_0xfee31['stack']);if(_0xfee31['name']){delete _0xfee31[_0x1064('0x28')];}_0x4f0fae[_0x1064('0x1b')](_0x2b5d5c)[_0x1064('0x29')](_0xfee31);};}exports[_0x1064('0x2a')]=function(_0xfa32a,_0x1cd4cc){var _0x46146f={},_0x1b05aa={},_0x3719b3={'count':0x0,'rows':[]};var _0x450105=_['map'](db[_0x1064('0x2b')][_0x1064('0x2c')],function(_0x4d767f){return{'name':_0x4d767f[_0x1064('0x2d')],'type':_0x4d767f[_0x1064('0x2e')][_0x1064('0x2f')]};});_0x1b05aa[_0x1064('0x30')]=_['map'](_0x450105,_0x1064('0x28'));_0x1b05aa[_0x1064('0x31')]=_[_0x1064('0x32')](_0xfa32a[_0x1064('0x31')]);_0x1b05aa[_0x1064('0x33')]=_[_0x1064('0x34')](_0x1b05aa[_0x1064('0x30')],_0x1b05aa[_0x1064('0x31')]);_0x46146f[_0x1064('0x35')]=_[_0x1064('0x34')](_0x1b05aa[_0x1064('0x30')],qs[_0x1064('0x36')](_0xfa32a[_0x1064('0x31')][_0x1064('0x36')]));_0x46146f[_0x1064('0x35')]=_0x46146f[_0x1064('0x35')][_0x1064('0x37')]?_0x46146f['attributes']:_0x1b05aa[_0x1064('0x30')];if(!_0xfa32a['query']['hasOwnProperty'](_0x1064('0x38'))){_0x46146f[_0x1064('0x1f')]=qs[_0x1064('0x1f')](_0xfa32a[_0x1064('0x31')][_0x1064('0x1f')]);_0x46146f[_0x1064('0x1d')]=qs['offset'](_0xfa32a[_0x1064('0x31')][_0x1064('0x1d')]);}_0x46146f['order']=qs[_0x1064('0x39')](_0xfa32a[_0x1064('0x31')][_0x1064('0x39')]);_0x46146f[_0x1064('0x3a')]=qs['filters'](_['pick'](_0xfa32a[_0x1064('0x31')],_0x1b05aa[_0x1064('0x33')]),_0x450105);if(_0xfa32a['query'][_0x1064('0x3b')]){_0x46146f['where']=_[_0x1064('0x3c')](_0x46146f[_0x1064('0x3a')],{'$or':_[_0x1064('0x3d')](_0x450105,function(_0x19921b){if(_0x19921b[_0x1064('0x2e')]!=='VIRTUAL'){var _0x3889ff={};_0x3889ff[_0x19921b[_0x1064('0x28')]]={'$like':'%'+_0xfa32a['query'][_0x1064('0x3b')]+'%'};return _0x3889ff;}})});}_0x46146f=_['merge']({},_0x46146f,_0xfa32a['options']);var _0x4a6557={'where':_0x46146f[_0x1064('0x3a')]};return db[_0x1064('0x2b')][_0x1064('0x20')](_0x4a6557)[_0x1064('0x24')](function(_0x46f71a){_0x3719b3[_0x1064('0x20')]=_0x46f71a;if(_0xfa32a[_0x1064('0x31')][_0x1064('0x3e')]){_0x46146f[_0x1064('0x3f')]=[{'all':!![]}];}return db[_0x1064('0x2b')][_0x1064('0x40')](_0x46146f);})[_0x1064('0x24')](function(_0x1b41d4){_0x3719b3[_0x1064('0x41')]=_0x1b41d4;return _0x3719b3;})[_0x1064('0x24')](respondWithFilteredResult(_0x1cd4cc,_0x46146f))[_0x1064('0x42')](handleError(_0x1cd4cc,null));};exports[_0x1064('0x43')]=function(_0x3b47b1,_0x2bcbdf){var _0x50916a={'raw':![],'where':{'id':_0x3b47b1[_0x1064('0x44')]['id']}},_0x5d55c3={};_0x5d55c3['model']=_[_0x1064('0x32')](db['VtigerConfiguration'][_0x1064('0x2c')]);_0x5d55c3[_0x1064('0x31')]=_['keys'](_0x3b47b1[_0x1064('0x31')]);_0x5d55c3[_0x1064('0x33')]=_['intersection'](_0x5d55c3[_0x1064('0x30')],_0x5d55c3[_0x1064('0x31')]);_0x50916a['attributes']=_[_0x1064('0x34')](_0x5d55c3[_0x1064('0x30')],qs[_0x1064('0x36')](_0x3b47b1['query']['fields']));_0x50916a['attributes']=_0x50916a[_0x1064('0x35')][_0x1064('0x37')]?_0x50916a['attributes']:_0x5d55c3[_0x1064('0x30')];if(_0x3b47b1[_0x1064('0x31')][_0x1064('0x3e')]){_0x50916a[_0x1064('0x3f')]=[{'all':!![]}];}_0x50916a=_[_0x1064('0x3c')]({},_0x50916a,_0x3b47b1[_0x1064('0x45')]);return db[_0x1064('0x2b')][_0x1064('0x46')](_0x50916a)[_0x1064('0x24')](handleEntityNotFound(_0x2bcbdf,null))[_0x1064('0x24')](respondWithResult(_0x2bcbdf,null))['catch'](handleError(_0x2bcbdf,null));};exports[_0x1064('0x47')]=function(_0x3b33ed,_0x3d4ecc){return db[_0x1064('0x2b')][_0x1064('0x47')](_0x3b33ed[_0x1064('0x48')],{})[_0x1064('0x24')](respondWithResult(_0x3d4ecc,0xc9))[_0x1064('0x42')](handleError(_0x3d4ecc,null));};exports['update']=function(_0x4d1e9a,_0x271f08){if(_0x4d1e9a[_0x1064('0x48')]['id']){delete _0x4d1e9a[_0x1064('0x48')]['id'];}return db[_0x1064('0x2b')][_0x1064('0x46')]({'where':{'id':_0x4d1e9a[_0x1064('0x44')]['id']}})[_0x1064('0x24')](handleEntityNotFound(_0x271f08,null))[_0x1064('0x24')](saveUpdates(_0x4d1e9a[_0x1064('0x48')],null))[_0x1064('0x24')](respondWithResult(_0x271f08,null))[_0x1064('0x42')](handleError(_0x271f08,null));};exports[_0x1064('0x25')]=function(_0x494214,_0x57dd3b){return db[_0x1064('0x2b')][_0x1064('0x46')]({'where':{'id':_0x494214[_0x1064('0x44')]['id']}})[_0x1064('0x24')](handleEntityNotFound(_0x57dd3b,null))[_0x1064('0x24')](removeEntity(_0x57dd3b,null))[_0x1064('0x42')](handleError(_0x57dd3b,null));};exports[_0x1064('0x49')]=function(_0x5d28bd,_0x1adfb5,_0x21afc5){var _0x42469f={};var _0x2420c0={};var _0xc69211;var _0x3f7f60;return db['VtigerConfiguration'][_0x1064('0x4a')]({'where':{'id':_0x5d28bd['params']['id']}})[_0x1064('0x24')](handleEntityNotFound(_0x1adfb5,null))[_0x1064('0x24')](function(_0x5ac60e){if(_0x5ac60e){_0xc69211=_0x5ac60e;_0x2420c0[_0x1064('0x30')]=_[_0x1064('0x32')](db[_0x1064('0x4b')][_0x1064('0x2c')]);_0x2420c0['query']=_[_0x1064('0x32')](_0x5d28bd[_0x1064('0x31')]);_0x2420c0[_0x1064('0x33')]=_[_0x1064('0x34')](_0x2420c0['model'],_0x2420c0[_0x1064('0x31')]);_0x42469f[_0x1064('0x35')]=_[_0x1064('0x34')](_0x2420c0[_0x1064('0x30')],qs[_0x1064('0x36')](_0x5d28bd[_0x1064('0x31')]['fields']));_0x42469f[_0x1064('0x35')]=_0x42469f[_0x1064('0x35')][_0x1064('0x37')]?_0x42469f['attributes']:_0x2420c0[_0x1064('0x30')];_0x42469f[_0x1064('0x4c')]=qs[_0x1064('0x39')](_0x5d28bd['query'][_0x1064('0x39')]);_0x42469f[_0x1064('0x3a')]=qs['filters'](_['pick'](_0x5d28bd[_0x1064('0x31')],_0x2420c0[_0x1064('0x33')]));if(_0x5d28bd[_0x1064('0x31')]['filter']){_0x42469f[_0x1064('0x3a')]=_[_0x1064('0x3c')](_0x42469f[_0x1064('0x3a')],{'$or':_['map'](_0x42469f[_0x1064('0x35')],function(_0x3b0ef8){var _0x589ebb={};_0x589ebb[_0x3b0ef8]={'$like':'%'+_0x5d28bd[_0x1064('0x31')]['filter']+'%'};return _0x589ebb;})});}_0x42469f=_[_0x1064('0x3c')]({},_0x42469f,_0x5d28bd[_0x1064('0x45')]);return _0xc69211[_0x1064('0x49')](_0x42469f);}})['then'](function(_0x5bcacc){if(_0x5bcacc){_0x3f7f60=_0x5bcacc[_0x1064('0x37')];if(!_0x5d28bd[_0x1064('0x31')][_0x1064('0x4d')](_0x1064('0x38'))){_0x42469f[_0x1064('0x1f')]=qs[_0x1064('0x1f')](_0x5d28bd[_0x1064('0x31')]['limit']);_0x42469f[_0x1064('0x1d')]=qs[_0x1064('0x1d')](_0x5d28bd[_0x1064('0x31')][_0x1064('0x1d')]);}return _0xc69211[_0x1064('0x49')](_0x42469f);}})['then'](function(_0x3585ce){if(_0x3585ce){return _0x3585ce?{'count':_0x3f7f60,'rows':_0x3585ce}:null;}})[_0x1064('0x24')](respondWithResult(_0x1adfb5,null))[_0x1064('0x42')](handleError(_0x1adfb5,null));};exports[_0x1064('0x4e')]=function(_0x1117f7,_0x332233,_0x38db98){var _0x1c5b7d={};var _0x11ea5e={};var _0x191ec8;var _0x687621;return db[_0x1064('0x2b')][_0x1064('0x4a')]({'where':{'id':_0x1117f7[_0x1064('0x44')]['id']}})['then'](handleEntityNotFound(_0x332233,null))['then'](function(_0x15a975){if(_0x15a975){_0x191ec8=_0x15a975;_0x11ea5e['model']=_[_0x1064('0x32')](db[_0x1064('0x4b')][_0x1064('0x2c')]);_0x11ea5e[_0x1064('0x31')]=_[_0x1064('0x32')](_0x1117f7[_0x1064('0x31')]);_0x11ea5e['filters']=_[_0x1064('0x34')](_0x11ea5e[_0x1064('0x30')],_0x11ea5e[_0x1064('0x31')]);_0x1c5b7d['attributes']=_[_0x1064('0x34')](_0x11ea5e['model'],qs['fields'](_0x1117f7['query']['fields']));_0x1c5b7d['attributes']=_0x1c5b7d[_0x1064('0x35')][_0x1064('0x37')]?_0x1c5b7d['attributes']:_0x11ea5e[_0x1064('0x30')];_0x1c5b7d['order']=qs['sort'](_0x1117f7[_0x1064('0x31')][_0x1064('0x39')]);_0x1c5b7d[_0x1064('0x3a')]=qs['filters'](_[_0x1064('0x4f')](_0x1117f7[_0x1064('0x31')],_0x11ea5e[_0x1064('0x33')]));if(_0x1117f7[_0x1064('0x31')]['filter']){_0x1c5b7d[_0x1064('0x3a')]=_[_0x1064('0x3c')](_0x1c5b7d['where'],{'$or':_[_0x1064('0x3d')](_0x1c5b7d[_0x1064('0x35')],function(_0xdf08a0){var _0x15b6f1={};_0x15b6f1[_0xdf08a0]={'$like':'%'+_0x1117f7[_0x1064('0x31')][_0x1064('0x3b')]+'%'};return _0x15b6f1;})});}_0x1c5b7d=_[_0x1064('0x3c')]({},_0x1c5b7d,_0x1117f7['options']);return _0x191ec8[_0x1064('0x4e')](_0x1c5b7d);}})[_0x1064('0x24')](function(_0x5e9ba9){if(_0x5e9ba9){_0x687621=_0x5e9ba9['length'];if(!_0x1117f7['query'][_0x1064('0x4d')](_0x1064('0x38'))){_0x1c5b7d[_0x1064('0x1f')]=qs[_0x1064('0x1f')](_0x1117f7['query'][_0x1064('0x1f')]);_0x1c5b7d[_0x1064('0x1d')]=qs[_0x1064('0x1d')](_0x1117f7[_0x1064('0x31')]['offset']);}return _0x191ec8[_0x1064('0x4e')](_0x1c5b7d);}})[_0x1064('0x24')](function(_0x2a37e1){if(_0x2a37e1){return _0x2a37e1?{'count':_0x687621,'rows':_0x2a37e1}:null;}})['then'](respondWithResult(_0x332233,null))[_0x1064('0x42')](handleError(_0x332233,null));};exports['getDescriptions']=function(_0x25fdfb,_0x483a54,_0x3caa37){var _0x437735={};var _0x5ef555={};var _0x12712d;var _0x631ed2;return db[_0x1064('0x2b')][_0x1064('0x4a')]({'where':{'id':_0x25fdfb[_0x1064('0x44')]['id']}})[_0x1064('0x24')](handleEntityNotFound(_0x483a54,null))[_0x1064('0x24')](function(_0x1a13fb){if(_0x1a13fb){_0x12712d=_0x1a13fb;_0x5ef555[_0x1064('0x30')]=_[_0x1064('0x32')](db[_0x1064('0x4b')][_0x1064('0x2c')]);_0x5ef555[_0x1064('0x31')]=_[_0x1064('0x32')](_0x25fdfb['query']);_0x5ef555['filters']=_[_0x1064('0x34')](_0x5ef555['model'],_0x5ef555[_0x1064('0x31')]);_0x437735[_0x1064('0x35')]=_[_0x1064('0x34')](_0x5ef555[_0x1064('0x30')],qs[_0x1064('0x36')](_0x25fdfb['query'][_0x1064('0x36')]));_0x437735[_0x1064('0x35')]=_0x437735['attributes'][_0x1064('0x37')]?_0x437735['attributes']:_0x5ef555[_0x1064('0x30')];_0x437735['order']=qs[_0x1064('0x39')](_0x25fdfb[_0x1064('0x31')][_0x1064('0x39')]);_0x437735[_0x1064('0x3a')]=qs[_0x1064('0x33')](_[_0x1064('0x4f')](_0x25fdfb[_0x1064('0x31')],_0x5ef555[_0x1064('0x33')]));if(_0x25fdfb['query'][_0x1064('0x3b')]){_0x437735[_0x1064('0x3a')]=_[_0x1064('0x3c')](_0x437735[_0x1064('0x3a')],{'$or':_[_0x1064('0x3d')](_0x437735[_0x1064('0x35')],function(_0x2bc9bd){var _0x2f6305={};_0x2f6305[_0x2bc9bd]={'$like':'%'+_0x25fdfb[_0x1064('0x31')][_0x1064('0x3b')]+'%'};return _0x2f6305;})});}_0x437735=_['merge']({},_0x437735,_0x25fdfb['options']);return _0x12712d[_0x1064('0x50')](_0x437735);}})['then'](function(_0x16855b){if(_0x16855b){_0x631ed2=_0x16855b['length'];if(!_0x25fdfb['query'][_0x1064('0x4d')](_0x1064('0x38'))){_0x437735[_0x1064('0x1f')]=qs[_0x1064('0x1f')](_0x25fdfb[_0x1064('0x31')][_0x1064('0x1f')]);_0x437735[_0x1064('0x1d')]=qs[_0x1064('0x1d')](_0x25fdfb[_0x1064('0x31')][_0x1064('0x1d')]);}return _0x12712d[_0x1064('0x50')](_0x437735);}})[_0x1064('0x24')](function(_0x275eca){if(_0x275eca){return _0x275eca?{'count':_0x631ed2,'rows':_0x275eca}:null;}})[_0x1064('0x24')](respondWithResult(_0x483a54,null))[_0x1064('0x42')](handleError(_0x483a54,null));}; \ No newline at end of file +var _0xda06=['path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','params','find','catch','create','body','findOne','VtigerField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x3c3741,_0x5dc6d3){var _0x53b3b5=function(_0x53c919){while(--_0x53c919){_0x3c3741['push'](_0x3c3741['shift']());}};_0x53b3b5(++_0x5dc6d3);}(_0xda06,0x176));var _0x6da0=function(_0x43f585,_0x3f8ba8){_0x43f585=_0x43f585-0x0;var _0x399005=_0xda06[_0x43f585];return _0x399005;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6da0('0x0'));var zipdir=require(_0x6da0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6da0('0x2'));var BPromise=require(_0x6da0('0x3'));var Mustache=require(_0x6da0('0x4'));var util=require(_0x6da0('0x5'));var path=require(_0x6da0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6da0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6da0('0x8'));var crypto=require(_0x6da0('0x9'));var jsforce=require(_0x6da0('0xa'));var deskjs=require(_0x6da0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6da0('0xc'));var Papa=require(_0x6da0('0xd'));var Redis=require(_0x6da0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6da0('0xf'))('api');var utils=require(_0x6da0('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x6da0('0x11'));var db=require(_0x6da0('0x12'))['db'];function respondWithStatusCode(_0x1a490f,_0x13c49b){_0x13c49b=_0x13c49b||0xcc;return function(_0x4f3b21){if(_0x4f3b21){return _0x1a490f[_0x6da0('0x13')](_0x13c49b);}return _0x1a490f[_0x6da0('0x14')](_0x13c49b)[_0x6da0('0x15')]();};}function respondWithResult(_0x1cb878,_0x4d3e61){_0x4d3e61=_0x4d3e61||0xc8;return function(_0x1fa54b){if(_0x1fa54b){return _0x1cb878[_0x6da0('0x14')](_0x4d3e61)[_0x6da0('0x16')](_0x1fa54b);}};}function respondWithFilteredResult(_0x16e9a8,_0x44d8b1){return function(_0x42d843){if(_0x42d843){var _0x2ce332=typeof _0x44d8b1[_0x6da0('0x17')]===_0x6da0('0x18')&&typeof _0x44d8b1[_0x6da0('0x19')]===_0x6da0('0x18');var _0x5ac5d5=_0x42d843['count'];var _0x12a074=_0x2ce332?0x0:_0x44d8b1[_0x6da0('0x17')];var _0x13706c=_0x2ce332?_0x42d843[_0x6da0('0x1a')]:_0x44d8b1[_0x6da0('0x17')]+_0x44d8b1['limit'];var _0x43f89c;if(_0x13706c>=_0x5ac5d5){_0x13706c=_0x5ac5d5;_0x43f89c=0xc8;}else{_0x43f89c=0xce;}_0x16e9a8[_0x6da0('0x14')](_0x43f89c);return _0x16e9a8[_0x6da0('0x1b')](_0x6da0('0x1c'),_0x12a074+'-'+_0x13706c+'/'+_0x5ac5d5)['json'](_0x42d843);}return null;};}function patchUpdates(_0x325534){return function(_0x17112d){try{jsonpatch[_0x6da0('0x1d')](_0x17112d,_0x325534,!![]);}catch(_0x21d43e){return BPromise[_0x6da0('0x1e')](_0x21d43e);}return _0x17112d[_0x6da0('0x1f')]();};}function saveUpdates(_0x41e10b,_0x511ea3){return function(_0x2681dd){if(_0x2681dd){return _0x2681dd[_0x6da0('0x20')](_0x41e10b)[_0x6da0('0x21')](function(_0x36ac4c){return _0x36ac4c;});}return null;};}function removeEntity(_0x29f93f,_0x407821){return function(_0x535003){if(_0x535003){return _0x535003[_0x6da0('0x22')]()[_0x6da0('0x21')](function(){_0x29f93f[_0x6da0('0x14')](0xcc)[_0x6da0('0x15')]();});}};}function handleEntityNotFound(_0x344bd2,_0x2d721c){return function(_0x323e95){if(!_0x323e95){_0x344bd2[_0x6da0('0x13')](0x194);}return _0x323e95;};}function handleError(_0x1ae4b8,_0x1bba14){_0x1bba14=_0x1bba14||0x1f4;return function(_0x3d0e34){logger[_0x6da0('0x23')](_0x3d0e34[_0x6da0('0x24')]);if(_0x3d0e34['name']){delete _0x3d0e34[_0x6da0('0x25')];}_0x1ae4b8['status'](_0x1bba14)[_0x6da0('0x26')](_0x3d0e34);};}exports[_0x6da0('0x27')]=function(_0x4413dd,_0x1969ba){var _0x31a56c={},_0x1d950a={},_0x5d22f9={'count':0x0,'rows':[]};var _0xd13729=_['map'](db[_0x6da0('0x28')][_0x6da0('0x29')],function(_0x5a9509){return{'name':_0x5a9509[_0x6da0('0x2a')],'type':_0x5a9509[_0x6da0('0x2b')][_0x6da0('0x2c')]};});_0x1d950a[_0x6da0('0x2d')]=_['map'](_0xd13729,_0x6da0('0x25'));_0x1d950a[_0x6da0('0x2e')]=_[_0x6da0('0x2f')](_0x4413dd[_0x6da0('0x2e')]);_0x1d950a['filters']=_[_0x6da0('0x30')](_0x1d950a[_0x6da0('0x2d')],_0x1d950a[_0x6da0('0x2e')]);_0x31a56c[_0x6da0('0x31')]=_[_0x6da0('0x30')](_0x1d950a[_0x6da0('0x2d')],qs[_0x6da0('0x32')](_0x4413dd[_0x6da0('0x2e')][_0x6da0('0x32')]));_0x31a56c[_0x6da0('0x31')]=_0x31a56c['attributes'][_0x6da0('0x33')]?_0x31a56c[_0x6da0('0x31')]:_0x1d950a['model'];if(!_0x4413dd[_0x6da0('0x2e')]['hasOwnProperty'](_0x6da0('0x34'))){_0x31a56c[_0x6da0('0x19')]=qs[_0x6da0('0x19')](_0x4413dd[_0x6da0('0x2e')]['limit']);_0x31a56c[_0x6da0('0x17')]=qs[_0x6da0('0x17')](_0x4413dd[_0x6da0('0x2e')]['offset']);}_0x31a56c['order']=qs[_0x6da0('0x35')](_0x4413dd[_0x6da0('0x2e')][_0x6da0('0x35')]);_0x31a56c['where']=qs[_0x6da0('0x36')](_[_0x6da0('0x37')](_0x4413dd[_0x6da0('0x2e')],_0x1d950a['filters']),_0xd13729);if(_0x4413dd[_0x6da0('0x2e')][_0x6da0('0x38')]){_0x31a56c[_0x6da0('0x39')]=_[_0x6da0('0x3a')](_0x31a56c[_0x6da0('0x39')],{'$or':_[_0x6da0('0x3b')](_0xd13729,function(_0x47d099){if(_0x47d099[_0x6da0('0x2b')]!==_0x6da0('0x3c')){var _0x1dfc4a={};_0x1dfc4a[_0x47d099[_0x6da0('0x25')]]={'$like':'%'+_0x4413dd[_0x6da0('0x2e')][_0x6da0('0x38')]+'%'};return _0x1dfc4a;}})});}_0x31a56c=_[_0x6da0('0x3a')]({},_0x31a56c,_0x4413dd[_0x6da0('0x3d')]);var _0x2e171b={'where':_0x31a56c[_0x6da0('0x39')]};return db[_0x6da0('0x28')][_0x6da0('0x1a')](_0x2e171b)[_0x6da0('0x21')](function(_0x1799e8){_0x5d22f9[_0x6da0('0x1a')]=_0x1799e8;if(_0x4413dd['query'][_0x6da0('0x3e')]){_0x31a56c[_0x6da0('0x3f')]=[{'all':!![]}];}return db[_0x6da0('0x28')]['findAll'](_0x31a56c);})[_0x6da0('0x21')](function(_0x5d55b4){_0x5d22f9['rows']=_0x5d55b4;return _0x5d22f9;})[_0x6da0('0x21')](respondWithFilteredResult(_0x1969ba,_0x31a56c))['catch'](handleError(_0x1969ba,null));};exports['show']=function(_0x185a95,_0x5cd6b9){var _0x2f3eeb={'raw':![],'where':{'id':_0x185a95[_0x6da0('0x40')]['id']}},_0x3cf2e9={};_0x3cf2e9[_0x6da0('0x2d')]=_[_0x6da0('0x2f')](db[_0x6da0('0x28')]['rawAttributes']);_0x3cf2e9[_0x6da0('0x2e')]=_[_0x6da0('0x2f')](_0x185a95[_0x6da0('0x2e')]);_0x3cf2e9[_0x6da0('0x36')]=_['intersection'](_0x3cf2e9[_0x6da0('0x2d')],_0x3cf2e9['query']);_0x2f3eeb[_0x6da0('0x31')]=_['intersection'](_0x3cf2e9[_0x6da0('0x2d')],qs[_0x6da0('0x32')](_0x185a95['query'][_0x6da0('0x32')]));_0x2f3eeb[_0x6da0('0x31')]=_0x2f3eeb[_0x6da0('0x31')]['length']?_0x2f3eeb['attributes']:_0x3cf2e9[_0x6da0('0x2d')];if(_0x185a95[_0x6da0('0x2e')][_0x6da0('0x3e')]){_0x2f3eeb[_0x6da0('0x3f')]=[{'all':!![]}];}_0x2f3eeb=_['merge']({},_0x2f3eeb,_0x185a95[_0x6da0('0x3d')]);return db['VtigerConfiguration'][_0x6da0('0x41')](_0x2f3eeb)[_0x6da0('0x21')](handleEntityNotFound(_0x5cd6b9,null))[_0x6da0('0x21')](respondWithResult(_0x5cd6b9,null))[_0x6da0('0x42')](handleError(_0x5cd6b9,null));};exports['create']=function(_0x5290e4,_0x565d35){return db[_0x6da0('0x28')][_0x6da0('0x43')](_0x5290e4['body'],{})['then'](respondWithResult(_0x565d35,0xc9))[_0x6da0('0x42')](handleError(_0x565d35,null));};exports[_0x6da0('0x20')]=function(_0x4191f8,_0x11d4af){if(_0x4191f8[_0x6da0('0x44')]['id']){delete _0x4191f8[_0x6da0('0x44')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4191f8['params']['id']}})[_0x6da0('0x21')](handleEntityNotFound(_0x11d4af,null))[_0x6da0('0x21')](saveUpdates(_0x4191f8[_0x6da0('0x44')],null))[_0x6da0('0x21')](respondWithResult(_0x11d4af,null))[_0x6da0('0x42')](handleError(_0x11d4af,null));};exports['destroy']=function(_0x240421,_0x1ce771){return db['VtigerConfiguration'][_0x6da0('0x41')]({'where':{'id':_0x240421[_0x6da0('0x40')]['id']}})[_0x6da0('0x21')](handleEntityNotFound(_0x1ce771,null))[_0x6da0('0x21')](removeEntity(_0x1ce771,null))[_0x6da0('0x42')](handleError(_0x1ce771,null));};exports['getFields']=function(_0x5ca257,_0x369cd7,_0x4e1f8f){var _0x557dbd={};var _0x5c0b6f={};var _0x38e9c8;var _0x54f994;return db['VtigerConfiguration'][_0x6da0('0x45')]({'where':{'id':_0x5ca257[_0x6da0('0x40')]['id']}})[_0x6da0('0x21')](handleEntityNotFound(_0x369cd7,null))['then'](function(_0x2772ab){if(_0x2772ab){_0x38e9c8=_0x2772ab;_0x5c0b6f[_0x6da0('0x2d')]=_['keys'](db[_0x6da0('0x46')][_0x6da0('0x29')]);_0x5c0b6f[_0x6da0('0x2e')]=_[_0x6da0('0x2f')](_0x5ca257[_0x6da0('0x2e')]);_0x5c0b6f[_0x6da0('0x36')]=_[_0x6da0('0x30')](_0x5c0b6f['model'],_0x5c0b6f[_0x6da0('0x2e')]);_0x557dbd[_0x6da0('0x31')]=_[_0x6da0('0x30')](_0x5c0b6f[_0x6da0('0x2d')],qs[_0x6da0('0x32')](_0x5ca257[_0x6da0('0x2e')][_0x6da0('0x32')]));_0x557dbd[_0x6da0('0x31')]=_0x557dbd['attributes'][_0x6da0('0x33')]?_0x557dbd['attributes']:_0x5c0b6f[_0x6da0('0x2d')];_0x557dbd[_0x6da0('0x47')]=qs['sort'](_0x5ca257[_0x6da0('0x2e')][_0x6da0('0x35')]);_0x557dbd[_0x6da0('0x39')]=qs[_0x6da0('0x36')](_[_0x6da0('0x37')](_0x5ca257['query'],_0x5c0b6f['filters']));if(_0x5ca257[_0x6da0('0x2e')][_0x6da0('0x38')]){_0x557dbd[_0x6da0('0x39')]=_[_0x6da0('0x3a')](_0x557dbd[_0x6da0('0x39')],{'$or':_[_0x6da0('0x3b')](_0x557dbd[_0x6da0('0x31')],function(_0x48adad){var _0x2de722={};_0x2de722[_0x48adad]={'$like':'%'+_0x5ca257['query'][_0x6da0('0x38')]+'%'};return _0x2de722;})});}_0x557dbd=_[_0x6da0('0x3a')]({},_0x557dbd,_0x5ca257[_0x6da0('0x3d')]);return _0x38e9c8[_0x6da0('0x48')](_0x557dbd);}})[_0x6da0('0x21')](function(_0x6ac5ab){if(_0x6ac5ab){_0x54f994=_0x6ac5ab[_0x6da0('0x33')];if(!_0x5ca257[_0x6da0('0x2e')][_0x6da0('0x49')]('nolimit')){_0x557dbd[_0x6da0('0x19')]=qs[_0x6da0('0x19')](_0x5ca257['query'][_0x6da0('0x19')]);_0x557dbd[_0x6da0('0x17')]=qs[_0x6da0('0x17')](_0x5ca257[_0x6da0('0x2e')][_0x6da0('0x17')]);}return _0x38e9c8[_0x6da0('0x48')](_0x557dbd);}})[_0x6da0('0x21')](function(_0x2af4a1){if(_0x2af4a1){return _0x2af4a1?{'count':_0x54f994,'rows':_0x2af4a1}:null;}})[_0x6da0('0x21')](respondWithResult(_0x369cd7,null))[_0x6da0('0x42')](handleError(_0x369cd7,null));};exports[_0x6da0('0x4a')]=function(_0x7a3bab,_0x1544be,_0x13fbf1){var _0x31f032={};var _0x1a0a35={};var _0x220997;var _0x528e7a;return db[_0x6da0('0x28')][_0x6da0('0x45')]({'where':{'id':_0x7a3bab[_0x6da0('0x40')]['id']}})[_0x6da0('0x21')](handleEntityNotFound(_0x1544be,null))[_0x6da0('0x21')](function(_0x57bdb1){if(_0x57bdb1){_0x220997=_0x57bdb1;_0x1a0a35['model']=_[_0x6da0('0x2f')](db['VtigerField'][_0x6da0('0x29')]);_0x1a0a35['query']=_[_0x6da0('0x2f')](_0x7a3bab[_0x6da0('0x2e')]);_0x1a0a35[_0x6da0('0x36')]=_[_0x6da0('0x30')](_0x1a0a35[_0x6da0('0x2d')],_0x1a0a35[_0x6da0('0x2e')]);_0x31f032[_0x6da0('0x31')]=_[_0x6da0('0x30')](_0x1a0a35[_0x6da0('0x2d')],qs['fields'](_0x7a3bab['query'][_0x6da0('0x32')]));_0x31f032[_0x6da0('0x31')]=_0x31f032['attributes'][_0x6da0('0x33')]?_0x31f032[_0x6da0('0x31')]:_0x1a0a35['model'];_0x31f032[_0x6da0('0x47')]=qs[_0x6da0('0x35')](_0x7a3bab[_0x6da0('0x2e')][_0x6da0('0x35')]);_0x31f032[_0x6da0('0x39')]=qs[_0x6da0('0x36')](_[_0x6da0('0x37')](_0x7a3bab[_0x6da0('0x2e')],_0x1a0a35[_0x6da0('0x36')]));if(_0x7a3bab['query'][_0x6da0('0x38')]){_0x31f032[_0x6da0('0x39')]=_[_0x6da0('0x3a')](_0x31f032[_0x6da0('0x39')],{'$or':_[_0x6da0('0x3b')](_0x31f032[_0x6da0('0x31')],function(_0x2d0c5c){var _0x4f2e3d={};_0x4f2e3d[_0x2d0c5c]={'$like':'%'+_0x7a3bab[_0x6da0('0x2e')]['filter']+'%'};return _0x4f2e3d;})});}_0x31f032=_[_0x6da0('0x3a')]({},_0x31f032,_0x7a3bab[_0x6da0('0x3d')]);return _0x220997[_0x6da0('0x4a')](_0x31f032);}})['then'](function(_0x589e71){if(_0x589e71){_0x528e7a=_0x589e71[_0x6da0('0x33')];if(!_0x7a3bab[_0x6da0('0x2e')][_0x6da0('0x49')]('nolimit')){_0x31f032[_0x6da0('0x19')]=qs['limit'](_0x7a3bab[_0x6da0('0x2e')][_0x6da0('0x19')]);_0x31f032['offset']=qs[_0x6da0('0x17')](_0x7a3bab[_0x6da0('0x2e')]['offset']);}return _0x220997[_0x6da0('0x4a')](_0x31f032);}})[_0x6da0('0x21')](function(_0xd3b806){if(_0xd3b806){return _0xd3b806?{'count':_0x528e7a,'rows':_0xd3b806}:null;}})['then'](respondWithResult(_0x1544be,null))[_0x6da0('0x42')](handleError(_0x1544be,null));};exports[_0x6da0('0x4b')]=function(_0x2a4267,_0x3bb06b,_0x4b68bc){var _0x58269b={};var _0x5b124d={};var _0x1fb04e;var _0x14acf4;return db['VtigerConfiguration'][_0x6da0('0x45')]({'where':{'id':_0x2a4267[_0x6da0('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb06b,null))[_0x6da0('0x21')](function(_0x5cf254){if(_0x5cf254){_0x1fb04e=_0x5cf254;_0x5b124d[_0x6da0('0x2d')]=_[_0x6da0('0x2f')](db[_0x6da0('0x46')][_0x6da0('0x29')]);_0x5b124d[_0x6da0('0x2e')]=_[_0x6da0('0x2f')](_0x2a4267[_0x6da0('0x2e')]);_0x5b124d[_0x6da0('0x36')]=_[_0x6da0('0x30')](_0x5b124d['model'],_0x5b124d[_0x6da0('0x2e')]);_0x58269b[_0x6da0('0x31')]=_[_0x6da0('0x30')](_0x5b124d[_0x6da0('0x2d')],qs[_0x6da0('0x32')](_0x2a4267[_0x6da0('0x2e')][_0x6da0('0x32')]));_0x58269b['attributes']=_0x58269b[_0x6da0('0x31')][_0x6da0('0x33')]?_0x58269b[_0x6da0('0x31')]:_0x5b124d['model'];_0x58269b[_0x6da0('0x47')]=qs[_0x6da0('0x35')](_0x2a4267['query'][_0x6da0('0x35')]);_0x58269b[_0x6da0('0x39')]=qs['filters'](_[_0x6da0('0x37')](_0x2a4267[_0x6da0('0x2e')],_0x5b124d['filters']));if(_0x2a4267['query'][_0x6da0('0x38')]){_0x58269b['where']=_[_0x6da0('0x3a')](_0x58269b[_0x6da0('0x39')],{'$or':_['map'](_0x58269b[_0x6da0('0x31')],function(_0x439a49){var _0x26f147={};_0x26f147[_0x439a49]={'$like':'%'+_0x2a4267['query'][_0x6da0('0x38')]+'%'};return _0x26f147;})});}_0x58269b=_[_0x6da0('0x3a')]({},_0x58269b,_0x2a4267[_0x6da0('0x3d')]);return _0x1fb04e[_0x6da0('0x4b')](_0x58269b);}})[_0x6da0('0x21')](function(_0x4701d6){if(_0x4701d6){_0x14acf4=_0x4701d6[_0x6da0('0x33')];if(!_0x2a4267[_0x6da0('0x2e')][_0x6da0('0x49')](_0x6da0('0x34'))){_0x58269b[_0x6da0('0x19')]=qs[_0x6da0('0x19')](_0x2a4267[_0x6da0('0x2e')][_0x6da0('0x19')]);_0x58269b[_0x6da0('0x17')]=qs[_0x6da0('0x17')](_0x2a4267[_0x6da0('0x2e')][_0x6da0('0x17')]);}return _0x1fb04e[_0x6da0('0x4b')](_0x58269b);}})[_0x6da0('0x21')](function(_0x56fafe){if(_0x56fafe){return _0x56fafe?{'count':_0x14acf4,'rows':_0x56fafe}:null;}})['then'](respondWithResult(_0x3bb06b,null))[_0x6da0('0x42')](handleError(_0x3bb06b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 450acaf..d770c3a 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 _0x0935=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','path'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x0935,0x1b7));var _0x5093=function(_0x204b9c,_0x25a006){_0x204b9c=_0x204b9c-0x0;var _0xd2c697=_0x0935[_0x204b9c];return _0xd2c697;};'use strict';var _=require(_0x5093('0x0'));var util=require(_0x5093('0x1'));var logger=require(_0x5093('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5093('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5093('0x4'));var rimraf=require(_0x5093('0x5'));var config=require(_0x5093('0x6'));var attributes=require(_0x5093('0x7'));module[_0x5093('0x8')]=function(_0x5d3851,_0x442b16){return _0x5d3851[_0x5093('0x9')](_0x5093('0xa'),attributes,{'tableName':_0x5093('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d92=['VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x618ad6,_0x4992d2){var _0x277505=function(_0x3bf48c){while(--_0x3bf48c){_0x618ad6['push'](_0x618ad6['shift']());}};_0x277505(++_0x4992d2);}(_0x8d92,0x1e2));var _0x28d9=function(_0x266703,_0x120c3b){_0x266703=_0x266703-0x0;var _0x37d275=_0x8d92[_0x266703];return _0x37d275;};'use strict';var _=require('lodash');var util=require(_0x28d9('0x0'));var logger=require(_0x28d9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x28d9('0x2'));var rp=require(_0x28d9('0x3'));var fs=require('fs');var path=require(_0x28d9('0x4'));var rimraf=require(_0x28d9('0x5'));var config=require(_0x28d9('0x6'));var attributes=require(_0x28d9('0x7'));module[_0x28d9('0x8')]=function(_0x507782,_0x3f5a98){return _0x507782[_0x28d9('0x9')](_0x28d9('0xa'),attributes,{'tableName':_0x28d9('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 fffead0..fa346cf 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 _0x2537=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash'];(function(_0x1eba02,_0x5c5578){var _0x3c9398=function(_0x4eab7f){while(--_0x4eab7f){_0x1eba02['push'](_0x1eba02['shift']());}};_0x3c9398(++_0x5c5578);}(_0x2537,0x1af));var _0x7253=function(_0x10ad82,_0x3dc023){_0x10ad82=_0x10ad82-0x0;var _0x214b67=_0x2537[_0x10ad82];return _0x214b67;};'use strict';var _=require(_0x7253('0x0'));var util=require(_0x7253('0x1'));var moment=require(_0x7253('0x2'));var BPromise=require(_0x7253('0x3'));var rs=require(_0x7253('0x4'));var fs=require('fs');var Redis=require(_0x7253('0x5'));var db=require(_0x7253('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7253('0x7'));var config=require(_0x7253('0x8'));var jayson=require(_0x7253('0x9'));var client=jayson[_0x7253('0xa')][_0x7253('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56ad93,_0x58c428,_0x20f11d){return new BPromise(function(_0x3f6bb0,_0x334aff){return client[_0x7253('0xc')](_0x56ad93,_0x20f11d)[_0x7253('0xd')](function(_0x1164d7){logger[_0x7253('0xe')](_0x7253('0xf'),_0x58c428,'request\x20sent');logger[_0x7253('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x58c428,_0x7253('0x11'),JSON[_0x7253('0x12')](_0x1164d7));if(_0x1164d7['error']){if(_0x1164d7['error'][_0x7253('0x13')]===0x1f4){logger[_0x7253('0x14')](_0x7253('0xf'),_0x58c428,_0x1164d7[_0x7253('0x14')][_0x7253('0x15')]);return _0x334aff(_0x1164d7[_0x7253('0x14')]['message']);}logger[_0x7253('0x14')](_0x7253('0xf'),_0x58c428,_0x1164d7[_0x7253('0x14')]['message']);return _0x3f6bb0(_0x1164d7['error'][_0x7253('0x15')]);}else{logger[_0x7253('0xe')](_0x7253('0xf'),_0x58c428,_0x7253('0x11'));_0x3f6bb0(_0x1164d7[_0x7253('0x16')][_0x7253('0x15')]);}})[_0x7253('0x17')](function(_0x4f5921){logger[_0x7253('0x14')](_0x7253('0xf'),_0x58c428,_0x4f5921);_0x334aff(_0x4f5921);});});} \ No newline at end of file +var _0x4ee7=['result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x421376,_0x485aca){var _0x2660d7=function(_0xe2b678){while(--_0xe2b678){_0x421376['push'](_0x421376['shift']());}};_0x2660d7(++_0x485aca);}(_0x4ee7,0x1ba));var _0x74ee=function(_0xc8ca6,_0x4a2bf7){_0xc8ca6=_0xc8ca6-0x0;var _0x2fadb5=_0x4ee7[_0xc8ca6];return _0x2fadb5;};'use strict';var _=require('lodash');var util=require(_0x74ee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74ee('0x1'));var fs=require('fs');var Redis=require(_0x74ee('0x2'));var db=require(_0x74ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74ee('0x4'))(_0x74ee('0x5'));var config=require(_0x74ee('0x6'));var jayson=require(_0x74ee('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x372974,_0x456893,_0x196918){return new BPromise(function(_0x15c008,_0x216882){return client[_0x74ee('0x8')](_0x372974,_0x196918)['then'](function(_0x37f43f){logger[_0x74ee('0x9')](_0x74ee('0xa'),_0x456893,_0x74ee('0xb'));logger[_0x74ee('0xc')](_0x74ee('0xd'),_0x456893,_0x74ee('0xb'),JSON[_0x74ee('0xe')](_0x37f43f));if(_0x37f43f[_0x74ee('0xf')]){if(_0x37f43f[_0x74ee('0xf')][_0x74ee('0x10')]===0x1f4){logger[_0x74ee('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x456893,_0x37f43f[_0x74ee('0xf')]['message']);return _0x216882(_0x37f43f[_0x74ee('0xf')][_0x74ee('0x11')]);}logger[_0x74ee('0xf')](_0x74ee('0xa'),_0x456893,_0x37f43f[_0x74ee('0xf')]['message']);return _0x15c008(_0x37f43f[_0x74ee('0xf')]['message']);}else{logger['info'](_0x74ee('0xa'),_0x456893,_0x74ee('0xb'));_0x15c008(_0x37f43f[_0x74ee('0x12')]['message']);}})[_0x74ee('0x13')](function(_0x11e82e){logger[_0x74ee('0xf')](_0x74ee('0xa'),_0x456893,_0x11e82e);_0x216882(_0x11e82e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e843afa..71ef575 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 _0xda2a=['/:id','show','create','put','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index'];(function(_0x6b2eb0,_0x12f3c1){var _0x48d7b1=function(_0x2b5655){while(--_0x2b5655){_0x6b2eb0['push'](_0x6b2eb0['shift']());}};_0x48d7b1(++_0x12f3c1);}(_0xda2a,0x14b));var _0xada2=function(_0x46b65e,_0x3f8ffe){_0x46b65e=_0x46b65e-0x0;var _0x197c43=_0xda2a[_0x46b65e];return _0x197c43;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xada2('0x0'));var express=require(_0xada2('0x1'));var router=express[_0xada2('0x2')]();var fs_extra=require(_0xada2('0x3'));var auth=require(_0xada2('0x4'));var interaction=require(_0xada2('0x5'));var config=require(_0xada2('0x6'));var controller=require(_0xada2('0x7'));router[_0xada2('0x8')]('/',auth[_0xada2('0x9')](),controller[_0xada2('0xa')]);router[_0xada2('0x8')](_0xada2('0xb'),auth[_0xada2('0x9')](),controller[_0xada2('0xc')]);router['post']('/',auth[_0xada2('0x9')](),controller[_0xada2('0xd')]);router[_0xada2('0xe')]('/:id',auth[_0xada2('0x9')](),controller[_0xada2('0xf')]);router['delete'](_0xada2('0xb'),auth[_0xada2('0x9')](),controller[_0xada2('0x10')]);module[_0xada2('0x11')]=router; \ No newline at end of file +var _0xad3e=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xad3e,0x11e));var _0xead3=function(_0x44cbd3,_0x4b774c){_0x44cbd3=_0x44cbd3-0x0;var _0x36687c=_0xad3e[_0x44cbd3];return _0x36687c;};'use strict';var multer=require(_0xead3('0x0'));var util=require(_0xead3('0x1'));var path=require(_0xead3('0x2'));var timeout=require(_0xead3('0x3'));var express=require(_0xead3('0x4'));var router=express[_0xead3('0x5')]();var fs_extra=require(_0xead3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xead3('0x7'));var config=require('../../config/environment');var controller=require(_0xead3('0x8'));router[_0xead3('0x9')]('/',auth[_0xead3('0xa')](),controller[_0xead3('0xb')]);router[_0xead3('0x9')](_0xead3('0xc'),auth[_0xead3('0xa')](),controller['show']);router[_0xead3('0xd')]('/',auth['isAuthenticated'](),controller[_0xead3('0xe')]);router[_0xead3('0xf')](_0xead3('0xc'),auth['isAuthenticated'](),controller[_0xead3('0x10')]);router[_0xead3('0x11')](_0xead3('0xc'),auth[_0xead3('0xa')](),controller[_0xead3('0x12')]);module[_0xead3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a5b9397..3b3dec1 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 _0xa115=['STRING','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa115,0x16a));var _0x5a11=function(_0x9ba49b,_0x57209c){_0x9ba49b=_0x9ba49b-0x0;var _0x4c7bad=_0xa115[_0x9ba49b];return _0x4c7bad;};'use strict';var Sequelize=require(_0x5a11('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5a11('0x1'),_0x5a11('0x2'),_0x5a11('0x3'),_0x5a11('0x4'),_0x5a11('0x5')),'defaultValue':_0x5a11('0x1')},'content':{'type':Sequelize[_0x5a11('0x6')]},'key':{'type':Sequelize[_0x5a11('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5a11('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x5a11('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5a11('0x6')]},'customField':{'type':Sequelize[_0x5a11('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a11('0x6')]}}; \ No newline at end of file +var _0x7288=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x26a897,_0x153639){var _0x363702=function(_0x106ce1){while(--_0x106ce1){_0x26a897['push'](_0x26a897['shift']());}};_0x363702(++_0x153639);}(_0x7288,0x123));var _0x8728=function(_0xbeddf4,_0xcf8273){_0xbeddf4=_0xbeddf4-0x0;var _0x19fea5=_0x7288[_0xbeddf4];return _0x19fea5;};'use strict';var Sequelize=require(_0x8728('0x0'));module[_0x8728('0x1')]={'type':{'type':Sequelize[_0x8728('0x2')](_0x8728('0x3'),_0x8728('0x4'),_0x8728('0x5'),_0x8728('0x6'),_0x8728('0x7')),'defaultValue':_0x8728('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8728('0x2')](_0x8728('0x3'),_0x8728('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8728('0x8')]},'idField':{'type':Sequelize[_0x8728('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'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 a4f26f8..92f7b07 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 _0xae85=['nolimit','limit','sort','where','pick','filter','merge','name','options','includeAll','include','rows','catch','params','intersection','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','send','index','map','VtigerField','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0x4f672c,_0x5ee942){var _0x26a275=function(_0x40650c){while(--_0x40650c){_0x4f672c['push'](_0x4f672c['shift']());}};_0x26a275(++_0x5ee942);}(_0xae85,0x136));var _0x5ae8=function(_0x5413e4,_0x25c0b0){_0x5413e4=_0x5413e4-0x0;var _0x110acc=_0xae85[_0x5413e4];return _0x110acc;};'use strict';var emlformat=require(_0x5ae8('0x0'));var rimraf=require(_0x5ae8('0x1'));var zipdir=require(_0x5ae8('0x2'));var jsonpatch=require(_0x5ae8('0x3'));var rp=require(_0x5ae8('0x4'));var moment=require('moment');var BPromise=require(_0x5ae8('0x5'));var Mustache=require(_0x5ae8('0x6'));var util=require(_0x5ae8('0x7'));var path=require(_0x5ae8('0x8'));var sox=require(_0x5ae8('0x9'));var csv=require(_0x5ae8('0xa'));var ejs=require(_0x5ae8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ae8('0xc'));var squel=require(_0x5ae8('0xd'));var crypto=require(_0x5ae8('0xe'));var jsforce=require(_0x5ae8('0xf'));var deskjs=require(_0x5ae8('0x10'));var toCsv=require(_0x5ae8('0xa'));var querystring=require('querystring');var Papa=require(_0x5ae8('0x11'));var Redis=require(_0x5ae8('0x12'));var authService=require(_0x5ae8('0x13'));var qs=require(_0x5ae8('0x14'));var as=require(_0x5ae8('0x15'));var hardwareService=require(_0x5ae8('0x16'));var logger=require(_0x5ae8('0x17'))(_0x5ae8('0x18'));var utils=require(_0x5ae8('0x19'));var config=require(_0x5ae8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8e7bc4,_0x172089){_0x172089=_0x172089||0xcc;return function(_0x4dc7b7){if(_0x4dc7b7){return _0x8e7bc4['sendStatus'](_0x172089);}return _0x8e7bc4[_0x5ae8('0x1b')](_0x172089)[_0x5ae8('0x1c')]();};}function respondWithResult(_0x3d207d,_0x42f4bf){_0x42f4bf=_0x42f4bf||0xc8;return function(_0x253e0d){if(_0x253e0d){return _0x3d207d[_0x5ae8('0x1b')](_0x42f4bf)[_0x5ae8('0x1d')](_0x253e0d);}};}function respondWithFilteredResult(_0xa33b9b,_0x483036){return function(_0x4ce9dd){if(_0x4ce9dd){var _0x1a2c5c=typeof _0x483036['offset']===_0x5ae8('0x1e')&&typeof _0x483036['limit']===_0x5ae8('0x1e');var _0x10e193=_0x4ce9dd[_0x5ae8('0x1f')];var _0x478ce5=_0x1a2c5c?0x0:_0x483036['offset'];var _0x38fc76=_0x1a2c5c?_0x4ce9dd[_0x5ae8('0x1f')]:_0x483036[_0x5ae8('0x20')]+_0x483036['limit'];var _0x5c0044;if(_0x38fc76>=_0x10e193){_0x38fc76=_0x10e193;_0x5c0044=0xc8;}else{_0x5c0044=0xce;}_0xa33b9b[_0x5ae8('0x1b')](_0x5c0044);return _0xa33b9b[_0x5ae8('0x21')](_0x5ae8('0x22'),_0x478ce5+'-'+_0x38fc76+'/'+_0x10e193)[_0x5ae8('0x1d')](_0x4ce9dd);}return null;};}function patchUpdates(_0x16445c){return function(_0x448911){try{jsonpatch['apply'](_0x448911,_0x16445c,!![]);}catch(_0x21f24d){return BPromise[_0x5ae8('0x23')](_0x21f24d);}return _0x448911[_0x5ae8('0x24')]();};}function saveUpdates(_0x4160e4,_0x498bac){return function(_0x38a8df){if(_0x38a8df){return _0x38a8df[_0x5ae8('0x25')](_0x4160e4)[_0x5ae8('0x26')](function(_0x5a4ccf){return _0x5a4ccf;});}return null;};}function removeEntity(_0x4fedaa,_0x48a0de){return function(_0x3b76bd){if(_0x3b76bd){return _0x3b76bd[_0x5ae8('0x27')]()[_0x5ae8('0x26')](function(){_0x4fedaa[_0x5ae8('0x1b')](0xcc)[_0x5ae8('0x1c')]();});}};}function handleEntityNotFound(_0x10c1eb,_0x356d6d){return function(_0x29face){if(!_0x29face){_0x10c1eb['sendStatus'](0x194);}return _0x29face;};}function handleError(_0xfe4462,_0x1c63af){_0x1c63af=_0x1c63af||0x1f4;return function(_0x375657){logger['error'](_0x375657[_0x5ae8('0x28')]);if(_0x375657['name']){delete _0x375657['name'];}_0xfe4462['status'](_0x1c63af)[_0x5ae8('0x29')](_0x375657);};}exports[_0x5ae8('0x2a')]=function(_0x12e2e1,_0x33c5f1){var _0x359afd={},_0x38164e={},_0x3c18b3={'count':0x0,'rows':[]};var _0x5e1c0b=_[_0x5ae8('0x2b')](db[_0x5ae8('0x2c')][_0x5ae8('0x2d')],function(_0x5a3a2c){return{'name':_0x5a3a2c['fieldName'],'type':_0x5a3a2c[_0x5ae8('0x2e')]['key']};});_0x38164e[_0x5ae8('0x2f')]=_[_0x5ae8('0x2b')](_0x5e1c0b,'name');_0x38164e[_0x5ae8('0x30')]=_[_0x5ae8('0x31')](_0x12e2e1[_0x5ae8('0x30')]);_0x38164e[_0x5ae8('0x32')]=_['intersection'](_0x38164e['model'],_0x38164e[_0x5ae8('0x30')]);_0x359afd[_0x5ae8('0x33')]=_['intersection'](_0x38164e[_0x5ae8('0x2f')],qs[_0x5ae8('0x34')](_0x12e2e1['query'][_0x5ae8('0x34')]));_0x359afd['attributes']=_0x359afd[_0x5ae8('0x33')][_0x5ae8('0x35')]?_0x359afd[_0x5ae8('0x33')]:_0x38164e[_0x5ae8('0x2f')];if(!_0x12e2e1[_0x5ae8('0x30')][_0x5ae8('0x36')](_0x5ae8('0x37'))){_0x359afd[_0x5ae8('0x38')]=qs[_0x5ae8('0x38')](_0x12e2e1[_0x5ae8('0x30')][_0x5ae8('0x38')]);_0x359afd[_0x5ae8('0x20')]=qs[_0x5ae8('0x20')](_0x12e2e1[_0x5ae8('0x30')]['offset']);}_0x359afd['order']=qs['sort'](_0x12e2e1[_0x5ae8('0x30')][_0x5ae8('0x39')]);_0x359afd[_0x5ae8('0x3a')]=qs['filters'](_[_0x5ae8('0x3b')](_0x12e2e1['query'],_0x38164e['filters']),_0x5e1c0b);if(_0x12e2e1[_0x5ae8('0x30')][_0x5ae8('0x3c')]){_0x359afd[_0x5ae8('0x3a')]=_[_0x5ae8('0x3d')](_0x359afd[_0x5ae8('0x3a')],{'$or':_['map'](_0x5e1c0b,function(_0x40c047){if(_0x40c047['type']!=='VIRTUAL'){var _0x1f8e73={};_0x1f8e73[_0x40c047[_0x5ae8('0x3e')]]={'$like':'%'+_0x12e2e1[_0x5ae8('0x30')][_0x5ae8('0x3c')]+'%'};return _0x1f8e73;}})});}_0x359afd=_[_0x5ae8('0x3d')]({},_0x359afd,_0x12e2e1[_0x5ae8('0x3f')]);var _0x48f19f={'where':_0x359afd[_0x5ae8('0x3a')]};return db[_0x5ae8('0x2c')][_0x5ae8('0x1f')](_0x48f19f)['then'](function(_0x3947f5){_0x3c18b3[_0x5ae8('0x1f')]=_0x3947f5;if(_0x12e2e1[_0x5ae8('0x30')][_0x5ae8('0x40')]){_0x359afd[_0x5ae8('0x41')]=[{'all':!![]}];}return db[_0x5ae8('0x2c')]['findAll'](_0x359afd);})[_0x5ae8('0x26')](function(_0x28bf31){_0x3c18b3[_0x5ae8('0x42')]=_0x28bf31;return _0x3c18b3;})[_0x5ae8('0x26')](respondWithFilteredResult(_0x33c5f1,_0x359afd))[_0x5ae8('0x43')](handleError(_0x33c5f1,null));};exports['show']=function(_0x3dd100,_0x249f66){var _0x589251={'raw':!![],'where':{'id':_0x3dd100[_0x5ae8('0x44')]['id']}},_0x4a04d3={};_0x4a04d3[_0x5ae8('0x2f')]=_['keys'](db[_0x5ae8('0x2c')][_0x5ae8('0x2d')]);_0x4a04d3[_0x5ae8('0x30')]=_[_0x5ae8('0x31')](_0x3dd100[_0x5ae8('0x30')]);_0x4a04d3[_0x5ae8('0x32')]=_[_0x5ae8('0x45')](_0x4a04d3['model'],_0x4a04d3['query']);_0x589251['attributes']=_['intersection'](_0x4a04d3[_0x5ae8('0x2f')],qs['fields'](_0x3dd100[_0x5ae8('0x30')]['fields']));_0x589251[_0x5ae8('0x33')]=_0x589251[_0x5ae8('0x33')]['length']?_0x589251[_0x5ae8('0x33')]:_0x4a04d3['model'];if(_0x3dd100[_0x5ae8('0x30')]['includeAll']){_0x589251[_0x5ae8('0x41')]=[{'all':!![]}];}_0x589251=_[_0x5ae8('0x3d')]({},_0x589251,_0x3dd100['options']);return db[_0x5ae8('0x2c')]['find'](_0x589251)[_0x5ae8('0x26')](handleEntityNotFound(_0x249f66,null))[_0x5ae8('0x26')](respondWithResult(_0x249f66,null))[_0x5ae8('0x43')](handleError(_0x249f66,null));};exports['create']=function(_0x5aede9,_0xe9f972){return db[_0x5ae8('0x2c')][_0x5ae8('0x46')](_0x5aede9[_0x5ae8('0x47')],{})[_0x5ae8('0x26')](respondWithResult(_0xe9f972,0xc9))['catch'](handleError(_0xe9f972,null));};exports['update']=function(_0x24d12b,_0x192d06){if(_0x24d12b[_0x5ae8('0x47')]['id']){delete _0x24d12b[_0x5ae8('0x47')]['id'];}return db[_0x5ae8('0x2c')][_0x5ae8('0x48')]({'where':{'id':_0x24d12b[_0x5ae8('0x44')]['id']}})[_0x5ae8('0x26')](handleEntityNotFound(_0x192d06,null))['then'](saveUpdates(_0x24d12b[_0x5ae8('0x47')],null))[_0x5ae8('0x26')](respondWithResult(_0x192d06,null))['catch'](handleError(_0x192d06,null));};exports['destroy']=function(_0x3786a2,_0x4f253b){return db['VtigerField'][_0x5ae8('0x48')]({'where':{'id':_0x3786a2[_0x5ae8('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f253b,null))[_0x5ae8('0x26')](removeEntity(_0x4f253b,null))[_0x5ae8('0x43')](handleError(_0x4f253b,null));}; \ No newline at end of file +var _0xd335=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerField','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','show','params','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x185fb5,_0x2d3986){var _0x543191=function(_0x450c1c){while(--_0x450c1c){_0x185fb5['push'](_0x185fb5['shift']());}};_0x543191(++_0x2d3986);}(_0xd335,0xcc));var _0x5d33=function(_0x1b9f05,_0x2a6b4d){_0x1b9f05=_0x1b9f05-0x0;var _0x53607c=_0xd335[_0x1b9f05];return _0x53607c;};'use strict';var emlformat=require(_0x5d33('0x0'));var rimraf=require(_0x5d33('0x1'));var zipdir=require(_0x5d33('0x2'));var jsonpatch=require(_0x5d33('0x3'));var rp=require(_0x5d33('0x4'));var moment=require(_0x5d33('0x5'));var BPromise=require(_0x5d33('0x6'));var Mustache=require(_0x5d33('0x7'));var util=require('util');var path=require(_0x5d33('0x8'));var sox=require(_0x5d33('0x9'));var csv=require(_0x5d33('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d33('0xb'));var _=require(_0x5d33('0xc'));var squel=require(_0x5d33('0xd'));var crypto=require(_0x5d33('0xe'));var jsforce=require(_0x5d33('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5d33('0xa'));var querystring=require(_0x5d33('0x10'));var Papa=require('papaparse');var Redis=require(_0x5d33('0x11'));var authService=require(_0x5d33('0x12'));var qs=require(_0x5d33('0x13'));var as=require(_0x5d33('0x14'));var hardwareService=require(_0x5d33('0x15'));var logger=require(_0x5d33('0x16'))(_0x5d33('0x17'));var utils=require(_0x5d33('0x18'));var config=require(_0x5d33('0x19'));var licenseUtil=require(_0x5d33('0x1a'));var db=require(_0x5d33('0x1b'))['db'];function respondWithStatusCode(_0x36234a,_0x27dde7){_0x27dde7=_0x27dde7||0xcc;return function(_0x18d25c){if(_0x18d25c){return _0x36234a[_0x5d33('0x1c')](_0x27dde7);}return _0x36234a[_0x5d33('0x1d')](_0x27dde7)[_0x5d33('0x1e')]();};}function respondWithResult(_0x5217cc,_0x3b08f2){_0x3b08f2=_0x3b08f2||0xc8;return function(_0x2d0314){if(_0x2d0314){return _0x5217cc['status'](_0x3b08f2)['json'](_0x2d0314);}};}function respondWithFilteredResult(_0x3978d6,_0x57093d){return function(_0x502a74){if(_0x502a74){var _0x2da11a=typeof _0x57093d[_0x5d33('0x1f')]===_0x5d33('0x20')&&typeof _0x57093d[_0x5d33('0x21')]===_0x5d33('0x20');var _0xf2461f=_0x502a74[_0x5d33('0x22')];var _0x9a19af=_0x2da11a?0x0:_0x57093d['offset'];var _0x24e418=_0x2da11a?_0x502a74[_0x5d33('0x22')]:_0x57093d[_0x5d33('0x1f')]+_0x57093d[_0x5d33('0x21')];var _0x556b37;if(_0x24e418>=_0xf2461f){_0x24e418=_0xf2461f;_0x556b37=0xc8;}else{_0x556b37=0xce;}_0x3978d6[_0x5d33('0x1d')](_0x556b37);return _0x3978d6[_0x5d33('0x23')](_0x5d33('0x24'),_0x9a19af+'-'+_0x24e418+'/'+_0xf2461f)['json'](_0x502a74);}return null;};}function patchUpdates(_0x1ae15b){return function(_0x39bdd8){try{jsonpatch[_0x5d33('0x25')](_0x39bdd8,_0x1ae15b,!![]);}catch(_0x193805){return BPromise[_0x5d33('0x26')](_0x193805);}return _0x39bdd8[_0x5d33('0x27')]();};}function saveUpdates(_0xf424f2,_0x2f1f6d){return function(_0xc4412e){if(_0xc4412e){return _0xc4412e[_0x5d33('0x28')](_0xf424f2)[_0x5d33('0x29')](function(_0x517858){return _0x517858;});}return null;};}function removeEntity(_0x2a664b,_0x3fcaa0){return function(_0x13db8f){if(_0x13db8f){return _0x13db8f[_0x5d33('0x2a')]()['then'](function(){_0x2a664b['status'](0xcc)[_0x5d33('0x1e')]();});}};}function handleEntityNotFound(_0x4e8eae,_0x3436a4){return function(_0x407139){if(!_0x407139){_0x4e8eae[_0x5d33('0x1c')](0x194);}return _0x407139;};}function handleError(_0x54a3a0,_0x39d92c){_0x39d92c=_0x39d92c||0x1f4;return function(_0x4a5e5a){logger['error'](_0x4a5e5a[_0x5d33('0x2b')]);if(_0x4a5e5a['name']){delete _0x4a5e5a[_0x5d33('0x2c')];}_0x54a3a0[_0x5d33('0x1d')](_0x39d92c)[_0x5d33('0x2d')](_0x4a5e5a);};}exports[_0x5d33('0x2e')]=function(_0x1525e3,_0x370fc8){var _0x225a30={},_0x42cd2d={},_0x1e9577={'count':0x0,'rows':[]};var _0x3ce19e=_[_0x5d33('0x2f')](db[_0x5d33('0x30')]['rawAttributes'],function(_0x4afe3a){return{'name':_0x4afe3a[_0x5d33('0x31')],'type':_0x4afe3a[_0x5d33('0x32')][_0x5d33('0x33')]};});_0x42cd2d[_0x5d33('0x34')]=_['map'](_0x3ce19e,'name');_0x42cd2d['query']=_[_0x5d33('0x35')](_0x1525e3[_0x5d33('0x36')]);_0x42cd2d[_0x5d33('0x37')]=_[_0x5d33('0x38')](_0x42cd2d[_0x5d33('0x34')],_0x42cd2d[_0x5d33('0x36')]);_0x225a30[_0x5d33('0x39')]=_[_0x5d33('0x38')](_0x42cd2d[_0x5d33('0x34')],qs[_0x5d33('0x3a')](_0x1525e3[_0x5d33('0x36')][_0x5d33('0x3a')]));_0x225a30[_0x5d33('0x39')]=_0x225a30[_0x5d33('0x39')][_0x5d33('0x3b')]?_0x225a30[_0x5d33('0x39')]:_0x42cd2d[_0x5d33('0x34')];if(!_0x1525e3[_0x5d33('0x36')][_0x5d33('0x3c')](_0x5d33('0x3d'))){_0x225a30[_0x5d33('0x21')]=qs[_0x5d33('0x21')](_0x1525e3['query'][_0x5d33('0x21')]);_0x225a30[_0x5d33('0x1f')]=qs[_0x5d33('0x1f')](_0x1525e3[_0x5d33('0x36')][_0x5d33('0x1f')]);}_0x225a30['order']=qs[_0x5d33('0x3e')](_0x1525e3[_0x5d33('0x36')][_0x5d33('0x3e')]);_0x225a30[_0x5d33('0x3f')]=qs[_0x5d33('0x37')](_[_0x5d33('0x40')](_0x1525e3[_0x5d33('0x36')],_0x42cd2d[_0x5d33('0x37')]),_0x3ce19e);if(_0x1525e3[_0x5d33('0x36')]['filter']){_0x225a30[_0x5d33('0x3f')]=_['merge'](_0x225a30[_0x5d33('0x3f')],{'$or':_[_0x5d33('0x2f')](_0x3ce19e,function(_0x411286){if(_0x411286[_0x5d33('0x32')]!=='VIRTUAL'){var _0x45190e={};_0x45190e[_0x411286[_0x5d33('0x2c')]]={'$like':'%'+_0x1525e3['query'][_0x5d33('0x41')]+'%'};return _0x45190e;}})});}_0x225a30=_['merge']({},_0x225a30,_0x1525e3['options']);var _0xb950d5={'where':_0x225a30[_0x5d33('0x3f')]};return db[_0x5d33('0x30')][_0x5d33('0x22')](_0xb950d5)['then'](function(_0x28b43f){_0x1e9577[_0x5d33('0x22')]=_0x28b43f;if(_0x1525e3[_0x5d33('0x36')]['includeAll']){_0x225a30['include']=[{'all':!![]}];}return db[_0x5d33('0x30')]['findAll'](_0x225a30);})[_0x5d33('0x29')](function(_0x5a48ba){_0x1e9577['rows']=_0x5a48ba;return _0x1e9577;})[_0x5d33('0x29')](respondWithFilteredResult(_0x370fc8,_0x225a30))['catch'](handleError(_0x370fc8,null));};exports[_0x5d33('0x42')]=function(_0x54ece1,_0x5d8d2a){var _0xe97ef7={'raw':!![],'where':{'id':_0x54ece1[_0x5d33('0x43')]['id']}},_0x3ffe33={};_0x3ffe33[_0x5d33('0x34')]=_['keys'](db[_0x5d33('0x30')]['rawAttributes']);_0x3ffe33['query']=_[_0x5d33('0x35')](_0x54ece1['query']);_0x3ffe33[_0x5d33('0x37')]=_['intersection'](_0x3ffe33['model'],_0x3ffe33[_0x5d33('0x36')]);_0xe97ef7[_0x5d33('0x39')]=_['intersection'](_0x3ffe33[_0x5d33('0x34')],qs[_0x5d33('0x3a')](_0x54ece1[_0x5d33('0x36')]['fields']));_0xe97ef7[_0x5d33('0x39')]=_0xe97ef7[_0x5d33('0x39')][_0x5d33('0x3b')]?_0xe97ef7['attributes']:_0x3ffe33[_0x5d33('0x34')];if(_0x54ece1[_0x5d33('0x36')][_0x5d33('0x44')]){_0xe97ef7[_0x5d33('0x45')]=[{'all':!![]}];}_0xe97ef7=_[_0x5d33('0x46')]({},_0xe97ef7,_0x54ece1[_0x5d33('0x47')]);return db[_0x5d33('0x30')][_0x5d33('0x48')](_0xe97ef7)[_0x5d33('0x29')](handleEntityNotFound(_0x5d8d2a,null))[_0x5d33('0x29')](respondWithResult(_0x5d8d2a,null))[_0x5d33('0x49')](handleError(_0x5d8d2a,null));};exports[_0x5d33('0x4a')]=function(_0x3eb5a8,_0x2411a5){return db['VtigerField'][_0x5d33('0x4a')](_0x3eb5a8['body'],{})[_0x5d33('0x29')](respondWithResult(_0x2411a5,0xc9))[_0x5d33('0x49')](handleError(_0x2411a5,null));};exports[_0x5d33('0x28')]=function(_0x54be6c,_0x130008){if(_0x54be6c['body']['id']){delete _0x54be6c[_0x5d33('0x4b')]['id'];}return db['VtigerField'][_0x5d33('0x48')]({'where':{'id':_0x54be6c[_0x5d33('0x43')]['id']}})[_0x5d33('0x29')](handleEntityNotFound(_0x130008,null))[_0x5d33('0x29')](saveUpdates(_0x54be6c[_0x5d33('0x4b')],null))['then'](respondWithResult(_0x130008,null))[_0x5d33('0x49')](handleError(_0x130008,null));};exports[_0x5d33('0x2a')]=function(_0x3b370f,_0x54f7a6){return db[_0x5d33('0x30')][_0x5d33('0x48')]({'where':{'id':_0x3b370f['params']['id']}})['then'](handleEntityNotFound(_0x54f7a6,null))[_0x5d33('0x29')](removeEntity(_0x54f7a6,null))[_0x5d33('0x49')](handleError(_0x54f7a6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b8715df..a8cda2c 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 _0x4dcd=['FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x12eb6b,_0x24dd92){var _0x5473a6=function(_0x4dfc79){while(--_0x4dfc79){_0x12eb6b['push'](_0x12eb6b['shift']());}};_0x5473a6(++_0x24dd92);}(_0x4dcd,0x1b4));var _0xd4dc=function(_0x5edd3c,_0x3ff86a){_0x5edd3c=_0x5edd3c-0x0;var _0x78042f=_0x4dcd[_0x5edd3c];return _0x78042f;};'use strict';var _=require(_0xd4dc('0x0'));var util=require('util');var logger=require(_0xd4dc('0x1'))(_0xd4dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4dc('0x3'));var fs=require('fs');var path=require(_0xd4dc('0x4'));var rimraf=require(_0xd4dc('0x5'));var config=require(_0xd4dc('0x6'));var attributes=require(_0xd4dc('0x7'));module[_0xd4dc('0x8')]=function(_0x3559b4,_0x194f6d){return _0x3559b4[_0xd4dc('0x9')](_0xd4dc('0xa'),attributes,{'tableName':_0xd4dc('0xb'),'paranoid':![],'indexes':[{'name':_0xd4dc('0xc'),'fields':[_0xd4dc('0xd'),_0xd4dc('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['request-promise','path','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','util','api','moment','bluebird'];(function(_0x557778,_0x12c7d0){var _0x1b8f56=function(_0x24841b){while(--_0x24841b){_0x557778['push'](_0x557778['shift']());}};_0x1b8f56(++_0x12c7d0);}(_0x757a,0x14c));var _0xa757=function(_0x5b589d,_0xbb774e){_0x5b589d=_0x5b589d-0x0;var _0x12b89a=_0x757a[_0x5b589d];return _0x12b89a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require('../../config/logger')(_0xa757('0x1'));var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var rp=require(_0xa757('0x4'));var fs=require('fs');var path=require(_0xa757('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x441dca,_0x34f82c){return _0x441dca[_0xa757('0x8')](_0xa757('0x9'),attributes,{'tableName':_0xa757('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xa757('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 1d2e45c..6a348a9 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 _0x5377=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','bluebird'];(function(_0x2dff0b,_0x38612a){var _0x2827e0=function(_0x902224){while(--_0x902224){_0x2dff0b['push'](_0x2dff0b['shift']());}};_0x2827e0(++_0x38612a);}(_0x5377,0x131));var _0x7537=function(_0x3da9c3,_0x403fb4){_0x3da9c3=_0x3da9c3-0x0;var _0x43898c=_0x5377[_0x3da9c3];return _0x43898c;};'use strict';var _=require('lodash');var util=require(_0x7537('0x0'));var moment=require(_0x7537('0x1'));var BPromise=require(_0x7537('0x2'));var rs=require(_0x7537('0x3'));var fs=require('fs');var Redis=require(_0x7537('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7537('0x5'));var logger=require(_0x7537('0x6'))(_0x7537('0x7'));var config=require('../../config/environment');var jayson=require(_0x7537('0x8'));var client=jayson[_0x7537('0x9')][_0x7537('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd96ae0,_0x366781,_0x3bd44e){return new BPromise(function(_0x5d19d6,_0x34124a){return client[_0x7537('0xb')](_0xd96ae0,_0x3bd44e)[_0x7537('0xc')](function(_0x3d9608){logger['info'](_0x7537('0xd'),_0x366781,_0x7537('0xe'));logger[_0x7537('0xf')](_0x7537('0x10'),_0x366781,'request\x20sent',JSON['stringify'](_0x3d9608));if(_0x3d9608[_0x7537('0x11')]){if(_0x3d9608[_0x7537('0x11')]['code']===0x1f4){logger['error'](_0x7537('0xd'),_0x366781,_0x3d9608[_0x7537('0x11')]['message']);return _0x34124a(_0x3d9608[_0x7537('0x11')]['message']);}logger[_0x7537('0x11')](_0x7537('0xd'),_0x366781,_0x3d9608[_0x7537('0x11')][_0x7537('0x12')]);return _0x5d19d6(_0x3d9608[_0x7537('0x11')][_0x7537('0x12')]);}else{logger[_0x7537('0x13')](_0x7537('0xd'),_0x366781,_0x7537('0xe'));_0x5d19d6(_0x3d9608[_0x7537('0x14')]['message']);}})[_0x7537('0x15')](function(_0x42682a){logger['error'](_0x7537('0xd'),_0x366781,_0x42682a);_0x34124a(_0x42682a);});});} \ No newline at end of file +var _0x5b96=['VtigerField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5b96,0xbc));var _0x65b9=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0x5b96[_0x548e1d];return _0x398584;};'use strict';var _=require(_0x65b9('0x0'));var util=require('util');var moment=require(_0x65b9('0x1'));var BPromise=require(_0x65b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65b9('0x3'));var db=require(_0x65b9('0x4'))['db'];var utils=require(_0x65b9('0x5'));var logger=require(_0x65b9('0x6'))(_0x65b9('0x7'));var config=require(_0x65b9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x65b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc38556,_0x44dc69,_0x22f166){return new BPromise(function(_0x557a20,_0x146349){return client[_0x65b9('0xa')](_0xc38556,_0x22f166)[_0x65b9('0xb')](function(_0x42c06e){logger[_0x65b9('0xc')]('VtigerField,\x20%s,\x20%s',_0x44dc69,'request\x20sent');logger[_0x65b9('0xd')](_0x65b9('0xe'),_0x44dc69,_0x65b9('0xf'),JSON[_0x65b9('0x10')](_0x42c06e));if(_0x42c06e[_0x65b9('0x11')]){if(_0x42c06e['error'][_0x65b9('0x12')]===0x1f4){logger[_0x65b9('0x11')](_0x65b9('0x13'),_0x44dc69,_0x42c06e['error'][_0x65b9('0x14')]);return _0x146349(_0x42c06e[_0x65b9('0x11')]['message']);}logger['error'](_0x65b9('0x13'),_0x44dc69,_0x42c06e[_0x65b9('0x11')]['message']);return _0x557a20(_0x42c06e['error'][_0x65b9('0x14')]);}else{logger['info'](_0x65b9('0x13'),_0x44dc69,'request\x20sent');_0x557a20(_0x42c06e[_0x65b9('0x15')][_0x65b9('0x14')]);}})[_0x65b9('0x16')](function(_0x34e3e2){logger['error'](_0x65b9('0x13'),_0x44dc69,_0x34e3e2);_0x146349(_0x34e3e2);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6595aa0..d0118b0 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 _0x58eb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','util','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x58eb,0x15e));var _0xb58e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x58eb[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0xb58e('0x0'));var path=require('path');var timeout=require(_0xb58e('0x1'));var express=require(_0xb58e('0x2'));var router=express[_0xb58e('0x3')]();var fs_extra=require(_0xb58e('0x4'));var auth=require(_0xb58e('0x5'));var interaction=require(_0xb58e('0x6'));var config=require(_0xb58e('0x7'));var controller=require(_0xb58e('0x8'));router[_0xb58e('0x9')]('/',auth[_0xb58e('0xa')](),controller['index']);router[_0xb58e('0x9')](_0xb58e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb58e('0x9')]('/:id/configurations',auth[_0xb58e('0xa')](),controller[_0xb58e('0xc')]);router[_0xb58e('0x9')](_0xb58e('0xd'),auth[_0xb58e('0xa')](),controller[_0xb58e('0xe')]);router[_0xb58e('0xf')]('/',auth[_0xb58e('0xa')](),controller[_0xb58e('0x10')]);router[_0xb58e('0xf')](_0xb58e('0x11'),auth[_0xb58e('0xa')](),controller[_0xb58e('0x12')]);router['put'](_0xb58e('0xb'),auth['isAuthenticated'](),controller[_0xb58e('0x13')]);router['delete'](_0xb58e('0xb'),auth[_0xb58e('0xa')](),controller[_0xb58e('0x14')]);module[_0xb58e('0x15')]=router; \ No newline at end of file +var _0x27ea=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer'];(function(_0x40a33a,_0x296e04){var _0x1399dd=function(_0x172c0f){while(--_0x172c0f){_0x40a33a['push'](_0x40a33a['shift']());}};_0x1399dd(++_0x296e04);}(_0x27ea,0xc7));var _0xa27e=function(_0x5232f1,_0x4292ae){_0x5232f1=_0x5232f1-0x0;var _0x325e04=_0x27ea[_0x5232f1];return _0x325e04;};'use strict';var multer=require(_0xa27e('0x0'));var util=require('util');var path=require(_0xa27e('0x1'));var timeout=require(_0xa27e('0x2'));var express=require('express');var router=express[_0xa27e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa27e('0x4'));var interaction=require(_0xa27e('0x5'));var config=require(_0xa27e('0x6'));var controller=require(_0xa27e('0x7'));router[_0xa27e('0x8')]('/',auth[_0xa27e('0x9')](),controller[_0xa27e('0xa')]);router[_0xa27e('0x8')]('/:id',auth[_0xa27e('0x9')](),controller['show']);router[_0xa27e('0x8')](_0xa27e('0xb'),auth[_0xa27e('0x9')](),controller['getConfigurations']);router[_0xa27e('0x8')](_0xa27e('0xc'),auth[_0xa27e('0x9')](),controller[_0xa27e('0xd')]);router[_0xa27e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa27e('0xe')](_0xa27e('0xb'),auth[_0xa27e('0x9')](),controller[_0xa27e('0xf')]);router[_0xa27e('0x10')]('/:id',auth[_0xa27e('0x9')](),controller[_0xa27e('0x11')]);router['delete']('/:id',auth[_0xa27e('0x9')](),controller[_0xa27e('0x12')]);module[_0xa27e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e0b75e6..31882ab 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 _0x5496=['remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x166f34,_0x5730d0){var _0x40ab14=function(_0x504e84){while(--_0x504e84){_0x166f34['push'](_0x166f34['shift']());}};_0x40ab14(++_0x5730d0);}(_0x5496,0x175));var _0x6549=function(_0x3f078a,_0x53efe4){_0x3f078a=_0x3f078a-0x0;var _0x460db0=_0x5496[_0x3f078a];return _0x460db0;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')]},'description':{'type':Sequelize[_0x6549('0x2')]},'username':{'type':Sequelize[_0x6549('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6549('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6549('0x2')],'unique':_0x6549('0x3')},'authType':{'type':Sequelize[_0x6549('0x4')]('password','token'),'defaultValue':_0x6549('0x5')},'serverUrl':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6549('0x6'),_0x6549('0x7')),'defaultValue':_0x6549('0x6')}}; \ No newline at end of file +var _0x1967=['integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','token','password'];(function(_0x7c104a,_0x2b6e76){var _0x320032=function(_0x53f031){while(--_0x53f031){_0x7c104a['push'](_0x7c104a['shift']());}};_0x320032(++_0x2b6e76);}(_0x1967,0x173));var _0x7196=function(_0x44d43a,_0x23dde7){_0x44d43a=_0x44d43a-0x0;var _0x4c2c66=_0x1967[_0x44d43a];return _0x4c2c66;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'password':{'type':Sequelize[_0x7196('0x1')]},'token':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'authType':{'type':Sequelize[_0x7196('0x4')]('password',_0x7196('0x5')),'defaultValue':_0x7196('0x6')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x4')](_0x7196('0x7'),_0x7196('0x8')),'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 638062e..624f6a4 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 _0x6e6c=['name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','ZendeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack'];(function(_0x176dd3,_0x1f546f){var _0x21bdd6=function(_0x59df8a){while(--_0x59df8a){_0x176dd3['push'](_0x176dd3['shift']());}};_0x21bdd6(++_0x1f546f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['ZendeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56'),_0xc6e6('0x57'),_0xc6e6('0x58'),'remoteUri']})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))['then'](function(_0x4bdac6){if(_0x4bdac6){_0x55cec5=_0x4bdac6[_0xc6e6('0x59')];var _0xc38c57=_0x55cec5[_0xc6e6('0x5a')](-0x1);if(_0xc38c57==='/'){_0x55cec5=_0x55cec5['substring'](0x0,_0x55cec5[_0xc6e6('0x5b')](_0xc38c57));}var _0x4ec143={'method':'GET','uri':util[_0xc6e6('0x5c')]('%s/%s',_0x55cec5,_0xc6e6('0x5d')),'json':!![]};switch(_0x4bdac6[_0xc6e6('0x58')]){case _0xc6e6('0x56'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util['format'](_0xc6e6('0x5f'),new Buffer(util[_0xc6e6('0x5c')](_0xc6e6('0x60'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x56')]))['toString'](_0xc6e6('0x61')))};break;case _0xc6e6('0x57'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util[_0xc6e6('0x5c')]('Basic\x20%s',new Buffer(util['format'](_0xc6e6('0x62'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x57')]))[_0xc6e6('0x63')](_0xc6e6('0x61')))};break;default:throw new db[(_0xc6e6('0x64'))][(_0xc6e6('0x65'))](_0xc6e6('0x66'));}return rp(_0x4ec143);}})[_0xc6e6('0x24')](function(_0x4bbe4c){if(_0x4bbe4c){var _0x506679=[_0xc6e6('0x67'),'description',_0xc6e6('0x68'),_0xc6e6('0x69')];_[_0xc6e6('0x6a')](_0x4bbe4c['ticket_fields'],function(_0x5b0c3b){return _0x506679[_0xc6e6('0x6b')](_0x5b0c3b['type']);});return{'count':_0x4bbe4c[_0xc6e6('0x5d')]['length'],'rows':_[_0xc6e6('0x2a')](_0x4bbe4c[_0xc6e6('0x5d')],function(_0x5d867e){return{'id':_0x5d867e['id'],'name':_0x5d867e[_0xc6e6('0x6c')]>0x7?_0x5d867e[_0xc6e6('0x6d')]:_0x5d867e[_0xc6e6('0x2e')],'custom':_0x5d867e['position']>0x7?!![]:![],'options':_0x5d867e[_0xc6e6('0x6e')]?_0x5d867e[_0xc6e6('0x6e')]:_0x5d867e[_0xc6e6('0x6f')]?_0x5d867e['custom_field_options']:[]};})};}})[_0xc6e6('0x24')](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x4e7b05){var _0x4e0add=_0x4c4985['query'][_0xc6e6('0x70')]?0x1f4:_0x4e7b05[_0xc6e6('0x71')]||0x1f4;logger[_0xc6e6('0x25')](_0xc6e6('0x72'),_0xc6e6('0x54'),_0x4e0add,JSON[_0xc6e6('0x73')](_0x4e7b05));delete _0x4e7b05['name'];if(_0x4e0add===0x191){_0x4e0add=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x4e0add)['send'](_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x70')]?{'message':_0xc6e6('0x74'),'statusCode':_0x4e7b05['statusCode']}:_0x4e7b05);});}; \ No newline at end of file +var _0x44a3=['save','update','then','error','stack','name','send','index','map','ZendeskAccount','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','catch','params','find','create','body','destroy','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x44a3,0x1a9));var _0x344a=function(_0x1ce4d1,_0xea0bcb){_0x1ce4d1=_0x1ce4d1-0x0;var _0x1b270e=_0x44a3[_0x1ce4d1];return _0x1b270e;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a69ea,_0x304b70){_0x304b70=_0x304b70||0xcc;return function(_0x2ad7eb){if(_0x2ad7eb){return _0x4a69ea[_0x344a('0x17')](_0x304b70);}return _0x4a69ea[_0x344a('0x18')](_0x304b70)[_0x344a('0x19')]();};}function respondWithResult(_0x133ad4,_0x4ee562){_0x4ee562=_0x4ee562||0xc8;return function(_0x4032d7){if(_0x4032d7){return _0x133ad4[_0x344a('0x18')](_0x4ee562)[_0x344a('0x1a')](_0x4032d7);}};}function respondWithFilteredResult(_0x6e1639,_0x58c8cd){return function(_0x54a643){if(_0x54a643){var _0x3609ce=typeof _0x58c8cd[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x58c8cd[_0x344a('0x1d')]==='undefined';var _0x397de6=_0x54a643[_0x344a('0x1e')];var _0x49b55f=_0x3609ce?0x0:_0x58c8cd[_0x344a('0x1b')];var _0x274016=_0x3609ce?_0x54a643[_0x344a('0x1e')]:_0x58c8cd[_0x344a('0x1b')]+_0x58c8cd[_0x344a('0x1d')];var _0x43fa0f;if(_0x274016>=_0x397de6){_0x274016=_0x397de6;_0x43fa0f=0xc8;}else{_0x43fa0f=0xce;}_0x6e1639[_0x344a('0x18')](_0x43fa0f);return _0x6e1639[_0x344a('0x1f')](_0x344a('0x20'),_0x49b55f+'-'+_0x274016+'/'+_0x397de6)[_0x344a('0x1a')](_0x54a643);}return null;};}function patchUpdates(_0x4b3552){return function(_0x16c0fe){try{jsonpatch[_0x344a('0x21')](_0x16c0fe,_0x4b3552,!![]);}catch(_0xe0bdd4){return BPromise[_0x344a('0x22')](_0xe0bdd4);}return _0x16c0fe[_0x344a('0x23')]();};}function saveUpdates(_0x80ae12,_0x185303){return function(_0x976bcf){if(_0x976bcf){return _0x976bcf[_0x344a('0x24')](_0x80ae12)[_0x344a('0x25')](function(_0x90070c){return _0x90070c;});}return null;};}function removeEntity(_0x3b2ab9,_0x5ce9da){return function(_0x266fce){if(_0x266fce){return _0x266fce['destroy']()[_0x344a('0x25')](function(){_0x3b2ab9['status'](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x484f97,_0x36c920){return function(_0x8bf0b0){if(!_0x8bf0b0){_0x484f97[_0x344a('0x17')](0x194);}return _0x8bf0b0;};}function handleError(_0x16d404,_0x26f059){_0x26f059=_0x26f059||0x1f4;return function(_0x28749b){logger[_0x344a('0x26')](_0x28749b[_0x344a('0x27')]);if(_0x28749b['name']){delete _0x28749b[_0x344a('0x28')];}_0x16d404[_0x344a('0x18')](_0x26f059)[_0x344a('0x29')](_0x28749b);};}exports[_0x344a('0x2a')]=function(_0x14bd54,_0x2d72c9){var _0x5b877d={},_0x3d25fe={},_0x49bbf8={'count':0x0,'rows':[]};var _0x593cf6=_[_0x344a('0x2b')](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x4803db){return{'name':_0x4803db['fieldName'],'type':_0x4803db['type'][_0x344a('0x2e')]};});_0x3d25fe[_0x344a('0x2f')]=_[_0x344a('0x2b')](_0x593cf6,'name');_0x3d25fe[_0x344a('0x30')]=_[_0x344a('0x31')](_0x14bd54[_0x344a('0x30')]);_0x3d25fe[_0x344a('0x32')]=_[_0x344a('0x33')](_0x3d25fe[_0x344a('0x2f')],_0x3d25fe[_0x344a('0x30')]);_0x5b877d['attributes']=_[_0x344a('0x33')](_0x3d25fe['model'],qs['fields'](_0x14bd54['query'][_0x344a('0x34')]));_0x5b877d[_0x344a('0x35')]=_0x5b877d[_0x344a('0x35')][_0x344a('0x36')]?_0x5b877d[_0x344a('0x35')]:_0x3d25fe[_0x344a('0x2f')];if(!_0x14bd54['query'][_0x344a('0x37')](_0x344a('0x38'))){_0x5b877d[_0x344a('0x1d')]=qs['limit'](_0x14bd54[_0x344a('0x30')][_0x344a('0x1d')]);_0x5b877d[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14bd54[_0x344a('0x30')]['offset']);}_0x5b877d[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14bd54[_0x344a('0x30')][_0x344a('0x3a')]);_0x5b877d[_0x344a('0x3b')]=qs['filters'](_[_0x344a('0x3c')](_0x14bd54[_0x344a('0x30')],_0x3d25fe[_0x344a('0x32')]),_0x593cf6);if(_0x14bd54[_0x344a('0x30')][_0x344a('0x3d')]){_0x5b877d['where']=_[_0x344a('0x3e')](_0x5b877d[_0x344a('0x3b')],{'$or':_[_0x344a('0x2b')](_0x593cf6,function(_0x3356fb){if(_0x3356fb[_0x344a('0x3f')]!==_0x344a('0x40')){var _0x335a0a={};_0x335a0a[_0x3356fb[_0x344a('0x28')]]={'$like':'%'+_0x14bd54['query'][_0x344a('0x3d')]+'%'};return _0x335a0a;}})});}_0x5b877d=_[_0x344a('0x3e')]({},_0x5b877d,_0x14bd54[_0x344a('0x41')]);var _0x28bad9={'where':_0x5b877d[_0x344a('0x3b')]};return db['ZendeskAccount'][_0x344a('0x1e')](_0x28bad9)[_0x344a('0x25')](function(_0x7a33d7){_0x49bbf8[_0x344a('0x1e')]=_0x7a33d7;if(_0x14bd54[_0x344a('0x30')][_0x344a('0x42')]){_0x5b877d[_0x344a('0x43')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x44')](_0x5b877d);})['then'](function(_0x115a9c){_0x49bbf8[_0x344a('0x45')]=_0x115a9c;return _0x49bbf8;})[_0x344a('0x25')](respondWithFilteredResult(_0x2d72c9,_0x5b877d))[_0x344a('0x46')](handleError(_0x2d72c9,null));};exports['show']=function(_0x32bfa6,_0x3069ca){var _0x2b0ee9={'raw':![],'where':{'id':_0x32bfa6[_0x344a('0x47')]['id']}},_0x41f25b={};_0x41f25b[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x41f25b[_0x344a('0x30')]=_[_0x344a('0x31')](_0x32bfa6['query']);_0x41f25b[_0x344a('0x32')]=_[_0x344a('0x33')](_0x41f25b['model'],_0x41f25b[_0x344a('0x30')]);_0x2b0ee9[_0x344a('0x35')]=_['intersection'](_0x41f25b[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x32bfa6['query'][_0x344a('0x34')]));_0x2b0ee9[_0x344a('0x35')]=_0x2b0ee9[_0x344a('0x35')]['length']?_0x2b0ee9[_0x344a('0x35')]:_0x41f25b['model'];if(_0x32bfa6[_0x344a('0x30')][_0x344a('0x42')]){_0x2b0ee9[_0x344a('0x43')]=[{'all':!![]}];}_0x2b0ee9=_[_0x344a('0x3e')]({},_0x2b0ee9,_0x32bfa6['options']);return db['ZendeskAccount'][_0x344a('0x48')](_0x2b0ee9)[_0x344a('0x25')](handleEntityNotFound(_0x3069ca,null))[_0x344a('0x25')](respondWithResult(_0x3069ca,null))[_0x344a('0x46')](handleError(_0x3069ca,null));};exports[_0x344a('0x49')]=function(_0xa3c8f0,_0x44962b){return db[_0x344a('0x2c')][_0x344a('0x49')](_0xa3c8f0[_0x344a('0x4a')],{})['then'](respondWithResult(_0x44962b,0xc9))[_0x344a('0x46')](handleError(_0x44962b,null));};exports[_0x344a('0x24')]=function(_0x6fad37,_0xbad7ca){if(_0x6fad37['body']['id']){delete _0x6fad37[_0x344a('0x4a')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x6fad37[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0xbad7ca,null))['then'](saveUpdates(_0x6fad37[_0x344a('0x4a')],null))[_0x344a('0x25')](respondWithResult(_0xbad7ca,null))[_0x344a('0x46')](handleError(_0xbad7ca,null));};exports[_0x344a('0x4b')]=function(_0x51e411,_0x225fce){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x51e411[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x225fce,null))[_0x344a('0x25')](removeEntity(_0x225fce,null))[_0x344a('0x46')](handleError(_0x225fce,null));};exports[_0x344a('0x4c')]=function(_0x292357,_0x1911d0,_0x5e0885){var _0x15928a={};var _0x47ce9c={};var _0x1b7f6c;var _0xb744c6;return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x292357[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1911d0,null))[_0x344a('0x25')](function(_0x14921e){if(_0x14921e){_0x1b7f6c=_0x14921e;_0x47ce9c[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x4d')][_0x344a('0x2d')]);_0x47ce9c[_0x344a('0x30')]=_['keys'](_0x292357[_0x344a('0x30')]);_0x47ce9c[_0x344a('0x32')]=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],_0x47ce9c[_0x344a('0x30')]);_0x15928a['attributes']=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x292357[_0x344a('0x30')]['fields']));_0x15928a[_0x344a('0x35')]=_0x15928a[_0x344a('0x35')]['length']?_0x15928a[_0x344a('0x35')]:_0x47ce9c[_0x344a('0x2f')];_0x15928a[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x292357[_0x344a('0x30')][_0x344a('0x3a')]);_0x15928a[_0x344a('0x3b')]=qs['filters'](_['pick'](_0x292357['query'],_0x47ce9c[_0x344a('0x32')]));if(_0x292357[_0x344a('0x30')][_0x344a('0x3d')]){_0x15928a[_0x344a('0x3b')]=_['merge'](_0x15928a[_0x344a('0x3b')],{'$or':_['map'](_0x15928a['attributes'],function(_0x57241e){var _0x56b562={};_0x56b562[_0x57241e]={'$like':'%'+_0x292357[_0x344a('0x30')][_0x344a('0x3d')]+'%'};return _0x56b562;})});}_0x15928a=_[_0x344a('0x3e')]({},_0x15928a,_0x292357[_0x344a('0x41')]);return _0x1b7f6c['getConfigurations'](_0x15928a);}})['then'](function(_0x56e76e){if(_0x56e76e){_0xb744c6=_0x56e76e[_0x344a('0x36')];if(!_0x292357[_0x344a('0x30')][_0x344a('0x37')](_0x344a('0x38'))){_0x15928a[_0x344a('0x1d')]=qs['limit'](_0x292357[_0x344a('0x30')][_0x344a('0x1d')]);_0x15928a[_0x344a('0x1b')]=qs['offset'](_0x292357[_0x344a('0x30')]['offset']);}return _0x1b7f6c['getConfigurations'](_0x15928a);}})[_0x344a('0x25')](function(_0x532bcf){if(_0x532bcf){return _0x532bcf?{'count':_0xb744c6,'rows':_0x532bcf}:null;}})['then'](respondWithResult(_0x1911d0,null))[_0x344a('0x46')](handleError(_0x1911d0,null));};exports[_0x344a('0x4e')]=function(_0x4f2e35,_0x1bf894,_0x5808f2){if(_0x4f2e35[_0x344a('0x4a')]['id']){delete _0x4f2e35[_0x344a('0x4a')]['id'];}return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x4f2e35['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1bf894,null))[_0x344a('0x25')](function(_0xb4ddd7){if(_0xb4ddd7){_0x4f2e35[_0x344a('0x4a')]['AccountId']=_0xb4ddd7['id'];_0x4f2e35['body'][_0x344a('0x4f')]=integrations[_0x344a('0x50')](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35[_0x344a('0x4a')][_0x344a('0x3f')]);_0x4f2e35['body'][_0x344a('0x51')]=integrations['getDescriptions'](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35['body']['type']);return db[_0x344a('0x4d')][_0x344a('0x49')](_0x4f2e35[_0x344a('0x4a')],{'include':[{'model':db[_0x344a('0x52')],'as':_0x344a('0x4f')},{'model':db[_0x344a('0x52')],'as':'Descriptions'}]});}return null;})[_0x344a('0x25')](respondWithResult(_0x1bf894,null))[_0x344a('0x46')](handleError(_0x1bf894,null));};exports[_0x344a('0x53')]=function(_0x1c4284,_0x26688e,_0x523774){var _0x23a761='';return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x1c4284[_0x344a('0x47')]['id']},'attributes':['id',_0x344a('0x54'),_0x344a('0x55'),_0x344a('0x56'),'authType',_0x344a('0x57')]})[_0x344a('0x25')](handleEntityNotFound(_0x26688e,null))[_0x344a('0x25')](function(_0x42e1c0){if(_0x42e1c0){_0x23a761=_0x42e1c0[_0x344a('0x57')];var _0x421a09=_0x23a761[_0x344a('0x58')](-0x1);if(_0x421a09==='/'){_0x23a761=_0x23a761[_0x344a('0x59')](0x0,_0x23a761['lastIndexOf'](_0x421a09));}var _0x33113e={'method':_0x344a('0x5a'),'uri':util[_0x344a('0x5b')](_0x344a('0x5c'),_0x23a761,_0x344a('0x5d')),'json':!![]};switch(_0x42e1c0[_0x344a('0x5e')]){case _0x344a('0x55'):_0x33113e[_0x344a('0x5f')]={'Authorization':util['format'](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x61'),_0x42e1c0[_0x344a('0x54')],_0x42e1c0['password']))[_0x344a('0x62')](_0x344a('0x63')))};break;case _0x344a('0x56'):_0x33113e[_0x344a('0x5f')]={'Authorization':util[_0x344a('0x5b')](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x64'),_0x42e1c0['username'],_0x42e1c0[_0x344a('0x56')]))[_0x344a('0x62')](_0x344a('0x63')))};break;default:throw new db[(_0x344a('0x65'))]['ValidationError'](_0x344a('0x66'));}return rp(_0x33113e);}})[_0x344a('0x25')](function(_0x1d0025){if(_0x1d0025){var _0x2ff11d=[_0x344a('0x67'),_0x344a('0x68'),'group',_0x344a('0x69')];_[_0x344a('0x6a')](_0x1d0025[_0x344a('0x5d')],function(_0x5584d5){return _0x2ff11d[_0x344a('0x6b')](_0x5584d5[_0x344a('0x3f')]);});return{'count':_0x1d0025[_0x344a('0x5d')][_0x344a('0x36')],'rows':_[_0x344a('0x2b')](_0x1d0025['ticket_fields'],function(_0x15aadb){return{'id':_0x15aadb['id'],'name':_0x15aadb[_0x344a('0x6c')]>0x7?_0x15aadb[_0x344a('0x6d')]:_0x15aadb['type'],'custom':_0x15aadb[_0x344a('0x6c')]>0x7?!![]:![],'options':_0x15aadb['system_field_options']?_0x15aadb['system_field_options']:_0x15aadb[_0x344a('0x6e')]?_0x15aadb[_0x344a('0x6e')]:[]};})};}})[_0x344a('0x25')](respondWithResult(_0x26688e,null))[_0x344a('0x46')](function(_0x375c34){var _0x5e8df4=_0x1c4284[_0x344a('0x30')][_0x344a('0x6f')]?0x1f4:_0x375c34['statusCode']||0x1f4;logger[_0x344a('0x26')](_0x344a('0x70'),'getFields',_0x5e8df4,JSON['stringify'](_0x375c34));delete _0x375c34[_0x344a('0x28')];if(_0x5e8df4===0x191){_0x5e8df4=0x190;}_0x26688e[_0x344a('0x18')](_0x5e8df4)[_0x344a('0x29')](_0x1c4284[_0x344a('0x30')]['test']?{'message':_0x344a('0x71'),'statusCode':_0x375c34[_0x344a('0x72')]}:_0x375c34);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1fa0724..f985131 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 _0x5f19=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x5f19,0x8a));var _0x95f1=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x5f19[_0xdd2bfa];return _0x55397e;};'use strict';var _=require('lodash');var util=require(_0x95f1('0x0'));var logger=require(_0x95f1('0x1'))(_0x95f1('0x2'));var moment=require(_0x95f1('0x3'));var BPromise=require(_0x95f1('0x4'));var rp=require(_0x95f1('0x5'));var fs=require('fs');var path=require(_0x95f1('0x6'));var rimraf=require(_0x95f1('0x7'));var config=require(_0x95f1('0x8'));var attributes=require(_0x95f1('0x9'));var integrations=require(_0x95f1('0xa'));module['exports']=function(_0x4fb055,_0x38e3d5){return _0x4fb055[_0x95f1('0xb')](_0x95f1('0xc'),attributes,{'tableName':_0x95f1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc803=['api','moment','bluebird','path','rimraf','../../config/environment','exports','ZendeskAccount','int_zendesk_accounts'];(function(_0x99d212,_0x21e447){var _0x3fba5b=function(_0x492792){while(--_0x492792){_0x99d212['push'](_0x99d212['shift']());}};_0x3fba5b(++_0x21e447);}(_0xc803,0x1b9));var _0x3c80=function(_0x1c8fc1,_0x335611){_0x1c8fc1=_0x1c8fc1-0x0;var _0x53b4ab=_0xc803[_0x1c8fc1];return _0x53b4ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3c80('0x0'));var moment=require(_0x3c80('0x1'));var BPromise=require(_0x3c80('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c80('0x3'));var rimraf=require(_0x3c80('0x4'));var config=require(_0x3c80('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3c80('0x6')]=function(_0x21296f,_0x530436){return _0x21296f['define'](_0x3c80('0x7'),attributes,{'tableName':_0x3c80('0x8'),'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 fa0d337..c494fd5 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 _0x5b17=['options','raw','attributes','limit','include','map','model','then','debug','stringify','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5b17,0xc5));var _0x75b1=function(_0x590a62,_0x515412){_0x590a62=_0x590a62-0x0;var _0x56fdcb=_0x5b17[_0x590a62];return _0x56fdcb;};'use strict';var _=require(_0x75b1('0x0'));var util=require(_0x75b1('0x1'));var moment=require(_0x75b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x75b1('0x3'));var fs=require('fs');var Redis=require(_0x75b1('0x4'));var db=require(_0x75b1('0x5'))['db'];var utils=require(_0x75b1('0x6'));var logger=require(_0x75b1('0x7'))(_0x75b1('0x8'));var config=require(_0x75b1('0x9'));var jayson=require(_0x75b1('0xa'));var client=jayson[_0x75b1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a788,_0x58f16c,_0x1e59bc){return new BPromise(function(_0x25b38a,_0x31a3b4){return client[_0x75b1('0xc')](_0x22a788,_0x1e59bc)['then'](function(_0x313b4f){logger[_0x75b1('0xd')](_0x75b1('0xe'),_0x58f16c,_0x75b1('0xf'));logger['debug'](_0x75b1('0x10'),_0x58f16c,_0x75b1('0xf'),JSON['stringify'](_0x313b4f));if(_0x313b4f[_0x75b1('0x11')]){if(_0x313b4f[_0x75b1('0x11')][_0x75b1('0x12')]===0x1f4){logger[_0x75b1('0x11')](_0x75b1('0xe'),_0x58f16c,_0x313b4f[_0x75b1('0x11')][_0x75b1('0x13')]);return _0x31a3b4(_0x313b4f[_0x75b1('0x11')]['message']);}logger[_0x75b1('0x11')](_0x75b1('0xe'),_0x58f16c,_0x313b4f[_0x75b1('0x11')][_0x75b1('0x13')]);return _0x25b38a(_0x313b4f[_0x75b1('0x11')][_0x75b1('0x13')]);}else{logger[_0x75b1('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x58f16c,'request\x20sent');_0x25b38a(_0x313b4f[_0x75b1('0x14')]['message']);}})[_0x75b1('0x15')](function(_0xdff532){logger['error'](_0x75b1('0xe'),_0x58f16c,_0xdff532);_0x31a3b4(_0xdff532);});});}exports[_0x75b1('0x16')]=function(_0x38adcf){var _0x4ca9b7=this;return new Promise(function(_0x512196,_0x372192){return db[_0x75b1('0x17')][_0x75b1('0x18')]({'raw':_0x38adcf['options']?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1a')]===undefined?!![]:![]:!![],'where':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')]['where']||null:null,'attributes':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1b')]||null:null,'limit':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1c')]||null:null,'include':_0x38adcf[_0x75b1('0x19')]?_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1d')]?_[_0x75b1('0x1e')](_0x38adcf[_0x75b1('0x19')][_0x75b1('0x1d')],function(_0x1af4ba){return{'model':db[_0x1af4ba['model']],'as':_0x1af4ba['as'],'attributes':_0x1af4ba['attributes'],'include':_0x1af4ba[_0x75b1('0x1d')]?_[_0x75b1('0x1e')](_0x1af4ba['include'],function(_0x5b5742){return{'model':db[_0x5b5742[_0x75b1('0x1f')]],'as':_0x5b5742['as'],'attributes':_0x5b5742[_0x75b1('0x1b')],'include':_0x5b5742['include']?_[_0x75b1('0x1e')](_0x5b5742[_0x75b1('0x1d')],function(_0x2d09f5){return{'model':db[_0x2d09f5['model']],'as':_0x2d09f5['as'],'attributes':_0x2d09f5[_0x75b1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x75b1('0x20')](function(_0x1cee31){logger[_0x75b1('0xd')](_0x75b1('0x16'),_0x38adcf);logger[_0x75b1('0x21')](_0x75b1('0x16'),_0x38adcf,JSON[_0x75b1('0x22')](_0x1cee31));_0x512196(_0x1cee31);})[_0x75b1('0x15')](function(_0x21725f){logger['error'](_0x75b1('0x16'),_0x21725f[_0x75b1('0x13')],_0x38adcf);_0x372192(_0x4ca9b7[_0x75b1('0x11')](0x1f4,_0x21725f['message']));});});};exports[_0x75b1('0x23')]=function(_0xfdaa7c){var _0xa1ed12=this;return new Promise(function(_0x12d17d,_0x340398){return db[_0x75b1('0x17')][_0x75b1('0x24')]({'raw':_0xfdaa7c[_0x75b1('0x19')]?_0xfdaa7c[_0x75b1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xfdaa7c['options']?_0xfdaa7c[_0x75b1('0x19')]['where']||null:null,'attributes':_0xfdaa7c[_0x75b1('0x19')]?_0xfdaa7c[_0x75b1('0x19')]['attributes']||null:null,'include':_0xfdaa7c[_0x75b1('0x19')]?_0xfdaa7c[_0x75b1('0x19')][_0x75b1('0x1d')]?_['map'](_0xfdaa7c['options']['include'],function(_0x54882e){return{'model':db[_0x54882e['model']],'as':_0x54882e['as'],'attributes':_0x54882e[_0x75b1('0x1b')],'include':_0x54882e[_0x75b1('0x1d')]?_[_0x75b1('0x1e')](_0x54882e[_0x75b1('0x1d')],function(_0x227db3){return{'model':db[_0x227db3[_0x75b1('0x1f')]],'as':_0x227db3['as'],'attributes':_0x227db3[_0x75b1('0x1b')],'include':_0x227db3['include']?_[_0x75b1('0x1e')](_0x227db3[_0x75b1('0x1d')],function(_0x5c7845){return{'model':db[_0x5c7845[_0x75b1('0x1f')]],'as':_0x5c7845['as'],'attributes':_0x5c7845[_0x75b1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x75b1('0x20')](function(_0x8b96f0){logger[_0x75b1('0xd')](_0x75b1('0x23'),_0xfdaa7c);logger[_0x75b1('0x21')](_0x75b1('0x23'),_0xfdaa7c,JSON[_0x75b1('0x22')](_0x8b96f0));_0x12d17d(_0x8b96f0);})['catch'](function(_0x4fab4f){logger[_0x75b1('0x11')](_0x75b1('0x23'),_0x4fab4f[_0x75b1('0x13')],_0xfdaa7c);_0x340398(_0xa1ed12['error'](0x1f4,_0x4fab4f['message']));});});}; \ No newline at end of file +var _0xed9d=['request\x20sent','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','map','model','include','stringify','raw','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug'];(function(_0x44118f,_0x414363){var _0x37e28c=function(_0x635ff2){while(--_0x635ff2){_0x44118f['push'](_0x44118f['shift']());}};_0x37e28c(++_0x414363);}(_0xed9d,0x79));var _0xded9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed9d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var moment=require(_0xded9('0x2'));var BPromise=require('bluebird');var rs=require(_0xded9('0x3'));var fs=require('fs');var Redis=require(_0xded9('0x4'));var db=require(_0xded9('0x5'))['db'];var utils=require(_0xded9('0x6'));var logger=require(_0xded9('0x7'))('rpc');var config=require(_0xded9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xded9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x185ea6,_0x32a385,_0x5bbc7c){return new BPromise(function(_0x3a16e4,_0x28f636){return client[_0xded9('0xa')](_0x185ea6,_0x5bbc7c)[_0xded9('0xb')](function(_0x3f4b76){logger[_0xded9('0xc')](_0xded9('0xd'),_0x32a385,'request\x20sent');logger[_0xded9('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x32a385,_0xded9('0xf'),JSON['stringify'](_0x3f4b76));if(_0x3f4b76[_0xded9('0x10')]){if(_0x3f4b76['error'][_0xded9('0x11')]===0x1f4){logger[_0xded9('0x10')](_0xded9('0xd'),_0x32a385,_0x3f4b76[_0xded9('0x10')][_0xded9('0x12')]);return _0x28f636(_0x3f4b76[_0xded9('0x10')][_0xded9('0x12')]);}logger[_0xded9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x32a385,_0x3f4b76[_0xded9('0x10')][_0xded9('0x12')]);return _0x3a16e4(_0x3f4b76[_0xded9('0x10')][_0xded9('0x12')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x32a385,_0xded9('0xf'));_0x3a16e4(_0x3f4b76[_0xded9('0x13')][_0xded9('0x12')]);}})[_0xded9('0x14')](function(_0x919e32){logger['error'](_0xded9('0xd'),_0x32a385,_0x919e32);_0x28f636(_0x919e32);});});}exports[_0xded9('0x15')]=function(_0x436ae3){var _0x3c335e=this;return new Promise(function(_0x3b500d,_0x4d62ae){return db[_0xded9('0x16')][_0xded9('0x17')]({'raw':_0x436ae3[_0xded9('0x18')]?_0x436ae3['options']['raw']===undefined?!![]:![]:!![],'where':_0x436ae3[_0xded9('0x18')]?_0x436ae3[_0xded9('0x18')][_0xded9('0x19')]||null:null,'attributes':_0x436ae3[_0xded9('0x18')]?_0x436ae3['options'][_0xded9('0x1a')]||null:null,'limit':_0x436ae3[_0xded9('0x18')]?_0x436ae3[_0xded9('0x18')][_0xded9('0x1b')]||null:null,'include':_0x436ae3[_0xded9('0x18')]?_0x436ae3[_0xded9('0x18')]['include']?_[_0xded9('0x1c')](_0x436ae3[_0xded9('0x18')]['include'],function(_0x422629){return{'model':db[_0x422629[_0xded9('0x1d')]],'as':_0x422629['as'],'attributes':_0x422629[_0xded9('0x1a')],'include':_0x422629['include']?_['map'](_0x422629[_0xded9('0x1e')],function(_0x34b09c){return{'model':db[_0x34b09c[_0xded9('0x1d')]],'as':_0x34b09c['as'],'attributes':_0x34b09c[_0xded9('0x1a')],'include':_0x34b09c[_0xded9('0x1e')]?_[_0xded9('0x1c')](_0x34b09c['include'],function(_0x5bf044){return{'model':db[_0x5bf044[_0xded9('0x1d')]],'as':_0x5bf044['as'],'attributes':_0x5bf044[_0xded9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a8af5){logger['info'](_0xded9('0x15'),_0x436ae3);logger[_0xded9('0xe')]('GetZendeskAccount',_0x436ae3,JSON[_0xded9('0x1f')](_0x3a8af5));_0x3b500d(_0x3a8af5);})[_0xded9('0x14')](function(_0x508082){logger[_0xded9('0x10')](_0xded9('0x15'),_0x508082[_0xded9('0x12')],_0x436ae3);_0x4d62ae(_0x3c335e[_0xded9('0x10')](0x1f4,_0x508082[_0xded9('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x1ccb6d){var _0x4b944c=this;return new Promise(function(_0x156eae,_0x152c8d){return db[_0xded9('0x16')]['find']({'raw':_0x1ccb6d[_0xded9('0x18')]?_0x1ccb6d[_0xded9('0x18')][_0xded9('0x20')]===undefined?!![]:![]:!![],'where':_0x1ccb6d[_0xded9('0x18')]?_0x1ccb6d[_0xded9('0x18')][_0xded9('0x19')]||null:null,'attributes':_0x1ccb6d['options']?_0x1ccb6d[_0xded9('0x18')][_0xded9('0x1a')]||null:null,'include':_0x1ccb6d[_0xded9('0x18')]?_0x1ccb6d[_0xded9('0x18')][_0xded9('0x1e')]?_['map'](_0x1ccb6d[_0xded9('0x18')][_0xded9('0x1e')],function(_0x20212f){return{'model':db[_0x20212f[_0xded9('0x1d')]],'as':_0x20212f['as'],'attributes':_0x20212f['attributes'],'include':_0x20212f[_0xded9('0x1e')]?_[_0xded9('0x1c')](_0x20212f[_0xded9('0x1e')],function(_0xc1704a){return{'model':db[_0xc1704a[_0xded9('0x1d')]],'as':_0xc1704a['as'],'attributes':_0xc1704a[_0xded9('0x1a')],'include':_0xc1704a[_0xded9('0x1e')]?_['map'](_0xc1704a['include'],function(_0x553687){return{'model':db[_0x553687['model']],'as':_0x553687['as'],'attributes':_0x553687[_0xded9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xded9('0xb')](function(_0x2811b4){logger[_0xded9('0xc')](_0xded9('0x21'),_0x1ccb6d);logger[_0xded9('0xe')](_0xded9('0x21'),_0x1ccb6d,JSON[_0xded9('0x1f')](_0x2811b4));_0x156eae(_0x2811b4);})[_0xded9('0x14')](function(_0x51eca7){logger[_0xded9('0x10')](_0xded9('0x21'),_0x51eca7['message'],_0x1ccb6d);_0x152c8d(_0x4b944c['error'](0x1f4,_0x51eca7['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 066e979..3b8afea 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x1a03f0,_0x1e07b4){var _0x26e3e2=function(_0x3d95ac){while(--_0x3d95ac){_0x1a03f0['push'](_0x1a03f0['shift']());}};_0x26e3e2(++_0x1e07b4);}(_0x91a7,0xe7));var _0x791a=function(_0x2bf8cc,_0x2c9c1c){_0x2bf8cc=_0x2bf8cc-0x0;var _0x273a60=_0x91a7[_0x2bf8cc];return _0x273a60;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb7e7[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 66d17fa..0a9970d 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 _0x1e50=['sequelize','exports','STRING'];(function(_0x2a6948,_0x1de223){var _0x1cf9ab=function(_0x276c89){while(--_0x276c89){_0x2a6948['push'](_0x2a6948['shift']());}};_0x1cf9ab(++_0x1de223);}(_0x1e50,0xba));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x01e5('0x0'));module[_0x01e5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x01e5('0x2')]}}; \ No newline at end of file +var _0x0b42=['exports','STRING','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0b42,0x10a));var _0x20b4=function(_0x4b8089,_0x25305e){_0x4b8089=_0x4b8089-0x0;var _0x1de835=_0x0b42[_0x4b8089];return _0x1de835;};'use strict';var Sequelize=require(_0x20b4('0x0'));module[_0x20b4('0x1')]={'name':{'type':Sequelize[_0x20b4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 583eef6..27bbea8 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 _0xcd41=['nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x242642,_0x55fb75){var _0x4a0ecd=function(_0xa0172d){while(--_0xa0172d){_0x242642['push'](_0x242642['shift']());}};_0x4a0ecd(++_0x55fb75);}(_0xcd41,0x10c));var _0x1cd4=function(_0x1e42cb,_0x17aaba){_0x1e42cb=_0x1e42cb-0x0;var _0xffe23f=_0xcd41[_0x1e42cb];return _0xffe23f;};'use strict';var emlformat=require(_0x1cd4('0x0'));var rimraf=require(_0x1cd4('0x1'));var zipdir=require(_0x1cd4('0x2'));var jsonpatch=require(_0x1cd4('0x3'));var rp=require(_0x1cd4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1cd4('0x5'));var path=require(_0x1cd4('0x6'));var sox=require(_0x1cd4('0x7'));var csv=require(_0x1cd4('0x8'));var ejs=require(_0x1cd4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1cd4('0xa'));var squel=require(_0x1cd4('0xb'));var crypto=require(_0x1cd4('0xc'));var jsforce=require(_0x1cd4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1cd4('0x8'));var querystring=require(_0x1cd4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cd4('0xf'))(_0x1cd4('0x10'));var utils=require('../../config/utils');var config=require(_0x1cd4('0x11'));var licenseUtil=require(_0x1cd4('0x12'));var db=require(_0x1cd4('0x13'))['db'];function respondWithStatusCode(_0x243f50,_0xdf79be){_0xdf79be=_0xdf79be||0xcc;return function(_0x2e76a5){if(_0x2e76a5){return _0x243f50[_0x1cd4('0x14')](_0xdf79be);}return _0x243f50['status'](_0xdf79be)[_0x1cd4('0x15')]();};}function respondWithResult(_0x2cd068,_0x5e5a0b){_0x5e5a0b=_0x5e5a0b||0xc8;return function(_0x5a7c1d){if(_0x5a7c1d){return _0x2cd068[_0x1cd4('0x16')](_0x5e5a0b)['json'](_0x5a7c1d);}};}function respondWithFilteredResult(_0x2a7602,_0x58124d){return function(_0x36b8f8){if(_0x36b8f8){var _0x5d8d8a=typeof _0x58124d[_0x1cd4('0x17')]===_0x1cd4('0x18')&&typeof _0x58124d[_0x1cd4('0x19')]===_0x1cd4('0x18');var _0x31f0d6=_0x36b8f8['count'];var _0x239a3c=_0x5d8d8a?0x0:_0x58124d['offset'];var _0x472ade=_0x5d8d8a?_0x36b8f8[_0x1cd4('0x1a')]:_0x58124d[_0x1cd4('0x17')]+_0x58124d['limit'];var _0x4ef41f;if(_0x472ade>=_0x31f0d6){_0x472ade=_0x31f0d6;_0x4ef41f=0xc8;}else{_0x4ef41f=0xce;}_0x2a7602['status'](_0x4ef41f);return _0x2a7602[_0x1cd4('0x1b')](_0x1cd4('0x1c'),_0x239a3c+'-'+_0x472ade+'/'+_0x31f0d6)['json'](_0x36b8f8);}return null;};}function patchUpdates(_0x252042){return function(_0x2a5bd5){try{jsonpatch['apply'](_0x2a5bd5,_0x252042,!![]);}catch(_0x14be7a){return BPromise['reject'](_0x14be7a);}return _0x2a5bd5[_0x1cd4('0x1d')]();};}function saveUpdates(_0x4b7563,_0x1d6f7f){return function(_0x165b1a){if(_0x165b1a){return _0x165b1a[_0x1cd4('0x1e')](_0x4b7563)[_0x1cd4('0x1f')](function(_0x4f5bff){return _0x4f5bff;});}return null;};}function removeEntity(_0x1b79e2,_0x3437b3){return function(_0x23c03a){if(_0x23c03a){return _0x23c03a[_0x1cd4('0x20')]()[_0x1cd4('0x1f')](function(){_0x1b79e2[_0x1cd4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad89f,_0x4055dc){return function(_0x5a689a){if(!_0x5a689a){_0x4ad89f['sendStatus'](0x194);}return _0x5a689a;};}function handleError(_0x2424d7,_0xb9f9b9){_0xb9f9b9=_0xb9f9b9||0x1f4;return function(_0x19bd9e){logger[_0x1cd4('0x21')](_0x19bd9e[_0x1cd4('0x22')]);if(_0x19bd9e[_0x1cd4('0x23')]){delete _0x19bd9e[_0x1cd4('0x23')];}_0x2424d7[_0x1cd4('0x16')](_0xb9f9b9)['send'](_0x19bd9e);};}exports[_0x1cd4('0x24')]=function(_0x2572d2,_0x45582d){var _0x45def9={},_0x63a6b9={},_0x35c2c8={'count':0x0,'rows':[]};var _0x227b54=_[_0x1cd4('0x25')](db['ZendeskConfiguration']['rawAttributes'],function(_0x275c79){return{'name':_0x275c79[_0x1cd4('0x26')],'type':_0x275c79[_0x1cd4('0x27')]['key']};});_0x63a6b9[_0x1cd4('0x28')]=_[_0x1cd4('0x25')](_0x227b54,'name');_0x63a6b9[_0x1cd4('0x29')]=_[_0x1cd4('0x2a')](_0x2572d2[_0x1cd4('0x29')]);_0x63a6b9[_0x1cd4('0x2b')]=_[_0x1cd4('0x2c')](_0x63a6b9['model'],_0x63a6b9[_0x1cd4('0x29')]);_0x45def9[_0x1cd4('0x2d')]=_[_0x1cd4('0x2c')](_0x63a6b9[_0x1cd4('0x28')],qs[_0x1cd4('0x2e')](_0x2572d2['query'][_0x1cd4('0x2e')]));_0x45def9['attributes']=_0x45def9[_0x1cd4('0x2d')][_0x1cd4('0x2f')]?_0x45def9[_0x1cd4('0x2d')]:_0x63a6b9[_0x1cd4('0x28')];if(!_0x2572d2[_0x1cd4('0x29')]['hasOwnProperty'](_0x1cd4('0x30'))){_0x45def9['limit']=qs[_0x1cd4('0x19')](_0x2572d2['query']['limit']);_0x45def9[_0x1cd4('0x17')]=qs[_0x1cd4('0x17')](_0x2572d2[_0x1cd4('0x29')][_0x1cd4('0x17')]);}_0x45def9[_0x1cd4('0x31')]=qs[_0x1cd4('0x32')](_0x2572d2['query'][_0x1cd4('0x32')]);_0x45def9[_0x1cd4('0x33')]=qs[_0x1cd4('0x2b')](_[_0x1cd4('0x34')](_0x2572d2['query'],_0x63a6b9[_0x1cd4('0x2b')]),_0x227b54);if(_0x2572d2[_0x1cd4('0x29')][_0x1cd4('0x35')]){_0x45def9[_0x1cd4('0x33')]=_['merge'](_0x45def9[_0x1cd4('0x33')],{'$or':_['map'](_0x227b54,function(_0x47edeb){if(_0x47edeb[_0x1cd4('0x27')]!==_0x1cd4('0x36')){var _0x44238b={};_0x44238b[_0x47edeb[_0x1cd4('0x23')]]={'$like':'%'+_0x2572d2[_0x1cd4('0x29')][_0x1cd4('0x35')]+'%'};return _0x44238b;}})});}_0x45def9=_[_0x1cd4('0x37')]({},_0x45def9,_0x2572d2[_0x1cd4('0x38')]);var _0x208d09={'where':_0x45def9['where']};return db['ZendeskConfiguration'][_0x1cd4('0x1a')](_0x208d09)['then'](function(_0x513f32){_0x35c2c8[_0x1cd4('0x1a')]=_0x513f32;if(_0x2572d2[_0x1cd4('0x29')][_0x1cd4('0x39')]){_0x45def9[_0x1cd4('0x3a')]=[{'all':!![]}];}return db[_0x1cd4('0x3b')][_0x1cd4('0x3c')](_0x45def9);})[_0x1cd4('0x1f')](function(_0x3a5bdd){_0x35c2c8[_0x1cd4('0x3d')]=_0x3a5bdd;return _0x35c2c8;})[_0x1cd4('0x1f')](respondWithFilteredResult(_0x45582d,_0x45def9))[_0x1cd4('0x3e')](handleError(_0x45582d,null));};exports[_0x1cd4('0x3f')]=function(_0x5b698e,_0x27d902){var _0x597941={'raw':![],'where':{'id':_0x5b698e[_0x1cd4('0x40')]['id']}},_0x52a75c={};_0x52a75c[_0x1cd4('0x28')]=_['keys'](db['ZendeskConfiguration'][_0x1cd4('0x41')]);_0x52a75c['query']=_[_0x1cd4('0x2a')](_0x5b698e[_0x1cd4('0x29')]);_0x52a75c[_0x1cd4('0x2b')]=_['intersection'](_0x52a75c[_0x1cd4('0x28')],_0x52a75c[_0x1cd4('0x29')]);_0x597941[_0x1cd4('0x2d')]=_[_0x1cd4('0x2c')](_0x52a75c[_0x1cd4('0x28')],qs['fields'](_0x5b698e['query'][_0x1cd4('0x2e')]));_0x597941[_0x1cd4('0x2d')]=_0x597941[_0x1cd4('0x2d')][_0x1cd4('0x2f')]?_0x597941[_0x1cd4('0x2d')]:_0x52a75c[_0x1cd4('0x28')];if(_0x5b698e['query'][_0x1cd4('0x39')]){_0x597941[_0x1cd4('0x3a')]=[{'all':!![]}];}_0x597941=_[_0x1cd4('0x37')]({},_0x597941,_0x5b698e[_0x1cd4('0x38')]);return db[_0x1cd4('0x3b')]['find'](_0x597941)[_0x1cd4('0x1f')](handleEntityNotFound(_0x27d902,null))['then'](respondWithResult(_0x27d902,null))['catch'](handleError(_0x27d902,null));};exports[_0x1cd4('0x42')]=function(_0x445d89,_0x1426b9){return db[_0x1cd4('0x3b')]['create'](_0x445d89['body'],{})[_0x1cd4('0x1f')](respondWithResult(_0x1426b9,0xc9))[_0x1cd4('0x3e')](handleError(_0x1426b9,null));};exports[_0x1cd4('0x1e')]=function(_0x43ed1e,_0x2176b1){if(_0x43ed1e[_0x1cd4('0x43')]['id']){delete _0x43ed1e[_0x1cd4('0x43')]['id'];}return db['ZendeskConfiguration'][_0x1cd4('0x44')]({'where':{'id':_0x43ed1e[_0x1cd4('0x40')]['id']}})[_0x1cd4('0x1f')](handleEntityNotFound(_0x2176b1,null))[_0x1cd4('0x1f')](saveUpdates(_0x43ed1e[_0x1cd4('0x43')],null))[_0x1cd4('0x1f')](respondWithResult(_0x2176b1,null))['catch'](handleError(_0x2176b1,null));};exports[_0x1cd4('0x20')]=function(_0x15b0e9,_0x5ec5f1){return db[_0x1cd4('0x3b')][_0x1cd4('0x44')]({'where':{'id':_0x15b0e9[_0x1cd4('0x40')]['id']}})[_0x1cd4('0x1f')](handleEntityNotFound(_0x5ec5f1,null))[_0x1cd4('0x1f')](removeEntity(_0x5ec5f1,null))['catch'](handleError(_0x5ec5f1,null));};exports[_0x1cd4('0x45')]=function(_0x3e08a6,_0x5c92fa,_0x38a5c8){var _0x4c7f89={};var _0xa2914f={};var _0x399a7e;var _0x1f0d83;return db[_0x1cd4('0x3b')][_0x1cd4('0x46')]({'where':{'id':_0x3e08a6[_0x1cd4('0x40')]['id']}})[_0x1cd4('0x1f')](handleEntityNotFound(_0x5c92fa,null))[_0x1cd4('0x1f')](function(_0x2c74f3){if(_0x2c74f3){_0x399a7e=_0x2c74f3;_0xa2914f[_0x1cd4('0x28')]=_[_0x1cd4('0x2a')](db[_0x1cd4('0x47')][_0x1cd4('0x41')]);_0xa2914f[_0x1cd4('0x29')]=_['keys'](_0x3e08a6[_0x1cd4('0x29')]);_0xa2914f[_0x1cd4('0x2b')]=_['intersection'](_0xa2914f[_0x1cd4('0x28')],_0xa2914f[_0x1cd4('0x29')]);_0x4c7f89['attributes']=_[_0x1cd4('0x2c')](_0xa2914f[_0x1cd4('0x28')],qs[_0x1cd4('0x2e')](_0x3e08a6['query'][_0x1cd4('0x2e')]));_0x4c7f89['attributes']=_0x4c7f89[_0x1cd4('0x2d')][_0x1cd4('0x2f')]?_0x4c7f89[_0x1cd4('0x2d')]:_0xa2914f[_0x1cd4('0x28')];_0x4c7f89[_0x1cd4('0x31')]=qs[_0x1cd4('0x32')](_0x3e08a6['query']['sort']);_0x4c7f89[_0x1cd4('0x33')]=qs[_0x1cd4('0x2b')](_[_0x1cd4('0x34')](_0x3e08a6['query'],_0xa2914f[_0x1cd4('0x2b')]));if(_0x3e08a6[_0x1cd4('0x29')][_0x1cd4('0x35')]){_0x4c7f89['where']=_['merge'](_0x4c7f89[_0x1cd4('0x33')],{'$or':_['map'](_0x4c7f89[_0x1cd4('0x2d')],function(_0x5115cd){var _0x369000={};_0x369000[_0x5115cd]={'$like':'%'+_0x3e08a6[_0x1cd4('0x29')][_0x1cd4('0x35')]+'%'};return _0x369000;})});}_0x4c7f89=_['merge']({},_0x4c7f89,_0x3e08a6['options']);return _0x399a7e[_0x1cd4('0x45')](_0x4c7f89);}})[_0x1cd4('0x1f')](function(_0xa39b0a){if(_0xa39b0a){_0x1f0d83=_0xa39b0a[_0x1cd4('0x2f')];if(!_0x3e08a6[_0x1cd4('0x29')][_0x1cd4('0x48')](_0x1cd4('0x30'))){_0x4c7f89['limit']=qs[_0x1cd4('0x19')](_0x3e08a6[_0x1cd4('0x29')][_0x1cd4('0x19')]);_0x4c7f89['offset']=qs['offset'](_0x3e08a6[_0x1cd4('0x29')][_0x1cd4('0x17')]);}return _0x399a7e[_0x1cd4('0x45')](_0x4c7f89);}})[_0x1cd4('0x1f')](function(_0x149593){if(_0x149593){return _0x149593?{'count':_0x1f0d83,'rows':_0x149593}:null;}})[_0x1cd4('0x1f')](respondWithResult(_0x5c92fa,null))[_0x1cd4('0x3e')](handleError(_0x5c92fa,null));};exports[_0x1cd4('0x49')]=function(_0x3d26d5,_0x409bea,_0x45e5ca){var _0x242f2d={};var _0x4a1e15={};var _0x167754;var _0xda62d7;return db[_0x1cd4('0x3b')][_0x1cd4('0x46')]({'where':{'id':_0x3d26d5[_0x1cd4('0x40')]['id']}})['then'](handleEntityNotFound(_0x409bea,null))[_0x1cd4('0x1f')](function(_0x58dde1){if(_0x58dde1){_0x167754=_0x58dde1;_0x4a1e15[_0x1cd4('0x28')]=_[_0x1cd4('0x2a')](db['ZendeskField']['rawAttributes']);_0x4a1e15[_0x1cd4('0x29')]=_[_0x1cd4('0x2a')](_0x3d26d5['query']);_0x4a1e15['filters']=_[_0x1cd4('0x2c')](_0x4a1e15['model'],_0x4a1e15['query']);_0x242f2d['attributes']=_['intersection'](_0x4a1e15[_0x1cd4('0x28')],qs['fields'](_0x3d26d5[_0x1cd4('0x29')]['fields']));_0x242f2d[_0x1cd4('0x2d')]=_0x242f2d[_0x1cd4('0x2d')][_0x1cd4('0x2f')]?_0x242f2d[_0x1cd4('0x2d')]:_0x4a1e15['model'];_0x242f2d[_0x1cd4('0x31')]=qs[_0x1cd4('0x32')](_0x3d26d5['query'][_0x1cd4('0x32')]);_0x242f2d[_0x1cd4('0x33')]=qs[_0x1cd4('0x2b')](_[_0x1cd4('0x34')](_0x3d26d5['query'],_0x4a1e15[_0x1cd4('0x2b')]));if(_0x3d26d5[_0x1cd4('0x29')]['filter']){_0x242f2d[_0x1cd4('0x33')]=_[_0x1cd4('0x37')](_0x242f2d[_0x1cd4('0x33')],{'$or':_['map'](_0x242f2d[_0x1cd4('0x2d')],function(_0x5b74fd){var _0x3633e9={};_0x3633e9[_0x5b74fd]={'$like':'%'+_0x3d26d5[_0x1cd4('0x29')]['filter']+'%'};return _0x3633e9;})});}_0x242f2d=_[_0x1cd4('0x37')]({},_0x242f2d,_0x3d26d5['options']);return _0x167754[_0x1cd4('0x49')](_0x242f2d);}})[_0x1cd4('0x1f')](function(_0x206b63){if(_0x206b63){_0xda62d7=_0x206b63[_0x1cd4('0x2f')];if(!_0x3d26d5['query'][_0x1cd4('0x48')](_0x1cd4('0x30'))){_0x242f2d[_0x1cd4('0x19')]=qs[_0x1cd4('0x19')](_0x3d26d5['query']['limit']);_0x242f2d['offset']=qs['offset'](_0x3d26d5[_0x1cd4('0x29')]['offset']);}return _0x167754[_0x1cd4('0x49')](_0x242f2d);}})[_0x1cd4('0x1f')](function(_0x3cb5fc){if(_0x3cb5fc){return _0x3cb5fc?{'count':_0xda62d7,'rows':_0x3cb5fc}:null;}})[_0x1cd4('0x1f')](respondWithResult(_0x409bea,null))[_0x1cd4('0x3e')](handleError(_0x409bea,null));};exports[_0x1cd4('0x4a')]=function(_0x8e8501,_0x461ee1,_0x2b006c){var _0x25f691={};var _0x46fc5f={};var _0x11e558;var _0x43df37;return db[_0x1cd4('0x3b')][_0x1cd4('0x46')]({'where':{'id':_0x8e8501[_0x1cd4('0x40')]['id']}})[_0x1cd4('0x1f')](handleEntityNotFound(_0x461ee1,null))['then'](function(_0x479a31){if(_0x479a31){_0x11e558=_0x479a31;_0x46fc5f[_0x1cd4('0x28')]=_['keys'](db[_0x1cd4('0x47')][_0x1cd4('0x41')]);_0x46fc5f['query']=_['keys'](_0x8e8501[_0x1cd4('0x29')]);_0x46fc5f[_0x1cd4('0x2b')]=_[_0x1cd4('0x2c')](_0x46fc5f[_0x1cd4('0x28')],_0x46fc5f[_0x1cd4('0x29')]);_0x25f691[_0x1cd4('0x2d')]=_[_0x1cd4('0x2c')](_0x46fc5f['model'],qs[_0x1cd4('0x2e')](_0x8e8501[_0x1cd4('0x29')]['fields']));_0x25f691[_0x1cd4('0x2d')]=_0x25f691[_0x1cd4('0x2d')][_0x1cd4('0x2f')]?_0x25f691[_0x1cd4('0x2d')]:_0x46fc5f[_0x1cd4('0x28')];_0x25f691['order']=qs[_0x1cd4('0x32')](_0x8e8501[_0x1cd4('0x29')][_0x1cd4('0x32')]);_0x25f691[_0x1cd4('0x33')]=qs[_0x1cd4('0x2b')](_[_0x1cd4('0x34')](_0x8e8501['query'],_0x46fc5f[_0x1cd4('0x2b')]));if(_0x8e8501[_0x1cd4('0x29')]['filter']){_0x25f691[_0x1cd4('0x33')]=_['merge'](_0x25f691[_0x1cd4('0x33')],{'$or':_['map'](_0x25f691[_0x1cd4('0x2d')],function(_0xbabda7){var _0x1dad72={};_0x1dad72[_0xbabda7]={'$like':'%'+_0x8e8501[_0x1cd4('0x29')][_0x1cd4('0x35')]+'%'};return _0x1dad72;})});}_0x25f691=_[_0x1cd4('0x37')]({},_0x25f691,_0x8e8501['options']);return _0x11e558[_0x1cd4('0x4a')](_0x25f691);}})[_0x1cd4('0x1f')](function(_0x532734){if(_0x532734){_0x43df37=_0x532734[_0x1cd4('0x2f')];if(!_0x8e8501['query']['hasOwnProperty'](_0x1cd4('0x30'))){_0x25f691['limit']=qs[_0x1cd4('0x19')](_0x8e8501['query']['limit']);_0x25f691['offset']=qs[_0x1cd4('0x17')](_0x8e8501[_0x1cd4('0x29')][_0x1cd4('0x17')]);}return _0x11e558['getDescriptions'](_0x25f691);}})['then'](function(_0x26f497){if(_0x26f497){return _0x26f497?{'count':_0x43df37,'rows':_0x26f497}:null;}})[_0x1cd4('0x1f')](respondWithResult(_0x461ee1,null))[_0x1cd4('0x3e')](handleError(_0x461ee1,null));};exports['getTags']=function(_0x1a5ad5,_0x19486d,_0x555209){var _0x573d68={};var _0x1eaf78={};var _0x46d05c;var _0x5002d7;return db[_0x1cd4('0x3b')][_0x1cd4('0x46')]({'where':{'id':_0x1a5ad5[_0x1cd4('0x40')]['id']}})[_0x1cd4('0x1f')](handleEntityNotFound(_0x19486d,null))[_0x1cd4('0x1f')](function(_0x28ccd4){if(_0x28ccd4){_0x46d05c=_0x28ccd4;_0x1eaf78[_0x1cd4('0x28')]=_[_0x1cd4('0x2a')](db[_0x1cd4('0x4b')]['rawAttributes']);_0x1eaf78[_0x1cd4('0x29')]=_['keys'](_0x1a5ad5[_0x1cd4('0x29')]);_0x1eaf78[_0x1cd4('0x2b')]=_['intersection'](_0x1eaf78[_0x1cd4('0x28')],_0x1eaf78[_0x1cd4('0x29')]);_0x573d68[_0x1cd4('0x2d')]=_[_0x1cd4('0x2c')](_0x1eaf78[_0x1cd4('0x28')],qs[_0x1cd4('0x2e')](_0x1a5ad5[_0x1cd4('0x29')][_0x1cd4('0x2e')]));_0x573d68[_0x1cd4('0x2d')]=_0x573d68[_0x1cd4('0x2d')][_0x1cd4('0x2f')]?_0x573d68['attributes']:_0x1eaf78[_0x1cd4('0x28')];_0x573d68[_0x1cd4('0x31')]=qs[_0x1cd4('0x32')](_0x1a5ad5[_0x1cd4('0x29')][_0x1cd4('0x32')]);_0x573d68['where']=qs[_0x1cd4('0x2b')](_[_0x1cd4('0x34')](_0x1a5ad5['query'],_0x1eaf78[_0x1cd4('0x2b')]));if(_0x1a5ad5[_0x1cd4('0x29')]['filter']){_0x573d68[_0x1cd4('0x33')]=_[_0x1cd4('0x37')](_0x573d68[_0x1cd4('0x33')],{'$or':_[_0x1cd4('0x25')](_0x573d68[_0x1cd4('0x2d')],function(_0x4a86c4){var _0x6b4fb5={};_0x6b4fb5[_0x4a86c4]={'$like':'%'+_0x1a5ad5[_0x1cd4('0x29')][_0x1cd4('0x35')]+'%'};return _0x6b4fb5;})});}_0x573d68=_[_0x1cd4('0x37')]({},_0x573d68,_0x1a5ad5[_0x1cd4('0x38')]);return _0x46d05c[_0x1cd4('0x4c')](_0x573d68);}})[_0x1cd4('0x1f')](function(_0x536be2){if(_0x536be2){_0x5002d7=_0x536be2[_0x1cd4('0x2f')];if(!_0x1a5ad5[_0x1cd4('0x29')][_0x1cd4('0x48')](_0x1cd4('0x30'))){_0x573d68[_0x1cd4('0x19')]=qs[_0x1cd4('0x19')](_0x1a5ad5['query'][_0x1cd4('0x19')]);_0x573d68[_0x1cd4('0x17')]=qs[_0x1cd4('0x17')](_0x1a5ad5[_0x1cd4('0x29')][_0x1cd4('0x17')]);}return _0x46d05c['getTags'](_0x573d68);}})[_0x1cd4('0x1f')](function(_0x262ad8){if(_0x262ad8){return _0x262ad8?{'count':_0x5002d7,'rows':_0x262ad8}:null;}})[_0x1cd4('0x1f')](respondWithResult(_0x19486d,null))[_0x1cd4('0x3e')](handleError(_0x19486d,null));};exports[_0x1cd4('0x4d')]=function(_0xb20614,_0x2c1f10,_0x321d52){if(_0xb20614[_0x1cd4('0x43')]['id']){delete _0xb20614[_0x1cd4('0x43')]['id'];}return db[_0x1cd4('0x3b')][_0x1cd4('0x46')]({'where':{'id':_0xb20614[_0x1cd4('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c1f10,null))[_0x1cd4('0x1f')](function(_0x36fb2e){if(_0x36fb2e){return _0x36fb2e[_0x1cd4('0x4d')](_0xb20614[_0x1cd4('0x43')][_0x1cd4('0x4e')]||[]);}return null;})[_0x1cd4('0x1f')](respondWithResult(_0x2c1f10,null))[_0x1cd4('0x3e')](handleError(_0x2c1f10,null));}; \ No newline at end of file +var _0x1f21=['catch','show','params','find','create','body','getFields','findOne','getSubjects','getDescriptions','ZendeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','then','destroy','sendStatus','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','type','key','name','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x1f21,0x15e));var _0x11f2=function(_0x17dcd8,_0x2bdbef){_0x17dcd8=_0x17dcd8-0x0;var _0x54bb5f=_0x1f21[_0x17dcd8];return _0x54bb5f;};'use strict';var emlformat=require(_0x11f2('0x0'));var rimraf=require(_0x11f2('0x1'));var zipdir=require(_0x11f2('0x2'));var jsonpatch=require(_0x11f2('0x3'));var rp=require(_0x11f2('0x4'));var moment=require(_0x11f2('0x5'));var BPromise=require(_0x11f2('0x6'));var Mustache=require(_0x11f2('0x7'));var util=require(_0x11f2('0x8'));var path=require('path');var sox=require(_0x11f2('0x9'));var csv=require(_0x11f2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11f2('0xb'));var _=require(_0x11f2('0xc'));var squel=require(_0x11f2('0xd'));var crypto=require(_0x11f2('0xe'));var jsforce=require(_0x11f2('0xf'));var deskjs=require(_0x11f2('0x10'));var toCsv=require(_0x11f2('0xa'));var querystring=require('querystring');var Papa=require(_0x11f2('0x11'));var Redis=require(_0x11f2('0x12'));var authService=require(_0x11f2('0x13'));var qs=require(_0x11f2('0x14'));var as=require(_0x11f2('0x15'));var hardwareService=require(_0x11f2('0x16'));var logger=require(_0x11f2('0x17'))('api');var utils=require(_0x11f2('0x18'));var config=require(_0x11f2('0x19'));var licenseUtil=require(_0x11f2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d1cf4,_0x431204){_0x431204=_0x431204||0xcc;return function(_0x3e9435){if(_0x3e9435){return _0x3d1cf4['sendStatus'](_0x431204);}return _0x3d1cf4[_0x11f2('0x1b')](_0x431204)['end']();};}function respondWithResult(_0x20a4d2,_0x59a157){_0x59a157=_0x59a157||0xc8;return function(_0x1b4cd0){if(_0x1b4cd0){return _0x20a4d2[_0x11f2('0x1b')](_0x59a157)[_0x11f2('0x1c')](_0x1b4cd0);}};}function respondWithFilteredResult(_0x5538aa,_0x3a8de4){return function(_0x373e9c){if(_0x373e9c){var _0x4f6b73=typeof _0x3a8de4[_0x11f2('0x1d')]==='undefined'&&typeof _0x3a8de4[_0x11f2('0x1e')]===_0x11f2('0x1f');var _0x53dff9=_0x373e9c[_0x11f2('0x20')];var _0x17012e=_0x4f6b73?0x0:_0x3a8de4[_0x11f2('0x1d')];var _0xd57e2e=_0x4f6b73?_0x373e9c[_0x11f2('0x20')]:_0x3a8de4[_0x11f2('0x1d')]+_0x3a8de4[_0x11f2('0x1e')];var _0x515abb;if(_0xd57e2e>=_0x53dff9){_0xd57e2e=_0x53dff9;_0x515abb=0xc8;}else{_0x515abb=0xce;}_0x5538aa[_0x11f2('0x1b')](_0x515abb);return _0x5538aa[_0x11f2('0x21')]('Content-Range',_0x17012e+'-'+_0xd57e2e+'/'+_0x53dff9)['json'](_0x373e9c);}return null;};}function patchUpdates(_0x3a0669){return function(_0x3e52fb){try{jsonpatch[_0x11f2('0x22')](_0x3e52fb,_0x3a0669,!![]);}catch(_0x5bebac){return BPromise[_0x11f2('0x23')](_0x5bebac);}return _0x3e52fb['save']();};}function saveUpdates(_0x277c61,_0xa702b3){return function(_0x2df434){if(_0x2df434){return _0x2df434['update'](_0x277c61)[_0x11f2('0x24')](function(_0x25da0f){return _0x25da0f;});}return null;};}function removeEntity(_0x171a13,_0x13d41a){return function(_0xe915a8){if(_0xe915a8){return _0xe915a8[_0x11f2('0x25')]()['then'](function(){_0x171a13[_0x11f2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3118c3,_0x48a81a){return function(_0x2f7e25){if(!_0x2f7e25){_0x3118c3[_0x11f2('0x26')](0x194);}return _0x2f7e25;};}function handleError(_0xafecbc,_0x528248){_0x528248=_0x528248||0x1f4;return function(_0x2d5441){logger[_0x11f2('0x27')](_0x2d5441[_0x11f2('0x28')]);if(_0x2d5441['name']){delete _0x2d5441['name'];}_0xafecbc[_0x11f2('0x1b')](_0x528248)[_0x11f2('0x29')](_0x2d5441);};}exports[_0x11f2('0x2a')]=function(_0x509434,_0x52b72c){var _0x2865f6={},_0x5d6ff6={},_0x307d93={'count':0x0,'rows':[]};var _0x21e179=_[_0x11f2('0x2b')](db[_0x11f2('0x2c')][_0x11f2('0x2d')],function(_0x255f6b){return{'name':_0x255f6b['fieldName'],'type':_0x255f6b[_0x11f2('0x2e')][_0x11f2('0x2f')]};});_0x5d6ff6['model']=_[_0x11f2('0x2b')](_0x21e179,_0x11f2('0x30'));_0x5d6ff6[_0x11f2('0x31')]=_[_0x11f2('0x32')](_0x509434[_0x11f2('0x31')]);_0x5d6ff6[_0x11f2('0x33')]=_[_0x11f2('0x34')](_0x5d6ff6['model'],_0x5d6ff6[_0x11f2('0x31')]);_0x2865f6[_0x11f2('0x35')]=_['intersection'](_0x5d6ff6['model'],qs[_0x11f2('0x36')](_0x509434[_0x11f2('0x31')][_0x11f2('0x36')]));_0x2865f6['attributes']=_0x2865f6[_0x11f2('0x35')][_0x11f2('0x37')]?_0x2865f6['attributes']:_0x5d6ff6[_0x11f2('0x38')];if(!_0x509434[_0x11f2('0x31')][_0x11f2('0x39')](_0x11f2('0x3a'))){_0x2865f6['limit']=qs['limit'](_0x509434[_0x11f2('0x31')][_0x11f2('0x1e')]);_0x2865f6[_0x11f2('0x1d')]=qs[_0x11f2('0x1d')](_0x509434[_0x11f2('0x31')][_0x11f2('0x1d')]);}_0x2865f6[_0x11f2('0x3b')]=qs['sort'](_0x509434[_0x11f2('0x31')][_0x11f2('0x3c')]);_0x2865f6[_0x11f2('0x3d')]=qs['filters'](_[_0x11f2('0x3e')](_0x509434['query'],_0x5d6ff6['filters']),_0x21e179);if(_0x509434[_0x11f2('0x31')][_0x11f2('0x3f')]){_0x2865f6[_0x11f2('0x3d')]=_[_0x11f2('0x40')](_0x2865f6[_0x11f2('0x3d')],{'$or':_[_0x11f2('0x2b')](_0x21e179,function(_0x159946){if(_0x159946[_0x11f2('0x2e')]!==_0x11f2('0x41')){var _0x4b8c6a={};_0x4b8c6a[_0x159946['name']]={'$like':'%'+_0x509434[_0x11f2('0x31')][_0x11f2('0x3f')]+'%'};return _0x4b8c6a;}})});}_0x2865f6=_[_0x11f2('0x40')]({},_0x2865f6,_0x509434[_0x11f2('0x42')]);var _0x41272c={'where':_0x2865f6[_0x11f2('0x3d')]};return db[_0x11f2('0x2c')]['count'](_0x41272c)[_0x11f2('0x24')](function(_0x562bb1){_0x307d93['count']=_0x562bb1;if(_0x509434[_0x11f2('0x31')][_0x11f2('0x43')]){_0x2865f6[_0x11f2('0x44')]=[{'all':!![]}];}return db[_0x11f2('0x2c')][_0x11f2('0x45')](_0x2865f6);})['then'](function(_0x2af8b3){_0x307d93['rows']=_0x2af8b3;return _0x307d93;})['then'](respondWithFilteredResult(_0x52b72c,_0x2865f6))[_0x11f2('0x46')](handleError(_0x52b72c,null));};exports[_0x11f2('0x47')]=function(_0x23910e,_0x23490e){var _0x39d75c={'raw':![],'where':{'id':_0x23910e[_0x11f2('0x48')]['id']}},_0x405034={};_0x405034[_0x11f2('0x38')]=_[_0x11f2('0x32')](db['ZendeskConfiguration'][_0x11f2('0x2d')]);_0x405034[_0x11f2('0x31')]=_[_0x11f2('0x32')](_0x23910e[_0x11f2('0x31')]);_0x405034[_0x11f2('0x33')]=_['intersection'](_0x405034[_0x11f2('0x38')],_0x405034['query']);_0x39d75c['attributes']=_[_0x11f2('0x34')](_0x405034[_0x11f2('0x38')],qs[_0x11f2('0x36')](_0x23910e[_0x11f2('0x31')][_0x11f2('0x36')]));_0x39d75c[_0x11f2('0x35')]=_0x39d75c['attributes'][_0x11f2('0x37')]?_0x39d75c['attributes']:_0x405034[_0x11f2('0x38')];if(_0x23910e['query'][_0x11f2('0x43')]){_0x39d75c['include']=[{'all':!![]}];}_0x39d75c=_[_0x11f2('0x40')]({},_0x39d75c,_0x23910e[_0x11f2('0x42')]);return db['ZendeskConfiguration'][_0x11f2('0x49')](_0x39d75c)[_0x11f2('0x24')](handleEntityNotFound(_0x23490e,null))[_0x11f2('0x24')](respondWithResult(_0x23490e,null))[_0x11f2('0x46')](handleError(_0x23490e,null));};exports[_0x11f2('0x4a')]=function(_0xae0bae,_0x469410){return db[_0x11f2('0x2c')][_0x11f2('0x4a')](_0xae0bae[_0x11f2('0x4b')],{})[_0x11f2('0x24')](respondWithResult(_0x469410,0xc9))['catch'](handleError(_0x469410,null));};exports['update']=function(_0x52fbe3,_0x4fdc85){if(_0x52fbe3[_0x11f2('0x4b')]['id']){delete _0x52fbe3['body']['id'];}return db['ZendeskConfiguration'][_0x11f2('0x49')]({'where':{'id':_0x52fbe3[_0x11f2('0x48')]['id']}})[_0x11f2('0x24')](handleEntityNotFound(_0x4fdc85,null))[_0x11f2('0x24')](saveUpdates(_0x52fbe3[_0x11f2('0x4b')],null))[_0x11f2('0x24')](respondWithResult(_0x4fdc85,null))['catch'](handleError(_0x4fdc85,null));};exports[_0x11f2('0x25')]=function(_0x41dbaa,_0x28ccd0){return db[_0x11f2('0x2c')][_0x11f2('0x49')]({'where':{'id':_0x41dbaa[_0x11f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x28ccd0,null))[_0x11f2('0x24')](removeEntity(_0x28ccd0,null))[_0x11f2('0x46')](handleError(_0x28ccd0,null));};exports[_0x11f2('0x4c')]=function(_0x59247e,_0x5a4937,_0x262caa){var _0x25551e={};var _0x6982d4={};var _0x278965;var _0xec0c14;return db[_0x11f2('0x2c')][_0x11f2('0x4d')]({'where':{'id':_0x59247e[_0x11f2('0x48')]['id']}})[_0x11f2('0x24')](handleEntityNotFound(_0x5a4937,null))[_0x11f2('0x24')](function(_0x4087e6){if(_0x4087e6){_0x278965=_0x4087e6;_0x6982d4['model']=_[_0x11f2('0x32')](db['ZendeskField']['rawAttributes']);_0x6982d4[_0x11f2('0x31')]=_['keys'](_0x59247e[_0x11f2('0x31')]);_0x6982d4[_0x11f2('0x33')]=_[_0x11f2('0x34')](_0x6982d4['model'],_0x6982d4[_0x11f2('0x31')]);_0x25551e['attributes']=_['intersection'](_0x6982d4[_0x11f2('0x38')],qs[_0x11f2('0x36')](_0x59247e['query'][_0x11f2('0x36')]));_0x25551e[_0x11f2('0x35')]=_0x25551e[_0x11f2('0x35')]['length']?_0x25551e[_0x11f2('0x35')]:_0x6982d4[_0x11f2('0x38')];_0x25551e[_0x11f2('0x3b')]=qs['sort'](_0x59247e['query'][_0x11f2('0x3c')]);_0x25551e[_0x11f2('0x3d')]=qs[_0x11f2('0x33')](_[_0x11f2('0x3e')](_0x59247e[_0x11f2('0x31')],_0x6982d4[_0x11f2('0x33')]));if(_0x59247e[_0x11f2('0x31')][_0x11f2('0x3f')]){_0x25551e[_0x11f2('0x3d')]=_[_0x11f2('0x40')](_0x25551e['where'],{'$or':_[_0x11f2('0x2b')](_0x25551e[_0x11f2('0x35')],function(_0x31cdc5){var _0x1eeffe={};_0x1eeffe[_0x31cdc5]={'$like':'%'+_0x59247e[_0x11f2('0x31')][_0x11f2('0x3f')]+'%'};return _0x1eeffe;})});}_0x25551e=_[_0x11f2('0x40')]({},_0x25551e,_0x59247e['options']);return _0x278965[_0x11f2('0x4c')](_0x25551e);}})[_0x11f2('0x24')](function(_0x210135){if(_0x210135){_0xec0c14=_0x210135['length'];if(!_0x59247e['query'][_0x11f2('0x39')](_0x11f2('0x3a'))){_0x25551e[_0x11f2('0x1e')]=qs[_0x11f2('0x1e')](_0x59247e[_0x11f2('0x31')]['limit']);_0x25551e['offset']=qs['offset'](_0x59247e[_0x11f2('0x31')]['offset']);}return _0x278965[_0x11f2('0x4c')](_0x25551e);}})['then'](function(_0x515056){if(_0x515056){return _0x515056?{'count':_0xec0c14,'rows':_0x515056}:null;}})['then'](respondWithResult(_0x5a4937,null))[_0x11f2('0x46')](handleError(_0x5a4937,null));};exports['getSubjects']=function(_0x34c153,_0x5b0276,_0x416b78){var _0x414db2={};var _0x590bda={};var _0x55a9cd;var _0x440000;return db[_0x11f2('0x2c')]['findOne']({'where':{'id':_0x34c153[_0x11f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b0276,null))[_0x11f2('0x24')](function(_0x3b3bdf){if(_0x3b3bdf){_0x55a9cd=_0x3b3bdf;_0x590bda['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x590bda[_0x11f2('0x31')]=_['keys'](_0x34c153[_0x11f2('0x31')]);_0x590bda[_0x11f2('0x33')]=_[_0x11f2('0x34')](_0x590bda[_0x11f2('0x38')],_0x590bda['query']);_0x414db2[_0x11f2('0x35')]=_[_0x11f2('0x34')](_0x590bda[_0x11f2('0x38')],qs[_0x11f2('0x36')](_0x34c153['query'][_0x11f2('0x36')]));_0x414db2[_0x11f2('0x35')]=_0x414db2[_0x11f2('0x35')][_0x11f2('0x37')]?_0x414db2['attributes']:_0x590bda[_0x11f2('0x38')];_0x414db2['order']=qs[_0x11f2('0x3c')](_0x34c153[_0x11f2('0x31')][_0x11f2('0x3c')]);_0x414db2[_0x11f2('0x3d')]=qs[_0x11f2('0x33')](_[_0x11f2('0x3e')](_0x34c153[_0x11f2('0x31')],_0x590bda[_0x11f2('0x33')]));if(_0x34c153[_0x11f2('0x31')][_0x11f2('0x3f')]){_0x414db2['where']=_['merge'](_0x414db2[_0x11f2('0x3d')],{'$or':_[_0x11f2('0x2b')](_0x414db2[_0x11f2('0x35')],function(_0x19b64e){var _0x59efce={};_0x59efce[_0x19b64e]={'$like':'%'+_0x34c153[_0x11f2('0x31')][_0x11f2('0x3f')]+'%'};return _0x59efce;})});}_0x414db2=_[_0x11f2('0x40')]({},_0x414db2,_0x34c153['options']);return _0x55a9cd[_0x11f2('0x4e')](_0x414db2);}})[_0x11f2('0x24')](function(_0x2f7c30){if(_0x2f7c30){_0x440000=_0x2f7c30[_0x11f2('0x37')];if(!_0x34c153[_0x11f2('0x31')][_0x11f2('0x39')]('nolimit')){_0x414db2[_0x11f2('0x1e')]=qs['limit'](_0x34c153[_0x11f2('0x31')][_0x11f2('0x1e')]);_0x414db2[_0x11f2('0x1d')]=qs['offset'](_0x34c153[_0x11f2('0x31')][_0x11f2('0x1d')]);}return _0x55a9cd[_0x11f2('0x4e')](_0x414db2);}})[_0x11f2('0x24')](function(_0x4bcd9b){if(_0x4bcd9b){return _0x4bcd9b?{'count':_0x440000,'rows':_0x4bcd9b}:null;}})[_0x11f2('0x24')](respondWithResult(_0x5b0276,null))[_0x11f2('0x46')](handleError(_0x5b0276,null));};exports[_0x11f2('0x4f')]=function(_0x463a56,_0x7f2b37,_0x2771db){var _0x1e6686={};var _0x27c11e={};var _0x1ac914;var _0x36d9a5;return db[_0x11f2('0x2c')][_0x11f2('0x4d')]({'where':{'id':_0x463a56[_0x11f2('0x48')]['id']}})[_0x11f2('0x24')](handleEntityNotFound(_0x7f2b37,null))[_0x11f2('0x24')](function(_0x30e38f){if(_0x30e38f){_0x1ac914=_0x30e38f;_0x27c11e[_0x11f2('0x38')]=_[_0x11f2('0x32')](db[_0x11f2('0x50')][_0x11f2('0x2d')]);_0x27c11e[_0x11f2('0x31')]=_[_0x11f2('0x32')](_0x463a56[_0x11f2('0x31')]);_0x27c11e[_0x11f2('0x33')]=_[_0x11f2('0x34')](_0x27c11e[_0x11f2('0x38')],_0x27c11e[_0x11f2('0x31')]);_0x1e6686[_0x11f2('0x35')]=_[_0x11f2('0x34')](_0x27c11e[_0x11f2('0x38')],qs[_0x11f2('0x36')](_0x463a56[_0x11f2('0x31')][_0x11f2('0x36')]));_0x1e6686[_0x11f2('0x35')]=_0x1e6686[_0x11f2('0x35')]['length']?_0x1e6686[_0x11f2('0x35')]:_0x27c11e[_0x11f2('0x38')];_0x1e6686[_0x11f2('0x3b')]=qs[_0x11f2('0x3c')](_0x463a56[_0x11f2('0x31')]['sort']);_0x1e6686['where']=qs[_0x11f2('0x33')](_[_0x11f2('0x3e')](_0x463a56['query'],_0x27c11e[_0x11f2('0x33')]));if(_0x463a56[_0x11f2('0x31')]['filter']){_0x1e6686[_0x11f2('0x3d')]=_[_0x11f2('0x40')](_0x1e6686[_0x11f2('0x3d')],{'$or':_[_0x11f2('0x2b')](_0x1e6686[_0x11f2('0x35')],function(_0x303d1c){var _0x1acad7={};_0x1acad7[_0x303d1c]={'$like':'%'+_0x463a56[_0x11f2('0x31')][_0x11f2('0x3f')]+'%'};return _0x1acad7;})});}_0x1e6686=_[_0x11f2('0x40')]({},_0x1e6686,_0x463a56[_0x11f2('0x42')]);return _0x1ac914[_0x11f2('0x4f')](_0x1e6686);}})[_0x11f2('0x24')](function(_0x55f81b){if(_0x55f81b){_0x36d9a5=_0x55f81b[_0x11f2('0x37')];if(!_0x463a56['query'][_0x11f2('0x39')](_0x11f2('0x3a'))){_0x1e6686[_0x11f2('0x1e')]=qs[_0x11f2('0x1e')](_0x463a56[_0x11f2('0x31')]['limit']);_0x1e6686['offset']=qs[_0x11f2('0x1d')](_0x463a56['query'][_0x11f2('0x1d')]);}return _0x1ac914[_0x11f2('0x4f')](_0x1e6686);}})[_0x11f2('0x24')](function(_0x400fcb){if(_0x400fcb){return _0x400fcb?{'count':_0x36d9a5,'rows':_0x400fcb}:null;}})[_0x11f2('0x24')](respondWithResult(_0x7f2b37,null))['catch'](handleError(_0x7f2b37,null));};exports[_0x11f2('0x51')]=function(_0xc8b4f9,_0x1e5dbc,_0xe40c25){var _0x5a9ba3={};var _0x46901a={};var _0x346094;var _0x3968f5;return db[_0x11f2('0x2c')][_0x11f2('0x4d')]({'where':{'id':_0xc8b4f9[_0x11f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e5dbc,null))['then'](function(_0x26226a){if(_0x26226a){_0x346094=_0x26226a;_0x46901a[_0x11f2('0x38')]=_[_0x11f2('0x32')](db[_0x11f2('0x52')]['rawAttributes']);_0x46901a[_0x11f2('0x31')]=_[_0x11f2('0x32')](_0xc8b4f9['query']);_0x46901a[_0x11f2('0x33')]=_['intersection'](_0x46901a[_0x11f2('0x38')],_0x46901a[_0x11f2('0x31')]);_0x5a9ba3[_0x11f2('0x35')]=_[_0x11f2('0x34')](_0x46901a[_0x11f2('0x38')],qs[_0x11f2('0x36')](_0xc8b4f9['query'][_0x11f2('0x36')]));_0x5a9ba3[_0x11f2('0x35')]=_0x5a9ba3['attributes'][_0x11f2('0x37')]?_0x5a9ba3[_0x11f2('0x35')]:_0x46901a['model'];_0x5a9ba3[_0x11f2('0x3b')]=qs['sort'](_0xc8b4f9[_0x11f2('0x31')][_0x11f2('0x3c')]);_0x5a9ba3[_0x11f2('0x3d')]=qs[_0x11f2('0x33')](_[_0x11f2('0x3e')](_0xc8b4f9['query'],_0x46901a[_0x11f2('0x33')]));if(_0xc8b4f9[_0x11f2('0x31')][_0x11f2('0x3f')]){_0x5a9ba3[_0x11f2('0x3d')]=_[_0x11f2('0x40')](_0x5a9ba3[_0x11f2('0x3d')],{'$or':_[_0x11f2('0x2b')](_0x5a9ba3[_0x11f2('0x35')],function(_0x6597a0){var _0x187d80={};_0x187d80[_0x6597a0]={'$like':'%'+_0xc8b4f9['query'][_0x11f2('0x3f')]+'%'};return _0x187d80;})});}_0x5a9ba3=_[_0x11f2('0x40')]({},_0x5a9ba3,_0xc8b4f9[_0x11f2('0x42')]);return _0x346094[_0x11f2('0x51')](_0x5a9ba3);}})[_0x11f2('0x24')](function(_0x1d372c){if(_0x1d372c){_0x3968f5=_0x1d372c[_0x11f2('0x37')];if(!_0xc8b4f9[_0x11f2('0x31')][_0x11f2('0x39')](_0x11f2('0x3a'))){_0x5a9ba3[_0x11f2('0x1e')]=qs[_0x11f2('0x1e')](_0xc8b4f9['query'][_0x11f2('0x1e')]);_0x5a9ba3[_0x11f2('0x1d')]=qs[_0x11f2('0x1d')](_0xc8b4f9['query'][_0x11f2('0x1d')]);}return _0x346094[_0x11f2('0x51')](_0x5a9ba3);}})[_0x11f2('0x24')](function(_0x3d69e5){if(_0x3d69e5){return _0x3d69e5?{'count':_0x3968f5,'rows':_0x3d69e5}:null;}})[_0x11f2('0x24')](respondWithResult(_0x1e5dbc,null))[_0x11f2('0x46')](handleError(_0x1e5dbc,null));};exports[_0x11f2('0x53')]=function(_0x4d4344,_0x5ea44d,_0x6af911){if(_0x4d4344[_0x11f2('0x4b')]['id']){delete _0x4d4344[_0x11f2('0x4b')]['id'];}return db[_0x11f2('0x2c')][_0x11f2('0x4d')]({'where':{'id':_0x4d4344['params']['id']}})[_0x11f2('0x24')](handleEntityNotFound(_0x5ea44d,null))[_0x11f2('0x24')](function(_0x20c44a){if(_0x20c44a){return _0x20c44a[_0x11f2('0x53')](_0x4d4344[_0x11f2('0x4b')]['ids']||[]);}return null;})[_0x11f2('0x24')](respondWithResult(_0x5ea44d,null))[_0x11f2('0x46')](handleError(_0x5ea44d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b2a8866..f30ec19 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 _0x757a=['define','int_zendesk_configurations','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x3b0515,_0x1fa41d){var _0x198d7a=function(_0x17b712){while(--_0x17b712){_0x3b0515['push'](_0x3b0515['shift']());}};_0x198d7a(++_0x1fa41d);}(_0x757a,0xde));var _0xa757=function(_0x56eaba,_0x12984c){_0x56eaba=_0x56eaba-0x0;var _0x57ad29=_0x757a[_0x56eaba];return _0x57ad29;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x236c=['../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x52a568,_0xce9574){var _0x1e0628=function(_0x1767a9){while(--_0x1767a9){_0x52a568['push'](_0x52a568['shift']());}};_0x1e0628(++_0xce9574);}(_0x236c,0x155));var _0xc236=function(_0x22f23a,_0x58cf05){_0x22f23a=_0x22f23a-0x0;var _0x141dd3=_0x236c[_0x22f23a];return _0x141dd3;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var logger=require(_0xc236('0x1'))(_0xc236('0x2'));var moment=require(_0xc236('0x3'));var BPromise=require(_0xc236('0x4'));var rp=require(_0xc236('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc236('0x6'));var config=require(_0xc236('0x7'));var attributes=require(_0xc236('0x8'));module[_0xc236('0x9')]=function(_0x23d3cc,_0x461c3a){return _0x23d3cc['define'](_0xc236('0xa'),attributes,{'tableName':_0xc236('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 59d1289..ad02254 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 _0xc90c=['../../config/utils','rpc','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x234e1e,_0x531528){var _0x22a084=function(_0x5de93d){while(--_0x5de93d){_0x234e1e['push'](_0x234e1e['shift']());}};_0x22a084(++_0x531528);}(_0xc90c,0x1dd));var _0xcc90=function(_0x1e783d,_0x345972){_0x1e783d=_0x1e783d-0x0;var _0xcba6e9=_0xc90c[_0x1e783d];return _0xcba6e9;};'use strict';var _=require(_0xcc90('0x0'));var util=require(_0xcc90('0x1'));var moment=require(_0xcc90('0x2'));var BPromise=require(_0xcc90('0x3'));var rs=require(_0xcc90('0x4'));var fs=require('fs');var Redis=require(_0xcc90('0x5'));var db=require(_0xcc90('0x6'))['db'];var utils=require(_0xcc90('0x7'));var logger=require('../../config/logger')(_0xcc90('0x8'));var config=require('../../config/environment');var jayson=require(_0xcc90('0x9'));var client=jayson[_0xcc90('0xa')][_0xcc90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdfdf03,_0x19a711,_0xcbe870){return new BPromise(function(_0x2ea8a6,_0x41ba9e){return client[_0xcc90('0xc')](_0xdfdf03,_0xcbe870)[_0xcc90('0xd')](function(_0x1ea9e4){logger['info'](_0xcc90('0xe'),_0x19a711,'request\x20sent');logger['debug'](_0xcc90('0xf'),_0x19a711,_0xcc90('0x10'),JSON[_0xcc90('0x11')](_0x1ea9e4));if(_0x1ea9e4[_0xcc90('0x12')]){if(_0x1ea9e4['error']['code']===0x1f4){logger[_0xcc90('0x12')](_0xcc90('0xe'),_0x19a711,_0x1ea9e4[_0xcc90('0x12')]['message']);return _0x41ba9e(_0x1ea9e4[_0xcc90('0x12')]['message']);}logger[_0xcc90('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x19a711,_0x1ea9e4['error'][_0xcc90('0x13')]);return _0x2ea8a6(_0x1ea9e4['error'][_0xcc90('0x13')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x19a711,'request\x20sent');_0x2ea8a6(_0x1ea9e4[_0xcc90('0x14')][_0xcc90('0x13')]);}})[_0xcc90('0x15')](function(_0x194713){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x19a711,_0x194713);_0x41ba9e(_0x194713);});});} \ No newline at end of file +var _0xa53d=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x29ab8e,_0x67c0c1){var _0xc602a3=function(_0x2782b5){while(--_0x2782b5){_0x29ab8e['push'](_0x29ab8e['shift']());}};_0xc602a3(++_0x67c0c1);}(_0xa53d,0x11c));var _0xda53=function(_0x21ed53,_0x4cd380){_0x21ed53=_0x21ed53-0x0;var _0x2f17ce=_0xa53d[_0x21ed53];return _0x2f17ce;};'use strict';var _=require(_0xda53('0x0'));var util=require(_0xda53('0x1'));var moment=require(_0xda53('0x2'));var BPromise=require(_0xda53('0x3'));var rs=require(_0xda53('0x4'));var fs=require('fs');var Redis=require(_0xda53('0x5'));var db=require(_0xda53('0x6'))['db'];var utils=require(_0xda53('0x7'));var logger=require('../../config/logger')(_0xda53('0x8'));var config=require(_0xda53('0x9'));var jayson=require(_0xda53('0xa'));var client=jayson[_0xda53('0xb')][_0xda53('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x237f2a,_0x54bb80,_0x254a90){return new BPromise(function(_0x35f4f7,_0x1bbc46){return client[_0xda53('0xd')](_0x237f2a,_0x254a90)[_0xda53('0xe')](function(_0x560aec){logger['info'](_0xda53('0xf'),_0x54bb80,_0xda53('0x10'));logger[_0xda53('0x11')](_0xda53('0x12'),_0x54bb80,_0xda53('0x10'),JSON[_0xda53('0x13')](_0x560aec));if(_0x560aec[_0xda53('0x14')]){if(_0x560aec['error']['code']===0x1f4){logger[_0xda53('0x14')](_0xda53('0xf'),_0x54bb80,_0x560aec['error'][_0xda53('0x15')]);return _0x1bbc46(_0x560aec[_0xda53('0x14')][_0xda53('0x15')]);}logger[_0xda53('0x14')](_0xda53('0xf'),_0x54bb80,_0x560aec['error'][_0xda53('0x15')]);return _0x35f4f7(_0x560aec[_0xda53('0x14')][_0xda53('0x15')]);}else{logger[_0xda53('0x16')](_0xda53('0xf'),_0x54bb80,_0xda53('0x10'));_0x35f4f7(_0x560aec[_0xda53('0x17')]['message']);}})[_0xda53('0x18')](function(_0x42e968){logger['error'](_0xda53('0xf'),_0x54bb80,_0x42e968);_0x1bbc46(_0x42e968);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3b0edc7..7a5431d 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 _0xaad2=['create','put','isAuthenticated','update','destroy','exports','connect-timeout','fs-extra','../../components/interaction/service','get','index','/:id','show','post'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xaad2,0x172));var _0x2aad=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xaad2[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2aad('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2aad('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x2aad('0x2'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x2aad('0x3')]('/',auth['isAuthenticated'](),controller[_0x2aad('0x4')]);router[_0x2aad('0x3')](_0x2aad('0x5'),auth['isAuthenticated'](),controller[_0x2aad('0x6')]);router[_0x2aad('0x7')]('/',auth['isAuthenticated'](),controller[_0x2aad('0x8')]);router[_0x2aad('0x9')](_0x2aad('0x5'),auth[_0x2aad('0xa')](),controller[_0x2aad('0xb')]);router['delete']('/:id',auth[_0x2aad('0xa')](),controller[_0x2aad('0xc')]);module[_0x2aad('0xd')]=router; \ No newline at end of file +var _0x9f9c=['Router','fs-extra','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x9f9c,0xda));var _0xc9f9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9f9c[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xc9f9('0x0'));var util=require(_0xc9f9('0x1'));var path=require('path');var timeout=require(_0xc9f9('0x2'));var express=require('express');var router=express[_0xc9f9('0x3')]();var fs_extra=require(_0xc9f9('0x4'));var auth=require(_0xc9f9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc9f9('0x6'));router[_0xc9f9('0x7')]('/',auth[_0xc9f9('0x8')](),controller[_0xc9f9('0x9')]);router[_0xc9f9('0x7')](_0xc9f9('0xa'),auth[_0xc9f9('0x8')](),controller[_0xc9f9('0xb')]);router[_0xc9f9('0xc')]('/',auth[_0xc9f9('0x8')](),controller['create']);router[_0xc9f9('0xd')]('/:id',auth[_0xc9f9('0x8')](),controller[_0xc9f9('0xe')]);router['delete'](_0xc9f9('0xa'),auth[_0xc9f9('0x8')](),controller[_0xc9f9('0xf')]);module[_0xc9f9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 85d1e4d..eac5ee2 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 _0xf5d6=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xf5d6,0x168));var _0x6f5d=function(_0x536086,_0x2c7bf4){_0x536086=_0x536086-0x0;var _0x1cd7bc=_0xf5d6[_0x536086];return _0x1cd7bc;};'use strict';var Sequelize=require(_0x6f5d('0x0'));module[_0x6f5d('0x1')]={'type':{'type':Sequelize[_0x6f5d('0x2')](_0x6f5d('0x3'),_0x6f5d('0x4'),'customVariable',_0x6f5d('0x5'),_0x6f5d('0x6')),'defaultValue':_0x6f5d('0x3')},'content':{'type':Sequelize[_0x6f5d('0x7')]},'key':{'type':Sequelize[_0x6f5d('0x7')]},'keyType':{'type':Sequelize[_0x6f5d('0x2')](_0x6f5d('0x3'),_0x6f5d('0x4'),_0x6f5d('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6f5d('0x7')]},'nameField':{'type':Sequelize[_0x6f5d('0x7')]},'customField':{'type':Sequelize[_0x6f5d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9150=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x9150,0xd7));var _0x0915=function(_0x59088d,_0x5a3d50){_0x59088d=_0x59088d-0x0;var _0x1d2d22=_0x9150[_0x59088d];return _0x1d2d22;};'use strict';var Sequelize=require(_0x0915('0x0'));module[_0x0915('0x1')]={'type':{'type':Sequelize[_0x0915('0x2')]('string',_0x0915('0x3'),_0x0915('0x4'),_0x0915('0x5'),'picklist'),'defaultValue':_0x0915('0x6')},'content':{'type':Sequelize[_0x0915('0x7')]},'key':{'type':Sequelize[_0x0915('0x7')]},'keyType':{'type':Sequelize[_0x0915('0x2')](_0x0915('0x6'),_0x0915('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0915('0x7')]},'idField':{'type':Sequelize[_0x0915('0x7')]},'nameField':{'type':Sequelize[_0x0915('0x7')]},'customField':{'type':Sequelize[_0x0915('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0915('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index cf5a4b8..2d8820a 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 _0x684d=['to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','apply','save','update','then','destroy','stack','name','send','index','ZendeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x17676d,_0x455155){var _0x29bd4a=function(_0x18b58c){while(--_0x18b58c){_0x17676d['push'](_0x17676d['shift']());}};_0x29bd4a(++_0x455155);}(_0x684d,0xcf));var _0xd684=function(_0x3f0a3f,_0x360939){_0x3f0a3f=_0x3f0a3f-0x0;var _0x3197c3=_0x684d[_0x3f0a3f];return _0x3197c3;};'use strict';var emlformat=require(_0xd684('0x0'));var rimraf=require(_0xd684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd684('0x2'));var rp=require(_0xd684('0x3'));var moment=require('moment');var BPromise=require(_0xd684('0x4'));var Mustache=require(_0xd684('0x5'));var util=require(_0xd684('0x6'));var path=require(_0xd684('0x7'));var sox=require(_0xd684('0x8'));var csv=require(_0xd684('0x9'));var ejs=require(_0xd684('0xa'));var fs=require('fs');var fs_extra=require(_0xd684('0xb'));var _=require(_0xd684('0xc'));var squel=require(_0xd684('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd684('0x9'));var querystring=require(_0xd684('0xe'));var Papa=require(_0xd684('0xf'));var Redis=require(_0xd684('0x10'));var authService=require(_0xd684('0x11'));var qs=require(_0xd684('0x12'));var as=require(_0xd684('0x13'));var hardwareService=require(_0xd684('0x14'));var logger=require(_0xd684('0x15'))('api');var utils=require(_0xd684('0x16'));var config=require(_0xd684('0x17'));var licenseUtil=require(_0xd684('0x18'));var db=require(_0xd684('0x19'))['db'];function respondWithStatusCode(_0x15003f,_0x2d0381){_0x2d0381=_0x2d0381||0xcc;return function(_0x413fbd){if(_0x413fbd){return _0x15003f[_0xd684('0x1a')](_0x2d0381);}return _0x15003f[_0xd684('0x1b')](_0x2d0381)[_0xd684('0x1c')]();};}function respondWithResult(_0x1b5ea8,_0x3424e6){_0x3424e6=_0x3424e6||0xc8;return function(_0x25aebc){if(_0x25aebc){return _0x1b5ea8[_0xd684('0x1b')](_0x3424e6)['json'](_0x25aebc);}};}function respondWithFilteredResult(_0x5b6adb,_0x60712){return function(_0x2e0af2){if(_0x2e0af2){var _0x8f4b02=typeof _0x60712['offset']===_0xd684('0x1d')&&typeof _0x60712['limit']==='undefined';var _0x4d34ee=_0x2e0af2[_0xd684('0x1e')];var _0x3529e3=_0x8f4b02?0x0:_0x60712[_0xd684('0x1f')];var _0xf5e24d=_0x8f4b02?_0x2e0af2[_0xd684('0x1e')]:_0x60712[_0xd684('0x1f')]+_0x60712['limit'];var _0x570b57;if(_0xf5e24d>=_0x4d34ee){_0xf5e24d=_0x4d34ee;_0x570b57=0xc8;}else{_0x570b57=0xce;}_0x5b6adb[_0xd684('0x1b')](_0x570b57);return _0x5b6adb['set']('Content-Range',_0x3529e3+'-'+_0xf5e24d+'/'+_0x4d34ee)['json'](_0x2e0af2);}return null;};}function patchUpdates(_0x3ea672){return function(_0x5063e7){try{jsonpatch[_0xd684('0x20')](_0x5063e7,_0x3ea672,!![]);}catch(_0xafa680){return BPromise['reject'](_0xafa680);}return _0x5063e7[_0xd684('0x21')]();};}function saveUpdates(_0x53a5ba,_0x1288c0){return function(_0x2890ad){if(_0x2890ad){return _0x2890ad[_0xd684('0x22')](_0x53a5ba)[_0xd684('0x23')](function(_0x52c270){return _0x52c270;});}return null;};}function removeEntity(_0x3a5deb,_0x1288c1){return function(_0x3780d7){if(_0x3780d7){return _0x3780d7[_0xd684('0x24')]()[_0xd684('0x23')](function(){_0x3a5deb[_0xd684('0x1b')](0xcc)[_0xd684('0x1c')]();});}};}function handleEntityNotFound(_0x40578c,_0x304eb4){return function(_0x32b082){if(!_0x32b082){_0x40578c[_0xd684('0x1a')](0x194);}return _0x32b082;};}function handleError(_0x53ede2,_0x169195){_0x169195=_0x169195||0x1f4;return function(_0x2a0840){logger['error'](_0x2a0840[_0xd684('0x25')]);if(_0x2a0840[_0xd684('0x26')]){delete _0x2a0840[_0xd684('0x26')];}_0x53ede2[_0xd684('0x1b')](_0x169195)[_0xd684('0x27')](_0x2a0840);};}exports[_0xd684('0x28')]=function(_0x1907c0,_0x586c1c){var _0xbcaee3={},_0x24d573={},_0x5c4a87={'count':0x0,'rows':[]};var _0x4a0e0e=_['map'](db[_0xd684('0x29')][_0xd684('0x2a')],function(_0x32a2e4){return{'name':_0x32a2e4['fieldName'],'type':_0x32a2e4[_0xd684('0x2b')][_0xd684('0x2c')]};});_0x24d573[_0xd684('0x2d')]=_[_0xd684('0x2e')](_0x4a0e0e,'name');_0x24d573[_0xd684('0x2f')]=_[_0xd684('0x30')](_0x1907c0[_0xd684('0x2f')]);_0x24d573[_0xd684('0x31')]=_[_0xd684('0x32')](_0x24d573[_0xd684('0x2d')],_0x24d573[_0xd684('0x2f')]);_0xbcaee3['attributes']=_['intersection'](_0x24d573[_0xd684('0x2d')],qs[_0xd684('0x33')](_0x1907c0['query'][_0xd684('0x33')]));_0xbcaee3['attributes']=_0xbcaee3['attributes']['length']?_0xbcaee3[_0xd684('0x34')]:_0x24d573['model'];if(!_0x1907c0['query'][_0xd684('0x35')](_0xd684('0x36'))){_0xbcaee3[_0xd684('0x37')]=qs[_0xd684('0x37')](_0x1907c0['query'][_0xd684('0x37')]);_0xbcaee3[_0xd684('0x1f')]=qs['offset'](_0x1907c0['query'][_0xd684('0x1f')]);}_0xbcaee3['order']=qs[_0xd684('0x38')](_0x1907c0[_0xd684('0x2f')][_0xd684('0x38')]);_0xbcaee3[_0xd684('0x39')]=qs[_0xd684('0x31')](_[_0xd684('0x3a')](_0x1907c0[_0xd684('0x2f')],_0x24d573[_0xd684('0x31')]),_0x4a0e0e);if(_0x1907c0['query'][_0xd684('0x3b')]){_0xbcaee3[_0xd684('0x39')]=_[_0xd684('0x3c')](_0xbcaee3[_0xd684('0x39')],{'$or':_['map'](_0x4a0e0e,function(_0x382684){if(_0x382684[_0xd684('0x2b')]!=='VIRTUAL'){var _0x203e76={};_0x203e76[_0x382684[_0xd684('0x26')]]={'$like':'%'+_0x1907c0[_0xd684('0x2f')]['filter']+'%'};return _0x203e76;}})});}_0xbcaee3=_[_0xd684('0x3c')]({},_0xbcaee3,_0x1907c0[_0xd684('0x3d')]);var _0x253c6d={'where':_0xbcaee3[_0xd684('0x39')]};return db[_0xd684('0x29')][_0xd684('0x1e')](_0x253c6d)['then'](function(_0x137130){_0x5c4a87['count']=_0x137130;if(_0x1907c0[_0xd684('0x2f')][_0xd684('0x3e')]){_0xbcaee3[_0xd684('0x3f')]=[{'all':!![]}];}return db[_0xd684('0x29')][_0xd684('0x40')](_0xbcaee3);})[_0xd684('0x23')](function(_0x24de5a){_0x5c4a87[_0xd684('0x41')]=_0x24de5a;return _0x5c4a87;})[_0xd684('0x23')](respondWithFilteredResult(_0x586c1c,_0xbcaee3))[_0xd684('0x42')](handleError(_0x586c1c,null));};exports[_0xd684('0x43')]=function(_0x274dd8,_0x1dab8e){var _0x5ad59c={'raw':!![],'where':{'id':_0x274dd8[_0xd684('0x44')]['id']}},_0x28d134={};_0x28d134[_0xd684('0x2d')]=_[_0xd684('0x30')](db[_0xd684('0x29')][_0xd684('0x2a')]);_0x28d134[_0xd684('0x2f')]=_[_0xd684('0x30')](_0x274dd8['query']);_0x28d134[_0xd684('0x31')]=_[_0xd684('0x32')](_0x28d134[_0xd684('0x2d')],_0x28d134[_0xd684('0x2f')]);_0x5ad59c[_0xd684('0x34')]=_[_0xd684('0x32')](_0x28d134[_0xd684('0x2d')],qs[_0xd684('0x33')](_0x274dd8[_0xd684('0x2f')][_0xd684('0x33')]));_0x5ad59c[_0xd684('0x34')]=_0x5ad59c[_0xd684('0x34')]['length']?_0x5ad59c[_0xd684('0x34')]:_0x28d134[_0xd684('0x2d')];if(_0x274dd8[_0xd684('0x2f')][_0xd684('0x3e')]){_0x5ad59c[_0xd684('0x3f')]=[{'all':!![]}];}_0x5ad59c=_[_0xd684('0x3c')]({},_0x5ad59c,_0x274dd8[_0xd684('0x3d')]);return db['ZendeskField'][_0xd684('0x45')](_0x5ad59c)['then'](handleEntityNotFound(_0x1dab8e,null))[_0xd684('0x23')](respondWithResult(_0x1dab8e,null))[_0xd684('0x42')](handleError(_0x1dab8e,null));};exports[_0xd684('0x46')]=function(_0x19f14a,_0x2abc4c){return db[_0xd684('0x29')][_0xd684('0x46')](_0x19f14a[_0xd684('0x47')],{})['then'](respondWithResult(_0x2abc4c,0xc9))['catch'](handleError(_0x2abc4c,null));};exports[_0xd684('0x22')]=function(_0x4dbb7e,_0x52e09b){if(_0x4dbb7e[_0xd684('0x47')]['id']){delete _0x4dbb7e[_0xd684('0x47')]['id'];}return db['ZendeskField'][_0xd684('0x45')]({'where':{'id':_0x4dbb7e['params']['id']}})[_0xd684('0x23')](handleEntityNotFound(_0x52e09b,null))[_0xd684('0x23')](saveUpdates(_0x4dbb7e[_0xd684('0x47')],null))[_0xd684('0x23')](respondWithResult(_0x52e09b,null))[_0xd684('0x42')](handleError(_0x52e09b,null));};exports[_0xd684('0x24')]=function(_0x465e30,_0x256e82){return db[_0xd684('0x29')][_0xd684('0x45')]({'where':{'id':_0x465e30['params']['id']}})[_0xd684('0x23')](handleEntityNotFound(_0x256e82,null))['then'](removeEntity(_0x256e82,null))['catch'](handleError(_0x256e82,null));}; \ No newline at end of file +var _0x9e0d=['options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','intersection'];(function(_0x309f5a,_0x30b85d){var _0x4276ec=function(_0x25860e){while(--_0x25860e){_0x309f5a['push'](_0x309f5a['shift']());}};_0x4276ec(++_0x30b85d);}(_0x9e0d,0x9b));var _0xd9e0=function(_0x5b8f70,_0x369d39){_0x5b8f70=_0x5b8f70-0x0;var _0x24c06c=_0x9e0d[_0x5b8f70];return _0x24c06c;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require(_0xd9e0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9e0('0x5'));var util=require(_0xd9e0('0x6'));var path=require(_0xd9e0('0x7'));var sox=require(_0xd9e0('0x8'));var csv=require('to-csv');var ejs=require(_0xd9e0('0x9'));var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd9e0('0xf'));var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9e0('0x13'));var logger=require(_0xd9e0('0x14'))(_0xd9e0('0x15'));var utils=require(_0xd9e0('0x16'));var config=require(_0xd9e0('0x17'));var licenseUtil=require(_0xd9e0('0x18'));var db=require(_0xd9e0('0x19'))['db'];function respondWithStatusCode(_0x5607ed,_0x1c9fc5){_0x1c9fc5=_0x1c9fc5||0xcc;return function(_0x1123f0){if(_0x1123f0){return _0x5607ed[_0xd9e0('0x1a')](_0x1c9fc5);}return _0x5607ed[_0xd9e0('0x1b')](_0x1c9fc5)['end']();};}function respondWithResult(_0x1a46ac,_0x310b9b){_0x310b9b=_0x310b9b||0xc8;return function(_0x39b339){if(_0x39b339){return _0x1a46ac['status'](_0x310b9b)[_0xd9e0('0x1c')](_0x39b339);}};}function respondWithFilteredResult(_0x32c7c7,_0x10742a){return function(_0x32e70f){if(_0x32e70f){var _0x419f18=typeof _0x10742a['offset']===_0xd9e0('0x1d')&&typeof _0x10742a[_0xd9e0('0x1e')]===_0xd9e0('0x1d');var _0x53131e=_0x32e70f[_0xd9e0('0x1f')];var _0x4403e4=_0x419f18?0x0:_0x10742a[_0xd9e0('0x20')];var _0x5b0d93=_0x419f18?_0x32e70f[_0xd9e0('0x1f')]:_0x10742a[_0xd9e0('0x20')]+_0x10742a[_0xd9e0('0x1e')];var _0x510d7c;if(_0x5b0d93>=_0x53131e){_0x5b0d93=_0x53131e;_0x510d7c=0xc8;}else{_0x510d7c=0xce;}_0x32c7c7[_0xd9e0('0x1b')](_0x510d7c);return _0x32c7c7[_0xd9e0('0x21')](_0xd9e0('0x22'),_0x4403e4+'-'+_0x5b0d93+'/'+_0x53131e)['json'](_0x32e70f);}return null;};}function patchUpdates(_0x3748f8){return function(_0x546158){try{jsonpatch[_0xd9e0('0x23')](_0x546158,_0x3748f8,!![]);}catch(_0x31686d){return BPromise[_0xd9e0('0x24')](_0x31686d);}return _0x546158[_0xd9e0('0x25')]();};}function saveUpdates(_0x18c8c6,_0x5962ba){return function(_0x903986){if(_0x903986){return _0x903986[_0xd9e0('0x26')](_0x18c8c6)[_0xd9e0('0x27')](function(_0x1fa129){return _0x1fa129;});}return null;};}function removeEntity(_0x140304,_0x97ed73){return function(_0x424eaa){if(_0x424eaa){return _0x424eaa[_0xd9e0('0x28')]()[_0xd9e0('0x27')](function(){_0x140304[_0xd9e0('0x1b')](0xcc)[_0xd9e0('0x29')]();});}};}function handleEntityNotFound(_0x340b30,_0x20d4a8){return function(_0x142f2b){if(!_0x142f2b){_0x340b30[_0xd9e0('0x1a')](0x194);}return _0x142f2b;};}function handleError(_0x131f29,_0x1741a5){_0x1741a5=_0x1741a5||0x1f4;return function(_0x43314f){logger['error'](_0x43314f[_0xd9e0('0x2a')]);if(_0x43314f['name']){delete _0x43314f[_0xd9e0('0x2b')];}_0x131f29[_0xd9e0('0x1b')](_0x1741a5)[_0xd9e0('0x2c')](_0x43314f);};}exports[_0xd9e0('0x2d')]=function(_0x5ec31d,_0x2a1948){var _0x5b69b7={},_0x27bbd1={},_0x2152de={'count':0x0,'rows':[]};var _0x360e81=_[_0xd9e0('0x2e')](db[_0xd9e0('0x2f')][_0xd9e0('0x30')],function(_0x31a76d){return{'name':_0x31a76d[_0xd9e0('0x31')],'type':_0x31a76d[_0xd9e0('0x32')][_0xd9e0('0x33')]};});_0x27bbd1['model']=_[_0xd9e0('0x2e')](_0x360e81,'name');_0x27bbd1[_0xd9e0('0x34')]=_[_0xd9e0('0x35')](_0x5ec31d[_0xd9e0('0x34')]);_0x27bbd1[_0xd9e0('0x36')]=_['intersection'](_0x27bbd1['model'],_0x27bbd1['query']);_0x5b69b7[_0xd9e0('0x37')]=_['intersection'](_0x27bbd1['model'],qs[_0xd9e0('0x38')](_0x5ec31d[_0xd9e0('0x34')][_0xd9e0('0x38')]));_0x5b69b7['attributes']=_0x5b69b7[_0xd9e0('0x37')][_0xd9e0('0x39')]?_0x5b69b7[_0xd9e0('0x37')]:_0x27bbd1[_0xd9e0('0x3a')];if(!_0x5ec31d[_0xd9e0('0x34')][_0xd9e0('0x3b')](_0xd9e0('0x3c'))){_0x5b69b7[_0xd9e0('0x1e')]=qs[_0xd9e0('0x1e')](_0x5ec31d[_0xd9e0('0x34')][_0xd9e0('0x1e')]);_0x5b69b7[_0xd9e0('0x20')]=qs['offset'](_0x5ec31d[_0xd9e0('0x34')][_0xd9e0('0x20')]);}_0x5b69b7['order']=qs['sort'](_0x5ec31d[_0xd9e0('0x34')]['sort']);_0x5b69b7[_0xd9e0('0x3d')]=qs[_0xd9e0('0x36')](_[_0xd9e0('0x3e')](_0x5ec31d['query'],_0x27bbd1[_0xd9e0('0x36')]),_0x360e81);if(_0x5ec31d['query'][_0xd9e0('0x3f')]){_0x5b69b7['where']=_[_0xd9e0('0x40')](_0x5b69b7[_0xd9e0('0x3d')],{'$or':_[_0xd9e0('0x2e')](_0x360e81,function(_0x326781){if(_0x326781[_0xd9e0('0x32')]!==_0xd9e0('0x41')){var _0x35980d={};_0x35980d[_0x326781[_0xd9e0('0x2b')]]={'$like':'%'+_0x5ec31d['query'][_0xd9e0('0x3f')]+'%'};return _0x35980d;}})});}_0x5b69b7=_['merge']({},_0x5b69b7,_0x5ec31d['options']);var _0x353814={'where':_0x5b69b7[_0xd9e0('0x3d')]};return db['ZendeskField'][_0xd9e0('0x1f')](_0x353814)[_0xd9e0('0x27')](function(_0x4c3090){_0x2152de[_0xd9e0('0x1f')]=_0x4c3090;if(_0x5ec31d[_0xd9e0('0x34')][_0xd9e0('0x42')]){_0x5b69b7[_0xd9e0('0x43')]=[{'all':!![]}];}return db[_0xd9e0('0x2f')]['findAll'](_0x5b69b7);})['then'](function(_0x5c7222){_0x2152de[_0xd9e0('0x44')]=_0x5c7222;return _0x2152de;})[_0xd9e0('0x27')](respondWithFilteredResult(_0x2a1948,_0x5b69b7))[_0xd9e0('0x45')](handleError(_0x2a1948,null));};exports[_0xd9e0('0x46')]=function(_0x686e32,_0x194c32){var _0x4e38ac={'raw':!![],'where':{'id':_0x686e32[_0xd9e0('0x47')]['id']}},_0x460e82={};_0x460e82['model']=_[_0xd9e0('0x35')](db['ZendeskField']['rawAttributes']);_0x460e82[_0xd9e0('0x34')]=_[_0xd9e0('0x35')](_0x686e32[_0xd9e0('0x34')]);_0x460e82[_0xd9e0('0x36')]=_[_0xd9e0('0x48')](_0x460e82[_0xd9e0('0x3a')],_0x460e82[_0xd9e0('0x34')]);_0x4e38ac[_0xd9e0('0x37')]=_[_0xd9e0('0x48')](_0x460e82[_0xd9e0('0x3a')],qs[_0xd9e0('0x38')](_0x686e32[_0xd9e0('0x34')][_0xd9e0('0x38')]));_0x4e38ac[_0xd9e0('0x37')]=_0x4e38ac[_0xd9e0('0x37')][_0xd9e0('0x39')]?_0x4e38ac[_0xd9e0('0x37')]:_0x460e82[_0xd9e0('0x3a')];if(_0x686e32[_0xd9e0('0x34')][_0xd9e0('0x42')]){_0x4e38ac['include']=[{'all':!![]}];}_0x4e38ac=_[_0xd9e0('0x40')]({},_0x4e38ac,_0x686e32[_0xd9e0('0x49')]);return db[_0xd9e0('0x2f')][_0xd9e0('0x4a')](_0x4e38ac)[_0xd9e0('0x27')](handleEntityNotFound(_0x194c32,null))[_0xd9e0('0x27')](respondWithResult(_0x194c32,null))['catch'](handleError(_0x194c32,null));};exports['create']=function(_0x43d224,_0x3ca1cb){return db[_0xd9e0('0x2f')]['create'](_0x43d224[_0xd9e0('0x4b')],{})[_0xd9e0('0x27')](respondWithResult(_0x3ca1cb,0xc9))['catch'](handleError(_0x3ca1cb,null));};exports[_0xd9e0('0x26')]=function(_0x31d196,_0x131f6b){if(_0x31d196[_0xd9e0('0x4b')]['id']){delete _0x31d196[_0xd9e0('0x4b')]['id'];}return db[_0xd9e0('0x2f')][_0xd9e0('0x4a')]({'where':{'id':_0x31d196['params']['id']}})['then'](handleEntityNotFound(_0x131f6b,null))['then'](saveUpdates(_0x31d196[_0xd9e0('0x4b')],null))[_0xd9e0('0x27')](respondWithResult(_0x131f6b,null))['catch'](handleError(_0x131f6b,null));};exports[_0xd9e0('0x28')]=function(_0x2d3682,_0x59441e){return db['ZendeskField']['find']({'where':{'id':_0x2d3682[_0xd9e0('0x47')]['id']}})[_0xd9e0('0x27')](handleEntityNotFound(_0x59441e,null))['then'](removeEntity(_0x59441e,null))[_0xd9e0('0x45')](handleError(_0x59441e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 90e9607..6b0a4f2 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 _0x919a=['bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','FieldId','lodash','util','../../config/logger'];(function(_0x427a15,_0x3ca611){var _0x246275=function(_0x141d5e){while(--_0x141d5e){_0x427a15['push'](_0x427a15['shift']());}};_0x246275(++_0x3ca611);}(_0x919a,0xbd));var _0xa919=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x919a[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xa919('0x0'));var util=require(_0xa919('0x1'));var logger=require(_0xa919('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa919('0x3'));var rp=require(_0xa919('0x4'));var fs=require('fs');var path=require(_0xa919('0x5'));var rimraf=require('rimraf');var config=require(_0xa919('0x6'));var attributes=require(_0xa919('0x7'));module[_0xa919('0x8')]=function(_0x5569eb,_0xaa3123){return _0x5569eb[_0xa919('0x9')]('ZendeskField',attributes,{'tableName':_0xa919('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xa919('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafe7=['path','rimraf','../../config/environment','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xafe7,0x9f));var _0x7afe=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xafe7[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x7afe('0x0'));var util=require('util');var logger=require(_0x7afe('0x1'))(_0x7afe('0x2'));var moment=require(_0x7afe('0x3'));var BPromise=require(_0x7afe('0x4'));var rp=require(_0x7afe('0x5'));var fs=require('fs');var path=require(_0x7afe('0x6'));var rimraf=require(_0x7afe('0x7'));var config=require(_0x7afe('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x7afe('0x9')]=function(_0x30047e,_0x2fd125){return _0x30047e[_0x7afe('0xa')]('ZendeskField',attributes,{'tableName':_0x7afe('0xb'),'paranoid':![],'indexes':[{'name':_0x7afe('0xc'),'fields':[_0x7afe('0xd'),_0x7afe('0xe')],'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 be80bc3..eeabc0a 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 _0x88c4=['client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x88c4,0x139));var _0x488c=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x88c4[_0x384231];return _0x2480bf;};'use strict';var _=require(_0x488c('0x0'));var util=require(_0x488c('0x1'));var moment=require(_0x488c('0x2'));var BPromise=require(_0x488c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x488c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x488c('0x5'));var logger=require('../../config/logger')(_0x488c('0x6'));var config=require(_0x488c('0x7'));var jayson=require(_0x488c('0x8'));var client=jayson[_0x488c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x176c9a,_0x58b1d5,_0x1c8dfc){return new BPromise(function(_0x4b07f3,_0x10be0e){return client[_0x488c('0xa')](_0x176c9a,_0x1c8dfc)[_0x488c('0xb')](function(_0x3ef1da){logger[_0x488c('0xc')](_0x488c('0xd'),_0x58b1d5,_0x488c('0xe'));logger[_0x488c('0xf')](_0x488c('0x10'),_0x58b1d5,'request\x20sent',JSON[_0x488c('0x11')](_0x3ef1da));if(_0x3ef1da['error']){if(_0x3ef1da[_0x488c('0x12')][_0x488c('0x13')]===0x1f4){logger[_0x488c('0x12')]('ZendeskField,\x20%s,\x20%s',_0x58b1d5,_0x3ef1da['error'][_0x488c('0x14')]);return _0x10be0e(_0x3ef1da[_0x488c('0x12')][_0x488c('0x14')]);}logger[_0x488c('0x12')]('ZendeskField,\x20%s,\x20%s',_0x58b1d5,_0x3ef1da[_0x488c('0x12')][_0x488c('0x14')]);return _0x4b07f3(_0x3ef1da[_0x488c('0x12')]['message']);}else{logger[_0x488c('0xc')]('ZendeskField,\x20%s,\x20%s',_0x58b1d5,'request\x20sent');_0x4b07f3(_0x3ef1da[_0x488c('0x15')]['message']);}})[_0x488c('0x16')](function(_0x73c6ad){logger['error'](_0x488c('0xd'),_0x58b1d5,_0x73c6ad);_0x10be0e(_0x73c6ad);});});} \ No newline at end of file +var _0x8dc5=['jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2378ef,_0x1b182e){var _0x9dc6fb=function(_0x4ce9e0){while(--_0x4ce9e0){_0x2378ef['push'](_0x2378ef['shift']());}};_0x9dc6fb(++_0x1b182e);}(_0x8dc5,0xeb));var _0x58dc=function(_0x5046cf,_0x44c493){_0x5046cf=_0x5046cf-0x0;var _0x2fb819=_0x8dc5[_0x5046cf];return _0x2fb819;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58dc('0x0'));var BPromise=require(_0x58dc('0x1'));var rs=require(_0x58dc('0x2'));var fs=require('fs');var Redis=require(_0x58dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x58dc('0x4'));var logger=require(_0x58dc('0x5'))(_0x58dc('0x6'));var config=require('../../config/environment');var jayson=require(_0x58dc('0x7'));var client=jayson[_0x58dc('0x8')][_0x58dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x331066,_0x509ae1,_0x812179){return new BPromise(function(_0x1e28cf,_0x3a2e03){return client[_0x58dc('0xa')](_0x331066,_0x812179)['then'](function(_0x50ccdf){logger[_0x58dc('0xb')](_0x58dc('0xc'),_0x509ae1,'request\x20sent');logger[_0x58dc('0xd')](_0x58dc('0xe'),_0x509ae1,'request\x20sent',JSON[_0x58dc('0xf')](_0x50ccdf));if(_0x50ccdf[_0x58dc('0x10')]){if(_0x50ccdf[_0x58dc('0x10')][_0x58dc('0x11')]===0x1f4){logger[_0x58dc('0x10')](_0x58dc('0xc'),_0x509ae1,_0x50ccdf[_0x58dc('0x10')][_0x58dc('0x12')]);return _0x3a2e03(_0x50ccdf[_0x58dc('0x10')][_0x58dc('0x12')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x509ae1,_0x50ccdf[_0x58dc('0x10')]['message']);return _0x1e28cf(_0x50ccdf[_0x58dc('0x10')][_0x58dc('0x12')]);}else{logger['info'](_0x58dc('0xc'),_0x509ae1,_0x58dc('0x13'));_0x1e28cf(_0x50ccdf[_0x58dc('0x14')][_0x58dc('0x12')]);}})[_0x58dc('0x15')](function(_0x1ad13d){logger[_0x58dc('0x10')](_0x58dc('0xc'),_0x509ae1,_0x1ad13d);_0x3a2e03(_0x1ad13d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6079be3..f9e861a 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 _0x38c7=['addConfiguration','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x54e9cd,_0x16ae73){var _0x343ae7=function(_0x4a9ea4){while(--_0x4a9ea4){_0x54e9cd['push'](_0x54e9cd['shift']());}};_0x343ae7(++_0x16ae73);}(_0x38c7,0x68));var _0x738c=function(_0x9f6171,_0x7bb0a5){_0x9f6171=_0x9f6171-0x0;var _0x4c3f71=_0x38c7[_0x9f6171];return _0x4c3f71;};'use strict';var multer=require(_0x738c('0x0'));var util=require('util');var path=require(_0x738c('0x1'));var timeout=require(_0x738c('0x2'));var express=require(_0x738c('0x3'));var router=express['Router']();var fs_extra=require(_0x738c('0x4'));var auth=require(_0x738c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x738c('0x6')](),controller['index']);router[_0x738c('0x7')](_0x738c('0x8'),auth[_0x738c('0x6')](),controller[_0x738c('0x9')]);router[_0x738c('0x7')](_0x738c('0xa'),auth[_0x738c('0x6')](),controller[_0x738c('0xb')]);router[_0x738c('0x7')](_0x738c('0xc'),auth[_0x738c('0x6')](),controller[_0x738c('0xd')]);router[_0x738c('0xe')]('/',auth[_0x738c('0x6')](),controller[_0x738c('0xf')]);router[_0x738c('0xe')](_0x738c('0xa'),auth[_0x738c('0x6')](),controller[_0x738c('0x10')]);router[_0x738c('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x738c('0x12')](_0x738c('0x8'),auth[_0x738c('0x6')](),controller[_0x738c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7d94=['addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0x7d94,0x164));var _0x47d9=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7d94[_0x4c445a];return _0x2f611c;};'use strict';var multer=require('multer');var util=require(_0x47d9('0x0'));var path=require(_0x47d9('0x1'));var timeout=require(_0x47d9('0x2'));var express=require(_0x47d9('0x3'));var router=express['Router']();var fs_extra=require(_0x47d9('0x4'));var auth=require(_0x47d9('0x5'));var interaction=require(_0x47d9('0x6'));var config=require(_0x47d9('0x7'));var controller=require(_0x47d9('0x8'));router[_0x47d9('0x9')]('/',auth[_0x47d9('0xa')](),controller['index']);router[_0x47d9('0x9')](_0x47d9('0xb'),auth['isAuthenticated'](),controller[_0x47d9('0xc')]);router[_0x47d9('0x9')](_0x47d9('0xd'),auth['isAuthenticated'](),controller[_0x47d9('0xe')]);router[_0x47d9('0x9')](_0x47d9('0xf'),auth[_0x47d9('0xa')](),controller[_0x47d9('0x10')]);router[_0x47d9('0x11')]('/',auth[_0x47d9('0xa')](),controller[_0x47d9('0x12')]);router[_0x47d9('0x11')]('/:id/configurations',auth[_0x47d9('0xa')](),controller[_0x47d9('0x13')]);router[_0x47d9('0x14')](_0x47d9('0xb'),auth[_0x47d9('0xa')](),controller[_0x47d9('0x15')]);router[_0x47d9('0x16')](_0x47d9('0xb'),auth[_0x47d9('0xa')](),controller[_0x47d9('0x17')]);module[_0x47d9('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 171d246..44f3be4 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 _0x668b=['exports','STRING','sequelize'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x668b,0x140));var _0xb668=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x668b[_0x1f44e4];return _0x591989;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file +var _0xf4eb=['sequelize','STRING'];(function(_0xe34284,_0x4291b5){var _0x41c8a8=function(_0x5181dc){while(--_0x5181dc){_0xe34284['push'](_0xe34284['shift']());}};_0x41c8a8(++_0x4291b5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x596bd8,_0x144edc){_0x596bd8=_0x596bd8-0x0;var _0x5cf6a7=_0xf4eb[_0x596bd8];return _0x5cf6a7;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbf4e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf4e('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xbf4e('0x1')]},'refreshToken':{'type':Sequelize[_0xbf4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bb71677..98c0d49 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 _0x332d=['destroy','error','name','index','map','ZohoAccount','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0x22cd0c,_0x4040b6){var _0x439eba=function(_0x43c4a0){while(--_0x43c4a0){_0x22cd0c['push'](_0x22cd0c['shift']());}};_0x439eba(++_0x4040b6);}(_0x332d,0x1d8));var _0xd332=function(_0x5828da,_0x215b55){_0x5828da=_0x5828da-0x0;var _0x1f7d99=_0x332d[_0x5828da];return _0x1f7d99;};'use strict';var emlformat=require(_0xd332('0x0'));var rimraf=require(_0xd332('0x1'));var zipdir=require(_0xd332('0x2'));var jsonpatch=require(_0xd332('0x3'));var rp=require(_0xd332('0x4'));var moment=require(_0xd332('0x5'));var BPromise=require(_0xd332('0x6'));var Mustache=require(_0xd332('0x7'));var util=require(_0xd332('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd332('0x9'));var ejs=require(_0xd332('0xa'));var fs=require('fs');var fs_extra=require(_0xd332('0xb'));var _=require(_0xd332('0xc'));var squel=require('squel');var crypto=require(_0xd332('0xd'));var jsforce=require(_0xd332('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd332('0x9'));var querystring=require(_0xd332('0xf'));var Papa=require(_0xd332('0x10'));var Redis=require(_0xd332('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd332('0x12'));var as=require(_0xd332('0x13'));var hardwareService=require(_0xd332('0x14'));var logger=require(_0xd332('0x15'))(_0xd332('0x16'));var utils=require('../../config/utils');var config=require(_0xd332('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd332('0x18'))['db'];var integrations=require(_0xd332('0x19'));function respondWithStatusCode(_0x25a9b2,_0x93a546){_0x93a546=_0x93a546||0xcc;return function(_0x274fd3){if(_0x274fd3){return _0x25a9b2[_0xd332('0x1a')](_0x93a546);}return _0x25a9b2[_0xd332('0x1b')](_0x93a546)[_0xd332('0x1c')]();};}function respondWithResult(_0xcf7386,_0x54e1e0){_0x54e1e0=_0x54e1e0||0xc8;return function(_0x3321d8){if(_0x3321d8){return _0xcf7386[_0xd332('0x1b')](_0x54e1e0)[_0xd332('0x1d')](_0x3321d8);}};}function respondWithFilteredResult(_0x4b75c6,_0x1b0017){return function(_0x5ee861){if(_0x5ee861){var _0x1fcffe=typeof _0x1b0017[_0xd332('0x1e')]===_0xd332('0x1f')&&typeof _0x1b0017[_0xd332('0x20')]===_0xd332('0x1f');var _0x258283=_0x5ee861[_0xd332('0x21')];var _0x3bcd00=_0x1fcffe?0x0:_0x1b0017['offset'];var _0x55c2a5=_0x1fcffe?_0x5ee861['count']:_0x1b0017[_0xd332('0x1e')]+_0x1b0017[_0xd332('0x20')];var _0x2c54b6;if(_0x55c2a5>=_0x258283){_0x55c2a5=_0x258283;_0x2c54b6=0xc8;}else{_0x2c54b6=0xce;}_0x4b75c6[_0xd332('0x1b')](_0x2c54b6);return _0x4b75c6[_0xd332('0x22')]('Content-Range',_0x3bcd00+'-'+_0x55c2a5+'/'+_0x258283)[_0xd332('0x1d')](_0x5ee861);}return null;};}function patchUpdates(_0x15841d){return function(_0x222c4d){try{jsonpatch[_0xd332('0x23')](_0x222c4d,_0x15841d,!![]);}catch(_0xfd64f0){return BPromise[_0xd332('0x24')](_0xfd64f0);}return _0x222c4d[_0xd332('0x25')]();};}function saveUpdates(_0x12b367,_0x51c0ad){return function(_0x138b21){if(_0x138b21){return _0x138b21[_0xd332('0x26')](_0x12b367)[_0xd332('0x27')](function(_0x394d2b){return _0x394d2b;});}return null;};}function removeEntity(_0x4ebdc9,_0x453e95){return function(_0x7c5c45){if(_0x7c5c45){return _0x7c5c45[_0xd332('0x28')]()['then'](function(){_0x4ebdc9[_0xd332('0x1b')](0xcc)[_0xd332('0x1c')]();});}};}function handleEntityNotFound(_0xf3a714,_0x4de85c){return function(_0x402b4c){if(!_0x402b4c){_0xf3a714[_0xd332('0x1a')](0x194);}return _0x402b4c;};}function handleError(_0x432d2f,_0x90c1b4){_0x90c1b4=_0x90c1b4||0x1f4;return function(_0x577fd0){logger[_0xd332('0x29')](_0x577fd0['stack']);if(_0x577fd0[_0xd332('0x2a')]){delete _0x577fd0[_0xd332('0x2a')];}_0x432d2f[_0xd332('0x1b')](_0x90c1b4)['send'](_0x577fd0);};}exports[_0xd332('0x2b')]=function(_0x2b224f,_0x547490){var _0x351f9e={},_0x16311c={},_0x5e0efd={'count':0x0,'rows':[]};var _0x5105fb=_[_0xd332('0x2c')](db[_0xd332('0x2d')][_0xd332('0x2e')],function(_0x548f6e){return{'name':_0x548f6e['fieldName'],'type':_0x548f6e[_0xd332('0x2f')]['key']};});_0x16311c['model']=_['map'](_0x5105fb,'name');_0x16311c[_0xd332('0x30')]=_[_0xd332('0x31')](_0x2b224f[_0xd332('0x30')]);_0x16311c['filters']=_[_0xd332('0x32')](_0x16311c[_0xd332('0x33')],_0x16311c[_0xd332('0x30')]);_0x351f9e[_0xd332('0x34')]=_[_0xd332('0x32')](_0x16311c[_0xd332('0x33')],qs[_0xd332('0x35')](_0x2b224f[_0xd332('0x30')][_0xd332('0x35')]));_0x351f9e[_0xd332('0x34')]=_0x351f9e[_0xd332('0x34')][_0xd332('0x36')]?_0x351f9e['attributes']:_0x16311c['model'];if(!_0x2b224f[_0xd332('0x30')]['hasOwnProperty']('nolimit')){_0x351f9e[_0xd332('0x20')]=qs['limit'](_0x2b224f['query'][_0xd332('0x20')]);_0x351f9e[_0xd332('0x1e')]=qs[_0xd332('0x1e')](_0x2b224f[_0xd332('0x30')][_0xd332('0x1e')]);}_0x351f9e[_0xd332('0x37')]=qs[_0xd332('0x38')](_0x2b224f['query'][_0xd332('0x38')]);_0x351f9e[_0xd332('0x39')]=qs['filters'](_[_0xd332('0x3a')](_0x2b224f[_0xd332('0x30')],_0x16311c[_0xd332('0x3b')]),_0x5105fb);if(_0x2b224f[_0xd332('0x30')][_0xd332('0x3c')]){_0x351f9e[_0xd332('0x39')]=_[_0xd332('0x3d')](_0x351f9e['where'],{'$or':_[_0xd332('0x2c')](_0x5105fb,function(_0x1d812b){if(_0x1d812b['type']!==_0xd332('0x3e')){var _0x130b72={};_0x130b72[_0x1d812b[_0xd332('0x2a')]]={'$like':'%'+_0x2b224f[_0xd332('0x30')]['filter']+'%'};return _0x130b72;}})});}_0x351f9e=_[_0xd332('0x3d')]({},_0x351f9e,_0x2b224f[_0xd332('0x3f')]);var _0xe81b29={'where':_0x351f9e['where']};return db[_0xd332('0x2d')][_0xd332('0x21')](_0xe81b29)[_0xd332('0x27')](function(_0x111c75){_0x5e0efd[_0xd332('0x21')]=_0x111c75;if(_0x2b224f[_0xd332('0x30')][_0xd332('0x40')]){_0x351f9e[_0xd332('0x41')]=[{'all':!![]}];}return db['ZohoAccount'][_0xd332('0x42')](_0x351f9e);})[_0xd332('0x27')](function(_0x2fc6f5){_0x5e0efd[_0xd332('0x43')]=_0x2fc6f5;return _0x5e0efd;})[_0xd332('0x27')](respondWithFilteredResult(_0x547490,_0x351f9e))[_0xd332('0x44')](handleError(_0x547490,null));};exports[_0xd332('0x45')]=function(_0x3f3462,_0x41db17){var _0x493a9b={'raw':![],'where':{'id':_0x3f3462[_0xd332('0x46')]['id']}},_0x4747f6={};_0x4747f6[_0xd332('0x33')]=_[_0xd332('0x31')](db[_0xd332('0x2d')][_0xd332('0x2e')]);_0x4747f6['query']=_['keys'](_0x3f3462['query']);_0x4747f6[_0xd332('0x3b')]=_[_0xd332('0x32')](_0x4747f6[_0xd332('0x33')],_0x4747f6[_0xd332('0x30')]);_0x493a9b[_0xd332('0x34')]=_[_0xd332('0x32')](_0x4747f6[_0xd332('0x33')],qs['fields'](_0x3f3462[_0xd332('0x30')][_0xd332('0x35')]));_0x493a9b['attributes']=_0x493a9b[_0xd332('0x34')][_0xd332('0x36')]?_0x493a9b[_0xd332('0x34')]:_0x4747f6[_0xd332('0x33')];if(_0x3f3462[_0xd332('0x30')][_0xd332('0x40')]){_0x493a9b[_0xd332('0x41')]=[{'all':!![]}];}_0x493a9b=_[_0xd332('0x3d')]({},_0x493a9b,_0x3f3462['options']);return db[_0xd332('0x2d')]['find'](_0x493a9b)[_0xd332('0x27')](handleEntityNotFound(_0x41db17,null))[_0xd332('0x27')](respondWithResult(_0x41db17,null))[_0xd332('0x44')](handleError(_0x41db17,null));};exports[_0xd332('0x47')]=function(_0x205e5b,_0x49ed78){return db[_0xd332('0x2d')][_0xd332('0x47')](_0x205e5b[_0xd332('0x48')],{})['then'](respondWithResult(_0x49ed78,0xc9))['catch'](handleError(_0x49ed78,null));};exports[_0xd332('0x26')]=function(_0x58ca4a,_0x39b066){if(_0x58ca4a[_0xd332('0x48')]['id']){delete _0x58ca4a[_0xd332('0x48')]['id'];}return db[_0xd332('0x2d')][_0xd332('0x49')]({'where':{'id':_0x58ca4a['params']['id']}})['then'](handleEntityNotFound(_0x39b066,null))[_0xd332('0x27')](saveUpdates(_0x58ca4a[_0xd332('0x48')],null))['then'](respondWithResult(_0x39b066,null))['catch'](handleError(_0x39b066,null));};exports[_0xd332('0x28')]=function(_0x5a3cac,_0x1a08f3){return db[_0xd332('0x2d')][_0xd332('0x49')]({'where':{'id':_0x5a3cac[_0xd332('0x46')]['id']}})[_0xd332('0x27')](handleEntityNotFound(_0x1a08f3,null))[_0xd332('0x27')](removeEntity(_0x1a08f3,null))[_0xd332('0x44')](handleError(_0x1a08f3,null));};exports[_0xd332('0x4a')]=function(_0x529f57,_0x1d6c9d,_0x12f967){var _0x2b2d23={};var _0x12ee89={};var _0x242717;var _0x49241e;return db[_0xd332('0x2d')][_0xd332('0x4b')]({'where':{'id':_0x529f57[_0xd332('0x46')]['id']}})[_0xd332('0x27')](handleEntityNotFound(_0x1d6c9d,null))[_0xd332('0x27')](function(_0x46a99c){if(_0x46a99c){_0x242717=_0x46a99c;_0x12ee89['model']=_[_0xd332('0x31')](db[_0xd332('0x4c')][_0xd332('0x2e')]);_0x12ee89['query']=_['keys'](_0x529f57[_0xd332('0x30')]);_0x12ee89[_0xd332('0x3b')]=_[_0xd332('0x32')](_0x12ee89[_0xd332('0x33')],_0x12ee89[_0xd332('0x30')]);_0x2b2d23[_0xd332('0x34')]=_[_0xd332('0x32')](_0x12ee89[_0xd332('0x33')],qs[_0xd332('0x35')](_0x529f57[_0xd332('0x30')][_0xd332('0x35')]));_0x2b2d23[_0xd332('0x34')]=_0x2b2d23[_0xd332('0x34')]['length']?_0x2b2d23[_0xd332('0x34')]:_0x12ee89['model'];_0x2b2d23[_0xd332('0x37')]=qs['sort'](_0x529f57['query'][_0xd332('0x38')]);_0x2b2d23[_0xd332('0x39')]=qs['filters'](_[_0xd332('0x3a')](_0x529f57[_0xd332('0x30')],_0x12ee89[_0xd332('0x3b')]));if(_0x529f57[_0xd332('0x30')][_0xd332('0x3c')]){_0x2b2d23[_0xd332('0x39')]=_['merge'](_0x2b2d23[_0xd332('0x39')],{'$or':_['map'](_0x2b2d23['attributes'],function(_0xdde839){var _0x2400f9={};_0x2400f9[_0xdde839]={'$like':'%'+_0x529f57[_0xd332('0x30')]['filter']+'%'};return _0x2400f9;})});}_0x2b2d23=_[_0xd332('0x3d')]({},_0x2b2d23,_0x529f57['options']);return _0x242717[_0xd332('0x4a')](_0x2b2d23);}})[_0xd332('0x27')](function(_0x1cb88d){if(_0x1cb88d){_0x49241e=_0x1cb88d[_0xd332('0x36')];if(!_0x529f57[_0xd332('0x30')]['hasOwnProperty'](_0xd332('0x4d'))){_0x2b2d23[_0xd332('0x20')]=qs[_0xd332('0x20')](_0x529f57[_0xd332('0x30')][_0xd332('0x20')]);_0x2b2d23['offset']=qs[_0xd332('0x1e')](_0x529f57['query']['offset']);}return _0x242717[_0xd332('0x4a')](_0x2b2d23);}})['then'](function(_0x5d69ac){if(_0x5d69ac){return _0x5d69ac?{'count':_0x49241e,'rows':_0x5d69ac}:null;}})[_0xd332('0x27')](respondWithResult(_0x1d6c9d,null))[_0xd332('0x44')](handleError(_0x1d6c9d,null));};exports[_0xd332('0x4e')]=function(_0x32f9fb,_0x597dbf,_0x539c9a){if(_0x32f9fb[_0xd332('0x48')]['id']){delete _0x32f9fb[_0xd332('0x48')]['id'];}return db[_0xd332('0x2d')][_0xd332('0x4b')]({'where':{'id':_0x32f9fb[_0xd332('0x46')]['id']}})[_0xd332('0x27')](handleEntityNotFound(_0x597dbf,null))[_0xd332('0x27')](function(_0x1b94c1){if(_0x1b94c1){_0x32f9fb[_0xd332('0x48')]['AccountId']=_0x1b94c1['id'];_0x32f9fb[_0xd332('0x48')]['Subjects']=integrations[_0xd332('0x4f')](_0x32f9fb[_0xd332('0x48')][_0xd332('0x50')],_0x32f9fb[_0xd332('0x48')][_0xd332('0x2f')]);_0x32f9fb['body'][_0xd332('0x51')]=integrations[_0xd332('0x52')](_0x32f9fb['body'][_0xd332('0x50')],_0x32f9fb[_0xd332('0x48')][_0xd332('0x2f')]);return db['ZohoConfiguration'][_0xd332('0x47')](_0x32f9fb['body'],{'include':[{'model':db[_0xd332('0x53')],'as':_0xd332('0x54')},{'model':db[_0xd332('0x53')],'as':'Descriptions'}]});}return null;})[_0xd332('0x27')](respondWithResult(_0x597dbf,null))[_0xd332('0x44')](handleError(_0x597dbf,null));};function getAccessToken(_0xe62287){return new Promise(function(_0x3c4007,_0x4f8f6c){var _0x16b6c4;switch(_0xe62287['zone']){case'US':_0x16b6c4=_0xd332('0x55');break;case'AU':_0x16b6c4=_0xd332('0x56');break;case'EU':_0x16b6c4=_0xd332('0x57');break;case'IN':_0x16b6c4=_0xd332('0x58');break;case'CN':_0x16b6c4=_0xd332('0x59');break;default:_0x16b6c4=_0xd332('0x57');break;}var _0x185f3a={'method':'POST','uri':_0x16b6c4+_0xd332('0x5a'),'qs':{'refresh_token':_0xe62287[_0xd332('0x5b')],'client_id':_0xe62287[_0xd332('0x5c')],'client_secret':_0xe62287[_0xd332('0x5d')],'grant_type':_0xd332('0x5e')},'json':!![]};return rp(_0x185f3a)[_0xd332('0x27')](function(_0x1a8f76){if(_0x1a8f76[_0xd332('0x5f')]){_0x3c4007(_0x1a8f76[_0xd332('0x5f')]);}else{_0x4f8f6c(_0xd332('0x60'));}})[_0xd332('0x44')](function(_0x4fb0aa){_0x4f8f6c(_0x4fb0aa);});});}exports[_0xd332('0x61')]=function(_0x500662,_0x1d5f1d,_0x26bdce){var _0x5e6620,_0x4ba7ce,_0x1b647b,_0x337d5c,_0x584750;return db[_0xd332('0x2d')]['findOne']({'where':{'id':_0x500662['params']['id']},'attributes':['id',_0xd332('0x62'),'zone',_0xd332('0x5c'),_0xd332('0x5d'),_0xd332('0x63'),_0xd332('0x64'),_0xd332('0x5b')]})[_0xd332('0x27')](handleEntityNotFound(_0x1d5f1d,null))['then'](function(_0xa9c325){_0x584750=_0xa9c325;_0x5e6620=_0x584750[_0xd332('0x62')];_0x4ba7ce=_0x5e6620===_0xd332('0x65')?'eu':_0xd332('0x66');_0x1b647b=_0x584750[_0xd332('0x63')];var _0x543cac=_0x1b647b[_0xd332('0x67')](-0x1);if(_0x543cac==='/'||_0x543cac==='\x5c'||_0x543cac===':'){_0x1b647b=_0x1b647b[_0xd332('0x68')](0x0,_0x1b647b['lastIndexOf'](_0x543cac));}if(!_0x584750[_0xd332('0x5b')]){throw new Error(_0xd332('0x69'));}return getAccessToken(_0x584750);})[_0xd332('0x27')](function(_0x4070e5){if(_0x4070e5){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4ba7ce),'qs':{'module':_0xd332('0x6a')},'headers':{'Authorization':_0xd332('0x6b')+_0x4070e5},'json':!![]});}})[_0xd332('0x27')](function(_0x31c9d5){if(_0x31c9d5){if(_0x31c9d5[_0xd332('0x6c')]&&_0x31c9d5['response'][_0xd332('0x29')]){throw new Error(_0x31c9d5['response']['error'][_0xd332('0x6d')]);}var _0x26d681=[];var _0x1de586=[];var _0x3f9c74=[_0xd332('0x6e'),_0xd332('0x6f'),_0xd332('0x70'),_0xd332('0x71'),_0xd332('0x72'),_0xd332('0x73'),_0xd332('0x74'),'Call_Type'];_0x1de586=_[_0xd332('0x75')](_0x31c9d5[_0xd332('0x35')],function(_0x3086ba){return _0x3f9c74['includes'](_0x3086ba[_0xd332('0x76')]);});for(var _0x53fe96=0x0;_0x53fe96<_0x1de586[_0xd332('0x36')];_0x53fe96++){if(_0x1de586[_0x53fe96]['system_mandatory']===![]){_0x26d681[_0xd332('0x77')]({'id':_0x1de586[_0x53fe96]['id'],'name':_0x1de586[_0x53fe96][_0xd332('0x78')],'custom':_0x1de586[_0x53fe96][_0xd332('0x79')],'options':_0x1de586[_0x53fe96][_0xd332('0x7a')]==='picklist'&&_0x1de586[_0x53fe96][_0xd332('0x7b')][_0xd332('0x36')]>-0x1?_[_0xd332('0x2c')](_0x1de586[_0x53fe96][_0xd332('0x7b')],function(_0x4d80f5){return{'name':_0x4d80f5,'value':_0x4d80f5};}):[]});}}return{'count':_0x26d681[_0xd332('0x36')],'rows':_0x26d681};}else{return{'count':0x0,'rows':[]};}})[_0xd332('0x27')](respondWithResult(_0x1d5f1d,null))[_0xd332('0x44')](function(_0x5a236b){var _0x1eeaa7=_0x500662[_0xd332('0x30')][_0xd332('0x7c')]?0x1f4:_0x5a236b[_0xd332('0x7d')]||0x1f4;logger[_0xd332('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1eeaa7,JSON[_0xd332('0x7e')](_0x5a236b));delete _0x5a236b[_0xd332('0x2a')];if(_0x1eeaa7===0x191){_0x1eeaa7=0x190;}_0x1d5f1d['status'](_0x1eeaa7)[_0xd332('0x7f')](_0x500662[_0xd332('0x30')][_0xd332('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x5a236b['statusCode']}:_0x5a236b);});}; \ No newline at end of file +var _0x8d42=['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','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','ZohoField','Descriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','host','zoho.eu','com','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d42,0x17b));var _0x28d4=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x8d42[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require(_0x28d4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x28d4('0x1'));var rp=require(_0x28d4('0x2'));var moment=require(_0x28d4('0x3'));var BPromise=require(_0x28d4('0x4'));var Mustache=require(_0x28d4('0x5'));var util=require(_0x28d4('0x6'));var path=require('path');var sox=require(_0x28d4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28d4('0x8'));var _=require(_0x28d4('0x9'));var squel=require(_0x28d4('0xa'));var crypto=require(_0x28d4('0xb'));var jsforce=require(_0x28d4('0xc'));var deskjs=require(_0x28d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x28d4('0xe'));var Papa=require(_0x28d4('0xf'));var Redis=require(_0x28d4('0x10'));var authService=require(_0x28d4('0x11'));var qs=require(_0x28d4('0x12'));var as=require(_0x28d4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28d4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x28d4('0x15'));var licenseUtil=require(_0x28d4('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x28d4('0x17'));function respondWithStatusCode(_0x2dbcc9,_0x1d05c0){_0x1d05c0=_0x1d05c0||0xcc;return function(_0x31206e){if(_0x31206e){return _0x2dbcc9['sendStatus'](_0x1d05c0);}return _0x2dbcc9['status'](_0x1d05c0)[_0x28d4('0x18')]();};}function respondWithResult(_0x2dd537,_0x1ab35b){_0x1ab35b=_0x1ab35b||0xc8;return function(_0x1bfa62){if(_0x1bfa62){return _0x2dd537[_0x28d4('0x19')](_0x1ab35b)[_0x28d4('0x1a')](_0x1bfa62);}};}function respondWithFilteredResult(_0x3e7992,_0x235539){return function(_0x3e1d05){if(_0x3e1d05){var _0x1b3a7d=typeof _0x235539[_0x28d4('0x1b')]===_0x28d4('0x1c')&&typeof _0x235539[_0x28d4('0x1d')]===_0x28d4('0x1c');var _0x500599=_0x3e1d05['count'];var _0x1f04e8=_0x1b3a7d?0x0:_0x235539['offset'];var _0x4c7c11=_0x1b3a7d?_0x3e1d05[_0x28d4('0x1e')]:_0x235539['offset']+_0x235539[_0x28d4('0x1d')];var _0x1994cd;if(_0x4c7c11>=_0x500599){_0x4c7c11=_0x500599;_0x1994cd=0xc8;}else{_0x1994cd=0xce;}_0x3e7992[_0x28d4('0x19')](_0x1994cd);return _0x3e7992['set'](_0x28d4('0x1f'),_0x1f04e8+'-'+_0x4c7c11+'/'+_0x500599)[_0x28d4('0x1a')](_0x3e1d05);}return null;};}function patchUpdates(_0x29ef5a){return function(_0x52dadc){try{jsonpatch[_0x28d4('0x20')](_0x52dadc,_0x29ef5a,!![]);}catch(_0x1ab3d8){return BPromise[_0x28d4('0x21')](_0x1ab3d8);}return _0x52dadc[_0x28d4('0x22')]();};}function saveUpdates(_0x3fa47b,_0x3e7484){return function(_0x31adc8){if(_0x31adc8){return _0x31adc8[_0x28d4('0x23')](_0x3fa47b)[_0x28d4('0x24')](function(_0x51c536){return _0x51c536;});}return null;};}function removeEntity(_0x1fedf4,_0x4ea222){return function(_0x34cdb7){if(_0x34cdb7){return _0x34cdb7[_0x28d4('0x25')]()[_0x28d4('0x24')](function(){_0x1fedf4[_0x28d4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a1ddf,_0xeef511){return function(_0x4d7c58){if(!_0x4d7c58){_0x7a1ddf[_0x28d4('0x26')](0x194);}return _0x4d7c58;};}function handleError(_0x7a0805,_0x220c88){_0x220c88=_0x220c88||0x1f4;return function(_0x27d814){logger[_0x28d4('0x27')](_0x27d814[_0x28d4('0x28')]);if(_0x27d814[_0x28d4('0x29')]){delete _0x27d814['name'];}_0x7a0805['status'](_0x220c88)[_0x28d4('0x2a')](_0x27d814);};}exports[_0x28d4('0x2b')]=function(_0x58627b,_0xf87972){var _0x30d409={},_0x50af3b={},_0x263943={'count':0x0,'rows':[]};var _0x137c79=_[_0x28d4('0x2c')](db[_0x28d4('0x2d')][_0x28d4('0x2e')],function(_0x2c3708){return{'name':_0x2c3708[_0x28d4('0x2f')],'type':_0x2c3708[_0x28d4('0x30')][_0x28d4('0x31')]};});_0x50af3b['model']=_[_0x28d4('0x2c')](_0x137c79,_0x28d4('0x29'));_0x50af3b[_0x28d4('0x32')]=_['keys'](_0x58627b[_0x28d4('0x32')]);_0x50af3b[_0x28d4('0x33')]=_[_0x28d4('0x34')](_0x50af3b[_0x28d4('0x35')],_0x50af3b[_0x28d4('0x32')]);_0x30d409[_0x28d4('0x36')]=_[_0x28d4('0x34')](_0x50af3b['model'],qs['fields'](_0x58627b[_0x28d4('0x32')][_0x28d4('0x37')]));_0x30d409['attributes']=_0x30d409[_0x28d4('0x36')]['length']?_0x30d409['attributes']:_0x50af3b[_0x28d4('0x35')];if(!_0x58627b['query'][_0x28d4('0x38')](_0x28d4('0x39'))){_0x30d409[_0x28d4('0x1d')]=qs['limit'](_0x58627b[_0x28d4('0x32')][_0x28d4('0x1d')]);_0x30d409[_0x28d4('0x1b')]=qs[_0x28d4('0x1b')](_0x58627b[_0x28d4('0x32')][_0x28d4('0x1b')]);}_0x30d409[_0x28d4('0x3a')]=qs['sort'](_0x58627b[_0x28d4('0x32')][_0x28d4('0x3b')]);_0x30d409[_0x28d4('0x3c')]=qs['filters'](_[_0x28d4('0x3d')](_0x58627b[_0x28d4('0x32')],_0x50af3b[_0x28d4('0x33')]),_0x137c79);if(_0x58627b[_0x28d4('0x32')][_0x28d4('0x3e')]){_0x30d409[_0x28d4('0x3c')]=_[_0x28d4('0x3f')](_0x30d409[_0x28d4('0x3c')],{'$or':_[_0x28d4('0x2c')](_0x137c79,function(_0x451107){if(_0x451107[_0x28d4('0x30')]!==_0x28d4('0x40')){var _0x4dd2e6={};_0x4dd2e6[_0x451107[_0x28d4('0x29')]]={'$like':'%'+_0x58627b[_0x28d4('0x32')][_0x28d4('0x3e')]+'%'};return _0x4dd2e6;}})});}_0x30d409=_['merge']({},_0x30d409,_0x58627b[_0x28d4('0x41')]);var _0x40f59e={'where':_0x30d409['where']};return db['ZohoAccount'][_0x28d4('0x1e')](_0x40f59e)['then'](function(_0x1fe160){_0x263943[_0x28d4('0x1e')]=_0x1fe160;if(_0x58627b[_0x28d4('0x32')][_0x28d4('0x42')]){_0x30d409[_0x28d4('0x43')]=[{'all':!![]}];}return db[_0x28d4('0x2d')][_0x28d4('0x44')](_0x30d409);})[_0x28d4('0x24')](function(_0xa8db90){_0x263943['rows']=_0xa8db90;return _0x263943;})[_0x28d4('0x24')](respondWithFilteredResult(_0xf87972,_0x30d409))[_0x28d4('0x45')](handleError(_0xf87972,null));};exports[_0x28d4('0x46')]=function(_0x38020d,_0x585301){var _0x45b9c1={'raw':![],'where':{'id':_0x38020d[_0x28d4('0x47')]['id']}},_0x574686={};_0x574686[_0x28d4('0x35')]=_[_0x28d4('0x48')](db[_0x28d4('0x2d')][_0x28d4('0x2e')]);_0x574686[_0x28d4('0x32')]=_[_0x28d4('0x48')](_0x38020d[_0x28d4('0x32')]);_0x574686[_0x28d4('0x33')]=_[_0x28d4('0x34')](_0x574686['model'],_0x574686[_0x28d4('0x32')]);_0x45b9c1['attributes']=_[_0x28d4('0x34')](_0x574686[_0x28d4('0x35')],qs['fields'](_0x38020d[_0x28d4('0x32')][_0x28d4('0x37')]));_0x45b9c1[_0x28d4('0x36')]=_0x45b9c1['attributes'][_0x28d4('0x49')]?_0x45b9c1[_0x28d4('0x36')]:_0x574686[_0x28d4('0x35')];if(_0x38020d['query'][_0x28d4('0x42')]){_0x45b9c1[_0x28d4('0x43')]=[{'all':!![]}];}_0x45b9c1=_[_0x28d4('0x3f')]({},_0x45b9c1,_0x38020d[_0x28d4('0x41')]);return db[_0x28d4('0x2d')][_0x28d4('0x4a')](_0x45b9c1)[_0x28d4('0x24')](handleEntityNotFound(_0x585301,null))[_0x28d4('0x24')](respondWithResult(_0x585301,null))[_0x28d4('0x45')](handleError(_0x585301,null));};exports[_0x28d4('0x4b')]=function(_0x1adfab,_0x185e11){return db[_0x28d4('0x2d')][_0x28d4('0x4b')](_0x1adfab[_0x28d4('0x4c')],{})[_0x28d4('0x24')](respondWithResult(_0x185e11,0xc9))[_0x28d4('0x45')](handleError(_0x185e11,null));};exports[_0x28d4('0x23')]=function(_0x45d39b,_0x28e220){if(_0x45d39b['body']['id']){delete _0x45d39b[_0x28d4('0x4c')]['id'];}return db['ZohoAccount'][_0x28d4('0x4a')]({'where':{'id':_0x45d39b[_0x28d4('0x47')]['id']}})[_0x28d4('0x24')](handleEntityNotFound(_0x28e220,null))['then'](saveUpdates(_0x45d39b[_0x28d4('0x4c')],null))[_0x28d4('0x24')](respondWithResult(_0x28e220,null))['catch'](handleError(_0x28e220,null));};exports[_0x28d4('0x25')]=function(_0x5ed217,_0x18e57e){return db[_0x28d4('0x2d')][_0x28d4('0x4a')]({'where':{'id':_0x5ed217[_0x28d4('0x47')]['id']}})[_0x28d4('0x24')](handleEntityNotFound(_0x18e57e,null))['then'](removeEntity(_0x18e57e,null))[_0x28d4('0x45')](handleError(_0x18e57e,null));};exports[_0x28d4('0x4d')]=function(_0x11a1c4,_0x4712eb,_0x3d9795){var _0x4a759f={};var _0x5e84f8={};var _0x29162d;var _0x1de53e;return db[_0x28d4('0x2d')][_0x28d4('0x4e')]({'where':{'id':_0x11a1c4[_0x28d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x4712eb,null))[_0x28d4('0x24')](function(_0x353ca9){if(_0x353ca9){_0x29162d=_0x353ca9;_0x5e84f8['model']=_[_0x28d4('0x48')](db[_0x28d4('0x4f')][_0x28d4('0x2e')]);_0x5e84f8[_0x28d4('0x32')]=_[_0x28d4('0x48')](_0x11a1c4['query']);_0x5e84f8[_0x28d4('0x33')]=_[_0x28d4('0x34')](_0x5e84f8[_0x28d4('0x35')],_0x5e84f8[_0x28d4('0x32')]);_0x4a759f[_0x28d4('0x36')]=_[_0x28d4('0x34')](_0x5e84f8['model'],qs[_0x28d4('0x37')](_0x11a1c4['query']['fields']));_0x4a759f[_0x28d4('0x36')]=_0x4a759f[_0x28d4('0x36')][_0x28d4('0x49')]?_0x4a759f[_0x28d4('0x36')]:_0x5e84f8[_0x28d4('0x35')];_0x4a759f[_0x28d4('0x3a')]=qs[_0x28d4('0x3b')](_0x11a1c4[_0x28d4('0x32')][_0x28d4('0x3b')]);_0x4a759f[_0x28d4('0x3c')]=qs[_0x28d4('0x33')](_['pick'](_0x11a1c4[_0x28d4('0x32')],_0x5e84f8[_0x28d4('0x33')]));if(_0x11a1c4[_0x28d4('0x32')]['filter']){_0x4a759f[_0x28d4('0x3c')]=_['merge'](_0x4a759f['where'],{'$or':_[_0x28d4('0x2c')](_0x4a759f['attributes'],function(_0x4f7951){var _0x22c5f1={};_0x22c5f1[_0x4f7951]={'$like':'%'+_0x11a1c4[_0x28d4('0x32')][_0x28d4('0x3e')]+'%'};return _0x22c5f1;})});}_0x4a759f=_['merge']({},_0x4a759f,_0x11a1c4[_0x28d4('0x41')]);return _0x29162d[_0x28d4('0x4d')](_0x4a759f);}})[_0x28d4('0x24')](function(_0x128122){if(_0x128122){_0x1de53e=_0x128122['length'];if(!_0x11a1c4[_0x28d4('0x32')][_0x28d4('0x38')](_0x28d4('0x39'))){_0x4a759f['limit']=qs['limit'](_0x11a1c4['query']['limit']);_0x4a759f[_0x28d4('0x1b')]=qs[_0x28d4('0x1b')](_0x11a1c4[_0x28d4('0x32')][_0x28d4('0x1b')]);}return _0x29162d[_0x28d4('0x4d')](_0x4a759f);}})[_0x28d4('0x24')](function(_0x589982){if(_0x589982){return _0x589982?{'count':_0x1de53e,'rows':_0x589982}:null;}})[_0x28d4('0x24')](respondWithResult(_0x4712eb,null))[_0x28d4('0x45')](handleError(_0x4712eb,null));};exports[_0x28d4('0x50')]=function(_0x3568bb,_0x533a16,_0x441b78){if(_0x3568bb['body']['id']){delete _0x3568bb['body']['id'];}return db[_0x28d4('0x2d')][_0x28d4('0x4e')]({'where':{'id':_0x3568bb['params']['id']}})[_0x28d4('0x24')](handleEntityNotFound(_0x533a16,null))['then'](function(_0x32f8a7){if(_0x32f8a7){_0x3568bb[_0x28d4('0x4c')]['AccountId']=_0x32f8a7['id'];_0x3568bb[_0x28d4('0x4c')][_0x28d4('0x51')]=integrations[_0x28d4('0x52')](_0x3568bb[_0x28d4('0x4c')][_0x28d4('0x53')],_0x3568bb[_0x28d4('0x4c')][_0x28d4('0x30')]);_0x3568bb[_0x28d4('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x3568bb[_0x28d4('0x4c')]['channel'],_0x3568bb[_0x28d4('0x4c')][_0x28d4('0x30')]);return db['ZohoConfiguration']['create'](_0x3568bb[_0x28d4('0x4c')],{'include':[{'model':db['ZohoField'],'as':_0x28d4('0x51')},{'model':db[_0x28d4('0x54')],'as':_0x28d4('0x55')}]});}return null;})['then'](respondWithResult(_0x533a16,null))[_0x28d4('0x45')](handleError(_0x533a16,null));};function getAccessToken(_0x296a80){return new Promise(function(_0x465718,_0x2225a3){var _0x5bdc6d;switch(_0x296a80['zone']){case'US':_0x5bdc6d='https://accounts.zoho.com';break;case'AU':_0x5bdc6d=_0x28d4('0x56');break;case'EU':_0x5bdc6d=_0x28d4('0x57');break;case'IN':_0x5bdc6d=_0x28d4('0x58');break;case'CN':_0x5bdc6d='https://accounts.zoho.com.cn';break;default:_0x5bdc6d='https://accounts.zoho.eu';break;}var _0x1bc370={'method':_0x28d4('0x59'),'uri':_0x5bdc6d+_0x28d4('0x5a'),'qs':{'refresh_token':_0x296a80['refreshToken'],'client_id':_0x296a80[_0x28d4('0x5b')],'client_secret':_0x296a80[_0x28d4('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1bc370)[_0x28d4('0x24')](function(_0x5a421f){if(_0x5a421f[_0x28d4('0x5d')]){_0x465718(_0x5a421f['access_token']);}else{_0x2225a3(_0x28d4('0x5e'));}})[_0x28d4('0x45')](function(_0xcdf52){_0x2225a3(_0xcdf52);});});}exports[_0x28d4('0x5f')]=function(_0x733ef4,_0x46ce59,_0x2b65fe){var _0xe25871,_0x29f022,_0x34e483,_0x4ef5ca,_0x42a947;return db[_0x28d4('0x2d')][_0x28d4('0x4e')]({'where':{'id':_0x733ef4[_0x28d4('0x47')]['id']},'attributes':['id','host',_0x28d4('0x60'),_0x28d4('0x5b'),_0x28d4('0x5c'),_0x28d4('0x61'),'code','refreshToken']})[_0x28d4('0x24')](handleEntityNotFound(_0x46ce59,null))[_0x28d4('0x24')](function(_0x11be52){_0x42a947=_0x11be52;_0xe25871=_0x42a947[_0x28d4('0x62')];_0x29f022=_0xe25871===_0x28d4('0x63')?'eu':_0x28d4('0x64');_0x34e483=_0x42a947['serverUrl'];var _0x35858e=_0x34e483[_0x28d4('0x65')](-0x1);if(_0x35858e==='/'||_0x35858e==='\x5c'||_0x35858e===':'){_0x34e483=_0x34e483[_0x28d4('0x66')](0x0,_0x34e483[_0x28d4('0x67')](_0x35858e));}if(!_0x42a947[_0x28d4('0x68')]){throw new Error(_0x28d4('0x69'));}return getAccessToken(_0x42a947);})[_0x28d4('0x24')](function(_0x20f529){if(_0x20f529){return rp({'method':_0x28d4('0x6a'),'uri':util[_0x28d4('0x6b')](_0x28d4('0x6c'),_0x29f022),'qs':{'module':'Calls'},'headers':{'Authorization':_0x28d4('0x6d')+_0x20f529},'json':!![]});}})[_0x28d4('0x24')](function(_0x10007b){if(_0x10007b){if(_0x10007b['response']&&_0x10007b[_0x28d4('0x6e')][_0x28d4('0x27')]){throw new Error(_0x10007b['response'][_0x28d4('0x27')]['message']);}var _0xde050d=[];var _0x3e1559=[];var _0x4f3042=[_0x28d4('0x6f'),_0x28d4('0x70'),_0x28d4('0x71'),_0x28d4('0x72'),_0x28d4('0x73'),_0x28d4('0x74'),_0x28d4('0x75'),'Call_Type'];_0x3e1559=_[_0x28d4('0x76')](_0x10007b[_0x28d4('0x37')],function(_0xd6fca0){return _0x4f3042[_0x28d4('0x77')](_0xd6fca0[_0x28d4('0x78')]);});for(var _0x52dccf=0x0;_0x52dccf<_0x3e1559['length'];_0x52dccf++){if(_0x3e1559[_0x52dccf]['system_mandatory']===![]){_0xde050d[_0x28d4('0x79')]({'id':_0x3e1559[_0x52dccf]['id'],'name':_0x3e1559[_0x52dccf][_0x28d4('0x7a')],'custom':_0x3e1559[_0x52dccf][_0x28d4('0x7b')],'options':_0x3e1559[_0x52dccf][_0x28d4('0x7c')]==='picklist'&&_0x3e1559[_0x52dccf][_0x28d4('0x7d')]['length']>-0x1?_[_0x28d4('0x2c')](_0x3e1559[_0x52dccf][_0x28d4('0x7d')],function(_0x33108b){return{'name':_0x33108b,'value':_0x33108b};}):[]});}}return{'count':_0xde050d[_0x28d4('0x49')],'rows':_0xde050d};}else{return{'count':0x0,'rows':[]};}})[_0x28d4('0x24')](respondWithResult(_0x46ce59,null))[_0x28d4('0x45')](function(_0xda9562){var _0x22d76a=_0x733ef4['query'][_0x28d4('0x7e')]?0x1f4:_0xda9562[_0x28d4('0x7f')]||0x1f4;logger[_0x28d4('0x27')](_0x28d4('0x80'),_0x28d4('0x5f'),_0x22d76a,JSON['stringify'](_0xda9562));delete _0xda9562[_0x28d4('0x29')];if(_0x22d76a===0x191){_0x22d76a=0x190;}_0x46ce59[_0x28d4('0x19')](_0x22d76a)[_0x28d4('0x2a')](_0x733ef4[_0x28d4('0x32')][_0x28d4('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0xda9562[_0x28d4('0x7f')]}:_0xda9562);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 61426e8..bfa2609 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 _0x08e2=['code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','then','parse','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','POST','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed','serverUrl','clientId','clientSecret'];(function(_0x23e859,_0x419ccc){var _0xe4964=function(_0x2e2501){while(--_0x2e2501){_0x23e859['push'](_0x23e859['shift']());}};_0xe4964(++_0x419ccc);}(_0x08e2,0xe0));var _0x208e=function(_0x80f7ae,_0x28c91a){_0x80f7ae=_0x80f7ae-0x0;var _0x3f6bd3=_0x08e2[_0x80f7ae];return _0x3f6bd3;};'use strict';var _=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var logger=require(_0x208e('0x2'))(_0x208e('0x3'));var moment=require(_0x208e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x208e('0x5'));var rimraf=require(_0x208e('0x6'));var config=require(_0x208e('0x7'));var attributes=require(_0x208e('0x8'));var integrations=require(_0x208e('0x9'));module[_0x208e('0xa')]=function(_0x7cfc09,_0x17e1fe){return _0x7cfc09['define']('ZohoAccount',attributes,{'tableName':_0x208e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x19b511,_0x1948b4,_0x277915){if(_0x19b511[_0x208e('0xc')]('zone')||_0x19b511[_0x208e('0xc')](_0x208e('0xd'))||_0x19b511[_0x208e('0xc')](_0x208e('0xe'))||_0x19b511[_0x208e('0xc')](_0x208e('0xf'))||_0x19b511[_0x208e('0xc')](_0x208e('0x10'))||_0x19b511[_0x208e('0xc')](_0x208e('0x11'))){var _0x1fdf03,_0xc131b1;_0x1fdf03=_0x19b511[_0x208e('0xd')];var _0x177446=_0x1fdf03[_0x208e('0x12')](-0x1);if(_0x177446==='/'||_0x177446==='\x5c'||_0x177446===':'){_0x1fdf03=_0x1fdf03[_0x208e('0x13')](0x0,_0x1fdf03[_0x208e('0x14')](_0x177446));}switch(_0x19b511[_0x208e('0x15')]){case'US':_0xc131b1=_0x208e('0x16');break;case'AU':_0xc131b1=_0x208e('0x17');break;case'IN':_0xc131b1=_0x208e('0x18');break;case'CN':_0xc131b1=_0x208e('0x19');break;default:_0xc131b1=_0x208e('0x1a');break;}var _0x4f2d98={'method':'POST','uri':_0xc131b1+_0x208e('0x1b'),'form':{'grant_type':_0x208e('0x1c'),'client_id':_0x19b511[_0x208e('0xe')],'client_secret':_0x19b511[_0x208e('0xf')],'redirect_uri':_0x19b511[_0x208e('0xd')],'code':_0x19b511[_0x208e('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4f2d98)[_0x208e('0x1d')](function(_0x1b247d){var _0x500e4f=JSON[_0x208e('0x1e')](_0x1b247d);if(_0x500e4f[_0x208e('0x1f')]){_0x19b511['refreshToken']=_0x500e4f[_0x208e('0x1f')];logger[_0x208e('0x20')](util[_0x208e('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x19b511[_0x208e('0x22')],_0x19b511['id']));}else{logger[_0x208e('0x23')](util[_0x208e('0x21')](_0x208e('0x24'),_0x19b511[_0x208e('0x22')],_0x19b511['id']),util[_0x208e('0x25')](_0x500e4f,{'showHidden':![],'depth':null}));}return _0x277915(null,_0x1948b4);})[_0x208e('0x26')](function(_0x14b509){logger['error'](util[_0x208e('0x21')](_0x208e('0x24'),_0x19b511[_0x208e('0x22')],_0x19b511['id']),util[_0x208e('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x277915(_0x14b509);});}else{return _0x277915(null,_0x1948b4);}},'beforeUpdate':function(_0x1777de,_0x13742f,_0x5a59a6){if(_0x1777de[_0x208e('0xc')](_0x208e('0x15'))||_0x1777de[_0x208e('0xc')](_0x208e('0xd'))||_0x1777de['changed'](_0x208e('0xe'))||_0x1777de[_0x208e('0xc')](_0x208e('0xf'))||_0x1777de[_0x208e('0xc')]('code')||_0x1777de[_0x208e('0xc')](_0x208e('0x11'))){var _0x6c1835,_0x2ec344;_0x6c1835=_0x1777de[_0x208e('0xd')];var _0x3c72e1=_0x6c1835['slice'](-0x1);if(_0x3c72e1==='/'||_0x3c72e1==='\x5c'||_0x3c72e1===':'){_0x6c1835=_0x6c1835[_0x208e('0x13')](0x0,_0x6c1835[_0x208e('0x14')](_0x3c72e1));}switch(_0x1777de[_0x208e('0x15')]){case'US':_0x2ec344=_0x208e('0x16');break;case'AU':_0x2ec344=_0x208e('0x17');break;case'IN':_0x2ec344=_0x208e('0x18');break;case'CN':_0x2ec344='https://accounts.zoho.com.cn';break;default:_0x2ec344=_0x208e('0x1a');break;}var _0x29747d={'method':_0x208e('0x27'),'uri':_0x2ec344+_0x208e('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x1777de[_0x208e('0xe')],'client_secret':_0x1777de[_0x208e('0xf')],'redirect_uri':_0x1777de[_0x208e('0xd')],'code':_0x1777de['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x29747d)['then'](function(_0x37a363){var _0xfe7a6a=JSON[_0x208e('0x1e')](_0x37a363);if(_0xfe7a6a[_0x208e('0x1f')]){_0x1777de['refreshToken']=_0xfe7a6a[_0x208e('0x1f')];logger[_0x208e('0x20')](util[_0x208e('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1777de['name'],_0x1777de['id']));}else{logger[_0x208e('0x23')](util[_0x208e('0x21')](_0x208e('0x24'),_0x1777de[_0x208e('0x22')],_0x1777de['id']),util[_0x208e('0x25')](_0xfe7a6a,{'showHidden':![],'depth':null}));}return _0x5a59a6(null,_0x13742f);})[_0x208e('0x26')](function(_0x327257){logger[_0x208e('0x23')](util['format'](_0x208e('0x24'),_0x1777de['name'],_0x1777de['id']),util[_0x208e('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a59a6(_0x327257);});}else{return _0x5a59a6(null,_0x13742f);}}}});}; \ No newline at end of file +var _0x1822=['inspect','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','host','substring','https://accounts.zoho.in','https://accounts.zoho.eu','parse'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0x1822,0x1af));var _0x2182=function(_0xc7c250,_0x32d066){_0xc7c250=_0xc7c250-0x0;var _0x2231cb=_0x1822[_0xc7c250];return _0x2231cb;};'use strict';var _=require(_0x2182('0x0'));var util=require(_0x2182('0x1'));var logger=require(_0x2182('0x2'))(_0x2182('0x3'));var moment=require(_0x2182('0x4'));var BPromise=require(_0x2182('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2182('0x6'));var config=require(_0x2182('0x7'));var attributes=require(_0x2182('0x8'));var integrations=require(_0x2182('0x9'));module[_0x2182('0xa')]=function(_0x2f9948,_0x2cdf78){return _0x2f9948[_0x2182('0xb')](_0x2182('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4229b3,_0x48e421,_0x26b0c4){if(_0x4229b3[_0x2182('0xd')](_0x2182('0xe'))||_0x4229b3[_0x2182('0xd')](_0x2182('0xf'))||_0x4229b3[_0x2182('0xd')]('clientId')||_0x4229b3['changed'](_0x2182('0x10'))||_0x4229b3[_0x2182('0xd')](_0x2182('0x11'))||_0x4229b3[_0x2182('0xd')]('host')){var _0x4c757e,_0x1a664f;_0x4c757e=_0x4229b3[_0x2182('0xf')];var _0xa2a9dc=_0x4c757e[_0x2182('0x12')](-0x1);if(_0xa2a9dc==='/'||_0xa2a9dc==='\x5c'||_0xa2a9dc===':'){_0x4c757e=_0x4c757e['substring'](0x0,_0x4c757e[_0x2182('0x13')](_0xa2a9dc));}switch(_0x4229b3[_0x2182('0xe')]){case'US':_0x1a664f=_0x2182('0x14');break;case'AU':_0x1a664f=_0x2182('0x15');break;case'IN':_0x1a664f='https://accounts.zoho.in';break;case'CN':_0x1a664f=_0x2182('0x16');break;default:_0x1a664f='https://accounts.zoho.eu';break;}var _0x14a434={'method':_0x2182('0x17'),'uri':_0x1a664f+_0x2182('0x18'),'form':{'grant_type':_0x2182('0x19'),'client_id':_0x4229b3[_0x2182('0x1a')],'client_secret':_0x4229b3[_0x2182('0x10')],'redirect_uri':_0x4229b3[_0x2182('0xf')],'code':_0x4229b3['code']},'headers':{'Content-Type':_0x2182('0x1b')}};return rp(_0x14a434)[_0x2182('0x1c')](function(_0x412f3d){var _0x16130f=JSON['parse'](_0x412f3d);if(_0x16130f['refresh_token']){_0x4229b3[_0x2182('0x1d')]=_0x16130f[_0x2182('0x1e')];logger[_0x2182('0x1f')](util[_0x2182('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4229b3[_0x2182('0x21')],_0x4229b3['id']));}else{logger[_0x2182('0x22')](util[_0x2182('0x20')](_0x2182('0x23'),_0x4229b3['name'],_0x4229b3['id']),util['inspect'](_0x16130f,{'showHidden':![],'depth':null}));}return _0x26b0c4(null,_0x48e421);})[_0x2182('0x24')](function(_0xbb998d){logger[_0x2182('0x22')](util['format'](_0x2182('0x23'),_0x4229b3['name'],_0x4229b3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x26b0c4(_0xbb998d);});}else{return _0x26b0c4(null,_0x48e421);}},'beforeUpdate':function(_0x5ba5f0,_0x526daf,_0xc550a7){if(_0x5ba5f0['changed'](_0x2182('0xe'))||_0x5ba5f0[_0x2182('0xd')](_0x2182('0xf'))||_0x5ba5f0[_0x2182('0xd')](_0x2182('0x1a'))||_0x5ba5f0[_0x2182('0xd')](_0x2182('0x10'))||_0x5ba5f0[_0x2182('0xd')](_0x2182('0x11'))||_0x5ba5f0['changed'](_0x2182('0x25'))){var _0x27b806,_0x2db3bb;_0x27b806=_0x5ba5f0[_0x2182('0xf')];var _0x2215f9=_0x27b806['slice'](-0x1);if(_0x2215f9==='/'||_0x2215f9==='\x5c'||_0x2215f9===':'){_0x27b806=_0x27b806[_0x2182('0x26')](0x0,_0x27b806['lastIndexOf'](_0x2215f9));}switch(_0x5ba5f0[_0x2182('0xe')]){case'US':_0x2db3bb=_0x2182('0x14');break;case'AU':_0x2db3bb='https://accounts.zoho.com.au';break;case'IN':_0x2db3bb=_0x2182('0x27');break;case'CN':_0x2db3bb=_0x2182('0x16');break;default:_0x2db3bb=_0x2182('0x28');break;}var _0x567649={'method':_0x2182('0x17'),'uri':_0x2db3bb+_0x2182('0x18'),'form':{'grant_type':_0x2182('0x19'),'client_id':_0x5ba5f0[_0x2182('0x1a')],'client_secret':_0x5ba5f0['clientSecret'],'redirect_uri':_0x5ba5f0[_0x2182('0xf')],'code':_0x5ba5f0[_0x2182('0x11')]},'headers':{'Content-Type':_0x2182('0x1b')}};return rp(_0x567649)['then'](function(_0x5c093c){var _0x5d957c=JSON[_0x2182('0x29')](_0x5c093c);if(_0x5d957c[_0x2182('0x1e')]){_0x5ba5f0[_0x2182('0x1d')]=_0x5d957c[_0x2182('0x1e')];logger[_0x2182('0x1f')](util[_0x2182('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5ba5f0[_0x2182('0x21')],_0x5ba5f0['id']));}else{logger['error'](util[_0x2182('0x20')](_0x2182('0x23'),_0x5ba5f0[_0x2182('0x21')],_0x5ba5f0['id']),util[_0x2182('0x2a')](_0x5d957c,{'showHidden':![],'depth':null}));}return _0xc550a7(null,_0x526daf);})[_0x2182('0x24')](function(_0x51aded){logger[_0x2182('0x22')](util[_0x2182('0x20')](_0x2182('0x23'),_0x5ba5f0['name'],_0x5ba5f0['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xc550a7(_0x51aded);});}else{return _0xc550a7(null,_0x526daf);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c5ae89b..b5dfca7 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 _0x9e63=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetZohoAccount','ZohoAccount','options','raw','where','include','map','model','attributes','find','ShowZohoAccount','stringify','lodash'];(function(_0x2eb4f5,_0x27f316){var _0x4e0896=function(_0x18c57d){while(--_0x18c57d){_0x2eb4f5['push'](_0x2eb4f5['shift']());}};_0x4e0896(++_0x27f316);}(_0x9e63,0x65));var _0x39e6=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x9e63[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var moment=require(_0x39e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x39e6('0x3'));var fs=require('fs');var Redis=require(_0x39e6('0x4'));var db=require(_0x39e6('0x5'))['db'];var utils=require(_0x39e6('0x6'));var logger=require(_0x39e6('0x7'))(_0x39e6('0x8'));var config=require(_0x39e6('0x9'));var jayson=require(_0x39e6('0xa'));var client=jayson['client'][_0x39e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2224,_0x3f2fa2,_0x554392){return new BPromise(function(_0x21938f,_0xddc291){return client['request'](_0x3c2224,_0x554392)[_0x39e6('0xc')](function(_0x4ee158){logger['info'](_0x39e6('0xd'),_0x3f2fa2,_0x39e6('0xe'));logger[_0x39e6('0xf')](_0x39e6('0x10'),_0x3f2fa2,_0x39e6('0xe'),JSON['stringify'](_0x4ee158));if(_0x4ee158['error']){if(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x12')]===0x1f4){logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x4ee158[_0x39e6('0x11')]['message']);return _0xddc291(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x13')]);}logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x4ee158['error']['message']);return _0x21938f(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x13')]);}else{logger[_0x39e6('0x14')](_0x39e6('0xd'),_0x3f2fa2,_0x39e6('0xe'));_0x21938f(_0x4ee158['result'][_0x39e6('0x13')]);}})[_0x39e6('0x15')](function(_0x32ad13){logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x32ad13);_0xddc291(_0x32ad13);});});}exports[_0x39e6('0x16')]=function(_0x1a3adf){var _0x512279=this;return new Promise(function(_0x24a61c,_0x3e6c74){return db[_0x39e6('0x17')]['findAll']({'raw':_0x1a3adf['options']?_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![],'where':_0x1a3adf[_0x39e6('0x18')]?_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x1a')]||null:null,'attributes':_0x1a3adf['options']?_0x1a3adf[_0x39e6('0x18')]['attributes']||null:null,'limit':_0x1a3adf[_0x39e6('0x18')]?_0x1a3adf[_0x39e6('0x18')]['limit']||null:null,'include':_0x1a3adf[_0x39e6('0x18')]?_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x1b')],function(_0x183f33){return{'model':db[_0x183f33[_0x39e6('0x1d')]],'as':_0x183f33['as'],'attributes':_0x183f33[_0x39e6('0x1e')],'include':_0x183f33[_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x183f33[_0x39e6('0x1b')],function(_0x3dce4d){return{'model':db[_0x3dce4d['model']],'as':_0x3dce4d['as'],'attributes':_0x3dce4d[_0x39e6('0x1e')],'include':_0x3dce4d['include']?_['map'](_0x3dce4d[_0x39e6('0x1b')],function(_0x22b820){return{'model':db[_0x22b820[_0x39e6('0x1d')]],'as':_0x22b820['as'],'attributes':_0x22b820[_0x39e6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39de88){logger[_0x39e6('0x14')]('GetZohoAccount',_0x1a3adf);logger[_0x39e6('0xf')](_0x39e6('0x16'),_0x1a3adf,JSON['stringify'](_0x39de88));_0x24a61c(_0x39de88);})[_0x39e6('0x15')](function(_0x2117d0){logger[_0x39e6('0x11')](_0x39e6('0x16'),_0x2117d0[_0x39e6('0x13')],_0x1a3adf);_0x3e6c74(_0x512279['error'](0x1f4,_0x2117d0[_0x39e6('0x13')]));});});};exports['ShowZohoAccount']=function(_0x355ad9){var _0x14c4d3=this;return new Promise(function(_0x3db607,_0x3c01e9){return db[_0x39e6('0x17')][_0x39e6('0x1f')]({'raw':_0x355ad9[_0x39e6('0x18')]?_0x355ad9[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![],'where':_0x355ad9[_0x39e6('0x18')]?_0x355ad9[_0x39e6('0x18')][_0x39e6('0x1a')]||null:null,'attributes':_0x355ad9[_0x39e6('0x18')]?_0x355ad9[_0x39e6('0x18')][_0x39e6('0x1e')]||null:null,'include':_0x355ad9[_0x39e6('0x18')]?_0x355ad9['options'][_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x355ad9[_0x39e6('0x18')]['include'],function(_0x11b0c3){return{'model':db[_0x11b0c3[_0x39e6('0x1d')]],'as':_0x11b0c3['as'],'attributes':_0x11b0c3[_0x39e6('0x1e')],'include':_0x11b0c3['include']?_[_0x39e6('0x1c')](_0x11b0c3['include'],function(_0x15d6db){return{'model':db[_0x15d6db[_0x39e6('0x1d')]],'as':_0x15d6db['as'],'attributes':_0x15d6db[_0x39e6('0x1e')],'include':_0x15d6db['include']?_[_0x39e6('0x1c')](_0x15d6db[_0x39e6('0x1b')],function(_0x45c327){return{'model':db[_0x45c327[_0x39e6('0x1d')]],'as':_0x45c327['as'],'attributes':_0x45c327['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xbe8b5){logger[_0x39e6('0x14')](_0x39e6('0x20'),_0x355ad9);logger[_0x39e6('0xf')](_0x39e6('0x20'),_0x355ad9,JSON[_0x39e6('0x21')](_0xbe8b5));_0x3db607(_0xbe8b5);})[_0x39e6('0x15')](function(_0x4e0a01){logger[_0x39e6('0x11')]('ShowZohoAccount',_0x4e0a01['message'],_0x355ad9);_0x3c01e9(_0x14c4d3[_0x39e6('0x11')](0x1f4,_0x4e0a01[_0x39e6('0x13')]));});});}; \ No newline at end of file +var _0xbbdd=['then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetZohoAccount','options','raw','attributes','limit','include','model','map','ShowZohoAccount','ZohoAccount','find','where','util','bluebird','randomstring','../../config/logger','jayson/promise','client','http','request'];(function(_0x5bce29,_0x3b6ab0){var _0x51b912=function(_0x20e1e5){while(--_0x20e1e5){_0x5bce29['push'](_0x5bce29['shift']());}};_0x51b912(++_0x3b6ab0);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xbbdd[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var moment=require('moment');var BPromise=require(_0xdbbd('0x1'));var rs=require(_0xdbbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbbd('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdbbd('0x4'));var client=jayson[_0xdbbd('0x5')][_0xdbbd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44beae,_0x59b866,_0x42ee02){return new BPromise(function(_0x41e7fe,_0xf5be47){return client[_0xdbbd('0x7')](_0x44beae,_0x42ee02)[_0xdbbd('0x8')](function(_0x38198c){logger[_0xdbbd('0x9')](_0xdbbd('0xa'),_0x59b866,_0xdbbd('0xb'));logger[_0xdbbd('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x59b866,_0xdbbd('0xb'),JSON[_0xdbbd('0xd')](_0x38198c));if(_0x38198c['error']){if(_0x38198c['error']['code']===0x1f4){logger['error'](_0xdbbd('0xa'),_0x59b866,_0x38198c[_0xdbbd('0xe')][_0xdbbd('0xf')]);return _0xf5be47(_0x38198c[_0xdbbd('0xe')][_0xdbbd('0xf')]);}logger[_0xdbbd('0xe')](_0xdbbd('0xa'),_0x59b866,_0x38198c['error'][_0xdbbd('0xf')]);return _0x41e7fe(_0x38198c[_0xdbbd('0xe')]['message']);}else{logger[_0xdbbd('0x9')](_0xdbbd('0xa'),_0x59b866,_0xdbbd('0xb'));_0x41e7fe(_0x38198c[_0xdbbd('0x10')]['message']);}})[_0xdbbd('0x11')](function(_0x4e2c35){logger['error'](_0xdbbd('0xa'),_0x59b866,_0x4e2c35);_0xf5be47(_0x4e2c35);});});}exports[_0xdbbd('0x12')]=function(_0x26eb4c){var _0x315b2d=this;return new Promise(function(_0x322ffc,_0x536a69){return db['ZohoAccount']['findAll']({'raw':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x14')]===undefined?!![]:![]:!![],'where':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')]['where']||null:null,'attributes':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x15')]||null:null,'limit':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x16')]||null:null,'include':_0x26eb4c['options']?_0x26eb4c['options'][_0xdbbd('0x17')]?_['map'](_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x17')],function(_0x14eccf){return{'model':db[_0x14eccf[_0xdbbd('0x18')]],'as':_0x14eccf['as'],'attributes':_0x14eccf['attributes'],'include':_0x14eccf[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x14eccf[_0xdbbd('0x17')],function(_0x5f3f4d){return{'model':db[_0x5f3f4d[_0xdbbd('0x18')]],'as':_0x5f3f4d['as'],'attributes':_0x5f3f4d[_0xdbbd('0x15')],'include':_0x5f3f4d[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x5f3f4d[_0xdbbd('0x17')],function(_0x423ce6){return{'model':db[_0x423ce6['model']],'as':_0x423ce6['as'],'attributes':_0x423ce6[_0xdbbd('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdbbd('0x8')](function(_0xb11f5d){logger[_0xdbbd('0x9')](_0xdbbd('0x12'),_0x26eb4c);logger[_0xdbbd('0xc')](_0xdbbd('0x12'),_0x26eb4c,JSON['stringify'](_0xb11f5d));_0x322ffc(_0xb11f5d);})[_0xdbbd('0x11')](function(_0x52e61f){logger[_0xdbbd('0xe')]('GetZohoAccount',_0x52e61f[_0xdbbd('0xf')],_0x26eb4c);_0x536a69(_0x315b2d[_0xdbbd('0xe')](0x1f4,_0x52e61f['message']));});});};exports[_0xdbbd('0x1a')]=function(_0x2ce1eb){var _0x107c08=this;return new Promise(function(_0x369540,_0x40df71){return db[_0xdbbd('0x1b')][_0xdbbd('0x1c')]({'raw':_0x2ce1eb[_0xdbbd('0x13')]?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x14')]===undefined?!![]:![]:!![],'where':_0x2ce1eb['options']?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x1d')]||null:null,'attributes':_0x2ce1eb[_0xdbbd('0x13')]?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x15')]||null:null,'include':_0x2ce1eb['options']?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x17')],function(_0x5460e7){return{'model':db[_0x5460e7[_0xdbbd('0x18')]],'as':_0x5460e7['as'],'attributes':_0x5460e7[_0xdbbd('0x15')],'include':_0x5460e7[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x5460e7[_0xdbbd('0x17')],function(_0x57aa55){return{'model':db[_0x57aa55[_0xdbbd('0x18')]],'as':_0x57aa55['as'],'attributes':_0x57aa55['attributes'],'include':_0x57aa55[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x57aa55['include'],function(_0x43f0f4){return{'model':db[_0x43f0f4[_0xdbbd('0x18')]],'as':_0x43f0f4['as'],'attributes':_0x43f0f4[_0xdbbd('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdbbd('0x8')](function(_0x4b8c08){logger['info'](_0xdbbd('0x1a'),_0x2ce1eb);logger[_0xdbbd('0xc')](_0xdbbd('0x1a'),_0x2ce1eb,JSON[_0xdbbd('0xd')](_0x4b8c08));_0x369540(_0x4b8c08);})[_0xdbbd('0x11')](function(_0x40e247){logger['error']('ShowZohoAccount',_0x40e247[_0xdbbd('0xf')],_0x2ce1eb);_0x40df71(_0x107c08[_0xdbbd('0xe')](0x1f4,_0x40e247['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d8c1157..5d91a16 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 _0xa879=['/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1f2c67,_0x1bdbc2){var _0x41e1b5=function(_0x579122){while(--_0x579122){_0x1f2c67['push'](_0x1f2c67['shift']());}};_0x41e1b5(++_0x1bdbc2);}(_0xa879,0x1ef));var _0x9a87=function(_0x2510ef,_0x5364d5){_0x2510ef=_0x2510ef-0x0;var _0x2d5c1b=_0xa879[_0x2510ef];return _0x2d5c1b;};'use strict';var multer=require(_0x9a87('0x0'));var util=require(_0x9a87('0x1'));var path=require(_0x9a87('0x2'));var timeout=require(_0x9a87('0x3'));var express=require(_0x9a87('0x4'));var router=express[_0x9a87('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9a87('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a87('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x9a87('0x8')]('/',auth[_0x9a87('0x9')](),controller[_0x9a87('0xa')]);router[_0x9a87('0x8')](_0x9a87('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x9a87('0x9')](),controller[_0x9a87('0xc')]);router['get']('/:id/subjects',auth[_0x9a87('0x9')](),controller[_0x9a87('0xd')]);router[_0x9a87('0x8')](_0x9a87('0xe'),auth[_0x9a87('0x9')](),controller[_0x9a87('0xf')]);router['post']('/',auth[_0x9a87('0x9')](),controller[_0x9a87('0x10')]);router[_0x9a87('0x11')](_0x9a87('0xb'),auth[_0x9a87('0x9')](),controller[_0x9a87('0x12')]);router[_0x9a87('0x13')](_0x9a87('0xb'),auth[_0x9a87('0x9')](),controller[_0x9a87('0x14')]);module[_0x9a87('0x15')]=router; \ No newline at end of file +var _0xbfa2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x9113df,_0x96ca3d){var _0x45b228=function(_0x10fa5a){while(--_0x10fa5a){_0x9113df['push'](_0x9113df['shift']());}};_0x45b228(++_0x96ca3d);}(_0xbfa2,0x1c5));var _0x2bfa=function(_0x505cb9,_0x5414df){_0x505cb9=_0x505cb9-0x0;var _0x3d9d29=_0xbfa2[_0x505cb9];return _0x3d9d29;};'use strict';var multer=require(_0x2bfa('0x0'));var util=require(_0x2bfa('0x1'));var path=require(_0x2bfa('0x2'));var timeout=require(_0x2bfa('0x3'));var express=require(_0x2bfa('0x4'));var router=express[_0x2bfa('0x5')]();var fs_extra=require(_0x2bfa('0x6'));var auth=require(_0x2bfa('0x7'));var interaction=require(_0x2bfa('0x8'));var config=require(_0x2bfa('0x9'));var controller=require(_0x2bfa('0xa'));router['get']('/',auth[_0x2bfa('0xb')](),controller[_0x2bfa('0xc')]);router[_0x2bfa('0xd')](_0x2bfa('0xe'),auth['isAuthenticated'](),controller[_0x2bfa('0xf')]);router[_0x2bfa('0xd')](_0x2bfa('0x10'),auth['isAuthenticated'](),controller[_0x2bfa('0x11')]);router[_0x2bfa('0xd')](_0x2bfa('0x12'),auth['isAuthenticated'](),controller[_0x2bfa('0x13')]);router[_0x2bfa('0xd')](_0x2bfa('0x14'),auth[_0x2bfa('0xb')](),controller[_0x2bfa('0x15')]);router[_0x2bfa('0x16')]('/',auth[_0x2bfa('0xb')](),controller[_0x2bfa('0x17')]);router[_0x2bfa('0x18')](_0x2bfa('0xe'),auth['isAuthenticated'](),controller[_0x2bfa('0x19')]);router['delete'](_0x2bfa('0xe'),auth[_0x2bfa('0xb')](),controller['destroy']);module[_0x2bfa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index db76eac..fb60e39 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 _0xb0b4=['sequelize','ENUM','lead','nothing','contact_lead','contact','STRING'];(function(_0xb1ee0e,_0x2126df){var _0x376116=function(_0x44b7ad){while(--_0x44b7ad){_0xb1ee0e['push'](_0xb1ee0e['shift']());}};_0x376116(++_0x2126df);}(_0xb0b4,0xb6));var _0x4b0b=function(_0x2942c3,_0x401efb){_0x2942c3=_0x2942c3-0x0;var _0x1f4fc4=_0xb0b4[_0x2942c3];return _0x1f4fc4;};'use strict';var Sequelize=require(_0x4b0b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x4b0b('0x1')](_0x4b0b('0x2'),'contact',_0x4b0b('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x4b0b('0x1')](_0x4b0b('0x4'),_0x4b0b('0x5'),_0x4b0b('0x2')),'defaultValue':_0x4b0b('0x4')},'description':{'type':Sequelize[_0x4b0b('0x6')]}}; \ No newline at end of file +var _0xf88f=['contact','nothing','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x4af04a,_0x5ac4b7){var _0x5ad7c9=function(_0x2e0698){while(--_0x2e0698){_0x4af04a['push'](_0x4af04a['shift']());}};_0x5ad7c9(++_0x5ac4b7);}(_0xf88f,0x1bb));var _0xff88=function(_0x1ded50,_0x294aff){_0x1ded50=_0x1ded50-0x0;var _0x3ced26=_0xf88f[_0x1ded50];return _0x3ced26;};'use strict';var Sequelize=require(_0xff88('0x0'));module[_0xff88('0x1')]={'name':{'type':Sequelize[_0xff88('0x2')]},'moduleCreate':{'type':Sequelize[_0xff88('0x3')](_0xff88('0x4'),_0xff88('0x5'),_0xff88('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xff88('0x3')](_0xff88('0x7'),_0xff88('0x5'),'lead'),'defaultValue':_0xff88('0x7')},'description':{'type':Sequelize[_0xff88('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 79094a0..526322d 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 _0x20e5=['key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ZohoConfiguration','count','includeAll','include','show','params','find','catch','create','body','destroy','ZohoField','order','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','status','set','apply','update','then','error','stack','name','send','index','map','rawAttributes'];(function(_0x84cd25,_0x56dbab){var _0x492299=function(_0x410830){while(--_0x410830){_0x84cd25['push'](_0x84cd25['shift']());}};_0x492299(++_0x56dbab);}(_0x20e5,0x168));var _0x520e=function(_0x3a93f2,_0x2b6893){_0x3a93f2=_0x3a93f2-0x0;var _0x3aa2ab=_0x20e5[_0x3a93f2];return _0x3aa2ab;};'use strict';var emlformat=require(_0x520e('0x0'));var rimraf=require(_0x520e('0x1'));var zipdir=require(_0x520e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x520e('0x3'));var moment=require(_0x520e('0x4'));var BPromise=require(_0x520e('0x5'));var Mustache=require(_0x520e('0x6'));var util=require(_0x520e('0x7'));var path=require(_0x520e('0x8'));var sox=require(_0x520e('0x9'));var csv=require(_0x520e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x520e('0xb'));var squel=require(_0x520e('0xc'));var crypto=require('crypto');var jsforce=require(_0x520e('0xd'));var deskjs=require(_0x520e('0xe'));var toCsv=require(_0x520e('0xa'));var querystring=require(_0x520e('0xf'));var Papa=require('papaparse');var Redis=require(_0x520e('0x10'));var authService=require(_0x520e('0x11'));var qs=require(_0x520e('0x12'));var as=require(_0x520e('0x13'));var hardwareService=require(_0x520e('0x14'));var logger=require(_0x520e('0x15'))(_0x520e('0x16'));var utils=require(_0x520e('0x17'));var config=require(_0x520e('0x18'));var licenseUtil=require(_0x520e('0x19'));var db=require(_0x520e('0x1a'))['db'];function respondWithStatusCode(_0x1d38c7,_0xadc66){_0xadc66=_0xadc66||0xcc;return function(_0x4e26fb){if(_0x4e26fb){return _0x1d38c7[_0x520e('0x1b')](_0xadc66);}return _0x1d38c7['status'](_0xadc66)[_0x520e('0x1c')]();};}function respondWithResult(_0xf12aad,_0x5e7e7b){_0x5e7e7b=_0x5e7e7b||0xc8;return function(_0x5369f6){if(_0x5369f6){return _0xf12aad['status'](_0x5e7e7b)[_0x520e('0x1d')](_0x5369f6);}};}function respondWithFilteredResult(_0x1bbbbf,_0x208031){return function(_0x2f89b9){if(_0x2f89b9){var _0x3b1104=typeof _0x208031['offset']===_0x520e('0x1e')&&typeof _0x208031[_0x520e('0x1f')]===_0x520e('0x1e');var _0xf749bb=_0x2f89b9['count'];var _0x3ef290=_0x3b1104?0x0:_0x208031[_0x520e('0x20')];var _0x2d8121=_0x3b1104?_0x2f89b9['count']:_0x208031['offset']+_0x208031[_0x520e('0x1f')];var _0xc09c45;if(_0x2d8121>=_0xf749bb){_0x2d8121=_0xf749bb;_0xc09c45=0xc8;}else{_0xc09c45=0xce;}_0x1bbbbf[_0x520e('0x21')](_0xc09c45);return _0x1bbbbf[_0x520e('0x22')]('Content-Range',_0x3ef290+'-'+_0x2d8121+'/'+_0xf749bb)[_0x520e('0x1d')](_0x2f89b9);}return null;};}function patchUpdates(_0x5ecb84){return function(_0x4935f9){try{jsonpatch[_0x520e('0x23')](_0x4935f9,_0x5ecb84,!![]);}catch(_0xe7a179){return BPromise['reject'](_0xe7a179);}return _0x4935f9['save']();};}function saveUpdates(_0x248e7f,_0x5519a7){return function(_0xb90ed4){if(_0xb90ed4){return _0xb90ed4[_0x520e('0x24')](_0x248e7f)[_0x520e('0x25')](function(_0x31996d){return _0x31996d;});}return null;};}function removeEntity(_0xe4815d,_0x5cc652){return function(_0x45507f){if(_0x45507f){return _0x45507f['destroy']()[_0x520e('0x25')](function(){_0xe4815d['status'](0xcc)[_0x520e('0x1c')]();});}};}function handleEntityNotFound(_0x1f8a10,_0x199089){return function(_0x3271fb){if(!_0x3271fb){_0x1f8a10[_0x520e('0x1b')](0x194);}return _0x3271fb;};}function handleError(_0x157093,_0xa6c488){_0xa6c488=_0xa6c488||0x1f4;return function(_0x44dc99){logger[_0x520e('0x26')](_0x44dc99[_0x520e('0x27')]);if(_0x44dc99[_0x520e('0x28')]){delete _0x44dc99[_0x520e('0x28')];}_0x157093[_0x520e('0x21')](_0xa6c488)[_0x520e('0x29')](_0x44dc99);};}exports[_0x520e('0x2a')]=function(_0xf27f,_0x7ddb41){var _0x3c4b67={},_0x5b1ef6={},_0x5c55a8={'count':0x0,'rows':[]};var _0xb6e828=_[_0x520e('0x2b')](db['ZohoConfiguration'][_0x520e('0x2c')],function(_0xd8ec16){return{'name':_0xd8ec16['fieldName'],'type':_0xd8ec16['type'][_0x520e('0x2d')]};});_0x5b1ef6['model']=_['map'](_0xb6e828,_0x520e('0x28'));_0x5b1ef6[_0x520e('0x2e')]=_[_0x520e('0x2f')](_0xf27f['query']);_0x5b1ef6['filters']=_[_0x520e('0x30')](_0x5b1ef6[_0x520e('0x31')],_0x5b1ef6[_0x520e('0x2e')]);_0x3c4b67[_0x520e('0x32')]=_[_0x520e('0x30')](_0x5b1ef6['model'],qs[_0x520e('0x33')](_0xf27f[_0x520e('0x2e')][_0x520e('0x33')]));_0x3c4b67[_0x520e('0x32')]=_0x3c4b67[_0x520e('0x32')][_0x520e('0x34')]?_0x3c4b67[_0x520e('0x32')]:_0x5b1ef6[_0x520e('0x31')];if(!_0xf27f[_0x520e('0x2e')][_0x520e('0x35')](_0x520e('0x36'))){_0x3c4b67[_0x520e('0x1f')]=qs[_0x520e('0x1f')](_0xf27f[_0x520e('0x2e')][_0x520e('0x1f')]);_0x3c4b67[_0x520e('0x20')]=qs[_0x520e('0x20')](_0xf27f[_0x520e('0x2e')]['offset']);}_0x3c4b67['order']=qs[_0x520e('0x37')](_0xf27f[_0x520e('0x2e')]['sort']);_0x3c4b67[_0x520e('0x38')]=qs[_0x520e('0x39')](_[_0x520e('0x3a')](_0xf27f[_0x520e('0x2e')],_0x5b1ef6['filters']),_0xb6e828);if(_0xf27f[_0x520e('0x2e')][_0x520e('0x3b')]){_0x3c4b67[_0x520e('0x38')]=_[_0x520e('0x3c')](_0x3c4b67[_0x520e('0x38')],{'$or':_['map'](_0xb6e828,function(_0x5f4259){if(_0x5f4259[_0x520e('0x3d')]!==_0x520e('0x3e')){var _0x4deb8a={};_0x4deb8a[_0x5f4259[_0x520e('0x28')]]={'$like':'%'+_0xf27f[_0x520e('0x2e')]['filter']+'%'};return _0x4deb8a;}})});}_0x3c4b67=_[_0x520e('0x3c')]({},_0x3c4b67,_0xf27f[_0x520e('0x3f')]);var _0x344fa3={'where':_0x3c4b67['where']};return db[_0x520e('0x40')][_0x520e('0x41')](_0x344fa3)[_0x520e('0x25')](function(_0x29382e){_0x5c55a8[_0x520e('0x41')]=_0x29382e;if(_0xf27f[_0x520e('0x2e')][_0x520e('0x42')]){_0x3c4b67[_0x520e('0x43')]=[{'all':!![]}];}return db[_0x520e('0x40')]['findAll'](_0x3c4b67);})[_0x520e('0x25')](function(_0x3e37c4){_0x5c55a8['rows']=_0x3e37c4;return _0x5c55a8;})[_0x520e('0x25')](respondWithFilteredResult(_0x7ddb41,_0x3c4b67))['catch'](handleError(_0x7ddb41,null));};exports[_0x520e('0x44')]=function(_0x4a0314,_0x3ecad4){var _0xfb4537={'raw':![],'where':{'id':_0x4a0314[_0x520e('0x45')]['id']}},_0xd965f={};_0xd965f['model']=_[_0x520e('0x2f')](db['ZohoConfiguration'][_0x520e('0x2c')]);_0xd965f[_0x520e('0x2e')]=_[_0x520e('0x2f')](_0x4a0314[_0x520e('0x2e')]);_0xd965f[_0x520e('0x39')]=_['intersection'](_0xd965f[_0x520e('0x31')],_0xd965f[_0x520e('0x2e')]);_0xfb4537[_0x520e('0x32')]=_['intersection'](_0xd965f[_0x520e('0x31')],qs[_0x520e('0x33')](_0x4a0314['query'][_0x520e('0x33')]));_0xfb4537[_0x520e('0x32')]=_0xfb4537['attributes'][_0x520e('0x34')]?_0xfb4537[_0x520e('0x32')]:_0xd965f[_0x520e('0x31')];if(_0x4a0314[_0x520e('0x2e')][_0x520e('0x42')]){_0xfb4537[_0x520e('0x43')]=[{'all':!![]}];}_0xfb4537=_['merge']({},_0xfb4537,_0x4a0314[_0x520e('0x3f')]);return db['ZohoConfiguration'][_0x520e('0x46')](_0xfb4537)[_0x520e('0x25')](handleEntityNotFound(_0x3ecad4,null))[_0x520e('0x25')](respondWithResult(_0x3ecad4,null))[_0x520e('0x47')](handleError(_0x3ecad4,null));};exports[_0x520e('0x48')]=function(_0x311764,_0x29b504){return db[_0x520e('0x40')][_0x520e('0x48')](_0x311764['body'],{})['then'](respondWithResult(_0x29b504,0xc9))[_0x520e('0x47')](handleError(_0x29b504,null));};exports[_0x520e('0x24')]=function(_0x36e4d2,_0x42b1d0){if(_0x36e4d2[_0x520e('0x49')]['id']){delete _0x36e4d2[_0x520e('0x49')]['id'];}return db[_0x520e('0x40')][_0x520e('0x46')]({'where':{'id':_0x36e4d2['params']['id']}})[_0x520e('0x25')](handleEntityNotFound(_0x42b1d0,null))[_0x520e('0x25')](saveUpdates(_0x36e4d2['body'],null))[_0x520e('0x25')](respondWithResult(_0x42b1d0,null))['catch'](handleError(_0x42b1d0,null));};exports[_0x520e('0x4a')]=function(_0x48e176,_0x1fc991){return db[_0x520e('0x40')]['find']({'where':{'id':_0x48e176[_0x520e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fc991,null))[_0x520e('0x25')](removeEntity(_0x1fc991,null))['catch'](handleError(_0x1fc991,null));};exports['getFields']=function(_0x19e435,_0x3939f4,_0x20093a){var _0x116c90={};var _0x11eec1={};var _0x30f282;var _0x51d646;return db[_0x520e('0x40')]['findOne']({'where':{'id':_0x19e435[_0x520e('0x45')]['id']}})[_0x520e('0x25')](handleEntityNotFound(_0x3939f4,null))[_0x520e('0x25')](function(_0x2b0353){if(_0x2b0353){_0x30f282=_0x2b0353;_0x11eec1[_0x520e('0x31')]=_[_0x520e('0x2f')](db[_0x520e('0x4b')]['rawAttributes']);_0x11eec1[_0x520e('0x2e')]=_['keys'](_0x19e435['query']);_0x11eec1[_0x520e('0x39')]=_[_0x520e('0x30')](_0x11eec1[_0x520e('0x31')],_0x11eec1['query']);_0x116c90[_0x520e('0x32')]=_[_0x520e('0x30')](_0x11eec1[_0x520e('0x31')],qs[_0x520e('0x33')](_0x19e435['query']['fields']));_0x116c90[_0x520e('0x32')]=_0x116c90[_0x520e('0x32')][_0x520e('0x34')]?_0x116c90[_0x520e('0x32')]:_0x11eec1[_0x520e('0x31')];_0x116c90[_0x520e('0x4c')]=qs[_0x520e('0x37')](_0x19e435[_0x520e('0x2e')][_0x520e('0x37')]);_0x116c90[_0x520e('0x38')]=qs[_0x520e('0x39')](_[_0x520e('0x3a')](_0x19e435[_0x520e('0x2e')],_0x11eec1['filters']));if(_0x19e435['query']['filter']){_0x116c90[_0x520e('0x38')]=_['merge'](_0x116c90['where'],{'$or':_[_0x520e('0x2b')](_0x116c90[_0x520e('0x32')],function(_0x4045c2){var _0x5a1ffc={};_0x5a1ffc[_0x4045c2]={'$like':'%'+_0x19e435['query'][_0x520e('0x3b')]+'%'};return _0x5a1ffc;})});}_0x116c90=_[_0x520e('0x3c')]({},_0x116c90,_0x19e435[_0x520e('0x3f')]);return _0x30f282[_0x520e('0x4d')](_0x116c90);}})[_0x520e('0x25')](function(_0x2c3832){if(_0x2c3832){_0x51d646=_0x2c3832[_0x520e('0x34')];if(!_0x19e435[_0x520e('0x2e')]['hasOwnProperty'](_0x520e('0x36'))){_0x116c90[_0x520e('0x1f')]=qs['limit'](_0x19e435[_0x520e('0x2e')][_0x520e('0x1f')]);_0x116c90['offset']=qs[_0x520e('0x20')](_0x19e435['query']['offset']);}return _0x30f282[_0x520e('0x4d')](_0x116c90);}})[_0x520e('0x25')](function(_0x2cdd72){if(_0x2cdd72){return _0x2cdd72?{'count':_0x51d646,'rows':_0x2cdd72}:null;}})[_0x520e('0x25')](respondWithResult(_0x3939f4,null))[_0x520e('0x47')](handleError(_0x3939f4,null));};exports[_0x520e('0x4e')]=function(_0xdb5894,_0x1e511a,_0x212af0){var _0x94ddcb={};var _0x5b651a={};var _0x2dbcae;var _0x540514;return db[_0x520e('0x40')][_0x520e('0x4f')]({'where':{'id':_0xdb5894[_0x520e('0x45')]['id']}})[_0x520e('0x25')](handleEntityNotFound(_0x1e511a,null))[_0x520e('0x25')](function(_0x321120){if(_0x321120){_0x2dbcae=_0x321120;_0x5b651a[_0x520e('0x31')]=_['keys'](db['ZohoField'][_0x520e('0x2c')]);_0x5b651a[_0x520e('0x2e')]=_[_0x520e('0x2f')](_0xdb5894[_0x520e('0x2e')]);_0x5b651a[_0x520e('0x39')]=_['intersection'](_0x5b651a[_0x520e('0x31')],_0x5b651a['query']);_0x94ddcb[_0x520e('0x32')]=_[_0x520e('0x30')](_0x5b651a[_0x520e('0x31')],qs[_0x520e('0x33')](_0xdb5894[_0x520e('0x2e')][_0x520e('0x33')]));_0x94ddcb[_0x520e('0x32')]=_0x94ddcb[_0x520e('0x32')]['length']?_0x94ddcb[_0x520e('0x32')]:_0x5b651a[_0x520e('0x31')];_0x94ddcb[_0x520e('0x4c')]=qs[_0x520e('0x37')](_0xdb5894['query'][_0x520e('0x37')]);_0x94ddcb[_0x520e('0x38')]=qs[_0x520e('0x39')](_[_0x520e('0x3a')](_0xdb5894[_0x520e('0x2e')],_0x5b651a[_0x520e('0x39')]));if(_0xdb5894[_0x520e('0x2e')]['filter']){_0x94ddcb[_0x520e('0x38')]=_[_0x520e('0x3c')](_0x94ddcb['where'],{'$or':_[_0x520e('0x2b')](_0x94ddcb[_0x520e('0x32')],function(_0x49be83){var _0x2ff608={};_0x2ff608[_0x49be83]={'$like':'%'+_0xdb5894[_0x520e('0x2e')][_0x520e('0x3b')]+'%'};return _0x2ff608;})});}_0x94ddcb=_[_0x520e('0x3c')]({},_0x94ddcb,_0xdb5894[_0x520e('0x3f')]);return _0x2dbcae[_0x520e('0x4e')](_0x94ddcb);}})[_0x520e('0x25')](function(_0xb2bec6){if(_0xb2bec6){_0x540514=_0xb2bec6['length'];if(!_0xdb5894[_0x520e('0x2e')][_0x520e('0x35')](_0x520e('0x36'))){_0x94ddcb[_0x520e('0x1f')]=qs['limit'](_0xdb5894['query'][_0x520e('0x1f')]);_0x94ddcb[_0x520e('0x20')]=qs[_0x520e('0x20')](_0xdb5894[_0x520e('0x2e')][_0x520e('0x20')]);}return _0x2dbcae[_0x520e('0x4e')](_0x94ddcb);}})['then'](function(_0x2e7cfd){if(_0x2e7cfd){return _0x2e7cfd?{'count':_0x540514,'rows':_0x2e7cfd}:null;}})['then'](respondWithResult(_0x1e511a,null))[_0x520e('0x47')](handleError(_0x1e511a,null));};exports[_0x520e('0x50')]=function(_0x431d4c,_0x59ae26,_0xcd2755){var _0x1ba0a1={};var _0x46cf29={};var _0x69d7ae;var _0x61006;return db[_0x520e('0x40')]['findOne']({'where':{'id':_0x431d4c[_0x520e('0x45')]['id']}})[_0x520e('0x25')](handleEntityNotFound(_0x59ae26,null))[_0x520e('0x25')](function(_0x5bae6e){if(_0x5bae6e){_0x69d7ae=_0x5bae6e;_0x46cf29[_0x520e('0x31')]=_[_0x520e('0x2f')](db['ZohoField'][_0x520e('0x2c')]);_0x46cf29[_0x520e('0x2e')]=_[_0x520e('0x2f')](_0x431d4c['query']);_0x46cf29[_0x520e('0x39')]=_[_0x520e('0x30')](_0x46cf29[_0x520e('0x31')],_0x46cf29['query']);_0x1ba0a1['attributes']=_[_0x520e('0x30')](_0x46cf29[_0x520e('0x31')],qs['fields'](_0x431d4c[_0x520e('0x2e')][_0x520e('0x33')]));_0x1ba0a1['attributes']=_0x1ba0a1['attributes'][_0x520e('0x34')]?_0x1ba0a1[_0x520e('0x32')]:_0x46cf29[_0x520e('0x31')];_0x1ba0a1[_0x520e('0x4c')]=qs['sort'](_0x431d4c[_0x520e('0x2e')][_0x520e('0x37')]);_0x1ba0a1[_0x520e('0x38')]=qs[_0x520e('0x39')](_['pick'](_0x431d4c[_0x520e('0x2e')],_0x46cf29[_0x520e('0x39')]));if(_0x431d4c['query']['filter']){_0x1ba0a1[_0x520e('0x38')]=_[_0x520e('0x3c')](_0x1ba0a1[_0x520e('0x38')],{'$or':_[_0x520e('0x2b')](_0x1ba0a1[_0x520e('0x32')],function(_0x5d54d1){var _0xdaadf4={};_0xdaadf4[_0x5d54d1]={'$like':'%'+_0x431d4c[_0x520e('0x2e')][_0x520e('0x3b')]+'%'};return _0xdaadf4;})});}_0x1ba0a1=_[_0x520e('0x3c')]({},_0x1ba0a1,_0x431d4c[_0x520e('0x3f')]);return _0x69d7ae['getDescriptions'](_0x1ba0a1);}})[_0x520e('0x25')](function(_0x1ca719){if(_0x1ca719){_0x61006=_0x1ca719[_0x520e('0x34')];if(!_0x431d4c[_0x520e('0x2e')][_0x520e('0x35')](_0x520e('0x36'))){_0x1ba0a1[_0x520e('0x1f')]=qs[_0x520e('0x1f')](_0x431d4c[_0x520e('0x2e')]['limit']);_0x1ba0a1[_0x520e('0x20')]=qs['offset'](_0x431d4c['query'][_0x520e('0x20')]);}return _0x69d7ae[_0x520e('0x50')](_0x1ba0a1);}})[_0x520e('0x25')](function(_0x2914d6){if(_0x2914d6){return _0x2914d6?{'count':_0x61006,'rows':_0x2914d6}:null;}})[_0x520e('0x25')](respondWithResult(_0x59ae26,null))[_0x520e('0x47')](handleError(_0x59ae26,null));}; \ No newline at end of file +var _0x0e69=['find','create','body','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x54072a,_0x392baa){var _0x1f50c3=function(_0x26165a){while(--_0x26165a){_0x54072a['push'](_0x54072a['shift']());}};_0x1f50c3(++_0x392baa);}(_0x0e69,0xb5));var _0x90e6=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x0e69[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0x90e6('0x0'));var rimraf=require(_0x90e6('0x1'));var zipdir=require(_0x90e6('0x2'));var jsonpatch=require(_0x90e6('0x3'));var rp=require(_0x90e6('0x4'));var moment=require(_0x90e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x90e6('0x6'));var util=require(_0x90e6('0x7'));var path=require('path');var sox=require(_0x90e6('0x8'));var csv=require(_0x90e6('0x9'));var ejs=require(_0x90e6('0xa'));var fs=require('fs');var fs_extra=require(_0x90e6('0xb'));var _=require(_0x90e6('0xc'));var squel=require('squel');var crypto=require(_0x90e6('0xd'));var jsforce=require(_0x90e6('0xe'));var deskjs=require(_0x90e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x90e6('0x10'));var Papa=require(_0x90e6('0x11'));var Redis=require(_0x90e6('0x12'));var authService=require(_0x90e6('0x13'));var qs=require(_0x90e6('0x14'));var as=require(_0x90e6('0x15'));var hardwareService=require(_0x90e6('0x16'));var logger=require(_0x90e6('0x17'))(_0x90e6('0x18'));var utils=require(_0x90e6('0x19'));var config=require(_0x90e6('0x1a'));var licenseUtil=require(_0x90e6('0x1b'));var db=require(_0x90e6('0x1c'))['db'];function respondWithStatusCode(_0x2aeaa9,_0x2bc66f){_0x2bc66f=_0x2bc66f||0xcc;return function(_0x2d4a88){if(_0x2d4a88){return _0x2aeaa9[_0x90e6('0x1d')](_0x2bc66f);}return _0x2aeaa9['status'](_0x2bc66f)[_0x90e6('0x1e')]();};}function respondWithResult(_0x12dcf8,_0x4fe645){_0x4fe645=_0x4fe645||0xc8;return function(_0xb7c889){if(_0xb7c889){return _0x12dcf8[_0x90e6('0x1f')](_0x4fe645)['json'](_0xb7c889);}};}function respondWithFilteredResult(_0x4cbd74,_0x284e82){return function(_0x503382){if(_0x503382){var _0x58c6b0=typeof _0x284e82[_0x90e6('0x20')]==='undefined'&&typeof _0x284e82[_0x90e6('0x21')]===_0x90e6('0x22');var _0x58a966=_0x503382[_0x90e6('0x23')];var _0x355a9d=_0x58c6b0?0x0:_0x284e82[_0x90e6('0x20')];var _0x233eb5=_0x58c6b0?_0x503382[_0x90e6('0x23')]:_0x284e82['offset']+_0x284e82['limit'];var _0xdf386d;if(_0x233eb5>=_0x58a966){_0x233eb5=_0x58a966;_0xdf386d=0xc8;}else{_0xdf386d=0xce;}_0x4cbd74['status'](_0xdf386d);return _0x4cbd74[_0x90e6('0x24')]('Content-Range',_0x355a9d+'-'+_0x233eb5+'/'+_0x58a966)['json'](_0x503382);}return null;};}function patchUpdates(_0x2ce950){return function(_0x5922d0){try{jsonpatch[_0x90e6('0x25')](_0x5922d0,_0x2ce950,!![]);}catch(_0x1a1fe7){return BPromise[_0x90e6('0x26')](_0x1a1fe7);}return _0x5922d0['save']();};}function saveUpdates(_0x4130f3,_0x46fd5f){return function(_0x3e7e46){if(_0x3e7e46){return _0x3e7e46[_0x90e6('0x27')](_0x4130f3)['then'](function(_0x562138){return _0x562138;});}return null;};}function removeEntity(_0x1efd46,_0x3127c4){return function(_0x56eafe){if(_0x56eafe){return _0x56eafe[_0x90e6('0x28')]()[_0x90e6('0x29')](function(){_0x1efd46[_0x90e6('0x1f')](0xcc)[_0x90e6('0x1e')]();});}};}function handleEntityNotFound(_0x34dade,_0x381ab0){return function(_0x640d5c){if(!_0x640d5c){_0x34dade['sendStatus'](0x194);}return _0x640d5c;};}function handleError(_0x574e21,_0xb6a763){_0xb6a763=_0xb6a763||0x1f4;return function(_0x2b02e6){logger[_0x90e6('0x2a')](_0x2b02e6[_0x90e6('0x2b')]);if(_0x2b02e6[_0x90e6('0x2c')]){delete _0x2b02e6['name'];}_0x574e21[_0x90e6('0x1f')](_0xb6a763)[_0x90e6('0x2d')](_0x2b02e6);};}exports[_0x90e6('0x2e')]=function(_0x39bd37,_0x4fcc23){var _0x7467c8={},_0x49f061={},_0x3a120e={'count':0x0,'rows':[]};var _0x1b4b8c=_[_0x90e6('0x2f')](db[_0x90e6('0x30')][_0x90e6('0x31')],function(_0x3b2777){return{'name':_0x3b2777[_0x90e6('0x32')],'type':_0x3b2777[_0x90e6('0x33')][_0x90e6('0x34')]};});_0x49f061[_0x90e6('0x35')]=_['map'](_0x1b4b8c,_0x90e6('0x2c'));_0x49f061['query']=_['keys'](_0x39bd37['query']);_0x49f061[_0x90e6('0x36')]=_[_0x90e6('0x37')](_0x49f061[_0x90e6('0x35')],_0x49f061[_0x90e6('0x38')]);_0x7467c8[_0x90e6('0x39')]=_['intersection'](_0x49f061[_0x90e6('0x35')],qs[_0x90e6('0x3a')](_0x39bd37[_0x90e6('0x38')][_0x90e6('0x3a')]));_0x7467c8[_0x90e6('0x39')]=_0x7467c8['attributes'][_0x90e6('0x3b')]?_0x7467c8[_0x90e6('0x39')]:_0x49f061[_0x90e6('0x35')];if(!_0x39bd37['query'][_0x90e6('0x3c')](_0x90e6('0x3d'))){_0x7467c8[_0x90e6('0x21')]=qs[_0x90e6('0x21')](_0x39bd37[_0x90e6('0x38')]['limit']);_0x7467c8[_0x90e6('0x20')]=qs[_0x90e6('0x20')](_0x39bd37['query']['offset']);}_0x7467c8[_0x90e6('0x3e')]=qs[_0x90e6('0x3f')](_0x39bd37['query'][_0x90e6('0x3f')]);_0x7467c8[_0x90e6('0x40')]=qs[_0x90e6('0x36')](_[_0x90e6('0x41')](_0x39bd37[_0x90e6('0x38')],_0x49f061[_0x90e6('0x36')]),_0x1b4b8c);if(_0x39bd37['query'][_0x90e6('0x42')]){_0x7467c8[_0x90e6('0x40')]=_[_0x90e6('0x43')](_0x7467c8[_0x90e6('0x40')],{'$or':_['map'](_0x1b4b8c,function(_0x54a40d){if(_0x54a40d[_0x90e6('0x33')]!==_0x90e6('0x44')){var _0x1a63b8={};_0x1a63b8[_0x54a40d[_0x90e6('0x2c')]]={'$like':'%'+_0x39bd37['query'][_0x90e6('0x42')]+'%'};return _0x1a63b8;}})});}_0x7467c8=_['merge']({},_0x7467c8,_0x39bd37[_0x90e6('0x45')]);var _0x189ae6={'where':_0x7467c8[_0x90e6('0x40')]};return db[_0x90e6('0x30')][_0x90e6('0x23')](_0x189ae6)['then'](function(_0x3a5505){_0x3a120e[_0x90e6('0x23')]=_0x3a5505;if(_0x39bd37[_0x90e6('0x38')][_0x90e6('0x46')]){_0x7467c8[_0x90e6('0x47')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x90e6('0x48')](_0x7467c8);})['then'](function(_0x142c69){_0x3a120e[_0x90e6('0x49')]=_0x142c69;return _0x3a120e;})['then'](respondWithFilteredResult(_0x4fcc23,_0x7467c8))[_0x90e6('0x4a')](handleError(_0x4fcc23,null));};exports[_0x90e6('0x4b')]=function(_0x345f74,_0x1dbc19){var _0x255ecf={'raw':![],'where':{'id':_0x345f74['params']['id']}},_0x3b6c68={};_0x3b6c68[_0x90e6('0x35')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x3b6c68['query']=_[_0x90e6('0x4c')](_0x345f74[_0x90e6('0x38')]);_0x3b6c68['filters']=_[_0x90e6('0x37')](_0x3b6c68[_0x90e6('0x35')],_0x3b6c68[_0x90e6('0x38')]);_0x255ecf[_0x90e6('0x39')]=_[_0x90e6('0x37')](_0x3b6c68[_0x90e6('0x35')],qs[_0x90e6('0x3a')](_0x345f74['query'][_0x90e6('0x3a')]));_0x255ecf['attributes']=_0x255ecf['attributes'][_0x90e6('0x3b')]?_0x255ecf[_0x90e6('0x39')]:_0x3b6c68[_0x90e6('0x35')];if(_0x345f74[_0x90e6('0x38')][_0x90e6('0x46')]){_0x255ecf['include']=[{'all':!![]}];}_0x255ecf=_[_0x90e6('0x43')]({},_0x255ecf,_0x345f74['options']);return db[_0x90e6('0x30')][_0x90e6('0x4d')](_0x255ecf)[_0x90e6('0x29')](handleEntityNotFound(_0x1dbc19,null))[_0x90e6('0x29')](respondWithResult(_0x1dbc19,null))[_0x90e6('0x4a')](handleError(_0x1dbc19,null));};exports[_0x90e6('0x4e')]=function(_0x3e3b65,_0x4e11ed){return db[_0x90e6('0x30')][_0x90e6('0x4e')](_0x3e3b65[_0x90e6('0x4f')],{})[_0x90e6('0x29')](respondWithResult(_0x4e11ed,0xc9))[_0x90e6('0x4a')](handleError(_0x4e11ed,null));};exports['update']=function(_0x1b91f1,_0x20ed4d){if(_0x1b91f1[_0x90e6('0x4f')]['id']){delete _0x1b91f1['body']['id'];}return db[_0x90e6('0x30')][_0x90e6('0x4d')]({'where':{'id':_0x1b91f1['params']['id']}})[_0x90e6('0x29')](handleEntityNotFound(_0x20ed4d,null))[_0x90e6('0x29')](saveUpdates(_0x1b91f1[_0x90e6('0x4f')],null))['then'](respondWithResult(_0x20ed4d,null))[_0x90e6('0x4a')](handleError(_0x20ed4d,null));};exports['destroy']=function(_0x16b8ba,_0x43c08c){return db[_0x90e6('0x30')][_0x90e6('0x4d')]({'where':{'id':_0x16b8ba[_0x90e6('0x50')]['id']}})[_0x90e6('0x29')](handleEntityNotFound(_0x43c08c,null))[_0x90e6('0x29')](removeEntity(_0x43c08c,null))[_0x90e6('0x4a')](handleError(_0x43c08c,null));};exports[_0x90e6('0x51')]=function(_0x104fe9,_0x27b387,_0x28be43){var _0x1e2113={};var _0x1f49c0={};var _0x17600b;var _0x428f1f;return db[_0x90e6('0x30')][_0x90e6('0x52')]({'where':{'id':_0x104fe9[_0x90e6('0x50')]['id']}})['then'](handleEntityNotFound(_0x27b387,null))[_0x90e6('0x29')](function(_0x583193){if(_0x583193){_0x17600b=_0x583193;_0x1f49c0[_0x90e6('0x35')]=_['keys'](db['ZohoField'][_0x90e6('0x31')]);_0x1f49c0['query']=_[_0x90e6('0x4c')](_0x104fe9[_0x90e6('0x38')]);_0x1f49c0[_0x90e6('0x36')]=_[_0x90e6('0x37')](_0x1f49c0[_0x90e6('0x35')],_0x1f49c0[_0x90e6('0x38')]);_0x1e2113['attributes']=_[_0x90e6('0x37')](_0x1f49c0[_0x90e6('0x35')],qs[_0x90e6('0x3a')](_0x104fe9[_0x90e6('0x38')][_0x90e6('0x3a')]));_0x1e2113[_0x90e6('0x39')]=_0x1e2113[_0x90e6('0x39')]['length']?_0x1e2113[_0x90e6('0x39')]:_0x1f49c0[_0x90e6('0x35')];_0x1e2113[_0x90e6('0x3e')]=qs[_0x90e6('0x3f')](_0x104fe9[_0x90e6('0x38')][_0x90e6('0x3f')]);_0x1e2113['where']=qs['filters'](_['pick'](_0x104fe9[_0x90e6('0x38')],_0x1f49c0[_0x90e6('0x36')]));if(_0x104fe9['query'][_0x90e6('0x42')]){_0x1e2113[_0x90e6('0x40')]=_[_0x90e6('0x43')](_0x1e2113[_0x90e6('0x40')],{'$or':_['map'](_0x1e2113[_0x90e6('0x39')],function(_0x3228f6){var _0x3d4b1f={};_0x3d4b1f[_0x3228f6]={'$like':'%'+_0x104fe9[_0x90e6('0x38')][_0x90e6('0x42')]+'%'};return _0x3d4b1f;})});}_0x1e2113=_[_0x90e6('0x43')]({},_0x1e2113,_0x104fe9[_0x90e6('0x45')]);return _0x17600b[_0x90e6('0x51')](_0x1e2113);}})[_0x90e6('0x29')](function(_0x535133){if(_0x535133){_0x428f1f=_0x535133[_0x90e6('0x3b')];if(!_0x104fe9[_0x90e6('0x38')][_0x90e6('0x3c')]('nolimit')){_0x1e2113[_0x90e6('0x21')]=qs[_0x90e6('0x21')](_0x104fe9[_0x90e6('0x38')]['limit']);_0x1e2113[_0x90e6('0x20')]=qs[_0x90e6('0x20')](_0x104fe9['query']['offset']);}return _0x17600b['getFields'](_0x1e2113);}})[_0x90e6('0x29')](function(_0x269089){if(_0x269089){return _0x269089?{'count':_0x428f1f,'rows':_0x269089}:null;}})[_0x90e6('0x29')](respondWithResult(_0x27b387,null))[_0x90e6('0x4a')](handleError(_0x27b387,null));};exports['getSubjects']=function(_0x3cc0f6,_0xb32b1c,_0x35f6ee){var _0x309b1b={};var _0x42b6a6={};var _0x43b21b;var _0x353d9f;return db[_0x90e6('0x30')][_0x90e6('0x52')]({'where':{'id':_0x3cc0f6[_0x90e6('0x50')]['id']}})[_0x90e6('0x29')](handleEntityNotFound(_0xb32b1c,null))[_0x90e6('0x29')](function(_0x55210e){if(_0x55210e){_0x43b21b=_0x55210e;_0x42b6a6['model']=_[_0x90e6('0x4c')](db[_0x90e6('0x53')]['rawAttributes']);_0x42b6a6[_0x90e6('0x38')]=_[_0x90e6('0x4c')](_0x3cc0f6[_0x90e6('0x38')]);_0x42b6a6[_0x90e6('0x36')]=_['intersection'](_0x42b6a6[_0x90e6('0x35')],_0x42b6a6[_0x90e6('0x38')]);_0x309b1b['attributes']=_[_0x90e6('0x37')](_0x42b6a6['model'],qs['fields'](_0x3cc0f6[_0x90e6('0x38')]['fields']));_0x309b1b[_0x90e6('0x39')]=_0x309b1b['attributes']['length']?_0x309b1b['attributes']:_0x42b6a6[_0x90e6('0x35')];_0x309b1b['order']=qs[_0x90e6('0x3f')](_0x3cc0f6['query'][_0x90e6('0x3f')]);_0x309b1b[_0x90e6('0x40')]=qs[_0x90e6('0x36')](_[_0x90e6('0x41')](_0x3cc0f6[_0x90e6('0x38')],_0x42b6a6[_0x90e6('0x36')]));if(_0x3cc0f6['query'][_0x90e6('0x42')]){_0x309b1b[_0x90e6('0x40')]=_[_0x90e6('0x43')](_0x309b1b['where'],{'$or':_[_0x90e6('0x2f')](_0x309b1b[_0x90e6('0x39')],function(_0x3fa131){var _0x3460fe={};_0x3460fe[_0x3fa131]={'$like':'%'+_0x3cc0f6[_0x90e6('0x38')][_0x90e6('0x42')]+'%'};return _0x3460fe;})});}_0x309b1b=_[_0x90e6('0x43')]({},_0x309b1b,_0x3cc0f6['options']);return _0x43b21b[_0x90e6('0x54')](_0x309b1b);}})['then'](function(_0x48a587){if(_0x48a587){_0x353d9f=_0x48a587[_0x90e6('0x3b')];if(!_0x3cc0f6[_0x90e6('0x38')][_0x90e6('0x3c')]('nolimit')){_0x309b1b[_0x90e6('0x21')]=qs[_0x90e6('0x21')](_0x3cc0f6[_0x90e6('0x38')]['limit']);_0x309b1b['offset']=qs[_0x90e6('0x20')](_0x3cc0f6[_0x90e6('0x38')][_0x90e6('0x20')]);}return _0x43b21b['getSubjects'](_0x309b1b);}})[_0x90e6('0x29')](function(_0x551ceb){if(_0x551ceb){return _0x551ceb?{'count':_0x353d9f,'rows':_0x551ceb}:null;}})[_0x90e6('0x29')](respondWithResult(_0xb32b1c,null))[_0x90e6('0x4a')](handleError(_0xb32b1c,null));};exports[_0x90e6('0x55')]=function(_0x53ad04,_0x58d0cd,_0x57427a){var _0x32a646={};var _0x46ff98={};var _0x3d6885;var _0x17139c;return db[_0x90e6('0x30')][_0x90e6('0x52')]({'where':{'id':_0x53ad04[_0x90e6('0x50')]['id']}})[_0x90e6('0x29')](handleEntityNotFound(_0x58d0cd,null))[_0x90e6('0x29')](function(_0x51bd1e){if(_0x51bd1e){_0x3d6885=_0x51bd1e;_0x46ff98['model']=_[_0x90e6('0x4c')](db[_0x90e6('0x53')][_0x90e6('0x31')]);_0x46ff98[_0x90e6('0x38')]=_[_0x90e6('0x4c')](_0x53ad04[_0x90e6('0x38')]);_0x46ff98[_0x90e6('0x36')]=_[_0x90e6('0x37')](_0x46ff98[_0x90e6('0x35')],_0x46ff98[_0x90e6('0x38')]);_0x32a646[_0x90e6('0x39')]=_[_0x90e6('0x37')](_0x46ff98[_0x90e6('0x35')],qs['fields'](_0x53ad04['query']['fields']));_0x32a646['attributes']=_0x32a646['attributes']['length']?_0x32a646['attributes']:_0x46ff98[_0x90e6('0x35')];_0x32a646[_0x90e6('0x3e')]=qs[_0x90e6('0x3f')](_0x53ad04[_0x90e6('0x38')][_0x90e6('0x3f')]);_0x32a646['where']=qs[_0x90e6('0x36')](_[_0x90e6('0x41')](_0x53ad04[_0x90e6('0x38')],_0x46ff98[_0x90e6('0x36')]));if(_0x53ad04[_0x90e6('0x38')]['filter']){_0x32a646[_0x90e6('0x40')]=_[_0x90e6('0x43')](_0x32a646[_0x90e6('0x40')],{'$or':_[_0x90e6('0x2f')](_0x32a646[_0x90e6('0x39')],function(_0x228de7){var _0x5f584d={};_0x5f584d[_0x228de7]={'$like':'%'+_0x53ad04[_0x90e6('0x38')]['filter']+'%'};return _0x5f584d;})});}_0x32a646=_['merge']({},_0x32a646,_0x53ad04[_0x90e6('0x45')]);return _0x3d6885['getDescriptions'](_0x32a646);}})[_0x90e6('0x29')](function(_0x4197a8){if(_0x4197a8){_0x17139c=_0x4197a8[_0x90e6('0x3b')];if(!_0x53ad04['query'][_0x90e6('0x3c')](_0x90e6('0x3d'))){_0x32a646['limit']=qs[_0x90e6('0x21')](_0x53ad04['query'][_0x90e6('0x21')]);_0x32a646[_0x90e6('0x20')]=qs['offset'](_0x53ad04['query']['offset']);}return _0x3d6885[_0x90e6('0x55')](_0x32a646);}})[_0x90e6('0x29')](function(_0x41175f){if(_0x41175f){return _0x41175f?{'count':_0x17139c,'rows':_0x41175f}:null;}})[_0x90e6('0x29')](respondWithResult(_0x58d0cd,null))[_0x90e6('0x4a')](handleError(_0x58d0cd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 72803c7..f2e2b45 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 _0x1658=['request-promise','./intZohoConfiguration.attributes','define','ZohoConfiguration','util','../../config/logger','moment','bluebird'];(function(_0x32bf52,_0xee9554){var _0x5cc76e=function(_0x289a87){while(--_0x289a87){_0x32bf52['push'](_0x32bf52['shift']());}};_0x5cc76e(++_0xee9554);}(_0x1658,0x16c));var _0x8165=function(_0x2a4a36,_0x496db1){_0x2a4a36=_0x2a4a36-0x0;var _0x3cb4e5=_0x1658[_0x2a4a36];return _0x3cb4e5;};'use strict';var _=require('lodash');var util=require(_0x8165('0x0'));var logger=require(_0x8165('0x1'))('api');var moment=require(_0x8165('0x2'));var BPromise=require(_0x8165('0x3'));var rp=require(_0x8165('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8165('0x5'));module['exports']=function(_0x471943,_0x39b504){return _0x471943[_0x8165('0x6')](_0x8165('0x7'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9366=['rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9366,0xc8));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6936('0x0'));var util=require(_0x6936('0x1'));var logger=require(_0x6936('0x2'))(_0x6936('0x3'));var moment=require(_0x6936('0x4'));var BPromise=require(_0x6936('0x5'));var rp=require(_0x6936('0x6'));var fs=require('fs');var path=require(_0x6936('0x7'));var rimraf=require(_0x6936('0x8'));var config=require('../../config/environment');var attributes=require(_0x6936('0x9'));module[_0x6936('0xa')]=function(_0x37aa5d,_0x45e743){return _0x37aa5d['define'](_0x6936('0xb'),attributes,{'tableName':_0x6936('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index c91aef1..f0c555b 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 _0xb901=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xef66ed,_0x1a5239){var _0xa14f66=function(_0x458541){while(--_0x458541){_0xef66ed['push'](_0xef66ed['shift']());}};_0xa14f66(++_0x1a5239);}(_0xb901,0x1f4));var _0x1b90=function(_0x241fd8,_0x568e21){_0x241fd8=_0x241fd8-0x0;var _0x3c260e=_0xb901[_0x241fd8];return _0x3c260e;};'use strict';var _=require(_0x1b90('0x0'));var util=require(_0x1b90('0x1'));var moment=require(_0x1b90('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b90('0x3'));var fs=require('fs');var Redis=require(_0x1b90('0x4'));var db=require(_0x1b90('0x5'))['db'];var utils=require(_0x1b90('0x6'));var logger=require(_0x1b90('0x7'))('rpc');var config=require(_0x1b90('0x8'));var jayson=require(_0x1b90('0x9'));var client=jayson[_0x1b90('0xa')][_0x1b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb725a0,_0x3a8269,_0xc1ffe){return new BPromise(function(_0x5f3225,_0x56dcc3){return client['request'](_0xb725a0,_0xc1ffe)[_0x1b90('0xc')](function(_0x255b17){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3a8269,_0x1b90('0xd'));logger[_0x1b90('0xe')](_0x1b90('0xf'),_0x3a8269,'request\x20sent',JSON[_0x1b90('0x10')](_0x255b17));if(_0x255b17[_0x1b90('0x11')]){if(_0x255b17[_0x1b90('0x11')]['code']===0x1f4){logger[_0x1b90('0x11')](_0x1b90('0x12'),_0x3a8269,_0x255b17['error']['message']);return _0x56dcc3(_0x255b17[_0x1b90('0x11')][_0x1b90('0x13')]);}logger[_0x1b90('0x11')](_0x1b90('0x12'),_0x3a8269,_0x255b17[_0x1b90('0x11')]['message']);return _0x5f3225(_0x255b17[_0x1b90('0x11')][_0x1b90('0x13')]);}else{logger[_0x1b90('0x14')](_0x1b90('0x12'),_0x3a8269,_0x1b90('0xd'));_0x5f3225(_0x255b17[_0x1b90('0x15')]['message']);}})[_0x1b90('0x16')](function(_0x22ef81){logger['error'](_0x1b90('0x12'),_0x3a8269,_0x22ef81);_0x56dcc3(_0x22ef81);});});} \ No newline at end of file +var _0x52d2=['http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xc5f527,_0x33c134){var _0x206a0c=function(_0x3191ef){while(--_0x3191ef){_0xc5f527['push'](_0xc5f527['shift']());}};_0x206a0c(++_0x33c134);}(_0x52d2,0x80));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x252d('0x0'));var util=require('util');var moment=require(_0x252d('0x1'));var BPromise=require('bluebird');var rs=require(_0x252d('0x2'));var fs=require('fs');var Redis=require(_0x252d('0x3'));var db=require(_0x252d('0x4'))['db'];var utils=require(_0x252d('0x5'));var logger=require('../../config/logger')(_0x252d('0x6'));var config=require(_0x252d('0x7'));var jayson=require(_0x252d('0x8'));var client=jayson[_0x252d('0x9')][_0x252d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd19cb3,_0x542b7d,_0x278aff){return new BPromise(function(_0x27e15b,_0xef541c){return client['request'](_0xd19cb3,_0x278aff)[_0x252d('0xb')](function(_0x174343){logger[_0x252d('0xc')](_0x252d('0xd'),_0x542b7d,_0x252d('0xe'));logger[_0x252d('0xf')](_0x252d('0x10'),_0x542b7d,_0x252d('0xe'),JSON[_0x252d('0x11')](_0x174343));if(_0x174343[_0x252d('0x12')]){if(_0x174343['error'][_0x252d('0x13')]===0x1f4){logger[_0x252d('0x12')](_0x252d('0xd'),_0x542b7d,_0x174343[_0x252d('0x12')][_0x252d('0x14')]);return _0xef541c(_0x174343[_0x252d('0x12')][_0x252d('0x14')]);}logger[_0x252d('0x12')](_0x252d('0xd'),_0x542b7d,_0x174343[_0x252d('0x12')][_0x252d('0x14')]);return _0x27e15b(_0x174343[_0x252d('0x12')][_0x252d('0x14')]);}else{logger[_0x252d('0xc')](_0x252d('0xd'),_0x542b7d,_0x252d('0xe'));_0x27e15b(_0x174343[_0x252d('0x15')]['message']);}})[_0x252d('0x16')](function(_0x247f7a){logger[_0x252d('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x542b7d,_0x247f7a);_0xef541c(_0x247f7a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 096fab8..2efc2ec 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 _0x0aac=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','delete'];(function(_0x38e528,_0xf85aa0){var _0x59a9f7=function(_0x1aecde){while(--_0x1aecde){_0x38e528['push'](_0x38e528['shift']());}};_0x59a9f7(++_0xf85aa0);}(_0x0aac,0x134));var _0xc0aa=function(_0x4c62af,_0x234da8){_0x4c62af=_0x4c62af-0x0;var _0x3d8c6d=_0x0aac[_0x4c62af];return _0x3d8c6d;};'use strict';var multer=require(_0xc0aa('0x0'));var util=require('util');var path=require(_0xc0aa('0x1'));var timeout=require(_0xc0aa('0x2'));var express=require(_0xc0aa('0x3'));var router=express[_0xc0aa('0x4')]();var fs_extra=require(_0xc0aa('0x5'));var auth=require(_0xc0aa('0x6'));var interaction=require(_0xc0aa('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xc0aa('0x8')]('/',auth[_0xc0aa('0x9')](),controller[_0xc0aa('0xa')]);router[_0xc0aa('0x8')](_0xc0aa('0xb'),auth['isAuthenticated'](),controller[_0xc0aa('0xc')]);router[_0xc0aa('0xd')]('/',auth[_0xc0aa('0x9')](),controller[_0xc0aa('0xe')]);router['put'](_0xc0aa('0xb'),auth[_0xc0aa('0x9')](),controller['update']);router[_0xc0aa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc0aa('0x10')]);module[_0xc0aa('0x11')]=router; \ No newline at end of file +var _0x6610=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x1668b4,_0x4055ec){var _0x3e2277=function(_0x5641fe){while(--_0x5641fe){_0x1668b4['push'](_0x1668b4['shift']());}};_0x3e2277(++_0x4055ec);}(_0x6610,0x7d));var _0x0661=function(_0xef6bdb,_0x5036c7){_0xef6bdb=_0xef6bdb-0x0;var _0x1382f7=_0x6610[_0xef6bdb];return _0x1382f7;};'use strict';var multer=require(_0x0661('0x0'));var util=require(_0x0661('0x1'));var path=require(_0x0661('0x2'));var timeout=require(_0x0661('0x3'));var express=require(_0x0661('0x4'));var router=express['Router']();var fs_extra=require(_0x0661('0x5'));var auth=require(_0x0661('0x6'));var interaction=require(_0x0661('0x7'));var config=require(_0x0661('0x8'));var controller=require(_0x0661('0x9'));router[_0x0661('0xa')]('/',auth[_0x0661('0xb')](),controller['index']);router['get'](_0x0661('0xc'),auth[_0x0661('0xb')](),controller[_0x0661('0xd')]);router[_0x0661('0xe')]('/',auth[_0x0661('0xb')](),controller[_0x0661('0xf')]);router['put'](_0x0661('0xc'),auth['isAuthenticated'](),controller[_0x0661('0x10')]);router[_0x0661('0x11')](_0x0661('0xc'),auth[_0x0661('0xb')](),controller[_0x0661('0x12')]);module[_0x0661('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index deda6cf..1dc169d 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 _0x998f=['ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','exports'];(function(_0x21d2b1,_0x56e81a){var _0x25a921=function(_0x33dcb0){while(--_0x33dcb0){_0x21d2b1['push'](_0x21d2b1['shift']());}};_0x25a921(++_0x56e81a);}(_0x998f,0x86));var _0xf998=function(_0x38cb40,_0x5aa17c){_0x38cb40=_0x38cb40-0x0;var _0x33a961=_0x998f[_0x38cb40];return _0x33a961;};'use strict';var Sequelize=require('sequelize');module[_0xf998('0x0')]={'type':{'type':Sequelize[_0xf998('0x1')]('string',_0xf998('0x2'),_0xf998('0x3'),_0xf998('0x4'),_0xf998('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf998('0x6')]},'key':{'type':Sequelize[_0xf998('0x6')]},'keyType':{'type':Sequelize[_0xf998('0x1')](_0xf998('0x7'),'variable',_0xf998('0x3'))},'keyContent':{'type':Sequelize[_0xf998('0x6')]},'idField':{'type':Sequelize[_0xf998('0x6')]},'nameField':{'type':Sequelize[_0xf998('0x6')]},'customField':{'type':Sequelize[_0xf998('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf998('0x6')]}}; \ No newline at end of file +var _0xc727=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x55b261,_0x9a118){var _0x1a2a54=function(_0xfe8735){while(--_0xfe8735){_0x55b261['push'](_0x55b261['shift']());}};_0x1a2a54(++_0x9a118);}(_0xc727,0x1b5));var _0x7c72=function(_0x53abdf,_0x20667d){_0x53abdf=_0x53abdf-0x0;var _0x596287=_0xc727[_0x53abdf];return _0x596287;};'use strict';var Sequelize=require(_0x7c72('0x0'));module[_0x7c72('0x1')]={'type':{'type':Sequelize[_0x7c72('0x2')](_0x7c72('0x3'),_0x7c72('0x4'),_0x7c72('0x5'),_0x7c72('0x6'),_0x7c72('0x7')),'defaultValue':_0x7c72('0x3')},'content':{'type':Sequelize[_0x7c72('0x8')]},'key':{'type':Sequelize[_0x7c72('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x7c72('0x3'),_0x7c72('0x4'),_0x7c72('0x5'))},'keyContent':{'type':Sequelize[_0x7c72('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7c72('0x8')]},'customField':{'type':Sequelize[_0x7c72('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c72('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 05a9adf..2aa78bd 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 _0x05cd=['stack','name','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','type','VIRTUAL','merge','options','findAll','rows','catch','show','params','include','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0x6033f7,_0x2e3537){var _0x130198=function(_0x4333e6){while(--_0x4333e6){_0x6033f7['push'](_0x6033f7['shift']());}};_0x130198(++_0x2e3537);}(_0x05cd,0x185));var _0xd05c=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0x05cd[_0x415603];return _0x131e72;};'use strict';var emlformat=require(_0xd05c('0x0'));var rimraf=require(_0xd05c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd05c('0x2'));var moment=require(_0xd05c('0x3'));var BPromise=require(_0xd05c('0x4'));var Mustache=require(_0xd05c('0x5'));var util=require('util');var path=require(_0xd05c('0x6'));var sox=require(_0xd05c('0x7'));var csv=require(_0xd05c('0x8'));var ejs=require(_0xd05c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd05c('0xa'));var squel=require(_0xd05c('0xb'));var crypto=require(_0xd05c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd05c('0xd'));var toCsv=require(_0xd05c('0x8'));var querystring=require(_0xd05c('0xe'));var Papa=require(_0xd05c('0xf'));var Redis=require(_0xd05c('0x10'));var authService=require(_0xd05c('0x11'));var qs=require(_0xd05c('0x12'));var as=require(_0xd05c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd05c('0x14'));var config=require(_0xd05c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd05c('0x16'))['db'];function respondWithStatusCode(_0x15a6b1,_0x15539c){_0x15539c=_0x15539c||0xcc;return function(_0x188792){if(_0x188792){return _0x15a6b1[_0xd05c('0x17')](_0x15539c);}return _0x15a6b1[_0xd05c('0x18')](_0x15539c)['end']();};}function respondWithResult(_0x5953f8,_0x24f549){_0x24f549=_0x24f549||0xc8;return function(_0xd45a05){if(_0xd45a05){return _0x5953f8[_0xd05c('0x18')](_0x24f549)[_0xd05c('0x19')](_0xd45a05);}};}function respondWithFilteredResult(_0x11682d,_0x46efef){return function(_0x1b65fe){if(_0x1b65fe){var _0x242bb7=typeof _0x46efef['offset']===_0xd05c('0x1a')&&typeof _0x46efef[_0xd05c('0x1b')]==='undefined';var _0x34fadd=_0x1b65fe[_0xd05c('0x1c')];var _0x5c1387=_0x242bb7?0x0:_0x46efef['offset'];var _0x1002a2=_0x242bb7?_0x1b65fe[_0xd05c('0x1c')]:_0x46efef['offset']+_0x46efef['limit'];var _0x286d28;if(_0x1002a2>=_0x34fadd){_0x1002a2=_0x34fadd;_0x286d28=0xc8;}else{_0x286d28=0xce;}_0x11682d[_0xd05c('0x18')](_0x286d28);return _0x11682d[_0xd05c('0x1d')](_0xd05c('0x1e'),_0x5c1387+'-'+_0x1002a2+'/'+_0x34fadd)[_0xd05c('0x19')](_0x1b65fe);}return null;};}function patchUpdates(_0x1996ac){return function(_0xfb90d4){try{jsonpatch['apply'](_0xfb90d4,_0x1996ac,!![]);}catch(_0x137745){return BPromise[_0xd05c('0x1f')](_0x137745);}return _0xfb90d4[_0xd05c('0x20')]();};}function saveUpdates(_0x9a0582,_0x44cde3){return function(_0x4e2fb1){if(_0x4e2fb1){return _0x4e2fb1[_0xd05c('0x21')](_0x9a0582)[_0xd05c('0x22')](function(_0x35616e){return _0x35616e;});}return null;};}function removeEntity(_0x14b688,_0x8a4c55){return function(_0x54c525){if(_0x54c525){return _0x54c525[_0xd05c('0x23')]()[_0xd05c('0x22')](function(){_0x14b688[_0xd05c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4071ab,_0x1ed80c){return function(_0x52d3a5){if(!_0x52d3a5){_0x4071ab[_0xd05c('0x17')](0x194);}return _0x52d3a5;};}function handleError(_0x3f71ae,_0x494631){_0x494631=_0x494631||0x1f4;return function(_0x33c137){logger[_0xd05c('0x24')](_0x33c137[_0xd05c('0x25')]);if(_0x33c137['name']){delete _0x33c137[_0xd05c('0x26')];}_0x3f71ae[_0xd05c('0x18')](_0x494631)['send'](_0x33c137);};}exports['index']=function(_0x676e23,_0x131de8){var _0x29c070={},_0x2bb3e3={},_0x2629c4={'count':0x0,'rows':[]};var _0x16bf68=_[_0xd05c('0x27')](db[_0xd05c('0x28')][_0xd05c('0x29')],function(_0x5984d3){return{'name':_0x5984d3[_0xd05c('0x2a')],'type':_0x5984d3['type'][_0xd05c('0x2b')]};});_0x2bb3e3[_0xd05c('0x2c')]=_[_0xd05c('0x27')](_0x16bf68,'name');_0x2bb3e3[_0xd05c('0x2d')]=_[_0xd05c('0x2e')](_0x676e23['query']);_0x2bb3e3[_0xd05c('0x2f')]=_[_0xd05c('0x30')](_0x2bb3e3[_0xd05c('0x2c')],_0x2bb3e3[_0xd05c('0x2d')]);_0x29c070['attributes']=_[_0xd05c('0x30')](_0x2bb3e3[_0xd05c('0x2c')],qs[_0xd05c('0x31')](_0x676e23['query'][_0xd05c('0x31')]));_0x29c070[_0xd05c('0x32')]=_0x29c070[_0xd05c('0x32')]['length']?_0x29c070['attributes']:_0x2bb3e3[_0xd05c('0x2c')];if(!_0x676e23[_0xd05c('0x2d')][_0xd05c('0x33')](_0xd05c('0x34'))){_0x29c070[_0xd05c('0x1b')]=qs[_0xd05c('0x1b')](_0x676e23['query']['limit']);_0x29c070['offset']=qs[_0xd05c('0x35')](_0x676e23[_0xd05c('0x2d')][_0xd05c('0x35')]);}_0x29c070[_0xd05c('0x36')]=qs[_0xd05c('0x37')](_0x676e23[_0xd05c('0x2d')]['sort']);_0x29c070['where']=qs[_0xd05c('0x2f')](_[_0xd05c('0x38')](_0x676e23[_0xd05c('0x2d')],_0x2bb3e3[_0xd05c('0x2f')]),_0x16bf68);if(_0x676e23[_0xd05c('0x2d')][_0xd05c('0x39')]){_0x29c070['where']=_['merge'](_0x29c070[_0xd05c('0x3a')],{'$or':_[_0xd05c('0x27')](_0x16bf68,function(_0x3af0a6){if(_0x3af0a6[_0xd05c('0x3b')]!==_0xd05c('0x3c')){var _0x8343a9={};_0x8343a9[_0x3af0a6[_0xd05c('0x26')]]={'$like':'%'+_0x676e23[_0xd05c('0x2d')]['filter']+'%'};return _0x8343a9;}})});}_0x29c070=_[_0xd05c('0x3d')]({},_0x29c070,_0x676e23[_0xd05c('0x3e')]);var _0x1b6d21={'where':_0x29c070[_0xd05c('0x3a')]};return db[_0xd05c('0x28')]['count'](_0x1b6d21)[_0xd05c('0x22')](function(_0x1458c6){_0x2629c4['count']=_0x1458c6;if(_0x676e23[_0xd05c('0x2d')]['includeAll']){_0x29c070['include']=[{'all':!![]}];}return db[_0xd05c('0x28')][_0xd05c('0x3f')](_0x29c070);})[_0xd05c('0x22')](function(_0x3fe50f){_0x2629c4[_0xd05c('0x40')]=_0x3fe50f;return _0x2629c4;})['then'](respondWithFilteredResult(_0x131de8,_0x29c070))[_0xd05c('0x41')](handleError(_0x131de8,null));};exports[_0xd05c('0x42')]=function(_0x228dac,_0x523e1e){var _0x261e87={'raw':!![],'where':{'id':_0x228dac[_0xd05c('0x43')]['id']}},_0x11b777={};_0x11b777['model']=_['keys'](db[_0xd05c('0x28')][_0xd05c('0x29')]);_0x11b777[_0xd05c('0x2d')]=_[_0xd05c('0x2e')](_0x228dac[_0xd05c('0x2d')]);_0x11b777[_0xd05c('0x2f')]=_[_0xd05c('0x30')](_0x11b777['model'],_0x11b777[_0xd05c('0x2d')]);_0x261e87[_0xd05c('0x32')]=_['intersection'](_0x11b777['model'],qs[_0xd05c('0x31')](_0x228dac[_0xd05c('0x2d')]['fields']));_0x261e87[_0xd05c('0x32')]=_0x261e87['attributes']['length']?_0x261e87[_0xd05c('0x32')]:_0x11b777[_0xd05c('0x2c')];if(_0x228dac[_0xd05c('0x2d')]['includeAll']){_0x261e87[_0xd05c('0x44')]=[{'all':!![]}];}_0x261e87=_[_0xd05c('0x3d')]({},_0x261e87,_0x228dac[_0xd05c('0x3e')]);return db[_0xd05c('0x28')]['find'](_0x261e87)['then'](handleEntityNotFound(_0x523e1e,null))[_0xd05c('0x22')](respondWithResult(_0x523e1e,null))[_0xd05c('0x41')](handleError(_0x523e1e,null));};exports['create']=function(_0x6f978f,_0x448a68){return db[_0xd05c('0x28')]['create'](_0x6f978f['body'],{})[_0xd05c('0x22')](respondWithResult(_0x448a68,0xc9))['catch'](handleError(_0x448a68,null));};exports[_0xd05c('0x21')]=function(_0x5e300e,_0xc1958d){if(_0x5e300e['body']['id']){delete _0x5e300e['body']['id'];}return db[_0xd05c('0x28')]['find']({'where':{'id':_0x5e300e[_0xd05c('0x43')]['id']}})[_0xd05c('0x22')](handleEntityNotFound(_0xc1958d,null))['then'](saveUpdates(_0x5e300e[_0xd05c('0x45')],null))['then'](respondWithResult(_0xc1958d,null))[_0xd05c('0x41')](handleError(_0xc1958d,null));};exports['destroy']=function(_0x49e652,_0x539b4d){return db['ZohoField'][_0xd05c('0x46')]({'where':{'id':_0x49e652['params']['id']}})[_0xd05c('0x22')](handleEntityNotFound(_0x539b4d,null))[_0xd05c('0x22')](removeEntity(_0x539b4d,null))[_0xd05c('0x41')](handleError(_0x539b4d,null));}; \ No newline at end of file +var _0xe96f=['update','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','then','includeAll','rows','params','attributes','length','include','options','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x2d513f,_0x126f93){var _0x2488c3=function(_0x59599c){while(--_0x59599c){_0x2d513f['push'](_0x2d513f['shift']());}};_0x2488c3(++_0x126f93);}(_0xe96f,0x199));var _0xfe96=function(_0x23bb4d,_0xb260c){_0x23bb4d=_0x23bb4d-0x0;var _0x3db934=_0xe96f[_0x23bb4d];return _0x3db934;};'use strict';var emlformat=require(_0xfe96('0x0'));var rimraf=require(_0xfe96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfe96('0x2'));var moment=require(_0xfe96('0x3'));var BPromise=require(_0xfe96('0x4'));var Mustache=require('mustache');var util=require(_0xfe96('0x5'));var path=require(_0xfe96('0x6'));var sox=require(_0xfe96('0x7'));var csv=require(_0xfe96('0x8'));var ejs=require(_0xfe96('0x9'));var fs=require('fs');var fs_extra=require(_0xfe96('0xa'));var _=require(_0xfe96('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe96('0x8'));var querystring=require(_0xfe96('0xc'));var Papa=require(_0xfe96('0xd'));var Redis=require('ioredis');var authService=require(_0xfe96('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfe96('0xf'));var hardwareService=require(_0xfe96('0x10'));var logger=require(_0xfe96('0x11'))('api');var utils=require(_0xfe96('0x12'));var config=require(_0xfe96('0x13'));var licenseUtil=require(_0xfe96('0x14'));var db=require(_0xfe96('0x15'))['db'];function respondWithStatusCode(_0x11c44c,_0x4da6d1){_0x4da6d1=_0x4da6d1||0xcc;return function(_0x2a261f){if(_0x2a261f){return _0x11c44c[_0xfe96('0x16')](_0x4da6d1);}return _0x11c44c[_0xfe96('0x17')](_0x4da6d1)[_0xfe96('0x18')]();};}function respondWithResult(_0x4efbe6,_0x3cef0c){_0x3cef0c=_0x3cef0c||0xc8;return function(_0x309ff0){if(_0x309ff0){return _0x4efbe6[_0xfe96('0x17')](_0x3cef0c)[_0xfe96('0x19')](_0x309ff0);}};}function respondWithFilteredResult(_0xe7052e,_0x363738){return function(_0x10ac4d){if(_0x10ac4d){var _0x4d56b7=typeof _0x363738['offset']===_0xfe96('0x1a')&&typeof _0x363738[_0xfe96('0x1b')]===_0xfe96('0x1a');var _0x4f97ac=_0x10ac4d[_0xfe96('0x1c')];var _0x230079=_0x4d56b7?0x0:_0x363738[_0xfe96('0x1d')];var _0xf6787e=_0x4d56b7?_0x10ac4d[_0xfe96('0x1c')]:_0x363738[_0xfe96('0x1d')]+_0x363738[_0xfe96('0x1b')];var _0x1f9049;if(_0xf6787e>=_0x4f97ac){_0xf6787e=_0x4f97ac;_0x1f9049=0xc8;}else{_0x1f9049=0xce;}_0xe7052e[_0xfe96('0x17')](_0x1f9049);return _0xe7052e[_0xfe96('0x1e')](_0xfe96('0x1f'),_0x230079+'-'+_0xf6787e+'/'+_0x4f97ac)[_0xfe96('0x19')](_0x10ac4d);}return null;};}function patchUpdates(_0x52fcf9){return function(_0x53a9d3){try{jsonpatch[_0xfe96('0x20')](_0x53a9d3,_0x52fcf9,!![]);}catch(_0x412725){return BPromise[_0xfe96('0x21')](_0x412725);}return _0x53a9d3[_0xfe96('0x22')]();};}function saveUpdates(_0x1e87f1,_0x17f941){return function(_0x1449c2){if(_0x1449c2){return _0x1449c2[_0xfe96('0x23')](_0x1e87f1)['then'](function(_0x309904){return _0x309904;});}return null;};}function removeEntity(_0x31f1ed,_0x5f2f7e){return function(_0x466d7d){if(_0x466d7d){return _0x466d7d[_0xfe96('0x24')]()['then'](function(){_0x31f1ed[_0xfe96('0x17')](0xcc)[_0xfe96('0x18')]();});}};}function handleEntityNotFound(_0x90700b,_0x444e58){return function(_0x1778d9){if(!_0x1778d9){_0x90700b['sendStatus'](0x194);}return _0x1778d9;};}function handleError(_0x21409e,_0x17b9c8){_0x17b9c8=_0x17b9c8||0x1f4;return function(_0x19cd3a){logger[_0xfe96('0x25')](_0x19cd3a[_0xfe96('0x26')]);if(_0x19cd3a[_0xfe96('0x27')]){delete _0x19cd3a[_0xfe96('0x27')];}_0x21409e['status'](_0x17b9c8)[_0xfe96('0x28')](_0x19cd3a);};}exports[_0xfe96('0x29')]=function(_0x52d8a1,_0x48d629){var _0x321861={},_0x5388e4={},_0x27ade7={'count':0x0,'rows':[]};var _0x3fe8eb=_[_0xfe96('0x2a')](db[_0xfe96('0x2b')][_0xfe96('0x2c')],function(_0x14cb2a){return{'name':_0x14cb2a[_0xfe96('0x2d')],'type':_0x14cb2a['type'][_0xfe96('0x2e')]};});_0x5388e4['model']=_[_0xfe96('0x2a')](_0x3fe8eb,_0xfe96('0x27'));_0x5388e4[_0xfe96('0x2f')]=_[_0xfe96('0x30')](_0x52d8a1[_0xfe96('0x2f')]);_0x5388e4[_0xfe96('0x31')]=_[_0xfe96('0x32')](_0x5388e4['model'],_0x5388e4[_0xfe96('0x2f')]);_0x321861['attributes']=_[_0xfe96('0x32')](_0x5388e4[_0xfe96('0x33')],qs[_0xfe96('0x34')](_0x52d8a1[_0xfe96('0x2f')]['fields']));_0x321861['attributes']=_0x321861['attributes']['length']?_0x321861['attributes']:_0x5388e4[_0xfe96('0x33')];if(!_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x35')](_0xfe96('0x36'))){_0x321861[_0xfe96('0x1b')]=qs[_0xfe96('0x1b')](_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x1b')]);_0x321861['offset']=qs[_0xfe96('0x1d')](_0x52d8a1[_0xfe96('0x2f')]['offset']);}_0x321861[_0xfe96('0x37')]=qs['sort'](_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x38')]);_0x321861['where']=qs[_0xfe96('0x31')](_[_0xfe96('0x39')](_0x52d8a1[_0xfe96('0x2f')],_0x5388e4['filters']),_0x3fe8eb);if(_0x52d8a1[_0xfe96('0x2f')]['filter']){_0x321861[_0xfe96('0x3a')]=_[_0xfe96('0x3b')](_0x321861[_0xfe96('0x3a')],{'$or':_[_0xfe96('0x2a')](_0x3fe8eb,function(_0x3df624){if(_0x3df624[_0xfe96('0x3c')]!=='VIRTUAL'){var _0x476f89={};_0x476f89[_0x3df624['name']]={'$like':'%'+_0x52d8a1['query'][_0xfe96('0x3d')]+'%'};return _0x476f89;}})});}_0x321861=_[_0xfe96('0x3b')]({},_0x321861,_0x52d8a1['options']);var _0x228518={'where':_0x321861[_0xfe96('0x3a')]};return db[_0xfe96('0x2b')][_0xfe96('0x1c')](_0x228518)[_0xfe96('0x3e')](function(_0x17621e){_0x27ade7[_0xfe96('0x1c')]=_0x17621e;if(_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x3f')]){_0x321861['include']=[{'all':!![]}];}return db[_0xfe96('0x2b')]['findAll'](_0x321861);})[_0xfe96('0x3e')](function(_0x3e382b){_0x27ade7[_0xfe96('0x40')]=_0x3e382b;return _0x27ade7;})[_0xfe96('0x3e')](respondWithFilteredResult(_0x48d629,_0x321861))['catch'](handleError(_0x48d629,null));};exports['show']=function(_0x21268c,_0x543f0b){var _0x271994={'raw':!![],'where':{'id':_0x21268c[_0xfe96('0x41')]['id']}},_0x3c14b2={};_0x3c14b2[_0xfe96('0x33')]=_[_0xfe96('0x30')](db[_0xfe96('0x2b')]['rawAttributes']);_0x3c14b2[_0xfe96('0x2f')]=_[_0xfe96('0x30')](_0x21268c[_0xfe96('0x2f')]);_0x3c14b2[_0xfe96('0x31')]=_[_0xfe96('0x32')](_0x3c14b2['model'],_0x3c14b2[_0xfe96('0x2f')]);_0x271994[_0xfe96('0x42')]=_[_0xfe96('0x32')](_0x3c14b2[_0xfe96('0x33')],qs[_0xfe96('0x34')](_0x21268c[_0xfe96('0x2f')][_0xfe96('0x34')]));_0x271994[_0xfe96('0x42')]=_0x271994[_0xfe96('0x42')][_0xfe96('0x43')]?_0x271994[_0xfe96('0x42')]:_0x3c14b2[_0xfe96('0x33')];if(_0x21268c[_0xfe96('0x2f')]['includeAll']){_0x271994[_0xfe96('0x44')]=[{'all':!![]}];}_0x271994=_[_0xfe96('0x3b')]({},_0x271994,_0x21268c[_0xfe96('0x45')]);return db[_0xfe96('0x2b')]['find'](_0x271994)['then'](handleEntityNotFound(_0x543f0b,null))[_0xfe96('0x3e')](respondWithResult(_0x543f0b,null))[_0xfe96('0x46')](handleError(_0x543f0b,null));};exports[_0xfe96('0x47')]=function(_0x57b8a2,_0x45d8cf){return db['ZohoField'][_0xfe96('0x47')](_0x57b8a2[_0xfe96('0x48')],{})[_0xfe96('0x3e')](respondWithResult(_0x45d8cf,0xc9))[_0xfe96('0x46')](handleError(_0x45d8cf,null));};exports['update']=function(_0x131528,_0x1b4cb7){if(_0x131528[_0xfe96('0x48')]['id']){delete _0x131528[_0xfe96('0x48')]['id'];}return db[_0xfe96('0x2b')][_0xfe96('0x49')]({'where':{'id':_0x131528[_0xfe96('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b4cb7,null))[_0xfe96('0x3e')](saveUpdates(_0x131528[_0xfe96('0x48')],null))[_0xfe96('0x3e')](respondWithResult(_0x1b4cb7,null))[_0xfe96('0x46')](handleError(_0x1b4cb7,null));};exports[_0xfe96('0x24')]=function(_0xf21b37,_0x2d4b06){return db[_0xfe96('0x2b')][_0xfe96('0x49')]({'where':{'id':_0xf21b37[_0xfe96('0x41')]['id']}})[_0xfe96('0x3e')](handleEntityNotFound(_0x2d4b06,null))[_0xfe96('0x3e')](removeEntity(_0x2d4b06,null))[_0xfe96('0x46')](handleError(_0x2d4b06,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a8d72b2..390269f 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 _0x6d11=['exports','define','ZohoField','int_zoho_fields','lodash','util','../../config/logger','moment','request-promise','path','./intZohoField.attributes'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6d11,0xbf));var _0x16d1=function(_0x30a27f,_0x2d8460){_0x30a27f=_0x30a27f-0x0;var _0x3d9598=_0x6d11[_0x30a27f];return _0x3d9598;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x507352,_0x449fa0){var _0x1f9446=function(_0x4a8451){while(--_0x4a8451){_0x507352['push'](_0x507352['shift']());}};_0x1f9446(++_0x449fa0);}(_0x0424,0x159));var _0x4042=function(_0x3904e9,_0x1c0782){_0x3904e9=_0x3904e9-0x0;var _0x1ba0e0=_0x0424[_0x3904e9];return _0x1ba0e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'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 2add78e..ecfb7a5 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 _0x569d=['randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x5736cc,_0x1b4ea0){var _0x28ca9c=function(_0x204862){while(--_0x204862){_0x5736cc['push'](_0x5736cc['shift']());}};_0x28ca9c(++_0x1b4ea0);}(_0x569d,0x1b5));var _0xd569=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0x569d[_0x48bc0d];return _0x35f641;};'use strict';var _=require('lodash');var util=require(_0xd569('0x0'));var moment=require(_0xd569('0x1'));var BPromise=require(_0xd569('0x2'));var rs=require(_0xd569('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd569('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd569('0x5'));var jayson=require(_0xd569('0x6'));var client=jayson[_0xd569('0x7')][_0xd569('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45cb9d,_0x162932,_0x19a928){return new BPromise(function(_0x3b8b98,_0x21b0aa){return client[_0xd569('0x9')](_0x45cb9d,_0x19a928)[_0xd569('0xa')](function(_0x299ad8){logger[_0xd569('0xb')]('ZohoField,\x20%s,\x20%s',_0x162932,'request\x20sent');logger['debug'](_0xd569('0xc'),_0x162932,'request\x20sent',JSON[_0xd569('0xd')](_0x299ad8));if(_0x299ad8[_0xd569('0xe')]){if(_0x299ad8[_0xd569('0xe')][_0xd569('0xf')]===0x1f4){logger[_0xd569('0xe')](_0xd569('0x10'),_0x162932,_0x299ad8['error'][_0xd569('0x11')]);return _0x21b0aa(_0x299ad8[_0xd569('0xe')][_0xd569('0x11')]);}logger['error'](_0xd569('0x10'),_0x162932,_0x299ad8['error'][_0xd569('0x11')]);return _0x3b8b98(_0x299ad8[_0xd569('0xe')][_0xd569('0x11')]);}else{logger[_0xd569('0xb')](_0xd569('0x10'),_0x162932,'request\x20sent');_0x3b8b98(_0x299ad8[_0xd569('0x12')][_0xd569('0x11')]);}})[_0xd569('0x13')](function(_0xe97975){logger[_0xd569('0xe')](_0xd569('0x10'),_0x162932,_0xe97975);_0x21b0aa(_0xe97975);});});} \ No newline at end of file +var _0x18c4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18c4,0x1be));var _0x418c=function(_0x5da3db,_0x721915){_0x5da3db=_0x5da3db-0x0;var _0x30c7c4=_0x18c4[_0x5da3db];return _0x30c7c4;};'use strict';var _=require(_0x418c('0x0'));var util=require('util');var moment=require(_0x418c('0x1'));var BPromise=require(_0x418c('0x2'));var rs=require(_0x418c('0x3'));var fs=require('fs');var Redis=require(_0x418c('0x4'));var db=require(_0x418c('0x5'))['db'];var utils=require(_0x418c('0x6'));var logger=require(_0x418c('0x7'))(_0x418c('0x8'));var config=require(_0x418c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x418c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e62d,_0x2aa24b,_0x2103ab){return new BPromise(function(_0x127824,_0x4228cf){return client['request'](_0x54e62d,_0x2103ab)[_0x418c('0xb')](function(_0x498466){logger[_0x418c('0xc')](_0x418c('0xd'),_0x2aa24b,_0x418c('0xe'));logger['debug'](_0x418c('0xf'),_0x2aa24b,'request\x20sent',JSON['stringify'](_0x498466));if(_0x498466[_0x418c('0x10')]){if(_0x498466['error']['code']===0x1f4){logger[_0x418c('0x10')]('ZohoField,\x20%s,\x20%s',_0x2aa24b,_0x498466[_0x418c('0x10')][_0x418c('0x11')]);return _0x4228cf(_0x498466[_0x418c('0x10')][_0x418c('0x11')]);}logger['error'](_0x418c('0xd'),_0x2aa24b,_0x498466[_0x418c('0x10')]['message']);return _0x127824(_0x498466['error'][_0x418c('0x11')]);}else{logger[_0x418c('0xc')](_0x418c('0xd'),_0x2aa24b,_0x418c('0xe'));_0x127824(_0x498466['result'][_0x418c('0x11')]);}})['catch'](function(_0x29ab6a){logger[_0x418c('0x10')](_0x418c('0xd'),_0x2aa24b,_0x29ab6a);_0x4228cf(_0x29ab6a);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 97cbd93..9aac6cf 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4feb04,_0x581d56){var _0x2c075c=function(_0x408cc2){while(--_0x408cc2){_0x4feb04['push'](_0x4feb04['shift']());}};_0x2c075c(++_0x581d56);}(_0x70e0,0x17b));var _0x070e=function(_0x5e4513,_0x55345b){_0x5e4513=_0x5e4513-0x0;var _0x1549ef=_0x70e0[_0x5e4513];return _0x1549ef;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x519ee1,_0x3aab5c){var _0x101c5a=function(_0x2ca5ee){while(--_0x2ca5ee){_0x519ee1['push'](_0x519ee1['shift']());}};_0x101c5a(++_0x3aab5c);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f5ecd29..c70cd3d 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 _0xd64b=['unique_name_and_version','app.js','state','sequelize','STRING'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xd64b,0xc1));var _0xbd64=function(_0x56f0b2,_0xdcf225){_0x56f0b2=_0x56f0b2-0x0;var _0x194f36=_0xd64b[_0x56f0b2];return _0x194f36;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![],'unique':_0xbd64('0x2')},'main':{'type':Sequelize[_0xbd64('0x1')],'defaultValue':_0xbd64('0x3')},'filename':{'type':Sequelize[_0xbd64('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xbd64('0x1')]},'logo':{'type':Sequelize[_0xbd64('0x1')]},'state':{'type':Sequelize[_0xbd64('0x1')],'unique':_0xbd64('0x4')},'description':{'type':Sequelize[_0xbd64('0x1')]},'title':{'type':Sequelize[_0xbd64('0x1')]},'remoteUri':{'type':Sequelize[_0xbd64('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2d5e=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x8715f3,_0x73e96e){var _0x4dbb03=function(_0x314e04){while(--_0x314e04){_0x8715f3['push'](_0x8715f3['shift']());}};_0x4dbb03(++_0x73e96e);}(_0x2d5e,0x19d));var _0xe2d5=function(_0x1e2ecc,_0x1cc518){_0x1e2ecc=_0x1e2ecc-0x0;var _0x34e0cb=_0x2d5e[_0x1e2ecc];return _0x34e0cb;};'use strict';var Sequelize=require(_0xe2d5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe2d5('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe2d5('0x1')},'main':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':_0xe2d5('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xe2d5('0x2')]},'type':{'type':Sequelize[_0xe2d5('0x2')]},'size':{'type':Sequelize[_0xe2d5('0x4')]},'active':{'type':Sequelize[_0xe2d5('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xe2d5('0x2')]},'logo':{'type':Sequelize[_0xe2d5('0x2')]},'state':{'type':Sequelize[_0xe2d5('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xe2d5('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xe2d5('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 785811a..fb1d274 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','Integration','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x127011,_0x46a223){var _0x5dfefb=function(_0x14cb7c){while(--_0x14cb7c){_0x127011['push'](_0x127011['shift']());}};_0x5dfefb(++_0x46a223);}(_0x4888,0x198));var _0x8488=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0x4888[_0x12c66e];return _0x19481a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['Integration']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));}; \ No newline at end of file +var _0x5d58=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Integration','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xe220a1,_0x5398d6){var _0x2279b9=function(_0x258297){while(--_0x258297){_0xe220a1['push'](_0xe220a1['shift']());}};_0x2279b9(++_0x5398d6);}(_0x5d58,0x187));var _0x85d5=function(_0x392e4f,_0x5235d0){_0x392e4f=_0x392e4f-0x0;var _0x93b348=_0x5d58[_0x392e4f];return _0x93b348;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['Integration']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['Integration'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['Integration'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0d90895..3aa1843 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 _0xa2c2=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations'];(function(_0x59400c,_0x364897){var _0x51508d=function(_0x1f7682){while(--_0x1f7682){_0x59400c['push'](_0x59400c['shift']());}};_0x51508d(++_0x364897);}(_0xa2c2,0xfc));var _0x2a2c=function(_0x2dd2c3,_0xb558a){_0x2dd2c3=_0x2dd2c3-0x0;var _0x457196=_0xa2c2[_0x2dd2c3];return _0x457196;};'use strict';var _=require('lodash');var util=require(_0x2a2c('0x0'));var logger=require(_0x2a2c('0x1'))('api');var moment=require(_0x2a2c('0x2'));var BPromise=require(_0x2a2c('0x3'));var rp=require(_0x2a2c('0x4'));var fs=require('fs');var path=require(_0x2a2c('0x5'));var rimraf=require(_0x2a2c('0x6'));var config=require(_0x2a2c('0x7'));var attributes=require(_0x2a2c('0x8'));module[_0x2a2c('0x9')]=function(_0x4d7c3e,_0x10d7e9){return _0x4d7c3e['define'](_0x2a2c('0xa'),attributes,{'tableName':_0x2a2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3df=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','../../config/logger','moment','bluebird'];(function(_0x2ced88,_0x524cb3){var _0xac5b0d=function(_0x3f240f){while(--_0x3f240f){_0x2ced88['push'](_0x2ced88['shift']());}};_0xac5b0d(++_0x524cb3);}(_0xe3df,0x1c0));var _0xfe3d=function(_0x5676e1,_0x3aa682){_0x5676e1=_0x5676e1-0x0;var _0x5ef6b2=_0xe3df[_0x5676e1];return _0x5ef6b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe3d('0x0'))('api');var moment=require(_0xfe3d('0x1'));var BPromise=require(_0xfe3d('0x2'));var rp=require(_0xfe3d('0x3'));var fs=require('fs');var path=require(_0xfe3d('0x4'));var rimraf=require(_0xfe3d('0x5'));var config=require(_0xfe3d('0x6'));var attributes=require(_0xfe3d('0x7'));module[_0xfe3d('0x8')]=function(_0x1d8b25,_0x4265ec){return _0x1d8b25[_0xfe3d('0x9')](_0xfe3d('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 3cd1326..2104a04 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x7633c,_0x1e45bf){var _0x1b77e2=function(_0x4c3e7f){while(--_0x4c3e7f){_0x7633c['push'](_0x7633c['shift']());}};_0x1b77e2(++_0x1e45bf);}(_0xadb5,0xad));var _0x5adb=function(_0x12d7d6,_0x538329){_0x12d7d6=_0x12d7d6-0x0;var _0x487929=_0xadb5[_0x12d7d6];return _0x487929;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x4975,0x86));var _0x5497=function(_0x21dbf1,_0x2cfa63){_0x21dbf1=_0x21dbf1-0x0;var _0x523bb1=_0x4975[_0x21dbf1];return _0x523bb1;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Integration,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0e96a9f..dd96e87 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x269bc7,_0x260562){_0x269bc7=_0x269bc7-0x0;var _0x44e6d5=_0x5f2f[_0x269bc7];return _0x44e6d5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 34d7900..5a939db 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 _0x0d3a=['INTEGER','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d3a,0xa1));var _0xa0d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d3a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa0d3('0x0'));module[_0xa0d3('0x1')]={'integration':{'type':Sequelize[_0xa0d3('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xa0d3('0x2')]},'ticketId':{'type':Sequelize[_0xa0d3('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xa0d3('0x2')]},'uniqueid':{'type':Sequelize[_0xa0d3('0x2')]},'calleridnum':{'type':Sequelize[_0xa0d3('0x2')]},'calleridname':{'type':Sequelize[_0xa0d3('0x2')]},'queue':{'type':Sequelize[_0xa0d3('0x2')]},'interface':{'type':Sequelize[_0xa0d3('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa0d3('0x3')]},'holdtime':{'type':Sequelize[_0xa0d3('0x4')]},'agentcomplete':{'type':Sequelize[_0xa0d3('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa0d3('0x3')]},'talktime':{'type':Sequelize[_0xa0d3('0x4')]},'agentacw':{'type':Sequelize[_0xa0d3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa0d3('0x4')]},'reason':{'type':Sequelize[_0xa0d3('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa0d3('0x3')]},'agentdump':{'type':Sequelize[_0xa0d3('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa0d3('0x3')]},'lastevent':{'type':Sequelize[_0xa0d3('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa0d3('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa0d3('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa0d3('0x2')]},'connectedlinename':{'type':Sequelize[_0xa0d3('0x2')]},'language':{'type':Sequelize[_0xa0d3('0x2')]},'accountcode':{'type':Sequelize[_0xa0d3('0x2')]},'context':{'type':Sequelize[_0xa0d3('0x2')]},'exten':{'type':Sequelize[_0xa0d3('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa0d3('0x2')]},'destchannelstate':{'type':Sequelize[_0xa0d3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa0d3('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa0d3('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa0d3('0x2')]},'destlanguage':{'type':Sequelize[_0xa0d3('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa0d3('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa0d3('0x2')]},'inReplyTo':{'type':Sequelize[_0xa0d3('0x2')]},'subject':{'type':Sequelize[_0xa0d3('0x2')]},'from':{'type':Sequelize[_0xa0d3('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xa0d3('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa0d3('0x6')]},'text':{'type':Sequelize[_0xa0d3('0x6')]},'status':{'type':Sequelize['ENUM'](_0xa0d3('0x7'),_0xa0d3('0x8'),_0xa0d3('0x9'),_0xa0d3('0xa'))},'url':{'type':Sequelize[_0xa0d3('0x2')]},'app':{'type':Sequelize[_0xa0d3('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xa0d3('0x4')]}}; \ No newline at end of file +var _0xb921=['FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT','SENDING'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0xb921,0xa1));var _0x1b92=function(_0x499bdb,_0x41da3a){_0x499bdb=_0x499bdb-0x0;var _0x362d62=_0xb921[_0x499bdb];return _0x362d62;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1b92('0x2')]},'exitStatus':{'type':Sequelize[_0x1b92('0x2')]},'ticketId':{'type':Sequelize[_0x1b92('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x1b92('0x2')]},'uniqueid':{'type':Sequelize[_0x1b92('0x2')]},'calleridnum':{'type':Sequelize[_0x1b92('0x2')]},'calleridname':{'type':Sequelize[_0x1b92('0x2')]},'queue':{'type':Sequelize[_0x1b92('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1b92('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1b92('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1b92('0x3')]},'holdtime':{'type':Sequelize[_0x1b92('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1b92('0x3')]},'talktime':{'type':Sequelize[_0x1b92('0x4')]},'agentacw':{'type':Sequelize[_0x1b92('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1b92('0x4')]},'reason':{'type':Sequelize[_0x1b92('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x1b92('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1b92('0x3')]},'agentdump':{'type':Sequelize[_0x1b92('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1b92('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1b92('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b92('0x2')]},'connectedlinename':{'type':Sequelize[_0x1b92('0x2')]},'language':{'type':Sequelize[_0x1b92('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1b92('0x2')]},'exten':{'type':Sequelize[_0x1b92('0x2')]},'priority':{'type':Sequelize[_0x1b92('0x2')]},'destchannel':{'type':Sequelize[_0x1b92('0x2')]},'destchannelstate':{'type':Sequelize[_0x1b92('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x1b92('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1b92('0x2')]},'destcalleridname':{'type':Sequelize[_0x1b92('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1b92('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1b92('0x2')]},'destlanguage':{'type':Sequelize[_0x1b92('0x2')]},'destaccountcode':{'type':Sequelize[_0x1b92('0x2')]},'destcontext':{'type':Sequelize[_0x1b92('0x2')]},'destexten':{'type':Sequelize[_0x1b92('0x2')]},'destpriority':{'type':Sequelize[_0x1b92('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b92('0x2')]},'messageId':{'type':Sequelize[_0x1b92('0x2')]},'inReplyTo':{'type':Sequelize[_0x1b92('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1b92('0x2')]},'cc':{'type':Sequelize[_0x1b92('0x2')]},'attachment':{'type':Sequelize[_0x1b92('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x1b92('0x6')]},'status':{'type':Sequelize['ENUM'](_0x1b92('0x7'),_0x1b92('0x8'),'RECEIVED',_0x1b92('0x9'))},'url':{'type':Sequelize[_0x1b92('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 631d19a..38e2783 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 _0x05a6=['merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','IntegrationReport','rawAttributes','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x3ae298,_0x5cb1f3){var _0x5cb5b5=function(_0x1eeeaa){while(--_0x1eeeaa){_0x3ae298['push'](_0x3ae298['shift']());}};_0x5cb5b5(++_0x5cb1f3);}(_0x05a6,0x193));var _0x605a=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x05a6[_0x4c440b];return _0x2d48cf;};'use strict';var emlformat=require(_0x605a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x605a('0x1'));var jsonpatch=require(_0x605a('0x2'));var rp=require(_0x605a('0x3'));var moment=require(_0x605a('0x4'));var BPromise=require(_0x605a('0x5'));var Mustache=require(_0x605a('0x6'));var util=require(_0x605a('0x7'));var path=require(_0x605a('0x8'));var sox=require(_0x605a('0x9'));var csv=require(_0x605a('0xa'));var ejs=require(_0x605a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x605a('0xc'));var squel=require(_0x605a('0xd'));var crypto=require(_0x605a('0xe'));var jsforce=require(_0x605a('0xf'));var deskjs=require(_0x605a('0x10'));var toCsv=require(_0x605a('0xa'));var querystring=require(_0x605a('0x11'));var Papa=require(_0x605a('0x12'));var Redis=require(_0x605a('0x13'));var authService=require(_0x605a('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x605a('0x15'));var logger=require(_0x605a('0x16'))(_0x605a('0x17'));var utils=require('../../config/utils');var config=require(_0x605a('0x18'));var licenseUtil=require(_0x605a('0x19'));var db=require(_0x605a('0x1a'))['db'];function respondWithStatusCode(_0x397b83,_0x2e1191){_0x2e1191=_0x2e1191||0xcc;return function(_0x3d21fa){if(_0x3d21fa){return _0x397b83[_0x605a('0x1b')](_0x2e1191);}return _0x397b83[_0x605a('0x1c')](_0x2e1191)[_0x605a('0x1d')]();};}function respondWithResult(_0x4c7bc6,_0xba6c5){_0xba6c5=_0xba6c5||0xc8;return function(_0x3775de){if(_0x3775de){return _0x4c7bc6[_0x605a('0x1c')](_0xba6c5)['json'](_0x3775de);}};}function respondWithFilteredResult(_0x25c650,_0x46b507){return function(_0x4e59ef){if(_0x4e59ef){var _0x96ab8e=typeof _0x46b507[_0x605a('0x1e')]===_0x605a('0x1f')&&typeof _0x46b507[_0x605a('0x20')]===_0x605a('0x1f');var _0xde0545=_0x4e59ef[_0x605a('0x21')];var _0x2de1f2=_0x96ab8e?0x0:_0x46b507['offset'];var _0x4b9673=_0x96ab8e?_0x4e59ef['count']:_0x46b507[_0x605a('0x1e')]+_0x46b507[_0x605a('0x20')];var _0x1ab531;if(_0x4b9673>=_0xde0545){_0x4b9673=_0xde0545;_0x1ab531=0xc8;}else{_0x1ab531=0xce;}_0x25c650[_0x605a('0x1c')](_0x1ab531);return _0x25c650[_0x605a('0x22')](_0x605a('0x23'),_0x2de1f2+'-'+_0x4b9673+'/'+_0xde0545)['json'](_0x4e59ef);}return null;};}function patchUpdates(_0x980735){return function(_0x16b2c0){try{jsonpatch['apply'](_0x16b2c0,_0x980735,!![]);}catch(_0x482144){return BPromise[_0x605a('0x24')](_0x482144);}return _0x16b2c0['save']();};}function saveUpdates(_0x540dfa,_0x3fc112){return function(_0x4a752e){if(_0x4a752e){return _0x4a752e[_0x605a('0x25')](_0x540dfa)[_0x605a('0x26')](function(_0x5f5853){return _0x5f5853;});}return null;};}function removeEntity(_0x35c74f,_0x20936c){return function(_0x28c6a4){if(_0x28c6a4){return _0x28c6a4['destroy']()['then'](function(){_0x35c74f[_0x605a('0x1c')](0xcc)[_0x605a('0x1d')]();});}};}function handleEntityNotFound(_0x241133,_0x34138c){return function(_0x89b442){if(!_0x89b442){_0x241133[_0x605a('0x1b')](0x194);}return _0x89b442;};}function handleError(_0x300907,_0x333888){_0x333888=_0x333888||0x1f4;return function(_0x40bb3e){logger[_0x605a('0x27')](_0x40bb3e[_0x605a('0x28')]);if(_0x40bb3e[_0x605a('0x29')]){delete _0x40bb3e[_0x605a('0x29')];}_0x300907[_0x605a('0x1c')](_0x333888)[_0x605a('0x2a')](_0x40bb3e);};}exports['index']=function(_0x290903,_0x401d44){var _0x294d6c={},_0x4c8807={},_0x1b9714={'count':0x0,'rows':[]};var _0x1cd814=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x459d69){return{'name':_0x459d69[_0x605a('0x2b')],'type':_0x459d69['type']['key']};});_0x4c8807[_0x605a('0x2c')]=_[_0x605a('0x2d')](_0x1cd814,'name');_0x4c8807[_0x605a('0x2e')]=_[_0x605a('0x2f')](_0x290903[_0x605a('0x2e')]);_0x4c8807[_0x605a('0x30')]=_[_0x605a('0x31')](_0x4c8807[_0x605a('0x2c')],_0x4c8807[_0x605a('0x2e')]);_0x294d6c[_0x605a('0x32')]=_['intersection'](_0x4c8807[_0x605a('0x2c')],qs[_0x605a('0x33')](_0x290903[_0x605a('0x2e')][_0x605a('0x33')]));_0x294d6c[_0x605a('0x32')]=_0x294d6c[_0x605a('0x32')][_0x605a('0x34')]?_0x294d6c[_0x605a('0x32')]:_0x4c8807[_0x605a('0x2c')];if(!_0x290903['query']['hasOwnProperty'](_0x605a('0x35'))){_0x294d6c[_0x605a('0x20')]=qs[_0x605a('0x20')](_0x290903[_0x605a('0x2e')]['limit']);_0x294d6c[_0x605a('0x1e')]=qs[_0x605a('0x1e')](_0x290903['query']['offset']);}_0x294d6c[_0x605a('0x36')]=qs[_0x605a('0x37')](_0x290903['query'][_0x605a('0x37')]);_0x294d6c[_0x605a('0x38')]=qs[_0x605a('0x30')](_[_0x605a('0x39')](_0x290903[_0x605a('0x2e')],_0x4c8807[_0x605a('0x30')]),_0x1cd814);if(_0x290903[_0x605a('0x2e')][_0x605a('0x3a')]){_0x294d6c[_0x605a('0x38')]=_[_0x605a('0x3b')](_0x294d6c[_0x605a('0x38')],{'$or':_['map'](_0x1cd814,function(_0x1ab96f){if(_0x1ab96f[_0x605a('0x3c')]!==_0x605a('0x3d')){var _0x4dd318={};_0x4dd318[_0x1ab96f[_0x605a('0x29')]]={'$like':'%'+_0x290903[_0x605a('0x2e')]['filter']+'%'};return _0x4dd318;}})});}_0x294d6c=_['merge']({},_0x294d6c,_0x290903[_0x605a('0x3e')]);var _0x34b7d2={'where':_0x294d6c[_0x605a('0x38')]};return db['IntegrationReport'][_0x605a('0x21')](_0x34b7d2)[_0x605a('0x26')](function(_0xc66aff){_0x1b9714[_0x605a('0x21')]=_0xc66aff;if(_0x290903['query'][_0x605a('0x3f')]){_0x294d6c[_0x605a('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x605a('0x41')](_0x294d6c);})[_0x605a('0x26')](function(_0x6ed816){_0x1b9714[_0x605a('0x42')]=_0x6ed816;return _0x1b9714;})['then'](respondWithFilteredResult(_0x401d44,_0x294d6c))[_0x605a('0x43')](handleError(_0x401d44,null));};exports[_0x605a('0x44')]=function(_0x4db418,_0x27e65a){var _0x49a04={'raw':![],'where':{'id':_0x4db418['params']['id']}},_0x4eab7e={};_0x4eab7e[_0x605a('0x2c')]=_[_0x605a('0x2f')](db[_0x605a('0x45')][_0x605a('0x46')]);_0x4eab7e[_0x605a('0x2e')]=_['keys'](_0x4db418[_0x605a('0x2e')]);_0x4eab7e['filters']=_[_0x605a('0x31')](_0x4eab7e[_0x605a('0x2c')],_0x4eab7e[_0x605a('0x2e')]);_0x49a04[_0x605a('0x32')]=_[_0x605a('0x31')](_0x4eab7e[_0x605a('0x2c')],qs[_0x605a('0x33')](_0x4db418[_0x605a('0x2e')][_0x605a('0x33')]));_0x49a04[_0x605a('0x32')]=_0x49a04[_0x605a('0x32')][_0x605a('0x34')]?_0x49a04['attributes']:_0x4eab7e['model'];if(_0x4db418[_0x605a('0x2e')][_0x605a('0x3f')]){_0x49a04[_0x605a('0x40')]=[{'all':!![]}];}_0x49a04=_[_0x605a('0x3b')]({},_0x49a04,_0x4db418[_0x605a('0x3e')]);return db[_0x605a('0x45')][_0x605a('0x47')](_0x49a04)[_0x605a('0x26')](handleEntityNotFound(_0x27e65a,null))[_0x605a('0x26')](respondWithResult(_0x27e65a,null))[_0x605a('0x43')](handleError(_0x27e65a,null));};exports[_0x605a('0x48')]=function(_0x5e6d4c,_0x1d078a){return db[_0x605a('0x45')][_0x605a('0x48')](_0x5e6d4c[_0x605a('0x49')],{})['then'](respondWithResult(_0x1d078a,0xc9))[_0x605a('0x43')](handleError(_0x1d078a,null));};exports[_0x605a('0x25')]=function(_0xce4add,_0x47adf4){if(_0xce4add[_0x605a('0x49')]['id']){delete _0xce4add[_0x605a('0x49')]['id'];}return db[_0x605a('0x45')][_0x605a('0x47')]({'where':{'id':_0xce4add[_0x605a('0x4a')]['id']}})[_0x605a('0x26')](handleEntityNotFound(_0x47adf4,null))[_0x605a('0x26')](saveUpdates(_0xce4add[_0x605a('0x49')],null))[_0x605a('0x26')](respondWithResult(_0x47adf4,null))['catch'](handleError(_0x47adf4,null));};exports[_0x605a('0x4b')]=function(_0x2133db,_0x4f3bbe){return db['IntegrationReport'][_0x605a('0x47')]({'where':{'id':_0x2133db[_0x605a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f3bbe,null))[_0x605a('0x26')](removeEntity(_0x4f3bbe,null))[_0x605a('0x43')](handleError(_0x4f3bbe,null));};exports[_0x605a('0x4c')]=function(_0x5b4ee4,_0x30b5c9){return db[_0x605a('0x45')][_0x605a('0x4c')]()[_0x605a('0x26')](respondWithResult(_0x30b5c9,null))[_0x605a('0x43')](handleError(_0x30b5c9,null));}; \ No newline at end of file +var _0x9e53=['keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','rows','params','rawAttributes','fields','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','IntegrationReport','fieldName','type','key','model','query'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9e53,0x1d5));var _0x39e5=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x9e53[_0x30bd4d];return _0x306915;};'use strict';var emlformat=require(_0x39e5('0x0'));var rimraf=require(_0x39e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39e5('0x2'));var rp=require(_0x39e5('0x3'));var moment=require(_0x39e5('0x4'));var BPromise=require(_0x39e5('0x5'));var Mustache=require(_0x39e5('0x6'));var util=require(_0x39e5('0x7'));var path=require('path');var sox=require(_0x39e5('0x8'));var csv=require(_0x39e5('0x9'));var ejs=require(_0x39e5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39e5('0xb'));var squel=require('squel');var crypto=require(_0x39e5('0xc'));var jsforce=require(_0x39e5('0xd'));var deskjs=require(_0x39e5('0xe'));var toCsv=require(_0x39e5('0x9'));var querystring=require('querystring');var Papa=require(_0x39e5('0xf'));var Redis=require(_0x39e5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x39e5('0x11'));var as=require(_0x39e5('0x12'));var hardwareService=require(_0x39e5('0x13'));var logger=require('../../config/logger')(_0x39e5('0x14'));var utils=require(_0x39e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x39e5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b53c6,_0x174571){_0x174571=_0x174571||0xcc;return function(_0x16d375){if(_0x16d375){return _0x2b53c6[_0x39e5('0x17')](_0x174571);}return _0x2b53c6['status'](_0x174571)[_0x39e5('0x18')]();};}function respondWithResult(_0x1cbb89,_0x1d5299){_0x1d5299=_0x1d5299||0xc8;return function(_0x155cfe){if(_0x155cfe){return _0x1cbb89[_0x39e5('0x19')](_0x1d5299)[_0x39e5('0x1a')](_0x155cfe);}};}function respondWithFilteredResult(_0x13554c,_0x46da34){return function(_0x57db6b){if(_0x57db6b){var _0x2580ca=typeof _0x46da34['offset']===_0x39e5('0x1b')&&typeof _0x46da34[_0x39e5('0x1c')]===_0x39e5('0x1b');var _0x5d9804=_0x57db6b[_0x39e5('0x1d')];var _0x347bde=_0x2580ca?0x0:_0x46da34['offset'];var _0x13273d=_0x2580ca?_0x57db6b[_0x39e5('0x1d')]:_0x46da34[_0x39e5('0x1e')]+_0x46da34[_0x39e5('0x1c')];var _0x2b40b5;if(_0x13273d>=_0x5d9804){_0x13273d=_0x5d9804;_0x2b40b5=0xc8;}else{_0x2b40b5=0xce;}_0x13554c[_0x39e5('0x19')](_0x2b40b5);return _0x13554c['set'](_0x39e5('0x1f'),_0x347bde+'-'+_0x13273d+'/'+_0x5d9804)[_0x39e5('0x1a')](_0x57db6b);}return null;};}function patchUpdates(_0x532fa4){return function(_0x228a66){try{jsonpatch[_0x39e5('0x20')](_0x228a66,_0x532fa4,!![]);}catch(_0x4035e9){return BPromise[_0x39e5('0x21')](_0x4035e9);}return _0x228a66[_0x39e5('0x22')]();};}function saveUpdates(_0x374b2d,_0x117e58){return function(_0x106694){if(_0x106694){return _0x106694[_0x39e5('0x23')](_0x374b2d)[_0x39e5('0x24')](function(_0x270149){return _0x270149;});}return null;};}function removeEntity(_0x574e2d,_0xf7321){return function(_0x449c31){if(_0x449c31){return _0x449c31[_0x39e5('0x25')]()[_0x39e5('0x24')](function(){_0x574e2d[_0x39e5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b58b,_0x42bfd0){return function(_0x39d6c4){if(!_0x39d6c4){_0x47b58b[_0x39e5('0x17')](0x194);}return _0x39d6c4;};}function handleError(_0x863dbb,_0x36eb05){_0x36eb05=_0x36eb05||0x1f4;return function(_0x4c4cb7){logger['error'](_0x4c4cb7[_0x39e5('0x26')]);if(_0x4c4cb7['name']){delete _0x4c4cb7[_0x39e5('0x27')];}_0x863dbb[_0x39e5('0x19')](_0x36eb05)[_0x39e5('0x28')](_0x4c4cb7);};}exports[_0x39e5('0x29')]=function(_0x307c43,_0x3b948b){var _0x30b894={},_0x12b75f={},_0x221050={'count':0x0,'rows':[]};var _0x5df36b=_[_0x39e5('0x2a')](db[_0x39e5('0x2b')]['rawAttributes'],function(_0x125713){return{'name':_0x125713[_0x39e5('0x2c')],'type':_0x125713[_0x39e5('0x2d')][_0x39e5('0x2e')]};});_0x12b75f[_0x39e5('0x2f')]=_[_0x39e5('0x2a')](_0x5df36b,'name');_0x12b75f[_0x39e5('0x30')]=_[_0x39e5('0x31')](_0x307c43['query']);_0x12b75f['filters']=_[_0x39e5('0x32')](_0x12b75f[_0x39e5('0x2f')],_0x12b75f[_0x39e5('0x30')]);_0x30b894[_0x39e5('0x33')]=_[_0x39e5('0x32')](_0x12b75f[_0x39e5('0x2f')],qs['fields'](_0x307c43[_0x39e5('0x30')]['fields']));_0x30b894[_0x39e5('0x33')]=_0x30b894[_0x39e5('0x33')][_0x39e5('0x34')]?_0x30b894[_0x39e5('0x33')]:_0x12b75f[_0x39e5('0x2f')];if(!_0x307c43[_0x39e5('0x30')][_0x39e5('0x35')](_0x39e5('0x36'))){_0x30b894[_0x39e5('0x1c')]=qs[_0x39e5('0x1c')](_0x307c43[_0x39e5('0x30')][_0x39e5('0x1c')]);_0x30b894[_0x39e5('0x1e')]=qs[_0x39e5('0x1e')](_0x307c43[_0x39e5('0x30')][_0x39e5('0x1e')]);}_0x30b894[_0x39e5('0x37')]=qs[_0x39e5('0x38')](_0x307c43[_0x39e5('0x30')][_0x39e5('0x38')]);_0x30b894[_0x39e5('0x39')]=qs['filters'](_['pick'](_0x307c43['query'],_0x12b75f[_0x39e5('0x3a')]),_0x5df36b);if(_0x307c43[_0x39e5('0x30')][_0x39e5('0x3b')]){_0x30b894[_0x39e5('0x39')]=_[_0x39e5('0x3c')](_0x30b894[_0x39e5('0x39')],{'$or':_['map'](_0x5df36b,function(_0x1b48e5){if(_0x1b48e5[_0x39e5('0x2d')]!==_0x39e5('0x3d')){var _0x1b5e69={};_0x1b5e69[_0x1b48e5[_0x39e5('0x27')]]={'$like':'%'+_0x307c43[_0x39e5('0x30')][_0x39e5('0x3b')]+'%'};return _0x1b5e69;}})});}_0x30b894=_[_0x39e5('0x3c')]({},_0x30b894,_0x307c43[_0x39e5('0x3e')]);var _0xef2bd0={'where':_0x30b894[_0x39e5('0x39')]};return db[_0x39e5('0x2b')]['count'](_0xef2bd0)['then'](function(_0x2f61ed){_0x221050[_0x39e5('0x1d')]=_0x2f61ed;if(_0x307c43[_0x39e5('0x30')]['includeAll']){_0x30b894['include']=[{'all':!![]}];}return db[_0x39e5('0x2b')]['findAll'](_0x30b894);})[_0x39e5('0x24')](function(_0x42facd){_0x221050[_0x39e5('0x3f')]=_0x42facd;return _0x221050;})[_0x39e5('0x24')](respondWithFilteredResult(_0x3b948b,_0x30b894))['catch'](handleError(_0x3b948b,null));};exports['show']=function(_0x4c0e09,_0x5b179f){var _0x104e1c={'raw':![],'where':{'id':_0x4c0e09[_0x39e5('0x40')]['id']}},_0x420df7={};_0x420df7[_0x39e5('0x2f')]=_[_0x39e5('0x31')](db[_0x39e5('0x2b')][_0x39e5('0x41')]);_0x420df7[_0x39e5('0x30')]=_[_0x39e5('0x31')](_0x4c0e09[_0x39e5('0x30')]);_0x420df7[_0x39e5('0x3a')]=_[_0x39e5('0x32')](_0x420df7[_0x39e5('0x2f')],_0x420df7[_0x39e5('0x30')]);_0x104e1c['attributes']=_[_0x39e5('0x32')](_0x420df7['model'],qs[_0x39e5('0x42')](_0x4c0e09[_0x39e5('0x30')][_0x39e5('0x42')]));_0x104e1c['attributes']=_0x104e1c[_0x39e5('0x33')][_0x39e5('0x34')]?_0x104e1c[_0x39e5('0x33')]:_0x420df7['model'];if(_0x4c0e09[_0x39e5('0x30')][_0x39e5('0x43')]){_0x104e1c[_0x39e5('0x44')]=[{'all':!![]}];}_0x104e1c=_[_0x39e5('0x3c')]({},_0x104e1c,_0x4c0e09[_0x39e5('0x3e')]);return db['IntegrationReport'][_0x39e5('0x45')](_0x104e1c)[_0x39e5('0x24')](handleEntityNotFound(_0x5b179f,null))[_0x39e5('0x24')](respondWithResult(_0x5b179f,null))[_0x39e5('0x46')](handleError(_0x5b179f,null));};exports[_0x39e5('0x47')]=function(_0x499883,_0x30e709){return db[_0x39e5('0x2b')]['create'](_0x499883[_0x39e5('0x48')],{})['then'](respondWithResult(_0x30e709,0xc9))[_0x39e5('0x46')](handleError(_0x30e709,null));};exports[_0x39e5('0x23')]=function(_0xc20758,_0x514899){if(_0xc20758[_0x39e5('0x48')]['id']){delete _0xc20758[_0x39e5('0x48')]['id'];}return db[_0x39e5('0x2b')][_0x39e5('0x45')]({'where':{'id':_0xc20758['params']['id']}})['then'](handleEntityNotFound(_0x514899,null))['then'](saveUpdates(_0xc20758[_0x39e5('0x48')],null))['then'](respondWithResult(_0x514899,null))['catch'](handleError(_0x514899,null));};exports['destroy']=function(_0x52872f,_0x45fbc6){return db[_0x39e5('0x2b')][_0x39e5('0x45')]({'where':{'id':_0x52872f[_0x39e5('0x40')]['id']}})[_0x39e5('0x24')](handleEntityNotFound(_0x45fbc6,null))[_0x39e5('0x24')](removeEntity(_0x45fbc6,null))[_0x39e5('0x46')](handleError(_0x45fbc6,null));};exports[_0x39e5('0x49')]=function(_0x4b1969,_0x155c4a){return db['IntegrationReport'][_0x39e5('0x49')]()[_0x39e5('0x24')](respondWithResult(_0x155c4a,null))[_0x39e5('0x46')](handleError(_0x155c4a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1a232d9..fe944c6 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 _0x820b=['bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','lodash','util','../../config/logger','api','moment'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x820b,0xd8));var _0xb820=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x820b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb820('0x0'));var util=require(_0xb820('0x1'));var logger=require(_0xb820('0x2'))(_0xb820('0x3'));var moment=require(_0xb820('0x4'));var BPromise=require(_0xb820('0x5'));var rp=require(_0xb820('0x6'));var fs=require('fs');var path=require(_0xb820('0x7'));var rimraf=require(_0xb820('0x8'));var config=require(_0xb820('0x9'));var attributes=require(_0xb820('0xa'));module[_0xb820('0xb')]=function(_0x3968cc,_0x4aabb9){return _0x3968cc['define'](_0xb820('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fa=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x460db6,_0x4178c8){var _0x53201d=function(_0x119982){while(--_0x119982){_0x460db6['push'](_0x460db6['shift']());}};_0x53201d(++_0x4178c8);}(_0xb5fa,0x123));var _0xab5f=function(_0x3036cf,_0x319c4f){_0x3036cf=_0x3036cf-0x0;var _0x29c007=_0xb5fa[_0x3036cf];return _0x29c007;};'use strict';var _=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var logger=require(_0xab5f('0x2'))(_0xab5f('0x3'));var moment=require(_0xab5f('0x4'));var BPromise=require(_0xab5f('0x5'));var rp=require(_0xab5f('0x6'));var fs=require('fs');var path=require(_0xab5f('0x7'));var rimraf=require('rimraf');var config=require(_0xab5f('0x8'));var attributes=require(_0xab5f('0x9'));module[_0xab5f('0xa')]=function(_0x243a31,_0x19dfee){return _0x243a31[_0xab5f('0xb')](_0xab5f('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index ae8bc25..827772b 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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3b32f4,_0x11fc14){var _0x5b8f92=function(_0x51ca61){while(--_0x51ca61){_0x3b32f4['push'](_0x3b32f4['shift']());}};_0x5b8f92(++_0x11fc14);}(_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']('IntegrationReport,\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);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2d4686,_0x3d6dbb){var _0x16f68b=function(_0x4eb4f1){while(--_0x4eb4f1){_0x2d4686['push'](_0x2d4686['shift']());}};_0x16f68b(++_0x3d6dbb);}(_0x31f0,0xb7));var _0x031f=function(_0x555d8a,_0x34b39f){_0x555d8a=_0x555d8a-0x0;var _0xbed317=_0x31f0[_0x555d8a];return _0xbed317;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 81d4269..4b5dd81 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 _0xa777=['../../components/interaction/service','../../config/environment','./interval.controller','get','index','show','isAuthenticated','getIntervals','post','create','/:id/sub_intervals','/:id/sub_intervals/create_many','addIntervals','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0xa777,0x102));var _0x7a77=function(_0x308157,_0x2b0d6b){_0x308157=_0x308157-0x0;var _0x521ceb=_0xa777[_0x308157];return _0x521ceb;};'use strict';var multer=require('multer');var util=require(_0x7a77('0x0'));var path=require(_0x7a77('0x1'));var timeout=require(_0x7a77('0x2'));var express=require(_0x7a77('0x3'));var router=express[_0x7a77('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a77('0x5'));var interaction=require(_0x7a77('0x6'));var config=require(_0x7a77('0x7'));var controller=require(_0x7a77('0x8'));router[_0x7a77('0x9')]('/',auth['isAuthenticated'](),controller[_0x7a77('0xa')]);router[_0x7a77('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7a77('0xb')]);router[_0x7a77('0x9')]('/:id/sub_intervals',auth[_0x7a77('0xc')](),controller[_0x7a77('0xd')]);router[_0x7a77('0xe')]('/',auth[_0x7a77('0xc')](),controller[_0x7a77('0xf')]);router[_0x7a77('0xe')](_0x7a77('0x10'),auth[_0x7a77('0xc')](),controller['addInterval']);router[_0x7a77('0xe')](_0x7a77('0x11'),auth[_0x7a77('0xc')](),controller[_0x7a77('0x12')]);router[_0x7a77('0x13')]('/:id',auth[_0x7a77('0xc')](),controller['update']);router[_0x7a77('0x14')](_0x7a77('0x15'),auth['isAuthenticated'](),controller[_0x7a77('0x16')]);module[_0x7a77('0x17')]=router; \ No newline at end of file +var _0xf6da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0xf6da,0x19f));var _0xaf6d=function(_0x8b3f38,_0x321d26){_0x8b3f38=_0x8b3f38-0x0;var _0x1072c9=_0xf6da[_0x8b3f38];return _0x1072c9;};'use strict';var multer=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var path=require(_0xaf6d('0x2'));var timeout=require(_0xaf6d('0x3'));var express=require(_0xaf6d('0x4'));var router=express[_0xaf6d('0x5')]();var fs_extra=require(_0xaf6d('0x6'));var auth=require(_0xaf6d('0x7'));var interaction=require(_0xaf6d('0x8'));var config=require(_0xaf6d('0x9'));var controller=require('./interval.controller');router[_0xaf6d('0xa')]('/',auth[_0xaf6d('0xb')](),controller[_0xaf6d('0xc')]);router[_0xaf6d('0xa')](_0xaf6d('0xd'),auth[_0xaf6d('0xb')](),controller[_0xaf6d('0xe')]);router[_0xaf6d('0xa')]('/:id/sub_intervals',auth[_0xaf6d('0xb')](),controller['getIntervals']);router['post']('/',auth[_0xaf6d('0xb')](),controller[_0xaf6d('0xf')]);router[_0xaf6d('0x10')](_0xaf6d('0x11'),auth[_0xaf6d('0xb')](),controller[_0xaf6d('0x12')]);router['post'](_0xaf6d('0x13'),auth[_0xaf6d('0xb')](),controller[_0xaf6d('0x14')]);router[_0xaf6d('0x15')](_0xaf6d('0xd'),auth['isAuthenticated'](),controller[_0xaf6d('0x16')]);router[_0xaf6d('0x17')](_0xaf6d('0xd'),auth['isAuthenticated'](),controller[_0xaf6d('0x18')]);module[_0xaf6d('0x19')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d3ebe3b..a8c0d83 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 _0xa1d1=['sequelize','STRING'];(function(_0x2ac1eb,_0x5955e0){var _0x22d131=function(_0x4478f3){while(--_0x4478f3){_0x2ac1eb['push'](_0x2ac1eb['shift']());}};_0x22d131(++_0x5955e0);}(_0xa1d1,0x194));var _0x1a1d=function(_0x2b6ca8,_0x4d054b){_0x2b6ca8=_0x2b6ca8-0x0;var _0x13e975=_0xa1d1[_0x2b6ca8];return _0x13e975;};'use strict';var Sequelize=require(_0x1a1d('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a1d('0x1')]},'description':{'type':Sequelize[_0x1a1d('0x1')]},'interval':{'type':Sequelize[_0x1a1d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x107b=['sequelize','STRING'];(function(_0x42f137,_0x3e8b05){var _0x26bcc5=function(_0x106250){while(--_0x106250){_0x42f137['push'](_0x42f137['shift']());}};_0x26bcc5(++_0x3e8b05);}(_0x107b,0x1f4));var _0xb107=function(_0x5e7734,_0x58e17d){_0x5e7734=_0x5e7734-0x0;var _0x30adf8=_0x107b[_0x5e7734];return _0x30adf8;};'use strict';var Sequelize=require(_0xb107('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb107('0x1')]},'interval':{'type':Sequelize[_0xb107('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 6afb0d9..257db40 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 _0x63de=['keys','filters','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','addInterval','getIntervals','filter','findOne','sequelize','transaction','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','save','update','then','get','Intervals','UserProfileResource','end','stack','name','send','map','Interval','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes'];(function(_0xff21b9,_0x56cf67){var _0x4e9e2e=function(_0x4df67b){while(--_0x4df67b){_0xff21b9['push'](_0xff21b9['shift']());}};_0x4e9e2e(++_0x56cf67);}(_0x63de,0x134));var _0xe63d=function(_0x122279,_0x5114b2){_0x122279=_0x122279-0x0;var _0x619c4=_0x63de[_0x122279];return _0x619c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe63d('0x0'));var zipdir=require(_0xe63d('0x1'));var jsonpatch=require(_0xe63d('0x2'));var rp=require(_0xe63d('0x3'));var moment=require(_0xe63d('0x4'));var BPromise=require(_0xe63d('0x5'));var Mustache=require('mustache');var util=require(_0xe63d('0x6'));var path=require(_0xe63d('0x7'));var sox=require(_0xe63d('0x8'));var csv=require(_0xe63d('0x9'));var ejs=require(_0xe63d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe63d('0xb'));var squel=require(_0xe63d('0xc'));var crypto=require(_0xe63d('0xd'));var jsforce=require(_0xe63d('0xe'));var deskjs=require(_0xe63d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe63d('0x10'));var Papa=require(_0xe63d('0x11'));var Redis=require(_0xe63d('0x12'));var authService=require(_0xe63d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe63d('0x14'));var hardwareService=require(_0xe63d('0x15'));var logger=require(_0xe63d('0x16'))(_0xe63d('0x17'));var utils=require('../../config/utils');var config=require(_0xe63d('0x18'));var licenseUtil=require(_0xe63d('0x19'));var db=require(_0xe63d('0x1a'))['db'];var extensions=require(_0xe63d('0x1b'));function respondWithStatusCode(_0x547d4,_0x490df7){_0x490df7=_0x490df7||0xcc;return function(_0x5748d5){if(_0x5748d5){return _0x547d4[_0xe63d('0x1c')](_0x490df7);}return _0x547d4[_0xe63d('0x1d')](_0x490df7)['end']();};}function respondWithResult(_0x173024,_0x1f8a4b){_0x1f8a4b=_0x1f8a4b||0xc8;return function(_0x97032f){if(_0x97032f){return _0x173024[_0xe63d('0x1d')](_0x1f8a4b)['json'](_0x97032f);}};}function respondWithFilteredResult(_0x58b3fb,_0x95e756){return function(_0x5c8b46){if(_0x5c8b46){var _0x135163=typeof _0x95e756[_0xe63d('0x1e')]===_0xe63d('0x1f')&&typeof _0x95e756['limit']===_0xe63d('0x1f');var _0x460b4c=_0x5c8b46[_0xe63d('0x20')];var _0x1ea4e9=_0x135163?0x0:_0x95e756[_0xe63d('0x1e')];var _0x5c85a9=_0x135163?_0x5c8b46[_0xe63d('0x20')]:_0x95e756[_0xe63d('0x1e')]+_0x95e756[_0xe63d('0x21')];var _0x124acf;if(_0x5c85a9>=_0x460b4c){_0x5c85a9=_0x460b4c;_0x124acf=0xc8;}else{_0x124acf=0xce;}_0x58b3fb[_0xe63d('0x1d')](_0x124acf);return _0x58b3fb[_0xe63d('0x22')](_0xe63d('0x23'),_0x1ea4e9+'-'+_0x5c85a9+'/'+_0x460b4c)[_0xe63d('0x24')](_0x5c8b46);}return null;};}function patchUpdates(_0x1e496d){return function(_0xf976ff){try{jsonpatch['apply'](_0xf976ff,_0x1e496d,!![]);}catch(_0xbee7b3){return BPromise['reject'](_0xbee7b3);}return _0xf976ff[_0xe63d('0x25')]();};}function saveUpdates(_0x1e99a5,_0x2283e8){return function(_0x5c1e5a){if(_0x5c1e5a){return _0x5c1e5a[_0xe63d('0x26')](_0x1e99a5)[_0xe63d('0x27')](function(_0x3abb84){return _0x3abb84;});}return null;};}function removeEntity(_0x13a907,_0x1aba95){return function(_0x379b78){if(_0x379b78){return _0x379b78['destroy']()[_0xe63d('0x27')](function(){var _0x4e2de1=_0x379b78[_0xe63d('0x28')]({'plain':!![]});var _0xe5cd54=_0xe63d('0x29');return db[_0xe63d('0x2a')]['destroy']({'where':{'type':_0xe5cd54,'resourceId':_0x4e2de1['id']}})[_0xe63d('0x27')](function(){return _0x379b78;});})['then'](function(){_0x13a907[_0xe63d('0x1d')](0xcc)[_0xe63d('0x2b')]();});}};}function handleEntityNotFound(_0x10f527,_0x3c98d4){return function(_0x253a1b){if(!_0x253a1b){_0x10f527[_0xe63d('0x1c')](0x194);}return _0x253a1b;};}function handleError(_0x42cc30,_0x3350a5){_0x3350a5=_0x3350a5||0x1f4;return function(_0x8df06c){logger['error'](_0x8df06c[_0xe63d('0x2c')]);if(_0x8df06c['name']){delete _0x8df06c[_0xe63d('0x2d')];}_0x42cc30[_0xe63d('0x1d')](_0x3350a5)[_0xe63d('0x2e')](_0x8df06c);};}exports['index']=function(_0x46fe98,_0x37b1b9){var _0x1b2b9e={},_0x1b436c={},_0x57c141={'count':0x0,'rows':[]};var _0x1e9ac5=_[_0xe63d('0x2f')](db[_0xe63d('0x30')]['rawAttributes'],function(_0xaa4ebb){return{'name':_0xaa4ebb['fieldName'],'type':_0xaa4ebb['type'][_0xe63d('0x31')]};});_0x1b436c[_0xe63d('0x32')]=_[_0xe63d('0x2f')](_0x1e9ac5,_0xe63d('0x2d'));_0x1b436c[_0xe63d('0x33')]=_['keys'](_0x46fe98[_0xe63d('0x33')]);_0x1b436c['filters']=_[_0xe63d('0x34')](_0x1b436c[_0xe63d('0x32')],_0x1b436c[_0xe63d('0x33')]);_0x1b2b9e[_0xe63d('0x35')]=_['intersection'](_0x1b436c[_0xe63d('0x32')],qs[_0xe63d('0x36')](_0x46fe98[_0xe63d('0x33')][_0xe63d('0x36')]));_0x1b2b9e[_0xe63d('0x35')]=_0x1b2b9e[_0xe63d('0x35')]['length']?_0x1b2b9e[_0xe63d('0x35')]:_0x1b436c[_0xe63d('0x32')];if(!_0x46fe98[_0xe63d('0x33')][_0xe63d('0x37')](_0xe63d('0x38'))){_0x1b2b9e[_0xe63d('0x21')]=qs[_0xe63d('0x21')](_0x46fe98[_0xe63d('0x33')][_0xe63d('0x21')]);_0x1b2b9e[_0xe63d('0x1e')]=qs[_0xe63d('0x1e')](_0x46fe98[_0xe63d('0x33')][_0xe63d('0x1e')]);}_0x1b2b9e[_0xe63d('0x39')]=qs[_0xe63d('0x3a')](_0x46fe98['query'][_0xe63d('0x3a')]);_0x1b2b9e['where']=qs['filters'](_[_0xe63d('0x3b')](_0x46fe98[_0xe63d('0x33')],_0x1b436c['filters']),_0x1e9ac5);if(_0x46fe98['query']['filter']){_0x1b2b9e[_0xe63d('0x3c')]=_[_0xe63d('0x3d')](_0x1b2b9e[_0xe63d('0x3c')],{'$or':_[_0xe63d('0x2f')](_0x1e9ac5,function(_0x25fdca){if(_0x25fdca[_0xe63d('0x3e')]!==_0xe63d('0x3f')){var _0x144588={};_0x144588[_0x25fdca[_0xe63d('0x2d')]]={'$like':'%'+_0x46fe98['query']['filter']+'%'};return _0x144588;}})});}_0x1b2b9e=_[_0xe63d('0x3d')]({},_0x1b2b9e,_0x46fe98[_0xe63d('0x40')]);var _0x5d6fd5={'where':_0x1b2b9e[_0xe63d('0x3c')]};return db[_0xe63d('0x30')][_0xe63d('0x20')](_0x5d6fd5)[_0xe63d('0x27')](function(_0x1c5fe5){_0x57c141[_0xe63d('0x20')]=_0x1c5fe5;if(_0x46fe98['query'][_0xe63d('0x41')]){_0x1b2b9e[_0xe63d('0x42')]=[{'all':!![]}];}return db[_0xe63d('0x30')][_0xe63d('0x43')](_0x1b2b9e);})['then'](function(_0x4fd6e7){_0x57c141[_0xe63d('0x44')]=_0x4fd6e7;return _0x57c141;})[_0xe63d('0x27')](respondWithFilteredResult(_0x37b1b9,_0x1b2b9e))[_0xe63d('0x45')](handleError(_0x37b1b9,null));};exports[_0xe63d('0x46')]=function(_0x8bde42,_0x4443c1){var _0x4afa1a={'raw':!![],'where':{'id':_0x8bde42['params']['id']}},_0x5365f4={};_0x5365f4[_0xe63d('0x32')]=_['keys'](db[_0xe63d('0x30')][_0xe63d('0x47')]);_0x5365f4[_0xe63d('0x33')]=_[_0xe63d('0x48')](_0x8bde42[_0xe63d('0x33')]);_0x5365f4[_0xe63d('0x49')]=_[_0xe63d('0x34')](_0x5365f4[_0xe63d('0x32')],_0x5365f4[_0xe63d('0x33')]);_0x4afa1a[_0xe63d('0x35')]=_[_0xe63d('0x34')](_0x5365f4[_0xe63d('0x32')],qs['fields'](_0x8bde42[_0xe63d('0x33')]['fields']));_0x4afa1a[_0xe63d('0x35')]=_0x4afa1a[_0xe63d('0x35')][_0xe63d('0x4a')]?_0x4afa1a[_0xe63d('0x35')]:_0x5365f4['model'];if(_0x8bde42[_0xe63d('0x33')]['includeAll']){_0x4afa1a[_0xe63d('0x42')]=[{'all':!![]}];}_0x4afa1a=_[_0xe63d('0x3d')]({},_0x4afa1a,_0x8bde42['options']);return db[_0xe63d('0x30')][_0xe63d('0x4b')](_0x4afa1a)['then'](handleEntityNotFound(_0x4443c1,null))[_0xe63d('0x27')](respondWithResult(_0x4443c1,null))[_0xe63d('0x45')](handleError(_0x4443c1,null));};exports['create']=function(_0x417696,_0x31f84c){return db[_0xe63d('0x30')][_0xe63d('0x4c')](_0x417696['body'],{})['then'](function(_0x53bc54){var _0x3bab57=_0x417696[_0xe63d('0x4d')][_0xe63d('0x28')]({'plain':!![]});if(!_0x3bab57)throw new Error(_0xe63d('0x4e'));if(_0x3bab57[_0xe63d('0x4f')]===_0xe63d('0x4d')){var _0x5b9b64=_0x53bc54[_0xe63d('0x28')]({'plain':!![]});var _0x3e5862=_0xe63d('0x29');return db[_0xe63d('0x50')][_0xe63d('0x4b')]({'where':{'name':_0x3e5862,'userProfileId':_0x3bab57['userProfileId']},'raw':!![]})[_0xe63d('0x27')](function(_0x2ea019){if(_0x2ea019&&_0x2ea019[_0xe63d('0x51')]===0x0){return db[_0xe63d('0x2a')][_0xe63d('0x4c')]({'name':_0x5b9b64[_0xe63d('0x2d')],'resourceId':_0x5b9b64['id'],'type':_0x2ea019['name'],'sectionId':_0x2ea019['id']},{})[_0xe63d('0x27')](function(){return _0x53bc54;});}else{return _0x53bc54;}})[_0xe63d('0x45')](function(_0xd1d6e2){logger[_0xe63d('0x52')](_0xe63d('0x53'),_0xd1d6e2);throw _0xd1d6e2;});}return _0x53bc54;})[_0xe63d('0x27')](respondWithResult(_0x31f84c,0xc9))[_0xe63d('0x45')](handleError(_0x31f84c,null));};exports[_0xe63d('0x26')]=function(_0x202876,_0x499dcb){if(_0x202876[_0xe63d('0x54')]['id']){delete _0x202876[_0xe63d('0x54')]['id'];}return db[_0xe63d('0x30')][_0xe63d('0x4b')]({'where':{'id':_0x202876[_0xe63d('0x55')]['id']}})[_0xe63d('0x27')](handleEntityNotFound(_0x499dcb,null))[_0xe63d('0x27')](saveUpdates(_0x202876[_0xe63d('0x54')],null))[_0xe63d('0x27')](respondWithResult(_0x499dcb,null))[_0xe63d('0x45')](handleError(_0x499dcb,null));};exports[_0xe63d('0x56')]=function(_0x22d2b,_0x2554a6){return db[_0xe63d('0x30')][_0xe63d('0x4b')]({'where':{'id':_0x22d2b['params']['id']}})['then'](handleEntityNotFound(_0x2554a6,null))['then'](removeEntity(_0x2554a6,null))['catch'](handleError(_0x2554a6,null));};exports[_0xe63d('0x57')]=function(_0x3cfc6a,_0x4ac576,_0x34f7b3){if(_0x3cfc6a[_0xe63d('0x54')]['id']){delete _0x3cfc6a[_0xe63d('0x54')]['id'];}return db[_0xe63d('0x30')][_0xe63d('0x4b')]({'where':{'id':_0x3cfc6a['params']['id']}})[_0xe63d('0x27')](handleEntityNotFound(_0x4ac576,null))[_0xe63d('0x27')](function(_0x2b5617){if(_0x2b5617){_0x3cfc6a['body']['IntervalId']=_0x2b5617['id'];return db[_0xe63d('0x30')][_0xe63d('0x4c')](_0x3cfc6a[_0xe63d('0x54')]);}})['then'](respondWithResult(_0x4ac576,null))[_0xe63d('0x45')](handleError(_0x4ac576,null));};exports[_0xe63d('0x58')]=function(_0x3921e3,_0x1b6686,_0x25735b){var _0x4f88fe={};var _0x8554ad={};var _0x937e01;var _0x58d3c1;return db[_0xe63d('0x30')]['findOne']({'where':{'id':_0x3921e3['params']['id']}})[_0xe63d('0x27')](handleEntityNotFound(_0x1b6686,null))[_0xe63d('0x27')](function(_0x562280){if(_0x562280){_0x937e01=_0x562280;_0x8554ad['model']=_['keys'](db[_0xe63d('0x30')][_0xe63d('0x47')]);_0x8554ad[_0xe63d('0x33')]=_['keys'](_0x3921e3['query']);_0x8554ad[_0xe63d('0x49')]=_[_0xe63d('0x34')](_0x8554ad[_0xe63d('0x32')],_0x8554ad[_0xe63d('0x33')]);_0x4f88fe['attributes']=_[_0xe63d('0x34')](_0x8554ad[_0xe63d('0x32')],qs[_0xe63d('0x36')](_0x3921e3['query'][_0xe63d('0x36')]));_0x4f88fe[_0xe63d('0x35')]=_0x4f88fe[_0xe63d('0x35')]['length']?_0x4f88fe['attributes']:_0x8554ad['model'];_0x4f88fe[_0xe63d('0x39')]=qs[_0xe63d('0x3a')](_0x3921e3['query'][_0xe63d('0x3a')]);_0x4f88fe['where']=qs[_0xe63d('0x49')](_['pick'](_0x3921e3[_0xe63d('0x33')],_0x8554ad['filters']));if(_0x3921e3[_0xe63d('0x33')][_0xe63d('0x59')]){_0x4f88fe[_0xe63d('0x3c')]=_[_0xe63d('0x3d')](_0x4f88fe[_0xe63d('0x3c')],{'$or':_[_0xe63d('0x2f')](_0x4f88fe[_0xe63d('0x35')],function(_0x4ea1d3){var _0x578e12={};_0x578e12[_0x4ea1d3]={'$like':'%'+_0x3921e3[_0xe63d('0x33')]['filter']+'%'};return _0x578e12;})});}_0x4f88fe=_[_0xe63d('0x3d')]({},_0x4f88fe,_0x3921e3[_0xe63d('0x40')]);return _0x937e01['getIntervals'](_0x4f88fe);}})[_0xe63d('0x27')](function(_0x57a352){if(_0x57a352){_0x58d3c1=_0x57a352[_0xe63d('0x4a')];if(!_0x3921e3['query'][_0xe63d('0x37')](_0xe63d('0x38'))){_0x4f88fe[_0xe63d('0x21')]=qs[_0xe63d('0x21')](_0x3921e3['query'][_0xe63d('0x21')]);_0x4f88fe['offset']=qs[_0xe63d('0x1e')](_0x3921e3[_0xe63d('0x33')][_0xe63d('0x1e')]);}return _0x937e01['getIntervals'](_0x4f88fe);}})[_0xe63d('0x27')](function(_0xad1ab5){if(_0xad1ab5){return _0xad1ab5?{'count':_0x58d3c1,'rows':_0xad1ab5}:null;}})[_0xe63d('0x27')](respondWithResult(_0x1b6686,null))[_0xe63d('0x45')](handleError(_0x1b6686,null));};exports['addIntervals']=function(_0x24991b,_0x11b333,_0x56e67c){return db[_0xe63d('0x30')][_0xe63d('0x5a')]({'where':{'id':_0x24991b['params']['id']}})['then'](handleEntityNotFound(_0x11b333,null))[_0xe63d('0x27')](function(_0x4ac2a2){if(_0x4ac2a2){return db[_0xe63d('0x5b')][_0xe63d('0x5c')](function(_0x3337a2){return db[_0xe63d('0x30')][_0xe63d('0x56')]({'where':{'IntervalId':_0x24991b[_0xe63d('0x55')]['id']},'transaction':_0x3337a2})[_0xe63d('0x27')](function(_0x1d29c3){var _0x3c5eb1=_['map'](_0x24991b[_0xe63d('0x54')],function(_0x4c28eb){delete _0x4c28eb['id'];_0x4c28eb[_0xe63d('0x5d')]=_0x24991b[_0xe63d('0x55')]['id'];return _0x4c28eb;});return db[_0xe63d('0x30')][_0xe63d('0x5e')](_0x3c5eb1,{'transaction':_0x3337a2});});})[_0xe63d('0x27')](function(){return db['Interval'][_0xe63d('0x43')]({'where':{'IntervalId':_0x24991b[_0xe63d('0x55')]['id']}});});}})[_0xe63d('0x27')](respondWithResult(_0x11b333,null))[_0xe63d('0x45')](handleError(_0x11b333,null));}; \ No newline at end of file +var _0x36d6=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','IntervalId','pick','getIntervals','addIntervals','findOne','transaction','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x2d528b,_0x22d73f){var _0x19c8fa=function(_0x38f960){while(--_0x38f960){_0x2d528b['push'](_0x2d528b['shift']());}};_0x19c8fa(++_0x22d73f);}(_0x36d6,0x102));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x636d('0x0'));var rimraf=require(_0x636d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x636d('0x2'));var rp=require(_0x636d('0x3'));var moment=require('moment');var BPromise=require(_0x636d('0x4'));var Mustache=require(_0x636d('0x5'));var util=require('util');var path=require(_0x636d('0x6'));var sox=require(_0x636d('0x7'));var csv=require(_0x636d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x636d('0x9'));var _=require(_0x636d('0xa'));var squel=require(_0x636d('0xb'));var crypto=require(_0x636d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x636d('0xd'));var toCsv=require(_0x636d('0x8'));var querystring=require(_0x636d('0xe'));var Papa=require(_0x636d('0xf'));var Redis=require('ioredis');var authService=require(_0x636d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x636d('0x11'));var logger=require(_0x636d('0x12'))('api');var utils=require(_0x636d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x636d('0x14'));var db=require(_0x636d('0x15'))['db'];var extensions=require(_0x636d('0x16'));function respondWithStatusCode(_0x63ce65,_0x351ed2){_0x351ed2=_0x351ed2||0xcc;return function(_0x211dd1){if(_0x211dd1){return _0x63ce65[_0x636d('0x17')](_0x351ed2);}return _0x63ce65['status'](_0x351ed2)[_0x636d('0x18')]();};}function respondWithResult(_0x347462,_0x3c6668){_0x3c6668=_0x3c6668||0xc8;return function(_0x34f6e5){if(_0x34f6e5){return _0x347462[_0x636d('0x19')](_0x3c6668)[_0x636d('0x1a')](_0x34f6e5);}};}function respondWithFilteredResult(_0x5ac056,_0x463e77){return function(_0x73517e){if(_0x73517e){var _0x358440=typeof _0x463e77[_0x636d('0x1b')]===_0x636d('0x1c')&&typeof _0x463e77[_0x636d('0x1d')]==='undefined';var _0xae90e4=_0x73517e['count'];var _0x2bc19a=_0x358440?0x0:_0x463e77['offset'];var _0xcc9ba7=_0x358440?_0x73517e['count']:_0x463e77[_0x636d('0x1b')]+_0x463e77['limit'];var _0x2ab0ff;if(_0xcc9ba7>=_0xae90e4){_0xcc9ba7=_0xae90e4;_0x2ab0ff=0xc8;}else{_0x2ab0ff=0xce;}_0x5ac056[_0x636d('0x19')](_0x2ab0ff);return _0x5ac056[_0x636d('0x1e')](_0x636d('0x1f'),_0x2bc19a+'-'+_0xcc9ba7+'/'+_0xae90e4)[_0x636d('0x1a')](_0x73517e);}return null;};}function patchUpdates(_0x5c4a1b){return function(_0x2a0e78){try{jsonpatch[_0x636d('0x20')](_0x2a0e78,_0x5c4a1b,!![]);}catch(_0x314201){return BPromise[_0x636d('0x21')](_0x314201);}return _0x2a0e78[_0x636d('0x22')]();};}function saveUpdates(_0x5be85c,_0x1f99c2){return function(_0x50d458){if(_0x50d458){return _0x50d458['update'](_0x5be85c)[_0x636d('0x23')](function(_0xc4b928){return _0xc4b928;});}return null;};}function removeEntity(_0x4df151,_0x456a97){return function(_0x5513dd){if(_0x5513dd){return _0x5513dd[_0x636d('0x24')]()[_0x636d('0x23')](function(){var _0x2e059e=_0x5513dd[_0x636d('0x25')]({'plain':!![]});var _0x142fd0='Intervals';return db[_0x636d('0x26')][_0x636d('0x24')]({'where':{'type':_0x142fd0,'resourceId':_0x2e059e['id']}})[_0x636d('0x23')](function(){return _0x5513dd;});})[_0x636d('0x23')](function(){_0x4df151[_0x636d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50262a,_0x1072dd){return function(_0x58ded5){if(!_0x58ded5){_0x50262a['sendStatus'](0x194);}return _0x58ded5;};}function handleError(_0x499c9a,_0x22358b){_0x22358b=_0x22358b||0x1f4;return function(_0x400b6c){logger[_0x636d('0x27')](_0x400b6c[_0x636d('0x28')]);if(_0x400b6c[_0x636d('0x29')]){delete _0x400b6c[_0x636d('0x29')];}_0x499c9a['status'](_0x22358b)[_0x636d('0x2a')](_0x400b6c);};}exports[_0x636d('0x2b')]=function(_0x1ff0db,_0x33de48){var _0x457031={},_0x56fef8={},_0x41a495={'count':0x0,'rows':[]};var _0x34149c=_[_0x636d('0x2c')](db[_0x636d('0x2d')][_0x636d('0x2e')],function(_0x5d4e5f){return{'name':_0x5d4e5f['fieldName'],'type':_0x5d4e5f[_0x636d('0x2f')][_0x636d('0x30')]};});_0x56fef8[_0x636d('0x31')]=_['map'](_0x34149c,_0x636d('0x29'));_0x56fef8[_0x636d('0x32')]=_[_0x636d('0x33')](_0x1ff0db[_0x636d('0x32')]);_0x56fef8['filters']=_[_0x636d('0x34')](_0x56fef8['model'],_0x56fef8[_0x636d('0x32')]);_0x457031[_0x636d('0x35')]=_['intersection'](_0x56fef8[_0x636d('0x31')],qs[_0x636d('0x36')](_0x1ff0db['query'][_0x636d('0x36')]));_0x457031[_0x636d('0x35')]=_0x457031[_0x636d('0x35')][_0x636d('0x37')]?_0x457031['attributes']:_0x56fef8[_0x636d('0x31')];if(!_0x1ff0db[_0x636d('0x32')][_0x636d('0x38')](_0x636d('0x39'))){_0x457031[_0x636d('0x1d')]=qs['limit'](_0x1ff0db['query']['limit']);_0x457031[_0x636d('0x1b')]=qs[_0x636d('0x1b')](_0x1ff0db[_0x636d('0x32')][_0x636d('0x1b')]);}_0x457031[_0x636d('0x3a')]=qs[_0x636d('0x3b')](_0x1ff0db[_0x636d('0x32')][_0x636d('0x3b')]);_0x457031['where']=qs[_0x636d('0x3c')](_['pick'](_0x1ff0db[_0x636d('0x32')],_0x56fef8['filters']),_0x34149c);if(_0x1ff0db[_0x636d('0x32')]['filter']){_0x457031[_0x636d('0x3d')]=_[_0x636d('0x3e')](_0x457031[_0x636d('0x3d')],{'$or':_[_0x636d('0x2c')](_0x34149c,function(_0x5c8de7){if(_0x5c8de7[_0x636d('0x2f')]!==_0x636d('0x3f')){var _0x201b55={};_0x201b55[_0x5c8de7[_0x636d('0x29')]]={'$like':'%'+_0x1ff0db[_0x636d('0x32')][_0x636d('0x40')]+'%'};return _0x201b55;}})});}_0x457031=_[_0x636d('0x3e')]({},_0x457031,_0x1ff0db[_0x636d('0x41')]);var _0x5e443e={'where':_0x457031['where']};return db[_0x636d('0x2d')][_0x636d('0x42')](_0x5e443e)[_0x636d('0x23')](function(_0x4fa67e){_0x41a495['count']=_0x4fa67e;if(_0x1ff0db[_0x636d('0x32')][_0x636d('0x43')]){_0x457031['include']=[{'all':!![]}];}return db[_0x636d('0x2d')][_0x636d('0x44')](_0x457031);})[_0x636d('0x23')](function(_0xefc27b){_0x41a495[_0x636d('0x45')]=_0xefc27b;return _0x41a495;})[_0x636d('0x23')](respondWithFilteredResult(_0x33de48,_0x457031))['catch'](handleError(_0x33de48,null));};exports[_0x636d('0x46')]=function(_0x1fcda9,_0x1970a8){var _0x3f756a={'raw':!![],'where':{'id':_0x1fcda9[_0x636d('0x47')]['id']}},_0x2a305e={};_0x2a305e[_0x636d('0x31')]=_[_0x636d('0x33')](db['Interval'][_0x636d('0x2e')]);_0x2a305e[_0x636d('0x32')]=_['keys'](_0x1fcda9['query']);_0x2a305e[_0x636d('0x3c')]=_[_0x636d('0x34')](_0x2a305e[_0x636d('0x31')],_0x2a305e[_0x636d('0x32')]);_0x3f756a[_0x636d('0x35')]=_['intersection'](_0x2a305e[_0x636d('0x31')],qs[_0x636d('0x36')](_0x1fcda9[_0x636d('0x32')][_0x636d('0x36')]));_0x3f756a[_0x636d('0x35')]=_0x3f756a['attributes']['length']?_0x3f756a[_0x636d('0x35')]:_0x2a305e[_0x636d('0x31')];if(_0x1fcda9[_0x636d('0x32')][_0x636d('0x43')]){_0x3f756a['include']=[{'all':!![]}];}_0x3f756a=_[_0x636d('0x3e')]({},_0x3f756a,_0x1fcda9[_0x636d('0x41')]);return db[_0x636d('0x2d')][_0x636d('0x48')](_0x3f756a)[_0x636d('0x23')](handleEntityNotFound(_0x1970a8,null))['then'](respondWithResult(_0x1970a8,null))['catch'](handleError(_0x1970a8,null));};exports[_0x636d('0x49')]=function(_0x4b52b0,_0x48b8b8){return db[_0x636d('0x2d')]['create'](_0x4b52b0['body'],{})['then'](function(_0x5e0f6f){var _0xfa4fe4=_0x4b52b0[_0x636d('0x4a')][_0x636d('0x25')]({'plain':!![]});if(!_0xfa4fe4)throw new Error(_0x636d('0x4b'));if(_0xfa4fe4[_0x636d('0x4c')]===_0x636d('0x4a')){var _0x2b393e=_0x5e0f6f[_0x636d('0x25')]({'plain':!![]});var _0xe9203c=_0x636d('0x4d');return db['UserProfileSection'][_0x636d('0x48')]({'where':{'name':_0xe9203c,'userProfileId':_0xfa4fe4['userProfileId']},'raw':!![]})[_0x636d('0x23')](function(_0x5e8082){if(_0x5e8082&&_0x5e8082[_0x636d('0x4e')]===0x0){return db[_0x636d('0x26')][_0x636d('0x49')]({'name':_0x2b393e[_0x636d('0x29')],'resourceId':_0x2b393e['id'],'type':_0x5e8082[_0x636d('0x29')],'sectionId':_0x5e8082['id']},{})[_0x636d('0x23')](function(){return _0x5e0f6f;});}else{return _0x5e0f6f;}})[_0x636d('0x4f')](function(_0x5d552f){logger[_0x636d('0x27')](_0x636d('0x50'),_0x5d552f);throw _0x5d552f;});}return _0x5e0f6f;})[_0x636d('0x23')](respondWithResult(_0x48b8b8,0xc9))[_0x636d('0x4f')](handleError(_0x48b8b8,null));};exports[_0x636d('0x51')]=function(_0x412eb8,_0x351dfe){if(_0x412eb8[_0x636d('0x52')]['id']){delete _0x412eb8['body']['id'];}return db[_0x636d('0x2d')][_0x636d('0x48')]({'where':{'id':_0x412eb8[_0x636d('0x47')]['id']}})[_0x636d('0x23')](handleEntityNotFound(_0x351dfe,null))[_0x636d('0x23')](saveUpdates(_0x412eb8[_0x636d('0x52')],null))[_0x636d('0x23')](respondWithResult(_0x351dfe,null))[_0x636d('0x4f')](handleError(_0x351dfe,null));};exports['destroy']=function(_0x55e744,_0x2e6f9e){return db['Interval'][_0x636d('0x48')]({'where':{'id':_0x55e744['params']['id']}})[_0x636d('0x23')](handleEntityNotFound(_0x2e6f9e,null))[_0x636d('0x23')](removeEntity(_0x2e6f9e,null))[_0x636d('0x4f')](handleError(_0x2e6f9e,null));};exports['addInterval']=function(_0x257b23,_0x250f0e,_0x48520a){if(_0x257b23[_0x636d('0x52')]['id']){delete _0x257b23[_0x636d('0x52')]['id'];}return db[_0x636d('0x2d')]['find']({'where':{'id':_0x257b23[_0x636d('0x47')]['id']}})[_0x636d('0x23')](handleEntityNotFound(_0x250f0e,null))['then'](function(_0x538f00){if(_0x538f00){_0x257b23[_0x636d('0x52')][_0x636d('0x53')]=_0x538f00['id'];return db['Interval'][_0x636d('0x49')](_0x257b23[_0x636d('0x52')]);}})['then'](respondWithResult(_0x250f0e,null))['catch'](handleError(_0x250f0e,null));};exports['getIntervals']=function(_0x4f4cd1,_0x211cfe,_0x181a22){var _0x36b393={};var _0x214b29={};var _0x269644;var _0x337456;return db['Interval']['findOne']({'where':{'id':_0x4f4cd1['params']['id']}})[_0x636d('0x23')](handleEntityNotFound(_0x211cfe,null))['then'](function(_0x13e729){if(_0x13e729){_0x269644=_0x13e729;_0x214b29[_0x636d('0x31')]=_['keys'](db['Interval']['rawAttributes']);_0x214b29[_0x636d('0x32')]=_['keys'](_0x4f4cd1[_0x636d('0x32')]);_0x214b29['filters']=_[_0x636d('0x34')](_0x214b29[_0x636d('0x31')],_0x214b29[_0x636d('0x32')]);_0x36b393['attributes']=_[_0x636d('0x34')](_0x214b29['model'],qs[_0x636d('0x36')](_0x4f4cd1[_0x636d('0x32')]['fields']));_0x36b393['attributes']=_0x36b393[_0x636d('0x35')][_0x636d('0x37')]?_0x36b393['attributes']:_0x214b29[_0x636d('0x31')];_0x36b393[_0x636d('0x3a')]=qs['sort'](_0x4f4cd1[_0x636d('0x32')][_0x636d('0x3b')]);_0x36b393[_0x636d('0x3d')]=qs['filters'](_[_0x636d('0x54')](_0x4f4cd1[_0x636d('0x32')],_0x214b29['filters']));if(_0x4f4cd1['query'][_0x636d('0x40')]){_0x36b393[_0x636d('0x3d')]=_['merge'](_0x36b393[_0x636d('0x3d')],{'$or':_['map'](_0x36b393['attributes'],function(_0x1ee805){var _0x2585c7={};_0x2585c7[_0x1ee805]={'$like':'%'+_0x4f4cd1[_0x636d('0x32')][_0x636d('0x40')]+'%'};return _0x2585c7;})});}_0x36b393=_[_0x636d('0x3e')]({},_0x36b393,_0x4f4cd1[_0x636d('0x41')]);return _0x269644[_0x636d('0x55')](_0x36b393);}})[_0x636d('0x23')](function(_0x314960){if(_0x314960){_0x337456=_0x314960['length'];if(!_0x4f4cd1[_0x636d('0x32')][_0x636d('0x38')]('nolimit')){_0x36b393[_0x636d('0x1d')]=qs[_0x636d('0x1d')](_0x4f4cd1[_0x636d('0x32')][_0x636d('0x1d')]);_0x36b393[_0x636d('0x1b')]=qs[_0x636d('0x1b')](_0x4f4cd1[_0x636d('0x32')]['offset']);}return _0x269644['getIntervals'](_0x36b393);}})[_0x636d('0x23')](function(_0x378e8b){if(_0x378e8b){return _0x378e8b?{'count':_0x337456,'rows':_0x378e8b}:null;}})[_0x636d('0x23')](respondWithResult(_0x211cfe,null))[_0x636d('0x4f')](handleError(_0x211cfe,null));};exports[_0x636d('0x56')]=function(_0x4a4409,_0x129da1,_0x2d3a8e){return db[_0x636d('0x2d')][_0x636d('0x57')]({'where':{'id':_0x4a4409[_0x636d('0x47')]['id']}})[_0x636d('0x23')](handleEntityNotFound(_0x129da1,null))[_0x636d('0x23')](function(_0x3053fd){if(_0x3053fd){return db['sequelize'][_0x636d('0x58')](function(_0x2d5059){return db[_0x636d('0x2d')][_0x636d('0x24')]({'where':{'IntervalId':_0x4a4409[_0x636d('0x47')]['id']},'transaction':_0x2d5059})[_0x636d('0x23')](function(_0x44a98a){var _0x3b370d=_[_0x636d('0x2c')](_0x4a4409[_0x636d('0x52')],function(_0x5e8a00){delete _0x5e8a00['id'];_0x5e8a00[_0x636d('0x53')]=_0x4a4409[_0x636d('0x47')]['id'];return _0x5e8a00;});return db[_0x636d('0x2d')]['bulkCreate'](_0x3b370d,{'transaction':_0x2d5059});});})[_0x636d('0x23')](function(){return db[_0x636d('0x2d')][_0x636d('0x44')]({'where':{'IntervalId':_0x4a4409[_0x636d('0x47')]['id']}});});}})['then'](respondWithResult(_0x129da1,null))[_0x636d('0x4f')](handleError(_0x129da1,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 66230f1..cbb3b41 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 _0x0c20=['reduce','./interval.attributes','iftime','exports','define','tools_intervals','rewrite','string','getIntervals','then','all','map'];(function(_0x3f6759,_0x319d57){var _0x4ee83a=function(_0x2d00c8){while(--_0x2d00c8){_0x3f6759['push'](_0x3f6759['shift']());}};_0x4ee83a(++_0x319d57);}(_0x0c20,0x199));var _0x00c2=function(_0x1b7dd3,_0x5d05c){_0x1b7dd3=_0x1b7dd3-0x0;var _0x23828c=_0x0c20[_0x1b7dd3];return _0x23828c;};'use strict';var attributes=require(_0x00c2('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x00c2('0x1')];module[_0x00c2('0x2')]=function(_0x2a97b1){return _0x2a97b1[_0x00c2('0x3')]('Interval',attributes,{'tableName':_0x00c2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41a053){extensions['rewrite'](_0x2a97b1,_0x41a053);},'afterBulkCreate':function(_0x32b0c1,_0x147e9b,_0x191d96){_0x191d96();extensions[_0x00c2('0x5')](_0x2a97b1,_0x32b0c1[0x0]);},'afterUpdate':function(_0x238896){extensions['rewrite'](_0x2a97b1,_0x238896);},'afterDestroy':function(_0x416a9b){extensions[_0x00c2('0x5')](_0x2a97b1,_0x416a9b);}},'instanceMethods':{'ifTime':function(_0x42fa76=undefined,_0x548388=new Date()){if(typeof this['interval']===_0x00c2('0x6')){return iftime(this['interval'],_0x42fa76,_0x548388);}else{return this[_0x00c2('0x7')]()[_0x00c2('0x8')](function(_0x4f3609){return Promise[_0x00c2('0x9')](_0x4f3609[_0x00c2('0xa')](function(_0x15bfb9){return _0x15bfb9['ifTime'](_0x42fa76,_0x548388);}));})[_0x00c2('0x8')](function(_0xc2cf4){return _0xc2cf4[_0x00c2('0xb')](function(_0xe2fd14,_0x4cb583){return _0xe2fd14||_0x4cb583;},![]);});}}}});}; \ No newline at end of file +var _0x1a62=['all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','getIntervals','then'];(function(_0x422c56,_0x53ff43){var _0x44930d=function(_0x58699b){while(--_0x58699b){_0x422c56['push'](_0x422c56['shift']());}};_0x44930d(++_0x53ff43);}(_0x1a62,0x162));var _0x21a6=function(_0x4a76d8,_0x5a442f){_0x4a76d8=_0x4a76d8-0x0;var _0xcda2b6=_0x1a62[_0x4a76d8];return _0xcda2b6;};'use strict';var attributes=require(_0x21a6('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x21a6('0x1'))[_0x21a6('0x2')];module[_0x21a6('0x3')]=function(_0xde5633){return _0xde5633[_0x21a6('0x4')]('Interval',attributes,{'tableName':_0x21a6('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28b504){extensions[_0x21a6('0x6')](_0xde5633,_0x28b504);},'afterBulkCreate':function(_0x129b35,_0x5c8033,_0x17762a){_0x17762a();extensions[_0x21a6('0x6')](_0xde5633,_0x129b35[0x0]);},'afterUpdate':function(_0x31f2f7){extensions[_0x21a6('0x6')](_0xde5633,_0x31f2f7);},'afterDestroy':function(_0x25d468){extensions[_0x21a6('0x6')](_0xde5633,_0x25d468);}},'instanceMethods':{'ifTime':function(_0x21a626=undefined,_0x16630e=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x21a6('0x7')],_0x21a626,_0x16630e);}else{return this[_0x21a6('0x8')]()[_0x21a6('0x9')](function(_0x1dbb4f){return Promise[_0x21a6('0xa')](_0x1dbb4f[_0x21a6('0xb')](function(_0x43c301){return _0x43c301[_0x21a6('0xc')](_0x21a626,_0x16630e);}));})[_0x21a6('0x9')](function(_0x2a75a8){return _0x2a75a8[_0x21a6('0xd')](function(_0x5b31c5,_0x2fe9e6){return _0x5b31c5||_0x2fe9e6;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 487f4b8..118eda2 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 _0x2a93=['IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','map','model','attributes','include','then','info','debug','stringify','catch','error','message','ShowInterval','find','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById'];(function(_0x33ec02,_0x264020){var _0x2c52ad=function(_0x4f7762){while(--_0x4f7762){_0x33ec02['push'](_0x33ec02['shift']());}};_0x2c52ad(++_0x264020);}(_0x2a93,0x1ae));var _0x32a9=function(_0x438ef2,_0x352581){_0x438ef2=_0x438ef2-0x0;var _0x55998c=_0x2a93[_0x438ef2];return _0x55998c;};'use strict';var _=require('lodash');var util=require(_0x32a9('0x0'));var db=require(_0x32a9('0x1'))['db'];var iftime=require(_0x32a9('0x2'))[_0x32a9('0x3')];var logger=require(_0x32a9('0x4'))(_0x32a9('0x5'));exports[_0x32a9('0x6')]=function(_0x2e85ae){var _0x4573c5=this;return new Promise(function(_0x423fe9,_0x89d77a){return db[_0x32a9('0x7')][_0x32a9('0x8')]({'raw':_0x2e85ae[_0x32a9('0x9')]?_0x2e85ae[_0x32a9('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2e85ae[_0x32a9('0x9')]?_0x2e85ae[_0x32a9('0x9')][_0x32a9('0xa')]||null:null,'attributes':_0x2e85ae['options']?_0x2e85ae[_0x32a9('0x9')]['attributes']||null:null,'limit':_0x2e85ae['options']?_0x2e85ae[_0x32a9('0x9')]['limit']||null:null,'include':_0x2e85ae[_0x32a9('0x9')]?_0x2e85ae[_0x32a9('0x9')]['include']?_[_0x32a9('0xb')](_0x2e85ae['options']['include'],function(_0x483052){return{'model':db[_0x483052[_0x32a9('0xc')]],'as':_0x483052['as'],'attributes':_0x483052[_0x32a9('0xd')],'include':_0x483052[_0x32a9('0xe')]?_[_0x32a9('0xb')](_0x483052['include'],function(_0x4910a2){return{'model':db[_0x4910a2['model']],'as':_0x4910a2['as'],'attributes':_0x4910a2['attributes'],'include':_0x4910a2[_0x32a9('0xe')]?_['map'](_0x4910a2['include'],function(_0x2c6954){return{'model':db[_0x2c6954[_0x32a9('0xc')]],'as':_0x2c6954['as'],'attributes':_0x2c6954['attributes']};}):[]};}):[]};}):[]:[]})[_0x32a9('0xf')](function(_0x219923){logger[_0x32a9('0x10')](_0x32a9('0x6'),_0x2e85ae);logger[_0x32a9('0x11')]('GetInterval',_0x2e85ae,JSON[_0x32a9('0x12')](_0x219923));_0x423fe9(_0x219923);})[_0x32a9('0x13')](function(_0x53fef7){logger[_0x32a9('0x14')](_0x32a9('0x6'),_0x53fef7[_0x32a9('0x15')],_0x2e85ae);_0x89d77a(_0x4573c5[_0x32a9('0x14')](0x1f4,_0x53fef7[_0x32a9('0x15')]));});});};exports[_0x32a9('0x16')]=function(_0x254dcb){var _0x3b5823=this;return new Promise(function(_0x375a1e,_0x1f272c){return db['Interval'][_0x32a9('0x17')]({'raw':_0x254dcb[_0x32a9('0x9')]?_0x254dcb['options']['raw']===undefined?!![]:![]:!![],'where':_0x254dcb[_0x32a9('0x9')]?_0x254dcb[_0x32a9('0x9')][_0x32a9('0xa')]||null:null,'attributes':_0x254dcb[_0x32a9('0x9')]?_0x254dcb['options'][_0x32a9('0xd')]||null:null,'include':_0x254dcb['options']?_0x254dcb[_0x32a9('0x9')][_0x32a9('0xe')]?_[_0x32a9('0xb')](_0x254dcb[_0x32a9('0x9')]['include'],function(_0x34daee){return{'model':db[_0x34daee[_0x32a9('0xc')]],'as':_0x34daee['as'],'attributes':_0x34daee[_0x32a9('0xd')],'include':_0x34daee[_0x32a9('0xe')]?_[_0x32a9('0xb')](_0x34daee[_0x32a9('0xe')],function(_0x2be702){return{'model':db[_0x2be702[_0x32a9('0xc')]],'as':_0x2be702['as'],'attributes':_0x2be702['attributes'],'include':_0x2be702[_0x32a9('0xe')]?_['map'](_0x2be702[_0x32a9('0xe')],function(_0xca5866){return{'model':db[_0xca5866[_0x32a9('0xc')]],'as':_0xca5866['as'],'attributes':_0xca5866[_0x32a9('0xd')]};}):[]};}):[]};}):[]:[]})[_0x32a9('0xf')](function(_0x1c19ee){logger['info'](_0x32a9('0x16'),_0x254dcb);logger[_0x32a9('0x11')]('ShowInterval',_0x254dcb,JSON[_0x32a9('0x12')](_0x1c19ee));_0x375a1e(_0x1c19ee);})[_0x32a9('0x13')](function(_0x4d5d48){logger[_0x32a9('0x14')](_0x32a9('0x16'),_0x4d5d48[_0x32a9('0x15')],_0x254dcb);_0x1f272c(_0x3b5823[_0x32a9('0x14')](0x1f4,_0x4d5d48[_0x32a9('0x15')]));});});};function checkArrayOfIntervals(_0x221b11,_0x5d9812){var _0x5d064f=[];return db['Interval']['findAll']({'where':{'id':_0x221b11}})[_0x32a9('0xf')](function(_0x2a5083){_0x5d064f=_0x2a5083;return Promise[_0x32a9('0x18')](_0x5d064f[_0x32a9('0xb')](function(_0x4278a9){return _0x4278a9[_0x32a9('0x19')](_0x5d9812);}));})['then'](function(_0x524d81){var _0x38aed5=_0x524d81[_0x32a9('0x1a')](function(_0x534120,_0x50657c){return _0x534120||_0x50657c;},![]);logger[_0x32a9('0x10')](util[_0x32a9('0x1b')](_0x32a9('0x1c'),_0x5d064f[_0x32a9('0xb')](function(_0x599634){return _0x599634[_0x32a9('0x1d')];})[_0x32a9('0x1e')](',\x20'),_0x5d064f[_0x32a9('0xb')](function(_0xf64fec){return _0xf64fec['id'];})[_0x32a9('0x1e')](',\x20')));return _0x38aed5;});}function checkSingleInterval(_0x137ab5,_0x105b9a){return db[_0x32a9('0x7')][_0x32a9('0x1f')](_0x137ab5)['then'](function(_0x50a8ae){if(_0x50a8ae){logger[_0x32a9('0x10')](util[_0x32a9('0x1b')](_0x32a9('0x20'),_0x50a8ae[_0x32a9('0x1d')],_0x50a8ae['id']));return _0x50a8ae['ifTime'](_0x105b9a);}});}exports[_0x32a9('0x21')]=function(_0x3d2899){var _0x237834=_0x3d2899['intervalIds'];var _0x293563=Array[_0x32a9('0x22')](_0x3d2899[_0x32a9('0x23')])?_0x3d2899[_0x32a9('0x23')]:typeof _0x3d2899[_0x32a9('0x23')]===_0x32a9('0x24')?[_0x3d2899[_0x32a9('0x23')]]:[];var _0x501d00=_0x3d2899[_0x32a9('0x25')]||undefined;var _0x39d092=![];if(_0x293563['length']){logger[_0x32a9('0x10')](util[_0x32a9('0x1b')](_0x32a9('0x26'),_0x293563[_0x32a9('0x1e')](';\x20')));}if(_0x501d00){logger[_0x32a9('0x10')](util[_0x32a9('0x1b')](_0x32a9('0x27'),_0x501d00));}logger[_0x32a9('0x11')](_0x32a9('0x28'),_0x39d092);logger['silly'](_0x32a9('0x21'),_0x3d2899);return Promise[_0x32a9('0x29')]()[_0x32a9('0xf')](function(){if(Array[_0x32a9('0x22')](_0x237834)){return checkArrayOfIntervals(_0x237834,_0x501d00);}else if(_0x237834){return checkSingleInterval(_0x237834,_0x501d00);}})[_0x32a9('0xf')](function(_0x3e3062){var _0xb2dd11=_0x293563[_0x32a9('0x1a')](function(_0x2da185,_0x5881f2){return _0x2da185||iftime(_0x5881f2,_0x501d00);},![]);_0x39d092=_0x3e3062||_0xb2dd11;return _0x39d092;})['catch'](function(_0x500cf8){logger[_0x32a9('0x14')](_0x32a9('0x21'),_0x3d2899,_0x500cf8);throw this['error'](0x1f4,_0x500cf8['message']);});}; \ No newline at end of file +var _0x0938=['attributes','limit','include','model','map','then','GetInterval','debug','catch','error','message','ShowInterval','info','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','isArray','lodash','../../mysqldb','iftime','rpc','Interval','findAll','options','raw','where'];(function(_0xba1e71,_0x54c2af){var _0x2dd7cb=function(_0x4b960a){while(--_0x4b960a){_0xba1e71['push'](_0xba1e71['shift']());}};_0x2dd7cb(++_0x54c2af);}(_0x0938,0xba));var _0x8093=function(_0x4a4ba0,_0x463721){_0x4a4ba0=_0x4a4ba0-0x0;var _0x45de2d=_0x0938[_0x4a4ba0];return _0x45de2d;};'use strict';var _=require(_0x8093('0x0'));var util=require('util');var db=require(_0x8093('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x8093('0x2')];var logger=require('../../config/logger')(_0x8093('0x3'));exports['GetInterval']=function(_0x163281){var _0x107973=this;return new Promise(function(_0x5b2592,_0x3e752d){return db[_0x8093('0x4')][_0x8093('0x5')]({'raw':_0x163281[_0x8093('0x6')]?_0x163281[_0x8093('0x6')][_0x8093('0x7')]===undefined?!![]:![]:!![],'where':_0x163281['options']?_0x163281[_0x8093('0x6')][_0x8093('0x8')]||null:null,'attributes':_0x163281['options']?_0x163281[_0x8093('0x6')][_0x8093('0x9')]||null:null,'limit':_0x163281[_0x8093('0x6')]?_0x163281[_0x8093('0x6')][_0x8093('0xa')]||null:null,'include':_0x163281[_0x8093('0x6')]?_0x163281[_0x8093('0x6')][_0x8093('0xb')]?_['map'](_0x163281[_0x8093('0x6')][_0x8093('0xb')],function(_0x208a82){return{'model':db[_0x208a82[_0x8093('0xc')]],'as':_0x208a82['as'],'attributes':_0x208a82[_0x8093('0x9')],'include':_0x208a82[_0x8093('0xb')]?_[_0x8093('0xd')](_0x208a82[_0x8093('0xb')],function(_0x470439){return{'model':db[_0x470439[_0x8093('0xc')]],'as':_0x470439['as'],'attributes':_0x470439['attributes'],'include':_0x470439['include']?_[_0x8093('0xd')](_0x470439[_0x8093('0xb')],function(_0x19a409){return{'model':db[_0x19a409[_0x8093('0xc')]],'as':_0x19a409['as'],'attributes':_0x19a409[_0x8093('0x9')]};}):[]};}):[]};}):[]:[]})[_0x8093('0xe')](function(_0x303b9c){logger['info'](_0x8093('0xf'),_0x163281);logger[_0x8093('0x10')]('GetInterval',_0x163281,JSON['stringify'](_0x303b9c));_0x5b2592(_0x303b9c);})[_0x8093('0x11')](function(_0x437e03){logger[_0x8093('0x12')](_0x8093('0xf'),_0x437e03[_0x8093('0x13')],_0x163281);_0x3e752d(_0x107973[_0x8093('0x12')](0x1f4,_0x437e03[_0x8093('0x13')]));});});};exports[_0x8093('0x14')]=function(_0x21facd){var _0x2a4573=this;return new Promise(function(_0xe90387,_0x43fd5c){return db[_0x8093('0x4')]['find']({'raw':_0x21facd[_0x8093('0x6')]?_0x21facd['options'][_0x8093('0x7')]===undefined?!![]:![]:!![],'where':_0x21facd['options']?_0x21facd[_0x8093('0x6')][_0x8093('0x8')]||null:null,'attributes':_0x21facd['options']?_0x21facd['options'][_0x8093('0x9')]||null:null,'include':_0x21facd['options']?_0x21facd[_0x8093('0x6')][_0x8093('0xb')]?_[_0x8093('0xd')](_0x21facd['options']['include'],function(_0x4ed253){return{'model':db[_0x4ed253[_0x8093('0xc')]],'as':_0x4ed253['as'],'attributes':_0x4ed253[_0x8093('0x9')],'include':_0x4ed253[_0x8093('0xb')]?_[_0x8093('0xd')](_0x4ed253[_0x8093('0xb')],function(_0x57aa86){return{'model':db[_0x57aa86[_0x8093('0xc')]],'as':_0x57aa86['as'],'attributes':_0x57aa86['attributes'],'include':_0x57aa86[_0x8093('0xb')]?_['map'](_0x57aa86[_0x8093('0xb')],function(_0x18f868){return{'model':db[_0x18f868[_0x8093('0xc')]],'as':_0x18f868['as'],'attributes':_0x18f868['attributes']};}):[]};}):[]};}):[]:[]})[_0x8093('0xe')](function(_0x232bae){logger[_0x8093('0x15')](_0x8093('0x14'),_0x21facd);logger[_0x8093('0x10')](_0x8093('0x14'),_0x21facd,JSON['stringify'](_0x232bae));_0xe90387(_0x232bae);})[_0x8093('0x11')](function(_0x514923){logger[_0x8093('0x12')](_0x8093('0x14'),_0x514923[_0x8093('0x13')],_0x21facd);_0x43fd5c(_0x2a4573['error'](0x1f4,_0x514923[_0x8093('0x13')]));});});};function checkArrayOfIntervals(_0x308041,_0x1791d0){var _0x27a7e0=[];return db[_0x8093('0x4')][_0x8093('0x5')]({'where':{'id':_0x308041}})[_0x8093('0xe')](function(_0x1318c3){_0x27a7e0=_0x1318c3;return Promise[_0x8093('0x16')](_0x27a7e0['map'](function(_0x34e8bc){return _0x34e8bc[_0x8093('0x17')](_0x1791d0);}));})[_0x8093('0xe')](function(_0x19e235){var _0x3cf4ef=_0x19e235[_0x8093('0x18')](function(_0x58d892,_0x194c75){return _0x58d892||_0x194c75;},![]);logger[_0x8093('0x15')](util[_0x8093('0x19')](_0x8093('0x1a'),_0x27a7e0[_0x8093('0xd')](function(_0x2d6493){return _0x2d6493[_0x8093('0x1b')];})[_0x8093('0x1c')](',\x20'),_0x27a7e0['map'](function(_0x520c0b){return _0x520c0b['id'];})[_0x8093('0x1c')](',\x20')));return _0x3cf4ef;});}function checkSingleInterval(_0x56a6f5,_0x1acc48){return db[_0x8093('0x4')]['findById'](_0x56a6f5)[_0x8093('0xe')](function(_0x67150b){if(_0x67150b){logger[_0x8093('0x15')](util['format'](_0x8093('0x1d'),_0x67150b['name'],_0x67150b['id']));return _0x67150b[_0x8093('0x17')](_0x1acc48);}});}exports[_0x8093('0x1e')]=function(_0x29ede4){var _0x4bb3d4=_0x29ede4[_0x8093('0x1f')];var _0xc85952=Array['isArray'](_0x29ede4['intervals'])?_0x29ede4['intervals']:typeof _0x29ede4[_0x8093('0x20')]===_0x8093('0x21')?[_0x29ede4[_0x8093('0x20')]]:[];var _0x4929bf=_0x29ede4[_0x8093('0x22')]||undefined;var _0x2cac23=![];if(_0xc85952['length']){logger[_0x8093('0x15')](util['format'](_0x8093('0x23'),_0xc85952[_0x8093('0x1c')](';\x20')));}if(_0x4929bf){logger[_0x8093('0x15')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x4929bf));}logger[_0x8093('0x10')](_0x8093('0x24'),_0x2cac23);logger[_0x8093('0x25')](_0x8093('0x1e'),_0x29ede4);return Promise['resolve']()[_0x8093('0xe')](function(){if(Array[_0x8093('0x26')](_0x4bb3d4)){return checkArrayOfIntervals(_0x4bb3d4,_0x4929bf);}else if(_0x4bb3d4){return checkSingleInterval(_0x4bb3d4,_0x4929bf);}})[_0x8093('0xe')](function(_0x338564){var _0x27c0f4=_0xc85952['reduce'](function(_0x2feca8,_0xe061c0){return _0x2feca8||iftime(_0xe061c0,_0x4929bf);},![]);_0x2cac23=_0x338564||_0x27c0f4;return _0x2cac23;})[_0x8093('0x11')](function(_0x3ea823){logger['error'](_0x8093('0x1e'),_0x29ede4,_0x3ea823);throw this[_0x8093('0x12')](0x1f4,_0x3ea823[_0x8093('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ab6c957..8a6c5d3 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x56503a,_0x1c4b81){var _0x52e0d4=function(_0x4544d0){while(--_0x4544d0){_0x56503a['push'](_0x56503a['shift']());}};_0x52e0d4(++_0x1c4b81);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36ab3f,_0x1c730b){_0x36ab3f=_0x36ab3f-0x0;var _0x293959=_0x5f2f[_0x36ab3f];return _0x293959;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x34ce60,_0x21e826){var _0x3d62ba=function(_0x3ba352){while(--_0x3ba352){_0x34ce60['push'](_0x34ce60['shift']());}};_0x3d62ba(++_0x21e826);}(_0x2ef3,0xba));var _0x32ef=function(_0x2edd58,_0x52b0ae){_0x2edd58=_0x2edd58-0x0;var _0x550915=_0x2ef3[_0x2edd58];return _0x550915;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 69aea96..d4bf87b 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 _0xc6b3=['description','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','setEncoding','utf8','data','end','statusCode','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xc6b3,0x78));var _0x3c6b=function(_0x5e4278,_0x53ed71){_0x5e4278=_0x5e4278-0x0;var _0x2b35fe=_0xc6b3[_0x5e4278];return _0x2b35fe;};'use strict';var BPromise=require(_0x3c6b('0x0'));var https=require('https');var logger=require(_0x3c6b('0x1'))(_0x3c6b('0x2'));var USERNAME=_0x3c6b('0x3');var PASSWORD=_0x3c6b('0x4');function openIssue(_0x4d2f7b,_0xb547a1){var _0x36a1bf={'fields':{'project':{'key':_0x4d2f7b[_0x3c6b('0x5')]||'MOTGUI'},'summary':(_0x4d2f7b[_0x3c6b('0x6')]||_0x3c6b('0x7'))+_0x3c6b('0x8')+_0x4d2f7b['ip'],'description':_0x4d2f7b[_0x3c6b('0x9')]||JSON['stringify'](_0x4d2f7b),'issuetype':{'name':_0x4d2f7b[_0x3c6b('0xa')]||_0x3c6b('0xb')}}};_0x36a1bf[_0x3c6b('0xc')][_0x3c6b('0xd')]=_0x4d2f7b['email'];_0x36a1bf['fields'][_0x3c6b('0xe')]=_0x4d2f7b[_0x3c6b('0xf')];_0x36a1bf[_0x3c6b('0xc')][_0x3c6b('0x10')]=_0x4d2f7b['newToken'];_0x36a1bf[_0x3c6b('0xc')][_0x3c6b('0x11')]=_0x4d2f7b[_0x3c6b('0x12')];_0x36a1bf[_0x3c6b('0xc')][_0x3c6b('0x13')]=_0x4d2f7b[_0x3c6b('0x14')];_0x36a1bf[_0x3c6b('0xc')][_0x3c6b('0x15')]=_0x4d2f7b['ip'];var _0x3596a8={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3c6b('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x3c6b('0x17'),'Authorization':_0x3c6b('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x3c6b('0x19')]('base64')}};var _0x36690b=JSON['stringify'](_0x36a1bf);var _0x111719=https['request'](_0x3596a8,function(_0x5bedd8){_0x5bedd8[_0x3c6b('0x1a')](_0x3c6b('0x1b'));var _0x81ea3='';_0x5bedd8['on'](_0x3c6b('0x1c'),function(_0x271e1c){_0x81ea3+=_0x271e1c;});_0x5bedd8['on'](_0x3c6b('0x1d'),function(){if(_0xb547a1){return _0xb547a1['status'](_0x5bedd8[_0x3c6b('0x1e')])['json'](JSON[_0x3c6b('0x1f')](_0x81ea3));}});});_0x111719['on']('error',function(_0x463992){if(_0xb547a1){return _0xb547a1[_0x3c6b('0x20')](0x1f4)['json']({'errors':[{'message':_0x3c6b('0x21'),'type':'api.jira'}]});}});_0x111719[_0x3c6b('0x22')](_0x36690b);_0x111719[_0x3c6b('0x1d')]();}exports[_0x3c6b('0x23')]=openIssue;exports[_0x3c6b('0x24')]=function(_0x2d95b5,_0xdccbf){_0x2d95b5[_0x3c6b('0x25')]['ip']=_0x2d95b5[_0x3c6b('0x26')][_0x3c6b('0x27')]||_0x2d95b5['connection'][_0x3c6b('0x28')]||_0x2d95b5[_0x3c6b('0x29')]['remoteAddress']||_0x2d95b5[_0x3c6b('0x2a')][_0x3c6b('0x29')]['remoteAddress'];return openIssue(_0x2d95b5[_0x3c6b('0x25')],_0xdccbf);}; \ No newline at end of file +var _0x553f=['oldToken','newToken','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','utf8','end','statusCode','json','parse','error','status','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','customfield_11501'];(function(_0x4db1d7,_0xe0d557){var _0x53f2d7=function(_0x167c55){while(--_0x167c55){_0x4db1d7['push'](_0x4db1d7['shift']());}};_0x53f2d7(++_0xe0d557);}(_0x553f,0x142));var _0xf553=function(_0x1410cc,_0x3dd52b){_0x1410cc=_0x1410cc-0x0;var _0x3eec27=_0x553f[_0x1410cc];return _0x3eec27;};'use strict';var BPromise=require(_0xf553('0x0'));var https=require('https');var logger=require(_0xf553('0x1'))(_0xf553('0x2'));var USERNAME='support';var PASSWORD=_0xf553('0x3');function openIssue(_0x5e729f,_0x56b550){var _0x474c16={'fields':{'project':{'key':_0x5e729f[_0xf553('0x4')]||'MOTGUI'},'summary':(_0x5e729f[_0xf553('0x5')]||_0xf553('0x6'))+_0xf553('0x7')+_0x5e729f['ip'],'description':_0x5e729f[_0xf553('0x8')]||JSON[_0xf553('0x9')](_0x5e729f),'issuetype':{'name':_0x5e729f['issuetype']||_0xf553('0xa')}}};_0x474c16[_0xf553('0xb')][_0xf553('0xc')]=_0x5e729f['email'];_0x474c16[_0xf553('0xb')][_0xf553('0xd')]=_0x5e729f[_0xf553('0xe')];_0x474c16[_0xf553('0xb')]['customfield_11502']=_0x5e729f[_0xf553('0xf')];_0x474c16['fields']['customfield_11503']=_0x5e729f['name'];_0x474c16['fields'][_0xf553('0x10')]=_0x5e729f[_0xf553('0x11')];_0x474c16[_0xf553('0xb')][_0xf553('0x12')]=_0x5e729f['ip'];var _0x582d63={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xf553('0x13'),'method':_0xf553('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xf553('0x15'),'Authorization':_0xf553('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xf553('0x17')](_0xf553('0x18'))}};var _0xc2f30a=JSON[_0xf553('0x9')](_0x474c16);var _0x429570=https[_0xf553('0x19')](_0x582d63,function(_0x28ea8a){_0x28ea8a['setEncoding'](_0xf553('0x1a'));var _0x5555d1='';_0x28ea8a['on']('data',function(_0x42893b){_0x5555d1+=_0x42893b;});_0x28ea8a['on'](_0xf553('0x1b'),function(){if(_0x56b550){return _0x56b550['status'](_0x28ea8a[_0xf553('0x1c')])[_0xf553('0x1d')](JSON[_0xf553('0x1e')](_0x5555d1));}});});_0x429570['on'](_0xf553('0x1f'),function(_0x169873){if(_0x56b550){return _0x56b550[_0xf553('0x20')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xf553('0x21')}]});}});_0x429570[_0xf553('0x22')](_0xc2f30a);_0x429570[_0xf553('0x1b')]();}exports[_0xf553('0x23')]=openIssue;exports[_0xf553('0x24')]=function(_0x7ed0bf,_0x51bc38){_0x7ed0bf['body']['ip']=_0x7ed0bf[_0xf553('0x25')][_0xf553('0x26')]||_0x7ed0bf[_0xf553('0x27')]['remoteAddress']||_0x7ed0bf['socket'][_0xf553('0x28')]||_0x7ed0bf[_0xf553('0x27')][_0xf553('0x29')][_0xf553('0x28')];return openIssue(_0x7ed0bf['body'],_0x51bc38);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 499a98e..7ffae77 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 _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e82ae,_0x1bf62f){var _0x2e3d18=function(_0x42dc5b){while(--_0x42dc5b){_0x5e82ae['push'](_0x5e82ae['shift']());}};_0x2e3d18(++_0x1bf62f);}(_0x878f,0x173));var _0xf878=function(_0x5f99d4,_0x1ad200){_0x5f99d4=_0x5f99d4-0x0;var _0x152c10=_0x878f[_0x5f99d4];return _0x152c10;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x12a4e0,_0x2f2d61){var _0x3ef737=function(_0x578e6a){while(--_0x578e6a){_0x12a4e0['push'](_0x12a4e0['shift']());}};_0x3ef737(++_0x2f2d61);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1f4872,_0x212bac){_0x1f4872=_0x1f4872-0x0;var _0x17b43d=_0xa8a8[_0x1f4872];return _0x17b43d;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 18cde1b..a68f881 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x358b74,_0x5e568a){_0x358b74=_0x358b74-0x0;var _0x3f76a7=_0x7a54[_0x358b74];return _0x3f76a7;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x5b15d1,_0x1d55ae){_0x5b15d1=_0x5b15d1-0x0;var _0x106d87=_0x7a54[_0x5b15d1];return _0x106d87;};'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 15dbdb5..1e46be9 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 _0xf5a7=['body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../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','apply','reject','update','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','type','VIRTUAL','merge','where','then','findAll','rows','catch','show','params','rawAttributes','intersection','include','options','create'];(function(_0x3e8c15,_0x506214){var _0x55129d=function(_0x5d7f14){while(--_0x5d7f14){_0x3e8c15['push'](_0x3e8c15['shift']());}};_0x55129d(++_0x506214);}(_0xf5a7,0x133));var _0x7f5a=function(_0x307893,_0x2df065){_0x307893=_0x307893-0x0;var _0x54d148=_0xf5a7[_0x307893];return _0x54d148;};'use strict';var emlformat=require(_0x7f5a('0x0'));var rimraf=require(_0x7f5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f5a('0x2'));var rp=require(_0x7f5a('0x3'));var moment=require(_0x7f5a('0x4'));var BPromise=require(_0x7f5a('0x5'));var Mustache=require(_0x7f5a('0x6'));var util=require(_0x7f5a('0x7'));var path=require(_0x7f5a('0x8'));var sox=require(_0x7f5a('0x9'));var csv=require(_0x7f5a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f5a('0xb'));var _=require(_0x7f5a('0xc'));var squel=require('squel');var crypto=require(_0x7f5a('0xd'));var jsforce=require(_0x7f5a('0xe'));var deskjs=require(_0x7f5a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f5a('0x10'));var Redis=require(_0x7f5a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f5a('0x12'));var hardwareService=require(_0x7f5a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f5a('0x14'));var config=require(_0x7f5a('0x15'));var licenseUtil=require(_0x7f5a('0x16'));var db=require(_0x7f5a('0x17'))['db'];function respondWithStatusCode(_0x169701,_0x325fda){_0x325fda=_0x325fda||0xcc;return function(_0x55ca4b){if(_0x55ca4b){return _0x169701[_0x7f5a('0x18')](_0x325fda);}return _0x169701[_0x7f5a('0x19')](_0x325fda)[_0x7f5a('0x1a')]();};}function respondWithResult(_0x112311,_0x1f1c17){_0x1f1c17=_0x1f1c17||0xc8;return function(_0x2a25ab){if(_0x2a25ab){return _0x112311[_0x7f5a('0x19')](_0x1f1c17)[_0x7f5a('0x1b')](_0x2a25ab);}};}function respondWithFilteredResult(_0x4ce5c2,_0x2ed7d3){return function(_0x3c6d7c){if(_0x3c6d7c){var _0x5c6810=typeof _0x2ed7d3[_0x7f5a('0x1c')]===_0x7f5a('0x1d')&&typeof _0x2ed7d3[_0x7f5a('0x1e')]===_0x7f5a('0x1d');var _0x568857=_0x3c6d7c[_0x7f5a('0x1f')];var _0xce9655=_0x5c6810?0x0:_0x2ed7d3[_0x7f5a('0x1c')];var _0x3e168e=_0x5c6810?_0x3c6d7c['count']:_0x2ed7d3[_0x7f5a('0x1c')]+_0x2ed7d3[_0x7f5a('0x1e')];var _0x557b16;if(_0x3e168e>=_0x568857){_0x3e168e=_0x568857;_0x557b16=0xc8;}else{_0x557b16=0xce;}_0x4ce5c2['status'](_0x557b16);return _0x4ce5c2[_0x7f5a('0x20')](_0x7f5a('0x21'),_0xce9655+'-'+_0x3e168e+'/'+_0x568857)[_0x7f5a('0x1b')](_0x3c6d7c);}return null;};}function patchUpdates(_0x90c080){return function(_0x208a6e){try{jsonpatch[_0x7f5a('0x22')](_0x208a6e,_0x90c080,!![]);}catch(_0x2942f9){return BPromise[_0x7f5a('0x23')](_0x2942f9);}return _0x208a6e['save']();};}function saveUpdates(_0x4b8d6b,_0x3d5f19){return function(_0x57019e){if(_0x57019e){return _0x57019e[_0x7f5a('0x24')](_0x4b8d6b)['then'](function(_0x3fda96){return _0x3fda96;});}return null;};}function removeEntity(_0x1c43bb,_0xf52b51){return function(_0xb65c0){if(_0xb65c0){return _0xb65c0[_0x7f5a('0x25')]()['then'](function(){_0x1c43bb[_0x7f5a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280a55,_0x31f206){return function(_0x49902a){if(!_0x49902a){_0x280a55[_0x7f5a('0x18')](0x194);}return _0x49902a;};}function handleError(_0x5d53cc,_0x35c43b){_0x35c43b=_0x35c43b||0x1f4;return function(_0x2bfbfe){logger[_0x7f5a('0x26')](_0x2bfbfe[_0x7f5a('0x27')]);if(_0x2bfbfe['name']){delete _0x2bfbfe[_0x7f5a('0x28')];}_0x5d53cc[_0x7f5a('0x19')](_0x35c43b)[_0x7f5a('0x29')](_0x2bfbfe);};}exports[_0x7f5a('0x2a')]=function(_0x49327f,_0x4ee1ca){var _0x550e81={},_0x30c290={},_0x2f8113={'count':0x0,'rows':[]};var _0x332baa=_['map'](db[_0x7f5a('0x2b')]['rawAttributes'],function(_0x347d5c){return{'name':_0x347d5c[_0x7f5a('0x2c')],'type':_0x347d5c['type'][_0x7f5a('0x2d')]};});_0x30c290[_0x7f5a('0x2e')]=_[_0x7f5a('0x2f')](_0x332baa,_0x7f5a('0x28'));_0x30c290[_0x7f5a('0x30')]=_[_0x7f5a('0x31')](_0x49327f[_0x7f5a('0x30')]);_0x30c290[_0x7f5a('0x32')]=_['intersection'](_0x30c290[_0x7f5a('0x2e')],_0x30c290['query']);_0x550e81['attributes']=_['intersection'](_0x30c290[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x49327f[_0x7f5a('0x30')][_0x7f5a('0x33')]));_0x550e81[_0x7f5a('0x34')]=_0x550e81['attributes'][_0x7f5a('0x35')]?_0x550e81['attributes']:_0x30c290[_0x7f5a('0x2e')];if(!_0x49327f['query'][_0x7f5a('0x36')](_0x7f5a('0x37'))){_0x550e81[_0x7f5a('0x1e')]=qs['limit'](_0x49327f['query'][_0x7f5a('0x1e')]);_0x550e81[_0x7f5a('0x1c')]=qs[_0x7f5a('0x1c')](_0x49327f['query'][_0x7f5a('0x1c')]);}_0x550e81['order']=qs['sort'](_0x49327f[_0x7f5a('0x30')][_0x7f5a('0x38')]);_0x550e81['where']=qs[_0x7f5a('0x32')](_[_0x7f5a('0x39')](_0x49327f[_0x7f5a('0x30')],_0x30c290[_0x7f5a('0x32')]),_0x332baa);if(_0x49327f[_0x7f5a('0x30')]['filter']){_0x550e81['where']=_['merge'](_0x550e81['where'],{'$or':_[_0x7f5a('0x2f')](_0x332baa,function(_0x5f194b){if(_0x5f194b[_0x7f5a('0x3a')]!==_0x7f5a('0x3b')){var _0x3e06c6={};_0x3e06c6[_0x5f194b[_0x7f5a('0x28')]]={'$like':'%'+_0x49327f[_0x7f5a('0x30')]['filter']+'%'};return _0x3e06c6;}})});}_0x550e81=_[_0x7f5a('0x3c')]({},_0x550e81,_0x49327f['options']);var _0x367be8={'where':_0x550e81[_0x7f5a('0x3d')]};return db[_0x7f5a('0x2b')]['count'](_0x367be8)[_0x7f5a('0x3e')](function(_0x5219e8){_0x2f8113[_0x7f5a('0x1f')]=_0x5219e8;if(_0x49327f[_0x7f5a('0x30')]['includeAll']){_0x550e81['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7f5a('0x3f')](_0x550e81);})['then'](function(_0x4d65c0){_0x2f8113[_0x7f5a('0x40')]=_0x4d65c0;return _0x2f8113;})[_0x7f5a('0x3e')](respondWithFilteredResult(_0x4ee1ca,_0x550e81))[_0x7f5a('0x41')](handleError(_0x4ee1ca,null));};exports[_0x7f5a('0x42')]=function(_0x1fa1cc,_0x185db9){var _0x121fdf={'raw':!![],'where':{'id':_0x1fa1cc[_0x7f5a('0x43')]['id']}},_0x29b022={};_0x29b022[_0x7f5a('0x2e')]=_[_0x7f5a('0x31')](db['JscriptyAnswerReport'][_0x7f5a('0x44')]);_0x29b022['query']=_[_0x7f5a('0x31')](_0x1fa1cc[_0x7f5a('0x30')]);_0x29b022[_0x7f5a('0x32')]=_['intersection'](_0x29b022[_0x7f5a('0x2e')],_0x29b022[_0x7f5a('0x30')]);_0x121fdf[_0x7f5a('0x34')]=_[_0x7f5a('0x45')](_0x29b022[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x1fa1cc[_0x7f5a('0x30')]['fields']));_0x121fdf[_0x7f5a('0x34')]=_0x121fdf[_0x7f5a('0x34')][_0x7f5a('0x35')]?_0x121fdf[_0x7f5a('0x34')]:_0x29b022[_0x7f5a('0x2e')];if(_0x1fa1cc[_0x7f5a('0x30')]['includeAll']){_0x121fdf[_0x7f5a('0x46')]=[{'all':!![]}];}_0x121fdf=_[_0x7f5a('0x3c')]({},_0x121fdf,_0x1fa1cc[_0x7f5a('0x47')]);return db[_0x7f5a('0x2b')]['find'](_0x121fdf)[_0x7f5a('0x3e')](handleEntityNotFound(_0x185db9,null))[_0x7f5a('0x3e')](respondWithResult(_0x185db9,null))[_0x7f5a('0x41')](handleError(_0x185db9,null));};exports[_0x7f5a('0x48')]=function(_0x10457b,_0x21c7f6){return db[_0x7f5a('0x2b')][_0x7f5a('0x48')](_0x10457b[_0x7f5a('0x49')],{})[_0x7f5a('0x3e')](respondWithResult(_0x21c7f6,0xc9))[_0x7f5a('0x41')](handleError(_0x21c7f6,null));};exports[_0x7f5a('0x24')]=function(_0xaabf0f,_0x163b97){if(_0xaabf0f['body']['id']){delete _0xaabf0f[_0x7f5a('0x49')]['id'];}return db['JscriptyAnswerReport'][_0x7f5a('0x4a')]({'where':{'id':_0xaabf0f[_0x7f5a('0x43')]['id']}})[_0x7f5a('0x3e')](handleEntityNotFound(_0x163b97,null))['then'](saveUpdates(_0xaabf0f['body'],null))[_0x7f5a('0x3e')](respondWithResult(_0x163b97,null))[_0x7f5a('0x41')](handleError(_0x163b97,null));};exports[_0x7f5a('0x25')]=function(_0x3ad069,_0x5731d0){return db[_0x7f5a('0x2b')][_0x7f5a('0x4a')]({'where':{'id':_0x3ad069['params']['id']}})['then'](handleEntityNotFound(_0x5731d0,null))[_0x7f5a('0x3e')](removeEntity(_0x5731d0,null))[_0x7f5a('0x41')](handleError(_0x5731d0,null));};exports[_0x7f5a('0x4b')]=function(_0x225019,_0x361c56){return db['JscriptyAnswerReport'][_0x7f5a('0x4b')]()[_0x7f5a('0x3e')](respondWithResult(_0x361c56,null))['catch'](handleError(_0x361c56,null));}; \ No newline at end of file +var _0x4e83=['fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x4e83,0x1ae));var _0x34e8=function(_0x22d8a6,_0x4383d6){_0x22d8a6=_0x22d8a6-0x0;var _0x1364e0=_0x4e83[_0x22d8a6];return _0x1364e0;};'use strict';var emlformat=require(_0x34e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34e8('0x1'));var jsonpatch=require(_0x34e8('0x2'));var rp=require(_0x34e8('0x3'));var moment=require(_0x34e8('0x4'));var BPromise=require(_0x34e8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x34e8('0x6'));var ejs=require(_0x34e8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34e8('0x8'));var squel=require(_0x34e8('0x9'));var crypto=require(_0x34e8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x34e8('0xb'));var toCsv=require(_0x34e8('0x6'));var querystring=require(_0x34e8('0xc'));var Papa=require('papaparse');var Redis=require(_0x34e8('0xd'));var authService=require(_0x34e8('0xe'));var qs=require(_0x34e8('0xf'));var as=require(_0x34e8('0x10'));var hardwareService=require(_0x34e8('0x11'));var logger=require(_0x34e8('0x12'))(_0x34e8('0x13'));var utils=require(_0x34e8('0x14'));var config=require(_0x34e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x34e8('0x16'))['db'];function respondWithStatusCode(_0x60b6b6,_0x516f49){_0x516f49=_0x516f49||0xcc;return function(_0x6454fd){if(_0x6454fd){return _0x60b6b6[_0x34e8('0x17')](_0x516f49);}return _0x60b6b6[_0x34e8('0x18')](_0x516f49)[_0x34e8('0x19')]();};}function respondWithResult(_0xc4ac78,_0x70f65a){_0x70f65a=_0x70f65a||0xc8;return function(_0x21f234){if(_0x21f234){return _0xc4ac78[_0x34e8('0x18')](_0x70f65a)[_0x34e8('0x1a')](_0x21f234);}};}function respondWithFilteredResult(_0x4c516a,_0xeb505){return function(_0x4447d3){if(_0x4447d3){var _0x36adfb=typeof _0xeb505[_0x34e8('0x1b')]===_0x34e8('0x1c')&&typeof _0xeb505['limit']===_0x34e8('0x1c');var _0x37b6ae=_0x4447d3[_0x34e8('0x1d')];var _0x708dd4=_0x36adfb?0x0:_0xeb505[_0x34e8('0x1b')];var _0x11543c=_0x36adfb?_0x4447d3[_0x34e8('0x1d')]:_0xeb505[_0x34e8('0x1b')]+_0xeb505[_0x34e8('0x1e')];var _0x19b9a4;if(_0x11543c>=_0x37b6ae){_0x11543c=_0x37b6ae;_0x19b9a4=0xc8;}else{_0x19b9a4=0xce;}_0x4c516a[_0x34e8('0x18')](_0x19b9a4);return _0x4c516a['set'](_0x34e8('0x1f'),_0x708dd4+'-'+_0x11543c+'/'+_0x37b6ae)[_0x34e8('0x1a')](_0x4447d3);}return null;};}function patchUpdates(_0xe42e15){return function(_0x8ecd4c){try{jsonpatch[_0x34e8('0x20')](_0x8ecd4c,_0xe42e15,!![]);}catch(_0x188055){return BPromise[_0x34e8('0x21')](_0x188055);}return _0x8ecd4c[_0x34e8('0x22')]();};}function saveUpdates(_0x4967f4,_0xc9fb93){return function(_0x20c7d3){if(_0x20c7d3){return _0x20c7d3['update'](_0x4967f4)[_0x34e8('0x23')](function(_0x592c0e){return _0x592c0e;});}return null;};}function removeEntity(_0x300b94,_0x381d0e){return function(_0x43c689){if(_0x43c689){return _0x43c689['destroy']()['then'](function(){_0x300b94[_0x34e8('0x18')](0xcc)[_0x34e8('0x19')]();});}};}function handleEntityNotFound(_0xb8c9f,_0x2dad57){return function(_0x2e29fb){if(!_0x2e29fb){_0xb8c9f[_0x34e8('0x17')](0x194);}return _0x2e29fb;};}function handleError(_0x31d68a,_0x5c93e5){_0x5c93e5=_0x5c93e5||0x1f4;return function(_0x29be75){logger[_0x34e8('0x24')](_0x29be75[_0x34e8('0x25')]);if(_0x29be75[_0x34e8('0x26')]){delete _0x29be75[_0x34e8('0x26')];}_0x31d68a[_0x34e8('0x18')](_0x5c93e5)[_0x34e8('0x27')](_0x29be75);};}exports[_0x34e8('0x28')]=function(_0x2b445a,_0x18490b){var _0x3f5421={},_0x6f4428={},_0x1df399={'count':0x0,'rows':[]};var _0x1e0d5e=_[_0x34e8('0x29')](db[_0x34e8('0x2a')][_0x34e8('0x2b')],function(_0x5c20db){return{'name':_0x5c20db[_0x34e8('0x2c')],'type':_0x5c20db[_0x34e8('0x2d')]['key']};});_0x6f4428[_0x34e8('0x2e')]=_[_0x34e8('0x29')](_0x1e0d5e,_0x34e8('0x26'));_0x6f4428[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x2b445a[_0x34e8('0x2f')]);_0x6f4428[_0x34e8('0x31')]=_[_0x34e8('0x32')](_0x6f4428[_0x34e8('0x2e')],_0x6f4428[_0x34e8('0x2f')]);_0x3f5421[_0x34e8('0x33')]=_[_0x34e8('0x32')](_0x6f4428[_0x34e8('0x2e')],qs[_0x34e8('0x34')](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x34')]));_0x3f5421[_0x34e8('0x33')]=_0x3f5421['attributes'][_0x34e8('0x35')]?_0x3f5421[_0x34e8('0x33')]:_0x6f4428['model'];if(!_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x36')](_0x34e8('0x37'))){_0x3f5421[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x1e')]);_0x3f5421['offset']=qs['offset'](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x1b')]);}_0x3f5421[_0x34e8('0x38')]=qs['sort'](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x39')]);_0x3f5421[_0x34e8('0x3a')]=qs[_0x34e8('0x31')](_[_0x34e8('0x3b')](_0x2b445a[_0x34e8('0x2f')],_0x6f4428[_0x34e8('0x31')]),_0x1e0d5e);if(_0x2b445a[_0x34e8('0x2f')]['filter']){_0x3f5421[_0x34e8('0x3a')]=_[_0x34e8('0x3c')](_0x3f5421[_0x34e8('0x3a')],{'$or':_['map'](_0x1e0d5e,function(_0x1caf4b){if(_0x1caf4b[_0x34e8('0x2d')]!=='VIRTUAL'){var _0x5d7ff7={};_0x5d7ff7[_0x1caf4b[_0x34e8('0x26')]]={'$like':'%'+_0x2b445a[_0x34e8('0x2f')]['filter']+'%'};return _0x5d7ff7;}})});}_0x3f5421=_[_0x34e8('0x3c')]({},_0x3f5421,_0x2b445a[_0x34e8('0x3d')]);var _0x29fb22={'where':_0x3f5421[_0x34e8('0x3a')]};return db[_0x34e8('0x2a')][_0x34e8('0x1d')](_0x29fb22)[_0x34e8('0x23')](function(_0x1221e2){_0x1df399[_0x34e8('0x1d')]=_0x1221e2;if(_0x2b445a['query']['includeAll']){_0x3f5421[_0x34e8('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x34e8('0x3f')](_0x3f5421);})[_0x34e8('0x23')](function(_0x29d2fb){_0x1df399[_0x34e8('0x40')]=_0x29d2fb;return _0x1df399;})['then'](respondWithFilteredResult(_0x18490b,_0x3f5421))[_0x34e8('0x41')](handleError(_0x18490b,null));};exports[_0x34e8('0x42')]=function(_0x18a158,_0x91a70f){var _0xb00838={'raw':!![],'where':{'id':_0x18a158[_0x34e8('0x43')]['id']}},_0x58b74f={};_0x58b74f['model']=_[_0x34e8('0x30')](db[_0x34e8('0x2a')]['rawAttributes']);_0x58b74f[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x18a158[_0x34e8('0x2f')]);_0x58b74f[_0x34e8('0x31')]=_['intersection'](_0x58b74f[_0x34e8('0x2e')],_0x58b74f[_0x34e8('0x2f')]);_0xb00838['attributes']=_['intersection'](_0x58b74f[_0x34e8('0x2e')],qs['fields'](_0x18a158[_0x34e8('0x2f')]['fields']));_0xb00838[_0x34e8('0x33')]=_0xb00838[_0x34e8('0x33')]['length']?_0xb00838[_0x34e8('0x33')]:_0x58b74f['model'];if(_0x18a158[_0x34e8('0x2f')]['includeAll']){_0xb00838[_0x34e8('0x3e')]=[{'all':!![]}];}_0xb00838=_[_0x34e8('0x3c')]({},_0xb00838,_0x18a158[_0x34e8('0x3d')]);return db[_0x34e8('0x2a')][_0x34e8('0x44')](_0xb00838)['then'](handleEntityNotFound(_0x91a70f,null))['then'](respondWithResult(_0x91a70f,null))[_0x34e8('0x41')](handleError(_0x91a70f,null));};exports[_0x34e8('0x45')]=function(_0x49a755,_0x1cc23c){return db[_0x34e8('0x2a')][_0x34e8('0x45')](_0x49a755['body'],{})[_0x34e8('0x23')](respondWithResult(_0x1cc23c,0xc9))[_0x34e8('0x41')](handleError(_0x1cc23c,null));};exports['update']=function(_0x51a814,_0x2de2e9){if(_0x51a814['body']['id']){delete _0x51a814[_0x34e8('0x46')]['id'];}return db[_0x34e8('0x2a')][_0x34e8('0x44')]({'where':{'id':_0x51a814[_0x34e8('0x43')]['id']}})[_0x34e8('0x23')](handleEntityNotFound(_0x2de2e9,null))[_0x34e8('0x23')](saveUpdates(_0x51a814[_0x34e8('0x46')],null))[_0x34e8('0x23')](respondWithResult(_0x2de2e9,null))[_0x34e8('0x41')](handleError(_0x2de2e9,null));};exports['destroy']=function(_0x5a1a1e,_0x345e83){return db[_0x34e8('0x2a')][_0x34e8('0x44')]({'where':{'id':_0x5a1a1e[_0x34e8('0x43')]['id']}})[_0x34e8('0x23')](handleEntityNotFound(_0x345e83,null))[_0x34e8('0x23')](removeEntity(_0x345e83,null))[_0x34e8('0x41')](handleError(_0x345e83,null));};exports[_0x34e8('0x47')]=function(_0x2b70a7,_0x4bf30e){return db['JscriptyAnswerReport'][_0x34e8('0x47')]()[_0x34e8('0x23')](respondWithResult(_0x4bf30e,null))[_0x34e8('0x41')](handleError(_0x4bf30e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a8443d1..e3bf6fd 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 _0x84ac=['moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api'];(function(_0xd9b348,_0x3e5301){var _0x1cf3f4=function(_0x311fba){while(--_0x311fba){_0xd9b348['push'](_0xd9b348['shift']());}};_0x1cf3f4(++_0x3e5301);}(_0x84ac,0x14c));var _0xc84a=function(_0x3f2855,_0x220576){_0x3f2855=_0x3f2855-0x0;var _0x20c16f=_0x84ac[_0x3f2855];return _0x20c16f;};'use strict';var _=require(_0xc84a('0x0'));var util=require(_0xc84a('0x1'));var logger=require(_0xc84a('0x2'))(_0xc84a('0x3'));var moment=require(_0xc84a('0x4'));var BPromise=require(_0xc84a('0x5'));var rp=require(_0xc84a('0x6'));var fs=require('fs');var path=require(_0xc84a('0x7'));var rimraf=require('rimraf');var config=require(_0xc84a('0x8'));var attributes=require(_0xc84a('0x9'));module[_0xc84a('0xa')]=function(_0x19adaa,_0x3193fc){return _0x19adaa[_0xc84a('0xb')](_0xc84a('0xc'),attributes,{'tableName':_0xc84a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6822=['api','bluebird','request-promise','path','rimraf','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x6822,0x111));var _0x2682=function(_0x205f56,_0x81e6eb){_0x205f56=_0x205f56-0x0;var _0x91d883=_0x6822[_0x205f56];return _0x91d883;};'use strict';var _=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var logger=require(_0x2682('0x2'))(_0x2682('0x3'));var moment=require('moment');var BPromise=require(_0x2682('0x4'));var rp=require(_0x2682('0x5'));var fs=require('fs');var path=require(_0x2682('0x6'));var rimraf=require(_0x2682('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x2682('0x8')]=function(_0x15eb22,_0x3f0f3d){return _0x15eb22[_0x2682('0x9')](_0x2682('0xa'),attributes,{'tableName':_0x2682('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index e00c2ac..fe6b5a9 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 _0x7e38=['../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x850eab,_0xd0b159){var _0x6b21=function(_0xe44156){while(--_0xe44156){_0x850eab['push'](_0x850eab['shift']());}};_0x6b21(++_0xd0b159);}(_0x7e38,0x14f));var _0x87e3=function(_0x54a66e,_0x3d4920){_0x54a66e=_0x54a66e-0x0;var _0xc130ea=_0x7e38[_0x54a66e];return _0xc130ea;};'use strict';var _=require(_0x87e3('0x0'));var util=require(_0x87e3('0x1'));var moment=require(_0x87e3('0x2'));var BPromise=require(_0x87e3('0x3'));var rs=require(_0x87e3('0x4'));var fs=require('fs');var Redis=require(_0x87e3('0x5'));var db=require(_0x87e3('0x6'))['db'];var utils=require(_0x87e3('0x7'));var logger=require(_0x87e3('0x8'))(_0x87e3('0x9'));var config=require(_0x87e3('0xa'));var jayson=require(_0x87e3('0xb'));var client=jayson[_0x87e3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7c0d,_0xddf88e,_0x4bae26){return new BPromise(function(_0x34743c,_0x18a026){return client[_0x87e3('0xd')](_0x2d7c0d,_0x4bae26)['then'](function(_0x14dcd3){logger[_0x87e3('0xe')](_0x87e3('0xf'),_0xddf88e,_0x87e3('0x10'));logger['debug'](_0x87e3('0x11'),_0xddf88e,'request\x20sent',JSON[_0x87e3('0x12')](_0x14dcd3));if(_0x14dcd3[_0x87e3('0x13')]){if(_0x14dcd3[_0x87e3('0x13')][_0x87e3('0x14')]===0x1f4){logger[_0x87e3('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xddf88e,_0x14dcd3['error'][_0x87e3('0x15')]);return _0x18a026(_0x14dcd3[_0x87e3('0x13')][_0x87e3('0x15')]);}logger[_0x87e3('0x13')](_0x87e3('0xf'),_0xddf88e,_0x14dcd3['error'][_0x87e3('0x15')]);return _0x34743c(_0x14dcd3[_0x87e3('0x13')]['message']);}else{logger[_0x87e3('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xddf88e,_0x87e3('0x10'));_0x34743c(_0x14dcd3[_0x87e3('0x16')][_0x87e3('0x15')]);}})['catch'](function(_0x1de6a3){logger['error'](_0x87e3('0xf'),_0xddf88e,_0x1de6a3);_0x18a026(_0x1de6a3);});});} \ No newline at end of file +var _0x4b7f=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info'];(function(_0x44ea8a,_0x1b559c){var _0x5ade26=function(_0x4ba5ff){while(--_0x4ba5ff){_0x44ea8a['push'](_0x44ea8a['shift']());}};_0x5ade26(++_0x1b559c);}(_0x4b7f,0x15c));var _0xf4b7=function(_0x2008ad,_0x5a054c){_0x2008ad=_0x2008ad-0x0;var _0x1519e3=_0x4b7f[_0x2008ad];return _0x1519e3;};'use strict';var _=require(_0xf4b7('0x0'));var util=require(_0xf4b7('0x1'));var moment=require('moment');var BPromise=require(_0xf4b7('0x2'));var rs=require(_0xf4b7('0x3'));var fs=require('fs');var Redis=require(_0xf4b7('0x4'));var db=require(_0xf4b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4b7('0x6'))('rpc');var config=require(_0xf4b7('0x7'));var jayson=require(_0xf4b7('0x8'));var client=jayson['client'][_0xf4b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20f792,_0x9e1659,_0x14257a){return new BPromise(function(_0x51297d,_0x5f2d63){return client[_0xf4b7('0xa')](_0x20f792,_0x14257a)['then'](function(_0x4be1e7){logger[_0xf4b7('0xb')](_0xf4b7('0xc'),_0x9e1659,_0xf4b7('0xd'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x9e1659,_0xf4b7('0xd'),JSON['stringify'](_0x4be1e7));if(_0x4be1e7[_0xf4b7('0xe')]){if(_0x4be1e7[_0xf4b7('0xe')][_0xf4b7('0xf')]===0x1f4){logger['error'](_0xf4b7('0xc'),_0x9e1659,_0x4be1e7[_0xf4b7('0xe')]['message']);return _0x5f2d63(_0x4be1e7[_0xf4b7('0xe')][_0xf4b7('0x10')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x9e1659,_0x4be1e7[_0xf4b7('0xe')][_0xf4b7('0x10')]);return _0x51297d(_0x4be1e7[_0xf4b7('0xe')][_0xf4b7('0x10')]);}else{logger[_0xf4b7('0xb')](_0xf4b7('0xc'),_0x9e1659,_0xf4b7('0xd'));_0x51297d(_0x4be1e7['result'][_0xf4b7('0x10')]);}})[_0xf4b7('0x11')](function(_0x2956de){logger['error'](_0xf4b7('0xc'),_0x9e1659,_0x2956de);_0x5f2d63(_0x2956de);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 10ebdf6..6680c93 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 _0x6318=['../../components/interaction/service','./jscriptyProject.controller','get','index','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1cba5c,_0x245bf8){var _0x4b6ac4=function(_0x5aab8c){while(--_0x5aab8c){_0x1cba5c['push'](_0x1cba5c['shift']());}};_0x4b6ac4(++_0x245bf8);}(_0x6318,0xd9));var _0x8631=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x6318[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x8631('0x0'));var util=require(_0x8631('0x1'));var path=require(_0x8631('0x2'));var timeout=require(_0x8631('0x3'));var express=require(_0x8631('0x4'));var router=express[_0x8631('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8631('0x6'));var interaction=require(_0x8631('0x7'));var config=require('../../config/environment');var controller=require(_0x8631('0x8'));router[_0x8631('0x9')]('/',auth['isAuthenticated'](),controller[_0x8631('0xa')]);router[_0x8631('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8631('0xb')]);router['get'](_0x8631('0xc'),auth[_0x8631('0xd')](),controller[_0x8631('0xe')]);router[_0x8631('0x9')](_0x8631('0xf'),auth[_0x8631('0xd')](),controller['getAnswers']);router[_0x8631('0x9')](_0x8631('0x10'),auth['isAuthenticated'](),timeout(_0x8631('0x11')),controller[_0x8631('0x12')]);router['post']('/',auth[_0x8631('0xd')](),controller['create']);router[_0x8631('0x13')](_0x8631('0x14'),auth[_0x8631('0xd')](),controller[_0x8631('0x15')]);router[_0x8631('0x16')](_0x8631('0x17'),auth[_0x8631('0xd')](),controller[_0x8631('0x18')]);router[_0x8631('0x19')]('/:id',auth[_0x8631('0xd')](),controller[_0x8631('0x1a')]);module[_0x8631('0x1b')]=router; \ No newline at end of file +var _0x1148=['/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x195dd3,_0x5560b7){var _0xf86451=function(_0xbbe385){while(--_0xbbe385){_0x195dd3['push'](_0x195dd3['shift']());}};_0xf86451(++_0x5560b7);}(_0x1148,0xaf));var _0x8114=function(_0x438712,_0x22564b){_0x438712=_0x438712-0x0;var _0x175a91=_0x1148[_0x438712];return _0x175a91;};'use strict';var multer=require(_0x8114('0x0'));var util=require(_0x8114('0x1'));var path=require(_0x8114('0x2'));var timeout=require(_0x8114('0x3'));var express=require(_0x8114('0x4'));var router=express[_0x8114('0x5')]();var fs_extra=require(_0x8114('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8114('0x7'));var config=require(_0x8114('0x8'));var controller=require('./jscriptyProject.controller');router[_0x8114('0x9')]('/',auth[_0x8114('0xa')](),controller[_0x8114('0xb')]);router[_0x8114('0x9')](_0x8114('0xc'),auth[_0x8114('0xa')](),controller[_0x8114('0xd')]);router[_0x8114('0x9')](_0x8114('0xe'),auth[_0x8114('0xa')](),controller[_0x8114('0xf')]);router[_0x8114('0x9')](_0x8114('0x10'),auth['isAuthenticated'](),controller[_0x8114('0x11')]);router['get'](_0x8114('0x12'),auth[_0x8114('0xa')](),timeout(_0x8114('0x13')),controller['getSummary']);router[_0x8114('0x14')]('/',auth[_0x8114('0xa')](),controller[_0x8114('0x15')]);router['post']('/:id/clone',auth[_0x8114('0xa')](),controller[_0x8114('0x16')]);router[_0x8114('0x17')]('/:id',auth[_0x8114('0xa')](),controller[_0x8114('0x18')]);router['delete'](_0x8114('0xc'),auth['isAuthenticated'](),controller[_0x8114('0x19')]);module[_0x8114('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 692e521..69e4321 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 _0xfef5=['isObjectLike','setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','STRING','name','TEXT','long'];(function(_0x22a93a,_0x3e446d){var _0x759bd2=function(_0x2d67c7){while(--_0x2d67c7){_0x22a93a['push'](_0x22a93a['shift']());}};_0x759bd2(++_0x3e446d);}(_0xfef5,0x1c8));var _0x5fef=function(_0x4d1f94,_0xcdccd0){_0x4d1f94=_0x4d1f94-0x0;var _0x259f18=_0xfef5[_0x4d1f94];return _0x259f18;};'use strict';var Sequelize=require(_0x5fef('0x0'));var _=require(_0x5fef('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0x5fef('0x2')],'unique':_0x5fef('0x3')},'description':{'type':Sequelize[_0x5fef('0x2')]},'formData':{'type':Sequelize[_0x5fef('0x4')](_0x5fef('0x5')),'set':function(_0x221c3f){if(_[_0x5fef('0x6')](_0x221c3f)){this[_0x5fef('0x7')](_0x5fef('0x8'),JSON['stringify'](_0x221c3f));}else if(_[_0x5fef('0x9')](_0x221c3f)){this[_0x5fef('0x7')](_0x5fef('0x8'),_0x221c3f);}else{this[_0x5fef('0x7')](_0x5fef('0x8'),util[_0x5fef('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x5fef('0xb')]('name')||'',this[_0x5fef('0xb')](_0x5fef('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5fef('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5fef('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x0304=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','description','BOOLEAN','sequelize','lodash','exports','long','isObjectLike','setDataValue'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0304,0xb0));var _0x4030=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x0304[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x4030('0x0'));var _=require(_0x4030('0x1'));var util=require('util');module[_0x4030('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x4030('0x3')),'set':function(_0x2b6a11){if(_[_0x4030('0x4')](_0x2b6a11)){this[_0x4030('0x5')](_0x4030('0x6'),JSON[_0x4030('0x7')](_0x2b6a11));}else if(_[_0x4030('0x8')](_0x2b6a11)){this[_0x4030('0x5')]('formData',_0x2b6a11);}else{this[_0x4030('0x5')](_0x4030('0x6'),util[_0x4030('0x9')](_0x4030('0xa'),this['getDataValue'](_0x4030('0xb'))||'',this['getDataValue'](_0x4030('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4030('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4030('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 26b083d..43edd36 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 _0x751c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','show','keys','rawAttributes','length','find','catch','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','pick','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x363ca7,_0x50d3ce){var _0x2010b3=function(_0x4cfd10){while(--_0x4cfd10){_0x363ca7['push'](_0x363ca7['shift']());}};_0x2010b3(++_0x50d3ce);}(_0x751c,0x69));var _0xc751=function(_0x4d7cbf,_0x4cd498){_0x4d7cbf=_0x4d7cbf-0x0;var _0x391f1b=_0x751c[_0x4d7cbf];return _0x391f1b;};'use strict';var emlformat=require(_0xc751('0x0'));var rimraf=require(_0xc751('0x1'));var zipdir=require(_0xc751('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc751('0x3'));var moment=require('moment');var BPromise=require(_0xc751('0x4'));var Mustache=require('mustache');var util=require(_0xc751('0x5'));var path=require(_0xc751('0x6'));var sox=require(_0xc751('0x7'));var csv=require(_0xc751('0x8'));var ejs=require(_0xc751('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc751('0xa'));var squel=require(_0xc751('0xb'));var crypto=require('crypto');var jsforce=require(_0xc751('0xc'));var deskjs=require(_0xc751('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc751('0xe'));var Papa=require(_0xc751('0xf'));var Redis=require(_0xc751('0x10'));var authService=require(_0xc751('0x11'));var qs=require(_0xc751('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc751('0x13'));var utils=require('../../config/utils');var config=require(_0xc751('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc751('0x15'))['db'];function respondWithStatusCode(_0x21cfff,_0x4221ce){_0x4221ce=_0x4221ce||0xcc;return function(_0x490214){if(_0x490214){return _0x21cfff[_0xc751('0x16')](_0x4221ce);}return _0x21cfff['status'](_0x4221ce)[_0xc751('0x17')]();};}function respondWithResult(_0x497cf7,_0x3dafe4){_0x3dafe4=_0x3dafe4||0xc8;return function(_0x405e49){if(_0x405e49){return _0x497cf7[_0xc751('0x18')](_0x3dafe4)[_0xc751('0x19')](_0x405e49);}};}function respondWithFilteredResult(_0x17af51,_0x5a7d75){return function(_0x3ca29d){if(_0x3ca29d){var _0x184f0e=typeof _0x5a7d75[_0xc751('0x1a')]===_0xc751('0x1b')&&typeof _0x5a7d75[_0xc751('0x1c')]===_0xc751('0x1b');var _0x49411d=_0x3ca29d['count'];var _0x6884e0=_0x184f0e?0x0:_0x5a7d75[_0xc751('0x1a')];var _0x1e98f1=_0x184f0e?_0x3ca29d['count']:_0x5a7d75[_0xc751('0x1a')]+_0x5a7d75[_0xc751('0x1c')];var _0x5a074b;if(_0x1e98f1>=_0x49411d){_0x1e98f1=_0x49411d;_0x5a074b=0xc8;}else{_0x5a074b=0xce;}_0x17af51[_0xc751('0x18')](_0x5a074b);return _0x17af51['set']('Content-Range',_0x6884e0+'-'+_0x1e98f1+'/'+_0x49411d)[_0xc751('0x19')](_0x3ca29d);}return null;};}function patchUpdates(_0x55bd5c){return function(_0x2cef60){try{jsonpatch['apply'](_0x2cef60,_0x55bd5c,!![]);}catch(_0x350090){return BPromise[_0xc751('0x1d')](_0x350090);}return _0x2cef60[_0xc751('0x1e')]();};}function saveUpdates(_0x419794,_0x3ad3e7){return function(_0x3be4eb){if(_0x3be4eb){return _0x3be4eb[_0xc751('0x1f')](_0x419794)[_0xc751('0x20')](function(_0x154625){return _0x154625;});}return null;};}function removeEntity(_0x37c921,_0x4df4a4){return function(_0x5b9413){if(_0x5b9413){return _0x5b9413[_0xc751('0x21')]()['then'](function(){var _0x5be9a8=_0x5b9413['get']({'plain':!![]});var _0x3210a4=_0xc751('0x22');return db[_0xc751('0x23')]['destroy']({'where':{'type':_0x3210a4,'resourceId':_0x5be9a8['id']}})[_0xc751('0x20')](function(){return _0x5b9413;});})[_0xc751('0x20')](function(){_0x37c921[_0xc751('0x18')](0xcc)[_0xc751('0x17')]();});}};}function handleEntityNotFound(_0x4bd31f,_0x1a7ec2){return function(_0x2fe70c){if(!_0x2fe70c){_0x4bd31f['sendStatus'](0x194);}return _0x2fe70c;};}function handleError(_0x58c24d,_0x31b876){_0x31b876=_0x31b876||0x1f4;return function(_0x212385){logger[_0xc751('0x24')](_0x212385[_0xc751('0x25')]);if(_0x212385[_0xc751('0x26')]){delete _0x212385[_0xc751('0x26')];}_0x58c24d[_0xc751('0x18')](_0x31b876)[_0xc751('0x27')](_0x212385);};}exports[_0xc751('0x28')]=function(_0x1b2816,_0x4d01ab){var _0x1c5bee={},_0x45146d={},_0x14a807={'count':0x0,'rows':[]};var _0xeefcb6=_[_0xc751('0x29')](db[_0xc751('0x2a')]['rawAttributes'],function(_0x1867c7){return{'name':_0x1867c7[_0xc751('0x2b')],'type':_0x1867c7['type'][_0xc751('0x2c')]};});_0x45146d[_0xc751('0x2d')]=_[_0xc751('0x29')](_0xeefcb6,_0xc751('0x26'));_0x45146d['query']=_['keys'](_0x1b2816[_0xc751('0x2e')]);_0x45146d[_0xc751('0x2f')]=_['intersection'](_0x45146d[_0xc751('0x2d')],_0x45146d[_0xc751('0x2e')]);_0x1c5bee[_0xc751('0x30')]=_[_0xc751('0x31')](_0x45146d[_0xc751('0x2d')],qs[_0xc751('0x32')](_0x1b2816[_0xc751('0x2e')][_0xc751('0x32')]));_0x1c5bee[_0xc751('0x30')]=_0x1c5bee[_0xc751('0x30')]['length']?_0x1c5bee[_0xc751('0x30')]:_0x45146d['model'];if(!_0x1b2816[_0xc751('0x2e')][_0xc751('0x33')](_0xc751('0x34'))){_0x1c5bee[_0xc751('0x1c')]=qs['limit'](_0x1b2816['query'][_0xc751('0x1c')]);_0x1c5bee['offset']=qs[_0xc751('0x1a')](_0x1b2816['query'][_0xc751('0x1a')]);}_0x1c5bee[_0xc751('0x35')]=qs[_0xc751('0x36')](_0x1b2816[_0xc751('0x2e')][_0xc751('0x36')]);_0x1c5bee['where']=qs[_0xc751('0x2f')](_['pick'](_0x1b2816[_0xc751('0x2e')],_0x45146d[_0xc751('0x2f')]),_0xeefcb6);if(_0x1b2816[_0xc751('0x2e')][_0xc751('0x37')]){_0x1c5bee['where']=_['merge'](_0x1c5bee[_0xc751('0x38')],{'$or':_['map'](_0xeefcb6,function(_0x22be47){if(_0x22be47[_0xc751('0x39')]!==_0xc751('0x3a')){var _0x49913d={};_0x49913d[_0x22be47['name']]={'$like':'%'+_0x1b2816[_0xc751('0x2e')][_0xc751('0x37')]+'%'};return _0x49913d;}})});}_0x1c5bee=_[_0xc751('0x3b')]({},_0x1c5bee,_0x1b2816[_0xc751('0x3c')]);var _0x2e299d={'where':_0x1c5bee[_0xc751('0x38')]};return db['JscriptyProject'][_0xc751('0x3d')](_0x2e299d)['then'](function(_0x433d4d){_0x14a807['count']=_0x433d4d;if(_0x1b2816[_0xc751('0x2e')][_0xc751('0x3e')]){_0x1c5bee['include']=[{'all':!![]}];}return db[_0xc751('0x2a')][_0xc751('0x3f')](_0x1c5bee);})[_0xc751('0x20')](function(_0x4d30f9){_0x14a807[_0xc751('0x40')]=_0x4d30f9;return _0x14a807;})[_0xc751('0x20')](respondWithFilteredResult(_0x4d01ab,_0x1c5bee))['catch'](handleError(_0x4d01ab,null));};exports[_0xc751('0x41')]=function(_0x3fd899,_0x32668c){var _0x528a24={'raw':![],'where':{'id':_0x3fd899['params']['id']}},_0x1b6b3c={};_0x1b6b3c['model']=_[_0xc751('0x42')](db[_0xc751('0x2a')][_0xc751('0x43')]);_0x1b6b3c['query']=_[_0xc751('0x42')](_0x3fd899[_0xc751('0x2e')]);_0x1b6b3c[_0xc751('0x2f')]=_[_0xc751('0x31')](_0x1b6b3c[_0xc751('0x2d')],_0x1b6b3c[_0xc751('0x2e')]);_0x528a24['attributes']=_[_0xc751('0x31')](_0x1b6b3c[_0xc751('0x2d')],qs[_0xc751('0x32')](_0x3fd899['query'][_0xc751('0x32')]));_0x528a24[_0xc751('0x30')]=_0x528a24[_0xc751('0x30')][_0xc751('0x44')]?_0x528a24[_0xc751('0x30')]:_0x1b6b3c['model'];if(_0x3fd899[_0xc751('0x2e')][_0xc751('0x3e')]){_0x528a24['include']=[{'all':!![]}];}_0x528a24=_['merge']({},_0x528a24,_0x3fd899[_0xc751('0x3c')]);return db[_0xc751('0x2a')][_0xc751('0x45')](_0x528a24)['then'](handleEntityNotFound(_0x32668c,null))[_0xc751('0x20')](respondWithResult(_0x32668c,null))[_0xc751('0x46')](handleError(_0x32668c,null));};exports[_0xc751('0x47')]=function(_0x1b3e07,_0x210095){return db[_0xc751('0x2a')]['create'](_0x1b3e07[_0xc751('0x48')],{})[_0xc751('0x20')](function(_0x25e700){var _0x58dd77=_0x1b3e07['user']['get']({'plain':!![]});if(!_0x58dd77)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58dd77['role']===_0xc751('0x49')){var _0x3082f4=_0x25e700[_0xc751('0x4a')]({'plain':!![]});var _0xbd347c=_0xc751('0x22');return db[_0xc751('0x4b')][_0xc751('0x45')]({'where':{'name':_0xbd347c,'userProfileId':_0x58dd77['userProfileId']},'raw':!![]})[_0xc751('0x20')](function(_0x29152f){if(_0x29152f&&_0x29152f[_0xc751('0x4c')]===0x0){return db[_0xc751('0x23')][_0xc751('0x47')]({'name':_0x3082f4[_0xc751('0x26')],'resourceId':_0x3082f4['id'],'type':_0x29152f[_0xc751('0x26')],'sectionId':_0x29152f['id']},{})['then'](function(){return _0x25e700;});}else{return _0x25e700;}})['catch'](function(_0x2bf1bf){logger[_0xc751('0x24')](_0xc751('0x4d'),_0x2bf1bf);throw _0x2bf1bf;});}return _0x25e700;})[_0xc751('0x20')](respondWithResult(_0x210095,0xc9))[_0xc751('0x46')](handleError(_0x210095,null));};exports['clone']=function(_0x3cc431,_0x3dc288){var _0x10c8d3={'where':{'id':_0x3cc431[_0xc751('0x4e')]['id']}},_0x58c98e={};_0x58c98e['model']=_[_0xc751('0x42')](db[_0xc751('0x2a')][_0xc751('0x43')]);_0x10c8d3[_0xc751('0x30')]=_[_0xc751('0x31')](_0x58c98e['model'],qs[_0xc751('0x32')](_0x3cc431['query'][_0xc751('0x32')]));_0x10c8d3[_0xc751('0x30')]=_0x10c8d3[_0xc751('0x30')]['length']?_0x10c8d3[_0xc751('0x30')]:_0x58c98e['model'];if(_0x3cc431[_0xc751('0x2e')][_0xc751('0x3e')]){_0x10c8d3[_0xc751('0x4f')]=[{'all':!![]}];}_0x10c8d3=_[_0xc751('0x3b')]({},_0x10c8d3,_0x3cc431[_0xc751('0x3c')]);return db[_0xc751('0x2a')][_0xc751('0x45')](_0x10c8d3)[_0xc751('0x20')](handleEntityNotFound(_0x3dc288,null))[_0xc751('0x20')](function(_0x5599ef){if(_0x5599ef){var _0x190036=_0x5599ef['get']({'plain':!![]});_0x190036=qs[_0xc751('0x50')](_0x190036,['id',_0xc751('0x51'),'updatedAt']);_0x3cc431[_0xc751('0x48')]=_['omit'](_0x3cc431[_0xc751('0x48')],['id',_0xc751('0x51'),_0xc751('0x52')]);return db[_0xc751('0x2a')][_0xc751('0x47')](_[_0xc751('0x3b')](_0x190036,_0x3cc431['body']),{'include':_0x3cc431[_0xc751('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0xc751('0x20')](function(_0x50ee15){var _0x5194b1=_0x3cc431[_0xc751('0x49')][_0xc751('0x4a')]({'plain':!![]});if(!_0x5194b1)throw new Error(_0xc751('0x53'));if(_0x5194b1[_0xc751('0x54')]===_0xc751('0x49')){var _0x15944e=_0x50ee15[_0xc751('0x4a')]({'plain':!![]});var _0x4962f8=_0xc751('0x22');return db[_0xc751('0x4b')][_0xc751('0x45')]({'where':{'name':_0x4962f8,'userProfileId':_0x5194b1[_0xc751('0x55')]},'raw':!![]})[_0xc751('0x20')](function(_0x3029de){if(_0x3029de&&_0x3029de[_0xc751('0x4c')]===0x0){return db[_0xc751('0x23')][_0xc751('0x47')]({'name':_0x15944e['name'],'resourceId':_0x15944e['id'],'type':_0x3029de['name'],'sectionId':_0x3029de['id']},{})[_0xc751('0x20')](function(){return _0x50ee15;});}else{return _0x50ee15;}})['catch'](function(_0x412736){logger['error'](_0xc751('0x4d'),_0x412736);throw _0x412736;});}return _0x50ee15;});}})[_0xc751('0x20')](respondWithResult(_0x3dc288,0xc9))[_0xc751('0x46')](handleError(_0x3dc288,null));};exports[_0xc751('0x1f')]=function(_0x7e7973,_0x1ea8aa){if(_0x7e7973[_0xc751('0x48')]['id']){delete _0x7e7973[_0xc751('0x48')]['id'];}return db[_0xc751('0x2a')][_0xc751('0x45')]({'where':{'id':_0x7e7973['params']['id']}})[_0xc751('0x20')](handleEntityNotFound(_0x1ea8aa,null))[_0xc751('0x20')](saveUpdates(_0x7e7973[_0xc751('0x48')],null))[_0xc751('0x20')](respondWithResult(_0x1ea8aa,null))['catch'](handleError(_0x1ea8aa,null));};exports[_0xc751('0x21')]=function(_0x4ec4c4,_0x4796cc){return db[_0xc751('0x2a')][_0xc751('0x45')]({'where':{'id':_0x4ec4c4[_0xc751('0x4e')]['id']}})[_0xc751('0x20')](handleEntityNotFound(_0x4796cc,null))[_0xc751('0x20')](removeEntity(_0x4796cc,null))[_0xc751('0x46')](handleError(_0x4796cc,null));};exports[_0xc751('0x56')]=function(_0x89ba3d,_0xebcfd8,_0x9094a1){var _0xb79a61={'raw':!![],'where':{}};var _0x20d6c1={};var _0x5e136c={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x89ba3d[_0xc751('0x4e')]['id']}})['then'](handleEntityNotFound(_0xebcfd8,null))[_0xc751('0x20')](function(_0x1e44e6){if(_0x1e44e6){_0x20d6c1[_0xc751('0x2d')]=_[_0xc751('0x42')](db[_0xc751('0x57')]['rawAttributes']);_0x20d6c1[_0xc751('0x2e')]=_[_0xc751('0x42')](_0x89ba3d[_0xc751('0x2e')]);_0x20d6c1[_0xc751('0x2f')]=_[_0xc751('0x31')](_0x20d6c1[_0xc751('0x2d')],_0x20d6c1[_0xc751('0x2e')]);_0xb79a61[_0xc751('0x30')]=_['intersection'](_0x20d6c1[_0xc751('0x2d')],qs[_0xc751('0x32')](_0x89ba3d[_0xc751('0x2e')][_0xc751('0x32')]));_0xb79a61['attributes']=_0xb79a61[_0xc751('0x30')][_0xc751('0x44')]?_0xb79a61[_0xc751('0x30')]:_0x20d6c1[_0xc751('0x2d')];if(!_0x89ba3d[_0xc751('0x2e')][_0xc751('0x33')](_0xc751('0x34'))){_0xb79a61[_0xc751('0x1c')]=qs['limit'](_0x89ba3d[_0xc751('0x2e')]['limit']);_0xb79a61[_0xc751('0x1a')]=qs[_0xc751('0x1a')](_0x89ba3d[_0xc751('0x2e')][_0xc751('0x1a')]);}_0xb79a61['order']=qs['sort'](_0x89ba3d['query'][_0xc751('0x36')]);_0xb79a61[_0xc751('0x38')]=qs['filters'](_['pick'](_0x89ba3d[_0xc751('0x2e')],_0x20d6c1[_0xc751('0x2f')]));_0xb79a61[_0xc751('0x38')][_0xc751('0x58')]=_0x1e44e6['id'];if(_0x89ba3d[_0xc751('0x2e')][_0xc751('0x37')]){_0xb79a61['where']=_['merge'](_0xb79a61[_0xc751('0x38')],{'$or':_[_0xc751('0x29')](_0xb79a61[_0xc751('0x30')],function(_0x2c5cd4){var _0x1c1eaa={};_0x1c1eaa[_0x2c5cd4]={'$like':'%'+_0x89ba3d['query'][_0xc751('0x37')]+'%'};return _0x1c1eaa;})});}_0xb79a61=_[_0xc751('0x3b')]({},_0xb79a61,_0x89ba3d[_0xc751('0x3c')]);return db['JscriptySessionReport'][_0xc751('0x3d')]({'where':_0xb79a61[_0xc751('0x38')]})[_0xc751('0x20')](function(_0x833962){_0x5e136c[_0xc751('0x3d')]=_0x833962;if(_0x89ba3d['query']['includeAll']){_0xb79a61['include']=[{'all':!![]}];}return db[_0xc751('0x57')][_0xc751('0x3f')](_0xb79a61);})[_0xc751('0x20')](function(_0x27576a){_0x5e136c[_0xc751('0x40')]=_0x27576a;return _0x5e136c;});}})['then'](respondWithFilteredResult(_0xebcfd8,_0xb79a61))['catch'](handleError(_0xebcfd8,null));};exports[_0xc751('0x59')]=function(_0x44e3b6,_0x3c9132,_0x326c24){var _0x4a4e9f={'raw':!![],'where':{}};var _0x2c089e={};var _0x332568={'count':0x0,'rows':[]};return db[_0xc751('0x2a')][_0xc751('0x5a')]({'where':{'id':_0x44e3b6[_0xc751('0x4e')]['id']}})[_0xc751('0x20')](handleEntityNotFound(_0x3c9132,null))[_0xc751('0x20')](function(_0x58ffac){if(_0x58ffac){_0x2c089e[_0xc751('0x2d')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x2c089e['query']=_[_0xc751('0x42')](_0x44e3b6['query']);_0x2c089e[_0xc751('0x2f')]=_['intersection'](_0x2c089e[_0xc751('0x2d')],_0x2c089e['query']);_0x4a4e9f[_0xc751('0x30')]=_['intersection'](_0x2c089e[_0xc751('0x2d')],qs[_0xc751('0x32')](_0x44e3b6[_0xc751('0x2e')][_0xc751('0x32')]));_0x4a4e9f[_0xc751('0x30')]=_0x4a4e9f[_0xc751('0x30')][_0xc751('0x44')]?_0x4a4e9f[_0xc751('0x30')]:_0x2c089e[_0xc751('0x2d')];if(!_0x44e3b6[_0xc751('0x2e')][_0xc751('0x33')]('nolimit')){_0x4a4e9f[_0xc751('0x1c')]=qs[_0xc751('0x1c')](_0x44e3b6[_0xc751('0x2e')][_0xc751('0x1c')]);_0x4a4e9f[_0xc751('0x1a')]=qs[_0xc751('0x1a')](_0x44e3b6[_0xc751('0x2e')]['offset']);}_0x4a4e9f[_0xc751('0x35')]=qs[_0xc751('0x36')](_0x44e3b6[_0xc751('0x2e')][_0xc751('0x36')]);_0x4a4e9f[_0xc751('0x38')]=qs[_0xc751('0x2f')](_[_0xc751('0x5b')](_0x44e3b6[_0xc751('0x2e')],_0x2c089e[_0xc751('0x2f')]));_0x4a4e9f[_0xc751('0x38')][_0xc751('0x58')]=_0x58ffac['id'];if(_0x44e3b6[_0xc751('0x2e')][_0xc751('0x37')]){_0x4a4e9f[_0xc751('0x38')]=_[_0xc751('0x3b')](_0x4a4e9f[_0xc751('0x38')],{'$or':_[_0xc751('0x29')](_0x4a4e9f[_0xc751('0x30')],function(_0x31a8f2){var _0x3769d9={};_0x3769d9[_0x31a8f2]={'$like':'%'+_0x44e3b6[_0xc751('0x2e')][_0xc751('0x37')]+'%'};return _0x3769d9;})});}_0x4a4e9f=_[_0xc751('0x3b')]({},_0x4a4e9f,_0x44e3b6['options']);return db[_0xc751('0x5c')][_0xc751('0x3d')]({'where':_0x4a4e9f[_0xc751('0x38')]})['then'](function(_0x20da30){_0x332568['count']=_0x20da30;if(_0x44e3b6[_0xc751('0x2e')]['includeAll']){_0x4a4e9f['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a4e9f);})[_0xc751('0x20')](function(_0x1ce33f){_0x332568[_0xc751('0x40')]=_0x1ce33f;return _0x332568;});}})[_0xc751('0x20')](respondWithFilteredResult(_0x3c9132,_0x4a4e9f))['catch'](handleError(_0x3c9132,null));};function char(_0x4b4bf0){return _0xc751('0x5d')===typeof _0x4b4bf0?String[_0xc751('0x5e')][_0xc751('0x5f')](null,arguments):_0x4b4bf0;}function needsEncapsulation(_0x5b1769){return!!_0x5b1769&&(_0x5b1769[_0xc751('0x60')]()[_0xc751('0x61')](char(0xd))>=0x0||_0x5b1769[_0xc751('0x60')]()[_0xc751('0x61')](char(0xa))>=0x0||_0x5b1769['toString']()[_0xc751('0x61')](char(0x2c))>=0x0||_0x5b1769[_0xc751('0x60')]()[_0xc751('0x61')](char(0x22))>=0x0);}function encapsulate(_0x137f5c){var _0xa61383=char(0x22),_0x263ebe='\x5c'+char(0x22),_0x530f37=_0x137f5c[_0xc751('0x60')]()[_0xc751('0x62')](new RegExp(_0xa61383,'g'),_0x263ebe);return _0xa61383+_0x530f37+_0xa61383;}exports['getSummary']=function(_0x262fe0,_0x3859f4,_0x5510b3){var _0x3a03ad,_0x57e4a5;var _0x30aa82={'where':{'ProjectId':_0x262fe0[_0xc751('0x4e')]['id']}};if(_0x262fe0[_0xc751('0x2e')][_0xc751('0x63')]){_0x30aa82[_0xc751('0x38')][_0xc751('0x64')]=JSON[_0xc751('0x65')](_0x262fe0[_0xc751('0x2e')][_0xc751('0x63')]);}return db[_0xc751('0x57')][_0xc751('0x3f')](_0x30aa82)['then'](handleEntityNotFound(_0x3859f4,null))[_0xc751('0x20')](function(_0x183989){if(_0x183989){_0x3a03ad=_0x183989;return db[_0xc751('0x66')][_0xc751('0x3f')]({'where':{'SessionId':{'$in':_[_0xc751('0x29')](_0x3a03ad,'id')},'ProjectId':_0x262fe0[_0xc751('0x4e')]['id']},'order':_0xc751('0x67')});}})[_0xc751('0x20')](handleEntityNotFound(_0x3859f4,null))[_0xc751('0x20')](function(_0x15896f){if(_0x15896f){_0x57e4a5=_0x15896f;var _0x2f4344={};for(var _0x5bf3fa=0x0,_0xab7ab4=_0x57e4a5['length'];_0x5bf3fa<_0xab7ab4;_0x5bf3fa++){if(!_0x2f4344[_0xc751('0x33')](_0x57e4a5[_0x5bf3fa][_0xc751('0x68')])){_0x2f4344[_0x57e4a5[_0x5bf3fa]['questionId']]=needsEncapsulation(_0x57e4a5[_0x5bf3fa][_0xc751('0x69')])?encapsulate(_0x57e4a5[_0x5bf3fa][_0xc751('0x69')]):_0x57e4a5[_0x5bf3fa][_0xc751('0x69')];}}var _0x27055c=[],_0x43b1e0={};for(var _0x351bfb=0x0,_0x3543a7=_0x3a03ad[_0xc751('0x44')];_0x351bfb<_0x3543a7;_0x351bfb++){_0x43b1e0={'ProjectId':_0x262fe0['params']['id'],'SessionId':_0x3a03ad[_0x351bfb]['id'],'StartTime':moment(_0x3a03ad[_0x351bfb]['starttime'])['format'](_0xc751('0x6a'))};for(var _0x14d124=0x0,_0x504a65=_0x57e4a5[_0xc751('0x44')];_0x14d124<_0x504a65;_0x14d124++){if(_0x57e4a5[_0x14d124][_0xc751('0x6b')]==_0x3a03ad[_0x351bfb]['id']&&_0x2f4344[_0xc751('0x33')](_0x57e4a5[_0x14d124][_0xc751('0x68')])){_0x43b1e0[_0x2f4344[_0x57e4a5[_0x14d124]['questionId']]]=_0x57e4a5[_0x14d124][_0xc751('0x6c')];}}for(var _0x53a2cd in _0x2f4344){if(!_0x43b1e0[_0xc751('0x33')](_0x2f4344[_0x53a2cd])){_0x43b1e0[_0x2f4344[_0x53a2cd]]=null;}}_0x27055c[_0xc751('0x6d')](_0x43b1e0);}return _0x27055c;}})[_0xc751('0x20')](function(_0x39b106){if(!_['isEmpty'](_0x39b106)){var _0x25d167=toCsv(_0x39b106);var _0x33103e=Date[_0xc751('0x6e')]();fs['writeFileSync'](util[_0xc751('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x262fe0[_0xc751('0x4e')]['id'],_0x33103e),_0x25d167);_0x3859f4[_0xc751('0x70')](_0xc751('0x71'),_0xc751('0x72')+util[_0xc751('0x6f')](_0xc751('0x73'),_0x262fe0[_0xc751('0x4e')]['id'],_0x33103e));_0x3859f4['setHeader'](_0xc751('0x74'),_0xc751('0x75'));return _0x3859f4[_0xc751('0x76')](util[_0xc751('0x6f')](_0xc751('0x77'),_0x262fe0[_0xc751('0x4e')]['id'],_0x33103e));}else{return _0x3859f4[_0xc751('0x16')](0xcc);}})[_0xc751('0x46')](handleError(_0x3859f4,null));}; \ No newline at end of file +var _0xce2f=['body','user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getSessions','findOne','JscriptySessionReport','length','hasOwnProperty','ProjectId','JscriptyAnswerReport','pick','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','send','map','JscriptyProject','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find'];(function(_0x2701bb,_0xc649d6){var _0x3c8a65=function(_0x35add4){while(--_0x35add4){_0x2701bb['push'](_0x2701bb['shift']());}};_0x3c8a65(++_0xc649d6);}(_0xce2f,0x18a));var _0xfce2=function(_0x1e60ac,_0xa58cb3){_0x1e60ac=_0x1e60ac-0x0;var _0x4e69ee=_0xce2f[_0x1e60ac];return _0x4e69ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfce2('0x0'));var zipdir=require(_0xfce2('0x1'));var jsonpatch=require(_0xfce2('0x2'));var rp=require(_0xfce2('0x3'));var moment=require(_0xfce2('0x4'));var BPromise=require(_0xfce2('0x5'));var Mustache=require('mustache');var util=require(_0xfce2('0x6'));var path=require('path');var sox=require(_0xfce2('0x7'));var csv=require('to-csv');var ejs=require(_0xfce2('0x8'));var fs=require('fs');var fs_extra=require(_0xfce2('0x9'));var _=require(_0xfce2('0xa'));var squel=require(_0xfce2('0xb'));var crypto=require(_0xfce2('0xc'));var jsforce=require(_0xfce2('0xd'));var deskjs=require(_0xfce2('0xe'));var toCsv=require(_0xfce2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfce2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfce2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfce2('0x12'));var logger=require('../../config/logger')(_0xfce2('0x13'));var utils=require(_0xfce2('0x14'));var config=require(_0xfce2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfce2('0x16'))['db'];function respondWithStatusCode(_0x5bc459,_0x14cf81){_0x14cf81=_0x14cf81||0xcc;return function(_0x1149ac){if(_0x1149ac){return _0x5bc459[_0xfce2('0x17')](_0x14cf81);}return _0x5bc459[_0xfce2('0x18')](_0x14cf81)[_0xfce2('0x19')]();};}function respondWithResult(_0x3fa748,_0x272f58){_0x272f58=_0x272f58||0xc8;return function(_0x4fdcc2){if(_0x4fdcc2){return _0x3fa748[_0xfce2('0x18')](_0x272f58)[_0xfce2('0x1a')](_0x4fdcc2);}};}function respondWithFilteredResult(_0x47c53a,_0x32094b){return function(_0x1d35c5){if(_0x1d35c5){var _0x5781fe=typeof _0x32094b['offset']===_0xfce2('0x1b')&&typeof _0x32094b[_0xfce2('0x1c')]==='undefined';var _0x18e430=_0x1d35c5[_0xfce2('0x1d')];var _0x1e02a6=_0x5781fe?0x0:_0x32094b[_0xfce2('0x1e')];var _0x2ad9f5=_0x5781fe?_0x1d35c5[_0xfce2('0x1d')]:_0x32094b[_0xfce2('0x1e')]+_0x32094b[_0xfce2('0x1c')];var _0x1cdd29;if(_0x2ad9f5>=_0x18e430){_0x2ad9f5=_0x18e430;_0x1cdd29=0xc8;}else{_0x1cdd29=0xce;}_0x47c53a[_0xfce2('0x18')](_0x1cdd29);return _0x47c53a['set']('Content-Range',_0x1e02a6+'-'+_0x2ad9f5+'/'+_0x18e430)[_0xfce2('0x1a')](_0x1d35c5);}return null;};}function patchUpdates(_0x3ea07b){return function(_0x312c10){try{jsonpatch[_0xfce2('0x1f')](_0x312c10,_0x3ea07b,!![]);}catch(_0x4bbebc){return BPromise[_0xfce2('0x20')](_0x4bbebc);}return _0x312c10[_0xfce2('0x21')]();};}function saveUpdates(_0x33ced0,_0x4c239b){return function(_0x4088c7){if(_0x4088c7){return _0x4088c7[_0xfce2('0x22')](_0x33ced0)[_0xfce2('0x23')](function(_0x4d59b7){return _0x4d59b7;});}return null;};}function removeEntity(_0x57bc28,_0x39476b){return function(_0x208903){if(_0x208903){return _0x208903[_0xfce2('0x24')]()[_0xfce2('0x23')](function(){var _0x57d743=_0x208903[_0xfce2('0x25')]({'plain':!![]});var _0x5cd9b2=_0xfce2('0x26');return db['UserProfileResource'][_0xfce2('0x24')]({'where':{'type':_0x5cd9b2,'resourceId':_0x57d743['id']}})[_0xfce2('0x23')](function(){return _0x208903;});})[_0xfce2('0x23')](function(){_0x57bc28['status'](0xcc)[_0xfce2('0x19')]();});}};}function handleEntityNotFound(_0x2358dc,_0x175bcc){return function(_0x112f0a){if(!_0x112f0a){_0x2358dc['sendStatus'](0x194);}return _0x112f0a;};}function handleError(_0x6c8a47,_0xef1b38){_0xef1b38=_0xef1b38||0x1f4;return function(_0x58022e){logger[_0xfce2('0x27')](_0x58022e[_0xfce2('0x28')]);if(_0x58022e[_0xfce2('0x29')]){delete _0x58022e[_0xfce2('0x29')];}_0x6c8a47['status'](_0xef1b38)[_0xfce2('0x2a')](_0x58022e);};}exports['index']=function(_0x1b211c,_0x468739){var _0x3332f9={},_0x35b7fe={},_0x1882cd={'count':0x0,'rows':[]};var _0x101107=_[_0xfce2('0x2b')](db[_0xfce2('0x2c')]['rawAttributes'],function(_0x10b9ec){return{'name':_0x10b9ec[_0xfce2('0x2d')],'type':_0x10b9ec[_0xfce2('0x2e')]['key']};});_0x35b7fe[_0xfce2('0x2f')]=_['map'](_0x101107,'name');_0x35b7fe[_0xfce2('0x30')]=_['keys'](_0x1b211c[_0xfce2('0x30')]);_0x35b7fe[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x35b7fe[_0xfce2('0x2f')],_0x35b7fe['query']);_0x3332f9['attributes']=_['intersection'](_0x35b7fe[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x1b211c[_0xfce2('0x30')][_0xfce2('0x33')]));_0x3332f9[_0xfce2('0x34')]=_0x3332f9['attributes']['length']?_0x3332f9[_0xfce2('0x34')]:_0x35b7fe[_0xfce2('0x2f')];if(!_0x1b211c[_0xfce2('0x30')]['hasOwnProperty'](_0xfce2('0x35'))){_0x3332f9['limit']=qs[_0xfce2('0x1c')](_0x1b211c[_0xfce2('0x30')][_0xfce2('0x1c')]);_0x3332f9['offset']=qs['offset'](_0x1b211c[_0xfce2('0x30')][_0xfce2('0x1e')]);}_0x3332f9[_0xfce2('0x36')]=qs[_0xfce2('0x37')](_0x1b211c['query'][_0xfce2('0x37')]);_0x3332f9['where']=qs[_0xfce2('0x31')](_['pick'](_0x1b211c[_0xfce2('0x30')],_0x35b7fe[_0xfce2('0x31')]),_0x101107);if(_0x1b211c[_0xfce2('0x30')][_0xfce2('0x38')]){_0x3332f9[_0xfce2('0x39')]=_['merge'](_0x3332f9[_0xfce2('0x39')],{'$or':_[_0xfce2('0x2b')](_0x101107,function(_0x52ae47){if(_0x52ae47[_0xfce2('0x2e')]!==_0xfce2('0x3a')){var _0x3df655={};_0x3df655[_0x52ae47[_0xfce2('0x29')]]={'$like':'%'+_0x1b211c[_0xfce2('0x30')]['filter']+'%'};return _0x3df655;}})});}_0x3332f9=_[_0xfce2('0x3b')]({},_0x3332f9,_0x1b211c['options']);var _0x35108a={'where':_0x3332f9[_0xfce2('0x39')]};return db[_0xfce2('0x2c')][_0xfce2('0x1d')](_0x35108a)[_0xfce2('0x23')](function(_0x51037e){_0x1882cd['count']=_0x51037e;if(_0x1b211c[_0xfce2('0x30')][_0xfce2('0x3c')]){_0x3332f9[_0xfce2('0x3d')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x3332f9);})['then'](function(_0x3fcd0e){_0x1882cd[_0xfce2('0x3e')]=_0x3fcd0e;return _0x1882cd;})['then'](respondWithFilteredResult(_0x468739,_0x3332f9))[_0xfce2('0x3f')](handleError(_0x468739,null));};exports[_0xfce2('0x40')]=function(_0x5beb7a,_0x2faefa){var _0x158bbe={'raw':![],'where':{'id':_0x5beb7a[_0xfce2('0x41')]['id']}},_0x5ad765={};_0x5ad765[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x2c')][_0xfce2('0x43')]);_0x5ad765['query']=_['keys'](_0x5beb7a[_0xfce2('0x30')]);_0x5ad765[_0xfce2('0x31')]=_['intersection'](_0x5ad765['model'],_0x5ad765[_0xfce2('0x30')]);_0x158bbe[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x5ad765[_0xfce2('0x2f')],qs['fields'](_0x5beb7a[_0xfce2('0x30')][_0xfce2('0x33')]));_0x158bbe['attributes']=_0x158bbe[_0xfce2('0x34')]['length']?_0x158bbe[_0xfce2('0x34')]:_0x5ad765[_0xfce2('0x2f')];if(_0x5beb7a[_0xfce2('0x30')][_0xfce2('0x3c')]){_0x158bbe[_0xfce2('0x3d')]=[{'all':!![]}];}_0x158bbe=_['merge']({},_0x158bbe,_0x5beb7a[_0xfce2('0x44')]);return db[_0xfce2('0x2c')][_0xfce2('0x45')](_0x158bbe)['then'](handleEntityNotFound(_0x2faefa,null))[_0xfce2('0x23')](respondWithResult(_0x2faefa,null))[_0xfce2('0x3f')](handleError(_0x2faefa,null));};exports['create']=function(_0x281b4f,_0x2f64d7){return db['JscriptyProject']['create'](_0x281b4f[_0xfce2('0x46')],{})[_0xfce2('0x23')](function(_0x388424){var _0x486750=_0x281b4f[_0xfce2('0x47')][_0xfce2('0x25')]({'plain':!![]});if(!_0x486750)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x486750[_0xfce2('0x48')]===_0xfce2('0x47')){var _0xdecfe0=_0x388424[_0xfce2('0x25')]({'plain':!![]});var _0x418f39=_0xfce2('0x26');return db['UserProfileSection'][_0xfce2('0x45')]({'where':{'name':_0x418f39,'userProfileId':_0x486750[_0xfce2('0x49')]},'raw':!![]})[_0xfce2('0x23')](function(_0x2c04d2){if(_0x2c04d2&&_0x2c04d2[_0xfce2('0x4a')]===0x0){return db[_0xfce2('0x4b')][_0xfce2('0x4c')]({'name':_0xdecfe0[_0xfce2('0x29')],'resourceId':_0xdecfe0['id'],'type':_0x2c04d2[_0xfce2('0x29')],'sectionId':_0x2c04d2['id']},{})[_0xfce2('0x23')](function(){return _0x388424;});}else{return _0x388424;}})[_0xfce2('0x3f')](function(_0x4f8a2f){logger[_0xfce2('0x27')](_0xfce2('0x4d'),_0x4f8a2f);throw _0x4f8a2f;});}return _0x388424;})['then'](respondWithResult(_0x2f64d7,0xc9))['catch'](handleError(_0x2f64d7,null));};exports[_0xfce2('0x4e')]=function(_0x889efe,_0x58417a){var _0x2ce4f3={'where':{'id':_0x889efe['params']['id']}},_0x157f50={};_0x157f50[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x2c')][_0xfce2('0x43')]);_0x2ce4f3[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x157f50[_0xfce2('0x2f')],qs['fields'](_0x889efe[_0xfce2('0x30')][_0xfce2('0x33')]));_0x2ce4f3[_0xfce2('0x34')]=_0x2ce4f3[_0xfce2('0x34')]['length']?_0x2ce4f3[_0xfce2('0x34')]:_0x157f50[_0xfce2('0x2f')];if(_0x889efe[_0xfce2('0x30')]['includeAll']){_0x2ce4f3[_0xfce2('0x3d')]=[{'all':!![]}];}_0x2ce4f3=_['merge']({},_0x2ce4f3,_0x889efe[_0xfce2('0x44')]);return db[_0xfce2('0x2c')][_0xfce2('0x45')](_0x2ce4f3)['then'](handleEntityNotFound(_0x58417a,null))[_0xfce2('0x23')](function(_0x29c464){if(_0x29c464){var _0x1a76db=_0x29c464['get']({'plain':!![]});_0x1a76db=qs[_0xfce2('0x4f')](_0x1a76db,['id',_0xfce2('0x50'),_0xfce2('0x51')]);_0x889efe[_0xfce2('0x46')]=_[_0xfce2('0x4f')](_0x889efe[_0xfce2('0x46')],['id','createdAt',_0xfce2('0x51')]);return db[_0xfce2('0x2c')][_0xfce2('0x4c')](_['merge'](_0x1a76db,_0x889efe[_0xfce2('0x46')]),{'include':_0x889efe[_0xfce2('0x30')][_0xfce2('0x3c')]?[{'all':!![]}]:undefined})[_0xfce2('0x23')](function(_0x26a041){var _0x27ca29=_0x889efe[_0xfce2('0x47')][_0xfce2('0x25')]({'plain':!![]});if(!_0x27ca29)throw new Error(_0xfce2('0x52'));if(_0x27ca29[_0xfce2('0x48')]===_0xfce2('0x47')){var _0x2a8691=_0x26a041[_0xfce2('0x25')]({'plain':!![]});var _0xcaf8c2=_0xfce2('0x26');return db[_0xfce2('0x53')][_0xfce2('0x45')]({'where':{'name':_0xcaf8c2,'userProfileId':_0x27ca29['userProfileId']},'raw':!![]})[_0xfce2('0x23')](function(_0x5651c5){if(_0x5651c5&&_0x5651c5['autoAssociation']===0x0){return db[_0xfce2('0x4b')][_0xfce2('0x4c')]({'name':_0x2a8691[_0xfce2('0x29')],'resourceId':_0x2a8691['id'],'type':_0x5651c5[_0xfce2('0x29')],'sectionId':_0x5651c5['id']},{})[_0xfce2('0x23')](function(){return _0x26a041;});}else{return _0x26a041;}})[_0xfce2('0x3f')](function(_0x52fdd2){logger[_0xfce2('0x27')](_0xfce2('0x4d'),_0x52fdd2);throw _0x52fdd2;});}return _0x26a041;});}})['then'](respondWithResult(_0x58417a,0xc9))[_0xfce2('0x3f')](handleError(_0x58417a,null));};exports[_0xfce2('0x22')]=function(_0x27027c,_0xaeaab5){if(_0x27027c[_0xfce2('0x46')]['id']){delete _0x27027c['body']['id'];}return db[_0xfce2('0x2c')]['find']({'where':{'id':_0x27027c['params']['id']}})['then'](handleEntityNotFound(_0xaeaab5,null))[_0xfce2('0x23')](saveUpdates(_0x27027c['body'],null))[_0xfce2('0x23')](respondWithResult(_0xaeaab5,null))[_0xfce2('0x3f')](handleError(_0xaeaab5,null));};exports[_0xfce2('0x24')]=function(_0x270a73,_0x5e571a){return db['JscriptyProject'][_0xfce2('0x45')]({'where':{'id':_0x270a73[_0xfce2('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e571a,null))[_0xfce2('0x23')](removeEntity(_0x5e571a,null))['catch'](handleError(_0x5e571a,null));};exports[_0xfce2('0x54')]=function(_0x2c6131,_0x52605b,_0x457ca4){var _0xf55475={'raw':!![],'where':{}};var _0x2960c8={};var _0x4783a4={'count':0x0,'rows':[]};return db[_0xfce2('0x2c')][_0xfce2('0x55')]({'where':{'id':_0x2c6131[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x52605b,null))[_0xfce2('0x23')](function(_0x5abd7b){if(_0x5abd7b){_0x2960c8[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x56')]['rawAttributes']);_0x2960c8[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0x2c6131[_0xfce2('0x30')]);_0x2960c8[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x2960c8[_0xfce2('0x2f')],_0x2960c8[_0xfce2('0x30')]);_0xf55475[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x2960c8[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x2c6131[_0xfce2('0x30')]['fields']));_0xf55475['attributes']=_0xf55475[_0xfce2('0x34')][_0xfce2('0x57')]?_0xf55475[_0xfce2('0x34')]:_0x2960c8[_0xfce2('0x2f')];if(!_0x2c6131[_0xfce2('0x30')][_0xfce2('0x58')]('nolimit')){_0xf55475[_0xfce2('0x1c')]=qs[_0xfce2('0x1c')](_0x2c6131[_0xfce2('0x30')][_0xfce2('0x1c')]);_0xf55475[_0xfce2('0x1e')]=qs['offset'](_0x2c6131[_0xfce2('0x30')][_0xfce2('0x1e')]);}_0xf55475[_0xfce2('0x36')]=qs[_0xfce2('0x37')](_0x2c6131[_0xfce2('0x30')][_0xfce2('0x37')]);_0xf55475[_0xfce2('0x39')]=qs[_0xfce2('0x31')](_['pick'](_0x2c6131['query'],_0x2960c8[_0xfce2('0x31')]));_0xf55475[_0xfce2('0x39')][_0xfce2('0x59')]=_0x5abd7b['id'];if(_0x2c6131[_0xfce2('0x30')][_0xfce2('0x38')]){_0xf55475[_0xfce2('0x39')]=_[_0xfce2('0x3b')](_0xf55475[_0xfce2('0x39')],{'$or':_[_0xfce2('0x2b')](_0xf55475[_0xfce2('0x34')],function(_0x4e3e10){var _0x3ed5a0={};_0x3ed5a0[_0x4e3e10]={'$like':'%'+_0x2c6131['query']['filter']+'%'};return _0x3ed5a0;})});}_0xf55475=_['merge']({},_0xf55475,_0x2c6131[_0xfce2('0x44')]);return db[_0xfce2('0x56')][_0xfce2('0x1d')]({'where':_0xf55475[_0xfce2('0x39')]})[_0xfce2('0x23')](function(_0x4312b8){_0x4783a4[_0xfce2('0x1d')]=_0x4312b8;if(_0x2c6131[_0xfce2('0x30')][_0xfce2('0x3c')]){_0xf55475[_0xfce2('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xf55475);})['then'](function(_0x18fb08){_0x4783a4['rows']=_0x18fb08;return _0x4783a4;});}})[_0xfce2('0x23')](respondWithFilteredResult(_0x52605b,_0xf55475))[_0xfce2('0x3f')](handleError(_0x52605b,null));};exports['getAnswers']=function(_0x1ecb8d,_0x38040c,_0x53bb66){var _0x279d9a={'raw':!![],'where':{}};var _0x3d0f85={};var _0x3fb980={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x1ecb8d[_0xfce2('0x41')]['id']}})['then'](handleEntityNotFound(_0x38040c,null))[_0xfce2('0x23')](function(_0x4c1cd8){if(_0x4c1cd8){_0x3d0f85[_0xfce2('0x2f')]=_['keys'](db[_0xfce2('0x5a')]['rawAttributes']);_0x3d0f85[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0x1ecb8d[_0xfce2('0x30')]);_0x3d0f85[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x3d0f85[_0xfce2('0x2f')],_0x3d0f85[_0xfce2('0x30')]);_0x279d9a[_0xfce2('0x34')]=_['intersection'](_0x3d0f85[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x1ecb8d[_0xfce2('0x30')][_0xfce2('0x33')]));_0x279d9a[_0xfce2('0x34')]=_0x279d9a[_0xfce2('0x34')][_0xfce2('0x57')]?_0x279d9a[_0xfce2('0x34')]:_0x3d0f85['model'];if(!_0x1ecb8d[_0xfce2('0x30')]['hasOwnProperty'](_0xfce2('0x35'))){_0x279d9a['limit']=qs[_0xfce2('0x1c')](_0x1ecb8d[_0xfce2('0x30')]['limit']);_0x279d9a[_0xfce2('0x1e')]=qs['offset'](_0x1ecb8d[_0xfce2('0x30')]['offset']);}_0x279d9a[_0xfce2('0x36')]=qs['sort'](_0x1ecb8d[_0xfce2('0x30')]['sort']);_0x279d9a[_0xfce2('0x39')]=qs['filters'](_[_0xfce2('0x5b')](_0x1ecb8d[_0xfce2('0x30')],_0x3d0f85[_0xfce2('0x31')]));_0x279d9a['where']['ProjectId']=_0x4c1cd8['id'];if(_0x1ecb8d[_0xfce2('0x30')]['filter']){_0x279d9a[_0xfce2('0x39')]=_[_0xfce2('0x3b')](_0x279d9a[_0xfce2('0x39')],{'$or':_['map'](_0x279d9a[_0xfce2('0x34')],function(_0x45a5b7){var _0x3abf0b={};_0x3abf0b[_0x45a5b7]={'$like':'%'+_0x1ecb8d[_0xfce2('0x30')][_0xfce2('0x38')]+'%'};return _0x3abf0b;})});}_0x279d9a=_[_0xfce2('0x3b')]({},_0x279d9a,_0x1ecb8d['options']);return db['JscriptyAnswerReport']['count']({'where':_0x279d9a['where']})[_0xfce2('0x23')](function(_0x16a6f0){_0x3fb980[_0xfce2('0x1d')]=_0x16a6f0;if(_0x1ecb8d['query'][_0xfce2('0x3c')]){_0x279d9a[_0xfce2('0x3d')]=[{'all':!![]}];}return db[_0xfce2('0x5a')][_0xfce2('0x5c')](_0x279d9a);})[_0xfce2('0x23')](function(_0x2042b1){_0x3fb980[_0xfce2('0x3e')]=_0x2042b1;return _0x3fb980;});}})[_0xfce2('0x23')](respondWithFilteredResult(_0x38040c,_0x279d9a))[_0xfce2('0x3f')](handleError(_0x38040c,null));};function char(_0x49ecd5){return _0xfce2('0x5d')===typeof _0x49ecd5?String[_0xfce2('0x5e')]['apply'](null,arguments):_0x49ecd5;}function needsEncapsulation(_0x439b22){return!!_0x439b22&&(_0x439b22[_0xfce2('0x5f')]()[_0xfce2('0x60')](char(0xd))>=0x0||_0x439b22[_0xfce2('0x5f')]()[_0xfce2('0x60')](char(0xa))>=0x0||_0x439b22[_0xfce2('0x5f')]()[_0xfce2('0x60')](char(0x2c))>=0x0||_0x439b22['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x168f40){var _0x17fdad=char(0x22),_0x5beb35='\x5c'+char(0x22),_0x35593a=_0x168f40[_0xfce2('0x5f')]()[_0xfce2('0x61')](new RegExp(_0x17fdad,'g'),_0x5beb35);return _0x17fdad+_0x35593a+_0x17fdad;}exports[_0xfce2('0x62')]=function(_0x5524de,_0x4bccb1,_0x14369b){var _0x23dd03,_0x3ff3a7;var _0x3d44c4={'where':{'ProjectId':_0x5524de['params']['id']}};if(_0x5524de[_0xfce2('0x30')]['startTime']){_0x3d44c4['where'][_0xfce2('0x63')]=JSON[_0xfce2('0x64')](_0x5524de[_0xfce2('0x30')][_0xfce2('0x65')]);}return db[_0xfce2('0x56')][_0xfce2('0x5c')](_0x3d44c4)[_0xfce2('0x23')](handleEntityNotFound(_0x4bccb1,null))[_0xfce2('0x23')](function(_0x1c94de){if(_0x1c94de){_0x23dd03=_0x1c94de;return db[_0xfce2('0x66')]['findAll']({'where':{'SessionId':{'$in':_[_0xfce2('0x2b')](_0x23dd03,'id')},'ProjectId':_0x5524de['params']['id']},'order':_0xfce2('0x67')});}})[_0xfce2('0x23')](handleEntityNotFound(_0x4bccb1,null))[_0xfce2('0x23')](function(_0x38062c){if(_0x38062c){_0x3ff3a7=_0x38062c;var _0x58c3b1={};for(var _0x4d1cf3=0x0,_0x58863f=_0x3ff3a7[_0xfce2('0x57')];_0x4d1cf3<_0x58863f;_0x4d1cf3++){if(!_0x58c3b1[_0xfce2('0x58')](_0x3ff3a7[_0x4d1cf3]['questionId'])){_0x58c3b1[_0x3ff3a7[_0x4d1cf3][_0xfce2('0x68')]]=needsEncapsulation(_0x3ff3a7[_0x4d1cf3][_0xfce2('0x69')])?encapsulate(_0x3ff3a7[_0x4d1cf3][_0xfce2('0x69')]):_0x3ff3a7[_0x4d1cf3]['question'];}}var _0x3e5992=[],_0x28a533={};for(var _0x527581=0x0,_0x5d7978=_0x23dd03['length'];_0x527581<_0x5d7978;_0x527581++){_0x28a533={'ProjectId':_0x5524de[_0xfce2('0x41')]['id'],'SessionId':_0x23dd03[_0x527581]['id'],'StartTime':moment(_0x23dd03[_0x527581]['starttime'])[_0xfce2('0x6a')](_0xfce2('0x6b'))};for(var _0x4fa0c3=0x0,_0x2015ce=_0x3ff3a7[_0xfce2('0x57')];_0x4fa0c3<_0x2015ce;_0x4fa0c3++){if(_0x3ff3a7[_0x4fa0c3]['SessionId']==_0x23dd03[_0x527581]['id']&&_0x58c3b1[_0xfce2('0x58')](_0x3ff3a7[_0x4fa0c3][_0xfce2('0x68')])){_0x28a533[_0x58c3b1[_0x3ff3a7[_0x4fa0c3][_0xfce2('0x68')]]]=_0x3ff3a7[_0x4fa0c3]['answer'];}}for(var _0x4a8660 in _0x58c3b1){if(!_0x28a533[_0xfce2('0x58')](_0x58c3b1[_0x4a8660])){_0x28a533[_0x58c3b1[_0x4a8660]]=null;}}_0x3e5992['push'](_0x28a533);}return _0x3e5992;}})[_0xfce2('0x23')](function(_0x1137ec){if(!_['isEmpty'](_0x1137ec)){var _0x280f1b=toCsv(_0x1137ec);var _0x5c1664=Date[_0xfce2('0x6c')]();fs['writeFileSync'](util[_0xfce2('0x6a')](_0xfce2('0x6d'),_0x5524de[_0xfce2('0x41')]['id'],_0x5c1664),_0x280f1b);_0x4bccb1['setHeader'](_0xfce2('0x6e'),_0xfce2('0x6f')+util[_0xfce2('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x5524de[_0xfce2('0x41')]['id'],_0x5c1664));_0x4bccb1[_0xfce2('0x70')](_0xfce2('0x71'),_0xfce2('0x72'));return _0x4bccb1[_0xfce2('0x73')](util[_0xfce2('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5524de['params']['id'],_0x5c1664));}else{return _0x4bccb1['sendStatus'](0xcc);}})[_0xfce2('0x3f')](handleError(_0x4bccb1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9eadaf4..6baf639 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 _0xafca=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x39a61c,_0x2e9d12){var _0x519a59=function(_0x4de40c){while(--_0x4de40c){_0x39a61c['push'](_0x39a61c['shift']());}};_0x519a59(++_0x2e9d12);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaafc('0x0'));var util=require('util');var logger=require(_0xaafc('0x1'))(_0xaafc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaafc('0x3'));var fs=require('fs');var path=require(_0xaafc('0x4'));var rimraf=require(_0xaafc('0x5'));var config=require(_0xaafc('0x6'));var attributes=require(_0xaafc('0x7'));module['exports']=function(_0x3db4ed,_0x418fca){return _0x3db4ed[_0xaafc('0x8')](_0xaafc('0x9'),attributes,{'tableName':_0xaafc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb13b=['api','moment','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x2c1c3b,_0x46d3e1){var _0xb8b34a=function(_0x1353e5){while(--_0x1353e5){_0x2c1c3b['push'](_0x2c1c3b['shift']());}};_0xb8b34a(++_0x46d3e1);}(_0xb13b,0x1de));var _0xbb13=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb13b[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var logger=require(_0xbb13('0x2'))(_0xbb13('0x3'));var moment=require(_0xbb13('0x4'));var BPromise=require('bluebird');var rp=require(_0xbb13('0x5'));var fs=require('fs');var path=require(_0xbb13('0x6'));var rimraf=require('rimraf');var config=require(_0xbb13('0x7'));var attributes=require(_0xbb13('0x8'));module[_0xbb13('0x9')]=function(_0x464c50,_0x296632){return _0x464c50[_0xbb13('0xa')](_0xbb13('0xb'),attributes,{'tableName':_0xbb13('0xc'),'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 98dc5d3..51470d0 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(_0x185f7f,_0x42aa8b){var _0x15d436=function(_0x581235){while(--_0x581235){_0x185f7f['push'](_0x185f7f['shift']());}};_0x15d436(++_0x42aa8b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4e1404,_0x581adb){_0x4e1404=_0x4e1404-0x0;var _0x589106=_0xf4eb[_0x4e1404];return _0x589106;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x519a6f,_0x52cb04){var _0x221793=function(_0x2da616){while(--_0x2da616){_0x519a6f['push'](_0x519a6f['shift']());}};_0x221793(++_0x52cb04);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2c38eb,_0x41336f){_0x2c38eb=_0x2c38eb-0x0;var _0x4f9808=_0xf4eb[_0x2c38eb];return _0x4f9808;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 741dbf6..c9c5a56 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 _0x4b5b=['../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x3e949f,_0x44f0f5){var _0x11320f=function(_0x4d6002){while(--_0x4d6002){_0x3e949f['push'](_0x3e949f['shift']());}};_0x11320f(++_0x44f0f5);}(_0x4b5b,0x1e9));var _0xb4b5=function(_0x5193ef,_0x4193b9){_0x5193ef=_0x5193ef-0x0;var _0x3f9c48=_0x4b5b[_0x5193ef];return _0x3f9c48;};'use strict';var multer=require('multer');var util=require(_0xb4b5('0x0'));var path=require(_0xb4b5('0x1'));var timeout=require(_0xb4b5('0x2'));var express=require(_0xb4b5('0x3'));var router=express['Router']();var fs_extra=require(_0xb4b5('0x4'));var auth=require(_0xb4b5('0x5'));var interaction=require(_0xb4b5('0x6'));var config=require('../../config/environment');var controller=require(_0xb4b5('0x7'));router['get']('/',auth[_0xb4b5('0x8')](),controller[_0xb4b5('0x9')]);router[_0xb4b5('0xa')]('/describe',auth[_0xb4b5('0x8')](),controller['describe']);router[_0xb4b5('0xa')]('/:id',auth[_0xb4b5('0x8')](),controller[_0xb4b5('0xb')]);router['post']('/',auth[_0xb4b5('0x8')](),controller[_0xb4b5('0xc')]);router[_0xb4b5('0xd')](_0xb4b5('0xe'),auth[_0xb4b5('0x8')](),controller[_0xb4b5('0xf')]);router[_0xb4b5('0x10')](_0xb4b5('0xe'),auth[_0xb4b5('0x8')](),controller[_0xb4b5('0x11')]);module[_0xb4b5('0x12')]=router; \ No newline at end of file +var _0x6a8d=['util','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x528038,_0x5a5b73){var _0x2296ce=function(_0x29c683){while(--_0x29c683){_0x528038['push'](_0x528038['shift']());}};_0x2296ce(++_0x5a5b73);}(_0x6a8d,0xfb));var _0xd6a8=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x6a8d[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0xd6a8('0x0'));var util=require(_0xd6a8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd6a8('0x2'));var router=express[_0xd6a8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd6a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd6a8('0x5'));var controller=require(_0xd6a8('0x6'));router[_0xd6a8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd6a8('0x7')](_0xd6a8('0x8'),auth[_0xd6a8('0x9')](),controller[_0xd6a8('0xa')]);router[_0xd6a8('0x7')]('/:id',auth[_0xd6a8('0x9')](),controller['show']);router[_0xd6a8('0xb')]('/',auth['isAuthenticated'](),controller[_0xd6a8('0xc')]);router['put'](_0xd6a8('0xd'),auth['isAuthenticated'](),controller[_0xd6a8('0xe')]);router[_0xd6a8('0xf')]('/:id',auth[_0xd6a8('0x9')](),controller[_0xd6a8('0x10')]);module[_0xd6a8('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 649e502..f0c0b9e 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x116309,_0xc1a6c2){_0x116309=_0x116309-0x0;var _0x220fb7=_0x7a54[_0x116309];return _0x220fb7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x526763,_0x3b87b0){_0x526763=_0x526763-0x0;var _0xbe4bf1=_0x7a54[_0x526763];return _0xbe4bf1;};'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 fd1c9c2..75508f0 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 _0xcb9c=['index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x41fd67,_0x333a8f){var _0x51e3ec=function(_0x18a5fc){while(--_0x18a5fc){_0x41fd67['push'](_0x41fd67['shift']());}};_0x51e3ec(++_0x333a8f);}(_0xcb9c,0x154));var _0xccb9=function(_0x3f33be,_0x43359b){_0x3f33be=_0x3f33be-0x0;var _0x53252f=_0xcb9c[_0x3f33be];return _0x53252f;};'use strict';var emlformat=require(_0xccb9('0x0'));var rimraf=require(_0xccb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccb9('0x2'));var rp=require(_0xccb9('0x3'));var moment=require(_0xccb9('0x4'));var BPromise=require(_0xccb9('0x5'));var Mustache=require('mustache');var util=require(_0xccb9('0x6'));var path=require(_0xccb9('0x7'));var sox=require(_0xccb9('0x8'));var csv=require(_0xccb9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccb9('0xa'));var _=require(_0xccb9('0xb'));var squel=require(_0xccb9('0xc'));var crypto=require('crypto');var jsforce=require(_0xccb9('0xd'));var deskjs=require(_0xccb9('0xe'));var toCsv=require(_0xccb9('0x9'));var querystring=require('querystring');var Papa=require(_0xccb9('0xf'));var Redis=require(_0xccb9('0x10'));var authService=require(_0xccb9('0x11'));var qs=require(_0xccb9('0x12'));var as=require(_0xccb9('0x13'));var hardwareService=require(_0xccb9('0x14'));var logger=require(_0xccb9('0x15'))(_0xccb9('0x16'));var utils=require('../../config/utils');var config=require(_0xccb9('0x17'));var licenseUtil=require(_0xccb9('0x18'));var db=require(_0xccb9('0x19'))['db'];function respondWithStatusCode(_0x57ed23,_0x107713){_0x107713=_0x107713||0xcc;return function(_0x1e22a0){if(_0x1e22a0){return _0x57ed23[_0xccb9('0x1a')](_0x107713);}return _0x57ed23[_0xccb9('0x1b')](_0x107713)[_0xccb9('0x1c')]();};}function respondWithResult(_0x776bb0,_0x289da2){_0x289da2=_0x289da2||0xc8;return function(_0x2f84a1){if(_0x2f84a1){return _0x776bb0[_0xccb9('0x1b')](_0x289da2)[_0xccb9('0x1d')](_0x2f84a1);}};}function respondWithFilteredResult(_0x3282f2,_0xfaa7ce){return function(_0x4629ae){if(_0x4629ae){var _0x5b8fc0=typeof _0xfaa7ce['offset']==='undefined'&&typeof _0xfaa7ce[_0xccb9('0x1e')]===_0xccb9('0x1f');var _0x55bce9=_0x4629ae[_0xccb9('0x20')];var _0x4f4756=_0x5b8fc0?0x0:_0xfaa7ce['offset'];var _0x41a32f=_0x5b8fc0?_0x4629ae['count']:_0xfaa7ce[_0xccb9('0x21')]+_0xfaa7ce['limit'];var _0x13dce9;if(_0x41a32f>=_0x55bce9){_0x41a32f=_0x55bce9;_0x13dce9=0xc8;}else{_0x13dce9=0xce;}_0x3282f2[_0xccb9('0x1b')](_0x13dce9);return _0x3282f2[_0xccb9('0x22')](_0xccb9('0x23'),_0x4f4756+'-'+_0x41a32f+'/'+_0x55bce9)[_0xccb9('0x1d')](_0x4629ae);}return null;};}function patchUpdates(_0x3613ce){return function(_0x5525b8){try{jsonpatch[_0xccb9('0x24')](_0x5525b8,_0x3613ce,!![]);}catch(_0x353882){return BPromise[_0xccb9('0x25')](_0x353882);}return _0x5525b8[_0xccb9('0x26')]();};}function saveUpdates(_0x12b5ae,_0x433e4a){return function(_0x3b7437){if(_0x3b7437){return _0x3b7437[_0xccb9('0x27')](_0x12b5ae)[_0xccb9('0x28')](function(_0x28933f){return _0x28933f;});}return null;};}function removeEntity(_0x3bfd35,_0x128e06){return function(_0x4b9046){if(_0x4b9046){return _0x4b9046[_0xccb9('0x29')]()[_0xccb9('0x28')](function(){_0x3bfd35['status'](0xcc)[_0xccb9('0x1c')]();});}};}function handleEntityNotFound(_0x22d8b6,_0x26758f){return function(_0x4dd036){if(!_0x4dd036){_0x22d8b6[_0xccb9('0x1a')](0x194);}return _0x4dd036;};}function handleError(_0x1cb764,_0x40f850){_0x40f850=_0x40f850||0x1f4;return function(_0x5cf6f4){logger[_0xccb9('0x2a')](_0x5cf6f4[_0xccb9('0x2b')]);if(_0x5cf6f4[_0xccb9('0x2c')]){delete _0x5cf6f4[_0xccb9('0x2c')];}_0x1cb764[_0xccb9('0x1b')](_0x40f850)['send'](_0x5cf6f4);};}exports[_0xccb9('0x2d')]=function(_0x314612,_0x1caaf5){var _0x2a774f={},_0x5e297f={},_0x3e0bdf={'count':0x0,'rows':[]};var _0x140f1f=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x8bd43c){return{'name':_0x8bd43c[_0xccb9('0x2e')],'type':_0x8bd43c[_0xccb9('0x2f')]['key']};});_0x5e297f[_0xccb9('0x30')]=_[_0xccb9('0x31')](_0x140f1f,_0xccb9('0x2c'));_0x5e297f['query']=_['keys'](_0x314612[_0xccb9('0x32')]);_0x5e297f[_0xccb9('0x33')]=_[_0xccb9('0x34')](_0x5e297f[_0xccb9('0x30')],_0x5e297f[_0xccb9('0x32')]);_0x2a774f[_0xccb9('0x35')]=_['intersection'](_0x5e297f['model'],qs[_0xccb9('0x36')](_0x314612[_0xccb9('0x32')][_0xccb9('0x36')]));_0x2a774f[_0xccb9('0x35')]=_0x2a774f[_0xccb9('0x35')][_0xccb9('0x37')]?_0x2a774f[_0xccb9('0x35')]:_0x5e297f['model'];if(!_0x314612[_0xccb9('0x32')]['hasOwnProperty'](_0xccb9('0x38'))){_0x2a774f['limit']=qs['limit'](_0x314612[_0xccb9('0x32')][_0xccb9('0x1e')]);_0x2a774f[_0xccb9('0x21')]=qs[_0xccb9('0x21')](_0x314612['query'][_0xccb9('0x21')]);}_0x2a774f[_0xccb9('0x39')]=qs[_0xccb9('0x3a')](_0x314612[_0xccb9('0x32')]['sort']);_0x2a774f[_0xccb9('0x3b')]=qs[_0xccb9('0x33')](_[_0xccb9('0x3c')](_0x314612[_0xccb9('0x32')],_0x5e297f[_0xccb9('0x33')]),_0x140f1f);if(_0x314612[_0xccb9('0x32')][_0xccb9('0x3d')]){_0x2a774f['where']=_[_0xccb9('0x3e')](_0x2a774f[_0xccb9('0x3b')],{'$or':_['map'](_0x140f1f,function(_0x2f5b3e){if(_0x2f5b3e[_0xccb9('0x2f')]!==_0xccb9('0x3f')){var _0x50772b={};_0x50772b[_0x2f5b3e[_0xccb9('0x2c')]]={'$like':'%'+_0x314612[_0xccb9('0x32')][_0xccb9('0x3d')]+'%'};return _0x50772b;}})});}_0x2a774f=_[_0xccb9('0x3e')]({},_0x2a774f,_0x314612[_0xccb9('0x40')]);var _0x2ff776={'where':_0x2a774f['where']};return db[_0xccb9('0x41')][_0xccb9('0x20')](_0x2ff776)['then'](function(_0x19d372){_0x3e0bdf[_0xccb9('0x20')]=_0x19d372;if(_0x314612[_0xccb9('0x32')][_0xccb9('0x42')]){_0x2a774f[_0xccb9('0x43')]=[{'all':!![]}];}return db[_0xccb9('0x41')]['findAll'](_0x2a774f);})[_0xccb9('0x28')](function(_0x2de528){_0x3e0bdf[_0xccb9('0x44')]=_0x2de528;return _0x3e0bdf;})[_0xccb9('0x28')](respondWithFilteredResult(_0x1caaf5,_0x2a774f))[_0xccb9('0x45')](handleError(_0x1caaf5,null));};exports[_0xccb9('0x46')]=function(_0x1242ff,_0x2a8381){var _0x42f760={'raw':!![],'where':{'id':_0x1242ff['params']['id']}},_0x436520={};_0x436520[_0xccb9('0x30')]=_['keys'](db[_0xccb9('0x41')][_0xccb9('0x47')]);_0x436520['query']=_['keys'](_0x1242ff[_0xccb9('0x32')]);_0x436520[_0xccb9('0x33')]=_[_0xccb9('0x34')](_0x436520[_0xccb9('0x30')],_0x436520['query']);_0x42f760['attributes']=_['intersection'](_0x436520[_0xccb9('0x30')],qs[_0xccb9('0x36')](_0x1242ff['query'][_0xccb9('0x36')]));_0x42f760[_0xccb9('0x35')]=_0x42f760[_0xccb9('0x35')]['length']?_0x42f760[_0xccb9('0x35')]:_0x436520[_0xccb9('0x30')];if(_0x1242ff[_0xccb9('0x32')][_0xccb9('0x42')]){_0x42f760[_0xccb9('0x43')]=[{'all':!![]}];}_0x42f760=_[_0xccb9('0x3e')]({},_0x42f760,_0x1242ff['options']);return db[_0xccb9('0x41')][_0xccb9('0x48')](_0x42f760)['then'](handleEntityNotFound(_0x2a8381,null))[_0xccb9('0x28')](respondWithResult(_0x2a8381,null))['catch'](handleError(_0x2a8381,null));};exports[_0xccb9('0x49')]=function(_0x4b82f8,_0x19440f){return db['JscriptyQuestionReport'][_0xccb9('0x49')](_0x4b82f8['body'],{})[_0xccb9('0x28')](respondWithResult(_0x19440f,0xc9))['catch'](handleError(_0x19440f,null));};exports[_0xccb9('0x27')]=function(_0xa0eeef,_0x35ff6b){if(_0xa0eeef[_0xccb9('0x4a')]['id']){delete _0xa0eeef['body']['id'];}return db[_0xccb9('0x41')][_0xccb9('0x48')]({'where':{'id':_0xa0eeef[_0xccb9('0x4b')]['id']}})[_0xccb9('0x28')](handleEntityNotFound(_0x35ff6b,null))[_0xccb9('0x28')](saveUpdates(_0xa0eeef[_0xccb9('0x4a')],null))[_0xccb9('0x28')](respondWithResult(_0x35ff6b,null))[_0xccb9('0x45')](handleError(_0x35ff6b,null));};exports['destroy']=function(_0x3a3d7c,_0x41b676){return db[_0xccb9('0x41')][_0xccb9('0x48')]({'where':{'id':_0x3a3d7c[_0xccb9('0x4b')]['id']}})[_0xccb9('0x28')](handleEntityNotFound(_0x41b676,null))[_0xccb9('0x28')](removeEntity(_0x41b676,null))[_0xccb9('0x45')](handleError(_0x41b676,null));};exports[_0xccb9('0x4c')]=function(_0x479928,_0x5c2e13){return db[_0xccb9('0x41')][_0xccb9('0x4c')]()[_0xccb9('0x28')](respondWithResult(_0x5c2e13,null))['catch'](handleError(_0x5c2e13,null));}; \ No newline at end of file +var _0x09c0=['destroy','end','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x09c0,0x14b));var _0x009c=function(_0x4416ca,_0x20844a){_0x4416ca=_0x4416ca-0x0;var _0x56c1e0=_0x09c0[_0x4416ca];return _0x56c1e0;};'use strict';var emlformat=require(_0x009c('0x0'));var rimraf=require(_0x009c('0x1'));var zipdir=require(_0x009c('0x2'));var jsonpatch=require(_0x009c('0x3'));var rp=require(_0x009c('0x4'));var moment=require(_0x009c('0x5'));var BPromise=require(_0x009c('0x6'));var Mustache=require(_0x009c('0x7'));var util=require(_0x009c('0x8'));var path=require(_0x009c('0x9'));var sox=require(_0x009c('0xa'));var csv=require(_0x009c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x009c('0xc'));var _=require(_0x009c('0xd'));var squel=require('squel');var crypto=require(_0x009c('0xe'));var jsforce=require(_0x009c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x009c('0xb'));var querystring=require(_0x009c('0x10'));var Papa=require(_0x009c('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x009c('0x12'));var as=require(_0x009c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x009c('0x14'));var utils=require('../../config/utils');var config=require(_0x009c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x009c('0x16'))['db'];function respondWithStatusCode(_0x497eb4,_0xa1af2c){_0xa1af2c=_0xa1af2c||0xcc;return function(_0x416976){if(_0x416976){return _0x497eb4['sendStatus'](_0xa1af2c);}return _0x497eb4[_0x009c('0x17')](_0xa1af2c)['end']();};}function respondWithResult(_0x461e47,_0x55d7d2){_0x55d7d2=_0x55d7d2||0xc8;return function(_0x14ef0e){if(_0x14ef0e){return _0x461e47[_0x009c('0x17')](_0x55d7d2)[_0x009c('0x18')](_0x14ef0e);}};}function respondWithFilteredResult(_0x24491e,_0x36c23c){return function(_0x59fee3){if(_0x59fee3){var _0x52c5c3=typeof _0x36c23c[_0x009c('0x19')]===_0x009c('0x1a')&&typeof _0x36c23c[_0x009c('0x1b')]===_0x009c('0x1a');var _0x25b23a=_0x59fee3['count'];var _0x21a60b=_0x52c5c3?0x0:_0x36c23c[_0x009c('0x19')];var _0x21d12e=_0x52c5c3?_0x59fee3[_0x009c('0x1c')]:_0x36c23c['offset']+_0x36c23c[_0x009c('0x1b')];var _0xdff95d;if(_0x21d12e>=_0x25b23a){_0x21d12e=_0x25b23a;_0xdff95d=0xc8;}else{_0xdff95d=0xce;}_0x24491e['status'](_0xdff95d);return _0x24491e[_0x009c('0x1d')](_0x009c('0x1e'),_0x21a60b+'-'+_0x21d12e+'/'+_0x25b23a)[_0x009c('0x18')](_0x59fee3);}return null;};}function patchUpdates(_0x5a063){return function(_0x12e311){try{jsonpatch['apply'](_0x12e311,_0x5a063,!![]);}catch(_0x45471c){return BPromise[_0x009c('0x1f')](_0x45471c);}return _0x12e311[_0x009c('0x20')]();};}function saveUpdates(_0x367354,_0x422c30){return function(_0x1a0921){if(_0x1a0921){return _0x1a0921['update'](_0x367354)[_0x009c('0x21')](function(_0xc0f54b){return _0xc0f54b;});}return null;};}function removeEntity(_0x196fef,_0x4defa1){return function(_0x50906f){if(_0x50906f){return _0x50906f[_0x009c('0x22')]()[_0x009c('0x21')](function(){_0x196fef[_0x009c('0x17')](0xcc)[_0x009c('0x23')]();});}};}function handleEntityNotFound(_0xcec8ba,_0x58efb3){return function(_0x8743e4){if(!_0x8743e4){_0xcec8ba['sendStatus'](0x194);}return _0x8743e4;};}function handleError(_0x1fea81,_0x44a851){_0x44a851=_0x44a851||0x1f4;return function(_0x527cf){logger['error'](_0x527cf[_0x009c('0x24')]);if(_0x527cf[_0x009c('0x25')]){delete _0x527cf[_0x009c('0x25')];}_0x1fea81['status'](_0x44a851)[_0x009c('0x26')](_0x527cf);};}exports[_0x009c('0x27')]=function(_0x4f9ff6,_0x14f7ab){var _0x532f5d={},_0x10071c={},_0x19e28e={'count':0x0,'rows':[]};var _0x493b00=_[_0x009c('0x28')](db[_0x009c('0x29')][_0x009c('0x2a')],function(_0x1004e6){return{'name':_0x1004e6[_0x009c('0x2b')],'type':_0x1004e6[_0x009c('0x2c')]['key']};});_0x10071c[_0x009c('0x2d')]=_[_0x009c('0x28')](_0x493b00,'name');_0x10071c[_0x009c('0x2e')]=_['keys'](_0x4f9ff6[_0x009c('0x2e')]);_0x10071c['filters']=_['intersection'](_0x10071c[_0x009c('0x2d')],_0x10071c[_0x009c('0x2e')]);_0x532f5d['attributes']=_[_0x009c('0x2f')](_0x10071c[_0x009c('0x2d')],qs[_0x009c('0x30')](_0x4f9ff6[_0x009c('0x2e')][_0x009c('0x30')]));_0x532f5d[_0x009c('0x31')]=_0x532f5d[_0x009c('0x31')][_0x009c('0x32')]?_0x532f5d['attributes']:_0x10071c[_0x009c('0x2d')];if(!_0x4f9ff6['query'][_0x009c('0x33')](_0x009c('0x34'))){_0x532f5d[_0x009c('0x1b')]=qs[_0x009c('0x1b')](_0x4f9ff6[_0x009c('0x2e')][_0x009c('0x1b')]);_0x532f5d[_0x009c('0x19')]=qs[_0x009c('0x19')](_0x4f9ff6['query']['offset']);}_0x532f5d['order']=qs[_0x009c('0x35')](_0x4f9ff6[_0x009c('0x2e')]['sort']);_0x532f5d[_0x009c('0x36')]=qs[_0x009c('0x37')](_[_0x009c('0x38')](_0x4f9ff6[_0x009c('0x2e')],_0x10071c[_0x009c('0x37')]),_0x493b00);if(_0x4f9ff6[_0x009c('0x2e')][_0x009c('0x39')]){_0x532f5d[_0x009c('0x36')]=_[_0x009c('0x3a')](_0x532f5d[_0x009c('0x36')],{'$or':_['map'](_0x493b00,function(_0x4f6cf5){if(_0x4f6cf5[_0x009c('0x2c')]!=='VIRTUAL'){var _0x3d2e65={};_0x3d2e65[_0x4f6cf5[_0x009c('0x25')]]={'$like':'%'+_0x4f9ff6[_0x009c('0x2e')][_0x009c('0x39')]+'%'};return _0x3d2e65;}})});}_0x532f5d=_[_0x009c('0x3a')]({},_0x532f5d,_0x4f9ff6[_0x009c('0x3b')]);var _0x399b83={'where':_0x532f5d[_0x009c('0x36')]};return db['JscriptyQuestionReport'][_0x009c('0x1c')](_0x399b83)[_0x009c('0x21')](function(_0x26c39a){_0x19e28e[_0x009c('0x1c')]=_0x26c39a;if(_0x4f9ff6['query'][_0x009c('0x3c')]){_0x532f5d[_0x009c('0x3d')]=[{'all':!![]}];}return db[_0x009c('0x29')][_0x009c('0x3e')](_0x532f5d);})[_0x009c('0x21')](function(_0x5398d6){_0x19e28e[_0x009c('0x3f')]=_0x5398d6;return _0x19e28e;})[_0x009c('0x21')](respondWithFilteredResult(_0x14f7ab,_0x532f5d))[_0x009c('0x40')](handleError(_0x14f7ab,null));};exports[_0x009c('0x41')]=function(_0xdb6a1a,_0x38faeb){var _0xc99ce8={'raw':!![],'where':{'id':_0xdb6a1a[_0x009c('0x42')]['id']}},_0x34c9e5={};_0x34c9e5['model']=_[_0x009c('0x43')](db[_0x009c('0x29')]['rawAttributes']);_0x34c9e5['query']=_[_0x009c('0x43')](_0xdb6a1a[_0x009c('0x2e')]);_0x34c9e5['filters']=_['intersection'](_0x34c9e5[_0x009c('0x2d')],_0x34c9e5[_0x009c('0x2e')]);_0xc99ce8[_0x009c('0x31')]=_[_0x009c('0x2f')](_0x34c9e5['model'],qs[_0x009c('0x30')](_0xdb6a1a[_0x009c('0x2e')]['fields']));_0xc99ce8[_0x009c('0x31')]=_0xc99ce8[_0x009c('0x31')][_0x009c('0x32')]?_0xc99ce8[_0x009c('0x31')]:_0x34c9e5['model'];if(_0xdb6a1a[_0x009c('0x2e')][_0x009c('0x3c')]){_0xc99ce8[_0x009c('0x3d')]=[{'all':!![]}];}_0xc99ce8=_[_0x009c('0x3a')]({},_0xc99ce8,_0xdb6a1a['options']);return db[_0x009c('0x29')][_0x009c('0x44')](_0xc99ce8)[_0x009c('0x21')](handleEntityNotFound(_0x38faeb,null))[_0x009c('0x21')](respondWithResult(_0x38faeb,null))['catch'](handleError(_0x38faeb,null));};exports[_0x009c('0x45')]=function(_0x123070,_0x272ead){return db[_0x009c('0x29')]['create'](_0x123070[_0x009c('0x46')],{})[_0x009c('0x21')](respondWithResult(_0x272ead,0xc9))[_0x009c('0x40')](handleError(_0x272ead,null));};exports[_0x009c('0x47')]=function(_0x19d1b6,_0x3d5d0b){if(_0x19d1b6['body']['id']){delete _0x19d1b6['body']['id'];}return db[_0x009c('0x29')][_0x009c('0x44')]({'where':{'id':_0x19d1b6[_0x009c('0x42')]['id']}})[_0x009c('0x21')](handleEntityNotFound(_0x3d5d0b,null))[_0x009c('0x21')](saveUpdates(_0x19d1b6[_0x009c('0x46')],null))['then'](respondWithResult(_0x3d5d0b,null))[_0x009c('0x40')](handleError(_0x3d5d0b,null));};exports[_0x009c('0x22')]=function(_0x5afc9e,_0x45f3f8){return db['JscriptyQuestionReport'][_0x009c('0x44')]({'where':{'id':_0x5afc9e['params']['id']}})[_0x009c('0x21')](handleEntityNotFound(_0x45f3f8,null))[_0x009c('0x21')](removeEntity(_0x45f3f8,null))[_0x009c('0x40')](handleError(_0x45f3f8,null));};exports[_0x009c('0x48')]=function(_0x417aa4,_0x406b96){return db[_0x009c('0x29')][_0x009c('0x48')]()[_0x009c('0x21')](respondWithResult(_0x406b96,null))['catch'](handleError(_0x406b96,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 6087935..8da2cbf 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 _0x6fde=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x3dd3c4,_0xa1a82d){var _0x2b00a7=function(_0x45ea63){while(--_0x45ea63){_0x3dd3c4['push'](_0x3dd3c4['shift']());}};_0x2b00a7(++_0xa1a82d);}(_0x6fde,0x108));var _0xe6fd=function(_0x4f7b43,_0x119c22){_0x4f7b43=_0x4f7b43-0x0;var _0x2fcdf3=_0x6fde[_0x4f7b43];return _0x2fcdf3;};'use strict';var _=require(_0xe6fd('0x0'));var util=require(_0xe6fd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe6fd('0x2'));var BPromise=require(_0xe6fd('0x3'));var rp=require(_0xe6fd('0x4'));var fs=require('fs');var path=require(_0xe6fd('0x5'));var rimraf=require(_0xe6fd('0x6'));var config=require(_0xe6fd('0x7'));var attributes=require(_0xe6fd('0x8'));module['exports']=function(_0x231953,_0x4d5a7f){return _0x231953[_0xe6fd('0x9')](_0xe6fd('0xa'),attributes,{'tableName':_0xe6fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fb=['./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x27dc6f,_0x5dbea8){var _0x461137=function(_0x406252){while(--_0x406252){_0x27dc6f['push'](_0x27dc6f['shift']());}};_0x461137(++_0x5dbea8);}(_0xc4fb,0x160));var _0xbc4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbc4f('0x0'));var util=require(_0xbc4f('0x1'));var logger=require(_0xbc4f('0x2'))(_0xbc4f('0x3'));var moment=require(_0xbc4f('0x4'));var BPromise=require('bluebird');var rp=require(_0xbc4f('0x5'));var fs=require('fs');var path=require(_0xbc4f('0x6'));var rimraf=require('rimraf');var config=require(_0xbc4f('0x7'));var attributes=require(_0xbc4f('0x8'));module[_0xbc4f('0x9')]=function(_0x1de441,_0x198962){return _0x1de441[_0xbc4f('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0xbc4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 3805b97..8c9f8e5 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 _0x3207=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x30bf58,_0x34319f){var _0x1aec82=function(_0x429f8d){while(--_0x429f8d){_0x30bf58['push'](_0x30bf58['shift']());}};_0x1aec82(++_0x34319f);}(_0x3207,0x13e));var _0x7320=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x3207[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0x7320('0x0'));var util=require('util');var moment=require(_0x7320('0x1'));var BPromise=require('bluebird');var rs=require(_0x7320('0x2'));var fs=require('fs');var Redis=require(_0x7320('0x3'));var db=require(_0x7320('0x4'))['db'];var utils=require(_0x7320('0x5'));var logger=require(_0x7320('0x6'))(_0x7320('0x7'));var config=require('../../config/environment');var jayson=require(_0x7320('0x8'));var client=jayson[_0x7320('0x9')][_0x7320('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x299d45,_0xe7f893,_0x27dba9){return new BPromise(function(_0x351928,_0x35afbd){return client['request'](_0x299d45,_0x27dba9)[_0x7320('0xb')](function(_0x51f872){logger[_0x7320('0xc')](_0x7320('0xd'),_0xe7f893,_0x7320('0xe'));logger[_0x7320('0xf')](_0x7320('0x10'),_0xe7f893,_0x7320('0xe'),JSON[_0x7320('0x11')](_0x51f872));if(_0x51f872['error']){if(_0x51f872['error'][_0x7320('0x12')]===0x1f4){logger[_0x7320('0x13')](_0x7320('0xd'),_0xe7f893,_0x51f872[_0x7320('0x13')]['message']);return _0x35afbd(_0x51f872['error'][_0x7320('0x14')]);}logger[_0x7320('0x13')](_0x7320('0xd'),_0xe7f893,_0x51f872[_0x7320('0x13')][_0x7320('0x14')]);return _0x351928(_0x51f872[_0x7320('0x13')][_0x7320('0x14')]);}else{logger[_0x7320('0xc')](_0x7320('0xd'),_0xe7f893,_0x7320('0xe'));_0x351928(_0x51f872[_0x7320('0x15')]['message']);}})[_0x7320('0x16')](function(_0x4ae31c){logger[_0x7320('0x13')](_0x7320('0xd'),_0xe7f893,_0x4ae31c);_0x35afbd(_0x4ae31c);});});} \ No newline at end of file +var _0x3ed3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x174af8,_0x4416b5){var _0x56b0a1=function(_0x5f3472){while(--_0x5f3472){_0x174af8['push'](_0x174af8['shift']());}};_0x56b0a1(++_0x4416b5);}(_0x3ed3,0x10e));var _0x33ed=function(_0x4b3ae2,_0x3da532){_0x4b3ae2=_0x4b3ae2-0x0;var _0x4e9a2f=_0x3ed3[_0x4b3ae2];return _0x4e9a2f;};'use strict';var _=require(_0x33ed('0x0'));var util=require(_0x33ed('0x1'));var moment=require(_0x33ed('0x2'));var BPromise=require(_0x33ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33ed('0x4'));var db=require(_0x33ed('0x5'))['db'];var utils=require(_0x33ed('0x6'));var logger=require(_0x33ed('0x7'))(_0x33ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x33ed('0x9'));var client=jayson[_0x33ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37119c,_0x31497e,_0xf4c129){return new BPromise(function(_0x2fa1ed,_0x79d39){return client['request'](_0x37119c,_0xf4c129)[_0x33ed('0xb')](function(_0x31f758){logger[_0x33ed('0xc')](_0x33ed('0xd'),_0x31497e,_0x33ed('0xe'));logger[_0x33ed('0xf')](_0x33ed('0x10'),_0x31497e,_0x33ed('0xe'),JSON['stringify'](_0x31f758));if(_0x31f758[_0x33ed('0x11')]){if(_0x31f758[_0x33ed('0x11')]['code']===0x1f4){logger[_0x33ed('0x11')](_0x33ed('0xd'),_0x31497e,_0x31f758[_0x33ed('0x11')][_0x33ed('0x12')]);return _0x79d39(_0x31f758['error'][_0x33ed('0x12')]);}logger[_0x33ed('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x31497e,_0x31f758[_0x33ed('0x11')][_0x33ed('0x12')]);return _0x2fa1ed(_0x31f758[_0x33ed('0x11')]['message']);}else{logger['info'](_0x33ed('0xd'),_0x31497e,'request\x20sent');_0x2fa1ed(_0x31f758[_0x33ed('0x13')]['message']);}})[_0x33ed('0x14')](function(_0x48f9af){logger['error'](_0x33ed('0xd'),_0x31497e,_0x48f9af);_0x79d39(_0x48f9af);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1947ca9..f271d53 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 _0x2f62=['../../config/environment','./jscriptySessionReport.controller','index','/describe','isAuthenticated','get','/:id','show','/:id/questions','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x496590,_0x3426e9){var _0x585ebc=function(_0x5a3f53){while(--_0x5a3f53){_0x496590['push'](_0x496590['shift']());}};_0x585ebc(++_0x3426e9);}(_0x2f62,0x8e));var _0x22f6=function(_0xa6edfa,_0x35b61b){_0xa6edfa=_0xa6edfa-0x0;var _0x42799e=_0x2f62[_0xa6edfa];return _0x42799e;};'use strict';var multer=require('multer');var util=require(_0x22f6('0x0'));var path=require('path');var timeout=require(_0x22f6('0x1'));var express=require(_0x22f6('0x2'));var router=express[_0x22f6('0x3')]();var fs_extra=require(_0x22f6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22f6('0x5'));var controller=require(_0x22f6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x22f6('0x7')]);router['get'](_0x22f6('0x8'),auth[_0x22f6('0x9')](),controller['describe']);router[_0x22f6('0xa')](_0x22f6('0xb'),auth[_0x22f6('0x9')](),controller[_0x22f6('0xc')]);router[_0x22f6('0xa')](_0x22f6('0xd'),auth[_0x22f6('0x9')](),controller['getQuestions']);router[_0x22f6('0xe')]('/',auth[_0x22f6('0x9')](),controller[_0x22f6('0xf')]);router[_0x22f6('0x10')](_0x22f6('0xb'),auth[_0x22f6('0x9')](),controller[_0x22f6('0x11')]);router[_0x22f6('0x12')](_0x22f6('0xb'),auth[_0x22f6('0x9')](),controller[_0x22f6('0x13')]);module[_0x22f6('0x14')]=router; \ No newline at end of file +var _0xfbc1=['Router','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xfbc1,0x1b1));var _0x1fbc=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0xfbc1[_0x15b380];return _0x232c5c;};'use strict';var multer=require('multer');var util=require(_0x1fbc('0x0'));var path=require(_0x1fbc('0x1'));var timeout=require(_0x1fbc('0x2'));var express=require(_0x1fbc('0x3'));var router=express[_0x1fbc('0x4')]();var fs_extra=require(_0x1fbc('0x5'));var auth=require(_0x1fbc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1fbc('0x7'));router[_0x1fbc('0x8')]('/',auth[_0x1fbc('0x9')](),controller[_0x1fbc('0xa')]);router[_0x1fbc('0x8')](_0x1fbc('0xb'),auth['isAuthenticated'](),controller[_0x1fbc('0xc')]);router[_0x1fbc('0x8')](_0x1fbc('0xd'),auth[_0x1fbc('0x9')](),controller[_0x1fbc('0xe')]);router['get'](_0x1fbc('0xf'),auth[_0x1fbc('0x9')](),controller[_0x1fbc('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1fbc('0x11')]);router[_0x1fbc('0x12')](_0x1fbc('0xd'),auth['isAuthenticated'](),controller[_0x1fbc('0x13')]);router[_0x1fbc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x1fbc('0x15')]);module[_0x1fbc('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 7688b64..71ff52c 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 _0x10dc=['moment','sequelize','exports','DATE','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x10dc,0x90));var _0xc10d=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x10dc[_0x513545];return _0x18b7c5;};'use strict';var moment=require(_0xc10d('0x0'));var Sequelize=require(_0xc10d('0x1'));module[_0xc10d('0x2')]={'starttime':{'type':Sequelize[_0xc10d('0x3')],'set':function(_0x477c24){this['setDataValue']('starttime',_0x477c24);this['setDataValue'](_0xc10d('0x4'),moment()[_0xc10d('0x5')](_0xc10d('0x6')));}},'endtime':{'type':Sequelize[_0xc10d('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xc10d('0x7')]},'queue':{'type':Sequelize[_0xc10d('0x7')]},'uniqueid':{'type':Sequelize[_0xc10d('0x7')]},'calleridname':{'type':Sequelize[_0xc10d('0x7')]},'calleridnum':{'type':Sequelize[_0xc10d('0x7')]},'completed':{'type':Sequelize[_0xc10d('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xe22e=['STRING','moment','sequelize','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xe22e,0x1b9));var _0xee22=function(_0x3131c4,_0x5df24e){_0x3131c4=_0x3131c4-0x0;var _0x5347db=_0xe22e[_0x3131c4];return _0x5347db;};'use strict';var moment=require(_0xee22('0x0'));var Sequelize=require(_0xee22('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xee22('0x2')],'set':function(_0x4ac74f){this[_0xee22('0x3')](_0xee22('0x4'),_0x4ac74f);this[_0xee22('0x3')](_0xee22('0x5'),moment()['format'](_0xee22('0x6')));}},'endtime':{'type':Sequelize[_0xee22('0x2')]},'membername':{'type':Sequelize[_0xee22('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xee22('0x7')]},'uniqueid':{'type':Sequelize[_0xee22('0x7')]},'calleridname':{'type':Sequelize[_0xee22('0x7')]},'calleridnum':{'type':Sequelize[_0xee22('0x7')]},'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 a4b9fb8..b2c7203 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 _0xab51=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','describe','findOne','JscriptyQuestionReport','nolimit','pick','SessionId','findAll','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis'];(function(_0x3c01ad,_0x13b391){var _0x1bafec=function(_0x3e7a46){while(--_0x3e7a46){_0x3c01ad['push'](_0x3c01ad['shift']());}};_0x1bafec(++_0x13b391);}(_0xab51,0x89));var _0x1ab5=function(_0x30b4be,_0x5918ae){_0x30b4be=_0x30b4be-0x0;var _0x410e33=_0xab51[_0x30b4be];return _0x410e33;};'use strict';var emlformat=require(_0x1ab5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1ab5('0x1'));var rp=require(_0x1ab5('0x2'));var moment=require(_0x1ab5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1ab5('0x4'));var util=require(_0x1ab5('0x5'));var path=require(_0x1ab5('0x6'));var sox=require(_0x1ab5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ab5('0x8'));var _=require(_0x1ab5('0x9'));var squel=require('squel');var crypto=require(_0x1ab5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1ab5('0xb'));var toCsv=require(_0x1ab5('0xc'));var querystring=require(_0x1ab5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1ab5('0xe'));var authService=require(_0x1ab5('0xf'));var qs=require(_0x1ab5('0x10'));var as=require(_0x1ab5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ab5('0x12'))(_0x1ab5('0x13'));var utils=require(_0x1ab5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1ab5('0x15'));var db=require(_0x1ab5('0x16'))['db'];function respondWithStatusCode(_0x2a52d4,_0x1794e6){_0x1794e6=_0x1794e6||0xcc;return function(_0x1d374b){if(_0x1d374b){return _0x2a52d4[_0x1ab5('0x17')](_0x1794e6);}return _0x2a52d4[_0x1ab5('0x18')](_0x1794e6)[_0x1ab5('0x19')]();};}function respondWithResult(_0x2b7086,_0x2cbc47){_0x2cbc47=_0x2cbc47||0xc8;return function(_0x4c3480){if(_0x4c3480){return _0x2b7086[_0x1ab5('0x18')](_0x2cbc47)[_0x1ab5('0x1a')](_0x4c3480);}};}function respondWithFilteredResult(_0x23d26c,_0x436969){return function(_0x4fbaad){if(_0x4fbaad){var _0x41b6c0=typeof _0x436969[_0x1ab5('0x1b')]==='undefined'&&typeof _0x436969[_0x1ab5('0x1c')]===_0x1ab5('0x1d');var _0x5cbd36=_0x4fbaad[_0x1ab5('0x1e')];var _0x15b89e=_0x41b6c0?0x0:_0x436969['offset'];var _0x14dc38=_0x41b6c0?_0x4fbaad[_0x1ab5('0x1e')]:_0x436969[_0x1ab5('0x1b')]+_0x436969[_0x1ab5('0x1c')];var _0x2bc292;if(_0x14dc38>=_0x5cbd36){_0x14dc38=_0x5cbd36;_0x2bc292=0xc8;}else{_0x2bc292=0xce;}_0x23d26c[_0x1ab5('0x18')](_0x2bc292);return _0x23d26c['set'](_0x1ab5('0x1f'),_0x15b89e+'-'+_0x14dc38+'/'+_0x5cbd36)[_0x1ab5('0x1a')](_0x4fbaad);}return null;};}function patchUpdates(_0x42291d){return function(_0x42d842){try{jsonpatch[_0x1ab5('0x20')](_0x42d842,_0x42291d,!![]);}catch(_0x526ce0){return BPromise['reject'](_0x526ce0);}return _0x42d842[_0x1ab5('0x21')]();};}function saveUpdates(_0x579e53,_0x409c25){return function(_0x2cb2a0){if(_0x2cb2a0){return _0x2cb2a0[_0x1ab5('0x22')](_0x579e53)[_0x1ab5('0x23')](function(_0x5363f5){return _0x5363f5;});}return null;};}function removeEntity(_0x3ff196,_0x4a1a54){return function(_0x12e7b8){if(_0x12e7b8){return _0x12e7b8[_0x1ab5('0x24')]()[_0x1ab5('0x23')](function(){_0x3ff196[_0x1ab5('0x18')](0xcc)[_0x1ab5('0x19')]();});}};}function handleEntityNotFound(_0x51f929,_0x164980){return function(_0xfafc16){if(!_0xfafc16){_0x51f929['sendStatus'](0x194);}return _0xfafc16;};}function handleError(_0x2b471a,_0x5f2a83){_0x5f2a83=_0x5f2a83||0x1f4;return function(_0x537956){logger[_0x1ab5('0x25')](_0x537956[_0x1ab5('0x26')]);if(_0x537956[_0x1ab5('0x27')]){delete _0x537956[_0x1ab5('0x27')];}_0x2b471a['status'](_0x5f2a83)['send'](_0x537956);};}exports['index']=function(_0x26c148,_0x5c2983){var _0x3059e3={},_0x1b1d9c={},_0x5b7561={'count':0x0,'rows':[]};var _0xb976a3=_[_0x1ab5('0x28')](db[_0x1ab5('0x29')][_0x1ab5('0x2a')],function(_0x462807){return{'name':_0x462807[_0x1ab5('0x2b')],'type':_0x462807[_0x1ab5('0x2c')][_0x1ab5('0x2d')]};});_0x1b1d9c[_0x1ab5('0x2e')]=_[_0x1ab5('0x28')](_0xb976a3,'name');_0x1b1d9c[_0x1ab5('0x2f')]=_[_0x1ab5('0x30')](_0x26c148[_0x1ab5('0x2f')]);_0x1b1d9c[_0x1ab5('0x31')]=_[_0x1ab5('0x32')](_0x1b1d9c['model'],_0x1b1d9c[_0x1ab5('0x2f')]);_0x3059e3[_0x1ab5('0x33')]=_[_0x1ab5('0x32')](_0x1b1d9c[_0x1ab5('0x2e')],qs['fields'](_0x26c148[_0x1ab5('0x2f')][_0x1ab5('0x34')]));_0x3059e3['attributes']=_0x3059e3['attributes']['length']?_0x3059e3['attributes']:_0x1b1d9c[_0x1ab5('0x2e')];if(!_0x26c148['query']['hasOwnProperty']('nolimit')){_0x3059e3[_0x1ab5('0x1c')]=qs[_0x1ab5('0x1c')](_0x26c148['query'][_0x1ab5('0x1c')]);_0x3059e3[_0x1ab5('0x1b')]=qs[_0x1ab5('0x1b')](_0x26c148[_0x1ab5('0x2f')][_0x1ab5('0x1b')]);}_0x3059e3[_0x1ab5('0x35')]=qs['sort'](_0x26c148[_0x1ab5('0x2f')][_0x1ab5('0x36')]);_0x3059e3[_0x1ab5('0x37')]=qs[_0x1ab5('0x31')](_['pick'](_0x26c148['query'],_0x1b1d9c['filters']),_0xb976a3);if(_0x26c148[_0x1ab5('0x2f')][_0x1ab5('0x38')]){_0x3059e3[_0x1ab5('0x37')]=_[_0x1ab5('0x39')](_0x3059e3[_0x1ab5('0x37')],{'$or':_[_0x1ab5('0x28')](_0xb976a3,function(_0x57dd1d){if(_0x57dd1d[_0x1ab5('0x2c')]!=='VIRTUAL'){var _0x38dae2={};_0x38dae2[_0x57dd1d['name']]={'$like':'%'+_0x26c148[_0x1ab5('0x2f')][_0x1ab5('0x38')]+'%'};return _0x38dae2;}})});}_0x3059e3=_['merge']({},_0x3059e3,_0x26c148[_0x1ab5('0x3a')]);var _0x5e9646={'where':_0x3059e3['where']};return db[_0x1ab5('0x29')][_0x1ab5('0x1e')](_0x5e9646)['then'](function(_0x4897dd){_0x5b7561[_0x1ab5('0x1e')]=_0x4897dd;if(_0x26c148[_0x1ab5('0x2f')][_0x1ab5('0x3b')]){_0x3059e3[_0x1ab5('0x3c')]=[{'all':!![]}];}return db[_0x1ab5('0x29')]['findAll'](_0x3059e3);})[_0x1ab5('0x23')](function(_0x5529fe){_0x5b7561[_0x1ab5('0x3d')]=_0x5529fe;return _0x5b7561;})[_0x1ab5('0x23')](respondWithFilteredResult(_0x5c2983,_0x3059e3))[_0x1ab5('0x3e')](handleError(_0x5c2983,null));};exports[_0x1ab5('0x3f')]=function(_0x3a4a08,_0x260a56){var _0x3935e7={'raw':!![],'where':{'id':_0x3a4a08[_0x1ab5('0x40')]['id']}},_0x54e347={};_0x54e347[_0x1ab5('0x2e')]=_[_0x1ab5('0x30')](db['JscriptySessionReport'][_0x1ab5('0x2a')]);_0x54e347[_0x1ab5('0x2f')]=_[_0x1ab5('0x30')](_0x3a4a08[_0x1ab5('0x2f')]);_0x54e347[_0x1ab5('0x31')]=_[_0x1ab5('0x32')](_0x54e347[_0x1ab5('0x2e')],_0x54e347[_0x1ab5('0x2f')]);_0x3935e7[_0x1ab5('0x33')]=_[_0x1ab5('0x32')](_0x54e347['model'],qs[_0x1ab5('0x34')](_0x3a4a08[_0x1ab5('0x2f')][_0x1ab5('0x34')]));_0x3935e7[_0x1ab5('0x33')]=_0x3935e7[_0x1ab5('0x33')][_0x1ab5('0x41')]?_0x3935e7[_0x1ab5('0x33')]:_0x54e347[_0x1ab5('0x2e')];if(_0x3a4a08[_0x1ab5('0x2f')][_0x1ab5('0x3b')]){_0x3935e7[_0x1ab5('0x3c')]=[{'all':!![]}];}_0x3935e7=_[_0x1ab5('0x39')]({},_0x3935e7,_0x3a4a08[_0x1ab5('0x3a')]);return db[_0x1ab5('0x29')][_0x1ab5('0x42')](_0x3935e7)[_0x1ab5('0x23')](handleEntityNotFound(_0x260a56,null))[_0x1ab5('0x23')](respondWithResult(_0x260a56,null))[_0x1ab5('0x3e')](handleError(_0x260a56,null));};exports[_0x1ab5('0x43')]=function(_0x59663b,_0x438ad6){return db[_0x1ab5('0x29')][_0x1ab5('0x43')](_0x59663b['body'],{})['then'](respondWithResult(_0x438ad6,0xc9))[_0x1ab5('0x3e')](handleError(_0x438ad6,null));};exports['update']=function(_0xeb16f6,_0x3ce304){if(_0xeb16f6[_0x1ab5('0x44')]['id']){delete _0xeb16f6[_0x1ab5('0x44')]['id'];}return db[_0x1ab5('0x29')][_0x1ab5('0x42')]({'where':{'id':_0xeb16f6[_0x1ab5('0x40')]['id']}})[_0x1ab5('0x23')](handleEntityNotFound(_0x3ce304,null))[_0x1ab5('0x23')](saveUpdates(_0xeb16f6[_0x1ab5('0x44')],null))[_0x1ab5('0x23')](respondWithResult(_0x3ce304,null))[_0x1ab5('0x3e')](handleError(_0x3ce304,null));};exports['destroy']=function(_0x99005d,_0x100735){return db['JscriptySessionReport'][_0x1ab5('0x42')]({'where':{'id':_0x99005d[_0x1ab5('0x40')]['id']}})['then'](handleEntityNotFound(_0x100735,null))[_0x1ab5('0x23')](removeEntity(_0x100735,null))[_0x1ab5('0x3e')](handleError(_0x100735,null));};exports[_0x1ab5('0x45')]=function(_0xe6d709,_0x20fe0a){return db[_0x1ab5('0x29')][_0x1ab5('0x45')]()[_0x1ab5('0x23')](respondWithResult(_0x20fe0a,null))[_0x1ab5('0x3e')](handleError(_0x20fe0a,null));};exports['getQuestions']=function(_0xb4bc75,_0x37fdda,_0x51f05e){var _0x1ffe34={'raw':!![],'where':{}};var _0x248bb0={};var _0x71d2fa={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1ab5('0x46')]({'where':{'id':_0xb4bc75['params']['id']}})[_0x1ab5('0x23')](handleEntityNotFound(_0x37fdda,null))[_0x1ab5('0x23')](function(_0x2adf16){if(_0x2adf16){_0x248bb0['model']=_['keys'](db[_0x1ab5('0x47')][_0x1ab5('0x2a')]);_0x248bb0['query']=_[_0x1ab5('0x30')](_0xb4bc75[_0x1ab5('0x2f')]);_0x248bb0[_0x1ab5('0x31')]=_[_0x1ab5('0x32')](_0x248bb0[_0x1ab5('0x2e')],_0x248bb0[_0x1ab5('0x2f')]);_0x1ffe34[_0x1ab5('0x33')]=_[_0x1ab5('0x32')](_0x248bb0['model'],qs[_0x1ab5('0x34')](_0xb4bc75[_0x1ab5('0x2f')][_0x1ab5('0x34')]));_0x1ffe34['attributes']=_0x1ffe34[_0x1ab5('0x33')][_0x1ab5('0x41')]?_0x1ffe34[_0x1ab5('0x33')]:_0x248bb0['model'];if(!_0xb4bc75[_0x1ab5('0x2f')]['hasOwnProperty'](_0x1ab5('0x48'))){_0x1ffe34['limit']=qs['limit'](_0xb4bc75[_0x1ab5('0x2f')][_0x1ab5('0x1c')]);_0x1ffe34['offset']=qs[_0x1ab5('0x1b')](_0xb4bc75[_0x1ab5('0x2f')][_0x1ab5('0x1b')]);}_0x1ffe34[_0x1ab5('0x35')]=qs[_0x1ab5('0x36')](_0xb4bc75[_0x1ab5('0x2f')][_0x1ab5('0x36')]);_0x1ffe34[_0x1ab5('0x37')]=qs[_0x1ab5('0x31')](_[_0x1ab5('0x49')](_0xb4bc75[_0x1ab5('0x2f')],_0x248bb0[_0x1ab5('0x31')]));_0x1ffe34[_0x1ab5('0x37')][_0x1ab5('0x4a')]=_0x2adf16['id'];if(_0xb4bc75['query']['filter']){_0x1ffe34[_0x1ab5('0x37')]=_['merge'](_0x1ffe34[_0x1ab5('0x37')],{'$or':_[_0x1ab5('0x28')](_0x1ffe34['attributes'],function(_0xdfa7c5){var _0x2159b3={};_0x2159b3[_0xdfa7c5]={'$like':'%'+_0xb4bc75[_0x1ab5('0x2f')][_0x1ab5('0x38')]+'%'};return _0x2159b3;})});}_0x1ffe34=_[_0x1ab5('0x39')]({},_0x1ffe34,_0xb4bc75[_0x1ab5('0x3a')]);return db[_0x1ab5('0x47')][_0x1ab5('0x1e')]({'where':_0x1ffe34[_0x1ab5('0x37')]})['then'](function(_0x4b3f2d){_0x71d2fa['count']=_0x4b3f2d;if(_0xb4bc75['query'][_0x1ab5('0x3b')]){_0x1ffe34['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1ab5('0x4b')](_0x1ffe34);})[_0x1ab5('0x23')](function(_0x4cc8d0){_0x71d2fa[_0x1ab5('0x3d')]=_0x4cc8d0;return _0x71d2fa;});}})['then'](respondWithFilteredResult(_0x37fdda,_0x1ffe34))['catch'](handleError(_0x37fdda,null));}; \ No newline at end of file +var _0x2538=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format'];(function(_0x233f43,_0x600ccb){var _0x3059d4=function(_0x3673e3){while(--_0x3673e3){_0x233f43['push'](_0x233f43['shift']());}};_0x3059d4(++_0x600ccb);}(_0x2538,0x13f));var _0x8253=function(_0x4f1c6c,_0x1e8f52){_0x4f1c6c=_0x4f1c6c-0x0;var _0x1d9e2a=_0x2538[_0x4f1c6c];return _0x1d9e2a;};'use strict';var emlformat=require(_0x8253('0x0'));var rimraf=require(_0x8253('0x1'));var zipdir=require(_0x8253('0x2'));var jsonpatch=require(_0x8253('0x3'));var rp=require('request-promise');var moment=require(_0x8253('0x4'));var BPromise=require(_0x8253('0x5'));var Mustache=require(_0x8253('0x6'));var util=require(_0x8253('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8253('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8253('0x9'));var squel=require(_0x8253('0xa'));var crypto=require(_0x8253('0xb'));var jsforce=require(_0x8253('0xc'));var deskjs=require(_0x8253('0xd'));var toCsv=require(_0x8253('0x8'));var querystring=require(_0x8253('0xe'));var Papa=require(_0x8253('0xf'));var Redis=require('ioredis');var authService=require(_0x8253('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8253('0x11'));var hardwareService=require(_0x8253('0x12'));var logger=require('../../config/logger')(_0x8253('0x13'));var utils=require(_0x8253('0x14'));var config=require(_0x8253('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8253('0x16'))['db'];function respondWithStatusCode(_0x2a8789,_0x5222e1){_0x5222e1=_0x5222e1||0xcc;return function(_0x28582e){if(_0x28582e){return _0x2a8789[_0x8253('0x17')](_0x5222e1);}return _0x2a8789[_0x8253('0x18')](_0x5222e1)[_0x8253('0x19')]();};}function respondWithResult(_0x266836,_0x220ef2){_0x220ef2=_0x220ef2||0xc8;return function(_0x2ed193){if(_0x2ed193){return _0x266836[_0x8253('0x18')](_0x220ef2)[_0x8253('0x1a')](_0x2ed193);}};}function respondWithFilteredResult(_0x224580,_0x528038){return function(_0x27464c){if(_0x27464c){var _0x104f86=typeof _0x528038[_0x8253('0x1b')]===_0x8253('0x1c')&&typeof _0x528038[_0x8253('0x1d')]===_0x8253('0x1c');var _0x330f3a=_0x27464c[_0x8253('0x1e')];var _0x255251=_0x104f86?0x0:_0x528038['offset'];var _0x591cf2=_0x104f86?_0x27464c[_0x8253('0x1e')]:_0x528038[_0x8253('0x1b')]+_0x528038['limit'];var _0x248829;if(_0x591cf2>=_0x330f3a){_0x591cf2=_0x330f3a;_0x248829=0xc8;}else{_0x248829=0xce;}_0x224580[_0x8253('0x18')](_0x248829);return _0x224580[_0x8253('0x1f')](_0x8253('0x20'),_0x255251+'-'+_0x591cf2+'/'+_0x330f3a)[_0x8253('0x1a')](_0x27464c);}return null;};}function patchUpdates(_0xf4fde7){return function(_0x161b43){try{jsonpatch[_0x8253('0x21')](_0x161b43,_0xf4fde7,!![]);}catch(_0x1c6281){return BPromise[_0x8253('0x22')](_0x1c6281);}return _0x161b43[_0x8253('0x23')]();};}function saveUpdates(_0xfedf31,_0x407917){return function(_0x41ae62){if(_0x41ae62){return _0x41ae62['update'](_0xfedf31)['then'](function(_0x412e30){return _0x412e30;});}return null;};}function removeEntity(_0x1ceb73,_0x39b7e7){return function(_0x1891f5){if(_0x1891f5){return _0x1891f5['destroy']()[_0x8253('0x24')](function(){_0x1ceb73['status'](0xcc)[_0x8253('0x19')]();});}};}function handleEntityNotFound(_0x3c5a40,_0x3d2203){return function(_0x5b6056){if(!_0x5b6056){_0x3c5a40[_0x8253('0x17')](0x194);}return _0x5b6056;};}function handleError(_0x3c044e,_0x4bc634){_0x4bc634=_0x4bc634||0x1f4;return function(_0x1b8e62){logger[_0x8253('0x25')](_0x1b8e62[_0x8253('0x26')]);if(_0x1b8e62['name']){delete _0x1b8e62[_0x8253('0x27')];}_0x3c044e[_0x8253('0x18')](_0x4bc634)[_0x8253('0x28')](_0x1b8e62);};}exports['index']=function(_0x3a6aab,_0x5ee300){var _0x1cecce={},_0x32e634={},_0x1cc893={'count':0x0,'rows':[]};var _0x18cd80=_[_0x8253('0x29')](db['JscriptySessionReport'][_0x8253('0x2a')],function(_0x2c1ae3){return{'name':_0x2c1ae3[_0x8253('0x2b')],'type':_0x2c1ae3[_0x8253('0x2c')]['key']};});_0x32e634[_0x8253('0x2d')]=_[_0x8253('0x29')](_0x18cd80,_0x8253('0x27'));_0x32e634[_0x8253('0x2e')]=_[_0x8253('0x2f')](_0x3a6aab['query']);_0x32e634[_0x8253('0x30')]=_[_0x8253('0x31')](_0x32e634[_0x8253('0x2d')],_0x32e634[_0x8253('0x2e')]);_0x1cecce['attributes']=_[_0x8253('0x31')](_0x32e634[_0x8253('0x2d')],qs[_0x8253('0x32')](_0x3a6aab[_0x8253('0x2e')][_0x8253('0x32')]));_0x1cecce['attributes']=_0x1cecce[_0x8253('0x33')][_0x8253('0x34')]?_0x1cecce['attributes']:_0x32e634[_0x8253('0x2d')];if(!_0x3a6aab[_0x8253('0x2e')]['hasOwnProperty'](_0x8253('0x35'))){_0x1cecce[_0x8253('0x1d')]=qs['limit'](_0x3a6aab['query']['limit']);_0x1cecce[_0x8253('0x1b')]=qs[_0x8253('0x1b')](_0x3a6aab[_0x8253('0x2e')]['offset']);}_0x1cecce[_0x8253('0x36')]=qs[_0x8253('0x37')](_0x3a6aab[_0x8253('0x2e')][_0x8253('0x37')]);_0x1cecce[_0x8253('0x38')]=qs[_0x8253('0x30')](_[_0x8253('0x39')](_0x3a6aab['query'],_0x32e634[_0x8253('0x30')]),_0x18cd80);if(_0x3a6aab[_0x8253('0x2e')][_0x8253('0x3a')]){_0x1cecce[_0x8253('0x38')]=_[_0x8253('0x3b')](_0x1cecce[_0x8253('0x38')],{'$or':_[_0x8253('0x29')](_0x18cd80,function(_0x22f385){if(_0x22f385[_0x8253('0x2c')]!=='VIRTUAL'){var _0x557ee7={};_0x557ee7[_0x22f385[_0x8253('0x27')]]={'$like':'%'+_0x3a6aab[_0x8253('0x2e')][_0x8253('0x3a')]+'%'};return _0x557ee7;}})});}_0x1cecce=_[_0x8253('0x3b')]({},_0x1cecce,_0x3a6aab['options']);var _0x3dbe70={'where':_0x1cecce[_0x8253('0x38')]};return db[_0x8253('0x3c')][_0x8253('0x1e')](_0x3dbe70)[_0x8253('0x24')](function(_0x313585){_0x1cc893[_0x8253('0x1e')]=_0x313585;if(_0x3a6aab[_0x8253('0x2e')][_0x8253('0x3d')]){_0x1cecce[_0x8253('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8253('0x3f')](_0x1cecce);})[_0x8253('0x24')](function(_0x369c09){_0x1cc893[_0x8253('0x40')]=_0x369c09;return _0x1cc893;})[_0x8253('0x24')](respondWithFilteredResult(_0x5ee300,_0x1cecce))[_0x8253('0x41')](handleError(_0x5ee300,null));};exports[_0x8253('0x42')]=function(_0x22fbb7,_0x560363){var _0x2ce461={'raw':!![],'where':{'id':_0x22fbb7[_0x8253('0x43')]['id']}},_0x4b7ab8={};_0x4b7ab8[_0x8253('0x2d')]=_[_0x8253('0x2f')](db[_0x8253('0x3c')][_0x8253('0x2a')]);_0x4b7ab8[_0x8253('0x2e')]=_['keys'](_0x22fbb7['query']);_0x4b7ab8['filters']=_[_0x8253('0x31')](_0x4b7ab8[_0x8253('0x2d')],_0x4b7ab8[_0x8253('0x2e')]);_0x2ce461[_0x8253('0x33')]=_['intersection'](_0x4b7ab8[_0x8253('0x2d')],qs['fields'](_0x22fbb7['query'][_0x8253('0x32')]));_0x2ce461[_0x8253('0x33')]=_0x2ce461[_0x8253('0x33')]['length']?_0x2ce461[_0x8253('0x33')]:_0x4b7ab8[_0x8253('0x2d')];if(_0x22fbb7[_0x8253('0x2e')][_0x8253('0x3d')]){_0x2ce461['include']=[{'all':!![]}];}_0x2ce461=_[_0x8253('0x3b')]({},_0x2ce461,_0x22fbb7[_0x8253('0x44')]);return db[_0x8253('0x3c')][_0x8253('0x45')](_0x2ce461)['then'](handleEntityNotFound(_0x560363,null))[_0x8253('0x24')](respondWithResult(_0x560363,null))['catch'](handleError(_0x560363,null));};exports[_0x8253('0x46')]=function(_0x27a538,_0x39e5df){return db[_0x8253('0x3c')]['create'](_0x27a538[_0x8253('0x47')],{})[_0x8253('0x24')](respondWithResult(_0x39e5df,0xc9))[_0x8253('0x41')](handleError(_0x39e5df,null));};exports[_0x8253('0x48')]=function(_0x23a371,_0x40d57f){if(_0x23a371[_0x8253('0x47')]['id']){delete _0x23a371['body']['id'];}return db[_0x8253('0x3c')]['find']({'where':{'id':_0x23a371[_0x8253('0x43')]['id']}})[_0x8253('0x24')](handleEntityNotFound(_0x40d57f,null))[_0x8253('0x24')](saveUpdates(_0x23a371[_0x8253('0x47')],null))[_0x8253('0x24')](respondWithResult(_0x40d57f,null))[_0x8253('0x41')](handleError(_0x40d57f,null));};exports[_0x8253('0x49')]=function(_0x143b32,_0x55dff7){return db[_0x8253('0x3c')]['find']({'where':{'id':_0x143b32[_0x8253('0x43')]['id']}})['then'](handleEntityNotFound(_0x55dff7,null))[_0x8253('0x24')](removeEntity(_0x55dff7,null))[_0x8253('0x41')](handleError(_0x55dff7,null));};exports[_0x8253('0x4a')]=function(_0xf8f07e,_0x3f7097){return db[_0x8253('0x3c')][_0x8253('0x4a')]()['then'](respondWithResult(_0x3f7097,null))[_0x8253('0x41')](handleError(_0x3f7097,null));};exports[_0x8253('0x4b')]=function(_0x4d26b4,_0x2ef724,_0x528253){var _0x1896a2={'raw':!![],'where':{}};var _0x36fa90={};var _0x41ed54={'count':0x0,'rows':[]};return db[_0x8253('0x3c')][_0x8253('0x4c')]({'where':{'id':_0x4d26b4[_0x8253('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ef724,null))[_0x8253('0x24')](function(_0x4e59d4){if(_0x4e59d4){_0x36fa90[_0x8253('0x2d')]=_['keys'](db[_0x8253('0x4d')][_0x8253('0x2a')]);_0x36fa90['query']=_[_0x8253('0x2f')](_0x4d26b4[_0x8253('0x2e')]);_0x36fa90['filters']=_[_0x8253('0x31')](_0x36fa90[_0x8253('0x2d')],_0x36fa90[_0x8253('0x2e')]);_0x1896a2[_0x8253('0x33')]=_['intersection'](_0x36fa90[_0x8253('0x2d')],qs[_0x8253('0x32')](_0x4d26b4[_0x8253('0x2e')][_0x8253('0x32')]));_0x1896a2[_0x8253('0x33')]=_0x1896a2['attributes'][_0x8253('0x34')]?_0x1896a2[_0x8253('0x33')]:_0x36fa90[_0x8253('0x2d')];if(!_0x4d26b4[_0x8253('0x2e')][_0x8253('0x4e')](_0x8253('0x35'))){_0x1896a2[_0x8253('0x1d')]=qs[_0x8253('0x1d')](_0x4d26b4['query'][_0x8253('0x1d')]);_0x1896a2[_0x8253('0x1b')]=qs[_0x8253('0x1b')](_0x4d26b4[_0x8253('0x2e')][_0x8253('0x1b')]);}_0x1896a2[_0x8253('0x36')]=qs[_0x8253('0x37')](_0x4d26b4['query'][_0x8253('0x37')]);_0x1896a2[_0x8253('0x38')]=qs[_0x8253('0x30')](_[_0x8253('0x39')](_0x4d26b4[_0x8253('0x2e')],_0x36fa90[_0x8253('0x30')]));_0x1896a2[_0x8253('0x38')][_0x8253('0x4f')]=_0x4e59d4['id'];if(_0x4d26b4[_0x8253('0x2e')]['filter']){_0x1896a2[_0x8253('0x38')]=_[_0x8253('0x3b')](_0x1896a2[_0x8253('0x38')],{'$or':_[_0x8253('0x29')](_0x1896a2[_0x8253('0x33')],function(_0x3c4d12){var _0xabaa4e={};_0xabaa4e[_0x3c4d12]={'$like':'%'+_0x4d26b4[_0x8253('0x2e')][_0x8253('0x3a')]+'%'};return _0xabaa4e;})});}_0x1896a2=_[_0x8253('0x3b')]({},_0x1896a2,_0x4d26b4[_0x8253('0x44')]);return db[_0x8253('0x4d')][_0x8253('0x1e')]({'where':_0x1896a2[_0x8253('0x38')]})[_0x8253('0x24')](function(_0x170cf7){_0x41ed54[_0x8253('0x1e')]=_0x170cf7;if(_0x4d26b4[_0x8253('0x2e')]['includeAll']){_0x1896a2[_0x8253('0x3e')]=[{'all':!![]}];}return db[_0x8253('0x4d')][_0x8253('0x3f')](_0x1896a2);})['then'](function(_0x4f0614){_0x41ed54[_0x8253('0x40')]=_0x4f0614;return _0x41ed54;});}})[_0x8253('0x24')](respondWithFilteredResult(_0x2ef724,_0x1896a2))['catch'](handleError(_0x2ef724,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f726bb1..e0f55d9 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 _0x1cb9=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xfd34d7,_0x569a29){var _0x58a462=function(_0x328b24){while(--_0x328b24){_0xfd34d7['push'](_0xfd34d7['shift']());}};_0x58a462(++_0x569a29);}(_0x1cb9,0x14e));var _0x91cb=function(_0x8e0150,_0x51baa2){_0x8e0150=_0x8e0150-0x0;var _0x1f6392=_0x1cb9[_0x8e0150];return _0x1f6392;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird'];(function(_0x43dbb6,_0x196148){var _0x570ad6=function(_0x3d43e9){while(--_0x3d43e9){_0x43dbb6['push'](_0x43dbb6['shift']());}};_0x570ad6(++_0x196148);}(_0x6455,0x97));var _0x5645=function(_0x17d4a3,_0xef916c){_0x17d4a3=_0x17d4a3-0x0;var _0x2fd765=_0x6455[_0x17d4a3];return _0x2fd765;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'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 984c3d3..af4311e 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 _0x57ca=['client','http','request','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4a7f9b,_0x4b806b){var _0x74c181=function(_0x1ef29d){while(--_0x1ef29d){_0x4a7f9b['push'](_0x4a7f9b['shift']());}};_0x74c181(++_0x4b806b);}(_0x57ca,0x108));var _0xa57c=function(_0x33584a,_0x323226){_0x33584a=_0x33584a-0x0;var _0x42951e=_0x57ca[_0x33584a];return _0x42951e;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xffd6=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xffd6,0x97));var _0x6ffd=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xffd6[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 2d5031a..7490be2 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 _0x3738=['update','/download_log_file','downloadLogFile','exports','multer','util','path','express','Router','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x3e1a50,_0x27cee4){var _0x3fce23=function(_0x230e85){while(--_0x230e85){_0x3e1a50['push'](_0x3e1a50['shift']());}};_0x3fce23(++_0x27cee4);}(_0x3738,0xe5));var _0x8373=function(_0x39eaf1,_0x56f6b9){_0x39eaf1=_0x39eaf1-0x0;var _0x116705=_0x3738[_0x39eaf1];return _0x116705;};'use strict';var multer=require(_0x8373('0x0'));var util=require(_0x8373('0x1'));var path=require(_0x8373('0x2'));var timeout=require('connect-timeout');var express=require(_0x8373('0x3'));var router=express[_0x8373('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8373('0x5'));router[_0x8373('0x6')]('/',controller[_0x8373('0x7')]);router[_0x8373('0x8')](_0x8373('0x9'),auth[_0x8373('0xa')](),controller[_0x8373('0xb')]);router[_0x8373('0x6')](_0x8373('0xc'),auth[_0x8373('0xa')](),controller[_0x8373('0xd')]);module[_0x8373('0xe')]=router; \ No newline at end of file +var _0xa19a=['put','isAuthenticated','downloadLogFile','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa19a,0x124));var _0xaa19=function(_0xb5136f,_0x40d842){_0xb5136f=_0xb5136f-0x0;var _0x5d2d0f=_0xa19a[_0xb5136f];return _0x5d2d0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa19('0x0'));var timeout=require(_0xaa19('0x1'));var express=require(_0xaa19('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa19('0x3'));var interaction=require(_0xaa19('0x4'));var config=require(_0xaa19('0x5'));var controller=require('./license.controller');router[_0xaa19('0x6')]('/',controller[_0xaa19('0x7')]);router[_0xaa19('0x8')]('/:id',auth[_0xaa19('0x9')](),controller['update']);router[_0xaa19('0x6')]('/download_log_file',auth['isAuthenticated'](),controller[_0xaa19('0xa')]);module[_0xaa19('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 54c5ff2..2abac25 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 _0xad38=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x5a5c59,_0x15053d){var _0x3aa4e2=function(_0x99b61e){while(--_0x99b61e){_0x5a5c59['push'](_0x5a5c59['shift']());}};_0x3aa4e2(++_0x15053d);}(_0xad38,0x9d));var _0x8ad3=function(_0xd73be6,_0x15e94d){_0xd73be6=_0xd73be6-0x0;var _0x155ad0=_0xad38[_0xd73be6];return _0x155ad0;};'use strict';var Sequelize=require(_0x8ad3('0x0'));module[_0x8ad3('0x1')]={'license':{'type':Sequelize[_0x8ad3('0x2')]},'data1':{'type':Sequelize[_0x8ad3('0x3')]},'data2':{'type':Sequelize[_0x8ad3('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x8ad3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3dad=['INTEGER','sequelize','exports','STRING'];(function(_0x310fe0,_0x56890e){var _0xc995d=function(_0x34e0a1){while(--_0x34e0a1){_0x310fe0['push'](_0x310fe0['shift']());}};_0xc995d(++_0x56890e);}(_0x3dad,0x95));var _0xd3da=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3dad[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xd3da('0x0'));module[_0xd3da('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xd3da('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd3da('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f39776a..786672d 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 _0x715c=['save','update','then','sendStatus','stack','name','../../config/license/util','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','body','License','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x715c,0xf1));var _0xc715=function(_0x1d7f90,_0xc590a6){_0x1d7f90=_0x1d7f90-0x0;var _0x2360ad=_0x715c[_0x1d7f90];return _0x2360ad;};'use strict';var emlformat=require(_0xc715('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc715('0x1'));var jsonpatch=require(_0xc715('0x2'));var rp=require(_0xc715('0x3'));var moment=require('moment');var BPromise=require(_0xc715('0x4'));var Mustache=require(_0xc715('0x5'));var util=require(_0xc715('0x6'));var path=require(_0xc715('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc715('0x8'));var fs=require('fs');var fs_extra=require(_0xc715('0x9'));var _=require('lodash');var squel=require(_0xc715('0xa'));var crypto=require(_0xc715('0xb'));var jsforce=require(_0xc715('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc715('0xd'));var Papa=require(_0xc715('0xe'));var Redis=require(_0xc715('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc715('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc715('0x11'))(_0xc715('0x12'));var utils=require(_0xc715('0x13'));var config=require(_0xc715('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc715('0x15'))['db'];function respondWithStatusCode(_0x1fa2ba,_0x38ad55){_0x38ad55=_0x38ad55||0xcc;return function(_0x197df8){if(_0x197df8){return _0x1fa2ba['sendStatus'](_0x38ad55);}return _0x1fa2ba[_0xc715('0x16')](_0x38ad55)[_0xc715('0x17')]();};}function respondWithResult(_0x21a7ae,_0x275eee){_0x275eee=_0x275eee||0xc8;return function(_0x1e53dc){if(_0x1e53dc){return _0x21a7ae[_0xc715('0x16')](_0x275eee)['json'](_0x1e53dc);}};}function respondWithFilteredResult(_0x38a5ac,_0x3a2f63){return function(_0x580650){if(_0x580650){var _0x4e2f6a=typeof _0x3a2f63[_0xc715('0x18')]===_0xc715('0x19')&&typeof _0x3a2f63[_0xc715('0x1a')]===_0xc715('0x19');var _0x20c817=_0x580650['count'];var _0x13791e=_0x4e2f6a?0x0:_0x3a2f63[_0xc715('0x18')];var _0x37aa9b=_0x4e2f6a?_0x580650[_0xc715('0x1b')]:_0x3a2f63['offset']+_0x3a2f63[_0xc715('0x1a')];var _0x199e6f;if(_0x37aa9b>=_0x20c817){_0x37aa9b=_0x20c817;_0x199e6f=0xc8;}else{_0x199e6f=0xce;}_0x38a5ac[_0xc715('0x16')](_0x199e6f);return _0x38a5ac['set'](_0xc715('0x1c'),_0x13791e+'-'+_0x37aa9b+'/'+_0x20c817)[_0xc715('0x1d')](_0x580650);}return null;};}function patchUpdates(_0x3ffa21){return function(_0x54b77c){try{jsonpatch[_0xc715('0x1e')](_0x54b77c,_0x3ffa21,!![]);}catch(_0x37349a){return BPromise['reject'](_0x37349a);}return _0x54b77c[_0xc715('0x1f')]();};}function saveUpdates(_0xef1b5f,_0x349ddc){return function(_0x42489f){if(_0x42489f){return _0x42489f[_0xc715('0x20')](_0xef1b5f)[_0xc715('0x21')](function(_0x552d33){return _0x552d33;});}return null;};}function removeEntity(_0x525567,_0x54cc69){return function(_0x4cb02e){if(_0x4cb02e){return _0x4cb02e['destroy']()[_0xc715('0x21')](function(){_0x525567[_0xc715('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bd9a3,_0x37078e){return function(_0x39acb2){if(!_0x39acb2){_0x5bd9a3[_0xc715('0x22')](0x194);}return _0x39acb2;};}function handleError(_0x194da8,_0x2c7b5d){_0x2c7b5d=_0x2c7b5d||0x1f4;return function(_0x2f1b9c){logger['error'](_0x2f1b9c[_0xc715('0x23')]);if(_0x2f1b9c[_0xc715('0x24')]){delete _0x2f1b9c[_0xc715('0x24')];}_0x194da8[_0xc715('0x16')](_0x2c7b5d)['send'](_0x2f1b9c);};}var utilLicense=require(_0xc715('0x25'));exports[_0xc715('0x26')]=function(_0x2f42cb,_0x475229){var _0x3a9b0d={'raw':!![],'where':{'id':0x1}},_0x286bed={};_0x286bed[_0xc715('0x27')]=_[_0xc715('0x28')](db['License'][_0xc715('0x29')]);_0x286bed[_0xc715('0x2a')]=_[_0xc715('0x28')](_0x2f42cb[_0xc715('0x2a')]);_0x286bed[_0xc715('0x2b')]=_['intersection'](_0x286bed[_0xc715('0x27')],_0x286bed['query']);_0x3a9b0d['attributes']=_[_0xc715('0x2c')](_0x286bed[_0xc715('0x27')],qs['fields'](_0x2f42cb['query'][_0xc715('0x2d')]));_0x3a9b0d[_0xc715('0x2e')]=_0x3a9b0d['attributes'][_0xc715('0x2f')]?_0x3a9b0d[_0xc715('0x2e')]:_0x286bed[_0xc715('0x27')];_0x3a9b0d=_[_0xc715('0x30')]({},_0x3a9b0d,_0x2f42cb[_0xc715('0x31')]);return utilLicense['getLicense'](_0x3a9b0d)['then'](respondWithResult(_0x475229,null))[_0xc715('0x32')](handleError(_0x475229,null));};exports[_0xc715('0x20')]=function(_0x542c3,_0x3acf00){if(_0x542c3[_0xc715('0x33')]['id']){delete _0x542c3[_0xc715('0x33')]['id'];}return db[_0xc715('0x34')]['find']({'where':{'id':_0x542c3[_0xc715('0x35')]['id']}})[_0xc715('0x21')](handleEntityNotFound(_0x3acf00,null))[_0xc715('0x21')](function(_0x1d45dc){var _0x576e4b=_0x1d45dc[_0xc715('0x36')]({'plain':!![]});return utilLicense[_0xc715('0x37')](_0x576e4b,_0x542c3[_0xc715('0x33')][_0xc715('0x38')]);})[_0xc715('0x21')](function(_0x2d68b0){if(!_0x2d68b0[_0xc715('0x39')]){return saveUpdates(_0x542c3[_0xc715('0x33')],null);}return _0x2d68b0;})['then'](respondWithResult(_0x3acf00,null))['catch'](handleError(_0x3acf00,null));};exports[_0xc715('0x3a')]=function(_0x1e2d8c,_0x17eb07){var _0x565f26=_0xc715('0x3b');var _0x132028=path[_0xc715('0x3c')](_0xc715('0x3d'),_0xc715('0x3e'),'xcally',_0x565f26);_0x17eb07[_0xc715('0x3f')](_0xc715('0x40'),_0xc715('0x41')+_0x565f26);_0x17eb07[_0xc715('0x42')](_0xc715('0x43'),'text/plain');_0x17eb07['download'](_0x132028);}; \ No newline at end of file +var _0x4b0c=['downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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/license/util','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','options','getLicense','catch','body','find','params','checkLicense','key','demo'];(function(_0x33b79a,_0x38da10){var _0x5d415f=function(_0x392e06){while(--_0x392e06){_0x33b79a['push'](_0x33b79a['shift']());}};_0x5d415f(++_0x38da10);}(_0x4b0c,0x138));var _0xc4b0=function(_0x35a058,_0x162209){_0x35a058=_0x35a058-0x0;var _0x4255c1=_0x4b0c[_0x35a058];return _0x4255c1;};'use strict';var emlformat=require(_0xc4b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4b0('0x1'));var jsonpatch=require(_0xc4b0('0x2'));var rp=require('request-promise');var moment=require(_0xc4b0('0x3'));var BPromise=require(_0xc4b0('0x4'));var Mustache=require(_0xc4b0('0x5'));var util=require(_0xc4b0('0x6'));var path=require(_0xc4b0('0x7'));var sox=require(_0xc4b0('0x8'));var csv=require(_0xc4b0('0x9'));var ejs=require(_0xc4b0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4b0('0xb'));var squel=require(_0xc4b0('0xc'));var crypto=require(_0xc4b0('0xd'));var jsforce=require(_0xc4b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc4b0('0x9'));var querystring=require(_0xc4b0('0xf'));var Papa=require(_0xc4b0('0x10'));var Redis=require(_0xc4b0('0x11'));var authService=require(_0xc4b0('0x12'));var qs=require(_0xc4b0('0x13'));var as=require(_0xc4b0('0x14'));var hardwareService=require(_0xc4b0('0x15'));var logger=require(_0xc4b0('0x16'))(_0xc4b0('0x17'));var utils=require(_0xc4b0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc4b0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50ed91,_0x4cccb5){_0x4cccb5=_0x4cccb5||0xcc;return function(_0x542faf){if(_0x542faf){return _0x50ed91[_0xc4b0('0x1a')](_0x4cccb5);}return _0x50ed91['status'](_0x4cccb5)[_0xc4b0('0x1b')]();};}function respondWithResult(_0x5f74ef,_0x5eba58){_0x5eba58=_0x5eba58||0xc8;return function(_0xf6cc8d){if(_0xf6cc8d){return _0x5f74ef['status'](_0x5eba58)[_0xc4b0('0x1c')](_0xf6cc8d);}};}function respondWithFilteredResult(_0x5ea045,_0x3476e0){return function(_0xa08988){if(_0xa08988){var _0x153ef1=typeof _0x3476e0[_0xc4b0('0x1d')]==='undefined'&&typeof _0x3476e0[_0xc4b0('0x1e')]===_0xc4b0('0x1f');var _0x32b3ba=_0xa08988[_0xc4b0('0x20')];var _0x2e5929=_0x153ef1?0x0:_0x3476e0[_0xc4b0('0x1d')];var _0x191d5c=_0x153ef1?_0xa08988['count']:_0x3476e0['offset']+_0x3476e0[_0xc4b0('0x1e')];var _0x236961;if(_0x191d5c>=_0x32b3ba){_0x191d5c=_0x32b3ba;_0x236961=0xc8;}else{_0x236961=0xce;}_0x5ea045[_0xc4b0('0x21')](_0x236961);return _0x5ea045['set'](_0xc4b0('0x22'),_0x2e5929+'-'+_0x191d5c+'/'+_0x32b3ba)[_0xc4b0('0x1c')](_0xa08988);}return null;};}function patchUpdates(_0x548399){return function(_0x275641){try{jsonpatch[_0xc4b0('0x23')](_0x275641,_0x548399,!![]);}catch(_0x57e782){return BPromise[_0xc4b0('0x24')](_0x57e782);}return _0x275641[_0xc4b0('0x25')]();};}function saveUpdates(_0x3a9e29,_0x3f9e11){return function(_0x248721){if(_0x248721){return _0x248721[_0xc4b0('0x26')](_0x3a9e29)['then'](function(_0x1fb4e0){return _0x1fb4e0;});}return null;};}function removeEntity(_0x1d714a,_0xdd3af6){return function(_0x5914fb){if(_0x5914fb){return _0x5914fb[_0xc4b0('0x27')]()[_0xc4b0('0x28')](function(){_0x1d714a[_0xc4b0('0x21')](0xcc)[_0xc4b0('0x1b')]();});}};}function handleEntityNotFound(_0x25e259,_0x306545){return function(_0x2fe684){if(!_0x2fe684){_0x25e259[_0xc4b0('0x1a')](0x194);}return _0x2fe684;};}function handleError(_0xe8470d,_0x87e9e){_0x87e9e=_0x87e9e||0x1f4;return function(_0x31379f){logger[_0xc4b0('0x29')](_0x31379f[_0xc4b0('0x2a')]);if(_0x31379f['name']){delete _0x31379f[_0xc4b0('0x2b')];}_0xe8470d[_0xc4b0('0x21')](_0x87e9e)[_0xc4b0('0x2c')](_0x31379f);};}var utilLicense=require(_0xc4b0('0x19'));exports[_0xc4b0('0x2d')]=function(_0x465e8a,_0x2600a3){var _0x245f6f={'raw':!![],'where':{'id':0x1}},_0x1b1228={};_0x1b1228[_0xc4b0('0x2e')]=_[_0xc4b0('0x2f')](db[_0xc4b0('0x30')][_0xc4b0('0x31')]);_0x1b1228['query']=_[_0xc4b0('0x2f')](_0x465e8a[_0xc4b0('0x32')]);_0x1b1228['filters']=_[_0xc4b0('0x33')](_0x1b1228[_0xc4b0('0x2e')],_0x1b1228['query']);_0x245f6f['attributes']=_[_0xc4b0('0x33')](_0x1b1228[_0xc4b0('0x2e')],qs[_0xc4b0('0x34')](_0x465e8a[_0xc4b0('0x32')][_0xc4b0('0x34')]));_0x245f6f['attributes']=_0x245f6f[_0xc4b0('0x35')]['length']?_0x245f6f[_0xc4b0('0x35')]:_0x1b1228[_0xc4b0('0x2e')];_0x245f6f=_['merge']({},_0x245f6f,_0x465e8a[_0xc4b0('0x36')]);return utilLicense[_0xc4b0('0x37')](_0x245f6f)[_0xc4b0('0x28')](respondWithResult(_0x2600a3,null))[_0xc4b0('0x38')](handleError(_0x2600a3,null));};exports[_0xc4b0('0x26')]=function(_0xb86f12,_0x580c5c){if(_0xb86f12[_0xc4b0('0x39')]['id']){delete _0xb86f12[_0xc4b0('0x39')]['id'];}return db[_0xc4b0('0x30')][_0xc4b0('0x3a')]({'where':{'id':_0xb86f12[_0xc4b0('0x3b')]['id']}})[_0xc4b0('0x28')](handleEntityNotFound(_0x580c5c,null))['then'](function(_0x32c03a){var _0x2000d3=_0x32c03a['get']({'plain':!![]});return utilLicense[_0xc4b0('0x3c')](_0x2000d3,_0xb86f12['body'][_0xc4b0('0x3d')]);})[_0xc4b0('0x28')](function(_0x1b386a){if(!_0x1b386a[_0xc4b0('0x3e')]){return saveUpdates(_0xb86f12[_0xc4b0('0x39')],null);}return _0x1b386a;})[_0xc4b0('0x28')](respondWithResult(_0x580c5c,null))[_0xc4b0('0x38')](handleError(_0x580c5c,null));};exports[_0xc4b0('0x3f')]=function(_0x26db0a,_0x4d809f){var _0x4d6a4a=_0xc4b0('0x40');var _0x156e99=path[_0xc4b0('0x41')](_0xc4b0('0x42'),_0xc4b0('0x43'),_0xc4b0('0x44'),_0x4d6a4a);_0x4d809f[_0xc4b0('0x45')](_0xc4b0('0x46'),_0xc4b0('0x47')+_0x4d6a4a);_0x4d809f[_0xc4b0('0x48')](_0xc4b0('0x49'),_0xc4b0('0x4a'));_0x4d809f['download'](_0x156e99);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f29d136..de62751 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 _0x6e0a=['rimraf','../../config/environment','./license.attributes','define','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4509f5,_0x1e54cd){var _0x46a9e7=function(_0x3f6770){while(--_0x3f6770){_0x4509f5['push'](_0x4509f5['shift']());}};_0x46a9e7(++_0x1e54cd);}(_0x6e0a,0xa1));var _0xa6e0=function(_0x34d2a0,_0x6cde4f){_0x34d2a0=_0x34d2a0-0x0;var _0x505c5b=_0x6e0a[_0x34d2a0];return _0x505c5b;};'use strict';var _=require(_0xa6e0('0x0'));var util=require(_0xa6e0('0x1'));var logger=require(_0xa6e0('0x2'))(_0xa6e0('0x3'));var moment=require(_0xa6e0('0x4'));var BPromise=require(_0xa6e0('0x5'));var rp=require(_0xa6e0('0x6'));var fs=require('fs');var path=require(_0xa6e0('0x7'));var rimraf=require(_0xa6e0('0x8'));var config=require(_0xa6e0('0x9'));var attributes=require(_0xa6e0('0xa'));module['exports']=function(_0x256be3,_0x373ffe){return _0x256be3[_0xa6e0('0xb')]('License',attributes,{'tableName':_0xa6e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfba5=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','License','license'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xfba5,0x138));var _0x5fba=function(_0xed10b7,_0x3572ce){_0xed10b7=_0xed10b7-0x0;var _0x57cdb0=_0xfba5[_0xed10b7];return _0x57cdb0;};'use strict';var _=require(_0x5fba('0x0'));var util=require(_0x5fba('0x1'));var logger=require(_0x5fba('0x2'))('api');var moment=require(_0x5fba('0x3'));var BPromise=require(_0x5fba('0x4'));var rp=require(_0x5fba('0x5'));var fs=require('fs');var path=require(_0x5fba('0x6'));var rimraf=require(_0x5fba('0x7'));var config=require(_0x5fba('0x8'));var attributes=require('./license.attributes');module['exports']=function(_0x6bb3fe,_0x28edb3){return _0x6bb3fe[_0x5fba('0x9')](_0x5fba('0xa'),attributes,{'tableName':_0x5fba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 9b89f23..ec966fd 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 _0xf3eb=['lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x180a34,_0x113087){var _0x50e5df=function(_0x31994e){while(--_0x31994e){_0x180a34['push'](_0x180a34['shift']());}};_0x50e5df(++_0x113087);}(_0xf3eb,0x18f));var _0xbf3e=function(_0x2e6dc1,_0xd0588){_0x2e6dc1=_0x2e6dc1-0x0;var _0x4e183c=_0xf3eb[_0x2e6dc1];return _0x4e183c;};'use strict';var _=require(_0xbf3e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf3e('0x1'));var rs=require(_0xbf3e('0x2'));var fs=require('fs');var Redis=require(_0xbf3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf3e('0x4'))(_0xbf3e('0x5'));var config=require('../../config/environment');var jayson=require(_0xbf3e('0x6'));var client=jayson['client'][_0xbf3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2cc89c,_0xca9c9e,_0x4d81c0){return new BPromise(function(_0x3d1760,_0x5e6ade){return client[_0xbf3e('0x8')](_0x2cc89c,_0x4d81c0)[_0xbf3e('0x9')](function(_0x5e06c6){logger[_0xbf3e('0xa')](_0xbf3e('0xb'),_0xca9c9e,_0xbf3e('0xc'));logger[_0xbf3e('0xd')](_0xbf3e('0xe'),_0xca9c9e,_0xbf3e('0xc'),JSON[_0xbf3e('0xf')](_0x5e06c6));if(_0x5e06c6[_0xbf3e('0x10')]){if(_0x5e06c6[_0xbf3e('0x10')][_0xbf3e('0x11')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0xca9c9e,_0x5e06c6[_0xbf3e('0x10')][_0xbf3e('0x12')]);return _0x5e6ade(_0x5e06c6[_0xbf3e('0x10')]['message']);}logger[_0xbf3e('0x10')]('License,\x20%s,\x20%s',_0xca9c9e,_0x5e06c6[_0xbf3e('0x10')][_0xbf3e('0x12')]);return _0x3d1760(_0x5e06c6[_0xbf3e('0x10')]['message']);}else{logger[_0xbf3e('0xa')](_0xbf3e('0xb'),_0xca9c9e,_0xbf3e('0xc'));_0x3d1760(_0x5e06c6[_0xbf3e('0x13')][_0xbf3e('0x12')]);}})[_0xbf3e('0x14')](function(_0x451dc0){logger[_0xbf3e('0x10')](_0xbf3e('0xb'),_0xca9c9e,_0x451dc0);_0x5e6ade(_0x451dc0);});});} \ No newline at end of file +var _0xdecf=['client','request','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8b671c,_0x363eca){var _0x47bc0a=function(_0x17f5c1){while(--_0x17f5c1){_0x8b671c['push'](_0x8b671c['shift']());}};_0x47bc0a(++_0x363eca);}(_0xdecf,0x1ef));var _0xfdec=function(_0x114a2e,_0x349c92){_0x114a2e=_0x114a2e-0x0;var _0x9ea9ef=_0xdecf[_0x114a2e];return _0x9ea9ef;};'use strict';var _=require(_0xfdec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdec('0x1'));var fs=require('fs');var Redis=require(_0xfdec('0x2'));var db=require(_0xfdec('0x3'))['db'];var utils=require(_0xfdec('0x4'));var logger=require(_0xfdec('0x5'))(_0xfdec('0x6'));var config=require(_0xfdec('0x7'));var jayson=require(_0xfdec('0x8'));var client=jayson[_0xfdec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44199c,_0x1352f9,_0x18b970){return new BPromise(function(_0x318b32,_0x927239){return client[_0xfdec('0xa')](_0x44199c,_0x18b970)['then'](function(_0x1e5561){logger[_0xfdec('0xb')]('License,\x20%s,\x20%s',_0x1352f9,_0xfdec('0xc'));logger[_0xfdec('0xd')](_0xfdec('0xe'),_0x1352f9,_0xfdec('0xc'),JSON[_0xfdec('0xf')](_0x1e5561));if(_0x1e5561[_0xfdec('0x10')]){if(_0x1e5561['error'][_0xfdec('0x11')]===0x1f4){logger['error'](_0xfdec('0x12'),_0x1352f9,_0x1e5561[_0xfdec('0x10')][_0xfdec('0x13')]);return _0x927239(_0x1e5561[_0xfdec('0x10')][_0xfdec('0x13')]);}logger[_0xfdec('0x10')]('License,\x20%s,\x20%s',_0x1352f9,_0x1e5561[_0xfdec('0x10')][_0xfdec('0x13')]);return _0x318b32(_0x1e5561['error']['message']);}else{logger[_0xfdec('0xb')](_0xfdec('0x12'),_0x1352f9,_0xfdec('0xc'));_0x318b32(_0x1e5561['result'][_0xfdec('0x13')]);}})[_0xfdec('0x14')](function(_0x30cb01){logger[_0xfdec('0x10')](_0xfdec('0x12'),_0x1352f9,_0x30cb01);_0x927239(_0x30cb01);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 325590e..184b207 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 _0x5769=['/:id/interactions','getInteractions','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addAnswer','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','removeDispositions','removeAnswers','delete','removeImap','removeSmtp','destroy','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','describe','/:id','isAuthenticated','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp'];(function(_0x3318a7,_0x2e0bf4){var _0x2b996f=function(_0x34fca8){while(--_0x34fca8){_0x3318a7['push'](_0x3318a7['shift']());}};_0x2b996f(++_0x2e0bf4);}(_0x5769,0x1c6));var _0x9576=function(_0x2dd35a,_0x4ea640){_0x2dd35a=_0x2dd35a-0x0;var _0x23ed2c=_0x5769[_0x2dd35a];return _0x23ed2c;};'use strict';var multer=require(_0x9576('0x0'));var util=require('util');var path=require(_0x9576('0x1'));var timeout=require(_0x9576('0x2'));var express=require('express');var router=express[_0x9576('0x3')]();var fs_extra=require(_0x9576('0x4'));var auth=require(_0x9576('0x5'));var interaction=require(_0x9576('0x6'));var config=require(_0x9576('0x7'));var controller=require(_0x9576('0x8'));router[_0x9576('0x9')]('/',auth['isAuthenticated'](),controller[_0x9576('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9576('0xb')]);router['get'](_0x9576('0xc'),auth[_0x9576('0xd')](),controller['show']);router[_0x9576('0x9')]('/:id/dispositions',auth[_0x9576('0xd')](),controller['getDispositions']);router[_0x9576('0x9')](_0x9576('0xe'),auth[_0x9576('0xd')](),controller[_0x9576('0xf')]);router['get'](_0x9576('0x10'),auth[_0x9576('0xd')](),controller['getImap']);router[_0x9576('0x9')](_0x9576('0x11'),auth[_0x9576('0xd')](),controller[_0x9576('0x12')]);router['get'](_0x9576('0x13'),auth[_0x9576('0xd')](),controller[_0x9576('0x14')]);router[_0x9576('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/messages',auth[_0x9576('0xd')](),controller[_0x9576('0x15')]);router[_0x9576('0x9')](_0x9576('0x16'),auth['isAuthenticated'](),controller[_0x9576('0x17')]);router[_0x9576('0x9')](_0x9576('0x18'),auth[_0x9576('0xd')](),controller[_0x9576('0x19')]);router[_0x9576('0x1a')](_0x9576('0x1b'),auth[_0x9576('0xd')](),controller['addDisposition']);router[_0x9576('0x1a')]('/:id/canned_answers',auth[_0x9576('0xd')](),controller[_0x9576('0x1c')]);router[_0x9576('0x1a')]('/',auth[_0x9576('0xd')](),controller['create']);router[_0x9576('0x1a')](_0x9576('0x10'),auth['isAuthenticated'](),controller['addImap']);router[_0x9576('0x1a')]('/:id/out_servers',auth[_0x9576('0xd')](),controller[_0x9576('0x1d')]);router[_0x9576('0x1a')](_0x9576('0x13'),auth[_0x9576('0xd')](),controller[_0x9576('0x1e')]);router[_0x9576('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9576('0x1f')]);router[_0x9576('0x1a')](_0x9576('0x20'),auth['isAuthenticated'](),controller[_0x9576('0x21')]);router[_0x9576('0x1a')](_0x9576('0x18'),auth[_0x9576('0xd')](),controller[_0x9576('0x22')]);router['put'](_0x9576('0xc'),auth[_0x9576('0xd')](),controller[_0x9576('0x23')]);router['delete'](_0x9576('0x1b'),auth[_0x9576('0xd')](),controller[_0x9576('0x24')]);router['delete'](_0x9576('0xe'),auth['isAuthenticated'](),controller[_0x9576('0x25')]);router[_0x9576('0x26')](_0x9576('0x10'),auth[_0x9576('0xd')](),controller[_0x9576('0x27')]);router[_0x9576('0x26')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x9576('0x28')]);router['delete']('/:id',auth[_0x9576('0xd')](),controller[_0x9576('0x29')]);router[_0x9576('0x26')](_0x9576('0x18'),auth[_0x9576('0xd')](),controller[_0x9576('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xbb2c=['/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','destroy','removeAgents','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','/describe','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x4f4602,_0x4422d0){var _0x2ef61a=function(_0x582a3d){while(--_0x582a3d){_0x4f4602['push'](_0x4f4602['shift']());}};_0x2ef61a(++_0x4422d0);}(_0xbb2c,0x80));var _0xcbb2=function(_0x3f5330,_0x179db7){_0x3f5330=_0x3f5330-0x0;var _0x5ce9c2=_0xbb2c[_0x3f5330];return _0x5ce9c2;};'use strict';var multer=require(_0xcbb2('0x0'));var util=require(_0xcbb2('0x1'));var path=require(_0xcbb2('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbb2('0x3'));var router=express['Router']();var fs_extra=require(_0xcbb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcbb2('0x5'));var config=require(_0xcbb2('0x6'));var controller=require(_0xcbb2('0x7'));router['get']('/',auth[_0xcbb2('0x8')](),controller['index']);router['get'](_0xcbb2('0x9'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0xa')]);router[_0xcbb2('0xb')](_0xcbb2('0xc'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0xd')]);router[_0xcbb2('0xb')]('/:id/dispositions',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0xe')]);router['get'](_0xcbb2('0xf'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x10')]);router['get']('/:id/in_servers',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x11')]);router['get'](_0xcbb2('0x12'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x13')]);router[_0xcbb2('0xb')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xcbb2('0x14')]);router[_0xcbb2('0xb')](_0xcbb2('0x15'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x16')]);router[_0xcbb2('0xb')](_0xcbb2('0x17'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x18')]);router['get'](_0xcbb2('0x19'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x1a')]);router[_0xcbb2('0xb')](_0xcbb2('0x1b'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x1c')]);router[_0xcbb2('0x1d')](_0xcbb2('0x1e'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x1f')]);router['post'](_0xcbb2('0xf'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x20')]);router['post']('/',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x21')]);router[_0xcbb2('0x1d')](_0xcbb2('0x22'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x23')]);router[_0xcbb2('0x1d')](_0xcbb2('0x12'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x24')]);router[_0xcbb2('0x1d')](_0xcbb2('0x25'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x26')]);router[_0xcbb2('0x1d')](_0xcbb2('0x15'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x27')]);router[_0xcbb2('0x1d')](_0xcbb2('0x28'),auth['isAuthenticated'](),controller[_0xcbb2('0x29')]);router[_0xcbb2('0x1d')]('/:id/users',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x2a')]);router[_0xcbb2('0x2b')](_0xcbb2('0xc'),auth['isAuthenticated'](),controller[_0xcbb2('0x2c')]);router[_0xcbb2('0x2d')](_0xcbb2('0x1e'),auth['isAuthenticated'](),controller[_0xcbb2('0x2e')]);router[_0xcbb2('0x2d')](_0xcbb2('0xf'),auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x2f')]);router[_0xcbb2('0x2d')](_0xcbb2('0x22'),auth['isAuthenticated'](),controller['removeImap']);router[_0xcbb2('0x2d')](_0xcbb2('0x12'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0xcbb2('0x2d')](_0xcbb2('0xc'),auth['isAuthenticated'](),controller[_0xcbb2('0x30')]);router[_0xcbb2('0x2d')]('/:id/users',auth[_0xcbb2('0x8')](),controller[_0xcbb2('0x31')]);module[_0xcbb2('0x32')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 9c5632a..bf55552 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 _0x74ac=['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}}','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','getDataValue','custom','sequelize','exports'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x74ac,0x130));var _0xc74a=function(_0x43a8f4,_0x53eaea){_0x43a8f4=_0x43a8f4-0x0;var _0x2c6e61=_0x74ac[_0x43a8f4];return _0x2c6e61;};'use strict';var Sequelize=require(_0xc74a('0x0'));module[_0xc74a('0x1')]={'description':{'type':Sequelize[_0xc74a('0x2')]},'name':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc74a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xc74a('0x4')]},'markAsUnread':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc74a('0x2')],'allowNull':![],'defaultValue':_0xc74a('0x5')},'fontSize':{'type':Sequelize[_0xc74a('0x6')](0x2)[_0xc74a('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc74a('0x4')],'defaultValue':function(){return _0xc74a('0x8');}},'notificationSound':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc74a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc74a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc74a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc74a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc74a('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc74a('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x281bcf){if(!_0x281bcf)this['setDataValue'](_0xc74a('0x9'),null);this[_0xc74a('0xa')](_0xc74a('0xb'),_0x281bcf);}},'provider':{'type':Sequelize[_0xc74a('0xc')](_0xc74a('0xd'),_0xc74a('0xe'),'yahoo',_0xc74a('0xf')),'defaultValue':null,'get':function(){var _0x590db8=this[_0xc74a('0x10')]('provider');return _0x590db8||'custom';},'set':function(_0x599dc5){if(_0x599dc5===_0xc74a('0x11')){_0x599dc5=null;}return this[_0xc74a('0xa')]('provider',_0x599dc5);}}}; \ No newline at end of file +var _0xfffd=['INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','hotmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xfffd,0x108));var _0xdfff=function(_0x3193d5,_0xea044a){_0x3193d5=_0x3193d5-0x0;var _0x14786c=_0xfffd[_0x3193d5];return _0x14786c;};'use strict';var Sequelize=require(_0xdfff('0x0'));module[_0xdfff('0x1')]={'description':{'type':Sequelize[_0xdfff('0x2')]},'name':{'type':Sequelize[_0xdfff('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdfff('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdfff('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xdfff('0x4')]},'markAsUnread':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdfff('0x2')],'allowNull':![],'defaultValue':_0xdfff('0x5')},'fontSize':{'type':Sequelize[_0xdfff('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdfff('0x4')],'defaultValue':function(){return _0xdfff('0x7');}},'notificationSound':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdfff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfff('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdfff('0x3')],'defaultValue':![],'comment':_0xdfff('0x8'),'set':function(_0x1f2232){if(!_0x1f2232)this['setDataValue'](_0xdfff('0x9'),null);this[_0xdfff('0xa')](_0xdfff('0xb'),_0x1f2232);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xdfff('0xc'),_0xdfff('0xd'),_0xdfff('0xe')),'defaultValue':null,'get':function(){var _0xf79ef8=this[_0xdfff('0xf')]('provider');return _0xf79ef8||_0xdfff('0x10');},'set':function(_0x45b4fc){if(_0x45b4fc===_0xdfff('0x10')){_0x45b4fc=null;}return this['setDataValue'](_0xdfff('0x11'),_0x45b4fc);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5f298f3..bd1d0fe 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 _0x2625=['user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','body','provider','MailServerIn','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','map','removeAnswers','custom','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','email','attachments','join','root','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','update','UserProfileResource','destroy','stack','name','send','gmail','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com'];(function(_0x2fcb5a,_0x5647f2){var _0x5693fb=function(_0x421aad){while(--_0x421aad){_0x2fcb5a['push'](_0x2fcb5a['shift']());}};_0x5693fb(++_0x5647f2);}(_0x2625,0x8e));var _0x5262=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x2625[_0x42bc91];return _0x3f5507;};'use strict';var moment=require(_0x5262('0x0'));var BPromise=require(_0x5262('0x1'));var util=require(_0x5262('0x2'));var path=require(_0x5262('0x3'));var _=require(_0x5262('0x4'));var juice=require('juice');var Redis=require(_0x5262('0x5'));var qs=require(_0x5262('0x6'));var logger=require(_0x5262('0x7'))(_0x5262('0x8'));var config=require(_0x5262('0x9'));var db=require('../../mysqldb')['db'];config[_0x5262('0xa')]=_[_0x5262('0xb')](config[_0x5262('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5262('0xc'))(new Redis(config[_0x5262('0xa')]));require(_0x5262('0xd'))['register'](socket);var jayson=require(_0x5262('0xe'));var client=jayson[_0x5262('0xf')][_0x5262('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x1e649f,_0x10d077,_0x558eff,_0x2e4a27){return new BPromise(function(_0x4fcd74,_0x1b3def){var _0x1fc626=_0x2e4a27||client;return _0x1fc626[_0x5262('0x11')](_0x1e649f,_0x558eff)[_0x5262('0x12')](function(_0x3b0fe8){logger['info'](_0x5262('0x13'),_0x10d077,_0x5262('0x14'));logger['debug'](_0x5262('0x15'),_0x10d077,'request\x20sent',JSON[_0x5262('0x16')](_0x3b0fe8));if(_0x3b0fe8['error']){if(_0x3b0fe8[_0x5262('0x17')][_0x5262('0x18')]===0x1f4){logger[_0x5262('0x17')]('MailAccount,\x20%s,\x20%s',_0x10d077,_0x3b0fe8[_0x5262('0x17')][_0x5262('0x19')]);return _0x1b3def(_0x3b0fe8[_0x5262('0x17')]['message']);}logger['error'](_0x5262('0x13'),_0x10d077,_0x3b0fe8[_0x5262('0x17')][_0x5262('0x19')]);return _0x4fcd74(_0x3b0fe8[_0x5262('0x17')]['message']);}else{logger[_0x5262('0x1a')]('MailAccount,\x20%s,\x20%s',_0x10d077,'request\x20sent');_0x4fcd74(_0x3b0fe8[_0x5262('0x1b')][_0x5262('0x19')]);}})[_0x5262('0x1c')](function(_0x51c487){logger[_0x5262('0x17')]('MailAccount,\x20%s,\x20%s',_0x10d077,_0x51c487);_0x1b3def(_0x51c487);});});}function respondWithStatusCode(_0x41bf83,_0xe4ef37){_0xe4ef37=_0xe4ef37||0xcc;return function(_0x1578a2){if(_0x1578a2){return _0x41bf83[_0x5262('0x1d')](_0xe4ef37);}return _0x41bf83[_0x5262('0x1e')](_0xe4ef37)[_0x5262('0x1f')]();};}function respondWithResult(_0x280f00,_0x3e6165){_0x3e6165=_0x3e6165||0xc8;return function(_0x439204){if(_0x439204){return _0x280f00['status'](_0x3e6165)[_0x5262('0x20')](_0x439204);}};}function respondWithFilteredResult(_0x2aced7,_0x24f38e){return function(_0x3aceb9){if(_0x3aceb9){var _0x256ca0=typeof _0x24f38e[_0x5262('0x21')]==='undefined'&&typeof _0x24f38e['limit']==='undefined';var _0x2fcca1=_0x3aceb9['count'];var _0xd91b3c=_0x256ca0?0x0:_0x24f38e['offset'];var _0x3a990d=_0x256ca0?_0x3aceb9[_0x5262('0x22')]:_0x24f38e[_0x5262('0x21')]+_0x24f38e[_0x5262('0x23')];var _0x5f4d3a;if(_0x3a990d>=_0x2fcca1){_0x3a990d=_0x2fcca1;_0x5f4d3a=0xc8;}else{_0x5f4d3a=0xce;}_0x2aced7[_0x5262('0x1e')](_0x5f4d3a);return _0x2aced7[_0x5262('0x24')](_0x5262('0x25'),_0xd91b3c+'-'+_0x3a990d+'/'+_0x2fcca1)[_0x5262('0x20')](_0x3aceb9);}return null;};}function saveUpdates(_0x1570da){return function(_0xfc0fde){if(_0xfc0fde){return _0xfc0fde[_0x5262('0x26')](_0x1570da)[_0x5262('0x12')](function(_0x1ccc13){return _0x1ccc13;});}return null;};}function removeEntity(_0x364f4d){return function(_0x291f2d){if(_0x291f2d){return _0x291f2d['destroy']()['then'](function(){var _0x3e814f=_0x291f2d['get']({'plain':!![]});var _0x3ff187='MailAccounts';return db[_0x5262('0x27')][_0x5262('0x28')]({'where':{'type':_0x3ff187,'resourceId':_0x3e814f['id']}})[_0x5262('0x12')](function(){return _0x291f2d;});})[_0x5262('0x12')](function(){_0x364f4d[_0x5262('0x1e')](0xcc)[_0x5262('0x1f')]();});}};}function handleEntityNotFound(_0x22e952){return function(_0x4be2c6){if(!_0x4be2c6){_0x22e952[_0x5262('0x1d')](0x194);}return _0x4be2c6;};}function handleError(_0x21404f,_0x55de8d){_0x55de8d=_0x55de8d||0x1f4;return function(_0x312e69){logger[_0x5262('0x17')](_0x312e69[_0x5262('0x29')]);if(_0x312e69[_0x5262('0x2a')]){delete _0x312e69[_0x5262('0x2a')];}_0x21404f[_0x5262('0x1e')](_0x55de8d)[_0x5262('0x2b')](_0x312e69);};}function getImapHost(_0x4674f5){switch(_0x4674f5){case _0x5262('0x2c'):return'imap.gmail.com';case'yahoo':return _0x5262('0x2d');case'hotmail':return _0x5262('0x2e');case _0x5262('0x2f'):return _0x5262('0x30');}throw new Error(_0x5262('0x31'),_0x4674f5);}function getSmtpHost(_0x26fefb){switch(_0x26fefb){case _0x5262('0x2c'):return _0x5262('0x32');case _0x5262('0x33'):return _0x5262('0x34');case'hotmail':return _0x5262('0x35');case'outlook365':return _0x5262('0x36');}throw new Error(_0x5262('0x31'),_0x26fefb);}function getAuthenticationOptions(_0x16061c,_0x1b67df){var _0x44d9a9={};var _0x231a45={};if(_0x16061c){_0x44d9a9[_0x5262('0x37')]=_0x231a45['user']=_0x1b67df[_0x5262('0x38')];_0x44d9a9[_0x5262('0x39')]=_0x231a45[_0x5262('0x3a')]=_0x1b67df[_0x5262('0x39')];if(_0x1b67df[_0x5262('0x3b')]){_0x44d9a9[_0x5262('0x3b')]=_0x231a45[_0x5262('0x3b')]=!![];_0x44d9a9[_0x5262('0x3c')]=_0x231a45['CloudProviderId']=_0x1b67df[_0x5262('0x3c')];_0x44d9a9[_0x5262('0x39')]=_0x231a45[_0x5262('0x3a')]=null;}else{_0x44d9a9[_0x5262('0x3c')]=_0x231a45[_0x5262('0x3c')]=null;}_0x44d9a9[_0x5262('0x3d')]=getImapHost(_0x16061c);_0x44d9a9['port']=0x3e1;_0x231a45['host']=getSmtpHost(_0x16061c);_0x231a45[_0x5262('0x3e')]=0x24b;_0x231a45[_0x5262('0x3f')]=![];_0x44d9a9['service']=_0x231a45[_0x5262('0x40')]=null;}else{if(_0x1b67df[_0x5262('0x41')]){_0x44d9a9[_0x5262('0x37')]=_0x231a45[_0x5262('0x37')]=_0x1b67df[_0x5262('0x38')];_0x44d9a9[_0x5262('0x39')]=_0x231a45[_0x5262('0x3a')]=_0x1b67df[_0x5262('0x39')];}else{_0x44d9a9[_0x5262('0x41')]=_0x231a45[_0x5262('0x41')]=![];_0x44d9a9[_0x5262('0x37')]=_0x231a45[_0x5262('0x37')]=null;_0x44d9a9['password']=_0x231a45[_0x5262('0x3a')]=null;}_0x44d9a9['host']=_0x1b67df[_0x5262('0x42')][_0x5262('0x3d')];_0x44d9a9[_0x5262('0x3e')]=_0x1b67df[_0x5262('0x42')][_0x5262('0x3e')];_0x231a45[_0x5262('0x3d')]=_0x1b67df[_0x5262('0x43')][_0x5262('0x3d')];_0x231a45[_0x5262('0x3e')]=_0x1b67df[_0x5262('0x43')]['port'];}return{'Imap':_0x44d9a9,'Smtp':_0x231a45};}exports['index']=function(_0x37d834,_0x3fdc0e){var _0x21431d={'include':[{'model':db['MailServerIn'],'as':_0x5262('0x42')},{'model':db[_0x5262('0x44')],'as':_0x5262('0x43')},{'model':db[_0x5262('0x45')],'as':_0x5262('0x46')}]},_0x51783d={},_0x44adbd={'count':0x0,'rows':[]};var _0x22900b=_['map'](db[_0x5262('0x47')][_0x5262('0x48')],function(_0x121141){return{'name':_0x121141[_0x5262('0x49')],'type':_0x121141[_0x5262('0x4a')][_0x5262('0x4b')]};});_0x51783d[_0x5262('0x4c')]=_['map'](_0x22900b,_0x5262('0x2a'));_0x51783d['query']=_[_0x5262('0x4d')](_0x37d834[_0x5262('0x4e')]);_0x51783d[_0x5262('0x4f')]=_[_0x5262('0x50')](_0x51783d[_0x5262('0x4c')],_0x51783d['query']);_0x21431d[_0x5262('0x51')]=_[_0x5262('0x50')](_0x51783d['model'],qs[_0x5262('0x52')](_0x37d834[_0x5262('0x4e')]['fields']));_0x21431d[_0x5262('0x51')]=_0x21431d[_0x5262('0x51')][_0x5262('0x53')]?_0x21431d[_0x5262('0x51')]:_0x51783d[_0x5262('0x4c')];if(!_0x37d834['query']['hasOwnProperty']('nolimit')){_0x21431d['limit']=qs[_0x5262('0x23')](_0x37d834[_0x5262('0x4e')][_0x5262('0x23')]);_0x21431d[_0x5262('0x21')]=qs[_0x5262('0x21')](_0x37d834['query'][_0x5262('0x21')]);}_0x21431d[_0x5262('0x54')]=qs['sort'](_0x37d834[_0x5262('0x4e')][_0x5262('0x55')]);_0x21431d['where']=qs[_0x5262('0x4f')](_[_0x5262('0x56')](_0x37d834[_0x5262('0x4e')],_0x51783d[_0x5262('0x4f')]),_0x22900b);if(_0x37d834[_0x5262('0x4e')][_0x5262('0x57')]){_0x21431d[_0x5262('0x58')]=_[_0x5262('0x59')](_0x21431d[_0x5262('0x58')],{'$or':_['map'](_0x22900b,function(_0x660163){if(_0x660163['type']!=='VIRTUAL'){var _0x2254a5={};_0x2254a5[_0x660163[_0x5262('0x2a')]]={'$like':'%'+_0x37d834[_0x5262('0x4e')]['filter']+'%'};return _0x2254a5;}})});}_0x21431d=_['merge']({},_0x21431d,_0x37d834[_0x5262('0x5a')]);var _0x468f57={'where':_0x21431d[_0x5262('0x58')]};return db[_0x5262('0x47')][_0x5262('0x22')](_0x468f57)[_0x5262('0x12')](function(_0x40e788){_0x44adbd[_0x5262('0x22')]=_0x40e788;if(_0x37d834[_0x5262('0x4e')][_0x5262('0x5b')]){_0x21431d[_0x5262('0x5c')]=[{'all':!![]}];}return db[_0x5262('0x47')][_0x5262('0x5d')](_0x21431d);})['then'](function(_0x44da78){_0x44adbd[_0x5262('0x5e')]=_0x44da78;return _0x44adbd;})[_0x5262('0x12')](respondWithFilteredResult(_0x3fdc0e,_0x21431d))[_0x5262('0x1c')](handleError(_0x3fdc0e,null));};exports[_0x5262('0x5f')]=function(_0x3d8361,_0x3b6339){var _0xd2e6c1={'raw':![],'where':{'id':_0x3d8361[_0x5262('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x5262('0x42')},{'model':db[_0x5262('0x44')],'as':'Smtp'},{'model':db[_0x5262('0x45')],'as':_0x5262('0x46')}]},_0x2fe9f9={};_0x2fe9f9[_0x5262('0x4c')]=_[_0x5262('0x4d')](db[_0x5262('0x47')][_0x5262('0x48')]);_0x2fe9f9[_0x5262('0x4e')]=_[_0x5262('0x4d')](_0x3d8361[_0x5262('0x4e')]);_0x2fe9f9[_0x5262('0x4f')]=_['intersection'](_0x2fe9f9['model'],_0x2fe9f9[_0x5262('0x4e')]);_0xd2e6c1[_0x5262('0x51')]=_[_0x5262('0x50')](_0x2fe9f9['model'],qs[_0x5262('0x52')](_0x3d8361[_0x5262('0x4e')][_0x5262('0x52')]));_0xd2e6c1[_0x5262('0x51')]=_0xd2e6c1['attributes'][_0x5262('0x53')]?_0xd2e6c1[_0x5262('0x51')]:_0x2fe9f9[_0x5262('0x4c')];if(_0x3d8361[_0x5262('0x4e')][_0x5262('0x5b')]){_0xd2e6c1[_0x5262('0x5c')]=[{'all':!![]}];}_0xd2e6c1=_['merge']({},_0xd2e6c1,_0x3d8361[_0x5262('0x5a')]);return db[_0x5262('0x47')][_0x5262('0x61')](_0xd2e6c1)['then'](handleEntityNotFound(_0x3b6339,null))[_0x5262('0x12')](respondWithResult(_0x3b6339,null))['catch'](handleError(_0x3b6339,null));};exports['update']=function(_0x4e1d4e,_0x36ecc7){if(_0x4e1d4e[_0x5262('0x62')]['id']){delete _0x4e1d4e[_0x5262('0x62')]['id'];}var _0x2748db=_0x4e1d4e[_0x5262('0x62')][_0x5262('0x63')]==='custom'?null:_0x4e1d4e['body']['provider'];var _0xebe3a9=_0x4e1d4e[_0x5262('0x62')][_0x5262('0x42')]||{};var _0x1cbc9f=_0x4e1d4e[_0x5262('0x62')][_0x5262('0x43')]||{};if(_0x2748db){_0xebe3a9[_0x5262('0x3d')]=getImapHost(_0x2748db);_0xebe3a9['port']=0x3e1;_0x1cbc9f[_0x5262('0x3d')]=getSmtpHost(_0x2748db);_0x1cbc9f[_0x5262('0x3e')]=0x24b;_0x1cbc9f[_0x5262('0x3f')]=![];}if(_0x1cbc9f['modernAuthentication']){_0x1cbc9f[_0x5262('0x3f')]=![];}else{_0x1cbc9f[_0x5262('0x3c')]=null;}if(!_0xebe3a9[_0x5262('0x3b')])_0xebe3a9['CloudProviderId']=null;_0x4e1d4e['body']['Imap']=_0xebe3a9;_0x4e1d4e[_0x5262('0x62')][_0x5262('0x43')]=_0x1cbc9f;return db[_0x5262('0x47')][_0x5262('0x61')]({'where':{'id':_0x4e1d4e[_0x5262('0x60')]['id']},'include':[{'model':db[_0x5262('0x64')],'as':_0x5262('0x42')},{'model':db[_0x5262('0x44')],'as':_0x5262('0x43')},{'model':db[_0x5262('0x45')],'as':_0x5262('0x46')}]})['then'](handleEntityNotFound(_0x36ecc7,null))[_0x5262('0x12')](function(_0x1f0b03){if(!_0x1f0b03)throw new Error(_0x5262('0x65'));if(_0x1f0b03['service'])delete _0x4e1d4e[_0x5262('0x62')][_0x5262('0x42')];return _0x1f0b03;})[_0x5262('0x12')](saveUpdates(_0x4e1d4e[_0x5262('0x62')],null))['then'](function(_0x41e2fe){if(!_0x4e1d4e['body'][_0x5262('0x42')])return _0x41e2fe;return db[_0x5262('0x64')][_0x5262('0x26')](_0x4e1d4e[_0x5262('0x62')][_0x5262('0x42')],{'where':{'MailAccountId':_0x41e2fe['id']}})[_0x5262('0x12')](function(){return _0x41e2fe;});})['then'](function(_0x58cc38){if(!_0x4e1d4e[_0x5262('0x62')][_0x5262('0x43')])return _0x58cc38;return db[_0x5262('0x44')][_0x5262('0x26')](_0x4e1d4e[_0x5262('0x62')][_0x5262('0x43')],{'where':{'MailAccountId':_0x58cc38['id']}})[_0x5262('0x12')](function(){return _0x58cc38;});})[_0x5262('0x12')](respondWithResult(_0x36ecc7,null))[_0x5262('0x1c')](handleError(_0x36ecc7,null));};exports[_0x5262('0x66')]=function(_0x3b0aed,_0x5355d3){return db[_0x5262('0x47')][_0x5262('0x66')]()[_0x5262('0x12')](respondWithResult(_0x5355d3,null))['catch'](handleError(_0x5355d3,null));};exports[_0x5262('0x67')]=function(_0x5cbcb1,_0x108c56){if(_0x5cbcb1[_0x5262('0x62')]['id']){delete _0x5cbcb1[_0x5262('0x62')]['id'];}return db[_0x5262('0x47')]['find']({'where':{'id':_0x5cbcb1[_0x5262('0x60')]['id']}})['then'](handleEntityNotFound(_0x108c56,null))[_0x5262('0x12')](function(_0x162497){if(_0x162497){_0x5cbcb1['body'][_0x5262('0x68')]=_0x162497['id'];return db[_0x5262('0x69')][_0x5262('0x6a')](_0x5cbcb1['body']);}})[_0x5262('0x12')](respondWithResult(_0x108c56,null))[_0x5262('0x1c')](handleError(_0x108c56,null));};exports[_0x5262('0x6b')]=function(_0xdd7372,_0x4281f4){var _0x25ccbd={'raw':![],'where':{}};var _0x2a8eed={};var _0x5aa25d={'count':0x0,'rows':[]};return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0xdd7372[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x4281f4,null))[_0x5262('0x12')](function(_0x662345){if(_0x662345){_0x2a8eed[_0x5262('0x4c')]=_[_0x5262('0x4d')](db[_0x5262('0x69')][_0x5262('0x48')]);_0x2a8eed[_0x5262('0x4e')]=_['keys'](_0xdd7372[_0x5262('0x4e')]);_0x2a8eed[_0x5262('0x4f')]=_[_0x5262('0x50')](_0x2a8eed[_0x5262('0x4c')],_0x2a8eed[_0x5262('0x4e')]);_0x25ccbd[_0x5262('0x51')]=_[_0x5262('0x50')](_0x2a8eed['model'],qs[_0x5262('0x52')](_0xdd7372['query'][_0x5262('0x52')]));_0x25ccbd['attributes']=_0x25ccbd[_0x5262('0x51')][_0x5262('0x53')]?_0x25ccbd[_0x5262('0x51')]:_0x2a8eed['model'];if(!_0xdd7372[_0x5262('0x4e')][_0x5262('0x6d')](_0x5262('0x6e'))){_0x25ccbd['limit']=qs[_0x5262('0x23')](_0xdd7372['query'][_0x5262('0x23')]);_0x25ccbd[_0x5262('0x21')]=qs[_0x5262('0x21')](_0xdd7372[_0x5262('0x4e')][_0x5262('0x21')]);}_0x25ccbd[_0x5262('0x54')]=qs['sort'](_0xdd7372[_0x5262('0x4e')][_0x5262('0x55')]);_0x25ccbd[_0x5262('0x58')]=qs[_0x5262('0x4f')](_['pick'](_0xdd7372[_0x5262('0x4e')],_0x2a8eed[_0x5262('0x4f')]));_0x25ccbd[_0x5262('0x58')]['MailAccountId']=_0x662345['id'];if(_0xdd7372['query'][_0x5262('0x57')]){_0x25ccbd[_0x5262('0x58')]=_[_0x5262('0x59')](_0x25ccbd[_0x5262('0x58')],{'$or':_['map'](_0x25ccbd['attributes'],function(_0x37ccab){var _0x39cf4f={};_0x39cf4f[_0x37ccab]={'$like':'%'+_0xdd7372['query'][_0x5262('0x57')]+'%'};return _0x39cf4f;})});}_0x25ccbd=_[_0x5262('0x59')]({},_0x25ccbd,_0xdd7372[_0x5262('0x5a')]);return db[_0x5262('0x69')][_0x5262('0x22')]({'where':_0x25ccbd[_0x5262('0x58')]})[_0x5262('0x12')](function(_0x20bd24){_0x5aa25d['count']=_0x20bd24;if(_0xdd7372['query']['includeAll']){_0x25ccbd[_0x5262('0x5c')]=[{'all':!![]}];}return db[_0x5262('0x69')]['findAll'](_0x25ccbd);})[_0x5262('0x12')](function(_0xc497f3){_0x5aa25d[_0x5262('0x5e')]=_0xc497f3;return _0x5aa25d;});}})[_0x5262('0x12')](respondWithFilteredResult(_0x4281f4,_0x25ccbd))['catch'](handleError(_0x4281f4,null));};exports[_0x5262('0x6f')]=function(_0x50cfe3,_0x11bde8){return db[_0x5262('0x47')][_0x5262('0x61')]({'where':{'id':_0x50cfe3[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x11bde8,null))['then'](function(_0x4b6766){if(_0x4b6766){return _0x4b6766[_0x5262('0x6f')](_0x50cfe3[_0x5262('0x4e')][_0x5262('0x70')]);}})[_0x5262('0x12')](respondWithStatusCode(_0x11bde8,null))[_0x5262('0x1c')](handleError(_0x11bde8,null));};exports[_0x5262('0x71')]=function(_0xe64ea3,_0x2a1478){if(_0xe64ea3[_0x5262('0x62')]['id']){delete _0xe64ea3[_0x5262('0x62')]['id'];}return db[_0x5262('0x47')][_0x5262('0x61')]({'where':{'id':_0xe64ea3[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x2a1478,null))[_0x5262('0x12')](function(_0x3fe04d){if(_0x3fe04d){_0xe64ea3[_0x5262('0x62')][_0x5262('0x68')]=_0x3fe04d['id'];return db['CannedAnswer'][_0x5262('0x6a')](_0xe64ea3[_0x5262('0x62')]);}})[_0x5262('0x12')](respondWithResult(_0x2a1478,null))[_0x5262('0x1c')](handleError(_0x2a1478,null));};exports[_0x5262('0x72')]=function(_0x105baf,_0x50f685){var _0x61bf4c={'raw':![],'where':{}};var _0xa25476={};var _0x301413={'count':0x0,'rows':[]};return db['MailAccount'][_0x5262('0x6c')]({'where':{'id':_0x105baf[_0x5262('0x60')]['id']}})['then'](handleEntityNotFound(_0x50f685,null))['then'](function(_0xc4c0f3){if(_0xc4c0f3){_0xa25476[_0x5262('0x4c')]=_[_0x5262('0x4d')](db[_0x5262('0x73')][_0x5262('0x48')]);_0xa25476['query']=_['keys'](_0x105baf[_0x5262('0x4e')]);_0xa25476[_0x5262('0x4f')]=_['intersection'](_0xa25476[_0x5262('0x4c')],_0xa25476[_0x5262('0x4e')]);_0x61bf4c[_0x5262('0x51')]=_[_0x5262('0x50')](_0xa25476[_0x5262('0x4c')],qs['fields'](_0x105baf[_0x5262('0x4e')][_0x5262('0x52')]));_0x61bf4c[_0x5262('0x51')]=_0x61bf4c[_0x5262('0x51')][_0x5262('0x53')]?_0x61bf4c['attributes']:_0xa25476[_0x5262('0x4c')];if(!_0x105baf[_0x5262('0x4e')][_0x5262('0x6d')](_0x5262('0x6e'))){_0x61bf4c['limit']=qs[_0x5262('0x23')](_0x105baf[_0x5262('0x4e')][_0x5262('0x23')]);_0x61bf4c['offset']=qs[_0x5262('0x21')](_0x105baf['query'][_0x5262('0x21')]);}_0x61bf4c[_0x5262('0x54')]=qs[_0x5262('0x55')](_0x105baf['query'][_0x5262('0x55')]);_0x61bf4c['where']=qs[_0x5262('0x4f')](_['pick'](_0x105baf[_0x5262('0x4e')],_0xa25476[_0x5262('0x4f')]));_0x61bf4c['where'][_0x5262('0x68')]=_0xc4c0f3['id'];if(_0x105baf['query'][_0x5262('0x57')]){_0x61bf4c[_0x5262('0x58')]=_[_0x5262('0x59')](_0x61bf4c[_0x5262('0x58')],{'$or':_[_0x5262('0x74')](_0x61bf4c['attributes'],function(_0x1f6d6e){var _0x28184d={};_0x28184d[_0x1f6d6e]={'$like':'%'+_0x105baf[_0x5262('0x4e')][_0x5262('0x57')]+'%'};return _0x28184d;})});}_0x61bf4c=_[_0x5262('0x59')]({},_0x61bf4c,_0x105baf[_0x5262('0x5a')]);return db[_0x5262('0x73')][_0x5262('0x22')]({'where':_0x61bf4c[_0x5262('0x58')]})[_0x5262('0x12')](function(_0x39db62){_0x301413['count']=_0x39db62;if(_0x105baf[_0x5262('0x4e')]['includeAll']){_0x61bf4c[_0x5262('0x5c')]=[{'all':!![]}];}return db[_0x5262('0x73')][_0x5262('0x5d')](_0x61bf4c);})['then'](function(_0x33160e){_0x301413['rows']=_0x33160e;return _0x301413;});}})['then'](respondWithFilteredResult(_0x50f685,_0x61bf4c))[_0x5262('0x1c')](handleError(_0x50f685,null));};exports['removeAnswers']=function(_0x119326,_0x3ebee5){return db['MailAccount'][_0x5262('0x61')]({'where':{'id':_0x119326[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x3ebee5,null))[_0x5262('0x12')](function(_0x131148){if(_0x131148){return _0x131148[_0x5262('0x75')](_0x119326[_0x5262('0x4e')]['ids']);}})['then'](respondWithStatusCode(_0x3ebee5,null))[_0x5262('0x1c')](handleError(_0x3ebee5,null));};exports[_0x5262('0x6a')]=function(_0x4574a0,_0x5a78cc){var _0x356f0a={'name':_0x4574a0[_0x5262('0x62')][_0x5262('0x2a')],'key':_0x4574a0[_0x5262('0x62')][_0x5262('0x4b')],'provider':_0x4574a0[_0x5262('0x62')]['provider']===_0x5262('0x76')?null:_0x4574a0[_0x5262('0x62')][_0x5262('0x63')],'email':_0x4574a0[_0x5262('0x62')]['email'],'ListId':_0x4574a0[_0x5262('0x62')]['ListId'],'active':!_[_0x5262('0x77')](_0x4574a0[_0x5262('0x62')][_0x5262('0x78')])?_0x4574a0[_0x5262('0x62')][_0x5262('0x78')]:!![],'description':_0x4574a0['body'][_0x5262('0x79')]||null};var _0x59a343=getAuthenticationOptions(_0x356f0a[_0x5262('0x63')],_0x4574a0[_0x5262('0x62')]);_0x356f0a['Imap']=_0x59a343[_0x5262('0x42')];_0x356f0a[_0x5262('0x43')]=_0x59a343[_0x5262('0x43')];return db[_0x5262('0x47')]['create'](_0x356f0a,{'include':[{'model':db[_0x5262('0x44')],'as':'Smtp'},{'model':db[_0x5262('0x64')],'as':'Imap'}]})[_0x5262('0x12')](function(_0x3a1ec7){var _0x205fcb=_0x4574a0['user'][_0x5262('0x7a')]({'plain':!![]});if(!_0x205fcb)throw new Error(_0x5262('0x7b'));if(_0x205fcb[_0x5262('0x7c')]===_0x5262('0x37')){var _0x17a567=_0x3a1ec7[_0x5262('0x7a')]({'plain':!![]});return db[_0x5262('0x7d')][_0x5262('0x61')]({'where':{'name':_0x5262('0x7e'),'userProfileId':_0x205fcb[_0x5262('0x7f')]},'raw':!![]})[_0x5262('0x12')](function(_0x5ebe0d){if(_0x5ebe0d&&_0x5ebe0d[_0x5262('0x80')]===0x0){return db[_0x5262('0x27')][_0x5262('0x6a')]({'name':_0x17a567['name'],'resourceId':_0x17a567['id'],'type':_0x5ebe0d[_0x5262('0x2a')],'sectionId':_0x5ebe0d['id']},{})[_0x5262('0x12')](function(){return _0x3a1ec7;});}else{return _0x3a1ec7;}})['catch'](function(_0x389d7c){logger[_0x5262('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x389d7c);throw _0x389d7c;});}return _0x3a1ec7;})[_0x5262('0x12')](respondWithResult(_0x5a78cc,0xc9))['catch'](handleError(_0x5a78cc,null));};exports[_0x5262('0x81')]=function(_0x24e7d1,_0x34b76c){return db['MailAccount'][_0x5262('0x6c')]({'where':{'id':_0x24e7d1[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x34b76c,null))['then'](function(_0x55af30){if(_0x55af30){return _0x55af30[_0x5262('0x81')]();}return null;})[_0x5262('0x12')](respondWithResult(_0x34b76c,null))[_0x5262('0x1c')](handleError(_0x34b76c,null));};exports[_0x5262('0x82')]=function(_0x4fb243,_0x31f446){if(_0x4fb243[_0x5262('0x62')]['id']){delete _0x4fb243[_0x5262('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x4fb243['params']['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x31f446,null))['then'](function(_0x492080){if(_0x492080){_0x4fb243[_0x5262('0x62')][_0x5262('0x68')]=_0x492080['id'];return db[_0x5262('0x64')]['create'](_0x4fb243[_0x5262('0x62')]);}})['then'](respondWithResult(_0x31f446,null))['catch'](handleError(_0x31f446,null));};exports[_0x5262('0x83')]=function(_0x5a7f31,_0x115f1a){return db['MailAccount'][_0x5262('0x6c')]({'where':{'id':_0x5a7f31['params']['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x115f1a,null))[_0x5262('0x12')](function(_0x3d7b8b){if(_0x3d7b8b){return _0x3d7b8b[_0x5262('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x115f1a,null))['catch'](handleError(_0x115f1a,null));};exports['getSmtp']=function(_0x141ee2,_0x134b28){return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0x141ee2[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x134b28,null))[_0x5262('0x12')](function(_0x515a8d){if(_0x515a8d){return _0x515a8d[_0x5262('0x85')]();}return null;})['then'](respondWithResult(_0x134b28,null))['catch'](handleError(_0x134b28,null));};exports[_0x5262('0x86')]=function(_0x166380,_0x5bbd67){if(_0x166380[_0x5262('0x62')]['id']){delete _0x166380[_0x5262('0x62')]['id'];}return db['MailAccount'][_0x5262('0x61')]({'where':{'id':_0x166380[_0x5262('0x60')]['id']}})['then'](handleEntityNotFound(_0x5bbd67,null))[_0x5262('0x12')](function(_0x2c7dba){if(_0x2c7dba){_0x166380[_0x5262('0x62')][_0x5262('0x68')]=_0x2c7dba['id'];return db['MailServerOut'][_0x5262('0x6a')](_0x166380[_0x5262('0x62')]);}})[_0x5262('0x12')](respondWithResult(_0x5bbd67,null))[_0x5262('0x1c')](handleError(_0x5bbd67,null));};exports[_0x5262('0x87')]=function(_0x3b3320,_0x152a75){return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0x3b3320[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x152a75,null))[_0x5262('0x12')](function(_0x2675f8){if(_0x2675f8){return _0x2675f8[_0x5262('0x88')](null);}return null;})[_0x5262('0x12')](respondWithStatusCode(_0x152a75,null))[_0x5262('0x1c')](handleError(_0x152a75,null));};exports['addInteraction']=function(_0x246609,_0x128db9){return db[_0x5262('0x89')][_0x5262('0x61')]({'where':{'id':_0x246609[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x128db9,null))[_0x5262('0x12')](function(_0xfcb0d0){if(_0xfcb0d0){return _0xfcb0d0[_0x5262('0x8a')](_0x246609['body']['ids'],_[_0x5262('0x8b')](_0x246609[_0x5262('0x62')],[_0x5262('0x70'),'id'])||{});}})['then'](respondWithResult(_0x128db9,null))['catch'](handleError(_0x128db9,null));};exports[_0x5262('0x8c')]=function(_0x4d10a8,_0x344ee6){var _0xd188ea={'raw':![],'where':{}};var _0x3fc488={};var _0x5c5895={'count':0x0,'rows':[]};return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0x4d10a8[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x344ee6,null))[_0x5262('0x12')](function(_0x40685a){if(_0x40685a){_0x3fc488['model']=_['keys'](db[_0x5262('0x89')][_0x5262('0x48')]);_0x3fc488[_0x5262('0x4e')]=_[_0x5262('0x4d')](_0x4d10a8[_0x5262('0x4e')]);_0x3fc488[_0x5262('0x4f')]=_['intersection'](_0x3fc488[_0x5262('0x4c')],_0x3fc488['query']);_0xd188ea['attributes']=_['intersection'](_0x3fc488[_0x5262('0x4c')],qs[_0x5262('0x52')](_0x4d10a8[_0x5262('0x4e')][_0x5262('0x52')]));_0xd188ea[_0x5262('0x51')]=_0xd188ea[_0x5262('0x51')][_0x5262('0x53')]?_0xd188ea[_0x5262('0x51')]:_0x3fc488[_0x5262('0x4c')];if(!_0x4d10a8[_0x5262('0x4e')][_0x5262('0x6d')]('nolimit')){_0xd188ea[_0x5262('0x23')]=qs[_0x5262('0x23')](_0x4d10a8['query']['limit']);_0xd188ea[_0x5262('0x21')]=qs[_0x5262('0x21')](_0x4d10a8[_0x5262('0x4e')]['offset']);}_0xd188ea[_0x5262('0x54')]=qs[_0x5262('0x55')](_0x4d10a8[_0x5262('0x4e')][_0x5262('0x55')]);_0xd188ea[_0x5262('0x58')]=qs[_0x5262('0x4f')](_[_0x5262('0x56')](_0x4d10a8[_0x5262('0x4e')],_0x3fc488[_0x5262('0x4f')]));_0xd188ea[_0x5262('0x58')][_0x5262('0x68')]=_0x40685a['id'];if(_0x4d10a8[_0x5262('0x4e')][_0x5262('0x57')]){_0xd188ea[_0x5262('0x58')]=_['merge'](_0xd188ea[_0x5262('0x58')],{'$or':_[_0x5262('0x74')](_0xd188ea[_0x5262('0x51')],function(_0x987362){var _0x5d1fc8={};_0x5d1fc8[_0x987362]={'$like':'%'+_0x4d10a8[_0x5262('0x4e')][_0x5262('0x57')]+'%'};return _0x5d1fc8;})});}_0xd188ea=_[_0x5262('0x59')]({},_0xd188ea,_0x4d10a8[_0x5262('0x5a')]);return db[_0x5262('0x89')][_0x5262('0x22')]({'where':_0xd188ea['where']})[_0x5262('0x12')](function(_0x715752){_0x5c5895[_0x5262('0x22')]=_0x715752;if(_0x4d10a8[_0x5262('0x4e')][_0x5262('0x5b')]){_0xd188ea[_0x5262('0x5c')]=[{'model':db[_0x5262('0x8d')],'as':_0x5262('0x8e'),'required':![]},{'model':db[_0x5262('0x8f')],'as':'Owner','attributes':[_0x5262('0x2a'),_0x5262('0x90'),_0x5262('0x91')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x4d10a8[_0x5262('0x4e')][_0x5262('0x92')]?{'id':_0x4d10a8['query']['tag']}:undefined,'required':_0x4d10a8[_0x5262('0x4e')][_0x5262('0x92')]?!![]:![]}];}return db[_0x5262('0x89')][_0x5262('0x5d')](_0xd188ea);})[_0x5262('0x12')](function(_0x58efbc){_0x5c5895['rows']=_0x58efbc;return _0x5c5895;});}})['then'](respondWithFilteredResult(_0x344ee6,_0xd188ea))[_0x5262('0x1c')](handleError(_0x344ee6,null));};exports[_0x5262('0x93')]=function addApplications(_0x1bd4ad,_0x291a24){var _0x1595aa=_0x1bd4ad[_0x5262('0x60')]['id'];var _0x32fde2=_0x1bd4ad[_0x5262('0x62')];var _0x47f965=0xc8;var _0x4a4294=null;return db[_0x5262('0x94')][_0x5262('0x95')]({'isolationLevel':db[_0x5262('0x94')][_0x5262('0x96')][_0x5262('0x97')][_0x5262('0x98')]},function(_0x358dcc){return db[_0x5262('0x47')]['findOne']({'where':{'id':_0x1595aa},'transaction':_0x358dcc})[_0x5262('0x12')](function(_0xc9ba1c){if(_0xc9ba1c){return db[_0x5262('0x99')][_0x5262('0x28')]({'where':{'MailAccountId':_0x1595aa},'transaction':_0x358dcc})[_0x5262('0x12')](function(){var _0x517cff=_['map'](_0x32fde2,function(_0x33fd4c){_0x33fd4c[_0x5262('0x68')]=_0x1595aa;return _0x33fd4c;});return db['MailApplication'][_0x5262('0x9a')](_0x517cff,{'transaction':_0x358dcc});});}else{_0x47f965=0x194;_0x4a4294=[];}});})[_0x5262('0x12')](function(){if(_0x47f965!==0x194){return db[_0x5262('0x99')][_0x5262('0x9b')]({'where':{'MailAccountId':_0x1595aa},'order':'priority'})[_0x5262('0x12')](function(_0x2b6721){_0x4a4294=_0x2b6721;});}})[_0x5262('0x1c')](function(_0x4321b9){_0x47f965=0x1f4;logger[_0x5262('0x17')](_0x4321b9['stack']);if(_0x4321b9[_0x5262('0x2a')]){delete _0x4321b9['name'];}_0x4a4294=_0x4321b9;})[_0x5262('0x9c')](function(){if(_0x4a4294===null){_0x291a24[_0x5262('0x1d')](_0x47f965);}else{if(_0x47f965===0x1f4){_0x291a24[_0x5262('0x1e')](_0x47f965)[_0x5262('0x2b')](_0x4a4294);}else{_0x291a24[_0x5262('0x1e')](_0x47f965)[_0x5262('0x20')](_0x4a4294);}}});};exports[_0x5262('0x9d')]=function(_0x2196f1,_0x20a05b){var _0x1b29c1={};var _0x30ef61={};var _0x506911;var _0x5b838e;return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0x2196f1[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x20a05b,null))[_0x5262('0x12')](function(_0x4bef04){if(_0x4bef04){_0x506911=_0x4bef04;_0x30ef61[_0x5262('0x4c')]=_[_0x5262('0x4d')](db[_0x5262('0x99')][_0x5262('0x48')]);_0x30ef61[_0x5262('0x4e')]=_[_0x5262('0x4d')](_0x2196f1[_0x5262('0x4e')]);_0x30ef61['filters']=_[_0x5262('0x50')](_0x30ef61['model'],_0x30ef61['query']);_0x1b29c1[_0x5262('0x51')]=_[_0x5262('0x50')](_0x30ef61['model'],qs[_0x5262('0x52')](_0x2196f1['query'][_0x5262('0x52')]));_0x1b29c1['attributes']=_0x1b29c1[_0x5262('0x51')][_0x5262('0x53')]?_0x1b29c1[_0x5262('0x51')]:_0x30ef61[_0x5262('0x4c')];_0x1b29c1[_0x5262('0x54')]=qs[_0x5262('0x55')](_0x2196f1['query'][_0x5262('0x55')]);_0x1b29c1[_0x5262('0x58')]=qs[_0x5262('0x4f')](_[_0x5262('0x56')](_0x2196f1[_0x5262('0x4e')],_0x30ef61['filters']));if(_0x2196f1[_0x5262('0x4e')][_0x5262('0x57')]){_0x1b29c1[_0x5262('0x58')]=_[_0x5262('0x59')](_0x1b29c1[_0x5262('0x58')],{'$or':_[_0x5262('0x74')](_0x1b29c1['attributes'],function(_0x564680){var _0x547eb5={};_0x547eb5[_0x564680]={'$like':'%'+_0x2196f1[_0x5262('0x4e')][_0x5262('0x57')]+'%'};return _0x547eb5;})});}_0x1b29c1=_[_0x5262('0x59')]({},_0x1b29c1,_0x2196f1[_0x5262('0x5a')]);return _0x506911[_0x5262('0x9d')](_0x1b29c1);}})['then'](function(_0x22b5b6){if(_0x22b5b6){_0x5b838e=_0x22b5b6['length'];if(!_0x2196f1[_0x5262('0x4e')][_0x5262('0x6d')]('nolimit')){_0x1b29c1['limit']=qs[_0x5262('0x23')](_0x2196f1[_0x5262('0x4e')][_0x5262('0x23')]);_0x1b29c1[_0x5262('0x21')]=qs[_0x5262('0x21')](_0x2196f1[_0x5262('0x4e')][_0x5262('0x21')]);}return _0x506911['getApplications'](_0x1b29c1);}})['then'](function(_0x1b0778){if(_0x1b0778){return _0x1b0778?{'count':_0x5b838e,'rows':_0x1b0778}:null;}})[_0x5262('0x12')](respondWithResult(_0x20a05b,null))['catch'](handleError(_0x20a05b,null));};exports[_0x5262('0x9e')]=function(_0xed4fdf,_0x55d9f4){var _0x5742d8={'raw':!![],'where':{}};var _0x14358d={};var _0x425447={'count':0x0,'rows':[]};return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0xed4fdf['params']['id']}})['then'](handleEntityNotFound(_0x55d9f4,null))[_0x5262('0x12')](function(_0x9396e3){if(_0x9396e3){_0x14358d[_0x5262('0x4c')]=_[_0x5262('0x4d')](db[_0x5262('0x9f')]['rawAttributes']);_0x14358d['query']=_[_0x5262('0x4d')](_0xed4fdf[_0x5262('0x4e')]);_0x14358d[_0x5262('0x4f')]=_[_0x5262('0x50')](_0x14358d[_0x5262('0x4c')],_0x14358d[_0x5262('0x4e')]);_0x5742d8[_0x5262('0x51')]=_[_0x5262('0x50')](_0x14358d[_0x5262('0x4c')],qs[_0x5262('0x52')](_0xed4fdf['query']['fields']));_0x5742d8[_0x5262('0x51')]=_0x5742d8[_0x5262('0x51')][_0x5262('0x53')]?_0x5742d8['attributes']:_0x14358d[_0x5262('0x4c')];if(!_0xed4fdf[_0x5262('0x4e')][_0x5262('0x6d')](_0x5262('0x6e'))){_0x5742d8['limit']=qs[_0x5262('0x23')](_0xed4fdf[_0x5262('0x4e')]['limit']);_0x5742d8[_0x5262('0x21')]=qs[_0x5262('0x21')](_0xed4fdf['query'][_0x5262('0x21')]);}_0x5742d8[_0x5262('0x54')]=qs['sort'](_0xed4fdf[_0x5262('0x4e')]['sort']);_0x5742d8[_0x5262('0x58')]=qs[_0x5262('0x4f')](_[_0x5262('0x56')](_0xed4fdf[_0x5262('0x4e')],_0x14358d[_0x5262('0x4f')]));_0x5742d8['where'][_0x5262('0x68')]=_0x9396e3['id'];if(_0xed4fdf[_0x5262('0x4e')][_0x5262('0x57')]){_0x5742d8[_0x5262('0x58')]=_[_0x5262('0x59')](_0x5742d8[_0x5262('0x58')],{'$or':_['map'](_0x5742d8[_0x5262('0x51')],function(_0x32a9d6){var _0x4f0f0b={};_0x4f0f0b[_0x32a9d6]={'$like':'%'+_0xed4fdf[_0x5262('0x4e')][_0x5262('0x57')]+'%'};return _0x4f0f0b;})});}if(_0xed4fdf[_0x5262('0x4e')][_0x5262('0xa0')]){var _0x37e52c=_0xed4fdf[_0x5262('0x4e')][_0x5262('0xa0')]['split'](',');var _0x1f2359={};_0x1f2359[_0x37e52c[0x0]]={'$gte':moment(_0x37e52c[0x1])[_0x5262('0xa1')](_0x5262('0xa2'))};_0x5742d8[_0x5262('0x58')]=_[_0x5262('0x59')](_0x5742d8['where'],_0x1f2359);}_0x5742d8=_[_0x5262('0x59')]({},_0x5742d8,_0xed4fdf[_0x5262('0x5a')]);return db[_0x5262('0x9f')]['count']({'where':_0x5742d8[_0x5262('0x58')]})[_0x5262('0x12')](function(_0x3c3469){_0x425447[_0x5262('0x22')]=_0x3c3469;if(_0xed4fdf[_0x5262('0x4e')][_0x5262('0x5b')]){_0x5742d8[_0x5262('0x5c')]=[{'all':!![]}];}return db['MailMessage'][_0x5262('0x5d')](_0x5742d8);})[_0x5262('0x12')](function(_0x51d69d){if(_0xed4fdf[_0x5262('0x4e')][_0x5262('0xa3')]==='true'){for(var _0x1c7c47=0x0;_0x1c7c47<_0x51d69d[_0x5262('0x53')];_0x1c7c47++){_0x51d69d[_0x1c7c47][_0x5262('0x62')]=juice(_0x51d69d[_0x1c7c47]['body']);}}_0x425447[_0x5262('0x5e')]=_0x51d69d;return _0x425447;});}})[_0x5262('0x12')](respondWithFilteredResult(_0x55d9f4,_0x5742d8))[_0x5262('0x1c')](handleError(_0x55d9f4,null));};exports[_0x5262('0x2b')]=function(_0xf63af,_0x884a93){var _0x43894d,_0x9c91de={},_0x56434;if(_0xf63af['body']['to']){_0x56434=_0xf63af[_0x5262('0x62')]['to'][_0x5262('0xa4')](',')[0x0];}return db['MailAccount'][_0x5262('0x61')]({'where':{'id':_0xf63af['params']['id']},'include':[{'model':db[_0x5262('0xa5')],'as':_0x5262('0xa6'),'include':[{'model':db[_0x5262('0x8d')],'as':_0x5262('0xa7'),'where':{'email':_0x56434},'limit':0x1,'order':[[_0x5262('0xa8'),'DESC']]}]},{'model':db[_0x5262('0x44')],'as':_0x5262('0x43'),'raw':!![],'include':[{'model':db[_0x5262('0xa9')],'as':_0x5262('0xa9'),'raw':!![]}]}]})[_0x5262('0x12')](handleEntityNotFound(_0x884a93,null))[_0x5262('0x12')](function(_0x54e5a7){if(!_0x54e5a7)return;_0x43894d=_0x54e5a7;if(!_0x54e5a7[_0x5262('0x43')])throw new Error(_0x5262('0xaa'));if(_[_0x5262('0x77')](_0xf63af[_0x5262('0x62')]['from'])){_0xf63af[_0x5262('0x62')][_0x5262('0xab')]=util['format']('%s\x20<%s>',_0x54e5a7[_0x5262('0x2a')],_0x54e5a7[_0x5262('0xac')]||_0x54e5a7[_0x5262('0x43')][_0x5262('0x37')]);}if(_0xf63af[_0x5262('0x62')][_0x5262('0xad')]&&_0xf63af['body'][_0x5262('0xad')][_0x5262('0x53')]){for(var _0x54a058=0x0;_0x54a058<_0xf63af[_0x5262('0x62')][_0x5262('0xad')]['length'];_0x54a058+=0x1){_0xf63af['body'][_0x5262('0xad')][_0x54a058]={'filename':_0xf63af[_0x5262('0x62')][_0x5262('0xad')][_0x54a058][_0x5262('0x2a')],'path':path[_0x5262('0xae')](config[_0x5262('0xaf')],'server/files/attachments',_0xf63af[_0x5262('0x62')][_0x5262('0xad')][_0x54a058]['basename'])};}}var _0x3a1e26=_0x54e5a7['getSmtpOptions']();return respondWithRpcPromise(_0x5262('0xb0'),_0x5262('0xb1'),{'account':_0x3a1e26,'message':_0xf63af[_0x5262('0x62')]});})[_0x5262('0x12')](function(_0x19bab8){if(!_0x19bab8)return;_0x9c91de=_0x19bab8;if(!_0x43894d[_0x5262('0xa6')])throw new Error(_0x5262('0xb2'));if(_0x43894d['List'][_0x5262('0xa7')][_0x5262('0x53')])return _0x43894d[_0x5262('0xa6')][_0x5262('0xa7')][0x0];return db[_0x5262('0x8d')][_0x5262('0x6a')](_[_0x5262('0xb')](_0xf63af[_0x5262('0x62')],{'firstName':_0xf63af[_0x5262('0x62')]['to'],'email':_0xf63af[_0x5262('0x62')]['to'],'phone':_0xf63af[_0x5262('0x62')]['to'],'ListId':_0x43894d[_0x5262('0xb3')]}));})['then'](function(_0x45e10d){if(!_0x45e10d)return;var _0x14cd36={'UserId':_0xf63af[_0x5262('0x37')]['id'],'ContactId':_0x45e10d['id'],'MailAccountId':_0x43894d['id'],'inReplyTo':_0x9c91de[_0x5262('0xb4')],'to':_0xf63af[_0x5262('0x62')][_0x5262('0xab')],'cc':_0xf63af[_0x5262('0x62')]['cc'],'subject':_0xf63af['body'][_0x5262('0xb5')],'attach':_0xf63af[_0x5262('0x62')][_0x5262('0xb6')],'firstMsgDirection':_0x5262('0xb7'),'lastMsgAt':moment()['format'](_0x5262('0xa2')),'lastMsgDirection':_0x5262('0xb7'),'Messages':[_['merge'](_0xf63af[_0x5262('0x62')],{'messageId':_0x9c91de[_0x5262('0xb4')],'sentAt':moment()[_0x5262('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x43894d['id'],'UserId':_0xf63af[_0x5262('0x37')]['id'],'ContactId':_0x45e10d['id']})]};if(_0xf63af[_0x5262('0x62')][_0x5262('0xb8')]){_0x14cd36=_['merge'](_0x14cd36,_0xf63af[_0x5262('0x62')][_0x5262('0xb8')]);}return db['MailInteraction'][_0x5262('0x6a')](_0x14cd36,{'include':[{'model':db['MailMessage'],'as':_0x5262('0xb9')}]});})[_0x5262('0x12')](respondWithResult(_0x884a93,null))[_0x5262('0x1c')](handleError(_0x884a93,null));};exports[_0x5262('0xba')]=function(_0x304c56,_0x32fb56){return db['MailAccount'][_0x5262('0x61')]({'where':{'id':_0x304c56[_0x5262('0x60')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x5262('0x43'),'raw':!![],'include':[{'model':db[_0x5262('0xa9')],'as':'CloudProvider','raw':!![]}]}]})[_0x5262('0x12')](handleEntityNotFound(_0x32fb56,null))[_0x5262('0x12')](function(_0x35bedb){if(!_0x35bedb[_0x5262('0x43')])return;var _0x5e0db1=_0x35bedb['getSmtpOptions']();return respondWithRpcPromise(_0x5262('0xbb'),'verifySmtp',{'account':_0x5e0db1});})[_0x5262('0x12')](respondWithResult(_0x32fb56,null))[_0x5262('0x1c')](handleError(_0x32fb56,null));};exports[_0x5262('0x28')]=function(_0x48c3f3,_0x1d5e96){return db[_0x5262('0x47')][_0x5262('0x61')]({'where':{'id':_0x48c3f3[_0x5262('0x60')]['id']}})['then'](handleEntityNotFound(_0x1d5e96,null))[_0x5262('0x12')](function(_0x1938ec){if(_0x1938ec&&_0x1938ec[_0x5262('0x40')]){throw new db[(_0x5262('0xbc'))][(_0x5262('0xbd'))](_0x5262('0xbe'));}return _0x1938ec;})[_0x5262('0x12')](removeEntity(_0x1d5e96,null))['catch'](handleError(_0x1d5e96,null));};exports[_0x5262('0xbf')]=function(_0x37d2b8,_0x25a0e5){return db[_0x5262('0x47')]['find']({'where':{'id':_0x37d2b8['params']['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x25a0e5,null))['then'](function(_0x320f73){if(_0x320f73){return _0x320f73[_0x5262('0xbf')](_0x37d2b8[_0x5262('0x62')][_0x5262('0x70')],_[_0x5262('0x8b')](_0x37d2b8[_0x5262('0x62')],[_0x5262('0x70'),'id'])||{})[_0x5262('0xc0')](function(_0x16ec95){for(var _0x465bc7=0x0;_0x465bc7<_0x37d2b8[_0x5262('0x62')][_0x5262('0x70')]['length'];_0x465bc7+=0x1){socket['emit'](_0x5262('0xc1'),{'UserId':Number(_0x37d2b8['body'][_0x5262('0x70')][_0x465bc7]),'MailAccountId':Number(_0x37d2b8[_0x5262('0x60')]['id'])});}return _0x16ec95;});}})[_0x5262('0x12')](respondWithResult(_0x25a0e5,null))[_0x5262('0x1c')](handleError(_0x25a0e5,null));};exports[_0x5262('0xc2')]=function(_0x5d3f8b,_0xafceef){return db['MailAccount'][_0x5262('0x61')]({'where':{'id':_0x5d3f8b[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0xafceef,null))[_0x5262('0x12')](function(_0x2e339d){if(_0x2e339d){return _0x2e339d[_0x5262('0xc2')](_0x5d3f8b[_0x5262('0x4e')][_0x5262('0x70')])[_0x5262('0x12')](function(){if(_['isArray'](_0x5d3f8b[_0x5262('0x4e')][_0x5262('0x70')])){for(var _0x2e256f=0x0;_0x2e256f<_0x5d3f8b[_0x5262('0x4e')][_0x5262('0x70')][_0x5262('0x53')];_0x2e256f+=0x1){socket[_0x5262('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x5d3f8b[_0x5262('0x4e')][_0x5262('0x70')][_0x2e256f]),'MailAccountId':Number(_0x5d3f8b[_0x5262('0x60')]['id'])});}}else{socket[_0x5262('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x5d3f8b['query'][_0x5262('0x70')]),'MailAccountId':Number(_0x5d3f8b[_0x5262('0x60')]['id'])});}});}})[_0x5262('0x12')](respondWithStatusCode(_0xafceef,null))[_0x5262('0x1c')](handleError(_0xafceef,null));};exports[_0x5262('0xc4')]=function(_0x3269e8,_0x39f61a){var _0x7a5a54={};var _0x5a5503={};var _0x552447;var _0x4741e5;return db[_0x5262('0x47')][_0x5262('0x6c')]({'where':{'id':_0x3269e8[_0x5262('0x60')]['id']}})[_0x5262('0x12')](handleEntityNotFound(_0x39f61a,null))[_0x5262('0x12')](function(_0x26386c){if(_0x26386c){_0x552447=_0x26386c;_0x5a5503[_0x5262('0x4c')]=_[_0x5262('0x4d')](db['User'][_0x5262('0x48')]);_0x5a5503['query']=_[_0x5262('0x4d')](_0x3269e8[_0x5262('0x4e')]);_0x5a5503['filters']=_['intersection'](_0x5a5503[_0x5262('0x4c')],_0x5a5503[_0x5262('0x4e')]);_0x7a5a54[_0x5262('0x51')]=_[_0x5262('0x50')](_0x5a5503[_0x5262('0x4c')],qs[_0x5262('0x52')](_0x3269e8[_0x5262('0x4e')][_0x5262('0x52')]));_0x7a5a54[_0x5262('0x51')]=_0x7a5a54[_0x5262('0x51')][_0x5262('0x53')]?_0x7a5a54[_0x5262('0x51')]:_0x5a5503[_0x5262('0x4c')];_0x7a5a54[_0x5262('0x54')]=qs[_0x5262('0x55')](_0x3269e8[_0x5262('0x4e')][_0x5262('0x55')]);_0x7a5a54['where']=qs['filters'](_[_0x5262('0x56')](_0x3269e8['query'],_0x5a5503['filters']));if(_0x3269e8[_0x5262('0x4e')][_0x5262('0x57')]){_0x7a5a54[_0x5262('0x58')]=_['merge'](_0x7a5a54[_0x5262('0x58')],{'$or':_[_0x5262('0x74')](_0x7a5a54[_0x5262('0x51')],function(_0x31c61f){var _0x5e683c={};_0x5e683c[_0x31c61f]={'$like':'%'+_0x3269e8[_0x5262('0x4e')][_0x5262('0x57')]+'%'};return _0x5e683c;})});}_0x7a5a54=_['merge']({},_0x7a5a54,_0x3269e8['options']);return _0x552447[_0x5262('0xc4')](_0x7a5a54);}})[_0x5262('0x12')](function(_0x246fcc){if(_0x246fcc){_0x4741e5=_0x246fcc['length'];if(!_0x3269e8[_0x5262('0x4e')]['hasOwnProperty'](_0x5262('0x6e'))){_0x7a5a54[_0x5262('0x23')]=qs[_0x5262('0x23')](_0x3269e8['query'][_0x5262('0x23')]);_0x7a5a54['offset']=qs[_0x5262('0x21')](_0x3269e8[_0x5262('0x4e')]['offset']);}return _0x552447[_0x5262('0xc4')](_0x7a5a54);}})[_0x5262('0x12')](function(_0x2683b9){if(_0x2683b9){return _0x2683b9?{'count':_0x4741e5,'rows':_0x2683b9}:null;}})['then'](respondWithResult(_0x39f61a,null))[_0x5262('0x1c')](handleError(_0x39f61a,null));}; \ No newline at end of file +var _0x2fa3=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','isNil','from','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','jayson/promise','client','request','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','then','MailAccounts','UserProfileResource','destroy','sendStatus','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','show','params','MailServerIn','MailServerOut','find','update','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','getDispositions','findOne','order','MailAccountId','Disposition','includeAll','rows','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','create','key','custom','email','active','get','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','finally','send','getApplications','getMessages'];(function(_0x2a7388,_0x2a9be2){var _0x3f51fe=function(_0x1b0744){while(--_0x1b0744){_0x2a7388['push'](_0x2a7388['shift']());}};_0x3f51fe(++_0x2a9be2);}(_0x2fa3,0x1a6));var _0x32fa=function(_0x41ea4a,_0x1a0181){_0x41ea4a=_0x41ea4a-0x0;var _0x2276c2=_0x2fa3[_0x41ea4a];return _0x2276c2;};'use strict';var moment=require('moment');var BPromise=require(_0x32fa('0x0'));var util=require(_0x32fa('0x1'));var path=require('path');var _=require(_0x32fa('0x2'));var juice=require(_0x32fa('0x3'));var Redis=require('ioredis');var qs=require(_0x32fa('0x4'));var logger=require(_0x32fa('0x5'))(_0x32fa('0x6'));var config=require(_0x32fa('0x7'));var db=require('../../mysqldb')['db'];config[_0x32fa('0x8')]=_['defaults'](config['redis'],{'host':_0x32fa('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32fa('0x8')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x32fa('0xa'));var client=jayson[_0x32fa('0xb')]['http']({'port':0x232b});function respondWithRpcPromise(_0x31d278,_0x16a1af,_0x57af9f,_0x78d902){return new BPromise(function(_0x7311fc,_0x35e5c3){var _0x443e50=_0x78d902||client;return _0x443e50[_0x32fa('0xc')](_0x31d278,_0x57af9f)['then'](function(_0x1e9361){logger['info']('MailAccount,\x20%s,\x20%s',_0x16a1af,_0x32fa('0xd'));logger[_0x32fa('0xe')](_0x32fa('0xf'),_0x16a1af,'request\x20sent',JSON[_0x32fa('0x10')](_0x1e9361));if(_0x1e9361[_0x32fa('0x11')]){if(_0x1e9361[_0x32fa('0x11')]['code']===0x1f4){logger[_0x32fa('0x11')](_0x32fa('0x12'),_0x16a1af,_0x1e9361['error'][_0x32fa('0x13')]);return _0x35e5c3(_0x1e9361[_0x32fa('0x11')][_0x32fa('0x13')]);}logger[_0x32fa('0x11')](_0x32fa('0x12'),_0x16a1af,_0x1e9361[_0x32fa('0x11')][_0x32fa('0x13')]);return _0x7311fc(_0x1e9361[_0x32fa('0x11')][_0x32fa('0x13')]);}else{logger[_0x32fa('0x14')](_0x32fa('0x12'),_0x16a1af,_0x32fa('0xd'));_0x7311fc(_0x1e9361[_0x32fa('0x15')][_0x32fa('0x13')]);}})[_0x32fa('0x16')](function(_0x5647bf){logger[_0x32fa('0x11')](_0x32fa('0x12'),_0x16a1af,_0x5647bf);_0x35e5c3(_0x5647bf);});});}function respondWithStatusCode(_0xcdc8d8,_0x359829){_0x359829=_0x359829||0xcc;return function(_0x470710){if(_0x470710){return _0xcdc8d8['sendStatus'](_0x359829);}return _0xcdc8d8[_0x32fa('0x17')](_0x359829)[_0x32fa('0x18')]();};}function respondWithResult(_0x4737d7,_0xe00dae){_0xe00dae=_0xe00dae||0xc8;return function(_0x261409){if(_0x261409){return _0x4737d7['status'](_0xe00dae)[_0x32fa('0x19')](_0x261409);}};}function respondWithFilteredResult(_0x226ae7,_0x602ad8){return function(_0x5699e7){if(_0x5699e7){var _0x4d00a1=typeof _0x602ad8[_0x32fa('0x1a')]===_0x32fa('0x1b')&&typeof _0x602ad8[_0x32fa('0x1c')]===_0x32fa('0x1b');var _0x546228=_0x5699e7[_0x32fa('0x1d')];var _0x399980=_0x4d00a1?0x0:_0x602ad8[_0x32fa('0x1a')];var _0x44476b=_0x4d00a1?_0x5699e7[_0x32fa('0x1d')]:_0x602ad8[_0x32fa('0x1a')]+_0x602ad8[_0x32fa('0x1c')];var _0x4d8888;if(_0x44476b>=_0x546228){_0x44476b=_0x546228;_0x4d8888=0xc8;}else{_0x4d8888=0xce;}_0x226ae7[_0x32fa('0x17')](_0x4d8888);return _0x226ae7['set'](_0x32fa('0x1e'),_0x399980+'-'+_0x44476b+'/'+_0x546228)['json'](_0x5699e7);}return null;};}function saveUpdates(_0x1f0822){return function(_0xf9c87a){if(_0xf9c87a){return _0xf9c87a['update'](_0x1f0822)[_0x32fa('0x1f')](function(_0x1b35a1){return _0x1b35a1;});}return null;};}function removeEntity(_0x3ade9f){return function(_0x334a4d){if(_0x334a4d){return _0x334a4d['destroy']()['then'](function(){var _0x507210=_0x334a4d['get']({'plain':!![]});var _0x4680a2=_0x32fa('0x20');return db[_0x32fa('0x21')][_0x32fa('0x22')]({'where':{'type':_0x4680a2,'resourceId':_0x507210['id']}})[_0x32fa('0x1f')](function(){return _0x334a4d;});})[_0x32fa('0x1f')](function(){_0x3ade9f[_0x32fa('0x17')](0xcc)[_0x32fa('0x18')]();});}};}function handleEntityNotFound(_0xfdb976){return function(_0x85dffe){if(!_0x85dffe){_0xfdb976[_0x32fa('0x23')](0x194);}return _0x85dffe;};}function handleError(_0x2004c4,_0x4344a8){_0x4344a8=_0x4344a8||0x1f4;return function(_0x4cc02a){logger[_0x32fa('0x11')](_0x4cc02a[_0x32fa('0x24')]);if(_0x4cc02a[_0x32fa('0x25')]){delete _0x4cc02a[_0x32fa('0x25')];}_0x2004c4[_0x32fa('0x17')](_0x4344a8)['send'](_0x4cc02a);};}function getImapHost(_0x1783b5){switch(_0x1783b5){case _0x32fa('0x26'):return _0x32fa('0x27');case _0x32fa('0x28'):return _0x32fa('0x29');case _0x32fa('0x2a'):return _0x32fa('0x2b');case _0x32fa('0x2c'):return _0x32fa('0x2d');}throw new Error(_0x32fa('0x2e'),_0x1783b5);}function getSmtpHost(_0x5650f7){switch(_0x5650f7){case'gmail':return _0x32fa('0x2f');case _0x32fa('0x28'):return _0x32fa('0x30');case _0x32fa('0x2a'):return _0x32fa('0x31');case _0x32fa('0x2c'):return _0x32fa('0x32');}throw new Error(_0x32fa('0x2e'),_0x5650f7);}function getAuthenticationOptions(_0x10552c,_0x4c2eba){var _0x4ddf76={};var _0x24d4f7={};if(_0x10552c){_0x4ddf76[_0x32fa('0x33')]=_0x24d4f7[_0x32fa('0x33')]=_0x4c2eba[_0x32fa('0x34')];_0x4ddf76['password']=_0x24d4f7[_0x32fa('0x35')]=_0x4c2eba[_0x32fa('0x36')];if(_0x4c2eba[_0x32fa('0x37')]){_0x4ddf76[_0x32fa('0x37')]=_0x24d4f7['modernAuthentication']=!![];_0x4ddf76['CloudProviderId']=_0x24d4f7[_0x32fa('0x38')]=_0x4c2eba[_0x32fa('0x38')];_0x4ddf76[_0x32fa('0x36')]=_0x24d4f7['pass']=null;}else{_0x4ddf76[_0x32fa('0x38')]=_0x24d4f7['CloudProviderId']=null;}_0x4ddf76[_0x32fa('0x39')]=getImapHost(_0x10552c);_0x4ddf76['port']=0x3e1;_0x24d4f7[_0x32fa('0x39')]=getSmtpHost(_0x10552c);_0x24d4f7[_0x32fa('0x3a')]=0x24b;_0x24d4f7[_0x32fa('0x3b')]=![];_0x4ddf76[_0x32fa('0x3c')]=_0x24d4f7[_0x32fa('0x3c')]=null;}else{if(_0x4c2eba[_0x32fa('0x3d')]){_0x4ddf76['user']=_0x24d4f7[_0x32fa('0x33')]=_0x4c2eba[_0x32fa('0x34')];_0x4ddf76[_0x32fa('0x36')]=_0x24d4f7[_0x32fa('0x35')]=_0x4c2eba[_0x32fa('0x36')];}else{_0x4ddf76['authentication']=_0x24d4f7['authentication']=![];_0x4ddf76[_0x32fa('0x33')]=_0x24d4f7[_0x32fa('0x33')]=null;_0x4ddf76[_0x32fa('0x36')]=_0x24d4f7[_0x32fa('0x35')]=null;}_0x4ddf76[_0x32fa('0x39')]=_0x4c2eba[_0x32fa('0x3e')]['host'];_0x4ddf76[_0x32fa('0x3a')]=_0x4c2eba[_0x32fa('0x3e')][_0x32fa('0x3a')];_0x24d4f7['host']=_0x4c2eba[_0x32fa('0x3f')][_0x32fa('0x39')];_0x24d4f7['port']=_0x4c2eba[_0x32fa('0x3f')][_0x32fa('0x3a')];}return{'Imap':_0x4ddf76,'Smtp':_0x24d4f7};}exports[_0x32fa('0x40')]=function(_0xf6899c,_0x1d3ee0){var _0x3ae89b={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x32fa('0x3f')},{'model':db[_0x32fa('0x41')],'as':_0x32fa('0x42')}]},_0x100793={},_0x22f498={'count':0x0,'rows':[]};var _0x4294f2=_['map'](db[_0x32fa('0x43')][_0x32fa('0x44')],function(_0x51f3dc){return{'name':_0x51f3dc['fieldName'],'type':_0x51f3dc[_0x32fa('0x45')]['key']};});_0x100793[_0x32fa('0x46')]=_['map'](_0x4294f2,_0x32fa('0x25'));_0x100793[_0x32fa('0x47')]=_[_0x32fa('0x48')](_0xf6899c['query']);_0x100793[_0x32fa('0x49')]=_[_0x32fa('0x4a')](_0x100793[_0x32fa('0x46')],_0x100793['query']);_0x3ae89b['attributes']=_[_0x32fa('0x4a')](_0x100793[_0x32fa('0x46')],qs[_0x32fa('0x4b')](_0xf6899c[_0x32fa('0x47')][_0x32fa('0x4b')]));_0x3ae89b[_0x32fa('0x4c')]=_0x3ae89b[_0x32fa('0x4c')][_0x32fa('0x4d')]?_0x3ae89b['attributes']:_0x100793[_0x32fa('0x46')];if(!_0xf6899c[_0x32fa('0x47')]['hasOwnProperty'](_0x32fa('0x4e'))){_0x3ae89b['limit']=qs[_0x32fa('0x1c')](_0xf6899c['query']['limit']);_0x3ae89b[_0x32fa('0x1a')]=qs[_0x32fa('0x1a')](_0xf6899c['query']['offset']);}_0x3ae89b['order']=qs[_0x32fa('0x4f')](_0xf6899c[_0x32fa('0x47')][_0x32fa('0x4f')]);_0x3ae89b['where']=qs[_0x32fa('0x49')](_[_0x32fa('0x50')](_0xf6899c['query'],_0x100793[_0x32fa('0x49')]),_0x4294f2);if(_0xf6899c[_0x32fa('0x47')][_0x32fa('0x51')]){_0x3ae89b[_0x32fa('0x52')]=_[_0x32fa('0x53')](_0x3ae89b[_0x32fa('0x52')],{'$or':_[_0x32fa('0x54')](_0x4294f2,function(_0x2e578a){if(_0x2e578a[_0x32fa('0x45')]!==_0x32fa('0x55')){var _0x20dad6={};_0x20dad6[_0x2e578a[_0x32fa('0x25')]]={'$like':'%'+_0xf6899c['query'][_0x32fa('0x51')]+'%'};return _0x20dad6;}})});}_0x3ae89b=_[_0x32fa('0x53')]({},_0x3ae89b,_0xf6899c[_0x32fa('0x56')]);var _0x314f74={'where':_0x3ae89b[_0x32fa('0x52')]};return db['MailAccount'][_0x32fa('0x1d')](_0x314f74)[_0x32fa('0x1f')](function(_0x4d1e9c){_0x22f498[_0x32fa('0x1d')]=_0x4d1e9c;if(_0xf6899c[_0x32fa('0x47')]['includeAll']){_0x3ae89b[_0x32fa('0x57')]=[{'all':!![]}];}return db['MailAccount'][_0x32fa('0x58')](_0x3ae89b);})[_0x32fa('0x1f')](function(_0x34fa3a){_0x22f498['rows']=_0x34fa3a;return _0x22f498;})[_0x32fa('0x1f')](respondWithFilteredResult(_0x1d3ee0,_0x3ae89b))[_0x32fa('0x16')](handleError(_0x1d3ee0,null));};exports[_0x32fa('0x59')]=function(_0x27596f,_0x3934fe){var _0x5c93af={'raw':![],'where':{'id':_0x27596f[_0x32fa('0x5a')]['id']},'include':[{'model':db[_0x32fa('0x5b')],'as':_0x32fa('0x3e')},{'model':db[_0x32fa('0x5c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x32fa('0x42')}]},_0x4d7686={};_0x4d7686[_0x32fa('0x46')]=_[_0x32fa('0x48')](db[_0x32fa('0x43')][_0x32fa('0x44')]);_0x4d7686[_0x32fa('0x47')]=_['keys'](_0x27596f[_0x32fa('0x47')]);_0x4d7686[_0x32fa('0x49')]=_['intersection'](_0x4d7686[_0x32fa('0x46')],_0x4d7686[_0x32fa('0x47')]);_0x5c93af[_0x32fa('0x4c')]=_['intersection'](_0x4d7686['model'],qs['fields'](_0x27596f[_0x32fa('0x47')][_0x32fa('0x4b')]));_0x5c93af['attributes']=_0x5c93af[_0x32fa('0x4c')][_0x32fa('0x4d')]?_0x5c93af[_0x32fa('0x4c')]:_0x4d7686[_0x32fa('0x46')];if(_0x27596f[_0x32fa('0x47')]['includeAll']){_0x5c93af[_0x32fa('0x57')]=[{'all':!![]}];}_0x5c93af=_['merge']({},_0x5c93af,_0x27596f['options']);return db[_0x32fa('0x43')][_0x32fa('0x5d')](_0x5c93af)[_0x32fa('0x1f')](handleEntityNotFound(_0x3934fe,null))['then'](respondWithResult(_0x3934fe,null))['catch'](handleError(_0x3934fe,null));};exports[_0x32fa('0x5e')]=function(_0x4ee32c,_0xe80e63){if(_0x4ee32c['body']['id']){delete _0x4ee32c[_0x32fa('0x5f')]['id'];}var _0x238636=_0x4ee32c['body'][_0x32fa('0x60')]==='custom'?null:_0x4ee32c[_0x32fa('0x5f')]['provider'];var _0x618edc=_0x4ee32c['body']['Imap']||{};var _0x4e5c30=_0x4ee32c[_0x32fa('0x5f')]['Smtp']||{};if(_0x238636){_0x618edc[_0x32fa('0x39')]=getImapHost(_0x238636);_0x618edc[_0x32fa('0x3a')]=0x3e1;_0x4e5c30[_0x32fa('0x39')]=getSmtpHost(_0x238636);_0x4e5c30[_0x32fa('0x3a')]=0x24b;_0x4e5c30[_0x32fa('0x3b')]=![];}if(_0x4e5c30[_0x32fa('0x37')]){_0x4e5c30['secure']=![];}else{_0x4e5c30[_0x32fa('0x38')]=null;}if(!_0x618edc[_0x32fa('0x37')])_0x618edc[_0x32fa('0x38')]=null;_0x4ee32c['body'][_0x32fa('0x3e')]=_0x618edc;_0x4ee32c[_0x32fa('0x5f')][_0x32fa('0x3f')]=_0x4e5c30;return db[_0x32fa('0x43')]['find']({'where':{'id':_0x4ee32c[_0x32fa('0x5a')]['id']},'include':[{'model':db[_0x32fa('0x5b')],'as':_0x32fa('0x3e')},{'model':db[_0x32fa('0x5c')],'as':_0x32fa('0x3f')},{'model':db['Pause'],'as':_0x32fa('0x42')}]})['then'](handleEntityNotFound(_0xe80e63,null))[_0x32fa('0x1f')](function(_0x5e238f){if(!_0x5e238f)throw new Error(_0x32fa('0x61'));if(_0x5e238f[_0x32fa('0x3c')])delete _0x4ee32c[_0x32fa('0x5f')][_0x32fa('0x3e')];return _0x5e238f;})[_0x32fa('0x1f')](saveUpdates(_0x4ee32c['body'],null))[_0x32fa('0x1f')](function(_0x4a5fe7){if(!_0x4ee32c[_0x32fa('0x5f')][_0x32fa('0x3e')])return _0x4a5fe7;return db[_0x32fa('0x5b')]['update'](_0x4ee32c[_0x32fa('0x5f')][_0x32fa('0x3e')],{'where':{'MailAccountId':_0x4a5fe7['id']}})[_0x32fa('0x1f')](function(){return _0x4a5fe7;});})[_0x32fa('0x1f')](function(_0x4d2949){if(!_0x4ee32c[_0x32fa('0x5f')]['Smtp'])return _0x4d2949;return db[_0x32fa('0x5c')][_0x32fa('0x5e')](_0x4ee32c['body']['Smtp'],{'where':{'MailAccountId':_0x4d2949['id']}})[_0x32fa('0x1f')](function(){return _0x4d2949;});})['then'](respondWithResult(_0xe80e63,null))['catch'](handleError(_0xe80e63,null));};exports[_0x32fa('0x62')]=function(_0x317f00,_0x2d2437){return db[_0x32fa('0x43')][_0x32fa('0x62')]()[_0x32fa('0x1f')](respondWithResult(_0x2d2437,null))['catch'](handleError(_0x2d2437,null));};exports[_0x32fa('0x63')]=function(_0x303935,_0x3b279d){if(_0x303935['body']['id']){delete _0x303935[_0x32fa('0x5f')]['id'];}return db['MailAccount'][_0x32fa('0x5d')]({'where':{'id':_0x303935['params']['id']}})['then'](handleEntityNotFound(_0x3b279d,null))[_0x32fa('0x1f')](function(_0x17b3b0){if(_0x17b3b0){_0x303935['body']['MailAccountId']=_0x17b3b0['id'];return db['Disposition']['create'](_0x303935[_0x32fa('0x5f')]);}})[_0x32fa('0x1f')](respondWithResult(_0x3b279d,null))['catch'](handleError(_0x3b279d,null));};exports[_0x32fa('0x64')]=function(_0x19e881,_0x4b1d2e){var _0x56dbfd={'raw':![],'where':{}};var _0x29209a={};var _0x40fd55={'count':0x0,'rows':[]};return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x19e881[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x4b1d2e,null))[_0x32fa('0x1f')](function(_0x2fb25f){if(_0x2fb25f){_0x29209a[_0x32fa('0x46')]=_[_0x32fa('0x48')](db['Disposition'][_0x32fa('0x44')]);_0x29209a[_0x32fa('0x47')]=_[_0x32fa('0x48')](_0x19e881[_0x32fa('0x47')]);_0x29209a[_0x32fa('0x49')]=_['intersection'](_0x29209a['model'],_0x29209a[_0x32fa('0x47')]);_0x56dbfd['attributes']=_[_0x32fa('0x4a')](_0x29209a[_0x32fa('0x46')],qs[_0x32fa('0x4b')](_0x19e881['query']['fields']));_0x56dbfd[_0x32fa('0x4c')]=_0x56dbfd[_0x32fa('0x4c')][_0x32fa('0x4d')]?_0x56dbfd[_0x32fa('0x4c')]:_0x29209a[_0x32fa('0x46')];if(!_0x19e881['query']['hasOwnProperty'](_0x32fa('0x4e'))){_0x56dbfd[_0x32fa('0x1c')]=qs['limit'](_0x19e881[_0x32fa('0x47')]['limit']);_0x56dbfd[_0x32fa('0x1a')]=qs['offset'](_0x19e881['query'][_0x32fa('0x1a')]);}_0x56dbfd[_0x32fa('0x66')]=qs[_0x32fa('0x4f')](_0x19e881[_0x32fa('0x47')][_0x32fa('0x4f')]);_0x56dbfd[_0x32fa('0x52')]=qs[_0x32fa('0x49')](_[_0x32fa('0x50')](_0x19e881['query'],_0x29209a[_0x32fa('0x49')]));_0x56dbfd[_0x32fa('0x52')][_0x32fa('0x67')]=_0x2fb25f['id'];if(_0x19e881[_0x32fa('0x47')][_0x32fa('0x51')]){_0x56dbfd[_0x32fa('0x52')]=_['merge'](_0x56dbfd['where'],{'$or':_[_0x32fa('0x54')](_0x56dbfd[_0x32fa('0x4c')],function(_0x40b0da){var _0x30062a={};_0x30062a[_0x40b0da]={'$like':'%'+_0x19e881[_0x32fa('0x47')][_0x32fa('0x51')]+'%'};return _0x30062a;})});}_0x56dbfd=_['merge']({},_0x56dbfd,_0x19e881['options']);return db[_0x32fa('0x68')][_0x32fa('0x1d')]({'where':_0x56dbfd[_0x32fa('0x52')]})['then'](function(_0x1ee840){_0x40fd55['count']=_0x1ee840;if(_0x19e881[_0x32fa('0x47')][_0x32fa('0x69')]){_0x56dbfd[_0x32fa('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x32fa('0x58')](_0x56dbfd);})[_0x32fa('0x1f')](function(_0xee182a){_0x40fd55[_0x32fa('0x6a')]=_0xee182a;return _0x40fd55;});}})['then'](respondWithFilteredResult(_0x4b1d2e,_0x56dbfd))[_0x32fa('0x16')](handleError(_0x4b1d2e,null));};exports['removeDispositions']=function(_0xcaf5e,_0x4bd3e7){return db[_0x32fa('0x43')][_0x32fa('0x5d')]({'where':{'id':_0xcaf5e[_0x32fa('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4bd3e7,null))[_0x32fa('0x1f')](function(_0xad2ec0){if(_0xad2ec0){return _0xad2ec0['removeDispositions'](_0xcaf5e[_0x32fa('0x47')][_0x32fa('0x6b')]);}})['then'](respondWithStatusCode(_0x4bd3e7,null))[_0x32fa('0x16')](handleError(_0x4bd3e7,null));};exports[_0x32fa('0x6c')]=function(_0x35ace6,_0x44a1d8){if(_0x35ace6[_0x32fa('0x5f')]['id']){delete _0x35ace6[_0x32fa('0x5f')]['id'];}return db[_0x32fa('0x43')]['find']({'where':{'id':_0x35ace6['params']['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x44a1d8,null))[_0x32fa('0x1f')](function(_0x26bd67){if(_0x26bd67){_0x35ace6[_0x32fa('0x5f')][_0x32fa('0x67')]=_0x26bd67['id'];return db[_0x32fa('0x6d')]['create'](_0x35ace6[_0x32fa('0x5f')]);}})[_0x32fa('0x1f')](respondWithResult(_0x44a1d8,null))[_0x32fa('0x16')](handleError(_0x44a1d8,null));};exports[_0x32fa('0x6e')]=function(_0x20f9ff,_0x5274c7){var _0x20f807={'raw':![],'where':{}};var _0x12ec8b={};var _0x53d862={'count':0x0,'rows':[]};return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x20f9ff[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x5274c7,null))[_0x32fa('0x1f')](function(_0x33b823){if(_0x33b823){_0x12ec8b[_0x32fa('0x46')]=_['keys'](db['CannedAnswer'][_0x32fa('0x44')]);_0x12ec8b[_0x32fa('0x47')]=_[_0x32fa('0x48')](_0x20f9ff['query']);_0x12ec8b['filters']=_[_0x32fa('0x4a')](_0x12ec8b['model'],_0x12ec8b[_0x32fa('0x47')]);_0x20f807[_0x32fa('0x4c')]=_[_0x32fa('0x4a')](_0x12ec8b[_0x32fa('0x46')],qs[_0x32fa('0x4b')](_0x20f9ff[_0x32fa('0x47')][_0x32fa('0x4b')]));_0x20f807['attributes']=_0x20f807[_0x32fa('0x4c')][_0x32fa('0x4d')]?_0x20f807['attributes']:_0x12ec8b[_0x32fa('0x46')];if(!_0x20f9ff[_0x32fa('0x47')][_0x32fa('0x6f')](_0x32fa('0x4e'))){_0x20f807[_0x32fa('0x1c')]=qs[_0x32fa('0x1c')](_0x20f9ff[_0x32fa('0x47')][_0x32fa('0x1c')]);_0x20f807[_0x32fa('0x1a')]=qs[_0x32fa('0x1a')](_0x20f9ff['query'][_0x32fa('0x1a')]);}_0x20f807['order']=qs['sort'](_0x20f9ff[_0x32fa('0x47')][_0x32fa('0x4f')]);_0x20f807[_0x32fa('0x52')]=qs[_0x32fa('0x49')](_[_0x32fa('0x50')](_0x20f9ff['query'],_0x12ec8b[_0x32fa('0x49')]));_0x20f807[_0x32fa('0x52')][_0x32fa('0x67')]=_0x33b823['id'];if(_0x20f9ff[_0x32fa('0x47')][_0x32fa('0x51')]){_0x20f807[_0x32fa('0x52')]=_[_0x32fa('0x53')](_0x20f807[_0x32fa('0x52')],{'$or':_[_0x32fa('0x54')](_0x20f807[_0x32fa('0x4c')],function(_0x34369c){var _0xc447ae={};_0xc447ae[_0x34369c]={'$like':'%'+_0x20f9ff[_0x32fa('0x47')][_0x32fa('0x51')]+'%'};return _0xc447ae;})});}_0x20f807=_[_0x32fa('0x53')]({},_0x20f807,_0x20f9ff['options']);return db[_0x32fa('0x6d')][_0x32fa('0x1d')]({'where':_0x20f807[_0x32fa('0x52')]})['then'](function(_0x473281){_0x53d862[_0x32fa('0x1d')]=_0x473281;if(_0x20f9ff['query'][_0x32fa('0x69')]){_0x20f807[_0x32fa('0x57')]=[{'all':!![]}];}return db[_0x32fa('0x6d')][_0x32fa('0x58')](_0x20f807);})[_0x32fa('0x1f')](function(_0x5aebac){_0x53d862[_0x32fa('0x6a')]=_0x5aebac;return _0x53d862;});}})[_0x32fa('0x1f')](respondWithFilteredResult(_0x5274c7,_0x20f807))['catch'](handleError(_0x5274c7,null));};exports[_0x32fa('0x70')]=function(_0x183c84,_0x8c4873){return db['MailAccount'][_0x32fa('0x5d')]({'where':{'id':_0x183c84[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x8c4873,null))[_0x32fa('0x1f')](function(_0x19299a){if(_0x19299a){return _0x19299a[_0x32fa('0x70')](_0x183c84[_0x32fa('0x47')]['ids']);}})[_0x32fa('0x1f')](respondWithStatusCode(_0x8c4873,null))[_0x32fa('0x16')](handleError(_0x8c4873,null));};exports[_0x32fa('0x71')]=function(_0x1e97f7,_0xf5c04d){var _0x47841c={'name':_0x1e97f7[_0x32fa('0x5f')][_0x32fa('0x25')],'key':_0x1e97f7[_0x32fa('0x5f')][_0x32fa('0x72')],'provider':_0x1e97f7[_0x32fa('0x5f')][_0x32fa('0x60')]===_0x32fa('0x73')?null:_0x1e97f7[_0x32fa('0x5f')][_0x32fa('0x60')],'email':_0x1e97f7[_0x32fa('0x5f')][_0x32fa('0x74')],'ListId':_0x1e97f7[_0x32fa('0x5f')]['ListId'],'active':!_['isNil'](_0x1e97f7[_0x32fa('0x5f')][_0x32fa('0x75')])?_0x1e97f7[_0x32fa('0x5f')]['active']:!![],'description':_0x1e97f7['body']['description']||null};var _0x3cc5bd=getAuthenticationOptions(_0x47841c[_0x32fa('0x60')],_0x1e97f7[_0x32fa('0x5f')]);_0x47841c[_0x32fa('0x3e')]=_0x3cc5bd[_0x32fa('0x3e')];_0x47841c[_0x32fa('0x3f')]=_0x3cc5bd[_0x32fa('0x3f')];return db[_0x32fa('0x43')]['create'](_0x47841c,{'include':[{'model':db['MailServerOut'],'as':_0x32fa('0x3f')},{'model':db[_0x32fa('0x5b')],'as':_0x32fa('0x3e')}]})[_0x32fa('0x1f')](function(_0x4badd3){var _0x511f15=_0x1e97f7[_0x32fa('0x33')][_0x32fa('0x76')]({'plain':!![]});if(!_0x511f15)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x511f15[_0x32fa('0x77')]==='user'){var _0x4ac823=_0x4badd3[_0x32fa('0x76')]({'plain':!![]});return db['UserProfileSection'][_0x32fa('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x511f15['userProfileId']},'raw':!![]})['then'](function(_0x332e63){if(_0x332e63&&_0x332e63[_0x32fa('0x78')]===0x0){return db['UserProfileResource'][_0x32fa('0x71')]({'name':_0x4ac823[_0x32fa('0x25')],'resourceId':_0x4ac823['id'],'type':_0x332e63['name'],'sectionId':_0x332e63['id']},{})[_0x32fa('0x1f')](function(){return _0x4badd3;});}else{return _0x4badd3;}})['catch'](function(_0x500b0d){logger[_0x32fa('0x11')](_0x32fa('0x79'),_0x500b0d);throw _0x500b0d;});}return _0x4badd3;})['then'](respondWithResult(_0xf5c04d,0xc9))[_0x32fa('0x16')](handleError(_0xf5c04d,null));};exports[_0x32fa('0x7a')]=function(_0x4a276b,_0x42ace3){return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x4a276b[_0x32fa('0x5a')]['id']}})['then'](handleEntityNotFound(_0x42ace3,null))[_0x32fa('0x1f')](function(_0x166070){if(_0x166070){return _0x166070[_0x32fa('0x7a')]();}return null;})['then'](respondWithResult(_0x42ace3,null))['catch'](handleError(_0x42ace3,null));};exports[_0x32fa('0x7b')]=function(_0xcd7303,_0x56ade8){if(_0xcd7303['body']['id']){delete _0xcd7303[_0x32fa('0x5f')]['id'];}return db[_0x32fa('0x43')][_0x32fa('0x5d')]({'where':{'id':_0xcd7303[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x56ade8,null))[_0x32fa('0x1f')](function(_0x5750b3){if(_0x5750b3){_0xcd7303[_0x32fa('0x5f')][_0x32fa('0x67')]=_0x5750b3['id'];return db[_0x32fa('0x5b')]['create'](_0xcd7303[_0x32fa('0x5f')]);}})['then'](respondWithResult(_0x56ade8,null))[_0x32fa('0x16')](handleError(_0x56ade8,null));};exports[_0x32fa('0x7c')]=function(_0x394161,_0x38ff1a){return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x394161['params']['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x38ff1a,null))['then'](function(_0x16431e){if(_0x16431e){return _0x16431e[_0x32fa('0x7d')](null);}return null;})[_0x32fa('0x1f')](respondWithStatusCode(_0x38ff1a,null))[_0x32fa('0x16')](handleError(_0x38ff1a,null));};exports[_0x32fa('0x7e')]=function(_0x44087b,_0x5ab155){return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x44087b['params']['id']}})['then'](handleEntityNotFound(_0x5ab155,null))[_0x32fa('0x1f')](function(_0x5c6a37){if(_0x5c6a37){return _0x5c6a37[_0x32fa('0x7e')]();}return null;})[_0x32fa('0x1f')](respondWithResult(_0x5ab155,null))[_0x32fa('0x16')](handleError(_0x5ab155,null));};exports[_0x32fa('0x7f')]=function(_0x1ef5e9,_0x2b5f7f){if(_0x1ef5e9[_0x32fa('0x5f')]['id']){delete _0x1ef5e9[_0x32fa('0x5f')]['id'];}return db[_0x32fa('0x43')][_0x32fa('0x5d')]({'where':{'id':_0x1ef5e9[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x2b5f7f,null))[_0x32fa('0x1f')](function(_0x36ddf1){if(_0x36ddf1){_0x1ef5e9['body'][_0x32fa('0x67')]=_0x36ddf1['id'];return db[_0x32fa('0x5c')][_0x32fa('0x71')](_0x1ef5e9[_0x32fa('0x5f')]);}})[_0x32fa('0x1f')](respondWithResult(_0x2b5f7f,null))['catch'](handleError(_0x2b5f7f,null));};exports[_0x32fa('0x80')]=function(_0x47c99b,_0x48028a){return db[_0x32fa('0x43')]['findOne']({'where':{'id':_0x47c99b[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x48028a,null))[_0x32fa('0x1f')](function(_0x1d3071){if(_0x1d3071){return _0x1d3071['setSmtp'](null);}return null;})[_0x32fa('0x1f')](respondWithStatusCode(_0x48028a,null))[_0x32fa('0x16')](handleError(_0x48028a,null));};exports[_0x32fa('0x81')]=function(_0x4085ff,_0x148bc9){return db['MailInteraction']['find']({'where':{'id':_0x4085ff[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x148bc9,null))[_0x32fa('0x1f')](function(_0x79af22){if(_0x79af22){return _0x79af22['addInteraction'](_0x4085ff[_0x32fa('0x5f')]['ids'],_[_0x32fa('0x82')](_0x4085ff[_0x32fa('0x5f')],[_0x32fa('0x6b'),'id'])||{});}})[_0x32fa('0x1f')](respondWithResult(_0x148bc9,null))[_0x32fa('0x16')](handleError(_0x148bc9,null));};exports['getInteractions']=function(_0xcb0b2e,_0x40a2cf){var _0x493fc9={'raw':![],'where':{}};var _0x1720ae={};var _0x1bb2a3={'count':0x0,'rows':[]};return db[_0x32fa('0x43')]['findOne']({'where':{'id':_0xcb0b2e[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x40a2cf,null))[_0x32fa('0x1f')](function(_0x3b6da3){if(_0x3b6da3){_0x1720ae['model']=_['keys'](db[_0x32fa('0x83')][_0x32fa('0x44')]);_0x1720ae['query']=_['keys'](_0xcb0b2e[_0x32fa('0x47')]);_0x1720ae[_0x32fa('0x49')]=_[_0x32fa('0x4a')](_0x1720ae[_0x32fa('0x46')],_0x1720ae[_0x32fa('0x47')]);_0x493fc9[_0x32fa('0x4c')]=_[_0x32fa('0x4a')](_0x1720ae[_0x32fa('0x46')],qs['fields'](_0xcb0b2e[_0x32fa('0x47')]['fields']));_0x493fc9[_0x32fa('0x4c')]=_0x493fc9['attributes'][_0x32fa('0x4d')]?_0x493fc9[_0x32fa('0x4c')]:_0x1720ae[_0x32fa('0x46')];if(!_0xcb0b2e[_0x32fa('0x47')]['hasOwnProperty']('nolimit')){_0x493fc9[_0x32fa('0x1c')]=qs[_0x32fa('0x1c')](_0xcb0b2e['query'][_0x32fa('0x1c')]);_0x493fc9['offset']=qs[_0x32fa('0x1a')](_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x1a')]);}_0x493fc9[_0x32fa('0x66')]=qs[_0x32fa('0x4f')](_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x4f')]);_0x493fc9[_0x32fa('0x52')]=qs[_0x32fa('0x49')](_[_0x32fa('0x50')](_0xcb0b2e[_0x32fa('0x47')],_0x1720ae[_0x32fa('0x49')]));_0x493fc9[_0x32fa('0x52')][_0x32fa('0x67')]=_0x3b6da3['id'];if(_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x51')]){_0x493fc9[_0x32fa('0x52')]=_[_0x32fa('0x53')](_0x493fc9['where'],{'$or':_[_0x32fa('0x54')](_0x493fc9[_0x32fa('0x4c')],function(_0x30b036){var _0x353e32={};_0x353e32[_0x30b036]={'$like':'%'+_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x51')]+'%'};return _0x353e32;})});}_0x493fc9=_[_0x32fa('0x53')]({},_0x493fc9,_0xcb0b2e[_0x32fa('0x56')]);return db['MailInteraction'][_0x32fa('0x1d')]({'where':_0x493fc9[_0x32fa('0x52')]})[_0x32fa('0x1f')](function(_0x539a53){_0x1bb2a3[_0x32fa('0x1d')]=_0x539a53;if(_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x69')]){_0x493fc9[_0x32fa('0x57')]=[{'model':db[_0x32fa('0x84')],'as':_0x32fa('0x85'),'required':![]},{'model':db[_0x32fa('0x86')],'as':_0x32fa('0x87'),'attributes':[_0x32fa('0x25'),'fullname',_0x32fa('0x88')],'required':![]},{'model':db[_0x32fa('0x89')],'as':'Tags','attributes':['id',_0x32fa('0x25'),_0x32fa('0x8a')],'where':_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x8b')]?{'id':_0xcb0b2e[_0x32fa('0x47')][_0x32fa('0x8b')]}:undefined,'required':_0xcb0b2e['query'][_0x32fa('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0x32fa('0x58')](_0x493fc9);})[_0x32fa('0x1f')](function(_0x27967c){_0x1bb2a3[_0x32fa('0x6a')]=_0x27967c;return _0x1bb2a3;});}})['then'](respondWithFilteredResult(_0x40a2cf,_0x493fc9))[_0x32fa('0x16')](handleError(_0x40a2cf,null));};exports[_0x32fa('0x8c')]=function addApplications(_0x7ad0a8,_0x16541f){var _0x148975=_0x7ad0a8[_0x32fa('0x5a')]['id'];var _0x38424a=_0x7ad0a8['body'];var _0x55dd9c=0xc8;var _0x3ff155=null;return db['sequelize'][_0x32fa('0x8d')]({'isolationLevel':db['sequelize'][_0x32fa('0x8e')][_0x32fa('0x8f')]['READ_COMMITTED']},function(_0x416af2){return db[_0x32fa('0x43')]['findOne']({'where':{'id':_0x148975},'transaction':_0x416af2})[_0x32fa('0x1f')](function(_0x1a8023){if(_0x1a8023){return db['MailApplication'][_0x32fa('0x22')]({'where':{'MailAccountId':_0x148975},'transaction':_0x416af2})['then'](function(){var _0x55a011=_[_0x32fa('0x54')](_0x38424a,function(_0x96776f){_0x96776f[_0x32fa('0x67')]=_0x148975;return _0x96776f;});return db[_0x32fa('0x90')][_0x32fa('0x91')](_0x55a011,{'transaction':_0x416af2});});}else{_0x55dd9c=0x194;_0x3ff155=[];}});})[_0x32fa('0x1f')](function(){if(_0x55dd9c!==0x194){return db['MailApplication'][_0x32fa('0x92')]({'where':{'MailAccountId':_0x148975},'order':'priority'})[_0x32fa('0x1f')](function(_0x57f66e){_0x3ff155=_0x57f66e;});}})[_0x32fa('0x16')](function(_0x522a17){_0x55dd9c=0x1f4;logger[_0x32fa('0x11')](_0x522a17[_0x32fa('0x24')]);if(_0x522a17['name']){delete _0x522a17['name'];}_0x3ff155=_0x522a17;})[_0x32fa('0x93')](function(){if(_0x3ff155===null){_0x16541f[_0x32fa('0x23')](_0x55dd9c);}else{if(_0x55dd9c===0x1f4){_0x16541f[_0x32fa('0x17')](_0x55dd9c)[_0x32fa('0x94')](_0x3ff155);}else{_0x16541f[_0x32fa('0x17')](_0x55dd9c)[_0x32fa('0x19')](_0x3ff155);}}});};exports[_0x32fa('0x95')]=function(_0x3374bc,_0x15de26){var _0x5224b9={};var _0x11aeda={};var _0x124fa6;var _0x1e933f;return db['MailAccount'][_0x32fa('0x65')]({'where':{'id':_0x3374bc[_0x32fa('0x5a')]['id']}})['then'](handleEntityNotFound(_0x15de26,null))['then'](function(_0x40ff75){if(_0x40ff75){_0x124fa6=_0x40ff75;_0x11aeda[_0x32fa('0x46')]=_[_0x32fa('0x48')](db[_0x32fa('0x90')]['rawAttributes']);_0x11aeda['query']=_[_0x32fa('0x48')](_0x3374bc['query']);_0x11aeda[_0x32fa('0x49')]=_[_0x32fa('0x4a')](_0x11aeda[_0x32fa('0x46')],_0x11aeda[_0x32fa('0x47')]);_0x5224b9['attributes']=_[_0x32fa('0x4a')](_0x11aeda['model'],qs['fields'](_0x3374bc[_0x32fa('0x47')][_0x32fa('0x4b')]));_0x5224b9[_0x32fa('0x4c')]=_0x5224b9['attributes'][_0x32fa('0x4d')]?_0x5224b9[_0x32fa('0x4c')]:_0x11aeda[_0x32fa('0x46')];_0x5224b9[_0x32fa('0x66')]=qs[_0x32fa('0x4f')](_0x3374bc[_0x32fa('0x47')][_0x32fa('0x4f')]);_0x5224b9['where']=qs['filters'](_[_0x32fa('0x50')](_0x3374bc[_0x32fa('0x47')],_0x11aeda[_0x32fa('0x49')]));if(_0x3374bc[_0x32fa('0x47')][_0x32fa('0x51')]){_0x5224b9[_0x32fa('0x52')]=_['merge'](_0x5224b9[_0x32fa('0x52')],{'$or':_[_0x32fa('0x54')](_0x5224b9['attributes'],function(_0x2095fe){var _0x21749c={};_0x21749c[_0x2095fe]={'$like':'%'+_0x3374bc['query'][_0x32fa('0x51')]+'%'};return _0x21749c;})});}_0x5224b9=_[_0x32fa('0x53')]({},_0x5224b9,_0x3374bc[_0x32fa('0x56')]);return _0x124fa6[_0x32fa('0x95')](_0x5224b9);}})[_0x32fa('0x1f')](function(_0x1951e3){if(_0x1951e3){_0x1e933f=_0x1951e3[_0x32fa('0x4d')];if(!_0x3374bc[_0x32fa('0x47')][_0x32fa('0x6f')]('nolimit')){_0x5224b9['limit']=qs[_0x32fa('0x1c')](_0x3374bc[_0x32fa('0x47')]['limit']);_0x5224b9[_0x32fa('0x1a')]=qs['offset'](_0x3374bc['query'][_0x32fa('0x1a')]);}return _0x124fa6[_0x32fa('0x95')](_0x5224b9);}})[_0x32fa('0x1f')](function(_0x2f214b){if(_0x2f214b){return _0x2f214b?{'count':_0x1e933f,'rows':_0x2f214b}:null;}})[_0x32fa('0x1f')](respondWithResult(_0x15de26,null))[_0x32fa('0x16')](handleError(_0x15de26,null));};exports[_0x32fa('0x96')]=function(_0x429654,_0x1eaf2f){var _0x3a1fee={'raw':!![],'where':{}};var _0x9af18e={};var _0x125b6d={'count':0x0,'rows':[]};return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x429654[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x1eaf2f,null))[_0x32fa('0x1f')](function(_0x242bfa){if(_0x242bfa){_0x9af18e['model']=_[_0x32fa('0x48')](db['MailMessage'][_0x32fa('0x44')]);_0x9af18e['query']=_[_0x32fa('0x48')](_0x429654[_0x32fa('0x47')]);_0x9af18e[_0x32fa('0x49')]=_[_0x32fa('0x4a')](_0x9af18e['model'],_0x9af18e[_0x32fa('0x47')]);_0x3a1fee['attributes']=_['intersection'](_0x9af18e[_0x32fa('0x46')],qs[_0x32fa('0x4b')](_0x429654[_0x32fa('0x47')][_0x32fa('0x4b')]));_0x3a1fee[_0x32fa('0x4c')]=_0x3a1fee[_0x32fa('0x4c')]['length']?_0x3a1fee[_0x32fa('0x4c')]:_0x9af18e[_0x32fa('0x46')];if(!_0x429654[_0x32fa('0x47')]['hasOwnProperty'](_0x32fa('0x4e'))){_0x3a1fee[_0x32fa('0x1c')]=qs[_0x32fa('0x1c')](_0x429654[_0x32fa('0x47')][_0x32fa('0x1c')]);_0x3a1fee[_0x32fa('0x1a')]=qs['offset'](_0x429654[_0x32fa('0x47')][_0x32fa('0x1a')]);}_0x3a1fee[_0x32fa('0x66')]=qs['sort'](_0x429654[_0x32fa('0x47')]['sort']);_0x3a1fee[_0x32fa('0x52')]=qs[_0x32fa('0x49')](_['pick'](_0x429654['query'],_0x9af18e['filters']));_0x3a1fee[_0x32fa('0x52')][_0x32fa('0x67')]=_0x242bfa['id'];if(_0x429654['query'][_0x32fa('0x51')]){_0x3a1fee['where']=_[_0x32fa('0x53')](_0x3a1fee['where'],{'$or':_[_0x32fa('0x54')](_0x3a1fee[_0x32fa('0x4c')],function(_0x4006e7){var _0xc06d06={};_0xc06d06[_0x4006e7]={'$like':'%'+_0x429654[_0x32fa('0x47')][_0x32fa('0x51')]+'%'};return _0xc06d06;})});}if(_0x429654[_0x32fa('0x47')]['$gte']){var _0x329a57=_0x429654[_0x32fa('0x47')][_0x32fa('0x97')][_0x32fa('0x98')](',');var _0x3a46fa={};_0x3a46fa[_0x329a57[0x0]]={'$gte':moment(_0x329a57[0x1])[_0x32fa('0x99')](_0x32fa('0x9a'))};_0x3a1fee[_0x32fa('0x52')]=_[_0x32fa('0x53')](_0x3a1fee[_0x32fa('0x52')],_0x3a46fa);}_0x3a1fee=_[_0x32fa('0x53')]({},_0x3a1fee,_0x429654[_0x32fa('0x56')]);return db[_0x32fa('0x9b')][_0x32fa('0x1d')]({'where':_0x3a1fee[_0x32fa('0x52')]})['then'](function(_0x484f7c){_0x125b6d[_0x32fa('0x1d')]=_0x484f7c;if(_0x429654[_0x32fa('0x47')][_0x32fa('0x69')]){_0x3a1fee[_0x32fa('0x57')]=[{'all':!![]}];}return db[_0x32fa('0x9b')][_0x32fa('0x58')](_0x3a1fee);})[_0x32fa('0x1f')](function(_0x1b584d){if(_0x429654['query'][_0x32fa('0x9c')]==='true'){for(var _0x44c8f9=0x0;_0x44c8f9<_0x1b584d[_0x32fa('0x4d')];_0x44c8f9++){_0x1b584d[_0x44c8f9][_0x32fa('0x5f')]=juice(_0x1b584d[_0x44c8f9][_0x32fa('0x5f')]);}}_0x125b6d[_0x32fa('0x6a')]=_0x1b584d;return _0x125b6d;});}})[_0x32fa('0x1f')](respondWithFilteredResult(_0x1eaf2f,_0x3a1fee))[_0x32fa('0x16')](handleError(_0x1eaf2f,null));};exports['send']=function(_0x404639,_0xcd48c){var _0x34f32b,_0x4e9a99={},_0x5630c3;if(_0x404639[_0x32fa('0x5f')]['to']){_0x5630c3=_0x404639[_0x32fa('0x5f')]['to']['split'](',')[0x0];}return db[_0x32fa('0x43')][_0x32fa('0x5d')]({'where':{'id':_0x404639[_0x32fa('0x5a')]['id']},'include':[{'model':db[_0x32fa('0x9d')],'as':_0x32fa('0x9e'),'include':[{'model':db[_0x32fa('0x84')],'as':_0x32fa('0x9f'),'where':{'email':_0x5630c3},'limit':0x1,'order':[[_0x32fa('0xa0'),_0x32fa('0xa1')]]}]},{'model':db[_0x32fa('0x5c')],'as':_0x32fa('0x3f'),'raw':!![],'include':[{'model':db[_0x32fa('0xa2')],'as':_0x32fa('0xa2'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xcd48c,null))[_0x32fa('0x1f')](function(_0x3c8587){if(!_0x3c8587)return;_0x34f32b=_0x3c8587;if(!_0x3c8587[_0x32fa('0x3f')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x32fa('0xa3')](_0x404639[_0x32fa('0x5f')][_0x32fa('0xa4')])){_0x404639[_0x32fa('0x5f')][_0x32fa('0xa4')]=util[_0x32fa('0x99')]('%s\x20<%s>',_0x3c8587[_0x32fa('0x25')],_0x3c8587[_0x32fa('0x74')]||_0x3c8587[_0x32fa('0x3f')][_0x32fa('0x33')]);}if(_0x404639['body'][_0x32fa('0xa5')]&&_0x404639['body'][_0x32fa('0xa5')][_0x32fa('0x4d')]){for(var _0x386bc9=0x0;_0x386bc9<_0x404639[_0x32fa('0x5f')]['attachments'][_0x32fa('0x4d')];_0x386bc9+=0x1){_0x404639[_0x32fa('0x5f')]['attachments'][_0x386bc9]={'filename':_0x404639['body'][_0x32fa('0xa5')][_0x386bc9][_0x32fa('0x25')],'path':path['join'](config[_0x32fa('0xa6')],_0x32fa('0xa7'),_0x404639[_0x32fa('0x5f')][_0x32fa('0xa5')][_0x386bc9][_0x32fa('0xa8')])};}}var _0x5171fb=_0x3c8587[_0x32fa('0xa9')]();return respondWithRpcPromise(_0x32fa('0xaa'),_0x32fa('0xab'),{'account':_0x5171fb,'message':_0x404639[_0x32fa('0x5f')]});})[_0x32fa('0x1f')](function(_0xcfbbf4){if(!_0xcfbbf4)return;_0x4e9a99=_0xcfbbf4;if(!_0x34f32b[_0x32fa('0x9e')])throw new Error(_0x32fa('0xac'));if(_0x34f32b[_0x32fa('0x9e')][_0x32fa('0x9f')][_0x32fa('0x4d')])return _0x34f32b[_0x32fa('0x9e')][_0x32fa('0x9f')][0x0];return db[_0x32fa('0x84')][_0x32fa('0x71')](_[_0x32fa('0xad')](_0x404639[_0x32fa('0x5f')],{'firstName':_0x404639[_0x32fa('0x5f')]['to'],'email':_0x404639['body']['to'],'phone':_0x404639[_0x32fa('0x5f')]['to'],'ListId':_0x34f32b[_0x32fa('0xae')]}));})['then'](function(_0x345abb){if(!_0x345abb)return;var _0x41c562={'UserId':_0x404639[_0x32fa('0x33')]['id'],'ContactId':_0x345abb['id'],'MailAccountId':_0x34f32b['id'],'inReplyTo':_0x4e9a99[_0x32fa('0xaf')],'to':_0x404639['body'][_0x32fa('0xa4')],'cc':_0x404639[_0x32fa('0x5f')]['cc'],'subject':_0x404639[_0x32fa('0x5f')][_0x32fa('0xb0')],'attach':_0x404639[_0x32fa('0x5f')][_0x32fa('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x32fa('0x99')](_0x32fa('0x9a')),'lastMsgDirection':_0x32fa('0xb2'),'Messages':[_[_0x32fa('0x53')](_0x404639['body'],{'messageId':_0x4e9a99[_0x32fa('0xaf')],'sentAt':moment()[_0x32fa('0x99')](_0x32fa('0x9a')),'read':!![],'MailAccountId':_0x34f32b['id'],'UserId':_0x404639['user']['id'],'ContactId':_0x345abb['id']})]};if(_0x404639[_0x32fa('0x5f')][_0x32fa('0xb3')]){_0x41c562=_[_0x32fa('0x53')](_0x41c562,_0x404639[_0x32fa('0x5f')][_0x32fa('0xb3')]);}return db['MailInteraction'][_0x32fa('0x71')](_0x41c562,{'include':[{'model':db['MailMessage'],'as':_0x32fa('0xb4')}]});})[_0x32fa('0x1f')](respondWithResult(_0xcd48c,null))[_0x32fa('0x16')](handleError(_0xcd48c,null));};exports[_0x32fa('0xb5')]=function(_0x2a4aee,_0x5eae10){return db[_0x32fa('0x43')][_0x32fa('0x5d')]({'where':{'id':_0x2a4aee['params']['id']},'include':[{'model':db[_0x32fa('0x5c')],'as':_0x32fa('0x3f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x32fa('0xa2'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5eae10,null))['then'](function(_0x3d7fa9){if(!_0x3d7fa9['Smtp'])return;var _0x21bb6a=_0x3d7fa9[_0x32fa('0xa9')]();return respondWithRpcPromise('VerifySmtp',_0x32fa('0xb5'),{'account':_0x21bb6a});})[_0x32fa('0x1f')](respondWithResult(_0x5eae10,null))[_0x32fa('0x16')](handleError(_0x5eae10,null));};exports[_0x32fa('0x22')]=function(_0x1dcb4c,_0x5ef0fd){return db['MailAccount'][_0x32fa('0x5d')]({'where':{'id':_0x1dcb4c['params']['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x5ef0fd,null))['then'](function(_0x3d1c93){if(_0x3d1c93&&_0x3d1c93['service']){throw new db['Sequelize'][(_0x32fa('0xb6'))](_0x32fa('0xb7'));}return _0x3d1c93;})[_0x32fa('0x1f')](removeEntity(_0x5ef0fd,null))[_0x32fa('0x16')](handleError(_0x5ef0fd,null));};exports[_0x32fa('0xb8')]=function(_0x5aa26b,_0x1a58e3){return db[_0x32fa('0x43')][_0x32fa('0x5d')]({'where':{'id':_0x5aa26b['params']['id']}})['then'](handleEntityNotFound(_0x1a58e3,null))['then'](function(_0x559e3d){if(_0x559e3d){return _0x559e3d['addAgents'](_0x5aa26b['body'][_0x32fa('0x6b')],_[_0x32fa('0x82')](_0x5aa26b[_0x32fa('0x5f')],[_0x32fa('0x6b'),'id'])||{})['spread'](function(_0x4f1f7c){for(var _0x5963f5=0x0;_0x5963f5<_0x5aa26b[_0x32fa('0x5f')][_0x32fa('0x6b')]['length'];_0x5963f5+=0x1){socket['emit'](_0x32fa('0xb9'),{'UserId':Number(_0x5aa26b[_0x32fa('0x5f')][_0x32fa('0x6b')][_0x5963f5]),'MailAccountId':Number(_0x5aa26b['params']['id'])});}return _0x4f1f7c;});}})[_0x32fa('0x1f')](respondWithResult(_0x1a58e3,null))[_0x32fa('0x16')](handleError(_0x1a58e3,null));};exports[_0x32fa('0xba')]=function(_0x2b61b5,_0x1a2983){return db['MailAccount'][_0x32fa('0x5d')]({'where':{'id':_0x2b61b5[_0x32fa('0x5a')]['id']}})[_0x32fa('0x1f')](handleEntityNotFound(_0x1a2983,null))[_0x32fa('0x1f')](function(_0x12cea5){if(_0x12cea5){return _0x12cea5[_0x32fa('0xba')](_0x2b61b5['query'][_0x32fa('0x6b')])[_0x32fa('0x1f')](function(){if(_[_0x32fa('0xbb')](_0x2b61b5[_0x32fa('0x47')][_0x32fa('0x6b')])){for(var _0x172805=0x0;_0x172805<_0x2b61b5['query']['ids'][_0x32fa('0x4d')];_0x172805+=0x1){socket[_0x32fa('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x2b61b5[_0x32fa('0x47')][_0x32fa('0x6b')][_0x172805]),'MailAccountId':Number(_0x2b61b5[_0x32fa('0x5a')]['id'])});}}else{socket[_0x32fa('0xbc')](_0x32fa('0xbd'),{'UserId':Number(_0x2b61b5[_0x32fa('0x47')][_0x32fa('0x6b')]),'MailAccountId':Number(_0x2b61b5[_0x32fa('0x5a')]['id'])});}});}})[_0x32fa('0x1f')](respondWithStatusCode(_0x1a2983,null))[_0x32fa('0x16')](handleError(_0x1a2983,null));};exports[_0x32fa('0xbe')]=function(_0x4eaa1d,_0x328230){var _0x2c3292={};var _0x422824={};var _0x1f1ac9;var _0x4f22a3;return db[_0x32fa('0x43')][_0x32fa('0x65')]({'where':{'id':_0x4eaa1d[_0x32fa('0x5a')]['id']}})['then'](handleEntityNotFound(_0x328230,null))['then'](function(_0x49f587){if(_0x49f587){_0x1f1ac9=_0x49f587;_0x422824[_0x32fa('0x46')]=_['keys'](db[_0x32fa('0x86')][_0x32fa('0x44')]);_0x422824[_0x32fa('0x47')]=_[_0x32fa('0x48')](_0x4eaa1d[_0x32fa('0x47')]);_0x422824[_0x32fa('0x49')]=_[_0x32fa('0x4a')](_0x422824[_0x32fa('0x46')],_0x422824[_0x32fa('0x47')]);_0x2c3292[_0x32fa('0x4c')]=_['intersection'](_0x422824['model'],qs[_0x32fa('0x4b')](_0x4eaa1d[_0x32fa('0x47')][_0x32fa('0x4b')]));_0x2c3292['attributes']=_0x2c3292[_0x32fa('0x4c')][_0x32fa('0x4d')]?_0x2c3292['attributes']:_0x422824[_0x32fa('0x46')];_0x2c3292[_0x32fa('0x66')]=qs[_0x32fa('0x4f')](_0x4eaa1d['query'][_0x32fa('0x4f')]);_0x2c3292[_0x32fa('0x52')]=qs['filters'](_[_0x32fa('0x50')](_0x4eaa1d[_0x32fa('0x47')],_0x422824[_0x32fa('0x49')]));if(_0x4eaa1d[_0x32fa('0x47')][_0x32fa('0x51')]){_0x2c3292[_0x32fa('0x52')]=_[_0x32fa('0x53')](_0x2c3292[_0x32fa('0x52')],{'$or':_['map'](_0x2c3292[_0x32fa('0x4c')],function(_0x347c95){var _0x12c45e={};_0x12c45e[_0x347c95]={'$like':'%'+_0x4eaa1d[_0x32fa('0x47')][_0x32fa('0x51')]+'%'};return _0x12c45e;})});}_0x2c3292=_['merge']({},_0x2c3292,_0x4eaa1d[_0x32fa('0x56')]);return _0x1f1ac9[_0x32fa('0xbe')](_0x2c3292);}})[_0x32fa('0x1f')](function(_0x587dcb){if(_0x587dcb){_0x4f22a3=_0x587dcb[_0x32fa('0x4d')];if(!_0x4eaa1d[_0x32fa('0x47')]['hasOwnProperty'](_0x32fa('0x4e'))){_0x2c3292['limit']=qs[_0x32fa('0x1c')](_0x4eaa1d['query'][_0x32fa('0x1c')]);_0x2c3292[_0x32fa('0x1a')]=qs[_0x32fa('0x1a')](_0x4eaa1d[_0x32fa('0x47')]['offset']);}return _0x1f1ac9[_0x32fa('0xbe')](_0x2c3292);}})[_0x32fa('0x1f')](function(_0x39b076){if(_0x39b076){return _0x39b076?{'count':_0x4f22a3,'rows':_0x39b076}:null;}})[_0x32fa('0x1f')](respondWithResult(_0x328230,null))[_0x32fa('0x16')](handleError(_0x328230,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9cad078..e4e18c2 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 _0x22e3=['events','../../mysqldb','MailAccount','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x22e3,0xf3));var _0x322e=function(_0x3b15e6,_0x448bb7){_0x3b15e6=_0x3b15e6-0x0;var _0x13b740=_0x22e3[_0x3b15e6];return _0x13b740;};'use strict';var EventEmitter=require(_0x322e('0x0'));var MailAccount=require(_0x322e('0x1'))['db'][_0x322e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x322e('0x3'),'afterUpdate':_0x322e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f16fd){return function(_0x2d8822,_0x115e3c,_0x371172){MailAccountEvents[_0x322e('0x5')](_0x3f16fd+':'+_0x2d8822['id'],_0x2d8822);MailAccountEvents['emit'](_0x3f16fd,_0x2d8822);_0x371172(null);};}for(var e in events){if(events[_0x322e('0x6')](e)){var event=events[e];MailAccount[_0x322e('0x7')](e,emitEvent(event));}}module[_0x322e('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x76d0=['events','../../mysqldb','MailAccount','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x474f02,_0x44c5af){var _0x47321d=function(_0x40e0de){while(--_0x40e0de){_0x474f02['push'](_0x474f02['shift']());}};_0x47321d(++_0x44c5af);}(_0x76d0,0x132));var _0x076d=function(_0x2ea26d,_0x8c061c){_0x2ea26d=_0x2ea26d-0x0;var _0x1746ac=_0x76d0[_0x2ea26d];return _0x1746ac;};'use strict';var EventEmitter=require(_0x076d('0x0'));var MailAccount=require(_0x076d('0x1'))['db'][_0x076d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x076d('0x3'),'afterDestroy':_0x076d('0x4')};function emitEvent(_0x4660e0){return function(_0x3f2663,_0x2a9ef1,_0x52e68d){MailAccountEvents['emit'](_0x4660e0+':'+_0x3f2663['id'],_0x3f2663);MailAccountEvents[_0x076d('0x5')](_0x4660e0,_0x3f2663);_0x52e68d(null);};}for(var e in events){if(events[_0x076d('0x6')](e)){var event=events[e];MailAccount[_0x076d('0x7')](e,emitEvent(event));}}module[_0x076d('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 93394d6..ed87f9f 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 _0x8e3e=['secure','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','custom','service','provider','host','port','Smtp'];(function(_0x443e83,_0x49af21){var _0x272399=function(_0x58bd49){while(--_0x58bd49){_0x443e83['push'](_0x443e83['shift']());}};_0x272399(++_0x49af21);}(_0x8e3e,0x136));var _0xe8e3=function(_0x388f2d,_0x1089ea){_0x388f2d=_0x388f2d-0x0;var _0x4de9ea=_0x8e3e[_0x388f2d];return _0x4de9ea;};'use strict';var attributes=require(_0xe8e3('0x0'));module[_0xe8e3('0x1')]=function(_0x2bdf6b){return _0x2bdf6b['define'](_0xe8e3('0x2'),attributes,{'tableName':_0xe8e3('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x36c4c7=this;var _0x4b5205={'id':_0x36c4c7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x36c4c7['provider']!==_0xe8e3('0x4')){_0x4b5205[_0xe8e3('0x5')]=_0x36c4c7[_0xe8e3('0x6')];}else{_0x4b5205['host']=_0x36c4c7['Smtp'][_0xe8e3('0x7')];_0x4b5205[_0xe8e3('0x8')]=_0x36c4c7[_0xe8e3('0x9')]['port'];_0x4b5205[_0xe8e3('0xa')]=_0x36c4c7[_0xe8e3('0x9')][_0xe8e3('0xa')];}if(_0x36c4c7[_0xe8e3('0x9')]['authentication']){if(_0x36c4c7[_0xe8e3('0x9')]['modernAuthentication']){if(!_0x36c4c7[_0xe8e3('0x9')]['CloudProvider'])throw new Error(_0xe8e3('0xb'));_0x4b5205[_0xe8e3('0xc')]={'type':'OAuth2','user':_0x36c4c7[_0xe8e3('0x9')][_0xe8e3('0xd')],'accessToken':_0x36c4c7['Smtp'][_0xe8e3('0xe')]['data5']};}else{_0x4b5205['auth']={'user':_0x36c4c7[_0xe8e3('0x9')][_0xe8e3('0xd')],'pass':_0x36c4c7[_0xe8e3('0x9')][_0xe8e3('0xf')]};}}return _0x4b5205;}}});}; \ No newline at end of file +var _0xf5b1=['user','data5','pass','./mailAccount.attributes','define','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5b1,0x73));var _0x1f5b=function(_0x52ee47,_0x5aaffc){_0x52ee47=_0x52ee47-0x0;var _0x2e2c82=_0xf5b1[_0x52ee47];return _0x2e2c82;};'use strict';var attributes=require(_0x1f5b('0x0'));module['exports']=function(_0x3e9339){return _0x3e9339[_0x1f5b('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4d7f0a=this;var _0x114364={'id':_0x4d7f0a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4d7f0a['provider']!==_0x1f5b('0x2')){_0x114364[_0x1f5b('0x3')]=_0x4d7f0a['provider'];}else{_0x114364[_0x1f5b('0x4')]=_0x4d7f0a['Smtp'][_0x1f5b('0x4')];_0x114364[_0x1f5b('0x5')]=_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0x5')];_0x114364[_0x1f5b('0x7')]=_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0x7')];}if(_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0x8')]){if(_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0x9')]){if(!_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0xa')])throw new Error(_0x1f5b('0xb'));_0x114364[_0x1f5b('0xc')]={'type':'OAuth2','user':_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0xd')],'accessToken':_0x4d7f0a[_0x1f5b('0x6')]['CloudProvider'][_0x1f5b('0xe')]};}else{_0x114364[_0x1f5b('0xc')]={'user':_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0xd')],'pass':_0x4d7f0a[_0x1f5b('0x6')][_0x1f5b('0xf')]};}}return _0x114364;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c57a349..9b61419 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 _0xee3c=['localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','List','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','length','create','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','update','attach','interaction','get','created','MailMessage','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3ab1d1,_0x1e29d1){var _0x54e7d5=function(_0x223dfb){while(--_0x223dfb){_0x3ab1d1['push'](_0x3ab1d1['shift']());}};_0x54e7d5(++_0x1e29d1);}(_0xee3c,0x14a));var _0xcee3=function(_0x28ddf5,_0x225183){_0x28ddf5=_0x28ddf5-0x0;var _0x4cec60=_0xee3c[_0x28ddf5];return _0x4cec60;};'use strict';var _=require(_0xcee3('0x0'));var moment=require(_0xcee3('0x1'));var BPromise=require(_0xcee3('0x2'));var rs=require(_0xcee3('0x3'));var Redis=require(_0xcee3('0x4'));var db=require(_0xcee3('0x5'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0xcee3('0x6'));var jayson=require(_0xcee3('0x7'));var client=jayson[_0xcee3('0x8')][_0xcee3('0x9')]({'port':0x232c});config[_0xcee3('0xa')]=_[_0xcee3('0xb')](config[_0xcee3('0xa')],{'host':_0xcee3('0xc'),'port':0x18eb});var socket=require(_0xcee3('0xd'))(new Redis(config[_0xcee3('0xa')]));require(_0xcee3('0xe'))[_0xcee3('0xf')](socket);function respondWithRpcPromise(_0x861421,_0x81de8e,_0x15d2af){return new BPromise(function(_0x507d8c,_0x1ed6a6){return client[_0xcee3('0x10')](_0x861421,_0x15d2af)[_0xcee3('0x11')](function(_0x2790ba){logger[_0xcee3('0x12')](_0xcee3('0x13'),_0x81de8e,'request\x20sent');logger[_0xcee3('0x14')](_0xcee3('0x15'),_0x81de8e,_0xcee3('0x16'),JSON[_0xcee3('0x17')](_0x2790ba));if(_0x2790ba[_0xcee3('0x18')]){if(_0x2790ba['error'][_0xcee3('0x19')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x81de8e,_0x2790ba['error'][_0xcee3('0x1a')]);return _0x1ed6a6(_0x2790ba[_0xcee3('0x18')]['message']);}logger['error'](_0xcee3('0x13'),_0x81de8e,_0x2790ba['error'][_0xcee3('0x1a')]);return _0x507d8c(_0x2790ba['error'][_0xcee3('0x1a')]);}else{logger[_0xcee3('0x12')]('MailAccount,\x20%s,\x20%s',_0x81de8e,_0xcee3('0x16'));_0x507d8c(_0x2790ba[_0xcee3('0x1b')][_0xcee3('0x1a')]);}})[_0xcee3('0x1c')](function(_0x50bf6e){logger[_0xcee3('0x18')](_0xcee3('0x13'),_0x81de8e,_0x50bf6e);_0x1ed6a6(_0x50bf6e);});});}exports[_0xcee3('0x1d')]=function(_0x11bf37){var _0x52f4d7=this;return new Promise(function(_0x254de7,_0xf2f32){return db[_0xcee3('0x1e')][_0xcee3('0x1f')]({'raw':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x21')]===undefined?!![]:![]:!![],'where':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x22')]||null:null,'attributes':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x23')]||null:null,'limit':_0x11bf37['options']?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x24')]||null:null,'include':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x25')]?_['map'](_0x11bf37['options'][_0xcee3('0x25')],function(_0x5b92ba){return{'model':db[_0x5b92ba['model']],'as':_0x5b92ba['as'],'attributes':_0x5b92ba[_0xcee3('0x23')],'include':_0x5b92ba['include']?_[_0xcee3('0x26')](_0x5b92ba[_0xcee3('0x25')],function(_0x19a15e){return{'model':db[_0x19a15e['model']],'as':_0x19a15e['as'],'attributes':_0x19a15e[_0xcee3('0x23')],'include':_0x19a15e['include']?_[_0xcee3('0x26')](_0x19a15e['include'],function(_0x2c2d48){return{'model':db[_0x2c2d48[_0xcee3('0x27')]],'as':_0x2c2d48['as'],'attributes':_0x2c2d48['attributes']};}):[]};}):[]};}):[]:[]})[_0xcee3('0x11')](function(_0x1efb1b){logger['info'](_0xcee3('0x1d'),_0x11bf37);logger['debug']('GetMailAccount',_0x11bf37,JSON[_0xcee3('0x17')](_0x1efb1b));_0x254de7(_0x1efb1b);})['catch'](function(_0x22e342){logger[_0xcee3('0x18')](_0xcee3('0x1d'),_0x22e342[_0xcee3('0x1a')],_0x11bf37);_0xf2f32(_0x52f4d7[_0xcee3('0x18')](0x1f4,_0x22e342[_0xcee3('0x1a')]));});});};exports[_0xcee3('0x28')]=function(_0x5ce5be){var _0x298a29=this;return new Promise(function(_0x56f705,_0x74019c){return db[_0xcee3('0x1e')][_0xcee3('0x29')]({'raw':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x21')]===undefined?!![]:![]:!![],'where':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')]['where']||null:null,'attributes':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x23')]||null:null,'include':_0x5ce5be['options']?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x25')]?_['map'](_0x5ce5be[_0xcee3('0x20')]['include'],function(_0x2a4996){return{'model':db[_0x2a4996['model']],'as':_0x2a4996['as'],'attributes':_0x2a4996['attributes'],'include':_0x2a4996[_0xcee3('0x25')]?_['map'](_0x2a4996[_0xcee3('0x25')],function(_0x322e05){return{'model':db[_0x322e05[_0xcee3('0x27')]],'as':_0x322e05['as'],'attributes':_0x322e05[_0xcee3('0x23')],'include':_0x322e05['include']?_['map'](_0x322e05[_0xcee3('0x25')],function(_0x45feca){return{'model':db[_0x45feca['model']],'as':_0x45feca['as'],'attributes':_0x45feca[_0xcee3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcee3('0x11')](function(_0x55081a){if(_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x2a')]===!![])_0x55081a[_0xcee3('0x2b')](_0xcee3('0x2c'),_0x55081a[_0xcee3('0x2d')]());logger[_0xcee3('0x12')]('ShowMailAccount',_0x5ce5be);logger[_0xcee3('0x14')](_0xcee3('0x28'),_0x5ce5be,JSON[_0xcee3('0x17')](_0x55081a));_0x56f705(_0x55081a);})[_0xcee3('0x1c')](function(_0x3ea90f){logger[_0xcee3('0x18')](_0xcee3('0x28'),_0x3ea90f['message'],_0x5ce5be);_0x74019c(_0x298a29[_0xcee3('0x18')](0x1f4,_0x3ea90f[_0xcee3('0x1a')]));});});};exports[_0xcee3('0x2e')]=function(_0x51aae6){var _0x45dab9=this;return new Promise(function(_0x436961,_0x5a7c9f){var _0x305bfa={'body':_0x51aae6[_0xcee3('0x2f')],'channel':_0xcee3('0x30')};var _0x5b4b40=_[_0xcee3('0x31')](_[_0xcee3('0x32')](db[_0xcee3('0x33')][_0xcee3('0x34')]),[_0xcee3('0x35'),'updatedAt','CompanyId',_0xcee3('0x36')]);var _0x41cd61=![];if(_0x51aae6[_0xcee3('0x2f')]['id']){delete _0x51aae6[_0xcee3('0x2f')]['id'];}if(_[_0xcee3('0x37')](_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xcee3('0x37')](_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')])||_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')]===''){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x39')));}if(_['isNil'](_0x51aae6[_0xcee3('0x2f')]['mapKey'])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x3a')+_0x5b4b40));}if(!_['includes'](_0x5b4b40,_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x3c')+_0x5b4b40));}var _0x12d32e={};_0x12d32e[_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')]]=_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')];return db[_0xcee3('0x1e')]['find']({'where':{'id':_0x51aae6[_0xcee3('0x3d')]['id']},'include':[{'model':db[_0xcee3('0x3e')],'as':'List','include':[{'model':db[_0xcee3('0x33')],'as':_0xcee3('0x3f'),'where':_0x12d32e,'limit':0x1,'order':[[_0xcee3('0x40'),_0xcee3('0x41')]]}]},{'model':db[_0xcee3('0x42')],'as':_0xcee3('0x43')},{'model':db[_0xcee3('0x44')],'as':'Smtp','include':[{'model':db[_0xcee3('0x45')],'as':_0xcee3('0x45')}]}]})[_0xcee3('0x11')](function(_0x27022b){if(_0x27022b&&_0x27022b[_0xcee3('0x46')]){var _0x2a0b71=_0x27022b['get']({'plain':!![]});_0x305bfa[_0xcee3('0x3d')]=_['omit'](_0x2a0b71,[_0xcee3('0x43'),_0xcee3('0x46')]);_0x305bfa[_0xcee3('0x3d')]['smtpOptions']=_0x27022b['getSmtpOptions']();_0x305bfa[_0xcee3('0x47')]=_0x2a0b71[_0xcee3('0x43')];_0x305bfa['list']=_0x2a0b71[_0xcee3('0x46')];_0x305bfa['applications']=_[_0xcee3('0x48')](_0x305bfa[_0xcee3('0x47')],[_0xcee3('0x49')],[_0xcee3('0x4a')]);if(_0x305bfa['account']&&_0x305bfa['account']['autoclose']){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x4b')]({'id':0x0,'priority':_0x305bfa[_0xcee3('0x47')]['length']+0x1,'app':_0xcee3('0x4c'),'appdata':_0xcee3('0x4d'),'interval':_0xcee3('0x4e')});}if(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x43')]){delete _0x305bfa[_0xcee3('0x3d')][_0xcee3('0x43')];}if(_0x305bfa['account']['List']){delete _0x305bfa[_0xcee3('0x3d')]['List'];}if(_0x2a0b71['List']['Contacts'][_0xcee3('0x4f')]){return _0x2a0b71[_0xcee3('0x46')][_0xcee3('0x3f')][0x0];}var _0x295451=_[_0xcee3('0xb')](_0x51aae6['body'],{'firstName':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')],'ListId':_0x2a0b71[_0xcee3('0x36')]});_0x295451[_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')]]=_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')];return db[_0xcee3('0x33')][_0xcee3('0x50')](_0x295451);}else{throw new Error('List\x20not\x20found');}})[_0xcee3('0x11')](function(_0x2e7a8d){_0x305bfa[_0xcee3('0x51')]=_0x2e7a8d;if(_0x2e7a8d){if(!_0x51aae6['body'][_0xcee3('0x1a')]['messageId']){_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x52')]=rs[_0xcee3('0x53')]()+'\x20'+_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x38')];}var _0x46f817={'ContactId':_0x2e7a8d['id'],'MailAccountId':_0x51aae6['account']['id'],'inReplyTo':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x52')],'to':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x38')],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x54')],'attach':_0x51aae6['body']['message']['attach'],'lastMsgAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x51aae6[_0xcee3('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':_0xcee3('0x57'),'attributes':[_0xcee3('0x52')],'where':{'messageId':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x58')]}}]})[_0xcee3('0x11')](function(_0x1b5d89){if(_0x1b5d89){return[_0x1b5d89,![]];}return db['MailInteraction']['create'](_0x46f817)[_0xcee3('0x11')](function(_0x9d6ffd){return[_0x9d6ffd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x22e6b9,_0x3ce8ad){if(_0x22e6b9){_0x41cd61=_0x3ce8ad;if(!_0x3ce8ad){return _0x22e6b9[_0xcee3('0x59')]({'inReplyTo':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['messageId'],'to':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['from'],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x54')],'attach':_0x22e6b9[_0xcee3('0x5a')]?_0x22e6b9['attach']:_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x5a')],'substatus':null,'substatusAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgDirection':'in'});}else{return _0x22e6b9;}}})[_0xcee3('0x11')](function(_0x1cb05d){_0x305bfa[_0xcee3('0x5b')]=_0x1cb05d[_0xcee3('0x5c')]({'plain':!![]});_0x305bfa['interaction'][_0xcee3('0x5d')]=_0x41cd61;return db[_0xcee3('0x5e')][_0xcee3('0x50')]({'body':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')],'MailAccountId':_0x51aae6['account']['id'],'MailInteractionId':_0x1cb05d['id'],'direction':'in','ContactId':_0x305bfa[_0xcee3('0x51')]['id'],'messageId':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['messageId'],'from':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['from'],'to':_0x51aae6['body'][_0xcee3('0x1a')]['to'],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x54')],'attach':_0x51aae6[_0xcee3('0x2f')]['message']['attach'],'Attachments':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x5f')],'originTo':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x60')],'originCc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['originCc'],'bcc':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x61')],'ChatWebsiteId':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x62')]||null,'originChannel':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x63')]||_0xcee3('0x64'),'ChatOfflineMessageId':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x65')]||null},{'include':[{'model':db[_0xcee3('0x66')],'as':'Attachments'}]});})['then'](function(_0x23cd22){_0x305bfa[_0xcee3('0x1a')]=_0x23cd22;if(!_0x305bfa[_0xcee3('0x5b')][_0xcee3('0x67')]){return;}return db[_0xcee3('0x68')]['find']({'attributes':['id',_0xcee3('0x69')],'where':{'id':_0x305bfa['interaction']['UserId']}});})['then'](function(_0x237a9d){if(_0x237a9d){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x6a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x237a9d[_0xcee3('0x69')]+','+(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x6b')]||0xa),'interval':_0xcee3('0x4e')});}if(!_0x305bfa[_0xcee3('0x5b')][_0xcee3('0x6c')]){return;}return db[_0xcee3('0x6d')][_0xcee3('0x29')]({'attributes':['id',_0xcee3('0x69')],'where':{'id':_0x305bfa['interaction'][_0xcee3('0x6c')]}});})[_0xcee3('0x11')](function(_0x513fce){if(_0x513fce){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x6a')]({'id':0x0,'priority':0x1,'app':_0xcee3('0x6e'),'appdata':_0x513fce[_0xcee3('0x69')]+','+(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x6f')]||0x12c),'interval':_0xcee3('0x4e')});}return respondWithRpcPromise(_0xcee3('0x70'),_0xcee3('0x71'),_0x305bfa);})[_0xcee3('0x11')](function(_0x17cb5c){_0x436961(_0x17cb5c);})[_0xcee3('0x1c')](function(_0x51d3cf){_0x5a7c9f(_0x45dab9['error'](0x1f4,_0x51d3cf['message']));});});}; \ No newline at end of file +var _0x44e8=['waitForTheAssignedQueue','Start','startRouting','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailAccount','MailAccount','findAll','options','where','include','map','model','attributes','catch','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','ListId','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','asc','autoclose','length','close','*,*,*,*','List\x20not\x20found','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','update','attach','created','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachments','interaction','UserId','User','name','queueId','MailQueue','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44e8,0xd7));var _0x844e=function(_0x202be7,_0x507cb2){_0x202be7=_0x202be7-0x0;var _0x384155=_0x44e8[_0x202be7];return _0x384155;};'use strict';var _=require(_0x844e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x844e('0x1'));var Redis=require(_0x844e('0x2'));var db=require(_0x844e('0x3'))['db'];var logger=require(_0x844e('0x4'))('rpc');var config=require(_0x844e('0x5'));var jayson=require(_0x844e('0x6'));var client=jayson[_0x844e('0x7')][_0x844e('0x8')]({'port':0x232c});config['redis']=_[_0x844e('0x9')](config[_0x844e('0xa')],{'host':_0x844e('0xb'),'port':0x18eb});var socket=require(_0x844e('0xc'))(new Redis(config['redis']));require(_0x844e('0xd'))[_0x844e('0xe')](socket);function respondWithRpcPromise(_0x336881,_0x134672,_0x32c6c7){return new BPromise(function(_0x1f9921,_0x536601){return client[_0x844e('0xf')](_0x336881,_0x32c6c7)[_0x844e('0x10')](function(_0x183c7e){logger[_0x844e('0x11')](_0x844e('0x12'),_0x134672,_0x844e('0x13'));logger[_0x844e('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x134672,_0x844e('0x13'),JSON[_0x844e('0x15')](_0x183c7e));if(_0x183c7e['error']){if(_0x183c7e[_0x844e('0x16')][_0x844e('0x17')]===0x1f4){logger['error'](_0x844e('0x12'),_0x134672,_0x183c7e[_0x844e('0x16')][_0x844e('0x18')]);return _0x536601(_0x183c7e['error'][_0x844e('0x18')]);}logger[_0x844e('0x16')](_0x844e('0x12'),_0x134672,_0x183c7e[_0x844e('0x16')][_0x844e('0x18')]);return _0x1f9921(_0x183c7e[_0x844e('0x16')][_0x844e('0x18')]);}else{logger[_0x844e('0x11')]('MailAccount,\x20%s,\x20%s',_0x134672,_0x844e('0x13'));_0x1f9921(_0x183c7e['result'][_0x844e('0x18')]);}})['catch'](function(_0x315c50){logger['error'](_0x844e('0x12'),_0x134672,_0x315c50);_0x536601(_0x315c50);});});}exports[_0x844e('0x19')]=function(_0x2d6ba8){var _0x410325=this;return new Promise(function(_0x3ea7da,_0x2b58c7){return db[_0x844e('0x1a')][_0x844e('0x1b')]({'raw':_0x2d6ba8['options']?_0x2d6ba8[_0x844e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2d6ba8['options']?_0x2d6ba8[_0x844e('0x1c')][_0x844e('0x1d')]||null:null,'attributes':_0x2d6ba8[_0x844e('0x1c')]?_0x2d6ba8[_0x844e('0x1c')]['attributes']||null:null,'limit':_0x2d6ba8[_0x844e('0x1c')]?_0x2d6ba8[_0x844e('0x1c')]['limit']||null:null,'include':_0x2d6ba8[_0x844e('0x1c')]?_0x2d6ba8[_0x844e('0x1c')][_0x844e('0x1e')]?_[_0x844e('0x1f')](_0x2d6ba8[_0x844e('0x1c')][_0x844e('0x1e')],function(_0x498ae0){return{'model':db[_0x498ae0[_0x844e('0x20')]],'as':_0x498ae0['as'],'attributes':_0x498ae0[_0x844e('0x21')],'include':_0x498ae0[_0x844e('0x1e')]?_[_0x844e('0x1f')](_0x498ae0[_0x844e('0x1e')],function(_0x5d6856){return{'model':db[_0x5d6856[_0x844e('0x20')]],'as':_0x5d6856['as'],'attributes':_0x5d6856['attributes'],'include':_0x5d6856['include']?_[_0x844e('0x1f')](_0x5d6856[_0x844e('0x1e')],function(_0x355456){return{'model':db[_0x355456['model']],'as':_0x355456['as'],'attributes':_0x355456[_0x844e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x844e('0x10')](function(_0xc3ec93){logger['info'](_0x844e('0x19'),_0x2d6ba8);logger[_0x844e('0x14')](_0x844e('0x19'),_0x2d6ba8,JSON[_0x844e('0x15')](_0xc3ec93));_0x3ea7da(_0xc3ec93);})[_0x844e('0x22')](function(_0x799cde){logger[_0x844e('0x16')](_0x844e('0x19'),_0x799cde[_0x844e('0x18')],_0x2d6ba8);_0x2b58c7(_0x410325[_0x844e('0x16')](0x1f4,_0x799cde['message']));});});};exports[_0x844e('0x23')]=function(_0x397546){var _0x13fc3f=this;return new Promise(function(_0x5f5dc3,_0x43ae36){return db[_0x844e('0x1a')][_0x844e('0x24')]({'raw':_0x397546['options']?_0x397546[_0x844e('0x1c')][_0x844e('0x25')]===undefined?!![]:![]:!![],'where':_0x397546[_0x844e('0x1c')]?_0x397546['options'][_0x844e('0x1d')]||null:null,'attributes':_0x397546[_0x844e('0x1c')]?_0x397546['options'][_0x844e('0x21')]||null:null,'include':_0x397546[_0x844e('0x1c')]?_0x397546['options'][_0x844e('0x1e')]?_[_0x844e('0x1f')](_0x397546[_0x844e('0x1c')][_0x844e('0x1e')],function(_0x672265){return{'model':db[_0x672265[_0x844e('0x20')]],'as':_0x672265['as'],'attributes':_0x672265[_0x844e('0x21')],'include':_0x672265['include']?_[_0x844e('0x1f')](_0x672265[_0x844e('0x1e')],function(_0x29637e){return{'model':db[_0x29637e[_0x844e('0x20')]],'as':_0x29637e['as'],'attributes':_0x29637e[_0x844e('0x21')],'include':_0x29637e[_0x844e('0x1e')]?_[_0x844e('0x1f')](_0x29637e[_0x844e('0x1e')],function(_0x10dc63){return{'model':db[_0x10dc63[_0x844e('0x20')]],'as':_0x10dc63['as'],'attributes':_0x10dc63[_0x844e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5701d5){if(_0x397546[_0x844e('0x1c')][_0x844e('0x26')]===!![])_0x5701d5[_0x844e('0x27')](_0x844e('0x28'),_0x5701d5[_0x844e('0x29')]());logger[_0x844e('0x11')](_0x844e('0x23'),_0x397546);logger[_0x844e('0x14')](_0x844e('0x23'),_0x397546,JSON['stringify'](_0x5701d5));_0x5f5dc3(_0x5701d5);})[_0x844e('0x22')](function(_0x51cd65){logger[_0x844e('0x16')]('ShowMailAccount',_0x51cd65[_0x844e('0x18')],_0x397546);_0x43ae36(_0x13fc3f['error'](0x1f4,_0x51cd65[_0x844e('0x18')]));});});};exports[_0x844e('0x2a')]=function(_0x206daa){var _0xb1a630=this;return new Promise(function(_0x2eb412,_0x3b4c9e){var _0x131cdd={'body':_0x206daa[_0x844e('0x2b')],'channel':_0x844e('0x2c')};var _0x2f3c00=_[_0x844e('0x2d')](_['keys'](db[_0x844e('0x2e')][_0x844e('0x2f')]),[_0x844e('0x30'),'updatedAt','CompanyId',_0x844e('0x31')]);var _0x3e24ca=![];if(_0x206daa[_0x844e('0x2b')]['id']){delete _0x206daa['body']['id'];}if(_['isNil'](_0x206daa['body']['from'])){return _0x3b4c9e(_0xb1a630[_0x844e('0x16')](0x1f4,_0x844e('0x32')));}if(_[_0x844e('0x33')](_0x206daa[_0x844e('0x2b')][_0x844e('0x2b')])||_0x206daa['body'][_0x844e('0x2b')]===''){return _0x3b4c9e(_0xb1a630['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x844e('0x33')](_0x206daa[_0x844e('0x2b')][_0x844e('0x34')])){return _0x3b4c9e(_0xb1a630[_0x844e('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f3c00));}if(!_[_0x844e('0x35')](_0x2f3c00,_0x206daa[_0x844e('0x2b')][_0x844e('0x34')])){return _0x3b4c9e(_0xb1a630['error'](0x1f4,_0x844e('0x36')+_0x2f3c00));}var _0x1bcbda={};_0x1bcbda[_0x206daa['body'][_0x844e('0x34')]]=_0x206daa[_0x844e('0x2b')][_0x844e('0x37')];return db[_0x844e('0x1a')][_0x844e('0x24')]({'where':{'id':_0x206daa[_0x844e('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x844e('0x39'),'include':[{'model':db[_0x844e('0x2e')],'as':_0x844e('0x3a'),'where':_0x1bcbda,'limit':0x1,'order':[[_0x844e('0x3b'),_0x844e('0x3c')]]}]},{'model':db[_0x844e('0x3d')],'as':_0x844e('0x3e')},{'model':db[_0x844e('0x3f')],'as':_0x844e('0x40'),'include':[{'model':db[_0x844e('0x41')],'as':'CloudProvider'}]}]})[_0x844e('0x10')](function(_0x694791){if(_0x694791&&_0x694791[_0x844e('0x39')]){var _0x510089=_0x694791[_0x844e('0x42')]({'plain':!![]});_0x131cdd[_0x844e('0x38')]=_[_0x844e('0x43')](_0x510089,[_0x844e('0x3e'),_0x844e('0x39')]);_0x131cdd[_0x844e('0x38')][_0x844e('0x28')]=_0x694791['getSmtpOptions']();_0x131cdd[_0x844e('0x44')]=_0x510089[_0x844e('0x3e')];_0x131cdd[_0x844e('0x45')]=_0x510089[_0x844e('0x39')];_0x131cdd[_0x844e('0x44')]=_[_0x844e('0x46')](_0x131cdd[_0x844e('0x44')],[_0x844e('0x47')],[_0x844e('0x48')]);if(_0x131cdd[_0x844e('0x38')]&&_0x131cdd[_0x844e('0x38')][_0x844e('0x49')]){_0x131cdd[_0x844e('0x44')]['push']({'id':0x0,'priority':_0x131cdd[_0x844e('0x44')][_0x844e('0x4a')]+0x1,'app':_0x844e('0x4b'),'appdata':_0x844e('0x49'),'interval':_0x844e('0x4c')});}if(_0x131cdd[_0x844e('0x38')]['Applications']){delete _0x131cdd[_0x844e('0x38')][_0x844e('0x3e')];}if(_0x131cdd['account'][_0x844e('0x39')]){delete _0x131cdd[_0x844e('0x38')][_0x844e('0x39')];}if(_0x510089[_0x844e('0x39')][_0x844e('0x3a')][_0x844e('0x4a')]){return _0x510089[_0x844e('0x39')][_0x844e('0x3a')][0x0];}var _0x43718a=_[_0x844e('0x9')](_0x206daa[_0x844e('0x2b')],{'firstName':_0x206daa[_0x844e('0x2b')][_0x844e('0x37')],'ListId':_0x510089[_0x844e('0x31')]});_0x43718a[_0x206daa['body'][_0x844e('0x34')]]=_0x206daa[_0x844e('0x2b')]['from'];return db[_0x844e('0x2e')]['create'](_0x43718a);}else{throw new Error(_0x844e('0x4d'));}})[_0x844e('0x10')](function(_0x1a84a7){_0x131cdd['contact']=_0x1a84a7;if(_0x1a84a7){if(!_0x206daa['body'][_0x844e('0x18')][_0x844e('0x4e')]){_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x4e')]=rs['generate']()+'\x20'+_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x37')];}var _0x192457={'ContactId':_0x1a84a7['id'],'MailAccountId':_0x206daa['account']['id'],'inReplyTo':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x4e')],'to':_0x206daa['body']['message'][_0x844e('0x37')],'cc':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')]['cc'],'subject':_0x206daa['body']['message'][_0x844e('0x4f')],'attach':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')]['attach'],'lastMsgAt':moment()[_0x844e('0x50')](_0x844e('0x51')),'lastMsgDirection':'in'};return db[_0x844e('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x206daa[_0x844e('0x38')]['id']},'include':[{'model':db[_0x844e('0x53')],'as':_0x844e('0x54'),'attributes':[_0x844e('0x4e')],'where':{'messageId':_0x206daa['body'][_0x844e('0x18')][_0x844e('0x55')]}}]})[_0x844e('0x10')](function(_0x4420b4){if(_0x4420b4){return[_0x4420b4,![]];}return db[_0x844e('0x52')][_0x844e('0x56')](_0x192457)[_0x844e('0x10')](function(_0x651093){return[_0x651093,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3f32cc,_0x530ed6){if(_0x3f32cc){_0x3e24ca=_0x530ed6;if(!_0x530ed6){return _0x3f32cc[_0x844e('0x57')]({'inReplyTo':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x4e')],'to':_0x206daa['body']['message']['from'],'cc':_0x206daa['body']['message']['cc'],'subject':_0x206daa['body'][_0x844e('0x18')][_0x844e('0x4f')],'attach':_0x3f32cc[_0x844e('0x58')]?_0x3f32cc['attach']:_0x206daa[_0x844e('0x2b')][_0x844e('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x844e('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x844e('0x50')](_0x844e('0x51')),'lastMsgDirection':'in'});}else{return _0x3f32cc;}}})[_0x844e('0x10')](function(_0x361e36){_0x131cdd['interaction']=_0x361e36['get']({'plain':!![]});_0x131cdd['interaction'][_0x844e('0x59')]=_0x3e24ca;return db[_0x844e('0x53')][_0x844e('0x56')]({'body':_0x206daa[_0x844e('0x2b')][_0x844e('0x2b')],'MailAccountId':_0x206daa['account']['id'],'MailInteractionId':_0x361e36['id'],'direction':'in','ContactId':_0x131cdd['contact']['id'],'messageId':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x4e')],'from':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x37')],'to':_0x206daa['body'][_0x844e('0x18')]['to'],'cc':_0x206daa[_0x844e('0x2b')]['message']['cc'],'subject':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')]['subject'],'attach':_0x206daa['body'][_0x844e('0x18')][_0x844e('0x58')],'Attachments':_0x206daa[_0x844e('0x2b')]['message']['attachments'],'originTo':_0x206daa['body'][_0x844e('0x18')]['originTo'],'originCc':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x5a')],'bcc':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')][_0x844e('0x5b')],'ChatWebsiteId':_0x206daa['body'][_0x844e('0x18')][_0x844e('0x5c')]||null,'originChannel':_0x206daa['body'][_0x844e('0x18')][_0x844e('0x5d')]||_0x844e('0x5e'),'ChatOfflineMessageId':_0x206daa[_0x844e('0x2b')][_0x844e('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x844e('0x5f')}]});})[_0x844e('0x10')](function(_0x233875){_0x131cdd[_0x844e('0x18')]=_0x233875;if(!_0x131cdd[_0x844e('0x60')][_0x844e('0x61')]){return;}return db[_0x844e('0x62')]['find']({'attributes':['id',_0x844e('0x63')],'where':{'id':_0x131cdd[_0x844e('0x60')]['UserId']}});})[_0x844e('0x10')](function(_0x3a0b58){if(_0x3a0b58){_0x131cdd[_0x844e('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3a0b58[_0x844e('0x63')]+','+(_0x131cdd[_0x844e('0x38')]['waitForTheAssignedAgent']||0xa),'interval':_0x844e('0x4c')});}if(!_0x131cdd[_0x844e('0x60')][_0x844e('0x64')]){return;}return db[_0x844e('0x65')][_0x844e('0x24')]({'attributes':['id',_0x844e('0x63')],'where':{'id':_0x131cdd[_0x844e('0x60')]['queueId']}});})[_0x844e('0x10')](function(_0x579bbf){if(_0x579bbf){_0x131cdd[_0x844e('0x44')]['unshift']({'id':0x0,'priority':0x1,'app':_0x844e('0x66'),'appdata':_0x579bbf['name']+','+(_0x131cdd[_0x844e('0x38')][_0x844e('0x67')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x844e('0x68'),_0x844e('0x69'),_0x131cdd);})[_0x844e('0x10')](function(_0x1a9c64){_0x2eb412(_0x1a9c64);})[_0x844e('0x22')](function(_0x5bf74d){_0x3b4c9e(_0xb1a630[_0x844e('0x16')](0x1f4,_0x5bf74d[_0x844e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0a368f9..f7023c7 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 _0x4a14=['update','emit','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a14,0x115));var _0x44a1=function(_0x1c8362,_0x4a1462){_0x1c8362=_0x1c8362-0x0;var _0x4fada5=_0x4a14[_0x1c8362];return _0x4fada5;};'use strict';var MailAccountEvents=require(_0x44a1('0x0'));var events=[_0x44a1('0x1'),_0x44a1('0x2'),_0x44a1('0x3')];function createListener(_0x2c8bb3,_0x2b5afe){return function(_0x5647cb){_0x2b5afe[_0x44a1('0x4')](_0x2c8bb3,_0x5647cb);};}function removeListener(_0x1b7416,_0x3b8f3a){return function(){MailAccountEvents['removeListener'](_0x1b7416,_0x3b8f3a);};}exports[_0x44a1('0x5')]=function(_0x23f6bb){for(var _0x12f06b=0x0,_0x1a8b3b=events[_0x44a1('0x6')];_0x12f06b<_0x1a8b3b;_0x12f06b++){var _0x9ddbfc=events[_0x12f06b];var _0x450785=createListener(_0x44a1('0x7')+_0x9ddbfc,_0x23f6bb);MailAccountEvents['on'](_0x9ddbfc,_0x450785);}}; \ No newline at end of file +var _0xbb92=['./mailAccount.events','remove','update','removeListener','length','mailAccount:'];(function(_0x1051b5,_0x4e4158){var _0x66f2b2=function(_0x445755){while(--_0x445755){_0x1051b5['push'](_0x1051b5['shift']());}};_0x66f2b2(++_0x4e4158);}(_0xbb92,0xcc));var _0x2bb9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb92[_0x501510];return _0x1e6ee5;};'use strict';var MailAccountEvents=require(_0x2bb9('0x0'));var events=['save',_0x2bb9('0x1'),_0x2bb9('0x2')];function createListener(_0x2b8613,_0x43d9cc){return function(_0x4559f0){_0x43d9cc['emit'](_0x2b8613,_0x4559f0);};}function removeListener(_0x391ee9,_0x30d7e6){return function(){MailAccountEvents[_0x2bb9('0x3')](_0x391ee9,_0x30d7e6);};}exports['register']=function(_0x2d96db){for(var _0x298562=0x0,_0x9452dd=events[_0x2bb9('0x4')];_0x298562<_0x9452dd;_0x298562++){var _0x54037c=events[_0x298562];var _0x4eb3e6=createListener(_0x2bb9('0x5')+_0x54037c,_0x2d96db);MailAccountEvents['on'](_0x54037c,_0x4eb3e6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 3795da4..7b6ebd7 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 _0xb893=['./mailApplication.controller','show','put','/:id','update','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x509b18,_0xf69a37){var _0x37ca09=function(_0x3243bb){while(--_0x3243bb){_0x509b18['push'](_0x509b18['shift']());}};_0x37ca09(++_0xf69a37);}(_0xb893,0x9d));var _0x3b89=function(_0xffad76,_0x2d3cd3){_0xffad76=_0xffad76-0x0;var _0x47819c=_0xb893[_0xffad76];return _0x47819c;};'use strict';var multer=require(_0x3b89('0x0'));var util=require(_0x3b89('0x1'));var path=require(_0x3b89('0x2'));var timeout=require(_0x3b89('0x3'));var express=require(_0x3b89('0x4'));var router=express['Router']();var fs_extra=require(_0x3b89('0x5'));var auth=require(_0x3b89('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b89('0x7'));var controller=require(_0x3b89('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x3b89('0x9')]);router[_0x3b89('0xa')](_0x3b89('0xb'),auth['isAuthenticated'](),controller[_0x3b89('0xc')]);router['delete'](_0x3b89('0xb'),auth[_0x3b89('0xd')](),controller['destroy']);module[_0x3b89('0xe')]=router; \ No newline at end of file +var _0xdc0e=['../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x409dbd,_0x1d41d9){var _0x445527=function(_0xfd2685){while(--_0xfd2685){_0x409dbd['push'](_0x409dbd['shift']());}};_0x445527(++_0x1d41d9);}(_0xdc0e,0x1ce));var _0xedc0=function(_0x5067c6,_0x3f1e9e){_0x5067c6=_0x5067c6-0x0;var _0xb5daa3=_0xdc0e[_0x5067c6];return _0xb5daa3;};'use strict';var multer=require('multer');var util=require(_0xedc0('0x0'));var path=require(_0xedc0('0x1'));var timeout=require(_0xedc0('0x2'));var express=require(_0xedc0('0x3'));var router=express[_0xedc0('0x4')]();var fs_extra=require(_0xedc0('0x5'));var auth=require(_0xedc0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xedc0('0x7'));var controller=require(_0xedc0('0x8'));router[_0xedc0('0x9')](_0xedc0('0xa'),auth[_0xedc0('0xb')](),controller[_0xedc0('0xc')]);router[_0xedc0('0xd')]('/:id',auth[_0xedc0('0xb')](),controller[_0xedc0('0xe')]);router[_0xedc0('0xf')](_0xedc0('0xa'),auth[_0xedc0('0xb')](),controller[_0xedc0('0x10')]);module[_0xedc0('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a0effbf..1f1c3dd 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 _0x51ee=['INTEGER','STRING','noop','TEXT'];(function(_0x38250f,_0xa18e96){var _0x425808=function(_0x23a11a){while(--_0x23a11a){_0x38250f['push'](_0x38250f['shift']());}};_0x425808(++_0xa18e96);}(_0x51ee,0x1b8));var _0xe51e=function(_0x126d3a,_0x277306){_0x126d3a=_0x126d3a-0x0;var _0xbc3e70=_0x51ee[_0x126d3a];return _0xbc3e70;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xe51e('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xe51e('0x1')],'allowNull':![],'defaultValue':_0xe51e('0x2')},'appdata':{'type':Sequelize[_0xe51e('0x3')]()},'description':{'type':Sequelize[_0xe51e('0x1')]},'interval':{'type':Sequelize[_0xe51e('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x064b=['INTEGER','TEXT','STRING','sequelize','exports'];(function(_0x193432,_0x1c4da4){var _0x3cfec1=function(_0x1ce019){while(--_0x1ce019){_0x193432['push'](_0x193432['shift']());}};_0x3cfec1(++_0x1c4da4);}(_0x064b,0x170));var _0xb064=function(_0x27959d,_0x586e6b){_0x27959d=_0x27959d-0x0;var _0x3f0080=_0x064b[_0x27959d];return _0x3f0080;};'use strict';var Sequelize=require(_0xb064('0x0'));module[_0xb064('0x1')]={'priority':{'type':Sequelize[_0xb064('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb064('0x3')]()},'description':{'type':Sequelize[_0xb064('0x4')]},'interval':{'type':Sequelize[_0xb064('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index cc28fae..9e71b03 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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x3f260a,_0x36a4d1){var _0x35c277=function(_0x5adf64){while(--_0x5adf64){_0x3f260a['push'](_0x3f260a['shift']());}};_0x35c277(++_0x36a4d1);}(_0xac4a,0x13f));var _0xaac4=function(_0x213024,_0x15b006){_0x213024=_0x213024-0x0;var _0x3f3d67=_0xac4a[_0x213024];return _0x3f3d67;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','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','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x17a28d,_0x48bda8){var _0x636d2d=function(_0x327a7d){while(--_0x327a7d){_0x17a28d['push'](_0x17a28d['shift']());}};_0x636d2d(++_0x48bda8);}(_0x70e0,0x17b));var _0x070e=function(_0xd84342,_0x349bf6){_0xd84342=_0xd84342-0x0;var _0x5cdf4b=_0x70e0[_0xd84342];return _0x5cdf4b;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 47c206d..f55b632 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 _0xadfa=['rimraf','../../config/environment','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xadfa,0x1c7));var _0xaadf=function(_0x4c12d3,_0x3d9d69){_0x4c12d3=_0x4c12d3-0x0;var _0x59f202=_0xadfa[_0x4c12d3];return _0x59f202;};'use strict';var _=require(_0xaadf('0x0'));var util=require('util');var logger=require(_0xaadf('0x1'))(_0xaadf('0x2'));var moment=require(_0xaadf('0x3'));var BPromise=require(_0xaadf('0x4'));var rp=require(_0xaadf('0x5'));var fs=require('fs');var path=require(_0xaadf('0x6'));var rimraf=require(_0xaadf('0x7'));var config=require(_0xaadf('0x8'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x346d9d,_0x7e5a6a){return _0x346d9d[_0xaadf('0x9')](_0xaadf('0xa'),attributes,{'tableName':_0xaadf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaadf('0xc'),'collate':_0xaadf('0xd')});}; \ No newline at end of file +var _0x02cf=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34b353,_0x1abd2a){var _0x1a06e8=function(_0xddaaf5){while(--_0xddaaf5){_0x34b353['push'](_0x34b353['shift']());}};_0x1a06e8(++_0x1abd2a);}(_0x02cf,0x1c6));var _0xf02c=function(_0x2f8103,_0x1fb2fb){_0x2f8103=_0x2f8103-0x0;var _0x5a748a=_0x02cf[_0x2f8103];return _0x5a748a;};'use strict';var _=require(_0xf02c('0x0'));var util=require(_0xf02c('0x1'));var logger=require(_0xf02c('0x2'))(_0xf02c('0x3'));var moment=require(_0xf02c('0x4'));var BPromise=require(_0xf02c('0x5'));var rp=require(_0xf02c('0x6'));var fs=require('fs');var path=require(_0xf02c('0x7'));var rimraf=require(_0xf02c('0x8'));var config=require(_0xf02c('0x9'));var attributes=require('./mailApplication.attributes');module[_0xf02c('0xa')]=function(_0x54198f,_0x1bdd58){return _0x54198f[_0xf02c('0xb')](_0xf02c('0xc'),attributes,{'tableName':_0xf02c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf02c('0xe'),'collate':_0xf02c('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index faa9b5e..672f9de 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 _0x8e11=['UpdateMailApplication','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x2200f3,_0x5c4ddc){var _0x46c443=function(_0x4e4077){while(--_0x4e4077){_0x2200f3['push'](_0x2200f3['shift']());}};_0x46c443(++_0x5c4ddc);}(_0x8e11,0x1b8));var _0x18e1=function(_0xa180cc,_0x2e4e20){_0xa180cc=_0xa180cc-0x0;var _0x2d6a96=_0x8e11[_0xa180cc];return _0x2d6a96;};'use strict';var _=require(_0x18e1('0x0'));var util=require(_0x18e1('0x1'));var moment=require(_0x18e1('0x2'));var BPromise=require(_0x18e1('0x3'));var rs=require(_0x18e1('0x4'));var fs=require('fs');var Redis=require(_0x18e1('0x5'));var db=require(_0x18e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x18e1('0x7'))(_0x18e1('0x8'));var config=require(_0x18e1('0x9'));var jayson=require(_0x18e1('0xa'));var client=jayson[_0x18e1('0xb')][_0x18e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x105238,_0x38a2a9,_0x438fd6){return new BPromise(function(_0x514535,_0x1d6374){return client[_0x18e1('0xd')](_0x105238,_0x438fd6)['then'](function(_0xbb9c39){logger[_0x18e1('0xe')](_0x18e1('0xf'),_0x38a2a9,_0x18e1('0x10'));logger[_0x18e1('0x11')](_0x18e1('0x12'),_0x38a2a9,_0x18e1('0x10'),JSON[_0x18e1('0x13')](_0xbb9c39));if(_0xbb9c39['error']){if(_0xbb9c39['error'][_0x18e1('0x14')]===0x1f4){logger[_0x18e1('0x15')](_0x18e1('0xf'),_0x38a2a9,_0xbb9c39[_0x18e1('0x15')][_0x18e1('0x16')]);return _0x1d6374(_0xbb9c39['error']['message']);}logger['error'](_0x18e1('0xf'),_0x38a2a9,_0xbb9c39[_0x18e1('0x15')][_0x18e1('0x16')]);return _0x514535(_0xbb9c39[_0x18e1('0x15')]['message']);}else{logger['info'](_0x18e1('0xf'),_0x38a2a9,_0x18e1('0x10'));_0x514535(_0xbb9c39[_0x18e1('0x17')][_0x18e1('0x16')]);}})[_0x18e1('0x18')](function(_0x28cde5){logger[_0x18e1('0x15')](_0x18e1('0xf'),_0x38a2a9,_0x28cde5);_0x1d6374(_0x28cde5);});});}exports[_0x18e1('0x19')]=function(_0x277bea){var _0x547f6f=this;return new Promise(function(_0x38c324,_0x1e05bf){return db['MailApplication'][_0x18e1('0x1a')](_0x277bea['body'],{'raw':_0x277bea[_0x18e1('0x1b')]?_0x277bea['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277bea[_0x18e1('0x1b')]?_0x277bea['options'][_0x18e1('0x1c')]||null:null,'attributes':_0x277bea['options']?_0x277bea[_0x18e1('0x1b')][_0x18e1('0x1d')]||null:null,'limit':_0x277bea[_0x18e1('0x1b')]?_0x277bea[_0x18e1('0x1b')][_0x18e1('0x1e')]||null:null})['then'](function(_0x1ea445){logger[_0x18e1('0xe')](_0x18e1('0x19'),_0x277bea);logger['debug'](_0x18e1('0x19'),_0x277bea,JSON[_0x18e1('0x13')](_0x1ea445));_0x38c324(_0x1ea445);})[_0x18e1('0x18')](function(_0x332617){logger[_0x18e1('0x15')](_0x18e1('0x19'),_0x332617['message'],_0x277bea);_0x1e05bf(_0x547f6f[_0x18e1('0x15')](0x1f4,_0x332617[_0x18e1('0x16')]));});});}; \ No newline at end of file +var _0x3c37=['attributes','limit','stringify','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x56a7ab,_0x32f65f){var _0x2fa42b=function(_0x3888ec){while(--_0x3888ec){_0x56a7ab['push'](_0x56a7ab['shift']());}};_0x2fa42b(++_0x32f65f);}(_0x3c37,0x1f1));var _0x73c3=function(_0x200e20,_0x1c446f){_0x200e20=_0x200e20-0x0;var _0x2117b8=_0x3c37[_0x200e20];return _0x2117b8;};'use strict';var _=require(_0x73c3('0x0'));var util=require('util');var moment=require(_0x73c3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73c3('0x2'));var db=require(_0x73c3('0x3'))['db'];var utils=require(_0x73c3('0x4'));var logger=require('../../config/logger')(_0x73c3('0x5'));var config=require(_0x73c3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x73c3('0x7')][_0x73c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2824ce,_0x480704,_0xbdca98){return new BPromise(function(_0x343cec,_0x503817){return client['request'](_0x2824ce,_0xbdca98)[_0x73c3('0x9')](function(_0x2d202a){logger[_0x73c3('0xa')](_0x73c3('0xb'),_0x480704,_0x73c3('0xc'));logger[_0x73c3('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x480704,'request\x20sent',JSON['stringify'](_0x2d202a));if(_0x2d202a['error']){if(_0x2d202a[_0x73c3('0xe')][_0x73c3('0xf')]===0x1f4){logger[_0x73c3('0xe')](_0x73c3('0xb'),_0x480704,_0x2d202a[_0x73c3('0xe')][_0x73c3('0x10')]);return _0x503817(_0x2d202a['error'][_0x73c3('0x10')]);}logger['error'](_0x73c3('0xb'),_0x480704,_0x2d202a[_0x73c3('0xe')][_0x73c3('0x10')]);return _0x343cec(_0x2d202a[_0x73c3('0xe')][_0x73c3('0x10')]);}else{logger[_0x73c3('0xa')]('MailApplication,\x20%s,\x20%s',_0x480704,_0x73c3('0xc'));_0x343cec(_0x2d202a[_0x73c3('0x11')][_0x73c3('0x10')]);}})['catch'](function(_0x2bac55){logger[_0x73c3('0xe')](_0x73c3('0xb'),_0x480704,_0x2bac55);_0x503817(_0x2bac55);});});}exports[_0x73c3('0x12')]=function(_0x50b587){var _0x2d6e43=this;return new Promise(function(_0x402407,_0x3b4d70){return db[_0x73c3('0x13')][_0x73c3('0x14')](_0x50b587[_0x73c3('0x15')],{'raw':_0x50b587[_0x73c3('0x16')]?_0x50b587[_0x73c3('0x16')][_0x73c3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b587['options']?_0x50b587[_0x73c3('0x16')][_0x73c3('0x18')]||null:null,'attributes':_0x50b587['options']?_0x50b587[_0x73c3('0x16')][_0x73c3('0x19')]||null:null,'limit':_0x50b587[_0x73c3('0x16')]?_0x50b587[_0x73c3('0x16')][_0x73c3('0x1a')]||null:null})[_0x73c3('0x9')](function(_0x58706f){logger[_0x73c3('0xa')](_0x73c3('0x12'),_0x50b587);logger[_0x73c3('0xd')](_0x73c3('0x12'),_0x50b587,JSON[_0x73c3('0x1b')](_0x58706f));_0x402407(_0x58706f);})[_0x73c3('0x1c')](function(_0x4fd9a9){logger[_0x73c3('0xe')](_0x73c3('0x12'),_0x4fd9a9[_0x73c3('0x10')],_0x50b587);_0x3b4d70(_0x2d6e43[_0x73c3('0xe')](0x1f4,_0x4fd9a9[_0x73c3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0769cfb..a83a3fa 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 _0x8aef=['put','tracked','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','express','../../components/auth/service','isAuthenticated','index','get','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','addTags'];(function(_0x285448,_0x17f8f8){var _0x1ab6f5=function(_0x50929e){while(--_0x50929e){_0x285448['push'](_0x285448['shift']());}};_0x1ab6f5(++_0x17f8f8);}(_0x8aef,0x189));var _0xf8ae=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x8aef[_0x3826ad];return _0x17b900;};'use strict';var express=require(_0xf8ae('0x0'));var router=express['Router']();var auth=require(_0xf8ae('0x1'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xf8ae('0x2')](),controller[_0xf8ae('0x3')]);router[_0xf8ae('0x4')](_0xf8ae('0x5'),auth[_0xf8ae('0x2')](),controller['describe']);router['get'](_0xf8ae('0x6'),auth[_0xf8ae('0x2')](),controller['show']);router[_0xf8ae('0x4')](_0xf8ae('0x7'),auth[_0xf8ae('0x2')](),controller[_0xf8ae('0x8')]);router['get'](_0xf8ae('0x9'),auth[_0xf8ae('0x2')](),controller[_0xf8ae('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf8ae('0xb')](_0xf8ae('0x7'),auth[_0xf8ae('0x2')](),controller[_0xf8ae('0xc')]);router[_0xf8ae('0xb')](_0xf8ae('0xd'),auth[_0xf8ae('0x2')](),interaction['tracked']('mail','mailinteraction:addtags'),controller[_0xf8ae('0xe')]);router[_0xf8ae('0xf')]('/:id',auth[_0xf8ae('0x2')](),interaction[_0xf8ae('0x10')](_0xf8ae('0x11'),_0xf8ae('0x12')),controller[_0xf8ae('0x13')]);router['delete']('/:id',auth[_0xf8ae('0x2')](),interaction[_0xf8ae('0x10')]('mail',_0xf8ae('0x14')),controller[_0xf8ae('0x15')]);router[_0xf8ae('0x16')](_0xf8ae('0xd'),auth['isAuthenticated'](),controller[_0xf8ae('0x17')]);module['exports']=router; \ No newline at end of file +var _0x38f2=['destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','tracked','mailinteraction:destroy'];(function(_0x3fe08f,_0x563dda){var _0x11ce9d=function(_0x3f9530){while(--_0x3f9530){_0x3fe08f['push'](_0x3fe08f['shift']());}};_0x11ce9d(++_0x563dda);}(_0x38f2,0x139));var _0x238f=function(_0x22f82f,_0x32ba8c){_0x22f82f=_0x22f82f-0x0;var _0xea3d7f=_0x38f2[_0x22f82f];return _0xea3d7f;};'use strict';var express=require(_0x238f('0x0'));var router=express[_0x238f('0x1')]();var auth=require(_0x238f('0x2'));var interaction=require(_0x238f('0x3'));var controller=require(_0x238f('0x4'));router[_0x238f('0x5')]('/',auth[_0x238f('0x6')](),controller[_0x238f('0x7')]);router[_0x238f('0x5')](_0x238f('0x8'),auth[_0x238f('0x6')](),controller[_0x238f('0x9')]);router['get']('/:id',auth[_0x238f('0x6')](),controller[_0x238f('0xa')]);router[_0x238f('0x5')](_0x238f('0xb'),auth[_0x238f('0x6')](),controller[_0x238f('0xc')]);router[_0x238f('0x5')](_0x238f('0xd'),auth[_0x238f('0x6')](),controller['download']);router[_0x238f('0xe')]('/',auth[_0x238f('0x6')](),controller[_0x238f('0xf')]);router[_0x238f('0xe')](_0x238f('0xb'),auth[_0x238f('0x6')](),controller[_0x238f('0x10')]);router[_0x238f('0xe')](_0x238f('0x11'),auth[_0x238f('0x6')](),interaction['tracked'](_0x238f('0x12'),_0x238f('0x13')),controller[_0x238f('0x14')]);router[_0x238f('0x15')](_0x238f('0x16'),auth[_0x238f('0x6')](),interaction['tracked'](_0x238f('0x12'),_0x238f('0x17')),controller[_0x238f('0x18')]);router[_0x238f('0x19')]('/:id',auth[_0x238f('0x6')](),interaction[_0x238f('0x1a')](_0x238f('0x12'),_0x238f('0x1b')),controller[_0x238f('0x1c')]);router[_0x238f('0x19')](_0x238f('0x11'),auth[_0x238f('0x6')](),controller[_0x238f('0x1d')]);module[_0x238f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f52c880..39da151 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 _0xe352=['INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x2da812,_0x119002){var _0x3c5b45=function(_0x53b4e3){while(--_0x53b4e3){_0x2da812['push'](_0x2da812['shift']());}};_0x3c5b45(++_0x119002);}(_0xe352,0x7f));var _0x2e35=function(_0x1364df,_0x13978c){_0x1364df=_0x1364df-0x0;var _0x439246=_0xe352[_0x1364df];return _0x439246;};'use strict';var Sequelize=require(_0x2e35('0x0'));var iconv=require(_0x2e35('0x1'));module[_0x2e35('0x2')]={'closed':{'type':Sequelize[_0x2e35('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2e35('0x4')]},'disposition':{'type':Sequelize[_0x2e35('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2e35('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x2e35('0x5')]},'cc':{'type':Sequelize[_0x2e35('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x2e35('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2e35('0x4')]},'substatus':{'type':Sequelize[_0x2e35('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x2e35('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2e35('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2e35('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2e35('0x8')]}}; \ No newline at end of file +var _0x4102=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER'];(function(_0x19d050,_0x2fffe9){var _0xad0a5c=function(_0x270c34){while(--_0x270c34){_0x19d050['push'](_0x19d050['shift']());}};_0xad0a5c(++_0x2fffe9);}(_0x4102,0xdc));var _0x2410=function(_0x35bd71,_0x24c30a){_0x35bd71=_0x35bd71-0x0;var _0x1b794c=_0x4102[_0x35bd71];return _0x1b794c;};'use strict';var Sequelize=require(_0x2410('0x0'));var iconv=require(_0x2410('0x1'));module[_0x2410('0x2')]={'closed':{'type':Sequelize[_0x2410('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2410('0x4')]},'disposition':{'type':Sequelize[_0x2410('0x5')]},'secondDisposition':{'type':Sequelize[_0x2410('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2410('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2410('0x6')]('long')},'subject':{'type':Sequelize[_0x2410('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2410('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x2410('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2410('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2410('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2410('0x7')]('in',_0x2410('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2410('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2410('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 058f059..ef49950 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 _0xa9c8=['status','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','params','keys','query','intersection','model','fields','attributes','length','includeAll','include','options','catch','create','body','find','describe','MailMessage','addMessage','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','rows','setTags','omit','ids','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','attachments','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','api','html-entities','redis','localhost','socket.io-emitter','register','sendStatus','end','offset','undefined','limit','count'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xa9c8,0x1c5));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8a9c('0x0'));var rimraf=require(_0x8a9c('0x1'));var zipdir=require(_0x8a9c('0x2'));var moment=require(_0x8a9c('0x3'));var BPromise=require(_0x8a9c('0x4'));var util=require(_0x8a9c('0x5'));var path=require(_0x8a9c('0x6'));var fs=require('fs');var _=require(_0x8a9c('0x7'));var juice=require(_0x8a9c('0x8'));var Redis=require(_0x8a9c('0x9'));var interaction=require(_0x8a9c('0xa'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8a9c('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x8a9c('0xc'));config[_0x8a9c('0xd')]=_['defaults'](config[_0x8a9c('0xd')],{'host':_0x8a9c('0xe'),'port':0x18eb});var socket=require(_0x8a9c('0xf'))(new Redis(config[_0x8a9c('0xd')]));require('./mailInteraction.socket')[_0x8a9c('0x10')](socket);function respondWithStatusCode(_0x3fb9c2,_0x3534ff){_0x3534ff=_0x3534ff||0xcc;return function(_0x51d2ec){if(_0x51d2ec){return _0x3fb9c2[_0x8a9c('0x11')](_0x3534ff);}return _0x3fb9c2['status'](_0x3534ff)[_0x8a9c('0x12')]();};}function respondWithResult(_0x205d0a,_0x283be6){_0x283be6=_0x283be6||0xc8;return function(_0x96f008){if(_0x96f008){return _0x205d0a['status'](_0x283be6)['json'](_0x96f008);}};}function respondWithFilteredResult(_0x513aaf,_0x409b85){return function(_0x2d18a6){if(_0x2d18a6){var _0x44f136=typeof _0x409b85[_0x8a9c('0x13')]===_0x8a9c('0x14')&&typeof _0x409b85[_0x8a9c('0x15')]===_0x8a9c('0x14');var _0x37856c=_0x2d18a6[_0x8a9c('0x16')];var _0x530556=_0x44f136?0x0:_0x409b85['offset'];var _0x2fa9b4=_0x44f136?_0x2d18a6[_0x8a9c('0x16')]:_0x409b85[_0x8a9c('0x13')]+_0x409b85['limit'];var _0x35cc47;if(_0x2fa9b4>=_0x37856c){_0x2fa9b4=_0x37856c;_0x35cc47=0xc8;}else{_0x35cc47=0xce;}_0x513aaf[_0x8a9c('0x17')](_0x35cc47);return _0x513aaf[_0x8a9c('0x18')](_0x8a9c('0x19'),_0x530556+'-'+_0x2fa9b4+'/'+_0x37856c)[_0x8a9c('0x1a')](_0x2d18a6);}return null;};}function saveUpdates(_0x53a69f){return function(_0x536039){if(_0x536039){return _0x536039[_0x8a9c('0x1b')](_0x53a69f)[_0x8a9c('0x1c')](function(_0xe00d60){return _0xe00d60;});}return null;};}function removeEntity(_0xde5c09){return function(_0x1dea68){if(_0x1dea68){return _0x1dea68[_0x8a9c('0x1d')]()[_0x8a9c('0x1c')](function(){_0xde5c09[_0x8a9c('0x17')](0xcc)[_0x8a9c('0x12')]();});}};}function handleEntityNotFound(_0x300c87){return function(_0x1bbe1f){if(!_0x1bbe1f){_0x300c87[_0x8a9c('0x11')](0x194);}return _0x1bbe1f;};}function handleError(_0x4b12e5,_0x2ec150){_0x2ec150=_0x2ec150||0x1f4;return function(_0x441026){logger[_0x8a9c('0x1e')](_0x441026[_0x8a9c('0x1f')]);if(_0x441026[_0x8a9c('0x20')]){delete _0x441026[_0x8a9c('0x20')];}_0x4b12e5[_0x8a9c('0x17')](_0x2ec150)[_0x8a9c('0x21')](_0x441026);};}exports[_0x8a9c('0x22')]=function(_0x52bdb0,_0x4b13c2){var _0x51f9af={};var _0x11aecc=_[_0x8a9c('0x23')](db[_0x8a9c('0x24')][_0x8a9c('0x25')],function(_0x25be58){return{'name':_0x25be58[_0x8a9c('0x26')],'type':_0x25be58[_0x8a9c('0x27')][_0x8a9c('0x28')]};});_0x51f9af=qs[_0x8a9c('0x29')](_0x11aecc,_0x52bdb0);return interaction[_0x8a9c('0x2a')](_0x8a9c('0x2b'),_0x52bdb0['query'],_0x52bdb0['user'],_0x51f9af,_0x11aecc)[_0x8a9c('0x1c')](respondWithFilteredResult(_0x4b13c2,_0x51f9af))['catch'](handleError(_0x4b13c2,null));};exports['show']=function(_0x191356,_0x4fb627){var _0x119452={'raw':![],'where':{'id':_0x191356[_0x8a9c('0x2c')]['id']}},_0x399087={};_0x399087['model']=_[_0x8a9c('0x2d')](db[_0x8a9c('0x24')][_0x8a9c('0x25')]);_0x399087[_0x8a9c('0x2e')]=_[_0x8a9c('0x2d')](_0x191356[_0x8a9c('0x2e')]);_0x399087['filters']=_[_0x8a9c('0x2f')](_0x399087[_0x8a9c('0x30')],_0x399087[_0x8a9c('0x2e')]);_0x119452['attributes']=_[_0x8a9c('0x2f')](_0x399087[_0x8a9c('0x30')],qs[_0x8a9c('0x31')](_0x191356[_0x8a9c('0x2e')]['fields']));_0x119452[_0x8a9c('0x32')]=_0x119452[_0x8a9c('0x32')][_0x8a9c('0x33')]?_0x119452[_0x8a9c('0x32')]:_0x399087['model'];if(_0x191356[_0x8a9c('0x2e')][_0x8a9c('0x34')]){_0x119452[_0x8a9c('0x35')]=[{'all':!![]}];}_0x119452=_['merge']({},_0x119452,_0x191356[_0x8a9c('0x36')]);return db[_0x8a9c('0x24')]['find'](_0x119452)[_0x8a9c('0x1c')](handleEntityNotFound(_0x4fb627,null))[_0x8a9c('0x1c')](respondWithResult(_0x4fb627,null))[_0x8a9c('0x37')](handleError(_0x4fb627,null));};exports['create']=function(_0x2cbb18,_0x1fc7af){return db[_0x8a9c('0x24')][_0x8a9c('0x38')](_0x2cbb18[_0x8a9c('0x39')],{})[_0x8a9c('0x1c')](respondWithResult(_0x1fc7af,0xc9))[_0x8a9c('0x37')](handleError(_0x1fc7af,null));};exports[_0x8a9c('0x1b')]=function(_0x127d66,_0x558d42){if(_0x127d66[_0x8a9c('0x39')]['id']){delete _0x127d66['body']['id'];}return db['MailInteraction'][_0x8a9c('0x3a')]({'where':{'id':_0x127d66[_0x8a9c('0x2c')]['id']}})[_0x8a9c('0x1c')](handleEntityNotFound(_0x558d42,null))[_0x8a9c('0x1c')](saveUpdates(_0x127d66['body'],null))[_0x8a9c('0x1c')](respondWithResult(_0x558d42,null))[_0x8a9c('0x37')](handleError(_0x558d42,null));};exports[_0x8a9c('0x1d')]=function(_0x44827c,_0x2e7fa6){return db[_0x8a9c('0x24')][_0x8a9c('0x3a')]({'where':{'id':_0x44827c['params']['id']}})[_0x8a9c('0x1c')](handleEntityNotFound(_0x2e7fa6,null))['then'](removeEntity(_0x2e7fa6,null))[_0x8a9c('0x37')](handleError(_0x2e7fa6,null));};exports[_0x8a9c('0x3b')]=function(_0x37c0db,_0x1418b1){return db[_0x8a9c('0x24')][_0x8a9c('0x3b')]()[_0x8a9c('0x1c')](respondWithResult(_0x1418b1,null))[_0x8a9c('0x37')](handleError(_0x1418b1,null));};exports['addMessage']=function(_0x13fd1c,_0x1ea32c){return db[_0x8a9c('0x3c')]['find']({'where':{'id':_0x13fd1c[_0x8a9c('0x2c')]['id']}})[_0x8a9c('0x1c')](handleEntityNotFound(_0x1ea32c,null))[_0x8a9c('0x1c')](function(_0x28a6c5){if(_0x28a6c5){return _0x28a6c5[_0x8a9c('0x3d')](_0x13fd1c['body']['ids'],_['omit'](_0x13fd1c['body'],['ids','id'])||{});}})[_0x8a9c('0x1c')](respondWithResult(_0x1ea32c,null))[_0x8a9c('0x37')](handleError(_0x1ea32c,null));};exports[_0x8a9c('0x3e')]=function(_0x18b9f9,_0x3a2f03){var _0x1a11fa={'raw':![],'where':{}};var _0x665644={};var _0x4fdcda={'count':0x0,'rows':[]};return db[_0x8a9c('0x24')][_0x8a9c('0x3f')]({'where':{'id':_0x18b9f9[_0x8a9c('0x2c')]['id']}})[_0x8a9c('0x1c')](handleEntityNotFound(_0x3a2f03,null))[_0x8a9c('0x1c')](function(_0x1491a2){if(_0x1491a2){_0x665644[_0x8a9c('0x30')]=_[_0x8a9c('0x2d')](db[_0x8a9c('0x3c')]['rawAttributes']);_0x665644[_0x8a9c('0x2e')]=_['keys'](_0x18b9f9[_0x8a9c('0x2e')]);_0x665644[_0x8a9c('0x40')]=_[_0x8a9c('0x2f')](_0x665644[_0x8a9c('0x30')],_0x665644[_0x8a9c('0x2e')]);_0x1a11fa[_0x8a9c('0x32')]=_[_0x8a9c('0x2f')](_0x665644['model'],qs['fields'](_0x18b9f9[_0x8a9c('0x2e')][_0x8a9c('0x31')]));_0x1a11fa[_0x8a9c('0x32')]=_0x1a11fa[_0x8a9c('0x32')][_0x8a9c('0x33')]?_0x1a11fa['attributes']:_0x665644[_0x8a9c('0x30')];if(!_0x18b9f9['query'][_0x8a9c('0x41')](_0x8a9c('0x42'))){_0x1a11fa[_0x8a9c('0x15')]=qs[_0x8a9c('0x15')](_0x18b9f9[_0x8a9c('0x2e')][_0x8a9c('0x15')]);_0x1a11fa[_0x8a9c('0x13')]=qs[_0x8a9c('0x13')](_0x18b9f9[_0x8a9c('0x2e')]['offset']);}_0x1a11fa[_0x8a9c('0x43')]=qs['sort'](_0x18b9f9[_0x8a9c('0x2e')][_0x8a9c('0x44')]);_0x1a11fa['where']=qs[_0x8a9c('0x40')](_['pick'](_0x18b9f9['query'],_0x665644[_0x8a9c('0x40')]));_0x1a11fa[_0x8a9c('0x45')]['MailInteractionId']=_0x1491a2['id'];if(_0x18b9f9[_0x8a9c('0x2e')][_0x8a9c('0x46')]){_0x1a11fa[_0x8a9c('0x45')]=_[_0x8a9c('0x47')](_0x1a11fa[_0x8a9c('0x45')],{'$or':_['map'](_0x1a11fa[_0x8a9c('0x32')],function(_0x3aa161){var _0x3459f9={};_0x3459f9[_0x3aa161]={'$like':'%'+_0x18b9f9[_0x8a9c('0x2e')]['filter']+'%'};return _0x3459f9;})});}if(_0x18b9f9[_0x8a9c('0x2e')][_0x8a9c('0x48')]){var _0x3e7efd=_0x18b9f9['query'][_0x8a9c('0x48')][_0x8a9c('0x49')](',');var _0x181e20={};_0x181e20[_0x3e7efd[0x0]]={'$gte':moment(_0x3e7efd[0x1])['format'](_0x8a9c('0x4a'))};_0x1a11fa[_0x8a9c('0x45')]=_['merge'](_0x1a11fa['where'],_0x181e20);}_0x1a11fa=_[_0x8a9c('0x47')]({},_0x1a11fa,_0x18b9f9[_0x8a9c('0x36')]);return db['MailMessage'][_0x8a9c('0x16')]({'where':_0x1a11fa['where']})[_0x8a9c('0x1c')](function(_0x1f310b){_0x4fdcda[_0x8a9c('0x16')]=_0x1f310b;if(_0x18b9f9[_0x8a9c('0x2e')][_0x8a9c('0x34')]){_0x1a11fa[_0x8a9c('0x35')]=[{'all':!![]}];}return db['MailMessage'][_0x8a9c('0x2a')](_0x1a11fa);})[_0x8a9c('0x1c')](function(_0x581290){if(_0x18b9f9[_0x8a9c('0x2e')]['inlineCss']===_0x8a9c('0x4b')){for(var _0x3d311c=0x0;_0x3d311c<_0x581290[_0x8a9c('0x33')];_0x3d311c++){_0x581290[_0x3d311c][_0x8a9c('0x39')]=juice(_0x581290[_0x3d311c][_0x8a9c('0x39')]);}}_0x4fdcda[_0x8a9c('0x4c')]=_0x581290;return _0x4fdcda;});}})[_0x8a9c('0x1c')](respondWithFilteredResult(_0x3a2f03,_0x1a11fa))[_0x8a9c('0x37')](handleError(_0x3a2f03,null));};exports['addTags']=function(_0x4cbb60,_0xdb8361){return db['MailInteraction'][_0x8a9c('0x3a')]({'where':{'id':_0x4cbb60[_0x8a9c('0x2c')]['id']}})[_0x8a9c('0x1c')](handleEntityNotFound(_0xdb8361,null))[_0x8a9c('0x1c')](function(_0x152c1e){if(_0x152c1e){return _0x152c1e[_0x8a9c('0x4d')](_0x4cbb60[_0x8a9c('0x39')]['ids'],_[_0x8a9c('0x4e')](_0x4cbb60['body'],[_0x8a9c('0x4f'),'id'])||{})[_0x8a9c('0x50')](function(){return db[_0x8a9c('0x51')]['findAll']({'attributes':['id',_0x8a9c('0x20'),_0x8a9c('0x52')],'where':{'id':_0x4cbb60[_0x8a9c('0x39')]['ids']}});})[_0x8a9c('0x1c')](function(_0x5e473a){socket[_0x8a9c('0x53')](_0x8a9c('0x54'),{'id':Number(_0x4cbb60[_0x8a9c('0x2c')]['id']),'tags':_0x5e473a||[]});return{'id':Number(_0x4cbb60[_0x8a9c('0x2c')]['id']),'tags':_0x5e473a||[]};});}})['then'](respondWithResult(_0xdb8361,null))[_0x8a9c('0x37')](handleError(_0xdb8361,null));};exports['removeTags']=function(_0x1d663c,_0x989732){return db[_0x8a9c('0x24')][_0x8a9c('0x3a')]({'where':{'id':_0x1d663c[_0x8a9c('0x2c')]['id']}})[_0x8a9c('0x1c')](handleEntityNotFound(_0x989732,null))[_0x8a9c('0x1c')](function(_0x4c4521){if(_0x4c4521){return _0x4c4521[_0x8a9c('0x55')](_0x1d663c[_0x8a9c('0x2e')][_0x8a9c('0x4f')]);}})[_0x8a9c('0x1c')](respondWithStatusCode(_0x989732,null))[_0x8a9c('0x37')](handleError(_0x989732,null));};exports[_0x8a9c('0x56')]=function(_0x2edc58,_0x526dd3){var _0x942846=moment()[_0x8a9c('0x57')]()[_0x8a9c('0x58')]();var _0x3b5185=path['join'](config[_0x8a9c('0x59')],_0x8a9c('0x5a'),_0x8a9c('0x5b'),_0x8a9c('0x5c'));var _0x429d43=path['join'](config[_0x8a9c('0x59')],_0x8a9c('0x5a'),'files','attachments');var _0x3709b5=path[_0x8a9c('0x5d')](_0x3b5185,_0x942846);var _0x24e377=util['format'](_0x8a9c('0x5e'),_0x2edc58['params']['id'],_0x942846);var _0x30d28b=path[_0x8a9c('0x5d')](_0x3b5185,_0x24e377);var _0x3fc427=[];if(_0x2edc58[_0x8a9c('0x2e')]['attachments']){_0x3fc427[_0x8a9c('0x5f')]({'model':db[_0x8a9c('0x60')],'as':_0x8a9c('0x61'),'raw':!![]});}var _0x5d2be9=[{'model':db[_0x8a9c('0x3c')],'as':_0x8a9c('0x62'),'attributes':['id',_0x8a9c('0x39'),_0x8a9c('0x63'),'to','cc','bcc',_0x8a9c('0x64'),_0x8a9c('0x65')],'where':{'secret':![]},'order':qs[_0x8a9c('0x44')]('id'),'include':_0x3fc427}];return db[_0x8a9c('0x24')][_0x8a9c('0x3a')]({'where':{'id':_0x2edc58[_0x8a9c('0x2c')]['id']},'include':_0x5d2be9})[_0x8a9c('0x1c')](handleEntityNotFound(_0x526dd3,null))[_0x8a9c('0x1c')](function(_0x1bad7d){if(_0x1bad7d&&_0x1bad7d[_0x8a9c('0x62')]){var _0x4510d1=_0x1bad7d[_0x8a9c('0x66')]({'plain':!![]});fs[_0x8a9c('0x67')](_0x3709b5);return BPromise[_0x8a9c('0x68')](_0x4510d1[_0x8a9c('0x62')],function(_0x1384d5,_0x2e72d7){var _0x889780={'from':_0x1384d5[_0x8a9c('0x63')],'to':_0x1384d5['to']||_0x8a9c('0x69'),'subject':_0x1384d5['subject'],'html':htmlEntities[_0x8a9c('0x6a')](_0x1384d5[_0x8a9c('0x39')]),'headers':{'Date':moment(_0x1384d5[_0x8a9c('0x65')])[_0x8a9c('0x6b')](_0x8a9c('0x6c'))},'attachments':[]};if(_0x1384d5['cc']){_0x889780[_0x8a9c('0x6d')]['Cc']=_0x1384d5['cc'];}if(_0x1384d5[_0x8a9c('0x6e')]){_0x889780[_0x8a9c('0x6d')][_0x8a9c('0x6f')]=_0x1384d5['bcc'];}return new BPromise(function(_0x3c14e4,_0x301c92){if(_0x1384d5['Attachments']){for(var _0x5dbb14=0x0;_0x5dbb14<_0x1384d5['Attachments'][_0x8a9c('0x33')];_0x5dbb14++){var _0x1e4220=_0x1384d5[_0x8a9c('0x61')][_0x5dbb14];var _0x539e0b=path[_0x8a9c('0x5d')](_0x429d43,_0x1e4220['basename']);if(fs[_0x8a9c('0x70')](_0x539e0b)){_0x889780[_0x8a9c('0x71')]['push']({'name':_0x1e4220[_0x8a9c('0x20')],'contentType':_0x1e4220['type'],'data':fs[_0x8a9c('0x72')](_0x539e0b)});}}}emlformat[_0x8a9c('0x73')](_0x889780,function(_0x1524c6,_0xf79a0f){if(_0x1524c6)return _0x301c92(_0x1524c6);fs[_0x8a9c('0x74')](path[_0x8a9c('0x5d')](_0x3709b5,util['format'](_0x8a9c('0x75'),_0x2e72d7)),_0xf79a0f);return _0x3c14e4(_0xf79a0f);});});})[_0x8a9c('0x1c')](function(){return new BPromise(function(_0x262c11,_0x4c5595){zipdir(_0x3709b5,{'saveTo':_0x30d28b},function(_0x545613,_0x1a9c6c){if(_0x545613)return _0x4c5595(_0x545613);return _0x262c11(_0x1a9c6c);});})['then'](function(){return new BPromise(function(_0x4d66c8,_0x42be33){rimraf(_0x3709b5,function(_0x3c013c){if(_0x3c013c)_0x42be33(_0x3c013c);return _0x4d66c8();});});})[_0x8a9c('0x1c')](function(){return _0x526dd3['download'](_0x30d28b,_0x24e377,function(_0xf6158a){if(!_0xf6158a)fs[_0x8a9c('0x76')](_0x30d28b);});});});}else{return _0x526dd3[_0x8a9c('0x11')](0xc8);}})['catch'](handleError(_0x526dd3,null));}; \ No newline at end of file +var _0xbb90=['root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','createdAt','get','mkdirSync','from','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','moment','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','type','key','getOptions','findAll','query','catch','show','model','keys','MailInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','params','describe','addMessage','MailMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','removeTags','download','unix','toString'];(function(_0x163e9b,_0x5e5603){var _0x1244fc=function(_0x204980){while(--_0x204980){_0x163e9b['push'](_0x163e9b['shift']());}};_0x1244fc(++_0x5e5603);}(_0xbb90,0x87));var _0x0bb9=function(_0x146130,_0x3c70e0){_0x146130=_0x146130-0x0;var _0x2c0647=_0xbb90[_0x146130];return _0x2c0647;};'use strict';var emlformat=require(_0x0bb9('0x0'));var rimraf=require(_0x0bb9('0x1'));var zipdir=require(_0x0bb9('0x2'));var moment=require(_0x0bb9('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x0bb9('0x4'));var fs=require('fs');var _=require(_0x0bb9('0x5'));var juice=require(_0x0bb9('0x6'));var Redis=require(_0x0bb9('0x7'));var interaction=require(_0x0bb9('0x8'));var qs=require(_0x0bb9('0x9'));var logger=require(_0x0bb9('0xa'))(_0x0bb9('0xb'));var config=require('../../config/environment');var db=require(_0x0bb9('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x0bb9('0xd')]=_['defaults'](config['redis'],{'host':_0x0bb9('0xe'),'port':0x18eb});var socket=require(_0x0bb9('0xf'))(new Redis(config[_0x0bb9('0xd')]));require(_0x0bb9('0x10'))[_0x0bb9('0x11')](socket);function respondWithStatusCode(_0x46aa20,_0x4b13ef){_0x4b13ef=_0x4b13ef||0xcc;return function(_0x44a977){if(_0x44a977){return _0x46aa20['sendStatus'](_0x4b13ef);}return _0x46aa20[_0x0bb9('0x12')](_0x4b13ef)['end']();};}function respondWithResult(_0x457f7d,_0x60f8d4){_0x60f8d4=_0x60f8d4||0xc8;return function(_0x545b52){if(_0x545b52){return _0x457f7d[_0x0bb9('0x12')](_0x60f8d4)[_0x0bb9('0x13')](_0x545b52);}};}function respondWithFilteredResult(_0x51cde7,_0x5064ff){return function(_0x1ee4e0){if(_0x1ee4e0){var _0x3c96f1=typeof _0x5064ff['offset']===_0x0bb9('0x14')&&typeof _0x5064ff[_0x0bb9('0x15')]===_0x0bb9('0x14');var _0x3882af=_0x1ee4e0[_0x0bb9('0x16')];var _0x5974a6=_0x3c96f1?0x0:_0x5064ff[_0x0bb9('0x17')];var _0x20d814=_0x3c96f1?_0x1ee4e0[_0x0bb9('0x16')]:_0x5064ff[_0x0bb9('0x17')]+_0x5064ff[_0x0bb9('0x15')];var _0x1f8008;if(_0x20d814>=_0x3882af){_0x20d814=_0x3882af;_0x1f8008=0xc8;}else{_0x1f8008=0xce;}_0x51cde7[_0x0bb9('0x12')](_0x1f8008);return _0x51cde7[_0x0bb9('0x18')](_0x0bb9('0x19'),_0x5974a6+'-'+_0x20d814+'/'+_0x3882af)[_0x0bb9('0x13')](_0x1ee4e0);}return null;};}function saveUpdates(_0x1b96cc){return function(_0x4db7de){if(_0x4db7de){return _0x4db7de[_0x0bb9('0x1a')](_0x1b96cc)[_0x0bb9('0x1b')](function(_0x43155b){return _0x43155b;});}return null;};}function removeEntity(_0x3acd4c){return function(_0x275e0b){if(_0x275e0b){return _0x275e0b[_0x0bb9('0x1c')]()[_0x0bb9('0x1b')](function(){_0x3acd4c[_0x0bb9('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f405e){return function(_0x3645fe){if(!_0x3645fe){_0x3f405e[_0x0bb9('0x1d')](0x194);}return _0x3645fe;};}function handleError(_0x4a39f4,_0x4e6e50){_0x4e6e50=_0x4e6e50||0x1f4;return function(_0x512c4c){logger[_0x0bb9('0x1e')](_0x512c4c['stack']);if(_0x512c4c['name']){delete _0x512c4c[_0x0bb9('0x1f')];}_0x4a39f4[_0x0bb9('0x12')](_0x4e6e50)['send'](_0x512c4c);};}exports[_0x0bb9('0x20')]=function(_0x1629fc,_0x27f70e){var _0x4d40d5={};var _0x1ec364=_[_0x0bb9('0x21')](db['MailInteraction'][_0x0bb9('0x22')],function(_0x4c156b){return{'name':_0x4c156b['fieldName'],'type':_0x4c156b[_0x0bb9('0x23')][_0x0bb9('0x24')]};});_0x4d40d5=qs[_0x0bb9('0x25')](_0x1ec364,_0x1629fc);return interaction[_0x0bb9('0x26')]('mail',_0x1629fc[_0x0bb9('0x27')],_0x1629fc['user'],_0x4d40d5,_0x1ec364)['then'](respondWithFilteredResult(_0x27f70e,_0x4d40d5))[_0x0bb9('0x28')](handleError(_0x27f70e,null));};exports[_0x0bb9('0x29')]=function(_0x3ff83c,_0x480f79){var _0x5adf0c={'raw':![],'where':{'id':_0x3ff83c['params']['id']}},_0x25ba9b={};_0x25ba9b[_0x0bb9('0x2a')]=_[_0x0bb9('0x2b')](db[_0x0bb9('0x2c')][_0x0bb9('0x22')]);_0x25ba9b[_0x0bb9('0x27')]=_['keys'](_0x3ff83c[_0x0bb9('0x27')]);_0x25ba9b[_0x0bb9('0x2d')]=_[_0x0bb9('0x2e')](_0x25ba9b[_0x0bb9('0x2a')],_0x25ba9b[_0x0bb9('0x27')]);_0x5adf0c[_0x0bb9('0x2f')]=_[_0x0bb9('0x2e')](_0x25ba9b[_0x0bb9('0x2a')],qs[_0x0bb9('0x30')](_0x3ff83c[_0x0bb9('0x27')]['fields']));_0x5adf0c[_0x0bb9('0x2f')]=_0x5adf0c[_0x0bb9('0x2f')][_0x0bb9('0x31')]?_0x5adf0c[_0x0bb9('0x2f')]:_0x25ba9b[_0x0bb9('0x2a')];if(_0x3ff83c[_0x0bb9('0x27')][_0x0bb9('0x32')]){_0x5adf0c[_0x0bb9('0x33')]=[{'all':!![]}];}_0x5adf0c=_[_0x0bb9('0x34')]({},_0x5adf0c,_0x3ff83c[_0x0bb9('0x35')]);return db[_0x0bb9('0x2c')][_0x0bb9('0x36')](_0x5adf0c)[_0x0bb9('0x1b')](handleEntityNotFound(_0x480f79,null))[_0x0bb9('0x1b')](respondWithResult(_0x480f79,null))[_0x0bb9('0x28')](handleError(_0x480f79,null));};exports['create']=function(_0x300883,_0x1fb47b){return db[_0x0bb9('0x2c')]['create'](_0x300883[_0x0bb9('0x37')],{})[_0x0bb9('0x1b')](respondWithResult(_0x1fb47b,0xc9))[_0x0bb9('0x28')](handleError(_0x1fb47b,null));};exports[_0x0bb9('0x1a')]=function(_0x3f0cd6,_0x5bf414){if(_0x3f0cd6[_0x0bb9('0x37')]['id']){delete _0x3f0cd6['body']['id'];}return db[_0x0bb9('0x2c')][_0x0bb9('0x36')]({'where':{'id':_0x3f0cd6[_0x0bb9('0x38')]['id']}})[_0x0bb9('0x1b')](handleEntityNotFound(_0x5bf414,null))[_0x0bb9('0x1b')](saveUpdates(_0x3f0cd6[_0x0bb9('0x37')],null))['then'](respondWithResult(_0x5bf414,null))[_0x0bb9('0x28')](handleError(_0x5bf414,null));};exports['destroy']=function(_0x33d6cb,_0x3774fb){return db[_0x0bb9('0x2c')]['find']({'where':{'id':_0x33d6cb[_0x0bb9('0x38')]['id']}})[_0x0bb9('0x1b')](handleEntityNotFound(_0x3774fb,null))[_0x0bb9('0x1b')](removeEntity(_0x3774fb,null))[_0x0bb9('0x28')](handleError(_0x3774fb,null));};exports[_0x0bb9('0x39')]=function(_0x10a75c,_0x3a65a2){return db[_0x0bb9('0x2c')][_0x0bb9('0x39')]()[_0x0bb9('0x1b')](respondWithResult(_0x3a65a2,null))['catch'](handleError(_0x3a65a2,null));};exports[_0x0bb9('0x3a')]=function(_0x290ea1,_0x1d209e){return db[_0x0bb9('0x3b')][_0x0bb9('0x36')]({'where':{'id':_0x290ea1[_0x0bb9('0x38')]['id']}})[_0x0bb9('0x1b')](handleEntityNotFound(_0x1d209e,null))[_0x0bb9('0x1b')](function(_0xc22d5c){if(_0xc22d5c){return _0xc22d5c[_0x0bb9('0x3a')](_0x290ea1[_0x0bb9('0x37')][_0x0bb9('0x3c')],_[_0x0bb9('0x3d')](_0x290ea1['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1d209e,null))[_0x0bb9('0x28')](handleError(_0x1d209e,null));};exports['getMessages']=function(_0x9756fd,_0x41d927){var _0x505f9c={'raw':![],'where':{}};var _0x2af7b6={};var _0x14ff6e={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x9756fd[_0x0bb9('0x38')]['id']}})[_0x0bb9('0x1b')](handleEntityNotFound(_0x41d927,null))[_0x0bb9('0x1b')](function(_0x374ee3){if(_0x374ee3){_0x2af7b6[_0x0bb9('0x2a')]=_[_0x0bb9('0x2b')](db[_0x0bb9('0x3b')]['rawAttributes']);_0x2af7b6[_0x0bb9('0x27')]=_[_0x0bb9('0x2b')](_0x9756fd['query']);_0x2af7b6['filters']=_['intersection'](_0x2af7b6[_0x0bb9('0x2a')],_0x2af7b6[_0x0bb9('0x27')]);_0x505f9c['attributes']=_['intersection'](_0x2af7b6['model'],qs[_0x0bb9('0x30')](_0x9756fd['query'][_0x0bb9('0x30')]));_0x505f9c[_0x0bb9('0x2f')]=_0x505f9c['attributes'][_0x0bb9('0x31')]?_0x505f9c[_0x0bb9('0x2f')]:_0x2af7b6[_0x0bb9('0x2a')];if(!_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x3e')](_0x0bb9('0x3f'))){_0x505f9c[_0x0bb9('0x15')]=qs[_0x0bb9('0x15')](_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x15')]);_0x505f9c[_0x0bb9('0x17')]=qs[_0x0bb9('0x17')](_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x17')]);}_0x505f9c[_0x0bb9('0x40')]=qs['sort'](_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x41')]);_0x505f9c[_0x0bb9('0x42')]=qs[_0x0bb9('0x2d')](_[_0x0bb9('0x43')](_0x9756fd[_0x0bb9('0x27')],_0x2af7b6[_0x0bb9('0x2d')]));_0x505f9c[_0x0bb9('0x42')][_0x0bb9('0x44')]=_0x374ee3['id'];if(_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x45')]){_0x505f9c[_0x0bb9('0x42')]=_[_0x0bb9('0x34')](_0x505f9c['where'],{'$or':_[_0x0bb9('0x21')](_0x505f9c[_0x0bb9('0x2f')],function(_0x461837){var _0x190e20={};_0x190e20[_0x461837]={'$like':'%'+_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x45')]+'%'};return _0x190e20;})});}if(_0x9756fd[_0x0bb9('0x27')][_0x0bb9('0x46')]){var _0x4e19c4=_0x9756fd[_0x0bb9('0x27')]['$gte']['split'](',');var _0xc5a307={};_0xc5a307[_0x4e19c4[0x0]]={'$gte':moment(_0x4e19c4[0x1])[_0x0bb9('0x47')](_0x0bb9('0x48'))};_0x505f9c['where']=_[_0x0bb9('0x34')](_0x505f9c[_0x0bb9('0x42')],_0xc5a307);}_0x505f9c=_[_0x0bb9('0x34')]({},_0x505f9c,_0x9756fd['options']);return db[_0x0bb9('0x3b')][_0x0bb9('0x16')]({'where':_0x505f9c[_0x0bb9('0x42')]})['then'](function(_0x54778a){_0x14ff6e[_0x0bb9('0x16')]=_0x54778a;if(_0x9756fd['query']['includeAll']){_0x505f9c[_0x0bb9('0x33')]=[{'all':!![]}];}return db[_0x0bb9('0x3b')]['findAll'](_0x505f9c);})[_0x0bb9('0x1b')](function(_0x58b64c){if(_0x9756fd['query'][_0x0bb9('0x49')]===_0x0bb9('0x4a')){for(var _0x88d082=0x0;_0x88d082<_0x58b64c[_0x0bb9('0x31')];_0x88d082++){_0x58b64c[_0x88d082][_0x0bb9('0x37')]=juice(_0x58b64c[_0x88d082][_0x0bb9('0x37')]);}}_0x14ff6e[_0x0bb9('0x4b')]=_0x58b64c;return _0x14ff6e;});}})[_0x0bb9('0x1b')](respondWithFilteredResult(_0x41d927,_0x505f9c))[_0x0bb9('0x28')](handleError(_0x41d927,null));};exports[_0x0bb9('0x4c')]=function(_0x1f5d11,_0x3a4ccb){return db[_0x0bb9('0x2c')][_0x0bb9('0x36')]({'where':{'id':_0x1f5d11[_0x0bb9('0x38')]['id']}})[_0x0bb9('0x1b')](handleEntityNotFound(_0x3a4ccb,null))[_0x0bb9('0x1b')](function(_0x5592e7){if(_0x5592e7){return _0x5592e7[_0x0bb9('0x4d')](_0x1f5d11[_0x0bb9('0x37')]['ids'],_[_0x0bb9('0x3d')](_0x1f5d11['body'],[_0x0bb9('0x3c'),'id'])||{})[_0x0bb9('0x4e')](function(){return db['Tag'][_0x0bb9('0x26')]({'attributes':['id',_0x0bb9('0x1f'),'color'],'where':{'id':_0x1f5d11[_0x0bb9('0x37')][_0x0bb9('0x3c')]}});})[_0x0bb9('0x1b')](function(_0x49b906){socket['emit']('mailInteractionTags:save',{'id':Number(_0x1f5d11[_0x0bb9('0x38')]['id']),'tags':_0x49b906||[]});return{'id':Number(_0x1f5d11[_0x0bb9('0x38')]['id']),'tags':_0x49b906||[]};});}})['then'](respondWithResult(_0x3a4ccb,null))[_0x0bb9('0x28')](handleError(_0x3a4ccb,null));};exports[_0x0bb9('0x4f')]=function(_0x5150ca,_0x2a28bb){return db[_0x0bb9('0x2c')][_0x0bb9('0x36')]({'where':{'id':_0x5150ca[_0x0bb9('0x38')]['id']}})['then'](handleEntityNotFound(_0x2a28bb,null))[_0x0bb9('0x1b')](function(_0x4dd1db){if(_0x4dd1db){return _0x4dd1db[_0x0bb9('0x4f')](_0x5150ca[_0x0bb9('0x27')][_0x0bb9('0x3c')]);}})[_0x0bb9('0x1b')](respondWithStatusCode(_0x2a28bb,null))['catch'](handleError(_0x2a28bb,null));};exports[_0x0bb9('0x50')]=function(_0x15a48a,_0x448838){var _0x564a42=moment()[_0x0bb9('0x51')]()[_0x0bb9('0x52')]();var _0x1abee7=path['join'](config[_0x0bb9('0x53')],'server',_0x0bb9('0x54'),_0x0bb9('0x55'));var _0x37ca1b=path[_0x0bb9('0x56')](config[_0x0bb9('0x53')],_0x0bb9('0x57'),_0x0bb9('0x54'),_0x0bb9('0x58'));var _0x44c66f=path[_0x0bb9('0x56')](_0x1abee7,_0x564a42);var _0x51ef41=util['format'](_0x0bb9('0x59'),_0x15a48a[_0x0bb9('0x38')]['id'],_0x564a42);var _0x2052b0=path['join'](_0x1abee7,_0x51ef41);var _0x204f9c=[];if(_0x15a48a[_0x0bb9('0x27')][_0x0bb9('0x58')]){_0x204f9c[_0x0bb9('0x5a')]({'model':db[_0x0bb9('0x5b')],'as':_0x0bb9('0x5c'),'raw':!![]});}var _0x2671d3=[{'model':db['MailMessage'],'as':_0x0bb9('0x5d'),'attributes':['id',_0x0bb9('0x37'),'from','to','cc',_0x0bb9('0x5e'),'subject',_0x0bb9('0x5f')],'where':{'secret':![]},'order':qs[_0x0bb9('0x41')]('id'),'include':_0x204f9c}];return db[_0x0bb9('0x2c')][_0x0bb9('0x36')]({'where':{'id':_0x15a48a[_0x0bb9('0x38')]['id']},'include':_0x2671d3})[_0x0bb9('0x1b')](handleEntityNotFound(_0x448838,null))[_0x0bb9('0x1b')](function(_0x3b6b20){if(_0x3b6b20&&_0x3b6b20['Messages']){var _0x3f2fa3=_0x3b6b20[_0x0bb9('0x60')]({'plain':!![]});fs[_0x0bb9('0x61')](_0x44c66f);return BPromise['each'](_0x3f2fa3[_0x0bb9('0x5d')],function(_0x25a5ee,_0x59978d){var _0x5c681d={'from':_0x25a5ee[_0x0bb9('0x62')],'to':_0x25a5ee['to']||'missing.recipient@your.company.com','subject':_0x25a5ee[_0x0bb9('0x63')],'html':htmlEntities[_0x0bb9('0x64')](_0x25a5ee[_0x0bb9('0x37')]),'headers':{'Date':moment(_0x25a5ee[_0x0bb9('0x5f')])['format'](_0x0bb9('0x65'))},'attachments':[]};if(_0x25a5ee['cc']){_0x5c681d[_0x0bb9('0x66')]['Cc']=_0x25a5ee['cc'];}if(_0x25a5ee[_0x0bb9('0x5e')]){_0x5c681d[_0x0bb9('0x66')][_0x0bb9('0x67')]=_0x25a5ee[_0x0bb9('0x5e')];}return new BPromise(function(_0x33002a,_0x49e2c5){if(_0x25a5ee[_0x0bb9('0x5c')]){for(var _0x4927e7=0x0;_0x4927e7<_0x25a5ee['Attachments'][_0x0bb9('0x31')];_0x4927e7++){var _0x951402=_0x25a5ee[_0x0bb9('0x5c')][_0x4927e7];var _0x2c0267=path['join'](_0x37ca1b,_0x951402['basename']);if(fs[_0x0bb9('0x68')](_0x2c0267)){_0x5c681d[_0x0bb9('0x58')][_0x0bb9('0x5a')]({'name':_0x951402[_0x0bb9('0x1f')],'contentType':_0x951402['type'],'data':fs[_0x0bb9('0x69')](_0x2c0267)});}}}emlformat[_0x0bb9('0x6a')](_0x5c681d,function(_0x30dce2,_0xb4066b){if(_0x30dce2)return _0x49e2c5(_0x30dce2);fs[_0x0bb9('0x6b')](path[_0x0bb9('0x56')](_0x44c66f,util['format']('message%d.eml',_0x59978d)),_0xb4066b);return _0x33002a(_0xb4066b);});});})['then'](function(){return new BPromise(function(_0x29ac3d,_0x24827b){zipdir(_0x44c66f,{'saveTo':_0x2052b0},function(_0x2b2237,_0x4b35bc){if(_0x2b2237)return _0x24827b(_0x2b2237);return _0x29ac3d(_0x4b35bc);});})[_0x0bb9('0x1b')](function(){return new BPromise(function(_0x294be5,_0x520dfa){rimraf(_0x44c66f,function(_0x51883c){if(_0x51883c)_0x520dfa(_0x51883c);return _0x294be5();});});})[_0x0bb9('0x1b')](function(){return _0x448838[_0x0bb9('0x50')](_0x2052b0,_0x51ef41,function(_0xc2ebcd){if(!_0xc2ebcd)fs[_0x0bb9('0x6c')](_0x2052b0);});});});}else{return _0x448838[_0x0bb9('0x1d')](0xc8);}})[_0x0bb9('0x28')](handleError(_0x448838,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 315002d..10d5cad 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 _0x3b4a=['setMaxListeners','save','remove','getUsers','then','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x387dbf,_0x5c9720){var _0x48c931=function(_0x314a26){while(--_0x314a26){_0x387dbf['push'](_0x387dbf['shift']());}};_0x48c931(++_0x5c9720);}(_0x3b4a,0xc9));var _0xa3b4=function(_0x186550,_0x26f3ee){_0x186550=_0x186550-0x0;var _0x4b4c70=_0x3b4a[_0x186550];return _0x4b4c70;};'use strict';var EventEmitter=require(_0xa3b4('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xa3b4('0x1'))['db'][_0xa3b4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa3b4('0x3')](0x0);var events={'afterCreate':_0xa3b4('0x4'),'afterUpdate':'update','afterDestroy':_0xa3b4('0x5')};function emitEvent(_0x3c9c6a){return function(_0x4cafab,_0x268606,_0x2c1047){_0x4cafab[_0xa3b4('0x6')]({'attributes':['id'],'raw':!![]})[_0xa3b4('0x7')](function(_0x446040){_0x4cafab['setDataValue'](_0xa3b4('0x8'),_0x446040['map'](function(_0x9ca4ad){return{'id':_0x9ca4ad['id']};}));return MailMessage[_0xa3b4('0x9')]({'where':{'MailInteractionId':_0x4cafab['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3b0635){_0x4cafab['setDataValue'](_0xa3b4('0xa'),_0x3b0635[_0xa3b4('0xb')]);MailInteractionEvents[_0xa3b4('0xc')](_0x3c9c6a+':'+_0x4cafab['id'],_0x4cafab);MailInteractionEvents[_0xa3b4('0xc')](_0x3c9c6a,_0x4cafab);_0x2c1047(null);})[_0xa3b4('0xd')](_0x2c1047(null));};}for(var e in events){if(events[_0xa3b4('0xe')](e)){var event=events[e];MailInteraction[_0xa3b4('0xf')](e,emitEvent(event));}}module[_0xa3b4('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x23aa=['MailInteraction','MailMessage','save','remove','setDataValue','Users','map','findAll','then','unreadMessages','emit','hook','../../mysqldb'];(function(_0x32f70b,_0x408d84){var _0x58cc25=function(_0x3a2a67){while(--_0x3a2a67){_0x32f70b['push'](_0x32f70b['shift']());}};_0x58cc25(++_0x408d84);}(_0x23aa,0x1c6));var _0xa23a=function(_0x444ea5,_0xd5a18f){_0x444ea5=_0x444ea5-0x0;var _0x4ff79e=_0x23aa[_0x444ea5];return _0x4ff79e;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xa23a('0x0'))['db'][_0xa23a('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xa23a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa23a('0x3'),'afterUpdate':'update','afterDestroy':_0xa23a('0x4')};function emitEvent(_0x54a943){return function(_0x57ebf3,_0x1c2cd2,_0x46184d){_0x57ebf3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x559f61){_0x57ebf3[_0xa23a('0x5')](_0xa23a('0x6'),_0x559f61[_0xa23a('0x7')](function(_0x4fd027){return{'id':_0x4fd027['id']};}));return MailMessage[_0xa23a('0x8')]({'where':{'MailInteractionId':_0x57ebf3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa23a('0x9')](function(_0x1e5179){_0x57ebf3[_0xa23a('0x5')](_0xa23a('0xa'),_0x1e5179['length']);MailInteractionEvents[_0xa23a('0xb')](_0x54a943+':'+_0x57ebf3['id'],_0x57ebf3);MailInteractionEvents[_0xa23a('0xb')](_0x54a943,_0x57ebf3);_0x46184d(null);})['catch'](_0x46184d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa23a('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index cad34d8..ae2e192 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 _0x60e5=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','MailMessage','update','then','catch'];(function(_0x11314c,_0x2ca8d7){var _0x12cb4a=function(_0x5e7ddc){while(--_0x5e7ddc){_0x11314c['push'](_0x11314c['shift']());}};_0x12cb4a(++_0x2ca8d7);}(_0x60e5,0xf4));var _0x560e=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x60e5[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x560e('0x0'));var util=require(_0x560e('0x1'));var logger=require(_0x560e('0x2'))(_0x560e('0x3'));var moment=require(_0x560e('0x4'));var BPromise=require(_0x560e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x560e('0x6'));var rimraf=require(_0x560e('0x7'));var config=require(_0x560e('0x8'));var attributes=require(_0x560e('0x9'));module[_0x560e('0xa')]=function(_0x504c30,_0x4a3633){return _0x504c30['define']('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x560e('0xb'),'fields':['subject','to'],'type':_0x560e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x208598,_0x474955,_0x4cb827){if(_0x208598[_0x560e('0xd')]){_0x208598[_0x560e('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x208598['closed']){_0x208598[_0x560e('0xf')]=moment()[_0x560e('0x10')](_0x560e('0x11'));}_0x4cb827(null,_0x474955);},'beforeUpdate':function(_0x166246,_0x144dda,_0x84b5e9){if(_0x166246[_0x560e('0x12')](_0x560e('0xd'))){_0x166246['substatusAt']=_0x166246[_0x560e('0xd')]?moment()[_0x560e('0x10')](_0x560e('0x11')):null;}if(_0x166246[_0x560e('0x12')](_0x560e('0x13'))){_0x166246['closedAt']=moment()[_0x560e('0x10')](_0x560e('0x11'));_0x166246[_0x560e('0xd')]=null;_0x166246[_0x560e('0xe')]=null;}_0x84b5e9(null,_0x166246);},'afterUpdate':function(_0x13b903,_0x2b142c,_0x24faa3){var _0x257752=_0x504c30[_0x560e('0x14')];var _0x4309fa=_0x13b903[_0x560e('0x15')]({'plain':!![]});if(_0x4309fa[_0x560e('0x13')]){return _0x257752[_0x560e('0x16')][_0x560e('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x4309fa['id']}})[_0x560e('0x18')](function(){_0x24faa3();})[_0x560e('0x19')](function(_0x3339cd){_0x24faa3(_0x3339cd);});}else{_0x24faa3();}}},'charset':'utf8mb4','collate':_0x560e('0x1a')});}; \ No newline at end of file +var _0xf84d=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','update','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf84d,0x160));var _0xdf84=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xf84d[_0xf34b0a];return _0x5021e1;};'use strict';var _=require(_0xdf84('0x0'));var util=require('util');var logger=require(_0xdf84('0x1'))(_0xdf84('0x2'));var moment=require(_0xdf84('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf84('0x4'));var fs=require('fs');var path=require(_0xdf84('0x5'));var rimraf=require(_0xdf84('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x5a2281,_0x535743){return _0x5a2281['define'](_0xdf84('0x7'),attributes,{'tableName':_0xdf84('0x8'),'paranoid':![],'indexes':[{'name':_0xdf84('0x9'),'fields':[_0xdf84('0xa'),'to'],'type':_0xdf84('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d9ccd,_0x415992,_0x4b4d3b){if(_0x5d9ccd[_0xdf84('0xc')]){_0x5d9ccd[_0xdf84('0xd')]=moment()[_0xdf84('0xe')](_0xdf84('0xf'));}if(_0x5d9ccd[_0xdf84('0x10')]){_0x5d9ccd['closedAt']=moment()[_0xdf84('0xe')](_0xdf84('0xf'));}_0x4b4d3b(null,_0x415992);},'beforeUpdate':function(_0x9acb9f,_0x25173e,_0xd6a8b5){if(_0x9acb9f[_0xdf84('0x11')](_0xdf84('0xc'))){_0x9acb9f[_0xdf84('0xd')]=_0x9acb9f['substatus']?moment()['format'](_0xdf84('0xf')):null;}if(_0x9acb9f[_0xdf84('0x11')]('closed')){_0x9acb9f[_0xdf84('0x12')]=moment()[_0xdf84('0xe')](_0xdf84('0xf'));_0x9acb9f[_0xdf84('0xc')]=null;_0x9acb9f[_0xdf84('0xd')]=null;}_0xd6a8b5(null,_0x9acb9f);},'afterUpdate':function(_0x16e4d7,_0x1a54c9,_0x3187af){var _0x1e116b=_0x5a2281[_0xdf84('0x13')];var _0x40bb13=_0x16e4d7[_0xdf84('0x14')]({'plain':!![]});if(_0x40bb13[_0xdf84('0x10')]){return _0x1e116b['MailMessage'][_0xdf84('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x40bb13['id']}})['then'](function(){_0x3187af();})[_0xdf84('0x16')](function(_0x25f1b7){_0x3187af(_0x25f1b7);});}else{_0x3187af();}}},'charset':_0xdf84('0x17'),'collate':_0xdf84('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f54b5ce..6afadc4 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 _0xacc6=['../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','update','body','options','raw','where','limit','UpdateMailInteraction','stringify','AddTagsToMailInteraction','MailInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c1b1a,_0x229087){var _0x4878e0=function(_0x3aad97){while(--_0x3aad97){_0x5c1b1a['push'](_0x5c1b1a['shift']());}};_0x4878e0(++_0x229087);}(_0xacc6,0x150));var _0x6acc=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xacc6[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var moment=require(_0x6acc('0x2'));var BPromise=require(_0x6acc('0x3'));var rs=require(_0x6acc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6acc('0x5'))['db'];var utils=require(_0x6acc('0x6'));var logger=require(_0x6acc('0x7'))('rpc');var config=require(_0x6acc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6acc('0x9')][_0x6acc('0xa')]({'port':0x232a});config['redis']=_[_0x6acc('0xb')](config['redis'],{'host':_0x6acc('0xc'),'port':0x18eb});var socket=require(_0x6acc('0xd'))(new Redis(config[_0x6acc('0xe')]));require(_0x6acc('0xf'))['register'](socket);function respondWithRpcPromise(_0x1343cb,_0x4cf4c7,_0x3c1a24){return new BPromise(function(_0x21b624,_0xb8647d){return client[_0x6acc('0x10')](_0x1343cb,_0x3c1a24)[_0x6acc('0x11')](function(_0x15b64b){logger['info'](_0x6acc('0x12'),_0x4cf4c7,_0x6acc('0x13'));logger[_0x6acc('0x14')](_0x6acc('0x15'),_0x4cf4c7,_0x6acc('0x13'),JSON['stringify'](_0x15b64b));if(_0x15b64b['error']){if(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x17')]===0x1f4){logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);return _0xb8647d(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);}logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);return _0x21b624(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);}else{logger[_0x6acc('0x19')](_0x6acc('0x12'),_0x4cf4c7,_0x6acc('0x13'));_0x21b624(_0x15b64b[_0x6acc('0x1a')]['message']);}})[_0x6acc('0x1b')](function(_0x43b8ca){logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x43b8ca);_0xb8647d(_0x43b8ca);});});}exports['UpdateMailInteraction']=function(_0x342043){var _0x531f7c=this;return new Promise(function(_0x51dea7,_0x4af9e){return db['MailInteraction'][_0x6acc('0x1c')](_0x342043[_0x6acc('0x1d')],{'raw':_0x342043[_0x6acc('0x1e')]?_0x342043[_0x6acc('0x1e')][_0x6acc('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x342043['options']?_0x342043[_0x6acc('0x1e')][_0x6acc('0x20')]||null:null,'attributes':_0x342043['options']?_0x342043[_0x6acc('0x1e')]['attributes']||null:null,'limit':_0x342043[_0x6acc('0x1e')]?_0x342043[_0x6acc('0x1e')][_0x6acc('0x21')]||null:null})[_0x6acc('0x11')](function(_0x5277b6){logger[_0x6acc('0x19')](_0x6acc('0x22'),_0x342043);logger['debug'](_0x6acc('0x22'),_0x342043,JSON[_0x6acc('0x23')](_0x5277b6));_0x51dea7(_0x5277b6);})[_0x6acc('0x1b')](function(_0x125084){logger[_0x6acc('0x16')](_0x6acc('0x22'),_0x125084[_0x6acc('0x18')],_0x342043);_0x4af9e(_0x531f7c[_0x6acc('0x16')](0x1f4,_0x125084['message']));});});};exports[_0x6acc('0x24')]=function(_0x54519d){return new Promise(function(_0x15be7c,_0x490ce6){return db[_0x6acc('0x25')][_0x6acc('0x26')]({'where':_0x54519d[_0x6acc('0x1e')]?_0x54519d[_0x6acc('0x1e')][_0x6acc('0x20')]||null:null})[_0x6acc('0x11')](function(_0x4b6498){if(_0x4b6498){return _0x4b6498['addTags'](_0x54519d['body']['ids'],_[_0x6acc('0x27')](_0x54519d[_0x6acc('0x1d')],[_0x6acc('0x28'),'id'])||{});}})[_0x6acc('0x29')](function(_0x349f9d){logger[_0x6acc('0x19')]('AddTags',_0x54519d);logger['debug'](_0x6acc('0x2a'),_0x54519d,JSON[_0x6acc('0x23')](_0x349f9d));_0x15be7c(_0x349f9d);})[_0x6acc('0x1b')](function(_0x363cbe){logger['error'](_0x6acc('0x2a'),_0x363cbe[_0x6acc('0x18')],_0x54519d);_0x490ce6(_this['error'](0x1f4,_0x363cbe[_0x6acc('0x18')]));});});}; \ No newline at end of file +var _0x5322=['body','options','raw','where','AddTagsToMailInteraction','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5322,0xff));var _0x2532=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x5322[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x2532('0x0'));var util=require(_0x2532('0x1'));var moment=require(_0x2532('0x2'));var BPromise=require('bluebird');var rs=require(_0x2532('0x3'));var fs=require('fs');var Redis=require(_0x2532('0x4'));var db=require(_0x2532('0x5'))['db'];var utils=require(_0x2532('0x6'));var logger=require('../../config/logger')(_0x2532('0x7'));var config=require(_0x2532('0x8'));var jayson=require(_0x2532('0x9'));var client=jayson[_0x2532('0xa')][_0x2532('0xb')]({'port':0x232a});config[_0x2532('0xc')]=_['defaults'](config[_0x2532('0xc')],{'host':_0x2532('0xd'),'port':0x18eb});var socket=require(_0x2532('0xe'))(new Redis(config[_0x2532('0xc')]));require(_0x2532('0xf'))[_0x2532('0x10')](socket);function respondWithRpcPromise(_0x58a034,_0x3f3325,_0x4423ed){return new BPromise(function(_0x18d2e1,_0x5d4577){return client[_0x2532('0x11')](_0x58a034,_0x4423ed)[_0x2532('0x12')](function(_0x3c437c){logger[_0x2532('0x13')](_0x2532('0x14'),_0x3f3325,_0x2532('0x15'));logger[_0x2532('0x16')](_0x2532('0x17'),_0x3f3325,_0x2532('0x15'),JSON[_0x2532('0x18')](_0x3c437c));if(_0x3c437c[_0x2532('0x19')]){if(_0x3c437c[_0x2532('0x19')][_0x2532('0x1a')]===0x1f4){logger[_0x2532('0x19')](_0x2532('0x14'),_0x3f3325,_0x3c437c['error'][_0x2532('0x1b')]);return _0x5d4577(_0x3c437c[_0x2532('0x19')][_0x2532('0x1b')]);}logger['error'](_0x2532('0x14'),_0x3f3325,_0x3c437c[_0x2532('0x19')][_0x2532('0x1b')]);return _0x18d2e1(_0x3c437c[_0x2532('0x19')]['message']);}else{logger[_0x2532('0x13')]('MailInteraction,\x20%s,\x20%s',_0x3f3325,_0x2532('0x15'));_0x18d2e1(_0x3c437c[_0x2532('0x1c')][_0x2532('0x1b')]);}})[_0x2532('0x1d')](function(_0x445cbf){logger[_0x2532('0x19')]('MailInteraction,\x20%s,\x20%s',_0x3f3325,_0x445cbf);_0x5d4577(_0x445cbf);});});}exports[_0x2532('0x1e')]=function(_0x60faf){var _0x122083=this;return new Promise(function(_0x178f50,_0x52d232){return db[_0x2532('0x1f')]['update'](_0x60faf[_0x2532('0x20')],{'raw':_0x60faf['options']?_0x60faf[_0x2532('0x21')][_0x2532('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60faf['options']?_0x60faf[_0x2532('0x21')][_0x2532('0x23')]||null:null,'attributes':_0x60faf[_0x2532('0x21')]?_0x60faf[_0x2532('0x21')]['attributes']||null:null,'limit':_0x60faf[_0x2532('0x21')]?_0x60faf['options']['limit']||null:null})[_0x2532('0x12')](function(_0x264d91){logger[_0x2532('0x13')]('UpdateMailInteraction',_0x60faf);logger[_0x2532('0x16')](_0x2532('0x1e'),_0x60faf,JSON['stringify'](_0x264d91));_0x178f50(_0x264d91);})['catch'](function(_0x232cec){logger[_0x2532('0x19')](_0x2532('0x1e'),_0x232cec['message'],_0x60faf);_0x52d232(_0x122083[_0x2532('0x19')](0x1f4,_0x232cec[_0x2532('0x1b')]));});});};exports[_0x2532('0x24')]=function(_0x39d965){return new Promise(function(_0x2850f1,_0x2f134f){return db[_0x2532('0x1f')]['find']({'where':_0x39d965[_0x2532('0x21')]?_0x39d965[_0x2532('0x21')]['where']||null:null})[_0x2532('0x12')](function(_0x5b2a9c){if(_0x5b2a9c){return _0x5b2a9c['addTags'](_0x39d965[_0x2532('0x20')]['ids'],_[_0x2532('0x25')](_0x39d965[_0x2532('0x20')],[_0x2532('0x26'),'id'])||{});}})[_0x2532('0x27')](function(_0x1fd59d){logger[_0x2532('0x13')](_0x2532('0x28'),_0x39d965);logger[_0x2532('0x16')](_0x2532('0x28'),_0x39d965,JSON[_0x2532('0x18')](_0x1fd59d));_0x2850f1(_0x1fd59d);})[_0x2532('0x1d')](function(_0x5877d4){logger['error'](_0x2532('0x28'),_0x5877d4[_0x2532('0x1b')],_0x39d965);_0x2f134f(_this['error'](0x1f4,_0x5877d4[_0x2532('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 42369ed..52981a1 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 _0xb004=['mailInteraction:','./mailInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x375d02,_0x50a2af){var _0x1eae8d=function(_0x31904a){while(--_0x31904a){_0x375d02['push'](_0x375d02['shift']());}};_0x1eae8d(++_0x50a2af);}(_0xb004,0x159));var _0x4b00=function(_0xd834e1,_0x277706){_0xd834e1=_0xd834e1-0x0;var _0x1040a4=_0xb004[_0xd834e1];return _0x1040a4;};'use strict';var MailInteractionEvents=require(_0x4b00('0x0'));var events=[_0x4b00('0x1'),'remove',_0x4b00('0x2')];function createListener(_0x5c2cd1,_0x2b59ac){return function(_0x52362f){_0x2b59ac[_0x4b00('0x3')](_0x5c2cd1,_0x52362f);};}function removeListener(_0x3b2ffa,_0x5ed008){return function(){MailInteractionEvents[_0x4b00('0x4')](_0x3b2ffa,_0x5ed008);};}exports[_0x4b00('0x5')]=function(_0x472f5e){for(var _0x4da7ed=0x0,_0x387891=events[_0x4b00('0x6')];_0x4da7ed<_0x387891;_0x4da7ed++){var _0x1d8114=events[_0x4da7ed];var _0x3ffac0=createListener(_0x4b00('0x7')+_0x1d8114,_0x472f5e);MailInteractionEvents['on'](_0x1d8114,_0x3ffac0);}}; \ No newline at end of file +var _0xc4df=['register','length','mailInteraction:','remove','update','removeListener'];(function(_0x2de553,_0x58da49){var _0x5ab4b4=function(_0x54779c){while(--_0x54779c){_0x2de553['push'](_0x2de553['shift']());}};_0x5ab4b4(++_0x58da49);}(_0xc4df,0x123));var _0xfc4d=function(_0x2f6b3b,_0x32ec37){_0x2f6b3b=_0x2f6b3b-0x0;var _0x31cf1e=_0xc4df[_0x2f6b3b];return _0x31cf1e;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xfc4d('0x0'),_0xfc4d('0x1')];function createListener(_0x3af5da,_0x169fa8){return function(_0x5d7926){_0x169fa8['emit'](_0x3af5da,_0x5d7926);};}function removeListener(_0x10f509,_0x22cfd9){return function(){MailInteractionEvents[_0xfc4d('0x2')](_0x10f509,_0x22cfd9);};}exports[_0xfc4d('0x3')]=function(_0x6582eb){for(var _0x2df17d=0x0,_0x430511=events[_0xfc4d('0x4')];_0x2df17d<_0x430511;_0x2df17d++){var _0x109e16=events[_0x2df17d];var _0x48ac9=createListener(_0xfc4d('0x5')+_0x109e16,_0x6582eb);MailInteractionEvents['on'](_0x109e16,_0x48ac9);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index cfbbd9a..978b3df 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc48d=['describe','exports','express','Router','get','/describe','isAuthenticated'];(function(_0x46eb54,_0x4f1eac){var _0x3902b2=function(_0x3ac68b){while(--_0x3ac68b){_0x46eb54['push'](_0x46eb54['shift']());}};_0x3902b2(++_0x4f1eac);}(_0xc48d,0x11a));var _0xdc48=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xc48d[_0x5e36d1];return _0x950b9e;};'use strict';var express=require(_0xdc48('0x0'));var router=express[_0xdc48('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0xdc48('0x2')](_0xdc48('0x3'),auth[_0xdc48('0x4')](),controller[_0xdc48('0x5')]);module[_0xdc48('0x6')]=router; \ No newline at end of file +var _0x8ca9=['/describe','isAuthenticated','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2640bd,_0x25fbb7){_0x2640bd=_0x2640bd-0x0;var _0x1ceece=_0x8ca9[_0x2640bd];return _0x1ceece;};'use strict';var express=require(_0x98ca('0x0'));var router=express[_0x98ca('0x1')]();var auth=require(_0x98ca('0x2'));var controller=require(_0x98ca('0x3'));router[_0x98ca('0x4')](_0x98ca('0x5'),auth[_0x98ca('0x6')](),controller['describe']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index d3a7c4e..eb8ea73 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4c63c6,_0x267ce1){var _0x4ca4a1=function(_0x2c5028){while(--_0x2c5028){_0x4c63c6['push'](_0x4c63c6['shift']());}};_0x4ca4a1(++_0x267ce1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x323ffc,_0x39b031){var _0x2f8738=function(_0x2ffda3){while(--_0x2ffda3){_0x323ffc['push'](_0x323ffc['shift']());}};_0x2f8738(++_0x39b031);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index eddca5a..6c9679d 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbac9=['INTEGER','exports'];(function(_0x367dd7,_0x2d2faa){var _0xd195b3=function(_0x49af63){while(--_0x49af63){_0x367dd7['push'](_0x367dd7['shift']());}};_0xd195b3(++_0x2d2faa);}(_0xbac9,0x1a1));var _0x9bac=function(_0x5e5c7b,_0x2495a3){_0x5e5c7b=_0x5e5c7b-0x0;var _0x3f947f=_0xbac9[_0x5e5c7b];return _0x3f947f;};'use strict';var Sequelize=require('sequelize');module[_0x9bac('0x0')]={'MailInteractionId':{'type':Sequelize[_0x9bac('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x9bac('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xc556=['exports','INTEGER','sequelize'];(function(_0x5e3f44,_0x3b425a){var _0x43829e=function(_0x2bd214){while(--_0x2bd214){_0x5e3f44['push'](_0x5e3f44['shift']());}};_0x43829e(++_0x3b425a);}(_0xc556,0x116));var _0x6c55=function(_0x21d253,_0x5e9128){_0x21d253=_0x21d253-0x0;var _0x4f4fbd=_0xc556[_0x21d253];return _0x4f4fbd;};'use strict';var Sequelize=require(_0x6c55('0x0'));module[_0x6c55('0x1')]={'MailInteractionId':{'type':Sequelize[_0x6c55('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x6c55('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index dccd9f1..ddc8757 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0323=['./mailInteractionHasTag','exports','define','mail_interaction_has_tags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0323,0x100));var _0x3032=function(_0x17422b,_0x3f1947){_0x17422b=_0x17422b-0x0;var _0x5cda75=_0x0323[_0x17422b];return _0x5cda75;};'use strict';var attributes=require(_0x3032('0x0'));module[_0x3032('0x1')]=function(_0x3ebe89){return _0x3ebe89[_0x3032('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x3032('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5d2=['exports','define','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0xd7105a,_0x289f1f){var _0x5de9a0=function(_0x822601){while(--_0x822601){_0xd7105a['push'](_0xd7105a['shift']());}};_0x5de9a0(++_0x289f1f);}(_0xf5d2,0xe7));var _0x2f5d=function(_0x4f33d3,_0x66cec1){_0x4f33d3=_0x4f33d3-0x0;var _0x318baf=_0xf5d2[_0x4f33d3];return _0x318baf;};'use strict';var attributes=require(_0x2f5d('0x0'));module[_0x2f5d('0x1')]=function(_0xdb922f){return _0xdb922f[_0x2f5d('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x2f5d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 484575d..0f47d05 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 _0xcc94=['accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0x420850,_0x446058){var _0x1363bc=function(_0x47d23c){while(--_0x47d23c){_0x420850['push'](_0x420850['shift']());}};_0x1363bc(++_0x446058);}(_0xcc94,0xee));var _0x4cc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc94[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4cc9('0x0'));var path=require(_0x4cc9('0x1'));var timeout=require(_0x4cc9('0x2'));var express=require(_0x4cc9('0x3'));var router=express[_0x4cc9('0x4')]();var fs_extra=require(_0x4cc9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4cc9('0x6'));var controller=require(_0x4cc9('0x7'));router[_0x4cc9('0x8')]('/',auth[_0x4cc9('0x9')](),controller[_0x4cc9('0xa')]);router['get'](_0x4cc9('0xb'),auth['isAuthenticated'](),controller[_0x4cc9('0xc')]);router[_0x4cc9('0x8')](_0x4cc9('0xd'),auth[_0x4cc9('0x9')](),controller['show']);router['get'](_0x4cc9('0xe'),auth[_0x4cc9('0x9')](),controller['download']);router[_0x4cc9('0xf')]('/',auth[_0x4cc9('0x9')](),interaction[_0x4cc9('0x10')](_0x4cc9('0x11'),_0x4cc9('0x12')),controller[_0x4cc9('0x13')]);router[_0x4cc9('0x14')]('/:id',auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x15')]);router[_0x4cc9('0x14')](_0x4cc9('0x16'),auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x17')]);router[_0x4cc9('0x14')](_0x4cc9('0x18'),auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x19')]);router[_0x4cc9('0x1a')](_0x4cc9('0xd'),auth[_0x4cc9('0x9')](),controller[_0x4cc9('0x1b')]);module[_0x4cc9('0x1c')]=router; \ No newline at end of file +var _0xbccf=['index','/describe','describe','/:id','show','/:id/download','download','post','tracked','create','put','update','accept','/:id/reject','reject','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x133793,_0x51ef10){var _0x50f6cd=function(_0x1c21b4){while(--_0x1c21b4){_0x133793['push'](_0x133793['shift']());}};_0x50f6cd(++_0x51ef10);}(_0xbccf,0x1d2));var _0xfbcc=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xbccf[_0x30cd7e];return _0x462a02;};'use strict';var multer=require(_0xfbcc('0x0'));var util=require('util');var path=require(_0xfbcc('0x1'));var timeout=require('connect-timeout');var express=require(_0xfbcc('0x2'));var router=express[_0xfbcc('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbcc('0x4'));var config=require(_0xfbcc('0x5'));var controller=require(_0xfbcc('0x6'));router[_0xfbcc('0x7')]('/',auth[_0xfbcc('0x8')](),controller[_0xfbcc('0x9')]);router[_0xfbcc('0x7')](_0xfbcc('0xa'),auth[_0xfbcc('0x8')](),controller[_0xfbcc('0xb')]);router[_0xfbcc('0x7')](_0xfbcc('0xc'),auth[_0xfbcc('0x8')](),controller[_0xfbcc('0xd')]);router[_0xfbcc('0x7')](_0xfbcc('0xe'),auth['isAuthenticated'](),controller[_0xfbcc('0xf')]);router[_0xfbcc('0x10')]('/',auth['isAuthenticated'](),interaction[_0xfbcc('0x11')]('mail','mailmessage:create'),controller[_0xfbcc('0x12')]);router[_0xfbcc('0x13')](_0xfbcc('0xc'),auth['isAuthenticated'](),controller[_0xfbcc('0x14')]);router[_0xfbcc('0x13')]('/:id/accept',auth[_0xfbcc('0x8')](),controller[_0xfbcc('0x15')]);router[_0xfbcc('0x13')](_0xfbcc('0x16'),auth['isAuthenticated'](),controller[_0xfbcc('0x17')]);router['delete'](_0xfbcc('0xc'),auth[_0xfbcc('0x8')](),controller[_0xfbcc('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9d3e018..aceef35 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 _0xb7aa=['Chat','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x1e09b4,_0x48ba6a){var _0x101d07=function(_0x4de0de){while(--_0x4de0de){_0x1e09b4['push'](_0x1e09b4['shift']());}};_0x101d07(++_0x48ba6a);}(_0xb7aa,0x11a));var _0xab7a=function(_0x39d250,_0x226f70){_0x39d250=_0x39d250-0x0;var _0x2917b5=_0xb7aa[_0x39d250];return _0x2917b5;};'use strict';var Sequelize=require(_0xab7a('0x0'));var _=require(_0xab7a('0x1'));module[_0xab7a('0x2')]={'body':{'type':Sequelize[_0xab7a('0x3')](_0xab7a('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xab7a('0x3')](_0xab7a('0x5'))},'read':{'type':Sequelize[_0xab7a('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xab7a('0x7')]('in',_0xab7a('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xab7a('0x9')](0x1fe)},'from':{'type':Sequelize[_0xab7a('0x9')]},'to':{'type':Sequelize[_0xab7a('0x3')](_0xab7a('0x4'))},'cc':{'type':Sequelize['TEXT'](_0xab7a('0x4'))},'bcc':{'type':Sequelize[_0xab7a('0x3')]('long')},'subject':{'type':Sequelize[_0xab7a('0x3')]},'sentAt':{'type':Sequelize[_0xab7a('0xa')]},'attach':{'type':Sequelize[_0xab7a('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xab7a('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xab7a('0xa')]},'originTo':{'type':Sequelize[_0xab7a('0x3')](_0xab7a('0x4'))},'originCc':{'type':Sequelize[_0xab7a('0x3')](_0xab7a('0x4'))},'originChannel':{'type':Sequelize[_0xab7a('0x7')]('Email',_0xab7a('0xc')),'defaultValue':_0xab7a('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0xa2a3=['Email','Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0xa2a3,0x120));var _0x3a2a=function(_0x372df5,_0x4c3340){_0x372df5=_0x372df5-0x0;var _0x55d332=_0xa2a3[_0x372df5];return _0x55d332;};'use strict';var Sequelize=require(_0x3a2a('0x0'));var _=require(_0x3a2a('0x1'));module[_0x3a2a('0x2')]={'body':{'type':Sequelize[_0x3a2a('0x3')](_0x3a2a('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x3a2a('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3a2a('0x6')]('in',_0x3a2a('0x7')),'defaultValue':_0x3a2a('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x3a2a('0x8')]},'to':{'type':Sequelize[_0x3a2a('0x3')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x3a2a('0x3')]('long')},'subject':{'type':Sequelize[_0x3a2a('0x3')]},'sentAt':{'type':Sequelize[_0x3a2a('0x9')]},'attach':{'type':Sequelize[_0x3a2a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3a2a('0x9')]},'originTo':{'type':Sequelize[_0x3a2a('0x3')](_0x3a2a('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x3a2a('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x3a2a('0xb'),_0x3a2a('0xc')),'defaultValue':_0x3a2a('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 20a0d6b..375bf30 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 _0x6756=['sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','accept','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interface','event','reject','download','toString','server','files','tmp','message-%s.eml','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','redis','defaults','localhost','socket.io-emitter','html-entities','register','client','http','request','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailMessage,\x20%s,\x20%s','info','result','catch','status','json','limit','offset','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','MailMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','readAt','user','agent','get','MailInteraction','UserId','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x1eda88,_0x555454){var _0x2eb594=function(_0x250216){while(--_0x250216){_0x1eda88['push'](_0x1eda88['shift']());}};_0x2eb594(++_0x555454);}(_0x6756,0x1f4));var _0x6675=function(_0x3b6fef,_0x5ae452){_0x3b6fef=_0x3b6fef-0x0;var _0x227b3f=_0x6756[_0x3b6fef];return _0x227b3f;};'use strict';var emlformat=require(_0x6675('0x0'));var moment=require(_0x6675('0x1'));var BPromise=require('bluebird');var util=require(_0x6675('0x2'));var path=require(_0x6675('0x3'));var fs=require('fs');var _=require(_0x6675('0x4'));var Redis=require(_0x6675('0x5'));var htmlToText=require(_0x6675('0x6'));var qs=require(_0x6675('0x7'));var logger=require(_0x6675('0x8'))('api');var interaction_log=require(_0x6675('0x8'))(_0x6675('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x6675('0xa')]=_[_0x6675('0xb')](config[_0x6675('0xa')],{'host':_0x6675('0xc'),'port':0x18eb});var socket=require(_0x6675('0xd'))(new Redis(config[_0x6675('0xa')]));var htmlEntities=require(_0x6675('0xe'));require('./mailMessage.socket')[_0x6675('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6675('0x10')][_0x6675('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x6675('0x11')]({'port':0x232b});var client9002=jayson[_0x6675('0x10')][_0x6675('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x517fb6,_0x2260cc,_0x1e1d33,_0x5b3f09){return new BPromise(function(_0x5dd726,_0x319f82){var _0xdd65bc=_0x5b3f09||client;return _0xdd65bc[_0x6675('0x12')](_0x517fb6,_0x1e1d33)[_0x6675('0x13')](function(_0xb4b2c7){logger['info']('MailMessage,\x20%s,\x20%s',_0x2260cc,'request\x20sent');logger[_0x6675('0x14')](_0x6675('0x15'),_0x2260cc,_0x6675('0x16'),JSON['stringify'](_0xb4b2c7));if(_0xb4b2c7[_0x6675('0x17')]){if(_0xb4b2c7['error'][_0x6675('0x18')]===0x1f4){logger[_0x6675('0x17')]('MailMessage,\x20%s,\x20%s',_0x2260cc,_0xb4b2c7['error'][_0x6675('0x19')]);return _0x319f82(_0xb4b2c7[_0x6675('0x17')][_0x6675('0x19')]);}logger[_0x6675('0x17')](_0x6675('0x1a'),_0x2260cc,_0xb4b2c7[_0x6675('0x17')][_0x6675('0x19')]);return _0x5dd726(_0xb4b2c7[_0x6675('0x17')][_0x6675('0x19')]);}else{logger[_0x6675('0x1b')](_0x6675('0x1a'),_0x2260cc,_0x6675('0x16'));_0x5dd726(_0xb4b2c7[_0x6675('0x1c')][_0x6675('0x19')]);}})[_0x6675('0x1d')](function(_0x35ffdf){logger['error']('MailMessage,\x20%s,\x20%s',_0x2260cc,_0x35ffdf);_0x319f82(_0x35ffdf);});});}function respondWithResult(_0x54bee5,_0x28056e){_0x28056e=_0x28056e||0xc8;return function(_0x621c4d){if(_0x621c4d){return _0x54bee5[_0x6675('0x1e')](_0x28056e)[_0x6675('0x1f')](_0x621c4d);}};}function respondWithFilteredResult(_0x2a2ab1,_0x5976c6){return function(_0x115043){if(_0x115043){var _0x4919e4=typeof _0x5976c6['offset']==='undefined'&&typeof _0x5976c6[_0x6675('0x20')]==='undefined';var _0x429b25=_0x115043['count'];var _0x3d4996=_0x4919e4?0x0:_0x5976c6[_0x6675('0x21')];var _0x4aed23=_0x4919e4?_0x115043[_0x6675('0x22')]:_0x5976c6[_0x6675('0x21')]+_0x5976c6[_0x6675('0x20')];var _0x505e23;if(_0x4aed23>=_0x429b25){_0x4aed23=_0x429b25;_0x505e23=0xc8;}else{_0x505e23=0xce;}_0x2a2ab1['status'](_0x505e23);return _0x2a2ab1[_0x6675('0x23')](_0x6675('0x24'),_0x3d4996+'-'+_0x4aed23+'/'+_0x429b25)[_0x6675('0x1f')](_0x115043);}return null;};}function saveUpdates(_0x140063){return function(_0x1efd71){if(_0x1efd71){return _0x1efd71[_0x6675('0x25')](_0x140063)[_0x6675('0x13')](function(_0x3aa596){return _0x3aa596;});}return null;};}function removeEntity(_0x28cb30){return function(_0x3ec2b0){if(_0x3ec2b0){return _0x3ec2b0[_0x6675('0x26')]()[_0x6675('0x13')](function(){_0x28cb30[_0x6675('0x1e')](0xcc)[_0x6675('0x27')]();});}};}function handleEntityNotFound(_0x5abf19){return function(_0x454855){if(!_0x454855){_0x5abf19[_0x6675('0x28')](0x194);}return _0x454855;};}function handleError(_0x27b563,_0x1c2d8e){_0x1c2d8e=_0x1c2d8e||0x1f4;return function(_0x3775ad){logger[_0x6675('0x17')](_0x3775ad[_0x6675('0x29')]);if(_0x3775ad[_0x6675('0x2a')]){delete _0x3775ad[_0x6675('0x2a')];}_0x27b563[_0x6675('0x1e')](_0x1c2d8e)['send'](_0x3775ad);};}exports['index']=function(_0x52edeb,_0x454971){var _0x3b9b32={},_0x24d60d={},_0x533ebf={'count':0x0,'rows':[]};var _0x2e3e85=_['map'](db[_0x6675('0x2b')][_0x6675('0x2c')],function(_0x331691){return{'name':_0x331691[_0x6675('0x2d')],'type':_0x331691[_0x6675('0x2e')]['key']};});_0x24d60d[_0x6675('0x2f')]=_[_0x6675('0x30')](_0x2e3e85,_0x6675('0x2a'));_0x24d60d[_0x6675('0x31')]=_[_0x6675('0x32')](_0x52edeb[_0x6675('0x31')]);_0x24d60d[_0x6675('0x33')]=_['intersection'](_0x24d60d[_0x6675('0x2f')],_0x24d60d[_0x6675('0x31')]);_0x3b9b32[_0x6675('0x34')]=_[_0x6675('0x35')](_0x24d60d[_0x6675('0x2f')],qs[_0x6675('0x36')](_0x52edeb['query']['fields']));_0x3b9b32[_0x6675('0x34')]=_0x3b9b32[_0x6675('0x34')][_0x6675('0x37')]?_0x3b9b32[_0x6675('0x34')]:_0x24d60d['model'];if(!_0x52edeb[_0x6675('0x31')][_0x6675('0x38')](_0x6675('0x39'))){_0x3b9b32['limit']=qs[_0x6675('0x20')](_0x52edeb[_0x6675('0x31')]['limit']);_0x3b9b32[_0x6675('0x21')]=qs[_0x6675('0x21')](_0x52edeb['query'][_0x6675('0x21')]);}_0x3b9b32[_0x6675('0x3a')]=qs['sort'](_0x52edeb['query']['sort']);_0x3b9b32['where']=qs['filters'](_[_0x6675('0x3b')](_0x52edeb[_0x6675('0x31')],_0x24d60d[_0x6675('0x33')]),_0x2e3e85);if(_0x52edeb['query'][_0x6675('0x3c')]){_0x3b9b32[_0x6675('0x3d')]=_[_0x6675('0x3e')](_0x3b9b32[_0x6675('0x3d')],{'$or':_[_0x6675('0x30')](_0x2e3e85,function(_0x978152){if(_0x978152['type']!==_0x6675('0x3f')){var _0x42d3c6={};_0x42d3c6[_0x978152[_0x6675('0x2a')]]={'$like':'%'+_0x52edeb[_0x6675('0x31')][_0x6675('0x3c')]+'%'};return _0x42d3c6;}})});}_0x3b9b32=_[_0x6675('0x3e')]({},_0x3b9b32,_0x52edeb['options']);var _0x3607ba={'where':_0x3b9b32[_0x6675('0x3d')]};return db[_0x6675('0x2b')][_0x6675('0x22')](_0x3607ba)[_0x6675('0x13')](function(_0x5cb934){_0x533ebf[_0x6675('0x22')]=_0x5cb934;if(_0x52edeb[_0x6675('0x31')][_0x6675('0x40')]){_0x3b9b32['include']=[{'all':!![]}];}return db[_0x6675('0x2b')][_0x6675('0x41')](_0x3b9b32);})['then'](function(_0x2171ba){_0x533ebf[_0x6675('0x42')]=_0x2171ba;return _0x533ebf;})['then'](respondWithFilteredResult(_0x454971,_0x3b9b32))[_0x6675('0x1d')](handleError(_0x454971,null));};exports[_0x6675('0x43')]=function(_0x498928,_0x7bae8b){var _0x2b45ec={'raw':!![],'where':{'id':_0x498928[_0x6675('0x44')]['id']}},_0x430e2c={};_0x430e2c['model']=_[_0x6675('0x32')](db[_0x6675('0x2b')][_0x6675('0x2c')]);_0x430e2c[_0x6675('0x31')]=_[_0x6675('0x32')](_0x498928[_0x6675('0x31')]);_0x430e2c[_0x6675('0x33')]=_[_0x6675('0x35')](_0x430e2c[_0x6675('0x2f')],_0x430e2c[_0x6675('0x31')]);_0x2b45ec[_0x6675('0x34')]=_[_0x6675('0x35')](_0x430e2c[_0x6675('0x2f')],qs[_0x6675('0x36')](_0x498928[_0x6675('0x31')][_0x6675('0x36')]));_0x2b45ec[_0x6675('0x34')]=_0x2b45ec['attributes'][_0x6675('0x37')]?_0x2b45ec[_0x6675('0x34')]:_0x430e2c[_0x6675('0x2f')];if(_0x498928[_0x6675('0x31')][_0x6675('0x40')]){_0x2b45ec[_0x6675('0x45')]=[{'all':!![]}];}_0x2b45ec=_[_0x6675('0x3e')]({},_0x2b45ec,_0x498928[_0x6675('0x46')]);return db[_0x6675('0x2b')][_0x6675('0x47')](_0x2b45ec)['then'](handleEntityNotFound(_0x7bae8b,null))['then'](respondWithResult(_0x7bae8b,null))[_0x6675('0x1d')](handleError(_0x7bae8b,null));};exports[_0x6675('0x25')]=function(_0x272543,_0xce3fdd){if(_0x272543['body']['id']){delete _0x272543[_0x6675('0x48')]['id'];}return db['MailMessage'][_0x6675('0x47')]({'where':{'id':_0x272543[_0x6675('0x44')]['id']}})['then'](handleEntityNotFound(_0xce3fdd,null))['then'](saveUpdates(_0x272543[_0x6675('0x48')],null))[_0x6675('0x13')](respondWithResult(_0xce3fdd,null))[_0x6675('0x1d')](handleError(_0xce3fdd,null));};exports[_0x6675('0x26')]=function(_0xebf98d,_0x21a3be){return db[_0x6675('0x2b')][_0x6675('0x47')]({'where':{'id':_0xebf98d[_0x6675('0x44')]['id']}})[_0x6675('0x13')](handleEntityNotFound(_0x21a3be,null))[_0x6675('0x13')](removeEntity(_0x21a3be,null))[_0x6675('0x1d')](handleError(_0x21a3be,null));};exports['describe']=function(_0x4275fa,_0x364cc2){return db[_0x6675('0x2b')][_0x6675('0x49')]()[_0x6675('0x13')](respondWithResult(_0x364cc2,null))['catch'](handleError(_0x364cc2,null));};exports[_0x6675('0x4a')]=function(_0x44f1f0,_0x2331e8){return db['MailMessage'][_0x6675('0x4a')](_0x44f1f0[_0x6675('0x48')])[_0x6675('0x13')](function(_0x242a79){if(_0x242a79){if(_0x242a79['direction']===_0x6675('0x4b')&&!_0x242a79[_0x6675('0x4c')]){var _0x592c50,_0x30713d,_0x13b58d;if(_0x44f1f0[_0x6675('0x48')]['to']){_0x30713d=_0x44f1f0[_0x6675('0x48')]['to'][_0x6675('0x4d')](',')[0x0];}return db[_0x6675('0x4e')]['findOne']({'where':{'id':_0x242a79[_0x6675('0x4f')]},'include':[{'model':db[_0x6675('0x50')],'as':_0x6675('0x51'),'include':[{'model':db[_0x6675('0x52')],'as':_0x6675('0x53'),'where':{'email':_0x30713d},'limit':0x1,'order':[[_0x6675('0x54'),'DESC']]}]},{'model':db[_0x6675('0x55')],'as':_0x6675('0x56'),'raw':!![],'include':[{'model':db[_0x6675('0x57')],'as':_0x6675('0x57'),'raw':!![]}]}]})[_0x6675('0x13')](function(_0x1b956c){_0x592c50=_0x1b956c;if(!_0x592c50||!_0x592c50[_0x6675('0x56')])return;var _0x3cdaa9=_0x592c50[_0x6675('0x58')]();if(_0x44f1f0[_0x6675('0x48')][_0x6675('0x59')]&&_0x44f1f0[_0x6675('0x48')][_0x6675('0x59')]['length']){for(var _0x125cdd=0x0;_0x125cdd<_0x44f1f0[_0x6675('0x48')]['attachments'][_0x6675('0x37')];_0x125cdd+=0x1){_0x44f1f0[_0x6675('0x48')][_0x6675('0x59')][_0x125cdd]={'filename':_0x44f1f0[_0x6675('0x48')][_0x6675('0x59')][_0x125cdd][_0x6675('0x2a')],'path':path[_0x6675('0x5a')](config[_0x6675('0x5b')],'server/files/attachments',_0x44f1f0['body'][_0x6675('0x59')][_0x125cdd]['basename'])};}}_0x13b58d={'account':_0x3cdaa9,'message':_0x44f1f0['body']};return;})[_0x6675('0x13')](function(){if(_0x592c50[_0x6675('0x51')]){if(_0x592c50[_0x6675('0x51')][_0x6675('0x53')][_0x6675('0x37')]){return _0x592c50[_0x6675('0x51')][_0x6675('0x53')][0x0];}else{return db[_0x6675('0x52')]['create'](_[_0x6675('0xb')](_0x44f1f0['body'],{'firstName':_0x44f1f0[_0x6675('0x48')]['to'],'email':_0x44f1f0[_0x6675('0x48')]['to'],'phone':_0x44f1f0[_0x6675('0x48')]['to'],'ListId':_0x592c50[_0x6675('0x5c')]}));}}else{throw new Error(_0x6675('0x5d'));}})[_0x6675('0x13')](function(){if(_0x13b58d){return respondWithRpcPromise('SendMail',_0x6675('0x5e'),_0x13b58d,client9003)[_0x6675('0x13')](function(_0x27852f){return _0x242a79[_0x6675('0x25')]({'read':!![],'messageId':_0x27852f[_0x6675('0x5f')],'sentAt':moment()[_0x6675('0x60')](_0x6675('0x61'))});})[_0x6675('0x1d')](function(_0x575ec4){logger['error']('%s',JSON[_0x6675('0x62')](_0x575ec4));return _0x242a79;});}return _0x242a79;});}return _0x242a79;}})[_0x6675('0x13')](respondWithResult(_0x2331e8,0xc9))[_0x6675('0x1d')](handleError(_0x2331e8,null));};exports['accept']=function(_0x57a635,_0x2f0c02){var _0x5278c8={'agent':{},'channel':'mail'};if(_0x57a635[_0x6675('0x48')]['id']){delete _0x57a635[_0x6675('0x48')]['id'];}_0x57a635['body']['read']=!![];_0x57a635[_0x6675('0x48')][_0x6675('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x57a635[_0x6675('0x48')]['UserId']=_0x57a635[_0x6675('0x48')]['UserId']||_0x57a635[_0x6675('0x64')]['id'];_0x5278c8[_0x6675('0x65')]['id']=_0x57a635['body']['UserId'];return db['MailMessage'][_0x6675('0x47')]({'where':{'id':_0x57a635[_0x6675('0x44')]['id'],'UserId':null}})[_0x6675('0x13')](handleEntityNotFound(_0x2f0c02,null))[_0x6675('0x13')](saveUpdates(_0x57a635[_0x6675('0x48')],null))[_0x6675('0x13')](function(_0x3135ef){if(_0x3135ef){_0x5278c8['message']=_0x3135ef[_0x6675('0x66')]({'plain':!![]});return db[_0x6675('0x67')][_0x6675('0x47')]({'where':{'id':_0x3135ef['MailInteractionId']}});}return null;})[_0x6675('0x13')](handleEntityNotFound(_0x2f0c02,null))[_0x6675('0x13')](function(_0x2c44e4){if(_0x2c44e4){return _0x2c44e4[_0x6675('0x25')]({'UserId':_0x57a635[_0x6675('0x48')][_0x6675('0x68')],'read1stAt':_['isNil'](_0x2c44e4[_0x6675('0x69')])?moment()[_0x6675('0x60')](_0x6675('0x61')):undefined});}return null;})[_0x6675('0x13')](function(_0x5aad90){if(_0x5aad90){_0x5278c8[_0x6675('0x6a')]=_0x5aad90[_0x6675('0x66')]({'plain':!![]});interaction_log[_0x6675('0x1b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57a635['user']['id'],_0x57a635[_0x6675('0x64')]['name'],_0x57a635[_0x6675('0x64')][_0x6675('0x6b')],_0x5278c8[_0x6675('0x6a')]['id'],_0x57a635[_0x6675('0x48')]?JSON[_0x6675('0x62')](_0x57a635['body']):_0x6675('0x6c'));return respondWithRpcPromise(_0x6675('0x6d'),'acceptMessage',_0x5278c8);}return null;})['then'](function(_0x497b83){var _0x24b7ad=_0x6675('0x6e')+_0x497b83['message'][_0x6675('0x6f')];return db[_0x6675('0x70')][_0x6675('0x31')](_0x24b7ad,{'type':db[_0x6675('0x71')][_0x6675('0x72')][_0x6675('0x73')],'raw':!![]})[_0x6675('0x13')](function(_0x18312a){return _0x18312a;});})[_0x6675('0x13')](function(_0x3f5003){if(_0x3f5003){_0x5278c8['message'][_0x6675('0x74')]=_0x3f5003[0x0];if(!_0x57a635[_0x6675('0x48')][_0x6675('0x68')])return;return db[_0x6675('0x75')][_0x6675('0x47')]({'where':{'id':_0x57a635[_0x6675('0x48')][_0x6675('0x68')],'role':_0x6675('0x65')},'attributes':['id',_0x6675('0x2a'),_0x6675('0x76'),_0x6675('0x77'),_0x6675('0x78')],'raw':!![]});}return null;})[_0x6675('0x13')](function(_0xee5cee){if(!_0xee5cee)return null;_0x5278c8[_0x6675('0x19')][_0x6675('0x65')]=_0xee5cee;return _0x5278c8;})[_0x6675('0x13')](function(_0x3f5dd3){if(_0x3f5dd3){if(_0x57a635[_0x6675('0x48')]['manual']){_0x5278c8[_0x6675('0x19')]['interface']=util[_0x6675('0x60')](_0x6675('0x79'),_0x57a635[_0x6675('0x64')][_0x6675('0x2a')]);_0x5278c8['message'][_0x6675('0x7a')]=_0x5278c8[_0x6675('0x7a')];_0x5278c8['message'][_0x6675('0x7b')]=_0x5278c8['channel'];_0x5278c8['message']['event']=_0x6675('0x7c');_0x5278c8['message'][_0x6675('0x48')]=htmlToText[_0x6675('0x7d')](_0x5278c8[_0x6675('0x19')][_0x6675('0x48')]);return respondWithRpcPromise(_0x6675('0x7e'),_0x6675('0x7e'),{'event':_0x6675('0x7f'),'message':_0x5278c8[_0x6675('0x19')]},client9002)[_0x6675('0x13')](function(){return _0x5278c8;});}return _0x5278c8;}return null;})[_0x6675('0x13')](respondWithResult(_0x2f0c02,null))[_0x6675('0x1d')](handleError(_0x2f0c02,null));};exports['reject']=function(_0x46be33,_0x5f2d90){var _0x387e15={'agent':{},'channel':'mail'};if(_0x46be33[_0x6675('0x48')]['id']){delete _0x46be33[_0x6675('0x48')]['id'];}_0x46be33[_0x6675('0x48')]['UserId']=_0x46be33[_0x6675('0x48')][_0x6675('0x68')]||_0x46be33[_0x6675('0x64')]['id'];_0x387e15[_0x6675('0x65')]['id']=_0x46be33[_0x6675('0x48')]['UserId'];return db['MailMessage'][_0x6675('0x47')]({'where':{'id':_0x46be33[_0x6675('0x44')]['id'],'UserId':null}})[_0x6675('0x13')](handleEntityNotFound(_0x5f2d90,null))[_0x6675('0x13')](function(_0x568ab7){if(_0x568ab7){_0x387e15[_0x6675('0x19')]=_0x568ab7['get']({'plain':!![]});return db[_0x6675('0x67')][_0x6675('0x47')]({'where':{'id':_0x568ab7[_0x6675('0x80')]}});}return null;})[_0x6675('0x13')](handleEntityNotFound(_0x5f2d90,null))[_0x6675('0x13')](function(_0x1edfda){if(_0x1edfda){_0x387e15[_0x6675('0x6a')]=_0x1edfda[_0x6675('0x66')]({'plain':!![]});interaction_log[_0x6675('0x1b')](_0x6675('0x81'),_0x46be33[_0x6675('0x64')]['id'],_0x46be33[_0x6675('0x64')][_0x6675('0x2a')],_0x46be33[_0x6675('0x64')][_0x6675('0x6b')],_0x387e15[_0x6675('0x6a')]['id'],_0x46be33['body']?JSON[_0x6675('0x62')](_0x46be33['body']):_0x6675('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x387e15);}return null;})[_0x6675('0x13')](function(_0x20d2a0){var _0x481d00=_0x6675('0x6e')+_0x20d2a0[_0x6675('0x19')]['ContactId'];return db[_0x6675('0x70')][_0x6675('0x31')](_0x481d00,{'type':db[_0x6675('0x71')][_0x6675('0x72')][_0x6675('0x73')],'raw':!![]})[_0x6675('0x13')](function(_0x589b5a){return _0x589b5a;});})['then'](function(_0x201c54){if(_0x201c54){_0x387e15['message'][_0x6675('0x74')]=_0x201c54[0x0];if(!_0x46be33[_0x6675('0x48')]['UserId'])return;return db['User']['find']({'where':{'id':_0x46be33[_0x6675('0x48')][_0x6675('0x68')],'role':_0x6675('0x65')},'attributes':['id',_0x6675('0x2a'),_0x6675('0x76'),'email',_0x6675('0x78')],'raw':!![]});}return null;})['then'](function(_0x58760a){if(!_0x58760a)return null;_0x387e15[_0x6675('0x19')]['agent']=_0x58760a;return _0x387e15;})[_0x6675('0x13')](function(_0x44a978){if(_0x44a978){_0x44a978['message'][_0x6675('0x82')]=util[_0x6675('0x60')](_0x6675('0x79'),_0x46be33['user'][_0x6675('0x2a')]);_0x44a978[_0x6675('0x19')][_0x6675('0x7a')]=_0x387e15[_0x6675('0x7a')];_0x44a978[_0x6675('0x19')][_0x6675('0x7b')]=_0x387e15[_0x6675('0x7a')];_0x44a978[_0x6675('0x19')][_0x6675('0x83')]=_0x6675('0x84');_0x44a978[_0x6675('0x19')][_0x6675('0x48')]=htmlToText[_0x6675('0x7d')](_0x387e15[_0x6675('0x19')][_0x6675('0x48')]);respondWithRpcPromise(_0x6675('0x7e'),'EventManager',{'event':'rejectmessage','message':_0x44a978[_0x6675('0x19')]},client9002);return _0x387e15;}return null;})['then'](respondWithResult(_0x5f2d90,null))[_0x6675('0x1d')](handleError(_0x5f2d90,null));};exports[_0x6675('0x85')]=function(_0x5e3bcd,_0x329105){var _0x252ecb=moment()['unix']()[_0x6675('0x86')]();var _0x3f27c4=path[_0x6675('0x5a')](config[_0x6675('0x5b')],_0x6675('0x87'),_0x6675('0x88'),_0x6675('0x89'));var _0x362070=path['join'](config['root'],_0x6675('0x87'),_0x6675('0x88'),_0x6675('0x59'));var _0x113ab5=util['format'](_0x6675('0x8a'),_0x252ecb);return db['MailMessage'][_0x6675('0x47')]({'where':{'id':_0x5e3bcd[_0x6675('0x44')]['id']},'attributes':['id','body','from','to','cc','bcc',_0x6675('0x8b'),_0x6675('0x8c')],'include':_0x5e3bcd[_0x6675('0x31')][_0x6675('0x59')]?[{'model':db[_0x6675('0x8d')],'as':_0x6675('0x8e')}]:undefined})[_0x6675('0x13')](handleEntityNotFound(_0x329105,null))['then'](function(_0x50509b){if(_0x50509b){var _0x33e98a=_0x50509b;var _0x492499={'from':_0x33e98a[_0x6675('0x8f')],'to':_0x33e98a['to'],'subject':_0x33e98a[_0x6675('0x8b')],'html':htmlEntities[_0x6675('0x90')](_0x33e98a[_0x6675('0x48')]),'headers':{'Date':moment(_0x33e98a['createdAt'])[_0x6675('0x60')](_0x6675('0x91'))},'attachments':[]};if(_0x50509b['cc']){_0x492499['headers']['Cc']=_0x50509b['cc'];}if(_0x50509b['bcc']){_0x492499[_0x6675('0x92')][_0x6675('0x93')]=_0x50509b['bcc'];}return new BPromise(function(_0x182a65,_0x36cbd3){if(_0x50509b[_0x6675('0x8e')]){for(var _0x1538ce=0x0;_0x1538ce<_0x50509b[_0x6675('0x8e')]['length'];_0x1538ce++){var _0x562398=_0x50509b['Attachments'][_0x1538ce];var _0x288d4d=path[_0x6675('0x5a')](_0x362070,_0x562398['basename']);if(fs[_0x6675('0x94')](_0x288d4d)){_0x492499[_0x6675('0x59')]['push']({'name':_0x562398[_0x6675('0x2a')],'contentType':_0x562398[_0x6675('0x2e')],'data':fs[_0x6675('0x95')](_0x288d4d)});}}}emlformat[_0x6675('0x96')](_0x492499,function(_0x5e67ef,_0x225dae){if(_0x5e67ef)return _0x36cbd3(_0x5e67ef);fs[_0x6675('0x97')](path[_0x6675('0x5a')](_0x3f27c4,_0x113ab5),_0x225dae);return _0x182a65(_0x225dae);});});}})[_0x6675('0x13')](function(_0x31e454){if(_0x31e454){return _0x329105[_0x6675('0x85')](path['join'](_0x3f27c4,_0x113ab5),_0x113ab5,function(_0x36f3a5){if(!_0x36f3a5)fs[_0x6675('0x98')](path[_0x6675('0x5a')](_0x3f27c4,_0x113ab5));});}})['catch'](handleError(_0x329105,null));}; \ No newline at end of file +var _0x5305=['DESC','MailServerOut','Smtp','getSmtpOptions','attachments','server/files/attachments','basename','Contacts','ListId','SendMail','sendMail','update','messageId','accept','mail','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','MailInteractionId','isNil','read1stAt','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','channel','motionChannel','fromString','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','sequelize','email','SIP/%s','event','download','unix','toString','join','server','files','tmp','from','bcc','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','offset','undefined','count','limit','Content-Range','json','destroy','then','end','stack','name','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','merge','options','MailMessage','findAll','show','params','rawAttributes','includeAll','include','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt'];(function(_0x148bf9,_0x59d684){var _0x56ccf0=function(_0x4fc7d2){while(--_0x4fc7d2){_0x148bf9['push'](_0x148bf9['shift']());}};_0x56ccf0(++_0x59d684);}(_0x5305,0xe6));var _0x5530=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5305[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5530('0x0'));var moment=require(_0x5530('0x1'));var BPromise=require(_0x5530('0x2'));var util=require(_0x5530('0x3'));var path=require(_0x5530('0x4'));var fs=require('fs');var _=require(_0x5530('0x5'));var Redis=require(_0x5530('0x6'));var htmlToText=require(_0x5530('0x7'));var qs=require(_0x5530('0x8'));var logger=require(_0x5530('0x9'))(_0x5530('0xa'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x5530('0xb'));var db=require(_0x5530('0xc'))['db'];config[_0x5530('0xd')]=_[_0x5530('0xe')](config[_0x5530('0xd')],{'host':_0x5530('0xf'),'port':0x18eb});var socket=require(_0x5530('0x10'))(new Redis(config['redis']));var htmlEntities=require(_0x5530('0x11'));require(_0x5530('0x12'))[_0x5530('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5530('0x14')]({'port':0x232c});var client9003=jayson[_0x5530('0x15')][_0x5530('0x14')]({'port':0x232b});var client9002=jayson[_0x5530('0x15')][_0x5530('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4d1f53,_0x1456d9,_0x5e1913,_0x2cef96){return new BPromise(function(_0x3c9529,_0x5d4844){var _0x1244fc=_0x2cef96||client;return _0x1244fc['request'](_0x4d1f53,_0x5e1913)['then'](function(_0x45d01d){logger[_0x5530('0x16')](_0x5530('0x17'),_0x1456d9,'request\x20sent');logger[_0x5530('0x18')](_0x5530('0x19'),_0x1456d9,'request\x20sent',JSON[_0x5530('0x1a')](_0x45d01d));if(_0x45d01d[_0x5530('0x1b')]){if(_0x45d01d[_0x5530('0x1b')][_0x5530('0x1c')]===0x1f4){logger[_0x5530('0x1b')]('MailMessage,\x20%s,\x20%s',_0x1456d9,_0x45d01d[_0x5530('0x1b')][_0x5530('0x1d')]);return _0x5d4844(_0x45d01d[_0x5530('0x1b')][_0x5530('0x1d')]);}logger[_0x5530('0x1b')](_0x5530('0x17'),_0x1456d9,_0x45d01d['error'][_0x5530('0x1d')]);return _0x3c9529(_0x45d01d[_0x5530('0x1b')][_0x5530('0x1d')]);}else{logger[_0x5530('0x16')](_0x5530('0x17'),_0x1456d9,_0x5530('0x1e'));_0x3c9529(_0x45d01d[_0x5530('0x1f')][_0x5530('0x1d')]);}})[_0x5530('0x20')](function(_0x11470d){logger[_0x5530('0x1b')](_0x5530('0x17'),_0x1456d9,_0x11470d);_0x5d4844(_0x11470d);});});}function respondWithResult(_0x3fb785,_0x36ba5){_0x36ba5=_0x36ba5||0xc8;return function(_0xdabbb8){if(_0xdabbb8){return _0x3fb785[_0x5530('0x21')](_0x36ba5)['json'](_0xdabbb8);}};}function respondWithFilteredResult(_0x314682,_0x466304){return function(_0x374c17){if(_0x374c17){var _0x21d6b6=typeof _0x466304[_0x5530('0x22')]===_0x5530('0x23')&&typeof _0x466304['limit']===_0x5530('0x23');var _0x6c1fdc=_0x374c17[_0x5530('0x24')];var _0x43dacc=_0x21d6b6?0x0:_0x466304[_0x5530('0x22')];var _0x370723=_0x21d6b6?_0x374c17[_0x5530('0x24')]:_0x466304[_0x5530('0x22')]+_0x466304[_0x5530('0x25')];var _0x1321ec;if(_0x370723>=_0x6c1fdc){_0x370723=_0x6c1fdc;_0x1321ec=0xc8;}else{_0x1321ec=0xce;}_0x314682[_0x5530('0x21')](_0x1321ec);return _0x314682['set'](_0x5530('0x26'),_0x43dacc+'-'+_0x370723+'/'+_0x6c1fdc)[_0x5530('0x27')](_0x374c17);}return null;};}function saveUpdates(_0x2e2b4e){return function(_0x24b018){if(_0x24b018){return _0x24b018['update'](_0x2e2b4e)['then'](function(_0x3922f3){return _0x3922f3;});}return null;};}function removeEntity(_0x5c30f0){return function(_0x3731c7){if(_0x3731c7){return _0x3731c7[_0x5530('0x28')]()[_0x5530('0x29')](function(){_0x5c30f0['status'](0xcc)[_0x5530('0x2a')]();});}};}function handleEntityNotFound(_0x4563e7){return function(_0x4824e7){if(!_0x4824e7){_0x4563e7['sendStatus'](0x194);}return _0x4824e7;};}function handleError(_0x5f53fd,_0x36d0f4){_0x36d0f4=_0x36d0f4||0x1f4;return function(_0xb67b3e){logger['error'](_0xb67b3e[_0x5530('0x2b')]);if(_0xb67b3e[_0x5530('0x2c')]){delete _0xb67b3e[_0x5530('0x2c')];}_0x5f53fd['status'](_0x36d0f4)['send'](_0xb67b3e);};}exports['index']=function(_0x1cf582,_0x452bd2){var _0x35cdde={},_0x39114e={},_0x444cb6={'count':0x0,'rows':[]};var _0x416220=_[_0x5530('0x2d')](db['MailMessage']['rawAttributes'],function(_0x5c65c6){return{'name':_0x5c65c6[_0x5530('0x2e')],'type':_0x5c65c6[_0x5530('0x2f')][_0x5530('0x30')]};});_0x39114e[_0x5530('0x31')]=_['map'](_0x416220,_0x5530('0x2c'));_0x39114e[_0x5530('0x32')]=_[_0x5530('0x33')](_0x1cf582['query']);_0x39114e['filters']=_[_0x5530('0x34')](_0x39114e[_0x5530('0x31')],_0x39114e[_0x5530('0x32')]);_0x35cdde[_0x5530('0x35')]=_[_0x5530('0x34')](_0x39114e[_0x5530('0x31')],qs[_0x5530('0x36')](_0x1cf582['query'][_0x5530('0x36')]));_0x35cdde['attributes']=_0x35cdde[_0x5530('0x35')][_0x5530('0x37')]?_0x35cdde[_0x5530('0x35')]:_0x39114e[_0x5530('0x31')];if(!_0x1cf582[_0x5530('0x32')][_0x5530('0x38')](_0x5530('0x39'))){_0x35cdde[_0x5530('0x25')]=qs[_0x5530('0x25')](_0x1cf582[_0x5530('0x32')][_0x5530('0x25')]);_0x35cdde[_0x5530('0x22')]=qs['offset'](_0x1cf582['query']['offset']);}_0x35cdde[_0x5530('0x3a')]=qs[_0x5530('0x3b')](_0x1cf582[_0x5530('0x32')][_0x5530('0x3b')]);_0x35cdde['where']=qs[_0x5530('0x3c')](_['pick'](_0x1cf582[_0x5530('0x32')],_0x39114e['filters']),_0x416220);if(_0x1cf582[_0x5530('0x32')]['filter']){_0x35cdde[_0x5530('0x3d')]=_['merge'](_0x35cdde[_0x5530('0x3d')],{'$or':_[_0x5530('0x2d')](_0x416220,function(_0x34821e){if(_0x34821e[_0x5530('0x2f')]!==_0x5530('0x3e')){var _0x2e35e5={};_0x2e35e5[_0x34821e[_0x5530('0x2c')]]={'$like':'%'+_0x1cf582[_0x5530('0x32')][_0x5530('0x3f')]+'%'};return _0x2e35e5;}})});}_0x35cdde=_[_0x5530('0x40')]({},_0x35cdde,_0x1cf582[_0x5530('0x41')]);var _0x3b233b={'where':_0x35cdde[_0x5530('0x3d')]};return db[_0x5530('0x42')][_0x5530('0x24')](_0x3b233b)[_0x5530('0x29')](function(_0x4e6798){_0x444cb6[_0x5530('0x24')]=_0x4e6798;if(_0x1cf582[_0x5530('0x32')]['includeAll']){_0x35cdde['include']=[{'all':!![]}];}return db[_0x5530('0x42')][_0x5530('0x43')](_0x35cdde);})['then'](function(_0x1d0d58){_0x444cb6['rows']=_0x1d0d58;return _0x444cb6;})[_0x5530('0x29')](respondWithFilteredResult(_0x452bd2,_0x35cdde))['catch'](handleError(_0x452bd2,null));};exports[_0x5530('0x44')]=function(_0x31c880,_0x4dcf95){var _0x5d56ca={'raw':!![],'where':{'id':_0x31c880[_0x5530('0x45')]['id']}},_0x51d45f={};_0x51d45f[_0x5530('0x31')]=_[_0x5530('0x33')](db[_0x5530('0x42')][_0x5530('0x46')]);_0x51d45f[_0x5530('0x32')]=_[_0x5530('0x33')](_0x31c880[_0x5530('0x32')]);_0x51d45f[_0x5530('0x3c')]=_['intersection'](_0x51d45f['model'],_0x51d45f[_0x5530('0x32')]);_0x5d56ca[_0x5530('0x35')]=_[_0x5530('0x34')](_0x51d45f['model'],qs[_0x5530('0x36')](_0x31c880['query'][_0x5530('0x36')]));_0x5d56ca[_0x5530('0x35')]=_0x5d56ca[_0x5530('0x35')][_0x5530('0x37')]?_0x5d56ca['attributes']:_0x51d45f['model'];if(_0x31c880[_0x5530('0x32')][_0x5530('0x47')]){_0x5d56ca[_0x5530('0x48')]=[{'all':!![]}];}_0x5d56ca=_[_0x5530('0x40')]({},_0x5d56ca,_0x31c880[_0x5530('0x41')]);return db[_0x5530('0x42')]['find'](_0x5d56ca)['then'](handleEntityNotFound(_0x4dcf95,null))['then'](respondWithResult(_0x4dcf95,null))[_0x5530('0x20')](handleError(_0x4dcf95,null));};exports['update']=function(_0x218fcb,_0x217f69){if(_0x218fcb[_0x5530('0x49')]['id']){delete _0x218fcb[_0x5530('0x49')]['id'];}return db[_0x5530('0x42')][_0x5530('0x4a')]({'where':{'id':_0x218fcb[_0x5530('0x45')]['id']}})[_0x5530('0x29')](handleEntityNotFound(_0x217f69,null))[_0x5530('0x29')](saveUpdates(_0x218fcb[_0x5530('0x49')],null))[_0x5530('0x29')](respondWithResult(_0x217f69,null))[_0x5530('0x20')](handleError(_0x217f69,null));};exports[_0x5530('0x28')]=function(_0x50170c,_0x376c4f){return db[_0x5530('0x42')]['find']({'where':{'id':_0x50170c[_0x5530('0x45')]['id']}})['then'](handleEntityNotFound(_0x376c4f,null))[_0x5530('0x29')](removeEntity(_0x376c4f,null))[_0x5530('0x20')](handleError(_0x376c4f,null));};exports[_0x5530('0x4b')]=function(_0x39514c,_0x511f0d){return db[_0x5530('0x42')][_0x5530('0x4b')]()['then'](respondWithResult(_0x511f0d,null))[_0x5530('0x20')](handleError(_0x511f0d,null));};exports[_0x5530('0x4c')]=function(_0x268f55,_0x313db8){return db['MailMessage'][_0x5530('0x4c')](_0x268f55[_0x5530('0x49')])[_0x5530('0x29')](function(_0x3cc819){if(_0x3cc819){if(_0x3cc819[_0x5530('0x4d')]===_0x5530('0x4e')&&!_0x3cc819[_0x5530('0x4f')]){var _0x12df74,_0x314281,_0x1bdb4b;if(_0x268f55[_0x5530('0x49')]['to']){_0x314281=_0x268f55[_0x5530('0x49')]['to'][_0x5530('0x50')](',')[0x0];}return db[_0x5530('0x51')][_0x5530('0x52')]({'where':{'id':_0x3cc819[_0x5530('0x53')]},'include':[{'model':db[_0x5530('0x54')],'as':_0x5530('0x55'),'include':[{'model':db[_0x5530('0x56')],'as':'Contacts','where':{'email':_0x314281},'limit':0x1,'order':[[_0x5530('0x57'),_0x5530('0x58')]]}]},{'model':db[_0x5530('0x59')],'as':_0x5530('0x5a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x5530('0x29')](function(_0x4dc264){_0x12df74=_0x4dc264;if(!_0x12df74||!_0x12df74[_0x5530('0x5a')])return;var _0x46bf77=_0x12df74[_0x5530('0x5b')]();if(_0x268f55[_0x5530('0x49')][_0x5530('0x5c')]&&_0x268f55[_0x5530('0x49')][_0x5530('0x5c')]['length']){for(var _0x617381=0x0;_0x617381<_0x268f55[_0x5530('0x49')][_0x5530('0x5c')][_0x5530('0x37')];_0x617381+=0x1){_0x268f55[_0x5530('0x49')][_0x5530('0x5c')][_0x617381]={'filename':_0x268f55['body'][_0x5530('0x5c')][_0x617381][_0x5530('0x2c')],'path':path['join'](config['root'],_0x5530('0x5d'),_0x268f55[_0x5530('0x49')][_0x5530('0x5c')][_0x617381][_0x5530('0x5e')])};}}_0x1bdb4b={'account':_0x46bf77,'message':_0x268f55[_0x5530('0x49')]};return;})['then'](function(){if(_0x12df74[_0x5530('0x55')]){if(_0x12df74['List'][_0x5530('0x5f')][_0x5530('0x37')]){return _0x12df74['List'][_0x5530('0x5f')][0x0];}else{return db[_0x5530('0x56')][_0x5530('0x4c')](_[_0x5530('0xe')](_0x268f55[_0x5530('0x49')],{'firstName':_0x268f55[_0x5530('0x49')]['to'],'email':_0x268f55[_0x5530('0x49')]['to'],'phone':_0x268f55['body']['to'],'ListId':_0x12df74[_0x5530('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x1bdb4b){return respondWithRpcPromise(_0x5530('0x61'),_0x5530('0x62'),_0x1bdb4b,client9003)[_0x5530('0x29')](function(_0x3cd055){return _0x3cc819[_0x5530('0x63')]({'read':!![],'messageId':_0x3cd055[_0x5530('0x64')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5530('0x20')](function(_0x434eca){logger['error']('%s',JSON[_0x5530('0x1a')](_0x434eca));return _0x3cc819;});}return _0x3cc819;});}return _0x3cc819;}})['then'](respondWithResult(_0x313db8,0xc9))[_0x5530('0x20')](handleError(_0x313db8,null));};exports[_0x5530('0x65')]=function(_0x556a10,_0x19ed20){var _0x3f7942={'agent':{},'channel':_0x5530('0x66')};if(_0x556a10['body']['id']){delete _0x556a10[_0x5530('0x49')]['id'];}_0x556a10[_0x5530('0x49')][_0x5530('0x67')]=!![];_0x556a10[_0x5530('0x49')][_0x5530('0x68')]=moment()[_0x5530('0x69')](_0x5530('0x6a'));_0x556a10[_0x5530('0x49')]['UserId']=_0x556a10[_0x5530('0x49')]['UserId']||_0x556a10[_0x5530('0x6b')]['id'];_0x3f7942['agent']['id']=_0x556a10['body'][_0x5530('0x6c')];return db[_0x5530('0x42')][_0x5530('0x4a')]({'where':{'id':_0x556a10[_0x5530('0x45')]['id'],'UserId':null}})[_0x5530('0x29')](handleEntityNotFound(_0x19ed20,null))['then'](saveUpdates(_0x556a10[_0x5530('0x49')],null))[_0x5530('0x29')](function(_0x3f55c7){if(_0x3f55c7){_0x3f7942['message']=_0x3f55c7[_0x5530('0x6d')]({'plain':!![]});return db['MailInteraction'][_0x5530('0x4a')]({'where':{'id':_0x3f55c7[_0x5530('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x19ed20,null))['then'](function(_0x312079){if(_0x312079){return _0x312079[_0x5530('0x63')]({'UserId':_0x556a10[_0x5530('0x49')][_0x5530('0x6c')],'read1stAt':_[_0x5530('0x6f')](_0x312079[_0x5530('0x70')])?moment()[_0x5530('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5530('0x29')](function(_0x543e9){if(_0x543e9){_0x3f7942['interaction']=_0x543e9[_0x5530('0x6d')]({'plain':!![]});interaction_log[_0x5530('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x556a10[_0x5530('0x6b')]['id'],_0x556a10[_0x5530('0x6b')][_0x5530('0x2c')],_0x556a10['user']['role'],_0x3f7942[_0x5530('0x71')]['id'],_0x556a10[_0x5530('0x49')]?JSON[_0x5530('0x1a')](_0x556a10['body']):_0x5530('0x72'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3f7942);}return null;})['then'](function(_0x4571ae){var _0x4b70f0=_0x5530('0x73')+_0x4571ae[_0x5530('0x1d')][_0x5530('0x74')];return db['sequelize'][_0x5530('0x32')](_0x4b70f0,{'type':db[_0x5530('0x75')][_0x5530('0x76')][_0x5530('0x77')],'raw':!![]})['then'](function(_0x5c046d){return _0x5c046d;});})[_0x5530('0x29')](function(_0x3a36fc){if(_0x3a36fc){_0x3f7942[_0x5530('0x1d')][_0x5530('0x78')]=_0x3a36fc[0x0];if(!_0x556a10[_0x5530('0x49')][_0x5530('0x6c')])return;return db[_0x5530('0x79')][_0x5530('0x4a')]({'where':{'id':_0x556a10[_0x5530('0x49')][_0x5530('0x6c')],'role':_0x5530('0x7a')},'attributes':['id','name',_0x5530('0x7b'),'email',_0x5530('0x7c')],'raw':!![]});}return null;})['then'](function(_0x4e52c5){if(!_0x4e52c5)return null;_0x3f7942[_0x5530('0x1d')][_0x5530('0x7a')]=_0x4e52c5;return _0x3f7942;})['then'](function(_0x5b9d88){if(_0x5b9d88){if(_0x556a10['body'][_0x5530('0x7d')]){_0x3f7942['message']['interface']=util['format']('SIP/%s',_0x556a10[_0x5530('0x6b')][_0x5530('0x2c')]);_0x3f7942[_0x5530('0x1d')][_0x5530('0x7e')]=_0x3f7942[_0x5530('0x7e')];_0x3f7942[_0x5530('0x1d')][_0x5530('0x7f')]=_0x3f7942[_0x5530('0x7e')];_0x3f7942['message']['event']='accept';_0x3f7942['message'][_0x5530('0x49')]=htmlToText[_0x5530('0x80')](_0x3f7942[_0x5530('0x1d')]['body']);return respondWithRpcPromise(_0x5530('0x81'),_0x5530('0x81'),{'event':_0x5530('0x82'),'message':_0x3f7942[_0x5530('0x1d')]},client9002)[_0x5530('0x29')](function(){return _0x3f7942;});}return _0x3f7942;}return null;})['then'](respondWithResult(_0x19ed20,null))[_0x5530('0x20')](handleError(_0x19ed20,null));};exports['reject']=function(_0x3e2375,_0x40fdae){var _0x26de6d={'agent':{},'channel':'mail'};if(_0x3e2375['body']['id']){delete _0x3e2375[_0x5530('0x49')]['id'];}_0x3e2375[_0x5530('0x49')][_0x5530('0x6c')]=_0x3e2375['body'][_0x5530('0x6c')]||_0x3e2375[_0x5530('0x6b')]['id'];_0x26de6d['agent']['id']=_0x3e2375[_0x5530('0x49')]['UserId'];return db[_0x5530('0x42')][_0x5530('0x4a')]({'where':{'id':_0x3e2375['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40fdae,null))[_0x5530('0x29')](function(_0x30b047){if(_0x30b047){_0x26de6d[_0x5530('0x1d')]=_0x30b047['get']({'plain':!![]});return db[_0x5530('0x83')]['find']({'where':{'id':_0x30b047[_0x5530('0x6e')]}});}return null;})[_0x5530('0x29')](handleEntityNotFound(_0x40fdae,null))[_0x5530('0x29')](function(_0x176fdb){if(_0x176fdb){_0x26de6d['interaction']=_0x176fdb[_0x5530('0x6d')]({'plain':!![]});interaction_log['info'](_0x5530('0x84'),_0x3e2375[_0x5530('0x6b')]['id'],_0x3e2375[_0x5530('0x6b')]['name'],_0x3e2375[_0x5530('0x6b')][_0x5530('0x85')],_0x26de6d['interaction']['id'],_0x3e2375['body']?JSON[_0x5530('0x1a')](_0x3e2375['body']):_0x5530('0x72'));return respondWithRpcPromise('RejectMessage',_0x5530('0x86'),_0x26de6d);}return null;})[_0x5530('0x29')](function(_0x2f5a21){var _0x541bad='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f5a21[_0x5530('0x1d')]['ContactId'];return db[_0x5530('0x87')][_0x5530('0x32')](_0x541bad,{'type':db[_0x5530('0x75')][_0x5530('0x76')][_0x5530('0x77')],'raw':!![]})['then'](function(_0x231937){return _0x231937;});})[_0x5530('0x29')](function(_0x2f82ba){if(_0x2f82ba){_0x26de6d[_0x5530('0x1d')][_0x5530('0x78')]=_0x2f82ba[0x0];if(!_0x3e2375[_0x5530('0x49')]['UserId'])return;return db[_0x5530('0x79')][_0x5530('0x4a')]({'where':{'id':_0x3e2375[_0x5530('0x49')][_0x5530('0x6c')],'role':_0x5530('0x7a')},'attributes':['id',_0x5530('0x2c'),_0x5530('0x7b'),_0x5530('0x88'),_0x5530('0x7c')],'raw':!![]});}return null;})[_0x5530('0x29')](function(_0x4d2127){if(!_0x4d2127)return null;_0x26de6d[_0x5530('0x1d')]['agent']=_0x4d2127;return _0x26de6d;})[_0x5530('0x29')](function(_0x3822fd){if(_0x3822fd){_0x3822fd[_0x5530('0x1d')]['interface']=util['format'](_0x5530('0x89'),_0x3e2375[_0x5530('0x6b')]['name']);_0x3822fd[_0x5530('0x1d')][_0x5530('0x7e')]=_0x26de6d['channel'];_0x3822fd['message']['motionChannel']=_0x26de6d[_0x5530('0x7e')];_0x3822fd[_0x5530('0x1d')][_0x5530('0x8a')]='reject';_0x3822fd[_0x5530('0x1d')][_0x5530('0x49')]=htmlToText[_0x5530('0x80')](_0x26de6d[_0x5530('0x1d')][_0x5530('0x49')]);respondWithRpcPromise(_0x5530('0x81'),_0x5530('0x81'),{'event':'rejectmessage','message':_0x3822fd[_0x5530('0x1d')]},client9002);return _0x26de6d;}return null;})[_0x5530('0x29')](respondWithResult(_0x40fdae,null))[_0x5530('0x20')](handleError(_0x40fdae,null));};exports[_0x5530('0x8b')]=function(_0x55a179,_0x544996){var _0x1941d5=moment()[_0x5530('0x8c')]()[_0x5530('0x8d')]();var _0xffabe=path[_0x5530('0x8e')](config['root'],_0x5530('0x8f'),_0x5530('0x90'),_0x5530('0x91'));var _0x567a83=path[_0x5530('0x8e')](config['root'],_0x5530('0x8f'),_0x5530('0x90'),_0x5530('0x5c'));var _0x18c2b1=util[_0x5530('0x69')]('message-%s.eml',_0x1941d5);return db[_0x5530('0x42')]['find']({'where':{'id':_0x55a179[_0x5530('0x45')]['id']},'attributes':['id',_0x5530('0x49'),_0x5530('0x92'),'to','cc',_0x5530('0x93'),'subject','createdAt'],'include':_0x55a179[_0x5530('0x32')][_0x5530('0x5c')]?[{'model':db[_0x5530('0x94')],'as':_0x5530('0x95')}]:undefined})['then'](handleEntityNotFound(_0x544996,null))[_0x5530('0x29')](function(_0x5b762f){if(_0x5b762f){var _0x3ca3c5=_0x5b762f;var _0x3ac1a4={'from':_0x3ca3c5[_0x5530('0x92')],'to':_0x3ca3c5['to'],'subject':_0x3ca3c5[_0x5530('0x96')],'html':htmlEntities[_0x5530('0x97')](_0x3ca3c5[_0x5530('0x49')]),'headers':{'Date':moment(_0x3ca3c5['createdAt'])[_0x5530('0x69')](_0x5530('0x98'))},'attachments':[]};if(_0x5b762f['cc']){_0x3ac1a4[_0x5530('0x99')]['Cc']=_0x5b762f['cc'];}if(_0x5b762f[_0x5530('0x93')]){_0x3ac1a4['headers']['Bcc']=_0x5b762f[_0x5530('0x93')];}return new BPromise(function(_0x1db60f,_0x10e8dc){if(_0x5b762f[_0x5530('0x95')]){for(var _0x145a86=0x0;_0x145a86<_0x5b762f[_0x5530('0x95')]['length'];_0x145a86++){var _0x45530d=_0x5b762f[_0x5530('0x95')][_0x145a86];var _0x450031=path['join'](_0x567a83,_0x45530d[_0x5530('0x5e')]);if(fs[_0x5530('0x9a')](_0x450031)){_0x3ac1a4[_0x5530('0x5c')][_0x5530('0x9b')]({'name':_0x45530d['name'],'contentType':_0x45530d['type'],'data':fs[_0x5530('0x9c')](_0x450031)});}}}emlformat[_0x5530('0x9d')](_0x3ac1a4,function(_0x26d036,_0x588bfe){if(_0x26d036)return _0x10e8dc(_0x26d036);fs['writeFileSync'](path[_0x5530('0x8e')](_0xffabe,_0x18c2b1),_0x588bfe);return _0x1db60f(_0x588bfe);});});}})[_0x5530('0x29')](function(_0x3a3048){if(_0x3a3048){return _0x544996[_0x5530('0x8b')](path[_0x5530('0x8e')](_0xffabe,_0x18c2b1),_0x18c2b1,function(_0x2e92c5){if(!_0x2e92c5)fs[_0x5530('0x9e')](path[_0x5530('0x8e')](_0xffabe,_0x18c2b1));});}})['catch'](handleError(_0x544996,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 94a34be..9847433 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 _0x5895=['emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1c0fc3,_0x3537bb){var _0x338237=function(_0x4ebb72){while(--_0x4ebb72){_0x1c0fc3['push'](_0x1c0fc3['shift']());}};_0x338237(++_0x3537bb);}(_0x5895,0xb2));var _0x5589=function(_0x561331,_0x483a41){_0x561331=_0x561331-0x0;var _0x584c7b=_0x5895[_0x561331];return _0x584c7b;};'use strict';var EventEmitter=require(_0x5589('0x0'));var MailMessage=require(_0x5589('0x1'))['db'][_0x5589('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5589('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x194ade){return function(_0x125bd5,_0x36b4bf,_0x4feea8){MailMessageEvents['emit'](_0x194ade+':'+_0x125bd5['id'],_0x125bd5);MailMessageEvents[_0x5589('0x4')](_0x194ade,_0x125bd5);_0x4feea8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x5589('0x5')](e,emitEvent(event));}}module[_0x5589('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x4b0e=['hook','exports','events','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3ca738,_0x19f67a){var _0x35d1f1=function(_0xb97525){while(--_0xb97525){_0x3ca738['push'](_0x3ca738['shift']());}};_0x35d1f1(++_0x19f67a);}(_0x4b0e,0x1a0));var _0xe4b0=function(_0x452209,_0x15ee11){_0x452209=_0x452209-0x0;var _0x32d028=_0x4b0e[_0x452209];return _0x32d028;};'use strict';var EventEmitter=require(_0xe4b0('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xe4b0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe4b0('0x2')](0x0);var events={'afterCreate':_0xe4b0('0x3'),'afterUpdate':'update','afterDestroy':_0xe4b0('0x4')};function emitEvent(_0x1bee6f){return function(_0x1bdfa7,_0x4173a9,_0x2d4e2b){MailMessageEvents[_0xe4b0('0x5')](_0x1bee6f+':'+_0x1bdfa7['id'],_0x1bdfa7);MailMessageEvents[_0xe4b0('0x5')](_0x1bee6f,_0x1bdfa7);_0x2d4e2b(null);};}for(var e in events){if(events[_0xe4b0('0x6')](e)){var event=events[e];MailMessage[_0xe4b0('0x7')](e,emitEvent(event));}}module[_0xe4b0('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f21407e..380f7b3 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 _0xe1f6=['request-promise','html-to-text','path','rimraf','exports','messageId','plainBody','subject','fromString','models','get','toLowerCase','secret','isNil','UserId','MailInteraction','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1c48a8,_0x3abc30){var _0x2e7e8e=function(_0x4a05fe){while(--_0x4a05fe){_0x1c48a8['push'](_0x1c48a8['shift']());}};_0x2e7e8e(++_0x3abc30);}(_0xe1f6,0xcc));var _0x6e1f=function(_0x565438,_0x52f592){_0x565438=_0x565438-0x0;var _0x2f3809=_0xe1f6[_0x565438];return _0x2f3809;};'use strict';var _=require(_0x6e1f('0x0'));var util=require(_0x6e1f('0x1'));var logger=require(_0x6e1f('0x2'))(_0x6e1f('0x3'));var moment=require(_0x6e1f('0x4'));var BPromise=require(_0x6e1f('0x5'));var rp=require(_0x6e1f('0x6'));var htmlToText=require(_0x6e1f('0x7'));var fs=require('fs');var path=require(_0x6e1f('0x8'));var rimraf=require(_0x6e1f('0x9'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x6e1f('0xa')]=function(_0x3186bf,_0x3aa77c){return _0x3186bf['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6e1f('0xb'),'fields':[_0x6e1f('0xb')]},{'name':'fti_mail_messages','fields':[_0x6e1f('0xc'),_0x6e1f('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c0d22,_0xcfca1a,_0x50be4b){if(_0x2c0d22['body']){_0x2c0d22[_0x6e1f('0xc')]=htmlToText[_0x6e1f('0xe')](_0x2c0d22['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x50be4b(null,_0xcfca1a);},'afterCreate':function(_0x11fe67,_0x56c698,_0x3fcd52){var _0x28d666=_0x3186bf[_0x6e1f('0xf')];var _0x3d6a25=_0x11fe67[_0x6e1f('0x10')]({'plain':!![]});if(_0x3d6a25['direction'][_0x6e1f('0x11')]()==='in'||_0x3d6a25['direction'][_0x6e1f('0x11')]()==='out'&&!_0x3d6a25[_0x6e1f('0x12')]&&!_[_0x6e1f('0x13')](_0x3d6a25[_0x6e1f('0x14')])){_0x28d666[_0x6e1f('0x15')]['findOne']({'where':{'id':_0x3d6a25['MailInteractionId']}})[_0x6e1f('0x16')](function(_0x133849){if(_0x133849){_0x133849[_0x6e1f('0x17')]({'lastMsgAt':_0x3d6a25[_0x6e1f('0x18')],'lastMsgDirection':_0x3d6a25[_0x6e1f('0x19')]['toLowerCase']()});}})[_0x6e1f('0x1a')](function(_0x28f13d){console[_0x6e1f('0x1b')](_0x28f13d);});}_0x3fcd52();}},'charset':_0x6e1f('0x1c'),'collate':_0x6e1f('0x1d')});}; \ No newline at end of file +var _0x0120=['fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','UserId','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId'];(function(_0x12a62c,_0xc9c41a){var _0x268a58=function(_0x100ca9){while(--_0x100ca9){_0x12a62c['push'](_0x12a62c['shift']());}};_0x268a58(++_0xc9c41a);}(_0x0120,0x149));var _0x0012=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0120[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0012('0x0'));var logger=require(_0x0012('0x1'))('api');var moment=require(_0x0012('0x2'));var BPromise=require('bluebird');var rp=require(_0x0012('0x3'));var htmlToText=require(_0x0012('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0012('0x5'));var config=require(_0x0012('0x6'));var attributes=require(_0x0012('0x7'));module['exports']=function(_0x320b33,_0x3674db){return _0x320b33[_0x0012('0x8')](_0x0012('0x9'),attributes,{'tableName':_0x0012('0xa'),'paranoid':![],'indexes':[{'name':_0x0012('0xb'),'fields':[_0x0012('0xb')]},{'name':_0x0012('0xc'),'fields':[_0x0012('0xd'),_0x0012('0xe')],'type':_0x0012('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15a83a,_0xba6747,_0x1581b1){if(_0x15a83a[_0x0012('0x10')]){_0x15a83a[_0x0012('0xd')]=htmlToText[_0x0012('0x11')](_0x15a83a[_0x0012('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1581b1(null,_0xba6747);},'afterCreate':function(_0x40d3ba,_0x1e5b4c,_0x2f44a8){var _0xef37d1=_0x320b33['models'];var _0x414b71=_0x40d3ba[_0x0012('0x12')]({'plain':!![]});if(_0x414b71['direction']['toLowerCase']()==='in'||_0x414b71[_0x0012('0x13')][_0x0012('0x14')]()===_0x0012('0x15')&&!_0x414b71[_0x0012('0x16')]&&!_['isNil'](_0x414b71[_0x0012('0x17')])){_0xef37d1['MailInteraction'][_0x0012('0x18')]({'where':{'id':_0x414b71['MailInteractionId']}})[_0x0012('0x19')](function(_0x440461){if(_0x440461){_0x440461[_0x0012('0x1a')]({'lastMsgAt':_0x414b71[_0x0012('0x1b')],'lastMsgDirection':_0x414b71['direction'][_0x0012('0x14')]()});}})['catch'](function(_0x5d60b3){console[_0x0012('0x1c')](_0x5d60b3);});}_0x2f44a8();}},'charset':_0x0012('0x1d'),'collate':_0x0012('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4f1d97d..ebd353a 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 _0x7334=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','create','body','options','raw','CreateMailMessage','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2126d0,_0x49a8e8){var _0x4bc2f5=function(_0x1c12b9){while(--_0x1c12b9){_0x2126d0['push'](_0x2126d0['shift']());}};_0x4bc2f5(++_0x49a8e8);}(_0x7334,0x184));var _0x4733=function(_0x566986,_0x45b7f3){_0x566986=_0x566986-0x0;var _0x22fdfa=_0x7334[_0x566986];return _0x22fdfa;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});config[_0x4733('0xb')]=_[_0x4733('0xc')](config[_0x4733('0xb')],{'host':_0x4733('0xd'),'port':0x18eb});var socket=require(_0x4733('0xe'))(new Redis(config[_0x4733('0xb')]));require(_0x4733('0xf'))[_0x4733('0x10')](socket);function respondWithRpcPromise(_0x1bc511,_0x2bafad,_0x49032d){return new BPromise(function(_0x42b97f,_0x1e6fcf){return client['request'](_0x1bc511,_0x49032d)[_0x4733('0x11')](function(_0x5240a4){logger[_0x4733('0x12')](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));logger[_0x4733('0x15')](_0x4733('0x16'),_0x2bafad,_0x4733('0x14'),JSON[_0x4733('0x17')](_0x5240a4));if(_0x5240a4['error']){if(_0x5240a4[_0x4733('0x18')]['code']===0x1f4){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);return _0x1e6fcf(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')]['message']);return _0x42b97f(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}else{logger['info'](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));_0x42b97f(_0x5240a4[_0x4733('0x1a')][_0x4733('0x19')]);}})['catch'](function(_0x517fbc){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x517fbc);_0x1e6fcf(_0x517fbc);});});}exports['CreateMailMessage']=function(_0x32f166){var _0x1943bc=this;return new Promise(function(_0x15339c,_0x7a4e0){return db['MailMessage'][_0x4733('0x1b')](_0x32f166[_0x4733('0x1c')],{'raw':_0x32f166['options']?_0x32f166[_0x4733('0x1d')][_0x4733('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x15a291){logger[_0x4733('0x12')](_0x4733('0x1f'),_0x32f166);logger[_0x4733('0x15')](_0x4733('0x1f'),_0x32f166,JSON[_0x4733('0x17')](_0x15a291));_0x15339c(_0x15a291);})[_0x4733('0x20')](function(_0x2bb78f){logger['error'](_0x4733('0x1f'),_0x2bb78f[_0x4733('0x19')],_0x32f166);_0x7a4e0(_0x1943bc[_0x4733('0x18')](0x1f4,_0x2bb78f[_0x4733('0x19')]));});});}; \ No newline at end of file +var _0xa30a=['then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 58a58b0..86f338e 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 _0xbb94=['remove','emit','removeListener','register','length','mailMessage:'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xbb94,0xde));var _0x4bb9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbb94[_0x3b380d];return _0x54502b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x4bb9('0x0'),'update'];function createListener(_0x2bd503,_0xffec30){return function(_0x4c9607){_0xffec30[_0x4bb9('0x1')](_0x2bd503,_0x4c9607);};}function removeListener(_0x13d29a,_0x3d302c){return function(){MailMessageEvents[_0x4bb9('0x2')](_0x13d29a,_0x3d302c);};}exports[_0x4bb9('0x3')]=function(_0x3e3057){for(var _0x5c0b70=0x0,_0x29bf40=events[_0x4bb9('0x4')];_0x5c0b70<_0x29bf40;_0x5c0b70++){var _0x18112b=events[_0x5c0b70];var _0x5cfac1=createListener(_0x4bb9('0x5')+_0x18112b,_0x3e3057);MailMessageEvents['on'](_0x18112b,_0x5cfac1);}}; \ No newline at end of file +var _0xf3be=['remove','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0xf3be,0x178));var _0xef3b=function(_0x37bbe8,_0x50d854){_0x37bbe8=_0x37bbe8-0x0;var _0x491f19=_0xf3be[_0x37bbe8];return _0x491f19;};'use strict';var MailMessageEvents=require(_0xef3b('0x0'));var events=[_0xef3b('0x1'),_0xef3b('0x2'),_0xef3b('0x3')];function createListener(_0x3310b7,_0x2e95ef){return function(_0x10c9b2){_0x2e95ef[_0xef3b('0x4')](_0x3310b7,_0x10c9b2);};}function removeListener(_0x22bf29,_0x437b21){return function(){MailMessageEvents[_0xef3b('0x5')](_0x22bf29,_0x437b21);};}exports[_0xef3b('0x6')]=function(_0xb704d5){for(var _0x1b887c=0x0,_0x39a6c4=events[_0xef3b('0x7')];_0x1b887c<_0x39a6c4;_0x1b887c++){var _0x55835a=events[_0x1b887c];var _0x4e48be=createListener(_0xef3b('0x8')+_0x55835a,_0xb704d5);MailMessageEvents['on'](_0x55835a,_0x4e48be);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e212572..2595b53 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 _0x496d=['/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x496d,0xa6));var _0xd496=function(_0x3ffc98,_0x5de236){_0x3ffc98=_0x3ffc98-0x0;var _0x58a5cf=_0x496d[_0x3ffc98];return _0x58a5cf;};'use strict';var multer=require(_0xd496('0x0'));var util=require(_0xd496('0x1'));var path=require(_0xd496('0x2'));var timeout=require(_0xd496('0x3'));var express=require('express');var router=express[_0xd496('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd496('0x5'));var interaction=require(_0xd496('0x6'));var config=require(_0xd496('0x7'));var controller=require(_0xd496('0x8'));router[_0xd496('0x9')]('/',auth[_0xd496('0xa')](),controller[_0xd496('0xb')]);router[_0xd496('0x9')](_0xd496('0xc'),auth[_0xd496('0xa')](),controller[_0xd496('0xd')]);router[_0xd496('0x9')](_0xd496('0xe'),auth['isAuthenticated'](),controller[_0xd496('0xf')]);router[_0xd496('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xd496('0x10')]);router[_0xd496('0x9')](_0xd496('0x11'),auth[_0xd496('0xa')](),controller[_0xd496('0x12')]);router[_0xd496('0x9')](_0xd496('0x13'),auth[_0xd496('0xa')](),controller[_0xd496('0x14')]);router[_0xd496('0x15')]('/',auth[_0xd496('0xa')](),controller[_0xd496('0x16')]);router[_0xd496('0x15')](_0xd496('0x11'),auth[_0xd496('0xa')](),controller[_0xd496('0x17')]);router[_0xd496('0x15')]('/:id/users',auth[_0xd496('0xa')](),controller[_0xd496('0x18')]);router[_0xd496('0x19')](_0xd496('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd496('0x1a')](_0xd496('0xe'),auth[_0xd496('0xa')](),controller[_0xd496('0x1b')]);router['delete'](_0xd496('0x11'),auth[_0xd496('0xa')](),controller[_0xd496('0x1c')]);router[_0xd496('0x1a')](_0xd496('0x13'),auth[_0xd496('0xa')](),controller[_0xd496('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xf6e7=['/:id','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put'];(function(_0x41ac4d,_0x2c88b0){var _0x32cc88=function(_0x187753){while(--_0x187753){_0x41ac4d['push'](_0x41ac4d['shift']());}};_0x32cc88(++_0x2c88b0);}(_0xf6e7,0x1f3));var _0x7f6e=function(_0x45239d,_0xba610e){_0x45239d=_0x45239d-0x0;var _0x578bf0=_0xf6e7[_0x45239d];return _0x578bf0;};'use strict';var multer=require('multer');var util=require(_0x7f6e('0x0'));var path=require('path');var timeout=require(_0x7f6e('0x1'));var express=require(_0x7f6e('0x2'));var router=express['Router']();var fs_extra=require(_0x7f6e('0x3'));var auth=require(_0x7f6e('0x4'));var interaction=require(_0x7f6e('0x5'));var config=require(_0x7f6e('0x6'));var controller=require(_0x7f6e('0x7'));router[_0x7f6e('0x8')]('/',auth[_0x7f6e('0x9')](),controller[_0x7f6e('0xa')]);router['get']('/describe',auth[_0x7f6e('0x9')](),controller[_0x7f6e('0xb')]);router[_0x7f6e('0x8')]('/:id',auth[_0x7f6e('0x9')](),controller[_0x7f6e('0xc')]);router[_0x7f6e('0x8')](_0x7f6e('0xd'),auth[_0x7f6e('0x9')](),controller[_0x7f6e('0xe')]);router[_0x7f6e('0x8')](_0x7f6e('0xf'),auth['isAuthenticated'](),controller[_0x7f6e('0x10')]);router[_0x7f6e('0x8')](_0x7f6e('0x11'),auth[_0x7f6e('0x9')](),controller[_0x7f6e('0x12')]);router['post']('/',auth[_0x7f6e('0x9')](),controller[_0x7f6e('0x13')]);router['post'](_0x7f6e('0xf'),auth[_0x7f6e('0x9')](),controller[_0x7f6e('0x14')]);router[_0x7f6e('0x15')](_0x7f6e('0x11'),auth[_0x7f6e('0x9')](),controller['addAgents']);router[_0x7f6e('0x16')](_0x7f6e('0x17'),auth[_0x7f6e('0x9')](),controller[_0x7f6e('0x18')]);router[_0x7f6e('0x19')]('/:id',auth[_0x7f6e('0x9')](),controller[_0x7f6e('0x1a')]);router[_0x7f6e('0x19')](_0x7f6e('0xf'),auth[_0x7f6e('0x9')](),controller[_0x7f6e('0x1b')]);router['delete'](_0x7f6e('0x11'),auth['isAuthenticated'](),controller[_0x7f6e('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1d01eb1..7dd21e0 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 _0xd019=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','name','STRING'];(function(_0x93d2f0,_0x324413){var _0x44dc81=function(_0x746fdf){while(--_0x746fdf){_0x93d2f0['push'](_0x93d2f0['shift']());}};_0x44dc81(++_0x324413);}(_0xd019,0x105));var _0x9d01=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0xd019[_0x13e300];return _0x5a3eea;};'use strict';var Sequelize=require(_0x9d01('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9d01('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9d01('0x2')]},'timeout':{'type':Sequelize[_0x9d01('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9d01('0x4')](_0x9d01('0x5'),_0x9d01('0x6'),_0x9d01('0x7'))}}; \ No newline at end of file +var _0x4f9d=['roundrobin','exports','name','STRING','INTEGER','beepall'];(function(_0x5a5974,_0x59be5d){var _0x1132be=function(_0x258bab){while(--_0x258bab){_0x5a5974['push'](_0x5a5974['shift']());}};_0x1132be(++_0x59be5d);}(_0x4f9d,0x169));var _0xd4f9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4f9d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xd4f9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd4f9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd4f9('0x2')]},'timeout':{'type':Sequelize[_0xd4f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd4f9('0x4'),_0xd4f9('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6e9dd5f..14ec20b 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 _0x1e40=['createdAt','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','addAgents','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','MailQueues','UserProfileResource','stack','name','send','map','MailQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','destroy','describe','getMembers','findOne','UserMailQueue','nolimit','order','sort','where','pick','MailQueueId','filter','options','findAndCountAll','UserId','agent','mailPause','updatedAt'];(function(_0x165ac8,_0x48074f){var _0x3639ee=function(_0x293651){while(--_0x293651){_0x165ac8['push'](_0x165ac8['shift']());}};_0x3639ee(++_0x48074f);}(_0x1e40,0xa4));var _0x01e4=function(_0x1db5be,_0x183e7f){_0x1db5be=_0x1db5be-0x0;var _0x1e46d6=_0x1e40[_0x1db5be];return _0x1e46d6;};'use strict';var BPromise=require(_0x01e4('0x0'));var util=require(_0x01e4('0x1'));var _=require('lodash');var squel=require(_0x01e4('0x2'));var Redis=require(_0x01e4('0x3'));var qs=require(_0x01e4('0x4'));var logger=require(_0x01e4('0x5'))(_0x01e4('0x6'));var config=require('../../config/environment');var db=require(_0x01e4('0x7'))['db'];config[_0x01e4('0x8')]=_[_0x01e4('0x9')](config[_0x01e4('0x8')],{'host':_0x01e4('0xa'),'port':0x18eb});var socket=require(_0x01e4('0xb'))(new Redis(config['redis']));require(_0x01e4('0xc'))['register'](socket);function respondWithStatusCode(_0x31da8f,_0x2e4ec1){_0x2e4ec1=_0x2e4ec1||0xcc;return function(_0x1f43bf){if(_0x1f43bf){return _0x31da8f[_0x01e4('0xd')](_0x2e4ec1);}return _0x31da8f[_0x01e4('0xe')](_0x2e4ec1)[_0x01e4('0xf')]();};}function respondWithResult(_0x365720,_0x41d44e){_0x41d44e=_0x41d44e||0xc8;return function(_0x48b272){if(_0x48b272){return _0x365720['status'](_0x41d44e)[_0x01e4('0x10')](_0x48b272);}};}function respondWithFilteredResult(_0x5234e0,_0x1a566b){return function(_0x2fc028){if(_0x2fc028){var _0x3c438c=typeof _0x1a566b[_0x01e4('0x11')]==='undefined'&&typeof _0x1a566b[_0x01e4('0x12')]===_0x01e4('0x13');var _0x7e6d4b=_0x2fc028[_0x01e4('0x14')];var _0x1c85df=_0x3c438c?0x0:_0x1a566b[_0x01e4('0x11')];var _0x594530=_0x3c438c?_0x2fc028[_0x01e4('0x14')]:_0x1a566b[_0x01e4('0x11')]+_0x1a566b[_0x01e4('0x12')];var _0x5d63ce;if(_0x594530>=_0x7e6d4b){_0x594530=_0x7e6d4b;_0x5d63ce=0xc8;}else{_0x5d63ce=0xce;}_0x5234e0['status'](_0x5d63ce);return _0x5234e0['set'](_0x01e4('0x15'),_0x1c85df+'-'+_0x594530+'/'+_0x7e6d4b)['json'](_0x2fc028);}return null;};}function saveUpdates(_0x297f19){return function(_0x3ac65c){if(_0x3ac65c){return _0x3ac65c[_0x01e4('0x16')](_0x297f19)[_0x01e4('0x17')](function(_0x8129e9){return _0x8129e9;});}return null;};}function removeEntity(_0x255cb7){return function(_0x433e59){if(_0x433e59){return _0x433e59['destroy']()[_0x01e4('0x17')](function(){var _0x58e02f=_0x433e59['get']({'plain':!![]});var _0x226b8a=_0x01e4('0x18');return db[_0x01e4('0x19')]['destroy']({'where':{'type':_0x226b8a,'resourceId':_0x58e02f['id']}})[_0x01e4('0x17')](function(){return _0x433e59;});})[_0x01e4('0x17')](function(){_0x255cb7[_0x01e4('0xe')](0xcc)[_0x01e4('0xf')]();});}};}function handleEntityNotFound(_0x4c427e){return function(_0x1198e2){if(!_0x1198e2){_0x4c427e[_0x01e4('0xd')](0x194);}return _0x1198e2;};}function handleError(_0x3d8372,_0x595198){_0x595198=_0x595198||0x1f4;return function(_0x977ab7){logger['error'](_0x977ab7[_0x01e4('0x1a')]);if(_0x977ab7[_0x01e4('0x1b')]){delete _0x977ab7[_0x01e4('0x1b')];}_0x3d8372['status'](_0x595198)[_0x01e4('0x1c')](_0x977ab7);};}exports['index']=function(_0x3063dc,_0x4314fe){var _0xae2bc9={};var _0x25b44e={'count':0x0,'rows':[]};var _0x3e8e26=_[_0x01e4('0x1d')](db[_0x01e4('0x1e')][_0x01e4('0x1f')],function(_0x1bba93){return{'name':_0x1bba93[_0x01e4('0x20')],'type':_0x1bba93[_0x01e4('0x21')]['key']};});_0xae2bc9=qs[_0x01e4('0x22')](_0x3e8e26,_0x3063dc);var _0x2df175={'where':_0xae2bc9['where']};return db[_0x01e4('0x1e')]['count'](_0x2df175)[_0x01e4('0x17')](function(_0x3746d6){_0x25b44e['count']=_0x3746d6;_0xae2bc9[_0x01e4('0x23')]=qs[_0x01e4('0x23')](_0x3063dc[_0x01e4('0x24')]);return db['MailQueue'][_0x01e4('0x25')](_0xae2bc9);})[_0x01e4('0x17')](function(_0x1b1ae7){_0x25b44e[_0x01e4('0x26')]=_0x1b1ae7;return _0x25b44e;})[_0x01e4('0x17')](respondWithFilteredResult(_0x4314fe,_0xae2bc9))[_0x01e4('0x27')](handleError(_0x4314fe,null));};exports[_0x01e4('0x28')]=function(_0x4976f7,_0x49e8d2){var _0x5c9fab={'raw':!![],'where':{'id':_0x4976f7[_0x01e4('0x29')]['id']}},_0x212e80={};_0x212e80[_0x01e4('0x2a')]=_[_0x01e4('0x2b')](db['MailQueue'][_0x01e4('0x1f')]);_0x212e80[_0x01e4('0x24')]=_[_0x01e4('0x2b')](_0x4976f7[_0x01e4('0x24')]);_0x212e80[_0x01e4('0x2c')]=_[_0x01e4('0x2d')](_0x212e80[_0x01e4('0x2a')],_0x212e80[_0x01e4('0x24')]);_0x5c9fab[_0x01e4('0x2e')]=_[_0x01e4('0x2d')](_0x212e80[_0x01e4('0x2a')],qs['fields'](_0x4976f7[_0x01e4('0x24')][_0x01e4('0x2f')]));_0x5c9fab[_0x01e4('0x2e')]=_0x5c9fab['attributes'][_0x01e4('0x30')]?_0x5c9fab[_0x01e4('0x2e')]:_0x212e80['model'];if(_0x4976f7[_0x01e4('0x24')][_0x01e4('0x31')]){_0x5c9fab[_0x01e4('0x23')]=[{'all':!![]}];}_0x5c9fab=_[_0x01e4('0x32')]({},_0x5c9fab,_0x4976f7['options']);return db[_0x01e4('0x1e')][_0x01e4('0x33')](_0x5c9fab)[_0x01e4('0x17')](handleEntityNotFound(_0x49e8d2,null))[_0x01e4('0x17')](respondWithResult(_0x49e8d2,null))[_0x01e4('0x27')](handleError(_0x49e8d2,null));};exports[_0x01e4('0x34')]=function(_0x3f13ba,_0x52ffa4){return db[_0x01e4('0x1e')]['create'](_0x3f13ba[_0x01e4('0x35')],{})[_0x01e4('0x17')](function(_0x91da04){var _0x406dde=_0x3f13ba['user'][_0x01e4('0x36')]({'plain':!![]});if(!_0x406dde)throw new Error(_0x01e4('0x37'));if(_0x406dde[_0x01e4('0x38')]===_0x01e4('0x39')){var _0x53dd6e=_0x91da04[_0x01e4('0x36')]({'plain':!![]});var _0x87101a=_0x01e4('0x18');return db['UserProfileSection'][_0x01e4('0x33')]({'where':{'name':_0x87101a,'userProfileId':_0x406dde['userProfileId']},'raw':!![]})[_0x01e4('0x17')](function(_0x740ddf){if(_0x740ddf&&_0x740ddf[_0x01e4('0x3a')]===0x0){return db[_0x01e4('0x19')]['create']({'name':_0x53dd6e[_0x01e4('0x1b')],'resourceId':_0x53dd6e['id'],'type':_0x740ddf['name'],'sectionId':_0x740ddf['id']},{})[_0x01e4('0x17')](function(){return _0x91da04;});}else{return _0x91da04;}})['catch'](function(_0x3f1aed){logger[_0x01e4('0x3b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f1aed);throw _0x3f1aed;});}return _0x91da04;})[_0x01e4('0x17')](respondWithResult(_0x52ffa4,0xc9))['catch'](handleError(_0x52ffa4,null));};exports[_0x01e4('0x16')]=function(_0xfb9c6,_0x82a1b8){if(_0xfb9c6[_0x01e4('0x35')]['id']){delete _0xfb9c6[_0x01e4('0x35')]['id'];}return db['MailQueue'][_0x01e4('0x33')]({'where':{'id':_0xfb9c6[_0x01e4('0x29')]['id']}})[_0x01e4('0x17')](handleEntityNotFound(_0x82a1b8,null))[_0x01e4('0x17')](saveUpdates(_0xfb9c6[_0x01e4('0x35')],null))[_0x01e4('0x17')](respondWithResult(_0x82a1b8,null))['catch'](handleError(_0x82a1b8,null));};exports[_0x01e4('0x3c')]=function(_0x299c5c,_0x25e48d){return db['MailQueue']['find']({'where':{'id':_0x299c5c[_0x01e4('0x29')]['id']}})['then'](handleEntityNotFound(_0x25e48d,null))[_0x01e4('0x17')](removeEntity(_0x25e48d,null))[_0x01e4('0x27')](handleError(_0x25e48d,null));};exports[_0x01e4('0x3d')]=function(_0x138a00,_0x57abb9){return db[_0x01e4('0x1e')][_0x01e4('0x3d')]()[_0x01e4('0x17')](respondWithResult(_0x57abb9,null))['catch'](handleError(_0x57abb9,null));};exports[_0x01e4('0x3e')]=function(_0xe00a19,_0x403ae0){var _0x4cf601={'raw':!![],'where':{}},_0xad93f5={},_0x1f1f0a;return db[_0x01e4('0x1e')][_0x01e4('0x3f')]({'where':{'id':_0xe00a19['params']['id']}})[_0x01e4('0x17')](handleEntityNotFound(_0x403ae0,null))[_0x01e4('0x17')](function(_0xd54e){if(_0xd54e){_0x1f1f0a=_0xd54e[_0x01e4('0x36')]({'plain':!![]});_0xad93f5['model']=_['keys'](db[_0x01e4('0x40')][_0x01e4('0x1f')]);_0xad93f5[_0x01e4('0x24')]=_[_0x01e4('0x2b')](_0xe00a19[_0x01e4('0x24')]);_0xad93f5[_0x01e4('0x2c')]=_[_0x01e4('0x2d')](_0xad93f5[_0x01e4('0x2a')],_0xad93f5[_0x01e4('0x24')]);_0x4cf601['attributes']=_[_0x01e4('0x2d')](_0xad93f5['model'],qs[_0x01e4('0x2f')](_0xe00a19[_0x01e4('0x24')][_0x01e4('0x2f')]));_0x4cf601['attributes']=_0x4cf601['attributes'][_0x01e4('0x30')]?_0x4cf601[_0x01e4('0x2e')]:_0xad93f5[_0x01e4('0x2a')];if(!_0xe00a19[_0x01e4('0x24')]['hasOwnProperty'](_0x01e4('0x41'))){_0x4cf601[_0x01e4('0x12')]=qs[_0x01e4('0x12')](_0xe00a19['query'][_0x01e4('0x12')]);_0x4cf601[_0x01e4('0x11')]=qs[_0x01e4('0x11')](_0xe00a19[_0x01e4('0x24')][_0x01e4('0x11')]);}_0x4cf601[_0x01e4('0x42')]=qs[_0x01e4('0x43')](_0xe00a19[_0x01e4('0x24')][_0x01e4('0x43')]);_0x4cf601[_0x01e4('0x44')]=qs[_0x01e4('0x2c')](_[_0x01e4('0x45')](_0xe00a19[_0x01e4('0x24')],_0xad93f5[_0x01e4('0x2c')]));_0x4cf601[_0x01e4('0x44')][_0x01e4('0x46')]=_0xd54e['id'];if(_0xe00a19['query'][_0x01e4('0x47')]){_0x4cf601[_0x01e4('0x44')]=_[_0x01e4('0x32')](_0x4cf601[_0x01e4('0x44')],{'$or':_[_0x01e4('0x1d')](_0x4cf601[_0x01e4('0x2e')],function(_0x49e786){var _0x30f0a4={};_0x30f0a4[_0x49e786]={'$like':'%'+_0xe00a19[_0x01e4('0x24')][_0x01e4('0x47')]+'%'};return _0x30f0a4;})});}_0x4cf601=_['merge']({},_0x4cf601,_0xe00a19[_0x01e4('0x48')]);return db[_0x01e4('0x40')][_0x01e4('0x25')](_0x4cf601);}})[_0x01e4('0x17')](function(_0x9fd8cd){if(_0x9fd8cd){return db['User'][_0x01e4('0x49')]({'where':{'id':_[_0x01e4('0x1d')](_0x9fd8cd,_0x01e4('0x4a')),'role':_0x01e4('0x4b')},'attributes':['id',_0x01e4('0x1b'),_0x01e4('0x4c'),_0x01e4('0x4d'),_0x01e4('0x4e')]});}})['then'](function(_0x4aa000){if(_0x4aa000){return{'count':_0x4aa000[_0x01e4('0x14')],'rows':_[_0x01e4('0x1d')](_0x4aa000[_0x01e4('0x26')],function(_0x10a7d2){return{'membername':_0x10a7d2['name'],'UserId':_0x10a7d2['id'],'queue_name':_0x1f1f0a['name'],'MailQueueId':_0x1f1f0a['id'],'interface':util['format'](_0x01e4('0x4f'),_0x01e4('0x50'),_0x10a7d2[_0x01e4('0x1b')]),'penalty':0x0,'paused':_0x10a7d2[_0x01e4('0x4c')],'createdAt':_0x10a7d2[_0x01e4('0x4e')],'updatedAt':_0x10a7d2[_0x01e4('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x01e4('0x17')](respondWithFilteredResult(_0x403ae0,_0x4cf601))[_0x01e4('0x27')](handleError(_0x403ae0,null));};exports[_0x01e4('0x51')]=function(_0x4a02ef,_0x6c920a){var _0x12b80b={};var _0x2eb014={};var _0x3f3d03;var _0x6e498c;return db['MailQueue'][_0x01e4('0x3f')]({'where':{'id':_0x4a02ef['params']['id']}})[_0x01e4('0x17')](handleEntityNotFound(_0x6c920a,null))[_0x01e4('0x17')](function(_0x24d062){if(_0x24d062){_0x3f3d03=_0x24d062;_0x2eb014['model']=_['keys'](db[_0x01e4('0x52')][_0x01e4('0x1f')]);_0x2eb014[_0x01e4('0x24')]=_[_0x01e4('0x2b')](_0x4a02ef[_0x01e4('0x24')]);_0x2eb014[_0x01e4('0x2c')]=_['intersection'](_0x2eb014[_0x01e4('0x2a')],_0x2eb014[_0x01e4('0x24')]);_0x12b80b[_0x01e4('0x2e')]=_[_0x01e4('0x2d')](_0x2eb014[_0x01e4('0x2a')],qs[_0x01e4('0x2f')](_0x4a02ef[_0x01e4('0x24')][_0x01e4('0x2f')]));_0x12b80b[_0x01e4('0x2e')]=_0x12b80b[_0x01e4('0x2e')][_0x01e4('0x30')]?_0x12b80b[_0x01e4('0x2e')]:_0x2eb014[_0x01e4('0x2a')];_0x12b80b[_0x01e4('0x42')]=qs[_0x01e4('0x43')](_0x4a02ef['query'][_0x01e4('0x43')]);_0x12b80b[_0x01e4('0x44')]=qs[_0x01e4('0x2c')](_['pick'](_0x4a02ef[_0x01e4('0x24')],_0x2eb014[_0x01e4('0x2c')]));if(_0x4a02ef[_0x01e4('0x24')][_0x01e4('0x47')]){_0x12b80b[_0x01e4('0x44')]=_['merge'](_0x12b80b[_0x01e4('0x44')],{'$or':_[_0x01e4('0x1d')](_0x12b80b[_0x01e4('0x2e')],function(_0x5cf157){var _0x1d963b={};_0x1d963b[_0x5cf157]={'$like':'%'+_0x4a02ef['query']['filter']+'%'};return _0x1d963b;})});}_0x12b80b=_['merge']({},_0x12b80b,_0x4a02ef[_0x01e4('0x48')]);return _0x3f3d03[_0x01e4('0x51')](_0x12b80b);}})[_0x01e4('0x17')](function(_0x265e5a){if(_0x265e5a){_0x6e498c=_0x265e5a[_0x01e4('0x30')];if(!_0x4a02ef['query'][_0x01e4('0x53')]('nolimit')){_0x12b80b[_0x01e4('0x12')]=qs[_0x01e4('0x12')](_0x4a02ef[_0x01e4('0x24')][_0x01e4('0x12')]);_0x12b80b['offset']=qs['offset'](_0x4a02ef[_0x01e4('0x24')][_0x01e4('0x11')]);}return _0x3f3d03[_0x01e4('0x51')](_0x12b80b);}})[_0x01e4('0x17')](function(_0x1b5d06){if(_0x1b5d06){return _0x1b5d06?{'count':_0x6e498c,'rows':_0x1b5d06}:null;}})[_0x01e4('0x17')](respondWithResult(_0x6c920a,null))[_0x01e4('0x27')](handleError(_0x6c920a,null));};exports[_0x01e4('0x54')]=function(_0x3b0375,_0x16bbed){var _0x47e4f2=_0x3b0375[_0x01e4('0x35')][_0x01e4('0x55')];return db['Team'][_0x01e4('0x25')]({'where':{'id':_0x47e4f2},'attributes':['id'],'include':[{'model':db[_0x01e4('0x56')],'as':_0x01e4('0x57'),'attributes':['id',_0x01e4('0x1b'),_0x01e4('0x58'),_0x01e4('0x59'),_0x01e4('0x5a')],'raw':!![]}]})[_0x01e4('0x17')](function(_0x5bc3f7){if(_0x5bc3f7){var _0x41b588=_[_0x01e4('0x5b')](_0x5bc3f7,function(_0x21e7b6){var _0x5eb7da=_0x21e7b6['get']({'plain':!![]});return _0x5eb7da[_0x01e4('0x57')];});return db['MailQueue'][_0x01e4('0x33')]({'where':{'id':_0x3b0375[_0x01e4('0x29')]['id']}})[_0x01e4('0x17')](function(_0x296c86){return db[_0x01e4('0x5c')][_0x01e4('0x5d')](function(_0x363494){return _0x296c86[_0x01e4('0x54')](_0x47e4f2,{'transaction':_0x363494})[_0x01e4('0x17')](function(){return BPromise['each'](_0x41b588,function(_0x479487){return db['UserMailQueue'][_0x01e4('0x5e')]({'where':{'UserId':_0x479487['id'],'MailQueueId':_0x3b0375[_0x01e4('0x29')]['id']},'transaction':_0x363494});});})[_0x01e4('0x17')](function(){_0x41b588[_0x01e4('0x5f')](function(_0x9f24e0){socket['emit'](_0x01e4('0x60'),{'UserId':_0x9f24e0['id'],'MailQueueId':_0x296c86['id']});});});});});}})[_0x01e4('0x17')](respondWithStatusCode(_0x16bbed,null))['catch'](handleError(_0x16bbed,null));};exports[_0x01e4('0x61')]=function(_0x5bbb87,_0x3cb000){return db[_0x01e4('0x52')]['findAll']({'where':{'id':_0x5bbb87[_0x01e4('0x24')][_0x01e4('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x01e4('0x57'),'attributes':['id'],'raw':!![]}]})[_0x01e4('0x17')](handleEntityNotFound(_0x3cb000,null))[_0x01e4('0x17')](function(_0x4688d3){var _0x140848=_[_0x01e4('0x1d')](_0x4688d3,'id');var _0x5638ff=[];var _0x293dc3=[];var _0x186c54=squel[_0x01e4('0x62')]();_0x186c54[_0x01e4('0x63')]('tq.TeamId')[_0x01e4('0x64')](_0x01e4('0x65'),'tq')[_0x01e4('0x66')](_0x01e4('0x67'),'ut',_0x01e4('0x68'))[_0x01e4('0x44')](_0x01e4('0x69'),_0x5bbb87['params']['id']);for(var _0x26c3ee=0x0;_0x26c3ee<_0x4688d3[_0x01e4('0x30')];_0x26c3ee+=0x1){let _0x157d23=_0x4688d3[_0x26c3ee];for(var _0x120dc2=0x0;_0x120dc2<_0x157d23['Agents']['length'];_0x120dc2+=0x1){let _0x109e28=_0x157d23[_0x01e4('0x57')][_0x120dc2];var _0x2b0ee8=_0x186c54['clone']();_0x2b0ee8['where'](_0x01e4('0x6a'),_0x109e28['id']);_0x293dc3['push'](db[_0x01e4('0x5c')][_0x01e4('0x24')](_0x2b0ee8['toString'](),{'type':db[_0x01e4('0x5c')][_0x01e4('0x6b')][_0x01e4('0x6c')]})['then'](function(_0x2844e0){if(_0x2844e0['length']===0x1){return _0x109e28['id'];}else{var _0x585038=_[_0x01e4('0x6d')](_[_0x01e4('0x1d')](_0x2844e0,_0x01e4('0x6e')),function(_0x3e8906){return _['includes'](_0x140848,_0x3e8906);});if(_0x585038){return _0x109e28['id'];}}}));}}return BPromise[_0x01e4('0x6f')](_0x293dc3)['then'](function(_0xdf3e54){_0x5638ff=_(_0x5638ff)['union'](_0xdf3e54)['compact']()[_0x01e4('0x70')]();return db[_0x01e4('0x1e')][_0x01e4('0x33')]({'where':{'id':_0x5bbb87['params']['id']}})[_0x01e4('0x17')](function(_0xe4bea2){return db[_0x01e4('0x5c')][_0x01e4('0x5d')](function(_0x170598){return _0xe4bea2['removeTeams'](_0x5bbb87[_0x01e4('0x24')][_0x01e4('0x55')],{'transaction':_0x170598})['then'](function(){if(!_[_0x01e4('0x71')](_0x5638ff)){return _0xe4bea2['removeAgents'](_0x5638ff,{'transaction':_0x170598});}})[_0x01e4('0x17')](function(){_0x5638ff['forEach'](function(_0x2c09aa){socket['emit']('userMailQueue:remove',{'UserId':_0x2c09aa,'MailQueueId':_0xe4bea2['id']});});});});});});})[_0x01e4('0x17')](respondWithStatusCode(_0x3cb000,null))['catch'](handleError(_0x3cb000,null));};exports[_0x01e4('0x72')]=function(_0x50b432,_0x2c6eaf){return db[_0x01e4('0x1e')][_0x01e4('0x33')]({'where':{'id':_0x50b432[_0x01e4('0x29')]['id']}})[_0x01e4('0x17')](handleEntityNotFound(_0x2c6eaf,null))[_0x01e4('0x17')](function(_0x29a229){if(_0x29a229){return _0x29a229[_0x01e4('0x72')](_0x50b432['body'][_0x01e4('0x55')],_[_0x01e4('0x73')](_0x50b432[_0x01e4('0x35')],[_0x01e4('0x55'),'id'])||{})['spread'](function(_0x4465d1){for(var _0x5b8ce2=0x0;_0x5b8ce2<_0x50b432['body'][_0x01e4('0x55')][_0x01e4('0x30')];_0x5b8ce2+=0x1){socket[_0x01e4('0x74')](_0x01e4('0x60'),{'UserId':Number(_0x50b432[_0x01e4('0x35')]['ids'][_0x5b8ce2]),'MailQueueId':Number(_0x50b432[_0x01e4('0x29')]['id'])});}return _0x4465d1;});}})[_0x01e4('0x17')](respondWithResult(_0x2c6eaf,null))[_0x01e4('0x27')](handleError(_0x2c6eaf,null));};exports[_0x01e4('0x75')]=function(_0x431365,_0x91760e){return db[_0x01e4('0x1e')][_0x01e4('0x33')]({'where':{'id':_0x431365['params']['id']}})[_0x01e4('0x17')](handleEntityNotFound(_0x91760e,null))[_0x01e4('0x17')](function(_0x3db00f){if(_0x3db00f){return _0x3db00f[_0x01e4('0x75')](_0x431365['query'][_0x01e4('0x55')])[_0x01e4('0x17')](function(){if(_[_0x01e4('0x76')](_0x431365[_0x01e4('0x24')][_0x01e4('0x55')])){for(var _0x496e3f=0x0;_0x496e3f<_0x431365[_0x01e4('0x24')][_0x01e4('0x55')][_0x01e4('0x30')];_0x496e3f+=0x1){socket['emit'](_0x01e4('0x77'),{'UserId':Number(_0x431365[_0x01e4('0x24')]['ids'][_0x496e3f]),'MailQueueId':Number(_0x431365[_0x01e4('0x29')]['id'])});}}else{socket[_0x01e4('0x74')](_0x01e4('0x77'),{'UserId':Number(_0x431365['query'][_0x01e4('0x55')]),'MailQueueId':Number(_0x431365[_0x01e4('0x29')]['id'])});}});}})[_0x01e4('0x17')](respondWithStatusCode(_0x91760e,null))[_0x01e4('0x27')](handleError(_0x91760e,null));};exports[_0x01e4('0x78')]=function(_0x4a2e3f,_0x4ff80e){var _0x31551e={};var _0x5f89cf={};var _0x3d6182;var _0x2b25cc;return db['MailQueue'][_0x01e4('0x3f')]({'where':{'id':_0x4a2e3f[_0x01e4('0x29')]['id']}})['then'](handleEntityNotFound(_0x4ff80e,null))[_0x01e4('0x17')](function(_0x58c085){if(_0x58c085){_0x3d6182=_0x58c085;_0x5f89cf[_0x01e4('0x2a')]=_[_0x01e4('0x2b')](db[_0x01e4('0x56')][_0x01e4('0x1f')]);_0x5f89cf[_0x01e4('0x24')]=_[_0x01e4('0x2b')](_0x4a2e3f[_0x01e4('0x24')]);_0x5f89cf[_0x01e4('0x2c')]=_['intersection'](_0x5f89cf[_0x01e4('0x2a')],_0x5f89cf[_0x01e4('0x24')]);_0x31551e[_0x01e4('0x2e')]=_[_0x01e4('0x2d')](_0x5f89cf[_0x01e4('0x2a')],qs[_0x01e4('0x2f')](_0x4a2e3f[_0x01e4('0x24')]['fields']));_0x31551e['attributes']=_0x31551e[_0x01e4('0x2e')][_0x01e4('0x30')]?_0x31551e[_0x01e4('0x2e')]:_0x5f89cf[_0x01e4('0x2a')];_0x31551e['order']=qs[_0x01e4('0x43')](_0x4a2e3f[_0x01e4('0x24')][_0x01e4('0x43')]);_0x31551e['where']=qs['filters'](_[_0x01e4('0x45')](_0x4a2e3f[_0x01e4('0x24')],_0x5f89cf[_0x01e4('0x2c')]));if(_0x4a2e3f[_0x01e4('0x24')][_0x01e4('0x47')]){_0x31551e[_0x01e4('0x44')]=_[_0x01e4('0x32')](_0x31551e[_0x01e4('0x44')],{'$or':_[_0x01e4('0x1d')](_0x31551e['attributes'],function(_0x26cf43){var _0x3d4c4e={};_0x3d4c4e[_0x26cf43]={'$like':'%'+_0x4a2e3f[_0x01e4('0x24')][_0x01e4('0x47')]+'%'};return _0x3d4c4e;})});}_0x31551e=_[_0x01e4('0x32')]({},_0x31551e,_0x4a2e3f[_0x01e4('0x48')]);return _0x3d6182[_0x01e4('0x78')](_0x31551e);}})['then'](function(_0x32477e){if(_0x32477e){_0x2b25cc=_0x32477e[_0x01e4('0x30')];if(!_0x4a2e3f['query'][_0x01e4('0x53')](_0x01e4('0x41'))){_0x31551e[_0x01e4('0x12')]=qs['limit'](_0x4a2e3f[_0x01e4('0x24')][_0x01e4('0x12')]);_0x31551e['offset']=qs[_0x01e4('0x11')](_0x4a2e3f[_0x01e4('0x24')][_0x01e4('0x11')]);}return _0x3d6182[_0x01e4('0x78')](_0x31551e);}})['then'](function(_0x246890){if(_0x246890){return _0x246890?{'count':_0x2b25cc,'rows':_0x246890}:null;}})[_0x01e4('0x17')](respondWithResult(_0x4ff80e,null))[_0x01e4('0x27')](handleError(_0x4ff80e,null));}; \ No newline at end of file +var _0x6da8=['ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error','name','send','map','MailQueue','rawAttributes','type','getOptions','where','include','findAll','catch','show','params','model','query','keys','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserMailQueue','hasOwnProperty','order','sort','filters','pick','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','getTeams','nolimit','ids','Agents','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','userMailQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','TeamId','includes','all','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash'];(function(_0x3feab5,_0x1849cb){var _0x4fb9e9=function(_0x3eab6b){while(--_0x3eab6b){_0x3feab5['push'](_0x3feab5['shift']());}};_0x4fb9e9(++_0x1849cb);}(_0x6da8,0xf1));var _0x86da=function(_0x4839fa,_0x592748){_0x4839fa=_0x4839fa-0x0;var _0x124a92=_0x6da8[_0x4839fa];return _0x124a92;};'use strict';var BPromise=require(_0x86da('0x0'));var util=require(_0x86da('0x1'));var _=require(_0x86da('0x2'));var squel=require('squel');var Redis=require(_0x86da('0x3'));var qs=require(_0x86da('0x4'));var logger=require(_0x86da('0x5'))(_0x86da('0x6'));var config=require('../../config/environment');var db=require(_0x86da('0x7'))['db'];config[_0x86da('0x8')]=_[_0x86da('0x9')](config[_0x86da('0x8')],{'host':_0x86da('0xa'),'port':0x18eb});var socket=require(_0x86da('0xb'))(new Redis(config[_0x86da('0x8')]));require(_0x86da('0xc'))[_0x86da('0xd')](socket);function respondWithStatusCode(_0x138176,_0x2be6c8){_0x2be6c8=_0x2be6c8||0xcc;return function(_0x8934ee){if(_0x8934ee){return _0x138176[_0x86da('0xe')](_0x2be6c8);}return _0x138176[_0x86da('0xf')](_0x2be6c8)[_0x86da('0x10')]();};}function respondWithResult(_0x4fdd55,_0x85d6d){_0x85d6d=_0x85d6d||0xc8;return function(_0x1de301){if(_0x1de301){return _0x4fdd55[_0x86da('0xf')](_0x85d6d)[_0x86da('0x11')](_0x1de301);}};}function respondWithFilteredResult(_0x25b317,_0x31468a){return function(_0x9c4fd5){if(_0x9c4fd5){var _0x2c7877=typeof _0x31468a[_0x86da('0x12')]===_0x86da('0x13')&&typeof _0x31468a[_0x86da('0x14')]===_0x86da('0x13');var _0x581892=_0x9c4fd5[_0x86da('0x15')];var _0x35b0d0=_0x2c7877?0x0:_0x31468a[_0x86da('0x12')];var _0x1e50a4=_0x2c7877?_0x9c4fd5[_0x86da('0x15')]:_0x31468a[_0x86da('0x12')]+_0x31468a[_0x86da('0x14')];var _0x4a7607;if(_0x1e50a4>=_0x581892){_0x1e50a4=_0x581892;_0x4a7607=0xc8;}else{_0x4a7607=0xce;}_0x25b317[_0x86da('0xf')](_0x4a7607);return _0x25b317[_0x86da('0x16')](_0x86da('0x17'),_0x35b0d0+'-'+_0x1e50a4+'/'+_0x581892)['json'](_0x9c4fd5);}return null;};}function saveUpdates(_0x36e8d3){return function(_0x500bad){if(_0x500bad){return _0x500bad[_0x86da('0x18')](_0x36e8d3)[_0x86da('0x19')](function(_0x4cc823){return _0x4cc823;});}return null;};}function removeEntity(_0x4e335d){return function(_0x1c214d){if(_0x1c214d){return _0x1c214d[_0x86da('0x1a')]()[_0x86da('0x19')](function(){var _0x27d65b=_0x1c214d[_0x86da('0x1b')]({'plain':!![]});var _0x3af34d='MailQueues';return db[_0x86da('0x1c')][_0x86da('0x1a')]({'where':{'type':_0x3af34d,'resourceId':_0x27d65b['id']}})[_0x86da('0x19')](function(){return _0x1c214d;});})[_0x86da('0x19')](function(){_0x4e335d[_0x86da('0xf')](0xcc)[_0x86da('0x10')]();});}};}function handleEntityNotFound(_0x263672){return function(_0x23584a){if(!_0x23584a){_0x263672[_0x86da('0xe')](0x194);}return _0x23584a;};}function handleError(_0x48ca03,_0xc98345){_0xc98345=_0xc98345||0x1f4;return function(_0x8d79f7){logger[_0x86da('0x1d')](_0x8d79f7['stack']);if(_0x8d79f7[_0x86da('0x1e')]){delete _0x8d79f7[_0x86da('0x1e')];}_0x48ca03[_0x86da('0xf')](_0xc98345)[_0x86da('0x1f')](_0x8d79f7);};}exports['index']=function(_0x44bf41,_0x4a3f05){var _0x5b952e={};var _0x3defb8={'count':0x0,'rows':[]};var _0x54ec29=_[_0x86da('0x20')](db[_0x86da('0x21')][_0x86da('0x22')],function(_0x3629d6){return{'name':_0x3629d6['fieldName'],'type':_0x3629d6[_0x86da('0x23')]['key']};});_0x5b952e=qs[_0x86da('0x24')](_0x54ec29,_0x44bf41);var _0x40aaa8={'where':_0x5b952e[_0x86da('0x25')]};return db[_0x86da('0x21')][_0x86da('0x15')](_0x40aaa8)[_0x86da('0x19')](function(_0x248c9d){_0x3defb8[_0x86da('0x15')]=_0x248c9d;_0x5b952e[_0x86da('0x26')]=qs[_0x86da('0x26')](_0x44bf41['query']);return db[_0x86da('0x21')][_0x86da('0x27')](_0x5b952e);})[_0x86da('0x19')](function(_0x390df3){_0x3defb8['rows']=_0x390df3;return _0x3defb8;})['then'](respondWithFilteredResult(_0x4a3f05,_0x5b952e))[_0x86da('0x28')](handleError(_0x4a3f05,null));};exports[_0x86da('0x29')]=function(_0x26d202,_0x15e979){var _0x45baaf={'raw':!![],'where':{'id':_0x26d202[_0x86da('0x2a')]['id']}},_0x43cf57={};_0x43cf57[_0x86da('0x2b')]=_['keys'](db[_0x86da('0x21')][_0x86da('0x22')]);_0x43cf57[_0x86da('0x2c')]=_[_0x86da('0x2d')](_0x26d202[_0x86da('0x2c')]);_0x43cf57['filters']=_[_0x86da('0x2e')](_0x43cf57[_0x86da('0x2b')],_0x43cf57[_0x86da('0x2c')]);_0x45baaf['attributes']=_[_0x86da('0x2e')](_0x43cf57[_0x86da('0x2b')],qs[_0x86da('0x2f')](_0x26d202[_0x86da('0x2c')]['fields']));_0x45baaf[_0x86da('0x30')]=_0x45baaf[_0x86da('0x30')][_0x86da('0x31')]?_0x45baaf['attributes']:_0x43cf57[_0x86da('0x2b')];if(_0x26d202[_0x86da('0x2c')][_0x86da('0x32')]){_0x45baaf[_0x86da('0x26')]=[{'all':!![]}];}_0x45baaf=_[_0x86da('0x33')]({},_0x45baaf,_0x26d202[_0x86da('0x34')]);return db['MailQueue'][_0x86da('0x35')](_0x45baaf)[_0x86da('0x19')](handleEntityNotFound(_0x15e979,null))[_0x86da('0x19')](respondWithResult(_0x15e979,null))['catch'](handleError(_0x15e979,null));};exports['create']=function(_0x59d5eb,_0x36dfc5){return db[_0x86da('0x21')][_0x86da('0x36')](_0x59d5eb[_0x86da('0x37')],{})[_0x86da('0x19')](function(_0x50cd11){var _0x24505c=_0x59d5eb['user']['get']({'plain':!![]});if(!_0x24505c)throw new Error(_0x86da('0x38'));if(_0x24505c[_0x86da('0x39')]===_0x86da('0x3a')){var _0xd4357d=_0x50cd11[_0x86da('0x1b')]({'plain':!![]});var _0x11832f=_0x86da('0x3b');return db[_0x86da('0x3c')][_0x86da('0x35')]({'where':{'name':_0x11832f,'userProfileId':_0x24505c[_0x86da('0x3d')]},'raw':!![]})['then'](function(_0x2bde8d){if(_0x2bde8d&&_0x2bde8d[_0x86da('0x3e')]===0x0){return db['UserProfileResource']['create']({'name':_0xd4357d[_0x86da('0x1e')],'resourceId':_0xd4357d['id'],'type':_0x2bde8d['name'],'sectionId':_0x2bde8d['id']},{})[_0x86da('0x19')](function(){return _0x50cd11;});}else{return _0x50cd11;}})[_0x86da('0x28')](function(_0xf9df17){logger[_0x86da('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf9df17);throw _0xf9df17;});}return _0x50cd11;})[_0x86da('0x19')](respondWithResult(_0x36dfc5,0xc9))[_0x86da('0x28')](handleError(_0x36dfc5,null));};exports[_0x86da('0x18')]=function(_0x17577a,_0x38c00f){if(_0x17577a[_0x86da('0x37')]['id']){delete _0x17577a[_0x86da('0x37')]['id'];}return db[_0x86da('0x21')][_0x86da('0x35')]({'where':{'id':_0x17577a[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0x38c00f,null))[_0x86da('0x19')](saveUpdates(_0x17577a[_0x86da('0x37')],null))[_0x86da('0x19')](respondWithResult(_0x38c00f,null))[_0x86da('0x28')](handleError(_0x38c00f,null));};exports['destroy']=function(_0x3c2f2b,_0x561bff){return db['MailQueue'][_0x86da('0x35')]({'where':{'id':_0x3c2f2b[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0x561bff,null))[_0x86da('0x19')](removeEntity(_0x561bff,null))[_0x86da('0x28')](handleError(_0x561bff,null));};exports[_0x86da('0x3f')]=function(_0x4434c5,_0x3836bb){return db[_0x86da('0x21')][_0x86da('0x3f')]()[_0x86da('0x19')](respondWithResult(_0x3836bb,null))[_0x86da('0x28')](handleError(_0x3836bb,null));};exports[_0x86da('0x40')]=function(_0x5b3063,_0x79fa24){var _0x449b47={'raw':!![],'where':{}},_0x519723={},_0x24bfc4;return db[_0x86da('0x21')]['findOne']({'where':{'id':_0x5b3063[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0x79fa24,null))[_0x86da('0x19')](function(_0x875e0d){if(_0x875e0d){_0x24bfc4=_0x875e0d['get']({'plain':!![]});_0x519723[_0x86da('0x2b')]=_['keys'](db[_0x86da('0x41')][_0x86da('0x22')]);_0x519723[_0x86da('0x2c')]=_[_0x86da('0x2d')](_0x5b3063['query']);_0x519723['filters']=_['intersection'](_0x519723[_0x86da('0x2b')],_0x519723[_0x86da('0x2c')]);_0x449b47['attributes']=_[_0x86da('0x2e')](_0x519723[_0x86da('0x2b')],qs[_0x86da('0x2f')](_0x5b3063['query'][_0x86da('0x2f')]));_0x449b47[_0x86da('0x30')]=_0x449b47[_0x86da('0x30')][_0x86da('0x31')]?_0x449b47[_0x86da('0x30')]:_0x519723['model'];if(!_0x5b3063[_0x86da('0x2c')][_0x86da('0x42')]('nolimit')){_0x449b47['limit']=qs['limit'](_0x5b3063[_0x86da('0x2c')]['limit']);_0x449b47['offset']=qs['offset'](_0x5b3063[_0x86da('0x2c')]['offset']);}_0x449b47[_0x86da('0x43')]=qs[_0x86da('0x44')](_0x5b3063[_0x86da('0x2c')][_0x86da('0x44')]);_0x449b47['where']=qs[_0x86da('0x45')](_[_0x86da('0x46')](_0x5b3063[_0x86da('0x2c')],_0x519723['filters']));_0x449b47[_0x86da('0x25')][_0x86da('0x47')]=_0x875e0d['id'];if(_0x5b3063['query'][_0x86da('0x48')]){_0x449b47['where']=_[_0x86da('0x33')](_0x449b47[_0x86da('0x25')],{'$or':_[_0x86da('0x20')](_0x449b47[_0x86da('0x30')],function(_0x94cbfc){var _0x16f0e7={};_0x16f0e7[_0x94cbfc]={'$like':'%'+_0x5b3063[_0x86da('0x2c')][_0x86da('0x48')]+'%'};return _0x16f0e7;})});}_0x449b47=_[_0x86da('0x33')]({},_0x449b47,_0x5b3063[_0x86da('0x34')]);return db['UserMailQueue'][_0x86da('0x27')](_0x449b47);}})[_0x86da('0x19')](function(_0x38a55d){if(_0x38a55d){return db[_0x86da('0x49')][_0x86da('0x4a')]({'where':{'id':_[_0x86da('0x20')](_0x38a55d,_0x86da('0x4b')),'role':_0x86da('0x4c')},'attributes':['id','name',_0x86da('0x4d'),'updatedAt',_0x86da('0x4e')]});}})[_0x86da('0x19')](function(_0x42c099){if(_0x42c099){return{'count':_0x42c099[_0x86da('0x15')],'rows':_[_0x86da('0x20')](_0x42c099['rows'],function(_0x5b777d){return{'membername':_0x5b777d[_0x86da('0x1e')],'UserId':_0x5b777d['id'],'queue_name':_0x24bfc4[_0x86da('0x1e')],'MailQueueId':_0x24bfc4['id'],'interface':util[_0x86da('0x4f')](_0x86da('0x50'),_0x86da('0x51'),_0x5b777d[_0x86da('0x1e')]),'penalty':0x0,'paused':_0x5b777d[_0x86da('0x4d')],'createdAt':_0x5b777d[_0x86da('0x4e')],'updatedAt':_0x5b777d[_0x86da('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x79fa24,_0x449b47))[_0x86da('0x28')](handleError(_0x79fa24,null));};exports['getTeams']=function(_0x305398,_0x2de9b5){var _0x1121f6={};var _0x11e8dc={};var _0x3759be;var _0x4fc581;return db['MailQueue'][_0x86da('0x53')]({'where':{'id':_0x305398[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0x2de9b5,null))[_0x86da('0x19')](function(_0x571baf){if(_0x571baf){_0x3759be=_0x571baf;_0x11e8dc[_0x86da('0x2b')]=_[_0x86da('0x2d')](db[_0x86da('0x54')]['rawAttributes']);_0x11e8dc[_0x86da('0x2c')]=_['keys'](_0x305398[_0x86da('0x2c')]);_0x11e8dc[_0x86da('0x45')]=_[_0x86da('0x2e')](_0x11e8dc[_0x86da('0x2b')],_0x11e8dc[_0x86da('0x2c')]);_0x1121f6['attributes']=_[_0x86da('0x2e')](_0x11e8dc[_0x86da('0x2b')],qs[_0x86da('0x2f')](_0x305398[_0x86da('0x2c')][_0x86da('0x2f')]));_0x1121f6[_0x86da('0x30')]=_0x1121f6[_0x86da('0x30')][_0x86da('0x31')]?_0x1121f6[_0x86da('0x30')]:_0x11e8dc[_0x86da('0x2b')];_0x1121f6[_0x86da('0x43')]=qs[_0x86da('0x44')](_0x305398[_0x86da('0x2c')][_0x86da('0x44')]);_0x1121f6[_0x86da('0x25')]=qs[_0x86da('0x45')](_['pick'](_0x305398['query'],_0x11e8dc[_0x86da('0x45')]));if(_0x305398['query']['filter']){_0x1121f6[_0x86da('0x25')]=_[_0x86da('0x33')](_0x1121f6[_0x86da('0x25')],{'$or':_[_0x86da('0x20')](_0x1121f6[_0x86da('0x30')],function(_0x20f0a9){var _0x2cf5e0={};_0x2cf5e0[_0x20f0a9]={'$like':'%'+_0x305398['query'][_0x86da('0x48')]+'%'};return _0x2cf5e0;})});}_0x1121f6=_[_0x86da('0x33')]({},_0x1121f6,_0x305398['options']);return _0x3759be[_0x86da('0x55')](_0x1121f6);}})[_0x86da('0x19')](function(_0x1a34ad){if(_0x1a34ad){_0x4fc581=_0x1a34ad[_0x86da('0x31')];if(!_0x305398['query'][_0x86da('0x42')](_0x86da('0x56'))){_0x1121f6[_0x86da('0x14')]=qs['limit'](_0x305398['query'][_0x86da('0x14')]);_0x1121f6[_0x86da('0x12')]=qs[_0x86da('0x12')](_0x305398[_0x86da('0x2c')]['offset']);}return _0x3759be[_0x86da('0x55')](_0x1121f6);}})[_0x86da('0x19')](function(_0x2cb753){if(_0x2cb753){return _0x2cb753?{'count':_0x4fc581,'rows':_0x2cb753}:null;}})[_0x86da('0x19')](respondWithResult(_0x2de9b5,null))[_0x86da('0x28')](handleError(_0x2de9b5,null));};exports['addTeams']=function(_0x35470e,_0x371712){var _0x3b3b81=_0x35470e['body'][_0x86da('0x57')];return db[_0x86da('0x54')][_0x86da('0x27')]({'where':{'id':_0x3b3b81},'attributes':['id'],'include':[{'model':db[_0x86da('0x49')],'as':_0x86da('0x58'),'attributes':['id','name','online',_0x86da('0x59'),_0x86da('0x5a')],'raw':!![]}]})[_0x86da('0x19')](function(_0x157353){if(_0x157353){var _0x4d4c33=_[_0x86da('0x5b')](_0x157353,function(_0x110be5){var _0x17c8c1=_0x110be5[_0x86da('0x1b')]({'plain':!![]});return _0x17c8c1[_0x86da('0x58')];});return db['MailQueue']['find']({'where':{'id':_0x35470e[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](function(_0x48f988){return db['sequelize'][_0x86da('0x5c')](function(_0x16082c){return _0x48f988[_0x86da('0x5d')](_0x3b3b81,{'transaction':_0x16082c})[_0x86da('0x19')](function(){return BPromise['each'](_0x4d4c33,function(_0x580225){return db[_0x86da('0x41')][_0x86da('0x5e')]({'where':{'UserId':_0x580225['id'],'MailQueueId':_0x35470e[_0x86da('0x2a')]['id']},'transaction':_0x16082c});});})[_0x86da('0x19')](function(){_0x4d4c33[_0x86da('0x5f')](function(_0x5ef979){socket['emit'](_0x86da('0x60'),{'UserId':_0x5ef979['id'],'MailQueueId':_0x48f988['id']});});});});});}})[_0x86da('0x19')](respondWithStatusCode(_0x371712,null))[_0x86da('0x28')](handleError(_0x371712,null));};exports['removeTeams']=function(_0x4bbd26,_0x5e3689){return db[_0x86da('0x54')][_0x86da('0x27')]({'where':{'id':_0x4bbd26[_0x86da('0x2c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x86da('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e3689,null))[_0x86da('0x19')](function(_0x36faf2){var _0x694736=_[_0x86da('0x20')](_0x36faf2,'id');var _0x518090=[];var _0x250fb4=[];var _0x1b3d50=squel[_0x86da('0x61')]();_0x1b3d50[_0x86da('0x62')](_0x86da('0x63'))[_0x86da('0x64')]('team_has_mail_queues','tq')[_0x86da('0x65')](_0x86da('0x66'),'ut',_0x86da('0x67'))[_0x86da('0x25')](_0x86da('0x68'),_0x4bbd26['params']['id']);for(var _0x76405=0x0;_0x76405<_0x36faf2[_0x86da('0x31')];_0x76405+=0x1){let _0xb908e8=_0x36faf2[_0x76405];for(var _0x4eedfd=0x0;_0x4eedfd<_0xb908e8[_0x86da('0x58')][_0x86da('0x31')];_0x4eedfd+=0x1){let _0x2f2d6c=_0xb908e8[_0x86da('0x58')][_0x4eedfd];var _0x2aa3da=_0x1b3d50[_0x86da('0x69')]();_0x2aa3da[_0x86da('0x25')](_0x86da('0x6a'),_0x2f2d6c['id']);_0x250fb4['push'](db[_0x86da('0x6b')][_0x86da('0x2c')](_0x2aa3da[_0x86da('0x6c')](),{'type':db[_0x86da('0x6b')][_0x86da('0x6d')]['SELECT']})[_0x86da('0x19')](function(_0x4e2dc5){if(_0x4e2dc5[_0x86da('0x31')]===0x1){return _0x2f2d6c['id'];}else{var _0x3abc5f=_['every'](_[_0x86da('0x20')](_0x4e2dc5,_0x86da('0x6e')),function(_0x281283){return _[_0x86da('0x6f')](_0x694736,_0x281283);});if(_0x3abc5f){return _0x2f2d6c['id'];}}}));}}return BPromise[_0x86da('0x70')](_0x250fb4)[_0x86da('0x19')](function(_0x2fab3b){_0x518090=_(_0x518090)['union'](_0x2fab3b)['compact']()['value']();return db[_0x86da('0x21')][_0x86da('0x35')]({'where':{'id':_0x4bbd26['params']['id']}})['then'](function(_0x214495){return db[_0x86da('0x6b')]['transaction'](function(_0x20c694){return _0x214495['removeTeams'](_0x4bbd26[_0x86da('0x2c')][_0x86da('0x57')],{'transaction':_0x20c694})[_0x86da('0x19')](function(){if(!_[_0x86da('0x71')](_0x518090)){return _0x214495[_0x86da('0x72')](_0x518090,{'transaction':_0x20c694});}})['then'](function(){_0x518090['forEach'](function(_0x2e44bf){socket[_0x86da('0x73')](_0x86da('0x74'),{'UserId':_0x2e44bf,'MailQueueId':_0x214495['id']});});});});});});})[_0x86da('0x19')](respondWithStatusCode(_0x5e3689,null))[_0x86da('0x28')](handleError(_0x5e3689,null));};exports[_0x86da('0x75')]=function(_0x25e8ed,_0xb07ebe){return db['MailQueue'][_0x86da('0x35')]({'where':{'id':_0x25e8ed[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0xb07ebe,null))['then'](function(_0x4e5b72){if(_0x4e5b72){return _0x4e5b72[_0x86da('0x75')](_0x25e8ed[_0x86da('0x37')][_0x86da('0x57')],_[_0x86da('0x76')](_0x25e8ed['body'],['ids','id'])||{})[_0x86da('0x77')](function(_0x217a98){for(var _0x225d84=0x0;_0x225d84<_0x25e8ed[_0x86da('0x37')][_0x86da('0x57')][_0x86da('0x31')];_0x225d84+=0x1){socket['emit'](_0x86da('0x60'),{'UserId':Number(_0x25e8ed[_0x86da('0x37')]['ids'][_0x225d84]),'MailQueueId':Number(_0x25e8ed[_0x86da('0x2a')]['id'])});}return _0x217a98;});}})['then'](respondWithResult(_0xb07ebe,null))[_0x86da('0x28')](handleError(_0xb07ebe,null));};exports['removeAgents']=function(_0x455446,_0x153e07){return db[_0x86da('0x21')]['find']({'where':{'id':_0x455446[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0x153e07,null))['then'](function(_0x59ca62){if(_0x59ca62){return _0x59ca62[_0x86da('0x72')](_0x455446['query'][_0x86da('0x57')])[_0x86da('0x19')](function(){if(_[_0x86da('0x78')](_0x455446['query']['ids'])){for(var _0x15cbfe=0x0;_0x15cbfe<_0x455446[_0x86da('0x2c')][_0x86da('0x57')][_0x86da('0x31')];_0x15cbfe+=0x1){socket[_0x86da('0x73')](_0x86da('0x74'),{'UserId':Number(_0x455446[_0x86da('0x2c')][_0x86da('0x57')][_0x15cbfe]),'MailQueueId':Number(_0x455446['params']['id'])});}}else{socket['emit'](_0x86da('0x74'),{'UserId':Number(_0x455446[_0x86da('0x2c')][_0x86da('0x57')]),'MailQueueId':Number(_0x455446['params']['id'])});}});}})[_0x86da('0x19')](respondWithStatusCode(_0x153e07,null))[_0x86da('0x28')](handleError(_0x153e07,null));};exports[_0x86da('0x79')]=function(_0x30763e,_0xeb8725){var _0x38168b={};var _0x5ee778={};var _0x120753;var _0xee6234;return db[_0x86da('0x21')]['findOne']({'where':{'id':_0x30763e[_0x86da('0x2a')]['id']}})[_0x86da('0x19')](handleEntityNotFound(_0xeb8725,null))[_0x86da('0x19')](function(_0x4b0fd9){if(_0x4b0fd9){_0x120753=_0x4b0fd9;_0x5ee778[_0x86da('0x2b')]=_[_0x86da('0x2d')](db[_0x86da('0x49')][_0x86da('0x22')]);_0x5ee778[_0x86da('0x2c')]=_['keys'](_0x30763e[_0x86da('0x2c')]);_0x5ee778[_0x86da('0x45')]=_[_0x86da('0x2e')](_0x5ee778['model'],_0x5ee778['query']);_0x38168b[_0x86da('0x30')]=_[_0x86da('0x2e')](_0x5ee778[_0x86da('0x2b')],qs[_0x86da('0x2f')](_0x30763e[_0x86da('0x2c')][_0x86da('0x2f')]));_0x38168b[_0x86da('0x30')]=_0x38168b[_0x86da('0x30')][_0x86da('0x31')]?_0x38168b[_0x86da('0x30')]:_0x5ee778[_0x86da('0x2b')];_0x38168b['order']=qs[_0x86da('0x44')](_0x30763e[_0x86da('0x2c')]['sort']);_0x38168b[_0x86da('0x25')]=qs['filters'](_[_0x86da('0x46')](_0x30763e['query'],_0x5ee778[_0x86da('0x45')]));if(_0x30763e[_0x86da('0x2c')][_0x86da('0x48')]){_0x38168b[_0x86da('0x25')]=_[_0x86da('0x33')](_0x38168b[_0x86da('0x25')],{'$or':_[_0x86da('0x20')](_0x38168b['attributes'],function(_0x4a4a56){var _0x1dd3e2={};_0x1dd3e2[_0x4a4a56]={'$like':'%'+_0x30763e['query']['filter']+'%'};return _0x1dd3e2;})});}_0x38168b=_[_0x86da('0x33')]({},_0x38168b,_0x30763e[_0x86da('0x34')]);return _0x120753[_0x86da('0x79')](_0x38168b);}})[_0x86da('0x19')](function(_0xc2b093){if(_0xc2b093){_0xee6234=_0xc2b093['length'];if(!_0x30763e[_0x86da('0x2c')]['hasOwnProperty']('nolimit')){_0x38168b[_0x86da('0x14')]=qs[_0x86da('0x14')](_0x30763e[_0x86da('0x2c')][_0x86da('0x14')]);_0x38168b[_0x86da('0x12')]=qs[_0x86da('0x12')](_0x30763e[_0x86da('0x2c')]['offset']);}return _0x120753[_0x86da('0x79')](_0x38168b);}})[_0x86da('0x19')](function(_0x309070){if(_0x309070){return _0x309070?{'count':_0xee6234,'rows':_0x309070}:null;}})[_0x86da('0x19')](respondWithResult(_0xeb8725,null))['catch'](handleError(_0xeb8725,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3f82dfb..aa9d28c 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 _0xc91a=['setMaxListeners','save','update','remove','emit','hook','exports','events','MailQueue'];(function(_0x424e69,_0x1f5d85){var _0x24c62b=function(_0x1ba98b){while(--_0x1ba98b){_0x424e69['push'](_0x424e69['shift']());}};_0x24c62b(++_0x1f5d85);}(_0xc91a,0x139));var _0xac91=function(_0x2d6720,_0x46b462){_0x2d6720=_0x2d6720-0x0;var _0x268bdf=_0xc91a[_0x2d6720];return _0x268bdf;};'use strict';var EventEmitter=require(_0xac91('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xac91('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xac91('0x2')](0x0);var events={'afterCreate':_0xac91('0x3'),'afterUpdate':_0xac91('0x4'),'afterDestroy':_0xac91('0x5')};function emitEvent(_0x178fd3){return function(_0x26b774,_0x4f7ba2,_0x59fecd){MailQueueEvents[_0xac91('0x6')](_0x178fd3+':'+_0x26b774['id'],_0x26b774);MailQueueEvents[_0xac91('0x6')](_0x178fd3,_0x26b774);_0x59fecd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xac91('0x7')](e,emitEvent(event));}}module[_0xac91('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x3eae=['../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x32c30c,_0x55ad1f){var _0x11fc72=function(_0x22b981){while(--_0x22b981){_0x32c30c['push'](_0x32c30c['shift']());}};_0x11fc72(++_0x55ad1f);}(_0x3eae,0xe6));var _0xe3ea=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x3eae[_0x4d7f3f];return _0x5d67cc;};'use strict';var EventEmitter=require(_0xe3ea('0x0'));var MailQueue=require(_0xe3ea('0x1'))['db'][_0xe3ea('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe3ea('0x3')](0x0);var events={'afterCreate':_0xe3ea('0x4'),'afterUpdate':_0xe3ea('0x5'),'afterDestroy':_0xe3ea('0x6')};function emitEvent(_0x4b15d5){return function(_0x2b1b51,_0x5616d8,_0x21ad0b){MailQueueEvents[_0xe3ea('0x7')](_0x4b15d5+':'+_0x2b1b51['id'],_0x2b1b51);MailQueueEvents['emit'](_0x4b15d5,_0x2b1b51);_0x21ad0b(null);};}for(var e in events){if(events[_0xe3ea('0x8')](e)){var event=events[e];MailQueue[_0xe3ea('0x9')](e,emitEvent(event));}}module[_0xe3ea('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 77aab83..69633b7 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 _0x4584=['exports','MailQueue','mail_queues','lodash','../../config/logger','moment','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4584,0x19b));var _0x4458=function(_0x170362,_0x1bf09a){_0x170362=_0x170362-0x0;var _0x2fd172=_0x4584[_0x170362];return _0x2fd172;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');var logger=require(_0x4458('0x1'))('api');var moment=require(_0x4458('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4458('0x3'));var rimraf=require(_0x4458('0x4'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x4458('0x5')]=function(_0x18caa0,_0x477e42){return _0x18caa0['define'](_0x4458('0x6'),attributes,{'tableName':_0x4458('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe788=['exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2e3102,_0x1e4e3a){var _0x16a525=function(_0x51c4c8){while(--_0x51c4c8){_0x2e3102['push'](_0x2e3102['shift']());}};_0x16a525(++_0x1e4e3a);}(_0xe788,0x122));var _0x8e78=function(_0x3cb1a5,_0x49d84a){_0x3cb1a5=_0x3cb1a5-0x0;var _0x216a56=_0xe788[_0x3cb1a5];return _0x216a56;};'use strict';var _=require('lodash');var util=require(_0x8e78('0x0'));var logger=require(_0x8e78('0x1'))(_0x8e78('0x2'));var moment=require(_0x8e78('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e78('0x4'));var fs=require('fs');var path=require(_0x8e78('0x5'));var rimraf=require(_0x8e78('0x6'));var config=require(_0x8e78('0x7'));var attributes=require(_0x8e78('0x8'));module[_0x8e78('0x9')]=function(_0x4575a1,_0x303487){return _0x4575a1[_0x8e78('0xa')](_0x8e78('0xb'),attributes,{'tableName':_0x8e78('0xc'),'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 16461da..28a050f 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 _0x6c74=['code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1dc77b,_0x3c57fb){var _0x1d9ffc=function(_0x43c5a1){while(--_0x43c5a1){_0x1dc77b['push'](_0x1dc77b['shift']());}};_0x1d9ffc(++_0x3c57fb);}(_0x6c74,0xb4));var _0x46c7=function(_0x544808,_0x10e96f){_0x544808=_0x544808-0x0;var _0x2ffdd8=_0x6c74[_0x544808];return _0x2ffdd8;};'use strict';var _=require('lodash');var util=require(_0x46c7('0x0'));var moment=require('moment');var BPromise=require(_0x46c7('0x1'));var rs=require(_0x46c7('0x2'));var fs=require('fs');var Redis=require(_0x46c7('0x3'));var db=require(_0x46c7('0x4'))['db'];var utils=require(_0x46c7('0x5'));var logger=require(_0x46c7('0x6'))(_0x46c7('0x7'));var config=require(_0x46c7('0x8'));var jayson=require(_0x46c7('0x9'));var client=jayson[_0x46c7('0xa')][_0x46c7('0xb')]({'port':0x232a});config[_0x46c7('0xc')]=_[_0x46c7('0xd')](config['redis'],{'host':_0x46c7('0xe'),'port':0x18eb});var socket=require(_0x46c7('0xf'))(new Redis(config['redis']));require(_0x46c7('0x10'))[_0x46c7('0x11')](socket);function respondWithRpcPromise(_0x3fdbd1,_0x49c489,_0x565016){return new BPromise(function(_0x5a6ed4,_0x1e8deb){return client['request'](_0x3fdbd1,_0x565016)[_0x46c7('0x12')](function(_0x69755a){logger[_0x46c7('0x13')](_0x46c7('0x14'),_0x49c489,_0x46c7('0x15'));logger[_0x46c7('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x49c489,_0x46c7('0x15'),JSON[_0x46c7('0x17')](_0x69755a));if(_0x69755a[_0x46c7('0x18')]){if(_0x69755a[_0x46c7('0x18')][_0x46c7('0x19')]===0x1f4){logger[_0x46c7('0x18')](_0x46c7('0x14'),_0x49c489,_0x69755a[_0x46c7('0x18')][_0x46c7('0x1a')]);return _0x1e8deb(_0x69755a[_0x46c7('0x18')][_0x46c7('0x1a')]);}logger[_0x46c7('0x18')](_0x46c7('0x14'),_0x49c489,_0x69755a[_0x46c7('0x18')][_0x46c7('0x1a')]);return _0x5a6ed4(_0x69755a['error'][_0x46c7('0x1a')]);}else{logger[_0x46c7('0x13')](_0x46c7('0x14'),_0x49c489,_0x46c7('0x15'));_0x5a6ed4(_0x69755a[_0x46c7('0x1b')]['message']);}})[_0x46c7('0x1c')](function(_0x4e4b31){logger['error'](_0x46c7('0x14'),_0x49c489,_0x4e4b31);_0x1e8deb(_0x4e4b31);});});}exports[_0x46c7('0x1d')]=function(_0x1af2f3){var _0x3b26b0=this;return new Promise(function(_0x351a27,_0x2e8234){return db[_0x46c7('0x1e')]['findAll']({'raw':_0x1af2f3[_0x46c7('0x1f')]?_0x1af2f3[_0x46c7('0x1f')][_0x46c7('0x20')]===undefined?!![]:![]:!![],'where':_0x1af2f3['options']?_0x1af2f3[_0x46c7('0x1f')][_0x46c7('0x21')]||null:null,'attributes':_0x1af2f3[_0x46c7('0x1f')]?_0x1af2f3[_0x46c7('0x1f')][_0x46c7('0x22')]||null:null,'limit':_0x1af2f3[_0x46c7('0x1f')]?_0x1af2f3[_0x46c7('0x1f')][_0x46c7('0x23')]||null:null,'include':_0x1af2f3[_0x46c7('0x1f')]?_0x1af2f3[_0x46c7('0x1f')][_0x46c7('0x24')]?_[_0x46c7('0x25')](_0x1af2f3[_0x46c7('0x1f')]['include'],function(_0x3db0cf){return{'model':db[_0x3db0cf['model']],'as':_0x3db0cf['as'],'attributes':_0x3db0cf[_0x46c7('0x22')],'include':_0x3db0cf['include']?_[_0x46c7('0x25')](_0x3db0cf[_0x46c7('0x24')],function(_0x257324){return{'model':db[_0x257324['model']],'as':_0x257324['as'],'attributes':_0x257324[_0x46c7('0x22')],'include':_0x257324[_0x46c7('0x24')]?_['map'](_0x257324[_0x46c7('0x24')],function(_0x20d22d){return{'model':db[_0x20d22d[_0x46c7('0x26')]],'as':_0x20d22d['as'],'attributes':_0x20d22d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb7b883){logger[_0x46c7('0x13')]('GetMailQueue',_0x1af2f3);logger[_0x46c7('0x16')](_0x46c7('0x1d'),_0x1af2f3,JSON[_0x46c7('0x17')](_0xb7b883));_0x351a27(_0xb7b883);})['catch'](function(_0xf390dc){logger[_0x46c7('0x18')](_0x46c7('0x1d'),_0xf390dc['message'],_0x1af2f3);_0x2e8234(_0x3b26b0[_0x46c7('0x18')](0x1f4,_0xf390dc[_0x46c7('0x1a')]));});});};exports[_0x46c7('0x27')]=function(_0x1daaa1){var _0x228381=this;return new Promise(function(_0x2b3126,_0x110acd){return db[_0x46c7('0x1e')][_0x46c7('0x28')]({'raw':_0x1daaa1['options']?_0x1daaa1[_0x46c7('0x1f')][_0x46c7('0x20')]===undefined?!![]:![]:!![],'where':_0x1daaa1[_0x46c7('0x1f')]?_0x1daaa1[_0x46c7('0x1f')][_0x46c7('0x21')]||null:null,'attributes':_0x1daaa1['options']?_0x1daaa1[_0x46c7('0x1f')]['attributes']||null:null,'include':_0x1daaa1[_0x46c7('0x1f')]?_0x1daaa1[_0x46c7('0x1f')]['include']?_[_0x46c7('0x25')](_0x1daaa1[_0x46c7('0x1f')][_0x46c7('0x24')],function(_0x3a1f69){return{'model':db[_0x3a1f69['model']],'as':_0x3a1f69['as'],'attributes':_0x3a1f69[_0x46c7('0x22')],'include':_0x3a1f69['include']?_[_0x46c7('0x25')](_0x3a1f69[_0x46c7('0x24')],function(_0x1121d5){return{'model':db[_0x1121d5[_0x46c7('0x26')]],'as':_0x1121d5['as'],'attributes':_0x1121d5['attributes'],'include':_0x1121d5[_0x46c7('0x24')]?_[_0x46c7('0x25')](_0x1121d5[_0x46c7('0x24')],function(_0x72d803){return{'model':db[_0x72d803[_0x46c7('0x26')]],'as':_0x72d803['as'],'attributes':_0x72d803[_0x46c7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x46c7('0x12')](function(_0x59d69e){logger[_0x46c7('0x13')](_0x46c7('0x27'),_0x1daaa1);logger[_0x46c7('0x16')](_0x46c7('0x27'),_0x1daaa1,JSON[_0x46c7('0x17')](_0x59d69e));_0x2b3126(_0x59d69e);})['catch'](function(_0x2ca8e9){logger[_0x46c7('0x18')](_0x46c7('0x27'),_0x2ca8e9[_0x46c7('0x1a')],_0x1daaa1);_0x110acd(_0x228381[_0x46c7('0x18')](0x1f4,_0x2ca8e9[_0x46c7('0x1a')]));});});}; \ No newline at end of file +var _0xe16b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','options','attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','MailQueue','find','raw','where','util'];(function(_0x3f83de,_0x120f4a){var _0x4ad112=function(_0x6fda13){while(--_0x6fda13){_0x3f83de['push'](_0x3f83de['shift']());}};_0x4ad112(++_0x120f4a);}(_0xe16b,0x155));var _0xbe16=function(_0x4bcb21,_0x48db18){_0x4bcb21=_0x4bcb21-0x0;var _0x75825=_0xe16b[_0x4bcb21];return _0x75825;};'use strict';var _=require('lodash');var util=require(_0xbe16('0x0'));var moment=require(_0xbe16('0x1'));var BPromise=require(_0xbe16('0x2'));var rs=require(_0xbe16('0x3'));var fs=require('fs');var Redis=require(_0xbe16('0x4'));var db=require(_0xbe16('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe16('0x6'))(_0xbe16('0x7'));var config=require(_0xbe16('0x8'));var jayson=require(_0xbe16('0x9'));var client=jayson[_0xbe16('0xa')]['http']({'port':0x232a});config[_0xbe16('0xb')]=_[_0xbe16('0xc')](config[_0xbe16('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe16('0xd'))(new Redis(config[_0xbe16('0xb')]));require(_0xbe16('0xe'))['register'](socket);function respondWithRpcPromise(_0x3ca232,_0x380d85,_0x4e2f30){return new BPromise(function(_0x710d9d,_0x480900){return client[_0xbe16('0xf')](_0x3ca232,_0x4e2f30)[_0xbe16('0x10')](function(_0x26b475){logger[_0xbe16('0x11')](_0xbe16('0x12'),_0x380d85,_0xbe16('0x13'));logger[_0xbe16('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x380d85,'request\x20sent',JSON[_0xbe16('0x15')](_0x26b475));if(_0x26b475['error']){if(_0x26b475[_0xbe16('0x16')]['code']===0x1f4){logger[_0xbe16('0x16')](_0xbe16('0x12'),_0x380d85,_0x26b475[_0xbe16('0x16')][_0xbe16('0x17')]);return _0x480900(_0x26b475[_0xbe16('0x16')][_0xbe16('0x17')]);}logger['error'](_0xbe16('0x12'),_0x380d85,_0x26b475[_0xbe16('0x16')][_0xbe16('0x17')]);return _0x710d9d(_0x26b475[_0xbe16('0x16')]['message']);}else{logger[_0xbe16('0x11')](_0xbe16('0x12'),_0x380d85,_0xbe16('0x13'));_0x710d9d(_0x26b475[_0xbe16('0x18')][_0xbe16('0x17')]);}})[_0xbe16('0x19')](function(_0x5ebfc4){logger['error'](_0xbe16('0x12'),_0x380d85,_0x5ebfc4);_0x480900(_0x5ebfc4);});});}exports['GetMailQueue']=function(_0x3e6f78){var _0x177fb7=this;return new Promise(function(_0x2b7f37,_0x45fd55){return db['MailQueue']['findAll']({'raw':_0x3e6f78['options']?_0x3e6f78[_0xbe16('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6f78[_0xbe16('0x1a')]?_0x3e6f78[_0xbe16('0x1a')]['where']||null:null,'attributes':_0x3e6f78[_0xbe16('0x1a')]?_0x3e6f78['options'][_0xbe16('0x1b')]||null:null,'limit':_0x3e6f78[_0xbe16('0x1a')]?_0x3e6f78[_0xbe16('0x1a')][_0xbe16('0x1c')]||null:null,'include':_0x3e6f78[_0xbe16('0x1a')]?_0x3e6f78[_0xbe16('0x1a')][_0xbe16('0x1d')]?_[_0xbe16('0x1e')](_0x3e6f78[_0xbe16('0x1a')]['include'],function(_0x265265){return{'model':db[_0x265265[_0xbe16('0x1f')]],'as':_0x265265['as'],'attributes':_0x265265['attributes'],'include':_0x265265['include']?_[_0xbe16('0x1e')](_0x265265[_0xbe16('0x1d')],function(_0x38f784){return{'model':db[_0x38f784['model']],'as':_0x38f784['as'],'attributes':_0x38f784[_0xbe16('0x1b')],'include':_0x38f784[_0xbe16('0x1d')]?_[_0xbe16('0x1e')](_0x38f784['include'],function(_0x537488){return{'model':db[_0x537488[_0xbe16('0x1f')]],'as':_0x537488['as'],'attributes':_0x537488[_0xbe16('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbe16('0x10')](function(_0x48e5ef){logger[_0xbe16('0x11')](_0xbe16('0x20'),_0x3e6f78);logger[_0xbe16('0x14')](_0xbe16('0x20'),_0x3e6f78,JSON['stringify'](_0x48e5ef));_0x2b7f37(_0x48e5ef);})['catch'](function(_0x2c80b4){logger[_0xbe16('0x16')]('GetMailQueue',_0x2c80b4[_0xbe16('0x17')],_0x3e6f78);_0x45fd55(_0x177fb7[_0xbe16('0x16')](0x1f4,_0x2c80b4['message']));});});};exports[_0xbe16('0x21')]=function(_0x334793){var _0x4deddf=this;return new Promise(function(_0xaee599,_0x3ffb3b){return db[_0xbe16('0x22')][_0xbe16('0x23')]({'raw':_0x334793[_0xbe16('0x1a')]?_0x334793['options'][_0xbe16('0x24')]===undefined?!![]:![]:!![],'where':_0x334793[_0xbe16('0x1a')]?_0x334793['options'][_0xbe16('0x25')]||null:null,'attributes':_0x334793[_0xbe16('0x1a')]?_0x334793[_0xbe16('0x1a')][_0xbe16('0x1b')]||null:null,'include':_0x334793[_0xbe16('0x1a')]?_0x334793[_0xbe16('0x1a')][_0xbe16('0x1d')]?_[_0xbe16('0x1e')](_0x334793[_0xbe16('0x1a')][_0xbe16('0x1d')],function(_0x42c1e2){return{'model':db[_0x42c1e2[_0xbe16('0x1f')]],'as':_0x42c1e2['as'],'attributes':_0x42c1e2[_0xbe16('0x1b')],'include':_0x42c1e2['include']?_[_0xbe16('0x1e')](_0x42c1e2[_0xbe16('0x1d')],function(_0x1018ec){return{'model':db[_0x1018ec[_0xbe16('0x1f')]],'as':_0x1018ec['as'],'attributes':_0x1018ec[_0xbe16('0x1b')],'include':_0x1018ec[_0xbe16('0x1d')]?_[_0xbe16('0x1e')](_0x1018ec['include'],function(_0x13d3a2){return{'model':db[_0x13d3a2['model']],'as':_0x13d3a2['as'],'attributes':_0x13d3a2[_0xbe16('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15bf03){logger[_0xbe16('0x11')](_0xbe16('0x21'),_0x334793);logger[_0xbe16('0x14')](_0xbe16('0x21'),_0x334793,JSON[_0xbe16('0x15')](_0x15bf03));_0xaee599(_0x15bf03);})['catch'](function(_0x1ce069){logger[_0xbe16('0x16')](_0xbe16('0x21'),_0x1ce069[_0xbe16('0x17')],_0x334793);_0x3ffb3b(_0x4deddf[_0xbe16('0x16')](0x1f4,_0x1ce069['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 619fbf6..25e5514 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 _0xd96e=['register','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x4f58f6,_0x143686){var _0x3b2ec0=function(_0x25e9d7){while(--_0x25e9d7){_0x4f58f6['push'](_0x4f58f6['shift']());}};_0x3b2ec0(++_0x143686);}(_0xd96e,0x16e));var _0xed96=function(_0xeb3682,_0x3829b9){_0xeb3682=_0xeb3682-0x0;var _0x7b5264=_0xd96e[_0xeb3682];return _0x7b5264;};'use strict';var MailQueueEvents=require(_0xed96('0x0'));var events=[_0xed96('0x1'),_0xed96('0x2'),_0xed96('0x3')];function createListener(_0x278f06,_0xdd144e){return function(_0x4fbed5){_0xdd144e[_0xed96('0x4')](_0x278f06,_0x4fbed5);};}function removeListener(_0x2259d1,_0xa9cd2){return function(){MailQueueEvents['removeListener'](_0x2259d1,_0xa9cd2);};}exports[_0xed96('0x5')]=function(_0x280d4d){for(var _0x50f1ef=0x0,_0x3c1d7d=events['length'];_0x50f1ef<_0x3c1d7d;_0x50f1ef++){var _0x5c1827=events[_0x50f1ef];var _0x20d2d7=createListener(_0xed96('0x6')+_0x5c1827,_0x280d4d);MailQueueEvents['on'](_0x5c1827,_0x20d2d7);}}; \ No newline at end of file +var _0x41ee=['save','update','removeListener','./mailQueue.events'];(function(_0x31d608,_0x395747){var _0x259b9c=function(_0x1a7797){while(--_0x1a7797){_0x31d608['push'](_0x31d608['shift']());}};_0x259b9c(++_0x395747);}(_0x41ee,0x9b));var _0xe41e=function(_0x10499e,_0x56fd86){_0x10499e=_0x10499e-0x0;var _0x3fef98=_0x41ee[_0x10499e];return _0x3fef98;};'use strict';var MailQueueEvents=require(_0xe41e('0x0'));var events=[_0xe41e('0x1'),'remove',_0xe41e('0x2')];function createListener(_0x509ab8,_0x39eb7e){return function(_0x2b5998){_0x39eb7e['emit'](_0x509ab8,_0x2b5998);};}function removeListener(_0x39e853,_0x335835){return function(){MailQueueEvents[_0xe41e('0x3')](_0x39e853,_0x335835);};}exports['register']=function(_0x2a8e08){for(var _0x29e885=0x0,_0x20854d=events['length'];_0x29e885<_0x20854d;_0x29e885++){var _0x24185f=events[_0x29e885];var _0x351964=createListener('mailQueue:'+_0x24185f,_0x2a8e08);MailQueueEvents['on'](_0x24185f,_0x351964);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4491987..7e0d236 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 _0xcd85=['/describe','describe','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x34d558,_0x3532e5){var _0x42e124=function(_0x34f0f1){while(--_0x34f0f1){_0x34d558['push'](_0x34d558['shift']());}};_0x42e124(++_0x3532e5);}(_0xcd85,0x67));var _0x5cd8=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xcd85[_0x305486];return _0xa04940;};'use strict';var multer=require('multer');var util=require(_0x5cd8('0x0'));var path=require(_0x5cd8('0x1'));var timeout=require(_0x5cd8('0x2'));var express=require(_0x5cd8('0x3'));var router=express[_0x5cd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5cd8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5cd8('0x6'));var controller=require(_0x5cd8('0x7'));router[_0x5cd8('0x8')]('/',auth[_0x5cd8('0x9')](),controller[_0x5cd8('0xa')]);router['get'](_0x5cd8('0xb'),auth['isAuthenticated'](),controller[_0x5cd8('0xc')]);router[_0x5cd8('0x8')]('/:id',auth[_0x5cd8('0x9')](),controller[_0x5cd8('0xd')]);router[_0x5cd8('0xe')]('/',auth[_0x5cd8('0x9')](),controller[_0x5cd8('0xf')]);router[_0x5cd8('0x10')]('/:id',auth[_0x5cd8('0x9')](),controller[_0x5cd8('0x11')]);router[_0x5cd8('0x12')]('/:id',auth[_0x5cd8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbe7f=['/describe','describe','/:id','show','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x3dde5a,_0x4c63bc){var _0x2d242f=function(_0x1e04a5){while(--_0x1e04a5){_0x3dde5a['push'](_0x3dde5a['shift']());}};_0x2d242f(++_0x4c63bc);}(_0xbe7f,0x16f));var _0xfbe7=function(_0x9791c4,_0x283c9f){_0x9791c4=_0x9791c4-0x0;var _0x36d7c9=_0xbe7f[_0x9791c4];return _0x36d7c9;};'use strict';var multer=require(_0xfbe7('0x0'));var util=require('util');var path=require(_0xfbe7('0x1'));var timeout=require(_0xfbe7('0x2'));var express=require(_0xfbe7('0x3'));var router=express[_0xfbe7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbe7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbe7('0x6'));var controller=require(_0xfbe7('0x7'));router[_0xfbe7('0x8')]('/',auth[_0xfbe7('0x9')](),controller[_0xfbe7('0xa')]);router[_0xfbe7('0x8')](_0xfbe7('0xb'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0xc')]);router['get'](_0xfbe7('0xd'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0xe')]);router['post']('/',auth[_0xfbe7('0x9')](),controller['create']);router[_0xfbe7('0xf')]('/:id',auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x10')]);router[_0xfbe7('0x11')](_0xfbe7('0xd'),auth[_0xfbe7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 172ba5b..34ac5ff 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 _0x03c6=['sequelize','exports','STRING','DATE'];(function(_0x509b66,_0x2923ed){var _0x5035e7=function(_0x214fa8){while(--_0x214fa8){_0x509b66['push'](_0x509b66['shift']());}};_0x5035e7(++_0x2923ed);}(_0x03c6,0x84));var _0x603c=function(_0x186e74,_0x50cf6a){_0x186e74=_0x186e74-0x0;var _0x25a1d8=_0x03c6[_0x186e74];return _0x25a1d8;};'use strict';var moment=require('moment');var Sequelize=require(_0x603c('0x0'));module[_0x603c('0x1')]={'uniqueid':{'type':Sequelize[_0x603c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x603c('0x3')]},'leaveAt':{'type':Sequelize[_0x603c('0x3')]},'acceptAt':{'type':Sequelize[_0x603c('0x3')]},'exitAt':{'type':Sequelize[_0x603c('0x3')]},'reason':{'type':Sequelize[_0x603c('0x2')]}}; \ No newline at end of file +var _0x0408=['STRING','DATE','sequelize','exports'];(function(_0x1e841f,_0x301832){var _0x16369f=function(_0x4379fa){while(--_0x4379fa){_0x1e841f['push'](_0x1e841f['shift']());}};_0x16369f(++_0x301832);}(_0x0408,0x1ba));var _0x8040=function(_0x53d14b,_0xba4b30){_0x53d14b=_0x53d14b-0x0;var _0x45b884=_0x0408[_0x53d14b];return _0x45b884;};'use strict';var moment=require('moment');var Sequelize=require(_0x8040('0x0'));module[_0x8040('0x1')]={'uniqueid':{'type':Sequelize[_0x8040('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8040('0x3')]},'leaveAt':{'type':Sequelize[_0x8040('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8040('0x3')]},'reason':{'type':Sequelize[_0x8040('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0e16afe..b57adb4 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 _0x77e6=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','index','map','MailQueueReport'];(function(_0x186f61,_0x2a2c51){var _0x16a9e4=function(_0x2ce55f){while(--_0x2ce55f){_0x186f61['push'](_0x186f61['shift']());}};_0x16a9e4(++_0x2a2c51);}(_0x77e6,0x1a6));var _0x677e=function(_0x38eb23,_0x4b0a66){_0x38eb23=_0x38eb23-0x0;var _0x40b0dd=_0x77e6[_0x38eb23];return _0x40b0dd;};'use strict';var emlformat=require(_0x677e('0x0'));var rimraf=require(_0x677e('0x1'));var zipdir=require(_0x677e('0x2'));var jsonpatch=require(_0x677e('0x3'));var rp=require(_0x677e('0x4'));var moment=require(_0x677e('0x5'));var BPromise=require(_0x677e('0x6'));var Mustache=require(_0x677e('0x7'));var util=require('util');var path=require(_0x677e('0x8'));var sox=require(_0x677e('0x9'));var csv=require('to-csv');var ejs=require(_0x677e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x677e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x677e('0xc'));var deskjs=require(_0x677e('0xd'));var toCsv=require(_0x677e('0xe'));var querystring=require(_0x677e('0xf'));var Papa=require('papaparse');var Redis=require(_0x677e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x677e('0x11'));var as=require(_0x677e('0x12'));var hardwareService=require(_0x677e('0x13'));var logger=require(_0x677e('0x14'))(_0x677e('0x15'));var utils=require(_0x677e('0x16'));var config=require(_0x677e('0x17'));var licenseUtil=require(_0x677e('0x18'));var db=require(_0x677e('0x19'))['db'];function respondWithStatusCode(_0x46a67e,_0x366490){_0x366490=_0x366490||0xcc;return function(_0x2a5f95){if(_0x2a5f95){return _0x46a67e[_0x677e('0x1a')](_0x366490);}return _0x46a67e[_0x677e('0x1b')](_0x366490)['end']();};}function respondWithResult(_0x512631,_0x5c7351){_0x5c7351=_0x5c7351||0xc8;return function(_0x213a50){if(_0x213a50){return _0x512631[_0x677e('0x1b')](_0x5c7351)[_0x677e('0x1c')](_0x213a50);}};}function respondWithFilteredResult(_0x36e976,_0x4daa04){return function(_0x42d0c3){if(_0x42d0c3){var _0x24c9eb=typeof _0x4daa04[_0x677e('0x1d')]===_0x677e('0x1e')&&typeof _0x4daa04[_0x677e('0x1f')]===_0x677e('0x1e');var _0xe4d960=_0x42d0c3['count'];var _0x1c5124=_0x24c9eb?0x0:_0x4daa04[_0x677e('0x1d')];var _0x385b06=_0x24c9eb?_0x42d0c3[_0x677e('0x20')]:_0x4daa04[_0x677e('0x1d')]+_0x4daa04[_0x677e('0x1f')];var _0x52f65d;if(_0x385b06>=_0xe4d960){_0x385b06=_0xe4d960;_0x52f65d=0xc8;}else{_0x52f65d=0xce;}_0x36e976[_0x677e('0x1b')](_0x52f65d);return _0x36e976['set'](_0x677e('0x21'),_0x1c5124+'-'+_0x385b06+'/'+_0xe4d960)[_0x677e('0x1c')](_0x42d0c3);}return null;};}function patchUpdates(_0x26e9c5){return function(_0x593aed){try{jsonpatch[_0x677e('0x22')](_0x593aed,_0x26e9c5,!![]);}catch(_0x1a6122){return BPromise[_0x677e('0x23')](_0x1a6122);}return _0x593aed[_0x677e('0x24')]();};}function saveUpdates(_0x295964,_0x8732e0){return function(_0x3a7895){if(_0x3a7895){return _0x3a7895['update'](_0x295964)['then'](function(_0x52d915){return _0x52d915;});}return null;};}function removeEntity(_0x357466,_0x154fce){return function(_0x31a1e4){if(_0x31a1e4){return _0x31a1e4[_0x677e('0x25')]()[_0x677e('0x26')](function(){_0x357466[_0x677e('0x1b')](0xcc)[_0x677e('0x27')]();});}};}function handleEntityNotFound(_0x42f2b8,_0x2c51d3){return function(_0x3f0646){if(!_0x3f0646){_0x42f2b8['sendStatus'](0x194);}return _0x3f0646;};}function handleError(_0x5f0ba2,_0x3d3370){_0x3d3370=_0x3d3370||0x1f4;return function(_0x184f68){logger['error'](_0x184f68[_0x677e('0x28')]);if(_0x184f68[_0x677e('0x29')]){delete _0x184f68[_0x677e('0x29')];}_0x5f0ba2[_0x677e('0x1b')](_0x3d3370)[_0x677e('0x2a')](_0x184f68);};}exports[_0x677e('0x2b')]=function(_0x56ad40,_0xcd4646){var _0x2a6033={},_0xeca8e2={},_0x1e2694={'count':0x0,'rows':[]};var _0x22e44c=_[_0x677e('0x2c')](db[_0x677e('0x2d')][_0x677e('0x2e')],function(_0x9d49b5){return{'name':_0x9d49b5['fieldName'],'type':_0x9d49b5[_0x677e('0x2f')][_0x677e('0x30')]};});_0xeca8e2[_0x677e('0x31')]=_[_0x677e('0x2c')](_0x22e44c,_0x677e('0x29'));_0xeca8e2[_0x677e('0x32')]=_[_0x677e('0x33')](_0x56ad40[_0x677e('0x32')]);_0xeca8e2[_0x677e('0x34')]=_[_0x677e('0x35')](_0xeca8e2['model'],_0xeca8e2[_0x677e('0x32')]);_0x2a6033[_0x677e('0x36')]=_[_0x677e('0x35')](_0xeca8e2[_0x677e('0x31')],qs[_0x677e('0x37')](_0x56ad40[_0x677e('0x32')]['fields']));_0x2a6033[_0x677e('0x36')]=_0x2a6033[_0x677e('0x36')][_0x677e('0x38')]?_0x2a6033['attributes']:_0xeca8e2[_0x677e('0x31')];if(!_0x56ad40[_0x677e('0x32')][_0x677e('0x39')](_0x677e('0x3a'))){_0x2a6033[_0x677e('0x1f')]=qs['limit'](_0x56ad40[_0x677e('0x32')][_0x677e('0x1f')]);_0x2a6033[_0x677e('0x1d')]=qs[_0x677e('0x1d')](_0x56ad40['query'][_0x677e('0x1d')]);}_0x2a6033[_0x677e('0x3b')]=qs[_0x677e('0x3c')](_0x56ad40['query']['sort']);_0x2a6033[_0x677e('0x3d')]=qs[_0x677e('0x34')](_['pick'](_0x56ad40[_0x677e('0x32')],_0xeca8e2[_0x677e('0x34')]),_0x22e44c);if(_0x56ad40['query']['filter']){_0x2a6033[_0x677e('0x3d')]=_[_0x677e('0x3e')](_0x2a6033['where'],{'$or':_['map'](_0x22e44c,function(_0x42ce2c){if(_0x42ce2c[_0x677e('0x2f')]!==_0x677e('0x3f')){var _0x5bb080={};_0x5bb080[_0x42ce2c[_0x677e('0x29')]]={'$like':'%'+_0x56ad40[_0x677e('0x32')][_0x677e('0x40')]+'%'};return _0x5bb080;}})});}_0x2a6033=_[_0x677e('0x3e')]({},_0x2a6033,_0x56ad40[_0x677e('0x41')]);var _0x4b34fa={'where':_0x2a6033['where']};return db[_0x677e('0x2d')][_0x677e('0x20')](_0x4b34fa)[_0x677e('0x26')](function(_0x1db5b4){_0x1e2694[_0x677e('0x20')]=_0x1db5b4;if(_0x56ad40[_0x677e('0x32')][_0x677e('0x42')]){_0x2a6033[_0x677e('0x43')]=[{'all':!![]}];}return db[_0x677e('0x2d')][_0x677e('0x44')](_0x2a6033);})['then'](function(_0x56eb30){_0x1e2694[_0x677e('0x45')]=_0x56eb30;return _0x1e2694;})[_0x677e('0x26')](respondWithFilteredResult(_0xcd4646,_0x2a6033))['catch'](handleError(_0xcd4646,null));};exports[_0x677e('0x46')]=function(_0x511125,_0x16362e){var _0x29b9c0={'raw':!![],'where':{'id':_0x511125[_0x677e('0x47')]['id']}},_0x283aaa={};_0x283aaa[_0x677e('0x31')]=_[_0x677e('0x33')](db['MailQueueReport'][_0x677e('0x2e')]);_0x283aaa[_0x677e('0x32')]=_[_0x677e('0x33')](_0x511125[_0x677e('0x32')]);_0x283aaa[_0x677e('0x34')]=_[_0x677e('0x35')](_0x283aaa['model'],_0x283aaa[_0x677e('0x32')]);_0x29b9c0['attributes']=_[_0x677e('0x35')](_0x283aaa[_0x677e('0x31')],qs[_0x677e('0x37')](_0x511125[_0x677e('0x32')][_0x677e('0x37')]));_0x29b9c0[_0x677e('0x36')]=_0x29b9c0[_0x677e('0x36')][_0x677e('0x38')]?_0x29b9c0[_0x677e('0x36')]:_0x283aaa[_0x677e('0x31')];if(_0x511125['query'][_0x677e('0x42')]){_0x29b9c0['include']=[{'all':!![]}];}_0x29b9c0=_['merge']({},_0x29b9c0,_0x511125[_0x677e('0x41')]);return db[_0x677e('0x2d')][_0x677e('0x48')](_0x29b9c0)[_0x677e('0x26')](handleEntityNotFound(_0x16362e,null))[_0x677e('0x26')](respondWithResult(_0x16362e,null))['catch'](handleError(_0x16362e,null));};exports[_0x677e('0x49')]=function(_0x136b77,_0x3cb653){return db[_0x677e('0x2d')][_0x677e('0x49')](_0x136b77['body'],{})[_0x677e('0x26')](respondWithResult(_0x3cb653,0xc9))[_0x677e('0x4a')](handleError(_0x3cb653,null));};exports[_0x677e('0x4b')]=function(_0x496627,_0x30ed5c){if(_0x496627['body']['id']){delete _0x496627[_0x677e('0x4c')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x496627[_0x677e('0x47')]['id']}})[_0x677e('0x26')](handleEntityNotFound(_0x30ed5c,null))[_0x677e('0x26')](saveUpdates(_0x496627[_0x677e('0x4c')],null))['then'](respondWithResult(_0x30ed5c,null))[_0x677e('0x4a')](handleError(_0x30ed5c,null));};exports[_0x677e('0x25')]=function(_0x51b2b8,_0x5e93e9){return db[_0x677e('0x2d')][_0x677e('0x48')]({'where':{'id':_0x51b2b8[_0x677e('0x47')]['id']}})[_0x677e('0x26')](handleEntityNotFound(_0x5e93e9,null))['then'](removeEntity(_0x5e93e9,null))[_0x677e('0x4a')](handleError(_0x5e93e9,null));};exports['describe']=function(_0x5404a1,_0x3bb4d8){return db['MailQueueReport'][_0x677e('0x4d')]()[_0x677e('0x26')](respondWithResult(_0x3bb4d8,null))[_0x677e('0x4a')](handleError(_0x3bb4d8,null));}; \ No newline at end of file +var _0xb145=['includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x5a83da,_0x4c2eb8){var _0x29beed=function(_0x560625){while(--_0x560625){_0x5a83da['push'](_0x5a83da['shift']());}};_0x29beed(++_0x4c2eb8);}(_0xb145,0xa3));var _0x5b14=function(_0x2d5dc3,_0x55f667){_0x2d5dc3=_0x2d5dc3-0x0;var _0x1a924c=_0xb145[_0x2d5dc3];return _0x1a924c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];function respondWithStatusCode(_0x1903a5,_0xc33723){_0xc33723=_0xc33723||0xcc;return function(_0x1cb56b){if(_0x1cb56b){return _0x1903a5[_0x5b14('0x19')](_0xc33723);}return _0x1903a5[_0x5b14('0x1a')](_0xc33723)['end']();};}function respondWithResult(_0x27b34b,_0x16f2a1){_0x16f2a1=_0x16f2a1||0xc8;return function(_0x35fb8b){if(_0x35fb8b){return _0x27b34b[_0x5b14('0x1a')](_0x16f2a1)[_0x5b14('0x1b')](_0x35fb8b);}};}function respondWithFilteredResult(_0x2a8fe5,_0x68f695){return function(_0xe5af75){if(_0xe5af75){var _0x183b0a=typeof _0x68f695[_0x5b14('0x1c')]===_0x5b14('0x1d')&&typeof _0x68f695[_0x5b14('0x1e')]==='undefined';var _0x24cfd0=_0xe5af75['count'];var _0x48d395=_0x183b0a?0x0:_0x68f695['offset'];var _0x3f397d=_0x183b0a?_0xe5af75[_0x5b14('0x1f')]:_0x68f695[_0x5b14('0x1c')]+_0x68f695[_0x5b14('0x1e')];var _0x3786f7;if(_0x3f397d>=_0x24cfd0){_0x3f397d=_0x24cfd0;_0x3786f7=0xc8;}else{_0x3786f7=0xce;}_0x2a8fe5[_0x5b14('0x1a')](_0x3786f7);return _0x2a8fe5[_0x5b14('0x20')]('Content-Range',_0x48d395+'-'+_0x3f397d+'/'+_0x24cfd0)['json'](_0xe5af75);}return null;};}function patchUpdates(_0x4fa079){return function(_0x4f4717){try{jsonpatch[_0x5b14('0x21')](_0x4f4717,_0x4fa079,!![]);}catch(_0x9a9495){return BPromise[_0x5b14('0x22')](_0x9a9495);}return _0x4f4717['save']();};}function saveUpdates(_0x1018d9,_0x1577f7){return function(_0x4857c7){if(_0x4857c7){return _0x4857c7[_0x5b14('0x23')](_0x1018d9)[_0x5b14('0x24')](function(_0x50951f){return _0x50951f;});}return null;};}function removeEntity(_0x33a293,_0x54073f){return function(_0x59282c){if(_0x59282c){return _0x59282c['destroy']()['then'](function(){_0x33a293[_0x5b14('0x1a')](0xcc)[_0x5b14('0x25')]();});}};}function handleEntityNotFound(_0x153a25,_0x5da505){return function(_0x46f86a){if(!_0x46f86a){_0x153a25[_0x5b14('0x19')](0x194);}return _0x46f86a;};}function handleError(_0x2ac7b0,_0x143648){_0x143648=_0x143648||0x1f4;return function(_0xe6851b){logger[_0x5b14('0x26')](_0xe6851b[_0x5b14('0x27')]);if(_0xe6851b[_0x5b14('0x28')]){delete _0xe6851b[_0x5b14('0x28')];}_0x2ac7b0[_0x5b14('0x1a')](_0x143648)[_0x5b14('0x29')](_0xe6851b);};}exports[_0x5b14('0x2a')]=function(_0x1c3c52,_0x266bbe){var _0x4cfd66={},_0x370fcd={},_0x18a76d={'count':0x0,'rows':[]};var _0x53b13d=_['map'](db[_0x5b14('0x2b')][_0x5b14('0x2c')],function(_0x5dca4f){return{'name':_0x5dca4f['fieldName'],'type':_0x5dca4f[_0x5b14('0x2d')]['key']};});_0x370fcd[_0x5b14('0x2e')]=_[_0x5b14('0x2f')](_0x53b13d,'name');_0x370fcd['query']=_[_0x5b14('0x30')](_0x1c3c52[_0x5b14('0x31')]);_0x370fcd[_0x5b14('0x32')]=_['intersection'](_0x370fcd[_0x5b14('0x2e')],_0x370fcd['query']);_0x4cfd66[_0x5b14('0x33')]=_[_0x5b14('0x34')](_0x370fcd[_0x5b14('0x2e')],qs[_0x5b14('0x35')](_0x1c3c52['query'][_0x5b14('0x35')]));_0x4cfd66[_0x5b14('0x33')]=_0x4cfd66[_0x5b14('0x33')][_0x5b14('0x36')]?_0x4cfd66['attributes']:_0x370fcd[_0x5b14('0x2e')];if(!_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x37')]('nolimit')){_0x4cfd66[_0x5b14('0x1e')]=qs['limit'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x1e')]);_0x4cfd66['offset']=qs[_0x5b14('0x1c')](_0x1c3c52[_0x5b14('0x31')]['offset']);}_0x4cfd66[_0x5b14('0x38')]=qs['sort'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x39')]);_0x4cfd66[_0x5b14('0x3a')]=qs[_0x5b14('0x32')](_['pick'](_0x1c3c52[_0x5b14('0x31')],_0x370fcd[_0x5b14('0x32')]),_0x53b13d);if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]){_0x4cfd66[_0x5b14('0x3a')]=_[_0x5b14('0x3c')](_0x4cfd66[_0x5b14('0x3a')],{'$or':_[_0x5b14('0x2f')](_0x53b13d,function(_0x4f647c){if(_0x4f647c[_0x5b14('0x2d')]!==_0x5b14('0x3d')){var _0x3f9d1d={};_0x3f9d1d[_0x4f647c[_0x5b14('0x28')]]={'$like':'%'+_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]+'%'};return _0x3f9d1d;}})});}_0x4cfd66=_[_0x5b14('0x3c')]({},_0x4cfd66,_0x1c3c52['options']);var _0x2ebaa8={'where':_0x4cfd66['where']};return db[_0x5b14('0x2b')][_0x5b14('0x1f')](_0x2ebaa8)['then'](function(_0x4c05ac){_0x18a76d['count']=_0x4c05ac;if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3e')]){_0x4cfd66['include']=[{'all':!![]}];}return db[_0x5b14('0x2b')][_0x5b14('0x3f')](_0x4cfd66);})[_0x5b14('0x24')](function(_0x3d0369){_0x18a76d[_0x5b14('0x40')]=_0x3d0369;return _0x18a76d;})['then'](respondWithFilteredResult(_0x266bbe,_0x4cfd66))[_0x5b14('0x41')](handleError(_0x266bbe,null));};exports[_0x5b14('0x42')]=function(_0x4fb46e,_0x996aee){var _0x985e69={'raw':!![],'where':{'id':_0x4fb46e[_0x5b14('0x43')]['id']}},_0x5cc257={};_0x5cc257['model']=_[_0x5b14('0x30')](db[_0x5b14('0x2b')][_0x5b14('0x2c')]);_0x5cc257[_0x5b14('0x31')]=_['keys'](_0x4fb46e[_0x5b14('0x31')]);_0x5cc257[_0x5b14('0x32')]=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],_0x5cc257['query']);_0x985e69['attributes']=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],qs['fields'](_0x4fb46e[_0x5b14('0x31')]['fields']));_0x985e69[_0x5b14('0x33')]=_0x985e69[_0x5b14('0x33')][_0x5b14('0x36')]?_0x985e69[_0x5b14('0x33')]:_0x5cc257[_0x5b14('0x2e')];if(_0x4fb46e['query'][_0x5b14('0x3e')]){_0x985e69[_0x5b14('0x44')]=[{'all':!![]}];}_0x985e69=_[_0x5b14('0x3c')]({},_0x985e69,_0x4fb46e[_0x5b14('0x45')]);return db[_0x5b14('0x2b')]['find'](_0x985e69)['then'](handleEntityNotFound(_0x996aee,null))[_0x5b14('0x24')](respondWithResult(_0x996aee,null))['catch'](handleError(_0x996aee,null));};exports['create']=function(_0x4825b4,_0x35d00d){return db[_0x5b14('0x2b')][_0x5b14('0x46')](_0x4825b4[_0x5b14('0x47')],{})[_0x5b14('0x24')](respondWithResult(_0x35d00d,0xc9))[_0x5b14('0x41')](handleError(_0x35d00d,null));};exports[_0x5b14('0x23')]=function(_0x4d2bee,_0x548e1c){if(_0x4d2bee['body']['id']){delete _0x4d2bee['body']['id'];}return db['MailQueueReport'][_0x5b14('0x48')]({'where':{'id':_0x4d2bee[_0x5b14('0x43')]['id']}})[_0x5b14('0x24')](handleEntityNotFound(_0x548e1c,null))[_0x5b14('0x24')](saveUpdates(_0x4d2bee[_0x5b14('0x47')],null))['then'](respondWithResult(_0x548e1c,null))['catch'](handleError(_0x548e1c,null));};exports[_0x5b14('0x49')]=function(_0xd6ea50,_0x58b18e){return db[_0x5b14('0x2b')][_0x5b14('0x48')]({'where':{'id':_0xd6ea50['params']['id']}})['then'](handleEntityNotFound(_0x58b18e,null))[_0x5b14('0x24')](removeEntity(_0x58b18e,null))[_0x5b14('0x41')](handleError(_0x58b18e,null));};exports[_0x5b14('0x4a')]=function(_0x5d3782,_0x1a51d5){return db[_0x5b14('0x2b')][_0x5b14('0x4a')]()[_0x5b14('0x24')](respondWithResult(_0x1a51d5,null))[_0x5b14('0x41')](handleError(_0x1a51d5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 571900b..4198c6a 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 _0xb238=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb238,0x71));var _0x8b23=function(_0x5722ad,_0x559789){_0x5722ad=_0x5722ad-0x0;var _0x1082da=_0xb238[_0x5722ad];return _0x1082da;};'use strict';var _=require(_0x8b23('0x0'));var util=require('util');var logger=require(_0x8b23('0x1'))(_0x8b23('0x2'));var moment=require(_0x8b23('0x3'));var BPromise=require(_0x8b23('0x4'));var rp=require(_0x8b23('0x5'));var fs=require('fs');var path=require(_0x8b23('0x6'));var rimraf=require(_0x8b23('0x7'));var config=require(_0x8b23('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x8b23('0x9')]=function(_0x3dbf57,_0x43561b){return _0x3dbf57[_0x8b23('0xa')](_0x8b23('0xb'),attributes,{'tableName':_0x8b23('0xc'),'paranoid':![],'indexes':[{'name':_0x8b23('0xd'),'fields':[_0x8b23('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85a7=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash'];(function(_0x2ae0f6,_0x29587f){var _0x442969=function(_0xc65006){while(--_0xc65006){_0x2ae0f6['push'](_0x2ae0f6['shift']());}};_0x442969(++_0x29587f);}(_0x85a7,0xa7));var _0x785a=function(_0x3a77de,_0x2bea85){_0x3a77de=_0x3a77de-0x0;var _0x382e0b=_0x85a7[_0x3a77de];return _0x382e0b;};'use strict';var _=require(_0x785a('0x0'));var util=require(_0x785a('0x1'));var logger=require(_0x785a('0x2'))(_0x785a('0x3'));var moment=require('moment');var BPromise=require(_0x785a('0x4'));var rp=require(_0x785a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x785a('0x6'));var config=require(_0x785a('0x7'));var attributes=require(_0x785a('0x8'));module['exports']=function(_0x2660b7,_0x2547d1){return _0x2660b7[_0x785a('0x9')](_0x785a('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x785a('0xb'),'fields':[_0x785a('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 2059ec6..0f2476d 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41d5ba,_0x9839c0){var _0x380f3f=function(_0x376545){while(--_0x376545){_0x41d5ba['push'](_0x41d5ba['shift']());}};_0x380f3f(++_0x9839c0);}(_0x326f,0xd1));var _0xf326=function(_0x441323,_0x177c71){_0x441323=_0x441323-0x0;var _0x4b8798=_0x326f[_0x441323];return _0x4b8798;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _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(_0xc5ca5c,_0x5c5f5e){var _0x224685=function(_0x51d3c7){while(--_0x51d3c7){_0xc5ca5c['push'](_0xc5ca5c['shift']());}};_0x224685(++_0x5c5f5e);}(_0x1261,0x144));var _0x1126=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x1261[_0x1b2255];return _0x33e57d;};'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 318ef6d..820422c 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ba733,_0x1f709d){var _0x542b07=function(_0x1870a8){while(--_0x1870a8){_0x1ba733['push'](_0x1ba733['shift']());}};_0x542b07(++_0x1f709d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x166cd7,_0x239594){var _0xbeb9aa=function(_0x4d776d){while(--_0x4d776d){_0x166cd7['push'](_0x166cd7['shift']());}};_0xbeb9aa(++_0x239594);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xcb91[_0x33155c];return _0x5becf7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index f19f9a0..69e00f9 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 _0x4ba9=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0x4ba9,0x96));var _0x94ba=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x4ba9[_0x2f71f6];return _0x2b23ea;};'use strict';var Sequelize=require(_0x94ba('0x0'));module[_0x94ba('0x1')]={'description':{'type':Sequelize[_0x94ba('0x2')]},'host':{'type':Sequelize[_0x94ba('0x2')]},'authentication':{'type':Sequelize[_0x94ba('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x94ba('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x94ba('0x4')]},'tls':{'type':Sequelize[_0x94ba('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x94ba('0x2')],'defaultValue':_0x94ba('0x5')},'connTimeout':{'type':Sequelize[_0x94ba('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x94ba('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x94ba('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1868=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x2a5541,_0x1324c3){var _0x54fd9e=function(_0x5f0142){while(--_0x5f0142){_0x2a5541['push'](_0x2a5541['shift']());}};_0x54fd9e(++_0x1324c3);}(_0x1868,0x9e));var _0x8186=function(_0x150dd7,_0x101b5d){_0x150dd7=_0x150dd7-0x0;var _0x557d30=_0x1868[_0x150dd7];return _0x557d30;};'use strict';var Sequelize=require(_0x8186('0x0'));module['exports']={'description':{'type':Sequelize[_0x8186('0x1')]},'host':{'type':Sequelize[_0x8186('0x1')]},'authentication':{'type':Sequelize[_0x8186('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8186('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8186('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x8186('0x4')},'connTimeout':{'type':Sequelize[_0x8186('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x8186('0x1')]},'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 9ad2648..45cb337 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 _0xd0e9=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd0e9,0x78));var _0x9d0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd0e9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9d0e('0x0'));var util=require(_0x9d0e('0x1'));var logger=require(_0x9d0e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9d0e('0x3'));var rp=require(_0x9d0e('0x4'));var fs=require('fs');var path=require(_0x9d0e('0x5'));var rimraf=require(_0x9d0e('0x6'));var config=require(_0x9d0e('0x7'));var attributes=require(_0x9d0e('0x8'));module['exports']=function(_0x54f091,_0x3d709d){return _0x54f091['define'](_0x9d0e('0x9'),attributes,{'tableName':_0x9d0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a39=['MailServerIn','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a39,0x19b));var _0x97a3=function(_0x3b75a4,_0x59831b){_0x3b75a4=_0x3b75a4-0x0;var _0x1d318a=_0x7a39[_0x3b75a4];return _0x1d318a;};'use strict';var _=require(_0x97a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97a3('0x1'));var moment=require('moment');var BPromise=require(_0x97a3('0x2'));var rp=require(_0x97a3('0x3'));var fs=require('fs');var path=require(_0x97a3('0x4'));var rimraf=require(_0x97a3('0x5'));var config=require(_0x97a3('0x6'));var attributes=require(_0x97a3('0x7'));module[_0x97a3('0x8')]=function(_0x2438f9,_0x3cc609){return _0x2438f9['define'](_0x97a3('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5d96af6..85509ce 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 _0x7d72=['GetMailServerIn','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','limit','include','map','attributes','model'];(function(_0x339ca0,_0x13a77a){var _0x5e34da=function(_0x39f789){while(--_0x39f789){_0x339ca0['push'](_0x339ca0['shift']());}};_0x5e34da(++_0x13a77a);}(_0x7d72,0x1e1));var _0x27d7=function(_0xdd55f7,_0x5d036c){_0xdd55f7=_0xdd55f7-0x0;var _0x53fdb9=_0x7d72[_0xdd55f7];return _0x53fdb9;};'use strict';var _=require('lodash');var util=require(_0x27d7('0x0'));var moment=require(_0x27d7('0x1'));var BPromise=require(_0x27d7('0x2'));var rs=require(_0x27d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x27d7('0x4'));var logger=require('../../config/logger')(_0x27d7('0x5'));var config=require(_0x27d7('0x6'));var jayson=require(_0x27d7('0x7'));var client=jayson['client'][_0x27d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dcb59,_0x13146c,_0x633f40){return new BPromise(function(_0x148be8,_0x4e33b8){return client[_0x27d7('0x9')](_0x4dcb59,_0x633f40)[_0x27d7('0xa')](function(_0x41485c){logger[_0x27d7('0xb')](_0x27d7('0xc'),_0x13146c,'request\x20sent');logger[_0x27d7('0xd')](_0x27d7('0xe'),_0x13146c,_0x27d7('0xf'),JSON[_0x27d7('0x10')](_0x41485c));if(_0x41485c[_0x27d7('0x11')]){if(_0x41485c[_0x27d7('0x11')][_0x27d7('0x12')]===0x1f4){logger[_0x27d7('0x11')](_0x27d7('0xc'),_0x13146c,_0x41485c[_0x27d7('0x11')][_0x27d7('0x13')]);return _0x4e33b8(_0x41485c[_0x27d7('0x11')][_0x27d7('0x13')]);}logger[_0x27d7('0x11')](_0x27d7('0xc'),_0x13146c,_0x41485c[_0x27d7('0x11')][_0x27d7('0x13')]);return _0x148be8(_0x41485c[_0x27d7('0x11')]['message']);}else{logger[_0x27d7('0xb')](_0x27d7('0xc'),_0x13146c,_0x27d7('0xf'));_0x148be8(_0x41485c[_0x27d7('0x14')][_0x27d7('0x13')]);}})[_0x27d7('0x15')](function(_0x5dc9e9){logger['error'](_0x27d7('0xc'),_0x13146c,_0x5dc9e9);_0x4e33b8(_0x5dc9e9);});});}exports['GetMailServerIn']=function(_0x2cbc18){var _0xb7120=this;return new Promise(function(_0x102055,_0x1b4606){return db[_0x27d7('0x16')][_0x27d7('0x17')]({'raw':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18[_0x27d7('0x18')][_0x27d7('0x19')]===undefined?!![]:![]:!![],'where':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18[_0x27d7('0x18')]['where']||null:null,'attributes':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18['options']['attributes']||null:null,'limit':_0x2cbc18['options']?_0x2cbc18[_0x27d7('0x18')][_0x27d7('0x1a')]||null:null,'include':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18['options'][_0x27d7('0x1b')]?_[_0x27d7('0x1c')](_0x2cbc18['options'][_0x27d7('0x1b')],function(_0x42e1a6){return{'model':db[_0x42e1a6['model']],'as':_0x42e1a6['as'],'attributes':_0x42e1a6[_0x27d7('0x1d')],'include':_0x42e1a6[_0x27d7('0x1b')]?_[_0x27d7('0x1c')](_0x42e1a6[_0x27d7('0x1b')],function(_0x52c755){return{'model':db[_0x52c755['model']],'as':_0x52c755['as'],'attributes':_0x52c755[_0x27d7('0x1d')],'include':_0x52c755[_0x27d7('0x1b')]?_[_0x27d7('0x1c')](_0x52c755[_0x27d7('0x1b')],function(_0x209bc6){return{'model':db[_0x209bc6[_0x27d7('0x1e')]],'as':_0x209bc6['as'],'attributes':_0x209bc6['attributes']};}):[]};}):[]};}):[]:[]})[_0x27d7('0xa')](function(_0x43353a){logger[_0x27d7('0xb')](_0x27d7('0x1f'),_0x2cbc18);logger[_0x27d7('0xd')](_0x27d7('0x1f'),_0x2cbc18,JSON[_0x27d7('0x10')](_0x43353a));_0x102055(_0x43353a);})[_0x27d7('0x15')](function(_0xb6b889){logger[_0x27d7('0x11')]('GetMailServerIn',_0xb6b889[_0x27d7('0x13')],_0x2cbc18);_0x1b4606(_0xb7120[_0x27d7('0x11')](0x1f4,_0xb6b889[_0x27d7('0x13')]));});});}; \ No newline at end of file +var _0xf17f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','debug','lodash','util','moment','randomstring'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xf17f,0x113));var _0xff17=function(_0x2d284c,_0x59aa64){_0x2d284c=_0x2d284c-0x0;var _0x4f5756=_0xf17f[_0x2d284c];return _0x4f5756;};'use strict';var _=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var moment=require(_0xff17('0x2'));var BPromise=require('bluebird');var rs=require(_0xff17('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff17('0x4'));var logger=require(_0xff17('0x5'))(_0xff17('0x6'));var config=require(_0xff17('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff17('0x8')][_0xff17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53788c,_0xdc0d13,_0x3a264d){return new BPromise(function(_0x58e9f8,_0x23d331){return client[_0xff17('0xa')](_0x53788c,_0x3a264d)[_0xff17('0xb')](function(_0x4faa51){logger[_0xff17('0xc')](_0xff17('0xd'),_0xdc0d13,_0xff17('0xe'));logger['debug'](_0xff17('0xf'),_0xdc0d13,_0xff17('0xe'),JSON[_0xff17('0x10')](_0x4faa51));if(_0x4faa51[_0xff17('0x11')]){if(_0x4faa51['error']['code']===0x1f4){logger[_0xff17('0x11')](_0xff17('0xd'),_0xdc0d13,_0x4faa51[_0xff17('0x11')]['message']);return _0x23d331(_0x4faa51[_0xff17('0x11')][_0xff17('0x12')]);}logger['error'](_0xff17('0xd'),_0xdc0d13,_0x4faa51[_0xff17('0x11')]['message']);return _0x58e9f8(_0x4faa51['error']['message']);}else{logger[_0xff17('0xc')]('MailServerIn,\x20%s,\x20%s',_0xdc0d13,_0xff17('0xe'));_0x58e9f8(_0x4faa51[_0xff17('0x13')][_0xff17('0x12')]);}})[_0xff17('0x14')](function(_0x29aae9){logger['error'](_0xff17('0xd'),_0xdc0d13,_0x29aae9);_0x23d331(_0x29aae9);});});}exports[_0xff17('0x15')]=function(_0x6365e8){var _0x594830=this;return new Promise(function(_0x5c33b8,_0x1950ff){return db[_0xff17('0x16')][_0xff17('0x17')]({'raw':_0x6365e8['options']?_0x6365e8['options']['raw']===undefined?!![]:![]:!![],'where':_0x6365e8['options']?_0x6365e8[_0xff17('0x18')]['where']||null:null,'attributes':_0x6365e8[_0xff17('0x18')]?_0x6365e8[_0xff17('0x18')][_0xff17('0x19')]||null:null,'limit':_0x6365e8['options']?_0x6365e8[_0xff17('0x18')][_0xff17('0x1a')]||null:null,'include':_0x6365e8['options']?_0x6365e8['options'][_0xff17('0x1b')]?_[_0xff17('0x1c')](_0x6365e8[_0xff17('0x18')]['include'],function(_0x594018){return{'model':db[_0x594018[_0xff17('0x1d')]],'as':_0x594018['as'],'attributes':_0x594018[_0xff17('0x19')],'include':_0x594018[_0xff17('0x1b')]?_[_0xff17('0x1c')](_0x594018['include'],function(_0x10cd49){return{'model':db[_0x10cd49[_0xff17('0x1d')]],'as':_0x10cd49['as'],'attributes':_0x10cd49['attributes'],'include':_0x10cd49[_0xff17('0x1b')]?_[_0xff17('0x1c')](_0x10cd49['include'],function(_0x301511){return{'model':db[_0x301511['model']],'as':_0x301511['as'],'attributes':_0x301511['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4138e3){logger[_0xff17('0xc')](_0xff17('0x15'),_0x6365e8);logger[_0xff17('0x1e')](_0xff17('0x15'),_0x6365e8,JSON[_0xff17('0x10')](_0x4138e3));_0x5c33b8(_0x4138e3);})[_0xff17('0x14')](function(_0x21dcbf){logger[_0xff17('0x11')](_0xff17('0x15'),_0x21dcbf['message'],_0x6365e8);_0x1950ff(_0x594830[_0xff17('0x11')](0x1f4,_0x21dcbf[_0xff17('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c604c76..6f336cc 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(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x7a54,0x106));var _0x47a5=function(_0x1369b0,_0x5db07e){_0x1369b0=_0x1369b0-0x0;var _0x3a6b79=_0x7a54[_0x1369b0];return _0x3a6b79;};'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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x1d2cf3,_0x366f39){_0x1d2cf3=_0x1d2cf3-0x0;var _0x907000=_0x7a54[_0x1d2cf3];return _0x907000;};'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 d0b786d..cf09612 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 _0xc900=['INTEGER','BOOLEAN','STRING'];(function(_0x8d0cde,_0x5018af){var _0x538af1=function(_0x20b048){while(--_0x20b048){_0x8d0cde['push'](_0x8d0cde['shift']());}};_0x538af1(++_0x5018af);}(_0xc900,0xb3));var _0x0c90=function(_0x26215b,_0x52270d){_0x26215b=_0x26215b-0x0;var _0x358b16=_0xc900[_0x26215b];return _0x358b16;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0c90('0x0')]},'host':{'type':Sequelize[_0x0c90('0x0')]},'user':{'type':Sequelize[_0x0c90('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0c90('0x1')]},'secure':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x02ce=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5615d1,_0x5accf0){var _0x30b90a=function(_0x452a52){while(--_0x452a52){_0x5615d1['push'](_0x5615d1['shift']());}};_0x30b90a(++_0x5accf0);}(_0x02ce,0x1ac));var _0xe02c=function(_0x23e8bd,_0x499264){_0x23e8bd=_0x23e8bd-0x0;var _0x49731a=_0x02ce[_0x23e8bd];return _0x49731a;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'description':{'type':Sequelize[_0xe02c('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe02c('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe02c('0x3')]},'secure':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xe02c('0x2')]},'authentication':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe02c('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 005eff7..b33d5a3 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 _0xfe9f=['MailServerOut','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','merge','filter','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index'];(function(_0x1c86af,_0x40f50d){var _0xbdd025=function(_0xd168a4){while(--_0xd168a4){_0x1c86af['push'](_0x1c86af['shift']());}};_0xbdd025(++_0x40f50d);}(_0xfe9f,0x1af));var _0xffe9=function(_0x5627bb,_0x20c6e5){_0x5627bb=_0x5627bb-0x0;var _0x1b2839=_0xfe9f[_0x5627bb];return _0x1b2839;};'use strict';var emlformat=require(_0xffe9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xffe9('0x1'));var moment=require(_0xffe9('0x2'));var BPromise=require(_0xffe9('0x3'));var Mustache=require(_0xffe9('0x4'));var util=require('util');var path=require(_0xffe9('0x5'));var sox=require(_0xffe9('0x6'));var csv=require(_0xffe9('0x7'));var ejs=require(_0xffe9('0x8'));var fs=require('fs');var fs_extra=require(_0xffe9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xffe9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xffe9('0xb'));var toCsv=require(_0xffe9('0x7'));var querystring=require('querystring');var Papa=require(_0xffe9('0xc'));var Redis=require(_0xffe9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xffe9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xffe9('0xf'))('api');var utils=require(_0xffe9('0x10'));var config=require(_0xffe9('0x11'));var licenseUtil=require(_0xffe9('0x12'));var db=require(_0xffe9('0x13'))['db'];function respondWithStatusCode(_0x537ed5,_0x13e6b3){_0x13e6b3=_0x13e6b3||0xcc;return function(_0x38a88b){if(_0x38a88b){return _0x537ed5['sendStatus'](_0x13e6b3);}return _0x537ed5[_0xffe9('0x14')](_0x13e6b3)['end']();};}function respondWithResult(_0x15c554,_0x291737){_0x291737=_0x291737||0xc8;return function(_0x1090a4){if(_0x1090a4){return _0x15c554[_0xffe9('0x14')](_0x291737)[_0xffe9('0x15')](_0x1090a4);}};}function respondWithFilteredResult(_0x4f2139,_0x31b0c0){return function(_0x5c9b8b){if(_0x5c9b8b){var _0x1f2a6f=typeof _0x31b0c0['offset']===_0xffe9('0x16')&&typeof _0x31b0c0['limit']==='undefined';var _0x274138=_0x5c9b8b[_0xffe9('0x17')];var _0x56691d=_0x1f2a6f?0x0:_0x31b0c0['offset'];var _0x3cd5f5=_0x1f2a6f?_0x5c9b8b[_0xffe9('0x17')]:_0x31b0c0[_0xffe9('0x18')]+_0x31b0c0[_0xffe9('0x19')];var _0x4f0c7f;if(_0x3cd5f5>=_0x274138){_0x3cd5f5=_0x274138;_0x4f0c7f=0xc8;}else{_0x4f0c7f=0xce;}_0x4f2139['status'](_0x4f0c7f);return _0x4f2139[_0xffe9('0x1a')](_0xffe9('0x1b'),_0x56691d+'-'+_0x3cd5f5+'/'+_0x274138)[_0xffe9('0x15')](_0x5c9b8b);}return null;};}function patchUpdates(_0x293492){return function(_0x86ea7e){try{jsonpatch[_0xffe9('0x1c')](_0x86ea7e,_0x293492,!![]);}catch(_0x277d69){return BPromise[_0xffe9('0x1d')](_0x277d69);}return _0x86ea7e['save']();};}function saveUpdates(_0x27a9f0,_0x1abbf0){return function(_0x4151dc){if(_0x4151dc){return _0x4151dc[_0xffe9('0x1e')](_0x27a9f0)['then'](function(_0x269597){return _0x269597;});}return null;};}function removeEntity(_0x340e16,_0x1f595f){return function(_0x11abea){if(_0x11abea){return _0x11abea['destroy']()[_0xffe9('0x1f')](function(){_0x340e16[_0xffe9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ab3c,_0x35e984){return function(_0x21cef3){if(!_0x21cef3){_0x24ab3c[_0xffe9('0x20')](0x194);}return _0x21cef3;};}function handleError(_0x1b4077,_0x46d4af){_0x46d4af=_0x46d4af||0x1f4;return function(_0x395578){logger[_0xffe9('0x21')](_0x395578[_0xffe9('0x22')]);if(_0x395578[_0xffe9('0x23')]){delete _0x395578[_0xffe9('0x23')];}_0x1b4077['status'](_0x46d4af)[_0xffe9('0x24')](_0x395578);};}exports[_0xffe9('0x25')]=function(_0x1ce66a,_0x1aaae1){var _0x4e6e26={},_0x59537a={},_0x177c1d={'count':0x0,'rows':[]};var _0x739c57=_['map'](db[_0xffe9('0x26')][_0xffe9('0x27')],function(_0x4d71a8){return{'name':_0x4d71a8[_0xffe9('0x28')],'type':_0x4d71a8[_0xffe9('0x29')]['key']};});_0x59537a[_0xffe9('0x2a')]=_[_0xffe9('0x2b')](_0x739c57,_0xffe9('0x23'));_0x59537a[_0xffe9('0x2c')]=_['keys'](_0x1ce66a['query']);_0x59537a['filters']=_[_0xffe9('0x2d')](_0x59537a['model'],_0x59537a['query']);_0x4e6e26[_0xffe9('0x2e')]=_['intersection'](_0x59537a[_0xffe9('0x2a')],qs[_0xffe9('0x2f')](_0x1ce66a[_0xffe9('0x2c')][_0xffe9('0x2f')]));_0x4e6e26[_0xffe9('0x2e')]=_0x4e6e26['attributes'][_0xffe9('0x30')]?_0x4e6e26['attributes']:_0x59537a[_0xffe9('0x2a')];if(!_0x1ce66a[_0xffe9('0x2c')]['hasOwnProperty'](_0xffe9('0x31'))){_0x4e6e26['limit']=qs[_0xffe9('0x19')](_0x1ce66a['query'][_0xffe9('0x19')]);_0x4e6e26['offset']=qs[_0xffe9('0x18')](_0x1ce66a['query'][_0xffe9('0x18')]);}_0x4e6e26['order']=qs[_0xffe9('0x32')](_0x1ce66a['query']['sort']);_0x4e6e26[_0xffe9('0x33')]=qs['filters'](_[_0xffe9('0x34')](_0x1ce66a[_0xffe9('0x2c')],_0x59537a[_0xffe9('0x35')]),_0x739c57);if(_0x1ce66a[_0xffe9('0x2c')]['filter']){_0x4e6e26[_0xffe9('0x33')]=_[_0xffe9('0x36')](_0x4e6e26[_0xffe9('0x33')],{'$or':_[_0xffe9('0x2b')](_0x739c57,function(_0x2fe900){if(_0x2fe900[_0xffe9('0x29')]!=='VIRTUAL'){var _0x437aaa={};_0x437aaa[_0x2fe900[_0xffe9('0x23')]]={'$like':'%'+_0x1ce66a[_0xffe9('0x2c')][_0xffe9('0x37')]+'%'};return _0x437aaa;}})});}_0x4e6e26=_[_0xffe9('0x36')]({},_0x4e6e26,_0x1ce66a['options']);var _0x2d1f81={'where':_0x4e6e26[_0xffe9('0x33')]};return db['MailServerOut'][_0xffe9('0x17')](_0x2d1f81)[_0xffe9('0x1f')](function(_0x2bf364){_0x177c1d['count']=_0x2bf364;if(_0x1ce66a[_0xffe9('0x2c')][_0xffe9('0x38')]){_0x4e6e26['include']=[{'all':!![]}];}return db[_0xffe9('0x26')][_0xffe9('0x39')](_0x4e6e26);})[_0xffe9('0x1f')](function(_0x3df42f){_0x177c1d['rows']=_0x3df42f;return _0x177c1d;})[_0xffe9('0x1f')](respondWithFilteredResult(_0x1aaae1,_0x4e6e26))[_0xffe9('0x3a')](handleError(_0x1aaae1,null));};exports[_0xffe9('0x3b')]=function(_0x23b70e,_0x84bfd8){var _0x3ecc00={'raw':!![],'where':{'id':_0x23b70e[_0xffe9('0x3c')]['id']}},_0x33063={};_0x33063['model']=_[_0xffe9('0x3d')](db['MailServerOut'][_0xffe9('0x27')]);_0x33063[_0xffe9('0x2c')]=_[_0xffe9('0x3d')](_0x23b70e[_0xffe9('0x2c')]);_0x33063[_0xffe9('0x35')]=_[_0xffe9('0x2d')](_0x33063['model'],_0x33063['query']);_0x3ecc00[_0xffe9('0x2e')]=_[_0xffe9('0x2d')](_0x33063[_0xffe9('0x2a')],qs[_0xffe9('0x2f')](_0x23b70e['query'][_0xffe9('0x2f')]));_0x3ecc00[_0xffe9('0x2e')]=_0x3ecc00['attributes']['length']?_0x3ecc00[_0xffe9('0x2e')]:_0x33063[_0xffe9('0x2a')];if(_0x23b70e[_0xffe9('0x2c')][_0xffe9('0x38')]){_0x3ecc00[_0xffe9('0x3e')]=[{'all':!![]}];}_0x3ecc00=_[_0xffe9('0x36')]({},_0x3ecc00,_0x23b70e[_0xffe9('0x3f')]);return db[_0xffe9('0x26')][_0xffe9('0x40')](_0x3ecc00)[_0xffe9('0x1f')](handleEntityNotFound(_0x84bfd8,null))[_0xffe9('0x1f')](respondWithResult(_0x84bfd8,null))['catch'](handleError(_0x84bfd8,null));};exports[_0xffe9('0x41')]=function(_0x5abbef,_0x3be068){return db[_0xffe9('0x26')][_0xffe9('0x41')](_0x5abbef[_0xffe9('0x42')],{})[_0xffe9('0x1f')](respondWithResult(_0x3be068,0xc9))[_0xffe9('0x3a')](handleError(_0x3be068,null));};exports['update']=function(_0xda8978,_0x47ae23){if(_0xda8978[_0xffe9('0x42')]['id']){delete _0xda8978[_0xffe9('0x42')]['id'];}return db[_0xffe9('0x26')][_0xffe9('0x40')]({'where':{'id':_0xda8978[_0xffe9('0x3c')]['id']}})[_0xffe9('0x1f')](handleEntityNotFound(_0x47ae23,null))[_0xffe9('0x1f')](saveUpdates(_0xda8978[_0xffe9('0x42')],null))[_0xffe9('0x1f')](respondWithResult(_0x47ae23,null))[_0xffe9('0x3a')](handleError(_0x47ae23,null));};exports['destroy']=function(_0x16862c,_0x30fe62){return db[_0xffe9('0x26')][_0xffe9('0x40')]({'where':{'id':_0x16862c['params']['id']}})['then'](handleEntityNotFound(_0x30fe62,null))[_0xffe9('0x1f')](removeEntity(_0x30fe62,null))[_0xffe9('0x3a')](handleError(_0x30fe62,null));}; \ No newline at end of file +var _0x965a=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','MailServerOut','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','catch','params','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x965a,0xb2));var _0xa965=function(_0x194e35,_0x43a4ec){_0x194e35=_0x194e35-0x0;var _0x2ff28e=_0x965a[_0x194e35];return _0x2ff28e;};'use strict';var emlformat=require(_0xa965('0x0'));var rimraf=require(_0xa965('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa965('0x2'));var rp=require(_0xa965('0x3'));var moment=require('moment');var BPromise=require(_0xa965('0x4'));var Mustache=require(_0xa965('0x5'));var util=require(_0xa965('0x6'));var path=require('path');var sox=require(_0xa965('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa965('0x8'));var squel=require(_0xa965('0x9'));var crypto=require(_0xa965('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa965('0xb'));var toCsv=require(_0xa965('0xc'));var querystring=require('querystring');var Papa=require(_0xa965('0xd'));var Redis=require('ioredis');var authService=require(_0xa965('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa965('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa965('0x10'))(_0xa965('0x11'));var utils=require(_0xa965('0x12'));var config=require(_0xa965('0x13'));var licenseUtil=require(_0xa965('0x14'));var db=require(_0xa965('0x15'))['db'];function respondWithStatusCode(_0x230efe,_0x3fd4b1){_0x3fd4b1=_0x3fd4b1||0xcc;return function(_0x3e3cd3){if(_0x3e3cd3){return _0x230efe[_0xa965('0x16')](_0x3fd4b1);}return _0x230efe[_0xa965('0x17')](_0x3fd4b1)[_0xa965('0x18')]();};}function respondWithResult(_0x4dd140,_0x11dfe6){_0x11dfe6=_0x11dfe6||0xc8;return function(_0x2187dd){if(_0x2187dd){return _0x4dd140['status'](_0x11dfe6)[_0xa965('0x19')](_0x2187dd);}};}function respondWithFilteredResult(_0x6af163,_0xa72a0){return function(_0x1230ef){if(_0x1230ef){var _0x5c2bf8=typeof _0xa72a0[_0xa965('0x1a')]===_0xa965('0x1b')&&typeof _0xa72a0[_0xa965('0x1c')]===_0xa965('0x1b');var _0x2bfc77=_0x1230ef[_0xa965('0x1d')];var _0x2d3306=_0x5c2bf8?0x0:_0xa72a0[_0xa965('0x1a')];var _0x491dc4=_0x5c2bf8?_0x1230ef[_0xa965('0x1d')]:_0xa72a0[_0xa965('0x1a')]+_0xa72a0[_0xa965('0x1c')];var _0x8b5ba0;if(_0x491dc4>=_0x2bfc77){_0x491dc4=_0x2bfc77;_0x8b5ba0=0xc8;}else{_0x8b5ba0=0xce;}_0x6af163[_0xa965('0x17')](_0x8b5ba0);return _0x6af163[_0xa965('0x1e')](_0xa965('0x1f'),_0x2d3306+'-'+_0x491dc4+'/'+_0x2bfc77)[_0xa965('0x19')](_0x1230ef);}return null;};}function patchUpdates(_0x40a413){return function(_0x32aa7c){try{jsonpatch[_0xa965('0x20')](_0x32aa7c,_0x40a413,!![]);}catch(_0x5600e1){return BPromise[_0xa965('0x21')](_0x5600e1);}return _0x32aa7c[_0xa965('0x22')]();};}function saveUpdates(_0x4174f9,_0x52bf6d){return function(_0x598f78){if(_0x598f78){return _0x598f78['update'](_0x4174f9)['then'](function(_0x1ff553){return _0x1ff553;});}return null;};}function removeEntity(_0x52e265,_0x48c75d){return function(_0x1591fc){if(_0x1591fc){return _0x1591fc[_0xa965('0x23')]()[_0xa965('0x24')](function(){_0x52e265[_0xa965('0x17')](0xcc)[_0xa965('0x18')]();});}};}function handleEntityNotFound(_0x2b620e,_0xcc2516){return function(_0x1b9d25){if(!_0x1b9d25){_0x2b620e['sendStatus'](0x194);}return _0x1b9d25;};}function handleError(_0x38236a,_0x18b910){_0x18b910=_0x18b910||0x1f4;return function(_0x50aaad){logger['error'](_0x50aaad[_0xa965('0x25')]);if(_0x50aaad[_0xa965('0x26')]){delete _0x50aaad[_0xa965('0x26')];}_0x38236a[_0xa965('0x17')](_0x18b910)[_0xa965('0x27')](_0x50aaad);};}exports['index']=function(_0x1f6e58,_0x137115){var _0x259000={},_0xa11262={},_0x2420de={'count':0x0,'rows':[]};var _0x2e4681=_['map'](db[_0xa965('0x28')][_0xa965('0x29')],function(_0x263b81){return{'name':_0x263b81['fieldName'],'type':_0x263b81[_0xa965('0x2a')]['key']};});_0xa11262[_0xa965('0x2b')]=_['map'](_0x2e4681,_0xa965('0x26'));_0xa11262[_0xa965('0x2c')]=_[_0xa965('0x2d')](_0x1f6e58[_0xa965('0x2c')]);_0xa11262[_0xa965('0x2e')]=_[_0xa965('0x2f')](_0xa11262[_0xa965('0x2b')],_0xa11262['query']);_0x259000['attributes']=_[_0xa965('0x2f')](_0xa11262['model'],qs[_0xa965('0x30')](_0x1f6e58[_0xa965('0x2c')]['fields']));_0x259000['attributes']=_0x259000[_0xa965('0x31')][_0xa965('0x32')]?_0x259000[_0xa965('0x31')]:_0xa11262[_0xa965('0x2b')];if(!_0x1f6e58['query'][_0xa965('0x33')](_0xa965('0x34'))){_0x259000[_0xa965('0x1c')]=qs[_0xa965('0x1c')](_0x1f6e58[_0xa965('0x2c')][_0xa965('0x1c')]);_0x259000[_0xa965('0x1a')]=qs[_0xa965('0x1a')](_0x1f6e58[_0xa965('0x2c')]['offset']);}_0x259000['order']=qs[_0xa965('0x35')](_0x1f6e58[_0xa965('0x2c')][_0xa965('0x35')]);_0x259000[_0xa965('0x36')]=qs[_0xa965('0x2e')](_['pick'](_0x1f6e58[_0xa965('0x2c')],_0xa11262[_0xa965('0x2e')]),_0x2e4681);if(_0x1f6e58[_0xa965('0x2c')][_0xa965('0x37')]){_0x259000['where']=_[_0xa965('0x38')](_0x259000['where'],{'$or':_[_0xa965('0x39')](_0x2e4681,function(_0x29eb1b){if(_0x29eb1b[_0xa965('0x2a')]!==_0xa965('0x3a')){var _0x48c809={};_0x48c809[_0x29eb1b[_0xa965('0x26')]]={'$like':'%'+_0x1f6e58[_0xa965('0x2c')][_0xa965('0x37')]+'%'};return _0x48c809;}})});}_0x259000=_['merge']({},_0x259000,_0x1f6e58[_0xa965('0x3b')]);var _0x3ea598={'where':_0x259000[_0xa965('0x36')]};return db[_0xa965('0x28')]['count'](_0x3ea598)[_0xa965('0x24')](function(_0x45f178){_0x2420de['count']=_0x45f178;if(_0x1f6e58[_0xa965('0x2c')][_0xa965('0x3c')]){_0x259000[_0xa965('0x3d')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x259000);})['then'](function(_0x555052){_0x2420de['rows']=_0x555052;return _0x2420de;})[_0xa965('0x24')](respondWithFilteredResult(_0x137115,_0x259000))[_0xa965('0x3e')](handleError(_0x137115,null));};exports['show']=function(_0x8069c3,_0x5b7efc){var _0x52c10a={'raw':!![],'where':{'id':_0x8069c3[_0xa965('0x3f')]['id']}},_0x593730={};_0x593730[_0xa965('0x2b')]=_[_0xa965('0x2d')](db[_0xa965('0x28')][_0xa965('0x29')]);_0x593730[_0xa965('0x2c')]=_[_0xa965('0x2d')](_0x8069c3[_0xa965('0x2c')]);_0x593730[_0xa965('0x2e')]=_['intersection'](_0x593730['model'],_0x593730['query']);_0x52c10a[_0xa965('0x31')]=_[_0xa965('0x2f')](_0x593730[_0xa965('0x2b')],qs[_0xa965('0x30')](_0x8069c3[_0xa965('0x2c')]['fields']));_0x52c10a['attributes']=_0x52c10a[_0xa965('0x31')][_0xa965('0x32')]?_0x52c10a[_0xa965('0x31')]:_0x593730[_0xa965('0x2b')];if(_0x8069c3[_0xa965('0x2c')]['includeAll']){_0x52c10a[_0xa965('0x3d')]=[{'all':!![]}];}_0x52c10a=_[_0xa965('0x38')]({},_0x52c10a,_0x8069c3['options']);return db['MailServerOut'][_0xa965('0x40')](_0x52c10a)[_0xa965('0x24')](handleEntityNotFound(_0x5b7efc,null))[_0xa965('0x24')](respondWithResult(_0x5b7efc,null))['catch'](handleError(_0x5b7efc,null));};exports[_0xa965('0x41')]=function(_0x5bb1b9,_0x5deb3f){return db[_0xa965('0x28')][_0xa965('0x41')](_0x5bb1b9['body'],{})[_0xa965('0x24')](respondWithResult(_0x5deb3f,0xc9))[_0xa965('0x3e')](handleError(_0x5deb3f,null));};exports[_0xa965('0x42')]=function(_0x4603c0,_0x488497){if(_0x4603c0[_0xa965('0x43')]['id']){delete _0x4603c0[_0xa965('0x43')]['id'];}return db[_0xa965('0x28')][_0xa965('0x40')]({'where':{'id':_0x4603c0[_0xa965('0x3f')]['id']}})[_0xa965('0x24')](handleEntityNotFound(_0x488497,null))[_0xa965('0x24')](saveUpdates(_0x4603c0[_0xa965('0x43')],null))[_0xa965('0x24')](respondWithResult(_0x488497,null))[_0xa965('0x3e')](handleError(_0x488497,null));};exports['destroy']=function(_0x457a7c,_0xbc1e39){return db[_0xa965('0x28')][_0xa965('0x40')]({'where':{'id':_0x457a7c[_0xa965('0x3f')]['id']}})['then'](handleEntityNotFound(_0xbc1e39,null))['then'](removeEntity(_0xbc1e39,null))[_0xa965('0x3e')](handleError(_0xbc1e39,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f73b75f..2044d5f 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 _0xe10c=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x579a0f,_0x59500c){var _0x596c13=function(_0x8b04aa){while(--_0x8b04aa){_0x579a0f['push'](_0x579a0f['shift']());}};_0x596c13(++_0x59500c);}(_0xe10c,0x120));var _0xce10=function(_0x4194dc,_0x2e170e){_0x4194dc=_0x4194dc-0x0;var _0x4febe4=_0xe10c[_0x4194dc];return _0x4febe4;};'use strict';var _=require(_0xce10('0x0'));var util=require(_0xce10('0x1'));var logger=require(_0xce10('0x2'))(_0xce10('0x3'));var moment=require(_0xce10('0x4'));var BPromise=require(_0xce10('0x5'));var rp=require(_0xce10('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce10('0x7'));var config=require(_0xce10('0x8'));var attributes=require(_0xce10('0x9'));module[_0xce10('0xa')]=function(_0x4a6502,_0x3613e3){return _0x4a6502['define'](_0xce10('0xb'),attributes,{'tableName':_0xce10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2364=['./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x2364,0x122));var _0x4236=function(_0x31bae8,_0xb97ec3){_0x31bae8=_0x31bae8-0x0;var _0x5dec73=_0x2364[_0x31bae8];return _0x5dec73;};'use strict';var _=require(_0x4236('0x0'));var util=require(_0x4236('0x1'));var logger=require(_0x4236('0x2'))(_0x4236('0x3'));var moment=require(_0x4236('0x4'));var BPromise=require(_0x4236('0x5'));var rp=require(_0x4236('0x6'));var fs=require('fs');var path=require(_0x4236('0x7'));var rimraf=require(_0x4236('0x8'));var config=require('../../config/environment');var attributes=require(_0x4236('0x9'));module['exports']=function(_0x35151a,_0x143bd7){return _0x35151a[_0x4236('0xa')](_0x4236('0xb'),attributes,{'tableName':_0x4236('0xc'),'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 b956d57..6609abe 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x53772f,_0x3cb20c){var _0x43062a=function(_0xfffe5d){while(--_0xfffe5d){_0x53772f['push'](_0x53772f['shift']());}};_0x43062a(++_0x3cb20c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x3b5658,_0x595a3a){_0x3b5658=_0x3b5658-0x0;var _0x57050c=_0x7a54[_0x3b5658];return _0x57050c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a2efba7..933db19 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 _0x3108=['show','post','create','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3108,0x11f));var _0x8310=function(_0x1736eb,_0x52dacc){_0x1736eb=_0x1736eb-0x0;var _0x3edb5b=_0x3108[_0x1736eb];return _0x3edb5b;};'use strict';var multer=require('multer');var util=require(_0x8310('0x0'));var path=require(_0x8310('0x1'));var timeout=require(_0x8310('0x2'));var express=require(_0x8310('0x3'));var router=express[_0x8310('0x4')]();var fs_extra=require(_0x8310('0x5'));var auth=require(_0x8310('0x6'));var interaction=require(_0x8310('0x7'));var config=require(_0x8310('0x8'));var controller=require('./mailSubstatus.controller');router[_0x8310('0x9')]('/',auth[_0x8310('0xa')](),controller[_0x8310('0xb')]);router[_0x8310('0x9')](_0x8310('0xc'),auth[_0x8310('0xa')](),controller['describe']);router[_0x8310('0x9')]('/:id',auth[_0x8310('0xa')](),controller[_0x8310('0xd')]);router[_0x8310('0xe')]('/',auth[_0x8310('0xa')](),controller[_0x8310('0xf')]);router['put']('/:id',auth[_0x8310('0xa')](),controller['update']);router[_0x8310('0x10')](_0x8310('0x11'),auth[_0x8310('0xa')](),controller[_0x8310('0x12')]);module[_0x8310('0x13')]=router; \ No newline at end of file +var _0xb256=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x105831,_0x15cb95){var _0x356d28=function(_0x41b405){while(--_0x41b405){_0x105831['push'](_0x105831['shift']());}};_0x356d28(++_0x15cb95);}(_0xb256,0x196));var _0x6b25=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xb256[_0x13843f];return _0x1063ae;};'use strict';var multer=require(_0x6b25('0x0'));var util=require(_0x6b25('0x1'));var path=require(_0x6b25('0x2'));var timeout=require(_0x6b25('0x3'));var express=require(_0x6b25('0x4'));var router=express[_0x6b25('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6b25('0x6'));var interaction=require(_0x6b25('0x7'));var config=require('../../config/environment');var controller=require(_0x6b25('0x8'));router['get']('/',auth[_0x6b25('0x9')](),controller[_0x6b25('0xa')]);router[_0x6b25('0xb')](_0x6b25('0xc'),auth[_0x6b25('0x9')](),controller[_0x6b25('0xd')]);router['get']('/:id',auth[_0x6b25('0x9')](),controller['show']);router[_0x6b25('0xe')]('/',auth[_0x6b25('0x9')](),controller[_0x6b25('0xf')]);router[_0x6b25('0x10')](_0x6b25('0x11'),auth['isAuthenticated'](),controller[_0x6b25('0x12')]);router[_0x6b25('0x13')](_0x6b25('0x11'),auth[_0x6b25('0x9')](),controller['destroy']);module[_0x6b25('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 5ce6080..7276f9b 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 _0x71ab=['exports','name'];(function(_0x29a36c,_0xc2fccd){var _0x26618e=function(_0x5b5e31){while(--_0x5b5e31){_0x29a36c['push'](_0x29a36c['shift']());}};_0x26618e(++_0xc2fccd);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb71a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x11e5=['name','sequelize','STRING'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x11e5,0x8b));var _0x511e=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x11e5[_0x45c48f];return _0xaf5037;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')],'unique':_0x511e('0x2'),'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 cf020ca..6045b76 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 _0xce53=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','MailSubstatus','fields','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xce53,0x81));var _0x3ce5=function(_0x1a3fd0,_0x2db6d8){_0x1a3fd0=_0x1a3fd0-0x0;var _0x38c3a8=_0xce53[_0x1a3fd0];return _0x38c3a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ce5('0x0'));var jsonpatch=require(_0x3ce5('0x1'));var rp=require(_0x3ce5('0x2'));var moment=require('moment');var BPromise=require(_0x3ce5('0x3'));var Mustache=require(_0x3ce5('0x4'));var util=require(_0x3ce5('0x5'));var path=require(_0x3ce5('0x6'));var sox=require(_0x3ce5('0x7'));var csv=require('to-csv');var ejs=require(_0x3ce5('0x8'));var fs=require('fs');var fs_extra=require(_0x3ce5('0x9'));var _=require(_0x3ce5('0xa'));var squel=require('squel');var crypto=require(_0x3ce5('0xb'));var jsforce=require(_0x3ce5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ce5('0xd'));var querystring=require(_0x3ce5('0xe'));var Papa=require(_0x3ce5('0xf'));var Redis=require(_0x3ce5('0x10'));var authService=require(_0x3ce5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3ce5('0x12'));var hardwareService=require(_0x3ce5('0x13'));var logger=require(_0x3ce5('0x14'))(_0x3ce5('0x15'));var utils=require(_0x3ce5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3ce5('0x17'))['db'];function respondWithStatusCode(_0x54cf16,_0x367536){_0x367536=_0x367536||0xcc;return function(_0x375c2c){if(_0x375c2c){return _0x54cf16[_0x3ce5('0x18')](_0x367536);}return _0x54cf16[_0x3ce5('0x19')](_0x367536)[_0x3ce5('0x1a')]();};}function respondWithResult(_0x3a8811,_0x501851){_0x501851=_0x501851||0xc8;return function(_0x418ae6){if(_0x418ae6){return _0x3a8811[_0x3ce5('0x19')](_0x501851)[_0x3ce5('0x1b')](_0x418ae6);}};}function respondWithFilteredResult(_0x459048,_0x3d808f){return function(_0x2b6c47){if(_0x2b6c47){var _0x49a311=typeof _0x3d808f[_0x3ce5('0x1c')]==='undefined'&&typeof _0x3d808f['limit']==='undefined';var _0x50665e=_0x2b6c47[_0x3ce5('0x1d')];var _0x340c3b=_0x49a311?0x0:_0x3d808f[_0x3ce5('0x1c')];var _0x1a3536=_0x49a311?_0x2b6c47[_0x3ce5('0x1d')]:_0x3d808f['offset']+_0x3d808f[_0x3ce5('0x1e')];var _0x575899;if(_0x1a3536>=_0x50665e){_0x1a3536=_0x50665e;_0x575899=0xc8;}else{_0x575899=0xce;}_0x459048[_0x3ce5('0x19')](_0x575899);return _0x459048[_0x3ce5('0x1f')]('Content-Range',_0x340c3b+'-'+_0x1a3536+'/'+_0x50665e)['json'](_0x2b6c47);}return null;};}function patchUpdates(_0x5790e0){return function(_0x384c34){try{jsonpatch[_0x3ce5('0x20')](_0x384c34,_0x5790e0,!![]);}catch(_0x22c13d){return BPromise[_0x3ce5('0x21')](_0x22c13d);}return _0x384c34[_0x3ce5('0x22')]();};}function saveUpdates(_0x425419,_0x46e787){return function(_0x576f50){if(_0x576f50){return _0x576f50[_0x3ce5('0x23')](_0x425419)[_0x3ce5('0x24')](function(_0x10434a){return _0x10434a;});}return null;};}function removeEntity(_0x4e5d3a,_0x258833){return function(_0x4e84e1){if(_0x4e84e1){return _0x4e84e1['destroy']()[_0x3ce5('0x24')](function(){_0x4e5d3a[_0x3ce5('0x19')](0xcc)[_0x3ce5('0x1a')]();});}};}function handleEntityNotFound(_0xca66b5,_0x5ad15d){return function(_0x5d4814){if(!_0x5d4814){_0xca66b5[_0x3ce5('0x18')](0x194);}return _0x5d4814;};}function handleError(_0x220627,_0x4224ef){_0x4224ef=_0x4224ef||0x1f4;return function(_0x56e871){logger[_0x3ce5('0x25')](_0x56e871[_0x3ce5('0x26')]);if(_0x56e871[_0x3ce5('0x27')]){delete _0x56e871[_0x3ce5('0x27')];}_0x220627[_0x3ce5('0x19')](_0x4224ef)[_0x3ce5('0x28')](_0x56e871);};}exports[_0x3ce5('0x29')]=function(_0x305d92,_0x422f53){var _0x168f69={},_0x484238={},_0x59f736={'count':0x0,'rows':[]};var _0x536cbb=_[_0x3ce5('0x2a')](db['MailSubstatus'][_0x3ce5('0x2b')],function(_0xacc55c){return{'name':_0xacc55c[_0x3ce5('0x2c')],'type':_0xacc55c[_0x3ce5('0x2d')]['key']};});_0x484238['model']=_[_0x3ce5('0x2a')](_0x536cbb,_0x3ce5('0x27'));_0x484238[_0x3ce5('0x2e')]=_[_0x3ce5('0x2f')](_0x305d92['query']);_0x484238['filters']=_[_0x3ce5('0x30')](_0x484238[_0x3ce5('0x31')],_0x484238[_0x3ce5('0x2e')]);_0x168f69[_0x3ce5('0x32')]=_[_0x3ce5('0x30')](_0x484238[_0x3ce5('0x31')],qs['fields'](_0x305d92[_0x3ce5('0x2e')]['fields']));_0x168f69['attributes']=_0x168f69[_0x3ce5('0x32')][_0x3ce5('0x33')]?_0x168f69['attributes']:_0x484238[_0x3ce5('0x31')];if(!_0x305d92[_0x3ce5('0x2e')][_0x3ce5('0x34')](_0x3ce5('0x35'))){_0x168f69[_0x3ce5('0x1e')]=qs[_0x3ce5('0x1e')](_0x305d92[_0x3ce5('0x2e')]['limit']);_0x168f69[_0x3ce5('0x1c')]=qs['offset'](_0x305d92['query'][_0x3ce5('0x1c')]);}_0x168f69['order']=qs[_0x3ce5('0x36')](_0x305d92[_0x3ce5('0x2e')][_0x3ce5('0x36')]);_0x168f69[_0x3ce5('0x37')]=qs['filters'](_[_0x3ce5('0x38')](_0x305d92['query'],_0x484238[_0x3ce5('0x39')]),_0x536cbb);if(_0x305d92[_0x3ce5('0x2e')][_0x3ce5('0x3a')]){_0x168f69[_0x3ce5('0x37')]=_['merge'](_0x168f69[_0x3ce5('0x37')],{'$or':_[_0x3ce5('0x2a')](_0x536cbb,function(_0x27faf1){if(_0x27faf1['type']!=='VIRTUAL'){var _0x559ce5={};_0x559ce5[_0x27faf1[_0x3ce5('0x27')]]={'$like':'%'+_0x305d92[_0x3ce5('0x2e')][_0x3ce5('0x3a')]+'%'};return _0x559ce5;}})});}_0x168f69=_[_0x3ce5('0x3b')]({},_0x168f69,_0x305d92[_0x3ce5('0x3c')]);var _0x468dd2={'where':_0x168f69['where']};return db['MailSubstatus'][_0x3ce5('0x1d')](_0x468dd2)[_0x3ce5('0x24')](function(_0x1fcb9b){_0x59f736[_0x3ce5('0x1d')]=_0x1fcb9b;if(_0x305d92['query'][_0x3ce5('0x3d')]){_0x168f69[_0x3ce5('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x3ce5('0x3f')](_0x168f69);})[_0x3ce5('0x24')](function(_0x5785c5){_0x59f736[_0x3ce5('0x40')]=_0x5785c5;return _0x59f736;})[_0x3ce5('0x24')](respondWithFilteredResult(_0x422f53,_0x168f69))[_0x3ce5('0x41')](handleError(_0x422f53,null));};exports[_0x3ce5('0x42')]=function(_0x141b4d,_0x263196){var _0x394de7={'raw':!![],'where':{'id':_0x141b4d[_0x3ce5('0x43')]['id']}},_0x1a13b6={};_0x1a13b6['model']=_[_0x3ce5('0x2f')](db[_0x3ce5('0x44')][_0x3ce5('0x2b')]);_0x1a13b6['query']=_['keys'](_0x141b4d[_0x3ce5('0x2e')]);_0x1a13b6[_0x3ce5('0x39')]=_[_0x3ce5('0x30')](_0x1a13b6[_0x3ce5('0x31')],_0x1a13b6[_0x3ce5('0x2e')]);_0x394de7[_0x3ce5('0x32')]=_['intersection'](_0x1a13b6['model'],qs[_0x3ce5('0x45')](_0x141b4d[_0x3ce5('0x2e')][_0x3ce5('0x45')]));_0x394de7['attributes']=_0x394de7['attributes'][_0x3ce5('0x33')]?_0x394de7[_0x3ce5('0x32')]:_0x1a13b6[_0x3ce5('0x31')];if(_0x141b4d[_0x3ce5('0x2e')][_0x3ce5('0x3d')]){_0x394de7[_0x3ce5('0x3e')]=[{'all':!![]}];}_0x394de7=_['merge']({},_0x394de7,_0x141b4d['options']);return db[_0x3ce5('0x44')][_0x3ce5('0x46')](_0x394de7)['then'](handleEntityNotFound(_0x263196,null))['then'](respondWithResult(_0x263196,null))[_0x3ce5('0x41')](handleError(_0x263196,null));};exports[_0x3ce5('0x47')]=function(_0x3626c2,_0x5e3e5f){return db[_0x3ce5('0x44')][_0x3ce5('0x47')](_0x3626c2['body'],{})[_0x3ce5('0x24')](respondWithResult(_0x5e3e5f,0xc9))[_0x3ce5('0x41')](handleError(_0x5e3e5f,null));};exports[_0x3ce5('0x23')]=function(_0x2135f2,_0x1083ea){if(_0x2135f2[_0x3ce5('0x48')]['id']){delete _0x2135f2['body']['id'];}return db[_0x3ce5('0x44')][_0x3ce5('0x46')]({'where':{'id':_0x2135f2[_0x3ce5('0x43')]['id']}})[_0x3ce5('0x24')](handleEntityNotFound(_0x1083ea,null))[_0x3ce5('0x24')](saveUpdates(_0x2135f2['body'],null))[_0x3ce5('0x24')](respondWithResult(_0x1083ea,null))[_0x3ce5('0x41')](handleError(_0x1083ea,null));};exports['destroy']=function(_0x4c6815,_0x4dcb2f){return db['MailSubstatus']['find']({'where':{'id':_0x4c6815[_0x3ce5('0x43')]['id']}})[_0x3ce5('0x24')](handleEntityNotFound(_0x4dcb2f,null))[_0x3ce5('0x24')](removeEntity(_0x4dcb2f,null))[_0x3ce5('0x41')](handleError(_0x4dcb2f,null));};exports[_0x3ce5('0x49')]=function(_0x492bfd,_0x302d00){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x302d00,null))[_0x3ce5('0x41')](handleError(_0x302d00,null));}; \ No newline at end of file +var _0x8452=['zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','update','then','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','filter','options','MailSubstatus','include','findAll','rows','catch','params','includeAll','merge','create','body','destroy','find','describe','eml-format'];(function(_0x2da0c4,_0x23aaaa){var _0x5db880=function(_0x1274d3){while(--_0x1274d3){_0x2da0c4['push'](_0x2da0c4['shift']());}};_0x5db880(++_0x23aaaa);}(_0x8452,0x91));var _0x2845=function(_0x421d1f,_0x103891){_0x421d1f=_0x421d1f-0x0;var _0x4228bf=_0x8452[_0x421d1f];return _0x4228bf;};'use strict';var emlformat=require(_0x2845('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2845('0x1'));var jsonpatch=require(_0x2845('0x2'));var rp=require('request-promise');var moment=require(_0x2845('0x3'));var BPromise=require(_0x2845('0x4'));var Mustache=require(_0x2845('0x5'));var util=require('util');var path=require(_0x2845('0x6'));var sox=require('sox');var csv=require(_0x2845('0x7'));var ejs=require(_0x2845('0x8'));var fs=require('fs');var fs_extra=require(_0x2845('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2845('0xa'));var jsforce=require(_0x2845('0xb'));var deskjs=require(_0x2845('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2845('0xd'));var Papa=require('papaparse');var Redis=require(_0x2845('0xe'));var authService=require(_0x2845('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2845('0x10'));var hardwareService=require(_0x2845('0x11'));var logger=require(_0x2845('0x12'))(_0x2845('0x13'));var utils=require(_0x2845('0x14'));var config=require(_0x2845('0x15'));var licenseUtil=require(_0x2845('0x16'));var db=require(_0x2845('0x17'))['db'];function respondWithStatusCode(_0x2e67bf,_0x1f63a7){_0x1f63a7=_0x1f63a7||0xcc;return function(_0x3c61c5){if(_0x3c61c5){return _0x2e67bf[_0x2845('0x18')](_0x1f63a7);}return _0x2e67bf[_0x2845('0x19')](_0x1f63a7)['end']();};}function respondWithResult(_0x395c70,_0x45ffee){_0x45ffee=_0x45ffee||0xc8;return function(_0xcee67){if(_0xcee67){return _0x395c70[_0x2845('0x19')](_0x45ffee)[_0x2845('0x1a')](_0xcee67);}};}function respondWithFilteredResult(_0x1577f3,_0x3082c6){return function(_0x12a049){if(_0x12a049){var _0x323ef1=typeof _0x3082c6['offset']===_0x2845('0x1b')&&typeof _0x3082c6['limit']===_0x2845('0x1b');var _0x32b075=_0x12a049[_0x2845('0x1c')];var _0xf3e5b6=_0x323ef1?0x0:_0x3082c6[_0x2845('0x1d')];var _0x5947d1=_0x323ef1?_0x12a049['count']:_0x3082c6[_0x2845('0x1d')]+_0x3082c6[_0x2845('0x1e')];var _0x48b69a;if(_0x5947d1>=_0x32b075){_0x5947d1=_0x32b075;_0x48b69a=0xc8;}else{_0x48b69a=0xce;}_0x1577f3[_0x2845('0x19')](_0x48b69a);return _0x1577f3['set']('Content-Range',_0xf3e5b6+'-'+_0x5947d1+'/'+_0x32b075)['json'](_0x12a049);}return null;};}function patchUpdates(_0x1764e2){return function(_0x4466ca){try{jsonpatch[_0x2845('0x1f')](_0x4466ca,_0x1764e2,!![]);}catch(_0x445250){return BPromise[_0x2845('0x20')](_0x445250);}return _0x4466ca[_0x2845('0x21')]();};}function saveUpdates(_0xfac0ba,_0x5b02e2){return function(_0x74ac17){if(_0x74ac17){return _0x74ac17[_0x2845('0x22')](_0xfac0ba)['then'](function(_0x373cd4){return _0x373cd4;});}return null;};}function removeEntity(_0x387e5f,_0x400e9e){return function(_0x8e061f){if(_0x8e061f){return _0x8e061f['destroy']()[_0x2845('0x23')](function(){_0x387e5f['status'](0xcc)[_0x2845('0x24')]();});}};}function handleEntityNotFound(_0x3d09b9,_0x3c12ec){return function(_0x315900){if(!_0x315900){_0x3d09b9['sendStatus'](0x194);}return _0x315900;};}function handleError(_0x46ba2a,_0x3393fb){_0x3393fb=_0x3393fb||0x1f4;return function(_0x3c42d2){logger[_0x2845('0x25')](_0x3c42d2['stack']);if(_0x3c42d2['name']){delete _0x3c42d2[_0x2845('0x26')];}_0x46ba2a['status'](_0x3393fb)[_0x2845('0x27')](_0x3c42d2);};}exports[_0x2845('0x28')]=function(_0x113ed5,_0x398111){var _0x430c90={},_0x143d8e={},_0x4004c4={'count':0x0,'rows':[]};var _0x33e261=_[_0x2845('0x29')](db['MailSubstatus'][_0x2845('0x2a')],function(_0x41c591){return{'name':_0x41c591['fieldName'],'type':_0x41c591[_0x2845('0x2b')][_0x2845('0x2c')]};});_0x143d8e[_0x2845('0x2d')]=_['map'](_0x33e261,'name');_0x143d8e[_0x2845('0x2e')]=_[_0x2845('0x2f')](_0x113ed5['query']);_0x143d8e[_0x2845('0x30')]=_[_0x2845('0x31')](_0x143d8e[_0x2845('0x2d')],_0x143d8e[_0x2845('0x2e')]);_0x430c90[_0x2845('0x32')]=_[_0x2845('0x31')](_0x143d8e['model'],qs[_0x2845('0x33')](_0x113ed5[_0x2845('0x2e')][_0x2845('0x33')]));_0x430c90[_0x2845('0x32')]=_0x430c90['attributes'][_0x2845('0x34')]?_0x430c90[_0x2845('0x32')]:_0x143d8e['model'];if(!_0x113ed5[_0x2845('0x2e')]['hasOwnProperty'](_0x2845('0x35'))){_0x430c90[_0x2845('0x1e')]=qs[_0x2845('0x1e')](_0x113ed5[_0x2845('0x2e')][_0x2845('0x1e')]);_0x430c90[_0x2845('0x1d')]=qs[_0x2845('0x1d')](_0x113ed5[_0x2845('0x2e')][_0x2845('0x1d')]);}_0x430c90[_0x2845('0x36')]=qs['sort'](_0x113ed5['query'][_0x2845('0x37')]);_0x430c90['where']=qs[_0x2845('0x30')](_[_0x2845('0x38')](_0x113ed5[_0x2845('0x2e')],_0x143d8e['filters']),_0x33e261);if(_0x113ed5[_0x2845('0x2e')]['filter']){_0x430c90[_0x2845('0x39')]=_['merge'](_0x430c90[_0x2845('0x39')],{'$or':_[_0x2845('0x29')](_0x33e261,function(_0x1ad20e){if(_0x1ad20e[_0x2845('0x2b')]!=='VIRTUAL'){var _0x4dd9f9={};_0x4dd9f9[_0x1ad20e['name']]={'$like':'%'+_0x113ed5[_0x2845('0x2e')][_0x2845('0x3a')]+'%'};return _0x4dd9f9;}})});}_0x430c90=_['merge']({},_0x430c90,_0x113ed5[_0x2845('0x3b')]);var _0x5efb11={'where':_0x430c90[_0x2845('0x39')]};return db[_0x2845('0x3c')][_0x2845('0x1c')](_0x5efb11)['then'](function(_0x5aa101){_0x4004c4[_0x2845('0x1c')]=_0x5aa101;if(_0x113ed5[_0x2845('0x2e')]['includeAll']){_0x430c90[_0x2845('0x3d')]=[{'all':!![]}];}return db[_0x2845('0x3c')][_0x2845('0x3e')](_0x430c90);})[_0x2845('0x23')](function(_0xfe7e8d){_0x4004c4[_0x2845('0x3f')]=_0xfe7e8d;return _0x4004c4;})[_0x2845('0x23')](respondWithFilteredResult(_0x398111,_0x430c90))[_0x2845('0x40')](handleError(_0x398111,null));};exports['show']=function(_0x274804,_0x3c3adb){var _0x43f398={'raw':!![],'where':{'id':_0x274804[_0x2845('0x41')]['id']}},_0x160252={};_0x160252[_0x2845('0x2d')]=_[_0x2845('0x2f')](db[_0x2845('0x3c')]['rawAttributes']);_0x160252[_0x2845('0x2e')]=_[_0x2845('0x2f')](_0x274804['query']);_0x160252['filters']=_[_0x2845('0x31')](_0x160252[_0x2845('0x2d')],_0x160252[_0x2845('0x2e')]);_0x43f398[_0x2845('0x32')]=_['intersection'](_0x160252['model'],qs[_0x2845('0x33')](_0x274804[_0x2845('0x2e')][_0x2845('0x33')]));_0x43f398[_0x2845('0x32')]=_0x43f398[_0x2845('0x32')][_0x2845('0x34')]?_0x43f398[_0x2845('0x32')]:_0x160252[_0x2845('0x2d')];if(_0x274804['query'][_0x2845('0x42')]){_0x43f398['include']=[{'all':!![]}];}_0x43f398=_[_0x2845('0x43')]({},_0x43f398,_0x274804[_0x2845('0x3b')]);return db[_0x2845('0x3c')]['find'](_0x43f398)[_0x2845('0x23')](handleEntityNotFound(_0x3c3adb,null))['then'](respondWithResult(_0x3c3adb,null))['catch'](handleError(_0x3c3adb,null));};exports['create']=function(_0x44ad0e,_0x154c75){return db['MailSubstatus'][_0x2845('0x44')](_0x44ad0e['body'],{})[_0x2845('0x23')](respondWithResult(_0x154c75,0xc9))[_0x2845('0x40')](handleError(_0x154c75,null));};exports[_0x2845('0x22')]=function(_0x145cba,_0x10229a){if(_0x145cba[_0x2845('0x45')]['id']){delete _0x145cba['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x145cba[_0x2845('0x41')]['id']}})[_0x2845('0x23')](handleEntityNotFound(_0x10229a,null))[_0x2845('0x23')](saveUpdates(_0x145cba[_0x2845('0x45')],null))[_0x2845('0x23')](respondWithResult(_0x10229a,null))[_0x2845('0x40')](handleError(_0x10229a,null));};exports[_0x2845('0x46')]=function(_0xc092f,_0x28f994){return db[_0x2845('0x3c')][_0x2845('0x47')]({'where':{'id':_0xc092f[_0x2845('0x41')]['id']}})['then'](handleEntityNotFound(_0x28f994,null))[_0x2845('0x23')](removeEntity(_0x28f994,null))['catch'](handleError(_0x28f994,null));};exports[_0x2845('0x48')]=function(_0x33b0e5,_0x3dd243){return db[_0x2845('0x3c')][_0x2845('0x48')]()['then'](respondWithResult(_0x3dd243,null))['catch'](handleError(_0x3dd243,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index a3b6145..ee69af6 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 _0x34c6=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0x34c6,0x64));var _0x634c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34c6[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x634c('0x0'));var MailSubstatus=require(_0x634c('0x1'))['db'][_0x634c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x634c('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x36ad39){return function(_0x57076c,_0x2ba0b5,_0x5ce0cc){MailSubstatusEvents['emit'](_0x36ad39+':'+_0x57076c['id'],_0x57076c);MailSubstatusEvents[_0x634c('0x4')](_0x36ad39,_0x57076c);_0x5ce0cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x634c('0x5')](e,emitEvent(event));}}module[_0x634c('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x1a08=['exports','events','../../mysqldb','MailSubstatus','update','emit','hasOwnProperty','hook'];(function(_0x1a99be,_0x4717b2){var _0x285477=function(_0x2f9051){while(--_0x2f9051){_0x1a99be['push'](_0x1a99be['shift']());}};_0x285477(++_0x4717b2);}(_0x1a08,0x89));var _0x81a0=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x1a08[_0x5be7aa];return _0x215408;};'use strict';var EventEmitter=require(_0x81a0('0x0'));var MailSubstatus=require(_0x81a0('0x1'))['db'][_0x81a0('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x81a0('0x3')};function emitEvent(_0x43284f){return function(_0x5a6e92,_0x553fc8,_0x368983){MailSubstatusEvents[_0x81a0('0x4')](_0x43284f+':'+_0x5a6e92['id'],_0x5a6e92);MailSubstatusEvents['emit'](_0x43284f,_0x5a6e92);_0x368983(null);};}for(var e in events){if(events[_0x81a0('0x5')](e)){var event=events[e];MailSubstatus[_0x81a0('0x6')](e,emitEvent(event));}}module[_0x81a0('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index dd2321f..7ed082a 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 _0xe0e1=['name','_previousDataValues','catch','./mailSubstatus.attributes','MailSubstatus','Condition','update'];(function(_0x87d2ac,_0x4c2098){var _0x10a7f1=function(_0x213a8a){while(--_0x213a8a){_0x87d2ac['push'](_0x87d2ac['shift']());}};_0x10a7f1(++_0x4c2098);}(_0xe0e1,0xe3));var _0x1e0e=function(_0xd79610,_0x5ac09e){_0xd79610=_0xd79610-0x0;var _0x44db99=_0xe0e1[_0xd79610];return _0x44db99;};'use strict';var attributes=require(_0x1e0e('0x0'));module['exports']=function(_0x658ed4){var _0x4daf72=_0x658ed4['models'];return _0x658ed4['define'](_0x1e0e('0x1'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x24035b,_0x55e5d3,_0x3a48d9){return _0x4daf72[_0x1e0e('0x2')][_0x1e0e('0x3')]({'value':_0x24035b[_0x1e0e('0x4')]},{'where':{'field':'mailSubstatus','value':_0x24035b[_0x1e0e('0x5')][_0x1e0e('0x4')]}})['then'](function(){_0x3a48d9();})[_0x1e0e('0x6')](function(_0x3e951d){_0x3a48d9(_0x3e951d);});}}});}; \ No newline at end of file +var _0xf1e7=['_previousDataValues','then','catch','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','update','name','mailSubstatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf1e7,0x139));var _0x7f1e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xf1e7[_0x122096];return _0x3d1966;};'use strict';var attributes=require(_0x7f1e('0x0'));module[_0x7f1e('0x1')]=function(_0x4d866b){var _0x43f97d=_0x4d866b['models'];return _0x4d866b['define'](_0x7f1e('0x2'),attributes,{'tableName':_0x7f1e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5c45e5,_0x148f95,_0x5e5820){return _0x43f97d['Condition'][_0x7f1e('0x4')]({'value':_0x5c45e5[_0x7f1e('0x5')]},{'where':{'field':_0x7f1e('0x6'),'value':_0x5c45e5[_0x7f1e('0x7')][_0x7f1e('0x5')]}})[_0x7f1e('0x8')](function(){_0x5e5820();})[_0x7f1e('0x9')](function(_0x5dcdca){_0x5e5820(_0x5dcdca);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 5082c3b..15faf0a 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 _0xa7e6=['message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x31daa8,_0x291f42){var _0x379d4c=function(_0x3bc64d){while(--_0x3bc64d){_0x31daa8['push'](_0x31daa8['shift']());}};_0x379d4c(++_0x291f42);}(_0xa7e6,0x95));var _0x6a7e=function(_0x194d61,_0x2a1696){_0x194d61=_0x194d61-0x0;var _0x16c05b=_0xa7e6[_0x194d61];return _0x16c05b;};'use strict';var _=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var moment=require(_0x6a7e('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a7e('0x3'));var fs=require('fs');var Redis=require(_0x6a7e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a7e('0x5'));var logger=require(_0x6a7e('0x6'))(_0x6a7e('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a7e('0x8'));var client=jayson['client'][_0x6a7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23feab,_0x2dbf8a,_0x5ed2d4){return new BPromise(function(_0x1762df,_0x2bd877){return client[_0x6a7e('0xa')](_0x23feab,_0x5ed2d4)[_0x6a7e('0xb')](function(_0x151382){logger[_0x6a7e('0xc')](_0x6a7e('0xd'),_0x2dbf8a,_0x6a7e('0xe'));logger['debug'](_0x6a7e('0xf'),_0x2dbf8a,_0x6a7e('0xe'),JSON[_0x6a7e('0x10')](_0x151382));if(_0x151382['error']){if(_0x151382['error'][_0x6a7e('0x11')]===0x1f4){logger[_0x6a7e('0x12')](_0x6a7e('0xd'),_0x2dbf8a,_0x151382[_0x6a7e('0x12')][_0x6a7e('0x13')]);return _0x2bd877(_0x151382[_0x6a7e('0x12')][_0x6a7e('0x13')]);}logger[_0x6a7e('0x12')](_0x6a7e('0xd'),_0x2dbf8a,_0x151382['error']['message']);return _0x1762df(_0x151382[_0x6a7e('0x12')][_0x6a7e('0x13')]);}else{logger[_0x6a7e('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x2dbf8a,'request\x20sent');_0x1762df(_0x151382[_0x6a7e('0x14')][_0x6a7e('0x13')]);}})['catch'](function(_0x9fe618){logger[_0x6a7e('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x2dbf8a,_0x9fe618);_0x2bd877(_0x9fe618);});});} \ No newline at end of file +var _0x9ceb=['info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9ceb,0x12b));var _0xb9ce=function(_0x117553,_0x5f730e){_0x117553=_0x117553-0x0;var _0x18dbc2=_0x9ceb[_0x117553];return _0x18dbc2;};'use strict';var _=require('lodash');var util=require(_0xb9ce('0x0'));var moment=require(_0xb9ce('0x1'));var BPromise=require(_0xb9ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9ce('0x3'));var db=require(_0xb9ce('0x4'))['db'];var utils=require(_0xb9ce('0x5'));var logger=require(_0xb9ce('0x6'))(_0xb9ce('0x7'));var config=require(_0xb9ce('0x8'));var jayson=require(_0xb9ce('0x9'));var client=jayson[_0xb9ce('0xa')][_0xb9ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6d8bd7,_0x32cb2b,_0x18dce5){return new BPromise(function(_0x222166,_0x43ed22){return client[_0xb9ce('0xc')](_0x6d8bd7,_0x18dce5)['then'](function(_0x4384d5){logger[_0xb9ce('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x32cb2b,_0xb9ce('0xe'));logger[_0xb9ce('0xf')](_0xb9ce('0x10'),_0x32cb2b,_0xb9ce('0xe'),JSON[_0xb9ce('0x11')](_0x4384d5));if(_0x4384d5[_0xb9ce('0x12')]){if(_0x4384d5[_0xb9ce('0x12')][_0xb9ce('0x13')]===0x1f4){logger[_0xb9ce('0x12')](_0xb9ce('0x14'),_0x32cb2b,_0x4384d5[_0xb9ce('0x12')][_0xb9ce('0x15')]);return _0x43ed22(_0x4384d5['error'][_0xb9ce('0x15')]);}logger['error'](_0xb9ce('0x14'),_0x32cb2b,_0x4384d5[_0xb9ce('0x12')][_0xb9ce('0x15')]);return _0x222166(_0x4384d5['error']['message']);}else{logger[_0xb9ce('0xd')](_0xb9ce('0x14'),_0x32cb2b,'request\x20sent');_0x222166(_0x4384d5[_0xb9ce('0x16')][_0xb9ce('0x15')]);}})[_0xb9ce('0x17')](function(_0x2e1b22){logger[_0xb9ce('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x32cb2b,_0x2e1b22);_0x43ed22(_0x2e1b22);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f19794f..9ae86b0 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 _0x6041=['post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6041,0xa0));var _0x1604=function(_0x30bdcc,_0x71a33d){_0x30bdcc=_0x30bdcc-0x0;var _0x9c86cb=_0x6041[_0x30bdcc];return _0x9c86cb;};'use strict';var multer=require(_0x1604('0x0'));var util=require(_0x1604('0x1'));var path=require(_0x1604('0x2'));var timeout=require('connect-timeout');var express=require(_0x1604('0x3'));var router=express[_0x1604('0x4')]();var fs_extra=require(_0x1604('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1604('0x6'));var config=require(_0x1604('0x7'));var controller=require(_0x1604('0x8'));router[_0x1604('0x9')]('/',auth['isAuthenticated'](),controller[_0x1604('0xa')]);router[_0x1604('0x9')](_0x1604('0xb'),auth[_0x1604('0xc')](),controller[_0x1604('0xd')]);router['get'](_0x1604('0xe'),auth['isAuthenticated'](),controller[_0x1604('0xf')]);router[_0x1604('0x10')]('/',auth[_0x1604('0xc')](),controller[_0x1604('0x11')]);router[_0x1604('0x12')](_0x1604('0xe'),auth[_0x1604('0xc')](),controller[_0x1604('0x13')]);router['delete']('/:id',auth[_0x1604('0xc')](),controller[_0x1604('0x14')]);module[_0x1604('0x15')]=router; \ No newline at end of file +var _0xa71a=['describe','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x1bce32,_0x17b4ac){var _0x33d708=function(_0xd76f65){while(--_0xd76f65){_0x1bce32['push'](_0x1bce32['shift']());}};_0x33d708(++_0x17b4ac);}(_0xa71a,0x198));var _0xaa71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa71a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xaa71('0x0'));var path=require(_0xaa71('0x1'));var timeout=require(_0xaa71('0x2'));var express=require(_0xaa71('0x3'));var router=express[_0xaa71('0x4')]();var fs_extra=require(_0xaa71('0x5'));var auth=require(_0xaa71('0x6'));var interaction=require(_0xaa71('0x7'));var config=require('../../config/environment');var controller=require(_0xaa71('0x8'));router[_0xaa71('0x9')]('/',auth[_0xaa71('0xa')](),controller['index']);router[_0xaa71('0x9')](_0xaa71('0xb'),auth['isAuthenticated'](),controller[_0xaa71('0xc')]);router[_0xaa71('0x9')](_0xaa71('0xd'),auth[_0xaa71('0xa')](),controller[_0xaa71('0xe')]);router['post']('/',auth[_0xaa71('0xa')](),controller[_0xaa71('0xf')]);router[_0xaa71('0x10')](_0xaa71('0xd'),auth['isAuthenticated'](),controller[_0xaa71('0x11')]);router[_0xaa71('0x12')]('/:id',auth[_0xaa71('0xa')](),controller['destroy']);module[_0xaa71('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d4a38e6..ac9d18a 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x37306a,_0x435902){var _0x552039=function(_0x1ea1a5){while(--_0x1ea1a5){_0x37306a['push'](_0x37306a['shift']());}};_0x552039(++_0x435902);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x509f32,_0x1ddd4f){var _0x48be5c=function(_0x249e1c){while(--_0x249e1c){_0x509f32['push'](_0x509f32['shift']());}};_0x48be5c(++_0x1ddd4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c6e934c..99a2cca 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 _0xd292=['../../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','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xd292,0x12e));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2d29('0x0'));var rimraf=require(_0x2d29('0x1'));var zipdir=require(_0x2d29('0x2'));var jsonpatch=require(_0x2d29('0x3'));var rp=require(_0x2d29('0x4'));var moment=require(_0x2d29('0x5'));var BPromise=require(_0x2d29('0x6'));var Mustache=require(_0x2d29('0x7'));var util=require(_0x2d29('0x8'));var path=require('path');var sox=require(_0x2d29('0x9'));var csv=require(_0x2d29('0xa'));var ejs=require(_0x2d29('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d29('0xc'));var squel=require(_0x2d29('0xd'));var crypto=require('crypto');var jsforce=require(_0x2d29('0xe'));var deskjs=require(_0x2d29('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2d29('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d29('0x11'));var authService=require(_0x2d29('0x12'));var qs=require(_0x2d29('0x13'));var as=require(_0x2d29('0x14'));var hardwareService=require(_0x2d29('0x15'));var logger=require(_0x2d29('0x16'))(_0x2d29('0x17'));var utils=require(_0x2d29('0x18'));var config=require(_0x2d29('0x19'));var licenseUtil=require(_0x2d29('0x1a'));var db=require(_0x2d29('0x1b'))['db'];function respondWithStatusCode(_0x558558,_0x5146ac){_0x5146ac=_0x5146ac||0xcc;return function(_0xd62aee){if(_0xd62aee){return _0x558558[_0x2d29('0x1c')](_0x5146ac);}return _0x558558[_0x2d29('0x1d')](_0x5146ac)[_0x2d29('0x1e')]();};}function respondWithResult(_0x2d9fa9,_0x368d71){_0x368d71=_0x368d71||0xc8;return function(_0x4c827d){if(_0x4c827d){return _0x2d9fa9[_0x2d29('0x1d')](_0x368d71)[_0x2d29('0x1f')](_0x4c827d);}};}function respondWithFilteredResult(_0x1b1cbb,_0x558cad){return function(_0x27863a){if(_0x27863a){var _0x467f7c=typeof _0x558cad[_0x2d29('0x20')]===_0x2d29('0x21')&&typeof _0x558cad[_0x2d29('0x22')]===_0x2d29('0x21');var _0x384cab=_0x27863a['count'];var _0x12064a=_0x467f7c?0x0:_0x558cad[_0x2d29('0x20')];var _0x578bd0=_0x467f7c?_0x27863a['count']:_0x558cad[_0x2d29('0x20')]+_0x558cad[_0x2d29('0x22')];var _0x4f88de;if(_0x578bd0>=_0x384cab){_0x578bd0=_0x384cab;_0x4f88de=0xc8;}else{_0x4f88de=0xce;}_0x1b1cbb[_0x2d29('0x1d')](_0x4f88de);return _0x1b1cbb[_0x2d29('0x23')](_0x2d29('0x24'),_0x12064a+'-'+_0x578bd0+'/'+_0x384cab)[_0x2d29('0x1f')](_0x27863a);}return null;};}function patchUpdates(_0x26629f){return function(_0x43c05a){try{jsonpatch[_0x2d29('0x25')](_0x43c05a,_0x26629f,!![]);}catch(_0x416734){return BPromise[_0x2d29('0x26')](_0x416734);}return _0x43c05a[_0x2d29('0x27')]();};}function saveUpdates(_0x18833d,_0xde6326){return function(_0xc72823){if(_0xc72823){return _0xc72823[_0x2d29('0x28')](_0x18833d)[_0x2d29('0x29')](function(_0x4d37fa){return _0x4d37fa;});}return null;};}function removeEntity(_0x79f3c7,_0x40ff46){return function(_0x2af3df){if(_0x2af3df){return _0x2af3df[_0x2d29('0x2a')]()[_0x2d29('0x29')](function(){_0x79f3c7[_0x2d29('0x1d')](0xcc)[_0x2d29('0x1e')]();});}};}function handleEntityNotFound(_0xc68a3,_0x454d96){return function(_0x2d3e8e){if(!_0x2d3e8e){_0xc68a3[_0x2d29('0x1c')](0x194);}return _0x2d3e8e;};}function handleError(_0x567cfd,_0x398ead){_0x398ead=_0x398ead||0x1f4;return function(_0x3096ee){logger[_0x2d29('0x2b')](_0x3096ee['stack']);if(_0x3096ee[_0x2d29('0x2c')]){delete _0x3096ee[_0x2d29('0x2c')];}_0x567cfd[_0x2d29('0x1d')](_0x398ead)[_0x2d29('0x2d')](_0x3096ee);};}exports[_0x2d29('0x2e')]=function(_0x3fab40,_0x3cf944){var _0x5b60f5={},_0x4c9b27={},_0x3926ac={'count':0x0,'rows':[]};var _0x231f51=_[_0x2d29('0x2f')](db[_0x2d29('0x30')]['rawAttributes'],function(_0x1cb9f2){return{'name':_0x1cb9f2[_0x2d29('0x31')],'type':_0x1cb9f2[_0x2d29('0x32')][_0x2d29('0x33')]};});_0x4c9b27[_0x2d29('0x34')]=_[_0x2d29('0x2f')](_0x231f51,_0x2d29('0x2c'));_0x4c9b27[_0x2d29('0x35')]=_[_0x2d29('0x36')](_0x3fab40['query']);_0x4c9b27[_0x2d29('0x37')]=_[_0x2d29('0x38')](_0x4c9b27[_0x2d29('0x34')],_0x4c9b27[_0x2d29('0x35')]);_0x5b60f5[_0x2d29('0x39')]=_[_0x2d29('0x38')](_0x4c9b27[_0x2d29('0x34')],qs[_0x2d29('0x3a')](_0x3fab40[_0x2d29('0x35')][_0x2d29('0x3a')]));_0x5b60f5[_0x2d29('0x39')]=_0x5b60f5[_0x2d29('0x39')]['length']?_0x5b60f5[_0x2d29('0x39')]:_0x4c9b27['model'];if(!_0x3fab40['query'][_0x2d29('0x3b')](_0x2d29('0x3c'))){_0x5b60f5['limit']=qs[_0x2d29('0x22')](_0x3fab40[_0x2d29('0x35')]['limit']);_0x5b60f5[_0x2d29('0x20')]=qs['offset'](_0x3fab40[_0x2d29('0x35')]['offset']);}_0x5b60f5[_0x2d29('0x3d')]=qs[_0x2d29('0x3e')](_0x3fab40[_0x2d29('0x35')][_0x2d29('0x3e')]);_0x5b60f5[_0x2d29('0x3f')]=qs[_0x2d29('0x37')](_[_0x2d29('0x40')](_0x3fab40['query'],_0x4c9b27['filters']),_0x231f51);if(_0x3fab40[_0x2d29('0x35')]['filter']){_0x5b60f5['where']=_[_0x2d29('0x41')](_0x5b60f5[_0x2d29('0x3f')],{'$or':_[_0x2d29('0x2f')](_0x231f51,function(_0x42795a){if(_0x42795a[_0x2d29('0x32')]!==_0x2d29('0x42')){var _0x54a79a={};_0x54a79a[_0x42795a[_0x2d29('0x2c')]]={'$like':'%'+_0x3fab40[_0x2d29('0x35')][_0x2d29('0x43')]+'%'};return _0x54a79a;}})});}_0x5b60f5=_[_0x2d29('0x41')]({},_0x5b60f5,_0x3fab40[_0x2d29('0x44')]);var _0x5eef70={'where':_0x5b60f5[_0x2d29('0x3f')]};return db['MailTransferReport'][_0x2d29('0x45')](_0x5eef70)['then'](function(_0x28203e){_0x3926ac[_0x2d29('0x45')]=_0x28203e;if(_0x3fab40[_0x2d29('0x35')]['includeAll']){_0x5b60f5[_0x2d29('0x46')]=[{'all':!![]}];}return db[_0x2d29('0x30')][_0x2d29('0x47')](_0x5b60f5);})['then'](function(_0x53dbde){_0x3926ac[_0x2d29('0x48')]=_0x53dbde;return _0x3926ac;})[_0x2d29('0x29')](respondWithFilteredResult(_0x3cf944,_0x5b60f5))['catch'](handleError(_0x3cf944,null));};exports['show']=function(_0x416a9d,_0xefed74){var _0x37ecd9={'raw':!![],'where':{'id':_0x416a9d[_0x2d29('0x49')]['id']}},_0x875150={};_0x875150['model']=_[_0x2d29('0x36')](db['MailTransferReport'][_0x2d29('0x4a')]);_0x875150[_0x2d29('0x35')]=_[_0x2d29('0x36')](_0x416a9d[_0x2d29('0x35')]);_0x875150[_0x2d29('0x37')]=_[_0x2d29('0x38')](_0x875150[_0x2d29('0x34')],_0x875150[_0x2d29('0x35')]);_0x37ecd9['attributes']=_['intersection'](_0x875150[_0x2d29('0x34')],qs[_0x2d29('0x3a')](_0x416a9d[_0x2d29('0x35')][_0x2d29('0x3a')]));_0x37ecd9[_0x2d29('0x39')]=_0x37ecd9['attributes']['length']?_0x37ecd9['attributes']:_0x875150[_0x2d29('0x34')];if(_0x416a9d[_0x2d29('0x35')]['includeAll']){_0x37ecd9[_0x2d29('0x46')]=[{'all':!![]}];}_0x37ecd9=_[_0x2d29('0x41')]({},_0x37ecd9,_0x416a9d[_0x2d29('0x44')]);return db[_0x2d29('0x30')]['find'](_0x37ecd9)[_0x2d29('0x29')](handleEntityNotFound(_0xefed74,null))['then'](respondWithResult(_0xefed74,null))[_0x2d29('0x4b')](handleError(_0xefed74,null));};exports[_0x2d29('0x4c')]=function(_0xd257f8,_0x4ee826){return db[_0x2d29('0x30')][_0x2d29('0x4c')](_0xd257f8[_0x2d29('0x4d')],{})[_0x2d29('0x29')](respondWithResult(_0x4ee826,0xc9))[_0x2d29('0x4b')](handleError(_0x4ee826,null));};exports[_0x2d29('0x28')]=function(_0x8b8ffe,_0x5049b4){if(_0x8b8ffe[_0x2d29('0x4d')]['id']){delete _0x8b8ffe['body']['id'];}return db[_0x2d29('0x30')][_0x2d29('0x4e')]({'where':{'id':_0x8b8ffe['params']['id']}})['then'](handleEntityNotFound(_0x5049b4,null))['then'](saveUpdates(_0x8b8ffe[_0x2d29('0x4d')],null))[_0x2d29('0x29')](respondWithResult(_0x5049b4,null))[_0x2d29('0x4b')](handleError(_0x5049b4,null));};exports['destroy']=function(_0x278c9e,_0x3a9464){return db['MailTransferReport'][_0x2d29('0x4e')]({'where':{'id':_0x278c9e[_0x2d29('0x49')]['id']}})[_0x2d29('0x29')](handleEntityNotFound(_0x3a9464,null))['then'](removeEntity(_0x3a9464,null))['catch'](handleError(_0x3a9464,null));};exports[_0x2d29('0x4f')]=function(_0x27d09b,_0x2455b8){return db['MailTransferReport'][_0x2d29('0x4f')]()[_0x2d29('0x29')](respondWithResult(_0x2455b8,null))[_0x2d29('0x4b')](handleError(_0x2455b8,null));}; \ No newline at end of file +var _0x66ba=['stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','catch','show','params','include','merge','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x4536cc,_0x45795d){var _0x5c1ffb=function(_0x2286c9){while(--_0x2286c9){_0x4536cc['push'](_0x4536cc['shift']());}};_0x5c1ffb(++_0x45795d);}(_0x66ba,0x166));var _0xa66b=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0x66ba[_0x119e7a];return _0x1fb90a;};'use strict';var emlformat=require(_0xa66b('0x0'));var rimraf=require(_0xa66b('0x1'));var zipdir=require(_0xa66b('0x2'));var jsonpatch=require(_0xa66b('0x3'));var rp=require(_0xa66b('0x4'));var moment=require('moment');var BPromise=require(_0xa66b('0x5'));var Mustache=require(_0xa66b('0x6'));var util=require(_0xa66b('0x7'));var path=require(_0xa66b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa66b('0x9'));var _=require(_0xa66b('0xa'));var squel=require(_0xa66b('0xb'));var crypto=require(_0xa66b('0xc'));var jsforce=require(_0xa66b('0xd'));var deskjs=require(_0xa66b('0xe'));var toCsv=require(_0xa66b('0xf'));var querystring=require('querystring');var Papa=require(_0xa66b('0x10'));var Redis=require(_0xa66b('0x11'));var authService=require(_0xa66b('0x12'));var qs=require(_0xa66b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66b('0x14'));var logger=require(_0xa66b('0x15'))(_0xa66b('0x16'));var utils=require(_0xa66b('0x17'));var config=require(_0xa66b('0x18'));var licenseUtil=require(_0xa66b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x118c11,_0x1fc3ca){_0x1fc3ca=_0x1fc3ca||0xcc;return function(_0x1ba3aa){if(_0x1ba3aa){return _0x118c11[_0xa66b('0x1a')](_0x1fc3ca);}return _0x118c11[_0xa66b('0x1b')](_0x1fc3ca)[_0xa66b('0x1c')]();};}function respondWithResult(_0x160142,_0x3c25ac){_0x3c25ac=_0x3c25ac||0xc8;return function(_0x58bdea){if(_0x58bdea){return _0x160142[_0xa66b('0x1b')](_0x3c25ac)[_0xa66b('0x1d')](_0x58bdea);}};}function respondWithFilteredResult(_0x4c8963,_0x5154b6){return function(_0x32fed8){if(_0x32fed8){var _0x427560=typeof _0x5154b6[_0xa66b('0x1e')]===_0xa66b('0x1f')&&typeof _0x5154b6[_0xa66b('0x20')]===_0xa66b('0x1f');var _0x36c1ba=_0x32fed8[_0xa66b('0x21')];var _0x10245b=_0x427560?0x0:_0x5154b6[_0xa66b('0x1e')];var _0x50878f=_0x427560?_0x32fed8[_0xa66b('0x21')]:_0x5154b6[_0xa66b('0x1e')]+_0x5154b6[_0xa66b('0x20')];var _0xc9c0e3;if(_0x50878f>=_0x36c1ba){_0x50878f=_0x36c1ba;_0xc9c0e3=0xc8;}else{_0xc9c0e3=0xce;}_0x4c8963[_0xa66b('0x1b')](_0xc9c0e3);return _0x4c8963[_0xa66b('0x22')](_0xa66b('0x23'),_0x10245b+'-'+_0x50878f+'/'+_0x36c1ba)[_0xa66b('0x1d')](_0x32fed8);}return null;};}function patchUpdates(_0x177182){return function(_0x142e51){try{jsonpatch[_0xa66b('0x24')](_0x142e51,_0x177182,!![]);}catch(_0x503381){return BPromise[_0xa66b('0x25')](_0x503381);}return _0x142e51[_0xa66b('0x26')]();};}function saveUpdates(_0x4fd4a9,_0x4f3f85){return function(_0x14b2d0){if(_0x14b2d0){return _0x14b2d0['update'](_0x4fd4a9)[_0xa66b('0x27')](function(_0x485b22){return _0x485b22;});}return null;};}function removeEntity(_0x5690b4,_0x4bd4a9){return function(_0xf0ddd7){if(_0xf0ddd7){return _0xf0ddd7[_0xa66b('0x28')]()[_0xa66b('0x27')](function(){_0x5690b4[_0xa66b('0x1b')](0xcc)[_0xa66b('0x1c')]();});}};}function handleEntityNotFound(_0x2e85b0,_0x4925a5){return function(_0x391f48){if(!_0x391f48){_0x2e85b0[_0xa66b('0x1a')](0x194);}return _0x391f48;};}function handleError(_0x1bf8b7,_0x2551fe){_0x2551fe=_0x2551fe||0x1f4;return function(_0x2bfb0b){logger[_0xa66b('0x29')](_0x2bfb0b[_0xa66b('0x2a')]);if(_0x2bfb0b[_0xa66b('0x2b')]){delete _0x2bfb0b[_0xa66b('0x2b')];}_0x1bf8b7['status'](_0x2551fe)['send'](_0x2bfb0b);};}exports[_0xa66b('0x2c')]=function(_0x12c49d,_0x3a263a){var _0x3e5c69={},_0x2670e9={},_0x5e7364={'count':0x0,'rows':[]};var _0xdb711c=_[_0xa66b('0x2d')](db[_0xa66b('0x2e')][_0xa66b('0x2f')],function(_0x3c12bb){return{'name':_0x3c12bb[_0xa66b('0x30')],'type':_0x3c12bb[_0xa66b('0x31')][_0xa66b('0x32')]};});_0x2670e9[_0xa66b('0x33')]=_[_0xa66b('0x2d')](_0xdb711c,'name');_0x2670e9[_0xa66b('0x34')]=_[_0xa66b('0x35')](_0x12c49d[_0xa66b('0x34')]);_0x2670e9[_0xa66b('0x36')]=_[_0xa66b('0x37')](_0x2670e9['model'],_0x2670e9['query']);_0x3e5c69[_0xa66b('0x38')]=_[_0xa66b('0x37')](_0x2670e9[_0xa66b('0x33')],qs[_0xa66b('0x39')](_0x12c49d[_0xa66b('0x34')]['fields']));_0x3e5c69[_0xa66b('0x38')]=_0x3e5c69[_0xa66b('0x38')][_0xa66b('0x3a')]?_0x3e5c69['attributes']:_0x2670e9[_0xa66b('0x33')];if(!_0x12c49d['query'][_0xa66b('0x3b')](_0xa66b('0x3c'))){_0x3e5c69[_0xa66b('0x20')]=qs[_0xa66b('0x20')](_0x12c49d[_0xa66b('0x34')]['limit']);_0x3e5c69['offset']=qs[_0xa66b('0x1e')](_0x12c49d[_0xa66b('0x34')][_0xa66b('0x1e')]);}_0x3e5c69[_0xa66b('0x3d')]=qs[_0xa66b('0x3e')](_0x12c49d[_0xa66b('0x34')]['sort']);_0x3e5c69[_0xa66b('0x3f')]=qs[_0xa66b('0x36')](_[_0xa66b('0x40')](_0x12c49d['query'],_0x2670e9[_0xa66b('0x36')]),_0xdb711c);if(_0x12c49d[_0xa66b('0x34')][_0xa66b('0x41')]){_0x3e5c69[_0xa66b('0x3f')]=_['merge'](_0x3e5c69[_0xa66b('0x3f')],{'$or':_[_0xa66b('0x2d')](_0xdb711c,function(_0x4ff919){if(_0x4ff919['type']!==_0xa66b('0x42')){var _0xc3a301={};_0xc3a301[_0x4ff919[_0xa66b('0x2b')]]={'$like':'%'+_0x12c49d[_0xa66b('0x34')]['filter']+'%'};return _0xc3a301;}})});}_0x3e5c69=_['merge']({},_0x3e5c69,_0x12c49d[_0xa66b('0x43')]);var _0x266a26={'where':_0x3e5c69[_0xa66b('0x3f')]};return db[_0xa66b('0x2e')]['count'](_0x266a26)[_0xa66b('0x27')](function(_0x2dce00){_0x5e7364['count']=_0x2dce00;if(_0x12c49d['query'][_0xa66b('0x44')]){_0x3e5c69['include']=[{'all':!![]}];}return db[_0xa66b('0x2e')]['findAll'](_0x3e5c69);})[_0xa66b('0x27')](function(_0x17dbd5){_0x5e7364[_0xa66b('0x45')]=_0x17dbd5;return _0x5e7364;})[_0xa66b('0x27')](respondWithFilteredResult(_0x3a263a,_0x3e5c69))[_0xa66b('0x46')](handleError(_0x3a263a,null));};exports[_0xa66b('0x47')]=function(_0x3410fc,_0x497b0c){var _0x5c669e={'raw':!![],'where':{'id':_0x3410fc[_0xa66b('0x48')]['id']}},_0x459d5d={};_0x459d5d['model']=_[_0xa66b('0x35')](db[_0xa66b('0x2e')]['rawAttributes']);_0x459d5d[_0xa66b('0x34')]=_['keys'](_0x3410fc[_0xa66b('0x34')]);_0x459d5d[_0xa66b('0x36')]=_[_0xa66b('0x37')](_0x459d5d[_0xa66b('0x33')],_0x459d5d['query']);_0x5c669e[_0xa66b('0x38')]=_['intersection'](_0x459d5d[_0xa66b('0x33')],qs[_0xa66b('0x39')](_0x3410fc[_0xa66b('0x34')][_0xa66b('0x39')]));_0x5c669e['attributes']=_0x5c669e[_0xa66b('0x38')][_0xa66b('0x3a')]?_0x5c669e[_0xa66b('0x38')]:_0x459d5d[_0xa66b('0x33')];if(_0x3410fc['query'][_0xa66b('0x44')]){_0x5c669e[_0xa66b('0x49')]=[{'all':!![]}];}_0x5c669e=_[_0xa66b('0x4a')]({},_0x5c669e,_0x3410fc[_0xa66b('0x43')]);return db[_0xa66b('0x2e')][_0xa66b('0x4b')](_0x5c669e)[_0xa66b('0x27')](handleEntityNotFound(_0x497b0c,null))[_0xa66b('0x27')](respondWithResult(_0x497b0c,null))[_0xa66b('0x46')](handleError(_0x497b0c,null));};exports[_0xa66b('0x4c')]=function(_0x3e7d89,_0x32a2df){return db[_0xa66b('0x2e')][_0xa66b('0x4c')](_0x3e7d89[_0xa66b('0x4d')],{})[_0xa66b('0x27')](respondWithResult(_0x32a2df,0xc9))[_0xa66b('0x46')](handleError(_0x32a2df,null));};exports[_0xa66b('0x4e')]=function(_0x444144,_0x2a72ec){if(_0x444144['body']['id']){delete _0x444144['body']['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x444144['params']['id']}})[_0xa66b('0x27')](handleEntityNotFound(_0x2a72ec,null))['then'](saveUpdates(_0x444144[_0xa66b('0x4d')],null))[_0xa66b('0x27')](respondWithResult(_0x2a72ec,null))[_0xa66b('0x46')](handleError(_0x2a72ec,null));};exports[_0xa66b('0x28')]=function(_0x1378c7,_0x2fbbd5){return db[_0xa66b('0x2e')][_0xa66b('0x4b')]({'where':{'id':_0x1378c7[_0xa66b('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fbbd5,null))[_0xa66b('0x27')](removeEntity(_0x2fbbd5,null))[_0xa66b('0x46')](handleError(_0x2fbbd5,null));};exports['describe']=function(_0x31ac9c,_0x3366ce){return db['MailTransferReport'][_0xa66b('0x4f')]()[_0xa66b('0x27')](respondWithResult(_0x3366ce,null))['catch'](handleError(_0x3366ce,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c7d0c15..898c2c1 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 _0x6317=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x58fcda,_0x1c3d13){var _0x8e4b88=function(_0x1da88a){while(--_0x1da88a){_0x58fcda['push'](_0x58fcda['shift']());}};_0x8e4b88(++_0x1c3d13);}(_0x6317,0x11a));var _0x7631=function(_0x3dffd9,_0x29d4df){_0x3dffd9=_0x3dffd9-0x0;var _0x4978ed=_0x6317[_0x3dffd9];return _0x4978ed;};'use strict';var _=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var logger=require(_0x7631('0x2'))(_0x7631('0x3'));var moment=require(_0x7631('0x4'));var BPromise=require(_0x7631('0x5'));var rp=require(_0x7631('0x6'));var fs=require('fs');var path=require(_0x7631('0x7'));var rimraf=require(_0x7631('0x8'));var config=require(_0x7631('0x9'));var attributes=require(_0x7631('0xa'));module[_0x7631('0xb')]=function(_0x50fd37,_0x4870ae){return _0x50fd37[_0x7631('0xc')](_0x7631('0xd'),attributes,{'tableName':_0x7631('0xe'),'paranoid':![],'indexes':[{'name':_0x7631('0xf'),'fields':[_0x7631('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe131=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','moment','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe131,0x1b5));var _0x1e13=function(_0x5067c6,_0x3f1e9e){_0x5067c6=_0x5067c6-0x0;var _0xb5daa3=_0xe131[_0x5067c6];return _0xb5daa3;};'use strict';var _=require(_0x1e13('0x0'));var util=require(_0x1e13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1e13('0x2'));var BPromise=require('bluebird');var rp=require(_0x1e13('0x3'));var fs=require('fs');var path=require(_0x1e13('0x4'));var rimraf=require(_0x1e13('0x5'));var config=require(_0x1e13('0x6'));var attributes=require(_0x1e13('0x7'));module[_0x1e13('0x8')]=function(_0x440239,_0x3ec2e6){return _0x440239[_0x1e13('0x9')](_0x1e13('0xa'),attributes,{'tableName':_0x1e13('0xb'),'paranoid':![],'indexes':[{'name':_0x1e13('0xc'),'fields':[_0x1e13('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e5de528..b554e77 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 _0xe899=['message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xe899,0x192));var _0x9e89=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0xe899[_0x575057];return _0x49dbc8;};'use strict';var _=require(_0x9e89('0x0'));var util=require(_0x9e89('0x1'));var moment=require('moment');var BPromise=require(_0x9e89('0x2'));var rs=require(_0x9e89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e89('0x4'))['db'];var utils=require(_0x9e89('0x5'));var logger=require(_0x9e89('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e89('0x7')][_0x9e89('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x284b22,_0x33be04,_0x4d7197){return new BPromise(function(_0x57bb12,_0x5bf8e3){return client['request'](_0x284b22,_0x4d7197)[_0x9e89('0x9')](function(_0x51453f){logger['info'](_0x9e89('0xa'),_0x33be04,'request\x20sent');logger[_0x9e89('0xb')](_0x9e89('0xc'),_0x33be04,_0x9e89('0xd'),JSON['stringify'](_0x51453f));if(_0x51453f[_0x9e89('0xe')]){if(_0x51453f['error'][_0x9e89('0xf')]===0x1f4){logger[_0x9e89('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x33be04,_0x51453f[_0x9e89('0xe')][_0x9e89('0x10')]);return _0x5bf8e3(_0x51453f[_0x9e89('0xe')][_0x9e89('0x10')]);}logger[_0x9e89('0xe')](_0x9e89('0xa'),_0x33be04,_0x51453f[_0x9e89('0xe')][_0x9e89('0x10')]);return _0x57bb12(_0x51453f[_0x9e89('0xe')]['message']);}else{logger[_0x9e89('0x11')](_0x9e89('0xa'),_0x33be04,_0x9e89('0xd'));_0x57bb12(_0x51453f[_0x9e89('0x12')]['message']);}})['catch'](function(_0x987b25){logger[_0x9e89('0xe')](_0x9e89('0xa'),_0x33be04,_0x987b25);_0x5bf8e3(_0x987b25);});});} \ No newline at end of file +var _0x9148=['../../config/environment','jayson/promise','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0x9148,0x1ea));var _0x8914=function(_0x1e9486,_0x5ebdb5){_0x1e9486=_0x1e9486-0x0;var _0x3a273c=_0x9148[_0x1e9486];return _0x3a273c;};'use strict';var _=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var moment=require(_0x8914('0x2'));var BPromise=require(_0x8914('0x3'));var rs=require(_0x8914('0x4'));var fs=require('fs');var Redis=require(_0x8914('0x5'));var db=require(_0x8914('0x6'))['db'];var utils=require(_0x8914('0x7'));var logger=require(_0x8914('0x8'))(_0x8914('0x9'));var config=require(_0x8914('0xa'));var jayson=require(_0x8914('0xb'));var client=jayson[_0x8914('0xc')][_0x8914('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3df885,_0x529647,_0xa815ef){return new BPromise(function(_0x36812d,_0x2c8506){return client['request'](_0x3df885,_0xa815ef)[_0x8914('0xe')](function(_0x473657){logger['info'](_0x8914('0xf'),_0x529647,_0x8914('0x10'));logger['debug'](_0x8914('0x11'),_0x529647,'request\x20sent',JSON[_0x8914('0x12')](_0x473657));if(_0x473657[_0x8914('0x13')]){if(_0x473657[_0x8914('0x13')][_0x8914('0x14')]===0x1f4){logger[_0x8914('0x13')](_0x8914('0xf'),_0x529647,_0x473657[_0x8914('0x13')]['message']);return _0x2c8506(_0x473657['error']['message']);}logger[_0x8914('0x13')](_0x8914('0xf'),_0x529647,_0x473657['error'][_0x8914('0x15')]);return _0x36812d(_0x473657['error'][_0x8914('0x15')]);}else{logger[_0x8914('0x16')](_0x8914('0xf'),_0x529647,'request\x20sent');_0x36812d(_0x473657[_0x8914('0x17')][_0x8914('0x15')]);}})[_0x8914('0x18')](function(_0x249e7b){logger[_0x8914('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x529647,_0x249e7b);_0x2c8506(_0x249e7b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index db9bf33..3fe3c0a 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 _0x3793=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x3f05d2,_0x290ee1){var _0x39cf55=function(_0x2caac0){while(--_0x2caac0){_0x3f05d2['push'](_0x3f05d2['shift']());}};_0x39cf55(++_0x290ee1);}(_0x3793,0xa9));var _0x3379=function(_0x594086,_0x319c9e){_0x594086=_0x594086-0x0;var _0x3580a5=_0x3793[_0x594086];return _0x3580a5;};'use strict';var multer=require(_0x3379('0x0'));var util=require(_0x3379('0x1'));var path=require('path');var timeout=require(_0x3379('0x2'));var express=require(_0x3379('0x3'));var router=express[_0x3379('0x4')]();var fs_extra=require(_0x3379('0x5'));var auth=require(_0x3379('0x6'));var interaction=require(_0x3379('0x7'));var config=require('../../config/environment');var controller=require(_0x3379('0x8'));router['get']('/',auth[_0x3379('0x9')](),controller[_0x3379('0xa')]);router[_0x3379('0xb')]('/describe',auth[_0x3379('0x9')](),controller[_0x3379('0xc')]);router[_0x3379('0xb')](_0x3379('0xd'),auth[_0x3379('0x9')](),controller[_0x3379('0xe')]);router[_0x3379('0xf')]('/',auth['isAuthenticated'](),controller[_0x3379('0x10')]);router[_0x3379('0x11')]('/:id',auth[_0x3379('0x9')](),controller['update']);router[_0x3379('0x12')](_0x3379('0xd'),auth[_0x3379('0x9')](),controller[_0x3379('0x13')]);module[_0x3379('0x14')]=router; \ No newline at end of file +var _0x5d7b=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','describe','/:id','show','post'];(function(_0xfd1d5,_0x336107){var _0x3a0b3c=function(_0x37aaa8){while(--_0x37aaa8){_0xfd1d5['push'](_0xfd1d5['shift']());}};_0x3a0b3c(++_0x336107);}(_0x5d7b,0x89));var _0xb5d7=function(_0x565b76,_0x1d150b){_0x565b76=_0x565b76-0x0;var _0x80f363=_0x5d7b[_0x565b76];return _0x80f363;};'use strict';var multer=require(_0xb5d7('0x0'));var util=require(_0xb5d7('0x1'));var path=require(_0xb5d7('0x2'));var timeout=require(_0xb5d7('0x3'));var express=require('express');var router=express[_0xb5d7('0x4')]();var fs_extra=require(_0xb5d7('0x5'));var auth=require(_0xb5d7('0x6'));var interaction=require(_0xb5d7('0x7'));var config=require(_0xb5d7('0x8'));var controller=require(_0xb5d7('0x9'));router['get']('/',auth[_0xb5d7('0xa')](),controller[_0xb5d7('0xb')]);router[_0xb5d7('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xb5d7('0xd')]);router[_0xb5d7('0xc')](_0xb5d7('0xe'),auth[_0xb5d7('0xa')](),controller[_0xb5d7('0xf')]);router[_0xb5d7('0x10')]('/',auth[_0xb5d7('0xa')](),controller[_0xb5d7('0x11')]);router['put'](_0xb5d7('0xe'),auth['isAuthenticated'](),controller[_0xb5d7('0x12')]);router[_0xb5d7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb5d7('0x14')]);module[_0xb5d7('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7e8c3c9..34e615f 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 _0x7552=['talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x3ea527,_0x46c244){var _0x314fa5=function(_0x368d31){while(--_0x368d31){_0x3ea527['push'](_0x3ea527['shift']());}};_0x314fa5(++_0x46c244);}(_0x7552,0x122));var _0x2755=function(_0x3cab19,_0x424f11){_0x3cab19=_0x3cab19-0x0;var _0x3e651a=_0x7552[_0x3cab19];return _0x3e651a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x2755('0x0')]={'channel':{'type':Sequelize[_0x2755('0x1')]},'membername':{'type':Sequelize[_0x2755('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2755('0x1')],'defaultValue':_0x2755('0x2'),'comment':_0x2755('0x3')},'duration':{'type':Sequelize[_0x2755('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2755('0x5')],'set':function(_0x28798c){var _0x1f5808=moment(_0x28798c);var _0xe2bca8=moment(this['getDataValue'](_0x2755('0x6')));var _0x324484=_0x1f5808[_0x2755('0x7')](_0xe2bca8,_0x2755('0x8'));this[_0x2755('0x9')](_0x2755('0xa'),_0x28798c);this[_0x2755('0x9')](_0x2755('0xb'),_0x324484>=0x0?_0x324484:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x2755('0xc')},'data2':{'type':Sequelize[_0x2755('0x1')],'comment':_0x2755('0xd')},'data3':{'type':Sequelize[_0x2755('0x1')],'comment':_0x2755('0xe')},'data4':{'type':Sequelize[_0x2755('0x1')],'comment':_0x2755('0xf')},'data5':{'type':Sequelize[_0x2755('0x1')],'comment':_0x2755('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x2755('0x1')]}}; \ No newline at end of file +var _0xa9ad=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x2dd615,_0x18099c){var _0x5255a4=function(_0x3f4c54){while(--_0x3f4c54){_0x2dd615['push'](_0x2dd615['shift']());}};_0x5255a4(++_0x18099c);}(_0xa9ad,0x19b));var _0xda9a=function(_0x5b9a2b,_0x5cc2bb){_0x5b9a2b=_0x5b9a2b-0x0;var _0x306553=_0xa9ad[_0x5b9a2b];return _0x306553;};'use strict';var Sequelize=require(_0xda9a('0x0'));var moment=require(_0xda9a('0x1'));module[_0xda9a('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xda9a('0x3')]},'interface':{'type':Sequelize[_0xda9a('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xda9a('0x4'),'comment':_0xda9a('0x5')},'duration':{'type':Sequelize[_0xda9a('0x6')]},'enterAt':{'type':Sequelize[_0xda9a('0x7')]},'exitAt':{'type':Sequelize[_0xda9a('0x7')],'set':function(_0x26e677){var _0x173b81=moment(_0x26e677);var _0x328716=moment(this['getDataValue'](_0xda9a('0x8')));var _0x5e914a=_0x173b81[_0xda9a('0x9')](_0x328716,'seconds');this[_0xda9a('0xa')]('exitAt',_0x26e677);this[_0xda9a('0xa')](_0xda9a('0xb'),_0x5e914a>=0x0?_0x5e914a:null);}},'data1':{'type':Sequelize[_0xda9a('0x3')],'comment':_0xda9a('0xc')},'data2':{'type':Sequelize[_0xda9a('0x3')],'comment':_0xda9a('0xd')},'data3':{'type':Sequelize[_0xda9a('0x3')],'comment':_0xda9a('0xe')},'data4':{'type':Sequelize[_0xda9a('0x3')],'comment':_0xda9a('0xf')},'data5':{'type':Sequelize[_0xda9a('0x3')],'comment':_0xda9a('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xda9a('0x6')]},'uniqueid':{'type':Sequelize[_0xda9a('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fcebe99..003f170 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x34e8,0x12c));var _0x834e=function(_0x3cb246,_0x3ecbd8){_0x3cb246=_0x3cb246-0x0;var _0x36c5da=_0x34e8[_0x3cb246];return _0x36c5da;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _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(_0x231a31,_0x39d48d){var _0x511b94=function(_0x52eaf6){while(--_0x52eaf6){_0x231a31['push'](_0x231a31['shift']());}};_0x511b94(++_0x39d48d);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4ea702c..a18195b 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 _0x9772=['membername_interface','membername','interface','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MemberReport'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x9772,0x189));var _0x2977=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x9772[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x2977('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2977('0x1'));var moment=require('moment');var BPromise=require(_0x2977('0x2'));var rp=require(_0x2977('0x3'));var fs=require('fs');var path=require(_0x2977('0x4'));var rimraf=require(_0x2977('0x5'));var config=require(_0x2977('0x6'));var attributes=require('./memberReport.attributes');module[_0x2977('0x7')]=function(_0x347741,_0x49fc81){return _0x347741[_0x2977('0x8')](_0x2977('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x2977('0xa'),'fields':[_0x2977('0xb'),_0x2977('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86c4=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x86c4,0x17b));var _0x486c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86c4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x486c('0x0'));var util=require(_0x486c('0x1'));var logger=require(_0x486c('0x2'))(_0x486c('0x3'));var moment=require(_0x486c('0x4'));var BPromise=require(_0x486c('0x5'));var rp=require(_0x486c('0x6'));var fs=require('fs');var path=require(_0x486c('0x7'));var rimraf=require(_0x486c('0x8'));var config=require(_0x486c('0x9'));var attributes=require(_0x486c('0xa'));module['exports']=function(_0x4a7ee7,_0x5f3512){return _0x4a7ee7[_0x486c('0xb')](_0x486c('0xc'),attributes,{'tableName':_0x486c('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x486c('0xe'),_0x486c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4b175bc..8b069a0 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 _0x0170=['update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','then','GetMemberReport','CreateMemberReport','MemberReport','body','UpdateMemberReport'];(function(_0x1246e5,_0x5e324b){var _0x438634=function(_0x52654f){while(--_0x52654f){_0x1246e5['push'](_0x1246e5['shift']());}};_0x438634(++_0x5e324b);}(_0x0170,0x1d6));var _0x0017=function(_0x347a7a,_0x2361ca){_0x347a7a=_0x347a7a-0x0;var _0x3b3f22=_0x0170[_0x347a7a];return _0x3b3f22;};'use strict';var _=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var moment=require('moment');var BPromise=require(_0x0017('0x2'));var rs=require(_0x0017('0x3'));var fs=require('fs');var Redis=require(_0x0017('0x4'));var db=require(_0x0017('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0017('0x6'))(_0x0017('0x7'));var config=require(_0x0017('0x8'));var jayson=require(_0x0017('0x9'));var client=jayson[_0x0017('0xa')][_0x0017('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52402,_0x3573e1,_0xea0574){return new BPromise(function(_0x121f63,_0x145f14){return client['request'](_0x52402,_0xea0574)['then'](function(_0x16e239){logger[_0x0017('0xc')](_0x0017('0xd'),_0x3573e1,_0x0017('0xe'));logger[_0x0017('0xf')](_0x0017('0x10'),_0x3573e1,_0x0017('0xe'),JSON[_0x0017('0x11')](_0x16e239));if(_0x16e239[_0x0017('0x12')]){if(_0x16e239[_0x0017('0x12')][_0x0017('0x13')]===0x1f4){logger[_0x0017('0x12')](_0x0017('0xd'),_0x3573e1,_0x16e239['error'][_0x0017('0x14')]);return _0x145f14(_0x16e239[_0x0017('0x12')][_0x0017('0x14')]);}logger[_0x0017('0x12')](_0x0017('0xd'),_0x3573e1,_0x16e239['error']['message']);return _0x121f63(_0x16e239[_0x0017('0x12')][_0x0017('0x14')]);}else{logger[_0x0017('0xc')]('MemberReport,\x20%s,\x20%s',_0x3573e1,_0x0017('0xe'));_0x121f63(_0x16e239[_0x0017('0x15')][_0x0017('0x14')]);}})[_0x0017('0x16')](function(_0x5e3c80){logger[_0x0017('0x12')](_0x0017('0xd'),_0x3573e1,_0x5e3c80);_0x145f14(_0x5e3c80);});});}exports['GetMemberReport']=function(_0x24cce2){var _0x16ef12=this;return new Promise(function(_0x29c8ea,_0x30253e){return db['MemberReport'][_0x0017('0x17')]({'raw':_0x24cce2[_0x0017('0x18')]?_0x24cce2['options'][_0x0017('0x19')]===undefined?!![]:![]:!![],'where':_0x24cce2['options']?_0x24cce2[_0x0017('0x18')]['where']||null:null,'attributes':_0x24cce2[_0x0017('0x18')]?_0x24cce2['options'][_0x0017('0x1a')]||null:null,'limit':_0x24cce2['options']?_0x24cce2[_0x0017('0x18')][_0x0017('0x1b')]||null:null,'include':_0x24cce2[_0x0017('0x18')]?_0x24cce2[_0x0017('0x18')][_0x0017('0x1c')]?_[_0x0017('0x1d')](_0x24cce2['options']['include'],function(_0x3b8136){return{'model':db[_0x3b8136[_0x0017('0x1e')]],'as':_0x3b8136['as'],'attributes':_0x3b8136[_0x0017('0x1a')],'include':_0x3b8136[_0x0017('0x1c')]?_['map'](_0x3b8136[_0x0017('0x1c')],function(_0x354068){return{'model':db[_0x354068[_0x0017('0x1e')]],'as':_0x354068['as'],'attributes':_0x354068[_0x0017('0x1a')],'include':_0x354068[_0x0017('0x1c')]?_[_0x0017('0x1d')](_0x354068[_0x0017('0x1c')],function(_0x45bdba){return{'model':db[_0x45bdba[_0x0017('0x1e')]],'as':_0x45bdba['as'],'attributes':_0x45bdba[_0x0017('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0017('0x1f')](function(_0x32c2ba){logger[_0x0017('0xc')]('GetMemberReport',_0x24cce2);logger[_0x0017('0xf')](_0x0017('0x20'),_0x24cce2,JSON['stringify'](_0x32c2ba));_0x29c8ea(_0x32c2ba);})['catch'](function(_0x113d74){logger[_0x0017('0x12')](_0x0017('0x20'),_0x113d74[_0x0017('0x14')],_0x24cce2);_0x30253e(_0x16ef12['error'](0x1f4,_0x113d74[_0x0017('0x14')]));});});};exports[_0x0017('0x21')]=function(_0x3a1ebb){var _0x318623=this;return new Promise(function(_0x5834f9,_0x1bc2f6){return db[_0x0017('0x22')]['create'](_0x3a1ebb[_0x0017('0x23')],{'raw':_0x3a1ebb[_0x0017('0x18')]?_0x3a1ebb[_0x0017('0x18')][_0x0017('0x19')]===undefined?!![]:![]:!![]})[_0x0017('0x1f')](function(_0x3cb86e){logger[_0x0017('0xc')]('CreateMemberReport',_0x3a1ebb);logger[_0x0017('0xf')]('CreateMemberReport',_0x3a1ebb,JSON[_0x0017('0x11')](_0x3cb86e));_0x5834f9(_0x3cb86e);})[_0x0017('0x16')](function(_0x2c7a5c){logger[_0x0017('0x12')]('CreateMemberReport',_0x2c7a5c[_0x0017('0x14')],_0x3a1ebb);_0x1bc2f6(_0x318623[_0x0017('0x12')](0x1f4,_0x2c7a5c['message']));});});};exports[_0x0017('0x24')]=function(_0x1eb0a9){var _0x13eb5d=this;return new Promise(function(_0x574261,_0x4bd900){return db[_0x0017('0x22')][_0x0017('0x25')](_0x1eb0a9[_0x0017('0x23')],{'raw':_0x1eb0a9[_0x0017('0x18')]?_0x1eb0a9[_0x0017('0x18')][_0x0017('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eb0a9['options']?_0x1eb0a9[_0x0017('0x18')][_0x0017('0x26')]||null:null,'attributes':_0x1eb0a9[_0x0017('0x18')]?_0x1eb0a9[_0x0017('0x18')][_0x0017('0x1a')]||null:null,'limit':_0x1eb0a9[_0x0017('0x18')]?_0x1eb0a9[_0x0017('0x18')][_0x0017('0x1b')]||null:null})[_0x0017('0x1f')](function(_0x52a312){logger[_0x0017('0xc')](_0x0017('0x24'),_0x1eb0a9);logger[_0x0017('0xf')](_0x0017('0x24'),_0x1eb0a9,JSON[_0x0017('0x11')](_0x52a312));_0x574261(_0x52a312);})[_0x0017('0x16')](function(_0x7c43a5){logger[_0x0017('0x12')]('UpdateMemberReport',_0x7c43a5[_0x0017('0x14')],_0x1eb0a9);_0x4bd900(_0x13eb5d['error'](0x1f4,_0x7c43a5['message']));});});}; \ No newline at end of file +var _0x7bd0=['then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','GetMemberReport','CreateMemberReport','create','UpdateMemberReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x7bd0,0x111));var _0x07bd=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x7bd0[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('MemberReport,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetMemberReport']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetMemberReport',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')](_0x4182b9['body'],{'raw':_0x4182b9['options']?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![]})[_0x07bd('0xe')](function(_0x4f61a3){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')]('CreateMemberReport',_0x4182b9,JSON['stringify'](_0x4f61a3));_0x1b6cc(_0x4f61a3);})[_0x07bd('0x18')](function(_0x185783){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x185783['message'],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x185783[_0x07bd('0x16')]));});});};exports[_0x07bd('0x26')]=function(_0x4d12df){var _0x278afb=this;return new Promise(function(_0x31c381,_0x51a232){return db[_0x07bd('0x19')][_0x07bd('0x27')](_0x4d12df[_0x07bd('0x28')],{'raw':_0x4d12df[_0x07bd('0x1b')]?_0x4d12df['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d12df[_0x07bd('0x1b')]?_0x4d12df['options'][_0x07bd('0x1d')]||null:null,'attributes':_0x4d12df[_0x07bd('0x1b')]?_0x4d12df[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x4d12df[_0x07bd('0x1b')]?_0x4d12df[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null})[_0x07bd('0xe')](function(_0x4957fc){logger[_0x07bd('0x17')](_0x07bd('0x26'),_0x4d12df);logger[_0x07bd('0x11')](_0x07bd('0x26'),_0x4d12df,JSON['stringify'](_0x4957fc));_0x31c381(_0x4957fc);})[_0x07bd('0x18')](function(_0x2799c6){logger[_0x07bd('0x14')](_0x07bd('0x26'),_0x2799c6['message'],_0x4d12df);_0x51a232(_0x278afb[_0x07bd('0x14')](0x1f4,_0x2799c6[_0x07bd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 02dfb59..5206d01 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 _0x9a14=['../../components/interaction/service','index','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x16f27c,_0xf5f0c8){var _0x498aeb=function(_0x11946a){while(--_0x11946a){_0x16f27c['push'](_0x16f27c['shift']());}};_0x498aeb(++_0xf5f0c8);}(_0x9a14,0x1d3));var _0x49a1=function(_0x2eb94a,_0x4248ec){_0x2eb94a=_0x2eb94a-0x0;var _0x588503=_0x9a14[_0x2eb94a];return _0x588503;};'use strict';var multer=require('multer');var util=require(_0x49a1('0x0'));var path=require(_0x49a1('0x1'));var timeout=require(_0x49a1('0x2'));var express=require('express');var router=express[_0x49a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x49a1('0x4'));var interaction=require(_0x49a1('0x5'));var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller[_0x49a1('0x6')]);module[_0x49a1('0x7')]=router; \ No newline at end of file +var _0xa063=['../../config/environment','./migration.controller','index','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22791d,_0x1a9bdc){var _0x2ca69c=function(_0x1d6a6f){while(--_0x1d6a6f){_0x22791d['push'](_0x22791d['shift']());}};_0x2ca69c(++_0x1a9bdc);}(_0xa063,0x100));var _0x3a06=function(_0x5ddfce,_0x289b26){_0x5ddfce=_0x5ddfce-0x0;var _0x1bf47c=_0xa063[_0x5ddfce];return _0x1bf47c;};'use strict';var multer=require(_0x3a06('0x0'));var util=require(_0x3a06('0x1'));var path=require(_0x3a06('0x2'));var timeout=require(_0x3a06('0x3'));var express=require('express');var router=express[_0x3a06('0x4')]();var fs_extra=require(_0x3a06('0x5'));var auth=require(_0x3a06('0x6'));var interaction=require(_0x3a06('0x7'));var config=require(_0x3a06('0x8'));var controller=require(_0x3a06('0x9'));router['get']('/',controller[_0x3a06('0xa')]);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 5cbba3d..aaf8d8e 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 _0x33ec=['exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x33ec,0x9b));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc33e('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x1803=['version','sequelize','exports','STRING'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x1803,0x1e1));var _0x3180=function(_0xa704b7,_0x1f0036){_0xa704b7=_0xa704b7-0x0;var _0x1d279d=_0x1803[_0xa704b7];return _0x1d279d;};'use strict';var Sequelize=require(_0x3180('0x0'));module[_0x3180('0x1')]={'version':{'type':Sequelize[_0x3180('0x2')],'unique':_0x3180('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 48afaf9..3c0b18b 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 _0xb891=['sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','Migration','findAll','rows','eml-format','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','query','intersection','attributes','model','length','hasOwnProperty','nolimit'];(function(_0x3d58ca,_0x4550d3){var _0x1d3772=function(_0x4836ee){while(--_0x4836ee){_0x3d58ca['push'](_0x3d58ca['shift']());}};_0x1d3772(++_0x4550d3);}(_0xb891,0x18d));var _0x1b89=function(_0x22664d,_0x2f94a1){_0x22664d=_0x22664d-0x0;var _0x3680a4=_0xb891[_0x22664d];return _0x3680a4;};'use strict';var emlformat=require(_0x1b89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b89('0x1'));var moment=require(_0x1b89('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1b89('0x3'));var util=require(_0x1b89('0x4'));var path=require(_0x1b89('0x5'));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(_0x1b89('0x6'));var squel=require(_0x1b89('0x7'));var crypto=require(_0x1b89('0x8'));var jsforce=require(_0x1b89('0x9'));var deskjs=require(_0x1b89('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1b89('0xb'));var Papa=require(_0x1b89('0xc'));var Redis=require(_0x1b89('0xd'));var authService=require(_0x1b89('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1b89('0xf'));var hardwareService=require(_0x1b89('0x10'));var logger=require(_0x1b89('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x1b89('0x12'));var licenseUtil=require(_0x1b89('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x470772,_0x5e57c1){_0x5e57c1=_0x5e57c1||0xcc;return function(_0x4f0bb9){if(_0x4f0bb9){return _0x470772[_0x1b89('0x14')](_0x5e57c1);}return _0x470772['status'](_0x5e57c1)[_0x1b89('0x15')]();};}function respondWithResult(_0x1e6d09,_0x5b386f){_0x5b386f=_0x5b386f||0xc8;return function(_0x4dce38){if(_0x4dce38){return _0x1e6d09[_0x1b89('0x16')](_0x5b386f)['json'](_0x4dce38);}};}function respondWithFilteredResult(_0x4dd9c9,_0xba2ea0){return function(_0x13e75d){if(_0x13e75d){var _0x2257d5=typeof _0xba2ea0[_0x1b89('0x17')]===_0x1b89('0x18')&&typeof _0xba2ea0[_0x1b89('0x19')]===_0x1b89('0x18');var _0x4d1c20=_0x13e75d[_0x1b89('0x1a')];var _0x1e7cf0=_0x2257d5?0x0:_0xba2ea0[_0x1b89('0x17')];var _0x1c910f=_0x2257d5?_0x13e75d[_0x1b89('0x1a')]:_0xba2ea0[_0x1b89('0x17')]+_0xba2ea0[_0x1b89('0x19')];var _0x3b74da;if(_0x1c910f>=_0x4d1c20){_0x1c910f=_0x4d1c20;_0x3b74da=0xc8;}else{_0x3b74da=0xce;}_0x4dd9c9[_0x1b89('0x16')](_0x3b74da);return _0x4dd9c9[_0x1b89('0x1b')](_0x1b89('0x1c'),_0x1e7cf0+'-'+_0x1c910f+'/'+_0x4d1c20)[_0x1b89('0x1d')](_0x13e75d);}return null;};}function patchUpdates(_0x322a78){return function(_0x12493b){try{jsonpatch[_0x1b89('0x1e')](_0x12493b,_0x322a78,!![]);}catch(_0x55d264){return BPromise[_0x1b89('0x1f')](_0x55d264);}return _0x12493b[_0x1b89('0x20')]();};}function saveUpdates(_0x2a2de9,_0x282ab6){return function(_0x1d0c28){if(_0x1d0c28){return _0x1d0c28[_0x1b89('0x21')](_0x2a2de9)[_0x1b89('0x22')](function(_0x23e875){return _0x23e875;});}return null;};}function removeEntity(_0x11f6f9,_0x345b5f){return function(_0x59b5b3){if(_0x59b5b3){return _0x59b5b3[_0x1b89('0x23')]()[_0x1b89('0x22')](function(){_0x11f6f9[_0x1b89('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x182b59,_0x179ea3){return function(_0x555e35){if(!_0x555e35){_0x182b59[_0x1b89('0x14')](0x194);}return _0x555e35;};}function handleError(_0x5bb1d5,_0x4ffb56){_0x4ffb56=_0x4ffb56||0x1f4;return function(_0x1fca15){logger[_0x1b89('0x24')](_0x1fca15[_0x1b89('0x25')]);if(_0x1fca15[_0x1b89('0x26')]){delete _0x1fca15[_0x1b89('0x26')];}_0x5bb1d5[_0x1b89('0x16')](_0x4ffb56)[_0x1b89('0x27')](_0x1fca15);};}exports[_0x1b89('0x28')]=function(_0xe0f361,_0x3b0800){var _0xc53d55={},_0x5f375e={},_0x1b1fbe={'count':0x0,'rows':[]};var _0x73aa50=_[_0x1b89('0x29')](db['Migration'][_0x1b89('0x2a')],function(_0xb9a302){return{'name':_0xb9a302['fieldName'],'type':_0xb9a302[_0x1b89('0x2b')]['key']};});_0x5f375e['model']=_[_0x1b89('0x29')](_0x73aa50,_0x1b89('0x26'));_0x5f375e['query']=_['keys'](_0xe0f361[_0x1b89('0x2c')]);_0x5f375e['filters']=_[_0x1b89('0x2d')](_0x5f375e['model'],_0x5f375e['query']);_0xc53d55[_0x1b89('0x2e')]=_[_0x1b89('0x2d')](_0x5f375e[_0x1b89('0x2f')],qs['fields'](_0xe0f361[_0x1b89('0x2c')]['fields']));_0xc53d55[_0x1b89('0x2e')]=_0xc53d55[_0x1b89('0x2e')][_0x1b89('0x30')]?_0xc53d55[_0x1b89('0x2e')]:_0x5f375e[_0x1b89('0x2f')];if(!_0xe0f361[_0x1b89('0x2c')][_0x1b89('0x31')](_0x1b89('0x32'))){_0xc53d55[_0x1b89('0x19')]=qs[_0x1b89('0x19')](_0xe0f361[_0x1b89('0x2c')][_0x1b89('0x19')]);_0xc53d55[_0x1b89('0x17')]=qs[_0x1b89('0x17')](_0xe0f361['query'][_0x1b89('0x17')]);}_0xc53d55['order']=qs['sort'](_0xe0f361[_0x1b89('0x2c')][_0x1b89('0x33')]);_0xc53d55[_0x1b89('0x34')]=qs[_0x1b89('0x35')](_[_0x1b89('0x36')](_0xe0f361['query'],_0x5f375e['filters']),_0x73aa50);if(_0xe0f361[_0x1b89('0x2c')][_0x1b89('0x37')]){_0xc53d55[_0x1b89('0x34')]=_[_0x1b89('0x38')](_0xc53d55[_0x1b89('0x34')],{'$or':_[_0x1b89('0x29')](_0x73aa50,function(_0x5d0bfe){if(_0x5d0bfe[_0x1b89('0x2b')]!==_0x1b89('0x39')){var _0x21a9c8={};_0x21a9c8[_0x5d0bfe['name']]={'$like':'%'+_0xe0f361[_0x1b89('0x2c')]['filter']+'%'};return _0x21a9c8;}})});}_0xc53d55=_['merge']({},_0xc53d55,_0xe0f361[_0x1b89('0x3a')]);var _0x50c7bb={'where':_0xc53d55[_0x1b89('0x34')]};return db['Migration'][_0x1b89('0x1a')](_0x50c7bb)[_0x1b89('0x22')](function(_0x5b2204){_0x1b1fbe['count']=_0x5b2204;if(_0xe0f361[_0x1b89('0x2c')][_0x1b89('0x3b')]){_0xc53d55[_0x1b89('0x3c')]=[{'all':!![]}];}return db[_0x1b89('0x3d')][_0x1b89('0x3e')](_0xc53d55);})[_0x1b89('0x22')](function(_0x5b829b){_0x1b1fbe[_0x1b89('0x3f')]=_0x5b829b;return _0x1b1fbe;})[_0x1b89('0x22')](respondWithFilteredResult(_0x3b0800,_0xc53d55))['catch'](handleError(_0x3b0800,null));}; \ No newline at end of file +var _0xbebf=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x49255c,_0x5e373c){var _0x4d50a2=function(_0x179954){while(--_0x179954){_0x49255c['push'](_0x49255c['shift']());}};_0x4d50a2(++_0x5e373c);}(_0xbebf,0xf9));var _0xfbeb=function(_0x15da71,_0x30d813){_0x15da71=_0x15da71-0x0;var _0x12ce6d=_0xbebf[_0x15da71];return _0x12ce6d;};'use strict';var emlformat=require(_0xfbeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbeb('0x1'));var jsonpatch=require(_0xfbeb('0x2'));var rp=require(_0xfbeb('0x3'));var moment=require(_0xfbeb('0x4'));var BPromise=require(_0xfbeb('0x5'));var Mustache=require('mustache');var util=require(_0xfbeb('0x6'));var path=require(_0xfbeb('0x7'));var sox=require(_0xfbeb('0x8'));var csv=require(_0xfbeb('0x9'));var ejs=require(_0xfbeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbeb('0xb'));var squel=require(_0xfbeb('0xc'));var crypto=require(_0xfbeb('0xd'));var jsforce=require(_0xfbeb('0xe'));var deskjs=require(_0xfbeb('0xf'));var toCsv=require(_0xfbeb('0x9'));var querystring=require('querystring');var Papa=require(_0xfbeb('0x10'));var Redis=require(_0xfbeb('0x11'));var authService=require(_0xfbeb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfbeb('0x13'));var hardwareService=require(_0xfbeb('0x14'));var logger=require(_0xfbeb('0x15'))('api');var utils=require(_0xfbeb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfbeb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdbc2db,_0x5aef2d){_0x5aef2d=_0x5aef2d||0xcc;return function(_0x57878f){if(_0x57878f){return _0xdbc2db[_0xfbeb('0x18')](_0x5aef2d);}return _0xdbc2db[_0xfbeb('0x19')](_0x5aef2d)[_0xfbeb('0x1a')]();};}function respondWithResult(_0xbe6426,_0x33851e){_0x33851e=_0x33851e||0xc8;return function(_0x4d8d71){if(_0x4d8d71){return _0xbe6426[_0xfbeb('0x19')](_0x33851e)[_0xfbeb('0x1b')](_0x4d8d71);}};}function respondWithFilteredResult(_0x14271b,_0x532602){return function(_0x461a10){if(_0x461a10){var _0x1bc76f=typeof _0x532602[_0xfbeb('0x1c')]===_0xfbeb('0x1d')&&typeof _0x532602[_0xfbeb('0x1e')]==='undefined';var _0x4d4935=_0x461a10[_0xfbeb('0x1f')];var _0x53101c=_0x1bc76f?0x0:_0x532602[_0xfbeb('0x1c')];var _0x2a3781=_0x1bc76f?_0x461a10[_0xfbeb('0x1f')]:_0x532602[_0xfbeb('0x1c')]+_0x532602['limit'];var _0x47c371;if(_0x2a3781>=_0x4d4935){_0x2a3781=_0x4d4935;_0x47c371=0xc8;}else{_0x47c371=0xce;}_0x14271b[_0xfbeb('0x19')](_0x47c371);return _0x14271b[_0xfbeb('0x20')](_0xfbeb('0x21'),_0x53101c+'-'+_0x2a3781+'/'+_0x4d4935)['json'](_0x461a10);}return null;};}function patchUpdates(_0x45455a){return function(_0x4bf4af){try{jsonpatch['apply'](_0x4bf4af,_0x45455a,!![]);}catch(_0x33d8f4){return BPromise[_0xfbeb('0x22')](_0x33d8f4);}return _0x4bf4af[_0xfbeb('0x23')]();};}function saveUpdates(_0x1c1ff4,_0x52dfb1){return function(_0x2617ee){if(_0x2617ee){return _0x2617ee['update'](_0x1c1ff4)[_0xfbeb('0x24')](function(_0x5291ce){return _0x5291ce;});}return null;};}function removeEntity(_0x27a44f,_0x2806a7){return function(_0x230de1){if(_0x230de1){return _0x230de1[_0xfbeb('0x25')]()['then'](function(){_0x27a44f['status'](0xcc)[_0xfbeb('0x1a')]();});}};}function handleEntityNotFound(_0x1da75d,_0x20ab23){return function(_0x2639b9){if(!_0x2639b9){_0x1da75d['sendStatus'](0x194);}return _0x2639b9;};}function handleError(_0x1f12ae,_0x292f2e){_0x292f2e=_0x292f2e||0x1f4;return function(_0x316157){logger['error'](_0x316157['stack']);if(_0x316157[_0xfbeb('0x26')]){delete _0x316157[_0xfbeb('0x26')];}_0x1f12ae[_0xfbeb('0x19')](_0x292f2e)[_0xfbeb('0x27')](_0x316157);};}exports[_0xfbeb('0x28')]=function(_0x1a2adf,_0x35988c){var _0x44b97e={},_0x1f275a={},_0x5704c0={'count':0x0,'rows':[]};var _0x26d27e=_[_0xfbeb('0x29')](db[_0xfbeb('0x2a')][_0xfbeb('0x2b')],function(_0x54433e){return{'name':_0x54433e[_0xfbeb('0x2c')],'type':_0x54433e[_0xfbeb('0x2d')]['key']};});_0x1f275a[_0xfbeb('0x2e')]=_[_0xfbeb('0x29')](_0x26d27e,_0xfbeb('0x26'));_0x1f275a[_0xfbeb('0x2f')]=_[_0xfbeb('0x30')](_0x1a2adf[_0xfbeb('0x2f')]);_0x1f275a[_0xfbeb('0x31')]=_[_0xfbeb('0x32')](_0x1f275a['model'],_0x1f275a[_0xfbeb('0x2f')]);_0x44b97e[_0xfbeb('0x33')]=_['intersection'](_0x1f275a[_0xfbeb('0x2e')],qs[_0xfbeb('0x34')](_0x1a2adf[_0xfbeb('0x2f')][_0xfbeb('0x34')]));_0x44b97e[_0xfbeb('0x33')]=_0x44b97e[_0xfbeb('0x33')]['length']?_0x44b97e[_0xfbeb('0x33')]:_0x1f275a[_0xfbeb('0x2e')];if(!_0x1a2adf['query'][_0xfbeb('0x35')](_0xfbeb('0x36'))){_0x44b97e['limit']=qs[_0xfbeb('0x1e')](_0x1a2adf['query'][_0xfbeb('0x1e')]);_0x44b97e[_0xfbeb('0x1c')]=qs[_0xfbeb('0x1c')](_0x1a2adf[_0xfbeb('0x2f')]['offset']);}_0x44b97e[_0xfbeb('0x37')]=qs['sort'](_0x1a2adf[_0xfbeb('0x2f')][_0xfbeb('0x38')]);_0x44b97e[_0xfbeb('0x39')]=qs[_0xfbeb('0x31')](_['pick'](_0x1a2adf['query'],_0x1f275a[_0xfbeb('0x31')]),_0x26d27e);if(_0x1a2adf[_0xfbeb('0x2f')][_0xfbeb('0x3a')]){_0x44b97e[_0xfbeb('0x39')]=_[_0xfbeb('0x3b')](_0x44b97e[_0xfbeb('0x39')],{'$or':_[_0xfbeb('0x29')](_0x26d27e,function(_0x366b8f){if(_0x366b8f[_0xfbeb('0x2d')]!=='VIRTUAL'){var _0x15237c={};_0x15237c[_0x366b8f[_0xfbeb('0x26')]]={'$like':'%'+_0x1a2adf['query']['filter']+'%'};return _0x15237c;}})});}_0x44b97e=_[_0xfbeb('0x3b')]({},_0x44b97e,_0x1a2adf[_0xfbeb('0x3c')]);var _0x436588={'where':_0x44b97e['where']};return db[_0xfbeb('0x2a')]['count'](_0x436588)[_0xfbeb('0x24')](function(_0x4952eb){_0x5704c0[_0xfbeb('0x1f')]=_0x4952eb;if(_0x1a2adf[_0xfbeb('0x2f')][_0xfbeb('0x3d')]){_0x44b97e[_0xfbeb('0x3e')]=[{'all':!![]}];}return db[_0xfbeb('0x2a')]['findAll'](_0x44b97e);})[_0xfbeb('0x24')](function(_0x4186d8){_0x5704c0[_0xfbeb('0x3f')]=_0x4186d8;return _0x5704c0;})[_0xfbeb('0x24')](respondWithFilteredResult(_0x35988c,_0x44b97e))[_0xfbeb('0x40')](handleError(_0x35988c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index fe5390e..cd49c79 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 _0x7e8f=['./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7e8f,0xbb));var _0xf7e8=function(_0x26ea78,_0x4deaaa){_0x26ea78=_0x26ea78-0x0;var _0x2bc8f1=_0x7e8f[_0x26ea78];return _0x2bc8f1;};'use strict';var _=require(_0xf7e8('0x0'));var util=require(_0xf7e8('0x1'));var logger=require(_0xf7e8('0x2'))(_0xf7e8('0x3'));var moment=require('moment');var BPromise=require(_0xf7e8('0x4'));var rp=require(_0xf7e8('0x5'));var fs=require('fs');var path=require(_0xf7e8('0x6'));var rimraf=require(_0xf7e8('0x7'));var config=require(_0xf7e8('0x8'));var attributes=require(_0xf7e8('0x9'));module[_0xf7e8('0xa')]=function(_0xbd6763,_0x34553f){return _0xbd6763[_0xf7e8('0xb')](_0xf7e8('0xc'),attributes,{'tableName':_0xf7e8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfc4=['../../config/logger','moment','request-promise','path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','util'];(function(_0x5d6790,_0x434e41){var _0x5404b5=function(_0x586c20){while(--_0x586c20){_0x5d6790['push'](_0x5d6790['shift']());}};_0x5404b5(++_0x434e41);}(_0xbfc4,0xa6));var _0x4bfc=function(_0x49642e,_0xa52730){_0x49642e=_0x49642e-0x0;var _0x2ff77b=_0xbfc4[_0x49642e];return _0x2ff77b;};'use strict';var _=require(_0x4bfc('0x0'));var util=require(_0x4bfc('0x1'));var logger=require(_0x4bfc('0x2'))('api');var moment=require(_0x4bfc('0x3'));var BPromise=require('bluebird');var rp=require(_0x4bfc('0x4'));var fs=require('fs');var path=require(_0x4bfc('0x5'));var rimraf=require(_0x4bfc('0x6'));var config=require('../../config/environment');var attributes=require(_0x4bfc('0x7'));module[_0x4bfc('0x8')]=function(_0x3caebb,_0x1c5783){return _0x3caebb[_0x4bfc('0x9')](_0x4bfc('0xa'),attributes,{'tableName':_0x4bfc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 91e15af..6d1de37 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 _0x1ddc=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1f1cd4,_0x4a52c9){var _0x2c4bac=function(_0x11abe5){while(--_0x11abe5){_0x1f1cd4['push'](_0x1f1cd4['shift']());}};_0x2c4bac(++_0x4a52c9);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x39f8fc,_0x6749a0){_0x39f8fc=_0x39f8fc-0x0;var _0x46f5d2=_0x1ddc[_0x39f8fc];return _0x46f5d2;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3938ff,_0x25c543,_0x593de5){return new BPromise(function(_0x54819b,_0x411452){return client[_0xc1dd('0x9')](_0x3938ff,_0x593de5)[_0xc1dd('0xa')](function(_0x217d07){logger['info'](_0xc1dd('0xb'),_0x25c543,_0xc1dd('0xc'));logger[_0xc1dd('0xd')](_0xc1dd('0xe'),_0x25c543,'request\x20sent',JSON[_0xc1dd('0xf')](_0x217d07));if(_0x217d07[_0xc1dd('0x10')]){if(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x11')]===0x1f4){logger[_0xc1dd('0x10')](_0xc1dd('0xb'),_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x411452(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}logger[_0xc1dd('0x10')]('Migration,\x20%s,\x20%s',_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x54819b(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}else{logger[_0xc1dd('0x13')]('Migration,\x20%s,\x20%s',_0x25c543,_0xc1dd('0xc'));_0x54819b(_0x217d07[_0xc1dd('0x14')][_0xc1dd('0x12')]);}})[_0xc1dd('0x15')](function(_0x5815d3){logger['error'](_0xc1dd('0xb'),_0x25c543,_0x5815d3);_0x411452(_0x5815d3);});});} \ No newline at end of file +var _0x3c81=['Migration,\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','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49065f,_0x413515){var _0x38133f=function(_0x4e8c14){while(--_0x4e8c14){_0x49065f['push'](_0x49065f['shift']());}};_0x38133f(++_0x413515);}(_0x3c81,0x102));var _0x13c8=function(_0x142f1f,_0x561d98){_0x142f1f=_0x142f1f-0x0;var _0x28d8cf=_0x3c81[_0x142f1f];return _0x28d8cf;};'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')]('Migration,\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 diff --git a/server/api/network/index.js b/server/api/network/index.js index caa35ce..94adec3 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 _0x62cf=['delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x10978d,_0x2d91ea){var _0x24aac3=function(_0x2c3e45){while(--_0x2c3e45){_0x10978d['push'](_0x10978d['shift']());}};_0x24aac3(++_0x2d91ea);}(_0x62cf,0x81));var _0xf62c=function(_0x477a27,_0xacef61){_0x477a27=_0x477a27-0x0;var _0x4f50c8=_0x62cf[_0x477a27];return _0x4f50c8;};'use strict';var multer=require(_0xf62c('0x0'));var util=require('util');var path=require(_0xf62c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf62c('0x2'));var router=express[_0xf62c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var controller=require(_0xf62c('0x6'));router[_0xf62c('0x7')]('/',auth[_0xf62c('0x8')](),controller[_0xf62c('0x9')]);router[_0xf62c('0x7')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller['show']);router[_0xf62c('0xb')]('/',auth['isAuthenticated'](),controller[_0xf62c('0xc')]);router[_0xf62c('0xd')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller[_0xf62c('0xe')]);router[_0xf62c('0xf')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller[_0xf62c('0x10')]);module[_0xf62c('0x11')]=router; \ No newline at end of file +var _0xba55=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4aba03,_0x38679a){var _0x3872cd=function(_0x3f704c){while(--_0x3f704c){_0x4aba03['push'](_0x4aba03['shift']());}};_0x3872cd(++_0x38679a);}(_0xba55,0x1f3));var _0x5ba5=function(_0x58e3e1,_0x1a6f0b){_0x58e3e1=_0x58e3e1-0x0;var _0x5db05a=_0xba55[_0x58e3e1];return _0x5db05a;};'use strict';var multer=require(_0x5ba5('0x0'));var util=require(_0x5ba5('0x1'));var path=require(_0x5ba5('0x2'));var timeout=require(_0x5ba5('0x3'));var express=require('express');var router=express[_0x5ba5('0x4')]();var fs_extra=require(_0x5ba5('0x5'));var auth=require(_0x5ba5('0x6'));var interaction=require(_0x5ba5('0x7'));var config=require(_0x5ba5('0x8'));var controller=require(_0x5ba5('0x9'));router['get']('/',auth[_0x5ba5('0xa')](),controller['index']);router[_0x5ba5('0xb')](_0x5ba5('0xc'),auth[_0x5ba5('0xa')](),controller[_0x5ba5('0xd')]);router[_0x5ba5('0xe')]('/',auth[_0x5ba5('0xa')](),controller[_0x5ba5('0xf')]);router[_0x5ba5('0x10')]('/:id',auth[_0x5ba5('0xa')](),controller[_0x5ba5('0x11')]);router['delete'](_0x5ba5('0xc'),auth['isAuthenticated'](),controller[_0x5ba5('0x12')]);module[_0x5ba5('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index fc7556c..f7c3bef 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 _0xaadc=['sequelize','exports','ENUM','localnet','externip','stun','STRING'];(function(_0x3f23a9,_0x48d5e1){var _0x48dde5=function(_0x486caf){while(--_0x486caf){_0x3f23a9['push'](_0x3f23a9['shift']());}};_0x48dde5(++_0x48d5e1);}(_0xaadc,0x150));var _0xcaad=function(_0x5c7688,_0x4fff1c){_0x5c7688=_0x5c7688-0x0;var _0x23c410=_0xaadc[_0x5c7688];return _0x23c410;};'use strict';var Sequelize=require(_0xcaad('0x0'));module[_0xcaad('0x1')]={'type':{'type':Sequelize[_0xcaad('0x2')](_0xcaad('0x3'),_0xcaad('0x4'),_0xcaad('0x5'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcaad('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde37=['STRING','sequelize','exports','ENUM','localnet','turn'];(function(_0x9aca96,_0x497a2a){var _0x2d64a5=function(_0x47c53f){while(--_0x47c53f){_0x9aca96['push'](_0x9aca96['shift']());}};_0x2d64a5(++_0x497a2a);}(_0xde37,0x121));var _0x7de3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde37[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7de3('0x0'));module[_0x7de3('0x1')]={'type':{'type':Sequelize[_0x7de3('0x2')](_0x7de3('0x3'),'externip','stun',_0x7de3('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7de3('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 934597a..a050427 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 _0x93a0=['where','Network','includeAll','include','findAll','params','keys','fields','options','create','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','chan_sip.so','body','format','find','TURN','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','util','path','lodash','../../config/logger','api','../../mysqldb','jayson/promise','request','then','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','pick','filter'];(function(_0xbd39d7,_0x2961a6){var _0x14ccb2=function(_0x3853e3){while(--_0x3853e3){_0xbd39d7['push'](_0xbd39d7['shift']());}};_0x14ccb2(++_0x2961a6);}(_0x93a0,0x1af));var _0x093a=function(_0x4d928c,_0x2e40b4){_0x4d928c=_0x4d928c-0x0;var _0x875ce=_0x93a0[_0x4d928c];return _0x875ce;};'use strict';var util=require(_0x093a('0x0'));var path=require(_0x093a('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x093a('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x093a('0x3'))(_0x093a('0x4'));var config=require('../../config/environment');var db=require(_0x093a('0x5'))['db'];var jayson=require(_0x093a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x404418,_0x3cdd7f,_0x924fe4,_0x46ebfc){return new Promise(function(_0x41955f,_0x1ae51e){var _0x2e799c=_0x46ebfc||client;return _0x2e799c[_0x093a('0x7')](_0x404418,_0x924fe4)[_0x093a('0x8')](function(_0x26df41){logger['info'](_0x093a('0x9'),_0x3cdd7f,'request\x20sent');logger['debug'](_0x093a('0xa'),_0x3cdd7f,_0x093a('0xb'),JSON['stringify'](_0x26df41));if(_0x26df41[_0x093a('0xc')]){if(_0x26df41[_0x093a('0xc')]['code']===0x1f4){logger['error'](_0x093a('0x9'),_0x3cdd7f,_0x26df41[_0x093a('0xc')][_0x093a('0xd')]);return _0x1ae51e(_0x26df41[_0x093a('0xc')][_0x093a('0xd')]);}logger[_0x093a('0xc')](_0x093a('0x9'),_0x3cdd7f,_0x26df41[_0x093a('0xc')]['message']);return _0x41955f(_0x26df41[_0x093a('0xc')][_0x093a('0xd')]);}else{logger[_0x093a('0xe')](_0x093a('0x9'),_0x3cdd7f,_0x093a('0xb'));_0x41955f(_0x26df41[_0x093a('0xf')][_0x093a('0xd')]);}})[_0x093a('0x10')](function(_0x288f56){logger['error']('Network,\x20%s,\x20%s',_0x3cdd7f,_0x288f56);_0x1ae51e(_0x288f56);});});}function respondWithResult(_0x3a3ce5,_0xb1f9d7){_0xb1f9d7=_0xb1f9d7||0xc8;return function(_0x9c562c){if(_0x9c562c){return _0x3a3ce5[_0x093a('0x11')](_0xb1f9d7)[_0x093a('0x12')](_0x9c562c);}};}function respondWithFilteredResult(_0x4e53f6,_0x440087){return function(_0x3af104){if(_0x3af104){var _0x3e76c0=typeof _0x440087['offset']===_0x093a('0x13')&&typeof _0x440087[_0x093a('0x14')]===_0x093a('0x13');var _0xfb2d56=_0x3af104[_0x093a('0x15')];var _0x26efc1=_0x3e76c0?0x0:_0x440087[_0x093a('0x16')];var _0x4696d2=_0x3e76c0?_0x3af104[_0x093a('0x15')]:_0x440087[_0x093a('0x16')]+_0x440087[_0x093a('0x14')];var _0x154400;if(_0x4696d2>=_0xfb2d56){_0x4696d2=_0xfb2d56;_0x154400=0xc8;}else{_0x154400=0xce;}_0x4e53f6[_0x093a('0x11')](_0x154400);return _0x4e53f6[_0x093a('0x17')](_0x093a('0x18'),_0x26efc1+'-'+_0x4696d2+'/'+_0xfb2d56)[_0x093a('0x12')](_0x3af104);}return null;};}function saveUpdates(_0x49abf6){return function(_0x3b726c){if(_0x3b726c){return _0x3b726c[_0x093a('0x19')](_0x49abf6)[_0x093a('0x8')](function(_0xc5deb5){return _0xc5deb5;});}return null;};}function removeEntity(_0x2a7ea4){return function(_0x5e61d9){if(_0x5e61d9){return _0x5e61d9[_0x093a('0x1a')]()[_0x093a('0x8')](function(){_0x2a7ea4[_0x093a('0x11')](0xcc)[_0x093a('0x1b')]();});}};}function handleEntityNotFound(_0x1aca2e){return function(_0x3bd867){if(!_0x3bd867){_0x1aca2e[_0x093a('0x1c')](0x194);}return _0x3bd867;};}function handleError(_0x21b3dc,_0x427d0a){_0x427d0a=_0x427d0a||0x1f4;return function(_0x42a061){logger[_0x093a('0xc')](_0x42a061[_0x093a('0x1d')]);if(_0x42a061[_0x093a('0x1e')]){delete _0x42a061['name'];}_0x21b3dc[_0x093a('0x11')](_0x427d0a)[_0x093a('0x1f')](_0x42a061);};}exports[_0x093a('0x20')]=function(_0x5475f4,_0x3c383c){var _0xe255da={},_0x435835={},_0x477394={'count':0x0,'rows':[]};var _0x225729=_[_0x093a('0x21')](db['Network'][_0x093a('0x22')],function(_0xd81a4f){return{'name':_0xd81a4f[_0x093a('0x23')],'type':_0xd81a4f[_0x093a('0x24')][_0x093a('0x25')]};});_0x435835[_0x093a('0x26')]=_[_0x093a('0x21')](_0x225729,_0x093a('0x1e'));_0x435835['query']=_['keys'](_0x5475f4['query']);_0x435835[_0x093a('0x27')]=_[_0x093a('0x28')](_0x435835[_0x093a('0x26')],_0x435835[_0x093a('0x29')]);_0xe255da[_0x093a('0x2a')]=_[_0x093a('0x28')](_0x435835[_0x093a('0x26')],qs['fields'](_0x5475f4[_0x093a('0x29')]['fields']));_0xe255da[_0x093a('0x2a')]=_0xe255da[_0x093a('0x2a')][_0x093a('0x2b')]?_0xe255da[_0x093a('0x2a')]:_0x435835['model'];if(!_0x5475f4[_0x093a('0x29')][_0x093a('0x2c')]('nolimit')){_0xe255da[_0x093a('0x14')]=qs[_0x093a('0x14')](_0x5475f4[_0x093a('0x29')][_0x093a('0x14')]);_0xe255da[_0x093a('0x16')]=qs['offset'](_0x5475f4[_0x093a('0x29')][_0x093a('0x16')]);}_0xe255da[_0x093a('0x2d')]=qs[_0x093a('0x2e')](_0x5475f4[_0x093a('0x29')][_0x093a('0x2e')]);_0xe255da['where']=qs['filters'](_[_0x093a('0x2f')](_0x5475f4[_0x093a('0x29')],_0x435835[_0x093a('0x27')]),_0x225729);if(_0x5475f4[_0x093a('0x29')][_0x093a('0x30')]){_0xe255da[_0x093a('0x31')]=_['merge'](_0xe255da[_0x093a('0x31')],{'$or':_['map'](_0x225729,function(_0x4e17aa){if(_0x4e17aa['type']!=='VIRTUAL'){var _0x1d152c={};_0x1d152c[_0x4e17aa[_0x093a('0x1e')]]={'$like':'%'+_0x5475f4[_0x093a('0x29')]['filter']+'%'};return _0x1d152c;}})});}_0xe255da=_['merge']({},_0xe255da,_0x5475f4['options']);var _0x278e2b={'where':_0xe255da[_0x093a('0x31')]};return db[_0x093a('0x32')][_0x093a('0x15')](_0x278e2b)['then'](function(_0xd2dd78){_0x477394['count']=_0xd2dd78;if(_0x5475f4['query'][_0x093a('0x33')]){_0xe255da[_0x093a('0x34')]=[{'all':!![]}];}return db['Network'][_0x093a('0x35')](_0xe255da);})[_0x093a('0x8')](function(_0x322111){_0x477394['rows']=_0x322111;return _0x477394;})['then'](respondWithFilteredResult(_0x3c383c,_0xe255da))[_0x093a('0x10')](handleError(_0x3c383c,null));};exports['show']=function(_0x352a83,_0xb319d1){var _0x3380fd={'raw':!![],'where':{'id':_0x352a83[_0x093a('0x36')]['id']}},_0x1a4c0c={};_0x1a4c0c[_0x093a('0x26')]=_[_0x093a('0x37')](db['Network'][_0x093a('0x22')]);_0x1a4c0c[_0x093a('0x29')]=_[_0x093a('0x37')](_0x352a83['query']);_0x1a4c0c[_0x093a('0x27')]=_['intersection'](_0x1a4c0c[_0x093a('0x26')],_0x1a4c0c['query']);_0x3380fd[_0x093a('0x2a')]=_[_0x093a('0x28')](_0x1a4c0c[_0x093a('0x26')],qs[_0x093a('0x38')](_0x352a83[_0x093a('0x29')][_0x093a('0x38')]));_0x3380fd[_0x093a('0x2a')]=_0x3380fd[_0x093a('0x2a')]['length']?_0x3380fd['attributes']:_0x1a4c0c[_0x093a('0x26')];if(_0x352a83['query'][_0x093a('0x33')]){_0x3380fd[_0x093a('0x34')]=[{'all':!![]}];}_0x3380fd=_['merge']({},_0x3380fd,_0x352a83[_0x093a('0x39')]);return db[_0x093a('0x32')]['find'](_0x3380fd)[_0x093a('0x8')](handleEntityNotFound(_0xb319d1,null))[_0x093a('0x8')](respondWithResult(_0xb319d1,null))[_0x093a('0x10')](handleError(_0xb319d1,null));};exports[_0x093a('0x3a')]=function(_0x56daa6,_0xd4ce40){var _0x439987;return db['Network'][_0x093a('0x3a')](_0x56daa6['body'],{'raw':!![]})['then'](function(_0x4e87b9){_0x439987=_0x4e87b9;return db['Network']['findAll']({'where':{'type':_0x56daa6['body'][_0x093a('0x24')]},'raw':!![]});})['then'](function(_0x37c980){if(_0x439987['type'][_0x093a('0x3b')]()==_0x093a('0x3c')){var _0x5a672f=fs[_0x093a('0x3d')](path[_0x093a('0x3e')](config[_0x093a('0x3f')],_0x093a('0x40')),_0x093a('0x41'));var _0x5a9de9=ejs[_0x093a('0x42')](_0x5a672f,{'networks':_0x37c980||[]});fs['writeFileSync'](_0x093a('0x43'),_0x5a9de9);return respondWithRpcPromise(_0x093a('0x44'),_0x093a('0x3a'),{'module':_0x093a('0x45')});}else if(_0x439987[_0x093a('0x24')][_0x093a('0x3b')]()=='TURN'){var _0x17d8f9=fs[_0x093a('0x3d')](path[_0x093a('0x3e')](config[_0x093a('0x3f')],'server/files/templates/turn_multiple.ejs'),_0x093a('0x41'));var _0x2f37fa=ejs[_0x093a('0x42')](_0x17d8f9,{'networks':_0x37c980||[]});fs[_0x093a('0x46')](_0x093a('0x47'),_0x2f37fa);return respondWithRpcPromise(_0x093a('0x44'),_0x093a('0x3a'),{'module':_0x093a('0x45')});}else{var _0x1336f9=fs[_0x093a('0x3d')](path[_0x093a('0x3e')](config['root'],_0x093a('0x48')),'utf8');var _0x1f9195=ejs['render'](_0x1336f9,{'networks':_0x37c980||[]});fs[_0x093a('0x46')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x56daa6['body'][_0x093a('0x24')]['toLowerCase']()),_0x1f9195);return respondWithRpcPromise(_0x093a('0x44'),'create',{'module':_0x093a('0x49')});}})['then'](function(){return _0x439987;})[_0x093a('0x8')](respondWithResult(_0xd4ce40,0xc9))[_0x093a('0x10')](handleError(_0xd4ce40,null));};exports['update']=function(_0x1aa01a,_0x66f55f){var _0x361d9c;return db[_0x093a('0x32')]['find']({'where':{'id':_0x1aa01a[_0x093a('0x36')]['id']}})[_0x093a('0x8')](handleEntityNotFound(_0x66f55f,null))['then'](saveUpdates(_0x1aa01a[_0x093a('0x4a')],null))['then'](function(_0x75eb0d){if(_0x75eb0d){_0x361d9c=_0x75eb0d;return db[_0x093a('0x32')][_0x093a('0x35')]({'where':{'type':_0x361d9c[_0x093a('0x24')]},'raw':!![]});}return null;})[_0x093a('0x8')](function(_0xe39008){if(_0x361d9c[_0x093a('0x24')][_0x093a('0x3b')]()==_0x093a('0x3c')){var _0x135dbf=fs['readFileSync'](path['join'](config[_0x093a('0x3f')],_0x093a('0x40')),'utf8');var _0x46dfcf=ejs['render'](_0x135dbf,{'networks':_0xe39008||[]});fs[_0x093a('0x46')]('/etc/asterisk/stun_xcally.conf',_0x46dfcf);return respondWithRpcPromise(_0x093a('0x44'),'update',{'module':_0x093a('0x45')});}else if(_0x361d9c[_0x093a('0x24')][_0x093a('0x3b')]()=='TURN'){var _0x2db485=fs['readFileSync'](path[_0x093a('0x3e')](config[_0x093a('0x3f')],'server/files/templates/turn_multiple.ejs'),_0x093a('0x41'));var _0x4b1a8d=ejs['render'](_0x2db485,{'networks':_0xe39008||[]});fs[_0x093a('0x46')]('/etc/asterisk/turn_xcally.conf',_0x4b1a8d);return respondWithRpcPromise(_0x093a('0x44'),_0x093a('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x51cf5b=fs[_0x093a('0x3d')](path[_0x093a('0x3e')](config[_0x093a('0x3f')],_0x093a('0x48')),_0x093a('0x41'));var _0xe8264b=ejs['render'](_0x51cf5b,{'networks':_0xe39008||[]});fs[_0x093a('0x46')](util[_0x093a('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x1aa01a[_0x093a('0x4a')][_0x093a('0x24')]['toLowerCase']()),_0xe8264b);return respondWithRpcPromise(_0x093a('0x44'),'update',{'module':_0x093a('0x49')});}})[_0x093a('0x8')](function(_0x151d1b){if(_0x151d1b){return _0x361d9c;}return null;})[_0x093a('0x8')](respondWithResult(_0x66f55f,null))[_0x093a('0x10')](handleError(_0x66f55f,null));};exports[_0x093a('0x1a')]=function(_0x3cae99,_0x5360d4){var _0x2845ae;return db[_0x093a('0x32')][_0x093a('0x4c')]({'where':{'id':_0x3cae99[_0x093a('0x36')]['id']}})[_0x093a('0x8')](function(_0x47cd43){_0x2845ae=_0x47cd43;return _0x47cd43;})[_0x093a('0x8')](handleEntityNotFound(_0x5360d4,null))[_0x093a('0x8')](removeEntity(_0x5360d4,null))['then'](function(){if(_0x2845ae){return db['Network'][_0x093a('0x35')]({'where':{'type':_0x2845ae[_0x093a('0x24')]},'raw':!![]});}})[_0x093a('0x8')](function(_0x3395cf){if(_0x2845ae[_0x093a('0x24')][_0x093a('0x3b')]()==_0x093a('0x3c')){var _0x1119df=fs['readFileSync'](path[_0x093a('0x3e')](config[_0x093a('0x3f')],_0x093a('0x40')),_0x093a('0x41'));var _0x170836=ejs[_0x093a('0x42')](_0x1119df,{'networks':_0x3395cf||[]});fs[_0x093a('0x46')](_0x093a('0x43'),_0x170836);return respondWithRpcPromise(_0x093a('0x44'),'destroy',{'module':_0x093a('0x45')});}else if(_0x2845ae['type']['toUpperCase']()==_0x093a('0x4d')){var _0x571bf7=fs[_0x093a('0x3d')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x093a('0x41'));var _0x50ce1e=ejs['render'](_0x571bf7,{'networks':_0x3395cf||[]});fs[_0x093a('0x46')]('/etc/asterisk/turn_xcally.conf',_0x50ce1e);return respondWithRpcPromise('Reload',_0x093a('0x1a'),{'module':'res_stun_monitor.so'});}else{var _0x34da4b=fs[_0x093a('0x3d')](path['join'](config[_0x093a('0x3f')],_0x093a('0x48')),_0x093a('0x41'));var _0x257d9b=ejs[_0x093a('0x42')](_0x34da4b,{'networks':_0x3395cf||[]});fs[_0x093a('0x46')](util[_0x093a('0x4b')](_0x093a('0x4e'),_0x2845ae[_0x093a('0x24')][_0x093a('0x4f')]()),_0x257d9b);return respondWithRpcPromise(_0x093a('0x44'),_0x093a('0x1a'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x5360d4,null));}; \ No newline at end of file +var _0x55cd=['../../config/environment','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','count','offset','limit','set','update','destroy','sendStatus','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','keys','filters','length','find','create','body','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','STUN','format','chan_sip.so','findAll','/etc/asterisk/turn_xcally.conf','path','lodash','../../components/parsers/qs','../../config/logger'];(function(_0x355cf3,_0x12c3da){var _0x72e07=function(_0x44b10f){while(--_0x44b10f){_0x355cf3['push'](_0x355cf3['shift']());}};_0x72e07(++_0x12c3da);}(_0x55cd,0x191));var _0xd55c=function(_0x412061,_0x4c5bea){_0x412061=_0x412061-0x0;var _0x45ffa5=_0x55cd[_0x412061];return _0x45ffa5;};'use strict';var util=require('util');var path=require(_0xd55c('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd55c('0x1'));var qs=require(_0xd55c('0x2'));var logger=require(_0xd55c('0x3'))('api');var config=require(_0xd55c('0x4'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28c865,_0x1f972f,_0x425478,_0x4c2342){return new Promise(function(_0x5b6976,_0xfaa38){var _0x560581=_0x4c2342||client;return _0x560581['request'](_0x28c865,_0x425478)[_0xd55c('0x5')](function(_0x3e9181){logger[_0xd55c('0x6')](_0xd55c('0x7'),_0x1f972f,'request\x20sent');logger[_0xd55c('0x8')](_0xd55c('0x9'),_0x1f972f,_0xd55c('0xa'),JSON[_0xd55c('0xb')](_0x3e9181));if(_0x3e9181[_0xd55c('0xc')]){if(_0x3e9181[_0xd55c('0xc')][_0xd55c('0xd')]===0x1f4){logger[_0xd55c('0xc')](_0xd55c('0x7'),_0x1f972f,_0x3e9181[_0xd55c('0xc')]['message']);return _0xfaa38(_0x3e9181[_0xd55c('0xc')][_0xd55c('0xe')]);}logger[_0xd55c('0xc')]('Network,\x20%s,\x20%s',_0x1f972f,_0x3e9181['error'][_0xd55c('0xe')]);return _0x5b6976(_0x3e9181['error'][_0xd55c('0xe')]);}else{logger[_0xd55c('0x6')]('Network,\x20%s,\x20%s',_0x1f972f,_0xd55c('0xa'));_0x5b6976(_0x3e9181[_0xd55c('0xf')][_0xd55c('0xe')]);}})[_0xd55c('0x10')](function(_0xaf3f2d){logger[_0xd55c('0xc')]('Network,\x20%s,\x20%s',_0x1f972f,_0xaf3f2d);_0xfaa38(_0xaf3f2d);});});}function respondWithResult(_0xb71f9e,_0x395cb3){_0x395cb3=_0x395cb3||0xc8;return function(_0x19f0b9){if(_0x19f0b9){return _0xb71f9e[_0xd55c('0x11')](_0x395cb3)[_0xd55c('0x12')](_0x19f0b9);}};}function respondWithFilteredResult(_0x4d3272,_0x2fc7ef){return function(_0x50f14b){if(_0x50f14b){var _0x3383c7=typeof _0x2fc7ef['offset']===_0xd55c('0x13')&&typeof _0x2fc7ef['limit']===_0xd55c('0x13');var _0x38aecc=_0x50f14b[_0xd55c('0x14')];var _0x286219=_0x3383c7?0x0:_0x2fc7ef[_0xd55c('0x15')];var _0x22136e=_0x3383c7?_0x50f14b[_0xd55c('0x14')]:_0x2fc7ef['offset']+_0x2fc7ef[_0xd55c('0x16')];var _0x3ddb0c;if(_0x22136e>=_0x38aecc){_0x22136e=_0x38aecc;_0x3ddb0c=0xc8;}else{_0x3ddb0c=0xce;}_0x4d3272[_0xd55c('0x11')](_0x3ddb0c);return _0x4d3272[_0xd55c('0x17')]('Content-Range',_0x286219+'-'+_0x22136e+'/'+_0x38aecc)[_0xd55c('0x12')](_0x50f14b);}return null;};}function saveUpdates(_0x146c99){return function(_0x48eb30){if(_0x48eb30){return _0x48eb30[_0xd55c('0x18')](_0x146c99)[_0xd55c('0x5')](function(_0x1a245f){return _0x1a245f;});}return null;};}function removeEntity(_0x22013b){return function(_0x3b722f){if(_0x3b722f){return _0x3b722f[_0xd55c('0x19')]()[_0xd55c('0x5')](function(){_0x22013b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f552){return function(_0x1d8a88){if(!_0x1d8a88){_0x29f552[_0xd55c('0x1a')](0x194);}return _0x1d8a88;};}function handleError(_0x4444b0,_0x3ef542){_0x3ef542=_0x3ef542||0x1f4;return function(_0x4c5e56){logger['error'](_0x4c5e56['stack']);if(_0x4c5e56[_0xd55c('0x1b')]){delete _0x4c5e56[_0xd55c('0x1b')];}_0x4444b0['status'](_0x3ef542)['send'](_0x4c5e56);};}exports[_0xd55c('0x1c')]=function(_0x5b6ab5,_0x2f32ee){var _0x3ea653={},_0x5177d2={},_0x99149d={'count':0x0,'rows':[]};var _0xcbb7=_[_0xd55c('0x1d')](db[_0xd55c('0x1e')][_0xd55c('0x1f')],function(_0x334943){return{'name':_0x334943[_0xd55c('0x20')],'type':_0x334943[_0xd55c('0x21')][_0xd55c('0x22')]};});_0x5177d2[_0xd55c('0x23')]=_[_0xd55c('0x1d')](_0xcbb7,_0xd55c('0x1b'));_0x5177d2[_0xd55c('0x24')]=_['keys'](_0x5b6ab5[_0xd55c('0x24')]);_0x5177d2['filters']=_[_0xd55c('0x25')](_0x5177d2[_0xd55c('0x23')],_0x5177d2[_0xd55c('0x24')]);_0x3ea653[_0xd55c('0x26')]=_['intersection'](_0x5177d2[_0xd55c('0x23')],qs[_0xd55c('0x27')](_0x5b6ab5['query'][_0xd55c('0x27')]));_0x3ea653[_0xd55c('0x26')]=_0x3ea653['attributes']['length']?_0x3ea653[_0xd55c('0x26')]:_0x5177d2[_0xd55c('0x23')];if(!_0x5b6ab5[_0xd55c('0x24')][_0xd55c('0x28')](_0xd55c('0x29'))){_0x3ea653[_0xd55c('0x16')]=qs['limit'](_0x5b6ab5[_0xd55c('0x24')][_0xd55c('0x16')]);_0x3ea653[_0xd55c('0x15')]=qs['offset'](_0x5b6ab5['query'][_0xd55c('0x15')]);}_0x3ea653['order']=qs[_0xd55c('0x2a')](_0x5b6ab5['query'][_0xd55c('0x2a')]);_0x3ea653[_0xd55c('0x2b')]=qs['filters'](_[_0xd55c('0x2c')](_0x5b6ab5['query'],_0x5177d2['filters']),_0xcbb7);if(_0x5b6ab5[_0xd55c('0x24')]['filter']){_0x3ea653[_0xd55c('0x2b')]=_['merge'](_0x3ea653[_0xd55c('0x2b')],{'$or':_[_0xd55c('0x1d')](_0xcbb7,function(_0x3f0045){if(_0x3f0045[_0xd55c('0x21')]!==_0xd55c('0x2d')){var _0x32fc1a={};_0x32fc1a[_0x3f0045[_0xd55c('0x1b')]]={'$like':'%'+_0x5b6ab5[_0xd55c('0x24')][_0xd55c('0x2e')]+'%'};return _0x32fc1a;}})});}_0x3ea653=_[_0xd55c('0x2f')]({},_0x3ea653,_0x5b6ab5[_0xd55c('0x30')]);var _0x231e49={'where':_0x3ea653[_0xd55c('0x2b')]};return db['Network'][_0xd55c('0x14')](_0x231e49)[_0xd55c('0x5')](function(_0x3145ed){_0x99149d[_0xd55c('0x14')]=_0x3145ed;if(_0x5b6ab5[_0xd55c('0x24')][_0xd55c('0x31')]){_0x3ea653[_0xd55c('0x32')]=[{'all':!![]}];}return db['Network']['findAll'](_0x3ea653);})[_0xd55c('0x5')](function(_0xec17b8){_0x99149d[_0xd55c('0x33')]=_0xec17b8;return _0x99149d;})[_0xd55c('0x5')](respondWithFilteredResult(_0x2f32ee,_0x3ea653))['catch'](handleError(_0x2f32ee,null));};exports[_0xd55c('0x34')]=function(_0x35eed9,_0x417bf4){var _0x50dc5c={'raw':!![],'where':{'id':_0x35eed9[_0xd55c('0x35')]['id']}},_0x2e42c6={};_0x2e42c6['model']=_[_0xd55c('0x36')](db[_0xd55c('0x1e')]['rawAttributes']);_0x2e42c6[_0xd55c('0x24')]=_[_0xd55c('0x36')](_0x35eed9[_0xd55c('0x24')]);_0x2e42c6[_0xd55c('0x37')]=_[_0xd55c('0x25')](_0x2e42c6[_0xd55c('0x23')],_0x2e42c6['query']);_0x50dc5c['attributes']=_[_0xd55c('0x25')](_0x2e42c6[_0xd55c('0x23')],qs[_0xd55c('0x27')](_0x35eed9[_0xd55c('0x24')][_0xd55c('0x27')]));_0x50dc5c['attributes']=_0x50dc5c['attributes'][_0xd55c('0x38')]?_0x50dc5c['attributes']:_0x2e42c6[_0xd55c('0x23')];if(_0x35eed9[_0xd55c('0x24')][_0xd55c('0x31')]){_0x50dc5c[_0xd55c('0x32')]=[{'all':!![]}];}_0x50dc5c=_[_0xd55c('0x2f')]({},_0x50dc5c,_0x35eed9[_0xd55c('0x30')]);return db[_0xd55c('0x1e')][_0xd55c('0x39')](_0x50dc5c)['then'](handleEntityNotFound(_0x417bf4,null))['then'](respondWithResult(_0x417bf4,null))[_0xd55c('0x10')](handleError(_0x417bf4,null));};exports[_0xd55c('0x3a')]=function(_0x20a2e9,_0x20eecb){var _0x3ffc39;return db[_0xd55c('0x1e')][_0xd55c('0x3a')](_0x20a2e9['body'],{'raw':!![]})[_0xd55c('0x5')](function(_0x5dae6f){_0x3ffc39=_0x5dae6f;return db[_0xd55c('0x1e')]['findAll']({'where':{'type':_0x20a2e9[_0xd55c('0x3b')][_0xd55c('0x21')]},'raw':!![]});})[_0xd55c('0x5')](function(_0x50fa8b){if(_0x3ffc39[_0xd55c('0x21')]['toUpperCase']()=='STUN'){var _0x4c8e6f=fs['readFileSync'](path['join'](config[_0xd55c('0x3c')],_0xd55c('0x3d')),'utf8');var _0x13565f=ejs[_0xd55c('0x3e')](_0x4c8e6f,{'networks':_0x50fa8b||[]});fs['writeFileSync'](_0xd55c('0x3f'),_0x13565f);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x3a'),{'module':_0xd55c('0x41')});}else if(_0x3ffc39[_0xd55c('0x21')][_0xd55c('0x42')]()==_0xd55c('0x43')){var _0xdd447c=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config[_0xd55c('0x3c')],_0xd55c('0x46')),_0xd55c('0x47'));var _0x5757f3=ejs['render'](_0xdd447c,{'networks':_0x50fa8b||[]});fs[_0xd55c('0x48')]('/etc/asterisk/turn_xcally.conf',_0x5757f3);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x3a'),{'module':_0xd55c('0x41')});}else{var _0x31de9b=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config[_0xd55c('0x3c')],_0xd55c('0x49')),_0xd55c('0x47'));var _0x5588c1=ejs[_0xd55c('0x3e')](_0x31de9b,{'networks':_0x50fa8b||[]});fs['writeFileSync'](util['format'](_0xd55c('0x4a'),_0x20a2e9[_0xd55c('0x3b')]['type'][_0xd55c('0x4b')]()),_0x5588c1);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x3a'),{'module':'chan_sip.so'});}})[_0xd55c('0x5')](function(){return _0x3ffc39;})[_0xd55c('0x5')](respondWithResult(_0x20eecb,0xc9))['catch'](handleError(_0x20eecb,null));};exports[_0xd55c('0x18')]=function(_0x4a82b1,_0x1ac353){var _0x154e05;return db[_0xd55c('0x1e')][_0xd55c('0x39')]({'where':{'id':_0x4a82b1['params']['id']}})[_0xd55c('0x5')](handleEntityNotFound(_0x1ac353,null))['then'](saveUpdates(_0x4a82b1[_0xd55c('0x3b')],null))[_0xd55c('0x5')](function(_0x2d1cc2){if(_0x2d1cc2){_0x154e05=_0x2d1cc2;return db[_0xd55c('0x1e')]['findAll']({'where':{'type':_0x154e05[_0xd55c('0x21')]},'raw':!![]});}return null;})[_0xd55c('0x5')](function(_0x76c0f4){if(_0x154e05['type'][_0xd55c('0x42')]()==_0xd55c('0x4c')){var _0x4eb558=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config['root'],_0xd55c('0x3d')),_0xd55c('0x47'));var _0x2364ab=ejs[_0xd55c('0x3e')](_0x4eb558,{'networks':_0x76c0f4||[]});fs['writeFileSync'](_0xd55c('0x3f'),_0x2364ab);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x18'),{'module':_0xd55c('0x41')});}else if(_0x154e05[_0xd55c('0x21')][_0xd55c('0x42')]()==_0xd55c('0x43')){var _0x1394a4=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config[_0xd55c('0x3c')],_0xd55c('0x46')),'utf8');var _0xbb57c=ejs[_0xd55c('0x3e')](_0x1394a4,{'networks':_0x76c0f4||[]});fs[_0xd55c('0x48')]('/etc/asterisk/turn_xcally.conf',_0xbb57c);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x18'),{'module':_0xd55c('0x41')});}else{var _0x38efaa=fs['readFileSync'](path['join'](config[_0xd55c('0x3c')],_0xd55c('0x49')),_0xd55c('0x47'));var _0x18d7f1=ejs[_0xd55c('0x3e')](_0x38efaa,{'networks':_0x76c0f4||[]});fs['writeFileSync'](util[_0xd55c('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x4a82b1[_0xd55c('0x3b')][_0xd55c('0x21')][_0xd55c('0x4b')]()),_0x18d7f1);return respondWithRpcPromise('Reload',_0xd55c('0x18'),{'module':_0xd55c('0x4e')});}})['then'](function(_0x1e23f6){if(_0x1e23f6){return _0x154e05;}return null;})[_0xd55c('0x5')](respondWithResult(_0x1ac353,null))[_0xd55c('0x10')](handleError(_0x1ac353,null));};exports['destroy']=function(_0x30b072,_0x3ba839){var _0x3b151c;return db[_0xd55c('0x1e')][_0xd55c('0x39')]({'where':{'id':_0x30b072['params']['id']}})['then'](function(_0x39ea3a){_0x3b151c=_0x39ea3a;return _0x39ea3a;})[_0xd55c('0x5')](handleEntityNotFound(_0x3ba839,null))['then'](removeEntity(_0x3ba839,null))[_0xd55c('0x5')](function(){if(_0x3b151c){return db[_0xd55c('0x1e')][_0xd55c('0x4f')]({'where':{'type':_0x3b151c[_0xd55c('0x21')]},'raw':!![]});}})[_0xd55c('0x5')](function(_0x6582d3){if(_0x3b151c['type'][_0xd55c('0x42')]()=='STUN'){var _0x2658dd=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config['root'],_0xd55c('0x3d')),_0xd55c('0x47'));var _0x128057=ejs['render'](_0x2658dd,{'networks':_0x6582d3||[]});fs[_0xd55c('0x48')](_0xd55c('0x3f'),_0x128057);return respondWithRpcPromise('Reload',_0xd55c('0x19'),{'module':_0xd55c('0x41')});}else if(_0x3b151c[_0xd55c('0x21')]['toUpperCase']()==_0xd55c('0x43')){var _0x218289=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config[_0xd55c('0x3c')],'server/files/templates/turn_multiple.ejs'),_0xd55c('0x47'));var _0x337f95=ejs[_0xd55c('0x3e')](_0x218289,{'networks':_0x6582d3||[]});fs[_0xd55c('0x48')](_0xd55c('0x50'),_0x337f95);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x19'),{'module':_0xd55c('0x41')});}else{var _0x488e50=fs[_0xd55c('0x44')](path[_0xd55c('0x45')](config[_0xd55c('0x3c')],'server/files/templates/network.ejs'),_0xd55c('0x47'));var _0x2b2662=ejs['render'](_0x488e50,{'networks':_0x6582d3||[]});fs[_0xd55c('0x48')](util[_0xd55c('0x4d')](_0xd55c('0x4a'),_0x3b151c[_0xd55c('0x21')][_0xd55c('0x4b')]()),_0x2b2662);return respondWithRpcPromise(_0xd55c('0x40'),_0xd55c('0x19'),{'module':_0xd55c('0x4e')});}})['catch'](handleError(_0x3ba839,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 10723a6..6957a82 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 _0xbdb7=['request-promise','path','rimraf','./network.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0xbdb7[_0x4a2ba2];return _0x1d09fd;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xd2ea,0x15f));var _0xad2e=function(_0x54d7d3,_0x14c369){_0x54d7d3=_0x54d7d3-0x0;var _0x5a23cf=_0xd2ea[_0x54d7d3];return _0x5a23cf;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'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 5c4d05f..e6a2649 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(_0x2e71e8,_0x54150f){var _0x3d59b3=function(_0x464459){while(--_0x464459){_0x2e71e8['push'](_0x2e71e8['shift']());}};_0x3d59b3(++_0x54150f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc75b72,_0x5e755b){var _0xfc56e4=function(_0x4d360e){while(--_0x4d360e){_0xc75b72['push'](_0xc75b72['shift']());}};_0xfc56e4(++_0x5e755b);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 04d04f1..83ac104 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 _0xaebd=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','/:id','getAnswers','/:id/interactions','getInteractions','/:id/users','create','post','/:id/dispositions','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','put','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x2c7046,_0x2e6a3f){_0x2c7046=_0x2c7046-0x0;var _0x2a0ade=_0xaebd[_0x2c7046];return _0x2a0ade;};'use strict';var multer=require(_0xdaeb('0x0'));var util=require('util');var path=require(_0xdaeb('0x1'));var timeout=require(_0xdaeb('0x2'));var express=require(_0xdaeb('0x3'));var router=express[_0xdaeb('0x4')]();var fs_extra=require(_0xdaeb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var controller=require(_0xdaeb('0x8'));router[_0xdaeb('0x9')]('/',auth[_0xdaeb('0xa')](),controller['index']);router[_0xdaeb('0x9')](_0xdaeb('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xdaeb('0x9')](_0xdaeb('0xc'),auth[_0xdaeb('0xa')](),controller['show']);router[_0xdaeb('0x9')]('/:id/dispositions',auth[_0xdaeb('0xa')](),controller['getDispositions']);router[_0xdaeb('0x9')]('/:id/canned_answers',auth[_0xdaeb('0xa')](),controller[_0xdaeb('0xd')]);router['get']('/:id/applications',auth[_0xdaeb('0xa')](),controller['getApplications']);router[_0xdaeb('0x9')](_0xdaeb('0xe'),auth[_0xdaeb('0xa')](),controller[_0xdaeb('0xf')]);router[_0xdaeb('0x9')](_0xdaeb('0x10'),auth[_0xdaeb('0xa')](),controller['getAgents']);router['post']('/',auth[_0xdaeb('0xa')](),controller[_0xdaeb('0x11')]);router[_0xdaeb('0x12')](_0xdaeb('0x13'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xdaeb('0x12')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdaeb('0x14')]);router[_0xdaeb('0x12')](_0xdaeb('0x15'),controller[_0xdaeb('0x16')]);router[_0xdaeb('0x12')](_0xdaeb('0x17'),auth['isAuthenticated'](),controller[_0xdaeb('0x18')]);router['post'](_0xdaeb('0x10'),auth[_0xdaeb('0xa')](),controller[_0xdaeb('0x19')]);router['post']('/:id/send',auth[_0xdaeb('0xa')](),controller[_0xdaeb('0x1a')]);router[_0xdaeb('0x1b')](_0xdaeb('0xc'),auth[_0xdaeb('0xa')](),controller['update']);router['delete'](_0xdaeb('0xc'),auth[_0xdaeb('0xa')](),controller[_0xdaeb('0x1c')]);router[_0xdaeb('0x1d')](_0xdaeb('0x13'),auth['isAuthenticated'](),controller[_0xdaeb('0x1e')]);router['delete'](_0xdaeb('0x1f'),auth[_0xdaeb('0xa')](),controller[_0xdaeb('0x20')]);router[_0xdaeb('0x1d')](_0xdaeb('0x10'),auth['isAuthenticated'](),controller[_0xdaeb('0x21')]);module[_0xdaeb('0x22')]=router; \ No newline at end of file +var _0x8603=['/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions'];(function(_0x2b0397,_0x524af8){var _0x1a0ac9=function(_0x45c685){while(--_0x45c685){_0x2b0397['push'](_0x2b0397['shift']());}};_0x1a0ac9(++_0x524af8);}(_0x8603,0x190));var _0x3860=function(_0x300a4d,_0x30dd6f){_0x300a4d=_0x300a4d-0x0;var _0x291ef5=_0x8603[_0x300a4d];return _0x291ef5;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['describe']);router['get']('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xb')]);router['get'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller['getDispositions']);router[_0x3860('0x9')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0xe')]);router[_0x3860('0x9')]('/:id/applications',auth[_0x3860('0x7')](),controller[_0x3860('0xf')]);router[_0x3860('0x9')](_0x3860('0x10'),auth[_0x3860('0x7')](),controller[_0x3860('0x11')]);router[_0x3860('0x9')](_0x3860('0x12'),auth[_0x3860('0x7')](),controller[_0x3860('0x13')]);router['post']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x14')]);router[_0x3860('0x15')](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x16')]);router[_0x3860('0x15')](_0x3860('0xd'),auth[_0x3860('0x7')](),controller[_0x3860('0x17')]);router[_0x3860('0x15')](_0x3860('0x18'),controller['notify']);router['post'](_0x3860('0x19'),auth[_0x3860('0x7')](),controller[_0x3860('0x1a')]);router['post'](_0x3860('0x12'),auth[_0x3860('0x7')](),controller[_0x3860('0x1b')]);router[_0x3860('0x15')](_0x3860('0x1c'),auth[_0x3860('0x7')](),controller[_0x3860('0x1d')]);router[_0x3860('0x1e')](_0x3860('0x1f'),auth[_0x3860('0x7')](),controller[_0x3860('0x20')]);router[_0x3860('0x21')](_0x3860('0x1f'),auth[_0x3860('0x7')](),controller[_0x3860('0x22')]);router['delete'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x23')]);router[_0x3860('0x21')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0x24')]);router['delete']('/:id/users',auth[_0x3860('0x7')](),controller[_0x3860('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c6cdf96..d49ea02 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 _0x5d0c=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x5d0c,0x72));var _0xc5d0=function(_0x2fa822,_0x298739){_0x2fa822=_0x2fa822-0x0;var _0xdebbf7=_0x5d0c[_0x2fa822];return _0xdebbf7;};'use strict';var Sequelize=require(_0xc5d0('0x0'));var rs=require(_0xc5d0('0x1'));module[_0xc5d0('0x2')]={'name':{'type':Sequelize[_0xc5d0('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc5d0('0x4')]();}},'replyUri':{'type':Sequelize[_0xc5d0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc5d0('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc5d0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xc5d0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc5d0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc5d0('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc5d0('0x8'),'set':function(_0x54150c){if(!_0x54150c)this[_0xc5d0('0x9')](_0xc5d0('0xa'),null);this['setDataValue'](_0xc5d0('0xb'),_0x54150c);}}}; \ No newline at end of file +var _0xcb56=['INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xcb56,0xc7));var _0x6cb5=function(_0x29320d,_0x26b1f1){_0x29320d=_0x29320d-0x0;var _0xd32419=_0xcb56[_0x29320d];return _0xd32419;};'use strict';var Sequelize=require(_0x6cb5('0x0'));var rs=require(_0x6cb5('0x1'));module[_0x6cb5('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x6cb5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6cb5('0x4')]},'token':{'type':Sequelize[_0x6cb5('0x4')],'defaultValue':function(){return rs[_0x6cb5('0x5')]();}},'replyUri':{'type':Sequelize[_0x6cb5('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6cb5('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6cb5('0x6')],'defaultValue':function(){return _0x6cb5('0x7');}},'notificationSound':{'type':Sequelize[_0x6cb5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6cb5('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6cb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6cb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6cb5('0x4')]},'queueTransfer':{'type':Sequelize[_0x6cb5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6cb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6cb5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6cb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x477157){if(!_0x477157)this[_0x6cb5('0xa')](_0x6cb5('0xb'),null);this['setDataValue'](_0x6cb5('0xc'),_0x477157);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e523e48..59808e4 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 _0x31c2=['Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','Contacts','DESC','Applications','account','applications','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','Owner','fullname','internal','Tags','color','tag','rows','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','OpenchannelAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelAccount','includeAll','findAll','show','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','body','describe','addDisposition','OpenchannelAccountId','getDispositions'];(function(_0x4f5ea0,_0x3e0d3a){var _0x3d1799=function(_0x158a65){while(--_0x158a65){_0x4f5ea0['push'](_0x4f5ea0['shift']());}};_0x3d1799(++_0x3e0d3a);}(_0x31c2,0x1e1));var _0x231c=function(_0xc00d7c,_0x44bc17){_0xc00d7c=_0xc00d7c-0x0;var _0x11f2fb=_0x31c2[_0xc00d7c];return _0x11f2fb;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require(_0x231c('0x1'));var zipdir=require(_0x231c('0x2'));var jsonpatch=require(_0x231c('0x3'));var rp=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var BPromise=require(_0x231c('0x6'));var Mustache=require(_0x231c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x231c('0x8'));var csv=require(_0x231c('0x9'));var ejs=require(_0x231c('0xa'));var fs=require('fs');var fs_extra=require(_0x231c('0xb'));var _=require('lodash');var squel=require(_0x231c('0xc'));var crypto=require('crypto');var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x9'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))('api');var utils=require(_0x231c('0x16'));var config=require(_0x231c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x231c('0x18'))['db'];config[_0x231c('0x19')]=_[_0x231c('0x1a')](config[_0x231c('0x19')],{'host':_0x231c('0x1b'),'port':0x18eb});var socket=require(_0x231c('0x1c'))(new Redis(config[_0x231c('0x19')]));require(_0x231c('0x1d'))[_0x231c('0x1e')](socket);var jayson=require(_0x231c('0x1f'));var client=jayson[_0x231c('0x20')][_0x231c('0x21')]({'port':0x232c});var client9002=jayson[_0x231c('0x20')][_0x231c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x12a6ad,_0x210f2e,_0x123f2d,_0x192bac){return new BPromise(function(_0x1852e5,_0x34d540){var _0x51b8ca=_0x192bac||client;return _0x51b8ca[_0x231c('0x22')](_0x12a6ad,_0x123f2d)[_0x231c('0x23')](function(_0x17f9ce){logger[_0x231c('0x24')](_0x231c('0x25'),_0x210f2e,_0x231c('0x26'));logger[_0x231c('0x27')](_0x231c('0x28'),_0x210f2e,_0x231c('0x26'),JSON[_0x231c('0x29')](_0x17f9ce));if(_0x17f9ce['error']){if(_0x17f9ce[_0x231c('0x2a')]['code']===0x1f4){logger[_0x231c('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x210f2e,_0x17f9ce[_0x231c('0x2a')][_0x231c('0x2b')]);return _0x34d540(_0x17f9ce[_0x231c('0x2a')][_0x231c('0x2b')]);}logger[_0x231c('0x2a')](_0x231c('0x25'),_0x210f2e,_0x17f9ce[_0x231c('0x2a')][_0x231c('0x2b')]);return _0x1852e5(_0x17f9ce['error'][_0x231c('0x2b')]);}else{logger[_0x231c('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x210f2e,_0x231c('0x26'));_0x1852e5(_0x17f9ce[_0x231c('0x2c')]['message']);}})[_0x231c('0x2d')](function(_0x564939){logger[_0x231c('0x2a')](_0x231c('0x25'),_0x210f2e,_0x564939);_0x34d540(_0x564939);});});}function respondWithStatusCode(_0x40e8ff,_0x2a673c){_0x2a673c=_0x2a673c||0xcc;return function(_0x449d74){if(_0x449d74){return _0x40e8ff[_0x231c('0x2e')](_0x2a673c);}return _0x40e8ff[_0x231c('0x2f')](_0x2a673c)['end']();};}function respondWithResult(_0x33cc46,_0x1b53bc){_0x1b53bc=_0x1b53bc||0xc8;return function(_0x58f361){if(_0x58f361){return _0x33cc46[_0x231c('0x2f')](_0x1b53bc)[_0x231c('0x30')](_0x58f361);}};}function respondWithFilteredResult(_0x45ced8,_0xeeddfc){return function(_0x271635){if(_0x271635){var _0x15a9bb=typeof _0xeeddfc[_0x231c('0x31')]==='undefined'&&typeof _0xeeddfc[_0x231c('0x32')]===_0x231c('0x33');var _0x578512=_0x271635['count'];var _0x5bfc50=_0x15a9bb?0x0:_0xeeddfc[_0x231c('0x31')];var _0x5d39fa=_0x15a9bb?_0x271635[_0x231c('0x34')]:_0xeeddfc['offset']+_0xeeddfc[_0x231c('0x32')];var _0x35a956;if(_0x5d39fa>=_0x578512){_0x5d39fa=_0x578512;_0x35a956=0xc8;}else{_0x35a956=0xce;}_0x45ced8[_0x231c('0x2f')](_0x35a956);return _0x45ced8[_0x231c('0x35')]('Content-Range',_0x5bfc50+'-'+_0x5d39fa+'/'+_0x578512)[_0x231c('0x30')](_0x271635);}return null;};}function patchUpdates(_0x379017){return function(_0x1ac65b){try{jsonpatch[_0x231c('0x36')](_0x1ac65b,_0x379017,!![]);}catch(_0x43006d){return BPromise[_0x231c('0x37')](_0x43006d);}return _0x1ac65b[_0x231c('0x38')]();};}function saveUpdates(_0xa097e,_0x57f505){return function(_0x5e2d03){if(_0x5e2d03){return _0x5e2d03[_0x231c('0x39')](_0xa097e)[_0x231c('0x23')](function(_0x31d515){return _0x31d515;});}return null;};}function removeEntity(_0x2d0eb0,_0xfdd111){return function(_0x2fd2e2){if(_0x2fd2e2){return _0x2fd2e2['destroy']()[_0x231c('0x23')](function(){var _0x1a3f38=_0x2fd2e2['get']({'plain':!![]});var _0x5df5c9=_0x231c('0x3a');return db['UserProfileResource'][_0x231c('0x3b')]({'where':{'type':_0x5df5c9,'resourceId':_0x1a3f38['id']}})['then'](function(){return _0x2fd2e2;});})[_0x231c('0x23')](function(){_0x2d0eb0[_0x231c('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16fd5e,_0x433952){return function(_0x179da1){if(!_0x179da1){_0x16fd5e['sendStatus'](0x194);}return _0x179da1;};}function handleError(_0x550771,_0xf413f9){_0xf413f9=_0xf413f9||0x1f4;return function(_0x705dc4){logger[_0x231c('0x2a')](_0x705dc4[_0x231c('0x3c')]);if(_0x705dc4[_0x231c('0x3d')]){delete _0x705dc4[_0x231c('0x3d')];}_0x550771[_0x231c('0x2f')](_0xf413f9)[_0x231c('0x3e')](_0x705dc4);};}exports[_0x231c('0x3f')]=function(_0x379c6e,_0x2c8033){var _0x3f6283={'include':[{'model':db[_0x231c('0x40')],'as':_0x231c('0x41')}]},_0x486cab={},_0x214d0e={'count':0x0,'rows':[]};var _0x2f763d=_[_0x231c('0x42')](db['OpenchannelAccount'][_0x231c('0x43')],function(_0x3b62bc){return{'name':_0x3b62bc[_0x231c('0x44')],'type':_0x3b62bc['type'][_0x231c('0x45')]};});_0x486cab[_0x231c('0x46')]=_[_0x231c('0x42')](_0x2f763d,_0x231c('0x3d'));_0x486cab[_0x231c('0x47')]=_[_0x231c('0x48')](_0x379c6e['query']);_0x486cab[_0x231c('0x49')]=_[_0x231c('0x4a')](_0x486cab[_0x231c('0x46')],_0x486cab[_0x231c('0x47')]);_0x3f6283['attributes']=_[_0x231c('0x4a')](_0x486cab['model'],qs[_0x231c('0x4b')](_0x379c6e['query'][_0x231c('0x4b')]));_0x3f6283[_0x231c('0x4c')]=_0x3f6283[_0x231c('0x4c')][_0x231c('0x4d')]?_0x3f6283[_0x231c('0x4c')]:_0x486cab[_0x231c('0x46')];if(!_0x379c6e['query'][_0x231c('0x4e')](_0x231c('0x4f'))){_0x3f6283[_0x231c('0x32')]=qs['limit'](_0x379c6e[_0x231c('0x47')][_0x231c('0x32')]);_0x3f6283[_0x231c('0x31')]=qs[_0x231c('0x31')](_0x379c6e['query'][_0x231c('0x31')]);}_0x3f6283['order']=qs[_0x231c('0x50')](_0x379c6e[_0x231c('0x47')][_0x231c('0x50')]);_0x3f6283[_0x231c('0x51')]=qs[_0x231c('0x49')](_[_0x231c('0x52')](_0x379c6e[_0x231c('0x47')],_0x486cab[_0x231c('0x49')]),_0x2f763d);if(_0x379c6e[_0x231c('0x47')][_0x231c('0x53')]){_0x3f6283[_0x231c('0x51')]=_[_0x231c('0x54')](_0x3f6283[_0x231c('0x51')],{'$or':_[_0x231c('0x42')](_0x2f763d,function(_0x53f33d){if(_0x53f33d[_0x231c('0x55')]!==_0x231c('0x56')){var _0x417ee3={};_0x417ee3[_0x53f33d[_0x231c('0x3d')]]={'$like':'%'+_0x379c6e[_0x231c('0x47')]['filter']+'%'};return _0x417ee3;}})});}_0x3f6283=_['merge']({},_0x3f6283,_0x379c6e[_0x231c('0x57')]);var _0x56a885={'where':_0x3f6283[_0x231c('0x51')]};return db[_0x231c('0x58')][_0x231c('0x34')](_0x56a885)['then'](function(_0x2e170e){_0x214d0e['count']=_0x2e170e;if(_0x379c6e[_0x231c('0x47')][_0x231c('0x59')]){_0x3f6283['include']=[{'all':!![]}];}return db[_0x231c('0x58')][_0x231c('0x5a')](_0x3f6283);})[_0x231c('0x23')](function(_0x5d2d20){_0x214d0e['rows']=_0x5d2d20;return _0x214d0e;})['then'](respondWithFilteredResult(_0x2c8033,_0x3f6283))[_0x231c('0x2d')](handleError(_0x2c8033,null));};exports[_0x231c('0x5b')]=function(_0x14c3c7,_0x4f1f66){var _0x228615={'raw':![],'where':{'id':_0x14c3c7[_0x231c('0x5c')]['id']},'include':[{'model':db[_0x231c('0x40')],'as':_0x231c('0x41')}]},_0x3b1305={};_0x3b1305[_0x231c('0x46')]=_[_0x231c('0x48')](db[_0x231c('0x58')][_0x231c('0x43')]);_0x3b1305[_0x231c('0x47')]=_[_0x231c('0x48')](_0x14c3c7['query']);_0x3b1305[_0x231c('0x49')]=_[_0x231c('0x4a')](_0x3b1305['model'],_0x3b1305[_0x231c('0x47')]);_0x228615['attributes']=_[_0x231c('0x4a')](_0x3b1305[_0x231c('0x46')],qs[_0x231c('0x4b')](_0x14c3c7[_0x231c('0x47')][_0x231c('0x4b')]));_0x228615[_0x231c('0x4c')]=_0x228615[_0x231c('0x4c')][_0x231c('0x4d')]?_0x228615[_0x231c('0x4c')]:_0x3b1305[_0x231c('0x46')];if(_0x14c3c7['query'][_0x231c('0x59')]){_0x228615[_0x231c('0x5d')]=[{'all':!![]}];}_0x228615=_[_0x231c('0x54')]({},_0x228615,_0x14c3c7['options']);return db[_0x231c('0x58')][_0x231c('0x5e')](_0x228615)['then'](handleEntityNotFound(_0x4f1f66,null))[_0x231c('0x23')](respondWithResult(_0x4f1f66,null))['catch'](handleError(_0x4f1f66,null));};exports[_0x231c('0x5f')]=function(_0x1f119c,_0xe5ec4){return db[_0x231c('0x58')][_0x231c('0x5f')](_0x1f119c['body'],{})[_0x231c('0x23')](function(_0x299c00){var _0xd016a9=_0x1f119c[_0x231c('0x60')][_0x231c('0x61')]({'plain':!![]});if(!_0xd016a9)throw new Error(_0x231c('0x62'));if(_0xd016a9[_0x231c('0x63')]==='user'){var _0x5b0dcb=_0x299c00['get']({'plain':!![]});var _0x139689=_0x231c('0x3a');return db['UserProfileSection'][_0x231c('0x5e')]({'where':{'name':_0x139689,'userProfileId':_0xd016a9['userProfileId']},'raw':!![]})[_0x231c('0x23')](function(_0x1096d6){if(_0x1096d6&&_0x1096d6[_0x231c('0x64')]===0x0){return db[_0x231c('0x65')]['create']({'name':_0x5b0dcb[_0x231c('0x3d')],'resourceId':_0x5b0dcb['id'],'type':_0x1096d6['name'],'sectionId':_0x1096d6['id']},{})[_0x231c('0x23')](function(){return _0x299c00;});}else{return _0x299c00;}})['catch'](function(_0x55594b){logger[_0x231c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55594b);throw _0x55594b;});}return _0x299c00;})[_0x231c('0x23')](respondWithResult(_0xe5ec4,0xc9))[_0x231c('0x2d')](handleError(_0xe5ec4,null));};exports['update']=function(_0x4538f0,_0x38ada5){if(_0x4538f0[_0x231c('0x66')]['id']){delete _0x4538f0[_0x231c('0x66')]['id'];}return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x4538f0['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x231c('0x23')](handleEntityNotFound(_0x38ada5,null))[_0x231c('0x23')](saveUpdates(_0x4538f0[_0x231c('0x66')],null))[_0x231c('0x23')](respondWithResult(_0x38ada5,null))[_0x231c('0x2d')](handleError(_0x38ada5,null));};exports['destroy']=function(_0x57bbda,_0x284b38){return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x57bbda['params']['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x284b38,null))[_0x231c('0x23')](removeEntity(_0x284b38,null))[_0x231c('0x2d')](handleError(_0x284b38,null));};exports[_0x231c('0x67')]=function(_0x5a72da,_0x5ac686){return db['OpenchannelAccount'][_0x231c('0x67')]()[_0x231c('0x23')](respondWithResult(_0x5ac686,null))['catch'](handleError(_0x5ac686,null));};exports[_0x231c('0x68')]=function(_0x804a59,_0x39072b,_0x1f606f){if(_0x804a59[_0x231c('0x66')]['id']){delete _0x804a59[_0x231c('0x66')]['id'];}return db['OpenchannelAccount'][_0x231c('0x5e')]({'where':{'id':_0x804a59[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x39072b,null))['then'](function(_0x7ef2bd){if(_0x7ef2bd){_0x804a59[_0x231c('0x66')][_0x231c('0x69')]=_0x7ef2bd['id'];return db['Disposition'][_0x231c('0x5f')](_0x804a59[_0x231c('0x66')]);}})['then'](respondWithResult(_0x39072b,null))['catch'](handleError(_0x39072b,null));};exports[_0x231c('0x6a')]=function(_0x413e39,_0x182d15,_0x145e62){var _0x3637f9={'raw':![],'where':{}};var _0xc45acc={};var _0x323111={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x413e39[_0x231c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x182d15,null))[_0x231c('0x23')](function(_0x1ce389){if(_0x1ce389){_0xc45acc['model']=_[_0x231c('0x48')](db[_0x231c('0x6b')]['rawAttributes']);_0xc45acc[_0x231c('0x47')]=_['keys'](_0x413e39[_0x231c('0x47')]);_0xc45acc[_0x231c('0x49')]=_['intersection'](_0xc45acc[_0x231c('0x46')],_0xc45acc['query']);_0x3637f9[_0x231c('0x4c')]=_[_0x231c('0x4a')](_0xc45acc['model'],qs[_0x231c('0x4b')](_0x413e39['query'][_0x231c('0x4b')]));_0x3637f9[_0x231c('0x4c')]=_0x3637f9[_0x231c('0x4c')][_0x231c('0x4d')]?_0x3637f9[_0x231c('0x4c')]:_0xc45acc[_0x231c('0x46')];if(!_0x413e39[_0x231c('0x47')][_0x231c('0x4e')](_0x231c('0x4f'))){_0x3637f9[_0x231c('0x32')]=qs[_0x231c('0x32')](_0x413e39[_0x231c('0x47')][_0x231c('0x32')]);_0x3637f9[_0x231c('0x31')]=qs[_0x231c('0x31')](_0x413e39[_0x231c('0x47')][_0x231c('0x31')]);}_0x3637f9[_0x231c('0x6c')]=qs[_0x231c('0x50')](_0x413e39[_0x231c('0x47')][_0x231c('0x50')]);_0x3637f9[_0x231c('0x51')]=qs[_0x231c('0x49')](_['pick'](_0x413e39[_0x231c('0x47')],_0xc45acc['filters']));_0x3637f9[_0x231c('0x51')][_0x231c('0x69')]=_0x1ce389['id'];if(_0x413e39[_0x231c('0x47')][_0x231c('0x53')]){_0x3637f9['where']=_['merge'](_0x3637f9['where'],{'$or':_[_0x231c('0x42')](_0x3637f9[_0x231c('0x4c')],function(_0x5d9530){var _0x430f7a={};_0x430f7a[_0x5d9530]={'$like':'%'+_0x413e39[_0x231c('0x47')]['filter']+'%'};return _0x430f7a;})});}_0x3637f9=_[_0x231c('0x54')]({},_0x3637f9,_0x413e39['options']);return db[_0x231c('0x6b')][_0x231c('0x34')]({'where':_0x3637f9[_0x231c('0x51')]})[_0x231c('0x23')](function(_0x2a21c1){_0x323111['count']=_0x2a21c1;if(_0x413e39['query'][_0x231c('0x59')]){_0x3637f9[_0x231c('0x5d')]=[{'all':!![]}];}return db[_0x231c('0x6b')]['findAll'](_0x3637f9);})[_0x231c('0x23')](function(_0x3682a0){_0x323111['rows']=_0x3682a0;return _0x323111;});}})[_0x231c('0x23')](respondWithFilteredResult(_0x182d15,_0x3637f9))[_0x231c('0x2d')](handleError(_0x182d15,null));};exports['removeDispositions']=function(_0x12549a,_0x31d8bc,_0xf86450){return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x12549a[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x31d8bc,null))['then'](function(_0x149ba4){if(_0x149ba4){return _0x149ba4[_0x231c('0x6d')](_0x12549a[_0x231c('0x47')][_0x231c('0x6e')]);}})[_0x231c('0x23')](respondWithStatusCode(_0x31d8bc,null))[_0x231c('0x2d')](handleError(_0x31d8bc,null));};exports[_0x231c('0x6f')]=function(_0x4e5926,_0x205f3a,_0x3b41f6){if(_0x4e5926[_0x231c('0x66')]['id']){delete _0x4e5926[_0x231c('0x66')]['id'];}return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x4e5926[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x205f3a,null))[_0x231c('0x23')](function(_0x46f6f1){if(_0x46f6f1){_0x4e5926[_0x231c('0x66')][_0x231c('0x69')]=_0x46f6f1['id'];return db[_0x231c('0x70')]['create'](_0x4e5926[_0x231c('0x66')]);}})[_0x231c('0x23')](respondWithResult(_0x205f3a,null))['catch'](handleError(_0x205f3a,null));};exports['getAnswers']=function(_0x991169,_0x1820c4,_0x2bc24e){var _0x1c690e={'raw':![],'where':{}};var _0x5d94fe={};var _0x202041={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x231c('0x71')]({'where':{'id':_0x991169[_0x231c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1820c4,null))[_0x231c('0x23')](function(_0x5e8657){if(_0x5e8657){_0x5d94fe[_0x231c('0x46')]=_['keys'](db[_0x231c('0x70')][_0x231c('0x43')]);_0x5d94fe[_0x231c('0x47')]=_[_0x231c('0x48')](_0x991169[_0x231c('0x47')]);_0x5d94fe['filters']=_['intersection'](_0x5d94fe[_0x231c('0x46')],_0x5d94fe[_0x231c('0x47')]);_0x1c690e[_0x231c('0x4c')]=_['intersection'](_0x5d94fe[_0x231c('0x46')],qs[_0x231c('0x4b')](_0x991169[_0x231c('0x47')][_0x231c('0x4b')]));_0x1c690e[_0x231c('0x4c')]=_0x1c690e['attributes'][_0x231c('0x4d')]?_0x1c690e[_0x231c('0x4c')]:_0x5d94fe[_0x231c('0x46')];if(!_0x991169[_0x231c('0x47')]['hasOwnProperty'](_0x231c('0x4f'))){_0x1c690e['limit']=qs[_0x231c('0x32')](_0x991169[_0x231c('0x47')][_0x231c('0x32')]);_0x1c690e[_0x231c('0x31')]=qs['offset'](_0x991169[_0x231c('0x47')]['offset']);}_0x1c690e[_0x231c('0x6c')]=qs[_0x231c('0x50')](_0x991169[_0x231c('0x47')][_0x231c('0x50')]);_0x1c690e['where']=qs[_0x231c('0x49')](_[_0x231c('0x52')](_0x991169[_0x231c('0x47')],_0x5d94fe[_0x231c('0x49')]));_0x1c690e['where'][_0x231c('0x69')]=_0x5e8657['id'];if(_0x991169[_0x231c('0x47')][_0x231c('0x53')]){_0x1c690e[_0x231c('0x51')]=_[_0x231c('0x54')](_0x1c690e[_0x231c('0x51')],{'$or':_[_0x231c('0x42')](_0x1c690e[_0x231c('0x4c')],function(_0x7f7123){var _0x5a652d={};_0x5a652d[_0x7f7123]={'$like':'%'+_0x991169[_0x231c('0x47')]['filter']+'%'};return _0x5a652d;})});}_0x1c690e=_[_0x231c('0x54')]({},_0x1c690e,_0x991169[_0x231c('0x57')]);return db['CannedAnswer']['count']({'where':_0x1c690e['where']})['then'](function(_0x393ab8){_0x202041[_0x231c('0x34')]=_0x393ab8;if(_0x991169[_0x231c('0x47')][_0x231c('0x59')]){_0x1c690e[_0x231c('0x5d')]=[{'all':!![]}];}return db[_0x231c('0x70')]['findAll'](_0x1c690e);})['then'](function(_0x56ee9b){_0x202041['rows']=_0x56ee9b;return _0x202041;});}})[_0x231c('0x23')](respondWithFilteredResult(_0x1820c4,_0x1c690e))[_0x231c('0x2d')](handleError(_0x1820c4,null));};exports[_0x231c('0x72')]=function(_0x3bbd2e,_0x143838,_0x5bd71d){return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x3bbd2e['params']['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x143838,null))[_0x231c('0x23')](function(_0x24419f){if(_0x24419f){return _0x24419f[_0x231c('0x72')](_0x3bbd2e[_0x231c('0x47')][_0x231c('0x6e')]);}})[_0x231c('0x23')](respondWithStatusCode(_0x143838,null))['catch'](handleError(_0x143838,null));};exports[_0x231c('0x73')]=function(_0x503f9f,_0x189b5d,_0x42f4bc){var _0x101d10={'body':_0x503f9f[_0x231c('0x66')],'channel':_0x231c('0x74')};var _0x41b5be=[];var _0x272ed1=[];var _0x5dab41={};var _0xf390e1=![];return db['CmContact']['describe']()[_0x231c('0x23')](function(_0x3ff0f4){if(!_0x3ff0f4){throw new db[(_0x231c('0x75'))]['ValidationError'](_0x231c('0x76'));}_0x41b5be=_[_0x231c('0x77')](_[_0x231c('0x48')](_0x3ff0f4),[_0x231c('0x78'),_0x231c('0x79')]);_0x272ed1=_[_0x231c('0x77')](_[_0x231c('0x48')](_0x3ff0f4),[_0x231c('0x78'),'updatedAt',_0x231c('0x7a'),_0x231c('0x7b')]);if(_0x503f9f[_0x231c('0x66')]['id']){delete _0x503f9f[_0x231c('0x66')]['id'];}if(_[_0x231c('0x7c')](_0x503f9f[_0x231c('0x66')][_0x231c('0x7d')])){throw new db[(_0x231c('0x75'))][(_0x231c('0x7e'))](_0x231c('0x7f'));}if(_[_0x231c('0x7c')](_0x503f9f[_0x231c('0x66')][_0x231c('0x66')])||_0x503f9f[_0x231c('0x66')][_0x231c('0x66')]===''){throw new db[(_0x231c('0x75'))][(_0x231c('0x7e'))](_0x231c('0x80'));}if(_[_0x231c('0x7c')](_0x503f9f[_0x231c('0x66')][_0x231c('0x81')])){throw new db[(_0x231c('0x75'))][(_0x231c('0x7e'))](_0x231c('0x82')+_0x272ed1);}if(!_[_0x231c('0x83')](_0x272ed1,_0x503f9f['body'][_0x231c('0x81')])){throw new db[(_0x231c('0x75'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x272ed1);}_0x5dab41[_0x503f9f['body']['mapKey']]=_0x503f9f['body']['from'];})[_0x231c('0x23')](function(){return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x503f9f[_0x231c('0x5c')]['id']},'include':[{'model':db[_0x231c('0x84')],'as':_0x231c('0x85'),'include':[{'model':db[_0x231c('0x86')],'as':_0x231c('0x87'),'where':_0x5dab41,'limit':0x1,'order':[[_0x231c('0x79'),_0x231c('0x88')]]}]},{'model':db['OpenchannelApplication'],'as':_0x231c('0x89')}]});})[_0x231c('0x23')](handleEntityNotFound(_0x189b5d,null))['then'](function(_0xea25d0){if(_0xea25d0&&_0xea25d0[_0x231c('0x85')]){_0x101d10[_0x231c('0x8a')]=_0xea25d0;_0x101d10[_0x231c('0x8b')]=_0xea25d0[_0x231c('0x89')];_0x101d10['list']=_0xea25d0[_0x231c('0x85')];_0x101d10['applications']=_['orderBy'](_0x101d10[_0x231c('0x8b')],[_0x231c('0x8c')],[_0x231c('0x8d')]);if(_0x101d10[_0x231c('0x8a')]['Applications']){delete _0x101d10[_0x231c('0x8a')]['Applications'];}if(_0x101d10[_0x231c('0x8a')][_0x231c('0x85')]&&_0x101d10[_0x231c('0x8a')]['List'][_0x231c('0x87')]['length']){return _0x101d10[_0x231c('0x8a')][_0x231c('0x85')][_0x231c('0x87')][0x0];}var _0x42443e=_[_0x231c('0x1a')](_0x503f9f[_0x231c('0x66')],{'firstName':_0x503f9f[_0x231c('0x66')]['from'],'ListId':_0xea25d0[_0x231c('0x7b')]});_0x42443e[_0x503f9f[_0x231c('0x66')][_0x231c('0x81')]]=_0x503f9f[_0x231c('0x66')]['from'];return db[_0x231c('0x86')][_0x231c('0x5f')](_0x42443e,{'fields':_0x41b5be,'raw':!![]});}})[_0x231c('0x23')](handleEntityNotFound(_0x189b5d,null))['then'](function(_0x5bc195){_0x101d10[_0x231c('0x8e')]=_0x5bc195;if(_0x5bc195){var _0x4b2985={'ContactId':_0x5bc195['id'],'OpenchannelAccountId':_0x503f9f['params']['id'],'from':(_0x5bc195[_0x231c('0x8f')]||'')+'\x20'+(_0x5bc195[_0x231c('0x90')]||'')};var _0x5d47e8={'OpenchannelAccountId':_0x503f9f[_0x231c('0x5c')]['id'],'closed':![]};if(_0x503f9f['body'][_0x231c('0x91')]){_0x5d47e8[_0x231c('0x91')]=_0x503f9f[_0x231c('0x66')][_0x231c('0x91')];return db['OpenchannelInteraction']['find']({'where':_0x5d47e8})[_0x231c('0x23')](function(_0x93cb53){if(_0x93cb53){return[_0x93cb53,![]];}_0x4b2985[_0x231c('0x91')]=_0x503f9f['body'][_0x231c('0x91')];_0x4b2985[_0x231c('0x92')]=_0x503f9f[_0x231c('0x66')][_0x231c('0x92')];return db[_0x231c('0x93')][_0x231c('0x5f')](_0x4b2985)['then'](function(_0x38fbc5){return[_0x38fbc5,!![]];});});}else{_0x5d47e8[_0x231c('0x91')]=null;}_0x5d47e8[_0x231c('0x94')]=_0x5bc195['id'];return db['OpenchannelInteraction'][_0x231c('0x5e')]({'where':_0x5d47e8})[_0x231c('0x23')](function(_0x4b3877){if(_0x4b3877){return[_0x4b3877,![]];}return db['OpenchannelInteraction']['create'](_0x4b2985)[_0x231c('0x23')](function(_0xa20032){return[_0xa20032,!![]];});});}})['spread'](function(_0x1c6390,_0x3ee50b){if(_0x1c6390){_0xf390e1=_0x3ee50b;if(!_0x3ee50b){var _0x5928d4={'from':(_0x101d10[_0x231c('0x8e')][_0x231c('0x8f')]||'')+'\x20'+(_0x101d10[_0x231c('0x8e')][_0x231c('0x90')]||'')};if(_0x503f9f['body']['threadId']&&_0x503f9f['body'][_0x231c('0x95')]&&_0x503f9f['body'][_0x231c('0x91')]!=_0x503f9f[_0x231c('0x66')][_0x231c('0x95')]){_0x5928d4[_0x231c('0x91')]=_0x503f9f['body'][_0x231c('0x95')];}return _0x1c6390[_0x231c('0x39')](_0x5928d4);}else{return _0x1c6390;}}})[_0x231c('0x23')](function(_0x503bef){_0x101d10[_0x231c('0x96')]=_0x503bef[_0x231c('0x61')]({'plain':!![]});_0x101d10[_0x231c('0x96')]['created']=_0xf390e1;if(_0x101d10['interaction'][_0x231c('0x97')]){if(_0x101d10[_0x231c('0x8a')][_0x231c('0x98')]){_0x101d10[_0x231c('0x8b')]['push']({'id':0x0,'priority':_0x101d10[_0x231c('0x8b')][_0x231c('0x4d')]+0x1,'app':_0x231c('0x99'),'appdata':_0x231c('0x9a'),'interval':_0x231c('0x9b')});}}return db[_0x231c('0x9c')][_0x231c('0x5f')]({'body':_0x503f9f[_0x231c('0x66')]['body'],'OpenchannelAccountId':_0x503f9f[_0x231c('0x5c')]['id'],'OpenchannelInteractionId':_0x503bef['id'],'direction':'in','ContactId':_0x101d10[_0x231c('0x8e')]['id'],'AttachmentId':_0x503f9f[_0x231c('0x66')][_0x231c('0x9d')]});})[_0x231c('0x23')](function(_0x536a62){_0x101d10['message']=_0x536a62;if(!_0x101d10['interaction'][_0x231c('0x9e')])return;return db[_0x231c('0x9f')]['find']({'attributes':['id','name'],'where':{'id':_0x101d10[_0x231c('0x96')]['UserId']}});})[_0x231c('0x23')](function(_0x54da50){if(_0x54da50){_0x101d10[_0x231c('0x8b')][_0x231c('0xa0')]({'id':0x0,'priority':0x0,'app':_0x231c('0xa1'),'appdata':_0x54da50[_0x231c('0x3d')]+','+(_0x101d10['account'][_0x231c('0xa2')]||0xa),'interval':'*,*,*,*'});}if(!_0x101d10[_0x231c('0x96')][_0x231c('0xa3')])return;return db['OpenchannelQueue'][_0x231c('0x5e')]({'attributes':['id',_0x231c('0x3d')],'where':{'id':_0x101d10['interaction']['queueId']}});})[_0x231c('0x23')](function(_0x1a7f71){if(_0x1a7f71){_0x101d10[_0x231c('0x8b')][_0x231c('0xa0')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1a7f71['name']+','+(_0x101d10[_0x231c('0x8a')][_0x231c('0xa4')]||0x12c),'interval':_0x231c('0x9b')});}return respondWithRpcPromise(_0x231c('0xa5'),_0x231c('0xa6'),_0x101d10);})[_0x231c('0x23')](function(_0x4af2f8){respondWithRpcPromise(_0x231c('0xa7'),'EventManager',{'event':_0x231c('0x73'),'message':_0x4af2f8},client9002);return _0x4af2f8;})['then'](respondWithResult(_0x189b5d,null))['catch'](handleError(_0x189b5d,null));};exports[_0x231c('0xa8')]=function(_0x85062,_0x44cb19){var _0x518f07=_0x85062[_0x231c('0x5c')]['id'];var _0x154d05=_0x85062[_0x231c('0x66')];var _0x1dd41d=0xc8;var _0x528dbb=null;return db[_0x231c('0xa9')][_0x231c('0xaa')]({'isolationLevel':db[_0x231c('0xa9')][_0x231c('0xab')]['ISOLATION_LEVELS'][_0x231c('0xac')]},function(_0x3295f0){return db[_0x231c('0x58')][_0x231c('0x71')]({'where':{'id':_0x518f07},'transaction':_0x3295f0})[_0x231c('0x23')](function(_0x1e88f5){if(_0x1e88f5){return db[_0x231c('0xad')][_0x231c('0x3b')]({'where':{'OpenchannelAccountId':_0x518f07},'transaction':_0x3295f0})[_0x231c('0x23')](function(){var _0x149ffc=_[_0x231c('0x42')](_0x154d05,function(_0x189e4f){_0x189e4f[_0x231c('0x69')]=_0x518f07;return _0x189e4f;});return db[_0x231c('0xad')][_0x231c('0xae')](_0x149ffc,{'transaction':_0x3295f0});});}else{_0x1dd41d=0x194;_0x528dbb=[];}});})['then'](function(){if(_0x1dd41d!==0x194){return db[_0x231c('0xad')][_0x231c('0xaf')]({'where':{'OpenchannelAccountId':_0x518f07},'order':_0x231c('0x8c')})['then'](function(_0x40afc4){_0x528dbb=_0x40afc4;});}})[_0x231c('0x2d')](function(_0x5457a1){_0x1dd41d=0x1f4;logger[_0x231c('0x2a')](_0x5457a1[_0x231c('0x3c')]);if(_0x5457a1[_0x231c('0x3d')]){delete _0x5457a1['name'];}_0x528dbb=_0x5457a1;})[_0x231c('0xb0')](function(){if(_0x528dbb===null){_0x44cb19[_0x231c('0x2e')](_0x1dd41d);}else{if(_0x1dd41d===0x1f4){_0x44cb19[_0x231c('0x2f')](_0x1dd41d)[_0x231c('0x3e')](_0x528dbb);}else{_0x44cb19[_0x231c('0x2f')](_0x1dd41d)['json'](_0x528dbb);}}});};exports[_0x231c('0xb1')]=function(_0x3d8942,_0x83ff52,_0x1c5b44){var _0x352d43={};var _0x4b0df5={};var _0x24a511;var _0x1a88ce;return db['OpenchannelAccount'][_0x231c('0x71')]({'where':{'id':_0x3d8942[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x83ff52,null))[_0x231c('0x23')](function(_0x3affcd){if(_0x3affcd){_0x24a511=_0x3affcd;_0x4b0df5['model']=_[_0x231c('0x48')](db[_0x231c('0xad')][_0x231c('0x43')]);_0x4b0df5['query']=_['keys'](_0x3d8942[_0x231c('0x47')]);_0x4b0df5[_0x231c('0x49')]=_[_0x231c('0x4a')](_0x4b0df5['model'],_0x4b0df5['query']);_0x352d43[_0x231c('0x4c')]=_[_0x231c('0x4a')](_0x4b0df5['model'],qs[_0x231c('0x4b')](_0x3d8942['query']['fields']));_0x352d43[_0x231c('0x4c')]=_0x352d43[_0x231c('0x4c')][_0x231c('0x4d')]?_0x352d43[_0x231c('0x4c')]:_0x4b0df5[_0x231c('0x46')];_0x352d43[_0x231c('0x6c')]=qs[_0x231c('0x50')](_0x3d8942[_0x231c('0x47')][_0x231c('0x50')]);_0x352d43[_0x231c('0x51')]=qs[_0x231c('0x49')](_[_0x231c('0x52')](_0x3d8942[_0x231c('0x47')],_0x4b0df5[_0x231c('0x49')]));if(_0x3d8942['query']['filter']){_0x352d43[_0x231c('0x51')]=_['merge'](_0x352d43[_0x231c('0x51')],{'$or':_[_0x231c('0x42')](_0x352d43[_0x231c('0x4c')],function(_0x18f996){var _0x46f08d={};_0x46f08d[_0x18f996]={'$like':'%'+_0x3d8942[_0x231c('0x47')][_0x231c('0x53')]+'%'};return _0x46f08d;})});}_0x352d43=_[_0x231c('0x54')]({},_0x352d43,_0x3d8942[_0x231c('0x57')]);return _0x24a511['getApplications'](_0x352d43);}})[_0x231c('0x23')](function(_0x57c71){if(_0x57c71){_0x1a88ce=_0x57c71['length'];if(!_0x3d8942[_0x231c('0x47')][_0x231c('0x4e')](_0x231c('0x4f'))){_0x352d43[_0x231c('0x32')]=qs[_0x231c('0x32')](_0x3d8942[_0x231c('0x47')]['limit']);_0x352d43[_0x231c('0x31')]=qs[_0x231c('0x31')](_0x3d8942['query'][_0x231c('0x31')]);}return _0x24a511[_0x231c('0xb1')](_0x352d43);}})[_0x231c('0x23')](function(_0x56d915){if(_0x56d915){return _0x56d915?{'count':_0x1a88ce,'rows':_0x56d915}:null;}})['then'](respondWithResult(_0x83ff52,null))[_0x231c('0x2d')](handleError(_0x83ff52,null));};exports['getInteractions']=function(_0x1ba028,_0x26e12b,_0x515c5f){var _0x379a71={'raw':![],'where':{}};var _0x357aff={};var _0x2c8966={'count':0x0,'rows':[]};return db[_0x231c('0x58')][_0x231c('0x71')]({'where':{'id':_0x1ba028[_0x231c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x26e12b,null))[_0x231c('0x23')](function(_0x59d699){if(_0x59d699){_0x357aff['model']=_[_0x231c('0x48')](db[_0x231c('0x93')][_0x231c('0x43')]);_0x357aff[_0x231c('0x47')]=_['keys'](_0x1ba028[_0x231c('0x47')]);_0x357aff['filters']=_[_0x231c('0x4a')](_0x357aff[_0x231c('0x46')],_0x357aff[_0x231c('0x47')]);_0x379a71['attributes']=_[_0x231c('0x4a')](_0x357aff[_0x231c('0x46')],qs['fields'](_0x1ba028['query']['fields']));_0x379a71[_0x231c('0x4c')]=_0x379a71[_0x231c('0x4c')][_0x231c('0x4d')]?_0x379a71[_0x231c('0x4c')]:_0x357aff[_0x231c('0x46')];if(!_0x1ba028[_0x231c('0x47')]['hasOwnProperty']('nolimit')){_0x379a71[_0x231c('0x32')]=qs[_0x231c('0x32')](_0x1ba028[_0x231c('0x47')][_0x231c('0x32')]);_0x379a71[_0x231c('0x31')]=qs[_0x231c('0x31')](_0x1ba028[_0x231c('0x47')]['offset']);}_0x379a71['order']=qs[_0x231c('0x50')](_0x1ba028[_0x231c('0x47')][_0x231c('0x50')]);_0x379a71['where']=qs[_0x231c('0x49')](_['pick'](_0x1ba028[_0x231c('0x47')],_0x357aff[_0x231c('0x49')]));_0x379a71['where'][_0x231c('0x69')]=_0x59d699['id'];if(_0x1ba028['query'][_0x231c('0x53')]){_0x379a71[_0x231c('0x51')]=_[_0x231c('0x54')](_0x379a71[_0x231c('0x51')],{'$or':_[_0x231c('0x42')](_0x379a71[_0x231c('0x4c')],function(_0x43a69c){var _0x2b77cb={};_0x2b77cb[_0x43a69c]={'$like':'%'+_0x1ba028[_0x231c('0x47')]['filter']+'%'};return _0x2b77cb;})});}_0x379a71=_[_0x231c('0x54')]({},_0x379a71,_0x1ba028[_0x231c('0x57')]);return db['OpenchannelInteraction'][_0x231c('0x34')]({'where':_0x379a71[_0x231c('0x51')]})[_0x231c('0x23')](function(_0x44d0e3){_0x2c8966[_0x231c('0x34')]=_0x44d0e3;if(_0x1ba028[_0x231c('0x47')][_0x231c('0x59')]){_0x379a71[_0x231c('0x5d')]=[{'model':db[_0x231c('0x86')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x231c('0xb2'),'attributes':[_0x231c('0x3d'),_0x231c('0xb3'),_0x231c('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x231c('0xb5'),'attributes':['id',_0x231c('0x3d'),_0x231c('0xb6')],'where':_0x1ba028[_0x231c('0x47')]['tag']?{'id':_0x1ba028['query'][_0x231c('0xb7')]}:undefined,'required':_0x1ba028[_0x231c('0x47')][_0x231c('0xb7')]?!![]:![]}];}return db[_0x231c('0x93')][_0x231c('0x5a')](_0x379a71);})[_0x231c('0x23')](function(_0x3897fc){_0x2c8966[_0x231c('0xb8')]=_0x3897fc;return _0x2c8966;});}})[_0x231c('0x23')](respondWithFilteredResult(_0x26e12b,_0x379a71))[_0x231c('0x2d')](handleError(_0x26e12b,null));};exports[_0x231c('0xb9')]=function(_0x35ed08,_0x2db857,_0x1e0d5e){return db[_0x231c('0x58')][_0x231c('0x5e')]({'where':{'id':_0x35ed08[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x2db857,null))[_0x231c('0x23')](function(_0x4d1954){if(_0x4d1954){return _0x4d1954[_0x231c('0xb9')](_0x35ed08[_0x231c('0x66')]['ids'],_[_0x231c('0xba')](_0x35ed08['body'],[_0x231c('0x6e'),'id'])||{})[_0x231c('0xbb')](function(_0x46f0b8){for(var _0x26a55f=0x0;_0x26a55f<_0x35ed08['body'][_0x231c('0x6e')][_0x231c('0x4d')];_0x26a55f+=0x1){socket[_0x231c('0xbc')](_0x231c('0xbd'),{'UserId':Number(_0x35ed08[_0x231c('0x66')][_0x231c('0x6e')][_0x26a55f]),'OpenchannelAccountId':Number(_0x35ed08[_0x231c('0x5c')]['id'])});}return _0x46f0b8;});}})[_0x231c('0x23')](respondWithResult(_0x2db857,null))[_0x231c('0x2d')](handleError(_0x2db857,null));};exports[_0x231c('0xbe')]=function(_0xce1fe4,_0x118c2e,_0x28154f){return db[_0x231c('0x58')]['find']({'where':{'id':_0xce1fe4[_0x231c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x118c2e,null))[_0x231c('0x23')](function(_0xe167d0){if(_0xe167d0){return _0xe167d0[_0x231c('0xbe')](_0xce1fe4[_0x231c('0x47')][_0x231c('0x6e')])[_0x231c('0x23')](function(){if(_['isArray'](_0xce1fe4[_0x231c('0x47')]['ids'])){for(var _0x84d1d3=0x0;_0x84d1d3<_0xce1fe4['query'][_0x231c('0x6e')][_0x231c('0x4d')];_0x84d1d3+=0x1){socket['emit'](_0x231c('0xbf'),{'UserId':Number(_0xce1fe4['query']['ids'][_0x84d1d3]),'OpenchannelAccountId':Number(_0xce1fe4[_0x231c('0x5c')]['id'])});}}else{socket[_0x231c('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0xce1fe4[_0x231c('0x47')][_0x231c('0x6e')]),'OpenchannelAccountId':Number(_0xce1fe4[_0x231c('0x5c')]['id'])});}});}})[_0x231c('0x23')](respondWithStatusCode(_0x118c2e,null))[_0x231c('0x2d')](handleError(_0x118c2e,null));};exports[_0x231c('0xc0')]=function(_0x1d5e25,_0x574359,_0x414eb7){var _0x1a5719={};var _0x1463bd={};var _0x5f4225;var _0x580155;return db[_0x231c('0x58')][_0x231c('0x71')]({'where':{'id':_0x1d5e25[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x574359,null))[_0x231c('0x23')](function(_0x530ff8){if(_0x530ff8){_0x5f4225=_0x530ff8;_0x1463bd[_0x231c('0x46')]=_[_0x231c('0x48')](db[_0x231c('0x9f')]['rawAttributes']);_0x1463bd[_0x231c('0x47')]=_[_0x231c('0x48')](_0x1d5e25[_0x231c('0x47')]);_0x1463bd[_0x231c('0x49')]=_['intersection'](_0x1463bd[_0x231c('0x46')],_0x1463bd['query']);_0x1a5719[_0x231c('0x4c')]=_[_0x231c('0x4a')](_0x1463bd[_0x231c('0x46')],qs['fields'](_0x1d5e25['query'][_0x231c('0x4b')]));_0x1a5719[_0x231c('0x4c')]=_0x1a5719[_0x231c('0x4c')]['length']?_0x1a5719[_0x231c('0x4c')]:_0x1463bd[_0x231c('0x46')];_0x1a5719[_0x231c('0x6c')]=qs[_0x231c('0x50')](_0x1d5e25[_0x231c('0x47')][_0x231c('0x50')]);_0x1a5719['where']=qs[_0x231c('0x49')](_['pick'](_0x1d5e25['query'],_0x1463bd['filters']));if(_0x1d5e25[_0x231c('0x47')]['filter']){_0x1a5719[_0x231c('0x51')]=_['merge'](_0x1a5719[_0x231c('0x51')],{'$or':_[_0x231c('0x42')](_0x1a5719[_0x231c('0x4c')],function(_0x1f0a7f){var _0x32b463={};_0x32b463[_0x1f0a7f]={'$like':'%'+_0x1d5e25['query']['filter']+'%'};return _0x32b463;})});}_0x1a5719=_[_0x231c('0x54')]({},_0x1a5719,_0x1d5e25[_0x231c('0x57')]);return _0x5f4225[_0x231c('0xc0')](_0x1a5719);}})[_0x231c('0x23')](function(_0x5a7639){if(_0x5a7639){_0x580155=_0x5a7639[_0x231c('0x4d')];if(!_0x1d5e25[_0x231c('0x47')]['hasOwnProperty'](_0x231c('0x4f'))){_0x1a5719[_0x231c('0x32')]=qs[_0x231c('0x32')](_0x1d5e25[_0x231c('0x47')]['limit']);_0x1a5719[_0x231c('0x31')]=qs[_0x231c('0x31')](_0x1d5e25[_0x231c('0x47')][_0x231c('0x31')]);}return _0x5f4225['getAgents'](_0x1a5719);}})['then'](function(_0x1237c3){if(_0x1237c3){return _0x1237c3?{'count':_0x580155,'rows':_0x1237c3}:null;}})[_0x231c('0x23')](respondWithResult(_0x574359,null))[_0x231c('0x2d')](handleError(_0x574359,null));};exports[_0x231c('0x3e')]=function(_0x1f6fce,_0x404b71,_0x1feb5){var _0x2299d9,_0x102a8e,_0x5591bc;if(_[_0x231c('0x7c')](_0x1f6fce[_0x231c('0x66')][_0x231c('0x66')])||_0x1f6fce[_0x231c('0x66')][_0x231c('0x66')]===''){throw new db[(_0x231c('0x75'))][(_0x231c('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x231c('0x7c')](_0x1f6fce[_0x231c('0x66')]['to'])){}_0x2299d9=_0x1f6fce[_0x231c('0x66')]['to'];return db[_0x231c('0x58')]['findOne']({'where':{'id':_0x1f6fce[_0x231c('0x5c')]['id']}})[_0x231c('0x23')](handleEntityNotFound(_0x404b71,null))[_0x231c('0x23')](function(_0x3a7b08){if(_0x3a7b08){return db['OpenchannelAccount'][_0x231c('0x5e')]({'where':{'id':_0x3a7b08['id']},'include':[{'model':db[_0x231c('0x84')],'as':_0x231c('0x85'),'include':[{'model':db[_0x231c('0x86')],'as':_0x231c('0x87'),'where':{[_0x3a7b08[_0x231c('0x81')]]:_0x2299d9},'limit':0x1,'order':[[_0x231c('0x79'),_0x231c('0x88')]]}]}]})[_0x231c('0x23')](handleEntityNotFound(_0x404b71,null))['then'](function(_0x1ebc90){if(_0x1ebc90&&_0x1ebc90[_0x231c('0x85')]){_0x102a8e=_0x1ebc90[_0x231c('0x61')]({'plain':!![]});if(_0x102a8e[_0x231c('0x85')]&&_0x102a8e[_0x231c('0x85')]['Contacts'][_0x231c('0x4d')]){return _0x102a8e[_0x231c('0x85')]['Contacts'][0x0];}return db['CmContact'][_0x231c('0x5f')](_[_0x231c('0x1a')](_0x1f6fce['body'],{'firstName':_0x2299d9,[_0x1ebc90[_0x231c('0x81')]]:_0x2299d9,'phone':_0x2299d9,'ListId':_0x102a8e[_0x231c('0x7b')]}));}})['then'](handleEntityNotFound(_0x404b71,null))[_0x231c('0x23')](function(_0x25a59b){if(_0x25a59b){_0x5591bc=_0x25a59b;return db['OpenchannelInteraction'][_0x231c('0x5e')]({'where':{'ContactId':_0x5591bc['id'],'closed':![],'OpenchannelAccountId':_0x102a8e['id']}})[_0x231c('0x23')](function(_0x5a8bf3){if(_0x5a8bf3){return[_0x5a8bf3,![]];}return db['OpenchannelInteraction'][_0x231c('0x5f')]({'UserId':_0x1f6fce['user']['id'],'ContactId':_0x5591bc['id'],'OpenchannelAccountId':_0x102a8e['id'],'lastMsgDirection':_0x231c('0xc1'),'firstMsgDirection':_0x231c('0xc1'),'Messages':[_['merge'](_0x1f6fce[_0x231c('0x66')],{'read':![],'body':_0x1f6fce['body'][_0x231c('0x66')],'OpenchannelAccountId':_0x102a8e['id'],'UserId':_0x1f6fce['user']['id'],'ContactId':_0x5591bc['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x231c('0xc2')}]})[_0x231c('0x23')](function(_0x249ed4){return[_0x249ed4,!![]];});});}})[_0x231c('0xbb')](function(_0x3b4e4e,_0x4f0d57){if(_0x4f0d57){return _0x3b4e4e;}return db['OpenchannelMessage'][_0x231c('0x5f')](_[_0x231c('0x54')](_0x1f6fce[_0x231c('0x66')],{'read':![],'body':_0x1f6fce[_0x231c('0x66')][_0x231c('0x66')],'OpenchannelAccountId':_0x102a8e['id'],'OpenchannelInteractionId':_0x3b4e4e['id'],'UserId':_0x1f6fce[_0x231c('0x60')]['id'],'ContactId':_0x5591bc['id']}))[_0x231c('0x23')](function(_0x200d3f){_0x3b4e4e[_0x231c('0xc3')][_0x231c('0xc2')]=[];_0x3b4e4e['dataValues']['Messages']['push'](_0x200d3f[_0x231c('0xc3')]);return _0x3b4e4e;});});}})['then'](respondWithResult(_0x404b71,null))[_0x231c('0x2d')](handleError(_0x404b71,null));}; \ No newline at end of file +var _0x2755=['unshift','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','isNil','DESC','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','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','defaults','redis','localhost','./openchannelAccount.socket','register','http','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','apply','reject','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','params','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','Disposition','findOne','OpenchannelAccountId','rows','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','OpenchannelApplication','Applications','applications','List','orderBy','account','Contacts','contact','firstName','OpenchannelInteraction','threadId','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','waitForTheAssignedAgent','queueId'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x2755,0x19a));var _0x5275=function(_0x577589,_0x10f13e){_0x577589=_0x577589-0x0;var _0x359ef8=_0x2755[_0x577589];return _0x359ef8;};'use strict';var emlformat=require(_0x5275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5275('0x1'));var jsonpatch=require(_0x5275('0x2'));var rp=require(_0x5275('0x3'));var moment=require('moment');var BPromise=require(_0x5275('0x4'));var Mustache=require(_0x5275('0x5'));var util=require('util');var path=require(_0x5275('0x6'));var sox=require(_0x5275('0x7'));var csv=require(_0x5275('0x8'));var ejs=require(_0x5275('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5275('0xa'));var jsforce=require(_0x5275('0xb'));var deskjs=require(_0x5275('0xc'));var toCsv=require(_0x5275('0x8'));var querystring=require(_0x5275('0xd'));var Papa=require('papaparse');var Redis=require(_0x5275('0xe'));var authService=require(_0x5275('0xf'));var qs=require(_0x5275('0x10'));var as=require(_0x5275('0x11'));var hardwareService=require(_0x5275('0x12'));var logger=require(_0x5275('0x13'))(_0x5275('0x14'));var utils=require(_0x5275('0x15'));var config=require(_0x5275('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5275('0x17'))['db'];config['redis']=_[_0x5275('0x18')](config[_0x5275('0x19')],{'host':_0x5275('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5275('0x19')]));require(_0x5275('0x1b'))[_0x5275('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5275('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x5275('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x49d547,_0x22e876,_0x628112,_0xc4d60e){return new BPromise(function(_0x53f3a6,_0x877f7c){var _0x4c614e=_0xc4d60e||client;return _0x4c614e['request'](_0x49d547,_0x628112)['then'](function(_0x35ffa8){logger[_0x5275('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x22e876,'request\x20sent');logger[_0x5275('0x1f')](_0x5275('0x20'),_0x22e876,_0x5275('0x21'),JSON[_0x5275('0x22')](_0x35ffa8));if(_0x35ffa8['error']){if(_0x35ffa8[_0x5275('0x23')][_0x5275('0x24')]===0x1f4){logger[_0x5275('0x23')](_0x5275('0x25'),_0x22e876,_0x35ffa8[_0x5275('0x23')][_0x5275('0x26')]);return _0x877f7c(_0x35ffa8[_0x5275('0x23')]['message']);}logger[_0x5275('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x22e876,_0x35ffa8[_0x5275('0x23')][_0x5275('0x26')]);return _0x53f3a6(_0x35ffa8[_0x5275('0x23')][_0x5275('0x26')]);}else{logger[_0x5275('0x1e')](_0x5275('0x25'),_0x22e876,_0x5275('0x21'));_0x53f3a6(_0x35ffa8[_0x5275('0x27')][_0x5275('0x26')]);}})[_0x5275('0x28')](function(_0x164f82){logger['error'](_0x5275('0x25'),_0x22e876,_0x164f82);_0x877f7c(_0x164f82);});});}function respondWithStatusCode(_0x4a2ee7,_0x1700b7){_0x1700b7=_0x1700b7||0xcc;return function(_0x3193c1){if(_0x3193c1){return _0x4a2ee7['sendStatus'](_0x1700b7);}return _0x4a2ee7[_0x5275('0x29')](_0x1700b7)[_0x5275('0x2a')]();};}function respondWithResult(_0x5e9268,_0x45d773){_0x45d773=_0x45d773||0xc8;return function(_0x72b894){if(_0x72b894){return _0x5e9268[_0x5275('0x29')](_0x45d773)[_0x5275('0x2b')](_0x72b894);}};}function respondWithFilteredResult(_0x18a0cf,_0x1bd1fc){return function(_0x4ccfd8){if(_0x4ccfd8){var _0x602680=typeof _0x1bd1fc['offset']===_0x5275('0x2c')&&typeof _0x1bd1fc[_0x5275('0x2d')]==='undefined';var _0x1f5276=_0x4ccfd8[_0x5275('0x2e')];var _0x43fc97=_0x602680?0x0:_0x1bd1fc[_0x5275('0x2f')];var _0x59ceaf=_0x602680?_0x4ccfd8[_0x5275('0x2e')]:_0x1bd1fc['offset']+_0x1bd1fc[_0x5275('0x2d')];var _0x47cefb;if(_0x59ceaf>=_0x1f5276){_0x59ceaf=_0x1f5276;_0x47cefb=0xc8;}else{_0x47cefb=0xce;}_0x18a0cf[_0x5275('0x29')](_0x47cefb);return _0x18a0cf['set']('Content-Range',_0x43fc97+'-'+_0x59ceaf+'/'+_0x1f5276)[_0x5275('0x2b')](_0x4ccfd8);}return null;};}function patchUpdates(_0x4a0043){return function(_0x236a33){try{jsonpatch[_0x5275('0x30')](_0x236a33,_0x4a0043,!![]);}catch(_0x2f8862){return BPromise[_0x5275('0x31')](_0x2f8862);}return _0x236a33[_0x5275('0x32')]();};}function saveUpdates(_0x349e4c,_0x35398f){return function(_0x152974){if(_0x152974){return _0x152974['update'](_0x349e4c)[_0x5275('0x33')](function(_0x43a6a7){return _0x43a6a7;});}return null;};}function removeEntity(_0x4740ad,_0x252eb3){return function(_0x392126){if(_0x392126){return _0x392126[_0x5275('0x34')]()[_0x5275('0x33')](function(){var _0x35a851=_0x392126[_0x5275('0x35')]({'plain':!![]});var _0x2be24a=_0x5275('0x36');return db[_0x5275('0x37')]['destroy']({'where':{'type':_0x2be24a,'resourceId':_0x35a851['id']}})['then'](function(){return _0x392126;});})[_0x5275('0x33')](function(){_0x4740ad[_0x5275('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3657e4,_0x10faca){return function(_0x495ba9){if(!_0x495ba9){_0x3657e4[_0x5275('0x38')](0x194);}return _0x495ba9;};}function handleError(_0x107f7e,_0x2f6768){_0x2f6768=_0x2f6768||0x1f4;return function(_0x3d5822){logger[_0x5275('0x23')](_0x3d5822[_0x5275('0x39')]);if(_0x3d5822[_0x5275('0x3a')]){delete _0x3d5822[_0x5275('0x3a')];}_0x107f7e[_0x5275('0x29')](_0x2f6768)[_0x5275('0x3b')](_0x3d5822);};}exports[_0x5275('0x3c')]=function(_0xdf90b5,_0x2f36c7){var _0x3e8581={'include':[{'model':db['Pause'],'as':_0x5275('0x3d')}]},_0x1e5f06={},_0x5a0b05={'count':0x0,'rows':[]};var _0x348879=_[_0x5275('0x3e')](db[_0x5275('0x3f')][_0x5275('0x40')],function(_0x224e91){return{'name':_0x224e91['fieldName'],'type':_0x224e91[_0x5275('0x41')][_0x5275('0x42')]};});_0x1e5f06['model']=_['map'](_0x348879,_0x5275('0x3a'));_0x1e5f06[_0x5275('0x43')]=_[_0x5275('0x44')](_0xdf90b5[_0x5275('0x43')]);_0x1e5f06[_0x5275('0x45')]=_[_0x5275('0x46')](_0x1e5f06[_0x5275('0x47')],_0x1e5f06['query']);_0x3e8581['attributes']=_[_0x5275('0x46')](_0x1e5f06[_0x5275('0x47')],qs[_0x5275('0x48')](_0xdf90b5[_0x5275('0x43')][_0x5275('0x48')]));_0x3e8581['attributes']=_0x3e8581[_0x5275('0x49')]['length']?_0x3e8581['attributes']:_0x1e5f06[_0x5275('0x47')];if(!_0xdf90b5[_0x5275('0x43')][_0x5275('0x4a')](_0x5275('0x4b'))){_0x3e8581[_0x5275('0x2d')]=qs[_0x5275('0x2d')](_0xdf90b5[_0x5275('0x43')][_0x5275('0x2d')]);_0x3e8581['offset']=qs[_0x5275('0x2f')](_0xdf90b5[_0x5275('0x43')][_0x5275('0x2f')]);}_0x3e8581[_0x5275('0x4c')]=qs[_0x5275('0x4d')](_0xdf90b5['query']['sort']);_0x3e8581[_0x5275('0x4e')]=qs[_0x5275('0x45')](_[_0x5275('0x4f')](_0xdf90b5['query'],_0x1e5f06['filters']),_0x348879);if(_0xdf90b5['query']['filter']){_0x3e8581[_0x5275('0x4e')]=_['merge'](_0x3e8581['where'],{'$or':_[_0x5275('0x3e')](_0x348879,function(_0x5ca27d){if(_0x5ca27d[_0x5275('0x41')]!==_0x5275('0x50')){var _0xf0cb9a={};_0xf0cb9a[_0x5ca27d[_0x5275('0x3a')]]={'$like':'%'+_0xdf90b5[_0x5275('0x43')][_0x5275('0x51')]+'%'};return _0xf0cb9a;}})});}_0x3e8581=_[_0x5275('0x52')]({},_0x3e8581,_0xdf90b5[_0x5275('0x53')]);var _0x48ae14={'where':_0x3e8581['where']};return db[_0x5275('0x3f')][_0x5275('0x2e')](_0x48ae14)['then'](function(_0x461200){_0x5a0b05['count']=_0x461200;if(_0xdf90b5['query'][_0x5275('0x54')]){_0x3e8581['include']=[{'all':!![]}];}return db[_0x5275('0x3f')][_0x5275('0x55')](_0x3e8581);})[_0x5275('0x33')](function(_0x370c12){_0x5a0b05['rows']=_0x370c12;return _0x5a0b05;})['then'](respondWithFilteredResult(_0x2f36c7,_0x3e8581))[_0x5275('0x28')](handleError(_0x2f36c7,null));};exports[_0x5275('0x56')]=function(_0x250aaa,_0x2672b4){var _0xa45f79={'raw':![],'where':{'id':_0x250aaa[_0x5275('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x31cbe8={};_0x31cbe8[_0x5275('0x47')]=_[_0x5275('0x44')](db[_0x5275('0x3f')][_0x5275('0x40')]);_0x31cbe8[_0x5275('0x43')]=_[_0x5275('0x44')](_0x250aaa[_0x5275('0x43')]);_0x31cbe8[_0x5275('0x45')]=_[_0x5275('0x46')](_0x31cbe8['model'],_0x31cbe8[_0x5275('0x43')]);_0xa45f79[_0x5275('0x49')]=_[_0x5275('0x46')](_0x31cbe8[_0x5275('0x47')],qs[_0x5275('0x48')](_0x250aaa[_0x5275('0x43')][_0x5275('0x48')]));_0xa45f79[_0x5275('0x49')]=_0xa45f79[_0x5275('0x49')][_0x5275('0x58')]?_0xa45f79[_0x5275('0x49')]:_0x31cbe8['model'];if(_0x250aaa[_0x5275('0x43')][_0x5275('0x54')]){_0xa45f79[_0x5275('0x59')]=[{'all':!![]}];}_0xa45f79=_[_0x5275('0x52')]({},_0xa45f79,_0x250aaa[_0x5275('0x53')]);return db[_0x5275('0x3f')][_0x5275('0x5a')](_0xa45f79)[_0x5275('0x33')](handleEntityNotFound(_0x2672b4,null))['then'](respondWithResult(_0x2672b4,null))[_0x5275('0x28')](handleError(_0x2672b4,null));};exports[_0x5275('0x5b')]=function(_0x2c5016,_0x182d03){return db[_0x5275('0x3f')][_0x5275('0x5b')](_0x2c5016['body'],{})['then'](function(_0x2d08ba){var _0x4385d0=_0x2c5016[_0x5275('0x5c')][_0x5275('0x35')]({'plain':!![]});if(!_0x4385d0)throw new Error(_0x5275('0x5d'));if(_0x4385d0['role']===_0x5275('0x5c')){var _0x132a3e=_0x2d08ba[_0x5275('0x35')]({'plain':!![]});var _0x4fc89f=_0x5275('0x36');return db[_0x5275('0x5e')][_0x5275('0x5a')]({'where':{'name':_0x4fc89f,'userProfileId':_0x4385d0[_0x5275('0x5f')]},'raw':!![]})[_0x5275('0x33')](function(_0xc3453){if(_0xc3453&&_0xc3453[_0x5275('0x60')]===0x0){return db[_0x5275('0x37')][_0x5275('0x5b')]({'name':_0x132a3e[_0x5275('0x3a')],'resourceId':_0x132a3e['id'],'type':_0xc3453[_0x5275('0x3a')],'sectionId':_0xc3453['id']},{})[_0x5275('0x33')](function(){return _0x2d08ba;});}else{return _0x2d08ba;}})[_0x5275('0x28')](function(_0x47a6a8){logger['error'](_0x5275('0x61'),_0x47a6a8);throw _0x47a6a8;});}return _0x2d08ba;})['then'](respondWithResult(_0x182d03,0xc9))[_0x5275('0x28')](handleError(_0x182d03,null));};exports[_0x5275('0x62')]=function(_0x430cf9,_0x30ba64){if(_0x430cf9[_0x5275('0x63')]['id']){delete _0x430cf9[_0x5275('0x63')]['id'];}return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x430cf9[_0x5275('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x5275('0x3d')}]})[_0x5275('0x33')](handleEntityNotFound(_0x30ba64,null))[_0x5275('0x33')](saveUpdates(_0x430cf9['body'],null))[_0x5275('0x33')](respondWithResult(_0x30ba64,null))[_0x5275('0x28')](handleError(_0x30ba64,null));};exports[_0x5275('0x34')]=function(_0x476851,_0x347fc1){return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x476851[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x347fc1,null))[_0x5275('0x33')](removeEntity(_0x347fc1,null))[_0x5275('0x28')](handleError(_0x347fc1,null));};exports[_0x5275('0x64')]=function(_0x37412a,_0x9e27cc){return db[_0x5275('0x3f')][_0x5275('0x64')]()['then'](respondWithResult(_0x9e27cc,null))[_0x5275('0x28')](handleError(_0x9e27cc,null));};exports[_0x5275('0x65')]=function(_0x674770,_0x46c5ec,_0x52506e){if(_0x674770['body']['id']){delete _0x674770[_0x5275('0x63')]['id'];}return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x674770[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x46c5ec,null))['then'](function(_0x58785a){if(_0x58785a){_0x674770[_0x5275('0x63')]['OpenchannelAccountId']=_0x58785a['id'];return db[_0x5275('0x66')][_0x5275('0x5b')](_0x674770['body']);}})[_0x5275('0x33')](respondWithResult(_0x46c5ec,null))[_0x5275('0x28')](handleError(_0x46c5ec,null));};exports['getDispositions']=function(_0x1055e2,_0x4dbb3e,_0xa4bdd){var _0x2e4f7c={'raw':![],'where':{}};var _0x166e98={};var _0x3da2b8={'count':0x0,'rows':[]};return db[_0x5275('0x3f')][_0x5275('0x67')]({'where':{'id':_0x1055e2[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x4dbb3e,null))[_0x5275('0x33')](function(_0x1ca469){if(_0x1ca469){_0x166e98['model']=_[_0x5275('0x44')](db['Disposition']['rawAttributes']);_0x166e98['query']=_[_0x5275('0x44')](_0x1055e2[_0x5275('0x43')]);_0x166e98['filters']=_['intersection'](_0x166e98[_0x5275('0x47')],_0x166e98['query']);_0x2e4f7c[_0x5275('0x49')]=_['intersection'](_0x166e98[_0x5275('0x47')],qs[_0x5275('0x48')](_0x1055e2[_0x5275('0x43')][_0x5275('0x48')]));_0x2e4f7c[_0x5275('0x49')]=_0x2e4f7c['attributes'][_0x5275('0x58')]?_0x2e4f7c[_0x5275('0x49')]:_0x166e98[_0x5275('0x47')];if(!_0x1055e2[_0x5275('0x43')][_0x5275('0x4a')](_0x5275('0x4b'))){_0x2e4f7c['limit']=qs['limit'](_0x1055e2[_0x5275('0x43')]['limit']);_0x2e4f7c[_0x5275('0x2f')]=qs[_0x5275('0x2f')](_0x1055e2[_0x5275('0x43')]['offset']);}_0x2e4f7c[_0x5275('0x4c')]=qs[_0x5275('0x4d')](_0x1055e2['query'][_0x5275('0x4d')]);_0x2e4f7c['where']=qs[_0x5275('0x45')](_[_0x5275('0x4f')](_0x1055e2[_0x5275('0x43')],_0x166e98[_0x5275('0x45')]));_0x2e4f7c[_0x5275('0x4e')][_0x5275('0x68')]=_0x1ca469['id'];if(_0x1055e2[_0x5275('0x43')][_0x5275('0x51')]){_0x2e4f7c[_0x5275('0x4e')]=_[_0x5275('0x52')](_0x2e4f7c[_0x5275('0x4e')],{'$or':_[_0x5275('0x3e')](_0x2e4f7c[_0x5275('0x49')],function(_0x31f303){var _0x4d6667={};_0x4d6667[_0x31f303]={'$like':'%'+_0x1055e2[_0x5275('0x43')][_0x5275('0x51')]+'%'};return _0x4d6667;})});}_0x2e4f7c=_['merge']({},_0x2e4f7c,_0x1055e2['options']);return db[_0x5275('0x66')]['count']({'where':_0x2e4f7c[_0x5275('0x4e')]})[_0x5275('0x33')](function(_0x1c0547){_0x3da2b8[_0x5275('0x2e')]=_0x1c0547;if(_0x1055e2[_0x5275('0x43')][_0x5275('0x54')]){_0x2e4f7c[_0x5275('0x59')]=[{'all':!![]}];}return db[_0x5275('0x66')][_0x5275('0x55')](_0x2e4f7c);})[_0x5275('0x33')](function(_0xa0aee3){_0x3da2b8[_0x5275('0x69')]=_0xa0aee3;return _0x3da2b8;});}})['then'](respondWithFilteredResult(_0x4dbb3e,_0x2e4f7c))[_0x5275('0x28')](handleError(_0x4dbb3e,null));};exports['removeDispositions']=function(_0x22f07f,_0x1729ab,_0x5d9748){return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x22f07f['params']['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x1729ab,null))['then'](function(_0x459402){if(_0x459402){return _0x459402[_0x5275('0x6a')](_0x22f07f[_0x5275('0x43')][_0x5275('0x6b')]);}})[_0x5275('0x33')](respondWithStatusCode(_0x1729ab,null))[_0x5275('0x28')](handleError(_0x1729ab,null));};exports['addAnswer']=function(_0x461246,_0x2c7f2a,_0x2d356c){if(_0x461246[_0x5275('0x63')]['id']){delete _0x461246[_0x5275('0x63')]['id'];}return db['OpenchannelAccount'][_0x5275('0x5a')]({'where':{'id':_0x461246[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x2c7f2a,null))['then'](function(_0x175e05){if(_0x175e05){_0x461246[_0x5275('0x63')]['OpenchannelAccountId']=_0x175e05['id'];return db[_0x5275('0x6c')][_0x5275('0x5b')](_0x461246['body']);}})[_0x5275('0x33')](respondWithResult(_0x2c7f2a,null))['catch'](handleError(_0x2c7f2a,null));};exports['getAnswers']=function(_0x2560af,_0x454ffa,_0x1ad987){var _0x4d4a9c={'raw':![],'where':{}};var _0x30c6b1={};var _0x25dc2b={'count':0x0,'rows':[]};return db[_0x5275('0x3f')][_0x5275('0x67')]({'where':{'id':_0x2560af[_0x5275('0x57')]['id']}})['then'](handleEntityNotFound(_0x454ffa,null))['then'](function(_0x5895f5){if(_0x5895f5){_0x30c6b1['model']=_[_0x5275('0x44')](db[_0x5275('0x6c')][_0x5275('0x40')]);_0x30c6b1[_0x5275('0x43')]=_[_0x5275('0x44')](_0x2560af[_0x5275('0x43')]);_0x30c6b1['filters']=_['intersection'](_0x30c6b1[_0x5275('0x47')],_0x30c6b1[_0x5275('0x43')]);_0x4d4a9c[_0x5275('0x49')]=_[_0x5275('0x46')](_0x30c6b1[_0x5275('0x47')],qs[_0x5275('0x48')](_0x2560af[_0x5275('0x43')][_0x5275('0x48')]));_0x4d4a9c[_0x5275('0x49')]=_0x4d4a9c['attributes']['length']?_0x4d4a9c[_0x5275('0x49')]:_0x30c6b1[_0x5275('0x47')];if(!_0x2560af[_0x5275('0x43')][_0x5275('0x4a')](_0x5275('0x4b'))){_0x4d4a9c[_0x5275('0x2d')]=qs[_0x5275('0x2d')](_0x2560af[_0x5275('0x43')]['limit']);_0x4d4a9c[_0x5275('0x2f')]=qs[_0x5275('0x2f')](_0x2560af['query'][_0x5275('0x2f')]);}_0x4d4a9c['order']=qs[_0x5275('0x4d')](_0x2560af[_0x5275('0x43')][_0x5275('0x4d')]);_0x4d4a9c['where']=qs[_0x5275('0x45')](_['pick'](_0x2560af[_0x5275('0x43')],_0x30c6b1[_0x5275('0x45')]));_0x4d4a9c['where'][_0x5275('0x68')]=_0x5895f5['id'];if(_0x2560af[_0x5275('0x43')]['filter']){_0x4d4a9c['where']=_[_0x5275('0x52')](_0x4d4a9c[_0x5275('0x4e')],{'$or':_[_0x5275('0x3e')](_0x4d4a9c['attributes'],function(_0x1c311b){var _0x216eb7={};_0x216eb7[_0x1c311b]={'$like':'%'+_0x2560af[_0x5275('0x43')][_0x5275('0x51')]+'%'};return _0x216eb7;})});}_0x4d4a9c=_[_0x5275('0x52')]({},_0x4d4a9c,_0x2560af[_0x5275('0x53')]);return db[_0x5275('0x6c')][_0x5275('0x2e')]({'where':_0x4d4a9c['where']})[_0x5275('0x33')](function(_0x4ce62f){_0x25dc2b[_0x5275('0x2e')]=_0x4ce62f;if(_0x2560af['query'][_0x5275('0x54')]){_0x4d4a9c['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4d4a9c);})[_0x5275('0x33')](function(_0x4e78ae){_0x25dc2b['rows']=_0x4e78ae;return _0x25dc2b;});}})['then'](respondWithFilteredResult(_0x454ffa,_0x4d4a9c))[_0x5275('0x28')](handleError(_0x454ffa,null));};exports[_0x5275('0x6d')]=function(_0x59f08e,_0x55f480,_0x1597d8){return db[_0x5275('0x3f')]['find']({'where':{'id':_0x59f08e[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x55f480,null))[_0x5275('0x33')](function(_0x5f9990){if(_0x5f9990){return _0x5f9990[_0x5275('0x6d')](_0x59f08e[_0x5275('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x55f480,null))[_0x5275('0x28')](handleError(_0x55f480,null));};exports[_0x5275('0x6e')]=function(_0x4a1c74,_0x38689a,_0x3a89c1){var _0x97b527={'body':_0x4a1c74[_0x5275('0x63')],'channel':_0x5275('0x6f')};var _0x5776a6=[];var _0x1ade43=[];var _0x2ff798={};var _0x22c5fe=![];return db[_0x5275('0x70')][_0x5275('0x64')]()['then'](function(_0x5fa465){if(!_0x5fa465){throw new db[(_0x5275('0x71'))][(_0x5275('0x72'))](_0x5275('0x73'));}_0x5776a6=_['difference'](_['keys'](_0x5fa465),[_0x5275('0x74'),_0x5275('0x75')]);_0x1ade43=_[_0x5275('0x76')](_[_0x5275('0x44')](_0x5fa465),[_0x5275('0x74'),'updatedAt',_0x5275('0x77'),_0x5275('0x78')]);if(_0x4a1c74[_0x5275('0x63')]['id']){delete _0x4a1c74[_0x5275('0x63')]['id'];}if(_['isNil'](_0x4a1c74['body']['from'])){throw new db['Sequelize']['ValidationError'](_0x5275('0x79'));}if(_['isNil'](_0x4a1c74[_0x5275('0x63')][_0x5275('0x63')])||_0x4a1c74[_0x5275('0x63')][_0x5275('0x63')]===''){throw new db[(_0x5275('0x71'))]['ValidationError'](_0x5275('0x7a'));}if(_['isNil'](_0x4a1c74[_0x5275('0x63')][_0x5275('0x7b')])){throw new db[(_0x5275('0x71'))][(_0x5275('0x72'))](_0x5275('0x7c')+_0x1ade43);}if(!_[_0x5275('0x7d')](_0x1ade43,_0x4a1c74[_0x5275('0x63')]['mapKey'])){throw new db[(_0x5275('0x71'))][(_0x5275('0x72'))](_0x5275('0x7e')+_0x1ade43);}_0x2ff798[_0x4a1c74[_0x5275('0x63')]['mapKey']]=_0x4a1c74[_0x5275('0x63')][_0x5275('0x7f')];})['then'](function(){return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x4a1c74['params']['id']},'include':[{'model':db[_0x5275('0x80')],'as':'List','include':[{'model':db[_0x5275('0x70')],'as':'Contacts','where':_0x2ff798,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x5275('0x81')],'as':_0x5275('0x82')}]});})[_0x5275('0x33')](handleEntityNotFound(_0x38689a,null))[_0x5275('0x33')](function(_0x3fa042){if(_0x3fa042&&_0x3fa042['List']){_0x97b527['account']=_0x3fa042;_0x97b527[_0x5275('0x83')]=_0x3fa042[_0x5275('0x82')];_0x97b527['list']=_0x3fa042[_0x5275('0x84')];_0x97b527[_0x5275('0x83')]=_[_0x5275('0x85')](_0x97b527[_0x5275('0x83')],['priority'],['asc']);if(_0x97b527[_0x5275('0x86')][_0x5275('0x82')]){delete _0x97b527['account']['Applications'];}if(_0x97b527[_0x5275('0x86')]['List']&&_0x97b527[_0x5275('0x86')][_0x5275('0x84')][_0x5275('0x87')][_0x5275('0x58')]){return _0x97b527[_0x5275('0x86')][_0x5275('0x84')][_0x5275('0x87')][0x0];}var _0x4d1135=_['defaults'](_0x4a1c74['body'],{'firstName':_0x4a1c74['body']['from'],'ListId':_0x3fa042[_0x5275('0x78')]});_0x4d1135[_0x4a1c74[_0x5275('0x63')]['mapKey']]=_0x4a1c74['body'][_0x5275('0x7f')];return db['CmContact'][_0x5275('0x5b')](_0x4d1135,{'fields':_0x5776a6,'raw':!![]});}})[_0x5275('0x33')](handleEntityNotFound(_0x38689a,null))[_0x5275('0x33')](function(_0x36680b){_0x97b527[_0x5275('0x88')]=_0x36680b;if(_0x36680b){var _0x24e09c={'ContactId':_0x36680b['id'],'OpenchannelAccountId':_0x4a1c74['params']['id'],'from':(_0x36680b[_0x5275('0x89')]||'')+'\x20'+(_0x36680b['lastName']||'')};var _0x3c31c7={'OpenchannelAccountId':_0x4a1c74[_0x5275('0x57')]['id'],'closed':![]};if(_0x4a1c74[_0x5275('0x63')]['threadId']){_0x3c31c7['threadId']=_0x4a1c74[_0x5275('0x63')]['threadId'];return db[_0x5275('0x8a')][_0x5275('0x5a')]({'where':_0x3c31c7})[_0x5275('0x33')](function(_0x181535){if(_0x181535){return[_0x181535,![]];}_0x24e09c[_0x5275('0x8b')]=_0x4a1c74[_0x5275('0x63')][_0x5275('0x8b')];_0x24e09c[_0x5275('0x8c')]=_0x4a1c74[_0x5275('0x63')][_0x5275('0x8c')];return db[_0x5275('0x8a')][_0x5275('0x5b')](_0x24e09c)['then'](function(_0x3d5113){return[_0x3d5113,!![]];});});}else{_0x3c31c7[_0x5275('0x8b')]=null;}_0x3c31c7[_0x5275('0x8d')]=_0x36680b['id'];return db[_0x5275('0x8a')][_0x5275('0x5a')]({'where':_0x3c31c7})[_0x5275('0x33')](function(_0x5e0b49){if(_0x5e0b49){return[_0x5e0b49,![]];}return db[_0x5275('0x8a')][_0x5275('0x5b')](_0x24e09c)[_0x5275('0x33')](function(_0x2c33be){return[_0x2c33be,!![]];});});}})[_0x5275('0x8e')](function(_0x1b8a1a,_0x29d0c9){if(_0x1b8a1a){_0x22c5fe=_0x29d0c9;if(!_0x29d0c9){var _0x32be16={'from':(_0x97b527[_0x5275('0x88')][_0x5275('0x89')]||'')+'\x20'+(_0x97b527[_0x5275('0x88')][_0x5275('0x8f')]||'')};if(_0x4a1c74[_0x5275('0x63')]['threadId']&&_0x4a1c74[_0x5275('0x63')][_0x5275('0x90')]&&_0x4a1c74[_0x5275('0x63')]['threadId']!=_0x4a1c74[_0x5275('0x63')][_0x5275('0x90')]){_0x32be16[_0x5275('0x8b')]=_0x4a1c74[_0x5275('0x63')][_0x5275('0x90')];}return _0x1b8a1a['update'](_0x32be16);}else{return _0x1b8a1a;}}})['then'](function(_0x17a8f5){_0x97b527[_0x5275('0x91')]=_0x17a8f5['get']({'plain':!![]});_0x97b527['interaction'][_0x5275('0x92')]=_0x22c5fe;if(_0x97b527[_0x5275('0x91')]['created']){if(_0x97b527[_0x5275('0x86')][_0x5275('0x93')]){_0x97b527[_0x5275('0x83')][_0x5275('0x94')]({'id':0x0,'priority':_0x97b527[_0x5275('0x83')][_0x5275('0x58')]+0x1,'app':_0x5275('0x95'),'appdata':_0x5275('0x96'),'interval':_0x5275('0x97')});}}return db[_0x5275('0x98')][_0x5275('0x5b')]({'body':_0x4a1c74[_0x5275('0x63')]['body'],'OpenchannelAccountId':_0x4a1c74[_0x5275('0x57')]['id'],'OpenchannelInteractionId':_0x17a8f5['id'],'direction':'in','ContactId':_0x97b527['contact']['id'],'AttachmentId':_0x4a1c74[_0x5275('0x63')]['AttachmentId']});})[_0x5275('0x33')](function(_0x2e397e){_0x97b527[_0x5275('0x26')]=_0x2e397e;if(!_0x97b527[_0x5275('0x91')][_0x5275('0x99')])return;return db[_0x5275('0x9a')][_0x5275('0x5a')]({'attributes':['id',_0x5275('0x3a')],'where':{'id':_0x97b527['interaction'][_0x5275('0x99')]}});})['then'](function(_0x177c71){if(_0x177c71){_0x97b527[_0x5275('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x177c71[_0x5275('0x3a')]+','+(_0x97b527[_0x5275('0x86')][_0x5275('0x9b')]||0xa),'interval':'*,*,*,*'});}if(!_0x97b527[_0x5275('0x91')][_0x5275('0x9c')])return;return db['OpenchannelQueue'][_0x5275('0x5a')]({'attributes':['id',_0x5275('0x3a')],'where':{'id':_0x97b527[_0x5275('0x91')]['queueId']}});})[_0x5275('0x33')](function(_0x18062d){if(_0x18062d){_0x97b527['applications'][_0x5275('0x9d')]({'id':0x0,'priority':0x1,'app':_0x5275('0x9e'),'appdata':_0x18062d[_0x5275('0x3a')]+','+(_0x97b527[_0x5275('0x86')][_0x5275('0x9f')]||0x12c),'interval':_0x5275('0x97')});}return respondWithRpcPromise(_0x5275('0xa0'),'startRouting',_0x97b527);})[_0x5275('0x33')](function(_0x4a0a1c){respondWithRpcPromise(_0x5275('0xa1'),_0x5275('0xa1'),{'event':'notify','message':_0x4a0a1c},client9002);return _0x4a0a1c;})[_0x5275('0x33')](respondWithResult(_0x38689a,null))[_0x5275('0x28')](handleError(_0x38689a,null));};exports[_0x5275('0xa2')]=function(_0x1e0d7d,_0x11addb){var _0x64e140=_0x1e0d7d[_0x5275('0x57')]['id'];var _0x251e07=_0x1e0d7d[_0x5275('0x63')];var _0x1938f9=0xc8;var _0x274d28=null;return db[_0x5275('0xa3')][_0x5275('0xa4')]({'isolationLevel':db['sequelize'][_0x5275('0xa5')][_0x5275('0xa6')][_0x5275('0xa7')]},function(_0x2c949a){return db[_0x5275('0x3f')][_0x5275('0x67')]({'where':{'id':_0x64e140},'transaction':_0x2c949a})[_0x5275('0x33')](function(_0x53975c){if(_0x53975c){return db['OpenchannelApplication'][_0x5275('0x34')]({'where':{'OpenchannelAccountId':_0x64e140},'transaction':_0x2c949a})[_0x5275('0x33')](function(){var _0x53d655=_[_0x5275('0x3e')](_0x251e07,function(_0x3624c8){_0x3624c8[_0x5275('0x68')]=_0x64e140;return _0x3624c8;});return db[_0x5275('0x81')]['bulkCreate'](_0x53d655,{'transaction':_0x2c949a});});}else{_0x1938f9=0x194;_0x274d28=[];}});})[_0x5275('0x33')](function(){if(_0x1938f9!==0x194){return db[_0x5275('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x64e140},'order':'priority'})['then'](function(_0x3670a6){_0x274d28=_0x3670a6;});}})[_0x5275('0x28')](function(_0x4bae25){_0x1938f9=0x1f4;logger[_0x5275('0x23')](_0x4bae25['stack']);if(_0x4bae25[_0x5275('0x3a')]){delete _0x4bae25[_0x5275('0x3a')];}_0x274d28=_0x4bae25;})['finally'](function(){if(_0x274d28===null){_0x11addb[_0x5275('0x38')](_0x1938f9);}else{if(_0x1938f9===0x1f4){_0x11addb[_0x5275('0x29')](_0x1938f9)[_0x5275('0x3b')](_0x274d28);}else{_0x11addb[_0x5275('0x29')](_0x1938f9)[_0x5275('0x2b')](_0x274d28);}}});};exports[_0x5275('0xa8')]=function(_0x5b97fe,_0x2723e0,_0x424077){var _0x1aeabc={};var _0x6f300d={};var _0x37565e;var _0x4261de;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5b97fe[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x2723e0,null))[_0x5275('0x33')](function(_0x4a64f1){if(_0x4a64f1){_0x37565e=_0x4a64f1;_0x6f300d[_0x5275('0x47')]=_[_0x5275('0x44')](db[_0x5275('0x81')][_0x5275('0x40')]);_0x6f300d['query']=_[_0x5275('0x44')](_0x5b97fe[_0x5275('0x43')]);_0x6f300d[_0x5275('0x45')]=_[_0x5275('0x46')](_0x6f300d[_0x5275('0x47')],_0x6f300d['query']);_0x1aeabc[_0x5275('0x49')]=_['intersection'](_0x6f300d[_0x5275('0x47')],qs['fields'](_0x5b97fe[_0x5275('0x43')][_0x5275('0x48')]));_0x1aeabc['attributes']=_0x1aeabc[_0x5275('0x49')][_0x5275('0x58')]?_0x1aeabc[_0x5275('0x49')]:_0x6f300d[_0x5275('0x47')];_0x1aeabc[_0x5275('0x4c')]=qs[_0x5275('0x4d')](_0x5b97fe[_0x5275('0x43')][_0x5275('0x4d')]);_0x1aeabc['where']=qs[_0x5275('0x45')](_[_0x5275('0x4f')](_0x5b97fe[_0x5275('0x43')],_0x6f300d[_0x5275('0x45')]));if(_0x5b97fe['query']['filter']){_0x1aeabc['where']=_[_0x5275('0x52')](_0x1aeabc[_0x5275('0x4e')],{'$or':_[_0x5275('0x3e')](_0x1aeabc[_0x5275('0x49')],function(_0x9afb26){var _0x467c0a={};_0x467c0a[_0x9afb26]={'$like':'%'+_0x5b97fe[_0x5275('0x43')]['filter']+'%'};return _0x467c0a;})});}_0x1aeabc=_[_0x5275('0x52')]({},_0x1aeabc,_0x5b97fe[_0x5275('0x53')]);return _0x37565e[_0x5275('0xa8')](_0x1aeabc);}})[_0x5275('0x33')](function(_0x468581){if(_0x468581){_0x4261de=_0x468581['length'];if(!_0x5b97fe[_0x5275('0x43')]['hasOwnProperty'](_0x5275('0x4b'))){_0x1aeabc[_0x5275('0x2d')]=qs[_0x5275('0x2d')](_0x5b97fe[_0x5275('0x43')][_0x5275('0x2d')]);_0x1aeabc[_0x5275('0x2f')]=qs[_0x5275('0x2f')](_0x5b97fe[_0x5275('0x43')]['offset']);}return _0x37565e[_0x5275('0xa8')](_0x1aeabc);}})[_0x5275('0x33')](function(_0x392ea4){if(_0x392ea4){return _0x392ea4?{'count':_0x4261de,'rows':_0x392ea4}:null;}})[_0x5275('0x33')](respondWithResult(_0x2723e0,null))['catch'](handleError(_0x2723e0,null));};exports[_0x5275('0xa9')]=function(_0x551f6c,_0x353a76,_0x1954c8){var _0x72452={'raw':![],'where':{}};var _0x14ad73={};var _0x455fee={'count':0x0,'rows':[]};return db[_0x5275('0x3f')]['findOne']({'where':{'id':_0x551f6c[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x353a76,null))[_0x5275('0x33')](function(_0x556f54){if(_0x556f54){_0x14ad73[_0x5275('0x47')]=_['keys'](db[_0x5275('0x8a')]['rawAttributes']);_0x14ad73['query']=_[_0x5275('0x44')](_0x551f6c[_0x5275('0x43')]);_0x14ad73[_0x5275('0x45')]=_['intersection'](_0x14ad73[_0x5275('0x47')],_0x14ad73[_0x5275('0x43')]);_0x72452['attributes']=_[_0x5275('0x46')](_0x14ad73['model'],qs['fields'](_0x551f6c['query']['fields']));_0x72452[_0x5275('0x49')]=_0x72452[_0x5275('0x49')]['length']?_0x72452[_0x5275('0x49')]:_0x14ad73[_0x5275('0x47')];if(!_0x551f6c[_0x5275('0x43')][_0x5275('0x4a')](_0x5275('0x4b'))){_0x72452[_0x5275('0x2d')]=qs[_0x5275('0x2d')](_0x551f6c['query'][_0x5275('0x2d')]);_0x72452[_0x5275('0x2f')]=qs[_0x5275('0x2f')](_0x551f6c[_0x5275('0x43')][_0x5275('0x2f')]);}_0x72452['order']=qs[_0x5275('0x4d')](_0x551f6c[_0x5275('0x43')][_0x5275('0x4d')]);_0x72452[_0x5275('0x4e')]=qs[_0x5275('0x45')](_[_0x5275('0x4f')](_0x551f6c['query'],_0x14ad73[_0x5275('0x45')]));_0x72452[_0x5275('0x4e')][_0x5275('0x68')]=_0x556f54['id'];if(_0x551f6c[_0x5275('0x43')]['filter']){_0x72452['where']=_[_0x5275('0x52')](_0x72452['where'],{'$or':_['map'](_0x72452[_0x5275('0x49')],function(_0x3e0c31){var _0x2764d1={};_0x2764d1[_0x3e0c31]={'$like':'%'+_0x551f6c['query'][_0x5275('0x51')]+'%'};return _0x2764d1;})});}_0x72452=_[_0x5275('0x52')]({},_0x72452,_0x551f6c[_0x5275('0x53')]);return db['OpenchannelInteraction'][_0x5275('0x2e')]({'where':_0x72452[_0x5275('0x4e')]})['then'](function(_0x299e36){_0x455fee[_0x5275('0x2e')]=_0x299e36;if(_0x551f6c[_0x5275('0x43')][_0x5275('0x54')]){_0x72452[_0x5275('0x59')]=[{'model':db['CmContact'],'as':_0x5275('0xaa'),'required':![]},{'model':db[_0x5275('0x9a')],'as':_0x5275('0xab'),'attributes':['name',_0x5275('0xac'),_0x5275('0xad')],'required':![]},{'model':db[_0x5275('0xae')],'as':_0x5275('0xaf'),'attributes':['id',_0x5275('0x3a'),_0x5275('0xb0')],'where':_0x551f6c[_0x5275('0x43')][_0x5275('0xb1')]?{'id':_0x551f6c[_0x5275('0x43')][_0x5275('0xb1')]}:undefined,'required':_0x551f6c[_0x5275('0x43')]['tag']?!![]:![]}];}return db[_0x5275('0x8a')][_0x5275('0x55')](_0x72452);})[_0x5275('0x33')](function(_0x2e9f33){_0x455fee['rows']=_0x2e9f33;return _0x455fee;});}})[_0x5275('0x33')](respondWithFilteredResult(_0x353a76,_0x72452))['catch'](handleError(_0x353a76,null));};exports['addAgents']=function(_0x4bce9e,_0x4cce4a,_0x2d8a95){return db['OpenchannelAccount']['find']({'where':{'id':_0x4bce9e[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x4cce4a,null))[_0x5275('0x33')](function(_0x18a1a1){if(_0x18a1a1){return _0x18a1a1[_0x5275('0xb2')](_0x4bce9e['body'][_0x5275('0x6b')],_['omit'](_0x4bce9e[_0x5275('0x63')],[_0x5275('0x6b'),'id'])||{})['spread'](function(_0x5cb7b0){for(var _0x47d402=0x0;_0x47d402<_0x4bce9e['body']['ids']['length'];_0x47d402+=0x1){socket[_0x5275('0xb3')](_0x5275('0xb4'),{'UserId':Number(_0x4bce9e[_0x5275('0x63')]['ids'][_0x47d402]),'OpenchannelAccountId':Number(_0x4bce9e['params']['id'])});}return _0x5cb7b0;});}})[_0x5275('0x33')](respondWithResult(_0x4cce4a,null))[_0x5275('0x28')](handleError(_0x4cce4a,null));};exports[_0x5275('0xb5')]=function(_0x59510f,_0x2a3e92,_0x59fcff){return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x59510f[_0x5275('0x57')]['id']}})['then'](handleEntityNotFound(_0x2a3e92,null))[_0x5275('0x33')](function(_0x1d4066){if(_0x1d4066){return _0x1d4066[_0x5275('0xb5')](_0x59510f[_0x5275('0x43')][_0x5275('0x6b')])['then'](function(){if(_['isArray'](_0x59510f[_0x5275('0x43')][_0x5275('0x6b')])){for(var _0x123bde=0x0;_0x123bde<_0x59510f[_0x5275('0x43')][_0x5275('0x6b')][_0x5275('0x58')];_0x123bde+=0x1){socket[_0x5275('0xb3')](_0x5275('0xb6'),{'UserId':Number(_0x59510f[_0x5275('0x43')][_0x5275('0x6b')][_0x123bde]),'OpenchannelAccountId':Number(_0x59510f[_0x5275('0x57')]['id'])});}}else{socket[_0x5275('0xb3')](_0x5275('0xb6'),{'UserId':Number(_0x59510f[_0x5275('0x43')][_0x5275('0x6b')]),'OpenchannelAccountId':Number(_0x59510f[_0x5275('0x57')]['id'])});}});}})[_0x5275('0x33')](respondWithStatusCode(_0x2a3e92,null))[_0x5275('0x28')](handleError(_0x2a3e92,null));};exports['getAgents']=function(_0x514b33,_0x559807,_0x555c28){var _0x42c063={};var _0x555fb9={};var _0x2f0f23;var _0x2adfb8;return db['OpenchannelAccount'][_0x5275('0x67')]({'where':{'id':_0x514b33[_0x5275('0x57')]['id']}})[_0x5275('0x33')](handleEntityNotFound(_0x559807,null))['then'](function(_0x58200f){if(_0x58200f){_0x2f0f23=_0x58200f;_0x555fb9[_0x5275('0x47')]=_[_0x5275('0x44')](db[_0x5275('0x9a')]['rawAttributes']);_0x555fb9['query']=_['keys'](_0x514b33[_0x5275('0x43')]);_0x555fb9['filters']=_[_0x5275('0x46')](_0x555fb9['model'],_0x555fb9[_0x5275('0x43')]);_0x42c063[_0x5275('0x49')]=_[_0x5275('0x46')](_0x555fb9['model'],qs['fields'](_0x514b33[_0x5275('0x43')][_0x5275('0x48')]));_0x42c063[_0x5275('0x49')]=_0x42c063[_0x5275('0x49')]['length']?_0x42c063[_0x5275('0x49')]:_0x555fb9[_0x5275('0x47')];_0x42c063['order']=qs['sort'](_0x514b33[_0x5275('0x43')][_0x5275('0x4d')]);_0x42c063[_0x5275('0x4e')]=qs['filters'](_[_0x5275('0x4f')](_0x514b33['query'],_0x555fb9['filters']));if(_0x514b33['query']['filter']){_0x42c063['where']=_[_0x5275('0x52')](_0x42c063[_0x5275('0x4e')],{'$or':_[_0x5275('0x3e')](_0x42c063['attributes'],function(_0x3fd84b){var _0x17f4f7={};_0x17f4f7[_0x3fd84b]={'$like':'%'+_0x514b33[_0x5275('0x43')][_0x5275('0x51')]+'%'};return _0x17f4f7;})});}_0x42c063=_[_0x5275('0x52')]({},_0x42c063,_0x514b33[_0x5275('0x53')]);return _0x2f0f23[_0x5275('0xb7')](_0x42c063);}})[_0x5275('0x33')](function(_0x2d1174){if(_0x2d1174){_0x2adfb8=_0x2d1174[_0x5275('0x58')];if(!_0x514b33[_0x5275('0x43')][_0x5275('0x4a')](_0x5275('0x4b'))){_0x42c063['limit']=qs[_0x5275('0x2d')](_0x514b33[_0x5275('0x43')][_0x5275('0x2d')]);_0x42c063[_0x5275('0x2f')]=qs[_0x5275('0x2f')](_0x514b33['query'][_0x5275('0x2f')]);}return _0x2f0f23[_0x5275('0xb7')](_0x42c063);}})[_0x5275('0x33')](function(_0xc87352){if(_0xc87352){return _0xc87352?{'count':_0x2adfb8,'rows':_0xc87352}:null;}})['then'](respondWithResult(_0x559807,null))['catch'](handleError(_0x559807,null));};exports[_0x5275('0x3b')]=function(_0x2c54c1,_0x185be5,_0x54594b){var _0x1726d0,_0xda7db,_0x47ef5c;if(_[_0x5275('0xb8')](_0x2c54c1['body'][_0x5275('0x63')])||_0x2c54c1[_0x5275('0x63')]['body']===''){throw new db[(_0x5275('0x71'))][(_0x5275('0x72'))](_0x5275('0x7a'));}if(_['isNil'](_0x2c54c1[_0x5275('0x63')]['to'])){}_0x1726d0=_0x2c54c1[_0x5275('0x63')]['to'];return db[_0x5275('0x3f')][_0x5275('0x67')]({'where':{'id':_0x2c54c1[_0x5275('0x57')]['id']}})['then'](handleEntityNotFound(_0x185be5,null))['then'](function(_0x413d1d){if(_0x413d1d){return db[_0x5275('0x3f')][_0x5275('0x5a')]({'where':{'id':_0x413d1d['id']},'include':[{'model':db[_0x5275('0x80')],'as':_0x5275('0x84'),'include':[{'model':db[_0x5275('0x70')],'as':'Contacts','where':{[_0x413d1d[_0x5275('0x7b')]]:_0x1726d0},'limit':0x1,'order':[[_0x5275('0x75'),_0x5275('0xb9')]]}]}]})[_0x5275('0x33')](handleEntityNotFound(_0x185be5,null))[_0x5275('0x33')](function(_0x43f8f0){if(_0x43f8f0&&_0x43f8f0[_0x5275('0x84')]){_0xda7db=_0x43f8f0['get']({'plain':!![]});if(_0xda7db[_0x5275('0x84')]&&_0xda7db[_0x5275('0x84')]['Contacts']['length']){return _0xda7db['List'][_0x5275('0x87')][0x0];}return db[_0x5275('0x70')][_0x5275('0x5b')](_[_0x5275('0x18')](_0x2c54c1[_0x5275('0x63')],{'firstName':_0x1726d0,[_0x43f8f0[_0x5275('0x7b')]]:_0x1726d0,'phone':_0x1726d0,'ListId':_0xda7db[_0x5275('0x78')]}));}})['then'](handleEntityNotFound(_0x185be5,null))['then'](function(_0x4a2b6e){if(_0x4a2b6e){_0x47ef5c=_0x4a2b6e;return db['OpenchannelInteraction'][_0x5275('0x5a')]({'where':{'ContactId':_0x47ef5c['id'],'closed':![],'OpenchannelAccountId':_0xda7db['id']}})[_0x5275('0x33')](function(_0x22479d){if(_0x22479d){return[_0x22479d,![]];}return db['OpenchannelInteraction'][_0x5275('0x5b')]({'UserId':_0x2c54c1[_0x5275('0x5c')]['id'],'ContactId':_0x47ef5c['id'],'OpenchannelAccountId':_0xda7db['id'],'lastMsgDirection':'out','firstMsgDirection':_0x5275('0xba'),'Messages':[_['merge'](_0x2c54c1['body'],{'read':![],'body':_0x2c54c1[_0x5275('0x63')][_0x5275('0x63')],'OpenchannelAccountId':_0xda7db['id'],'UserId':_0x2c54c1['user']['id'],'ContactId':_0x47ef5c['id']})]},{'include':[{'model':db[_0x5275('0x98')],'as':_0x5275('0xbb')}]})['then'](function(_0x3ad61a){return[_0x3ad61a,!![]];});});}})[_0x5275('0x8e')](function(_0x26243b,_0x1a0fab){if(_0x1a0fab){return _0x26243b;}return db[_0x5275('0x98')]['create'](_[_0x5275('0x52')](_0x2c54c1[_0x5275('0x63')],{'read':![],'body':_0x2c54c1[_0x5275('0x63')][_0x5275('0x63')],'OpenchannelAccountId':_0xda7db['id'],'OpenchannelInteractionId':_0x26243b['id'],'UserId':_0x2c54c1[_0x5275('0x5c')]['id'],'ContactId':_0x47ef5c['id']}))[_0x5275('0x33')](function(_0x42516d){_0x26243b[_0x5275('0xbc')][_0x5275('0xbb')]=[];_0x26243b[_0x5275('0xbc')][_0x5275('0xbb')][_0x5275('0x94')](_0x42516d[_0x5275('0xbc')]);return _0x26243b;});});}})[_0x5275('0x33')](respondWithResult(_0x185be5,null))[_0x5275('0x28')](handleError(_0x185be5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 5f0a0a0..9d7fc5f 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 _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0x923ab6,_0x200ec5){var _0x484752=function(_0x266328){while(--_0x266328){_0x923ab6['push'](_0x923ab6['shift']());}};_0x484752(++_0x200ec5);}(_0xdace,0xc5));var _0xedac=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xdace[_0x7d62cb];return _0x3a6266;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x5b437a,_0x4c5b98){var _0xe179b7=function(_0x4c0513){while(--_0x4c0513){_0x5b437a['push'](_0x5b437a['shift']());}};_0xe179b7(++_0x4c5b98);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 93fab98..739c27b 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(_0x3ffb05,_0x8113cb){var _0xd704c5=function(_0xe6d857){while(--_0xe6d857){_0x3ffb05['push'](_0x3ffb05['shift']());}};_0xd704c5(++_0x8113cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x2ebfbd,_0x23e616){var _0xdaddee=function(_0x2dfcfc){while(--_0x2dfcfc){_0x2ebfbd['push'](_0x2ebfbd['shift']());}};_0xdaddee(++_0x23e616);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 22a0bac..811082f 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 _0x9b87=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9b87,0x8e));var _0x79b8=function(_0x3b5bdc,_0x6d3ac0){_0x3b5bdc=_0x3b5bdc-0x0;var _0x195ecc=_0x9b87[_0x3b5bdc];return _0x195ecc;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rs=require(_0x79b8('0x4'));var fs=require('fs');var Redis=require(_0x79b8('0x5'));var db=require(_0x79b8('0x6'))['db'];var utils=require(_0x79b8('0x7'));var logger=require(_0x79b8('0x8'))(_0x79b8('0x9'));var config=require(_0x79b8('0xa'));var jayson=require(_0x79b8('0xb'));var client=jayson[_0x79b8('0xc')][_0x79b8('0xd')]({'port':0x232a});config[_0x79b8('0xe')]=_[_0x79b8('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x79b8('0x10'))[_0x79b8('0x11')](socket);function respondWithRpcPromise(_0x2f3453,_0x4bc41f,_0x28434){return new BPromise(function(_0x2fdb05,_0xdf585a){return client['request'](_0x2f3453,_0x28434)['then'](function(_0x46c0ce){logger[_0x79b8('0x12')](_0x79b8('0x13'),_0x4bc41f,_0x79b8('0x14'));logger[_0x79b8('0x15')](_0x79b8('0x16'),_0x4bc41f,_0x79b8('0x14'),JSON[_0x79b8('0x17')](_0x46c0ce));if(_0x46c0ce[_0x79b8('0x18')]){if(_0x46c0ce[_0x79b8('0x18')][_0x79b8('0x19')]===0x1f4){logger['error'](_0x79b8('0x13'),_0x4bc41f,_0x46c0ce['error']['message']);return _0xdf585a(_0x46c0ce[_0x79b8('0x18')][_0x79b8('0x1a')]);}logger[_0x79b8('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bc41f,_0x46c0ce[_0x79b8('0x18')]['message']);return _0x2fdb05(_0x46c0ce['error'][_0x79b8('0x1a')]);}else{logger[_0x79b8('0x12')](_0x79b8('0x13'),_0x4bc41f,_0x79b8('0x14'));_0x2fdb05(_0x46c0ce[_0x79b8('0x1b')][_0x79b8('0x1a')]);}})['catch'](function(_0x6a0de5){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4bc41f,_0x6a0de5);_0xdf585a(_0x6a0de5);});});} \ No newline at end of file +var _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','util','moment','bluebird'];(function(_0x14c800,_0x4131d7){var _0x234531=function(_0x130154){while(--_0x130154){_0x14c800['push'](_0x14c800['shift']());}};_0x234531(++_0x4131d7);}(_0xb58b,0x1f1));var _0xbb58=function(_0x16c818,_0x12bdb8){_0x16c818=_0x16c818-0x0;var _0x1f6521=_0xb58b[_0x16c818];return _0x1f6521;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});config[_0xbb58('0x9')]=_[_0xbb58('0xa')](config[_0xbb58('0x9')],{'host':_0xbb58('0xb'),'port':0x18eb});var socket=require(_0xbb58('0xc'))(new Redis(config[_0xbb58('0x9')]));require(_0xbb58('0xd'))[_0xbb58('0xe')](socket);function respondWithRpcPromise(_0x429e75,_0x261d00,_0x27f77f){return new BPromise(function(_0x4bb8c5,_0x80ab3a){return client['request'](_0x429e75,_0x27f77f)[_0xbb58('0xf')](function(_0x440392){logger[_0xbb58('0x10')](_0xbb58('0x11'),_0x261d00,'request\x20sent');logger[_0xbb58('0x12')](_0xbb58('0x13'),_0x261d00,'request\x20sent',JSON[_0xbb58('0x14')](_0x440392));if(_0x440392[_0xbb58('0x15')]){if(_0x440392[_0xbb58('0x15')][_0xbb58('0x16')]===0x1f4){logger[_0xbb58('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x261d00,_0x440392[_0xbb58('0x15')][_0xbb58('0x17')]);return _0x80ab3a(_0x440392['error']['message']);}logger[_0xbb58('0x15')](_0xbb58('0x11'),_0x261d00,_0x440392[_0xbb58('0x15')]['message']);return _0x4bb8c5(_0x440392['error']['message']);}else{logger['info'](_0xbb58('0x11'),_0x261d00,_0xbb58('0x18'));_0x4bb8c5(_0x440392['result'][_0xbb58('0x17')]);}})['catch'](function(_0x2cf892){logger[_0xbb58('0x15')](_0xbb58('0x11'),_0x261d00,_0x2cf892);_0x80ab3a(_0x2cf892);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7a7e5e6..2b05a01 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 _0x235a=['save','remove','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x56e6c6,_0x4486ce){var _0x21547e=function(_0x5f0730){while(--_0x5f0730){_0x56e6c6['push'](_0x56e6c6['shift']());}};_0x21547e(++_0x4486ce);}(_0x235a,0x1ef));var _0xa235=function(_0xb28ad8,_0x407b4d){_0xb28ad8=_0xb28ad8-0x0;var _0xac7135=_0x235a[_0xb28ad8];return _0xac7135;};'use strict';var OpenchannelAccountEvents=require(_0xa235('0x0'));var events=[_0xa235('0x1'),_0xa235('0x2'),'update'];function createListener(_0x343afd,_0x52c3b3){return function(_0x3ae786){_0x52c3b3[_0xa235('0x3')](_0x343afd,_0x3ae786);};}function removeListener(_0x277a68,_0x314ebf){return function(){OpenchannelAccountEvents[_0xa235('0x4')](_0x277a68,_0x314ebf);};}exports[_0xa235('0x5')]=function(_0x2961c8){for(var _0x1707fc=0x0,_0x4b849b=events[_0xa235('0x6')];_0x1707fc<_0x4b849b;_0x1707fc++){var _0x2dc1ba=events[_0x1707fc];var _0x450e27=createListener(_0xa235('0x7')+_0x2dc1ba,_0x2961c8);OpenchannelAccountEvents['on'](_0x2dc1ba,_0x450e27);}}; \ No newline at end of file +var _0x834d=['update','emit','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x5deebc,_0x11804a){var _0x4c2c95=function(_0x58d9fb){while(--_0x58d9fb){_0x5deebc['push'](_0x5deebc['shift']());}};_0x4c2c95(++_0x11804a);}(_0x834d,0x140));var _0xd834=function(_0x3b39ce,_0x4c1e59){_0x3b39ce=_0x3b39ce-0x0;var _0x145289=_0x834d[_0x3b39ce];return _0x145289;};'use strict';var OpenchannelAccountEvents=require(_0xd834('0x0'));var events=[_0xd834('0x1'),'remove',_0xd834('0x2')];function createListener(_0x555e39,_0x48410e){return function(_0x19a31d){_0x48410e[_0xd834('0x3')](_0x555e39,_0x19a31d);};}function removeListener(_0x2d838f,_0xfee6e0){return function(){OpenchannelAccountEvents['removeListener'](_0x2d838f,_0xfee6e0);};}exports[_0xd834('0x4')]=function(_0x3f0759){for(var _0x5e696=0x0,_0x42623d=events[_0xd834('0x5')];_0x5e696<_0x42623d;_0x5e696++){var _0x256853=events[_0x5e696];var _0x51c989=createListener(_0xd834('0x6')+_0x256853,_0x3f0759);OpenchannelAccountEvents['on'](_0x256853,_0x51c989);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1030fab..f76aa0d 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 _0xc958=['put','/:id','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','post','create'];(function(_0x46527b,_0x4faf52){var _0x3cac19=function(_0x2c70bb){while(--_0x2c70bb){_0x46527b['push'](_0x46527b['shift']());}};_0x3cac19(++_0x4faf52);}(_0xc958,0xf4));var _0x8c95=function(_0x7b5fb3,_0x2a860f){_0x7b5fb3=_0x7b5fb3-0x0;var _0x5558a2=_0xc958[_0x7b5fb3];return _0x5558a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c95('0x0'));var timeout=require('connect-timeout');var express=require(_0x8c95('0x1'));var router=express[_0x8c95('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8c95('0x3'));var interaction=require(_0x8c95('0x4'));var config=require(_0x8c95('0x5'));var controller=require(_0x8c95('0x6'));router[_0x8c95('0x7')]('/',auth['isAuthenticated'](),controller[_0x8c95('0x8')]);router['get']('/:id',auth[_0x8c95('0x9')](),controller['show']);router[_0x8c95('0xa')]('/',auth[_0x8c95('0x9')](),controller[_0x8c95('0xb')]);router[_0x8c95('0xc')](_0x8c95('0xd'),auth[_0x8c95('0x9')](),controller['update']);router[_0x8c95('0xe')](_0x8c95('0xd'),auth[_0x8c95('0x9')](),controller['destroy']);module[_0x8c95('0xf')]=router; \ No newline at end of file +var _0x27b7=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','express','fs-extra','../../components/auth/service'];(function(_0x2c203e,_0x253d39){var _0x28f34e=function(_0x392175){while(--_0x392175){_0x2c203e['push'](_0x2c203e['shift']());}};_0x28f34e(++_0x253d39);}(_0x27b7,0x19a));var _0x727b=function(_0x228dec,_0x4fe0ba){_0x228dec=_0x228dec-0x0;var _0xb9b0cf=_0x27b7[_0x228dec];return _0xb9b0cf;};'use strict';var multer=require('multer');var util=require(_0x727b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x727b('0x1'));var router=express['Router']();var fs_extra=require(_0x727b('0x2'));var auth=require(_0x727b('0x3'));var interaction=require(_0x727b('0x4'));var config=require(_0x727b('0x5'));var controller=require(_0x727b('0x6'));router['get']('/',auth[_0x727b('0x7')](),controller[_0x727b('0x8')]);router[_0x727b('0x9')](_0x727b('0xa'),auth['isAuthenticated'](),controller[_0x727b('0xb')]);router[_0x727b('0xc')]('/',auth[_0x727b('0x7')](),controller[_0x727b('0xd')]);router[_0x727b('0xe')](_0x727b('0xa'),auth['isAuthenticated'](),controller[_0x727b('0xf')]);router[_0x727b('0x10')](_0x727b('0xa'),auth[_0x727b('0x7')](),controller['destroy']);module[_0x727b('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 f0131d1..2449375 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 _0xbe4d=['noop','TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x40c329,_0x553cb8){var _0x2a7841=function(_0x4fb764){while(--_0x4fb764){_0x40c329['push'](_0x40c329['shift']());}};_0x2a7841(++_0x553cb8);}(_0xbe4d,0x106));var _0xdbe4=function(_0x2f0eda,_0x34e32b){_0x2f0eda=_0x2f0eda-0x0;var _0xbeecc5=_0xbe4d[_0x2f0eda];return _0xbeecc5;};'use strict';var Sequelize=require(_0xdbe4('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdbe4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdbe4('0x2')},'appdata':{'type':Sequelize[_0xdbe4('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xdbe4('0x4')],'defaultValue':_0xdbe4('0x5')}}; \ No newline at end of file +var _0xb71e=['exports','STRING','noop','*,*,*,*'];(function(_0xdc70ef,_0x463508){var _0xebf625=function(_0xd67f){while(--_0xd67f){_0xdc70ef['push'](_0xdc70ef['shift']());}};_0xebf625(++_0x463508);}(_0xb71e,0xac));var _0xeb71=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xb71e[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module[_0xeb71('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeb71('0x1')],'allowNull':![],'defaultValue':_0xeb71('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xeb71('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeb71('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0cbdf40..86287f4 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 _0xc48b=['params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body'];(function(_0x1826b6,_0x170b87){var _0x5957f2=function(_0x104545){while(--_0x104545){_0x1826b6['push'](_0x1826b6['shift']());}};_0x5957f2(++_0x170b87);}(_0xc48b,0xd3));var _0xbc48=function(_0x5ee1ef,_0x8d83d5){_0x5ee1ef=_0x5ee1ef-0x0;var _0x601cdc=_0xc48b[_0x5ee1ef];return _0x601cdc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbc48('0x0'));var jsonpatch=require(_0xbc48('0x1'));var rp=require(_0xbc48('0x2'));var moment=require(_0xbc48('0x3'));var BPromise=require(_0xbc48('0x4'));var Mustache=require('mustache');var util=require(_0xbc48('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbc48('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc48('0x7'));var _=require('lodash');var squel=require(_0xbc48('0x8'));var crypto=require(_0xbc48('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbc48('0x6'));var querystring=require('querystring');var Papa=require(_0xbc48('0xa'));var Redis=require(_0xbc48('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xbc48('0xc'));var as=require(_0xbc48('0xd'));var hardwareService=require(_0xbc48('0xe'));var logger=require('../../config/logger')(_0xbc48('0xf'));var utils=require('../../config/utils');var config=require(_0xbc48('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc48('0x11'))['db'];function respondWithStatusCode(_0xff6ee4,_0x2d251c){_0x2d251c=_0x2d251c||0xcc;return function(_0x5ad379){if(_0x5ad379){return _0xff6ee4['sendStatus'](_0x2d251c);}return _0xff6ee4[_0xbc48('0x12')](_0x2d251c)['end']();};}function respondWithResult(_0x7872dc,_0x19c741){_0x19c741=_0x19c741||0xc8;return function(_0x1537d7){if(_0x1537d7){return _0x7872dc[_0xbc48('0x12')](_0x19c741)[_0xbc48('0x13')](_0x1537d7);}};}function respondWithFilteredResult(_0x8caeff,_0x54d518){return function(_0x2e47f0){if(_0x2e47f0){var _0x630f2f=typeof _0x54d518['offset']===_0xbc48('0x14')&&typeof _0x54d518[_0xbc48('0x15')]===_0xbc48('0x14');var _0x145ce6=_0x2e47f0[_0xbc48('0x16')];var _0x4bb687=_0x630f2f?0x0:_0x54d518[_0xbc48('0x17')];var _0xd4b0db=_0x630f2f?_0x2e47f0[_0xbc48('0x16')]:_0x54d518['offset']+_0x54d518[_0xbc48('0x15')];var _0x6b5553;if(_0xd4b0db>=_0x145ce6){_0xd4b0db=_0x145ce6;_0x6b5553=0xc8;}else{_0x6b5553=0xce;}_0x8caeff[_0xbc48('0x12')](_0x6b5553);return _0x8caeff[_0xbc48('0x18')](_0xbc48('0x19'),_0x4bb687+'-'+_0xd4b0db+'/'+_0x145ce6)['json'](_0x2e47f0);}return null;};}function patchUpdates(_0xb8c821){return function(_0x180076){try{jsonpatch[_0xbc48('0x1a')](_0x180076,_0xb8c821,!![]);}catch(_0x2b8129){return BPromise[_0xbc48('0x1b')](_0x2b8129);}return _0x180076['save']();};}function saveUpdates(_0x5f3d47,_0x4d9cc1){return function(_0x5b09c6){if(_0x5b09c6){return _0x5b09c6[_0xbc48('0x1c')](_0x5f3d47)['then'](function(_0x468fb2){return _0x468fb2;});}return null;};}function removeEntity(_0x376b37,_0x310965){return function(_0x443b68){if(_0x443b68){return _0x443b68[_0xbc48('0x1d')]()[_0xbc48('0x1e')](function(){_0x376b37['status'](0xcc)[_0xbc48('0x1f')]();});}};}function handleEntityNotFound(_0x1bdd6f,_0x4a5f42){return function(_0x3ec0e6){if(!_0x3ec0e6){_0x1bdd6f[_0xbc48('0x20')](0x194);}return _0x3ec0e6;};}function handleError(_0x7220ff,_0x3ab99c){_0x3ab99c=_0x3ab99c||0x1f4;return function(_0x3a06e7){logger['error'](_0x3a06e7[_0xbc48('0x21')]);if(_0x3a06e7[_0xbc48('0x22')]){delete _0x3a06e7['name'];}_0x7220ff[_0xbc48('0x12')](_0x3ab99c)[_0xbc48('0x23')](_0x3a06e7);};}exports[_0xbc48('0x24')]=function(_0x1c7893,_0x2780d5){var _0x5c5866={},_0x332561={},_0x282647={'count':0x0,'rows':[]};var _0xb8bb1f=_[_0xbc48('0x25')](db[_0xbc48('0x26')][_0xbc48('0x27')],function(_0x58feed){return{'name':_0x58feed[_0xbc48('0x28')],'type':_0x58feed[_0xbc48('0x29')][_0xbc48('0x2a')]};});_0x332561[_0xbc48('0x2b')]=_[_0xbc48('0x25')](_0xb8bb1f,'name');_0x332561[_0xbc48('0x2c')]=_[_0xbc48('0x2d')](_0x1c7893[_0xbc48('0x2c')]);_0x332561[_0xbc48('0x2e')]=_[_0xbc48('0x2f')](_0x332561['model'],_0x332561[_0xbc48('0x2c')]);_0x5c5866[_0xbc48('0x30')]=_[_0xbc48('0x2f')](_0x332561[_0xbc48('0x2b')],qs[_0xbc48('0x31')](_0x1c7893[_0xbc48('0x2c')]['fields']));_0x5c5866['attributes']=_0x5c5866[_0xbc48('0x30')][_0xbc48('0x32')]?_0x5c5866['attributes']:_0x332561[_0xbc48('0x2b')];if(!_0x1c7893[_0xbc48('0x2c')]['hasOwnProperty'](_0xbc48('0x33'))){_0x5c5866[_0xbc48('0x15')]=qs[_0xbc48('0x15')](_0x1c7893['query'][_0xbc48('0x15')]);_0x5c5866[_0xbc48('0x17')]=qs[_0xbc48('0x17')](_0x1c7893[_0xbc48('0x2c')][_0xbc48('0x17')]);}_0x5c5866[_0xbc48('0x34')]=qs[_0xbc48('0x35')](_0x1c7893[_0xbc48('0x2c')]['sort']);_0x5c5866[_0xbc48('0x36')]=qs[_0xbc48('0x2e')](_[_0xbc48('0x37')](_0x1c7893[_0xbc48('0x2c')],_0x332561[_0xbc48('0x2e')]),_0xb8bb1f);if(_0x1c7893[_0xbc48('0x2c')][_0xbc48('0x38')]){_0x5c5866['where']=_[_0xbc48('0x39')](_0x5c5866['where'],{'$or':_[_0xbc48('0x25')](_0xb8bb1f,function(_0x50d02c){if(_0x50d02c[_0xbc48('0x29')]!==_0xbc48('0x3a')){var _0x33c122={};_0x33c122[_0x50d02c[_0xbc48('0x22')]]={'$like':'%'+_0x1c7893[_0xbc48('0x2c')][_0xbc48('0x38')]+'%'};return _0x33c122;}})});}_0x5c5866=_['merge']({},_0x5c5866,_0x1c7893[_0xbc48('0x3b')]);var _0x2d0e8a={'where':_0x5c5866[_0xbc48('0x36')]};return db['OpenchannelApplication'][_0xbc48('0x16')](_0x2d0e8a)['then'](function(_0x5791e0){_0x282647[_0xbc48('0x16')]=_0x5791e0;if(_0x1c7893[_0xbc48('0x2c')][_0xbc48('0x3c')]){_0x5c5866[_0xbc48('0x3d')]=[{'all':!![]}];}return db[_0xbc48('0x26')][_0xbc48('0x3e')](_0x5c5866);})['then'](function(_0x1fa688){_0x282647[_0xbc48('0x3f')]=_0x1fa688;return _0x282647;})[_0xbc48('0x1e')](respondWithFilteredResult(_0x2780d5,_0x5c5866))[_0xbc48('0x40')](handleError(_0x2780d5,null));};exports[_0xbc48('0x41')]=function(_0xf36201,_0x32f0ad){var _0x3764e2={'raw':!![],'where':{'id':_0xf36201['params']['id']}},_0x1800e5={};_0x1800e5['model']=_[_0xbc48('0x2d')](db[_0xbc48('0x26')]['rawAttributes']);_0x1800e5['query']=_[_0xbc48('0x2d')](_0xf36201[_0xbc48('0x2c')]);_0x1800e5[_0xbc48('0x2e')]=_[_0xbc48('0x2f')](_0x1800e5['model'],_0x1800e5[_0xbc48('0x2c')]);_0x3764e2[_0xbc48('0x30')]=_[_0xbc48('0x2f')](_0x1800e5[_0xbc48('0x2b')],qs[_0xbc48('0x31')](_0xf36201[_0xbc48('0x2c')]['fields']));_0x3764e2[_0xbc48('0x30')]=_0x3764e2[_0xbc48('0x30')]['length']?_0x3764e2[_0xbc48('0x30')]:_0x1800e5[_0xbc48('0x2b')];if(_0xf36201['query'][_0xbc48('0x3c')]){_0x3764e2['include']=[{'all':!![]}];}_0x3764e2=_[_0xbc48('0x39')]({},_0x3764e2,_0xf36201[_0xbc48('0x3b')]);return db[_0xbc48('0x26')][_0xbc48('0x42')](_0x3764e2)[_0xbc48('0x1e')](handleEntityNotFound(_0x32f0ad,null))[_0xbc48('0x1e')](respondWithResult(_0x32f0ad,null))['catch'](handleError(_0x32f0ad,null));};exports[_0xbc48('0x43')]=function(_0x2e8eda,_0x5c7877){return db[_0xbc48('0x26')][_0xbc48('0x43')](_0x2e8eda[_0xbc48('0x44')],{})['then'](respondWithResult(_0x5c7877,0xc9))[_0xbc48('0x40')](handleError(_0x5c7877,null));};exports[_0xbc48('0x1c')]=function(_0x306d70,_0x3cbbc1){if(_0x306d70[_0xbc48('0x44')]['id']){delete _0x306d70[_0xbc48('0x44')]['id'];}return db[_0xbc48('0x26')][_0xbc48('0x42')]({'where':{'id':_0x306d70[_0xbc48('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cbbc1,null))[_0xbc48('0x1e')](saveUpdates(_0x306d70['body'],null))[_0xbc48('0x1e')](respondWithResult(_0x3cbbc1,null))[_0xbc48('0x40')](handleError(_0x3cbbc1,null));};exports[_0xbc48('0x1d')]=function(_0x27985a,_0x4acfe0){return db[_0xbc48('0x26')][_0xbc48('0x42')]({'where':{'id':_0x27985a[_0xbc48('0x45')]['id']}})['then'](handleEntityNotFound(_0x4acfe0,null))[_0xbc48('0x1e')](removeEntity(_0x4acfe0,null))[_0xbc48('0x40')](handleError(_0x4acfe0,null));}; \ No newline at end of file +var _0xb940=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','index','OpenchannelApplication','rawAttributes','fieldName','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','update'];(function(_0x4666c5,_0x295a44){var _0x5c4eb6=function(_0x531dcb){while(--_0x531dcb){_0x4666c5['push'](_0x4666c5['shift']());}};_0x5c4eb6(++_0x295a44);}(_0xb940,0x128));var _0x0b94=function(_0x4d05dd,_0x258cdd){_0x4d05dd=_0x4d05dd-0x0;var _0x1c5226=_0xb940[_0x4d05dd];return _0x1c5226;};'use strict';var emlformat=require(_0x0b94('0x0'));var rimraf=require(_0x0b94('0x1'));var zipdir=require(_0x0b94('0x2'));var jsonpatch=require(_0x0b94('0x3'));var rp=require(_0x0b94('0x4'));var moment=require(_0x0b94('0x5'));var BPromise=require(_0x0b94('0x6'));var Mustache=require(_0x0b94('0x7'));var util=require('util');var path=require(_0x0b94('0x8'));var sox=require(_0x0b94('0x9'));var csv=require(_0x0b94('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b94('0xb'));var _=require(_0x0b94('0xc'));var squel=require(_0x0b94('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b94('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0b94('0xa'));var querystring=require(_0x0b94('0xf'));var Papa=require(_0x0b94('0x10'));var Redis=require('ioredis');var authService=require(_0x0b94('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0b94('0x12'));var hardwareService=require(_0x0b94('0x13'));var logger=require(_0x0b94('0x14'))(_0x0b94('0x15'));var utils=require(_0x0b94('0x16'));var config=require(_0x0b94('0x17'));var licenseUtil=require(_0x0b94('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2949bb,_0x5286b6){_0x5286b6=_0x5286b6||0xcc;return function(_0x2e4151){if(_0x2e4151){return _0x2949bb[_0x0b94('0x19')](_0x5286b6);}return _0x2949bb[_0x0b94('0x1a')](_0x5286b6)[_0x0b94('0x1b')]();};}function respondWithResult(_0x4ce222,_0x543e34){_0x543e34=_0x543e34||0xc8;return function(_0x1ce0ab){if(_0x1ce0ab){return _0x4ce222['status'](_0x543e34)['json'](_0x1ce0ab);}};}function respondWithFilteredResult(_0x49ea6c,_0x43f438){return function(_0x585583){if(_0x585583){var _0x4ce92f=typeof _0x43f438[_0x0b94('0x1c')]===_0x0b94('0x1d')&&typeof _0x43f438['limit']===_0x0b94('0x1d');var _0x2bf7c9=_0x585583[_0x0b94('0x1e')];var _0x42e20f=_0x4ce92f?0x0:_0x43f438[_0x0b94('0x1c')];var _0x292d36=_0x4ce92f?_0x585583[_0x0b94('0x1e')]:_0x43f438[_0x0b94('0x1c')]+_0x43f438[_0x0b94('0x1f')];var _0x444501;if(_0x292d36>=_0x2bf7c9){_0x292d36=_0x2bf7c9;_0x444501=0xc8;}else{_0x444501=0xce;}_0x49ea6c[_0x0b94('0x1a')](_0x444501);return _0x49ea6c[_0x0b94('0x20')](_0x0b94('0x21'),_0x42e20f+'-'+_0x292d36+'/'+_0x2bf7c9)['json'](_0x585583);}return null;};}function patchUpdates(_0x342bad){return function(_0x47499f){try{jsonpatch[_0x0b94('0x22')](_0x47499f,_0x342bad,!![]);}catch(_0x49d19d){return BPromise['reject'](_0x49d19d);}return _0x47499f[_0x0b94('0x23')]();};}function saveUpdates(_0x26916d,_0x381b33){return function(_0x287fee){if(_0x287fee){return _0x287fee['update'](_0x26916d)[_0x0b94('0x24')](function(_0x1e8ab0){return _0x1e8ab0;});}return null;};}function removeEntity(_0x566e65,_0x391b8c){return function(_0x462e4d){if(_0x462e4d){return _0x462e4d[_0x0b94('0x25')]()[_0x0b94('0x24')](function(){_0x566e65[_0x0b94('0x1a')](0xcc)[_0x0b94('0x1b')]();});}};}function handleEntityNotFound(_0x5e7371,_0x18d7fd){return function(_0x3104c7){if(!_0x3104c7){_0x5e7371['sendStatus'](0x194);}return _0x3104c7;};}function handleError(_0x5e9a3c,_0x4c17b3){_0x4c17b3=_0x4c17b3||0x1f4;return function(_0x2e98b5){logger['error'](_0x2e98b5['stack']);if(_0x2e98b5[_0x0b94('0x26')]){delete _0x2e98b5['name'];}_0x5e9a3c[_0x0b94('0x1a')](_0x4c17b3)[_0x0b94('0x27')](_0x2e98b5);};}exports[_0x0b94('0x28')]=function(_0xb6e135,_0x224386){var _0x5f3fcd={},_0x4f3401={},_0x16d6bd={'count':0x0,'rows':[]};var _0x635f08=_['map'](db[_0x0b94('0x29')][_0x0b94('0x2a')],function(_0x56ad01){return{'name':_0x56ad01[_0x0b94('0x2b')],'type':_0x56ad01['type']['key']};});_0x4f3401['model']=_['map'](_0x635f08,_0x0b94('0x26'));_0x4f3401[_0x0b94('0x2c')]=_['keys'](_0xb6e135[_0x0b94('0x2c')]);_0x4f3401[_0x0b94('0x2d')]=_['intersection'](_0x4f3401[_0x0b94('0x2e')],_0x4f3401[_0x0b94('0x2c')]);_0x5f3fcd['attributes']=_['intersection'](_0x4f3401[_0x0b94('0x2e')],qs['fields'](_0xb6e135[_0x0b94('0x2c')][_0x0b94('0x2f')]));_0x5f3fcd[_0x0b94('0x30')]=_0x5f3fcd[_0x0b94('0x30')][_0x0b94('0x31')]?_0x5f3fcd[_0x0b94('0x30')]:_0x4f3401[_0x0b94('0x2e')];if(!_0xb6e135[_0x0b94('0x2c')][_0x0b94('0x32')](_0x0b94('0x33'))){_0x5f3fcd[_0x0b94('0x1f')]=qs[_0x0b94('0x1f')](_0xb6e135[_0x0b94('0x2c')][_0x0b94('0x1f')]);_0x5f3fcd[_0x0b94('0x1c')]=qs[_0x0b94('0x1c')](_0xb6e135[_0x0b94('0x2c')][_0x0b94('0x1c')]);}_0x5f3fcd[_0x0b94('0x34')]=qs[_0x0b94('0x35')](_0xb6e135['query'][_0x0b94('0x35')]);_0x5f3fcd[_0x0b94('0x36')]=qs[_0x0b94('0x2d')](_[_0x0b94('0x37')](_0xb6e135['query'],_0x4f3401[_0x0b94('0x2d')]),_0x635f08);if(_0xb6e135[_0x0b94('0x2c')]['filter']){_0x5f3fcd[_0x0b94('0x36')]=_[_0x0b94('0x38')](_0x5f3fcd['where'],{'$or':_[_0x0b94('0x39')](_0x635f08,function(_0x1ba52f){if(_0x1ba52f[_0x0b94('0x3a')]!==_0x0b94('0x3b')){var _0x5c48df={};_0x5c48df[_0x1ba52f['name']]={'$like':'%'+_0xb6e135[_0x0b94('0x2c')][_0x0b94('0x3c')]+'%'};return _0x5c48df;}})});}_0x5f3fcd=_['merge']({},_0x5f3fcd,_0xb6e135[_0x0b94('0x3d')]);var _0x43269a={'where':_0x5f3fcd[_0x0b94('0x36')]};return db[_0x0b94('0x29')][_0x0b94('0x1e')](_0x43269a)[_0x0b94('0x24')](function(_0x52a053){_0x16d6bd[_0x0b94('0x1e')]=_0x52a053;if(_0xb6e135[_0x0b94('0x2c')][_0x0b94('0x3e')]){_0x5f3fcd[_0x0b94('0x3f')]=[{'all':!![]}];}return db[_0x0b94('0x29')][_0x0b94('0x40')](_0x5f3fcd);})[_0x0b94('0x24')](function(_0x4c6be5){_0x16d6bd['rows']=_0x4c6be5;return _0x16d6bd;})[_0x0b94('0x24')](respondWithFilteredResult(_0x224386,_0x5f3fcd))[_0x0b94('0x41')](handleError(_0x224386,null));};exports[_0x0b94('0x42')]=function(_0x4acf59,_0x4ba3b0){var _0xd9af20={'raw':!![],'where':{'id':_0x4acf59[_0x0b94('0x43')]['id']}},_0x366ecd={};_0x366ecd['model']=_[_0x0b94('0x44')](db['OpenchannelApplication'][_0x0b94('0x2a')]);_0x366ecd[_0x0b94('0x2c')]=_[_0x0b94('0x44')](_0x4acf59['query']);_0x366ecd['filters']=_['intersection'](_0x366ecd[_0x0b94('0x2e')],_0x366ecd['query']);_0xd9af20[_0x0b94('0x30')]=_[_0x0b94('0x45')](_0x366ecd[_0x0b94('0x2e')],qs[_0x0b94('0x2f')](_0x4acf59[_0x0b94('0x2c')][_0x0b94('0x2f')]));_0xd9af20[_0x0b94('0x30')]=_0xd9af20[_0x0b94('0x30')]['length']?_0xd9af20[_0x0b94('0x30')]:_0x366ecd[_0x0b94('0x2e')];if(_0x4acf59[_0x0b94('0x2c')][_0x0b94('0x3e')]){_0xd9af20[_0x0b94('0x3f')]=[{'all':!![]}];}_0xd9af20=_[_0x0b94('0x38')]({},_0xd9af20,_0x4acf59[_0x0b94('0x3d')]);return db[_0x0b94('0x29')][_0x0b94('0x46')](_0xd9af20)[_0x0b94('0x24')](handleEntityNotFound(_0x4ba3b0,null))[_0x0b94('0x24')](respondWithResult(_0x4ba3b0,null))[_0x0b94('0x41')](handleError(_0x4ba3b0,null));};exports[_0x0b94('0x47')]=function(_0x4b5747,_0x33a39f){return db[_0x0b94('0x29')]['create'](_0x4b5747[_0x0b94('0x48')],{})[_0x0b94('0x24')](respondWithResult(_0x33a39f,0xc9))[_0x0b94('0x41')](handleError(_0x33a39f,null));};exports[_0x0b94('0x49')]=function(_0x3b7d69,_0x48c447){if(_0x3b7d69[_0x0b94('0x48')]['id']){delete _0x3b7d69[_0x0b94('0x48')]['id'];}return db[_0x0b94('0x29')][_0x0b94('0x46')]({'where':{'id':_0x3b7d69['params']['id']}})[_0x0b94('0x24')](handleEntityNotFound(_0x48c447,null))[_0x0b94('0x24')](saveUpdates(_0x3b7d69[_0x0b94('0x48')],null))[_0x0b94('0x24')](respondWithResult(_0x48c447,null))[_0x0b94('0x41')](handleError(_0x48c447,null));};exports[_0x0b94('0x25')]=function(_0x5692c0,_0x4af7fe){return db[_0x0b94('0x29')][_0x0b94('0x46')]({'where':{'id':_0x5692c0[_0x0b94('0x43')]['id']}})[_0x0b94('0x24')](handleEntityNotFound(_0x4af7fe,null))[_0x0b94('0x24')](removeEntity(_0x4af7fe,null))[_0x0b94('0x41')](handleError(_0x4af7fe,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 66076de..5191418 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 _0x08df=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x08df,0xdc));var _0xf08d=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x08df[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require('lodash');var util=require(_0xf08d('0x0'));var logger=require(_0xf08d('0x1'))(_0xf08d('0x2'));var moment=require(_0xf08d('0x3'));var BPromise=require(_0xf08d('0x4'));var rp=require(_0xf08d('0x5'));var fs=require('fs');var path=require(_0xf08d('0x6'));var rimraf=require(_0xf08d('0x7'));var config=require(_0xf08d('0x8'));var attributes=require(_0xf08d('0x9'));module[_0xf08d('0xa')]=function(_0x113558,_0x30424b){return _0x113558[_0xf08d('0xb')]('OpenchannelApplication',attributes,{'tableName':_0xf08d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf08d('0xd')});}; \ No newline at end of file +var _0xb7f6=['openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x4cddab,_0x37739b){var _0x1be704=function(_0x383c81){while(--_0x383c81){_0x4cddab['push'](_0x4cddab['shift']());}};_0x1be704(++_0x37739b);}(_0xb7f6,0x160));var _0x6b7f=function(_0x3738e1,_0x24e2da){_0x3738e1=_0x3738e1-0x0;var _0x3c1242=_0xb7f6[_0x3738e1];return _0x3c1242;};'use strict';var _=require(_0x6b7f('0x0'));var util=require(_0x6b7f('0x1'));var logger=require(_0x6b7f('0x2'))(_0x6b7f('0x3'));var moment=require(_0x6b7f('0x4'));var BPromise=require(_0x6b7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b7f('0x6'));var rimraf=require(_0x6b7f('0x7'));var config=require(_0x6b7f('0x8'));var attributes=require(_0x6b7f('0x9'));module[_0x6b7f('0xa')]=function(_0x52da4d,_0x1ae7f3){return _0x52da4d[_0x6b7f('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x6b7f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 54ca1bf..122645a 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 _0xf3f6=['jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4be79b,_0x21e987){var _0x14d71e=function(_0x25ea7a){while(--_0x25ea7a){_0x4be79b['push'](_0x4be79b['shift']());}};_0x14d71e(++_0x21e987);}(_0xf3f6,0x140));var _0x6f3f=function(_0x5ad0e6,_0x52c355){_0x5ad0e6=_0x5ad0e6-0x0;var _0x1fbd47=_0xf3f6[_0x5ad0e6];return _0x1fbd47;};'use strict';var _=require(_0x6f3f('0x0'));var util=require(_0x6f3f('0x1'));var moment=require(_0x6f3f('0x2'));var BPromise=require(_0x6f3f('0x3'));var rs=require(_0x6f3f('0x4'));var fs=require('fs');var Redis=require(_0x6f3f('0x5'));var db=require(_0x6f3f('0x6'))['db'];var utils=require(_0x6f3f('0x7'));var logger=require(_0x6f3f('0x8'))('rpc');var config=require(_0x6f3f('0x9'));var jayson=require(_0x6f3f('0xa'));var client=jayson[_0x6f3f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36dad7,_0xe222d,_0x3c10c8){return new BPromise(function(_0x349e18,_0x2dba41){return client[_0x6f3f('0xc')](_0x36dad7,_0x3c10c8)[_0x6f3f('0xd')](function(_0x547dd1){logger[_0x6f3f('0xe')](_0x6f3f('0xf'),_0xe222d,'request\x20sent');logger[_0x6f3f('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xe222d,_0x6f3f('0x11'),JSON[_0x6f3f('0x12')](_0x547dd1));if(_0x547dd1[_0x6f3f('0x13')]){if(_0x547dd1['error']['code']===0x1f4){logger[_0x6f3f('0x13')](_0x6f3f('0xf'),_0xe222d,_0x547dd1[_0x6f3f('0x13')][_0x6f3f('0x14')]);return _0x2dba41(_0x547dd1[_0x6f3f('0x13')][_0x6f3f('0x14')]);}logger[_0x6f3f('0x13')](_0x6f3f('0xf'),_0xe222d,_0x547dd1[_0x6f3f('0x13')][_0x6f3f('0x14')]);return _0x349e18(_0x547dd1['error'][_0x6f3f('0x14')]);}else{logger[_0x6f3f('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0xe222d,_0x6f3f('0x11'));_0x349e18(_0x547dd1['result'][_0x6f3f('0x14')]);}})[_0x6f3f('0x15')](function(_0x4ff400){logger[_0x6f3f('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0xe222d,_0x4ff400);_0x2dba41(_0x4ff400);});});}exports[_0x6f3f('0x16')]=function(_0x1258fd){var _0x54fe9c=this;return new Promise(function(_0x9e0d0e,_0xa4d36){return db[_0x6f3f('0x17')][_0x6f3f('0x18')](_0x1258fd[_0x6f3f('0x19')],{'raw':_0x1258fd[_0x6f3f('0x1a')]?_0x1258fd[_0x6f3f('0x1a')][_0x6f3f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1258fd[_0x6f3f('0x1a')]?_0x1258fd[_0x6f3f('0x1a')][_0x6f3f('0x1c')]||null:null,'attributes':_0x1258fd[_0x6f3f('0x1a')]?_0x1258fd['options']['attributes']||null:null,'limit':_0x1258fd['options']?_0x1258fd[_0x6f3f('0x1a')][_0x6f3f('0x1d')]||null:null})[_0x6f3f('0xd')](function(_0x2c5181){logger[_0x6f3f('0xe')](_0x6f3f('0x16'),_0x1258fd);logger[_0x6f3f('0x10')]('UpdateOpenchannelApplication',_0x1258fd,JSON[_0x6f3f('0x12')](_0x2c5181));_0x9e0d0e(_0x2c5181);})[_0x6f3f('0x15')](function(_0x5b20cb){logger[_0x6f3f('0x13')](_0x6f3f('0x16'),_0x5b20cb[_0x6f3f('0x14')],_0x1258fd);_0xa4d36(_0x54fe9c[_0x6f3f('0x13')](0x1f4,_0x5b20cb[_0x6f3f('0x14')]));});});}; \ No newline at end of file +var _0x02b1=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','OpenchannelApplication','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash'];(function(_0x5c14ee,_0x315573){var _0x18454b=function(_0x406d25){while(--_0x406d25){_0x5c14ee['push'](_0x5c14ee['shift']());}};_0x18454b(++_0x315573);}(_0x02b1,0x1a3));var _0x102b=function(_0x236ba6,_0x247d72){_0x236ba6=_0x236ba6-0x0;var _0x392d63=_0x02b1[_0x236ba6];return _0x392d63;};'use strict';var _=require(_0x102b('0x0'));var util=require(_0x102b('0x1'));var moment=require('moment');var BPromise=require(_0x102b('0x2'));var rs=require(_0x102b('0x3'));var fs=require('fs');var Redis=require(_0x102b('0x4'));var db=require(_0x102b('0x5'))['db'];var utils=require(_0x102b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x102b('0x7'));var client=jayson[_0x102b('0x8')][_0x102b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b78aa,_0x555eb0,_0x43c9be){return new BPromise(function(_0x2bf862,_0xd7a324){return client[_0x102b('0xa')](_0x3b78aa,_0x43c9be)[_0x102b('0xb')](function(_0x44edbf){logger['info'](_0x102b('0xc'),_0x555eb0,'request\x20sent');logger['debug'](_0x102b('0xd'),_0x555eb0,_0x102b('0xe'),JSON[_0x102b('0xf')](_0x44edbf));if(_0x44edbf[_0x102b('0x10')]){if(_0x44edbf[_0x102b('0x10')][_0x102b('0x11')]===0x1f4){logger[_0x102b('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x555eb0,_0x44edbf['error'][_0x102b('0x12')]);return _0xd7a324(_0x44edbf['error'][_0x102b('0x12')]);}logger['error'](_0x102b('0xc'),_0x555eb0,_0x44edbf[_0x102b('0x10')]['message']);return _0x2bf862(_0x44edbf[_0x102b('0x10')]['message']);}else{logger[_0x102b('0x13')](_0x102b('0xc'),_0x555eb0,_0x102b('0xe'));_0x2bf862(_0x44edbf['result'][_0x102b('0x12')]);}})[_0x102b('0x14')](function(_0x4bc82f){logger[_0x102b('0x10')](_0x102b('0xc'),_0x555eb0,_0x4bc82f);_0xd7a324(_0x4bc82f);});});}exports['UpdateOpenchannelApplication']=function(_0x354fbb){var _0x457fe7=this;return new Promise(function(_0x4b84c0,_0x5e16ce){return db[_0x102b('0x15')]['update'](_0x354fbb['body'],{'raw':_0x354fbb['options']?_0x354fbb[_0x102b('0x16')][_0x102b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354fbb[_0x102b('0x16')]?_0x354fbb['options'][_0x102b('0x18')]||null:null,'attributes':_0x354fbb['options']?_0x354fbb[_0x102b('0x16')][_0x102b('0x19')]||null:null,'limit':_0x354fbb['options']?_0x354fbb[_0x102b('0x16')][_0x102b('0x1a')]||null:null})[_0x102b('0xb')](function(_0x2bcbad){logger[_0x102b('0x13')](_0x102b('0x1b'),_0x354fbb);logger['debug'](_0x102b('0x1b'),_0x354fbb,JSON[_0x102b('0xf')](_0x2bcbad));_0x4b84c0(_0x2bcbad);})['catch'](function(_0x130d74){logger[_0x102b('0x10')](_0x102b('0x1b'),_0x130d74[_0x102b('0x12')],_0x354fbb);_0x5e16ce(_0x457fe7[_0x102b('0x10')](0x1f4,_0x130d74[_0x102b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index dcce92b..345b47b 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 _0x19ce=['util','path','express','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer'];(function(_0x3fa9cc,_0x2172bc){var _0x3ade14=function(_0xe23443){while(--_0xe23443){_0x3fa9cc['push'](_0x3fa9cc['shift']());}};_0x3ade14(++_0x2172bc);}(_0x19ce,0x135));var _0xe19c=function(_0x1be623,_0x2d741a){_0x1be623=_0x1be623-0x0;var _0x4abc61=_0x19ce[_0x1be623];return _0x4abc61;};'use strict';var multer=require(_0xe19c('0x0'));var util=require(_0xe19c('0x1'));var path=require(_0xe19c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe19c('0x3'));var router=express['Router']();var fs_extra=require(_0xe19c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe19c('0x5'));var config=require('../../config/environment');var controller=require(_0xe19c('0x6'));router[_0xe19c('0x7')]('/',auth['isAuthenticated'](),controller[_0xe19c('0x8')]);router['get'](_0xe19c('0x9'),auth[_0xe19c('0xa')](),controller['describe']);router['get'](_0xe19c('0xb'),auth['isAuthenticated'](),controller[_0xe19c('0xc')]);router['get']('/:id/messages',auth[_0xe19c('0xa')](),controller[_0xe19c('0xd')]);router[_0xe19c('0x7')]('/:id/download',auth[_0xe19c('0xa')](),controller[_0xe19c('0xe')]);router[_0xe19c('0xf')]('/',auth['isAuthenticated'](),controller[_0xe19c('0x10')]);router[_0xe19c('0xf')](_0xe19c('0x11'),auth[_0xe19c('0xa')](),controller[_0xe19c('0x12')]);router[_0xe19c('0xf')](_0xe19c('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0xe19c('0x14'),_0xe19c('0x15')),controller[_0xe19c('0x16')]);router[_0xe19c('0x17')](_0xe19c('0xb'),auth['isAuthenticated'](),interaction[_0xe19c('0x18')](_0xe19c('0x14'),_0xe19c('0x19')),controller[_0xe19c('0x1a')]);router[_0xe19c('0x1b')](_0xe19c('0xb'),auth[_0xe19c('0xa')](),interaction[_0xe19c('0x18')](_0xe19c('0x14'),_0xe19c('0x1c')),controller[_0xe19c('0x1d')]);router[_0xe19c('0x1b')](_0xe19c('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe19c('0x1e')]=router; \ No newline at end of file +var _0xaff2=['openchannel','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','put','openchannelinteraction:update','delete','/:id'];(function(_0x40b50d,_0x5f35db){var _0x1fc393=function(_0x2e60d4){while(--_0x2e60d4){_0x40b50d['push'](_0x40b50d['shift']());}};_0x1fc393(++_0x5f35db);}(_0xaff2,0x1d1));var _0x2aff=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xaff2[_0x65c0bb];return _0x320bd5;};'use strict';var multer=require(_0x2aff('0x0'));var util=require(_0x2aff('0x1'));var path=require('path');var timeout=require(_0x2aff('0x2'));var express=require(_0x2aff('0x3'));var router=express[_0x2aff('0x4')]();var fs_extra=require(_0x2aff('0x5'));var auth=require(_0x2aff('0x6'));var interaction=require(_0x2aff('0x7'));var config=require(_0x2aff('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x2aff('0x9')]('/',auth['isAuthenticated'](),controller[_0x2aff('0xa')]);router['get'](_0x2aff('0xb'),auth[_0x2aff('0xc')](),controller[_0x2aff('0xd')]);router[_0x2aff('0x9')]('/:id',auth[_0x2aff('0xc')](),controller[_0x2aff('0xe')]);router['get']('/:id/messages',auth[_0x2aff('0xc')](),controller[_0x2aff('0xf')]);router[_0x2aff('0x9')](_0x2aff('0x10'),auth['isAuthenticated'](),controller[_0x2aff('0x11')]);router[_0x2aff('0x12')]('/',auth[_0x2aff('0xc')](),controller[_0x2aff('0x13')]);router[_0x2aff('0x12')](_0x2aff('0x14'),auth[_0x2aff('0xc')](),controller[_0x2aff('0x15')]);router[_0x2aff('0x12')](_0x2aff('0x16'),auth[_0x2aff('0xc')](),interaction[_0x2aff('0x17')]('openchannel','openchannelinteraction:addtags'),controller['addTags']);router[_0x2aff('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x2aff('0x19')),controller['update']);router[_0x2aff('0x1a')](_0x2aff('0x1b'),auth[_0x2aff('0xc')](),interaction[_0x2aff('0x17')](_0x2aff('0x1c'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0x2aff('0x16'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 53cfa0a..242698d 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 _0xa40b=['exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER'];(function(_0x31162c,_0x4efe27){var _0x37c738=function(_0x419568){while(--_0x419568){_0x31162c['push'](_0x31162c['shift']());}};_0x37c738(++_0x4efe27);}(_0xa40b,0x15e));var _0xba40=function(_0x5bc4ed,_0x430f92){_0x5bc4ed=_0x5bc4ed-0x0;var _0x270668=_0xa40b[_0x5bc4ed];return _0x270668;};'use strict';var Sequelize=require('sequelize');module[_0xba40('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xba40('0x1')]},'disposition':{'type':Sequelize[_0xba40('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xba40('0x2')]},'read1stAt':{'type':Sequelize[_0xba40('0x1')]},'threadId':{'type':Sequelize[_0xba40('0x2')]},'externalUrl':{'type':Sequelize[_0xba40('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xba40('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xba40('0x3')]('in',_0xba40('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xba40('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xba40('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xba40('0x6')]}}; \ No newline at end of file +var _0xf6ed=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x20478b,_0x464e32){var _0x500c52=function(_0x3f74a2){while(--_0x3f74a2){_0x20478b['push'](_0x20478b['shift']());}};_0x500c52(++_0x464e32);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x4e13ff,_0x5756bf){_0x4e13ff=_0x4e13ff-0x0;var _0x14528d=_0xf6ed[_0x4e13ff];return _0x14528d;};'use strict';var Sequelize=require(_0xdf6e('0x0'));module['exports']={'closed':{'type':Sequelize[_0xdf6e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdf6e('0x2')]},'disposition':{'type':Sequelize[_0xdf6e('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdf6e('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xdf6e('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdf6e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xdf6e('0x4')]('in',_0xdf6e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdf6e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xdf6e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index da76665..0a20891 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 _0xde79=['findAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','join','root','server','tmp','attachments','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','toString','closed','closedAt','disposition','threadId','Private','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','Contact','direction','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','find','describe','addMessage','body','omit','ids','getMessages','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','pick','where','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xd543c6,_0x229c9e){var _0x2b3ce9=function(_0x116f87){while(--_0x116f87){_0xd543c6['push'](_0xd543c6['shift']());}};_0x2b3ce9(++_0x229c9e);}(_0xde79,0xaf));var _0x9de7=function(_0x4c36e5,_0x5c9c28){_0x4c36e5=_0x4c36e5-0x0;var _0x3844e2=_0xde79[_0x4c36e5];return _0x3844e2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9de7('0x0'));var moment=require(_0x9de7('0x1'));var util=require(_0x9de7('0x2'));var path=require(_0x9de7('0x3'));var ejs=require(_0x9de7('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x9de7('0x5'));var interaction=require(_0x9de7('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x9de7('0x7'))(_0x9de7('0x8'));var config=require(_0x9de7('0x9'));var db=require(_0x9de7('0xa'))['db'];config[_0x9de7('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9de7('0xc'))(new Redis(config[_0x9de7('0xb')]));require(_0x9de7('0xd'))[_0x9de7('0xe')](socket);function respondWithStatusCode(_0x575b76,_0x2146ec){_0x2146ec=_0x2146ec||0xcc;return function(_0x3426ba){if(_0x3426ba){return _0x575b76[_0x9de7('0xf')](_0x2146ec);}return _0x575b76[_0x9de7('0x10')](_0x2146ec)[_0x9de7('0x11')]();};}function respondWithResult(_0x5d6c2c,_0xbfe23d){_0xbfe23d=_0xbfe23d||0xc8;return function(_0x10ce2b){if(_0x10ce2b){return _0x5d6c2c[_0x9de7('0x10')](_0xbfe23d)[_0x9de7('0x12')](_0x10ce2b);}};}function respondWithFilteredResult(_0x85a82c,_0xb92c2b){return function(_0x53e406){if(_0x53e406){var _0x419235=typeof _0xb92c2b[_0x9de7('0x13')]===_0x9de7('0x14')&&typeof _0xb92c2b[_0x9de7('0x15')]===_0x9de7('0x14');var _0x229202=_0x53e406['count'];var _0xf23740=_0x419235?0x0:_0xb92c2b['offset'];var _0x3d184c=_0x419235?_0x53e406[_0x9de7('0x16')]:_0xb92c2b[_0x9de7('0x13')]+_0xb92c2b[_0x9de7('0x15')];var _0x280cca;if(_0x3d184c>=_0x229202){_0x3d184c=_0x229202;_0x280cca=0xc8;}else{_0x280cca=0xce;}_0x85a82c[_0x9de7('0x10')](_0x280cca);return _0x85a82c['set'](_0x9de7('0x17'),_0xf23740+'-'+_0x3d184c+'/'+_0x229202)[_0x9de7('0x12')](_0x53e406);}return null;};}function saveUpdates(_0x4e84b0){return function(_0x54e9a9){if(_0x54e9a9){return _0x54e9a9[_0x9de7('0x18')](_0x4e84b0)['then'](function(_0xd7af1d){return _0xd7af1d;});}return null;};}function removeEntity(_0x519d48){return function(_0xab7bf){if(_0xab7bf){return _0xab7bf[_0x9de7('0x19')]()[_0x9de7('0x1a')](function(){_0x519d48[_0x9de7('0x10')](0xcc)[_0x9de7('0x11')]();});}};}function handleEntityNotFound(_0x2f2460){return function(_0x17bd2f){if(!_0x17bd2f){_0x2f2460[_0x9de7('0xf')](0x194);}return _0x17bd2f;};}function handleError(_0x43d83f,_0x386df1){_0x386df1=_0x386df1||0x1f4;return function(_0x5d35f7){logger[_0x9de7('0x1b')](_0x5d35f7['stack']);if(_0x5d35f7[_0x9de7('0x1c')]){delete _0x5d35f7[_0x9de7('0x1c')];}_0x43d83f[_0x9de7('0x10')](_0x386df1)[_0x9de7('0x1d')](_0x5d35f7);};}exports[_0x9de7('0x1e')]=function(_0x21a6b5,_0x27e9ec){var _0x332933={};var _0x152a76=_['map'](db[_0x9de7('0x1f')][_0x9de7('0x20')],function(_0xfc2864){return{'name':_0xfc2864[_0x9de7('0x21')],'type':_0xfc2864[_0x9de7('0x22')]['key']};});_0x332933=qs['getOptions'](_0x152a76,_0x21a6b5);return interaction['findAll'](_0x9de7('0x23'),_0x21a6b5[_0x9de7('0x24')],_0x21a6b5[_0x9de7('0x25')],_0x332933,_0x152a76)[_0x9de7('0x1a')](respondWithFilteredResult(_0x27e9ec,_0x332933))[_0x9de7('0x26')](handleError(_0x27e9ec,null));};exports[_0x9de7('0x27')]=function(_0xadd3f6,_0x10f545){var _0x3f654c={};if(_0xadd3f6[_0x9de7('0x24')]['type']&&_0xadd3f6[_0x9de7('0x24')][_0x9de7('0x22')]===_0x9de7('0x28')){_0x3f654c[_0x9de7('0x28')]=_0xadd3f6[_0x9de7('0x29')]['id'];}else{_0x3f654c['id']=_0xadd3f6[_0x9de7('0x29')]['id'];}var _0x415951={'raw':![],'where':_0x3f654c},_0x564e6d={};_0x564e6d[_0x9de7('0x2a')]=_[_0x9de7('0x2b')](db[_0x9de7('0x1f')][_0x9de7('0x20')]);_0x564e6d['query']=_[_0x9de7('0x2b')](_0xadd3f6[_0x9de7('0x24')]);_0x564e6d[_0x9de7('0x2c')]=_[_0x9de7('0x2d')](_0x564e6d[_0x9de7('0x2a')],_0x564e6d['query']);_0x415951[_0x9de7('0x2e')]=_[_0x9de7('0x2d')](_0x564e6d[_0x9de7('0x2a')],qs[_0x9de7('0x2f')](_0xadd3f6['query'][_0x9de7('0x2f')]));_0x415951['attributes']=_0x415951['attributes'][_0x9de7('0x30')]?_0x415951[_0x9de7('0x2e')]:_0x564e6d[_0x9de7('0x2a')];if(_0xadd3f6[_0x9de7('0x24')][_0x9de7('0x31')]){_0x415951[_0x9de7('0x32')]=[{'all':!![]}];}_0x415951=_[_0x9de7('0x33')]({},_0x415951,_0xadd3f6[_0x9de7('0x34')]);return db['OpenchannelInteraction']['find'](_0x415951)[_0x9de7('0x1a')](handleEntityNotFound(_0x10f545,null))[_0x9de7('0x1a')](respondWithResult(_0x10f545,null))[_0x9de7('0x26')](handleError(_0x10f545,null));};exports[_0x9de7('0x35')]=function(_0x31caa7,_0x463b5c){return db[_0x9de7('0x1f')][_0x9de7('0x35')](_0x31caa7['body'],{})[_0x9de7('0x1a')](respondWithResult(_0x463b5c,0xc9))[_0x9de7('0x26')](handleError(_0x463b5c,null));};exports[_0x9de7('0x18')]=function(_0x26d783,_0x2bc3e5){if(_0x26d783['body']['id']){delete _0x26d783['body']['id'];}return db[_0x9de7('0x1f')][_0x9de7('0x36')]({'where':{'id':_0x26d783['params']['id']}})[_0x9de7('0x1a')](handleEntityNotFound(_0x2bc3e5,null))[_0x9de7('0x1a')](saveUpdates(_0x26d783['body'],null))[_0x9de7('0x1a')](respondWithResult(_0x2bc3e5,null))[_0x9de7('0x26')](handleError(_0x2bc3e5,null));};exports['destroy']=function(_0x58ab97,_0x4d5d06){return db[_0x9de7('0x1f')][_0x9de7('0x36')]({'where':{'id':_0x58ab97[_0x9de7('0x29')]['id']}})[_0x9de7('0x1a')](handleEntityNotFound(_0x4d5d06,null))['then'](removeEntity(_0x4d5d06,null))[_0x9de7('0x26')](handleError(_0x4d5d06,null));};exports[_0x9de7('0x37')]=function(_0xbc9e95,_0x188137){return db[_0x9de7('0x1f')][_0x9de7('0x37')]()[_0x9de7('0x1a')](respondWithResult(_0x188137,null))[_0x9de7('0x26')](handleError(_0x188137,null));};exports[_0x9de7('0x38')]=function(_0x27e041,_0x5e68fc){return db['OpenchannelMessage']['find']({'where':{'id':_0x27e041[_0x9de7('0x29')]['id']}})['then'](handleEntityNotFound(_0x5e68fc,null))[_0x9de7('0x1a')](function(_0xf65f96){if(_0xf65f96){return _0xf65f96[_0x9de7('0x38')](_0x27e041[_0x9de7('0x39')]['ids'],_[_0x9de7('0x3a')](_0x27e041[_0x9de7('0x39')],[_0x9de7('0x3b'),'id'])||{});}})[_0x9de7('0x1a')](respondWithResult(_0x5e68fc,null))[_0x9de7('0x26')](handleError(_0x5e68fc,null));};exports[_0x9de7('0x3c')]=function(_0x305045,_0x6f3eb0){var _0x4e0e8d={'raw':![],'where':{}};var _0x3039b2={};var _0x3c0da0={'count':0x0,'rows':[]};return db[_0x9de7('0x1f')]['findOne']({'where':{'id':_0x305045[_0x9de7('0x29')]['id']}})[_0x9de7('0x1a')](handleEntityNotFound(_0x6f3eb0,null))[_0x9de7('0x1a')](function(_0x3e6e87){if(_0x3e6e87){_0x3039b2[_0x9de7('0x2a')]=_[_0x9de7('0x2b')](db[_0x9de7('0x3d')][_0x9de7('0x20')]);_0x3039b2[_0x9de7('0x24')]=_[_0x9de7('0x2b')](_0x305045[_0x9de7('0x24')]);_0x3039b2['filters']=_[_0x9de7('0x2d')](_0x3039b2['model'],_0x3039b2['query']);_0x4e0e8d[_0x9de7('0x2e')]=_[_0x9de7('0x2d')](_0x3039b2[_0x9de7('0x2a')],qs[_0x9de7('0x2f')](_0x305045[_0x9de7('0x24')]['fields']));_0x4e0e8d[_0x9de7('0x2e')]=_0x4e0e8d[_0x9de7('0x2e')][_0x9de7('0x30')]?_0x4e0e8d[_0x9de7('0x2e')]:_0x3039b2[_0x9de7('0x2a')];if(!_0x305045[_0x9de7('0x24')][_0x9de7('0x3e')](_0x9de7('0x3f'))){_0x4e0e8d[_0x9de7('0x15')]=qs[_0x9de7('0x15')](_0x305045[_0x9de7('0x24')][_0x9de7('0x15')]);_0x4e0e8d[_0x9de7('0x13')]=qs['offset'](_0x305045[_0x9de7('0x24')]['offset']);}_0x4e0e8d[_0x9de7('0x40')]=qs[_0x9de7('0x41')](_0x305045[_0x9de7('0x24')][_0x9de7('0x41')]);_0x4e0e8d['where']=qs[_0x9de7('0x2c')](_[_0x9de7('0x42')](_0x305045[_0x9de7('0x24')],_0x3039b2['filters']));_0x4e0e8d[_0x9de7('0x43')]['OpenchannelInteractionId']=_0x3e6e87['id'];if(_0x305045[_0x9de7('0x24')][_0x9de7('0x44')]){_0x4e0e8d[_0x9de7('0x43')]=_[_0x9de7('0x33')](_0x4e0e8d['where'],{'$or':_[_0x9de7('0x45')](_0x4e0e8d[_0x9de7('0x2e')],function(_0x21039d){var _0x51ab96={};_0x51ab96[_0x21039d]={'$like':'%'+_0x305045[_0x9de7('0x24')][_0x9de7('0x44')]+'%'};return _0x51ab96;})});}if(_0x305045[_0x9de7('0x24')][_0x9de7('0x46')]){var _0x5154f9=_0x305045[_0x9de7('0x24')]['$gte']['split'](',');var _0x29fbca={};_0x29fbca[_0x5154f9[0x0]]={'$gte':moment(_0x5154f9[0x1])[_0x9de7('0x47')](_0x9de7('0x48'))};_0x4e0e8d[_0x9de7('0x43')]=_[_0x9de7('0x33')](_0x4e0e8d['where'],_0x29fbca);}_0x4e0e8d=_[_0x9de7('0x33')]({},_0x4e0e8d,_0x305045[_0x9de7('0x34')]);return db[_0x9de7('0x3d')][_0x9de7('0x16')]({'where':_0x4e0e8d['where']})[_0x9de7('0x1a')](function(_0x2646b2){_0x3c0da0[_0x9de7('0x16')]=_0x2646b2;if(_0x305045[_0x9de7('0x24')][_0x9de7('0x31')]){_0x4e0e8d[_0x9de7('0x32')]=[{'all':!![]}];}return db[_0x9de7('0x3d')][_0x9de7('0x49')](_0x4e0e8d);})['then'](function(_0x993c20){_0x3c0da0[_0x9de7('0x4a')]=_0x993c20;return _0x3c0da0;});}})[_0x9de7('0x1a')](respondWithFilteredResult(_0x6f3eb0,_0x4e0e8d))[_0x9de7('0x26')](handleError(_0x6f3eb0,null));};exports[_0x9de7('0x4b')]=function(_0x47adec,_0x4583c5){return db[_0x9de7('0x1f')][_0x9de7('0x36')]({'where':{'id':_0x47adec[_0x9de7('0x29')]['id']}})['then'](handleEntityNotFound(_0x4583c5,null))[_0x9de7('0x1a')](function(_0x1a1f3a){if(_0x1a1f3a){return _0x1a1f3a[_0x9de7('0x4c')](_0x47adec[_0x9de7('0x39')]['ids'],_[_0x9de7('0x3a')](_0x47adec[_0x9de7('0x39')],[_0x9de7('0x3b'),'id'])||{})[_0x9de7('0x4d')](function(){return db[_0x9de7('0x4e')][_0x9de7('0x49')]({'attributes':['id',_0x9de7('0x1c'),_0x9de7('0x4f')],'where':{'id':_0x47adec[_0x9de7('0x39')]['ids']}});})['then'](function(_0x5a5ba9){socket[_0x9de7('0x50')]('openchannelInteractionTags:save',{'id':Number(_0x47adec[_0x9de7('0x29')]['id']),'tags':_0x5a5ba9||[]});return{'id':Number(_0x47adec[_0x9de7('0x29')]['id']),'tags':_0x5a5ba9||[]};});}})['then'](respondWithResult(_0x4583c5,null))[_0x9de7('0x26')](handleError(_0x4583c5,null));};exports[_0x9de7('0x51')]=function(_0x160576,_0x24359d){return db['OpenchannelInteraction'][_0x9de7('0x36')]({'where':{'id':_0x160576[_0x9de7('0x29')]['id']}})['then'](handleEntityNotFound(_0x24359d,null))['then'](function(_0x1a6d1c){if(_0x1a6d1c){return _0x1a6d1c[_0x9de7('0x51')](_0x160576['query'][_0x9de7('0x3b')]);}})['then'](respondWithStatusCode(_0x24359d,null))['catch'](handleError(_0x24359d,null));};exports[_0x9de7('0x52')]=function(_0x1996ef,_0x4ab218){var _0x53fb41=moment()['unix']()['toString']();var _0x5a89a6=path[_0x9de7('0x53')](config[_0x9de7('0x54')],_0x9de7('0x55'),'files',_0x9de7('0x56'));var _0xb72ae2=path[_0x9de7('0x53')](config[_0x9de7('0x54')],_0x9de7('0x55'),'files',_0x9de7('0x57'));var _0x589b91=path[_0x9de7('0x53')](_0x5a89a6,_0x53fb41);var _0x53435f=util['format']('transcript-%d-%s.zip',_0x1996ef[_0x9de7('0x29')]['id'],_0x53fb41);var _0x51609d=path[_0x9de7('0x53')](_0x5a89a6,_0x53435f);var _0x517338=[];_0x517338['push']({'model':db['User'],'as':_0x9de7('0x58'),'attributes':['id',_0x9de7('0x59')],'raw':!![]});_0x517338[_0x9de7('0x5a')]({'model':db[_0x9de7('0x5b')],'as':'Contact','attributes':['id',_0x9de7('0x5c'),_0x9de7('0x5d')],'raw':!![]});if(_0x1996ef[_0x9de7('0x24')][_0x9de7('0x57')]){_0x517338[_0x9de7('0x5a')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x22c469=[{'model':db[_0x9de7('0x3d')],'as':_0x9de7('0x5e'),'attributes':['id',_0x9de7('0x39'),_0x9de7('0x5f'),'direction',_0x9de7('0x60'),'read'],'include':_0x517338}];_0x22c469[_0x9de7('0x5a')]({'model':db[_0x9de7('0x61')],'as':_0x9de7('0x62'),'attributes':['id','name']});_0x22c469[_0x9de7('0x5a')]({'model':db[_0x9de7('0x58')],'as':_0x9de7('0x63'),'attributes':['id','fullname']});return db[_0x9de7('0x1f')][_0x9de7('0x36')]({'where':{'id':_0x1996ef[_0x9de7('0x29')]['id']},'include':_0x22c469})[_0x9de7('0x1a')](handleEntityNotFound(_0x4ab218,null))['then'](function(_0x943cf9){if(_0x943cf9){var _0x42ca05=_0x943cf9[_0x9de7('0x64')]({'plain':!![]});fs['mkdirSync'](_0x589b91);var _0x2d6901={'channel':_0x9de7('0x65'),'account':_0x42ca05[_0x9de7('0x62')][_0x9de7('0x1c')],'agent':_0x42ca05['Owner']?_0x42ca05[_0x9de7('0x63')][_0x9de7('0x59')]:_0x9de7('0x66'),'createdAt':moment(_0x42ca05[_0x9de7('0x5f')])['format'](_0x9de7('0x48'))[_0x9de7('0x67')](),'closedAt':_0x42ca05[_0x9de7('0x68')]?moment(_0x42ca05[_0x9de7('0x69')])['format'](_0x9de7('0x48'))['toString']():'','disposition':_0x42ca05[_0x9de7('0x6a')],'visibility':_0x42ca05[_0x9de7('0x6b')]?'Public':_0x9de7('0x6c'),'messages':_(_0x42ca05['Messages'])[_0x9de7('0x44')]({'secret':![]})[_0x9de7('0x45')](function(_0x1e7e4b){if(_0x1e7e4b[_0x9de7('0x6d')]){var _0xd7465c=path[_0x9de7('0x53')](_0xb72ae2,_0x1e7e4b[_0x9de7('0x6d')][_0x9de7('0x6e')]);if(fs[_0x9de7('0x6f')](_0xd7465c)){fs[_0x9de7('0x70')](_0xd7465c)[_0x9de7('0x71')](fs[_0x9de7('0x72')](path[_0x9de7('0x53')](_0x589b91,_0x1e7e4b['Attachment'][_0x9de7('0x6e')])));}}return{'date':moment(_0x1e7e4b[_0x9de7('0x5f')])[_0x9de7('0x47')](_0x9de7('0x48'))[_0x9de7('0x67')](),'sender':_0x1e7e4b['direction']===_0x9de7('0x73')?_0x1e7e4b[_0x9de7('0x58')]?_0x1e7e4b[_0x9de7('0x58')]['fullname']:'System':_0x1e7e4b[_0x9de7('0x74')]['firstName']+(_0x1e7e4b['Contact']['lastName']?'\x20'+_0x1e7e4b[_0x9de7('0x74')]['lastName']:''),'body':_0x1e7e4b[_0x9de7('0x6d')]?_0x1e7e4b[_0x9de7('0x6d')]['basename']:_0x1e7e4b[_0x9de7('0x39')],'direction':_0x1e7e4b[_0x9de7('0x75')]===_0x9de7('0x73')?'A':'C','secret':_0x1e7e4b[_0x9de7('0x60')],'read':_0x1e7e4b['read'],'attachment':_0x1e7e4b[_0x9de7('0x6d')]};})['value']()};return ejs['renderFile'](path[_0x9de7('0x53')](config[_0x9de7('0x54')],_0x9de7('0x55'),_0x9de7('0x76'),_0x9de7('0x77')),{'interaction':_0x2d6901})[_0x9de7('0x1a')](function(_0x281641){var _0x531cae=path[_0x9de7('0x53')](_0x589b91,_0x9de7('0x78')+_0x42ca05['id']+'-'+_0x53fb41+'.pdf');var _0x485f81={'path':_0x531cae,'channel':_0x9de7('0x65'),'interactionId':_0x42ca05['id']};return pdf[_0x9de7('0x79')](_0x281641,_0x485f81);})[_0x9de7('0x1a')](function(){return new Promise(function(_0xb764b1,_0x5b2faf){zipdir(_0x589b91,{'saveTo':_0x51609d},function(_0x2fd49c,_0x169022){if(_0x2fd49c)return _0x5b2faf(_0x2fd49c);return _0xb764b1(_0x169022);});})[_0x9de7('0x1a')](function(){return new Promise(function(_0x2d128c,_0x3e4d25){rimraf(_0x589b91,function(_0x5dc5ea){if(_0x5dc5ea)_0x3e4d25(_0x5dc5ea);return _0x2d128c();});});})['then'](function(){return _0x4ab218[_0x9de7('0x52')](_0x51609d,_0x53435f,function(_0x26619e){if(_0x26619e){logger[_0x9de7('0x1b')](_0x9de7('0x7a'),_0x26619e);}else{fs[_0x9de7('0x7b')](_0x51609d);}});});});}else{return _0x4ab218[_0x9de7('0xf')](0xc8);}})[_0x9de7('0x26')](handleError(_0x4ab218,null));}; \ No newline at end of file +var _0xf8dc=['Public','Private','filter','existsSync','createReadStream','pipe','createWriteStream','basename','out','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','query','user','catch','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','length','include','find','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','spread','Tag','removeTags','download','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','toString','disposition','threadId'];(function(_0x44cd28,_0x1502d9){var _0x39356e=function(_0x4dfe82){while(--_0x4dfe82){_0x44cd28['push'](_0x44cd28['shift']());}};_0x39356e(++_0x1502d9);}(_0xf8dc,0x8e));var _0xcf8d=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xf8dc[_0x42f009];return _0x22a1e0;};'use strict';var rimraf=require(_0xcf8d('0x0'));var zipdir=require(_0xcf8d('0x1'));var moment=require('moment');var util=require(_0xcf8d('0x2'));var path=require(_0xcf8d('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf8d('0x4'));var Redis=require(_0xcf8d('0x5'));var interaction=require(_0xcf8d('0x6'));var qs=require(_0xcf8d('0x7'));var pdf=require(_0xcf8d('0x8'));var logger=require('../../config/logger')(_0xcf8d('0x9'));var config=require(_0xcf8d('0xa'));var db=require(_0xcf8d('0xb'))['db'];config['redis']=_[_0xcf8d('0xc')](config[_0xcf8d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf8d('0xe'))(new Redis(config[_0xcf8d('0xd')]));require(_0xcf8d('0xf'))[_0xcf8d('0x10')](socket);function respondWithStatusCode(_0x589593,_0x2f7678){_0x2f7678=_0x2f7678||0xcc;return function(_0x28cff7){if(_0x28cff7){return _0x589593[_0xcf8d('0x11')](_0x2f7678);}return _0x589593[_0xcf8d('0x12')](_0x2f7678)[_0xcf8d('0x13')]();};}function respondWithResult(_0x1f37a3,_0x4512e4){_0x4512e4=_0x4512e4||0xc8;return function(_0x55fe01){if(_0x55fe01){return _0x1f37a3[_0xcf8d('0x12')](_0x4512e4)[_0xcf8d('0x14')](_0x55fe01);}};}function respondWithFilteredResult(_0x27a53b,_0x3ba3bf){return function(_0x3f4b2b){if(_0x3f4b2b){var _0x4d251d=typeof _0x3ba3bf[_0xcf8d('0x15')]===_0xcf8d('0x16')&&typeof _0x3ba3bf[_0xcf8d('0x17')]===_0xcf8d('0x16');var _0x28107b=_0x3f4b2b[_0xcf8d('0x18')];var _0x757aed=_0x4d251d?0x0:_0x3ba3bf[_0xcf8d('0x15')];var _0x54b35e=_0x4d251d?_0x3f4b2b[_0xcf8d('0x18')]:_0x3ba3bf[_0xcf8d('0x15')]+_0x3ba3bf[_0xcf8d('0x17')];var _0x1625b3;if(_0x54b35e>=_0x28107b){_0x54b35e=_0x28107b;_0x1625b3=0xc8;}else{_0x1625b3=0xce;}_0x27a53b['status'](_0x1625b3);return _0x27a53b[_0xcf8d('0x19')](_0xcf8d('0x1a'),_0x757aed+'-'+_0x54b35e+'/'+_0x28107b)[_0xcf8d('0x14')](_0x3f4b2b);}return null;};}function saveUpdates(_0xa1086a){return function(_0x2d776d){if(_0x2d776d){return _0x2d776d[_0xcf8d('0x1b')](_0xa1086a)['then'](function(_0x2c1d83){return _0x2c1d83;});}return null;};}function removeEntity(_0x5dbca7){return function(_0x4941d8){if(_0x4941d8){return _0x4941d8[_0xcf8d('0x1c')]()[_0xcf8d('0x1d')](function(){_0x5dbca7[_0xcf8d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57e6bd){return function(_0x155f27){if(!_0x155f27){_0x57e6bd[_0xcf8d('0x11')](0x194);}return _0x155f27;};}function handleError(_0x41a7a5,_0x2c5b96){_0x2c5b96=_0x2c5b96||0x1f4;return function(_0x403f58){logger[_0xcf8d('0x1e')](_0x403f58[_0xcf8d('0x1f')]);if(_0x403f58['name']){delete _0x403f58[_0xcf8d('0x20')];}_0x41a7a5[_0xcf8d('0x12')](_0x2c5b96)['send'](_0x403f58);};}exports[_0xcf8d('0x21')]=function(_0x3be675,_0x56ac68){var _0x32c5ed={};var _0x168620=_[_0xcf8d('0x22')](db['OpenchannelInteraction'][_0xcf8d('0x23')],function(_0xc8833a){return{'name':_0xc8833a[_0xcf8d('0x24')],'type':_0xc8833a[_0xcf8d('0x25')][_0xcf8d('0x26')]};});_0x32c5ed=qs[_0xcf8d('0x27')](_0x168620,_0x3be675);return interaction['findAll']('openchannel',_0x3be675[_0xcf8d('0x28')],_0x3be675[_0xcf8d('0x29')],_0x32c5ed,_0x168620)[_0xcf8d('0x1d')](respondWithFilteredResult(_0x56ac68,_0x32c5ed))[_0xcf8d('0x2a')](handleError(_0x56ac68,null));};exports['show']=function(_0x14a759,_0x438bf5){var _0x2c95d2={};if(_0x14a759[_0xcf8d('0x28')][_0xcf8d('0x25')]&&_0x14a759['query'][_0xcf8d('0x25')]===_0xcf8d('0x2b')){_0x2c95d2[_0xcf8d('0x2b')]=_0x14a759['params']['id'];}else{_0x2c95d2['id']=_0x14a759[_0xcf8d('0x2c')]['id'];}var _0x9516f3={'raw':![],'where':_0x2c95d2},_0x2326a9={};_0x2326a9[_0xcf8d('0x2d')]=_[_0xcf8d('0x2e')](db[_0xcf8d('0x2f')][_0xcf8d('0x23')]);_0x2326a9[_0xcf8d('0x28')]=_[_0xcf8d('0x2e')](_0x14a759[_0xcf8d('0x28')]);_0x2326a9[_0xcf8d('0x30')]=_[_0xcf8d('0x31')](_0x2326a9['model'],_0x2326a9['query']);_0x9516f3[_0xcf8d('0x32')]=_['intersection'](_0x2326a9[_0xcf8d('0x2d')],qs[_0xcf8d('0x33')](_0x14a759[_0xcf8d('0x28')]['fields']));_0x9516f3[_0xcf8d('0x32')]=_0x9516f3[_0xcf8d('0x32')][_0xcf8d('0x34')]?_0x9516f3[_0xcf8d('0x32')]:_0x2326a9[_0xcf8d('0x2d')];if(_0x14a759[_0xcf8d('0x28')]['includeAll']){_0x9516f3[_0xcf8d('0x35')]=[{'all':!![]}];}_0x9516f3=_['merge']({},_0x9516f3,_0x14a759['options']);return db['OpenchannelInteraction'][_0xcf8d('0x36')](_0x9516f3)[_0xcf8d('0x1d')](handleEntityNotFound(_0x438bf5,null))['then'](respondWithResult(_0x438bf5,null))[_0xcf8d('0x2a')](handleError(_0x438bf5,null));};exports['create']=function(_0x19b440,_0x5de4df){return db[_0xcf8d('0x2f')]['create'](_0x19b440[_0xcf8d('0x37')],{})['then'](respondWithResult(_0x5de4df,0xc9))[_0xcf8d('0x2a')](handleError(_0x5de4df,null));};exports[_0xcf8d('0x1b')]=function(_0x5d637b,_0x1b17e3){if(_0x5d637b[_0xcf8d('0x37')]['id']){delete _0x5d637b['body']['id'];}return db[_0xcf8d('0x2f')][_0xcf8d('0x36')]({'where':{'id':_0x5d637b[_0xcf8d('0x2c')]['id']}})[_0xcf8d('0x1d')](handleEntityNotFound(_0x1b17e3,null))[_0xcf8d('0x1d')](saveUpdates(_0x5d637b[_0xcf8d('0x37')],null))[_0xcf8d('0x1d')](respondWithResult(_0x1b17e3,null))[_0xcf8d('0x2a')](handleError(_0x1b17e3,null));};exports[_0xcf8d('0x1c')]=function(_0x2dae6e,_0x5f0304){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2dae6e[_0xcf8d('0x2c')]['id']}})[_0xcf8d('0x1d')](handleEntityNotFound(_0x5f0304,null))[_0xcf8d('0x1d')](removeEntity(_0x5f0304,null))[_0xcf8d('0x2a')](handleError(_0x5f0304,null));};exports[_0xcf8d('0x38')]=function(_0x220aba,_0xeca66e){return db['OpenchannelInteraction'][_0xcf8d('0x38')]()[_0xcf8d('0x1d')](respondWithResult(_0xeca66e,null))[_0xcf8d('0x2a')](handleError(_0xeca66e,null));};exports[_0xcf8d('0x39')]=function(_0x3091aa,_0x169240){return db[_0xcf8d('0x3a')][_0xcf8d('0x36')]({'where':{'id':_0x3091aa[_0xcf8d('0x2c')]['id']}})[_0xcf8d('0x1d')](handleEntityNotFound(_0x169240,null))[_0xcf8d('0x1d')](function(_0x5070fe){if(_0x5070fe){return _0x5070fe[_0xcf8d('0x39')](_0x3091aa[_0xcf8d('0x37')][_0xcf8d('0x3b')],_[_0xcf8d('0x3c')](_0x3091aa[_0xcf8d('0x37')],[_0xcf8d('0x3b'),'id'])||{});}})[_0xcf8d('0x1d')](respondWithResult(_0x169240,null))[_0xcf8d('0x2a')](handleError(_0x169240,null));};exports[_0xcf8d('0x3d')]=function(_0x3b5bbf,_0x32670b){var _0x9e826f={'raw':![],'where':{}};var _0x5ccca0={};var _0x44c0b0={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xcf8d('0x3e')]({'where':{'id':_0x3b5bbf[_0xcf8d('0x2c')]['id']}})[_0xcf8d('0x1d')](handleEntityNotFound(_0x32670b,null))[_0xcf8d('0x1d')](function(_0x59b1c4){if(_0x59b1c4){_0x5ccca0[_0xcf8d('0x2d')]=_['keys'](db[_0xcf8d('0x3a')][_0xcf8d('0x23')]);_0x5ccca0[_0xcf8d('0x28')]=_[_0xcf8d('0x2e')](_0x3b5bbf['query']);_0x5ccca0[_0xcf8d('0x30')]=_[_0xcf8d('0x31')](_0x5ccca0['model'],_0x5ccca0[_0xcf8d('0x28')]);_0x9e826f['attributes']=_[_0xcf8d('0x31')](_0x5ccca0['model'],qs[_0xcf8d('0x33')](_0x3b5bbf[_0xcf8d('0x28')][_0xcf8d('0x33')]));_0x9e826f['attributes']=_0x9e826f[_0xcf8d('0x32')][_0xcf8d('0x34')]?_0x9e826f[_0xcf8d('0x32')]:_0x5ccca0[_0xcf8d('0x2d')];if(!_0x3b5bbf[_0xcf8d('0x28')][_0xcf8d('0x3f')](_0xcf8d('0x40'))){_0x9e826f[_0xcf8d('0x17')]=qs[_0xcf8d('0x17')](_0x3b5bbf[_0xcf8d('0x28')][_0xcf8d('0x17')]);_0x9e826f[_0xcf8d('0x15')]=qs[_0xcf8d('0x15')](_0x3b5bbf['query'][_0xcf8d('0x15')]);}_0x9e826f[_0xcf8d('0x41')]=qs[_0xcf8d('0x42')](_0x3b5bbf['query'][_0xcf8d('0x42')]);_0x9e826f[_0xcf8d('0x43')]=qs[_0xcf8d('0x30')](_[_0xcf8d('0x44')](_0x3b5bbf[_0xcf8d('0x28')],_0x5ccca0[_0xcf8d('0x30')]));_0x9e826f[_0xcf8d('0x43')][_0xcf8d('0x45')]=_0x59b1c4['id'];if(_0x3b5bbf[_0xcf8d('0x28')]['filter']){_0x9e826f[_0xcf8d('0x43')]=_[_0xcf8d('0x46')](_0x9e826f[_0xcf8d('0x43')],{'$or':_[_0xcf8d('0x22')](_0x9e826f[_0xcf8d('0x32')],function(_0x11dd04){var _0x33d9b0={};_0x33d9b0[_0x11dd04]={'$like':'%'+_0x3b5bbf['query']['filter']+'%'};return _0x33d9b0;})});}if(_0x3b5bbf[_0xcf8d('0x28')][_0xcf8d('0x47')]){var _0x6aad7e=_0x3b5bbf[_0xcf8d('0x28')][_0xcf8d('0x47')]['split'](',');var _0x5eb7b3={};_0x5eb7b3[_0x6aad7e[0x0]]={'$gte':moment(_0x6aad7e[0x1])[_0xcf8d('0x48')](_0xcf8d('0x49'))};_0x9e826f['where']=_[_0xcf8d('0x46')](_0x9e826f['where'],_0x5eb7b3);}_0x9e826f=_['merge']({},_0x9e826f,_0x3b5bbf[_0xcf8d('0x4a')]);return db[_0xcf8d('0x3a')][_0xcf8d('0x18')]({'where':_0x9e826f[_0xcf8d('0x43')]})[_0xcf8d('0x1d')](function(_0x4f15a1){_0x44c0b0[_0xcf8d('0x18')]=_0x4f15a1;if(_0x3b5bbf[_0xcf8d('0x28')]['includeAll']){_0x9e826f['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcf8d('0x4b')](_0x9e826f);})['then'](function(_0x5a7440){_0x44c0b0[_0xcf8d('0x4c')]=_0x5a7440;return _0x44c0b0;});}})[_0xcf8d('0x1d')](respondWithFilteredResult(_0x32670b,_0x9e826f))['catch'](handleError(_0x32670b,null));};exports['addTags']=function(_0x3a8a7e,_0x282f6c){return db['OpenchannelInteraction'][_0xcf8d('0x36')]({'where':{'id':_0x3a8a7e[_0xcf8d('0x2c')]['id']}})[_0xcf8d('0x1d')](handleEntityNotFound(_0x282f6c,null))['then'](function(_0x46df74){if(_0x46df74){return _0x46df74[_0xcf8d('0x4d')](_0x3a8a7e['body'][_0xcf8d('0x3b')],_['omit'](_0x3a8a7e['body'],[_0xcf8d('0x3b'),'id'])||{})[_0xcf8d('0x4e')](function(){return db[_0xcf8d('0x4f')][_0xcf8d('0x4b')]({'attributes':['id',_0xcf8d('0x20'),'color'],'where':{'id':_0x3a8a7e[_0xcf8d('0x37')][_0xcf8d('0x3b')]}});})[_0xcf8d('0x1d')](function(_0x10a5ed){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x3a8a7e[_0xcf8d('0x2c')]['id']),'tags':_0x10a5ed||[]});return{'id':Number(_0x3a8a7e['params']['id']),'tags':_0x10a5ed||[]};});}})[_0xcf8d('0x1d')](respondWithResult(_0x282f6c,null))[_0xcf8d('0x2a')](handleError(_0x282f6c,null));};exports[_0xcf8d('0x50')]=function(_0x397a58,_0x507eb5){return db[_0xcf8d('0x2f')][_0xcf8d('0x36')]({'where':{'id':_0x397a58[_0xcf8d('0x2c')]['id']}})[_0xcf8d('0x1d')](handleEntityNotFound(_0x507eb5,null))[_0xcf8d('0x1d')](function(_0x5e69b9){if(_0x5e69b9){return _0x5e69b9[_0xcf8d('0x50')](_0x397a58[_0xcf8d('0x28')][_0xcf8d('0x3b')]);}})[_0xcf8d('0x1d')](respondWithStatusCode(_0x507eb5,null))[_0xcf8d('0x2a')](handleError(_0x507eb5,null));};exports[_0xcf8d('0x51')]=function(_0x4b2a59,_0x1cd946){var _0x36c886=moment()['unix']()['toString']();var _0x337e97=path['join'](config[_0xcf8d('0x52')],_0xcf8d('0x53'),'files',_0xcf8d('0x54'));var _0x387d74=path[_0xcf8d('0x55')](config[_0xcf8d('0x52')],_0xcf8d('0x53'),_0xcf8d('0x56'),_0xcf8d('0x57'));var _0x104477=path[_0xcf8d('0x55')](_0x337e97,_0x36c886);var _0x489364=util['format'](_0xcf8d('0x58'),_0x4b2a59[_0xcf8d('0x2c')]['id'],_0x36c886);var _0x357e84=path[_0xcf8d('0x55')](_0x337e97,_0x489364);var _0x3fd46f=[];_0x3fd46f[_0xcf8d('0x59')]({'model':db[_0xcf8d('0x5a')],'as':_0xcf8d('0x5a'),'attributes':['id',_0xcf8d('0x5b')],'raw':!![]});_0x3fd46f[_0xcf8d('0x59')]({'model':db[_0xcf8d('0x5c')],'as':'Contact','attributes':['id',_0xcf8d('0x5d'),_0xcf8d('0x5e')],'raw':!![]});if(_0x4b2a59[_0xcf8d('0x28')][_0xcf8d('0x57')]){_0x3fd46f['push']({'model':db[_0xcf8d('0x5f')],'as':_0xcf8d('0x5f'),'raw':!![]});}var _0x10f704=[{'model':db[_0xcf8d('0x3a')],'as':_0xcf8d('0x60'),'attributes':['id',_0xcf8d('0x37'),_0xcf8d('0x61'),_0xcf8d('0x62'),_0xcf8d('0x63'),_0xcf8d('0x64')],'include':_0x3fd46f}];_0x10f704[_0xcf8d('0x59')]({'model':db[_0xcf8d('0x65')],'as':_0xcf8d('0x66'),'attributes':['id',_0xcf8d('0x20')]});_0x10f704[_0xcf8d('0x59')]({'model':db[_0xcf8d('0x5a')],'as':_0xcf8d('0x67'),'attributes':['id','fullname']});return db[_0xcf8d('0x2f')][_0xcf8d('0x36')]({'where':{'id':_0x4b2a59[_0xcf8d('0x2c')]['id']},'include':_0x10f704})[_0xcf8d('0x1d')](handleEntityNotFound(_0x1cd946,null))[_0xcf8d('0x1d')](function(_0x5a82f8){if(_0x5a82f8){var _0x195a3d=_0x5a82f8['get']({'plain':!![]});fs[_0xcf8d('0x68')](_0x104477);var _0x4865ba={'channel':_0xcf8d('0x69'),'account':_0x195a3d[_0xcf8d('0x66')][_0xcf8d('0x20')],'agent':_0x195a3d[_0xcf8d('0x67')]?_0x195a3d[_0xcf8d('0x67')][_0xcf8d('0x5b')]:_0xcf8d('0x6a'),'createdAt':moment(_0x195a3d[_0xcf8d('0x61')])[_0xcf8d('0x48')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x195a3d['closed']?moment(_0x195a3d['closedAt'])[_0xcf8d('0x48')](_0xcf8d('0x49'))[_0xcf8d('0x6b')]():'','disposition':_0x195a3d[_0xcf8d('0x6c')],'visibility':_0x195a3d[_0xcf8d('0x6d')]?_0xcf8d('0x6e'):_0xcf8d('0x6f'),'messages':_(_0x195a3d[_0xcf8d('0x60')])[_0xcf8d('0x70')]({'secret':![]})[_0xcf8d('0x22')](function(_0x2797de){if(_0x2797de[_0xcf8d('0x5f')]){var _0x55ca78=path[_0xcf8d('0x55')](_0x387d74,_0x2797de[_0xcf8d('0x5f')]['basename']);if(fs[_0xcf8d('0x71')](_0x55ca78)){fs[_0xcf8d('0x72')](_0x55ca78)[_0xcf8d('0x73')](fs[_0xcf8d('0x74')](path[_0xcf8d('0x55')](_0x104477,_0x2797de['Attachment'][_0xcf8d('0x75')])));}}return{'date':moment(_0x2797de['createdAt'])[_0xcf8d('0x48')](_0xcf8d('0x49'))[_0xcf8d('0x6b')](),'sender':_0x2797de['direction']===_0xcf8d('0x76')?_0x2797de[_0xcf8d('0x5a')]?_0x2797de[_0xcf8d('0x5a')][_0xcf8d('0x5b')]:'System':_0x2797de[_0xcf8d('0x77')][_0xcf8d('0x5d')]+(_0x2797de['Contact'][_0xcf8d('0x5e')]?'\x20'+_0x2797de['Contact'][_0xcf8d('0x5e')]:''),'body':_0x2797de[_0xcf8d('0x5f')]?_0x2797de[_0xcf8d('0x5f')][_0xcf8d('0x75')]:_0x2797de['body'],'direction':_0x2797de['direction']===_0xcf8d('0x76')?'A':'C','secret':_0x2797de[_0xcf8d('0x63')],'read':_0x2797de['read'],'attachment':_0x2797de['Attachment']};})[_0xcf8d('0x78')]()};return ejs[_0xcf8d('0x79')](path[_0xcf8d('0x55')](config[_0xcf8d('0x52')],_0xcf8d('0x53'),_0xcf8d('0x7a'),_0xcf8d('0x7b')),{'interaction':_0x4865ba})[_0xcf8d('0x1d')](function(_0x8df695){var _0x43757d=path[_0xcf8d('0x55')](_0x104477,_0xcf8d('0x7c')+_0x195a3d['id']+'-'+_0x36c886+'.pdf');var _0x38ff00={'path':_0x43757d,'channel':_0xcf8d('0x69'),'interactionId':_0x195a3d['id']};return pdf['createPdfFromHTML'](_0x8df695,_0x38ff00);})['then'](function(){return new Promise(function(_0x502669,_0x61148d){zipdir(_0x104477,{'saveTo':_0x357e84},function(_0x589615,_0x47de98){if(_0x589615)return _0x61148d(_0x589615);return _0x502669(_0x47de98);});})[_0xcf8d('0x1d')](function(){return new Promise(function(_0x1682f7,_0x2d49b6){rimraf(_0x104477,function(_0x340f78){if(_0x340f78)_0x2d49b6(_0x340f78);return _0x1682f7();});});})[_0xcf8d('0x1d')](function(){return _0x1cd946['download'](_0x357e84,_0x489364,function(_0x2bbeda){if(_0x2bbeda){logger[_0xcf8d('0x1e')](_0xcf8d('0x7d'),_0x2bbeda);}else{fs['unlinkSync'](_0x357e84);}});});});}else{return _0x1cd946['sendStatus'](0xc8);}})[_0xcf8d('0x2a')](handleError(_0x1cd946,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6142221..7c35b5f 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 _0xa047=['then','Users','map','findAll','setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove'];(function(_0x14a3d3,_0x2535ac){var _0x2e193d=function(_0x59eec3){while(--_0x59eec3){_0x14a3d3['push'](_0x14a3d3['shift']());}};_0x2e193d(++_0x2535ac);}(_0xa047,0x16f));var _0x7a04=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0xa047[_0x15fc3c];return _0x94c5c8;};'use strict';var EventEmitter=require(_0x7a04('0x0'));var OpenchannelInteraction=require(_0x7a04('0x1'))['db'][_0x7a04('0x2')];var OpenchannelMessage=require(_0x7a04('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7a04('0x3')](0x0);var events={'afterCreate':_0x7a04('0x4'),'afterUpdate':_0x7a04('0x5'),'afterDestroy':_0x7a04('0x6')};function emitEvent(_0xb713ae){return function(_0x2f1b4a,_0x3478ed,_0x537931){_0x2f1b4a['getUsers']({'attributes':['id'],'raw':!![]})[_0x7a04('0x7')](function(_0x3441c6){_0x2f1b4a['setDataValue'](_0x7a04('0x8'),_0x3441c6[_0x7a04('0x9')](function(_0x1573b7){return{'id':_0x1573b7['id']};}));return OpenchannelMessage[_0x7a04('0xa')]({'where':{'OpenchannelInteractionId':_0x2f1b4a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7a04('0x7')](function(_0x5e46eb){_0x2f1b4a[_0x7a04('0xb')](_0x7a04('0xc'),_0x5e46eb[_0x7a04('0xd')]);OpenchannelInteractionEvents['emit'](_0xb713ae+':'+_0x2f1b4a['id'],_0x2f1b4a);OpenchannelInteractionEvents['emit'](_0xb713ae,_0x2f1b4a);_0x537931(null);})[_0x7a04('0xe')](_0x537931(null));};}for(var e in events){if(events[_0x7a04('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7a04('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x58d7=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','save','getUsers','then','setDataValue','Users'];(function(_0x273b4f,_0x517eb5){var _0x60f096=function(_0x6ad416){while(--_0x6ad416){_0x273b4f['push'](_0x273b4f['shift']());}};_0x60f096(++_0x517eb5);}(_0x58d7,0x1c0));var _0x758d=function(_0x4bfb0f,_0x2cae7f){_0x4bfb0f=_0x4bfb0f-0x0;var _0x257446=_0x58d7[_0x4bfb0f];return _0x257446;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x758d('0x0'))['db'][_0x758d('0x1')];var OpenchannelMessage=require(_0x758d('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x758d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46e7f1){return function(_0x1623b3,_0x632644,_0x4cd882){_0x1623b3[_0x758d('0x3')]({'attributes':['id'],'raw':!![]})[_0x758d('0x4')](function(_0x35046d){_0x1623b3[_0x758d('0x5')](_0x758d('0x6'),_0x35046d['map'](function(_0x5752cc){return{'id':_0x5752cc['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1623b3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3b7ee7){_0x1623b3['setDataValue'](_0x758d('0x7'),_0x3b7ee7['length']);OpenchannelInteractionEvents[_0x758d('0x8')](_0x46e7f1+':'+_0x1623b3['id'],_0x1623b3);OpenchannelInteractionEvents[_0x758d('0x8')](_0x46e7f1,_0x1623b3);_0x4cd882(null);})[_0x758d('0x9')](_0x4cd882(null));};}for(var e in events){if(events[_0x758d('0xa')](e)){var event=events[e];OpenchannelInteraction[_0x758d('0xb')](e,emitEvent(event));}}module[_0x758d('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 184c9c7..2b54715 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 _0xdf76=['exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x250d04,_0x1c461a){var _0x14a00b=function(_0x1674d8){while(--_0x1674d8){_0x250d04['push'](_0x250d04['shift']());}};_0x14a00b(++_0x1c461a);}(_0xdf76,0x1c2));var _0x6df7=function(_0x505f73,_0x1f95d8){_0x505f73=_0x505f73-0x0;var _0x227e7f=_0xdf76[_0x505f73];return _0x227e7f;};'use strict';var _=require(_0x6df7('0x0'));var util=require(_0x6df7('0x1'));var logger=require(_0x6df7('0x2'))(_0x6df7('0x3'));var moment=require(_0x6df7('0x4'));var BPromise=require(_0x6df7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6df7('0x6'));var rimraf=require(_0x6df7('0x7'));var config=require(_0x6df7('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x6df7('0x9')]=function(_0x258c8d,_0x51d10e){return _0x258c8d[_0x6df7('0xa')](_0x6df7('0xb'),attributes,{'tableName':_0x6df7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6df7('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x4556f4,_0xa245c5,_0x1002ef){if(_0x4556f4[_0x6df7('0xe')](_0x6df7('0xf'))){_0x4556f4['closedAt']=moment()['format'](_0x6df7('0x10'));}_0x1002ef(null,_0x4556f4);}}});}; \ No newline at end of file +var _0x0b7a=['moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0b7a,0x141));var _0xa0b7=function(_0x3b722b,_0x5b0200){_0x3b722b=_0x3b722b-0x0;var _0x404341=_0x0b7a[_0x3b722b];return _0x404341;};'use strict';var _=require('lodash');var util=require(_0xa0b7('0x0'));var logger=require(_0xa0b7('0x1'))(_0xa0b7('0x2'));var moment=require(_0xa0b7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0b7('0x4'));var rimraf=require(_0xa0b7('0x5'));var config=require(_0xa0b7('0x6'));var attributes=require(_0xa0b7('0x7'));module[_0xa0b7('0x8')]=function(_0x3e327f,_0x5edd6e){return _0x3e327f[_0xa0b7('0x9')](_0xa0b7('0xa'),attributes,{'tableName':_0xa0b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa0b7('0xc'),'hooks':{'beforeUpdate':function(_0xeaa9d0,_0x485889,_0x182e31){if(_0xeaa9d0[_0xa0b7('0xd')](_0xa0b7('0xe'))){_0xeaa9d0[_0xa0b7('0xf')]=moment()[_0xa0b7('0x10')](_0xa0b7('0x11'));}_0x182e31(null,_0xeaa9d0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2780a6d..6c3fd5c 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 _0xff0e=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','limit','debug','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','register'];(function(_0x1c2310,_0x31d96b){var _0xe4cc6d=function(_0x54ccd4){while(--_0x54ccd4){_0x1c2310['push'](_0x1c2310['shift']());}};_0xe4cc6d(++_0x31d96b);}(_0xff0e,0xc3));var _0xeff0=function(_0x4cd628,_0x5814e0){_0x4cd628=_0x4cd628-0x0;var _0x5a6096=_0xff0e[_0x4cd628];return _0x5a6096;};'use strict';var _=require(_0xeff0('0x0'));var util=require(_0xeff0('0x1'));var moment=require('moment');var BPromise=require(_0xeff0('0x2'));var rs=require(_0xeff0('0x3'));var fs=require('fs');var Redis=require(_0xeff0('0x4'));var db=require(_0xeff0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeff0('0x6'));var config=require(_0xeff0('0x7'));var jayson=require(_0xeff0('0x8'));var client=jayson[_0xeff0('0x9')][_0xeff0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xeff0('0xb')],{'host':_0xeff0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeff0('0xb')]));require(_0xeff0('0xd'))[_0xeff0('0xe')](socket);function respondWithRpcPromise(_0x368dbb,_0x78c41b,_0x430e20){return new BPromise(function(_0x573f0d,_0xc2edce){return client[_0xeff0('0xf')](_0x368dbb,_0x430e20)[_0xeff0('0x10')](function(_0x31d38a){logger[_0xeff0('0x11')](_0xeff0('0x12'),_0x78c41b,_0xeff0('0x13'));logger['debug'](_0xeff0('0x14'),_0x78c41b,'request\x20sent',JSON[_0xeff0('0x15')](_0x31d38a));if(_0x31d38a[_0xeff0('0x16')]){if(_0x31d38a['error'][_0xeff0('0x17')]===0x1f4){logger['error'](_0xeff0('0x12'),_0x78c41b,_0x31d38a[_0xeff0('0x16')][_0xeff0('0x18')]);return _0xc2edce(_0x31d38a[_0xeff0('0x16')][_0xeff0('0x18')]);}logger[_0xeff0('0x16')](_0xeff0('0x12'),_0x78c41b,_0x31d38a[_0xeff0('0x16')]['message']);return _0x573f0d(_0x31d38a[_0xeff0('0x16')][_0xeff0('0x18')]);}else{logger[_0xeff0('0x11')](_0xeff0('0x12'),_0x78c41b,_0xeff0('0x13'));_0x573f0d(_0x31d38a[_0xeff0('0x19')][_0xeff0('0x18')]);}})[_0xeff0('0x1a')](function(_0x234568){logger[_0xeff0('0x16')](_0xeff0('0x12'),_0x78c41b,_0x234568);_0xc2edce(_0x234568);});});}exports[_0xeff0('0x1b')]=function(_0x2e9566){var _0x3df51a=this;return new Promise(function(_0x1b6ee1,_0x1f6eae){return db[_0xeff0('0x1c')][_0xeff0('0x1d')](_0x2e9566['body'],{'raw':_0x2e9566[_0xeff0('0x1e')]?_0x2e9566[_0xeff0('0x1e')][_0xeff0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9566[_0xeff0('0x1e')]?_0x2e9566[_0xeff0('0x1e')][_0xeff0('0x20')]||null:null,'attributes':_0x2e9566['options']?_0x2e9566['options']['attributes']||null:null,'limit':_0x2e9566[_0xeff0('0x1e')]?_0x2e9566['options'][_0xeff0('0x21')]||null:null})[_0xeff0('0x10')](function(_0x5923af){logger[_0xeff0('0x11')](_0xeff0('0x1b'),_0x2e9566);logger[_0xeff0('0x22')](_0xeff0('0x1b'),_0x2e9566,JSON[_0xeff0('0x15')](_0x5923af));_0x1b6ee1(_0x5923af);})['catch'](function(_0x1686fa){logger[_0xeff0('0x16')](_0xeff0('0x1b'),_0x1686fa[_0xeff0('0x18')],_0x2e9566);_0x1f6eae(_0x3df51a[_0xeff0('0x16')](0x1f4,_0x1686fa[_0xeff0('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x592a56){return new Promise(function(_0x1f2ae5,_0x572039){return db[_0xeff0('0x1c')][_0xeff0('0x23')]({'where':_0x592a56[_0xeff0('0x1e')]?_0x592a56[_0xeff0('0x1e')][_0xeff0('0x20')]||null:null})[_0xeff0('0x10')](function(_0xdc604){if(_0xdc604){return _0xdc604[_0xeff0('0x24')](_0x592a56[_0xeff0('0x25')][_0xeff0('0x26')],_[_0xeff0('0x27')](_0x592a56[_0xeff0('0x25')],[_0xeff0('0x26'),'id'])||{});}})[_0xeff0('0x28')](function(_0x4a26bd){logger[_0xeff0('0x11')](_0xeff0('0x29'),_0x592a56);logger[_0xeff0('0x22')](_0xeff0('0x29'),_0x592a56,JSON[_0xeff0('0x15')](_0x4a26bd));_0x1f2ae5(_0x4a26bd);})[_0xeff0('0x1a')](function(_0x1a661a){logger[_0xeff0('0x16')](_0xeff0('0x29'),_0x1a661a[_0xeff0('0x18')],_0x592a56);_0x572039(_this[_0xeff0('0x16')](0x1f4,_0x1a661a[_0xeff0('0x18')]));});});}; \ No newline at end of file +var _0x265a=['../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','./openchannelInteraction.socket','register','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','AddTagsToOpenchannelInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis'];(function(_0x3efe9b,_0x5b41a8){var _0x132073=function(_0x34459e){while(--_0x34459e){_0x3efe9b['push'](_0x3efe9b['shift']());}};_0x132073(++_0x5b41a8);}(_0x265a,0xdf));var _0xa265=function(_0x28c313,_0x597ed4){_0x28c313=_0x28c313-0x0;var _0x58c0ce=_0x265a[_0x28c313];return _0x58c0ce;};'use strict';var _=require(_0xa265('0x0'));var util=require(_0xa265('0x1'));var moment=require(_0xa265('0x2'));var BPromise=require('bluebird');var rs=require(_0xa265('0x3'));var fs=require('fs');var Redis=require(_0xa265('0x4'));var db=require(_0xa265('0x5'))['db'];var utils=require(_0xa265('0x6'));var logger=require(_0xa265('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xa265('0x8')]=_[_0xa265('0x9')](config['redis'],{'host':_0xa265('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa265('0x8')]));require(_0xa265('0xb'))[_0xa265('0xc')](socket);function respondWithRpcPromise(_0x331b1f,_0xb03608,_0x19170c){return new BPromise(function(_0x57f278,_0x5e2ed6){return client['request'](_0x331b1f,_0x19170c)[_0xa265('0xd')](function(_0x4ee281){logger[_0xa265('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb03608,_0xa265('0xf'));logger[_0xa265('0x10')](_0xa265('0x11'),_0xb03608,_0xa265('0xf'),JSON[_0xa265('0x12')](_0x4ee281));if(_0x4ee281[_0xa265('0x13')]){if(_0x4ee281[_0xa265('0x13')][_0xa265('0x14')]===0x1f4){logger[_0xa265('0x13')](_0xa265('0x15'),_0xb03608,_0x4ee281['error']['message']);return _0x5e2ed6(_0x4ee281[_0xa265('0x13')][_0xa265('0x16')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xb03608,_0x4ee281[_0xa265('0x13')][_0xa265('0x16')]);return _0x57f278(_0x4ee281[_0xa265('0x13')]['message']);}else{logger[_0xa265('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb03608,_0xa265('0xf'));_0x57f278(_0x4ee281['result'][_0xa265('0x16')]);}})[_0xa265('0x17')](function(_0x146ed3){logger[_0xa265('0x13')](_0xa265('0x15'),_0xb03608,_0x146ed3);_0x5e2ed6(_0x146ed3);});});}exports[_0xa265('0x18')]=function(_0x2008e9){var _0xae4b60=this;return new Promise(function(_0x47d5fc,_0x543ab5){return db[_0xa265('0x19')][_0xa265('0x1a')](_0x2008e9[_0xa265('0x1b')],{'raw':_0x2008e9[_0xa265('0x1c')]?_0x2008e9[_0xa265('0x1c')][_0xa265('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2008e9['options']?_0x2008e9['options']['where']||null:null,'attributes':_0x2008e9['options']?_0x2008e9[_0xa265('0x1c')]['attributes']||null:null,'limit':_0x2008e9['options']?_0x2008e9[_0xa265('0x1c')][_0xa265('0x1e')]||null:null})[_0xa265('0xd')](function(_0x5615bf){logger[_0xa265('0xe')](_0xa265('0x18'),_0x2008e9);logger[_0xa265('0x10')]('UpdateOpenchannelInteraction',_0x2008e9,JSON[_0xa265('0x12')](_0x5615bf));_0x47d5fc(_0x5615bf);})[_0xa265('0x17')](function(_0x40a7a7){logger[_0xa265('0x13')](_0xa265('0x18'),_0x40a7a7[_0xa265('0x16')],_0x2008e9);_0x543ab5(_0xae4b60[_0xa265('0x13')](0x1f4,_0x40a7a7[_0xa265('0x16')]));});});};exports[_0xa265('0x1f')]=function(_0x467de3){return new Promise(function(_0x31a020,_0xf42dbc){return db['OpenchannelInteraction']['find']({'where':_0x467de3[_0xa265('0x1c')]?_0x467de3[_0xa265('0x1c')][_0xa265('0x20')]||null:null})[_0xa265('0xd')](function(_0x1e3a24){if(_0x1e3a24){return _0x1e3a24[_0xa265('0x21')](_0x467de3[_0xa265('0x1b')][_0xa265('0x22')],_[_0xa265('0x23')](_0x467de3[_0xa265('0x1b')],[_0xa265('0x22'),'id'])||{});}})[_0xa265('0x24')](function(_0x408039){logger[_0xa265('0xe')](_0xa265('0x25'),_0x467de3);logger[_0xa265('0x10')]('AddTags',_0x467de3,JSON[_0xa265('0x12')](_0x408039));_0x31a020(_0x408039);})['catch'](function(_0x4efb14){logger['error']('AddTags',_0x4efb14['message'],_0x467de3);_0xf42dbc(_this[_0xa265('0x13')](0x1f4,_0x4efb14['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f084f02..bd078a2 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 _0x303d=['update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x35b806,_0x5324d2){var _0x2b04ed=function(_0x3d29f3){while(--_0x3d29f3){_0x35b806['push'](_0x35b806['shift']());}};_0x2b04ed(++_0x5324d2);}(_0x303d,0x6d));var _0xd303=function(_0xb5179e,_0x67e31d){_0xb5179e=_0xb5179e-0x0;var _0x423511=_0x303d[_0xb5179e];return _0x423511;};'use strict';var OpenchannelInteractionEvents=require(_0xd303('0x0'));var events=[_0xd303('0x1'),_0xd303('0x2'),_0xd303('0x3')];function createListener(_0x385b7b,_0x2637f8){return function(_0x116cbc){_0x2637f8[_0xd303('0x4')](_0x385b7b,_0x116cbc);};}function removeListener(_0x331836,_0x4d99de){return function(){OpenchannelInteractionEvents['removeListener'](_0x331836,_0x4d99de);};}exports[_0xd303('0x5')]=function(_0x2b83f8){for(var _0x3fc648=0x0,_0x4baace=events[_0xd303('0x6')];_0x3fc648<_0x4baace;_0x3fc648++){var _0x155a3c=events[_0x3fc648];var _0x3a846c=createListener(_0xd303('0x7')+_0x155a3c,_0x2b83f8);OpenchannelInteractionEvents['on'](_0x155a3c,_0x3a846c);}}; \ No newline at end of file +var _0x6063=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','emit'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x6063,0x1c3));var _0x3606=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6063[_0x42cae2];return _0x5f256f;};'use strict';var OpenchannelInteractionEvents=require(_0x3606('0x0'));var events=[_0x3606('0x1'),'remove',_0x3606('0x2')];function createListener(_0x8ba037,_0x344271){return function(_0x4c56c5){_0x344271[_0x3606('0x3')](_0x8ba037,_0x4c56c5);};}function removeListener(_0x15ce84,_0x577d7b){return function(){OpenchannelInteractionEvents['removeListener'](_0x15ce84,_0x577d7b);};}exports[_0x3606('0x4')]=function(_0x3b9e70){for(var _0x2abe46=0x0,_0x19031e=events[_0x3606('0x5')];_0x2abe46<_0x19031e;_0x2abe46++){var _0x42ca92=events[_0x2abe46];var _0x59c395=createListener(_0x3606('0x6')+_0x42ca92,_0x3b9e70);OpenchannelInteractionEvents['on'](_0x42ca92,_0x59c395);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 09d3c7d..0cc2e7c 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x10bdcd,_0x3f934e){var _0xd5f1b9=function(_0x153470){while(--_0x153470){_0x10bdcd['push'](_0x10bdcd['shift']());}};_0xd5f1b9(++_0x3f934e);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cca39,_0x13a213){_0x1cca39=_0x1cca39-0x0;var _0x40cdbd=_0xedd9[_0x1cca39];return _0x40cdbd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x1f7678,_0x145ee1){var _0x1608b3=function(_0x332d44){while(--_0x332d44){_0x1f7678['push'](_0x1f7678['shift']());}};_0x1608b3(++_0x145ee1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b81931a..642f1f6 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 _0x8f4c=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3cc411,_0x53a261){var _0x27bd2e=function(_0x2fd260){while(--_0x2fd260){_0x3cc411['push'](_0x3cc411['shift']());}};_0x27bd2e(++_0x53a261);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3fcca7,_0x27dfb1){_0x3fcca7=_0x3fcca7-0x0;var _0x489ed4=_0x8f4c[_0x3fcca7];return _0x489ed4;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'body':{'type':Sequelize[_0xc8f4('0x2')](_0xc8f4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8f4('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc8f4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc8f4('0x5')),'defaultValue':_0xc8f4('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc8f4('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc8f4('0x2')]}}; \ No newline at end of file +var _0xfcbb=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x2de448,_0x136290){var _0x224ea6=function(_0x4b98e1){while(--_0x4b98e1){_0x2de448['push'](_0x2de448['shift']());}};_0x224ea6(++_0x136290);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x33fa87,_0x3fb064){_0x33fa87=_0x33fa87-0x0;var _0x135451=_0xfcbb[_0x33fa87];return _0x135451;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'body':{'type':Sequelize[_0xbfcb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfcb('0x4')]('in',_0xbfcb('0x5')),'defaultValue':_0xbfcb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfcb('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index eb8b37d..0764f46 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 _0x65f8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','OpenchannelMessage','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','OpenchannelInteractionId','isNil','read1stAt','format','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','contact','interface','eml-format','rimraf'];(function(_0x6c8950,_0x377977){var _0x495fd3=function(_0x307875){while(--_0x307875){_0x6c8950['push'](_0x6c8950['shift']());}};_0x495fd3(++_0x377977);}(_0x65f8,0x104));var _0x865f=function(_0x5908b8,_0x544699){_0x5908b8=_0x5908b8-0x0;var _0xe24a76=_0x65f8[_0x5908b8];return _0xe24a76;};'use strict';var emlformat=require(_0x865f('0x0'));var rimraf=require(_0x865f('0x1'));var zipdir=require(_0x865f('0x2'));var jsonpatch=require(_0x865f('0x3'));var rp=require(_0x865f('0x4'));var moment=require(_0x865f('0x5'));var BPromise=require(_0x865f('0x6'));var Mustache=require(_0x865f('0x7'));var util=require(_0x865f('0x8'));var path=require(_0x865f('0x9'));var sox=require(_0x865f('0xa'));var csv=require(_0x865f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x865f('0xc'));var _=require('lodash');var squel=require(_0x865f('0xd'));var crypto=require(_0x865f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x865f('0xb'));var querystring=require(_0x865f('0xf'));var Papa=require('papaparse');var Redis=require(_0x865f('0x10'));var authService=require(_0x865f('0x11'));var qs=require(_0x865f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x865f('0x13'))(_0x865f('0x14'));var utils=require(_0x865f('0x15'));var config=require(_0x865f('0x16'));var licenseUtil=require(_0x865f('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x865f('0x18')](config[_0x865f('0x19')],{'host':_0x865f('0x1a'),'port':0x18eb});var socket=require(_0x865f('0x1b'))(new Redis(config[_0x865f('0x19')]));require(_0x865f('0x1c'))[_0x865f('0x1d')](socket);var jayson=require(_0x865f('0x1e'));var client=jayson[_0x865f('0x1f')][_0x865f('0x20')]({'port':0x232c});var client9002=jayson[_0x865f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b81aa,_0x4c9cc1,_0x384096,_0x3e559b){return new BPromise(function(_0x13c144,_0x168206){var _0x556e19=_0x3e559b||client;return _0x556e19['request'](_0x1b81aa,_0x384096)[_0x865f('0x21')](function(_0x11bbd6){logger[_0x865f('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c9cc1,_0x865f('0x23'));logger[_0x865f('0x24')](_0x865f('0x25'),_0x4c9cc1,_0x865f('0x23'),JSON[_0x865f('0x26')](_0x11bbd6));if(_0x11bbd6[_0x865f('0x27')]){if(_0x11bbd6[_0x865f('0x27')]['code']===0x1f4){logger['error'](_0x865f('0x28'),_0x4c9cc1,_0x11bbd6[_0x865f('0x27')][_0x865f('0x29')]);return _0x168206(_0x11bbd6[_0x865f('0x27')][_0x865f('0x29')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4c9cc1,_0x11bbd6[_0x865f('0x27')][_0x865f('0x29')]);return _0x13c144(_0x11bbd6['error'][_0x865f('0x29')]);}else{logger[_0x865f('0x22')](_0x865f('0x28'),_0x4c9cc1,'request\x20sent');_0x13c144(_0x11bbd6['result'][_0x865f('0x29')]);}})[_0x865f('0x2a')](function(_0x17ff95){logger[_0x865f('0x27')](_0x865f('0x28'),_0x4c9cc1,_0x17ff95);_0x168206(_0x17ff95);});});}function respondWithStatusCode(_0x17f60d,_0x43b6c1){_0x43b6c1=_0x43b6c1||0xcc;return function(_0x59ab6b){if(_0x59ab6b){return _0x17f60d[_0x865f('0x2b')](_0x43b6c1);}return _0x17f60d['status'](_0x43b6c1)[_0x865f('0x2c')]();};}function respondWithResult(_0x14abcc,_0x28839b){_0x28839b=_0x28839b||0xc8;return function(_0x1553d1){if(_0x1553d1){return _0x14abcc[_0x865f('0x2d')](_0x28839b)[_0x865f('0x2e')](_0x1553d1);}};}function respondWithFilteredResult(_0xc9af37,_0x57ef79){return function(_0x23b564){if(_0x23b564){var _0x1b2f53=typeof _0x57ef79[_0x865f('0x2f')]===_0x865f('0x30')&&typeof _0x57ef79[_0x865f('0x31')]==='undefined';var _0x349571=_0x23b564[_0x865f('0x32')];var _0x5ee008=_0x1b2f53?0x0:_0x57ef79['offset'];var _0x347ba1=_0x1b2f53?_0x23b564[_0x865f('0x32')]:_0x57ef79['offset']+_0x57ef79[_0x865f('0x31')];var _0x3feb00;if(_0x347ba1>=_0x349571){_0x347ba1=_0x349571;_0x3feb00=0xc8;}else{_0x3feb00=0xce;}_0xc9af37[_0x865f('0x2d')](_0x3feb00);return _0xc9af37[_0x865f('0x33')](_0x865f('0x34'),_0x5ee008+'-'+_0x347ba1+'/'+_0x349571)[_0x865f('0x2e')](_0x23b564);}return null;};}function patchUpdates(_0x16cf7c){return function(_0x3cb7ef){try{jsonpatch[_0x865f('0x35')](_0x3cb7ef,_0x16cf7c,!![]);}catch(_0x2192c3){return BPromise[_0x865f('0x36')](_0x2192c3);}return _0x3cb7ef[_0x865f('0x37')]();};}function saveUpdates(_0xbb0ecd,_0x28e1ec){return function(_0x2a35e9){if(_0x2a35e9){return _0x2a35e9[_0x865f('0x38')](_0xbb0ecd)['then'](function(_0x480af8){return _0x480af8;});}return null;};}function removeEntity(_0x5eae47,_0x2a5e2b){return function(_0x145444){if(_0x145444){return _0x145444[_0x865f('0x39')]()[_0x865f('0x21')](function(){_0x5eae47[_0x865f('0x2d')](0xcc)[_0x865f('0x2c')]();});}};}function handleEntityNotFound(_0x1a7fd5,_0xd1b59b){return function(_0x34f05f){if(!_0x34f05f){_0x1a7fd5[_0x865f('0x2b')](0x194);}return _0x34f05f;};}function handleError(_0x4f9128,_0x35e6fd){_0x35e6fd=_0x35e6fd||0x1f4;return function(_0x5a43ba){logger[_0x865f('0x27')](_0x5a43ba['stack']);if(_0x5a43ba['name']){delete _0x5a43ba[_0x865f('0x3a')];}_0x4f9128[_0x865f('0x2d')](_0x35e6fd)[_0x865f('0x3b')](_0x5a43ba);};}exports[_0x865f('0x3c')]=function(_0x276912,_0x2bded0){var _0x36bacb={},_0x360ded={},_0x2f4c4e={'count':0x0,'rows':[]};var _0xb7c16d=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x23e241){return{'name':_0x23e241[_0x865f('0x3d')],'type':_0x23e241[_0x865f('0x3e')][_0x865f('0x3f')]};});_0x360ded[_0x865f('0x40')]=_[_0x865f('0x41')](_0xb7c16d,'name');_0x360ded['query']=_[_0x865f('0x42')](_0x276912[_0x865f('0x43')]);_0x360ded[_0x865f('0x44')]=_[_0x865f('0x45')](_0x360ded[_0x865f('0x40')],_0x360ded['query']);_0x36bacb[_0x865f('0x46')]=_['intersection'](_0x360ded[_0x865f('0x40')],qs[_0x865f('0x47')](_0x276912[_0x865f('0x43')][_0x865f('0x47')]));_0x36bacb[_0x865f('0x46')]=_0x36bacb['attributes']['length']?_0x36bacb[_0x865f('0x46')]:_0x360ded[_0x865f('0x40')];if(!_0x276912[_0x865f('0x43')][_0x865f('0x48')](_0x865f('0x49'))){_0x36bacb[_0x865f('0x31')]=qs['limit'](_0x276912[_0x865f('0x43')]['limit']);_0x36bacb[_0x865f('0x2f')]=qs[_0x865f('0x2f')](_0x276912[_0x865f('0x43')][_0x865f('0x2f')]);}_0x36bacb[_0x865f('0x4a')]=qs[_0x865f('0x4b')](_0x276912[_0x865f('0x43')]['sort']);_0x36bacb[_0x865f('0x4c')]=qs[_0x865f('0x44')](_['pick'](_0x276912[_0x865f('0x43')],_0x360ded[_0x865f('0x44')]),_0xb7c16d);if(_0x276912[_0x865f('0x43')]['filter']){_0x36bacb[_0x865f('0x4c')]=_[_0x865f('0x4d')](_0x36bacb[_0x865f('0x4c')],{'$or':_[_0x865f('0x41')](_0xb7c16d,function(_0x1d77b9){if(_0x1d77b9['type']!==_0x865f('0x4e')){var _0x10bae6={};_0x10bae6[_0x1d77b9['name']]={'$like':'%'+_0x276912[_0x865f('0x43')][_0x865f('0x4f')]+'%'};return _0x10bae6;}})});}_0x36bacb=_[_0x865f('0x4d')]({},_0x36bacb,_0x276912[_0x865f('0x50')]);var _0x48064d={'where':_0x36bacb[_0x865f('0x4c')]};return db[_0x865f('0x51')][_0x865f('0x32')](_0x48064d)[_0x865f('0x21')](function(_0x958267){_0x2f4c4e[_0x865f('0x32')]=_0x958267;if(_0x276912[_0x865f('0x43')][_0x865f('0x52')]){_0x36bacb[_0x865f('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x865f('0x54')](_0x36bacb);})['then'](function(_0xc11e73){_0x2f4c4e['rows']=_0xc11e73;return _0x2f4c4e;})[_0x865f('0x21')](respondWithFilteredResult(_0x2bded0,_0x36bacb))[_0x865f('0x2a')](handleError(_0x2bded0,null));};exports[_0x865f('0x55')]=function(_0x4878f7,_0x29abf6){var _0x3e5a9d={'raw':!![],'where':{'id':_0x4878f7[_0x865f('0x56')]['id']}},_0x1dc8de={};_0x1dc8de[_0x865f('0x40')]=_[_0x865f('0x42')](db[_0x865f('0x51')][_0x865f('0x57')]);_0x1dc8de[_0x865f('0x43')]=_['keys'](_0x4878f7[_0x865f('0x43')]);_0x1dc8de[_0x865f('0x44')]=_[_0x865f('0x45')](_0x1dc8de[_0x865f('0x40')],_0x1dc8de[_0x865f('0x43')]);_0x3e5a9d[_0x865f('0x46')]=_[_0x865f('0x45')](_0x1dc8de['model'],qs['fields'](_0x4878f7['query']['fields']));_0x3e5a9d[_0x865f('0x46')]=_0x3e5a9d['attributes']['length']?_0x3e5a9d[_0x865f('0x46')]:_0x1dc8de[_0x865f('0x40')];if(_0x4878f7[_0x865f('0x43')][_0x865f('0x52')]){_0x3e5a9d[_0x865f('0x53')]=[{'all':!![]}];}_0x3e5a9d=_[_0x865f('0x4d')]({},_0x3e5a9d,_0x4878f7[_0x865f('0x50')]);return db[_0x865f('0x51')][_0x865f('0x58')](_0x3e5a9d)['then'](handleEntityNotFound(_0x29abf6,null))[_0x865f('0x21')](respondWithResult(_0x29abf6,null))[_0x865f('0x2a')](handleError(_0x29abf6,null));};exports[_0x865f('0x59')]=function(_0x14bc44,_0x1757a9){return db[_0x865f('0x51')][_0x865f('0x59')](_0x14bc44[_0x865f('0x5a')],{})[_0x865f('0x21')](respondWithResult(_0x1757a9,0xc9))[_0x865f('0x2a')](handleError(_0x1757a9,null));};exports[_0x865f('0x38')]=function(_0x5941ab,_0xeb9963){if(_0x5941ab[_0x865f('0x5a')]['id']){delete _0x5941ab[_0x865f('0x5a')]['id'];}return db[_0x865f('0x51')][_0x865f('0x58')]({'where':{'id':_0x5941ab[_0x865f('0x56')]['id']}})['then'](handleEntityNotFound(_0xeb9963,null))[_0x865f('0x21')](saveUpdates(_0x5941ab[_0x865f('0x5a')],null))[_0x865f('0x21')](respondWithResult(_0xeb9963,null))[_0x865f('0x2a')](handleError(_0xeb9963,null));};exports[_0x865f('0x39')]=function(_0x2823e8,_0x528042){return db[_0x865f('0x51')]['find']({'where':{'id':_0x2823e8[_0x865f('0x56')]['id']}})['then'](handleEntityNotFound(_0x528042,null))[_0x865f('0x21')](removeEntity(_0x528042,null))[_0x865f('0x2a')](handleError(_0x528042,null));};exports['describe']=function(_0x5171bb,_0x333ea4){return db[_0x865f('0x51')][_0x865f('0x5b')]()['then'](respondWithResult(_0x333ea4,null))['catch'](handleError(_0x333ea4,null));};var interaction_log=require(_0x865f('0x13'))(_0x865f('0x5c'));exports[_0x865f('0x5d')]=function(_0x290de2,_0x4b25f6,_0x27749f){var _0x50b2a3={'agent':{},'channel':_0x865f('0x5e')};if(_0x290de2['body']['id']){delete _0x290de2[_0x865f('0x5a')]['id'];}_0x290de2[_0x865f('0x5a')]['read']=!![];_0x290de2['body'][_0x865f('0x5f')]=moment()['format'](_0x865f('0x60'));_0x290de2[_0x865f('0x5a')]['UserId']=_0x290de2[_0x865f('0x5a')]['UserId']||_0x290de2[_0x865f('0x61')]['id'];_0x50b2a3[_0x865f('0x62')]['id']=_0x290de2['body'][_0x865f('0x63')];return db['OpenchannelMessage']['find']({'where':{'id':_0x290de2[_0x865f('0x56')]['id'],'UserId':null}})[_0x865f('0x21')](handleEntityNotFound(_0x4b25f6,null))[_0x865f('0x21')](saveUpdates(_0x290de2[_0x865f('0x5a')],null))[_0x865f('0x21')](function(_0x45454e){if(_0x45454e){_0x50b2a3[_0x865f('0x29')]=_0x45454e['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x45454e[_0x865f('0x64')]}});}return null;})[_0x865f('0x21')](handleEntityNotFound(_0x4b25f6,null))[_0x865f('0x21')](function(_0x4a25e5){if(_0x4a25e5){return _0x4a25e5[_0x865f('0x38')]({'UserId':_0x290de2[_0x865f('0x5a')]['UserId'],'read1stAt':_[_0x865f('0x65')](_0x4a25e5[_0x865f('0x66')])?moment()[_0x865f('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x865f('0x21')](function(_0x2a898a){if(_0x2a898a){_0x50b2a3[_0x865f('0x68')]=_0x2a898a[_0x865f('0x69')]({'plain':!![]});interaction_log['info'](_0x865f('0x6a'),_0x290de2[_0x865f('0x61')]['id'],_0x290de2[_0x865f('0x61')][_0x865f('0x3a')],_0x290de2[_0x865f('0x61')]['role'],_0x50b2a3[_0x865f('0x68')]['id'],_0x290de2['body']?JSON[_0x865f('0x26')](_0x290de2['body']):_0x865f('0x6b'));return respondWithRpcPromise(_0x865f('0x6c'),'acceptMessage',_0x50b2a3);}return null;})[_0x865f('0x21')](function(_0x18a65a){var _0x535821=_0x865f('0x6d')+_0x18a65a['message']['ContactId'];return db[_0x865f('0x6e')]['query'](_0x535821,{'type':db[_0x865f('0x6f')]['QueryTypes'][_0x865f('0x70')],'raw':!![]})[_0x865f('0x21')](function(_0x552592){return _0x552592;});})[_0x865f('0x21')](function(_0x24722a){if(_0x24722a){_0x50b2a3[_0x865f('0x29')]['contact']=_0x24722a[0x0];if(!_0x290de2['body'][_0x865f('0x63')])return;return db[_0x865f('0x71')][_0x865f('0x58')]({'where':{'id':_0x290de2[_0x865f('0x5a')][_0x865f('0x63')],'role':_0x865f('0x62')},'attributes':['id',_0x865f('0x3a'),_0x865f('0x72'),_0x865f('0x73'),_0x865f('0x74')],'raw':!![]});}return null;})[_0x865f('0x21')](function(_0x3ffefa){if(!_0x3ffefa)return null;_0x50b2a3[_0x865f('0x29')]['agent']=_0x3ffefa;return _0x50b2a3;})[_0x865f('0x21')](function(_0xb70c31){if(_0xb70c31){if(_0x290de2[_0x865f('0x5a')][_0x865f('0x75')]){_0x50b2a3[_0x865f('0x29')]['interface']=util['format'](_0x865f('0x76'),_0x290de2[_0x865f('0x61')]['name']);_0x50b2a3[_0x865f('0x29')]['channel']=_0x50b2a3[_0x865f('0x77')];_0x50b2a3['message'][_0x865f('0x78')]=_0x50b2a3[_0x865f('0x77')];_0x50b2a3[_0x865f('0x29')][_0x865f('0x79')]='accept';return respondWithRpcPromise('EventManager',_0x865f('0x7a'),{'event':_0x865f('0x7b'),'message':_0x50b2a3[_0x865f('0x29')]},client9002)[_0x865f('0x21')](function(){return _0x50b2a3;});}return _0x50b2a3;}return null;})[_0x865f('0x21')](respondWithResult(_0x4b25f6,null))[_0x865f('0x2a')](handleError(_0x4b25f6,null));};var interaction_log=require(_0x865f('0x13'))(_0x865f('0x5c'));exports['reject']=function(_0x495f7e,_0x809e7e,_0x384a42){var _0x4b8929={'agent':{},'channel':_0x865f('0x5e')};if(_0x495f7e[_0x865f('0x5a')]['id']){delete _0x495f7e[_0x865f('0x5a')]['id'];}_0x495f7e[_0x865f('0x5a')][_0x865f('0x63')]=_0x495f7e[_0x865f('0x5a')][_0x865f('0x63')]||_0x495f7e['user']['id'];_0x4b8929[_0x865f('0x62')]['id']=_0x495f7e[_0x865f('0x5a')][_0x865f('0x63')];return db['OpenchannelMessage'][_0x865f('0x58')]({'where':{'id':_0x495f7e['params']['id'],'UserId':null}})[_0x865f('0x21')](handleEntityNotFound(_0x809e7e,null))['then'](function(_0x117432){if(_0x117432){_0x4b8929[_0x865f('0x29')]=_0x117432['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x865f('0x58')]({'where':{'id':_0x117432[_0x865f('0x64')]}});}return null;})[_0x865f('0x21')](handleEntityNotFound(_0x809e7e,null))['then'](function(_0x27b28b){if(_0x27b28b){_0x4b8929[_0x865f('0x68')]=_0x27b28b['get']({'plain':!![]});interaction_log['info'](_0x865f('0x7c'),_0x495f7e[_0x865f('0x61')]['id'],_0x495f7e['user']['name'],_0x495f7e['user']['role'],_0x4b8929['interaction']['id'],_0x495f7e[_0x865f('0x5a')]?JSON[_0x865f('0x26')](_0x495f7e[_0x865f('0x5a')]):_0x865f('0x6b'));return respondWithRpcPromise(_0x865f('0x7d'),_0x865f('0x7e'),_0x4b8929);}return null;})[_0x865f('0x21')](function(_0x4de162){var _0x327c93=_0x865f('0x6d')+_0x4de162['message'][_0x865f('0x7f')];return db[_0x865f('0x6e')][_0x865f('0x43')](_0x327c93,{'type':db['Sequelize'][_0x865f('0x80')][_0x865f('0x70')],'raw':!![]})['then'](function(_0x47addf){return _0x47addf;});})[_0x865f('0x21')](function(_0x3b1bfe){if(_0x3b1bfe){_0x4b8929[_0x865f('0x29')][_0x865f('0x81')]=_0x3b1bfe[0x0];if(!_0x495f7e[_0x865f('0x5a')][_0x865f('0x63')])return;return db[_0x865f('0x71')][_0x865f('0x58')]({'where':{'id':_0x495f7e[_0x865f('0x5a')][_0x865f('0x63')],'role':_0x865f('0x62')},'attributes':['id',_0x865f('0x3a'),'fullname',_0x865f('0x73'),_0x865f('0x74')],'raw':!![]});}return null;})[_0x865f('0x21')](function(_0x231475){if(!_0x231475)return null;_0x4b8929[_0x865f('0x29')]['agent']=_0x231475;return _0x4b8929;})[_0x865f('0x21')](function(_0x472930){if(_0x472930){_0x472930[_0x865f('0x29')][_0x865f('0x82')]=util[_0x865f('0x67')]('SIP/%s',_0x495f7e[_0x865f('0x61')][_0x865f('0x3a')]);_0x472930[_0x865f('0x29')]['channel']=_0x4b8929['channel'];_0x472930['message'][_0x865f('0x78')]=_0x4b8929[_0x865f('0x77')];_0x472930['message'][_0x865f('0x79')]=_0x865f('0x36');respondWithRpcPromise(_0x865f('0x7a'),'EventManager',{'event':'rejectmessage','message':_0x472930[_0x865f('0x29')]},client9002);return _0x4b8929;}return null;})[_0x865f('0x21')](respondWithResult(_0x809e7e,null))[_0x865f('0x2a')](handleError(_0x809e7e,null));}; \ No newline at end of file +var _0x5031=['keys','length','find','create','body','params','describe','openchannel-interactions','openchannel','read','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','ContactId','Sequelize','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x5031,0x144));var _0x1503=function(_0x5d9454,_0x519530){_0x5d9454=_0x5d9454-0x0;var _0x9618c9=_0x5031[_0x5d9454];return _0x9618c9;};'use strict';var emlformat=require(_0x1503('0x0'));var rimraf=require(_0x1503('0x1'));var zipdir=require(_0x1503('0x2'));var jsonpatch=require(_0x1503('0x3'));var rp=require(_0x1503('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1503('0x5'));var util=require(_0x1503('0x6'));var path=require(_0x1503('0x7'));var sox=require(_0x1503('0x8'));var csv=require(_0x1503('0x9'));var ejs=require(_0x1503('0xa'));var fs=require('fs');var fs_extra=require(_0x1503('0xb'));var _=require(_0x1503('0xc'));var squel=require(_0x1503('0xd'));var crypto=require('crypto');var jsforce=require(_0x1503('0xe'));var deskjs=require(_0x1503('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1503('0x10'));var Papa=require(_0x1503('0x11'));var Redis=require(_0x1503('0x12'));var authService=require(_0x1503('0x13'));var qs=require(_0x1503('0x14'));var as=require(_0x1503('0x15'));var hardwareService=require(_0x1503('0x16'));var logger=require(_0x1503('0x17'))(_0x1503('0x18'));var utils=require(_0x1503('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1503('0x1a'));var db=require(_0x1503('0x1b'))['db'];config[_0x1503('0x1c')]=_[_0x1503('0x1d')](config[_0x1503('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1503('0x1e'))(new Redis(config[_0x1503('0x1c')]));require(_0x1503('0x1f'))[_0x1503('0x20')](socket);var jayson=require(_0x1503('0x21'));var client=jayson[_0x1503('0x22')][_0x1503('0x23')]({'port':0x232c});var client9002=jayson[_0x1503('0x22')][_0x1503('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1e35b2,_0x38868d,_0x3c6935,_0x2a3c8b){return new BPromise(function(_0x33dae9,_0x350563){var _0x15bcf0=_0x2a3c8b||client;return _0x15bcf0[_0x1503('0x24')](_0x1e35b2,_0x3c6935)[_0x1503('0x25')](function(_0x401b1b){logger['info'](_0x1503('0x26'),_0x38868d,_0x1503('0x27'));logger[_0x1503('0x28')](_0x1503('0x29'),_0x38868d,_0x1503('0x27'),JSON['stringify'](_0x401b1b));if(_0x401b1b['error']){if(_0x401b1b['error']['code']===0x1f4){logger[_0x1503('0x2a')](_0x1503('0x26'),_0x38868d,_0x401b1b[_0x1503('0x2a')][_0x1503('0x2b')]);return _0x350563(_0x401b1b['error'][_0x1503('0x2b')]);}logger[_0x1503('0x2a')](_0x1503('0x26'),_0x38868d,_0x401b1b[_0x1503('0x2a')][_0x1503('0x2b')]);return _0x33dae9(_0x401b1b[_0x1503('0x2a')][_0x1503('0x2b')]);}else{logger[_0x1503('0x2c')](_0x1503('0x26'),_0x38868d,'request\x20sent');_0x33dae9(_0x401b1b[_0x1503('0x2d')]['message']);}})[_0x1503('0x2e')](function(_0x2e8ee1){logger[_0x1503('0x2a')](_0x1503('0x26'),_0x38868d,_0x2e8ee1);_0x350563(_0x2e8ee1);});});}function respondWithStatusCode(_0x499ed6,_0x346f55){_0x346f55=_0x346f55||0xcc;return function(_0x2057bd){if(_0x2057bd){return _0x499ed6[_0x1503('0x2f')](_0x346f55);}return _0x499ed6[_0x1503('0x30')](_0x346f55)[_0x1503('0x31')]();};}function respondWithResult(_0x35c2c1,_0x4cab3a){_0x4cab3a=_0x4cab3a||0xc8;return function(_0xaae8e7){if(_0xaae8e7){return _0x35c2c1[_0x1503('0x30')](_0x4cab3a)[_0x1503('0x32')](_0xaae8e7);}};}function respondWithFilteredResult(_0xc5ccef,_0x339a11){return function(_0xcdb7ea){if(_0xcdb7ea){var _0x3e7b2b=typeof _0x339a11[_0x1503('0x33')]===_0x1503('0x34')&&typeof _0x339a11[_0x1503('0x35')]==='undefined';var _0xf5bddd=_0xcdb7ea[_0x1503('0x36')];var _0x131c4f=_0x3e7b2b?0x0:_0x339a11['offset'];var _0x58b2fc=_0x3e7b2b?_0xcdb7ea['count']:_0x339a11[_0x1503('0x33')]+_0x339a11['limit'];var _0x5e24fd;if(_0x58b2fc>=_0xf5bddd){_0x58b2fc=_0xf5bddd;_0x5e24fd=0xc8;}else{_0x5e24fd=0xce;}_0xc5ccef[_0x1503('0x30')](_0x5e24fd);return _0xc5ccef[_0x1503('0x37')](_0x1503('0x38'),_0x131c4f+'-'+_0x58b2fc+'/'+_0xf5bddd)[_0x1503('0x32')](_0xcdb7ea);}return null;};}function patchUpdates(_0x5d170e){return function(_0x2cea16){try{jsonpatch['apply'](_0x2cea16,_0x5d170e,!![]);}catch(_0x181ff){return BPromise[_0x1503('0x39')](_0x181ff);}return _0x2cea16[_0x1503('0x3a')]();};}function saveUpdates(_0x22eba8,_0x4d87a7){return function(_0x41605f){if(_0x41605f){return _0x41605f[_0x1503('0x3b')](_0x22eba8)['then'](function(_0x3f3782){return _0x3f3782;});}return null;};}function removeEntity(_0x2b230e,_0x520269){return function(_0x201b5b){if(_0x201b5b){return _0x201b5b[_0x1503('0x3c')]()[_0x1503('0x25')](function(){_0x2b230e[_0x1503('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x190536,_0x1ac567){return function(_0xee0742){if(!_0xee0742){_0x190536[_0x1503('0x2f')](0x194);}return _0xee0742;};}function handleError(_0x146915,_0x4c6971){_0x4c6971=_0x4c6971||0x1f4;return function(_0x14a424){logger[_0x1503('0x2a')](_0x14a424['stack']);if(_0x14a424[_0x1503('0x3d')]){delete _0x14a424[_0x1503('0x3d')];}_0x146915[_0x1503('0x30')](_0x4c6971)[_0x1503('0x3e')](_0x14a424);};}exports['index']=function(_0x53a810,_0x1e4fc6){var _0x19b41e={},_0x46e3f1={},_0x2c9e23={'count':0x0,'rows':[]};var _0x552573=_[_0x1503('0x3f')](db[_0x1503('0x40')][_0x1503('0x41')],function(_0x410a38){return{'name':_0x410a38[_0x1503('0x42')],'type':_0x410a38[_0x1503('0x43')][_0x1503('0x44')]};});_0x46e3f1[_0x1503('0x45')]=_[_0x1503('0x3f')](_0x552573,_0x1503('0x3d'));_0x46e3f1[_0x1503('0x46')]=_['keys'](_0x53a810['query']);_0x46e3f1[_0x1503('0x47')]=_[_0x1503('0x48')](_0x46e3f1[_0x1503('0x45')],_0x46e3f1[_0x1503('0x46')]);_0x19b41e[_0x1503('0x49')]=_[_0x1503('0x48')](_0x46e3f1['model'],qs['fields'](_0x53a810[_0x1503('0x46')][_0x1503('0x4a')]));_0x19b41e['attributes']=_0x19b41e[_0x1503('0x49')]['length']?_0x19b41e[_0x1503('0x49')]:_0x46e3f1[_0x1503('0x45')];if(!_0x53a810['query']['hasOwnProperty'](_0x1503('0x4b'))){_0x19b41e[_0x1503('0x35')]=qs['limit'](_0x53a810[_0x1503('0x46')]['limit']);_0x19b41e['offset']=qs[_0x1503('0x33')](_0x53a810['query'][_0x1503('0x33')]);}_0x19b41e[_0x1503('0x4c')]=qs[_0x1503('0x4d')](_0x53a810[_0x1503('0x46')][_0x1503('0x4d')]);_0x19b41e[_0x1503('0x4e')]=qs[_0x1503('0x47')](_['pick'](_0x53a810['query'],_0x46e3f1[_0x1503('0x47')]),_0x552573);if(_0x53a810[_0x1503('0x46')]['filter']){_0x19b41e[_0x1503('0x4e')]=_['merge'](_0x19b41e[_0x1503('0x4e')],{'$or':_[_0x1503('0x3f')](_0x552573,function(_0x715d0f){if(_0x715d0f[_0x1503('0x43')]!==_0x1503('0x4f')){var _0x353da4={};_0x353da4[_0x715d0f[_0x1503('0x3d')]]={'$like':'%'+_0x53a810['query'][_0x1503('0x50')]+'%'};return _0x353da4;}})});}_0x19b41e=_[_0x1503('0x51')]({},_0x19b41e,_0x53a810[_0x1503('0x52')]);var _0x20b482={'where':_0x19b41e[_0x1503('0x4e')]};return db[_0x1503('0x40')][_0x1503('0x36')](_0x20b482)[_0x1503('0x25')](function(_0x10dd97){_0x2c9e23[_0x1503('0x36')]=_0x10dd97;if(_0x53a810[_0x1503('0x46')][_0x1503('0x53')]){_0x19b41e[_0x1503('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1503('0x55')](_0x19b41e);})[_0x1503('0x25')](function(_0x5f067f){_0x2c9e23['rows']=_0x5f067f;return _0x2c9e23;})[_0x1503('0x25')](respondWithFilteredResult(_0x1e4fc6,_0x19b41e))[_0x1503('0x2e')](handleError(_0x1e4fc6,null));};exports[_0x1503('0x56')]=function(_0x2823b1,_0x2ec18d){var _0x36ee22={'raw':!![],'where':{'id':_0x2823b1['params']['id']}},_0xdff146={};_0xdff146[_0x1503('0x45')]=_[_0x1503('0x57')](db[_0x1503('0x40')][_0x1503('0x41')]);_0xdff146[_0x1503('0x46')]=_[_0x1503('0x57')](_0x2823b1[_0x1503('0x46')]);_0xdff146[_0x1503('0x47')]=_['intersection'](_0xdff146[_0x1503('0x45')],_0xdff146[_0x1503('0x46')]);_0x36ee22[_0x1503('0x49')]=_['intersection'](_0xdff146[_0x1503('0x45')],qs[_0x1503('0x4a')](_0x2823b1['query'][_0x1503('0x4a')]));_0x36ee22[_0x1503('0x49')]=_0x36ee22['attributes'][_0x1503('0x58')]?_0x36ee22[_0x1503('0x49')]:_0xdff146['model'];if(_0x2823b1[_0x1503('0x46')][_0x1503('0x53')]){_0x36ee22['include']=[{'all':!![]}];}_0x36ee22=_[_0x1503('0x51')]({},_0x36ee22,_0x2823b1[_0x1503('0x52')]);return db[_0x1503('0x40')][_0x1503('0x59')](_0x36ee22)[_0x1503('0x25')](handleEntityNotFound(_0x2ec18d,null))['then'](respondWithResult(_0x2ec18d,null))['catch'](handleError(_0x2ec18d,null));};exports[_0x1503('0x5a')]=function(_0x12e6e4,_0x7c0f61){return db[_0x1503('0x40')]['create'](_0x12e6e4[_0x1503('0x5b')],{})['then'](respondWithResult(_0x7c0f61,0xc9))[_0x1503('0x2e')](handleError(_0x7c0f61,null));};exports[_0x1503('0x3b')]=function(_0x477ea8,_0x55d728){if(_0x477ea8[_0x1503('0x5b')]['id']){delete _0x477ea8[_0x1503('0x5b')]['id'];}return db[_0x1503('0x40')]['find']({'where':{'id':_0x477ea8[_0x1503('0x5c')]['id']}})[_0x1503('0x25')](handleEntityNotFound(_0x55d728,null))[_0x1503('0x25')](saveUpdates(_0x477ea8[_0x1503('0x5b')],null))[_0x1503('0x25')](respondWithResult(_0x55d728,null))['catch'](handleError(_0x55d728,null));};exports['destroy']=function(_0x2039f3,_0x3d5838){return db['OpenchannelMessage'][_0x1503('0x59')]({'where':{'id':_0x2039f3[_0x1503('0x5c')]['id']}})[_0x1503('0x25')](handleEntityNotFound(_0x3d5838,null))['then'](removeEntity(_0x3d5838,null))[_0x1503('0x2e')](handleError(_0x3d5838,null));};exports[_0x1503('0x5d')]=function(_0x3708c1,_0x8a5aae){return db[_0x1503('0x40')][_0x1503('0x5d')]()[_0x1503('0x25')](respondWithResult(_0x8a5aae,null))[_0x1503('0x2e')](handleError(_0x8a5aae,null));};var interaction_log=require(_0x1503('0x17'))(_0x1503('0x5e'));exports['accept']=function(_0x4a4435,_0x14e70e,_0x27e7e3){var _0x122688={'agent':{},'channel':_0x1503('0x5f')};if(_0x4a4435[_0x1503('0x5b')]['id']){delete _0x4a4435[_0x1503('0x5b')]['id'];}_0x4a4435[_0x1503('0x5b')][_0x1503('0x60')]=!![];_0x4a4435['body']['readAt']=moment()[_0x1503('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a4435['body'][_0x1503('0x62')]=_0x4a4435['body']['UserId']||_0x4a4435[_0x1503('0x63')]['id'];_0x122688[_0x1503('0x64')]['id']=_0x4a4435[_0x1503('0x5b')][_0x1503('0x62')];return db[_0x1503('0x40')][_0x1503('0x59')]({'where':{'id':_0x4a4435[_0x1503('0x5c')]['id'],'UserId':null}})[_0x1503('0x25')](handleEntityNotFound(_0x14e70e,null))['then'](saveUpdates(_0x4a4435[_0x1503('0x5b')],null))[_0x1503('0x25')](function(_0x4efe00){if(_0x4efe00){_0x122688[_0x1503('0x2b')]=_0x4efe00[_0x1503('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1503('0x59')]({'where':{'id':_0x4efe00[_0x1503('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x14e70e,null))[_0x1503('0x25')](function(_0x5e5c65){if(_0x5e5c65){return _0x5e5c65[_0x1503('0x3b')]({'UserId':_0x4a4435[_0x1503('0x5b')][_0x1503('0x62')],'read1stAt':_[_0x1503('0x67')](_0x5e5c65[_0x1503('0x68')])?moment()[_0x1503('0x61')](_0x1503('0x69')):undefined});}return null;})['then'](function(_0x3a09dd){if(_0x3a09dd){_0x122688[_0x1503('0x6a')]=_0x3a09dd[_0x1503('0x65')]({'plain':!![]});interaction_log['info'](_0x1503('0x6b'),_0x4a4435[_0x1503('0x63')]['id'],_0x4a4435['user'][_0x1503('0x3d')],_0x4a4435[_0x1503('0x63')]['role'],_0x122688[_0x1503('0x6a')]['id'],_0x4a4435['body']?JSON['stringify'](_0x4a4435['body']):'null');return respondWithRpcPromise(_0x1503('0x6c'),_0x1503('0x6d'),_0x122688);}return null;})[_0x1503('0x25')](function(_0x485151){var _0x5a967b=_0x1503('0x6e')+_0x485151[_0x1503('0x2b')]['ContactId'];return db[_0x1503('0x6f')][_0x1503('0x46')](_0x5a967b,{'type':db['Sequelize'][_0x1503('0x70')][_0x1503('0x71')],'raw':!![]})[_0x1503('0x25')](function(_0x4b9197){return _0x4b9197;});})[_0x1503('0x25')](function(_0x5c85f3){if(_0x5c85f3){_0x122688[_0x1503('0x2b')][_0x1503('0x72')]=_0x5c85f3[0x0];if(!_0x4a4435[_0x1503('0x5b')][_0x1503('0x62')])return;return db[_0x1503('0x73')][_0x1503('0x59')]({'where':{'id':_0x4a4435[_0x1503('0x5b')]['UserId'],'role':_0x1503('0x64')},'attributes':['id',_0x1503('0x3d'),_0x1503('0x74'),'email',_0x1503('0x75')],'raw':!![]});}return null;})[_0x1503('0x25')](function(_0x1ddb6a){if(!_0x1ddb6a)return null;_0x122688[_0x1503('0x2b')]['agent']=_0x1ddb6a;return _0x122688;})[_0x1503('0x25')](function(_0x46cdb2){if(_0x46cdb2){if(_0x4a4435['body'][_0x1503('0x76')]){_0x122688[_0x1503('0x2b')][_0x1503('0x77')]=util['format'](_0x1503('0x78'),_0x4a4435[_0x1503('0x63')][_0x1503('0x3d')]);_0x122688[_0x1503('0x2b')][_0x1503('0x79')]=_0x122688[_0x1503('0x79')];_0x122688[_0x1503('0x2b')]['motionChannel']=_0x122688[_0x1503('0x79')];_0x122688[_0x1503('0x2b')][_0x1503('0x7a')]=_0x1503('0x7b');return respondWithRpcPromise(_0x1503('0x7c'),_0x1503('0x7c'),{'event':_0x1503('0x7d'),'message':_0x122688['message']},client9002)['then'](function(){return _0x122688;});}return _0x122688;}return null;})[_0x1503('0x25')](respondWithResult(_0x14e70e,null))[_0x1503('0x2e')](handleError(_0x14e70e,null));};var interaction_log=require(_0x1503('0x17'))(_0x1503('0x5e'));exports[_0x1503('0x39')]=function(_0x278035,_0xc41352,_0x15f4a0){var _0x25a965={'agent':{},'channel':_0x1503('0x5f')};if(_0x278035[_0x1503('0x5b')]['id']){delete _0x278035[_0x1503('0x5b')]['id'];}_0x278035[_0x1503('0x5b')][_0x1503('0x62')]=_0x278035['body'][_0x1503('0x62')]||_0x278035[_0x1503('0x63')]['id'];_0x25a965[_0x1503('0x64')]['id']=_0x278035['body'][_0x1503('0x62')];return db[_0x1503('0x40')][_0x1503('0x59')]({'where':{'id':_0x278035[_0x1503('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc41352,null))['then'](function(_0x29be2e){if(_0x29be2e){_0x25a965[_0x1503('0x2b')]=_0x29be2e[_0x1503('0x65')]({'plain':!![]});return db[_0x1503('0x7e')][_0x1503('0x59')]({'where':{'id':_0x29be2e[_0x1503('0x66')]}});}return null;})[_0x1503('0x25')](handleEntityNotFound(_0xc41352,null))[_0x1503('0x25')](function(_0x330ddf){if(_0x330ddf){_0x25a965['interaction']=_0x330ddf[_0x1503('0x65')]({'plain':!![]});interaction_log[_0x1503('0x2c')](_0x1503('0x7f'),_0x278035['user']['id'],_0x278035[_0x1503('0x63')][_0x1503('0x3d')],_0x278035[_0x1503('0x63')][_0x1503('0x80')],_0x25a965[_0x1503('0x6a')]['id'],_0x278035[_0x1503('0x5b')]?JSON[_0x1503('0x81')](_0x278035['body']):_0x1503('0x82'));return respondWithRpcPromise(_0x1503('0x83'),_0x1503('0x84'),_0x25a965);}return null;})[_0x1503('0x25')](function(_0x8a2873){var _0x5912a5=_0x1503('0x6e')+_0x8a2873['message'][_0x1503('0x85')];return db['sequelize']['query'](_0x5912a5,{'type':db[_0x1503('0x86')][_0x1503('0x70')][_0x1503('0x71')],'raw':!![]})[_0x1503('0x25')](function(_0x487600){return _0x487600;});})[_0x1503('0x25')](function(_0x2b480e){if(_0x2b480e){_0x25a965['message'][_0x1503('0x72')]=_0x2b480e[0x0];if(!_0x278035[_0x1503('0x5b')][_0x1503('0x62')])return;return db['User'][_0x1503('0x59')]({'where':{'id':_0x278035[_0x1503('0x5b')][_0x1503('0x62')],'role':_0x1503('0x64')},'attributes':['id','name',_0x1503('0x74'),'email',_0x1503('0x75')],'raw':!![]});}return null;})[_0x1503('0x25')](function(_0x1d7d55){if(!_0x1d7d55)return null;_0x25a965['message'][_0x1503('0x64')]=_0x1d7d55;return _0x25a965;})['then'](function(_0x5bdb2a){if(_0x5bdb2a){_0x5bdb2a[_0x1503('0x2b')][_0x1503('0x77')]=util[_0x1503('0x61')](_0x1503('0x78'),_0x278035[_0x1503('0x63')][_0x1503('0x3d')]);_0x5bdb2a['message'][_0x1503('0x79')]=_0x25a965[_0x1503('0x79')];_0x5bdb2a[_0x1503('0x2b')][_0x1503('0x87')]=_0x25a965[_0x1503('0x79')];_0x5bdb2a['message'][_0x1503('0x7a')]=_0x1503('0x39');respondWithRpcPromise(_0x1503('0x7c'),_0x1503('0x7c'),{'event':_0x1503('0x88'),'message':_0x5bdb2a[_0x1503('0x2b')]},client9002);return _0x25a965;}return null;})[_0x1503('0x25')](respondWithResult(_0xc41352,null))['catch'](handleError(_0xc41352,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0f1261d..176ec15 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 _0xfddf=['exports','remove','emit','hasOwnProperty','hook'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xfddf,0xfb));var _0xffdd=function(_0x4d7e37,_0x3916be){_0x4d7e37=_0x4d7e37-0x0;var _0x34234f=_0xfddf[_0x4d7e37];return _0x34234f;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xffdd('0x0')};function emitEvent(_0x44e88a){return function(_0x3bef74,_0x30b62d,_0x368717){OpenchannelMessageEvents[_0xffdd('0x1')](_0x44e88a+':'+_0x3bef74['id'],_0x3bef74);OpenchannelMessageEvents['emit'](_0x44e88a,_0x3bef74);_0x368717(null);};}for(var e in events){if(events[_0xffdd('0x2')](e)){var event=events[e];OpenchannelMessage[_0xffdd('0x3')](e,emitEvent(event));}}module[_0xffdd('0x4')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3558=['hook','exports','events','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x20c0af,_0x5d2561){var _0x5b8435=function(_0x391a1d){while(--_0x391a1d){_0x20c0af['push'](_0x20c0af['shift']());}};_0x5b8435(++_0x5d2561);}(_0x3558,0x16a));var _0x8355=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x3558[_0x1a9204];return _0x17ca68;};'use strict';var EventEmitter=require(_0x8355('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x8355('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8355('0x2')](0x0);var events={'afterCreate':_0x8355('0x3'),'afterUpdate':_0x8355('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a65ac){return function(_0x17fdc1,_0x393de3,_0x21c420){OpenchannelMessageEvents[_0x8355('0x5')](_0x2a65ac+':'+_0x17fdc1['id'],_0x17fdc1);OpenchannelMessageEvents[_0x8355('0x5')](_0x2a65ac,_0x17fdc1);_0x21c420(null);};}for(var e in events){if(events[_0x8355('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8355('0x7')](e,emitEvent(event));}}module[_0x8355('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8229d47..a4c83f8 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 _0xff60=['omit','POST','method','GET','afterCreate','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction'];(function(_0x54454d,_0x31df65){var _0x2f7146=function(_0x2d8302){while(--_0x2d8302){_0x54454d['push'](_0x54454d['shift']());}};_0x2f7146(++_0x31df65);}(_0xff60,0x6f));var _0x0ff6=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xff60[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0ff6('0x0'));var util=require('util');var logger=require(_0x0ff6('0x1'))(_0x0ff6('0x2'));var moment=require(_0x0ff6('0x3'));var BPromise=require(_0x0ff6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ff6('0x5'));var rimraf=require(_0x0ff6('0x6'));var config=require('../../config/environment');var attributes=require(_0x0ff6('0x7'));module[_0x0ff6('0x8')]=function(_0x538f24,_0x1d42bb){return _0x538f24[_0x0ff6('0x9')](_0x0ff6('0xa'),attributes,{'tableName':_0x0ff6('0xb'),'paranoid':![],'indexes':[{'name':_0x0ff6('0xc'),'fields':[_0x0ff6('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5692,_0x537c16,_0x4ce59c){var _0x1ec5a2=_0x538f24['models'];var _0x217ff9=_0x1c5692[_0x0ff6('0xe')]({'plain':!![]});if(_0x217ff9[_0x0ff6('0xf')][_0x0ff6('0x10')]()==='in'||_0x217ff9[_0x0ff6('0xf')][_0x0ff6('0x10')]()===_0x0ff6('0x11')&&!_0x217ff9['secret']&&!_[_0x0ff6('0x12')](_0x217ff9[_0x0ff6('0x13')])){_0x1ec5a2[_0x0ff6('0x14')][_0x0ff6('0x15')]({'where':{'id':_0x217ff9[_0x0ff6('0x16')]}})[_0x0ff6('0x17')](function(_0x48a069){if(_0x48a069){_0x48a069[_0x0ff6('0x18')]({'lastMsgAt':_0x217ff9[_0x0ff6('0x19')],'lastMsgDirection':_0x217ff9[_0x0ff6('0xf')][_0x0ff6('0x10')]()});}})[_0x0ff6('0x1a')](function(_0x15ebad){console[_0x0ff6('0x1b')](_0x15ebad);});}if(_0x217ff9[_0x0ff6('0xf')]==='out'&&!_0x217ff9[_0x0ff6('0x1c')]){var _0x54dcc9;_0x1ec5a2[_0x0ff6('0x1d')][_0x0ff6('0x1e')]()[_0x0ff6('0x17')](function(_0x37fa09){return _0x1ec5a2[_0x0ff6('0x1f')][_0x0ff6('0x20')]({'where':{'id':_0x217ff9['OpenchannelAccountId']},'include':[{'model':_0x1ec5a2[_0x0ff6('0x14')],'as':_0x0ff6('0x21'),'where':{'id':_0x217ff9['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1ec5a2['CmContact'],'as':_0x0ff6('0x22'),'attributes':_[_0x0ff6('0x23')](_0x37fa09)}]}]});})['then'](function(_0x1606b4){_0x54dcc9=_0x1606b4[_0x0ff6('0xe')]({'plain':!![]});if(_0x54dcc9&&_0x54dcc9[_0x0ff6('0x24')]){logger[_0x0ff6('0x25')](_0x0ff6('0x26'),'afterCreate',util[_0x0ff6('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x217ff9['id'],_0x54dcc9[_0x0ff6('0x24')]));if(_0x54dcc9[_0x0ff6('0x21')]&&_0x54dcc9[_0x0ff6('0x21')][_0x0ff6('0x28')]){_0x217ff9[_0x0ff6('0x29')]=_[_0x0ff6('0x2a')](_0x54dcc9[_0x0ff6('0x21')][0x0],'Contact');_0x217ff9[_0x0ff6('0x22')]=_0x54dcc9['Interactions'][0x0][_0x0ff6('0x22')];}var _0x537c16={'method':_0x0ff6('0x2b'),'uri':encodeURI(_0x54dcc9[_0x0ff6('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x537c16[_0x0ff6('0x2c')]){case _0x0ff6('0x2d'):_0x537c16['qs']=_0x217ff9;break;case _0x0ff6('0x2b'):_0x537c16[_0x0ff6('0xd')]=_0x217ff9;break;}return rp(_0x537c16)['then'](function(_0x3428a2){logger[_0x0ff6('0x25')](_0x0ff6('0x26'),_0x0ff6('0x2e'),util[_0x0ff6('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x217ff9['id'],_0x54dcc9[_0x0ff6('0x24')]));if(_0x3428a2[_0x0ff6('0xd')][_0x0ff6('0x2f')]&&_0x3428a2[_0x0ff6('0xd')][_0x0ff6('0x2f')]!=_0x217ff9[_0x0ff6('0x29')][_0x0ff6('0x2f')]){return _0x1ec5a2[_0x0ff6('0x14')][_0x0ff6('0x18')]({'threadId':_0x3428a2[_0x0ff6('0xd')][_0x0ff6('0x2f')]},{'where':{'id':_0x217ff9['Interaction']['id']}});}else{return;}})[_0x0ff6('0x17')](function(){return _0x1c5692[_0x0ff6('0x18')]({'read':!![]});})[_0x0ff6('0x1a')](function(_0x10cab9){logger[_0x0ff6('0x1b')](_0x0ff6('0x26'),_0x0ff6('0x2e'),util[_0x0ff6('0x30')](_0x10cab9,{'showHidden':![],'depth':null}));_0x4ce59c();});}else{_0x4ce59c();}})['finally'](function(){_0x4ce59c();});}else{_0x4ce59c();}}},'charset':_0x0ff6('0x31'),'collate':_0x0ff6('0x32')});}; \ No newline at end of file +var _0x212e=['body','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Contact','keys','replyUri','info','format','length','Interactions','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x4a691b,_0x2fe397){var _0x5299b9=function(_0x13baff){while(--_0x13baff){_0x4a691b['push'](_0x4a691b['shift']());}};_0x5299b9(++_0x2fe397);}(_0x212e,0x1b5));var _0xe212=function(_0x2c0964,_0x504d2f){_0x2c0964=_0x2c0964-0x0;var _0x3c6616=_0x212e[_0x2c0964];return _0x3c6616;};'use strict';var _=require(_0xe212('0x0'));var util=require(_0xe212('0x1'));var logger=require(_0xe212('0x2'))(_0xe212('0x3'));var moment=require('moment');var BPromise=require(_0xe212('0x4'));var rp=require(_0xe212('0x5'));var fs=require('fs');var path=require(_0xe212('0x6'));var rimraf=require(_0xe212('0x7'));var config=require(_0xe212('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xe212('0x9')]=function(_0x696799,_0x18e5d1){return _0x696799['define'](_0xe212('0xa'),attributes,{'tableName':_0xe212('0xb'),'paranoid':![],'indexes':[{'name':_0xe212('0xc'),'fields':[_0xe212('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a94ee,_0x1e4c65,_0x521311){var _0x5fee92=_0x696799['models'];var _0x3e33da=_0x4a94ee['get']({'plain':!![]});if(_0x3e33da[_0xe212('0xe')][_0xe212('0xf')]()==='in'||_0x3e33da[_0xe212('0xe')][_0xe212('0xf')]()===_0xe212('0x10')&&!_0x3e33da[_0xe212('0x11')]&&!_[_0xe212('0x12')](_0x3e33da[_0xe212('0x13')])){_0x5fee92[_0xe212('0x14')][_0xe212('0x15')]({'where':{'id':_0x3e33da[_0xe212('0x16')]}})[_0xe212('0x17')](function(_0x22a1c5){if(_0x22a1c5){_0x22a1c5[_0xe212('0x18')]({'lastMsgAt':_0x3e33da[_0xe212('0x19')],'lastMsgDirection':_0x3e33da[_0xe212('0xe')][_0xe212('0xf')]()});}})[_0xe212('0x1a')](function(_0x4dcb78){console[_0xe212('0x1b')](_0x4dcb78);});}if(_0x3e33da['direction']===_0xe212('0x10')&&!_0x3e33da[_0xe212('0x11')]){var _0x4d7d25;_0x5fee92[_0xe212('0x1c')][_0xe212('0x1d')]()['then'](function(_0x3c714e){return _0x5fee92['OpenchannelAccount'][_0xe212('0x1e')]({'where':{'id':_0x3e33da[_0xe212('0x1f')]},'include':[{'model':_0x5fee92[_0xe212('0x14')],'as':'Interactions','where':{'id':_0x3e33da['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5fee92[_0xe212('0x1c')],'as':_0xe212('0x20'),'attributes':_[_0xe212('0x21')](_0x3c714e)}]}]});})[_0xe212('0x17')](function(_0x2710c8){_0x4d7d25=_0x2710c8['get']({'plain':!![]});if(_0x4d7d25&&_0x4d7d25[_0xe212('0x22')]){logger[_0xe212('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xe212('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x3e33da['id'],_0x4d7d25[_0xe212('0x22')]));if(_0x4d7d25['Interactions']&&_0x4d7d25['Interactions'][_0xe212('0x25')]){_0x3e33da['Interaction']=_['omit'](_0x4d7d25['Interactions'][0x0],_0xe212('0x20'));_0x3e33da[_0xe212('0x20')]=_0x4d7d25[_0xe212('0x26')][0x0][_0xe212('0x20')];}var _0x1e4c65={'method':_0xe212('0x27'),'uri':encodeURI(_0x4d7d25[_0xe212('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1e4c65[_0xe212('0x28')]){case _0xe212('0x29'):_0x1e4c65['qs']=_0x3e33da;break;case _0xe212('0x27'):_0x1e4c65['body']=_0x3e33da;break;}return rp(_0x1e4c65)[_0xe212('0x17')](function(_0x5f35e6){logger[_0xe212('0x23')](_0xe212('0x2a'),_0xe212('0x2b'),util[_0xe212('0x24')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3e33da['id'],_0x4d7d25[_0xe212('0x22')]));if(_0x5f35e6[_0xe212('0xd')][_0xe212('0x2c')]&&_0x5f35e6[_0xe212('0xd')][_0xe212('0x2c')]!=_0x3e33da[_0xe212('0x2d')][_0xe212('0x2c')]){return _0x5fee92[_0xe212('0x14')][_0xe212('0x18')]({'threadId':_0x5f35e6[_0xe212('0xd')][_0xe212('0x2c')]},{'where':{'id':_0x3e33da['Interaction']['id']}});}else{return;}})['then'](function(){return _0x4a94ee['update']({'read':!![]});})[_0xe212('0x1a')](function(_0xe11bae){logger['error'](_0xe212('0x2a'),_0xe212('0x2b'),util[_0xe212('0x2e')](_0xe11bae,{'showHidden':![],'depth':null}));_0x521311();});}else{_0x521311();}})[_0xe212('0x2f')](function(){_0x521311();});}else{_0x521311();}}},'charset':_0xe212('0x30'),'collate':_0xe212('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1a4415a..6d383f8 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2059cc,_0x391dad){var _0x1ddf66=function(_0x5f1a0b){while(--_0x5f1a0b){_0x2059cc['push'](_0x2059cc['shift']());}};_0x1ddf66(++_0x391dad);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x442a11,_0x76bfc8){var _0x16ccc7=function(_0x9f5aad){while(--_0x9f5aad){_0x442a11['push'](_0x442a11['shift']());}};_0x16ccc7(++_0x76bfc8);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b52027c..572c19d 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 _0xb138=['update','removeListener','length','./openchannelMessage.events','save','remove'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xb138,0x1dd));var _0x8b13=function(_0x3ba0af,_0xccb8a1){_0x3ba0af=_0x3ba0af-0x0;var _0x650db7=_0xb138[_0x3ba0af];return _0x650db7;};'use strict';var OpenchannelMessageEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){OpenchannelMessageEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('openchannelMessage:'+_0x33d1a7,_0xd19a0f);OpenchannelMessageEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file +var _0xf95f=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x505d2b,_0x150834){var _0x45a2be=function(_0x40e2af){while(--_0x40e2af){_0x505d2b['push'](_0x505d2b['shift']());}};_0x45a2be(++_0x150834);}(_0xf95f,0x142));var _0xff95=function(_0x53b0f8,_0x459130){_0x53b0f8=_0x53b0f8-0x0;var _0x133415=_0xf95f[_0x53b0f8];return _0x133415;};'use strict';var OpenchannelMessageEvents=require(_0xff95('0x0'));var events=[_0xff95('0x1'),_0xff95('0x2'),_0xff95('0x3')];function createListener(_0x109eae,_0x2c7ada){return function(_0x1a42e0){_0x2c7ada[_0xff95('0x4')](_0x109eae,_0x1a42e0);};}function removeListener(_0x1e81fe,_0x498f22){return function(){OpenchannelMessageEvents[_0xff95('0x5')](_0x1e81fe,_0x498f22);};}exports['register']=function(_0x3f72b4){for(var _0x4fb1ed=0x0,_0x314fb4=events[_0xff95('0x6')];_0x4fb1ed<_0x314fb4;_0x4fb1ed++){var _0x2b9ce9=events[_0x4fb1ed];var _0x1a42b2=createListener(_0xff95('0x7')+_0x2b9ce9,_0x3f72b4);OpenchannelMessageEvents['on'](_0x2b9ce9,_0x1a42b2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 23e4d2f..acf0762 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 _0xe27f=['removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','delete','destroy'];(function(_0x36422a,_0x4665b1){var _0x1e5594=function(_0x27433e){while(--_0x27433e){_0x36422a['push'](_0x36422a['shift']());}};_0x1e5594(++_0x4665b1);}(_0xe27f,0x1b2));var _0xfe27=function(_0x122427,_0x2d41d0){_0x122427=_0x122427-0x0;var _0x227714=_0xe27f[_0x122427];return _0x227714;};'use strict';var multer=require(_0xfe27('0x0'));var util=require(_0xfe27('0x1'));var path=require('path');var timeout=require(_0xfe27('0x2'));var express=require(_0xfe27('0x3'));var router=express[_0xfe27('0x4')]();var fs_extra=require(_0xfe27('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfe27('0x6'));var config=require(_0xfe27('0x7'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0xfe27('0x8')](),controller[_0xfe27('0x9')]);router[_0xfe27('0xa')]('/describe',auth[_0xfe27('0x8')](),controller[_0xfe27('0xb')]);router[_0xfe27('0xa')](_0xfe27('0xc'),auth['isAuthenticated'](),controller[_0xfe27('0xd')]);router['get'](_0xfe27('0xe'),auth[_0xfe27('0x8')](),controller['getMembers']);router[_0xfe27('0xa')](_0xfe27('0xf'),auth[_0xfe27('0x8')](),controller[_0xfe27('0x10')]);router['get'](_0xfe27('0x11'),auth['isAuthenticated'](),controller[_0xfe27('0x12')]);router['post']('/',auth[_0xfe27('0x8')](),controller[_0xfe27('0x13')]);router[_0xfe27('0x14')](_0xfe27('0xf'),auth[_0xfe27('0x8')](),controller[_0xfe27('0x15')]);router[_0xfe27('0x14')](_0xfe27('0x11'),auth[_0xfe27('0x8')](),controller[_0xfe27('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfe27('0x17')](_0xfe27('0xc'),auth[_0xfe27('0x8')](),controller[_0xfe27('0x18')]);router[_0xfe27('0x17')]('/:id/teams',auth[_0xfe27('0x8')](),controller[_0xfe27('0x19')]);router[_0xfe27('0x17')](_0xfe27('0x11'),auth[_0xfe27('0x8')](),controller['removeAgents']);module[_0xfe27('0x1a')]=router; \ No newline at end of file +var _0x017d=['getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x017d,0x65));var _0xd017=function(_0x2cae9f,_0x14d8d3){_0x2cae9f=_0x2cae9f-0x0;var _0x4eef78=_0x017d[_0x2cae9f];return _0x4eef78;};'use strict';var multer=require(_0xd017('0x0'));var util=require(_0xd017('0x1'));var path=require('path');var timeout=require(_0xd017('0x2'));var express=require(_0xd017('0x3'));var router=express[_0xd017('0x4')]();var fs_extra=require(_0xd017('0x5'));var auth=require(_0xd017('0x6'));var interaction=require(_0xd017('0x7'));var config=require(_0xd017('0x8'));var controller=require(_0xd017('0x9'));router[_0xd017('0xa')]('/',auth[_0xd017('0xb')](),controller[_0xd017('0xc')]);router[_0xd017('0xa')](_0xd017('0xd'),auth[_0xd017('0xb')](),controller[_0xd017('0xe')]);router[_0xd017('0xa')](_0xd017('0xf'),auth[_0xd017('0xb')](),controller[_0xd017('0x10')]);router[_0xd017('0xa')](_0xd017('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0xd017('0xa')](_0xd017('0x12'),auth[_0xd017('0xb')](),controller[_0xd017('0x13')]);router['get']('/:id/users',auth[_0xd017('0xb')](),controller[_0xd017('0x14')]);router[_0xd017('0x15')]('/',auth[_0xd017('0xb')](),controller[_0xd017('0x16')]);router[_0xd017('0x15')]('/:id/teams',auth[_0xd017('0xb')](),controller[_0xd017('0x17')]);router[_0xd017('0x15')](_0xd017('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd017('0x19')]);router[_0xd017('0x1a')]('/:id',auth[_0xd017('0xb')](),controller[_0xd017('0x1b')]);router[_0xd017('0x1a')](_0xd017('0x12'),auth[_0xd017('0xb')](),controller[_0xd017('0x1c')]);router[_0xd017('0x1a')](_0xd017('0x18'),auth[_0xd017('0xb')](),controller[_0xd017('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 4829a47..783b648 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 _0xb8fa=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0xb8fa,0x1a7));var _0xab8f=function(_0x304993,_0x21dff5){_0x304993=_0x304993-0x0;var _0x321226=_0xb8fa[_0x304993];return _0x321226;};'use strict';var Sequelize=require('sequelize');module[_0xab8f('0x0')]={'name':{'type':Sequelize[_0xab8f('0x1')],'unique':_0xab8f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab8f('0x1')]},'timeout':{'type':Sequelize[_0xab8f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab8f('0x4')](_0xab8f('0x5'),_0xab8f('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xabc7=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x371cb8,_0x43aa0e){var _0x1cdfd1=function(_0x46a726){while(--_0x46a726){_0x371cb8['push'](_0x371cb8['shift']());}};_0x1cdfd1(++_0x43aa0e);}(_0xabc7,0xb3));var _0x7abc=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xabc7[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x7abc('0x0'));module[_0x7abc('0x1')]={'name':{'type':Sequelize[_0x7abc('0x2')],'unique':_0x7abc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7abc('0x2')]},'timeout':{'type':Sequelize[_0x7abc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7abc('0x5')](_0x7abc('0x6'),_0x7abc('0x7'),_0x7abc('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index f6b42b7..cb8947c 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 _0x339f=['sendStatus','status','end','offset','undefined','count','limit','json','update','then','get','OpenchannelQueues','UserProfileResource','destroy','stack','name','index','map','OpenchannelQueue','fieldName','key','getOptions','where','include','rows','show','params','model','keys','query','filters','intersection','attributes','length','includeAll','merge','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserOpenchannelQueue','rawAttributes','fields','hasOwnProperty','order','sort','OpenchannelQueueId','filter','findAll','findAndCountAll','openchannelPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','getTeams','nolimit','addTeams','ids','User','voicePause','flatMap','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','field','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','spread','removeAgents','getAgents','pick','bluebird','util','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket'];(function(_0x1bc94b,_0x127ae7){var _0xbb76f4=function(_0x3255bd){while(--_0x3255bd){_0x1bc94b['push'](_0x1bc94b['shift']());}};_0xbb76f4(++_0x127ae7);}(_0x339f,0x152));var _0xf339=function(_0x44fb8e,_0x27f5d5){_0x44fb8e=_0x44fb8e-0x0;var _0xc9d630=_0x339f[_0x44fb8e];return _0xc9d630;};'use strict';var BPromise=require(_0xf339('0x0'));var util=require(_0xf339('0x1'));var _=require('lodash');var squel=require(_0xf339('0x2'));var Redis=require('ioredis');var qs=require(_0xf339('0x3'));var logger=require('../../config/logger')(_0xf339('0x4'));var config=require(_0xf339('0x5'));var db=require(_0xf339('0x6'))['db'];config[_0xf339('0x7')]=_['defaults'](config[_0xf339('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf339('0x8'))(new Redis(config[_0xf339('0x7')]));require(_0xf339('0x9'))['register'](socket);function respondWithStatusCode(_0x181a1a,_0x23014a){_0x23014a=_0x23014a||0xcc;return function(_0x526d2b){if(_0x526d2b){return _0x181a1a[_0xf339('0xa')](_0x23014a);}return _0x181a1a[_0xf339('0xb')](_0x23014a)[_0xf339('0xc')]();};}function respondWithResult(_0x5ae1b0,_0x362a25){_0x362a25=_0x362a25||0xc8;return function(_0xd6e10d){if(_0xd6e10d){return _0x5ae1b0[_0xf339('0xb')](_0x362a25)['json'](_0xd6e10d);}};}function respondWithFilteredResult(_0x121d9a,_0x1a86db){return function(_0x51c5ae){if(_0x51c5ae){var _0x5d49c8=typeof _0x1a86db[_0xf339('0xd')]===_0xf339('0xe')&&typeof _0x1a86db['limit']===_0xf339('0xe');var _0x3eb803=_0x51c5ae[_0xf339('0xf')];var _0xc62476=_0x5d49c8?0x0:_0x1a86db[_0xf339('0xd')];var _0x168d4e=_0x5d49c8?_0x51c5ae[_0xf339('0xf')]:_0x1a86db[_0xf339('0xd')]+_0x1a86db[_0xf339('0x10')];var _0x13618d;if(_0x168d4e>=_0x3eb803){_0x168d4e=_0x3eb803;_0x13618d=0xc8;}else{_0x13618d=0xce;}_0x121d9a[_0xf339('0xb')](_0x13618d);return _0x121d9a['set']('Content-Range',_0xc62476+'-'+_0x168d4e+'/'+_0x3eb803)[_0xf339('0x11')](_0x51c5ae);}return null;};}function saveUpdates(_0x3d270f){return function(_0x8b605){if(_0x8b605){return _0x8b605[_0xf339('0x12')](_0x3d270f)[_0xf339('0x13')](function(_0x33a775){return _0x33a775;});}return null;};}function removeEntity(_0x434a87){return function(_0x370de2){if(_0x370de2){return _0x370de2['destroy']()[_0xf339('0x13')](function(){var _0x185b37=_0x370de2[_0xf339('0x14')]({'plain':!![]});var _0x1b51f0=_0xf339('0x15');return db[_0xf339('0x16')][_0xf339('0x17')]({'where':{'type':_0x1b51f0,'resourceId':_0x185b37['id']}})[_0xf339('0x13')](function(){return _0x370de2;});})[_0xf339('0x13')](function(){_0x434a87['status'](0xcc)[_0xf339('0xc')]();});}};}function handleEntityNotFound(_0x1ee52f){return function(_0x53e4da){if(!_0x53e4da){_0x1ee52f[_0xf339('0xa')](0x194);}return _0x53e4da;};}function handleError(_0x52eb49,_0x5737ab){_0x5737ab=_0x5737ab||0x1f4;return function(_0xddba46){logger['error'](_0xddba46[_0xf339('0x18')]);if(_0xddba46[_0xf339('0x19')]){delete _0xddba46[_0xf339('0x19')];}_0x52eb49[_0xf339('0xb')](_0x5737ab)['send'](_0xddba46);};}exports[_0xf339('0x1a')]=function(_0xe662f,_0x428236){var _0x47c044={};var _0x9b3e63={'count':0x0,'rows':[]};var _0x20309b=_[_0xf339('0x1b')](db[_0xf339('0x1c')]['rawAttributes'],function(_0x417e29){return{'name':_0x417e29[_0xf339('0x1d')],'type':_0x417e29['type'][_0xf339('0x1e')]};});_0x47c044=qs[_0xf339('0x1f')](_0x20309b,_0xe662f);var _0x485bbd={'where':_0x47c044[_0xf339('0x20')]};return db[_0xf339('0x1c')][_0xf339('0xf')](_0x485bbd)[_0xf339('0x13')](function(_0x2ece67){_0x9b3e63[_0xf339('0xf')]=_0x2ece67;_0x47c044['include']=qs[_0xf339('0x21')](_0xe662f['query']);return db[_0xf339('0x1c')]['findAll'](_0x47c044);})['then'](function(_0x42b96a){_0x9b3e63[_0xf339('0x22')]=_0x42b96a;return _0x9b3e63;})[_0xf339('0x13')](respondWithFilteredResult(_0x428236,_0x47c044))['catch'](handleError(_0x428236,null));};exports[_0xf339('0x23')]=function(_0x2e6231,_0x393c4b){var _0x22e005={'raw':!![],'where':{'id':_0x2e6231[_0xf339('0x24')]['id']}},_0xb5f5a6={};_0xb5f5a6[_0xf339('0x25')]=_[_0xf339('0x26')](db[_0xf339('0x1c')]['rawAttributes']);_0xb5f5a6[_0xf339('0x27')]=_['keys'](_0x2e6231[_0xf339('0x27')]);_0xb5f5a6[_0xf339('0x28')]=_[_0xf339('0x29')](_0xb5f5a6['model'],_0xb5f5a6[_0xf339('0x27')]);_0x22e005[_0xf339('0x2a')]=_['intersection'](_0xb5f5a6[_0xf339('0x25')],qs['fields'](_0x2e6231[_0xf339('0x27')]['fields']));_0x22e005[_0xf339('0x2a')]=_0x22e005['attributes'][_0xf339('0x2b')]?_0x22e005['attributes']:_0xb5f5a6[_0xf339('0x25')];if(_0x2e6231[_0xf339('0x27')][_0xf339('0x2c')]){_0x22e005['include']=[{'all':!![]}];}_0x22e005=_[_0xf339('0x2d')]({},_0x22e005,_0x2e6231[_0xf339('0x2e')]);return db[_0xf339('0x1c')]['find'](_0x22e005)[_0xf339('0x13')](handleEntityNotFound(_0x393c4b,null))[_0xf339('0x13')](respondWithResult(_0x393c4b,null))['catch'](handleError(_0x393c4b,null));};exports['create']=function(_0x4a6d82,_0x2e2ce2){return db[_0xf339('0x1c')][_0xf339('0x2f')](_0x4a6d82[_0xf339('0x30')],{})[_0xf339('0x13')](function(_0x180d25){var _0xd36160=_0x4a6d82[_0xf339('0x31')][_0xf339('0x14')]({'plain':!![]});if(!_0xd36160)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd36160[_0xf339('0x32')]===_0xf339('0x31')){var _0x2efbd8=_0x180d25[_0xf339('0x14')]({'plain':!![]});var _0x2e2638=_0xf339('0x15');return db[_0xf339('0x33')]['find']({'where':{'name':_0x2e2638,'userProfileId':_0xd36160[_0xf339('0x34')]},'raw':!![]})[_0xf339('0x13')](function(_0x19569b){if(_0x19569b&&_0x19569b[_0xf339('0x35')]===0x0){return db[_0xf339('0x16')][_0xf339('0x2f')]({'name':_0x2efbd8[_0xf339('0x19')],'resourceId':_0x2efbd8['id'],'type':_0x19569b['name'],'sectionId':_0x19569b['id']},{})[_0xf339('0x13')](function(){return _0x180d25;});}else{return _0x180d25;}})[_0xf339('0x36')](function(_0x54802f){logger[_0xf339('0x37')](_0xf339('0x38'),_0x54802f);throw _0x54802f;});}return _0x180d25;})[_0xf339('0x13')](respondWithResult(_0x2e2ce2,0xc9))[_0xf339('0x36')](handleError(_0x2e2ce2,null));};exports[_0xf339('0x12')]=function(_0x55bc47,_0x3a6d14){if(_0x55bc47['body']['id']){delete _0x55bc47[_0xf339('0x30')]['id'];}return db['OpenchannelQueue'][_0xf339('0x39')]({'where':{'id':_0x55bc47[_0xf339('0x24')]['id']}})['then'](handleEntityNotFound(_0x3a6d14,null))[_0xf339('0x13')](saveUpdates(_0x55bc47['body'],null))[_0xf339('0x13')](respondWithResult(_0x3a6d14,null))['catch'](handleError(_0x3a6d14,null));};exports[_0xf339('0x17')]=function(_0x367916,_0x5a5204){return db[_0xf339('0x1c')]['find']({'where':{'id':_0x367916['params']['id']}})[_0xf339('0x13')](handleEntityNotFound(_0x5a5204,null))[_0xf339('0x13')](removeEntity(_0x5a5204,null))[_0xf339('0x36')](handleError(_0x5a5204,null));};exports['describe']=function(_0x3b0f0b,_0x2c8314){return db[_0xf339('0x1c')][_0xf339('0x3a')]()[_0xf339('0x13')](respondWithResult(_0x2c8314,null))[_0xf339('0x36')](handleError(_0x2c8314,null));};exports[_0xf339('0x3b')]=function(_0x305742,_0xcffb0c){var _0x3f45b8={'raw':!![],'where':{}},_0x3ef998={},_0x2bba0d;return db[_0xf339('0x1c')]['findOne']({'where':{'id':_0x305742['params']['id']}})[_0xf339('0x13')](handleEntityNotFound(_0xcffb0c,null))[_0xf339('0x13')](function(_0x4031fa){if(_0x4031fa){_0x2bba0d=_0x4031fa[_0xf339('0x14')]({'plain':!![]});_0x3ef998[_0xf339('0x25')]=_['keys'](db[_0xf339('0x3c')][_0xf339('0x3d')]);_0x3ef998[_0xf339('0x27')]=_['keys'](_0x305742[_0xf339('0x27')]);_0x3ef998[_0xf339('0x28')]=_[_0xf339('0x29')](_0x3ef998[_0xf339('0x25')],_0x3ef998[_0xf339('0x27')]);_0x3f45b8['attributes']=_[_0xf339('0x29')](_0x3ef998['model'],qs[_0xf339('0x3e')](_0x305742[_0xf339('0x27')][_0xf339('0x3e')]));_0x3f45b8['attributes']=_0x3f45b8['attributes'][_0xf339('0x2b')]?_0x3f45b8[_0xf339('0x2a')]:_0x3ef998[_0xf339('0x25')];if(!_0x305742[_0xf339('0x27')][_0xf339('0x3f')]('nolimit')){_0x3f45b8[_0xf339('0x10')]=qs['limit'](_0x305742[_0xf339('0x27')]['limit']);_0x3f45b8[_0xf339('0xd')]=qs['offset'](_0x305742[_0xf339('0x27')]['offset']);}_0x3f45b8[_0xf339('0x40')]=qs['sort'](_0x305742[_0xf339('0x27')][_0xf339('0x41')]);_0x3f45b8[_0xf339('0x20')]=qs[_0xf339('0x28')](_['pick'](_0x305742[_0xf339('0x27')],_0x3ef998['filters']));_0x3f45b8['where'][_0xf339('0x42')]=_0x4031fa['id'];if(_0x305742[_0xf339('0x27')][_0xf339('0x43')]){_0x3f45b8[_0xf339('0x20')]=_[_0xf339('0x2d')](_0x3f45b8['where'],{'$or':_[_0xf339('0x1b')](_0x3f45b8[_0xf339('0x2a')],function(_0x116ad9){var _0xe8b7fd={};_0xe8b7fd[_0x116ad9]={'$like':'%'+_0x305742[_0xf339('0x27')][_0xf339('0x43')]+'%'};return _0xe8b7fd;})});}_0x3f45b8=_[_0xf339('0x2d')]({},_0x3f45b8,_0x305742[_0xf339('0x2e')]);return db[_0xf339('0x3c')][_0xf339('0x44')](_0x3f45b8);}})['then'](function(_0x4b95af){if(_0x4b95af){return db['User'][_0xf339('0x45')]({'where':{'id':_[_0xf339('0x1b')](_0x4b95af,'UserId'),'role':'agent'},'attributes':['id',_0xf339('0x19'),_0xf339('0x46'),_0xf339('0x47'),_0xf339('0x48')]});}})['then'](function(_0x36e6e0){if(_0x36e6e0){return{'count':_0x36e6e0[_0xf339('0xf')],'rows':_[_0xf339('0x1b')](_0x36e6e0[_0xf339('0x22')],function(_0x5f5c9c){return{'membername':_0x5f5c9c['name'],'UserId':_0x5f5c9c['id'],'queue_name':_0x2bba0d[_0xf339('0x19')],'OpenchannelQueueId':_0x2bba0d['id'],'interface':util['format'](_0xf339('0x49'),_0xf339('0x4a'),_0x5f5c9c[_0xf339('0x19')]),'penalty':0x0,'paused':_0x5f5c9c[_0xf339('0x46')],'createdAt':_0x5f5c9c['createdAt'],'updatedAt':_0x5f5c9c[_0xf339('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf339('0x13')](respondWithFilteredResult(_0xcffb0c,_0x3f45b8))[_0xf339('0x36')](handleError(_0xcffb0c,null));};exports['getTeams']=function(_0x3f5631,_0x45728c){var _0x59a78b={};var _0x5cd5e1={};var _0x151f92;var _0x183e65;return db['OpenchannelQueue'][_0xf339('0x4b')]({'where':{'id':_0x3f5631[_0xf339('0x24')]['id']}})[_0xf339('0x13')](handleEntityNotFound(_0x45728c,null))[_0xf339('0x13')](function(_0x4b4603){if(_0x4b4603){_0x151f92=_0x4b4603;_0x5cd5e1['model']=_['keys'](db[_0xf339('0x4c')]['rawAttributes']);_0x5cd5e1[_0xf339('0x27')]=_[_0xf339('0x26')](_0x3f5631[_0xf339('0x27')]);_0x5cd5e1[_0xf339('0x28')]=_['intersection'](_0x5cd5e1['model'],_0x5cd5e1['query']);_0x59a78b[_0xf339('0x2a')]=_[_0xf339('0x29')](_0x5cd5e1[_0xf339('0x25')],qs['fields'](_0x3f5631['query']['fields']));_0x59a78b['attributes']=_0x59a78b[_0xf339('0x2a')][_0xf339('0x2b')]?_0x59a78b[_0xf339('0x2a')]:_0x5cd5e1[_0xf339('0x25')];_0x59a78b[_0xf339('0x40')]=qs[_0xf339('0x41')](_0x3f5631[_0xf339('0x27')][_0xf339('0x41')]);_0x59a78b['where']=qs[_0xf339('0x28')](_['pick'](_0x3f5631['query'],_0x5cd5e1[_0xf339('0x28')]));if(_0x3f5631[_0xf339('0x27')][_0xf339('0x43')]){_0x59a78b['where']=_[_0xf339('0x2d')](_0x59a78b[_0xf339('0x20')],{'$or':_[_0xf339('0x1b')](_0x59a78b[_0xf339('0x2a')],function(_0x26abf3){var _0x4c66c6={};_0x4c66c6[_0x26abf3]={'$like':'%'+_0x3f5631['query'][_0xf339('0x43')]+'%'};return _0x4c66c6;})});}_0x59a78b=_['merge']({},_0x59a78b,_0x3f5631[_0xf339('0x2e')]);return _0x151f92[_0xf339('0x4d')](_0x59a78b);}})['then'](function(_0x41e939){if(_0x41e939){_0x183e65=_0x41e939[_0xf339('0x2b')];if(!_0x3f5631[_0xf339('0x27')][_0xf339('0x3f')](_0xf339('0x4e'))){_0x59a78b['limit']=qs[_0xf339('0x10')](_0x3f5631[_0xf339('0x27')][_0xf339('0x10')]);_0x59a78b[_0xf339('0xd')]=qs[_0xf339('0xd')](_0x3f5631['query'][_0xf339('0xd')]);}return _0x151f92[_0xf339('0x4d')](_0x59a78b);}})[_0xf339('0x13')](function(_0x391cfd){if(_0x391cfd){return _0x391cfd?{'count':_0x183e65,'rows':_0x391cfd}:null;}})[_0xf339('0x13')](respondWithResult(_0x45728c,null))[_0xf339('0x36')](handleError(_0x45728c,null));};exports[_0xf339('0x4f')]=function(_0x33d76e,_0x5f5362){var _0x1bb79f=_0x33d76e['body'][_0xf339('0x50')];return db[_0xf339('0x4c')]['findAll']({'where':{'id':_0x1bb79f},'attributes':['id'],'include':[{'model':db[_0xf339('0x51')],'as':'Agents','attributes':['id',_0xf339('0x19'),'online',_0xf339('0x52'),'interface'],'raw':!![]}]})['then'](function(_0x3badee){if(_0x3badee){var _0x35b28d=_[_0xf339('0x53')](_0x3badee,function(_0x5d787c){var _0x4cb922=_0x5d787c[_0xf339('0x14')]({'plain':!![]});return _0x4cb922['Agents'];});return db[_0xf339('0x1c')][_0xf339('0x39')]({'where':{'id':_0x33d76e[_0xf339('0x24')]['id']}})[_0xf339('0x13')](function(_0x22abcc){return db[_0xf339('0x54')]['transaction'](function(_0x13cfe6){return _0x22abcc['addTeams'](_0x1bb79f,{'transaction':_0x13cfe6})['then'](function(){return BPromise[_0xf339('0x55')](_0x35b28d,function(_0x4215b0){return db['UserOpenchannelQueue'][_0xf339('0x56')]({'where':{'UserId':_0x4215b0['id'],'OpenchannelQueueId':_0x33d76e[_0xf339('0x24')]['id']},'transaction':_0x13cfe6});});})['then'](function(){_0x35b28d['forEach'](function(_0x16c100){socket[_0xf339('0x57')](_0xf339('0x58'),{'UserId':_0x16c100['id'],'OpenchannelQueueId':_0x22abcc['id']});});});});});}})['then'](respondWithStatusCode(_0x5f5362,null))['catch'](handleError(_0x5f5362,null));};exports[_0xf339('0x59')]=function(_0x55b194,_0x1df034){return db[_0xf339('0x4c')]['findAll']({'where':{'id':_0x55b194[_0xf339('0x27')][_0xf339('0x50')]},'attributes':['id'],'include':[{'model':db[_0xf339('0x51')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf339('0x13')](handleEntityNotFound(_0x1df034,null))[_0xf339('0x13')](function(_0x2dbceb){var _0x5911f6=_[_0xf339('0x1b')](_0x2dbceb,'id');var _0x2b3946=[];var _0x20ea02=[];var _0x237986=squel['select']();_0x237986[_0xf339('0x5a')]('tq.TeamId')[_0xf339('0x5b')](_0xf339('0x5c'),'tq')['join'](_0xf339('0x5d'),'ut',_0xf339('0x5e'))['where']('OpenchannelQueueId\x20=\x20?',_0x55b194['params']['id']);for(var _0x1f1d66=0x0;_0x1f1d66<_0x2dbceb[_0xf339('0x2b')];_0x1f1d66+=0x1){let _0x4dea0a=_0x2dbceb[_0x1f1d66];for(var _0x2d4feb=0x0;_0x2d4feb<_0x4dea0a[_0xf339('0x5f')]['length'];_0x2d4feb+=0x1){let _0x220289=_0x4dea0a[_0xf339('0x5f')][_0x2d4feb];var _0x1dd56b=_0x237986[_0xf339('0x60')]();_0x1dd56b[_0xf339('0x20')](_0xf339('0x61'),_0x220289['id']);_0x20ea02['push'](db['sequelize'][_0xf339('0x27')](_0x1dd56b[_0xf339('0x62')](),{'type':db[_0xf339('0x54')][_0xf339('0x63')][_0xf339('0x64')]})[_0xf339('0x13')](function(_0x288841){if(_0x288841[_0xf339('0x2b')]===0x1){return _0x220289['id'];}else{var _0x17b48e=_[_0xf339('0x65')](_[_0xf339('0x1b')](_0x288841,_0xf339('0x66')),function(_0x1e9e2c){return _[_0xf339('0x67')](_0x5911f6,_0x1e9e2c);});if(_0x17b48e){return _0x220289['id'];}}}));}}return BPromise[_0xf339('0x68')](_0x20ea02)['then'](function(_0x5d9aab){_0x2b3946=_(_0x2b3946)[_0xf339('0x69')](_0x5d9aab)[_0xf339('0x6a')]()[_0xf339('0x6b')]();return db[_0xf339('0x1c')]['find']({'where':{'id':_0x55b194['params']['id']}})[_0xf339('0x13')](function(_0x57d811){return db[_0xf339('0x54')]['transaction'](function(_0x346b40){return _0x57d811['removeTeams'](_0x55b194[_0xf339('0x27')][_0xf339('0x50')],{'transaction':_0x346b40})[_0xf339('0x13')](function(){if(!_[_0xf339('0x6c')](_0x2b3946)){return _0x57d811['removeAgents'](_0x2b3946,{'transaction':_0x346b40});}})[_0xf339('0x13')](function(){_0x2b3946[_0xf339('0x6d')](function(_0x5228ca){socket['emit'](_0xf339('0x6e'),{'UserId':_0x5228ca,'OpenchannelQueueId':_0x57d811['id']});});});});});});})[_0xf339('0x13')](respondWithStatusCode(_0x1df034,null))['catch'](handleError(_0x1df034,null));};exports[_0xf339('0x6f')]=function(_0x68fff8,_0x59fce0){return db[_0xf339('0x1c')]['find']({'where':{'id':_0x68fff8[_0xf339('0x24')]['id']}})[_0xf339('0x13')](handleEntityNotFound(_0x59fce0,null))[_0xf339('0x13')](function(_0x59ec1a){if(_0x59ec1a){return _0x59ec1a['addAgents'](_0x68fff8[_0xf339('0x30')]['ids'],_['omit'](_0x68fff8[_0xf339('0x30')],['ids','id'])||{})[_0xf339('0x70')](function(_0x5ed562){for(var _0x5c40c6=0x0;_0x5c40c6<_0x68fff8[_0xf339('0x30')][_0xf339('0x50')][_0xf339('0x2b')];_0x5c40c6+=0x1){socket['emit'](_0xf339('0x58'),{'UserId':Number(_0x68fff8[_0xf339('0x30')][_0xf339('0x50')][_0x5c40c6]),'OpenchannelQueueId':Number(_0x68fff8[_0xf339('0x24')]['id'])});}return _0x5ed562;});}})[_0xf339('0x13')](respondWithResult(_0x59fce0,null))[_0xf339('0x36')](handleError(_0x59fce0,null));};exports[_0xf339('0x71')]=function(_0x4bf8ad,_0x1c0cd9){return db[_0xf339('0x1c')]['find']({'where':{'id':_0x4bf8ad['params']['id']}})[_0xf339('0x13')](handleEntityNotFound(_0x1c0cd9,null))['then'](function(_0x32be46){if(_0x32be46){return _0x32be46['removeAgents'](_0x4bf8ad[_0xf339('0x27')][_0xf339('0x50')])[_0xf339('0x13')](function(){if(_['isArray'](_0x4bf8ad['query']['ids'])){for(var _0x4a9a16=0x0;_0x4a9a16<_0x4bf8ad[_0xf339('0x27')][_0xf339('0x50')]['length'];_0x4a9a16+=0x1){socket[_0xf339('0x57')](_0xf339('0x6e'),{'UserId':Number(_0x4bf8ad[_0xf339('0x27')]['ids'][_0x4a9a16]),'OpenchannelQueueId':Number(_0x4bf8ad[_0xf339('0x24')]['id'])});}}else{socket[_0xf339('0x57')](_0xf339('0x6e'),{'UserId':Number(_0x4bf8ad[_0xf339('0x27')][_0xf339('0x50')]),'OpenchannelQueueId':Number(_0x4bf8ad['params']['id'])});}});}})[_0xf339('0x13')](respondWithStatusCode(_0x1c0cd9,null))[_0xf339('0x36')](handleError(_0x1c0cd9,null));};exports[_0xf339('0x72')]=function(_0x1019ac,_0x3f8d3f){var _0xd5db38={};var _0x122c03={};var _0xb8a145;var _0x3589e1;return db[_0xf339('0x1c')][_0xf339('0x4b')]({'where':{'id':_0x1019ac[_0xf339('0x24')]['id']}})['then'](handleEntityNotFound(_0x3f8d3f,null))[_0xf339('0x13')](function(_0x2f6215){if(_0x2f6215){_0xb8a145=_0x2f6215;_0x122c03[_0xf339('0x25')]=_['keys'](db[_0xf339('0x51')][_0xf339('0x3d')]);_0x122c03[_0xf339('0x27')]=_[_0xf339('0x26')](_0x1019ac['query']);_0x122c03[_0xf339('0x28')]=_[_0xf339('0x29')](_0x122c03[_0xf339('0x25')],_0x122c03[_0xf339('0x27')]);_0xd5db38['attributes']=_['intersection'](_0x122c03['model'],qs['fields'](_0x1019ac['query'][_0xf339('0x3e')]));_0xd5db38['attributes']=_0xd5db38[_0xf339('0x2a')][_0xf339('0x2b')]?_0xd5db38[_0xf339('0x2a')]:_0x122c03[_0xf339('0x25')];_0xd5db38['order']=qs[_0xf339('0x41')](_0x1019ac['query'][_0xf339('0x41')]);_0xd5db38[_0xf339('0x20')]=qs[_0xf339('0x28')](_[_0xf339('0x73')](_0x1019ac[_0xf339('0x27')],_0x122c03['filters']));if(_0x1019ac[_0xf339('0x27')][_0xf339('0x43')]){_0xd5db38[_0xf339('0x20')]=_['merge'](_0xd5db38[_0xf339('0x20')],{'$or':_['map'](_0xd5db38[_0xf339('0x2a')],function(_0x4e2550){var _0x3c7573={};_0x3c7573[_0x4e2550]={'$like':'%'+_0x1019ac[_0xf339('0x27')]['filter']+'%'};return _0x3c7573;})});}_0xd5db38=_['merge']({},_0xd5db38,_0x1019ac['options']);return _0xb8a145[_0xf339('0x72')](_0xd5db38);}})[_0xf339('0x13')](function(_0x4a6c58){if(_0x4a6c58){_0x3589e1=_0x4a6c58[_0xf339('0x2b')];if(!_0x1019ac[_0xf339('0x27')][_0xf339('0x3f')](_0xf339('0x4e'))){_0xd5db38[_0xf339('0x10')]=qs[_0xf339('0x10')](_0x1019ac[_0xf339('0x27')][_0xf339('0x10')]);_0xd5db38[_0xf339('0xd')]=qs[_0xf339('0xd')](_0x1019ac['query'][_0xf339('0xd')]);}return _0xb8a145['getAgents'](_0xd5db38);}})['then'](function(_0x3736b7){if(_0x3736b7){return _0x3736b7?{'count':_0x3589e1,'rows':_0x3736b7}:null;}})[_0xf339('0x13')](respondWithResult(_0x3f8d3f,null))['catch'](handleError(_0x3f8d3f,null));}; \ No newline at end of file +var _0x5fef=['ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','fieldName','type','key','getOptions','include','query','OpenchannelQueue','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','order','sort','pick','where','OpenchannelQueueId','merge','filter','options','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','createdAt','Team','getTeams','nolimit','addTeams','ids','Agents','voicePause','interface','sequelize','each','forEach','removeTeams','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone'];(function(_0x4dde4b,_0x1ed9dd){var _0x25b792=function(_0x3c7ee6){while(--_0x3c7ee6){_0x4dde4b['push'](_0x4dde4b['shift']());}};_0x25b792(++_0x1ed9dd);}(_0x5fef,0x182));var _0xf5fe=function(_0x485e30,_0x2e9767){_0x485e30=_0x485e30-0x0;var _0x112f84=_0x5fef[_0x485e30];return _0x112f84;};'use strict';var BPromise=require(_0xf5fe('0x0'));var util=require('util');var _=require(_0xf5fe('0x1'));var squel=require('squel');var Redis=require(_0xf5fe('0x2'));var qs=require(_0xf5fe('0x3'));var logger=require(_0xf5fe('0x4'))(_0xf5fe('0x5'));var config=require(_0xf5fe('0x6'));var db=require(_0xf5fe('0x7'))['db'];config[_0xf5fe('0x8')]=_[_0xf5fe('0x9')](config['redis'],{'host':_0xf5fe('0xa'),'port':0x18eb});var socket=require(_0xf5fe('0xb'))(new Redis(config[_0xf5fe('0x8')]));require(_0xf5fe('0xc'))['register'](socket);function respondWithStatusCode(_0x5ee0f2,_0x35dc14){_0x35dc14=_0x35dc14||0xcc;return function(_0x5a7764){if(_0x5a7764){return _0x5ee0f2[_0xf5fe('0xd')](_0x35dc14);}return _0x5ee0f2[_0xf5fe('0xe')](_0x35dc14)[_0xf5fe('0xf')]();};}function respondWithResult(_0x566807,_0x31c052){_0x31c052=_0x31c052||0xc8;return function(_0x3ff00e){if(_0x3ff00e){return _0x566807['status'](_0x31c052)[_0xf5fe('0x10')](_0x3ff00e);}};}function respondWithFilteredResult(_0x7d0666,_0x4558da){return function(_0x1845d7){if(_0x1845d7){var _0x13ecf7=typeof _0x4558da[_0xf5fe('0x11')]===_0xf5fe('0x12')&&typeof _0x4558da[_0xf5fe('0x13')]==='undefined';var _0x5baf48=_0x1845d7['count'];var _0x56ab97=_0x13ecf7?0x0:_0x4558da[_0xf5fe('0x11')];var _0x5cb079=_0x13ecf7?_0x1845d7[_0xf5fe('0x14')]:_0x4558da[_0xf5fe('0x11')]+_0x4558da[_0xf5fe('0x13')];var _0x552064;if(_0x5cb079>=_0x5baf48){_0x5cb079=_0x5baf48;_0x552064=0xc8;}else{_0x552064=0xce;}_0x7d0666[_0xf5fe('0xe')](_0x552064);return _0x7d0666[_0xf5fe('0x15')](_0xf5fe('0x16'),_0x56ab97+'-'+_0x5cb079+'/'+_0x5baf48)[_0xf5fe('0x10')](_0x1845d7);}return null;};}function saveUpdates(_0x1e6d55){return function(_0xb7229e){if(_0xb7229e){return _0xb7229e['update'](_0x1e6d55)[_0xf5fe('0x17')](function(_0x807722){return _0x807722;});}return null;};}function removeEntity(_0x24367b){return function(_0x20f1c8){if(_0x20f1c8){return _0x20f1c8[_0xf5fe('0x18')]()[_0xf5fe('0x17')](function(){var _0x248943=_0x20f1c8[_0xf5fe('0x19')]({'plain':!![]});var _0x58c49f=_0xf5fe('0x1a');return db[_0xf5fe('0x1b')][_0xf5fe('0x18')]({'where':{'type':_0x58c49f,'resourceId':_0x248943['id']}})[_0xf5fe('0x17')](function(){return _0x20f1c8;});})[_0xf5fe('0x17')](function(){_0x24367b[_0xf5fe('0xe')](0xcc)[_0xf5fe('0xf')]();});}};}function handleEntityNotFound(_0x8850){return function(_0x4cf0ec){if(!_0x4cf0ec){_0x8850['sendStatus'](0x194);}return _0x4cf0ec;};}function handleError(_0x322fb1,_0xfff639){_0xfff639=_0xfff639||0x1f4;return function(_0x21531c){logger[_0xf5fe('0x1c')](_0x21531c[_0xf5fe('0x1d')]);if(_0x21531c[_0xf5fe('0x1e')]){delete _0x21531c[_0xf5fe('0x1e')];}_0x322fb1['status'](_0xfff639)['send'](_0x21531c);};}exports[_0xf5fe('0x1f')]=function(_0x2b831b,_0x1f8200){var _0xb7281={};var _0x5d11b5={'count':0x0,'rows':[]};var _0x28cbb0=_[_0xf5fe('0x20')](db['OpenchannelQueue']['rawAttributes'],function(_0x193fa4){return{'name':_0x193fa4[_0xf5fe('0x21')],'type':_0x193fa4[_0xf5fe('0x22')][_0xf5fe('0x23')]};});_0xb7281=qs[_0xf5fe('0x24')](_0x28cbb0,_0x2b831b);var _0x4d9cba={'where':_0xb7281['where']};return db['OpenchannelQueue']['count'](_0x4d9cba)[_0xf5fe('0x17')](function(_0x1da316){_0x5d11b5[_0xf5fe('0x14')]=_0x1da316;_0xb7281[_0xf5fe('0x25')]=qs[_0xf5fe('0x25')](_0x2b831b[_0xf5fe('0x26')]);return db[_0xf5fe('0x27')]['findAll'](_0xb7281);})['then'](function(_0x53f3bd){_0x5d11b5[_0xf5fe('0x28')]=_0x53f3bd;return _0x5d11b5;})[_0xf5fe('0x17')](respondWithFilteredResult(_0x1f8200,_0xb7281))['catch'](handleError(_0x1f8200,null));};exports[_0xf5fe('0x29')]=function(_0x572cec,_0x41c878){var _0x442d05={'raw':!![],'where':{'id':_0x572cec['params']['id']}},_0x10ca45={};_0x10ca45[_0xf5fe('0x2a')]=_[_0xf5fe('0x2b')](db[_0xf5fe('0x27')][_0xf5fe('0x2c')]);_0x10ca45[_0xf5fe('0x26')]=_['keys'](_0x572cec[_0xf5fe('0x26')]);_0x10ca45[_0xf5fe('0x2d')]=_[_0xf5fe('0x2e')](_0x10ca45[_0xf5fe('0x2a')],_0x10ca45[_0xf5fe('0x26')]);_0x442d05[_0xf5fe('0x2f')]=_[_0xf5fe('0x2e')](_0x10ca45[_0xf5fe('0x2a')],qs[_0xf5fe('0x30')](_0x572cec[_0xf5fe('0x26')]['fields']));_0x442d05[_0xf5fe('0x2f')]=_0x442d05[_0xf5fe('0x2f')]['length']?_0x442d05[_0xf5fe('0x2f')]:_0x10ca45[_0xf5fe('0x2a')];if(_0x572cec['query']['includeAll']){_0x442d05[_0xf5fe('0x25')]=[{'all':!![]}];}_0x442d05=_['merge']({},_0x442d05,_0x572cec['options']);return db['OpenchannelQueue'][_0xf5fe('0x31')](_0x442d05)[_0xf5fe('0x17')](handleEntityNotFound(_0x41c878,null))[_0xf5fe('0x17')](respondWithResult(_0x41c878,null))[_0xf5fe('0x32')](handleError(_0x41c878,null));};exports[_0xf5fe('0x33')]=function(_0x538fe1,_0x308ca2){return db[_0xf5fe('0x27')][_0xf5fe('0x33')](_0x538fe1[_0xf5fe('0x34')],{})['then'](function(_0x3e399a){var _0x2cbc60=_0x538fe1[_0xf5fe('0x35')][_0xf5fe('0x19')]({'plain':!![]});if(!_0x2cbc60)throw new Error(_0xf5fe('0x36'));if(_0x2cbc60['role']===_0xf5fe('0x35')){var _0x5830a0=_0x3e399a[_0xf5fe('0x19')]({'plain':!![]});var _0x37c873='OpenchannelQueues';return db[_0xf5fe('0x37')]['find']({'where':{'name':_0x37c873,'userProfileId':_0x2cbc60['userProfileId']},'raw':!![]})[_0xf5fe('0x17')](function(_0x24c718){if(_0x24c718&&_0x24c718[_0xf5fe('0x38')]===0x0){return db[_0xf5fe('0x1b')][_0xf5fe('0x33')]({'name':_0x5830a0['name'],'resourceId':_0x5830a0['id'],'type':_0x24c718[_0xf5fe('0x1e')],'sectionId':_0x24c718['id']},{})[_0xf5fe('0x17')](function(){return _0x3e399a;});}else{return _0x3e399a;}})[_0xf5fe('0x32')](function(_0x370809){logger[_0xf5fe('0x1c')](_0xf5fe('0x39'),_0x370809);throw _0x370809;});}return _0x3e399a;})['then'](respondWithResult(_0x308ca2,0xc9))[_0xf5fe('0x32')](handleError(_0x308ca2,null));};exports[_0xf5fe('0x3a')]=function(_0x590973,_0x5e73d3){if(_0x590973[_0xf5fe('0x34')]['id']){delete _0x590973['body']['id'];}return db[_0xf5fe('0x27')][_0xf5fe('0x31')]({'where':{'id':_0x590973[_0xf5fe('0x3b')]['id']}})[_0xf5fe('0x17')](handleEntityNotFound(_0x5e73d3,null))[_0xf5fe('0x17')](saveUpdates(_0x590973['body'],null))[_0xf5fe('0x17')](respondWithResult(_0x5e73d3,null))[_0xf5fe('0x32')](handleError(_0x5e73d3,null));};exports[_0xf5fe('0x18')]=function(_0x2d3e23,_0x25d063){return db[_0xf5fe('0x27')][_0xf5fe('0x31')]({'where':{'id':_0x2d3e23['params']['id']}})[_0xf5fe('0x17')](handleEntityNotFound(_0x25d063,null))[_0xf5fe('0x17')](removeEntity(_0x25d063,null))[_0xf5fe('0x32')](handleError(_0x25d063,null));};exports['describe']=function(_0x2317e9,_0x4da2db){return db[_0xf5fe('0x27')][_0xf5fe('0x3c')]()[_0xf5fe('0x17')](respondWithResult(_0x4da2db,null))[_0xf5fe('0x32')](handleError(_0x4da2db,null));};exports[_0xf5fe('0x3d')]=function(_0x5eb6cb,_0x31100c){var _0x2e30fb={'raw':!![],'where':{}},_0x1bb32c={},_0x2f32b1;return db[_0xf5fe('0x27')][_0xf5fe('0x3e')]({'where':{'id':_0x5eb6cb['params']['id']}})[_0xf5fe('0x17')](handleEntityNotFound(_0x31100c,null))['then'](function(_0x26373f){if(_0x26373f){_0x2f32b1=_0x26373f[_0xf5fe('0x19')]({'plain':!![]});_0x1bb32c[_0xf5fe('0x2a')]=_[_0xf5fe('0x2b')](db[_0xf5fe('0x3f')][_0xf5fe('0x2c')]);_0x1bb32c['query']=_[_0xf5fe('0x2b')](_0x5eb6cb[_0xf5fe('0x26')]);_0x1bb32c[_0xf5fe('0x2d')]=_['intersection'](_0x1bb32c[_0xf5fe('0x2a')],_0x1bb32c['query']);_0x2e30fb[_0xf5fe('0x2f')]=_[_0xf5fe('0x2e')](_0x1bb32c['model'],qs['fields'](_0x5eb6cb[_0xf5fe('0x26')]['fields']));_0x2e30fb[_0xf5fe('0x2f')]=_0x2e30fb['attributes'][_0xf5fe('0x40')]?_0x2e30fb[_0xf5fe('0x2f')]:_0x1bb32c[_0xf5fe('0x2a')];if(!_0x5eb6cb[_0xf5fe('0x26')][_0xf5fe('0x41')]('nolimit')){_0x2e30fb[_0xf5fe('0x13')]=qs[_0xf5fe('0x13')](_0x5eb6cb[_0xf5fe('0x26')][_0xf5fe('0x13')]);_0x2e30fb[_0xf5fe('0x11')]=qs['offset'](_0x5eb6cb[_0xf5fe('0x26')][_0xf5fe('0x11')]);}_0x2e30fb[_0xf5fe('0x42')]=qs[_0xf5fe('0x43')](_0x5eb6cb[_0xf5fe('0x26')][_0xf5fe('0x43')]);_0x2e30fb['where']=qs[_0xf5fe('0x2d')](_[_0xf5fe('0x44')](_0x5eb6cb[_0xf5fe('0x26')],_0x1bb32c[_0xf5fe('0x2d')]));_0x2e30fb[_0xf5fe('0x45')][_0xf5fe('0x46')]=_0x26373f['id'];if(_0x5eb6cb[_0xf5fe('0x26')]['filter']){_0x2e30fb['where']=_[_0xf5fe('0x47')](_0x2e30fb[_0xf5fe('0x45')],{'$or':_[_0xf5fe('0x20')](_0x2e30fb['attributes'],function(_0x584bbb){var _0x156bad={};_0x156bad[_0x584bbb]={'$like':'%'+_0x5eb6cb[_0xf5fe('0x26')][_0xf5fe('0x48')]+'%'};return _0x156bad;})});}_0x2e30fb=_[_0xf5fe('0x47')]({},_0x2e30fb,_0x5eb6cb[_0xf5fe('0x49')]);return db[_0xf5fe('0x3f')][_0xf5fe('0x4a')](_0x2e30fb);}})[_0xf5fe('0x17')](function(_0xf45d48){if(_0xf45d48){return db[_0xf5fe('0x4b')][_0xf5fe('0x4c')]({'where':{'id':_[_0xf5fe('0x20')](_0xf45d48,_0xf5fe('0x4d')),'role':_0xf5fe('0x4e')},'attributes':['id',_0xf5fe('0x1e'),_0xf5fe('0x4f'),_0xf5fe('0x50'),'createdAt']});}})[_0xf5fe('0x17')](function(_0x5a260f){if(_0x5a260f){return{'count':_0x5a260f['count'],'rows':_[_0xf5fe('0x20')](_0x5a260f[_0xf5fe('0x28')],function(_0x4e3f08){return{'membername':_0x4e3f08[_0xf5fe('0x1e')],'UserId':_0x4e3f08['id'],'queue_name':_0x2f32b1[_0xf5fe('0x1e')],'OpenchannelQueueId':_0x2f32b1['id'],'interface':util[_0xf5fe('0x51')]('%s/%s','SIP',_0x4e3f08[_0xf5fe('0x1e')]),'penalty':0x0,'paused':_0x4e3f08[_0xf5fe('0x4f')],'createdAt':_0x4e3f08[_0xf5fe('0x52')],'updatedAt':_0x4e3f08[_0xf5fe('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5fe('0x17')](respondWithFilteredResult(_0x31100c,_0x2e30fb))[_0xf5fe('0x32')](handleError(_0x31100c,null));};exports['getTeams']=function(_0xccb527,_0x157128){var _0x24697c={};var _0x434b66={};var _0xd6c723;var _0x2c8af1;return db[_0xf5fe('0x27')]['findOne']({'where':{'id':_0xccb527['params']['id']}})[_0xf5fe('0x17')](handleEntityNotFound(_0x157128,null))[_0xf5fe('0x17')](function(_0x235fbe){if(_0x235fbe){_0xd6c723=_0x235fbe;_0x434b66[_0xf5fe('0x2a')]=_['keys'](db[_0xf5fe('0x53')]['rawAttributes']);_0x434b66[_0xf5fe('0x26')]=_['keys'](_0xccb527[_0xf5fe('0x26')]);_0x434b66[_0xf5fe('0x2d')]=_[_0xf5fe('0x2e')](_0x434b66[_0xf5fe('0x2a')],_0x434b66['query']);_0x24697c[_0xf5fe('0x2f')]=_[_0xf5fe('0x2e')](_0x434b66[_0xf5fe('0x2a')],qs[_0xf5fe('0x30')](_0xccb527[_0xf5fe('0x26')][_0xf5fe('0x30')]));_0x24697c[_0xf5fe('0x2f')]=_0x24697c[_0xf5fe('0x2f')]['length']?_0x24697c[_0xf5fe('0x2f')]:_0x434b66[_0xf5fe('0x2a')];_0x24697c[_0xf5fe('0x42')]=qs[_0xf5fe('0x43')](_0xccb527['query'][_0xf5fe('0x43')]);_0x24697c['where']=qs[_0xf5fe('0x2d')](_[_0xf5fe('0x44')](_0xccb527[_0xf5fe('0x26')],_0x434b66['filters']));if(_0xccb527[_0xf5fe('0x26')][_0xf5fe('0x48')]){_0x24697c[_0xf5fe('0x45')]=_[_0xf5fe('0x47')](_0x24697c[_0xf5fe('0x45')],{'$or':_[_0xf5fe('0x20')](_0x24697c['attributes'],function(_0xfb89a8){var _0x2600f2={};_0x2600f2[_0xfb89a8]={'$like':'%'+_0xccb527[_0xf5fe('0x26')][_0xf5fe('0x48')]+'%'};return _0x2600f2;})});}_0x24697c=_[_0xf5fe('0x47')]({},_0x24697c,_0xccb527[_0xf5fe('0x49')]);return _0xd6c723[_0xf5fe('0x54')](_0x24697c);}})[_0xf5fe('0x17')](function(_0x27ccfd){if(_0x27ccfd){_0x2c8af1=_0x27ccfd['length'];if(!_0xccb527[_0xf5fe('0x26')]['hasOwnProperty'](_0xf5fe('0x55'))){_0x24697c[_0xf5fe('0x13')]=qs[_0xf5fe('0x13')](_0xccb527[_0xf5fe('0x26')]['limit']);_0x24697c[_0xf5fe('0x11')]=qs[_0xf5fe('0x11')](_0xccb527[_0xf5fe('0x26')][_0xf5fe('0x11')]);}return _0xd6c723[_0xf5fe('0x54')](_0x24697c);}})[_0xf5fe('0x17')](function(_0x59c579){if(_0x59c579){return _0x59c579?{'count':_0x2c8af1,'rows':_0x59c579}:null;}})['then'](respondWithResult(_0x157128,null))[_0xf5fe('0x32')](handleError(_0x157128,null));};exports[_0xf5fe('0x56')]=function(_0x1daf4a,_0x584cc6){var _0x1bece1=_0x1daf4a[_0xf5fe('0x34')][_0xf5fe('0x57')];return db['Team'][_0xf5fe('0x4a')]({'where':{'id':_0x1bece1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf5fe('0x58'),'attributes':['id',_0xf5fe('0x1e'),'online',_0xf5fe('0x59'),_0xf5fe('0x5a')],'raw':!![]}]})[_0xf5fe('0x17')](function(_0x39e2cb){if(_0x39e2cb){var _0x87a0cf=_['flatMap'](_0x39e2cb,function(_0x5e21b0){var _0x451cbd=_0x5e21b0[_0xf5fe('0x19')]({'plain':!![]});return _0x451cbd[_0xf5fe('0x58')];});return db[_0xf5fe('0x27')][_0xf5fe('0x31')]({'where':{'id':_0x1daf4a[_0xf5fe('0x3b')]['id']}})[_0xf5fe('0x17')](function(_0x1973c3){return db[_0xf5fe('0x5b')]['transaction'](function(_0x42a892){return _0x1973c3['addTeams'](_0x1bece1,{'transaction':_0x42a892})['then'](function(){return BPromise[_0xf5fe('0x5c')](_0x87a0cf,function(_0x156e6c){return db[_0xf5fe('0x3f')]['findOrCreate']({'where':{'UserId':_0x156e6c['id'],'OpenchannelQueueId':_0x1daf4a[_0xf5fe('0x3b')]['id']},'transaction':_0x42a892});});})['then'](function(){_0x87a0cf[_0xf5fe('0x5d')](function(_0x5a18b9){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x5a18b9['id'],'OpenchannelQueueId':_0x1973c3['id']});});});});});}})[_0xf5fe('0x17')](respondWithStatusCode(_0x584cc6,null))[_0xf5fe('0x32')](handleError(_0x584cc6,null));};exports[_0xf5fe('0x5e')]=function(_0x138048,_0x4fa7f6){return db[_0xf5fe('0x53')][_0xf5fe('0x4a')]({'where':{'id':_0x138048['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf5fe('0x4b')],'as':_0xf5fe('0x58'),'attributes':['id'],'raw':!![]}]})[_0xf5fe('0x17')](handleEntityNotFound(_0x4fa7f6,null))[_0xf5fe('0x17')](function(_0x37caa3){var _0x2b07d3=_[_0xf5fe('0x20')](_0x37caa3,'id');var _0x477e7a=[];var _0x51d2ec=[];var _0x516f55=squel['select']();_0x516f55[_0xf5fe('0x5f')](_0xf5fe('0x60'))['from'](_0xf5fe('0x61'),'tq')['join'](_0xf5fe('0x62'),'ut',_0xf5fe('0x63'))['where'](_0xf5fe('0x64'),_0x138048[_0xf5fe('0x3b')]['id']);for(var _0xdfb06f=0x0;_0xdfb06f<_0x37caa3[_0xf5fe('0x40')];_0xdfb06f+=0x1){let _0x3d97bb=_0x37caa3[_0xdfb06f];for(var _0x5f26bb=0x0;_0x5f26bb<_0x3d97bb[_0xf5fe('0x58')][_0xf5fe('0x40')];_0x5f26bb+=0x1){let _0x2dc519=_0x3d97bb['Agents'][_0x5f26bb];var _0x420171=_0x516f55[_0xf5fe('0x65')]();_0x420171['where'](_0xf5fe('0x66'),_0x2dc519['id']);_0x51d2ec[_0xf5fe('0x67')](db[_0xf5fe('0x5b')][_0xf5fe('0x26')](_0x420171[_0xf5fe('0x68')](),{'type':db[_0xf5fe('0x5b')][_0xf5fe('0x69')][_0xf5fe('0x6a')]})['then'](function(_0x54fd9a){if(_0x54fd9a['length']===0x1){return _0x2dc519['id'];}else{var _0x453286=_[_0xf5fe('0x6b')](_[_0xf5fe('0x20')](_0x54fd9a,_0xf5fe('0x6c')),function(_0x295732){return _[_0xf5fe('0x6d')](_0x2b07d3,_0x295732);});if(_0x453286){return _0x2dc519['id'];}}}));}}return BPromise[_0xf5fe('0x6e')](_0x51d2ec)['then'](function(_0x4cb660){_0x477e7a=_(_0x477e7a)[_0xf5fe('0x6f')](_0x4cb660)[_0xf5fe('0x70')]()['value']();return db['OpenchannelQueue'][_0xf5fe('0x31')]({'where':{'id':_0x138048[_0xf5fe('0x3b')]['id']}})['then'](function(_0x1cc56c){return db[_0xf5fe('0x5b')]['transaction'](function(_0xd86efb){return _0x1cc56c[_0xf5fe('0x5e')](_0x138048[_0xf5fe('0x26')][_0xf5fe('0x57')],{'transaction':_0xd86efb})[_0xf5fe('0x17')](function(){if(!_['isEmpty'](_0x477e7a)){return _0x1cc56c[_0xf5fe('0x71')](_0x477e7a,{'transaction':_0xd86efb});}})[_0xf5fe('0x17')](function(){_0x477e7a['forEach'](function(_0x17674f){socket[_0xf5fe('0x72')](_0xf5fe('0x73'),{'UserId':_0x17674f,'OpenchannelQueueId':_0x1cc56c['id']});});});});});});})['then'](respondWithStatusCode(_0x4fa7f6,null))[_0xf5fe('0x32')](handleError(_0x4fa7f6,null));};exports[_0xf5fe('0x74')]=function(_0x4f4bb3,_0x26eaaa){return db[_0xf5fe('0x27')][_0xf5fe('0x31')]({'where':{'id':_0x4f4bb3[_0xf5fe('0x3b')]['id']}})[_0xf5fe('0x17')](handleEntityNotFound(_0x26eaaa,null))['then'](function(_0x7a4a85){if(_0x7a4a85){return _0x7a4a85[_0xf5fe('0x74')](_0x4f4bb3['body'][_0xf5fe('0x57')],_[_0xf5fe('0x75')](_0x4f4bb3['body'],[_0xf5fe('0x57'),'id'])||{})[_0xf5fe('0x76')](function(_0x53a31d){for(var _0x28c41b=0x0;_0x28c41b<_0x4f4bb3[_0xf5fe('0x34')]['ids'][_0xf5fe('0x40')];_0x28c41b+=0x1){socket[_0xf5fe('0x72')](_0xf5fe('0x77'),{'UserId':Number(_0x4f4bb3[_0xf5fe('0x34')]['ids'][_0x28c41b]),'OpenchannelQueueId':Number(_0x4f4bb3['params']['id'])});}return _0x53a31d;});}})[_0xf5fe('0x17')](respondWithResult(_0x26eaaa,null))[_0xf5fe('0x32')](handleError(_0x26eaaa,null));};exports[_0xf5fe('0x71')]=function(_0x119af8,_0x1b248e){return db['OpenchannelQueue'][_0xf5fe('0x31')]({'where':{'id':_0x119af8[_0xf5fe('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1b248e,null))[_0xf5fe('0x17')](function(_0x3e5855){if(_0x3e5855){return _0x3e5855[_0xf5fe('0x71')](_0x119af8[_0xf5fe('0x26')][_0xf5fe('0x57')])[_0xf5fe('0x17')](function(){if(_[_0xf5fe('0x78')](_0x119af8[_0xf5fe('0x26')][_0xf5fe('0x57')])){for(var _0x49aaab=0x0;_0x49aaab<_0x119af8[_0xf5fe('0x26')][_0xf5fe('0x57')][_0xf5fe('0x40')];_0x49aaab+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x119af8[_0xf5fe('0x26')][_0xf5fe('0x57')][_0x49aaab]),'OpenchannelQueueId':Number(_0x119af8[_0xf5fe('0x3b')]['id'])});}}else{socket[_0xf5fe('0x72')](_0xf5fe('0x73'),{'UserId':Number(_0x119af8[_0xf5fe('0x26')][_0xf5fe('0x57')]),'OpenchannelQueueId':Number(_0x119af8[_0xf5fe('0x3b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b248e,null))[_0xf5fe('0x32')](handleError(_0x1b248e,null));};exports[_0xf5fe('0x79')]=function(_0x45e65a,_0x2c490a){var _0x59ef95={};var _0x3556dd={};var _0x4afe68;var _0x5ab408;return db['OpenchannelQueue'][_0xf5fe('0x3e')]({'where':{'id':_0x45e65a[_0xf5fe('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2c490a,null))[_0xf5fe('0x17')](function(_0xda4a49){if(_0xda4a49){_0x4afe68=_0xda4a49;_0x3556dd[_0xf5fe('0x2a')]=_[_0xf5fe('0x2b')](db[_0xf5fe('0x4b')][_0xf5fe('0x2c')]);_0x3556dd[_0xf5fe('0x26')]=_['keys'](_0x45e65a[_0xf5fe('0x26')]);_0x3556dd[_0xf5fe('0x2d')]=_[_0xf5fe('0x2e')](_0x3556dd[_0xf5fe('0x2a')],_0x3556dd['query']);_0x59ef95[_0xf5fe('0x2f')]=_['intersection'](_0x3556dd[_0xf5fe('0x2a')],qs[_0xf5fe('0x30')](_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x30')]));_0x59ef95[_0xf5fe('0x2f')]=_0x59ef95['attributes']['length']?_0x59ef95[_0xf5fe('0x2f')]:_0x3556dd[_0xf5fe('0x2a')];_0x59ef95['order']=qs[_0xf5fe('0x43')](_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x43')]);_0x59ef95[_0xf5fe('0x45')]=qs['filters'](_[_0xf5fe('0x44')](_0x45e65a['query'],_0x3556dd[_0xf5fe('0x2d')]));if(_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x48')]){_0x59ef95[_0xf5fe('0x45')]=_['merge'](_0x59ef95['where'],{'$or':_[_0xf5fe('0x20')](_0x59ef95['attributes'],function(_0x4b75e1){var _0x51c36f={};_0x51c36f[_0x4b75e1]={'$like':'%'+_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x48')]+'%'};return _0x51c36f;})});}_0x59ef95=_['merge']({},_0x59ef95,_0x45e65a[_0xf5fe('0x49')]);return _0x4afe68[_0xf5fe('0x79')](_0x59ef95);}})[_0xf5fe('0x17')](function(_0x1f8df4){if(_0x1f8df4){_0x5ab408=_0x1f8df4[_0xf5fe('0x40')];if(!_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x41')](_0xf5fe('0x55'))){_0x59ef95[_0xf5fe('0x13')]=qs['limit'](_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x13')]);_0x59ef95['offset']=qs[_0xf5fe('0x11')](_0x45e65a[_0xf5fe('0x26')][_0xf5fe('0x11')]);}return _0x4afe68['getAgents'](_0x59ef95);}})['then'](function(_0x33ce03){if(_0x33ce03){return _0x33ce03?{'count':_0x5ab408,'rows':_0x33ce03}:null;}})[_0xf5fe('0x17')](respondWithResult(_0x2c490a,null))[_0xf5fe('0x32')](handleError(_0x2c490a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 142b667..d4c0e35 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 _0x0fa7=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x216883,_0x50a34d){var _0x14c097=function(_0x5dce2a){while(--_0x5dce2a){_0x216883['push'](_0x216883['shift']());}};_0x14c097(++_0x50a34d);}(_0x0fa7,0x134));var _0x70fa=function(_0x486eab,_0x669c77){_0x486eab=_0x486eab-0x0;var _0x41e214=_0x0fa7[_0x486eab];return _0x41e214;};'use strict';var EventEmitter=require(_0x70fa('0x0'));var OpenchannelQueue=require(_0x70fa('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x70fa('0x2'),'afterDestroy':_0x70fa('0x3')};function emitEvent(_0x5b943d){return function(_0x506501,_0x58c409,_0x364b23){OpenchannelQueueEvents[_0x70fa('0x4')](_0x5b943d+':'+_0x506501['id'],_0x506501);OpenchannelQueueEvents['emit'](_0x5b943d,_0x506501);_0x364b23(null);};}for(var e in events){if(events[_0x70fa('0x5')](e)){var event=events[e];OpenchannelQueue[_0x70fa('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xd74c=['save','update','hook','exports','events','setMaxListeners'];(function(_0x155574,_0x4e0b0b){var _0x56b559=function(_0x1a4b1d){while(--_0x1a4b1d){_0x155574['push'](_0x155574['shift']());}};_0x56b559(++_0x4e0b0b);}(_0xd74c,0xee));var _0xcd74=function(_0x40a12d,_0x478905){_0x40a12d=_0x40a12d-0x0;var _0xb35f05=_0xd74c[_0x40a12d];return _0xb35f05;};'use strict';var EventEmitter=require(_0xcd74('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xcd74('0x1')](0x0);var events={'afterCreate':_0xcd74('0x2'),'afterUpdate':_0xcd74('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b0316){return function(_0x1c7693,_0x2ba977,_0x1ffe20){OpenchannelQueueEvents['emit'](_0x4b0316+':'+_0x1c7693['id'],_0x1c7693);OpenchannelQueueEvents['emit'](_0x4b0316,_0x1c7693);_0x1ffe20(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xcd74('0x4')](e,emitEvent(event));}}module[_0xcd74('0x5')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8b4fb03..af1cfe0 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 _0xd447=['util','../../config/logger','moment','bluebird','rimraf','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x153597,_0x492f6f){var _0x27d9de=function(_0x42f31f){while(--_0x42f31f){_0x153597['push'](_0x153597['shift']());}};_0x27d9de(++_0x492f6f);}(_0xd447,0x182));var _0x7d44=function(_0x32e3e6,_0x382f3a){_0x32e3e6=_0x32e3e6-0x0;var _0x21c225=_0xd447[_0x32e3e6];return _0x21c225;};'use strict';var _=require(_0x7d44('0x0'));var util=require(_0x7d44('0x1'));var logger=require(_0x7d44('0x2'))('api');var moment=require(_0x7d44('0x3'));var BPromise=require(_0x7d44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d44('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x391c80,_0x32b121){return _0x391c80[_0x7d44('0x6')](_0x7d44('0x7'),attributes,{'tableName':_0x7d44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa922=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','moment','bluebird','request-promise'];(function(_0x49777b,_0x1ba533){var _0x56a2bc=function(_0x1f4d5d){while(--_0x1f4d5d){_0x49777b['push'](_0x49777b['shift']());}};_0x56a2bc(++_0x1ba533);}(_0xa922,0x14b));var _0x2a92=function(_0x29c838,_0x47ddfb){_0x29c838=_0x29c838-0x0;var _0x449c3e=_0xa922[_0x29c838];return _0x449c3e;};'use strict';var _=require(_0x2a92('0x0'));var util=require(_0x2a92('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2a92('0x2'));var BPromise=require(_0x2a92('0x3'));var rp=require(_0x2a92('0x4'));var fs=require('fs');var path=require(_0x2a92('0x5'));var rimraf=require(_0x2a92('0x6'));var config=require(_0x2a92('0x7'));var attributes=require(_0x2a92('0x8'));module[_0x2a92('0x9')]=function(_0x2c1f99,_0x1c9621){return _0x2c1f99[_0x2a92('0xa')](_0x2a92('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 0cd5b6d..0952827 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 _0x2c0c=['catch','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','debug','stringify','ShowOpenchannelQueue','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c0c,0x140));var _0xc2c0=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x2c0c[_0x72895a];return _0x5226d5;};'use strict';var _=require(_0xc2c0('0x0'));var util=require(_0xc2c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc2c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2c0('0x3'))['db'];var utils=require(_0xc2c0('0x4'));var logger=require(_0xc2c0('0x5'))(_0xc2c0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc2c0('0x7'));var client=jayson[_0xc2c0('0x8')]['http']({'port':0x232a});config[_0xc2c0('0x9')]=_[_0xc2c0('0xa')](config[_0xc2c0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc2c0('0xb'))(new Redis(config[_0xc2c0('0x9')]));require(_0xc2c0('0xc'))['register'](socket);function respondWithRpcPromise(_0x37474a,_0x3821de,_0x1701e4){return new BPromise(function(_0x36a5e4,_0x33ee4c){return client[_0xc2c0('0xd')](_0x37474a,_0x1701e4)[_0xc2c0('0xe')](function(_0x32cfcb){logger[_0xc2c0('0xf')](_0xc2c0('0x10'),_0x3821de,_0xc2c0('0x11'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3821de,'request\x20sent',JSON['stringify'](_0x32cfcb));if(_0x32cfcb[_0xc2c0('0x12')]){if(_0x32cfcb[_0xc2c0('0x12')]['code']===0x1f4){logger[_0xc2c0('0x12')](_0xc2c0('0x10'),_0x3821de,_0x32cfcb[_0xc2c0('0x12')][_0xc2c0('0x13')]);return _0x33ee4c(_0x32cfcb[_0xc2c0('0x12')]['message']);}logger[_0xc2c0('0x12')](_0xc2c0('0x10'),_0x3821de,_0x32cfcb[_0xc2c0('0x12')]['message']);return _0x36a5e4(_0x32cfcb['error'][_0xc2c0('0x13')]);}else{logger[_0xc2c0('0xf')](_0xc2c0('0x10'),_0x3821de,_0xc2c0('0x11'));_0x36a5e4(_0x32cfcb['result'][_0xc2c0('0x13')]);}})[_0xc2c0('0x14')](function(_0x18536b){logger['error'](_0xc2c0('0x10'),_0x3821de,_0x18536b);_0x33ee4c(_0x18536b);});});}exports['GetOpenchannelQueue']=function(_0x18b691){var _0x4661d9=this;return new Promise(function(_0x1dff00,_0x3f41eb){return db[_0xc2c0('0x15')][_0xc2c0('0x16')]({'raw':_0x18b691[_0xc2c0('0x17')]?_0x18b691[_0xc2c0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x18b691['options']?_0x18b691[_0xc2c0('0x17')][_0xc2c0('0x18')]||null:null,'attributes':_0x18b691['options']?_0x18b691[_0xc2c0('0x17')][_0xc2c0('0x19')]||null:null,'limit':_0x18b691[_0xc2c0('0x17')]?_0x18b691[_0xc2c0('0x17')][_0xc2c0('0x1a')]||null:null,'include':_0x18b691[_0xc2c0('0x17')]?_0x18b691[_0xc2c0('0x17')][_0xc2c0('0x1b')]?_[_0xc2c0('0x1c')](_0x18b691['options'][_0xc2c0('0x1b')],function(_0x13c593){return{'model':db[_0x13c593['model']],'as':_0x13c593['as'],'attributes':_0x13c593[_0xc2c0('0x19')],'include':_0x13c593[_0xc2c0('0x1b')]?_[_0xc2c0('0x1c')](_0x13c593[_0xc2c0('0x1b')],function(_0x1acb2d){return{'model':db[_0x1acb2d[_0xc2c0('0x1d')]],'as':_0x1acb2d['as'],'attributes':_0x1acb2d[_0xc2c0('0x19')],'include':_0x1acb2d[_0xc2c0('0x1b')]?_[_0xc2c0('0x1c')](_0x1acb2d[_0xc2c0('0x1b')],function(_0x4eded5){return{'model':db[_0x4eded5['model']],'as':_0x4eded5['as'],'attributes':_0x4eded5[_0xc2c0('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ad873){logger[_0xc2c0('0xf')](_0xc2c0('0x1e'),_0x18b691);logger[_0xc2c0('0x1f')](_0xc2c0('0x1e'),_0x18b691,JSON[_0xc2c0('0x20')](_0x1ad873));_0x1dff00(_0x1ad873);})[_0xc2c0('0x14')](function(_0x1fd7aa){logger[_0xc2c0('0x12')](_0xc2c0('0x1e'),_0x1fd7aa['message'],_0x18b691);_0x3f41eb(_0x4661d9[_0xc2c0('0x12')](0x1f4,_0x1fd7aa[_0xc2c0('0x13')]));});});};exports[_0xc2c0('0x21')]=function(_0x230f17){var _0x1649bf=this;return new Promise(function(_0x9a8eca,_0x1b58f3){return db[_0xc2c0('0x15')]['find']({'raw':_0x230f17[_0xc2c0('0x17')]?_0x230f17[_0xc2c0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x230f17['options']?_0x230f17[_0xc2c0('0x17')][_0xc2c0('0x18')]||null:null,'attributes':_0x230f17[_0xc2c0('0x17')]?_0x230f17[_0xc2c0('0x17')]['attributes']||null:null,'include':_0x230f17[_0xc2c0('0x17')]?_0x230f17[_0xc2c0('0x17')]['include']?_[_0xc2c0('0x1c')](_0x230f17[_0xc2c0('0x17')]['include'],function(_0x521948){return{'model':db[_0x521948['model']],'as':_0x521948['as'],'attributes':_0x521948['attributes'],'include':_0x521948[_0xc2c0('0x1b')]?_[_0xc2c0('0x1c')](_0x521948['include'],function(_0x3f7153){return{'model':db[_0x3f7153[_0xc2c0('0x1d')]],'as':_0x3f7153['as'],'attributes':_0x3f7153[_0xc2c0('0x19')],'include':_0x3f7153[_0xc2c0('0x1b')]?_[_0xc2c0('0x1c')](_0x3f7153[_0xc2c0('0x1b')],function(_0x3126cc){return{'model':db[_0x3126cc['model']],'as':_0x3126cc['as'],'attributes':_0x3126cc[_0xc2c0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc2c0('0xe')](function(_0x2ff51a){logger[_0xc2c0('0xf')](_0xc2c0('0x21'),_0x230f17);logger[_0xc2c0('0x1f')](_0xc2c0('0x21'),_0x230f17,JSON[_0xc2c0('0x20')](_0x2ff51a));_0x9a8eca(_0x2ff51a);})['catch'](function(_0x109ed1){logger[_0xc2c0('0x12')](_0xc2c0('0x21'),_0x109ed1['message'],_0x230f17);_0x1b58f3(_0x1649bf[_0xc2c0('0x12')](0x1f4,_0x109ed1['message']));});});}; \ No newline at end of file +var _0xd4b0=['find','where','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueue','findAll','options','raw','attributes','limit','include','model','map','then','info','GetOpenchannelQueue','ShowOpenchannelQueue'];(function(_0x46e730,_0x402751){var _0x1e6c92=function(_0x1635e8){while(--_0x1635e8){_0x46e730['push'](_0x46e730['shift']());}};_0x1e6c92(++_0x402751);}(_0xd4b0,0x162));var _0x0d4b=function(_0x5806fa,_0x37a422){_0x5806fa=_0x5806fa-0x0;var _0x4c74d2=_0xd4b0[_0x5806fa];return _0x4c74d2;};'use strict';var _=require(_0x0d4b('0x0'));var util=require('util');var moment=require(_0x0d4b('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d4b('0x2'));var fs=require('fs');var Redis=require(_0x0d4b('0x3'));var db=require(_0x0d4b('0x4'))['db'];var utils=require(_0x0d4b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0d4b('0x6'));var jayson=require(_0x0d4b('0x7'));var client=jayson[_0x0d4b('0x8')]['http']({'port':0x232a});config[_0x0d4b('0x9')]=_[_0x0d4b('0xa')](config[_0x0d4b('0x9')],{'host':_0x0d4b('0xb'),'port':0x18eb});var socket=require(_0x0d4b('0xc'))(new Redis(config[_0x0d4b('0x9')]));require('./openchannelQueue.socket')[_0x0d4b('0xd')](socket);function respondWithRpcPromise(_0x46119e,_0x520b37,_0x2b3bc0){return new BPromise(function(_0x131651,_0x140758){return client['request'](_0x46119e,_0x2b3bc0)['then'](function(_0x3126e9){logger['info'](_0x0d4b('0xe'),_0x520b37,_0x0d4b('0xf'));logger[_0x0d4b('0x10')](_0x0d4b('0x11'),_0x520b37,_0x0d4b('0xf'),JSON[_0x0d4b('0x12')](_0x3126e9));if(_0x3126e9[_0x0d4b('0x13')]){if(_0x3126e9[_0x0d4b('0x13')][_0x0d4b('0x14')]===0x1f4){logger['error'](_0x0d4b('0xe'),_0x520b37,_0x3126e9['error'][_0x0d4b('0x15')]);return _0x140758(_0x3126e9['error']['message']);}logger[_0x0d4b('0x13')](_0x0d4b('0xe'),_0x520b37,_0x3126e9[_0x0d4b('0x13')]['message']);return _0x131651(_0x3126e9[_0x0d4b('0x13')][_0x0d4b('0x15')]);}else{logger['info'](_0x0d4b('0xe'),_0x520b37,_0x0d4b('0xf'));_0x131651(_0x3126e9[_0x0d4b('0x16')][_0x0d4b('0x15')]);}})['catch'](function(_0x12175d){logger[_0x0d4b('0x13')](_0x0d4b('0xe'),_0x520b37,_0x12175d);_0x140758(_0x12175d);});});}exports['GetOpenchannelQueue']=function(_0x94184d){var _0x24652a=this;return new Promise(function(_0x294246,_0x41cfca){return db[_0x0d4b('0x17')][_0x0d4b('0x18')]({'raw':_0x94184d[_0x0d4b('0x19')]?_0x94184d[_0x0d4b('0x19')][_0x0d4b('0x1a')]===undefined?!![]:![]:!![],'where':_0x94184d[_0x0d4b('0x19')]?_0x94184d[_0x0d4b('0x19')]['where']||null:null,'attributes':_0x94184d[_0x0d4b('0x19')]?_0x94184d[_0x0d4b('0x19')][_0x0d4b('0x1b')]||null:null,'limit':_0x94184d['options']?_0x94184d[_0x0d4b('0x19')][_0x0d4b('0x1c')]||null:null,'include':_0x94184d[_0x0d4b('0x19')]?_0x94184d[_0x0d4b('0x19')][_0x0d4b('0x1d')]?_['map'](_0x94184d[_0x0d4b('0x19')][_0x0d4b('0x1d')],function(_0x3bcd30){return{'model':db[_0x3bcd30[_0x0d4b('0x1e')]],'as':_0x3bcd30['as'],'attributes':_0x3bcd30[_0x0d4b('0x1b')],'include':_0x3bcd30['include']?_[_0x0d4b('0x1f')](_0x3bcd30['include'],function(_0x5973c5){return{'model':db[_0x5973c5[_0x0d4b('0x1e')]],'as':_0x5973c5['as'],'attributes':_0x5973c5[_0x0d4b('0x1b')],'include':_0x5973c5[_0x0d4b('0x1d')]?_[_0x0d4b('0x1f')](_0x5973c5[_0x0d4b('0x1d')],function(_0x347301){return{'model':db[_0x347301[_0x0d4b('0x1e')]],'as':_0x347301['as'],'attributes':_0x347301[_0x0d4b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d4b('0x20')](function(_0x3a6810){logger[_0x0d4b('0x21')](_0x0d4b('0x22'),_0x94184d);logger['debug'](_0x0d4b('0x22'),_0x94184d,JSON['stringify'](_0x3a6810));_0x294246(_0x3a6810);})['catch'](function(_0x4967ca){logger[_0x0d4b('0x13')](_0x0d4b('0x22'),_0x4967ca[_0x0d4b('0x15')],_0x94184d);_0x41cfca(_0x24652a[_0x0d4b('0x13')](0x1f4,_0x4967ca[_0x0d4b('0x15')]));});});};exports[_0x0d4b('0x23')]=function(_0x509227){var _0x333606=this;return new Promise(function(_0x555590,_0x53d6e1){return db[_0x0d4b('0x17')][_0x0d4b('0x24')]({'raw':_0x509227[_0x0d4b('0x19')]?_0x509227[_0x0d4b('0x19')][_0x0d4b('0x1a')]===undefined?!![]:![]:!![],'where':_0x509227[_0x0d4b('0x19')]?_0x509227['options'][_0x0d4b('0x25')]||null:null,'attributes':_0x509227[_0x0d4b('0x19')]?_0x509227[_0x0d4b('0x19')]['attributes']||null:null,'include':_0x509227[_0x0d4b('0x19')]?_0x509227[_0x0d4b('0x19')][_0x0d4b('0x1d')]?_['map'](_0x509227[_0x0d4b('0x19')][_0x0d4b('0x1d')],function(_0x1c334d){return{'model':db[_0x1c334d[_0x0d4b('0x1e')]],'as':_0x1c334d['as'],'attributes':_0x1c334d['attributes'],'include':_0x1c334d[_0x0d4b('0x1d')]?_[_0x0d4b('0x1f')](_0x1c334d[_0x0d4b('0x1d')],function(_0x36c585){return{'model':db[_0x36c585[_0x0d4b('0x1e')]],'as':_0x36c585['as'],'attributes':_0x36c585[_0x0d4b('0x1b')],'include':_0x36c585[_0x0d4b('0x1d')]?_[_0x0d4b('0x1f')](_0x36c585['include'],function(_0x41e58c){return{'model':db[_0x41e58c[_0x0d4b('0x1e')]],'as':_0x41e58c['as'],'attributes':_0x41e58c[_0x0d4b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d4b('0x20')](function(_0x4b253b){logger[_0x0d4b('0x21')](_0x0d4b('0x23'),_0x509227);logger[_0x0d4b('0x10')](_0x0d4b('0x23'),_0x509227,JSON[_0x0d4b('0x12')](_0x4b253b));_0x555590(_0x4b253b);})[_0x0d4b('0x26')](function(_0x3b0068){logger['error']('ShowOpenchannelQueue',_0x3b0068[_0x0d4b('0x15')],_0x509227);_0x53d6e1(_0x333606[_0x0d4b('0x13')](0x1f4,_0x3b0068['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3f02f60..08cab8b 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 _0x166d=['./openchannelQueue.events','emit','removeListener','register'];(function(_0x2d967a,_0x28e0ba){var _0x128a2b=function(_0x84707a){while(--_0x84707a){_0x2d967a['push'](_0x2d967a['shift']());}};_0x128a2b(++_0x28e0ba);}(_0x166d,0xc4));var _0xd166=function(_0x26aeef,_0x3c3166){_0x26aeef=_0x26aeef-0x0;var _0x12b538=_0x166d[_0x26aeef];return _0x12b538;};'use strict';var OpenchannelQueueEvents=require(_0xd166('0x0'));var events=['save','remove','update'];function createListener(_0x4ffe70,_0xdb3928){return function(_0xd3fe66){_0xdb3928[_0xd166('0x1')](_0x4ffe70,_0xd3fe66);};}function removeListener(_0x4128b5,_0x5aa606){return function(){OpenchannelQueueEvents[_0xd166('0x2')](_0x4128b5,_0x5aa606);};}exports[_0xd166('0x3')]=function(_0xd0128a){for(var _0x3fb008=0x0,_0x75e3fc=events['length'];_0x3fb008<_0x75e3fc;_0x3fb008++){var _0x2229e0=events[_0x3fb008];var _0xe29cf1=createListener('openchannelQueue:'+_0x2229e0,_0xd0128a);OpenchannelQueueEvents['on'](_0x2229e0,_0xe29cf1);}}; \ No newline at end of file +var _0xb2c8=['update','emit','removeListener','register','length','openchannelQueue:','save'];(function(_0xacd111,_0x129fe0){var _0x26dd8e=function(_0x176ed4){while(--_0x176ed4){_0xacd111['push'](_0xacd111['shift']());}};_0x26dd8e(++_0x129fe0);}(_0xb2c8,0x172));var _0x8b2c=function(_0x24138d,_0x45c37a){_0x24138d=_0x24138d-0x0;var _0x1b44e6=_0xb2c8[_0x24138d];return _0x1b44e6;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x8b2c('0x0'),'remove',_0x8b2c('0x1')];function createListener(_0x2a0d8c,_0x4aec29){return function(_0x49d467){_0x4aec29[_0x8b2c('0x2')](_0x2a0d8c,_0x49d467);};}function removeListener(_0x1a4b59,_0x200bf0){return function(){OpenchannelQueueEvents[_0x8b2c('0x3')](_0x1a4b59,_0x200bf0);};}exports[_0x8b2c('0x4')]=function(_0x59dd38){for(var _0x2ce2e1=0x0,_0x532657=events[_0x8b2c('0x5')];_0x2ce2e1<_0x532657;_0x2ce2e1++){var _0x39d994=events[_0x2ce2e1];var _0x5ba157=createListener(_0x8b2c('0x6')+_0x39d994,_0x59dd38);OpenchannelQueueEvents['on'](_0x39d994,_0x5ba157);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1a6c92d..2d01c70 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 _0x5193=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x37b36b,_0x12d5c3){var _0xb03376=function(_0x8aa9d0){while(--_0x8aa9d0){_0x37b36b['push'](_0x37b36b['shift']());}};_0xb03376(++_0x12d5c3);}(_0x5193,0xa9));var _0x3519=function(_0x380c4b,_0x7fd56b){_0x380c4b=_0x380c4b-0x0;var _0x3ad29a=_0x5193[_0x380c4b];return _0x3ad29a;};'use strict';var multer=require(_0x3519('0x0'));var util=require(_0x3519('0x1'));var path=require(_0x3519('0x2'));var timeout=require(_0x3519('0x3'));var express=require(_0x3519('0x4'));var router=express[_0x3519('0x5')]();var fs_extra=require(_0x3519('0x6'));var auth=require(_0x3519('0x7'));var interaction=require(_0x3519('0x8'));var config=require(_0x3519('0x9'));var controller=require(_0x3519('0xa'));router[_0x3519('0xb')]('/',auth[_0x3519('0xc')](),controller['index']);router['get'](_0x3519('0xd'),auth[_0x3519('0xc')](),controller[_0x3519('0xe')]);router[_0x3519('0xb')](_0x3519('0xf'),auth[_0x3519('0xc')](),controller[_0x3519('0x10')]);router[_0x3519('0x11')]('/',auth[_0x3519('0xc')](),controller[_0x3519('0x12')]);router[_0x3519('0x13')](_0x3519('0xf'),auth['isAuthenticated'](),controller[_0x3519('0x14')]);router[_0x3519('0x15')](_0x3519('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x3519('0x16')]=router; \ No newline at end of file +var _0x0a7b=['/describe','show','post','put','delete','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0a7b,0x113));var _0xb0a7=function(_0x380d9e,_0x30cb9d){_0x380d9e=_0x380d9e-0x0;var _0x56a7e5=_0x0a7b[_0x380d9e];return _0x56a7e5;};'use strict';var multer=require(_0xb0a7('0x0'));var util=require(_0xb0a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb0a7('0x3'));var interaction=require(_0xb0a7('0x4'));var config=require(_0xb0a7('0x5'));var controller=require(_0xb0a7('0x6'));router[_0xb0a7('0x7')]('/',auth[_0xb0a7('0x8')](),controller[_0xb0a7('0x9')]);router['get'](_0xb0a7('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xb0a7('0x8')](),controller[_0xb0a7('0xb')]);router[_0xb0a7('0xc')]('/',auth[_0xb0a7('0x8')](),controller['create']);router[_0xb0a7('0xd')]('/:id',auth[_0xb0a7('0x8')](),controller['update']);router[_0xb0a7('0xe')]('/:id',auth[_0xb0a7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0479b9b..c136e3b 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 _0x266c=['STRING','DATE','moment'];(function(_0x8c823e,_0x3a870c){var _0x507089=function(_0x2f12ac){while(--_0x2f12ac){_0x8c823e['push'](_0x8c823e['shift']());}};_0x507089(++_0x3a870c);}(_0x266c,0x1b5));var _0xc266=function(_0x18282d,_0x3db002){_0x18282d=_0x18282d-0x0;var _0x1bf26a=_0x266c[_0x18282d];return _0x1bf26a;};'use strict';var moment=require(_0xc266('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc266('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xc266('0x1')]},'joinAt':{'type':Sequelize[_0xc266('0x2')]},'leaveAt':{'type':Sequelize[_0xc266('0x2')]},'acceptAt':{'type':Sequelize[_0xc266('0x2')]},'exitAt':{'type':Sequelize[_0xc266('0x2')]},'reason':{'type':Sequelize[_0xc266('0x1')]}}; \ No newline at end of file +var _0xea05=['STRING','moment','sequelize','exports','DATE'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0xea05,0xe2));var _0x5ea0=function(_0x46c20f,_0x41d832){_0x46c20f=_0x46c20f-0x0;var _0x369244=_0xea05[_0x46c20f];return _0x369244;};'use strict';var moment=require(_0x5ea0('0x0'));var Sequelize=require(_0x5ea0('0x1'));module[_0x5ea0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5ea0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5ea0('0x3')]},'exitAt':{'type':Sequelize[_0x5ea0('0x3')]},'reason':{'type':Sequelize[_0x5ea0('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c56b384..ebab9ca 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 _0x1bfc=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','fieldName','type','key','keys','intersection','query','attributes','model','fields','length','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count'];(function(_0x1ca547,_0x2e1fda){var _0x48eb2b=function(_0x459c84){while(--_0x459c84){_0x1ca547['push'](_0x1ca547['shift']());}};_0x48eb2b(++_0x2e1fda);}(_0x1bfc,0x13d));var _0xc1bf=function(_0x3e8aa8,_0x213551){_0x3e8aa8=_0x3e8aa8-0x0;var _0x1edfd8=_0x1bfc[_0x3e8aa8];return _0x1edfd8;};'use strict';var emlformat=require(_0xc1bf('0x0'));var rimraf=require(_0xc1bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1bf('0x2'));var rp=require(_0xc1bf('0x3'));var moment=require(_0xc1bf('0x4'));var BPromise=require(_0xc1bf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc1bf('0x6'));var csv=require('to-csv');var ejs=require(_0xc1bf('0x7'));var fs=require('fs');var fs_extra=require(_0xc1bf('0x8'));var _=require(_0xc1bf('0x9'));var squel=require(_0xc1bf('0xa'));var crypto=require(_0xc1bf('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc1bf('0xc'));var Papa=require(_0xc1bf('0xd'));var Redis=require(_0xc1bf('0xe'));var authService=require(_0xc1bf('0xf'));var qs=require(_0xc1bf('0x10'));var as=require(_0xc1bf('0x11'));var hardwareService=require(_0xc1bf('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc1bf('0x13'));var config=require(_0xc1bf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32fe64,_0x2c76dd){_0x2c76dd=_0x2c76dd||0xcc;return function(_0x51ff17){if(_0x51ff17){return _0x32fe64['sendStatus'](_0x2c76dd);}return _0x32fe64[_0xc1bf('0x15')](_0x2c76dd)[_0xc1bf('0x16')]();};}function respondWithResult(_0x49e1b4,_0x4075b2){_0x4075b2=_0x4075b2||0xc8;return function(_0x5b9412){if(_0x5b9412){return _0x49e1b4[_0xc1bf('0x15')](_0x4075b2)[_0xc1bf('0x17')](_0x5b9412);}};}function respondWithFilteredResult(_0x22531b,_0x1cec1e){return function(_0x4cc70b){if(_0x4cc70b){var _0x582f8e=typeof _0x1cec1e[_0xc1bf('0x18')]===_0xc1bf('0x19')&&typeof _0x1cec1e[_0xc1bf('0x1a')]===_0xc1bf('0x19');var _0x3ca1d9=_0x4cc70b[_0xc1bf('0x1b')];var _0x3f45bd=_0x582f8e?0x0:_0x1cec1e[_0xc1bf('0x18')];var _0x5386a4=_0x582f8e?_0x4cc70b[_0xc1bf('0x1b')]:_0x1cec1e[_0xc1bf('0x18')]+_0x1cec1e['limit'];var _0x32fd0f;if(_0x5386a4>=_0x3ca1d9){_0x5386a4=_0x3ca1d9;_0x32fd0f=0xc8;}else{_0x32fd0f=0xce;}_0x22531b[_0xc1bf('0x15')](_0x32fd0f);return _0x22531b[_0xc1bf('0x1c')](_0xc1bf('0x1d'),_0x3f45bd+'-'+_0x5386a4+'/'+_0x3ca1d9)[_0xc1bf('0x17')](_0x4cc70b);}return null;};}function patchUpdates(_0x27f225){return function(_0x4234fd){try{jsonpatch[_0xc1bf('0x1e')](_0x4234fd,_0x27f225,!![]);}catch(_0xffab3b){return BPromise[_0xc1bf('0x1f')](_0xffab3b);}return _0x4234fd[_0xc1bf('0x20')]();};}function saveUpdates(_0x237937,_0x3fe20b){return function(_0x3d7e75){if(_0x3d7e75){return _0x3d7e75[_0xc1bf('0x21')](_0x237937)[_0xc1bf('0x22')](function(_0x409046){return _0x409046;});}return null;};}function removeEntity(_0x2416e7,_0x4a45a8){return function(_0xe2ead3){if(_0xe2ead3){return _0xe2ead3[_0xc1bf('0x23')]()['then'](function(){_0x2416e7[_0xc1bf('0x15')](0xcc)[_0xc1bf('0x16')]();});}};}function handleEntityNotFound(_0x325e51,_0x2b4744){return function(_0x1fda9d){if(!_0x1fda9d){_0x325e51['sendStatus'](0x194);}return _0x1fda9d;};}function handleError(_0x50c4e4,_0x3065cd){_0x3065cd=_0x3065cd||0x1f4;return function(_0x2e7c2e){logger[_0xc1bf('0x24')](_0x2e7c2e[_0xc1bf('0x25')]);if(_0x2e7c2e[_0xc1bf('0x26')]){delete _0x2e7c2e['name'];}_0x50c4e4[_0xc1bf('0x15')](_0x3065cd)[_0xc1bf('0x27')](_0x2e7c2e);};}exports['index']=function(_0x29853c,_0xa4e25c){var _0x36beca={},_0x1ea9a5={},_0x457597={'count':0x0,'rows':[]};var _0x22c462=_[_0xc1bf('0x28')](db[_0xc1bf('0x29')]['rawAttributes'],function(_0x3d8a19){return{'name':_0x3d8a19[_0xc1bf('0x2a')],'type':_0x3d8a19[_0xc1bf('0x2b')][_0xc1bf('0x2c')]};});_0x1ea9a5['model']=_[_0xc1bf('0x28')](_0x22c462,_0xc1bf('0x26'));_0x1ea9a5['query']=_[_0xc1bf('0x2d')](_0x29853c['query']);_0x1ea9a5['filters']=_[_0xc1bf('0x2e')](_0x1ea9a5['model'],_0x1ea9a5[_0xc1bf('0x2f')]);_0x36beca[_0xc1bf('0x30')]=_[_0xc1bf('0x2e')](_0x1ea9a5[_0xc1bf('0x31')],qs[_0xc1bf('0x32')](_0x29853c['query'][_0xc1bf('0x32')]));_0x36beca['attributes']=_0x36beca[_0xc1bf('0x30')][_0xc1bf('0x33')]?_0x36beca['attributes']:_0x1ea9a5['model'];if(!_0x29853c['query']['hasOwnProperty']('nolimit')){_0x36beca['limit']=qs['limit'](_0x29853c[_0xc1bf('0x2f')][_0xc1bf('0x1a')]);_0x36beca['offset']=qs[_0xc1bf('0x18')](_0x29853c['query'][_0xc1bf('0x18')]);}_0x36beca['order']=qs[_0xc1bf('0x34')](_0x29853c[_0xc1bf('0x2f')][_0xc1bf('0x34')]);_0x36beca['where']=qs[_0xc1bf('0x35')](_[_0xc1bf('0x36')](_0x29853c[_0xc1bf('0x2f')],_0x1ea9a5[_0xc1bf('0x35')]),_0x22c462);if(_0x29853c[_0xc1bf('0x2f')][_0xc1bf('0x37')]){_0x36beca[_0xc1bf('0x38')]=_[_0xc1bf('0x39')](_0x36beca[_0xc1bf('0x38')],{'$or':_[_0xc1bf('0x28')](_0x22c462,function(_0x568083){if(_0x568083[_0xc1bf('0x2b')]!=='VIRTUAL'){var _0x32ff06={};_0x32ff06[_0x568083['name']]={'$like':'%'+_0x29853c[_0xc1bf('0x2f')][_0xc1bf('0x37')]+'%'};return _0x32ff06;}})});}_0x36beca=_[_0xc1bf('0x39')]({},_0x36beca,_0x29853c[_0xc1bf('0x3a')]);var _0x49015e={'where':_0x36beca[_0xc1bf('0x38')]};return db[_0xc1bf('0x29')]['count'](_0x49015e)[_0xc1bf('0x22')](function(_0x10087a){_0x457597['count']=_0x10087a;if(_0x29853c[_0xc1bf('0x2f')]['includeAll']){_0x36beca[_0xc1bf('0x3b')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xc1bf('0x3c')](_0x36beca);})['then'](function(_0x5295b9){_0x457597[_0xc1bf('0x3d')]=_0x5295b9;return _0x457597;})[_0xc1bf('0x22')](respondWithFilteredResult(_0xa4e25c,_0x36beca))[_0xc1bf('0x3e')](handleError(_0xa4e25c,null));};exports[_0xc1bf('0x3f')]=function(_0x164f0a,_0x2cc752){var _0xe014f={'raw':!![],'where':{'id':_0x164f0a['params']['id']}},_0xbcaedc={};_0xbcaedc['model']=_[_0xc1bf('0x2d')](db[_0xc1bf('0x29')][_0xc1bf('0x40')]);_0xbcaedc['query']=_[_0xc1bf('0x2d')](_0x164f0a[_0xc1bf('0x2f')]);_0xbcaedc['filters']=_[_0xc1bf('0x2e')](_0xbcaedc[_0xc1bf('0x31')],_0xbcaedc[_0xc1bf('0x2f')]);_0xe014f[_0xc1bf('0x30')]=_[_0xc1bf('0x2e')](_0xbcaedc[_0xc1bf('0x31')],qs[_0xc1bf('0x32')](_0x164f0a[_0xc1bf('0x2f')][_0xc1bf('0x32')]));_0xe014f[_0xc1bf('0x30')]=_0xe014f[_0xc1bf('0x30')][_0xc1bf('0x33')]?_0xe014f['attributes']:_0xbcaedc[_0xc1bf('0x31')];if(_0x164f0a[_0xc1bf('0x2f')]['includeAll']){_0xe014f[_0xc1bf('0x3b')]=[{'all':!![]}];}_0xe014f=_[_0xc1bf('0x39')]({},_0xe014f,_0x164f0a['options']);return db[_0xc1bf('0x29')][_0xc1bf('0x41')](_0xe014f)[_0xc1bf('0x22')](handleEntityNotFound(_0x2cc752,null))['then'](respondWithResult(_0x2cc752,null))[_0xc1bf('0x3e')](handleError(_0x2cc752,null));};exports[_0xc1bf('0x42')]=function(_0x596ab2,_0x5b3b93){return db['OpenchannelQueueReport'][_0xc1bf('0x42')](_0x596ab2[_0xc1bf('0x43')],{})[_0xc1bf('0x22')](respondWithResult(_0x5b3b93,0xc9))[_0xc1bf('0x3e')](handleError(_0x5b3b93,null));};exports[_0xc1bf('0x21')]=function(_0x2b7a4e,_0x288dc5){if(_0x2b7a4e[_0xc1bf('0x43')]['id']){delete _0x2b7a4e[_0xc1bf('0x43')]['id'];}return db['OpenchannelQueueReport'][_0xc1bf('0x41')]({'where':{'id':_0x2b7a4e['params']['id']}})[_0xc1bf('0x22')](handleEntityNotFound(_0x288dc5,null))[_0xc1bf('0x22')](saveUpdates(_0x2b7a4e[_0xc1bf('0x43')],null))[_0xc1bf('0x22')](respondWithResult(_0x288dc5,null))[_0xc1bf('0x3e')](handleError(_0x288dc5,null));};exports[_0xc1bf('0x23')]=function(_0x464ec7,_0x2266ed){return db['OpenchannelQueueReport'][_0xc1bf('0x41')]({'where':{'id':_0x464ec7['params']['id']}})['then'](handleEntityNotFound(_0x2266ed,null))[_0xc1bf('0x22')](removeEntity(_0x2266ed,null))[_0xc1bf('0x3e')](handleError(_0x2266ed,null));};exports['describe']=function(_0x3b310a,_0x3711e5){return db[_0xc1bf('0x29')][_0xc1bf('0x44')]()[_0xc1bf('0x22')](respondWithResult(_0x3711e5,null))[_0xc1bf('0x3e')](handleError(_0x3711e5,null));}; \ No newline at end of file +var _0x2b32=['stack','name','send','map','OpenchannelQueueReport','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','rawAttributes','options','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','sendStatus','error'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2b32,0xfb));var _0x22b3=function(_0x5d829d,_0x14680a){_0x5d829d=_0x5d829d-0x0;var _0x25a70f=_0x2b32[_0x5d829d];return _0x25a70f;};'use strict';var emlformat=require(_0x22b3('0x0'));var rimraf=require(_0x22b3('0x1'));var zipdir=require(_0x22b3('0x2'));var jsonpatch=require(_0x22b3('0x3'));var rp=require(_0x22b3('0x4'));var moment=require(_0x22b3('0x5'));var BPromise=require(_0x22b3('0x6'));var Mustache=require(_0x22b3('0x7'));var util=require('util');var path=require(_0x22b3('0x8'));var sox=require(_0x22b3('0x9'));var csv=require(_0x22b3('0xa'));var ejs=require(_0x22b3('0xb'));var fs=require('fs');var fs_extra=require(_0x22b3('0xc'));var _=require(_0x22b3('0xd'));var squel=require(_0x22b3('0xe'));var crypto=require(_0x22b3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x22b3('0x10'));var toCsv=require(_0x22b3('0xa'));var querystring=require(_0x22b3('0x11'));var Papa=require('papaparse');var Redis=require(_0x22b3('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22b3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22b3('0x14'))('api');var utils=require(_0x22b3('0x15'));var config=require(_0x22b3('0x16'));var licenseUtil=require(_0x22b3('0x17'));var db=require(_0x22b3('0x18'))['db'];function respondWithStatusCode(_0x2b530e,_0x24d1c3){_0x24d1c3=_0x24d1c3||0xcc;return function(_0x22e84b){if(_0x22e84b){return _0x2b530e['sendStatus'](_0x24d1c3);}return _0x2b530e[_0x22b3('0x19')](_0x24d1c3)[_0x22b3('0x1a')]();};}function respondWithResult(_0x273d44,_0x33affb){_0x33affb=_0x33affb||0xc8;return function(_0x4ca244){if(_0x4ca244){return _0x273d44['status'](_0x33affb)['json'](_0x4ca244);}};}function respondWithFilteredResult(_0x3f16fa,_0x59da23){return function(_0x2a0209){if(_0x2a0209){var _0x516124=typeof _0x59da23[_0x22b3('0x1b')]===_0x22b3('0x1c')&&typeof _0x59da23[_0x22b3('0x1d')]===_0x22b3('0x1c');var _0x2bec2b=_0x2a0209[_0x22b3('0x1e')];var _0xa37cae=_0x516124?0x0:_0x59da23[_0x22b3('0x1b')];var _0x512016=_0x516124?_0x2a0209[_0x22b3('0x1e')]:_0x59da23[_0x22b3('0x1b')]+_0x59da23[_0x22b3('0x1d')];var _0x2136c0;if(_0x512016>=_0x2bec2b){_0x512016=_0x2bec2b;_0x2136c0=0xc8;}else{_0x2136c0=0xce;}_0x3f16fa['status'](_0x2136c0);return _0x3f16fa[_0x22b3('0x1f')](_0x22b3('0x20'),_0xa37cae+'-'+_0x512016+'/'+_0x2bec2b)[_0x22b3('0x21')](_0x2a0209);}return null;};}function patchUpdates(_0x3a15be){return function(_0x1e4422){try{jsonpatch['apply'](_0x1e4422,_0x3a15be,!![]);}catch(_0x13d8de){return BPromise[_0x22b3('0x22')](_0x13d8de);}return _0x1e4422[_0x22b3('0x23')]();};}function saveUpdates(_0x34c7c5,_0x41c61f){return function(_0x4f6ada){if(_0x4f6ada){return _0x4f6ada[_0x22b3('0x24')](_0x34c7c5)['then'](function(_0x5b13f5){return _0x5b13f5;});}return null;};}function removeEntity(_0x16fce2,_0x5d70be){return function(_0x2d7225){if(_0x2d7225){return _0x2d7225[_0x22b3('0x25')]()[_0x22b3('0x26')](function(){_0x16fce2[_0x22b3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559669,_0x4f8618){return function(_0x42e0db){if(!_0x42e0db){_0x559669[_0x22b3('0x27')](0x194);}return _0x42e0db;};}function handleError(_0x50c6a2,_0x1ad279){_0x1ad279=_0x1ad279||0x1f4;return function(_0x4e76a3){logger[_0x22b3('0x28')](_0x4e76a3[_0x22b3('0x29')]);if(_0x4e76a3[_0x22b3('0x2a')]){delete _0x4e76a3[_0x22b3('0x2a')];}_0x50c6a2['status'](_0x1ad279)[_0x22b3('0x2b')](_0x4e76a3);};}exports['index']=function(_0x59248a,_0x3dd219){var _0x5195f7={},_0x28cacf={},_0x2838b0={'count':0x0,'rows':[]};var _0x30a69b=_[_0x22b3('0x2c')](db[_0x22b3('0x2d')]['rawAttributes'],function(_0x54ac05){return{'name':_0x54ac05['fieldName'],'type':_0x54ac05[_0x22b3('0x2e')]['key']};});_0x28cacf[_0x22b3('0x2f')]=_['map'](_0x30a69b,_0x22b3('0x2a'));_0x28cacf[_0x22b3('0x30')]=_[_0x22b3('0x31')](_0x59248a[_0x22b3('0x30')]);_0x28cacf[_0x22b3('0x32')]=_[_0x22b3('0x33')](_0x28cacf[_0x22b3('0x2f')],_0x28cacf[_0x22b3('0x30')]);_0x5195f7[_0x22b3('0x34')]=_[_0x22b3('0x33')](_0x28cacf['model'],qs[_0x22b3('0x35')](_0x59248a[_0x22b3('0x30')][_0x22b3('0x35')]));_0x5195f7[_0x22b3('0x34')]=_0x5195f7[_0x22b3('0x34')][_0x22b3('0x36')]?_0x5195f7[_0x22b3('0x34')]:_0x28cacf[_0x22b3('0x2f')];if(!_0x59248a['query']['hasOwnProperty'](_0x22b3('0x37'))){_0x5195f7[_0x22b3('0x1d')]=qs[_0x22b3('0x1d')](_0x59248a[_0x22b3('0x30')][_0x22b3('0x1d')]);_0x5195f7[_0x22b3('0x1b')]=qs[_0x22b3('0x1b')](_0x59248a['query']['offset']);}_0x5195f7[_0x22b3('0x38')]=qs[_0x22b3('0x39')](_0x59248a['query'][_0x22b3('0x39')]);_0x5195f7[_0x22b3('0x3a')]=qs[_0x22b3('0x32')](_[_0x22b3('0x3b')](_0x59248a[_0x22b3('0x30')],_0x28cacf[_0x22b3('0x32')]),_0x30a69b);if(_0x59248a[_0x22b3('0x30')][_0x22b3('0x3c')]){_0x5195f7['where']=_[_0x22b3('0x3d')](_0x5195f7[_0x22b3('0x3a')],{'$or':_['map'](_0x30a69b,function(_0x3bc16b){if(_0x3bc16b['type']!=='VIRTUAL'){var _0x1d15ff={};_0x1d15ff[_0x3bc16b[_0x22b3('0x2a')]]={'$like':'%'+_0x59248a[_0x22b3('0x30')][_0x22b3('0x3c')]+'%'};return _0x1d15ff;}})});}_0x5195f7=_['merge']({},_0x5195f7,_0x59248a['options']);var _0x315263={'where':_0x5195f7[_0x22b3('0x3a')]};return db[_0x22b3('0x2d')]['count'](_0x315263)[_0x22b3('0x26')](function(_0x27526e){_0x2838b0[_0x22b3('0x1e')]=_0x27526e;if(_0x59248a['query'][_0x22b3('0x3e')]){_0x5195f7[_0x22b3('0x3f')]=[{'all':!![]}];}return db[_0x22b3('0x2d')]['findAll'](_0x5195f7);})[_0x22b3('0x26')](function(_0x2c6c78){_0x2838b0[_0x22b3('0x40')]=_0x2c6c78;return _0x2838b0;})[_0x22b3('0x26')](respondWithFilteredResult(_0x3dd219,_0x5195f7))[_0x22b3('0x41')](handleError(_0x3dd219,null));};exports[_0x22b3('0x42')]=function(_0x579da4,_0x556bd7){var _0x19109e={'raw':!![],'where':{'id':_0x579da4['params']['id']}},_0x248a99={};_0x248a99[_0x22b3('0x2f')]=_[_0x22b3('0x31')](db[_0x22b3('0x2d')][_0x22b3('0x43')]);_0x248a99['query']=_['keys'](_0x579da4['query']);_0x248a99[_0x22b3('0x32')]=_['intersection'](_0x248a99['model'],_0x248a99[_0x22b3('0x30')]);_0x19109e[_0x22b3('0x34')]=_['intersection'](_0x248a99[_0x22b3('0x2f')],qs[_0x22b3('0x35')](_0x579da4[_0x22b3('0x30')][_0x22b3('0x35')]));_0x19109e['attributes']=_0x19109e[_0x22b3('0x34')]['length']?_0x19109e[_0x22b3('0x34')]:_0x248a99['model'];if(_0x579da4['query'][_0x22b3('0x3e')]){_0x19109e['include']=[{'all':!![]}];}_0x19109e=_[_0x22b3('0x3d')]({},_0x19109e,_0x579da4[_0x22b3('0x44')]);return db['OpenchannelQueueReport'][_0x22b3('0x45')](_0x19109e)[_0x22b3('0x26')](handleEntityNotFound(_0x556bd7,null))[_0x22b3('0x26')](respondWithResult(_0x556bd7,null))[_0x22b3('0x41')](handleError(_0x556bd7,null));};exports['create']=function(_0xa504fd,_0x3a6a57){return db['OpenchannelQueueReport']['create'](_0xa504fd[_0x22b3('0x46')],{})[_0x22b3('0x26')](respondWithResult(_0x3a6a57,0xc9))[_0x22b3('0x41')](handleError(_0x3a6a57,null));};exports[_0x22b3('0x24')]=function(_0x38cef5,_0x1048c9){if(_0x38cef5[_0x22b3('0x46')]['id']){delete _0x38cef5[_0x22b3('0x46')]['id'];}return db[_0x22b3('0x2d')][_0x22b3('0x45')]({'where':{'id':_0x38cef5[_0x22b3('0x47')]['id']}})[_0x22b3('0x26')](handleEntityNotFound(_0x1048c9,null))[_0x22b3('0x26')](saveUpdates(_0x38cef5['body'],null))[_0x22b3('0x26')](respondWithResult(_0x1048c9,null))[_0x22b3('0x41')](handleError(_0x1048c9,null));};exports[_0x22b3('0x25')]=function(_0x18191b,_0x4855f0){return db[_0x22b3('0x2d')][_0x22b3('0x45')]({'where':{'id':_0x18191b['params']['id']}})[_0x22b3('0x26')](handleEntityNotFound(_0x4855f0,null))[_0x22b3('0x26')](removeEntity(_0x4855f0,null))[_0x22b3('0x41')](handleError(_0x4855f0,null));};exports[_0x22b3('0x48')]=function(_0x50dacc,_0x522bb0){return db[_0x22b3('0x2d')]['describe']()[_0x22b3('0x26')](respondWithResult(_0x522bb0,null))['catch'](handleError(_0x522bb0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6965000..6268c45 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x44195f,_0x55b0ae){var _0xbdf6a=function(_0x37af98){while(--_0x37af98){_0x44195f['push'](_0x44195f['shift']());}};_0xbdf6a(++_0x55b0ae);}(_0x7a54,0x106));var _0x47a5=function(_0x58e84c,_0x6827aa){_0x58e84c=_0x58e84c-0x0;var _0x2a5c2c=_0x7a54[_0x58e84c];return _0x2a5c2c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0xcbdbc4,_0x2614a2){var _0xf2322e=function(_0x1ef474){while(--_0x1ef474){_0xcbdbc4['push'](_0xcbdbc4['shift']());}};_0xf2322e(++_0x2614a2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c5e04b6..164e033 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 _0xdc91=['stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3d1db0,_0x5e2587){var _0x374cab=function(_0x5eac8b){while(--_0x5eac8b){_0x3d1db0['push'](_0x3d1db0['shift']());}};_0x374cab(++_0x5e2587);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1b859a,_0x16f1c2){_0x1b859a=_0x1b859a-0x0;var _0x401b65=_0xdc91[_0x1b859a];return _0x401b65;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x2'))['db'];var utils=require(_0x1dc9('0x3'));var logger=require(_0x1dc9('0x4'))(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var jayson=require(_0x1dc9('0x7'));var client=jayson[_0x1dc9('0x8')][_0x1dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac058,_0x2c6e6c,_0x25a752){return new BPromise(function(_0x316995,_0x3d1772){return client[_0x1dc9('0xa')](_0x5ac058,_0x25a752)[_0x1dc9('0xb')](function(_0x43c405){logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,_0x1dc9('0xe'));logger['debug'](_0x1dc9('0xf'),_0x2c6e6c,'request\x20sent',JSON[_0x1dc9('0x10')](_0x43c405));if(_0x43c405['error']){if(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x12')]===0x1f4){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error'][_0x1dc9('0x13')]);return _0x3d1772(_0x43c405[_0x1dc9('0x11')]['message']);}logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error']['message']);return _0x316995(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x13')]);}else{logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,'request\x20sent');_0x316995(_0x43c405['result'][_0x1dc9('0x13')]);}})[_0x1dc9('0x14')](function(_0x5cccb9){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x5cccb9);_0x3d1772(_0x5cccb9);});});}exports[_0x1dc9('0x15')]=function(_0x197bcd){var _0x335590=this;return new Promise(function(_0x1e845a,_0x2442d0){return db[_0x1dc9('0x16')][_0x1dc9('0x17')](_0x197bcd[_0x1dc9('0x18')],{'raw':_0x197bcd[_0x1dc9('0x19')]?_0x197bcd[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x49bd5b){logger[_0x1dc9('0xc')]('CreateOpenchannelQueueReport',_0x197bcd);logger['debug']('CreateOpenchannelQueueReport',_0x197bcd,JSON[_0x1dc9('0x10')](_0x49bd5b));_0x1e845a(_0x49bd5b);})[_0x1dc9('0x14')](function(_0x277499){logger[_0x1dc9('0x11')](_0x1dc9('0x15'),_0x277499[_0x1dc9('0x13')],_0x197bcd);_0x2442d0(_0x335590[_0x1dc9('0x11')](0x1f4,_0x277499['message']));});});};exports[_0x1dc9('0x1b')]=function(_0x2a4740){var _0x14181d=this;return new Promise(function(_0x4c6e65,_0x39f3f7){return db[_0x1dc9('0x16')][_0x1dc9('0x1c')](_0x2a4740[_0x1dc9('0x18')],{'raw':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')]['where']||null:null,'attributes':_0x2a4740['options']?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1d')]||null:null,'limit':_0x2a4740[_0x1dc9('0x19')]?_0x2a4740[_0x1dc9('0x19')][_0x1dc9('0x1e')]||null:null})[_0x1dc9('0xb')](function(_0x10123d){logger[_0x1dc9('0xc')](_0x1dc9('0x1b'),_0x2a4740);logger['debug'](_0x1dc9('0x1b'),_0x2a4740,JSON[_0x1dc9('0x10')](_0x10123d));_0x4c6e65(_0x10123d);})[_0x1dc9('0x14')](function(_0x2d75bc){logger[_0x1dc9('0x11')](_0x1dc9('0x1b'),_0x2d75bc['message'],_0x2a4740);_0x39f3f7(_0x14181d['error'](0x1f4,_0x2d75bc[_0x1dc9('0x13')]));});});}; \ No newline at end of file +var _0x9ccd=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','limit','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x101924,_0x2ec1d4){var _0x1fde9=function(_0x3895ae){while(--_0x3895ae){_0x101924['push'](_0x101924['shift']());}};_0x1fde9(++_0x2ec1d4);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});}exports[_0xd9cc('0x16')]=function(_0x2e2baa){var _0x5a4b50=this;return new Promise(function(_0x37b745,_0x32df89){return db['OpenchannelQueueReport'][_0xd9cc('0x17')](_0x2e2baa[_0xd9cc('0x18')],{'raw':_0x2e2baa[_0xd9cc('0x19')]?_0x2e2baa[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![]})[_0xd9cc('0xb')](function(_0x59f00d){logger['info'](_0xd9cc('0x16'),_0x2e2baa);logger[_0xd9cc('0xe')](_0xd9cc('0x16'),_0x2e2baa,JSON[_0xd9cc('0x11')](_0x59f00d));_0x37b745(_0x59f00d);})[_0xd9cc('0x15')](function(_0x426a5c){logger[_0xd9cc('0x12')](_0xd9cc('0x16'),_0x426a5c[_0xd9cc('0x14')],_0x2e2baa);_0x32df89(_0x5a4b50[_0xd9cc('0x12')](0x1f4,_0x426a5c[_0xd9cc('0x14')]));});});};exports[_0xd9cc('0x1b')]=function(_0x45b05a){var _0x35fb49=this;return new Promise(function(_0x503451,_0xc74622){return db[_0xd9cc('0x1c')]['update'](_0x45b05a[_0xd9cc('0x18')],{'raw':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1d')]||null:null,'attributes':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')]['attributes']||null:null,'limit':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1e')]||null:null})[_0xd9cc('0xb')](function(_0xfcd78c){logger[_0xd9cc('0xc')](_0xd9cc('0x1b'),_0x45b05a);logger[_0xd9cc('0xe')]('UpdateOpenchannelQueueReport',_0x45b05a,JSON[_0xd9cc('0x11')](_0xfcd78c));_0x503451(_0xfcd78c);})[_0xd9cc('0x15')](function(_0x42d185){logger[_0xd9cc('0x12')](_0xd9cc('0x1b'),_0x42d185[_0xd9cc('0x14')],_0x45b05a);_0xc74622(_0x35fb49['error'](0x1f4,_0x42d185[_0xd9cc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 62fe754..5693f94 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 _0xd558=['put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xd558,0xc3));var _0x8d55=function(_0x4ec2d9,_0x3c0bf8){_0x4ec2d9=_0x4ec2d9-0x0;var _0x40c49f=_0xd558[_0x4ec2d9];return _0x40c49f;};'use strict';var multer=require(_0x8d55('0x0'));var util=require('util');var path=require(_0x8d55('0x1'));var timeout=require(_0x8d55('0x2'));var express=require('express');var router=express[_0x8d55('0x3')]();var fs_extra=require(_0x8d55('0x4'));var auth=require(_0x8d55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d55('0x6'));var controller=require(_0x8d55('0x7'));router[_0x8d55('0x8')]('/',auth[_0x8d55('0x9')](),controller[_0x8d55('0xa')]);router['get'](_0x8d55('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8d55('0x8')]('/:id',auth[_0x8d55('0x9')](),controller[_0x8d55('0xc')]);router[_0x8d55('0xd')]('/',auth[_0x8d55('0x9')](),controller[_0x8d55('0xe')]);router[_0x8d55('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8d55('0x10')]);router[_0x8d55('0x11')](_0x8d55('0x12'),auth['isAuthenticated'](),controller[_0x8d55('0x13')]);module[_0x8d55('0x14')]=router; \ No newline at end of file +var _0x33ad=['get','index','/describe','isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x28406a,_0x125f4b){var _0x21295d=function(_0x403b9b){while(--_0x403b9b){_0x28406a['push'](_0x28406a['shift']());}};_0x21295d(++_0x125f4b);}(_0x33ad,0x1c2));var _0xd33a=function(_0x120958,_0x22f339){_0x120958=_0x120958-0x0;var _0x106697=_0x33ad[_0x120958];return _0x106697;};'use strict';var multer=require(_0xd33a('0x0'));var util=require(_0xd33a('0x1'));var path=require(_0xd33a('0x2'));var timeout=require(_0xd33a('0x3'));var express=require('express');var router=express[_0xd33a('0x4')]();var fs_extra=require(_0xd33a('0x5'));var auth=require(_0xd33a('0x6'));var interaction=require(_0xd33a('0x7'));var config=require(_0xd33a('0x8'));var controller=require(_0xd33a('0x9'));router[_0xd33a('0xa')]('/',auth['isAuthenticated'](),controller[_0xd33a('0xb')]);router[_0xd33a('0xa')](_0xd33a('0xc'),auth[_0xd33a('0xd')](),controller['describe']);router[_0xd33a('0xa')]('/:id',auth[_0xd33a('0xd')](),controller[_0xd33a('0xe')]);router[_0xd33a('0xf')]('/',auth[_0xd33a('0xd')](),controller[_0xd33a('0x10')]);router['put']('/:id',auth[_0xd33a('0xd')](),controller[_0xd33a('0x11')]);router[_0xd33a('0x12')]('/:id',auth[_0xd33a('0xd')](),controller['destroy']);module[_0xd33a('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 10ac4f8..f0c1bfc 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1e8cba,_0x29a703){var _0x214cfb=function(_0x1fcf30){while(--_0x1fcf30){_0x1e8cba['push'](_0x1e8cba['shift']());}};_0x214cfb(++_0x29a703);}(_0xaa88,0x137));var _0x8aa8=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0xaa88[_0x217ff6];return _0x417c93;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 054c784..a5adac1 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 _0x49fe=['rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','OpenchannelTransferReport'];(function(_0x564791,_0x2a6353){var _0x386535=function(_0x1b069e){while(--_0x1b069e){_0x564791['push'](_0x564791['shift']());}};_0x386535(++_0x2a6353);}(_0x49fe,0x100));var _0xe49f=function(_0x4ebbfe,_0x2fd9fe){_0x4ebbfe=_0x4ebbfe-0x0;var _0x2db526=_0x49fe[_0x4ebbfe];return _0x2db526;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require(_0xe49f('0x1'));var zipdir=require(_0xe49f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe49f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe49f('0x4'));var util=require(_0xe49f('0x5'));var path=require(_0xe49f('0x6'));var sox=require(_0xe49f('0x7'));var csv=require('to-csv');var ejs=require(_0xe49f('0x8'));var fs=require('fs');var fs_extra=require(_0xe49f('0x9'));var _=require(_0xe49f('0xa'));var squel=require(_0xe49f('0xb'));var crypto=require('crypto');var jsforce=require(_0xe49f('0xc'));var deskjs=require(_0xe49f('0xd'));var toCsv=require(_0xe49f('0xe'));var querystring=require(_0xe49f('0xf'));var Papa=require(_0xe49f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe49f('0x11'));var as=require(_0xe49f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe49f('0x13'));var utils=require(_0xe49f('0x14'));var config=require(_0xe49f('0x15'));var licenseUtil=require(_0xe49f('0x16'));var db=require(_0xe49f('0x17'))['db'];function respondWithStatusCode(_0x1d5ecc,_0x564edb){_0x564edb=_0x564edb||0xcc;return function(_0x5c8b24){if(_0x5c8b24){return _0x1d5ecc[_0xe49f('0x18')](_0x564edb);}return _0x1d5ecc[_0xe49f('0x19')](_0x564edb)[_0xe49f('0x1a')]();};}function respondWithResult(_0x4213f6,_0x1cd9b4){_0x1cd9b4=_0x1cd9b4||0xc8;return function(_0x517e43){if(_0x517e43){return _0x4213f6[_0xe49f('0x19')](_0x1cd9b4)[_0xe49f('0x1b')](_0x517e43);}};}function respondWithFilteredResult(_0x2cff19,_0x575030){return function(_0x1b9291){if(_0x1b9291){var _0x4268b3=typeof _0x575030[_0xe49f('0x1c')]==='undefined'&&typeof _0x575030[_0xe49f('0x1d')]===_0xe49f('0x1e');var _0x37c30f=_0x1b9291[_0xe49f('0x1f')];var _0x3fcfa4=_0x4268b3?0x0:_0x575030[_0xe49f('0x1c')];var _0xdec8d=_0x4268b3?_0x1b9291[_0xe49f('0x1f')]:_0x575030['offset']+_0x575030[_0xe49f('0x1d')];var _0x4b159c;if(_0xdec8d>=_0x37c30f){_0xdec8d=_0x37c30f;_0x4b159c=0xc8;}else{_0x4b159c=0xce;}_0x2cff19[_0xe49f('0x19')](_0x4b159c);return _0x2cff19[_0xe49f('0x20')](_0xe49f('0x21'),_0x3fcfa4+'-'+_0xdec8d+'/'+_0x37c30f)[_0xe49f('0x1b')](_0x1b9291);}return null;};}function patchUpdates(_0x2a054e){return function(_0xfe4d5d){try{jsonpatch['apply'](_0xfe4d5d,_0x2a054e,!![]);}catch(_0x1a21e9){return BPromise[_0xe49f('0x22')](_0x1a21e9);}return _0xfe4d5d[_0xe49f('0x23')]();};}function saveUpdates(_0x128b89,_0x554398){return function(_0x40018d){if(_0x40018d){return _0x40018d['update'](_0x128b89)[_0xe49f('0x24')](function(_0x11f953){return _0x11f953;});}return null;};}function removeEntity(_0xf0ebd,_0x5e8908){return function(_0x3470e1){if(_0x3470e1){return _0x3470e1[_0xe49f('0x25')]()[_0xe49f('0x24')](function(){_0xf0ebd[_0xe49f('0x19')](0xcc)[_0xe49f('0x1a')]();});}};}function handleEntityNotFound(_0x4d8f38,_0x60cdfa){return function(_0x15cbef){if(!_0x15cbef){_0x4d8f38[_0xe49f('0x18')](0x194);}return _0x15cbef;};}function handleError(_0x3e434c,_0x3708ac){_0x3708ac=_0x3708ac||0x1f4;return function(_0x47aee6){logger['error'](_0x47aee6[_0xe49f('0x26')]);if(_0x47aee6[_0xe49f('0x27')]){delete _0x47aee6[_0xe49f('0x27')];}_0x3e434c['status'](_0x3708ac)[_0xe49f('0x28')](_0x47aee6);};}exports[_0xe49f('0x29')]=function(_0x3b31c3,_0x3b7bf0){var _0x276ecd={},_0x28d6c0={},_0x131713={'count':0x0,'rows':[]};var _0x1558ed=_[_0xe49f('0x2a')](db[_0xe49f('0x2b')][_0xe49f('0x2c')],function(_0x31a190){return{'name':_0x31a190[_0xe49f('0x2d')],'type':_0x31a190['type'][_0xe49f('0x2e')]};});_0x28d6c0[_0xe49f('0x2f')]=_['map'](_0x1558ed,'name');_0x28d6c0[_0xe49f('0x30')]=_['keys'](_0x3b31c3[_0xe49f('0x30')]);_0x28d6c0[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0x28d6c0['model'],_0x28d6c0[_0xe49f('0x30')]);_0x276ecd['attributes']=_[_0xe49f('0x32')](_0x28d6c0[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0x3b31c3[_0xe49f('0x30')][_0xe49f('0x33')]));_0x276ecd[_0xe49f('0x34')]=_0x276ecd[_0xe49f('0x34')][_0xe49f('0x35')]?_0x276ecd[_0xe49f('0x34')]:_0x28d6c0['model'];if(!_0x3b31c3[_0xe49f('0x30')][_0xe49f('0x36')](_0xe49f('0x37'))){_0x276ecd[_0xe49f('0x1d')]=qs[_0xe49f('0x1d')](_0x3b31c3[_0xe49f('0x30')][_0xe49f('0x1d')]);_0x276ecd[_0xe49f('0x1c')]=qs[_0xe49f('0x1c')](_0x3b31c3[_0xe49f('0x30')]['offset']);}_0x276ecd['order']=qs[_0xe49f('0x38')](_0x3b31c3[_0xe49f('0x30')]['sort']);_0x276ecd[_0xe49f('0x39')]=qs['filters'](_[_0xe49f('0x3a')](_0x3b31c3[_0xe49f('0x30')],_0x28d6c0['filters']),_0x1558ed);if(_0x3b31c3[_0xe49f('0x30')][_0xe49f('0x3b')]){_0x276ecd[_0xe49f('0x39')]=_[_0xe49f('0x3c')](_0x276ecd[_0xe49f('0x39')],{'$or':_[_0xe49f('0x2a')](_0x1558ed,function(_0x4f9bea){if(_0x4f9bea[_0xe49f('0x3d')]!==_0xe49f('0x3e')){var _0xab5b9e={};_0xab5b9e[_0x4f9bea[_0xe49f('0x27')]]={'$like':'%'+_0x3b31c3[_0xe49f('0x30')]['filter']+'%'};return _0xab5b9e;}})});}_0x276ecd=_['merge']({},_0x276ecd,_0x3b31c3[_0xe49f('0x3f')]);var _0x1c1188={'where':_0x276ecd[_0xe49f('0x39')]};return db['OpenchannelTransferReport'][_0xe49f('0x1f')](_0x1c1188)['then'](function(_0x57509c){_0x131713[_0xe49f('0x1f')]=_0x57509c;if(_0x3b31c3[_0xe49f('0x30')][_0xe49f('0x40')]){_0x276ecd[_0xe49f('0x41')]=[{'all':!![]}];}return db[_0xe49f('0x2b')][_0xe49f('0x42')](_0x276ecd);})[_0xe49f('0x24')](function(_0x3a3429){_0x131713[_0xe49f('0x43')]=_0x3a3429;return _0x131713;})['then'](respondWithFilteredResult(_0x3b7bf0,_0x276ecd))['catch'](handleError(_0x3b7bf0,null));};exports['show']=function(_0xdaedc1,_0x32f4fa){var _0x2f9a39={'raw':!![],'where':{'id':_0xdaedc1[_0xe49f('0x44')]['id']}},_0x11b4db={};_0x11b4db['model']=_[_0xe49f('0x45')](db[_0xe49f('0x2b')]['rawAttributes']);_0x11b4db[_0xe49f('0x30')]=_[_0xe49f('0x45')](_0xdaedc1[_0xe49f('0x30')]);_0x11b4db['filters']=_['intersection'](_0x11b4db[_0xe49f('0x2f')],_0x11b4db[_0xe49f('0x30')]);_0x2f9a39[_0xe49f('0x34')]=_[_0xe49f('0x32')](_0x11b4db['model'],qs[_0xe49f('0x33')](_0xdaedc1[_0xe49f('0x30')][_0xe49f('0x33')]));_0x2f9a39[_0xe49f('0x34')]=_0x2f9a39['attributes'][_0xe49f('0x35')]?_0x2f9a39['attributes']:_0x11b4db[_0xe49f('0x2f')];if(_0xdaedc1[_0xe49f('0x30')][_0xe49f('0x40')]){_0x2f9a39[_0xe49f('0x41')]=[{'all':!![]}];}_0x2f9a39=_[_0xe49f('0x3c')]({},_0x2f9a39,_0xdaedc1[_0xe49f('0x3f')]);return db[_0xe49f('0x2b')][_0xe49f('0x46')](_0x2f9a39)['then'](handleEntityNotFound(_0x32f4fa,null))['then'](respondWithResult(_0x32f4fa,null))[_0xe49f('0x47')](handleError(_0x32f4fa,null));};exports[_0xe49f('0x48')]=function(_0x19bf1f,_0x18828d){return db[_0xe49f('0x2b')][_0xe49f('0x48')](_0x19bf1f[_0xe49f('0x49')],{})[_0xe49f('0x24')](respondWithResult(_0x18828d,0xc9))['catch'](handleError(_0x18828d,null));};exports['update']=function(_0x302e7d,_0x25e77f){if(_0x302e7d[_0xe49f('0x49')]['id']){delete _0x302e7d[_0xe49f('0x49')]['id'];}return db[_0xe49f('0x2b')]['find']({'where':{'id':_0x302e7d[_0xe49f('0x44')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x25e77f,null))[_0xe49f('0x24')](saveUpdates(_0x302e7d[_0xe49f('0x49')],null))[_0xe49f('0x24')](respondWithResult(_0x25e77f,null))[_0xe49f('0x47')](handleError(_0x25e77f,null));};exports['destroy']=function(_0x38d9bf,_0x4272cd){return db['OpenchannelTransferReport'][_0xe49f('0x46')]({'where':{'id':_0x38d9bf[_0xe49f('0x44')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x4272cd,null))[_0xe49f('0x24')](removeEntity(_0x4272cd,null))[_0xe49f('0x47')](handleError(_0x4272cd,null));};exports[_0xe49f('0x4a')]=function(_0x11ab4d,_0xdeb687){return db[_0xe49f('0x2b')][_0xe49f('0x4a')]()['then'](respondWithResult(_0xdeb687,null))['catch'](handleError(_0xdeb687,null));}; \ No newline at end of file +var _0x945c=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','fieldName'];(function(_0xf980e,_0xde7c92){var _0x300bc6=function(_0x382990){while(--_0x382990){_0xf980e['push'](_0xf980e['shift']());}};_0x300bc6(++_0xde7c92);}(_0x945c,0xb4));var _0xc945=function(_0x56c43c,_0x54fc87){_0x56c43c=_0x56c43c-0x0;var _0x42a121=_0x945c[_0x56c43c];return _0x42a121;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc945('0x0'));var zipdir=require(_0xc945('0x1'));var jsonpatch=require(_0xc945('0x2'));var rp=require(_0xc945('0x3'));var moment=require(_0xc945('0x4'));var BPromise=require(_0xc945('0x5'));var Mustache=require('mustache');var util=require(_0xc945('0x6'));var path=require(_0xc945('0x7'));var sox=require(_0xc945('0x8'));var csv=require(_0xc945('0x9'));var ejs=require(_0xc945('0xa'));var fs=require('fs');var fs_extra=require(_0xc945('0xb'));var _=require(_0xc945('0xc'));var squel=require(_0xc945('0xd'));var crypto=require(_0xc945('0xe'));var jsforce=require(_0xc945('0xf'));var deskjs=require(_0xc945('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc945('0x11'));var Papa=require(_0xc945('0x12'));var Redis=require(_0xc945('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc945('0x14'));var as=require(_0xc945('0x15'));var hardwareService=require(_0xc945('0x16'));var logger=require(_0xc945('0x17'))('api');var utils=require(_0xc945('0x18'));var config=require(_0xc945('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc945('0x1a'))['db'];function respondWithStatusCode(_0x14b2e0,_0x61d9c7){_0x61d9c7=_0x61d9c7||0xcc;return function(_0x3e9577){if(_0x3e9577){return _0x14b2e0[_0xc945('0x1b')](_0x61d9c7);}return _0x14b2e0['status'](_0x61d9c7)[_0xc945('0x1c')]();};}function respondWithResult(_0x17c456,_0x2423c0){_0x2423c0=_0x2423c0||0xc8;return function(_0x34b1d1){if(_0x34b1d1){return _0x17c456[_0xc945('0x1d')](_0x2423c0)[_0xc945('0x1e')](_0x34b1d1);}};}function respondWithFilteredResult(_0x389fa5,_0x2a9e57){return function(_0x39c88b){if(_0x39c88b){var _0x1e956e=typeof _0x2a9e57[_0xc945('0x1f')]===_0xc945('0x20')&&typeof _0x2a9e57[_0xc945('0x21')]===_0xc945('0x20');var _0x313f94=_0x39c88b[_0xc945('0x22')];var _0x357b1c=_0x1e956e?0x0:_0x2a9e57[_0xc945('0x1f')];var _0x5529f7=_0x1e956e?_0x39c88b[_0xc945('0x22')]:_0x2a9e57['offset']+_0x2a9e57[_0xc945('0x21')];var _0x558c5f;if(_0x5529f7>=_0x313f94){_0x5529f7=_0x313f94;_0x558c5f=0xc8;}else{_0x558c5f=0xce;}_0x389fa5['status'](_0x558c5f);return _0x389fa5[_0xc945('0x23')]('Content-Range',_0x357b1c+'-'+_0x5529f7+'/'+_0x313f94)[_0xc945('0x1e')](_0x39c88b);}return null;};}function patchUpdates(_0x59cb41){return function(_0x415364){try{jsonpatch[_0xc945('0x24')](_0x415364,_0x59cb41,!![]);}catch(_0x3748b2){return BPromise[_0xc945('0x25')](_0x3748b2);}return _0x415364[_0xc945('0x26')]();};}function saveUpdates(_0x506305,_0x24d957){return function(_0x49ea16){if(_0x49ea16){return _0x49ea16[_0xc945('0x27')](_0x506305)[_0xc945('0x28')](function(_0x166e14){return _0x166e14;});}return null;};}function removeEntity(_0x2c8d92,_0x5775f7){return function(_0x1aa19f){if(_0x1aa19f){return _0x1aa19f[_0xc945('0x29')]()['then'](function(){_0x2c8d92[_0xc945('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3434a0,_0x738215){return function(_0x472168){if(!_0x472168){_0x3434a0['sendStatus'](0x194);}return _0x472168;};}function handleError(_0x27b337,_0xe9607a){_0xe9607a=_0xe9607a||0x1f4;return function(_0x308a0b){logger['error'](_0x308a0b[_0xc945('0x2a')]);if(_0x308a0b[_0xc945('0x2b')]){delete _0x308a0b[_0xc945('0x2b')];}_0x27b337[_0xc945('0x1d')](_0xe9607a)[_0xc945('0x2c')](_0x308a0b);};}exports[_0xc945('0x2d')]=function(_0x1454b4,_0x3a656c){var _0x234ccc={},_0x1eb881={},_0x304da8={'count':0x0,'rows':[]};var _0x320835=_['map'](db[_0xc945('0x2e')]['rawAttributes'],function(_0x5f24d5){return{'name':_0x5f24d5[_0xc945('0x2f')],'type':_0x5f24d5['type']['key']};});_0x1eb881[_0xc945('0x30')]=_['map'](_0x320835,_0xc945('0x2b'));_0x1eb881[_0xc945('0x31')]=_[_0xc945('0x32')](_0x1454b4[_0xc945('0x31')]);_0x1eb881[_0xc945('0x33')]=_[_0xc945('0x34')](_0x1eb881[_0xc945('0x30')],_0x1eb881[_0xc945('0x31')]);_0x234ccc[_0xc945('0x35')]=_[_0xc945('0x34')](_0x1eb881[_0xc945('0x30')],qs[_0xc945('0x36')](_0x1454b4[_0xc945('0x31')][_0xc945('0x36')]));_0x234ccc[_0xc945('0x35')]=_0x234ccc[_0xc945('0x35')][_0xc945('0x37')]?_0x234ccc['attributes']:_0x1eb881[_0xc945('0x30')];if(!_0x1454b4['query'][_0xc945('0x38')](_0xc945('0x39'))){_0x234ccc[_0xc945('0x21')]=qs[_0xc945('0x21')](_0x1454b4['query'][_0xc945('0x21')]);_0x234ccc['offset']=qs[_0xc945('0x1f')](_0x1454b4[_0xc945('0x31')][_0xc945('0x1f')]);}_0x234ccc[_0xc945('0x3a')]=qs['sort'](_0x1454b4[_0xc945('0x31')]['sort']);_0x234ccc[_0xc945('0x3b')]=qs['filters'](_['pick'](_0x1454b4[_0xc945('0x31')],_0x1eb881[_0xc945('0x33')]),_0x320835);if(_0x1454b4['query'][_0xc945('0x3c')]){_0x234ccc[_0xc945('0x3b')]=_[_0xc945('0x3d')](_0x234ccc['where'],{'$or':_['map'](_0x320835,function(_0xe6b18d){if(_0xe6b18d[_0xc945('0x3e')]!==_0xc945('0x3f')){var _0x403f1f={};_0x403f1f[_0xe6b18d['name']]={'$like':'%'+_0x1454b4[_0xc945('0x31')][_0xc945('0x3c')]+'%'};return _0x403f1f;}})});}_0x234ccc=_['merge']({},_0x234ccc,_0x1454b4[_0xc945('0x40')]);var _0x31466d={'where':_0x234ccc[_0xc945('0x3b')]};return db[_0xc945('0x2e')][_0xc945('0x22')](_0x31466d)['then'](function(_0x279806){_0x304da8[_0xc945('0x22')]=_0x279806;if(_0x1454b4[_0xc945('0x31')]['includeAll']){_0x234ccc[_0xc945('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc945('0x42')](_0x234ccc);})['then'](function(_0x4287e0){_0x304da8['rows']=_0x4287e0;return _0x304da8;})[_0xc945('0x28')](respondWithFilteredResult(_0x3a656c,_0x234ccc))[_0xc945('0x43')](handleError(_0x3a656c,null));};exports[_0xc945('0x44')]=function(_0x11516c,_0x389dd8){var _0x3ff21f={'raw':!![],'where':{'id':_0x11516c[_0xc945('0x45')]['id']}},_0x518a84={};_0x518a84[_0xc945('0x30')]=_['keys'](db['OpenchannelTransferReport'][_0xc945('0x46')]);_0x518a84['query']=_[_0xc945('0x32')](_0x11516c[_0xc945('0x31')]);_0x518a84[_0xc945('0x33')]=_[_0xc945('0x34')](_0x518a84[_0xc945('0x30')],_0x518a84[_0xc945('0x31')]);_0x3ff21f[_0xc945('0x35')]=_['intersection'](_0x518a84['model'],qs[_0xc945('0x36')](_0x11516c['query'][_0xc945('0x36')]));_0x3ff21f['attributes']=_0x3ff21f['attributes'][_0xc945('0x37')]?_0x3ff21f[_0xc945('0x35')]:_0x518a84[_0xc945('0x30')];if(_0x11516c[_0xc945('0x31')][_0xc945('0x47')]){_0x3ff21f['include']=[{'all':!![]}];}_0x3ff21f=_[_0xc945('0x3d')]({},_0x3ff21f,_0x11516c[_0xc945('0x40')]);return db['OpenchannelTransferReport'][_0xc945('0x48')](_0x3ff21f)[_0xc945('0x28')](handleEntityNotFound(_0x389dd8,null))['then'](respondWithResult(_0x389dd8,null))[_0xc945('0x43')](handleError(_0x389dd8,null));};exports[_0xc945('0x49')]=function(_0x4bca4f,_0x3cc08b){return db['OpenchannelTransferReport']['create'](_0x4bca4f[_0xc945('0x4a')],{})[_0xc945('0x28')](respondWithResult(_0x3cc08b,0xc9))[_0xc945('0x43')](handleError(_0x3cc08b,null));};exports[_0xc945('0x27')]=function(_0x4200f1,_0x585667){if(_0x4200f1['body']['id']){delete _0x4200f1['body']['id'];}return db[_0xc945('0x2e')][_0xc945('0x48')]({'where':{'id':_0x4200f1[_0xc945('0x45')]['id']}})[_0xc945('0x28')](handleEntityNotFound(_0x585667,null))[_0xc945('0x28')](saveUpdates(_0x4200f1[_0xc945('0x4a')],null))[_0xc945('0x28')](respondWithResult(_0x585667,null))[_0xc945('0x43')](handleError(_0x585667,null));};exports[_0xc945('0x29')]=function(_0x1b9d8e,_0x551212){return db[_0xc945('0x2e')]['find']({'where':{'id':_0x1b9d8e[_0xc945('0x45')]['id']}})[_0xc945('0x28')](handleEntityNotFound(_0x551212,null))['then'](removeEntity(_0x551212,null))['catch'](handleError(_0x551212,null));};exports[_0xc945('0x4b')]=function(_0x3663e8,_0x4af8e0){return db['OpenchannelTransferReport'][_0xc945('0x4b')]()[_0xc945('0x28')](respondWithResult(_0x4af8e0,null))['catch'](handleError(_0x4af8e0,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f5badf6..f5d4d4d 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 _0x39fe=['rimraf','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x39fe,0x19c));var _0xe39f=function(_0x458f41,_0xdf0e6d){_0x458f41=_0x458f41-0x0;var _0x4f7fd5=_0x39fe[_0x458f41];return _0x4f7fd5;};'use strict';var _=require(_0xe39f('0x0'));var util=require(_0xe39f('0x1'));var logger=require(_0xe39f('0x2'))(_0xe39f('0x3'));var moment=require(_0xe39f('0x4'));var BPromise=require(_0xe39f('0x5'));var rp=require(_0xe39f('0x6'));var fs=require('fs');var path=require(_0xe39f('0x7'));var rimraf=require(_0xe39f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe39f('0x9'));module[_0xe39f('0xa')]=function(_0x479c9e,_0x1d56e9){return _0x479c9e[_0xe39f('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0xe39f('0xc'),'paranoid':![],'indexes':[{'name':_0xe39f('0xd'),'fields':[_0xe39f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x427e=['rimraf','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x427e,0x89));var _0xe427=function(_0x3ca3d6,_0x36a649){_0x3ca3d6=_0x3ca3d6-0x0;var _0x2fcf1a=_0x427e[_0x3ca3d6];return _0x2fcf1a;};'use strict';var _=require(_0xe427('0x0'));var util=require('util');var logger=require(_0xe427('0x1'))(_0xe427('0x2'));var moment=require(_0xe427('0x3'));var BPromise=require(_0xe427('0x4'));var rp=require(_0xe427('0x5'));var fs=require('fs');var path=require(_0xe427('0x6'));var rimraf=require(_0xe427('0x7'));var config=require(_0xe427('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0xe427('0x9')]=function(_0x4e1cff,_0x241e4d){return _0x4e1cff['define'](_0xe427('0xa'),attributes,{'tableName':_0xe427('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d186d65..94ec68f 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 _0x19da=['error','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x19da,0x9f));var _0xa19d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x19da[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var moment=require('moment');var BPromise=require(_0xa19d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19d('0x2'));var db=require(_0xa19d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa19d('0x4'))(_0xa19d('0x5'));var config=require('../../config/environment');var jayson=require(_0xa19d('0x6'));var client=jayson[_0xa19d('0x7')][_0xa19d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14dc68,_0x32da37,_0x4b4627){return new BPromise(function(_0x197c4e,_0x4e6638){return client[_0xa19d('0x9')](_0x14dc68,_0x4b4627)[_0xa19d('0xa')](function(_0x538dea){logger['info'](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));logger[_0xa19d('0xd')](_0xa19d('0xe'),_0x32da37,_0xa19d('0xc'),JSON[_0xa19d('0xf')](_0x538dea));if(_0x538dea['error']){if(_0x538dea['error'][_0xa19d('0x10')]===0x1f4){logger[_0xa19d('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x32da37,_0x538dea['error'][_0xa19d('0x12')]);return _0x4e6638(_0x538dea[_0xa19d('0x11')]['message']);}logger[_0xa19d('0x11')](_0xa19d('0xb'),_0x32da37,_0x538dea[_0xa19d('0x11')]['message']);return _0x197c4e(_0x538dea[_0xa19d('0x11')]['message']);}else{logger[_0xa19d('0x13')](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));_0x197c4e(_0x538dea[_0xa19d('0x14')][_0xa19d('0x12')]);}})[_0xa19d('0x15')](function(_0x2f2774){logger[_0xa19d('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x32da37,_0x2f2774);_0x4e6638(_0x2f2774);});});} \ No newline at end of file +var _0x5ad3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x30b6df,_0x1d9dda){var _0x154577=function(_0x49ea04){while(--_0x49ea04){_0x30b6df['push'](_0x30b6df['shift']());}};_0x154577(++_0x1d9dda);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x38e870,_0x3d2e6a){_0x38e870=_0x38e870-0x0;var _0x2dabbe=_0x5ad3[_0x38e870];return _0x2dabbe;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31cc6a,_0x4edc59,_0x292521){return new BPromise(function(_0x3cec3e,_0x3f1f55){return client['request'](_0x31cc6a,_0x292521)[_0x35ad('0xd')](function(_0x487107){logger['info'](_0x35ad('0xe'),_0x4edc59,_0x35ad('0xf'));logger['debug'](_0x35ad('0x10'),_0x4edc59,_0x35ad('0xf'),JSON['stringify'](_0x487107));if(_0x487107['error']){if(_0x487107[_0x35ad('0x11')][_0x35ad('0x12')]===0x1f4){logger['error'](_0x35ad('0xe'),_0x4edc59,_0x487107[_0x35ad('0x11')]['message']);return _0x3f1f55(_0x487107['error'][_0x35ad('0x13')]);}logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x487107['error'][_0x35ad('0x13')]);return _0x3cec3e(_0x487107[_0x35ad('0x11')]['message']);}else{logger[_0x35ad('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4edc59,'request\x20sent');_0x3cec3e(_0x487107[_0x35ad('0x15')][_0x35ad('0x13')]);}})[_0x35ad('0x16')](function(_0x56cb8e){logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x56cb8e);_0x3f1f55(_0x56cb8e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1ce2436..8032471 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 _0x75d5=['../../config/environment','get','isAuthenticated','index','/:id','create','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1dcb07,_0x32fb4a){var _0x24b4b1=function(_0x302dba){while(--_0x302dba){_0x1dcb07['push'](_0x1dcb07['shift']());}};_0x24b4b1(++_0x32fb4a);}(_0x75d5,0x1c7));var _0x575d=function(_0x468fc5,_0x4c2f01){_0x468fc5=_0x468fc5-0x0;var _0x423ef5=_0x75d5[_0x468fc5];return _0x423ef5;};'use strict';var multer=require(_0x575d('0x0'));var util=require(_0x575d('0x1'));var path=require(_0x575d('0x2'));var timeout=require(_0x575d('0x3'));var express=require(_0x575d('0x4'));var router=express[_0x575d('0x5')]();var fs_extra=require(_0x575d('0x6'));var auth=require(_0x575d('0x7'));var interaction=require(_0x575d('0x8'));var config=require(_0x575d('0x9'));var controller=require('./pause.controller');router[_0x575d('0xa')]('/',auth[_0x575d('0xb')](),controller[_0x575d('0xc')]);router['get'](_0x575d('0xd'),auth[_0x575d('0xb')](),controller['show']);router['post']('/',auth[_0x575d('0xb')](),controller[_0x575d('0xe')]);router['put'](_0x575d('0xd'),auth[_0x575d('0xb')](),controller['update']);router['delete']('/:id',auth[_0x575d('0xb')](),controller[_0x575d('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6eb3=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2d1f46,_0x548bea){var _0x5a6f7d=function(_0x36878d){while(--_0x36878d){_0x2d1f46['push'](_0x2d1f46['shift']());}};_0x5a6f7d(++_0x548bea);}(_0x6eb3,0x11d));var _0x36eb=function(_0x5b9c2f,_0x341c3c){_0x5b9c2f=_0x5b9c2f-0x0;var _0x338842=_0x6eb3[_0x5b9c2f];return _0x338842;};'use strict';var multer=require(_0x36eb('0x0'));var util=require(_0x36eb('0x1'));var path=require(_0x36eb('0x2'));var timeout=require(_0x36eb('0x3'));var express=require('express');var router=express[_0x36eb('0x4')]();var fs_extra=require(_0x36eb('0x5'));var auth=require(_0x36eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x36eb('0x7'));var controller=require('./pause.controller');router[_0x36eb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x36eb('0x8')](_0x36eb('0x9'),auth[_0x36eb('0xa')](),controller[_0x36eb('0xb')]);router['post']('/',auth[_0x36eb('0xa')](),controller[_0x36eb('0xc')]);router['put'](_0x36eb('0x9'),auth['isAuthenticated'](),controller[_0x36eb('0xd')]);router[_0x36eb('0xe')](_0x36eb('0x9'),auth[_0x36eb('0xa')](),controller[_0x36eb('0xf')]);module[_0x36eb('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 3786cf2..639d2b5 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 _0x0b18=['STRING','sequelize','exports'];(function(_0x4f5a71,_0x4fbfb3){var _0xbaf4d3=function(_0x3c58a1){while(--_0x3c58a1){_0x4f5a71['push'](_0x4f5a71['shift']());}};_0xbaf4d3(++_0x4fbfb3);}(_0x0b18,0x16c));var _0x80b1=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x0b18[_0x2b9ac8];return _0x3ceea9;};'use strict';var Sequelize=require(_0x80b1('0x0'));module[_0x80b1('0x1')]={'name':{'type':Sequelize[_0x80b1('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x80b1('0x2')]}}; \ No newline at end of file +var _0x04c7=['sequelize','exports','STRING','name'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x04c7,0x100));var _0x704c=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x04c7[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x704c('0x0'));module[_0x704c('0x1')]={'name':{'type':Sequelize[_0x704c('0x2')],'unique':_0x704c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x704c('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 441ef20..06581fc 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 _0x78bd=['order','sort','where','filter','merge','map','type','options','count','include','findAll','show','params','keys','includeAll','find','catch','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x490726,_0x4728a6){var _0x55d52e=function(_0x451e19){while(--_0x451e19){_0x490726['push'](_0x490726['shift']());}};_0x55d52e(++_0x4728a6);}(_0x78bd,0x6b));var _0xd78b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x78bd[_0x37a79c];return _0x561d89;};'use strict';var emlformat=require(_0xd78b('0x0'));var rimraf=require(_0xd78b('0x1'));var zipdir=require(_0xd78b('0x2'));var jsonpatch=require(_0xd78b('0x3'));var rp=require(_0xd78b('0x4'));var moment=require(_0xd78b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd78b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd78b('0x7'));var ejs=require(_0xd78b('0x8'));var fs=require('fs');var fs_extra=require(_0xd78b('0x9'));var _=require(_0xd78b('0xa'));var squel=require(_0xd78b('0xb'));var crypto=require(_0xd78b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd78b('0x7'));var querystring=require(_0xd78b('0xd'));var Papa=require(_0xd78b('0xe'));var Redis=require(_0xd78b('0xf'));var authService=require(_0xd78b('0x10'));var qs=require(_0xd78b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd78b('0x12'))(_0xd78b('0x13'));var utils=require(_0xd78b('0x14'));var config=require(_0xd78b('0x15'));var licenseUtil=require(_0xd78b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfb82cc,_0xfe7762){_0xfe7762=_0xfe7762||0xcc;return function(_0x2152c8){if(_0x2152c8){return _0xfb82cc[_0xd78b('0x17')](_0xfe7762);}return _0xfb82cc[_0xd78b('0x18')](_0xfe7762)['end']();};}function respondWithResult(_0x1c9936,_0x10f568){_0x10f568=_0x10f568||0xc8;return function(_0x58f5c2){if(_0x58f5c2){return _0x1c9936[_0xd78b('0x18')](_0x10f568)[_0xd78b('0x19')](_0x58f5c2);}};}function respondWithFilteredResult(_0x5c0593,_0x3be02b){return function(_0x463659){if(_0x463659){var _0x5cf53f=typeof _0x3be02b[_0xd78b('0x1a')]==='undefined'&&typeof _0x3be02b[_0xd78b('0x1b')]===_0xd78b('0x1c');var _0x558d6f=_0x463659['count'];var _0x9d8e98=_0x5cf53f?0x0:_0x3be02b[_0xd78b('0x1a')];var _0x53bab9=_0x5cf53f?_0x463659['count']:_0x3be02b[_0xd78b('0x1a')]+_0x3be02b[_0xd78b('0x1b')];var _0x576f04;if(_0x53bab9>=_0x558d6f){_0x53bab9=_0x558d6f;_0x576f04=0xc8;}else{_0x576f04=0xce;}_0x5c0593[_0xd78b('0x18')](_0x576f04);return _0x5c0593[_0xd78b('0x1d')](_0xd78b('0x1e'),_0x9d8e98+'-'+_0x53bab9+'/'+_0x558d6f)[_0xd78b('0x19')](_0x463659);}return null;};}function patchUpdates(_0x3cad1c){return function(_0x42ea98){try{jsonpatch[_0xd78b('0x1f')](_0x42ea98,_0x3cad1c,!![]);}catch(_0x394f2b){return BPromise[_0xd78b('0x20')](_0x394f2b);}return _0x42ea98[_0xd78b('0x21')]();};}function saveUpdates(_0x18364b,_0x2e3911){return function(_0x4623d0){if(_0x4623d0){return _0x4623d0[_0xd78b('0x22')](_0x18364b)[_0xd78b('0x23')](function(_0x1f57c0){return _0x1f57c0;});}return null;};}function removeEntity(_0x232c7f,_0x2d6863){return function(_0x232923){if(_0x232923){return _0x232923[_0xd78b('0x24')]()[_0xd78b('0x23')](function(){var _0x5b340d=_0x232923[_0xd78b('0x25')]({'plain':!![]});var _0x1884ae=_0xd78b('0x26');return db[_0xd78b('0x27')]['destroy']({'where':{'type':_0x1884ae,'resourceId':_0x5b340d['id']}})[_0xd78b('0x23')](function(){return _0x232923;});})[_0xd78b('0x23')](function(){_0x232c7f[_0xd78b('0x18')](0xcc)[_0xd78b('0x28')]();});}};}function handleEntityNotFound(_0x30e7e2,_0x2dec60){return function(_0x158454){if(!_0x158454){_0x30e7e2[_0xd78b('0x17')](0x194);}return _0x158454;};}function handleError(_0x3631af,_0x4ff900){_0x4ff900=_0x4ff900||0x1f4;return function(_0x280aa6){logger['error'](_0x280aa6[_0xd78b('0x29')]);if(_0x280aa6[_0xd78b('0x2a')]){delete _0x280aa6['name'];}_0x3631af['status'](_0x4ff900)[_0xd78b('0x2b')](_0x280aa6);};}exports[_0xd78b('0x2c')]=function(_0x249dba,_0x2b0fc7){var _0x2fdbad={},_0x195113={},_0x15014c={'count':0x0,'rows':[]};var _0xb0aab9=_['map'](db[_0xd78b('0x2d')][_0xd78b('0x2e')],function(_0x3a90c2){return{'name':_0x3a90c2['fieldName'],'type':_0x3a90c2['type'][_0xd78b('0x2f')]};});_0x195113[_0xd78b('0x30')]=_['map'](_0xb0aab9,_0xd78b('0x2a'));_0x195113[_0xd78b('0x31')]=_['keys'](_0x249dba[_0xd78b('0x31')]);_0x195113[_0xd78b('0x32')]=_[_0xd78b('0x33')](_0x195113[_0xd78b('0x30')],_0x195113['query']);_0x2fdbad[_0xd78b('0x34')]=_['intersection'](_0x195113['model'],qs['fields'](_0x249dba[_0xd78b('0x31')][_0xd78b('0x35')]));_0x2fdbad[_0xd78b('0x34')]=_0x2fdbad[_0xd78b('0x34')][_0xd78b('0x36')]?_0x2fdbad['attributes']:_0x195113[_0xd78b('0x30')];if(!_0x249dba[_0xd78b('0x31')][_0xd78b('0x37')](_0xd78b('0x38'))){_0x2fdbad[_0xd78b('0x1b')]=qs[_0xd78b('0x1b')](_0x249dba[_0xd78b('0x31')][_0xd78b('0x1b')]);_0x2fdbad[_0xd78b('0x1a')]=qs[_0xd78b('0x1a')](_0x249dba[_0xd78b('0x31')]['offset']);}_0x2fdbad[_0xd78b('0x39')]=qs['sort'](_0x249dba[_0xd78b('0x31')][_0xd78b('0x3a')]);_0x2fdbad[_0xd78b('0x3b')]=qs[_0xd78b('0x32')](_['pick'](_0x249dba['query'],_0x195113[_0xd78b('0x32')]),_0xb0aab9);if(_0x249dba[_0xd78b('0x31')][_0xd78b('0x3c')]){_0x2fdbad['where']=_[_0xd78b('0x3d')](_0x2fdbad['where'],{'$or':_[_0xd78b('0x3e')](_0xb0aab9,function(_0x429fe0){if(_0x429fe0[_0xd78b('0x3f')]!=='VIRTUAL'){var _0x3e8eb1={};_0x3e8eb1[_0x429fe0[_0xd78b('0x2a')]]={'$like':'%'+_0x249dba[_0xd78b('0x31')]['filter']+'%'};return _0x3e8eb1;}})});}_0x2fdbad=_['merge']({},_0x2fdbad,_0x249dba[_0xd78b('0x40')]);var _0x37bfe9={'where':_0x2fdbad[_0xd78b('0x3b')]};return db[_0xd78b('0x2d')][_0xd78b('0x41')](_0x37bfe9)[_0xd78b('0x23')](function(_0x5ed930){_0x15014c[_0xd78b('0x41')]=_0x5ed930;if(_0x249dba[_0xd78b('0x31')]['includeAll']){_0x2fdbad[_0xd78b('0x42')]=[{'all':!![]}];}return db['Pause'][_0xd78b('0x43')](_0x2fdbad);})[_0xd78b('0x23')](function(_0x3d133c){_0x15014c['rows']=_0x3d133c;return _0x15014c;})[_0xd78b('0x23')](respondWithFilteredResult(_0x2b0fc7,_0x2fdbad))['catch'](handleError(_0x2b0fc7,null));};exports[_0xd78b('0x44')]=function(_0x5b01a3,_0x2673b9){var _0x378974={'raw':!![],'where':{'id':_0x5b01a3[_0xd78b('0x45')]['id']}},_0x418f19={};_0x418f19[_0xd78b('0x30')]=_['keys'](db[_0xd78b('0x2d')]['rawAttributes']);_0x418f19[_0xd78b('0x31')]=_[_0xd78b('0x46')](_0x5b01a3[_0xd78b('0x31')]);_0x418f19['filters']=_[_0xd78b('0x33')](_0x418f19[_0xd78b('0x30')],_0x418f19[_0xd78b('0x31')]);_0x378974['attributes']=_[_0xd78b('0x33')](_0x418f19[_0xd78b('0x30')],qs['fields'](_0x5b01a3[_0xd78b('0x31')][_0xd78b('0x35')]));_0x378974['attributes']=_0x378974[_0xd78b('0x34')][_0xd78b('0x36')]?_0x378974[_0xd78b('0x34')]:_0x418f19[_0xd78b('0x30')];if(_0x5b01a3[_0xd78b('0x31')][_0xd78b('0x47')]){_0x378974[_0xd78b('0x42')]=[{'all':!![]}];}_0x378974=_['merge']({},_0x378974,_0x5b01a3[_0xd78b('0x40')]);return db[_0xd78b('0x2d')][_0xd78b('0x48')](_0x378974)['then'](handleEntityNotFound(_0x2673b9,null))[_0xd78b('0x23')](respondWithResult(_0x2673b9,null))[_0xd78b('0x49')](handleError(_0x2673b9,null));};exports[_0xd78b('0x4a')]=function(_0x73a06c,_0x5cf3c4){return db[_0xd78b('0x2d')][_0xd78b('0x4a')](_0x73a06c[_0xd78b('0x4b')],{})[_0xd78b('0x23')](function(_0x2b12d7){var _0x49f34c=_0x73a06c[_0xd78b('0x4c')][_0xd78b('0x25')]({'plain':!![]});if(!_0x49f34c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49f34c[_0xd78b('0x4d')]===_0xd78b('0x4c')){var _0x2fd75b=_0x2b12d7[_0xd78b('0x25')]({'plain':!![]});var _0x463885=_0xd78b('0x26');return db['UserProfileSection'][_0xd78b('0x48')]({'where':{'name':_0x463885,'userProfileId':_0x49f34c[_0xd78b('0x4e')]},'raw':!![]})[_0xd78b('0x23')](function(_0x2c37ac){if(_0x2c37ac&&_0x2c37ac[_0xd78b('0x4f')]===0x0){return db[_0xd78b('0x27')][_0xd78b('0x4a')]({'name':_0x2fd75b[_0xd78b('0x2a')],'resourceId':_0x2fd75b['id'],'type':_0x2c37ac[_0xd78b('0x2a')],'sectionId':_0x2c37ac['id']},{})[_0xd78b('0x23')](function(){return _0x2b12d7;});}else{return _0x2b12d7;}})['catch'](function(_0x49c34e){logger[_0xd78b('0x50')](_0xd78b('0x51'),_0x49c34e);throw _0x49c34e;});}return _0x2b12d7;})['then'](respondWithResult(_0x5cf3c4,0xc9))['catch'](handleError(_0x5cf3c4,null));};exports[_0xd78b('0x22')]=function(_0x4df542,_0x589a1d){if(_0x4df542['body']['id']){delete _0x4df542[_0xd78b('0x4b')]['id'];}return db[_0xd78b('0x2d')][_0xd78b('0x48')]({'where':{'id':_0x4df542['params']['id']}})[_0xd78b('0x23')](handleEntityNotFound(_0x589a1d,null))[_0xd78b('0x23')](saveUpdates(_0x4df542[_0xd78b('0x4b')],null))['then'](respondWithResult(_0x589a1d,null))[_0xd78b('0x49')](handleError(_0x589a1d,null));};exports[_0xd78b('0x24')]=function(_0x3e7fb0,_0x1ee5c3){return db[_0xd78b('0x2d')][_0xd78b('0x48')]({'where':{'id':_0x3e7fb0['params']['id']}})[_0xd78b('0x23')](handleEntityNotFound(_0x1ee5c3,null))[_0xd78b('0x23')](removeEntity(_0x1ee5c3,null))['catch'](handleError(_0x1ee5c3,null));}; \ No newline at end of file +var _0xbe9b=['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','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','Pause','includeAll','include','catch','show','params','merge','find','create','body','role','autoAssociation'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbe9b,0x100));var _0xbbe9=function(_0x4ffda6,_0x27193d){_0x4ffda6=_0x4ffda6-0x0;var _0x45e4c8=_0xbe9b[_0x4ffda6];return _0x45e4c8;};'use strict';var emlformat=require(_0xbbe9('0x0'));var rimraf=require(_0xbbe9('0x1'));var zipdir=require(_0xbbe9('0x2'));var jsonpatch=require(_0xbbe9('0x3'));var rp=require(_0xbbe9('0x4'));var moment=require(_0xbbe9('0x5'));var BPromise=require(_0xbbe9('0x6'));var Mustache=require(_0xbbe9('0x7'));var util=require(_0xbbe9('0x8'));var path=require(_0xbbe9('0x9'));var sox=require(_0xbbe9('0xa'));var csv=require(_0xbbe9('0xb'));var ejs=require(_0xbbe9('0xc'));var fs=require('fs');var fs_extra=require(_0xbbe9('0xd'));var _=require('lodash');var squel=require(_0xbbe9('0xe'));var crypto=require(_0xbbe9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbbe9('0xb'));var querystring=require(_0xbbe9('0x10'));var Papa=require(_0xbbe9('0x11'));var Redis=require('ioredis');var authService=require(_0xbbe9('0x12'));var qs=require(_0xbbe9('0x13'));var as=require(_0xbbe9('0x14'));var hardwareService=require(_0xbbe9('0x15'));var logger=require(_0xbbe9('0x16'))(_0xbbe9('0x17'));var utils=require(_0xbbe9('0x18'));var config=require(_0xbbe9('0x19'));var licenseUtil=require(_0xbbe9('0x1a'));var db=require(_0xbbe9('0x1b'))['db'];function respondWithStatusCode(_0x4afeb4,_0x4a24be){_0x4a24be=_0x4a24be||0xcc;return function(_0xc66e75){if(_0xc66e75){return _0x4afeb4['sendStatus'](_0x4a24be);}return _0x4afeb4['status'](_0x4a24be)[_0xbbe9('0x1c')]();};}function respondWithResult(_0x331078,_0x3d5848){_0x3d5848=_0x3d5848||0xc8;return function(_0x3c9e1a){if(_0x3c9e1a){return _0x331078[_0xbbe9('0x1d')](_0x3d5848)[_0xbbe9('0x1e')](_0x3c9e1a);}};}function respondWithFilteredResult(_0x3b7a1a,_0x51608e){return function(_0x454201){if(_0x454201){var _0x529eab=typeof _0x51608e[_0xbbe9('0x1f')]===_0xbbe9('0x20')&&typeof _0x51608e[_0xbbe9('0x21')]===_0xbbe9('0x20');var _0x5de7a7=_0x454201[_0xbbe9('0x22')];var _0xa3a3f8=_0x529eab?0x0:_0x51608e['offset'];var _0x25f4c2=_0x529eab?_0x454201[_0xbbe9('0x22')]:_0x51608e[_0xbbe9('0x1f')]+_0x51608e[_0xbbe9('0x21')];var _0x2d2a45;if(_0x25f4c2>=_0x5de7a7){_0x25f4c2=_0x5de7a7;_0x2d2a45=0xc8;}else{_0x2d2a45=0xce;}_0x3b7a1a[_0xbbe9('0x1d')](_0x2d2a45);return _0x3b7a1a[_0xbbe9('0x23')](_0xbbe9('0x24'),_0xa3a3f8+'-'+_0x25f4c2+'/'+_0x5de7a7)[_0xbbe9('0x1e')](_0x454201);}return null;};}function patchUpdates(_0x98df9){return function(_0x515e84){try{jsonpatch['apply'](_0x515e84,_0x98df9,!![]);}catch(_0x32f467){return BPromise[_0xbbe9('0x25')](_0x32f467);}return _0x515e84[_0xbbe9('0x26')]();};}function saveUpdates(_0x1e85f5,_0x5a372){return function(_0x31e165){if(_0x31e165){return _0x31e165[_0xbbe9('0x27')](_0x1e85f5)['then'](function(_0x3bebc1){return _0x3bebc1;});}return null;};}function removeEntity(_0x446210,_0x485166){return function(_0xbda7b2){if(_0xbda7b2){return _0xbda7b2[_0xbbe9('0x28')]()[_0xbbe9('0x29')](function(){var _0xf43c92=_0xbda7b2[_0xbbe9('0x2a')]({'plain':!![]});var _0xd02305=_0xbbe9('0x2b');return db[_0xbbe9('0x2c')][_0xbbe9('0x28')]({'where':{'type':_0xd02305,'resourceId':_0xf43c92['id']}})[_0xbbe9('0x29')](function(){return _0xbda7b2;});})['then'](function(){_0x446210[_0xbbe9('0x1d')](0xcc)[_0xbbe9('0x1c')]();});}};}function handleEntityNotFound(_0x562a8e,_0x50fc65){return function(_0x4a1e11){if(!_0x4a1e11){_0x562a8e[_0xbbe9('0x2d')](0x194);}return _0x4a1e11;};}function handleError(_0x4edc01,_0x4c8749){_0x4c8749=_0x4c8749||0x1f4;return function(_0x103cab){logger[_0xbbe9('0x2e')](_0x103cab[_0xbbe9('0x2f')]);if(_0x103cab[_0xbbe9('0x30')]){delete _0x103cab[_0xbbe9('0x30')];}_0x4edc01[_0xbbe9('0x1d')](_0x4c8749)[_0xbbe9('0x31')](_0x103cab);};}exports[_0xbbe9('0x32')]=function(_0x828303,_0x41611e){var _0x4a7009={},_0x9541ad={},_0x555ca4={'count':0x0,'rows':[]};var _0x2afebc=_[_0xbbe9('0x33')](db['Pause'][_0xbbe9('0x34')],function(_0x482f43){return{'name':_0x482f43[_0xbbe9('0x35')],'type':_0x482f43[_0xbbe9('0x36')][_0xbbe9('0x37')]};});_0x9541ad[_0xbbe9('0x38')]=_['map'](_0x2afebc,_0xbbe9('0x30'));_0x9541ad[_0xbbe9('0x39')]=_[_0xbbe9('0x3a')](_0x828303['query']);_0x9541ad['filters']=_['intersection'](_0x9541ad['model'],_0x9541ad['query']);_0x4a7009['attributes']=_[_0xbbe9('0x3b')](_0x9541ad['model'],qs['fields'](_0x828303[_0xbbe9('0x39')][_0xbbe9('0x3c')]));_0x4a7009[_0xbbe9('0x3d')]=_0x4a7009[_0xbbe9('0x3d')][_0xbbe9('0x3e')]?_0x4a7009['attributes']:_0x9541ad['model'];if(!_0x828303[_0xbbe9('0x39')][_0xbbe9('0x3f')]('nolimit')){_0x4a7009[_0xbbe9('0x21')]=qs[_0xbbe9('0x21')](_0x828303[_0xbbe9('0x39')][_0xbbe9('0x21')]);_0x4a7009[_0xbbe9('0x1f')]=qs[_0xbbe9('0x1f')](_0x828303['query'][_0xbbe9('0x1f')]);}_0x4a7009[_0xbbe9('0x40')]=qs[_0xbbe9('0x41')](_0x828303[_0xbbe9('0x39')][_0xbbe9('0x41')]);_0x4a7009['where']=qs[_0xbbe9('0x42')](_[_0xbbe9('0x43')](_0x828303[_0xbbe9('0x39')],_0x9541ad[_0xbbe9('0x42')]),_0x2afebc);if(_0x828303[_0xbbe9('0x39')][_0xbbe9('0x44')]){_0x4a7009[_0xbbe9('0x45')]=_['merge'](_0x4a7009[_0xbbe9('0x45')],{'$or':_[_0xbbe9('0x33')](_0x2afebc,function(_0x2948d1){if(_0x2948d1['type']!==_0xbbe9('0x46')){var _0x330019={};_0x330019[_0x2948d1[_0xbbe9('0x30')]]={'$like':'%'+_0x828303[_0xbbe9('0x39')][_0xbbe9('0x44')]+'%'};return _0x330019;}})});}_0x4a7009=_['merge']({},_0x4a7009,_0x828303[_0xbbe9('0x47')]);var _0x2324dc={'where':_0x4a7009['where']};return db[_0xbbe9('0x48')][_0xbbe9('0x22')](_0x2324dc)[_0xbbe9('0x29')](function(_0x5ef905){_0x555ca4[_0xbbe9('0x22')]=_0x5ef905;if(_0x828303[_0xbbe9('0x39')][_0xbbe9('0x49')]){_0x4a7009[_0xbbe9('0x4a')]=[{'all':!![]}];}return db[_0xbbe9('0x48')]['findAll'](_0x4a7009);})[_0xbbe9('0x29')](function(_0x483f02){_0x555ca4['rows']=_0x483f02;return _0x555ca4;})[_0xbbe9('0x29')](respondWithFilteredResult(_0x41611e,_0x4a7009))[_0xbbe9('0x4b')](handleError(_0x41611e,null));};exports[_0xbbe9('0x4c')]=function(_0x206529,_0x5c9c94){var _0x51d82a={'raw':!![],'where':{'id':_0x206529[_0xbbe9('0x4d')]['id']}},_0x231219={};_0x231219[_0xbbe9('0x38')]=_[_0xbbe9('0x3a')](db[_0xbbe9('0x48')][_0xbbe9('0x34')]);_0x231219['query']=_['keys'](_0x206529[_0xbbe9('0x39')]);_0x231219['filters']=_[_0xbbe9('0x3b')](_0x231219[_0xbbe9('0x38')],_0x231219['query']);_0x51d82a[_0xbbe9('0x3d')]=_[_0xbbe9('0x3b')](_0x231219[_0xbbe9('0x38')],qs[_0xbbe9('0x3c')](_0x206529[_0xbbe9('0x39')][_0xbbe9('0x3c')]));_0x51d82a[_0xbbe9('0x3d')]=_0x51d82a[_0xbbe9('0x3d')]['length']?_0x51d82a[_0xbbe9('0x3d')]:_0x231219[_0xbbe9('0x38')];if(_0x206529[_0xbbe9('0x39')]['includeAll']){_0x51d82a[_0xbbe9('0x4a')]=[{'all':!![]}];}_0x51d82a=_[_0xbbe9('0x4e')]({},_0x51d82a,_0x206529[_0xbbe9('0x47')]);return db[_0xbbe9('0x48')][_0xbbe9('0x4f')](_0x51d82a)[_0xbbe9('0x29')](handleEntityNotFound(_0x5c9c94,null))[_0xbbe9('0x29')](respondWithResult(_0x5c9c94,null))['catch'](handleError(_0x5c9c94,null));};exports['create']=function(_0x48af77,_0x33f414){return db['Pause'][_0xbbe9('0x50')](_0x48af77[_0xbbe9('0x51')],{})[_0xbbe9('0x29')](function(_0x3e93d1){var _0x4787a0=_0x48af77['user']['get']({'plain':!![]});if(!_0x4787a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4787a0[_0xbbe9('0x52')]==='user'){var _0x2e427a=_0x3e93d1[_0xbbe9('0x2a')]({'plain':!![]});var _0x5dccd6='Pauses';return db['UserProfileSection'][_0xbbe9('0x4f')]({'where':{'name':_0x5dccd6,'userProfileId':_0x4787a0['userProfileId']},'raw':!![]})[_0xbbe9('0x29')](function(_0x2d7dcd){if(_0x2d7dcd&&_0x2d7dcd[_0xbbe9('0x53')]===0x0){return db['UserProfileResource'][_0xbbe9('0x50')]({'name':_0x2e427a['name'],'resourceId':_0x2e427a['id'],'type':_0x2d7dcd[_0xbbe9('0x30')],'sectionId':_0x2d7dcd['id']},{})[_0xbbe9('0x29')](function(){return _0x3e93d1;});}else{return _0x3e93d1;}})[_0xbbe9('0x4b')](function(_0x1f02bd){logger[_0xbbe9('0x2e')](_0xbbe9('0x54'),_0x1f02bd);throw _0x1f02bd;});}return _0x3e93d1;})[_0xbbe9('0x29')](respondWithResult(_0x33f414,0xc9))[_0xbbe9('0x4b')](handleError(_0x33f414,null));};exports[_0xbbe9('0x27')]=function(_0x5347c8,_0x5cb474){if(_0x5347c8['body']['id']){delete _0x5347c8[_0xbbe9('0x51')]['id'];}return db[_0xbbe9('0x48')][_0xbbe9('0x4f')]({'where':{'id':_0x5347c8[_0xbbe9('0x4d')]['id']}})[_0xbbe9('0x29')](handleEntityNotFound(_0x5cb474,null))['then'](saveUpdates(_0x5347c8['body'],null))[_0xbbe9('0x29')](respondWithResult(_0x5cb474,null))[_0xbbe9('0x4b')](handleError(_0x5cb474,null));};exports['destroy']=function(_0x4b9eed,_0x5840d8){return db[_0xbbe9('0x48')][_0xbbe9('0x4f')]({'where':{'id':_0x4b9eed[_0xbbe9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5840d8,null))[_0xbbe9('0x29')](removeEntity(_0x5840d8,null))[_0xbbe9('0x4b')](handleError(_0x5840d8,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index d574f63..1809eaa 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x487a93,_0x371b7e){_0x487a93=_0x487a93-0x0;var _0x4d798b=_0x7fbe[_0x487a93];return _0x4d798b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 6ee26df..e742036 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(_0x2b0544,_0x384ae8){var _0x393356=function(_0x4fbed1){while(--_0x4fbed1){_0x2b0544['push'](_0x2b0544['shift']());}};_0x393356(++_0x384ae8);}(_0xb10b,0x12a));var _0xbb10=function(_0x11280c,_0x4e8f92){_0x11280c=_0x11280c-0x0;var _0x5999ac=_0xb10b[_0x11280c];return _0x5999ac;};'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(_0x2856b9,_0x432a51){var _0x1e50be=function(_0x150631){while(--_0x150631){_0x2856b9['push'](_0x2856b9['shift']());}};_0x1e50be(++_0x432a51);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ea17a,_0x4b9c83){_0x4ea17a=_0x4ea17a-0x0;var _0x58e65f=_0xb10b[_0x4ea17a];return _0x58e65f;};'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 b46fb7a..f12b71d 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 _0x6334=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','format','%s-%s%s','extname','now','originalname','post','file','upload','webhookPost','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x31a15b,_0x306dc2){var _0x2ccd80=function(_0x2fdf46){while(--_0x2fdf46){_0x31a15b['push'](_0x31a15b['shift']());}};_0x2ccd80(++_0x306dc2);}(_0x6334,0x119));var _0x4633=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x6334[_0x190681];return _0x4f2ada;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),controller['webhookGet']);router[_0x4633('0xa')](_0x4633('0xe'),auth['isAuthenticated'](),controller[_0x4633('0xf')]);router[_0x4633('0xa')](_0x4633('0x10'),auth['isAuthenticated'](),controller[_0x4633('0x11')]);var upload=multer({'storage':multer[_0x4633('0x12')]({'destination':function(_0x5157a7,_0x6a63b,_0x3d5182){_0x3d5182(null,path[_0x4633('0x13')](config[_0x4633('0x14')],'server/files/plugins'));},'filename':function(_0x73b5e4,_0xad405,_0x438e87){_0xad405['originalname']=_0xad405['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x438e87(null,util[_0x4633('0x15')](_0x4633('0x16'),path['basename'](_0xad405['originalname'],path[_0x4633('0x17')](_0xad405['originalname'])),Date[_0x4633('0x18')](),path[_0x4633('0x17')](_0xad405[_0x4633('0x19')])));}})});router[_0x4633('0x1a')]('/',upload['single'](_0x4633('0x1b')),controller[_0x4633('0x1c')]);router[_0x4633('0x1a')]('/webhook',controller[_0x4633('0x1d')]);router[_0x4633('0x1e')](_0x4633('0xe'),auth[_0x4633('0xb')](),controller[_0x4633('0x1f')]);router['delete'](_0x4633('0xe'),auth[_0x4633('0xb')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xdb94=['upload','webhookPost','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','single','file'];(function(_0x310ac0,_0xedd465){var _0x43aaa0=function(_0x2fd7ea){while(--_0x2fd7ea){_0x310ac0['push'](_0x310ac0['shift']());}};_0x43aaa0(++_0xedd465);}(_0xdb94,0xe5));var _0x4db9=function(_0x484878,_0x35bf8d){_0x484878=_0x484878-0x0;var _0x78db02=_0xdb94[_0x484878];return _0x78db02;};'use strict';var multer=require('multer');var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db9('0x2'));var router=express[_0x4db9('0x3')]();var fs_extra=require(_0x4db9('0x4'));var auth=require(_0x4db9('0x5'));var interaction=require(_0x4db9('0x6'));var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0x9')]);router[_0x4db9('0xa')](_0x4db9('0xb'),controller[_0x4db9('0xc')]);router['get'](_0x4db9('0xd'),auth[_0x4db9('0x8')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xa')](_0x4db9('0xf'),auth['isAuthenticated'](),controller[_0x4db9('0x10')]);var upload=multer({'storage':multer[_0x4db9('0x11')]({'destination':function(_0x31f02d,_0xe6de11,_0x34147f){_0x34147f(null,path[_0x4db9('0x12')](config['root'],_0x4db9('0x13')));},'filename':function(_0x4397fc,_0x59f01c,_0x549c92){_0x59f01c[_0x4db9('0x14')]=_0x59f01c[_0x4db9('0x14')][_0x4db9('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x549c92(null,util['format'](_0x4db9('0x16'),path[_0x4db9('0x17')](_0x59f01c[_0x4db9('0x14')],path[_0x4db9('0x18')](_0x59f01c[_0x4db9('0x14')])),Date['now'](),path[_0x4db9('0x18')](_0x59f01c[_0x4db9('0x14')])));}})});router['post']('/',upload[_0x4db9('0x19')](_0x4db9('0x1a')),controller[_0x4db9('0x1b')]);router['post'](_0x4db9('0xb'),controller[_0x4db9('0x1c')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x1d')]);router[_0x4db9('0x1e')]('/:id',auth[_0x4db9('0x8')](),controller[_0x4db9('0x1e')]);module[_0x4db9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ecf4e47..dd69d4b 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 _0x77c3=['script','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.','sequelize','STRING','ENUM','html'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x77c3,0x11a));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x377c('0x0'));module['exports']={'name':{'type':Sequelize[_0x377c('0x1')]},'type':{'type':Sequelize[_0x377c('0x2')](_0x377c('0x3'),_0x377c('0x4'))},'description':{'type':Sequelize[_0x377c('0x5')]},'version':{'type':Sequelize[_0x377c('0x5')]},'path':{'type':Sequelize[_0x377c('0x1')],'comment':_0x377c('0x6')},'active':{'type':Sequelize[_0x377c('0x7')],'defaultValue':0x0,'comment':_0x377c('0x8')},'sidebar':{'type':Sequelize[_0x377c('0x2')](_0x377c('0x9'),'agentOnly',_0x377c('0xa'),_0x377c('0xb')),'defaultValue':_0x377c('0xa'),'comment':_0x377c('0xc')},'icon':{'type':Sequelize[_0x377c('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x377c('0x1')]},'scriptPath':{'type':Sequelize[_0x377c('0x1')]}}; \ No newline at end of file +var _0xef70=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always'];(function(_0x861fdc,_0xaf7cdd){var _0x3656ab=function(_0x116e39){while(--_0x116e39){_0x861fdc['push'](_0x861fdc['shift']());}};_0x3656ab(++_0xaf7cdd);}(_0xef70,0x121));var _0x0ef7=function(_0x3f6663,_0x7363ee){_0x3f6663=_0x3f6663-0x0;var _0x492ad4=_0xef70[_0x3f6663];return _0x492ad4;};'use strict';var Sequelize=require('sequelize');module[_0x0ef7('0x0')]={'name':{'type':Sequelize[_0x0ef7('0x1')]},'type':{'type':Sequelize[_0x0ef7('0x2')](_0x0ef7('0x3'),_0x0ef7('0x4'))},'description':{'type':Sequelize[_0x0ef7('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0ef7('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x0ef7('0x6')],'defaultValue':0x0,'comment':_0x0ef7('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x0ef7('0x8'),'agentOnly','always',_0x0ef7('0x9')),'defaultValue':_0x0ef7('0xa'),'comment':_0x0ef7('0xb')},'icon':{'type':Sequelize[_0x0ef7('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x0ef7('0x1')]},'scriptName':{'type':Sequelize[_0x0ef7('0x1')]},'scriptPath':{'type':Sequelize[_0x0ef7('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e990983..847d450 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 _0xadd8=['ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','0777','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','always','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','root','webhookGet','resolve','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','statusCode','webhookPost','content-type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','Plugin','includeAll','include','findAll','rows','catch','find','download','params','join','server/files/plugins','%s.zip','basename','zip','code'];(function(_0x524831,_0x2cc5bb){var _0x710c91=function(_0x131843){while(--_0x131843){_0x524831['push'](_0x524831['shift']());}};_0x710c91(++_0x2cc5bb);}(_0xadd8,0x19d));var _0x8add=function(_0xf99a4d,_0x5e1353){_0xf99a4d=_0xf99a4d-0x0;var _0x11b574=_0xadd8[_0xf99a4d];return _0x11b574;};'use strict';var emlformat=require(_0x8add('0x0'));var rimraf=require(_0x8add('0x1'));var zipdir=require(_0x8add('0x2'));var jsonpatch=require(_0x8add('0x3'));var rp=require(_0x8add('0x4'));var moment=require(_0x8add('0x5'));var BPromise=require(_0x8add('0x6'));var Mustache=require(_0x8add('0x7'));var util=require(_0x8add('0x8'));var path=require(_0x8add('0x9'));var sox=require(_0x8add('0xa'));var csv=require(_0x8add('0xb'));var ejs=require(_0x8add('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8add('0xd'));var squel=require(_0x8add('0xe'));var crypto=require(_0x8add('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8add('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8add('0x11'));var extract=require('extract-zip');var rimraf=require(_0x8add('0x1'));var archiver=require(_0x8add('0x12'));var Redis=require(_0x8add('0x13'));var authService=require(_0x8add('0x14'));var qs=require(_0x8add('0x15'));var as=require(_0x8add('0x16'));var hardwareService=require(_0x8add('0x17'));var logger=require(_0x8add('0x18'))(_0x8add('0x19'));var utils=require(_0x8add('0x1a'));var config=require(_0x8add('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x8add('0x1c')],{'host':_0x8add('0x1d'),'port':0x18eb});var socket=require(_0x8add('0x1e'))(new Redis(config[_0x8add('0x1c')]));require(_0x8add('0x1f'))[_0x8add('0x20')](socket);function respondWithStatusCode(_0x509e7c,_0x5bbd1e){_0x5bbd1e=_0x5bbd1e||0xcc;return function(_0x5eee39){if(_0x5eee39){return _0x509e7c[_0x8add('0x21')](_0x5bbd1e);}return _0x509e7c[_0x8add('0x22')](_0x5bbd1e)[_0x8add('0x23')]();};}function respondWithResult(_0x3e24e8,_0x5b8ce6){_0x5b8ce6=_0x5b8ce6||0xc8;return function(_0x2a9313){if(_0x2a9313){return _0x3e24e8[_0x8add('0x22')](_0x5b8ce6)[_0x8add('0x24')](_0x2a9313);}};}function respondWithFilteredResult(_0x385761,_0x321a58){return function(_0x387f2a){if(_0x387f2a){var _0x5214c8=typeof _0x321a58[_0x8add('0x25')]==='undefined'&&typeof _0x321a58[_0x8add('0x26')]===_0x8add('0x27');var _0x2d0018=_0x387f2a[_0x8add('0x28')];var _0x59e06d=_0x5214c8?0x0:_0x321a58[_0x8add('0x25')];var _0xf11846=_0x5214c8?_0x387f2a['count']:_0x321a58['offset']+_0x321a58[_0x8add('0x26')];var _0x16009b;if(_0xf11846>=_0x2d0018){_0xf11846=_0x2d0018;_0x16009b=0xc8;}else{_0x16009b=0xce;}_0x385761[_0x8add('0x22')](_0x16009b);return _0x385761[_0x8add('0x29')](_0x8add('0x2a'),_0x59e06d+'-'+_0xf11846+'/'+_0x2d0018)[_0x8add('0x24')](_0x387f2a);}return null;};}function patchUpdates(_0x1f253f){return function(_0x12aa76){try{jsonpatch[_0x8add('0x2b')](_0x12aa76,_0x1f253f,!![]);}catch(_0x183924){return BPromise['reject'](_0x183924);}return _0x12aa76['save']();};}function saveUpdates(_0x5024a9,_0x58438e){return function(_0x2de88b){if(_0x2de88b){return _0x2de88b[_0x8add('0x2c')](_0x5024a9)[_0x8add('0x2d')](function(_0x36fdca){return _0x36fdca;});}return null;};}function removeEntity(_0xc5db4a,_0x326a18){return function(_0x3291ea){if(_0x3291ea){return _0x3291ea[_0x8add('0x2e')]()[_0x8add('0x2d')](function(){var _0x446153=_0x3291ea[_0x8add('0x2f')]({'plain':!![]});var _0x8095c1='Plugins';return db[_0x8add('0x30')][_0x8add('0x2e')]({'where':{'type':_0x8095c1,'resourceId':_0x446153['id']}})[_0x8add('0x2d')](function(){return _0x3291ea;});})['then'](function(){_0xc5db4a[_0x8add('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c25ed,_0x5b6f03){return function(_0x378204){if(!_0x378204){_0x5c25ed[_0x8add('0x21')](0x194);}return _0x378204;};}function handleError(_0xa47ec4,_0x19033e){_0x19033e=_0x19033e||0x1f4;return function(_0x12f4ea){logger[_0x8add('0x31')](_0x12f4ea['stack']);if(_0x12f4ea[_0x8add('0x32')]){delete _0x12f4ea[_0x8add('0x32')];}_0xa47ec4['status'](_0x19033e)['send'](_0x12f4ea);};}exports[_0x8add('0x33')]=function(_0x266b9f,_0x419610){var _0x261392={},_0x534bfb={},_0x366057={'count':0x0,'rows':[]};var _0x35401f=_[_0x8add('0x34')](db['Plugin'][_0x8add('0x35')],function(_0x311308){return{'name':_0x311308[_0x8add('0x36')],'type':_0x311308[_0x8add('0x37')][_0x8add('0x38')]};});_0x534bfb['model']=_['map'](_0x35401f,'name');_0x534bfb[_0x8add('0x39')]=_[_0x8add('0x3a')](_0x266b9f[_0x8add('0x39')]);_0x534bfb[_0x8add('0x3b')]=_[_0x8add('0x3c')](_0x534bfb[_0x8add('0x3d')],_0x534bfb['query']);_0x261392[_0x8add('0x3e')]=_[_0x8add('0x3c')](_0x534bfb['model'],qs[_0x8add('0x3f')](_0x266b9f[_0x8add('0x39')][_0x8add('0x3f')]));_0x261392['attributes']=_0x261392['attributes'][_0x8add('0x40')]?_0x261392['attributes']:_0x534bfb['model'];if(!_0x266b9f['query'][_0x8add('0x41')](_0x8add('0x42'))){_0x261392['limit']=qs['limit'](_0x266b9f[_0x8add('0x39')][_0x8add('0x26')]);_0x261392['offset']=qs[_0x8add('0x25')](_0x266b9f['query']['offset']);}_0x261392[_0x8add('0x43')]=qs[_0x8add('0x44')](_0x266b9f[_0x8add('0x39')][_0x8add('0x44')]);_0x261392[_0x8add('0x45')]=qs['filters'](_['pick'](_0x266b9f[_0x8add('0x39')],_0x534bfb['filters']),_0x35401f);if(_0x266b9f[_0x8add('0x39')]['filter']){_0x261392[_0x8add('0x45')]=_['merge'](_0x261392[_0x8add('0x45')],{'$or':_['map'](_0x35401f,function(_0x2d1eb5){if(_0x2d1eb5['type']!==_0x8add('0x46')){var _0x423017={};_0x423017[_0x2d1eb5[_0x8add('0x32')]]={'$like':'%'+_0x266b9f[_0x8add('0x39')][_0x8add('0x47')]+'%'};return _0x423017;}})});}_0x261392=_[_0x8add('0x48')]({},_0x261392,_0x266b9f['options']);var _0x1b81ae={'where':_0x261392[_0x8add('0x45')]};return db[_0x8add('0x49')][_0x8add('0x28')](_0x1b81ae)['then'](function(_0x59e399){_0x366057[_0x8add('0x28')]=_0x59e399;if(_0x266b9f[_0x8add('0x39')][_0x8add('0x4a')]){_0x261392[_0x8add('0x4b')]=[{'all':!![]}];}return db[_0x8add('0x49')][_0x8add('0x4c')](_0x261392);})[_0x8add('0x2d')](function(_0x2414c8){_0x366057[_0x8add('0x4d')]=_0x2414c8;return _0x366057;})[_0x8add('0x2d')](respondWithFilteredResult(_0x419610,_0x261392))[_0x8add('0x4e')](handleError(_0x419610,null));};exports['show']=function(_0x485fc4,_0x322860){var _0x41ead5={'raw':!![],'where':{'id':_0x485fc4['params']['id']}},_0x3abe0d={};_0x3abe0d[_0x8add('0x3d')]=_[_0x8add('0x3a')](db[_0x8add('0x49')]['rawAttributes']);_0x3abe0d[_0x8add('0x39')]=_[_0x8add('0x3a')](_0x485fc4['query']);_0x3abe0d[_0x8add('0x3b')]=_[_0x8add('0x3c')](_0x3abe0d[_0x8add('0x3d')],_0x3abe0d[_0x8add('0x39')]);_0x41ead5[_0x8add('0x3e')]=_[_0x8add('0x3c')](_0x3abe0d[_0x8add('0x3d')],qs[_0x8add('0x3f')](_0x485fc4[_0x8add('0x39')][_0x8add('0x3f')]));_0x41ead5[_0x8add('0x3e')]=_0x41ead5[_0x8add('0x3e')][_0x8add('0x40')]?_0x41ead5['attributes']:_0x3abe0d[_0x8add('0x3d')];if(_0x485fc4[_0x8add('0x39')][_0x8add('0x4a')]){_0x41ead5['include']=[{'all':!![]}];}_0x41ead5=_[_0x8add('0x48')]({},_0x41ead5,_0x485fc4['options']);return db[_0x8add('0x49')][_0x8add('0x4f')](_0x41ead5)['then'](handleEntityNotFound(_0x322860,null))['then'](respondWithResult(_0x322860,null))[_0x8add('0x4e')](handleError(_0x322860,null));};exports[_0x8add('0x50')]=function(_0x43427a,_0x180332,_0x851892){return db['Plugin'][_0x8add('0x4f')]({'where':{'id':_0x43427a[_0x8add('0x51')]['id']},'attributes':[_0x8add('0x32'),_0x8add('0x9')],'raw':!![]})['then'](handleEntityNotFound(_0x180332,null))[_0x8add('0x2d')](function(_0x40847b){if(_0x40847b){var _0x47761f=path[_0x8add('0x52')](config['root'],_0x8add('0x53'),util['format'](_0x8add('0x54'),path[_0x8add('0x55')](_0x40847b[_0x8add('0x9')])));var _0x34251f=fs['createWriteStream'](_0x47761f);var _0x40b07c=archiver(_0x8add('0x56'),{'zlib':{'level':0x9}});_0x40b07c['on']('warning',function(_0x1fb61a){if(_0x1fb61a[_0x8add('0x57')]===_0x8add('0x58')){logger[_0x8add('0x31')](_0x1fb61a);}else{throw new db['Sequelize'][(_0x8add('0x59'))](_0x8add('0x5a'));}});_0x40b07c['on']('error',function(_0x29e4d8){throw new db[(_0x8add('0x5b'))][(_0x8add('0x59'))](_0x8add('0x5a'));});_0x40b07c[_0x8add('0x5c')](_0x34251f);_0x40b07c[_0x8add('0x5d')](_0x8add('0x5e'),{'cwd':path[_0x8add('0x52')](config['root'],_0x8add('0x53'),path[_0x8add('0x5f')](_0x40847b[_0x8add('0x9')])),'ignore':[path[_0x8add('0x52')](path[_0x8add('0x55')](_0x40847b[_0x8add('0x9')]),_0x8add('0x60')),path[_0x8add('0x52')](path[_0x8add('0x55')](_0x40847b[_0x8add('0x9')]),_0x8add('0x61'))],'nodir':!![]})[_0x8add('0x62')]();_0x34251f['on'](_0x8add('0x63'),function(){if(!fs[_0x8add('0x64')](_0x47761f)){throw new db['Sequelize']['Error'](_0x8add('0x65'));}return _0x180332[_0x8add('0x50')](_0x47761f,util[_0x8add('0x66')](_0x8add('0x54'),path['basename'](_0x40847b[_0x8add('0x9')])),function(_0x58c270){if(_0x58c270){throw new db[(_0x8add('0x5b'))][(_0x8add('0x59'))](_0x8add('0x67'));}fs['unlinkSync'](_0x47761f);logger[_0x8add('0x68')](_0x8add('0x69'));logger[_0x8add('0x68')](_0x8add('0x6a'));});});}return null;})[_0x8add('0x4e')](handleError(_0x180332,null));};exports[_0x8add('0x6b')]=function(_0x53324b,_0x8fc478,_0x48eb63){var _0x54b3d8=path[_0x8add('0x55')](_0x53324b['file'][_0x8add('0x6c')],path[_0x8add('0x6d')](_0x53324b[_0x8add('0x6e')][_0x8add('0x6c')]));var _0x3cbdb7=path[_0x8add('0x52')](config['root'],'server/files/plugins',_0x53324b[_0x8add('0x6e')]['filename']);var _0x1d195e=path[_0x8add('0x52')](config['root'],_0x8add('0x53'),_0x54b3d8);logger[_0x8add('0x68')]('Plugin\x20upload\x20filepath:\x20%s',_0x3cbdb7);logger['info'](_0x8add('0x6f'),_0x1d195e);try{fs['chmodSync'](_0x3cbdb7,parseInt(_0x8add('0x70'),0x8));extract(_0x3cbdb7,{'dir':_0x1d195e},function(_0x124e1a){if(_0x124e1a){logger[_0x8add('0x31')](_0x124e1a);handleError(_0x124e1a,!![]);};var _0x51fa54=fs['readdirSync'](_0x1d195e);if(_0x51fa54[_0x8add('0x40')]>0x1){removeReferences(_0x3cbdb7,_0x1d195e);logger[_0x8add('0x31')]('Invalid\x20plugin\x20structure');return _0x48eb63(new Error('Invalid\x20plugin\x20structure'));}var _0x362374=fs[_0x8add('0x71')](path[_0x8add('0x52')](_0x1d195e,_0x51fa54[0x0]));if(_0x362374[_0x8add('0x72')]()){removeReferences(_0x3cbdb7,_0x1d195e);logger[_0x8add('0x31')]('Invalid\x20plugin\x20structure');return _0x48eb63(new Error(_0x8add('0x73')));}if(_0x362374[_0x8add('0x74')]()){var _0x50a9e7=fs[_0x8add('0x75')](path[_0x8add('0x52')](_0x1d195e,_0x51fa54[0x0]));if(_0x50a9e7[_0x8add('0x40')]===0x0){removeReferences(_0x3cbdb7,_0x1d195e);logger[_0x8add('0x31')](_0x8add('0x73'));return _0x48eb63(new Error(_0x8add('0x73')));}var _0x33c999=_0x50a9e7[_0x8add('0x76')](function(_0x165368){return _0x165368==='manifest.json';});if(!_0x33c999){return _0x48eb63(new Error(_0x8add('0x77')));}var _0x485750=fs[_0x8add('0x78')](path[_0x8add('0x52')](_0x1d195e,_0x51fa54[0x0],_0x8add('0x79')));var _0x160fe0=JSON[_0x8add('0x7a')](_0x485750);if(_0x8add('0x27')==typeof _0x160fe0['name']){return _0x48eb63(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x160fe0[_0x8add('0x37')]){return _0x48eb63(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8add('0x27')==typeof _0x160fe0[_0x8add('0x7b')]){return _0x48eb63(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x8add('0x27')==typeof _0x160fe0[_0x8add('0x7c')]){return _0x48eb63(new Error(_0x8add('0x7d')));}if(_0x160fe0['type']===_0x8add('0x7e')){if('undefined'==typeof _0x160fe0['parameters'][_0x8add('0x7f')]){return _0x48eb63(new Error(_0x8add('0x80')));}if('undefined'==typeof _0x160fe0[_0x8add('0x7c')]['views'][_0x8add('0x81')]&&_0x8add('0x27')==typeof _0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')]['agent']){return _0x48eb63(new Error(_0x8add('0x82')));}}else if(_0x160fe0[_0x8add('0x37')]===_0x8add('0x83')){if('undefined'==typeof _0x160fe0[_0x8add('0x7c')]['scriptName']){return _0x48eb63(new Error(_0x8add('0x84')));}if('undefined'==typeof _0x160fe0[_0x8add('0x7c')][_0x8add('0x85')]){return _0x48eb63(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x48eb63(new Error(_0x8add('0x86')));}var _0x186f4b=_0x160fe0[_0x8add('0x32')];var _0x4400c7=_0x160fe0[_0x8add('0x87')];var _0x44c5f4=_0x160fe0['type'];var _0x4e43bb=_0x160fe0['sidebar']?_0x160fe0['sidebar']:_0x8add('0x88');var _0x500094=_0x160fe0['icon']?_0x160fe0['icon']:'icon-apps';var _0xbed7dd='';var _0x3d61dd='';var _0x360980='';var _0x2ea00f='';var _0x268fcf=_0x160fe0[_0x8add('0x7b')];if(_0x44c5f4===_0x8add('0x7e')){if(_0x8add('0x27')!=typeof _0x160fe0[_0x8add('0x7c')]['views'][_0x8add('0x81')]){var _0x5a000a=_0x160fe0[_0x8add('0x7c')]['views'][_0x8add('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x8add('0x89')](_0x5a000a)){_0xbed7dd=path['join'](_0x8add('0x8a'),_0x54b3d8,_0x51fa54[0x0],_0x5a000a);}else{_0xbed7dd=_0x5a000a;}}else{logger[_0x8add('0x68')](_0x8add('0x8b'));}if(_0x8add('0x27')!=typeof _0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')][_0x8add('0x8c')]){var _0x36531f=_0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')][_0x8add('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x8add('0x89')](_0x36531f)){_0x3d61dd=path['join'](_0x8add('0x8a'),_0x54b3d8,_0x51fa54[0x0],_0x36531f);}else{_0x3d61dd=_0x36531f;}}else{logger[_0x8add('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x44c5f4===_0x8add('0x83')){_0x360980=_0x160fe0['parameters'][_0x8add('0x8d')];_0x2ea00f=_0x160fe0['parameters'][_0x8add('0x85')];if(_0x8add('0x27')!=typeof _0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')]){if(_0x8add('0x27')!=typeof _0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')][_0x8add('0x81')]){var _0x5a000a=_0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')][_0x8add('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x8add('0x89')](_0x5a000a)){_0xbed7dd=path[_0x8add('0x52')](_0x8add('0x8a'),_0x54b3d8,_0x51fa54[0x0],_0x5a000a);}else{_0xbed7dd=_0x5a000a;}}if('undefined'!=typeof _0x160fe0[_0x8add('0x7c')][_0x8add('0x7f')][_0x8add('0x8c')]){var _0x36531f=_0x160fe0['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x8add('0x89')](_0x36531f)){_0x3d61dd=path[_0x8add('0x52')]('plugins',_0x54b3d8,_0x51fa54[0x0],_0x36531f);}else{_0x3d61dd=_0x36531f;}}}}var _0xa3ef71={'name':_0x186f4b,'description':_0x4400c7,'path':path[_0x8add('0x52')](_0x54b3d8,_0x51fa54[0x0]),'type':_0x44c5f4,'sidebar':_0x4e43bb,'icon':_0x500094,'adminUrl':_0xbed7dd,'agentUrl':_0x3d61dd,'scriptName':_0x360980,'scriptPath':_0x2ea00f,'version':_0x268fcf};removeReferences(_0x3cbdb7,null);return db[_0x8add('0x49')][_0x8add('0x8e')](_0xa3ef71)['then'](function(_0x3d19ac){var _0x5edff0={'role':_0x53324b[_0x8add('0x8f')][_0x8add('0x90')],'userProfileId':_0x53324b[_0x8add('0x8f')][_0x8add('0x91')]};if(!_0x5edff0)throw new Error(_0x8add('0x92'));if(_0x5edff0[_0x8add('0x90')]==='user'){var _0x50c9b4=_0x3d19ac['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Plugins','userProfileId':_0x5edff0[_0x8add('0x91')]},'raw':!![]})[_0x8add('0x2d')](function(_0x121433){if(_0x121433&&_0x121433[_0x8add('0x93')]===0x0){return db['UserProfileResource'][_0x8add('0x8e')]({'name':_0x50c9b4['name'],'resourceId':_0x50c9b4['id'],'type':_0x121433[_0x8add('0x32')],'sectionId':_0x121433['id']},{})[_0x8add('0x2d')](function(){return _0x3d19ac;});}else{return _0x3d19ac;}})[_0x8add('0x4e')](function(_0x7cd78d){logger[_0x8add('0x31')](_0x8add('0x94'),_0x7cd78d);throw _0x7cd78d;});}return _0x3d19ac;})[_0x8add('0x2d')](respondWithResult(_0x8fc478,null))[_0x8add('0x4e')](handleError(_0x8fc478,null));}});}catch(_0xc0f49f){_0x8fc478[_0x8add('0x22')](0x1f4)[_0x8add('0x95')](_0xc0f49f);}};function removeReferences(_0x31b75d,_0x4cc5e9){try{if(_0x31b75d){fs[_0x8add('0x96')](_0x31b75d);logger[_0x8add('0x68')](_0x8add('0x97'));}if(_0x4cc5e9){rimraf(_0x4cc5e9,function(){});logger['info'](_0x8add('0x98'));}}catch(_0x1c6d09){logger['error'](_0x1c6d09);}}exports[_0x8add('0x2c')]=function(_0xa60ad3,_0x2635e1,_0x3332cd){return db[_0x8add('0x49')][_0x8add('0x4f')]({'where':{'id':_0xa60ad3[_0x8add('0x51')]['id']}})[_0x8add('0x2d')](handleEntityNotFound(_0x2635e1,null))['then'](saveUpdates(_0xa60ad3[_0x8add('0x8f')],null))[_0x8add('0x2d')](respondWithResult(_0x2635e1,null))[_0x8add('0x4e')](handleError(_0x2635e1,null));};exports['delete']=function(_0x4b8c13,_0xd7b2f0,_0x493720){return db['Plugin'][_0x8add('0x4f')]({'where':{'id':_0x4b8c13[_0x8add('0x51')]['id']}})['then'](function(_0x318a99){if(_0x318a99){return _0x318a99['destroy']();}})[_0x8add('0x2d')](function(_0x376037){rimraf(path[_0x8add('0x52')](config[_0x8add('0x99')],_0x8add('0x53'),path['dirname'](_0x376037[_0x8add('0x9')])),function(){});return _0x376037;})['then'](handleEntityNotFound(_0xd7b2f0,null))[_0x8add('0x2d')](respondWithStatusCode(_0xd7b2f0,null))[_0x8add('0x4e')](handleError(_0xd7b2f0,null));};exports[_0x8add('0x9a')]=function(_0x21152d,_0x1dee21,_0x19830c){return BPromise[_0x8add('0x9b')]()[_0x8add('0x2d')](function(){if(!_0x21152d['query'][_0x8add('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x21152d[_0x8add('0x39')][_0x8add('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3a6ff2=_0x21152d[_0x8add('0x39')][_0x8add('0x9d')]?_0x21152d['query']['hostname']+':'+_0x21152d[_0x8add('0x39')]['port']:_0x8add('0x9e')+_0x21152d[_0x8add('0x39')]['port'];var _0x52e733=_0x21152d[_0x8add('0x39')]['json']?_0x21152d[_0x8add('0x39')][_0x8add('0x24')]:!![];var _0x1c58b9=_0x21152d['query'][_0x8add('0x9f')]?_0x21152d[_0x8add('0x39')][_0x8add('0x9f')]:null;var _0x2b38db={'method':_0x21152d[_0x8add('0xa0')],'uri':util[_0x8add('0x66')](_0x8add('0xa1'),_0x3a6ff2,_0x21152d[_0x8add('0x39')][_0x8add('0x9')]),'json':_0x52e733,'resolveWithFullResponse':!![],'encoding':_0x1c58b9,'qs':_0x21152d[_0x8add('0x39')]};if(_0x21152d['headers']){_0x2b38db['headers']=_0x21152d[_0x8add('0xa2')];if(_0x2b38db['headers'][_0x8add('0xa3')]){delete _0x2b38db[_0x8add('0xa2')][_0x8add('0xa3')];}}if(_0x2b38db[_0x8add('0xa2')]['content-type']){delete _0x2b38db[_0x8add('0xa2')]['content-type'];}return rp(_0x2b38db);})[_0x8add('0x2d')](function(_0x404b22){if(_0x404b22){_0x1dee21[_0x8add('0x29')](_0x404b22[_0x8add('0xa2')]);logger['info'](_0x404b22['body']);if(_['endsWith'](_0x21152d[_0x8add('0x39')][_0x8add('0x9')],_0x8add('0x50'))&&_0x404b22[_0x8add('0xa4')]==0x1f4){return _0x1dee21['sendStatus'](_0x404b22['statusCode']);}else{return _0x1dee21['status'](_0x404b22['statusCode'])[_0x8add('0x95')](_0x404b22['body']);}}else{return _0x1dee21[_0x8add('0x21')](0xc8);}})[_0x8add('0x4e')](handleError(_0x1dee21,null));};exports[_0x8add('0xa5')]=function(_0xf2b472,_0x536aba,_0x1cd5a2){return BPromise[_0x8add('0x9b')]()[_0x8add('0x2d')](function(){if(!_0xf2b472[_0x8add('0x39')][_0x8add('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xf2b472[_0x8add('0x39')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x581e88=_0xf2b472['query'][_0x8add('0x9d')]?_0xf2b472[_0x8add('0x39')][_0x8add('0x9d')]+':'+_0xf2b472[_0x8add('0x39')]['port']:_0x8add('0x9e')+_0xf2b472['query'][_0x8add('0x9c')];var _0x48cbe3=_0xf2b472['query']['json']?_0xf2b472[_0x8add('0x39')][_0x8add('0x24')]:!![];var _0x5421b2=_0xf2b472[_0x8add('0x39')][_0x8add('0x9f')]?_0xf2b472[_0x8add('0x39')]['encoding']:null;var _0x38256a={'method':_0xf2b472[_0x8add('0xa0')],'uri':util[_0x8add('0x66')](_0x8add('0xa1'),_0x581e88,_0xf2b472[_0x8add('0x39')][_0x8add('0x9')]),'json':_0x48cbe3,'resolveWithFullResponse':!![],'encoding':_0x5421b2,'body':_0xf2b472[_0x8add('0x8f')]};if(_0xf2b472[_0x8add('0xa2')]){_0x38256a[_0x8add('0xa2')]=_0xf2b472[_0x8add('0xa2')];if(_0x38256a[_0x8add('0xa2')][_0x8add('0xa3')]){delete _0x38256a['headers'][_0x8add('0xa3')];}}if(_0x38256a[_0x8add('0xa2')][_0x8add('0xa6')]){delete _0x38256a[_0x8add('0xa2')]['content-type'];}return rp(_0x38256a);})['then'](function(_0x36210c){if(_0x36210c){_0x536aba['set'](_0x36210c['headers']);logger[_0x8add('0x68')](_0x36210c[_0x8add('0x8f')]);return _0x536aba[_0x8add('0x22')](_0x36210c['statusCode'])[_0x8add('0x95')](_0x36210c['body']);}else{return _0x536aba[_0x8add('0x21')](0xc8);}})['catch'](handleError(_0x536aba,null));}; \ No newline at end of file +var _0xfb18=['root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','body','userProfileId','user','UserProfileSection','Plugins','autoAssociation','UserProfileResource','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','hostname','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','status','json','offset','undefined','count','limit','reject','update','then','get','destroy','end','sendStatus','error','stack','name','index','map','Plugin','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','params','includeAll','options','download','find','join','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','catch','upload','file','filename','extname'];(function(_0x534be4,_0xb96494){var _0x5dec4b=function(_0x567614){while(--_0x567614){_0x534be4['push'](_0x534be4['shift']());}};_0x5dec4b(++_0xb96494);}(_0xfb18,0xe4));var _0x8fb1=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0xfb18[_0x36940e];return _0x3283f2;};'use strict';var emlformat=require(_0x8fb1('0x0'));var rimraf=require(_0x8fb1('0x1'));var zipdir=require(_0x8fb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fb1('0x3'));var moment=require(_0x8fb1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8fb1('0x5'));var util=require('util');var path=require(_0x8fb1('0x6'));var sox=require('sox');var csv=require(_0x8fb1('0x7'));var ejs=require(_0x8fb1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fb1('0x9'));var squel=require(_0x8fb1('0xa'));var crypto=require(_0x8fb1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8fb1('0xc'));var toCsv=require(_0x8fb1('0x7'));var querystring=require('querystring');var Papa=require(_0x8fb1('0xd'));var extract=require(_0x8fb1('0xe'));var rimraf=require(_0x8fb1('0x1'));var archiver=require(_0x8fb1('0xf'));var Redis=require('ioredis');var authService=require(_0x8fb1('0x10'));var qs=require(_0x8fb1('0x11'));var as=require(_0x8fb1('0x12'));var hardwareService=require(_0x8fb1('0x13'));var logger=require('../../config/logger')(_0x8fb1('0x14'));var utils=require(_0x8fb1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8fb1('0x16'));var db=require(_0x8fb1('0x17'))['db'];config[_0x8fb1('0x18')]=_['defaults'](config['redis'],{'host':_0x8fb1('0x19'),'port':0x18eb});var socket=require(_0x8fb1('0x1a'))(new Redis(config[_0x8fb1('0x18')]));require(_0x8fb1('0x1b'))['register'](socket);function respondWithStatusCode(_0x3c028b,_0x26530f){_0x26530f=_0x26530f||0xcc;return function(_0x4a1252){if(_0x4a1252){return _0x3c028b['sendStatus'](_0x26530f);}return _0x3c028b['status'](_0x26530f)['end']();};}function respondWithResult(_0x54a70c,_0x162101){_0x162101=_0x162101||0xc8;return function(_0x313d02){if(_0x313d02){return _0x54a70c[_0x8fb1('0x1c')](_0x162101)[_0x8fb1('0x1d')](_0x313d02);}};}function respondWithFilteredResult(_0x5dcff9,_0x24d5f8){return function(_0x5f5746){if(_0x5f5746){var _0x3b7e4d=typeof _0x24d5f8[_0x8fb1('0x1e')]===_0x8fb1('0x1f')&&typeof _0x24d5f8['limit']===_0x8fb1('0x1f');var _0x51c9d4=_0x5f5746[_0x8fb1('0x20')];var _0x5149bf=_0x3b7e4d?0x0:_0x24d5f8['offset'];var _0x47e645=_0x3b7e4d?_0x5f5746[_0x8fb1('0x20')]:_0x24d5f8['offset']+_0x24d5f8[_0x8fb1('0x21')];var _0x598b4c;if(_0x47e645>=_0x51c9d4){_0x47e645=_0x51c9d4;_0x598b4c=0xc8;}else{_0x598b4c=0xce;}_0x5dcff9[_0x8fb1('0x1c')](_0x598b4c);return _0x5dcff9['set']('Content-Range',_0x5149bf+'-'+_0x47e645+'/'+_0x51c9d4)[_0x8fb1('0x1d')](_0x5f5746);}return null;};}function patchUpdates(_0x35c103){return function(_0x3ed5bc){try{jsonpatch['apply'](_0x3ed5bc,_0x35c103,!![]);}catch(_0x17dd01){return BPromise[_0x8fb1('0x22')](_0x17dd01);}return _0x3ed5bc['save']();};}function saveUpdates(_0x4f60c9,_0x4a0928){return function(_0x5cc9b8){if(_0x5cc9b8){return _0x5cc9b8[_0x8fb1('0x23')](_0x4f60c9)['then'](function(_0x18c8de){return _0x18c8de;});}return null;};}function removeEntity(_0x58512b,_0x516a09){return function(_0xfdbc75){if(_0xfdbc75){return _0xfdbc75['destroy']()[_0x8fb1('0x24')](function(){var _0x38e1f9=_0xfdbc75[_0x8fb1('0x25')]({'plain':!![]});var _0xddd7ba='Plugins';return db['UserProfileResource'][_0x8fb1('0x26')]({'where':{'type':_0xddd7ba,'resourceId':_0x38e1f9['id']}})[_0x8fb1('0x24')](function(){return _0xfdbc75;});})[_0x8fb1('0x24')](function(){_0x58512b[_0x8fb1('0x1c')](0xcc)[_0x8fb1('0x27')]();});}};}function handleEntityNotFound(_0x19b2d7,_0x46a6e6){return function(_0x49cc11){if(!_0x49cc11){_0x19b2d7[_0x8fb1('0x28')](0x194);}return _0x49cc11;};}function handleError(_0x1dc28c,_0x2189c5){_0x2189c5=_0x2189c5||0x1f4;return function(_0x544c7d){logger[_0x8fb1('0x29')](_0x544c7d[_0x8fb1('0x2a')]);if(_0x544c7d[_0x8fb1('0x2b')]){delete _0x544c7d[_0x8fb1('0x2b')];}_0x1dc28c[_0x8fb1('0x1c')](_0x2189c5)['send'](_0x544c7d);};}exports[_0x8fb1('0x2c')]=function(_0xbfa7b7,_0x187b1c){var _0x469223={},_0x6be19a={},_0x6668ac={'count':0x0,'rows':[]};var _0x4147cb=_[_0x8fb1('0x2d')](db[_0x8fb1('0x2e')][_0x8fb1('0x2f')],function(_0x459470){return{'name':_0x459470['fieldName'],'type':_0x459470[_0x8fb1('0x30')][_0x8fb1('0x31')]};});_0x6be19a[_0x8fb1('0x32')]=_['map'](_0x4147cb,_0x8fb1('0x2b'));_0x6be19a[_0x8fb1('0x33')]=_[_0x8fb1('0x34')](_0xbfa7b7[_0x8fb1('0x33')]);_0x6be19a[_0x8fb1('0x35')]=_[_0x8fb1('0x36')](_0x6be19a[_0x8fb1('0x32')],_0x6be19a[_0x8fb1('0x33')]);_0x469223[_0x8fb1('0x37')]=_['intersection'](_0x6be19a[_0x8fb1('0x32')],qs[_0x8fb1('0x38')](_0xbfa7b7[_0x8fb1('0x33')]['fields']));_0x469223[_0x8fb1('0x37')]=_0x469223[_0x8fb1('0x37')][_0x8fb1('0x39')]?_0x469223['attributes']:_0x6be19a[_0x8fb1('0x32')];if(!_0xbfa7b7[_0x8fb1('0x33')][_0x8fb1('0x3a')](_0x8fb1('0x3b'))){_0x469223[_0x8fb1('0x21')]=qs[_0x8fb1('0x21')](_0xbfa7b7[_0x8fb1('0x33')]['limit']);_0x469223[_0x8fb1('0x1e')]=qs[_0x8fb1('0x1e')](_0xbfa7b7[_0x8fb1('0x33')][_0x8fb1('0x1e')]);}_0x469223[_0x8fb1('0x3c')]=qs[_0x8fb1('0x3d')](_0xbfa7b7[_0x8fb1('0x33')][_0x8fb1('0x3d')]);_0x469223[_0x8fb1('0x3e')]=qs[_0x8fb1('0x35')](_['pick'](_0xbfa7b7['query'],_0x6be19a[_0x8fb1('0x35')]),_0x4147cb);if(_0xbfa7b7['query'][_0x8fb1('0x3f')]){_0x469223[_0x8fb1('0x3e')]=_[_0x8fb1('0x40')](_0x469223[_0x8fb1('0x3e')],{'$or':_[_0x8fb1('0x2d')](_0x4147cb,function(_0x1d60e0){if(_0x1d60e0['type']!=='VIRTUAL'){var _0x1fa7ce={};_0x1fa7ce[_0x1d60e0[_0x8fb1('0x2b')]]={'$like':'%'+_0xbfa7b7['query'][_0x8fb1('0x3f')]+'%'};return _0x1fa7ce;}})});}_0x469223=_[_0x8fb1('0x40')]({},_0x469223,_0xbfa7b7['options']);var _0x196fac={'where':_0x469223[_0x8fb1('0x3e')]};return db[_0x8fb1('0x2e')]['count'](_0x196fac)[_0x8fb1('0x24')](function(_0x1a8687){_0x6668ac[_0x8fb1('0x20')]=_0x1a8687;if(_0xbfa7b7[_0x8fb1('0x33')]['includeAll']){_0x469223[_0x8fb1('0x41')]=[{'all':!![]}];}return db[_0x8fb1('0x2e')]['findAll'](_0x469223);})['then'](function(_0x5cd4a4){_0x6668ac['rows']=_0x5cd4a4;return _0x6668ac;})[_0x8fb1('0x24')](respondWithFilteredResult(_0x187b1c,_0x469223))['catch'](handleError(_0x187b1c,null));};exports['show']=function(_0x372a73,_0x2fcb16){var _0x3554f8={'raw':!![],'where':{'id':_0x372a73[_0x8fb1('0x42')]['id']}},_0x942ab1={};_0x942ab1[_0x8fb1('0x32')]=_[_0x8fb1('0x34')](db['Plugin'][_0x8fb1('0x2f')]);_0x942ab1[_0x8fb1('0x33')]=_['keys'](_0x372a73['query']);_0x942ab1[_0x8fb1('0x35')]=_['intersection'](_0x942ab1[_0x8fb1('0x32')],_0x942ab1[_0x8fb1('0x33')]);_0x3554f8[_0x8fb1('0x37')]=_[_0x8fb1('0x36')](_0x942ab1[_0x8fb1('0x32')],qs[_0x8fb1('0x38')](_0x372a73['query'][_0x8fb1('0x38')]));_0x3554f8['attributes']=_0x3554f8[_0x8fb1('0x37')][_0x8fb1('0x39')]?_0x3554f8[_0x8fb1('0x37')]:_0x942ab1['model'];if(_0x372a73['query'][_0x8fb1('0x43')]){_0x3554f8['include']=[{'all':!![]}];}_0x3554f8=_[_0x8fb1('0x40')]({},_0x3554f8,_0x372a73[_0x8fb1('0x44')]);return db['Plugin']['find'](_0x3554f8)[_0x8fb1('0x24')](handleEntityNotFound(_0x2fcb16,null))['then'](respondWithResult(_0x2fcb16,null))['catch'](handleError(_0x2fcb16,null));};exports[_0x8fb1('0x45')]=function(_0x56cce5,_0x227c86,_0x25130b){return db[_0x8fb1('0x2e')][_0x8fb1('0x46')]({'where':{'id':_0x56cce5[_0x8fb1('0x42')]['id']},'attributes':[_0x8fb1('0x2b'),_0x8fb1('0x6')],'raw':!![]})[_0x8fb1('0x24')](handleEntityNotFound(_0x227c86,null))[_0x8fb1('0x24')](function(_0x5bee43){if(_0x5bee43){var _0x12d76e=path[_0x8fb1('0x47')](config['root'],_0x8fb1('0x48'),util[_0x8fb1('0x49')]('%s.zip',path[_0x8fb1('0x4a')](_0x5bee43[_0x8fb1('0x6')])));var _0x3b14e0=fs[_0x8fb1('0x4b')](_0x12d76e);var _0x3f9e8f=archiver(_0x8fb1('0x4c'),{'zlib':{'level':0x9}});_0x3f9e8f['on']('warning',function(_0x496df3){if(_0x496df3[_0x8fb1('0x4d')]===_0x8fb1('0x4e')){logger[_0x8fb1('0x29')](_0x496df3);}else{throw new db[(_0x8fb1('0x4f'))][(_0x8fb1('0x50'))](_0x8fb1('0x51'));}});_0x3f9e8f['on'](_0x8fb1('0x29'),function(_0x196628){throw new db['Sequelize'][(_0x8fb1('0x50'))](_0x8fb1('0x51'));});_0x3f9e8f[_0x8fb1('0x52')](_0x3b14e0);_0x3f9e8f['glob'](_0x8fb1('0x53'),{'cwd':path['join'](config['root'],_0x8fb1('0x48'),path[_0x8fb1('0x54')](_0x5bee43[_0x8fb1('0x6')])),'ignore':[path[_0x8fb1('0x47')](path[_0x8fb1('0x4a')](_0x5bee43['path']),_0x8fb1('0x55')),path['join'](path[_0x8fb1('0x4a')](_0x5bee43[_0x8fb1('0x6')]),_0x8fb1('0x56'))],'nodir':!![]})[_0x8fb1('0x57')]();_0x3b14e0['on'](_0x8fb1('0x58'),function(){if(!fs['existsSync'](_0x12d76e)){throw new db[(_0x8fb1('0x4f'))][(_0x8fb1('0x50'))](_0x8fb1('0x59'));}return _0x227c86['download'](_0x12d76e,util['format'](_0x8fb1('0x5a'),path[_0x8fb1('0x4a')](_0x5bee43[_0x8fb1('0x6')])),function(_0x2d7114){if(_0x2d7114){throw new db['Sequelize'][(_0x8fb1('0x50'))](_0x8fb1('0x5b'));}fs[_0x8fb1('0x5c')](_0x12d76e);logger[_0x8fb1('0x5d')]('Download\x20completed');logger[_0x8fb1('0x5d')](_0x8fb1('0x5e'));});});}return null;})[_0x8fb1('0x5f')](handleError(_0x227c86,null));};exports[_0x8fb1('0x60')]=function(_0x38b2f2,_0x593812,_0x58782a){var _0x4f477c=path['basename'](_0x38b2f2[_0x8fb1('0x61')][_0x8fb1('0x62')],path[_0x8fb1('0x63')](_0x38b2f2[_0x8fb1('0x61')]['filename']));var _0x170dd8=path['join'](config[_0x8fb1('0x64')],_0x8fb1('0x48'),_0x38b2f2[_0x8fb1('0x61')][_0x8fb1('0x62')]);var _0x2877ee=path[_0x8fb1('0x47')](config['root'],_0x8fb1('0x48'),_0x4f477c);logger[_0x8fb1('0x5d')](_0x8fb1('0x65'),_0x170dd8);logger[_0x8fb1('0x5d')](_0x8fb1('0x66'),_0x2877ee);try{fs[_0x8fb1('0x67')](_0x170dd8,parseInt(_0x8fb1('0x68'),0x8));extract(_0x170dd8,{'dir':_0x2877ee},function(_0x36872d){if(_0x36872d){logger[_0x8fb1('0x29')](_0x36872d);handleError(_0x36872d,!![]);};var _0xcb1b18=fs[_0x8fb1('0x69')](_0x2877ee);if(_0xcb1b18[_0x8fb1('0x39')]>0x1){removeReferences(_0x170dd8,_0x2877ee);logger[_0x8fb1('0x29')](_0x8fb1('0x6a'));return _0x58782a(new Error(_0x8fb1('0x6a')));}var _0x58e8b8=fs[_0x8fb1('0x6b')](path[_0x8fb1('0x47')](_0x2877ee,_0xcb1b18[0x0]));if(_0x58e8b8[_0x8fb1('0x6c')]()){removeReferences(_0x170dd8,_0x2877ee);logger[_0x8fb1('0x29')](_0x8fb1('0x6a'));return _0x58782a(new Error('Invalid\x20plugin\x20structure'));}if(_0x58e8b8[_0x8fb1('0x6d')]()){var _0x15fc59=fs[_0x8fb1('0x69')](path['join'](_0x2877ee,_0xcb1b18[0x0]));if(_0x15fc59['length']===0x0){removeReferences(_0x170dd8,_0x2877ee);logger[_0x8fb1('0x29')](_0x8fb1('0x6a'));return _0x58782a(new Error(_0x8fb1('0x6a')));}var _0x42a55b=_0x15fc59[_0x8fb1('0x6e')](function(_0x434acd){return _0x434acd===_0x8fb1('0x6f');});if(!_0x42a55b){return _0x58782a(new Error(_0x8fb1('0x70')));}var _0x334c3d=fs[_0x8fb1('0x71')](path[_0x8fb1('0x47')](_0x2877ee,_0xcb1b18[0x0],_0x8fb1('0x6f')));var _0x44439e=JSON[_0x8fb1('0x72')](_0x334c3d);if(_0x8fb1('0x1f')==typeof _0x44439e[_0x8fb1('0x2b')]){return _0x58782a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x8fb1('0x1f')==typeof _0x44439e['type']){return _0x58782a(new Error(_0x8fb1('0x73')));}if(_0x8fb1('0x1f')==typeof _0x44439e[_0x8fb1('0x74')]){return _0x58782a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x44439e['parameters']){return _0x58782a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x44439e[_0x8fb1('0x30')]===_0x8fb1('0x75')){if(_0x8fb1('0x1f')==typeof _0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')]){return _0x58782a(new Error(_0x8fb1('0x78')));}if(_0x8fb1('0x1f')==typeof _0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')]['admin']&&_0x8fb1('0x1f')==typeof _0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')]['agent']){return _0x58782a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x44439e[_0x8fb1('0x30')]===_0x8fb1('0x79')){if('undefined'==typeof _0x44439e['parameters']['scriptName']){return _0x58782a(new Error(_0x8fb1('0x7a')));}if(_0x8fb1('0x1f')==typeof _0x44439e[_0x8fb1('0x76')][_0x8fb1('0x7b')]){return _0x58782a(new Error(_0x8fb1('0x7c')));}}else{return _0x58782a(new Error(_0x8fb1('0x7d')));}var _0x5c9728=_0x44439e[_0x8fb1('0x2b')];var _0x3b2c21=_0x44439e[_0x8fb1('0x7e')];var _0x3a9929=_0x44439e['type'];var _0x39161b=_0x44439e[_0x8fb1('0x7f')]?_0x44439e[_0x8fb1('0x7f')]:_0x8fb1('0x80');var _0x576a74=_0x44439e[_0x8fb1('0x81')]?_0x44439e[_0x8fb1('0x81')]:_0x8fb1('0x82');var _0x2ac7e8='';var _0x5230eb='';var _0x3a2910='';var _0x2a398d='';var _0x4a7765=_0x44439e[_0x8fb1('0x74')];if(_0x3a9929===_0x8fb1('0x75')){if('undefined'!=typeof _0x44439e[_0x8fb1('0x76')]['views'][_0x8fb1('0x83')]){var _0x3c73e6=_0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')][_0x8fb1('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x8fb1('0x84')](_0x3c73e6)){_0x2ac7e8=path[_0x8fb1('0x47')]('plugins',_0x4f477c,_0xcb1b18[0x0],_0x3c73e6);}else{_0x2ac7e8=_0x3c73e6;}}else{logger[_0x8fb1('0x5d')](_0x8fb1('0x85'));}if(_0x8fb1('0x1f')!=typeof _0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')][_0x8fb1('0x86')]){var _0x340361=_0x44439e['parameters'][_0x8fb1('0x77')][_0x8fb1('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x340361)){_0x5230eb=path[_0x8fb1('0x47')](_0x8fb1('0x87'),_0x4f477c,_0xcb1b18[0x0],_0x340361);}else{_0x5230eb=_0x340361;}}else{logger[_0x8fb1('0x5d')](_0x8fb1('0x88'));}}else if(_0x3a9929===_0x8fb1('0x79')){_0x3a2910=_0x44439e['parameters'][_0x8fb1('0x89')];_0x2a398d=_0x44439e[_0x8fb1('0x76')][_0x8fb1('0x7b')];if(_0x8fb1('0x1f')!=typeof _0x44439e[_0x8fb1('0x76')]['views']){if(_0x8fb1('0x1f')!=typeof _0x44439e['parameters'][_0x8fb1('0x77')][_0x8fb1('0x83')]){var _0x3c73e6=_0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')][_0x8fb1('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x8fb1('0x84')](_0x3c73e6)){_0x2ac7e8=path['join'](_0x8fb1('0x87'),_0x4f477c,_0xcb1b18[0x0],_0x3c73e6);}else{_0x2ac7e8=_0x3c73e6;}}if(_0x8fb1('0x1f')!=typeof _0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')]['agent']){var _0x340361=_0x44439e[_0x8fb1('0x76')][_0x8fb1('0x77')][_0x8fb1('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x8fb1('0x84')](_0x340361)){_0x5230eb=path[_0x8fb1('0x47')](_0x8fb1('0x87'),_0x4f477c,_0xcb1b18[0x0],_0x340361);}else{_0x5230eb=_0x340361;}}}}var _0x38f05d={'name':_0x5c9728,'description':_0x3b2c21,'path':path[_0x8fb1('0x47')](_0x4f477c,_0xcb1b18[0x0]),'type':_0x3a9929,'sidebar':_0x39161b,'icon':_0x576a74,'adminUrl':_0x2ac7e8,'agentUrl':_0x5230eb,'scriptName':_0x3a2910,'scriptPath':_0x2a398d,'version':_0x4a7765};removeReferences(_0x170dd8,null);return db['Plugin'][_0x8fb1('0x8a')](_0x38f05d)[_0x8fb1('0x24')](function(_0x12a13a){var _0x1fef19={'role':_0x38b2f2['body'][_0x8fb1('0x8b')],'userProfileId':_0x38b2f2[_0x8fb1('0x8c')][_0x8fb1('0x8d')]};if(!_0x1fef19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fef19[_0x8fb1('0x8b')]===_0x8fb1('0x8e')){var _0x41e8d7=_0x12a13a[_0x8fb1('0x25')]({'plain':!![]});return db[_0x8fb1('0x8f')][_0x8fb1('0x46')]({'where':{'name':_0x8fb1('0x90'),'userProfileId':_0x1fef19[_0x8fb1('0x8d')]},'raw':!![]})[_0x8fb1('0x24')](function(_0x222d93){if(_0x222d93&&_0x222d93[_0x8fb1('0x91')]===0x0){return db[_0x8fb1('0x92')]['create']({'name':_0x41e8d7[_0x8fb1('0x2b')],'resourceId':_0x41e8d7['id'],'type':_0x222d93[_0x8fb1('0x2b')],'sectionId':_0x222d93['id']},{})[_0x8fb1('0x24')](function(){return _0x12a13a;});}else{return _0x12a13a;}})['catch'](function(_0x2bd482){logger[_0x8fb1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bd482);throw _0x2bd482;});}return _0x12a13a;})[_0x8fb1('0x24')](respondWithResult(_0x593812,null))[_0x8fb1('0x5f')](handleError(_0x593812,null));}});}catch(_0x31ece1){_0x593812[_0x8fb1('0x1c')](0x1f4)[_0x8fb1('0x93')](_0x31ece1);}};function removeReferences(_0x4ae947,_0x135c00){try{if(_0x4ae947){fs[_0x8fb1('0x5c')](_0x4ae947);logger['info'](_0x8fb1('0x94'));}if(_0x135c00){rimraf(_0x135c00,function(){});logger[_0x8fb1('0x5d')](_0x8fb1('0x95'));}}catch(_0x7acee9){logger[_0x8fb1('0x29')](_0x7acee9);}}exports['update']=function(_0x411da0,_0x57dd9c,_0xc10e1d){return db[_0x8fb1('0x2e')][_0x8fb1('0x46')]({'where':{'id':_0x411da0[_0x8fb1('0x42')]['id']}})[_0x8fb1('0x24')](handleEntityNotFound(_0x57dd9c,null))[_0x8fb1('0x24')](saveUpdates(_0x411da0['body'],null))[_0x8fb1('0x24')](respondWithResult(_0x57dd9c,null))['catch'](handleError(_0x57dd9c,null));};exports[_0x8fb1('0x96')]=function(_0x4379e7,_0x1f29df,_0x59a516){return db[_0x8fb1('0x2e')][_0x8fb1('0x46')]({'where':{'id':_0x4379e7[_0x8fb1('0x42')]['id']}})[_0x8fb1('0x24')](function(_0x248dac){if(_0x248dac){return _0x248dac[_0x8fb1('0x26')]();}})[_0x8fb1('0x24')](function(_0x96540e){rimraf(path[_0x8fb1('0x47')](config[_0x8fb1('0x64')],'server/files/plugins',path[_0x8fb1('0x54')](_0x96540e[_0x8fb1('0x6')])),function(){});return _0x96540e;})[_0x8fb1('0x24')](handleEntityNotFound(_0x1f29df,null))[_0x8fb1('0x24')](respondWithStatusCode(_0x1f29df,null))[_0x8fb1('0x5f')](handleError(_0x1f29df,null));};exports['webhookGet']=function(_0x4fba64,_0x49ecc2,_0x41f875){return BPromise[_0x8fb1('0x97')]()[_0x8fb1('0x24')](function(){if(!_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x437b3c=_0x4fba64[_0x8fb1('0x33')]['hostname']?_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x99')]+':'+_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x98')]:'http://localhost:'+_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x98')];var _0xab4418=_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x1d')]?_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x1d')]:!![];var _0xfb3ab5=_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x9a')]?_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x9a')]:null;var _0xdf4a38={'method':_0x4fba64['method'],'uri':util[_0x8fb1('0x49')]('%s%s',_0x437b3c,_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x6')]),'json':_0xab4418,'resolveWithFullResponse':!![],'encoding':_0xfb3ab5,'qs':_0x4fba64['query']};if(_0x4fba64[_0x8fb1('0x9b')]){_0xdf4a38[_0x8fb1('0x9b')]=_0x4fba64[_0x8fb1('0x9b')];if(_0xdf4a38[_0x8fb1('0x9b')][_0x8fb1('0x9c')]){delete _0xdf4a38[_0x8fb1('0x9b')][_0x8fb1('0x9c')];}}if(_0xdf4a38[_0x8fb1('0x9b')][_0x8fb1('0x9d')]){delete _0xdf4a38[_0x8fb1('0x9b')][_0x8fb1('0x9d')];}return rp(_0xdf4a38);})[_0x8fb1('0x24')](function(_0x57acf8){if(_0x57acf8){_0x49ecc2[_0x8fb1('0x9e')](_0x57acf8[_0x8fb1('0x9b')]);logger['info'](_0x57acf8[_0x8fb1('0x8c')]);if(_[_0x8fb1('0x9f')](_0x4fba64[_0x8fb1('0x33')][_0x8fb1('0x6')],'download')&&_0x57acf8[_0x8fb1('0xa0')]==0x1f4){return _0x49ecc2[_0x8fb1('0x28')](_0x57acf8[_0x8fb1('0xa0')]);}else{return _0x49ecc2['status'](_0x57acf8[_0x8fb1('0xa0')])[_0x8fb1('0x93')](_0x57acf8[_0x8fb1('0x8c')]);}}else{return _0x49ecc2[_0x8fb1('0x28')](0xc8);}})[_0x8fb1('0x5f')](handleError(_0x49ecc2,null));};exports[_0x8fb1('0xa1')]=function(_0x4d7339,_0x44f96a,_0x14b272){return BPromise[_0x8fb1('0x97')]()[_0x8fb1('0x24')](function(){if(!_0x4d7339[_0x8fb1('0x33')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x98')]){throw new Error(_0x8fb1('0xa2'));}var _0x31d767=_0x4d7339['query']['hostname']?_0x4d7339[_0x8fb1('0x33')]['hostname']+':'+_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x98')]:'http://localhost:'+_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x98')];var _0x25b4a8=_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x1d')]?_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x1d')]:!![];var _0x36594b=_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x9a')]?_0x4d7339[_0x8fb1('0x33')]['encoding']:null;var _0xed0242={'method':_0x4d7339['method'],'uri':util[_0x8fb1('0x49')](_0x8fb1('0xa3'),_0x31d767,_0x4d7339[_0x8fb1('0x33')][_0x8fb1('0x6')]),'json':_0x25b4a8,'resolveWithFullResponse':!![],'encoding':_0x36594b,'body':_0x4d7339[_0x8fb1('0x8c')]};if(_0x4d7339[_0x8fb1('0x9b')]){_0xed0242['headers']=_0x4d7339['headers'];if(_0xed0242['headers']['content-length']){delete _0xed0242[_0x8fb1('0x9b')][_0x8fb1('0x9c')];}}if(_0xed0242[_0x8fb1('0x9b')][_0x8fb1('0x9d')]){delete _0xed0242[_0x8fb1('0x9b')][_0x8fb1('0x9d')];}return rp(_0xed0242);})[_0x8fb1('0x24')](function(_0xe5218e){if(_0xe5218e){_0x44f96a[_0x8fb1('0x9e')](_0xe5218e[_0x8fb1('0x9b')]);logger['info'](_0xe5218e[_0x8fb1('0x8c')]);return _0x44f96a[_0x8fb1('0x1c')](_0xe5218e[_0x8fb1('0xa0')])[_0x8fb1('0x93')](_0xe5218e[_0x8fb1('0x8c')]);}else{return _0x44f96a['sendStatus'](0xc8);}})[_0x8fb1('0x5f')](handleError(_0x44f96a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8b600df..29e6cf3 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 _0xdc03=['update','remove','emit','hasOwnProperty','hook','events','Plugin','setMaxListeners'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xdc03,0x65));var _0x3dc0=function(_0x46e553,_0x3a977c){_0x46e553=_0x46e553-0x0;var _0x586516=_0xdc03[_0x46e553];return _0x586516;};'use strict';var EventEmitter=require(_0x3dc0('0x0'));var Plugin=require('../../mysqldb')['db'][_0x3dc0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x3dc0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dc0('0x3'),'afterDestroy':_0x3dc0('0x4')};function emitEvent(_0x2971c1){return function(_0x10c75a,_0x3b41f0,_0x221975){PluginEvents['emit'](_0x2971c1+':'+_0x10c75a['id'],_0x10c75a);PluginEvents[_0x3dc0('0x5')](_0x2971c1,_0x10c75a);_0x221975(null);};}for(var e in events){if(events[_0x3dc0('0x6')](e)){var event=events[e];Plugin[_0x3dc0('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x1134=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x488362,_0x50b4b7){var _0x5431c1=function(_0x23c3b6){while(--_0x23c3b6){_0x488362['push'](_0x488362['shift']());}};_0x5431c1(++_0x50b4b7);}(_0x1134,0x19c));var _0x4113=function(_0xa36151,_0x23b67b){_0xa36151=_0xa36151-0x0;var _0x5939c8=_0x1134[_0xa36151];return _0x5939c8;};'use strict';var EventEmitter=require(_0x4113('0x0'));var Plugin=require(_0x4113('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4113('0x2')](0x0);var events={'afterCreate':_0x4113('0x3'),'afterUpdate':'update','afterDestroy':_0x4113('0x4')};function emitEvent(_0x143fd0){return function(_0x4acb7a,_0x3f7a19,_0x487960){PluginEvents[_0x4113('0x5')](_0x143fd0+':'+_0x4acb7a['id'],_0x4acb7a);PluginEvents['emit'](_0x143fd0,_0x4acb7a);_0x487960(null);};}for(var e in events){if(events[_0x4113('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x4113('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index be083c1..2eb5935 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 _0x7f53=['lodash','util','api','moment','bluebird','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x445ce3,_0x985e9e){var _0x1438f6=function(_0xcb1855){while(--_0xcb1855){_0x445ce3['push'](_0x445ce3['shift']());}};_0x1438f6(++_0x985e9e);}(_0x7f53,0xc0));var _0x37f5=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x7f53[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x37f5('0x0'));var util=require(_0x37f5('0x1'));var logger=require('../../config/logger')(_0x37f5('0x2'));var moment=require(_0x37f5('0x3'));var BPromise=require(_0x37f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37f5('0x5'));var rimraf=require('rimraf');var config=require(_0x37f5('0x6'));var attributes=require(_0x37f5('0x7'));module[_0x37f5('0x8')]=function(_0x3592ec,_0x550a68){return _0x3592ec[_0x37f5('0x9')](_0x37f5('0xa'),attributes,{'tableName':_0x37f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6193=['Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0x6193,0x13a));var _0x3619=function(_0x49e4e0,_0x47a9dc){_0x49e4e0=_0x49e4e0-0x0;var _0x2609a4=_0x6193[_0x49e4e0];return _0x2609a4;};'use strict';var _=require(_0x3619('0x0'));var util=require('util');var logger=require(_0x3619('0x1'))(_0x3619('0x2'));var moment=require(_0x3619('0x3'));var BPromise=require(_0x3619('0x4'));var rp=require(_0x3619('0x5'));var fs=require('fs');var path=require(_0x3619('0x6'));var rimraf=require(_0x3619('0x7'));var config=require(_0x3619('0x8'));var attributes=require(_0x3619('0x9'));module[_0x3619('0xa')]=function(_0x2b0bf7,_0x51c656){return _0x2b0bf7['define'](_0x3619('0xb'),attributes,{'tableName':_0x3619('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 3e5c00e..b733dec 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 _0x59b6=['message','catch','CreatePlugin','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x574701,_0x3da128){var _0x1c8080=function(_0x378dd6){while(--_0x378dd6){_0x574701['push'](_0x574701['shift']());}};_0x1c8080(++_0x3da128);}(_0x59b6,0x1aa));var _0x659b=function(_0x23e80a,_0x12b7be){_0x23e80a=_0x23e80a-0x0;var _0x11b1df=_0x59b6[_0x23e80a];return _0x11b1df;};'use strict';var _=require(_0x659b('0x0'));var util=require(_0x659b('0x1'));var moment=require(_0x659b('0x2'));var BPromise=require(_0x659b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x659b('0x4'));var db=require(_0x659b('0x5'))['db'];var utils=require(_0x659b('0x6'));var logger=require(_0x659b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x659b('0x8'));var client=jayson[_0x659b('0x9')][_0x659b('0xa')]({'port':0x232a});config[_0x659b('0xb')]=_[_0x659b('0xc')](config[_0x659b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x659b('0xd'))(new Redis(config[_0x659b('0xb')]));require(_0x659b('0xe'))['register'](socket);function respondWithRpcPromise(_0xae37e1,_0x2a4e40,_0x125f37){return new BPromise(function(_0x456c12,_0x20ada9){return client['request'](_0xae37e1,_0x125f37)['then'](function(_0x181c8e){logger[_0x659b('0xf')](_0x659b('0x10'),_0x2a4e40,'request\x20sent');logger[_0x659b('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2a4e40,_0x659b('0x12'),JSON[_0x659b('0x13')](_0x181c8e));if(_0x181c8e[_0x659b('0x14')]){if(_0x181c8e[_0x659b('0x14')][_0x659b('0x15')]===0x1f4){logger[_0x659b('0x14')](_0x659b('0x10'),_0x2a4e40,_0x181c8e['error']['message']);return _0x20ada9(_0x181c8e['error'][_0x659b('0x16')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x2a4e40,_0x181c8e[_0x659b('0x14')]['message']);return _0x456c12(_0x181c8e['error']['message']);}else{logger[_0x659b('0xf')](_0x659b('0x10'),_0x2a4e40,_0x659b('0x12'));_0x456c12(_0x181c8e['result'][_0x659b('0x16')]);}})[_0x659b('0x17')](function(_0xbce26e){logger[_0x659b('0x14')](_0x659b('0x10'),_0x2a4e40,_0xbce26e);_0x20ada9(_0xbce26e);});});}exports[_0x659b('0x18')]=function(_0x3f126a){var _0x4cc6b2=this;return new Promise(function(_0x398bee,_0x1c7fd2){return db['Plugin'][_0x659b('0x19')](_0x3f126a[_0x659b('0x1a')],{'raw':_0x3f126a[_0x659b('0x1b')]?_0x3f126a[_0x659b('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x410a29){logger['info'](_0x659b('0x18'),_0x3f126a);logger[_0x659b('0x11')](_0x659b('0x18'),_0x3f126a,JSON[_0x659b('0x13')](_0x410a29));_0x398bee(_0x410a29);})[_0x659b('0x17')](function(_0x45cf21){logger['error']('CreatePlugin',_0x45cf21[_0x659b('0x16')],_0x3f126a);_0x1c7fd2(_0x4cc6b2[_0x659b('0x14')](0x1f4,_0x45cf21[_0x659b('0x16')]));});});}; \ No newline at end of file +var _0x8bc8=['socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','CreatePlugin','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x199091,_0x38892e){var _0x409197=function(_0x15ea87){while(--_0x15ea87){_0x199091['push'](_0x199091['shift']());}};_0x409197(++_0x38892e);}(_0x8bc8,0x1c0));var _0x88bc=function(_0x324d77,_0x307ef7){_0x324d77=_0x324d77-0x0;var _0x2a77a7=_0x8bc8[_0x324d77];return _0x2a77a7;};'use strict';var _=require('lodash');var util=require(_0x88bc('0x0'));var moment=require(_0x88bc('0x1'));var BPromise=require(_0x88bc('0x2'));var rs=require(_0x88bc('0x3'));var fs=require('fs');var Redis=require(_0x88bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x88bc('0x5'));var logger=require(_0x88bc('0x6'))(_0x88bc('0x7'));var config=require(_0x88bc('0x8'));var jayson=require(_0x88bc('0x9'));var client=jayson[_0x88bc('0xa')][_0x88bc('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x88bc('0xc')],{'host':_0x88bc('0xd'),'port':0x18eb});var socket=require(_0x88bc('0xe'))(new Redis(config['redis']));require(_0x88bc('0xf'))[_0x88bc('0x10')](socket);function respondWithRpcPromise(_0xbfa2af,_0x1ed625,_0x3fa726){return new BPromise(function(_0x2618a3,_0x45adf5){return client[_0x88bc('0x11')](_0xbfa2af,_0x3fa726)['then'](function(_0x65c809){logger['info'](_0x88bc('0x12'),_0x1ed625,'request\x20sent');logger[_0x88bc('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1ed625,_0x88bc('0x14'),JSON[_0x88bc('0x15')](_0x65c809));if(_0x65c809[_0x88bc('0x16')]){if(_0x65c809[_0x88bc('0x16')][_0x88bc('0x17')]===0x1f4){logger['error'](_0x88bc('0x12'),_0x1ed625,_0x65c809[_0x88bc('0x16')][_0x88bc('0x18')]);return _0x45adf5(_0x65c809[_0x88bc('0x16')]['message']);}logger[_0x88bc('0x16')](_0x88bc('0x12'),_0x1ed625,_0x65c809[_0x88bc('0x16')][_0x88bc('0x18')]);return _0x2618a3(_0x65c809[_0x88bc('0x16')]['message']);}else{logger[_0x88bc('0x19')](_0x88bc('0x12'),_0x1ed625,'request\x20sent');_0x2618a3(_0x65c809[_0x88bc('0x1a')][_0x88bc('0x18')]);}})['catch'](function(_0x22185b){logger[_0x88bc('0x16')](_0x88bc('0x12'),_0x1ed625,_0x22185b);_0x45adf5(_0x22185b);});});}exports[_0x88bc('0x1b')]=function(_0x51746d){var _0x325599=this;return new Promise(function(_0x44035f,_0x515662){return db['Plugin'][_0x88bc('0x1c')](_0x51746d[_0x88bc('0x1d')],{'raw':_0x51746d['options']?_0x51746d[_0x88bc('0x1e')][_0x88bc('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x24c4e4){logger[_0x88bc('0x19')](_0x88bc('0x1b'),_0x51746d);logger['debug'](_0x88bc('0x1b'),_0x51746d,JSON[_0x88bc('0x15')](_0x24c4e4));_0x44035f(_0x24c4e4);})[_0x88bc('0x20')](function(_0x24899c){logger[_0x88bc('0x16')](_0x88bc('0x1b'),_0x24899c[_0x88bc('0x18')],_0x51746d);_0x515662(_0x325599['error'](0x1f4,_0x24899c[_0x88bc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 473e093..edcf0de 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 _0xd92a=['emit','removeListener','register','length','plugin:','./plugin.events','remove','update'];(function(_0x97cc99,_0x2f818e){var _0x23ee28=function(_0x37e9c7){while(--_0x37e9c7){_0x97cc99['push'](_0x97cc99['shift']());}};_0x23ee28(++_0x2f818e);}(_0xd92a,0x19d));var _0xad92=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd92a[_0x21a9d9];return _0x46adce;};'use strict';var PluginEvents=require(_0xad92('0x0'));var events=['save',_0xad92('0x1'),_0xad92('0x2')];function createListener(_0x5a0674,_0x3d123f){return function(_0x4ec4db){_0x3d123f[_0xad92('0x3')](_0x5a0674,_0x4ec4db);};}function removeListener(_0xbfdef8,_0x4a8aa2){return function(){PluginEvents[_0xad92('0x4')](_0xbfdef8,_0x4a8aa2);};}exports[_0xad92('0x5')]=function(_0x143bbe){for(var _0x490255=0x0,_0x2c50ac=events[_0xad92('0x6')];_0x490255<_0x2c50ac;_0x490255++){var _0x46e95f=events[_0x490255];var _0x1fd496=createListener(_0xad92('0x7')+_0x46e95f,_0x143bbe);PluginEvents['on'](_0x46e95f,_0x1fd496);}}; \ No newline at end of file +var _0xc495=['plugin:','./plugin.events','save','remove','update','emit','register','length'];(function(_0x1df670,_0x32f367){var _0x69f9f1=function(_0x3a33b6){while(--_0x3a33b6){_0x1df670['push'](_0x1df670['shift']());}};_0x69f9f1(++_0x32f367);}(_0xc495,0x1a1));var _0x5c49=function(_0x224bf8,_0x51b785){_0x224bf8=_0x224bf8-0x0;var _0x4e4e8a=_0xc495[_0x224bf8];return _0x4e4e8a;};'use strict';var PluginEvents=require(_0x5c49('0x0'));var events=[_0x5c49('0x1'),_0x5c49('0x2'),_0x5c49('0x3')];function createListener(_0x443030,_0x33d412){return function(_0x33085f){_0x33d412[_0x5c49('0x4')](_0x443030,_0x33085f);};}function removeListener(_0x4299e6,_0x18caac){return function(){PluginEvents['removeListener'](_0x4299e6,_0x18caac);};}exports[_0x5c49('0x5')]=function(_0x327638){for(var _0x22a99a=0x0,_0x39a7ea=events[_0x5c49('0x6')];_0x22a99a<_0x39a7ea;_0x22a99a++){var _0x276876=events[_0x22a99a];var _0x336c31=createListener(_0x5c49('0x7')+_0x276876,_0x327638);PluginEvents['on'](_0x276876,_0x336c31);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ad7ba01..6166268 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(_0x116b63,_0x345b91){var _0xf847ed=function(_0x55ddc1){while(--_0x55ddc1){_0x116b63['push'](_0x116b63['shift']());}};_0xf847ed(++_0x345b91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x50f573,_0x90dbeb){var _0x4e190a=function(_0x29c370){while(--_0x29c370){_0x50f573['push'](_0x50f573['shift']());}};_0x4e190a(++_0x90dbeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 b3f7f9c..94d090c 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 _0x8ce3=['length','catch','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','status','json','stack','name','send','npm\x20install','info','error','index','list','reject','express','motion2'];(function(_0x5ad0d0,_0x3e145f){var _0x38fc1d=function(_0x8a60ee){while(--_0x8a60ee){_0x5ad0d0['push'](_0x5ad0d0['shift']());}};_0x38fc1d(++_0x3e145f);}(_0x8ce3,0xc3));var _0x38ce=function(_0x5530a9,_0x48e4c2){_0x5530a9=_0x5530a9-0x0;var _0x1c69f4=_0x8ce3[_0x5530a9];return _0x1c69f4;};'use strict';var _=require(_0x38ce('0x0'));var pm2=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var path=require(_0x38ce('0x3'));var exec=require(_0x38ce('0x4'))[_0x38ce('0x5')];var BPromise=require(_0x38ce('0x6'));function handleEntityNotFound(_0x17b96d,_0x1efae3){return function(_0x381fa0){if(!_0x381fa0){_0x17b96d['sendStatus'](0x194);;}return _0x381fa0;};}function respondWithResult(_0x372f86,_0xb24f4c){_0xb24f4c=_0xb24f4c||0xc8;return function(_0x58074c){if(_0x58074c){return _0x372f86[_0x38ce('0x7')](_0xb24f4c)[_0x38ce('0x8')](_0x58074c);}return null;};}function handleError(_0x3f8011,_0x482955){_0x482955=_0x482955||0x1f4;return function(_0x3c66e5){logger['error'](_0x3c66e5[_0x38ce('0x9')]);if(_0x3c66e5['name']){delete _0x3c66e5[_0x38ce('0xa')];}_0x3f8011[_0x38ce('0x7')](_0x482955)[_0x38ce('0xb')](_0x3c66e5);};}function execChildProcess(){return new BPromise(function(_0x2c0cab,_0x564332){exec(_0x38ce('0xc'),function(_0x2a9045,_0x171a02,_0x29bd3a){logger[_0x38ce('0xd')](_0x171a02);logger[_0x38ce('0xd')](_0x29bd3a);if(_0x2a9045){logger[_0x38ce('0xe')](_0x2a9045);return _0x564332(_0x2a9045);}return _0x2c0cab(_0x171a02);});});}exports[_0x38ce('0xf')]=function(_0x263d6f,_0x2e661b){return pm2[_0x38ce('0x10')]()['then'](function(_0x48ba7c){if(_0x48ba7c){var _0x3c4d7f=_[_0x38ce('0x11')](_0x48ba7c,function(_0x2369f3){return _0x2369f3['name']===_0x38ce('0x12')||_0x2369f3['name']===_0x38ce('0x13');});return{'rows':_0x3c4d7f,'count':_0x3c4d7f[_0x38ce('0x14')]};}return null;})['then'](respondWithResult(_0x2e661b,null))[_0x38ce('0x15')](handleError(_0x2e661b,null));};exports[_0x38ce('0x16')]=function(_0x1dfaba,_0x51f670){return pm2[_0x38ce('0x17')](_0x1dfaba[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](respondWithResult(_0x51f670,null))[_0x38ce('0x19')](handleEntityNotFound(_0x51f670,null))[_0x38ce('0x15')](handleError(_0x51f670,null));};exports[_0x38ce('0x1a')]=function(_0x2d4218,_0x518b04){if(_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')]&&_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]){var _0x30b060=path[_0x38ce('0x1d')](__dirname,_0x38ce('0x1e'),_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]);var _0x3cf50b=process[_0x38ce('0x1f')]();process['chdir'](path[_0x38ce('0x20')](_0x30b060));return execChildProcess()[_0x38ce('0x19')](function(_0xe40e9c){process[_0x38ce('0x21')](_0x3cf50b);return pm2['start']({'name':_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')],'script':_0x30b060});})['then'](function(_0xe0af00){pm2[_0x38ce('0x22')]();return _0xe0af00[0x0];})[_0x38ce('0x19')](respondWithResult(_0x518b04,0xc9))['catch'](handleError(_0x518b04,null));}else{return _0x518b04['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x23')});}};exports[_0x38ce('0x24')]=function(_0x21d4e7,_0x264cf0){if(_0x21d4e7[_0x38ce('0x1b')]['id']){delete _0x21d4e7[_0x38ce('0x1b')]['id'];}var _0xce1f64={'online':_0x38ce('0x25'),'stopped':_0x38ce('0x26')};if(_0xce1f64[_0x38ce('0x27')](_0x21d4e7[_0x38ce('0x1b')]['status'])){return pm2[_0xce1f64[_0x21d4e7[_0x38ce('0x1b')][_0x38ce('0x7')]]](_0x21d4e7['params']['id'])[_0x38ce('0x19')](respondWithResult(_0x264cf0,0xc8))[_0x38ce('0x15')](handleError(_0x264cf0,null));}else{return _0x264cf0['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x28')});}};exports['destroy']=function(_0x28d775,_0x53f2c9){if(_0x28d775[_0x38ce('0x1b')]['id']){delete _0x28d775[_0x38ce('0x1b')]['id'];}if(_0x28d775[_0x38ce('0x18')]['id']){return pm2[_0x38ce('0x29')](_0x28d775[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](function(_0x34262a){pm2[_0x38ce('0x22')]();return _0x34262a[0x0];})['then'](respondWithResult(_0x53f2c9,null))['catch'](handleError(_0x53f2c9,null));}else{return _0x53f2c9[_0x38ce('0x7')](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x2a')});}}; \ No newline at end of file +var _0xd87e=['catch','describe','params','create','body','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length'];(function(_0x58f477,_0x1d7d99){var _0x276381=function(_0x1bcf30){while(--_0x1bcf30){_0x58f477['push'](_0x58f477['shift']());}};_0x276381(++_0x1d7d99);}(_0xd87e,0x1bf));var _0xed87=function(_0x39868e,_0x4b6da9){_0x39868e=_0x39868e-0x0;var _0x4eadec=_0xd87e[_0x39868e];return _0x4eadec;};'use strict';var _=require(_0xed87('0x0'));var pm2=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var path=require(_0xed87('0x3'));var exec=require(_0xed87('0x4'))['exec'];var BPromise=require(_0xed87('0x5'));function handleEntityNotFound(_0x5e960f,_0x11a5d9){return function(_0x41ca7c){if(!_0x41ca7c){_0x5e960f['sendStatus'](0x194);;}return _0x41ca7c;};}function respondWithResult(_0x17adfe,_0x589fb9){_0x589fb9=_0x589fb9||0xc8;return function(_0x5da793){if(_0x5da793){return _0x17adfe[_0xed87('0x6')](_0x589fb9)[_0xed87('0x7')](_0x5da793);}return null;};}function handleError(_0x33e1c1,_0x2f348a){_0x2f348a=_0x2f348a||0x1f4;return function(_0x569d66){logger[_0xed87('0x8')](_0x569d66[_0xed87('0x9')]);if(_0x569d66[_0xed87('0xa')]){delete _0x569d66[_0xed87('0xa')];}_0x33e1c1[_0xed87('0x6')](_0x2f348a)[_0xed87('0xb')](_0x569d66);};}function execChildProcess(){return new BPromise(function(_0x293db4,_0x5b8ab4){exec(_0xed87('0xc'),function(_0xf104cb,_0x5cf4fe,_0x2f642f){logger[_0xed87('0xd')](_0x5cf4fe);logger['info'](_0x2f642f);if(_0xf104cb){logger['error'](_0xf104cb);return _0x5b8ab4(_0xf104cb);}return _0x293db4(_0x5cf4fe);});});}exports[_0xed87('0xe')]=function(_0x32276e,_0x353d46){return pm2[_0xed87('0xf')]()[_0xed87('0x10')](function(_0x3865c5){if(_0x3865c5){var _0x52dfe8=_[_0xed87('0x11')](_0x3865c5,function(_0x19b283){return _0x19b283[_0xed87('0xa')]===_0xed87('0x12')||_0x19b283[_0xed87('0xa')]===_0xed87('0x13');});return{'rows':_0x52dfe8,'count':_0x52dfe8[_0xed87('0x14')]};}return null;})[_0xed87('0x10')](respondWithResult(_0x353d46,null))[_0xed87('0x15')](handleError(_0x353d46,null));};exports['show']=function(_0x3db5ea,_0x18ab7d){return pm2[_0xed87('0x16')](_0x3db5ea[_0xed87('0x17')]['id'])['then'](respondWithResult(_0x18ab7d,null))[_0xed87('0x10')](handleEntityNotFound(_0x18ab7d,null))[_0xed87('0x15')](handleError(_0x18ab7d,null));};exports[_0xed87('0x18')]=function(_0x3f9e08,_0x98a2ca){if(_0x3f9e08[_0xed87('0x19')][_0xed87('0xa')]&&_0x3f9e08[_0xed87('0x19')][_0xed87('0x1a')]){var _0x52e81c=path['join'](__dirname,'../../files/plugins',_0x3f9e08['body'][_0xed87('0x1a')]);var _0x5d3ec8=process[_0xed87('0x1b')]();process[_0xed87('0x1c')](path['dirname'](_0x52e81c));return execChildProcess()[_0xed87('0x10')](function(_0x505733){process[_0xed87('0x1c')](_0x5d3ec8);return pm2[_0xed87('0x1d')]({'name':_0x3f9e08[_0xed87('0x19')][_0xed87('0xa')],'script':_0x52e81c});})[_0xed87('0x10')](function(_0x5d15b3){pm2[_0xed87('0x1e')]();return _0x5d15b3[0x0];})[_0xed87('0x10')](respondWithResult(_0x98a2ca,0xc9))[_0xed87('0x15')](handleError(_0x98a2ca,null));}else{return _0x98a2ca[_0xed87('0x6')](0x1f4)[_0xed87('0xb')]({'message':_0xed87('0x1f')});}};exports[_0xed87('0x20')]=function(_0x4735b3,_0x40b2fa){if(_0x4735b3[_0xed87('0x19')]['id']){delete _0x4735b3[_0xed87('0x19')]['id'];}var _0x341a35={'online':_0xed87('0x21'),'stopped':_0xed87('0x22')};if(_0x341a35['hasOwnProperty'](_0x4735b3[_0xed87('0x19')][_0xed87('0x6')])){return pm2[_0x341a35[_0x4735b3['body'][_0xed87('0x6')]]](_0x4735b3[_0xed87('0x17')]['id'])[_0xed87('0x10')](respondWithResult(_0x40b2fa,0xc8))['catch'](handleError(_0x40b2fa,null));}else{return _0x40b2fa['status'](0x1f4)[_0xed87('0xb')]({'message':_0xed87('0x23')});}};exports[_0xed87('0x24')]=function(_0x549a19,_0x37d45a){if(_0x549a19[_0xed87('0x19')]['id']){delete _0x549a19[_0xed87('0x19')]['id'];}if(_0x549a19[_0xed87('0x17')]['id']){return pm2[_0xed87('0x25')](_0x549a19[_0xed87('0x17')]['id'])[_0xed87('0x10')](function(_0x10509d){pm2[_0xed87('0x1e')]();return _0x10509d[0x0];})['then'](respondWithResult(_0x37d45a,null))[_0xed87('0x15')](handleError(_0x37d45a,null));}else{return _0x37d45a[_0xed87('0x6')](0x1f4)['send']({'message':_0xed87('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index adbe3aa..4877388 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 _0xb707=['getAgents','/queues','isAuthenticated','getQueues','exports','Router','../../components/auth/service','./realtime.controller','/agents'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xb707,0x16d));var _0x7b70=function(_0x2c760b,_0x227b6f){_0x2c760b=_0x2c760b-0x0;var _0x351f79=_0xb707[_0x2c760b];return _0x351f79;};'use strict';var express=require('express');var router=express[_0x7b70('0x0')]();var auth=require(_0x7b70('0x1'));var controller=require(_0x7b70('0x2'));router['get'](_0x7b70('0x3'),auth['isAuthenticated'](),controller[_0x7b70('0x4')]);router['get'](_0x7b70('0x5'),auth[_0x7b70('0x6')](),controller[_0x7b70('0x7')]);module[_0x7b70('0x8')]=router; \ No newline at end of file +var _0x5382=['../../components/auth/service','./realtime.controller','get','/agents','getAgents','exports','express','Router'];(function(_0x542fd5,_0x39ae77){var _0x27cb37=function(_0x1d6c90){while(--_0x1d6c90){_0x542fd5['push'](_0x542fd5['shift']());}};_0x27cb37(++_0x39ae77);}(_0x5382,0x1ae));var _0x2538=function(_0x11fd1f,_0x510abd){_0x11fd1f=_0x11fd1f-0x0;var _0x1cba90=_0x5382[_0x11fd1f];return _0x1cba90;};'use strict';var express=require(_0x2538('0x0'));var router=express[_0x2538('0x1')]();var auth=require(_0x2538('0x2'));var controller=require(_0x2538('0x3'));router[_0x2538('0x4')](_0x2538('0x5'),auth['isAuthenticated'](),controller[_0x2538('0x6')]);router[_0x2538('0x4')]('/queues',auth['isAuthenticated'](),controller['getQueues']);module[_0x2538('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index f560393..a92ba4c 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 _0xba86=['User','findAndCountAll','count','rows','map','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','toLowerCase','startCase','Queue','key','name','type','outbound','dialMethod','getOptions','userProfileId','Queues','getResources','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','status','set','Content-Range','json','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','validateSortParameter','fields','join','order','getRealtimeAgents','getAgentIdsByStatus','length','rawAttributes','role','agent','push','literal','forEach','Pause','where','merge','user','Agents','online','extraQueryConditions','assign','UserProfile'];(function(_0x19f9c8,_0x827af9){var _0x3ef79d=function(_0x47d908){while(--_0x47d908){_0x19f9c8['push'](_0x19f9c8['shift']());}};_0x3ef79d(++_0x827af9);}(_0xba86,0xbe));var _0x6ba8=function(_0x3d5434,_0x54ae93){_0x3d5434=_0x3d5434-0x0;var _0x57dbcf=_0xba86[_0x3d5434];return _0x57dbcf;};'use strict';var _=require(_0x6ba8('0x0'));var util=require(_0x6ba8('0x1'));var rta=require(_0x6ba8('0x2'));var rtq=require(_0x6ba8('0x3'));var qs=require(_0x6ba8('0x4'));var utils=require(_0x6ba8('0x5'));var db=require(_0x6ba8('0x6'))['db'];var APIBadRequestError=require(_0x6ba8('0x7'))[_0x6ba8('0x8')];var APIHandleError=require('../../errors/api')[_0x6ba8('0x9')];function respondWithFilteredResult(_0x47c403,_0x53d7e9){return function(_0xe05e66){if(_0xe05e66){var _0x80dc79=typeof _0x53d7e9[_0x6ba8('0xa')]==='undefined'&&typeof _0x53d7e9['limit']===_0x6ba8('0xb');var _0x159111=_0xe05e66['count'];var _0x30b832=_0x80dc79?0x0:_0x53d7e9[_0x6ba8('0xa')];var _0x4c19b1=_0x80dc79?_0xe05e66['count']:_0x53d7e9[_0x6ba8('0xa')]+_0x53d7e9[_0x6ba8('0xc')];var _0x24ffe6;if(_0x4c19b1>=_0x159111){_0x4c19b1=_0x159111;_0x24ffe6=0xc8;}else{_0x24ffe6=0xce;}_0x47c403[_0x6ba8('0xd')](_0x24ffe6);return _0x47c403[_0x6ba8('0xe')](_0x6ba8('0xf'),_0x30b832+'-'+_0x4c19b1+'/'+_0x159111)[_0x6ba8('0x10')](_0xe05e66);}return null;};}exports['getAgents']=function(_0x28b622,_0x5544c6){var _0x40524e={'count':0x0,'rows':[]};var _0x35d517={};var _0x53dee6;var _0x131dcf=utils[_0x6ba8('0x11')]();var _0x5c0e23;var _0x5ba22e;var _0x1214ec=_0x28b622['query']['globalQueueFilter'];var _0x22198e=_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x13')];var _0x572735=_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x14')];var _0x1f2d46=_0x22198e===_0x6ba8('0x15')||_0x22198e===_0x6ba8('0x16')?!![]:![];var _0x16cdb7=[];var _0x3c4fc4;var _0x2e60a0;Promise[_0x6ba8('0x17')]()[_0x6ba8('0x18')](function(){if(_0x28b622['query'][_0x6ba8('0x19')]){if(!utils[_0x6ba8('0x1a')](_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x19')])){throw new APIBadRequestError(util[_0x6ba8('0x1b')](_0x6ba8('0x1c'),_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x19')]));}_0x53dee6=_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x19')]['toLowerCase']();}if(!_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x1d')]||!_0x28b622['query'][_0x6ba8('0x1d')][_0x6ba8('0x1e')]('globalStatus')){_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x1d')]=rta[_0x6ba8('0x1f')](_0x28b622['query'][_0x6ba8('0x1d')]);return;}var _0x2c0e18=rta['getUpdatedSortOptions'](_0x28b622['query'][_0x6ba8('0x1d')]);_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x1d')]=_0x2c0e18[_0x6ba8('0x20')][_0x6ba8('0x21')](',');_0x3c4fc4=_0x2c0e18[_0x6ba8('0x22')];})[_0x6ba8('0x18')](function(){if(!_0x1214ec){return[];}return rta['getAgentIdsByQueues'](_0x1214ec,_0x53dee6);})[_0x6ba8('0x18')](function(_0x3c17d6){_0x16cdb7=_0x3c17d6;return rta[_0x6ba8('0x23')]();})[_0x6ba8('0x18')](function(_0x2ab610){_0x5ba22e=_0x2ab610['rows'];if((!_0x22198e||_0x1f2d46)&&!_0x3c4fc4){return _0x16cdb7;}if(_0x3c4fc4&&!_0x22198e){return rta['getSortedAgentsIdsByStatus'](_0x5ba22e,_0x16cdb7,_0x3c4fc4);}else{return rta[_0x6ba8('0x24')](_0x5ba22e,_0x16cdb7,_0x22198e);}})[_0x6ba8('0x18')](function(_0x5955e7){_0x16cdb7=_0x5955e7;var _0x5947d4=![];if(_0x16cdb7[_0x6ba8('0x25')]===0x0){if(_0x1214ec||_0x22198e){_0x5947d4=!![];}if(_0x1f2d46){_0x5947d4=![];}}if(_0x5947d4){return _0x40524e;}var _0x2e6c35=_['map'](db['User'][_0x6ba8('0x26')],function(_0x1adbd){return{'name':_0x1adbd['fieldName'],'type':_0x1adbd['type']['key']};});_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x27')]=_0x6ba8('0x28');_0x35d517=qs['getOptions'](_0x2e6c35,_0x28b622);_0x35d517['raw']=!![];var _0x44ecab=[];if(_0x16cdb7[_0x6ba8('0x25')]>0x0){_0x44ecab[_0x6ba8('0x29')]({'id':{'$in':_0x16cdb7}});if(_0x3c4fc4&&!_0x22198e){_0x2e60a0=[db['sequelize'][_0x6ba8('0x2a')]('FIELD(id,'+_0x16cdb7+')')];_0x35d517['order']=_0x2e60a0;}}if(_0x1f2d46){_0x131dcf[_0x6ba8('0x2b')](function(_0x12846b){var _0x3d9e78=!![];if(_0x22198e===_0x6ba8('0x16')&&_0x53dee6!==_0x12846b){_0x3d9e78=![];}_0x44ecab[_0x6ba8('0x29')]({[_0x12846b+_0x6ba8('0x2c')]:_0x3d9e78});});if(_0x572735){_0x44ecab[_0x6ba8('0x29')]({'pauseType':_0x572735});}}else if(_0x22198e){_0x131dcf[_0x6ba8('0x2b')](function(_0x5b43d4){_0x44ecab[_0x6ba8('0x29')]({[_0x5b43d4+'Pause']:![]});});}_0x35d517[_0x6ba8('0x2d')]=_[_0x6ba8('0x2e')](_0x35d517['where'],{'$and':_0x44ecab});if(_0x28b622['user'][_0x6ba8('0x27')]===_0x6ba8('0x2f')){var _0xa1f901={'params':{'id':_0x28b622[_0x6ba8('0x2f')]['userProfileId']},'query':{'section':_0x6ba8('0x30'),'role':_0x6ba8('0x28'),'raw':!![],'ids':_0x16cdb7,'customSorting':_0x2e60a0}};if(_0x28b622[_0x6ba8('0x12')][_0x6ba8('0x31')]){_0xa1f901[_0x6ba8('0x12')][_0x6ba8('0x31')]=!![];}if(_0x1f2d46){_0xa1f901[_0x6ba8('0x12')][_0x6ba8('0x32')]=_0x44ecab;}_0xa1f901[_0x6ba8('0x12')]=Object[_0x6ba8('0x33')](_0xa1f901[_0x6ba8('0x12')],_['omit'](_0x28b622['query'],'id'));return db[_0x6ba8('0x34')]['getResources'](_0xa1f901);}return db[_0x6ba8('0x35')][_0x6ba8('0x36')](_0x35d517);})[_0x6ba8('0x18')](function(_0x583150){_0x40524e[_0x6ba8('0x37')]=_0x583150[_0x6ba8('0x37')];_0x5c0e23=_0x583150[_0x6ba8('0x38')];return _0x5c0e23[_0x6ba8('0x39')](function(_0x19eff9){var _0x34646c=_['find'](_0x5ba22e,['id',_0x19eff9['id']]);if(_0x34646c){var _0xb4fba6=rta[_0x6ba8('0x3a')](_0x34646c);_[_0x6ba8('0x2e')](_0x19eff9,_0xb4fba6);}_0x19eff9['globalStatus']=rta[_0x6ba8('0x3b')](_0x19eff9);if(_0x19eff9['globalStatus']['includes']('pause')){_0x131dcf[_0x6ba8('0x2b')](function(_0x2e0e04){if(_0x19eff9[_0x2e0e04+'Pause']){if(_0x2e0e04===_0x6ba8('0x3c')){if(_0x19eff9[_0x6ba8('0x3d')]!==_0x6ba8('0x3e')){_0x19eff9[_0x6ba8('0x3d')]='pause';}}else{_0x19eff9[_0x2e0e04+_0x6ba8('0x3f')]=_0x6ba8('0x15');}}});}return _0x19eff9;});})[_0x6ba8('0x18')](function(_0x422c68){if(!_0x3c4fc4||_0x2e60a0){return _0x422c68;}return rta[_0x6ba8('0x40')](_0x422c68,_0x3c4fc4);})[_0x6ba8('0x18')](function(_0x7af8e5){var _0x1cd80a=rta[_0x6ba8('0x41')]();_0x40524e[_0x6ba8('0x38')]=_0x7af8e5[_0x6ba8('0x39')](function(_0x45b9a7){return _[_0x6ba8('0x42')](_0x45b9a7,_0x1cd80a);});return _0x40524e;})[_0x6ba8('0x18')](respondWithFilteredResult(_0x5544c6,_0x35d517))[_0x6ba8('0x43')](APIHandleError(_0x5544c6));};exports['getQueues']=function(_0x39f280,_0x46be24){var _0x321d61={'count':0x0,'rows':[]};var _0x3da3d3={};var _0x1cdd7d;var _0x208292;var _0xaf5dc;Promise[_0x6ba8('0x17')]()[_0x6ba8('0x18')](function(){if(_0x39f280['query']['channel']){if(!utils[_0x6ba8('0x1a')](_0x39f280[_0x6ba8('0x12')][_0x6ba8('0x19')])){throw new APIBadRequestError(util[_0x6ba8('0x1b')](_0x6ba8('0x1c'),_0x39f280['query']['channel']));}_0x1cdd7d=_0x39f280['query'][_0x6ba8('0x19')][_0x6ba8('0x44')]();}var _0x2b4083=_[_0x6ba8('0x45')](_0x1cdd7d)+_0x6ba8('0x46');var _0x4af343=_[_0x6ba8('0x39')](db[_0x2b4083]['rawAttributes'],function(_0x14de7e){return{'name':_0x14de7e['fieldName'],'type':_0x14de7e['type'][_0x6ba8('0x47')]};});if(!_0x39f280[_0x6ba8('0x12')]['fields']){var _0x23b3b9=['id',_0x6ba8('0x48')];if(_0x1cdd7d===_0x6ba8('0x3c')){_0x23b3b9['push'](_0x6ba8('0x49'));if(_0x39f280[_0x6ba8('0x12')][_0x6ba8('0x49')]===_0x6ba8('0x4a')){_0x23b3b9[_0x6ba8('0x29')](['dialActive',_0x6ba8('0x4b')]);}}_0x39f280[_0x6ba8('0x12')][_0x6ba8('0x20')]=_0x23b3b9['join'](',');}_0x3da3d3=qs[_0x6ba8('0x4c')](_0x4af343,_0x39f280);if(_0x39f280['user'][_0x6ba8('0x27')]===_0x6ba8('0x2f')){var _0xae4222={'params':{'id':_0x39f280[_0x6ba8('0x2f')][_0x6ba8('0x4d')]},'query':{'section':_0x1cdd7d==='voice'&&_0x39f280[_0x6ba8('0x12')]['type']===_0x6ba8('0x4a')?'QueueCampaigns':_[_0x6ba8('0x45')](_0x1cdd7d)+_0x6ba8('0x4e'),'type':_0x39f280[_0x6ba8('0x12')][_0x6ba8('0x49')],'nolimit':!![],'sort':_0x6ba8('0x48'),'filter':_0x39f280[_0x6ba8('0x12')]['filter']}};_0xae4222[_0x6ba8('0x12')]=Object[_0x6ba8('0x33')](_0xae4222[_0x6ba8('0x12')],_0x39f280[_0x6ba8('0x12')]);delete _0xae4222[_0x6ba8('0x12')]['id'];return db[_0x6ba8('0x34')][_0x6ba8('0x4f')](_0xae4222);}return db[_0x2b4083][_0x6ba8('0x36')](_0x3da3d3);})['then'](function(_0x5a3abb){_0x321d61[_0x6ba8('0x37')]=_0x5a3abb['count'];_0x208292=_0x5a3abb['rows'];return rtq[_0x6ba8('0x50')](_0x39f280,_0x1cdd7d);})[_0x6ba8('0x18')](function(_0x2a66c9){_0xaf5dc=_0x2a66c9[_0x6ba8('0x38')];return rtq['initializeQueues'](_0x208292,_0xaf5dc,_0x1cdd7d,_0x39f280[_0x6ba8('0x12')][_0x6ba8('0x49')]);})[_0x6ba8('0x18')](function(_0x48dc38){_0x321d61[_0x6ba8('0x38')]=_0x48dc38;return _0x321d61;})['then'](respondWithFilteredResult(_0x46be24,_0x3da3d3))[_0x6ba8('0x43')](APIHandleError(_0x46be24));}; \ No newline at end of file +var _0x685b=['toLowerCase','includes','globalStatus','sort','validateSortParameter','getUpdatedSortOptions','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','getOptions','sequelize','push','Pause','forEach','where','user','userProfileId','Agents','agent','assign','omit','UserProfile','findAndCountAll','find','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','name','outbound','dialActive','fields','filter','getResources','getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','json','getAgents','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid'];(function(_0x1ac035,_0x4d8dff){var _0x4a7387=function(_0x5d902d){while(--_0x5d902d){_0x1ac035['push'](_0x1ac035['shift']());}};_0x4a7387(++_0x4d8dff);}(_0x685b,0x177));var _0xb685=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x685b[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0xb685('0x0'));var rtq=require(_0xb685('0x1'));var qs=require(_0xb685('0x2'));var utils=require('../../config/utils');var db=require(_0xb685('0x3'))['db'];var APIBadRequestError=require(_0xb685('0x4'))[_0xb685('0x5')];var APIHandleError=require(_0xb685('0x4'))['handleError'];function respondWithFilteredResult(_0x3659fd,_0x30c37f){return function(_0xb71b15){if(_0xb71b15){var _0x524f89=typeof _0x30c37f[_0xb685('0x6')]===_0xb685('0x7')&&typeof _0x30c37f[_0xb685('0x8')]==='undefined';var _0xade14e=_0xb71b15[_0xb685('0x9')];var _0x4e5c0a=_0x524f89?0x0:_0x30c37f['offset'];var _0x2022b6=_0x524f89?_0xb71b15[_0xb685('0x9')]:_0x30c37f[_0xb685('0x6')]+_0x30c37f[_0xb685('0x8')];var _0x301e5d;if(_0x2022b6>=_0xade14e){_0x2022b6=_0xade14e;_0x301e5d=0xc8;}else{_0x301e5d=0xce;}_0x3659fd[_0xb685('0xa')](_0x301e5d);return _0x3659fd['set'](_0xb685('0xb'),_0x4e5c0a+'-'+_0x2022b6+'/'+_0xade14e)[_0xb685('0xc')](_0xb71b15);}return null;};}exports[_0xb685('0xd')]=function(_0x829af,_0x244305){var _0x190345={'count':0x0,'rows':[]};var _0x190d98={};var _0x244b7d;var _0x306343=utils['getChannels']();var _0x5eeea8;var _0x1bbc8b;var _0x3a03de=_0x829af[_0xb685('0xe')][_0xb685('0xf')];var _0x249feb=_0x829af[_0xb685('0xe')]['globalStatusFilter'];var _0x119cd8=_0x829af[_0xb685('0xe')][_0xb685('0x10')];var _0x1f998c=_0x249feb===_0xb685('0x11')||_0x249feb===_0xb685('0x12')?!![]:![];var _0x2b7ea3=[];var _0x43dada;var _0x57aa79;Promise[_0xb685('0x13')]()[_0xb685('0x14')](function(){if(_0x829af[_0xb685('0xe')][_0xb685('0x15')]){if(!utils[_0xb685('0x16')](_0x829af[_0xb685('0xe')][_0xb685('0x15')])){throw new APIBadRequestError(util[_0xb685('0x17')](_0xb685('0x18'),_0x829af['query']['channel']));}_0x244b7d=_0x829af[_0xb685('0xe')][_0xb685('0x15')][_0xb685('0x19')]();}if(!_0x829af[_0xb685('0xe')]['sort']||!_0x829af[_0xb685('0xe')]['sort'][_0xb685('0x1a')](_0xb685('0x1b'))){_0x829af['query'][_0xb685('0x1c')]=rta[_0xb685('0x1d')](_0x829af[_0xb685('0xe')][_0xb685('0x1c')]);return;}var _0x332c52=rta[_0xb685('0x1e')](_0x829af['query'][_0xb685('0x1c')]);_0x829af['query']['sort']=_0x332c52['fields'][_0xb685('0x1f')](',');_0x43dada=_0x332c52[_0xb685('0x20')];})[_0xb685('0x14')](function(){if(!_0x3a03de){return[];}return rta['getAgentIdsByQueues'](_0x3a03de,_0x244b7d);})['then'](function(_0x6fe029){_0x2b7ea3=_0x6fe029;return rta[_0xb685('0x21')]();})['then'](function(_0x4e12e3){_0x1bbc8b=_0x4e12e3[_0xb685('0x22')];if((!_0x249feb||_0x1f998c)&&!_0x43dada){return _0x2b7ea3;}if(_0x43dada&&!_0x249feb){return rta[_0xb685('0x23')](_0x1bbc8b,_0x2b7ea3,_0x43dada);}else{return rta[_0xb685('0x24')](_0x1bbc8b,_0x2b7ea3,_0x249feb);}})[_0xb685('0x14')](function(_0x46860d){_0x2b7ea3=_0x46860d;var _0x355206=![];if(_0x2b7ea3[_0xb685('0x25')]===0x0){if(_0x3a03de||_0x249feb){_0x355206=!![];}if(_0x1f998c){_0x355206=![];}}if(_0x355206){return _0x190345;}var _0x38e212=_[_0xb685('0x26')](db[_0xb685('0x27')][_0xb685('0x28')],function(_0x56bceb){return{'name':_0x56bceb[_0xb685('0x29')],'type':_0x56bceb[_0xb685('0x2a')][_0xb685('0x2b')]};});_0x829af[_0xb685('0xe')][_0xb685('0x2c')]='agent';_0x190d98=qs[_0xb685('0x2d')](_0x38e212,_0x829af);_0x190d98['raw']=!![];var _0x329a4a=[];if(_0x2b7ea3[_0xb685('0x25')]>0x0){_0x329a4a['push']({'id':{'$in':_0x2b7ea3}});if(_0x43dada&&!_0x249feb){_0x57aa79=[db[_0xb685('0x2e')]['literal']('FIELD(id,'+_0x2b7ea3+')')];_0x190d98[_0xb685('0x20')]=_0x57aa79;}}if(_0x1f998c){_0x306343['forEach'](function(_0x5e8794){var _0x4fcf1f=!![];if(_0x249feb===_0xb685('0x12')&&_0x244b7d!==_0x5e8794){_0x4fcf1f=![];}_0x329a4a[_0xb685('0x2f')]({[_0x5e8794+_0xb685('0x30')]:_0x4fcf1f});});if(_0x119cd8){_0x329a4a['push']({'pauseType':_0x119cd8});}}else if(_0x249feb){_0x306343[_0xb685('0x31')](function(_0x5ee523){_0x329a4a[_0xb685('0x2f')]({[_0x5ee523+_0xb685('0x30')]:![]});});}_0x190d98[_0xb685('0x32')]=_['merge'](_0x190d98['where'],{'$and':_0x329a4a});if(_0x829af[_0xb685('0x33')][_0xb685('0x2c')]===_0xb685('0x33')){var _0x117e5d={'params':{'id':_0x829af[_0xb685('0x33')][_0xb685('0x34')]},'query':{'section':_0xb685('0x35'),'role':_0xb685('0x36'),'raw':!![],'ids':_0x2b7ea3,'customSorting':_0x57aa79}};if(_0x829af['query']['online']){_0x117e5d['query']['online']=!![];}if(_0x1f998c){_0x117e5d[_0xb685('0xe')]['extraQueryConditions']=_0x329a4a;}_0x117e5d[_0xb685('0xe')]=Object[_0xb685('0x37')](_0x117e5d[_0xb685('0xe')],_[_0xb685('0x38')](_0x829af[_0xb685('0xe')],'id'));return db[_0xb685('0x39')]['getResources'](_0x117e5d);}return db[_0xb685('0x27')][_0xb685('0x3a')](_0x190d98);})[_0xb685('0x14')](function(_0x25c037){_0x190345['count']=_0x25c037[_0xb685('0x9')];_0x5eeea8=_0x25c037[_0xb685('0x22')];return _0x5eeea8[_0xb685('0x26')](function(_0x4c9297){var _0x3c4e49=_[_0xb685('0x3b')](_0x1bbc8b,['id',_0x4c9297['id']]);if(_0x3c4e49){var _0x406ec7=rta['filterAgentAttributes'](_0x3c4e49);_['merge'](_0x4c9297,_0x406ec7);}_0x4c9297[_0xb685('0x1b')]=rta[_0xb685('0x3c')](_0x4c9297);if(_0x4c9297[_0xb685('0x1b')][_0xb685('0x1a')](_0xb685('0x11'))){_0x306343[_0xb685('0x31')](function(_0x3aaaa1){if(_0x4c9297[_0x3aaaa1+_0xb685('0x30')]){if(_0x3aaaa1===_0xb685('0x3d')){if(_0x4c9297[_0xb685('0x3e')]!==_0xb685('0x3f')){_0x4c9297[_0xb685('0x3e')]=_0xb685('0x11');}}else{_0x4c9297[_0x3aaaa1+_0xb685('0x40')]='pause';}}});}return _0x4c9297;});})[_0xb685('0x14')](function(_0x1f5174){if(!_0x43dada||_0x57aa79){return _0x1f5174;}return rta[_0xb685('0x41')](_0x1f5174,_0x43dada);})[_0xb685('0x14')](function(_0x4654f0){var _0x1e0798=rta[_0xb685('0x42')]();_0x190345[_0xb685('0x22')]=_0x4654f0[_0xb685('0x26')](function(_0x180cb7){return _[_0xb685('0x43')](_0x180cb7,_0x1e0798);});return _0x190345;})[_0xb685('0x14')](respondWithFilteredResult(_0x244305,_0x190d98))[_0xb685('0x44')](APIHandleError(_0x244305));};exports[_0xb685('0x45')]=function(_0x5e31f3,_0x3ca321){var _0x365105={'count':0x0,'rows':[]};var _0x1b4cad={};var _0x185ff3;var _0x3c9fa6;var _0x11c96a;Promise['resolve']()[_0xb685('0x14')](function(){if(_0x5e31f3['query'][_0xb685('0x15')]){if(!utils[_0xb685('0x16')](_0x5e31f3['query'][_0xb685('0x15')])){throw new APIBadRequestError(util['format'](_0xb685('0x18'),_0x5e31f3[_0xb685('0xe')][_0xb685('0x15')]));}_0x185ff3=_0x5e31f3[_0xb685('0xe')][_0xb685('0x15')]['toLowerCase']();}var _0x163429=_[_0xb685('0x46')](_0x185ff3)+_0xb685('0x47');var _0x341282=_['map'](db[_0x163429]['rawAttributes'],function(_0x4c07d4){return{'name':_0x4c07d4[_0xb685('0x29')],'type':_0x4c07d4['type'][_0xb685('0x2b')]};});if(!_0x5e31f3['query']['fields']){var _0x2facd5=['id',_0xb685('0x48')];if(_0x185ff3==='voice'){_0x2facd5['push']('type');if(_0x5e31f3[_0xb685('0xe')]['type']===_0xb685('0x49')){_0x2facd5[_0xb685('0x2f')]([_0xb685('0x4a'),'dialMethod']);}}_0x5e31f3[_0xb685('0xe')][_0xb685('0x4b')]=_0x2facd5['join'](',');}_0x1b4cad=qs['getOptions'](_0x341282,_0x5e31f3);if(_0x5e31f3[_0xb685('0x33')][_0xb685('0x2c')]===_0xb685('0x33')){var _0x3264a4={'params':{'id':_0x5e31f3[_0xb685('0x33')][_0xb685('0x34')]},'query':{'section':_0x185ff3==='voice'&&_0x5e31f3[_0xb685('0xe')]['type']===_0xb685('0x49')?'QueueCampaigns':_[_0xb685('0x46')](_0x185ff3)+'Queues','type':_0x5e31f3[_0xb685('0xe')][_0xb685('0x2a')],'nolimit':!![],'sort':_0xb685('0x48'),'filter':_0x5e31f3[_0xb685('0xe')][_0xb685('0x4c')]}};_0x3264a4['query']=Object[_0xb685('0x37')](_0x3264a4['query'],_0x5e31f3[_0xb685('0xe')]);delete _0x3264a4[_0xb685('0xe')]['id'];return db[_0xb685('0x39')][_0xb685('0x4d')](_0x3264a4);}return db[_0x163429][_0xb685('0x3a')](_0x1b4cad);})[_0xb685('0x14')](function(_0xed7180){_0x365105[_0xb685('0x9')]=_0xed7180[_0xb685('0x9')];_0x3c9fa6=_0xed7180['rows'];return rtq[_0xb685('0x4e')](_0x5e31f3,_0x185ff3);})[_0xb685('0x14')](function(_0x45b702){_0x11c96a=_0x45b702[_0xb685('0x22')];return rtq[_0xb685('0x4f')](_0x3c9fa6,_0x11c96a,_0x185ff3,_0x5e31f3[_0xb685('0xe')][_0xb685('0x2a')]);})[_0xb685('0x14')](function(_0x233050){_0x365105['rows']=_0x233050;return _0x365105;})[_0xb685('0x14')](respondWithFilteredResult(_0x3ca321,_0x1b4cad))[_0xb685('0x44')](APIHandleError(_0x3ca321));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4c20c4c..a073328 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2acd0f,_0x3ac736){var _0x434b3e=function(_0x2fdca0){while(--_0x2fdca0){_0x2acd0f['push'](_0x2acd0f['shift']());}};_0x434b3e(++_0x3ac736);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xf1e7e7,_0x4c9d11){var _0x24500a=function(_0xd5f641){while(--_0xd5f641){_0xf1e7e7['push'](_0xf1e7e7['shift']());}};_0x24500a(++_0x4c9d11);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xcb91[_0x58c20f];return _0x3b0318;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2b3397e..45a5b97 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 _0x9485=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x9485,0x8b));var _0x5948=function(_0x1d28ca,_0x29bbc5){_0x1d28ca=_0x1d28ca-0x0;var _0x33ed76=_0x9485[_0x1d28ca];return _0x33ed76;};'use strict';var Sequelize=require(_0x5948('0x0'));module[_0x5948('0x1')]={'state':{'type':Sequelize[_0x5948('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5948('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x5948('0x3')]},'starttime':{'type':Sequelize[_0x5948('0x4')]},'responsetime':{'type':Sequelize[_0x5948('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5948('0x3')]},'campaigntype':{'type':Sequelize[_0x5948('0x3')]},'membername':{'type':Sequelize[_0x5948('0x3')]}}; \ No newline at end of file +var _0xd9c8=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0xb942b5,_0x2cc3d0){var _0x1e6c45=function(_0x15b738){while(--_0x15b738){_0xb942b5['push'](_0xb942b5['shift']());}};_0x1e6c45(++_0x2cc3d0);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd9c8[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x8d9c('0x0'));module[_0x8d9c('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8d9c('0x2')]},'scheduledat':{'type':Sequelize[_0x8d9c('0x3')]},'uniqueid':{'type':Sequelize[_0x8d9c('0x2')]},'starttime':{'type':Sequelize[_0x8d9c('0x3')]},'responsetime':{'type':Sequelize[_0x8d9c('0x3')]},'ringtime':{'type':Sequelize[_0x8d9c('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8d9c('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 43ed22e..60df038 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 _0x1eb6=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x18b957,_0x2dec00){var _0x5b38f7=function(_0x521841){while(--_0x521841){_0x18b957['push'](_0x18b957['shift']());}};_0x5b38f7(++_0x2dec00);}(_0x1eb6,0x9c));var _0x61eb=function(_0x246c0f,_0x219e37){_0x246c0f=_0x246c0f-0x0;var _0x16e5ec=_0x1eb6[_0x246c0f];return _0x16e5ec;};'use strict';var _=require(_0x61eb('0x0'));var util=require(_0x61eb('0x1'));var logger=require('../../config/logger')(_0x61eb('0x2'));var moment=require(_0x61eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x61eb('0x4'));var fs=require('fs');var path=require(_0x61eb('0x5'));var rimraf=require(_0x61eb('0x6'));var config=require(_0x61eb('0x7'));var attributes=require(_0x61eb('0x8'));module[_0x61eb('0x9')]=function(_0x2604cf,_0x1b02f7){return _0x2604cf[_0x61eb('0xa')](_0x61eb('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1a=['request-promise','../../config/environment','exports','define','ReportAgentPreview','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc1a,0x163));var _0xabc1=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xbc1a[_0x59d89e];return _0x554e93;};'use strict';var _=require('lodash');var util=require(_0xabc1('0x0'));var logger=require(_0xabc1('0x1'))(_0xabc1('0x2'));var moment=require(_0xabc1('0x3'));var BPromise=require(_0xabc1('0x4'));var rp=require(_0xabc1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xabc1('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xabc1('0x7')]=function(_0x25eb1b,_0x273584){return _0x25eb1b[_0xabc1('0x8')](_0xabc1('0x9'),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 92ba871..4f3fc56 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 _0x13f7=['then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','CreateReportAgentPreview','create','body','options','raw'];(function(_0x8a8864,_0x4127ac){var _0x8ea095=function(_0x25d8a0){while(--_0x25d8a0){_0x8a8864['push'](_0x8a8864['shift']());}};_0x8ea095(++_0x4127ac);}(_0x13f7,0x151));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var util=require('util');var moment=require(_0x713f('0x1'));var BPromise=require(_0x713f('0x2'));var rs=require(_0x713f('0x3'));var fs=require('fs');var Redis=require(_0x713f('0x4'));var db=require(_0x713f('0x5'))['db'];var utils=require(_0x713f('0x6'));var logger=require(_0x713f('0x7'))(_0x713f('0x8'));var config=require(_0x713f('0x9'));var jayson=require(_0x713f('0xa'));var client=jayson['client'][_0x713f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x482d42,_0x56594c,_0x23288f){return new BPromise(function(_0x30e97d,_0x5b57c){return client['request'](_0x482d42,_0x23288f)['then'](function(_0x186aa6){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x56594c,_0x713f('0xc'));logger[_0x713f('0xd')](_0x713f('0xe'),_0x56594c,_0x713f('0xc'),JSON[_0x713f('0xf')](_0x186aa6));if(_0x186aa6[_0x713f('0x10')]){if(_0x186aa6[_0x713f('0x10')][_0x713f('0x11')]===0x1f4){logger[_0x713f('0x10')](_0x713f('0x12'),_0x56594c,_0x186aa6[_0x713f('0x10')]['message']);return _0x5b57c(_0x186aa6[_0x713f('0x10')][_0x713f('0x13')]);}logger[_0x713f('0x10')](_0x713f('0x12'),_0x56594c,_0x186aa6[_0x713f('0x10')]['message']);return _0x30e97d(_0x186aa6[_0x713f('0x10')][_0x713f('0x13')]);}else{logger[_0x713f('0x14')](_0x713f('0x12'),_0x56594c,_0x713f('0xc'));_0x30e97d(_0x186aa6[_0x713f('0x15')][_0x713f('0x13')]);}})['catch'](function(_0x262727){logger['error'](_0x713f('0x12'),_0x56594c,_0x262727);_0x5b57c(_0x262727);});});}exports[_0x713f('0x16')]=function(_0x3e4edd){var _0x35b03d=this;return new Promise(function(_0x499421,_0x211bc1){return db['ReportAgentPreview'][_0x713f('0x17')](_0x3e4edd[_0x713f('0x18')],{'raw':_0x3e4edd[_0x713f('0x19')]?_0x3e4edd[_0x713f('0x19')][_0x713f('0x1a')]===undefined?!![]:![]:!![]})[_0x713f('0x1b')](function(_0xfae983){logger[_0x713f('0x14')](_0x713f('0x16'),_0x3e4edd);logger[_0x713f('0xd')](_0x713f('0x16'),_0x3e4edd,JSON[_0x713f('0xf')](_0xfae983));_0x499421(_0xfae983);})['catch'](function(_0x1ab6ab){logger[_0x713f('0x10')]('CreateReportAgentPreview',_0x1ab6ab[_0x713f('0x13')],_0x3e4edd);_0x211bc1(_0x35b03d[_0x713f('0x10')](0x1f4,_0x1ab6ab[_0x713f('0x13')]));});});}; \ No newline at end of file +var _0x4272=['jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ReportAgentPreview','create','options','raw','then','CreateReportAgentPreview','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x95d5bf,_0x264899){var _0x3ecfa8=function(_0x1c8055){while(--_0x1c8055){_0x95d5bf['push'](_0x95d5bf['shift']());}};_0x3ecfa8(++_0x264899);}(_0x4272,0x119));var _0x2427=function(_0x3c9c75,_0x4bca88){_0x3c9c75=_0x3c9c75-0x0;var _0x4f007c=_0x4272[_0x3c9c75];return _0x4f007c;};'use strict';var _=require(_0x2427('0x0'));var util=require(_0x2427('0x1'));var moment=require(_0x2427('0x2'));var BPromise=require(_0x2427('0x3'));var rs=require(_0x2427('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2427('0x5'))['db'];var utils=require(_0x2427('0x6'));var logger=require(_0x2427('0x7'))('rpc');var config=require(_0x2427('0x8'));var jayson=require(_0x2427('0x9'));var client=jayson[_0x2427('0xa')][_0x2427('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4efc0b,_0x50a3d6,_0x5aaff4){return new BPromise(function(_0x40a289,_0x14a13a){return client['request'](_0x4efc0b,_0x5aaff4)['then'](function(_0x3581a2){logger[_0x2427('0xc')](_0x2427('0xd'),_0x50a3d6,_0x2427('0xe'));logger[_0x2427('0xf')](_0x2427('0x10'),_0x50a3d6,_0x2427('0xe'),JSON[_0x2427('0x11')](_0x3581a2));if(_0x3581a2[_0x2427('0x12')]){if(_0x3581a2[_0x2427('0x12')][_0x2427('0x13')]===0x1f4){logger['error'](_0x2427('0xd'),_0x50a3d6,_0x3581a2[_0x2427('0x12')]['message']);return _0x14a13a(_0x3581a2['error'][_0x2427('0x14')]);}logger[_0x2427('0x12')](_0x2427('0xd'),_0x50a3d6,_0x3581a2['error']['message']);return _0x40a289(_0x3581a2[_0x2427('0x12')][_0x2427('0x14')]);}else{logger[_0x2427('0xc')](_0x2427('0xd'),_0x50a3d6,'request\x20sent');_0x40a289(_0x3581a2[_0x2427('0x15')][_0x2427('0x14')]);}})['catch'](function(_0x4fe0c0){logger[_0x2427('0x12')](_0x2427('0xd'),_0x50a3d6,_0x4fe0c0);_0x14a13a(_0x4fe0c0);});});}exports['CreateReportAgentPreview']=function(_0x1aef53){var _0x24cacf=this;return new Promise(function(_0x245855,_0x2346d6){return db[_0x2427('0x16')][_0x2427('0x17')](_0x1aef53['body'],{'raw':_0x1aef53[_0x2427('0x18')]?_0x1aef53[_0x2427('0x18')][_0x2427('0x19')]===undefined?!![]:![]:!![]})[_0x2427('0x1a')](function(_0x451a4e){logger[_0x2427('0xc')](_0x2427('0x1b'),_0x1aef53);logger[_0x2427('0xf')]('CreateReportAgentPreview',_0x1aef53,JSON[_0x2427('0x11')](_0x451a4e));_0x245855(_0x451a4e);})[_0x2427('0x1c')](function(_0x204386){logger[_0x2427('0x12')](_0x2427('0x1b'),_0x204386[_0x2427('0x14')],_0x1aef53);_0x2346d6(_0x24cacf['error'](0x1f4,_0x204386['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 73989c4..599748a 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 _0x8b9c=['queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify'];(function(_0x2447b0,_0x68333b){var _0x4c10b7=function(_0x256aac){while(--_0x256aac){_0x2447b0['push'](_0x2447b0['shift']());}};_0x4c10b7(++_0x68333b);}(_0x8b9c,0xba));var _0xc8b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8b9c[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xc8b9('0x0'));var util=require(_0xc8b9('0x1'));var path=require('path');var express=require(_0xc8b9('0x2'));var router=express['Router']();var auth=require(_0xc8b9('0x3'));var controller=require(_0xc8b9('0x4'));router[_0xc8b9('0x5')](_0xc8b9('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xc8b9('0x5')](_0xc8b9('0x7'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x9')]);router[_0xc8b9('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0xa')]);router['get'](_0xc8b9('0xb'),auth[_0xc8b9('0x8')](),controller['voiceQueues']);router[_0xc8b9('0x5')](_0xc8b9('0xc'),auth['isAuthenticated'](),controller[_0xc8b9('0xd')]);router[_0xc8b9('0x5')](_0xc8b9('0xe'),auth[_0xc8b9('0x8')](),controller['mailQueues']);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0xc8b9('0xf')]);router['get'](_0xc8b9('0x10'),auth['isAuthenticated'](),controller[_0xc8b9('0x11')]);router['get'](_0xc8b9('0x12'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x13')]);router[_0xc8b9('0x5')](_0xc8b9('0x14'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x15')]);router[_0xc8b9('0x5')](_0xc8b9('0x16'),auth[_0xc8b9('0x8')](),controller['faxQueues']);router[_0xc8b9('0x5')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xc8b9('0x17')]);router['get']('/voice/queues/channels',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x18')]);router['get'](_0xc8b9('0x19'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x1a')]);router['get'](_0xc8b9('0x1b'),auth[_0xc8b9('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0xc8b9('0x1c'),auth['isAuthenticated'](),controller[_0xc8b9('0x1d')]);router['get'](_0xc8b9('0x1e'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x1f')]);router[_0xc8b9('0x20')](_0xc8b9('0x1e'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x21')]);router[_0xc8b9('0x5')]('/outbound',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x22')]);router[_0xc8b9('0x5')](_0xc8b9('0x23'),auth['isAuthenticated'](),controller[_0xc8b9('0x24')]);router[_0xc8b9('0x5')](_0xc8b9('0x25'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x26')]);router[_0xc8b9('0x20')]('/agents/:id/capacity',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x27')]);router[_0xc8b9('0x5')](_0xc8b9('0x28'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x29')]);router['get'](_0xc8b9('0x2a'),auth['isAuthenticated'](),controller['trunks']);router[_0xc8b9('0x5')](_0xc8b9('0x2b'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x2c')]);router['get'](_0xc8b9('0x2d'),auth[_0xc8b9('0x8')](),controller['faxAccounts']);router[_0xc8b9('0x5')](_0xc8b9('0x2e'),auth['isAuthenticated'](),controller[_0xc8b9('0x2f')]);router['get'](_0xc8b9('0x30'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x31')]);router['get'](_0xc8b9('0x32'),auth[_0xc8b9('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xc8b9('0x5')](_0xc8b9('0x33'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x34')]);router[_0xc8b9('0x5')](_0xc8b9('0x35'),auth['isAuthenticated'](),controller[_0xc8b9('0x36')]);router['get'](_0xc8b9('0x37'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x38')]);router[_0xc8b9('0x5')](_0xc8b9('0x39'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xc8b9('0x3a')](_0xc8b9('0x3b'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x3c')](_0xc8b9('0x3d')));router[_0xc8b9('0x5')](_0xc8b9('0x3e'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x3f')]);router[_0xc8b9('0x3a')]('/chat/queues/:id/notify',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x3c')](_0xc8b9('0x40')));router['get'](_0xc8b9('0x41'),auth['isAuthenticated'](),controller[_0xc8b9('0x42')]);router['post'](_0xc8b9('0x43'),auth['isAuthenticated'](),controller[_0xc8b9('0x3c')](_0xc8b9('0x44')));router[_0xc8b9('0x5')](_0xc8b9('0x45'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x46')]);router['post']('/openchannel/queues/:id/notify',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x3c')](_0xc8b9('0x47')));router['get'](_0xc8b9('0x48'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x49')]);router[_0xc8b9('0x3a')]('/sms/queues/:id/notify',auth[_0xc8b9('0x8')](),controller['queueNotify'](_0xc8b9('0x4a')));router[_0xc8b9('0x3a')](_0xc8b9('0x4b'),auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x3c')](_0xc8b9('0x4c')));router[_0xc8b9('0x5')](_0xc8b9('0x4d'),auth[_0xc8b9('0x8')](),controller['showSmsQueues']);router['get'](_0xc8b9('0x4e'),auth['isAuthenticated'](),controller[_0xc8b9('0x4f')]);router[_0xc8b9('0x3a')]('/agents/:id/notify',auth[_0xc8b9('0x8')](),controller[_0xc8b9('0x50')]);module[_0xc8b9('0x51')]=router; \ No newline at end of file +var _0xc734=['chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xc734,0xce));var _0x4c73=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0xc734[_0x467488];return _0x56107f;};'use strict';var multer=require('multer');var util=require(_0x4c73('0x0'));var path=require(_0x4c73('0x1'));var express=require(_0x4c73('0x2'));var router=express['Router']();var auth=require(_0x4c73('0x3'));var controller=require('./rpc.controller');router[_0x4c73('0x4')](_0x4c73('0x5'),auth[_0x4c73('0x6')](),controller['voiceChannels']);router[_0x4c73('0x4')](_0x4c73('0x7'),auth[_0x4c73('0x6')](),controller['voiceChannelMixMonitor']);router[_0x4c73('0x4')](_0x4c73('0x8'),auth['isAuthenticated'](),controller[_0x4c73('0x9')]);router[_0x4c73('0x4')](_0x4c73('0xa'),auth[_0x4c73('0x6')](),controller[_0x4c73('0xb')]);router[_0x4c73('0x4')](_0x4c73('0xc'),auth[_0x4c73('0x6')](),controller['chatQueues']);router[_0x4c73('0x4')](_0x4c73('0xd'),auth[_0x4c73('0x6')](),controller[_0x4c73('0xe')]);router[_0x4c73('0x4')](_0x4c73('0xf'),auth[_0x4c73('0x6')](),controller['mailAccounts']);router[_0x4c73('0x4')](_0x4c73('0x10'),auth[_0x4c73('0x6')](),controller['openchannelQueues']);router[_0x4c73('0x4')]('/sms/queues',auth[_0x4c73('0x6')](),controller[_0x4c73('0x11')]);router[_0x4c73('0x4')](_0x4c73('0x12'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x13')]);router[_0x4c73('0x4')](_0x4c73('0x14'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x15')]);router[_0x4c73('0x4')](_0x4c73('0x16'),auth[_0x4c73('0x6')](),controller['voiceQueuesPreview']);router[_0x4c73('0x4')](_0x4c73('0x17'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x18')]);router['get'](_0x4c73('0x19'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x1a')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x4c73('0x6')](),controller[_0x4c73('0x1b')]);router[_0x4c73('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x4c73('0x6')](),controller[_0x4c73('0x1c')]);router[_0x4c73('0x4')](_0x4c73('0x1d'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x1e')]);router[_0x4c73('0x1f')](_0x4c73('0x1d'),auth[_0x4c73('0x6')](),controller['updateVoiceQueue']);router[_0x4c73('0x4')](_0x4c73('0x20'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x21')]);router['get'](_0x4c73('0x22'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x23')]);router[_0x4c73('0x4')](_0x4c73('0x24'),auth[_0x4c73('0x6')](),controller['agents']);router[_0x4c73('0x1f')](_0x4c73('0x25'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x26')]);router[_0x4c73('0x4')](_0x4c73('0x27'),auth['isAuthenticated'](),controller[_0x4c73('0x28')]);router[_0x4c73('0x4')]('/trunks',auth[_0x4c73('0x6')](),controller[_0x4c73('0x29')]);router['get'](_0x4c73('0x2a'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x2b')]);router[_0x4c73('0x4')](_0x4c73('0x2c'),auth['isAuthenticated'](),controller[_0x4c73('0x2d')]);router[_0x4c73('0x4')]('/chat/queues/waitinginteractions',auth[_0x4c73('0x6')](),controller[_0x4c73('0x2e')]);router['get'](_0x4c73('0x2f'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x30')]);router[_0x4c73('0x4')](_0x4c73('0x31'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x32')]);router[_0x4c73('0x4')](_0x4c73('0x33'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x34')]);router[_0x4c73('0x4')]('/sms/queues/waitinginteractions',auth[_0x4c73('0x6')](),controller[_0x4c73('0x35')]);router[_0x4c73('0x4')](_0x4c73('0x36'),auth['isAuthenticated'](),controller[_0x4c73('0x37')]);router[_0x4c73('0x4')](_0x4c73('0x38'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x39')]);router[_0x4c73('0x3a')](_0x4c73('0x3b'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x3c')](_0x4c73('0x3d')));router['get'](_0x4c73('0x3e'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x3f')]);router[_0x4c73('0x3a')]('/chat/queues/:id/notify',auth[_0x4c73('0x6')](),controller[_0x4c73('0x3c')](_0x4c73('0x40')));router[_0x4c73('0x4')](_0x4c73('0x41'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x4c73('0x3a')](_0x4c73('0x42'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x3c')]('fax'));router['get'](_0x4c73('0x43'),auth['isAuthenticated'](),controller[_0x4c73('0x44')]);router[_0x4c73('0x3a')](_0x4c73('0x45'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x3c')](_0x4c73('0x46')));router[_0x4c73('0x4')](_0x4c73('0x47'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x48')]);router['post'](_0x4c73('0x49'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x3c')](_0x4c73('0x4a')));router[_0x4c73('0x3a')](_0x4c73('0x4b'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x3c')](_0x4c73('0x4c')));router[_0x4c73('0x4')](_0x4c73('0x4d'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x4e')]);router[_0x4c73('0x4')](_0x4c73('0x4f'),auth['isAuthenticated'](),controller[_0x4c73('0x50')]);router[_0x4c73('0x3a')](_0x4c73('0x51'),auth[_0x4c73('0x6')](),controller[_0x4c73('0x52')]);module[_0x4c73('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index bd9d707..8c7c1a3 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x586047,_0x3a4259){var _0x3a12d8=function(_0x24567d){while(--_0x24567d){_0x586047['push'](_0x586047['shift']());}};_0x3a12d8(++_0x3a4259);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x394ee5,_0x409f9f){var _0x49262d=function(_0x2a0bb9){while(--_0x2a0bb9){_0x394ee5['push'](_0x394ee5['shift']());}};_0x49262d(++_0x409f9f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9e00e42..1b4f037 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 _0x71c6=['index','show','/:id/run','run','create','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x71c6,0x68));var _0x671c=function(_0x21f71e,_0x2d3918){_0x21f71e=_0x21f71e-0x0;var _0x1bc97c=_0x71c6[_0x21f71e];return _0x1bc97c;};'use strict';var multer=require(_0x671c('0x0'));var util=require(_0x671c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x671c('0x2'));var router=express[_0x671c('0x3')]();var fs_extra=require(_0x671c('0x4'));var auth=require(_0x671c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x671c('0x6'));var controller=require(_0x671c('0x7'));router[_0x671c('0x8')]('/',auth[_0x671c('0x9')](),controller[_0x671c('0xa')]);router[_0x671c('0x8')]('/:id',auth[_0x671c('0x9')](),controller[_0x671c('0xb')]);router[_0x671c('0x8')](_0x671c('0xc'),auth[_0x671c('0x9')](),controller[_0x671c('0xd')]);router['post']('/',auth[_0x671c('0x9')](),controller[_0x671c('0xe')]);router['put'](_0x671c('0xf'),auth[_0x671c('0x9')](),controller[_0x671c('0x10')]);router[_0x671c('0x11')](_0x671c('0xf'),auth[_0x671c('0x9')](),controller['destroy']);module[_0x671c('0x12')]=router; \ No newline at end of file +var _0x0ba4=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/run','run','create'];(function(_0x59d51a,_0x5f3217){var _0x4fc9f1=function(_0x5133f0){while(--_0x5133f0){_0x59d51a['push'](_0x59d51a['shift']());}};_0x4fc9f1(++_0x5f3217);}(_0x0ba4,0x19c));var _0x40ba=function(_0x4a23a9,_0x17a2c0){_0x4a23a9=_0x4a23a9-0x0;var _0x18c27f=_0x0ba4[_0x4a23a9];return _0x18c27f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40ba('0x0'));var timeout=require(_0x40ba('0x1'));var express=require(_0x40ba('0x2'));var router=express[_0x40ba('0x3')]();var fs_extra=require(_0x40ba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x40ba('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x40ba('0x6')]('/',auth[_0x40ba('0x7')](),controller[_0x40ba('0x8')]);router[_0x40ba('0x6')](_0x40ba('0x9'),auth[_0x40ba('0x7')](),controller['show']);router['get'](_0x40ba('0xa'),auth[_0x40ba('0x7')](),controller[_0x40ba('0xb')]);router['post']('/',auth[_0x40ba('0x7')](),controller[_0x40ba('0xc')]);router['put']('/:id',auth[_0x40ba('0x7')](),controller[_0x40ba('0xd')]);router[_0x40ba('0xe')](_0x40ba('0x9'),auth['isAuthenticated'](),controller[_0x40ba('0xf')]);module[_0x40ba('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 292516c..2a487aa 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 _0xf4ea=['months','days','hours','minutes','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x494a64,_0x44ccb5){var _0x5d8cee=function(_0x827780){while(--_0x827780){_0x494a64['push'](_0x494a64['shift']());}};_0x5d8cee(++_0x44ccb5);}(_0xf4ea,0xfa));var _0xaf4e=function(_0xcbff5,_0x50eb75){_0xcbff5=_0xcbff5-0x0;var _0x13a00a=_0xf4ea[_0xcbff5];return _0x13a00a;};'use strict';var Sequelize=require(_0xaf4e('0x0'));module[_0xaf4e('0x1')]={'name':{'type':Sequelize[_0xaf4e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xaf4e('0x2')]},'active':{'type':Sequelize[_0xaf4e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xaf4e('0x2')],'allowNull':![],'defaultValue':_0xaf4e('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xaf4e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xaf4e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xaf4e('0x7')](_0xaf4e('0x8'),_0xaf4e('0x9'),_0xaf4e('0xa'),'weeks',_0xaf4e('0xb'),_0xaf4e('0xc'),_0xaf4e('0xd')),'allowNull':![],'defaultValue':_0xaf4e('0xb')},'output':{'type':Sequelize[_0xaf4e('0x7')]('csv',_0xaf4e('0xe'),_0xaf4e('0xf')),'allowNull':![],'defaultValue':_0xaf4e('0x10')},'type':{'type':Sequelize[_0xaf4e('0x7')](_0xaf4e('0x11'),_0xaf4e('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xaf4e('0x13')]},'bcc':{'type':Sequelize[_0xaf4e('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf058=['custom','TEXT','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','xlsx'];(function(_0x71e58f,_0x4d233b){var _0x47471a=function(_0x350bc1){while(--_0x350bc1){_0x71e58f['push'](_0x71e58f['shift']());}};_0x47471a(++_0x4d233b);}(_0xf058,0x1bc));var _0x8f05=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf058[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8f05('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8f05('0x1')]},'active':{'type':Sequelize[_0x8f05('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8f05('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x8f05('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8f05('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8f05('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8f05('0x5')](_0x8f05('0x6'),_0x8f05('0x7'),_0x8f05('0x8'),_0x8f05('0x9'),_0x8f05('0xa'),_0x8f05('0xb'),_0x8f05('0xc')),'allowNull':![],'defaultValue':_0x8f05('0xa')},'output':{'type':Sequelize[_0x8f05('0x5')](_0x8f05('0xd'),'pdf',_0x8f05('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x8f05('0xf'),'default'),'allowNull':![],'defaultValue':_0x8f05('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x8f05('0x1')]},'cc':{'type':Sequelize[_0x8f05('0x10')]},'bcc':{'type':Sequelize[_0x8f05('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 79415e5..9984294 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 _0xd22c=['jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto'];(function(_0x31a32a,_0x3c6ed3){var _0x5eda40=function(_0x2b0eaa){while(--_0x2b0eaa){_0x31a32a['push'](_0x31a32a['shift']());}};_0x5eda40(++_0x3c6ed3);}(_0xd22c,0x13b));var _0xcd22=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0xd22c[_0x15af0f];return _0x2bd1cb;};'use strict';var emlformat=require(_0xcd22('0x0'));var rimraf=require(_0xcd22('0x1'));var zipdir=require(_0xcd22('0x2'));var jsonpatch=require(_0xcd22('0x3'));var rp=require(_0xcd22('0x4'));var moment=require(_0xcd22('0x5'));var BPromise=require(_0xcd22('0x6'));var Mustache=require('mustache');var util=require(_0xcd22('0x7'));var path=require('path');var sox=require(_0xcd22('0x8'));var csv=require(_0xcd22('0x9'));var ejs=require(_0xcd22('0xa'));var fs=require('fs');var fs_extra=require(_0xcd22('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd22('0xc'));var jsforce=require(_0xcd22('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd22('0x9'));var querystring=require(_0xcd22('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd22('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd22('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd22('0x11'));var logger=require('../../config/logger')(_0xcd22('0x12'));var utils=require(_0xcd22('0x13'));var config=require(_0xcd22('0x14'));var licenseUtil=require(_0xcd22('0x15'));var db=require(_0xcd22('0x16'))['db'];function respondWithStatusCode(_0x2730f4,_0x6e639){_0x6e639=_0x6e639||0xcc;return function(_0x578595){if(_0x578595){return _0x2730f4[_0xcd22('0x17')](_0x6e639);}return _0x2730f4['status'](_0x6e639)[_0xcd22('0x18')]();};}function respondWithResult(_0x16c302,_0x47c877){_0x47c877=_0x47c877||0xc8;return function(_0x54695a){if(_0x54695a){return _0x16c302[_0xcd22('0x19')](_0x47c877)[_0xcd22('0x1a')](_0x54695a);}};}function respondWithFilteredResult(_0x2865ca,_0x25f684){return function(_0x58cb47){if(_0x58cb47){var _0x255fd7=typeof _0x25f684[_0xcd22('0x1b')]===_0xcd22('0x1c')&&typeof _0x25f684[_0xcd22('0x1d')]===_0xcd22('0x1c');var _0x180465=_0x58cb47[_0xcd22('0x1e')];var _0x1842bd=_0x255fd7?0x0:_0x25f684[_0xcd22('0x1b')];var _0x17125d=_0x255fd7?_0x58cb47[_0xcd22('0x1e')]:_0x25f684[_0xcd22('0x1b')]+_0x25f684[_0xcd22('0x1d')];var _0x51ee63;if(_0x17125d>=_0x180465){_0x17125d=_0x180465;_0x51ee63=0xc8;}else{_0x51ee63=0xce;}_0x2865ca[_0xcd22('0x19')](_0x51ee63);return _0x2865ca[_0xcd22('0x1f')](_0xcd22('0x20'),_0x1842bd+'-'+_0x17125d+'/'+_0x180465)[_0xcd22('0x1a')](_0x58cb47);}return null;};}function patchUpdates(_0x464985){return function(_0x2007af){try{jsonpatch[_0xcd22('0x21')](_0x2007af,_0x464985,!![]);}catch(_0x33b11f){return BPromise['reject'](_0x33b11f);}return _0x2007af[_0xcd22('0x22')]();};}function saveUpdates(_0x604ee,_0x59320c){return function(_0x2a420d){if(_0x2a420d){return _0x2a420d['update'](_0x604ee)['then'](function(_0x8c7dbf){return _0x8c7dbf;});}return null;};}function removeEntity(_0x2ac902,_0x55778d){return function(_0x1ae9e9){if(_0x1ae9e9){return _0x1ae9e9[_0xcd22('0x23')]()[_0xcd22('0x24')](function(){var _0x3349c5=_0x1ae9e9[_0xcd22('0x25')]({'plain':!![]});var _0x5d281a=_0xcd22('0x26');return db[_0xcd22('0x27')][_0xcd22('0x23')]({'where':{'type':_0x5d281a,'resourceId':_0x3349c5['id']}})['then'](function(){return _0x1ae9e9;});})[_0xcd22('0x24')](function(){_0x2ac902[_0xcd22('0x19')](0xcc)[_0xcd22('0x18')]();});}};}function handleEntityNotFound(_0x49d010,_0x84a5cb){return function(_0x55b710){if(!_0x55b710){_0x49d010[_0xcd22('0x17')](0x194);}return _0x55b710;};}function handleError(_0x1e6c0b,_0xfe5e25){_0xfe5e25=_0xfe5e25||0x1f4;return function(_0x3dcee3){logger[_0xcd22('0x28')](_0x3dcee3[_0xcd22('0x29')]);if(_0x3dcee3[_0xcd22('0x2a')]){delete _0x3dcee3[_0xcd22('0x2a')];}_0x1e6c0b[_0xcd22('0x19')](_0xfe5e25)['send'](_0x3dcee3);};}exports[_0xcd22('0x2b')]=function(_0xe41c1d,_0x2830c0){var _0x35a3b7={},_0x2872da={},_0x4fd6b7={'count':0x0,'rows':[]};var _0x14b559=_[_0xcd22('0x2c')](db[_0xcd22('0x2d')]['rawAttributes'],function(_0xf68bd7){return{'name':_0xf68bd7[_0xcd22('0x2e')],'type':_0xf68bd7[_0xcd22('0x2f')][_0xcd22('0x30')]};});_0x2872da[_0xcd22('0x31')]=_[_0xcd22('0x2c')](_0x14b559,'name');_0x2872da[_0xcd22('0x32')]=_[_0xcd22('0x33')](_0xe41c1d[_0xcd22('0x32')]);_0x2872da[_0xcd22('0x34')]=_[_0xcd22('0x35')](_0x2872da[_0xcd22('0x31')],_0x2872da[_0xcd22('0x32')]);_0x35a3b7['attributes']=_[_0xcd22('0x35')](_0x2872da[_0xcd22('0x31')],qs['fields'](_0xe41c1d[_0xcd22('0x32')][_0xcd22('0x36')]));_0x35a3b7['attributes']=_0x35a3b7['attributes'][_0xcd22('0x37')]?_0x35a3b7[_0xcd22('0x38')]:_0x2872da[_0xcd22('0x31')];if(!_0xe41c1d['query'][_0xcd22('0x39')](_0xcd22('0x3a'))){_0x35a3b7['limit']=qs[_0xcd22('0x1d')](_0xe41c1d['query'][_0xcd22('0x1d')]);_0x35a3b7[_0xcd22('0x1b')]=qs['offset'](_0xe41c1d['query']['offset']);}_0x35a3b7['order']=qs['sort'](_0xe41c1d[_0xcd22('0x32')]['sort']);_0x35a3b7[_0xcd22('0x3b')]=qs['filters'](_[_0xcd22('0x3c')](_0xe41c1d[_0xcd22('0x32')],_0x2872da[_0xcd22('0x34')]),_0x14b559);if(_0xe41c1d[_0xcd22('0x32')][_0xcd22('0x3d')]){_0x35a3b7['where']=_[_0xcd22('0x3e')](_0x35a3b7[_0xcd22('0x3b')],{'$or':_[_0xcd22('0x2c')](_0x14b559,function(_0xb5d766){if(_0xb5d766[_0xcd22('0x2f')]!=='VIRTUAL'){var _0x6a1cae={};_0x6a1cae[_0xb5d766[_0xcd22('0x2a')]]={'$like':'%'+_0xe41c1d[_0xcd22('0x32')][_0xcd22('0x3d')]+'%'};return _0x6a1cae;}})});}_0x35a3b7=_[_0xcd22('0x3e')]({},_0x35a3b7,_0xe41c1d[_0xcd22('0x3f')]);var _0x4c0e3b={'where':_0x35a3b7[_0xcd22('0x3b')]};return db[_0xcd22('0x2d')][_0xcd22('0x1e')](_0x4c0e3b)[_0xcd22('0x24')](function(_0x117f29){_0x4fd6b7[_0xcd22('0x1e')]=_0x117f29;if(_0xe41c1d[_0xcd22('0x32')]['includeAll']){_0x35a3b7[_0xcd22('0x40')]=[{'all':!![]}];}return db['Schedule'][_0xcd22('0x41')](_0x35a3b7);})[_0xcd22('0x24')](function(_0xabffd9){_0x4fd6b7[_0xcd22('0x42')]=_0xabffd9;return _0x4fd6b7;})[_0xcd22('0x24')](respondWithFilteredResult(_0x2830c0,_0x35a3b7))[_0xcd22('0x43')](handleError(_0x2830c0,null));};exports[_0xcd22('0x44')]=function(_0x8c0ad,_0xd02b1d){var _0x478127={'raw':![],'where':{'id':_0x8c0ad['params']['id']}},_0x2edd24={};_0x2edd24[_0xcd22('0x31')]=_[_0xcd22('0x33')](db[_0xcd22('0x2d')][_0xcd22('0x45')]);_0x2edd24[_0xcd22('0x32')]=_[_0xcd22('0x33')](_0x8c0ad['query']);_0x2edd24['filters']=_[_0xcd22('0x35')](_0x2edd24[_0xcd22('0x31')],_0x2edd24[_0xcd22('0x32')]);_0x478127[_0xcd22('0x38')]=_[_0xcd22('0x35')](_0x2edd24[_0xcd22('0x31')],qs['fields'](_0x8c0ad[_0xcd22('0x32')]['fields']));_0x478127[_0xcd22('0x38')]=_0x478127['attributes'][_0xcd22('0x37')]?_0x478127[_0xcd22('0x38')]:_0x2edd24['model'];if(_0x8c0ad['query']['includeAll']){_0x478127[_0xcd22('0x40')]=[{'all':!![]}];}_0x478127=_[_0xcd22('0x3e')]({},_0x478127,_0x8c0ad[_0xcd22('0x3f')]);return db[_0xcd22('0x2d')][_0xcd22('0x46')](_0x478127)[_0xcd22('0x24')](handleEntityNotFound(_0xd02b1d,null))[_0xcd22('0x24')](respondWithResult(_0xd02b1d,null))[_0xcd22('0x43')](handleError(_0xd02b1d,null));};exports[_0xcd22('0x47')]=function(_0x4170ee,_0x40e7b5){return db['Schedule'][_0xcd22('0x47')](_0x4170ee[_0xcd22('0x48')],{})['then'](function(_0x40752c){var _0x510109=_0x4170ee[_0xcd22('0x49')]['get']({'plain':!![]});if(!_0x510109)throw new Error(_0xcd22('0x4a'));if(_0x510109[_0xcd22('0x4b')]===_0xcd22('0x49')){var _0x71f910=_0x40752c['get']({'plain':!![]});var _0x47519d=_0xcd22('0x26');return db[_0xcd22('0x4c')]['find']({'where':{'name':_0x47519d,'userProfileId':_0x510109[_0xcd22('0x4d')]},'raw':!![]})[_0xcd22('0x24')](function(_0x5ceada){if(_0x5ceada&&_0x5ceada[_0xcd22('0x4e')]===0x0){return db['UserProfileResource'][_0xcd22('0x47')]({'name':_0x71f910[_0xcd22('0x2a')],'resourceId':_0x71f910['id'],'type':_0x5ceada['name'],'sectionId':_0x5ceada['id']},{})[_0xcd22('0x24')](function(){return _0x40752c;});}else{return _0x40752c;}})[_0xcd22('0x43')](function(_0x1e46c5){logger[_0xcd22('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e46c5);throw _0x1e46c5;});}return _0x40752c;})[_0xcd22('0x24')](respondWithResult(_0x40e7b5,0xc9))[_0xcd22('0x43')](handleError(_0x40e7b5,null));};exports[_0xcd22('0x4f')]=function(_0x4182dd,_0x1c2f48){if(_0x4182dd[_0xcd22('0x48')]['id']){delete _0x4182dd[_0xcd22('0x48')]['id'];}return db[_0xcd22('0x2d')][_0xcd22('0x46')]({'where':{'id':_0x4182dd[_0xcd22('0x50')]['id']}})[_0xcd22('0x24')](handleEntityNotFound(_0x1c2f48,null))[_0xcd22('0x24')](saveUpdates(_0x4182dd[_0xcd22('0x48')],null))['then'](respondWithResult(_0x1c2f48,null))[_0xcd22('0x43')](handleError(_0x1c2f48,null));};exports[_0xcd22('0x23')]=function(_0x5e28b6,_0x259aaf){return db['Schedule'][_0xcd22('0x46')]({'where':{'id':_0x5e28b6[_0xcd22('0x50')]['id']}})[_0xcd22('0x24')](handleEntityNotFound(_0x259aaf,null))[_0xcd22('0x24')](removeEntity(_0x259aaf,null))[_0xcd22('0x43')](handleError(_0x259aaf,null));};exports[_0xcd22('0x51')]=function(_0x367609,_0x52812d,_0x3a33da){var _0x132640=require('../../config/schedule');return db[_0xcd22('0x2d')]['find']({'where':{'id':_0x367609[_0xcd22('0x50')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x52812d,null))[_0xcd22('0x24')](function(){_0x132640['run'](_0x367609[_0xcd22('0x50')]['id']);})[_0xcd22('0x24')](respondWithStatusCode(_0x52812d,null))[_0xcd22('0x43')](handleError(_0x52812d,null));}; \ No newline at end of file +var _0xa379=['rows','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','include'];(function(_0x405fe8,_0xa55e2f){var _0x50e490=function(_0x566869){while(--_0x566869){_0x405fe8['push'](_0x405fe8['shift']());}};_0x50e490(++_0xa55e2f);}(_0xa379,0x1bf));var _0x9a37=function(_0x2a9948,_0x235a3a){_0x2a9948=_0x2a9948-0x0;var _0x708470=_0xa379[_0x2a9948];return _0x708470;};'use strict';var emlformat=require(_0x9a37('0x0'));var rimraf=require(_0x9a37('0x1'));var zipdir=require(_0x9a37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a37('0x3'));var moment=require(_0x9a37('0x4'));var BPromise=require(_0x9a37('0x5'));var Mustache=require(_0x9a37('0x6'));var util=require(_0x9a37('0x7'));var path=require(_0x9a37('0x8'));var sox=require(_0x9a37('0x9'));var csv=require('to-csv');var ejs=require(_0x9a37('0xa'));var fs=require('fs');var fs_extra=require(_0x9a37('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9a37('0xc'));var deskjs=require(_0x9a37('0xd'));var toCsv=require(_0x9a37('0xe'));var querystring=require('querystring');var Papa=require(_0x9a37('0xf'));var Redis=require(_0x9a37('0x10'));var authService=require(_0x9a37('0x11'));var qs=require(_0x9a37('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a37('0x13'));var logger=require(_0x9a37('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9a37('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a37('0x16'))['db'];function respondWithStatusCode(_0x38ee20,_0x2ecbd0){_0x2ecbd0=_0x2ecbd0||0xcc;return function(_0x181d08){if(_0x181d08){return _0x38ee20[_0x9a37('0x17')](_0x2ecbd0);}return _0x38ee20[_0x9a37('0x18')](_0x2ecbd0)[_0x9a37('0x19')]();};}function respondWithResult(_0x510f1d,_0x1e7b29){_0x1e7b29=_0x1e7b29||0xc8;return function(_0x5e9363){if(_0x5e9363){return _0x510f1d[_0x9a37('0x18')](_0x1e7b29)['json'](_0x5e9363);}};}function respondWithFilteredResult(_0x24419c,_0x2d7221){return function(_0x38dab3){if(_0x38dab3){var _0x5e3ee5=typeof _0x2d7221[_0x9a37('0x1a')]===_0x9a37('0x1b')&&typeof _0x2d7221[_0x9a37('0x1c')]===_0x9a37('0x1b');var _0x4af6f0=_0x38dab3[_0x9a37('0x1d')];var _0x2380b7=_0x5e3ee5?0x0:_0x2d7221['offset'];var _0x27adbf=_0x5e3ee5?_0x38dab3[_0x9a37('0x1d')]:_0x2d7221[_0x9a37('0x1a')]+_0x2d7221[_0x9a37('0x1c')];var _0x4f42ac;if(_0x27adbf>=_0x4af6f0){_0x27adbf=_0x4af6f0;_0x4f42ac=0xc8;}else{_0x4f42ac=0xce;}_0x24419c['status'](_0x4f42ac);return _0x24419c['set'](_0x9a37('0x1e'),_0x2380b7+'-'+_0x27adbf+'/'+_0x4af6f0)[_0x9a37('0x1f')](_0x38dab3);}return null;};}function patchUpdates(_0x1895aa){return function(_0x30146c){try{jsonpatch[_0x9a37('0x20')](_0x30146c,_0x1895aa,!![]);}catch(_0x5a6527){return BPromise[_0x9a37('0x21')](_0x5a6527);}return _0x30146c[_0x9a37('0x22')]();};}function saveUpdates(_0x2651c8,_0x25dbdb){return function(_0x4784ed){if(_0x4784ed){return _0x4784ed[_0x9a37('0x23')](_0x2651c8)[_0x9a37('0x24')](function(_0x212bcb){return _0x212bcb;});}return null;};}function removeEntity(_0x58737d,_0x10693b){return function(_0x470ec0){if(_0x470ec0){return _0x470ec0[_0x9a37('0x25')]()[_0x9a37('0x24')](function(){var _0x493a3a=_0x470ec0['get']({'plain':!![]});var _0x193800='Scheduler';return db[_0x9a37('0x26')][_0x9a37('0x25')]({'where':{'type':_0x193800,'resourceId':_0x493a3a['id']}})[_0x9a37('0x24')](function(){return _0x470ec0;});})[_0x9a37('0x24')](function(){_0x58737d[_0x9a37('0x18')](0xcc)[_0x9a37('0x19')]();});}};}function handleEntityNotFound(_0x5910bc,_0x1a9792){return function(_0x31aeaf){if(!_0x31aeaf){_0x5910bc['sendStatus'](0x194);}return _0x31aeaf;};}function handleError(_0x21f314,_0x44c8bb){_0x44c8bb=_0x44c8bb||0x1f4;return function(_0x1f9151){logger[_0x9a37('0x27')](_0x1f9151[_0x9a37('0x28')]);if(_0x1f9151[_0x9a37('0x29')]){delete _0x1f9151[_0x9a37('0x29')];}_0x21f314[_0x9a37('0x18')](_0x44c8bb)[_0x9a37('0x2a')](_0x1f9151);};}exports[_0x9a37('0x2b')]=function(_0x162503,_0x3f64de){var _0x47cdba={},_0x2de511={},_0x2281c0={'count':0x0,'rows':[]};var _0x11b036=_[_0x9a37('0x2c')](db['Schedule']['rawAttributes'],function(_0x2d7f48){return{'name':_0x2d7f48[_0x9a37('0x2d')],'type':_0x2d7f48[_0x9a37('0x2e')][_0x9a37('0x2f')]};});_0x2de511['model']=_[_0x9a37('0x2c')](_0x11b036,_0x9a37('0x29'));_0x2de511[_0x9a37('0x30')]=_[_0x9a37('0x31')](_0x162503[_0x9a37('0x30')]);_0x2de511[_0x9a37('0x32')]=_[_0x9a37('0x33')](_0x2de511[_0x9a37('0x34')],_0x2de511[_0x9a37('0x30')]);_0x47cdba[_0x9a37('0x35')]=_[_0x9a37('0x33')](_0x2de511[_0x9a37('0x34')],qs[_0x9a37('0x36')](_0x162503[_0x9a37('0x30')][_0x9a37('0x36')]));_0x47cdba[_0x9a37('0x35')]=_0x47cdba['attributes'][_0x9a37('0x37')]?_0x47cdba[_0x9a37('0x35')]:_0x2de511['model'];if(!_0x162503[_0x9a37('0x30')][_0x9a37('0x38')](_0x9a37('0x39'))){_0x47cdba[_0x9a37('0x1c')]=qs[_0x9a37('0x1c')](_0x162503[_0x9a37('0x30')]['limit']);_0x47cdba[_0x9a37('0x1a')]=qs['offset'](_0x162503[_0x9a37('0x30')][_0x9a37('0x1a')]);}_0x47cdba[_0x9a37('0x3a')]=qs[_0x9a37('0x3b')](_0x162503[_0x9a37('0x30')][_0x9a37('0x3b')]);_0x47cdba[_0x9a37('0x3c')]=qs['filters'](_[_0x9a37('0x3d')](_0x162503[_0x9a37('0x30')],_0x2de511['filters']),_0x11b036);if(_0x162503['query'][_0x9a37('0x3e')]){_0x47cdba[_0x9a37('0x3c')]=_[_0x9a37('0x3f')](_0x47cdba['where'],{'$or':_[_0x9a37('0x2c')](_0x11b036,function(_0x463251){if(_0x463251[_0x9a37('0x2e')]!==_0x9a37('0x40')){var _0x4443b4={};_0x4443b4[_0x463251[_0x9a37('0x29')]]={'$like':'%'+_0x162503['query'][_0x9a37('0x3e')]+'%'};return _0x4443b4;}})});}_0x47cdba=_['merge']({},_0x47cdba,_0x162503[_0x9a37('0x41')]);var _0x204077={'where':_0x47cdba[_0x9a37('0x3c')]};return db[_0x9a37('0x42')][_0x9a37('0x1d')](_0x204077)[_0x9a37('0x24')](function(_0x75dd0c){_0x2281c0['count']=_0x75dd0c;if(_0x162503[_0x9a37('0x30')][_0x9a37('0x43')]){_0x47cdba[_0x9a37('0x44')]=[{'all':!![]}];}return db[_0x9a37('0x42')]['findAll'](_0x47cdba);})[_0x9a37('0x24')](function(_0x524dd1){_0x2281c0[_0x9a37('0x45')]=_0x524dd1;return _0x2281c0;})['then'](respondWithFilteredResult(_0x3f64de,_0x47cdba))[_0x9a37('0x46')](handleError(_0x3f64de,null));};exports[_0x9a37('0x47')]=function(_0xf924e6,_0x27eb49){var _0x171c3c={'raw':![],'where':{'id':_0xf924e6[_0x9a37('0x48')]['id']}},_0x3b998e={};_0x3b998e[_0x9a37('0x34')]=_['keys'](db['Schedule'][_0x9a37('0x49')]);_0x3b998e[_0x9a37('0x30')]=_['keys'](_0xf924e6[_0x9a37('0x30')]);_0x3b998e[_0x9a37('0x32')]=_[_0x9a37('0x33')](_0x3b998e[_0x9a37('0x34')],_0x3b998e[_0x9a37('0x30')]);_0x171c3c[_0x9a37('0x35')]=_[_0x9a37('0x33')](_0x3b998e[_0x9a37('0x34')],qs[_0x9a37('0x36')](_0xf924e6['query']['fields']));_0x171c3c['attributes']=_0x171c3c[_0x9a37('0x35')][_0x9a37('0x37')]?_0x171c3c['attributes']:_0x3b998e['model'];if(_0xf924e6[_0x9a37('0x30')][_0x9a37('0x43')]){_0x171c3c[_0x9a37('0x44')]=[{'all':!![]}];}_0x171c3c=_[_0x9a37('0x3f')]({},_0x171c3c,_0xf924e6['options']);return db[_0x9a37('0x42')][_0x9a37('0x4a')](_0x171c3c)[_0x9a37('0x24')](handleEntityNotFound(_0x27eb49,null))[_0x9a37('0x24')](respondWithResult(_0x27eb49,null))[_0x9a37('0x46')](handleError(_0x27eb49,null));};exports[_0x9a37('0x4b')]=function(_0x7a3768,_0x3405eb){return db[_0x9a37('0x42')][_0x9a37('0x4b')](_0x7a3768[_0x9a37('0x4c')],{})[_0x9a37('0x24')](function(_0x2ae8c9){var _0x3bdd19=_0x7a3768['user'][_0x9a37('0x4d')]({'plain':!![]});if(!_0x3bdd19)throw new Error(_0x9a37('0x4e'));if(_0x3bdd19[_0x9a37('0x4f')]===_0x9a37('0x50')){var _0x28ab4f=_0x2ae8c9['get']({'plain':!![]});var _0x24c374=_0x9a37('0x51');return db['UserProfileSection'][_0x9a37('0x4a')]({'where':{'name':_0x24c374,'userProfileId':_0x3bdd19[_0x9a37('0x52')]},'raw':!![]})[_0x9a37('0x24')](function(_0x2e15c3){if(_0x2e15c3&&_0x2e15c3['autoAssociation']===0x0){return db[_0x9a37('0x26')][_0x9a37('0x4b')]({'name':_0x28ab4f['name'],'resourceId':_0x28ab4f['id'],'type':_0x2e15c3['name'],'sectionId':_0x2e15c3['id']},{})[_0x9a37('0x24')](function(){return _0x2ae8c9;});}else{return _0x2ae8c9;}})[_0x9a37('0x46')](function(_0x5a7443){logger[_0x9a37('0x27')](_0x9a37('0x53'),_0x5a7443);throw _0x5a7443;});}return _0x2ae8c9;})[_0x9a37('0x24')](respondWithResult(_0x3405eb,0xc9))[_0x9a37('0x46')](handleError(_0x3405eb,null));};exports[_0x9a37('0x23')]=function(_0x1364c0,_0x385df9){if(_0x1364c0[_0x9a37('0x4c')]['id']){delete _0x1364c0[_0x9a37('0x4c')]['id'];}return db[_0x9a37('0x42')][_0x9a37('0x4a')]({'where':{'id':_0x1364c0[_0x9a37('0x48')]['id']}})[_0x9a37('0x24')](handleEntityNotFound(_0x385df9,null))[_0x9a37('0x24')](saveUpdates(_0x1364c0[_0x9a37('0x4c')],null))[_0x9a37('0x24')](respondWithResult(_0x385df9,null))[_0x9a37('0x46')](handleError(_0x385df9,null));};exports[_0x9a37('0x25')]=function(_0x330283,_0x39bb70){return db[_0x9a37('0x42')]['find']({'where':{'id':_0x330283[_0x9a37('0x48')]['id']}})['then'](handleEntityNotFound(_0x39bb70,null))[_0x9a37('0x24')](removeEntity(_0x39bb70,null))[_0x9a37('0x46')](handleError(_0x39bb70,null));};exports['run']=function(_0x346e3c,_0x72e0a,_0x3479b6){var _0x10c489=require(_0x9a37('0x54'));return db['Schedule'][_0x9a37('0x4a')]({'where':{'id':_0x346e3c['params']['id']},'raw':!![]})[_0x9a37('0x24')](handleEntityNotFound(_0x72e0a,null))[_0x9a37('0x24')](function(){_0x10c489[_0x9a37('0x55')](_0x346e3c[_0x9a37('0x48')]['id']);})['then'](respondWithStatusCode(_0x72e0a,null))['catch'](handleError(_0x72e0a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3f9fed8..1f8d412 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 _0x7fbb=['exports','define','Schedule','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d2026,_0x1e9950){var _0x14fcf0=function(_0x11c56d){while(--_0x11c56d){_0x1d2026['push'](_0x1d2026['shift']());}};_0x14fcf0(++_0x1e9950);}(_0x7fbb,0x18f));var _0xb7fb=function(_0x4fd80b,_0x5b0c1c){_0x4fd80b=_0x4fd80b-0x0;var _0x250e67=_0x7fbb[_0x4fd80b];return _0x250e67;};'use strict';var _=require(_0xb7fb('0x0'));var util=require(_0xb7fb('0x1'));var logger=require(_0xb7fb('0x2'))('api');var moment=require(_0xb7fb('0x3'));var BPromise=require(_0xb7fb('0x4'));var rp=require(_0xb7fb('0x5'));var fs=require('fs');var path=require(_0xb7fb('0x6'));var rimraf=require(_0xb7fb('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xb7fb('0x8')]=function(_0x2e4619,_0x2c72b7){return _0x2e4619[_0xb7fb('0x9')](_0xb7fb('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff3=['Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./schedule.attributes','exports','define'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xbff3,0x1ca));var _0x3bff=function(_0x3dd4da,_0x591108){_0x3dd4da=_0x3dd4da-0x0;var _0x2591cc=_0xbff3[_0x3dd4da];return _0x2591cc;};'use strict';var _=require(_0x3bff('0x0'));var util=require(_0x3bff('0x1'));var logger=require(_0x3bff('0x2'))('api');var moment=require(_0x3bff('0x3'));var BPromise=require(_0x3bff('0x4'));var rp=require(_0x3bff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bff('0x6'));var attributes=require(_0x3bff('0x7'));module[_0x3bff('0x8')]=function(_0x1c9311,_0x582ff7){return _0x1c9311[_0x3bff('0x9')](_0x3bff('0xa'),attributes,{'tableName':_0x3bff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b2eccfa..862d294 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 _0x2389=['../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2389,0x1dc));var _0x9238=function(_0x5baf3e,_0x148cba){_0x5baf3e=_0x5baf3e-0x0;var _0x5b08b9=_0x2389[_0x5baf3e];return _0x5b08b9;};'use strict';var _=require(_0x9238('0x0'));var util=require(_0x9238('0x1'));var moment=require(_0x9238('0x2'));var BPromise=require(_0x9238('0x3'));var rs=require(_0x9238('0x4'));var fs=require('fs');var Redis=require(_0x9238('0x5'));var db=require(_0x9238('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9238('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9238('0x8'));var client=jayson[_0x9238('0x9')][_0x9238('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26d72a,_0x4bfd12,_0x4e055f){return new BPromise(function(_0x3f1099,_0x33c41e){return client[_0x9238('0xb')](_0x26d72a,_0x4e055f)[_0x9238('0xc')](function(_0x431ab5){logger[_0x9238('0xd')](_0x9238('0xe'),_0x4bfd12,_0x9238('0xf'));logger[_0x9238('0x10')](_0x9238('0x11'),_0x4bfd12,_0x9238('0xf'),JSON[_0x9238('0x12')](_0x431ab5));if(_0x431ab5[_0x9238('0x13')]){if(_0x431ab5[_0x9238('0x13')][_0x9238('0x14')]===0x1f4){logger[_0x9238('0x13')]('Schedule,\x20%s,\x20%s',_0x4bfd12,_0x431ab5[_0x9238('0x13')][_0x9238('0x15')]);return _0x33c41e(_0x431ab5['error'][_0x9238('0x15')]);}logger[_0x9238('0x13')](_0x9238('0xe'),_0x4bfd12,_0x431ab5[_0x9238('0x13')][_0x9238('0x15')]);return _0x3f1099(_0x431ab5[_0x9238('0x13')][_0x9238('0x15')]);}else{logger[_0x9238('0xd')]('Schedule,\x20%s,\x20%s',_0x4bfd12,'request\x20sent');_0x3f1099(_0x431ab5[_0x9238('0x16')][_0x9238('0x15')]);}})['catch'](function(_0x119365){logger[_0x9238('0x13')](_0x9238('0xe'),_0x4bfd12,_0x119365);_0x33c41e(_0x119365);});});} \ No newline at end of file +var _0x1994=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x5112bc,_0x49be76){var _0x3599fd=function(_0x4b8666){while(--_0x4b8666){_0x5112bc['push'](_0x5112bc['shift']());}};_0x3599fd(++_0x49be76);}(_0x1994,0x1f4));var _0x4199=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1994[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4199('0x0'));var util=require(_0x4199('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4199('0x2'));var db=require(_0x4199('0x3'))['db'];var utils=require(_0x4199('0x4'));var logger=require(_0x4199('0x5'))(_0x4199('0x6'));var config=require(_0x4199('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4199('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2de3,_0x1ccec4,_0x4a930e){return new BPromise(function(_0x46a1c6,_0x57140d){return client[_0x4199('0x9')](_0x1f2de3,_0x4a930e)[_0x4199('0xa')](function(_0x3a7910){logger[_0x4199('0xb')](_0x4199('0xc'),_0x1ccec4,_0x4199('0xd'));logger['debug'](_0x4199('0xe'),_0x1ccec4,_0x4199('0xd'),JSON[_0x4199('0xf')](_0x3a7910));if(_0x3a7910['error']){if(_0x3a7910['error']['code']===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x1ccec4,_0x3a7910[_0x4199('0x10')][_0x4199('0x11')]);return _0x57140d(_0x3a7910['error'][_0x4199('0x11')]);}logger[_0x4199('0x10')]('Schedule,\x20%s,\x20%s',_0x1ccec4,_0x3a7910['error'][_0x4199('0x11')]);return _0x46a1c6(_0x3a7910[_0x4199('0x10')]['message']);}else{logger[_0x4199('0xb')](_0x4199('0xc'),_0x1ccec4,_0x4199('0xd'));_0x46a1c6(_0x3a7910[_0x4199('0x12')][_0x4199('0x11')]);}})[_0x4199('0x13')](function(_0xb5e584){logger[_0x4199('0x10')](_0x4199('0xc'),_0x1ccec4,_0xb5e584);_0x57140d(_0xb5e584);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 1722684..50cdcba 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 _0xba47=['show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xba47,0x134));var _0x7ba4=function(_0x47fcce,_0x40bfa7){_0x47fcce=_0x47fcce-0x0;var _0x417e9c=_0xba47[_0x47fcce];return _0x417e9c;};'use strict';var multer=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var path=require(_0x7ba4('0x2'));var timeout=require(_0x7ba4('0x3'));var express=require(_0x7ba4('0x4'));var router=express[_0x7ba4('0x5')]();var fs_extra=require(_0x7ba4('0x6'));var auth=require(_0x7ba4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7ba4('0x8'));var controller=require('./screenRecording.controller');router[_0x7ba4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7ba4('0x9')](_0x7ba4('0xa'),auth[_0x7ba4('0xb')](),controller[_0x7ba4('0xc')]);router[_0x7ba4('0x9')](_0x7ba4('0xd'),auth[_0x7ba4('0xb')](),controller[_0x7ba4('0xe')]);router['get'](_0x7ba4('0xf'),auth[_0x7ba4('0xb')](),controller[_0x7ba4('0x10')]);router[_0x7ba4('0x11')]('/',auth[_0x7ba4('0xb')](),controller[_0x7ba4('0x12')]);router[_0x7ba4('0x13')](_0x7ba4('0xd'),auth[_0x7ba4('0xb')](),controller['update']);router[_0x7ba4('0x14')](_0x7ba4('0xd'),auth[_0x7ba4('0xb')](),controller[_0x7ba4('0x15')]);module[_0x7ba4('0x16')]=router; \ No newline at end of file +var _0xbff3=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./screenRecording.controller','index','get','/describe','describe','/:id','isAuthenticated','show','download','post','create','put','destroy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbff3,0xdc));var _0x3bff=function(_0x660362,_0x16a84a){_0x660362=_0x660362-0x0;var _0x13f18c=_0xbff3[_0x660362];return _0x13f18c;};'use strict';var multer=require(_0x3bff('0x0'));var util=require('util');var path=require(_0x3bff('0x1'));var timeout=require(_0x3bff('0x2'));var express=require(_0x3bff('0x3'));var router=express[_0x3bff('0x4')]();var fs_extra=require(_0x3bff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3bff('0x6'));var config=require('../../config/environment');var controller=require(_0x3bff('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3bff('0x8')]);router[_0x3bff('0x9')](_0x3bff('0xa'),auth['isAuthenticated'](),controller[_0x3bff('0xb')]);router[_0x3bff('0x9')](_0x3bff('0xc'),auth[_0x3bff('0xd')](),controller[_0x3bff('0xe')]);router['get']('/:id/download',auth[_0x3bff('0xd')](),controller[_0x3bff('0xf')]);router[_0x3bff('0x10')]('/',auth[_0x3bff('0xd')](),controller[_0x3bff('0x11')]);router[_0x3bff('0x12')](_0x3bff('0xc'),auth[_0x3bff('0xd')](),controller['update']);router['delete'](_0x3bff('0xc'),auth[_0x3bff('0xd')](),controller[_0x3bff('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 35ea23e..25f34cb 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 _0x014c=['../../config/environment','exports','VIRTUAL','extname','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','moment'];(function(_0x5a6a90,_0x2ca2a0){var _0x434a61=function(_0x4ee129){while(--_0x4ee129){_0x5a6a90['push'](_0x5a6a90['shift']());}};_0x434a61(++_0x2ca2a0);}(_0x014c,0x17b));var _0xc014=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x014c[_0x466247];return _0x4b352e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc014('0x0'));var path=require('path');var config=require(_0xc014('0x1'));module[_0xc014('0x2')]={'format':{'type':Sequelize[_0xc014('0x3')],'get':function(){return this['getDataValue']('value')?path[_0xc014('0x4')](this[_0xc014('0x5')](_0xc014('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xc014('0x7')]},'channel':{'type':Sequelize[_0xc014('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x398960){var _0x367c5c=_0x398960['replace'](/\\/g,'/');this[_0xc014('0x8')]('value',_0x367c5c);}},'rating':{'type':Sequelize[_0xc014('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc014('0x9')],'set':function(_0x5701db){this['setDataValue'](_0xc014('0xa'),moment()[_0xc014('0xb')](_0x5701db,'ms'));this[_0xc014('0x8')](_0xc014('0xc'),moment());this['setDataValue'](_0xc014('0xd'),_0x5701db);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc014('0x5')]('startedAt'))[_0xc014('0xe')](_0xc014('0xf'))[_0xc014('0x10')]();}},'closedAt':{'type':Sequelize[_0xc014('0x11')],'get':function(){return moment(this['getDataValue'](_0xc014('0xc')))[_0xc014('0xe')](_0xc014('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0xc014('0x11')],'get':function(){return moment(this['getDataValue'](_0xc014('0x12')))[_0xc014('0xe')](_0xc014('0xf'))[_0xc014('0x10')]();}},'updatedAt':{'type':Sequelize[_0xc014('0x11')],'get':function(){return moment(this[_0xc014('0x5')]('updatedAt'))[_0xc014('0xe')](_0xc014('0xf'))[_0xc014('0x10')]();}}}; \ No newline at end of file +var _0x19cb=['createdAt','updatedAt','moment','path','exports','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x47467,_0x3afd2a){var _0x2bd690=function(_0x44ae00){while(--_0x44ae00){_0x47467['push'](_0x47467['shift']());}};_0x2bd690(++_0x3afd2a);}(_0x19cb,0x146));var _0xb19c=function(_0x202179,_0x185e1f){_0x202179=_0x202179-0x0;var _0x24852a=_0x19cb[_0x202179];return _0x24852a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb19c('0x0'));var path=require(_0xb19c('0x1'));var config=require('../../config/environment');module[_0xb19c('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb19c('0x3')]('value')?path['extname'](this['getDataValue'](_0xb19c('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xb19c('0x5')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x2d6a30){var _0x477ac1=_0x2d6a30[_0xb19c('0x6')](/\\/g,'/');this[_0xb19c('0x7')]('value',_0x477ac1);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb19c('0x8')],'set':function(_0x3ffb45){this[_0xb19c('0x7')](_0xb19c('0x9'),moment()[_0xb19c('0xa')](_0x3ffb45,'ms'));this['setDataValue'](_0xb19c('0xb'),moment());this[_0xb19c('0x7')](_0xb19c('0xc'),_0x3ffb45);}},'startedAt':{'type':Sequelize[_0xb19c('0xd')],'get':function(){return moment(this[_0xb19c('0x3')](_0xb19c('0x9')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xb19c('0xd')],'get':function(){return moment(this[_0xb19c('0x3')](_0xb19c('0xb')))['format'](_0xb19c('0xe'))[_0xb19c('0xf')]();}},'createdAt':{'type':Sequelize[_0xb19c('0xd')],'get':function(){return moment(this['getDataValue'](_0xb19c('0x10')))['format'](_0xb19c('0xe'))[_0xb19c('0xf')]();}},'updatedAt':{'type':Sequelize[_0xb19c('0xd')],'get':function(){return moment(this[_0xb19c('0x3')](_0xb19c('0x11')))['format'](_0xb19c('0xe'))[_0xb19c('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 35787df..2be0391 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 _0xabce=['sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','include','rows','includeAll','find','catch','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','recording','join','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x5a6d3b,_0x15a93b){var _0x3aaf17=function(_0xc74bd7){while(--_0xc74bd7){_0x5a6d3b['push'](_0x5a6d3b['shift']());}};_0x3aaf17(++_0x15a93b);}(_0xabce,0x103));var _0xeabc=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xabce[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}exports[_0xeabc('0x2a')]=function(_0x48fb52,_0x2163e6){var _0x38572d={},_0x2b568f={},_0x2f8633={'count':0x0,'rows':[]};var _0x149170=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')],function(_0x2915c1){return{'name':_0x2915c1['fieldName'],'type':_0x2915c1[_0xeabc('0x2e')]['key']};});_0x2b568f[_0xeabc('0x2f')]=_[_0xeabc('0x30')](_[_0xeabc('0x2b')](_0x149170,_0xeabc('0x28')),[_0xeabc('0x31')]);_0x2b568f[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x48fb52['query']);_0x2b568f[_0xeabc('0x34')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],_0x2b568f['query']);_0x38572d[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],qs['fields'](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x37')]));_0x38572d[_0xeabc('0x36')]=_0x38572d['attributes'][_0xeabc('0x38')]?_0x38572d[_0xeabc('0x36')]:_0x2b568f['model'];if(!_0x48fb52['query'][_0xeabc('0x39')](_0xeabc('0x3a'))){_0x38572d['limit']=qs[_0xeabc('0x1d')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x1d')]);_0x38572d[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x48fb52['query'][_0xeabc('0x1f')]);}_0x38572d['order']=qs[_0xeabc('0x3b')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x3b')]);_0x38572d['where']=qs['filters'](_[_0xeabc('0x3c')](_0x48fb52['query'],_0x2b568f[_0xeabc('0x34')]),_0x149170);if(_0x48fb52['query']['filter']){_0x38572d['where']=_['merge'](_0x38572d[_0xeabc('0x3d')],{'$or':_['map'](_0x149170,function(_0x257fe8){if(_0x257fe8[_0xeabc('0x2e')]!=='VIRTUAL'){var _0xe8fa6e={};_0xe8fa6e[_0x257fe8['name']]={'$like':'%'+_0x48fb52[_0xeabc('0x32')]['filter']+'%'};return _0xe8fa6e;}})});}_0x38572d=_[_0xeabc('0x3e')]({},_0x38572d,_0x48fb52[_0xeabc('0x3f')]);var _0xeeef02={'where':_0x38572d['where']};return db['ScreenRecording']['count'](_0xeeef02)[_0xeabc('0x25')](function(_0x23fb33){_0x2f8633[_0xeabc('0x1e')]=_0x23fb33;if(_0x48fb52['query']['includeAll']){_0x38572d[_0xeabc('0x40')]=[{'all':!![]}];}return db[_0xeabc('0x2c')]['findAll'](_0x38572d);})[_0xeabc('0x25')](function(_0x5e0b78){_0x2f8633[_0xeabc('0x41')]=_0x5e0b78;return _0x2f8633;})['then'](respondWithFilteredResult(_0x2163e6,_0x38572d))['catch'](handleError(_0x2163e6,null));};exports['show']=function(_0x25958b,_0x37c926){var _0xd03226={'raw':![],'where':{'id':_0x25958b['params']['id']}},_0x3eeeb5={};_0x3eeeb5[_0xeabc('0x2f')]=_['keys'](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x3eeeb5[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x25958b[_0xeabc('0x32')]);_0x3eeeb5['filters']=_['intersection'](_0x3eeeb5[_0xeabc('0x2f')],_0x3eeeb5['query']);_0xd03226[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x3eeeb5['model'],qs[_0xeabc('0x37')](_0x25958b[_0xeabc('0x32')][_0xeabc('0x37')]));_0xd03226[_0xeabc('0x36')]=_0xd03226[_0xeabc('0x36')][_0xeabc('0x38')]?_0xd03226[_0xeabc('0x36')]:_0x3eeeb5['model'];if(_0x25958b[_0xeabc('0x32')][_0xeabc('0x42')]){_0xd03226[_0xeabc('0x40')]=[{'all':!![]}];}_0xd03226=_[_0xeabc('0x3e')]({},_0xd03226,_0x25958b[_0xeabc('0x3f')]);return db[_0xeabc('0x2c')][_0xeabc('0x43')](_0xd03226)[_0xeabc('0x25')](handleEntityNotFound(_0x37c926,null))[_0xeabc('0x25')](respondWithResult(_0x37c926,null))[_0xeabc('0x44')](handleError(_0x37c926,null));};exports['create']=function(_0x38356c,_0x2e6efb){return db[_0xeabc('0x2c')][_0xeabc('0x45')](_0x38356c[_0xeabc('0x46')],{})[_0xeabc('0x25')](respondWithResult(_0x2e6efb,0xc9))[_0xeabc('0x44')](handleError(_0x2e6efb,null));};exports['update']=function(_0x766743,_0x32e09b){if(_0x766743[_0xeabc('0x46')]['id']){delete _0x766743[_0xeabc('0x46')]['id'];}delete _0x766743[_0xeabc('0x46')]['duration'];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x47')];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x48')];delete _0x766743['body'][_0xeabc('0x49')];return db[_0xeabc('0x2c')]['find']({'where':{'id':_0x766743[_0xeabc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32e09b,null))[_0xeabc('0x25')](saveUpdates(_0x766743['body'],null))[_0xeabc('0x25')](respondWithResult(_0x32e09b,null))[_0xeabc('0x44')](handleError(_0x32e09b,null));};exports[_0xeabc('0x4b')]=function(_0x1524c3,_0x1ee837){return db[_0xeabc('0x2c')][_0xeabc('0x4b')]()[_0xeabc('0x25')](respondWithResult(_0x1ee837,null))[_0xeabc('0x44')](handleError(_0x1ee837,null));};exports[_0xeabc('0x4c')]=function(_0x48a13f,_0x180a14,_0x2537ab){var _0x4072cb=require(_0xeabc('0x4d'));var _0x555d6b=![];var _0x1cef45={};if(_0x48a13f[_0xeabc('0x32')][_0xeabc('0x2e')]&&_0x48a13f[_0xeabc('0x32')]['type']===_0xeabc('0x4e')){_0x1cef45[_0xeabc('0x4e')]=_0x48a13f[_0xeabc('0x4a')]['id'];}else{_0x1cef45['id']=_0x48a13f[_0xeabc('0x4a')]['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':_0x1cef45,'attributes':['id',_0xeabc('0x49')],'raw':!![]})[_0xeabc('0x25')](handleEntityNotFound(_0x180a14,null))[_0xeabc('0x25')](function(_0x58ab08){if(_0x58ab08){var _0x4546c4=path['join'](config['root'],'server/files/screen_recordings',_0x58ab08[_0xeabc('0x49')]);var _0x8d4cca=util[_0xeabc('0x31')](_0xeabc('0x4f'),_0x4546c4);if(fs[_0xeabc('0x50')](_0x8d4cca)){_0x555d6b=!![];return _0x4072cb[_0xeabc('0x51')](_0x8d4cca,_0x4546c4,config['secrets'][_0xeabc('0x52')])[_0xeabc('0x25')](function(){return _0x58ab08;});}return _0x58ab08;}})[_0xeabc('0x25')](function(_0x104c1e){if(_0x104c1e){var _0x2ddc53=path[_0xeabc('0x53')](config[_0xeabc('0x54')],_0xeabc('0x55'),_0x104c1e['value']);if(!fs['existsSync'](_0x2ddc53)){throw new db[(_0xeabc('0x56'))][(_0xeabc('0x57'))](_0xeabc('0x58'));}if(_0x104c1e['filename']){return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,_0x104c1e['filename']+path['extname'](_0x2ddc53),function(){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}else{return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,function(_0x13f04f){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}}})[_0xeabc('0x44')](function(_0xc2ef0c){if(_0xc2ef0c['message']===_0xeabc('0x58')){_0x180a14[_0xeabc('0x1a')](0x194)[_0xeabc('0x29')](_0xeabc('0x5a'));}else{return handleError(_0x180a14,null);}});};exports[_0xeabc('0x5b')]=function(_0x514787,_0x5c61b4){return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':{'id':_0x514787[_0xeabc('0x4a')]['id']}})[_0xeabc('0x25')](function(_0x1b61a8){if(_[_0xeabc('0x5c')](_0x1b61a8)){throw new ReferenceError(_0xeabc('0x5d'));}return _0x1b61a8;})[_0xeabc('0x25')](function(_0x3f829b){var _0x54d2b3=path[_0xeabc('0x53')](config['root'],_0xeabc('0x55'),_0x3f829b[_0xeabc('0x49')]);logger[_0xeabc('0x5e')](_0xeabc('0x5f'),_0x54d2b3);if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger[_0xeabc('0x5e')](_0xeabc('0x60')+_0x54d2b3+_0xeabc('0x61'));fs['unlinkSync'](_0x54d2b3);}_0x54d2b3=_0x54d2b3+_0xeabc('0x62');if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger['info'](_0xeabc('0x60')+_0x54d2b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x54d2b3);}return _0x3f829b;})[_0xeabc('0x25')](function(_0x11bc62){if(!_0x11bc62)throw new InternalError();return _0x11bc62[_0xeabc('0x5b')]();})[_0xeabc('0x25')](function(){_0x5c61b4['status'](0xcc)['end']();})[_0xeabc('0x44')](handleError(_0x5c61b4,null));}; \ No newline at end of file +var _0xdc97=['join','root','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','ScreenRecording','includeAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid'];(function(_0x534634,_0x34eb7d){var _0x1ecbc0=function(_0x238efa){while(--_0x238efa){_0x534634['push'](_0x534634['shift']());}};_0x1ecbc0(++_0x34eb7d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x19d85b,_0x3daa57){_0x19d85b=_0x19d85b-0x0;var _0x28e6d4=_0xdc97[_0x19d85b];return _0x28e6d4;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['ScreenRecording']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['differenceBy'](_[_0x7dc9('0x27')](_0x14083d,_0x7dc9('0x24')),[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x450124[_0x7dc9('0x29')]);_0x1fcf0e['filters']=_['intersection'](_0x1fcf0e['model'],_0x1fcf0e[_0x7dc9('0x29')]);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e[_0x7dc9('0x2c')],qs[_0x7dc9('0x2d')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x229f8e[_0x7dc9('0x2e')]=_0x229f8e[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x229f8e['attributes']:_0x1fcf0e[_0x7dc9('0x2c')];if(!_0x450124['query'][_0x7dc9('0x30')](_0x7dc9('0x31'))){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124['query'][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query']['offset']);}_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x33')]);_0x229f8e['where']=qs[_0x7dc9('0x34')](_[_0x7dc9('0x35')](_0x450124[_0x7dc9('0x29')],_0x1fcf0e[_0x7dc9('0x34')]),_0x14083d);if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]){_0x229f8e[_0x7dc9('0x37')]=_[_0x7dc9('0x38')](_0x229f8e[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x452aed){if(_0x452aed[_0x7dc9('0x39')]!=='VIRTUAL'){var _0x34b5c9={};_0x34b5c9[_0x452aed[_0x7dc9('0x24')]]={'$like':'%'+_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]+'%'};return _0x34b5c9;}})});}_0x229f8e=_['merge']({},_0x229f8e,_0x450124[_0x7dc9('0x3a')]);var _0x89db0e={'where':_0x229f8e[_0x7dc9('0x37')]};return db[_0x7dc9('0x3b')][_0x7dc9('0x1b')](_0x89db0e)[_0x7dc9('0x21')](function(_0x5a1201){_0x3c4379['count']=_0x5a1201;if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x3c')]){_0x229f8e['include']=[{'all':!![]}];}return db[_0x7dc9('0x3b')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x2a91fe){_0x3c4379[_0x7dc9('0x3d')]=_0x2a91fe;return _0x3c4379;})['then'](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3e')](handleError(_0x236d42,null));};exports[_0x7dc9('0x3f')]=function(_0x1929b6,_0x95513c){var _0x28ffc0={'raw':![],'where':{'id':_0x1929b6[_0x7dc9('0x40')]['id']}},_0x23499a={};_0x23499a['model']=_[_0x7dc9('0x2a')](db['ScreenRecording']['rawAttributes']);_0x23499a[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x1929b6[_0x7dc9('0x29')]);_0x23499a[_0x7dc9('0x34')]=_[_0x7dc9('0x2b')](_0x23499a[_0x7dc9('0x2c')],_0x23499a[_0x7dc9('0x29')]);_0x28ffc0[_0x7dc9('0x2e')]=_[_0x7dc9('0x2b')](_0x23499a['model'],qs[_0x7dc9('0x2d')](_0x1929b6[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x28ffc0[_0x7dc9('0x2e')]=_0x28ffc0[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x28ffc0['attributes']:_0x23499a[_0x7dc9('0x2c')];if(_0x1929b6[_0x7dc9('0x29')]['includeAll']){_0x28ffc0[_0x7dc9('0x41')]=[{'all':!![]}];}_0x28ffc0=_[_0x7dc9('0x38')]({},_0x28ffc0,_0x1929b6[_0x7dc9('0x3a')]);return db['ScreenRecording'][_0x7dc9('0x42')](_0x28ffc0)['then'](handleEntityNotFound(_0x95513c,null))['then'](respondWithResult(_0x95513c,null))[_0x7dc9('0x3e')](handleError(_0x95513c,null));};exports[_0x7dc9('0x43')]=function(_0x36d591,_0x5e0dc5){return db['ScreenRecording'][_0x7dc9('0x43')](_0x36d591['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x5e0dc5,0xc9))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports['update']=function(_0x24ccce,_0x1d6c0a){if(_0x24ccce[_0x7dc9('0x44')]['id']){delete _0x24ccce[_0x7dc9('0x44')]['id'];}delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x45')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x46')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x47')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x48')];return db[_0x7dc9('0x3b')]['find']({'where':{'id':_0x24ccce[_0x7dc9('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d6c0a,null))['then'](saveUpdates(_0x24ccce[_0x7dc9('0x44')],null))[_0x7dc9('0x21')](respondWithResult(_0x1d6c0a,null))[_0x7dc9('0x3e')](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x49')]=function(_0x346d27,_0x510e2a){return db[_0x7dc9('0x3b')][_0x7dc9('0x49')]()[_0x7dc9('0x21')](respondWithResult(_0x510e2a,null))['catch'](handleError(_0x510e2a,null));};exports[_0x7dc9('0x4a')]=function(_0x3fc164,_0x2cf133,_0x32bc31){var _0xf41b8c=require(_0x7dc9('0x4b'));var _0x593132=![];var _0x366b8b={};if(_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]&&_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]===_0x7dc9('0x4c')){_0x366b8b[_0x7dc9('0x4c')]=_0x3fc164[_0x7dc9('0x40')]['id'];}else{_0x366b8b['id']=_0x3fc164[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':_0x366b8b,'attributes':['id',_0x7dc9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x2cf133,null))[_0x7dc9('0x21')](function(_0x39be46){if(_0x39be46){var _0x38df9a=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x39be46[_0x7dc9('0x48')]);var _0xd8d327=util[_0x7dc9('0x28')](_0x7dc9('0x4f'),_0x38df9a);if(fs[_0x7dc9('0x50')](_0xd8d327)){_0x593132=!![];return _0xf41b8c[_0x7dc9('0x51')](_0xd8d327,_0x38df9a,config['secrets']['recording'])['then'](function(){return _0x39be46;});}return _0x39be46;}})[_0x7dc9('0x21')](function(_0x3daf33){if(_0x3daf33){var _0x32a64f=path[_0x7dc9('0x4d')](config['root'],'server/files/screen_recordings',_0x3daf33[_0x7dc9('0x48')]);if(!fs[_0x7dc9('0x50')](_0x32a64f)){throw new db[(_0x7dc9('0x52'))][(_0x7dc9('0x53'))](_0x7dc9('0x54'));}if(_0x3daf33[_0x7dc9('0x55')]){return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,_0x3daf33['filename']+path[_0x7dc9('0x56')](_0x32a64f),function(){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}else{return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,function(_0x1dad95){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}}})['catch'](function(_0x175858){if(_0x175858[_0x7dc9('0x58')]===_0x7dc9('0x54')){_0x2cf133[_0x7dc9('0x16')](0x194)[_0x7dc9('0x25')](_0x7dc9('0x59'));}else{return handleError(_0x2cf133,null);}});};exports[_0x7dc9('0x5a')]=function(_0x2a02ed,_0x3463e4){return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':{'id':_0x2a02ed[_0x7dc9('0x40')]['id']}})[_0x7dc9('0x21')](function(_0x5eee27){if(_[_0x7dc9('0x5b')](_0x5eee27)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5eee27;})[_0x7dc9('0x21')](function(_0x15cf19){var _0x48ea37=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x15cf19[_0x7dc9('0x48')]);logger[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x48ea37);if(!_['isNil'](_0x15cf19['value'])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger[_0x7dc9('0x5c')](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}_0x48ea37=_0x48ea37+_0x7dc9('0x61');if(!_[_0x7dc9('0x5b')](_0x15cf19[_0x7dc9('0x48')])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger['info'](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}return _0x15cf19;})['then'](function(_0x4f80bd){if(!_0x4f80bd)throw new InternalError();return _0x4f80bd[_0x7dc9('0x5a')]();})[_0x7dc9('0x21')](function(){_0x3463e4[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();})['catch'](handleError(_0x3463e4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index aa3dfd6..c4038d3 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 _0xe8f7=['exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe8f7,0x10c));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7e8f('0x0'));var util=require(_0x7e8f('0x1'));var logger=require(_0x7e8f('0x2'))(_0x7e8f('0x3'));var moment=require(_0x7e8f('0x4'));var BPromise=require(_0x7e8f('0x5'));var rp=require(_0x7e8f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e8f('0x7'));var attributes=require('./screenRecording.attributes');module[_0x7e8f('0x8')]=function(_0x2da9d4,_0x405930){return _0x2da9d4[_0x7e8f('0x9')](_0x7e8f('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x7e8f('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f5d=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5661d4,_0x381a5a){var _0x41cc74=function(_0x55bbb9){while(--_0x55bbb9){_0x5661d4['push'](_0x5661d4['shift']());}};_0x41cc74(++_0x381a5a);}(_0x6f5d,0x161));var _0xd6f5=function(_0x462cb7,_0x4d4aeb){_0x462cb7=_0x462cb7-0x0;var _0x25cf6a=_0x6f5d[_0x462cb7];return _0x25cf6a;};'use strict';var _=require(_0xd6f5('0x0'));var util=require(_0xd6f5('0x1'));var logger=require(_0xd6f5('0x2'))(_0xd6f5('0x3'));var moment=require(_0xd6f5('0x4'));var BPromise=require(_0xd6f5('0x5'));var rp=require(_0xd6f5('0x6'));var fs=require('fs');var path=require(_0xd6f5('0x7'));var rimraf=require(_0xd6f5('0x8'));var config=require(_0xd6f5('0x9'));var attributes=require(_0xd6f5('0xa'));module[_0xd6f5('0xb')]=function(_0x34cf1b,_0x40607a){return _0x34cf1b['define'](_0xd6f5('0xc'),attributes,{'tableName':_0xd6f5('0xd'),'paranoid':![],'indexes':[{'name':_0xd6f5('0xe'),'fields':[_0xd6f5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9003b4e..c86a037 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 _0x94cc=['info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x527845,_0x5037cf){var _0x369422=function(_0xf6c93a){while(--_0xf6c93a){_0x527845['push'](_0x527845['shift']());}};_0x369422(++_0x5037cf);}(_0x94cc,0x13e));var _0xc94c=function(_0x10e35a,_0x3e857c){_0x10e35a=_0x10e35a-0x0;var _0x25245a=_0x94cc[_0x10e35a];return _0x25245a;};'use strict';var _=require(_0xc94c('0x0'));var util=require(_0xc94c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc94c('0x2'));var db=require(_0xc94c('0x3'))['db'];var utils=require(_0xc94c('0x4'));var logger=require(_0xc94c('0x5'))(_0xc94c('0x6'));var config=require(_0xc94c('0x7'));var jayson=require(_0xc94c('0x8'));var client=jayson[_0xc94c('0x9')][_0xc94c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45a3ea,_0x1316b9,_0x194dc3){return new BPromise(function(_0x31325e,_0x447654){return client['request'](_0x45a3ea,_0x194dc3)[_0xc94c('0xb')](function(_0x2595e4){logger[_0xc94c('0xc')](_0xc94c('0xd'),_0x1316b9,'request\x20sent');logger['debug'](_0xc94c('0xe'),_0x1316b9,_0xc94c('0xf'),JSON[_0xc94c('0x10')](_0x2595e4));if(_0x2595e4[_0xc94c('0x11')]){if(_0x2595e4['error'][_0xc94c('0x12')]===0x1f4){logger[_0xc94c('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x1316b9,_0x2595e4['error'][_0xc94c('0x13')]);return _0x447654(_0x2595e4['error'][_0xc94c('0x13')]);}logger[_0xc94c('0x11')](_0xc94c('0xd'),_0x1316b9,_0x2595e4[_0xc94c('0x11')][_0xc94c('0x13')]);return _0x31325e(_0x2595e4['error'][_0xc94c('0x13')]);}else{logger[_0xc94c('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x1316b9,_0xc94c('0xf'));_0x31325e(_0x2595e4[_0xc94c('0x14')][_0xc94c('0x13')]);}})[_0xc94c('0x15')](function(_0x2029a6){logger[_0xc94c('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x1316b9,_0x2029a6);_0x447654(_0x2029a6);});});} \ No newline at end of file +var _0xc83f=['debug','request\x20sent','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0x2ce991,_0x1d97fd){var _0x3451a1=function(_0x334a5d){while(--_0x334a5d){_0x2ce991['push'](_0x2ce991['shift']());}};_0x3451a1(++_0x1d97fd);}(_0xc83f,0x184));var _0xfc83=function(_0x13188a,_0x2f635f){_0x13188a=_0x13188a-0x0;var _0x2f5716=_0xc83f[_0x13188a];return _0x2f5716;};'use strict';var _=require('lodash');var util=require(_0xfc83('0x0'));var moment=require('moment');var BPromise=require(_0xfc83('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc83('0x2'));var db=require(_0xfc83('0x3'))['db'];var utils=require(_0xfc83('0x4'));var logger=require(_0xfc83('0x5'))(_0xfc83('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc83('0x7')][_0xfc83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cb2e0,_0x4c38bc,_0x385cce){return new BPromise(function(_0x13e927,_0x18f083){return client[_0xfc83('0x9')](_0x2cb2e0,_0x385cce)[_0xfc83('0xa')](function(_0x1d695d){logger[_0xfc83('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x4c38bc,'request\x20sent');logger[_0xfc83('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4c38bc,_0xfc83('0xd'),JSON[_0xfc83('0xe')](_0x1d695d));if(_0x1d695d['error']){if(_0x1d695d[_0xfc83('0xf')]['code']===0x1f4){logger[_0xfc83('0xf')](_0xfc83('0x10'),_0x4c38bc,_0x1d695d[_0xfc83('0xf')][_0xfc83('0x11')]);return _0x18f083(_0x1d695d[_0xfc83('0xf')][_0xfc83('0x11')]);}logger[_0xfc83('0xf')](_0xfc83('0x10'),_0x4c38bc,_0x1d695d[_0xfc83('0xf')][_0xfc83('0x11')]);return _0x13e927(_0x1d695d[_0xfc83('0xf')][_0xfc83('0x11')]);}else{logger[_0xfc83('0xb')](_0xfc83('0x10'),_0x4c38bc,_0xfc83('0xd'));_0x13e927(_0x1d695d[_0xfc83('0x12')]['message']);}})[_0xfc83('0x13')](function(_0x2d37b3){logger['error'](_0xfc83('0x10'),_0x4c38bc,_0x2d37b3);_0x18f083(_0x2d37b3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b60cc88..a0a108e 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 _0xad42=['/:id/gdpr','gdpr','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','addLogo','logologin','/:id/logo_login','file','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','/:id/logo','getLogo','getLogoLogin'];(function(_0x50da7a,_0x1d67f4){var _0x2eeb7d=function(_0x1eb018){while(--_0x1eb018){_0x50da7a['push'](_0x50da7a['shift']());}};_0x2eeb7d(++_0x1d67f4);}(_0xad42,0xbd));var _0x2ad4=function(_0x5e307c,_0xfd90e){_0x5e307c=_0x5e307c-0x0;var _0x171570=_0xad42[_0x5e307c];return _0x171570;};'use strict';var multer=require(_0x2ad4('0x0'));var util=require(_0x2ad4('0x1'));var path=require(_0x2ad4('0x2'));var timeout=require(_0x2ad4('0x3'));var express=require(_0x2ad4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ad4('0x5'));var config=require(_0x2ad4('0x6'));var controller=require(_0x2ad4('0x7'));router[_0x2ad4('0x8')]('/',auth[_0x2ad4('0x9')](),controller[_0x2ad4('0xa')]);router[_0x2ad4('0x8')](_0x2ad4('0xb'),controller['getDate']);router[_0x2ad4('0x8')](_0x2ad4('0xc'),controller['show']);router[_0x2ad4('0x8')](_0x2ad4('0xd'),controller[_0x2ad4('0xe')]);router[_0x2ad4('0x8')]('/:id/logo_login',controller[_0x2ad4('0xf')]);router['get'](_0x2ad4('0x10'),controller[_0x2ad4('0x11')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0x2ad4('0x8')](_0x2ad4('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x2ad4('0x13')]({'destination':function(_0x48e8a6,_0x533a60,_0x35d411){_0x35d411(null,path[_0x2ad4('0x14')](config[_0x2ad4('0x15')],_0x2ad4('0x16')));},'filename':function(_0x345398,_0x1cfd6e,_0x4e54d6){_0x4e54d6(null,util[_0x2ad4('0x17')](_0x2ad4('0x18'),'logo',path[_0x2ad4('0x19')](_0x1cfd6e[_0x2ad4('0x1a')])));}})});router[_0x2ad4('0x1b')]('/:id/logo',upload[_0x2ad4('0x1c')]('file'),controller[_0x2ad4('0x1d')]);var upload=multer({'storage':multer[_0x2ad4('0x13')]({'destination':function(_0x563e07,_0x2f820e,_0x11cfae){_0x11cfae(null,path[_0x2ad4('0x14')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3a5551,_0x13199e,_0x59617a){_0x59617a(null,util[_0x2ad4('0x17')](_0x2ad4('0x18'),_0x2ad4('0x1e'),path[_0x2ad4('0x19')](_0x13199e['originalname'])));}})});router[_0x2ad4('0x1b')](_0x2ad4('0x1f'),upload[_0x2ad4('0x1c')](_0x2ad4('0x20')),controller[_0x2ad4('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bc2c8,_0x223299,_0x8e4717){_0x8e4717(null,path[_0x2ad4('0x14')](config[_0x2ad4('0x15')],_0x2ad4('0x16')));},'filename':function(_0x4decab,_0x8d0e84,_0x5f5a25){_0x5f5a25(null,util[_0x2ad4('0x17')](_0x2ad4('0x18'),_0x2ad4('0x22'),path[_0x2ad4('0x19')](_0x8d0e84[_0x2ad4('0x1a')])));}})});router[_0x2ad4('0x1b')](_0x2ad4('0x23'),upload[_0x2ad4('0x1c')](_0x2ad4('0x20')),controller[_0x2ad4('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x551e93,_0xd87f1d,_0xfc5a60){_0xfc5a60(null,path[_0x2ad4('0x14')](config[_0x2ad4('0x15')],_0x2ad4('0x16')));},'filename':function(_0x3b4417,_0x1f0708,_0x28b4a3){_0x28b4a3(null,util[_0x2ad4('0x17')](_0x2ad4('0x18'),_0x2ad4('0x25'),path['extname'](_0x1f0708['originalname'])));}})});router[_0x2ad4('0x1b')]('/:id/favicon',upload[_0x2ad4('0x1c')](_0x2ad4('0x20')),controller[_0x2ad4('0x26')]);router[_0x2ad4('0x27')](_0x2ad4('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x2ad4('0x28')]=router; \ No newline at end of file +var _0x5b87=['/now','getDate','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','join','logologin','preferred','originalname','addFavicon','put','/:id','update','multer','util','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index'];(function(_0x4e1dd4,_0x1459e8){var _0x4191b8=function(_0x1ade15){while(--_0x1ade15){_0x4e1dd4['push'](_0x4e1dd4['shift']());}};_0x4191b8(++_0x1459e8);}(_0x5b87,0x172));var _0x75b8=function(_0x1c3b02,_0x5dca87){_0x1c3b02=_0x1c3b02-0x0;var _0x40c417=_0x5b87[_0x1c3b02];return _0x40c417;};'use strict';var multer=require(_0x75b8('0x0'));var util=require(_0x75b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75b8('0x2'));var router=express[_0x75b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x75b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75b8('0x5'));var controller=require(_0x75b8('0x6'));router[_0x75b8('0x7')]('/',auth[_0x75b8('0x8')](),controller[_0x75b8('0x9')]);router['get'](_0x75b8('0xa'),controller[_0x75b8('0xb')]);router[_0x75b8('0x7')]('/:id',controller[_0x75b8('0xc')]);router['get'](_0x75b8('0xd'),controller[_0x75b8('0xe')]);router[_0x75b8('0x7')]('/:id/logo_login',controller[_0x75b8('0xf')]);router['get'](_0x75b8('0x10'),controller['gdpr']);router['get'](_0x75b8('0x11'),controller['getPreferred']);router[_0x75b8('0x7')](_0x75b8('0x12'),controller[_0x75b8('0x13')]);var upload=multer({'storage':multer[_0x75b8('0x14')]({'destination':function(_0x4d920a,_0x34617d,_0x12138c){_0x12138c(null,path['join'](config[_0x75b8('0x15')],_0x75b8('0x16')));},'filename':function(_0x2cc46b,_0x56189f,_0x22ce5d){_0x22ce5d(null,util[_0x75b8('0x17')](_0x75b8('0x18'),_0x75b8('0x19'),path[_0x75b8('0x1a')](_0x56189f['originalname'])));}})});router[_0x75b8('0x1b')]('/:id/logo',upload[_0x75b8('0x1c')](_0x75b8('0x1d')),controller['addLogo']);var upload=multer({'storage':multer[_0x75b8('0x14')]({'destination':function(_0x17ba7f,_0x6691a3,_0x5576a6){_0x5576a6(null,path[_0x75b8('0x1e')](config[_0x75b8('0x15')],_0x75b8('0x16')));},'filename':function(_0x2d4217,_0x2b0326,_0xedc7f7){_0xedc7f7(null,util[_0x75b8('0x17')](_0x75b8('0x18'),_0x75b8('0x1f'),path['extname'](_0x2b0326['originalname'])));}})});router['post']('/:id/logo_login',upload[_0x75b8('0x1c')](_0x75b8('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x75b8('0x14')]({'destination':function(_0x56a044,_0x156835,_0x3fe8d3){_0x3fe8d3(null,path[_0x75b8('0x1e')](config['root'],_0x75b8('0x16')));},'filename':function(_0x3bb74c,_0xf5153,_0x5a7798){_0x5a7798(null,util[_0x75b8('0x17')](_0x75b8('0x18'),_0x75b8('0x20'),path[_0x75b8('0x1a')](_0xf5153[_0x75b8('0x21')])));}})});router['post']('/:id/preferred',upload[_0x75b8('0x1c')](_0x75b8('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b0434,_0x2626ce,_0x2ea3f9){_0x2ea3f9(null,path['join'](config['root'],_0x75b8('0x16')));},'filename':function(_0x588278,_0x2929fa,_0x1307ef){_0x1307ef(null,util[_0x75b8('0x17')](_0x75b8('0x18'),'favicon',path[_0x75b8('0x1a')](_0x2929fa['originalname'])));}})});router[_0x75b8('0x1b')]('/:id/favicon',upload[_0x75b8('0x1c')](_0x75b8('0x1d')),controller[_0x75b8('0x22')]);router[_0x75b8('0x23')](_0x75b8('0x24'),auth[_0x75b8('0x8')](),controller[_0x75b8('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f580383..6e50c5c 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 _0xfb64=['STRING','BOOLEAN','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb64,0x109));var _0x4fb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb64[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x4fb6('0x0')]={'min_internal':{'type':Sequelize[_0x4fb6('0x1')](0xb),'unique':_0x4fb6('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4fb6('0x1')](0xb),'unique':_0x4fb6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4fb6('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x4fb6('0x4')},'logo':{'type':Sequelize[_0x4fb6('0x5')]},'defaultLogo':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4fb6('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4fb6('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x4fb6('0x5')]},'turnpassword':{'type':Sequelize[_0x4fb6('0x5')]},'pageTitle':{'type':Sequelize[_0x4fb6('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4fb6('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4fb6('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x4fb6('0x7')},'chatTimeout':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4fb6('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4fb6('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4fb6('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4fb6('0x1')]},'sentimentRegion':{'type':Sequelize[_0x4fb6('0x5')]},'language':{'type':Sequelize[_0x4fb6('0x5')]},'bucket':{'type':Sequelize[_0x4fb6('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4fb6('0x1')](0x2)[_0x4fb6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4fb6('0x1')](0x2)[_0x4fb6('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4fb6('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x4fb6('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4fb6('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x4fb6('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x709a=['alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x311c34,_0x1f9ced){var _0x46d5a6=function(_0x4d0535){while(--_0x4d0535){_0x311c34['push'](_0x311c34['shift']());}};_0x46d5a6(++_0x1f9ced);}(_0x709a,0x98));var _0xa709=function(_0xb31333,_0xe1fce2){_0xb31333=_0xb31333-0x0;var _0x2395f9=_0x709a[_0xb31333];return _0x2395f9;};'use strict';var Sequelize=require(_0xa709('0x0'));module[_0xa709('0x1')]={'min_internal':{'type':Sequelize[_0xa709('0x2')](0xb),'unique':_0xa709('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa709('0x2')](0xb),'unique':_0xa709('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa709('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa709('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xa709('0x5')]},'defaultLogo':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa709('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa709('0x5')]},'turnaddr':{'type':Sequelize[_0xa709('0x5')]},'turnusername':{'type':Sequelize[_0xa709('0x5')]},'turnpassword':{'type':Sequelize[_0xa709('0x5')]},'pageTitle':{'type':Sequelize[_0xa709('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa709('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xa709('0x7')},'enableEmailPreview':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa709('0x5')],'defaultValue':_0xa709('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa709('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa709('0x5')]},'defaultFavicon':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa709('0x2')]},'transcribeRegion':{'type':Sequelize[_0xa709('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xa709('0x5')]},'language':{'type':Sequelize[_0xa709('0x5')]},'bucket':{'type':Sequelize[_0xa709('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xa709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa709('0x2')](0x2)[_0xa709('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa709('0x2')](0x2)[_0xa709('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xa709('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa709('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xa709('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa709('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index cce3b44..3d1a6d0 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 _0x255f=['loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','join','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','defaultFavicon','default_loginLogo.svg','gdpr','addPreferred','default_preferred.png','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','Setting','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge','options','where','includeAll','show','intersection','find','body','params','addLogo','file','filename','logo','addLogoLogin'];(function(_0x395993,_0xd55940){var _0x1272bb=function(_0x3280b3){while(--_0x3280b3){_0x395993['push'](_0x395993['shift']());}};_0x1272bb(++_0xd55940);}(_0x255f,0x185));var _0xf255=function(_0x402265,_0x137911){_0x402265=_0x402265-0x0;var _0x700cc6=_0x255f[_0x402265];return _0x700cc6;};'use strict';var emlformat=require(_0xf255('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf255('0x1'));var jsonpatch=require(_0xf255('0x2'));var rp=require(_0xf255('0x3'));var moment=require('moment');var BPromise=require(_0xf255('0x4'));var Mustache=require(_0xf255('0x5'));var util=require(_0xf255('0x6'));var path=require(_0xf255('0x7'));var sox=require(_0xf255('0x8'));var csv=require(_0xf255('0x9'));var ejs=require(_0xf255('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf255('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf255('0xc'));var deskjs=require(_0xf255('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf255('0xe'));var Papa=require(_0xf255('0xf'));var Redis=require('ioredis');var authService=require(_0xf255('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf255('0x11'));var hardwareService=require(_0xf255('0x12'));var logger=require(_0xf255('0x13'))(_0xf255('0x14'));var utils=require(_0xf255('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf255('0x16'));var db=require(_0xf255('0x17'))['db'];var jayson=require(_0xf255('0x18'));var client=jayson['client'][_0xf255('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x139e90,_0x52a804,_0x17b028,_0x266b73){return new BPromise(function(_0x233853,_0x49240a){var _0x393d1d=_0x266b73||client;return _0x393d1d[_0xf255('0x1a')](_0x139e90,_0x17b028)[_0xf255('0x1b')](function(_0x750c8a){logger[_0xf255('0x1c')](_0xf255('0x1d'),_0x52a804,'request\x20sent');logger[_0xf255('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x52a804,_0xf255('0x1f'),JSON['stringify'](_0x750c8a));if(_0x750c8a[_0xf255('0x20')]){if(_0x750c8a[_0xf255('0x20')][_0xf255('0x21')]===0x1f4){logger[_0xf255('0x20')](_0xf255('0x1d'),_0x52a804,_0x750c8a[_0xf255('0x20')][_0xf255('0x22')]);return _0x49240a(_0x750c8a[_0xf255('0x20')][_0xf255('0x22')]);}logger[_0xf255('0x20')](_0xf255('0x1d'),_0x52a804,_0x750c8a['error'][_0xf255('0x22')]);return _0x233853(_0x750c8a[_0xf255('0x20')][_0xf255('0x22')]);}else{logger[_0xf255('0x1c')](_0xf255('0x1d'),_0x52a804,_0xf255('0x1f'));_0x233853(_0x750c8a[_0xf255('0x23')]['message']);}})[_0xf255('0x24')](function(_0xe12574){logger[_0xf255('0x20')](_0xf255('0x1d'),_0x52a804,_0xe12574);_0x49240a(_0xe12574);});});}function respondWithStatusCode(_0x325ee8,_0x1b3b1a){_0x1b3b1a=_0x1b3b1a||0xcc;return function(_0x25eca0){if(_0x25eca0){return _0x325ee8['sendStatus'](_0x1b3b1a);}return _0x325ee8[_0xf255('0x25')](_0x1b3b1a)['end']();};}function respondWithResult(_0x4db833,_0x3d64c5){_0x3d64c5=_0x3d64c5||0xc8;return function(_0x3270d4){if(_0x3270d4){return _0x4db833[_0xf255('0x25')](_0x3d64c5)[_0xf255('0x26')](_0x3270d4);}};}function respondWithFilteredResult(_0x3c0c32,_0x54d391){return function(_0x1c3a8e){if(_0x1c3a8e){var _0x157397=typeof _0x54d391[_0xf255('0x27')]==='undefined'&&typeof _0x54d391[_0xf255('0x28')]===_0xf255('0x29');var _0x254951=_0x1c3a8e['count'];var _0xa1827e=_0x157397?0x0:_0x54d391[_0xf255('0x27')];var _0x3bc770=_0x157397?_0x1c3a8e[_0xf255('0x2a')]:_0x54d391[_0xf255('0x27')]+_0x54d391[_0xf255('0x28')];var _0x2a159c;if(_0x3bc770>=_0x254951){_0x3bc770=_0x254951;_0x2a159c=0xc8;}else{_0x2a159c=0xce;}_0x3c0c32[_0xf255('0x25')](_0x2a159c);return _0x3c0c32[_0xf255('0x2b')](_0xf255('0x2c'),_0xa1827e+'-'+_0x3bc770+'/'+_0x254951)['json'](_0x1c3a8e);}return null;};}function patchUpdates(_0x3dab12){return function(_0x415299){try{jsonpatch[_0xf255('0x2d')](_0x415299,_0x3dab12,!![]);}catch(_0x269d72){return BPromise[_0xf255('0x2e')](_0x269d72);}return _0x415299[_0xf255('0x2f')]();};}function saveUpdates(_0x2855a2,_0xf9e1d1){return function(_0x4b86cf){if(_0x4b86cf){return _0x4b86cf[_0xf255('0x30')](_0x2855a2)['then'](function(_0x57ce5c){return _0x57ce5c;});}return null;};}function removeEntity(_0x376ebf,_0x90d5e0){return function(_0x164312){if(_0x164312){return _0x164312[_0xf255('0x31')]()[_0xf255('0x1b')](function(){_0x376ebf[_0xf255('0x25')](0xcc)[_0xf255('0x32')]();});}};}function handleEntityNotFound(_0x4d60ef,_0x1de946){return function(_0x913367){if(!_0x913367){_0x4d60ef[_0xf255('0x33')](0x194);}return _0x913367;};}function handleError(_0x430345,_0x3d9252){_0x3d9252=_0x3d9252||0x1f4;return function(_0x2e7106){logger['error'](_0x2e7106[_0xf255('0x34')]);if(_0x2e7106[_0xf255('0x35')]){delete _0x2e7106[_0xf255('0x35')];}_0x430345[_0xf255('0x25')](_0x3d9252)[_0xf255('0x36')](_0x2e7106);};}exports['index']=function(_0x25128c,_0x2a2c76){var _0x6f9156={},_0x38c24c={},_0x12de34={'count':0x0,'rows':[]};var _0xe88ae1=_['map'](db[_0xf255('0x37')][_0xf255('0x38')],function(_0x472991){return{'name':_0x472991[_0xf255('0x39')],'type':_0x472991[_0xf255('0x3a')]['key']};});_0x38c24c[_0xf255('0x3b')]=_[_0xf255('0x3c')](_0xe88ae1,_0xf255('0x35'));_0x38c24c[_0xf255('0x3d')]=_[_0xf255('0x3e')](_0x25128c[_0xf255('0x3d')]);_0x38c24c[_0xf255('0x3f')]=_['intersection'](_0x38c24c[_0xf255('0x3b')],_0x38c24c[_0xf255('0x3d')]);_0x6f9156[_0xf255('0x40')]=_['intersection'](_0x38c24c[_0xf255('0x3b')],qs['fields'](_0x25128c[_0xf255('0x3d')][_0xf255('0x41')]));_0x6f9156[_0xf255('0x40')]=_0x6f9156[_0xf255('0x40')][_0xf255('0x42')]?_0x6f9156[_0xf255('0x40')]:_0x38c24c[_0xf255('0x3b')];if(!_0x25128c[_0xf255('0x3d')][_0xf255('0x43')](_0xf255('0x44'))){_0x6f9156[_0xf255('0x28')]=qs[_0xf255('0x28')](_0x25128c[_0xf255('0x3d')][_0xf255('0x28')]);_0x6f9156[_0xf255('0x27')]=qs[_0xf255('0x27')](_0x25128c[_0xf255('0x3d')]['offset']);}_0x6f9156[_0xf255('0x45')]=qs['sort'](_0x25128c[_0xf255('0x3d')][_0xf255('0x46')]);_0x6f9156['where']=qs[_0xf255('0x3f')](_['pick'](_0x25128c[_0xf255('0x3d')],_0x38c24c[_0xf255('0x3f')]),_0xe88ae1);if(_0x25128c['query'][_0xf255('0x47')]){_0x6f9156['where']=_['merge'](_0x6f9156['where'],{'$or':_[_0xf255('0x3c')](_0xe88ae1,function(_0x2dacdb){if(_0x2dacdb[_0xf255('0x3a')]!==_0xf255('0x48')){var _0x5a2bb9={};_0x5a2bb9[_0x2dacdb[_0xf255('0x35')]]={'$like':'%'+_0x25128c[_0xf255('0x3d')][_0xf255('0x47')]+'%'};return _0x5a2bb9;}})});}_0x6f9156=_[_0xf255('0x49')]({},_0x6f9156,_0x25128c[_0xf255('0x4a')]);var _0x5ef308={'where':_0x6f9156[_0xf255('0x4b')]};return db[_0xf255('0x37')][_0xf255('0x2a')](_0x5ef308)[_0xf255('0x1b')](function(_0x103849){_0x12de34[_0xf255('0x2a')]=_0x103849;if(_0x25128c[_0xf255('0x3d')][_0xf255('0x4c')]){_0x6f9156['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x6f9156);})[_0xf255('0x1b')](function(_0x4b27e7){_0x12de34['rows']=_0x4b27e7;return _0x12de34;})[_0xf255('0x1b')](respondWithFilteredResult(_0x2a2c76,_0x6f9156))[_0xf255('0x24')](handleError(_0x2a2c76,null));};exports[_0xf255('0x4d')]=function(_0x2843c0,_0x493e9a){var _0x5bf6e7={'raw':![],'where':{'id':_0x2843c0['params']['id']}},_0x1a893c={};_0x1a893c['model']=_[_0xf255('0x3e')](db['Setting'][_0xf255('0x38')]);_0x1a893c[_0xf255('0x3d')]=_[_0xf255('0x3e')](_0x2843c0[_0xf255('0x3d')]);_0x1a893c[_0xf255('0x3f')]=_[_0xf255('0x4e')](_0x1a893c[_0xf255('0x3b')],_0x1a893c[_0xf255('0x3d')]);_0x5bf6e7[_0xf255('0x40')]=_[_0xf255('0x4e')](_0x1a893c[_0xf255('0x3b')],qs[_0xf255('0x41')](_0x2843c0[_0xf255('0x3d')][_0xf255('0x41')]));_0x5bf6e7[_0xf255('0x40')]=_0x5bf6e7['attributes'][_0xf255('0x42')]?_0x5bf6e7[_0xf255('0x40')]:_0x1a893c[_0xf255('0x3b')];if(_0x2843c0[_0xf255('0x3d')][_0xf255('0x4c')]){_0x5bf6e7['include']=[{'all':!![]}];}_0x5bf6e7=_['merge']({},_0x5bf6e7,_0x2843c0[_0xf255('0x4a')]);return db[_0xf255('0x37')][_0xf255('0x4f')](_0x5bf6e7)[_0xf255('0x1b')](handleEntityNotFound(_0x493e9a,null))[_0xf255('0x1b')](respondWithResult(_0x493e9a,null))[_0xf255('0x24')](handleError(_0x493e9a,null));};exports[_0xf255('0x30')]=function(_0x48ee25,_0x49962e){if(_0x48ee25[_0xf255('0x50')]['id']){delete _0x48ee25[_0xf255('0x50')]['id'];}return db[_0xf255('0x37')][_0xf255('0x4f')]({'where':{'id':_0x48ee25[_0xf255('0x51')]['id']}})[_0xf255('0x1b')](handleEntityNotFound(_0x49962e,null))[_0xf255('0x1b')](saveUpdates(_0x48ee25[_0xf255('0x50')],null))[_0xf255('0x1b')](respondWithResult(_0x49962e,null))[_0xf255('0x24')](handleError(_0x49962e,null));};exports[_0xf255('0x52')]=function(_0xad9a81,_0x38db26,_0x57093d){if(_0xad9a81[_0xf255('0x53')]&&_0xad9a81[_0xf255('0x53')][_0xf255('0x54')]){_0xad9a81[_0xf255('0x50')][_0xf255('0x55')]=_0xad9a81['file'][_0xf255('0x54')];}return db[_0xf255('0x37')][_0xf255('0x4f')]({'where':{'id':_0xad9a81[_0xf255('0x51')]['id']}})['then'](handleEntityNotFound(_0x38db26,null))[_0xf255('0x1b')](saveUpdates(_0xad9a81[_0xf255('0x50')],null))[_0xf255('0x1b')](respondWithResult(_0x38db26,null))[_0xf255('0x24')](handleError(_0x38db26,null));};exports[_0xf255('0x56')]=function(_0x603ced,_0x10a468,_0x435afa){if(_0x603ced[_0xf255('0x53')]&&_0x603ced['file'][_0xf255('0x54')]){_0x603ced[_0xf255('0x50')][_0xf255('0x57')]=_0x603ced['file'][_0xf255('0x54')];}return db['Setting'][_0xf255('0x4f')]({'where':{'id':_0x603ced[_0xf255('0x51')]['id']}})[_0xf255('0x1b')](handleEntityNotFound(_0x10a468,null))[_0xf255('0x1b')](saveUpdates(_0x603ced[_0xf255('0x50')],null))[_0xf255('0x1b')](respondWithResult(_0x10a468,null))[_0xf255('0x24')](handleError(_0x10a468,null));};var utilLicense=require(_0xf255('0x16'));exports[_0xf255('0x58')]=function(_0x5b2e0b,_0x4e1821,_0x2c0f60){var _0x3fb81d=_0xf255('0x59');var _0xf2f59e={'custom':![]};return utilLicense[_0xf255('0x5a')]()[_0xf255('0x1b')](function(_0x51ffd4){if(_0x51ffd4){_0xf2f59e=_0x51ffd4;}return db[_0xf255('0x37')][_0xf255('0x4f')]({'where':{'id':_0x5b2e0b[_0xf255('0x51')]['id']},'attributes':[_0xf255('0x55'),_0xf255('0x57'),_0xf255('0x5b'),'favicon',_0xf255('0x5c'),_0xf255('0x5d'),_0xf255('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf255('0x1b')](handleEntityNotFound(_0x4e1821,null))['then'](function(_0x58bf65){if(_0x58bf65){var _0x527eab=_0x58bf65['logo']&&fs[_0xf255('0x5f')](path['join'](config[_0xf255('0x60')],_0x3fb81d,_['toLower'](_0x58bf65[_0xf255('0x55')])))?path[_0xf255('0x61')](config[_0xf255('0x60')],_0x3fb81d,_[_0xf255('0x62')](_0x58bf65['logo'])):path[_0xf255('0x61')](config[_0xf255('0x60')],_0x3fb81d,_[_0xf255('0x62')](_0xf255('0x63')));var _0x46f5a3=_0xf255('0x64')+_[_0xf255('0x65')]('logo');if(_0x58bf65[_0x46f5a3]||!_0xf2f59e[_0xf255('0x66')]){_0x527eab=path[_0xf255('0x61')](config['root'],_0x3fb81d,_[_0xf255('0x62')]('default_logo.svg'));}if(!fs[_0xf255('0x5f')](_0x527eab)){throw new db[(_0xf255('0x67'))][(_0xf255('0x68'))](_['upperFirst'](_0xf255('0x55'))+_0xf255('0x69'));}return _0x4e1821[_0xf255('0x6a')](_0x527eab);}})[_0xf255('0x24')](handleError(_0x4e1821,null));};var utilLicense=require(_0xf255('0x16'));exports[_0xf255('0x6b')]=function(_0x25f231,_0x51e8ae,_0x19441a){var _0x20803c=_0xf255('0x59');var _0x462b1a={'custom':![]};return utilLicense[_0xf255('0x5a')]()['then'](function(_0x2648ab){if(_0x2648ab){_0x462b1a=_0x2648ab;}return db['Setting'][_0xf255('0x4f')]({'where':{'id':_0x25f231[_0xf255('0x51')]['id']},'attributes':[_0xf255('0x55'),'loginLogo',_0xf255('0x5b'),_0xf255('0x6c'),_0xf255('0x5c'),_0xf255('0x5d'),_0xf255('0x5e'),_0xf255('0x6d')],'raw':!![]});})[_0xf255('0x1b')](handleEntityNotFound(_0x51e8ae,null))[_0xf255('0x1b')](function(_0x55d250){if(_0x55d250){var _0x2f1cdd=_0x55d250[_0xf255('0x57')]&&fs[_0xf255('0x5f')](path[_0xf255('0x61')](config['root'],_0x20803c,_['toLower'](_0x55d250['loginLogo'])))?path[_0xf255('0x61')](config['root'],_0x20803c,_['toLower'](_0x55d250[_0xf255('0x57')])):path['join'](config['root'],_0x20803c,_[_0xf255('0x62')]('default_loginLogo.svg'));var _0x2b013f=_0xf255('0x64')+_[_0xf255('0x65')](_0xf255('0x57'));if(_0x55d250[_0x2b013f]||!_0x462b1a['custom']){_0x2f1cdd=path['join'](config['root'],_0x20803c,_['toLower'](_0xf255('0x6e')));}if(!fs[_0xf255('0x5f')](_0x2f1cdd)){throw new db[(_0xf255('0x67'))][(_0xf255('0x68'))](_[_0xf255('0x65')]('loginLogo')+'\x20not\x20found');}return _0x51e8ae[_0xf255('0x6a')](_0x2f1cdd);}})['catch'](handleError(_0x51e8ae,null));};exports[_0xf255('0x6f')]=function(_0x54fe2d,_0x12881d){return db['Setting'][_0xf255('0x4f')]({'where':{'id':_0x54fe2d['params']['id']},'attributes':['securePassword']})[_0xf255('0x1b')](respondWithResult(_0x12881d,null))[_0xf255('0x24')](handleError(_0x12881d,null));};exports[_0xf255('0x70')]=function(_0x36c5d9,_0x18c63d,_0x2bd1f9){if(_0x36c5d9[_0xf255('0x53')]&&_0x36c5d9[_0xf255('0x53')][_0xf255('0x54')]){_0x36c5d9[_0xf255('0x50')][_0xf255('0x5b')]=_0x36c5d9[_0xf255('0x53')][_0xf255('0x54')];}return db[_0xf255('0x37')][_0xf255('0x4f')]({'where':{'id':_0x36c5d9['params']['id']}})[_0xf255('0x1b')](handleEntityNotFound(_0x18c63d,null))[_0xf255('0x1b')](saveUpdates(_0x36c5d9[_0xf255('0x50')],null))[_0xf255('0x1b')](respondWithResult(_0x18c63d,null))[_0xf255('0x24')](handleError(_0x18c63d,null));};var utilLicense=require(_0xf255('0x16'));exports['getPreferred']=function(_0x549c04,_0x351610,_0xfcb0a4){var _0x3b8ba4=_0xf255('0x59');var _0x5e3797={'custom':![]};return utilLicense[_0xf255('0x5a')]()[_0xf255('0x1b')](function(_0x5651ae){if(_0x5651ae){_0x5e3797=_0x5651ae;}return db['Setting'][_0xf255('0x4f')]({'where':{'id':_0x549c04[_0xf255('0x51')]['id']},'attributes':['logo',_0xf255('0x57'),_0xf255('0x5b'),_0xf255('0x6c'),_0xf255('0x5c'),_0xf255('0x5d'),_0xf255('0x5e'),_0xf255('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x351610,null))[_0xf255('0x1b')](function(_0xdf8742){if(_0xdf8742){var _0x19202b=_0xdf8742[_0xf255('0x5b')]&&fs[_0xf255('0x5f')](path[_0xf255('0x61')](config[_0xf255('0x60')],_0x3b8ba4,_['toLower'](_0xdf8742[_0xf255('0x5b')])))?path[_0xf255('0x61')](config['root'],_0x3b8ba4,_['toLower'](_0xdf8742[_0xf255('0x5b')])):path[_0xf255('0x61')](config['root'],_0x3b8ba4,_[_0xf255('0x62')](_0xf255('0x71')));var _0x11c7be=_0xf255('0x64')+_['upperFirst'](_0xf255('0x5b'));if(_0xdf8742[_0x11c7be]||!_0x5e3797[_0xf255('0x66')]||!_0x5e3797[_0xf255('0x5b')]){_0x19202b=path[_0xf255('0x61')](config[_0xf255('0x60')],_0x3b8ba4,_[_0xf255('0x62')]('default_preferred.png'));}if(!fs[_0xf255('0x5f')](_0x19202b)){throw new db[(_0xf255('0x67'))][(_0xf255('0x68'))](_[_0xf255('0x65')](_0xf255('0x5b'))+_0xf255('0x69'));}return _0x351610[_0xf255('0x6a')](_0x19202b);}})[_0xf255('0x24')](handleError(_0x351610,null));};exports['addFavicon']=function(_0x5bce16,_0x4950a0,_0x27a097){if(_0x5bce16[_0xf255('0x53')]&&_0x5bce16[_0xf255('0x53')][_0xf255('0x54')]){_0x5bce16['body'][_0xf255('0x6c')]=_0x5bce16[_0xf255('0x53')][_0xf255('0x54')];}return db['Setting'][_0xf255('0x4f')]({'where':{'id':_0x5bce16['params']['id']}})['then'](handleEntityNotFound(_0x4950a0,null))['then'](saveUpdates(_0x5bce16[_0xf255('0x50')],null))[_0xf255('0x1b')](respondWithResult(_0x4950a0,null))[_0xf255('0x24')](handleError(_0x4950a0,null));};var utilLicense=require(_0xf255('0x16'));exports['getFavicon']=function(_0x1d2223,_0x43ae8c,_0x3da867){var _0x1d0873='server/files/images/logos';var _0x598507={'custom':![]};return utilLicense[_0xf255('0x5a')]()['then'](function(_0x3661d8){if(_0x3661d8){_0x598507=_0x3661d8;}return db[_0xf255('0x37')][_0xf255('0x4f')]({'where':{'id':_0x1d2223['params']['id']},'attributes':[_0xf255('0x55'),_0xf255('0x57'),_0xf255('0x5b'),_0xf255('0x6c'),_0xf255('0x5c'),'defaultLoginLogo','defaultPreferred',_0xf255('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x43ae8c,null))[_0xf255('0x1b')](function(_0x2ece78){if(_0x2ece78){var _0x51af77=_0x2ece78['favicon']&&fs[_0xf255('0x5f')](path[_0xf255('0x61')](config['root'],_0x1d0873,_[_0xf255('0x62')](_0x2ece78[_0xf255('0x6c')])))?path[_0xf255('0x61')](config['root'],_0x1d0873,_[_0xf255('0x62')](_0x2ece78['favicon'])):path[_0xf255('0x61')](config[_0xf255('0x60')],_0x1d0873,_[_0xf255('0x62')]('default_favicon.ico'));var _0x17b78d=_0xf255('0x64')+_[_0xf255('0x65')]('favicon');if(_0x2ece78[_0x17b78d]||!_0x598507[_0xf255('0x66')]){_0x51af77=path[_0xf255('0x61')](config['root'],_0x1d0873,_[_0xf255('0x62')](_0xf255('0x72')));}if(!fs[_0xf255('0x5f')](_0x51af77)){throw new db[(_0xf255('0x67'))][(_0xf255('0x68'))](_[_0xf255('0x65')](_0xf255('0x6c'))+_0xf255('0x69'));}return _0x43ae8c[_0xf255('0x6a')](_0x51af77);}})[_0xf255('0x24')](handleError(_0x43ae8c,null));};exports['getDate']=function(_0x2e6bb3,_0x2a0b58){var _0x190ba6={'offset':moment()[_0xf255('0x73')]()};_0x190ba6[_0xf255('0x74')]=moment()[_0xf255('0x73')](_0x190ba6['offset'])[_0xf255('0x75')](_0xf255('0x76'));return _0x2a0b58['status'](0xc8)[_0xf255('0x36')](_0x190ba6);}; \ No newline at end of file +var _0x3b43=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','Setting','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','keys','includeAll','options','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','preferred','default_loginLogo.svg','download','gdpr','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x3b43,0x71));var _0x33b4=function(_0x7fa430,_0x445b3c){_0x7fa430=_0x7fa430-0x0;var _0xc9059f=_0x3b43[_0x7fa430];return _0xc9059f;};'use strict';var emlformat=require(_0x33b4('0x0'));var rimraf=require(_0x33b4('0x1'));var zipdir=require(_0x33b4('0x2'));var jsonpatch=require(_0x33b4('0x3'));var rp=require(_0x33b4('0x4'));var moment=require(_0x33b4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x33b4('0x6'));var util=require(_0x33b4('0x7'));var path=require('path');var sox=require(_0x33b4('0x8'));var csv=require('to-csv');var ejs=require(_0x33b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33b4('0xa'));var squel=require(_0x33b4('0xb'));var crypto=require(_0x33b4('0xc'));var jsforce=require(_0x33b4('0xd'));var deskjs=require(_0x33b4('0xe'));var toCsv=require(_0x33b4('0xf'));var querystring=require(_0x33b4('0x10'));var Papa=require(_0x33b4('0x11'));var Redis=require('ioredis');var authService=require(_0x33b4('0x12'));var qs=require(_0x33b4('0x13'));var as=require(_0x33b4('0x14'));var hardwareService=require(_0x33b4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x33b4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x33b4('0x17'))['db'];var jayson=require(_0x33b4('0x18'));var client=jayson[_0x33b4('0x19')][_0x33b4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1fa2c4,_0x4a5624,_0x4ab433,_0x861491){return new BPromise(function(_0x36d4b1,_0x518b43){var _0x3f621b=_0x861491||client;return _0x3f621b[_0x33b4('0x1b')](_0x1fa2c4,_0x4ab433)[_0x33b4('0x1c')](function(_0x4e39b6){logger[_0x33b4('0x1d')]('Setting,\x20%s,\x20%s',_0x4a5624,'request\x20sent');logger[_0x33b4('0x1e')](_0x33b4('0x1f'),_0x4a5624,'request\x20sent',JSON[_0x33b4('0x20')](_0x4e39b6));if(_0x4e39b6['error']){if(_0x4e39b6[_0x33b4('0x21')][_0x33b4('0x22')]===0x1f4){logger[_0x33b4('0x21')](_0x33b4('0x23'),_0x4a5624,_0x4e39b6[_0x33b4('0x21')][_0x33b4('0x24')]);return _0x518b43(_0x4e39b6[_0x33b4('0x21')][_0x33b4('0x24')]);}logger[_0x33b4('0x21')](_0x33b4('0x23'),_0x4a5624,_0x4e39b6[_0x33b4('0x21')]['message']);return _0x36d4b1(_0x4e39b6[_0x33b4('0x21')][_0x33b4('0x24')]);}else{logger[_0x33b4('0x1d')]('Setting,\x20%s,\x20%s',_0x4a5624,_0x33b4('0x25'));_0x36d4b1(_0x4e39b6[_0x33b4('0x26')][_0x33b4('0x24')]);}})['catch'](function(_0x22c2d2){logger['error'](_0x33b4('0x23'),_0x4a5624,_0x22c2d2);_0x518b43(_0x22c2d2);});});}function respondWithStatusCode(_0x2fd708,_0x447790){_0x447790=_0x447790||0xcc;return function(_0x229211){if(_0x229211){return _0x2fd708['sendStatus'](_0x447790);}return _0x2fd708[_0x33b4('0x27')](_0x447790)[_0x33b4('0x28')]();};}function respondWithResult(_0x8e5019,_0x55320c){_0x55320c=_0x55320c||0xc8;return function(_0x459af2){if(_0x459af2){return _0x8e5019[_0x33b4('0x27')](_0x55320c)[_0x33b4('0x29')](_0x459af2);}};}function respondWithFilteredResult(_0x24aabd,_0x13830a){return function(_0x33bff0){if(_0x33bff0){var _0x6ef29a=typeof _0x13830a[_0x33b4('0x2a')]===_0x33b4('0x2b')&&typeof _0x13830a['limit']===_0x33b4('0x2b');var _0x47213b=_0x33bff0[_0x33b4('0x2c')];var _0x58f649=_0x6ef29a?0x0:_0x13830a['offset'];var _0x4d752b=_0x6ef29a?_0x33bff0[_0x33b4('0x2c')]:_0x13830a[_0x33b4('0x2a')]+_0x13830a[_0x33b4('0x2d')];var _0x560437;if(_0x4d752b>=_0x47213b){_0x4d752b=_0x47213b;_0x560437=0xc8;}else{_0x560437=0xce;}_0x24aabd['status'](_0x560437);return _0x24aabd[_0x33b4('0x2e')](_0x33b4('0x2f'),_0x58f649+'-'+_0x4d752b+'/'+_0x47213b)[_0x33b4('0x29')](_0x33bff0);}return null;};}function patchUpdates(_0x149a4b){return function(_0x34ce1a){try{jsonpatch[_0x33b4('0x30')](_0x34ce1a,_0x149a4b,!![]);}catch(_0x4fef87){return BPromise[_0x33b4('0x31')](_0x4fef87);}return _0x34ce1a['save']();};}function saveUpdates(_0x110e56,_0x59979a){return function(_0x4b0423){if(_0x4b0423){return _0x4b0423[_0x33b4('0x32')](_0x110e56)[_0x33b4('0x1c')](function(_0x2abcb2){return _0x2abcb2;});}return null;};}function removeEntity(_0x81146e,_0x490fe1){return function(_0x3c83a9){if(_0x3c83a9){return _0x3c83a9[_0x33b4('0x33')]()[_0x33b4('0x1c')](function(){_0x81146e[_0x33b4('0x27')](0xcc)[_0x33b4('0x28')]();});}};}function handleEntityNotFound(_0x3899b4,_0x42daf7){return function(_0x2d46d8){if(!_0x2d46d8){_0x3899b4[_0x33b4('0x34')](0x194);}return _0x2d46d8;};}function handleError(_0x23360c,_0x2951aa){_0x2951aa=_0x2951aa||0x1f4;return function(_0x3ab150){logger[_0x33b4('0x21')](_0x3ab150[_0x33b4('0x35')]);if(_0x3ab150['name']){delete _0x3ab150[_0x33b4('0x36')];}_0x23360c['status'](_0x2951aa)[_0x33b4('0x37')](_0x3ab150);};}exports[_0x33b4('0x38')]=function(_0x136c78,_0x5c76b7){var _0x2df59e={},_0x1e7f58={},_0x1abacd={'count':0x0,'rows':[]};var _0x12b67a=_[_0x33b4('0x39')](db[_0x33b4('0x3a')]['rawAttributes'],function(_0x1962f5){return{'name':_0x1962f5[_0x33b4('0x3b')],'type':_0x1962f5[_0x33b4('0x3c')][_0x33b4('0x3d')]};});_0x1e7f58[_0x33b4('0x3e')]=_[_0x33b4('0x39')](_0x12b67a,_0x33b4('0x36'));_0x1e7f58['query']=_['keys'](_0x136c78[_0x33b4('0x3f')]);_0x1e7f58[_0x33b4('0x40')]=_['intersection'](_0x1e7f58[_0x33b4('0x3e')],_0x1e7f58[_0x33b4('0x3f')]);_0x2df59e[_0x33b4('0x41')]=_[_0x33b4('0x42')](_0x1e7f58[_0x33b4('0x3e')],qs[_0x33b4('0x43')](_0x136c78[_0x33b4('0x3f')]['fields']));_0x2df59e[_0x33b4('0x41')]=_0x2df59e[_0x33b4('0x41')][_0x33b4('0x44')]?_0x2df59e[_0x33b4('0x41')]:_0x1e7f58[_0x33b4('0x3e')];if(!_0x136c78['query'][_0x33b4('0x45')](_0x33b4('0x46'))){_0x2df59e['limit']=qs[_0x33b4('0x2d')](_0x136c78[_0x33b4('0x3f')][_0x33b4('0x2d')]);_0x2df59e[_0x33b4('0x2a')]=qs[_0x33b4('0x2a')](_0x136c78[_0x33b4('0x3f')][_0x33b4('0x2a')]);}_0x2df59e[_0x33b4('0x47')]=qs['sort'](_0x136c78[_0x33b4('0x3f')][_0x33b4('0x48')]);_0x2df59e[_0x33b4('0x49')]=qs['filters'](_[_0x33b4('0x4a')](_0x136c78[_0x33b4('0x3f')],_0x1e7f58[_0x33b4('0x40')]),_0x12b67a);if(_0x136c78['query'][_0x33b4('0x4b')]){_0x2df59e['where']=_[_0x33b4('0x4c')](_0x2df59e[_0x33b4('0x49')],{'$or':_['map'](_0x12b67a,function(_0x67c147){if(_0x67c147[_0x33b4('0x3c')]!=='VIRTUAL'){var _0x555cf8={};_0x555cf8[_0x67c147[_0x33b4('0x36')]]={'$like':'%'+_0x136c78['query'][_0x33b4('0x4b')]+'%'};return _0x555cf8;}})});}_0x2df59e=_[_0x33b4('0x4c')]({},_0x2df59e,_0x136c78['options']);var _0x335674={'where':_0x2df59e[_0x33b4('0x49')]};return db['Setting'][_0x33b4('0x2c')](_0x335674)[_0x33b4('0x1c')](function(_0x4c8163){_0x1abacd[_0x33b4('0x2c')]=_0x4c8163;if(_0x136c78[_0x33b4('0x3f')]['includeAll']){_0x2df59e[_0x33b4('0x4d')]=[{'all':!![]}];}return db['Setting'][_0x33b4('0x4e')](_0x2df59e);})[_0x33b4('0x1c')](function(_0x25f9cf){_0x1abacd[_0x33b4('0x4f')]=_0x25f9cf;return _0x1abacd;})[_0x33b4('0x1c')](respondWithFilteredResult(_0x5c76b7,_0x2df59e))[_0x33b4('0x50')](handleError(_0x5c76b7,null));};exports['show']=function(_0x5e4be9,_0x48dadb){var _0x2c68f7={'raw':![],'where':{'id':_0x5e4be9[_0x33b4('0x51')]['id']}},_0x1c1a49={};_0x1c1a49[_0x33b4('0x3e')]=_[_0x33b4('0x52')](db['Setting']['rawAttributes']);_0x1c1a49[_0x33b4('0x3f')]=_['keys'](_0x5e4be9['query']);_0x1c1a49[_0x33b4('0x40')]=_['intersection'](_0x1c1a49[_0x33b4('0x3e')],_0x1c1a49[_0x33b4('0x3f')]);_0x2c68f7['attributes']=_[_0x33b4('0x42')](_0x1c1a49['model'],qs[_0x33b4('0x43')](_0x5e4be9[_0x33b4('0x3f')]['fields']));_0x2c68f7['attributes']=_0x2c68f7['attributes'][_0x33b4('0x44')]?_0x2c68f7['attributes']:_0x1c1a49['model'];if(_0x5e4be9[_0x33b4('0x3f')][_0x33b4('0x53')]){_0x2c68f7[_0x33b4('0x4d')]=[{'all':!![]}];}_0x2c68f7=_[_0x33b4('0x4c')]({},_0x2c68f7,_0x5e4be9[_0x33b4('0x54')]);return db[_0x33b4('0x3a')]['find'](_0x2c68f7)[_0x33b4('0x1c')](handleEntityNotFound(_0x48dadb,null))['then'](respondWithResult(_0x48dadb,null))[_0x33b4('0x50')](handleError(_0x48dadb,null));};exports[_0x33b4('0x32')]=function(_0x55fbc4,_0x2f3e7f){if(_0x55fbc4[_0x33b4('0x55')]['id']){delete _0x55fbc4[_0x33b4('0x55')]['id'];}return db[_0x33b4('0x3a')][_0x33b4('0x56')]({'where':{'id':_0x55fbc4[_0x33b4('0x51')]['id']}})['then'](handleEntityNotFound(_0x2f3e7f,null))['then'](saveUpdates(_0x55fbc4['body'],null))[_0x33b4('0x1c')](respondWithResult(_0x2f3e7f,null))[_0x33b4('0x50')](handleError(_0x2f3e7f,null));};exports[_0x33b4('0x57')]=function(_0x5da430,_0x3cf643,_0xd5604){if(_0x5da430[_0x33b4('0x58')]&&_0x5da430[_0x33b4('0x58')][_0x33b4('0x59')]){_0x5da430[_0x33b4('0x55')][_0x33b4('0x5a')]=_0x5da430[_0x33b4('0x58')][_0x33b4('0x59')];}return db[_0x33b4('0x3a')]['find']({'where':{'id':_0x5da430[_0x33b4('0x51')]['id']}})[_0x33b4('0x1c')](handleEntityNotFound(_0x3cf643,null))[_0x33b4('0x1c')](saveUpdates(_0x5da430[_0x33b4('0x55')],null))[_0x33b4('0x1c')](respondWithResult(_0x3cf643,null))['catch'](handleError(_0x3cf643,null));};exports[_0x33b4('0x5b')]=function(_0x50c661,_0x60146f,_0x18e53d){if(_0x50c661['file']&&_0x50c661['file'][_0x33b4('0x59')]){_0x50c661[_0x33b4('0x55')][_0x33b4('0x5c')]=_0x50c661['file'][_0x33b4('0x59')];}return db[_0x33b4('0x3a')][_0x33b4('0x56')]({'where':{'id':_0x50c661['params']['id']}})[_0x33b4('0x1c')](handleEntityNotFound(_0x60146f,null))[_0x33b4('0x1c')](saveUpdates(_0x50c661[_0x33b4('0x55')],null))['then'](respondWithResult(_0x60146f,null))[_0x33b4('0x50')](handleError(_0x60146f,null));};var utilLicense=require(_0x33b4('0x5d'));exports[_0x33b4('0x5e')]=function(_0x55fd6a,_0x3e6d31,_0x324013){var _0x68ea0c=_0x33b4('0x5f');var _0x187c60={'custom':![]};return utilLicense[_0x33b4('0x60')]()[_0x33b4('0x1c')](function(_0x269c74){if(_0x269c74){_0x187c60=_0x269c74;}return db['Setting'][_0x33b4('0x56')]({'where':{'id':_0x55fd6a[_0x33b4('0x51')]['id']},'attributes':['logo','loginLogo','preferred',_0x33b4('0x61'),_0x33b4('0x62'),_0x33b4('0x63'),_0x33b4('0x64'),_0x33b4('0x65')],'raw':!![]});})[_0x33b4('0x1c')](handleEntityNotFound(_0x3e6d31,null))[_0x33b4('0x1c')](function(_0x89107a){if(_0x89107a){var _0x5c2823=_0x89107a[_0x33b4('0x5a')]&&fs[_0x33b4('0x66')](path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x68ea0c,_[_0x33b4('0x69')](_0x89107a[_0x33b4('0x5a')])))?path[_0x33b4('0x67')](config['root'],_0x68ea0c,_['toLower'](_0x89107a[_0x33b4('0x5a')])):path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x68ea0c,_[_0x33b4('0x69')](_0x33b4('0x6a')));var _0x597c7e=_0x33b4('0x6b')+_['upperFirst']('logo');if(_0x89107a[_0x597c7e]||!_0x187c60[_0x33b4('0x6c')]){_0x5c2823=path[_0x33b4('0x67')](config['root'],_0x68ea0c,_['toLower'](_0x33b4('0x6a')));}if(!fs[_0x33b4('0x66')](_0x5c2823)){throw new db[(_0x33b4('0x6d'))][(_0x33b4('0x6e'))](_[_0x33b4('0x6f')](_0x33b4('0x5a'))+_0x33b4('0x70'));}return _0x3e6d31['download'](_0x5c2823);}})[_0x33b4('0x50')](handleError(_0x3e6d31,null));};var utilLicense=require('../../config/license/util');exports[_0x33b4('0x71')]=function(_0x18cda0,_0x1c9a78,_0x49c307){var _0x31090e=_0x33b4('0x5f');var _0xa46eef={'custom':![]};return utilLicense[_0x33b4('0x60')]()[_0x33b4('0x1c')](function(_0x2f964e){if(_0x2f964e){_0xa46eef=_0x2f964e;}return db[_0x33b4('0x3a')][_0x33b4('0x56')]({'where':{'id':_0x18cda0[_0x33b4('0x51')]['id']},'attributes':[_0x33b4('0x5a'),_0x33b4('0x5c'),_0x33b4('0x72'),_0x33b4('0x61'),_0x33b4('0x62'),_0x33b4('0x63'),_0x33b4('0x64'),_0x33b4('0x65')],'raw':!![]});})[_0x33b4('0x1c')](handleEntityNotFound(_0x1c9a78,null))[_0x33b4('0x1c')](function(_0x1c33f0){if(_0x1c33f0){var _0xd1c25b=_0x1c33f0[_0x33b4('0x5c')]&&fs[_0x33b4('0x66')](path['join'](config[_0x33b4('0x68')],_0x31090e,_[_0x33b4('0x69')](_0x1c33f0[_0x33b4('0x5c')])))?path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x31090e,_[_0x33b4('0x69')](_0x1c33f0[_0x33b4('0x5c')])):path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x31090e,_[_0x33b4('0x69')](_0x33b4('0x73')));var _0x4d9fdc=_0x33b4('0x6b')+_['upperFirst'](_0x33b4('0x5c'));if(_0x1c33f0[_0x4d9fdc]||!_0xa46eef['custom']){_0xd1c25b=path[_0x33b4('0x67')](config['root'],_0x31090e,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x33b4('0x66')](_0xd1c25b)){throw new db[(_0x33b4('0x6d'))][(_0x33b4('0x6e'))](_[_0x33b4('0x6f')](_0x33b4('0x5c'))+_0x33b4('0x70'));}return _0x1c9a78[_0x33b4('0x74')](_0xd1c25b);}})[_0x33b4('0x50')](handleError(_0x1c9a78,null));};exports[_0x33b4('0x75')]=function(_0x4b7428,_0x3bb038){return db[_0x33b4('0x3a')]['find']({'where':{'id':_0x4b7428['params']['id']},'attributes':['securePassword']})[_0x33b4('0x1c')](respondWithResult(_0x3bb038,null))[_0x33b4('0x50')](handleError(_0x3bb038,null));};exports[_0x33b4('0x76')]=function(_0x55de28,_0x58f877,_0x32c6fd){if(_0x55de28[_0x33b4('0x58')]&&_0x55de28['file'][_0x33b4('0x59')]){_0x55de28[_0x33b4('0x55')]['preferred']=_0x55de28[_0x33b4('0x58')][_0x33b4('0x59')];}return db[_0x33b4('0x3a')]['find']({'where':{'id':_0x55de28[_0x33b4('0x51')]['id']}})[_0x33b4('0x1c')](handleEntityNotFound(_0x58f877,null))[_0x33b4('0x1c')](saveUpdates(_0x55de28[_0x33b4('0x55')],null))['then'](respondWithResult(_0x58f877,null))[_0x33b4('0x50')](handleError(_0x58f877,null));};var utilLicense=require(_0x33b4('0x5d'));exports['getPreferred']=function(_0x1dc5fe,_0x53a9f4,_0x25ebe4){var _0x185787=_0x33b4('0x5f');var _0x43ce0e={'custom':![]};return utilLicense[_0x33b4('0x60')]()[_0x33b4('0x1c')](function(_0x4f7e80){if(_0x4f7e80){_0x43ce0e=_0x4f7e80;}return db[_0x33b4('0x3a')][_0x33b4('0x56')]({'where':{'id':_0x1dc5fe[_0x33b4('0x51')]['id']},'attributes':[_0x33b4('0x5a'),_0x33b4('0x5c'),_0x33b4('0x72'),_0x33b4('0x61'),_0x33b4('0x62'),_0x33b4('0x63'),_0x33b4('0x64'),'defaultFavicon'],'raw':!![]});})[_0x33b4('0x1c')](handleEntityNotFound(_0x53a9f4,null))[_0x33b4('0x1c')](function(_0x27a51a){if(_0x27a51a){var _0x31c0bb=_0x27a51a[_0x33b4('0x72')]&&fs[_0x33b4('0x66')](path['join'](config[_0x33b4('0x68')],_0x185787,_[_0x33b4('0x69')](_0x27a51a['preferred'])))?path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x185787,_[_0x33b4('0x69')](_0x27a51a['preferred'])):path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x185787,_[_0x33b4('0x69')]('default_preferred.png'));var _0x2d9ded='default'+_[_0x33b4('0x6f')](_0x33b4('0x72'));if(_0x27a51a[_0x2d9ded]||!_0x43ce0e[_0x33b4('0x6c')]||!_0x43ce0e['preferred']){_0x31c0bb=path['join'](config[_0x33b4('0x68')],_0x185787,_[_0x33b4('0x69')](_0x33b4('0x77')));}if(!fs[_0x33b4('0x66')](_0x31c0bb)){throw new db[(_0x33b4('0x6d'))]['ValidationError'](_[_0x33b4('0x6f')](_0x33b4('0x72'))+_0x33b4('0x70'));}return _0x53a9f4[_0x33b4('0x74')](_0x31c0bb);}})[_0x33b4('0x50')](handleError(_0x53a9f4,null));};exports[_0x33b4('0x78')]=function(_0x3632a6,_0x25ce0d,_0x1f3496){if(_0x3632a6['file']&&_0x3632a6[_0x33b4('0x58')][_0x33b4('0x59')]){_0x3632a6[_0x33b4('0x55')][_0x33b4('0x61')]=_0x3632a6[_0x33b4('0x58')]['filename'];}return db[_0x33b4('0x3a')][_0x33b4('0x56')]({'where':{'id':_0x3632a6[_0x33b4('0x51')]['id']}})['then'](handleEntityNotFound(_0x25ce0d,null))[_0x33b4('0x1c')](saveUpdates(_0x3632a6[_0x33b4('0x55')],null))[_0x33b4('0x1c')](respondWithResult(_0x25ce0d,null))[_0x33b4('0x50')](handleError(_0x25ce0d,null));};var utilLicense=require(_0x33b4('0x5d'));exports[_0x33b4('0x79')]=function(_0x26cd89,_0x2f92a3,_0x146fa1){var _0x54f81e=_0x33b4('0x5f');var _0x76c99f={'custom':![]};return utilLicense[_0x33b4('0x60')]()[_0x33b4('0x1c')](function(_0x28650b){if(_0x28650b){_0x76c99f=_0x28650b;}return db['Setting'][_0x33b4('0x56')]({'where':{'id':_0x26cd89['params']['id']},'attributes':['logo',_0x33b4('0x5c'),_0x33b4('0x72'),'favicon',_0x33b4('0x62'),_0x33b4('0x63'),_0x33b4('0x64'),_0x33b4('0x65')],'raw':!![]});})[_0x33b4('0x1c')](handleEntityNotFound(_0x2f92a3,null))[_0x33b4('0x1c')](function(_0x2e5a7a){if(_0x2e5a7a){var _0x4dd3c1=_0x2e5a7a[_0x33b4('0x61')]&&fs[_0x33b4('0x66')](path['join'](config[_0x33b4('0x68')],_0x54f81e,_[_0x33b4('0x69')](_0x2e5a7a[_0x33b4('0x61')])))?path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x54f81e,_[_0x33b4('0x69')](_0x2e5a7a[_0x33b4('0x61')])):path[_0x33b4('0x67')](config[_0x33b4('0x68')],_0x54f81e,_['toLower'](_0x33b4('0x7a')));var _0x2867ad=_0x33b4('0x6b')+_[_0x33b4('0x6f')](_0x33b4('0x61'));if(_0x2e5a7a[_0x2867ad]||!_0x76c99f[_0x33b4('0x6c')]){_0x4dd3c1=path[_0x33b4('0x67')](config['root'],_0x54f81e,_['toLower'](_0x33b4('0x7a')));}if(!fs[_0x33b4('0x66')](_0x4dd3c1)){throw new db[(_0x33b4('0x6d'))][(_0x33b4('0x6e'))](_[_0x33b4('0x6f')](_0x33b4('0x61'))+'\x20not\x20found');}return _0x2f92a3[_0x33b4('0x74')](_0x4dd3c1);}})['catch'](handleError(_0x2f92a3,null));};exports[_0x33b4('0x7b')]=function(_0x264188,_0x59fea9){var _0xf0bb80={'offset':moment()[_0x33b4('0x7c')]()};_0xf0bb80[_0x33b4('0x7d')]=moment()[_0x33b4('0x7c')](_0xf0bb80[_0x33b4('0x2a')])['format'](_0x33b4('0x7e'));return _0x59fea9[_0x33b4('0x27')](0xc8)[_0x33b4('0x37')](_0xf0bb80);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c879697..7c6fbb8 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(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x008c,0x188));var _0xc008=function(_0x3cb9eb,_0x3fd4b9){_0x3cb9eb=_0x3cb9eb-0x0;var _0x4d5970=_0x008c[_0x3cb9eb];return _0x4d5970;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5c0529f..082f2a9 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 _0xd687=['options','raw','attributes','include','model','map','ShowSetting','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Setting','find'];(function(_0x3cf2ad,_0x1437a9){var _0x25d66f=function(_0x4f16d1){while(--_0x4f16d1){_0x3cf2ad['push'](_0x3cf2ad['shift']());}};_0x25d66f(++_0x1437a9);}(_0xd687,0xbb));var _0x7d68=function(_0x315de3,_0x47fb12){_0x315de3=_0x315de3-0x0;var _0x1d1889=_0xd687[_0x315de3];return _0x1d1889;};'use strict';var _=require(_0x7d68('0x0'));var util=require(_0x7d68('0x1'));var moment=require(_0x7d68('0x2'));var BPromise=require(_0x7d68('0x3'));var rs=require(_0x7d68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d68('0x5'));var logger=require(_0x7d68('0x6'))('rpc');var config=require(_0x7d68('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7d68('0x8')][_0x7d68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fb5be,_0x469a5a,_0x3573b5){return new BPromise(function(_0x54b992,_0x9fb0ec){return client['request'](_0x2fb5be,_0x3573b5)[_0x7d68('0xa')](function(_0x3fbd1d){logger[_0x7d68('0xb')](_0x7d68('0xc'),_0x469a5a,_0x7d68('0xd'));logger[_0x7d68('0xe')](_0x7d68('0xf'),_0x469a5a,'request\x20sent',JSON[_0x7d68('0x10')](_0x3fbd1d));if(_0x3fbd1d[_0x7d68('0x11')]){if(_0x3fbd1d[_0x7d68('0x11')]['code']===0x1f4){logger[_0x7d68('0x11')](_0x7d68('0xc'),_0x469a5a,_0x3fbd1d[_0x7d68('0x11')][_0x7d68('0x12')]);return _0x9fb0ec(_0x3fbd1d[_0x7d68('0x11')][_0x7d68('0x12')]);}logger[_0x7d68('0x11')](_0x7d68('0xc'),_0x469a5a,_0x3fbd1d['error'][_0x7d68('0x12')]);return _0x54b992(_0x3fbd1d['error'][_0x7d68('0x12')]);}else{logger['info'](_0x7d68('0xc'),_0x469a5a,'request\x20sent');_0x54b992(_0x3fbd1d[_0x7d68('0x13')]['message']);}})[_0x7d68('0x14')](function(_0x2a4aa4){logger[_0x7d68('0x11')](_0x7d68('0xc'),_0x469a5a,_0x2a4aa4);_0x9fb0ec(_0x2a4aa4);});});}exports['ShowSetting']=function(_0x217be6){var _0x31d7bc=this;return new Promise(function(_0x161a44,_0x462426){return db[_0x7d68('0x15')][_0x7d68('0x16')]({'raw':_0x217be6[_0x7d68('0x17')]?_0x217be6['options'][_0x7d68('0x18')]===undefined?!![]:![]:!![],'where':_0x217be6[_0x7d68('0x17')]?_0x217be6[_0x7d68('0x17')]['where']||null:null,'attributes':_0x217be6['options']?_0x217be6[_0x7d68('0x17')][_0x7d68('0x19')]||null:null,'include':_0x217be6[_0x7d68('0x17')]?_0x217be6[_0x7d68('0x17')]['include']?_['map'](_0x217be6['options'][_0x7d68('0x1a')],function(_0x5b65d0){return{'model':db[_0x5b65d0[_0x7d68('0x1b')]],'as':_0x5b65d0['as'],'attributes':_0x5b65d0[_0x7d68('0x19')],'include':_0x5b65d0[_0x7d68('0x1a')]?_[_0x7d68('0x1c')](_0x5b65d0[_0x7d68('0x1a')],function(_0xd6d4aa){return{'model':db[_0xd6d4aa[_0x7d68('0x1b')]],'as':_0xd6d4aa['as'],'attributes':_0xd6d4aa[_0x7d68('0x19')],'include':_0xd6d4aa['include']?_[_0x7d68('0x1c')](_0xd6d4aa[_0x7d68('0x1a')],function(_0x5e1813){return{'model':db[_0x5e1813['model']],'as':_0x5e1813['as'],'attributes':_0x5e1813[_0x7d68('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7d68('0xa')](function(_0x41eb1b){logger[_0x7d68('0xb')](_0x7d68('0x1d'),_0x217be6);logger[_0x7d68('0xe')](_0x7d68('0x1d'),_0x217be6,JSON[_0x7d68('0x10')](_0x41eb1b));_0x161a44(_0x41eb1b);})[_0x7d68('0x14')](function(_0x39c0da){logger[_0x7d68('0x11')](_0x7d68('0x1d'),_0x39c0da[_0x7d68('0x12')],_0x217be6);_0x462426(_0x31d7bc['error'](0x1f4,_0x39c0da[_0x7d68('0x12')]));});});}; \ No newline at end of file +var _0x797e=['ShowSetting','Setting','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x58f869,_0x4a10e6){var _0x3a0c99=function(_0x5ec8e4){while(--_0x5ec8e4){_0x58f869['push'](_0x58f869['shift']());}};_0x3a0c99(++_0x4a10e6);}(_0x797e,0x164));var _0xe797=function(_0x5205f1,_0x2dc66d){_0x5205f1=_0x5205f1-0x0;var _0x116975=_0x797e[_0x5205f1];return _0x116975;};'use strict';var _=require(_0xe797('0x0'));var util=require(_0xe797('0x1'));var moment=require(_0xe797('0x2'));var BPromise=require(_0xe797('0x3'));var rs=require(_0xe797('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe797('0x5'))['db'];var utils=require(_0xe797('0x6'));var logger=require(_0xe797('0x7'))(_0xe797('0x8'));var config=require(_0xe797('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe797('0xa')][_0xe797('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e19cf,_0x202f03,_0x247a5b){return new BPromise(function(_0x453fce,_0x33d1e0){return client['request'](_0x5e19cf,_0x247a5b)[_0xe797('0xc')](function(_0x543b0c){logger[_0xe797('0xd')](_0xe797('0xe'),_0x202f03,_0xe797('0xf'));logger[_0xe797('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x202f03,_0xe797('0xf'),JSON[_0xe797('0x11')](_0x543b0c));if(_0x543b0c['error']){if(_0x543b0c[_0xe797('0x12')][_0xe797('0x13')]===0x1f4){logger[_0xe797('0x12')](_0xe797('0xe'),_0x202f03,_0x543b0c[_0xe797('0x12')]['message']);return _0x33d1e0(_0x543b0c[_0xe797('0x12')]['message']);}logger['error'](_0xe797('0xe'),_0x202f03,_0x543b0c['error'][_0xe797('0x14')]);return _0x453fce(_0x543b0c[_0xe797('0x12')]['message']);}else{logger['info'](_0xe797('0xe'),_0x202f03,'request\x20sent');_0x453fce(_0x543b0c['result'][_0xe797('0x14')]);}})['catch'](function(_0x240d69){logger[_0xe797('0x12')](_0xe797('0xe'),_0x202f03,_0x240d69);_0x33d1e0(_0x240d69);});});}exports[_0xe797('0x15')]=function(_0x2dc2d2){var _0x463398=this;return new Promise(function(_0x1f8d79,_0x2cfb44){return db[_0xe797('0x16')]['find']({'raw':_0x2dc2d2[_0xe797('0x17')]?_0x2dc2d2[_0xe797('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc2d2[_0xe797('0x17')]?_0x2dc2d2[_0xe797('0x17')][_0xe797('0x18')]||null:null,'attributes':_0x2dc2d2[_0xe797('0x17')]?_0x2dc2d2['options'][_0xe797('0x19')]||null:null,'include':_0x2dc2d2[_0xe797('0x17')]?_0x2dc2d2[_0xe797('0x17')][_0xe797('0x1a')]?_[_0xe797('0x1b')](_0x2dc2d2[_0xe797('0x17')][_0xe797('0x1a')],function(_0x432601){return{'model':db[_0x432601['model']],'as':_0x432601['as'],'attributes':_0x432601['attributes'],'include':_0x432601[_0xe797('0x1a')]?_['map'](_0x432601[_0xe797('0x1a')],function(_0x7e8c62){return{'model':db[_0x7e8c62[_0xe797('0x1c')]],'as':_0x7e8c62['as'],'attributes':_0x7e8c62[_0xe797('0x19')],'include':_0x7e8c62[_0xe797('0x1a')]?_[_0xe797('0x1b')](_0x7e8c62[_0xe797('0x1a')],function(_0x1acf0e){return{'model':db[_0x1acf0e[_0xe797('0x1c')]],'as':_0x1acf0e['as'],'attributes':_0x1acf0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe797('0xc')](function(_0x4cd32b){logger[_0xe797('0xd')](_0xe797('0x15'),_0x2dc2d2);logger[_0xe797('0x10')]('ShowSetting',_0x2dc2d2,JSON[_0xe797('0x11')](_0x4cd32b));_0x1f8d79(_0x4cd32b);})['catch'](function(_0x17ad57){logger[_0xe797('0x12')](_0xe797('0x15'),_0x17ad57[_0xe797('0x14')],_0x2dc2d2);_0x2cfb44(_0x463398['error'](0x1f4,_0x17ad57['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c5949bb..15c2594 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(_0x839ecb,_0x1044d2){var _0x3d7e87=function(_0x28e00a){while(--_0x28e00a){_0x839ecb['push'](_0x839ecb['shift']());}};_0x3d7e87(++_0x1044d2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x24534c,_0x4e91c4){var _0x5e5802=function(_0x55da9c){while(--_0x55da9c){_0x24534c['push'](_0x24534c['shift']());}};_0x5e5802(++_0x4e91c4);}(_0x7a54,0x106));var _0x47a5=function(_0x337d94,_0x2a983b){_0x337d94=_0x337d94-0x0;var _0x4ad4db=_0x7a54[_0x337d94];return _0x4ad4db;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f4d968b..a02140a 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 _0x2c64=['twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x2db588,_0x4b5828){var _0xf72e3d=function(_0xb750bf){while(--_0xb750bf){_0x2db588['push'](_0x2db588['shift']());}};_0xf72e3d(++_0x4b5828);}(_0x2c64,0x1d9));var _0x42c6=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x2c64[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0x42c6('0x0'));var rs=require(_0x42c6('0x1'));module[_0x42c6('0x2')]={'name':{'type':Sequelize[_0x42c6('0x3')],'unique':_0x42c6('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x42c6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x42c6('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x42c6('0x5')]();}},'phone':{'type':Sequelize[_0x42c6('0x3')]},'type':{'type':Sequelize[_0x42c6('0x6')](_0x42c6('0x7'),_0x42c6('0x8'),_0x42c6('0x9'),_0x42c6('0xa'),_0x42c6('0xb'),'clickatell',_0x42c6('0xc'),_0x42c6('0xd'),_0x42c6('0xe'),_0x42c6('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x42c6('0x3')]},'authToken':{'type':Sequelize[_0x42c6('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x42c6('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x42c6('0x3')]},'applicationId':{'type':Sequelize[_0x42c6('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x42c6('0x3')]},'deliveryReport':{'type':Sequelize[_0x42c6('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0x42c6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x42c6('0x11')],'defaultValue':function(){return _0x42c6('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x42c6('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x42c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x42c6('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x42c6('0x13')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x42c6('0x10')],'defaultValue':![],'comment':_0x42c6('0x14'),'set':function(_0x1c2573){if(!_0x1c2573)this['setDataValue'](_0x42c6('0x15'),null);this[_0x42c6('0x16')](_0x42c6('0x17'),_0x1c2573);}}}; \ No newline at end of file +var _0x19cb=['randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x158a71,_0x49172e){var _0xbe5783=function(_0x10e861){while(--_0x10e861){_0x158a71['push'](_0x158a71['shift']());}};_0xbe5783(++_0x49172e);}(_0x19cb,0x176));var _0xb19c=function(_0x74cd9d,_0x1bfff2){_0x74cd9d=_0x74cd9d-0x0;var _0x3dc011=_0x19cb[_0x74cd9d];return _0x3dc011;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb19c('0x0'));module[_0xb19c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb19c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xb19c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb19c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb19c('0x3')],'defaultValue':function(){return rs[_0xb19c('0x4')]();}},'phone':{'type':Sequelize[_0xb19c('0x3')]},'type':{'type':Sequelize[_0xb19c('0x5')](_0xb19c('0x6'),_0xb19c('0x7'),_0xb19c('0x8'),'clicksend',_0xb19c('0x9'),'clickatell',_0xb19c('0xa'),_0xb19c('0xb'),_0xb19c('0xc'),_0xb19c('0xd'))},'accountSid':{'type':Sequelize[_0xb19c('0x3')]},'authId':{'type':Sequelize[_0xb19c('0x3')]},'authToken':{'type':Sequelize[_0xb19c('0x3')]},'smsMethod':{'type':Sequelize[_0xb19c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb19c('0x3')]},'password':{'type':Sequelize[_0xb19c('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xb19c('0x3')]},'accountId':{'type':Sequelize[_0xb19c('0x3')]},'senderString':{'type':Sequelize[_0xb19c('0x3')]},'deliveryReport':{'type':Sequelize[_0xb19c('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xb19c('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb19c('0xf')],'defaultValue':function(){return _0xb19c('0x10');}},'notificationSound':{'type':Sequelize[_0xb19c('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb19c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb19c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb19c('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb19c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb19c('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb19c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb19c('0x11')],'comment':_0xb19c('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xb19c('0xe')],'defaultValue':![],'comment':_0xb19c('0x13'),'set':function(_0x207785){if(!_0x207785)this[_0xb19c('0x14')](_0xb19c('0x15'),null);this[_0xb19c('0x14')]('mandatoryDisposition',_0x207785);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b58cedb..df84893 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 _0x8ef7=['SmsAccount,\x20%s,\x20%s,\x20%s','debug','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','stack','finally','getInteractions','Owner','internal','Tag','Tags','color','tag','List','ListId','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','intelepeer','DELIVRD','state','message-id','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','name','send','index','Pause','map','SmsAccount','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','difference','createdAt','updatedAt','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','User','unshift','agent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start'];(function(_0x12e84f,_0x114cba){var _0x2f7a5c=function(_0xcfca0){while(--_0xcfca0){_0x12e84f['push'](_0x12e84f['shift']());}};_0x2f7a5c(++_0x114cba);}(_0x8ef7,0x116));var _0x78ef=function(_0x1b2b03,_0x2502dd){_0x1b2b03=_0x1b2b03-0x0;var _0x46ec87=_0x8ef7[_0x1b2b03];return _0x46ec87;};'use strict';var emlformat=require(_0x78ef('0x0'));var rimraf=require(_0x78ef('0x1'));var zipdir=require(_0x78ef('0x2'));var jsonpatch=require(_0x78ef('0x3'));var rp=require(_0x78ef('0x4'));var moment=require(_0x78ef('0x5'));var BPromise=require(_0x78ef('0x6'));var Mustache=require(_0x78ef('0x7'));var util=require(_0x78ef('0x8'));var path=require(_0x78ef('0x9'));var sox=require('sox');var csv=require(_0x78ef('0xa'));var ejs=require(_0x78ef('0xb'));var fs=require('fs');var fs_extra=require(_0x78ef('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x78ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x78ef('0xe'));var toCsv=require(_0x78ef('0xa'));var querystring=require(_0x78ef('0xf'));var Papa=require('papaparse');var Redis=require(_0x78ef('0x10'));var authService=require(_0x78ef('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78ef('0x12'));var logger=require(_0x78ef('0x13'))(_0x78ef('0x14'));var utils=require(_0x78ef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x78ef('0x16'));var db=require('../../mysqldb')['db'];config[_0x78ef('0x17')]=_[_0x78ef('0x18')](config[_0x78ef('0x17')],{'host':_0x78ef('0x19'),'port':0x18eb});var socket=require(_0x78ef('0x1a'))(new Redis(config[_0x78ef('0x17')]));require('./smsAccount.socket')[_0x78ef('0x1b')](socket);var jayson=require(_0x78ef('0x1c'));var client=jayson[_0x78ef('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x10a4c6,_0x5436f4,_0x5b3a5f,_0x5e4210){return new BPromise(function(_0x4d81c8,_0x9d83a1){var _0x2678fa=_0x5e4210||client;return _0x2678fa[_0x78ef('0x1e')](_0x10a4c6,_0x5b3a5f)[_0x78ef('0x1f')](function(_0x20c6f1){logger[_0x78ef('0x20')](_0x78ef('0x21'),_0x5436f4,_0x78ef('0x22'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5436f4,'request\x20sent',JSON['stringify'](_0x20c6f1));if(_0x20c6f1[_0x78ef('0x23')]){if(_0x20c6f1[_0x78ef('0x23')][_0x78ef('0x24')]===0x1f4){logger[_0x78ef('0x23')](_0x78ef('0x21'),_0x5436f4,_0x20c6f1[_0x78ef('0x23')][_0x78ef('0x25')]);return _0x9d83a1(_0x20c6f1['error'][_0x78ef('0x25')]);}logger[_0x78ef('0x23')](_0x78ef('0x21'),_0x5436f4,_0x20c6f1[_0x78ef('0x23')][_0x78ef('0x25')]);return _0x4d81c8(_0x20c6f1[_0x78ef('0x23')]['message']);}else{logger[_0x78ef('0x20')]('SmsAccount,\x20%s,\x20%s',_0x5436f4,'request\x20sent');_0x4d81c8(_0x20c6f1['result'][_0x78ef('0x25')]);}})[_0x78ef('0x26')](function(_0x3dded6){logger[_0x78ef('0x23')](_0x78ef('0x21'),_0x5436f4,_0x3dded6);_0x9d83a1(_0x3dded6);});});}function respondWithStatusCode(_0x14b9e3,_0x14795b){_0x14795b=_0x14795b||0xcc;return function(_0x39a5f2){if(_0x39a5f2){return _0x14b9e3[_0x78ef('0x27')](_0x14795b);}return _0x14b9e3['status'](_0x14795b)['end']();};}function respondWithResult(_0x5c7cc1,_0x4a6457){_0x4a6457=_0x4a6457||0xc8;return function(_0x4f5220){if(_0x4f5220){return _0x5c7cc1[_0x78ef('0x28')](_0x4a6457)['json'](_0x4f5220);}};}function respondWithFilteredResult(_0x86a386,_0x43e78a){return function(_0x2a7509){if(_0x2a7509){var _0x2bb5c4=typeof _0x43e78a[_0x78ef('0x29')]===_0x78ef('0x2a')&&typeof _0x43e78a[_0x78ef('0x2b')]===_0x78ef('0x2a');var _0x25f2ed=_0x2a7509['count'];var _0x368eb6=_0x2bb5c4?0x0:_0x43e78a[_0x78ef('0x29')];var _0x368ce3=_0x2bb5c4?_0x2a7509[_0x78ef('0x2c')]:_0x43e78a[_0x78ef('0x29')]+_0x43e78a[_0x78ef('0x2b')];var _0x42e7b3;if(_0x368ce3>=_0x25f2ed){_0x368ce3=_0x25f2ed;_0x42e7b3=0xc8;}else{_0x42e7b3=0xce;}_0x86a386[_0x78ef('0x28')](_0x42e7b3);return _0x86a386[_0x78ef('0x2d')]('Content-Range',_0x368eb6+'-'+_0x368ce3+'/'+_0x25f2ed)[_0x78ef('0x2e')](_0x2a7509);}return null;};}function patchUpdates(_0x476c09){return function(_0xb6e265){try{jsonpatch['apply'](_0xb6e265,_0x476c09,!![]);}catch(_0x2f7e4c){return BPromise[_0x78ef('0x2f')](_0x2f7e4c);}return _0xb6e265[_0x78ef('0x30')]();};}function saveUpdates(_0x51f866,_0x2956ad){return function(_0x19d69b){if(_0x19d69b){return _0x19d69b[_0x78ef('0x31')](_0x51f866)['then'](function(_0x444b7e){return _0x444b7e;});}return null;};}function removeEntity(_0x402b6a,_0x24c44d){return function(_0x59f220){if(_0x59f220){return _0x59f220[_0x78ef('0x32')]()[_0x78ef('0x1f')](function(){var _0x50b625=_0x59f220[_0x78ef('0x33')]({'plain':!![]});var _0x1ecd5f=_0x78ef('0x34');return db[_0x78ef('0x35')][_0x78ef('0x32')]({'where':{'type':_0x1ecd5f,'resourceId':_0x50b625['id']}})['then'](function(){return _0x59f220;});})['then'](function(){_0x402b6a[_0x78ef('0x28')](0xcc)[_0x78ef('0x36')]();});}};}function handleEntityNotFound(_0x40f7d6,_0x3e7efa){return function(_0x1f3458){if(!_0x1f3458){_0x40f7d6['sendStatus'](0x194);}return _0x1f3458;};}function handleError(_0x3dd9e1,_0xcb1b52){_0xcb1b52=_0xcb1b52||0x1f4;return function(_0x1a9a3e){logger['error'](_0x1a9a3e['stack']);if(_0x1a9a3e[_0x78ef('0x37')]){delete _0x1a9a3e[_0x78ef('0x37')];}_0x3dd9e1[_0x78ef('0x28')](_0xcb1b52)[_0x78ef('0x38')](_0x1a9a3e);};}exports[_0x78ef('0x39')]=function(_0x1eca43,_0x3f8f6f){var _0x42d680={'include':[{'model':db[_0x78ef('0x3a')],'as':'mandatoryDispositionPause'}]},_0x322d3f={},_0x109eec={'count':0x0,'rows':[]};var _0x478c44=_[_0x78ef('0x3b')](db[_0x78ef('0x3c')][_0x78ef('0x3d')],function(_0x52799f){return{'name':_0x52799f['fieldName'],'type':_0x52799f[_0x78ef('0x3e')]['key']};});_0x322d3f[_0x78ef('0x3f')]=_[_0x78ef('0x3b')](_0x478c44,_0x78ef('0x37'));_0x322d3f[_0x78ef('0x40')]=_['keys'](_0x1eca43[_0x78ef('0x40')]);_0x322d3f['filters']=_[_0x78ef('0x41')](_0x322d3f[_0x78ef('0x3f')],_0x322d3f[_0x78ef('0x40')]);_0x42d680[_0x78ef('0x42')]=_[_0x78ef('0x41')](_0x322d3f[_0x78ef('0x3f')],qs[_0x78ef('0x43')](_0x1eca43[_0x78ef('0x40')]['fields']));_0x42d680[_0x78ef('0x42')]=_0x42d680[_0x78ef('0x42')][_0x78ef('0x44')]?_0x42d680[_0x78ef('0x42')]:_0x322d3f[_0x78ef('0x3f')];if(!_0x1eca43[_0x78ef('0x40')][_0x78ef('0x45')](_0x78ef('0x46'))){_0x42d680[_0x78ef('0x2b')]=qs[_0x78ef('0x2b')](_0x1eca43['query']['limit']);_0x42d680[_0x78ef('0x29')]=qs[_0x78ef('0x29')](_0x1eca43[_0x78ef('0x40')][_0x78ef('0x29')]);}_0x42d680[_0x78ef('0x47')]=qs[_0x78ef('0x48')](_0x1eca43[_0x78ef('0x40')][_0x78ef('0x48')]);_0x42d680['where']=qs[_0x78ef('0x49')](_[_0x78ef('0x4a')](_0x1eca43['query'],_0x322d3f['filters']),_0x478c44);if(_0x1eca43[_0x78ef('0x40')][_0x78ef('0x4b')]){_0x42d680[_0x78ef('0x4c')]=_[_0x78ef('0x4d')](_0x42d680[_0x78ef('0x4c')],{'$or':_[_0x78ef('0x3b')](_0x478c44,function(_0x1e7f4f){if(_0x1e7f4f[_0x78ef('0x3e')]!==_0x78ef('0x4e')){var _0x47f5d4={};_0x47f5d4[_0x1e7f4f[_0x78ef('0x37')]]={'$like':'%'+_0x1eca43[_0x78ef('0x40')]['filter']+'%'};return _0x47f5d4;}})});}_0x42d680=_[_0x78ef('0x4d')]({},_0x42d680,_0x1eca43[_0x78ef('0x4f')]);var _0x151ccf={'where':_0x42d680[_0x78ef('0x4c')]};return db[_0x78ef('0x3c')]['count'](_0x151ccf)[_0x78ef('0x1f')](function(_0x350c1e){_0x109eec[_0x78ef('0x2c')]=_0x350c1e;if(_0x1eca43[_0x78ef('0x40')][_0x78ef('0x50')]){_0x42d680[_0x78ef('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0x78ef('0x52')](_0x42d680);})[_0x78ef('0x1f')](function(_0x5601dd){_0x109eec[_0x78ef('0x53')]=_0x5601dd;return _0x109eec;})['then'](respondWithFilteredResult(_0x3f8f6f,_0x42d680))['catch'](handleError(_0x3f8f6f,null));};exports[_0x78ef('0x54')]=function(_0x13abea,_0x323cad){var _0x6df535={'raw':![],'where':{'id':_0x13abea[_0x78ef('0x55')]['id']},'include':[{'model':db[_0x78ef('0x3a')],'as':_0x78ef('0x56')}]},_0x45e3bb={};_0x45e3bb[_0x78ef('0x3f')]=_[_0x78ef('0x57')](db['SmsAccount'][_0x78ef('0x3d')]);_0x45e3bb[_0x78ef('0x40')]=_[_0x78ef('0x57')](_0x13abea[_0x78ef('0x40')]);_0x45e3bb[_0x78ef('0x49')]=_[_0x78ef('0x41')](_0x45e3bb[_0x78ef('0x3f')],_0x45e3bb[_0x78ef('0x40')]);_0x6df535[_0x78ef('0x42')]=_['intersection'](_0x45e3bb[_0x78ef('0x3f')],qs[_0x78ef('0x43')](_0x13abea['query']['fields']));_0x6df535[_0x78ef('0x42')]=_0x6df535['attributes'][_0x78ef('0x44')]?_0x6df535['attributes']:_0x45e3bb[_0x78ef('0x3f')];if(_0x13abea[_0x78ef('0x40')][_0x78ef('0x50')]){_0x6df535[_0x78ef('0x51')]=[{'all':!![]}];}_0x6df535=_[_0x78ef('0x4d')]({},_0x6df535,_0x13abea[_0x78ef('0x4f')]);return db[_0x78ef('0x3c')][_0x78ef('0x58')](_0x6df535)[_0x78ef('0x1f')](handleEntityNotFound(_0x323cad,null))[_0x78ef('0x1f')](respondWithResult(_0x323cad,null))[_0x78ef('0x26')](handleError(_0x323cad,null));};exports[_0x78ef('0x59')]=function(_0x3e6bcf,_0x404f66){return db[_0x78ef('0x3c')][_0x78ef('0x59')](_0x3e6bcf[_0x78ef('0x5a')],{})[_0x78ef('0x1f')](function(_0x39049e){var _0x2adac1=_0x3e6bcf[_0x78ef('0x5b')][_0x78ef('0x33')]({'plain':!![]});if(!_0x2adac1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adac1[_0x78ef('0x5c')]===_0x78ef('0x5b')){var _0x543c1a=_0x39049e[_0x78ef('0x33')]({'plain':!![]});var _0x211e72=_0x78ef('0x34');return db[_0x78ef('0x5d')]['find']({'where':{'name':_0x211e72,'userProfileId':_0x2adac1[_0x78ef('0x5e')]},'raw':!![]})[_0x78ef('0x1f')](function(_0x1a25b6){if(_0x1a25b6&&_0x1a25b6[_0x78ef('0x5f')]===0x0){return db[_0x78ef('0x35')][_0x78ef('0x59')]({'name':_0x543c1a[_0x78ef('0x37')],'resourceId':_0x543c1a['id'],'type':_0x1a25b6[_0x78ef('0x37')],'sectionId':_0x1a25b6['id']},{})[_0x78ef('0x1f')](function(){return _0x39049e;});}else{return _0x39049e;}})[_0x78ef('0x26')](function(_0x3969a8){logger[_0x78ef('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3969a8);throw _0x3969a8;});}return _0x39049e;})['then'](respondWithResult(_0x404f66,0xc9))[_0x78ef('0x26')](handleError(_0x404f66,null));};exports[_0x78ef('0x31')]=function(_0x1483de,_0x484ac3){if(_0x1483de['body']['id']){delete _0x1483de['body']['id'];}return db[_0x78ef('0x3c')][_0x78ef('0x58')]({'where':{'id':_0x1483de[_0x78ef('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x78ef('0x56')}]})[_0x78ef('0x1f')](handleEntityNotFound(_0x484ac3,null))['then'](saveUpdates(_0x1483de[_0x78ef('0x5a')],null))[_0x78ef('0x1f')](respondWithResult(_0x484ac3,null))['catch'](handleError(_0x484ac3,null));};exports[_0x78ef('0x32')]=function(_0xd86c0e,_0x4483ee){return db[_0x78ef('0x3c')][_0x78ef('0x58')]({'where':{'id':_0xd86c0e['params']['id']}})['then'](handleEntityNotFound(_0x4483ee,null))[_0x78ef('0x1f')](removeEntity(_0x4483ee,null))[_0x78ef('0x26')](handleError(_0x4483ee,null));};exports[_0x78ef('0x60')]=function(_0x230862,_0x255490){return db['SmsAccount'][_0x78ef('0x60')]()[_0x78ef('0x1f')](respondWithResult(_0x255490,null))[_0x78ef('0x26')](handleError(_0x255490,null));};exports[_0x78ef('0x61')]=function(_0x54d533,_0x34869c,_0x3a71b9){if(_0x54d533[_0x78ef('0x5a')]['id']){delete _0x54d533[_0x78ef('0x5a')]['id'];}return db[_0x78ef('0x3c')]['find']({'where':{'id':_0x54d533[_0x78ef('0x55')]['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x34869c,null))[_0x78ef('0x1f')](function(_0x20fe1e){if(_0x20fe1e){_0x54d533[_0x78ef('0x5a')][_0x78ef('0x62')]=_0x20fe1e['id'];return db[_0x78ef('0x63')][_0x78ef('0x59')](_0x54d533['body']);}})[_0x78ef('0x1f')](respondWithResult(_0x34869c,null))[_0x78ef('0x26')](handleError(_0x34869c,null));};exports[_0x78ef('0x64')]=function(_0x109fe6,_0xdab85,_0x4579fa){var _0x57f449={'raw':![],'where':{}};var _0x5dcd13={};var _0x37c092={'count':0x0,'rows':[]};return db[_0x78ef('0x3c')][_0x78ef('0x65')]({'where':{'id':_0x109fe6['params']['id']}})['then'](handleEntityNotFound(_0xdab85,null))[_0x78ef('0x1f')](function(_0x3a67e7){if(_0x3a67e7){_0x5dcd13[_0x78ef('0x3f')]=_[_0x78ef('0x57')](db[_0x78ef('0x63')]['rawAttributes']);_0x5dcd13['query']=_[_0x78ef('0x57')](_0x109fe6[_0x78ef('0x40')]);_0x5dcd13['filters']=_[_0x78ef('0x41')](_0x5dcd13[_0x78ef('0x3f')],_0x5dcd13['query']);_0x57f449[_0x78ef('0x42')]=_['intersection'](_0x5dcd13['model'],qs['fields'](_0x109fe6[_0x78ef('0x40')]['fields']));_0x57f449['attributes']=_0x57f449['attributes'][_0x78ef('0x44')]?_0x57f449[_0x78ef('0x42')]:_0x5dcd13[_0x78ef('0x3f')];if(!_0x109fe6[_0x78ef('0x40')][_0x78ef('0x45')](_0x78ef('0x46'))){_0x57f449['limit']=qs[_0x78ef('0x2b')](_0x109fe6['query']['limit']);_0x57f449[_0x78ef('0x29')]=qs[_0x78ef('0x29')](_0x109fe6[_0x78ef('0x40')][_0x78ef('0x29')]);}_0x57f449[_0x78ef('0x47')]=qs[_0x78ef('0x48')](_0x109fe6['query'][_0x78ef('0x48')]);_0x57f449[_0x78ef('0x4c')]=qs[_0x78ef('0x49')](_[_0x78ef('0x4a')](_0x109fe6['query'],_0x5dcd13[_0x78ef('0x49')]));_0x57f449[_0x78ef('0x4c')][_0x78ef('0x62')]=_0x3a67e7['id'];if(_0x109fe6[_0x78ef('0x40')][_0x78ef('0x4b')]){_0x57f449[_0x78ef('0x4c')]=_[_0x78ef('0x4d')](_0x57f449['where'],{'$or':_[_0x78ef('0x3b')](_0x57f449[_0x78ef('0x42')],function(_0x15aea1){var _0x19f785={};_0x19f785[_0x15aea1]={'$like':'%'+_0x109fe6[_0x78ef('0x40')]['filter']+'%'};return _0x19f785;})});}_0x57f449=_['merge']({},_0x57f449,_0x109fe6[_0x78ef('0x4f')]);return db[_0x78ef('0x63')][_0x78ef('0x2c')]({'where':_0x57f449[_0x78ef('0x4c')]})['then'](function(_0x17b94b){_0x37c092[_0x78ef('0x2c')]=_0x17b94b;if(_0x109fe6['query'][_0x78ef('0x50')]){_0x57f449[_0x78ef('0x51')]=[{'all':!![]}];}return db[_0x78ef('0x63')][_0x78ef('0x52')](_0x57f449);})[_0x78ef('0x1f')](function(_0x1267a9){_0x37c092[_0x78ef('0x53')]=_0x1267a9;return _0x37c092;});}})[_0x78ef('0x1f')](respondWithFilteredResult(_0xdab85,_0x57f449))[_0x78ef('0x26')](handleError(_0xdab85,null));};exports[_0x78ef('0x66')]=function(_0x552746,_0x127058,_0x4c3900){return db[_0x78ef('0x3c')][_0x78ef('0x58')]({'where':{'id':_0x552746[_0x78ef('0x55')]['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x127058,null))['then'](function(_0x445d78){if(_0x445d78){return _0x445d78[_0x78ef('0x66')](_0x552746['query'][_0x78ef('0x67')]);}})[_0x78ef('0x1f')](respondWithStatusCode(_0x127058,null))['catch'](handleError(_0x127058,null));};exports['addAnswer']=function(_0x1c6735,_0x3da4f6,_0x1fee1e){if(_0x1c6735['body']['id']){delete _0x1c6735['body']['id'];}return db['SmsAccount'][_0x78ef('0x58')]({'where':{'id':_0x1c6735['params']['id']}})['then'](handleEntityNotFound(_0x3da4f6,null))[_0x78ef('0x1f')](function(_0x171038){if(_0x171038){_0x1c6735[_0x78ef('0x5a')][_0x78ef('0x62')]=_0x171038['id'];return db[_0x78ef('0x68')][_0x78ef('0x59')](_0x1c6735[_0x78ef('0x5a')]);}})[_0x78ef('0x1f')](respondWithResult(_0x3da4f6,null))[_0x78ef('0x26')](handleError(_0x3da4f6,null));};exports['getAnswers']=function(_0x575d9e,_0x86596e,_0x3ebf80){var _0x57d194={'raw':![],'where':{}};var _0x6e3cbc={};var _0x545060={'count':0x0,'rows':[]};return db[_0x78ef('0x3c')][_0x78ef('0x65')]({'where':{'id':_0x575d9e[_0x78ef('0x55')]['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x86596e,null))['then'](function(_0x5dccc3){if(_0x5dccc3){_0x6e3cbc[_0x78ef('0x3f')]=_[_0x78ef('0x57')](db['CannedAnswer']['rawAttributes']);_0x6e3cbc[_0x78ef('0x40')]=_[_0x78ef('0x57')](_0x575d9e[_0x78ef('0x40')]);_0x6e3cbc[_0x78ef('0x49')]=_[_0x78ef('0x41')](_0x6e3cbc[_0x78ef('0x3f')],_0x6e3cbc[_0x78ef('0x40')]);_0x57d194[_0x78ef('0x42')]=_['intersection'](_0x6e3cbc[_0x78ef('0x3f')],qs[_0x78ef('0x43')](_0x575d9e['query'][_0x78ef('0x43')]));_0x57d194[_0x78ef('0x42')]=_0x57d194['attributes']['length']?_0x57d194['attributes']:_0x6e3cbc[_0x78ef('0x3f')];if(!_0x575d9e[_0x78ef('0x40')][_0x78ef('0x45')](_0x78ef('0x46'))){_0x57d194['limit']=qs[_0x78ef('0x2b')](_0x575d9e[_0x78ef('0x40')]['limit']);_0x57d194[_0x78ef('0x29')]=qs[_0x78ef('0x29')](_0x575d9e['query'][_0x78ef('0x29')]);}_0x57d194[_0x78ef('0x47')]=qs[_0x78ef('0x48')](_0x575d9e[_0x78ef('0x40')][_0x78ef('0x48')]);_0x57d194['where']=qs[_0x78ef('0x49')](_['pick'](_0x575d9e['query'],_0x6e3cbc[_0x78ef('0x49')]));_0x57d194['where']['SmsAccountId']=_0x5dccc3['id'];if(_0x575d9e[_0x78ef('0x40')]['filter']){_0x57d194[_0x78ef('0x4c')]=_[_0x78ef('0x4d')](_0x57d194[_0x78ef('0x4c')],{'$or':_[_0x78ef('0x3b')](_0x57d194[_0x78ef('0x42')],function(_0x18a4d4){var _0x374944={};_0x374944[_0x18a4d4]={'$like':'%'+_0x575d9e[_0x78ef('0x40')]['filter']+'%'};return _0x374944;})});}_0x57d194=_[_0x78ef('0x4d')]({},_0x57d194,_0x575d9e[_0x78ef('0x4f')]);return db[_0x78ef('0x68')]['count']({'where':_0x57d194[_0x78ef('0x4c')]})[_0x78ef('0x1f')](function(_0x4e8d41){_0x545060['count']=_0x4e8d41;if(_0x575d9e[_0x78ef('0x40')][_0x78ef('0x50')]){_0x57d194[_0x78ef('0x51')]=[{'all':!![]}];}return db[_0x78ef('0x68')][_0x78ef('0x52')](_0x57d194);})['then'](function(_0x57a0d3){_0x545060[_0x78ef('0x53')]=_0x57a0d3;return _0x545060;});}})['then'](respondWithFilteredResult(_0x86596e,_0x57d194))['catch'](handleError(_0x86596e,null));};exports[_0x78ef('0x69')]=function(_0xac5d5d,_0x3800bd,_0x145e82){return db[_0x78ef('0x3c')]['find']({'where':{'id':_0xac5d5d[_0x78ef('0x55')]['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x3800bd,null))['then'](function(_0x33ec0a){if(_0x33ec0a){return _0x33ec0a['removeAnswers'](_0xac5d5d['query']['ids']);}})[_0x78ef('0x1f')](respondWithStatusCode(_0x3800bd,null))[_0x78ef('0x26')](handleError(_0x3800bd,null));};exports[_0x78ef('0x6a')]=function(_0xaf6eb8,_0x30c013,_0x4daa5e){var _0x41934a={'channel':_0x78ef('0x6b')};var _0x441e50=[];var _0x11bdde=[];var _0x46da59={};return db['SmsAccount'][_0x78ef('0x58')]({'where':{'id':_0xaf6eb8[_0x78ef('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x78ef('0x6c')}]})[_0x78ef('0x1f')](handleEntityNotFound(_0x30c013,null))[_0x78ef('0x1f')](function(_0x1f77f2){_0x41934a[_0x78ef('0x6d')]=_0x1f77f2;_0x41934a[_0x78ef('0x6e')]=_[_0x78ef('0x6f')](_0x1f77f2['Applications'],[_0x78ef('0x70')],[_0x78ef('0x71')]);if(_0x41934a['account'][_0x78ef('0x6c')]){delete _0x41934a[_0x78ef('0x6d')]['Applications'];}return db['CmContact']['describe']();})[_0x78ef('0x1f')](function(_0x3022e9){if(!_0x3022e9){throw new db[(_0x78ef('0x72'))][(_0x78ef('0x73'))]('no\x20available\x20attributes');}_0x441e50=_[_0x78ef('0x74')](_[_0x78ef('0x57')](_0x3022e9),[_0x78ef('0x75'),_0x78ef('0x76')]);_0x11bdde=_[_0x78ef('0x74')](_[_0x78ef('0x57')](_0x3022e9),['createdAt','updatedAt','CompanyId','ListId']);_0x41934a[_0x78ef('0x5a')]={'mapKey':_0x78ef('0x77')};if(_0x41934a[_0x78ef('0x6d')][_0x78ef('0x3e')]){switch(_0x41934a[_0x78ef('0x6d')][_0x78ef('0x3e')]){case _0x78ef('0x78'):_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')]=_0xaf6eb8['body'][_0x78ef('0x7a')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')]=_0xaf6eb8['body'][_0x78ef('0x7b')];_0x41934a['body'][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')]['MessageSid'];break;case _0x78ef('0x7d'):_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')]='+'+_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x7e')];_0x41934a['body'][_0x78ef('0x5a')]=_0xaf6eb8['body'][_0x78ef('0x7f')];break;case _0x78ef('0x80'):_0x41934a[_0x78ef('0x5a')]['from']=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x79')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x25')];break;case _0x78ef('0x81'):_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x79')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x5a')];_0x41934a['body'][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')]['message_id'];break;case'plivo':_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x7a')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x82')];_0x41934a['body'][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x83')];break;case _0x78ef('0x84'):_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')]='+'+_0xaf6eb8[_0x78ef('0x5a')]['results'][0x0][_0x78ef('0x79')];_0x41934a[_0x78ef('0x5a')]['body']=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x85')][0x0][_0x78ef('0x7f')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x85')][0x0][_0x78ef('0x7c')];break;case _0x78ef('0x86'):_0x41934a['body'][_0x78ef('0x79')]=_0xaf6eb8['body'][_0x78ef('0x87')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x88')][_0x78ef('0x25')];break;case _0x78ef('0x89'):_0x41934a['body'][_0x78ef('0x79')]=_0xaf6eb8['body'][_0x78ef('0x8a')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')]=_0xaf6eb8['body'][_0x78ef('0x7f')];_0x41934a['body'][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x8b')];break;case _0x78ef('0x8c'):_0x41934a['body'][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')][0x0]['message']['id'];_0x41934a['body']['from']=_0xaf6eb8[_0x78ef('0x5a')][0x0][_0x78ef('0x25')]['from'];_0x41934a['body'][_0x78ef('0x5a')]=_0xaf6eb8[_0x78ef('0x5a')][0x0]['message']['text'];break;case'intelepeer':_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x79')];_0x41934a[_0x78ef('0x5a')]['body']=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x25')];_0x41934a[_0x78ef('0x5a')][_0x78ef('0x7c')]=_0xaf6eb8[_0x78ef('0x5a')][_0x78ef('0x8d')];break;}}if(_0x41934a[_0x78ef('0x5a')]['id']){delete _0x41934a[_0x78ef('0x5a')]['id'];}if(_[_0x78ef('0x8e')](_0x41934a[_0x78ef('0x5a')]['from'])){throw new db[(_0x78ef('0x72'))][(_0x78ef('0x73'))](_0x78ef('0x8f'));}if(_[_0x78ef('0x8e')](_0x41934a[_0x78ef('0x5a')][_0x78ef('0x5a')])||_0x41934a['body'][_0x78ef('0x5a')]===''){throw new db[(_0x78ef('0x72'))][(_0x78ef('0x73'))](_0x78ef('0x90'));}if(_['isNil'](_0x41934a['body']['mapKey'])){throw new db[(_0x78ef('0x72'))]['ValidationError'](_0x78ef('0x91')+_0x11bdde);}if(!_[_0x78ef('0x92')](_0x11bdde,_0x41934a[_0x78ef('0x5a')][_0x78ef('0x93')])){throw new db['Sequelize'][(_0x78ef('0x73'))](_0x78ef('0x94')+_0x11bdde);}_0x46da59[_0x41934a[_0x78ef('0x5a')]['mapKey']]=_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')];return db[_0x78ef('0x95')][_0x78ef('0x58')]({'where':{'id':_0x41934a['account']['ListId']},'include':[{'model':db[_0x78ef('0x96')],'as':_0x78ef('0x97'),'where':_0x46da59,'limit':0x1,'order':[[_0x78ef('0x76'),_0x78ef('0x98')]]}]});})[_0x78ef('0x1f')](handleEntityNotFound(_0x30c013,null))[_0x78ef('0x1f')](function(_0x27bb46){if(_0x27bb46){_0x41934a[_0x78ef('0x99')]=_['omit'](_0x27bb46,[_0x78ef('0x97')]);if(_0x27bb46[_0x78ef('0x97')][_0x78ef('0x44')]){return _0x27bb46[_0x78ef('0x97')][0x0];}var _0x58891c=_['defaults'](_0x41934a[_0x78ef('0x5a')],{'firstName':_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')],'ListId':_0x27bb46['id']});_0x58891c[_0x41934a[_0x78ef('0x5a')][_0x78ef('0x93')]]=_0x41934a[_0x78ef('0x5a')]['from'];return db[_0x78ef('0x96')][_0x78ef('0x59')](_0x58891c,{'fields':_0x441e50,'raw':!![]});}})[_0x78ef('0x1f')](handleEntityNotFound(_0x30c013,null))[_0x78ef('0x1f')](function(_0x3bfab7){if(_0x3bfab7){_0x41934a['contact']=_0x3bfab7;var _0x544572={'ContactId':_0x3bfab7['id'],'phone':_0x41934a[_0x78ef('0x5a')][_0x78ef('0x79')],'SmsAccountId':_0xaf6eb8[_0x78ef('0x55')]['id']};var _0x9058e1={'ContactId':_0x3bfab7['id'],'SmsAccountId':_0xaf6eb8[_0x78ef('0x55')]['id'],'closed':![]};return db[_0x78ef('0x9a')]['find']({'where':_0x9058e1})['then'](function(_0x44f735){if(_0x44f735){return[_0x44f735,![]];}return db[_0x78ef('0x9a')][_0x78ef('0x59')](_0x544572)['then'](function(_0x4bf3cd){return[_0x4bf3cd,!![]];});});}})['spread'](function(_0x2a93a6,_0x276a26){_0x41934a[_0x78ef('0x9b')]=_0x2a93a6['get']({'plain':!![]});_0x41934a['interaction'][_0x78ef('0x9c')]=![];if(_0x276a26){if(_0x41934a[_0x78ef('0x6d')][_0x78ef('0x9d')]){_0x41934a[_0x78ef('0x6e')][_0x78ef('0x9e')]({'id':0x0,'priority':_0x41934a[_0x78ef('0x6e')][_0x78ef('0x44')]+0x1,'app':_0x78ef('0x9f'),'appdata':_0x78ef('0xa0'),'interval':'*,*,*,*'});}_0x41934a[_0x78ef('0x9b')][_0x78ef('0x9c')]=!![];}return db['SmsMessage'][_0x78ef('0x59')]({'phone':_0x41934a['body'][_0x78ef('0x79')],'messageId':_0x41934a[_0x78ef('0x5a')][_0x78ef('0x7c')],'body':_0x41934a['body'][_0x78ef('0x5a')],'SmsAccountId':_0xaf6eb8[_0x78ef('0x55')]['id'],'SmsInteractionId':_0x2a93a6['id'],'direction':'in','ContactId':_0x2a93a6[_0x78ef('0xa1')],'AttachmentId':_0x41934a[_0x78ef('0x5a')][_0x78ef('0xa2')]});})['then'](function(_0x439b04){_0x41934a['message']=_0x439b04;if(!_0x41934a[_0x78ef('0x9b')][_0x78ef('0xa3')])return;return db[_0x78ef('0xa4')]['find']({'attributes':['id',_0x78ef('0x37')],'where':{'id':_0x41934a['interaction'][_0x78ef('0xa3')]}});})[_0x78ef('0x1f')](function(_0x3b0e0a){if(_0x3b0e0a){_0x41934a['applications'][_0x78ef('0xa5')]({'id':0x0,'priority':0x0,'app':_0x78ef('0xa6'),'appdata':_0x3b0e0a[_0x78ef('0x37')]+','+(_0x41934a[_0x78ef('0x6d')]['waitForTheAssignedAgent']||0xa),'interval':_0x78ef('0xa7')});}if(!_0x41934a[_0x78ef('0x9b')][_0x78ef('0xa8')])return;return db['SmsQueue']['find']({'attributes':['id',_0x78ef('0x37')],'where':{'id':_0x41934a[_0x78ef('0x9b')][_0x78ef('0xa8')]}});})[_0x78ef('0x1f')](function(_0x14c4cc){if(_0x14c4cc){_0x41934a[_0x78ef('0x6e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x78ef('0xa9'),'appdata':_0x14c4cc[_0x78ef('0x37')]+','+(_0x41934a[_0x78ef('0x6d')][_0x78ef('0xaa')]||0x12c),'interval':_0x78ef('0xa7')});}return respondWithRpcPromise(_0x78ef('0xab'),'startRouting',_0x41934a);})['then'](function(_0x3ad385){if(_0x3ad385){var _0x44baed=0xc8;var _0xc81114='receiveMessage';logger[_0x78ef('0x20')](_0x78ef('0xac'),_0xc81114,_0x44baed,'entity\x20found');logger[_0x78ef('0xad')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xc81114,_0x44baed,'entity\x20found',JSON[_0x78ef('0xae')](_0x3ad385));if(_0x41934a['account']['type']===_0x78ef('0x78')){return _0x30c013[_0x78ef('0x28')](_0x44baed)['set'](_0x78ef('0xaf'),_0x78ef('0xb0'))[_0x78ef('0x38')](_0x78ef('0xb1'));}else{return _0x30c013[_0x78ef('0x28')](_0x44baed)[_0x78ef('0x2e')](_0x3ad385);}}})[_0x78ef('0x26')](handleError(_0x30c013,null));};exports[_0x78ef('0xb2')]=function(_0x212c72,_0x55f03f){var _0x4faf19=_0x212c72[_0x78ef('0x55')]['id'];var _0x4c16d9=_0x212c72[_0x78ef('0x5a')];var _0x2da99a=0xc8;var _0x15d629=null;return db[_0x78ef('0xb3')][_0x78ef('0xb4')]({'isolationLevel':db[_0x78ef('0xb3')]['Transaction'][_0x78ef('0xb5')][_0x78ef('0xb6')]},function(_0x259a93){return db['SmsAccount'][_0x78ef('0x65')]({'where':{'id':_0x4faf19},'transaction':_0x259a93})[_0x78ef('0x1f')](function(_0x206040){if(_0x206040){return db[_0x78ef('0xb7')][_0x78ef('0x32')]({'where':{'SmsAccountId':_0x4faf19},'transaction':_0x259a93})['then'](function(){var _0x20c248=_[_0x78ef('0x3b')](_0x4c16d9,function(_0x2f547c){_0x2f547c['SmsAccountId']=_0x4faf19;return _0x2f547c;});return db[_0x78ef('0xb7')]['bulkCreate'](_0x20c248,{'transaction':_0x259a93});});}else{_0x2da99a=0x194;_0x15d629=[];}});})[_0x78ef('0x1f')](function(){if(_0x2da99a!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x4faf19},'order':_0x78ef('0x70')})[_0x78ef('0x1f')](function(_0x24cc3f){_0x15d629=_0x24cc3f;});}})[_0x78ef('0x26')](function(_0x4d47f2){_0x2da99a=0x1f4;logger['error'](_0x4d47f2[_0x78ef('0xb8')]);if(_0x4d47f2[_0x78ef('0x37')]){delete _0x4d47f2[_0x78ef('0x37')];}_0x15d629=_0x4d47f2;})[_0x78ef('0xb9')](function(){if(_0x15d629===null){_0x55f03f[_0x78ef('0x27')](_0x2da99a);}else{if(_0x2da99a===0x1f4){_0x55f03f[_0x78ef('0x28')](_0x2da99a)[_0x78ef('0x38')](_0x15d629);}else{_0x55f03f[_0x78ef('0x28')](_0x2da99a)[_0x78ef('0x2e')](_0x15d629);}}});};exports['getApplications']=function(_0x2749cd,_0x554c1a,_0x5b7f00){var _0x272b86={};var _0x154a41={};var _0x32f1c3;var _0x426e90;return db[_0x78ef('0x3c')][_0x78ef('0x65')]({'where':{'id':_0x2749cd[_0x78ef('0x55')]['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x554c1a,null))[_0x78ef('0x1f')](function(_0xe1c8c5){if(_0xe1c8c5){_0x32f1c3=_0xe1c8c5;_0x154a41[_0x78ef('0x3f')]=_['keys'](db[_0x78ef('0xb7')]['rawAttributes']);_0x154a41[_0x78ef('0x40')]=_[_0x78ef('0x57')](_0x2749cd[_0x78ef('0x40')]);_0x154a41[_0x78ef('0x49')]=_[_0x78ef('0x41')](_0x154a41[_0x78ef('0x3f')],_0x154a41['query']);_0x272b86['attributes']=_[_0x78ef('0x41')](_0x154a41[_0x78ef('0x3f')],qs[_0x78ef('0x43')](_0x2749cd[_0x78ef('0x40')][_0x78ef('0x43')]));_0x272b86['attributes']=_0x272b86[_0x78ef('0x42')][_0x78ef('0x44')]?_0x272b86[_0x78ef('0x42')]:_0x154a41['model'];_0x272b86[_0x78ef('0x47')]=qs[_0x78ef('0x48')](_0x2749cd[_0x78ef('0x40')][_0x78ef('0x48')]);_0x272b86[_0x78ef('0x4c')]=qs[_0x78ef('0x49')](_[_0x78ef('0x4a')](_0x2749cd[_0x78ef('0x40')],_0x154a41[_0x78ef('0x49')]));if(_0x2749cd['query'][_0x78ef('0x4b')]){_0x272b86[_0x78ef('0x4c')]=_['merge'](_0x272b86[_0x78ef('0x4c')],{'$or':_[_0x78ef('0x3b')](_0x272b86[_0x78ef('0x42')],function(_0x2e55f3){var _0x302b1a={};_0x302b1a[_0x2e55f3]={'$like':'%'+_0x2749cd['query']['filter']+'%'};return _0x302b1a;})});}_0x272b86=_['merge']({},_0x272b86,_0x2749cd[_0x78ef('0x4f')]);return _0x32f1c3['getApplications'](_0x272b86);}})[_0x78ef('0x1f')](function(_0x3b4ab5){if(_0x3b4ab5){_0x426e90=_0x3b4ab5['length'];if(!_0x2749cd['query'][_0x78ef('0x45')](_0x78ef('0x46'))){_0x272b86[_0x78ef('0x2b')]=qs[_0x78ef('0x2b')](_0x2749cd['query']['limit']);_0x272b86[_0x78ef('0x29')]=qs[_0x78ef('0x29')](_0x2749cd[_0x78ef('0x40')][_0x78ef('0x29')]);}return _0x32f1c3['getApplications'](_0x272b86);}})['then'](function(_0x10a0ec){if(_0x10a0ec){return _0x10a0ec?{'count':_0x426e90,'rows':_0x10a0ec}:null;}})[_0x78ef('0x1f')](respondWithResult(_0x554c1a,null))[_0x78ef('0x26')](handleError(_0x554c1a,null));};exports[_0x78ef('0xba')]=function(_0x2aaf7f,_0x318422,_0x449744){var _0x3ac425={'raw':![],'where':{}};var _0x5c2ac9={};var _0x1160d2={'count':0x0,'rows':[]};return db[_0x78ef('0x3c')][_0x78ef('0x65')]({'where':{'id':_0x2aaf7f[_0x78ef('0x55')]['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x318422,null))[_0x78ef('0x1f')](function(_0xb1cd01){if(_0xb1cd01){_0x5c2ac9['model']=_['keys'](db[_0x78ef('0x9a')][_0x78ef('0x3d')]);_0x5c2ac9[_0x78ef('0x40')]=_[_0x78ef('0x57')](_0x2aaf7f[_0x78ef('0x40')]);_0x5c2ac9[_0x78ef('0x49')]=_[_0x78ef('0x41')](_0x5c2ac9[_0x78ef('0x3f')],_0x5c2ac9['query']);_0x3ac425[_0x78ef('0x42')]=_[_0x78ef('0x41')](_0x5c2ac9[_0x78ef('0x3f')],qs['fields'](_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0x43')]));_0x3ac425[_0x78ef('0x42')]=_0x3ac425[_0x78ef('0x42')][_0x78ef('0x44')]?_0x3ac425['attributes']:_0x5c2ac9[_0x78ef('0x3f')];if(!_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0x45')](_0x78ef('0x46'))){_0x3ac425[_0x78ef('0x2b')]=qs[_0x78ef('0x2b')](_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0x2b')]);_0x3ac425[_0x78ef('0x29')]=qs[_0x78ef('0x29')](_0x2aaf7f['query'][_0x78ef('0x29')]);}_0x3ac425[_0x78ef('0x47')]=qs[_0x78ef('0x48')](_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0x48')]);_0x3ac425[_0x78ef('0x4c')]=qs[_0x78ef('0x49')](_[_0x78ef('0x4a')](_0x2aaf7f[_0x78ef('0x40')],_0x5c2ac9[_0x78ef('0x49')]));_0x3ac425[_0x78ef('0x4c')][_0x78ef('0x62')]=_0xb1cd01['id'];if(_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0x4b')]){_0x3ac425[_0x78ef('0x4c')]=_[_0x78ef('0x4d')](_0x3ac425['where'],{'$or':_[_0x78ef('0x3b')](_0x3ac425[_0x78ef('0x42')],function(_0x3ed615){var _0x4ff866={};_0x4ff866[_0x3ed615]={'$like':'%'+_0x2aaf7f['query'][_0x78ef('0x4b')]+'%'};return _0x4ff866;})});}_0x3ac425=_[_0x78ef('0x4d')]({},_0x3ac425,_0x2aaf7f[_0x78ef('0x4f')]);return db[_0x78ef('0x9a')][_0x78ef('0x2c')]({'where':_0x3ac425[_0x78ef('0x4c')]})[_0x78ef('0x1f')](function(_0x2eeb1b){_0x1160d2[_0x78ef('0x2c')]=_0x2eeb1b;if(_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0x50')]){_0x3ac425[_0x78ef('0x51')]=[{'model':db[_0x78ef('0x96')],'as':'Contact','required':![]},{'model':db[_0x78ef('0xa4')],'as':_0x78ef('0xbb'),'attributes':[_0x78ef('0x37'),'fullname',_0x78ef('0xbc')],'required':![]},{'model':db[_0x78ef('0xbd')],'as':_0x78ef('0xbe'),'attributes':['id',_0x78ef('0x37'),_0x78ef('0xbf')],'where':_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0xc0')]?{'id':_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0xc0')]}:undefined,'required':_0x2aaf7f[_0x78ef('0x40')][_0x78ef('0xc0')]?!![]:![]}];}return db[_0x78ef('0x9a')][_0x78ef('0x52')](_0x3ac425);})[_0x78ef('0x1f')](function(_0x3a8bc3){_0x1160d2[_0x78ef('0x53')]=_0x3a8bc3;return _0x1160d2;});}})[_0x78ef('0x1f')](respondWithFilteredResult(_0x318422,_0x3ac425))[_0x78ef('0x26')](handleError(_0x318422,null));};exports[_0x78ef('0x38')]=function(_0x281810,_0xf27412,_0x3dfd23){var _0x42b09c,_0x3c5d3c,_0x5d9414;if(_[_0x78ef('0x8e')](_0x281810[_0x78ef('0x5a')][_0x78ef('0x5a')])||_0x281810[_0x78ef('0x5a')][_0x78ef('0x5a')]===''){throw new db['Sequelize'][(_0x78ef('0x73'))](_0x78ef('0x90'));}if(_[_0x78ef('0x8e')](_0x281810['body']['to'])){throw new db[(_0x78ef('0x72'))][(_0x78ef('0x73'))]('to\x20is\x20mandatory');}_0x42b09c=_0x281810[_0x78ef('0x5a')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x281810[_0x78ef('0x55')]['id']},'include':[{'model':db[_0x78ef('0x95')],'as':_0x78ef('0xc1'),'include':[{'model':db[_0x78ef('0x96')],'as':_0x78ef('0x97'),'where':{'mobile':_0x42b09c},'limit':0x1,'order':[[_0x78ef('0x76'),'DESC']]}]}]})[_0x78ef('0x1f')](handleEntityNotFound(_0xf27412,null))[_0x78ef('0x1f')](function(_0x32d9df){if(_0x32d9df&&_0x32d9df[_0x78ef('0xc1')]){_0x3c5d3c=_0x32d9df[_0x78ef('0x33')]({'plain':!![]});if(_0x3c5d3c['List']&&_0x3c5d3c[_0x78ef('0xc1')][_0x78ef('0x97')][_0x78ef('0x44')]){return _0x3c5d3c[_0x78ef('0xc1')]['Contacts'][0x0];}return db[_0x78ef('0x96')]['create'](_[_0x78ef('0x18')](_0x281810[_0x78ef('0x5a')],{'firstName':_0x42b09c,'mobile':_0x42b09c,'phone':_0x42b09c,'ListId':_0x3c5d3c[_0x78ef('0xc2')]}));}})[_0x78ef('0x1f')](handleEntityNotFound(_0xf27412,null))[_0x78ef('0x1f')](function(_0x19fca4){if(_0x19fca4){_0x5d9414=_0x19fca4;return db['SmsInteraction'][_0x78ef('0x58')]({'where':{'ContactId':_0x5d9414['id'],'closed':![],'SmsAccountId':_0x3c5d3c['id']}})[_0x78ef('0x1f')](function(_0x469c2c){if(_0x469c2c){return[_0x469c2c,![]];}return db['SmsInteraction']['create']({'UserId':_0x281810['user']['id'],'ContactId':_0x5d9414['id'],'SmsAccountId':_0x3c5d3c['id'],'phone':_0x42b09c,'firstMsgDirection':_0x78ef('0xc3'),'Messages':[_[_0x78ef('0x4d')](_0x281810[_0x78ef('0x5a')],{'read':![],'body':_0x281810['body'][_0x78ef('0x5a')],'phone':_0x42b09c,'SmsAccountId':_0x3c5d3c['id'],'UserId':_0x281810['user']['id'],'ContactId':_0x5d9414['id']})]},{'include':[{'model':db[_0x78ef('0xc4')],'as':_0x78ef('0xc5')}]})['then'](function(_0x2ea474){return[_0x2ea474,!![]];});});}})[_0x78ef('0xc6')](function(_0x29e408,_0x289125){if(_0x289125){return _0x29e408;}return db[_0x78ef('0xc4')][_0x78ef('0x59')](_[_0x78ef('0x4d')](_0x281810[_0x78ef('0x5a')],{'read':![],'body':_0x281810[_0x78ef('0x5a')][_0x78ef('0x5a')],'phone':_0x42b09c,'SmsAccountId':_0x3c5d3c['id'],'SmsInteractionId':_0x29e408['id'],'UserId':_0x281810[_0x78ef('0x5b')]['id'],'ContactId':_0x5d9414['id']}))[_0x78ef('0x1f')](function(_0x23c952){_0x29e408['dataValues'][_0x78ef('0xc5')]=[];_0x29e408['dataValues'][_0x78ef('0xc5')]['push'](_0x23c952[_0x78ef('0xc7')]);return _0x29e408;});})[_0x78ef('0x1f')](respondWithResult(_0xf27412,null))[_0x78ef('0x26')](handleError(_0xf27412,null));};exports[_0x78ef('0x28')]=function(_0x144742,_0x57c506,_0x488fd8){if(_0x144742[_0x78ef('0x5a')]['id']){delete _0x144742[_0x78ef('0x5a')]['id'];}var _0x5cb5e3,_0x4dced2,_0x14c3aa;return db[_0x78ef('0x3c')][_0x78ef('0x58')]({'where':{'id':_0x144742[_0x78ef('0x55')]['id']}})['then'](handleEntityNotFound(_0x57c506,null))[_0x78ef('0x1f')](function(_0x4d1373){if(_0x4d1373){_0x14c3aa=_0x4d1373;logger[_0x78ef('0xad')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x78ef('0x28'),_0x78ef('0xc8'),_0x4d1373[_0x78ef('0x3e')],util[_0x78ef('0xc9')](_0x144742[_0x78ef('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4d1373['type']){case _0x78ef('0x7d'):if(_0x144742[_0x78ef('0x5a')][_0x78ef('0xca')]&&_0x144742[_0x78ef('0x5a')]['status']){_0x4dced2=_0x144742[_0x78ef('0x5a')][_0x78ef('0x28')];return db[_0x78ef('0xc4')][_0x78ef('0x58')]({'where':{'messageId':_0x144742[_0x78ef('0x5a')][_0x78ef('0xca')]}});}break;case _0x78ef('0x80'):if(_0x144742[_0x78ef('0x5a')][_0x78ef('0xcb')]&&_0x144742[_0x78ef('0x5a')][_0x78ef('0xcc')]){_0x4dced2=_0x144742[_0x78ef('0x5a')]['statusInt'];return db[_0x78ef('0xc4')]['find']({'where':{'messageId':_0x144742[_0x78ef('0x5a')]['requestid']}});}break;case _0x78ef('0x81'):if(_0x144742['body'][_0x78ef('0xcd')]&&_0x144742[_0x78ef('0x5a')][_0x78ef('0xce')]){_0x4dced2=_0x144742['body'][_0x78ef('0xce')];return db[_0x78ef('0xc4')][_0x78ef('0x58')]({'where':{'messageId':_0x144742[_0x78ef('0x5a')][_0x78ef('0xcd')]}});}break;case'infobip':var _0x28c5d5=_0x144742[_0x78ef('0x5a')][_0x78ef('0x85')][0x0];if(_0x28c5d5[_0x78ef('0x7c')]&&_0x28c5d5[_0x78ef('0x28')][_0x78ef('0xcf')]===_0x78ef('0xd0')){_0x4dced2=_0x28c5d5[_0x78ef('0x28')][_0x78ef('0xcf')];return db[_0x78ef('0xc4')]['find']({'where':{'messageId':_0x28c5d5[_0x78ef('0x7c')]}});}break;case _0x78ef('0x89'):if(_0x144742[_0x78ef('0x5a')][_0x78ef('0x7c')]&&_0x144742[_0x78ef('0x5a')][_0x78ef('0x28')]){_0x4dced2=_0x144742['body'][_0x78ef('0x28')];return db[_0x78ef('0xc4')][_0x78ef('0x58')]({'where':{'messageId':_0x144742[_0x78ef('0x5a')][_0x78ef('0x7c')]}});}break;case _0x78ef('0x8c'):if(_0x144742['body'][0x0][_0x78ef('0x25')]['id']){_0x4dced2=_0x144742[_0x78ef('0x5a')][0x0]['type'];return db[_0x78ef('0xc4')][_0x78ef('0x58')]({'where':{'messageId':_0x144742['body'][0x0]['message']['id']}});}break;case'intelepeer':if(_0x144742[_0x78ef('0x5a')][_0x78ef('0xd1')]&&_0x144742['body'][_0x78ef('0x28')]){_0x4dced2=_0x144742['body'][_0x78ef('0x28')];return db[_0x78ef('0xc4')][_0x78ef('0x58')]({'where':{'messageId':_0x144742[_0x78ef('0x5a')][_0x78ef('0xd1')]}});}break;}}})[_0x78ef('0x1f')](handleEntityNotFound(_0x57c506,null))[_0x78ef('0x1f')](function(_0x49f2db){if(_0x49f2db){_0x5cb5e3=_0x49f2db;switch(_0x14c3aa[_0x78ef('0x3e')]){case _0x78ef('0x7d'):if(_0x4dced2===_0x78ef('0xd0')){return _0x5cb5e3['update']({'read':!![]});}else{logger[_0x78ef('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x78ef('0x28'),_0x78ef('0x7d'),util[_0x78ef('0xc9')](_0x144742['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4dced2==='1'){return _0x5cb5e3[_0x78ef('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x78ef('0x28'),'skebby',util[_0x78ef('0xc9')](_0x144742[_0x78ef('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x78ef('0x81'):if(!_0x144742[_0x78ef('0x5a')][_0x78ef('0xd2')]&&_0x4dced2>=0xc8&&_0x4dced2<=0xce){return _0x5cb5e3[_0x78ef('0x31')]({'read':!![]});}else{logger[_0x78ef('0x23')](_0x78ef('0xac'),_0x78ef('0x28'),'clicksend',util[_0x78ef('0xc9')](_0x144742[_0x78ef('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x78ef('0x84'):var _0x56ed53=_0x144742['body'][_0x78ef('0x85')][0x0];if(_0x56ed53[_0x78ef('0x28')]['groupName']===_0x78ef('0xd0')){return _0x5cb5e3[_0x78ef('0x31')]({'read':!![]});}else{logger[_0x78ef('0x23')](_0x78ef('0xac'),_0x78ef('0x28'),'infobip',util[_0x78ef('0xc9')](_0x144742['body'],{'showHidden':![],'depth':null}));}break;case _0x78ef('0x89'):if(_0x4dced2==_0x78ef('0xd3')||_0x4dced2==_0x78ef('0xd4')){return _0x5cb5e3[_0x78ef('0x31')]({'read':!![]});}else{logger[_0x78ef('0x23')](_0x78ef('0xac'),_0x78ef('0x28'),_0x78ef('0x89'),util[_0x78ef('0xc9')](_0x144742[_0x78ef('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x78ef('0x8c'):if(_0x4dced2=='message-delivered'){return _0x5cb5e3[_0x78ef('0x31')]({'read':!![]});}else{logger[_0x78ef('0x23')](_0x78ef('0xac'),_0x78ef('0x28'),'bandwidth',util[_0x78ef('0xc9')](_0x144742[_0x78ef('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x78ef('0xd5'):if(_0x4dced2===_0x78ef('0xd6')||_0x4dced2==='ACCEPTD'){return _0x5cb5e3[_0x78ef('0x31')]({'read':!![]});}else{logger[_0x78ef('0x23')](_0x78ef('0xac'),_0x78ef('0x28'),_0x78ef('0xd5'),util[_0x78ef('0xc9')](_0x144742[_0x78ef('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x5cb5e3;}})[_0x78ef('0x1f')](respondWithResult(_0x57c506,null))[_0x78ef('0x26')](handleError(_0x57c506,null));};exports['statusGet']=function(_0x193e4d,_0x440df1,_0x55828f){var _0x2c72ad,_0x4f56db,_0x4152ac;return db[_0x78ef('0x3c')]['find']({'where':{'id':_0x193e4d[_0x78ef('0x55')]['id']}})['then'](handleEntityNotFound(_0x440df1,null))[_0x78ef('0x1f')](function(_0x4216a5){if(_0x4216a5){_0x4152ac=_0x4216a5;logger[_0x78ef('0xad')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x78ef('0x28'),_0x78ef('0xc8'),_0x4216a5[_0x78ef('0x3e')],util[_0x78ef('0xc9')](_0x193e4d['query'],{'showHidden':![],'depth':null}));switch(_0x4216a5['type']){case _0x78ef('0x86'):if(_0x193e4d[_0x78ef('0x40')]['message-id']&&_0x193e4d[_0x78ef('0x40')][_0x78ef('0xd7')]){_0x4f56db=_0x193e4d['query'][_0x78ef('0xd7')];return db[_0x78ef('0xc4')][_0x78ef('0x58')]({'where':{'messageId':_0x193e4d[_0x78ef('0x40')][_0x78ef('0xd8')]}});}break;}}})[_0x78ef('0x1f')](handleEntityNotFound(_0x440df1,null))[_0x78ef('0x1f')](function(_0x40a670){if(_0x40a670){_0x2c72ad=_0x40a670;switch(_0x4152ac[_0x78ef('0x3e')]){case _0x78ef('0x86'):if(_0x4f56db==='2'||_0x4f56db==='6'){return _0x2c72ad[_0x78ef('0x31')]({'read':!![]});}else{logger[_0x78ef('0x23')](_0x78ef('0xac'),_0x78ef('0x28'),_0x78ef('0x86'),util['inspect'](_0x193e4d[_0x78ef('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x2c72ad;}})[_0x78ef('0x1f')](respondWithResult(_0x440df1,null))[_0x78ef('0x26')](handleError(_0x440df1,null));};exports['addAgents']=function(_0xf78ef9,_0x34a6a7,_0x56bc9c){return db['SmsAccount'][_0x78ef('0x58')]({'where':{'id':_0xf78ef9[_0x78ef('0x55')]['id']}})['then'](handleEntityNotFound(_0x34a6a7,null))[_0x78ef('0x1f')](function(_0x584c81){if(_0x584c81){return _0x584c81[_0x78ef('0xd9')](_0xf78ef9[_0x78ef('0x5a')][_0x78ef('0x67')],_[_0x78ef('0xda')](_0xf78ef9['body'],[_0x78ef('0x67'),'id'])||{})[_0x78ef('0xc6')](function(_0x127906){for(var _0x5d4341=0x0;_0x5d4341<_0xf78ef9[_0x78ef('0x5a')]['ids']['length'];_0x5d4341+=0x1){socket['emit'](_0x78ef('0xdb'),{'UserId':Number(_0xf78ef9[_0x78ef('0x5a')]['ids'][_0x5d4341]),'SmsAccountId':Number(_0xf78ef9['params']['id'])});}return _0x127906;});}})[_0x78ef('0x1f')](respondWithResult(_0x34a6a7,null))[_0x78ef('0x26')](handleError(_0x34a6a7,null));};exports[_0x78ef('0xdc')]=function(_0x41daf9,_0x27b017,_0x5c88f2){return db[_0x78ef('0x3c')]['find']({'where':{'id':_0x41daf9['params']['id']}})[_0x78ef('0x1f')](handleEntityNotFound(_0x27b017,null))[_0x78ef('0x1f')](function(_0x423e41){if(_0x423e41){return _0x423e41[_0x78ef('0xdc')](_0x41daf9[_0x78ef('0x40')][_0x78ef('0x67')])[_0x78ef('0x1f')](function(){if(_[_0x78ef('0xdd')](_0x41daf9[_0x78ef('0x40')][_0x78ef('0x67')])){for(var _0x3b7d22=0x0;_0x3b7d22<_0x41daf9[_0x78ef('0x40')][_0x78ef('0x67')]['length'];_0x3b7d22+=0x1){socket[_0x78ef('0xde')](_0x78ef('0xdf'),{'UserId':Number(_0x41daf9[_0x78ef('0x40')][_0x78ef('0x67')][_0x3b7d22]),'SmsAccountId':Number(_0x41daf9[_0x78ef('0x55')]['id'])});}}else{socket['emit'](_0x78ef('0xdf'),{'UserId':Number(_0x41daf9[_0x78ef('0x40')][_0x78ef('0x67')]),'SmsAccountId':Number(_0x41daf9[_0x78ef('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x27b017,null))['catch'](handleError(_0x27b017,null));};exports['getAgents']=function(_0x43132a,_0x652286,_0x32d1e0){var _0x1b178c={};var _0x20b32c={};var _0x365279;var _0xb397c6;return db[_0x78ef('0x3c')][_0x78ef('0x65')]({'where':{'id':_0x43132a['params']['id']}})['then'](handleEntityNotFound(_0x652286,null))['then'](function(_0x352f02){if(_0x352f02){_0x365279=_0x352f02;_0x20b32c[_0x78ef('0x3f')]=_['keys'](db[_0x78ef('0xa4')][_0x78ef('0x3d')]);_0x20b32c[_0x78ef('0x40')]=_[_0x78ef('0x57')](_0x43132a[_0x78ef('0x40')]);_0x20b32c[_0x78ef('0x49')]=_['intersection'](_0x20b32c[_0x78ef('0x3f')],_0x20b32c[_0x78ef('0x40')]);_0x1b178c[_0x78ef('0x42')]=_[_0x78ef('0x41')](_0x20b32c[_0x78ef('0x3f')],qs['fields'](_0x43132a[_0x78ef('0x40')][_0x78ef('0x43')]));_0x1b178c[_0x78ef('0x42')]=_0x1b178c[_0x78ef('0x42')][_0x78ef('0x44')]?_0x1b178c[_0x78ef('0x42')]:_0x20b32c['model'];_0x1b178c[_0x78ef('0x47')]=qs['sort'](_0x43132a[_0x78ef('0x40')][_0x78ef('0x48')]);_0x1b178c[_0x78ef('0x4c')]=qs['filters'](_[_0x78ef('0x4a')](_0x43132a[_0x78ef('0x40')],_0x20b32c[_0x78ef('0x49')]));if(_0x43132a[_0x78ef('0x40')][_0x78ef('0x4b')]){_0x1b178c[_0x78ef('0x4c')]=_[_0x78ef('0x4d')](_0x1b178c[_0x78ef('0x4c')],{'$or':_[_0x78ef('0x3b')](_0x1b178c[_0x78ef('0x42')],function(_0x35a92d){var _0x4059dd={};_0x4059dd[_0x35a92d]={'$like':'%'+_0x43132a[_0x78ef('0x40')][_0x78ef('0x4b')]+'%'};return _0x4059dd;})});}_0x1b178c=_[_0x78ef('0x4d')]({},_0x1b178c,_0x43132a[_0x78ef('0x4f')]);return _0x365279[_0x78ef('0xe0')](_0x1b178c);}})['then'](function(_0x2965de){if(_0x2965de){_0xb397c6=_0x2965de['length'];if(!_0x43132a['query']['hasOwnProperty'](_0x78ef('0x46'))){_0x1b178c[_0x78ef('0x2b')]=qs[_0x78ef('0x2b')](_0x43132a[_0x78ef('0x40')][_0x78ef('0x2b')]);_0x1b178c['offset']=qs['offset'](_0x43132a[_0x78ef('0x40')][_0x78ef('0x29')]);}return _0x365279[_0x78ef('0xe0')](_0x1b178c);}})[_0x78ef('0x1f')](function(_0x44c5c9){if(_0x44c5c9){return _0x44c5c9?{'count':_0xb397c6,'rows':_0x44c5c9}:null;}})['then'](respondWithResult(_0x652286,null))['catch'](handleError(_0x652286,null));}; \ No newline at end of file +var _0x621b=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','clickatell','replyMessageId','bandwidth','intelepeer','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','omit','defaults','contact','SmsInteraction','spread','interaction','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','json','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x50fb37,_0xf2f062){var _0x5617d3=function(_0xadb6e0){while(--_0xadb6e0){_0x50fb37['push'](_0x50fb37['shift']());}};_0x5617d3(++_0xf2f062);}(_0x621b,0xe4));var _0xb621=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x621b[_0x44d9ab];return _0x31485e;};'use strict';var emlformat=require(_0xb621('0x0'));var rimraf=require(_0xb621('0x1'));var zipdir=require(_0xb621('0x2'));var jsonpatch=require(_0xb621('0x3'));var rp=require(_0xb621('0x4'));var moment=require('moment');var BPromise=require(_0xb621('0x5'));var Mustache=require(_0xb621('0x6'));var util=require(_0xb621('0x7'));var path=require('path');var sox=require(_0xb621('0x8'));var csv=require(_0xb621('0x9'));var ejs=require(_0xb621('0xa'));var fs=require('fs');var fs_extra=require(_0xb621('0xb'));var _=require(_0xb621('0xc'));var squel=require(_0xb621('0xd'));var crypto=require('crypto');var jsforce=require(_0xb621('0xe'));var deskjs=require(_0xb621('0xf'));var toCsv=require(_0xb621('0x9'));var querystring=require(_0xb621('0x10'));var Papa=require(_0xb621('0x11'));var Redis=require(_0xb621('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb621('0x13'));var as=require(_0xb621('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb621('0x15'));var utils=require('../../config/utils');var config=require(_0xb621('0x16'));var licenseUtil=require(_0xb621('0x17'));var db=require(_0xb621('0x18'))['db'];config[_0xb621('0x19')]=_['defaults'](config[_0xb621('0x19')],{'host':_0xb621('0x1a'),'port':0x18eb});var socket=require(_0xb621('0x1b'))(new Redis(config[_0xb621('0x19')]));require(_0xb621('0x1c'))['register'](socket);var jayson=require(_0xb621('0x1d'));var client=jayson[_0xb621('0x1e')][_0xb621('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5ab747,_0x4cc476,_0x37b3b0,_0x11bd47){return new BPromise(function(_0x3463af,_0x3d5e9e){var _0x17fc4e=_0x11bd47||client;return _0x17fc4e[_0xb621('0x20')](_0x5ab747,_0x37b3b0)[_0xb621('0x21')](function(_0xdf91a0){logger[_0xb621('0x22')](_0xb621('0x23'),_0x4cc476,_0xb621('0x24'));logger['debug'](_0xb621('0x25'),_0x4cc476,_0xb621('0x24'),JSON[_0xb621('0x26')](_0xdf91a0));if(_0xdf91a0[_0xb621('0x27')]){if(_0xdf91a0[_0xb621('0x27')][_0xb621('0x28')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4cc476,_0xdf91a0[_0xb621('0x27')][_0xb621('0x29')]);return _0x3d5e9e(_0xdf91a0['error'][_0xb621('0x29')]);}logger['error'](_0xb621('0x23'),_0x4cc476,_0xdf91a0['error'][_0xb621('0x29')]);return _0x3463af(_0xdf91a0['error'][_0xb621('0x29')]);}else{logger[_0xb621('0x22')](_0xb621('0x23'),_0x4cc476,_0xb621('0x24'));_0x3463af(_0xdf91a0[_0xb621('0x2a')]['message']);}})[_0xb621('0x2b')](function(_0x3e1a0f){logger[_0xb621('0x27')](_0xb621('0x23'),_0x4cc476,_0x3e1a0f);_0x3d5e9e(_0x3e1a0f);});});}function respondWithStatusCode(_0x55cdb0,_0x1737b1){_0x1737b1=_0x1737b1||0xcc;return function(_0x290206){if(_0x290206){return _0x55cdb0[_0xb621('0x2c')](_0x1737b1);}return _0x55cdb0[_0xb621('0x2d')](_0x1737b1)['end']();};}function respondWithResult(_0x1ddafb,_0x9d4e2e){_0x9d4e2e=_0x9d4e2e||0xc8;return function(_0x3b52c5){if(_0x3b52c5){return _0x1ddafb[_0xb621('0x2d')](_0x9d4e2e)['json'](_0x3b52c5);}};}function respondWithFilteredResult(_0x546dbc,_0x4ab412){return function(_0x301d50){if(_0x301d50){var _0xf86b61=typeof _0x4ab412[_0xb621('0x2e')]==='undefined'&&typeof _0x4ab412[_0xb621('0x2f')]==='undefined';var _0x4e9747=_0x301d50['count'];var _0x50cb1f=_0xf86b61?0x0:_0x4ab412[_0xb621('0x2e')];var _0x48519d=_0xf86b61?_0x301d50['count']:_0x4ab412[_0xb621('0x2e')]+_0x4ab412[_0xb621('0x2f')];var _0x491369;if(_0x48519d>=_0x4e9747){_0x48519d=_0x4e9747;_0x491369=0xc8;}else{_0x491369=0xce;}_0x546dbc[_0xb621('0x2d')](_0x491369);return _0x546dbc[_0xb621('0x30')](_0xb621('0x31'),_0x50cb1f+'-'+_0x48519d+'/'+_0x4e9747)['json'](_0x301d50);}return null;};}function patchUpdates(_0x1edecd){return function(_0x1e6eb7){try{jsonpatch[_0xb621('0x32')](_0x1e6eb7,_0x1edecd,!![]);}catch(_0x509d1e){return BPromise[_0xb621('0x33')](_0x509d1e);}return _0x1e6eb7[_0xb621('0x34')]();};}function saveUpdates(_0x3a57da,_0x4c177f){return function(_0x2bf3b8){if(_0x2bf3b8){return _0x2bf3b8[_0xb621('0x35')](_0x3a57da)['then'](function(_0xe7981d){return _0xe7981d;});}return null;};}function removeEntity(_0x3a36a8,_0x28ff0a){return function(_0x57b85a){if(_0x57b85a){return _0x57b85a[_0xb621('0x36')]()[_0xb621('0x21')](function(){var _0x50572e=_0x57b85a[_0xb621('0x37')]({'plain':!![]});var _0xe6c09b=_0xb621('0x38');return db[_0xb621('0x39')]['destroy']({'where':{'type':_0xe6c09b,'resourceId':_0x50572e['id']}})[_0xb621('0x21')](function(){return _0x57b85a;});})['then'](function(){_0x3a36a8[_0xb621('0x2d')](0xcc)[_0xb621('0x3a')]();});}};}function handleEntityNotFound(_0x1e17e6,_0xd5475e){return function(_0xd8ea8){if(!_0xd8ea8){_0x1e17e6[_0xb621('0x2c')](0x194);}return _0xd8ea8;};}function handleError(_0x54f73e,_0xc2371d){_0xc2371d=_0xc2371d||0x1f4;return function(_0x376a1c){logger['error'](_0x376a1c[_0xb621('0x3b')]);if(_0x376a1c[_0xb621('0x3c')]){delete _0x376a1c[_0xb621('0x3c')];}_0x54f73e[_0xb621('0x2d')](_0xc2371d)['send'](_0x376a1c);};}exports[_0xb621('0x3d')]=function(_0x30f09b,_0x55193c){var _0x2a2c0c={'include':[{'model':db[_0xb621('0x3e')],'as':_0xb621('0x3f')}]},_0x321d63={},_0x40a500={'count':0x0,'rows':[]};var _0x22414e=_['map'](db[_0xb621('0x40')]['rawAttributes'],function(_0x17aecc){return{'name':_0x17aecc['fieldName'],'type':_0x17aecc['type']['key']};});_0x321d63[_0xb621('0x41')]=_['map'](_0x22414e,_0xb621('0x3c'));_0x321d63['query']=_[_0xb621('0x42')](_0x30f09b['query']);_0x321d63[_0xb621('0x43')]=_[_0xb621('0x44')](_0x321d63['model'],_0x321d63[_0xb621('0x45')]);_0x2a2c0c['attributes']=_['intersection'](_0x321d63[_0xb621('0x41')],qs[_0xb621('0x46')](_0x30f09b[_0xb621('0x45')][_0xb621('0x46')]));_0x2a2c0c['attributes']=_0x2a2c0c[_0xb621('0x47')][_0xb621('0x48')]?_0x2a2c0c[_0xb621('0x47')]:_0x321d63[_0xb621('0x41')];if(!_0x30f09b[_0xb621('0x45')][_0xb621('0x49')](_0xb621('0x4a'))){_0x2a2c0c[_0xb621('0x2f')]=qs['limit'](_0x30f09b['query'][_0xb621('0x2f')]);_0x2a2c0c[_0xb621('0x2e')]=qs[_0xb621('0x2e')](_0x30f09b[_0xb621('0x45')]['offset']);}_0x2a2c0c[_0xb621('0x4b')]=qs[_0xb621('0x4c')](_0x30f09b[_0xb621('0x45')]['sort']);_0x2a2c0c['where']=qs['filters'](_['pick'](_0x30f09b[_0xb621('0x45')],_0x321d63['filters']),_0x22414e);if(_0x30f09b[_0xb621('0x45')][_0xb621('0x4d')]){_0x2a2c0c[_0xb621('0x4e')]=_[_0xb621('0x4f')](_0x2a2c0c[_0xb621('0x4e')],{'$or':_[_0xb621('0x50')](_0x22414e,function(_0x4dc684){if(_0x4dc684[_0xb621('0x51')]!==_0xb621('0x52')){var _0x41979d={};_0x41979d[_0x4dc684[_0xb621('0x3c')]]={'$like':'%'+_0x30f09b[_0xb621('0x45')][_0xb621('0x4d')]+'%'};return _0x41979d;}})});}_0x2a2c0c=_[_0xb621('0x4f')]({},_0x2a2c0c,_0x30f09b[_0xb621('0x53')]);var _0x249b27={'where':_0x2a2c0c[_0xb621('0x4e')]};return db[_0xb621('0x40')][_0xb621('0x54')](_0x249b27)[_0xb621('0x21')](function(_0x321e91){_0x40a500['count']=_0x321e91;if(_0x30f09b[_0xb621('0x45')][_0xb621('0x55')]){_0x2a2c0c['include']=[{'all':!![]}];}return db[_0xb621('0x40')][_0xb621('0x56')](_0x2a2c0c);})[_0xb621('0x21')](function(_0x452367){_0x40a500[_0xb621('0x57')]=_0x452367;return _0x40a500;})[_0xb621('0x21')](respondWithFilteredResult(_0x55193c,_0x2a2c0c))[_0xb621('0x2b')](handleError(_0x55193c,null));};exports[_0xb621('0x58')]=function(_0x5c5334,_0x4ffba4){var _0x32935a={'raw':![],'where':{'id':_0x5c5334[_0xb621('0x59')]['id']},'include':[{'model':db[_0xb621('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4d6d59={};_0x4d6d59[_0xb621('0x41')]=_[_0xb621('0x42')](db[_0xb621('0x40')][_0xb621('0x5a')]);_0x4d6d59['query']=_['keys'](_0x5c5334[_0xb621('0x45')]);_0x4d6d59[_0xb621('0x43')]=_[_0xb621('0x44')](_0x4d6d59[_0xb621('0x41')],_0x4d6d59[_0xb621('0x45')]);_0x32935a[_0xb621('0x47')]=_[_0xb621('0x44')](_0x4d6d59[_0xb621('0x41')],qs['fields'](_0x5c5334[_0xb621('0x45')]['fields']));_0x32935a[_0xb621('0x47')]=_0x32935a[_0xb621('0x47')]['length']?_0x32935a[_0xb621('0x47')]:_0x4d6d59[_0xb621('0x41')];if(_0x5c5334[_0xb621('0x45')][_0xb621('0x55')]){_0x32935a[_0xb621('0x5b')]=[{'all':!![]}];}_0x32935a=_[_0xb621('0x4f')]({},_0x32935a,_0x5c5334[_0xb621('0x53')]);return db[_0xb621('0x40')]['find'](_0x32935a)['then'](handleEntityNotFound(_0x4ffba4,null))[_0xb621('0x21')](respondWithResult(_0x4ffba4,null))[_0xb621('0x2b')](handleError(_0x4ffba4,null));};exports[_0xb621('0x5c')]=function(_0x5eaf1c,_0x11b069){return db['SmsAccount'][_0xb621('0x5c')](_0x5eaf1c['body'],{})['then'](function(_0x4d8187){var _0x35d4c8=_0x5eaf1c[_0xb621('0x5d')][_0xb621('0x37')]({'plain':!![]});if(!_0x35d4c8)throw new Error(_0xb621('0x5e'));if(_0x35d4c8[_0xb621('0x5f')]===_0xb621('0x5d')){var _0xa5d636=_0x4d8187[_0xb621('0x37')]({'plain':!![]});var _0x47e600=_0xb621('0x38');return db[_0xb621('0x60')][_0xb621('0x61')]({'where':{'name':_0x47e600,'userProfileId':_0x35d4c8[_0xb621('0x62')]},'raw':!![]})[_0xb621('0x21')](function(_0x558216){if(_0x558216&&_0x558216['autoAssociation']===0x0){return db[_0xb621('0x39')][_0xb621('0x5c')]({'name':_0xa5d636['name'],'resourceId':_0xa5d636['id'],'type':_0x558216[_0xb621('0x3c')],'sectionId':_0x558216['id']},{})[_0xb621('0x21')](function(){return _0x4d8187;});}else{return _0x4d8187;}})[_0xb621('0x2b')](function(_0x3f157b){logger[_0xb621('0x27')](_0xb621('0x63'),_0x3f157b);throw _0x3f157b;});}return _0x4d8187;})[_0xb621('0x21')](respondWithResult(_0x11b069,0xc9))[_0xb621('0x2b')](handleError(_0x11b069,null));};exports[_0xb621('0x35')]=function(_0xc7460b,_0x457f8c){if(_0xc7460b[_0xb621('0x64')]['id']){delete _0xc7460b[_0xb621('0x64')]['id'];}return db['SmsAccount'][_0xb621('0x61')]({'where':{'id':_0xc7460b[_0xb621('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xb621('0x3f')}]})['then'](handleEntityNotFound(_0x457f8c,null))[_0xb621('0x21')](saveUpdates(_0xc7460b[_0xb621('0x64')],null))[_0xb621('0x21')](respondWithResult(_0x457f8c,null))[_0xb621('0x2b')](handleError(_0x457f8c,null));};exports[_0xb621('0x36')]=function(_0x58e14e,_0x1646da){return db['SmsAccount'][_0xb621('0x61')]({'where':{'id':_0x58e14e[_0xb621('0x59')]['id']}})['then'](handleEntityNotFound(_0x1646da,null))[_0xb621('0x21')](removeEntity(_0x1646da,null))[_0xb621('0x2b')](handleError(_0x1646da,null));};exports[_0xb621('0x65')]=function(_0x510bd6,_0x2d64ff){return db[_0xb621('0x40')][_0xb621('0x65')]()[_0xb621('0x21')](respondWithResult(_0x2d64ff,null))[_0xb621('0x2b')](handleError(_0x2d64ff,null));};exports[_0xb621('0x66')]=function(_0x401b34,_0x142045,_0x3940d2){if(_0x401b34[_0xb621('0x64')]['id']){delete _0x401b34[_0xb621('0x64')]['id'];}return db[_0xb621('0x40')][_0xb621('0x61')]({'where':{'id':_0x401b34['params']['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x142045,null))[_0xb621('0x21')](function(_0xbbc8d7){if(_0xbbc8d7){_0x401b34[_0xb621('0x64')][_0xb621('0x67')]=_0xbbc8d7['id'];return db[_0xb621('0x68')]['create'](_0x401b34[_0xb621('0x64')]);}})[_0xb621('0x21')](respondWithResult(_0x142045,null))['catch'](handleError(_0x142045,null));};exports['getDispositions']=function(_0x3502f3,_0x5a6ea0,_0x12de1c){var _0x471f95={'raw':![],'where':{}};var _0x3681c1={};var _0x4a4c5f={'count':0x0,'rows':[]};return db[_0xb621('0x40')][_0xb621('0x69')]({'where':{'id':_0x3502f3[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x5a6ea0,null))[_0xb621('0x21')](function(_0x35809f){if(_0x35809f){_0x3681c1['model']=_[_0xb621('0x42')](db['Disposition']['rawAttributes']);_0x3681c1[_0xb621('0x45')]=_[_0xb621('0x42')](_0x3502f3[_0xb621('0x45')]);_0x3681c1[_0xb621('0x43')]=_[_0xb621('0x44')](_0x3681c1[_0xb621('0x41')],_0x3681c1[_0xb621('0x45')]);_0x471f95[_0xb621('0x47')]=_[_0xb621('0x44')](_0x3681c1[_0xb621('0x41')],qs[_0xb621('0x46')](_0x3502f3[_0xb621('0x45')]['fields']));_0x471f95[_0xb621('0x47')]=_0x471f95[_0xb621('0x47')]['length']?_0x471f95[_0xb621('0x47')]:_0x3681c1[_0xb621('0x41')];if(!_0x3502f3[_0xb621('0x45')][_0xb621('0x49')](_0xb621('0x4a'))){_0x471f95[_0xb621('0x2f')]=qs['limit'](_0x3502f3['query'][_0xb621('0x2f')]);_0x471f95[_0xb621('0x2e')]=qs[_0xb621('0x2e')](_0x3502f3[_0xb621('0x45')][_0xb621('0x2e')]);}_0x471f95['order']=qs[_0xb621('0x4c')](_0x3502f3[_0xb621('0x45')]['sort']);_0x471f95[_0xb621('0x4e')]=qs[_0xb621('0x43')](_[_0xb621('0x6a')](_0x3502f3[_0xb621('0x45')],_0x3681c1[_0xb621('0x43')]));_0x471f95[_0xb621('0x4e')]['SmsAccountId']=_0x35809f['id'];if(_0x3502f3[_0xb621('0x45')][_0xb621('0x4d')]){_0x471f95[_0xb621('0x4e')]=_['merge'](_0x471f95[_0xb621('0x4e')],{'$or':_['map'](_0x471f95[_0xb621('0x47')],function(_0x5bbe99){var _0x1a766c={};_0x1a766c[_0x5bbe99]={'$like':'%'+_0x3502f3['query']['filter']+'%'};return _0x1a766c;})});}_0x471f95=_[_0xb621('0x4f')]({},_0x471f95,_0x3502f3[_0xb621('0x53')]);return db[_0xb621('0x68')][_0xb621('0x54')]({'where':_0x471f95[_0xb621('0x4e')]})[_0xb621('0x21')](function(_0x47c14d){_0x4a4c5f['count']=_0x47c14d;if(_0x3502f3[_0xb621('0x45')][_0xb621('0x55')]){_0x471f95[_0xb621('0x5b')]=[{'all':!![]}];}return db[_0xb621('0x68')][_0xb621('0x56')](_0x471f95);})[_0xb621('0x21')](function(_0x55200b){_0x4a4c5f[_0xb621('0x57')]=_0x55200b;return _0x4a4c5f;});}})[_0xb621('0x21')](respondWithFilteredResult(_0x5a6ea0,_0x471f95))['catch'](handleError(_0x5a6ea0,null));};exports[_0xb621('0x6b')]=function(_0x33806d,_0x223519,_0x565b82){return db['SmsAccount'][_0xb621('0x61')]({'where':{'id':_0x33806d[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x223519,null))[_0xb621('0x21')](function(_0x241b9f){if(_0x241b9f){return _0x241b9f[_0xb621('0x6b')](_0x33806d[_0xb621('0x45')][_0xb621('0x6c')]);}})[_0xb621('0x21')](respondWithStatusCode(_0x223519,null))[_0xb621('0x2b')](handleError(_0x223519,null));};exports[_0xb621('0x6d')]=function(_0x26ca52,_0x172bd9,_0x4fc9c7){if(_0x26ca52[_0xb621('0x64')]['id']){delete _0x26ca52[_0xb621('0x64')]['id'];}return db[_0xb621('0x40')][_0xb621('0x61')]({'where':{'id':_0x26ca52[_0xb621('0x59')]['id']}})['then'](handleEntityNotFound(_0x172bd9,null))[_0xb621('0x21')](function(_0x4a2c3c){if(_0x4a2c3c){_0x26ca52[_0xb621('0x64')]['SmsAccountId']=_0x4a2c3c['id'];return db[_0xb621('0x6e')][_0xb621('0x5c')](_0x26ca52[_0xb621('0x64')]);}})[_0xb621('0x21')](respondWithResult(_0x172bd9,null))[_0xb621('0x2b')](handleError(_0x172bd9,null));};exports[_0xb621('0x6f')]=function(_0x23af6e,_0x42d1ed,_0x44a59f){var _0x28961f={'raw':![],'where':{}};var _0x28fadf={};var _0x257e2a={'count':0x0,'rows':[]};return db[_0xb621('0x40')]['findOne']({'where':{'id':_0x23af6e[_0xb621('0x59')]['id']}})['then'](handleEntityNotFound(_0x42d1ed,null))['then'](function(_0xff5eea){if(_0xff5eea){_0x28fadf['model']=_['keys'](db[_0xb621('0x6e')][_0xb621('0x5a')]);_0x28fadf[_0xb621('0x45')]=_['keys'](_0x23af6e[_0xb621('0x45')]);_0x28fadf[_0xb621('0x43')]=_[_0xb621('0x44')](_0x28fadf[_0xb621('0x41')],_0x28fadf[_0xb621('0x45')]);_0x28961f[_0xb621('0x47')]=_[_0xb621('0x44')](_0x28fadf['model'],qs[_0xb621('0x46')](_0x23af6e[_0xb621('0x45')][_0xb621('0x46')]));_0x28961f[_0xb621('0x47')]=_0x28961f[_0xb621('0x47')][_0xb621('0x48')]?_0x28961f[_0xb621('0x47')]:_0x28fadf[_0xb621('0x41')];if(!_0x23af6e['query'][_0xb621('0x49')]('nolimit')){_0x28961f[_0xb621('0x2f')]=qs[_0xb621('0x2f')](_0x23af6e[_0xb621('0x45')]['limit']);_0x28961f['offset']=qs[_0xb621('0x2e')](_0x23af6e[_0xb621('0x45')][_0xb621('0x2e')]);}_0x28961f[_0xb621('0x4b')]=qs[_0xb621('0x4c')](_0x23af6e[_0xb621('0x45')][_0xb621('0x4c')]);_0x28961f['where']=qs['filters'](_['pick'](_0x23af6e['query'],_0x28fadf[_0xb621('0x43')]));_0x28961f['where'][_0xb621('0x67')]=_0xff5eea['id'];if(_0x23af6e['query']['filter']){_0x28961f['where']=_[_0xb621('0x4f')](_0x28961f[_0xb621('0x4e')],{'$or':_[_0xb621('0x50')](_0x28961f['attributes'],function(_0x4c53e8){var _0x2ab2a1={};_0x2ab2a1[_0x4c53e8]={'$like':'%'+_0x23af6e[_0xb621('0x45')][_0xb621('0x4d')]+'%'};return _0x2ab2a1;})});}_0x28961f=_['merge']({},_0x28961f,_0x23af6e[_0xb621('0x53')]);return db[_0xb621('0x6e')][_0xb621('0x54')]({'where':_0x28961f['where']})['then'](function(_0x3dadf6){_0x257e2a[_0xb621('0x54')]=_0x3dadf6;if(_0x23af6e['query'][_0xb621('0x55')]){_0x28961f['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x28961f);})[_0xb621('0x21')](function(_0x57caf1){_0x257e2a['rows']=_0x57caf1;return _0x257e2a;});}})[_0xb621('0x21')](respondWithFilteredResult(_0x42d1ed,_0x28961f))[_0xb621('0x2b')](handleError(_0x42d1ed,null));};exports['removeAnswers']=function(_0x57f5f1,_0x4470e4,_0x1dc45f){return db[_0xb621('0x40')]['find']({'where':{'id':_0x57f5f1[_0xb621('0x59')]['id']}})['then'](handleEntityNotFound(_0x4470e4,null))[_0xb621('0x21')](function(_0x45a640){if(_0x45a640){return _0x45a640[_0xb621('0x70')](_0x57f5f1[_0xb621('0x45')][_0xb621('0x6c')]);}})[_0xb621('0x21')](respondWithStatusCode(_0x4470e4,null))['catch'](handleError(_0x4470e4,null));};exports['notify']=function(_0x85655a,_0x28d1fb,_0x19f996){var _0x2b0332={'channel':'sms'};var _0x1f8a56=[];var _0x3bf03e=[];var _0x87b744={};return db[_0xb621('0x40')]['find']({'where':{'id':_0x85655a[_0xb621('0x59')]['id']},'include':[{'model':db[_0xb621('0x71')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x28d1fb,null))[_0xb621('0x21')](function(_0x30b14c){_0x2b0332['account']=_0x30b14c;_0x2b0332[_0xb621('0x72')]=_[_0xb621('0x73')](_0x30b14c[_0xb621('0x74')],[_0xb621('0x75')],[_0xb621('0x76')]);if(_0x2b0332[_0xb621('0x77')][_0xb621('0x74')]){delete _0x2b0332[_0xb621('0x77')][_0xb621('0x74')];}return db[_0xb621('0x78')][_0xb621('0x65')]();})[_0xb621('0x21')](function(_0x685d8c){if(!_0x685d8c){throw new db[(_0xb621('0x79'))]['ValidationError']('no\x20available\x20attributes');}_0x1f8a56=_[_0xb621('0x7a')](_[_0xb621('0x42')](_0x685d8c),[_0xb621('0x7b'),_0xb621('0x7c')]);_0x3bf03e=_[_0xb621('0x7a')](_['keys'](_0x685d8c),[_0xb621('0x7b'),_0xb621('0x7c'),_0xb621('0x7d'),_0xb621('0x7e')]);_0x2b0332[_0xb621('0x64')]={'mapKey':_0xb621('0x7f')};if(_0x2b0332[_0xb621('0x77')][_0xb621('0x51')]){switch(_0x2b0332[_0xb621('0x77')]['type']){case _0xb621('0x80'):_0x2b0332[_0xb621('0x64')][_0xb621('0x81')]=_0x85655a[_0xb621('0x64')][_0xb621('0x82')];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a[_0xb621('0x64')][_0xb621('0x83')];_0x2b0332[_0xb621('0x64')][_0xb621('0x84')]=_0x85655a[_0xb621('0x64')]['MessageSid'];break;case _0xb621('0x85'):_0x2b0332[_0xb621('0x64')][_0xb621('0x81')]='+'+_0x85655a[_0xb621('0x64')][_0xb621('0x86')];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a[_0xb621('0x64')][_0xb621('0x87')];break;case _0xb621('0x88'):_0x2b0332[_0xb621('0x64')][_0xb621('0x81')]=_0x85655a[_0xb621('0x64')][_0xb621('0x81')];_0x2b0332['body'][_0xb621('0x64')]=_0x85655a[_0xb621('0x64')][_0xb621('0x29')];break;case _0xb621('0x89'):_0x2b0332['body'][_0xb621('0x81')]=_0x85655a[_0xb621('0x64')][_0xb621('0x81')];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a['body'][_0xb621('0x64')];_0x2b0332[_0xb621('0x64')]['messageId']=_0x85655a['body'][_0xb621('0x8a')];break;case _0xb621('0x8b'):_0x2b0332['body']['from']=_0x85655a[_0xb621('0x64')][_0xb621('0x82')];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a[_0xb621('0x64')][_0xb621('0x8c')];_0x2b0332[_0xb621('0x64')][_0xb621('0x84')]=_0x85655a[_0xb621('0x64')][_0xb621('0x8d')];break;case _0xb621('0x8e'):_0x2b0332[_0xb621('0x64')][_0xb621('0x81')]='+'+_0x85655a[_0xb621('0x64')][_0xb621('0x8f')][0x0][_0xb621('0x81')];_0x2b0332[_0xb621('0x64')]['body']=_0x85655a[_0xb621('0x64')][_0xb621('0x8f')][0x0][_0xb621('0x87')];_0x2b0332['body']['messageId']=_0x85655a[_0xb621('0x64')][_0xb621('0x8f')][0x0][_0xb621('0x84')];break;case _0xb621('0x90'):_0x2b0332[_0xb621('0x64')][_0xb621('0x81')]=_0x85655a[_0xb621('0x64')]['originatingAddress'];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a[_0xb621('0x64')]['segmentedMessage'][_0xb621('0x29')];break;case _0xb621('0x91'):_0x2b0332[_0xb621('0x64')][_0xb621('0x81')]=_0x85655a[_0xb621('0x64')]['fromNumber'];_0x2b0332['body'][_0xb621('0x64')]=_0x85655a['body'][_0xb621('0x87')];_0x2b0332['body'][_0xb621('0x84')]=_0x85655a['body'][_0xb621('0x92')];break;case _0xb621('0x93'):_0x2b0332[_0xb621('0x64')][_0xb621('0x84')]=_0x85655a[_0xb621('0x64')][0x0]['message']['id'];_0x2b0332['body'][_0xb621('0x81')]=_0x85655a[_0xb621('0x64')][0x0][_0xb621('0x29')][_0xb621('0x81')];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a[_0xb621('0x64')][0x0][_0xb621('0x29')]['text'];break;case _0xb621('0x94'):_0x2b0332[_0xb621('0x64')]['from']=_0x85655a[_0xb621('0x64')][_0xb621('0x81')];_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]=_0x85655a['body']['message'];_0x2b0332[_0xb621('0x64')]['messageId']=_0x85655a[_0xb621('0x64')]['refid'];break;}}if(_0x2b0332[_0xb621('0x64')]['id']){delete _0x2b0332[_0xb621('0x64')]['id'];}if(_['isNil'](_0x2b0332[_0xb621('0x64')]['from'])){throw new db[(_0xb621('0x79'))][(_0xb621('0x95'))]('from\x20is\x20mandatory');}if(_[_0xb621('0x96')](_0x2b0332[_0xb621('0x64')]['body'])||_0x2b0332[_0xb621('0x64')][_0xb621('0x64')]===''){throw new db[(_0xb621('0x79'))][(_0xb621('0x95'))](_0xb621('0x97'));}if(_['isNil'](_0x2b0332[_0xb621('0x64')][_0xb621('0x98')])){throw new db[(_0xb621('0x79'))]['ValidationError'](_0xb621('0x99')+_0x3bf03e);}if(!_[_0xb621('0x9a')](_0x3bf03e,_0x2b0332[_0xb621('0x64')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3bf03e);}_0x87b744[_0x2b0332['body'][_0xb621('0x98')]]=_0x2b0332[_0xb621('0x64')][_0xb621('0x81')];return db[_0xb621('0x9b')][_0xb621('0x61')]({'where':{'id':_0x2b0332[_0xb621('0x77')][_0xb621('0x7e')]},'include':[{'model':db[_0xb621('0x78')],'as':_0xb621('0x9c'),'where':_0x87b744,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x28d1fb,null))[_0xb621('0x21')](function(_0x1d20e1){if(_0x1d20e1){_0x2b0332[_0xb621('0x9d')]=_[_0xb621('0x9e')](_0x1d20e1,[_0xb621('0x9c')]);if(_0x1d20e1[_0xb621('0x9c')][_0xb621('0x48')]){return _0x1d20e1[_0xb621('0x9c')][0x0];}var _0x268e96=_[_0xb621('0x9f')](_0x2b0332[_0xb621('0x64')],{'firstName':_0x2b0332[_0xb621('0x64')][_0xb621('0x81')],'ListId':_0x1d20e1['id']});_0x268e96[_0x2b0332[_0xb621('0x64')][_0xb621('0x98')]]=_0x2b0332[_0xb621('0x64')][_0xb621('0x81')];return db[_0xb621('0x78')][_0xb621('0x5c')](_0x268e96,{'fields':_0x1f8a56,'raw':!![]});}})[_0xb621('0x21')](handleEntityNotFound(_0x28d1fb,null))[_0xb621('0x21')](function(_0x682916){if(_0x682916){_0x2b0332[_0xb621('0xa0')]=_0x682916;var _0x24f8b7={'ContactId':_0x682916['id'],'phone':_0x2b0332[_0xb621('0x64')][_0xb621('0x81')],'SmsAccountId':_0x85655a[_0xb621('0x59')]['id']};var _0x4f3bab={'ContactId':_0x682916['id'],'SmsAccountId':_0x85655a[_0xb621('0x59')]['id'],'closed':![]};return db[_0xb621('0xa1')][_0xb621('0x61')]({'where':_0x4f3bab})[_0xb621('0x21')](function(_0x189c2d){if(_0x189c2d){return[_0x189c2d,![]];}return db[_0xb621('0xa1')][_0xb621('0x5c')](_0x24f8b7)['then'](function(_0x224d77){return[_0x224d77,!![]];});});}})[_0xb621('0xa2')](function(_0x53b4e6,_0x2aea89){_0x2b0332[_0xb621('0xa3')]=_0x53b4e6['get']({'plain':!![]});_0x2b0332['interaction']['created']=![];if(_0x2aea89){if(_0x2b0332['account']['autoclose']){_0x2b0332[_0xb621('0x72')]['push']({'id':0x0,'priority':_0x2b0332[_0xb621('0x72')][_0xb621('0x48')]+0x1,'app':_0xb621('0xa4'),'appdata':_0xb621('0xa5'),'interval':_0xb621('0xa6')});}_0x2b0332[_0xb621('0xa3')]['created']=!![];}return db[_0xb621('0xa7')][_0xb621('0x5c')]({'phone':_0x2b0332[_0xb621('0x64')][_0xb621('0x81')],'messageId':_0x2b0332['body'][_0xb621('0x84')],'body':_0x2b0332[_0xb621('0x64')]['body'],'SmsAccountId':_0x85655a[_0xb621('0x59')]['id'],'SmsInteractionId':_0x53b4e6['id'],'direction':'in','ContactId':_0x53b4e6[_0xb621('0xa8')],'AttachmentId':_0x2b0332['body'][_0xb621('0xa9')]});})['then'](function(_0x306f5e){_0x2b0332[_0xb621('0x29')]=_0x306f5e;if(!_0x2b0332[_0xb621('0xa3')][_0xb621('0xaa')])return;return db[_0xb621('0xab')][_0xb621('0x61')]({'attributes':['id',_0xb621('0x3c')],'where':{'id':_0x2b0332['interaction'][_0xb621('0xaa')]}});})[_0xb621('0x21')](function(_0x1e5e39){if(_0x1e5e39){_0x2b0332[_0xb621('0x72')][_0xb621('0xac')]({'id':0x0,'priority':0x0,'app':_0xb621('0xad'),'appdata':_0x1e5e39[_0xb621('0x3c')]+','+(_0x2b0332[_0xb621('0x77')][_0xb621('0xae')]||0xa),'interval':_0xb621('0xa6')});}if(!_0x2b0332['interaction'][_0xb621('0xaf')])return;return db[_0xb621('0xb0')][_0xb621('0x61')]({'attributes':['id','name'],'where':{'id':_0x2b0332[_0xb621('0xa3')][_0xb621('0xaf')]}});})['then'](function(_0x299903){if(_0x299903){_0x2b0332['applications'][_0xb621('0xac')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x299903[_0xb621('0x3c')]+','+(_0x2b0332[_0xb621('0x77')][_0xb621('0xb1')]||0x12c),'interval':_0xb621('0xa6')});}return respondWithRpcPromise(_0xb621('0xb2'),_0xb621('0xb3'),_0x2b0332);})[_0xb621('0x21')](function(_0x14d484){if(_0x14d484){var _0x10f6a3=0xc8;var _0x34cc86='receiveMessage';logger['info'](_0xb621('0x25'),_0x34cc86,_0x10f6a3,_0xb621('0xb4'));logger[_0xb621('0xb5')](_0xb621('0xb6'),_0x34cc86,_0x10f6a3,'entity\x20found',JSON[_0xb621('0x26')](_0x14d484));if(_0x2b0332[_0xb621('0x77')][_0xb621('0x51')]===_0xb621('0x80')){return _0x28d1fb[_0xb621('0x2d')](_0x10f6a3)[_0xb621('0x30')](_0xb621('0xb7'),_0xb621('0xb8'))['send'](_0xb621('0xb9'));}else{return _0x28d1fb[_0xb621('0x2d')](_0x10f6a3)[_0xb621('0xba')](_0x14d484);}}})[_0xb621('0x2b')](handleError(_0x28d1fb,null));};exports['addApplications']=function(_0x508d8d,_0x537259){var _0x33091b=_0x508d8d[_0xb621('0x59')]['id'];var _0xf2cc48=_0x508d8d[_0xb621('0x64')];var _0x206bce=0xc8;var _0x57bc94=null;return db[_0xb621('0xbb')]['transaction']({'isolationLevel':db[_0xb621('0xbb')]['Transaction'][_0xb621('0xbc')][_0xb621('0xbd')]},function(_0x3b38a2){return db[_0xb621('0x40')][_0xb621('0x69')]({'where':{'id':_0x33091b},'transaction':_0x3b38a2})[_0xb621('0x21')](function(_0x2bb3df){if(_0x2bb3df){return db[_0xb621('0x71')]['destroy']({'where':{'SmsAccountId':_0x33091b},'transaction':_0x3b38a2})[_0xb621('0x21')](function(){var _0x233c3c=_['map'](_0xf2cc48,function(_0x4ec10c){_0x4ec10c[_0xb621('0x67')]=_0x33091b;return _0x4ec10c;});return db[_0xb621('0x71')][_0xb621('0xbe')](_0x233c3c,{'transaction':_0x3b38a2});});}else{_0x206bce=0x194;_0x57bc94=[];}});})[_0xb621('0x21')](function(){if(_0x206bce!==0x194){return db[_0xb621('0x71')][_0xb621('0xbf')]({'where':{'SmsAccountId':_0x33091b},'order':_0xb621('0x75')})[_0xb621('0x21')](function(_0x202fc3){_0x57bc94=_0x202fc3;});}})['catch'](function(_0x1aeaa7){_0x206bce=0x1f4;logger['error'](_0x1aeaa7[_0xb621('0x3b')]);if(_0x1aeaa7[_0xb621('0x3c')]){delete _0x1aeaa7[_0xb621('0x3c')];}_0x57bc94=_0x1aeaa7;})[_0xb621('0xc0')](function(){if(_0x57bc94===null){_0x537259[_0xb621('0x2c')](_0x206bce);}else{if(_0x206bce===0x1f4){_0x537259[_0xb621('0x2d')](_0x206bce)[_0xb621('0xc1')](_0x57bc94);}else{_0x537259[_0xb621('0x2d')](_0x206bce)[_0xb621('0xba')](_0x57bc94);}}});};exports['getApplications']=function(_0x5a9966,_0x47b0ab,_0x4cb31a){var _0x25eeb1={};var _0x5ea119={};var _0x51515c;var _0x19a934;return db[_0xb621('0x40')][_0xb621('0x69')]({'where':{'id':_0x5a9966[_0xb621('0x59')]['id']}})['then'](handleEntityNotFound(_0x47b0ab,null))['then'](function(_0x5c8e02){if(_0x5c8e02){_0x51515c=_0x5c8e02;_0x5ea119[_0xb621('0x41')]=_['keys'](db[_0xb621('0x71')][_0xb621('0x5a')]);_0x5ea119[_0xb621('0x45')]=_[_0xb621('0x42')](_0x5a9966['query']);_0x5ea119[_0xb621('0x43')]=_['intersection'](_0x5ea119['model'],_0x5ea119['query']);_0x25eeb1[_0xb621('0x47')]=_[_0xb621('0x44')](_0x5ea119[_0xb621('0x41')],qs[_0xb621('0x46')](_0x5a9966['query'][_0xb621('0x46')]));_0x25eeb1[_0xb621('0x47')]=_0x25eeb1['attributes'][_0xb621('0x48')]?_0x25eeb1[_0xb621('0x47')]:_0x5ea119['model'];_0x25eeb1[_0xb621('0x4b')]=qs[_0xb621('0x4c')](_0x5a9966[_0xb621('0x45')][_0xb621('0x4c')]);_0x25eeb1[_0xb621('0x4e')]=qs[_0xb621('0x43')](_[_0xb621('0x6a')](_0x5a9966['query'],_0x5ea119[_0xb621('0x43')]));if(_0x5a9966[_0xb621('0x45')]['filter']){_0x25eeb1[_0xb621('0x4e')]=_[_0xb621('0x4f')](_0x25eeb1[_0xb621('0x4e')],{'$or':_[_0xb621('0x50')](_0x25eeb1[_0xb621('0x47')],function(_0x5cf8f0){var _0x4ca043={};_0x4ca043[_0x5cf8f0]={'$like':'%'+_0x5a9966['query'][_0xb621('0x4d')]+'%'};return _0x4ca043;})});}_0x25eeb1=_[_0xb621('0x4f')]({},_0x25eeb1,_0x5a9966[_0xb621('0x53')]);return _0x51515c[_0xb621('0xc2')](_0x25eeb1);}})[_0xb621('0x21')](function(_0x439afd){if(_0x439afd){_0x19a934=_0x439afd['length'];if(!_0x5a9966[_0xb621('0x45')][_0xb621('0x49')]('nolimit')){_0x25eeb1['limit']=qs[_0xb621('0x2f')](_0x5a9966[_0xb621('0x45')][_0xb621('0x2f')]);_0x25eeb1[_0xb621('0x2e')]=qs[_0xb621('0x2e')](_0x5a9966['query'][_0xb621('0x2e')]);}return _0x51515c[_0xb621('0xc2')](_0x25eeb1);}})['then'](function(_0x5a6bc2){if(_0x5a6bc2){return _0x5a6bc2?{'count':_0x19a934,'rows':_0x5a6bc2}:null;}})[_0xb621('0x21')](respondWithResult(_0x47b0ab,null))[_0xb621('0x2b')](handleError(_0x47b0ab,null));};exports[_0xb621('0xc3')]=function(_0x27bb01,_0x16a629,_0x2fb6ff){var _0x3372bb={'raw':![],'where':{}};var _0x381145={};var _0x1b6285={'count':0x0,'rows':[]};return db[_0xb621('0x40')]['findOne']({'where':{'id':_0x27bb01[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x16a629,null))[_0xb621('0x21')](function(_0x10a395){if(_0x10a395){_0x381145[_0xb621('0x41')]=_[_0xb621('0x42')](db['SmsInteraction'][_0xb621('0x5a')]);_0x381145[_0xb621('0x45')]=_[_0xb621('0x42')](_0x27bb01[_0xb621('0x45')]);_0x381145[_0xb621('0x43')]=_[_0xb621('0x44')](_0x381145[_0xb621('0x41')],_0x381145[_0xb621('0x45')]);_0x3372bb[_0xb621('0x47')]=_[_0xb621('0x44')](_0x381145['model'],qs['fields'](_0x27bb01[_0xb621('0x45')][_0xb621('0x46')]));_0x3372bb[_0xb621('0x47')]=_0x3372bb['attributes'][_0xb621('0x48')]?_0x3372bb[_0xb621('0x47')]:_0x381145[_0xb621('0x41')];if(!_0x27bb01['query'][_0xb621('0x49')](_0xb621('0x4a'))){_0x3372bb['limit']=qs[_0xb621('0x2f')](_0x27bb01['query'][_0xb621('0x2f')]);_0x3372bb[_0xb621('0x2e')]=qs[_0xb621('0x2e')](_0x27bb01[_0xb621('0x45')][_0xb621('0x2e')]);}_0x3372bb[_0xb621('0x4b')]=qs[_0xb621('0x4c')](_0x27bb01[_0xb621('0x45')][_0xb621('0x4c')]);_0x3372bb[_0xb621('0x4e')]=qs[_0xb621('0x43')](_[_0xb621('0x6a')](_0x27bb01['query'],_0x381145['filters']));_0x3372bb['where'][_0xb621('0x67')]=_0x10a395['id'];if(_0x27bb01[_0xb621('0x45')]['filter']){_0x3372bb[_0xb621('0x4e')]=_[_0xb621('0x4f')](_0x3372bb[_0xb621('0x4e')],{'$or':_['map'](_0x3372bb[_0xb621('0x47')],function(_0xc69252){var _0x1db1a6={};_0x1db1a6[_0xc69252]={'$like':'%'+_0x27bb01[_0xb621('0x45')]['filter']+'%'};return _0x1db1a6;})});}_0x3372bb=_[_0xb621('0x4f')]({},_0x3372bb,_0x27bb01[_0xb621('0x53')]);return db[_0xb621('0xa1')]['count']({'where':_0x3372bb[_0xb621('0x4e')]})[_0xb621('0x21')](function(_0x531029){_0x1b6285[_0xb621('0x54')]=_0x531029;if(_0x27bb01[_0xb621('0x45')]['includeAll']){_0x3372bb[_0xb621('0x5b')]=[{'model':db[_0xb621('0x78')],'as':_0xb621('0xc4'),'required':![]},{'model':db['User'],'as':_0xb621('0xc5'),'attributes':[_0xb621('0x3c'),_0xb621('0xc6'),_0xb621('0xc7')],'required':![]},{'model':db['Tag'],'as':_0xb621('0xc8'),'attributes':['id','name',_0xb621('0xc9')],'where':_0x27bb01[_0xb621('0x45')][_0xb621('0xca')]?{'id':_0x27bb01[_0xb621('0x45')][_0xb621('0xca')]}:undefined,'required':_0x27bb01[_0xb621('0x45')][_0xb621('0xca')]?!![]:![]}];}return db[_0xb621('0xa1')]['findAll'](_0x3372bb);})[_0xb621('0x21')](function(_0x1dd11b){_0x1b6285[_0xb621('0x57')]=_0x1dd11b;return _0x1b6285;});}})[_0xb621('0x21')](respondWithFilteredResult(_0x16a629,_0x3372bb))['catch'](handleError(_0x16a629,null));};exports[_0xb621('0xc1')]=function(_0x36b7c5,_0x12bec8,_0x583cb3){var _0x73a966,_0x2f757c,_0x155ea5;if(_[_0xb621('0x96')](_0x36b7c5[_0xb621('0x64')]['body'])||_0x36b7c5[_0xb621('0x64')]['body']===''){throw new db['Sequelize'][(_0xb621('0x95'))](_0xb621('0x97'));}if(_[_0xb621('0x96')](_0x36b7c5['body']['to'])){throw new db[(_0xb621('0x79'))][(_0xb621('0x95'))](_0xb621('0xcb'));}_0x73a966=_0x36b7c5['body']['to'];return db['SmsAccount'][_0xb621('0x61')]({'where':{'id':_0x36b7c5[_0xb621('0x59')]['id']},'include':[{'model':db[_0xb621('0x9b')],'as':_0xb621('0xcc'),'include':[{'model':db[_0xb621('0x78')],'as':'Contacts','where':{'mobile':_0x73a966},'limit':0x1,'order':[[_0xb621('0x7c'),_0xb621('0xcd')]]}]}]})[_0xb621('0x21')](handleEntityNotFound(_0x12bec8,null))[_0xb621('0x21')](function(_0x15b91b){if(_0x15b91b&&_0x15b91b[_0xb621('0xcc')]){_0x2f757c=_0x15b91b[_0xb621('0x37')]({'plain':!![]});if(_0x2f757c[_0xb621('0xcc')]&&_0x2f757c[_0xb621('0xcc')][_0xb621('0x9c')][_0xb621('0x48')]){return _0x2f757c[_0xb621('0xcc')][_0xb621('0x9c')][0x0];}return db[_0xb621('0x78')][_0xb621('0x5c')](_[_0xb621('0x9f')](_0x36b7c5[_0xb621('0x64')],{'firstName':_0x73a966,'mobile':_0x73a966,'phone':_0x73a966,'ListId':_0x2f757c[_0xb621('0x7e')]}));}})['then'](handleEntityNotFound(_0x12bec8,null))[_0xb621('0x21')](function(_0x9a01ed){if(_0x9a01ed){_0x155ea5=_0x9a01ed;return db['SmsInteraction'][_0xb621('0x61')]({'where':{'ContactId':_0x155ea5['id'],'closed':![],'SmsAccountId':_0x2f757c['id']}})[_0xb621('0x21')](function(_0x3d7922){if(_0x3d7922){return[_0x3d7922,![]];}return db[_0xb621('0xa1')][_0xb621('0x5c')]({'UserId':_0x36b7c5[_0xb621('0x5d')]['id'],'ContactId':_0x155ea5['id'],'SmsAccountId':_0x2f757c['id'],'phone':_0x73a966,'firstMsgDirection':_0xb621('0xce'),'Messages':[_[_0xb621('0x4f')](_0x36b7c5[_0xb621('0x64')],{'read':![],'body':_0x36b7c5[_0xb621('0x64')][_0xb621('0x64')],'phone':_0x73a966,'SmsAccountId':_0x2f757c['id'],'UserId':_0x36b7c5[_0xb621('0x5d')]['id'],'ContactId':_0x155ea5['id']})]},{'include':[{'model':db[_0xb621('0xa7')],'as':_0xb621('0xcf')}]})[_0xb621('0x21')](function(_0x3f9d30){return[_0x3f9d30,!![]];});});}})[_0xb621('0xa2')](function(_0x599574,_0x5d47ec){if(_0x5d47ec){return _0x599574;}return db[_0xb621('0xa7')][_0xb621('0x5c')](_['merge'](_0x36b7c5['body'],{'read':![],'body':_0x36b7c5[_0xb621('0x64')][_0xb621('0x64')],'phone':_0x73a966,'SmsAccountId':_0x2f757c['id'],'SmsInteractionId':_0x599574['id'],'UserId':_0x36b7c5[_0xb621('0x5d')]['id'],'ContactId':_0x155ea5['id']}))[_0xb621('0x21')](function(_0x358209){_0x599574['dataValues'][_0xb621('0xcf')]=[];_0x599574[_0xb621('0xd0')]['Messages'][_0xb621('0xd1')](_0x358209[_0xb621('0xd0')]);return _0x599574;});})['then'](respondWithResult(_0x12bec8,null))[_0xb621('0x2b')](handleError(_0x12bec8,null));};exports[_0xb621('0x2d')]=function(_0x3a7d58,_0x35ce48,_0x425ea0){if(_0x3a7d58[_0xb621('0x64')]['id']){delete _0x3a7d58[_0xb621('0x64')]['id'];}var _0x36c173,_0x32ab16,_0x5111c1;return db[_0xb621('0x40')][_0xb621('0x61')]({'where':{'id':_0x3a7d58['params']['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x35ce48,null))['then'](function(_0x316bb9){if(_0x316bb9){_0x5111c1=_0x316bb9;logger[_0xb621('0xb5')](_0xb621('0x25'),_0xb621('0x2d'),_0xb621('0xd2'),_0x316bb9[_0xb621('0x51')],util[_0xb621('0xd3')](_0x3a7d58[_0xb621('0x64')],{'showHidden':![],'depth':null}));switch(_0x316bb9[_0xb621('0x51')]){case _0xb621('0x85'):if(_0x3a7d58[_0xb621('0x64')][_0xb621('0xd4')]&&_0x3a7d58['body']['status']){_0x32ab16=_0x3a7d58[_0xb621('0x64')][_0xb621('0x2d')];return db[_0xb621('0xa7')]['find']({'where':{'messageId':_0x3a7d58['body']['skebby_dispatch_id']}});}break;case'connectel':if(_0x3a7d58[_0xb621('0x64')][_0xb621('0xd5')]&&_0x3a7d58[_0xb621('0x64')]['statusInt']){_0x32ab16=_0x3a7d58[_0xb621('0x64')][_0xb621('0xd6')];return db[_0xb621('0xa7')][_0xb621('0x61')]({'where':{'messageId':_0x3a7d58[_0xb621('0x64')][_0xb621('0xd5')]}});}break;case _0xb621('0x89'):if(_0x3a7d58[_0xb621('0x64')]['message_id']&&_0x3a7d58[_0xb621('0x64')][_0xb621('0xd7')]){_0x32ab16=_0x3a7d58['body'][_0xb621('0xd7')];return db['SmsMessage'][_0xb621('0x61')]({'where':{'messageId':_0x3a7d58[_0xb621('0x64')][_0xb621('0x8a')]}});}break;case'infobip':var _0x3b8397=_0x3a7d58['body'][_0xb621('0x8f')][0x0];if(_0x3b8397[_0xb621('0x84')]&&_0x3b8397['status'][_0xb621('0xd8')]===_0xb621('0xd9')){_0x32ab16=_0x3b8397[_0xb621('0x2d')][_0xb621('0xd8')];return db[_0xb621('0xa7')][_0xb621('0x61')]({'where':{'messageId':_0x3b8397[_0xb621('0x84')]}});}break;case'clickatell':if(_0x3a7d58[_0xb621('0x64')][_0xb621('0x84')]&&_0x3a7d58['body'][_0xb621('0x2d')]){_0x32ab16=_0x3a7d58['body']['status'];return db[_0xb621('0xa7')][_0xb621('0x61')]({'where':{'messageId':_0x3a7d58[_0xb621('0x64')]['messageId']}});}break;case _0xb621('0x93'):if(_0x3a7d58[_0xb621('0x64')][0x0][_0xb621('0x29')]['id']){_0x32ab16=_0x3a7d58[_0xb621('0x64')][0x0][_0xb621('0x51')];return db[_0xb621('0xa7')][_0xb621('0x61')]({'where':{'messageId':_0x3a7d58[_0xb621('0x64')][0x0][_0xb621('0x29')]['id']}});}break;case _0xb621('0x94'):if(_0x3a7d58['body'][_0xb621('0xda')]&&_0x3a7d58[_0xb621('0x64')][_0xb621('0x2d')]){_0x32ab16=_0x3a7d58[_0xb621('0x64')]['status'];return db[_0xb621('0xa7')][_0xb621('0x61')]({'where':{'messageId':_0x3a7d58['body'][_0xb621('0xda')]}});}break;}}})[_0xb621('0x21')](handleEntityNotFound(_0x35ce48,null))[_0xb621('0x21')](function(_0x4b57ed){if(_0x4b57ed){_0x36c173=_0x4b57ed;switch(_0x5111c1['type']){case _0xb621('0x85'):if(_0x32ab16==='DELIVERED'){return _0x36c173['update']({'read':!![]});}else{logger[_0xb621('0x27')](_0xb621('0x25'),_0xb621('0x2d'),_0xb621('0x85'),util['inspect'](_0x3a7d58[_0xb621('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb621('0x88'):if(_0x32ab16==='1'){return _0x36c173['update']({'read':!![]});}else{logger[_0xb621('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb621('0x2d'),_0xb621('0x85'),util['inspect'](_0x3a7d58['body'],{'showHidden':![],'depth':null}));}break;case _0xb621('0x89'):if(!_0x3a7d58[_0xb621('0x64')][_0xb621('0xdb')]&&_0x32ab16>=0xc8&&_0x32ab16<=0xce){return _0x36c173[_0xb621('0x35')]({'read':!![]});}else{logger[_0xb621('0x27')](_0xb621('0x25'),'status','clicksend',util[_0xb621('0xd3')](_0x3a7d58[_0xb621('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb621('0x8e'):var _0x330c29=_0x3a7d58[_0xb621('0x64')][_0xb621('0x8f')][0x0];if(_0x330c29[_0xb621('0x2d')][_0xb621('0xd8')]===_0xb621('0xd9')){return _0x36c173['update']({'read':!![]});}else{logger['error'](_0xb621('0x25'),_0xb621('0x2d'),_0xb621('0x8e'),util[_0xb621('0xd3')](_0x3a7d58[_0xb621('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb621('0x91'):if(_0x32ab16==_0xb621('0xdc')||_0x32ab16==_0xb621('0xdd')){return _0x36c173[_0xb621('0x35')]({'read':!![]});}else{logger['error'](_0xb621('0x25'),_0xb621('0x2d'),_0xb621('0x91'),util[_0xb621('0xd3')](_0x3a7d58[_0xb621('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb621('0x93'):if(_0x32ab16==_0xb621('0xde')){return _0x36c173[_0xb621('0x35')]({'read':!![]});}else{logger[_0xb621('0x27')](_0xb621('0x25'),_0xb621('0x2d'),_0xb621('0x93'),util[_0xb621('0xd3')](_0x3a7d58['body'],{'showHidden':![],'depth':null}));}break;case _0xb621('0x94'):if(_0x32ab16===_0xb621('0xdf')||_0x32ab16===_0xb621('0xe0')){return _0x36c173[_0xb621('0x35')]({'read':!![]});}else{logger[_0xb621('0x27')](_0xb621('0x25'),'status',_0xb621('0x94'),util[_0xb621('0xd3')](_0x3a7d58[_0xb621('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x36c173;}})['then'](respondWithResult(_0x35ce48,null))[_0xb621('0x2b')](handleError(_0x35ce48,null));};exports[_0xb621('0xe1')]=function(_0x22c120,_0x1a8927,_0x28d7f8){var _0x3121c0,_0x12cc51,_0x18bc81;return db['SmsAccount'][_0xb621('0x61')]({'where':{'id':_0x22c120[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x1a8927,null))['then'](function(_0x557c3b){if(_0x557c3b){_0x18bc81=_0x557c3b;logger[_0xb621('0xb5')](_0xb621('0x25'),_0xb621('0x2d'),'received\x20delivery\x20report\x20from',_0x557c3b['type'],util['inspect'](_0x22c120['query'],{'showHidden':![],'depth':null}));switch(_0x557c3b[_0xb621('0x51')]){case'csc':if(_0x22c120['query'][_0xb621('0xe2')]&&_0x22c120[_0xb621('0x45')][_0xb621('0xe3')]){_0x12cc51=_0x22c120['query'][_0xb621('0xe3')];return db[_0xb621('0xa7')][_0xb621('0x61')]({'where':{'messageId':_0x22c120[_0xb621('0x45')][_0xb621('0xe2')]}});}break;}}})[_0xb621('0x21')](handleEntityNotFound(_0x1a8927,null))[_0xb621('0x21')](function(_0x33d0de){if(_0x33d0de){_0x3121c0=_0x33d0de;switch(_0x18bc81['type']){case _0xb621('0x90'):if(_0x12cc51==='2'||_0x12cc51==='6'){return _0x3121c0[_0xb621('0x35')]({'read':!![]});}else{logger['error'](_0xb621('0x25'),_0xb621('0x2d'),_0xb621('0x90'),util[_0xb621('0xd3')](_0x22c120[_0xb621('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x3121c0;}})['then'](respondWithResult(_0x1a8927,null))[_0xb621('0x2b')](handleError(_0x1a8927,null));};exports[_0xb621('0xe4')]=function(_0x3e40b5,_0x30323b,_0x3fd698){return db[_0xb621('0x40')]['find']({'where':{'id':_0x3e40b5[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x30323b,null))[_0xb621('0x21')](function(_0x568cd3){if(_0x568cd3){return _0x568cd3[_0xb621('0xe4')](_0x3e40b5[_0xb621('0x64')][_0xb621('0x6c')],_[_0xb621('0x9e')](_0x3e40b5['body'],['ids','id'])||{})[_0xb621('0xa2')](function(_0x17bb2a){for(var _0xb872ef=0x0;_0xb872ef<_0x3e40b5[_0xb621('0x64')][_0xb621('0x6c')]['length'];_0xb872ef+=0x1){socket[_0xb621('0xe5')](_0xb621('0xe6'),{'UserId':Number(_0x3e40b5[_0xb621('0x64')][_0xb621('0x6c')][_0xb872ef]),'SmsAccountId':Number(_0x3e40b5[_0xb621('0x59')]['id'])});}return _0x17bb2a;});}})[_0xb621('0x21')](respondWithResult(_0x30323b,null))[_0xb621('0x2b')](handleError(_0x30323b,null));};exports[_0xb621('0xe7')]=function(_0x4d75a0,_0x28ab90,_0x413786){return db['SmsAccount'][_0xb621('0x61')]({'where':{'id':_0x4d75a0[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x28ab90,null))[_0xb621('0x21')](function(_0x10039b){if(_0x10039b){return _0x10039b[_0xb621('0xe7')](_0x4d75a0[_0xb621('0x45')]['ids'])['then'](function(){if(_['isArray'](_0x4d75a0[_0xb621('0x45')]['ids'])){for(var _0x4bbc88=0x0;_0x4bbc88<_0x4d75a0[_0xb621('0x45')][_0xb621('0x6c')][_0xb621('0x48')];_0x4bbc88+=0x1){socket[_0xb621('0xe5')](_0xb621('0xe8'),{'UserId':Number(_0x4d75a0[_0xb621('0x45')][_0xb621('0x6c')][_0x4bbc88]),'SmsAccountId':Number(_0x4d75a0['params']['id'])});}}else{socket['emit'](_0xb621('0xe8'),{'UserId':Number(_0x4d75a0['query'][_0xb621('0x6c')]),'SmsAccountId':Number(_0x4d75a0['params']['id'])});}});}})[_0xb621('0x21')](respondWithStatusCode(_0x28ab90,null))[_0xb621('0x2b')](handleError(_0x28ab90,null));};exports['getAgents']=function(_0x2686e2,_0x4b8cd1,_0x52f3a7){var _0x12ab84={};var _0x112061={};var _0x1b9cb8;var _0x34aeaa;return db[_0xb621('0x40')][_0xb621('0x69')]({'where':{'id':_0x2686e2[_0xb621('0x59')]['id']}})[_0xb621('0x21')](handleEntityNotFound(_0x4b8cd1,null))[_0xb621('0x21')](function(_0x2879b1){if(_0x2879b1){_0x1b9cb8=_0x2879b1;_0x112061[_0xb621('0x41')]=_['keys'](db[_0xb621('0xab')]['rawAttributes']);_0x112061[_0xb621('0x45')]=_[_0xb621('0x42')](_0x2686e2['query']);_0x112061[_0xb621('0x43')]=_[_0xb621('0x44')](_0x112061['model'],_0x112061[_0xb621('0x45')]);_0x12ab84[_0xb621('0x47')]=_['intersection'](_0x112061[_0xb621('0x41')],qs[_0xb621('0x46')](_0x2686e2[_0xb621('0x45')]['fields']));_0x12ab84[_0xb621('0x47')]=_0x12ab84[_0xb621('0x47')][_0xb621('0x48')]?_0x12ab84['attributes']:_0x112061[_0xb621('0x41')];_0x12ab84[_0xb621('0x4b')]=qs['sort'](_0x2686e2['query'][_0xb621('0x4c')]);_0x12ab84[_0xb621('0x4e')]=qs[_0xb621('0x43')](_[_0xb621('0x6a')](_0x2686e2[_0xb621('0x45')],_0x112061[_0xb621('0x43')]));if(_0x2686e2[_0xb621('0x45')][_0xb621('0x4d')]){_0x12ab84['where']=_[_0xb621('0x4f')](_0x12ab84[_0xb621('0x4e')],{'$or':_[_0xb621('0x50')](_0x12ab84['attributes'],function(_0x2a30f9){var _0x41dfa2={};_0x41dfa2[_0x2a30f9]={'$like':'%'+_0x2686e2['query'][_0xb621('0x4d')]+'%'};return _0x41dfa2;})});}_0x12ab84=_[_0xb621('0x4f')]({},_0x12ab84,_0x2686e2[_0xb621('0x53')]);return _0x1b9cb8['getAgents'](_0x12ab84);}})[_0xb621('0x21')](function(_0x486f9f){if(_0x486f9f){_0x34aeaa=_0x486f9f['length'];if(!_0x2686e2['query']['hasOwnProperty'](_0xb621('0x4a'))){_0x12ab84[_0xb621('0x2f')]=qs['limit'](_0x2686e2[_0xb621('0x45')][_0xb621('0x2f')]);_0x12ab84['offset']=qs[_0xb621('0x2e')](_0x2686e2[_0xb621('0x45')]['offset']);}return _0x1b9cb8[_0xb621('0xe9')](_0x12ab84);}})[_0xb621('0x21')](function(_0x612ec3){if(_0x612ec3){return _0x612ec3?{'count':_0x34aeaa,'rows':_0x612ec3}:null;}})['then'](respondWithResult(_0x4b8cd1,null))[_0xb621('0x2b')](handleError(_0x4b8cd1,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5de65c7..485599c 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 _0x4d49=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x4d49,0x140));var _0x94d4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4d49[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x94d4('0x0'));var SmsAccount=require(_0x94d4('0x1'))['db'][_0x94d4('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x94d4('0x3')](0x0);var events={'afterCreate':_0x94d4('0x4'),'afterUpdate':_0x94d4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38e584){return function(_0x2e1310,_0x3d226d,_0x5660ba){SmsAccountEvents[_0x94d4('0x6')](_0x38e584+':'+_0x2e1310['id'],_0x2e1310);SmsAccountEvents[_0x94d4('0x6')](_0x38e584,_0x2e1310);_0x5660ba(null);};}for(var e in events){if(events[_0x94d4('0x7')](e)){var event=events[e];SmsAccount[_0x94d4('0x8')](e,emitEvent(event));}}module[_0x94d4('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x7400=['hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x7400,0x161));var _0x0740=function(_0x28de32,_0x242d8b){_0x28de32=_0x28de32-0x0;var _0x5ec7a8=_0x7400[_0x28de32];return _0x5ec7a8;};'use strict';var EventEmitter=require(_0x0740('0x0'));var SmsAccount=require(_0x0740('0x1'))['db'][_0x0740('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0740('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0740('0x4'),'afterDestroy':_0x0740('0x5')};function emitEvent(_0x2d7752){return function(_0x4f92e4,_0x4e50e1,_0x159bbf){SmsAccountEvents[_0x0740('0x6')](_0x2d7752+':'+_0x4f92e4['id'],_0x4f92e4);SmsAccountEvents['emit'](_0x2d7752,_0x4f92e4);_0x159bbf(null);};}for(var e in events){if(events[_0x0740('0x7')](e)){var event=events[e];SmsAccount[_0x0740('0x8')](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 1075e01..0602bb6 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 _0x3c05=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x3c05,0x120));var _0x53c0=function(_0x16c374,_0x26a617){_0x16c374=_0x16c374-0x0;var _0x1c8ec3=_0x3c05[_0x16c374];return _0x1c8ec3;};'use strict';var _=require(_0x53c0('0x0'));var util=require(_0x53c0('0x1'));var logger=require(_0x53c0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x53c0('0x3'));var rp=require(_0x53c0('0x4'));var fs=require('fs');var path=require(_0x53c0('0x5'));var rimraf=require(_0x53c0('0x6'));var config=require(_0x53c0('0x7'));var attributes=require(_0x53c0('0x8'));module['exports']=function(_0x23a1c8,_0x126f78){return _0x23a1c8[_0x53c0('0x9')](_0x53c0('0xa'),attributes,{'tableName':_0x53c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e4a=['request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x591bdb,_0x2a891b){var _0x5da14e=function(_0x1f9168){while(--_0x1f9168){_0x591bdb['push'](_0x591bdb['shift']());}};_0x5da14e(++_0x2a891b);}(_0x6e4a,0xa3));var _0xa6e4=function(_0x36f4b2,_0x4e8b9d){_0x36f4b2=_0x36f4b2-0x0;var _0x3e70c6=_0x6e4a[_0x36f4b2];return _0x3e70c6;};'use strict';var _=require(_0xa6e4('0x0'));var util=require(_0xa6e4('0x1'));var logger=require(_0xa6e4('0x2'))(_0xa6e4('0x3'));var moment=require(_0xa6e4('0x4'));var BPromise=require(_0xa6e4('0x5'));var rp=require(_0xa6e4('0x6'));var fs=require('fs');var path=require(_0xa6e4('0x7'));var rimraf=require('rimraf');var config=require(_0xa6e4('0x8'));var attributes=require(_0xa6e4('0x9'));module['exports']=function(_0x1d7e03,_0x56573c){return _0x1d7e03[_0xa6e4('0xa')](_0xa6e4('0xb'),attributes,{'tableName':_0xa6e4('0xc'),'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 010b933..7a19578 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 _0xd69f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','find','options','raw','attributes','include','map','model','then','stringify','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x1429e8,_0x4a3cba){var _0x19ed9a=function(_0x5929){while(--_0x5929){_0x1429e8['push'](_0x1429e8['shift']());}};_0x19ed9a(++_0x4a3cba);}(_0xd69f,0xd9));var _0xfd69=function(_0x2e3eda,_0x12fd3d){_0x2e3eda=_0x2e3eda-0x0;var _0x423a68=_0xd69f[_0x2e3eda];return _0x423a68;};'use strict';var _=require('lodash');var util=require(_0xfd69('0x0'));var moment=require(_0xfd69('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd69('0x2'));var db=require(_0xfd69('0x3'))['db'];var utils=require(_0xfd69('0x4'));var logger=require(_0xfd69('0x5'))(_0xfd69('0x6'));var config=require(_0xfd69('0x7'));var jayson=require(_0xfd69('0x8'));var client=jayson[_0xfd69('0x9')][_0xfd69('0xa')]({'port':0x232a});config[_0xfd69('0xb')]=_['defaults'](config[_0xfd69('0xb')],{'host':_0xfd69('0xc'),'port':0x18eb});var socket=require(_0xfd69('0xd'))(new Redis(config['redis']));require(_0xfd69('0xe'))[_0xfd69('0xf')](socket);function respondWithRpcPromise(_0x216bd0,_0x4b6b6c,_0x45f269){return new BPromise(function(_0x7ee6d7,_0x373d98){return client[_0xfd69('0x10')](_0x216bd0,_0x45f269)['then'](function(_0x3fd620){logger[_0xfd69('0x11')](_0xfd69('0x12'),_0x4b6b6c,_0xfd69('0x13'));logger[_0xfd69('0x14')](_0xfd69('0x15'),_0x4b6b6c,_0xfd69('0x13'),JSON['stringify'](_0x3fd620));if(_0x3fd620[_0xfd69('0x16')]){if(_0x3fd620[_0xfd69('0x16')][_0xfd69('0x17')]===0x1f4){logger[_0xfd69('0x16')](_0xfd69('0x12'),_0x4b6b6c,_0x3fd620['error'][_0xfd69('0x18')]);return _0x373d98(_0x3fd620[_0xfd69('0x16')][_0xfd69('0x18')]);}logger[_0xfd69('0x16')](_0xfd69('0x12'),_0x4b6b6c,_0x3fd620['error']['message']);return _0x7ee6d7(_0x3fd620[_0xfd69('0x16')][_0xfd69('0x18')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x4b6b6c,'request\x20sent');_0x7ee6d7(_0x3fd620[_0xfd69('0x19')]['message']);}})[_0xfd69('0x1a')](function(_0x21a1c0){logger[_0xfd69('0x16')](_0xfd69('0x12'),_0x4b6b6c,_0x21a1c0);_0x373d98(_0x21a1c0);});});}exports[_0xfd69('0x1b')]=function(_0x4bef3c){var _0x59bbd0=this;return new Promise(function(_0x1fa486,_0x363011){return db['SmsAccount'][_0xfd69('0x1c')]({'raw':_0x4bef3c[_0xfd69('0x1d')]?_0x4bef3c[_0xfd69('0x1d')][_0xfd69('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bef3c[_0xfd69('0x1d')]?_0x4bef3c[_0xfd69('0x1d')]['where']||null:null,'attributes':_0x4bef3c[_0xfd69('0x1d')]?_0x4bef3c[_0xfd69('0x1d')][_0xfd69('0x1f')]||null:null,'include':_0x4bef3c[_0xfd69('0x1d')]?_0x4bef3c[_0xfd69('0x1d')][_0xfd69('0x20')]?_[_0xfd69('0x21')](_0x4bef3c[_0xfd69('0x1d')]['include'],function(_0x101baa){return{'model':db[_0x101baa['model']],'as':_0x101baa['as'],'attributes':_0x101baa['attributes'],'include':_0x101baa[_0xfd69('0x20')]?_[_0xfd69('0x21')](_0x101baa[_0xfd69('0x20')],function(_0x5e41f5){return{'model':db[_0x5e41f5[_0xfd69('0x22')]],'as':_0x5e41f5['as'],'attributes':_0x5e41f5[_0xfd69('0x1f')],'include':_0x5e41f5['include']?_['map'](_0x5e41f5[_0xfd69('0x20')],function(_0x47d320){return{'model':db[_0x47d320[_0xfd69('0x22')]],'as':_0x47d320['as'],'attributes':_0x47d320[_0xfd69('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfd69('0x23')](function(_0x4fa836){logger[_0xfd69('0x11')](_0xfd69('0x1b'),_0x4bef3c);logger[_0xfd69('0x14')](_0xfd69('0x1b'),_0x4bef3c,JSON[_0xfd69('0x24')](_0x4fa836));_0x1fa486(_0x4fa836);})[_0xfd69('0x1a')](function(_0x343ceb){logger[_0xfd69('0x16')](_0xfd69('0x1b'),_0x343ceb[_0xfd69('0x18')],_0x4bef3c);_0x363011(_0x59bbd0[_0xfd69('0x16')](0x1f4,_0x343ceb[_0xfd69('0x18')]));});});}; \ No newline at end of file +var _0xbc0e=['attributes','model','ShowSmsAccount','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','options','raw','where','include','map'];(function(_0x5219e4,_0x50cdef){var _0x390418=function(_0x589678){while(--_0x589678){_0x5219e4['push'](_0x5219e4['shift']());}};_0x390418(++_0x50cdef);}(_0xbc0e,0x1d9));var _0xebc0=function(_0x3215c8,_0x7af716){_0x3215c8=_0x3215c8-0x0;var _0x4744e4=_0xbc0e[_0x3215c8];return _0x4744e4;};'use strict';var _=require(_0xebc0('0x0'));var util=require(_0xebc0('0x1'));var moment=require(_0xebc0('0x2'));var BPromise=require(_0xebc0('0x3'));var rs=require(_0xebc0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebc0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xebc0('0x6'))(_0xebc0('0x7'));var config=require(_0xebc0('0x8'));var jayson=require(_0xebc0('0x9'));var client=jayson[_0xebc0('0xa')]['http']({'port':0x232a});config[_0xebc0('0xb')]=_[_0xebc0('0xc')](config[_0xebc0('0xb')],{'host':_0xebc0('0xd'),'port':0x18eb});var socket=require(_0xebc0('0xe'))(new Redis(config[_0xebc0('0xb')]));require('./smsAccount.socket')[_0xebc0('0xf')](socket);function respondWithRpcPromise(_0x34eea6,_0x230e7a,_0x21b20d){return new BPromise(function(_0x135169,_0x553195){return client['request'](_0x34eea6,_0x21b20d)[_0xebc0('0x10')](function(_0x1008b8){logger[_0xebc0('0x11')]('SmsAccount,\x20%s,\x20%s',_0x230e7a,_0xebc0('0x12'));logger['debug'](_0xebc0('0x13'),_0x230e7a,_0xebc0('0x12'),JSON[_0xebc0('0x14')](_0x1008b8));if(_0x1008b8[_0xebc0('0x15')]){if(_0x1008b8[_0xebc0('0x15')][_0xebc0('0x16')]===0x1f4){logger[_0xebc0('0x15')](_0xebc0('0x17'),_0x230e7a,_0x1008b8[_0xebc0('0x15')][_0xebc0('0x18')]);return _0x553195(_0x1008b8[_0xebc0('0x15')]['message']);}logger['error'](_0xebc0('0x17'),_0x230e7a,_0x1008b8[_0xebc0('0x15')][_0xebc0('0x18')]);return _0x135169(_0x1008b8[_0xebc0('0x15')][_0xebc0('0x18')]);}else{logger[_0xebc0('0x11')](_0xebc0('0x17'),_0x230e7a,_0xebc0('0x12'));_0x135169(_0x1008b8[_0xebc0('0x19')][_0xebc0('0x18')]);}})['catch'](function(_0x5b2c95){logger[_0xebc0('0x15')]('SmsAccount,\x20%s,\x20%s',_0x230e7a,_0x5b2c95);_0x553195(_0x5b2c95);});});}exports['ShowSmsAccount']=function(_0x188675){var _0x512248=this;return new Promise(function(_0x9a98a1,_0x4af504){return db['SmsAccount']['find']({'raw':_0x188675[_0xebc0('0x1a')]?_0x188675[_0xebc0('0x1a')][_0xebc0('0x1b')]===undefined?!![]:![]:!![],'where':_0x188675[_0xebc0('0x1a')]?_0x188675['options'][_0xebc0('0x1c')]||null:null,'attributes':_0x188675[_0xebc0('0x1a')]?_0x188675['options']['attributes']||null:null,'include':_0x188675[_0xebc0('0x1a')]?_0x188675[_0xebc0('0x1a')][_0xebc0('0x1d')]?_[_0xebc0('0x1e')](_0x188675['options'][_0xebc0('0x1d')],function(_0x100b08){return{'model':db[_0x100b08['model']],'as':_0x100b08['as'],'attributes':_0x100b08[_0xebc0('0x1f')],'include':_0x100b08['include']?_[_0xebc0('0x1e')](_0x100b08[_0xebc0('0x1d')],function(_0x191864){return{'model':db[_0x191864[_0xebc0('0x20')]],'as':_0x191864['as'],'attributes':_0x191864[_0xebc0('0x1f')],'include':_0x191864[_0xebc0('0x1d')]?_[_0xebc0('0x1e')](_0x191864[_0xebc0('0x1d')],function(_0x5abc1e){return{'model':db[_0x5abc1e[_0xebc0('0x20')]],'as':_0x5abc1e['as'],'attributes':_0x5abc1e[_0xebc0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xebc0('0x10')](function(_0x34c49d){logger[_0xebc0('0x11')](_0xebc0('0x21'),_0x188675);logger[_0xebc0('0x22')]('ShowSmsAccount',_0x188675,JSON[_0xebc0('0x14')](_0x34c49d));_0x9a98a1(_0x34c49d);})[_0xebc0('0x23')](function(_0x465785){logger[_0xebc0('0x15')](_0xebc0('0x21'),_0x465785[_0xebc0('0x18')],_0x188675);_0x4af504(_0x512248['error'](0x1f4,_0x465785['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index dd5b160..801feed 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 08509d7..1e420a8 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(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52aec5,_0x49e60d){var _0x4c23dd=function(_0x40eff2){while(--_0x40eff2){_0x52aec5['push'](_0x52aec5['shift']());}};_0x4c23dd(++_0x49e60d);}(_0x34e8,0x12c));var _0x834e=function(_0x513d20,_0x5d2dee){_0x513d20=_0x513d20-0x0;var _0x493f6f=_0x34e8[_0x513d20];return _0x493f6f;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f8808b4..58b9a86 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 _0x9b5a=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x9b5a,0x14f));var _0xa9b5=function(_0x4268db,_0x2bf066){_0x4268db=_0x4268db-0x0;var _0x36f4b1=_0x9b5a[_0x4268db];return _0x36f4b1;};'use strict';var Sequelize=require(_0xa9b5('0x0'));module[_0xa9b5('0x1')]={'priority':{'type':Sequelize[_0xa9b5('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa9b5('0x3')},'appdata':{'type':Sequelize[_0xa9b5('0x4')]()},'description':{'type':Sequelize[_0xa9b5('0x5')]},'interval':{'type':Sequelize[_0xa9b5('0x5')],'defaultValue':_0xa9b5('0x6')}}; \ No newline at end of file +var _0x78ce=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x28aa34,_0x474747){var _0x274fa7=function(_0x580cdf){while(--_0x580cdf){_0x28aa34['push'](_0x28aa34['shift']());}};_0x274fa7(++_0x474747);}(_0x78ce,0x157));var _0xe78c=function(_0x279095,_0x15f37e){_0x279095=_0x279095-0x0;var _0x5a5cdb=_0x78ce[_0x279095];return _0x5a5cdb;};'use strict';var Sequelize=require(_0xe78c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe78c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe78c('0x2')],'allowNull':![],'defaultValue':_0xe78c('0x3')},'appdata':{'type':Sequelize[_0xe78c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe78c('0x2')],'defaultValue':_0xe78c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 070b811..7765c32 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 _0x3692=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsApplication','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3692,0x82));var _0x2369=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x3692[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0x2369('0x0'));var rimraf=require(_0x2369('0x1'));var zipdir=require(_0x2369('0x2'));var jsonpatch=require(_0x2369('0x3'));var rp=require(_0x2369('0x4'));var moment=require('moment');var BPromise=require(_0x2369('0x5'));var Mustache=require(_0x2369('0x6'));var util=require(_0x2369('0x7'));var path=require(_0x2369('0x8'));var sox=require('sox');var csv=require(_0x2369('0x9'));var ejs=require(_0x2369('0xa'));var fs=require('fs');var fs_extra=require(_0x2369('0xb'));var _=require('lodash');var squel=require(_0x2369('0xc'));var crypto=require(_0x2369('0xd'));var jsforce=require(_0x2369('0xe'));var deskjs=require(_0x2369('0xf'));var toCsv=require(_0x2369('0x9'));var querystring=require('querystring');var Papa=require(_0x2369('0x10'));var Redis=require(_0x2369('0x11'));var authService=require(_0x2369('0x12'));var qs=require(_0x2369('0x13'));var as=require(_0x2369('0x14'));var hardwareService=require(_0x2369('0x15'));var logger=require(_0x2369('0x16'))(_0x2369('0x17'));var utils=require(_0x2369('0x18'));var config=require(_0x2369('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5adb7e,_0x2b94a4){_0x2b94a4=_0x2b94a4||0xcc;return function(_0x578a75){if(_0x578a75){return _0x5adb7e[_0x2369('0x1a')](_0x2b94a4);}return _0x5adb7e[_0x2369('0x1b')](_0x2b94a4)[_0x2369('0x1c')]();};}function respondWithResult(_0x432404,_0x2a6d4e){_0x2a6d4e=_0x2a6d4e||0xc8;return function(_0x1d9d44){if(_0x1d9d44){return _0x432404[_0x2369('0x1b')](_0x2a6d4e)[_0x2369('0x1d')](_0x1d9d44);}};}function respondWithFilteredResult(_0x1dfd73,_0x53dad9){return function(_0x1bb4e1){if(_0x1bb4e1){var _0x20a3fc=typeof _0x53dad9['offset']===_0x2369('0x1e')&&typeof _0x53dad9[_0x2369('0x1f')]==='undefined';var _0x5646a3=_0x1bb4e1[_0x2369('0x20')];var _0x265a78=_0x20a3fc?0x0:_0x53dad9[_0x2369('0x21')];var _0xcb1a66=_0x20a3fc?_0x1bb4e1['count']:_0x53dad9['offset']+_0x53dad9[_0x2369('0x1f')];var _0x3505f4;if(_0xcb1a66>=_0x5646a3){_0xcb1a66=_0x5646a3;_0x3505f4=0xc8;}else{_0x3505f4=0xce;}_0x1dfd73[_0x2369('0x1b')](_0x3505f4);return _0x1dfd73[_0x2369('0x22')](_0x2369('0x23'),_0x265a78+'-'+_0xcb1a66+'/'+_0x5646a3)['json'](_0x1bb4e1);}return null;};}function patchUpdates(_0xfca2d2){return function(_0x90c9f1){try{jsonpatch[_0x2369('0x24')](_0x90c9f1,_0xfca2d2,!![]);}catch(_0x3fdba9){return BPromise[_0x2369('0x25')](_0x3fdba9);}return _0x90c9f1[_0x2369('0x26')]();};}function saveUpdates(_0x347721,_0x589743){return function(_0x3f8853){if(_0x3f8853){return _0x3f8853[_0x2369('0x27')](_0x347721)[_0x2369('0x28')](function(_0x5df88f){return _0x5df88f;});}return null;};}function removeEntity(_0x23594e,_0x5ba88d){return function(_0x386284){if(_0x386284){return _0x386284[_0x2369('0x29')]()[_0x2369('0x28')](function(){_0x23594e[_0x2369('0x1b')](0xcc)[_0x2369('0x1c')]();});}};}function handleEntityNotFound(_0x424f10,_0x112d07){return function(_0x18d55e){if(!_0x18d55e){_0x424f10[_0x2369('0x1a')](0x194);}return _0x18d55e;};}function handleError(_0x4b8cc3,_0x39995b){_0x39995b=_0x39995b||0x1f4;return function(_0x52c1f3){logger[_0x2369('0x2a')](_0x52c1f3[_0x2369('0x2b')]);if(_0x52c1f3[_0x2369('0x2c')]){delete _0x52c1f3[_0x2369('0x2c')];}_0x4b8cc3['status'](_0x39995b)['send'](_0x52c1f3);};}exports[_0x2369('0x2d')]=function(_0x4bae5a,_0x3f2f41){var _0x1f4f01={},_0x1495cf={},_0x1e8133={'count':0x0,'rows':[]};var _0xd08c58=_[_0x2369('0x2e')](db[_0x2369('0x2f')]['rawAttributes'],function(_0x1a0d1c){return{'name':_0x1a0d1c['fieldName'],'type':_0x1a0d1c[_0x2369('0x30')]['key']};});_0x1495cf[_0x2369('0x31')]=_[_0x2369('0x2e')](_0xd08c58,_0x2369('0x2c'));_0x1495cf[_0x2369('0x32')]=_['keys'](_0x4bae5a[_0x2369('0x32')]);_0x1495cf[_0x2369('0x33')]=_[_0x2369('0x34')](_0x1495cf[_0x2369('0x31')],_0x1495cf[_0x2369('0x32')]);_0x1f4f01[_0x2369('0x35')]=_[_0x2369('0x34')](_0x1495cf[_0x2369('0x31')],qs[_0x2369('0x36')](_0x4bae5a[_0x2369('0x32')]['fields']));_0x1f4f01[_0x2369('0x35')]=_0x1f4f01[_0x2369('0x35')][_0x2369('0x37')]?_0x1f4f01['attributes']:_0x1495cf['model'];if(!_0x4bae5a[_0x2369('0x32')]['hasOwnProperty'](_0x2369('0x38'))){_0x1f4f01['limit']=qs[_0x2369('0x1f')](_0x4bae5a[_0x2369('0x32')][_0x2369('0x1f')]);_0x1f4f01[_0x2369('0x21')]=qs[_0x2369('0x21')](_0x4bae5a[_0x2369('0x32')]['offset']);}_0x1f4f01['order']=qs['sort'](_0x4bae5a['query'][_0x2369('0x39')]);_0x1f4f01['where']=qs[_0x2369('0x33')](_[_0x2369('0x3a')](_0x4bae5a[_0x2369('0x32')],_0x1495cf[_0x2369('0x33')]),_0xd08c58);if(_0x4bae5a[_0x2369('0x32')][_0x2369('0x3b')]){_0x1f4f01[_0x2369('0x3c')]=_['merge'](_0x1f4f01[_0x2369('0x3c')],{'$or':_[_0x2369('0x2e')](_0xd08c58,function(_0x4d4f50){if(_0x4d4f50['type']!==_0x2369('0x3d')){var _0x5e501b={};_0x5e501b[_0x4d4f50[_0x2369('0x2c')]]={'$like':'%'+_0x4bae5a[_0x2369('0x32')][_0x2369('0x3b')]+'%'};return _0x5e501b;}})});}_0x1f4f01=_[_0x2369('0x3e')]({},_0x1f4f01,_0x4bae5a['options']);var _0x552ef3={'where':_0x1f4f01[_0x2369('0x3c')]};return db['SmsApplication'][_0x2369('0x20')](_0x552ef3)[_0x2369('0x28')](function(_0x3d2b62){_0x1e8133[_0x2369('0x20')]=_0x3d2b62;if(_0x4bae5a[_0x2369('0x32')][_0x2369('0x3f')]){_0x1f4f01[_0x2369('0x40')]=[{'all':!![]}];}return db[_0x2369('0x2f')]['findAll'](_0x1f4f01);})[_0x2369('0x28')](function(_0x31fb59){_0x1e8133[_0x2369('0x41')]=_0x31fb59;return _0x1e8133;})[_0x2369('0x28')](respondWithFilteredResult(_0x3f2f41,_0x1f4f01))[_0x2369('0x42')](handleError(_0x3f2f41,null));};exports[_0x2369('0x43')]=function(_0xf7955,_0x2f5f9f){var _0x48b452={'raw':!![],'where':{'id':_0xf7955[_0x2369('0x44')]['id']}},_0x1eda8f={};_0x1eda8f[_0x2369('0x31')]=_[_0x2369('0x45')](db[_0x2369('0x2f')][_0x2369('0x46')]);_0x1eda8f[_0x2369('0x32')]=_[_0x2369('0x45')](_0xf7955['query']);_0x1eda8f[_0x2369('0x33')]=_[_0x2369('0x34')](_0x1eda8f['model'],_0x1eda8f[_0x2369('0x32')]);_0x48b452[_0x2369('0x35')]=_[_0x2369('0x34')](_0x1eda8f[_0x2369('0x31')],qs['fields'](_0xf7955[_0x2369('0x32')]['fields']));_0x48b452[_0x2369('0x35')]=_0x48b452['attributes'][_0x2369('0x37')]?_0x48b452[_0x2369('0x35')]:_0x1eda8f[_0x2369('0x31')];if(_0xf7955[_0x2369('0x32')][_0x2369('0x3f')]){_0x48b452[_0x2369('0x40')]=[{'all':!![]}];}_0x48b452=_[_0x2369('0x3e')]({},_0x48b452,_0xf7955[_0x2369('0x47')]);return db[_0x2369('0x2f')][_0x2369('0x48')](_0x48b452)[_0x2369('0x28')](handleEntityNotFound(_0x2f5f9f,null))[_0x2369('0x28')](respondWithResult(_0x2f5f9f,null))['catch'](handleError(_0x2f5f9f,null));};exports['create']=function(_0x553899,_0x410956){return db[_0x2369('0x2f')][_0x2369('0x49')](_0x553899[_0x2369('0x4a')],{})[_0x2369('0x28')](respondWithResult(_0x410956,0xc9))[_0x2369('0x42')](handleError(_0x410956,null));};exports[_0x2369('0x27')]=function(_0x269e5c,_0x5bbdd2){if(_0x269e5c['body']['id']){delete _0x269e5c[_0x2369('0x4a')]['id'];}return db[_0x2369('0x2f')]['find']({'where':{'id':_0x269e5c[_0x2369('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bbdd2,null))[_0x2369('0x28')](saveUpdates(_0x269e5c[_0x2369('0x4a')],null))['then'](respondWithResult(_0x5bbdd2,null))[_0x2369('0x42')](handleError(_0x5bbdd2,null));};exports[_0x2369('0x29')]=function(_0x26b3ef,_0x3b2b14){return db[_0x2369('0x2f')][_0x2369('0x48')]({'where':{'id':_0x26b3ef['params']['id']}})[_0x2369('0x28')](handleEntityNotFound(_0x3b2b14,null))[_0x2369('0x28')](removeEntity(_0x3b2b14,null))['catch'](handleError(_0x3b2b14,null));}; \ No newline at end of file +var _0x5bc6=['map','rawAttributes','fieldName','type','key','model','filters','attributes','intersection','fields','length','query','order','sort','where','filter','merge','VIRTUAL','options','includeAll','SmsApplication','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x45138b,_0xec2bd6){var _0x398884=function(_0x408309){while(--_0x408309){_0x45138b['push'](_0x45138b['shift']());}};_0x398884(++_0xec2bd6);}(_0x5bc6,0x1da));var _0x65bc=function(_0x2351c6,_0x13d107){_0x2351c6=_0x2351c6-0x0;var _0x2c46e4=_0x5bc6[_0x2351c6];return _0x2c46e4;};'use strict';var emlformat=require(_0x65bc('0x0'));var rimraf=require(_0x65bc('0x1'));var zipdir=require(_0x65bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x65bc('0x3'));var BPromise=require(_0x65bc('0x4'));var Mustache=require(_0x65bc('0x5'));var util=require(_0x65bc('0x6'));var path=require(_0x65bc('0x7'));var sox=require(_0x65bc('0x8'));var csv=require(_0x65bc('0x9'));var ejs=require(_0x65bc('0xa'));var fs=require('fs');var fs_extra=require(_0x65bc('0xb'));var _=require(_0x65bc('0xc'));var squel=require(_0x65bc('0xd'));var crypto=require(_0x65bc('0xe'));var jsforce=require(_0x65bc('0xf'));var deskjs=require(_0x65bc('0x10'));var toCsv=require(_0x65bc('0x9'));var querystring=require(_0x65bc('0x11'));var Papa=require(_0x65bc('0x12'));var Redis=require(_0x65bc('0x13'));var authService=require(_0x65bc('0x14'));var qs=require(_0x65bc('0x15'));var as=require(_0x65bc('0x16'));var hardwareService=require(_0x65bc('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65bc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x65bc('0x19'))['db'];function respondWithStatusCode(_0x382e36,_0x236ec8){_0x236ec8=_0x236ec8||0xcc;return function(_0x2f14a7){if(_0x2f14a7){return _0x382e36['sendStatus'](_0x236ec8);}return _0x382e36[_0x65bc('0x1a')](_0x236ec8)[_0x65bc('0x1b')]();};}function respondWithResult(_0x346c0e,_0x1ae235){_0x1ae235=_0x1ae235||0xc8;return function(_0x52ad9b){if(_0x52ad9b){return _0x346c0e[_0x65bc('0x1a')](_0x1ae235)[_0x65bc('0x1c')](_0x52ad9b);}};}function respondWithFilteredResult(_0x269ef8,_0x4bfdac){return function(_0x727963){if(_0x727963){var _0x1ecf7c=typeof _0x4bfdac[_0x65bc('0x1d')]==='undefined'&&typeof _0x4bfdac[_0x65bc('0x1e')]===_0x65bc('0x1f');var _0xded540=_0x727963[_0x65bc('0x20')];var _0x259f35=_0x1ecf7c?0x0:_0x4bfdac[_0x65bc('0x1d')];var _0x358683=_0x1ecf7c?_0x727963[_0x65bc('0x20')]:_0x4bfdac[_0x65bc('0x1d')]+_0x4bfdac[_0x65bc('0x1e')];var _0x93ee9e;if(_0x358683>=_0xded540){_0x358683=_0xded540;_0x93ee9e=0xc8;}else{_0x93ee9e=0xce;}_0x269ef8[_0x65bc('0x1a')](_0x93ee9e);return _0x269ef8['set']('Content-Range',_0x259f35+'-'+_0x358683+'/'+_0xded540)[_0x65bc('0x1c')](_0x727963);}return null;};}function patchUpdates(_0x1f995b){return function(_0x101395){try{jsonpatch[_0x65bc('0x21')](_0x101395,_0x1f995b,!![]);}catch(_0x257833){return BPromise[_0x65bc('0x22')](_0x257833);}return _0x101395[_0x65bc('0x23')]();};}function saveUpdates(_0x2799a1,_0x46cef9){return function(_0x1f0c7c){if(_0x1f0c7c){return _0x1f0c7c[_0x65bc('0x24')](_0x2799a1)[_0x65bc('0x25')](function(_0x1441e3){return _0x1441e3;});}return null;};}function removeEntity(_0x3a64f1,_0x40e21c){return function(_0x16c7c5){if(_0x16c7c5){return _0x16c7c5[_0x65bc('0x26')]()[_0x65bc('0x25')](function(){_0x3a64f1[_0x65bc('0x1a')](0xcc)[_0x65bc('0x1b')]();});}};}function handleEntityNotFound(_0x12f43d,_0xb43be7){return function(_0x31245c){if(!_0x31245c){_0x12f43d['sendStatus'](0x194);}return _0x31245c;};}function handleError(_0x5553ea,_0x1c89cb){_0x1c89cb=_0x1c89cb||0x1f4;return function(_0x246a71){logger[_0x65bc('0x27')](_0x246a71[_0x65bc('0x28')]);if(_0x246a71[_0x65bc('0x29')]){delete _0x246a71[_0x65bc('0x29')];}_0x5553ea[_0x65bc('0x1a')](_0x1c89cb)[_0x65bc('0x2a')](_0x246a71);};}exports[_0x65bc('0x2b')]=function(_0x298c20,_0xeb7a63){var _0x224411={},_0x166661={},_0x1ad63b={'count':0x0,'rows':[]};var _0x314353=_[_0x65bc('0x2c')](db['SmsApplication'][_0x65bc('0x2d')],function(_0x27d575){return{'name':_0x27d575[_0x65bc('0x2e')],'type':_0x27d575[_0x65bc('0x2f')][_0x65bc('0x30')]};});_0x166661[_0x65bc('0x31')]=_[_0x65bc('0x2c')](_0x314353,_0x65bc('0x29'));_0x166661['query']=_['keys'](_0x298c20['query']);_0x166661[_0x65bc('0x32')]=_['intersection'](_0x166661[_0x65bc('0x31')],_0x166661['query']);_0x224411[_0x65bc('0x33')]=_[_0x65bc('0x34')](_0x166661[_0x65bc('0x31')],qs[_0x65bc('0x35')](_0x298c20['query']['fields']));_0x224411[_0x65bc('0x33')]=_0x224411['attributes'][_0x65bc('0x36')]?_0x224411[_0x65bc('0x33')]:_0x166661[_0x65bc('0x31')];if(!_0x298c20['query']['hasOwnProperty']('nolimit')){_0x224411[_0x65bc('0x1e')]=qs[_0x65bc('0x1e')](_0x298c20[_0x65bc('0x37')]['limit']);_0x224411['offset']=qs[_0x65bc('0x1d')](_0x298c20[_0x65bc('0x37')][_0x65bc('0x1d')]);}_0x224411[_0x65bc('0x38')]=qs['sort'](_0x298c20[_0x65bc('0x37')][_0x65bc('0x39')]);_0x224411[_0x65bc('0x3a')]=qs['filters'](_['pick'](_0x298c20[_0x65bc('0x37')],_0x166661[_0x65bc('0x32')]),_0x314353);if(_0x298c20[_0x65bc('0x37')][_0x65bc('0x3b')]){_0x224411[_0x65bc('0x3a')]=_[_0x65bc('0x3c')](_0x224411['where'],{'$or':_[_0x65bc('0x2c')](_0x314353,function(_0x34e24d){if(_0x34e24d[_0x65bc('0x2f')]!==_0x65bc('0x3d')){var _0x1b06cb={};_0x1b06cb[_0x34e24d[_0x65bc('0x29')]]={'$like':'%'+_0x298c20['query']['filter']+'%'};return _0x1b06cb;}})});}_0x224411=_[_0x65bc('0x3c')]({},_0x224411,_0x298c20[_0x65bc('0x3e')]);var _0x3aaf4f={'where':_0x224411[_0x65bc('0x3a')]};return db['SmsApplication'][_0x65bc('0x20')](_0x3aaf4f)['then'](function(_0xe6c2ec){_0x1ad63b[_0x65bc('0x20')]=_0xe6c2ec;if(_0x298c20[_0x65bc('0x37')][_0x65bc('0x3f')]){_0x224411['include']=[{'all':!![]}];}return db[_0x65bc('0x40')]['findAll'](_0x224411);})['then'](function(_0x48388a){_0x1ad63b[_0x65bc('0x41')]=_0x48388a;return _0x1ad63b;})['then'](respondWithFilteredResult(_0xeb7a63,_0x224411))[_0x65bc('0x42')](handleError(_0xeb7a63,null));};exports[_0x65bc('0x43')]=function(_0x4f38e2,_0x43e75c){var _0x59677a={'raw':!![],'where':{'id':_0x4f38e2[_0x65bc('0x44')]['id']}},_0x113e8e={};_0x113e8e[_0x65bc('0x31')]=_['keys'](db[_0x65bc('0x40')][_0x65bc('0x2d')]);_0x113e8e[_0x65bc('0x37')]=_[_0x65bc('0x45')](_0x4f38e2[_0x65bc('0x37')]);_0x113e8e['filters']=_[_0x65bc('0x34')](_0x113e8e[_0x65bc('0x31')],_0x113e8e['query']);_0x59677a[_0x65bc('0x33')]=_['intersection'](_0x113e8e[_0x65bc('0x31')],qs[_0x65bc('0x35')](_0x4f38e2[_0x65bc('0x37')][_0x65bc('0x35')]));_0x59677a['attributes']=_0x59677a['attributes']['length']?_0x59677a[_0x65bc('0x33')]:_0x113e8e[_0x65bc('0x31')];if(_0x4f38e2[_0x65bc('0x37')][_0x65bc('0x3f')]){_0x59677a[_0x65bc('0x46')]=[{'all':!![]}];}_0x59677a=_[_0x65bc('0x3c')]({},_0x59677a,_0x4f38e2['options']);return db['SmsApplication'][_0x65bc('0x47')](_0x59677a)[_0x65bc('0x25')](handleEntityNotFound(_0x43e75c,null))['then'](respondWithResult(_0x43e75c,null))[_0x65bc('0x42')](handleError(_0x43e75c,null));};exports[_0x65bc('0x48')]=function(_0x215cde,_0x110511){return db[_0x65bc('0x40')]['create'](_0x215cde[_0x65bc('0x49')],{})[_0x65bc('0x25')](respondWithResult(_0x110511,0xc9))[_0x65bc('0x42')](handleError(_0x110511,null));};exports['update']=function(_0x16f766,_0x4532aa){if(_0x16f766[_0x65bc('0x49')]['id']){delete _0x16f766[_0x65bc('0x49')]['id'];}return db[_0x65bc('0x40')][_0x65bc('0x47')]({'where':{'id':_0x16f766[_0x65bc('0x44')]['id']}})[_0x65bc('0x25')](handleEntityNotFound(_0x4532aa,null))['then'](saveUpdates(_0x16f766[_0x65bc('0x49')],null))[_0x65bc('0x25')](respondWithResult(_0x4532aa,null))[_0x65bc('0x42')](handleError(_0x4532aa,null));};exports[_0x65bc('0x26')]=function(_0x18a1df,_0x3cc3d7){return db['SmsApplication'][_0x65bc('0x47')]({'where':{'id':_0x18a1df[_0x65bc('0x44')]['id']}})[_0x65bc('0x25')](handleEntityNotFound(_0x3cc3d7,null))[_0x65bc('0x25')](removeEntity(_0x3cc3d7,null))[_0x65bc('0x42')](handleError(_0x3cc3d7,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index be509c6..f634b11 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 _0x4e09=['rimraf','../../config/environment','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x4e1bc0,_0x2fd996){var _0x151f70=function(_0x236460){while(--_0x236460){_0x4e1bc0['push'](_0x4e1bc0['shift']());}};_0x151f70(++_0x2fd996);}(_0x4e09,0x19e));var _0x94e0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4e09[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x94e0('0x0'));var util=require(_0x94e0('0x1'));var logger=require(_0x94e0('0x2'))('api');var moment=require(_0x94e0('0x3'));var BPromise=require(_0x94e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94e0('0x5'));var rimraf=require(_0x94e0('0x6'));var config=require(_0x94e0('0x7'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x223c25,_0xf6c33d){return _0x223c25[_0x94e0('0x8')]('SmsApplication',attributes,{'tableName':_0x94e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x94e0('0xa'),'collate':_0x94e0('0xb')});}; \ No newline at end of file +var _0x244e=['sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment'];(function(_0x2ae02a,_0x58c939){var _0x534c76=function(_0x300e37){while(--_0x300e37){_0x2ae02a['push'](_0x2ae02a['shift']());}};_0x534c76(++_0x58c939);}(_0x244e,0x132));var _0xe244=function(_0xd4385,_0x265881){_0xd4385=_0xd4385-0x0;var _0x1b7ffc=_0x244e[_0xd4385];return _0x1b7ffc;};'use strict';var _=require(_0xe244('0x0'));var util=require('util');var logger=require(_0xe244('0x1'))(_0xe244('0x2'));var moment=require(_0xe244('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe244('0x4'));var rimraf=require('rimraf');var config=require(_0xe244('0x5'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x27509e,_0x47fce3){return _0x27509e['define']('SmsApplication',attributes,{'tableName':_0xe244('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe244('0x7')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 39fd236..9397bfe 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 _0xa3db=['client','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0xa3db,0x10c));var _0xba3d=function(_0x2c5a14,_0x4359de){_0x2c5a14=_0x2c5a14-0x0;var _0xbd78=_0xa3db[_0x2c5a14];return _0xbd78;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var moment=require(_0xba3d('0x2'));var BPromise=require(_0xba3d('0x3'));var rs=require(_0xba3d('0x4'));var fs=require('fs');var Redis=require(_0xba3d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba3d('0x6'))('rpc');var config=require(_0xba3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba3d('0x8')][_0xba3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477583,_0x1bacd7,_0x1bd181){return new BPromise(function(_0x426868,_0x3b69e9){return client[_0xba3d('0xa')](_0x477583,_0x1bd181)[_0xba3d('0xb')](function(_0x102fe6){logger[_0xba3d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1bacd7,_0xba3d('0xd'));logger[_0xba3d('0xe')](_0xba3d('0xf'),_0x1bacd7,_0xba3d('0xd'),JSON[_0xba3d('0x10')](_0x102fe6));if(_0x102fe6['error']){if(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x12')]===0x1f4){logger[_0xba3d('0x11')]('SmsApplication,\x20%s,\x20%s',_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x3b69e9(_0x102fe6[_0xba3d('0x11')]['message']);}logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x102fe6['error'][_0xba3d('0x13')]);return _0x426868(_0x102fe6[_0xba3d('0x11')][_0xba3d('0x13')]);}else{logger[_0xba3d('0xc')](_0xba3d('0x14'),_0x1bacd7,_0xba3d('0xd'));_0x426868(_0x102fe6[_0xba3d('0x15')][_0xba3d('0x13')]);}})[_0xba3d('0x16')](function(_0x2ce092){logger['error'](_0xba3d('0x14'),_0x1bacd7,_0x2ce092);_0x3b69e9(_0x2ce092);});});} \ No newline at end of file +var _0xf06c=['client','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2d43df,_0x56d287){var _0x398564=function(_0x35a222){while(--_0x35a222){_0x2d43df['push'](_0x2d43df['shift']());}};_0x398564(++_0x56d287);}(_0xf06c,0xc7));var _0xcf06=function(_0x1b5762,_0x2e592e){_0x1b5762=_0x1b5762-0x0;var _0x3e40aa=_0xf06c[_0x1b5762];return _0x3e40aa;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var moment=require(_0xcf06('0x2'));var BPromise=require(_0xcf06('0x3'));var rs=require(_0xcf06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf06('0x5'))['db'];var utils=require(_0xcf06('0x6'));var logger=require(_0xcf06('0x7'))('rpc');var config=require(_0xcf06('0x8'));var jayson=require(_0xcf06('0x9'));var client=jayson[_0xcf06('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ac40,_0x5d1aa0,_0x2723ad){return new BPromise(function(_0x48ed0c,_0x4dd606){return client['request'](_0x22ac40,_0x2723ad)['then'](function(_0x6ecf1a){logger[_0xcf06('0xb')](_0xcf06('0xc'),_0x5d1aa0,'request\x20sent');logger['debug'](_0xcf06('0xd'),_0x5d1aa0,'request\x20sent',JSON[_0xcf06('0xe')](_0x6ecf1a));if(_0x6ecf1a['error']){if(_0x6ecf1a[_0xcf06('0xf')]['code']===0x1f4){logger[_0xcf06('0xf')](_0xcf06('0xc'),_0x5d1aa0,_0x6ecf1a[_0xcf06('0xf')][_0xcf06('0x10')]);return _0x4dd606(_0x6ecf1a['error']['message']);}logger[_0xcf06('0xf')](_0xcf06('0xc'),_0x5d1aa0,_0x6ecf1a[_0xcf06('0xf')][_0xcf06('0x10')]);return _0x48ed0c(_0x6ecf1a['error'][_0xcf06('0x10')]);}else{logger[_0xcf06('0xb')]('SmsApplication,\x20%s,\x20%s',_0x5d1aa0,'request\x20sent');_0x48ed0c(_0x6ecf1a[_0xcf06('0x11')][_0xcf06('0x10')]);}})[_0xcf06('0x12')](function(_0x57c316){logger[_0xcf06('0xf')](_0xcf06('0xc'),_0x5d1aa0,_0x57c316);_0x4dd606(_0x57c316);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3769ba3..316ba68 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 _0x9348=['addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x9348,0x10d));var _0x8934=function(_0xe9d5f5,_0x19ccf6){_0xe9d5f5=_0xe9d5f5-0x0;var _0x25c6e9=_0x9348[_0xe9d5f5];return _0x25c6e9;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/describe',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0x9')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0x11')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['post'](_0x8934('0xd'),auth[_0x8934('0xa')](),controller[_0x8934('0x13')]);router[_0x8934('0x11')](_0x8934('0x14'),auth[_0x8934('0xa')](),interaction['tracked'](_0x8934('0x15'),_0x8934('0x16')),controller[_0x8934('0x17')]);router[_0x8934('0x18')](_0x8934('0x19'),auth[_0x8934('0xa')](),interaction[_0x8934('0x1a')](_0x8934('0x15'),'smsinteraction:update'),controller[_0x8934('0x1b')]);router[_0x8934('0x1c')](_0x8934('0x19'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x8934('0x1d')),controller['destroy']);router[_0x8934('0x1c')](_0x8934('0x14'),auth[_0x8934('0xa')](),controller[_0x8934('0x1e')]);module[_0x8934('0x1f')]=router; \ No newline at end of file +var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x544a70,_0x26608f){var _0x4a765d=function(_0x306bf7){while(--_0x306bf7){_0x544a70['push'](_0x544a70['shift']());}};_0x4a765d(++_0x26608f);}(_0x13f6,0x124));var _0x613f=function(_0x58d64c,_0x3e4647){_0x58d64c=_0x58d64c-0x0;var _0x25d125=_0x13f6[_0x58d64c];return _0x25d125;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8603858..673d678 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 _0xfb11=['out','INTEGER','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x1a2ca7,_0x22de37){var _0x436d60=function(_0x558600){while(--_0x558600){_0x1a2ca7['push'](_0x1a2ca7['shift']());}};_0x436d60(++_0x22de37);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xfb11[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x1fb1('0x0'));var moment=require('moment');module[_0x1fb1('0x1')]={'closed':{'type':Sequelize[_0x1fb1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1fb1('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1fb1('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1fb1('0x3')]},'read1stAt':{'type':Sequelize[_0x1fb1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1fb1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1fb1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1fb1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1fb1('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1fb1('0x6')]}}; \ No newline at end of file +var _0x7462=['STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','moment','DATE'];(function(_0x31129a,_0x110737){var _0x55ef4f=function(_0x3ec246){while(--_0x3ec246){_0x31129a['push'](_0x31129a['shift']());}};_0x55ef4f(++_0x110737);}(_0x7462,0x165));var _0x2746=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x7462[_0x4f2c3a];return _0x17d91c;};'use strict';var Sequelize=require(_0x2746('0x0'));var moment=require(_0x2746('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2746('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2746('0x3')]},'note':{'type':Sequelize[_0x2746('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2746('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2746('0x4')]('in',_0x2746('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2746('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2746('0x4')]('in',_0x2746('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2746('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2746('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 71db9e8..2991b5e 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 _0x654a=['zip-dir','moment','bluebird','util','path','ejs','../../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','json','offset','undefined','limit','count','status','set','then','destroy','end','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','user','params','model','keys','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','update','describe','SmsMessage','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','pick','where','SmsInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','Tag','color','emit','smsInteractionTags:save','download','unix','toString','root','files','join','transcript-%d-%s.zip','push','CmContact','Contact','Messages','direction','secret','read','Account','User','Owner','fullname','mkdirSync','Sms','N.A.','createdAt','closed','closedAt','disposition','out','System','firstName','lastName','value','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf'];(function(_0x33098d,_0x70012){var _0x45544d=function(_0x1cbaf1){while(--_0x1cbaf1){_0x33098d['push'](_0x33098d['shift']());}};_0x45544d(++_0x70012);}(_0x654a,0x7c));var _0xa654=function(_0x4dc0bc,_0x490bf0){_0x4dc0bc=_0x4dc0bc-0x0;var _0x470317=_0x654a[_0x4dc0bc];return _0x470317;};'use strict';var rimraf=require(_0xa654('0x0'));var zipdir=require(_0xa654('0x1'));var moment=require(_0xa654('0x2'));var BPromise=require(_0xa654('0x3'));var util=require(_0xa654('0x4'));var path=require(_0xa654('0x5'));var ejs=require(_0xa654('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xa654('0x7'));var qs=require(_0xa654('0x8'));var pdf=require(_0xa654('0x9'));var logger=require(_0xa654('0xa'))(_0xa654('0xb'));var config=require(_0xa654('0xc'));var db=require(_0xa654('0xd'))['db'];config['redis']=_[_0xa654('0xe')](config[_0xa654('0xf')],{'host':_0xa654('0x10'),'port':0x18eb});var socket=require(_0xa654('0x11'))(new Redis(config[_0xa654('0xf')]));require(_0xa654('0x12'))[_0xa654('0x13')](socket);function respondWithStatusCode(_0x1fec3d,_0x41a6f2){_0x41a6f2=_0x41a6f2||0xcc;return function(_0x436380){if(_0x436380){return _0x1fec3d[_0xa654('0x14')](_0x41a6f2);}return _0x1fec3d['status'](_0x41a6f2)['end']();};}function respondWithResult(_0x1c3e9f,_0x536f43){_0x536f43=_0x536f43||0xc8;return function(_0xfdf5d1){if(_0xfdf5d1){return _0x1c3e9f['status'](_0x536f43)[_0xa654('0x15')](_0xfdf5d1);}};}function respondWithFilteredResult(_0x2765a0,_0x1bfb37){return function(_0x1f7634){if(_0x1f7634){var _0x4758d9=typeof _0x1bfb37[_0xa654('0x16')]===_0xa654('0x17')&&typeof _0x1bfb37[_0xa654('0x18')]==='undefined';var _0x41dc7b=_0x1f7634[_0xa654('0x19')];var _0x4a2a75=_0x4758d9?0x0:_0x1bfb37['offset'];var _0x43fd4c=_0x4758d9?_0x1f7634[_0xa654('0x19')]:_0x1bfb37['offset']+_0x1bfb37[_0xa654('0x18')];var _0x5bb364;if(_0x43fd4c>=_0x41dc7b){_0x43fd4c=_0x41dc7b;_0x5bb364=0xc8;}else{_0x5bb364=0xce;}_0x2765a0[_0xa654('0x1a')](_0x5bb364);return _0x2765a0[_0xa654('0x1b')]('Content-Range',_0x4a2a75+'-'+_0x43fd4c+'/'+_0x41dc7b)[_0xa654('0x15')](_0x1f7634);}return null;};}function saveUpdates(_0x6e2ba){return function(_0x3e50c4){if(_0x3e50c4){return _0x3e50c4['update'](_0x6e2ba)[_0xa654('0x1c')](function(_0x1c25ab){return _0x1c25ab;});}return null;};}function removeEntity(_0x1c5e21){return function(_0x2fe375){if(_0x2fe375){return _0x2fe375[_0xa654('0x1d')]()[_0xa654('0x1c')](function(){_0x1c5e21['status'](0xcc)[_0xa654('0x1e')]();});}};}function handleEntityNotFound(_0xd595ac){return function(_0x5dae59){if(!_0x5dae59){_0xd595ac['sendStatus'](0x194);}return _0x5dae59;};}function handleError(_0x52e1ad,_0x245d19){_0x245d19=_0x245d19||0x1f4;return function(_0x320603){logger['error'](_0x320603[_0xa654('0x1f')]);if(_0x320603[_0xa654('0x20')]){delete _0x320603['name'];}_0x52e1ad[_0xa654('0x1a')](_0x245d19)[_0xa654('0x21')](_0x320603);};}exports[_0xa654('0x22')]=function(_0x255234,_0x23801c){var _0x5e58b3={};var _0x127dc9=_['map'](db[_0xa654('0x23')][_0xa654('0x24')],function(_0x3cf182){return{'name':_0x3cf182[_0xa654('0x25')],'type':_0x3cf182[_0xa654('0x26')][_0xa654('0x27')]};});_0x5e58b3=qs[_0xa654('0x28')](_0x127dc9,_0x255234);return interaction[_0xa654('0x29')]('sms',_0x255234['query'],_0x255234[_0xa654('0x2a')],_0x5e58b3,_0x127dc9)[_0xa654('0x1c')](respondWithFilteredResult(_0x23801c,_0x5e58b3))['catch'](handleError(_0x23801c,null));};exports['show']=function(_0xa25265,_0x4019fa){var _0x814d7f={'raw':![],'where':{'id':_0xa25265[_0xa654('0x2b')]['id']}},_0x14dfe6={};_0x14dfe6[_0xa654('0x2c')]=_[_0xa654('0x2d')](db['SmsInteraction']['rawAttributes']);_0x14dfe6[_0xa654('0x2e')]=_[_0xa654('0x2d')](_0xa25265[_0xa654('0x2e')]);_0x14dfe6['filters']=_['intersection'](_0x14dfe6['model'],_0x14dfe6[_0xa654('0x2e')]);_0x814d7f[_0xa654('0x2f')]=_[_0xa654('0x30')](_0x14dfe6[_0xa654('0x2c')],qs[_0xa654('0x31')](_0xa25265[_0xa654('0x2e')][_0xa654('0x31')]));_0x814d7f['attributes']=_0x814d7f[_0xa654('0x2f')][_0xa654('0x32')]?_0x814d7f['attributes']:_0x14dfe6[_0xa654('0x2c')];if(_0xa25265['query'][_0xa654('0x33')]){_0x814d7f[_0xa654('0x34')]=[{'all':!![]}];}_0x814d7f=_[_0xa654('0x35')]({},_0x814d7f,_0xa25265[_0xa654('0x36')]);return db[_0xa654('0x23')][_0xa654('0x37')](_0x814d7f)['then'](handleEntityNotFound(_0x4019fa,null))['then'](respondWithResult(_0x4019fa,null))[_0xa654('0x38')](handleError(_0x4019fa,null));};exports[_0xa654('0x39')]=function(_0x58f10d,_0x23cb6d){return db['SmsInteraction'][_0xa654('0x39')](_0x58f10d[_0xa654('0x3a')],{})[_0xa654('0x1c')](respondWithResult(_0x23cb6d,0xc9))[_0xa654('0x38')](handleError(_0x23cb6d,null));};exports[_0xa654('0x3b')]=function(_0x37e2a6,_0x38a2a8){if(_0x37e2a6[_0xa654('0x3a')]['id']){delete _0x37e2a6['body']['id'];}return db['SmsInteraction'][_0xa654('0x37')]({'where':{'id':_0x37e2a6[_0xa654('0x2b')]['id']}})[_0xa654('0x1c')](handleEntityNotFound(_0x38a2a8,null))[_0xa654('0x1c')](saveUpdates(_0x37e2a6[_0xa654('0x3a')],null))['then'](respondWithResult(_0x38a2a8,null))[_0xa654('0x38')](handleError(_0x38a2a8,null));};exports['destroy']=function(_0x1c0ace,_0x4eb79f){return db[_0xa654('0x23')]['find']({'where':{'id':_0x1c0ace['params']['id']}})[_0xa654('0x1c')](handleEntityNotFound(_0x4eb79f,null))['then'](removeEntity(_0x4eb79f,null))[_0xa654('0x38')](handleError(_0x4eb79f,null));};exports[_0xa654('0x3c')]=function(_0x2e2851,_0x5923a1){return db[_0xa654('0x23')][_0xa654('0x3c')]()[_0xa654('0x1c')](respondWithResult(_0x5923a1,null))['catch'](handleError(_0x5923a1,null));};exports['addMessage']=function(_0x59df50,_0x3fa994){return db[_0xa654('0x3d')][_0xa654('0x37')]({'where':{'id':_0x59df50['params']['id']}})[_0xa654('0x1c')](handleEntityNotFound(_0x3fa994,null))[_0xa654('0x1c')](function(_0x3af239){if(_0x3af239){return _0x3af239['addMessage'](_0x59df50[_0xa654('0x3a')]['ids'],_['omit'](_0x59df50['body'],[_0xa654('0x3e'),'id'])||{});}})[_0xa654('0x1c')](respondWithResult(_0x3fa994,null))[_0xa654('0x38')](handleError(_0x3fa994,null));};exports[_0xa654('0x3f')]=function(_0xfcc3cb,_0x47f951){var _0x12d86f={'raw':![],'where':{}};var _0x4bd41a={};var _0x5e1460={'count':0x0,'rows':[]};return db[_0xa654('0x23')][_0xa654('0x40')]({'where':{'id':_0xfcc3cb[_0xa654('0x2b')]['id']}})[_0xa654('0x1c')](handleEntityNotFound(_0x47f951,null))[_0xa654('0x1c')](function(_0x1bbd3d){if(_0x1bbd3d){_0x4bd41a[_0xa654('0x2c')]=_[_0xa654('0x2d')](db[_0xa654('0x3d')][_0xa654('0x24')]);_0x4bd41a[_0xa654('0x2e')]=_[_0xa654('0x2d')](_0xfcc3cb[_0xa654('0x2e')]);_0x4bd41a[_0xa654('0x41')]=_[_0xa654('0x30')](_0x4bd41a['model'],_0x4bd41a[_0xa654('0x2e')]);_0x12d86f['attributes']=_['intersection'](_0x4bd41a[_0xa654('0x2c')],qs[_0xa654('0x31')](_0xfcc3cb['query']['fields']));_0x12d86f['attributes']=_0x12d86f[_0xa654('0x2f')]['length']?_0x12d86f[_0xa654('0x2f')]:_0x4bd41a[_0xa654('0x2c')];if(!_0xfcc3cb['query'][_0xa654('0x42')](_0xa654('0x43'))){_0x12d86f[_0xa654('0x18')]=qs[_0xa654('0x18')](_0xfcc3cb[_0xa654('0x2e')][_0xa654('0x18')]);_0x12d86f[_0xa654('0x16')]=qs['offset'](_0xfcc3cb['query'][_0xa654('0x16')]);}_0x12d86f['order']=qs['sort'](_0xfcc3cb['query'][_0xa654('0x44')]);_0x12d86f['where']=qs[_0xa654('0x41')](_[_0xa654('0x45')](_0xfcc3cb[_0xa654('0x2e')],_0x4bd41a[_0xa654('0x41')]));_0x12d86f[_0xa654('0x46')][_0xa654('0x47')]=_0x1bbd3d['id'];if(_0xfcc3cb[_0xa654('0x2e')][_0xa654('0x48')]){_0x12d86f[_0xa654('0x46')]=_[_0xa654('0x35')](_0x12d86f[_0xa654('0x46')],{'$or':_[_0xa654('0x49')](_0x12d86f[_0xa654('0x2f')],function(_0xc82a77){var _0x26c7b2={};_0x26c7b2[_0xc82a77]={'$like':'%'+_0xfcc3cb[_0xa654('0x2e')]['filter']+'%'};return _0x26c7b2;})});}if(_0xfcc3cb['query']['$gte']){var _0x3be7bc=_0xfcc3cb[_0xa654('0x2e')][_0xa654('0x4a')][_0xa654('0x4b')](',');var _0x3527d2={};_0x3527d2[_0x3be7bc[0x0]]={'$gte':moment(_0x3be7bc[0x1])[_0xa654('0x4c')](_0xa654('0x4d'))};_0x12d86f[_0xa654('0x46')]=_[_0xa654('0x35')](_0x12d86f[_0xa654('0x46')],_0x3527d2);}_0x12d86f=_[_0xa654('0x35')]({},_0x12d86f,_0xfcc3cb['options']);return db[_0xa654('0x3d')][_0xa654('0x19')]({'where':_0x12d86f[_0xa654('0x46')]})[_0xa654('0x1c')](function(_0x58dd64){_0x5e1460[_0xa654('0x19')]=_0x58dd64;if(_0xfcc3cb[_0xa654('0x2e')][_0xa654('0x33')]){_0x12d86f['include']=[{'all':!![]}];}return db['SmsMessage'][_0xa654('0x29')](_0x12d86f);})[_0xa654('0x1c')](function(_0xfbf7c6){_0x5e1460[_0xa654('0x4e')]=_0xfbf7c6;return _0x5e1460;});}})[_0xa654('0x1c')](respondWithFilteredResult(_0x47f951,_0x12d86f))[_0xa654('0x38')](handleError(_0x47f951,null));};exports[_0xa654('0x4f')]=function(_0x3d41c3,_0x377d83){return db['SmsInteraction'][_0xa654('0x37')]({'where':{'id':_0x3d41c3[_0xa654('0x2b')]['id']}})[_0xa654('0x1c')](handleEntityNotFound(_0x377d83,null))[_0xa654('0x1c')](function(_0x1197f4){if(_0x1197f4){return _0x1197f4['setTags'](_0x3d41c3[_0xa654('0x3a')][_0xa654('0x3e')],_[_0xa654('0x50')](_0x3d41c3[_0xa654('0x3a')],[_0xa654('0x3e'),'id'])||{})['spread'](function(){return db[_0xa654('0x51')][_0xa654('0x29')]({'attributes':['id',_0xa654('0x20'),_0xa654('0x52')],'where':{'id':_0x3d41c3[_0xa654('0x3a')][_0xa654('0x3e')]}});})[_0xa654('0x1c')](function(_0x5befb4){socket[_0xa654('0x53')](_0xa654('0x54'),{'id':Number(_0x3d41c3[_0xa654('0x2b')]['id']),'tags':_0x5befb4||[]});return{'id':Number(_0x3d41c3[_0xa654('0x2b')]['id']),'tags':_0x5befb4||[]};});}})[_0xa654('0x1c')](respondWithResult(_0x377d83,null))['catch'](handleError(_0x377d83,null));};exports['removeTags']=function(_0x1d5c33,_0x1fc56d){return db['SmsInteraction'][_0xa654('0x37')]({'where':{'id':_0x1d5c33[_0xa654('0x2b')]['id']}})[_0xa654('0x1c')](handleEntityNotFound(_0x1fc56d,null))[_0xa654('0x1c')](function(_0xee98ee){if(_0xee98ee){return _0xee98ee['removeTags'](_0x1d5c33[_0xa654('0x2e')][_0xa654('0x3e')]);}})['then'](respondWithStatusCode(_0x1fc56d,null))[_0xa654('0x38')](handleError(_0x1fc56d,null));};exports[_0xa654('0x55')]=function(_0x39928d,_0x56697f){var _0x632fc=moment()[_0xa654('0x56')]()[_0xa654('0x57')]();var _0x3b234f=path['join'](config[_0xa654('0x58')],'server',_0xa654('0x59'),'tmp');var _0x2d157f=path[_0xa654('0x5a')](_0x3b234f,_0x632fc);var _0x4d2775=util['format'](_0xa654('0x5b'),_0x39928d[_0xa654('0x2b')]['id'],_0x632fc);var _0x52ae72=path[_0xa654('0x5a')](_0x3b234f,_0x4d2775);var _0x3cbe3a=[];_0x3cbe3a[_0xa654('0x5c')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3cbe3a['push']({'model':db[_0xa654('0x5d')],'as':_0xa654('0x5e'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x514361=[{'model':db['SmsMessage'],'as':_0xa654('0x5f'),'attributes':['id',_0xa654('0x3a'),'createdAt',_0xa654('0x60'),_0xa654('0x61'),_0xa654('0x62')],'include':_0x3cbe3a}];_0x514361[_0xa654('0x5c')]({'model':db['SmsAccount'],'as':_0xa654('0x63'),'attributes':['id',_0xa654('0x20')]});_0x514361[_0xa654('0x5c')]({'model':db[_0xa654('0x64')],'as':_0xa654('0x65'),'attributes':['id',_0xa654('0x66')]});return db[_0xa654('0x23')]['find']({'where':{'id':_0x39928d[_0xa654('0x2b')]['id']},'include':_0x514361})[_0xa654('0x1c')](handleEntityNotFound(_0x56697f,null))[_0xa654('0x1c')](function(_0x1a5131){if(_0x1a5131){var _0x2d5f97=_0x1a5131['get']({'plain':!![]});fs[_0xa654('0x67')](_0x2d157f);var _0x345b34={'channel':_0xa654('0x68'),'account':_0x2d5f97[_0xa654('0x63')][_0xa654('0x20')],'agent':_0x2d5f97['Owner']?_0x2d5f97[_0xa654('0x65')]['fullname']:_0xa654('0x69'),'createdAt':moment(_0x2d5f97[_0xa654('0x6a')])[_0xa654('0x4c')](_0xa654('0x4d'))[_0xa654('0x57')](),'closedAt':_0x2d5f97[_0xa654('0x6b')]?moment(_0x2d5f97[_0xa654('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa654('0x57')]():'','disposition':_0x2d5f97[_0xa654('0x6d')],'messages':_(_0x2d5f97[_0xa654('0x5f')])[_0xa654('0x48')]({'secret':![]})['map'](function(_0x426716){return{'date':moment(_0x426716['createdAt'])[_0xa654('0x4c')](_0xa654('0x4d'))[_0xa654('0x57')](),'sender':_0x426716[_0xa654('0x60')]===_0xa654('0x6e')?_0x426716[_0xa654('0x64')]?_0x426716[_0xa654('0x64')][_0xa654('0x66')]:_0xa654('0x6f'):_0x426716[_0xa654('0x5e')][_0xa654('0x70')]+(_0x426716['Contact'][_0xa654('0x71')]?'\x20'+_0x426716[_0xa654('0x5e')]['lastName']:''),'body':_0x426716[_0xa654('0x3a')],'direction':_0x426716[_0xa654('0x60')]===_0xa654('0x6e')?'A':'C','secret':_0x426716[_0xa654('0x61')],'read':_0x426716[_0xa654('0x62')]};})[_0xa654('0x72')]()};return ejs[_0xa654('0x73')](path[_0xa654('0x5a')](config[_0xa654('0x58')],_0xa654('0x74'),_0xa654('0x75'),_0xa654('0x76')),{'interaction':_0x345b34})[_0xa654('0x1c')](function(_0x3b695f){var _0x1422d8=path[_0xa654('0x5a')](_0x2d157f,_0xa654('0x77')+_0x2d5f97['id']+'-'+_0x632fc+_0xa654('0x78'));var _0x39f6e3={'path':_0x1422d8,'channel':_0xa654('0x68'),'interactionId':_0x2d5f97['id']};return pdf[_0xa654('0x79')](_0x3b695f,_0x39f6e3);})['then'](function(){return new BPromise(function(_0x4236b5,_0x5deed9){zipdir(_0x2d157f,{'saveTo':_0x52ae72},function(_0x4856c1,_0x54f687){if(_0x4856c1)return _0x5deed9(_0x4856c1);return _0x4236b5(_0x54f687);});})[_0xa654('0x1c')](function(){return new BPromise(function(_0x506567,_0x2d26c2){rimraf(_0x2d157f,function(_0x18e5c2){if(_0x18e5c2)_0x2d26c2(_0x18e5c2);return _0x506567();});});})[_0xa654('0x1c')](function(){return _0x56697f[_0xa654('0x55')](_0x52ae72,_0x4d2775,function(_0x5ce499){if(_0x5ce499){console[_0xa654('0x7a')](_0xa654('0x7b'),_0x5ce499);}else{fs[_0xa654('0x7c')](_0x52ae72);}});});});}else{return _0x56697f[_0xa654('0x14')](0xc8);}})[_0xa654('0x38')](handleError(_0x56697f,null));}; \ No newline at end of file +var _0xc95c=['toString','join','root','files','tmp','format','push','User','lastName','Messages','createdAt','secret','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','closed','closedAt','disposition','out','System','Contact','direction','read','renderFile','server','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','show','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','update','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','Tag','emit','removeTags','download','unix'];(function(_0x4870d2,_0x1a4887){var _0x1beefe=function(_0x1dc907){while(--_0x1dc907){_0x4870d2['push'](_0x4870d2['shift']());}};_0x1beefe(++_0x1a4887);}(_0xc95c,0x18d));var _0xcc95=function(_0xc1cfb0,_0x583e57){_0xc1cfb0=_0xc1cfb0-0x0;var _0xe85ea4=_0xc95c[_0xc1cfb0];return _0xe85ea4;};'use strict';var rimraf=require(_0xcc95('0x0'));var zipdir=require(_0xcc95('0x1'));var moment=require(_0xcc95('0x2'));var BPromise=require(_0xcc95('0x3'));var util=require(_0xcc95('0x4'));var path=require('path');var ejs=require(_0xcc95('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xcc95('0x6'));var interaction=require(_0xcc95('0x7'));var qs=require(_0xcc95('0x8'));var pdf=require(_0xcc95('0x9'));var logger=require('../../config/logger')(_0xcc95('0xa'));var config=require(_0xcc95('0xb'));var db=require(_0xcc95('0xc'))['db'];config['redis']=_['defaults'](config[_0xcc95('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc95('0xe'))(new Redis(config[_0xcc95('0xd')]));require(_0xcc95('0xf'))[_0xcc95('0x10')](socket);function respondWithStatusCode(_0x232af2,_0x2f417a){_0x2f417a=_0x2f417a||0xcc;return function(_0x8f25da){if(_0x8f25da){return _0x232af2['sendStatus'](_0x2f417a);}return _0x232af2[_0xcc95('0x11')](_0x2f417a)[_0xcc95('0x12')]();};}function respondWithResult(_0x1a58ac,_0x45ccb1){_0x45ccb1=_0x45ccb1||0xc8;return function(_0x3f2432){if(_0x3f2432){return _0x1a58ac['status'](_0x45ccb1)['json'](_0x3f2432);}};}function respondWithFilteredResult(_0x4ac052,_0x2e87a5){return function(_0x16d9c9){if(_0x16d9c9){var _0x291b1e=typeof _0x2e87a5[_0xcc95('0x13')]===_0xcc95('0x14')&&typeof _0x2e87a5[_0xcc95('0x15')]===_0xcc95('0x14');var _0x5c4597=_0x16d9c9[_0xcc95('0x16')];var _0x5eee08=_0x291b1e?0x0:_0x2e87a5[_0xcc95('0x13')];var _0x3a6c5a=_0x291b1e?_0x16d9c9['count']:_0x2e87a5[_0xcc95('0x13')]+_0x2e87a5['limit'];var _0x24bf70;if(_0x3a6c5a>=_0x5c4597){_0x3a6c5a=_0x5c4597;_0x24bf70=0xc8;}else{_0x24bf70=0xce;}_0x4ac052[_0xcc95('0x11')](_0x24bf70);return _0x4ac052[_0xcc95('0x17')](_0xcc95('0x18'),_0x5eee08+'-'+_0x3a6c5a+'/'+_0x5c4597)[_0xcc95('0x19')](_0x16d9c9);}return null;};}function saveUpdates(_0x10d84c){return function(_0x2ed753){if(_0x2ed753){return _0x2ed753['update'](_0x10d84c)[_0xcc95('0x1a')](function(_0x3d5c7d){return _0x3d5c7d;});}return null;};}function removeEntity(_0x3eb233){return function(_0x2c7e95){if(_0x2c7e95){return _0x2c7e95[_0xcc95('0x1b')]()[_0xcc95('0x1a')](function(){_0x3eb233[_0xcc95('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b72d4){return function(_0x4fa9b5){if(!_0x4fa9b5){_0x5b72d4[_0xcc95('0x1c')](0x194);}return _0x4fa9b5;};}function handleError(_0x3a893c,_0x2d099d){_0x2d099d=_0x2d099d||0x1f4;return function(_0x2e91ee){logger[_0xcc95('0x1d')](_0x2e91ee[_0xcc95('0x1e')]);if(_0x2e91ee[_0xcc95('0x1f')]){delete _0x2e91ee[_0xcc95('0x1f')];}_0x3a893c['status'](_0x2d099d)[_0xcc95('0x20')](_0x2e91ee);};}exports[_0xcc95('0x21')]=function(_0x5662af,_0x352e7d){var _0x42ec48={};var _0x4d2c20=_[_0xcc95('0x22')](db['SmsInteraction'][_0xcc95('0x23')],function(_0x3e4d1f){return{'name':_0x3e4d1f[_0xcc95('0x24')],'type':_0x3e4d1f[_0xcc95('0x25')][_0xcc95('0x26')]};});_0x42ec48=qs[_0xcc95('0x27')](_0x4d2c20,_0x5662af);return interaction[_0xcc95('0x28')]('sms',_0x5662af[_0xcc95('0x29')],_0x5662af['user'],_0x42ec48,_0x4d2c20)[_0xcc95('0x1a')](respondWithFilteredResult(_0x352e7d,_0x42ec48))['catch'](handleError(_0x352e7d,null));};exports[_0xcc95('0x2a')]=function(_0x4fb26b,_0x51c43f){var _0x610d30={'raw':![],'where':{'id':_0x4fb26b['params']['id']}},_0x20a33e={};_0x20a33e[_0xcc95('0x2b')]=_[_0xcc95('0x2c')](db[_0xcc95('0x2d')][_0xcc95('0x23')]);_0x20a33e['query']=_[_0xcc95('0x2c')](_0x4fb26b[_0xcc95('0x29')]);_0x20a33e[_0xcc95('0x2e')]=_[_0xcc95('0x2f')](_0x20a33e[_0xcc95('0x2b')],_0x20a33e[_0xcc95('0x29')]);_0x610d30[_0xcc95('0x30')]=_['intersection'](_0x20a33e[_0xcc95('0x2b')],qs['fields'](_0x4fb26b[_0xcc95('0x29')][_0xcc95('0x31')]));_0x610d30[_0xcc95('0x30')]=_0x610d30[_0xcc95('0x30')][_0xcc95('0x32')]?_0x610d30[_0xcc95('0x30')]:_0x20a33e['model'];if(_0x4fb26b[_0xcc95('0x29')][_0xcc95('0x33')]){_0x610d30[_0xcc95('0x34')]=[{'all':!![]}];}_0x610d30=_[_0xcc95('0x35')]({},_0x610d30,_0x4fb26b['options']);return db[_0xcc95('0x2d')][_0xcc95('0x36')](_0x610d30)[_0xcc95('0x1a')](handleEntityNotFound(_0x51c43f,null))['then'](respondWithResult(_0x51c43f,null))[_0xcc95('0x37')](handleError(_0x51c43f,null));};exports[_0xcc95('0x38')]=function(_0x84fea1,_0x5cf6cc){return db[_0xcc95('0x2d')][_0xcc95('0x38')](_0x84fea1[_0xcc95('0x39')],{})[_0xcc95('0x1a')](respondWithResult(_0x5cf6cc,0xc9))['catch'](handleError(_0x5cf6cc,null));};exports[_0xcc95('0x3a')]=function(_0x21b022,_0x525496){if(_0x21b022[_0xcc95('0x39')]['id']){delete _0x21b022['body']['id'];}return db['SmsInteraction'][_0xcc95('0x36')]({'where':{'id':_0x21b022[_0xcc95('0x3b')]['id']}})[_0xcc95('0x1a')](handleEntityNotFound(_0x525496,null))[_0xcc95('0x1a')](saveUpdates(_0x21b022[_0xcc95('0x39')],null))[_0xcc95('0x1a')](respondWithResult(_0x525496,null))[_0xcc95('0x37')](handleError(_0x525496,null));};exports[_0xcc95('0x1b')]=function(_0x962ec0,_0x589027){return db['SmsInteraction']['find']({'where':{'id':_0x962ec0[_0xcc95('0x3b')]['id']}})[_0xcc95('0x1a')](handleEntityNotFound(_0x589027,null))[_0xcc95('0x1a')](removeEntity(_0x589027,null))[_0xcc95('0x37')](handleError(_0x589027,null));};exports[_0xcc95('0x3c')]=function(_0x3e5c9e,_0xaf202){return db[_0xcc95('0x2d')]['describe']()[_0xcc95('0x1a')](respondWithResult(_0xaf202,null))[_0xcc95('0x37')](handleError(_0xaf202,null));};exports[_0xcc95('0x3d')]=function(_0xf0aca3,_0x136e64){return db[_0xcc95('0x3e')][_0xcc95('0x36')]({'where':{'id':_0xf0aca3[_0xcc95('0x3b')]['id']}})[_0xcc95('0x1a')](handleEntityNotFound(_0x136e64,null))[_0xcc95('0x1a')](function(_0x20c025){if(_0x20c025){return _0x20c025[_0xcc95('0x3d')](_0xf0aca3['body'][_0xcc95('0x3f')],_[_0xcc95('0x40')](_0xf0aca3[_0xcc95('0x39')],[_0xcc95('0x3f'),'id'])||{});}})[_0xcc95('0x1a')](respondWithResult(_0x136e64,null))['catch'](handleError(_0x136e64,null));};exports[_0xcc95('0x41')]=function(_0x339a58,_0x43aa65){var _0x5b393d={'raw':![],'where':{}};var _0x16a31b={};var _0x1707cd={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xcc95('0x42')]({'where':{'id':_0x339a58[_0xcc95('0x3b')]['id']}})['then'](handleEntityNotFound(_0x43aa65,null))['then'](function(_0x2ddfc6){if(_0x2ddfc6){_0x16a31b['model']=_[_0xcc95('0x2c')](db[_0xcc95('0x3e')][_0xcc95('0x23')]);_0x16a31b['query']=_['keys'](_0x339a58[_0xcc95('0x29')]);_0x16a31b[_0xcc95('0x2e')]=_[_0xcc95('0x2f')](_0x16a31b[_0xcc95('0x2b')],_0x16a31b[_0xcc95('0x29')]);_0x5b393d[_0xcc95('0x30')]=_[_0xcc95('0x2f')](_0x16a31b[_0xcc95('0x2b')],qs['fields'](_0x339a58[_0xcc95('0x29')][_0xcc95('0x31')]));_0x5b393d[_0xcc95('0x30')]=_0x5b393d[_0xcc95('0x30')]['length']?_0x5b393d[_0xcc95('0x30')]:_0x16a31b['model'];if(!_0x339a58[_0xcc95('0x29')][_0xcc95('0x43')](_0xcc95('0x44'))){_0x5b393d['limit']=qs[_0xcc95('0x15')](_0x339a58[_0xcc95('0x29')][_0xcc95('0x15')]);_0x5b393d[_0xcc95('0x13')]=qs[_0xcc95('0x13')](_0x339a58['query']['offset']);}_0x5b393d[_0xcc95('0x45')]=qs[_0xcc95('0x46')](_0x339a58[_0xcc95('0x29')][_0xcc95('0x46')]);_0x5b393d[_0xcc95('0x47')]=qs[_0xcc95('0x2e')](_[_0xcc95('0x48')](_0x339a58[_0xcc95('0x29')],_0x16a31b['filters']));_0x5b393d['where'][_0xcc95('0x49')]=_0x2ddfc6['id'];if(_0x339a58[_0xcc95('0x29')][_0xcc95('0x4a')]){_0x5b393d[_0xcc95('0x47')]=_[_0xcc95('0x35')](_0x5b393d[_0xcc95('0x47')],{'$or':_['map'](_0x5b393d[_0xcc95('0x30')],function(_0x4be3da){var _0x5942ec={};_0x5942ec[_0x4be3da]={'$like':'%'+_0x339a58[_0xcc95('0x29')][_0xcc95('0x4a')]+'%'};return _0x5942ec;})});}if(_0x339a58['query'][_0xcc95('0x4b')]){var _0x35df8e=_0x339a58[_0xcc95('0x29')][_0xcc95('0x4b')][_0xcc95('0x4c')](',');var _0x49f31d={};_0x49f31d[_0x35df8e[0x0]]={'$gte':moment(_0x35df8e[0x1])['format'](_0xcc95('0x4d'))};_0x5b393d[_0xcc95('0x47')]=_['merge'](_0x5b393d[_0xcc95('0x47')],_0x49f31d);}_0x5b393d=_[_0xcc95('0x35')]({},_0x5b393d,_0x339a58[_0xcc95('0x4e')]);return db[_0xcc95('0x3e')][_0xcc95('0x16')]({'where':_0x5b393d[_0xcc95('0x47')]})[_0xcc95('0x1a')](function(_0x5ab18e){_0x1707cd[_0xcc95('0x16')]=_0x5ab18e;if(_0x339a58['query'][_0xcc95('0x33')]){_0x5b393d[_0xcc95('0x34')]=[{'all':!![]}];}return db[_0xcc95('0x3e')][_0xcc95('0x28')](_0x5b393d);})[_0xcc95('0x1a')](function(_0x48ce1b){_0x1707cd[_0xcc95('0x4f')]=_0x48ce1b;return _0x1707cd;});}})[_0xcc95('0x1a')](respondWithFilteredResult(_0x43aa65,_0x5b393d))[_0xcc95('0x37')](handleError(_0x43aa65,null));};exports[_0xcc95('0x50')]=function(_0x3d58ad,_0x3d1ba4){return db['SmsInteraction'][_0xcc95('0x36')]({'where':{'id':_0x3d58ad[_0xcc95('0x3b')]['id']}})[_0xcc95('0x1a')](handleEntityNotFound(_0x3d1ba4,null))['then'](function(_0x318915){if(_0x318915){return _0x318915[_0xcc95('0x51')](_0x3d58ad[_0xcc95('0x39')][_0xcc95('0x3f')],_[_0xcc95('0x40')](_0x3d58ad[_0xcc95('0x39')],[_0xcc95('0x3f'),'id'])||{})['spread'](function(){return db[_0xcc95('0x52')][_0xcc95('0x28')]({'attributes':['id','name','color'],'where':{'id':_0x3d58ad['body'][_0xcc95('0x3f')]}});})[_0xcc95('0x1a')](function(_0x23a214){socket[_0xcc95('0x53')]('smsInteractionTags:save',{'id':Number(_0x3d58ad['params']['id']),'tags':_0x23a214||[]});return{'id':Number(_0x3d58ad[_0xcc95('0x3b')]['id']),'tags':_0x23a214||[]};});}})['then'](respondWithResult(_0x3d1ba4,null))['catch'](handleError(_0x3d1ba4,null));};exports[_0xcc95('0x54')]=function(_0xde8911,_0x53a9fb){return db['SmsInteraction']['find']({'where':{'id':_0xde8911[_0xcc95('0x3b')]['id']}})['then'](handleEntityNotFound(_0x53a9fb,null))[_0xcc95('0x1a')](function(_0x4dbeb4){if(_0x4dbeb4){return _0x4dbeb4[_0xcc95('0x54')](_0xde8911[_0xcc95('0x29')][_0xcc95('0x3f')]);}})[_0xcc95('0x1a')](respondWithStatusCode(_0x53a9fb,null))[_0xcc95('0x37')](handleError(_0x53a9fb,null));};exports[_0xcc95('0x55')]=function(_0x410133,_0x4ad5ce){var _0x4d35ff=moment()[_0xcc95('0x56')]()[_0xcc95('0x57')]();var _0x58a887=path[_0xcc95('0x58')](config[_0xcc95('0x59')],'server',_0xcc95('0x5a'),_0xcc95('0x5b'));var _0x557743=path[_0xcc95('0x58')](_0x58a887,_0x4d35ff);var _0x2be08c=util[_0xcc95('0x5c')]('transcript-%d-%s.zip',_0x410133[_0xcc95('0x3b')]['id'],_0x4d35ff);var _0x20f232=path[_0xcc95('0x58')](_0x58a887,_0x2be08c);var _0x5dad34=[];_0x5dad34[_0xcc95('0x5d')]({'model':db[_0xcc95('0x5e')],'as':_0xcc95('0x5e'),'attributes':['id','fullname'],'raw':!![]});_0x5dad34[_0xcc95('0x5d')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xcc95('0x5f')],'raw':!![]});var _0xade1bf=[{'model':db[_0xcc95('0x3e')],'as':_0xcc95('0x60'),'attributes':['id','body',_0xcc95('0x61'),'direction',_0xcc95('0x62'),'read'],'include':_0x5dad34}];_0xade1bf[_0xcc95('0x5d')]({'model':db[_0xcc95('0x63')],'as':_0xcc95('0x64'),'attributes':['id',_0xcc95('0x1f')]});_0xade1bf[_0xcc95('0x5d')]({'model':db[_0xcc95('0x5e')],'as':_0xcc95('0x65'),'attributes':['id',_0xcc95('0x66')]});return db['SmsInteraction']['find']({'where':{'id':_0x410133['params']['id']},'include':_0xade1bf})[_0xcc95('0x1a')](handleEntityNotFound(_0x4ad5ce,null))['then'](function(_0x2cf747){if(_0x2cf747){var _0x107353=_0x2cf747[_0xcc95('0x67')]({'plain':!![]});fs[_0xcc95('0x68')](_0x557743);var _0x1b07b6={'channel':_0xcc95('0x69'),'account':_0x107353[_0xcc95('0x64')]['name'],'agent':_0x107353[_0xcc95('0x65')]?_0x107353[_0xcc95('0x65')][_0xcc95('0x66')]:'N.A.','createdAt':moment(_0x107353[_0xcc95('0x61')])[_0xcc95('0x5c')](_0xcc95('0x4d'))[_0xcc95('0x57')](),'closedAt':_0x107353[_0xcc95('0x6a')]?moment(_0x107353[_0xcc95('0x6b')])[_0xcc95('0x5c')](_0xcc95('0x4d'))['toString']():'','disposition':_0x107353[_0xcc95('0x6c')],'messages':_(_0x107353[_0xcc95('0x60')])[_0xcc95('0x4a')]({'secret':![]})[_0xcc95('0x22')](function(_0x399b5b){return{'date':moment(_0x399b5b[_0xcc95('0x61')])['format'](_0xcc95('0x4d'))[_0xcc95('0x57')](),'sender':_0x399b5b['direction']===_0xcc95('0x6d')?_0x399b5b[_0xcc95('0x5e')]?_0x399b5b[_0xcc95('0x5e')][_0xcc95('0x66')]:_0xcc95('0x6e'):_0x399b5b['Contact']['firstName']+(_0x399b5b[_0xcc95('0x6f')]['lastName']?'\x20'+_0x399b5b['Contact'][_0xcc95('0x5f')]:''),'body':_0x399b5b['body'],'direction':_0x399b5b[_0xcc95('0x70')]===_0xcc95('0x6d')?'A':'C','secret':_0x399b5b[_0xcc95('0x62')],'read':_0x399b5b[_0xcc95('0x71')]};})['value']()};return ejs[_0xcc95('0x72')](path[_0xcc95('0x58')](config[_0xcc95('0x59')],_0xcc95('0x73'),'views',_0xcc95('0x74')),{'interaction':_0x1b07b6})[_0xcc95('0x1a')](function(_0x20feeb){var _0x2c0c70=path[_0xcc95('0x58')](_0x557743,_0xcc95('0x75')+_0x107353['id']+'-'+_0x4d35ff+'.pdf');var _0x88acd={'path':_0x2c0c70,'channel':_0xcc95('0x69'),'interactionId':_0x107353['id']};return pdf[_0xcc95('0x76')](_0x20feeb,_0x88acd);})[_0xcc95('0x1a')](function(){return new BPromise(function(_0x3e3fc0,_0x2227ea){zipdir(_0x557743,{'saveTo':_0x20f232},function(_0x17d470,_0x1be3af){if(_0x17d470)return _0x2227ea(_0x17d470);return _0x3e3fc0(_0x1be3af);});})['then'](function(){return new BPromise(function(_0x1d4457,_0x1a1ff2){rimraf(_0x557743,function(_0x28b5d5){if(_0x28b5d5)_0x1a1ff2(_0x28b5d5);return _0x1d4457();});});})[_0xcc95('0x1a')](function(){return _0x4ad5ce[_0xcc95('0x55')](_0x20f232,_0x2be08c,function(_0x4ce069){if(_0x4ce069){console[_0xcc95('0x77')](_0xcc95('0x78'),_0x4ce069);}else{fs['unlinkSync'](_0x20f232);}});});});}else{return _0x4ad5ce[_0xcc95('0x1c')](0xc8);}})[_0xcc95('0x37')](handleError(_0x4ad5ce,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 83915db..001554b 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 _0xd7d1=['SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x372d35,_0x3b939c){var _0x53a050=function(_0x2ed7d8){while(--_0x2ed7d8){_0x372d35['push'](_0x372d35['shift']());}};_0x53a050(++_0x3b939c);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3724d4,_0x194592){_0x3724d4=_0x3724d4-0x0;var _0x504cc5=_0xd7d1[_0x3724d4];return _0x504cc5;};'use strict';var EventEmitter=require(_0x1d7d('0x0'));var SmsInteraction=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x2')];var SmsMessage=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1d7d('0x4')](0x0);var events={'afterCreate':_0x1d7d('0x5'),'afterUpdate':_0x1d7d('0x6'),'afterDestroy':_0x1d7d('0x7')};function emitEvent(_0x1adb6b){return function(_0x3c0839,_0x1a2564,_0x14b2b9){_0x3c0839['getUsers']({'attributes':['id'],'raw':!![]})[_0x1d7d('0x8')](function(_0x1aa456){_0x3c0839[_0x1d7d('0x9')](_0x1d7d('0xa'),_0x1aa456[_0x1d7d('0xb')](function(_0x268732){return{'id':_0x268732['id']};}));return SmsMessage[_0x1d7d('0xc')]({'where':{'SmsInteractionId':_0x3c0839['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1d7d('0x8')](function(_0x1ad06f){_0x3c0839[_0x1d7d('0x9')](_0x1d7d('0xd'),_0x1ad06f['length']);SmsInteractionEvents[_0x1d7d('0xe')](_0x1adb6b+':'+_0x3c0839['id'],_0x3c0839);SmsInteractionEvents['emit'](_0x1adb6b,_0x3c0839);_0x14b2b9(null);})[_0x1d7d('0xf')](_0x14b2b9(null));};}for(var e in events){if(events[_0x1d7d('0x10')](e)){var event=events[e];SmsInteraction[_0x1d7d('0x11')](e,emitEvent(event));}}module[_0x1d7d('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x0120=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x0120,0x6f));var _0x0012=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0120[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0x0012('0x0'));var SmsInteraction=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var SmsMessage=require(_0x0012('0x1'))['db'][_0x0012('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0012('0x4')](0x0);var events={'afterCreate':_0x0012('0x5'),'afterUpdate':_0x0012('0x6'),'afterDestroy':_0x0012('0x7')};function emitEvent(_0x302029){return function(_0x3505ab,_0x3fcfbc,_0x4eaa5b){_0x3505ab['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x95d441){_0x3505ab[_0x0012('0x8')](_0x0012('0x9'),_0x95d441[_0x0012('0xa')](function(_0x33c82f){return{'id':_0x33c82f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3505ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0012('0xb')](function(_0x2d484c){_0x3505ab[_0x0012('0x8')](_0x0012('0xc'),_0x2d484c['length']);SmsInteractionEvents[_0x0012('0xd')](_0x302029+':'+_0x3505ab['id'],_0x3505ab);SmsInteractionEvents['emit'](_0x302029,_0x3505ab);_0x4eaa5b(null);})[_0x0012('0xe')](_0x4eaa5b(null));};}for(var e in events){if(events[_0x0012('0xf')](e)){var event=events[e];SmsInteraction[_0x0012('0x10')](e,emitEvent(event));}}module[_0x0012('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index d1b9968..27263b8 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 _0xbe53=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','../../config/environment','exports','define','SmsInteraction','sms_interactions'];(function(_0x5e3d08,_0x40c70c){var _0x30a59e=function(_0x314dd4){while(--_0x314dd4){_0x5e3d08['push'](_0x5e3d08['shift']());}};_0x30a59e(++_0x40c70c);}(_0xbe53,0x155));var _0x3be5=function(_0x13e9ad,_0x4445fa){_0x13e9ad=_0x13e9ad-0x0;var _0x35ac77=_0xbe53[_0x13e9ad];return _0x35ac77;};'use strict';var _=require('lodash');var util=require(_0x3be5('0x0'));var logger=require(_0x3be5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3be5('0x2'));var rp=require(_0x3be5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3be5('0x4'));var attributes=require('./smsInteraction.attributes');module[_0x3be5('0x5')]=function(_0xa67466,_0x11316e){return _0xa67466[_0x3be5('0x6')](_0x3be5('0x7'),attributes,{'tableName':_0x3be5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd00301,_0x52445c,_0x5b8659){if(_0xd00301[_0x3be5('0x9')](_0x3be5('0xa'))){_0xd00301[_0x3be5('0xb')]=moment()[_0x3be5('0xc')](_0x3be5('0xd'));}_0x5b8659(null,_0xd00301);}}});}; \ No newline at end of file +var _0x24c3=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x252b3c,_0x4f1ee6){var _0x1da8ce=function(_0x5e567a){while(--_0x5e567a){_0x252b3c['push'](_0x252b3c['shift']());}};_0x1da8ce(++_0x4f1ee6);}(_0x24c3,0x102));var _0x324c=function(_0x1c9e8d,_0x5e976f){_0x1c9e8d=_0x1c9e8d-0x0;var _0x1a6df5=_0x24c3[_0x1c9e8d];return _0x1a6df5;};'use strict';var _=require(_0x324c('0x0'));var util=require('util');var logger=require(_0x324c('0x1'))(_0x324c('0x2'));var moment=require(_0x324c('0x3'));var BPromise=require(_0x324c('0x4'));var rp=require(_0x324c('0x5'));var fs=require('fs');var path=require(_0x324c('0x6'));var rimraf=require(_0x324c('0x7'));var config=require(_0x324c('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x453ad7,_0x2f1ae5){return _0x453ad7[_0x324c('0x9')](_0x324c('0xa'),attributes,{'tableName':_0x324c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5da6d3,_0x5bdd52,_0xc57f7a){if(_0x5da6d3[_0x324c('0xc')](_0x324c('0xd'))){_0x5da6d3['closedAt']=moment()[_0x324c('0xe')](_0x324c('0xf'));}_0xc57f7a(null,_0x5da6d3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c7d2212..ef6386c 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 _0xe6d4=['options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','body'];(function(_0x5342c0,_0x5071b8){var _0x21376c=function(_0x264e44){while(--_0x264e44){_0x5342c0['push'](_0x5342c0['shift']());}};_0x21376c(++_0x5071b8);}(_0xe6d4,0xe4));var _0x4e6d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe6d4[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4e6d('0x0'));var util=require(_0x4e6d('0x1'));var moment=require('moment');var BPromise=require(_0x4e6d('0x2'));var rs=require(_0x4e6d('0x3'));var fs=require('fs');var Redis=require(_0x4e6d('0x4'));var db=require(_0x4e6d('0x5'))['db'];var utils=require(_0x4e6d('0x6'));var logger=require(_0x4e6d('0x7'))(_0x4e6d('0x8'));var config=require(_0x4e6d('0x9'));var jayson=require(_0x4e6d('0xa'));var client=jayson[_0x4e6d('0xb')][_0x4e6d('0xc')]({'port':0x232a});config[_0x4e6d('0xd')]=_['defaults'](config[_0x4e6d('0xd')],{'host':_0x4e6d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4e6d('0xf'))[_0x4e6d('0x10')](socket);function respondWithRpcPromise(_0xe17e35,_0xf26cc7,_0x579203){return new BPromise(function(_0x2de820,_0x83f204){return client[_0x4e6d('0x11')](_0xe17e35,_0x579203)[_0x4e6d('0x12')](function(_0x1bd1dd){logger[_0x4e6d('0x13')](_0x4e6d('0x14'),_0xf26cc7,'request\x20sent');logger[_0x4e6d('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xf26cc7,_0x4e6d('0x16'),JSON[_0x4e6d('0x17')](_0x1bd1dd));if(_0x1bd1dd[_0x4e6d('0x18')]){if(_0x1bd1dd['error'][_0x4e6d('0x19')]===0x1f4){logger[_0x4e6d('0x18')](_0x4e6d('0x14'),_0xf26cc7,_0x1bd1dd[_0x4e6d('0x18')]['message']);return _0x83f204(_0x1bd1dd[_0x4e6d('0x18')][_0x4e6d('0x1a')]);}logger[_0x4e6d('0x18')](_0x4e6d('0x14'),_0xf26cc7,_0x1bd1dd[_0x4e6d('0x18')][_0x4e6d('0x1a')]);return _0x2de820(_0x1bd1dd[_0x4e6d('0x18')][_0x4e6d('0x1a')]);}else{logger[_0x4e6d('0x13')](_0x4e6d('0x14'),_0xf26cc7,'request\x20sent');_0x2de820(_0x1bd1dd[_0x4e6d('0x1b')][_0x4e6d('0x1a')]);}})[_0x4e6d('0x1c')](function(_0x8d18d5){logger['error']('SmsInteraction,\x20%s,\x20%s',_0xf26cc7,_0x8d18d5);_0x83f204(_0x8d18d5);});});}exports['UpdateSmsInteraction']=function(_0x1ba693){var _0xe97166=this;return new Promise(function(_0x4d6745,_0x52a7f2){return db['SmsInteraction']['update'](_0x1ba693[_0x4e6d('0x1d')],{'raw':_0x1ba693[_0x4e6d('0x1e')]?_0x1ba693[_0x4e6d('0x1e')][_0x4e6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ba693[_0x4e6d('0x1e')]?_0x1ba693[_0x4e6d('0x1e')][_0x4e6d('0x20')]||null:null,'attributes':_0x1ba693['options']?_0x1ba693[_0x4e6d('0x1e')][_0x4e6d('0x21')]||null:null,'limit':_0x1ba693[_0x4e6d('0x1e')]?_0x1ba693[_0x4e6d('0x1e')][_0x4e6d('0x22')]||null:null})[_0x4e6d('0x12')](function(_0x1a8735){logger['info'](_0x4e6d('0x23'),_0x1ba693);logger[_0x4e6d('0x15')](_0x4e6d('0x23'),_0x1ba693,JSON['stringify'](_0x1a8735));_0x4d6745(_0x1a8735);})[_0x4e6d('0x1c')](function(_0x346c97){logger[_0x4e6d('0x18')]('UpdateSmsInteraction',_0x346c97[_0x4e6d('0x1a')],_0x1ba693);_0x52a7f2(_0xe97166[_0x4e6d('0x18')](0x1f4,_0x346c97['message']));});});};exports[_0x4e6d('0x24')]=function(_0x8e9ef1){return new Promise(function(_0xfedcb0,_0x193aba){return db['SmsInteraction'][_0x4e6d('0x25')]({'where':_0x8e9ef1[_0x4e6d('0x1e')]?_0x8e9ef1[_0x4e6d('0x1e')][_0x4e6d('0x20')]||null:null})[_0x4e6d('0x12')](function(_0x2fd625){if(_0x2fd625){return _0x2fd625[_0x4e6d('0x26')](_0x8e9ef1[_0x4e6d('0x1d')][_0x4e6d('0x27')],_[_0x4e6d('0x28')](_0x8e9ef1['body'],['ids','id'])||{});}})[_0x4e6d('0x29')](function(_0x33045a){logger['info'](_0x4e6d('0x2a'),_0x8e9ef1);logger[_0x4e6d('0x15')](_0x4e6d('0x2a'),_0x8e9ef1,JSON['stringify'](_0x33045a));_0xfedcb0(_0x33045a);})[_0x4e6d('0x1c')](function(_0x17ea00){logger[_0x4e6d('0x18')](_0x4e6d('0x2a'),_0x17ea00[_0x4e6d('0x1a')],_0x8e9ef1);_0x193aba(_this[_0x4e6d('0x18')](0x1f4,_0x17ea00[_0x4e6d('0x1a')]));});});}; \ No newline at end of file +var _0xb738=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','then','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb738,0xa2));var _0x8b73=function(_0x4edc1e,_0x3dd3eb){_0x4edc1e=_0x4edc1e-0x0;var _0x30bf30=_0xb738[_0x4edc1e];return _0x30bf30;};'use strict';var _=require(_0x8b73('0x0'));var util=require('util');var moment=require(_0x8b73('0x1'));var BPromise=require(_0x8b73('0x2'));var rs=require(_0x8b73('0x3'));var fs=require('fs');var Redis=require(_0x8b73('0x4'));var db=require(_0x8b73('0x5'))['db'];var utils=require(_0x8b73('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b73('0x7'));var jayson=require(_0x8b73('0x8'));var client=jayson[_0x8b73('0x9')][_0x8b73('0xa')]({'port':0x232a});config[_0x8b73('0xb')]=_['defaults'](config[_0x8b73('0xb')],{'host':_0x8b73('0xc'),'port':0x18eb});var socket=require(_0x8b73('0xd'))(new Redis(config[_0x8b73('0xb')]));require(_0x8b73('0xe'))[_0x8b73('0xf')](socket);function respondWithRpcPromise(_0x1b6fdc,_0x490df4,_0x323f26){return new BPromise(function(_0x186e72,_0x419c6f){return client[_0x8b73('0x10')](_0x1b6fdc,_0x323f26)['then'](function(_0x5cd1f1){logger[_0x8b73('0x11')](_0x8b73('0x12'),_0x490df4,_0x8b73('0x13'));logger[_0x8b73('0x14')](_0x8b73('0x15'),_0x490df4,_0x8b73('0x13'),JSON[_0x8b73('0x16')](_0x5cd1f1));if(_0x5cd1f1['error']){if(_0x5cd1f1[_0x8b73('0x17')]['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x490df4,_0x5cd1f1[_0x8b73('0x17')]['message']);return _0x419c6f(_0x5cd1f1[_0x8b73('0x17')][_0x8b73('0x18')]);}logger['error'](_0x8b73('0x12'),_0x490df4,_0x5cd1f1[_0x8b73('0x17')]['message']);return _0x186e72(_0x5cd1f1['error'][_0x8b73('0x18')]);}else{logger[_0x8b73('0x11')](_0x8b73('0x12'),_0x490df4,_0x8b73('0x13'));_0x186e72(_0x5cd1f1[_0x8b73('0x19')][_0x8b73('0x18')]);}})[_0x8b73('0x1a')](function(_0x98d28c){logger['error'](_0x8b73('0x12'),_0x490df4,_0x98d28c);_0x419c6f(_0x98d28c);});});}exports[_0x8b73('0x1b')]=function(_0x366cbf){var _0x305c2c=this;return new Promise(function(_0x45324c,_0x331a1c){return db[_0x8b73('0x1c')][_0x8b73('0x1d')](_0x366cbf[_0x8b73('0x1e')],{'raw':_0x366cbf[_0x8b73('0x1f')]?_0x366cbf[_0x8b73('0x1f')][_0x8b73('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x366cbf[_0x8b73('0x1f')]?_0x366cbf[_0x8b73('0x1f')][_0x8b73('0x21')]||null:null,'attributes':_0x366cbf[_0x8b73('0x1f')]?_0x366cbf[_0x8b73('0x1f')]['attributes']||null:null,'limit':_0x366cbf[_0x8b73('0x1f')]?_0x366cbf[_0x8b73('0x1f')][_0x8b73('0x22')]||null:null})[_0x8b73('0x23')](function(_0x5d4508){logger[_0x8b73('0x11')]('UpdateSmsInteraction',_0x366cbf);logger[_0x8b73('0x14')](_0x8b73('0x1b'),_0x366cbf,JSON[_0x8b73('0x16')](_0x5d4508));_0x45324c(_0x5d4508);})[_0x8b73('0x1a')](function(_0x127bb6){logger[_0x8b73('0x17')](_0x8b73('0x1b'),_0x127bb6[_0x8b73('0x18')],_0x366cbf);_0x331a1c(_0x305c2c[_0x8b73('0x17')](0x1f4,_0x127bb6[_0x8b73('0x18')]));});});};exports[_0x8b73('0x24')]=function(_0x183bde){return new Promise(function(_0x459a02,_0x1bfbb4){return db['SmsInteraction'][_0x8b73('0x25')]({'where':_0x183bde[_0x8b73('0x1f')]?_0x183bde[_0x8b73('0x1f')]['where']||null:null})[_0x8b73('0x23')](function(_0x4fff44){if(_0x4fff44){return _0x4fff44[_0x8b73('0x26')](_0x183bde[_0x8b73('0x1e')][_0x8b73('0x27')],_['omit'](_0x183bde[_0x8b73('0x1e')],[_0x8b73('0x27'),'id'])||{});}})[_0x8b73('0x28')](function(_0x1a0306){logger[_0x8b73('0x11')](_0x8b73('0x29'),_0x183bde);logger[_0x8b73('0x14')](_0x8b73('0x29'),_0x183bde,JSON['stringify'](_0x1a0306));_0x459a02(_0x1a0306);})[_0x8b73('0x1a')](function(_0x4d241e){logger[_0x8b73('0x17')]('AddTags',_0x4d241e[_0x8b73('0x18')],_0x183bde);_0x1bfbb4(_this['error'](0x1f4,_0x4d241e[_0x8b73('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3d5e86f..8a18475 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 _0xc2ce=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3f8167,_0x5c36aa){var _0x1241c3=function(_0x4548b5){while(--_0x4548b5){_0x3f8167['push'](_0x3f8167['shift']());}};_0x1241c3(++_0x5c36aa);}(_0xc2ce,0x13d));var _0xec2c=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0xc2ce[_0x127a60];return _0xc1f6a3;};'use strict';var SmsInteractionEvents=require(_0xec2c('0x0'));var events=[_0xec2c('0x1'),_0xec2c('0x2'),_0xec2c('0x3')];function createListener(_0x2d212c,_0x40bd46){return function(_0x3bf4ec){_0x40bd46[_0xec2c('0x4')](_0x2d212c,_0x3bf4ec);};}function removeListener(_0x5cf59b,_0x454e60){return function(){SmsInteractionEvents[_0xec2c('0x5')](_0x5cf59b,_0x454e60);};}exports[_0xec2c('0x6')]=function(_0x20bf43){for(var _0x144c96=0x0,_0x404b19=events[_0xec2c('0x7')];_0x144c96<_0x404b19;_0x144c96++){var _0x31323e=events[_0x144c96];var _0x59bbe8=createListener(_0xec2c('0x8')+_0x31323e,_0x20bf43);SmsInteractionEvents['on'](_0x31323e,_0x59bbe8);}}; \ No newline at end of file +var _0x594d=['save','remove','update','emit','length','./smsInteraction.events'];(function(_0x3f4683,_0x4062f9){var _0x1a80aa=function(_0x5dea92){while(--_0x5dea92){_0x3f4683['push'](_0x3f4683['shift']());}};_0x1a80aa(++_0x4062f9);}(_0x594d,0x11f));var _0xd594=function(_0x40f8f0,_0x36dd7d){_0x40f8f0=_0x40f8f0-0x0;var _0x4941a7=_0x594d[_0x40f8f0];return _0x4941a7;};'use strict';var SmsInteractionEvents=require(_0xd594('0x0'));var events=[_0xd594('0x1'),_0xd594('0x2'),_0xd594('0x3')];function createListener(_0x2c2043,_0x59a799){return function(_0x46a7c9){_0x59a799[_0xd594('0x4')](_0x2c2043,_0x46a7c9);};}function removeListener(_0x1c7eb8,_0x25c528){return function(){SmsInteractionEvents['removeListener'](_0x1c7eb8,_0x25c528);};}exports['register']=function(_0x1c4e5a){for(var _0x45cafc=0x0,_0xbf0669=events[_0xd594('0x5')];_0x45cafc<_0xbf0669;_0x45cafc++){var _0xe37093=events[_0x45cafc];var _0x71a19b=createListener('smsInteraction:'+_0xe37093,_0x1c4e5a);SmsInteractionEvents['on'](_0xe37093,_0x71a19b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8ca5484..a34e55f 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 _0xfd7b=['../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','create','/:id/status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xfd7b,0xd1));var _0xbfd7=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xfd7b[_0xb1cf84];return _0x4bad2e;};'use strict';var multer=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var path=require(_0xbfd7('0x2'));var timeout=require('connect-timeout');var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbfd7('0x6'));var config=require(_0xbfd7('0x7'));var controller=require(_0xbfd7('0x8'));router['get']('/',auth[_0xbfd7('0x9')](),controller[_0xbfd7('0xa')]);router['get'](_0xbfd7('0xb'),auth[_0xbfd7('0x9')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbfd7('0xe')]('/',auth[_0xbfd7('0x9')](),interaction[_0xbfd7('0xf')](_0xbfd7('0x10'),'smsmessage:create'),controller[_0xbfd7('0x11')]);router[_0xbfd7('0xe')](_0xbfd7('0x12'),controller['status']);router[_0xbfd7('0x13')](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0x14')]);router[_0xbfd7('0x13')]('/:id/accept',auth[_0xbfd7('0x9')](),controller[_0xbfd7('0x15')]);router[_0xbfd7('0x13')](_0xbfd7('0x16'),auth[_0xbfd7('0x9')](),controller[_0xbfd7('0x17')]);router[_0xbfd7('0x18')](_0xbfd7('0xd'),auth[_0xbfd7('0x9')](),controller[_0xbfd7('0x19')]);module[_0xbfd7('0x1a')]=router; \ No newline at end of file +var _0xd8fe=['/describe','describe','get','/:id','show','post','tracked','smsmessage:create','/:id/status','status','put','update','accept','/:id/reject','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8fe,0xfa));var _0xed8f=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xd8fe[_0x264545];return _0x114d10;};'use strict';var multer=require(_0xed8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xed8f('0x1'));var express=require(_0xed8f('0x2'));var router=express[_0xed8f('0x3')]();var fs_extra=require(_0xed8f('0x4'));var auth=require(_0xed8f('0x5'));var interaction=require(_0xed8f('0x6'));var config=require('../../config/environment');var controller=require(_0xed8f('0x7'));router['get']('/',auth[_0xed8f('0x8')](),controller[_0xed8f('0x9')]);router['get'](_0xed8f('0xa'),auth[_0xed8f('0x8')](),controller[_0xed8f('0xb')]);router[_0xed8f('0xc')](_0xed8f('0xd'),auth[_0xed8f('0x8')](),controller[_0xed8f('0xe')]);router[_0xed8f('0xf')]('/',auth[_0xed8f('0x8')](),interaction[_0xed8f('0x10')]('sms',_0xed8f('0x11')),controller['create']);router[_0xed8f('0xf')](_0xed8f('0x12'),controller[_0xed8f('0x13')]);router[_0xed8f('0x14')](_0xed8f('0xd'),auth['isAuthenticated'](),controller[_0xed8f('0x15')]);router[_0xed8f('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0xed8f('0x16')]);router[_0xed8f('0x14')](_0xed8f('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xed8f('0xd'),auth['isAuthenticated'](),controller[_0xed8f('0x18')]);module[_0xed8f('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d75e515..43d7d61 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 _0x7485=['TEXT','sequelize','exports','medium','BOOLEAN','out','STRING'];(function(_0x16c58d,_0x19b86c){var _0x117b9e=function(_0x37bbcf){while(--_0x37bbcf){_0x16c58d['push'](_0x16c58d['shift']());}};_0x117b9e(++_0x19b86c);}(_0x7485,0x135));var _0x5748=function(_0x2b1888,_0x41f33e){_0x2b1888=_0x2b1888-0x0;var _0x31e99d=_0x7485[_0x2b1888];return _0x31e99d;};'use strict';var Sequelize=require(_0x5748('0x0'));module[_0x5748('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5748('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5748('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5748('0x4')),'defaultValue':_0x5748('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5748('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5748('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5748('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5748('0x5')]},'providerResponse':{'type':Sequelize[_0x5748('0x6')]}}; \ No newline at end of file +var _0x81ef=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x111692,_0x19f8a9){var _0x11836f=function(_0x2f2714){while(--_0x2f2714){_0x111692['push'](_0x111692['shift']());}};_0x11836f(++_0x19f8a9);}(_0x81ef,0xc3));var _0xf81e=function(_0x18f5ee,_0x2c9733){_0x18f5ee=_0x18f5ee-0x0;var _0x25e16f=_0x81ef[_0x18f5ee];return _0x25e16f;};'use strict';var Sequelize=require(_0xf81e('0x0'));module[_0xf81e('0x1')]={'body':{'type':Sequelize[_0xf81e('0x2')](_0xf81e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf81e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf81e('0x5')]('in',_0xf81e('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf81e('0x7')]},'readAt':{'type':Sequelize[_0xf81e('0x8')]},'secret':{'type':Sequelize[_0xf81e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf81e('0x7')]},'providerResponse':{'type':Sequelize[_0xf81e('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0714805..b900ae4 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 _0xf03d=['lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','stack','name','index','SmsMessage','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','show','params','create','body','find','describe','../../config/logger','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','user','role','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x414901,_0x20ee6a){var _0x2cae72=function(_0x1f13bc){while(--_0x1f13bc){_0x414901['push'](_0x414901['shift']());}};_0x2cae72(++_0x20ee6a);}(_0xf03d,0x1a7));var _0xdf03=function(_0x3051e7,_0x3cd14d){_0x3051e7=_0x3051e7-0x0;var _0x4fbc85=_0xf03d[_0x3051e7];return _0x4fbc85;};'use strict';var emlformat=require(_0xdf03('0x0'));var rimraf=require(_0xdf03('0x1'));var zipdir=require(_0xdf03('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf03('0x3'));var moment=require(_0xdf03('0x4'));var BPromise=require(_0xdf03('0x5'));var Mustache=require(_0xdf03('0x6'));var util=require(_0xdf03('0x7'));var path=require(_0xdf03('0x8'));var sox=require(_0xdf03('0x9'));var csv=require(_0xdf03('0xa'));var ejs=require(_0xdf03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf03('0xc'));var squel=require('squel');var crypto=require(_0xdf03('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdf03('0xe'));var toCsv=require(_0xdf03('0xa'));var querystring=require(_0xdf03('0xf'));var Papa=require(_0xdf03('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf03('0x11'));var as=require(_0xdf03('0x12'));var hardwareService=require(_0xdf03('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdf03('0x14'));var licenseUtil=require(_0xdf03('0x15'));var db=require('../../mysqldb')['db'];config[_0xdf03('0x16')]=_[_0xdf03('0x17')](config[_0xdf03('0x16')],{'host':_0xdf03('0x18'),'port':0x18eb});var socket=require(_0xdf03('0x19'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xdf03('0x1a'));var client=jayson[_0xdf03('0x1b')][_0xdf03('0x1c')]({'port':0x232c});var client9002=jayson[_0xdf03('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43ab5d,_0x1b4b7f,_0x3b936a,_0x3bb274){return new BPromise(function(_0x216176,_0x232938){var _0x406451=_0x3bb274||client;return _0x406451[_0xdf03('0x1d')](_0x43ab5d,_0x3b936a)['then'](function(_0x112d54){logger['info'](_0xdf03('0x1e'),_0x1b4b7f,_0xdf03('0x1f'));logger[_0xdf03('0x20')](_0xdf03('0x21'),_0x1b4b7f,_0xdf03('0x1f'),JSON[_0xdf03('0x22')](_0x112d54));if(_0x112d54[_0xdf03('0x23')]){if(_0x112d54[_0xdf03('0x23')]['code']===0x1f4){logger[_0xdf03('0x23')](_0xdf03('0x1e'),_0x1b4b7f,_0x112d54['error'][_0xdf03('0x24')]);return _0x232938(_0x112d54['error'][_0xdf03('0x24')]);}logger['error'](_0xdf03('0x1e'),_0x1b4b7f,_0x112d54[_0xdf03('0x23')][_0xdf03('0x24')]);return _0x216176(_0x112d54['error'][_0xdf03('0x24')]);}else{logger[_0xdf03('0x25')](_0xdf03('0x1e'),_0x1b4b7f,_0xdf03('0x1f'));_0x216176(_0x112d54[_0xdf03('0x26')][_0xdf03('0x24')]);}})[_0xdf03('0x27')](function(_0x4cc4f3){logger['error'](_0xdf03('0x1e'),_0x1b4b7f,_0x4cc4f3);_0x232938(_0x4cc4f3);});});}function respondWithStatusCode(_0x2457a6,_0x2c61cc){_0x2c61cc=_0x2c61cc||0xcc;return function(_0x5cd6ce){if(_0x5cd6ce){return _0x2457a6[_0xdf03('0x28')](_0x2c61cc);}return _0x2457a6['status'](_0x2c61cc)[_0xdf03('0x29')]();};}function respondWithResult(_0x11f483,_0x309a02){_0x309a02=_0x309a02||0xc8;return function(_0x1ab727){if(_0x1ab727){return _0x11f483[_0xdf03('0x2a')](_0x309a02)[_0xdf03('0x2b')](_0x1ab727);}};}function respondWithFilteredResult(_0x19d26d,_0x3affb7){return function(_0x1ca481){if(_0x1ca481){var _0x587303=typeof _0x3affb7[_0xdf03('0x2c')]===_0xdf03('0x2d')&&typeof _0x3affb7['limit']===_0xdf03('0x2d');var _0x4187b7=_0x1ca481['count'];var _0x786365=_0x587303?0x0:_0x3affb7['offset'];var _0x52ec9f=_0x587303?_0x1ca481[_0xdf03('0x2e')]:_0x3affb7[_0xdf03('0x2c')]+_0x3affb7[_0xdf03('0x2f')];var _0x514124;if(_0x52ec9f>=_0x4187b7){_0x52ec9f=_0x4187b7;_0x514124=0xc8;}else{_0x514124=0xce;}_0x19d26d[_0xdf03('0x2a')](_0x514124);return _0x19d26d['set'](_0xdf03('0x30'),_0x786365+'-'+_0x52ec9f+'/'+_0x4187b7)['json'](_0x1ca481);}return null;};}function patchUpdates(_0x4b9c46){return function(_0x17103d){try{jsonpatch['apply'](_0x17103d,_0x4b9c46,!![]);}catch(_0x591f40){return BPromise[_0xdf03('0x31')](_0x591f40);}return _0x17103d['save']();};}function saveUpdates(_0x3ec641,_0x1056c3){return function(_0x51c67d){if(_0x51c67d){return _0x51c67d[_0xdf03('0x32')](_0x3ec641)[_0xdf03('0x33')](function(_0x4f7add){return _0x4f7add;});}return null;};}function removeEntity(_0xb1a799,_0x24e8f5){return function(_0x563c9d){if(_0x563c9d){return _0x563c9d[_0xdf03('0x34')]()[_0xdf03('0x33')](function(){_0xb1a799['status'](0xcc)[_0xdf03('0x29')]();});}};}function handleEntityNotFound(_0x14171,_0x541fec){return function(_0x14d878){if(!_0x14d878){_0x14171[_0xdf03('0x28')](0x194);}return _0x14d878;};}function handleError(_0x588724,_0x1ccb9f){_0x1ccb9f=_0x1ccb9f||0x1f4;return function(_0x382431){logger[_0xdf03('0x23')](_0x382431[_0xdf03('0x35')]);if(_0x382431[_0xdf03('0x36')]){delete _0x382431[_0xdf03('0x36')];}_0x588724[_0xdf03('0x2a')](_0x1ccb9f)['send'](_0x382431);};}exports[_0xdf03('0x37')]=function(_0x14d5b6,_0x261965){var _0x1dfed5={},_0x129aa4={},_0xbfd796={'count':0x0,'rows':[]};var _0x455e99=_['map'](db[_0xdf03('0x38')][_0xdf03('0x39')],function(_0x1ac94d){return{'name':_0x1ac94d['fieldName'],'type':_0x1ac94d[_0xdf03('0x3a')][_0xdf03('0x3b')]};});_0x129aa4[_0xdf03('0x3c')]=_[_0xdf03('0x3d')](_0x455e99,'name');_0x129aa4[_0xdf03('0x3e')]=_[_0xdf03('0x3f')](_0x14d5b6[_0xdf03('0x3e')]);_0x129aa4['filters']=_[_0xdf03('0x40')](_0x129aa4[_0xdf03('0x3c')],_0x129aa4[_0xdf03('0x3e')]);_0x1dfed5[_0xdf03('0x41')]=_['intersection'](_0x129aa4['model'],qs['fields'](_0x14d5b6[_0xdf03('0x3e')][_0xdf03('0x42')]));_0x1dfed5[_0xdf03('0x41')]=_0x1dfed5[_0xdf03('0x41')][_0xdf03('0x43')]?_0x1dfed5[_0xdf03('0x41')]:_0x129aa4['model'];if(!_0x14d5b6[_0xdf03('0x3e')][_0xdf03('0x44')](_0xdf03('0x45'))){_0x1dfed5[_0xdf03('0x2f')]=qs['limit'](_0x14d5b6[_0xdf03('0x3e')][_0xdf03('0x2f')]);_0x1dfed5[_0xdf03('0x2c')]=qs['offset'](_0x14d5b6['query'][_0xdf03('0x2c')]);}_0x1dfed5[_0xdf03('0x46')]=qs['sort'](_0x14d5b6[_0xdf03('0x3e')][_0xdf03('0x47')]);_0x1dfed5['where']=qs[_0xdf03('0x48')](_[_0xdf03('0x49')](_0x14d5b6[_0xdf03('0x3e')],_0x129aa4[_0xdf03('0x48')]),_0x455e99);if(_0x14d5b6[_0xdf03('0x3e')][_0xdf03('0x4a')]){_0x1dfed5[_0xdf03('0x4b')]=_['merge'](_0x1dfed5[_0xdf03('0x4b')],{'$or':_[_0xdf03('0x3d')](_0x455e99,function(_0x4b3025){if(_0x4b3025['type']!=='VIRTUAL'){var _0x381008={};_0x381008[_0x4b3025[_0xdf03('0x36')]]={'$like':'%'+_0x14d5b6[_0xdf03('0x3e')][_0xdf03('0x4a')]+'%'};return _0x381008;}})});}_0x1dfed5=_[_0xdf03('0x4c')]({},_0x1dfed5,_0x14d5b6[_0xdf03('0x4d')]);var _0x113ffe={'where':_0x1dfed5[_0xdf03('0x4b')]};return db[_0xdf03('0x38')][_0xdf03('0x2e')](_0x113ffe)[_0xdf03('0x33')](function(_0x4881d5){_0xbfd796[_0xdf03('0x2e')]=_0x4881d5;if(_0x14d5b6['query'][_0xdf03('0x4e')]){_0x1dfed5[_0xdf03('0x4f')]=[{'all':!![]}];}return db[_0xdf03('0x38')]['findAll'](_0x1dfed5);})[_0xdf03('0x33')](function(_0x402b1a){_0xbfd796[_0xdf03('0x50')]=_0x402b1a;return _0xbfd796;})[_0xdf03('0x33')](respondWithFilteredResult(_0x261965,_0x1dfed5))['catch'](handleError(_0x261965,null));};exports[_0xdf03('0x51')]=function(_0x267a59,_0x49db04){var _0x4dced6={'raw':!![],'where':{'id':_0x267a59[_0xdf03('0x52')]['id']}},_0x209afc={};_0x209afc[_0xdf03('0x3c')]=_[_0xdf03('0x3f')](db[_0xdf03('0x38')]['rawAttributes']);_0x209afc[_0xdf03('0x3e')]=_[_0xdf03('0x3f')](_0x267a59[_0xdf03('0x3e')]);_0x209afc[_0xdf03('0x48')]=_[_0xdf03('0x40')](_0x209afc[_0xdf03('0x3c')],_0x209afc[_0xdf03('0x3e')]);_0x4dced6[_0xdf03('0x41')]=_['intersection'](_0x209afc[_0xdf03('0x3c')],qs[_0xdf03('0x42')](_0x267a59[_0xdf03('0x3e')]['fields']));_0x4dced6[_0xdf03('0x41')]=_0x4dced6['attributes'][_0xdf03('0x43')]?_0x4dced6[_0xdf03('0x41')]:_0x209afc[_0xdf03('0x3c')];if(_0x267a59['query'][_0xdf03('0x4e')]){_0x4dced6['include']=[{'all':!![]}];}_0x4dced6=_[_0xdf03('0x4c')]({},_0x4dced6,_0x267a59[_0xdf03('0x4d')]);return db[_0xdf03('0x38')]['find'](_0x4dced6)[_0xdf03('0x33')](handleEntityNotFound(_0x49db04,null))[_0xdf03('0x33')](respondWithResult(_0x49db04,null))[_0xdf03('0x27')](handleError(_0x49db04,null));};exports[_0xdf03('0x53')]=function(_0x25e46e,_0x362eb5){return db[_0xdf03('0x38')][_0xdf03('0x53')](_0x25e46e[_0xdf03('0x54')],{})[_0xdf03('0x33')](respondWithResult(_0x362eb5,0xc9))[_0xdf03('0x27')](handleError(_0x362eb5,null));};exports[_0xdf03('0x32')]=function(_0x3fc0b5,_0x556627){if(_0x3fc0b5[_0xdf03('0x54')]['id']){delete _0x3fc0b5[_0xdf03('0x54')]['id'];}return db[_0xdf03('0x38')][_0xdf03('0x55')]({'where':{'id':_0x3fc0b5[_0xdf03('0x52')]['id']}})[_0xdf03('0x33')](handleEntityNotFound(_0x556627,null))[_0xdf03('0x33')](saveUpdates(_0x3fc0b5['body'],null))[_0xdf03('0x33')](respondWithResult(_0x556627,null))[_0xdf03('0x27')](handleError(_0x556627,null));};exports[_0xdf03('0x34')]=function(_0x4a92c5,_0xef4515){return db[_0xdf03('0x38')][_0xdf03('0x55')]({'where':{'id':_0x4a92c5[_0xdf03('0x52')]['id']}})[_0xdf03('0x33')](handleEntityNotFound(_0xef4515,null))[_0xdf03('0x33')](removeEntity(_0xef4515,null))[_0xdf03('0x27')](handleError(_0xef4515,null));};exports[_0xdf03('0x56')]=function(_0xf02a97,_0x590183){return db[_0xdf03('0x38')][_0xdf03('0x56')]()[_0xdf03('0x33')](respondWithResult(_0x590183,null))[_0xdf03('0x27')](handleError(_0x590183,null));};var interaction_log=require(_0xdf03('0x57'))('sms-interactions');exports[_0xdf03('0x58')]=function(_0x347b45,_0x420148,_0x5daccb){var _0x31ae71={'agent':{},'channel':_0xdf03('0x59')};if(_0x347b45[_0xdf03('0x54')]['id']){delete _0x347b45['body']['id'];}_0x347b45[_0xdf03('0x54')]['read']=!![];_0x347b45[_0xdf03('0x54')]['readAt']=moment()[_0xdf03('0x5a')](_0xdf03('0x5b'));_0x347b45[_0xdf03('0x54')][_0xdf03('0x5c')]=_0x347b45[_0xdf03('0x54')][_0xdf03('0x5c')]||_0x347b45['user']['id'];_0x31ae71['agent']['id']=_0x347b45[_0xdf03('0x54')][_0xdf03('0x5c')];return db[_0xdf03('0x38')][_0xdf03('0x55')]({'where':{'id':_0x347b45[_0xdf03('0x52')]['id'],'UserId':null}})[_0xdf03('0x33')](handleEntityNotFound(_0x420148,null))['then'](saveUpdates(_0x347b45[_0xdf03('0x54')],null))[_0xdf03('0x33')](function(_0x52ab18){if(_0x52ab18){_0x31ae71[_0xdf03('0x24')]=_0x52ab18[_0xdf03('0x5d')]({'plain':!![]});return db[_0xdf03('0x5e')][_0xdf03('0x55')]({'where':{'id':_0x52ab18[_0xdf03('0x5f')]}});}return null;})[_0xdf03('0x33')](handleEntityNotFound(_0x420148,null))[_0xdf03('0x33')](function(_0x4dac41){if(_0x4dac41){return _0x4dac41['update']({'UserId':_0x347b45['body'][_0xdf03('0x5c')],'read1stAt':_[_0xdf03('0x60')](_0x4dac41[_0xdf03('0x61')])?moment()[_0xdf03('0x5a')](_0xdf03('0x5b')):undefined});}return null;})[_0xdf03('0x33')](function(_0x34b671){if(_0x34b671){_0x31ae71['interaction']=_0x34b671[_0xdf03('0x5d')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x347b45[_0xdf03('0x62')]['id'],_0x347b45['user']['name'],_0x347b45[_0xdf03('0x62')][_0xdf03('0x63')],_0x31ae71[_0xdf03('0x64')]['id'],_0x347b45[_0xdf03('0x54')]?JSON[_0xdf03('0x22')](_0x347b45[_0xdf03('0x54')]):'null');return respondWithRpcPromise(_0xdf03('0x65'),_0xdf03('0x66'),_0x31ae71);}return null;})[_0xdf03('0x33')](function(_0x222956){var _0x2de49a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x222956[_0xdf03('0x24')][_0xdf03('0x67')];return db[_0xdf03('0x68')][_0xdf03('0x3e')](_0x2de49a,{'type':db[_0xdf03('0x69')][_0xdf03('0x6a')][_0xdf03('0x6b')],'raw':!![]})['then'](function(_0x1c24f2){return _0x1c24f2;});})[_0xdf03('0x33')](function(_0xbecbec){if(_0xbecbec){_0x31ae71['message'][_0xdf03('0x6c')]=_0xbecbec[0x0];if(!_0x347b45['body']['UserId'])return;return db[_0xdf03('0x6d')]['find']({'where':{'id':_0x347b45[_0xdf03('0x54')]['UserId'],'role':_0xdf03('0x6e')},'attributes':['id',_0xdf03('0x36'),_0xdf03('0x6f'),_0xdf03('0x70'),_0xdf03('0x71')],'raw':!![]});}return null;})[_0xdf03('0x33')](function(_0x5b40f5){if(!_0x5b40f5)return null;_0x31ae71[_0xdf03('0x24')]['agent']=_0x5b40f5;return _0x31ae71;})[_0xdf03('0x33')](function(_0x278b73){if(_0x278b73){if(_0x347b45[_0xdf03('0x54')][_0xdf03('0x72')]){_0x31ae71[_0xdf03('0x24')][_0xdf03('0x73')]=util[_0xdf03('0x5a')](_0xdf03('0x74'),_0x347b45[_0xdf03('0x62')][_0xdf03('0x36')]);_0x31ae71[_0xdf03('0x24')][_0xdf03('0x75')]=_0x31ae71[_0xdf03('0x75')];_0x31ae71[_0xdf03('0x24')][_0xdf03('0x76')]=_0x31ae71['channel'];_0x31ae71[_0xdf03('0x24')]['event']=_0xdf03('0x58');return respondWithRpcPromise('EventManager',_0xdf03('0x77'),{'event':_0xdf03('0x78'),'message':_0x31ae71['message']},client9002)[_0xdf03('0x33')](function(){return _0x31ae71;});}return _0x31ae71;}return null;})[_0xdf03('0x33')](respondWithResult(_0x420148,null))[_0xdf03('0x27')](handleError(_0x420148,null));};var interaction_log=require(_0xdf03('0x57'))(_0xdf03('0x79'));exports[_0xdf03('0x31')]=function(_0x2ee07b,_0x466c02,_0x188d6f){var _0x131868={'agent':{},'channel':_0xdf03('0x59')};if(_0x2ee07b[_0xdf03('0x54')]['id']){delete _0x2ee07b[_0xdf03('0x54')]['id'];}_0x2ee07b[_0xdf03('0x54')][_0xdf03('0x5c')]=_0x2ee07b[_0xdf03('0x54')][_0xdf03('0x5c')]||_0x2ee07b[_0xdf03('0x62')]['id'];_0x131868[_0xdf03('0x6e')]['id']=_0x2ee07b[_0xdf03('0x54')]['UserId'];return db['SmsMessage'][_0xdf03('0x55')]({'where':{'id':_0x2ee07b[_0xdf03('0x52')]['id'],'UserId':null}})[_0xdf03('0x33')](handleEntityNotFound(_0x466c02,null))[_0xdf03('0x33')](function(_0x381404){if(_0x381404){_0x131868[_0xdf03('0x24')]=_0x381404['get']({'plain':!![]});return db['SmsInteraction'][_0xdf03('0x55')]({'where':{'id':_0x381404[_0xdf03('0x5f')]}});}return null;})[_0xdf03('0x33')](handleEntityNotFound(_0x466c02,null))[_0xdf03('0x33')](function(_0x5b6133){if(_0x5b6133){_0x131868[_0xdf03('0x64')]=_0x5b6133['get']({'plain':!![]});interaction_log[_0xdf03('0x25')](_0xdf03('0x7a'),_0x2ee07b[_0xdf03('0x62')]['id'],_0x2ee07b['user'][_0xdf03('0x36')],_0x2ee07b[_0xdf03('0x62')][_0xdf03('0x63')],_0x131868['interaction']['id'],_0x2ee07b[_0xdf03('0x54')]?JSON[_0xdf03('0x22')](_0x2ee07b[_0xdf03('0x54')]):_0xdf03('0x7b'));return respondWithRpcPromise(_0xdf03('0x7c'),'rejectMessage',_0x131868);}return null;})['then'](function(_0x537f62){var _0x48b6b4=_0xdf03('0x7d')+_0x537f62[_0xdf03('0x24')][_0xdf03('0x67')];return db[_0xdf03('0x68')]['query'](_0x48b6b4,{'type':db[_0xdf03('0x69')][_0xdf03('0x6a')]['SELECT'],'raw':!![]})[_0xdf03('0x33')](function(_0x54cae5){return _0x54cae5;});})[_0xdf03('0x33')](function(_0x2cd9b4){if(_0x2cd9b4){_0x131868['message'][_0xdf03('0x6c')]=_0x2cd9b4[0x0];if(!_0x2ee07b[_0xdf03('0x54')][_0xdf03('0x5c')])return;return db['User']['find']({'where':{'id':_0x2ee07b[_0xdf03('0x54')]['UserId'],'role':_0xdf03('0x6e')},'attributes':['id','name','fullname',_0xdf03('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4a2a1f){if(!_0x4a2a1f)return null;_0x131868[_0xdf03('0x24')]['agent']=_0x4a2a1f;return _0x131868;})[_0xdf03('0x33')](function(_0x2ff584){if(_0x2ff584){_0x2ff584[_0xdf03('0x24')][_0xdf03('0x73')]=util[_0xdf03('0x5a')](_0xdf03('0x74'),_0x2ee07b['user'][_0xdf03('0x36')]);_0x2ff584[_0xdf03('0x24')][_0xdf03('0x75')]=_0x131868[_0xdf03('0x75')];_0x2ff584[_0xdf03('0x24')]['motionChannel']=_0x131868[_0xdf03('0x75')];_0x2ff584[_0xdf03('0x24')][_0xdf03('0x7e')]=_0xdf03('0x31');respondWithRpcPromise('EventManager',_0xdf03('0x77'),{'event':'rejectmessage','message':_0x2ff584[_0xdf03('0x24')]},client9002);return _0x131868;}return null;})['then'](respondWithResult(_0x466c02,null))[_0xdf03('0x27')](handleError(_0x466c02,null));};exports[_0xdf03('0x2a')]=function(_0x319437,_0x2a3450,_0x513790){if(_0x319437[_0xdf03('0x54')]['id']){delete _0x319437[_0xdf03('0x54')]['id'];}var _0x2943a2;return db[_0xdf03('0x38')]['find']({'where':{'id':_0x319437[_0xdf03('0x52')]['id']}})[_0xdf03('0x33')](handleEntityNotFound(_0x2a3450,null))[_0xdf03('0x33')](function(_0x5424b6){if(_0x5424b6){_0x2943a2=_0x5424b6;return db['SmsAccount']['find']({'where':{'id':_0x5424b6[_0xdf03('0x7f')]}});}})['then'](handleEntityNotFound(_0x2a3450,null))[_0xdf03('0x33')](function(_0x366c92){if(_0x366c92){logger['debug'](_0xdf03('0x21'),'status',_0xdf03('0x80'),_0x366c92[_0xdf03('0x3a')],util[_0xdf03('0x81')](_0x319437[_0xdf03('0x54')],{'showHidden':![],'depth':null}));switch(_0x366c92[_0xdf03('0x3a')]){case _0xdf03('0x82'):if(_0x319437[_0xdf03('0x54')][_0xdf03('0x83')]&&_0x319437['body'][_0xdf03('0x83')]===_0x2943a2['messageId']){return _0x2943a2['update']({'read':!![]});}else{logger[_0xdf03('0x23')](_0xdf03('0x84'),_0xdf03('0x2a'),'twilio',util[_0xdf03('0x81')](_0x319437[_0xdf03('0x54')],{'showHidden':![],'depth':null}));}break;case _0xdf03('0x85'):if(_0x319437[_0xdf03('0x54')]['MessageUUID']&&_0x319437[_0xdf03('0x54')][_0xdf03('0x86')]===_0x2943a2[_0xdf03('0x87')]&&_[_0xdf03('0x88')]([_0xdf03('0x89'),_0xdf03('0x8a')],_0x319437[_0xdf03('0x54')][_0xdf03('0x8b')])>=0x0){return _0x2943a2[_0xdf03('0x32')]({'read':!![]});}else{logger[_0xdf03('0x23')](_0xdf03('0x84'),_0xdf03('0x2a'),_0xdf03('0x8c'),util[_0xdf03('0x81')](_0x319437[_0xdf03('0x54')],{'showHidden':![],'depth':null}));}break;case _0xdf03('0x8d'):var _0x69885b=_0x319437[_0xdf03('0x54')][_0xdf03('0x8e')][0x0];if(_0x69885b[_0xdf03('0x2a')][_0xdf03('0x8f')]===_0xdf03('0x90')){return _0x2943a2[_0xdf03('0x32')]({'read':!![]});}else{logger[_0xdf03('0x23')](_0xdf03('0x84'),_0xdf03('0x2a'),_0xdf03('0x8d'),util[_0xdf03('0x81')](_0x319437['body'],{'showHidden':![],'depth':null}));}break;}return _0x2943a2;}})[_0xdf03('0x33')](respondWithResult(_0x2a3450,null))[_0xdf03('0x27')](handleError(_0x2a3450,null));}; \ No newline at end of file +var _0xa93a=['format','interaction','get','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','fullname','email','SIP/%s','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','client','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','save','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','VIRTUAL','merge','options','where','SmsMessage','includeAll','include','findAll','show','params','model','intersection','find','create','body','update','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId'];(function(_0x18845f,_0x3cc1b4){var _0x3d38ed=function(_0x2d206d){while(--_0x2d206d){_0x18845f['push'](_0x18845f['shift']());}};_0x3d38ed(++_0x3cc1b4);}(_0xa93a,0xb8));var _0xaa93=function(_0x39873b,_0x4b3afe){_0x39873b=_0x39873b-0x0;var _0x2ce3cc=_0xa93a[_0x39873b];return _0x2ce3cc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa93('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa93('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xaa93('0x2'));var util=require('util');var path=require(_0xaa93('0x3'));var sox=require(_0xaa93('0x4'));var csv=require(_0xaa93('0x5'));var ejs=require(_0xaa93('0x6'));var fs=require('fs');var fs_extra=require(_0xaa93('0x7'));var _=require('lodash');var squel=require(_0xaa93('0x8'));var crypto=require(_0xaa93('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xaa93('0xa'));var toCsv=require('to-csv');var querystring=require(_0xaa93('0xb'));var Papa=require(_0xaa93('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa93('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa93('0xe'))(_0xaa93('0xf'));var utils=require(_0xaa93('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa93('0x11'))['db'];config['redis']=_[_0xaa93('0x12')](config['redis'],{'host':_0xaa93('0x13'),'port':0x18eb});var socket=require(_0xaa93('0x14'))(new Redis(config[_0xaa93('0x15')]));require(_0xaa93('0x16'))[_0xaa93('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaa93('0x18')]['http']({'port':0x232c});var client9002=jayson[_0xaa93('0x18')][_0xaa93('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x59d73c,_0x543a57,_0x1394d5,_0x665c32){return new BPromise(function(_0x1cc0bc,_0x33cab3){var _0x1f6d57=_0x665c32||client;return _0x1f6d57[_0xaa93('0x1a')](_0x59d73c,_0x1394d5)[_0xaa93('0x1b')](function(_0x28b89d){logger[_0xaa93('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x543a57,_0xaa93('0x1d'));logger[_0xaa93('0x1e')](_0xaa93('0x1f'),_0x543a57,'request\x20sent',JSON[_0xaa93('0x20')](_0x28b89d));if(_0x28b89d[_0xaa93('0x21')]){if(_0x28b89d['error'][_0xaa93('0x22')]===0x1f4){logger['error'](_0xaa93('0x23'),_0x543a57,_0x28b89d['error'][_0xaa93('0x24')]);return _0x33cab3(_0x28b89d[_0xaa93('0x21')]['message']);}logger[_0xaa93('0x21')]('SmsMessage,\x20%s,\x20%s',_0x543a57,_0x28b89d[_0xaa93('0x21')][_0xaa93('0x24')]);return _0x1cc0bc(_0x28b89d['error']['message']);}else{logger[_0xaa93('0x1c')](_0xaa93('0x23'),_0x543a57,_0xaa93('0x1d'));_0x1cc0bc(_0x28b89d['result']['message']);}})[_0xaa93('0x25')](function(_0x51a0de){logger[_0xaa93('0x21')](_0xaa93('0x23'),_0x543a57,_0x51a0de);_0x33cab3(_0x51a0de);});});}function respondWithStatusCode(_0x1941b8,_0x584059){_0x584059=_0x584059||0xcc;return function(_0x2c2e8f){if(_0x2c2e8f){return _0x1941b8[_0xaa93('0x26')](_0x584059);}return _0x1941b8[_0xaa93('0x27')](_0x584059)[_0xaa93('0x28')]();};}function respondWithResult(_0x5333ad,_0x3e225f){_0x3e225f=_0x3e225f||0xc8;return function(_0x592f06){if(_0x592f06){return _0x5333ad['status'](_0x3e225f)['json'](_0x592f06);}};}function respondWithFilteredResult(_0x535a92,_0x3b7b4c){return function(_0x76cd82){if(_0x76cd82){var _0x46c3ae=typeof _0x3b7b4c[_0xaa93('0x29')]==='undefined'&&typeof _0x3b7b4c[_0xaa93('0x2a')]===_0xaa93('0x2b');var _0x3afae7=_0x76cd82[_0xaa93('0x2c')];var _0x1317e8=_0x46c3ae?0x0:_0x3b7b4c[_0xaa93('0x29')];var _0x455227=_0x46c3ae?_0x76cd82[_0xaa93('0x2c')]:_0x3b7b4c[_0xaa93('0x29')]+_0x3b7b4c[_0xaa93('0x2a')];var _0x5618af;if(_0x455227>=_0x3afae7){_0x455227=_0x3afae7;_0x5618af=0xc8;}else{_0x5618af=0xce;}_0x535a92['status'](_0x5618af);return _0x535a92['set'](_0xaa93('0x2d'),_0x1317e8+'-'+_0x455227+'/'+_0x3afae7)[_0xaa93('0x2e')](_0x76cd82);}return null;};}function patchUpdates(_0x47265e){return function(_0x4a1108){try{jsonpatch['apply'](_0x4a1108,_0x47265e,!![]);}catch(_0x469a0c){return BPromise['reject'](_0x469a0c);}return _0x4a1108[_0xaa93('0x2f')]();};}function saveUpdates(_0x42c42a,_0x1e9be3){return function(_0x1451df){if(_0x1451df){return _0x1451df['update'](_0x42c42a)[_0xaa93('0x1b')](function(_0x46f46d){return _0x46f46d;});}return null;};}function removeEntity(_0x1b6e9e,_0x390767){return function(_0x31de11){if(_0x31de11){return _0x31de11['destroy']()[_0xaa93('0x1b')](function(){_0x1b6e9e['status'](0xcc)[_0xaa93('0x28')]();});}};}function handleEntityNotFound(_0x465db0,_0xf6f427){return function(_0x1fb0e7){if(!_0x1fb0e7){_0x465db0[_0xaa93('0x26')](0x194);}return _0x1fb0e7;};}function handleError(_0x2313cb,_0x582829){_0x582829=_0x582829||0x1f4;return function(_0x548c0d){logger['error'](_0x548c0d[_0xaa93('0x30')]);if(_0x548c0d['name']){delete _0x548c0d[_0xaa93('0x31')];}_0x2313cb[_0xaa93('0x27')](_0x582829)['send'](_0x548c0d);};}exports[_0xaa93('0x32')]=function(_0x44fc71,_0x3c972e){var _0x355fc0={},_0x3b2c81={},_0x172c74={'count':0x0,'rows':[]};var _0x2b67c7=_[_0xaa93('0x33')](db['SmsMessage'][_0xaa93('0x34')],function(_0x2fede7){return{'name':_0x2fede7[_0xaa93('0x35')],'type':_0x2fede7[_0xaa93('0x36')]['key']};});_0x3b2c81['model']=_['map'](_0x2b67c7,'name');_0x3b2c81[_0xaa93('0x37')]=_[_0xaa93('0x38')](_0x44fc71[_0xaa93('0x37')]);_0x3b2c81[_0xaa93('0x39')]=_['intersection'](_0x3b2c81['model'],_0x3b2c81[_0xaa93('0x37')]);_0x355fc0[_0xaa93('0x3a')]=_['intersection'](_0x3b2c81['model'],qs[_0xaa93('0x3b')](_0x44fc71[_0xaa93('0x37')]['fields']));_0x355fc0[_0xaa93('0x3a')]=_0x355fc0['attributes'][_0xaa93('0x3c')]?_0x355fc0['attributes']:_0x3b2c81['model'];if(!_0x44fc71[_0xaa93('0x37')][_0xaa93('0x3d')]('nolimit')){_0x355fc0[_0xaa93('0x2a')]=qs[_0xaa93('0x2a')](_0x44fc71[_0xaa93('0x37')][_0xaa93('0x2a')]);_0x355fc0[_0xaa93('0x29')]=qs[_0xaa93('0x29')](_0x44fc71[_0xaa93('0x37')][_0xaa93('0x29')]);}_0x355fc0[_0xaa93('0x3e')]=qs['sort'](_0x44fc71[_0xaa93('0x37')][_0xaa93('0x3f')]);_0x355fc0['where']=qs['filters'](_[_0xaa93('0x40')](_0x44fc71[_0xaa93('0x37')],_0x3b2c81[_0xaa93('0x39')]),_0x2b67c7);if(_0x44fc71[_0xaa93('0x37')][_0xaa93('0x41')]){_0x355fc0['where']=_['merge'](_0x355fc0['where'],{'$or':_[_0xaa93('0x33')](_0x2b67c7,function(_0x4dfe00){if(_0x4dfe00[_0xaa93('0x36')]!==_0xaa93('0x42')){var _0x3d991d={};_0x3d991d[_0x4dfe00[_0xaa93('0x31')]]={'$like':'%'+_0x44fc71[_0xaa93('0x37')][_0xaa93('0x41')]+'%'};return _0x3d991d;}})});}_0x355fc0=_[_0xaa93('0x43')]({},_0x355fc0,_0x44fc71[_0xaa93('0x44')]);var _0x4de61={'where':_0x355fc0[_0xaa93('0x45')]};return db[_0xaa93('0x46')]['count'](_0x4de61)[_0xaa93('0x1b')](function(_0x483041){_0x172c74[_0xaa93('0x2c')]=_0x483041;if(_0x44fc71[_0xaa93('0x37')][_0xaa93('0x47')]){_0x355fc0[_0xaa93('0x48')]=[{'all':!![]}];}return db[_0xaa93('0x46')][_0xaa93('0x49')](_0x355fc0);})[_0xaa93('0x1b')](function(_0x2c7cc4){_0x172c74['rows']=_0x2c7cc4;return _0x172c74;})[_0xaa93('0x1b')](respondWithFilteredResult(_0x3c972e,_0x355fc0))[_0xaa93('0x25')](handleError(_0x3c972e,null));};exports[_0xaa93('0x4a')]=function(_0x2b28ce,_0x1978a0){var _0x293f56={'raw':!![],'where':{'id':_0x2b28ce[_0xaa93('0x4b')]['id']}},_0x5d2b3c={};_0x5d2b3c[_0xaa93('0x4c')]=_[_0xaa93('0x38')](db[_0xaa93('0x46')]['rawAttributes']);_0x5d2b3c['query']=_[_0xaa93('0x38')](_0x2b28ce[_0xaa93('0x37')]);_0x5d2b3c[_0xaa93('0x39')]=_[_0xaa93('0x4d')](_0x5d2b3c[_0xaa93('0x4c')],_0x5d2b3c[_0xaa93('0x37')]);_0x293f56[_0xaa93('0x3a')]=_[_0xaa93('0x4d')](_0x5d2b3c[_0xaa93('0x4c')],qs[_0xaa93('0x3b')](_0x2b28ce[_0xaa93('0x37')][_0xaa93('0x3b')]));_0x293f56[_0xaa93('0x3a')]=_0x293f56[_0xaa93('0x3a')]['length']?_0x293f56[_0xaa93('0x3a')]:_0x5d2b3c[_0xaa93('0x4c')];if(_0x2b28ce['query'][_0xaa93('0x47')]){_0x293f56['include']=[{'all':!![]}];}_0x293f56=_['merge']({},_0x293f56,_0x2b28ce[_0xaa93('0x44')]);return db[_0xaa93('0x46')][_0xaa93('0x4e')](_0x293f56)[_0xaa93('0x1b')](handleEntityNotFound(_0x1978a0,null))[_0xaa93('0x1b')](respondWithResult(_0x1978a0,null))['catch'](handleError(_0x1978a0,null));};exports['create']=function(_0x1d4517,_0x36684a){return db[_0xaa93('0x46')][_0xaa93('0x4f')](_0x1d4517[_0xaa93('0x50')],{})['then'](respondWithResult(_0x36684a,0xc9))[_0xaa93('0x25')](handleError(_0x36684a,null));};exports[_0xaa93('0x51')]=function(_0x50e70e,_0x439ffe){if(_0x50e70e[_0xaa93('0x50')]['id']){delete _0x50e70e[_0xaa93('0x50')]['id'];}return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x50e70e[_0xaa93('0x4b')]['id']}})['then'](handleEntityNotFound(_0x439ffe,null))['then'](saveUpdates(_0x50e70e[_0xaa93('0x50')],null))[_0xaa93('0x1b')](respondWithResult(_0x439ffe,null))['catch'](handleError(_0x439ffe,null));};exports['destroy']=function(_0x2ab945,_0x5c66b9){return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x2ab945['params']['id']}})[_0xaa93('0x1b')](handleEntityNotFound(_0x5c66b9,null))[_0xaa93('0x1b')](removeEntity(_0x5c66b9,null))[_0xaa93('0x25')](handleError(_0x5c66b9,null));};exports[_0xaa93('0x52')]=function(_0x4ffe17,_0x3838b6){return db['SmsMessage'][_0xaa93('0x52')]()[_0xaa93('0x1b')](respondWithResult(_0x3838b6,null))['catch'](handleError(_0x3838b6,null));};var interaction_log=require('../../config/logger')(_0xaa93('0x53'));exports['accept']=function(_0x4a8c2d,_0x2da5b6,_0x13d591){var _0x2a63b5={'agent':{},'channel':_0xaa93('0x54')};if(_0x4a8c2d['body']['id']){delete _0x4a8c2d['body']['id'];}_0x4a8c2d['body'][_0xaa93('0x55')]=!![];_0x4a8c2d['body']['readAt']=moment()['format'](_0xaa93('0x56'));_0x4a8c2d['body']['UserId']=_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')]||_0x4a8c2d[_0xaa93('0x58')]['id'];_0x2a63b5[_0xaa93('0x59')]['id']=_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')];return db['SmsMessage'][_0xaa93('0x4e')]({'where':{'id':_0x4a8c2d[_0xaa93('0x4b')]['id'],'UserId':null}})[_0xaa93('0x1b')](handleEntityNotFound(_0x2da5b6,null))[_0xaa93('0x1b')](saveUpdates(_0x4a8c2d[_0xaa93('0x50')],null))[_0xaa93('0x1b')](function(_0x4ad4a2){if(_0x4ad4a2){_0x2a63b5[_0xaa93('0x24')]=_0x4ad4a2['get']({'plain':!![]});return db[_0xaa93('0x5a')][_0xaa93('0x4e')]({'where':{'id':_0x4ad4a2[_0xaa93('0x5b')]}});}return null;})[_0xaa93('0x1b')](handleEntityNotFound(_0x2da5b6,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342['update']({'UserId':_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')],'read1stAt':_['isNil'](_0x37a342['read1stAt'])?moment()[_0xaa93('0x5c')](_0xaa93('0x56')):undefined});}return null;})['then'](function(_0x3c5958){if(_0x3c5958){_0x2a63b5[_0xaa93('0x5d')]=_0x3c5958[_0xaa93('0x5e')]({'plain':!![]});interaction_log[_0xaa93('0x1c')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a8c2d['user']['id'],_0x4a8c2d[_0xaa93('0x58')][_0xaa93('0x31')],_0x4a8c2d[_0xaa93('0x58')]['role'],_0x2a63b5['interaction']['id'],_0x4a8c2d['body']?JSON[_0xaa93('0x20')](_0x4a8c2d[_0xaa93('0x50')]):_0xaa93('0x5f'));return respondWithRpcPromise(_0xaa93('0x60'),_0xaa93('0x61'),_0x2a63b5);}return null;})[_0xaa93('0x1b')](function(_0x433748){var _0x3790b2=_0xaa93('0x62')+_0x433748[_0xaa93('0x24')][_0xaa93('0x63')];return db[_0xaa93('0x64')][_0xaa93('0x37')](_0x3790b2,{'type':db[_0xaa93('0x65')]['QueryTypes'][_0xaa93('0x66')],'raw':!![]})[_0xaa93('0x1b')](function(_0x18bd8b){return _0x18bd8b;});})[_0xaa93('0x1b')](function(_0x2d2106){if(_0x2d2106){_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x67')]=_0x2d2106[0x0];if(!_0x4a8c2d['body']['UserId'])return;return db[_0xaa93('0x68')]['find']({'where':{'id':_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')],'role':_0xaa93('0x59')},'attributes':['id',_0xaa93('0x31'),'fullname','email',_0xaa93('0x69')],'raw':!![]});}return null;})[_0xaa93('0x1b')](function(_0x2ceb96){if(!_0x2ceb96)return null;_0x2a63b5[_0xaa93('0x24')]['agent']=_0x2ceb96;return _0x2a63b5;})[_0xaa93('0x1b')](function(_0x2d6ca3){if(_0x2d6ca3){if(_0x4a8c2d['body'][_0xaa93('0x6a')]){_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6b')]=util['format']('SIP/%s',_0x4a8c2d['user'][_0xaa93('0x31')]);_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6c')]=_0x2a63b5[_0xaa93('0x6c')];_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6d')]=_0x2a63b5[_0xaa93('0x6c')];_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6e')]='accept';return respondWithRpcPromise(_0xaa93('0x6f'),'EventManager',{'event':_0xaa93('0x70'),'message':_0x2a63b5['message']},client9002)[_0xaa93('0x1b')](function(){return _0x2a63b5;});}return _0x2a63b5;}return null;})[_0xaa93('0x1b')](respondWithResult(_0x2da5b6,null))[_0xaa93('0x25')](handleError(_0x2da5b6,null));};var interaction_log=require(_0xaa93('0xe'))(_0xaa93('0x53'));exports[_0xaa93('0x71')]=function(_0x238148,_0x1b804c,_0x45c8dc){var _0x310ac8={'agent':{},'channel':'sms'};if(_0x238148['body']['id']){delete _0x238148[_0xaa93('0x50')]['id'];}_0x238148['body']['UserId']=_0x238148[_0xaa93('0x50')]['UserId']||_0x238148['user']['id'];_0x310ac8[_0xaa93('0x59')]['id']=_0x238148[_0xaa93('0x50')][_0xaa93('0x57')];return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x238148[_0xaa93('0x4b')]['id'],'UserId':null}})[_0xaa93('0x1b')](handleEntityNotFound(_0x1b804c,null))[_0xaa93('0x1b')](function(_0x2c6421){if(_0x2c6421){_0x310ac8[_0xaa93('0x24')]=_0x2c6421[_0xaa93('0x5e')]({'plain':!![]});return db[_0xaa93('0x5a')][_0xaa93('0x4e')]({'where':{'id':_0x2c6421[_0xaa93('0x5b')]}});}return null;})[_0xaa93('0x1b')](handleEntityNotFound(_0x1b804c,null))['then'](function(_0x1f675b){if(_0x1f675b){_0x310ac8[_0xaa93('0x5d')]=_0x1f675b['get']({'plain':!![]});interaction_log[_0xaa93('0x1c')](_0xaa93('0x72'),_0x238148[_0xaa93('0x58')]['id'],_0x238148['user']['name'],_0x238148[_0xaa93('0x58')][_0xaa93('0x73')],_0x310ac8[_0xaa93('0x5d')]['id'],_0x238148[_0xaa93('0x50')]?JSON[_0xaa93('0x20')](_0x238148[_0xaa93('0x50')]):'null');return respondWithRpcPromise(_0xaa93('0x74'),_0xaa93('0x75'),_0x310ac8);}return null;})[_0xaa93('0x1b')](function(_0x23fe7d){var _0x5a29bf=_0xaa93('0x62')+_0x23fe7d['message'][_0xaa93('0x63')];return db[_0xaa93('0x64')][_0xaa93('0x37')](_0x5a29bf,{'type':db[_0xaa93('0x65')]['QueryTypes']['SELECT'],'raw':!![]})[_0xaa93('0x1b')](function(_0xd599d6){return _0xd599d6;});})[_0xaa93('0x1b')](function(_0x55e816){if(_0x55e816){_0x310ac8[_0xaa93('0x24')][_0xaa93('0x67')]=_0x55e816[0x0];if(!_0x238148[_0xaa93('0x50')][_0xaa93('0x57')])return;return db[_0xaa93('0x68')][_0xaa93('0x4e')]({'where':{'id':_0x238148[_0xaa93('0x50')]['UserId'],'role':'agent'},'attributes':['id',_0xaa93('0x31'),_0xaa93('0x76'),_0xaa93('0x77'),_0xaa93('0x69')],'raw':!![]});}return null;})[_0xaa93('0x1b')](function(_0x3d8867){if(!_0x3d8867)return null;_0x310ac8[_0xaa93('0x24')][_0xaa93('0x59')]=_0x3d8867;return _0x310ac8;})[_0xaa93('0x1b')](function(_0x360cc3){if(_0x360cc3){_0x360cc3['message'][_0xaa93('0x6b')]=util[_0xaa93('0x5c')](_0xaa93('0x78'),_0x238148[_0xaa93('0x58')][_0xaa93('0x31')]);_0x360cc3[_0xaa93('0x24')][_0xaa93('0x6c')]=_0x310ac8[_0xaa93('0x6c')];_0x360cc3[_0xaa93('0x24')]['motionChannel']=_0x310ac8[_0xaa93('0x6c')];_0x360cc3[_0xaa93('0x24')][_0xaa93('0x6e')]=_0xaa93('0x71');respondWithRpcPromise(_0xaa93('0x6f'),_0xaa93('0x6f'),{'event':_0xaa93('0x79'),'message':_0x360cc3[_0xaa93('0x24')]},client9002);return _0x310ac8;}return null;})['then'](respondWithResult(_0x1b804c,null))['catch'](handleError(_0x1b804c,null));};exports[_0xaa93('0x27')]=function(_0x2f3cd2,_0x38ad98,_0x18ef08){if(_0x2f3cd2[_0xaa93('0x50')]['id']){delete _0x2f3cd2[_0xaa93('0x50')]['id'];}var _0xa6e395;return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x2f3cd2[_0xaa93('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38ad98,null))[_0xaa93('0x1b')](function(_0x360f5a){if(_0x360f5a){_0xa6e395=_0x360f5a;return db['SmsAccount']['find']({'where':{'id':_0x360f5a[_0xaa93('0x7a')]}});}})[_0xaa93('0x1b')](handleEntityNotFound(_0x38ad98,null))[_0xaa93('0x1b')](function(_0xccad4f){if(_0xccad4f){logger[_0xaa93('0x1e')](_0xaa93('0x1f'),_0xaa93('0x27'),'received\x20delivery\x20report\x20from',_0xccad4f[_0xaa93('0x36')],util[_0xaa93('0x7b')](_0x2f3cd2['body'],{'showHidden':![],'depth':null}));switch(_0xccad4f[_0xaa93('0x36')]){case _0xaa93('0x7c'):if(_0x2f3cd2[_0xaa93('0x50')][_0xaa93('0x7d')]&&_0x2f3cd2[_0xaa93('0x50')][_0xaa93('0x7d')]===_0xa6e395[_0xaa93('0x7e')]){return _0xa6e395[_0xaa93('0x51')]({'read':!![]});}else{logger[_0xaa93('0x21')](_0xaa93('0x7f'),'status','twilio',util[_0xaa93('0x7b')](_0x2f3cd2['body'],{'showHidden':![],'depth':null}));}break;case _0xaa93('0x80'):if(_0x2f3cd2['body'][_0xaa93('0x81')]&&_0x2f3cd2[_0xaa93('0x50')]['MessageUUID']===_0xa6e395[_0xaa93('0x7e')]&&_[_0xaa93('0x82')]([_0xaa93('0x83'),_0xaa93('0x84')],_0x2f3cd2[_0xaa93('0x50')]['Status'])>=0x0){return _0xa6e395[_0xaa93('0x51')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xaa93('0x85'),util[_0xaa93('0x7b')](_0x2f3cd2[_0xaa93('0x50')],{'showHidden':![],'depth':null}));}break;case _0xaa93('0x86'):var _0x1be539=_0x2f3cd2[_0xaa93('0x50')][_0xaa93('0x87')][0x0];if(_0x1be539['status'][_0xaa93('0x88')]===_0xaa93('0x89')){return _0xa6e395[_0xaa93('0x51')]({'read':!![]});}else{logger[_0xaa93('0x21')](_0xaa93('0x7f'),_0xaa93('0x27'),'infobip',util[_0xaa93('0x7b')](_0x2f3cd2[_0xaa93('0x50')],{'showHidden':![],'depth':null}));}break;}return _0xa6e395;}})[_0xaa93('0x1b')](respondWithResult(_0x38ad98,null))['catch'](handleError(_0x38ad98,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9b92e6f..984ac24 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 _0xd566=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x26c977,_0x44239c){var _0xcd119d=function(_0x1ccea8){while(--_0x1ccea8){_0x26c977['push'](_0x26c977['shift']());}};_0xcd119d(++_0x44239c);}(_0xd566,0xbd));var _0x6d56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd566[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x6d56('0x0'));var SmsMessage=require(_0x6d56('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6d56('0x2')](0x0);var events={'afterCreate':_0x6d56('0x3'),'afterUpdate':_0x6d56('0x4'),'afterDestroy':_0x6d56('0x5')};function emitEvent(_0x8f032a){return function(_0x46b7aa,_0x12202c,_0x13754e){SmsMessageEvents[_0x6d56('0x6')](_0x8f032a+':'+_0x46b7aa['id'],_0x46b7aa);SmsMessageEvents['emit'](_0x8f032a,_0x46b7aa);_0x13754e(null);};}for(var e in events){if(events[_0x6d56('0x7')](e)){var event=events[e];SmsMessage[_0x6d56('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x3cd7=['hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x3cd7,0x1f1));var _0x73cd=function(_0xf353f3,_0x4ca89b){_0xf353f3=_0xf353f3-0x0;var _0x4fa139=_0x3cd7[_0xf353f3];return _0x4fa139;};'use strict';var EventEmitter=require(_0x73cd('0x0'));var SmsMessage=require(_0x73cd('0x1'))['db'][_0x73cd('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x73cd('0x3')](0x0);var events={'afterCreate':_0x73cd('0x4'),'afterUpdate':'update','afterDestroy':_0x73cd('0x5')};function emitEvent(_0x348fee){return function(_0x2151b8,_0x2f6fde,_0x507910){SmsMessageEvents['emit'](_0x348fee+':'+_0x2151b8['id'],_0x2151b8);SmsMessageEvents[_0x73cd('0x6')](_0x348fee,_0x2151b8);_0x507910(null);};}for(var e in events){if(events[_0x73cd('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x73cd('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 d6a69d4..df06ef2 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 _0xbbed=['apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','code','message','Bearer\x20','refid','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token=','token','sid','update','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','login?username=','username','&password=','password','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','toString','base64','data','queued_count','clickSend','plivo','/api/sms/messages/','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','sender','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8'];(function(_0x25df55,_0x57ea51){var _0x4863e7=function(_0x3f5780){while(--_0x3f5780){_0x25df55['push'](_0x25df55['shift']());}};_0x4863e7(++_0x57ea51);}(_0xbbed,0x1e4));var _0xdbbe=function(_0x17959b,_0x4cd9f0){_0x17959b=_0x17959b-0x0;var _0x19299c=_0xbbed[_0x17959b];return _0x19299c;};'use strict';var _=require('lodash');var util=require(_0xdbbe('0x0'));var logger=require('../../config/logger')(_0xdbbe('0x1'));var moment=require(_0xdbbe('0x2'));var BPromise=require(_0xdbbe('0x3'));var rp=require(_0xdbbe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbe('0x5'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xdbbe('0x6')]=function(_0x31dae9,_0x2d2a4d){return _0x31dae9['define'](_0xdbbe('0x7'),attributes,{'tableName':_0xdbbe('0x8'),'paranoid':![],'indexes':[{'name':_0xdbbe('0x9'),'fields':['messageId']},{'name':_0xdbbe('0xa'),'fields':[_0xdbbe('0xb')],'type':_0xdbbe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a03f,_0x81d990,_0x242775){var _0x567288=_0x31dae9[_0xdbbe('0xd')];var _0x42484f=_0x26a03f['get']({'plain':!![]});if(_0x42484f[_0xdbbe('0xe')][_0xdbbe('0xf')]()==='in'||_0x42484f['direction']['toLowerCase']()===_0xdbbe('0x10')&&!_0x42484f[_0xdbbe('0x11')]&&!_[_0xdbbe('0x12')](_0x42484f[_0xdbbe('0x13')])&&!_[_0xdbbe('0x12')](_0x42484f[_0xdbbe('0x14')])){_0x567288[_0xdbbe('0x15')][_0xdbbe('0x16')]({'where':{'id':_0x42484f['SmsInteractionId']}})[_0xdbbe('0x17')](function(_0x40502e){if(_0x40502e){_0x40502e['update']({'lastMsgAt':_0x42484f['createdAt'],'lastMsgDirection':_0x42484f[_0xdbbe('0xe')]['toLowerCase']()});}})[_0xdbbe('0x18')](function(_0x477284){console['error'](_0x477284);});}if(_0x42484f[_0xdbbe('0xe')]===_0xdbbe('0x10')&&!_0x42484f['secret']){var _0x3ae4e4;_0x567288[_0xdbbe('0x19')][_0xdbbe('0x1a')]({'where':{'id':_0x42484f[_0xdbbe('0x1b')]},'raw':!![]})[_0xdbbe('0x17')](function(_0x50e92c){_0x3ae4e4=_0x50e92c;if(_0x3ae4e4&&_0x3ae4e4[_0xdbbe('0x1c')]){switch(_0x3ae4e4[_0xdbbe('0x1c')]){case _0xdbbe('0x1d'):var _0x224bbe=require(_0xdbbe('0x1d'));if(_0x3ae4e4[_0xdbbe('0x1e')]&&_0x3ae4e4['authToken']&&_0x3ae4e4[_0xdbbe('0x1f')]){var _0x5d0d25=new _0x224bbe(_0x3ae4e4[_0xdbbe('0x1e')],_0x3ae4e4[_0xdbbe('0x20')]);_0x5d0d25[_0xdbbe('0x21')][_0xdbbe('0x22')]({'body':_0x42484f[_0xdbbe('0xb')],'to':_0x42484f['phone'],'from':_0x3ae4e4[_0xdbbe('0x1f')],'statusCallback':_0x3ae4e4[_0xdbbe('0x23')]+'/api/sms/messages/'+_0x42484f['id']+_0xdbbe('0x24')+_0x3ae4e4[_0xdbbe('0x25')]})[_0xdbbe('0x17')](function(_0x4778d6){if(_0x4778d6[_0xdbbe('0x26')]){return _0x26a03f[_0xdbbe('0x27')]({'messageId':_0x4778d6[_0xdbbe('0x26')]});}})['catch'](function(_0x43aef1){logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdbbe('0x29'),_0xdbbe('0x1d'),util[_0xdbbe('0x2a')](_0x43aef1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),'twilio',_0xdbbe('0x2c'));}break;case _0xdbbe('0x2d'):var _0x3a9ee5=_0xdbbe('0x2e');if(_0x3ae4e4['username']&&_0x3ae4e4['password']){var _0x1b094e={'recipient':[_0x42484f[_0xdbbe('0x1f')]],'message':_0x42484f[_0xdbbe('0xb')],'message_type':_0x3ae4e4[_0xdbbe('0x2f')]};if(_0x3ae4e4[_0xdbbe('0x2f')]&&_0x3ae4e4[_0xdbbe('0x2f')]!=='SI'){_0x1b094e['sender']=_0x3ae4e4[_0xdbbe('0x1f')];}var _0x302c2b={'url':_0x3a9ee5+_0xdbbe('0x30')+_0x3ae4e4[_0xdbbe('0x31')]+_0xdbbe('0x32')+_0x3ae4e4[_0xdbbe('0x33')],'method':'GET'};rp(_0x302c2b)[_0xdbbe('0x17')](function(_0x4141ab){var _0x2919df=_0x4141ab[_0xdbbe('0x34')](';');var _0x55115f={'user_key':_0x2919df[0x0],'session_key':_0x2919df[0x1]};_0x302c2b={'url':_0x3a9ee5+'sms','method':_0xdbbe('0x35'),'headers':{'user_key':_0x55115f[_0xdbbe('0x36')],'Session_key':_0x55115f[_0xdbbe('0x37')]},'json':!![],'body':_0x1b094e};return rp(_0x302c2b);})[_0xdbbe('0x17')](function(_0x3c7208){if(_0x3c7208['total_sent']>=0x1){var _0x4f0bb3={'messageId':_0x3c7208[_0xdbbe('0x38')]};if(_0x3ae4e4['smsMethod']!=='GP'||!_0x3ae4e4[_0xdbbe('0x39')]){_0x4f0bb3[_0xdbbe('0x3a')]=!![];}return _0x26a03f[_0xdbbe('0x27')](_0x4f0bb3);}else{return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x2d'),util[_0xdbbe('0x2a')](_0x3c7208,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d30e7){return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),'afterCreate',_0xdbbe('0x2d'),util[_0xdbbe('0x2a')](_0x1d30e7,{'showHidden':![],'depth':null}));});}else{logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x2d'),_0xdbbe('0x3b'));}break;case _0xdbbe('0x3c'):if(_0x3ae4e4[_0xdbbe('0x20')]){var _0x12a952={'recipient':_0x42484f[_0xdbbe('0x1f')],'message':_0x42484f[_0xdbbe('0xb')],'sender':_0x3ae4e4[_0xdbbe('0x3d')]||_0x3ae4e4[_0xdbbe('0x1f')],'authorization':_0x3ae4e4[_0xdbbe('0x20')]};var _0x81d990={'method':'POST','uri':_0xdbbe('0x3e'),'body':_0x12a952,'json':!![]};rp(_0x81d990)['then'](function(_0x299bd5){var _0x480e0e={'messageId':_0x299bd5[_0xdbbe('0x3f')]};if(!_0x3ae4e4[_0xdbbe('0x39')]){_0x480e0e[_0xdbbe('0x3a')]=!![];}return _0x26a03f[_0xdbbe('0x27')](_0x480e0e);})[_0xdbbe('0x18')](function(_0x5111f8){logger['error'](_0xdbbe('0x2b'),'afterCreate',_0xdbbe('0x3c'),util[_0xdbbe('0x2a')](_0x5111f8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xdbbe('0x40'):if(_0x3ae4e4['username']&&_0x3ae4e4[_0xdbbe('0x33')]){var _0x12a952={'messages':[{'source':_0xdbbe('0x41'),'to':_0x42484f['phone'],'body':_0x42484f['body'],'from':_0x3ae4e4[_0xdbbe('0x3d')]||_0x3ae4e4[_0xdbbe('0x1f')]}]};var _0xc24b7a=util[_0xdbbe('0x42')]('%s:%s',_0x3ae4e4['username'],_0x3ae4e4[_0xdbbe('0x33')]);var _0x81d990={'method':_0xdbbe('0x35'),'uri':_0xdbbe('0x43'),'body':_0x12a952,'headers':{'Authorization':util[_0xdbbe('0x42')]('Basic\x20%s',new Buffer(_0xc24b7a)[_0xdbbe('0x44')](_0xdbbe('0x45')))},'json':!![]};rp(_0x81d990)[_0xdbbe('0x17')](function(_0x3949ff){if(_0x3949ff['http_code']>=0xc8&&_0x3949ff['http_code']<=0xce){if(_0x3949ff[_0xdbbe('0x46')]&&_0x3949ff[_0xdbbe('0x46')][_0xdbbe('0x47')]>0x0){var _0x531abd=_['head'](_0x3949ff[_0xdbbe('0x46')][_0xdbbe('0x21')]);var _0x5bb243={'messageId':_0x531abd['message_id']};if(!_0x3ae4e4[_0xdbbe('0x39')]){_0x5bb243[_0xdbbe('0x3a')]=!![];}return _0x26a03f[_0xdbbe('0x27')](_0x5bb243);}else{logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),'clickSend',util[_0xdbbe('0x2a')](_0x3949ff,{'showHidden':![],'depth':null}));}}else{logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdbbe('0x48'),util['inspect'](_0x3949ff,{'showHidden':![],'depth':null}));}})[_0xdbbe('0x18')](function(_0x44d3fa){logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x48'),util['inspect'](_0x44d3fa,{'showHidden':![],'depth':null}));});}else{logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x48'),_0xdbbe('0x3b'));}break;case _0xdbbe('0x49'):if(_0x3ae4e4['authId']&&_0x3ae4e4[_0xdbbe('0x20')]){var _0x12a952={'dst':_0x42484f[_0xdbbe('0x1f')],'text':_0x42484f['body'],'src':_0x3ae4e4[_0xdbbe('0x3d')]||_0x3ae4e4['phone'],'url':_0x3ae4e4[_0xdbbe('0x23')]+_0xdbbe('0x4a')+_0x42484f['id']+'/status?token='+_0x3ae4e4[_0xdbbe('0x25')]};var _0xc24b7a=util[_0xdbbe('0x42')](_0xdbbe('0x4b'),_0x3ae4e4[_0xdbbe('0x4c')],_0x3ae4e4[_0xdbbe('0x20')]);var _0x81d990={'method':_0xdbbe('0x35'),'uri':util['format'](_0xdbbe('0x4d'),_0x3ae4e4['authId']),'body':_0x12a952,'headers':{'Authorization':util['format'](_0xdbbe('0x4e'),new Buffer(_0xc24b7a)[_0xdbbe('0x44')](_0xdbbe('0x45')))},'json':!![]};rp(_0x81d990)[_0xdbbe('0x17')](function(_0x133d96){var _0x516b3e={'messageId':_0x133d96[_0xdbbe('0x4f')][0x0]};return _0x26a03f[_0xdbbe('0x27')](_0x516b3e);})['catch'](function(_0x42a323){logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x49'),util['inspect'](_0x42a323,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdbbe('0x2b'),'afterCreate','plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xdbbe('0x50'):if(_0x3ae4e4['username']&&_0x3ae4e4[_0xdbbe('0x33')]){if(_0x3ae4e4[_0xdbbe('0x51')]){var _0x585f4a={'method':_0xdbbe('0x35'),'uri':_0x3ae4e4[_0xdbbe('0x51')]+_0xdbbe('0x52'),'body':{'username':_0x3ae4e4[_0xdbbe('0x31')],'password':_0x3ae4e4['password']},'json':!![]};return rp(_0x585f4a)[_0xdbbe('0x17')](function(_0x31ccc5){var _0x34afdb={'method':_0xdbbe('0x35'),'uri':_0x3ae4e4['baseUrl']+_0xdbbe('0x53'),'body':{'messages':[{'from':_0x3ae4e4[_0xdbbe('0x1f')],'destinations':[{'to':_0x42484f['phone']}],'text':_0x42484f['body'],'notifyUrl':_0x3ae4e4[_0xdbbe('0x23')]+_0xdbbe('0x4a')+_0x42484f['id']+_0xdbbe('0x24')+_0x3ae4e4['token'],'notifyContentType':_0xdbbe('0x54'),'callbackData':_0x3ae4e4[_0xdbbe('0x1f')]+';'+_0x42484f[_0xdbbe('0xb')]}]},'headers':{'Authorization':_0xdbbe('0x55')+_0x31ccc5[_0xdbbe('0x25')]},'json':!![]};return rp(_0x34afdb)['then'](function(_0x2b095e){if(_0x2b095e[_0xdbbe('0x21')]){var _0x5604ba={'messageId':_0x2b095e[_0xdbbe('0x21')][0x0][_0xdbbe('0x9')]};if(!_0x3ae4e4[_0xdbbe('0x39')]){_0x5604ba[_0xdbbe('0x3a')]=!![];}return _0x26a03f['update'](_0x5604ba);}else{return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x50'),util['inspect'](_0x2b095e,{'showHidden':![],'depth':null}));}});})[_0xdbbe('0x18')](function(_0x25f44c){return logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdbbe('0x29'),'infobip',util[_0xdbbe('0x2a')](_0x25f44c,{'showHidden':![],'depth':null}));});}else{logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdbbe('0x50'),_0xdbbe('0x56'));}}else{logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdbbe('0x29'),_0xdbbe('0x50'),_0xdbbe('0x3b'));}break;case _0xdbbe('0x57'):var _0x4231a6=require('crypto');if(_0x3ae4e4[_0xdbbe('0x58')]){var _0x3cd92d={};_0x3cd92d[_0xdbbe('0x59')]=_0x3ae4e4['username'];_0x3cd92d[_0xdbbe('0x1f')]=_0x42484f[_0xdbbe('0x1f')];_0x3cd92d[_0xdbbe('0x5a')]=_0x3ae4e4[_0xdbbe('0x1f')];_0x3cd92d[_0xdbbe('0x5b')]=_0x42484f[_0xdbbe('0xb')];_0x3cd92d[_0xdbbe('0x5c')]=+new Date();var _0x2df7ca='';var _0x192a5e='';var _0x2791d9=Object[_0xdbbe('0x5d')](_0x3cd92d);_0x2791d9[_0xdbbe('0x5e')]();for(var _0x5c60a5=0x0;_0x5c60a5<_0x2791d9['length'];_0x5c60a5++){if(_0x2df7ca!=''){_0x2df7ca+='&';}_0x2df7ca+=_0x2791d9[_0x5c60a5]+'='+encodeURIComponent(_0x3cd92d[_0x2791d9[_0x5c60a5]]);_0x192a5e+=_0x3cd92d[_0x2791d9[_0x5c60a5]];}_0x192a5e+=_0x3ae4e4['apiKey'];_0x192a5e=_0x4231a6[_0xdbbe('0x5f')](_0xdbbe('0x60'))[_0xdbbe('0x27')](_0x192a5e)[_0xdbbe('0x61')](_0xdbbe('0x62'));if(_0x2df7ca!==''){_0x2df7ca+='&';}_0x2df7ca+=_0xdbbe('0x63')+_0x192a5e;var _0x302c2b={'method':'GET','uri':_0x3ae4e4[_0xdbbe('0x51')]+'/external/get/send.php?'+_0x2df7ca,'json':!![]};return rp(_0x302c2b)[_0xdbbe('0x17')](function(_0x1ce37a){var _0x4062de=Object[_0xdbbe('0x5d')](_0x1ce37a);if(_0x1ce37a[_0x4062de[0x0]][_0xdbbe('0x28')]&&parseInt(_0x1ce37a[_0x4062de[0x0]][_0xdbbe('0x28')])===0x0){var _0x19804e={'messageId':_0x1ce37a[_0x4062de[0x0]][_0xdbbe('0x64')]};if(!_0x3ae4e4[_0xdbbe('0x39')]){_0x19804e[_0xdbbe('0x3a')]=!![];}return _0x26a03f[_0xdbbe('0x27')](_0x19804e);}else{return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x57'),util[_0xdbbe('0x2a')](_0x1ce37a['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x53a5b3){return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),'afterCreate','csc',util[_0xdbbe('0x2a')](_0x53a5b3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdbbe('0x29'),_0xdbbe('0x57'),_0xdbbe('0x65'));}break;case _0xdbbe('0x66'):if(_0x3ae4e4[_0xdbbe('0x58')]){var _0x378029={'method':_0xdbbe('0x35'),'uri':_0xdbbe('0x67'),'headers':{'Authorization':_0x3ae4e4[_0xdbbe('0x58')]},'body':{'content':_0x42484f[_0xdbbe('0xb')],'to':[_0x42484f[_0xdbbe('0x1f')]],'from':_0x3ae4e4['phone'],'binary':![],'clientMessageId':_0xdbbe('0x68'),'charset':_0xdbbe('0x69')},'json':!![]};rp(_0x378029)[_0xdbbe('0x17')](function(_0x2bef5d){if(!_0x2bef5d['error']){var _0xc59cea={'messageId':_0x2bef5d['messages'][0x0][_0xdbbe('0x6a')]};if(!_0x3ae4e4['deliveryReport']){_0xc59cea[_0xdbbe('0x3a')]=!![];}return _0x26a03f[_0xdbbe('0x27')](_0xc59cea);}else{return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x66'),util[_0xdbbe('0x2a')](_0x2bef5d[_0xdbbe('0x28')],{'showHidden':![],'depth':null}));}})[_0xdbbe('0x18')](function(_0x410630){return logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x66'),util[_0xdbbe('0x2a')](_0x410630,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x66'),_0xdbbe('0x65'));}break;case _0xdbbe('0x6b'):if(_0x3ae4e4[_0xdbbe('0x31')]&&_0x3ae4e4[_0xdbbe('0x33')]){var _0xc24b7a=util[_0xdbbe('0x42')](_0xdbbe('0x4b'),_0x3ae4e4[_0xdbbe('0x31')],_0x3ae4e4[_0xdbbe('0x33')]);var _0x81d990={'method':_0xdbbe('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3ae4e4[_0xdbbe('0x6c')]+_0xdbbe('0x6d'),'body':{'to':[_0x42484f[_0xdbbe('0x1f')]],'text':_0x42484f['body'],'from':_0x3ae4e4['phone'],'applicationId':_0x3ae4e4[_0xdbbe('0x6e')]},'headers':{'Authorization':util[_0xdbbe('0x42')](_0xdbbe('0x4e'),new Buffer(_0xc24b7a)[_0xdbbe('0x44')]('base64'))},'json':!![]};rp(_0x81d990)[_0xdbbe('0x17')](function(_0x5938ab){if(_0x5938ab['id']){var _0x301fdb={'messageId':_0x5938ab['id']};return _0x26a03f[_0xdbbe('0x27')](_0x301fdb);}else{logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util['inspect'](_0x5938ab,{'showHidden':![],'depth':null}));}})['catch'](function(_0x34c4ba){logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),'bandwidth',util['inspect'](_0x34c4ba,{'showHidden':![],'depth':null}));});}else{logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),_0xdbbe('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdbbe('0x6f'):if(_0x3ae4e4['apiKey']){var _0x4c9046={};var _0x302c2b={'method':_0xdbbe('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x3ae4e4['apiKey'],'Content-Type':_0xdbbe('0x54')},'body':{'from':_0x3ae4e4[_0xdbbe('0x1f')],'to':_0x42484f[_0xdbbe('0x1f')],'text':_0x42484f[_0xdbbe('0xb')]},'json':!![]};return rp(_0x302c2b)[_0xdbbe('0x17')](function(_0x357e4f){if(_0x357e4f[_0xdbbe('0x70')]==0xca){_0x4c9046[_0xdbbe('0x71')]=_0x357e4f;var _0x2e56c2={'method':_0xdbbe('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xdbbe('0x72')+_0x3ae4e4[_0xdbbe('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x4c9046[_0xdbbe('0x71')]['refid']},'json':!![]};return rp(_0x2e56c2)[_0xdbbe('0x17')](function(_0x43c2f1){_0x4c9046['status']=_0x43c2f1;var _0x10d583={'messageId':_0x4c9046[_0xdbbe('0x71')][_0xdbbe('0x73')],'read':!![]};return _0x26a03f[_0xdbbe('0x27')](_0x10d583);});}else{return logger['error'](_0xdbbe('0x2b'),'afterCreate',_0xdbbe('0x6f'),util[_0xdbbe('0x2a')](_0x357e4f,{'showHidden':![],'depth':null}));}})[_0xdbbe('0x18')](function(_0x1beb37){return logger[_0xdbbe('0x28')](_0xdbbe('0x2b'),_0xdbbe('0x29'),'intelepeer',util[_0xdbbe('0x2a')](_0x1beb37,{'showHidden':![],'depth':null}));});}else{return logger[_0xdbbe('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdbbe('0x29'),_0xdbbe('0x6f'),'Token\x20not\x20received');}break;}}})[_0xdbbe('0x74')](function(){_0x242775();});}else{_0x242775();}}},'charset':'utf8mb4','collate':_0xdbbe('0x75')});}; \ No newline at end of file +var _0x1b40=['username','password','smsMethod','login?username=','&password=','GET','split','POST','user_key','internal_order_id','deliveryReport','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','keys','sort','createHash','md5','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','/messages','bandwidth','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','/status?token=','token','sid','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0x1b40,0x135));var _0x01b4=function(_0x6cbe6d,_0x37bba3){_0x6cbe6d=_0x6cbe6d-0x0;var _0x25e1c9=_0x1b40[_0x6cbe6d];return _0x25e1c9;};'use strict';var _=require(_0x01b4('0x0'));var util=require(_0x01b4('0x1'));var logger=require('../../config/logger')(_0x01b4('0x2'));var moment=require(_0x01b4('0x3'));var BPromise=require(_0x01b4('0x4'));var rp=require(_0x01b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01b4('0x6'));var config=require(_0x01b4('0x7'));var attributes=require(_0x01b4('0x8'));module['exports']=function(_0x591681,_0x4ea4b4){return _0x591681[_0x01b4('0x9')](_0x01b4('0xa'),attributes,{'tableName':_0x01b4('0xb'),'paranoid':![],'indexes':[{'name':_0x01b4('0xc'),'fields':[_0x01b4('0xc')]},{'name':_0x01b4('0xd'),'fields':[_0x01b4('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fe01a,_0x416cfd,_0x1048cb){var _0x263333=_0x591681['models'];var _0x24c7eb=_0x2fe01a['get']({'plain':!![]});if(_0x24c7eb[_0x01b4('0xf')]['toLowerCase']()==='in'||_0x24c7eb[_0x01b4('0xf')][_0x01b4('0x10')]()===_0x01b4('0x11')&&!_0x24c7eb[_0x01b4('0x12')]&&!_[_0x01b4('0x13')](_0x24c7eb[_0x01b4('0x14')])&&!_['isNil'](_0x24c7eb[_0x01b4('0x15')])){_0x263333[_0x01b4('0x16')]['findOne']({'where':{'id':_0x24c7eb[_0x01b4('0x15')]}})['then'](function(_0x1ae2c9){if(_0x1ae2c9){_0x1ae2c9[_0x01b4('0x17')]({'lastMsgAt':_0x24c7eb[_0x01b4('0x18')],'lastMsgDirection':_0x24c7eb[_0x01b4('0xf')]['toLowerCase']()});}})[_0x01b4('0x19')](function(_0x1a88c9){console[_0x01b4('0x1a')](_0x1a88c9);});}if(_0x24c7eb[_0x01b4('0xf')]===_0x01b4('0x11')&&!_0x24c7eb[_0x01b4('0x12')]){var _0x499002;_0x263333[_0x01b4('0x1b')][_0x01b4('0x1c')]({'where':{'id':_0x24c7eb[_0x01b4('0x1d')]},'raw':!![]})[_0x01b4('0x1e')](function(_0x2e00ec){_0x499002=_0x2e00ec;if(_0x499002&&_0x499002['type']){switch(_0x499002[_0x01b4('0x1f')]){case _0x01b4('0x20'):var _0x34019c=require('twilio');if(_0x499002[_0x01b4('0x21')]&&_0x499002[_0x01b4('0x22')]&&_0x499002[_0x01b4('0x23')]){var _0x4cca00=new _0x34019c(_0x499002['accountSid'],_0x499002['authToken']);_0x4cca00[_0x01b4('0x24')]['create']({'body':_0x24c7eb[_0x01b4('0xe')],'to':_0x24c7eb[_0x01b4('0x23')],'from':_0x499002[_0x01b4('0x23')],'statusCallback':_0x499002['remote']+_0x01b4('0x25')+_0x24c7eb['id']+_0x01b4('0x26')+_0x499002[_0x01b4('0x27')]})[_0x01b4('0x1e')](function(_0x1e835c){if(_0x1e835c[_0x01b4('0x28')]){return _0x2fe01a[_0x01b4('0x17')]({'messageId':_0x1e835c[_0x01b4('0x28')]});}})[_0x01b4('0x19')](function(_0x1049d4){logger[_0x01b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x01b4('0x29'),_0x01b4('0x20'),util['inspect'](_0x1049d4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x01b4('0x20'),_0x01b4('0x2a'));}break;case _0x01b4('0x2b'):var _0x587577=_0x01b4('0x2c');if(_0x499002[_0x01b4('0x2d')]&&_0x499002[_0x01b4('0x2e')]){var _0x2158e5={'recipient':[_0x24c7eb[_0x01b4('0x23')]],'message':_0x24c7eb[_0x01b4('0xe')],'message_type':_0x499002[_0x01b4('0x2f')]};if(_0x499002[_0x01b4('0x2f')]&&_0x499002[_0x01b4('0x2f')]!=='SI'){_0x2158e5['sender']=_0x499002['phone'];}var _0x34c474={'url':_0x587577+_0x01b4('0x30')+_0x499002[_0x01b4('0x2d')]+_0x01b4('0x31')+_0x499002[_0x01b4('0x2e')],'method':_0x01b4('0x32')};rp(_0x34c474)[_0x01b4('0x1e')](function(_0x4c065e){var _0x483130=_0x4c065e[_0x01b4('0x33')](';');var _0x1d8c10={'user_key':_0x483130[0x0],'session_key':_0x483130[0x1]};_0x34c474={'url':_0x587577+'sms','method':_0x01b4('0x34'),'headers':{'user_key':_0x1d8c10[_0x01b4('0x35')],'Session_key':_0x1d8c10['session_key']},'json':!![],'body':_0x2158e5};return rp(_0x34c474);})[_0x01b4('0x1e')](function(_0x2e6478){if(_0x2e6478['total_sent']>=0x1){var _0x5116ba={'messageId':_0x2e6478[_0x01b4('0x36')]};if(_0x499002[_0x01b4('0x2f')]!=='GP'||!_0x499002[_0x01b4('0x37')]){_0x5116ba['read']=!![];}return _0x2fe01a[_0x01b4('0x17')](_0x5116ba);}else{return logger['error'](_0x01b4('0x38'),'afterCreate',_0x01b4('0x2b'),util[_0x01b4('0x39')](_0x2e6478,{'showHidden':![],'depth':null}));}})[_0x01b4('0x19')](function(_0x2e2e0b){return logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x2b'),util[_0x01b4('0x39')](_0x2e2e0b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x01b4('0x38'),_0x01b4('0x29'),'skebby',_0x01b4('0x3a'));}break;case _0x01b4('0x3b'):if(_0x499002['authToken']){var _0x27ed94={'recipient':_0x24c7eb[_0x01b4('0x23')],'message':_0x24c7eb[_0x01b4('0xe')],'sender':_0x499002[_0x01b4('0x3c')]||_0x499002[_0x01b4('0x23')],'authorization':_0x499002[_0x01b4('0x22')]};var _0x416cfd={'method':_0x01b4('0x34'),'uri':_0x01b4('0x3d'),'body':_0x27ed94,'json':!![]};rp(_0x416cfd)['then'](function(_0x582530){var _0x1843ad={'messageId':_0x582530['requestid']};if(!_0x499002[_0x01b4('0x37')]){_0x1843ad[_0x01b4('0x3e')]=!![];}return _0x2fe01a[_0x01b4('0x17')](_0x1843ad);})['catch'](function(_0x592117){logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),'connectel',util[_0x01b4('0x39')](_0x592117,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x01b4('0x29'),_0x01b4('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x01b4('0x3f'):if(_0x499002[_0x01b4('0x2d')]&&_0x499002[_0x01b4('0x2e')]){var _0x27ed94={'messages':[{'source':_0x01b4('0x40'),'to':_0x24c7eb[_0x01b4('0x23')],'body':_0x24c7eb[_0x01b4('0xe')],'from':_0x499002['senderString']||_0x499002[_0x01b4('0x23')]}]};var _0x372cc2=util['format'](_0x01b4('0x41'),_0x499002[_0x01b4('0x2d')],_0x499002[_0x01b4('0x2e')]);var _0x416cfd={'method':'POST','uri':_0x01b4('0x42'),'body':_0x27ed94,'headers':{'Authorization':util[_0x01b4('0x43')](_0x01b4('0x44'),new Buffer(_0x372cc2)[_0x01b4('0x45')]('base64'))},'json':!![]};rp(_0x416cfd)[_0x01b4('0x1e')](function(_0x16ef7b){if(_0x16ef7b[_0x01b4('0x46')]>=0xc8&&_0x16ef7b[_0x01b4('0x46')]<=0xce){if(_0x16ef7b[_0x01b4('0x47')]&&_0x16ef7b[_0x01b4('0x47')][_0x01b4('0x48')]>0x0){var _0x252631=_[_0x01b4('0x49')](_0x16ef7b[_0x01b4('0x47')][_0x01b4('0x24')]);var _0x124ebb={'messageId':_0x252631[_0x01b4('0x4a')]};if(!_0x499002[_0x01b4('0x37')]){_0x124ebb[_0x01b4('0x3e')]=!![];}return _0x2fe01a[_0x01b4('0x17')](_0x124ebb);}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x4b'),util[_0x01b4('0x39')](_0x16ef7b,{'showHidden':![],'depth':null}));}}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x4b'),util[_0x01b4('0x39')](_0x16ef7b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2f0a75){logger[_0x01b4('0x1a')](_0x01b4('0x38'),'afterCreate','clickSend',util[_0x01b4('0x39')](_0x2f0a75,{'showHidden':![],'depth':null}));});}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x4b'),_0x01b4('0x3a'));}break;case _0x01b4('0x4c'):if(_0x499002[_0x01b4('0x4d')]&&_0x499002[_0x01b4('0x22')]){var _0x27ed94={'dst':_0x24c7eb[_0x01b4('0x23')],'text':_0x24c7eb[_0x01b4('0xe')],'src':_0x499002[_0x01b4('0x3c')]||_0x499002[_0x01b4('0x23')],'url':_0x499002[_0x01b4('0x4e')]+_0x01b4('0x25')+_0x24c7eb['id']+_0x01b4('0x26')+_0x499002[_0x01b4('0x27')]};var _0x372cc2=util[_0x01b4('0x43')]('%s:%s',_0x499002['authId'],_0x499002[_0x01b4('0x22')]);var _0x416cfd={'method':'POST','uri':util[_0x01b4('0x43')](_0x01b4('0x4f'),_0x499002[_0x01b4('0x4d')]),'body':_0x27ed94,'headers':{'Authorization':util['format'](_0x01b4('0x44'),new Buffer(_0x372cc2)[_0x01b4('0x45')](_0x01b4('0x50')))},'json':!![]};rp(_0x416cfd)['then'](function(_0x45eacb){var _0x304b14={'messageId':_0x45eacb['message_uuid'][0x0]};return _0x2fe01a['update'](_0x304b14);})[_0x01b4('0x19')](function(_0x28d114){logger[_0x01b4('0x1a')](_0x01b4('0x38'),'afterCreate',_0x01b4('0x4c'),util['inspect'](_0x28d114,{'showHidden':![],'depth':null}));});}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x4c'),_0x01b4('0x51'));}break;case _0x01b4('0x52'):if(_0x499002[_0x01b4('0x2d')]&&_0x499002['password']){if(_0x499002[_0x01b4('0x53')]){var _0x32066f={'method':_0x01b4('0x34'),'uri':_0x499002[_0x01b4('0x53')]+_0x01b4('0x54'),'body':{'username':_0x499002[_0x01b4('0x2d')],'password':_0x499002[_0x01b4('0x2e')]},'json':!![]};return rp(_0x32066f)[_0x01b4('0x1e')](function(_0x4c2434){var _0x150cf1={'method':_0x01b4('0x34'),'uri':_0x499002['baseUrl']+_0x01b4('0x55'),'body':{'messages':[{'from':_0x499002[_0x01b4('0x23')],'destinations':[{'to':_0x24c7eb['phone']}],'text':_0x24c7eb[_0x01b4('0xe')],'notifyUrl':_0x499002['remote']+'/api/sms/messages/'+_0x24c7eb['id']+_0x01b4('0x26')+_0x499002[_0x01b4('0x27')],'notifyContentType':_0x01b4('0x56'),'callbackData':_0x499002[_0x01b4('0x23')]+';'+_0x24c7eb[_0x01b4('0xe')]}]},'headers':{'Authorization':_0x01b4('0x57')+_0x4c2434[_0x01b4('0x27')]},'json':!![]};return rp(_0x150cf1)['then'](function(_0x27d180){if(_0x27d180[_0x01b4('0x24')]){var _0x1b2702={'messageId':_0x27d180[_0x01b4('0x24')][0x0][_0x01b4('0xc')]};if(!_0x499002['deliveryReport']){_0x1b2702['read']=!![];}return _0x2fe01a[_0x01b4('0x17')](_0x1b2702);}else{return logger['error'](_0x01b4('0x38'),_0x01b4('0x29'),'infobip',util[_0x01b4('0x39')](_0x27d180,{'showHidden':![],'depth':null}));}});})[_0x01b4('0x19')](function(_0x4ea965){return logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x52'),util[_0x01b4('0x39')](_0x4ea965,{'showHidden':![],'depth':null}));});}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),'infobip',_0x01b4('0x58'));}}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),'afterCreate',_0x01b4('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x01b4('0x59'):var _0x835d14=require('crypto');if(_0x499002[_0x01b4('0x5a')]){var _0x3fd7d2={};_0x3fd7d2[_0x01b4('0x5b')]=_0x499002['username'];_0x3fd7d2[_0x01b4('0x23')]=_0x24c7eb[_0x01b4('0x23')];_0x3fd7d2['sender']=_0x499002['phone'];_0x3fd7d2[_0x01b4('0x5c')]=_0x24c7eb['body'];_0x3fd7d2['timestamp']=+new Date();var _0x5ce36f='';var _0x4a638b='';var _0x5ce469=Object[_0x01b4('0x5d')](_0x3fd7d2);_0x5ce469[_0x01b4('0x5e')]();for(var _0x4f8118=0x0;_0x4f8118<_0x5ce469['length'];_0x4f8118++){if(_0x5ce36f!=''){_0x5ce36f+='&';}_0x5ce36f+=_0x5ce469[_0x4f8118]+'='+encodeURIComponent(_0x3fd7d2[_0x5ce469[_0x4f8118]]);_0x4a638b+=_0x3fd7d2[_0x5ce469[_0x4f8118]];}_0x4a638b+=_0x499002[_0x01b4('0x5a')];_0x4a638b=_0x835d14[_0x01b4('0x5f')](_0x01b4('0x60'))[_0x01b4('0x17')](_0x4a638b)['digest'](_0x01b4('0x61'));if(_0x5ce36f!==''){_0x5ce36f+='&';}_0x5ce36f+=_0x01b4('0x62')+_0x4a638b;var _0x34c474={'method':_0x01b4('0x32'),'uri':_0x499002[_0x01b4('0x53')]+'/external/get/send.php?'+_0x5ce36f,'json':!![]};return rp(_0x34c474)[_0x01b4('0x1e')](function(_0x214991){var _0x212744=Object['keys'](_0x214991);if(_0x214991[_0x212744[0x0]][_0x01b4('0x1a')]&&parseInt(_0x214991[_0x212744[0x0]][_0x01b4('0x1a')])===0x0){var _0x38712a={'messageId':_0x214991[_0x212744[0x0]][_0x01b4('0x63')]};if(!_0x499002[_0x01b4('0x37')]){_0x38712a[_0x01b4('0x3e')]=!![];}return _0x2fe01a[_0x01b4('0x17')](_0x38712a);}else{return logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x59'),util[_0x01b4('0x39')](_0x214991[_0x01b4('0x1a')],{'showHidden':![],'depth':null}));}})[_0x01b4('0x19')](function(_0x185a15){return logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x59'),util['inspect'](_0x185a15,{'showHidden':![],'depth':null}));});}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x59'),_0x01b4('0x64'));}break;case _0x01b4('0x65'):if(_0x499002[_0x01b4('0x5a')]){var _0x5588cb={'method':_0x01b4('0x34'),'uri':_0x01b4('0x66'),'headers':{'Authorization':_0x499002[_0x01b4('0x5a')]},'body':{'content':_0x24c7eb[_0x01b4('0xe')],'to':[_0x24c7eb['phone']],'from':_0x499002['phone'],'binary':![],'clientMessageId':_0x01b4('0x67'),'charset':_0x01b4('0x68')},'json':!![]};rp(_0x5588cb)[_0x01b4('0x1e')](function(_0x338ec8){if(!_0x338ec8[_0x01b4('0x1a')]){var _0x301103={'messageId':_0x338ec8[_0x01b4('0x24')][0x0][_0x01b4('0x69')]};if(!_0x499002[_0x01b4('0x37')]){_0x301103[_0x01b4('0x3e')]=!![];}return _0x2fe01a[_0x01b4('0x17')](_0x301103);}else{return logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x65'),util['inspect'](_0x338ec8['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x13b8d9){return logger['error'](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x65'),util['inspect'](_0x13b8d9,{'showHidden':![],'depth':null}));});}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x65'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x499002['username']&&_0x499002[_0x01b4('0x2e')]){var _0x372cc2=util[_0x01b4('0x43')]('%s:%s',_0x499002[_0x01b4('0x2d')],_0x499002[_0x01b4('0x2e')]);var _0x416cfd={'method':_0x01b4('0x34'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x499002[_0x01b4('0x6a')]+_0x01b4('0x6b'),'body':{'to':[_0x24c7eb[_0x01b4('0x23')]],'text':_0x24c7eb['body'],'from':_0x499002[_0x01b4('0x23')],'applicationId':_0x499002['applicationId']},'headers':{'Authorization':util[_0x01b4('0x43')](_0x01b4('0x44'),new Buffer(_0x372cc2)[_0x01b4('0x45')](_0x01b4('0x50')))},'json':!![]};rp(_0x416cfd)['then'](function(_0x31789e){if(_0x31789e['id']){var _0x41f5a4={'messageId':_0x31789e['id']};return _0x2fe01a[_0x01b4('0x17')](_0x41f5a4);}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),'bandwidth',util[_0x01b4('0x39')](_0x31789e,{'showHidden':![],'depth':null}));}})[_0x01b4('0x19')](function(_0x1a5e4f){logger['error'](_0x01b4('0x38'),'afterCreate',_0x01b4('0x6c'),util[_0x01b4('0x39')](_0x1a5e4f,{'showHidden':![],'depth':null}));});}else{logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),_0x01b4('0x6c'),_0x01b4('0x3a'));}break;case _0x01b4('0x6d'):if(_0x499002[_0x01b4('0x5a')]){var _0x3ee80e={};var _0x34c474={'method':_0x01b4('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x01b4('0x6e')+_0x499002[_0x01b4('0x5a')],'Content-Type':_0x01b4('0x56')},'body':{'from':_0x499002[_0x01b4('0x23')],'to':_0x24c7eb[_0x01b4('0x23')],'text':_0x24c7eb[_0x01b4('0xe')]},'json':!![]};return rp(_0x34c474)[_0x01b4('0x1e')](function(_0x43ef18){if(_0x43ef18[_0x01b4('0x6f')]==0xca){_0x3ee80e['message']=_0x43ef18;var _0x55170e={'method':_0x01b4('0x34'),'uri':_0x01b4('0x70'),'headers':{'Authorization':_0x01b4('0x6e')+_0x499002['apiKey'],'Content-Type':_0x01b4('0x56')},'body':{'refid':_0x3ee80e[_0x01b4('0x71')][_0x01b4('0x72')]},'json':!![]};return rp(_0x55170e)['then'](function(_0x22c9b0){_0x3ee80e[_0x01b4('0x73')]=_0x22c9b0;var _0x8399f5={'messageId':_0x3ee80e[_0x01b4('0x71')][_0x01b4('0x72')],'read':!![]};return _0x2fe01a[_0x01b4('0x17')](_0x8399f5);});}else{return logger['error'](_0x01b4('0x38'),_0x01b4('0x29'),'intelepeer',util['inspect'](_0x43ef18,{'showHidden':![],'depth':null}));}})['catch'](function(_0x37508d){return logger[_0x01b4('0x1a')](_0x01b4('0x38'),_0x01b4('0x29'),'intelepeer',util[_0x01b4('0x39')](_0x37508d,{'showHidden':![],'depth':null}));});}else{return logger[_0x01b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x01b4('0x29'),_0x01b4('0x6d'),_0x01b4('0x74'));}break;}}})['finally'](function(){_0x1048cb();});}else{_0x1048cb();}}},'charset':'utf8mb4','collate':_0x01b4('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index adac160..f2ae5f7 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 _0xc58f=['jayson/promise','redis','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSmsMessage','create','body','options','raw','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3f8e96,_0x4475b3){var _0x35f37f=function(_0x15cf0c){while(--_0x15cf0c){_0x3f8e96['push'](_0x3f8e96['shift']());}};_0x35f37f(++_0x4475b3);}(_0xc58f,0x10e));var _0xfc58=function(_0x23a971,_0x70b461){_0x23a971=_0x23a971-0x0;var _0x36c6d3=_0xc58f[_0x23a971];return _0x36c6d3;};'use strict';var _=require(_0xfc58('0x0'));var util=require('util');var moment=require(_0xfc58('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc58('0x2'));var fs=require('fs');var Redis=require(_0xfc58('0x3'));var db=require(_0xfc58('0x4'))['db'];var utils=require(_0xfc58('0x5'));var logger=require(_0xfc58('0x6'))(_0xfc58('0x7'));var config=require(_0xfc58('0x8'));var jayson=require(_0xfc58('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfc58('0xa')]=_['defaults'](config[_0xfc58('0xa')],{'host':_0xfc58('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc58('0xc'))[_0xfc58('0xd')](socket);function respondWithRpcPromise(_0x3de390,_0x5668cf,_0x3c2ab0){return new BPromise(function(_0xbe117,_0x355674){return client[_0xfc58('0xe')](_0x3de390,_0x3c2ab0)[_0xfc58('0xf')](function(_0x2a28b8){logger['info'](_0xfc58('0x10'),_0x5668cf,_0xfc58('0x11'));logger[_0xfc58('0x12')](_0xfc58('0x13'),_0x5668cf,'request\x20sent',JSON['stringify'](_0x2a28b8));if(_0x2a28b8[_0xfc58('0x14')]){if(_0x2a28b8[_0xfc58('0x14')]['code']===0x1f4){logger['error'](_0xfc58('0x10'),_0x5668cf,_0x2a28b8[_0xfc58('0x14')]['message']);return _0x355674(_0x2a28b8[_0xfc58('0x14')][_0xfc58('0x15')]);}logger[_0xfc58('0x14')](_0xfc58('0x10'),_0x5668cf,_0x2a28b8[_0xfc58('0x14')][_0xfc58('0x15')]);return _0xbe117(_0x2a28b8[_0xfc58('0x14')][_0xfc58('0x15')]);}else{logger[_0xfc58('0x16')](_0xfc58('0x10'),_0x5668cf,_0xfc58('0x11'));_0xbe117(_0x2a28b8[_0xfc58('0x17')]['message']);}})[_0xfc58('0x18')](function(_0x5d196c){logger['error'](_0xfc58('0x10'),_0x5668cf,_0x5d196c);_0x355674(_0x5d196c);});});}exports[_0xfc58('0x19')]=function(_0x1a1d1e){var _0x4b4210=this;return new Promise(function(_0x324ad9,_0xb2c2cc){return db['SmsMessage'][_0xfc58('0x1a')](_0x1a1d1e[_0xfc58('0x1b')],{'raw':_0x1a1d1e[_0xfc58('0x1c')]?_0x1a1d1e['options'][_0xfc58('0x1d')]===undefined?!![]:![]:!![]})[_0xfc58('0xf')](function(_0x5897ab){logger[_0xfc58('0x16')](_0xfc58('0x19'),_0x1a1d1e);logger['debug']('CreateSmsMessage',_0x1a1d1e,JSON[_0xfc58('0x1e')](_0x5897ab));_0x324ad9(_0x5897ab);})['catch'](function(_0x1e2ea3){logger[_0xfc58('0x14')](_0xfc58('0x19'),_0x1e2ea3[_0xfc58('0x15')],_0x1a1d1e);_0xb2c2cc(_0x4b4210[_0xfc58('0x14')](0x1f4,_0x1e2ea3[_0xfc58('0x15')]));});});}; \ No newline at end of file +var _0xb010=['error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x53b271,_0x1ecce1){var _0xe226aa=function(_0x55a91b){while(--_0x55a91b){_0x53b271['push'](_0x53b271['shift']());}};_0xe226aa(++_0x1ecce1);}(_0xb010,0xc5));var _0x0b01=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb010[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x0b01('0x0'));var util=require(_0x0b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b01('0x3'));var logger=require(_0x0b01('0x4'))(_0x0b01('0x5'));var config=require(_0x0b01('0x6'));var jayson=require(_0x0b01('0x7'));var client=jayson[_0x0b01('0x8')][_0x0b01('0x9')]({'port':0x232a});config[_0x0b01('0xa')]=_[_0x0b01('0xb')](config[_0x0b01('0xa')],{'host':_0x0b01('0xc'),'port':0x18eb});var socket=require(_0x0b01('0xd'))(new Redis(config[_0x0b01('0xa')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x57dc50,_0x404627,_0x188471){return new BPromise(function(_0x35b18c,_0x4b7aba){return client['request'](_0x57dc50,_0x188471)[_0x0b01('0xe')](function(_0xcff25e){logger[_0x0b01('0xf')](_0x0b01('0x10'),_0x404627,_0x0b01('0x11'));logger[_0x0b01('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x404627,_0x0b01('0x11'),JSON[_0x0b01('0x13')](_0xcff25e));if(_0xcff25e[_0x0b01('0x14')]){if(_0xcff25e[_0x0b01('0x14')][_0x0b01('0x15')]===0x1f4){logger[_0x0b01('0x14')](_0x0b01('0x10'),_0x404627,_0xcff25e[_0x0b01('0x14')]['message']);return _0x4b7aba(_0xcff25e[_0x0b01('0x14')][_0x0b01('0x16')]);}logger[_0x0b01('0x14')]('SmsMessage,\x20%s,\x20%s',_0x404627,_0xcff25e[_0x0b01('0x14')][_0x0b01('0x16')]);return _0x35b18c(_0xcff25e[_0x0b01('0x14')][_0x0b01('0x16')]);}else{logger['info'](_0x0b01('0x10'),_0x404627,'request\x20sent');_0x35b18c(_0xcff25e[_0x0b01('0x17')][_0x0b01('0x16')]);}})[_0x0b01('0x18')](function(_0x430aed){logger[_0x0b01('0x14')](_0x0b01('0x10'),_0x404627,_0x430aed);_0x4b7aba(_0x430aed);});});}exports['CreateSmsMessage']=function(_0x5d8bed){var _0xf33e32=this;return new Promise(function(_0x147548,_0x24c7f6){return db[_0x0b01('0x19')][_0x0b01('0x1a')](_0x5d8bed[_0x0b01('0x1b')],{'raw':_0x5d8bed[_0x0b01('0x1c')]?_0x5d8bed[_0x0b01('0x1c')][_0x0b01('0x1d')]===undefined?!![]:![]:!![]})[_0x0b01('0xe')](function(_0x107a1b){logger['info'](_0x0b01('0x1e'),_0x5d8bed);logger['debug'](_0x0b01('0x1e'),_0x5d8bed,JSON[_0x0b01('0x13')](_0x107a1b));_0x147548(_0x107a1b);})['catch'](function(_0x36ddf9){logger[_0x0b01('0x14')]('CreateSmsMessage',_0x36ddf9['message'],_0x5d8bed);_0x24c7f6(_0xf33e32[_0x0b01('0x14')](0x1f4,_0x36ddf9[_0x0b01('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9b70b62..b3e965b 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 _0xd7ee=['length','smsMessage:','save','update','removeListener','register'];(function(_0x5e2231,_0xf2b011){var _0x3f578e=function(_0x4af5cd){while(--_0x4af5cd){_0x5e2231['push'](_0x5e2231['shift']());}};_0x3f578e(++_0xf2b011);}(_0xd7ee,0xa4));var _0xed7e=function(_0x458959,_0x4cdf7a){_0x458959=_0x458959-0x0;var _0xde7ff6=_0xd7ee[_0x458959];return _0xde7ff6;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xed7e('0x0'),'remove',_0xed7e('0x1')];function createListener(_0x2f2319,_0x1eb26e){return function(_0x531052){_0x1eb26e['emit'](_0x2f2319,_0x531052);};}function removeListener(_0x5b0e6e,_0x246c6f){return function(){SmsMessageEvents[_0xed7e('0x2')](_0x5b0e6e,_0x246c6f);};}exports[_0xed7e('0x3')]=function(_0x3ede07){for(var _0x47ebfd=0x0,_0x1714b4=events[_0xed7e('0x4')];_0x47ebfd<_0x1714b4;_0x47ebfd++){var _0x5c8e22=events[_0x47ebfd];var _0x492872=createListener(_0xed7e('0x5')+_0x5c8e22,_0x3ede07);SmsMessageEvents['on'](_0x5c8e22,_0x492872);}}; \ No newline at end of file +var _0x991c=['length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x991c,0x14f));var _0xc991=function(_0x59933d,_0x2b6aee){_0x59933d=_0x59933d-0x0;var _0x29974a=_0x991c[_0x59933d];return _0x29974a;};'use strict';var SmsMessageEvents=require(_0xc991('0x0'));var events=[_0xc991('0x1'),_0xc991('0x2'),_0xc991('0x3')];function createListener(_0x3fd892,_0x260ee2){return function(_0x445dfa){_0x260ee2[_0xc991('0x4')](_0x3fd892,_0x445dfa);};}function removeListener(_0x431ede,_0x8f813b){return function(){SmsMessageEvents[_0xc991('0x5')](_0x431ede,_0x8f813b);};}exports[_0xc991('0x6')]=function(_0x35dccd){for(var _0x379d07=0x0,_0x55fdc5=events[_0xc991('0x7')];_0x379d07<_0x55fdc5;_0x379d07++){var _0x29dc30=events[_0x379d07];var _0x51cb7e=createListener(_0xc991('0x8')+_0x29dc30,_0x35dccd);SmsMessageEvents['on'](_0x29dc30,_0x51cb7e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8195ff7..ac4e9e3 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 _0xa953=['index','describe','/:id','/:id/teams','/:id/users','post','create','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0xa953,0x1f1));var _0x3a95=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0xa953[_0x2f421];return _0x27b4af;};'use strict';var multer=require(_0x3a95('0x0'));var util=require('util');var path=require(_0x3a95('0x1'));var timeout=require(_0x3a95('0x2'));var express=require(_0x3a95('0x3'));var router=express['Router']();var fs_extra=require(_0x3a95('0x4'));var auth=require(_0x3a95('0x5'));var interaction=require(_0x3a95('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x3a95('0x7')]('/',auth[_0x3a95('0x8')](),controller[_0x3a95('0x9')]);router['get']('/describe',auth[_0x3a95('0x8')](),controller[_0x3a95('0xa')]);router['get'](_0x3a95('0xb'),auth[_0x3a95('0x8')](),controller['show']);router[_0x3a95('0x7')]('/:id/members',auth[_0x3a95('0x8')](),controller['getMembers']);router[_0x3a95('0x7')](_0x3a95('0xc'),auth[_0x3a95('0x8')](),controller['getTeams']);router[_0x3a95('0x7')](_0x3a95('0xd'),auth[_0x3a95('0x8')](),controller['getAgents']);router[_0x3a95('0xe')]('/',auth[_0x3a95('0x8')](),controller[_0x3a95('0xf')]);router[_0x3a95('0xe')](_0x3a95('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3a95('0xe')](_0x3a95('0xd'),auth[_0x3a95('0x8')](),controller[_0x3a95('0x10')]);router['put']('/:id',auth[_0x3a95('0x8')](),controller[_0x3a95('0x11')]);router[_0x3a95('0x12')](_0x3a95('0xb'),auth[_0x3a95('0x8')](),controller[_0x3a95('0x13')]);router[_0x3a95('0x12')](_0x3a95('0xc'),auth[_0x3a95('0x8')](),controller[_0x3a95('0x14')]);router[_0x3a95('0x12')](_0x3a95('0xd'),auth['isAuthenticated'](),controller[_0x3a95('0x15')]);module[_0x3a95('0x16')]=router; \ No newline at end of file +var _0xbe5a=['./smsQueue.controller','isAuthenticated','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','removeTeams','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e3131,_0x1920b3){var _0x2d039c=function(_0x2b0ad7){while(--_0x2b0ad7){_0x1e3131['push'](_0x1e3131['shift']());}};_0x2d039c(++_0x1920b3);}(_0xbe5a,0xa1));var _0xabe5=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xbe5a[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0xabe5('0x0'));var util=require('util');var path=require(_0xabe5('0x1'));var timeout=require(_0xabe5('0x2'));var express=require(_0xabe5('0x3'));var router=express['Router']();var fs_extra=require(_0xabe5('0x4'));var auth=require(_0xabe5('0x5'));var interaction=require(_0xabe5('0x6'));var config=require('../../config/environment');var controller=require(_0xabe5('0x7'));router['get']('/',auth[_0xabe5('0x8')](),controller['index']);router[_0xabe5('0x9')]('/describe',auth[_0xabe5('0x8')](),controller['describe']);router['get'](_0xabe5('0xa'),auth['isAuthenticated'](),controller[_0xabe5('0xb')]);router[_0xabe5('0x9')](_0xabe5('0xc'),auth[_0xabe5('0x8')](),controller[_0xabe5('0xd')]);router[_0xabe5('0x9')](_0xabe5('0xe'),auth[_0xabe5('0x8')](),controller[_0xabe5('0xf')]);router['get'](_0xabe5('0x10'),auth['isAuthenticated'](),controller[_0xabe5('0x11')]);router[_0xabe5('0x12')]('/',auth[_0xabe5('0x8')](),controller[_0xabe5('0x13')]);router['post'](_0xabe5('0xe'),auth[_0xabe5('0x8')](),controller['addTeams']);router[_0xabe5('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xabe5('0x14')]);router[_0xabe5('0x15')](_0xabe5('0xa'),auth[_0xabe5('0x8')](),controller['update']);router[_0xabe5('0x16')](_0xabe5('0xa'),auth[_0xabe5('0x8')](),controller['destroy']);router[_0xabe5('0x16')](_0xabe5('0xe'),auth[_0xabe5('0x8')](),controller[_0xabe5('0x17')]);router[_0xabe5('0x16')]('/:id/users',auth[_0xabe5('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 84f5c81..4ef8981 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 _0x6a15=['name','INTEGER','rrmemory','beepall','exports','STRING'];(function(_0x2d4f44,_0x291763){var _0x28957a=function(_0x2752c2){while(--_0x2752c2){_0x2d4f44['push'](_0x2d4f44['shift']());}};_0x28957a(++_0x291763);}(_0x6a15,0x154));var _0x56a1=function(_0x2bca8c,_0x3036b8){_0x2bca8c=_0x2bca8c-0x0;var _0x1e23e6=_0x6a15[_0x2bca8c];return _0x1e23e6;};'use strict';var Sequelize=require('sequelize');module[_0x56a1('0x0')]={'name':{'type':Sequelize[_0x56a1('0x1')],'unique':_0x56a1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x56a1('0x1')]},'timeout':{'type':Sequelize[_0x56a1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x56a1('0x4'),_0x56a1('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x117e=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x46732e,_0x33c42a){var _0x3f5262=function(_0x191084){while(--_0x191084){_0x46732e['push'](_0x46732e['shift']());}};_0x3f5262(++_0x33c42a);}(_0x117e,0x73));var _0xe117=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x117e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe117('0x0'));module['exports']={'name':{'type':Sequelize[_0xe117('0x1')],'unique':_0xe117('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe117('0x1')]},'timeout':{'type':Sequelize[_0xe117('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe117('0x4')](_0xe117('0x5'),_0xe117('0x6'),_0xe117('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 9a19989..ec62ba2 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x2552e2,_0x4fb60a){var _0x27922b=function(_0x3ff1cb){while(--_0x3ff1cb){_0x2552e2['push'](_0x2552e2['shift']());}};_0x27922b(++_0x4fb60a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x5b5f97,_0x46b15e){var _0x2f6001=function(_0x268878){while(--_0x268878){_0x5b5f97['push'](_0x5b5f97['shift']());}};_0x2f6001(++_0x46b15e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8da8d0e..293272c 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 _0x8cf9=['update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x11c01c,_0x492c06){var _0x58e8c4=function(_0x46f992){while(--_0x46f992){_0x11c01c['push'](_0x11c01c['shift']());}};_0x58e8c4(++_0x492c06);}(_0x8cf9,0x1cf));var _0x98cf=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x8cf9[_0x4a747d];return _0x3a5b5c;};'use strict';var EventEmitter=require(_0x98cf('0x0'));var SmsQueue=require(_0x98cf('0x1'))['db'][_0x98cf('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x98cf('0x3')](0x0);var events={'afterCreate':_0x98cf('0x4'),'afterUpdate':_0x98cf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3cd564){return function(_0x4cdd50,_0x312d94,_0x1f2a56){SmsQueueEvents[_0x98cf('0x6')](_0x3cd564+':'+_0x4cdd50['id'],_0x4cdd50);SmsQueueEvents[_0x98cf('0x6')](_0x3cd564,_0x4cdd50);_0x1f2a56(null);};}for(var e in events){if(events[_0x98cf('0x7')](e)){var event=events[e];SmsQueue[_0x98cf('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xa5b7=['../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa5b7,0x17c));var _0x7a5b=function(_0x24f9e9,_0x144ed8){_0x24f9e9=_0x24f9e9-0x0;var _0x548df8=_0xa5b7[_0x24f9e9];return _0x548df8;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x7a5b('0x0'))['db'][_0x7a5b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7a5b('0x2')](0x0);var events={'afterCreate':_0x7a5b('0x3'),'afterUpdate':_0x7a5b('0x4'),'afterDestroy':_0x7a5b('0x5')};function emitEvent(_0x42eb1c){return function(_0x5d2d13,_0x4fdefa,_0x2473fe){SmsQueueEvents[_0x7a5b('0x6')](_0x42eb1c+':'+_0x5d2d13['id'],_0x5d2d13);SmsQueueEvents[_0x7a5b('0x6')](_0x42eb1c,_0x5d2d13);_0x2473fe(null);};}for(var e in events){if(events[_0x7a5b('0x7')](e)){var event=events[e];SmsQueue[_0x7a5b('0x8')](e,emitEvent(event));}}module[_0x7a5b('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f61b820..12ddc47 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 _0xbf30=['api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x273ef0,_0x1a40d7){var _0x50f42e=function(_0x3eb4bc){while(--_0x3eb4bc){_0x273ef0['push'](_0x273ef0['shift']());}};_0x50f42e(++_0x1a40d7);}(_0xbf30,0x8c));var _0x0bf3=function(_0x171d09,_0x5db1cd){_0x171d09=_0x171d09-0x0;var _0x13e106=_0xbf30[_0x171d09];return _0x13e106;};'use strict';var _=require(_0x0bf3('0x0'));var util=require(_0x0bf3('0x1'));var logger=require(_0x0bf3('0x2'))(_0x0bf3('0x3'));var moment=require(_0x0bf3('0x4'));var BPromise=require(_0x0bf3('0x5'));var rp=require(_0x0bf3('0x6'));var fs=require('fs');var path=require(_0x0bf3('0x7'));var rimraf=require(_0x0bf3('0x8'));var config=require('../../config/environment');var attributes=require(_0x0bf3('0x9'));module['exports']=function(_0x6b5e92,_0x2b5a1b){return _0x6b5e92[_0x0bf3('0xa')](_0x0bf3('0xb'),attributes,{'tableName':_0x0bf3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51d1=['bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1553cd,_0x7d92d6){var _0x4ab66e=function(_0x42e437){while(--_0x42e437){_0x1553cd['push'](_0x1553cd['shift']());}};_0x4ab66e(++_0x7d92d6);}(_0x51d1,0x70));var _0x151d=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x51d1[_0x3005d5];return _0x547c7e;};'use strict';var _=require(_0x151d('0x0'));var util=require(_0x151d('0x1'));var logger=require(_0x151d('0x2'))(_0x151d('0x3'));var moment=require(_0x151d('0x4'));var BPromise=require(_0x151d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x151d('0x6'));var rimraf=require(_0x151d('0x7'));var config=require(_0x151d('0x8'));var attributes=require(_0x151d('0x9'));module[_0x151d('0xa')]=function(_0x366992,_0x557a2d){return _0x366992[_0x151d('0xb')]('SmsQueue',attributes,{'tableName':_0x151d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f81bd30..f484a6b 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 _0x3c17=['SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSmsQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./smsQueue.socket','register','request','request\x20sent','debug','stringify','error','code'];(function(_0x25955b,_0x2fdf32){var _0x50c9b8=function(_0x811288){while(--_0x811288){_0x25955b['push'](_0x25955b['shift']());}};_0x50c9b8(++_0x2fdf32);}(_0x3c17,0x8a));var _0x73c1=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x3c17[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x73c1('0x0'));var util=require(_0x73c1('0x1'));var moment=require('moment');var BPromise=require(_0x73c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73c1('0x3'))['db'];var utils=require(_0x73c1('0x4'));var logger=require(_0x73c1('0x5'))(_0x73c1('0x6'));var config=require(_0x73c1('0x7'));var jayson=require(_0x73c1('0x8'));var client=jayson[_0x73c1('0x9')][_0x73c1('0xa')]({'port':0x232a});config['redis']=_[_0x73c1('0xb')](config['redis'],{'host':_0x73c1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73c1('0xd')]));require(_0x73c1('0xe'))[_0x73c1('0xf')](socket);function respondWithRpcPromise(_0x19d6ff,_0x5a9ee1,_0x37d668){return new BPromise(function(_0x15501e,_0x5970b1){return client[_0x73c1('0x10')](_0x19d6ff,_0x37d668)['then'](function(_0x402e8b){logger['info']('SmsQueue,\x20%s,\x20%s',_0x5a9ee1,_0x73c1('0x11'));logger[_0x73c1('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5a9ee1,_0x73c1('0x11'),JSON[_0x73c1('0x13')](_0x402e8b));if(_0x402e8b[_0x73c1('0x14')]){if(_0x402e8b[_0x73c1('0x14')][_0x73c1('0x15')]===0x1f4){logger[_0x73c1('0x14')](_0x73c1('0x16'),_0x5a9ee1,_0x402e8b[_0x73c1('0x14')][_0x73c1('0x17')]);return _0x5970b1(_0x402e8b[_0x73c1('0x14')][_0x73c1('0x17')]);}logger[_0x73c1('0x14')]('SmsQueue,\x20%s,\x20%s',_0x5a9ee1,_0x402e8b['error']['message']);return _0x15501e(_0x402e8b[_0x73c1('0x14')][_0x73c1('0x17')]);}else{logger[_0x73c1('0x18')](_0x73c1('0x16'),_0x5a9ee1,_0x73c1('0x11'));_0x15501e(_0x402e8b[_0x73c1('0x19')]['message']);}})[_0x73c1('0x1a')](function(_0x1ceff4){logger['error'](_0x73c1('0x16'),_0x5a9ee1,_0x1ceff4);_0x5970b1(_0x1ceff4);});});}exports[_0x73c1('0x1b')]=function(_0x61bdb4){var _0x559d8c=this;return new Promise(function(_0x26aba6,_0x6b508a){return db[_0x73c1('0x1c')][_0x73c1('0x1d')]({'raw':_0x61bdb4[_0x73c1('0x1e')]?_0x61bdb4[_0x73c1('0x1e')][_0x73c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x61bdb4[_0x73c1('0x1e')]?_0x61bdb4[_0x73c1('0x1e')][_0x73c1('0x20')]||null:null,'attributes':_0x61bdb4[_0x73c1('0x1e')]?_0x61bdb4[_0x73c1('0x1e')][_0x73c1('0x21')]||null:null,'limit':_0x61bdb4['options']?_0x61bdb4[_0x73c1('0x1e')][_0x73c1('0x22')]||null:null,'include':_0x61bdb4[_0x73c1('0x1e')]?_0x61bdb4['options'][_0x73c1('0x23')]?_[_0x73c1('0x24')](_0x61bdb4[_0x73c1('0x1e')]['include'],function(_0x47b4ee){return{'model':db[_0x47b4ee[_0x73c1('0x25')]],'as':_0x47b4ee['as'],'attributes':_0x47b4ee[_0x73c1('0x21')],'include':_0x47b4ee[_0x73c1('0x23')]?_[_0x73c1('0x24')](_0x47b4ee[_0x73c1('0x23')],function(_0x50a997){return{'model':db[_0x50a997[_0x73c1('0x25')]],'as':_0x50a997['as'],'attributes':_0x50a997['attributes'],'include':_0x50a997[_0x73c1('0x23')]?_['map'](_0x50a997['include'],function(_0x576f62){return{'model':db[_0x576f62[_0x73c1('0x25')]],'as':_0x576f62['as'],'attributes':_0x576f62[_0x73c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x73c1('0x26')](function(_0x328e8b){logger['info'](_0x73c1('0x1b'),_0x61bdb4);logger[_0x73c1('0x12')](_0x73c1('0x1b'),_0x61bdb4,JSON[_0x73c1('0x13')](_0x328e8b));_0x26aba6(_0x328e8b);})[_0x73c1('0x1a')](function(_0x269172){logger[_0x73c1('0x14')](_0x73c1('0x1b'),_0x269172[_0x73c1('0x17')],_0x61bdb4);_0x6b508a(_0x559d8c[_0x73c1('0x14')](0x1f4,_0x269172[_0x73c1('0x17')]));});});};exports['ShowSmsQueue']=function(_0x2f89c2){var _0x2ab126=this;return new Promise(function(_0x53f8de,_0x4ab325){return db[_0x73c1('0x1c')]['find']({'raw':_0x2f89c2['options']?_0x2f89c2[_0x73c1('0x1e')][_0x73c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f89c2[_0x73c1('0x1e')]?_0x2f89c2[_0x73c1('0x1e')][_0x73c1('0x20')]||null:null,'attributes':_0x2f89c2['options']?_0x2f89c2[_0x73c1('0x1e')][_0x73c1('0x21')]||null:null,'include':_0x2f89c2[_0x73c1('0x1e')]?_0x2f89c2[_0x73c1('0x1e')][_0x73c1('0x23')]?_[_0x73c1('0x24')](_0x2f89c2['options']['include'],function(_0x15a060){return{'model':db[_0x15a060['model']],'as':_0x15a060['as'],'attributes':_0x15a060[_0x73c1('0x21')],'include':_0x15a060[_0x73c1('0x23')]?_[_0x73c1('0x24')](_0x15a060[_0x73c1('0x23')],function(_0x3c9c4f){return{'model':db[_0x3c9c4f[_0x73c1('0x25')]],'as':_0x3c9c4f['as'],'attributes':_0x3c9c4f['attributes'],'include':_0x3c9c4f[_0x73c1('0x23')]?_[_0x73c1('0x24')](_0x3c9c4f['include'],function(_0x306862){return{'model':db[_0x306862[_0x73c1('0x25')]],'as':_0x306862['as'],'attributes':_0x306862['attributes']};}):[]};}):[]};}):[]:[]})[_0x73c1('0x26')](function(_0x36894d){logger[_0x73c1('0x18')](_0x73c1('0x27'),_0x2f89c2);logger['debug']('ShowSmsQueue',_0x2f89c2,JSON['stringify'](_0x36894d));_0x53f8de(_0x36894d);})[_0x73c1('0x1a')](function(_0x5a4357){logger['error'](_0x73c1('0x27'),_0x5a4357['message'],_0x2f89c2);_0x4ab325(_0x2ab126['error'](0x1f4,_0x5a4357[_0x73c1('0x17')]));});});}; \ No newline at end of file +var _0x8b57=['localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','then','catch','ShowSmsQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8b57,0xf9));var _0x78b5=function(_0x3977a1,_0xdcd73a){_0x3977a1=_0x3977a1-0x0;var _0xa33933=_0x8b57[_0x3977a1];return _0xa33933;};'use strict';var _=require(_0x78b5('0x0'));var util=require(_0x78b5('0x1'));var moment=require(_0x78b5('0x2'));var BPromise=require(_0x78b5('0x3'));var rs=require(_0x78b5('0x4'));var fs=require('fs');var Redis=require(_0x78b5('0x5'));var db=require(_0x78b5('0x6'))['db'];var utils=require(_0x78b5('0x7'));var logger=require('../../config/logger')(_0x78b5('0x8'));var config=require(_0x78b5('0x9'));var jayson=require(_0x78b5('0xa'));var client=jayson[_0x78b5('0xb')][_0x78b5('0xc')]({'port':0x232a});config[_0x78b5('0xd')]=_[_0x78b5('0xe')](config['redis'],{'host':_0x78b5('0xf'),'port':0x18eb});var socket=require(_0x78b5('0x10'))(new Redis(config[_0x78b5('0xd')]));require(_0x78b5('0x11'))[_0x78b5('0x12')](socket);function respondWithRpcPromise(_0x3cb7f6,_0x177b27,_0x44e1f5){return new BPromise(function(_0x3912c0,_0x3c79e4){return client[_0x78b5('0x13')](_0x3cb7f6,_0x44e1f5)['then'](function(_0x125a4e){logger[_0x78b5('0x14')](_0x78b5('0x15'),_0x177b27,'request\x20sent');logger[_0x78b5('0x16')](_0x78b5('0x17'),_0x177b27,'request\x20sent',JSON[_0x78b5('0x18')](_0x125a4e));if(_0x125a4e[_0x78b5('0x19')]){if(_0x125a4e['error']['code']===0x1f4){logger[_0x78b5('0x19')](_0x78b5('0x15'),_0x177b27,_0x125a4e[_0x78b5('0x19')][_0x78b5('0x1a')]);return _0x3c79e4(_0x125a4e['error'][_0x78b5('0x1a')]);}logger[_0x78b5('0x19')]('SmsQueue,\x20%s,\x20%s',_0x177b27,_0x125a4e[_0x78b5('0x19')][_0x78b5('0x1a')]);return _0x3912c0(_0x125a4e[_0x78b5('0x19')]['message']);}else{logger['info'](_0x78b5('0x15'),_0x177b27,_0x78b5('0x1b'));_0x3912c0(_0x125a4e[_0x78b5('0x1c')][_0x78b5('0x1a')]);}})['catch'](function(_0x231ec7){logger['error'](_0x78b5('0x15'),_0x177b27,_0x231ec7);_0x3c79e4(_0x231ec7);});});}exports[_0x78b5('0x1d')]=function(_0xf283aa){var _0x1783e1=this;return new Promise(function(_0x1738a2,_0x3fafba){return db[_0x78b5('0x1e')][_0x78b5('0x1f')]({'raw':_0xf283aa[_0x78b5('0x20')]?_0xf283aa['options'][_0x78b5('0x21')]===undefined?!![]:![]:!![],'where':_0xf283aa[_0x78b5('0x20')]?_0xf283aa['options']['where']||null:null,'attributes':_0xf283aa[_0x78b5('0x20')]?_0xf283aa[_0x78b5('0x20')][_0x78b5('0x22')]||null:null,'limit':_0xf283aa[_0x78b5('0x20')]?_0xf283aa[_0x78b5('0x20')][_0x78b5('0x23')]||null:null,'include':_0xf283aa[_0x78b5('0x20')]?_0xf283aa[_0x78b5('0x20')]['include']?_['map'](_0xf283aa['options'][_0x78b5('0x24')],function(_0x7ddb64){return{'model':db[_0x7ddb64['model']],'as':_0x7ddb64['as'],'attributes':_0x7ddb64[_0x78b5('0x22')],'include':_0x7ddb64['include']?_[_0x78b5('0x25')](_0x7ddb64[_0x78b5('0x24')],function(_0x4ffb42){return{'model':db[_0x4ffb42['model']],'as':_0x4ffb42['as'],'attributes':_0x4ffb42[_0x78b5('0x22')],'include':_0x4ffb42[_0x78b5('0x24')]?_[_0x78b5('0x25')](_0x4ffb42['include'],function(_0x341af0){return{'model':db[_0x341af0[_0x78b5('0x26')]],'as':_0x341af0['as'],'attributes':_0x341af0[_0x78b5('0x22')]};}):[]};}):[]};}):[]:[]})[_0x78b5('0x27')](function(_0x23792d){logger[_0x78b5('0x14')]('GetSmsQueue',_0xf283aa);logger[_0x78b5('0x16')](_0x78b5('0x1d'),_0xf283aa,JSON[_0x78b5('0x18')](_0x23792d));_0x1738a2(_0x23792d);})[_0x78b5('0x28')](function(_0x1cab40){logger[_0x78b5('0x19')](_0x78b5('0x1d'),_0x1cab40[_0x78b5('0x1a')],_0xf283aa);_0x3fafba(_0x1783e1[_0x78b5('0x19')](0x1f4,_0x1cab40[_0x78b5('0x1a')]));});});};exports[_0x78b5('0x29')]=function(_0x20d328){var _0x386d30=this;return new Promise(function(_0x3cd232,_0x858a73){return db['SmsQueue'][_0x78b5('0x2a')]({'raw':_0x20d328[_0x78b5('0x20')]?_0x20d328[_0x78b5('0x20')][_0x78b5('0x21')]===undefined?!![]:![]:!![],'where':_0x20d328['options']?_0x20d328[_0x78b5('0x20')][_0x78b5('0x2b')]||null:null,'attributes':_0x20d328[_0x78b5('0x20')]?_0x20d328[_0x78b5('0x20')][_0x78b5('0x22')]||null:null,'include':_0x20d328[_0x78b5('0x20')]?_0x20d328[_0x78b5('0x20')][_0x78b5('0x24')]?_[_0x78b5('0x25')](_0x20d328[_0x78b5('0x20')][_0x78b5('0x24')],function(_0x1adcc0){return{'model':db[_0x1adcc0[_0x78b5('0x26')]],'as':_0x1adcc0['as'],'attributes':_0x1adcc0['attributes'],'include':_0x1adcc0[_0x78b5('0x24')]?_[_0x78b5('0x25')](_0x1adcc0[_0x78b5('0x24')],function(_0x171e23){return{'model':db[_0x171e23[_0x78b5('0x26')]],'as':_0x171e23['as'],'attributes':_0x171e23['attributes'],'include':_0x171e23[_0x78b5('0x24')]?_['map'](_0x171e23[_0x78b5('0x24')],function(_0x1ce85b){return{'model':db[_0x1ce85b[_0x78b5('0x26')]],'as':_0x1ce85b['as'],'attributes':_0x1ce85b[_0x78b5('0x22')]};}):[]};}):[]};}):[]:[]})[_0x78b5('0x27')](function(_0x40238f){logger[_0x78b5('0x14')](_0x78b5('0x29'),_0x20d328);logger['debug'](_0x78b5('0x29'),_0x20d328,JSON[_0x78b5('0x18')](_0x40238f));_0x3cd232(_0x40238f);})[_0x78b5('0x28')](function(_0x42b3a2){logger[_0x78b5('0x19')](_0x78b5('0x29'),_0x42b3a2[_0x78b5('0x1a')],_0x20d328);_0x858a73(_0x386d30[_0x78b5('0x19')](0x1f4,_0x42b3a2[_0x78b5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c614297..7e17405 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 _0x9ae1=['remove','update','emit','removeListener','register','smsQueue:','./smsQueue.events','save'];(function(_0x1e716d,_0x12b8f9){var _0x49cb36=function(_0x2a227d){while(--_0x2a227d){_0x1e716d['push'](_0x1e716d['shift']());}};_0x49cb36(++_0x12b8f9);}(_0x9ae1,0x1be));var _0x19ae=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x9ae1[_0x55f8b4];return _0x2475f9;};'use strict';var SmsQueueEvents=require(_0x19ae('0x0'));var events=[_0x19ae('0x1'),_0x19ae('0x2'),_0x19ae('0x3')];function createListener(_0x4376c9,_0x5d4ec3){return function(_0x3b8477){_0x5d4ec3[_0x19ae('0x4')](_0x4376c9,_0x3b8477);};}function removeListener(_0x507cfd,_0x498116){return function(){SmsQueueEvents[_0x19ae('0x5')](_0x507cfd,_0x498116);};}exports[_0x19ae('0x6')]=function(_0x498cab){for(var _0xbc799a=0x0,_0x511573=events['length'];_0xbc799a<_0x511573;_0xbc799a++){var _0x350aee=events[_0xbc799a];var _0x290bb7=createListener(_0x19ae('0x7')+_0x350aee,_0x498cab);SmsQueueEvents['on'](_0x350aee,_0x290bb7);}}; \ No newline at end of file +var _0x25b6=['update','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x25b6,0x1ad));var _0x625b=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x25b6[_0x4733d3];return _0x1b9a44;};'use strict';var SmsQueueEvents=require(_0x625b('0x0'));var events=[_0x625b('0x1'),_0x625b('0x2'),_0x625b('0x3')];function createListener(_0x130e57,_0x1b84db){return function(_0x831fcc){_0x1b84db['emit'](_0x130e57,_0x831fcc);};}function removeListener(_0x2d45cd,_0x133073){return function(){SmsQueueEvents[_0x625b('0x4')](_0x2d45cd,_0x133073);};}exports[_0x625b('0x5')]=function(_0x418d88){for(var _0x460d94=0x0,_0x1f390e=events[_0x625b('0x6')];_0x460d94<_0x1f390e;_0x460d94++){var _0x360bdf=events[_0x460d94];var _0x327663=createListener(_0x625b('0x7')+_0x360bdf,_0x418d88);SmsQueueEvents['on'](_0x360bdf,_0x327663);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6de1a71..400d380 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 _0x51a8=['isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x9f1af6,_0x1909e4){var _0x5f060d=function(_0xe6643b){while(--_0xe6643b){_0x9f1af6['push'](_0x9f1af6['shift']());}};_0x5f060d(++_0x1909e4);}(_0x51a8,0x186));var _0x851a=function(_0x357eda,_0x3f1bf6){_0x357eda=_0x357eda-0x0;var _0xadf5c8=_0x51a8[_0x357eda];return _0xadf5c8;};'use strict';var multer=require(_0x851a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x851a('0x1'));var express=require(_0x851a('0x2'));var router=express[_0x851a('0x3')]();var fs_extra=require(_0x851a('0x4'));var auth=require(_0x851a('0x5'));var interaction=require(_0x851a('0x6'));var config=require(_0x851a('0x7'));var controller=require(_0x851a('0x8'));router[_0x851a('0x9')]('/',auth[_0x851a('0xa')](),controller['index']);router['get'](_0x851a('0xb'),auth[_0x851a('0xa')](),controller[_0x851a('0xc')]);router['get'](_0x851a('0xd'),auth[_0x851a('0xa')](),controller['show']);router['post']('/',auth[_0x851a('0xa')](),controller[_0x851a('0xe')]);router[_0x851a('0xf')](_0x851a('0xd'),auth[_0x851a('0xa')](),controller[_0x851a('0x10')]);router[_0x851a('0x11')](_0x851a('0xd'),auth[_0x851a('0xa')](),controller[_0x851a('0x12')]);module[_0x851a('0x13')]=router; \ No newline at end of file +var _0x576b=['fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0x3c05a5,_0x1a93f4){var _0xb15a3c=function(_0x2fa2f1){while(--_0x2fa2f1){_0x3c05a5['push'](_0x3c05a5['shift']());}};_0xb15a3c(++_0x1a93f4);}(_0x576b,0x1d9));var _0xb576=function(_0x34daae,_0x49679c){_0x34daae=_0x34daae-0x0;var _0x433a73=_0x576b[_0x34daae];return _0x433a73;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb576('0x0'));var express=require(_0xb576('0x1'));var router=express['Router']();var fs_extra=require(_0xb576('0x2'));var auth=require(_0xb576('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb576('0x4'));var controller=require(_0xb576('0x5'));router[_0xb576('0x6')]('/',auth[_0xb576('0x7')](),controller[_0xb576('0x8')]);router[_0xb576('0x6')](_0xb576('0x9'),auth[_0xb576('0x7')](),controller[_0xb576('0xa')]);router[_0xb576('0x6')](_0xb576('0xb'),auth[_0xb576('0x7')](),controller[_0xb576('0xc')]);router[_0xb576('0xd')]('/',auth[_0xb576('0x7')](),controller['create']);router[_0xb576('0xe')]('/:id',auth[_0xb576('0x7')](),controller[_0xb576('0xf')]);router[_0xb576('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb576('0x11')]);module[_0xb576('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index aaa9ef6..ca005ee 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 _0x140b=['exports','STRING','DATE'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x140b,0x6f));var _0xb140=function(_0x4c210e,_0x3cfd96){_0x4c210e=_0x4c210e-0x0;var _0x734c90=_0x140b[_0x4c210e];return _0x734c90;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb140('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb140('0x1')]},'joinAt':{'type':Sequelize[_0xb140('0x2')]},'leaveAt':{'type':Sequelize[_0xb140('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb140('0x2')]},'reason':{'type':Sequelize[_0xb140('0x1')]}}; \ No newline at end of file +var _0xf197=['exports','STRING','DATE','sequelize'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0xf197,0x10f));var _0x7f19=function(_0x53c5b7,_0x30cf7e){_0x53c5b7=_0x53c5b7-0x0;var _0x1a5f1c=_0xf197[_0x53c5b7];return _0x1a5f1c;};'use strict';var moment=require('moment');var Sequelize=require(_0x7f19('0x0'));module[_0x7f19('0x1')]={'uniqueid':{'type':Sequelize[_0x7f19('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7f19('0x2')]},'joinAt':{'type':Sequelize[_0x7f19('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7f19('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7f19('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5c48049..82a406a 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 _0x5ed8=['util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','end','error','name','send','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','merge','options','SmsQueueReport','includeAll','include','findAll','params','keys','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x99c2dd,_0x1d32eb){var _0x173349=function(_0x211a30){while(--_0x211a30){_0x99c2dd['push'](_0x99c2dd['shift']());}};_0x173349(++_0x1d32eb);}(_0x5ed8,0x1b6));var _0x85ed=function(_0x2ba1b2,_0x1d4370){_0x2ba1b2=_0x2ba1b2-0x0;var _0x23345e=_0x5ed8[_0x2ba1b2];return _0x23345e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85ed('0x0'));var zipdir=require(_0x85ed('0x1'));var jsonpatch=require(_0x85ed('0x2'));var rp=require(_0x85ed('0x3'));var moment=require(_0x85ed('0x4'));var BPromise=require(_0x85ed('0x5'));var Mustache=require('mustache');var util=require(_0x85ed('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x85ed('0x7'));var ejs=require(_0x85ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ed('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x85ed('0xa'));var deskjs=require(_0x85ed('0xb'));var toCsv=require(_0x85ed('0x7'));var querystring=require(_0x85ed('0xc'));var Papa=require(_0x85ed('0xd'));var Redis=require(_0x85ed('0xe'));var authService=require(_0x85ed('0xf'));var qs=require(_0x85ed('0x10'));var as=require(_0x85ed('0x11'));var hardwareService=require(_0x85ed('0x12'));var logger=require(_0x85ed('0x13'))(_0x85ed('0x14'));var utils=require(_0x85ed('0x15'));var config=require(_0x85ed('0x16'));var licenseUtil=require(_0x85ed('0x17'));var db=require(_0x85ed('0x18'))['db'];function respondWithStatusCode(_0x1a0002,_0x23d29f){_0x23d29f=_0x23d29f||0xcc;return function(_0x251997){if(_0x251997){return _0x1a0002[_0x85ed('0x19')](_0x23d29f);}return _0x1a0002[_0x85ed('0x1a')](_0x23d29f)['end']();};}function respondWithResult(_0x3043ba,_0x5575a4){_0x5575a4=_0x5575a4||0xc8;return function(_0x52f763){if(_0x52f763){return _0x3043ba[_0x85ed('0x1a')](_0x5575a4)[_0x85ed('0x1b')](_0x52f763);}};}function respondWithFilteredResult(_0x265879,_0x9639c3){return function(_0x371d4b){if(_0x371d4b){var _0x3fd797=typeof _0x9639c3[_0x85ed('0x1c')]===_0x85ed('0x1d')&&typeof _0x9639c3['limit']===_0x85ed('0x1d');var _0x3cacdf=_0x371d4b[_0x85ed('0x1e')];var _0x4533c6=_0x3fd797?0x0:_0x9639c3[_0x85ed('0x1c')];var _0x20fffe=_0x3fd797?_0x371d4b[_0x85ed('0x1e')]:_0x9639c3[_0x85ed('0x1c')]+_0x9639c3[_0x85ed('0x1f')];var _0x54f4ee;if(_0x20fffe>=_0x3cacdf){_0x20fffe=_0x3cacdf;_0x54f4ee=0xc8;}else{_0x54f4ee=0xce;}_0x265879[_0x85ed('0x1a')](_0x54f4ee);return _0x265879[_0x85ed('0x20')]('Content-Range',_0x4533c6+'-'+_0x20fffe+'/'+_0x3cacdf)['json'](_0x371d4b);}return null;};}function patchUpdates(_0x2fabb4){return function(_0x38e1ac){try{jsonpatch['apply'](_0x38e1ac,_0x2fabb4,!![]);}catch(_0x4306dc){return BPromise[_0x85ed('0x21')](_0x4306dc);}return _0x38e1ac[_0x85ed('0x22')]();};}function saveUpdates(_0x4b1e2b,_0x196d15){return function(_0x585cc8){if(_0x585cc8){return _0x585cc8[_0x85ed('0x23')](_0x4b1e2b)['then'](function(_0x3aed92){return _0x3aed92;});}return null;};}function removeEntity(_0xf9599e,_0x59d941){return function(_0x278695){if(_0x278695){return _0x278695[_0x85ed('0x24')]()[_0x85ed('0x25')](function(){_0xf9599e[_0x85ed('0x1a')](0xcc)[_0x85ed('0x26')]();});}};}function handleEntityNotFound(_0x75f3fb,_0x504403){return function(_0x5ca4ce){if(!_0x5ca4ce){_0x75f3fb['sendStatus'](0x194);}return _0x5ca4ce;};}function handleError(_0x49158e,_0x37e45e){_0x37e45e=_0x37e45e||0x1f4;return function(_0x1cf663){logger[_0x85ed('0x27')](_0x1cf663['stack']);if(_0x1cf663['name']){delete _0x1cf663[_0x85ed('0x28')];}_0x49158e[_0x85ed('0x1a')](_0x37e45e)[_0x85ed('0x29')](_0x1cf663);};}exports[_0x85ed('0x2a')]=function(_0x4b0213,_0x9e52b5){var _0x55fd38={},_0x41c64a={},_0x5d50ee={'count':0x0,'rows':[]};var _0x4e3c23=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x55f04a){return{'name':_0x55f04a[_0x85ed('0x2b')],'type':_0x55f04a[_0x85ed('0x2c')][_0x85ed('0x2d')]};});_0x41c64a[_0x85ed('0x2e')]=_['map'](_0x4e3c23,_0x85ed('0x28'));_0x41c64a[_0x85ed('0x2f')]=_['keys'](_0x4b0213[_0x85ed('0x2f')]);_0x41c64a[_0x85ed('0x30')]=_[_0x85ed('0x31')](_0x41c64a[_0x85ed('0x2e')],_0x41c64a[_0x85ed('0x2f')]);_0x55fd38[_0x85ed('0x32')]=_[_0x85ed('0x31')](_0x41c64a[_0x85ed('0x2e')],qs['fields'](_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x33')]));_0x55fd38['attributes']=_0x55fd38[_0x85ed('0x32')][_0x85ed('0x34')]?_0x55fd38[_0x85ed('0x32')]:_0x41c64a['model'];if(!_0x4b0213[_0x85ed('0x2f')]['hasOwnProperty'](_0x85ed('0x35'))){_0x55fd38[_0x85ed('0x1f')]=qs[_0x85ed('0x1f')](_0x4b0213['query'][_0x85ed('0x1f')]);_0x55fd38['offset']=qs[_0x85ed('0x1c')](_0x4b0213[_0x85ed('0x2f')]['offset']);}_0x55fd38[_0x85ed('0x36')]=qs[_0x85ed('0x37')](_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x37')]);_0x55fd38['where']=qs['filters'](_[_0x85ed('0x38')](_0x4b0213[_0x85ed('0x2f')],_0x41c64a[_0x85ed('0x30')]),_0x4e3c23);if(_0x4b0213['query'][_0x85ed('0x39')]){_0x55fd38[_0x85ed('0x3a')]=_['merge'](_0x55fd38[_0x85ed('0x3a')],{'$or':_[_0x85ed('0x3b')](_0x4e3c23,function(_0x383f4a){if(_0x383f4a[_0x85ed('0x2c')]!=='VIRTUAL'){var _0x29feb4={};_0x29feb4[_0x383f4a[_0x85ed('0x28')]]={'$like':'%'+_0x4b0213['query'][_0x85ed('0x39')]+'%'};return _0x29feb4;}})});}_0x55fd38=_[_0x85ed('0x3c')]({},_0x55fd38,_0x4b0213[_0x85ed('0x3d')]);var _0x11262a={'where':_0x55fd38[_0x85ed('0x3a')]};return db[_0x85ed('0x3e')][_0x85ed('0x1e')](_0x11262a)[_0x85ed('0x25')](function(_0xffcc7e){_0x5d50ee[_0x85ed('0x1e')]=_0xffcc7e;if(_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x3f')]){_0x55fd38[_0x85ed('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x85ed('0x41')](_0x55fd38);})['then'](function(_0x349800){_0x5d50ee['rows']=_0x349800;return _0x5d50ee;})[_0x85ed('0x25')](respondWithFilteredResult(_0x9e52b5,_0x55fd38))['catch'](handleError(_0x9e52b5,null));};exports['show']=function(_0x199f82,_0x34ba3d){var _0x56523d={'raw':!![],'where':{'id':_0x199f82[_0x85ed('0x42')]['id']}},_0x15dde3={};_0x15dde3[_0x85ed('0x2e')]=_[_0x85ed('0x43')](db[_0x85ed('0x3e')][_0x85ed('0x44')]);_0x15dde3[_0x85ed('0x2f')]=_[_0x85ed('0x43')](_0x199f82[_0x85ed('0x2f')]);_0x15dde3[_0x85ed('0x30')]=_[_0x85ed('0x31')](_0x15dde3['model'],_0x15dde3['query']);_0x56523d[_0x85ed('0x32')]=_[_0x85ed('0x31')](_0x15dde3[_0x85ed('0x2e')],qs['fields'](_0x199f82[_0x85ed('0x2f')][_0x85ed('0x33')]));_0x56523d[_0x85ed('0x32')]=_0x56523d['attributes']['length']?_0x56523d[_0x85ed('0x32')]:_0x15dde3[_0x85ed('0x2e')];if(_0x199f82[_0x85ed('0x2f')]['includeAll']){_0x56523d[_0x85ed('0x40')]=[{'all':!![]}];}_0x56523d=_['merge']({},_0x56523d,_0x199f82[_0x85ed('0x3d')]);return db[_0x85ed('0x3e')][_0x85ed('0x45')](_0x56523d)[_0x85ed('0x25')](handleEntityNotFound(_0x34ba3d,null))[_0x85ed('0x25')](respondWithResult(_0x34ba3d,null))[_0x85ed('0x46')](handleError(_0x34ba3d,null));};exports[_0x85ed('0x47')]=function(_0x3b9250,_0x370cd0){return db['SmsQueueReport'][_0x85ed('0x47')](_0x3b9250[_0x85ed('0x48')],{})['then'](respondWithResult(_0x370cd0,0xc9))[_0x85ed('0x46')](handleError(_0x370cd0,null));};exports[_0x85ed('0x23')]=function(_0x2ab3d8,_0x4a4555){if(_0x2ab3d8[_0x85ed('0x48')]['id']){delete _0x2ab3d8['body']['id'];}return db[_0x85ed('0x3e')][_0x85ed('0x45')]({'where':{'id':_0x2ab3d8['params']['id']}})[_0x85ed('0x25')](handleEntityNotFound(_0x4a4555,null))[_0x85ed('0x25')](saveUpdates(_0x2ab3d8['body'],null))['then'](respondWithResult(_0x4a4555,null))[_0x85ed('0x46')](handleError(_0x4a4555,null));};exports[_0x85ed('0x24')]=function(_0x293245,_0x272dc9){return db['SmsQueueReport'][_0x85ed('0x45')]({'where':{'id':_0x293245[_0x85ed('0x42')]['id']}})['then'](handleEntityNotFound(_0x272dc9,null))['then'](removeEntity(_0x272dc9,null))[_0x85ed('0x46')](handleError(_0x272dc9,null));};exports['describe']=function(_0x25b096,_0x3a39d9){return db[_0x85ed('0x3e')][_0x85ed('0x49')]()[_0x85ed('0x25')](respondWithResult(_0x3a39d9,null))[_0x85ed('0x46')](handleError(_0x3a39d9,null));}; \ No newline at end of file +var _0x74ef=['includeAll','findAll','rows','catch','show','params','intersection','length','include','options','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL'];(function(_0x3bae6e,_0x5c8569){var _0x19437b=function(_0x3e454b){while(--_0x3e454b){_0x3bae6e['push'](_0x3bae6e['shift']());}};_0x19437b(++_0x5c8569);}(_0x74ef,0x1bf));var _0xf74e=function(_0x26f73d,_0x9e3661){_0x26f73d=_0x26f73d-0x0;var _0x44b40f=_0x74ef[_0x26f73d];return _0x44b40f;};'use strict';var emlformat=require(_0xf74e('0x0'));var rimraf=require(_0xf74e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf74e('0x2'));var rp=require(_0xf74e('0x3'));var moment=require('moment');var BPromise=require(_0xf74e('0x4'));var Mustache=require('mustache');var util=require(_0xf74e('0x5'));var path=require('path');var sox=require(_0xf74e('0x6'));var csv=require(_0xf74e('0x7'));var ejs=require(_0xf74e('0x8'));var fs=require('fs');var fs_extra=require(_0xf74e('0x9'));var _=require(_0xf74e('0xa'));var squel=require('squel');var crypto=require(_0xf74e('0xb'));var jsforce=require(_0xf74e('0xc'));var deskjs=require(_0xf74e('0xd'));var toCsv=require(_0xf74e('0x7'));var querystring=require(_0xf74e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf74e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf74e('0x10'));var hardwareService=require(_0xf74e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf74e('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646591,_0x3d7faa){_0x3d7faa=_0x3d7faa||0xcc;return function(_0x438a22){if(_0x438a22){return _0x646591[_0xf74e('0x13')](_0x3d7faa);}return _0x646591[_0xf74e('0x14')](_0x3d7faa)[_0xf74e('0x15')]();};}function respondWithResult(_0x46225b,_0x145926){_0x145926=_0x145926||0xc8;return function(_0x3c0613){if(_0x3c0613){return _0x46225b[_0xf74e('0x14')](_0x145926)[_0xf74e('0x16')](_0x3c0613);}};}function respondWithFilteredResult(_0x26e21d,_0x566b06){return function(_0x593236){if(_0x593236){var _0x2dd0f1=typeof _0x566b06[_0xf74e('0x17')]===_0xf74e('0x18')&&typeof _0x566b06[_0xf74e('0x19')]==='undefined';var _0x36faf4=_0x593236[_0xf74e('0x1a')];var _0x3e3f6a=_0x2dd0f1?0x0:_0x566b06[_0xf74e('0x17')];var _0x5affa5=_0x2dd0f1?_0x593236[_0xf74e('0x1a')]:_0x566b06['offset']+_0x566b06[_0xf74e('0x19')];var _0x148dbc;if(_0x5affa5>=_0x36faf4){_0x5affa5=_0x36faf4;_0x148dbc=0xc8;}else{_0x148dbc=0xce;}_0x26e21d[_0xf74e('0x14')](_0x148dbc);return _0x26e21d[_0xf74e('0x1b')](_0xf74e('0x1c'),_0x3e3f6a+'-'+_0x5affa5+'/'+_0x36faf4)[_0xf74e('0x16')](_0x593236);}return null;};}function patchUpdates(_0x8ee452){return function(_0x3a2ef8){try{jsonpatch[_0xf74e('0x1d')](_0x3a2ef8,_0x8ee452,!![]);}catch(_0x568d36){return BPromise['reject'](_0x568d36);}return _0x3a2ef8[_0xf74e('0x1e')]();};}function saveUpdates(_0x555f1b,_0x41149b){return function(_0x4637c2){if(_0x4637c2){return _0x4637c2['update'](_0x555f1b)[_0xf74e('0x1f')](function(_0x550236){return _0x550236;});}return null;};}function removeEntity(_0x442637,_0x151ed2){return function(_0x53c58f){if(_0x53c58f){return _0x53c58f[_0xf74e('0x20')]()[_0xf74e('0x1f')](function(){_0x442637['status'](0xcc)[_0xf74e('0x15')]();});}};}function handleEntityNotFound(_0x42a6d3,_0x56a915){return function(_0x5b766e){if(!_0x5b766e){_0x42a6d3[_0xf74e('0x13')](0x194);}return _0x5b766e;};}function handleError(_0x437ece,_0x135b74){_0x135b74=_0x135b74||0x1f4;return function(_0x120f74){logger[_0xf74e('0x21')](_0x120f74[_0xf74e('0x22')]);if(_0x120f74['name']){delete _0x120f74[_0xf74e('0x23')];}_0x437ece['status'](_0x135b74)[_0xf74e('0x24')](_0x120f74);};}exports[_0xf74e('0x25')]=function(_0x218d21,_0x275804){var _0x461082={},_0x182070={},_0x1da27d={'count':0x0,'rows':[]};var _0x4cc2da=_[_0xf74e('0x26')](db[_0xf74e('0x27')][_0xf74e('0x28')],function(_0x4d1092){return{'name':_0x4d1092['fieldName'],'type':_0x4d1092[_0xf74e('0x29')][_0xf74e('0x2a')]};});_0x182070[_0xf74e('0x2b')]=_[_0xf74e('0x26')](_0x4cc2da,_0xf74e('0x23'));_0x182070[_0xf74e('0x2c')]=_[_0xf74e('0x2d')](_0x218d21['query']);_0x182070[_0xf74e('0x2e')]=_['intersection'](_0x182070['model'],_0x182070['query']);_0x461082['attributes']=_['intersection'](_0x182070[_0xf74e('0x2b')],qs[_0xf74e('0x2f')](_0x218d21[_0xf74e('0x2c')][_0xf74e('0x2f')]));_0x461082[_0xf74e('0x30')]=_0x461082[_0xf74e('0x30')]['length']?_0x461082['attributes']:_0x182070['model'];if(!_0x218d21[_0xf74e('0x2c')][_0xf74e('0x31')](_0xf74e('0x32'))){_0x461082['limit']=qs[_0xf74e('0x19')](_0x218d21[_0xf74e('0x2c')][_0xf74e('0x19')]);_0x461082[_0xf74e('0x17')]=qs['offset'](_0x218d21['query'][_0xf74e('0x17')]);}_0x461082[_0xf74e('0x33')]=qs['sort'](_0x218d21[_0xf74e('0x2c')]['sort']);_0x461082['where']=qs[_0xf74e('0x2e')](_[_0xf74e('0x34')](_0x218d21[_0xf74e('0x2c')],_0x182070[_0xf74e('0x2e')]),_0x4cc2da);if(_0x218d21[_0xf74e('0x2c')][_0xf74e('0x35')]){_0x461082[_0xf74e('0x36')]=_[_0xf74e('0x37')](_0x461082[_0xf74e('0x36')],{'$or':_[_0xf74e('0x26')](_0x4cc2da,function(_0x48cf87){if(_0x48cf87['type']!==_0xf74e('0x38')){var _0x355db1={};_0x355db1[_0x48cf87[_0xf74e('0x23')]]={'$like':'%'+_0x218d21[_0xf74e('0x2c')][_0xf74e('0x35')]+'%'};return _0x355db1;}})});}_0x461082=_[_0xf74e('0x37')]({},_0x461082,_0x218d21['options']);var _0x4a310a={'where':_0x461082[_0xf74e('0x36')]};return db['SmsQueueReport'][_0xf74e('0x1a')](_0x4a310a)['then'](function(_0x21e400){_0x1da27d['count']=_0x21e400;if(_0x218d21['query'][_0xf74e('0x39')]){_0x461082['include']=[{'all':!![]}];}return db[_0xf74e('0x27')][_0xf74e('0x3a')](_0x461082);})['then'](function(_0x28ffa6){_0x1da27d[_0xf74e('0x3b')]=_0x28ffa6;return _0x1da27d;})[_0xf74e('0x1f')](respondWithFilteredResult(_0x275804,_0x461082))[_0xf74e('0x3c')](handleError(_0x275804,null));};exports[_0xf74e('0x3d')]=function(_0x1ecc9f,_0x50fd33){var _0x215e86={'raw':!![],'where':{'id':_0x1ecc9f[_0xf74e('0x3e')]['id']}},_0x373ab0={};_0x373ab0[_0xf74e('0x2b')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x373ab0[_0xf74e('0x2c')]=_[_0xf74e('0x2d')](_0x1ecc9f['query']);_0x373ab0['filters']=_['intersection'](_0x373ab0[_0xf74e('0x2b')],_0x373ab0[_0xf74e('0x2c')]);_0x215e86['attributes']=_[_0xf74e('0x3f')](_0x373ab0[_0xf74e('0x2b')],qs[_0xf74e('0x2f')](_0x1ecc9f[_0xf74e('0x2c')][_0xf74e('0x2f')]));_0x215e86[_0xf74e('0x30')]=_0x215e86[_0xf74e('0x30')][_0xf74e('0x40')]?_0x215e86[_0xf74e('0x30')]:_0x373ab0[_0xf74e('0x2b')];if(_0x1ecc9f[_0xf74e('0x2c')][_0xf74e('0x39')]){_0x215e86[_0xf74e('0x41')]=[{'all':!![]}];}_0x215e86=_['merge']({},_0x215e86,_0x1ecc9f[_0xf74e('0x42')]);return db[_0xf74e('0x27')][_0xf74e('0x43')](_0x215e86)[_0xf74e('0x1f')](handleEntityNotFound(_0x50fd33,null))[_0xf74e('0x1f')](respondWithResult(_0x50fd33,null))[_0xf74e('0x3c')](handleError(_0x50fd33,null));};exports[_0xf74e('0x44')]=function(_0x1ffdde,_0x2bbd29){return db[_0xf74e('0x27')]['create'](_0x1ffdde['body'],{})[_0xf74e('0x1f')](respondWithResult(_0x2bbd29,0xc9))[_0xf74e('0x3c')](handleError(_0x2bbd29,null));};exports[_0xf74e('0x45')]=function(_0x69ec22,_0x3ef877){if(_0x69ec22['body']['id']){delete _0x69ec22['body']['id'];}return db[_0xf74e('0x27')][_0xf74e('0x43')]({'where':{'id':_0x69ec22['params']['id']}})[_0xf74e('0x1f')](handleEntityNotFound(_0x3ef877,null))[_0xf74e('0x1f')](saveUpdates(_0x69ec22[_0xf74e('0x46')],null))[_0xf74e('0x1f')](respondWithResult(_0x3ef877,null))[_0xf74e('0x3c')](handleError(_0x3ef877,null));};exports[_0xf74e('0x20')]=function(_0x560280,_0x8e1455){return db['SmsQueueReport'][_0xf74e('0x43')]({'where':{'id':_0x560280[_0xf74e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x8e1455,null))[_0xf74e('0x1f')](removeEntity(_0x8e1455,null))[_0xf74e('0x3c')](handleError(_0x8e1455,null));};exports[_0xf74e('0x47')]=function(_0x43e503,_0x1c5ba9){return db[_0xf74e('0x27')][_0xf74e('0x47')]()[_0xf74e('0x1f')](respondWithResult(_0x1c5ba9,null))[_0xf74e('0x3c')](handleError(_0x1c5ba9,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3c0f705..2693325 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x18bb8a,_0x12dc21){var _0x54a212=function(_0x19d340){while(--_0x19d340){_0x18bb8a['push'](_0x18bb8a['shift']());}};_0x54a212(++_0x12dc21);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xcb91[_0x547456];return _0xc1fd7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x180e11,_0x24bfb8){var _0x330930=function(_0x5be898){while(--_0x5be898){_0x180e11['push'](_0x180e11['shift']());}};_0x330930(++_0x24bfb8);}(_0xe706,0xa3));var _0x6e70=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0xe706[_0x291aaf];return _0x5571e6;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 933074e..d6d70c7 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 _0x9013=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','message','UpdateSmsQueueReport','update','raw','where','lodash','util','moment','bluebird'];(function(_0x438c0e,_0x275ab1){var _0x21c813=function(_0x1756ba){while(--_0x1756ba){_0x438c0e['push'](_0x438c0e['shift']());}};_0x21c813(++_0x275ab1);}(_0x9013,0xec));var _0x3901=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9013[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x3901('0x0'));var util=require(_0x3901('0x1'));var moment=require(_0x3901('0x2'));var BPromise=require(_0x3901('0x3'));var rs=require(_0x3901('0x4'));var fs=require('fs');var Redis=require(_0x3901('0x5'));var db=require(_0x3901('0x6'))['db'];var utils=require(_0x3901('0x7'));var logger=require(_0x3901('0x8'))('rpc');var config=require(_0x3901('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3901('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea69b,_0x11a06d,_0x4dcb47){return new BPromise(function(_0x427913,_0x3e178f){return client['request'](_0x3ea69b,_0x4dcb47)[_0x3901('0xb')](function(_0x163afe){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x11a06d,_0x3901('0xc'));logger[_0x3901('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x11a06d,'request\x20sent',JSON[_0x3901('0xe')](_0x163afe));if(_0x163afe[_0x3901('0xf')]){if(_0x163afe['error'][_0x3901('0x10')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x11a06d,_0x163afe[_0x3901('0xf')]['message']);return _0x3e178f(_0x163afe[_0x3901('0xf')]['message']);}logger[_0x3901('0xf')](_0x3901('0x11'),_0x11a06d,_0x163afe[_0x3901('0xf')]['message']);return _0x427913(_0x163afe[_0x3901('0xf')]['message']);}else{logger[_0x3901('0x12')](_0x3901('0x11'),_0x11a06d,_0x3901('0xc'));_0x427913(_0x163afe[_0x3901('0x13')]['message']);}})[_0x3901('0x14')](function(_0x1fd9f9){logger[_0x3901('0xf')](_0x3901('0x11'),_0x11a06d,_0x1fd9f9);_0x3e178f(_0x1fd9f9);});});}exports[_0x3901('0x15')]=function(_0x4b41af){var _0x3af780=this;return new Promise(function(_0x1a3665,_0x59b248){return db[_0x3901('0x16')][_0x3901('0x17')](_0x4b41af['body'],{'raw':_0x4b41af[_0x3901('0x18')]?_0x4b41af[_0x3901('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3901('0xb')](function(_0xa1b147){logger[_0x3901('0x12')]('CreateSmsQueueReport',_0x4b41af);logger['debug'](_0x3901('0x15'),_0x4b41af,JSON[_0x3901('0xe')](_0xa1b147));_0x1a3665(_0xa1b147);})['catch'](function(_0x576c5c){logger[_0x3901('0xf')](_0x3901('0x15'),_0x576c5c['message'],_0x4b41af);_0x59b248(_0x3af780[_0x3901('0xf')](0x1f4,_0x576c5c[_0x3901('0x19')]));});});};exports[_0x3901('0x1a')]=function(_0x48bab4){var _0x289940=this;return new Promise(function(_0x1e2837,_0x5f1340){return db[_0x3901('0x16')][_0x3901('0x1b')](_0x48bab4['body'],{'raw':_0x48bab4[_0x3901('0x18')]?_0x48bab4[_0x3901('0x18')][_0x3901('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48bab4[_0x3901('0x18')]?_0x48bab4[_0x3901('0x18')][_0x3901('0x1d')]||null:null,'attributes':_0x48bab4['options']?_0x48bab4[_0x3901('0x18')]['attributes']||null:null,'limit':_0x48bab4[_0x3901('0x18')]?_0x48bab4[_0x3901('0x18')]['limit']||null:null})[_0x3901('0xb')](function(_0x54b692){logger[_0x3901('0x12')](_0x3901('0x1a'),_0x48bab4);logger[_0x3901('0xd')](_0x3901('0x1a'),_0x48bab4,JSON['stringify'](_0x54b692));_0x1e2837(_0x54b692);})[_0x3901('0x14')](function(_0x3f03b4){logger[_0x3901('0xf')](_0x3901('0x1a'),_0x3f03b4['message'],_0x48bab4);_0x5f1340(_0x289940['error'](0x1f4,_0x3f03b4[_0x3901('0x19')]));});});}; \ No newline at end of file +var _0xa587=['options','raw','then','info','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SmsQueueReport','create','body'];(function(_0x41b358,_0x563481){var _0x153ba6=function(_0x548d2c){while(--_0x548d2c){_0x41b358['push'](_0x41b358['shift']());}};_0x153ba6(++_0x563481);}(_0xa587,0xf2));var _0x7a58=function(_0xac1a40,_0x2ef17d){_0xac1a40=_0xac1a40-0x0;var _0x4db939=_0xa587[_0xac1a40];return _0x4db939;};'use strict';var _=require('lodash');var util=require(_0x7a58('0x0'));var moment=require(_0x7a58('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a58('0x2'));var fs=require('fs');var Redis=require(_0x7a58('0x3'));var db=require(_0x7a58('0x4'))['db'];var utils=require(_0x7a58('0x5'));var logger=require(_0x7a58('0x6'))(_0x7a58('0x7'));var config=require(_0x7a58('0x8'));var jayson=require(_0x7a58('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40c225,_0x1f9142,_0x2fde8c){return new BPromise(function(_0x5a05f4,_0x3e2992){return client[_0x7a58('0xa')](_0x40c225,_0x2fde8c)['then'](function(_0x4d0b23){logger['info'](_0x7a58('0xb'),_0x1f9142,_0x7a58('0xc'));logger[_0x7a58('0xd')](_0x7a58('0xe'),_0x1f9142,'request\x20sent',JSON['stringify'](_0x4d0b23));if(_0x4d0b23[_0x7a58('0xf')]){if(_0x4d0b23[_0x7a58('0xf')]['code']===0x1f4){logger[_0x7a58('0xf')](_0x7a58('0xb'),_0x1f9142,_0x4d0b23[_0x7a58('0xf')]['message']);return _0x3e2992(_0x4d0b23['error'][_0x7a58('0x10')]);}logger[_0x7a58('0xf')](_0x7a58('0xb'),_0x1f9142,_0x4d0b23[_0x7a58('0xf')][_0x7a58('0x10')]);return _0x5a05f4(_0x4d0b23['error'][_0x7a58('0x10')]);}else{logger['info'](_0x7a58('0xb'),_0x1f9142,_0x7a58('0xc'));_0x5a05f4(_0x4d0b23[_0x7a58('0x11')]['message']);}})[_0x7a58('0x12')](function(_0x4b7fc4){logger[_0x7a58('0xf')](_0x7a58('0xb'),_0x1f9142,_0x4b7fc4);_0x3e2992(_0x4b7fc4);});});}exports['CreateSmsQueueReport']=function(_0x1ab299){var _0x53887e=this;return new Promise(function(_0x370abc,_0x19b8f6){return db[_0x7a58('0x13')][_0x7a58('0x14')](_0x1ab299[_0x7a58('0x15')],{'raw':_0x1ab299[_0x7a58('0x16')]?_0x1ab299[_0x7a58('0x16')][_0x7a58('0x17')]===undefined?!![]:![]:!![]})[_0x7a58('0x18')](function(_0x1d00b0){logger[_0x7a58('0x19')](_0x7a58('0x1a'),_0x1ab299);logger[_0x7a58('0xd')](_0x7a58('0x1a'),_0x1ab299,JSON[_0x7a58('0x1b')](_0x1d00b0));_0x370abc(_0x1d00b0);})[_0x7a58('0x12')](function(_0x1a0fc4){logger[_0x7a58('0xf')](_0x7a58('0x1a'),_0x1a0fc4[_0x7a58('0x10')],_0x1ab299);_0x19b8f6(_0x53887e[_0x7a58('0xf')](0x1f4,_0x1a0fc4[_0x7a58('0x10')]));});});};exports[_0x7a58('0x1c')]=function(_0x108cfb){var _0x5acda3=this;return new Promise(function(_0x5b53c1,_0x195485){return db[_0x7a58('0x13')][_0x7a58('0x1d')](_0x108cfb['body'],{'raw':_0x108cfb[_0x7a58('0x16')]?_0x108cfb[_0x7a58('0x16')][_0x7a58('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108cfb[_0x7a58('0x16')]?_0x108cfb[_0x7a58('0x16')][_0x7a58('0x1e')]||null:null,'attributes':_0x108cfb[_0x7a58('0x16')]?_0x108cfb['options'][_0x7a58('0x1f')]||null:null,'limit':_0x108cfb['options']?_0x108cfb[_0x7a58('0x16')][_0x7a58('0x20')]||null:null})[_0x7a58('0x18')](function(_0x171f2d){logger[_0x7a58('0x19')](_0x7a58('0x1c'),_0x108cfb);logger['debug']('UpdateSmsQueueReport',_0x108cfb,JSON[_0x7a58('0x1b')](_0x171f2d));_0x5b53c1(_0x171f2d);})['catch'](function(_0x5cc563){logger[_0x7a58('0xf')]('UpdateSmsQueueReport',_0x5cc563[_0x7a58('0x10')],_0x108cfb);_0x195485(_0x5acda3[_0x7a58('0xf')](0x1f4,_0x5cc563['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 05f8e3e..34c5327 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 _0x4b1f=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','post'];(function(_0x4853fc,_0x52cd55){var _0x23be73=function(_0x541448){while(--_0x541448){_0x4853fc['push'](_0x4853fc['shift']());}};_0x23be73(++_0x52cd55);}(_0x4b1f,0x195));var _0xf4b1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4b1f[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var path=require('path');var timeout=require(_0xf4b1('0x2'));var express=require(_0xf4b1('0x3'));var router=express[_0xf4b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf4b1('0x5'));var interaction=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x9')]);router[_0xf4b1('0xa')](_0xf4b1('0xb'),auth[_0xf4b1('0x8')](),controller['describe']);router['get']('/:id',auth[_0xf4b1('0x8')](),controller['show']);router[_0xf4b1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf4b1('0xd')](_0xf4b1('0xe'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0xf')]);router[_0xf4b1('0x10')](_0xf4b1('0xe'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x11')]);module[_0xf4b1('0x12')]=router; \ No newline at end of file +var _0xcca7=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0xcca7,0x1aa));var _0x7cca=function(_0x22ada8,_0x23a7ea){_0x22ada8=_0x22ada8-0x0;var _0x506e36=_0xcca7[_0x22ada8];return _0x506e36;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var controller=require(_0x7cca('0x7'));router[_0x7cca('0x8')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xa')]);router['get']('/describe',auth[_0x7cca('0x9')](),controller[_0x7cca('0xb')]);router[_0x7cca('0x8')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller[_0x7cca('0xd')]);router[_0x7cca('0xe')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xf')]);router[_0x7cca('0x10')]('/:id',auth[_0x7cca('0x9')](),controller[_0x7cca('0x11')]);router[_0x7cca('0x12')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller['destroy']);module[_0x7cca('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ebb8119..0050d0f 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x23eda3,_0x4d4bbb){var _0x3ffc87=function(_0xd2e2cb){while(--_0xd2e2cb){_0x23eda3['push'](_0x23eda3['shift']());}};_0x3ffc87(++_0x4d4bbb);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x4b84[_0x2fb87c];return _0x43038b;};'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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x863840,_0x2387fe){var _0x5183b0=function(_0x19a1e5){while(--_0x19a1e5){_0x863840['push'](_0x863840['shift']());}};_0x5183b0(++_0x2387fe);}(_0x54ef,0x112));var _0xf54e=function(_0x430ea8,_0x3aa11e){_0x430ea8=_0x430ea8-0x0;var _0x10de94=_0x54ef[_0x430ea8];return _0x10de94;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e0475e2..eafd2e7 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 _0xfc67=['update','destroy','then','end','name','send','index','map','SmsTransferReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x4c458b,_0x3aeb48){var _0x338f8c=function(_0x31bdc0){while(--_0x31bdc0){_0x4c458b['push'](_0x4c458b['shift']());}};_0x338f8c(++_0x3aeb48);}(_0xfc67,0x101));var _0x7fc6=function(_0x503055,_0x304102){_0x503055=_0x503055-0x0;var _0x30fb63=_0xfc67[_0x503055];return _0x30fb63;};'use strict';var emlformat=require(_0x7fc6('0x0'));var rimraf=require(_0x7fc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fc6('0x2'));var rp=require(_0x7fc6('0x3'));var moment=require(_0x7fc6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7fc6('0x5'));var util=require(_0x7fc6('0x6'));var path=require('path');var sox=require(_0x7fc6('0x7'));var csv=require(_0x7fc6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fc6('0x9'));var _=require(_0x7fc6('0xa'));var squel=require(_0x7fc6('0xb'));var crypto=require(_0x7fc6('0xc'));var jsforce=require(_0x7fc6('0xd'));var deskjs=require(_0x7fc6('0xe'));var toCsv=require(_0x7fc6('0x8'));var querystring=require(_0x7fc6('0xf'));var Papa=require(_0x7fc6('0x10'));var Redis=require(_0x7fc6('0x11'));var authService=require(_0x7fc6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fc6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fc6('0x14'));var utils=require(_0x7fc6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7fc6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4335e2,_0x42213a){_0x42213a=_0x42213a||0xcc;return function(_0x40a8c3){if(_0x40a8c3){return _0x4335e2[_0x7fc6('0x17')](_0x42213a);}return _0x4335e2['status'](_0x42213a)['end']();};}function respondWithResult(_0x1a5d58,_0x2e6746){_0x2e6746=_0x2e6746||0xc8;return function(_0x588f3c){if(_0x588f3c){return _0x1a5d58[_0x7fc6('0x18')](_0x2e6746)['json'](_0x588f3c);}};}function respondWithFilteredResult(_0x3be0f9,_0x28bf34){return function(_0x5d3f81){if(_0x5d3f81){var _0x41932c=typeof _0x28bf34[_0x7fc6('0x19')]===_0x7fc6('0x1a')&&typeof _0x28bf34[_0x7fc6('0x1b')]===_0x7fc6('0x1a');var _0x65f399=_0x5d3f81[_0x7fc6('0x1c')];var _0x2a8268=_0x41932c?0x0:_0x28bf34[_0x7fc6('0x19')];var _0x2e3adc=_0x41932c?_0x5d3f81[_0x7fc6('0x1c')]:_0x28bf34[_0x7fc6('0x19')]+_0x28bf34[_0x7fc6('0x1b')];var _0x296791;if(_0x2e3adc>=_0x65f399){_0x2e3adc=_0x65f399;_0x296791=0xc8;}else{_0x296791=0xce;}_0x3be0f9[_0x7fc6('0x18')](_0x296791);return _0x3be0f9[_0x7fc6('0x1d')](_0x7fc6('0x1e'),_0x2a8268+'-'+_0x2e3adc+'/'+_0x65f399)[_0x7fc6('0x1f')](_0x5d3f81);}return null;};}function patchUpdates(_0x522922){return function(_0x1bb8da){try{jsonpatch[_0x7fc6('0x20')](_0x1bb8da,_0x522922,!![]);}catch(_0x3ecd91){return BPromise[_0x7fc6('0x21')](_0x3ecd91);}return _0x1bb8da[_0x7fc6('0x22')]();};}function saveUpdates(_0x216a66,_0x17818a){return function(_0x1db9c0){if(_0x1db9c0){return _0x1db9c0[_0x7fc6('0x23')](_0x216a66)['then'](function(_0x13603a){return _0x13603a;});}return null;};}function removeEntity(_0x3fc9b9,_0x224100){return function(_0x45df36){if(_0x45df36){return _0x45df36[_0x7fc6('0x24')]()[_0x7fc6('0x25')](function(){_0x3fc9b9[_0x7fc6('0x18')](0xcc)[_0x7fc6('0x26')]();});}};}function handleEntityNotFound(_0x2d3c79,_0x10bd55){return function(_0x4ad281){if(!_0x4ad281){_0x2d3c79[_0x7fc6('0x17')](0x194);}return _0x4ad281;};}function handleError(_0xde752c,_0x419f0f){_0x419f0f=_0x419f0f||0x1f4;return function(_0x33b850){logger['error'](_0x33b850['stack']);if(_0x33b850[_0x7fc6('0x27')]){delete _0x33b850[_0x7fc6('0x27')];}_0xde752c['status'](_0x419f0f)[_0x7fc6('0x28')](_0x33b850);};}exports[_0x7fc6('0x29')]=function(_0x12c2d3,_0x4bfe88){var _0x20989d={},_0x3b021f={},_0x3a7e2e={'count':0x0,'rows':[]};var _0xc8bb81=_[_0x7fc6('0x2a')](db[_0x7fc6('0x2b')][_0x7fc6('0x2c')],function(_0x412099){return{'name':_0x412099['fieldName'],'type':_0x412099[_0x7fc6('0x2d')]['key']};});_0x3b021f['model']=_[_0x7fc6('0x2a')](_0xc8bb81,_0x7fc6('0x27'));_0x3b021f[_0x7fc6('0x2e')]=_[_0x7fc6('0x2f')](_0x12c2d3[_0x7fc6('0x2e')]);_0x3b021f[_0x7fc6('0x30')]=_[_0x7fc6('0x31')](_0x3b021f[_0x7fc6('0x32')],_0x3b021f[_0x7fc6('0x2e')]);_0x20989d['attributes']=_['intersection'](_0x3b021f[_0x7fc6('0x32')],qs[_0x7fc6('0x33')](_0x12c2d3[_0x7fc6('0x2e')][_0x7fc6('0x33')]));_0x20989d[_0x7fc6('0x34')]=_0x20989d[_0x7fc6('0x34')]['length']?_0x20989d[_0x7fc6('0x34')]:_0x3b021f[_0x7fc6('0x32')];if(!_0x12c2d3[_0x7fc6('0x2e')][_0x7fc6('0x35')](_0x7fc6('0x36'))){_0x20989d['limit']=qs[_0x7fc6('0x1b')](_0x12c2d3[_0x7fc6('0x2e')]['limit']);_0x20989d[_0x7fc6('0x19')]=qs[_0x7fc6('0x19')](_0x12c2d3[_0x7fc6('0x2e')]['offset']);}_0x20989d[_0x7fc6('0x37')]=qs[_0x7fc6('0x38')](_0x12c2d3[_0x7fc6('0x2e')][_0x7fc6('0x38')]);_0x20989d['where']=qs[_0x7fc6('0x30')](_['pick'](_0x12c2d3[_0x7fc6('0x2e')],_0x3b021f['filters']),_0xc8bb81);if(_0x12c2d3['query'][_0x7fc6('0x39')]){_0x20989d[_0x7fc6('0x3a')]=_['merge'](_0x20989d[_0x7fc6('0x3a')],{'$or':_[_0x7fc6('0x2a')](_0xc8bb81,function(_0x235ea2){if(_0x235ea2[_0x7fc6('0x2d')]!==_0x7fc6('0x3b')){var _0x3ef321={};_0x3ef321[_0x235ea2[_0x7fc6('0x27')]]={'$like':'%'+_0x12c2d3['query']['filter']+'%'};return _0x3ef321;}})});}_0x20989d=_[_0x7fc6('0x3c')]({},_0x20989d,_0x12c2d3[_0x7fc6('0x3d')]);var _0xb6106f={'where':_0x20989d[_0x7fc6('0x3a')]};return db[_0x7fc6('0x2b')][_0x7fc6('0x1c')](_0xb6106f)['then'](function(_0x58fa4b){_0x3a7e2e[_0x7fc6('0x1c')]=_0x58fa4b;if(_0x12c2d3['query'][_0x7fc6('0x3e')]){_0x20989d[_0x7fc6('0x3f')]=[{'all':!![]}];}return db[_0x7fc6('0x2b')][_0x7fc6('0x40')](_0x20989d);})['then'](function(_0x28a350){_0x3a7e2e['rows']=_0x28a350;return _0x3a7e2e;})[_0x7fc6('0x25')](respondWithFilteredResult(_0x4bfe88,_0x20989d))['catch'](handleError(_0x4bfe88,null));};exports[_0x7fc6('0x41')]=function(_0x52daa1,_0x14324e){var _0x278678={'raw':!![],'where':{'id':_0x52daa1[_0x7fc6('0x42')]['id']}},_0x563dfd={};_0x563dfd[_0x7fc6('0x32')]=_[_0x7fc6('0x2f')](db['SmsTransferReport']['rawAttributes']);_0x563dfd['query']=_[_0x7fc6('0x2f')](_0x52daa1[_0x7fc6('0x2e')]);_0x563dfd[_0x7fc6('0x30')]=_[_0x7fc6('0x31')](_0x563dfd[_0x7fc6('0x32')],_0x563dfd[_0x7fc6('0x2e')]);_0x278678[_0x7fc6('0x34')]=_[_0x7fc6('0x31')](_0x563dfd[_0x7fc6('0x32')],qs[_0x7fc6('0x33')](_0x52daa1[_0x7fc6('0x2e')][_0x7fc6('0x33')]));_0x278678[_0x7fc6('0x34')]=_0x278678[_0x7fc6('0x34')][_0x7fc6('0x43')]?_0x278678['attributes']:_0x563dfd[_0x7fc6('0x32')];if(_0x52daa1[_0x7fc6('0x2e')][_0x7fc6('0x3e')]){_0x278678[_0x7fc6('0x3f')]=[{'all':!![]}];}_0x278678=_[_0x7fc6('0x3c')]({},_0x278678,_0x52daa1[_0x7fc6('0x3d')]);return db['SmsTransferReport'][_0x7fc6('0x44')](_0x278678)[_0x7fc6('0x25')](handleEntityNotFound(_0x14324e,null))['then'](respondWithResult(_0x14324e,null))[_0x7fc6('0x45')](handleError(_0x14324e,null));};exports['create']=function(_0x563a75,_0x4e4647){return db[_0x7fc6('0x2b')][_0x7fc6('0x46')](_0x563a75[_0x7fc6('0x47')],{})[_0x7fc6('0x25')](respondWithResult(_0x4e4647,0xc9))['catch'](handleError(_0x4e4647,null));};exports[_0x7fc6('0x23')]=function(_0x46c0e7,_0x29d9e5){if(_0x46c0e7[_0x7fc6('0x47')]['id']){delete _0x46c0e7[_0x7fc6('0x47')]['id'];}return db[_0x7fc6('0x2b')][_0x7fc6('0x44')]({'where':{'id':_0x46c0e7[_0x7fc6('0x42')]['id']}})['then'](handleEntityNotFound(_0x29d9e5,null))[_0x7fc6('0x25')](saveUpdates(_0x46c0e7['body'],null))[_0x7fc6('0x25')](respondWithResult(_0x29d9e5,null))['catch'](handleError(_0x29d9e5,null));};exports[_0x7fc6('0x24')]=function(_0x1ad818,_0x4a2ceb){return db[_0x7fc6('0x2b')][_0x7fc6('0x44')]({'where':{'id':_0x1ad818['params']['id']}})[_0x7fc6('0x25')](handleEntityNotFound(_0x4a2ceb,null))[_0x7fc6('0x25')](removeEntity(_0x4a2ceb,null))['catch'](handleError(_0x4a2ceb,null));};exports[_0x7fc6('0x48')]=function(_0x714af3,_0x50ca54){return db[_0x7fc6('0x2b')][_0x7fc6('0x48')]()[_0x7fc6('0x25')](respondWithResult(_0x50ca54,null))[_0x7fc6('0x45')](handleError(_0x50ca54,null));}; \ No newline at end of file +var _0x13d4=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','type','key','model','query'];(function(_0x4b1775,_0xba4c2){var _0x84ff70=function(_0x4de0e6){while(--_0x4de0e6){_0x4b1775['push'](_0x4b1775['shift']());}};_0x84ff70(++_0xba4c2);}(_0x13d4,0x1ca));var _0x413d=function(_0x338ef4,_0x68c766){_0x338ef4=_0x338ef4-0x0;var _0x344c9e=_0x13d4[_0x338ef4];return _0x344c9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x413d('0x0'));var zipdir=require(_0x413d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x413d('0x2'));var moment=require(_0x413d('0x3'));var BPromise=require(_0x413d('0x4'));var Mustache=require('mustache');var util=require(_0x413d('0x5'));var path=require(_0x413d('0x6'));var sox=require(_0x413d('0x7'));var csv=require(_0x413d('0x8'));var ejs=require(_0x413d('0x9'));var fs=require('fs');var fs_extra=require(_0x413d('0xa'));var _=require(_0x413d('0xb'));var squel=require('squel');var crypto=require(_0x413d('0xc'));var jsforce=require(_0x413d('0xd'));var deskjs=require(_0x413d('0xe'));var toCsv=require(_0x413d('0x8'));var querystring=require(_0x413d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x413d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x413d('0x11'))('api');var utils=require(_0x413d('0x12'));var config=require(_0x413d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x413d('0x14'))['db'];function respondWithStatusCode(_0x56a0d2,_0x27ce0c){_0x27ce0c=_0x27ce0c||0xcc;return function(_0x3315dc){if(_0x3315dc){return _0x56a0d2[_0x413d('0x15')](_0x27ce0c);}return _0x56a0d2[_0x413d('0x16')](_0x27ce0c)[_0x413d('0x17')]();};}function respondWithResult(_0x415a94,_0x454070){_0x454070=_0x454070||0xc8;return function(_0x2bcaff){if(_0x2bcaff){return _0x415a94['status'](_0x454070)[_0x413d('0x18')](_0x2bcaff);}};}function respondWithFilteredResult(_0x286659,_0x168602){return function(_0x388b4f){if(_0x388b4f){var _0xb413c=typeof _0x168602[_0x413d('0x19')]==='undefined'&&typeof _0x168602['limit']===_0x413d('0x1a');var _0x4c0636=_0x388b4f[_0x413d('0x1b')];var _0xfe22f9=_0xb413c?0x0:_0x168602[_0x413d('0x19')];var _0x53a28c=_0xb413c?_0x388b4f[_0x413d('0x1b')]:_0x168602['offset']+_0x168602[_0x413d('0x1c')];var _0xa51208;if(_0x53a28c>=_0x4c0636){_0x53a28c=_0x4c0636;_0xa51208=0xc8;}else{_0xa51208=0xce;}_0x286659['status'](_0xa51208);return _0x286659['set'](_0x413d('0x1d'),_0xfe22f9+'-'+_0x53a28c+'/'+_0x4c0636)[_0x413d('0x18')](_0x388b4f);}return null;};}function patchUpdates(_0x1568d4){return function(_0x524eb0){try{jsonpatch[_0x413d('0x1e')](_0x524eb0,_0x1568d4,!![]);}catch(_0x5e305d){return BPromise[_0x413d('0x1f')](_0x5e305d);}return _0x524eb0[_0x413d('0x20')]();};}function saveUpdates(_0x2e4ccb,_0xd1e17e){return function(_0x245cc1){if(_0x245cc1){return _0x245cc1[_0x413d('0x21')](_0x2e4ccb)[_0x413d('0x22')](function(_0x3b4eb3){return _0x3b4eb3;});}return null;};}function removeEntity(_0x5c727b,_0x568300){return function(_0x2ab85b){if(_0x2ab85b){return _0x2ab85b[_0x413d('0x23')]()[_0x413d('0x22')](function(){_0x5c727b['status'](0xcc)[_0x413d('0x17')]();});}};}function handleEntityNotFound(_0x313967,_0x17f8d3){return function(_0x575db3){if(!_0x575db3){_0x313967[_0x413d('0x15')](0x194);}return _0x575db3;};}function handleError(_0x49428e,_0x2c7385){_0x2c7385=_0x2c7385||0x1f4;return function(_0x1abf03){logger[_0x413d('0x24')](_0x1abf03[_0x413d('0x25')]);if(_0x1abf03['name']){delete _0x1abf03[_0x413d('0x26')];}_0x49428e[_0x413d('0x16')](_0x2c7385)['send'](_0x1abf03);};}exports[_0x413d('0x27')]=function(_0x312938,_0x4eb51e){var _0x3eccdf={},_0x38f9c4={},_0x59303c={'count':0x0,'rows':[]};var _0x3ac9f1=_[_0x413d('0x28')](db[_0x413d('0x29')]['rawAttributes'],function(_0x56d8e1){return{'name':_0x56d8e1['fieldName'],'type':_0x56d8e1[_0x413d('0x2a')][_0x413d('0x2b')]};});_0x38f9c4[_0x413d('0x2c')]=_[_0x413d('0x28')](_0x3ac9f1,'name');_0x38f9c4[_0x413d('0x2d')]=_['keys'](_0x312938[_0x413d('0x2d')]);_0x38f9c4[_0x413d('0x2e')]=_[_0x413d('0x2f')](_0x38f9c4[_0x413d('0x2c')],_0x38f9c4['query']);_0x3eccdf[_0x413d('0x30')]=_[_0x413d('0x2f')](_0x38f9c4[_0x413d('0x2c')],qs['fields'](_0x312938[_0x413d('0x2d')][_0x413d('0x31')]));_0x3eccdf[_0x413d('0x30')]=_0x3eccdf['attributes']['length']?_0x3eccdf['attributes']:_0x38f9c4[_0x413d('0x2c')];if(!_0x312938[_0x413d('0x2d')][_0x413d('0x32')](_0x413d('0x33'))){_0x3eccdf[_0x413d('0x1c')]=qs[_0x413d('0x1c')](_0x312938[_0x413d('0x2d')][_0x413d('0x1c')]);_0x3eccdf[_0x413d('0x19')]=qs[_0x413d('0x19')](_0x312938[_0x413d('0x2d')][_0x413d('0x19')]);}_0x3eccdf[_0x413d('0x34')]=qs[_0x413d('0x35')](_0x312938[_0x413d('0x2d')][_0x413d('0x35')]);_0x3eccdf[_0x413d('0x36')]=qs[_0x413d('0x2e')](_['pick'](_0x312938['query'],_0x38f9c4[_0x413d('0x2e')]),_0x3ac9f1);if(_0x312938[_0x413d('0x2d')][_0x413d('0x37')]){_0x3eccdf[_0x413d('0x36')]=_[_0x413d('0x38')](_0x3eccdf['where'],{'$or':_['map'](_0x3ac9f1,function(_0x39f9f1){if(_0x39f9f1[_0x413d('0x2a')]!==_0x413d('0x39')){var _0x3ae560={};_0x3ae560[_0x39f9f1[_0x413d('0x26')]]={'$like':'%'+_0x312938[_0x413d('0x2d')][_0x413d('0x37')]+'%'};return _0x3ae560;}})});}_0x3eccdf=_[_0x413d('0x38')]({},_0x3eccdf,_0x312938[_0x413d('0x3a')]);var _0x55ba2a={'where':_0x3eccdf[_0x413d('0x36')]};return db['SmsTransferReport'][_0x413d('0x1b')](_0x55ba2a)[_0x413d('0x22')](function(_0x5b43a2){_0x59303c[_0x413d('0x1b')]=_0x5b43a2;if(_0x312938[_0x413d('0x2d')][_0x413d('0x3b')]){_0x3eccdf['include']=[{'all':!![]}];}return db[_0x413d('0x29')][_0x413d('0x3c')](_0x3eccdf);})[_0x413d('0x22')](function(_0x4c260f){_0x59303c[_0x413d('0x3d')]=_0x4c260f;return _0x59303c;})[_0x413d('0x22')](respondWithFilteredResult(_0x4eb51e,_0x3eccdf))[_0x413d('0x3e')](handleError(_0x4eb51e,null));};exports[_0x413d('0x3f')]=function(_0x239280,_0x3e3175){var _0x517662={'raw':!![],'where':{'id':_0x239280[_0x413d('0x40')]['id']}},_0x513610={};_0x513610[_0x413d('0x2c')]=_[_0x413d('0x41')](db['SmsTransferReport'][_0x413d('0x42')]);_0x513610[_0x413d('0x2d')]=_[_0x413d('0x41')](_0x239280[_0x413d('0x2d')]);_0x513610[_0x413d('0x2e')]=_['intersection'](_0x513610[_0x413d('0x2c')],_0x513610[_0x413d('0x2d')]);_0x517662['attributes']=_['intersection'](_0x513610[_0x413d('0x2c')],qs[_0x413d('0x31')](_0x239280[_0x413d('0x2d')][_0x413d('0x31')]));_0x517662[_0x413d('0x30')]=_0x517662['attributes'][_0x413d('0x43')]?_0x517662[_0x413d('0x30')]:_0x513610[_0x413d('0x2c')];if(_0x239280[_0x413d('0x2d')][_0x413d('0x3b')]){_0x517662['include']=[{'all':!![]}];}_0x517662=_['merge']({},_0x517662,_0x239280[_0x413d('0x3a')]);return db[_0x413d('0x29')][_0x413d('0x44')](_0x517662)[_0x413d('0x22')](handleEntityNotFound(_0x3e3175,null))[_0x413d('0x22')](respondWithResult(_0x3e3175,null))['catch'](handleError(_0x3e3175,null));};exports[_0x413d('0x45')]=function(_0x4c1652,_0x4c7795){return db[_0x413d('0x29')]['create'](_0x4c1652[_0x413d('0x46')],{})['then'](respondWithResult(_0x4c7795,0xc9))[_0x413d('0x3e')](handleError(_0x4c7795,null));};exports[_0x413d('0x21')]=function(_0x5546d1,_0x462ec5){if(_0x5546d1[_0x413d('0x46')]['id']){delete _0x5546d1[_0x413d('0x46')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x5546d1[_0x413d('0x40')]['id']}})[_0x413d('0x22')](handleEntityNotFound(_0x462ec5,null))['then'](saveUpdates(_0x5546d1[_0x413d('0x46')],null))[_0x413d('0x22')](respondWithResult(_0x462ec5,null))[_0x413d('0x3e')](handleError(_0x462ec5,null));};exports[_0x413d('0x23')]=function(_0x5bd317,_0x5eea62){return db[_0x413d('0x29')]['find']({'where':{'id':_0x5bd317[_0x413d('0x40')]['id']}})[_0x413d('0x22')](handleEntityNotFound(_0x5eea62,null))[_0x413d('0x22')](removeEntity(_0x5eea62,null))[_0x413d('0x3e')](handleError(_0x5eea62,null));};exports[_0x413d('0x47')]=function(_0x2b6c5c,_0x2c30ac){return db['SmsTransferReport'][_0x413d('0x47')]()[_0x413d('0x22')](respondWithResult(_0x2c30ac,null))[_0x413d('0x3e')](handleError(_0x2c30ac,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ef1c2c3..2c4e87f 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 _0x3edb=['request-promise','rimraf','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3edb,0x1c9));var _0xb3ed=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3edb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb3ed('0x0'));var util=require(_0xb3ed('0x1'));var logger=require('../../config/logger')(_0xb3ed('0x2'));var moment=require(_0xb3ed('0x3'));var BPromise=require(_0xb3ed('0x4'));var rp=require(_0xb3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3ed('0x6'));var config=require('../../config/environment');var attributes=require(_0xb3ed('0x7'));module['exports']=function(_0xa51c35,_0x28a1c6){return _0xa51c35[_0xb3ed('0x8')]('SmsTransferReport',attributes,{'tableName':_0xb3ed('0x9'),'paranoid':![],'indexes':[{'name':_0xb3ed('0xa'),'fields':[_0xb3ed('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5bc=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid'];(function(_0x5ba15b,_0x540288){var _0x2bfd59=function(_0x12c1a0){while(--_0x12c1a0){_0x5ba15b['push'](_0x5ba15b['shift']());}};_0x2bfd59(++_0x540288);}(_0xe5bc,0x8c));var _0xce5b=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0xe5bc[_0x18b344];return _0x5ef6bb;};'use strict';var _=require(_0xce5b('0x0'));var util=require(_0xce5b('0x1'));var logger=require(_0xce5b('0x2'))(_0xce5b('0x3'));var moment=require(_0xce5b('0x4'));var BPromise=require(_0xce5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce5b('0x6'));var rimraf=require(_0xce5b('0x7'));var config=require(_0xce5b('0x8'));var attributes=require(_0xce5b('0x9'));module[_0xce5b('0xa')]=function(_0x2d890c,_0x59ed4f){return _0x2d890c[_0xce5b('0xb')]('SmsTransferReport',attributes,{'tableName':_0xce5b('0xc'),'paranoid':![],'indexes':[{'name':_0xce5b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f692d98..178786d 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 _0x1782=['http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsTransferReport,\x20%s,\x20%s','result','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x14596d,_0x1a4568){var _0x55696a=function(_0x103e27){while(--_0x103e27){_0x14596d['push'](_0x14596d['shift']());}};_0x55696a(++_0x1a4568);}(_0x1782,0x188));var _0x2178=function(_0x542feb,_0x339f5a){_0x542feb=_0x542feb-0x0;var _0x5a1ff9=_0x1782[_0x542feb];return _0x5a1ff9;};'use strict';var _=require('lodash');var util=require(_0x2178('0x0'));var moment=require(_0x2178('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2178('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2178('0x3'));var logger=require(_0x2178('0x4'))('rpc');var config=require(_0x2178('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2178('0x6')][_0x2178('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x374bf8,_0x58aa47,_0x483397){return new BPromise(function(_0x35c8a8,_0x249977){return client[_0x2178('0x8')](_0x374bf8,_0x483397)[_0x2178('0x9')](function(_0x15ba49){logger[_0x2178('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x58aa47,_0x2178('0xb'));logger[_0x2178('0xc')](_0x2178('0xd'),_0x58aa47,'request\x20sent',JSON[_0x2178('0xe')](_0x15ba49));if(_0x15ba49[_0x2178('0xf')]){if(_0x15ba49[_0x2178('0xf')]['code']===0x1f4){logger[_0x2178('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x58aa47,_0x15ba49[_0x2178('0xf')][_0x2178('0x10')]);return _0x249977(_0x15ba49[_0x2178('0xf')][_0x2178('0x10')]);}logger[_0x2178('0xf')](_0x2178('0x11'),_0x58aa47,_0x15ba49[_0x2178('0xf')]['message']);return _0x35c8a8(_0x15ba49[_0x2178('0xf')][_0x2178('0x10')]);}else{logger[_0x2178('0xa')](_0x2178('0x11'),_0x58aa47,_0x2178('0xb'));_0x35c8a8(_0x15ba49[_0x2178('0x12')][_0x2178('0x10')]);}})['catch'](function(_0xc75c80){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x58aa47,_0xc75c80);_0x249977(_0xc75c80);});});} \ No newline at end of file +var _0x294b=['jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5a28ed,_0x2bcf10){var _0x4d4f6a=function(_0x25c1e1){while(--_0x25c1e1){_0x5a28ed['push'](_0x5a28ed['shift']());}};_0x4d4f6a(++_0x2bcf10);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var moment=require(_0xb294('0x1'));var BPromise=require(_0xb294('0x2'));var rs=require(_0xb294('0x3'));var fs=require('fs');var Redis=require(_0xb294('0x4'));var db=require(_0xb294('0x5'))['db'];var utils=require(_0xb294('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb294('0x7'));var jayson=require(_0xb294('0x8'));var client=jayson[_0xb294('0x9')][_0xb294('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcc7910,_0x509dbd,_0x39dfbf){return new BPromise(function(_0x5110aa,_0x5226a4){return client['request'](_0xcc7910,_0x39dfbf)[_0xb294('0xb')](function(_0x33f8e5){logger[_0xb294('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x509dbd,'request\x20sent');logger['debug'](_0xb294('0xd'),_0x509dbd,_0xb294('0xe'),JSON[_0xb294('0xf')](_0x33f8e5));if(_0x33f8e5[_0xb294('0x10')]){if(_0x33f8e5[_0xb294('0x10')][_0xb294('0x11')]===0x1f4){logger[_0xb294('0x10')](_0xb294('0x12'),_0x509dbd,_0x33f8e5[_0xb294('0x10')][_0xb294('0x13')]);return _0x5226a4(_0x33f8e5['error']['message']);}logger[_0xb294('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x509dbd,_0x33f8e5['error'][_0xb294('0x13')]);return _0x5110aa(_0x33f8e5[_0xb294('0x10')][_0xb294('0x13')]);}else{logger[_0xb294('0xc')](_0xb294('0x12'),_0x509dbd,_0xb294('0xe'));_0x5110aa(_0x33f8e5[_0xb294('0x14')][_0xb294('0x13')]);}})[_0xb294('0x15')](function(_0x289839){logger[_0xb294('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x509dbd,_0x289839);_0x5226a4(_0x289839);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 19a4335..9f00fd3 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 _0x226c=['now','post','single','file','create','put','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','root','originalname','replace','%s-%s%s','basename','extname'];(function(_0x317cc3,_0x319661){var _0x329b98=function(_0x14dd2f){while(--_0x14dd2f){_0x317cc3['push'](_0x317cc3['shift']());}};_0x329b98(++_0x319661);}(_0x226c,0x1cb));var _0xc226=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x226c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc226('0x0'));var util=require(_0xc226('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc226('0x2'));var router=express['Router']();var fs_extra=require(_0xc226('0x3'));var auth=require(_0xc226('0x4'));var interaction=require(_0xc226('0x5'));var config=require(_0xc226('0x6'));var controller=require(_0xc226('0x7'));router[_0xc226('0x8')]('/',auth[_0xc226('0x9')](),controller['index']);router[_0xc226('0x8')](_0xc226('0xa'),auth[_0xc226('0x9')](),controller[_0xc226('0xb')]);router[_0xc226('0x8')](_0xc226('0xc'),auth[_0xc226('0x9')](),controller[_0xc226('0xd')]);var upload=multer({'storage':multer[_0xc226('0xe')]({'destination':function(_0x5bc659,_0x72dcd7,_0x58e74b){_0x58e74b(null,path['join'](config[_0xc226('0xf')],'server/files/sounds/original/'));},'filename':function(_0x5906f6,_0x158e25,_0x52fcb2){_0x158e25['originalname']=_0x158e25[_0xc226('0x10')][_0xc226('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52fcb2(null,util['format'](_0xc226('0x12'),path[_0xc226('0x13')](_0x158e25[_0xc226('0x10')],path[_0xc226('0x14')](_0x158e25[_0xc226('0x10')])),Date[_0xc226('0x15')](),path[_0xc226('0x14')](_0x158e25[_0xc226('0x10')])));}})});router[_0xc226('0x16')]('/',upload[_0xc226('0x17')](_0xc226('0x18')),controller[_0xc226('0x19')]);router[_0xc226('0x1a')](_0xc226('0xa'),auth['isAuthenticated'](),controller[_0xc226('0x1b')]);router[_0xc226('0x1c')](_0xc226('0xa'),auth['isAuthenticated'](),controller[_0xc226('0x1c')]);module[_0xc226('0x1d')]=router; \ No newline at end of file +var _0x8473=['/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','file','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1438e6,_0x4dac7f){var _0x5f109e=function(_0x34c361){while(--_0x34c361){_0x1438e6['push'](_0x1438e6['shift']());}};_0x5f109e(++_0x4dac7f);}(_0x8473,0xcc));var _0x3847=function(_0x39c28a,_0x5cfaf2){_0x39c28a=_0x39c28a-0x0;var _0x2f3ec4=_0x8473[_0x39c28a];return _0x2f3ec4;};'use strict';var multer=require('multer');var util=require(_0x3847('0x0'));var path=require(_0x3847('0x1'));var timeout=require(_0x3847('0x2'));var express=require(_0x3847('0x3'));var router=express[_0x3847('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3847('0x5'));var interaction=require(_0x3847('0x6'));var config=require('../../config/environment');var controller=require(_0x3847('0x7'));router[_0x3847('0x8')]('/',auth[_0x3847('0x9')](),controller[_0x3847('0xa')]);router['get'](_0x3847('0xb'),auth[_0x3847('0x9')](),controller[_0x3847('0xc')]);router[_0x3847('0x8')](_0x3847('0xd'),auth[_0x3847('0x9')](),controller[_0x3847('0xe')]);var upload=multer({'storage':multer[_0x3847('0xf')]({'destination':function(_0x4b89cb,_0x58b3be,_0x4bee15){_0x4bee15(null,path['join'](config[_0x3847('0x10')],_0x3847('0x11')));},'filename':function(_0x47446f,_0x278299,_0x4c125a){_0x278299[_0x3847('0x12')]=_0x278299[_0x3847('0x12')][_0x3847('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c125a(null,util[_0x3847('0x14')](_0x3847('0x15'),path['basename'](_0x278299[_0x3847('0x12')],path[_0x3847('0x16')](_0x278299['originalname'])),Date[_0x3847('0x17')](),path[_0x3847('0x16')](_0x278299['originalname'])));}})});router[_0x3847('0x18')]('/',upload['single'](_0x3847('0x19')),controller[_0x3847('0x1a')]);router[_0x3847('0x1b')](_0x3847('0xb'),auth['isAuthenticated'](),controller[_0x3847('0x1c')]);router[_0x3847('0x1d')](_0x3847('0xb'),auth[_0x3847('0x9')](),controller['delete']);module[_0x3847('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 95c75da..168b733 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 _0xd431=['BIGINT','INTEGER','STRING','FLOAT'];(function(_0x45c791,_0x2cf7be){var _0xd03894=function(_0x4fa25d){while(--_0x4fa25d){_0x45c791['push'](_0x45c791['shift']());}};_0xd03894(++_0x2cf7be);}(_0xd431,0x1b6));var _0x1d43=function(_0x2c823e,_0x1067c9){_0x2c823e=_0x2c823e-0x0;var _0x21b297=_0xd431[_0x2c823e];return _0x21b297;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1d43('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1d43('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x1d43('0x0')]},'original_duration':{'type':Sequelize[_0x1d43('0x1')]},'original_sampleCount':{'type':Sequelize[_0x1d43('0x2')]},'original_channelCount':{'type':Sequelize[_0x1d43('0x3')]},'original_bitRate':{'type':Sequelize[_0x1d43('0x2')]},'original_sampleRate':{'type':Sequelize[_0x1d43('0x3')]},'converted_format':{'type':Sequelize[_0x1d43('0x0')]},'converted_duration':{'type':Sequelize[_0x1d43('0x1')]},'converted_sampleCount':{'type':Sequelize[_0x1d43('0x2')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1d43('0x3')]}}; \ No newline at end of file +var _0x914b=['exports','name','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x914b,0x1bf));var _0xb914=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x914b[_0xea6018];return _0x57b54d;};'use strict';var Sequelize=require(_0xb914('0x0'));module[_0xb914('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb914('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb914('0x3')]},'display_name':{'type':Sequelize[_0xb914('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xb914('0x3')]},'original_format':{'type':Sequelize[_0xb914('0x3')]},'original_duration':{'type':Sequelize[_0xb914('0x4')]},'original_sampleCount':{'type':Sequelize[_0xb914('0x5')]},'original_channelCount':{'type':Sequelize[_0xb914('0x6')]},'original_bitRate':{'type':Sequelize[_0xb914('0x5')]},'original_sampleRate':{'type':Sequelize[_0xb914('0x6')]},'converted_format':{'type':Sequelize[_0xb914('0x3')]},'converted_duration':{'type':Sequelize[_0xb914('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xb914('0x6')]},'converted_bitRate':{'type':Sequelize[_0xb914('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 f40102f..b1997a0 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 _0x9167=['reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','%s.%s','format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','description','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','apply'];(function(_0x350748,_0x1f937c){var _0x154a6d=function(_0x488378){while(--_0x488378){_0x350748['push'](_0x350748['shift']());}};_0x154a6d(++_0x1f937c);}(_0x9167,0x1cb));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7916('0x0'));var zipdir=require(_0x7916('0x1'));var jsonpatch=require(_0x7916('0x2'));var rp=require(_0x7916('0x3'));var moment=require(_0x7916('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7916('0x5'));var util=require(_0x7916('0x6'));var path=require(_0x7916('0x7'));var sox=require(_0x7916('0x8'));var csv=require(_0x7916('0x9'));var ejs=require(_0x7916('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7916('0xb'));var squel=require(_0x7916('0xc'));var crypto=require(_0x7916('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7916('0xe'));var Redis=require('ioredis');var authService=require(_0x7916('0xf'));var qs=require(_0x7916('0x10'));var as=require(_0x7916('0x11'));var hardwareService=require(_0x7916('0x12'));var logger=require(_0x7916('0x13'))('api');var utils=require(_0x7916('0x14'));var config=require(_0x7916('0x15'));var licenseUtil=require(_0x7916('0x16'));var db=require(_0x7916('0x17'))['db'];function respondWithStatusCode(_0x212a2c,_0x36a59a){_0x36a59a=_0x36a59a||0xcc;return function(_0x35a5cc){if(_0x35a5cc){return _0x212a2c[_0x7916('0x18')](_0x36a59a);}return _0x212a2c[_0x7916('0x19')](_0x36a59a)[_0x7916('0x1a')]();};}function respondWithResult(_0x2210bc,_0xff80a1){_0xff80a1=_0xff80a1||0xc8;return function(_0x2ce8f4){if(_0x2ce8f4){return _0x2210bc[_0x7916('0x19')](_0xff80a1)[_0x7916('0x1b')](_0x2ce8f4);}};}function respondWithFilteredResult(_0x120584,_0x4674d4){return function(_0x200b34){if(_0x200b34){var _0x113eb3=typeof _0x4674d4[_0x7916('0x1c')]===_0x7916('0x1d')&&typeof _0x4674d4[_0x7916('0x1e')]===_0x7916('0x1d');var _0x42f70d=_0x200b34[_0x7916('0x1f')];var _0x14f703=_0x113eb3?0x0:_0x4674d4[_0x7916('0x1c')];var _0x40966c=_0x113eb3?_0x200b34['count']:_0x4674d4[_0x7916('0x1c')]+_0x4674d4[_0x7916('0x1e')];var _0x513dec;if(_0x40966c>=_0x42f70d){_0x40966c=_0x42f70d;_0x513dec=0xc8;}else{_0x513dec=0xce;}_0x120584[_0x7916('0x19')](_0x513dec);return _0x120584['set']('Content-Range',_0x14f703+'-'+_0x40966c+'/'+_0x42f70d)[_0x7916('0x1b')](_0x200b34);}return null;};}function patchUpdates(_0x13f6fd){return function(_0x867ed9){try{jsonpatch[_0x7916('0x20')](_0x867ed9,_0x13f6fd,!![]);}catch(_0x520f4d){return BPromise[_0x7916('0x21')](_0x520f4d);}return _0x867ed9[_0x7916('0x22')]();};}function saveUpdates(_0x2e406c,_0x5f1e0e){return function(_0x4eec69){if(_0x4eec69){return _0x4eec69[_0x7916('0x23')](_0x2e406c)[_0x7916('0x24')](function(_0x2099b9){return _0x2099b9;});}return null;};}function removeEntity(_0xf75e9f,_0x12739f){return function(_0x3f0075){if(_0x3f0075){return _0x3f0075['destroy']()[_0x7916('0x24')](function(){var _0x235ab3=_0x3f0075[_0x7916('0x25')]({'plain':!![]});var _0xad6b85=_0x7916('0x26');return db[_0x7916('0x27')][_0x7916('0x28')]({'where':{'type':_0xad6b85,'resourceId':_0x235ab3['id']}})[_0x7916('0x24')](function(){return _0x3f0075;});})[_0x7916('0x24')](function(){_0xf75e9f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x433855,_0x52fce3){return function(_0x19f860){if(!_0x19f860){_0x433855['sendStatus'](0x194);}return _0x19f860;};}function handleError(_0x4b9b93,_0x3d1424){_0x3d1424=_0x3d1424||0x1f4;return function(_0x1c81ca){logger[_0x7916('0x29')](_0x1c81ca[_0x7916('0x2a')]);if(_0x1c81ca[_0x7916('0x2b')]){delete _0x1c81ca[_0x7916('0x2b')];}_0x4b9b93['status'](_0x3d1424)[_0x7916('0x2c')](_0x1c81ca);};}exports[_0x7916('0x2d')]=function(_0x106f4a,_0x21612f){var _0x41c4c8={},_0x10a949={},_0x24da87={'count':0x0,'rows':[]};var _0x383351=_[_0x7916('0x2e')](db[_0x7916('0x2f')][_0x7916('0x30')],function(_0x21a658){return{'name':_0x21a658['fieldName'],'type':_0x21a658[_0x7916('0x31')][_0x7916('0x32')]};});_0x10a949[_0x7916('0x33')]=_[_0x7916('0x2e')](_0x383351,_0x7916('0x2b'));_0x10a949[_0x7916('0x34')]=_[_0x7916('0x35')](_0x106f4a['query']);_0x10a949[_0x7916('0x36')]=_[_0x7916('0x37')](_0x10a949[_0x7916('0x33')],_0x10a949[_0x7916('0x34')]);_0x41c4c8[_0x7916('0x38')]=_['intersection'](_0x10a949[_0x7916('0x33')],qs[_0x7916('0x39')](_0x106f4a['query']['fields']));_0x41c4c8['attributes']=_0x41c4c8[_0x7916('0x38')][_0x7916('0x3a')]?_0x41c4c8[_0x7916('0x38')]:_0x10a949[_0x7916('0x33')];if(!_0x106f4a['query']['hasOwnProperty']('nolimit')){_0x41c4c8[_0x7916('0x1e')]=qs['limit'](_0x106f4a[_0x7916('0x34')]['limit']);_0x41c4c8['offset']=qs['offset'](_0x106f4a[_0x7916('0x34')][_0x7916('0x1c')]);}_0x41c4c8[_0x7916('0x3b')]=qs['sort'](_0x106f4a[_0x7916('0x34')]['sort']);_0x41c4c8[_0x7916('0x3c')]=qs[_0x7916('0x36')](_[_0x7916('0x3d')](_0x106f4a[_0x7916('0x34')],_0x10a949[_0x7916('0x36')]),_0x383351);if(_0x106f4a['query'][_0x7916('0x3e')]){_0x41c4c8[_0x7916('0x3c')]=_[_0x7916('0x3f')](_0x41c4c8[_0x7916('0x3c')],{'$or':_[_0x7916('0x2e')](_0x383351,function(_0x50182f){if(_0x50182f[_0x7916('0x31')]!==_0x7916('0x40')){var _0x7c1954={};_0x7c1954[_0x50182f[_0x7916('0x2b')]]={'$like':'%'+_0x106f4a[_0x7916('0x34')]['filter']+'%'};return _0x7c1954;}})});}_0x41c4c8=_[_0x7916('0x3f')]({},_0x41c4c8,_0x106f4a['options']);var _0x374745={'where':_0x41c4c8[_0x7916('0x3c')]};return db[_0x7916('0x2f')][_0x7916('0x1f')](_0x374745)['then'](function(_0x3e6f34){_0x24da87[_0x7916('0x1f')]=_0x3e6f34;if(_0x106f4a['query'][_0x7916('0x41')]){_0x41c4c8[_0x7916('0x42')]=[{'all':!![]}];}return db['Sound'][_0x7916('0x43')](_0x41c4c8);})['then'](function(_0x4b358e){_0x24da87[_0x7916('0x44')]=_0x4b358e;return _0x24da87;})['then'](respondWithFilteredResult(_0x21612f,_0x41c4c8))[_0x7916('0x45')](handleError(_0x21612f,null));};exports[_0x7916('0x46')]=function(_0x3cf31c,_0x203136){var _0x2aedf6={'raw':!![],'where':{'id':_0x3cf31c[_0x7916('0x47')]['id']}},_0x429319={};_0x429319[_0x7916('0x33')]=_[_0x7916('0x35')](db[_0x7916('0x2f')][_0x7916('0x30')]);_0x429319[_0x7916('0x34')]=_[_0x7916('0x35')](_0x3cf31c[_0x7916('0x34')]);_0x429319[_0x7916('0x36')]=_[_0x7916('0x37')](_0x429319['model'],_0x429319['query']);_0x2aedf6[_0x7916('0x38')]=_[_0x7916('0x37')](_0x429319[_0x7916('0x33')],qs[_0x7916('0x39')](_0x3cf31c[_0x7916('0x34')]['fields']));_0x2aedf6[_0x7916('0x38')]=_0x2aedf6['attributes'][_0x7916('0x3a')]?_0x2aedf6['attributes']:_0x429319[_0x7916('0x33')];if(_0x3cf31c[_0x7916('0x34')][_0x7916('0x41')]){_0x2aedf6[_0x7916('0x42')]=[{'all':!![]}];}_0x2aedf6=_[_0x7916('0x3f')]({},_0x2aedf6,_0x3cf31c[_0x7916('0x48')]);return db[_0x7916('0x2f')]['find'](_0x2aedf6)[_0x7916('0x24')](handleEntityNotFound(_0x203136,null))[_0x7916('0x24')](respondWithResult(_0x203136,null))['catch'](handleError(_0x203136,null));};exports[_0x7916('0x49')]=function(_0x3a077a,_0x383da9,_0x271828){return db['Sound']['find']({'where':{'id':_0x3a077a[_0x7916('0x47')]['id']},'attributes':[_0x7916('0x2b'),_0x7916('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x383da9,null))[_0x7916('0x24')](function(_0x5eb9c0){if(_0x5eb9c0){if(!fs[_0x7916('0x4b')](path[_0x7916('0x4c')](config[_0x7916('0x4d')],_0x7916('0x4e'),_0x5eb9c0[_0x7916('0x4a')]+'.'+_0x5eb9c0[_0x7916('0x4f')]))){throw new db[(_0x7916('0x50'))]['ValidationError'](_0x7916('0x51'));}return _0x383da9[_0x7916('0x49')](path[_0x7916('0x4c')](config[_0x7916('0x4d')],_0x7916('0x4e'),util['format'](_0x7916('0x52'),_0x5eb9c0[_0x7916('0x4a')],_0x5eb9c0[_0x7916('0x4f')])),util[_0x7916('0x53')]('%s.%s',_0x5eb9c0[_0x7916('0x2b')],_0x5eb9c0[_0x7916('0x4f')]));}return null;})[_0x7916('0x45')](handleError(_0x383da9,null));};exports['create']=function(_0x217b04,_0x128fc9,_0x2ba46a){var _0x5128c1={'name':path[_0x7916('0x54')](_0x217b04[_0x7916('0x55')][_0x7916('0x56')],path[_0x7916('0x57')](_0x217b04['file'][_0x7916('0x56')])),'save_name':path[_0x7916('0x54')](_0x217b04[_0x7916('0x55')][_0x7916('0x58')],path['extname'](_0x217b04[_0x7916('0x55')][_0x7916('0x58')])),'original_format':path[_0x7916('0x57')](_0x217b04['file']['originalname'])[_0x7916('0x59')](0x1),'converted_format':_0x7916('0x5a')};var _0x1391ce=path[_0x7916('0x4c')](config['root'],_0x7916('0x5b'),_0x217b04['file'][_0x7916('0x58')]);var _0x12a4a7=path[_0x7916('0x4c')](config[_0x7916('0x4d')],_0x7916('0x4e'),util[_0x7916('0x53')](_0x7916('0x52'),path[_0x7916('0x54')](_0x217b04[_0x7916('0x55')][_0x7916('0x58')],path[_0x7916('0x57')](_0x217b04[_0x7916('0x55')]['filename'])),_0x5128c1[_0x7916('0x4f')]));logger[_0x7916('0x5c')](_0x7916('0x5d'),_0x1391ce);logger[_0x7916('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x12a4a7);try{fs[_0x7916('0x5e')](_0x1391ce,parseInt(_0x7916('0x5f'),0x8));var _0x8eb891=sox[_0x7916('0x60')](_0x1391ce,_0x12a4a7,{'sampleRate':0x1f40,'format':_0x7916('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x8eb891['on'](_0x7916('0x29'),function(_0x11a59b){fs[_0x7916('0x61')](_0x1391ce);_0x128fc9[_0x7916('0x19')](0x1f4)['send'](_0x11a59b);});_0x8eb891['on'](_0x7916('0x62'),function(_0x61a1cf){_0x5128c1[_0x7916('0x63')]=isNaN(_0x61a1cf[_0x7916('0x64')])?null:_0x61a1cf[_0x7916('0x64')]*0x3e8;_0x5128c1[_0x7916('0x65')]=isNaN(_0x61a1cf[_0x7916('0x66')])?null:_0x61a1cf[_0x7916('0x66')];_0x5128c1[_0x7916('0x67')]=isNaN(_0x61a1cf['channelCount'])?null:_0x61a1cf[_0x7916('0x68')];_0x5128c1[_0x7916('0x69')]=isNaN(_0x61a1cf['bitRate'])?null:_0x61a1cf[_0x7916('0x6a')];_0x5128c1[_0x7916('0x6b')]=isNaN(_0x61a1cf['sampleRate'])?null:_0x61a1cf['sampleRate'];});_0x8eb891['on'](_0x7916('0x6c'),function(_0x5d819b){_0x5128c1['converted_duration']=isNaN(_0x5d819b[_0x7916('0x64')])?null:_0x5d819b[_0x7916('0x64')]*0x3e8;_0x5128c1[_0x7916('0x6d')]=isNaN(_0x5d819b[_0x7916('0x66')])?null:_0x5d819b[_0x7916('0x66')];_0x5128c1[_0x7916('0x6e')]=isNaN(_0x5d819b[_0x7916('0x68')])?null:_0x5d819b['channelCount'];_0x5128c1[_0x7916('0x6f')]=isNaN(_0x5d819b[_0x7916('0x6a')])?null:_0x5d819b['bitRate'];_0x5128c1['converted_sampleRate']=isNaN(_0x5d819b[_0x7916('0x70')])?null:_0x5d819b[_0x7916('0x70')];});_0x8eb891['on']('end',function(){fs['chmodSync'](_0x12a4a7,parseInt(_0x7916('0x5f'),0x8));return db[_0x7916('0x2f')]['create'](_0x5128c1)[_0x7916('0x24')](function(_0x5b2448){var _0x4796cf={'role':_0x217b04[_0x7916('0x71')]['role'],'userProfileId':_0x217b04[_0x7916('0x71')][_0x7916('0x72')]};if(!_0x4796cf)throw new Error(_0x7916('0x73'));if(_0x4796cf[_0x7916('0x74')]===_0x7916('0x75')){var _0x5a63cd=_0x5b2448[_0x7916('0x25')]({'plain':!![]});return db[_0x7916('0x76')][_0x7916('0x77')]({'where':{'name':_0x7916('0x26'),'userProfileId':_0x4796cf[_0x7916('0x72')]},'raw':!![]})[_0x7916('0x24')](function(_0x27a150){if(_0x27a150&&_0x27a150[_0x7916('0x78')]===0x0){return db[_0x7916('0x27')]['create']({'name':_0x5a63cd['name'],'resourceId':_0x5a63cd['id'],'type':_0x27a150['name'],'sectionId':_0x27a150['id']},{})['then'](function(){return _0x5b2448;});}else{return _0x5b2448;}})[_0x7916('0x45')](function(_0x18ad85){logger[_0x7916('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18ad85);throw _0x18ad85;});}return _0x5b2448;})[_0x7916('0x24')](respondWithResult(_0x128fc9,null))[_0x7916('0x45')](handleError(_0x128fc9,null));});_0x8eb891['start']();}catch(_0x12ac3e){_0x128fc9[_0x7916('0x19')](0x1f4)[_0x7916('0x2c')](_0x12ac3e);}};exports[_0x7916('0x23')]=function(_0x3d2800,_0x145988,_0x5b65e6){return db['Sound'][_0x7916('0x77')]({'where':{'id':_0x3d2800[_0x7916('0x47')]['id']}})[_0x7916('0x24')](handleEntityNotFound(_0x145988,null))[_0x7916('0x24')](saveUpdates(_['pick'](_0x3d2800[_0x7916('0x71')],[_0x7916('0x2b'),_0x7916('0x79')]),null))[_0x7916('0x24')](respondWithResult(_0x145988,null))[_0x7916('0x45')](handleError(_0x145988,null));};exports['delete']=function(_0x471364,_0x195974,_0x232195){return db[_0x7916('0x2f')][_0x7916('0x77')]({'where':{'id':_0x471364[_0x7916('0x47')]['id']}})['then'](function(_0x2bb5a5){if(_0x2bb5a5){return _0x2bb5a5['destroy']();}})[_0x7916('0x24')](function(_0xba59de){var _0xd53790=path[_0x7916('0x4c')](config[_0x7916('0x4d')],_0x7916('0x5b'),util[_0x7916('0x53')](_0x7916('0x52'),_0xba59de[_0x7916('0x4a')],_0xba59de[_0x7916('0x7a')]));var _0x2ec21c=path[_0x7916('0x4c')](config[_0x7916('0x4d')],'server/files/sounds/converted',util[_0x7916('0x53')](_0x7916('0x52'),_0xba59de[_0x7916('0x4a')],_0xba59de[_0x7916('0x4f')]));fs['unlinkSync'](_0xd53790);fs[_0x7916('0x61')](_0x2ec21c);return _0xba59de;})[_0x7916('0x24')](function(_0x47293f){if(_0x47293f){return _0x195974['status'](0xcc)[_0x7916('0x1a')]();}})[_0x7916('0x24')](handleEntityNotFound(_0x195974,null))['catch'](handleError(_0x195974,null));}; \ No newline at end of file +var _0xcdda=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','Sounds','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','Sound','findAll','rows','catch','keys','includeAll','find','download','params','save_name','existsSync','join','converted_format','Sequelize','ValidationError','root','server/files/sounds/converted','%s.%s','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x424ca6,_0x5e518d){var _0x229200=function(_0x1c161d){while(--_0x1c161d){_0x424ca6['push'](_0x424ca6['shift']());}};_0x229200(++_0x5e518d);}(_0xcdda,0x1ec));var _0xacdd=function(_0x3e0f52,_0x3754e6){_0x3e0f52=_0x3e0f52-0x0;var _0xc558fd=_0xcdda[_0x3e0f52];return _0xc558fd;};'use strict';var emlformat=require(_0xacdd('0x0'));var rimraf=require(_0xacdd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacdd('0x2'));var rp=require('request-promise');var moment=require(_0xacdd('0x3'));var BPromise=require(_0xacdd('0x4'));var Mustache=require(_0xacdd('0x5'));var util=require(_0xacdd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xacdd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xacdd('0x8'));var _=require(_0xacdd('0x9'));var squel=require(_0xacdd('0xa'));var crypto=require(_0xacdd('0xb'));var jsforce=require(_0xacdd('0xc'));var deskjs=require(_0xacdd('0xd'));var toCsv=require(_0xacdd('0x7'));var querystring=require(_0xacdd('0xe'));var Papa=require(_0xacdd('0xf'));var Redis=require('ioredis');var authService=require(_0xacdd('0x10'));var qs=require(_0xacdd('0x11'));var as=require(_0xacdd('0x12'));var hardwareService=require(_0xacdd('0x13'));var logger=require('../../config/logger')(_0xacdd('0x14'));var utils=require(_0xacdd('0x15'));var config=require(_0xacdd('0x16'));var licenseUtil=require(_0xacdd('0x17'));var db=require(_0xacdd('0x18'))['db'];function respondWithStatusCode(_0x318bb8,_0x4edf46){_0x4edf46=_0x4edf46||0xcc;return function(_0x247882){if(_0x247882){return _0x318bb8[_0xacdd('0x19')](_0x4edf46);}return _0x318bb8[_0xacdd('0x1a')](_0x4edf46)[_0xacdd('0x1b')]();};}function respondWithResult(_0x5662e8,_0x2caf2c){_0x2caf2c=_0x2caf2c||0xc8;return function(_0x3b9aab){if(_0x3b9aab){return _0x5662e8[_0xacdd('0x1a')](_0x2caf2c)[_0xacdd('0x1c')](_0x3b9aab);}};}function respondWithFilteredResult(_0x5cea6e,_0x1fbc1f){return function(_0x644845){if(_0x644845){var _0x319e84=typeof _0x1fbc1f[_0xacdd('0x1d')]===_0xacdd('0x1e')&&typeof _0x1fbc1f[_0xacdd('0x1f')]===_0xacdd('0x1e');var _0x3659d4=_0x644845[_0xacdd('0x20')];var _0x41a56e=_0x319e84?0x0:_0x1fbc1f[_0xacdd('0x1d')];var _0x1a7205=_0x319e84?_0x644845['count']:_0x1fbc1f[_0xacdd('0x1d')]+_0x1fbc1f[_0xacdd('0x1f')];var _0x2b68b4;if(_0x1a7205>=_0x3659d4){_0x1a7205=_0x3659d4;_0x2b68b4=0xc8;}else{_0x2b68b4=0xce;}_0x5cea6e[_0xacdd('0x1a')](_0x2b68b4);return _0x5cea6e[_0xacdd('0x21')](_0xacdd('0x22'),_0x41a56e+'-'+_0x1a7205+'/'+_0x3659d4)[_0xacdd('0x1c')](_0x644845);}return null;};}function patchUpdates(_0x444b3b){return function(_0x524318){try{jsonpatch[_0xacdd('0x23')](_0x524318,_0x444b3b,!![]);}catch(_0x3235f1){return BPromise['reject'](_0x3235f1);}return _0x524318['save']();};}function saveUpdates(_0x465227,_0x97b6d5){return function(_0x1b414e){if(_0x1b414e){return _0x1b414e['update'](_0x465227)['then'](function(_0x3f0248){return _0x3f0248;});}return null;};}function removeEntity(_0x3b5c60,_0x47a1e0){return function(_0x300b44){if(_0x300b44){return _0x300b44[_0xacdd('0x24')]()['then'](function(){var _0x297db5=_0x300b44['get']({'plain':!![]});var _0x21974d=_0xacdd('0x25');return db[_0xacdd('0x26')][_0xacdd('0x24')]({'where':{'type':_0x21974d,'resourceId':_0x297db5['id']}})['then'](function(){return _0x300b44;});})[_0xacdd('0x27')](function(){_0x3b5c60[_0xacdd('0x1a')](0xcc)[_0xacdd('0x1b')]();});}};}function handleEntityNotFound(_0x632d54,_0x3d2020){return function(_0x4d090b){if(!_0x4d090b){_0x632d54[_0xacdd('0x19')](0x194);}return _0x4d090b;};}function handleError(_0x252ad4,_0x23a84d){_0x23a84d=_0x23a84d||0x1f4;return function(_0x5246bf){logger[_0xacdd('0x28')](_0x5246bf[_0xacdd('0x29')]);if(_0x5246bf['name']){delete _0x5246bf[_0xacdd('0x2a')];}_0x252ad4[_0xacdd('0x1a')](_0x23a84d)[_0xacdd('0x2b')](_0x5246bf);};}exports[_0xacdd('0x2c')]=function(_0x47a2b4,_0x70f974){var _0x4d6aab={},_0x833ed6={},_0x1efdd5={'count':0x0,'rows':[]};var _0x18eb24=_[_0xacdd('0x2d')](db['Sound'][_0xacdd('0x2e')],function(_0xee97ae){return{'name':_0xee97ae[_0xacdd('0x2f')],'type':_0xee97ae[_0xacdd('0x30')][_0xacdd('0x31')]};});_0x833ed6['model']=_[_0xacdd('0x2d')](_0x18eb24,_0xacdd('0x2a'));_0x833ed6[_0xacdd('0x32')]=_['keys'](_0x47a2b4[_0xacdd('0x32')]);_0x833ed6['filters']=_[_0xacdd('0x33')](_0x833ed6['model'],_0x833ed6[_0xacdd('0x32')]);_0x4d6aab[_0xacdd('0x34')]=_[_0xacdd('0x33')](_0x833ed6['model'],qs[_0xacdd('0x35')](_0x47a2b4[_0xacdd('0x32')][_0xacdd('0x35')]));_0x4d6aab[_0xacdd('0x34')]=_0x4d6aab[_0xacdd('0x34')][_0xacdd('0x36')]?_0x4d6aab['attributes']:_0x833ed6[_0xacdd('0x37')];if(!_0x47a2b4[_0xacdd('0x32')][_0xacdd('0x38')](_0xacdd('0x39'))){_0x4d6aab[_0xacdd('0x1f')]=qs[_0xacdd('0x1f')](_0x47a2b4[_0xacdd('0x32')]['limit']);_0x4d6aab[_0xacdd('0x1d')]=qs[_0xacdd('0x1d')](_0x47a2b4[_0xacdd('0x32')][_0xacdd('0x1d')]);}_0x4d6aab[_0xacdd('0x3a')]=qs['sort'](_0x47a2b4['query'][_0xacdd('0x3b')]);_0x4d6aab['where']=qs[_0xacdd('0x3c')](_['pick'](_0x47a2b4[_0xacdd('0x32')],_0x833ed6[_0xacdd('0x3c')]),_0x18eb24);if(_0x47a2b4[_0xacdd('0x32')][_0xacdd('0x3d')]){_0x4d6aab[_0xacdd('0x3e')]=_[_0xacdd('0x3f')](_0x4d6aab[_0xacdd('0x3e')],{'$or':_['map'](_0x18eb24,function(_0x1bb64f){if(_0x1bb64f[_0xacdd('0x30')]!==_0xacdd('0x40')){var _0x2d0a41={};_0x2d0a41[_0x1bb64f[_0xacdd('0x2a')]]={'$like':'%'+_0x47a2b4[_0xacdd('0x32')]['filter']+'%'};return _0x2d0a41;}})});}_0x4d6aab=_['merge']({},_0x4d6aab,_0x47a2b4[_0xacdd('0x41')]);var _0x429971={'where':_0x4d6aab['where']};return db[_0xacdd('0x42')][_0xacdd('0x20')](_0x429971)[_0xacdd('0x27')](function(_0x5b869d){_0x1efdd5[_0xacdd('0x20')]=_0x5b869d;if(_0x47a2b4[_0xacdd('0x32')]['includeAll']){_0x4d6aab['include']=[{'all':!![]}];}return db[_0xacdd('0x42')][_0xacdd('0x43')](_0x4d6aab);})[_0xacdd('0x27')](function(_0x57cc62){_0x1efdd5[_0xacdd('0x44')]=_0x57cc62;return _0x1efdd5;})['then'](respondWithFilteredResult(_0x70f974,_0x4d6aab))[_0xacdd('0x45')](handleError(_0x70f974,null));};exports['show']=function(_0x15e2e1,_0x41f25f){var _0x55c451={'raw':!![],'where':{'id':_0x15e2e1['params']['id']}},_0x3898db={};_0x3898db[_0xacdd('0x37')]=_['keys'](db[_0xacdd('0x42')][_0xacdd('0x2e')]);_0x3898db['query']=_[_0xacdd('0x46')](_0x15e2e1[_0xacdd('0x32')]);_0x3898db[_0xacdd('0x3c')]=_[_0xacdd('0x33')](_0x3898db[_0xacdd('0x37')],_0x3898db['query']);_0x55c451['attributes']=_[_0xacdd('0x33')](_0x3898db[_0xacdd('0x37')],qs['fields'](_0x15e2e1['query']['fields']));_0x55c451['attributes']=_0x55c451[_0xacdd('0x34')][_0xacdd('0x36')]?_0x55c451[_0xacdd('0x34')]:_0x3898db[_0xacdd('0x37')];if(_0x15e2e1[_0xacdd('0x32')][_0xacdd('0x47')]){_0x55c451['include']=[{'all':!![]}];}_0x55c451=_[_0xacdd('0x3f')]({},_0x55c451,_0x15e2e1[_0xacdd('0x41')]);return db['Sound'][_0xacdd('0x48')](_0x55c451)['then'](handleEntityNotFound(_0x41f25f,null))[_0xacdd('0x27')](respondWithResult(_0x41f25f,null))[_0xacdd('0x45')](handleError(_0x41f25f,null));};exports[_0xacdd('0x49')]=function(_0x2d7252,_0x5b164c,_0x5524ab){return db[_0xacdd('0x42')][_0xacdd('0x48')]({'where':{'id':_0x2d7252[_0xacdd('0x4a')]['id']},'attributes':['name',_0xacdd('0x4b'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x5b164c,null))['then'](function(_0x51fb88){if(_0x51fb88){if(!fs[_0xacdd('0x4c')](path[_0xacdd('0x4d')](config['root'],'server/files/sounds/converted',_0x51fb88[_0xacdd('0x4b')]+'.'+_0x51fb88[_0xacdd('0x4e')]))){throw new db[(_0xacdd('0x4f'))][(_0xacdd('0x50'))]('Sound\x20not\x20found');}return _0x5b164c[_0xacdd('0x49')](path[_0xacdd('0x4d')](config[_0xacdd('0x51')],_0xacdd('0x52'),util['format'](_0xacdd('0x53'),_0x51fb88[_0xacdd('0x4b')],_0x51fb88[_0xacdd('0x4e')])),util['format']('%s.%s',_0x51fb88[_0xacdd('0x2a')],_0x51fb88['converted_format']));}return null;})[_0xacdd('0x45')](handleError(_0x5b164c,null));};exports['create']=function(_0x8735d8,_0x284abf,_0xb2eba3){var _0x461c89={'name':path[_0xacdd('0x54')](_0x8735d8[_0xacdd('0x55')][_0xacdd('0x56')],path['extname'](_0x8735d8[_0xacdd('0x55')]['originalname'])),'save_name':path['basename'](_0x8735d8[_0xacdd('0x55')][_0xacdd('0x57')],path[_0xacdd('0x58')](_0x8735d8[_0xacdd('0x55')][_0xacdd('0x57')])),'original_format':path['extname'](_0x8735d8[_0xacdd('0x55')][_0xacdd('0x56')])[_0xacdd('0x59')](0x1),'converted_format':_0xacdd('0x5a')};var _0x5e6bb6=path[_0xacdd('0x4d')](config['root'],_0xacdd('0x5b'),_0x8735d8[_0xacdd('0x55')][_0xacdd('0x57')]);var _0x2a8733=path[_0xacdd('0x4d')](config[_0xacdd('0x51')],_0xacdd('0x52'),util[_0xacdd('0x5c')](_0xacdd('0x53'),path[_0xacdd('0x54')](_0x8735d8[_0xacdd('0x55')]['filename'],path[_0xacdd('0x58')](_0x8735d8['file'][_0xacdd('0x57')])),_0x461c89[_0xacdd('0x4e')]));logger[_0xacdd('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x5e6bb6);logger[_0xacdd('0x5d')](_0xacdd('0x5e'),_0x2a8733);try{fs[_0xacdd('0x5f')](_0x5e6bb6,parseInt('0777',0x8));var _0x222be4=sox['transcode'](_0x5e6bb6,_0x2a8733,{'sampleRate':0x1f40,'format':_0xacdd('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x222be4['on'](_0xacdd('0x28'),function(_0x48922c){fs[_0xacdd('0x60')](_0x5e6bb6);_0x284abf[_0xacdd('0x1a')](0x1f4)[_0xacdd('0x2b')](_0x48922c);});_0x222be4['on'](_0xacdd('0x61'),function(_0x202a07){_0x461c89[_0xacdd('0x62')]=isNaN(_0x202a07[_0xacdd('0x63')])?null:_0x202a07[_0xacdd('0x63')]*0x3e8;_0x461c89[_0xacdd('0x64')]=isNaN(_0x202a07['sampleCount'])?null:_0x202a07[_0xacdd('0x65')];_0x461c89[_0xacdd('0x66')]=isNaN(_0x202a07['channelCount'])?null:_0x202a07[_0xacdd('0x67')];_0x461c89[_0xacdd('0x68')]=isNaN(_0x202a07[_0xacdd('0x69')])?null:_0x202a07[_0xacdd('0x69')];_0x461c89[_0xacdd('0x6a')]=isNaN(_0x202a07[_0xacdd('0x6b')])?null:_0x202a07[_0xacdd('0x6b')];});_0x222be4['on']('dest',function(_0x14826b){_0x461c89[_0xacdd('0x6c')]=isNaN(_0x14826b[_0xacdd('0x63')])?null:_0x14826b[_0xacdd('0x63')]*0x3e8;_0x461c89[_0xacdd('0x6d')]=isNaN(_0x14826b['sampleCount'])?null:_0x14826b['sampleCount'];_0x461c89[_0xacdd('0x6e')]=isNaN(_0x14826b[_0xacdd('0x67')])?null:_0x14826b[_0xacdd('0x67')];_0x461c89[_0xacdd('0x6f')]=isNaN(_0x14826b[_0xacdd('0x69')])?null:_0x14826b[_0xacdd('0x69')];_0x461c89[_0xacdd('0x70')]=isNaN(_0x14826b[_0xacdd('0x6b')])?null:_0x14826b[_0xacdd('0x6b')];});_0x222be4['on'](_0xacdd('0x1b'),function(){fs[_0xacdd('0x5f')](_0x2a8733,parseInt('0777',0x8));return db[_0xacdd('0x42')][_0xacdd('0x71')](_0x461c89)[_0xacdd('0x27')](function(_0x43754a){var _0x4cf311={'role':_0x8735d8[_0xacdd('0x72')][_0xacdd('0x73')],'userProfileId':_0x8735d8[_0xacdd('0x72')][_0xacdd('0x74')]};if(!_0x4cf311)throw new Error(_0xacdd('0x75'));if(_0x4cf311[_0xacdd('0x73')]===_0xacdd('0x76')){var _0x2d0162=_0x43754a['get']({'plain':!![]});return db['UserProfileSection'][_0xacdd('0x48')]({'where':{'name':_0xacdd('0x25'),'userProfileId':_0x4cf311[_0xacdd('0x74')]},'raw':!![]})[_0xacdd('0x27')](function(_0x211e52){if(_0x211e52&&_0x211e52[_0xacdd('0x77')]===0x0){return db[_0xacdd('0x26')][_0xacdd('0x71')]({'name':_0x2d0162['name'],'resourceId':_0x2d0162['id'],'type':_0x211e52[_0xacdd('0x2a')],'sectionId':_0x211e52['id']},{})[_0xacdd('0x27')](function(){return _0x43754a;});}else{return _0x43754a;}})[_0xacdd('0x45')](function(_0x2113b9){logger['error'](_0xacdd('0x78'),_0x2113b9);throw _0x2113b9;});}return _0x43754a;})['then'](respondWithResult(_0x284abf,null))[_0xacdd('0x45')](handleError(_0x284abf,null));});_0x222be4[_0xacdd('0x79')]();}catch(_0x13a8bc){_0x284abf[_0xacdd('0x1a')](0x1f4)[_0xacdd('0x2b')](_0x13a8bc);}};exports['update']=function(_0x35af24,_0x44b3b3,_0x5c9727){return db['Sound'][_0xacdd('0x48')]({'where':{'id':_0x35af24['params']['id']}})['then'](handleEntityNotFound(_0x44b3b3,null))[_0xacdd('0x27')](saveUpdates(_[_0xacdd('0x7a')](_0x35af24[_0xacdd('0x72')],['name',_0xacdd('0x7b')]),null))[_0xacdd('0x27')](respondWithResult(_0x44b3b3,null))[_0xacdd('0x45')](handleError(_0x44b3b3,null));};exports[_0xacdd('0x7c')]=function(_0x32af63,_0x4b9ed6,_0x3059ae){return db[_0xacdd('0x42')]['find']({'where':{'id':_0x32af63[_0xacdd('0x4a')]['id']}})['then'](function(_0xae9360){if(_0xae9360){return _0xae9360[_0xacdd('0x24')]();}})[_0xacdd('0x27')](function(_0x555008){var _0x563449=path[_0xacdd('0x4d')](config[_0xacdd('0x51')],_0xacdd('0x5b'),util['format']('%s.%s',_0x555008[_0xacdd('0x4b')],_0x555008[_0xacdd('0x7d')]));var _0x2fe201=path[_0xacdd('0x4d')](config[_0xacdd('0x51')],_0xacdd('0x52'),util[_0xacdd('0x5c')](_0xacdd('0x53'),_0x555008[_0xacdd('0x4b')],_0x555008['converted_format']));fs[_0xacdd('0x60')](_0x563449);fs[_0xacdd('0x60')](_0x2fe201);return _0x555008;})['then'](function(_0x3a0527){if(_0x3a0527){return _0x4b9ed6[_0xacdd('0x1a')](0xcc)[_0xacdd('0x1b')]();}})[_0xacdd('0x27')](handleEntityNotFound(_0x4b9ed6,null))['catch'](handleError(_0x4b9ed6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 0e20ef2..630a7fc 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 _0x3808=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3808,0x9a));var _0x8380=function(_0x47a1b5,_0x52d76a){_0x47a1b5=_0x47a1b5-0x0;var _0x39b975=_0x3808[_0x47a1b5];return _0x39b975;};'use strict';var _=require(_0x8380('0x0'));var util=require(_0x8380('0x1'));var logger=require(_0x8380('0x2'))(_0x8380('0x3'));var moment=require(_0x8380('0x4'));var BPromise=require('bluebird');var rp=require(_0x8380('0x5'));var fs=require('fs');var path=require(_0x8380('0x6'));var rimraf=require(_0x8380('0x7'));var config=require(_0x8380('0x8'));var attributes=require(_0x8380('0x9'));module[_0x8380('0xa')]=function(_0x2926e2,_0x503012){return _0x2926e2[_0x8380('0xb')](_0x8380('0xc'),attributes,{'tableName':_0x8380('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2c2=['define','tools_sounds','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x274285,_0xa8eb38){var _0x353e66=function(_0x1e27c8){while(--_0x1e27c8){_0x274285['push'](_0x274285['shift']());}};_0x353e66(++_0xa8eb38);}(_0xa2c2,0x19a));var _0x2a2c=function(_0x3edba0,_0x5b0e70){_0x3edba0=_0x3edba0-0x0;var _0xc6e131=_0xa2c2[_0x3edba0];return _0xc6e131;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2a2c('0x0'))(_0x2a2c('0x1'));var moment=require(_0x2a2c('0x2'));var BPromise=require(_0x2a2c('0x3'));var rp=require(_0x2a2c('0x4'));var fs=require('fs');var path=require(_0x2a2c('0x5'));var rimraf=require(_0x2a2c('0x6'));var config=require(_0x2a2c('0x7'));var attributes=require(_0x2a2c('0x8'));module[_0x2a2c('0x9')]=function(_0x5984c6,_0x41a0f4){return _0x5984c6[_0x2a2c('0xa')]('Sound',attributes,{'tableName':_0x2a2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index f8261ab..4805271 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 _0x07da=['raw','where','attributes','include','map','model','ShowSound','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Sound','options'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0x07da,0xff));var _0xa07d=function(_0x53c86d,_0xdd71c8){_0x53c86d=_0x53c86d-0x0;var _0x366fb5=_0x07da[_0x53c86d];return _0x366fb5;};'use strict';var _=require('lodash');var util=require(_0xa07d('0x0'));var moment=require(_0xa07d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa07d('0x2'));var db=require(_0xa07d('0x3'))['db'];var utils=require(_0xa07d('0x4'));var logger=require(_0xa07d('0x5'))('rpc');var config=require(_0xa07d('0x6'));var jayson=require(_0xa07d('0x7'));var client=jayson[_0xa07d('0x8')][_0xa07d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x272831,_0x3b437e,_0x2e1c60){return new BPromise(function(_0x13bee8,_0xf1f73c){return client[_0xa07d('0xa')](_0x272831,_0x2e1c60)[_0xa07d('0xb')](function(_0x53e5d5){logger[_0xa07d('0xc')](_0xa07d('0xd'),_0x3b437e,_0xa07d('0xe'));logger[_0xa07d('0xf')](_0xa07d('0x10'),_0x3b437e,_0xa07d('0xe'),JSON[_0xa07d('0x11')](_0x53e5d5));if(_0x53e5d5['error']){if(_0x53e5d5[_0xa07d('0x12')][_0xa07d('0x13')]===0x1f4){logger[_0xa07d('0x12')](_0xa07d('0xd'),_0x3b437e,_0x53e5d5[_0xa07d('0x12')][_0xa07d('0x14')]);return _0xf1f73c(_0x53e5d5[_0xa07d('0x12')]['message']);}logger[_0xa07d('0x12')]('Sound,\x20%s,\x20%s',_0x3b437e,_0x53e5d5[_0xa07d('0x12')][_0xa07d('0x14')]);return _0x13bee8(_0x53e5d5[_0xa07d('0x12')][_0xa07d('0x14')]);}else{logger[_0xa07d('0xc')](_0xa07d('0xd'),_0x3b437e,'request\x20sent');_0x13bee8(_0x53e5d5[_0xa07d('0x15')][_0xa07d('0x14')]);}})['catch'](function(_0x19aa1c){logger[_0xa07d('0x12')](_0xa07d('0xd'),_0x3b437e,_0x19aa1c);_0xf1f73c(_0x19aa1c);});});}exports['ShowSound']=function(_0x30df81){var _0x52c3ab=this;return new Promise(function(_0xd29ec4,_0x21fb7d){return db[_0xa07d('0x16')]['find']({'raw':_0x30df81[_0xa07d('0x17')]?_0x30df81[_0xa07d('0x17')][_0xa07d('0x18')]===undefined?!![]:![]:!![],'where':_0x30df81['options']?_0x30df81[_0xa07d('0x17')][_0xa07d('0x19')]||null:null,'attributes':_0x30df81[_0xa07d('0x17')]?_0x30df81[_0xa07d('0x17')][_0xa07d('0x1a')]||null:null,'include':_0x30df81[_0xa07d('0x17')]?_0x30df81[_0xa07d('0x17')][_0xa07d('0x1b')]?_[_0xa07d('0x1c')](_0x30df81[_0xa07d('0x17')][_0xa07d('0x1b')],function(_0xd6e5fb){return{'model':db[_0xd6e5fb['model']],'as':_0xd6e5fb['as'],'attributes':_0xd6e5fb[_0xa07d('0x1a')],'include':_0xd6e5fb['include']?_[_0xa07d('0x1c')](_0xd6e5fb['include'],function(_0x208fb6){return{'model':db[_0x208fb6['model']],'as':_0x208fb6['as'],'attributes':_0x208fb6[_0xa07d('0x1a')],'include':_0x208fb6[_0xa07d('0x1b')]?_[_0xa07d('0x1c')](_0x208fb6[_0xa07d('0x1b')],function(_0x3fbc5a){return{'model':db[_0x3fbc5a[_0xa07d('0x1d')]],'as':_0x3fbc5a['as'],'attributes':_0x3fbc5a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa07d('0xb')](function(_0x28403b){logger['info'](_0xa07d('0x1e'),_0x30df81);logger['debug'](_0xa07d('0x1e'),_0x30df81,JSON[_0xa07d('0x11')](_0x28403b));_0xd29ec4(_0x28403b);})['catch'](function(_0x12c412){logger[_0xa07d('0x12')](_0xa07d('0x1e'),_0x12c412[_0xa07d('0x14')],_0x30df81);_0x21fb7d(_0x52c3ab[_0xa07d('0x12')](0x1f4,_0x12c412['message']));});});}; \ No newline at end of file +var _0x6040=['options','raw','attributes','include','model','map','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ShowSound'];(function(_0x4262e6,_0x5928d0){var _0x52d4eb=function(_0x318b77){while(--_0x318b77){_0x4262e6['push'](_0x4262e6['shift']());}};_0x52d4eb(++_0x5928d0);}(_0x6040,0x181));var _0x0604=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x6040[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x0604('0x0'));var util=require(_0x0604('0x1'));var moment=require('moment');var BPromise=require(_0x0604('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0604('0x3'));var db=require(_0x0604('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0604('0x5'))(_0x0604('0x6'));var config=require(_0x0604('0x7'));var jayson=require(_0x0604('0x8'));var client=jayson[_0x0604('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257bd2,_0x5679f5,_0x4ff085){return new BPromise(function(_0x11b534,_0x4a86fc){return client['request'](_0x257bd2,_0x4ff085)['then'](function(_0x5c9f6c){logger[_0x0604('0xa')](_0x0604('0xb'),_0x5679f5,'request\x20sent');logger[_0x0604('0xc')](_0x0604('0xd'),_0x5679f5,_0x0604('0xe'),JSON['stringify'](_0x5c9f6c));if(_0x5c9f6c['error']){if(_0x5c9f6c['error']['code']===0x1f4){logger['error'](_0x0604('0xb'),_0x5679f5,_0x5c9f6c[_0x0604('0xf')]['message']);return _0x4a86fc(_0x5c9f6c[_0x0604('0xf')]['message']);}logger[_0x0604('0xf')](_0x0604('0xb'),_0x5679f5,_0x5c9f6c[_0x0604('0xf')][_0x0604('0x10')]);return _0x11b534(_0x5c9f6c[_0x0604('0xf')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x5679f5,_0x0604('0xe'));_0x11b534(_0x5c9f6c[_0x0604('0x11')][_0x0604('0x10')]);}})[_0x0604('0x12')](function(_0x5d6075){logger['error']('Sound,\x20%s,\x20%s',_0x5679f5,_0x5d6075);_0x4a86fc(_0x5d6075);});});}exports[_0x0604('0x13')]=function(_0x6d0655){var _0x4a852f=this;return new Promise(function(_0x1009f4,_0x4848c4){return db['Sound']['find']({'raw':_0x6d0655[_0x0604('0x14')]?_0x6d0655[_0x0604('0x14')][_0x0604('0x15')]===undefined?!![]:![]:!![],'where':_0x6d0655[_0x0604('0x14')]?_0x6d0655[_0x0604('0x14')]['where']||null:null,'attributes':_0x6d0655[_0x0604('0x14')]?_0x6d0655[_0x0604('0x14')][_0x0604('0x16')]||null:null,'include':_0x6d0655[_0x0604('0x14')]?_0x6d0655[_0x0604('0x14')][_0x0604('0x17')]?_['map'](_0x6d0655[_0x0604('0x14')][_0x0604('0x17')],function(_0x167560){return{'model':db[_0x167560[_0x0604('0x18')]],'as':_0x167560['as'],'attributes':_0x167560[_0x0604('0x16')],'include':_0x167560[_0x0604('0x17')]?_[_0x0604('0x19')](_0x167560[_0x0604('0x17')],function(_0x51b5ff){return{'model':db[_0x51b5ff[_0x0604('0x18')]],'as':_0x51b5ff['as'],'attributes':_0x51b5ff[_0x0604('0x16')],'include':_0x51b5ff[_0x0604('0x17')]?_[_0x0604('0x19')](_0x51b5ff[_0x0604('0x17')],function(_0x2e3c84){return{'model':db[_0x2e3c84[_0x0604('0x18')]],'as':_0x2e3c84['as'],'attributes':_0x2e3c84[_0x0604('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0604('0x1a')](function(_0x3d00c0){logger[_0x0604('0xa')](_0x0604('0x13'),_0x6d0655);logger[_0x0604('0xc')]('ShowSound',_0x6d0655,JSON['stringify'](_0x3d00c0));_0x1009f4(_0x3d00c0);})[_0x0604('0x12')](function(_0x27af7c){logger[_0x0604('0xf')](_0x0604('0x13'),_0x27af7c[_0x0604('0x10')],_0x6d0655);_0x4848c4(_0x4a852f[_0x0604('0xf')](0x1f4,_0x27af7c[_0x0604('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 30d4c5d..570ec7a 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x3c586f,_0x5eafb5){var _0x25f7f1=function(_0x58fa8c){while(--_0x58fa8c){_0x3c586f['push'](_0x3c586f['shift']());}};_0x25f7f1(++_0x5eafb5);}(_0x757a,0xde));var _0xa757=function(_0x43394f,_0x2e2fc5){_0x43394f=_0x43394f-0x0;var _0x4c9861=_0x757a[_0x43394f];return _0x4c9861;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x53109c,_0x1ecd56){_0x53109c=_0x53109c-0x0;var _0x35ca09=_0x9ffd[_0x53109c];return _0x35ca09;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9d98bf4..8cbcc98 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 _0x2b94=['TEXT','medium','ENUM','STRING','exports'];(function(_0x4a97c0,_0x5479da){var _0x553047=function(_0x5910fd){while(--_0x5910fd){_0x4a97c0['push'](_0x4a97c0['shift']());}};_0x553047(++_0x5479da);}(_0x2b94,0xb3));var _0x42b9=function(_0x46cbfb,_0x5717b4){_0x46cbfb=_0x46cbfb-0x0;var _0x5d6d57=_0x2b94[_0x46cbfb];return _0x5d6d57;};'use strict';var Sequelize=require('sequelize');module[_0x42b9('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x42b9('0x1')](_0x42b9('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x42b9('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x42b9('0x4')]},'providerResponse':{'type':Sequelize[_0x42b9('0x1')]}}; \ No newline at end of file +var _0x6cf1=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x6cf1,0x186));var _0x16cf=function(_0x85be30,_0x1defc6){_0x85be30=_0x85be30-0x0;var _0x1074ed=_0x6cf1[_0x85be30];return _0x1074ed;};'use strict';var Sequelize=require(_0x16cf('0x0'));module[_0x16cf('0x1')]={'uniqueid':{'type':Sequelize[_0x16cf('0x2')]},'body':{'type':Sequelize[_0x16cf('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x16cf('0x4')]('in',_0x16cf('0x5')),'defaultValue':_0x16cf('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x16cf('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 33f1134..2b4d9eb 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 _0x7782=['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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','SquareMessage','length','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x518762,_0x152560){var _0x25449b=function(_0x1e9ef7){while(--_0x1e9ef7){_0x518762['push'](_0x518762['shift']());}};_0x25449b(++_0x152560);}(_0x7782,0x134));var _0x2778=function(_0x2980bd,_0x5b0d12){_0x2980bd=_0x2980bd-0x0;var _0x403f3a=_0x7782[_0x2980bd];return _0x403f3a;};'use strict';var emlformat=require(_0x2778('0x0'));var rimraf=require(_0x2778('0x1'));var zipdir=require(_0x2778('0x2'));var jsonpatch=require(_0x2778('0x3'));var rp=require('request-promise');var moment=require(_0x2778('0x4'));var BPromise=require(_0x2778('0x5'));var Mustache=require(_0x2778('0x6'));var util=require(_0x2778('0x7'));var path=require(_0x2778('0x8'));var sox=require(_0x2778('0x9'));var csv=require(_0x2778('0xa'));var ejs=require(_0x2778('0xb'));var fs=require('fs');var fs_extra=require(_0x2778('0xc'));var _=require(_0x2778('0xd'));var squel=require(_0x2778('0xe'));var crypto=require(_0x2778('0xf'));var jsforce=require(_0x2778('0x10'));var deskjs=require(_0x2778('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2778('0x12'));var Papa=require(_0x2778('0x13'));var Redis=require(_0x2778('0x14'));var authService=require(_0x2778('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x2778('0x16'));var hardwareService=require(_0x2778('0x17'));var logger=require(_0x2778('0x18'))(_0x2778('0x19'));var utils=require(_0x2778('0x1a'));var config=require(_0x2778('0x1b'));var licenseUtil=require(_0x2778('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x146615,_0x58ce62){_0x58ce62=_0x58ce62||0xcc;return function(_0x251d6a){if(_0x251d6a){return _0x146615[_0x2778('0x1d')](_0x58ce62);}return _0x146615[_0x2778('0x1e')](_0x58ce62)[_0x2778('0x1f')]();};}function respondWithResult(_0x249ee7,_0x5ca23b){_0x5ca23b=_0x5ca23b||0xc8;return function(_0x2336e4){if(_0x2336e4){return _0x249ee7[_0x2778('0x1e')](_0x5ca23b)[_0x2778('0x20')](_0x2336e4);}};}function respondWithFilteredResult(_0x49e0e5,_0x2ccd7c){return function(_0x57f546){if(_0x57f546){var _0x296067=typeof _0x2ccd7c[_0x2778('0x21')]===_0x2778('0x22')&&typeof _0x2ccd7c['limit']===_0x2778('0x22');var _0x58d74e=_0x57f546[_0x2778('0x23')];var _0x56d59a=_0x296067?0x0:_0x2ccd7c[_0x2778('0x21')];var _0x25edac=_0x296067?_0x57f546[_0x2778('0x23')]:_0x2ccd7c['offset']+_0x2ccd7c[_0x2778('0x24')];var _0x22fece;if(_0x25edac>=_0x58d74e){_0x25edac=_0x58d74e;_0x22fece=0xc8;}else{_0x22fece=0xce;}_0x49e0e5[_0x2778('0x1e')](_0x22fece);return _0x49e0e5[_0x2778('0x25')](_0x2778('0x26'),_0x56d59a+'-'+_0x25edac+'/'+_0x58d74e)[_0x2778('0x20')](_0x57f546);}return null;};}function patchUpdates(_0x6f0ed8){return function(_0x5ba89a){try{jsonpatch[_0x2778('0x27')](_0x5ba89a,_0x6f0ed8,!![]);}catch(_0x35c49b){return BPromise[_0x2778('0x28')](_0x35c49b);}return _0x5ba89a[_0x2778('0x29')]();};}function saveUpdates(_0x36a44f,_0x58ee02){return function(_0x229711){if(_0x229711){return _0x229711[_0x2778('0x2a')](_0x36a44f)[_0x2778('0x2b')](function(_0x55eb4d){return _0x55eb4d;});}return null;};}function removeEntity(_0x2bb7f2,_0x4b2de5){return function(_0x2cbd08){if(_0x2cbd08){return _0x2cbd08[_0x2778('0x2c')]()[_0x2778('0x2b')](function(){_0x2bb7f2[_0x2778('0x1e')](0xcc)[_0x2778('0x1f')]();});}};}function handleEntityNotFound(_0x3da83f,_0xfda515){return function(_0x21dd2f){if(!_0x21dd2f){_0x3da83f[_0x2778('0x1d')](0x194);}return _0x21dd2f;};}function handleError(_0x315b77,_0x2b75e9){_0x2b75e9=_0x2b75e9||0x1f4;return function(_0x9a1302){logger['error'](_0x9a1302[_0x2778('0x2d')]);if(_0x9a1302['name']){delete _0x9a1302['name'];}_0x315b77[_0x2778('0x1e')](_0x2b75e9)[_0x2778('0x2e')](_0x9a1302);};}exports[_0x2778('0x2f')]=function(_0x169a55,_0x3544f7){var _0x52af56={},_0x3c1cad={},_0x9549dc={'count':0x0,'rows':[]};var _0x43d3b0=_[_0x2778('0x30')](db['SquareMessage'][_0x2778('0x31')],function(_0x58e378){return{'name':_0x58e378[_0x2778('0x32')],'type':_0x58e378[_0x2778('0x33')][_0x2778('0x34')]};});_0x3c1cad[_0x2778('0x35')]=_['map'](_0x43d3b0,_0x2778('0x36'));_0x3c1cad[_0x2778('0x37')]=_[_0x2778('0x38')](_0x169a55[_0x2778('0x37')]);_0x3c1cad[_0x2778('0x39')]=_[_0x2778('0x3a')](_0x3c1cad[_0x2778('0x35')],_0x3c1cad[_0x2778('0x37')]);_0x52af56[_0x2778('0x3b')]=_[_0x2778('0x3a')](_0x3c1cad[_0x2778('0x35')],qs[_0x2778('0x3c')](_0x169a55['query']['fields']));_0x52af56['attributes']=_0x52af56['attributes']['length']?_0x52af56['attributes']:_0x3c1cad[_0x2778('0x35')];if(!_0x169a55['query'][_0x2778('0x3d')]('nolimit')){_0x52af56[_0x2778('0x24')]=qs[_0x2778('0x24')](_0x169a55[_0x2778('0x37')][_0x2778('0x24')]);_0x52af56[_0x2778('0x21')]=qs[_0x2778('0x21')](_0x169a55[_0x2778('0x37')][_0x2778('0x21')]);}_0x52af56[_0x2778('0x3e')]=qs['sort'](_0x169a55[_0x2778('0x37')]['sort']);_0x52af56[_0x2778('0x3f')]=qs[_0x2778('0x39')](_[_0x2778('0x40')](_0x169a55[_0x2778('0x37')],_0x3c1cad[_0x2778('0x39')]),_0x43d3b0);if(_0x169a55[_0x2778('0x37')]['filter']){_0x52af56['where']=_[_0x2778('0x41')](_0x52af56[_0x2778('0x3f')],{'$or':_[_0x2778('0x30')](_0x43d3b0,function(_0x3349fb){if(_0x3349fb[_0x2778('0x33')]!==_0x2778('0x42')){var _0x2f5c04={};_0x2f5c04[_0x3349fb[_0x2778('0x36')]]={'$like':'%'+_0x169a55[_0x2778('0x37')][_0x2778('0x43')]+'%'};return _0x2f5c04;}})});}_0x52af56=_[_0x2778('0x41')]({},_0x52af56,_0x169a55[_0x2778('0x44')]);var _0x7527cd={'where':_0x52af56[_0x2778('0x3f')]};return db['SquareMessage'][_0x2778('0x23')](_0x7527cd)[_0x2778('0x2b')](function(_0x252b35){_0x9549dc[_0x2778('0x23')]=_0x252b35;if(_0x169a55['query']['includeAll']){_0x52af56[_0x2778('0x45')]=[{'all':!![]}];}return db['SquareMessage'][_0x2778('0x46')](_0x52af56);})[_0x2778('0x2b')](function(_0x1d7750){_0x9549dc[_0x2778('0x47')]=_0x1d7750;return _0x9549dc;})[_0x2778('0x2b')](respondWithFilteredResult(_0x3544f7,_0x52af56))['catch'](handleError(_0x3544f7,null));};exports['show']=function(_0x43aee9,_0x4e03c1){var _0x1b1f62={'raw':!![],'where':{'id':_0x43aee9[_0x2778('0x48')]['id']}},_0x17e8db={};_0x17e8db[_0x2778('0x35')]=_[_0x2778('0x38')](db[_0x2778('0x49')]['rawAttributes']);_0x17e8db[_0x2778('0x37')]=_['keys'](_0x43aee9[_0x2778('0x37')]);_0x17e8db[_0x2778('0x39')]=_['intersection'](_0x17e8db['model'],_0x17e8db['query']);_0x1b1f62[_0x2778('0x3b')]=_[_0x2778('0x3a')](_0x17e8db[_0x2778('0x35')],qs[_0x2778('0x3c')](_0x43aee9[_0x2778('0x37')][_0x2778('0x3c')]));_0x1b1f62[_0x2778('0x3b')]=_0x1b1f62[_0x2778('0x3b')][_0x2778('0x4a')]?_0x1b1f62[_0x2778('0x3b')]:_0x17e8db[_0x2778('0x35')];if(_0x43aee9['query'][_0x2778('0x4b')]){_0x1b1f62[_0x2778('0x45')]=[{'all':!![]}];}_0x1b1f62=_[_0x2778('0x41')]({},_0x1b1f62,_0x43aee9[_0x2778('0x44')]);return db[_0x2778('0x49')][_0x2778('0x4c')](_0x1b1f62)[_0x2778('0x2b')](handleEntityNotFound(_0x4e03c1,null))[_0x2778('0x2b')](respondWithResult(_0x4e03c1,null))[_0x2778('0x4d')](handleError(_0x4e03c1,null));};exports['create']=function(_0x3938a8,_0x5a912b){return db[_0x2778('0x49')][_0x2778('0x4e')](_0x3938a8[_0x2778('0x4f')],{})[_0x2778('0x2b')](respondWithResult(_0x5a912b,0xc9))['catch'](handleError(_0x5a912b,null));};exports[_0x2778('0x2a')]=function(_0x40ac40,_0x3ec7a9){if(_0x40ac40[_0x2778('0x4f')]['id']){delete _0x40ac40[_0x2778('0x4f')]['id'];}return db[_0x2778('0x49')][_0x2778('0x4c')]({'where':{'id':_0x40ac40[_0x2778('0x48')]['id']}})[_0x2778('0x2b')](handleEntityNotFound(_0x3ec7a9,null))['then'](saveUpdates(_0x40ac40['body'],null))[_0x2778('0x2b')](respondWithResult(_0x3ec7a9,null))['catch'](handleError(_0x3ec7a9,null));};exports[_0x2778('0x2c')]=function(_0x402e66,_0x415121){return db[_0x2778('0x49')]['find']({'where':{'id':_0x402e66[_0x2778('0x48')]['id']}})['then'](handleEntityNotFound(_0x415121,null))[_0x2778('0x2b')](removeEntity(_0x415121,null))[_0x2778('0x4d')](handleError(_0x415121,null));}; \ No newline at end of file +var _0x1fda=['Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','find','create','body','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x34bf78,_0x2ab2e3){var _0x255765=function(_0x3fb5db){while(--_0x3fb5db){_0x34bf78['push'](_0x34bf78['shift']());}};_0x255765(++_0x2ab2e3);}(_0x1fda,0x74));var _0xa1fd=function(_0x511e3f,_0xb2c5a8){_0x511e3f=_0x511e3f-0x0;var _0x50060e=_0x1fda[_0x511e3f];return _0x50060e;};'use strict';var emlformat=require(_0xa1fd('0x0'));var rimraf=require(_0xa1fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1fd('0x2'));var moment=require('moment');var BPromise=require(_0xa1fd('0x3'));var Mustache=require(_0xa1fd('0x4'));var util=require('util');var path=require(_0xa1fd('0x5'));var sox=require(_0xa1fd('0x6'));var csv=require(_0xa1fd('0x7'));var ejs=require(_0xa1fd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa1fd('0x9'));var squel=require('squel');var crypto=require(_0xa1fd('0xa'));var jsforce=require(_0xa1fd('0xb'));var deskjs=require(_0xa1fd('0xc'));var toCsv=require(_0xa1fd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1fd('0xd'));var as=require(_0xa1fd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1fd('0xf'))(_0xa1fd('0x10'));var utils=require(_0xa1fd('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294f79,_0x2e4696){_0x2e4696=_0x2e4696||0xcc;return function(_0x53b27c){if(_0x53b27c){return _0x294f79[_0xa1fd('0x12')](_0x2e4696);}return _0x294f79['status'](_0x2e4696)['end']();};}function respondWithResult(_0x2d7a07,_0x3d2ddc){_0x3d2ddc=_0x3d2ddc||0xc8;return function(_0x419aa8){if(_0x419aa8){return _0x2d7a07[_0xa1fd('0x13')](_0x3d2ddc)[_0xa1fd('0x14')](_0x419aa8);}};}function respondWithFilteredResult(_0x481182,_0x5cc6cd){return function(_0x5e05ae){if(_0x5e05ae){var _0x360e6f=typeof _0x5cc6cd[_0xa1fd('0x15')]===_0xa1fd('0x16')&&typeof _0x5cc6cd[_0xa1fd('0x17')]==='undefined';var _0x54bc52=_0x5e05ae[_0xa1fd('0x18')];var _0x8cf01f=_0x360e6f?0x0:_0x5cc6cd['offset'];var _0x2f4a16=_0x360e6f?_0x5e05ae['count']:_0x5cc6cd[_0xa1fd('0x15')]+_0x5cc6cd['limit'];var _0x133c84;if(_0x2f4a16>=_0x54bc52){_0x2f4a16=_0x54bc52;_0x133c84=0xc8;}else{_0x133c84=0xce;}_0x481182[_0xa1fd('0x13')](_0x133c84);return _0x481182[_0xa1fd('0x19')](_0xa1fd('0x1a'),_0x8cf01f+'-'+_0x2f4a16+'/'+_0x54bc52)[_0xa1fd('0x14')](_0x5e05ae);}return null;};}function patchUpdates(_0xf59eb4){return function(_0x318cd3){try{jsonpatch[_0xa1fd('0x1b')](_0x318cd3,_0xf59eb4,!![]);}catch(_0x4a310c){return BPromise[_0xa1fd('0x1c')](_0x4a310c);}return _0x318cd3[_0xa1fd('0x1d')]();};}function saveUpdates(_0x33f164,_0x55591d){return function(_0x471ca1){if(_0x471ca1){return _0x471ca1[_0xa1fd('0x1e')](_0x33f164)['then'](function(_0xbb1842){return _0xbb1842;});}return null;};}function removeEntity(_0x4e8696,_0x167714){return function(_0x46e58d){if(_0x46e58d){return _0x46e58d[_0xa1fd('0x1f')]()[_0xa1fd('0x20')](function(){_0x4e8696['status'](0xcc)[_0xa1fd('0x21')]();});}};}function handleEntityNotFound(_0x47eacc,_0x1578c1){return function(_0x25f50f){if(!_0x25f50f){_0x47eacc['sendStatus'](0x194);}return _0x25f50f;};}function handleError(_0x1610c3,_0x38db8e){_0x38db8e=_0x38db8e||0x1f4;return function(_0x2a526c){logger[_0xa1fd('0x22')](_0x2a526c[_0xa1fd('0x23')]);if(_0x2a526c[_0xa1fd('0x24')]){delete _0x2a526c[_0xa1fd('0x24')];}_0x1610c3[_0xa1fd('0x13')](_0x38db8e)[_0xa1fd('0x25')](_0x2a526c);};}exports[_0xa1fd('0x26')]=function(_0x2e8b7e,_0x2f0979){var _0x54159a={},_0x8144a6={},_0x5bab11={'count':0x0,'rows':[]};var _0x51e545=_['map'](db[_0xa1fd('0x27')][_0xa1fd('0x28')],function(_0x23e770){return{'name':_0x23e770[_0xa1fd('0x29')],'type':_0x23e770[_0xa1fd('0x2a')][_0xa1fd('0x2b')]};});_0x8144a6[_0xa1fd('0x2c')]=_['map'](_0x51e545,_0xa1fd('0x24'));_0x8144a6['query']=_[_0xa1fd('0x2d')](_0x2e8b7e[_0xa1fd('0x2e')]);_0x8144a6[_0xa1fd('0x2f')]=_[_0xa1fd('0x30')](_0x8144a6[_0xa1fd('0x2c')],_0x8144a6[_0xa1fd('0x2e')]);_0x54159a[_0xa1fd('0x31')]=_[_0xa1fd('0x30')](_0x8144a6[_0xa1fd('0x2c')],qs[_0xa1fd('0x32')](_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x32')]));_0x54159a[_0xa1fd('0x31')]=_0x54159a[_0xa1fd('0x31')]['length']?_0x54159a[_0xa1fd('0x31')]:_0x8144a6[_0xa1fd('0x2c')];if(!_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x33')](_0xa1fd('0x34'))){_0x54159a['limit']=qs[_0xa1fd('0x17')](_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x17')]);_0x54159a[_0xa1fd('0x15')]=qs[_0xa1fd('0x15')](_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x15')]);}_0x54159a['order']=qs[_0xa1fd('0x35')](_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x35')]);_0x54159a[_0xa1fd('0x36')]=qs[_0xa1fd('0x2f')](_[_0xa1fd('0x37')](_0x2e8b7e[_0xa1fd('0x2e')],_0x8144a6[_0xa1fd('0x2f')]),_0x51e545);if(_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x38')]){_0x54159a[_0xa1fd('0x36')]=_[_0xa1fd('0x39')](_0x54159a[_0xa1fd('0x36')],{'$or':_[_0xa1fd('0x3a')](_0x51e545,function(_0x286900){if(_0x286900[_0xa1fd('0x2a')]!==_0xa1fd('0x3b')){var _0x312e22={};_0x312e22[_0x286900[_0xa1fd('0x24')]]={'$like':'%'+_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x38')]+'%'};return _0x312e22;}})});}_0x54159a=_[_0xa1fd('0x39')]({},_0x54159a,_0x2e8b7e[_0xa1fd('0x3c')]);var _0x88b436={'where':_0x54159a[_0xa1fd('0x36')]};return db[_0xa1fd('0x27')][_0xa1fd('0x18')](_0x88b436)[_0xa1fd('0x20')](function(_0x2b5cd4){_0x5bab11[_0xa1fd('0x18')]=_0x2b5cd4;if(_0x2e8b7e[_0xa1fd('0x2e')][_0xa1fd('0x3d')]){_0x54159a['include']=[{'all':!![]}];}return db['SquareMessage'][_0xa1fd('0x3e')](_0x54159a);})['then'](function(_0x176120){_0x5bab11['rows']=_0x176120;return _0x5bab11;})[_0xa1fd('0x20')](respondWithFilteredResult(_0x2f0979,_0x54159a))[_0xa1fd('0x3f')](handleError(_0x2f0979,null));};exports[_0xa1fd('0x40')]=function(_0x35c492,_0x180e4a){var _0x30e90e={'raw':!![],'where':{'id':_0x35c492[_0xa1fd('0x41')]['id']}},_0x3a135f={};_0x3a135f[_0xa1fd('0x2c')]=_[_0xa1fd('0x2d')](db[_0xa1fd('0x27')][_0xa1fd('0x28')]);_0x3a135f[_0xa1fd('0x2e')]=_[_0xa1fd('0x2d')](_0x35c492[_0xa1fd('0x2e')]);_0x3a135f[_0xa1fd('0x2f')]=_[_0xa1fd('0x30')](_0x3a135f[_0xa1fd('0x2c')],_0x3a135f[_0xa1fd('0x2e')]);_0x30e90e[_0xa1fd('0x31')]=_[_0xa1fd('0x30')](_0x3a135f[_0xa1fd('0x2c')],qs['fields'](_0x35c492[_0xa1fd('0x2e')]['fields']));_0x30e90e[_0xa1fd('0x31')]=_0x30e90e[_0xa1fd('0x31')][_0xa1fd('0x42')]?_0x30e90e['attributes']:_0x3a135f[_0xa1fd('0x2c')];if(_0x35c492[_0xa1fd('0x2e')][_0xa1fd('0x3d')]){_0x30e90e[_0xa1fd('0x43')]=[{'all':!![]}];}_0x30e90e=_[_0xa1fd('0x39')]({},_0x30e90e,_0x35c492[_0xa1fd('0x3c')]);return db[_0xa1fd('0x27')][_0xa1fd('0x44')](_0x30e90e)[_0xa1fd('0x20')](handleEntityNotFound(_0x180e4a,null))['then'](respondWithResult(_0x180e4a,null))[_0xa1fd('0x3f')](handleError(_0x180e4a,null));};exports[_0xa1fd('0x45')]=function(_0x42570a,_0x320503){return db[_0xa1fd('0x27')]['create'](_0x42570a[_0xa1fd('0x46')],{})[_0xa1fd('0x20')](respondWithResult(_0x320503,0xc9))['catch'](handleError(_0x320503,null));};exports[_0xa1fd('0x1e')]=function(_0x4fbe48,_0xf11840){if(_0x4fbe48[_0xa1fd('0x46')]['id']){delete _0x4fbe48['body']['id'];}return db['SquareMessage'][_0xa1fd('0x44')]({'where':{'id':_0x4fbe48['params']['id']}})[_0xa1fd('0x20')](handleEntityNotFound(_0xf11840,null))['then'](saveUpdates(_0x4fbe48[_0xa1fd('0x46')],null))['then'](respondWithResult(_0xf11840,null))['catch'](handleError(_0xf11840,null));};exports[_0xa1fd('0x1f')]=function(_0x22b976,_0x1c9bd5){return db[_0xa1fd('0x27')][_0xa1fd('0x44')]({'where':{'id':_0x22b976[_0xa1fd('0x41')]['id']}})[_0xa1fd('0x20')](handleEntityNotFound(_0x1c9bd5,null))[_0xa1fd('0x20')](removeEntity(_0x1c9bd5,null))[_0xa1fd('0x3f')](handleError(_0x1c9bd5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 87d8d81..2466588 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 _0xb97e=['../../config/environment','SquareMessage','square_messages','util','moment','request-promise','path','rimraf'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xb97e,0x1c3));var _0xeb97=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb97e[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require(_0xeb97('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xeb97('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb97('0x2'));var fs=require('fs');var path=require(_0xeb97('0x3'));var rimraf=require(_0xeb97('0x4'));var config=require(_0xeb97('0x5'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x4988b1,_0x4dc4bf){return _0x4988b1['define'](_0xeb97('0x6'),attributes,{'tableName':_0xeb97('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9050=['api','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0xf120ca,_0x230215){var _0x613b7f=function(_0x2f3a68){while(--_0x2f3a68){_0xf120ca['push'](_0xf120ca['shift']());}};_0x613b7f(++_0x230215);}(_0x9050,0x75));var _0x0905=function(_0x4a3a1f,_0xac8b50){_0x4a3a1f=_0x4a3a1f-0x0;var _0x2bc4b2=_0x9050[_0x4a3a1f];return _0x2bc4b2;};'use strict';var _=require(_0x0905('0x0'));var util=require(_0x0905('0x1'));var logger=require(_0x0905('0x2'))(_0x0905('0x3'));var moment=require('moment');var BPromise=require(_0x0905('0x4'));var rp=require(_0x0905('0x5'));var fs=require('fs');var path=require(_0x0905('0x6'));var rimraf=require(_0x0905('0x7'));var config=require(_0x0905('0x8'));var attributes=require(_0x0905('0x9'));module['exports']=function(_0x173311,_0xd6f5c0){return _0x173311['define'](_0x0905('0xa'),attributes,{'tableName':_0x0905('0xb'),'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 3e663f9..9522e40 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 _0x36b3=['../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36b3,0x96));var _0x336b=function(_0xf7c8e1,_0x5cc506){_0xf7c8e1=_0xf7c8e1-0x0;var _0x47b3a7=_0x36b3[_0xf7c8e1];return _0x47b3a7;};'use strict';var _=require('lodash');var util=require(_0x336b('0x0'));var moment=require(_0x336b('0x1'));var BPromise=require(_0x336b('0x2'));var rs=require(_0x336b('0x3'));var fs=require('fs');var Redis=require(_0x336b('0x4'));var db=require(_0x336b('0x5'))['db'];var utils=require(_0x336b('0x6'));var logger=require('../../config/logger')(_0x336b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x336b('0x8')][_0x336b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x576e4e,_0x367e68,_0x576e15){return new BPromise(function(_0x1367e2,_0x34a671){return client[_0x336b('0xa')](_0x576e4e,_0x576e15)[_0x336b('0xb')](function(_0x435466){logger[_0x336b('0xc')]('SquareMessage,\x20%s,\x20%s',_0x367e68,_0x336b('0xd'));logger[_0x336b('0xe')](_0x336b('0xf'),_0x367e68,_0x336b('0xd'),JSON['stringify'](_0x435466));if(_0x435466['error']){if(_0x435466[_0x336b('0x10')][_0x336b('0x11')]===0x1f4){logger[_0x336b('0x10')](_0x336b('0x12'),_0x367e68,_0x435466[_0x336b('0x10')][_0x336b('0x13')]);return _0x34a671(_0x435466[_0x336b('0x10')]['message']);}logger[_0x336b('0x10')](_0x336b('0x12'),_0x367e68,_0x435466[_0x336b('0x10')][_0x336b('0x13')]);return _0x1367e2(_0x435466[_0x336b('0x10')]['message']);}else{logger[_0x336b('0xc')](_0x336b('0x12'),_0x367e68,'request\x20sent');_0x1367e2(_0x435466['result'][_0x336b('0x13')]);}})[_0x336b('0x14')](function(_0x10bbeb){logger[_0x336b('0x10')](_0x336b('0x12'),_0x367e68,_0x10bbeb);_0x34a671(_0x10bbeb);});});}exports[_0x336b('0x15')]=function(_0x229b37){var _0xf84689=this;return new Promise(function(_0xeeed76,_0x363650){return db['SquareMessage']['create'](_0x229b37[_0x336b('0x16')],{'raw':_0x229b37[_0x336b('0x17')]?_0x229b37['options'][_0x336b('0x18')]===undefined?!![]:![]:!![]})[_0x336b('0xb')](function(_0x38e029){logger[_0x336b('0xc')](_0x336b('0x15'),_0x229b37);logger[_0x336b('0xe')](_0x336b('0x15'),_0x229b37,JSON[_0x336b('0x19')](_0x38e029));_0xeeed76(_0x38e029);})[_0x336b('0x14')](function(_0x3db9c4){logger[_0x336b('0x10')](_0x336b('0x15'),_0x3db9c4[_0x336b('0x13')],_0x229b37);_0x363650(_0xf84689[_0x336b('0x10')](0x1f4,_0x3db9c4[_0x336b('0x13')]));});});}; \ No newline at end of file +var _0x577d=['SquareMessage','create','body','options','raw','then','info','debug','stringify','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateSquareMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x577d,0x176));var _0xd577=function(_0x723273,_0x269b15){_0x723273=_0x723273-0x0;var _0x305ffc=_0x577d[_0x723273];return _0x305ffc;};'use strict';var _=require('lodash');var util=require(_0xd577('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd577('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd577('0x2'))['db'];var utils=require(_0xd577('0x3'));var logger=require(_0xd577('0x4'))('rpc');var config=require(_0xd577('0x5'));var jayson=require(_0xd577('0x6'));var client=jayson[_0xd577('0x7')][_0xd577('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7322e2,_0x93db96,_0x425a0a){return new BPromise(function(_0x4556c2,_0x110d44){return client['request'](_0x7322e2,_0x425a0a)['then'](function(_0x3c6a4e){logger['info'](_0xd577('0x9'),_0x93db96,_0xd577('0xa'));logger['debug'](_0xd577('0xb'),_0x93db96,_0xd577('0xa'),JSON['stringify'](_0x3c6a4e));if(_0x3c6a4e[_0xd577('0xc')]){if(_0x3c6a4e[_0xd577('0xc')]['code']===0x1f4){logger['error'](_0xd577('0x9'),_0x93db96,_0x3c6a4e[_0xd577('0xc')]['message']);return _0x110d44(_0x3c6a4e['error'][_0xd577('0xd')]);}logger[_0xd577('0xc')]('SquareMessage,\x20%s,\x20%s',_0x93db96,_0x3c6a4e[_0xd577('0xc')][_0xd577('0xd')]);return _0x4556c2(_0x3c6a4e[_0xd577('0xc')]['message']);}else{logger['info'](_0xd577('0x9'),_0x93db96,'request\x20sent');_0x4556c2(_0x3c6a4e[_0xd577('0xe')][_0xd577('0xd')]);}})['catch'](function(_0x4f628b){logger['error'](_0xd577('0x9'),_0x93db96,_0x4f628b);_0x110d44(_0x4f628b);});});}exports[_0xd577('0xf')]=function(_0x15bb41){var _0x83b27f=this;return new Promise(function(_0x5d6982,_0x5a3f46){return db[_0xd577('0x10')][_0xd577('0x11')](_0x15bb41[_0xd577('0x12')],{'raw':_0x15bb41[_0xd577('0x13')]?_0x15bb41['options'][_0xd577('0x14')]===undefined?!![]:![]:!![]})[_0xd577('0x15')](function(_0x33948e){logger[_0xd577('0x16')](_0xd577('0xf'),_0x15bb41);logger[_0xd577('0x17')](_0xd577('0xf'),_0x15bb41,JSON[_0xd577('0x18')](_0x33948e));_0x5d6982(_0x33948e);})[_0xd577('0x19')](function(_0x510e28){logger[_0xd577('0xc')](_0xd577('0xf'),_0x510e28['message'],_0x15bb41);_0x5a3f46(_0x83b27f[_0xd577('0xc')](0x1f4,_0x510e28[_0xd577('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1996b25..3c07364 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 _0x1ec9=['/:id/test','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4c427e,_0x47b469){var _0x27b358=function(_0x4f2bac){while(--_0x4f2bac){_0x4c427e['push'](_0x4c427e['shift']());}};_0x27b358(++_0x47b469);}(_0x1ec9,0xed));var _0x91ec=function(_0x4835e7,_0x2ba5dc){_0x4835e7=_0x4835e7-0x0;var _0x245a9c=_0x1ec9[_0x4835e7];return _0x245a9c;};'use strict';var multer=require(_0x91ec('0x0'));var util=require('util');var path=require(_0x91ec('0x1'));var timeout=require(_0x91ec('0x2'));var express=require(_0x91ec('0x3'));var router=express[_0x91ec('0x4')]();var fs_extra=require(_0x91ec('0x5'));var auth=require(_0x91ec('0x6'));var interaction=require(_0x91ec('0x7'));var config=require(_0x91ec('0x8'));var controller=require(_0x91ec('0x9'));router[_0x91ec('0xa')]('/',auth[_0x91ec('0xb')](),controller[_0x91ec('0xc')]);router[_0x91ec('0xa')](_0x91ec('0xd'),auth[_0x91ec('0xb')](),controller[_0x91ec('0xe')]);router[_0x91ec('0xa')](_0x91ec('0xf'),auth[_0x91ec('0xb')](),timeout('15s'),controller['test']);router['post']('/',auth['isAuthenticated'](),controller[_0x91ec('0x10')]);router['put'](_0x91ec('0xd'),auth['isAuthenticated'](),controller[_0x91ec('0x11')]);router[_0x91ec('0x12')](_0x91ec('0xd'),auth[_0x91ec('0xb')](),controller[_0x91ec('0x13')]);module[_0x91ec('0x14')]=router; \ No newline at end of file +var _0xdce5=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1579a8,_0x408979){var _0x11f5b8=function(_0x4050d0){while(--_0x4050d0){_0x1579a8['push'](_0x1579a8['shift']());}};_0x11f5b8(++_0x408979);}(_0xdce5,0xe8));var _0x5dce=function(_0x1ba8e5,_0x15fdbf){_0x1ba8e5=_0x1ba8e5-0x0;var _0x1d52a5=_0xdce5[_0x1ba8e5];return _0x1d52a5;};'use strict';var multer=require(_0x5dce('0x0'));var util=require(_0x5dce('0x1'));var path=require(_0x5dce('0x2'));var timeout=require(_0x5dce('0x3'));var express=require(_0x5dce('0x4'));var router=express[_0x5dce('0x5')]();var fs_extra=require(_0x5dce('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5dce('0x7'));var config=require(_0x5dce('0x8'));var controller=require(_0x5dce('0x9'));router[_0x5dce('0xa')]('/',auth[_0x5dce('0xb')](),controller[_0x5dce('0xc')]);router['get'](_0x5dce('0xd'),auth[_0x5dce('0xb')](),controller[_0x5dce('0xe')]);router[_0x5dce('0xa')]('/:id/test',auth[_0x5dce('0xb')](),timeout(_0x5dce('0xf')),controller[_0x5dce('0x10')]);router[_0x5dce('0x11')]('/',auth[_0x5dce('0xb')](),controller[_0x5dce('0x12')]);router[_0x5dce('0x13')](_0x5dce('0xd'),auth[_0x5dce('0xb')](),controller[_0x5dce('0x14')]);router[_0x5dce('0x15')]('/:id',auth[_0x5dce('0xb')](),controller[_0x5dce('0x16')]);module[_0x5dce('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index cb41849..94bcabd 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 _0x8d2a=['STRING','name','sequelize','exports'];(function(_0x3d673c,_0x5dbb95){var _0x1e8ab3=function(_0x645ac4){while(--_0x645ac4){_0x3d673c['push'](_0x3d673c['shift']());}};_0x1e8ab3(++_0x5dbb95);}(_0x8d2a,0x11e));var _0xa8d2=function(_0x41b566,_0x4ac1d4){_0x41b566=_0x41b566-0x0;var _0x4f7149=_0x8d2a[_0x41b566];return _0x4f7149;};'use strict';var Sequelize=require(_0xa8d2('0x0'));module[_0xa8d2('0x1')]={'name':{'type':Sequelize[_0xa8d2('0x2')],'unique':_0xa8d2('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa8d2('0x2')]},'description':{'type':Sequelize[_0xa8d2('0x2')]}}; \ No newline at end of file +var _0xc342=['STRING','sequelize'];(function(_0x1ad10a,_0x56074a){var _0x300d3f=function(_0x3f9f7a){while(--_0x3f9f7a){_0x1ad10a['push'](_0x1ad10a['shift']());}};_0x300d3f(++_0x56074a);}(_0xc342,0xe3));var _0x2c34=function(_0x4f3cd1,_0x4b666e){_0x4f3cd1=_0x4f3cd1-0x0;var _0x4f304d=_0xc342[_0x4f3cd1];return _0x4f304d;};'use strict';var Sequelize=require(_0x2c34('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c34('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x2c34('0x1')]},'description':{'type':Sequelize[_0x2c34('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e6b529e..990e800 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 _0x9bf2=['send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name'];(function(_0x2a4a29,_0x3cc571){var _0x4139fe=function(_0x2b6a6b){while(--_0x2b6a6b){_0x2a4a29['push'](_0x2a4a29['shift']());}};_0x4139fe(++_0x3cc571);}(_0x9bf2,0x11c));var _0x29bf=function(_0x56b05c,_0x1994d5){_0x56b05c=_0x56b05c-0x0;var _0x4d841b=_0x9bf2[_0x56b05c];return _0x4d841b;};'use strict';var emlformat=require(_0x29bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29bf('0x1'));var jsonpatch=require(_0x29bf('0x2'));var rp=require(_0x29bf('0x3'));var moment=require(_0x29bf('0x4'));var BPromise=require(_0x29bf('0x5'));var Mustache=require(_0x29bf('0x6'));var util=require(_0x29bf('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x29bf('0x8'));var ejs=require(_0x29bf('0x9'));var fs=require('fs');var fs_extra=require(_0x29bf('0xa'));var _=require('lodash');var squel=require(_0x29bf('0xb'));var crypto=require(_0x29bf('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x29bf('0x8'));var querystring=require(_0x29bf('0xd'));var Papa=require('papaparse');var Redis=require(_0x29bf('0xe'));var authService=require(_0x29bf('0xf'));var qs=require(_0x29bf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29bf('0x11'));var logger=require(_0x29bf('0x12'))('api');var utils=require(_0x29bf('0x13'));var config=require(_0x29bf('0x14'));var licenseUtil=require(_0x29bf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x583204,_0x396485){_0x396485=_0x396485||0xcc;return function(_0x2b8ba8){if(_0x2b8ba8){return _0x583204['sendStatus'](_0x396485);}return _0x583204[_0x29bf('0x16')](_0x396485)[_0x29bf('0x17')]();};}function respondWithResult(_0x2ccf27,_0x4cdc1c){_0x4cdc1c=_0x4cdc1c||0xc8;return function(_0x460621){if(_0x460621){return _0x2ccf27['status'](_0x4cdc1c)[_0x29bf('0x18')](_0x460621);}};}function respondWithFilteredResult(_0x3935d0,_0x39315b){return function(_0x48f533){if(_0x48f533){var _0x568add=typeof _0x39315b[_0x29bf('0x19')]===_0x29bf('0x1a')&&typeof _0x39315b[_0x29bf('0x1b')]===_0x29bf('0x1a');var _0x37b099=_0x48f533['count'];var _0x5e2825=_0x568add?0x0:_0x39315b['offset'];var _0x2bdce6=_0x568add?_0x48f533['count']:_0x39315b[_0x29bf('0x19')]+_0x39315b[_0x29bf('0x1b')];var _0xe3ba4c;if(_0x2bdce6>=_0x37b099){_0x2bdce6=_0x37b099;_0xe3ba4c=0xc8;}else{_0xe3ba4c=0xce;}_0x3935d0['status'](_0xe3ba4c);return _0x3935d0[_0x29bf('0x1c')](_0x29bf('0x1d'),_0x5e2825+'-'+_0x2bdce6+'/'+_0x37b099)['json'](_0x48f533);}return null;};}function patchUpdates(_0x52004e){return function(_0x3a9139){try{jsonpatch['apply'](_0x3a9139,_0x52004e,!![]);}catch(_0xe3297c){return BPromise[_0x29bf('0x1e')](_0xe3297c);}return _0x3a9139[_0x29bf('0x1f')]();};}function saveUpdates(_0x3d3281,_0x450a90){return function(_0x5ccc95){if(_0x5ccc95){return _0x5ccc95['update'](_0x3d3281)[_0x29bf('0x20')](function(_0x441a2d){return _0x441a2d;});}return null;};}function removeEntity(_0x8ec8bd,_0x253177){return function(_0x3caa3f){if(_0x3caa3f){return _0x3caa3f[_0x29bf('0x21')]()[_0x29bf('0x20')](function(){var _0x2275e7=_0x3caa3f[_0x29bf('0x22')]({'plain':!![]});var _0x106b0b='ODBC';return db[_0x29bf('0x23')][_0x29bf('0x21')]({'where':{'type':_0x106b0b,'resourceId':_0x2275e7['id']}})[_0x29bf('0x20')](function(){return _0x3caa3f;});})[_0x29bf('0x20')](function(){_0x8ec8bd[_0x29bf('0x16')](0xcc)[_0x29bf('0x17')]();});}};}function handleEntityNotFound(_0x100803,_0x907bf6){return function(_0x3cbc31){if(!_0x3cbc31){_0x100803[_0x29bf('0x24')](0x194);}return _0x3cbc31;};}function handleError(_0x13a9bd,_0x3348a4){_0x3348a4=_0x3348a4||0x1f4;return function(_0x57d023){logger[_0x29bf('0x25')](_0x57d023[_0x29bf('0x26')]);if(_0x57d023['name']){delete _0x57d023[_0x29bf('0x27')];}_0x13a9bd[_0x29bf('0x16')](_0x3348a4)[_0x29bf('0x28')](_0x57d023);};}exports[_0x29bf('0x29')]=function(_0x2918a3,_0x96d4e8){var _0x3d2aa3={},_0x5e4ab8={},_0x142790={'count':0x0,'rows':[]};var _0x179d46=_[_0x29bf('0x2a')](db[_0x29bf('0x2b')][_0x29bf('0x2c')],function(_0x2d7272){return{'name':_0x2d7272[_0x29bf('0x2d')],'type':_0x2d7272[_0x29bf('0x2e')][_0x29bf('0x2f')]};});_0x5e4ab8[_0x29bf('0x30')]=_['map'](_0x179d46,_0x29bf('0x27'));_0x5e4ab8['query']=_[_0x29bf('0x31')](_0x2918a3[_0x29bf('0x32')]);_0x5e4ab8['filters']=_['intersection'](_0x5e4ab8[_0x29bf('0x30')],_0x5e4ab8[_0x29bf('0x32')]);_0x3d2aa3['attributes']=_[_0x29bf('0x33')](_0x5e4ab8['model'],qs[_0x29bf('0x34')](_0x2918a3[_0x29bf('0x32')][_0x29bf('0x34')]));_0x3d2aa3['attributes']=_0x3d2aa3[_0x29bf('0x35')][_0x29bf('0x36')]?_0x3d2aa3[_0x29bf('0x35')]:_0x5e4ab8[_0x29bf('0x30')];if(!_0x2918a3[_0x29bf('0x32')]['hasOwnProperty']('nolimit')){_0x3d2aa3[_0x29bf('0x1b')]=qs[_0x29bf('0x1b')](_0x2918a3['query'][_0x29bf('0x1b')]);_0x3d2aa3[_0x29bf('0x19')]=qs[_0x29bf('0x19')](_0x2918a3[_0x29bf('0x32')][_0x29bf('0x19')]);}_0x3d2aa3['order']=qs['sort'](_0x2918a3[_0x29bf('0x32')][_0x29bf('0x37')]);_0x3d2aa3[_0x29bf('0x38')]=qs[_0x29bf('0x39')](_[_0x29bf('0x3a')](_0x2918a3[_0x29bf('0x32')],_0x5e4ab8['filters']),_0x179d46);if(_0x2918a3['query'][_0x29bf('0x3b')]){_0x3d2aa3[_0x29bf('0x38')]=_[_0x29bf('0x3c')](_0x3d2aa3['where'],{'$or':_[_0x29bf('0x2a')](_0x179d46,function(_0x534f1a){if(_0x534f1a[_0x29bf('0x2e')]!==_0x29bf('0x3d')){var _0xfd4c4={};_0xfd4c4[_0x534f1a[_0x29bf('0x27')]]={'$like':'%'+_0x2918a3[_0x29bf('0x32')][_0x29bf('0x3b')]+'%'};return _0xfd4c4;}})});}_0x3d2aa3=_[_0x29bf('0x3c')]({},_0x3d2aa3,_0x2918a3[_0x29bf('0x3e')]);var _0xaee1fd={'where':_0x3d2aa3[_0x29bf('0x38')]};return db[_0x29bf('0x2b')][_0x29bf('0x3f')](_0xaee1fd)[_0x29bf('0x20')](function(_0x37f61a){_0x142790['count']=_0x37f61a;if(_0x2918a3[_0x29bf('0x32')][_0x29bf('0x40')]){_0x3d2aa3[_0x29bf('0x41')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3d2aa3);})[_0x29bf('0x20')](function(_0x55c479){_0x142790[_0x29bf('0x42')]=_0x55c479;return _0x142790;})[_0x29bf('0x20')](respondWithFilteredResult(_0x96d4e8,_0x3d2aa3))['catch'](handleError(_0x96d4e8,null));};exports[_0x29bf('0x43')]=function(_0x56ce99,_0x1b68c0){var _0x1de629={'raw':!![],'where':{'id':_0x56ce99[_0x29bf('0x44')]['id']}},_0x19447c={};_0x19447c['model']=_[_0x29bf('0x31')](db[_0x29bf('0x2b')][_0x29bf('0x2c')]);_0x19447c[_0x29bf('0x32')]=_[_0x29bf('0x31')](_0x56ce99[_0x29bf('0x32')]);_0x19447c[_0x29bf('0x39')]=_[_0x29bf('0x33')](_0x19447c[_0x29bf('0x30')],_0x19447c[_0x29bf('0x32')]);_0x1de629[_0x29bf('0x35')]=_[_0x29bf('0x33')](_0x19447c[_0x29bf('0x30')],qs['fields'](_0x56ce99[_0x29bf('0x32')][_0x29bf('0x34')]));_0x1de629[_0x29bf('0x35')]=_0x1de629['attributes'][_0x29bf('0x36')]?_0x1de629['attributes']:_0x19447c['model'];if(_0x56ce99[_0x29bf('0x32')][_0x29bf('0x40')]){_0x1de629[_0x29bf('0x41')]=[{'all':!![]}];}_0x1de629=_['merge']({},_0x1de629,_0x56ce99[_0x29bf('0x3e')]);return db[_0x29bf('0x2b')][_0x29bf('0x45')](_0x1de629)[_0x29bf('0x20')](handleEntityNotFound(_0x1b68c0,null))['then'](respondWithResult(_0x1b68c0,null))['catch'](handleError(_0x1b68c0,null));};exports['create']=function(_0x2a95fc,_0x4a5d7d){return db[_0x29bf('0x2b')][_0x29bf('0x46')](_0x2a95fc[_0x29bf('0x47')],{})[_0x29bf('0x20')](function(_0x4687b5){var _0x3ae72b=_0x2a95fc[_0x29bf('0x48')]['get']({'plain':!![]});if(!_0x3ae72b)throw new Error(_0x29bf('0x49'));if(_0x3ae72b[_0x29bf('0x4a')]==='user'){var _0x51cbf7=_0x4687b5[_0x29bf('0x22')]({'plain':!![]});var _0x5aecda=_0x29bf('0x4b');return db['UserProfileSection'][_0x29bf('0x45')]({'where':{'name':_0x5aecda,'userProfileId':_0x3ae72b['userProfileId']},'raw':!![]})[_0x29bf('0x20')](function(_0x35bf1e){if(_0x35bf1e&&_0x35bf1e['autoAssociation']===0x0){return db[_0x29bf('0x23')][_0x29bf('0x46')]({'name':_0x51cbf7[_0x29bf('0x27')],'resourceId':_0x51cbf7['id'],'type':_0x35bf1e[_0x29bf('0x27')],'sectionId':_0x35bf1e['id']},{})['then'](function(){return _0x4687b5;});}else{return _0x4687b5;}})[_0x29bf('0x4c')](function(_0x8d9e4d){logger['error'](_0x29bf('0x4d'),_0x8d9e4d);throw _0x8d9e4d;});}return _0x4687b5;})[_0x29bf('0x20')](respondWithResult(_0x4a5d7d,0xc9))[_0x29bf('0x4c')](handleError(_0x4a5d7d,null));};exports['update']=function(_0xad2d60,_0x2c17c9){if(_0xad2d60[_0x29bf('0x47')]['id']){delete _0xad2d60[_0x29bf('0x47')]['id'];}return db[_0x29bf('0x2b')]['find']({'where':{'id':_0xad2d60[_0x29bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c17c9,null))[_0x29bf('0x20')](saveUpdates(_0xad2d60[_0x29bf('0x47')],null))[_0x29bf('0x20')](respondWithResult(_0x2c17c9,null))[_0x29bf('0x4c')](handleError(_0x2c17c9,null));};exports[_0x29bf('0x21')]=function(_0x35721e,_0x59feb7){return db['SquareOdbc'][_0x29bf('0x45')]({'where':{'id':_0x35721e['params']['id']}})[_0x29bf('0x20')](handleEntityNotFound(_0x59feb7,null))['then'](removeEntity(_0x59feb7,null))[_0x29bf('0x4c')](handleError(_0x59feb7,null));};exports['test']=function(_0x26d76b,_0x89b80b,_0x452bca){var _0x443abe;return db[_0x29bf('0x2b')][_0x29bf('0x45')]({'where':{'id':_0x26d76b[_0x29bf('0x44')]['id']},'attributes':['id',_0x29bf('0x4e')]})['then'](handleEntityNotFound(_0x89b80b,null))[_0x29bf('0x20')](function(_0x2be131){if(_0x2be131){var _0x376352=require(_0x29bf('0x4f'))();_0x376352[_0x29bf('0x50')](_0x2be131['dsn']);_0x376352['closeSync']();return _0x2be131;}})[_0x29bf('0x20')](respondWithResult(_0x89b80b,null))[_0x29bf('0x4c')](handleError(_0x89b80b,null));}; \ No newline at end of file +var _0xac8f=['odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','test','dsn'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0xac8f,0x108));var _0xfac8=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0xac8f[_0x12a554];return _0x244ba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfac8('0x0'));var zipdir=require(_0xfac8('0x1'));var jsonpatch=require(_0xfac8('0x2'));var rp=require('request-promise');var moment=require(_0xfac8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfac8('0x4'));var util=require(_0xfac8('0x5'));var path=require(_0xfac8('0x6'));var sox=require(_0xfac8('0x7'));var csv=require('to-csv');var ejs=require(_0xfac8('0x8'));var fs=require('fs');var fs_extra=require(_0xfac8('0x9'));var _=require('lodash');var squel=require(_0xfac8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfac8('0xb'));var toCsv=require(_0xfac8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfac8('0xd'));var authService=require(_0xfac8('0xe'));var qs=require(_0xfac8('0xf'));var as=require(_0xfac8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfac8('0x11'));var utils=require(_0xfac8('0x12'));var config=require(_0xfac8('0x13'));var licenseUtil=require(_0xfac8('0x14'));var db=require(_0xfac8('0x15'))['db'];function respondWithStatusCode(_0x568c19,_0xdc76b5){_0xdc76b5=_0xdc76b5||0xcc;return function(_0x586c1c){if(_0x586c1c){return _0x568c19[_0xfac8('0x16')](_0xdc76b5);}return _0x568c19['status'](_0xdc76b5)[_0xfac8('0x17')]();};}function respondWithResult(_0xf6be71,_0x502d94){_0x502d94=_0x502d94||0xc8;return function(_0x591ad9){if(_0x591ad9){return _0xf6be71[_0xfac8('0x18')](_0x502d94)[_0xfac8('0x19')](_0x591ad9);}};}function respondWithFilteredResult(_0x18a321,_0x108b95){return function(_0x4de3e9){if(_0x4de3e9){var _0x424a91=typeof _0x108b95[_0xfac8('0x1a')]===_0xfac8('0x1b')&&typeof _0x108b95['limit']==='undefined';var _0x5c6707=_0x4de3e9[_0xfac8('0x1c')];var _0x4b1cd4=_0x424a91?0x0:_0x108b95[_0xfac8('0x1a')];var _0x366038=_0x424a91?_0x4de3e9[_0xfac8('0x1c')]:_0x108b95[_0xfac8('0x1a')]+_0x108b95['limit'];var _0x5136b8;if(_0x366038>=_0x5c6707){_0x366038=_0x5c6707;_0x5136b8=0xc8;}else{_0x5136b8=0xce;}_0x18a321[_0xfac8('0x18')](_0x5136b8);return _0x18a321[_0xfac8('0x1d')](_0xfac8('0x1e'),_0x4b1cd4+'-'+_0x366038+'/'+_0x5c6707)['json'](_0x4de3e9);}return null;};}function patchUpdates(_0x29f847){return function(_0x36c761){try{jsonpatch['apply'](_0x36c761,_0x29f847,!![]);}catch(_0x130ea9){return BPromise[_0xfac8('0x1f')](_0x130ea9);}return _0x36c761[_0xfac8('0x20')]();};}function saveUpdates(_0x13b3f6,_0x26caf8){return function(_0x972da2){if(_0x972da2){return _0x972da2[_0xfac8('0x21')](_0x13b3f6)['then'](function(_0x321f5a){return _0x321f5a;});}return null;};}function removeEntity(_0x37aef6,_0x27421e){return function(_0x265ee4){if(_0x265ee4){return _0x265ee4[_0xfac8('0x22')]()[_0xfac8('0x23')](function(){var _0xa388ae=_0x265ee4[_0xfac8('0x24')]({'plain':!![]});var _0x5cce43='ODBC';return db[_0xfac8('0x25')][_0xfac8('0x22')]({'where':{'type':_0x5cce43,'resourceId':_0xa388ae['id']}})[_0xfac8('0x23')](function(){return _0x265ee4;});})[_0xfac8('0x23')](function(){_0x37aef6['status'](0xcc)[_0xfac8('0x17')]();});}};}function handleEntityNotFound(_0x5a5b83,_0x277212){return function(_0xe9dc1a){if(!_0xe9dc1a){_0x5a5b83[_0xfac8('0x16')](0x194);}return _0xe9dc1a;};}function handleError(_0x51b41c,_0x52f103){_0x52f103=_0x52f103||0x1f4;return function(_0x3c650e){logger[_0xfac8('0x26')](_0x3c650e[_0xfac8('0x27')]);if(_0x3c650e[_0xfac8('0x28')]){delete _0x3c650e[_0xfac8('0x28')];}_0x51b41c[_0xfac8('0x18')](_0x52f103)[_0xfac8('0x29')](_0x3c650e);};}exports[_0xfac8('0x2a')]=function(_0x1d0f3e,_0x592906){var _0xe9dadf={},_0x421ac5={},_0x2d0010={'count':0x0,'rows':[]};var _0x27343e=_[_0xfac8('0x2b')](db[_0xfac8('0x2c')]['rawAttributes'],function(_0x39d5a1){return{'name':_0x39d5a1[_0xfac8('0x2d')],'type':_0x39d5a1[_0xfac8('0x2e')][_0xfac8('0x2f')]};});_0x421ac5[_0xfac8('0x30')]=_[_0xfac8('0x2b')](_0x27343e,'name');_0x421ac5[_0xfac8('0x31')]=_['keys'](_0x1d0f3e[_0xfac8('0x31')]);_0x421ac5['filters']=_[_0xfac8('0x32')](_0x421ac5[_0xfac8('0x30')],_0x421ac5[_0xfac8('0x31')]);_0xe9dadf['attributes']=_[_0xfac8('0x32')](_0x421ac5['model'],qs[_0xfac8('0x33')](_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x33')]));_0xe9dadf[_0xfac8('0x34')]=_0xe9dadf['attributes'][_0xfac8('0x35')]?_0xe9dadf[_0xfac8('0x34')]:_0x421ac5[_0xfac8('0x30')];if(!_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x36')](_0xfac8('0x37'))){_0xe9dadf[_0xfac8('0x38')]=qs[_0xfac8('0x38')](_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x38')]);_0xe9dadf['offset']=qs[_0xfac8('0x1a')](_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x1a')]);}_0xe9dadf['order']=qs[_0xfac8('0x39')](_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x39')]);_0xe9dadf['where']=qs[_0xfac8('0x3a')](_[_0xfac8('0x3b')](_0x1d0f3e[_0xfac8('0x31')],_0x421ac5[_0xfac8('0x3a')]),_0x27343e);if(_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x3c')]){_0xe9dadf[_0xfac8('0x3d')]=_['merge'](_0xe9dadf[_0xfac8('0x3d')],{'$or':_['map'](_0x27343e,function(_0x3e85d2){if(_0x3e85d2['type']!==_0xfac8('0x3e')){var _0x334e61={};_0x334e61[_0x3e85d2[_0xfac8('0x28')]]={'$like':'%'+_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x3c')]+'%'};return _0x334e61;}})});}_0xe9dadf=_['merge']({},_0xe9dadf,_0x1d0f3e[_0xfac8('0x3f')]);var _0x3cd6d1={'where':_0xe9dadf[_0xfac8('0x3d')]};return db[_0xfac8('0x2c')][_0xfac8('0x1c')](_0x3cd6d1)[_0xfac8('0x23')](function(_0x58d7f8){_0x2d0010[_0xfac8('0x1c')]=_0x58d7f8;if(_0x1d0f3e[_0xfac8('0x31')][_0xfac8('0x40')]){_0xe9dadf[_0xfac8('0x41')]=[{'all':!![]}];}return db[_0xfac8('0x2c')][_0xfac8('0x42')](_0xe9dadf);})[_0xfac8('0x23')](function(_0x13e4d1){_0x2d0010['rows']=_0x13e4d1;return _0x2d0010;})[_0xfac8('0x23')](respondWithFilteredResult(_0x592906,_0xe9dadf))[_0xfac8('0x43')](handleError(_0x592906,null));};exports[_0xfac8('0x44')]=function(_0x55da12,_0x3cd03b){var _0x460851={'raw':!![],'where':{'id':_0x55da12[_0xfac8('0x45')]['id']}},_0x1416b5={};_0x1416b5[_0xfac8('0x30')]=_['keys'](db[_0xfac8('0x2c')][_0xfac8('0x46')]);_0x1416b5[_0xfac8('0x31')]=_['keys'](_0x55da12[_0xfac8('0x31')]);_0x1416b5[_0xfac8('0x3a')]=_[_0xfac8('0x32')](_0x1416b5[_0xfac8('0x30')],_0x1416b5[_0xfac8('0x31')]);_0x460851[_0xfac8('0x34')]=_['intersection'](_0x1416b5['model'],qs['fields'](_0x55da12[_0xfac8('0x31')][_0xfac8('0x33')]));_0x460851[_0xfac8('0x34')]=_0x460851[_0xfac8('0x34')]['length']?_0x460851[_0xfac8('0x34')]:_0x1416b5[_0xfac8('0x30')];if(_0x55da12['query'][_0xfac8('0x40')]){_0x460851[_0xfac8('0x41')]=[{'all':!![]}];}_0x460851=_[_0xfac8('0x47')]({},_0x460851,_0x55da12[_0xfac8('0x3f')]);return db['SquareOdbc']['find'](_0x460851)[_0xfac8('0x23')](handleEntityNotFound(_0x3cd03b,null))[_0xfac8('0x23')](respondWithResult(_0x3cd03b,null))['catch'](handleError(_0x3cd03b,null));};exports[_0xfac8('0x48')]=function(_0x5b0899,_0x56bfd3){return db[_0xfac8('0x2c')]['create'](_0x5b0899[_0xfac8('0x49')],{})[_0xfac8('0x23')](function(_0x46e4f4){var _0x4c4273=_0x5b0899[_0xfac8('0x4a')][_0xfac8('0x24')]({'plain':!![]});if(!_0x4c4273)throw new Error(_0xfac8('0x4b'));if(_0x4c4273['role']===_0xfac8('0x4a')){var _0x5ea9a3=_0x46e4f4['get']({'plain':!![]});var _0x41a2db=_0xfac8('0x4c');return db[_0xfac8('0x4d')]['find']({'where':{'name':_0x41a2db,'userProfileId':_0x4c4273[_0xfac8('0x4e')]},'raw':!![]})[_0xfac8('0x23')](function(_0xc74e){if(_0xc74e&&_0xc74e[_0xfac8('0x4f')]===0x0){return db[_0xfac8('0x25')]['create']({'name':_0x5ea9a3[_0xfac8('0x28')],'resourceId':_0x5ea9a3['id'],'type':_0xc74e[_0xfac8('0x28')],'sectionId':_0xc74e['id']},{})[_0xfac8('0x23')](function(){return _0x46e4f4;});}else{return _0x46e4f4;}})[_0xfac8('0x43')](function(_0x3029d6){logger[_0xfac8('0x26')](_0xfac8('0x50'),_0x3029d6);throw _0x3029d6;});}return _0x46e4f4;})['then'](respondWithResult(_0x56bfd3,0xc9))[_0xfac8('0x43')](handleError(_0x56bfd3,null));};exports['update']=function(_0x16b036,_0x220754){if(_0x16b036['body']['id']){delete _0x16b036[_0xfac8('0x49')]['id'];}return db[_0xfac8('0x2c')][_0xfac8('0x51')]({'where':{'id':_0x16b036[_0xfac8('0x45')]['id']}})['then'](handleEntityNotFound(_0x220754,null))['then'](saveUpdates(_0x16b036[_0xfac8('0x49')],null))['then'](respondWithResult(_0x220754,null))[_0xfac8('0x43')](handleError(_0x220754,null));};exports[_0xfac8('0x22')]=function(_0xc3d044,_0x48f198){return db[_0xfac8('0x2c')][_0xfac8('0x51')]({'where':{'id':_0xc3d044['params']['id']}})[_0xfac8('0x23')](handleEntityNotFound(_0x48f198,null))[_0xfac8('0x23')](removeEntity(_0x48f198,null))['catch'](handleError(_0x48f198,null));};exports[_0xfac8('0x52')]=function(_0x4584f6,_0x216cfe,_0x363b4f){var _0x162255;return db[_0xfac8('0x2c')][_0xfac8('0x51')]({'where':{'id':_0x4584f6[_0xfac8('0x45')]['id']},'attributes':['id',_0xfac8('0x53')]})[_0xfac8('0x23')](handleEntityNotFound(_0x216cfe,null))[_0xfac8('0x23')](function(_0x3e446f){if(_0x3e446f){var _0x43b2a7=require(_0xfac8('0x54'))();_0x43b2a7[_0xfac8('0x55')](_0x3e446f[_0xfac8('0x53')]);_0x43b2a7[_0xfac8('0x56')]();return _0x3e446f;}})[_0xfac8('0x23')](respondWithResult(_0x216cfe,null))[_0xfac8('0x43')](handleError(_0x216cfe,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b7c394e..e63a625 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 _0xedf2=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1c17f2,_0xdda2f1){var _0x213d19=function(_0xda6068){while(--_0xda6068){_0x1c17f2['push'](_0x1c17f2['shift']());}};_0x213d19(++_0xdda2f1);}(_0xedf2,0xa2));var _0x2edf=function(_0x30891e,_0x54666a){_0x30891e=_0x30891e-0x0;var _0x240e23=_0xedf2[_0x30891e];return _0x240e23;};'use strict';var _=require('lodash');var util=require(_0x2edf('0x0'));var logger=require('../../config/logger')(_0x2edf('0x1'));var moment=require(_0x2edf('0x2'));var BPromise=require(_0x2edf('0x3'));var rp=require(_0x2edf('0x4'));var fs=require('fs');var path=require(_0x2edf('0x5'));var rimraf=require(_0x2edf('0x6'));var config=require(_0x2edf('0x7'));var attributes=require(_0x2edf('0x8'));module[_0x2edf('0x9')]=function(_0x2d5e6f,_0x47531c){return _0x2d5e6f[_0x2edf('0xa')](_0x2edf('0xb'),attributes,{'tableName':_0x2edf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd920=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x573d89,_0x4cb34f){var _0x41e1ad=function(_0xbab0b1){while(--_0xbab0b1){_0x573d89['push'](_0x573d89['shift']());}};_0x41e1ad(++_0x4cb34f);}(_0xd920,0x165));var _0x0d92=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xd920[_0x146a97];return _0x259d5c;};'use strict';var _=require('lodash');var util=require(_0x0d92('0x0'));var logger=require(_0x0d92('0x1'))('api');var moment=require(_0x0d92('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d92('0x3'));var fs=require('fs');var path=require(_0x0d92('0x4'));var rimraf=require(_0x0d92('0x5'));var config=require(_0x0d92('0x6'));var attributes=require(_0x0d92('0x7'));module[_0x0d92('0x8')]=function(_0x7ec088,_0x3d04d6){return _0x7ec088[_0x0d92('0x9')](_0x0d92('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index f87c876..f55253e 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 _0x8122=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','then','lodash','util','moment'];(function(_0x216f7d,_0x496249){var _0xc49d7f=function(_0x27be52){while(--_0x27be52){_0x216f7d['push'](_0x216f7d['shift']());}};_0xc49d7f(++_0x496249);}(_0x8122,0x12f));var _0x2812=function(_0x47d1e3,_0x2f8342){_0x47d1e3=_0x47d1e3-0x0;var _0xca9cf=_0x8122[_0x47d1e3];return _0xca9cf;};'use strict';var _=require(_0x2812('0x0'));var util=require(_0x2812('0x1'));var moment=require(_0x2812('0x2'));var BPromise=require(_0x2812('0x3'));var rs=require(_0x2812('0x4'));var fs=require('fs');var Redis=require(_0x2812('0x5'));var db=require(_0x2812('0x6'))['db'];var utils=require(_0x2812('0x7'));var logger=require('../../config/logger')(_0x2812('0x8'));var config=require(_0x2812('0x9'));var jayson=require(_0x2812('0xa'));var client=jayson[_0x2812('0xb')][_0x2812('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ee7c6,_0x268006,_0x43a7da){return new BPromise(function(_0x85b5fe,_0x12f6c8){return client[_0x2812('0xd')](_0x3ee7c6,_0x43a7da)['then'](function(_0x42d1b4){logger['info'](_0x2812('0xe'),_0x268006,_0x2812('0xf'));logger[_0x2812('0x10')](_0x2812('0x11'),_0x268006,_0x2812('0xf'),JSON[_0x2812('0x12')](_0x42d1b4));if(_0x42d1b4[_0x2812('0x13')]){if(_0x42d1b4[_0x2812('0x13')][_0x2812('0x14')]===0x1f4){logger[_0x2812('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x268006,_0x42d1b4[_0x2812('0x13')][_0x2812('0x15')]);return _0x12f6c8(_0x42d1b4[_0x2812('0x13')][_0x2812('0x15')]);}logger[_0x2812('0x13')](_0x2812('0xe'),_0x268006,_0x42d1b4[_0x2812('0x13')][_0x2812('0x15')]);return _0x85b5fe(_0x42d1b4[_0x2812('0x13')][_0x2812('0x15')]);}else{logger[_0x2812('0x16')](_0x2812('0xe'),_0x268006,'request\x20sent');_0x85b5fe(_0x42d1b4['result'][_0x2812('0x15')]);}})[_0x2812('0x17')](function(_0x121db8){logger[_0x2812('0x13')](_0x2812('0xe'),_0x268006,_0x121db8);_0x12f6c8(_0x121db8);});});}exports[_0x2812('0x18')]=function(_0x27b457){var _0x237df7=this;return new Promise(function(_0x574749,_0x504e52){return db[_0x2812('0x19')][_0x2812('0x1a')]({'raw':_0x27b457[_0x2812('0x1b')]?_0x27b457[_0x2812('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x27b457[_0x2812('0x1b')]?_0x27b457[_0x2812('0x1b')][_0x2812('0x1c')]||null:null,'attributes':_0x27b457[_0x2812('0x1b')]?_0x27b457[_0x2812('0x1b')][_0x2812('0x1d')]||null:null,'include':_0x27b457[_0x2812('0x1b')]?_0x27b457[_0x2812('0x1b')][_0x2812('0x1e')]?_[_0x2812('0x1f')](_0x27b457['options'][_0x2812('0x1e')],function(_0x2385db){return{'model':db[_0x2385db[_0x2812('0x20')]],'as':_0x2385db['as'],'attributes':_0x2385db[_0x2812('0x1d')],'include':_0x2385db['include']?_['map'](_0x2385db[_0x2812('0x1e')],function(_0x2178d5){return{'model':db[_0x2178d5['model']],'as':_0x2178d5['as'],'attributes':_0x2178d5[_0x2812('0x1d')],'include':_0x2178d5[_0x2812('0x1e')]?_[_0x2812('0x1f')](_0x2178d5[_0x2812('0x1e')],function(_0x20afc5){return{'model':db[_0x20afc5[_0x2812('0x20')]],'as':_0x20afc5['as'],'attributes':_0x20afc5[_0x2812('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2812('0x21')](function(_0x5a400d){logger[_0x2812('0x16')](_0x2812('0x18'),_0x27b457);logger[_0x2812('0x10')](_0x2812('0x18'),_0x27b457,JSON[_0x2812('0x12')](_0x5a400d));_0x574749(_0x5a400d);})[_0x2812('0x17')](function(_0x3b5459){logger['error'](_0x2812('0x18'),_0x3b5459['message'],_0x27b457);_0x504e52(_0x237df7['error'](0x1f4,_0x3b5459[_0x2812('0x15')]));});});}; \ No newline at end of file +var _0x0e61=['then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','include','model','map','attributes'];(function(_0xe0cad,_0x54bdb7){var _0x4013db=function(_0x420a5){while(--_0x420a5){_0xe0cad['push'](_0xe0cad['shift']());}};_0x4013db(++_0x54bdb7);}(_0x0e61,0x9e));var _0x10e6=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x0e61[_0x8c8176];return _0x4dc47b;};'use strict';var _=require(_0x10e6('0x0'));var util=require(_0x10e6('0x1'));var moment=require(_0x10e6('0x2'));var BPromise=require(_0x10e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10e6('0x4'));var db=require(_0x10e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10e6('0x6'));var config=require(_0x10e6('0x7'));var jayson=require(_0x10e6('0x8'));var client=jayson['client'][_0x10e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x218755,_0x3bde3d,_0x15fc07){return new BPromise(function(_0x541410,_0x28e632){return client[_0x10e6('0xa')](_0x218755,_0x15fc07)['then'](function(_0x2ec47f){logger[_0x10e6('0xb')](_0x10e6('0xc'),_0x3bde3d,_0x10e6('0xd'));logger['debug'](_0x10e6('0xe'),_0x3bde3d,_0x10e6('0xd'),JSON['stringify'](_0x2ec47f));if(_0x2ec47f['error']){if(_0x2ec47f[_0x10e6('0xf')]['code']===0x1f4){logger[_0x10e6('0xf')](_0x10e6('0xc'),_0x3bde3d,_0x2ec47f[_0x10e6('0xf')][_0x10e6('0x10')]);return _0x28e632(_0x2ec47f[_0x10e6('0xf')][_0x10e6('0x10')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3bde3d,_0x2ec47f[_0x10e6('0xf')]['message']);return _0x541410(_0x2ec47f['error'][_0x10e6('0x10')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3bde3d,_0x10e6('0xd'));_0x541410(_0x2ec47f[_0x10e6('0x11')]['message']);}})[_0x10e6('0x12')](function(_0x4546d6){logger['error'](_0x10e6('0xc'),_0x3bde3d,_0x4546d6);_0x28e632(_0x4546d6);});});}exports[_0x10e6('0x13')]=function(_0x4d9131){var _0x39a0f8=this;return new Promise(function(_0x356050,_0xf86a69){return db[_0x10e6('0x14')][_0x10e6('0x15')]({'raw':_0x4d9131[_0x10e6('0x16')]?_0x4d9131['options'][_0x10e6('0x17')]===undefined?!![]:![]:!![],'where':_0x4d9131[_0x10e6('0x16')]?_0x4d9131[_0x10e6('0x16')]['where']||null:null,'attributes':_0x4d9131['options']?_0x4d9131[_0x10e6('0x16')]['attributes']||null:null,'include':_0x4d9131[_0x10e6('0x16')]?_0x4d9131[_0x10e6('0x16')][_0x10e6('0x18')]?_['map'](_0x4d9131[_0x10e6('0x16')][_0x10e6('0x18')],function(_0x2c8bdf){return{'model':db[_0x2c8bdf[_0x10e6('0x19')]],'as':_0x2c8bdf['as'],'attributes':_0x2c8bdf['attributes'],'include':_0x2c8bdf[_0x10e6('0x18')]?_[_0x10e6('0x1a')](_0x2c8bdf[_0x10e6('0x18')],function(_0x165529){return{'model':db[_0x165529[_0x10e6('0x19')]],'as':_0x165529['as'],'attributes':_0x165529[_0x10e6('0x1b')],'include':_0x165529[_0x10e6('0x18')]?_['map'](_0x165529[_0x10e6('0x18')],function(_0x5165af){return{'model':db[_0x5165af[_0x10e6('0x19')]],'as':_0x5165af['as'],'attributes':_0x5165af[_0x10e6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x10e6('0x1c')](function(_0x5e0a41){logger[_0x10e6('0xb')](_0x10e6('0x13'),_0x4d9131);logger[_0x10e6('0x1d')](_0x10e6('0x13'),_0x4d9131,JSON[_0x10e6('0x1e')](_0x5e0a41));_0x356050(_0x5e0a41);})['catch'](function(_0x5c15ec){logger[_0x10e6('0xf')](_0x10e6('0x13'),_0x5c15ec['message'],_0x4d9131);_0xf86a69(_0x39a0f8[_0x10e6('0xf')](0x1f4,_0x5c15ec[_0x10e6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 7985a8e..6322a0a 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 _0x6a4d=['isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index'];(function(_0xaa7629,_0x219723){var _0x487c07=function(_0x36959c){while(--_0x36959c){_0xaa7629['push'](_0xaa7629['shift']());}};_0x487c07(++_0x219723);}(_0x6a4d,0x106));var _0xd6a4=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x6a4d[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0xd6a4('0x0'));var util=require('util');var path=require(_0xd6a4('0x1'));var timeout=require(_0xd6a4('0x2'));var express=require(_0xd6a4('0x3'));var router=express[_0xd6a4('0x4')]();var fs_extra=require(_0xd6a4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6a4('0x6'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd6a4('0x7')]);router['get']('/:id',auth[_0xd6a4('0x8')](),controller['show']);router['post']('/',auth[_0xd6a4('0x8')](),controller['create']);router[_0xd6a4('0x9')](_0xd6a4('0xa'),auth[_0xd6a4('0x8')](),controller[_0xd6a4('0xb')]);router[_0xd6a4('0xc')](_0xd6a4('0xa'),auth['isAuthenticated'](),controller[_0xd6a4('0xd')]);module[_0xd6a4('0xe')]=router; \ No newline at end of file +var _0x9827=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x360dc2,_0x843dd0){var _0x32817d=function(_0x427143){while(--_0x427143){_0x360dc2['push'](_0x360dc2['shift']());}};_0x32817d(++_0x843dd0);}(_0x9827,0x75));var _0x7982=function(_0x27fdcc,_0x421cb5){_0x27fdcc=_0x27fdcc-0x0;var _0x17c2de=_0x9827[_0x27fdcc];return _0x17c2de;};'use strict';var multer=require(_0x7982('0x0'));var util=require(_0x7982('0x1'));var path=require(_0x7982('0x2'));var timeout=require(_0x7982('0x3'));var express=require(_0x7982('0x4'));var router=express['Router']();var fs_extra=require(_0x7982('0x5'));var auth=require(_0x7982('0x6'));var interaction=require(_0x7982('0x7'));var config=require(_0x7982('0x8'));var controller=require(_0x7982('0x9'));router[_0x7982('0xa')]('/',auth[_0x7982('0xb')](),controller[_0x7982('0xc')]);router['get'](_0x7982('0xd'),auth[_0x7982('0xb')](),controller[_0x7982('0xe')]);router[_0x7982('0xf')]('/',auth[_0x7982('0xb')](),controller[_0x7982('0x10')]);router[_0x7982('0x11')](_0x7982('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7982('0xd'),auth[_0x7982('0xb')](),controller[_0x7982('0x12')]);module[_0x7982('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f1f5c34..ec57a11 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 _0x6ead=['toString','utf8','production','DATE','sequelize','exports','STRING','BLOB','long','getDataValue','preproduction'];(function(_0x1d5d3f,_0x3a9d08){var _0x6f9221=function(_0x1e9b5d){while(--_0x1e9b5d){_0x1d5d3f['push'](_0x1d5d3f['shift']());}};_0x6f9221(++_0x3a9d08);}(_0x6ead,0x122));var _0xd6ea=function(_0x5cf27d,_0xdac4e9){_0x5cf27d=_0x5cf27d-0x0;var _0xa9450a=_0x6ead[_0x5cf27d];return _0xa9450a;};'use strict';var Sequelize=require(_0xd6ea('0x0'));module[_0xd6ea('0x1')]={'name':{'type':Sequelize[_0xd6ea('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd6ea('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xd6ea('0x3')](_0xd6ea('0x4')),'get':function(){if(this[_0xd6ea('0x5')](_0xd6ea('0x6'))){return this['getDataValue'](_0xd6ea('0x6'))[_0xd6ea('0x7')](_0xd6ea('0x8'));}}},'production':{'type':Sequelize[_0xd6ea('0x3')]('long'),'get':function(){if(this[_0xd6ea('0x5')](_0xd6ea('0x9'))){return this[_0xd6ea('0x5')](_0xd6ea('0x9'))[_0xd6ea('0x7')](_0xd6ea('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xd6ea('0xa')]}}; \ No newline at end of file +var _0x2dcf=['long','production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString'];(function(_0x1b69a4,_0x3e9f5f){var _0x4ab6a6=function(_0x33697){while(--_0x33697){_0x1b69a4['push'](_0x1b69a4['shift']());}};_0x4ab6a6(++_0x3e9f5f);}(_0x2dcf,0x1b0));var _0xf2dc=function(_0x473617,_0x472029){_0x473617=_0x473617-0x0;var _0x537f8e=_0x2dcf[_0x473617];return _0x537f8e;};'use strict';var Sequelize=require(_0xf2dc('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2dc('0x1')],'unique':_0xf2dc('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xf2dc('0x3')]},'preproduction':{'type':Sequelize[_0xf2dc('0x4')]('long'),'get':function(){if(this[_0xf2dc('0x5')](_0xf2dc('0x6'))){return this['getDataValue'](_0xf2dc('0x6'))[_0xf2dc('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xf2dc('0x8')),'get':function(){if(this['getDataValue'](_0xf2dc('0x9'))){return this[_0xf2dc('0x5')](_0xf2dc('0x9'))[_0xf2dc('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0xf2dc('0xa')]},'publishedAt':{'type':Sequelize[_0xf2dc('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 29a0485..f6d50a4 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 _0x2968=['api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','stringify','end','sendStatus','error','stack','name','index','SquareProject','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','publish','production','lodash','ioredis','../../components/parsers/qs'];(function(_0x390074,_0x163058){var _0x18c4c4=function(_0x3fc581){while(--_0x3fc581){_0x390074['push'](_0x390074['shift']());}};_0x18c4c4(++_0x163058);}(_0x2968,0x121));var _0x8296=function(_0x5f1b7a,_0x38b1b2){_0x5f1b7a=_0x5f1b7a-0x0;var _0x476f1a=_0x2968[_0x5f1b7a];return _0x476f1a;};'use strict';var _=require(_0x8296('0x0'));var Redis=require(_0x8296('0x1'));var qs=require(_0x8296('0x2'));var logger=require('../../config/logger')(_0x8296('0x3'));var config=require(_0x8296('0x4'));var db=require(_0x8296('0x5'))['db'];config[_0x8296('0x6')]=_[_0x8296('0x7')](config[_0x8296('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x8296('0x8'))(new Redis(config[_0x8296('0x6')]));require(_0x8296('0x9'))[_0x8296('0xa')](socket);function respondWithResult(_0xe9d7ce,_0x4cf9a9){_0x4cf9a9=_0x4cf9a9||0xc8;return function(_0x1c739a){if(_0x1c739a){return _0xe9d7ce[_0x8296('0xb')](_0x4cf9a9)['json'](_0x1c739a);}};}function respondWithFilteredResult(_0x319f02,_0x14f0e9){return function(_0x1c112a){if(_0x1c112a){var _0x1dab6c=typeof _0x14f0e9[_0x8296('0xc')]===_0x8296('0xd')&&typeof _0x14f0e9[_0x8296('0xe')]==='undefined';var _0x5a1161=_0x1c112a[_0x8296('0xf')];var _0x389448=_0x1dab6c?0x0:_0x14f0e9[_0x8296('0xc')];var _0x82b708=_0x1dab6c?_0x1c112a[_0x8296('0xf')]:_0x14f0e9[_0x8296('0xc')]+_0x14f0e9[_0x8296('0xe')];var _0x4e357c;if(_0x82b708>=_0x5a1161){_0x82b708=_0x5a1161;_0x4e357c=0xc8;}else{_0x4e357c=0xce;}_0x319f02[_0x8296('0xb')](_0x4e357c);return _0x319f02['set'](_0x8296('0x10'),_0x389448+'-'+_0x82b708+'/'+_0x5a1161)[_0x8296('0x11')](_0x1c112a);}return null;};}function saveUpdates(_0x48d50d){return function(_0x1316e7){if(_0x1316e7){return _0x1316e7[_0x8296('0x12')](_0x48d50d)[_0x8296('0x13')](function(_0x5dc069){return _0x5dc069;});}return null;};}function removeEntity(_0x532639){return function(_0x44b4ef){if(_0x44b4ef){return _0x44b4ef[_0x8296('0x14')]()[_0x8296('0x13')](function(){var _0x3901d6=_0x44b4ef[_0x8296('0x15')]({'plain':!![]});var _0x552118=_0x8296('0x16');return db[_0x8296('0x17')]['destroy']({'where':{'type':_0x552118,'resourceId':_0x3901d6['id']}})[_0x8296('0x13')](function(){return _0x44b4ef;});})[_0x8296('0x13')](function(){var _0x43a7a5=new Redis(config[_0x8296('0x6')]);_0x43a7a5['publish']('agi',JSON[_0x8296('0x18')]({'id':_0x44b4ef['id'],'deleted':!![]}));})[_0x8296('0x13')](function(){_0x532639[_0x8296('0xb')](0xcc)[_0x8296('0x19')]();});}};}function handleEntityNotFound(_0x1317ee){return function(_0x4c7e7f){if(!_0x4c7e7f){_0x1317ee[_0x8296('0x1a')](0x194);}return _0x4c7e7f;};}function handleError(_0x414219,_0x3b6c73){_0x3b6c73=_0x3b6c73||0x1f4;return function(_0x52e144){logger[_0x8296('0x1b')](_0x52e144[_0x8296('0x1c')]);if(_0x52e144[_0x8296('0x1d')]){delete _0x52e144[_0x8296('0x1d')];}_0x414219['status'](_0x3b6c73)['send'](_0x52e144);};}exports[_0x8296('0x1e')]=function(_0x173f90,_0x2d7757){var _0xc1dcf2={},_0x128d40={},_0x118d7a={'count':0x0,'rows':[]};var _0x36ca90=_['map'](db[_0x8296('0x1f')]['rawAttributes'],function(_0x59a9ff){return{'name':_0x59a9ff[_0x8296('0x20')],'type':_0x59a9ff[_0x8296('0x21')][_0x8296('0x22')]};});_0x128d40[_0x8296('0x23')]=_['map'](_0x36ca90,_0x8296('0x1d'));_0x128d40['query']=_[_0x8296('0x24')](_0x173f90['query']);_0x128d40[_0x8296('0x25')]=_[_0x8296('0x26')](_0x128d40[_0x8296('0x23')],_0x128d40['query']);_0xc1dcf2[_0x8296('0x27')]=_[_0x8296('0x26')](_0x128d40[_0x8296('0x23')],qs[_0x8296('0x28')](_0x173f90[_0x8296('0x29')]['fields']));_0xc1dcf2[_0x8296('0x27')]=_0xc1dcf2[_0x8296('0x27')][_0x8296('0x2a')]?_0xc1dcf2['attributes']:_0x128d40[_0x8296('0x23')];if(!_0x173f90[_0x8296('0x29')][_0x8296('0x2b')](_0x8296('0x2c'))){_0xc1dcf2[_0x8296('0xe')]=qs[_0x8296('0xe')](_0x173f90[_0x8296('0x29')][_0x8296('0xe')]);_0xc1dcf2[_0x8296('0xc')]=qs[_0x8296('0xc')](_0x173f90[_0x8296('0x29')]['offset']);}_0xc1dcf2[_0x8296('0x2d')]=qs[_0x8296('0x2e')](_0x173f90[_0x8296('0x29')][_0x8296('0x2e')]);_0xc1dcf2[_0x8296('0x2f')]=qs[_0x8296('0x25')](_[_0x8296('0x30')](_0x173f90[_0x8296('0x29')],_0x128d40[_0x8296('0x25')]),_0x36ca90);if(_0x173f90[_0x8296('0x29')]['filter']){_0xc1dcf2[_0x8296('0x2f')]=_[_0x8296('0x31')](_0xc1dcf2[_0x8296('0x2f')],{'$or':_[_0x8296('0x32')](_0x36ca90,function(_0x114c84){if(_0x114c84['type']!==_0x8296('0x33')){var _0xf4db8b={};_0xf4db8b[_0x114c84['name']]={'$like':'%'+_0x173f90[_0x8296('0x29')][_0x8296('0x34')]+'%'};return _0xf4db8b;}})});}_0xc1dcf2=_[_0x8296('0x31')]({},_0xc1dcf2,_0x173f90[_0x8296('0x35')]);var _0x190855={'where':_0xc1dcf2[_0x8296('0x2f')]};return db[_0x8296('0x1f')][_0x8296('0xf')](_0x190855)[_0x8296('0x13')](function(_0x2a31f5){_0x118d7a[_0x8296('0xf')]=_0x2a31f5;if(_0x173f90[_0x8296('0x29')][_0x8296('0x36')]){_0xc1dcf2['include']=[{'all':!![]}];}return db['SquareProject'][_0x8296('0x37')](_0xc1dcf2);})[_0x8296('0x13')](function(_0x1a300e){_0x118d7a['rows']=_0x1a300e;return _0x118d7a;})['then'](respondWithFilteredResult(_0x2d7757,_0xc1dcf2))[_0x8296('0x38')](handleError(_0x2d7757,null));};exports[_0x8296('0x39')]=function(_0x9ab4e6,_0x57a6dd){var _0x13b472={'raw':![],'where':{'id':_0x9ab4e6[_0x8296('0x3a')]['id']}},_0x1355fb={};_0x1355fb[_0x8296('0x23')]=_[_0x8296('0x24')](db[_0x8296('0x1f')][_0x8296('0x3b')]);_0x1355fb[_0x8296('0x29')]=_[_0x8296('0x24')](_0x9ab4e6[_0x8296('0x29')]);_0x1355fb[_0x8296('0x25')]=_[_0x8296('0x26')](_0x1355fb['model'],_0x1355fb[_0x8296('0x29')]);_0x13b472[_0x8296('0x27')]=_['intersection'](_0x1355fb[_0x8296('0x23')],qs['fields'](_0x9ab4e6['query']['fields']));_0x13b472[_0x8296('0x27')]=_0x13b472[_0x8296('0x27')][_0x8296('0x2a')]?_0x13b472['attributes']:_0x1355fb[_0x8296('0x23')];if(_0x9ab4e6['query']['includeAll']){_0x13b472[_0x8296('0x3c')]=[{'all':!![]}];}_0x13b472=_['merge']({},_0x13b472,_0x9ab4e6[_0x8296('0x35')]);return db[_0x8296('0x1f')]['find'](_0x13b472)[_0x8296('0x13')](handleEntityNotFound(_0x57a6dd,null))[_0x8296('0x13')](respondWithResult(_0x57a6dd,null))['catch'](handleError(_0x57a6dd,null));};exports[_0x8296('0x3d')]=function(_0x387643,_0x2ec3b6){return db['SquareProject'][_0x8296('0x3d')](_0x387643['body'],{})[_0x8296('0x13')](function(_0x74d84e){var _0x459de9=_0x387643['user'][_0x8296('0x15')]({'plain':!![]});if(!_0x459de9)throw new Error(_0x8296('0x3e'));if(_0x459de9[_0x8296('0x3f')]===_0x8296('0x40')){var _0x3be064=_0x74d84e[_0x8296('0x15')]({'plain':!![]});var _0x186552='SquareProjects';return db[_0x8296('0x41')][_0x8296('0x42')]({'where':{'name':_0x186552,'userProfileId':_0x459de9[_0x8296('0x43')]},'raw':!![]})[_0x8296('0x13')](function(_0x3c9ba6){if(_0x3c9ba6&&_0x3c9ba6[_0x8296('0x44')]===0x0){return db[_0x8296('0x17')]['create']({'name':_0x3be064[_0x8296('0x1d')],'resourceId':_0x3be064['id'],'type':_0x3c9ba6[_0x8296('0x1d')],'sectionId':_0x3c9ba6['id']},{})[_0x8296('0x13')](function(){return _0x74d84e;});}else{return _0x74d84e;}})[_0x8296('0x38')](function(_0x1463d7){logger[_0x8296('0x1b')](_0x8296('0x45'),_0x1463d7);throw _0x1463d7;});}return _0x74d84e;})[_0x8296('0x13')](respondWithResult(_0x2ec3b6,0xc9))[_0x8296('0x38')](handleError(_0x2ec3b6,null));};exports['update']=function(_0x5b23c8,_0x3f3e25){if(_0x5b23c8[_0x8296('0x46')]['id']){delete _0x5b23c8[_0x8296('0x46')]['id'];}return db['SquareProject'][_0x8296('0x42')]({'where':{'id':_0x5b23c8[_0x8296('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3f3e25,null))[_0x8296('0x13')](saveUpdates(_0x5b23c8[_0x8296('0x46')],null))[_0x8296('0x13')](function(_0x5cc219){if(!_0x5cc219)return;var _0x2b519d=_0x5cc219[_0x8296('0x15')]({'plain':!![]});return _0x2b519d;})[_0x8296('0x13')](function(_0x30ae61){var _0x1e14a9=new Redis(config['redis']);_0x1e14a9[_0x8296('0x47')]('agi',JSON['stringify'](_['pick'](_0x30ae61,['id','name',_0x8296('0x48')])));return _0x30ae61;})['then'](respondWithResult(_0x3f3e25,null))[_0x8296('0x38')](handleError(_0x3f3e25,null));};exports[_0x8296('0x14')]=function(_0x20dce3,_0x2927d2){return db[_0x8296('0x1f')][_0x8296('0x42')]({'where':{'id':_0x20dce3[_0x8296('0x3a')]['id']}})[_0x8296('0x13')](handleEntityNotFound(_0x2927d2,null))[_0x8296('0x13')](removeEntity(_0x2927d2,null))['catch'](handleError(_0x2927d2,null));}; \ No newline at end of file +var _0x8845=['publish','then','end','sendStatus','error','stack','name','send','index','map','SquareProject','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','./squareProject.socket','register','json','undefined','count','offset','limit','status','Content-Range','destroy','get','SquareProjects','UserProfileResource'];(function(_0x484e47,_0x155a54){var _0x5c6ea5=function(_0x312683){while(--_0x312683){_0x484e47['push'](_0x484e47['shift']());}};_0x5c6ea5(++_0x155a54);}(_0x8845,0x13a));var _0x5884=function(_0x2499e1,_0x46cedd){_0x2499e1=_0x2499e1-0x0;var _0x26cf27=_0x8845[_0x2499e1];return _0x26cf27;};'use strict';var _=require(_0x5884('0x0'));var Redis=require(_0x5884('0x1'));var qs=require(_0x5884('0x2'));var logger=require(_0x5884('0x3'))(_0x5884('0x4'));var config=require('../../config/environment');var db=require(_0x5884('0x5'))['db'];config[_0x5884('0x6')]=_[_0x5884('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5884('0x8'))[_0x5884('0x9')](socket);function respondWithResult(_0x196f1f,_0x677baf){_0x677baf=_0x677baf||0xc8;return function(_0x2c1299){if(_0x2c1299){return _0x196f1f['status'](_0x677baf)[_0x5884('0xa')](_0x2c1299);}};}function respondWithFilteredResult(_0x5bbda2,_0x4c4b75){return function(_0x500ca4){if(_0x500ca4){var _0x50ce47=typeof _0x4c4b75['offset']===_0x5884('0xb')&&typeof _0x4c4b75['limit']===_0x5884('0xb');var _0x559d6c=_0x500ca4[_0x5884('0xc')];var _0x4691ca=_0x50ce47?0x0:_0x4c4b75[_0x5884('0xd')];var _0x2d0253=_0x50ce47?_0x500ca4['count']:_0x4c4b75[_0x5884('0xd')]+_0x4c4b75[_0x5884('0xe')];var _0x6ec0e7;if(_0x2d0253>=_0x559d6c){_0x2d0253=_0x559d6c;_0x6ec0e7=0xc8;}else{_0x6ec0e7=0xce;}_0x5bbda2[_0x5884('0xf')](_0x6ec0e7);return _0x5bbda2['set'](_0x5884('0x10'),_0x4691ca+'-'+_0x2d0253+'/'+_0x559d6c)['json'](_0x500ca4);}return null;};}function saveUpdates(_0x388927){return function(_0x15d85b){if(_0x15d85b){return _0x15d85b['update'](_0x388927)['then'](function(_0x2f0fb7){return _0x2f0fb7;});}return null;};}function removeEntity(_0xfbf1d9){return function(_0x2a5249){if(_0x2a5249){return _0x2a5249[_0x5884('0x11')]()['then'](function(){var _0x2c76a4=_0x2a5249[_0x5884('0x12')]({'plain':!![]});var _0x45c6ce=_0x5884('0x13');return db[_0x5884('0x14')][_0x5884('0x11')]({'where':{'type':_0x45c6ce,'resourceId':_0x2c76a4['id']}})['then'](function(){return _0x2a5249;});})['then'](function(){var _0x48345a=new Redis(config[_0x5884('0x6')]);_0x48345a[_0x5884('0x15')]('agi',JSON['stringify']({'id':_0x2a5249['id'],'deleted':!![]}));})[_0x5884('0x16')](function(){_0xfbf1d9[_0x5884('0xf')](0xcc)[_0x5884('0x17')]();});}};}function handleEntityNotFound(_0x1facb9){return function(_0x1ac845){if(!_0x1ac845){_0x1facb9[_0x5884('0x18')](0x194);}return _0x1ac845;};}function handleError(_0x57de1a,_0xe509d4){_0xe509d4=_0xe509d4||0x1f4;return function(_0xa3a628){logger[_0x5884('0x19')](_0xa3a628[_0x5884('0x1a')]);if(_0xa3a628[_0x5884('0x1b')]){delete _0xa3a628[_0x5884('0x1b')];}_0x57de1a[_0x5884('0xf')](_0xe509d4)[_0x5884('0x1c')](_0xa3a628);};}exports[_0x5884('0x1d')]=function(_0x290a56,_0x2563b7){var _0x5481fe={},_0x55c9a6={},_0x6f593d={'count':0x0,'rows':[]};var _0x4602fe=_[_0x5884('0x1e')](db[_0x5884('0x1f')]['rawAttributes'],function(_0x22a404){return{'name':_0x22a404[_0x5884('0x20')],'type':_0x22a404[_0x5884('0x21')][_0x5884('0x22')]};});_0x55c9a6[_0x5884('0x23')]=_[_0x5884('0x1e')](_0x4602fe,_0x5884('0x1b'));_0x55c9a6['query']=_['keys'](_0x290a56[_0x5884('0x24')]);_0x55c9a6[_0x5884('0x25')]=_['intersection'](_0x55c9a6['model'],_0x55c9a6[_0x5884('0x24')]);_0x5481fe[_0x5884('0x26')]=_['intersection'](_0x55c9a6['model'],qs[_0x5884('0x27')](_0x290a56['query'][_0x5884('0x27')]));_0x5481fe[_0x5884('0x26')]=_0x5481fe['attributes'][_0x5884('0x28')]?_0x5481fe[_0x5884('0x26')]:_0x55c9a6[_0x5884('0x23')];if(!_0x290a56['query'][_0x5884('0x29')]('nolimit')){_0x5481fe[_0x5884('0xe')]=qs[_0x5884('0xe')](_0x290a56[_0x5884('0x24')][_0x5884('0xe')]);_0x5481fe[_0x5884('0xd')]=qs[_0x5884('0xd')](_0x290a56[_0x5884('0x24')][_0x5884('0xd')]);}_0x5481fe[_0x5884('0x2a')]=qs['sort'](_0x290a56[_0x5884('0x24')]['sort']);_0x5481fe['where']=qs[_0x5884('0x25')](_[_0x5884('0x2b')](_0x290a56['query'],_0x55c9a6[_0x5884('0x25')]),_0x4602fe);if(_0x290a56[_0x5884('0x24')][_0x5884('0x2c')]){_0x5481fe['where']=_[_0x5884('0x2d')](_0x5481fe[_0x5884('0x2e')],{'$or':_[_0x5884('0x1e')](_0x4602fe,function(_0x4fdc3f){if(_0x4fdc3f[_0x5884('0x21')]!==_0x5884('0x2f')){var _0x3a0b71={};_0x3a0b71[_0x4fdc3f[_0x5884('0x1b')]]={'$like':'%'+_0x290a56[_0x5884('0x24')][_0x5884('0x2c')]+'%'};return _0x3a0b71;}})});}_0x5481fe=_[_0x5884('0x2d')]({},_0x5481fe,_0x290a56[_0x5884('0x30')]);var _0x2aa560={'where':_0x5481fe['where']};return db[_0x5884('0x1f')]['count'](_0x2aa560)[_0x5884('0x16')](function(_0x3d001c){_0x6f593d[_0x5884('0xc')]=_0x3d001c;if(_0x290a56['query']['includeAll']){_0x5481fe[_0x5884('0x31')]=[{'all':!![]}];}return db[_0x5884('0x1f')][_0x5884('0x32')](_0x5481fe);})[_0x5884('0x16')](function(_0x218ce7){_0x6f593d['rows']=_0x218ce7;return _0x6f593d;})['then'](respondWithFilteredResult(_0x2563b7,_0x5481fe))[_0x5884('0x33')](handleError(_0x2563b7,null));};exports[_0x5884('0x34')]=function(_0x30e266,_0x5c51fa){var _0x56b6fe={'raw':![],'where':{'id':_0x30e266[_0x5884('0x35')]['id']}},_0x3bf570={};_0x3bf570[_0x5884('0x23')]=_[_0x5884('0x36')](db[_0x5884('0x1f')][_0x5884('0x37')]);_0x3bf570[_0x5884('0x24')]=_[_0x5884('0x36')](_0x30e266[_0x5884('0x24')]);_0x3bf570[_0x5884('0x25')]=_['intersection'](_0x3bf570[_0x5884('0x23')],_0x3bf570[_0x5884('0x24')]);_0x56b6fe[_0x5884('0x26')]=_[_0x5884('0x38')](_0x3bf570[_0x5884('0x23')],qs[_0x5884('0x27')](_0x30e266['query']['fields']));_0x56b6fe[_0x5884('0x26')]=_0x56b6fe[_0x5884('0x26')][_0x5884('0x28')]?_0x56b6fe[_0x5884('0x26')]:_0x3bf570[_0x5884('0x23')];if(_0x30e266['query'][_0x5884('0x39')]){_0x56b6fe[_0x5884('0x31')]=[{'all':!![]}];}_0x56b6fe=_[_0x5884('0x2d')]({},_0x56b6fe,_0x30e266[_0x5884('0x30')]);return db[_0x5884('0x1f')]['find'](_0x56b6fe)['then'](handleEntityNotFound(_0x5c51fa,null))[_0x5884('0x16')](respondWithResult(_0x5c51fa,null))[_0x5884('0x33')](handleError(_0x5c51fa,null));};exports['create']=function(_0x4c268a,_0x120604){return db[_0x5884('0x1f')][_0x5884('0x3a')](_0x4c268a[_0x5884('0x3b')],{})[_0x5884('0x16')](function(_0x4f9365){var _0x3c5ec7=_0x4c268a[_0x5884('0x3c')][_0x5884('0x12')]({'plain':!![]});if(!_0x3c5ec7)throw new Error(_0x5884('0x3d'));if(_0x3c5ec7['role']==='user'){var _0x2257a7=_0x4f9365[_0x5884('0x12')]({'plain':!![]});var _0x16a4d3=_0x5884('0x13');return db['UserProfileSection'][_0x5884('0x3e')]({'where':{'name':_0x16a4d3,'userProfileId':_0x3c5ec7['userProfileId']},'raw':!![]})[_0x5884('0x16')](function(_0x46fdd0){if(_0x46fdd0&&_0x46fdd0[_0x5884('0x3f')]===0x0){return db[_0x5884('0x14')][_0x5884('0x3a')]({'name':_0x2257a7['name'],'resourceId':_0x2257a7['id'],'type':_0x46fdd0[_0x5884('0x1b')],'sectionId':_0x46fdd0['id']},{})[_0x5884('0x16')](function(){return _0x4f9365;});}else{return _0x4f9365;}})[_0x5884('0x33')](function(_0x17616a){logger['error'](_0x5884('0x40'),_0x17616a);throw _0x17616a;});}return _0x4f9365;})[_0x5884('0x16')](respondWithResult(_0x120604,0xc9))[_0x5884('0x33')](handleError(_0x120604,null));};exports['update']=function(_0x1dd8cc,_0xff9252){if(_0x1dd8cc[_0x5884('0x3b')]['id']){delete _0x1dd8cc[_0x5884('0x3b')]['id'];}return db[_0x5884('0x1f')][_0x5884('0x3e')]({'where':{'id':_0x1dd8cc[_0x5884('0x35')]['id']}})[_0x5884('0x16')](handleEntityNotFound(_0xff9252,null))['then'](saveUpdates(_0x1dd8cc[_0x5884('0x3b')],null))[_0x5884('0x16')](function(_0x1a195f){if(!_0x1a195f)return;var _0xe978e6=_0x1a195f[_0x5884('0x12')]({'plain':!![]});return _0xe978e6;})[_0x5884('0x16')](function(_0x3bd07b){var _0x627749=new Redis(config[_0x5884('0x6')]);_0x627749[_0x5884('0x15')](_0x5884('0x41'),JSON[_0x5884('0x42')](_[_0x5884('0x2b')](_0x3bd07b,['id',_0x5884('0x1b'),'production'])));return _0x3bd07b;})[_0x5884('0x16')](respondWithResult(_0xff9252,null))[_0x5884('0x33')](handleError(_0xff9252,null));};exports[_0x5884('0x11')]=function(_0x207bf8,_0x57a203){return db[_0x5884('0x1f')]['find']({'where':{'id':_0x207bf8[_0x5884('0x35')]['id']}})['then'](handleEntityNotFound(_0x57a203,null))[_0x5884('0x16')](removeEntity(_0x57a203,null))[_0x5884('0x33')](handleError(_0x57a203,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index afb5102..4fe8c2d 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 _0xeca3=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0xeca3,0x13f));var _0x3eca=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeca3[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x3eca('0x0'));var SquareProject=require(_0x3eca('0x1'))['db'][_0x3eca('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3eca('0x3')](0x0);var events={'afterCreate':_0x3eca('0x4'),'afterUpdate':_0x3eca('0x5'),'afterDestroy':_0x3eca('0x6')};function emitEvent(_0x526c55){return function(_0x3ce3c6,_0x152d09,_0x428e4b){SquareProjectEvents[_0x3eca('0x7')](_0x526c55+':'+_0x3ce3c6['id'],_0x3ce3c6);SquareProjectEvents[_0x3eca('0x7')](_0x526c55,_0x3ce3c6);_0x428e4b(null);};}for(var e in events){if(events[_0x3eca('0x8')](e)){var event=events[e];SquareProject[_0x3eca('0x9')](e,emitEvent(event));}}module[_0x3eca('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x259a=['events','SquareProject','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x259a,0x188));var _0xa259=function(_0x6b888e,_0x420fed){_0x6b888e=_0x6b888e-0x0;var _0x17d0f6=_0x259a[_0x6b888e];return _0x17d0f6;};'use strict';var EventEmitter=require(_0xa259('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa259('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa259('0x2'),'afterUpdate':_0xa259('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e2f1a){return function(_0xbee06c,_0x359be2,_0x174844){SquareProjectEvents[_0xa259('0x4')](_0x1e2f1a+':'+_0xbee06c['id'],_0xbee06c);SquareProjectEvents['emit'](_0x1e2f1a,_0xbee06c);_0x174844(null);};}for(var e in events){if(events[_0xa259('0x5')](e)){var event=events[e];SquareProject[_0xa259('0x6')](e,emitEvent(event));}}module[_0xa259('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 b236547..7fb46cb 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 _0xf1f5=['../../config/environment','./squareProject.attributes','exports','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x476b62,_0x4429e1){var _0x2c8c6c=function(_0x51ab17){while(--_0x51ab17){_0x476b62['push'](_0x476b62['shift']());}};_0x2c8c6c(++_0x4429e1);}(_0xf1f5,0x19d));var _0x5f1f=function(_0x2008ee,_0xe5f904){_0x2008ee=_0x2008ee-0x0;var _0x25dede=_0xf1f5[_0x2008ee];return _0x25dede;};'use strict';var _=require(_0x5f1f('0x0'));var util=require('util');var logger=require(_0x5f1f('0x1'))(_0x5f1f('0x2'));var moment=require(_0x5f1f('0x3'));var BPromise=require(_0x5f1f('0x4'));var rp=require(_0x5f1f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f1f('0x6'));var config=require(_0x5f1f('0x7'));var attributes=require(_0x5f1f('0x8'));module[_0x5f1f('0x9')]=function(_0x436570,_0x44ae22){return _0x436570['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x431299,_0x41e6cc,_0x3ed025){if(_0x431299[_0x5f1f('0xa')]('preproduction')){_0x431299[_0x5f1f('0xb')]=moment()[_0x5f1f('0xc')](_0x5f1f('0xd'));}if(_0x431299['changed'](_0x5f1f('0xe'))){_0x431299['publishedAt']=moment()[_0x5f1f('0xc')](_0x5f1f('0xd'));}_0x3ed025(null,_0x431299);}}});}; \ No newline at end of file +var _0x8ba5=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','format','changed','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x44dee8,_0x3b349c){var _0x16c381=function(_0x3ec729){while(--_0x3ec729){_0x44dee8['push'](_0x44dee8['shift']());}};_0x16c381(++_0x3b349c);}(_0x8ba5,0x1de));var _0x58ba=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0x8ba5[_0x177dc7];return _0x19b7dc;};'use strict';var _=require(_0x58ba('0x0'));var util=require(_0x58ba('0x1'));var logger=require(_0x58ba('0x2'))(_0x58ba('0x3'));var moment=require(_0x58ba('0x4'));var BPromise=require(_0x58ba('0x5'));var rp=require(_0x58ba('0x6'));var fs=require('fs');var path=require(_0x58ba('0x7'));var rimraf=require('rimraf');var config=require(_0x58ba('0x8'));var attributes=require('./squareProject.attributes');module[_0x58ba('0x9')]=function(_0x56856e,_0x1803e2){return _0x56856e['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe8eb2,_0x2c7b98,_0x1571e6){if(_0xe8eb2['changed']('preproduction')){_0xe8eb2['savedAt']=moment()[_0x58ba('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xe8eb2[_0x58ba('0xb')](_0x58ba('0xc'))){_0xe8eb2[_0x58ba('0xd')]=moment()[_0x58ba('0xa')](_0x58ba('0xe'));}_0x1571e6(null,_0xe8eb2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4c2c0f0..fb58ac0 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 _0x399f=['message','ShowSquareProject','find','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error'];(function(_0x3726a8,_0x15f69d){var _0x48fd45=function(_0x14691a){while(--_0x14691a){_0x3726a8['push'](_0x3726a8['shift']());}};_0x48fd45(++_0x15f69d);}(_0x399f,0xbd));var _0xf399=function(_0x5dff0c,_0x51df58){_0x5dff0c=_0x5dff0c-0x0;var _0x2a58f7=_0x399f[_0x5dff0c];return _0x2a58f7;};'use strict';var _=require(_0xf399('0x0'));var Redis=require(_0xf399('0x1'));var db=require(_0xf399('0x2'))['db'];var logger=require(_0xf399('0x3'))('rpc');var config=require(_0xf399('0x4'));config[_0xf399('0x5')]=_[_0xf399('0x6')](config[_0xf399('0x5')],{'host':_0xf399('0x7'),'port':0x18eb});var socket=require(_0xf399('0x8'))(new Redis(config[_0xf399('0x5')]));require(_0xf399('0x9'))[_0xf399('0xa')](socket);exports[_0xf399('0xb')]=function(_0x37adac){var _0x354dbe=this;return new Promise(function(_0x605a08,_0x986cc2){return db[_0xf399('0xc')][_0xf399('0xd')]({'raw':_0x37adac['options']?_0x37adac[_0xf399('0xe')][_0xf399('0xf')]===undefined?!![]:![]:!![],'where':_0x37adac[_0xf399('0xe')]?_0x37adac['options'][_0xf399('0x10')]||null:null,'attributes':_0x37adac[_0xf399('0xe')]?_0x37adac['options'][_0xf399('0x11')]||null:null,'limit':_0x37adac['options']?_0x37adac[_0xf399('0xe')][_0xf399('0x12')]||null:null,'include':_0x37adac['options']?_0x37adac[_0xf399('0xe')]['include']?_['map'](_0x37adac[_0xf399('0xe')][_0xf399('0x13')],function(_0x40c6b1){return{'model':db[_0x40c6b1['model']],'as':_0x40c6b1['as'],'attributes':_0x40c6b1[_0xf399('0x11')],'include':_0x40c6b1[_0xf399('0x13')]?_['map'](_0x40c6b1[_0xf399('0x13')],function(_0x505774){return{'model':db[_0x505774['model']],'as':_0x505774['as'],'attributes':_0x505774[_0xf399('0x11')],'include':_0x505774['include']?_[_0xf399('0x14')](_0x505774[_0xf399('0x13')],function(_0x5d01d3){return{'model':db[_0x5d01d3[_0xf399('0x15')]],'as':_0x5d01d3['as'],'attributes':_0x5d01d3[_0xf399('0x11')]};}):[]};}):[]};}):[]:[]})[_0xf399('0x16')](function(_0x31e588){logger[_0xf399('0x17')]('GetSquareProjects',_0x37adac);logger[_0xf399('0x18')](_0xf399('0xb'),_0x37adac,JSON[_0xf399('0x19')](_0x31e588));_0x605a08(_0x31e588);})[_0xf399('0x1a')](function(_0x1338e){logger[_0xf399('0x1b')](_0xf399('0xb'),_0x1338e[_0xf399('0x1c')],_0x37adac);_0x986cc2(_0x354dbe[_0xf399('0x1b')](0x1f4,_0x1338e['message']));});});};exports[_0xf399('0x1d')]=function(_0x3001a9){var _0xcbd525=this;return new Promise(function(_0x4b32e2,_0x2a7238){return db['SquareProject'][_0xf399('0x1e')]({'raw':_0x3001a9['options']?_0x3001a9[_0xf399('0xe')][_0xf399('0xf')]===undefined?!![]:![]:!![],'where':_0x3001a9['options']?_0x3001a9[_0xf399('0xe')][_0xf399('0x10')]||null:null,'attributes':_0x3001a9[_0xf399('0xe')]?_0x3001a9[_0xf399('0xe')][_0xf399('0x11')]||null:null,'include':_0x3001a9['options']?_0x3001a9[_0xf399('0xe')]['include']?_[_0xf399('0x14')](_0x3001a9['options'][_0xf399('0x13')],function(_0x293f95){return{'model':db[_0x293f95[_0xf399('0x15')]],'as':_0x293f95['as'],'attributes':_0x293f95[_0xf399('0x11')],'include':_0x293f95['include']?_[_0xf399('0x14')](_0x293f95[_0xf399('0x13')],function(_0x3e2ace){return{'model':db[_0x3e2ace[_0xf399('0x15')]],'as':_0x3e2ace['as'],'attributes':_0x3e2ace[_0xf399('0x11')],'include':_0x3e2ace['include']?_[_0xf399('0x14')](_0x3e2ace[_0xf399('0x13')],function(_0x474e26){return{'model':db[_0x474e26[_0xf399('0x15')]],'as':_0x474e26['as'],'attributes':_0x474e26[_0xf399('0x11')]};}):[]};}):[]};}):[]:[]})[_0xf399('0x16')](function(_0x3a6a94){logger[_0xf399('0x17')](_0xf399('0x1d'),_0x3001a9);logger[_0xf399('0x18')](_0xf399('0x1d'),_0x3001a9,JSON[_0xf399('0x19')](_0x3a6a94));_0x4b32e2(_0x3a6a94);})[_0xf399('0x1a')](function(_0x2a539a){logger['error'](_0xf399('0x1d'),_0x2a539a[_0xf399('0x1c')],_0x3001a9);_0x2a7238(_0xcbd525[_0xf399('0x1b')](0x1f4,_0x2a539a[_0xf399('0x1c')]));});});}; \ No newline at end of file +var _0x2c23=['map','info','stringify','catch','message','error','ShowSquareProject','find','lodash','ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','raw','where','include','model','attributes'];(function(_0x5c2d40,_0x1884d9){var _0x2fb71b=function(_0x2a01dc){while(--_0x2a01dc){_0x5c2d40['push'](_0x5c2d40['shift']());}};_0x2fb71b(++_0x1884d9);}(_0x2c23,0xf2));var _0x32c2=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0x2c23[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require(_0x32c2('0x0'));var Redis=require(_0x32c2('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x32c2('0x2'));var config=require(_0x32c2('0x3'));config[_0x32c2('0x4')]=_[_0x32c2('0x5')](config['redis'],{'host':_0x32c2('0x6'),'port':0x18eb});var socket=require(_0x32c2('0x7'))(new Redis(config[_0x32c2('0x4')]));require(_0x32c2('0x8'))['register'](socket);exports[_0x32c2('0x9')]=function(_0x3f2cc3){var _0x41474e=this;return new Promise(function(_0x47b4ae,_0xefb0eb){return db[_0x32c2('0xa')][_0x32c2('0xb')]({'raw':_0x3f2cc3[_0x32c2('0xc')]?_0x3f2cc3[_0x32c2('0xc')][_0x32c2('0xd')]===undefined?!![]:![]:!![],'where':_0x3f2cc3[_0x32c2('0xc')]?_0x3f2cc3[_0x32c2('0xc')][_0x32c2('0xe')]||null:null,'attributes':_0x3f2cc3[_0x32c2('0xc')]?_0x3f2cc3[_0x32c2('0xc')]['attributes']||null:null,'limit':_0x3f2cc3[_0x32c2('0xc')]?_0x3f2cc3[_0x32c2('0xc')]['limit']||null:null,'include':_0x3f2cc3[_0x32c2('0xc')]?_0x3f2cc3['options']['include']?_['map'](_0x3f2cc3[_0x32c2('0xc')][_0x32c2('0xf')],function(_0x336f52){return{'model':db[_0x336f52[_0x32c2('0x10')]],'as':_0x336f52['as'],'attributes':_0x336f52[_0x32c2('0x11')],'include':_0x336f52[_0x32c2('0xf')]?_[_0x32c2('0x12')](_0x336f52[_0x32c2('0xf')],function(_0x3714ac){return{'model':db[_0x3714ac[_0x32c2('0x10')]],'as':_0x3714ac['as'],'attributes':_0x3714ac[_0x32c2('0x11')],'include':_0x3714ac[_0x32c2('0xf')]?_[_0x32c2('0x12')](_0x3714ac['include'],function(_0x580c3a){return{'model':db[_0x580c3a[_0x32c2('0x10')]],'as':_0x580c3a['as'],'attributes':_0x580c3a[_0x32c2('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x985819){logger[_0x32c2('0x13')](_0x32c2('0x9'),_0x3f2cc3);logger['debug'](_0x32c2('0x9'),_0x3f2cc3,JSON[_0x32c2('0x14')](_0x985819));_0x47b4ae(_0x985819);})[_0x32c2('0x15')](function(_0x3d7511){logger['error'](_0x32c2('0x9'),_0x3d7511[_0x32c2('0x16')],_0x3f2cc3);_0xefb0eb(_0x41474e[_0x32c2('0x17')](0x1f4,_0x3d7511[_0x32c2('0x16')]));});});};exports[_0x32c2('0x18')]=function(_0x425359){var _0x5bf01c=this;return new Promise(function(_0x5b05fc,_0x2f90a8){return db['SquareProject'][_0x32c2('0x19')]({'raw':_0x425359['options']?_0x425359[_0x32c2('0xc')][_0x32c2('0xd')]===undefined?!![]:![]:!![],'where':_0x425359['options']?_0x425359[_0x32c2('0xc')][_0x32c2('0xe')]||null:null,'attributes':_0x425359[_0x32c2('0xc')]?_0x425359[_0x32c2('0xc')][_0x32c2('0x11')]||null:null,'include':_0x425359[_0x32c2('0xc')]?_0x425359[_0x32c2('0xc')][_0x32c2('0xf')]?_[_0x32c2('0x12')](_0x425359['options'][_0x32c2('0xf')],function(_0xbfa74c){return{'model':db[_0xbfa74c['model']],'as':_0xbfa74c['as'],'attributes':_0xbfa74c[_0x32c2('0x11')],'include':_0xbfa74c[_0x32c2('0xf')]?_[_0x32c2('0x12')](_0xbfa74c[_0x32c2('0xf')],function(_0x2aaf17){return{'model':db[_0x2aaf17[_0x32c2('0x10')]],'as':_0x2aaf17['as'],'attributes':_0x2aaf17['attributes'],'include':_0x2aaf17['include']?_[_0x32c2('0x12')](_0x2aaf17['include'],function(_0x29ec0a){return{'model':db[_0x29ec0a[_0x32c2('0x10')]],'as':_0x29ec0a['as'],'attributes':_0x29ec0a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x253e08){logger['info'](_0x32c2('0x18'),_0x425359);logger['debug'](_0x32c2('0x18'),_0x425359,JSON[_0x32c2('0x14')](_0x253e08));_0x5b05fc(_0x253e08);})['catch'](function(_0x493671){logger['error']('ShowSquareProject',_0x493671[_0x32c2('0x16')],_0x425359);_0x2f90a8(_0x5bf01c['error'](0x1f4,_0x493671[_0x32c2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c096a8c..623f2bb 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 _0xcbb2=['squareProject:','./squareProject.events','save','remove','emit','removeListener','register','length'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0xcbb2,0xd1));var _0x2cbb=function(_0x23e43,_0x572a03){_0x23e43=_0x23e43-0x0;var _0x3b1ae2=_0xcbb2[_0x23e43];return _0x3b1ae2;};'use strict';var SquareProjectEvents=require(_0x2cbb('0x0'));var events=[_0x2cbb('0x1'),_0x2cbb('0x2'),'update'];function createListener(_0x379d64,_0x47577a){return function(_0x41a4af){_0x47577a[_0x2cbb('0x3')](_0x379d64,_0x41a4af);};}function removeListener(_0x5d94cf,_0x117137){return function(){SquareProjectEvents[_0x2cbb('0x4')](_0x5d94cf,_0x117137);};}exports[_0x2cbb('0x5')]=function(_0x43ee2a){for(var _0xe2370b=0x0,_0x507be1=events[_0x2cbb('0x6')];_0xe2370b<_0x507be1;_0xe2370b++){var _0xcbc60a=events[_0xe2370b];var _0x490b40=createListener(_0x2cbb('0x7')+_0xcbc60a,_0x43ee2a);SquareProjectEvents['on'](_0xcbc60a,_0x490b40);}}; \ No newline at end of file +var _0x8bbb=['removeListener','register','length','squareProject:','save','remove','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8bbb,0x1dc));var _0xb8bb=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x8bbb[_0x17bb31];return _0x505c71;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb8bb('0x0'),_0xb8bb('0x1'),_0xb8bb('0x2')];function createListener(_0x44ff02,_0x3548f8){return function(_0xc2594b){_0x3548f8[_0xb8bb('0x3')](_0x44ff02,_0xc2594b);};}function removeListener(_0xb79162,_0x4d09a2){return function(){SquareProjectEvents[_0xb8bb('0x4')](_0xb79162,_0x4d09a2);};}exports[_0xb8bb('0x5')]=function(_0x43bf3b){for(var _0xddeac2=0x0,_0x11a3bd=events[_0xb8bb('0x6')];_0xddeac2<_0x11a3bd;_0xddeac2++){var _0x1b1b38=events[_0xddeac2];var _0x876dc5=createListener(_0xb8bb('0x7')+_0x1b1b38,_0x43bf3b);SquareProjectEvents['on'](_0x1b1b38,_0x876dc5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4d49d9f..180f03d 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x28a244,_0x29cdab){var _0x38c6f5=function(_0x59a1f2){while(--_0x59a1f2){_0x28a244['push'](_0x28a244['shift']());}};_0x38c6f5(++_0x29cdab);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1c445a,_0xea7543){_0x1c445a=_0x1c445a-0x0;var _0x33e4ad=_0x7fbe[_0x1c445a];return _0x33e4ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x253aec,_0x31e9d1){var _0x2417b2=function(_0x5573bf){while(--_0x5573bf){_0x253aec['push'](_0x253aec['shift']());}};_0x2417b2(++_0x31e9d1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x5fc3[_0x125ff8];return _0x2d9ef;};'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')]('/:id',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('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);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 98089e1..b21e8df 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 _0x5fc3=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x5fc3[_0x3f3f40];return _0x403b7a;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'context':{'type':Sequelize[_0x35fc('0x2')]},'extension':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x35fc('0x2')]},'projectName':{'type':Sequelize[_0x35fc('0x2')]},'saveName':{'type':Sequelize[_0x35fc('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x35fc('0x3')],'get':function(){var _0x508b32='';var _0x16e153=this[_0x35fc('0x4')](_0x35fc('0x5'));if(_0x16e153){_0x508b32=_0x16e153[_0x35fc('0x6')](_0x16e153[_0x35fc('0x7')]('.'));}return _0x508b32;}}}; \ No newline at end of file +var _0x5075=['savePath','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x39a6ca,_0x10c9f0){var _0x752c2f=function(_0x3f6ed1){while(--_0x3f6ed1){_0x39a6ca['push'](_0x39a6ca['shift']());}};_0x752c2f(++_0x10c9f0);}(_0x5075,0x73));var _0x5507=function(_0x5d5c49,_0x528f94){_0x5d5c49=_0x5d5c49-0x0;var _0x41cb72=_0x5075[_0x5d5c49];return _0x41cb72;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'callerid':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'extension':{'type':Sequelize[_0x5507('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'dnid':{'type':Sequelize[_0x5507('0x2')]},'projectName':{'type':Sequelize[_0x5507('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x5507('0x2')]},'format':{'type':Sequelize[_0x5507('0x3')],'get':function(){var _0x4c2d6d='';var _0x42c232=this[_0x5507('0x4')](_0x5507('0x5'));if(_0x42c232){_0x4c2d6d=_0x42c232['substring'](_0x42c232['lastIndexOf']('.'));}return _0x4c2d6d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a857483..e91ee02 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 _0x64b3=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','options','findAll','catch','params','length','includeAll','merge','find','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x12baed,_0x45a719){var _0x630772=function(_0x449242){while(--_0x449242){_0x12baed['push'](_0x12baed['shift']());}};_0x630772(++_0x45a719);}(_0x64b3,0xaf));var _0x364b=function(_0x328dda,_0x4a1a95){_0x328dda=_0x328dda-0x0;var _0x4caede=_0x64b3[_0x328dda];return _0x4caede;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x364b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x364b('0x1'));var moment=require(_0x364b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x364b('0x3'));var util=require(_0x364b('0x4'));var path=require('path');var sox=require(_0x364b('0x5'));var csv=require(_0x364b('0x6'));var ejs=require(_0x364b('0x7'));var fs=require('fs');var fs_extra=require(_0x364b('0x8'));var _=require('lodash');var squel=require(_0x364b('0x9'));var crypto=require(_0x364b('0xa'));var jsforce=require(_0x364b('0xb'));var deskjs=require(_0x364b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x364b('0xd'));var Redis=require('ioredis');var authService=require(_0x364b('0xe'));var qs=require(_0x364b('0xf'));var as=require(_0x364b('0x10'));var hardwareService=require(_0x364b('0x11'));var logger=require(_0x364b('0x12'))(_0x364b('0x13'));var utils=require(_0x364b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x364b('0x15'));var db=require(_0x364b('0x16'))['db'];function respondWithStatusCode(_0x4366f5,_0x3f954d){_0x3f954d=_0x3f954d||0xcc;return function(_0x41b3a7){if(_0x41b3a7){return _0x4366f5[_0x364b('0x17')](_0x3f954d);}return _0x4366f5[_0x364b('0x18')](_0x3f954d)[_0x364b('0x19')]();};}function respondWithResult(_0x10d49c,_0xc9a6ab){_0xc9a6ab=_0xc9a6ab||0xc8;return function(_0x2b41ad){if(_0x2b41ad){return _0x10d49c['status'](_0xc9a6ab)[_0x364b('0x1a')](_0x2b41ad);}};}function respondWithFilteredResult(_0x46e42c,_0x568003){return function(_0x19450d){if(_0x19450d){var _0x57313a=typeof _0x568003['offset']===_0x364b('0x1b')&&typeof _0x568003[_0x364b('0x1c')]===_0x364b('0x1b');var _0x3e944f=_0x19450d[_0x364b('0x1d')];var _0x8d0a66=_0x57313a?0x0:_0x568003['offset'];var _0x28f7f7=_0x57313a?_0x19450d[_0x364b('0x1d')]:_0x568003['offset']+_0x568003['limit'];var _0x128778;if(_0x28f7f7>=_0x3e944f){_0x28f7f7=_0x3e944f;_0x128778=0xc8;}else{_0x128778=0xce;}_0x46e42c[_0x364b('0x18')](_0x128778);return _0x46e42c['set'](_0x364b('0x1e'),_0x8d0a66+'-'+_0x28f7f7+'/'+_0x3e944f)[_0x364b('0x1a')](_0x19450d);}return null;};}function patchUpdates(_0x45e072){return function(_0x554e79){try{jsonpatch[_0x364b('0x1f')](_0x554e79,_0x45e072,!![]);}catch(_0x485369){return BPromise[_0x364b('0x20')](_0x485369);}return _0x554e79[_0x364b('0x21')]();};}function saveUpdates(_0x2107f5,_0x2708c4){return function(_0xea7979){if(_0xea7979){return _0xea7979[_0x364b('0x22')](_0x2107f5)[_0x364b('0x23')](function(_0x1b4d7b){return _0x1b4d7b;});}return null;};}function removeEntity(_0xc001ac,_0x206fe2){return function(_0x149f5b){if(_0x149f5b){return _0x149f5b[_0x364b('0x24')]()[_0x364b('0x23')](function(){_0xc001ac['status'](0xcc)[_0x364b('0x19')]();});}};}function handleEntityNotFound(_0x147532,_0x349ae0){return function(_0x304970){if(!_0x304970){_0x147532[_0x364b('0x17')](0x194);}return _0x304970;};}function handleError(_0x584f05,_0x4e17aa){_0x4e17aa=_0x4e17aa||0x1f4;return function(_0x3ad1e8){logger[_0x364b('0x25')](_0x3ad1e8[_0x364b('0x26')]);if(_0x3ad1e8[_0x364b('0x27')]){delete _0x3ad1e8[_0x364b('0x27')];}_0x584f05[_0x364b('0x18')](_0x4e17aa)[_0x364b('0x28')](_0x3ad1e8);};}exports[_0x364b('0x29')]=function(_0x7b4690,_0x34b67d){var _0x31ff5b={},_0x4e89ec={},_0x4424de={'count':0x0,'rows':[]};var _0x5ea93f=_[_0x364b('0x2a')](db[_0x364b('0x2b')][_0x364b('0x2c')],function(_0x5a133b){return{'name':_0x5a133b[_0x364b('0x2d')],'type':_0x5a133b[_0x364b('0x2e')]['key']};});_0x4e89ec[_0x364b('0x2f')]=_['map'](_0x5ea93f,_0x364b('0x27'));_0x4e89ec[_0x364b('0x30')]=_[_0x364b('0x31')](_0x7b4690[_0x364b('0x30')]);_0x4e89ec[_0x364b('0x32')]=_[_0x364b('0x33')](_0x4e89ec[_0x364b('0x2f')],_0x4e89ec['query']);_0x31ff5b[_0x364b('0x34')]=_[_0x364b('0x33')](_0x4e89ec['model'],qs[_0x364b('0x35')](_0x7b4690[_0x364b('0x30')][_0x364b('0x35')]));_0x31ff5b[_0x364b('0x34')]=_0x31ff5b[_0x364b('0x34')]['length']?_0x31ff5b['attributes']:_0x4e89ec[_0x364b('0x2f')];if(!_0x7b4690[_0x364b('0x30')][_0x364b('0x36')](_0x364b('0x37'))){_0x31ff5b[_0x364b('0x1c')]=qs[_0x364b('0x1c')](_0x7b4690[_0x364b('0x30')][_0x364b('0x1c')]);_0x31ff5b[_0x364b('0x38')]=qs[_0x364b('0x38')](_0x7b4690[_0x364b('0x30')][_0x364b('0x38')]);}_0x31ff5b[_0x364b('0x39')]=qs[_0x364b('0x3a')](_0x7b4690[_0x364b('0x30')][_0x364b('0x3a')]);_0x31ff5b[_0x364b('0x3b')]=qs[_0x364b('0x32')](_[_0x364b('0x3c')](_0x7b4690['query'],_0x4e89ec[_0x364b('0x32')]),_0x5ea93f);if(_0x7b4690[_0x364b('0x30')][_0x364b('0x3d')]){_0x31ff5b[_0x364b('0x3b')]=_['merge'](_0x31ff5b[_0x364b('0x3b')],{'$or':_['map'](_0x5ea93f,function(_0x574cdb){if(_0x574cdb['type']!=='VIRTUAL'){var _0x46c8ad={};_0x46c8ad[_0x574cdb[_0x364b('0x27')]]={'$like':'%'+_0x7b4690[_0x364b('0x30')][_0x364b('0x3d')]+'%'};return _0x46c8ad;}})});}_0x31ff5b=_['merge']({},_0x31ff5b,_0x7b4690[_0x364b('0x3e')]);var _0x2e02b7={'where':_0x31ff5b[_0x364b('0x3b')]};return db[_0x364b('0x2b')][_0x364b('0x1d')](_0x2e02b7)[_0x364b('0x23')](function(_0x1a4620){_0x4424de[_0x364b('0x1d')]=_0x1a4620;if(_0x7b4690[_0x364b('0x30')]['includeAll']){_0x31ff5b['include']=[{'all':!![]}];}return db[_0x364b('0x2b')][_0x364b('0x3f')](_0x31ff5b);})[_0x364b('0x23')](function(_0x5b34e9){_0x4424de['rows']=_0x5b34e9;return _0x4424de;})['then'](respondWithFilteredResult(_0x34b67d,_0x31ff5b))[_0x364b('0x40')](handleError(_0x34b67d,null));};exports['show']=function(_0x254d14,_0x415ece){var _0x4a9f2a={'raw':!![],'where':{'id':_0x254d14[_0x364b('0x41')]['id']}},_0x5ef0a1={};_0x5ef0a1[_0x364b('0x2f')]=_['keys'](db['SquareRecording'][_0x364b('0x2c')]);_0x5ef0a1['query']=_['keys'](_0x254d14['query']);_0x5ef0a1[_0x364b('0x32')]=_['intersection'](_0x5ef0a1[_0x364b('0x2f')],_0x5ef0a1[_0x364b('0x30')]);_0x4a9f2a[_0x364b('0x34')]=_[_0x364b('0x33')](_0x5ef0a1[_0x364b('0x2f')],qs[_0x364b('0x35')](_0x254d14[_0x364b('0x30')][_0x364b('0x35')]));_0x4a9f2a[_0x364b('0x34')]=_0x4a9f2a[_0x364b('0x34')][_0x364b('0x42')]?_0x4a9f2a[_0x364b('0x34')]:_0x5ef0a1[_0x364b('0x2f')];if(_0x254d14[_0x364b('0x30')][_0x364b('0x43')]){_0x4a9f2a['include']=[{'all':!![]}];}_0x4a9f2a=_[_0x364b('0x44')]({},_0x4a9f2a,_0x254d14[_0x364b('0x3e')]);return db[_0x364b('0x2b')][_0x364b('0x45')](_0x4a9f2a)[_0x364b('0x23')](handleEntityNotFound(_0x415ece,null))[_0x364b('0x23')](respondWithResult(_0x415ece,null))[_0x364b('0x40')](handleError(_0x415ece,null));};exports[_0x364b('0x46')]=function(_0x29c04f,_0x576ebd){return db['SquareRecording'][_0x364b('0x46')](_0x29c04f[_0x364b('0x47')],{})['then'](respondWithResult(_0x576ebd,0xc9))[_0x364b('0x40')](handleError(_0x576ebd,null));};exports[_0x364b('0x22')]=function(_0x155a80,_0x5cbfbd){if(_0x155a80[_0x364b('0x47')]['id']){delete _0x155a80[_0x364b('0x47')]['id'];}return db[_0x364b('0x2b')][_0x364b('0x45')]({'where':{'id':_0x155a80[_0x364b('0x41')]['id']}})['then'](handleEntityNotFound(_0x5cbfbd,null))[_0x364b('0x23')](saveUpdates(_0x155a80[_0x364b('0x47')],null))[_0x364b('0x23')](respondWithResult(_0x5cbfbd,null))['catch'](handleError(_0x5cbfbd,null));};exports[_0x364b('0x48')]=function(_0x243394,_0x4df258,_0x75ecd0){var _0x5847f7=require('../../components/encryptor');var _0xf0babc=![];var _0x3c4d13={};if(_0x243394[_0x364b('0x30')][_0x364b('0x2e')]&&_0x243394[_0x364b('0x30')][_0x364b('0x2e')]===_0x364b('0x49')){_0x3c4d13['uniqueid']=_0x243394[_0x364b('0x41')]['id'];}else{_0x3c4d13['id']=_0x243394[_0x364b('0x41')]['id'];}return db['SquareRecording'][_0x364b('0x45')]({'where':_0x3c4d13,'attributes':['id',_0x364b('0x4a'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x4df258,null))[_0x364b('0x23')](function(_0x1fc126){if(_0x1fc126){var _0x1487b1=_0x1fc126[_0x364b('0x4a')];var _0x1f2bd7=util[_0x364b('0x4b')](_0x364b('0x4c'),_0x1487b1);if(fs[_0x364b('0x4d')](_0x1f2bd7)){_0xf0babc=!![];return _0x5847f7[_0x364b('0x4e')](_0x1f2bd7,_0x1487b1,config[_0x364b('0x4f')]['recording'])[_0x364b('0x23')](function(){return _0x1fc126;});}return _0x1fc126;}})[_0x364b('0x23')](function(_0x8db988){if(_0x8db988){var _0x7f11cc=_0x8db988[_0x364b('0x4a')];if(!fs[_0x364b('0x4d')](_0x7f11cc)){throw new db['Sequelize'][(_0x364b('0x50'))](_0x364b('0x51'));}if(_0x8db988[_0x364b('0x52')]){return _0x4df258[_0x364b('0x48')](_0x7f11cc,_0x8db988[_0x364b('0x52')]+path['extname'](_0x7f11cc),function(){if(_0xf0babc){fs['unlink'](_0x7f11cc);}});}else{return _0x4df258[_0x364b('0x48')](_0x7f11cc,function(_0x3e2240){if(_0xf0babc){fs[_0x364b('0x53')](_0x7f11cc);}});}}})[_0x364b('0x40')](function(_0x5d686d){if(_0x5d686d[_0x364b('0x54')]===_0x364b('0x51')){_0x4df258[_0x364b('0x18')](0x194)[_0x364b('0x28')](_0x364b('0x55'));}else{return handleError(_0x4df258,null);}});};exports['destroy']=function(_0x2ec36d,_0x400fe5){return db[_0x364b('0x2b')][_0x364b('0x45')]({'where':{'id':_0x2ec36d[_0x364b('0x41')]['id']}})[_0x364b('0x23')](function(_0x30a673){if(_[_0x364b('0x56')](_0x30a673)){throw new ReferenceError(_0x364b('0x57'));}return _0x30a673;})[_0x364b('0x23')](function(_0x28c135){var _0x2a1cd4=_0x28c135[_0x364b('0x4a')];logger['info'](_0x364b('0x58'),_0x2a1cd4);if(!_[_0x364b('0x56')](_0x28c135[_0x364b('0x4a')])&&fs[_0x364b('0x4d')](_0x2a1cd4)){logger[_0x364b('0x59')](_0x364b('0x5a')+_0x2a1cd4+_0x364b('0x5b'));fs[_0x364b('0x5c')](_0x2a1cd4);}_0x2a1cd4=_0x2a1cd4+_0x364b('0x5d');if(!_[_0x364b('0x56')](_0x28c135['savePath'])&&fs[_0x364b('0x4d')](_0x2a1cd4)){logger['info']('File:\x20\x22'+_0x2a1cd4+_0x364b('0x5b'));fs[_0x364b('0x5c')](_0x2a1cd4);}return _0x28c135;})[_0x364b('0x23')](function(_0xfbbc87){if(!_0xfbbc87)throw new InternalError();return _0xfbbc87[_0x364b('0x24')]();})[_0x364b('0x23')](function(){_0x400fe5[_0x364b('0x18')](0xcc)['end']();})['catch'](handleError(_0x400fe5,null));}; \ No newline at end of file +var _0xa314=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','SquareRecording','rows','catch','show','params','options','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','model','query'];(function(_0x412587,_0x4ea099){var _0x2f7f2d=function(_0x104379){while(--_0x104379){_0x412587['push'](_0x412587['shift']());}};_0x2f7f2d(++_0x4ea099);}(_0xa314,0x13f));var _0x4a31=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0xa314[_0x4e783c];return _0x2fbd6d;};'use strict';var emlformat=require(_0x4a31('0x0'));var rimraf=require(_0x4a31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a31('0x2'));var rp=require('request-promise');var moment=require(_0x4a31('0x3'));var BPromise=require(_0x4a31('0x4'));var Mustache=require(_0x4a31('0x5'));var util=require(_0x4a31('0x6'));var path=require(_0x4a31('0x7'));var sox=require('sox');var csv=require(_0x4a31('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a31('0x9'));var squel=require(_0x4a31('0xa'));var crypto=require(_0x4a31('0xb'));var jsforce=require(_0x4a31('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a31('0xd'));var Papa=require(_0x4a31('0xe'));var Redis=require(_0x4a31('0xf'));var authService=require(_0x4a31('0x10'));var qs=require(_0x4a31('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a31('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4a31('0x13'));var config=require(_0x4a31('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122f94,_0x27077b){_0x27077b=_0x27077b||0xcc;return function(_0x4e3d91){if(_0x4e3d91){return _0x122f94[_0x4a31('0x15')](_0x27077b);}return _0x122f94[_0x4a31('0x16')](_0x27077b)[_0x4a31('0x17')]();};}function respondWithResult(_0x117eb8,_0x2bfa55){_0x2bfa55=_0x2bfa55||0xc8;return function(_0x56cb3b){if(_0x56cb3b){return _0x117eb8['status'](_0x2bfa55)[_0x4a31('0x18')](_0x56cb3b);}};}function respondWithFilteredResult(_0x2e3c85,_0x10b783){return function(_0x432181){if(_0x432181){var _0x5a69f1=typeof _0x10b783[_0x4a31('0x19')]===_0x4a31('0x1a')&&typeof _0x10b783[_0x4a31('0x1b')]===_0x4a31('0x1a');var _0x4204f6=_0x432181[_0x4a31('0x1c')];var _0x5ee886=_0x5a69f1?0x0:_0x10b783[_0x4a31('0x19')];var _0x38b342=_0x5a69f1?_0x432181[_0x4a31('0x1c')]:_0x10b783[_0x4a31('0x19')]+_0x10b783[_0x4a31('0x1b')];var _0x17dde9;if(_0x38b342>=_0x4204f6){_0x38b342=_0x4204f6;_0x17dde9=0xc8;}else{_0x17dde9=0xce;}_0x2e3c85[_0x4a31('0x16')](_0x17dde9);return _0x2e3c85[_0x4a31('0x1d')](_0x4a31('0x1e'),_0x5ee886+'-'+_0x38b342+'/'+_0x4204f6)[_0x4a31('0x18')](_0x432181);}return null;};}function patchUpdates(_0x5035a0){return function(_0x4a413e){try{jsonpatch[_0x4a31('0x1f')](_0x4a413e,_0x5035a0,!![]);}catch(_0x517f56){return BPromise[_0x4a31('0x20')](_0x517f56);}return _0x4a413e[_0x4a31('0x21')]();};}function saveUpdates(_0xddc13d,_0x80e8e){return function(_0x3a1153){if(_0x3a1153){return _0x3a1153['update'](_0xddc13d)[_0x4a31('0x22')](function(_0x176289){return _0x176289;});}return null;};}function removeEntity(_0x46e258,_0xa6537){return function(_0x3249bd){if(_0x3249bd){return _0x3249bd[_0x4a31('0x23')]()['then'](function(){_0x46e258['status'](0xcc)[_0x4a31('0x17')]();});}};}function handleEntityNotFound(_0x16ecfa,_0x2e9360){return function(_0x26e723){if(!_0x26e723){_0x16ecfa[_0x4a31('0x15')](0x194);}return _0x26e723;};}function handleError(_0x41c33e,_0x73a1d9){_0x73a1d9=_0x73a1d9||0x1f4;return function(_0x3b25de){logger[_0x4a31('0x24')](_0x3b25de[_0x4a31('0x25')]);if(_0x3b25de[_0x4a31('0x26')]){delete _0x3b25de[_0x4a31('0x26')];}_0x41c33e[_0x4a31('0x16')](_0x73a1d9)[_0x4a31('0x27')](_0x3b25de);};}exports[_0x4a31('0x28')]=function(_0x4712f8,_0x247c9f){var _0x5e4f78={},_0x1454b6={},_0x12c65={'count':0x0,'rows':[]};var _0xd25e80=_[_0x4a31('0x29')](db['SquareRecording'][_0x4a31('0x2a')],function(_0x316c8b){return{'name':_0x316c8b['fieldName'],'type':_0x316c8b['type']['key']};});_0x1454b6[_0x4a31('0x2b')]=_[_0x4a31('0x29')](_0xd25e80,_0x4a31('0x26'));_0x1454b6[_0x4a31('0x2c')]=_[_0x4a31('0x2d')](_0x4712f8[_0x4a31('0x2c')]);_0x1454b6[_0x4a31('0x2e')]=_[_0x4a31('0x2f')](_0x1454b6[_0x4a31('0x2b')],_0x1454b6['query']);_0x5e4f78['attributes']=_[_0x4a31('0x2f')](_0x1454b6[_0x4a31('0x2b')],qs[_0x4a31('0x30')](_0x4712f8[_0x4a31('0x2c')][_0x4a31('0x30')]));_0x5e4f78[_0x4a31('0x31')]=_0x5e4f78[_0x4a31('0x31')][_0x4a31('0x32')]?_0x5e4f78[_0x4a31('0x31')]:_0x1454b6[_0x4a31('0x2b')];if(!_0x4712f8[_0x4a31('0x2c')][_0x4a31('0x33')](_0x4a31('0x34'))){_0x5e4f78[_0x4a31('0x1b')]=qs[_0x4a31('0x1b')](_0x4712f8[_0x4a31('0x2c')]['limit']);_0x5e4f78['offset']=qs[_0x4a31('0x19')](_0x4712f8['query'][_0x4a31('0x19')]);}_0x5e4f78[_0x4a31('0x35')]=qs[_0x4a31('0x36')](_0x4712f8[_0x4a31('0x2c')][_0x4a31('0x36')]);_0x5e4f78[_0x4a31('0x37')]=qs['filters'](_[_0x4a31('0x38')](_0x4712f8[_0x4a31('0x2c')],_0x1454b6['filters']),_0xd25e80);if(_0x4712f8[_0x4a31('0x2c')]['filter']){_0x5e4f78[_0x4a31('0x37')]=_[_0x4a31('0x39')](_0x5e4f78['where'],{'$or':_[_0x4a31('0x29')](_0xd25e80,function(_0x4cea52){if(_0x4cea52[_0x4a31('0x3a')]!=='VIRTUAL'){var _0x496a71={};_0x496a71[_0x4cea52[_0x4a31('0x26')]]={'$like':'%'+_0x4712f8[_0x4a31('0x2c')][_0x4a31('0x3b')]+'%'};return _0x496a71;}})});}_0x5e4f78=_[_0x4a31('0x39')]({},_0x5e4f78,_0x4712f8['options']);var _0x1ee8b5={'where':_0x5e4f78[_0x4a31('0x37')]};return db['SquareRecording']['count'](_0x1ee8b5)['then'](function(_0x1b9482){_0x12c65[_0x4a31('0x1c')]=_0x1b9482;if(_0x4712f8[_0x4a31('0x2c')][_0x4a31('0x3c')]){_0x5e4f78['include']=[{'all':!![]}];}return db[_0x4a31('0x3d')]['findAll'](_0x5e4f78);})['then'](function(_0x1f5287){_0x12c65[_0x4a31('0x3e')]=_0x1f5287;return _0x12c65;})[_0x4a31('0x22')](respondWithFilteredResult(_0x247c9f,_0x5e4f78))[_0x4a31('0x3f')](handleError(_0x247c9f,null));};exports[_0x4a31('0x40')]=function(_0x3b29be,_0x15f2f8){var _0x2aaf3f={'raw':!![],'where':{'id':_0x3b29be[_0x4a31('0x41')]['id']}},_0x2cb6a4={};_0x2cb6a4[_0x4a31('0x2b')]=_[_0x4a31('0x2d')](db[_0x4a31('0x3d')][_0x4a31('0x2a')]);_0x2cb6a4[_0x4a31('0x2c')]=_[_0x4a31('0x2d')](_0x3b29be[_0x4a31('0x2c')]);_0x2cb6a4[_0x4a31('0x2e')]=_['intersection'](_0x2cb6a4[_0x4a31('0x2b')],_0x2cb6a4['query']);_0x2aaf3f[_0x4a31('0x31')]=_['intersection'](_0x2cb6a4['model'],qs[_0x4a31('0x30')](_0x3b29be[_0x4a31('0x2c')][_0x4a31('0x30')]));_0x2aaf3f[_0x4a31('0x31')]=_0x2aaf3f[_0x4a31('0x31')][_0x4a31('0x32')]?_0x2aaf3f[_0x4a31('0x31')]:_0x2cb6a4[_0x4a31('0x2b')];if(_0x3b29be[_0x4a31('0x2c')][_0x4a31('0x3c')]){_0x2aaf3f['include']=[{'all':!![]}];}_0x2aaf3f=_[_0x4a31('0x39')]({},_0x2aaf3f,_0x3b29be[_0x4a31('0x42')]);return db[_0x4a31('0x3d')][_0x4a31('0x43')](_0x2aaf3f)[_0x4a31('0x22')](handleEntityNotFound(_0x15f2f8,null))[_0x4a31('0x22')](respondWithResult(_0x15f2f8,null))[_0x4a31('0x3f')](handleError(_0x15f2f8,null));};exports['create']=function(_0x1873bc,_0x3fbcfb){return db[_0x4a31('0x3d')][_0x4a31('0x44')](_0x1873bc[_0x4a31('0x45')],{})[_0x4a31('0x22')](respondWithResult(_0x3fbcfb,0xc9))[_0x4a31('0x3f')](handleError(_0x3fbcfb,null));};exports[_0x4a31('0x46')]=function(_0x2abede,_0x25c37d){if(_0x2abede['body']['id']){delete _0x2abede['body']['id'];}return db[_0x4a31('0x3d')][_0x4a31('0x43')]({'where':{'id':_0x2abede[_0x4a31('0x41')]['id']}})[_0x4a31('0x22')](handleEntityNotFound(_0x25c37d,null))[_0x4a31('0x22')](saveUpdates(_0x2abede[_0x4a31('0x45')],null))[_0x4a31('0x22')](respondWithResult(_0x25c37d,null))[_0x4a31('0x3f')](handleError(_0x25c37d,null));};exports[_0x4a31('0x47')]=function(_0x142e34,_0x207e49,_0x1b44cc){var _0x3ec8f9=require(_0x4a31('0x48'));var _0x3640ce=![];var _0x29d043={};if(_0x142e34[_0x4a31('0x2c')][_0x4a31('0x3a')]&&_0x142e34[_0x4a31('0x2c')][_0x4a31('0x3a')]===_0x4a31('0x49')){_0x29d043[_0x4a31('0x49')]=_0x142e34['params']['id'];}else{_0x29d043['id']=_0x142e34[_0x4a31('0x41')]['id'];}return db[_0x4a31('0x3d')][_0x4a31('0x43')]({'where':_0x29d043,'attributes':['id',_0x4a31('0x4a'),_0x4a31('0x4b')],'raw':!![]})[_0x4a31('0x22')](handleEntityNotFound(_0x207e49,null))[_0x4a31('0x22')](function(_0xe0c842){if(_0xe0c842){var _0x536f44=_0xe0c842[_0x4a31('0x4a')];var _0x5835a5=util[_0x4a31('0x4c')](_0x4a31('0x4d'),_0x536f44);if(fs['existsSync'](_0x5835a5)){_0x3640ce=!![];return _0x3ec8f9['decryptFile'](_0x5835a5,_0x536f44,config['secrets'][_0x4a31('0x4e')])['then'](function(){return _0xe0c842;});}return _0xe0c842;}})[_0x4a31('0x22')](function(_0x16b829){if(_0x16b829){var _0x16de42=_0x16b829['savePath'];if(!fs[_0x4a31('0x4f')](_0x16de42)){throw new db[(_0x4a31('0x50'))]['ValidationError'](_0x4a31('0x51'));}if(_0x16b829['filename']){return _0x207e49[_0x4a31('0x47')](_0x16de42,_0x16b829[_0x4a31('0x4b')]+path[_0x4a31('0x52')](_0x16de42),function(){if(_0x3640ce){fs[_0x4a31('0x53')](_0x16de42);}});}else{return _0x207e49[_0x4a31('0x47')](_0x16de42,function(_0x3163c9){if(_0x3640ce){fs[_0x4a31('0x53')](_0x16de42);}});}}})[_0x4a31('0x3f')](function(_0xb52948){if(_0xb52948['message']===_0x4a31('0x51')){_0x207e49[_0x4a31('0x16')](0x194)['send']('Not\x20found');}else{return handleError(_0x207e49,null);}});};exports[_0x4a31('0x23')]=function(_0x5ab002,_0x4aad3d){return db['SquareRecording']['find']({'where':{'id':_0x5ab002[_0x4a31('0x41')]['id']}})[_0x4a31('0x22')](function(_0x1c3c54){if(_[_0x4a31('0x54')](_0x1c3c54)){throw new ReferenceError(_0x4a31('0x55'));}return _0x1c3c54;})[_0x4a31('0x22')](function(_0x1bb777){var _0x5384d7=_0x1bb777[_0x4a31('0x4a')];logger[_0x4a31('0x56')](_0x4a31('0x57'),_0x5384d7);if(!_[_0x4a31('0x54')](_0x1bb777[_0x4a31('0x4a')])&&fs[_0x4a31('0x4f')](_0x5384d7)){logger['info']('File:\x20\x22'+_0x5384d7+_0x4a31('0x58'));fs['unlinkSync'](_0x5384d7);}_0x5384d7=_0x5384d7+_0x4a31('0x59');if(!_[_0x4a31('0x54')](_0x1bb777[_0x4a31('0x4a')])&&fs[_0x4a31('0x4f')](_0x5384d7)){logger[_0x4a31('0x56')](_0x4a31('0x5a')+_0x5384d7+_0x4a31('0x58'));fs['unlinkSync'](_0x5384d7);}return _0x1bb777;})[_0x4a31('0x22')](function(_0x4454e9){if(!_0x4454e9)throw new InternalError();return _0x4454e9[_0x4a31('0x23')]();})[_0x4a31('0x22')](function(){_0x4aad3d[_0x4a31('0x16')](0xcc)[_0x4a31('0x17')]();})[_0x4a31('0x3f')](handleError(_0x4aad3d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a29bd75..bfc271f 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 _0x1122=['bluebird','request-promise','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var logger=require(_0x2112('0x1'))(_0x2112('0x2'));var moment=require(_0x2112('0x3'));var BPromise=require(_0x2112('0x4'));var rp=require(_0x2112('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2112('0x6'));var attributes=require('./squareRecording.attributes');module[_0x2112('0x7')]=function(_0x224776,_0x4c7ac4){return _0x224776[_0x2112('0x8')](_0x2112('0x9'),attributes,{'tableName':_0x2112('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8710=['rimraf','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','api','moment','bluebird','path'];(function(_0x472959,_0x330adc){var _0xb65fac=function(_0x54047d){while(--_0x54047d){_0x472959['push'](_0x472959['shift']());}};_0xb65fac(++_0x330adc);}(_0x8710,0x68));var _0x0871=function(_0x237899,_0x4ae30b){_0x237899=_0x237899-0x0;var _0x201dc3=_0x8710[_0x237899];return _0x201dc3;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var logger=require('../../config/logger')(_0x0871('0x2'));var moment=require(_0x0871('0x3'));var BPromise=require(_0x0871('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0871('0x5'));var rimraf=require(_0x0871('0x6'));var config=require('../../config/environment');var attributes=require(_0x0871('0x7'));module['exports']=function(_0x32d76a,_0x42539c){return _0x32d76a[_0x0871('0x8')](_0x0871('0x9'),attributes,{'tableName':_0x0871('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 6107b95..84608ba 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 _0x6c5b=['raw','CreateSquareRecording','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SquareRecording','body','options'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6c5b,0x1ca));var _0xb6c5=function(_0x266bf4,_0xc66f9e){_0x266bf4=_0x266bf4-0x0;var _0x4b5e64=_0x6c5b[_0x266bf4];return _0x4b5e64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb6c5('0x0'));var BPromise=require(_0xb6c5('0x1'));var rs=require(_0xb6c5('0x2'));var fs=require('fs');var Redis=require(_0xb6c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb6c5('0x4'));var config=require(_0xb6c5('0x5'));var jayson=require(_0xb6c5('0x6'));var client=jayson['client'][_0xb6c5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x149262,_0x5c1383,_0x18f5d8){return new BPromise(function(_0xcb1daa,_0x254b86){return client['request'](_0x149262,_0x18f5d8)[_0xb6c5('0x8')](function(_0x4122ea){logger[_0xb6c5('0x9')](_0xb6c5('0xa'),_0x5c1383,'request\x20sent');logger[_0xb6c5('0xb')](_0xb6c5('0xc'),_0x5c1383,_0xb6c5('0xd'),JSON[_0xb6c5('0xe')](_0x4122ea));if(_0x4122ea['error']){if(_0x4122ea[_0xb6c5('0xf')]['code']===0x1f4){logger['error'](_0xb6c5('0xa'),_0x5c1383,_0x4122ea[_0xb6c5('0xf')][_0xb6c5('0x10')]);return _0x254b86(_0x4122ea[_0xb6c5('0xf')][_0xb6c5('0x10')]);}logger[_0xb6c5('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5c1383,_0x4122ea['error'][_0xb6c5('0x10')]);return _0xcb1daa(_0x4122ea[_0xb6c5('0xf')][_0xb6c5('0x10')]);}else{logger[_0xb6c5('0x9')](_0xb6c5('0xa'),_0x5c1383,_0xb6c5('0xd'));_0xcb1daa(_0x4122ea[_0xb6c5('0x11')]['message']);}})[_0xb6c5('0x12')](function(_0x4e07b4){logger[_0xb6c5('0xf')](_0xb6c5('0xa'),_0x5c1383,_0x4e07b4);_0x254b86(_0x4e07b4);});});}exports['CreateSquareRecording']=function(_0x144129){var _0x4608db=this;return new Promise(function(_0x8940dc,_0x55698c){return db[_0xb6c5('0x13')]['create'](_0x144129[_0xb6c5('0x14')],{'raw':_0x144129[_0xb6c5('0x15')]?_0x144129[_0xb6c5('0x15')][_0xb6c5('0x16')]===undefined?!![]:![]:!![]})[_0xb6c5('0x8')](function(_0x35d211){logger[_0xb6c5('0x9')](_0xb6c5('0x17'),_0x144129);logger[_0xb6c5('0xb')](_0xb6c5('0x17'),_0x144129,JSON['stringify'](_0x35d211));_0x8940dc(_0x35d211);})[_0xb6c5('0x12')](function(_0x23420e){logger[_0xb6c5('0xf')]('CreateSquareRecording',_0x23420e[_0xb6c5('0x10')],_0x144129);_0x55698c(_0x4608db[_0xb6c5('0xf')](0x1f4,_0x23420e[_0xb6c5('0x10')]));});});}; \ No newline at end of file +var _0xa829=['http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateSquareRecording','SquareRecording','create','body','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x288dfc,_0x2da6ad){var _0x26bd86=function(_0x475b7d){while(--_0x475b7d){_0x288dfc['push'](_0x288dfc['shift']());}};_0x26bd86(++_0x2da6ad);}(_0xa829,0x1a6));var _0x9a82=function(_0x4116ab,_0x1b460c){_0x4116ab=_0x4116ab-0x0;var _0x6c05e8=_0xa829[_0x4116ab];return _0x6c05e8;};'use strict';var _=require(_0x9a82('0x0'));var util=require(_0x9a82('0x1'));var moment=require(_0x9a82('0x2'));var BPromise=require(_0x9a82('0x3'));var rs=require(_0x9a82('0x4'));var fs=require('fs');var Redis=require(_0x9a82('0x5'));var db=require(_0x9a82('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a82('0x7'));var config=require(_0x9a82('0x8'));var jayson=require(_0x9a82('0x9'));var client=jayson['client'][_0x9a82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2716be,_0x458f1b,_0x3e3ecc){return new BPromise(function(_0x56b1f7,_0x1ce414){return client[_0x9a82('0xb')](_0x2716be,_0x3e3ecc)[_0x9a82('0xc')](function(_0x4438fd){logger[_0x9a82('0xd')](_0x9a82('0xe'),_0x458f1b,_0x9a82('0xf'));logger[_0x9a82('0x10')](_0x9a82('0x11'),_0x458f1b,_0x9a82('0xf'),JSON[_0x9a82('0x12')](_0x4438fd));if(_0x4438fd[_0x9a82('0x13')]){if(_0x4438fd[_0x9a82('0x13')]['code']===0x1f4){logger['error'](_0x9a82('0xe'),_0x458f1b,_0x4438fd['error'][_0x9a82('0x14')]);return _0x1ce414(_0x4438fd[_0x9a82('0x13')][_0x9a82('0x14')]);}logger[_0x9a82('0x13')](_0x9a82('0xe'),_0x458f1b,_0x4438fd['error'][_0x9a82('0x14')]);return _0x56b1f7(_0x4438fd[_0x9a82('0x13')][_0x9a82('0x14')]);}else{logger['info'](_0x9a82('0xe'),_0x458f1b,_0x9a82('0xf'));_0x56b1f7(_0x4438fd['result'][_0x9a82('0x14')]);}})['catch'](function(_0x23f73c){logger['error'](_0x9a82('0xe'),_0x458f1b,_0x23f73c);_0x1ce414(_0x23f73c);});});}exports[_0x9a82('0x15')]=function(_0x2d7433){var _0x4f26d6=this;return new Promise(function(_0x4d7f30,_0x295c04){return db[_0x9a82('0x16')][_0x9a82('0x17')](_0x2d7433[_0x9a82('0x18')],{'raw':_0x2d7433['options']?_0x2d7433['options'][_0x9a82('0x19')]===undefined?!![]:![]:!![]})[_0x9a82('0xc')](function(_0x4fc9f8){logger[_0x9a82('0xd')](_0x9a82('0x15'),_0x2d7433);logger[_0x9a82('0x10')](_0x9a82('0x15'),_0x2d7433,JSON['stringify'](_0x4fc9f8));_0x4d7f30(_0x4fc9f8);})[_0x9a82('0x1a')](function(_0x582d1d){logger[_0x9a82('0x13')](_0x9a82('0x15'),_0x582d1d['message'],_0x2d7433);_0x295c04(_0x4f26d6['error'](0x1f4,_0x582d1d[_0x9a82('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 26f3495..cff69f6 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(_0x54ba5c,_0x38cc7a){var _0xdb96be=function(_0x544c81){while(--_0x544c81){_0x54ba5c['push'](_0x54ba5c['shift']());}};_0xdb96be(++_0x38cc7a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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(_0x133540,_0x30c16e){var _0x17dac7=function(_0x2a5871){while(--_0x2a5871){_0x133540['push'](_0x133540['shift']());}};_0x17dac7(++_0x30c16e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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 37de24d..df8c60a 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 _0x3209=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x151132,_0x32026a){var _0x13c2ad=function(_0x4dcd81){while(--_0x4dcd81){_0x151132['push'](_0x151132['shift']());}};_0x13c2ad(++_0x32026a);}(_0x3209,0x79));var _0x9320=function(_0x3f98ba,_0x42fd5c){_0x3f98ba=_0x3f98ba-0x0;var _0x56086f=_0x3209[_0x3f98ba];return _0x56086f;};'use strict';var Sequelize=require(_0x9320('0x0'));module[_0x9320('0x1')]={'network':{'type':Sequelize[_0x9320('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x9320('0x2')]},'channel':{'type':Sequelize[_0x9320('0x2')]},'language':{'type':Sequelize[_0x9320('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9320('0x2')]},'version':{'type':Sequelize[_0x9320('0x2')]},'callerid':{'type':Sequelize[_0x9320('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x9320('0x2')]},'callingani2':{'type':Sequelize[_0x9320('0x2')]},'callington':{'type':Sequelize[_0x9320('0x2')]},'callingtns':{'type':Sequelize[_0x9320('0x2')]},'dnid':{'type':Sequelize[_0x9320('0x2')]},'rdnis':{'type':Sequelize[_0x9320('0x2')]},'context':{'type':Sequelize[_0x9320('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x9320('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x9320('0x2')]},'project_name':{'type':Sequelize[_0x9320('0x2')]},'joinAt':{'type':Sequelize[_0x9320('0x3')]},'leaveAt':{'type':Sequelize[_0x9320('0x3')]},'bot':{'type':Sequelize[_0x9320('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6acc=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6acc,0x167));var _0xc6ac=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x6acc[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0xc6ac('0x0'));module[_0xc6ac('0x1')]={'network':{'type':Sequelize[_0xc6ac('0x2')]},'network_script':{'type':Sequelize[_0xc6ac('0x2')]},'request':{'type':Sequelize[_0xc6ac('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc6ac('0x2')]},'type':{'type':Sequelize[_0xc6ac('0x2')]},'uniqueid':{'type':Sequelize[_0xc6ac('0x2')]},'version':{'type':Sequelize[_0xc6ac('0x2')]},'callerid':{'type':Sequelize[_0xc6ac('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xc6ac('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xc6ac('0x2')]},'callingtns':{'type':Sequelize[_0xc6ac('0x2')]},'dnid':{'type':Sequelize[_0xc6ac('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc6ac('0x2')]},'extension':{'type':Sequelize[_0xc6ac('0x2')]},'priority':{'type':Sequelize[_0xc6ac('0x2')]},'enhanced':{'type':Sequelize[_0xc6ac('0x2')]},'accountcode':{'type':Sequelize[_0xc6ac('0x2')]},'threadid':{'type':Sequelize[_0xc6ac('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc6ac('0x3')]},'bot':{'type':Sequelize[_0xc6ac('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 a5b8248..95510a1 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 _0x4ca5=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','update','then','error','name','map','SquareReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3c969e,_0x39f67b){var _0x4e5cdb=function(_0x1f5796){while(--_0x1f5796){_0x3c969e['push'](_0x3c969e['shift']());}};_0x4e5cdb(++_0x39f67b);}(_0x4ca5,0xc6));var _0x54ca=function(_0x3b3dcf,_0x1bd7c8){_0x3b3dcf=_0x3b3dcf-0x0;var _0x45aa71=_0x4ca5[_0x3b3dcf];return _0x45aa71;};'use strict';var emlformat=require(_0x54ca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54ca('0x1'));var rp=require(_0x54ca('0x2'));var moment=require(_0x54ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x54ca('0x4'));var util=require('util');var path=require(_0x54ca('0x5'));var sox=require('sox');var csv=require(_0x54ca('0x6'));var ejs=require(_0x54ca('0x7'));var fs=require('fs');var fs_extra=require(_0x54ca('0x8'));var _=require(_0x54ca('0x9'));var squel=require(_0x54ca('0xa'));var crypto=require(_0x54ca('0xb'));var jsforce=require(_0x54ca('0xc'));var deskjs=require(_0x54ca('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x54ca('0xe'));var Redis=require(_0x54ca('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x54ca('0x10'));var hardwareService=require(_0x54ca('0x11'));var logger=require('../../config/logger')(_0x54ca('0x12'));var utils=require(_0x54ca('0x13'));var config=require(_0x54ca('0x14'));var licenseUtil=require(_0x54ca('0x15'));var db=require(_0x54ca('0x16'))['db'];function respondWithStatusCode(_0x3b7843,_0x4877ff){_0x4877ff=_0x4877ff||0xcc;return function(_0x272139){if(_0x272139){return _0x3b7843[_0x54ca('0x17')](_0x4877ff);}return _0x3b7843['status'](_0x4877ff)[_0x54ca('0x18')]();};}function respondWithResult(_0x34cc7f,_0x58842b){_0x58842b=_0x58842b||0xc8;return function(_0x45ce88){if(_0x45ce88){return _0x34cc7f['status'](_0x58842b)[_0x54ca('0x19')](_0x45ce88);}};}function respondWithFilteredResult(_0x36b77f,_0x272f1d){return function(_0x4b3f1e){if(_0x4b3f1e){var _0x46a145=typeof _0x272f1d[_0x54ca('0x1a')]==='undefined'&&typeof _0x272f1d[_0x54ca('0x1b')]===_0x54ca('0x1c');var _0x33642b=_0x4b3f1e['count'];var _0x84b763=_0x46a145?0x0:_0x272f1d['offset'];var _0x463444=_0x46a145?_0x4b3f1e[_0x54ca('0x1d')]:_0x272f1d[_0x54ca('0x1a')]+_0x272f1d[_0x54ca('0x1b')];var _0x34bb57;if(_0x463444>=_0x33642b){_0x463444=_0x33642b;_0x34bb57=0xc8;}else{_0x34bb57=0xce;}_0x36b77f[_0x54ca('0x1e')](_0x34bb57);return _0x36b77f['set'](_0x54ca('0x1f'),_0x84b763+'-'+_0x463444+'/'+_0x33642b)['json'](_0x4b3f1e);}return null;};}function patchUpdates(_0x3366f6){return function(_0x4ac9a5){try{jsonpatch[_0x54ca('0x20')](_0x4ac9a5,_0x3366f6,!![]);}catch(_0x445329){return BPromise['reject'](_0x445329);}return _0x4ac9a5[_0x54ca('0x21')]();};}function saveUpdates(_0x169987,_0x2297b9){return function(_0x19fc7c){if(_0x19fc7c){return _0x19fc7c[_0x54ca('0x22')](_0x169987)['then'](function(_0x1ba9a0){return _0x1ba9a0;});}return null;};}function removeEntity(_0x482302,_0xb5180c){return function(_0x123d1d){if(_0x123d1d){return _0x123d1d['destroy']()[_0x54ca('0x23')](function(){_0x482302[_0x54ca('0x1e')](0xcc)[_0x54ca('0x18')]();});}};}function handleEntityNotFound(_0xd926af,_0x1f4eb7){return function(_0x1bfcc9){if(!_0x1bfcc9){_0xd926af[_0x54ca('0x17')](0x194);}return _0x1bfcc9;};}function handleError(_0x4be583,_0x5d0552){_0x5d0552=_0x5d0552||0x1f4;return function(_0x3cdc7e){logger[_0x54ca('0x24')](_0x3cdc7e['stack']);if(_0x3cdc7e['name']){delete _0x3cdc7e[_0x54ca('0x25')];}_0x4be583[_0x54ca('0x1e')](_0x5d0552)['send'](_0x3cdc7e);};}exports['index']=function(_0x4ea4b4,_0xefa911){var _0x1013de={},_0x214e62={},_0x2dedd6={'count':0x0,'rows':[]};var _0x2863df=_[_0x54ca('0x26')](db[_0x54ca('0x27')]['rawAttributes'],function(_0x430592){return{'name':_0x430592[_0x54ca('0x28')],'type':_0x430592[_0x54ca('0x29')][_0x54ca('0x2a')]};});_0x214e62[_0x54ca('0x2b')]=_[_0x54ca('0x26')](_0x2863df,_0x54ca('0x25'));_0x214e62[_0x54ca('0x2c')]=_[_0x54ca('0x2d')](_0x4ea4b4[_0x54ca('0x2c')]);_0x214e62['filters']=_['intersection'](_0x214e62[_0x54ca('0x2b')],_0x214e62['query']);_0x1013de[_0x54ca('0x2e')]=_[_0x54ca('0x2f')](_0x214e62[_0x54ca('0x2b')],qs[_0x54ca('0x30')](_0x4ea4b4[_0x54ca('0x2c')][_0x54ca('0x30')]));_0x1013de[_0x54ca('0x2e')]=_0x1013de['attributes'][_0x54ca('0x31')]?_0x1013de[_0x54ca('0x2e')]:_0x214e62['model'];if(!_0x4ea4b4[_0x54ca('0x2c')][_0x54ca('0x32')](_0x54ca('0x33'))){_0x1013de[_0x54ca('0x1b')]=qs[_0x54ca('0x1b')](_0x4ea4b4[_0x54ca('0x2c')]['limit']);_0x1013de[_0x54ca('0x1a')]=qs[_0x54ca('0x1a')](_0x4ea4b4[_0x54ca('0x2c')][_0x54ca('0x1a')]);}_0x1013de[_0x54ca('0x34')]=qs[_0x54ca('0x35')](_0x4ea4b4[_0x54ca('0x2c')][_0x54ca('0x35')]);_0x1013de[_0x54ca('0x36')]=qs[_0x54ca('0x37')](_[_0x54ca('0x38')](_0x4ea4b4['query'],_0x214e62[_0x54ca('0x37')]),_0x2863df);if(_0x4ea4b4[_0x54ca('0x2c')][_0x54ca('0x39')]){_0x1013de[_0x54ca('0x36')]=_[_0x54ca('0x3a')](_0x1013de[_0x54ca('0x36')],{'$or':_[_0x54ca('0x26')](_0x2863df,function(_0xb92ed4){if(_0xb92ed4[_0x54ca('0x29')]!=='VIRTUAL'){var _0x3b2f05={};_0x3b2f05[_0xb92ed4[_0x54ca('0x25')]]={'$like':'%'+_0x4ea4b4['query'][_0x54ca('0x39')]+'%'};return _0x3b2f05;}})});}_0x1013de=_[_0x54ca('0x3a')]({},_0x1013de,_0x4ea4b4[_0x54ca('0x3b')]);var _0xeb4022={'where':_0x1013de[_0x54ca('0x36')]};return db[_0x54ca('0x27')][_0x54ca('0x1d')](_0xeb4022)['then'](function(_0x110265){_0x2dedd6['count']=_0x110265;if(_0x4ea4b4[_0x54ca('0x2c')][_0x54ca('0x3c')]){_0x1013de[_0x54ca('0x3d')]=[{'all':!![]}];}return db[_0x54ca('0x27')][_0x54ca('0x3e')](_0x1013de);})[_0x54ca('0x23')](function(_0x469646){_0x2dedd6[_0x54ca('0x3f')]=_0x469646;return _0x2dedd6;})[_0x54ca('0x23')](respondWithFilteredResult(_0xefa911,_0x1013de))[_0x54ca('0x40')](handleError(_0xefa911,null));};exports['show']=function(_0x1581cb,_0x56aa18){var _0x11fa38={'raw':!![],'where':{'id':_0x1581cb[_0x54ca('0x41')]['id']}},_0x53f13d={};_0x53f13d['model']=_[_0x54ca('0x2d')](db['SquareReport'][_0x54ca('0x42')]);_0x53f13d[_0x54ca('0x2c')]=_[_0x54ca('0x2d')](_0x1581cb['query']);_0x53f13d[_0x54ca('0x37')]=_[_0x54ca('0x2f')](_0x53f13d[_0x54ca('0x2b')],_0x53f13d[_0x54ca('0x2c')]);_0x11fa38[_0x54ca('0x2e')]=_[_0x54ca('0x2f')](_0x53f13d[_0x54ca('0x2b')],qs['fields'](_0x1581cb[_0x54ca('0x2c')][_0x54ca('0x30')]));_0x11fa38['attributes']=_0x11fa38[_0x54ca('0x2e')][_0x54ca('0x31')]?_0x11fa38['attributes']:_0x53f13d[_0x54ca('0x2b')];if(_0x1581cb[_0x54ca('0x2c')][_0x54ca('0x3c')]){_0x11fa38[_0x54ca('0x3d')]=[{'all':!![]}];}_0x11fa38=_['merge']({},_0x11fa38,_0x1581cb[_0x54ca('0x3b')]);return db[_0x54ca('0x27')][_0x54ca('0x43')](_0x11fa38)[_0x54ca('0x23')](handleEntityNotFound(_0x56aa18,null))[_0x54ca('0x23')](respondWithResult(_0x56aa18,null))['catch'](handleError(_0x56aa18,null));};exports[_0x54ca('0x44')]=function(_0x2d50ba,_0x8782e3){return db[_0x54ca('0x27')][_0x54ca('0x44')](_0x2d50ba[_0x54ca('0x45')],{})[_0x54ca('0x23')](respondWithResult(_0x8782e3,0xc9))[_0x54ca('0x40')](handleError(_0x8782e3,null));};exports['update']=function(_0x404b56,_0x201abd){if(_0x404b56[_0x54ca('0x45')]['id']){delete _0x404b56[_0x54ca('0x45')]['id'];}return db['SquareReport'][_0x54ca('0x43')]({'where':{'id':_0x404b56[_0x54ca('0x41')]['id']}})[_0x54ca('0x23')](handleEntityNotFound(_0x201abd,null))['then'](saveUpdates(_0x404b56['body'],null))[_0x54ca('0x23')](respondWithResult(_0x201abd,null))['catch'](handleError(_0x201abd,null));};exports[_0x54ca('0x46')]=function(_0x4d95c3,_0x5668ee){return db[_0x54ca('0x27')][_0x54ca('0x43')]({'where':{'id':_0x4d95c3[_0x54ca('0x41')]['id']}})[_0x54ca('0x23')](handleEntityNotFound(_0x5668ee,null))[_0x54ca('0x23')](removeEntity(_0x5668ee,null))[_0x54ca('0x40')](handleError(_0x5668ee,null));};exports[_0x54ca('0x47')]=function(_0x561d20,_0x7d59b4){return db['SquareReport'][_0x54ca('0x47')]()[_0x54ca('0x23')](respondWithResult(_0x7d59b4,null))[_0x54ca('0x40')](handleError(_0x7d59b4,null));}; \ No newline at end of file +var _0x47ae=['destroy','end','name','send','index','map','SquareReport','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','length','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x1e46e4,_0x311ba4){var _0x2c2b06=function(_0x55c908){while(--_0x55c908){_0x1e46e4['push'](_0x1e46e4['shift']());}};_0x2c2b06(++_0x311ba4);}(_0x47ae,0x100));var _0xe47a=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x47ae[_0x443494];return _0x4a6794;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe47a('0x0'));var zipdir=require(_0xe47a('0x1'));var jsonpatch=require(_0xe47a('0x2'));var rp=require(_0xe47a('0x3'));var moment=require('moment');var BPromise=require(_0xe47a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe47a('0x5'));var sox=require(_0xe47a('0x6'));var csv=require(_0xe47a('0x7'));var ejs=require(_0xe47a('0x8'));var fs=require('fs');var fs_extra=require(_0xe47a('0x9'));var _=require('lodash');var squel=require(_0xe47a('0xa'));var crypto=require(_0xe47a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe47a('0xc'));var toCsv=require(_0xe47a('0x7'));var querystring=require(_0xe47a('0xd'));var Papa=require('papaparse');var Redis=require(_0xe47a('0xe'));var authService=require(_0xe47a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe47a('0x10'));var hardwareService=require(_0xe47a('0x11'));var logger=require(_0xe47a('0x12'))(_0xe47a('0x13'));var utils=require(_0xe47a('0x14'));var config=require(_0xe47a('0x15'));var licenseUtil=require(_0xe47a('0x16'));var db=require(_0xe47a('0x17'))['db'];function respondWithStatusCode(_0x18d9ac,_0x262f59){_0x262f59=_0x262f59||0xcc;return function(_0xa5fe8b){if(_0xa5fe8b){return _0x18d9ac[_0xe47a('0x18')](_0x262f59);}return _0x18d9ac[_0xe47a('0x19')](_0x262f59)['end']();};}function respondWithResult(_0x2a16ba,_0x498561){_0x498561=_0x498561||0xc8;return function(_0x29510f){if(_0x29510f){return _0x2a16ba['status'](_0x498561)['json'](_0x29510f);}};}function respondWithFilteredResult(_0x277b3a,_0x322c49){return function(_0x3fe3be){if(_0x3fe3be){var _0x28bb38=typeof _0x322c49['offset']==='undefined'&&typeof _0x322c49['limit']===_0xe47a('0x1a');var _0x3d8bab=_0x3fe3be[_0xe47a('0x1b')];var _0x312486=_0x28bb38?0x0:_0x322c49[_0xe47a('0x1c')];var _0x45fef9=_0x28bb38?_0x3fe3be[_0xe47a('0x1b')]:_0x322c49[_0xe47a('0x1c')]+_0x322c49[_0xe47a('0x1d')];var _0x2f2ac7;if(_0x45fef9>=_0x3d8bab){_0x45fef9=_0x3d8bab;_0x2f2ac7=0xc8;}else{_0x2f2ac7=0xce;}_0x277b3a[_0xe47a('0x19')](_0x2f2ac7);return _0x277b3a[_0xe47a('0x1e')](_0xe47a('0x1f'),_0x312486+'-'+_0x45fef9+'/'+_0x3d8bab)['json'](_0x3fe3be);}return null;};}function patchUpdates(_0x57dcbe){return function(_0x28b505){try{jsonpatch[_0xe47a('0x20')](_0x28b505,_0x57dcbe,!![]);}catch(_0x4e432f){return BPromise['reject'](_0x4e432f);}return _0x28b505[_0xe47a('0x21')]();};}function saveUpdates(_0x2f299d,_0x417901){return function(_0x44bcad){if(_0x44bcad){return _0x44bcad[_0xe47a('0x22')](_0x2f299d)[_0xe47a('0x23')](function(_0x5188db){return _0x5188db;});}return null;};}function removeEntity(_0x1c06ff,_0xa410d3){return function(_0x2ae7c9){if(_0x2ae7c9){return _0x2ae7c9[_0xe47a('0x24')]()[_0xe47a('0x23')](function(){_0x1c06ff[_0xe47a('0x19')](0xcc)[_0xe47a('0x25')]();});}};}function handleEntityNotFound(_0x2cb4f0,_0x24d2c2){return function(_0x8b8a5d){if(!_0x8b8a5d){_0x2cb4f0[_0xe47a('0x18')](0x194);}return _0x8b8a5d;};}function handleError(_0x1ce449,_0x451901){_0x451901=_0x451901||0x1f4;return function(_0x154f93){logger['error'](_0x154f93['stack']);if(_0x154f93[_0xe47a('0x26')]){delete _0x154f93[_0xe47a('0x26')];}_0x1ce449['status'](_0x451901)[_0xe47a('0x27')](_0x154f93);};}exports[_0xe47a('0x28')]=function(_0x129fa7,_0x435aa3){var _0x2ce539={},_0x201442={},_0x360826={'count':0x0,'rows':[]};var _0x12d852=_[_0xe47a('0x29')](db[_0xe47a('0x2a')]['rawAttributes'],function(_0x324981){return{'name':_0x324981[_0xe47a('0x2b')],'type':_0x324981['type'][_0xe47a('0x2c')]};});_0x201442[_0xe47a('0x2d')]=_[_0xe47a('0x29')](_0x12d852,_0xe47a('0x26'));_0x201442[_0xe47a('0x2e')]=_['keys'](_0x129fa7[_0xe47a('0x2e')]);_0x201442[_0xe47a('0x2f')]=_[_0xe47a('0x30')](_0x201442[_0xe47a('0x2d')],_0x201442['query']);_0x2ce539[_0xe47a('0x31')]=_[_0xe47a('0x30')](_0x201442[_0xe47a('0x2d')],qs[_0xe47a('0x32')](_0x129fa7[_0xe47a('0x2e')][_0xe47a('0x32')]));_0x2ce539[_0xe47a('0x31')]=_0x2ce539[_0xe47a('0x31')]['length']?_0x2ce539[_0xe47a('0x31')]:_0x201442['model'];if(!_0x129fa7[_0xe47a('0x2e')]['hasOwnProperty'](_0xe47a('0x33'))){_0x2ce539[_0xe47a('0x1d')]=qs['limit'](_0x129fa7[_0xe47a('0x2e')][_0xe47a('0x1d')]);_0x2ce539['offset']=qs[_0xe47a('0x1c')](_0x129fa7[_0xe47a('0x2e')][_0xe47a('0x1c')]);}_0x2ce539[_0xe47a('0x34')]=qs['sort'](_0x129fa7[_0xe47a('0x2e')][_0xe47a('0x35')]);_0x2ce539[_0xe47a('0x36')]=qs[_0xe47a('0x2f')](_[_0xe47a('0x37')](_0x129fa7[_0xe47a('0x2e')],_0x201442[_0xe47a('0x2f')]),_0x12d852);if(_0x129fa7[_0xe47a('0x2e')]['filter']){_0x2ce539[_0xe47a('0x36')]=_['merge'](_0x2ce539['where'],{'$or':_[_0xe47a('0x29')](_0x12d852,function(_0x305c00){if(_0x305c00[_0xe47a('0x38')]!=='VIRTUAL'){var _0x1795d7={};_0x1795d7[_0x305c00[_0xe47a('0x26')]]={'$like':'%'+_0x129fa7[_0xe47a('0x2e')][_0xe47a('0x39')]+'%'};return _0x1795d7;}})});}_0x2ce539=_[_0xe47a('0x3a')]({},_0x2ce539,_0x129fa7[_0xe47a('0x3b')]);var _0x119e48={'where':_0x2ce539['where']};return db['SquareReport'][_0xe47a('0x1b')](_0x119e48)[_0xe47a('0x23')](function(_0x14bd6f){_0x360826[_0xe47a('0x1b')]=_0x14bd6f;if(_0x129fa7[_0xe47a('0x2e')][_0xe47a('0x3c')]){_0x2ce539['include']=[{'all':!![]}];}return db[_0xe47a('0x2a')]['findAll'](_0x2ce539);})[_0xe47a('0x23')](function(_0x2a40f6){_0x360826[_0xe47a('0x3d')]=_0x2a40f6;return _0x360826;})[_0xe47a('0x23')](respondWithFilteredResult(_0x435aa3,_0x2ce539))[_0xe47a('0x3e')](handleError(_0x435aa3,null));};exports[_0xe47a('0x3f')]=function(_0x428ba9,_0x20e06a){var _0x10c78a={'raw':!![],'where':{'id':_0x428ba9[_0xe47a('0x40')]['id']}},_0x4fd80f={};_0x4fd80f[_0xe47a('0x2d')]=_[_0xe47a('0x41')](db[_0xe47a('0x2a')][_0xe47a('0x42')]);_0x4fd80f[_0xe47a('0x2e')]=_[_0xe47a('0x41')](_0x428ba9['query']);_0x4fd80f[_0xe47a('0x2f')]=_[_0xe47a('0x30')](_0x4fd80f[_0xe47a('0x2d')],_0x4fd80f[_0xe47a('0x2e')]);_0x10c78a[_0xe47a('0x31')]=_[_0xe47a('0x30')](_0x4fd80f[_0xe47a('0x2d')],qs[_0xe47a('0x32')](_0x428ba9[_0xe47a('0x2e')][_0xe47a('0x32')]));_0x10c78a[_0xe47a('0x31')]=_0x10c78a[_0xe47a('0x31')][_0xe47a('0x43')]?_0x10c78a[_0xe47a('0x31')]:_0x4fd80f['model'];if(_0x428ba9[_0xe47a('0x2e')][_0xe47a('0x3c')]){_0x10c78a[_0xe47a('0x44')]=[{'all':!![]}];}_0x10c78a=_[_0xe47a('0x3a')]({},_0x10c78a,_0x428ba9['options']);return db[_0xe47a('0x2a')]['find'](_0x10c78a)['then'](handleEntityNotFound(_0x20e06a,null))['then'](respondWithResult(_0x20e06a,null))[_0xe47a('0x3e')](handleError(_0x20e06a,null));};exports[_0xe47a('0x45')]=function(_0x44a6e8,_0xc05b6c){return db[_0xe47a('0x2a')][_0xe47a('0x45')](_0x44a6e8['body'],{})[_0xe47a('0x23')](respondWithResult(_0xc05b6c,0xc9))[_0xe47a('0x3e')](handleError(_0xc05b6c,null));};exports[_0xe47a('0x22')]=function(_0x2f6eb9,_0x235d7b){if(_0x2f6eb9[_0xe47a('0x46')]['id']){delete _0x2f6eb9[_0xe47a('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x2f6eb9[_0xe47a('0x40')]['id']}})[_0xe47a('0x23')](handleEntityNotFound(_0x235d7b,null))[_0xe47a('0x23')](saveUpdates(_0x2f6eb9[_0xe47a('0x46')],null))[_0xe47a('0x23')](respondWithResult(_0x235d7b,null))['catch'](handleError(_0x235d7b,null));};exports['destroy']=function(_0x17c063,_0x31f471){return db['SquareReport'][_0xe47a('0x47')]({'where':{'id':_0x17c063[_0xe47a('0x40')]['id']}})['then'](handleEntityNotFound(_0x31f471,null))[_0xe47a('0x23')](removeEntity(_0x31f471,null))[_0xe47a('0x3e')](handleError(_0x31f471,null));};exports[_0xe47a('0x48')]=function(_0x499029,_0x317a18){return db['SquareReport'][_0xe47a('0x48')]()[_0xe47a('0x23')](respondWithResult(_0x317a18,null))['catch'](handleError(_0x317a18,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1f42ded..76b2efe 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 _0xa526=['exports','define','report_square','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3d6a9a,_0x18504f){var _0x5dfbed=function(_0x1b60dd){while(--_0x1b60dd){_0x3d6a9a['push'](_0x3d6a9a['shift']());}};_0x5dfbed(++_0x18504f);}(_0xa526,0x185));var _0x6a52=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xa526[_0x4536a4];return _0x4fd1c1;};'use strict';var _=require(_0x6a52('0x0'));var util=require(_0x6a52('0x1'));var logger=require('../../config/logger')(_0x6a52('0x2'));var moment=require(_0x6a52('0x3'));var BPromise=require(_0x6a52('0x4'));var rp=require(_0x6a52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a52('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x6a52('0x7')]=function(_0x4bc049,_0x32080b){return _0x4bc049[_0x6a52('0x8')]('SquareReport',attributes,{'tableName':_0x6a52('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x6a52('0xa')]},{'name':_0x6a52('0xb'),'fields':[_0x6a52('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62f9=['../../config/environment','./squareReport.attributes','exports','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','path'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x62f9,0xa2));var _0x962f=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0x62f9[_0x271537];return _0x19dc22;};'use strict';var _=require(_0x962f('0x0'));var util=require('util');var logger=require(_0x962f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x962f('0x2'));var rimraf=require('rimraf');var config=require(_0x962f('0x3'));var attributes=require(_0x962f('0x4'));module[_0x962f('0x5')]=function(_0x18b310,_0x28e328){return _0x18b310['define']('SquareReport',attributes,{'tableName':_0x962f('0x6'),'paranoid':![],'indexes':[{'name':_0x962f('0x7'),'fields':[_0x962f('0x8'),_0x962f('0x9')]},{'name':_0x962f('0xa'),'fields':[_0x962f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 42b9f8e..ac29934 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 _0xb8fa=['http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','create','options','debug','UpdateSquareReport','SquareReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb8fa,0x1b7));var _0xab8f=function(_0x5b0725,_0x4581ce){_0x5b0725=_0x5b0725-0x0;var _0x3e3a46=_0xb8fa[_0x5b0725];return _0x3e3a46;};'use strict';var _=require(_0xab8f('0x0'));var util=require(_0xab8f('0x1'));var moment=require(_0xab8f('0x2'));var BPromise=require(_0xab8f('0x3'));var rs=require(_0xab8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab8f('0x6'));var config=require('../../config/environment');var jayson=require(_0xab8f('0x7'));var client=jayson[_0xab8f('0x8')][_0xab8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e72c,_0x25db98,_0x282078){return new BPromise(function(_0x7970aa,_0x257215){return client[_0xab8f('0xa')](_0x37e72c,_0x282078)[_0xab8f('0xb')](function(_0x402ee6){logger[_0xab8f('0xc')]('SquareReport,\x20%s,\x20%s',_0x25db98,_0xab8f('0xd'));logger['debug'](_0xab8f('0xe'),_0x25db98,_0xab8f('0xd'),JSON[_0xab8f('0xf')](_0x402ee6));if(_0x402ee6[_0xab8f('0x10')]){if(_0x402ee6[_0xab8f('0x10')]['code']===0x1f4){logger[_0xab8f('0x10')]('SquareReport,\x20%s,\x20%s',_0x25db98,_0x402ee6['error'][_0xab8f('0x11')]);return _0x257215(_0x402ee6[_0xab8f('0x10')][_0xab8f('0x11')]);}logger['error'](_0xab8f('0x12'),_0x25db98,_0x402ee6[_0xab8f('0x10')][_0xab8f('0x11')]);return _0x7970aa(_0x402ee6['error']['message']);}else{logger[_0xab8f('0xc')](_0xab8f('0x12'),_0x25db98,_0xab8f('0xd'));_0x7970aa(_0x402ee6[_0xab8f('0x13')][_0xab8f('0x11')]);}})[_0xab8f('0x14')](function(_0x5e2d71){logger['error']('SquareReport,\x20%s,\x20%s',_0x25db98,_0x5e2d71);_0x257215(_0x5e2d71);});});}exports[_0xab8f('0x15')]=function(_0x13db1c){var _0x504fe5=this;return new Promise(function(_0x4c8b9a,_0x508394){return db['SquareReport'][_0xab8f('0x16')](_0x13db1c['body'],{'raw':_0x13db1c[_0xab8f('0x17')]?_0x13db1c[_0xab8f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xab8f('0xb')](function(_0x5dd2d6){logger['info'](_0xab8f('0x15'),_0x13db1c);logger[_0xab8f('0x18')](_0xab8f('0x15'),_0x13db1c,JSON[_0xab8f('0xf')](_0x5dd2d6));_0x4c8b9a(_0x5dd2d6);})[_0xab8f('0x14')](function(_0xa123a8){logger[_0xab8f('0x10')]('CreateSquareReport',_0xa123a8[_0xab8f('0x11')],_0x13db1c);_0x508394(_0x504fe5['error'](0x1f4,_0xa123a8[_0xab8f('0x11')]));});});};exports[_0xab8f('0x19')]=function(_0x2c1a22){var _0x1da217=this;return new Promise(function(_0xfd0147,_0x30e034){return db[_0xab8f('0x1a')][_0xab8f('0x1b')](_0x2c1a22['body'],{'raw':_0x2c1a22[_0xab8f('0x17')]?_0x2c1a22[_0xab8f('0x17')][_0xab8f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1a22[_0xab8f('0x17')]?_0x2c1a22[_0xab8f('0x17')][_0xab8f('0x1d')]||null:null,'attributes':_0x2c1a22[_0xab8f('0x17')]?_0x2c1a22[_0xab8f('0x17')][_0xab8f('0x1e')]||null:null,'limit':_0x2c1a22['options']?_0x2c1a22[_0xab8f('0x17')][_0xab8f('0x1f')]||null:null})['then'](function(_0x5e52ac){logger['info'](_0xab8f('0x19'),_0x2c1a22);logger[_0xab8f('0x18')](_0xab8f('0x19'),_0x2c1a22,JSON[_0xab8f('0xf')](_0x5e52ac));_0xfd0147(_0x5e52ac);})[_0xab8f('0x14')](function(_0x1aaca9){logger['error'](_0xab8f('0x19'),_0x1aaca9[_0xab8f('0x11')],_0x2c1a22);_0x30e034(_0x1da217['error'](0x1f4,_0x1aaca9['message']));});});}; \ No newline at end of file +var _0x5924=['debug','catch','update','where','attributes','limit','UpdateSquareReport','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','body','options','raw','CreateSquareReport'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x5924,0x167));var _0x4592=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x5924[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0x4592('0x0'));var moment=require('moment');var BPromise=require(_0x4592('0x1'));var rs=require(_0x4592('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4592('0x3'))['db'];var utils=require(_0x4592('0x4'));var logger=require(_0x4592('0x5'))(_0x4592('0x6'));var config=require(_0x4592('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4592('0x8')][_0x4592('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3896e0,_0x7ec327,_0x334a1c){return new BPromise(function(_0x2042e1,_0x1cb5ab){return client[_0x4592('0xa')](_0x3896e0,_0x334a1c)[_0x4592('0xb')](function(_0x4db3cf){logger[_0x4592('0xc')]('SquareReport,\x20%s,\x20%s',_0x7ec327,'request\x20sent');logger['debug'](_0x4592('0xd'),_0x7ec327,_0x4592('0xe'),JSON[_0x4592('0xf')](_0x4db3cf));if(_0x4db3cf['error']){if(_0x4db3cf[_0x4592('0x10')][_0x4592('0x11')]===0x1f4){logger[_0x4592('0x10')](_0x4592('0x12'),_0x7ec327,_0x4db3cf[_0x4592('0x10')][_0x4592('0x13')]);return _0x1cb5ab(_0x4db3cf[_0x4592('0x10')][_0x4592('0x13')]);}logger[_0x4592('0x10')](_0x4592('0x12'),_0x7ec327,_0x4db3cf[_0x4592('0x10')][_0x4592('0x13')]);return _0x2042e1(_0x4db3cf[_0x4592('0x10')][_0x4592('0x13')]);}else{logger[_0x4592('0xc')](_0x4592('0x12'),_0x7ec327,_0x4592('0xe'));_0x2042e1(_0x4db3cf[_0x4592('0x14')][_0x4592('0x13')]);}})['catch'](function(_0x2b1d5f){logger[_0x4592('0x10')]('SquareReport,\x20%s,\x20%s',_0x7ec327,_0x2b1d5f);_0x1cb5ab(_0x2b1d5f);});});}exports['CreateSquareReport']=function(_0x5b9f04){var _0x365a78=this;return new Promise(function(_0x1d6d21,_0x1ddbd7){return db['SquareReport']['create'](_0x5b9f04[_0x4592('0x15')],{'raw':_0x5b9f04[_0x4592('0x16')]?_0x5b9f04[_0x4592('0x16')][_0x4592('0x17')]===undefined?!![]:![]:!![]})[_0x4592('0xb')](function(_0x1cc3b8){logger[_0x4592('0xc')](_0x4592('0x18'),_0x5b9f04);logger[_0x4592('0x19')](_0x4592('0x18'),_0x5b9f04,JSON[_0x4592('0xf')](_0x1cc3b8));_0x1d6d21(_0x1cc3b8);})[_0x4592('0x1a')](function(_0x5aeac4){logger[_0x4592('0x10')]('CreateSquareReport',_0x5aeac4[_0x4592('0x13')],_0x5b9f04);_0x1ddbd7(_0x365a78[_0x4592('0x10')](0x1f4,_0x5aeac4['message']));});});};exports['UpdateSquareReport']=function(_0xf1f75d){var _0x42f050=this;return new Promise(function(_0x55dd13,_0x1d6c84){return db['SquareReport'][_0x4592('0x1b')](_0xf1f75d['body'],{'raw':_0xf1f75d['options']?_0xf1f75d[_0x4592('0x16')][_0x4592('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1f75d[_0x4592('0x16')]?_0xf1f75d[_0x4592('0x16')][_0x4592('0x1c')]||null:null,'attributes':_0xf1f75d[_0x4592('0x16')]?_0xf1f75d[_0x4592('0x16')][_0x4592('0x1d')]||null:null,'limit':_0xf1f75d[_0x4592('0x16')]?_0xf1f75d[_0x4592('0x16')][_0x4592('0x1e')]||null:null})[_0x4592('0xb')](function(_0x4480f9){logger['info'](_0x4592('0x1f'),_0xf1f75d);logger[_0x4592('0x19')](_0x4592('0x1f'),_0xf1f75d,JSON[_0x4592('0xf')](_0x4480f9));_0x55dd13(_0x4480f9);})[_0x4592('0x1a')](function(_0x3d3457){logger[_0x4592('0x10')](_0x4592('0x1f'),_0x3d3457['message'],_0xf1f75d);_0x1d6c84(_0x42f050['error'](0x1f4,_0x3d3457[_0x4592('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9fbc155..61dd0b5 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 _0x2186=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2186,0xce));var _0x6218=function(_0x53431e,_0x3d12e6){_0x53431e=_0x53431e-0x0;var _0x204b30=_0x2186[_0x53431e];return _0x204b30;};'use strict';var multer=require(_0x6218('0x0'));var util=require(_0x6218('0x1'));var path=require(_0x6218('0x2'));var timeout=require(_0x6218('0x3'));var express=require('express');var router=express[_0x6218('0x4')]();var fs_extra=require(_0x6218('0x5'));var auth=require(_0x6218('0x6'));var interaction=require(_0x6218('0x7'));var config=require(_0x6218('0x8'));var controller=require('./squareReportDetail.controller');router[_0x6218('0x9')]('/',auth[_0x6218('0xa')](),controller[_0x6218('0xb')]);router[_0x6218('0x9')](_0x6218('0xc'),auth['isAuthenticated'](),controller[_0x6218('0xd')]);router['get'](_0x6218('0xe'),auth[_0x6218('0xa')](),controller[_0x6218('0xf')]);router[_0x6218('0x10')]('/',auth[_0x6218('0xa')](),controller[_0x6218('0x11')]);router[_0x6218('0x12')](_0x6218('0xe'),auth['isAuthenticated'](),controller[_0x6218('0x13')]);router[_0x6218('0x14')](_0x6218('0xe'),auth[_0x6218('0xa')](),controller[_0x6218('0x15')]);module[_0x6218('0x16')]=router; \ No newline at end of file +var _0x20f6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','exports','multer','path','connect-timeout','express'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x20f6,0x140));var _0x620f=function(_0x392419,_0x4229ba){_0x392419=_0x392419-0x0;var _0x418a9e=_0x20f6[_0x392419];return _0x418a9e;};'use strict';var multer=require(_0x620f('0x0'));var util=require('util');var path=require(_0x620f('0x1'));var timeout=require(_0x620f('0x2'));var express=require(_0x620f('0x3'));var router=express[_0x620f('0x4')]();var fs_extra=require(_0x620f('0x5'));var auth=require(_0x620f('0x6'));var interaction=require(_0x620f('0x7'));var config=require(_0x620f('0x8'));var controller=require('./squareReportDetail.controller');router[_0x620f('0x9')]('/',auth[_0x620f('0xa')](),controller[_0x620f('0xb')]);router[_0x620f('0x9')](_0x620f('0xc'),auth[_0x620f('0xa')](),controller[_0x620f('0xd')]);router[_0x620f('0x9')](_0x620f('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x620f('0xf')]('/',auth[_0x620f('0xa')](),controller[_0x620f('0x10')]);router['put'](_0x620f('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x620f('0xe'),auth[_0x620f('0xa')](),controller['destroy']);module[_0x620f('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 24ff0b5..4479722 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 _0xb794=['sequelize','exports','STRING','TEXT'];(function(_0x754d4b,_0x45bdb3){var _0x5ba509=function(_0x354ab6){while(--_0x354ab6){_0x754d4b['push'](_0x754d4b['shift']());}};_0x5ba509(++_0x45bdb3);}(_0xb794,0xa4));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4b79('0x0'));module[_0x4b79('0x1')]={'uniqueid':{'type':Sequelize[_0x4b79('0x2')]},'node':{'type':Sequelize[_0x4b79('0x2')]},'application':{'type':Sequelize[_0x4b79('0x2')]},'data':{'type':Sequelize[_0x4b79('0x3')]},'project_name':{'type':Sequelize[_0x4b79('0x2')]},'callerid':{'type':Sequelize[_0x4b79('0x2')]}}; \ No newline at end of file +var _0xc6cf=['STRING','TEXT','sequelize','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc6cf,0xaa));var _0xfc6c=function(_0x2db2e8,_0x709369){_0x2db2e8=_0x2db2e8-0x0;var _0x15611c=_0xc6cf[_0x2db2e8];return _0x15611c;};'use strict';var Sequelize=require(_0xfc6c('0x0'));module[_0xfc6c('0x1')]={'uniqueid':{'type':Sequelize[_0xfc6c('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xfc6c('0x2')]},'data':{'type':Sequelize[_0xfc6c('0x3')]},'project_name':{'type':Sequelize[_0xfc6c('0x2')]},'callerid':{'type':Sequelize[_0xfc6c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b98c46a..e516e5c 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 _0x86ee=['then','destroy','error','name','send','index','map','SquareDetailsReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update'];(function(_0x44820b,_0x4805f1){var _0x25d09a=function(_0x4485b4){while(--_0x4485b4){_0x44820b['push'](_0x44820b['shift']());}};_0x25d09a(++_0x4805f1);}(_0x86ee,0x1e1));var _0xe86e=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x86ee[_0x99868f];return _0x27a71b;};'use strict';var emlformat=require(_0xe86e('0x0'));var rimraf=require(_0xe86e('0x1'));var zipdir=require(_0xe86e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe86e('0x3'));var moment=require('moment');var BPromise=require(_0xe86e('0x4'));var Mustache=require('mustache');var util=require(_0xe86e('0x5'));var path=require(_0xe86e('0x6'));var sox=require(_0xe86e('0x7'));var csv=require('to-csv');var ejs=require(_0xe86e('0x8'));var fs=require('fs');var fs_extra=require(_0xe86e('0x9'));var _=require(_0xe86e('0xa'));var squel=require(_0xe86e('0xb'));var crypto=require(_0xe86e('0xc'));var jsforce=require(_0xe86e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe86e('0xe'));var querystring=require(_0xe86e('0xf'));var Papa=require(_0xe86e('0x10'));var Redis=require('ioredis');var authService=require(_0xe86e('0x11'));var qs=require(_0xe86e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe86e('0x13'));var utils=require(_0xe86e('0x14'));var config=require(_0xe86e('0x15'));var licenseUtil=require(_0xe86e('0x16'));var db=require(_0xe86e('0x17'))['db'];function respondWithStatusCode(_0x417362,_0x27db19){_0x27db19=_0x27db19||0xcc;return function(_0xa51767){if(_0xa51767){return _0x417362[_0xe86e('0x18')](_0x27db19);}return _0x417362[_0xe86e('0x19')](_0x27db19)[_0xe86e('0x1a')]();};}function respondWithResult(_0x1979ca,_0x4c7652){_0x4c7652=_0x4c7652||0xc8;return function(_0x513d23){if(_0x513d23){return _0x1979ca[_0xe86e('0x19')](_0x4c7652)['json'](_0x513d23);}};}function respondWithFilteredResult(_0x5623f5,_0x4103de){return function(_0x14a787){if(_0x14a787){var _0x48e775=typeof _0x4103de[_0xe86e('0x1b')]===_0xe86e('0x1c')&&typeof _0x4103de[_0xe86e('0x1d')]==='undefined';var _0x23c9f0=_0x14a787['count'];var _0x325bad=_0x48e775?0x0:_0x4103de[_0xe86e('0x1b')];var _0x4236fa=_0x48e775?_0x14a787[_0xe86e('0x1e')]:_0x4103de[_0xe86e('0x1b')]+_0x4103de['limit'];var _0x42e0c8;if(_0x4236fa>=_0x23c9f0){_0x4236fa=_0x23c9f0;_0x42e0c8=0xc8;}else{_0x42e0c8=0xce;}_0x5623f5[_0xe86e('0x19')](_0x42e0c8);return _0x5623f5[_0xe86e('0x1f')]('Content-Range',_0x325bad+'-'+_0x4236fa+'/'+_0x23c9f0)[_0xe86e('0x20')](_0x14a787);}return null;};}function patchUpdates(_0x2d811e){return function(_0x12ddf3){try{jsonpatch[_0xe86e('0x21')](_0x12ddf3,_0x2d811e,!![]);}catch(_0x59364a){return BPromise[_0xe86e('0x22')](_0x59364a);}return _0x12ddf3[_0xe86e('0x23')]();};}function saveUpdates(_0x4f679c,_0x4e9804){return function(_0x50d0e3){if(_0x50d0e3){return _0x50d0e3[_0xe86e('0x24')](_0x4f679c)[_0xe86e('0x25')](function(_0x331ca7){return _0x331ca7;});}return null;};}function removeEntity(_0x3a6b33,_0x17f11b){return function(_0x106c2f){if(_0x106c2f){return _0x106c2f[_0xe86e('0x26')]()[_0xe86e('0x25')](function(){_0x3a6b33[_0xe86e('0x19')](0xcc)[_0xe86e('0x1a')]();});}};}function handleEntityNotFound(_0x1c3d93,_0x14b534){return function(_0x158913){if(!_0x158913){_0x1c3d93[_0xe86e('0x18')](0x194);}return _0x158913;};}function handleError(_0x344e1d,_0x43ad23){_0x43ad23=_0x43ad23||0x1f4;return function(_0x461959){logger[_0xe86e('0x27')](_0x461959['stack']);if(_0x461959[_0xe86e('0x28')]){delete _0x461959['name'];}_0x344e1d[_0xe86e('0x19')](_0x43ad23)[_0xe86e('0x29')](_0x461959);};}exports[_0xe86e('0x2a')]=function(_0x3b621c,_0x3cb138){var _0x2cf5eb={},_0x3fbdfb={},_0x3ea1c3={'count':0x0,'rows':[]};var _0x10bf3c=_[_0xe86e('0x2b')](db[_0xe86e('0x2c')]['rawAttributes'],function(_0x4d6b0a){return{'name':_0x4d6b0a[_0xe86e('0x2d')],'type':_0x4d6b0a['type'][_0xe86e('0x2e')]};});_0x3fbdfb[_0xe86e('0x2f')]=_[_0xe86e('0x2b')](_0x10bf3c,_0xe86e('0x28'));_0x3fbdfb[_0xe86e('0x30')]=_[_0xe86e('0x31')](_0x3b621c['query']);_0x3fbdfb[_0xe86e('0x32')]=_[_0xe86e('0x33')](_0x3fbdfb[_0xe86e('0x2f')],_0x3fbdfb[_0xe86e('0x30')]);_0x2cf5eb['attributes']=_[_0xe86e('0x33')](_0x3fbdfb[_0xe86e('0x2f')],qs[_0xe86e('0x34')](_0x3b621c[_0xe86e('0x30')][_0xe86e('0x34')]));_0x2cf5eb['attributes']=_0x2cf5eb[_0xe86e('0x35')][_0xe86e('0x36')]?_0x2cf5eb[_0xe86e('0x35')]:_0x3fbdfb[_0xe86e('0x2f')];if(!_0x3b621c[_0xe86e('0x30')]['hasOwnProperty'](_0xe86e('0x37'))){_0x2cf5eb['limit']=qs['limit'](_0x3b621c[_0xe86e('0x30')][_0xe86e('0x1d')]);_0x2cf5eb['offset']=qs[_0xe86e('0x1b')](_0x3b621c['query']['offset']);}_0x2cf5eb[_0xe86e('0x38')]=qs[_0xe86e('0x39')](_0x3b621c[_0xe86e('0x30')][_0xe86e('0x39')]);_0x2cf5eb[_0xe86e('0x3a')]=qs[_0xe86e('0x32')](_[_0xe86e('0x3b')](_0x3b621c[_0xe86e('0x30')],_0x3fbdfb['filters']),_0x10bf3c);if(_0x3b621c[_0xe86e('0x30')]['filter']){_0x2cf5eb[_0xe86e('0x3a')]=_[_0xe86e('0x3c')](_0x2cf5eb[_0xe86e('0x3a')],{'$or':_[_0xe86e('0x2b')](_0x10bf3c,function(_0x3747a3){if(_0x3747a3['type']!==_0xe86e('0x3d')){var _0x11b835={};_0x11b835[_0x3747a3['name']]={'$like':'%'+_0x3b621c['query']['filter']+'%'};return _0x11b835;}})});}_0x2cf5eb=_[_0xe86e('0x3c')]({},_0x2cf5eb,_0x3b621c[_0xe86e('0x3e')]);var _0x2fcc12={'where':_0x2cf5eb[_0xe86e('0x3a')]};return db[_0xe86e('0x2c')][_0xe86e('0x1e')](_0x2fcc12)[_0xe86e('0x25')](function(_0x36345a){_0x3ea1c3[_0xe86e('0x1e')]=_0x36345a;if(_0x3b621c[_0xe86e('0x30')][_0xe86e('0x3f')]){_0x2cf5eb[_0xe86e('0x40')]=[{'all':!![]}];}return db[_0xe86e('0x2c')][_0xe86e('0x41')](_0x2cf5eb);})[_0xe86e('0x25')](function(_0x45ce86){_0x3ea1c3[_0xe86e('0x42')]=_0x45ce86;return _0x3ea1c3;})[_0xe86e('0x25')](respondWithFilteredResult(_0x3cb138,_0x2cf5eb))[_0xe86e('0x43')](handleError(_0x3cb138,null));};exports[_0xe86e('0x44')]=function(_0x22a415,_0x36bdf4){var _0x1942a2={'raw':!![],'where':{'id':_0x22a415[_0xe86e('0x45')]['id']}},_0x4ee9e8={};_0x4ee9e8['model']=_[_0xe86e('0x31')](db[_0xe86e('0x2c')]['rawAttributes']);_0x4ee9e8['query']=_[_0xe86e('0x31')](_0x22a415[_0xe86e('0x30')]);_0x4ee9e8[_0xe86e('0x32')]=_[_0xe86e('0x33')](_0x4ee9e8[_0xe86e('0x2f')],_0x4ee9e8['query']);_0x1942a2[_0xe86e('0x35')]=_[_0xe86e('0x33')](_0x4ee9e8[_0xe86e('0x2f')],qs[_0xe86e('0x34')](_0x22a415['query'][_0xe86e('0x34')]));_0x1942a2[_0xe86e('0x35')]=_0x1942a2['attributes']['length']?_0x1942a2[_0xe86e('0x35')]:_0x4ee9e8[_0xe86e('0x2f')];if(_0x22a415[_0xe86e('0x30')][_0xe86e('0x3f')]){_0x1942a2[_0xe86e('0x40')]=[{'all':!![]}];}_0x1942a2=_[_0xe86e('0x3c')]({},_0x1942a2,_0x22a415[_0xe86e('0x3e')]);return db[_0xe86e('0x2c')][_0xe86e('0x46')](_0x1942a2)[_0xe86e('0x25')](handleEntityNotFound(_0x36bdf4,null))[_0xe86e('0x25')](respondWithResult(_0x36bdf4,null))[_0xe86e('0x43')](handleError(_0x36bdf4,null));};exports['create']=function(_0x213f14,_0x2d563b){return db[_0xe86e('0x2c')][_0xe86e('0x47')](_0x213f14[_0xe86e('0x48')],{})[_0xe86e('0x25')](respondWithResult(_0x2d563b,0xc9))['catch'](handleError(_0x2d563b,null));};exports['update']=function(_0x51fe78,_0x234e26){if(_0x51fe78[_0xe86e('0x48')]['id']){delete _0x51fe78['body']['id'];}return db[_0xe86e('0x2c')]['find']({'where':{'id':_0x51fe78[_0xe86e('0x45')]['id']}})[_0xe86e('0x25')](handleEntityNotFound(_0x234e26,null))[_0xe86e('0x25')](saveUpdates(_0x51fe78[_0xe86e('0x48')],null))[_0xe86e('0x25')](respondWithResult(_0x234e26,null))[_0xe86e('0x43')](handleError(_0x234e26,null));};exports['destroy']=function(_0x11869d,_0x27e8ac){return db[_0xe86e('0x2c')]['find']({'where':{'id':_0x11869d[_0xe86e('0x45')]['id']}})[_0xe86e('0x25')](handleEntityNotFound(_0x27e8ac,null))[_0xe86e('0x25')](removeEntity(_0x27e8ac,null))[_0xe86e('0x43')](handleError(_0x27e8ac,null));};exports['describe']=function(_0x26bb24,_0x3f3e68){return db[_0xe86e('0x2c')][_0xe86e('0x49')]()['then'](respondWithResult(_0x3f3e68,null))[_0xe86e('0x43')](handleError(_0x3f3e68,null));}; \ No newline at end of file +var _0x9088=['stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','save','update','then','destroy','error'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x9088,0x6c));var _0x8908=function(_0x1453e2,_0x1f7ddb){_0x1453e2=_0x1453e2-0x0;var _0x508cb5=_0x9088[_0x1453e2];return _0x508cb5;};'use strict';var emlformat=require(_0x8908('0x0'));var rimraf=require(_0x8908('0x1'));var zipdir=require(_0x8908('0x2'));var jsonpatch=require(_0x8908('0x3'));var rp=require(_0x8908('0x4'));var moment=require('moment');var BPromise=require(_0x8908('0x5'));var Mustache=require(_0x8908('0x6'));var util=require(_0x8908('0x7'));var path=require(_0x8908('0x8'));var sox=require(_0x8908('0x9'));var csv=require('to-csv');var ejs=require(_0x8908('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8908('0xb'));var crypto=require(_0x8908('0xc'));var jsforce=require(_0x8908('0xd'));var deskjs=require(_0x8908('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8908('0xf'));var Papa=require('papaparse');var Redis=require(_0x8908('0x10'));var authService=require(_0x8908('0x11'));var qs=require(_0x8908('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8908('0x13'));var utils=require(_0x8908('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8908('0x15'));var db=require(_0x8908('0x16'))['db'];function respondWithStatusCode(_0x3d028a,_0xaa07b){_0xaa07b=_0xaa07b||0xcc;return function(_0x51fa46){if(_0x51fa46){return _0x3d028a[_0x8908('0x17')](_0xaa07b);}return _0x3d028a[_0x8908('0x18')](_0xaa07b)[_0x8908('0x19')]();};}function respondWithResult(_0x4393ea,_0x21a598){_0x21a598=_0x21a598||0xc8;return function(_0x23f478){if(_0x23f478){return _0x4393ea[_0x8908('0x18')](_0x21a598)[_0x8908('0x1a')](_0x23f478);}};}function respondWithFilteredResult(_0x2b520a,_0xd1f567){return function(_0x327e3b){if(_0x327e3b){var _0xb4626c=typeof _0xd1f567[_0x8908('0x1b')]==='undefined'&&typeof _0xd1f567['limit']===_0x8908('0x1c');var _0x3f89c0=_0x327e3b[_0x8908('0x1d')];var _0x144a8d=_0xb4626c?0x0:_0xd1f567[_0x8908('0x1b')];var _0x56e197=_0xb4626c?_0x327e3b['count']:_0xd1f567[_0x8908('0x1b')]+_0xd1f567['limit'];var _0x3e5bcd;if(_0x56e197>=_0x3f89c0){_0x56e197=_0x3f89c0;_0x3e5bcd=0xc8;}else{_0x3e5bcd=0xce;}_0x2b520a['status'](_0x3e5bcd);return _0x2b520a[_0x8908('0x1e')]('Content-Range',_0x144a8d+'-'+_0x56e197+'/'+_0x3f89c0)[_0x8908('0x1a')](_0x327e3b);}return null;};}function patchUpdates(_0x6c5074){return function(_0x1f2104){try{jsonpatch['apply'](_0x1f2104,_0x6c5074,!![]);}catch(_0x3e3adc){return BPromise['reject'](_0x3e3adc);}return _0x1f2104[_0x8908('0x1f')]();};}function saveUpdates(_0x5bb259,_0x362519){return function(_0x4510ed){if(_0x4510ed){return _0x4510ed[_0x8908('0x20')](_0x5bb259)[_0x8908('0x21')](function(_0x4e390a){return _0x4e390a;});}return null;};}function removeEntity(_0x149270,_0x37dc28){return function(_0x36f265){if(_0x36f265){return _0x36f265[_0x8908('0x22')]()[_0x8908('0x21')](function(){_0x149270[_0x8908('0x18')](0xcc)[_0x8908('0x19')]();});}};}function handleEntityNotFound(_0x57323b,_0x5baeeb){return function(_0x5ca0f9){if(!_0x5ca0f9){_0x57323b['sendStatus'](0x194);}return _0x5ca0f9;};}function handleError(_0x4fec65,_0x203ac2){_0x203ac2=_0x203ac2||0x1f4;return function(_0x5877d8){logger[_0x8908('0x23')](_0x5877d8[_0x8908('0x24')]);if(_0x5877d8[_0x8908('0x25')]){delete _0x5877d8[_0x8908('0x25')];}_0x4fec65[_0x8908('0x18')](_0x203ac2)[_0x8908('0x26')](_0x5877d8);};}exports[_0x8908('0x27')]=function(_0x46a984,_0x4992ba){var _0x4c5063={},_0x160237={},_0x51885c={'count':0x0,'rows':[]};var _0xe32344=_[_0x8908('0x28')](db[_0x8908('0x29')][_0x8908('0x2a')],function(_0x3a646c){return{'name':_0x3a646c[_0x8908('0x2b')],'type':_0x3a646c[_0x8908('0x2c')]['key']};});_0x160237[_0x8908('0x2d')]=_['map'](_0xe32344,'name');_0x160237[_0x8908('0x2e')]=_[_0x8908('0x2f')](_0x46a984[_0x8908('0x2e')]);_0x160237[_0x8908('0x30')]=_[_0x8908('0x31')](_0x160237['model'],_0x160237['query']);_0x4c5063[_0x8908('0x32')]=_[_0x8908('0x31')](_0x160237[_0x8908('0x2d')],qs[_0x8908('0x33')](_0x46a984[_0x8908('0x2e')][_0x8908('0x33')]));_0x4c5063['attributes']=_0x4c5063[_0x8908('0x32')][_0x8908('0x34')]?_0x4c5063[_0x8908('0x32')]:_0x160237['model'];if(!_0x46a984[_0x8908('0x2e')][_0x8908('0x35')](_0x8908('0x36'))){_0x4c5063[_0x8908('0x37')]=qs[_0x8908('0x37')](_0x46a984[_0x8908('0x2e')]['limit']);_0x4c5063[_0x8908('0x1b')]=qs['offset'](_0x46a984['query'][_0x8908('0x1b')]);}_0x4c5063[_0x8908('0x38')]=qs['sort'](_0x46a984['query']['sort']);_0x4c5063[_0x8908('0x39')]=qs[_0x8908('0x30')](_['pick'](_0x46a984[_0x8908('0x2e')],_0x160237[_0x8908('0x30')]),_0xe32344);if(_0x46a984['query'][_0x8908('0x3a')]){_0x4c5063[_0x8908('0x39')]=_['merge'](_0x4c5063[_0x8908('0x39')],{'$or':_[_0x8908('0x28')](_0xe32344,function(_0x412fb7){if(_0x412fb7['type']!==_0x8908('0x3b')){var _0x757c1c={};_0x757c1c[_0x412fb7['name']]={'$like':'%'+_0x46a984[_0x8908('0x2e')][_0x8908('0x3a')]+'%'};return _0x757c1c;}})});}_0x4c5063=_[_0x8908('0x3c')]({},_0x4c5063,_0x46a984[_0x8908('0x3d')]);var _0x114843={'where':_0x4c5063[_0x8908('0x39')]};return db[_0x8908('0x29')][_0x8908('0x1d')](_0x114843)['then'](function(_0x3a2d4b){_0x51885c['count']=_0x3a2d4b;if(_0x46a984[_0x8908('0x2e')][_0x8908('0x3e')]){_0x4c5063[_0x8908('0x3f')]=[{'all':!![]}];}return db[_0x8908('0x29')][_0x8908('0x40')](_0x4c5063);})[_0x8908('0x21')](function(_0xd7bb02){_0x51885c[_0x8908('0x41')]=_0xd7bb02;return _0x51885c;})['then'](respondWithFilteredResult(_0x4992ba,_0x4c5063))[_0x8908('0x42')](handleError(_0x4992ba,null));};exports['show']=function(_0x3326f1,_0x453408){var _0xfdfe7e={'raw':!![],'where':{'id':_0x3326f1[_0x8908('0x43')]['id']}},_0x1845f6={};_0x1845f6[_0x8908('0x2d')]=_[_0x8908('0x2f')](db[_0x8908('0x29')][_0x8908('0x2a')]);_0x1845f6[_0x8908('0x2e')]=_['keys'](_0x3326f1['query']);_0x1845f6[_0x8908('0x30')]=_['intersection'](_0x1845f6[_0x8908('0x2d')],_0x1845f6['query']);_0xfdfe7e[_0x8908('0x32')]=_['intersection'](_0x1845f6['model'],qs['fields'](_0x3326f1[_0x8908('0x2e')][_0x8908('0x33')]));_0xfdfe7e['attributes']=_0xfdfe7e[_0x8908('0x32')][_0x8908('0x34')]?_0xfdfe7e[_0x8908('0x32')]:_0x1845f6[_0x8908('0x2d')];if(_0x3326f1[_0x8908('0x2e')][_0x8908('0x3e')]){_0xfdfe7e['include']=[{'all':!![]}];}_0xfdfe7e=_[_0x8908('0x3c')]({},_0xfdfe7e,_0x3326f1[_0x8908('0x3d')]);return db[_0x8908('0x29')][_0x8908('0x44')](_0xfdfe7e)[_0x8908('0x21')](handleEntityNotFound(_0x453408,null))['then'](respondWithResult(_0x453408,null))[_0x8908('0x42')](handleError(_0x453408,null));};exports[_0x8908('0x45')]=function(_0x19a916,_0x31f0d7){return db[_0x8908('0x29')][_0x8908('0x45')](_0x19a916['body'],{})[_0x8908('0x21')](respondWithResult(_0x31f0d7,0xc9))['catch'](handleError(_0x31f0d7,null));};exports[_0x8908('0x20')]=function(_0x1489d3,_0x4438d5){if(_0x1489d3[_0x8908('0x46')]['id']){delete _0x1489d3[_0x8908('0x46')]['id'];}return db[_0x8908('0x29')][_0x8908('0x44')]({'where':{'id':_0x1489d3[_0x8908('0x43')]['id']}})[_0x8908('0x21')](handleEntityNotFound(_0x4438d5,null))[_0x8908('0x21')](saveUpdates(_0x1489d3[_0x8908('0x46')],null))[_0x8908('0x21')](respondWithResult(_0x4438d5,null))[_0x8908('0x42')](handleError(_0x4438d5,null));};exports[_0x8908('0x22')]=function(_0x1c817e,_0x4f2d0f){return db[_0x8908('0x29')][_0x8908('0x44')]({'where':{'id':_0x1c817e[_0x8908('0x43')]['id']}})[_0x8908('0x21')](handleEntityNotFound(_0x4f2d0f,null))[_0x8908('0x21')](removeEntity(_0x4f2d0f,null))['catch'](handleError(_0x4f2d0f,null));};exports[_0x8908('0x47')]=function(_0x3d3795,_0x32d97a){return db[_0x8908('0x29')]['describe']()[_0x8908('0x21')](respondWithResult(_0x32d97a,null))[_0x8908('0x42')](handleError(_0x32d97a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8b0426f..c056bb3 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 _0x40fe=['api','bluebird','path','rimraf','./squareReportDetail.attributes','define','report_square_details','util','../../config/logger'];(function(_0x52c5c2,_0x368427){var _0x46084c=function(_0xf92732){while(--_0xf92732){_0x52c5c2['push'](_0x52c5c2['shift']());}};_0x46084c(++_0x368427);}(_0x40fe,0xcd));var _0xe40f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x40fe[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xe40f('0x0'));var logger=require(_0xe40f('0x1'))(_0xe40f('0x2'));var moment=require('moment');var BPromise=require(_0xe40f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe40f('0x4'));var rimraf=require(_0xe40f('0x5'));var config=require('../../config/environment');var attributes=require(_0xe40f('0x6'));module['exports']=function(_0x43f874,_0x491b40){return _0x43f874[_0xe40f('0x7')]('SquareDetailsReport',attributes,{'tableName':_0xe40f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f31=['../../config/environment','define','SquareDetailsReport','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x334eeb,_0x251035){var _0x1c2240=function(_0x7d3a99){while(--_0x7d3a99){_0x334eeb['push'](_0x334eeb['shift']());}};_0x1c2240(++_0x251035);}(_0x5f31,0x1a7));var _0x15f3=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x5f31[_0x34325b];return _0x3da348;};'use strict';var _=require(_0x15f3('0x0'));var util=require('util');var logger=require(_0x15f3('0x1'))(_0x15f3('0x2'));var moment=require('moment');var BPromise=require(_0x15f3('0x3'));var rp=require(_0x15f3('0x4'));var fs=require('fs');var path=require(_0x15f3('0x5'));var rimraf=require(_0x15f3('0x6'));var config=require(_0x15f3('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x2cad1d,_0x49fbf6){return _0x2cad1d[_0x15f3('0x8')](_0x15f3('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 46fcbdd..063c52a 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 _0x3de3=['../../config/logger','../../config/environment','jayson/promise','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','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x323ba7,_0x5da32f){var _0x299f51=function(_0x4fba86){while(--_0x4fba86){_0x323ba7['push'](_0x323ba7['shift']());}};_0x299f51(++_0x5da32f);}(_0x3de3,0x1ce));var _0x33de=function(_0x399580,_0x80216b){_0x399580=_0x399580-0x0;var _0x4e9795=_0x3de3[_0x399580];return _0x4e9795;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['SquareDetailsReport'][_0x33de('0x17')](_0x52cfa0['body'],{'raw':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![]})[_0x33de('0xb')](function(_0xc4f1a4){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger['debug']('CreateSquareDetailsReport',_0x52cfa0,JSON[_0x33de('0x10')](_0xc4f1a4));_0x201ff3(_0xc4f1a4);})['catch'](function(_0x8acd8d){logger['error'](_0x33de('0x16'),_0x8acd8d[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7['error'](0x1f4,_0x8acd8d[_0x33de('0x13')]));});});}; \ No newline at end of file +var _0x4fad=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4fad,0xcb));var _0xd4fa=function(_0x2fcbca,_0x3fba7d){_0x2fcbca=_0x2fcbca-0x0;var _0x400128=_0x4fad[_0x2fcbca];return _0x400128;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b426,_0x2b9f6a,_0x19a910){return new BPromise(function(_0x155c09,_0x3fff99){return client[_0xd4fa('0xc')](_0x52b426,_0x19a910)['then'](function(_0x26a894){logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,'request\x20sent');logger[_0xd4fa('0xf')](_0xd4fa('0x10'),_0x2b9f6a,_0xd4fa('0x11'),JSON[_0xd4fa('0x12')](_0x26a894));if(_0x26a894['error']){if(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x14')]===0x1f4){logger[_0xd4fa('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x2b9f6a,_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);return _0x3fff99(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}logger[_0xd4fa('0x13')](_0xd4fa('0xe'),_0x2b9f6a,_0x26a894['error'][_0xd4fa('0x15')]);return _0x155c09(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}else{logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,_0xd4fa('0x11'));_0x155c09(_0x26a894[_0xd4fa('0x16')]['message']);}})[_0xd4fa('0x17')](function(_0x3a3b8c){logger[_0xd4fa('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x2b9f6a,_0x3a3b8c);_0x3fff99(_0x3a3b8c);});});}exports['CreateSquareDetailsReport']=function(_0x1faa0b){var _0x5601d6=this;return new Promise(function(_0x5df190,_0x1f9be1){return db[_0xd4fa('0x18')][_0xd4fa('0x19')](_0x1faa0b[_0xd4fa('0x1a')],{'raw':_0x1faa0b['options']?_0x1faa0b[_0xd4fa('0x1b')][_0xd4fa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xbf7dcf){logger['info']('CreateSquareDetailsReport',_0x1faa0b);logger[_0xd4fa('0xf')](_0xd4fa('0x1d'),_0x1faa0b,JSON[_0xd4fa('0x12')](_0xbf7dcf));_0x5df190(_0xbf7dcf);})[_0xd4fa('0x17')](function(_0x586af0){logger[_0xd4fa('0x13')](_0xd4fa('0x1d'),_0x586af0[_0xd4fa('0x15')],_0x1faa0b);_0x1f9be1(_0x5601d6[_0xd4fa('0x13')](0x1f4,_0x586af0[_0xd4fa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 343e292..cfb1ad6 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 _0xf574=['isAuthenticated','killProcess','get'];(function(_0x2b1e45,_0x48b77f){var _0x2bb528=function(_0x39ffa5){while(--_0x39ffa5){_0x2b1e45['push'](_0x2b1e45['shift']());}};_0x2bb528(++_0x48b77f);}(_0xf574,0x1ca));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x4f57('0x0')]('/',auth[_0x4f57('0x1')](),controller['index']);router['get']('/process/:pid/kill',auth[_0x4f57('0x1')](),controller[_0x4f57('0x2')]);module['exports']=router; \ No newline at end of file +var _0x111f=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x111f,0x1c8));var _0xf111=function(_0x17a533,_0x5c56a2){_0x17a533=_0x17a533-0x0;var _0x40ee00=_0x111f[_0x17a533];return _0x40ee00;};'use strict';var express=require('express');var router=express[_0xf111('0x0')]();var auth=require(_0xf111('0x1'));var controller=require(_0xf111('0x2'));router[_0xf111('0x3')]('/',auth[_0xf111('0x4')](),controller['index']);router[_0xf111('0x3')](_0xf111('0x5'),auth[_0xf111('0x4')](),controller[_0xf111('0x6')]);module[_0xf111('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 3ccc71e..0913e75 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 _0x6634=['api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','getAllData','then','status','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger'];(function(_0x27fe34,_0xc77b74){var _0x1371e4=function(_0x4a2258){while(--_0x4a2258){_0x27fe34['push'](_0x27fe34['shift']());}};_0x1371e4(++_0xc77b74);}(_0x6634,0xcd));var _0x4663=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0x6634[_0x411e5d];return _0x58298;};'use strict';var info=require(_0x4663('0x0'));var exec=require('child_process')[_0x4663('0x1')];var logger=require(_0x4663('0x2'))(_0x4663('0x3'));var util=require('util');var BPromise=require(_0x4663('0x4'));var _=require(_0x4663('0x5'));function handleError(_0x544553,_0x214232,_0x6a9367){_0x214232=_0x214232||0x1f4;return function(_0x10baaa){logger[_0x4663('0x6')](_0x4663('0x7'),_0x6a9367,_0x214232,util[_0x4663('0x8')](_0x10baaa,{'showHidden':![],'depth':null}));delete _0x10baaa['name'];_0x544553['status'](_0x214232)[_0x4663('0x9')](_0x10baaa);};}exports['index']=function(_0x45ed2b,_0x3eb08b){return info[_0x4663('0xa')]()[_0x4663('0xb')](function(_0x1429ec){return _0x3eb08b[_0x4663('0xc')](0xc8)[_0x4663('0xd')](_0x1429ec);})[_0x4663('0xe')](function(_0xea1006){return _0x3eb08b[_0x4663('0xc')](0x1f4)['json'](_0xea1006);});};exports[_0x4663('0xf')]=function(_0x3005a2,_0x20ab05){var _0x3c70b9=['components/import/cm'];return new BPromise(function(_0x41f60d,_0x5b8f8c){return exec(util['format'](_0x4663('0x10'),_0x3005a2[_0x4663('0x11')]['pid']),function(_0x2aa4c2,_0x117835,_0x4a39d){if(_0x2aa4c2){return _0x5b8f8c(_0x2aa4c2);}return _0x41f60d(_0x117835);});})[_0x4663('0xb')](function(_0x492b41){var _0x6883bb=![];var _0x186183=_0x492b41[_0x4663('0x12')](/\n/);for(var _0x5a1923=0x0,_0x3fb00e=_0x3c70b9['length'];_0x5a1923<_0x3fb00e,_0x6883bb===![];_0x5a1923+=0x1){if(_0x492b41[_0x4663('0x13')](_0x3c70b9[_0x5a1923])>=0x0){_0x6883bb=!![];}}if(!_0x6883bb){throw new Error(util[_0x4663('0x14')](_0x4663('0x15'),_0x3005a2[_0x4663('0x11')][_0x4663('0x16')]));}process[_0x4663('0x17')](_0x3005a2[_0x4663('0x11')][_0x4663('0x16')],_0x4663('0x18'));return _0x20ab05[_0x4663('0xc')](0xc8)[_0x4663('0xd')]({'message':util[_0x4663('0x14')](_0x4663('0x19'),_0x3005a2['params'][_0x4663('0x16')])});})[_0x4663('0xe')](handleError(_0x20ab05,null,_0x4663('0xf')));}; \ No newline at end of file +var _0xce87=['then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData'];(function(_0x1c9e5e,_0x16dc04){var _0x4d9462=function(_0x2ca523){while(--_0x2ca523){_0x1c9e5e['push'](_0x1c9e5e['shift']());}};_0x4d9462(++_0x16dc04);}(_0xce87,0x65));var _0x7ce8=function(_0x2dd5bd,_0x105a04){_0x2dd5bd=_0x2dd5bd-0x0;var _0x3eb830=_0xce87[_0x2dd5bd];return _0x3eb830;};'use strict';var info=require(_0x7ce8('0x0'));var exec=require('child_process')['exec'];var logger=require('../../config/logger')('api');var util=require(_0x7ce8('0x1'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0xd2b83a,_0x144579,_0x13a2df){_0x144579=_0x144579||0x1f4;return function(_0xe25b30){logger[_0x7ce8('0x2')](_0x7ce8('0x3'),_0x13a2df,_0x144579,util['inspect'](_0xe25b30,{'showHidden':![],'depth':null}));delete _0xe25b30[_0x7ce8('0x4')];_0xd2b83a[_0x7ce8('0x5')](_0x144579)[_0x7ce8('0x6')](_0xe25b30);};}exports[_0x7ce8('0x7')]=function(_0x342d5f,_0x98bf2f){return info[_0x7ce8('0x8')]()[_0x7ce8('0x9')](function(_0xf09e23){return _0x98bf2f[_0x7ce8('0x5')](0xc8)['json'](_0xf09e23);})[_0x7ce8('0xa')](function(_0x4082e5){return _0x98bf2f[_0x7ce8('0x5')](0x1f4)[_0x7ce8('0xb')](_0x4082e5);});};exports[_0x7ce8('0xc')]=function(_0x426624,_0x4d7f7a){var _0x36d25d=[_0x7ce8('0xd')];return new BPromise(function(_0x51042b,_0xff2d94){return exec(util[_0x7ce8('0xe')](_0x7ce8('0xf'),_0x426624['params'][_0x7ce8('0x10')]),function(_0x3ba4c0,_0x529137,_0x591dcb){if(_0x3ba4c0){return _0xff2d94(_0x3ba4c0);}return _0x51042b(_0x529137);});})['then'](function(_0x573d64){var _0x2dbd3d=![];var _0x3ec1f3=_0x573d64[_0x7ce8('0x11')](/\n/);for(var _0x2edeba=0x0,_0x1d0398=_0x36d25d['length'];_0x2edeba<_0x1d0398,_0x2dbd3d===![];_0x2edeba+=0x1){if(_0x573d64[_0x7ce8('0x12')](_0x36d25d[_0x2edeba])>=0x0){_0x2dbd3d=!![];}}if(!_0x2dbd3d){throw new Error(util[_0x7ce8('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x426624[_0x7ce8('0x13')]['pid']));}process[_0x7ce8('0x14')](_0x426624['params'][_0x7ce8('0x10')],'SIGINT');return _0x4d7f7a[_0x7ce8('0x5')](0xc8)[_0x7ce8('0xb')]({'message':util[_0x7ce8('0xe')](_0x7ce8('0x15'),_0x426624[_0x7ce8('0x13')][_0x7ce8('0x10')])});})[_0x7ce8('0xa')](handleError(_0x4d7f7a,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5f49e55..38da432 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./tag.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x8666ec,_0x34fb14){var _0x496fe8=function(_0x52361d){while(--_0x52361d){_0x8666ec['push'](_0x8666ec['shift']());}};_0x496fe8(++_0x34fb14);}(_0x4ea3,0x70));var _0x34ea=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ea3[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file +var _0x4c4e=['fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x45c546,_0x3448a5){var _0x334206=function(_0x38045a){while(--_0x38045a){_0x45c546['push'](_0x45c546['shift']());}};_0x334206(++_0x3448a5);}(_0x4c4e,0x152));var _0xe4c4=function(_0x58e9a8,_0x523882){_0x58e9a8=_0x58e9a8-0x0;var _0x5c8bbb=_0x4c4e[_0x58e9a8];return _0x5c8bbb;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4c4('0xe')]('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);router[_0xe4c4('0x10')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['update']);router[_0xe4c4('0x11')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 279414a..b02afc3 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 _0xe6d7=['STRING','#0091EA','exports','name'];(function(_0x45d2b2,_0x542058){var _0x1eec14=function(_0x20e290){while(--_0x20e290){_0x45d2b2['push'](_0x45d2b2['shift']());}};_0x1eec14(++_0x542058);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x496bb7,_0x32b9fa){_0x496bb7=_0x496bb7-0x0;var _0x589721=_0xe6d7[_0x496bb7];return _0x589721;};'use strict';var Sequelize=require('sequelize');module[_0x7e6d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7e6d('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':_0x7e6d('0x3')},'description':{'type':Sequelize[_0x7e6d('0x2')]}}; \ No newline at end of file +var _0x0427=['name','#0091EA','STRING'];(function(_0x7d2cb1,_0x1765da){var _0x35e868=function(_0x4d21dc){while(--_0x4d21dc){_0x7d2cb1['push'](_0x7d2cb1['shift']());}};_0x35e868(++_0x1765da);}(_0x0427,0x137));var _0x7042=function(_0x37f7e2,_0xfa6eec){_0x37f7e2=_0x37f7e2-0x0;var _0x243a8b=_0x0427[_0x37f7e2];return _0x243a8b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7042('0x0')],'unique':_0x7042('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7042('0x2')},'description':{'type':Sequelize[_0x7042('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 350f39b..a1a9123 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 _0x79e9=['Tag','fieldName','type','key','model','filters','intersection','attributes','query','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','keys','rawAttributes','include','find','body','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','status','json','undefined','offset','limit','set','reject','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','index','map'];(function(_0x16bf06,_0x170510){var _0x293c9e=function(_0x2c736d){while(--_0x2c736d){_0x16bf06['push'](_0x16bf06['shift']());}};_0x293c9e(++_0x170510);}(_0x79e9,0x116));var _0x979e=function(_0x2931e6,_0x4b79a2){_0x2931e6=_0x2931e6-0x0;var _0x1b1208=_0x79e9[_0x2931e6];return _0x1b1208;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x979e('0x0'));var zipdir=require(_0x979e('0x1'));var jsonpatch=require(_0x979e('0x2'));var rp=require(_0x979e('0x3'));var moment=require(_0x979e('0x4'));var BPromise=require(_0x979e('0x5'));var Mustache=require(_0x979e('0x6'));var util=require(_0x979e('0x7'));var path=require(_0x979e('0x8'));var sox=require(_0x979e('0x9'));var csv=require(_0x979e('0xa'));var ejs=require(_0x979e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x979e('0xc'));var squel=require('squel');var crypto=require(_0x979e('0xd'));var jsforce=require(_0x979e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x979e('0xa'));var querystring=require(_0x979e('0xf'));var Papa=require(_0x979e('0x10'));var Redis=require(_0x979e('0x11'));var authService=require(_0x979e('0x12'));var qs=require(_0x979e('0x13'));var as=require(_0x979e('0x14'));var hardwareService=require(_0x979e('0x15'));var logger=require(_0x979e('0x16'))(_0x979e('0x17'));var utils=require(_0x979e('0x18'));var config=require(_0x979e('0x19'));var licenseUtil=require(_0x979e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x503741,_0x51cd7e){_0x51cd7e=_0x51cd7e||0xcc;return function(_0x2b47aa){if(_0x2b47aa){return _0x503741['sendStatus'](_0x51cd7e);}return _0x503741['status'](_0x51cd7e)['end']();};}function respondWithResult(_0xa556bd,_0x2f2c03){_0x2f2c03=_0x2f2c03||0xc8;return function(_0x94a751){if(_0x94a751){return _0xa556bd[_0x979e('0x1b')](_0x2f2c03)[_0x979e('0x1c')](_0x94a751);}};}function respondWithFilteredResult(_0x439bf4,_0x40a7b5){return function(_0x327587){if(_0x327587){var _0x2bf3fb=typeof _0x40a7b5['offset']===_0x979e('0x1d')&&typeof _0x40a7b5['limit']===_0x979e('0x1d');var _0x3563d6=_0x327587['count'];var _0x5d584a=_0x2bf3fb?0x0:_0x40a7b5[_0x979e('0x1e')];var _0x1cddd0=_0x2bf3fb?_0x327587['count']:_0x40a7b5[_0x979e('0x1e')]+_0x40a7b5[_0x979e('0x1f')];var _0x5343dc;if(_0x1cddd0>=_0x3563d6){_0x1cddd0=_0x3563d6;_0x5343dc=0xc8;}else{_0x5343dc=0xce;}_0x439bf4['status'](_0x5343dc);return _0x439bf4[_0x979e('0x20')]('Content-Range',_0x5d584a+'-'+_0x1cddd0+'/'+_0x3563d6)[_0x979e('0x1c')](_0x327587);}return null;};}function patchUpdates(_0xd94d87){return function(_0x19dc61){try{jsonpatch['apply'](_0x19dc61,_0xd94d87,!![]);}catch(_0x462944){return BPromise[_0x979e('0x21')](_0x462944);}return _0x19dc61['save']();};}function saveUpdates(_0x24841d,_0x40c635){return function(_0x3b0b10){if(_0x3b0b10){return _0x3b0b10[_0x979e('0x22')](_0x24841d)[_0x979e('0x23')](function(_0x5034b1){return _0x5034b1;});}return null;};}function removeEntity(_0x3b1751,_0x1b2961){return function(_0x34f837){if(_0x34f837){return _0x34f837[_0x979e('0x24')]()['then'](function(){var _0x2c3776=_0x34f837[_0x979e('0x25')]({'plain':!![]});var _0x1c49dd=_0x979e('0x26');return db[_0x979e('0x27')][_0x979e('0x24')]({'where':{'type':_0x1c49dd,'resourceId':_0x2c3776['id']}})['then'](function(){return _0x34f837;});})['then'](function(){_0x3b1751[_0x979e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35dfd1,_0x54b8b9){return function(_0x3c1a93){if(!_0x3c1a93){_0x35dfd1[_0x979e('0x28')](0x194);}return _0x3c1a93;};}function handleError(_0x3b352f,_0x3adcf4){_0x3adcf4=_0x3adcf4||0x1f4;return function(_0x3b4bf9){logger[_0x979e('0x29')](_0x3b4bf9['stack']);if(_0x3b4bf9['name']){delete _0x3b4bf9[_0x979e('0x2a')];}_0x3b352f[_0x979e('0x1b')](_0x3adcf4)[_0x979e('0x2b')](_0x3b4bf9);};}exports[_0x979e('0x2c')]=function(_0x103115,_0x5d1600){var _0x2178aa={},_0x52b5e7={},_0x42a5f4={'count':0x0,'rows':[]};var _0x56967d=_[_0x979e('0x2d')](db[_0x979e('0x2e')]['rawAttributes'],function(_0x5915a1){return{'name':_0x5915a1[_0x979e('0x2f')],'type':_0x5915a1[_0x979e('0x30')][_0x979e('0x31')]};});_0x52b5e7[_0x979e('0x32')]=_[_0x979e('0x2d')](_0x56967d,_0x979e('0x2a'));_0x52b5e7['query']=_['keys'](_0x103115['query']);_0x52b5e7[_0x979e('0x33')]=_[_0x979e('0x34')](_0x52b5e7[_0x979e('0x32')],_0x52b5e7['query']);_0x2178aa[_0x979e('0x35')]=_[_0x979e('0x34')](_0x52b5e7[_0x979e('0x32')],qs['fields'](_0x103115[_0x979e('0x36')][_0x979e('0x37')]));_0x2178aa['attributes']=_0x2178aa['attributes']['length']?_0x2178aa[_0x979e('0x35')]:_0x52b5e7[_0x979e('0x32')];if(!_0x103115[_0x979e('0x36')][_0x979e('0x38')](_0x979e('0x39'))){_0x2178aa['limit']=qs[_0x979e('0x1f')](_0x103115[_0x979e('0x36')]['limit']);_0x2178aa[_0x979e('0x1e')]=qs[_0x979e('0x1e')](_0x103115[_0x979e('0x36')][_0x979e('0x1e')]);}_0x2178aa['order']=qs[_0x979e('0x3a')](_0x103115['query']['sort']);_0x2178aa[_0x979e('0x3b')]=qs['filters'](_[_0x979e('0x3c')](_0x103115[_0x979e('0x36')],_0x52b5e7[_0x979e('0x33')]),_0x56967d);if(_0x103115['query']['filter']){_0x2178aa[_0x979e('0x3b')]=_[_0x979e('0x3d')](_0x2178aa['where'],{'$or':_[_0x979e('0x2d')](_0x56967d,function(_0x2dca50){if(_0x2dca50['type']!==_0x979e('0x3e')){var _0x5b6ebe={};_0x5b6ebe[_0x2dca50['name']]={'$like':'%'+_0x103115[_0x979e('0x36')][_0x979e('0x3f')]+'%'};return _0x5b6ebe;}})});}_0x2178aa=_[_0x979e('0x3d')]({},_0x2178aa,_0x103115[_0x979e('0x40')]);var _0x1bdda3={'where':_0x2178aa[_0x979e('0x3b')]};return db[_0x979e('0x2e')]['count'](_0x1bdda3)['then'](function(_0x346995){_0x42a5f4[_0x979e('0x41')]=_0x346995;if(_0x103115[_0x979e('0x36')][_0x979e('0x42')]){_0x2178aa['include']=[{'all':!![]}];}return db[_0x979e('0x2e')][_0x979e('0x43')](_0x2178aa);})[_0x979e('0x23')](function(_0xbced44){_0x42a5f4[_0x979e('0x44')]=_0xbced44;return _0x42a5f4;})[_0x979e('0x23')](respondWithFilteredResult(_0x5d1600,_0x2178aa))[_0x979e('0x45')](handleError(_0x5d1600,null));};exports['show']=function(_0x1fc8a5,_0x5a7da5){var _0x2878d2={'raw':!![],'where':{'id':_0x1fc8a5['params']['id']}},_0x1f1af8={};_0x1f1af8[_0x979e('0x32')]=_[_0x979e('0x46')](db['Tag'][_0x979e('0x47')]);_0x1f1af8[_0x979e('0x36')]=_[_0x979e('0x46')](_0x1fc8a5[_0x979e('0x36')]);_0x1f1af8[_0x979e('0x33')]=_['intersection'](_0x1f1af8['model'],_0x1f1af8['query']);_0x2878d2[_0x979e('0x35')]=_[_0x979e('0x34')](_0x1f1af8[_0x979e('0x32')],qs[_0x979e('0x37')](_0x1fc8a5['query'][_0x979e('0x37')]));_0x2878d2['attributes']=_0x2878d2[_0x979e('0x35')]['length']?_0x2878d2[_0x979e('0x35')]:_0x1f1af8[_0x979e('0x32')];if(_0x1fc8a5[_0x979e('0x36')][_0x979e('0x42')]){_0x2878d2[_0x979e('0x48')]=[{'all':!![]}];}_0x2878d2=_[_0x979e('0x3d')]({},_0x2878d2,_0x1fc8a5[_0x979e('0x40')]);return db['Tag'][_0x979e('0x49')](_0x2878d2)[_0x979e('0x23')](handleEntityNotFound(_0x5a7da5,null))['then'](respondWithResult(_0x5a7da5,null))[_0x979e('0x45')](handleError(_0x5a7da5,null));};exports['create']=function(_0x478dab,_0x45463b){return db[_0x979e('0x2e')]['create'](_0x478dab[_0x979e('0x4a')],{})['then'](function(_0xadf603){var _0x27f35e=_0x478dab['user'][_0x979e('0x25')]({'plain':!![]});if(!_0x27f35e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27f35e['role']==='user'){var _0xe24a32=_0xadf603[_0x979e('0x25')]({'plain':!![]});var _0x1c451b=_0x979e('0x26');return db[_0x979e('0x4b')][_0x979e('0x49')]({'where':{'name':_0x1c451b,'userProfileId':_0x27f35e['userProfileId']},'raw':!![]})[_0x979e('0x23')](function(_0x255820){if(_0x255820&&_0x255820[_0x979e('0x4c')]===0x0){return db[_0x979e('0x27')][_0x979e('0x4d')]({'name':_0xe24a32['name'],'resourceId':_0xe24a32['id'],'type':_0x255820[_0x979e('0x2a')],'sectionId':_0x255820['id']},{})['then'](function(){return _0xadf603;});}else{return _0xadf603;}})['catch'](function(_0x2c11ed){logger['error'](_0x979e('0x4e'),_0x2c11ed);throw _0x2c11ed;});}return _0xadf603;})[_0x979e('0x23')](respondWithResult(_0x45463b,0xc9))[_0x979e('0x45')](handleError(_0x45463b,null));};exports['update']=function(_0x4aaa51,_0x41bd18){if(_0x4aaa51[_0x979e('0x4a')]['id']){delete _0x4aaa51[_0x979e('0x4a')]['id'];}return db[_0x979e('0x2e')]['find']({'where':{'id':_0x4aaa51[_0x979e('0x4f')]['id']}})[_0x979e('0x23')](handleEntityNotFound(_0x41bd18,null))[_0x979e('0x23')](saveUpdates(_0x4aaa51[_0x979e('0x4a')],null))[_0x979e('0x23')](respondWithResult(_0x41bd18,null))['catch'](handleError(_0x41bd18,null));};exports[_0x979e('0x24')]=function(_0x283679,_0x15d64d){return db[_0x979e('0x2e')]['find']({'where':{'id':_0x283679['params']['id']}})['then'](handleEntityNotFound(_0x15d64d,null))[_0x979e('0x23')](removeEntity(_0x15d64d,null))[_0x979e('0x45')](handleError(_0x15d64d,null));};exports[_0x979e('0x50')]=function(_0x179d47,_0x1342f3){return db['Tag'][_0x979e('0x50')]()[_0x979e('0x23')](respondWithResult(_0x1342f3,null))[_0x979e('0x45')](handleError(_0x1342f3,null));}; \ No newline at end of file +var _0xd04e=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Tag','includeAll','include','catch','show','params','keys','filters','find','create','body','user','get','role','userProfileId','autoAssociation','error','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','Tags','UserProfileResource','stack','name','send','index','map','rawAttributes','key','query','intersection','model'];(function(_0x1e7118,_0x414f94){var _0x2d1659=function(_0x5134ad){while(--_0x5134ad){_0x1e7118['push'](_0x1e7118['shift']());}};_0x2d1659(++_0x414f94);}(_0xd04e,0x10d));var _0xed04=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xd04e[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xed04('0x0'));var rimraf=require(_0xed04('0x1'));var zipdir=require(_0xed04('0x2'));var jsonpatch=require(_0xed04('0x3'));var rp=require(_0xed04('0x4'));var moment=require(_0xed04('0x5'));var BPromise=require(_0xed04('0x6'));var Mustache=require(_0xed04('0x7'));var util=require(_0xed04('0x8'));var path=require('path');var sox=require(_0xed04('0x9'));var csv=require(_0xed04('0xa'));var ejs=require(_0xed04('0xb'));var fs=require('fs');var fs_extra=require(_0xed04('0xc'));var _=require(_0xed04('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed04('0xe'));var toCsv=require(_0xed04('0xa'));var querystring=require(_0xed04('0xf'));var Papa=require(_0xed04('0x10'));var Redis=require(_0xed04('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed04('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed04('0x13'))('api');var utils=require(_0xed04('0x14'));var config=require(_0xed04('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xed04('0x16'))['db'];function respondWithStatusCode(_0x367e08,_0x54a165){_0x54a165=_0x54a165||0xcc;return function(_0x4d0a9c){if(_0x4d0a9c){return _0x367e08[_0xed04('0x17')](_0x54a165);}return _0x367e08[_0xed04('0x18')](_0x54a165)[_0xed04('0x19')]();};}function respondWithResult(_0x11cb2c,_0x3c4736){_0x3c4736=_0x3c4736||0xc8;return function(_0x4355ff){if(_0x4355ff){return _0x11cb2c['status'](_0x3c4736)['json'](_0x4355ff);}};}function respondWithFilteredResult(_0x55c385,_0x14be6e){return function(_0x52d43b){if(_0x52d43b){var _0x2fe96e=typeof _0x14be6e[_0xed04('0x1a')]===_0xed04('0x1b')&&typeof _0x14be6e['limit']===_0xed04('0x1b');var _0x4af7be=_0x52d43b[_0xed04('0x1c')];var _0x2d081d=_0x2fe96e?0x0:_0x14be6e[_0xed04('0x1a')];var _0x5a1956=_0x2fe96e?_0x52d43b[_0xed04('0x1c')]:_0x14be6e['offset']+_0x14be6e[_0xed04('0x1d')];var _0x220056;if(_0x5a1956>=_0x4af7be){_0x5a1956=_0x4af7be;_0x220056=0xc8;}else{_0x220056=0xce;}_0x55c385['status'](_0x220056);return _0x55c385['set'](_0xed04('0x1e'),_0x2d081d+'-'+_0x5a1956+'/'+_0x4af7be)['json'](_0x52d43b);}return null;};}function patchUpdates(_0x55abc1){return function(_0x112508){try{jsonpatch[_0xed04('0x1f')](_0x112508,_0x55abc1,!![]);}catch(_0x40a8be){return BPromise['reject'](_0x40a8be);}return _0x112508['save']();};}function saveUpdates(_0x5312c6,_0x1314aa){return function(_0x1afd0b){if(_0x1afd0b){return _0x1afd0b[_0xed04('0x20')](_0x5312c6)[_0xed04('0x21')](function(_0x504a23){return _0x504a23;});}return null;};}function removeEntity(_0x57d4c4,_0x1841b3){return function(_0x67eb94){if(_0x67eb94){return _0x67eb94[_0xed04('0x22')]()[_0xed04('0x21')](function(){var _0x2c30f8=_0x67eb94['get']({'plain':!![]});var _0x465e2f=_0xed04('0x23');return db[_0xed04('0x24')][_0xed04('0x22')]({'where':{'type':_0x465e2f,'resourceId':_0x2c30f8['id']}})['then'](function(){return _0x67eb94;});})[_0xed04('0x21')](function(){_0x57d4c4[_0xed04('0x18')](0xcc)[_0xed04('0x19')]();});}};}function handleEntityNotFound(_0x5f2cc4,_0x3b95ee){return function(_0xff01e8){if(!_0xff01e8){_0x5f2cc4[_0xed04('0x17')](0x194);}return _0xff01e8;};}function handleError(_0x35f3f0,_0xc6b702){_0xc6b702=_0xc6b702||0x1f4;return function(_0x509068){logger['error'](_0x509068[_0xed04('0x25')]);if(_0x509068['name']){delete _0x509068[_0xed04('0x26')];}_0x35f3f0[_0xed04('0x18')](_0xc6b702)[_0xed04('0x27')](_0x509068);};}exports[_0xed04('0x28')]=function(_0x6ac126,_0x5c9168){var _0x5b1616={},_0xf39044={},_0x1e52b4={'count':0x0,'rows':[]};var _0x3d7367=_[_0xed04('0x29')](db['Tag'][_0xed04('0x2a')],function(_0x35efde){return{'name':_0x35efde['fieldName'],'type':_0x35efde['type'][_0xed04('0x2b')]};});_0xf39044['model']=_[_0xed04('0x29')](_0x3d7367,_0xed04('0x26'));_0xf39044['query']=_['keys'](_0x6ac126[_0xed04('0x2c')]);_0xf39044['filters']=_[_0xed04('0x2d')](_0xf39044[_0xed04('0x2e')],_0xf39044[_0xed04('0x2c')]);_0x5b1616[_0xed04('0x2f')]=_['intersection'](_0xf39044[_0xed04('0x2e')],qs[_0xed04('0x30')](_0x6ac126[_0xed04('0x2c')]['fields']));_0x5b1616[_0xed04('0x2f')]=_0x5b1616[_0xed04('0x2f')][_0xed04('0x31')]?_0x5b1616['attributes']:_0xf39044[_0xed04('0x2e')];if(!_0x6ac126['query'][_0xed04('0x32')](_0xed04('0x33'))){_0x5b1616[_0xed04('0x1d')]=qs[_0xed04('0x1d')](_0x6ac126[_0xed04('0x2c')][_0xed04('0x1d')]);_0x5b1616[_0xed04('0x1a')]=qs[_0xed04('0x1a')](_0x6ac126[_0xed04('0x2c')]['offset']);}_0x5b1616[_0xed04('0x34')]=qs[_0xed04('0x35')](_0x6ac126[_0xed04('0x2c')][_0xed04('0x35')]);_0x5b1616[_0xed04('0x36')]=qs['filters'](_[_0xed04('0x37')](_0x6ac126[_0xed04('0x2c')],_0xf39044['filters']),_0x3d7367);if(_0x6ac126[_0xed04('0x2c')][_0xed04('0x38')]){_0x5b1616['where']=_[_0xed04('0x39')](_0x5b1616[_0xed04('0x36')],{'$or':_[_0xed04('0x29')](_0x3d7367,function(_0x4f9e2f){if(_0x4f9e2f[_0xed04('0x3a')]!==_0xed04('0x3b')){var _0xa0e388={};_0xa0e388[_0x4f9e2f['name']]={'$like':'%'+_0x6ac126[_0xed04('0x2c')][_0xed04('0x38')]+'%'};return _0xa0e388;}})});}_0x5b1616=_[_0xed04('0x39')]({},_0x5b1616,_0x6ac126[_0xed04('0x3c')]);var _0x18a6d2={'where':_0x5b1616[_0xed04('0x36')]};return db[_0xed04('0x3d')]['count'](_0x18a6d2)[_0xed04('0x21')](function(_0x3d853e){_0x1e52b4['count']=_0x3d853e;if(_0x6ac126[_0xed04('0x2c')][_0xed04('0x3e')]){_0x5b1616[_0xed04('0x3f')]=[{'all':!![]}];}return db[_0xed04('0x3d')]['findAll'](_0x5b1616);})[_0xed04('0x21')](function(_0x311ec5){_0x1e52b4['rows']=_0x311ec5;return _0x1e52b4;})[_0xed04('0x21')](respondWithFilteredResult(_0x5c9168,_0x5b1616))[_0xed04('0x40')](handleError(_0x5c9168,null));};exports[_0xed04('0x41')]=function(_0x533117,_0x380932){var _0x33d49c={'raw':!![],'where':{'id':_0x533117[_0xed04('0x42')]['id']}},_0x2dfa43={};_0x2dfa43[_0xed04('0x2e')]=_[_0xed04('0x43')](db[_0xed04('0x3d')]['rawAttributes']);_0x2dfa43[_0xed04('0x2c')]=_[_0xed04('0x43')](_0x533117[_0xed04('0x2c')]);_0x2dfa43[_0xed04('0x44')]=_['intersection'](_0x2dfa43[_0xed04('0x2e')],_0x2dfa43[_0xed04('0x2c')]);_0x33d49c[_0xed04('0x2f')]=_[_0xed04('0x2d')](_0x2dfa43[_0xed04('0x2e')],qs['fields'](_0x533117[_0xed04('0x2c')][_0xed04('0x30')]));_0x33d49c['attributes']=_0x33d49c[_0xed04('0x2f')][_0xed04('0x31')]?_0x33d49c['attributes']:_0x2dfa43[_0xed04('0x2e')];if(_0x533117[_0xed04('0x2c')]['includeAll']){_0x33d49c[_0xed04('0x3f')]=[{'all':!![]}];}_0x33d49c=_[_0xed04('0x39')]({},_0x33d49c,_0x533117[_0xed04('0x3c')]);return db['Tag'][_0xed04('0x45')](_0x33d49c)[_0xed04('0x21')](handleEntityNotFound(_0x380932,null))[_0xed04('0x21')](respondWithResult(_0x380932,null))[_0xed04('0x40')](handleError(_0x380932,null));};exports[_0xed04('0x46')]=function(_0x4cfec3,_0xc74227){return db[_0xed04('0x3d')][_0xed04('0x46')](_0x4cfec3[_0xed04('0x47')],{})[_0xed04('0x21')](function(_0x4675e8){var _0x5b62c5=_0x4cfec3[_0xed04('0x48')][_0xed04('0x49')]({'plain':!![]});if(!_0x5b62c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b62c5[_0xed04('0x4a')]===_0xed04('0x48')){var _0x28baaf=_0x4675e8[_0xed04('0x49')]({'plain':!![]});var _0x46dc3a=_0xed04('0x23');return db['UserProfileSection'][_0xed04('0x45')]({'where':{'name':_0x46dc3a,'userProfileId':_0x5b62c5[_0xed04('0x4b')]},'raw':!![]})[_0xed04('0x21')](function(_0x5c5d29){if(_0x5c5d29&&_0x5c5d29[_0xed04('0x4c')]===0x0){return db[_0xed04('0x24')]['create']({'name':_0x28baaf[_0xed04('0x26')],'resourceId':_0x28baaf['id'],'type':_0x5c5d29[_0xed04('0x26')],'sectionId':_0x5c5d29['id']},{})[_0xed04('0x21')](function(){return _0x4675e8;});}else{return _0x4675e8;}})[_0xed04('0x40')](function(_0x17f2ec){logger[_0xed04('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17f2ec);throw _0x17f2ec;});}return _0x4675e8;})[_0xed04('0x21')](respondWithResult(_0xc74227,0xc9))['catch'](handleError(_0xc74227,null));};exports[_0xed04('0x20')]=function(_0x18b2aa,_0x3bb61a){if(_0x18b2aa[_0xed04('0x47')]['id']){delete _0x18b2aa['body']['id'];}return db[_0xed04('0x3d')][_0xed04('0x45')]({'where':{'id':_0x18b2aa[_0xed04('0x42')]['id']}})[_0xed04('0x21')](handleEntityNotFound(_0x3bb61a,null))[_0xed04('0x21')](saveUpdates(_0x18b2aa[_0xed04('0x47')],null))[_0xed04('0x21')](respondWithResult(_0x3bb61a,null))[_0xed04('0x40')](handleError(_0x3bb61a,null));};exports[_0xed04('0x22')]=function(_0x187862,_0xbcb6bf){return db[_0xed04('0x3d')][_0xed04('0x45')]({'where':{'id':_0x187862[_0xed04('0x42')]['id']}})[_0xed04('0x21')](handleEntityNotFound(_0xbcb6bf,null))[_0xed04('0x21')](removeEntity(_0xbcb6bf,null))['catch'](handleError(_0xbcb6bf,null));};exports['describe']=function(_0x5e9373,_0x1d4765){return db[_0xed04('0x3d')][_0xed04('0x4e')]()[_0xed04('0x21')](respondWithResult(_0x1d4765,null))['catch'](handleError(_0x1d4765,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a1a6f52..a8ee4bb 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 _0x6da2=['rimraf','./tag.attributes','exports','define','tools_tags','lodash','api','moment','bluebird','request-promise','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6da2,0xe1));var _0x26da=function(_0xb67251,_0x1f6208){_0xb67251=_0xb67251-0x0;var _0x979d96=_0x6da2[_0xb67251];return _0x979d96;};'use strict';var _=require(_0x26da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26da('0x1'));var moment=require(_0x26da('0x2'));var BPromise=require(_0x26da('0x3'));var rp=require(_0x26da('0x4'));var fs=require('fs');var path=require(_0x26da('0x5'));var rimraf=require(_0x26da('0x6'));var config=require('../../config/environment');var attributes=require(_0x26da('0x7'));module[_0x26da('0x8')]=function(_0x567514,_0x1ffca4){return _0x567514[_0x26da('0x9')]('Tag',attributes,{'tableName':_0x26da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06c5=['./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x06c5,0x88));var _0x506c=function(_0x213c87,_0x4bbaa4){_0x213c87=_0x213c87-0x0;var _0x3861c7=_0x06c5[_0x213c87];return _0x3861c7;};'use strict';var _=require(_0x506c('0x0'));var util=require(_0x506c('0x1'));var logger=require(_0x506c('0x2'))(_0x506c('0x3'));var moment=require('moment');var BPromise=require(_0x506c('0x4'));var rp=require(_0x506c('0x5'));var fs=require('fs');var path=require(_0x506c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x506c('0x7'));module[_0x506c('0x8')]=function(_0x5a542a,_0x536372){return _0x5a542a[_0x506c('0x9')]('Tag',attributes,{'tableName':_0x506c('0xa'),'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 083487e..16612bb 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 _0x402f=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','message','error','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x2b674d,_0x4c6f0f){var _0x32dd54=function(_0xc3f584){while(--_0xc3f584){_0x2b674d['push'](_0x2b674d['shift']());}};_0x32dd54(++_0x4c6f0f);}(_0x402f,0x6f));var _0xf402=function(_0x44c464,_0x27b695){_0x44c464=_0x44c464-0x0;var _0x39299e=_0x402f[_0x44c464];return _0x39299e;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var moment=require(_0xf402('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf402('0x2'));var db=require(_0xf402('0x3'))['db'];var utils=require(_0xf402('0x4'));var logger=require('../../config/logger')(_0xf402('0x5'));var config=require('../../config/environment');var jayson=require(_0xf402('0x6'));var client=jayson[_0xf402('0x7')][_0xf402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8774,_0xa1b27d,_0x55c515){return new BPromise(function(_0x4d1771,_0x2f0ffe){return client[_0xf402('0x9')](_0x2a8774,_0x55c515)[_0xf402('0xa')](function(_0xdc18e0){logger[_0xf402('0xb')](_0xf402('0xc'),_0xa1b27d,_0xf402('0xd'));logger[_0xf402('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'),JSON['stringify'](_0xdc18e0));if(_0xdc18e0['error']){if(_0xdc18e0['error']['code']===0x1f4){logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0['error']['message']);return _0x2f0ffe(_0xdc18e0['error'][_0xf402('0xf')]);}logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0[_0xf402('0x10')][_0xf402('0xf')]);return _0x4d1771(_0xdc18e0[_0xf402('0x10')]['message']);}else{logger[_0xf402('0xb')]('Tag,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'));_0x4d1771(_0xdc18e0['result']['message']);}})['catch'](function(_0xb45d00){logger[_0xf402('0x10')](_0xf402('0xc'),_0xa1b27d,_0xb45d00);_0x2f0ffe(_0xb45d00);});});} \ No newline at end of file +var _0x2fed=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x2fed,0x7c));var _0xd2fe=function(_0x4f17a6,_0x1577cc){_0x4f17a6=_0x4f17a6-0x0;var _0x48526a=_0x2fed[_0x4f17a6];return _0x48526a;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var moment=require(_0xd2fe('0x2'));var BPromise=require(_0xd2fe('0x3'));var rs=require(_0xd2fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2fe('0x5'))['db'];var utils=require(_0xd2fe('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd2fe('0x7'));var jayson=require(_0xd2fe('0x8'));var client=jayson[_0xd2fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7bf5,_0x44e015,_0x3b6591){return new BPromise(function(_0x42a8fb,_0x47996a){return client[_0xd2fe('0xa')](_0x2f7bf5,_0x3b6591)[_0xd2fe('0xb')](function(_0x815784){logger[_0xd2fe('0xc')](_0xd2fe('0xd'),_0x44e015,_0xd2fe('0xe'));logger[_0xd2fe('0xf')](_0xd2fe('0x10'),_0x44e015,_0xd2fe('0xe'),JSON[_0xd2fe('0x11')](_0x815784));if(_0x815784[_0xd2fe('0x12')]){if(_0x815784[_0xd2fe('0x12')][_0xd2fe('0x13')]===0x1f4){logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')][_0xd2fe('0x14')]);return _0x47996a(_0x815784[_0xd2fe('0x12')]['message']);}logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')]['message']);return _0x42a8fb(_0x815784['error']['message']);}else{logger[_0xd2fe('0xc')]('Tag,\x20%s,\x20%s',_0x44e015,_0xd2fe('0xe'));_0x42a8fb(_0x815784[_0xd2fe('0x15')][_0xd2fe('0x14')]);}})[_0xd2fe('0x16')](function(_0x303ca2){logger[_0xd2fe('0x12')]('Tag,\x20%s,\x20%s',_0x44e015,_0x303ca2);_0x47996a(_0x303ca2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index cd321e1..1007ad4 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 66d7932..042817b 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 _0xb7e7=['STRING','sequelize'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1acc09,_0x31584c){var _0x313f5d=function(_0x384d69){while(--_0x384d69){_0x1acc09['push'](_0x1acc09['shift']());}};_0x313f5d(++_0x31584c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'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 b2f5b40..d1ccd06 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 _0x543b=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserVoiceQueue','MailQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','isArray','Chat','Fax','Openchannel','Whatsapp','transaction','QueueId','Voice','TeamVoiceQueue','penalty','findOrCreate','Queue:save','User','voicePause','interface','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Mail','emit','Queue:remove','UserVoiceQueueRt','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include'];(function(_0xa40325,_0x1ab4cb){var _0x362dcd=function(_0x2b4faf){while(--_0x2b4faf){_0xa40325['push'](_0xa40325['shift']());}};_0x362dcd(++_0x1ab4cb);}(_0x543b,0xf1));var _0xb543=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x543b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xb543('0x0'));var rimraf=require(_0xb543('0x1'));var zipdir=require(_0xb543('0x2'));var jsonpatch=require(_0xb543('0x3'));var rp=require(_0xb543('0x4'));var moment=require(_0xb543('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb543('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb543('0x7'));var csv=require(_0xb543('0x8'));var ejs=require(_0xb543('0x9'));var fs=require('fs');var fs_extra=require(_0xb543('0xa'));var _=require(_0xb543('0xb'));var squel=require('squel');var crypto=require(_0xb543('0xc'));var jsforce=require(_0xb543('0xd'));var deskjs=require(_0xb543('0xe'));var toCsv=require(_0xb543('0x8'));var querystring=require(_0xb543('0xf'));var Papa=require(_0xb543('0x10'));var Redis=require(_0xb543('0x11'));var authService=require(_0xb543('0x12'));var qs=require(_0xb543('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb543('0x14'));var logger=require(_0xb543('0x15'))(_0xb543('0x16'));var utils=require(_0xb543('0x17'));var config=require(_0xb543('0x18'));var licenseUtil=require(_0xb543('0x19'));var db=require(_0xb543('0x1a'))['db'];config[_0xb543('0x1b')]=_[_0xb543('0x1c')](config[_0xb543('0x1b')],{'host':_0xb543('0x1d'),'port':0x18eb});var socket=require(_0xb543('0x1e'))(new Redis(config[_0xb543('0x1b')]));require(_0xb543('0x1f'))['register'](socket);function respondWithStatusCode(_0x1df45a,_0x5ea406){_0x5ea406=_0x5ea406||0xcc;return function(_0x4c1291){if(_0x4c1291){return _0x1df45a['sendStatus'](_0x5ea406);}return _0x1df45a[_0xb543('0x20')](_0x5ea406)[_0xb543('0x21')]();};}function respondWithResult(_0x2a58fd,_0xda8784){_0xda8784=_0xda8784||0xc8;return function(_0x2d125){if(_0x2d125){return _0x2a58fd[_0xb543('0x20')](_0xda8784)[_0xb543('0x22')](_0x2d125);}};}function respondWithFilteredResult(_0x120f8b,_0x3094af){return function(_0x19a00c){if(_0x19a00c){var _0x1899a9=typeof _0x3094af['offset']===_0xb543('0x23')&&typeof _0x3094af[_0xb543('0x24')]===_0xb543('0x23');var _0x124946=_0x19a00c['count'];var _0x17af81=_0x1899a9?0x0:_0x3094af[_0xb543('0x25')];var _0x2a5f2c=_0x1899a9?_0x19a00c[_0xb543('0x26')]:_0x3094af['offset']+_0x3094af[_0xb543('0x24')];var _0x5b1be9;if(_0x2a5f2c>=_0x124946){_0x2a5f2c=_0x124946;_0x5b1be9=0xc8;}else{_0x5b1be9=0xce;}_0x120f8b[_0xb543('0x20')](_0x5b1be9);return _0x120f8b['set'](_0xb543('0x27'),_0x17af81+'-'+_0x2a5f2c+'/'+_0x124946)[_0xb543('0x22')](_0x19a00c);}return null;};}function patchUpdates(_0x56b41){return function(_0x49b90c){try{jsonpatch[_0xb543('0x28')](_0x49b90c,_0x56b41,!![]);}catch(_0x4b861c){return BPromise[_0xb543('0x29')](_0x4b861c);}return _0x49b90c[_0xb543('0x2a')]();};}function saveUpdates(_0x814ae6,_0x1410a9){return function(_0x506142){if(_0x506142){return _0x506142[_0xb543('0x2b')](_0x814ae6)[_0xb543('0x2c')](function(_0x5d08d1){return _0x5d08d1;});}return null;};}function handleEntityNotFound(_0x3032e7,_0x325046){return function(_0x32eb6){if(!_0x32eb6){_0x3032e7[_0xb543('0x2d')](0x194);}return _0x32eb6;};}function handleError(_0x520490,_0x65488c){_0x65488c=_0x65488c||0x1f4;return function(_0x4e4fde){logger[_0xb543('0x2e')](_0x4e4fde[_0xb543('0x2f')]);if(_0x4e4fde[_0xb543('0x30')]){delete _0x4e4fde['name'];}_0x520490[_0xb543('0x20')](_0x65488c)[_0xb543('0x31')](_0x4e4fde);};}exports[_0xb543('0x32')]=function(_0x50727b,_0x5e5d98){var _0x3336dc={},_0x218747={},_0xe5def0={'count':0x0,'rows':[]};var _0x86c8b5=_[_0xb543('0x33')](db[_0xb543('0x34')][_0xb543('0x35')],function(_0x59f1d5){return{'name':_0x59f1d5[_0xb543('0x36')],'type':_0x59f1d5[_0xb543('0x37')][_0xb543('0x38')]};});_0x218747[_0xb543('0x39')]=_[_0xb543('0x33')](_0x86c8b5,_0xb543('0x30'));_0x218747[_0xb543('0x3a')]=_['keys'](_0x50727b[_0xb543('0x3a')]);_0x218747[_0xb543('0x3b')]=_[_0xb543('0x3c')](_0x218747[_0xb543('0x39')],_0x218747[_0xb543('0x3a')]);_0x3336dc['attributes']=_[_0xb543('0x3c')](_0x218747[_0xb543('0x39')],qs[_0xb543('0x3d')](_0x50727b[_0xb543('0x3a')][_0xb543('0x3d')]));_0x3336dc[_0xb543('0x3e')]=_0x3336dc[_0xb543('0x3e')][_0xb543('0x3f')]?_0x3336dc[_0xb543('0x3e')]:_0x218747[_0xb543('0x39')];if(!_0x50727b[_0xb543('0x3a')][_0xb543('0x40')](_0xb543('0x41'))){_0x3336dc[_0xb543('0x24')]=qs[_0xb543('0x24')](_0x50727b[_0xb543('0x3a')]['limit']);_0x3336dc['offset']=qs[_0xb543('0x25')](_0x50727b[_0xb543('0x3a')][_0xb543('0x25')]);}_0x3336dc[_0xb543('0x42')]=qs[_0xb543('0x43')](_0x50727b[_0xb543('0x3a')]['sort']);_0x3336dc[_0xb543('0x44')]=qs[_0xb543('0x3b')](_['pick'](_0x50727b['query'],_0x218747['filters']),_0x86c8b5);if(_0x50727b[_0xb543('0x3a')][_0xb543('0x45')]){_0x3336dc['where']=_['merge'](_0x3336dc['where'],{'$or':_[_0xb543('0x33')](_0x86c8b5,function(_0x15c785){if(_0x15c785[_0xb543('0x37')]!==_0xb543('0x46')){var _0x5e45c8={};_0x5e45c8[_0x15c785[_0xb543('0x30')]]={'$like':'%'+_0x50727b[_0xb543('0x3a')][_0xb543('0x45')]+'%'};return _0x5e45c8;}})});}_0x3336dc=_[_0xb543('0x47')]({},_0x3336dc,_0x50727b[_0xb543('0x48')]);var _0x22a506={'where':_0x3336dc[_0xb543('0x44')]};return db[_0xb543('0x34')]['count'](_0x22a506)[_0xb543('0x2c')](function(_0x35e0d0){_0xe5def0[_0xb543('0x26')]=_0x35e0d0;if(_0x50727b[_0xb543('0x3a')][_0xb543('0x49')]){_0x3336dc['include']=[{'all':!![]}];}return db[_0xb543('0x34')][_0xb543('0x4a')](_0x3336dc);})[_0xb543('0x2c')](function(_0x2616c6){_0xe5def0[_0xb543('0x4b')]=_0x2616c6;return _0xe5def0;})['then'](respondWithFilteredResult(_0x5e5d98,_0x3336dc))[_0xb543('0x4c')](handleError(_0x5e5d98,null));};exports[_0xb543('0x4d')]=function(_0x3cc6fd,_0x536fa7){var _0xf7f51b={'raw':![],'where':{'id':_0x3cc6fd[_0xb543('0x4e')]['id']}},_0x37bca4={};_0x37bca4[_0xb543('0x39')]=_[_0xb543('0x4f')](db[_0xb543('0x34')][_0xb543('0x35')]);_0x37bca4[_0xb543('0x3a')]=_['keys'](_0x3cc6fd[_0xb543('0x3a')]);_0x37bca4['filters']=_[_0xb543('0x3c')](_0x37bca4[_0xb543('0x39')],_0x37bca4[_0xb543('0x3a')]);_0xf7f51b[_0xb543('0x3e')]=_['intersection'](_0x37bca4['model'],qs[_0xb543('0x3d')](_0x3cc6fd[_0xb543('0x3a')]['fields']));_0xf7f51b['attributes']=_0xf7f51b['attributes'][_0xb543('0x3f')]?_0xf7f51b[_0xb543('0x3e')]:_0x37bca4[_0xb543('0x39')];if(_0x3cc6fd[_0xb543('0x3a')]['includeAll']){_0xf7f51b[_0xb543('0x50')]=[{'all':!![]}];}_0xf7f51b=_['merge']({},_0xf7f51b,_0x3cc6fd[_0xb543('0x48')]);return db['Team']['find'](_0xf7f51b)[_0xb543('0x2c')](handleEntityNotFound(_0x536fa7,null))[_0xb543('0x2c')](respondWithResult(_0x536fa7,null))['catch'](handleError(_0x536fa7,null));};exports[_0xb543('0x51')]=function(_0x812842,_0x59abfe){return db[_0xb543('0x34')]['create'](_0x812842[_0xb543('0x52')],{})['then'](function(_0xfec79d){var _0x5ad8e2=_0x812842[_0xb543('0x53')][_0xb543('0x54')]({'plain':!![]});if(!_0x5ad8e2)throw new Error(_0xb543('0x55'));if(_0x5ad8e2[_0xb543('0x56')]==='user'){var _0x265cb1=_0xfec79d['get']({'plain':!![]});var _0x937aee=_0xb543('0x57');return db[_0xb543('0x58')][_0xb543('0x59')]({'where':{'name':_0x937aee,'userProfileId':_0x5ad8e2[_0xb543('0x5a')]},'raw':!![]})[_0xb543('0x2c')](function(_0x1e8b63){if(_0x1e8b63&&_0x1e8b63[_0xb543('0x5b')]===0x0){return db[_0xb543('0x5c')][_0xb543('0x51')]({'name':_0x265cb1[_0xb543('0x30')],'resourceId':_0x265cb1['id'],'type':_0x1e8b63['name'],'sectionId':_0x1e8b63['id']},{})[_0xb543('0x2c')](function(){return _0xfec79d;});}else{return _0xfec79d;}})[_0xb543('0x4c')](function(_0x22e169){logger[_0xb543('0x2e')](_0xb543('0x5d'),_0x22e169);throw _0x22e169;});}return _0xfec79d;})[_0xb543('0x2c')](respondWithResult(_0x59abfe,0xc9))[_0xb543('0x4c')](handleError(_0x59abfe,null));};exports['update']=function(_0x158893,_0x4031d8){if(_0x158893[_0xb543('0x52')]['id']){delete _0x158893['body']['id'];}return db['Team'][_0xb543('0x59')]({'where':{'id':_0x158893['params']['id']}})[_0xb543('0x2c')](handleEntityNotFound(_0x4031d8,null))[_0xb543('0x2c')](saveUpdates(_0x158893[_0xb543('0x52')],null))[_0xb543('0x2c')](respondWithResult(_0x4031d8,null))['catch'](handleError(_0x4031d8,null));};exports[_0xb543('0x5e')]=function(_0x3ef85c,_0x357e85){var _0x311e80=_0x3ef85c[_0xb543('0x4e')]['id'];var _0x523840=[];return db[_0xb543('0x5f')]['transaction'](function(_0x40521d){var _0x2d6424=_0xb543('0x60')+_0x311e80;return db[_0xb543('0x5f')][_0xb543('0x3a')](_0x2d6424,{'type':db[_0xb543('0x61')]['QueryTypes'][_0xb543('0x62')],'raw':!![],'transaction':_0x40521d})[_0xb543('0x2c')](function(_0x553622){_0x523840=_[_0xb543('0x33')](_0x553622,function(_0x3c2f50){return Number(_0x3c2f50[_0xb543('0x63')]);});})[_0xb543('0x2c')](function(){var _0x37675e=_0xb543('0x64')+_0x311e80;return db[_0xb543('0x5f')][_0xb543('0x3a')](_0x37675e,{'type':db[_0xb543('0x61')][_0xb543('0x65')]['SELECT'],'raw':!![],'transaction':_0x40521d});})[_0xb543('0x2c')](function(_0x227648){var _0x42660=_[_0xb543('0x33')](_0x227648,function(_0x440d5b){return Number(_0x440d5b['VoiceQueueId']);});return db[_0xb543('0x66')]['destroy']({'where':{'UserId':{'$in':_0x523840},'VoiceQueueId':{'$in':_0x42660}},'transaction':_0x40521d});})[_0xb543('0x2c')](function(){var _0xc887e6='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x311e80;return db['sequelize'][_0xb543('0x3a')](_0xc887e6,{'type':db[_0xb543('0x61')][_0xb543('0x65')][_0xb543('0x62')],'raw':!![],'transaction':_0x40521d});})['then'](function(_0x19b1d5){var _0x41aabc=_['map'](_0x19b1d5,function(_0x2ab154){return Number(_0x2ab154[_0xb543('0x67')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x523840},'MailQueueId':{'$in':_0x41aabc}},'transaction':_0x40521d});})['then'](function(){var _0x95311b='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x311e80;return db[_0xb543('0x5f')]['query'](_0x95311b,{'type':db[_0xb543('0x61')]['QueryTypes'][_0xb543('0x62')],'raw':!![],'transaction':_0x40521d});})[_0xb543('0x2c')](function(_0xdc4fd6){var _0x57007e=_['map'](_0xdc4fd6,function(_0x19d73b){return Number(_0x19d73b['SmsQueueId']);});return db[_0xb543('0x68')][_0xb543('0x5e')]({'where':{'UserId':{'$in':_0x523840},'SmsQueueId':{'$in':_0x57007e}},'transaction':_0x40521d});})['then'](function(){var _0x17e37e=_0xb543('0x69')+_0x311e80;return db[_0xb543('0x5f')][_0xb543('0x3a')](_0x17e37e,{'type':db[_0xb543('0x61')][_0xb543('0x65')]['SELECT'],'raw':!![],'transaction':_0x40521d});})[_0xb543('0x2c')](function(_0x3f4fe8){var _0x243749=_[_0xb543('0x33')](_0x3f4fe8,function(_0x476a19){return Number(_0x476a19[_0xb543('0x6a')]);});return db[_0xb543('0x6b')][_0xb543('0x5e')]({'where':{'UserId':{'$in':_0x523840},'ChatQueueId':{'$in':_0x243749}},'transaction':_0x40521d});})['then'](function(){var _0x89524b=_0xb543('0x6c')+_0x311e80;return db[_0xb543('0x5f')][_0xb543('0x3a')](_0x89524b,{'type':db[_0xb543('0x61')][_0xb543('0x65')][_0xb543('0x62')],'raw':!![],'transaction':_0x40521d});})['then'](function(_0x3a5df4){var _0x37fe91=_['map'](_0x3a5df4,function(_0x2b30f9){return Number(_0x2b30f9['FaxQueueId']);});return db[_0xb543('0x6d')][_0xb543('0x5e')]({'where':{'UserId':{'$in':_0x523840},'FaxQueueId':{'$in':_0x37fe91}},'transaction':_0x40521d});})[_0xb543('0x2c')](function(){var _0x2be521=_0xb543('0x6e')+_0x311e80;return db[_0xb543('0x5f')]['query'](_0x2be521,{'type':db[_0xb543('0x61')]['QueryTypes'][_0xb543('0x62')],'raw':!![],'transaction':_0x40521d});})[_0xb543('0x2c')](function(_0x235c34){var _0x3fff90=_[_0xb543('0x33')](_0x235c34,function(_0x4f0495){return Number(_0x4f0495['OpenchannelQueueId']);});return db[_0xb543('0x6f')][_0xb543('0x5e')]({'where':{'UserId':{'$in':_0x523840},'OpenchannelQueueId':{'$in':_0x3fff90}},'transaction':_0x40521d});})[_0xb543('0x2c')](function(){var _0x9daa98=_0xb543('0x70')+_0x311e80;return db['sequelize'][_0xb543('0x3a')](_0x9daa98,{'type':db[_0xb543('0x61')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x40521d});})['then'](function(_0x320b0c){var _0x2dd725=_[_0xb543('0x33')](_0x320b0c,function(_0x15a15f){return Number(_0x15a15f[_0xb543('0x71')]);});return db['UserWhatsappQueue'][_0xb543('0x5e')]({'where':{'UserId':{'$in':_0x523840},'WhatsappQueueId':{'$in':_0x2dd725}},'transaction':_0x40521d});})['then'](function(){return db[_0xb543('0x72')]['find']({'where':{'TeamId':_0x311e80}});})[_0xb543('0x2c')](function(_0x5ce7ef){if(_0x5ce7ef===null){return;}return db[_0xb543('0x73')][_0xb543('0x5e')]({'where':{'UserId':{'$in':_0x523840},'VoicePrefixId':_0x5ce7ef[_0xb543('0x74')]},'transaction':_0x40521d});})['then'](function(){return db['Team'][_0xb543('0x5e')]({'where':{'id':_0x311e80},'cascade':!![],'transaction':_0x40521d});})['then'](function(_0x37b63a){if(_0x37b63a===0x0){_0x357e85['sendStatus'](0x194);}else{return db[_0xb543('0x5c')][_0xb543('0x5e')]({'where':{'type':'Teams','resourceId':_0x311e80},'cascade':!![],'transaction':_0x40521d})[_0xb543('0x2c')](function(){_0x357e85[_0xb543('0x20')](0xcc)[_0xb543('0x21')]();});}})[_0xb543('0x4c')](function(_0x1c1a85){_0x357e85['status'](0x1f4)[_0xb543('0x31')](_0x1c1a85);});});};exports[_0xb543('0x75')]=function(_0x100d17,_0x7b896e,_0x80bfaa){return db['Team']['findOne']({'where':{'id':_0x100d17[_0xb543('0x4e')]['id']}})[_0xb543('0x2c')](handleEntityNotFound(_0x7b896e,null))['then'](function(_0x18a1d7){if(!_0x100d17[_0xb543('0x3a')][_0xb543('0x76')]||!utils[_0xb543('0x77')](_0x100d17['query']['channel'])){throw new db[(_0xb543('0x61'))][(_0xb543('0x78'))](_0xb543('0x79'));}var _0x5bc1da={};var _0x1f4416={};_0x1f4416['model']=_[_0xb543('0x4f')](db[_[_0xb543('0x7a')](_0x100d17[_0xb543('0x3a')][_0xb543('0x76')][_0xb543('0x7b')]())+_0xb543('0x7c')][_0xb543('0x35')]);_0x1f4416[_0xb543('0x3a')]=_[_0xb543('0x4f')](_0x100d17[_0xb543('0x3a')]);_0x1f4416[_0xb543('0x3b')]=_[_0xb543('0x3c')](_0x1f4416[_0xb543('0x39')],_0x1f4416['query']);_0x5bc1da['attributes']=_['intersection'](_0x1f4416[_0xb543('0x39')],qs['fields'](_0x100d17['query'][_0xb543('0x3d')]));_0x5bc1da[_0xb543('0x3e')]=_0x5bc1da['attributes'][_0xb543('0x3f')]?_0x5bc1da[_0xb543('0x3e')]:_0x1f4416[_0xb543('0x39')];_0x5bc1da[_0xb543('0x24')]=qs['limit'](_0x100d17['query'][_0xb543('0x24')]);_0x5bc1da[_0xb543('0x25')]=qs[_0xb543('0x25')](_0x100d17[_0xb543('0x3a')][_0xb543('0x25')]);_0x5bc1da[_0xb543('0x42')]=qs[_0xb543('0x43')](_0x100d17[_0xb543('0x3a')][_0xb543('0x43')]);_0x5bc1da['where']=qs[_0xb543('0x3b')](_['pick'](_0x100d17[_0xb543('0x3a')],_0x1f4416['filters']));_0x5bc1da=_[_0xb543('0x47')]({},_0x5bc1da,_0x100d17[_0xb543('0x48')]);return _0x18a1d7[_0xb543('0x54')+_[_0xb543('0x7a')](_0x100d17[_0xb543('0x3a')][_0xb543('0x76')]['toLowerCase']())+_0xb543('0x7d')](_0x5bc1da);})[_0xb543('0x2c')](respondWithResult(_0x7b896e,null))[_0xb543('0x4c')](handleError(_0x7b896e,null));};exports[_0xb543('0x7e')]=function(_0x417665,_0x41b9ab,_0x5b3182){return db[_0xb543('0x34')][_0xb543('0x7f')]({'where':{'id':_0x417665[_0xb543('0x4e')]['id']}})['then'](function(_0x407993){if(_0x407993){if(!_0x417665['body'][_0xb543('0x76')]||!utils[_0xb543('0x77')](_0x417665[_0xb543('0x52')]['channel'])){throw new db[(_0xb543('0x61'))]['ValidationError'](_0xb543('0x79'));}return _0x407993[_0xb543('0x80')+_[_0xb543('0x7a')](_0x417665[_0xb543('0x52')][_0xb543('0x76')][_0xb543('0x7b')]())+_0xb543('0x7d')](_0x417665[_0xb543('0x52')][_0xb543('0x81')]);}return null;})[_0xb543('0x2c')](handleEntityNotFound(_0x41b9ab,null))[_0xb543('0x2c')](respondWithStatusCode(_0x41b9ab,null))[_0xb543('0x4c')](handleError(_0x41b9ab,null));};exports[_0xb543('0x82')]=function(_0x249439,_0x10020e,_0x1e8b60){return db[_0xb543('0x34')][_0xb543('0x7f')]({'where':{'id':_0x249439[_0xb543('0x4e')]['id']}})['then'](function(_0x4f149f){if(_0x4f149f){if(!_0x249439[_0xb543('0x3a')][_0xb543('0x76')]||!utils['isValidChannel'](_0x249439['query'][_0xb543('0x76')])){throw new db[(_0xb543('0x61'))][(_0xb543('0x78'))](_0xb543('0x79'));}return _0x4f149f[_0xb543('0x83')+_['capitalize'](_0x249439[_0xb543('0x3a')][_0xb543('0x76')][_0xb543('0x7b')]())+'Queues'](_0x249439['query'][_0xb543('0x81')]);}return null;})[_0xb543('0x2c')](handleEntityNotFound(_0x10020e,null))[_0xb543('0x2c')](respondWithStatusCode(_0x10020e,null))[_0xb543('0x4c')](handleError(_0x10020e,null));};exports[_0xb543('0x84')]=function(_0xe9ce60,_0x3b2073){var _0x2d88a3=_[_0xb543('0x85')](_0xe9ce60[_0xb543('0x52')][_0xb543('0x81')])?_0xe9ce60[_0xb543('0x52')][_0xb543('0x81')]:[_0xe9ce60[_0xb543('0x52')][_0xb543('0x81')]];var _0x15abd1=_0xe9ce60[_0xb543('0x4e')]['id'];return db[_0xb543('0x34')][_0xb543('0x59')]({'where':{'id':_0x15abd1}})['then'](handleEntityNotFound(_0x3b2073,null))[_0xb543('0x2c')](function(_0x37baa5){if(_0x37baa5){var _0x5073ff=['Voice',_0xb543('0x86'),'Mail','Sms',_0xb543('0x87'),_0xb543('0x88'),_0xb543('0x89')];return db[_0xb543('0x5f')][_0xb543('0x8a')](function(_0x3a23b8){var _0x5e3f0b=_['map'](_0x5073ff,function(_0x41f6f5){var _0x5bf9be={'attributes':['id',_0xb543('0x30')]};if(_0x41f6f5==='Voice'){_0x5bf9be['through']={'attributes':['penalty']};}return _0x37baa5[_0xb543('0x54')+_0x41f6f5+'Queues'](_0x5bf9be)[_0xb543('0x2c')](function(_0x3909a2){var _0x22c9e6=_['map'](_0x3909a2,function(_0x63a21){var _0x3040b6=_[_0xb543('0x33')](_0x2d88a3,function(_0x16aac1){var _0x2d3242={'where':{'UserId':_0x16aac1,[_0x41f6f5+_0xb543('0x8b')]:_0x63a21['id']},'transaction':_0x3a23b8};if(_0x41f6f5===_0xb543('0x8c')){_0x2d3242[_0xb543('0x1c')]={'penalty':_0x63a21[_0xb543('0x8d')][_0xb543('0x8e')]};}return db['User'+_0x41f6f5+'Queue'][_0xb543('0x8f')](_0x2d3242)[_0xb543('0x2c')](function(){socket['emit'](_0xb543('0x53')+_0x41f6f5+_0xb543('0x90'),{'UserId':_0x16aac1,[_0x41f6f5+_0xb543('0x8b')]:_0x63a21['id']});if(_0x41f6f5!==_0xb543('0x8c')){return;}return db[_0xb543('0x91')][_0xb543('0x4a')]({'where':{'id':_0x2d88a3,'online':0x1},'attributes':['id',_0xb543('0x30'),'online',_0xb543('0x92'),_0xb543('0x93')],'raw':!![]})[_0xb543('0x2c')](function(_0x4e111f){var _0x2ae983=_[_0xb543('0x33')](_0x4e111f,function(_0x212877){return db['UserVoiceQueueRt'][_0xb543('0x94')]({'membername':_0x212877[_0xb543('0x30')],'UserId':_0x212877['id'],'queue_name':_0x63a21[_0xb543('0x30')],'VoiceQueueId':_0x63a21['id'],'interface':_[_0xb543('0x95')](_0x212877[_0xb543('0x93')])?util[_0xb543('0x96')](_0xb543('0x97'),_0x212877[_0xb543('0x30')]):_0x212877[_0xb543('0x93')],'paused':_0x212877[_0xb543('0x92')]||![],'penalty':_0x63a21[_0xb543('0x8d')][_0xb543('0x8e')]},{'transaction':_0x3a23b8});});return Promise[_0xb543('0x98')](_0x2ae983);});});});return Promise[_0xb543('0x98')](_0x3040b6);});return Promise[_0xb543('0x98')](_0x22c9e6);})[_0xb543('0x2c')](function(){return db[_0xb543('0x72')][_0xb543('0x7f')]({'where':{'teamId':_0x15abd1}})[_0xb543('0x2c')](function(_0x1c071a){if(_0x1c071a){var _0x13f39c=_[_0xb543('0x33')](_0x2d88a3,function(_0x14a9e2){db[_0xb543('0x73')][_0xb543('0x94')]({'UserId':_0x14a9e2,'VoicePrefixId':_0x1c071a[_0xb543('0x74')]});});return Promise[_0xb543('0x98')](_0x13f39c);}});});});return Promise['all'](_0x5e3f0b)[_0xb543('0x2c')](function(){return _0x37baa5['addAgents'](_0x2d88a3,{'transaction':_0x3a23b8})[_0xb543('0x99')](function(_0x4573fd){return _0x4573fd;});});});}})[_0xb543('0x2c')](respondWithResult(_0x3b2073,null))[_0xb543('0x4c')](handleError(_0x3b2073,null));};exports[_0xb543('0x9a')]=function(_0xb94146,_0x4377b7){var _0xd5d4a7=_[_0xb543('0x85')](_0xb94146[_0xb543('0x3a')]['ids'])?_0xb94146[_0xb543('0x3a')]['ids']:[_0xb94146[_0xb543('0x3a')][_0xb543('0x81')]];var _0x4e913b=_0xb94146[_0xb543('0x4e')]['id'];return db[_0xb543('0x34')][_0xb543('0x59')]({'where':{'id':_0x4e913b}})[_0xb543('0x2c')](handleEntityNotFound(_0x4377b7,null))[_0xb543('0x2c')](function(_0x241e8d){if(_0x241e8d){var _0x44a353=[_0xb543('0x8c'),_0xb543('0x86'),_0xb543('0x9b'),'Sms',_0xb543('0x87'),_0xb543('0x88'),'Whatsapp'];return db[_0xb543('0x5f')][_0xb543('0x8a')](function(_0x430ff2){var _0x5e3f21=_[_0xb543('0x33')](_0x44a353,function(_0x424f2b){var _0x126e1c={'attributes':['id','name']};return _0x241e8d[_0xb543('0x54')+_0x424f2b+_0xb543('0x7d')](_0x126e1c)[_0xb543('0x2c')](function(_0x3eb8d6){var _0x4510fe=_[_0xb543('0x33')](_0x3eb8d6,function(_0x15ae2f){return _0x15ae2f[_0xb543('0x9a')](_0xd5d4a7,{'transaction':_0x430ff2})[_0xb543('0x2c')](function(){var _0x56e6fd=_[_0xb543('0x33')](_0xd5d4a7,function(_0x46a69f){socket[_0xb543('0x9c')](_0xb543('0x53')+_0x424f2b+_0xb543('0x9d'),{'UserId':Number(_0x46a69f),[_0x424f2b+'QueueId']:_0x15ae2f['id']});if(_0x424f2b!=='Voice'){return;}return db[_0xb543('0x9e')]['destroy']({'where':{'VoiceQueueId':_0x15ae2f['id'],'UserId':_0x46a69f},'transaction':_0x430ff2});});return Promise[_0xb543('0x98')](_0x56e6fd);});});return Promise[_0xb543('0x98')](_0x4510fe);});});return Promise[_0xb543('0x98')](_0x5e3f21)[_0xb543('0x2c')](function(){return _0x241e8d[_0xb543('0x9a')](_0xd5d4a7,{'transaction':_0x430ff2});})['then'](function(){return db[_0xb543('0x72')][_0xb543('0x7f')]({'where':{'teamId':_0x4e913b}})[_0xb543('0x2c')](function(_0x2d8a4e){if(_0x2d8a4e){var _0x120efc=_[_0xb543('0x33')](_0xd5d4a7,function(_0xd6365e){db['UserVoicePrefix'][_0xb543('0x5e')]({'where':{'UserId':_0xd6365e,'VoicePrefixId':_0x2d8a4e[_0xb543('0x74')]}});});return Promise[_0xb543('0x98')](_0x120efc);}});});});}})[_0xb543('0x2c')](respondWithStatusCode(_0x4377b7,null))[_0xb543('0x4c')](handleError(_0x4377b7,null));};exports['getAgents']=function(_0x3c2864,_0x599826,_0x16d98b){var _0x4f7c0a={};var _0x21d45d={};var _0x11deaf;var _0x528e1a;return db[_0xb543('0x34')]['findOne']({'where':{'id':_0x3c2864[_0xb543('0x4e')]['id']}})[_0xb543('0x2c')](handleEntityNotFound(_0x599826,null))[_0xb543('0x2c')](function(_0x3b6355){if(_0x3b6355){_0x11deaf=_0x3b6355;_0x21d45d['model']=_[_0xb543('0x4f')](db[_0xb543('0x91')][_0xb543('0x35')]);_0x21d45d['query']=_[_0xb543('0x4f')](_0x3c2864[_0xb543('0x3a')]);_0x21d45d['filters']=_[_0xb543('0x3c')](_0x21d45d[_0xb543('0x39')],_0x21d45d[_0xb543('0x3a')]);_0x4f7c0a[_0xb543('0x3e')]=_[_0xb543('0x3c')](_0x21d45d[_0xb543('0x39')],qs[_0xb543('0x3d')](_0x3c2864[_0xb543('0x3a')][_0xb543('0x3d')]));_0x4f7c0a[_0xb543('0x3e')]=_0x4f7c0a[_0xb543('0x3e')]['length']?_0x4f7c0a['attributes']:_0x21d45d[_0xb543('0x39')];_0x4f7c0a[_0xb543('0x42')]=qs[_0xb543('0x43')](_0x3c2864[_0xb543('0x3a')][_0xb543('0x43')]);_0x4f7c0a[_0xb543('0x44')]=qs[_0xb543('0x3b')](_[_0xb543('0x9f')](_0x3c2864[_0xb543('0x3a')],_0x21d45d[_0xb543('0x3b')]));if(_0x3c2864[_0xb543('0x3a')][_0xb543('0x45')]){_0x4f7c0a[_0xb543('0x44')]=_['merge'](_0x4f7c0a[_0xb543('0x44')],{'$or':_[_0xb543('0x33')](_0x4f7c0a[_0xb543('0x3e')],function(_0x361947){var _0x5e478b={};_0x5e478b[_0x361947]={'$like':'%'+_0x3c2864[_0xb543('0x3a')][_0xb543('0x45')]+'%'};return _0x5e478b;})});}_0x4f7c0a=_['merge']({},_0x4f7c0a,_0x3c2864[_0xb543('0x48')]);return _0x11deaf[_0xb543('0xa0')](_0x4f7c0a);}})['then'](function(_0xdabc35){if(_0xdabc35){_0x528e1a=_0xdabc35['length'];if(!_0x3c2864[_0xb543('0x3a')][_0xb543('0x40')]('nolimit')){_0x4f7c0a['limit']=qs[_0xb543('0x24')](_0x3c2864[_0xb543('0x3a')][_0xb543('0x24')]);_0x4f7c0a[_0xb543('0x25')]=qs[_0xb543('0x25')](_0x3c2864['query'][_0xb543('0x25')]);}return _0x11deaf['getAgents'](_0x4f7c0a);}})[_0xb543('0x2c')](function(_0x422190){if(_0x422190){return _0x422190?{'count':_0x528e1a,'rows':_0x422190}:null;}})[_0xb543('0x2c')](respondWithResult(_0x599826,null))[_0xb543('0x4c')](handleError(_0x599826,null));}; \ No newline at end of file +var _0x97ec=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','body','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','SELECT','UserId','Sequelize','QueryTypes','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','end','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','add','removeQueues','remove','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','get','User','Queue','findOrCreate','emit','QueueId','online','voicePause','isNil','interface','TeamVoiceQueue','all','upsert','VoicePrefixId','spread','removeAgents','isArray','Queue:remove','UserVoiceQueueRt','TeamVoicePrefix','getAgents','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x22f262,_0x14c731){var _0x4c38db=function(_0x472ada){while(--_0x472ada){_0x22f262['push'](_0x22f262['shift']());}};_0x4c38db(++_0x14c731);}(_0x97ec,0xf8));var _0xc97e=function(_0x16c4d9,_0x16508c){_0x16c4d9=_0x16c4d9-0x0;var _0x5de3be=_0x97ec[_0x16c4d9];return _0x5de3be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc97e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc97e('0x1'));var rp=require(_0xc97e('0x2'));var moment=require(_0xc97e('0x3'));var BPromise=require(_0xc97e('0x4'));var Mustache=require(_0xc97e('0x5'));var util=require(_0xc97e('0x6'));var path=require(_0xc97e('0x7'));var sox=require(_0xc97e('0x8'));var csv=require('to-csv');var ejs=require(_0xc97e('0x9'));var fs=require('fs');var fs_extra=require(_0xc97e('0xa'));var _=require(_0xc97e('0xb'));var squel=require(_0xc97e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc97e('0xd'));var toCsv=require(_0xc97e('0xe'));var querystring=require(_0xc97e('0xf'));var Papa=require(_0xc97e('0x10'));var Redis=require('ioredis');var authService=require(_0xc97e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc97e('0x12'));var hardwareService=require(_0xc97e('0x13'));var logger=require(_0xc97e('0x14'))('api');var utils=require(_0xc97e('0x15'));var config=require(_0xc97e('0x16'));var licenseUtil=require(_0xc97e('0x17'));var db=require(_0xc97e('0x18'))['db'];config[_0xc97e('0x19')]=_[_0xc97e('0x1a')](config[_0xc97e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xc97e('0x1b'))(new Redis(config['redis']));require(_0xc97e('0x1c'))[_0xc97e('0x1d')](socket);function respondWithStatusCode(_0x2c27b6,_0x527472){_0x527472=_0x527472||0xcc;return function(_0x47a554){if(_0x47a554){return _0x2c27b6['sendStatus'](_0x527472);}return _0x2c27b6[_0xc97e('0x1e')](_0x527472)['end']();};}function respondWithResult(_0x2cd043,_0x1c0eed){_0x1c0eed=_0x1c0eed||0xc8;return function(_0x3f1547){if(_0x3f1547){return _0x2cd043[_0xc97e('0x1e')](_0x1c0eed)[_0xc97e('0x1f')](_0x3f1547);}};}function respondWithFilteredResult(_0x50fa4e,_0x16c269){return function(_0x14fe0c){if(_0x14fe0c){var _0x49a9cb=typeof _0x16c269['offset']===_0xc97e('0x20')&&typeof _0x16c269[_0xc97e('0x21')]===_0xc97e('0x20');var _0x3389b1=_0x14fe0c[_0xc97e('0x22')];var _0x1d6f7a=_0x49a9cb?0x0:_0x16c269['offset'];var _0x1b133d=_0x49a9cb?_0x14fe0c[_0xc97e('0x22')]:_0x16c269[_0xc97e('0x23')]+_0x16c269[_0xc97e('0x21')];var _0x255809;if(_0x1b133d>=_0x3389b1){_0x1b133d=_0x3389b1;_0x255809=0xc8;}else{_0x255809=0xce;}_0x50fa4e[_0xc97e('0x1e')](_0x255809);return _0x50fa4e[_0xc97e('0x24')](_0xc97e('0x25'),_0x1d6f7a+'-'+_0x1b133d+'/'+_0x3389b1)[_0xc97e('0x1f')](_0x14fe0c);}return null;};}function patchUpdates(_0x2c71ea){return function(_0x532b2f){try{jsonpatch[_0xc97e('0x26')](_0x532b2f,_0x2c71ea,!![]);}catch(_0x2182b6){return BPromise['reject'](_0x2182b6);}return _0x532b2f[_0xc97e('0x27')]();};}function saveUpdates(_0x158eb1,_0x1c4eed){return function(_0x265608){if(_0x265608){return _0x265608['update'](_0x158eb1)[_0xc97e('0x28')](function(_0x3617b9){return _0x3617b9;});}return null;};}function handleEntityNotFound(_0x164dfe,_0x3704d9){return function(_0x3d060f){if(!_0x3d060f){_0x164dfe[_0xc97e('0x29')](0x194);}return _0x3d060f;};}function handleError(_0xfb8380,_0x56c76c){_0x56c76c=_0x56c76c||0x1f4;return function(_0x3ee877){logger[_0xc97e('0x2a')](_0x3ee877[_0xc97e('0x2b')]);if(_0x3ee877[_0xc97e('0x2c')]){delete _0x3ee877[_0xc97e('0x2c')];}_0xfb8380[_0xc97e('0x1e')](_0x56c76c)[_0xc97e('0x2d')](_0x3ee877);};}exports[_0xc97e('0x2e')]=function(_0x4a3190,_0x47b4a0){var _0x157e81={},_0x500a07={},_0x2bb05a={'count':0x0,'rows':[]};var _0x45a9ca=_[_0xc97e('0x2f')](db[_0xc97e('0x30')][_0xc97e('0x31')],function(_0x1b8c03){return{'name':_0x1b8c03['fieldName'],'type':_0x1b8c03[_0xc97e('0x32')][_0xc97e('0x33')]};});_0x500a07['model']=_[_0xc97e('0x2f')](_0x45a9ca,_0xc97e('0x2c'));_0x500a07[_0xc97e('0x34')]=_[_0xc97e('0x35')](_0x4a3190['query']);_0x500a07[_0xc97e('0x36')]=_[_0xc97e('0x37')](_0x500a07[_0xc97e('0x38')],_0x500a07['query']);_0x157e81[_0xc97e('0x39')]=_[_0xc97e('0x37')](_0x500a07[_0xc97e('0x38')],qs['fields'](_0x4a3190['query'][_0xc97e('0x3a')]));_0x157e81[_0xc97e('0x39')]=_0x157e81[_0xc97e('0x39')][_0xc97e('0x3b')]?_0x157e81[_0xc97e('0x39')]:_0x500a07[_0xc97e('0x38')];if(!_0x4a3190[_0xc97e('0x34')][_0xc97e('0x3c')]('nolimit')){_0x157e81[_0xc97e('0x21')]=qs[_0xc97e('0x21')](_0x4a3190[_0xc97e('0x34')][_0xc97e('0x21')]);_0x157e81[_0xc97e('0x23')]=qs[_0xc97e('0x23')](_0x4a3190[_0xc97e('0x34')]['offset']);}_0x157e81[_0xc97e('0x3d')]=qs['sort'](_0x4a3190['query'][_0xc97e('0x3e')]);_0x157e81[_0xc97e('0x3f')]=qs[_0xc97e('0x36')](_[_0xc97e('0x40')](_0x4a3190[_0xc97e('0x34')],_0x500a07[_0xc97e('0x36')]),_0x45a9ca);if(_0x4a3190['query'][_0xc97e('0x41')]){_0x157e81[_0xc97e('0x3f')]=_[_0xc97e('0x42')](_0x157e81['where'],{'$or':_[_0xc97e('0x2f')](_0x45a9ca,function(_0x3834a6){if(_0x3834a6[_0xc97e('0x32')]!==_0xc97e('0x43')){var _0x14eb1c={};_0x14eb1c[_0x3834a6[_0xc97e('0x2c')]]={'$like':'%'+_0x4a3190['query'][_0xc97e('0x41')]+'%'};return _0x14eb1c;}})});}_0x157e81=_[_0xc97e('0x42')]({},_0x157e81,_0x4a3190[_0xc97e('0x44')]);var _0x59710e={'where':_0x157e81['where']};return db[_0xc97e('0x30')]['count'](_0x59710e)[_0xc97e('0x28')](function(_0x208df2){_0x2bb05a[_0xc97e('0x22')]=_0x208df2;if(_0x4a3190['query'][_0xc97e('0x45')]){_0x157e81['include']=[{'all':!![]}];}return db[_0xc97e('0x30')][_0xc97e('0x46')](_0x157e81);})[_0xc97e('0x28')](function(_0x5c24d0){_0x2bb05a[_0xc97e('0x47')]=_0x5c24d0;return _0x2bb05a;})[_0xc97e('0x28')](respondWithFilteredResult(_0x47b4a0,_0x157e81))[_0xc97e('0x48')](handleError(_0x47b4a0,null));};exports[_0xc97e('0x49')]=function(_0x1f38c0,_0x46895d){var _0x189ec9={'raw':![],'where':{'id':_0x1f38c0[_0xc97e('0x4a')]['id']}},_0x2357ef={};_0x2357ef['model']=_[_0xc97e('0x35')](db[_0xc97e('0x30')][_0xc97e('0x31')]);_0x2357ef[_0xc97e('0x34')]=_[_0xc97e('0x35')](_0x1f38c0[_0xc97e('0x34')]);_0x2357ef[_0xc97e('0x36')]=_[_0xc97e('0x37')](_0x2357ef[_0xc97e('0x38')],_0x2357ef['query']);_0x189ec9[_0xc97e('0x39')]=_[_0xc97e('0x37')](_0x2357ef[_0xc97e('0x38')],qs[_0xc97e('0x3a')](_0x1f38c0['query'][_0xc97e('0x3a')]));_0x189ec9['attributes']=_0x189ec9[_0xc97e('0x39')]['length']?_0x189ec9[_0xc97e('0x39')]:_0x2357ef[_0xc97e('0x38')];if(_0x1f38c0['query'][_0xc97e('0x45')]){_0x189ec9['include']=[{'all':!![]}];}_0x189ec9=_[_0xc97e('0x42')]({},_0x189ec9,_0x1f38c0[_0xc97e('0x44')]);return db[_0xc97e('0x30')][_0xc97e('0x4b')](_0x189ec9)[_0xc97e('0x28')](handleEntityNotFound(_0x46895d,null))[_0xc97e('0x28')](respondWithResult(_0x46895d,null))['catch'](handleError(_0x46895d,null));};exports[_0xc97e('0x4c')]=function(_0x4f7395,_0x16b126){return db[_0xc97e('0x30')][_0xc97e('0x4c')](_0x4f7395['body'],{})[_0xc97e('0x28')](function(_0x419445){var _0x51e4b7=_0x4f7395[_0xc97e('0x4d')]['get']({'plain':!![]});if(!_0x51e4b7)throw new Error(_0xc97e('0x4e'));if(_0x51e4b7['role']===_0xc97e('0x4d')){var _0x1f61fe=_0x419445['get']({'plain':!![]});var _0x332492='Teams';return db['UserProfileSection'][_0xc97e('0x4b')]({'where':{'name':_0x332492,'userProfileId':_0x51e4b7[_0xc97e('0x4f')]},'raw':!![]})['then'](function(_0x4b633e){if(_0x4b633e&&_0x4b633e[_0xc97e('0x50')]===0x0){return db[_0xc97e('0x51')][_0xc97e('0x4c')]({'name':_0x1f61fe['name'],'resourceId':_0x1f61fe['id'],'type':_0x4b633e[_0xc97e('0x2c')],'sectionId':_0x4b633e['id']},{})[_0xc97e('0x28')](function(){return _0x419445;});}else{return _0x419445;}})['catch'](function(_0x220130){logger[_0xc97e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x220130);throw _0x220130;});}return _0x419445;})['then'](respondWithResult(_0x16b126,0xc9))['catch'](handleError(_0x16b126,null));};exports['update']=function(_0x488b6c,_0x4aa1c5){if(_0x488b6c['body']['id']){delete _0x488b6c[_0xc97e('0x52')]['id'];}return db[_0xc97e('0x30')]['find']({'where':{'id':_0x488b6c[_0xc97e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aa1c5,null))[_0xc97e('0x28')](saveUpdates(_0x488b6c[_0xc97e('0x52')],null))[_0xc97e('0x28')](respondWithResult(_0x4aa1c5,null))[_0xc97e('0x48')](handleError(_0x4aa1c5,null));};exports[_0xc97e('0x53')]=function(_0x35b9b8,_0x2bc19f){var _0x1f30f1=_0x35b9b8[_0xc97e('0x4a')]['id'];var _0x90d1cc=[];return db['sequelize'][_0xc97e('0x54')](function(_0x2d3cfe){var _0x4a0137=_0xc97e('0x55')+_0x1f30f1;return db[_0xc97e('0x56')][_0xc97e('0x34')](_0x4a0137,{'type':db['Sequelize']['QueryTypes'][_0xc97e('0x57')],'raw':!![],'transaction':_0x2d3cfe})[_0xc97e('0x28')](function(_0x3bea59){_0x90d1cc=_[_0xc97e('0x2f')](_0x3bea59,function(_0x4fe975){return Number(_0x4fe975[_0xc97e('0x58')]);});})['then'](function(){var _0x433c8c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1f30f1;return db[_0xc97e('0x56')][_0xc97e('0x34')](_0x433c8c,{'type':db[_0xc97e('0x59')][_0xc97e('0x5a')][_0xc97e('0x57')],'raw':!![],'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(_0x31da04){var _0x1f3559=_[_0xc97e('0x2f')](_0x31da04,function(_0x2fa45a){return Number(_0x2fa45a['VoiceQueueId']);});return db[_0xc97e('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x90d1cc},'VoiceQueueId':{'$in':_0x1f3559}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){var _0x212716=_0xc97e('0x5c')+_0x1f30f1;return db[_0xc97e('0x56')][_0xc97e('0x34')](_0x212716,{'type':db[_0xc97e('0x59')]['QueryTypes'][_0xc97e('0x57')],'raw':!![],'transaction':_0x2d3cfe});})['then'](function(_0x1d0e8b){var _0x1dda9e=_['map'](_0x1d0e8b,function(_0x3b8b16){return Number(_0x3b8b16[_0xc97e('0x5d')]);});return db['UserMailQueue'][_0xc97e('0x53')]({'where':{'UserId':{'$in':_0x90d1cc},'MailQueueId':{'$in':_0x1dda9e}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){var _0x3397c1=_0xc97e('0x5e')+_0x1f30f1;return db[_0xc97e('0x56')][_0xc97e('0x34')](_0x3397c1,{'type':db['Sequelize'][_0xc97e('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(_0x2f190b){var _0x36edfa=_[_0xc97e('0x2f')](_0x2f190b,function(_0x327775){return Number(_0x327775[_0xc97e('0x5f')]);});return db[_0xc97e('0x60')][_0xc97e('0x53')]({'where':{'UserId':{'$in':_0x90d1cc},'SmsQueueId':{'$in':_0x36edfa}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){var _0x576331=_0xc97e('0x61')+_0x1f30f1;return db[_0xc97e('0x56')]['query'](_0x576331,{'type':db[_0xc97e('0x59')][_0xc97e('0x5a')][_0xc97e('0x57')],'raw':!![],'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(_0x3186ac){var _0x1967a7=_['map'](_0x3186ac,function(_0x4b423c){return Number(_0x4b423c['ChatQueueId']);});return db[_0xc97e('0x62')][_0xc97e('0x53')]({'where':{'UserId':{'$in':_0x90d1cc},'ChatQueueId':{'$in':_0x1967a7}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){var _0x46eac9=_0xc97e('0x63')+_0x1f30f1;return db[_0xc97e('0x56')][_0xc97e('0x34')](_0x46eac9,{'type':db[_0xc97e('0x59')][_0xc97e('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(_0x5a624c){var _0xbc2e50=_[_0xc97e('0x2f')](_0x5a624c,function(_0x4aea3f){return Number(_0x4aea3f[_0xc97e('0x64')]);});return db[_0xc97e('0x65')]['destroy']({'where':{'UserId':{'$in':_0x90d1cc},'FaxQueueId':{'$in':_0xbc2e50}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){var _0x1ed50c=_0xc97e('0x66')+_0x1f30f1;return db['sequelize'][_0xc97e('0x34')](_0x1ed50c,{'type':db[_0xc97e('0x59')]['QueryTypes'][_0xc97e('0x57')],'raw':!![],'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(_0x53d973){var _0x2408e6=_['map'](_0x53d973,function(_0x3b4f95){return Number(_0x3b4f95[_0xc97e('0x67')]);});return db['UserOpenchannelQueue'][_0xc97e('0x53')]({'where':{'UserId':{'$in':_0x90d1cc},'OpenchannelQueueId':{'$in':_0x2408e6}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){var _0xa62854=_0xc97e('0x68')+_0x1f30f1;return db[_0xc97e('0x56')][_0xc97e('0x34')](_0xa62854,{'type':db[_0xc97e('0x59')]['QueryTypes'][_0xc97e('0x57')],'raw':!![],'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(_0x2a87b0){var _0x1f504=_[_0xc97e('0x2f')](_0x2a87b0,function(_0x14a7c4){return Number(_0x14a7c4[_0xc97e('0x69')]);});return db[_0xc97e('0x6a')][_0xc97e('0x53')]({'where':{'UserId':{'$in':_0x90d1cc},'WhatsappQueueId':{'$in':_0x1f504}},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){return db['TeamVoicePrefix'][_0xc97e('0x4b')]({'where':{'TeamId':_0x1f30f1}});})['then'](function(_0x46feaf){if(_0x46feaf===null){return;}return db[_0xc97e('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x90d1cc},'VoicePrefixId':_0x46feaf['VoicePrefixId']},'transaction':_0x2d3cfe});})[_0xc97e('0x28')](function(){return db[_0xc97e('0x30')]['destroy']({'where':{'id':_0x1f30f1},'cascade':!![],'transaction':_0x2d3cfe});})['then'](function(_0x5b6052){if(_0x5b6052===0x0){_0x2bc19f[_0xc97e('0x29')](0x194);}else{return db[_0xc97e('0x51')][_0xc97e('0x53')]({'where':{'type':'Teams','resourceId':_0x1f30f1},'cascade':!![],'transaction':_0x2d3cfe})[_0xc97e('0x28')](function(){_0x2bc19f['status'](0xcc)[_0xc97e('0x6c')]();});}})[_0xc97e('0x48')](function(_0x8a6b84){_0x2bc19f[_0xc97e('0x1e')](0x1f4)[_0xc97e('0x2d')](_0x8a6b84);});});};exports[_0xc97e('0x6d')]=function(_0x1757b4,_0x4c4466,_0xee4e55){return db[_0xc97e('0x30')][_0xc97e('0x6e')]({'where':{'id':_0x1757b4[_0xc97e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c4466,null))[_0xc97e('0x28')](function(_0x42682e){if(!_0x1757b4['query']['channel']||!utils[_0xc97e('0x6f')](_0x1757b4[_0xc97e('0x34')][_0xc97e('0x70')])){throw new db['Sequelize'][(_0xc97e('0x71'))](_0xc97e('0x72'));}var _0x40cc61={};var _0x2429a4={};_0x2429a4[_0xc97e('0x38')]=_[_0xc97e('0x35')](db[_[_0xc97e('0x73')](_0x1757b4[_0xc97e('0x34')][_0xc97e('0x70')]['toLowerCase']())+'Queue'][_0xc97e('0x31')]);_0x2429a4['query']=_[_0xc97e('0x35')](_0x1757b4[_0xc97e('0x34')]);_0x2429a4['filters']=_[_0xc97e('0x37')](_0x2429a4['model'],_0x2429a4[_0xc97e('0x34')]);_0x40cc61[_0xc97e('0x39')]=_[_0xc97e('0x37')](_0x2429a4[_0xc97e('0x38')],qs[_0xc97e('0x3a')](_0x1757b4[_0xc97e('0x34')][_0xc97e('0x3a')]));_0x40cc61['attributes']=_0x40cc61[_0xc97e('0x39')]['length']?_0x40cc61['attributes']:_0x2429a4['model'];_0x40cc61[_0xc97e('0x21')]=qs[_0xc97e('0x21')](_0x1757b4[_0xc97e('0x34')][_0xc97e('0x21')]);_0x40cc61[_0xc97e('0x23')]=qs[_0xc97e('0x23')](_0x1757b4[_0xc97e('0x34')][_0xc97e('0x23')]);_0x40cc61[_0xc97e('0x3d')]=qs['sort'](_0x1757b4[_0xc97e('0x34')][_0xc97e('0x3e')]);_0x40cc61[_0xc97e('0x3f')]=qs['filters'](_[_0xc97e('0x40')](_0x1757b4[_0xc97e('0x34')],_0x2429a4[_0xc97e('0x36')]));_0x40cc61=_[_0xc97e('0x42')]({},_0x40cc61,_0x1757b4[_0xc97e('0x44')]);return _0x42682e['get'+_[_0xc97e('0x73')](_0x1757b4['query']['channel'][_0xc97e('0x74')]())+_0xc97e('0x75')](_0x40cc61);})[_0xc97e('0x28')](respondWithResult(_0x4c4466,null))['catch'](handleError(_0x4c4466,null));};exports[_0xc97e('0x76')]=function(_0x7820,_0x33a6c2,_0xfeef22){return db[_0xc97e('0x30')][_0xc97e('0x6e')]({'where':{'id':_0x7820['params']['id']}})[_0xc97e('0x28')](function(_0x1dcc93){if(_0x1dcc93){if(!_0x7820[_0xc97e('0x52')][_0xc97e('0x70')]||!utils['isValidChannel'](_0x7820[_0xc97e('0x52')][_0xc97e('0x70')])){throw new db[(_0xc97e('0x59'))][(_0xc97e('0x71'))](_0xc97e('0x72'));}return _0x1dcc93[_0xc97e('0x77')+_[_0xc97e('0x73')](_0x7820['body'][_0xc97e('0x70')][_0xc97e('0x74')]())+_0xc97e('0x75')](_0x7820[_0xc97e('0x52')]['ids']);}return null;})[_0xc97e('0x28')](handleEntityNotFound(_0x33a6c2,null))[_0xc97e('0x28')](respondWithStatusCode(_0x33a6c2,null))[_0xc97e('0x48')](handleError(_0x33a6c2,null));};exports[_0xc97e('0x78')]=function(_0x3f7657,_0x7aeb17,_0x50a8f4){return db[_0xc97e('0x30')][_0xc97e('0x6e')]({'where':{'id':_0x3f7657['params']['id']}})['then'](function(_0x4639a5){if(_0x4639a5){if(!_0x3f7657[_0xc97e('0x34')][_0xc97e('0x70')]||!utils[_0xc97e('0x6f')](_0x3f7657[_0xc97e('0x34')][_0xc97e('0x70')])){throw new db[(_0xc97e('0x59'))][(_0xc97e('0x71'))](_0xc97e('0x72'));}return _0x4639a5[_0xc97e('0x79')+_['capitalize'](_0x3f7657[_0xc97e('0x34')][_0xc97e('0x70')]['toLowerCase']())+_0xc97e('0x75')](_0x3f7657[_0xc97e('0x34')][_0xc97e('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x7aeb17,null))[_0xc97e('0x28')](respondWithStatusCode(_0x7aeb17,null))[_0xc97e('0x48')](handleError(_0x7aeb17,null));};exports[_0xc97e('0x7b')]=function(_0x476021,_0x2af644){var _0x35102e=_['isArray'](_0x476021[_0xc97e('0x52')][_0xc97e('0x7a')])?_0x476021['body'][_0xc97e('0x7a')]:[_0x476021[_0xc97e('0x52')][_0xc97e('0x7a')]];var _0x5125c3=_0x476021['params']['id'];return db[_0xc97e('0x30')][_0xc97e('0x4b')]({'where':{'id':_0x5125c3}})['then'](handleEntityNotFound(_0x2af644,null))[_0xc97e('0x28')](function(_0x3f6837){if(_0x3f6837){var _0x35c21c=[_0xc97e('0x7c'),_0xc97e('0x7d'),_0xc97e('0x7e'),_0xc97e('0x7f'),_0xc97e('0x80'),_0xc97e('0x81'),_0xc97e('0x82')];return db[_0xc97e('0x56')][_0xc97e('0x54')](function(_0x1a2150){var _0x43b688=_[_0xc97e('0x2f')](_0x35c21c,function(_0x1b5d00){var _0x408a15={'attributes':['id','name']};if(_0x1b5d00===_0xc97e('0x7c')){_0x408a15['through']={'attributes':[_0xc97e('0x83')]};}return _0x3f6837[_0xc97e('0x84')+_0x1b5d00+'Queues'](_0x408a15)[_0xc97e('0x28')](function(_0x3a0ab2){var _0x51bec7=_[_0xc97e('0x2f')](_0x3a0ab2,function(_0xf1e382){var _0xcb27e3=_[_0xc97e('0x2f')](_0x35102e,function(_0x22f04e){var _0xa72d06={'where':{'UserId':_0x22f04e,[_0x1b5d00+'QueueId']:_0xf1e382['id']},'transaction':_0x1a2150};if(_0x1b5d00===_0xc97e('0x7c')){_0xa72d06['defaults']={'penalty':_0xf1e382['TeamVoiceQueue'][_0xc97e('0x83')]};}return db[_0xc97e('0x85')+_0x1b5d00+_0xc97e('0x86')][_0xc97e('0x87')](_0xa72d06)['then'](function(){socket[_0xc97e('0x88')](_0xc97e('0x4d')+_0x1b5d00+'Queue:save',{'UserId':_0x22f04e,[_0x1b5d00+_0xc97e('0x89')]:_0xf1e382['id']});if(_0x1b5d00!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x35102e,'online':0x1},'attributes':['id','name',_0xc97e('0x8a'),_0xc97e('0x8b'),'interface'],'raw':!![]})[_0xc97e('0x28')](function(_0x1f25c7){var _0x363387=_[_0xc97e('0x2f')](_0x1f25c7,function(_0x2d3b12){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2d3b12[_0xc97e('0x2c')],'UserId':_0x2d3b12['id'],'queue_name':_0xf1e382['name'],'VoiceQueueId':_0xf1e382['id'],'interface':_[_0xc97e('0x8c')](_0x2d3b12[_0xc97e('0x8d')])?util['format']('SIP/%s',_0x2d3b12['name']):_0x2d3b12[_0xc97e('0x8d')],'paused':_0x2d3b12[_0xc97e('0x8b')]||![],'penalty':_0xf1e382[_0xc97e('0x8e')][_0xc97e('0x83')]},{'transaction':_0x1a2150});});return Promise['all'](_0x363387);});});});return Promise[_0xc97e('0x8f')](_0xcb27e3);});return Promise['all'](_0x51bec7);})[_0xc97e('0x28')](function(){return db['TeamVoicePrefix'][_0xc97e('0x6e')]({'where':{'teamId':_0x5125c3}})[_0xc97e('0x28')](function(_0x4fb060){if(_0x4fb060){var _0x1d5300=_[_0xc97e('0x2f')](_0x35102e,function(_0x52f99e){db['UserVoicePrefix'][_0xc97e('0x90')]({'UserId':_0x52f99e,'VoicePrefixId':_0x4fb060[_0xc97e('0x91')]});});return Promise[_0xc97e('0x8f')](_0x1d5300);}});});});return Promise['all'](_0x43b688)['then'](function(){return _0x3f6837[_0xc97e('0x7b')](_0x35102e,{'transaction':_0x1a2150})[_0xc97e('0x92')](function(_0x56fa70){return _0x56fa70;});});});}})[_0xc97e('0x28')](respondWithResult(_0x2af644,null))['catch'](handleError(_0x2af644,null));};exports[_0xc97e('0x93')]=function(_0x5f354d,_0x47ccd5){var _0x378ba8=_[_0xc97e('0x94')](_0x5f354d[_0xc97e('0x34')][_0xc97e('0x7a')])?_0x5f354d[_0xc97e('0x34')]['ids']:[_0x5f354d[_0xc97e('0x34')]['ids']];var _0x79b398=_0x5f354d[_0xc97e('0x4a')]['id'];return db[_0xc97e('0x30')][_0xc97e('0x4b')]({'where':{'id':_0x79b398}})['then'](handleEntityNotFound(_0x47ccd5,null))[_0xc97e('0x28')](function(_0x3e9db4){if(_0x3e9db4){var _0x5b93a2=[_0xc97e('0x7c'),'Chat',_0xc97e('0x7e'),_0xc97e('0x7f'),_0xc97e('0x80'),_0xc97e('0x81'),_0xc97e('0x82')];return db[_0xc97e('0x56')][_0xc97e('0x54')](function(_0x23bcc1){var _0x3b8e70=_[_0xc97e('0x2f')](_0x5b93a2,function(_0xab0cc){var _0x4c5c73={'attributes':['id',_0xc97e('0x2c')]};return _0x3e9db4[_0xc97e('0x84')+_0xab0cc+'Queues'](_0x4c5c73)[_0xc97e('0x28')](function(_0x3546e9){var _0x13dc42=_[_0xc97e('0x2f')](_0x3546e9,function(_0x3ca369){return _0x3ca369[_0xc97e('0x93')](_0x378ba8,{'transaction':_0x23bcc1})[_0xc97e('0x28')](function(){var _0x481e74=_[_0xc97e('0x2f')](_0x378ba8,function(_0x19e2d3){socket['emit'](_0xc97e('0x4d')+_0xab0cc+_0xc97e('0x95'),{'UserId':Number(_0x19e2d3),[_0xab0cc+_0xc97e('0x89')]:_0x3ca369['id']});if(_0xab0cc!==_0xc97e('0x7c')){return;}return db[_0xc97e('0x96')][_0xc97e('0x53')]({'where':{'VoiceQueueId':_0x3ca369['id'],'UserId':_0x19e2d3},'transaction':_0x23bcc1});});return Promise[_0xc97e('0x8f')](_0x481e74);});});return Promise[_0xc97e('0x8f')](_0x13dc42);});});return Promise['all'](_0x3b8e70)[_0xc97e('0x28')](function(){return _0x3e9db4[_0xc97e('0x93')](_0x378ba8,{'transaction':_0x23bcc1});})[_0xc97e('0x28')](function(){return db[_0xc97e('0x97')][_0xc97e('0x6e')]({'where':{'teamId':_0x79b398}})['then'](function(_0x283eb5){if(_0x283eb5){var _0x50853a=_[_0xc97e('0x2f')](_0x378ba8,function(_0x532a57){db['UserVoicePrefix'][_0xc97e('0x53')]({'where':{'UserId':_0x532a57,'VoicePrefixId':_0x283eb5[_0xc97e('0x91')]}});});return Promise[_0xc97e('0x8f')](_0x50853a);}});});});}})['then'](respondWithStatusCode(_0x47ccd5,null))[_0xc97e('0x48')](handleError(_0x47ccd5,null));};exports[_0xc97e('0x98')]=function(_0x277fd5,_0x3569dc,_0x13c8d2){var _0x5e85c8={};var _0xe95951={};var _0x57deea;var _0x4dc842;return db[_0xc97e('0x30')][_0xc97e('0x6e')]({'where':{'id':_0x277fd5[_0xc97e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3569dc,null))[_0xc97e('0x28')](function(_0x3629){if(_0x3629){_0x57deea=_0x3629;_0xe95951['model']=_[_0xc97e('0x35')](db[_0xc97e('0x85')][_0xc97e('0x31')]);_0xe95951[_0xc97e('0x34')]=_['keys'](_0x277fd5[_0xc97e('0x34')]);_0xe95951[_0xc97e('0x36')]=_[_0xc97e('0x37')](_0xe95951[_0xc97e('0x38')],_0xe95951[_0xc97e('0x34')]);_0x5e85c8[_0xc97e('0x39')]=_[_0xc97e('0x37')](_0xe95951[_0xc97e('0x38')],qs[_0xc97e('0x3a')](_0x277fd5[_0xc97e('0x34')]['fields']));_0x5e85c8['attributes']=_0x5e85c8[_0xc97e('0x39')][_0xc97e('0x3b')]?_0x5e85c8['attributes']:_0xe95951[_0xc97e('0x38')];_0x5e85c8[_0xc97e('0x3d')]=qs[_0xc97e('0x3e')](_0x277fd5[_0xc97e('0x34')][_0xc97e('0x3e')]);_0x5e85c8[_0xc97e('0x3f')]=qs[_0xc97e('0x36')](_[_0xc97e('0x40')](_0x277fd5[_0xc97e('0x34')],_0xe95951['filters']));if(_0x277fd5[_0xc97e('0x34')][_0xc97e('0x41')]){_0x5e85c8[_0xc97e('0x3f')]=_[_0xc97e('0x42')](_0x5e85c8[_0xc97e('0x3f')],{'$or':_[_0xc97e('0x2f')](_0x5e85c8[_0xc97e('0x39')],function(_0x5294be){var _0x38e153={};_0x38e153[_0x5294be]={'$like':'%'+_0x277fd5[_0xc97e('0x34')][_0xc97e('0x41')]+'%'};return _0x38e153;})});}_0x5e85c8=_['merge']({},_0x5e85c8,_0x277fd5[_0xc97e('0x44')]);return _0x57deea['getAgents'](_0x5e85c8);}})[_0xc97e('0x28')](function(_0x4a567a){if(_0x4a567a){_0x4dc842=_0x4a567a[_0xc97e('0x3b')];if(!_0x277fd5[_0xc97e('0x34')][_0xc97e('0x3c')](_0xc97e('0x99'))){_0x5e85c8[_0xc97e('0x21')]=qs[_0xc97e('0x21')](_0x277fd5[_0xc97e('0x34')]['limit']);_0x5e85c8[_0xc97e('0x23')]=qs[_0xc97e('0x23')](_0x277fd5[_0xc97e('0x34')][_0xc97e('0x23')]);}return _0x57deea[_0xc97e('0x98')](_0x5e85c8);}})[_0xc97e('0x28')](function(_0x58ca66){if(_0x58ca66){return _0x58ca66?{'count':_0x4dc842,'rows':_0x58ca66}:null;}})[_0xc97e('0x28')](respondWithResult(_0x3569dc,null))['catch'](handleError(_0x3569dc,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 52119e9..541c507 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 _0xf9b8=['events','../../mysqldb','Team','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x102571,_0x577bbc){var _0x2811d4=function(_0x778f6e){while(--_0x778f6e){_0x102571['push'](_0x102571['shift']());}};_0x2811d4(++_0x577bbc);}(_0xf9b8,0x87));var _0x8f9b=function(_0x247dab,_0x5af496){_0x247dab=_0x247dab-0x0;var _0x222cd5=_0xf9b8[_0x247dab];return _0x222cd5;};'use strict';var EventEmitter=require(_0x8f9b('0x0'));var Team=require(_0x8f9b('0x1'))['db'][_0x8f9b('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x8f9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f9b('0x4'),'afterDestroy':_0x8f9b('0x5')};function emitEvent(_0x456111){return function(_0x34574f,_0xb01031,_0x3f0a5b){TeamEvents['emit'](_0x456111+':'+_0x34574f['id'],_0x34574f);TeamEvents[_0x8f9b('0x6')](_0x456111,_0x34574f);_0x3f0a5b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x8f9b('0x7')](e,emitEvent(event));}}module[_0x8f9b('0x8')]=TeamEvents; \ No newline at end of file +var _0xf1e2=['../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x488164,_0x21c9b6){var _0x5829ed=function(_0x5d4585){while(--_0x5d4585){_0x488164['push'](_0x488164['shift']());}};_0x5829ed(++_0x21c9b6);}(_0xf1e2,0x95));var _0x2f1e=function(_0xe8840,_0x27d21a){_0xe8840=_0xe8840-0x0;var _0x2fb5e7=_0xf1e2[_0xe8840];return _0x2fb5e7;};'use strict';var EventEmitter=require(_0x2f1e('0x0'));var Team=require(_0x2f1e('0x1'))['db'][_0x2f1e('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2f1e('0x3')](0x0);var events={'afterCreate':_0x2f1e('0x4'),'afterUpdate':_0x2f1e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38574b){return function(_0x3dede4,_0x3bf8f0,_0x28b873){TeamEvents[_0x2f1e('0x6')](_0x38574b+':'+_0x3dede4['id'],_0x3dede4);TeamEvents[_0x2f1e('0x6')](_0x38574b,_0x3dede4);_0x28b873(null);};}for(var e in events){if(events[_0x2f1e('0x7')](e)){var event=events[e];Team[_0x2f1e('0x8')](e,emitEvent(event));}}module[_0x2f1e('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index a888029..a2057ca 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 _0x87da=['Mail','Openchannel','Sms','resolve','all','./team.attributes','get','Queues','then','map','catch','exports','define','Team','teams','Chat','Fax'];(function(_0x49710b,_0x5d35d6){var _0x589f8d=function(_0x365ae4){while(--_0x365ae4){_0x49710b['push'](_0x49710b['shift']());}};_0x589f8d(++_0x5d35d6);}(_0x87da,0x9e));var _0xa87d=function(_0x90b1fd,_0x58e942){_0x90b1fd=_0x90b1fd-0x0;var _0x4fafa3=_0x87da[_0x90b1fd];return _0x4fafa3;};'use strict';var _=require('lodash');var attributes=require(_0xa87d('0x0'));function getQueuesByChannel(_0x12d540,_0x52276e){var _0x25cd2a=_0xa87d('0x1')+_0x52276e+_0xa87d('0x2');return _0x12d540[_0x25cd2a]()[_0xa87d('0x3')](function(_0x37b411){return _[_0xa87d('0x4')](_0x37b411,function(_0x2fc346){_0x2fc346['setDataValue']('channel',_0x52276e);return _0x2fc346;});})[_0xa87d('0x5')](function(_0x330d64){throw _0x330d64;});}module[_0xa87d('0x6')]=function(_0x1210f1){return _0x1210f1[_0xa87d('0x7')](_0xa87d('0x8'),attributes,{'tableName':_0xa87d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3d4d96=this;var _0x2c83f1=[_0xa87d('0xa'),_0xa87d('0xb'),_0xa87d('0xc'),_0xa87d('0xd'),_0xa87d('0xe'),'Voice','Whatsapp'];return Promise[_0xa87d('0xf')]()[_0xa87d('0x3')](function(){var _0x3e86e8=_[_0xa87d('0x4')](_0x2c83f1,function(_0x1bccc5){return getQueuesByChannel(_0x3d4d96,_0x1bccc5);});return Promise[_0xa87d('0x10')](_0x3e86e8);})[_0xa87d('0x5')](function(_0x23f49c){throw _0x23f49c;});}}});}; \ No newline at end of file +var _0x47eb=['define','Team','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','./team.attributes','get','Queues','then','setDataValue','channel','catch','exports'];(function(_0x225ba2,_0x1d25f7){var _0x59d8ff=function(_0x387ba9){while(--_0x387ba9){_0x225ba2['push'](_0x225ba2['shift']());}};_0x59d8ff(++_0x1d25f7);}(_0x47eb,0xc4));var _0xb47e=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x47eb[_0x1ca29f];return _0x576c3b;};'use strict';var _=require('lodash');var attributes=require(_0xb47e('0x0'));function getQueuesByChannel(_0x1d8bdd,_0x262e23){var _0x3fa41a=_0xb47e('0x1')+_0x262e23+_0xb47e('0x2');return _0x1d8bdd[_0x3fa41a]()[_0xb47e('0x3')](function(_0x3ab6e5){return _['map'](_0x3ab6e5,function(_0x18b2cd){_0x18b2cd[_0xb47e('0x4')](_0xb47e('0x5'),_0x262e23);return _0x18b2cd;});})[_0xb47e('0x6')](function(_0x5227ac){throw _0x5227ac;});}module[_0xb47e('0x7')]=function(_0x25a5f5){return _0x25a5f5[_0xb47e('0x8')](_0xb47e('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xc9a324=this;var _0x7c4b9c=['Chat','Fax',_0xb47e('0xa'),_0xb47e('0xb'),_0xb47e('0xc'),_0xb47e('0xd'),_0xb47e('0xe')];return Promise[_0xb47e('0xf')]()[_0xb47e('0x3')](function(){var _0x5372c7=_[_0xb47e('0x10')](_0x7c4b9c,function(_0x123399){return getQueuesByChannel(_0xc9a324,_0x123399);});return Promise['all'](_0x5372c7);})[_0xb47e('0x6')](function(_0x5ddd26){throw _0x5ddd26;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index e1b7792..d4abced 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 _0x7a29=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a29,0x111));var _0x97a2=function(_0x62621f,_0x2eaca1){_0x62621f=_0x62621f-0x0;var _0x302757=_0x7a29[_0x62621f];return _0x302757;};'use strict';var _=require(_0x97a2('0x0'));var util=require(_0x97a2('0x1'));var moment=require(_0x97a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97a2('0x4'));var logger=require(_0x97a2('0x5'))(_0x97a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x97a2('0x7'));var client=jayson[_0x97a2('0x8')][_0x97a2('0x9')]({'port':0x232a});config[_0x97a2('0xa')]=_[_0x97a2('0xb')](config[_0x97a2('0xa')],{'host':_0x97a2('0xc'),'port':0x18eb});var socket=require(_0x97a2('0xd'))(new Redis(config[_0x97a2('0xa')]));require(_0x97a2('0xe'))[_0x97a2('0xf')](socket);function respondWithRpcPromise(_0xc9ef,_0x3edccf,_0x2e8402){return new BPromise(function(_0x1914f1,_0x517d5f){return client[_0x97a2('0x10')](_0xc9ef,_0x2e8402)[_0x97a2('0x11')](function(_0x47fb5b){logger['info'](_0x97a2('0x12'),_0x3edccf,_0x97a2('0x13'));logger[_0x97a2('0x14')](_0x97a2('0x15'),_0x3edccf,'request\x20sent',JSON[_0x97a2('0x16')](_0x47fb5b));if(_0x47fb5b[_0x97a2('0x17')]){if(_0x47fb5b[_0x97a2('0x17')][_0x97a2('0x18')]===0x1f4){logger[_0x97a2('0x17')](_0x97a2('0x12'),_0x3edccf,_0x47fb5b[_0x97a2('0x17')]['message']);return _0x517d5f(_0x47fb5b['error'][_0x97a2('0x19')]);}logger[_0x97a2('0x17')](_0x97a2('0x12'),_0x3edccf,_0x47fb5b[_0x97a2('0x17')][_0x97a2('0x19')]);return _0x1914f1(_0x47fb5b[_0x97a2('0x17')]['message']);}else{logger[_0x97a2('0x1a')]('Team,\x20%s,\x20%s',_0x3edccf,_0x97a2('0x13'));_0x1914f1(_0x47fb5b[_0x97a2('0x1b')]['message']);}})['catch'](function(_0x27bcb3){logger[_0x97a2('0x17')](_0x97a2('0x12'),_0x3edccf,_0x27bcb3);_0x517d5f(_0x27bcb3);});});} \ No newline at end of file +var _0x9167=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./team.socket','register'];(function(_0xbab353,_0x37e159){var _0x56871e=function(_0x474f77){while(--_0x474f77){_0xbab353['push'](_0xbab353['shift']());}};_0x56871e(++_0x37e159);}(_0x9167,0x98));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7916('0x0'));var util=require(_0x7916('0x1'));var moment=require(_0x7916('0x2'));var BPromise=require(_0x7916('0x3'));var rs=require(_0x7916('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7916('0x5'));var logger=require(_0x7916('0x6'))(_0x7916('0x7'));var config=require('../../config/environment');var jayson=require(_0x7916('0x8'));var client=jayson['client'][_0x7916('0x9')]({'port':0x232a});config['redis']=_[_0x7916('0xa')](config['redis'],{'host':_0x7916('0xb'),'port':0x18eb});var socket=require(_0x7916('0xc'))(new Redis(config[_0x7916('0xd')]));require(_0x7916('0xe'))[_0x7916('0xf')](socket);function respondWithRpcPromise(_0x26d4bf,_0x8261e1,_0x3b1295){return new BPromise(function(_0x1fa706,_0x219308){return client['request'](_0x26d4bf,_0x3b1295)[_0x7916('0x10')](function(_0x2b9934){logger[_0x7916('0x11')](_0x7916('0x12'),_0x8261e1,_0x7916('0x13'));logger[_0x7916('0x14')](_0x7916('0x15'),_0x8261e1,'request\x20sent',JSON[_0x7916('0x16')](_0x2b9934));if(_0x2b9934['error']){if(_0x2b9934[_0x7916('0x17')][_0x7916('0x18')]===0x1f4){logger[_0x7916('0x17')](_0x7916('0x12'),_0x8261e1,_0x2b9934['error'][_0x7916('0x19')]);return _0x219308(_0x2b9934[_0x7916('0x17')][_0x7916('0x19')]);}logger[_0x7916('0x17')]('Team,\x20%s,\x20%s',_0x8261e1,_0x2b9934[_0x7916('0x17')]['message']);return _0x1fa706(_0x2b9934[_0x7916('0x17')][_0x7916('0x19')]);}else{logger[_0x7916('0x11')](_0x7916('0x12'),_0x8261e1,_0x7916('0x13'));_0x1fa706(_0x2b9934[_0x7916('0x1a')][_0x7916('0x19')]);}})[_0x7916('0x1b')](function(_0x218f5a){logger[_0x7916('0x17')]('Team,\x20%s,\x20%s',_0x8261e1,_0x218f5a);_0x219308(_0x218f5a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c3ec1aa..56c6903 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 _0x96d9=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x96d9,0xea));var _0x996d=function(_0x1241b4,_0x363b60){_0x1241b4=_0x1241b4-0x0;var _0x276ffb=_0x96d9[_0x1241b4];return _0x276ffb;};'use strict';var TeamEvents=require(_0x996d('0x0'));var events=[_0x996d('0x1'),_0x996d('0x2'),_0x996d('0x3')];function createListener(_0x25ebfb,_0x3c9b3b){return function(_0x2c01e6){_0x3c9b3b[_0x996d('0x4')](_0x25ebfb,_0x2c01e6);};}function removeListener(_0x51322b,_0x3ee31b){return function(){TeamEvents[_0x996d('0x5')](_0x51322b,_0x3ee31b);};}exports[_0x996d('0x6')]=function(_0x5f99a){for(var _0x5b9be6=0x0,_0x427a02=events[_0x996d('0x7')];_0x5b9be6<_0x427a02;_0x5b9be6++){var _0x4d65b5=events[_0x5b9be6];var _0x40c142=createListener(_0x996d('0x8')+_0x4d65b5,_0x5f99a);TeamEvents['on'](_0x4d65b5,_0x40c142);}}; \ No newline at end of file +var _0x16d1=['team:','./team.events','save','remove','update','removeListener'];(function(_0x756427,_0x42c899){var _0x4a70f8=function(_0x3fb4fc){while(--_0x3fb4fc){_0x756427['push'](_0x756427['shift']());}};_0x4a70f8(++_0x42c899);}(_0x16d1,0xf7));var _0x116d=function(_0x471af3,_0x1b561b){_0x471af3=_0x471af3-0x0;var _0x36dfe7=_0x16d1[_0x471af3];return _0x36dfe7;};'use strict';var TeamEvents=require(_0x116d('0x0'));var events=[_0x116d('0x1'),_0x116d('0x2'),_0x116d('0x3')];function createListener(_0x41610c,_0x5f35b6){return function(_0xb8a8b){_0x5f35b6['emit'](_0x41610c,_0xb8a8b);};}function removeListener(_0x13e3c8,_0x2a6178){return function(){TeamEvents[_0x116d('0x4')](_0x13e3c8,_0x2a6178);};}exports['register']=function(_0x24f61d){for(var _0x32717b=0x0,_0x912a78=events['length'];_0x32717b<_0x912a78;_0x32717b++){var _0x34c27a=events[_0x32717b];var _0x2e3922=createListener(_0x116d('0x5')+_0x34c27a,_0x24f61d);TeamEvents['on'](_0x34c27a,_0x2e3922);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index f1e8da9..f5eebfe 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 _0x534d=['INTEGER','sequelize','exports'];(function(_0x27a480,_0xab43d8){var _0x5f5b14=function(_0x837672){while(--_0x837672){_0x27a480['push'](_0x27a480['shift']());}};_0x5f5b14(++_0xab43d8);}(_0x534d,0x79));var _0xd534=function(_0x3291cd,_0x879f26){_0x3291cd=_0x3291cd-0x0;var _0x247347=_0x534d[_0x3291cd];return _0x247347;};'use strict';var Sequelize=require(_0xd534('0x0'));module[_0xd534('0x1')]={'TeamId':{'type':Sequelize[_0xd534('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd534('0x2')]}}; \ No newline at end of file +var _0x7985=['sequelize','INTEGER'];(function(_0x21f45b,_0xd38634){var _0x2fdc7b=function(_0x55c94){while(--_0x55c94){_0x21f45b['push'](_0x21f45b['shift']());}};_0x2fdc7b(++_0xd38634);}(_0x7985,0x1de));var _0x5798=function(_0xd16df9,_0x18db96){_0xd16df9=_0xd16df9-0x0;var _0x141b04=_0x7985[_0xd16df9];return _0x141b04;};'use strict';var Sequelize=require(_0x5798('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x5798('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x5798('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a57f2b3..373dcd5 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 _0x4123=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4123,0x87));var _0x3412=function(_0xe3752c,_0x4e6169){_0xe3752c=_0xe3752c-0x0;var _0x2ce6e2=_0x4123[_0xe3752c];return _0x2ce6e2;};'use strict';var _=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var logger=require(_0x3412('0x2'))(_0x3412('0x3'));var moment=require(_0x3412('0x4'));var BPromise=require(_0x3412('0x5'));var rp=require(_0x3412('0x6'));var fs=require('fs');var path=require(_0x3412('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3412('0x8'));module[_0x3412('0x9')]=function(_0x48eb88,_0x11aa67){return _0x48eb88[_0x3412('0xa')](_0x3412('0xb'),attributes,{'tableName':_0x3412('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9348=['../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x15b7b4,_0x3cb06a){var _0x5e1f72=function(_0x23672a){while(--_0x23672a){_0x15b7b4['push'](_0x15b7b4['shift']());}};_0x5e1f72(++_0x3cb06a);}(_0x9348,0x10d));var _0x8934=function(_0x34192d,_0x3a77e5){_0x34192d=_0x34192d-0x0;var _0xaa7304=_0x9348[_0x34192d];return _0xaa7304;};'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')]('TeamVoicePrefix',attributes,{'tableName':_0x8934('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 3cf4dd2..ce0a59f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c3e1c,_0x2130a5){var _0x4e34eb=function(_0x7274c1){while(--_0x7274c1){_0x2c3e1c['push'](_0x2c3e1c['shift']());}};_0x4e34eb(++_0x2130a5);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x52f106,_0xd6b907){var _0x3c8bfa=function(_0x3c64a9){while(--_0x3c64a9){_0x52f106['push'](_0x52f106['shift']());}};_0x3c8bfa(++_0xd6b907);}(_0x70e0,0x17b));var _0x070e=function(_0x568ffa,_0x1f8dfe){_0x568ffa=_0x568ffa-0x0;var _0x4470b8=_0x70e0[_0x568ffa];return _0x4470b8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8bcec7c..54980f4 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 _0xdb60=['INTEGER','sequelize'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xdb60,0xd3));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0db6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0db6('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x54d7=['sequelize','INTEGER'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x54d7,0x1d8));var _0x754d=function(_0x4d429e,_0x36a3b5){_0x4d429e=_0x4d429e-0x0;var _0x144ea1=_0x54d7[_0x4d429e];return _0x144ea1;};'use strict';var Sequelize=require(_0x754d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x754d('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 4fa3232..1d0903a 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 _0x7aaf=['./teamVoiceQueue.attributes','exports','TeamVoiceQueue','lodash','../../config/logger','api','request-promise','rimraf'];(function(_0x5b11b1,_0x7b7914){var _0x3218a0=function(_0x347f36){while(--_0x347f36){_0x5b11b1['push'](_0x5b11b1['shift']());}};_0x3218a0(++_0x7b7914);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0xffa4ea,_0x243f9c){_0xffa4ea=_0xffa4ea-0x0;var _0x3297b3=_0x7aaf[_0xffa4ea];return _0x3297b3;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var logger=require(_0xf7aa('0x1'))(_0xf7aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7aa('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7aa('0x5'));module[_0xf7aa('0x6')]=function(_0x1babcd,_0xf02ed5){return _0x1babcd['define'](_0xf7aa('0x7'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8de=['util','../../config/logger','moment','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','team_has_voice_queues'];(function(_0x3d417e,_0x554376){var _0x804420=function(_0x15e3b1){while(--_0x15e3b1){_0x3d417e['push'](_0x3d417e['shift']());}};_0x804420(++_0x554376);}(_0xf8de,0x1d4));var _0xef8d=function(_0x29cc53,_0xe973ec){_0x29cc53=_0x29cc53-0x0;var _0x957fd8=_0xf8de[_0x29cc53];return _0x957fd8;};'use strict';var _=require('lodash');var util=require(_0xef8d('0x0'));var logger=require(_0xef8d('0x1'))('api');var moment=require(_0xef8d('0x2'));var BPromise=require('bluebird');var rp=require(_0xef8d('0x3'));var fs=require('fs');var path=require(_0xef8d('0x4'));var rimraf=require(_0xef8d('0x5'));var config=require('../../config/environment');var attributes=require(_0xef8d('0x6'));module[_0xef8d('0x7')]=function(_0x586e39,_0x2ba6b9){return _0x586e39['define']('TeamVoiceQueue',attributes,{'tableName':_0xef8d('0x8'),'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 b843879..643a1f6 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 _0x2259=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2259,0x17c));var _0x9225=function(_0x3fc0fd,_0x50d29f){_0x3fc0fd=_0x3fc0fd-0x0;var _0x4dfdaa=_0x2259[_0x3fc0fd];return _0x4dfdaa;};'use strict';var _=require(_0x9225('0x0'));var util=require(_0x9225('0x1'));var moment=require(_0x9225('0x2'));var BPromise=require(_0x9225('0x3'));var rs=require(_0x9225('0x4'));var fs=require('fs');var Redis=require(_0x9225('0x5'));var db=require(_0x9225('0x6'))['db'];var utils=require(_0x9225('0x7'));var logger=require('../../config/logger')(_0x9225('0x8'));var config=require(_0x9225('0x9'));var jayson=require(_0x9225('0xa'));var client=jayson[_0x9225('0xb')][_0x9225('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36bd31,_0x14d943,_0x46b110){return new BPromise(function(_0x238484,_0x17f6ea){return client[_0x9225('0xd')](_0x36bd31,_0x46b110)[_0x9225('0xe')](function(_0x49bdef){logger[_0x9225('0xf')](_0x9225('0x10'),_0x14d943,_0x9225('0x11'));logger[_0x9225('0x12')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x14d943,'request\x20sent',JSON['stringify'](_0x49bdef));if(_0x49bdef[_0x9225('0x13')]){if(_0x49bdef['error'][_0x9225('0x14')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x14d943,_0x49bdef[_0x9225('0x13')]['message']);return _0x17f6ea(_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);}logger['error'](_0x9225('0x10'),_0x14d943,_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);return _0x238484(_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);}else{logger['info'](_0x9225('0x10'),_0x14d943,_0x9225('0x11'));_0x238484(_0x49bdef[_0x9225('0x16')][_0x9225('0x15')]);}})[_0x9225('0x17')](function(_0x4c385d){logger[_0x9225('0x13')](_0x9225('0x10'),_0x14d943,_0x4c385d);_0x17f6ea(_0x4c385d);});});} \ No newline at end of file +var _0xcf95=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5cf9('0x0'));var util=require(_0x5cf9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cf9('0x2'));var db=require(_0x5cf9('0x3'))['db'];var utils=require(_0x5cf9('0x4'));var logger=require(_0x5cf9('0x5'))('rpc');var config=require(_0x5cf9('0x6'));var jayson=require(_0x5cf9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0c3a,_0x2d24df,_0x51acd7){return new BPromise(function(_0x26b0de,_0x233ccf){return client[_0x5cf9('0x8')](_0x1c0c3a,_0x51acd7)[_0x5cf9('0x9')](function(_0x435886){logger[_0x5cf9('0xa')](_0x5cf9('0xb'),_0x2d24df,_0x5cf9('0xc'));logger[_0x5cf9('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2d24df,_0x5cf9('0xc'),JSON[_0x5cf9('0xe')](_0x435886));if(_0x435886[_0x5cf9('0xf')]){if(_0x435886[_0x5cf9('0xf')]['code']===0x1f4){logger[_0x5cf9('0xf')](_0x5cf9('0xb'),_0x2d24df,_0x435886[_0x5cf9('0xf')][_0x5cf9('0x10')]);return _0x233ccf(_0x435886[_0x5cf9('0xf')][_0x5cf9('0x10')]);}logger[_0x5cf9('0xf')](_0x5cf9('0xb'),_0x2d24df,_0x435886['error'][_0x5cf9('0x10')]);return _0x26b0de(_0x435886[_0x5cf9('0xf')]['message']);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x2d24df,'request\x20sent');_0x26b0de(_0x435886[_0x5cf9('0x11')][_0x5cf9('0x10')]);}})[_0x5cf9('0x12')](function(_0x2f4d21){logger['error'](_0x5cf9('0xb'),_0x2d24df,_0x2f4d21);_0x233ccf(_0x2f4d21);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 97f1d77..d3d122f 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 _0xac41=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller'];(function(_0x5da7d8,_0x309f0c){var _0x261acc=function(_0x2d3887){while(--_0x2d3887){_0x5da7d8['push'](_0x5da7d8['shift']());}};_0x261acc(++_0x309f0c);}(_0xac41,0xdd));var _0x1ac4=function(_0x70f930,_0x5ae8cb){_0x70f930=_0x70f930-0x0;var _0x3d4b3a=_0xac41[_0x70f930];return _0x3d4b3a;};'use strict';var multer=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var path=require(_0x1ac4('0x2'));var timeout=require(_0x1ac4('0x3'));var express=require(_0x1ac4('0x4'));var router=express[_0x1ac4('0x5')]();var fs_extra=require(_0x1ac4('0x6'));var auth=require(_0x1ac4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac4('0x8'));var controller=require(_0x1ac4('0x9'));router[_0x1ac4('0xa')]('/',auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xc')]);router[_0x1ac4('0xa')](_0x1ac4('0xd'),auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xe')]);router[_0x1ac4('0xf')]('/',auth[_0x1ac4('0xb')](),controller[_0x1ac4('0x10')]);router[_0x1ac4('0x11')](_0x1ac4('0xd'),auth[_0x1ac4('0xb')](),controller[_0x1ac4('0x12')]);router['delete'](_0x1ac4('0xd'),auth['isAuthenticated'](),controller[_0x1ac4('0x13')]);module[_0x1ac4('0x14')]=router; \ No newline at end of file +var _0xeaab=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xeaab,0xd9));var _0xbeaa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeaab[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xbeaa('0x0'));var util=require('util');var path=require(_0xbeaa('0x1'));var timeout=require(_0xbeaa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeaa('0x3'));var auth=require(_0xbeaa('0x4'));var interaction=require(_0xbeaa('0x5'));var config=require(_0xbeaa('0x6'));var controller=require(_0xbeaa('0x7'));router[_0xbeaa('0x8')]('/',auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xa')]);router[_0xbeaa('0x8')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xc')]);router[_0xbeaa('0xd')]('/',auth[_0xbeaa('0x9')](),controller['create']);router[_0xbeaa('0xe')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xf')]);router[_0xbeaa('0x10')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller['destroy']);module[_0xbeaa('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8ccfaf1..ad2be57 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 _0x9cc1=['exports','STRING','TEXT','sequelize'];(function(_0x10156d,_0x5a451a){var _0x4ba0c6=function(_0x426212){while(--_0x426212){_0x10156d['push'](_0x10156d['shift']());}};_0x4ba0c6(++_0x5a451a);}(_0x9cc1,0x137));var _0x19cc=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x9cc1[_0x39ffd1];return _0x31267e;};'use strict';var Sequelize=require(_0x19cc('0x0'));module[_0x19cc('0x1')]={'name':{'type':Sequelize[_0x19cc('0x2')]},'description':{'type':Sequelize[_0x19cc('0x2')]},'html':{'type':Sequelize[_0x19cc('0x3')]}}; \ No newline at end of file +var _0xf9a9=['TEXT','exports','STRING'];(function(_0x4ba845,_0x2ba597){var _0x38b3c0=function(_0x2a10f4){while(--_0x2a10f4){_0x4ba845['push'](_0x4ba845['shift']());}};_0x38b3c0(++_0x2ba597);}(_0xf9a9,0x1c6));var _0x9f9a=function(_0x367968,_0x12df23){_0x367968=_0x367968-0x0;var _0x19884d=_0xf9a9[_0x367968];return _0x19884d;};'use strict';var Sequelize=require('sequelize');module[_0x9f9a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f9a('0x1')]},'html':{'type':Sequelize[_0x9f9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8736022..67c645d 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 _0x4ae9=['save','then','get','Templates','sendStatus','error','stack','name','send','Template','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','set','Content-Range','reject'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x4ae9,0x1e1));var _0x94ae=function(_0x239f2e,_0x4c5c60){_0x239f2e=_0x239f2e-0x0;var _0x17dcf6=_0x4ae9[_0x239f2e];return _0x17dcf6;};'use strict';var emlformat=require(_0x94ae('0x0'));var rimraf=require(_0x94ae('0x1'));var zipdir=require(_0x94ae('0x2'));var jsonpatch=require(_0x94ae('0x3'));var rp=require(_0x94ae('0x4'));var moment=require(_0x94ae('0x5'));var BPromise=require(_0x94ae('0x6'));var Mustache=require(_0x94ae('0x7'));var util=require(_0x94ae('0x8'));var path=require(_0x94ae('0x9'));var sox=require('sox');var csv=require(_0x94ae('0xa'));var ejs=require(_0x94ae('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94ae('0xc'));var squel=require('squel');var crypto=require(_0x94ae('0xd'));var jsforce=require(_0x94ae('0xe'));var deskjs=require(_0x94ae('0xf'));var toCsv=require(_0x94ae('0xa'));var querystring=require(_0x94ae('0x10'));var Papa=require(_0x94ae('0x11'));var Redis=require(_0x94ae('0x12'));var authService=require(_0x94ae('0x13'));var qs=require(_0x94ae('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94ae('0x15'));var logger=require(_0x94ae('0x16'))(_0x94ae('0x17'));var utils=require(_0x94ae('0x18'));var config=require(_0x94ae('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x94ae('0x1a'))['db'];function respondWithStatusCode(_0x3f6d03,_0x521bb1){_0x521bb1=_0x521bb1||0xcc;return function(_0x3f1d14){if(_0x3f1d14){return _0x3f6d03['sendStatus'](_0x521bb1);}return _0x3f6d03[_0x94ae('0x1b')](_0x521bb1)[_0x94ae('0x1c')]();};}function respondWithResult(_0x3053d2,_0x4ea00d){_0x4ea00d=_0x4ea00d||0xc8;return function(_0x1fbb82){if(_0x1fbb82){return _0x3053d2['status'](_0x4ea00d)[_0x94ae('0x1d')](_0x1fbb82);}};}function respondWithFilteredResult(_0x3b57c8,_0x4014e0){return function(_0x5467d1){if(_0x5467d1){var _0x2096ea=typeof _0x4014e0[_0x94ae('0x1e')]==='undefined'&&typeof _0x4014e0['limit']===_0x94ae('0x1f');var _0x147777=_0x5467d1['count'];var _0x48ea4b=_0x2096ea?0x0:_0x4014e0['offset'];var _0x4a5998=_0x2096ea?_0x5467d1['count']:_0x4014e0[_0x94ae('0x1e')]+_0x4014e0['limit'];var _0x9b8b66;if(_0x4a5998>=_0x147777){_0x4a5998=_0x147777;_0x9b8b66=0xc8;}else{_0x9b8b66=0xce;}_0x3b57c8[_0x94ae('0x1b')](_0x9b8b66);return _0x3b57c8[_0x94ae('0x20')](_0x94ae('0x21'),_0x48ea4b+'-'+_0x4a5998+'/'+_0x147777)[_0x94ae('0x1d')](_0x5467d1);}return null;};}function patchUpdates(_0x1b8f52){return function(_0x2f6ea9){try{jsonpatch['apply'](_0x2f6ea9,_0x1b8f52,!![]);}catch(_0x252b68){return BPromise[_0x94ae('0x22')](_0x252b68);}return _0x2f6ea9[_0x94ae('0x23')]();};}function saveUpdates(_0x3a676e,_0x1756d5){return function(_0x224880){if(_0x224880){return _0x224880['update'](_0x3a676e)[_0x94ae('0x24')](function(_0x366603){return _0x366603;});}return null;};}function removeEntity(_0x50b531,_0x99aca){return function(_0x3385f9){if(_0x3385f9){return _0x3385f9['destroy']()[_0x94ae('0x24')](function(){var _0x535679=_0x3385f9[_0x94ae('0x25')]({'plain':!![]});var _0x51342d=_0x94ae('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x51342d,'resourceId':_0x535679['id']}})[_0x94ae('0x24')](function(){return _0x3385f9;});})[_0x94ae('0x24')](function(){_0x50b531['status'](0xcc)[_0x94ae('0x1c')]();});}};}function handleEntityNotFound(_0x452276,_0x193a9c){return function(_0x144c1f){if(!_0x144c1f){_0x452276[_0x94ae('0x27')](0x194);}return _0x144c1f;};}function handleError(_0x56fe11,_0x37b5ad){_0x37b5ad=_0x37b5ad||0x1f4;return function(_0x302e7b){logger[_0x94ae('0x28')](_0x302e7b[_0x94ae('0x29')]);if(_0x302e7b[_0x94ae('0x2a')]){delete _0x302e7b[_0x94ae('0x2a')];}_0x56fe11[_0x94ae('0x1b')](_0x37b5ad)[_0x94ae('0x2b')](_0x302e7b);};}exports['index']=function(_0x67f898,_0x231e2a){var _0x30281c={},_0xe7b4e3={},_0xbcee75={'count':0x0,'rows':[]};var _0x3fbb91=_['map'](db[_0x94ae('0x2c')][_0x94ae('0x2d')],function(_0x396950){return{'name':_0x396950[_0x94ae('0x2e')],'type':_0x396950[_0x94ae('0x2f')][_0x94ae('0x30')]};});_0xe7b4e3['model']=_['map'](_0x3fbb91,_0x94ae('0x2a'));_0xe7b4e3[_0x94ae('0x31')]=_[_0x94ae('0x32')](_0x67f898[_0x94ae('0x31')]);_0xe7b4e3[_0x94ae('0x33')]=_['intersection'](_0xe7b4e3[_0x94ae('0x34')],_0xe7b4e3['query']);_0x30281c[_0x94ae('0x35')]=_['intersection'](_0xe7b4e3['model'],qs[_0x94ae('0x36')](_0x67f898['query']['fields']));_0x30281c['attributes']=_0x30281c[_0x94ae('0x35')][_0x94ae('0x37')]?_0x30281c[_0x94ae('0x35')]:_0xe7b4e3[_0x94ae('0x34')];if(!_0x67f898[_0x94ae('0x31')]['hasOwnProperty'](_0x94ae('0x38'))){_0x30281c[_0x94ae('0x39')]=qs['limit'](_0x67f898[_0x94ae('0x31')]['limit']);_0x30281c[_0x94ae('0x1e')]=qs['offset'](_0x67f898[_0x94ae('0x31')][_0x94ae('0x1e')]);}_0x30281c[_0x94ae('0x3a')]=qs[_0x94ae('0x3b')](_0x67f898[_0x94ae('0x31')][_0x94ae('0x3b')]);_0x30281c[_0x94ae('0x3c')]=qs[_0x94ae('0x33')](_[_0x94ae('0x3d')](_0x67f898[_0x94ae('0x31')],_0xe7b4e3[_0x94ae('0x33')]),_0x3fbb91);if(_0x67f898[_0x94ae('0x31')]['filter']){_0x30281c[_0x94ae('0x3c')]=_[_0x94ae('0x3e')](_0x30281c[_0x94ae('0x3c')],{'$or':_['map'](_0x3fbb91,function(_0xbb933e){if(_0xbb933e[_0x94ae('0x2f')]!==_0x94ae('0x3f')){var _0x3e6367={};_0x3e6367[_0xbb933e['name']]={'$like':'%'+_0x67f898['query']['filter']+'%'};return _0x3e6367;}})});}_0x30281c=_[_0x94ae('0x3e')]({},_0x30281c,_0x67f898[_0x94ae('0x40')]);var _0x16f2fc={'where':_0x30281c['where']};return db[_0x94ae('0x2c')][_0x94ae('0x41')](_0x16f2fc)[_0x94ae('0x24')](function(_0x600a24){_0xbcee75[_0x94ae('0x41')]=_0x600a24;if(_0x67f898[_0x94ae('0x31')]['includeAll']){_0x30281c[_0x94ae('0x42')]=[{'all':!![]}];}return db[_0x94ae('0x2c')][_0x94ae('0x43')](_0x30281c);})[_0x94ae('0x24')](function(_0xb59c81){_0xbcee75[_0x94ae('0x44')]=_0xb59c81;return _0xbcee75;})[_0x94ae('0x24')](respondWithFilteredResult(_0x231e2a,_0x30281c))[_0x94ae('0x45')](handleError(_0x231e2a,null));};exports[_0x94ae('0x46')]=function(_0xba181c,_0x257b82){var _0xb3f98d={'raw':!![],'where':{'id':_0xba181c[_0x94ae('0x47')]['id']}},_0x1fd6f9={};_0x1fd6f9[_0x94ae('0x34')]=_[_0x94ae('0x32')](db[_0x94ae('0x2c')][_0x94ae('0x2d')]);_0x1fd6f9['query']=_[_0x94ae('0x32')](_0xba181c[_0x94ae('0x31')]);_0x1fd6f9[_0x94ae('0x33')]=_[_0x94ae('0x48')](_0x1fd6f9[_0x94ae('0x34')],_0x1fd6f9[_0x94ae('0x31')]);_0xb3f98d['attributes']=_[_0x94ae('0x48')](_0x1fd6f9[_0x94ae('0x34')],qs[_0x94ae('0x36')](_0xba181c['query'][_0x94ae('0x36')]));_0xb3f98d['attributes']=_0xb3f98d['attributes'][_0x94ae('0x37')]?_0xb3f98d['attributes']:_0x1fd6f9[_0x94ae('0x34')];if(_0xba181c[_0x94ae('0x31')][_0x94ae('0x49')]){_0xb3f98d[_0x94ae('0x42')]=[{'all':!![]}];}_0xb3f98d=_['merge']({},_0xb3f98d,_0xba181c['options']);return db['Template'][_0x94ae('0x4a')](_0xb3f98d)[_0x94ae('0x24')](handleEntityNotFound(_0x257b82,null))['then'](respondWithResult(_0x257b82,null))[_0x94ae('0x45')](handleError(_0x257b82,null));};exports['create']=function(_0x40a787,_0x24ec28){return db['Template'][_0x94ae('0x4b')](_0x40a787['body'],{})[_0x94ae('0x24')](function(_0x23a2a4){var _0x463681=_0x40a787[_0x94ae('0x4c')][_0x94ae('0x25')]({'plain':!![]});if(!_0x463681)throw new Error(_0x94ae('0x4d'));if(_0x463681[_0x94ae('0x4e')]===_0x94ae('0x4c')){var _0x510c67=_0x23a2a4[_0x94ae('0x25')]({'plain':!![]});var _0x390cb6='Templates';return db[_0x94ae('0x4f')][_0x94ae('0x4a')]({'where':{'name':_0x390cb6,'userProfileId':_0x463681[_0x94ae('0x50')]},'raw':!![]})['then'](function(_0x3a34da){if(_0x3a34da&&_0x3a34da[_0x94ae('0x51')]===0x0){return db[_0x94ae('0x52')][_0x94ae('0x4b')]({'name':_0x510c67[_0x94ae('0x2a')],'resourceId':_0x510c67['id'],'type':_0x3a34da[_0x94ae('0x2a')],'sectionId':_0x3a34da['id']},{})[_0x94ae('0x24')](function(){return _0x23a2a4;});}else{return _0x23a2a4;}})[_0x94ae('0x45')](function(_0xbcf30c){logger[_0x94ae('0x28')](_0x94ae('0x53'),_0xbcf30c);throw _0xbcf30c;});}return _0x23a2a4;})[_0x94ae('0x24')](respondWithResult(_0x24ec28,0xc9))['catch'](handleError(_0x24ec28,null));};exports[_0x94ae('0x54')]=function(_0x387d72,_0x7e4a95){if(_0x387d72['body']['id']){delete _0x387d72[_0x94ae('0x55')]['id'];}return db['Template'][_0x94ae('0x4a')]({'where':{'id':_0x387d72[_0x94ae('0x47')]['id']}})[_0x94ae('0x24')](handleEntityNotFound(_0x7e4a95,null))[_0x94ae('0x24')](saveUpdates(_0x387d72['body'],null))[_0x94ae('0x24')](respondWithResult(_0x7e4a95,null))[_0x94ae('0x45')](handleError(_0x7e4a95,null));};exports['destroy']=function(_0x110906,_0x2c46eb){return db['Template'][_0x94ae('0x4a')]({'where':{'id':_0x110906[_0x94ae('0x47')]['id']}})[_0x94ae('0x24')](handleEntityNotFound(_0x2c46eb,null))['then'](removeEntity(_0x2c46eb,null))[_0x94ae('0x45')](handleError(_0x2c46eb,null));}; \ No newline at end of file +var _0xc168=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','Template','findAll','rows','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x771454,_0x17231e){var _0xc2b5c8=function(_0x50bd54){while(--_0x50bd54){_0x771454['push'](_0x771454['shift']());}};_0xc2b5c8(++_0x17231e);}(_0xc168,0x193));var _0x8c16=function(_0x1ba1c7,_0x2833a5){_0x1ba1c7=_0x1ba1c7-0x0;var _0x342f1f=_0xc168[_0x1ba1c7];return _0x342f1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c16('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c16('0x1'));var rp=require(_0x8c16('0x2'));var moment=require(_0x8c16('0x3'));var BPromise=require(_0x8c16('0x4'));var Mustache=require(_0x8c16('0x5'));var util=require(_0x8c16('0x6'));var path=require('path');var sox=require(_0x8c16('0x7'));var csv=require('to-csv');var ejs=require(_0x8c16('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c16('0x9'));var squel=require(_0x8c16('0xa'));var crypto=require(_0x8c16('0xb'));var jsforce=require(_0x8c16('0xc'));var deskjs=require(_0x8c16('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8c16('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c16('0xf'));var authService=require(_0x8c16('0x10'));var qs=require(_0x8c16('0x11'));var as=require(_0x8c16('0x12'));var hardwareService=require(_0x8c16('0x13'));var logger=require(_0x8c16('0x14'))(_0x8c16('0x15'));var utils=require(_0x8c16('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8c16('0x17'));var db=require(_0x8c16('0x18'))['db'];function respondWithStatusCode(_0x5d3595,_0x36732f){_0x36732f=_0x36732f||0xcc;return function(_0x3343d7){if(_0x3343d7){return _0x5d3595[_0x8c16('0x19')](_0x36732f);}return _0x5d3595[_0x8c16('0x1a')](_0x36732f)[_0x8c16('0x1b')]();};}function respondWithResult(_0x41d79a,_0x16c993){_0x16c993=_0x16c993||0xc8;return function(_0x12952f){if(_0x12952f){return _0x41d79a[_0x8c16('0x1a')](_0x16c993)[_0x8c16('0x1c')](_0x12952f);}};}function respondWithFilteredResult(_0x1528a1,_0x391c0f){return function(_0x487f78){if(_0x487f78){var _0xef7f64=typeof _0x391c0f[_0x8c16('0x1d')]==='undefined'&&typeof _0x391c0f['limit']===_0x8c16('0x1e');var _0x1dad91=_0x487f78[_0x8c16('0x1f')];var _0x266ed9=_0xef7f64?0x0:_0x391c0f[_0x8c16('0x1d')];var _0x3a92d2=_0xef7f64?_0x487f78[_0x8c16('0x1f')]:_0x391c0f[_0x8c16('0x1d')]+_0x391c0f['limit'];var _0x4a7643;if(_0x3a92d2>=_0x1dad91){_0x3a92d2=_0x1dad91;_0x4a7643=0xc8;}else{_0x4a7643=0xce;}_0x1528a1[_0x8c16('0x1a')](_0x4a7643);return _0x1528a1['set'](_0x8c16('0x20'),_0x266ed9+'-'+_0x3a92d2+'/'+_0x1dad91)[_0x8c16('0x1c')](_0x487f78);}return null;};}function patchUpdates(_0x2850ce){return function(_0x9442a2){try{jsonpatch[_0x8c16('0x21')](_0x9442a2,_0x2850ce,!![]);}catch(_0x54e535){return BPromise[_0x8c16('0x22')](_0x54e535);}return _0x9442a2[_0x8c16('0x23')]();};}function saveUpdates(_0x161c9d,_0x4a30c9){return function(_0x4deb8c){if(_0x4deb8c){return _0x4deb8c[_0x8c16('0x24')](_0x161c9d)[_0x8c16('0x25')](function(_0x47d3c5){return _0x47d3c5;});}return null;};}function removeEntity(_0x3cf889,_0x3ac5d1){return function(_0x26baca){if(_0x26baca){return _0x26baca['destroy']()[_0x8c16('0x25')](function(){var _0x3fc397=_0x26baca[_0x8c16('0x26')]({'plain':!![]});var _0x88ae1c=_0x8c16('0x27');return db[_0x8c16('0x28')][_0x8c16('0x29')]({'where':{'type':_0x88ae1c,'resourceId':_0x3fc397['id']}})[_0x8c16('0x25')](function(){return _0x26baca;});})[_0x8c16('0x25')](function(){_0x3cf889[_0x8c16('0x1a')](0xcc)[_0x8c16('0x1b')]();});}};}function handleEntityNotFound(_0x2ab4f8,_0x57d87a){return function(_0x486b4e){if(!_0x486b4e){_0x2ab4f8[_0x8c16('0x19')](0x194);}return _0x486b4e;};}function handleError(_0x26e457,_0x275b78){_0x275b78=_0x275b78||0x1f4;return function(_0x345f60){logger[_0x8c16('0x2a')](_0x345f60[_0x8c16('0x2b')]);if(_0x345f60[_0x8c16('0x2c')]){delete _0x345f60[_0x8c16('0x2c')];}_0x26e457[_0x8c16('0x1a')](_0x275b78)[_0x8c16('0x2d')](_0x345f60);};}exports['index']=function(_0x16ad76,_0x299e6d){var _0x1c14e6={},_0x2a20ed={},_0x36ee22={'count':0x0,'rows':[]};var _0x5e329c=_[_0x8c16('0x2e')](db['Template'][_0x8c16('0x2f')],function(_0x1d7cb3){return{'name':_0x1d7cb3[_0x8c16('0x30')],'type':_0x1d7cb3[_0x8c16('0x31')][_0x8c16('0x32')]};});_0x2a20ed[_0x8c16('0x33')]=_[_0x8c16('0x2e')](_0x5e329c,_0x8c16('0x2c'));_0x2a20ed[_0x8c16('0x34')]=_[_0x8c16('0x35')](_0x16ad76[_0x8c16('0x34')]);_0x2a20ed[_0x8c16('0x36')]=_[_0x8c16('0x37')](_0x2a20ed[_0x8c16('0x33')],_0x2a20ed[_0x8c16('0x34')]);_0x1c14e6['attributes']=_['intersection'](_0x2a20ed['model'],qs[_0x8c16('0x38')](_0x16ad76[_0x8c16('0x34')]['fields']));_0x1c14e6['attributes']=_0x1c14e6[_0x8c16('0x39')][_0x8c16('0x3a')]?_0x1c14e6[_0x8c16('0x39')]:_0x2a20ed[_0x8c16('0x33')];if(!_0x16ad76[_0x8c16('0x34')][_0x8c16('0x3b')](_0x8c16('0x3c'))){_0x1c14e6[_0x8c16('0x3d')]=qs[_0x8c16('0x3d')](_0x16ad76[_0x8c16('0x34')][_0x8c16('0x3d')]);_0x1c14e6['offset']=qs['offset'](_0x16ad76['query'][_0x8c16('0x1d')]);}_0x1c14e6[_0x8c16('0x3e')]=qs[_0x8c16('0x3f')](_0x16ad76[_0x8c16('0x34')]['sort']);_0x1c14e6[_0x8c16('0x40')]=qs[_0x8c16('0x36')](_[_0x8c16('0x41')](_0x16ad76['query'],_0x2a20ed[_0x8c16('0x36')]),_0x5e329c);if(_0x16ad76[_0x8c16('0x34')][_0x8c16('0x42')]){_0x1c14e6['where']=_['merge'](_0x1c14e6[_0x8c16('0x40')],{'$or':_['map'](_0x5e329c,function(_0x2301e3){if(_0x2301e3[_0x8c16('0x31')]!=='VIRTUAL'){var _0x4a5111={};_0x4a5111[_0x2301e3[_0x8c16('0x2c')]]={'$like':'%'+_0x16ad76[_0x8c16('0x34')]['filter']+'%'};return _0x4a5111;}})});}_0x1c14e6=_[_0x8c16('0x43')]({},_0x1c14e6,_0x16ad76['options']);var _0x5f0982={'where':_0x1c14e6[_0x8c16('0x40')]};return db['Template'][_0x8c16('0x1f')](_0x5f0982)[_0x8c16('0x25')](function(_0x1ba88f){_0x36ee22[_0x8c16('0x1f')]=_0x1ba88f;if(_0x16ad76['query']['includeAll']){_0x1c14e6['include']=[{'all':!![]}];}return db[_0x8c16('0x44')][_0x8c16('0x45')](_0x1c14e6);})[_0x8c16('0x25')](function(_0x4cb3be){_0x36ee22[_0x8c16('0x46')]=_0x4cb3be;return _0x36ee22;})[_0x8c16('0x25')](respondWithFilteredResult(_0x299e6d,_0x1c14e6))['catch'](handleError(_0x299e6d,null));};exports[_0x8c16('0x47')]=function(_0x446594,_0x4636b3){var _0x41ec1b={'raw':!![],'where':{'id':_0x446594[_0x8c16('0x48')]['id']}},_0x54aac2={};_0x54aac2[_0x8c16('0x33')]=_[_0x8c16('0x35')](db[_0x8c16('0x44')][_0x8c16('0x2f')]);_0x54aac2[_0x8c16('0x34')]=_[_0x8c16('0x35')](_0x446594[_0x8c16('0x34')]);_0x54aac2[_0x8c16('0x36')]=_[_0x8c16('0x37')](_0x54aac2[_0x8c16('0x33')],_0x54aac2[_0x8c16('0x34')]);_0x41ec1b[_0x8c16('0x39')]=_[_0x8c16('0x37')](_0x54aac2[_0x8c16('0x33')],qs[_0x8c16('0x38')](_0x446594[_0x8c16('0x34')][_0x8c16('0x38')]));_0x41ec1b[_0x8c16('0x39')]=_0x41ec1b[_0x8c16('0x39')][_0x8c16('0x3a')]?_0x41ec1b['attributes']:_0x54aac2[_0x8c16('0x33')];if(_0x446594[_0x8c16('0x34')]['includeAll']){_0x41ec1b[_0x8c16('0x49')]=[{'all':!![]}];}_0x41ec1b=_[_0x8c16('0x43')]({},_0x41ec1b,_0x446594[_0x8c16('0x4a')]);return db[_0x8c16('0x44')]['find'](_0x41ec1b)['then'](handleEntityNotFound(_0x4636b3,null))[_0x8c16('0x25')](respondWithResult(_0x4636b3,null))['catch'](handleError(_0x4636b3,null));};exports[_0x8c16('0x4b')]=function(_0x277ead,_0x301246){return db[_0x8c16('0x44')][_0x8c16('0x4b')](_0x277ead[_0x8c16('0x4c')],{})[_0x8c16('0x25')](function(_0x55d412){var _0x47eda0=_0x277ead[_0x8c16('0x4d')]['get']({'plain':!![]});if(!_0x47eda0)throw new Error(_0x8c16('0x4e'));if(_0x47eda0[_0x8c16('0x4f')]===_0x8c16('0x4d')){var _0x1763d3=_0x55d412[_0x8c16('0x26')]({'plain':!![]});var _0x62c62d=_0x8c16('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x62c62d,'userProfileId':_0x47eda0[_0x8c16('0x50')]},'raw':!![]})[_0x8c16('0x25')](function(_0x50ae31){if(_0x50ae31&&_0x50ae31[_0x8c16('0x51')]===0x0){return db[_0x8c16('0x28')][_0x8c16('0x4b')]({'name':_0x1763d3[_0x8c16('0x2c')],'resourceId':_0x1763d3['id'],'type':_0x50ae31[_0x8c16('0x2c')],'sectionId':_0x50ae31['id']},{})[_0x8c16('0x25')](function(){return _0x55d412;});}else{return _0x55d412;}})[_0x8c16('0x52')](function(_0x2cf3c3){logger[_0x8c16('0x2a')](_0x8c16('0x53'),_0x2cf3c3);throw _0x2cf3c3;});}return _0x55d412;})[_0x8c16('0x25')](respondWithResult(_0x301246,0xc9))[_0x8c16('0x52')](handleError(_0x301246,null));};exports['update']=function(_0x13ed1c,_0x3a112f){if(_0x13ed1c[_0x8c16('0x4c')]['id']){delete _0x13ed1c[_0x8c16('0x4c')]['id'];}return db[_0x8c16('0x44')][_0x8c16('0x54')]({'where':{'id':_0x13ed1c[_0x8c16('0x48')]['id']}})[_0x8c16('0x25')](handleEntityNotFound(_0x3a112f,null))[_0x8c16('0x25')](saveUpdates(_0x13ed1c[_0x8c16('0x4c')],null))[_0x8c16('0x25')](respondWithResult(_0x3a112f,null))[_0x8c16('0x52')](handleError(_0x3a112f,null));};exports[_0x8c16('0x29')]=function(_0x1a9a8f,_0xbf76ba){return db['Template'][_0x8c16('0x54')]({'where':{'id':_0x1a9a8f[_0x8c16('0x48')]['id']}})['then'](handleEntityNotFound(_0xbf76ba,null))[_0x8c16('0x25')](removeEntity(_0xbf76ba,null))[_0x8c16('0x52')](handleError(_0xbf76ba,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 425fa86..423dc68 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 _0xab83=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','util','../../config/logger','moment'];(function(_0x4abeb9,_0x1da57a){var _0x14aee5=function(_0x508941){while(--_0x508941){_0x4abeb9['push'](_0x4abeb9['shift']());}};_0x14aee5(++_0x1da57a);}(_0xab83,0x171));var _0x3ab8=function(_0x4fad63,_0x2852c4){_0x4fad63=_0x4fad63-0x0;var _0x2e17a8=_0xab83[_0x4fad63];return _0x2e17a8;};'use strict';var _=require('lodash');var util=require(_0x3ab8('0x0'));var logger=require(_0x3ab8('0x1'))('api');var moment=require(_0x3ab8('0x2'));var BPromise=require(_0x3ab8('0x3'));var rp=require(_0x3ab8('0x4'));var fs=require('fs');var path=require(_0x3ab8('0x5'));var rimraf=require(_0x3ab8('0x6'));var config=require(_0x3ab8('0x7'));var attributes=require(_0x3ab8('0x8'));module[_0x3ab8('0x9')]=function(_0x532588,_0x128023){return _0x532588[_0x3ab8('0xa')]('Template',attributes,{'tableName':_0x3ab8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe53a=['api','moment','bluebird','path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x225407,_0x3c5d12){var _0x8124ec=function(_0x4ee7d9){while(--_0x4ee7d9){_0x225407['push'](_0x225407['shift']());}};_0x8124ec(++_0x3c5d12);}(_0xe53a,0x6a));var _0xae53=function(_0x3756a9,_0x38fdf4){_0x3756a9=_0x3756a9-0x0;var _0x44c785=_0xe53a[_0x3756a9];return _0x44c785;};'use strict';var _=require(_0xae53('0x0'));var util=require(_0xae53('0x1'));var logger=require('../../config/logger')(_0xae53('0x2'));var moment=require(_0xae53('0x3'));var BPromise=require(_0xae53('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae53('0x5'));var rimraf=require(_0xae53('0x6'));var config=require('../../config/environment');var attributes=require(_0xae53('0x7'));module[_0xae53('0x8')]=function(_0x10dcab,_0x53233a){return _0x10dcab[_0xae53('0x9')](_0xae53('0xa'),attributes,{'tableName':_0xae53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 6f93ad2..8db1f0f 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 _0x8719=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','map','include','model','GetTemplate'];(function(_0x3e20e8,_0x58a046){var _0x58ede5=function(_0x1b5d65){while(--_0x1b5d65){_0x3e20e8['push'](_0x3e20e8['shift']());}};_0x58ede5(++_0x58a046);}(_0x8719,0xd9));var _0x9871=function(_0xa0d2dd,_0x440da9){_0xa0d2dd=_0xa0d2dd-0x0;var _0x52b707=_0x8719[_0xa0d2dd];return _0x52b707;};'use strict';var _=require(_0x9871('0x0'));var util=require(_0x9871('0x1'));var moment=require('moment');var BPromise=require(_0x9871('0x2'));var rs=require(_0x9871('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9871('0x4'))['db'];var utils=require(_0x9871('0x5'));var logger=require(_0x9871('0x6'))(_0x9871('0x7'));var config=require('../../config/environment');var jayson=require(_0x9871('0x8'));var client=jayson['client'][_0x9871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25ee14,_0x1d0da4,_0x30ef71){return new BPromise(function(_0x18231b,_0x1e053d){return client['request'](_0x25ee14,_0x30ef71)[_0x9871('0xa')](function(_0x18141c){logger[_0x9871('0xb')](_0x9871('0xc'),_0x1d0da4,_0x9871('0xd'));logger[_0x9871('0xe')](_0x9871('0xf'),_0x1d0da4,'request\x20sent',JSON[_0x9871('0x10')](_0x18141c));if(_0x18141c[_0x9871('0x11')]){if(_0x18141c[_0x9871('0x11')][_0x9871('0x12')]===0x1f4){logger['error'](_0x9871('0xc'),_0x1d0da4,_0x18141c[_0x9871('0x11')][_0x9871('0x13')]);return _0x1e053d(_0x18141c[_0x9871('0x11')][_0x9871('0x13')]);}logger['error'](_0x9871('0xc'),_0x1d0da4,_0x18141c[_0x9871('0x11')]['message']);return _0x18231b(_0x18141c['error'][_0x9871('0x13')]);}else{logger[_0x9871('0xb')](_0x9871('0xc'),_0x1d0da4,'request\x20sent');_0x18231b(_0x18141c[_0x9871('0x14')][_0x9871('0x13')]);}})[_0x9871('0x15')](function(_0x11a22c){logger[_0x9871('0x11')](_0x9871('0xc'),_0x1d0da4,_0x11a22c);_0x1e053d(_0x11a22c);});});}exports['GetTemplate']=function(_0x4f38dd){var _0x5ac4cc=this;return new Promise(function(_0x22105d,_0x53e30b){return db['Template'][_0x9871('0x16')]({'raw':_0x4f38dd['options']?_0x4f38dd[_0x9871('0x17')][_0x9871('0x18')]===undefined?!![]:![]:!![],'where':_0x4f38dd[_0x9871('0x17')]?_0x4f38dd['options'][_0x9871('0x19')]||null:null,'attributes':_0x4f38dd[_0x9871('0x17')]?_0x4f38dd[_0x9871('0x17')][_0x9871('0x1a')]||null:null,'limit':_0x4f38dd[_0x9871('0x17')]?_0x4f38dd[_0x9871('0x17')]['limit']||null:null,'include':_0x4f38dd[_0x9871('0x17')]?_0x4f38dd[_0x9871('0x17')]['include']?_[_0x9871('0x1b')](_0x4f38dd[_0x9871('0x17')][_0x9871('0x1c')],function(_0x11c816){return{'model':db[_0x11c816[_0x9871('0x1d')]],'as':_0x11c816['as'],'attributes':_0x11c816['attributes'],'include':_0x11c816[_0x9871('0x1c')]?_[_0x9871('0x1b')](_0x11c816[_0x9871('0x1c')],function(_0x36217f){return{'model':db[_0x36217f[_0x9871('0x1d')]],'as':_0x36217f['as'],'attributes':_0x36217f[_0x9871('0x1a')],'include':_0x36217f[_0x9871('0x1c')]?_[_0x9871('0x1b')](_0x36217f[_0x9871('0x1c')],function(_0x339743){return{'model':db[_0x339743[_0x9871('0x1d')]],'as':_0x339743['as'],'attributes':_0x339743[_0x9871('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9871('0xa')](function(_0x12cd82){logger[_0x9871('0xb')](_0x9871('0x1e'),_0x4f38dd);logger[_0x9871('0xe')]('GetTemplate',_0x4f38dd,JSON[_0x9871('0x10')](_0x12cd82));_0x22105d(_0x12cd82);})[_0x9871('0x15')](function(_0x42e0bb){logger[_0x9871('0x11')](_0x9871('0x1e'),_0x42e0bb[_0x9871('0x13')],_0x4f38dd);_0x53e30b(_0x5ac4cc[_0x9871('0x11')](0x1f4,_0x42e0bb[_0x9871('0x13')]));});});}; \ No newline at end of file +var _0x7bc9=['request\x20sent','debug','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s'];(function(_0x7abcd6,_0x36548c){var _0x329aea=function(_0x55b0a3){while(--_0x55b0a3){_0x7abcd6['push'](_0x7abcd6['shift']());}};_0x329aea(++_0x36548c);}(_0x7bc9,0x128));var _0x97bc=function(_0x3368bb,_0x36e4e8){_0x3368bb=_0x3368bb-0x0;var _0x42cb82=_0x7bc9[_0x3368bb];return _0x42cb82;};'use strict';var _=require('lodash');var util=require(_0x97bc('0x0'));var moment=require('moment');var BPromise=require(_0x97bc('0x1'));var rs=require(_0x97bc('0x2'));var fs=require('fs');var Redis=require(_0x97bc('0x3'));var db=require(_0x97bc('0x4'))['db'];var utils=require(_0x97bc('0x5'));var logger=require('../../config/logger')(_0x97bc('0x6'));var config=require(_0x97bc('0x7'));var jayson=require(_0x97bc('0x8'));var client=jayson[_0x97bc('0x9')][_0x97bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18be89,_0x437f44,_0x4799e6){return new BPromise(function(_0x26f851,_0x1f9782){return client['request'](_0x18be89,_0x4799e6)[_0x97bc('0xb')](function(_0x3de1a6){logger[_0x97bc('0xc')](_0x97bc('0xd'),_0x437f44,_0x97bc('0xe'));logger[_0x97bc('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x437f44,_0x97bc('0xe'),JSON[_0x97bc('0x10')](_0x3de1a6));if(_0x3de1a6[_0x97bc('0x11')]){if(_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x12')]===0x1f4){logger[_0x97bc('0x11')](_0x97bc('0xd'),_0x437f44,_0x3de1a6['error'][_0x97bc('0x13')]);return _0x1f9782(_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x13')]);}logger[_0x97bc('0x11')]('Template,\x20%s,\x20%s',_0x437f44,_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x13')]);return _0x26f851(_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x13')]);}else{logger[_0x97bc('0xc')](_0x97bc('0xd'),_0x437f44,_0x97bc('0xe'));_0x26f851(_0x3de1a6['result'][_0x97bc('0x13')]);}})[_0x97bc('0x14')](function(_0x42bffd){logger[_0x97bc('0x11')](_0x97bc('0xd'),_0x437f44,_0x42bffd);_0x1f9782(_0x42bffd);});});}exports[_0x97bc('0x15')]=function(_0x33a2fe){var _0x48a9d2=this;return new Promise(function(_0x2b1de1,_0x174612){return db[_0x97bc('0x16')][_0x97bc('0x17')]({'raw':_0x33a2fe['options']?_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x19')]===undefined?!![]:![]:!![],'where':_0x33a2fe['options']?_0x33a2fe[_0x97bc('0x18')]['where']||null:null,'attributes':_0x33a2fe[_0x97bc('0x18')]?_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x1a')]||null:null,'limit':_0x33a2fe[_0x97bc('0x18')]?_0x33a2fe['options'][_0x97bc('0x1b')]||null:null,'include':_0x33a2fe[_0x97bc('0x18')]?_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x1c')]?_[_0x97bc('0x1d')](_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x1c')],function(_0x20aa32){return{'model':db[_0x20aa32['model']],'as':_0x20aa32['as'],'attributes':_0x20aa32['attributes'],'include':_0x20aa32['include']?_[_0x97bc('0x1d')](_0x20aa32[_0x97bc('0x1c')],function(_0x49e11c){return{'model':db[_0x49e11c[_0x97bc('0x1e')]],'as':_0x49e11c['as'],'attributes':_0x49e11c[_0x97bc('0x1a')],'include':_0x49e11c[_0x97bc('0x1c')]?_[_0x97bc('0x1d')](_0x49e11c[_0x97bc('0x1c')],function(_0x35cae7){return{'model':db[_0x35cae7[_0x97bc('0x1e')]],'as':_0x35cae7['as'],'attributes':_0x35cae7[_0x97bc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97bc('0xb')](function(_0x5279b4){logger[_0x97bc('0xc')](_0x97bc('0x15'),_0x33a2fe);logger[_0x97bc('0xf')](_0x97bc('0x15'),_0x33a2fe,JSON[_0x97bc('0x10')](_0x5279b4));_0x2b1de1(_0x5279b4);})['catch'](function(_0x5a5e2c){logger[_0x97bc('0x11')]('GetTemplate',_0x5a5e2c[_0x97bc('0x13')],_0x33a2fe);_0x174612(_0x48a9d2[_0x97bc('0x11')](0x1f4,_0x5a5e2c['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index d34f3c0..fda4d6b 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 _0x30d3=['isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get'];(function(_0x4715b7,_0x4dedec){var _0x11d72a=function(_0x393699){while(--_0x393699){_0x4715b7['push'](_0x4715b7['shift']());}};_0x11d72a(++_0x4dedec);}(_0x30d3,0x9f));var _0x330d=function(_0x18f25c,_0x2280d4){_0x18f25c=_0x18f25c-0x0;var _0x2083c7=_0x30d3[_0x18f25c];return _0x2083c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x330d('0x0'));var timeout=require(_0x330d('0x1'));var express=require(_0x330d('0x2'));var router=express[_0x330d('0x3')]();var fs_extra=require(_0x330d('0x4'));var auth=require(_0x330d('0x5'));var interaction=require(_0x330d('0x6'));var config=require('../../config/environment');var controller=require(_0x330d('0x7'));router[_0x330d('0x8')]('/',auth[_0x330d('0x9')](),controller[_0x330d('0xa')]);router['get']('/:id',auth[_0x330d('0x9')](),controller[_0x330d('0xb')]);router[_0x330d('0x8')](_0x330d('0xc'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x330d('0x8')](_0x330d('0xd'),auth[_0x330d('0x9')](),controller[_0x330d('0xe')]);router[_0x330d('0x8')](_0x330d('0xf'),auth[_0x330d('0x9')](),controller['getActions']);router[_0x330d('0x10')]('/',auth[_0x330d('0x9')](),controller[_0x330d('0x11')]);router['post'](_0x330d('0xc'),auth[_0x330d('0x9')](),controller[_0x330d('0x12')]);router[_0x330d('0x10')]('/:id/any_conditions',auth[_0x330d('0x9')](),controller[_0x330d('0x13')]);router['post'](_0x330d('0xf'),auth['isAuthenticated'](),controller[_0x330d('0x14')]);router[_0x330d('0x15')](_0x330d('0x16'),auth['isAuthenticated'](),controller['update']);router[_0x330d('0x17')](_0x330d('0x16'),auth[_0x330d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5e93=['getAllConditions','getAnyConditions','getActions','post','addAnyCondition','/:id/actions','addAction','put','update','delete','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions'];(function(_0x3676a6,_0x3be9de){var _0x4f5f22=function(_0x12f0d1){while(--_0x12f0d1){_0x3676a6['push'](_0x3676a6['shift']());}};_0x4f5f22(++_0x3be9de);}(_0x5e93,0x115));var _0x35e9=function(_0x5df11b,_0x577fbb){_0x5df11b=_0x5df11b-0x0;var _0x583b35=_0x5e93[_0x5df11b];return _0x583b35;};'use strict';var multer=require(_0x35e9('0x0'));var util=require('util');var path=require(_0x35e9('0x1'));var timeout=require('connect-timeout');var express=require(_0x35e9('0x2'));var router=express[_0x35e9('0x3')]();var fs_extra=require(_0x35e9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x35e9('0x5'));var config=require('../../config/environment');var controller=require(_0x35e9('0x6'));router[_0x35e9('0x7')]('/',auth[_0x35e9('0x8')](),controller[_0x35e9('0x9')]);router[_0x35e9('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x35e9('0x7')](_0x35e9('0xa'),auth[_0x35e9('0x8')](),controller[_0x35e9('0xb')]);router[_0x35e9('0x7')]('/:id/any_conditions',auth[_0x35e9('0x8')](),controller[_0x35e9('0xc')]);router['get']('/:id/actions',auth[_0x35e9('0x8')](),controller[_0x35e9('0xd')]);router[_0x35e9('0xe')]('/',auth[_0x35e9('0x8')](),controller['create']);router[_0x35e9('0xe')](_0x35e9('0xa'),auth[_0x35e9('0x8')](),controller['addAllCondition']);router[_0x35e9('0xe')]('/:id/any_conditions',auth[_0x35e9('0x8')](),controller[_0x35e9('0xf')]);router[_0x35e9('0xe')](_0x35e9('0x10'),auth[_0x35e9('0x8')](),controller[_0x35e9('0x11')]);router[_0x35e9('0x12')]('/:id',auth[_0x35e9('0x8')](),controller[_0x35e9('0x13')]);router[_0x35e9('0x14')](_0x35e9('0x15'),auth[_0x35e9('0x8')](),controller[_0x35e9('0x16')]);module[_0x35e9('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 7fc83c8..1c7eb32 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 _0x71bd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x59547f,_0x1fe1da){var _0x2448d4=function(_0x20ac5d){while(--_0x20ac5d){_0x59547f['push'](_0x59547f['shift']());}};_0x2448d4(++_0x1fe1da);}(_0x71bd,0xd9));var _0xd71b=function(_0x1cf3a7,_0x31f53b){_0x1cf3a7=_0x1cf3a7-0x0;var _0x406896=_0x71bd[_0x1cf3a7];return _0x406896;};'use strict';var Sequelize=require(_0xd71b('0x0'));module[_0xd71b('0x1')]={'name':{'type':Sequelize[_0xd71b('0x2')]},'channel':{'type':Sequelize[_0xd71b('0x2')]},'description':{'type':Sequelize[_0xd71b('0x2')]},'status':{'type':Sequelize[_0xd71b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xac26=['STRING'];(function(_0x14e9f0,_0x287f90){var _0xa63f7e=function(_0x4829d6){while(--_0x4829d6){_0x14e9f0['push'](_0x14e9f0['shift']());}};_0xa63f7e(++_0x287f90);}(_0xac26,0xee));var _0x6ac2=function(_0xadde9b,_0x1744c8){_0xadde9b=_0xadde9b-0x0;var _0xccd241=_0xac26[_0xadde9b];return _0xccd241;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6ac2('0x0')]},'channel':{'type':Sequelize[_0x6ac2('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7b54548..8055bbb 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 _0xbdd9=['eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','Trigger','findAll','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','UserProfileResource','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions'];(function(_0x36c0d1,_0x1d9948){var _0x59c859=function(_0x5d4c69){while(--_0x5d4c69){_0x36c0d1['push'](_0x36c0d1['shift']());}};_0x59c859(++_0x1d9948);}(_0xbdd9,0x1e0));var _0x9bdd=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xbdd9[_0x16ea87];return _0x6e7b1c;};'use strict';var emlformat=require(_0x9bdd('0x0'));var rimraf=require(_0x9bdd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bdd('0x2'));var rp=require(_0x9bdd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bdd('0x4'));var path=require(_0x9bdd('0x5'));var sox=require(_0x9bdd('0x6'));var csv=require(_0x9bdd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bdd('0x8'));var _=require('lodash');var squel=require(_0x9bdd('0x9'));var crypto=require(_0x9bdd('0xa'));var jsforce=require(_0x9bdd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9bdd('0x7'));var querystring=require(_0x9bdd('0xc'));var Papa=require(_0x9bdd('0xd'));var Redis=require(_0x9bdd('0xe'));var authService=require(_0x9bdd('0xf'));var qs=require(_0x9bdd('0x10'));var as=require(_0x9bdd('0x11'));var hardwareService=require(_0x9bdd('0x12'));var logger=require(_0x9bdd('0x13'))(_0x9bdd('0x14'));var utils=require(_0x9bdd('0x15'));var config=require(_0x9bdd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9bdd('0x17'))['db'];function respondWithStatusCode(_0x49374a,_0x5e9078){_0x5e9078=_0x5e9078||0xcc;return function(_0x8300b){if(_0x8300b){return _0x49374a[_0x9bdd('0x18')](_0x5e9078);}return _0x49374a[_0x9bdd('0x19')](_0x5e9078)[_0x9bdd('0x1a')]();};}function respondWithResult(_0x4b64f1,_0x1d9ba1){_0x1d9ba1=_0x1d9ba1||0xc8;return function(_0x69dc21){if(_0x69dc21){return _0x4b64f1[_0x9bdd('0x19')](_0x1d9ba1)[_0x9bdd('0x1b')](_0x69dc21);}};}function respondWithFilteredResult(_0x5cacd2,_0x301b13){return function(_0x4b0adc){if(_0x4b0adc){var _0x18c77d=typeof _0x301b13[_0x9bdd('0x1c')]===_0x9bdd('0x1d')&&typeof _0x301b13['limit']==='undefined';var _0x29b52f=_0x4b0adc[_0x9bdd('0x1e')];var _0x5bbe52=_0x18c77d?0x0:_0x301b13[_0x9bdd('0x1c')];var _0x25bce1=_0x18c77d?_0x4b0adc[_0x9bdd('0x1e')]:_0x301b13[_0x9bdd('0x1c')]+_0x301b13[_0x9bdd('0x1f')];var _0x2fc2cb;if(_0x25bce1>=_0x29b52f){_0x25bce1=_0x29b52f;_0x2fc2cb=0xc8;}else{_0x2fc2cb=0xce;}_0x5cacd2[_0x9bdd('0x19')](_0x2fc2cb);return _0x5cacd2['set'](_0x9bdd('0x20'),_0x5bbe52+'-'+_0x25bce1+'/'+_0x29b52f)['json'](_0x4b0adc);}return null;};}function patchUpdates(_0x1dcf74){return function(_0x462d10){try{jsonpatch[_0x9bdd('0x21')](_0x462d10,_0x1dcf74,!![]);}catch(_0x1b1bbc){return BPromise[_0x9bdd('0x22')](_0x1b1bbc);}return _0x462d10[_0x9bdd('0x23')]();};}function saveUpdates(_0x2dc779,_0x3425ab){return function(_0x22e0af){if(_0x22e0af){return _0x22e0af[_0x9bdd('0x24')](_0x2dc779)[_0x9bdd('0x25')](function(_0x44a24d){return _0x44a24d;});}return null;};}function removeEntity(_0x3d8f6b,_0x143943){return function(_0x141aae){if(_0x141aae){return _0x141aae[_0x9bdd('0x26')]()['then'](function(){var _0x285ae6=_0x141aae[_0x9bdd('0x27')]({'plain':!![]});var _0xc3a475='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0xc3a475,'resourceId':_0x285ae6['id']}})['then'](function(){return _0x141aae;});})[_0x9bdd('0x25')](function(){_0x3d8f6b[_0x9bdd('0x19')](0xcc)[_0x9bdd('0x1a')]();});}};}function handleEntityNotFound(_0x2a73b3,_0x22b569){return function(_0x3b799f){if(!_0x3b799f){_0x2a73b3[_0x9bdd('0x18')](0x194);}return _0x3b799f;};}function handleError(_0x29b376,_0x52601f){_0x52601f=_0x52601f||0x1f4;return function(_0x21b2ca){logger[_0x9bdd('0x28')](_0x21b2ca[_0x9bdd('0x29')]);if(_0x21b2ca['name']){delete _0x21b2ca[_0x9bdd('0x2a')];}_0x29b376[_0x9bdd('0x19')](_0x52601f)[_0x9bdd('0x2b')](_0x21b2ca);};}exports[_0x9bdd('0x2c')]=function(_0x5358cf,_0x35979e){var _0x5a3af5={},_0x275abd={},_0x5cd5ca={'count':0x0,'rows':[]};var _0x238f61=_[_0x9bdd('0x2d')](db['Trigger'][_0x9bdd('0x2e')],function(_0x3ed9a7){return{'name':_0x3ed9a7['fieldName'],'type':_0x3ed9a7[_0x9bdd('0x2f')][_0x9bdd('0x30')]};});_0x275abd[_0x9bdd('0x31')]=_[_0x9bdd('0x2d')](_0x238f61,'name');_0x275abd[_0x9bdd('0x32')]=_[_0x9bdd('0x33')](_0x5358cf[_0x9bdd('0x32')]);_0x275abd[_0x9bdd('0x34')]=_['intersection'](_0x275abd[_0x9bdd('0x31')],_0x275abd[_0x9bdd('0x32')]);_0x5a3af5[_0x9bdd('0x35')]=_[_0x9bdd('0x36')](_0x275abd[_0x9bdd('0x31')],qs[_0x9bdd('0x37')](_0x5358cf['query'][_0x9bdd('0x37')]));_0x5a3af5[_0x9bdd('0x35')]=_0x5a3af5[_0x9bdd('0x35')]['length']?_0x5a3af5[_0x9bdd('0x35')]:_0x275abd[_0x9bdd('0x31')];if(!_0x5358cf[_0x9bdd('0x32')]['hasOwnProperty'](_0x9bdd('0x38'))){_0x5a3af5[_0x9bdd('0x1f')]=qs['limit'](_0x5358cf[_0x9bdd('0x32')][_0x9bdd('0x1f')]);_0x5a3af5[_0x9bdd('0x1c')]=qs[_0x9bdd('0x1c')](_0x5358cf[_0x9bdd('0x32')][_0x9bdd('0x1c')]);}_0x5a3af5[_0x9bdd('0x39')]=qs[_0x9bdd('0x3a')](_0x5358cf[_0x9bdd('0x32')][_0x9bdd('0x3a')]);_0x5a3af5['where']=qs[_0x9bdd('0x34')](_[_0x9bdd('0x3b')](_0x5358cf[_0x9bdd('0x32')],_0x275abd[_0x9bdd('0x34')]),_0x238f61);if(_0x5358cf[_0x9bdd('0x32')][_0x9bdd('0x3c')]){_0x5a3af5[_0x9bdd('0x3d')]=_[_0x9bdd('0x3e')](_0x5a3af5[_0x9bdd('0x3d')],{'$or':_['map'](_0x238f61,function(_0x151439){if(_0x151439[_0x9bdd('0x2f')]!==_0x9bdd('0x3f')){var _0x2abcb9={};_0x2abcb9[_0x151439[_0x9bdd('0x2a')]]={'$like':'%'+_0x5358cf[_0x9bdd('0x32')][_0x9bdd('0x3c')]+'%'};return _0x2abcb9;}})});}_0x5a3af5=_['merge']({},_0x5a3af5,_0x5358cf['options']);var _0x406e7e={'where':_0x5a3af5[_0x9bdd('0x3d')]};return db['Trigger']['count'](_0x406e7e)['then'](function(_0xb576d5){_0x5cd5ca[_0x9bdd('0x1e')]=_0xb576d5;if(_0x5358cf[_0x9bdd('0x32')][_0x9bdd('0x40')]){_0x5a3af5[_0x9bdd('0x41')]=[{'all':!![]}];}return db[_0x9bdd('0x42')][_0x9bdd('0x43')](_0x5a3af5);})[_0x9bdd('0x25')](function(_0x4be420){_0x5cd5ca[_0x9bdd('0x44')]=_0x4be420;return _0x5cd5ca;})[_0x9bdd('0x25')](respondWithFilteredResult(_0x35979e,_0x5a3af5))['catch'](handleError(_0x35979e,null));};exports[_0x9bdd('0x45')]=function(_0x244984,_0x4a30f0){var _0x547ec4={'raw':![],'where':{'id':_0x244984[_0x9bdd('0x46')]['id']}},_0x4c0ecd={};_0x4c0ecd[_0x9bdd('0x31')]=_[_0x9bdd('0x33')](db[_0x9bdd('0x42')]['rawAttributes']);_0x4c0ecd[_0x9bdd('0x32')]=_[_0x9bdd('0x33')](_0x244984[_0x9bdd('0x32')]);_0x4c0ecd[_0x9bdd('0x34')]=_['intersection'](_0x4c0ecd[_0x9bdd('0x31')],_0x4c0ecd[_0x9bdd('0x32')]);_0x547ec4['attributes']=_['intersection'](_0x4c0ecd[_0x9bdd('0x31')],qs[_0x9bdd('0x37')](_0x244984[_0x9bdd('0x32')][_0x9bdd('0x37')]));_0x547ec4[_0x9bdd('0x35')]=_0x547ec4['attributes']['length']?_0x547ec4[_0x9bdd('0x35')]:_0x4c0ecd[_0x9bdd('0x31')];if(_0x244984[_0x9bdd('0x32')][_0x9bdd('0x40')]){_0x547ec4[_0x9bdd('0x41')]=[{'all':!![]}];}_0x547ec4=_[_0x9bdd('0x3e')]({},_0x547ec4,_0x244984[_0x9bdd('0x47')]);return db[_0x9bdd('0x42')][_0x9bdd('0x48')](_0x547ec4)['then'](handleEntityNotFound(_0x4a30f0,null))['then'](respondWithResult(_0x4a30f0,null))[_0x9bdd('0x49')](handleError(_0x4a30f0,null));};exports[_0x9bdd('0x4a')]=function(_0x3af4c6,_0x5afebf){return db[_0x9bdd('0x42')][_0x9bdd('0x4a')](_0x3af4c6[_0x9bdd('0x4b')],{})[_0x9bdd('0x25')](function(_0x55c822){var _0x30dd3f=_0x3af4c6[_0x9bdd('0x4c')][_0x9bdd('0x27')]({'plain':!![]});if(!_0x30dd3f)throw new Error(_0x9bdd('0x4d'));if(_0x30dd3f[_0x9bdd('0x4e')]===_0x9bdd('0x4c')){var _0x49ca54=_0x55c822['get']({'plain':!![]});var _0x275198=_0x9bdd('0x4f');return db[_0x9bdd('0x50')][_0x9bdd('0x48')]({'where':{'name':_0x275198,'userProfileId':_0x30dd3f[_0x9bdd('0x51')]},'raw':!![]})[_0x9bdd('0x25')](function(_0x24a774){if(_0x24a774&&_0x24a774['autoAssociation']===0x0){return db[_0x9bdd('0x52')][_0x9bdd('0x4a')]({'name':_0x49ca54[_0x9bdd('0x2a')],'resourceId':_0x49ca54['id'],'type':_0x24a774[_0x9bdd('0x2a')],'sectionId':_0x24a774['id']},{})[_0x9bdd('0x25')](function(){return _0x55c822;});}else{return _0x55c822;}})[_0x9bdd('0x49')](function(_0x42bd55){logger[_0x9bdd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42bd55);throw _0x42bd55;});}return _0x55c822;})[_0x9bdd('0x25')](respondWithResult(_0x5afebf,0xc9))['catch'](handleError(_0x5afebf,null));};exports[_0x9bdd('0x24')]=function(_0xaafb97,_0x29b71d){if(_0xaafb97['body']['id']){delete _0xaafb97[_0x9bdd('0x4b')]['id'];}return db['Trigger'][_0x9bdd('0x48')]({'where':{'id':_0xaafb97[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x29b71d,null))[_0x9bdd('0x25')](saveUpdates(_0xaafb97['body'],null))[_0x9bdd('0x25')](respondWithResult(_0x29b71d,null))['catch'](handleError(_0x29b71d,null));};exports[_0x9bdd('0x26')]=function(_0x22d7af,_0x3ec8de){return db[_0x9bdd('0x42')]['find']({'where':{'id':_0x22d7af[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x3ec8de,null))[_0x9bdd('0x25')](removeEntity(_0x3ec8de,null))['catch'](handleError(_0x3ec8de,null));};exports['addAllCondition']=function(_0x1c0130,_0x2901cd,_0x494ea4){if(_0x1c0130[_0x9bdd('0x4b')]['id']){delete _0x1c0130[_0x9bdd('0x4b')]['id'];}return db[_0x9bdd('0x42')]['find']({'where':{'id':_0x1c0130[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x2901cd,null))['then'](function(_0x3de3ce){if(_0x3de3ce){_0x1c0130[_0x9bdd('0x4b')][_0x9bdd('0x53')]=_0x3de3ce['id'];return db[_0x9bdd('0x54')]['create'](_0x1c0130[_0x9bdd('0x4b')]);}})[_0x9bdd('0x25')](respondWithResult(_0x2901cd,null))[_0x9bdd('0x49')](handleError(_0x2901cd,null));};exports[_0x9bdd('0x55')]=function(_0x1ccc04,_0x74b86d,_0x4a81b4){if(_0x1ccc04[_0x9bdd('0x4b')]['id']){delete _0x1ccc04[_0x9bdd('0x4b')]['id'];}return db[_0x9bdd('0x42')][_0x9bdd('0x48')]({'where':{'id':_0x1ccc04[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x74b86d,null))[_0x9bdd('0x25')](function(_0x301429){if(_0x301429){_0x1ccc04[_0x9bdd('0x4b')][_0x9bdd('0x56')]=_0x301429['id'];return db[_0x9bdd('0x54')]['create'](_0x1ccc04['body']);}})[_0x9bdd('0x25')](respondWithResult(_0x74b86d,null))[_0x9bdd('0x49')](handleError(_0x74b86d,null));};exports[_0x9bdd('0x57')]=function(_0x24bdec,_0x2afbeb,_0x454ee5){var _0x4acc99={};var _0x141101={};var _0x5ba9cb;var _0x4ac6cb;return db['Trigger'][_0x9bdd('0x58')]({'where':{'id':_0x24bdec[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x2afbeb,null))['then'](function(_0x4a30eb){if(_0x4a30eb){_0x5ba9cb=_0x4a30eb;_0x141101['model']=_[_0x9bdd('0x33')](db[_0x9bdd('0x54')]['rawAttributes']);_0x141101[_0x9bdd('0x32')]=_[_0x9bdd('0x33')](_0x24bdec[_0x9bdd('0x32')]);_0x141101[_0x9bdd('0x34')]=_[_0x9bdd('0x36')](_0x141101[_0x9bdd('0x31')],_0x141101['query']);_0x4acc99[_0x9bdd('0x35')]=_['intersection'](_0x141101[_0x9bdd('0x31')],qs[_0x9bdd('0x37')](_0x24bdec[_0x9bdd('0x32')][_0x9bdd('0x37')]));_0x4acc99[_0x9bdd('0x35')]=_0x4acc99[_0x9bdd('0x35')][_0x9bdd('0x59')]?_0x4acc99[_0x9bdd('0x35')]:_0x141101['model'];_0x4acc99[_0x9bdd('0x39')]=qs['sort'](_0x24bdec[_0x9bdd('0x32')]['sort']);_0x4acc99[_0x9bdd('0x3d')]=qs[_0x9bdd('0x34')](_[_0x9bdd('0x3b')](_0x24bdec[_0x9bdd('0x32')],_0x141101[_0x9bdd('0x34')]));if(_0x24bdec[_0x9bdd('0x32')][_0x9bdd('0x3c')]){_0x4acc99[_0x9bdd('0x3d')]=_['merge'](_0x4acc99['where'],{'$or':_['map'](_0x4acc99[_0x9bdd('0x35')],function(_0x4bc0ed){var _0x743b60={};_0x743b60[_0x4bc0ed]={'$like':'%'+_0x24bdec[_0x9bdd('0x32')][_0x9bdd('0x3c')]+'%'};return _0x743b60;})});}_0x4acc99=_[_0x9bdd('0x3e')]({},_0x4acc99,_0x24bdec['options']);return _0x5ba9cb[_0x9bdd('0x57')](_0x4acc99);}})[_0x9bdd('0x25')](function(_0x212fcc){if(_0x212fcc){_0x4ac6cb=_0x212fcc[_0x9bdd('0x59')];if(!_0x24bdec[_0x9bdd('0x32')]['hasOwnProperty']('nolimit')){_0x4acc99[_0x9bdd('0x1f')]=qs[_0x9bdd('0x1f')](_0x24bdec[_0x9bdd('0x32')][_0x9bdd('0x1f')]);_0x4acc99[_0x9bdd('0x1c')]=qs[_0x9bdd('0x1c')](_0x24bdec['query'][_0x9bdd('0x1c')]);}return _0x5ba9cb[_0x9bdd('0x57')](_0x4acc99);}})['then'](function(_0x3d2414){if(_0x3d2414){return _0x3d2414?{'count':_0x4ac6cb,'rows':_0x3d2414}:null;}})[_0x9bdd('0x25')](respondWithResult(_0x2afbeb,null))[_0x9bdd('0x49')](handleError(_0x2afbeb,null));};exports[_0x9bdd('0x5a')]=function(_0x1a61c0,_0x3860dd,_0x105a6c){var _0x5ef621={};var _0x5740a4={};var _0x22d0d4;var _0x3db4b5;return db[_0x9bdd('0x42')][_0x9bdd('0x58')]({'where':{'id':_0x1a61c0[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x3860dd,null))[_0x9bdd('0x25')](function(_0x3c5eb3){if(_0x3c5eb3){_0x22d0d4=_0x3c5eb3;_0x5740a4[_0x9bdd('0x31')]=_[_0x9bdd('0x33')](db[_0x9bdd('0x54')]['rawAttributes']);_0x5740a4['query']=_[_0x9bdd('0x33')](_0x1a61c0['query']);_0x5740a4['filters']=_[_0x9bdd('0x36')](_0x5740a4[_0x9bdd('0x31')],_0x5740a4[_0x9bdd('0x32')]);_0x5ef621['attributes']=_[_0x9bdd('0x36')](_0x5740a4[_0x9bdd('0x31')],qs['fields'](_0x1a61c0[_0x9bdd('0x32')][_0x9bdd('0x37')]));_0x5ef621[_0x9bdd('0x35')]=_0x5ef621[_0x9bdd('0x35')][_0x9bdd('0x59')]?_0x5ef621['attributes']:_0x5740a4[_0x9bdd('0x31')];_0x5ef621[_0x9bdd('0x39')]=qs[_0x9bdd('0x3a')](_0x1a61c0[_0x9bdd('0x32')][_0x9bdd('0x3a')]);_0x5ef621[_0x9bdd('0x3d')]=qs['filters'](_[_0x9bdd('0x3b')](_0x1a61c0['query'],_0x5740a4['filters']));if(_0x1a61c0['query'][_0x9bdd('0x3c')]){_0x5ef621[_0x9bdd('0x3d')]=_[_0x9bdd('0x3e')](_0x5ef621[_0x9bdd('0x3d')],{'$or':_[_0x9bdd('0x2d')](_0x5ef621['attributes'],function(_0x21df51){var _0x3732b6={};_0x3732b6[_0x21df51]={'$like':'%'+_0x1a61c0['query']['filter']+'%'};return _0x3732b6;})});}_0x5ef621=_[_0x9bdd('0x3e')]({},_0x5ef621,_0x1a61c0[_0x9bdd('0x47')]);return _0x22d0d4[_0x9bdd('0x5a')](_0x5ef621);}})[_0x9bdd('0x25')](function(_0x173bff){if(_0x173bff){_0x3db4b5=_0x173bff[_0x9bdd('0x59')];if(!_0x1a61c0[_0x9bdd('0x32')][_0x9bdd('0x5b')](_0x9bdd('0x38'))){_0x5ef621[_0x9bdd('0x1f')]=qs[_0x9bdd('0x1f')](_0x1a61c0['query'][_0x9bdd('0x1f')]);_0x5ef621[_0x9bdd('0x1c')]=qs['offset'](_0x1a61c0[_0x9bdd('0x32')]['offset']);}return _0x22d0d4[_0x9bdd('0x5a')](_0x5ef621);}})[_0x9bdd('0x25')](function(_0x16186f){if(_0x16186f){return _0x16186f?{'count':_0x3db4b5,'rows':_0x16186f}:null;}})[_0x9bdd('0x25')](respondWithResult(_0x3860dd,null))[_0x9bdd('0x49')](handleError(_0x3860dd,null));};exports[_0x9bdd('0x5c')]=function(_0x53fba6,_0x44e8b6,_0x24da8b){if(_0x53fba6[_0x9bdd('0x4b')]['id']){delete _0x53fba6[_0x9bdd('0x4b')]['id'];}return db['Trigger'][_0x9bdd('0x48')]({'where':{'id':_0x53fba6[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x44e8b6,null))[_0x9bdd('0x25')](function(_0xd7563f){if(_0xd7563f){_0x53fba6[_0x9bdd('0x4b')][_0x9bdd('0x5d')]=_0xd7563f['id'];return db[_0x9bdd('0x5e')][_0x9bdd('0x4a')](_0x53fba6[_0x9bdd('0x4b')]);}})[_0x9bdd('0x25')](respondWithResult(_0x44e8b6,null))[_0x9bdd('0x49')](handleError(_0x44e8b6,null));};exports['getActions']=function(_0x82950,_0x586db7,_0x533c5f){var _0x563d89={};var _0x2d0e62={};var _0x597f63;var _0x26fa47;return db[_0x9bdd('0x42')][_0x9bdd('0x58')]({'where':{'id':_0x82950[_0x9bdd('0x46')]['id']}})[_0x9bdd('0x25')](handleEntityNotFound(_0x586db7,null))[_0x9bdd('0x25')](function(_0x49b22d){if(_0x49b22d){_0x597f63=_0x49b22d;_0x2d0e62[_0x9bdd('0x31')]=_[_0x9bdd('0x33')](db['Action'][_0x9bdd('0x2e')]);_0x2d0e62['query']=_['keys'](_0x82950[_0x9bdd('0x32')]);_0x2d0e62['filters']=_['intersection'](_0x2d0e62[_0x9bdd('0x31')],_0x2d0e62[_0x9bdd('0x32')]);_0x563d89[_0x9bdd('0x35')]=_[_0x9bdd('0x36')](_0x2d0e62['model'],qs[_0x9bdd('0x37')](_0x82950[_0x9bdd('0x32')]['fields']));_0x563d89[_0x9bdd('0x35')]=_0x563d89[_0x9bdd('0x35')][_0x9bdd('0x59')]?_0x563d89[_0x9bdd('0x35')]:_0x2d0e62[_0x9bdd('0x31')];_0x563d89[_0x9bdd('0x39')]=qs[_0x9bdd('0x3a')](_0x82950['query'][_0x9bdd('0x3a')]);_0x563d89[_0x9bdd('0x3d')]=qs[_0x9bdd('0x34')](_['pick'](_0x82950['query'],_0x2d0e62[_0x9bdd('0x34')]));if(_0x82950['query']['filter']){_0x563d89['where']=_[_0x9bdd('0x3e')](_0x563d89['where'],{'$or':_['map'](_0x563d89[_0x9bdd('0x35')],function(_0x39b589){var _0x5eaa7a={};_0x5eaa7a[_0x39b589]={'$like':'%'+_0x82950['query'][_0x9bdd('0x3c')]+'%'};return _0x5eaa7a;})});}_0x563d89=_['merge']({},_0x563d89,_0x82950[_0x9bdd('0x47')]);return _0x597f63['getActions'](_0x563d89);}})[_0x9bdd('0x25')](function(_0x120d55){if(_0x120d55){_0x26fa47=_0x120d55['length'];if(!_0x82950[_0x9bdd('0x32')][_0x9bdd('0x5b')](_0x9bdd('0x38'))){_0x563d89[_0x9bdd('0x1f')]=qs[_0x9bdd('0x1f')](_0x82950[_0x9bdd('0x32')][_0x9bdd('0x1f')]);_0x563d89[_0x9bdd('0x1c')]=qs[_0x9bdd('0x1c')](_0x82950[_0x9bdd('0x32')][_0x9bdd('0x1c')]);}return _0x597f63[_0x9bdd('0x5f')](_0x563d89);}})['then'](function(_0x4aedd0){if(_0x4aedd0){return _0x4aedd0?{'count':_0x26fa47,'rows':_0x4aedd0}:null;}})[_0x9bdd('0x25')](respondWithResult(_0x586db7,null))['catch'](handleError(_0x586db7,null));}; \ No newline at end of file +var _0xae01=['squel','crypto','jsforce','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','undefined','limit','count','offset','Content-Range','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','index','map','Trigger','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','filter','merge','options','findAll','rows','catch','show','rawAttributes','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','pick','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x45bf4e,_0x5eb51b){var _0x48ef35=function(_0x16551c){while(--_0x16551c){_0x45bf4e['push'](_0x45bf4e['shift']());}};_0x48ef35(++_0x5eb51b);}(_0xae01,0xb9));var _0x1ae0=function(_0x2e804f,_0x1b3f7a){_0x2e804f=_0x2e804f-0x0;var _0x2b4077=_0xae01[_0x2e804f];return _0x2b4077;};'use strict';var emlformat=require(_0x1ae0('0x0'));var rimraf=require(_0x1ae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ae0('0x2'));var rp=require(_0x1ae0('0x3'));var moment=require(_0x1ae0('0x4'));var BPromise=require(_0x1ae0('0x5'));var Mustache=require(_0x1ae0('0x6'));var util=require(_0x1ae0('0x7'));var path=require(_0x1ae0('0x8'));var sox=require(_0x1ae0('0x9'));var csv=require('to-csv');var ejs=require(_0x1ae0('0xa'));var fs=require('fs');var fs_extra=require(_0x1ae0('0xb'));var _=require(_0x1ae0('0xc'));var squel=require(_0x1ae0('0xd'));var crypto=require(_0x1ae0('0xe'));var jsforce=require(_0x1ae0('0xf'));var deskjs=require(_0x1ae0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1ae0('0x11'));var Papa=require(_0x1ae0('0x12'));var Redis=require(_0x1ae0('0x13'));var authService=require(_0x1ae0('0x14'));var qs=require(_0x1ae0('0x15'));var as=require(_0x1ae0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1ae0('0x17'));var utils=require(_0x1ae0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ae0('0x19'));var db=require(_0x1ae0('0x1a'))['db'];function respondWithStatusCode(_0x32600a,_0x1c99cd){_0x1c99cd=_0x1c99cd||0xcc;return function(_0x41eec8){if(_0x41eec8){return _0x32600a[_0x1ae0('0x1b')](_0x1c99cd);}return _0x32600a[_0x1ae0('0x1c')](_0x1c99cd)[_0x1ae0('0x1d')]();};}function respondWithResult(_0x18d257,_0x40ed2d){_0x40ed2d=_0x40ed2d||0xc8;return function(_0x84b978){if(_0x84b978){return _0x18d257['status'](_0x40ed2d)[_0x1ae0('0x1e')](_0x84b978);}};}function respondWithFilteredResult(_0x347199,_0x35073e){return function(_0x3a8f58){if(_0x3a8f58){var _0x25cc46=typeof _0x35073e['offset']===_0x1ae0('0x1f')&&typeof _0x35073e[_0x1ae0('0x20')]===_0x1ae0('0x1f');var _0x56c120=_0x3a8f58['count'];var _0x3c2983=_0x25cc46?0x0:_0x35073e['offset'];var _0x63f82a=_0x25cc46?_0x3a8f58[_0x1ae0('0x21')]:_0x35073e[_0x1ae0('0x22')]+_0x35073e[_0x1ae0('0x20')];var _0x5f288d;if(_0x63f82a>=_0x56c120){_0x63f82a=_0x56c120;_0x5f288d=0xc8;}else{_0x5f288d=0xce;}_0x347199['status'](_0x5f288d);return _0x347199['set'](_0x1ae0('0x23'),_0x3c2983+'-'+_0x63f82a+'/'+_0x56c120)[_0x1ae0('0x1e')](_0x3a8f58);}return null;};}function patchUpdates(_0x2b7009){return function(_0x3ef599){try{jsonpatch['apply'](_0x3ef599,_0x2b7009,!![]);}catch(_0x32d91d){return BPromise['reject'](_0x32d91d);}return _0x3ef599[_0x1ae0('0x24')]();};}function saveUpdates(_0x201574,_0x20533d){return function(_0x483884){if(_0x483884){return _0x483884[_0x1ae0('0x25')](_0x201574)[_0x1ae0('0x26')](function(_0x5bc173){return _0x5bc173;});}return null;};}function removeEntity(_0x393286,_0x2be8ba){return function(_0x8eb4a5){if(_0x8eb4a5){return _0x8eb4a5['destroy']()[_0x1ae0('0x26')](function(){var _0x115cce=_0x8eb4a5[_0x1ae0('0x27')]({'plain':!![]});var _0x4bd343=_0x1ae0('0x28');return db[_0x1ae0('0x29')][_0x1ae0('0x2a')]({'where':{'type':_0x4bd343,'resourceId':_0x115cce['id']}})['then'](function(){return _0x8eb4a5;});})[_0x1ae0('0x26')](function(){_0x393286[_0x1ae0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3a61,_0x4be060){return function(_0x4512b9){if(!_0x4512b9){_0x3b3a61[_0x1ae0('0x1b')](0x194);}return _0x4512b9;};}function handleError(_0x257653,_0x5899bb){_0x5899bb=_0x5899bb||0x1f4;return function(_0x3dd02f){logger[_0x1ae0('0x2b')](_0x3dd02f[_0x1ae0('0x2c')]);if(_0x3dd02f[_0x1ae0('0x2d')]){delete _0x3dd02f[_0x1ae0('0x2d')];}_0x257653[_0x1ae0('0x1c')](_0x5899bb)['send'](_0x3dd02f);};}exports[_0x1ae0('0x2e')]=function(_0x1033f7,_0x72b765){var _0x2b64ba={},_0x134dbc={},_0x54813b={'count':0x0,'rows':[]};var _0x34aae8=_[_0x1ae0('0x2f')](db[_0x1ae0('0x30')]['rawAttributes'],function(_0x5b64c4){return{'name':_0x5b64c4[_0x1ae0('0x31')],'type':_0x5b64c4[_0x1ae0('0x32')][_0x1ae0('0x33')]};});_0x134dbc['model']=_[_0x1ae0('0x2f')](_0x34aae8,_0x1ae0('0x2d'));_0x134dbc[_0x1ae0('0x34')]=_[_0x1ae0('0x35')](_0x1033f7['query']);_0x134dbc[_0x1ae0('0x36')]=_[_0x1ae0('0x37')](_0x134dbc[_0x1ae0('0x38')],_0x134dbc[_0x1ae0('0x34')]);_0x2b64ba[_0x1ae0('0x39')]=_[_0x1ae0('0x37')](_0x134dbc[_0x1ae0('0x38')],qs[_0x1ae0('0x3a')](_0x1033f7[_0x1ae0('0x34')][_0x1ae0('0x3a')]));_0x2b64ba[_0x1ae0('0x39')]=_0x2b64ba[_0x1ae0('0x39')]['length']?_0x2b64ba[_0x1ae0('0x39')]:_0x134dbc['model'];if(!_0x1033f7['query']['hasOwnProperty'](_0x1ae0('0x3b'))){_0x2b64ba[_0x1ae0('0x20')]=qs[_0x1ae0('0x20')](_0x1033f7[_0x1ae0('0x34')]['limit']);_0x2b64ba['offset']=qs[_0x1ae0('0x22')](_0x1033f7[_0x1ae0('0x34')][_0x1ae0('0x22')]);}_0x2b64ba['order']=qs[_0x1ae0('0x3c')](_0x1033f7['query'][_0x1ae0('0x3c')]);_0x2b64ba[_0x1ae0('0x3d')]=qs['filters'](_['pick'](_0x1033f7[_0x1ae0('0x34')],_0x134dbc['filters']),_0x34aae8);if(_0x1033f7['query'][_0x1ae0('0x3e')]){_0x2b64ba['where']=_[_0x1ae0('0x3f')](_0x2b64ba['where'],{'$or':_[_0x1ae0('0x2f')](_0x34aae8,function(_0x4f2041){if(_0x4f2041['type']!=='VIRTUAL'){var _0x199252={};_0x199252[_0x4f2041[_0x1ae0('0x2d')]]={'$like':'%'+_0x1033f7['query']['filter']+'%'};return _0x199252;}})});}_0x2b64ba=_['merge']({},_0x2b64ba,_0x1033f7[_0x1ae0('0x40')]);var _0x4a806f={'where':_0x2b64ba[_0x1ae0('0x3d')]};return db[_0x1ae0('0x30')][_0x1ae0('0x21')](_0x4a806f)['then'](function(_0x291f97){_0x54813b[_0x1ae0('0x21')]=_0x291f97;if(_0x1033f7['query']['includeAll']){_0x2b64ba['include']=[{'all':!![]}];}return db[_0x1ae0('0x30')][_0x1ae0('0x41')](_0x2b64ba);})[_0x1ae0('0x26')](function(_0x2ef14f){_0x54813b[_0x1ae0('0x42')]=_0x2ef14f;return _0x54813b;})[_0x1ae0('0x26')](respondWithFilteredResult(_0x72b765,_0x2b64ba))[_0x1ae0('0x43')](handleError(_0x72b765,null));};exports[_0x1ae0('0x44')]=function(_0x2223c0,_0x4fe104){var _0x183ab3={'raw':![],'where':{'id':_0x2223c0['params']['id']}},_0x5ea1c2={};_0x5ea1c2['model']=_['keys'](db[_0x1ae0('0x30')][_0x1ae0('0x45')]);_0x5ea1c2[_0x1ae0('0x34')]=_[_0x1ae0('0x35')](_0x2223c0[_0x1ae0('0x34')]);_0x5ea1c2[_0x1ae0('0x36')]=_[_0x1ae0('0x37')](_0x5ea1c2[_0x1ae0('0x38')],_0x5ea1c2['query']);_0x183ab3[_0x1ae0('0x39')]=_['intersection'](_0x5ea1c2[_0x1ae0('0x38')],qs[_0x1ae0('0x3a')](_0x2223c0[_0x1ae0('0x34')][_0x1ae0('0x3a')]));_0x183ab3[_0x1ae0('0x39')]=_0x183ab3[_0x1ae0('0x39')][_0x1ae0('0x46')]?_0x183ab3[_0x1ae0('0x39')]:_0x5ea1c2['model'];if(_0x2223c0['query'][_0x1ae0('0x47')]){_0x183ab3[_0x1ae0('0x48')]=[{'all':!![]}];}_0x183ab3=_['merge']({},_0x183ab3,_0x2223c0['options']);return db[_0x1ae0('0x30')][_0x1ae0('0x49')](_0x183ab3)[_0x1ae0('0x26')](handleEntityNotFound(_0x4fe104,null))[_0x1ae0('0x26')](respondWithResult(_0x4fe104,null))[_0x1ae0('0x43')](handleError(_0x4fe104,null));};exports[_0x1ae0('0x4a')]=function(_0x26e05d,_0x2e3496){return db['Trigger'][_0x1ae0('0x4a')](_0x26e05d[_0x1ae0('0x4b')],{})[_0x1ae0('0x26')](function(_0x57a42f){var _0x11190c=_0x26e05d[_0x1ae0('0x4c')][_0x1ae0('0x27')]({'plain':!![]});if(!_0x11190c)throw new Error(_0x1ae0('0x4d'));if(_0x11190c[_0x1ae0('0x4e')]===_0x1ae0('0x4c')){var _0x419b4d=_0x57a42f[_0x1ae0('0x27')]({'plain':!![]});var _0x4b7479='Triggers';return db[_0x1ae0('0x4f')]['find']({'where':{'name':_0x4b7479,'userProfileId':_0x11190c[_0x1ae0('0x50')]},'raw':!![]})[_0x1ae0('0x26')](function(_0x42947c){if(_0x42947c&&_0x42947c[_0x1ae0('0x51')]===0x0){return db[_0x1ae0('0x29')][_0x1ae0('0x4a')]({'name':_0x419b4d[_0x1ae0('0x2d')],'resourceId':_0x419b4d['id'],'type':_0x42947c['name'],'sectionId':_0x42947c['id']},{})['then'](function(){return _0x57a42f;});}else{return _0x57a42f;}})[_0x1ae0('0x43')](function(_0x5af46e){logger['error'](_0x1ae0('0x52'),_0x5af46e);throw _0x5af46e;});}return _0x57a42f;})[_0x1ae0('0x26')](respondWithResult(_0x2e3496,0xc9))[_0x1ae0('0x43')](handleError(_0x2e3496,null));};exports[_0x1ae0('0x25')]=function(_0x481c25,_0x4f120e){if(_0x481c25[_0x1ae0('0x4b')]['id']){delete _0x481c25[_0x1ae0('0x4b')]['id'];}return db[_0x1ae0('0x30')]['find']({'where':{'id':_0x481c25[_0x1ae0('0x53')]['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0x4f120e,null))[_0x1ae0('0x26')](saveUpdates(_0x481c25['body'],null))[_0x1ae0('0x26')](respondWithResult(_0x4f120e,null))['catch'](handleError(_0x4f120e,null));};exports[_0x1ae0('0x2a')]=function(_0x439d7c,_0xb3f9ee){return db[_0x1ae0('0x30')][_0x1ae0('0x49')]({'where':{'id':_0x439d7c[_0x1ae0('0x53')]['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0xb3f9ee,null))['then'](removeEntity(_0xb3f9ee,null))[_0x1ae0('0x43')](handleError(_0xb3f9ee,null));};exports[_0x1ae0('0x54')]=function(_0x362b25,_0x6aa306,_0x4922e0){if(_0x362b25[_0x1ae0('0x4b')]['id']){delete _0x362b25[_0x1ae0('0x4b')]['id'];}return db[_0x1ae0('0x30')][_0x1ae0('0x49')]({'where':{'id':_0x362b25[_0x1ae0('0x53')]['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0x6aa306,null))[_0x1ae0('0x26')](function(_0xbd314){if(_0xbd314){_0x362b25[_0x1ae0('0x4b')][_0x1ae0('0x55')]=_0xbd314['id'];return db[_0x1ae0('0x56')][_0x1ae0('0x4a')](_0x362b25[_0x1ae0('0x4b')]);}})[_0x1ae0('0x26')](respondWithResult(_0x6aa306,null))[_0x1ae0('0x43')](handleError(_0x6aa306,null));};exports[_0x1ae0('0x57')]=function(_0x122eae,_0x20ae04,_0x1d503b){if(_0x122eae[_0x1ae0('0x4b')]['id']){delete _0x122eae[_0x1ae0('0x4b')]['id'];}return db[_0x1ae0('0x30')]['find']({'where':{'id':_0x122eae[_0x1ae0('0x53')]['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0x20ae04,null))[_0x1ae0('0x26')](function(_0x5c063e){if(_0x5c063e){_0x122eae[_0x1ae0('0x4b')][_0x1ae0('0x58')]=_0x5c063e['id'];return db[_0x1ae0('0x56')][_0x1ae0('0x4a')](_0x122eae[_0x1ae0('0x4b')]);}})[_0x1ae0('0x26')](respondWithResult(_0x20ae04,null))[_0x1ae0('0x43')](handleError(_0x20ae04,null));};exports[_0x1ae0('0x59')]=function(_0x220761,_0x3dff3d,_0x39809b){var _0x3ecf39={};var _0x11aca3={};var _0x2e7e1a;var _0x435d79;return db[_0x1ae0('0x30')][_0x1ae0('0x5a')]({'where':{'id':_0x220761[_0x1ae0('0x53')]['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0x3dff3d,null))[_0x1ae0('0x26')](function(_0x2d5464){if(_0x2d5464){_0x2e7e1a=_0x2d5464;_0x11aca3[_0x1ae0('0x38')]=_[_0x1ae0('0x35')](db['Condition'][_0x1ae0('0x45')]);_0x11aca3[_0x1ae0('0x34')]=_[_0x1ae0('0x35')](_0x220761[_0x1ae0('0x34')]);_0x11aca3['filters']=_[_0x1ae0('0x37')](_0x11aca3['model'],_0x11aca3[_0x1ae0('0x34')]);_0x3ecf39[_0x1ae0('0x39')]=_[_0x1ae0('0x37')](_0x11aca3['model'],qs[_0x1ae0('0x3a')](_0x220761[_0x1ae0('0x34')][_0x1ae0('0x3a')]));_0x3ecf39[_0x1ae0('0x39')]=_0x3ecf39[_0x1ae0('0x39')][_0x1ae0('0x46')]?_0x3ecf39[_0x1ae0('0x39')]:_0x11aca3[_0x1ae0('0x38')];_0x3ecf39[_0x1ae0('0x5b')]=qs[_0x1ae0('0x3c')](_0x220761[_0x1ae0('0x34')][_0x1ae0('0x3c')]);_0x3ecf39['where']=qs[_0x1ae0('0x36')](_[_0x1ae0('0x5c')](_0x220761[_0x1ae0('0x34')],_0x11aca3[_0x1ae0('0x36')]));if(_0x220761[_0x1ae0('0x34')][_0x1ae0('0x3e')]){_0x3ecf39[_0x1ae0('0x3d')]=_['merge'](_0x3ecf39[_0x1ae0('0x3d')],{'$or':_[_0x1ae0('0x2f')](_0x3ecf39[_0x1ae0('0x39')],function(_0x46ff9e){var _0x1ba00d={};_0x1ba00d[_0x46ff9e]={'$like':'%'+_0x220761[_0x1ae0('0x34')][_0x1ae0('0x3e')]+'%'};return _0x1ba00d;})});}_0x3ecf39=_['merge']({},_0x3ecf39,_0x220761[_0x1ae0('0x40')]);return _0x2e7e1a[_0x1ae0('0x59')](_0x3ecf39);}})['then'](function(_0x399d2a){if(_0x399d2a){_0x435d79=_0x399d2a[_0x1ae0('0x46')];if(!_0x220761[_0x1ae0('0x34')]['hasOwnProperty'](_0x1ae0('0x3b'))){_0x3ecf39[_0x1ae0('0x20')]=qs['limit'](_0x220761[_0x1ae0('0x34')]['limit']);_0x3ecf39[_0x1ae0('0x22')]=qs[_0x1ae0('0x22')](_0x220761[_0x1ae0('0x34')][_0x1ae0('0x22')]);}return _0x2e7e1a[_0x1ae0('0x59')](_0x3ecf39);}})[_0x1ae0('0x26')](function(_0x58f184){if(_0x58f184){return _0x58f184?{'count':_0x435d79,'rows':_0x58f184}:null;}})[_0x1ae0('0x26')](respondWithResult(_0x3dff3d,null))[_0x1ae0('0x43')](handleError(_0x3dff3d,null));};exports[_0x1ae0('0x5d')]=function(_0x4a0ef9,_0x2d96e3,_0x11e45e){var _0x2f4c75={};var _0x46091e={};var _0x49cc8e;var _0x4f4463;return db[_0x1ae0('0x30')][_0x1ae0('0x5a')]({'where':{'id':_0x4a0ef9[_0x1ae0('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d96e3,null))[_0x1ae0('0x26')](function(_0x1243aa){if(_0x1243aa){_0x49cc8e=_0x1243aa;_0x46091e[_0x1ae0('0x38')]=_[_0x1ae0('0x35')](db['Condition'][_0x1ae0('0x45')]);_0x46091e[_0x1ae0('0x34')]=_[_0x1ae0('0x35')](_0x4a0ef9[_0x1ae0('0x34')]);_0x46091e[_0x1ae0('0x36')]=_[_0x1ae0('0x37')](_0x46091e[_0x1ae0('0x38')],_0x46091e[_0x1ae0('0x34')]);_0x2f4c75[_0x1ae0('0x39')]=_[_0x1ae0('0x37')](_0x46091e[_0x1ae0('0x38')],qs[_0x1ae0('0x3a')](_0x4a0ef9['query'][_0x1ae0('0x3a')]));_0x2f4c75[_0x1ae0('0x39')]=_0x2f4c75['attributes']['length']?_0x2f4c75['attributes']:_0x46091e[_0x1ae0('0x38')];_0x2f4c75[_0x1ae0('0x5b')]=qs[_0x1ae0('0x3c')](_0x4a0ef9[_0x1ae0('0x34')][_0x1ae0('0x3c')]);_0x2f4c75[_0x1ae0('0x3d')]=qs[_0x1ae0('0x36')](_[_0x1ae0('0x5c')](_0x4a0ef9[_0x1ae0('0x34')],_0x46091e[_0x1ae0('0x36')]));if(_0x4a0ef9['query'][_0x1ae0('0x3e')]){_0x2f4c75[_0x1ae0('0x3d')]=_['merge'](_0x2f4c75[_0x1ae0('0x3d')],{'$or':_[_0x1ae0('0x2f')](_0x2f4c75['attributes'],function(_0x3ba375){var _0x2162c9={};_0x2162c9[_0x3ba375]={'$like':'%'+_0x4a0ef9['query'][_0x1ae0('0x3e')]+'%'};return _0x2162c9;})});}_0x2f4c75=_[_0x1ae0('0x3f')]({},_0x2f4c75,_0x4a0ef9[_0x1ae0('0x40')]);return _0x49cc8e[_0x1ae0('0x5d')](_0x2f4c75);}})['then'](function(_0x55528d){if(_0x55528d){_0x4f4463=_0x55528d['length'];if(!_0x4a0ef9['query'][_0x1ae0('0x5e')]('nolimit')){_0x2f4c75['limit']=qs[_0x1ae0('0x20')](_0x4a0ef9[_0x1ae0('0x34')][_0x1ae0('0x20')]);_0x2f4c75['offset']=qs[_0x1ae0('0x22')](_0x4a0ef9[_0x1ae0('0x34')][_0x1ae0('0x22')]);}return _0x49cc8e['getAnyConditions'](_0x2f4c75);}})[_0x1ae0('0x26')](function(_0x4fc31e){if(_0x4fc31e){return _0x4fc31e?{'count':_0x4f4463,'rows':_0x4fc31e}:null;}})[_0x1ae0('0x26')](respondWithResult(_0x2d96e3,null))[_0x1ae0('0x43')](handleError(_0x2d96e3,null));};exports[_0x1ae0('0x5f')]=function(_0x3ca76b,_0x3c24d6,_0x529867){if(_0x3ca76b[_0x1ae0('0x4b')]['id']){delete _0x3ca76b[_0x1ae0('0x4b')]['id'];}return db[_0x1ae0('0x30')][_0x1ae0('0x49')]({'where':{'id':_0x3ca76b[_0x1ae0('0x53')]['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0x3c24d6,null))[_0x1ae0('0x26')](function(_0x1c9554){if(_0x1c9554){_0x3ca76b[_0x1ae0('0x4b')][_0x1ae0('0x60')]=_0x1c9554['id'];return db[_0x1ae0('0x61')][_0x1ae0('0x4a')](_0x3ca76b[_0x1ae0('0x4b')]);}})[_0x1ae0('0x26')](respondWithResult(_0x3c24d6,null))['catch'](handleError(_0x3c24d6,null));};exports[_0x1ae0('0x62')]=function(_0x943f2f,_0x4b418d,_0x6314c9){var _0x5551c0={};var _0xcee608={};var _0xa2c5f5;var _0x36aa08;return db[_0x1ae0('0x30')]['findOne']({'where':{'id':_0x943f2f['params']['id']}})[_0x1ae0('0x26')](handleEntityNotFound(_0x4b418d,null))[_0x1ae0('0x26')](function(_0x44847d){if(_0x44847d){_0xa2c5f5=_0x44847d;_0xcee608[_0x1ae0('0x38')]=_[_0x1ae0('0x35')](db['Action'][_0x1ae0('0x45')]);_0xcee608['query']=_[_0x1ae0('0x35')](_0x943f2f[_0x1ae0('0x34')]);_0xcee608[_0x1ae0('0x36')]=_['intersection'](_0xcee608[_0x1ae0('0x38')],_0xcee608[_0x1ae0('0x34')]);_0x5551c0['attributes']=_[_0x1ae0('0x37')](_0xcee608[_0x1ae0('0x38')],qs['fields'](_0x943f2f[_0x1ae0('0x34')]['fields']));_0x5551c0[_0x1ae0('0x39')]=_0x5551c0[_0x1ae0('0x39')][_0x1ae0('0x46')]?_0x5551c0[_0x1ae0('0x39')]:_0xcee608[_0x1ae0('0x38')];_0x5551c0[_0x1ae0('0x5b')]=qs[_0x1ae0('0x3c')](_0x943f2f[_0x1ae0('0x34')][_0x1ae0('0x3c')]);_0x5551c0[_0x1ae0('0x3d')]=qs[_0x1ae0('0x36')](_[_0x1ae0('0x5c')](_0x943f2f[_0x1ae0('0x34')],_0xcee608[_0x1ae0('0x36')]));if(_0x943f2f[_0x1ae0('0x34')][_0x1ae0('0x3e')]){_0x5551c0[_0x1ae0('0x3d')]=_[_0x1ae0('0x3f')](_0x5551c0[_0x1ae0('0x3d')],{'$or':_[_0x1ae0('0x2f')](_0x5551c0[_0x1ae0('0x39')],function(_0x2d0ed2){var _0x5717ae={};_0x5717ae[_0x2d0ed2]={'$like':'%'+_0x943f2f[_0x1ae0('0x34')][_0x1ae0('0x3e')]+'%'};return _0x5717ae;})});}_0x5551c0=_['merge']({},_0x5551c0,_0x943f2f[_0x1ae0('0x40')]);return _0xa2c5f5[_0x1ae0('0x62')](_0x5551c0);}})[_0x1ae0('0x26')](function(_0x5208ed){if(_0x5208ed){_0x36aa08=_0x5208ed[_0x1ae0('0x46')];if(!_0x943f2f[_0x1ae0('0x34')][_0x1ae0('0x5e')](_0x1ae0('0x3b'))){_0x5551c0['limit']=qs[_0x1ae0('0x20')](_0x943f2f['query'][_0x1ae0('0x20')]);_0x5551c0[_0x1ae0('0x22')]=qs[_0x1ae0('0x22')](_0x943f2f[_0x1ae0('0x34')][_0x1ae0('0x22')]);}return _0xa2c5f5[_0x1ae0('0x62')](_0x5551c0);}})[_0x1ae0('0x26')](function(_0x380889){if(_0x380889){return _0x380889?{'count':_0x36aa08,'rows':_0x380889}:null;}})[_0x1ae0('0x26')](respondWithResult(_0x4b418d,null))[_0x1ae0('0x43')](handleError(_0x4b418d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5361ce3..f60b4f9 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 _0x9335=['Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x56aa4b,_0x3ee227){var _0x38f87d=function(_0x493d20){while(--_0x493d20){_0x56aa4b['push'](_0x56aa4b['shift']());}};_0x38f87d(++_0x3ee227);}(_0x9335,0xab));var _0x5933=function(_0x2de315,_0x59e4f1){_0x2de315=_0x2de315-0x0;var _0x16d6dc=_0x9335[_0x2de315];return _0x16d6dc;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var logger=require('../../config/logger')(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var BPromise=require(_0x5933('0x4'));var rp=require(_0x5933('0x5'));var fs=require('fs');var path=require(_0x5933('0x6'));var rimraf=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var attributes=require('./trigger.attributes');module[_0x5933('0x9')]=function(_0x4de024,_0x553710){return _0x4de024[_0x5933('0xa')](_0x5933('0xb'),attributes,{'tableName':_0x5933('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3be=['tools_triggers','lodash','util','../../config/logger','api','bluebird','./trigger.attributes','exports','define','Trigger'];(function(_0x19b908,_0x2094f9){var _0x5b5165=function(_0x5933ec){while(--_0x5933ec){_0x19b908['push'](_0x19b908['shift']());}};_0x5b5165(++_0x2094f9);}(_0xf3be,0x1e1));var _0xef3b=function(_0x1edf0d,_0x7c81be){_0x1edf0d=_0x1edf0d-0x0;var _0x5740a2=_0xf3be[_0x1edf0d];return _0x5740a2;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var logger=require(_0xef3b('0x2'))(_0xef3b('0x3'));var moment=require('moment');var BPromise=require(_0xef3b('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(_0xef3b('0x5'));module[_0xef3b('0x6')]=function(_0x48f499,_0x3dfcc2){return _0x48f499[_0xef3b('0x7')](_0xef3b('0x8'),attributes,{'tableName':_0xef3b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index c78a8b2..a92fba5 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 _0x0417=['Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trigger','findAll','options','raw','limit','include','map','model','attributes','GetTrigger','ShowTrigger','find','where','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4880e1,_0x19d3e6){var _0x1641ad=function(_0x232900){while(--_0x232900){_0x4880e1['push'](_0x4880e1['shift']());}};_0x1641ad(++_0x19d3e6);}(_0x0417,0x1a3));var _0x7041=function(_0x1ba167,_0x2f54de){_0x1ba167=_0x1ba167-0x0;var _0x59ec55=_0x0417[_0x1ba167];return _0x59ec55;};'use strict';var _=require(_0x7041('0x0'));var util=require(_0x7041('0x1'));var moment=require(_0x7041('0x2'));var BPromise=require(_0x7041('0x3'));var rs=require(_0x7041('0x4'));var fs=require('fs');var Redis=require(_0x7041('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7041('0x6'))('rpc');var config=require(_0x7041('0x7'));var jayson=require(_0x7041('0x8'));var client=jayson[_0x7041('0x9')][_0x7041('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x154a3f,_0x1efe62,_0x12a038){return new BPromise(function(_0x219726,_0x569ea9){return client[_0x7041('0xb')](_0x154a3f,_0x12a038)[_0x7041('0xc')](function(_0x127b75){logger['info'](_0x7041('0xd'),_0x1efe62,_0x7041('0xe'));logger[_0x7041('0xf')](_0x7041('0x10'),_0x1efe62,_0x7041('0xe'),JSON[_0x7041('0x11')](_0x127b75));if(_0x127b75[_0x7041('0x12')]){if(_0x127b75[_0x7041('0x12')]['code']===0x1f4){logger['error'](_0x7041('0xd'),_0x1efe62,_0x127b75[_0x7041('0x12')]['message']);return _0x569ea9(_0x127b75[_0x7041('0x12')][_0x7041('0x13')]);}logger[_0x7041('0x12')]('Trigger,\x20%s,\x20%s',_0x1efe62,_0x127b75[_0x7041('0x12')]['message']);return _0x219726(_0x127b75[_0x7041('0x12')][_0x7041('0x13')]);}else{logger['info'](_0x7041('0xd'),_0x1efe62,'request\x20sent');_0x219726(_0x127b75[_0x7041('0x14')]['message']);}})[_0x7041('0x15')](function(_0x2e00de){logger[_0x7041('0x12')](_0x7041('0xd'),_0x1efe62,_0x2e00de);_0x569ea9(_0x2e00de);});});}exports['GetTrigger']=function(_0x3e76bb){var _0x138786=this;return new Promise(function(_0x5da2b3,_0x37d842){return db[_0x7041('0x16')][_0x7041('0x17')]({'raw':_0x3e76bb[_0x7041('0x18')]?_0x3e76bb[_0x7041('0x18')][_0x7041('0x19')]===undefined?!![]:![]:!![],'where':_0x3e76bb['options']?_0x3e76bb[_0x7041('0x18')]['where']||null:null,'attributes':_0x3e76bb['options']?_0x3e76bb[_0x7041('0x18')]['attributes']||null:null,'limit':_0x3e76bb[_0x7041('0x18')]?_0x3e76bb['options'][_0x7041('0x1a')]||null:null,'include':_0x3e76bb[_0x7041('0x18')]?_0x3e76bb[_0x7041('0x18')][_0x7041('0x1b')]?_[_0x7041('0x1c')](_0x3e76bb[_0x7041('0x18')][_0x7041('0x1b')],function(_0x3e68fc){return{'model':db[_0x3e68fc[_0x7041('0x1d')]],'as':_0x3e68fc['as'],'attributes':_0x3e68fc['attributes'],'include':_0x3e68fc[_0x7041('0x1b')]?_['map'](_0x3e68fc[_0x7041('0x1b')],function(_0x3f13a2){return{'model':db[_0x3f13a2[_0x7041('0x1d')]],'as':_0x3f13a2['as'],'attributes':_0x3f13a2['attributes'],'include':_0x3f13a2[_0x7041('0x1b')]?_[_0x7041('0x1c')](_0x3f13a2[_0x7041('0x1b')],function(_0x489b79){return{'model':db[_0x489b79['model']],'as':_0x489b79['as'],'attributes':_0x489b79[_0x7041('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x217bf1){logger['info']('GetTrigger',_0x3e76bb);logger[_0x7041('0xf')](_0x7041('0x1f'),_0x3e76bb,JSON[_0x7041('0x11')](_0x217bf1));_0x5da2b3(_0x217bf1);})['catch'](function(_0x59da43){logger[_0x7041('0x12')](_0x7041('0x1f'),_0x59da43[_0x7041('0x13')],_0x3e76bb);_0x37d842(_0x138786[_0x7041('0x12')](0x1f4,_0x59da43[_0x7041('0x13')]));});});};exports[_0x7041('0x20')]=function(_0x507635){var _0x4c5457=this;return new Promise(function(_0x357777,_0x3ec7d7){return db[_0x7041('0x16')][_0x7041('0x21')]({'raw':_0x507635[_0x7041('0x18')]?_0x507635[_0x7041('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x507635[_0x7041('0x18')]?_0x507635[_0x7041('0x18')][_0x7041('0x22')]||null:null,'attributes':_0x507635['options']?_0x507635[_0x7041('0x18')]['attributes']||null:null,'include':_0x507635['options']?_0x507635[_0x7041('0x18')][_0x7041('0x1b')]?_[_0x7041('0x1c')](_0x507635[_0x7041('0x18')][_0x7041('0x1b')],function(_0x3335d9){return{'model':db[_0x3335d9[_0x7041('0x1d')]],'as':_0x3335d9['as'],'attributes':_0x3335d9[_0x7041('0x1e')],'include':_0x3335d9[_0x7041('0x1b')]?_['map'](_0x3335d9['include'],function(_0x3afe2e){return{'model':db[_0x3afe2e[_0x7041('0x1d')]],'as':_0x3afe2e['as'],'attributes':_0x3afe2e[_0x7041('0x1e')],'include':_0x3afe2e[_0x7041('0x1b')]?_[_0x7041('0x1c')](_0x3afe2e[_0x7041('0x1b')],function(_0x1485e7){return{'model':db[_0x1485e7[_0x7041('0x1d')]],'as':_0x1485e7['as'],'attributes':_0x1485e7[_0x7041('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7041('0xc')](function(_0x5dbdec){logger[_0x7041('0x23')]('ShowTrigger',_0x507635);logger[_0x7041('0xf')](_0x7041('0x20'),_0x507635,JSON[_0x7041('0x11')](_0x5dbdec));_0x357777(_0x5dbdec);})[_0x7041('0x15')](function(_0x5a354a){logger[_0x7041('0x12')](_0x7041('0x20'),_0x5a354a[_0x7041('0x13')],_0x507635);_0x3ec7d7(_0x4c5457['error'](0x1f4,_0x5a354a[_0x7041('0x13')]));});});}; \ No newline at end of file +var _0x0bb7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowTrigger','lodash','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0bb7,0x10d));var _0x70bb=function(_0x2ca32f,_0x172f2d){_0x2ca32f=_0x2ca32f-0x0;var _0xfe824e=_0x0bb7[_0x2ca32f];return _0xfe824e;};'use strict';var _=require(_0x70bb('0x0'));var util=require('util');var moment=require(_0x70bb('0x1'));var BPromise=require(_0x70bb('0x2'));var rs=require(_0x70bb('0x3'));var fs=require('fs');var Redis=require(_0x70bb('0x4'));var db=require(_0x70bb('0x5'))['db'];var utils=require(_0x70bb('0x6'));var logger=require(_0x70bb('0x7'))(_0x70bb('0x8'));var config=require('../../config/environment');var jayson=require(_0x70bb('0x9'));var client=jayson[_0x70bb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x152add,_0x19f82c,_0x542a21){return new BPromise(function(_0x3985c1,_0x1d80fe){return client['request'](_0x152add,_0x542a21)[_0x70bb('0xb')](function(_0x485219){logger[_0x70bb('0xc')](_0x70bb('0xd'),_0x19f82c,_0x70bb('0xe'));logger['debug'](_0x70bb('0xf'),_0x19f82c,_0x70bb('0xe'),JSON[_0x70bb('0x10')](_0x485219));if(_0x485219[_0x70bb('0x11')]){if(_0x485219[_0x70bb('0x11')]['code']===0x1f4){logger[_0x70bb('0x11')]('Trigger,\x20%s,\x20%s',_0x19f82c,_0x485219[_0x70bb('0x11')][_0x70bb('0x12')]);return _0x1d80fe(_0x485219['error']['message']);}logger[_0x70bb('0x11')](_0x70bb('0xd'),_0x19f82c,_0x485219[_0x70bb('0x11')]['message']);return _0x3985c1(_0x485219[_0x70bb('0x11')][_0x70bb('0x12')]);}else{logger[_0x70bb('0xc')](_0x70bb('0xd'),_0x19f82c,_0x70bb('0xe'));_0x3985c1(_0x485219[_0x70bb('0x13')][_0x70bb('0x12')]);}})[_0x70bb('0x14')](function(_0x2a0576){logger['error'](_0x70bb('0xd'),_0x19f82c,_0x2a0576);_0x1d80fe(_0x2a0576);});});}exports[_0x70bb('0x15')]=function(_0x44b2e8){var _0xa5f489=this;return new Promise(function(_0x50f472,_0x316e91){return db[_0x70bb('0x16')][_0x70bb('0x17')]({'raw':_0x44b2e8[_0x70bb('0x18')]?_0x44b2e8['options'][_0x70bb('0x19')]===undefined?!![]:![]:!![],'where':_0x44b2e8[_0x70bb('0x18')]?_0x44b2e8[_0x70bb('0x18')][_0x70bb('0x1a')]||null:null,'attributes':_0x44b2e8[_0x70bb('0x18')]?_0x44b2e8[_0x70bb('0x18')][_0x70bb('0x1b')]||null:null,'limit':_0x44b2e8[_0x70bb('0x18')]?_0x44b2e8[_0x70bb('0x18')][_0x70bb('0x1c')]||null:null,'include':_0x44b2e8[_0x70bb('0x18')]?_0x44b2e8['options'][_0x70bb('0x1d')]?_[_0x70bb('0x1e')](_0x44b2e8[_0x70bb('0x18')][_0x70bb('0x1d')],function(_0x43c47e){return{'model':db[_0x43c47e[_0x70bb('0x1f')]],'as':_0x43c47e['as'],'attributes':_0x43c47e[_0x70bb('0x1b')],'include':_0x43c47e['include']?_['map'](_0x43c47e[_0x70bb('0x1d')],function(_0xb8195e){return{'model':db[_0xb8195e[_0x70bb('0x1f')]],'as':_0xb8195e['as'],'attributes':_0xb8195e[_0x70bb('0x1b')],'include':_0xb8195e[_0x70bb('0x1d')]?_[_0x70bb('0x1e')](_0xb8195e[_0x70bb('0x1d')],function(_0x1df29b){return{'model':db[_0x1df29b['model']],'as':_0x1df29b['as'],'attributes':_0x1df29b['attributes']};}):[]};}):[]};}):[]:[]})[_0x70bb('0xb')](function(_0x5239e7){logger['info'](_0x70bb('0x15'),_0x44b2e8);logger[_0x70bb('0x20')]('GetTrigger',_0x44b2e8,JSON[_0x70bb('0x10')](_0x5239e7));_0x50f472(_0x5239e7);})[_0x70bb('0x14')](function(_0x571311){logger[_0x70bb('0x11')](_0x70bb('0x15'),_0x571311['message'],_0x44b2e8);_0x316e91(_0xa5f489['error'](0x1f4,_0x571311['message']));});});};exports['ShowTrigger']=function(_0x3098a4){var _0x50cb80=this;return new Promise(function(_0xc2ad00,_0x341c8b){return db[_0x70bb('0x16')]['find']({'raw':_0x3098a4[_0x70bb('0x18')]?_0x3098a4[_0x70bb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3098a4[_0x70bb('0x18')]?_0x3098a4['options'][_0x70bb('0x1a')]||null:null,'attributes':_0x3098a4[_0x70bb('0x18')]?_0x3098a4[_0x70bb('0x18')][_0x70bb('0x1b')]||null:null,'include':_0x3098a4[_0x70bb('0x18')]?_0x3098a4[_0x70bb('0x18')][_0x70bb('0x1d')]?_[_0x70bb('0x1e')](_0x3098a4[_0x70bb('0x18')]['include'],function(_0x3b5672){return{'model':db[_0x3b5672[_0x70bb('0x1f')]],'as':_0x3b5672['as'],'attributes':_0x3b5672[_0x70bb('0x1b')],'include':_0x3b5672[_0x70bb('0x1d')]?_['map'](_0x3b5672['include'],function(_0x2f3132){return{'model':db[_0x2f3132[_0x70bb('0x1f')]],'as':_0x2f3132['as'],'attributes':_0x2f3132[_0x70bb('0x1b')],'include':_0x2f3132[_0x70bb('0x1d')]?_[_0x70bb('0x1e')](_0x2f3132['include'],function(_0x5a5173){return{'model':db[_0x5a5173[_0x70bb('0x1f')]],'as':_0x5a5173['as'],'attributes':_0x5a5173[_0x70bb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x70bb('0xb')](function(_0x55fd16){logger['info'](_0x70bb('0x21'),_0x3098a4);logger[_0x70bb('0x20')](_0x70bb('0x21'),_0x3098a4,JSON['stringify'](_0x55fd16));_0xc2ad00(_0x55fd16);})[_0x70bb('0x14')](function(_0xdf07d3){logger[_0x70bb('0x11')](_0x70bb('0x21'),_0xdf07d3[_0x70bb('0x12')],_0x3098a4);_0x341c8b(_0x50cb80['error'](0x1f4,_0xdf07d3[_0x70bb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 23d27f6..13825a3 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 _0x19f0=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','put'];(function(_0x3cff0d,_0x1b856a){var _0x4c4c15=function(_0x5f5349){while(--_0x5f5349){_0x3cff0d['push'](_0x3cff0d['shift']());}};_0x4c4c15(++_0x1b856a);}(_0x19f0,0x1b9));var _0x019f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19f0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x019f('0x0'));var util=require(_0x019f('0x1'));var path=require(_0x019f('0x2'));var timeout=require(_0x019f('0x3'));var express=require(_0x019f('0x4'));var router=express[_0x019f('0x5')]();var fs_extra=require(_0x019f('0x6'));var auth=require(_0x019f('0x7'));var interaction=require(_0x019f('0x8'));var config=require(_0x019f('0x9'));var controller=require(_0x019f('0xa'));router[_0x019f('0xb')]('/',auth[_0x019f('0xc')](),controller[_0x019f('0xd')]);router[_0x019f('0xb')](_0x019f('0xe'),auth[_0x019f('0xc')](),controller[_0x019f('0xf')]);router[_0x019f('0x10')](_0x019f('0x11'),auth[_0x019f('0xc')](),controller['clone']);router[_0x019f('0x10')]('/',auth[_0x019f('0xc')](),controller['create']);router[_0x019f('0x12')](_0x019f('0xe'),auth[_0x019f('0xc')](),controller[_0x019f('0x13')]);router[_0x019f('0x14')](_0x019f('0xe'),auth[_0x019f('0xc')](),controller[_0x019f('0x15')]);module[_0x019f('0x16')]=router; \ No newline at end of file +var _0x6632=['Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','post','/:id/clone','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6632,0x1d1));var _0x2663=function(_0x4d35d3,_0x5b167f){_0x4d35d3=_0x4d35d3-0x0;var _0x4dd761=_0x6632[_0x4d35d3];return _0x4dd761;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2663('0x0'));var timeout=require(_0x2663('0x1'));var express=require(_0x2663('0x2'));var router=express[_0x2663('0x3')]();var fs_extra=require(_0x2663('0x4'));var auth=require(_0x2663('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2663('0x6'));var controller=require(_0x2663('0x7'));router['get']('/',auth[_0x2663('0x8')](),controller['index']);router['get']('/:id',auth[_0x2663('0x8')](),controller['show']);router[_0x2663('0x9')](_0x2663('0xa'),auth[_0x2663('0x8')](),controller['clone']);router[_0x2663('0x9')]('/',auth['isAuthenticated'](),controller[_0x2663('0xb')]);router[_0x2663('0xc')](_0x2663('0xd'),auth[_0x2663('0x8')](),controller[_0x2663('0xe')]);router[_0x2663('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2663('0x10')]);module[_0x2663('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 4b84e6e..ca56906 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 _0x7d21=['PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','\x22\x22\x20<>','INTEGER','always','accept','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','nonat','update,nonat','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN'];(function(_0x455a49,_0x441ef7){var _0x2c1e7a=function(_0x3e4d77){while(--_0x3e4d77){_0x455a49['push'](_0x455a49['shift']());}};_0x2c1e7a(++_0x441ef7);}(_0x7d21,0xf2));var _0x17d2=function(_0x48fb54,_0x27f4ee){_0x48fb54=_0x48fb54-0x0;var _0x9fee11=_0x7d21[_0x48fb54];return _0x9fee11;};'use strict';var Sequelize=require(_0x17d2('0x0'));module[_0x17d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x3'),_0x17d2('0x4'),_0x17d2('0x5')),'allowNull':![],'defaultValue':_0x17d2('0x3')},'context':{'type':Sequelize[_0x17d2('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x7'),_0x17d2('0x8'),_0x17d2('0x9'),_0x17d2('0xa'),_0x17d2('0xb'),'PROHIB_PASSED_SCREEN',_0x17d2('0xc'),_0x17d2('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x17d2('0x6')]},'remotesecret':{'type':Sequelize[_0x17d2('0x6')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x65e10){this[_0x17d2('0xe')](_0x17d2('0xf'),_0x65e10?_0x65e10[_0x17d2('0x10')](','):null);},'get':function(){return this[_0x17d2('0x11')](_0x17d2('0xf'))?this[_0x17d2('0x11')](_0x17d2('0xf'))['split'](','):null;},'comment':_0x17d2('0x12')},'dtmfmode':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x13'),_0x17d2('0x14'),_0x17d2('0x15'),_0x17d2('0x16'),_0x17d2('0x17')),'defaultValue':_0x17d2('0x13')},'directmedia':{'type':Sequelize[_0x17d2('0x2')]('yes','no','nonat',_0x17d2('0x18'),_0x17d2('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x17d2('0x6')]},'directmediadeny':{'type':Sequelize[_0x17d2('0x6')]},'nat':{'type':Sequelize[_0x17d2('0x6')],'defaultValue':_0x17d2('0x1b'),'set':function(_0x32ff3d){this[_0x17d2('0xe')](_0x17d2('0x1c'),_0x32ff3d?_0x32ff3d[_0x17d2('0x10')](','):null);},'get':function(){return this[_0x17d2('0x11')](_0x17d2('0x1c'))?this[_0x17d2('0x11')](_0x17d2('0x1c'))[_0x17d2('0x1d')](','):null;},'comment':_0x17d2('0x1e')},'callgroup':{'type':Sequelize[_0x17d2('0x6')]},'namedcallgroup':{'type':Sequelize[_0x17d2('0x6')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x17d2('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x17d2('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x17d2('0x20'),'set':function(_0x582df2){this[_0x17d2('0xe')](_0x17d2('0x21'),_0x582df2?_0x582df2[_0x17d2('0x10')](';'):_0x17d2('0x20'));},'get':function(){return this['getDataValue'](_0x17d2('0x21'))?this[_0x17d2('0x11')](_0x17d2('0x21'))['split'](';'):null;},'comment':_0x17d2('0x22')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x17d2('0x6')],'defaultValue':'port,invite','set':function(_0x16f80b){this[_0x17d2('0xe')]('insecure',_0x16f80b?_0x16f80b[_0x17d2('0x10')](','):null);},'get':function(){return this[_0x17d2('0x11')](_0x17d2('0x23'))?this[_0x17d2('0x11')]('insecure')[_0x17d2('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no','never')},'promiscredir':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x17d2('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x17d2('0x24')},'amaflags':{'type':Sequelize[_0x17d2('0x6')]},'callcounter':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':_0x17d2('0x1a')},'busylevel':{'type':Sequelize[_0x17d2('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x17d2('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x17d2('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x17d2('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x17d2('0x6')]},'videosupport':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no',_0x17d2('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x17d2('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x27'),'refuse',_0x17d2('0x28'))},'session_expires':{'type':Sequelize[_0x17d2('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x17d2('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x17d2('0x29'),'uas'),'defaultValue':_0x17d2('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x17d2('0x6')]},'regexten':{'type':Sequelize[_0x17d2('0x6')]},'fromdomain':{'type':Sequelize[_0x17d2('0x6')]},'fromuser':{'type':Sequelize[_0x17d2('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':_0x17d2('0x1a')},'keepalive':{'type':Sequelize[_0x17d2('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x17d2('0x6')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x17d2('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x17d2('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x17d2('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no',_0x17d2('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x17d2('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x17d2('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x17d2('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x17d2('0x6')]},'contactacl':{'type':Sequelize[_0x17d2('0x6')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x17d2('0x6')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x17d2('0x2')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x17d2('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x17d2('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x17d2('0x1a'),'no',_0x17d2('0x2c'),_0x17d2('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x17d2('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x17d2('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x17d2('0x6')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x17d2('0x6')]},'dtlscapath':{'type':Sequelize[_0x17d2('0x6')]},'dtlssetup':{'type':Sequelize[_0x17d2('0x2')]('active',_0x17d2('0x2e'),_0x17d2('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x17d2('0x6')]},'usereqphone':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x17d2('0x6')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x17d2('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x17d2('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x17d2('0x6')]},'mohinterpret':{'type':Sequelize[_0x17d2('0x6')]},'mohsuggest':{'type':Sequelize[_0x17d2('0x6')]},'parkinglot':{'type':Sequelize[_0x17d2('0x6')]},'description':{'type':Sequelize[_0x17d2('0x6')]},'host':{'type':Sequelize[_0x17d2('0x6')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x17d2('0x2')](_0x17d2('0x1a'),'no',_0x17d2('0x30'),_0x17d2('0x18'),_0x17d2('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x17d2('0x6')]},'otherFields':{'type':Sequelize[_0x17d2('0x6')]},'active':{'type':Sequelize[_0x17d2('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x17d2('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0a33=['yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','info','shortinfo','inband','rfc2833','nonat','update','outgoing'];(function(_0x2803dc,_0x1cdaf1){var _0x552ae4=function(_0x15f1ef){while(--_0x15f1ef){_0x2803dc['push'](_0x2803dc['shift']());}};_0x552ae4(++_0x1cdaf1);}(_0x0a33,0x72));var _0x30a3=function(_0x419dd8,_0x3aef16){_0x419dd8=_0x419dd8-0x0;var _0x4d7983=_0x0a33[_0x419dd8];return _0x4d7983;};'use strict';var Sequelize=require('sequelize');module[_0x30a3('0x0')]={'name':{'type':Sequelize[_0x30a3('0x1')],'allowNull':![],'unique':_0x30a3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x4'),_0x30a3('0x5'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x30a3('0x1')],'allowNull':![],'defaultValue':_0x30a3('0x6')},'callingpres':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x7'),'ALLOWED_PASSED_SCREEN',_0x30a3('0x8'),_0x30a3('0x9'),'PROHIB_NOT_SCREENED',_0x30a3('0xa'),_0x30a3('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x30a3('0x1')]},'permit':{'type':Sequelize[_0x30a3('0x1')]},'secret':{'type':Sequelize[_0x30a3('0x1')]},'md5secret':{'type':Sequelize[_0x30a3('0x1')]},'remotesecret':{'type':Sequelize[_0x30a3('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x4258f0){this[_0x30a3('0xc')](_0x30a3('0xd'),_0x4258f0?_0x4258f0[_0x30a3('0xe')](','):null);},'get':function(){return this[_0x30a3('0xf')](_0x30a3('0xd'))?this[_0x30a3('0xf')](_0x30a3('0xd'))[_0x30a3('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x30a3('0x11'),_0x30a3('0x12'),_0x30a3('0x13'),'auto'),'defaultValue':_0x30a3('0x14')},'directmedia':{'type':Sequelize[_0x30a3('0x3')]('yes','no',_0x30a3('0x15'),_0x30a3('0x16'),_0x30a3('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x30a3('0x1')]},'directmediadeny':{'type':Sequelize[_0x30a3('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x417cb9){this['setDataValue'](_0x30a3('0x19'),_0x417cb9?_0x417cb9[_0x30a3('0xe')](','):null);},'get':function(){return this[_0x30a3('0xf')]('nat')?this[_0x30a3('0xf')]('nat')[_0x30a3('0x10')](','):null;},'comment':_0x30a3('0x1a')},'callgroup':{'type':Sequelize[_0x30a3('0x1')]},'namedcallgroup':{'type':Sequelize[_0x30a3('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x30a3('0x1')]},'language':{'type':Sequelize[_0x30a3('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x30a3('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x30a3('0x1')],'defaultValue':_0x30a3('0x1b')},'allow':{'type':Sequelize[_0x30a3('0x1')],'allowNull':![],'defaultValue':_0x30a3('0x1c'),'set':function(_0x1c67ac){this[_0x30a3('0xc')](_0x30a3('0x1d'),_0x1c67ac?_0x1c67ac[_0x30a3('0xe')](';'):_0x30a3('0x1c'));},'get':function(){return this[_0x30a3('0xf')]('allow')?this[_0x30a3('0xf')](_0x30a3('0x1d'))[_0x30a3('0x10')](';'):null;},'comment':_0x30a3('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x30a3('0x18'),'no')},'insecure':{'type':Sequelize[_0x30a3('0x1')],'defaultValue':_0x30a3('0x1f'),'set':function(_0x30d2d7){this[_0x30a3('0xc')](_0x30a3('0x20'),_0x30d2d7?_0x30d2d7['join'](','):null);},'get':function(){return this['getDataValue'](_0x30a3('0x20'))?this[_0x30a3('0xf')]('insecure')[_0x30a3('0x10')](','):null;},'comment':_0x30a3('0x21')},'trustrpid':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x30a3('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x30a3('0x1')]},'callerid':{'type':Sequelize[_0x30a3('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x30a3('0x1')]},'callcounter':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x30a3('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x30a3('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x30a3('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x30a3('0x1')]},'videosupport':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no',_0x30a3('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x30a3('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no')},'mailbox':{'type':Sequelize[_0x30a3('0x1')]},'session_timers':{'type':Sequelize[_0x30a3('0x3')]('accept',_0x30a3('0x24'),'originate')},'session_expires':{'type':Sequelize[_0x30a3('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x30a3('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x25'),_0x30a3('0x26')),'defaultValue':_0x30a3('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x30a3('0x1')]},'regexten':{'type':Sequelize[_0x30a3('0x1')]},'fromdomain':{'type':Sequelize[_0x30a3('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x30a3('0x22')](0x5)},'qualify':{'type':Sequelize[_0x30a3('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x30a3('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x30a3('0x1')]},'rtptimeout':{'type':Sequelize[_0x30a3('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x30a3('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x30a3('0x3')]('yes','no',_0x30a3('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x30a3('0x1')]},'callbackextension':{'type':Sequelize[_0x30a3('0x1')]},'timert1':{'type':Sequelize[_0x30a3('0x22')](0xb)},'timerb':{'type':Sequelize[_0x30a3('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x30a3('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x30a3('0x1')]},'contactacl':{'type':Sequelize[_0x30a3('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x30a3('0x1')]},'use_q850_reason':{'type':Sequelize[_0x30a3('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x30a3('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no')},'force_avp':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x30a3('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x30a3('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x30a3('0x3')]('yes','no',_0x30a3('0x28'),_0x30a3('0x29'))},'dtlsrekey':{'type':Sequelize[_0x30a3('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x30a3('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x30a3('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x2a'),_0x30a3('0x2b'),_0x30a3('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x30a3('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x30a3('0x1')]},'call_limit':{'type':Sequelize[_0x30a3('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x30a3('0x1')]},'mohinterpret':{'type':Sequelize[_0x30a3('0x1')]},'mohsuggest':{'type':Sequelize[_0x30a3('0x1')]},'parkinglot':{'type':Sequelize[_0x30a3('0x1')]},'description':{'type':Sequelize[_0x30a3('0x1')]},'host':{'type':Sequelize[_0x30a3('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x30a3('0x3')](_0x30a3('0x18'),'no',_0x30a3('0x15'),_0x30a3('0x16'),_0x30a3('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x30a3('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x30a3('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 89b7b1d..c5b9c3f 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x3bc4b8,_0x628952){var _0x5af8c5=function(_0x48302a){while(--_0x48302a){_0x3bc4b8['push'](_0x3bc4b8['shift']());}};_0x5af8c5(++_0x628952);}(_0x6aa7,0x178));var _0x76aa=function(_0x5790fe,_0x44875c){_0x5790fe=_0x5790fe-0x0;var _0x111f5b=_0x6aa7[_0x5790fe];return _0x111f5b;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5ee2db,_0x47ea25){_0x5ee2db=_0x5ee2db-0x0;var _0x2cab07=_0xe5b3[_0x5ee2db];return _0x2cab07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7a9f368..ee515dc 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 _0xfc6f=['moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','Trunk','lodash','util','../../config/logger'];(function(_0x5e50db,_0x567125){var _0x5cc6ff=function(_0x1964e6){while(--_0x1964e6){_0x5e50db['push'](_0x5e50db['shift']());}};_0x5cc6ff(++_0x567125);}(_0xfc6f,0x1c9));var _0xffc6=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xfc6f[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xffc6('0x0'));var util=require(_0xffc6('0x1'));var logger=require(_0xffc6('0x2'))('api');var moment=require(_0xffc6('0x3'));var BPromise=require(_0xffc6('0x4'));var rp=require(_0xffc6('0x5'));var fs=require('fs');var path=require(_0xffc6('0x6'));var rimraf=require('rimraf');var config=require(_0xffc6('0x7'));var attributes=require(_0xffc6('0x8'));module['exports']=function(_0xcf360d,_0x3ee505){return _0xcf360d['define'](_0xffc6('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17e4=['bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x17e4,0xf9));var _0x417e=function(_0x422acb,_0x414746){_0x422acb=_0x422acb-0x0;var _0x552da1=_0x17e4[_0x422acb];return _0x552da1;};'use strict';var _=require(_0x417e('0x0'));var util=require(_0x417e('0x1'));var logger=require(_0x417e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x417e('0x3'));var rp=require(_0x417e('0x4'));var fs=require('fs');var path=require(_0x417e('0x5'));var rimraf=require(_0x417e('0x6'));var config=require(_0x417e('0x7'));var attributes=require(_0x417e('0x8'));module[_0x417e('0x9')]=function(_0x13d02d,_0x450404){return _0x13d02d[_0x417e('0xa')]('Trunk',attributes,{'tableName':_0x417e('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 efeddfd..16ba96d 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 _0xa6d1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','where','limit','include','model','map','attributes','ShowTrunk','find','raw','lodash','util','moment','bluebird'];(function(_0x478f7e,_0x39478f){var _0xd7e3c9=function(_0x477a1a){while(--_0x477a1a){_0x478f7e['push'](_0x478f7e['shift']());}};_0xd7e3c9(++_0x39478f);}(_0xa6d1,0xf8));var _0x1a6d=function(_0x58d1ba,_0x16d0a7){_0x58d1ba=_0x58d1ba-0x0;var _0x199fdc=_0xa6d1[_0x58d1ba];return _0x199fdc;};'use strict';var _=require(_0x1a6d('0x0'));var util=require(_0x1a6d('0x1'));var moment=require(_0x1a6d('0x2'));var BPromise=require(_0x1a6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a6d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a6d('0x5'));var logger=require(_0x1a6d('0x6'))(_0x1a6d('0x7'));var config=require(_0x1a6d('0x8'));var jayson=require(_0x1a6d('0x9'));var client=jayson['client'][_0x1a6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc2c17,_0x707fe,_0x445c7a){return new BPromise(function(_0x97522d,_0x52f8f0){return client[_0x1a6d('0xb')](_0xfc2c17,_0x445c7a)[_0x1a6d('0xc')](function(_0x34d03e){logger[_0x1a6d('0xd')](_0x1a6d('0xe'),_0x707fe,'request\x20sent');logger[_0x1a6d('0xf')](_0x1a6d('0x10'),_0x707fe,_0x1a6d('0x11'),JSON[_0x1a6d('0x12')](_0x34d03e));if(_0x34d03e[_0x1a6d('0x13')]){if(_0x34d03e[_0x1a6d('0x13')][_0x1a6d('0x14')]===0x1f4){logger['error'](_0x1a6d('0xe'),_0x707fe,_0x34d03e['error'][_0x1a6d('0x15')]);return _0x52f8f0(_0x34d03e[_0x1a6d('0x13')][_0x1a6d('0x15')]);}logger[_0x1a6d('0x13')]('Trunk,\x20%s,\x20%s',_0x707fe,_0x34d03e[_0x1a6d('0x13')][_0x1a6d('0x15')]);return _0x97522d(_0x34d03e[_0x1a6d('0x13')][_0x1a6d('0x15')]);}else{logger[_0x1a6d('0xd')](_0x1a6d('0xe'),_0x707fe,_0x1a6d('0x11'));_0x97522d(_0x34d03e[_0x1a6d('0x16')][_0x1a6d('0x15')]);}})[_0x1a6d('0x17')](function(_0xae82f9){logger[_0x1a6d('0x13')](_0x1a6d('0xe'),_0x707fe,_0xae82f9);_0x52f8f0(_0xae82f9);});});}exports[_0x1a6d('0x18')]=function(_0x859af){var _0x2745fa=this;return new Promise(function(_0x3b95e7,_0x382174){return db[_0x1a6d('0x19')]['findAll']({'raw':_0x859af['options']?_0x859af[_0x1a6d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x859af[_0x1a6d('0x1a')]?_0x859af[_0x1a6d('0x1a')][_0x1a6d('0x1b')]||null:null,'attributes':_0x859af['options']?_0x859af[_0x1a6d('0x1a')]['attributes']||null:null,'limit':_0x859af[_0x1a6d('0x1a')]?_0x859af['options'][_0x1a6d('0x1c')]||null:null,'include':_0x859af['options']?_0x859af[_0x1a6d('0x1a')][_0x1a6d('0x1d')]?_['map'](_0x859af[_0x1a6d('0x1a')][_0x1a6d('0x1d')],function(_0x1b0959){return{'model':db[_0x1b0959[_0x1a6d('0x1e')]],'as':_0x1b0959['as'],'attributes':_0x1b0959['attributes'],'include':_0x1b0959[_0x1a6d('0x1d')]?_[_0x1a6d('0x1f')](_0x1b0959[_0x1a6d('0x1d')],function(_0x5ab6d9){return{'model':db[_0x5ab6d9[_0x1a6d('0x1e')]],'as':_0x5ab6d9['as'],'attributes':_0x5ab6d9[_0x1a6d('0x20')],'include':_0x5ab6d9['include']?_[_0x1a6d('0x1f')](_0x5ab6d9[_0x1a6d('0x1d')],function(_0x3410ea){return{'model':db[_0x3410ea['model']],'as':_0x3410ea['as'],'attributes':_0x3410ea['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a6d('0xc')](function(_0x2c5622){logger['info'](_0x1a6d('0x18'),_0x859af);logger['debug']('GetTrunk',_0x859af,JSON['stringify'](_0x2c5622));_0x3b95e7(_0x2c5622);})[_0x1a6d('0x17')](function(_0x587285){logger[_0x1a6d('0x13')](_0x1a6d('0x18'),_0x587285[_0x1a6d('0x15')],_0x859af);_0x382174(_0x2745fa[_0x1a6d('0x13')](0x1f4,_0x587285[_0x1a6d('0x15')]));});});};exports[_0x1a6d('0x21')]=function(_0x1014f5){var _0x2fa34e=this;return new Promise(function(_0x180b1e,_0x5da2a9){return db['Trunk'][_0x1a6d('0x22')]({'raw':_0x1014f5[_0x1a6d('0x1a')]?_0x1014f5[_0x1a6d('0x1a')][_0x1a6d('0x23')]===undefined?!![]:![]:!![],'where':_0x1014f5[_0x1a6d('0x1a')]?_0x1014f5[_0x1a6d('0x1a')][_0x1a6d('0x1b')]||null:null,'attributes':_0x1014f5[_0x1a6d('0x1a')]?_0x1014f5[_0x1a6d('0x1a')][_0x1a6d('0x20')]||null:null,'include':_0x1014f5[_0x1a6d('0x1a')]?_0x1014f5[_0x1a6d('0x1a')]['include']?_[_0x1a6d('0x1f')](_0x1014f5['options'][_0x1a6d('0x1d')],function(_0x5ba7bb){return{'model':db[_0x5ba7bb[_0x1a6d('0x1e')]],'as':_0x5ba7bb['as'],'attributes':_0x5ba7bb['attributes'],'include':_0x5ba7bb['include']?_[_0x1a6d('0x1f')](_0x5ba7bb[_0x1a6d('0x1d')],function(_0x1e8acd){return{'model':db[_0x1e8acd[_0x1a6d('0x1e')]],'as':_0x1e8acd['as'],'attributes':_0x1e8acd[_0x1a6d('0x20')],'include':_0x1e8acd[_0x1a6d('0x1d')]?_['map'](_0x1e8acd[_0x1a6d('0x1d')],function(_0x457a27){return{'model':db[_0x457a27[_0x1a6d('0x1e')]],'as':_0x457a27['as'],'attributes':_0x457a27['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a6d('0xc')](function(_0x226015){logger[_0x1a6d('0xd')]('ShowTrunk',_0x1014f5);logger[_0x1a6d('0xf')](_0x1a6d('0x21'),_0x1014f5,JSON[_0x1a6d('0x12')](_0x226015));_0x180b1e(_0x226015);})['catch'](function(_0xe7dcb2){logger[_0x1a6d('0x13')](_0x1a6d('0x21'),_0xe7dcb2[_0x1a6d('0x15')],_0x1014f5);_0x5da2a9(_0x2fa34e[_0x1a6d('0x13')](0x1f4,_0xe7dcb2[_0x1a6d('0x15')]));});});}; \ No newline at end of file +var _0xfb0d=['Trunk','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowTrunk'];(function(_0x3c6e26,_0x4ada02){var _0x21f37b=function(_0x28a538){while(--_0x28a538){_0x3c6e26['push'](_0x3c6e26['shift']());}};_0x21f37b(++_0x4ada02);}(_0xfb0d,0x134));var _0xdfb0=function(_0x4aa4f6,_0x2e70a1){_0x4aa4f6=_0x4aa4f6-0x0;var _0x5e540b=_0xfb0d[_0x4aa4f6];return _0x5e540b;};'use strict';var _=require('lodash');var util=require(_0xdfb0('0x0'));var moment=require(_0xdfb0('0x1'));var BPromise=require(_0xdfb0('0x2'));var rs=require(_0xdfb0('0x3'));var fs=require('fs');var Redis=require(_0xdfb0('0x4'));var db=require(_0xdfb0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfb0('0x6'))('rpc');var config=require(_0xdfb0('0x7'));var jayson=require(_0xdfb0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27a9fd,_0x36fe63,_0x29309a){return new BPromise(function(_0x2daf9b,_0x4c64f6){return client[_0xdfb0('0x9')](_0x27a9fd,_0x29309a)['then'](function(_0x4489b5){logger[_0xdfb0('0xa')]('Trunk,\x20%s,\x20%s',_0x36fe63,_0xdfb0('0xb'));logger['debug'](_0xdfb0('0xc'),_0x36fe63,_0xdfb0('0xb'),JSON[_0xdfb0('0xd')](_0x4489b5));if(_0x4489b5[_0xdfb0('0xe')]){if(_0x4489b5[_0xdfb0('0xe')][_0xdfb0('0xf')]===0x1f4){logger[_0xdfb0('0xe')]('Trunk,\x20%s,\x20%s',_0x36fe63,_0x4489b5[_0xdfb0('0xe')]['message']);return _0x4c64f6(_0x4489b5['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x36fe63,_0x4489b5['error'][_0xdfb0('0x10')]);return _0x2daf9b(_0x4489b5[_0xdfb0('0xe')][_0xdfb0('0x10')]);}else{logger[_0xdfb0('0xa')](_0xdfb0('0x11'),_0x36fe63,_0xdfb0('0xb'));_0x2daf9b(_0x4489b5['result'][_0xdfb0('0x10')]);}})[_0xdfb0('0x12')](function(_0x474f12){logger[_0xdfb0('0xe')]('Trunk,\x20%s,\x20%s',_0x36fe63,_0x474f12);_0x4c64f6(_0x474f12);});});}exports[_0xdfb0('0x13')]=function(_0x9f8df8){var _0xe327ce=this;return new Promise(function(_0x82baca,_0x3fc42e){return db['Trunk'][_0xdfb0('0x14')]({'raw':_0x9f8df8['options']?_0x9f8df8[_0xdfb0('0x15')][_0xdfb0('0x16')]===undefined?!![]:![]:!![],'where':_0x9f8df8[_0xdfb0('0x15')]?_0x9f8df8[_0xdfb0('0x15')][_0xdfb0('0x17')]||null:null,'attributes':_0x9f8df8[_0xdfb0('0x15')]?_0x9f8df8[_0xdfb0('0x15')][_0xdfb0('0x18')]||null:null,'limit':_0x9f8df8[_0xdfb0('0x15')]?_0x9f8df8[_0xdfb0('0x15')][_0xdfb0('0x19')]||null:null,'include':_0x9f8df8[_0xdfb0('0x15')]?_0x9f8df8[_0xdfb0('0x15')][_0xdfb0('0x1a')]?_[_0xdfb0('0x1b')](_0x9f8df8[_0xdfb0('0x15')]['include'],function(_0x152550){return{'model':db[_0x152550['model']],'as':_0x152550['as'],'attributes':_0x152550[_0xdfb0('0x18')],'include':_0x152550[_0xdfb0('0x1a')]?_[_0xdfb0('0x1b')](_0x152550[_0xdfb0('0x1a')],function(_0x4ff157){return{'model':db[_0x4ff157[_0xdfb0('0x1c')]],'as':_0x4ff157['as'],'attributes':_0x4ff157[_0xdfb0('0x18')],'include':_0x4ff157[_0xdfb0('0x1a')]?_[_0xdfb0('0x1b')](_0x4ff157[_0xdfb0('0x1a')],function(_0x10fd3e){return{'model':db[_0x10fd3e[_0xdfb0('0x1c')]],'as':_0x10fd3e['as'],'attributes':_0x10fd3e[_0xdfb0('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdfb0('0x1d')](function(_0x159976){logger[_0xdfb0('0xa')](_0xdfb0('0x13'),_0x9f8df8);logger[_0xdfb0('0x1e')](_0xdfb0('0x13'),_0x9f8df8,JSON[_0xdfb0('0xd')](_0x159976));_0x82baca(_0x159976);})[_0xdfb0('0x12')](function(_0x5858c5){logger[_0xdfb0('0xe')](_0xdfb0('0x13'),_0x5858c5[_0xdfb0('0x10')],_0x9f8df8);_0x3fc42e(_0xe327ce[_0xdfb0('0xe')](0x1f4,_0x5858c5[_0xdfb0('0x10')]));});});};exports[_0xdfb0('0x1f')]=function(_0x454208){var _0x40033f=this;return new Promise(function(_0x2a0741,_0x3bd842){return db[_0xdfb0('0x20')][_0xdfb0('0x21')]({'raw':_0x454208[_0xdfb0('0x15')]?_0x454208[_0xdfb0('0x15')][_0xdfb0('0x16')]===undefined?!![]:![]:!![],'where':_0x454208[_0xdfb0('0x15')]?_0x454208[_0xdfb0('0x15')][_0xdfb0('0x17')]||null:null,'attributes':_0x454208[_0xdfb0('0x15')]?_0x454208[_0xdfb0('0x15')]['attributes']||null:null,'include':_0x454208[_0xdfb0('0x15')]?_0x454208[_0xdfb0('0x15')][_0xdfb0('0x1a')]?_[_0xdfb0('0x1b')](_0x454208[_0xdfb0('0x15')]['include'],function(_0x95f132){return{'model':db[_0x95f132[_0xdfb0('0x1c')]],'as':_0x95f132['as'],'attributes':_0x95f132[_0xdfb0('0x18')],'include':_0x95f132[_0xdfb0('0x1a')]?_[_0xdfb0('0x1b')](_0x95f132[_0xdfb0('0x1a')],function(_0x53a7bb){return{'model':db[_0x53a7bb[_0xdfb0('0x1c')]],'as':_0x53a7bb['as'],'attributes':_0x53a7bb['attributes'],'include':_0x53a7bb['include']?_[_0xdfb0('0x1b')](_0x53a7bb['include'],function(_0x6c9a4){return{'model':db[_0x6c9a4['model']],'as':_0x6c9a4['as'],'attributes':_0x6c9a4[_0xdfb0('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdfb0('0x1d')](function(_0x2c99e0){logger[_0xdfb0('0xa')](_0xdfb0('0x1f'),_0x454208);logger[_0xdfb0('0x1e')](_0xdfb0('0x1f'),_0x454208,JSON['stringify'](_0x2c99e0));_0x2a0741(_0x2c99e0);})['catch'](function(_0x707e14){logger[_0xdfb0('0xe')](_0xdfb0('0x1f'),_0x707e14[_0xdfb0('0x10')],_0x454208);_0x3bd842(_0x40033f[_0xdfb0('0xe')](0x1f4,_0x707e14[_0xdfb0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a1b56a3..a8d558c 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 _0x7cc9=['Router','./user-setting.controller','put','/:id','update','exports','express'];(function(_0x11ad99,_0x4eabe0){var _0x29d8d1=function(_0x352aeb){while(--_0x352aeb){_0x11ad99['push'](_0x11ad99['shift']());}};_0x29d8d1(++_0x4eabe0);}(_0x7cc9,0x13a));var _0x97cc=function(_0x6a7421,_0x20b4f5){_0x6a7421=_0x6a7421-0x0;var _0x33f5d1=_0x7cc9[_0x6a7421];return _0x33f5d1;};'use strict';var express=require(_0x97cc('0x0'));var router=express[_0x97cc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x97cc('0x2'));router[_0x97cc('0x3')](_0x97cc('0x4'),auth['isAuthenticated'](),controller[_0x97cc('0x5')]);module[_0x97cc('0x6')]=router; \ No newline at end of file +var _0x4a6a=['./user-setting.controller','/:id','isAuthenticated','update','express','Router','../../components/auth/service'];(function(_0x4e05ea,_0x1a33e3){var _0x14a86a=function(_0x2773af){while(--_0x2773af){_0x4e05ea['push'](_0x4e05ea['shift']());}};_0x14a86a(++_0x1a33e3);}(_0x4a6a,0xdd));var _0xa4a6=function(_0x241cfc,_0x5b30a1){_0x241cfc=_0x241cfc-0x0;var _0x49f4f1=_0x4a6a[_0x241cfc];return _0x49f4f1;};'use strict';var express=require(_0xa4a6('0x0'));var router=express[_0xa4a6('0x1')]();var auth=require(_0xa4a6('0x2'));var controller=require(_0xa4a6('0x3'));router['put'](_0xa4a6('0x4'),auth[_0xa4a6('0x5')](),controller[_0xa4a6('0x6')]);module['exports']=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 4c50f89..c9d83c2 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 _0xb573=['ENUM','error','INTEGER','sequelize','warning','debug','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb573,0x8f));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3b57('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x3b57('0x1'),'info',_0x3b57('0x2')];module[_0x3b57('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3b57('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3b57('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3b57('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0x1f10=['exports','ENUM','error','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','warning','debug'];(function(_0x44519e,_0x18a02b){var _0x2fbb31=function(_0x482580){while(--_0x482580){_0x44519e['push'](_0x44519e['shift']());}};_0x2fbb31(++_0x18a02b);}(_0x1f10,0x110));var _0x01f1=function(_0xb31439,_0x23f81f){_0xb31439=_0xb31439-0x0;var _0x7a494c=_0x1f10[_0xb31439];return _0x7a494c;};'use strict';var Sequelize=require(_0x01f1('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x01f1('0x1'),'info',_0x01f1('0x2')];module[_0x01f1('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x01f1('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x01f1('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x01f1('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x01f1('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x01f1('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x01f1('0x9')],'unique':_0x01f1('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 0d4921d..6d44f63 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 _0x1df5=['catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','Unauthorized','params','UserSetting','find','body'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1df5,0xfd));var _0x51df=function(_0x2103e2,_0x431e65){_0x2103e2=_0x2103e2-0x0;var _0x5b3ca6=_0x1df5[_0x2103e2];return _0x5b3ca6;};'use strict';var _=require(_0x51df('0x0'));var Redis=require(_0x51df('0x1'));var logger=require(_0x51df('0x2'))(_0x51df('0x3'));var config=require(_0x51df('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x51df('0x5'))(new Redis(config[_0x51df('0x6')]));require(_0x51df('0x7'))[_0x51df('0x8')](socket);config[_0x51df('0x6')]=_[_0x51df('0x9')](config[_0x51df('0x6')],{'host':_0x51df('0xa'),'port':0x18eb});function respondWithResult(_0x50961e,_0x1316c2){_0x1316c2=_0x1316c2||0xc8;return function(_0x53b879){if(_0x53b879){return _0x50961e[_0x51df('0xb')](_0x1316c2)[_0x51df('0xc')](_0x53b879);}};}function saveUpdates(_0x8dbf50){return function(_0x264d7f){if(_0x264d7f){return _0x264d7f[_0x51df('0xd')](_0x8dbf50)[_0x51df('0xe')](function(_0x6ebea){return _0x6ebea;});}return null;};}function handleEntityNotFound(_0x45c6f5){return function(_0x5f0736){if(!_0x5f0736){_0x45c6f5[_0x51df('0xf')](0x194);}return _0x5f0736;};}function handleError(_0xf92e25,_0x3b23bc){_0x3b23bc=_0x3b23bc||0x1f4;return function(_0x26e508){logger[_0x51df('0x10')](_0x26e508[_0x51df('0x11')]);if(_0x26e508[_0x51df('0x12')]){delete _0x26e508[_0x51df('0x12')];}_0xf92e25[_0x51df('0xb')](_0x3b23bc)[_0x51df('0x13')](_0x26e508);};}exports[_0x51df('0xd')]=function(_0x38efc5,_0x2315f6){if(_0x38efc5[_0x51df('0x14')][_0x51df('0x15')]!=='admin')throw new Error(_0x51df('0x16'));if(isNaN(Number(_0x38efc5[_0x51df('0x17')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x51df('0x18')][_0x51df('0x19')]({'where':{'id':_0x38efc5[_0x51df('0x17')]['id']}})['then'](handleEntityNotFound(_0x2315f6,null))[_0x51df('0xe')](saveUpdates(_0x38efc5[_0x51df('0x1a')],null))[_0x51df('0xe')](respondWithResult(_0x2315f6,null))[_0x51df('0x1b')](handleError(_0x2315f6,null));}; \ No newline at end of file +var _0x818f=['json','then','sendStatus','error','stack','name','send','update','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','status'];(function(_0x1c214f,_0x3d3abf){var _0x1d8052=function(_0xab5bf8){while(--_0xab5bf8){_0x1c214f['push'](_0x1c214f['shift']());}};_0x1d8052(++_0x3d3abf);}(_0x818f,0x1da));var _0xf818=function(_0x272f4b,_0x4bbcef){_0x272f4b=_0x272f4b-0x0;var _0x44751b=_0x818f[_0x272f4b];return _0x44751b;};'use strict';var _=require(_0xf818('0x0'));var Redis=require(_0xf818('0x1'));var logger=require(_0xf818('0x2'))(_0xf818('0x3'));var config=require(_0xf818('0x4'));var db=require(_0xf818('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xf818('0x6')]));require(_0xf818('0x7'))[_0xf818('0x8')](socket);config[_0xf818('0x6')]=_[_0xf818('0x9')](config[_0xf818('0x6')],{'host':_0xf818('0xa'),'port':0x18eb});function respondWithResult(_0x42a23e,_0x860f80){_0x860f80=_0x860f80||0xc8;return function(_0x55540d){if(_0x55540d){return _0x42a23e[_0xf818('0xb')](_0x860f80)[_0xf818('0xc')](_0x55540d);}};}function saveUpdates(_0xd37725){return function(_0x4987b0){if(_0x4987b0){return _0x4987b0['update'](_0xd37725)[_0xf818('0xd')](function(_0x188f49){return _0x188f49;});}return null;};}function handleEntityNotFound(_0x458873){return function(_0x3386f9){if(!_0x3386f9){_0x458873[_0xf818('0xe')](0x194);}return _0x3386f9;};}function handleError(_0x4accdc,_0x373d66){_0x373d66=_0x373d66||0x1f4;return function(_0x2b1f0e){logger[_0xf818('0xf')](_0x2b1f0e[_0xf818('0x10')]);if(_0x2b1f0e[_0xf818('0x11')]){delete _0x2b1f0e['name'];}_0x4accdc['status'](_0x373d66)[_0xf818('0x12')](_0x2b1f0e);};}exports[_0xf818('0x13')]=function(_0x950109,_0x42fde5){if(_0x950109['user'][_0xf818('0x14')]!==_0xf818('0x15'))throw new Error(_0xf818('0x16'));if(isNaN(Number(_0x950109[_0xf818('0x17')]['id'])))throw new Error(_0xf818('0x18'));return db['UserSetting']['find']({'where':{'id':_0x950109[_0xf818('0x17')]['id']}})['then'](handleEntityNotFound(_0x42fde5,null))[_0xf818('0xd')](saveUpdates(_0x950109[_0xf818('0x19')],null))['then'](respondWithResult(_0x42fde5,null))[_0xf818('0x1a')](handleError(_0x42fde5,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 722e20b..7cb3165 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 _0x15c8=['hasOwnProperty','events','UserSetting','save','update','emit'];(function(_0x435c6d,_0x53bc73){var _0x2d9e57=function(_0x1c4d98){while(--_0x1c4d98){_0x435c6d['push'](_0x435c6d['shift']());}};_0x2d9e57(++_0x53bc73);}(_0x15c8,0x1c9));var _0x815c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x15c8[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x815c('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x815c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x815c('0x2'),'afterUpdate':_0x815c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x199a53){return function(_0xa8f774,_0x43e4e5,_0x2054fe){UserSettingEvents[_0x815c('0x4')](_0x199a53+':'+_0xa8f774['id'],_0xa8f774);UserSettingEvents[_0x815c('0x4')](_0x199a53,_0xa8f774);_0x2054fe(null);};}for(var e in events){if(events[_0x815c('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x57ba=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x137148,_0x217180){var _0x18bc0=function(_0x2abde5){while(--_0x2abde5){_0x137148['push'](_0x137148['shift']());}};_0x18bc0(++_0x217180);}(_0x57ba,0x1b4));var _0xa57b=function(_0x3eb3d1,_0x29f458){_0x3eb3d1=_0x3eb3d1-0x0;var _0x3fb92a=_0x57ba[_0x3eb3d1];return _0x3fb92a;};'use strict';var EventEmitter=require(_0xa57b('0x0'));var UserSetting=require(_0xa57b('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa57b('0x2')](0x0);var events={'afterCreate':_0xa57b('0x3'),'afterUpdate':_0xa57b('0x4'),'afterDestroy':_0xa57b('0x5')};function emitEvent(_0x1e7501){return function(_0x3d384c,_0x5527b7,_0xcddb6f){UserSettingEvents['emit'](_0x1e7501+':'+_0x3d384c['id'],_0x3d384c);UserSettingEvents[_0xa57b('0x6')](_0x1e7501,_0x3d384c);_0xcddb6f(null);};}for(var e in events){if(events[_0xa57b('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xa57b('0x8')]=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 8257b91..055f3cc 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 _0xa8b1=['user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x3f0af3,_0x23daa7){var _0xd1db39=function(_0x4091c8){while(--_0x4091c8){_0x3f0af3['push'](_0x3f0af3['shift']());}};_0xd1db39(++_0x23daa7);}(_0xa8b1,0x182));var _0x1a8b=function(_0xb33fd2,_0x1965ea){_0xb33fd2=_0xb33fd2-0x0;var _0x146858=_0xa8b1[_0xb33fd2];return _0x146858;};'use strict';var attributes=require(_0x1a8b('0x0'));module[_0x1a8b('0x1')]=function(_0x1a339f){return _0x1a339f[_0x1a8b('0x2')](_0x1a8b('0x3'),attributes,{'tableName':_0x1a8b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd654e6){if(!_0xd654e6['clientSideLoggingEnabled'])_0xd654e6['clientSideLoggingEnabledSince']=null;else if(_0xd654e6[_0x1a8b('0x5')]===null)_0xd654e6[_0x1a8b('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x8caf=['user_settings','clientSideLoggingEnabledSince','exports','define','UserSetting'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x2833fd,_0x28c021){_0x2833fd=_0x2833fd-0x0;var _0x3331a0=_0x8caf[_0x2833fd];return _0x3331a0;};'use strict';var attributes=require('./user-setting.attributes');module[_0xf8ca('0x0')]=function(_0x215811){return _0x215811[_0xf8ca('0x1')](_0xf8ca('0x2'),attributes,{'tableName':_0xf8ca('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35d47c){if(!_0x35d47c['clientSideLoggingEnabled'])_0x35d47c[_0xf8ca('0x4')]=null;else if(_0x35d47c[_0xf8ca('0x4')]===null)_0x35d47c[_0xf8ca('0x4')]=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 50ecdce..bfdb612 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 _0xf13e=['./user-setting.events','save','remove','emit','user-setting:update','UserId','register','length','user-setting:'];(function(_0x34513d,_0x1fbca6){var _0x2f89fd=function(_0x2ba88b){while(--_0x2ba88b){_0x34513d['push'](_0x34513d['shift']());}};_0x2f89fd(++_0x1fbca6);}(_0xf13e,0x1cb));var _0xef13=function(_0x3f4ed1,_0x2b5dad){_0x3f4ed1=_0x3f4ed1-0x0;var _0x26b597=_0xf13e[_0x3f4ed1];return _0x26b597;};'use strict';var UserSettingEvents=require(_0xef13('0x0'));var events=[_0xef13('0x1'),_0xef13('0x2'),'update'];function createListener(_0x446bee,_0x2e8141){return function(_0x24dfa4){_0x2e8141[_0xef13('0x3')](_0x446bee,_0x24dfa4);if(_0x446bee===_0xef13('0x4')){_0x2e8141[_0xef13('0x3')]('user-setting:update:user-'+_0x24dfa4[_0xef13('0x5')],_0x24dfa4);}};}exports[_0xef13('0x6')]=function(_0x42878e){for(var _0x5b8d92=0x0,_0x12fc78=events[_0xef13('0x7')];_0x5b8d92<_0x12fc78;_0x5b8d92++){var _0x2fecf1=events[_0x5b8d92];var _0x34a03b=createListener(_0xef13('0x8')+_0x2fecf1,_0x42878e);UserSettingEvents['on'](_0x2fecf1,_0x34a03b);}}; \ No newline at end of file +var _0x1113=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length','save'];(function(_0x5f473d,_0x594305){var _0x310903=function(_0x527af0){while(--_0x527af0){_0x5f473d['push'](_0x5f473d['shift']());}};_0x310903(++_0x594305);}(_0x1113,0x16f));var _0x3111=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x1113[_0xdeefbd];return _0x4ff63f;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x3111('0x0'),_0x3111('0x1'),_0x3111('0x2')];function createListener(_0x4aad0c,_0x5defdd){return function(_0x1a5045){_0x5defdd[_0x3111('0x3')](_0x4aad0c,_0x1a5045);if(_0x4aad0c===_0x3111('0x4')){_0x5defdd[_0x3111('0x3')](_0x3111('0x5')+_0x1a5045[_0x3111('0x6')],_0x1a5045);}};}exports['register']=function(_0x48ba8a){for(var _0x3959a7=0x0,_0x1a0465=events[_0x3111('0x7')];_0x3959a7<_0x1a0465;_0x3959a7++){var _0x29d0db=events[_0x3959a7];var _0x10123d=createListener('user-setting:'+_0x29d0db,_0x48ba8a);UserSettingEvents['on'](_0x29d0db,_0x10123d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1e17377..9e49185 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 _0x845f=['get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x564862,_0x31dc02){var _0x1a846b=function(_0x2fd045){while(--_0x2fd045){_0x564862['push'](_0x564862['shift']());}};_0x1a846b(++_0x31dc02);}(_0x845f,0x1b8));var _0xf845=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x845f[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0xf845('0x0'));var util=require(_0xf845('0x1'));var path=require(_0xf845('0x2'));var timeout=require('connect-timeout');var express=require(_0xf845('0x3'));var router=express[_0xf845('0x4')]();var fs_extra=require(_0xf845('0x5'));var auth=require(_0xf845('0x6'));var interaction=require(_0xf845('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xf845('0x8')]('/',auth[_0xf845('0x9')](),controller[_0xf845('0xa')]);router[_0xf845('0x8')]('/describe',auth[_0xf845('0x9')](),controller[_0xf845('0xb')]);router[_0xf845('0x8')](_0xf845('0xc'),auth[_0xf845('0x9')](),controller[_0xf845('0xd')]);router[_0xf845('0x8')](_0xf845('0xe'),auth['isAuthenticated'](),controller[_0xf845('0xf')]);router[_0xf845('0x8')](_0xf845('0x10'),auth[_0xf845('0x9')](),controller[_0xf845('0x11')]);router[_0xf845('0x8')](_0xf845('0x12'),controller[_0xf845('0x13')]);router[_0xf845('0x8')](_0xf845('0x14'),auth[_0xf845('0x9')](),controller[_0xf845('0x15')]);router[_0xf845('0x8')](_0xf845('0x16'),auth['isAuthenticated'](),controller[_0xf845('0x17')]);router['get'](_0xf845('0x18'),auth[_0xf845('0x9')](),controller[_0xf845('0x19')]);router[_0xf845('0x8')]('/:id/queues_rt',auth[_0xf845('0x9')](),controller[_0xf845('0x1a')]);router[_0xf845('0x8')]('/:id/groups',auth[_0xf845('0x9')](),controller[_0xf845('0x1b')]);router[_0xf845('0x8')](_0xf845('0x1c'),auth[_0xf845('0x9')](),controller['getRecordings']);router[_0xf845('0x8')](_0xf845('0x1d'),auth[_0xf845('0x9')](),controller[_0xf845('0x1e')]);router[_0xf845('0x8')](_0xf845('0x1f'),auth[_0xf845('0x9')](),controller['getChatInteractions']);router[_0xf845('0x8')](_0xf845('0x20'),auth[_0xf845('0x9')](),controller[_0xf845('0x21')]);router[_0xf845('0x8')](_0xf845('0x22'),auth[_0xf845('0x9')](),controller['getMailInteractions']);router[_0xf845('0x8')](_0xf845('0x23'),auth[_0xf845('0x9')](),controller[_0xf845('0x24')]);router['get'](_0xf845('0x25'),auth[_0xf845('0x9')](),controller[_0xf845('0x26')]);router[_0xf845('0x8')]('/:id/whatsapp/interactions',auth[_0xf845('0x9')](),controller[_0xf845('0x27')]);router['get'](_0xf845('0x28'),auth[_0xf845('0x9')](),controller[_0xf845('0x29')]);router[_0xf845('0x8')](_0xf845('0x2a'),auth[_0xf845('0x9')](),controller['getLists']);router[_0xf845('0x8')](_0xf845('0x2b'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf845('0x8')]('/:id/prefixes',auth[_0xf845('0x9')](),controller[_0xf845('0x2c')]);router['get'](_0xf845('0x2d'),auth[_0xf845('0x9')](),controller['getFaxAccounts']);router['get'](_0xf845('0x2e'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xf845('0x8')](_0xf845('0x2f'),auth[_0xf845('0x9')](),controller[_0xf845('0x30')]);router[_0xf845('0x8')](_0xf845('0x31'),auth[_0xf845('0x9')](),controller[_0xf845('0x32')]);router['get'](_0xf845('0x33'),auth[_0xf845('0x9')](),controller[_0xf845('0x34')]);router[_0xf845('0x8')](_0xf845('0x35'),auth[_0xf845('0x9')](),controller['getWhatsappAccounts']);router[_0xf845('0x8')](_0xf845('0x36'),auth[_0xf845('0x9')](),controller[_0xf845('0x37')]);router['get']('/:id/api_key',auth[_0xf845('0x9')](),controller[_0xf845('0x38')]);router[_0xf845('0x39')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xf845('0x39')]('/',auth[_0xf845('0x9')](),controller[_0xf845('0x3a')]);router['post']('/create_many',auth[_0xf845('0x9')](),controller[_0xf845('0x3b')]);router[_0xf845('0x39')](_0xf845('0x18'),auth[_0xf845('0x9')](),controller[_0xf845('0x3c')]);var upload=multer({'storage':multer[_0xf845('0x3d')]({'destination':function(_0x39f83a,_0x396afd,_0x4bce0a){_0x4bce0a(null,path[_0xf845('0x3e')](config[_0xf845('0x3f')],_0xf845('0x40')));},'filename':function(_0x1600e4,_0xb1d554,_0x325ef1){_0x325ef1(null,util[_0xf845('0x41')](_0xf845('0x42'),Date['now'](),_0xb1d554[_0xf845('0x43')]));}})});router['post'](_0xf845('0x12'),upload['single']('file'),controller[_0xf845('0x44')]);router[_0xf845('0x39')](_0xf845('0x45'),auth['isAuthenticated'](),controller[_0xf845('0x46')]);router[_0xf845('0x39')](_0xf845('0x47'),auth[_0xf845('0x9')](),controller[_0xf845('0x48')]);router[_0xf845('0x39')](_0xf845('0x49'),auth['isAuthenticated'](),controller[_0xf845('0x4a')]);router[_0xf845('0x39')](_0xf845('0x4b'),auth['isAuthenticated'](),controller['unpause']);router['post'](_0xf845('0x28'),auth[_0xf845('0x9')](),controller[_0xf845('0x4c')]);router[_0xf845('0x39')](_0xf845('0x4d'),auth['isAuthenticated'](),controller[_0xf845('0x4e')]);router[_0xf845('0x39')](_0xf845('0x4f'),auth[_0xf845('0x9')](),controller[_0xf845('0x50')]);router[_0xf845('0x39')](_0xf845('0x51'),auth[_0xf845('0x9')](),controller[_0xf845('0x52')]);router[_0xf845('0x39')]('/:id/sms_interactions',auth[_0xf845('0x9')](),controller[_0xf845('0x53')]);router[_0xf845('0x39')](_0xf845('0x54'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xf845('0x39')](_0xf845('0x55'),auth[_0xf845('0x9')](),controller[_0xf845('0x56')]);router[_0xf845('0x39')](_0xf845('0x2d'),auth['isAuthenticated'](),controller[_0xf845('0x57')]);router[_0xf845('0x39')](_0xf845('0x2e'),auth[_0xf845('0x9')](),controller['addMailAccounts']);router[_0xf845('0x39')](_0xf845('0x2f'),auth[_0xf845('0x9')](),controller[_0xf845('0x58')]);router[_0xf845('0x39')](_0xf845('0x31'),auth[_0xf845('0x9')](),controller[_0xf845('0x59')]);router['post'](_0xf845('0x33'),auth[_0xf845('0x9')](),controller['addChatWebsites']);router['post'](_0xf845('0x35'),auth[_0xf845('0x9')](),controller['addWhatsappAccounts']);router[_0xf845('0x39')](_0xf845('0x5a'),auth[_0xf845('0x9')](),controller[_0xf845('0x5b')]);router[_0xf845('0x5c')](_0xf845('0x10'),auth[_0xf845('0x9')](),controller[_0xf845('0x5d')]);router['put'](_0xf845('0x5e'),auth[_0xf845('0x9')](),controller[_0xf845('0x5f')]);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0xf845('0x60')]);router[_0xf845('0x61')](_0xf845('0x28'),auth['isAuthenticated'](),controller[_0xf845('0x62')]);router[_0xf845('0x61')](_0xf845('0x10'),auth[_0xf845('0x9')](),controller[_0xf845('0x63')]);router[_0xf845('0x61')](_0xf845('0x4d'),auth[_0xf845('0x9')](),controller[_0xf845('0x64')]);router[_0xf845('0x61')](_0xf845('0x4f'),auth[_0xf845('0x9')](),controller[_0xf845('0x65')]);router[_0xf845('0x61')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xf845('0x61')](_0xf845('0x66'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xf845('0x61')]('/:id/openchannel_interactions',auth[_0xf845('0x9')](),controller[_0xf845('0x67')]);router['delete'](_0xf845('0x55'),auth[_0xf845('0x9')](),controller['removeWhatsappInteractions']);router[_0xf845('0x61')](_0xf845('0x2d'),auth[_0xf845('0x9')](),controller[_0xf845('0x68')]);router[_0xf845('0x61')]('/:id/mail_accounts',auth[_0xf845('0x9')](),controller[_0xf845('0x69')]);router[_0xf845('0x61')](_0xf845('0x2f'),auth[_0xf845('0x9')](),controller[_0xf845('0x6a')]);router['delete']('/:id/sms_accounts',auth[_0xf845('0x9')](),controller[_0xf845('0x6b')]);router[_0xf845('0x61')](_0xf845('0x33'),auth['isAuthenticated'](),controller[_0xf845('0x6c')]);router['delete'](_0xf845('0x35'),auth[_0xf845('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0xf845('0x5a'),auth['isAuthenticated'](),controller[_0xf845('0x6d')]);router[_0xf845('0x39')]('/:id/messengerSoundNotification',auth[_0xf845('0x9')](),controller[_0xf845('0x6e')]);module[_0xf845('0x6f')]=router; \ No newline at end of file +var _0xf229=['/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/: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','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts'];(function(_0x159a23,_0x27be31){var _0x4689c4=function(_0x385577){while(--_0x385577){_0x159a23['push'](_0x159a23['shift']());}};_0x4689c4(++_0x27be31);}(_0xf229,0xb1));var _0x9f22=function(_0x2304c8,_0x3db606){_0x2304c8=_0x2304c8-0x0;var _0x4aa81f=_0xf229[_0x2304c8];return _0x4aa81f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9f22('0x0'));var express=require(_0x9f22('0x1'));var router=express['Router']();var fs_extra=require(_0x9f22('0x2'));var auth=require(_0x9f22('0x3'));var interaction=require(_0x9f22('0x4'));var config=require(_0x9f22('0x5'));var controller=require('./user.controller');router[_0x9f22('0x6')]('/',auth[_0x9f22('0x7')](),controller[_0x9f22('0x8')]);router['get']('/describe',auth[_0x9f22('0x7')](),controller[_0x9f22('0x9')]);router['get'](_0x9f22('0xa'),auth[_0x9f22('0x7')](),controller[_0x9f22('0xb')]);router[_0x9f22('0x6')](_0x9f22('0xc'),auth[_0x9f22('0x7')](),controller['getPresence']);router[_0x9f22('0x6')](_0x9f22('0xd'),auth[_0x9f22('0x7')](),controller[_0x9f22('0xe')]);router[_0x9f22('0x6')](_0x9f22('0xf'),controller[_0x9f22('0x10')]);router['get'](_0x9f22('0x11'),auth['isAuthenticated'](),controller[_0x9f22('0x12')]);router[_0x9f22('0x6')](_0x9f22('0x13'),auth[_0x9f22('0x7')](),controller['getContacts']);router[_0x9f22('0x6')](_0x9f22('0x14'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x15')]);router[_0x9f22('0x6')](_0x9f22('0x16'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x17')]);router[_0x9f22('0x6')](_0x9f22('0x18'),auth[_0x9f22('0x7')](),controller['getGroups']);router[_0x9f22('0x6')](_0x9f22('0x19'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x1a')]);router[_0x9f22('0x6')](_0x9f22('0x1b'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x1c')]);router[_0x9f22('0x6')](_0x9f22('0x1d'),auth['isAuthenticated'](),controller[_0x9f22('0x1e')]);router[_0x9f22('0x6')](_0x9f22('0x1f'),auth['isAuthenticated'](),controller[_0x9f22('0x20')]);router[_0x9f22('0x6')](_0x9f22('0x21'),auth['isAuthenticated'](),controller[_0x9f22('0x22')]);router['get'](_0x9f22('0x23'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x24')]);router[_0x9f22('0x6')](_0x9f22('0x25'),auth[_0x9f22('0x7')](),controller['getFaxInteractions']);router[_0x9f22('0x6')](_0x9f22('0x26'),auth['isAuthenticated'](),controller[_0x9f22('0x27')]);router[_0x9f22('0x6')](_0x9f22('0x28'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x29')]);router[_0x9f22('0x6')](_0x9f22('0x2a'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x2b')]);router[_0x9f22('0x6')](_0x9f22('0x2c'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x2d')]);router[_0x9f22('0x6')](_0x9f22('0x2e'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x2f')]);router[_0x9f22('0x6')](_0x9f22('0x30'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x9f22('0x6')](_0x9f22('0x31'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x32')]);router[_0x9f22('0x6')](_0x9f22('0x33'),auth['isAuthenticated'](),controller[_0x9f22('0x34')]);router['get'](_0x9f22('0x35'),auth[_0x9f22('0x7')](),controller['getSmsAccounts']);router[_0x9f22('0x6')](_0x9f22('0x36'),auth[_0x9f22('0x7')](),controller['getChatWebsites']);router[_0x9f22('0x6')](_0x9f22('0x37'),auth['isAuthenticated'](),controller[_0x9f22('0x38')]);router[_0x9f22('0x6')](_0x9f22('0x39'),auth['isAuthenticated'](),controller[_0x9f22('0x3a')]);router[_0x9f22('0x6')](_0x9f22('0x3b'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x9f22('0x3c')]('/:id/contacts',auth[_0x9f22('0x7')](),controller['addContacts']);router[_0x9f22('0x3c')]('/',auth[_0x9f22('0x7')](),controller[_0x9f22('0x3d')]);router[_0x9f22('0x3c')](_0x9f22('0x3e'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x3f')]);router[_0x9f22('0x3c')](_0x9f22('0x14'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x40')]);var upload=multer({'storage':multer[_0x9f22('0x41')]({'destination':function(_0x514e04,_0x3d1ab7,_0x37f407){_0x37f407(null,path[_0x9f22('0x42')](config[_0x9f22('0x43')],_0x9f22('0x44')));},'filename':function(_0x289d5f,_0x47df93,_0x232253){_0x232253(null,util[_0x9f22('0x45')](_0x9f22('0x46'),Date['now'](),_0x47df93[_0x9f22('0x47')]));}})});router[_0x9f22('0x3c')](_0x9f22('0xf'),upload[_0x9f22('0x48')](_0x9f22('0x49')),controller[_0x9f22('0x4a')]);router[_0x9f22('0x3c')](_0x9f22('0x4b'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x4c')]);router[_0x9f22('0x3c')]('/:id/logout',auth[_0x9f22('0x7')](),controller['logout']);router[_0x9f22('0x3c')](_0x9f22('0x4d'),auth['isAuthenticated'](),controller['pause']);router['post'](_0x9f22('0x4e'),auth['isAuthenticated'](),controller[_0x9f22('0x4f')]);router[_0x9f22('0x3c')](_0x9f22('0x28'),auth[_0x9f22('0x7')](),controller['addTeams']);router[_0x9f22('0x3c')](_0x9f22('0x50'),auth[_0x9f22('0x7')](),controller['addChatInteractions']);router[_0x9f22('0x3c')](_0x9f22('0x51'),auth[_0x9f22('0x7')](),controller['addMailInteractions']);router[_0x9f22('0x3c')](_0x9f22('0x52'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x53')]);router[_0x9f22('0x3c')](_0x9f22('0x54'),auth[_0x9f22('0x7')](),controller['addSmsInteractions']);router['post'](_0x9f22('0x55'),auth[_0x9f22('0x7')](),controller['addOpenchannelInteractions']);router[_0x9f22('0x3c')](_0x9f22('0x56'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x57')]);router[_0x9f22('0x3c')](_0x9f22('0x30'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x58')]);router[_0x9f22('0x3c')](_0x9f22('0x31'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x59')]);router[_0x9f22('0x3c')]('/:id/openchannel_accounts',auth[_0x9f22('0x7')](),controller[_0x9f22('0x5a')]);router[_0x9f22('0x3c')](_0x9f22('0x35'),auth[_0x9f22('0x7')](),controller['addSmsAccounts']);router[_0x9f22('0x3c')]('/:id/chat_websites',auth[_0x9f22('0x7')](),controller[_0x9f22('0x5b')]);router[_0x9f22('0x3c')]('/:id/whatsapp_accounts',auth[_0x9f22('0x7')](),controller[_0x9f22('0x5c')]);router[_0x9f22('0x3c')](_0x9f22('0x3b'),auth[_0x9f22('0x7')](),controller['createApiKey']);router[_0x9f22('0x5d')](_0x9f22('0xd'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x5e')]);router[_0x9f22('0x5d')](_0x9f22('0x5f'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x60')]);router[_0x9f22('0x61')]('/:id/queues',auth[_0x9f22('0x7')](),controller[_0x9f22('0x62')]);router[_0x9f22('0x61')](_0x9f22('0x28'),auth['isAuthenticated'](),controller[_0x9f22('0x63')]);router[_0x9f22('0x61')](_0x9f22('0xd'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x64')]);router[_0x9f22('0x61')](_0x9f22('0x50'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x65')]);router[_0x9f22('0x61')](_0x9f22('0x51'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x66')]);router[_0x9f22('0x61')](_0x9f22('0x52'),auth[_0x9f22('0x7')](),controller['removeFaxInteractions']);router[_0x9f22('0x61')](_0x9f22('0x54'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x67')]);router[_0x9f22('0x61')](_0x9f22('0x55'),auth[_0x9f22('0x7')](),controller['removeOpenchannelInteractions']);router[_0x9f22('0x61')]('/:id/whatsapp_interactions',auth[_0x9f22('0x7')](),controller[_0x9f22('0x68')]);router[_0x9f22('0x61')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9f22('0x69')]);router[_0x9f22('0x61')](_0x9f22('0x31'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x6a')]);router[_0x9f22('0x61')](_0x9f22('0x33'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x9f22('0x61')](_0x9f22('0x35'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x6b')]);router[_0x9f22('0x61')](_0x9f22('0x36'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x6c')]);router[_0x9f22('0x61')](_0x9f22('0x37'),auth[_0x9f22('0x7')](),controller['removeWhatsappAccounts']);router[_0x9f22('0x61')](_0x9f22('0x3b'),auth[_0x9f22('0x7')](),controller[_0x9f22('0x6d')]);router[_0x9f22('0x3c')](_0x9f22('0x6e'),auth['isAuthenticated'](),controller[_0x9f22('0x6f')]);module[_0x9f22('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index cb56b46..4f8c09f 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 _0xf43a=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blockedAt','UNSIGNED','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','user','agent','telephone','local','INTEGER','accountcode','callerid','BOOLEAN','DEFAULT\x20PAUSE','DATE','ENUM','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','nonat','update','yes','force_rport,comedia','nat'];(function(_0x59e112,_0x241b57){var _0x36e77c=function(_0x40658c){while(--_0x40658c){_0x59e112['push'](_0x59e112['shift']());}};_0x36e77c(++_0x241b57);}(_0xf43a,0x80));var _0xaf43=function(_0x443d72,_0x2ea176){_0x443d72=_0x443d72-0x0;var _0x14040e=_0xf43a[_0x443d72];return _0x14040e;};'use strict';var Sequelize=require(_0xaf43('0x0'));var moment=require('moment');var util=require(_0xaf43('0x1'));var _=require(_0xaf43('0x2'));module[_0xaf43('0x3')]={'name':{'type':Sequelize[_0xaf43('0x4')],'allowNull':![],'unique':_0xaf43('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2671f1){this[_0xaf43('0x6')](_0xaf43('0x5'),_0x2671f1);this[_0xaf43('0x6')](_0xaf43('0x7'),_0x2671f1);},'comment':_0xaf43('0x8')},'fullname':{'type':Sequelize[_0xaf43('0x4')],'allowNull':![],'set':function(_0x35efd8){this[_0xaf43('0x6')](_0xaf43('0x9'),_0x35efd8);this[_0xaf43('0x6')]('callerid',util[_0xaf43('0xa')](_0xaf43('0xb'),_0x35efd8,this[_0xaf43('0xc')](_0xaf43('0xd'))));}},'alias':{'type':Sequelize[_0xaf43('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaf43('0xe'),'validate':{'isEmail':!![]},'set':function(_0x2cfbbe){if(_0x2cfbbe){this[_0xaf43('0x6')](_0xaf43('0xe'),_0x2cfbbe[_0xaf43('0xf')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xaf43('0x10'),_0xaf43('0x11'),_0xaf43('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xaf43('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xaf43('0x4')],'defaultValue':_0xaf43('0x13')},'internal':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':![],'unique':_0xaf43('0xd'),'set':function(_0x2c2f38){this[_0xaf43('0x6')](_0xaf43('0xd'),_0x2c2f38);this[_0xaf43('0x6')](_0xaf43('0x15'),_0x2c2f38);this['setDataValue'](_0xaf43('0x16'),util['format'](_0xaf43('0xb'),this[_0xaf43('0xc')](_0xaf43('0x9')),_0x2c2f38));}},'salt':{'type':Sequelize[_0xaf43('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xaf43('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xaf43('0x4')]},'country':{'type':Sequelize[_0xaf43('0x4')]},'online':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xaf43('0x4')],'defaultValue':_0xaf43('0x18')},'lastPauseAt':{'type':Sequelize[_0xaf43('0x19')]},'chatCapacity':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xaf43('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xaf43('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xaf43('0x1a')]('friend','user',_0xaf43('0x1b')),'allowNull':!![],'defaultValue':_0xaf43('0x1c')},'context':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x1d'),'ALLOWED_PASSED_SCREEN',_0xaf43('0x1e'),'ALLOWED',_0xaf43('0x1f'),_0xaf43('0x20'),_0xaf43('0x21'),_0xaf43('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![],'defaultValue':_0xaf43('0x23'),'set':function(_0x9d4fc1){this[_0xaf43('0x6')](_0xaf43('0x24'),_0x9d4fc1?_0x9d4fc1[_0xaf43('0x25')](','):null);},'get':function(){return this[_0xaf43('0xc')](_0xaf43('0x24'))?this[_0xaf43('0xc')](_0xaf43('0x24'))[_0xaf43('0x26')](','):null;},'comment':_0xaf43('0x27')},'dtmfmode':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x28'),'info','shortinfo',_0xaf43('0x29'),_0xaf43('0x2a')),'allowNull':!![],'defaultValue':_0xaf43('0x28')},'directmedia':{'type':Sequelize[_0xaf43('0x1a')]('yes','no',_0xaf43('0x2b'),_0xaf43('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![],'defaultValue':_0xaf43('0x2e'),'set':function(_0x4b033b){this[_0xaf43('0x6')](_0xaf43('0x2f'),_0x4b033b?_0x4b033b[_0xaf43('0x25')](','):null);},'get':function(){return this['getDataValue'](_0xaf43('0x2f'))?this['getDataValue'](_0xaf43('0x2f'))[_0xaf43('0x26')](','):null;},'comment':_0xaf43('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xaf43('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xaf43('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xaf43('0x4')]},'disallow':{'type':Sequelize[_0xaf43('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xaf43('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1ed7a2){this[_0xaf43('0x6')](_0xaf43('0x31'),_0x1ed7a2?_0x1ed7a2['join'](';'):_0xaf43('0x32'));},'get':function(){return this['getDataValue'](_0xaf43('0x31'))?this[_0xaf43('0xc')]('allow')[_0xaf43('0x26')](';'):null;},'comment':_0xaf43('0x33')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![],'set':function(_0xa82c01){this[_0xaf43('0x6')](_0xaf43('0x34'),_0xa82c01?_0xa82c01[_0xaf43('0x25')](','):null);},'get':function(){return this[_0xaf43('0xc')](_0xaf43('0x34'))?this[_0xaf43('0xc')]('insecure')[_0xaf43('0x26')](','):null;},'comment':_0xaf43('0x35')},'trustrpid':{'type':Sequelize[_0xaf43('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xaf43('0x2d'),'no',_0xaf43('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xaf43('0x37')},'amaflags':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xaf43('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':_0xaf43('0x2d')},'busylevel':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xaf43('0x1a')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xaf43('0x1a')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xaf43('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xaf43('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xaf43('0x1a')]('accept',_0xaf43('0x38'),_0xaf43('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xaf43('0x3a'),_0xaf43('0x3b')),'allowNull':!![],'defaultValue':_0xaf43('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xaf43('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':_0xaf43('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xaf43('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xaf43('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no',_0xaf43('0x3c'),_0xaf43('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xaf43('0x3e'),_0xaf43('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xaf43('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xaf43('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xaf43('0x1a')](_0xaf43('0x2d'),'no',_0xaf43('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xaf43('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xaf43('0x19')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0,'set':function(_0x81036e){this[_0xaf43('0x6')](_0xaf43('0x40'),_0x81036e);var _0x2a9824=this[_0xaf43('0x41')]({'plain':!![]});switch(_0x81036e){case 0x0:case 0x1:var _0x44d76a=_0x2a9824[_0xaf43('0x24')]?_['isArray'](_0x2a9824[_0xaf43('0x24')])?_0x2a9824[_0xaf43('0x24')]['join']():_0x2a9824[_0xaf43('0x24')]:_0xaf43('0x23');if(_0x44d76a===_0xaf43('0x42')){_0x44d76a=_0xaf43('0x23');}this[_0xaf43('0x6')]('transport',_0x44d76a);this[_0xaf43('0x6')](_0xaf43('0x43'),'no');this[_0xaf43('0x6')](_0xaf43('0x44'),null);this[_0xaf43('0x6')](_0xaf43('0x45'),null);this['setDataValue'](_0xaf43('0x46'),null);this[_0xaf43('0x6')](_0xaf43('0x47'),null);this[_0xaf43('0x6')](_0xaf43('0x48'),null);this[_0xaf43('0x6')](_0xaf43('0x49'),null);this[_0xaf43('0x6')](_0xaf43('0x4a'),null);this[_0xaf43('0x6')](_0xaf43('0x4b'),null);this[_0xaf43('0x6')](_0xaf43('0x4c'),'no');break;case 0x2:this['setDataValue'](_0xaf43('0x24'),_0xaf43('0x42'));this[_0xaf43('0x6')](_0xaf43('0x43'),'yes');this['setDataValue'](_0xaf43('0x44'),_0xaf43('0x2d'));this[_0xaf43('0x6')]('force_avp',_0xaf43('0x2d'));this[_0xaf43('0x6')](_0xaf43('0x46'),_0xaf43('0x2d'));this[_0xaf43('0x6')](_0xaf43('0x47'),_0xaf43('0x2d'));this[_0xaf43('0x6')](_0xaf43('0x48'),'no');this[_0xaf43('0x6')](_0xaf43('0x49'),_0xaf43('0x3f'));this['setDataValue'](_0xaf43('0x4a'),_0x2a9824[_0xaf43('0x4a')]||_0xaf43('0x4d'));this[_0xaf43('0x6')](_0xaf43('0x4b'),_0x2a9824[_0xaf43('0x4b')]||_0xaf43('0x4e'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xaf43('0x4f')],'set':function(_0x30027e){this[_0xaf43('0x6')](_0xaf43('0x50'),_0x30027e?_0x30027e['join'](','):[]);},'get':function(){return this['getDataValue'](_0xaf43('0x50'))?_[_0xaf43('0x51')](this['getDataValue'](_0xaf43('0x50'))[_0xaf43('0x26')](','),function(_0x1de3cf){return parseInt(_0x1de3cf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xaf43('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xaf43('0x1a')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xaf43('0x52')],'get':function(){return this[_0xaf43('0xc')](_0xaf43('0x53'))?this[_0xaf43('0xc')](_0xaf43('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xaf43('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3a6e2c){if(typeof _0x3a6e2c==='string'){var _0x4b3316=_0x3a6e2c==='1'?!![]:_0x3a6e2c==='0'?![]:_0x3a6e2c===_0xaf43('0x54')?!![]:_0x3a6e2c==='false'?![]:![];this['setDataValue']('screenrecording',_0x4b3316);}else{this[_0xaf43('0x6')](_0xaf43('0x55'),_0x3a6e2c);}}},'blocked':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![],'set':function(_0x252224){this[_0xaf43('0x6')]('blocked',_0x252224);if(_0x252224===!![]){this[_0xaf43('0x6')](_0xaf43('0x56'),moment());this[_0xaf43('0x6')]('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xaf43('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xaf43('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xaf43('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xaf43('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x26d8=['certificate','active','actpass','update,nonat','get','isArray','wss','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','encryption','avpf','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','telephone','INTEGER','accountcode','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','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\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','originate','uac','uas'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x26d8,0xd5));var _0x826d=function(_0x193983,_0x4c1934){_0x193983=_0x193983-0x0;var _0x3768b1=_0x26d8[_0x193983];return _0x3768b1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x826d('0x0'));module[_0x826d('0x1')]={'name':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'unique':_0x826d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e09bd){this[_0x826d('0x4')](_0x826d('0x3'),_0x3e09bd);this[_0x826d('0x4')](_0x826d('0x5'),_0x3e09bd);},'comment':_0x826d('0x6')},'fullname':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'set':function(_0x584534){this['setDataValue']('fullname',_0x584534);this[_0x826d('0x4')](_0x826d('0x7'),util[_0x826d('0x8')](_0x826d('0x9'),_0x584534,this[_0x826d('0xa')](_0x826d('0xb'))));}},'alias':{'type':Sequelize[_0x826d('0x2')]},'email':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'unique':_0x826d('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3b2ffa){if(_0x3b2ffa){this['setDataValue'](_0x826d('0xc'),_0x3b2ffa['toLowerCase']());}}},'role':{'type':Sequelize[_0x826d('0xd')](_0x826d('0xe'),_0x826d('0xf'),'agent',_0x826d('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x826d('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':![],'unique':_0x826d('0xb'),'set':function(_0x5a8b7e){this[_0x826d('0x4')](_0x826d('0xb'),_0x5a8b7e);this[_0x826d('0x4')](_0x826d('0x12'),_0x5a8b7e);this[_0x826d('0x4')](_0x826d('0x7'),util[_0x826d('0x8')](_0x826d('0x9'),this[_0x826d('0xa')](_0x826d('0x13')),_0x5a8b7e));}},'salt':{'type':Sequelize[_0x826d('0x2')]},'phone':{'type':Sequelize[_0x826d('0x2')]},'mobile':{'type':Sequelize[_0x826d('0x2')]},'address':{'type':Sequelize[_0x826d('0x2')]},'zipcode':{'type':Sequelize[_0x826d('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x826d('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x826d('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x826d('0x2')],'defaultValue':_0x826d('0x16')},'lastPauseAt':{'type':Sequelize[_0x826d('0x14')]},'chatCapacity':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x826d('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x826d('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x826d('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x826d('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x826d('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x826d('0xd')]('friend',_0x826d('0xf'),_0x826d('0x18')),'allowNull':!![],'defaultValue':_0x826d('0x19')},'context':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![],'defaultValue':_0x826d('0x1a')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x826d('0x1b'),_0x826d('0x1c'),_0x826d('0x1d'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x826d('0x1e'),_0x826d('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x826d('0x20'),'set':function(_0x21926b){this[_0x826d('0x4')]('transport',_0x21926b?_0x21926b[_0x826d('0x21')](','):null);},'get':function(){return this['getDataValue'](_0x826d('0x22'))?this['getDataValue'](_0x826d('0x22'))[_0x826d('0x23')](','):null;},'comment':_0x826d('0x24')},'dtmfmode':{'type':Sequelize[_0x826d('0xd')]('rfc2833','info',_0x826d('0x25'),_0x826d('0x26'),_0x826d('0x27')),'allowNull':!![],'defaultValue':_0x826d('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0x826d('0x29'),'no',_0x826d('0x2a'),_0x826d('0x2b'),_0x826d('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x826d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![],'defaultValue':_0x826d('0x2d'),'set':function(_0x2b4b7e){this['setDataValue'](_0x826d('0x2e'),_0x2b4b7e?_0x2b4b7e['join'](','):null);},'get':function(){return this[_0x826d('0xa')](_0x826d('0x2e'))?this[_0x826d('0xa')](_0x826d('0x2e'))[_0x826d('0x23')](','):null;},'comment':_0x826d('0x2f')},'callgroup':{'type':Sequelize[_0x826d('0x2')]},'namedcallgroup':{'type':Sequelize[_0x826d('0x2')]},'pickupgroup':{'type':Sequelize[_0x826d('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x826d('0x2')]},'language':{'type':Sequelize[_0x826d('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x826d('0x2')],'allowNull':![],'defaultValue':_0x826d('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x256d33){this[_0x826d('0x4')](_0x826d('0x31'),_0x256d33?_0x256d33[_0x826d('0x21')](';'):_0x826d('0x32'));},'get':function(){return this[_0x826d('0xa')]('allow')?this[_0x826d('0xa')]('allow')[_0x826d('0x23')](';'):null;},'comment':_0x826d('0x33')},'autoframing':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![],'set':function(_0x9f9588){this[_0x826d('0x4')](_0x826d('0x34'),_0x9f9588?_0x9f9588[_0x826d('0x21')](','):null);},'get':function(){return this[_0x826d('0xa')](_0x826d('0x34'))?this[_0x826d('0xa')](_0x826d('0x34'))['split'](','):null;},'comment':_0x826d('0x35')},'trustrpid':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![],'defaultValue':_0x826d('0x36')},'amaflags':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![],'defaultValue':_0x826d('0x29')},'busylevel':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x826d('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x826d('0xd')]('yes','no',_0x826d('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x826d('0xd')]('accept',_0x826d('0x38'),_0x826d('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x3a'),_0x826d('0x3b')),'allowNull':!![],'defaultValue':_0x826d('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no','fingerprint',_0x826d('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x3d'),'passive',_0x826d('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x826d('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x826d('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x826d('0x2a'),_0x826d('0x2b'),_0x826d('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x826d('0x2')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x826d('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0,'set':function(_0x4a6ab8){this[_0x826d('0x4')]('showWebBar',_0x4a6ab8);var _0x38f415=this[_0x826d('0x40')]({'plain':!![]});switch(_0x4a6ab8){case 0x0:case 0x1:var _0x41a578=_0x38f415[_0x826d('0x22')]?_[_0x826d('0x41')](_0x38f415['transport'])?_0x38f415[_0x826d('0x22')]['join']():_0x38f415[_0x826d('0x22')]:_0x826d('0x20');if(_0x41a578===_0x826d('0x42')){_0x41a578=_0x826d('0x20');}this['setDataValue'](_0x826d('0x22'),_0x41a578);this[_0x826d('0x4')]('encryption','no');this[_0x826d('0x4')]('avpf',null);this[_0x826d('0x4')](_0x826d('0x43'),null);this[_0x826d('0x4')](_0x826d('0x44'),null);this[_0x826d('0x4')](_0x826d('0x45'),null);this['setDataValue'](_0x826d('0x46'),null);this[_0x826d('0x4')]('dtlssetup',null);this[_0x826d('0x4')](_0x826d('0x47'),null);this[_0x826d('0x4')](_0x826d('0x48'),null);this[_0x826d('0x4')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x826d('0x22'),_0x826d('0x42'));this['setDataValue'](_0x826d('0x49'),'yes');this[_0x826d('0x4')](_0x826d('0x4a'),_0x826d('0x29'));this[_0x826d('0x4')]('force_avp','yes');this['setDataValue'](_0x826d('0x44'),_0x826d('0x29'));this['setDataValue'](_0x826d('0x45'),_0x826d('0x29'));this[_0x826d('0x4')](_0x826d('0x46'),'no');this[_0x826d('0x4')](_0x826d('0x4b'),_0x826d('0x3e'));this[_0x826d('0x4')](_0x826d('0x47'),_0x38f415[_0x826d('0x47')]||_0x826d('0x4c'));this[_0x826d('0x4')]('dtlsprivatekey',_0x38f415['dtlsprivatekey']||_0x826d('0x4d'));this[_0x826d('0x4')]('rtcp_mux',_0x826d('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x826d('0x4e')],'set':function(_0x53f9e4){this[_0x826d('0x4')]('permissions',_0x53f9e4?_0x53f9e4['join'](','):[]);},'get':function(){return this[_0x826d('0xa')](_0x826d('0x4f'))?_[_0x826d('0x50')](this[_0x826d('0xa')](_0x826d('0x4f'))['split'](','),function(_0x5aa2e3){return parseInt(_0x5aa2e3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x826d('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x826d('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x826d('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x826d('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x826d('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x826d('0xd')](_0x826d('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x826d('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x826d('0x2')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x826d('0x51')],'get':function(){return this[_0x826d('0xa')](_0x826d('0x52'))?this[_0x826d('0xa')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x826d('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![],'set':function(_0x580ca0){if(typeof _0x580ca0===_0x826d('0x53')){var _0x3f754b=_0x580ca0==='1'?!![]:_0x580ca0==='0'?![]:_0x580ca0===_0x826d('0x54')?!![]:_0x580ca0===_0x826d('0x55')?![]:![];this['setDataValue'](_0x826d('0x56'),_0x3f754b);}else{this[_0x826d('0x4')]('screenrecording',_0x580ca0);}}},'blocked':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![],'set':function(_0x333dac){this[_0x826d('0x4')](_0x826d('0x57'),_0x333dac);if(_0x333dac===!![]){this[_0x826d('0x4')]('blockedAt',moment());this[_0x826d('0x4')](_0x826d('0x58'),0x0);}else{this['setDataValue'](_0x826d('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x826d('0x11')](0x5)[_0x826d('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x826d('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x826d('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x826d('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4eacb0d..5b6313b 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 _0x061a=['CmList','getAgents','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$contains','$contained','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','idle','unknown','ringing','queues','VoiceQueue','inbound','flatten','col','desc','asc','substring','uniqBy','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','select','field','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','enabled','moment','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','json','offset','undefined','set','then','info','debug','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','catch','update','role','agent','emit','destroy','get','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','name','UserProfileResource','stack','send','User','rawAttributes','fieldName','type','key','password','salt','resetPasswordToken','md5secret','index','where','count','query','includeAll','userSetting','attributes','push','findAll','openTabs','true','rows','length','chat','dataValues','fax','mail','openchannel','whatsapp','all','show','params','getOptions','include','UserSetting','merge','options','sms','body','describe','addContacts','find','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','110','104','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','some','isEmpty','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','addQueues','channel','online','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','Queue:save','voice','format','SIP/%s','interface','UserVoiceQueueRt','upsert','removeQueues','Queues','isArray','Queue:remove','userpic','file','join','root','download','existsSync','server/files/images/','getOpenTabs','CHAT','createdAt','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','Tag','Tags','color','tag','getQueues','model','Queue','keys','filters','intersection','fields','sort','nolimit','limit','getVoiceQueuesRt','order','pick','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','Team','addTeams','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getLists'];(function(_0x1b69a4,_0x3e9f5f){var _0x4ab6a6=function(_0x33697){while(--_0x33697){_0x1b69a4['push'](_0x1b69a4['shift']());}};_0x4ab6a6(++_0x3e9f5f);}(_0x061a,0x70));var _0xa061=function(_0x1d62f6,_0xd4d529){_0x1d62f6=_0x1d62f6-0x0;var _0x29a6c2=_0x061a[_0x1d62f6];return _0x29a6c2;};'use strict';var moment=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var path=require(_0xa061('0x2'));var fs=require('fs');var _=require(_0xa061('0x3'));var squel=require(_0xa061('0x4'));var Redis=require(_0xa061('0x5'));var jayson=require(_0xa061('0x6'));var authService=require(_0xa061('0x7'));var contacts=require(_0xa061('0x8'));var qs=require(_0xa061('0x9'));var rta=require('../../components/realtime/agents');var logger=require(_0xa061('0xa'))('api');var utils=require('../../config/utils');var config=require(_0xa061('0xb'));var licenseUtil=require(_0xa061('0xc'));var APIBadRequestError=require(_0xa061('0xd'))[_0xa061('0xe')];var APINotFoundError=require('../../errors/api')[_0xa061('0xf')];var APIForbiddenError=require(_0xa061('0xd'))[_0xa061('0x10')];var APIHandleError=require('../../errors/api')[_0xa061('0x11')];var db=require('../../mysqldb')['db'];var socket=require(_0xa061('0x12'))(new Redis(config[_0xa061('0x13')]));require(_0xa061('0x14'))[_0xa061('0x15')](socket);config[_0xa061('0x13')]=_[_0xa061('0x16')](config['redis'],{'host':_0xa061('0x17'),'port':0x18eb});var amiClient=jayson[_0xa061('0x18')][_0xa061('0x19')]({'port':0x232a});var values;function respondWithStatusCode(_0x3c8250,_0x5e701f){_0x5e701f=_0x5e701f||0xcc;return function(_0x546dcc){if(_0x546dcc){return _0x3c8250[_0xa061('0x1a')](_0x5e701f);}return _0x3c8250[_0xa061('0x1b')](_0x5e701f)[_0xa061('0x1c')]();};}function respondWithResult(_0x1d73d7,_0x43e6d5){_0x43e6d5=_0x43e6d5||0xc8;return function(_0x56b587){if(_0x56b587){return _0x1d73d7['status'](_0x43e6d5)[_0xa061('0x1d')](_0x56b587);}};}function respondWithFilteredResult(_0x1e83f4,_0x5e6c2a){return function(_0x496661){if(_0x496661){var _0xa43d92=typeof _0x5e6c2a[_0xa061('0x1e')]===_0xa061('0x1f')&&typeof _0x5e6c2a['limit']===_0xa061('0x1f');var _0x26eeb9=_0x496661['count'];var _0x1393e7=_0xa43d92?0x0:_0x5e6c2a[_0xa061('0x1e')];var _0x4a8d06=_0xa43d92?_0x496661['count']:_0x5e6c2a['offset']+_0x5e6c2a['limit'];var _0x1f9591;if(_0x4a8d06>=_0x26eeb9){_0x4a8d06=_0x26eeb9;_0x1f9591=0xc8;}else{_0x1f9591=0xce;}_0x1e83f4[_0xa061('0x1b')](_0x1f9591);return _0x1e83f4[_0xa061('0x20')]('Content-Range',_0x1393e7+'-'+_0x4a8d06+'/'+_0x26eeb9)[_0xa061('0x1d')](_0x496661);}return null;};}function respondWithRpcPromise(_0x3e6bf5,_0x2e5bcb,_0x3929ee,_0x324ca4){return new Promise(function(_0x189634,_0x472727){var _0x3b99ab=_0x324ca4||amiClient;return _0x3b99ab['request'](_0x3e6bf5,_0x3929ee)[_0xa061('0x21')](function(_0x17bed4){logger[_0xa061('0x22')]('User,\x20%s,\x20%s',_0x2e5bcb,'request\x20sent');logger[_0xa061('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x2e5bcb,_0xa061('0x24'),JSON[_0xa061('0x25')](_0x17bed4));if(_0x17bed4[_0xa061('0x26')]){if(_0x17bed4['error'][_0xa061('0x27')]===0x1f4){logger[_0xa061('0x26')](_0xa061('0x28'),_0x2e5bcb,_0x17bed4[_0xa061('0x26')]['message']);return _0x472727(_0x17bed4[_0xa061('0x26')][_0xa061('0x29')]);}logger[_0xa061('0x26')]('User,\x20%s,\x20%s',_0x2e5bcb,_0x17bed4[_0xa061('0x26')][_0xa061('0x29')]);return _0x189634(_0x17bed4['error'][_0xa061('0x29')]);}else{logger[_0xa061('0x22')](_0xa061('0x28'),_0x2e5bcb,_0xa061('0x24'));_0x189634(_0x17bed4['result'][_0xa061('0x29')]);}})[_0xa061('0x2a')](function(_0x40fe82){logger[_0xa061('0x26')](_0xa061('0x28'),_0x2e5bcb,_0x40fe82);_0x472727(_0x40fe82);});});}function saveUpdates(_0x47c373){return function(_0x3152bd){if(_0x3152bd){return _0x3152bd[_0xa061('0x2b')](_0x47c373)[_0xa061('0x21')](function(_0x5cab45){if(_0x5cab45[_0xa061('0x2c')]===_0xa061('0x2d')){socket[_0xa061('0x2e')]('userNotification:recalc:'+_0x5cab45['id'],_0x5cab45);}return _0x5cab45;});}return null;};}function removeEntity(_0x5f4dfb,_0x36cc31){return function(_0x1f4361){if(_0x1f4361){return _0x1f4361[_0xa061('0x2f')]({'transaction':_0x36cc31})[_0xa061('0x21')](function(){var _0x1168a9=_0x1f4361[_0xa061('0x30')]({'plain':!![]});if(_0x1168a9[_0xa061('0x2c')]===_0xa061('0x31'))return;var _0x24644b=[{'name':_0xa061('0x32'),'value':_0xa061('0x33'),'ignore':!![]},{'name':_0xa061('0x34'),'value':_0xa061('0x2d'),'ignore':![]},{'name':_0xa061('0x35'),'value':_0xa061('0x36'),'ignore':![]}];var _0x3a19ec=_(_0x24644b)[_0xa061('0x37')](_0xa061('0x38'))[_0xa061('0x39')](_0xa061('0x3a'))['value']();if(_[_0xa061('0x3b')](_0x3a19ec,_0x1168a9[_0xa061('0x2c')])){return;}var _0x5a2845=_['find'](_0x24644b,[_0xa061('0x3a'),_0x1168a9['role']])[_0xa061('0x3c')];return db[_0xa061('0x3d')][_0xa061('0x2f')]({'where':{'type':_0x5a2845,'resourceId':_0x1168a9['id']},'transaction':_0x36cc31})[_0xa061('0x21')](function(){return _0x1f4361;});})[_0xa061('0x21')](function(){_0x5f4dfb['status'](0xcc)[_0xa061('0x1c')]();});}};}function handleEntityNotFound(_0x3a3914){return function(_0x28a36c){if(!_0x28a36c){_0x3a3914[_0xa061('0x1a')](0x194);}return _0x28a36c;};}function handleError(_0x16bb3d,_0x424de0){_0x424de0=_0x424de0||0x1f4;return function(_0x2a0307){logger[_0xa061('0x26')](_0x2a0307[_0xa061('0x3e')]);if(_0x2a0307[_0xa061('0x3c')]){delete _0x2a0307[_0xa061('0x3c')];}_0x16bb3d['status'](_0x424de0)[_0xa061('0x3f')](_0x2a0307);};}function getUserAttributes(){return _(db[_0xa061('0x40')][_0xa061('0x41')])[_0xa061('0x39')](function(_0x257d80){return{'name':_0x257d80[_0xa061('0x42')],'type':_0x257d80[_0xa061('0x43')][_0xa061('0x44')]};})['filter'](function(_0x146df1){return![_0xa061('0x45'),_0xa061('0x46'),'previousPasswords',_0xa061('0x47'),'resetPasswordExpires',_0xa061('0x48')][_0xa061('0x3b')](_0x146df1['name']);})[_0xa061('0x3a')]();}exports[_0xa061('0x49')]=function(_0x53e67c,_0x89a05b){var _0x1a116f={},_0x31f310={'count':0x0,'rows':[]};var _0x4d788d=getUserAttributes();_0x1a116f=qs['getOptions'](_0x4d788d,_0x53e67c);var _0x238c74={'where':_0x1a116f[_0xa061('0x4a')]};return db[_0xa061('0x40')]['count'](_0x238c74)['then'](function(_0x48b193){_0x31f310[_0xa061('0x4b')]=_0x48b193;if(_0x53e67c[_0xa061('0x4c')][_0xa061('0x4d')]){_0x1a116f['include']=[{'all':!![]}];}if(_0x53e67c[_0xa061('0x4c')][_0xa061('0x4e')]==='true'){_0x1a116f['include']=[{'model':db['UserSetting'],'as':_0xa061('0x4e')}];}if(!_[_0xa061('0x3b')](_0x1a116f[_0xa061('0x4f')],'id')){_0x1a116f[_0xa061('0x4f')][_0xa061('0x50')]('id');}return db['User'][_0xa061('0x51')](_0x1a116f);})['then'](function(_0x3c4991){_0x31f310['rows']=_0x3c4991;if(_0x53e67c[_0xa061('0x4c')][_0xa061('0x52')]===_0xa061('0x53')){var _0x133cca=[];for(var _0x408d3d=0x0;_0x408d3d<_0x31f310[_0xa061('0x54')][_0xa061('0x55')];_0x408d3d++){_0x133cca[_0xa061('0x50')](get_open_tabs(_0xa061('0x56'),_0x31f310[_0xa061('0x54')][_0x408d3d][_0xa061('0x57')]));_0x133cca['push'](get_open_tabs('sms',_0x31f310[_0xa061('0x54')][_0x408d3d]['dataValues']));_0x133cca['push'](get_open_tabs(_0xa061('0x58'),_0x31f310[_0xa061('0x54')][_0x408d3d][_0xa061('0x57')]));_0x133cca[_0xa061('0x50')](get_open_tabs(_0xa061('0x59'),_0x31f310['rows'][_0x408d3d]['dataValues']));_0x133cca[_0xa061('0x50')](get_open_tabs(_0xa061('0x5a'),_0x31f310[_0xa061('0x54')][_0x408d3d][_0xa061('0x57')]));_0x133cca[_0xa061('0x50')](get_open_tabs(_0xa061('0x5b'),_0x31f310[_0xa061('0x54')][_0x408d3d][_0xa061('0x57')]));}return Promise[_0xa061('0x5c')](_0x133cca)[_0xa061('0x21')](function(){return _0x31f310;});}else{return _0x31f310;}})[_0xa061('0x21')](respondWithFilteredResult(_0x89a05b,_0x1a116f))[_0xa061('0x2a')](handleError(_0x89a05b,null));};exports[_0xa061('0x5d')]=function(_0x9efcaf,_0x122fe9){var _0x26dbbf=getUserAttributes();_0x9efcaf['query']['id']=_0x9efcaf[_0xa061('0x5e')]['id'];var _0x29bfa4=qs[_0xa061('0x5f')](_0x26dbbf,_0x9efcaf);if(_0x9efcaf[_0xa061('0x4c')][_0xa061('0x4d')]){_0x29bfa4[_0xa061('0x60')]=[{'all':!![]}];}if(_0x9efcaf[_0xa061('0x4c')][_0xa061('0x4e')]===_0xa061('0x53')){_0x29bfa4[_0xa061('0x60')]=[{'model':db[_0xa061('0x61')],'as':_0xa061('0x4e')}];}_0x29bfa4=_[_0xa061('0x62')]({},_0x29bfa4,_0x9efcaf[_0xa061('0x63')]);if(!_[_0xa061('0x3b')](_0x29bfa4[_0xa061('0x4f')],'id')){_0x29bfa4['attributes'][_0xa061('0x50')]('id');}return db[_0xa061('0x40')]['find'](_0x29bfa4)[_0xa061('0x21')](handleEntityNotFound(_0x122fe9,null))[_0xa061('0x21')](function(_0x36196a){var _0x1abc6b=[];values=_0x36196a;if(_0x9efcaf['query'][_0xa061('0x52')]===_0xa061('0x53')){_0x1abc6b[_0xa061('0x50')](get_open_tabs(_0xa061('0x56'),_0x36196a[_0xa061('0x57')]));_0x1abc6b[_0xa061('0x50')](get_open_tabs(_0xa061('0x64'),_0x36196a[_0xa061('0x57')]));_0x1abc6b['push'](get_open_tabs('openchannel',_0x36196a[_0xa061('0x57')]));_0x1abc6b[_0xa061('0x50')](get_open_tabs('whatsapp',_0x36196a['dataValues']));_0x1abc6b[_0xa061('0x50')](get_open_tabs(_0xa061('0x58'),_0x36196a[_0xa061('0x57')]));_0x1abc6b['push'](get_open_tabs('mail',_0x36196a[_0xa061('0x57')]));return Promise['all'](_0x1abc6b);}else{return values;}})['then'](function(){return values;})[_0xa061('0x21')](respondWithResult(_0x122fe9,null))['catch'](handleError(_0x122fe9,null));};exports['update']=function(_0xb48ed3,_0x1afe7b){if(_0xb48ed3[_0xa061('0x65')]['id']){delete _0xb48ed3[_0xa061('0x65')]['id'];}delete _0xb48ed3[_0xa061('0x65')][_0xa061('0x2c')];return db[_0xa061('0x40')]['find']({'where':{'id':_0xb48ed3[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x1afe7b,null))[_0xa061('0x21')](saveUpdates(_0xb48ed3['body'],null))[_0xa061('0x21')](respondWithResult(_0x1afe7b,null))[_0xa061('0x2a')](handleError(_0x1afe7b,null));};exports['describe']=function(_0x3104cc,_0xcb70dd){return db[_0xa061('0x40')][_0xa061('0x66')]()[_0xa061('0x21')](respondWithResult(_0xcb70dd,null))[_0xa061('0x2a')](handleError(_0xcb70dd,null));};exports[_0xa061('0x67')]=function(_0x542b4f,_0x2ec48f){return db[_0xa061('0x40')][_0xa061('0x68')]({'where':{'id':_0x542b4f[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x2ec48f,null))[_0xa061('0x21')](function(_0x1cce75){if(_0x1cce75){return _0x1cce75['addContacts'](_0x542b4f[_0xa061('0x65')][_0xa061('0x69')],_[_0xa061('0x6a')](_0x542b4f[_0xa061('0x65')],[_0xa061('0x69'),'id'])||{});}})[_0xa061('0x21')](respondWithResult(_0x2ec48f,null))[_0xa061('0x2a')](handleError(_0x2ec48f,null));};function validateUser(_0xa26815){return new Promise(function(_0x538d08,_0x2bdea2){if(_0xa26815[_0xa061('0x6b')])return _0x538d08(_0xa26815);return db[_0xa061('0x6c')][_0xa061('0x6d')](0x1)['then'](function(_0x288431){if(_0x288431[_0xa061('0x6e')])authService[_0xa061('0x6f')](_0xa26815['password']);db[_0xa061('0x40')]['max']('internal')['then'](function(_0xa79df3){if(_[_0xa061('0x70')](_0xa79df3)){_0xa26815[_0xa061('0x6b')]=_0x288431[_0xa061('0x71')]||0x1;return;}if(_['isNil'](_0x288431[_0xa061('0x71')])||_0x288431[_0xa061('0x71')]===_0xa79df3){_0xa26815[_0xa061('0x6b')]=_0xa79df3+0x1;return;}if(_0x288431[_0xa061('0x71')]>_0xa79df3){_0xa26815[_0xa061('0x6b')]=_0x288431[_0xa061('0x71')];return;}return db[_0xa061('0x72')][_0xa061('0x4c')]('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[_0xa061('0x72')][_0xa061('0x73')][_0xa061('0x74')]})[_0xa061('0x21')](function(_0xbbaebe){if(_0xbbaebe&&_0xbbaebe[_0xa061('0x55')]){for(var _0x7fb3ee=0x0,_0x2f9066=_0xbbaebe[_0xa061('0x55')];_0x7fb3ee<_0x2f9066&&_['isNil'](_0xa26815[_0xa061('0x6b')]);_0x7fb3ee++){if(_0x288431[_0xa061('0x71')]<=_0xbbaebe[_0x7fb3ee][_0xa061('0x75')]){_0xa26815[_0xa061('0x6b')]=_0xbbaebe[_0x7fb3ee][_0xa061('0x75')];}else if(_0x288431['min_internal']>_0xbbaebe[_0x7fb3ee][_0xa061('0x75')]&&_0x288431[_0xa061('0x71')]<=_0xbbaebe[_0x7fb3ee]['to']){_0xa26815[_0xa061('0x6b')]=_0x288431[_0xa061('0x71')];}}}if(_[_0xa061('0x70')](_0xa26815['internal'])){_0xa26815[_0xa061('0x6b')]=_0xa79df3+0x1;}return _0x538d08(_0xa26815);});});})[_0xa061('0x2a')](function(_0x1f2ee8){_0x2bdea2(_0x1f2ee8);});});}function updateUser(_0x233180){return new Promise(function(_0x36011e,_0x13f6a0){try{if(_0x233180[_0xa061('0x76')]){_0x233180[_0xa061('0x77')]=_0x233180[_0xa061('0x6b')];_0x233180['VoiceMail']={'mailbox':_0x233180[_0xa061('0x6b')],'password':_0x233180[_0xa061('0x45')],'fullname':_0x233180[_0xa061('0x78')],'email':_0x233180[_0xa061('0x79')]};}if(_0x233180[_0xa061('0x2c')]===_0xa061('0x2d')){if(!_0x233180[_0xa061('0x7a')])_0x233180[_0xa061('0x7a')]=[_0xa061('0x7b'),_0xa061('0x7c'),'103','113',_0xa061('0x7d'),_0xa061('0x7e'),'105','106',_0xa061('0x7f'),_0xa061('0x80'),_0xa061('0x81'),_0xa061('0x82'),_0xa061('0x83'),_0xa061('0x84'),_0xa061('0x85')];}_0x36011e(_0x233180);}catch(_0x535f3a){_0x13f6a0(_0x535f3a);}});}exports[_0xa061('0x86')]=function(_0x48d449,_0x56e089){if(_0x48d449[_0xa061('0x33')][_0xa061('0x2c')]===_0xa061('0x2d'))throw new Error(_0xa061('0x87'));if(_0x48d449[_0xa061('0x65')][_0xa061('0x2c')]===_0xa061('0x33')&&_0x48d449[_0xa061('0x33')]['role']!==_0xa061('0x31')){throw new Error(_0xa061('0x88'));}if(_0x48d449[_0xa061('0x65')][_0xa061('0x2c')]===_0xa061('0x31')&&_0x48d449[_0xa061('0x33')][_0xa061('0x2c')]!==_0xa061('0x31')){throw new Error(_0xa061('0x89'));}return licenseUtil[_0xa061('0x8a')]([_0x48d449['body']])['then'](function(){return validateUser(_0x48d449[_0xa061('0x65')]);})[_0xa061('0x21')](function(_0x424ae2){return updateUser(_0x424ae2)[_0xa061('0x21')](function(_0xce673){if(_0xce673[_0xa061('0x2c')]===_0xa061('0x31')){_0xce673[_0xa061('0x8b')]=_0x48d449['user'][_0xa061('0x8b')];delete _0xce673[_0xa061('0x8c')];}return _0xce673;});})[_0xa061('0x21')](function(_0x2d7a73){return db['User'][_0xa061('0x86')](_0x2d7a73,{'include':[{'model':db[_0xa061('0x8d')],'as':_0xa061('0x8d')}]});})[_0xa061('0x21')](function(_0x31dc10){if(_0x48d449[_0xa061('0x65')][_0xa061('0x2c')]===_0xa061('0x33'))return _0x31dc10;if(_0x48d449[_0xa061('0x33')]['role']!=='user')return _0x31dc10;return db[_0xa061('0x8e')][_0xa061('0x68')]({'where':{'name':_0x31dc10['role']==='agent'?'Agents':'Telephones','userProfileId':_0x48d449[_0xa061('0x33')][_0xa061('0x8c')]},'raw':!![]})[_0xa061('0x21')](function(_0x3871ce){if(!_0x3871ce||_0x3871ce[_0xa061('0x8f')]!=0x0)return _0x31dc10;return db[_0xa061('0x3d')][_0xa061('0x86')]({'name':_0x31dc10[_0xa061('0x3c')],'resourceId':_0x31dc10['id'],'type':_0x3871ce['name'],'sectionId':_0x3871ce['id']},{})[_0xa061('0x21')](function(){return _0x31dc10;});})[_0xa061('0x2a')](function(_0x501a28){logger[_0xa061('0x26')](_0xa061('0x90'),_0x501a28);throw _0x501a28;});})[_0xa061('0x21')](respondWithResult(_0x56e089,0xc9))[_0xa061('0x2a')](handleError(_0x56e089,null));};exports[_0xa061('0x91')]=function(_0x5d2d01,_0x145181){var _0x286ed3=_0x5d2d01[_0xa061('0x65')];var _0xa763e7=[];if(_0x5d2d01[_0xa061('0x33')][_0xa061('0x2c')]==='agent')throw new Error(_0xa061('0x87'));if(_['some'](_0x286ed3,[_0xa061('0x2c'),_0xa061('0x33')])&&_0x5d2d01[_0xa061('0x33')]['role']!=='admin'){throw new Error(_0xa061('0x88'));}if(_['some'](_0x286ed3,[_0xa061('0x2c'),_0xa061('0x31')])&&_0x5d2d01[_0xa061('0x33')][_0xa061('0x2c')]!=='admin'){throw new Error(_0xa061('0x92'));}return licenseUtil[_0xa061('0x8a')](_0x286ed3)[_0xa061('0x21')](function(){return validateUser(_0x286ed3[0x0]);})[_0xa061('0x21')](function(){for(var _0x4ce71f=0x1;_0x4ce71f<_0x286ed3[_0xa061('0x55')];_0x4ce71f++){var _0x130e4a=_0x286ed3[_0x4ce71f-0x1][_0xa061('0x6b')];if(!_0x286ed3[_0x4ce71f][_0xa061('0x6b')])_0x286ed3[_0x4ce71f]['internal']=_0x130e4a+0x1;_0xa763e7[_0xa061('0x50')](validateUser(_0x286ed3[_0x4ce71f]));}return Promise['all'](_0xa763e7);})['then'](function(){_0xa763e7=[];for(var _0x3d9457=0x0;_0x3d9457<_0x286ed3[_0xa061('0x55')];_0x3d9457++){_0xa763e7[_0xa061('0x50')](updateUser(_0x286ed3[_0x3d9457]));}return Promise[_0xa061('0x5c')](_0xa763e7);})[_0xa061('0x21')](function(){_0xa763e7=_0x286ed3['map'](function(_0x3c0015){return db[_0xa061('0x40')][_0xa061('0x86')](_0x3c0015,{'include':[{'model':db[_0xa061('0x8d')],'as':_0xa061('0x8d')}]})[_0xa061('0x21')](function(_0xdf56d8){_0x3c0015['id']=_0xdf56d8['id'];return _0x3c0015;});});return Promise[_0xa061('0x5c')](_0xa763e7);})[_0xa061('0x21')](function(_0xc089eb){if(_0x5d2d01[_0xa061('0x65')]['role']===_0xa061('0x33'))return _0xc089eb;if(_0x5d2d01[_0xa061('0x33')][_0xa061('0x2c')]!=='user')return _0xc089eb;var _0x1033ec=_[_0xa061('0x93')](_0xc089eb,function(_0x5d6581){return _0x5d6581[_0xa061('0x2c')]===_0xa061('0x2d')||_0x5d6581['role']===_0xa061('0x36');});if(!_0x1033ec)return _0xc089eb;return db['UserProfileSection'][_0xa061('0x51')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x5d2d01['user'][_0xa061('0x8c')]},'raw':!![]})['then'](function(_0x246de7){if(_[_0xa061('0x94')](_0x246de7)||!_[_0xa061('0x93')](_0x246de7,[_0xa061('0x8f'),0x0]))return _0xc089eb;_0xa763e7=[];var _0xa9f67d=_(_0x246de7)[_0xa061('0x39')](function(_0x56ae2c){if(_0x56ae2c[_0xa061('0x8f')]===0x1)return;return _0x56ae2c['name']===_0xa061('0x34')?_0xa061('0x2d'):'telephone';})['compact']()[_0xa061('0x3a')]();for(var _0x208562=0x0;_0x208562<_0xc089eb[_0xa061('0x55')];_0x208562++){if(!_[_0xa061('0x3b')](_0xa9f67d,_0xc089eb[_0x208562][_0xa061('0x2c')]))return;var _0x1abf38=_0xc089eb[_0x208562][_0xa061('0x2c')]===_0xa061('0x2d')?_0xa061('0x34'):'Telephones';_0xa763e7['push'](db[_0xa061('0x3d')][_0xa061('0x86')]({'name':_0xc089eb[_0x208562]['name'],'resourceId':_0xc089eb[_0x208562]['id'],'type':_0x1abf38,'sectionId':_[_0xa061('0x68')](_0x246de7,[_0xa061('0x3c'),_0x1abf38])['id']},{}));}return Promise[_0xa061('0x5c')](_0xa763e7);});})[_0xa061('0x21')](respondWithResult(_0x145181,0xc9))[_0xa061('0x2a')](handleError(_0x145181,null));};exports[_0xa061('0x95')]=function(_0x58211e,_0x40dff8){if(_0x58211e['body']['id']){delete _0x58211e[_0xa061('0x65')]['id'];}return db['User'][_0xa061('0x68')]({'where':{'id':_0x58211e[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](function(_0x2176fc){if(!_0x2176fc)return null;if(_0x2176fc['id']===_0x58211e[_0xa061('0x33')]['id']){if(!_0x58211e['body'][_0xa061('0x96')]||!_0x58211e[_0xa061('0x65')][_0xa061('0x97')]){throw new db[(_0xa061('0x98'))]['ValidationError'](_0xa061('0x99'));}if(!_0x2176fc['authenticate'](_0x58211e[_0xa061('0x65')]['oldPassword'])){throw new db['Sequelize'][(_0xa061('0x9a'))](_0xa061('0x9b'));}if(_0x58211e['body'][_0xa061('0x96')]===_0x58211e['body'][_0xa061('0x97')]){throw new db[(_0xa061('0x98'))]['ValidationError'](_0xa061('0x9c'));}}else if(_0x58211e[_0xa061('0x33')][_0xa061('0x2c')]===_0xa061('0x31')){if(!_0x58211e[_0xa061('0x65')][_0xa061('0x97')]){throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))](_0xa061('0x9d'));}}else if(_0x58211e['user'][_0xa061('0x2c')]==='user'){if(!_0x58211e[_0xa061('0x65')][_0xa061('0x97')]){throw new db[(_0xa061('0x98'))]['ValidationError'](_0xa061('0x9d'));}if(_0x2176fc[_0xa061('0x2c')]!=='agent'){throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))]('Unauthorized');}}else{throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))](_0xa061('0x87'));}return _0x2176fc;})[_0xa061('0x21')](handleEntityNotFound(_0x40dff8,null))['then'](function(_0x2c5e52){return db[_0xa061('0x6c')][_0xa061('0x9e')]({'attributes':['id',_0xa061('0x6e'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xa061('0x21')](function(_0x1b231c){if(_0x1b231c[_0xa061('0x6e')])authService[_0xa061('0x6f')](_0x58211e[_0xa061('0x65')]['newPassword']);if(!_0x1b231c[_0xa061('0x9f')]||!_0x2c5e52[_0xa061('0xa0')])return _0x2c5e52;authService['validatePasswordHistory'](_0x58211e['body'][_0xa061('0x97')],_0x2c5e52['previousPasswords'],_0x1b231c[_0xa061('0xa1')]);return _0x2c5e52;})[_0xa061('0x21')](saveUpdates({'password':_0x58211e['body'][_0xa061('0x97')],'passwordResetAt':_0x58211e[_0xa061('0x33')]['id']==_0x58211e[_0xa061('0x5e')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x58211e[_0xa061('0x65')][_0xa061('0x97')],_0x2c5e52[_0xa061('0xa0')])},null));})[_0xa061('0x21')](respondWithResult(_0x40dff8,null))[_0xa061('0x2a')](handleError(_0x40dff8,null));};exports[_0xa061('0xa2')]=function(_0xa551,_0x2db331){var _0x1bd4c5=_0xa551[_0xa061('0x65')][_0xa061('0xa3')];return db[_0xa061('0x40')][_0xa061('0x68')]({'where':{'id':_0xa551[_0xa061('0x5e')]['id']},'attributes':['id',_0xa061('0x3c'),_0xa061('0x2c'),_0xa061('0xa4'),'loginInPause',_0xa061('0xa5'),'interface']})[_0xa061('0x21')](handleEntityNotFound(_0x2db331,null))[_0xa061('0x21')](function(_0x1cb824){if(_0x1cb824){if(!utils[_0xa061('0xa6')](_0x1bd4c5)){throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))](_0xa061('0xa7'));}return _0x1cb824[_0xa061('0xa8')+_[_0xa061('0xa9')](_0x1bd4c5[_0xa061('0xaa')]())+'Queues'](_0xa551[_0xa061('0x65')][_0xa061('0x69')],{'penalty':_0xa551['body'][_0xa061('0xab')]||0x0})[_0xa061('0xac')](function(_0x8035a2){for(var _0x4074da=0x0;_0x4074da<_0xa551['body'][_0xa061('0x69')][_0xa061('0x55')];_0x4074da+=0x1){var _0x3f26df={'UserId':Number(_0xa551['params']['id'])};_0x3f26df[_[_0xa061('0xa9')](_0x1bd4c5['toLowerCase']())+_0xa061('0xad')]=Number(_0xa551['body'][_0xa061('0x69')][_0x4074da]);socket[_0xa061('0x2e')](_0xa061('0x33')+_[_0xa061('0xa9')](_0x1bd4c5[_0xa061('0xaa')]())+_0xa061('0xae'),_0x3f26df);}return _0x8035a2;})[_0xa061('0x21')](function(){if(_0x1bd4c5==='voice'){return db['VoiceQueue'][_0xa061('0x51')]({'where':{'id':_0xa551[_0xa061('0x65')][_0xa061('0x69')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xa061('0x21')](function(_0x2fd29e){var _0x417ac8=_0x1cb824[_0xa061('0x30')]({'plain':!![]});var _0x3bba93=[];if(_0x1bd4c5===_0xa061('0xaf')&&_0x417ac8[_0xa061('0x2c')]===_0xa061('0x2d')&&_0x417ac8[_0xa061('0xa4')]){for(let _0x135586=0x0;_0x135586<_0x2fd29e['length'];_0x135586+=0x1){_0x3bba93[_0xa061('0x50')]({'membername':_0x417ac8[_0xa061('0x3c')],'UserId':_0x417ac8['id'],'queue_name':_0x2fd29e[_0x135586]['name'],'VoiceQueueId':_0x2fd29e[_0x135586]['id'],'interface':_[_0xa061('0x70')](_0x417ac8['interface'])?util[_0xa061('0xb0')](_0xa061('0xb1'),_0x417ac8['name']):_0x417ac8[_0xa061('0xb2')],'paused':_0x417ac8['voicePause']||![],'penalty':_0xa551['body'][_0xa061('0xab')]||0x0});}return Promise[_0xa061('0x5c')](_0x3bba93['map'](function(_0xaca845){return db[_0xa061('0xb3')][_0xa061('0xb4')](_0xaca845);}));}return _0x1cb824;});}})[_0xa061('0x21')](respondWithStatusCode(_0x2db331,null))[_0xa061('0x2a')](handleError(_0x2db331,null));};exports[_0xa061('0xb5')]=function(_0x28d054,_0x35135d){var _0x231d42,_0x5eb07d;return db[_0xa061('0x40')]['find']({'where':{'id':_0x28d054[_0xa061('0x5e')]['id']},'attributes':['id',_0xa061('0x3c'),'role']})['then'](handleEntityNotFound(_0x35135d,null))[_0xa061('0x21')](function(_0x34975f){if(_0x34975f){_0x231d42=_0x34975f;if(!_0x28d054[_0xa061('0x4c')][_0xa061('0xa3')]||!utils[_0xa061('0xa6')](_0x28d054[_0xa061('0x4c')][_0xa061('0xa3')])){throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))](_0xa061('0xa7'));}return _0x34975f['remove'+_[_0xa061('0xa9')](_0x28d054['query'][_0xa061('0xa3')][_0xa061('0xaa')]())+_0xa061('0xb6')](_0x28d054[_0xa061('0x4c')][_0xa061('0x69')]);}})[_0xa061('0x21')](function(_0x5aeea4){if(_[_0xa061('0xb7')](_0x28d054[_0xa061('0x4c')][_0xa061('0x69')])){for(var _0x2ec626=0x0;_0x2ec626<_0x28d054['query'][_0xa061('0x69')][_0xa061('0x55')];_0x2ec626+=0x1){_0x5eb07d={'UserId':Number(_0x28d054[_0xa061('0x5e')]['id'])};_0x5eb07d[_[_0xa061('0xa9')](_0x28d054[_0xa061('0x4c')][_0xa061('0xa3')]['toLowerCase']())+_0xa061('0xad')]=Number(_0x28d054[_0xa061('0x4c')][_0xa061('0x69')][_0x2ec626]);socket['emit'](_0xa061('0x33')+_['capitalize'](_0x28d054['query'][_0xa061('0xa3')][_0xa061('0xaa')]())+_0xa061('0xb8'),_0x5eb07d);}}else{_0x5eb07d={'UserId':Number(_0x28d054[_0xa061('0x5e')]['id'])};_0x5eb07d[_[_0xa061('0xa9')](_0x28d054[_0xa061('0x4c')]['channel'][_0xa061('0xaa')]())+_0xa061('0xad')]=Number(_0x28d054['query'][_0xa061('0x69')]);socket[_0xa061('0x2e')](_0xa061('0x33')+_[_0xa061('0xa9')](_0x28d054[_0xa061('0x4c')][_0xa061('0xa3')][_0xa061('0xaa')]())+_0xa061('0xb8'),_0x5eb07d);}return _0x5aeea4;})['then'](function(){if(_0x28d054[_0xa061('0x4c')][_0xa061('0xa3')]==='voice'){return db['UserVoiceQueueRt'][_0xa061('0x2f')]({'where':{'UserId':_0x28d054[_0xa061('0x5e')]['id'],'VoiceQueueId':_0x28d054[_0xa061('0x4c')][_0xa061('0x69')]},'individualHooks':!![]})[_0xa061('0x21')](function(){return _0x231d42;});}return _0x231d42;})[_0xa061('0x21')](respondWithStatusCode(_0x35135d,null))[_0xa061('0x2a')](handleError(_0x35135d,null));};exports['addAvatar']=function(_0x112248,_0x3530c8){_0x112248[_0xa061('0x65')][_0xa061('0xb9')]=_0x112248[_0xa061('0xba')]['filename'];return db[_0xa061('0x40')][_0xa061('0x68')]({'where':{'id':_0x112248['params']['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x3530c8,null))[_0xa061('0x21')](saveUpdates(_0x112248[_0xa061('0x65')],null))['then'](respondWithResult(_0x3530c8,null))[_0xa061('0x2a')](handleError(_0x3530c8,null));};exports['getAvatar']=function(_0x2d38d7,_0x29230a){var _0x13a7c3=path[_0xa061('0xbb')](config[_0xa061('0xbc')],'server/files/images/logos/default_profile.png');return db[_0xa061('0x40')][_0xa061('0x68')]({'where':{'id':_0x2d38d7[_0xa061('0x5e')]['id']},'attributes':['id',_0xa061('0xb9')],'raw':!![]})[_0xa061('0x21')](handleEntityNotFound(_0x29230a,null))[_0xa061('0x21')](function(_0x18c22e){if(_0x18c22e){if(_[_0xa061('0x70')](_0x18c22e[_0xa061('0xb9')])){return _0x29230a[_0xa061('0xbd')](_0x13a7c3);}else{if(!fs[_0xa061('0xbe')](path['join'](config['root'],_0xa061('0xbf'),_0x18c22e['userpic']))){return _0x29230a['download'](_0x13a7c3);}return _0x29230a[_0xa061('0xbd')](path['join'](config['root'],_0xa061('0xbf'),_0x18c22e[_0xa061('0xb9')]));}}})[_0xa061('0x2a')](handleError(_0x29230a,null));};exports[_0xa061('0xc0')]=function(_0x3868bc,_0x35b2e4){return db['User'][_0xa061('0x68')]({'where':{'id':_0x3868bc[_0xa061('0x5e')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x35b2e4,null))['then'](function(_0x57c3f1){var _0x25e029=[];values=_0x57c3f1['dataValues'];_0x25e029[_0xa061('0x50')](get_open_tabs('chat',_0x57c3f1[_0xa061('0x57')]));_0x25e029[_0xa061('0x50')](get_open_tabs('sms',_0x57c3f1[_0xa061('0x57')]));_0x25e029[_0xa061('0x50')](get_open_tabs(_0xa061('0x5a'),_0x57c3f1[_0xa061('0x57')]));_0x25e029['push'](get_open_tabs('whatsapp',_0x57c3f1[_0xa061('0x57')]));_0x25e029[_0xa061('0x50')](get_open_tabs(_0xa061('0x58'),_0x57c3f1[_0xa061('0x57')]));_0x25e029['push'](get_open_tabs('mail',_0x57c3f1['dataValues']));return Promise['all'](_0x25e029);})[_0xa061('0x21')](function(_0x116e7c){if(_0x116e7c){var _0x1b9a8b=_[_0xa061('0x39')](values['ChatOpenTabs'],function(_0x4c286a){return{'channel':_0xa061('0xc1'),'id':_0x4c286a['id'],'createdAt':_0x4c286a[_0xa061('0xc2')]};});var _0x5a5095=_[_0xa061('0x39')](values['FaxOpenTabs'],function(_0x5f0e77){return{'channel':_0xa061('0xc3'),'id':_0x5f0e77['id'],'createdAt':_0x5f0e77['createdAt']};});var _0x451a9c=_[_0xa061('0x39')](values['OpenchannelOpenTabs'],function(_0x29b4a7){return{'channel':_0xa061('0xc4'),'id':_0x29b4a7['id'],'createdAt':_0x29b4a7['createdAt']};});var _0x4f64c5=_[_0xa061('0x39')](values[_0xa061('0xc5')],function(_0x1edc1e){return{'channel':_0xa061('0xc6'),'id':_0x1edc1e['id'],'createdAt':_0x1edc1e['createdAt']};});var _0xdd216f=_['map'](values[_0xa061('0xc7')],function(_0x1e9a32){return{'channel':_0xa061('0xc8'),'id':_0x1e9a32['id'],'createdAt':_0x1e9a32[_0xa061('0xc2')]};});var _0x46fc5f=_[_0xa061('0x39')](values[_0xa061('0xc9')],function(_0x3998d9){return{'channel':_0xa061('0xca'),'id':_0x3998d9['id'],'createdAt':_0x3998d9[_0xa061('0xc2')]};});var _0x424439=_['concat'](_0x1b9a8b,_0x5a5095,_0x451a9c,_0x4f64c5,_0xdd216f,_0x46fc5f);var _0x41eb96={'count':_0x424439[_0xa061('0x55')],'rows':_0x424439};return _0x41eb96;}else return null;})[_0xa061('0x21')](respondWithResult(_0x35b2e4,null))['catch'](handleError(_0x35b2e4,null));};exports[_0xa061('0xcb')]=function(_0x14deb4,_0x25ce42){var _0x473baa={};return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x14deb4[_0xa061('0x5e')]['id']}})['then'](function(_0x26c964){if(!_0x26c964){throw new APINotFoundError(util[_0xa061('0xb0')](_0xa061('0xcc'),_0x14deb4[_0xa061('0x5e')]['id']));}return contacts[_0xa061('0x66')]();})['then'](function(_0x51f0e6){_0x14deb4[_0xa061('0x4c')]['User']=_0x14deb4[_0xa061('0x5e')]['id'];_0x473baa=qs[_0xa061('0x5f')](_0x51f0e6,_0x14deb4);if(_0x14deb4[_0xa061('0x4c')][_0xa061('0xcd')]('includeAll')){_0x473baa[_0xa061('0x60')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xa061('0xce')],'as':_0xa061('0xcf'),'attributes':['id',_0xa061('0x3c'),_0xa061('0xd0')],'where':_0x14deb4[_0xa061('0x4c')][_0xa061('0xd1')]?{'id':_0x14deb4[_0xa061('0x4c')][_0xa061('0xd1')]}:undefined,'required':_0x14deb4[_0xa061('0x4c')][_0xa061('0xd1')]?!![]:![]}];}return contacts['findAll'](_0x14deb4[_0xa061('0x4c')],_0x14deb4['user'],_0x473baa,_0x51f0e6);})[_0xa061('0x21')](respondWithFilteredResult(_0x25ce42,_0x473baa))[_0xa061('0x2a')](APIHandleError(_0x25ce42));};exports[_0xa061('0xd2')]=function(_0x1b4eee,_0x383e7e){var _0x55d4a9;var _0x1aa538={};var _0x44e4a0;return db['User']['findOne']({'where':{'id':_0x1b4eee[_0xa061('0x5e')]['id']},'attributes':['id',_0xa061('0x3c'),_0xa061('0x2c')]})[_0xa061('0x21')](handleEntityNotFound(_0x383e7e,null))[_0xa061('0x21')](function(_0x184463){if(!utils[_0xa061('0xa6')](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xa3')])){throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))]('Unknown\x20channel');}_0x55d4a9=_0x184463;var _0x25e449={};_0x25e449[_0xa061('0xd3')]=_['keys'](db[_[_0xa061('0xa9')](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xa3')])+_0xa061('0xd4')][_0xa061('0x41')]);_0x25e449[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x1b4eee[_0xa061('0x4c')]);_0x25e449[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x25e449[_0xa061('0xd3')],_0x25e449[_0xa061('0x4c')]);_0x1aa538[_0xa061('0x4f')]=_['intersection'](_0x25e449[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x1b4eee[_0xa061('0x4c')]['fields']));_0x1aa538['attributes']=_0x1aa538[_0xa061('0x4f')][_0xa061('0x55')]?_0x1aa538['attributes']:_0x25e449['model'];_0x1aa538['order']=qs['sort'](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xd9')]);_0x1aa538[_0xa061('0x4a')]=qs['filters'](_['pick'](_0x1b4eee['query'],_0x25e449[_0xa061('0xd6')]));if(_0x1b4eee[_0xa061('0x4c')][_0xa061('0x37')]){_0x1aa538[_0xa061('0x4a')]=_['merge'](_0x1aa538[_0xa061('0x4a')],{'$or':_['map'](_0x1aa538[_0xa061('0x4f')],function(_0x1c5657){var _0x4c5abc={};_0x4c5abc[_0x1c5657]={'$like':'%'+_0x1b4eee[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x4c5abc;})});}_0x1aa538=_[_0xa061('0x62')]({},_0x1aa538,_0x1b4eee[_0xa061('0x63')]);switch(_0x55d4a9[_0xa061('0x2c')]){case _0xa061('0x31'):return db[_[_0xa061('0xa9')](_0x1b4eee['query'][_0xa061('0xa3')])+_0xa061('0xd4')]['findAll'](_0x1aa538);case'user':case _0xa061('0x2d'):return _0x55d4a9[_0xa061('0x30')+_['capitalize'](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xa3')])+_0xa061('0xb6')](_0x1aa538);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})[_0xa061('0x21')](function(_0x320ad6){_0x44e4a0=_0x320ad6[_0xa061('0x55')];if(!_0x1b4eee[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x1aa538[_0xa061('0xdb')]=qs[_0xa061('0xdb')](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xdb')]);_0x1aa538['offset']=qs[_0xa061('0x1e')](_0x1b4eee['query']['offset']);}switch(_0x55d4a9[_0xa061('0x2c')]){case _0xa061('0x31'):return db[_[_0xa061('0xa9')](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xa3')])+_0xa061('0xd4')]['findAll'](_0x1aa538);case _0xa061('0x33'):case _0xa061('0x2d'):return _0x55d4a9[_0xa061('0x30')+_['capitalize'](_0x1b4eee[_0xa061('0x4c')][_0xa061('0xa3')])+'Queues'](_0x1aa538);}})[_0xa061('0x21')](function(_0x40eb05){return{'count':_0x44e4a0,'rows':_0x40eb05};})['then'](respondWithResult(_0x383e7e,null))[_0xa061('0x2a')](handleError(_0x383e7e,null));};exports[_0xa061('0xdc')]=function(_0x20f003,_0x5370c1){var _0x2f48f1={};var _0x27b254={};var _0x20e23e;var _0x81040;return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x20f003[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x5370c1,null))['then'](function(_0x1b6b90){if(_0x1b6b90){_0x20e23e=_0x1b6b90;_0x27b254[_0xa061('0xd3')]=_[_0xa061('0xd5')](db[_0xa061('0xb3')][_0xa061('0x41')]);_0x27b254[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x20f003['query']);_0x27b254[_0xa061('0xd6')]=_['intersection'](_0x27b254['model'],_0x27b254[_0xa061('0x4c')]);_0x2f48f1[_0xa061('0x4f')]=_[_0xa061('0xd7')](_0x27b254[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x20f003[_0xa061('0x4c')][_0xa061('0xd8')]));_0x2f48f1[_0xa061('0x4f')]=_0x2f48f1[_0xa061('0x4f')][_0xa061('0x55')]?_0x2f48f1[_0xa061('0x4f')]:_0x27b254[_0xa061('0xd3')];_0x2f48f1[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x20f003[_0xa061('0x4c')][_0xa061('0xd9')]);_0x2f48f1[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x20f003[_0xa061('0x4c')],_0x27b254['filters']));if(_0x20f003['query'][_0xa061('0x37')]){_0x2f48f1['where']=_[_0xa061('0x62')](_0x2f48f1[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x2f48f1[_0xa061('0x4f')],function(_0x14064b){var _0x239a49={};_0x239a49[_0x14064b]={'$like':'%'+_0x20f003[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x239a49;})});}_0x2f48f1=_[_0xa061('0x62')]({},_0x2f48f1,_0x20f003[_0xa061('0x63')]);return _0x20e23e[_0xa061('0xdc')](_0x2f48f1);}})[_0xa061('0x21')](function(_0x342651){if(_0x342651){_0x81040=_0x342651[_0xa061('0x55')];if(!_0x20f003[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x2f48f1[_0xa061('0xdb')]=qs['limit'](_0x20f003['query'][_0xa061('0xdb')]);_0x2f48f1[_0xa061('0x1e')]=qs[_0xa061('0x1e')](_0x20f003[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x20e23e['getVoiceQueuesRt'](_0x2f48f1);}})[_0xa061('0x21')](function(_0xf9d2da){if(_0xf9d2da){return _0xf9d2da?{'count':_0x81040,'rows':_0xf9d2da}:null;}})[_0xa061('0x21')](respondWithResult(_0x5370c1,null))[_0xa061('0x2a')](handleError(_0x5370c1,null));};exports[_0xa061('0xdf')]=function(_0x2dea61,_0x2601db){var _0xb1fbb0={};var _0x214f40={};var _0x1a7e4c;var _0x50d276;return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x2dea61[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x2601db,null))['then'](function(_0xb53c40){if(_0xb53c40){_0x1a7e4c=_0xb53c40;_0x214f40['model']=_[_0xa061('0xd5')](db['ChatGroup']['rawAttributes']);_0x214f40[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x2dea61[_0xa061('0x4c')]);_0x214f40['filters']=_[_0xa061('0xd7')](_0x214f40['model'],_0x214f40[_0xa061('0x4c')]);_0xb1fbb0[_0xa061('0x4f')]=_[_0xa061('0xd7')](_0x214f40['model'],qs[_0xa061('0xd8')](_0x2dea61[_0xa061('0x4c')][_0xa061('0xd8')]));_0xb1fbb0['attributes']=_0xb1fbb0[_0xa061('0x4f')][_0xa061('0x55')]?_0xb1fbb0[_0xa061('0x4f')]:_0x214f40[_0xa061('0xd3')];_0xb1fbb0[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x2dea61['query'][_0xa061('0xd9')]);_0xb1fbb0[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x2dea61[_0xa061('0x4c')],_0x214f40[_0xa061('0xd6')]));if(_0x2dea61[_0xa061('0x4c')]['filter']){_0xb1fbb0['where']=_[_0xa061('0x62')](_0xb1fbb0[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0xb1fbb0[_0xa061('0x4f')],function(_0x5af62f){var _0x12b9bb={};_0x12b9bb[_0x5af62f]={'$like':'%'+_0x2dea61[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x12b9bb;})});}_0xb1fbb0=_['merge']({},_0xb1fbb0,_0x2dea61[_0xa061('0x63')]);return _0x1a7e4c[_0xa061('0xdf')](_0xb1fbb0);}})[_0xa061('0x21')](function(_0x53d7a7){if(_0x53d7a7){_0x50d276=_0x53d7a7['length'];if(!_0x2dea61[_0xa061('0x4c')][_0xa061('0xcd')]('nolimit')){_0xb1fbb0[_0xa061('0xdb')]=qs[_0xa061('0xdb')](_0x2dea61[_0xa061('0x4c')][_0xa061('0xdb')]);_0xb1fbb0[_0xa061('0x1e')]=qs[_0xa061('0x1e')](_0x2dea61['query'][_0xa061('0x1e')]);}return _0x1a7e4c[_0xa061('0xdf')](_0xb1fbb0);}})[_0xa061('0x21')](function(_0x53ab95){if(_0x53ab95){return _0x53ab95?{'count':_0x50d276,'rows':_0x53ab95}:null;}})[_0xa061('0x21')](respondWithResult(_0x2601db,null))['catch'](handleError(_0x2601db,null));};exports[_0xa061('0xe0')]=function(_0x2aed34,_0x2c2745){var _0x22f2a6={'raw':!![],'where':{}};var _0x5aa03e={};var _0x4f3a43={'count':0x0,'rows':[]};return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x2aed34[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x2c2745,null))[_0xa061('0x21')](function(_0x333e53){if(_0x333e53){_0x5aa03e[_0xa061('0xd3')]=_[_0xa061('0xd5')](db[_0xa061('0xe1')][_0xa061('0x41')]);_0x5aa03e['query']=_[_0xa061('0xd5')](_0x2aed34[_0xa061('0x4c')]);_0x5aa03e[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x5aa03e['model'],_0x5aa03e[_0xa061('0x4c')]);_0x22f2a6[_0xa061('0x4f')]=_['intersection'](_0x5aa03e['model'],qs[_0xa061('0xd8')](_0x2aed34[_0xa061('0x4c')][_0xa061('0xd8')]));_0x22f2a6[_0xa061('0x4f')]=_0x22f2a6[_0xa061('0x4f')][_0xa061('0x55')]?_0x22f2a6['attributes']:_0x5aa03e['model'];if(!_0x2aed34['query'][_0xa061('0xcd')](_0xa061('0xda'))){_0x22f2a6['limit']=qs[_0xa061('0xdb')](_0x2aed34['query']['limit']);_0x22f2a6[_0xa061('0x1e')]=qs[_0xa061('0x1e')](_0x2aed34[_0xa061('0x4c')]['offset']);}_0x22f2a6[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x2aed34[_0xa061('0x4c')][_0xa061('0xd9')]);_0x22f2a6['where']=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x2aed34['query'],_0x5aa03e[_0xa061('0xd6')]));_0x22f2a6[_0xa061('0x4a')][_0xa061('0xe2')]=_0x333e53['id'];if(_0x2aed34[_0xa061('0x4c')][_0xa061('0x37')]){_0x22f2a6[_0xa061('0x4a')]=_['merge'](_0x22f2a6['where'],{'$or':_[_0xa061('0x39')](_0x22f2a6[_0xa061('0x4f')],function(_0x25d975){var _0x58471b={};_0x58471b[_0x25d975]={'$like':'%'+_0x2aed34[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x58471b;})});}_0x22f2a6=_[_0xa061('0x62')]({},_0x22f2a6,_0x2aed34['options']);return db[_0xa061('0xe1')]['count']({'where':_0x22f2a6['where']})[_0xa061('0x21')](function(_0x330b9a){_0x4f3a43[_0xa061('0x4b')]=_0x330b9a;if(_0x2aed34['query'][_0xa061('0x4d')]){_0x22f2a6['include']=[{'all':!![]}];}return db[_0xa061('0xe1')][_0xa061('0x51')](_0x22f2a6);})[_0xa061('0x21')](function(_0xa38eef){_0x4f3a43[_0xa061('0x54')]=_0xa38eef;return _0x4f3a43;});}})['then'](respondWithFilteredResult(_0x2c2745,_0x22f2a6))['catch'](handleError(_0x2c2745,null));};exports[_0xa061('0xe3')]=function(_0x5495ab,_0x4a88e0){var _0x37f486={'raw':!![],'where':{}};var _0xe7ae78={};var _0x4a5ec4={'count':0x0,'rows':[]};return db[_0xa061('0x40')]['findOne']({'where':{'id':_0x5495ab[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x4a88e0,null))[_0xa061('0x21')](function(_0x1361b4){if(_0x1361b4){_0xe7ae78[_0xa061('0xd3')]=_['keys'](db[_0xa061('0xe4')][_0xa061('0x41')]);_0xe7ae78[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x5495ab[_0xa061('0x4c')]);_0xe7ae78[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0xe7ae78[_0xa061('0xd3')],_0xe7ae78[_0xa061('0x4c')]);_0x37f486['attributes']=_[_0xa061('0xd7')](_0xe7ae78[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x5495ab['query'][_0xa061('0xd8')]));_0x37f486[_0xa061('0x4f')]=_0x37f486['attributes'][_0xa061('0x55')]?_0x37f486[_0xa061('0x4f')]:_0xe7ae78[_0xa061('0xd3')];if(!_0x5495ab[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x37f486[_0xa061('0xdb')]=qs[_0xa061('0xdb')](_0x5495ab[_0xa061('0x4c')][_0xa061('0xdb')]);_0x37f486['offset']=qs[_0xa061('0x1e')](_0x5495ab['query'][_0xa061('0x1e')]);}_0x37f486[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x5495ab['query']['sort']);_0x37f486[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x5495ab[_0xa061('0x4c')],_0xe7ae78[_0xa061('0xd6')]));_0x37f486[_0xa061('0x4a')][_0xa061('0xe2')]=_0x1361b4['id'];if(_0x5495ab[_0xa061('0x4c')]['filter']){_0x37f486[_0xa061('0x4a')]=_[_0xa061('0x62')](_0x37f486[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x37f486[_0xa061('0x4f')],function(_0x297e29){var _0xe012c3={};_0xe012c3[_0x297e29]={'$like':'%'+_0x5495ab['query'][_0xa061('0x37')]+'%'};return _0xe012c3;})});}_0x37f486=_['merge']({},_0x37f486,_0x5495ab[_0xa061('0x63')]);return db['ScreenRecording']['count']({'where':_0x37f486[_0xa061('0x4a')]})[_0xa061('0x21')](function(_0x152b71){_0x4a5ec4['count']=_0x152b71;if(_0x5495ab[_0xa061('0x4c')][_0xa061('0x4d')]){_0x37f486[_0xa061('0x60')]=[{'all':!![]}];}return db[_0xa061('0xe4')][_0xa061('0x51')](_0x37f486);})[_0xa061('0x21')](function(_0x5acd75){_0x4a5ec4[_0xa061('0x54')]=_0x5acd75;return _0x4a5ec4;});}})['then'](respondWithFilteredResult(_0x4a88e0,_0x37f486))['catch'](handleError(_0x4a88e0,null));};exports[_0xa061('0xe5')]=function(_0x140b25,_0x316e7c){var _0x595e8b={};var _0x29f4c2={};var _0x443ac3;var _0x9a13bb;return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x140b25[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x316e7c,null))[_0xa061('0x21')](function(_0x5115bf){if(_0x5115bf){_0x443ac3=_0x5115bf;_0x29f4c2['model']=_['keys'](db[_0xa061('0xe6')][_0xa061('0x41')]);_0x29f4c2[_0xa061('0x4c')]=_['keys'](_0x140b25[_0xa061('0x4c')]);_0x29f4c2[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x29f4c2[_0xa061('0xd3')],_0x29f4c2[_0xa061('0x4c')]);_0x595e8b[_0xa061('0x4f')]=_[_0xa061('0xd7')](_0x29f4c2[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x140b25['query'][_0xa061('0xd8')]));_0x595e8b[_0xa061('0x4f')]=_0x595e8b['attributes'][_0xa061('0x55')]?_0x595e8b[_0xa061('0x4f')]:_0x29f4c2[_0xa061('0xd3')];_0x595e8b[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x140b25['query'][_0xa061('0xd9')]);_0x595e8b['where']=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x140b25['query'],_0x29f4c2[_0xa061('0xd6')]));if(_0x140b25[_0xa061('0x4c')][_0xa061('0x37')]){_0x595e8b[_0xa061('0x4a')]=_['merge'](_0x595e8b[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x595e8b[_0xa061('0x4f')],function(_0x2dac37){var _0x5c0880={};_0x5c0880[_0x2dac37]={'$like':'%'+_0x140b25[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x5c0880;})});}_0x595e8b=_[_0xa061('0x62')]({},_0x595e8b,_0x140b25[_0xa061('0x63')]);return _0x443ac3[_0xa061('0xe5')](_0x595e8b);}})[_0xa061('0x21')](function(_0xb3a0ac){if(_0xb3a0ac){_0x9a13bb=_0xb3a0ac[_0xa061('0x55')];if(!_0x140b25[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x595e8b['limit']=qs['limit'](_0x140b25['query'][_0xa061('0xdb')]);_0x595e8b[_0xa061('0x1e')]=qs['offset'](_0x140b25[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x443ac3[_0xa061('0xe5')](_0x595e8b);}})[_0xa061('0x21')](function(_0x32c74f){if(_0x32c74f){return _0x32c74f?{'count':_0x9a13bb,'rows':_0x32c74f}:null;}})[_0xa061('0x21')](respondWithResult(_0x316e7c,null))['catch'](handleError(_0x316e7c,null));};exports[_0xa061('0xe7')]=function(_0x759309,_0x181ce3){var _0x1b97cb={};var _0x241145={};var _0x43ef2d;var _0x4671bc;return db['User']['findOne']({'where':{'id':_0x759309['params']['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x181ce3,null))[_0xa061('0x21')](function(_0x3b6a91){if(_0x3b6a91){_0x43ef2d=_0x3b6a91;_0x241145[_0xa061('0xd3')]=_[_0xa061('0xd5')](db['OpenchannelInteraction']['rawAttributes']);_0x241145[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x759309['query']);_0x241145[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x241145['model'],_0x241145['query']);_0x1b97cb[_0xa061('0x4f')]=_['intersection'](_0x241145[_0xa061('0xd3')],qs['fields'](_0x759309[_0xa061('0x4c')][_0xa061('0xd8')]));_0x1b97cb[_0xa061('0x4f')]=_0x1b97cb['attributes']['length']?_0x1b97cb[_0xa061('0x4f')]:_0x241145[_0xa061('0xd3')];_0x1b97cb['order']=qs['sort'](_0x759309[_0xa061('0x4c')][_0xa061('0xd9')]);_0x1b97cb[_0xa061('0x4a')]=qs['filters'](_[_0xa061('0xde')](_0x759309['query'],_0x241145[_0xa061('0xd6')]));if(_0x759309[_0xa061('0x4c')]['filter']){_0x1b97cb['where']=_[_0xa061('0x62')](_0x1b97cb[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x1b97cb[_0xa061('0x4f')],function(_0x1403fd){var _0x1819d4={};_0x1819d4[_0x1403fd]={'$like':'%'+_0x759309['query'][_0xa061('0x37')]+'%'};return _0x1819d4;})});}_0x1b97cb=_[_0xa061('0x62')]({},_0x1b97cb,_0x759309['options']);return _0x43ef2d[_0xa061('0xe7')](_0x1b97cb);}})[_0xa061('0x21')](function(_0x56369){if(_0x56369){_0x4671bc=_0x56369['length'];if(!_0x759309[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x1b97cb['limit']=qs[_0xa061('0xdb')](_0x759309[_0xa061('0x4c')][_0xa061('0xdb')]);_0x1b97cb[_0xa061('0x1e')]=qs[_0xa061('0x1e')](_0x759309[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x43ef2d[_0xa061('0xe7')](_0x1b97cb);}})[_0xa061('0x21')](function(_0x580db3){if(_0x580db3){return _0x580db3?{'count':_0x4671bc,'rows':_0x580db3}:null;}})[_0xa061('0x21')](respondWithResult(_0x181ce3,null))[_0xa061('0x2a')](handleError(_0x181ce3,null));};exports['getMailInteractions']=function(_0x101102,_0x465c8b){var _0x13dafe={'raw':!![],'where':{}};var _0x2713ae={};var _0x132bfe={'count':0x0,'rows':[]};return db['User'][_0xa061('0x9e')]({'where':{'id':_0x101102[_0xa061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x465c8b,null))[_0xa061('0x21')](function(_0xf15d3){if(_0xf15d3){_0x2713ae['model']=_[_0xa061('0xd5')](db[_0xa061('0xe8')][_0xa061('0x41')]);_0x2713ae[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x101102[_0xa061('0x4c')]);_0x2713ae[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x2713ae['model'],_0x2713ae[_0xa061('0x4c')]);_0x13dafe[_0xa061('0x4f')]=_[_0xa061('0xd7')](_0x2713ae[_0xa061('0xd3')],qs['fields'](_0x101102['query'][_0xa061('0xd8')]));_0x13dafe[_0xa061('0x4f')]=_0x13dafe[_0xa061('0x4f')][_0xa061('0x55')]?_0x13dafe[_0xa061('0x4f')]:_0x2713ae[_0xa061('0xd3')];if(!_0x101102[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x13dafe['limit']=qs['limit'](_0x101102[_0xa061('0x4c')]['limit']);_0x13dafe[_0xa061('0x1e')]=qs['offset'](_0x101102[_0xa061('0x4c')]['offset']);}_0x13dafe['order']=qs[_0xa061('0xd9')](_0x101102['query'][_0xa061('0xd9')]);_0x13dafe[_0xa061('0x4a')]=qs['filters'](_[_0xa061('0xde')](_0x101102[_0xa061('0x4c')],_0x2713ae['filters']));_0x13dafe['where'][_0xa061('0xe2')]=_0xf15d3['id'];if(_0x101102[_0xa061('0x4c')]['filter']){_0x13dafe['where']=_[_0xa061('0x62')](_0x13dafe[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x13dafe[_0xa061('0x4f')],function(_0x52b4d9){var _0x96f993={};_0x96f993[_0x52b4d9]={'$like':'%'+_0x101102[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x96f993;})});}_0x13dafe=_[_0xa061('0x62')]({},_0x13dafe,_0x101102['options']);return db[_0xa061('0xe8')]['count']({'where':_0x13dafe[_0xa061('0x4a')]})['then'](function(_0x42ac9b){_0x132bfe['count']=_0x42ac9b;if(_0x101102[_0xa061('0x4c')]['includeAll']){_0x13dafe['include']=[{'all':!![]}];}return db[_0xa061('0xe8')][_0xa061('0x51')](_0x13dafe);})[_0xa061('0x21')](function(_0x3e635f){_0x132bfe[_0xa061('0x54')]=_0x3e635f;return _0x132bfe;});}})[_0xa061('0x21')](respondWithFilteredResult(_0x465c8b,_0x13dafe))[_0xa061('0x2a')](handleError(_0x465c8b,null));};exports[_0xa061('0xe9')]=function(_0x3e1eb1,_0x1abd03){var _0x2026fb={};var _0x46c1d3={};var _0x2439a3;var _0x4579cc;return db[_0xa061('0x40')]['findOne']({'where':{'id':_0x3e1eb1[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x1abd03,null))['then'](function(_0x4c955c){if(_0x4c955c){_0x2439a3=_0x4c955c;_0x46c1d3[_0xa061('0xd3')]=_['keys'](db[_0xa061('0xea')]['rawAttributes']);_0x46c1d3[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x3e1eb1['query']);_0x46c1d3['filters']=_['intersection'](_0x46c1d3[_0xa061('0xd3')],_0x46c1d3['query']);_0x2026fb['attributes']=_[_0xa061('0xd7')](_0x46c1d3[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x3e1eb1[_0xa061('0x4c')]['fields']));_0x2026fb[_0xa061('0x4f')]=_0x2026fb[_0xa061('0x4f')][_0xa061('0x55')]?_0x2026fb[_0xa061('0x4f')]:_0x46c1d3['model'];_0x2026fb[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x3e1eb1[_0xa061('0x4c')][_0xa061('0xd9')]);_0x2026fb['where']=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x3e1eb1[_0xa061('0x4c')],_0x46c1d3[_0xa061('0xd6')]));if(_0x3e1eb1[_0xa061('0x4c')]['filter']){_0x2026fb['where']=_[_0xa061('0x62')](_0x2026fb[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x2026fb[_0xa061('0x4f')],function(_0x454de4){var _0x4423e0={};_0x4423e0[_0x454de4]={'$like':'%'+_0x3e1eb1[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x4423e0;})});}_0x2026fb=_['merge']({},_0x2026fb,_0x3e1eb1[_0xa061('0x63')]);return _0x2439a3[_0xa061('0xe9')](_0x2026fb);}})[_0xa061('0x21')](function(_0x268bfb){if(_0x268bfb){_0x4579cc=_0x268bfb[_0xa061('0x55')];if(!_0x3e1eb1[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x2026fb['limit']=qs['limit'](_0x3e1eb1[_0xa061('0x4c')][_0xa061('0xdb')]);_0x2026fb[_0xa061('0x1e')]=qs['offset'](_0x3e1eb1[_0xa061('0x4c')]['offset']);}return _0x2439a3[_0xa061('0xe9')](_0x2026fb);}})[_0xa061('0x21')](function(_0x1afcb6){if(_0x1afcb6){return _0x1afcb6?{'count':_0x4579cc,'rows':_0x1afcb6}:null;}})[_0xa061('0x21')](respondWithResult(_0x1abd03,null))[_0xa061('0x2a')](handleError(_0x1abd03,null));};exports[_0xa061('0xeb')]=function(_0x1e7191,_0x4fce41){var _0x1be006={};var _0x2bae8e={};var _0x107e48;var _0x104c59;return db['User'][_0xa061('0x9e')]({'where':{'id':_0x1e7191[_0xa061('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4fce41,null))[_0xa061('0x21')](function(_0x313053){if(_0x313053){_0x107e48=_0x313053;_0x2bae8e[_0xa061('0xd3')]=_[_0xa061('0xd5')](db[_0xa061('0xec')][_0xa061('0x41')]);_0x2bae8e[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x1e7191[_0xa061('0x4c')]);_0x2bae8e[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x2bae8e['model'],_0x2bae8e[_0xa061('0x4c')]);_0x1be006[_0xa061('0x4f')]=_[_0xa061('0xd7')](_0x2bae8e[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x1e7191[_0xa061('0x4c')][_0xa061('0xd8')]));_0x1be006[_0xa061('0x4f')]=_0x1be006[_0xa061('0x4f')][_0xa061('0x55')]?_0x1be006[_0xa061('0x4f')]:_0x2bae8e['model'];_0x1be006['order']=qs['sort'](_0x1e7191[_0xa061('0x4c')][_0xa061('0xd9')]);_0x1be006[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x1e7191[_0xa061('0x4c')],_0x2bae8e[_0xa061('0xd6')]));if(_0x1e7191[_0xa061('0x4c')]['filter']){_0x1be006[_0xa061('0x4a')]=_['merge'](_0x1be006['where'],{'$or':_[_0xa061('0x39')](_0x1be006[_0xa061('0x4f')],function(_0x26012d){var _0x425f87={};_0x425f87[_0x26012d]={'$like':'%'+_0x1e7191[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x425f87;})});}_0x1be006=_[_0xa061('0x62')]({},_0x1be006,_0x1e7191[_0xa061('0x63')]);return _0x107e48[_0xa061('0xeb')](_0x1be006);}})[_0xa061('0x21')](function(_0x2c540a){if(_0x2c540a){_0x104c59=_0x2c540a['length'];if(!_0x1e7191['query']['hasOwnProperty'](_0xa061('0xda'))){_0x1be006[_0xa061('0xdb')]=qs[_0xa061('0xdb')](_0x1e7191['query'][_0xa061('0xdb')]);_0x1be006[_0xa061('0x1e')]=qs[_0xa061('0x1e')](_0x1e7191[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x107e48[_0xa061('0xeb')](_0x1be006);}})[_0xa061('0x21')](function(_0x326dcf){if(_0x326dcf){return _0x326dcf?{'count':_0x104c59,'rows':_0x326dcf}:null;}})[_0xa061('0x21')](respondWithResult(_0x4fce41,null))[_0xa061('0x2a')](handleError(_0x4fce41,null));};exports['getWhatsappInteractions']=function(_0x3b87a7,_0x5097ca){var _0xbf1179={};var _0x3d2151={};var _0x1ea640;var _0x53be04;return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x3b87a7['params']['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x5097ca,null))['then'](function(_0x3205f3){if(_0x3205f3){_0x1ea640=_0x3205f3;_0x3d2151[_0xa061('0xd3')]=_[_0xa061('0xd5')](db[_0xa061('0xed')][_0xa061('0x41')]);_0x3d2151[_0xa061('0x4c')]=_['keys'](_0x3b87a7[_0xa061('0x4c')]);_0x3d2151[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x3d2151[_0xa061('0xd3')],_0x3d2151[_0xa061('0x4c')]);_0xbf1179[_0xa061('0x4f')]=_['intersection'](_0x3d2151['model'],qs[_0xa061('0xd8')](_0x3b87a7[_0xa061('0x4c')][_0xa061('0xd8')]));_0xbf1179[_0xa061('0x4f')]=_0xbf1179[_0xa061('0x4f')][_0xa061('0x55')]?_0xbf1179[_0xa061('0x4f')]:_0x3d2151[_0xa061('0xd3')];_0xbf1179[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x3b87a7['query'][_0xa061('0xd9')]);_0xbf1179[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x3b87a7[_0xa061('0x4c')],_0x3d2151[_0xa061('0xd6')]));if(_0x3b87a7[_0xa061('0x4c')]['filter']){_0xbf1179[_0xa061('0x4a')]=_['merge'](_0xbf1179[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0xbf1179[_0xa061('0x4f')],function(_0x396f35){var _0x308ab6={};_0x308ab6[_0x396f35]={'$like':'%'+_0x3b87a7[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x308ab6;})});}_0xbf1179=_['merge']({},_0xbf1179,_0x3b87a7[_0xa061('0x63')]);return _0x1ea640[_0xa061('0xee')](_0xbf1179);}})[_0xa061('0x21')](function(_0xb45f0c){if(_0xb45f0c){_0x53be04=_0xb45f0c[_0xa061('0x55')];if(!_0x3b87a7['query'][_0xa061('0xcd')](_0xa061('0xda'))){_0xbf1179[_0xa061('0xdb')]=qs['limit'](_0x3b87a7[_0xa061('0x4c')][_0xa061('0xdb')]);_0xbf1179[_0xa061('0x1e')]=qs[_0xa061('0x1e')](_0x3b87a7[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x1ea640[_0xa061('0xee')](_0xbf1179);}})[_0xa061('0x21')](function(_0x3bba9e){if(_0x3bba9e){return _0x3bba9e?{'count':_0x53be04,'rows':_0x3bba9e}:null;}})['then'](respondWithResult(_0x5097ca,null))['catch'](handleError(_0x5097ca,null));};exports[_0xa061('0xef')]=function(_0x40983a,_0x486189,_0x446d1e){var _0x278c95;var _0x34b15c;var _0x522071;var _0x35b751=!_[_0xa061('0x70')](_0x40983a[_0xa061('0x5e')]['id'])?_0x40983a[_0xa061('0x5e')]['id']:!_[_0xa061('0x70')](_0x40983a[_0xa061('0x33')]['id'])?_0x40983a['user']['id']:null;return db[_0xa061('0x40')]['find']({'where':{'id':_0x35b751,'role':{'$or':[_0xa061('0x31'),_0xa061('0x33'),_0xa061('0x2d')]}},'attributes':['id',_0xa061('0x3c'),_0xa061('0xf0'),'mobile','role',_0xa061('0x6b'),_0xa061('0xf1')]})['then'](function(_0x383f7b){if(_0x383f7b){if(_0x383f7b['role']===_0xa061('0x2d')){_0x278c95=_0x383f7b;if(_0x40983a[_0xa061('0x65')]['interface']){_0x522071=util[_0xa061('0xb0')](_0xa061('0xf2'),_0x278c95[_0x40983a[_0xa061('0x65')][_0xa061('0xb2')]]);}else if(_0x40983a['body']['intrf']){_0x522071=util[_0xa061('0xb0')](_0xa061('0xb1'),_0x40983a[_0xa061('0x65')][_0xa061('0xf3')]);}else{_0x522071=util['format'](_0xa061('0xb1'),_0x278c95[_0xa061('0x3c')]);}socket['to'](util[_0xa061('0xb0')](_0xa061('0xf4'),_0x278c95['name']))[_0xa061('0x2e')](_0xa061('0xf5'),{'user':{'id':_0x278c95['id'],'name':_0x278c95['name']},'ip':_0x40983a[_0xa061('0xf6')][_0xa061('0xf7')]||_0x40983a[_0xa061('0xf8')][_0xa061('0xf9')]||_0x40983a[_0xa061('0xfa')][_0xa061('0xf9')]||_0x40983a[_0xa061('0xf8')][_0xa061('0xfa')][_0xa061('0xf9')]});return db['UserVoiceQueueRt'][_0xa061('0x2f')]({'where':{'membername':_0x278c95['name']},'individualHooks':!![]});}}else{throw new db[(_0xa061('0x98'))][(_0xa061('0x9a'))](_0xa061('0xfb'));}})[_0xa061('0x21')](function(){if(_0x278c95){return _0x278c95[_0xa061('0xfc')]({'raw':!![]});}})[_0xa061('0x21')](function(_0x33c0c8){if(_0x278c95){if(_0x33c0c8){_0x34b15c=_0x33c0c8;if(_0x34b15c['length']){var _0x19644c=_0x34b15c['map'](function(_0x1cd965){var _0x2776a9={'membername':_0x278c95[_0xa061('0x3c')],'UserId':_0x278c95['id'],'queue_name':_0x1cd965[_0xa061('0x3c')],'VoiceQueueId':_0x1cd965['id'],'interface':_0x522071,'paused':_0x278c95[_0xa061('0xf1')]||![],'penalty':_0x1cd965['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0xa061('0xb4')](_0x2776a9);});return Promise[_0xa061('0x5c')](_0x19644c);}}}})[_0xa061('0x21')](function(){if(_0x278c95){return db['MemberReport'][_0xa061('0x51')]({'where':{'membername':_0x278c95[_0xa061('0x3c')],'exitAt':null}});}})['then'](function(_0x42242b){if(_0x278c95){var _0x4c211b=[];_0x42242b[_0xa061('0xfd')](function(_0x597282){_0x4c211b[_0xa061('0x50')](_0x597282['update']({'exitAt':moment()['format'](_0xa061('0xfe'))}));});return Promise[_0xa061('0x5c')](_0x4c211b);}})['then'](function(){if(_0x278c95){var _0x1ee176=[];var _0xb8eab0=[];var _0x4ae9b0=utils['getChannels']();var _0x476718={'membername':_0x278c95[_0xa061('0x3c')],'interface':_0x522071,'enterAt':moment()['format'](_0xa061('0xfe')),'role':_0x278c95[_0xa061('0x2c')],'internal':_0x278c95[_0xa061('0x6b')]};_0x4ae9b0[_0xa061('0xfd')](function(_0x25482c){_0x1ee176['push'](_[_0xa061('0x62')]({'channel':_0x25482c,'type':_0xa061('0xff'),'data1':_0x40983a[_0xa061('0x65')][_0xa061('0x100')],'data2':_0x522071},_0x476718));if(_0x278c95['loginInPause']){_0xb8eab0['push'](_['merge']({'channel':_0x25482c,'type':_0xa061('0x101'),'data1':_0xa061('0x102')},_0x476718));}});return db[_0xa061('0x103')]['bulkCreate'](_0x1ee176[_0xa061('0x104')](_0xb8eab0),{'individualHooks':!![]});}})[_0xa061('0x21')](function(){if(_0x278c95){return _0x278c95[_0xa061('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xa061('0xb0')](_0xa061('0xfe')),'voicePause':_0x278c95[_0xa061('0xf1')]||![],'mailPause':_0x278c95['loginInPause']||![],'chatPause':_0x278c95[_0xa061('0xf1')]||![],'faxPause':_0x278c95[_0xa061('0xf1')]||![],'smsPause':_0x278c95[_0xa061('0xf1')]||![],'openchannelPause':_0x278c95['loginInPause']||![],'whatsappPause':_0x278c95[_0xa061('0xf1')]||![],'pauseType':_0x278c95[_0xa061('0xf1')]?_0xa061('0x102'):null,'interface':_0x522071,'lastPauseAt':moment()[_0xa061('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x3b6313){if(_0x40983a[_0xa061('0x105')]){return _0x446d1e();}else{return Promise[_0xa061('0x106')](_0x3b6313)[_0xa061('0x21')](respondWithResult(_0x486189,null));}})[_0xa061('0x2a')](handleError(_0x486189,null));};exports[_0xa061('0x107')]=function(_0x20b6f6,_0x51d8fa){var _0x538b01;return db[_0xa061('0x40')][_0xa061('0x68')]({'where':{'id':_0x20b6f6[_0xa061('0x5e')]['id'],'role':_0xa061('0x2d')},'attributes':['id',_0xa061('0x3c'),_0xa061('0x2c')]})[_0xa061('0x21')](handleEntityNotFound(_0x51d8fa,null))[_0xa061('0x21')](function(_0x472faa){if(_0x472faa){_0x538b01=_0x472faa;return db[_0xa061('0xb3')][_0xa061('0x2f')]({'where':{'membername':_0x538b01['name']},'individualHooks':!![]});}})[_0xa061('0x21')](function(){return db[_0xa061('0x103')][_0xa061('0x51')]({'where':{'membername':_0x538b01[_0xa061('0x3c')],'exitAt':null}});})[_0xa061('0x21')](function(_0x280dd9){var _0x1d39eb=[];_0x280dd9[_0xa061('0xfd')](function(_0x2e5c8b){_0x1d39eb[_0xa061('0x50')](_0x2e5c8b['update']({'exitAt':moment()['format'](_0xa061('0xfe'))}));});return Promise['all'](_0x1d39eb);})[_0xa061('0x21')](function(){return _0x538b01[_0xa061('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa061('0x21')](respondWithResult(_0x51d8fa,null))[_0xa061('0x2a')](handleError(_0x51d8fa,null));};exports['pause']=function(_0x159bf7,_0x18d08c){var _0x413133;return db['UserVoiceQueueRt'][_0xa061('0x2b')]({'paused':0x1},{'where':{'UserId':_0x159bf7[_0xa061('0x5e')]['id']},'individualHooks':!![]})[_0xa061('0x21')](function(){return db['User']['find']({'where':{'id':_0x159bf7[_0xa061('0x5e')]['id'],'role':_0xa061('0x2d')},'attributes':['id',_0xa061('0x3c'),_0xa061('0x2c'),_0xa061('0x6b'),_0xa061('0xb2'),_0xa061('0xa4')]});})[_0xa061('0x21')](handleEntityNotFound(_0x18d08c,null))[_0xa061('0x21')](function(_0x355e02){if(_0x355e02){_0x413133=_0x355e02;return respondWithRpcPromise(_0xa061('0x108'),_0xa061('0x109'),{'id':_0x413133['id'],'name':_0x413133[_0xa061('0x3c')],'pause':!![]});}})[_0xa061('0x21')](function(){if(_0x413133){return db[_0xa061('0x103')]['findAll']({'where':{'membername':_0x413133[_0xa061('0x3c')],'type':'PAUSE','exitAt':null}});}})[_0xa061('0x21')](function(_0x4fa986){if(_0x4fa986[_0xa061('0x55')]){var _0x5d581b=moment()[_0xa061('0xb0')](_0xa061('0xfe'));for(var _0x27ba40=0x0,_0x608b77=_0x4fa986[_0xa061('0x55')];_0x27ba40<_0x608b77;_0x27ba40++){_0x4fa986[_0x27ba40][_0xa061('0x10a')]({'exitAt':_0x5d581b});}}})['then'](function(){var _0x4c44d5=[];var _0x1bf0f8=utils[_0xa061('0x10b')]();_0x1bf0f8[_0xa061('0xfd')](function(_0x42428d){_0x4c44d5[_0xa061('0x50')]({'channel':_0x42428d,'membername':_0x413133[_0xa061('0x3c')],'interface':_['isNil'](_0x413133[_0xa061('0xb2')])?util[_0xa061('0xb0')](_0xa061('0xb1'),_0x413133[_0xa061('0x3c')]):_0x413133['interface'],'type':_0xa061('0x101'),'enterAt':moment()[_0xa061('0xb0')](_0xa061('0xfe')),'data1':_0x159bf7[_0xa061('0x65')][_0xa061('0x43')]||_0xa061('0x10c'),'role':_0x413133[_0xa061('0x2c')],'internal':_0x413133[_0xa061('0x6b')]});});return db[_0xa061('0x103')][_0xa061('0x91')](_0x4c44d5,{'individualHooks':!![]});})[_0xa061('0x21')](function(){return _0x413133[_0xa061('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x159bf7[_0xa061('0x65')]['type']||_0xa061('0x10c'),'lastPauseAt':moment()[_0xa061('0xb0')](_0xa061('0xfe'))});})['then'](respondWithResult(_0x18d08c,null))['catch'](handleError(_0x18d08c,null));};exports[_0xa061('0x10d')]=function(_0x320629,_0x9e2d59){if(_0x320629[_0xa061('0x65')][_0xa061('0xa3')]&&!utils[_0xa061('0xa6')](_0x320629['body'][_0xa061('0xa3')])){throw new APIBadRequestError(util[_0xa061('0xb0')](_0xa061('0x10e'),_0x320629[_0xa061('0x65')]['channel']));}return db[_0xa061('0x40')][_0xa061('0x68')]({'where':{'id':_0x320629[_0xa061('0x5e')]['id']},'attributes':['id',_0xa061('0x3c'),_0xa061('0x2c'),_0xa061('0x6b'),_0xa061('0xb2'),_0xa061('0xa4'),'voicePause',_0xa061('0x10f'),_0xa061('0x110'),_0xa061('0x111'),_0xa061('0x112'),_0xa061('0x113'),'whatsappPause',_0xa061('0x114'),_0xa061('0x115')]})[_0xa061('0x21')](function(_0x43aa86){if(!_0x43aa86){throw new APINotFoundError(util[_0xa061('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x320629[_0xa061('0x5e')]['id']));}return _0x43aa86[_0xa061('0x10d')](_0x320629[_0xa061('0x65')][_0xa061('0xa3')]);})[_0xa061('0x21')](respondWithResult(_0x9e2d59,null))['catch'](APIHandleError(_0x9e2d59));};exports['getTeams']=function(_0x964f08,_0x3ec50b){var _0x4a0869={};var _0x27b738={};var _0x1bee14;var _0x56180b;return db[_0xa061('0x40')]['findOne']({'where':{'id':_0x964f08[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x3ec50b,null))[_0xa061('0x21')](function(_0xea5cc9){if(_0xea5cc9){_0x1bee14=_0xea5cc9;_0x27b738[_0xa061('0xd3')]=_['keys'](db[_0xa061('0x116')][_0xa061('0x41')]);_0x27b738['query']=_[_0xa061('0xd5')](_0x964f08[_0xa061('0x4c')]);_0x27b738['filters']=_[_0xa061('0xd7')](_0x27b738[_0xa061('0xd3')],_0x27b738['query']);_0x4a0869['attributes']=_[_0xa061('0xd7')](_0x27b738[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x964f08[_0xa061('0x4c')][_0xa061('0xd8')]));_0x4a0869[_0xa061('0x4f')]=_0x4a0869[_0xa061('0x4f')][_0xa061('0x55')]?_0x4a0869[_0xa061('0x4f')]:_0x27b738[_0xa061('0xd3')];_0x4a0869[_0xa061('0xdd')]=qs[_0xa061('0xd9')](_0x964f08[_0xa061('0x4c')][_0xa061('0xd9')]);_0x4a0869['where']=qs[_0xa061('0xd6')](_[_0xa061('0xde')](_0x964f08[_0xa061('0x4c')],_0x27b738[_0xa061('0xd6')]));if(_0x964f08[_0xa061('0x4c')]['filter']){_0x4a0869[_0xa061('0x4a')]=_[_0xa061('0x62')](_0x4a0869[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0x4a0869[_0xa061('0x4f')],function(_0x6851fa){var _0x23cb51={};_0x23cb51[_0x6851fa]={'$like':'%'+_0x964f08[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x23cb51;})});}_0x4a0869=_['merge']({},_0x4a0869,_0x964f08[_0xa061('0x63')]);return _0x1bee14['getTeams'](_0x4a0869);}})[_0xa061('0x21')](function(_0x5ea8d2){if(_0x5ea8d2){_0x56180b=_0x5ea8d2[_0xa061('0x55')];if(!_0x964f08[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0x4a0869[_0xa061('0xdb')]=qs['limit'](_0x964f08[_0xa061('0x4c')][_0xa061('0xdb')]);_0x4a0869['offset']=qs[_0xa061('0x1e')](_0x964f08[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x1bee14['getTeams'](_0x4a0869);}})['then'](function(_0x484cae){if(_0x484cae){return _0x484cae?{'count':_0x56180b,'rows':_0x484cae}:null;}})['then'](respondWithResult(_0x3ec50b,null))[_0xa061('0x2a')](handleError(_0x3ec50b,null));};exports[_0xa061('0x117')]=function(_0x1314ce,_0x3aeff0){var _0x12c39e=_0x1314ce['params']['id'];var _0x5432c4=_0x1314ce['body']?_0x1314ce['body']['ids']:null;var _0xe3a476=[];return Promise['resolve']()[_0xa061('0x21')](function(){if(!_0x5432c4)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xa061('0x21')](function(){return db[_0xa061('0x40')]['findOne']({'where':{'id':_0x12c39e}});})['then'](function(_0xb39f9e){if(!_0xb39f9e)throw new APINotFoundError(util[_0xa061('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1314ce[_0xa061('0x5e')]['id']));return db[_0xa061('0x72')][_0xa061('0x118')](function(_0x4df444){return _0xb39f9e['addTeams'](_0x5432c4,{'transaction':_0x4df444})[_0xa061('0x21')](function(){return db[_0xa061('0x116')][_0xa061('0x51')]({'where':{'id':{'$in':_0x5432c4}}});})[_0xa061('0x21')](function(_0xec504a){var _0x83fcfc=_['map'](_0xec504a,function(_0x5c8dbb){return _0x5c8dbb[_0xa061('0x119')]();});return Promise[_0xa061('0x5c')](_0x83fcfc);})[_0xa061('0x21')](function(_0x2236c8){_0xe3a476=_[_0xa061('0x11a')](_0x2236c8);var _0x2c023d=_[_0xa061('0x39')](_0xe3a476,function(_0x566365){return _0x566365[_0xa061('0x11b')](_0xb39f9e['id'],{'transaction':_0x4df444});});return Promise[_0xa061('0x5c')](_0x2c023d);})['then'](function(){if(!_0xb39f9e[_0xa061('0xa4')])return;var _0x2d36b1=_[_0xa061('0x37')](_0xe3a476,function(_0x55bd77){return _0x55bd77[_0xa061('0x11c')](_0xa061('0xa3'))==='Voice';});var _0xacb153=_['map'](_0x2d36b1,function(_0x342d52){return db['UserVoiceQueueRt'][_0xa061('0xb4')]({'membername':_0xb39f9e[_0xa061('0x3c')],'UserId':_0xb39f9e['id'],'queue_name':_0x342d52[_0xa061('0x3c')],'VoiceQueueId':_0x342d52['id'],'interface':_[_0xa061('0x70')](_0xb39f9e[_0xa061('0xb2')])?util['format']('SIP/%s',_0xb39f9e['name']):_0xb39f9e[_0xa061('0xb2')],'paused':_0xb39f9e[_0xa061('0xa5')]||![],'penalty':_0xb39f9e['penalty']},{'transaction':_0x4df444});});return Promise[_0xa061('0x5c')](_0xacb153);})[_0xa061('0x21')](function(){return db[_0xa061('0x11d')][_0xa061('0x51')]({'where':{'teamId':{'$in':_0x5432c4}}});})[_0xa061('0x21')](function(_0xbaa808){var _0x304c81=_[_0xa061('0x39')](_0xbaa808,function(_0x478ab2){return db[_0xa061('0x11e')][_0xa061('0x86')]({'UserId':_0xb39f9e['id'],'VoicePrefixId':_0x478ab2[_0xa061('0x11f')]},{'transaction':_0x4df444});});return Promise['all'](_0x304c81);});});})['then'](function(){for(var _0x1172e3=0x0;_0x1172e3<_0xe3a476[_0xa061('0x55')];_0x1172e3++){var _0x58d35b=_0xe3a476[_0x1172e3][_0xa061('0x11c')](_0xa061('0xa3'));var _0x1c9e9d=_0x58d35b+'QueueId';socket[_0xa061('0x2e')](_0xa061('0x33')+_0x58d35b+_0xa061('0xae'),{'UserId':_0x12c39e,['queueField']:_0xe3a476[_0x1172e3]['id']});}})[_0xa061('0x21')](respondWithStatusCode(_0x3aeff0,null))[_0xa061('0x2a')](APIHandleError(_0x3aeff0));};exports[_0xa061('0x120')]=function(_0x27a5bb,_0x22e913){var _0x502ab3=_0x27a5bb[_0xa061('0x5e')]['id'];var _0xbf8b78=null;if(_0x27a5bb[_0xa061('0x4c')]['ids']){_0xbf8b78=_[_0xa061('0xb7')](_0x27a5bb[_0xa061('0x4c')]['ids'])?_0x27a5bb['query'][_0xa061('0x69')]:[_0x27a5bb[_0xa061('0x4c')][_0xa061('0x69')]];}var _0x46e5c1=[];return Promise[_0xa061('0x106')]()[_0xa061('0x21')](function(){if(!_0xbf8b78)throw new APIBadRequestError(_0xa061('0x121'));})[_0xa061('0x21')](function(){return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x502ab3}});})[_0xa061('0x21')](function(_0x5bfefa){if(!_0x5bfefa)throw new APINotFoundError(util[_0xa061('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x27a5bb[_0xa061('0x5e')]['id']));return db['sequelize'][_0xa061('0x118')](function(_0x34b293){return _0x5bfefa[_0xa061('0x120')](_0xbf8b78,{'transaction':_0x34b293})[_0xa061('0x21')](function(){return db[_0xa061('0x116')][_0xa061('0x51')]({'where':{'id':{'$in':_0xbf8b78}}});})[_0xa061('0x21')](function(_0x5399e6){var _0x1ee032=_[_0xa061('0x39')](_0x5399e6,function(_0x43f189){return _0x43f189[_0xa061('0x119')]();});return Promise[_0xa061('0x5c')](_0x1ee032);})['then'](function(_0x23f351){_0x46e5c1=_[_0xa061('0x11a')](_0x23f351);var _0x53fd3b=_[_0xa061('0x39')](_0x46e5c1,function(_0x2a70bf){return _0x2a70bf['removeAgent'](_0x5bfefa['id'],{'transaction':_0x34b293});});return Promise['all'](_0x53fd3b);})[_0xa061('0x21')](function(){if(!_0x5bfefa[_0xa061('0xa4')])return;var _0x573838=_['filter'](_0x46e5c1,function(_0x4650b8){return _0x4650b8['getDataValue'](_0xa061('0xa3'))==='Voice';});var _0x38be46=_[_0xa061('0x39')](_0x573838,function(_0x5d8a9b){return db['UserVoiceQueueRt'][_0xa061('0x2f')]({'where':{'VoiceQueueId':_0x5d8a9b['id'],'UserId':_0x5bfefa['id']},'transaction':_0x34b293});});return Promise['all'](_0x38be46);})[_0xa061('0x21')](function(){return db['TeamVoicePrefix'][_0xa061('0x51')]({'where':{'teamId':{'$in':_0xbf8b78}}});})[_0xa061('0x21')](function(_0x189851){var _0x3784e2=_[_0xa061('0x39')](_0x189851,function(_0x37980f){return db[_0xa061('0x11e')]['destroy']({'where':{'UserId':_0x5bfefa['id'],'VoicePrefixId':_0x37980f['VoicePrefixId']}},{'transaction':_0x34b293});});return Promise[_0xa061('0x5c')](_0x3784e2);});});})[_0xa061('0x21')](function(){for(var _0x100e8d=0x0;_0x100e8d<_0x46e5c1[_0xa061('0x55')];_0x100e8d++){var _0x4e0891=_0x46e5c1[_0x100e8d]['getDataValue']('channel');var _0x33038=_0x4e0891+_0xa061('0xad');socket[_0xa061('0x2e')](_0xa061('0x33')+_0x4e0891+_0xa061('0xb8'),{'UserId':_0x502ab3,['queueField']:_0x46e5c1[_0x100e8d]['id']});}})[_0xa061('0x21')](respondWithStatusCode(_0x22e913,null))[_0xa061('0x2a')](APIHandleError(_0x22e913));};exports[_0xa061('0x122')]=function(_0x1c63b8,_0x27269a){var _0xa646ef={};var _0x3fa6e5={};var _0x17dbac;var _0x2fa0fa;return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x1c63b8[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x27269a,null))['then'](function(_0x27e9e6){if(_0x27e9e6){_0x17dbac=_0x27e9e6;_0x3fa6e5[_0xa061('0xd3')]=_['keys'](db[_0xa061('0x123')][_0xa061('0x41')]);_0x3fa6e5[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x1c63b8['query']);_0x3fa6e5[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x3fa6e5[_0xa061('0xd3')],_0x3fa6e5['query']);_0xa646ef[_0xa061('0x4f')]=_['intersection'](_0x3fa6e5[_0xa061('0xd3')],qs[_0xa061('0xd8')](_0x1c63b8[_0xa061('0x4c')][_0xa061('0xd8')]));_0xa646ef[_0xa061('0x4f')]=_0xa646ef[_0xa061('0x4f')]['length']?_0xa646ef[_0xa061('0x4f')]:_0x3fa6e5[_0xa061('0xd3')];_0xa646ef[_0xa061('0xdd')]=qs['sort'](_0x1c63b8[_0xa061('0x4c')]['sort']);_0xa646ef[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_['pick'](_0x1c63b8['query'],_0x3fa6e5[_0xa061('0xd6')]));if(_0x1c63b8['query'][_0xa061('0x37')]){_0xa646ef['where']=_[_0xa061('0x62')](_0xa646ef[_0xa061('0x4a')],{'$or':_[_0xa061('0x39')](_0xa646ef[_0xa061('0x4f')],function(_0x3ea6e2){var _0x53c674={};_0x53c674[_0x3ea6e2]={'$like':'%'+_0x1c63b8[_0xa061('0x4c')][_0xa061('0x37')]+'%'};return _0x53c674;})});}_0xa646ef=_[_0xa061('0x62')]({},_0xa646ef,_0x1c63b8[_0xa061('0x63')]);return _0x17dbac[_0xa061('0x122')](_0xa646ef);}})['then'](function(_0x245e5d){if(_0x245e5d){_0x2fa0fa=_0x245e5d['length'];if(!_0x1c63b8[_0xa061('0x4c')][_0xa061('0xcd')](_0xa061('0xda'))){_0xa646ef[_0xa061('0xdb')]=qs[_0xa061('0xdb')](_0x1c63b8[_0xa061('0x4c')]['limit']);_0xa646ef[_0xa061('0x1e')]=qs['offset'](_0x1c63b8[_0xa061('0x4c')][_0xa061('0x1e')]);}return _0x17dbac[_0xa061('0x122')](_0xa646ef);}})[_0xa061('0x21')](function(_0x1a7c77){if(_0x1a7c77){return _0x1a7c77?{'count':_0x2fa0fa,'rows':_0x1a7c77}:null;}})[_0xa061('0x21')](respondWithResult(_0x27269a,null))[_0xa061('0x2a')](handleError(_0x27269a,null));};exports[_0xa061('0x124')]=function(_0x5e17c7,_0x3c6fab){var _0x22e897={};var _0x160e97={};var _0x2b86aa;return db[_0xa061('0x40')][_0xa061('0x9e')]({'where':{'id':_0x5e17c7[_0xa061('0x5e')]['id']}})[_0xa061('0x21')](handleEntityNotFound(_0x3c6fab,null))[_0xa061('0x21')](function(_0x3bd43a){if(_0x3bd43a){_0x2b86aa=_0x3bd43a;_0x160e97[_0xa061('0xd3')]=_['keys'](db[_0xa061('0x40')][_0xa061('0x41')]);_0x160e97[_0xa061('0x4c')]=_[_0xa061('0xd5')](_0x5e17c7[_0xa061('0x4c')]);_0x160e97[_0xa061('0xd6')]=_[_0xa061('0xd7')](_0x160e97[_0xa061('0xd3')],_0x160e97['query']);_0x22e897['attributes']=_['intersection'](_0x160e97[_0xa061('0xd3')],qs['fields'](_0x5e17c7[_0xa061('0x4c')][_0xa061('0xd8')]));_0x22e897[_0xa061('0x4f')]=_0x22e897[_0xa061('0x4f')][_0xa061('0x55')]?_0x22e897[_0xa061('0x4f')]:_0x160e97[_0xa061('0xd3')];_0x22e897['order']=qs[_0xa061('0xd9')](_0x5e17c7[_0xa061('0x4c')][_0xa061('0xd9')]);_0x22e897[_0xa061('0x4a')]=qs[_0xa061('0xd6')](_['pick'](_0x5e17c7['query'],_0x160e97['filters']));if(_0x5e17c7[_0xa061('0x4c')][_0xa061('0x37')]){_0x22e897[_0xa061('0x4a')]=_['merge'](_0x22e897['where'],{'$or':_[_0xa061('0x39')](_0x22e897[_0xa061('0x4f')],function(_0x41031d){var _0x9f57d1={};_0x9f57d1[_0x41031d]={'$like':'%'+_0x5e17c7['query']['filter']+'%'};return _0x9f57d1;})});}_0x22e897[_0xa061('0xd3')]=db[_0xa061('0x40')];_0x22e897['as']='Agents';_0x22e897=_['merge']({},_0x22e897,_0x5e17c7[_0xa061('0x63')]);return _0x2b86aa['getVoiceQueues']({'include':[_0x22e897]});}})[_0xa061('0x21')](function(_0x390cd3){if(_0x390cd3){var _0x1b7ae6={},_0x16759a=[];for(var _0x1271e9=0x0;_0x1271e9<_0x390cd3[_0xa061('0x55')];_0x1271e9+=0x1){for(var _0xd8636=0x0,_0x1ab885;_0xd8636<_0x390cd3[_0x1271e9][_0xa061('0x34')][_0xa061('0x55')];_0xd8636+=0x1){_0x1ab885=_0x390cd3[_0x1271e9][_0xa061('0x34')][_0xd8636]['get']({'plain':!![]});_0x1b7ae6[_0x1ab885['id']]=_0x1ab885;}}_0x1b7ae6=_['values'](_0x1b7ae6);for(var _0x2b8c1f=qs[_0xa061('0x1e')](_0x5e17c7[_0xa061('0x4c')][_0xa061('0x1e')]);_0x2b8c1f<_0x1b7ae6['length']&&_0x16759a[_0xa061('0x55')]=_0x1d25e5){_0x23232f=_0x1d25e5;_0xaf40d9=0xc8;}else{_0xaf40d9=0xce;}_0x18e51c[_0x22f8('0x17')](_0xaf40d9);return _0x18e51c[_0x22f8('0x1e')]('Content-Range',_0x38d051+'-'+_0x23232f+'/'+_0x1d25e5)['json'](_0x332efc);}return null;};}function respondWithRpcPromise(_0x557636,_0x4be32f,_0x27cd76,_0x161994){return new Promise(function(_0x3c1a92,_0x5af21a){var _0x5a8f97=_0x161994||amiClient;return _0x5a8f97[_0x22f8('0x1f')](_0x557636,_0x27cd76)[_0x22f8('0x20')](function(_0x33a425){logger[_0x22f8('0x21')](_0x22f8('0x22'),_0x4be32f,_0x22f8('0x23'));logger['debug'](_0x22f8('0x24'),_0x4be32f,_0x22f8('0x23'),JSON[_0x22f8('0x25')](_0x33a425));if(_0x33a425[_0x22f8('0x26')]){if(_0x33a425[_0x22f8('0x26')][_0x22f8('0x27')]===0x1f4){logger['error'](_0x22f8('0x22'),_0x4be32f,_0x33a425[_0x22f8('0x26')]['message']);return _0x5af21a(_0x33a425[_0x22f8('0x26')]['message']);}logger['error'](_0x22f8('0x22'),_0x4be32f,_0x33a425[_0x22f8('0x26')][_0x22f8('0x28')]);return _0x3c1a92(_0x33a425[_0x22f8('0x26')]['message']);}else{logger[_0x22f8('0x21')]('User,\x20%s,\x20%s',_0x4be32f,'request\x20sent');_0x3c1a92(_0x33a425[_0x22f8('0x29')]['message']);}})['catch'](function(_0xea8842){logger[_0x22f8('0x26')](_0x22f8('0x22'),_0x4be32f,_0xea8842);_0x5af21a(_0xea8842);});});}function saveUpdates(_0x57cba3){return function(_0x1ff6ec){if(_0x1ff6ec){return _0x1ff6ec[_0x22f8('0x2a')](_0x57cba3)[_0x22f8('0x20')](function(_0x4bc16d){if(_0x4bc16d[_0x22f8('0x2b')]===_0x22f8('0x2c')){socket[_0x22f8('0x2d')]('userNotification:recalc:'+_0x4bc16d['id'],_0x4bc16d);}return _0x4bc16d;});}return null;};}function removeEntity(_0x7ecb50,_0x53ebd0){return function(_0xdcbcf0){if(_0xdcbcf0){return _0xdcbcf0[_0x22f8('0x2e')]({'transaction':_0x53ebd0})[_0x22f8('0x20')](function(){var _0x48f090=_0xdcbcf0[_0x22f8('0x2f')]({'plain':!![]});if(_0x48f090['role']===_0x22f8('0x30'))return;var _0x417606=[{'name':'Users','value':_0x22f8('0x31'),'ignore':!![]},{'name':'Agents','value':_0x22f8('0x2c'),'ignore':![]},{'name':_0x22f8('0x32'),'value':_0x22f8('0x33'),'ignore':![]}];var _0x3ed140=_(_0x417606)[_0x22f8('0x34')]('ignore')['map']('value')[_0x22f8('0x35')]();if(_[_0x22f8('0x36')](_0x3ed140,_0x48f090[_0x22f8('0x2b')])){return;}var _0x4a908b=_[_0x22f8('0x37')](_0x417606,['value',_0x48f090[_0x22f8('0x2b')]])[_0x22f8('0x38')];return db[_0x22f8('0x39')][_0x22f8('0x2e')]({'where':{'type':_0x4a908b,'resourceId':_0x48f090['id']},'transaction':_0x53ebd0})['then'](function(){return _0xdcbcf0;});})[_0x22f8('0x20')](function(){_0x7ecb50[_0x22f8('0x17')](0xcc)[_0x22f8('0x18')]();});}};}function handleEntityNotFound(_0x3b9ce7){return function(_0x104ae2){if(!_0x104ae2){_0x3b9ce7[_0x22f8('0x3a')](0x194);}return _0x104ae2;};}function handleError(_0x2d1818,_0x4367a1){_0x4367a1=_0x4367a1||0x1f4;return function(_0x505656){logger[_0x22f8('0x26')](_0x505656[_0x22f8('0x3b')]);if(_0x505656[_0x22f8('0x38')]){delete _0x505656[_0x22f8('0x38')];}_0x2d1818[_0x22f8('0x17')](_0x4367a1)[_0x22f8('0x3c')](_0x505656);};}function getUserAttributes(){return _(db['User'][_0x22f8('0x3d')])[_0x22f8('0x3e')](function(_0x4584ed){return{'name':_0x4584ed['fieldName'],'type':_0x4584ed[_0x22f8('0x3f')][_0x22f8('0x40')]};})[_0x22f8('0x34')](function(_0x2e0d40){return![_0x22f8('0x41'),_0x22f8('0x42'),'previousPasswords',_0x22f8('0x43'),'resetPasswordExpires',_0x22f8('0x44')][_0x22f8('0x36')](_0x2e0d40[_0x22f8('0x38')]);})[_0x22f8('0x35')]();}exports['index']=function(_0x539c35,_0x65cb90){var _0x2d11c0={},_0x1f4111={'count':0x0,'rows':[]};var _0x168436=getUserAttributes();_0x2d11c0=qs['getOptions'](_0x168436,_0x539c35);var _0x3bf118={'where':_0x2d11c0[_0x22f8('0x45')]};return db['User'][_0x22f8('0x1c')](_0x3bf118)[_0x22f8('0x20')](function(_0x2f569c){_0x1f4111[_0x22f8('0x1c')]=_0x2f569c;if(_0x539c35[_0x22f8('0x46')][_0x22f8('0x47')]){_0x2d11c0['include']=[{'all':!![]}];}if(_0x539c35[_0x22f8('0x46')][_0x22f8('0x48')]===_0x22f8('0x49')){_0x2d11c0['include']=[{'model':db[_0x22f8('0x4a')],'as':_0x22f8('0x48')}];}if(!_[_0x22f8('0x36')](_0x2d11c0[_0x22f8('0x4b')],'id')){_0x2d11c0['attributes'][_0x22f8('0x4c')]('id');}return db['User'][_0x22f8('0x4d')](_0x2d11c0);})[_0x22f8('0x20')](function(_0x4163b9){_0x1f4111[_0x22f8('0x4e')]=_0x4163b9;if(_0x539c35[_0x22f8('0x46')]['openTabs']===_0x22f8('0x49')){var _0x3b57fb=[];for(var _0x46744b=0x0;_0x46744b<_0x1f4111[_0x22f8('0x4e')][_0x22f8('0x4f')];_0x46744b++){_0x3b57fb[_0x22f8('0x4c')](get_open_tabs('chat',_0x1f4111[_0x22f8('0x4e')][_0x46744b]['dataValues']));_0x3b57fb[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x50'),_0x1f4111[_0x22f8('0x4e')][_0x46744b][_0x22f8('0x51')]));_0x3b57fb[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x52'),_0x1f4111['rows'][_0x46744b][_0x22f8('0x51')]));_0x3b57fb['push'](get_open_tabs(_0x22f8('0x53'),_0x1f4111[_0x22f8('0x4e')][_0x46744b]['dataValues']));_0x3b57fb[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x54'),_0x1f4111[_0x22f8('0x4e')][_0x46744b][_0x22f8('0x51')]));_0x3b57fb[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x55'),_0x1f4111[_0x22f8('0x4e')][_0x46744b][_0x22f8('0x51')]));}return Promise[_0x22f8('0x56')](_0x3b57fb)[_0x22f8('0x20')](function(){return _0x1f4111;});}else{return _0x1f4111;}})[_0x22f8('0x20')](respondWithFilteredResult(_0x65cb90,_0x2d11c0))[_0x22f8('0x57')](handleError(_0x65cb90,null));};exports[_0x22f8('0x58')]=function(_0x24b628,_0x454264){var _0x2c14ed=getUserAttributes();_0x24b628[_0x22f8('0x46')]['id']=_0x24b628[_0x22f8('0x59')]['id'];var _0xc657c4=qs[_0x22f8('0x5a')](_0x2c14ed,_0x24b628);if(_0x24b628[_0x22f8('0x46')][_0x22f8('0x47')]){_0xc657c4[_0x22f8('0x5b')]=[{'all':!![]}];}if(_0x24b628[_0x22f8('0x46')][_0x22f8('0x48')]===_0x22f8('0x49')){_0xc657c4[_0x22f8('0x5b')]=[{'model':db[_0x22f8('0x4a')],'as':_0x22f8('0x48')}];}_0xc657c4=_[_0x22f8('0x5c')]({},_0xc657c4,_0x24b628[_0x22f8('0x5d')]);if(!_['includes'](_0xc657c4[_0x22f8('0x4b')],'id')){_0xc657c4[_0x22f8('0x4b')][_0x22f8('0x4c')]('id');}return db[_0x22f8('0x5e')][_0x22f8('0x37')](_0xc657c4)[_0x22f8('0x20')](handleEntityNotFound(_0x454264,null))[_0x22f8('0x20')](function(_0x64d6d4){var _0x3160b1=[];values=_0x64d6d4;if(_0x24b628[_0x22f8('0x46')][_0x22f8('0x5f')]===_0x22f8('0x49')){_0x3160b1[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x60'),_0x64d6d4['dataValues']));_0x3160b1[_0x22f8('0x4c')](get_open_tabs('sms',_0x64d6d4[_0x22f8('0x51')]));_0x3160b1[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x54'),_0x64d6d4[_0x22f8('0x51')]));_0x3160b1['push'](get_open_tabs(_0x22f8('0x55'),_0x64d6d4[_0x22f8('0x51')]));_0x3160b1[_0x22f8('0x4c')](get_open_tabs('fax',_0x64d6d4[_0x22f8('0x51')]));_0x3160b1[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x53'),_0x64d6d4[_0x22f8('0x51')]));return Promise['all'](_0x3160b1);}else{return values;}})[_0x22f8('0x20')](function(){return values;})[_0x22f8('0x20')](respondWithResult(_0x454264,null))[_0x22f8('0x57')](handleError(_0x454264,null));};exports[_0x22f8('0x2a')]=function(_0x838e35,_0x27f8d8){if(_0x838e35[_0x22f8('0x61')]['id']){delete _0x838e35[_0x22f8('0x61')]['id'];}delete _0x838e35[_0x22f8('0x61')]['role'];return db['User'][_0x22f8('0x37')]({'where':{'id':_0x838e35[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x27f8d8,null))[_0x22f8('0x20')](saveUpdates(_0x838e35[_0x22f8('0x61')],null))[_0x22f8('0x20')](respondWithResult(_0x27f8d8,null))['catch'](handleError(_0x27f8d8,null));};exports['describe']=function(_0x4546a1,_0x1e12b2){return db[_0x22f8('0x5e')][_0x22f8('0x62')]()['then'](respondWithResult(_0x1e12b2,null))['catch'](handleError(_0x1e12b2,null));};exports[_0x22f8('0x63')]=function(_0x587240,_0x25e6b6){return db['User'][_0x22f8('0x37')]({'where':{'id':_0x587240['params']['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x25e6b6,null))[_0x22f8('0x20')](function(_0x532e20){if(_0x532e20){return _0x532e20[_0x22f8('0x63')](_0x587240[_0x22f8('0x61')][_0x22f8('0x64')],_[_0x22f8('0x65')](_0x587240[_0x22f8('0x61')],[_0x22f8('0x64'),'id'])||{});}})[_0x22f8('0x20')](respondWithResult(_0x25e6b6,null))['catch'](handleError(_0x25e6b6,null));};function validateUser(_0x18e59e){return new Promise(function(_0x167d36,_0x1fa419){if(_0x18e59e[_0x22f8('0x66')])return _0x167d36(_0x18e59e);return db[_0x22f8('0x67')][_0x22f8('0x68')](0x1)[_0x22f8('0x20')](function(_0xb2ec2d){if(_0xb2ec2d[_0x22f8('0x69')])authService['validatePasswordPattern'](_0x18e59e[_0x22f8('0x41')]);db['User'][_0x22f8('0x6a')](_0x22f8('0x66'))[_0x22f8('0x20')](function(_0x344f35){if(_[_0x22f8('0x6b')](_0x344f35)){_0x18e59e[_0x22f8('0x66')]=_0xb2ec2d[_0x22f8('0x6c')]||0x1;return;}if(_[_0x22f8('0x6b')](_0xb2ec2d[_0x22f8('0x6c')])||_0xb2ec2d[_0x22f8('0x6c')]===_0x344f35){_0x18e59e[_0x22f8('0x66')]=_0x344f35+0x1;return;}if(_0xb2ec2d['min_internal']>_0x344f35){_0x18e59e[_0x22f8('0x66')]=_0xb2ec2d[_0x22f8('0x6c')];return;}return db[_0x22f8('0x6d')][_0x22f8('0x46')](_0x22f8('0x6e'),{'type':db['sequelize'][_0x22f8('0x6f')][_0x22f8('0x70')]})[_0x22f8('0x20')](function(_0x2c00fc){if(_0x2c00fc&&_0x2c00fc[_0x22f8('0x4f')]){for(var _0x3edf72=0x0,_0x236f0e=_0x2c00fc[_0x22f8('0x4f')];_0x3edf72<_0x236f0e&&_[_0x22f8('0x6b')](_0x18e59e[_0x22f8('0x66')]);_0x3edf72++){if(_0xb2ec2d[_0x22f8('0x6c')]<=_0x2c00fc[_0x3edf72][_0x22f8('0x71')]){_0x18e59e[_0x22f8('0x66')]=_0x2c00fc[_0x3edf72][_0x22f8('0x71')];}else if(_0xb2ec2d[_0x22f8('0x6c')]>_0x2c00fc[_0x3edf72]['from']&&_0xb2ec2d[_0x22f8('0x6c')]<=_0x2c00fc[_0x3edf72]['to']){_0x18e59e[_0x22f8('0x66')]=_0xb2ec2d[_0x22f8('0x6c')];}}}if(_[_0x22f8('0x6b')](_0x18e59e['internal'])){_0x18e59e[_0x22f8('0x66')]=_0x344f35+0x1;}return _0x167d36(_0x18e59e);});});})['catch'](function(_0x2bea50){_0x1fa419(_0x2bea50);});});}function updateUser(_0x42d24){return new Promise(function(_0x141785,_0xa0247c){try{if(_0x42d24[_0x22f8('0x72')]){_0x42d24[_0x22f8('0x73')]=_0x42d24[_0x22f8('0x66')];_0x42d24[_0x22f8('0x74')]={'mailbox':_0x42d24[_0x22f8('0x66')],'password':_0x42d24[_0x22f8('0x41')],'fullname':_0x42d24['fullname'],'email':_0x42d24[_0x22f8('0x75')]};}if(_0x42d24['role']===_0x22f8('0x2c')){if(!_0x42d24[_0x22f8('0x76')])_0x42d24['permissions']=[_0x22f8('0x77'),'102','103',_0x22f8('0x78'),'110',_0x22f8('0x79'),_0x22f8('0x7a'),_0x22f8('0x7b'),_0x22f8('0x7c'),'108',_0x22f8('0x7d'),_0x22f8('0x7e'),_0x22f8('0x7f'),_0x22f8('0x80'),_0x22f8('0x81')];}_0x141785(_0x42d24);}catch(_0x387354){_0xa0247c(_0x387354);}});}exports[_0x22f8('0x82')]=function(_0x2d5f12,_0x586012){if(_0x2d5f12[_0x22f8('0x31')][_0x22f8('0x2b')]===_0x22f8('0x2c'))throw new Error(_0x22f8('0x83'));if(_0x2d5f12[_0x22f8('0x61')][_0x22f8('0x2b')]===_0x22f8('0x31')&&_0x2d5f12['user'][_0x22f8('0x2b')]!==_0x22f8('0x30')){throw new Error(_0x22f8('0x84'));}if(_0x2d5f12['body'][_0x22f8('0x2b')]===_0x22f8('0x30')&&_0x2d5f12[_0x22f8('0x31')]['role']!==_0x22f8('0x30')){throw new Error(_0x22f8('0x85'));}return licenseUtil[_0x22f8('0x86')]([_0x2d5f12[_0x22f8('0x61')]])[_0x22f8('0x20')](function(){return validateUser(_0x2d5f12[_0x22f8('0x61')]);})[_0x22f8('0x20')](function(_0xf23bad){return updateUser(_0xf23bad)['then'](function(_0x551203){if(_0x551203['role']===_0x22f8('0x30')){_0x551203[_0x22f8('0x87')]=_0x2d5f12[_0x22f8('0x31')]['settingsEnabled'];delete _0x551203[_0x22f8('0x88')];}return _0x551203;});})[_0x22f8('0x20')](function(_0x41269e){return db[_0x22f8('0x5e')][_0x22f8('0x82')](_0x41269e,{'include':[{'model':db[_0x22f8('0x74')],'as':'VoiceMail'}]});})['then'](function(_0x136d02){if(_0x2d5f12[_0x22f8('0x61')][_0x22f8('0x2b')]===_0x22f8('0x31'))return _0x136d02;if(_0x2d5f12[_0x22f8('0x31')][_0x22f8('0x2b')]!=='user')return _0x136d02;return db[_0x22f8('0x89')][_0x22f8('0x37')]({'where':{'name':_0x136d02[_0x22f8('0x2b')]===_0x22f8('0x2c')?_0x22f8('0x8a'):'Telephones','userProfileId':_0x2d5f12[_0x22f8('0x31')][_0x22f8('0x88')]},'raw':!![]})[_0x22f8('0x20')](function(_0x1b76b1){if(!_0x1b76b1||_0x1b76b1[_0x22f8('0x8b')]!=0x0)return _0x136d02;return db[_0x22f8('0x39')][_0x22f8('0x82')]({'name':_0x136d02[_0x22f8('0x38')],'resourceId':_0x136d02['id'],'type':_0x1b76b1['name'],'sectionId':_0x1b76b1['id']},{})[_0x22f8('0x20')](function(){return _0x136d02;});})['catch'](function(_0x36783a){logger['error'](_0x22f8('0x8c'),_0x36783a);throw _0x36783a;});})['then'](respondWithResult(_0x586012,0xc9))['catch'](handleError(_0x586012,null));};exports[_0x22f8('0x8d')]=function(_0x33087a,_0x28333c){var _0x1ee0bd=_0x33087a[_0x22f8('0x61')];var _0x22ea6c=[];if(_0x33087a[_0x22f8('0x31')][_0x22f8('0x2b')]===_0x22f8('0x2c'))throw new Error(_0x22f8('0x83'));if(_[_0x22f8('0x8e')](_0x1ee0bd,[_0x22f8('0x2b'),_0x22f8('0x31')])&&_0x33087a[_0x22f8('0x31')][_0x22f8('0x2b')]!==_0x22f8('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x1ee0bd,[_0x22f8('0x2b'),'admin'])&&_0x33087a['user'][_0x22f8('0x2b')]!==_0x22f8('0x30')){throw new Error(_0x22f8('0x8f'));}return licenseUtil[_0x22f8('0x86')](_0x1ee0bd)[_0x22f8('0x20')](function(){return validateUser(_0x1ee0bd[0x0]);})['then'](function(){for(var _0x5c57ea=0x1;_0x5c57ea<_0x1ee0bd['length'];_0x5c57ea++){var _0x529cd0=_0x1ee0bd[_0x5c57ea-0x1][_0x22f8('0x66')];if(!_0x1ee0bd[_0x5c57ea][_0x22f8('0x66')])_0x1ee0bd[_0x5c57ea]['internal']=_0x529cd0+0x1;_0x22ea6c['push'](validateUser(_0x1ee0bd[_0x5c57ea]));}return Promise['all'](_0x22ea6c);})[_0x22f8('0x20')](function(){_0x22ea6c=[];for(var _0x55b1d8=0x0;_0x55b1d8<_0x1ee0bd[_0x22f8('0x4f')];_0x55b1d8++){_0x22ea6c[_0x22f8('0x4c')](updateUser(_0x1ee0bd[_0x55b1d8]));}return Promise[_0x22f8('0x56')](_0x22ea6c);})[_0x22f8('0x20')](function(){_0x22ea6c=_0x1ee0bd[_0x22f8('0x3e')](function(_0x687e91){return db[_0x22f8('0x5e')][_0x22f8('0x82')](_0x687e91,{'include':[{'model':db[_0x22f8('0x74')],'as':'VoiceMail'}]})['then'](function(_0x5f5703){_0x687e91['id']=_0x5f5703['id'];return _0x687e91;});});return Promise[_0x22f8('0x56')](_0x22ea6c);})[_0x22f8('0x20')](function(_0x367011){if(_0x33087a[_0x22f8('0x61')][_0x22f8('0x2b')]===_0x22f8('0x31'))return _0x367011;if(_0x33087a[_0x22f8('0x31')][_0x22f8('0x2b')]!==_0x22f8('0x31'))return _0x367011;var _0x17182b=_[_0x22f8('0x8e')](_0x367011,function(_0x331bc5){return _0x331bc5[_0x22f8('0x2b')]===_0x22f8('0x2c')||_0x331bc5['role']===_0x22f8('0x33');});if(!_0x17182b)return _0x367011;return db[_0x22f8('0x89')][_0x22f8('0x4d')]({'where':{'name':{'$or':[_0x22f8('0x8a'),'Telephones']},'userProfileId':_0x33087a[_0x22f8('0x31')][_0x22f8('0x88')]},'raw':!![]})[_0x22f8('0x20')](function(_0x23ea23){if(_['isEmpty'](_0x23ea23)||!_[_0x22f8('0x8e')](_0x23ea23,[_0x22f8('0x8b'),0x0]))return _0x367011;_0x22ea6c=[];var _0x55bdfb=_(_0x23ea23)[_0x22f8('0x3e')](function(_0x29c82e){if(_0x29c82e['autoAssociation']===0x1)return;return _0x29c82e['name']===_0x22f8('0x8a')?_0x22f8('0x2c'):_0x22f8('0x33');})[_0x22f8('0x90')]()[_0x22f8('0x35')]();for(var _0x350ffe=0x0;_0x350ffe<_0x367011[_0x22f8('0x4f')];_0x350ffe++){if(!_[_0x22f8('0x36')](_0x55bdfb,_0x367011[_0x350ffe][_0x22f8('0x2b')]))return;var _0xcba57a=_0x367011[_0x350ffe]['role']===_0x22f8('0x2c')?_0x22f8('0x8a'):'Telephones';_0x22ea6c[_0x22f8('0x4c')](db[_0x22f8('0x39')]['create']({'name':_0x367011[_0x350ffe][_0x22f8('0x38')],'resourceId':_0x367011[_0x350ffe]['id'],'type':_0xcba57a,'sectionId':_[_0x22f8('0x37')](_0x23ea23,['name',_0xcba57a])['id']},{}));}return Promise[_0x22f8('0x56')](_0x22ea6c);});})[_0x22f8('0x20')](respondWithResult(_0x28333c,0xc9))[_0x22f8('0x57')](handleError(_0x28333c,null));};exports[_0x22f8('0x91')]=function(_0x5dbd48,_0x2d5909){if(_0x5dbd48[_0x22f8('0x61')]['id']){delete _0x5dbd48['body']['id'];}return db[_0x22f8('0x5e')][_0x22f8('0x37')]({'where':{'id':_0x5dbd48[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](function(_0x15b0e0){if(!_0x15b0e0)return null;if(_0x15b0e0['id']===_0x5dbd48[_0x22f8('0x31')]['id']){if(!_0x5dbd48[_0x22f8('0x61')][_0x22f8('0x92')]||!_0x5dbd48['body'][_0x22f8('0x93')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x15b0e0[_0x22f8('0x94')](_0x5dbd48[_0x22f8('0x61')]['oldPassword'])){throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))](_0x22f8('0x97'));}if(_0x5dbd48[_0x22f8('0x61')][_0x22f8('0x92')]===_0x5dbd48['body'][_0x22f8('0x93')]){throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))](_0x22f8('0x98'));}}else if(_0x5dbd48[_0x22f8('0x31')][_0x22f8('0x2b')]===_0x22f8('0x30')){if(!_0x5dbd48['body'][_0x22f8('0x93')]){throw new db['Sequelize'][(_0x22f8('0x96'))](_0x22f8('0x99'));}}else if(_0x5dbd48[_0x22f8('0x31')][_0x22f8('0x2b')]===_0x22f8('0x31')){if(!_0x5dbd48[_0x22f8('0x61')][_0x22f8('0x93')]){throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x15b0e0[_0x22f8('0x2b')]!==_0x22f8('0x2c')){throw new db[(_0x22f8('0x95'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))](_0x22f8('0x83'));}return _0x15b0e0;})[_0x22f8('0x20')](handleEntityNotFound(_0x2d5909,null))[_0x22f8('0x20')](function(_0x18f908){return db['Setting'][_0x22f8('0x9a')]({'attributes':['id',_0x22f8('0x69'),_0x22f8('0x9b'),'passwordHistoryLimit']})[_0x22f8('0x20')](function(_0x12ec5c){if(_0x12ec5c[_0x22f8('0x69')])authService[_0x22f8('0x9c')](_0x5dbd48[_0x22f8('0x61')][_0x22f8('0x93')]);if(!_0x12ec5c[_0x22f8('0x9b')]||!_0x18f908[_0x22f8('0x9d')])return _0x18f908;authService['validatePasswordHistory'](_0x5dbd48[_0x22f8('0x61')][_0x22f8('0x93')],_0x18f908[_0x22f8('0x9d')],_0x12ec5c['passwordHistoryLimit']);return _0x18f908;})[_0x22f8('0x20')](saveUpdates({'password':_0x5dbd48['body'][_0x22f8('0x93')],'passwordResetAt':_0x5dbd48['user']['id']==_0x5dbd48[_0x22f8('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x5dbd48[_0x22f8('0x61')][_0x22f8('0x93')],_0x18f908[_0x22f8('0x9d')])},null));})['then'](respondWithResult(_0x2d5909,null))['catch'](handleError(_0x2d5909,null));};exports['addQueues']=function(_0x3c41be,_0x2d3496){var _0x447515=_0x3c41be['body'][_0x22f8('0x9e')];return db[_0x22f8('0x5e')][_0x22f8('0x37')]({'where':{'id':_0x3c41be['params']['id']},'attributes':['id','name',_0x22f8('0x2b'),_0x22f8('0x9f'),_0x22f8('0xa0'),_0x22f8('0xa1'),_0x22f8('0xa2')]})[_0x22f8('0x20')](handleEntityNotFound(_0x2d3496,null))[_0x22f8('0x20')](function(_0x1840a6){if(_0x1840a6){if(!utils[_0x22f8('0xa3')](_0x447515)){throw new db[(_0x22f8('0x95'))]['ValidationError']('Unknown\x20channel');}return _0x1840a6['add'+_['capitalize'](_0x447515['toLowerCase']())+'Queues'](_0x3c41be[_0x22f8('0x61')][_0x22f8('0x64')],{'penalty':_0x3c41be[_0x22f8('0x61')][_0x22f8('0xa4')]||0x0})['spread'](function(_0x5bf48e){for(var _0x456a1c=0x0;_0x456a1c<_0x3c41be[_0x22f8('0x61')][_0x22f8('0x64')]['length'];_0x456a1c+=0x1){var _0x3ac1ef={'UserId':Number(_0x3c41be[_0x22f8('0x59')]['id'])};_0x3ac1ef[_[_0x22f8('0xa5')](_0x447515['toLowerCase']())+_0x22f8('0xa6')]=Number(_0x3c41be['body']['ids'][_0x456a1c]);socket[_0x22f8('0x2d')]('user'+_[_0x22f8('0xa5')](_0x447515[_0x22f8('0xa7')]())+_0x22f8('0xa8'),_0x3ac1ef);}return _0x5bf48e;})[_0x22f8('0x20')](function(){if(_0x447515===_0x22f8('0xa9')){return db[_0x22f8('0xaa')][_0x22f8('0x4d')]({'where':{'id':_0x3c41be[_0x22f8('0x61')][_0x22f8('0x64')]||[]},'raw':!![],'attributes':['id',_0x22f8('0x38')]});}})['then'](function(_0x28dedc){var _0x430688=_0x1840a6['get']({'plain':!![]});var _0x22bf81=[];if(_0x447515===_0x22f8('0xa9')&&_0x430688[_0x22f8('0x2b')]===_0x22f8('0x2c')&&_0x430688[_0x22f8('0x9f')]){for(let _0x458c3e=0x0;_0x458c3e<_0x28dedc['length'];_0x458c3e+=0x1){_0x22bf81[_0x22f8('0x4c')]({'membername':_0x430688[_0x22f8('0x38')],'UserId':_0x430688['id'],'queue_name':_0x28dedc[_0x458c3e][_0x22f8('0x38')],'VoiceQueueId':_0x28dedc[_0x458c3e]['id'],'interface':_[_0x22f8('0x6b')](_0x430688[_0x22f8('0xa2')])?util[_0x22f8('0xab')](_0x22f8('0xac'),_0x430688[_0x22f8('0x38')]):_0x430688[_0x22f8('0xa2')],'paused':_0x430688[_0x22f8('0xa1')]||![],'penalty':_0x3c41be['body']['penalty']||0x0});}return Promise['all'](_0x22bf81[_0x22f8('0x3e')](function(_0xbe3b26){return db[_0x22f8('0xad')][_0x22f8('0xae')](_0xbe3b26);}));}return _0x1840a6;});}})['then'](respondWithStatusCode(_0x2d3496,null))[_0x22f8('0x57')](handleError(_0x2d3496,null));};exports[_0x22f8('0xaf')]=function(_0x43e1ba,_0xf166ab){var _0x278722,_0x32f05a;return db[_0x22f8('0x5e')]['find']({'where':{'id':_0x43e1ba[_0x22f8('0x59')]['id']},'attributes':['id','name',_0x22f8('0x2b')]})[_0x22f8('0x20')](handleEntityNotFound(_0xf166ab,null))[_0x22f8('0x20')](function(_0x5b164d){if(_0x5b164d){_0x278722=_0x5b164d;if(!_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x9e')]||!utils[_0x22f8('0xa3')](_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x9e')])){throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))]('Unknown\x20channel');}return _0x5b164d[_0x22f8('0xb0')+_[_0x22f8('0xa5')](_0x43e1ba[_0x22f8('0x46')]['channel'][_0x22f8('0xa7')]())+_0x22f8('0xb1')](_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x64')]);}})[_0x22f8('0x20')](function(_0x340339){if(_[_0x22f8('0xb2')](_0x43e1ba[_0x22f8('0x46')]['ids'])){for(var _0x1790ce=0x0;_0x1790ce<_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x64')][_0x22f8('0x4f')];_0x1790ce+=0x1){_0x32f05a={'UserId':Number(_0x43e1ba[_0x22f8('0x59')]['id'])};_0x32f05a[_[_0x22f8('0xa5')](_0x43e1ba['query'][_0x22f8('0x9e')][_0x22f8('0xa7')]())+_0x22f8('0xa6')]=Number(_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x64')][_0x1790ce]);socket['emit'](_0x22f8('0x31')+_[_0x22f8('0xa5')](_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x9e')][_0x22f8('0xa7')]())+_0x22f8('0xb3'),_0x32f05a);}}else{_0x32f05a={'UserId':Number(_0x43e1ba[_0x22f8('0x59')]['id'])};_0x32f05a[_[_0x22f8('0xa5')](_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x9e')][_0x22f8('0xa7')]())+_0x22f8('0xa6')]=Number(_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x64')]);socket[_0x22f8('0x2d')](_0x22f8('0x31')+_['capitalize'](_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x9e')][_0x22f8('0xa7')]())+_0x22f8('0xb3'),_0x32f05a);}return _0x340339;})['then'](function(){if(_0x43e1ba[_0x22f8('0x46')]['channel']===_0x22f8('0xa9')){return db[_0x22f8('0xad')][_0x22f8('0x2e')]({'where':{'UserId':_0x43e1ba[_0x22f8('0x59')]['id'],'VoiceQueueId':_0x43e1ba[_0x22f8('0x46')][_0x22f8('0x64')]},'individualHooks':!![]})[_0x22f8('0x20')](function(){return _0x278722;});}return _0x278722;})[_0x22f8('0x20')](respondWithStatusCode(_0xf166ab,null))['catch'](handleError(_0xf166ab,null));};exports[_0x22f8('0xb4')]=function(_0x3dfec1,_0xff928c){_0x3dfec1[_0x22f8('0x61')][_0x22f8('0xb5')]=_0x3dfec1[_0x22f8('0xb6')][_0x22f8('0xb7')];return db['User'][_0x22f8('0x37')]({'where':{'id':_0x3dfec1[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0xff928c,null))[_0x22f8('0x20')](saveUpdates(_0x3dfec1[_0x22f8('0x61')],null))[_0x22f8('0x20')](respondWithResult(_0xff928c,null))['catch'](handleError(_0xff928c,null));};exports[_0x22f8('0xb8')]=function(_0x2254c2,_0x36fa19){var _0xa4596a=path[_0x22f8('0xb9')](config[_0x22f8('0xba')],_0x22f8('0xbb'));return db['User'][_0x22f8('0x37')]({'where':{'id':_0x2254c2[_0x22f8('0x59')]['id']},'attributes':['id',_0x22f8('0xb5')],'raw':!![]})[_0x22f8('0x20')](handleEntityNotFound(_0x36fa19,null))[_0x22f8('0x20')](function(_0x39dd89){if(_0x39dd89){if(_[_0x22f8('0x6b')](_0x39dd89[_0x22f8('0xb5')])){return _0x36fa19[_0x22f8('0xbc')](_0xa4596a);}else{if(!fs['existsSync'](path[_0x22f8('0xb9')](config[_0x22f8('0xba')],_0x22f8('0xbd'),_0x39dd89[_0x22f8('0xb5')]))){return _0x36fa19[_0x22f8('0xbc')](_0xa4596a);}return _0x36fa19[_0x22f8('0xbc')](path[_0x22f8('0xb9')](config[_0x22f8('0xba')],_0x22f8('0xbd'),_0x39dd89[_0x22f8('0xb5')]));}}})[_0x22f8('0x57')](handleError(_0x36fa19,null));};exports[_0x22f8('0xbe')]=function(_0x5733f2,_0x2f86e6){return db['User'][_0x22f8('0x37')]({'where':{'id':_0x5733f2[_0x22f8('0x59')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2f86e6,null))[_0x22f8('0x20')](function(_0x5313ef){var _0x48c1b4=[];values=_0x5313ef[_0x22f8('0x51')];_0x48c1b4['push'](get_open_tabs(_0x22f8('0x60'),_0x5313ef['dataValues']));_0x48c1b4[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x50'),_0x5313ef['dataValues']));_0x48c1b4[_0x22f8('0x4c')](get_open_tabs('openchannel',_0x5313ef[_0x22f8('0x51')]));_0x48c1b4[_0x22f8('0x4c')](get_open_tabs(_0x22f8('0x55'),_0x5313ef[_0x22f8('0x51')]));_0x48c1b4['push'](get_open_tabs(_0x22f8('0x52'),_0x5313ef[_0x22f8('0x51')]));_0x48c1b4[_0x22f8('0x4c')](get_open_tabs('mail',_0x5313ef['dataValues']));return Promise[_0x22f8('0x56')](_0x48c1b4);})[_0x22f8('0x20')](function(_0x2d5496){if(_0x2d5496){var _0x5e4b3f=_['map'](values[_0x22f8('0xbf')],function(_0x5ea16d){return{'channel':'CHAT','id':_0x5ea16d['id'],'createdAt':_0x5ea16d['createdAt']};});var _0x536d43=_[_0x22f8('0x3e')](values[_0x22f8('0xc0')],function(_0xdf96dc){return{'channel':'FAX','id':_0xdf96dc['id'],'createdAt':_0xdf96dc[_0x22f8('0xc1')]};});var _0xf2489b=_['map'](values[_0x22f8('0xc2')],function(_0x27ac79){return{'channel':_0x22f8('0xc3'),'id':_0x27ac79['id'],'createdAt':_0x27ac79['createdAt']};});var _0x4e5e7e=_[_0x22f8('0x3e')](values['MailOpenTabs'],function(_0x56ea5c){return{'channel':_0x22f8('0xc4'),'id':_0x56ea5c['id'],'createdAt':_0x56ea5c[_0x22f8('0xc1')]};});var _0x5f0aab=_[_0x22f8('0x3e')](values[_0x22f8('0xc5')],function(_0x5b5b42){return{'channel':_0x22f8('0xc6'),'id':_0x5b5b42['id'],'createdAt':_0x5b5b42[_0x22f8('0xc1')]};});var _0x1c3449=_[_0x22f8('0x3e')](values[_0x22f8('0xc7')],function(_0x5487d9){return{'channel':_0x22f8('0xc8'),'id':_0x5487d9['id'],'createdAt':_0x5487d9['createdAt']};});var _0x183498=_['concat'](_0x5e4b3f,_0x536d43,_0xf2489b,_0x4e5e7e,_0x5f0aab,_0x1c3449);var _0x32403d={'count':_0x183498['length'],'rows':_0x183498};return _0x32403d;}else return null;})[_0x22f8('0x20')](respondWithResult(_0x2f86e6,null))[_0x22f8('0x57')](handleError(_0x2f86e6,null));};exports[_0x22f8('0xc9')]=function(_0x4a3d06,_0x7a7883){var _0x525cea={};return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x4a3d06[_0x22f8('0x59')]['id']}})['then'](function(_0x291939){if(!_0x291939){throw new APINotFoundError(util[_0x22f8('0xab')](_0x22f8('0xca'),_0x4a3d06[_0x22f8('0x59')]['id']));}return contacts['describe']();})['then'](function(_0x4fd002){_0x4a3d06[_0x22f8('0x46')][_0x22f8('0x5e')]=_0x4a3d06['params']['id'];_0x525cea=qs['getOptions'](_0x4fd002,_0x4a3d06);if(_0x4a3d06[_0x22f8('0x46')]['hasOwnProperty']('includeAll')){_0x525cea[_0x22f8('0x5b')]=[{'model':db[_0x22f8('0xcb')],'as':_0x22f8('0xcc'),'required':![]},{'model':db[_0x22f8('0xcd')],'as':_0x22f8('0xce'),'attributes':['id',_0x22f8('0x38'),_0x22f8('0xcf')],'where':_0x4a3d06['query'][_0x22f8('0xd0')]?{'id':_0x4a3d06[_0x22f8('0x46')]['tag']}:undefined,'required':_0x4a3d06[_0x22f8('0x46')][_0x22f8('0xd0')]?!![]:![]}];}return contacts[_0x22f8('0x4d')](_0x4a3d06[_0x22f8('0x46')],_0x4a3d06['user'],_0x525cea,_0x4fd002);})['then'](respondWithFilteredResult(_0x7a7883,_0x525cea))['catch'](APIHandleError(_0x7a7883));};exports[_0x22f8('0xd1')]=function(_0x532350,_0x444b2e){var _0x1a056d;var _0x3e3517={};var _0x3e7344;return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x532350[_0x22f8('0x59')]['id']},'attributes':['id',_0x22f8('0x38'),_0x22f8('0x2b')]})[_0x22f8('0x20')](handleEntityNotFound(_0x444b2e,null))['then'](function(_0x17ea30){if(!utils[_0x22f8('0xa3')](_0x532350[_0x22f8('0x46')]['channel'])){throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))]('Unknown\x20channel');}_0x1a056d=_0x17ea30;var _0x486db1={};_0x486db1[_0x22f8('0xd2')]=_[_0x22f8('0xd3')](db[_[_0x22f8('0xa5')](_0x532350[_0x22f8('0x46')]['channel'])+_0x22f8('0xd4')]['rawAttributes']);_0x486db1['query']=_['keys'](_0x532350[_0x22f8('0x46')]);_0x486db1[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x486db1[_0x22f8('0xd2')],_0x486db1[_0x22f8('0x46')]);_0x3e3517[_0x22f8('0x4b')]=_[_0x22f8('0xd6')](_0x486db1[_0x22f8('0xd2')],qs['fields'](_0x532350[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x3e3517[_0x22f8('0x4b')]=_0x3e3517[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x3e3517[_0x22f8('0x4b')]:_0x486db1[_0x22f8('0xd2')];_0x3e3517[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0x532350['query']['sort']);_0x3e3517[_0x22f8('0x45')]=qs['filters'](_['pick'](_0x532350[_0x22f8('0x46')],_0x486db1[_0x22f8('0xd5')]));if(_0x532350[_0x22f8('0x46')][_0x22f8('0x34')]){_0x3e3517['where']=_[_0x22f8('0x5c')](_0x3e3517[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x3e3517['attributes'],function(_0x4a1c88){var _0xbe8c79={};_0xbe8c79[_0x4a1c88]={'$like':'%'+_0x532350['query']['filter']+'%'};return _0xbe8c79;})});}_0x3e3517=_[_0x22f8('0x5c')]({},_0x3e3517,_0x532350['options']);switch(_0x1a056d['role']){case _0x22f8('0x30'):return db[_[_0x22f8('0xa5')](_0x532350[_0x22f8('0x46')][_0x22f8('0x9e')])+_0x22f8('0xd4')][_0x22f8('0x4d')](_0x3e3517);case'user':case _0x22f8('0x2c'):return _0x1a056d[_0x22f8('0x2f')+_[_0x22f8('0xa5')](_0x532350[_0x22f8('0x46')][_0x22f8('0x9e')])+_0x22f8('0xb1')](_0x3e3517);default:throw new db['Sequelize'][(_0x22f8('0x96'))](_0x22f8('0xda'));}})['then'](function(_0x810596){_0x3e7344=_0x810596['length'];if(!_0x532350[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x3e3517[_0x22f8('0x1d')]=qs[_0x22f8('0x1d')](_0x532350[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x3e3517['offset']=qs[_0x22f8('0x1a')](_0x532350['query']['offset']);}switch(_0x1a056d['role']){case _0x22f8('0x30'):return db[_[_0x22f8('0xa5')](_0x532350['query'][_0x22f8('0x9e')])+_0x22f8('0xd4')][_0x22f8('0x4d')](_0x3e3517);case _0x22f8('0x31'):case _0x22f8('0x2c'):return _0x1a056d['get'+_[_0x22f8('0xa5')](_0x532350[_0x22f8('0x46')][_0x22f8('0x9e')])+_0x22f8('0xb1')](_0x3e3517);}})[_0x22f8('0x20')](function(_0x86ece5){return{'count':_0x3e7344,'rows':_0x86ece5};})[_0x22f8('0x20')](respondWithResult(_0x444b2e,null))[_0x22f8('0x57')](handleError(_0x444b2e,null));};exports[_0x22f8('0xdd')]=function(_0xc481e,_0x2abe75){var _0x3c0127={};var _0x233270={};var _0x2ff9a0;var _0x2130c4;return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0xc481e[_0x22f8('0x59')]['id']}})['then'](handleEntityNotFound(_0x2abe75,null))['then'](function(_0xd0ab59){if(_0xd0ab59){_0x2ff9a0=_0xd0ab59;_0x233270[_0x22f8('0xd2')]=_[_0x22f8('0xd3')](db['UserVoiceQueueRt'][_0x22f8('0x3d')]);_0x233270['query']=_[_0x22f8('0xd3')](_0xc481e['query']);_0x233270['filters']=_['intersection'](_0x233270[_0x22f8('0xd2')],_0x233270['query']);_0x3c0127['attributes']=_['intersection'](_0x233270['model'],qs[_0x22f8('0xd7')](_0xc481e[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x3c0127[_0x22f8('0x4b')]=_0x3c0127[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x3c0127[_0x22f8('0x4b')]:_0x233270[_0x22f8('0xd2')];_0x3c0127[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0xc481e[_0x22f8('0x46')][_0x22f8('0xd9')]);_0x3c0127['where']=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0xc481e['query'],_0x233270['filters']));if(_0xc481e[_0x22f8('0x46')][_0x22f8('0x34')]){_0x3c0127['where']=_['merge'](_0x3c0127[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x3c0127[_0x22f8('0x4b')],function(_0xffe5fb){var _0x3399cc={};_0x3399cc[_0xffe5fb]={'$like':'%'+_0xc481e[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x3399cc;})});}_0x3c0127=_['merge']({},_0x3c0127,_0xc481e[_0x22f8('0x5d')]);return _0x2ff9a0[_0x22f8('0xdd')](_0x3c0127);}})[_0x22f8('0x20')](function(_0x17ef9f){if(_0x17ef9f){_0x2130c4=_0x17ef9f[_0x22f8('0x4f')];if(!_0xc481e['query'][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x3c0127[_0x22f8('0x1d')]=qs[_0x22f8('0x1d')](_0xc481e[_0x22f8('0x46')]['limit']);_0x3c0127[_0x22f8('0x1a')]=qs['offset'](_0xc481e[_0x22f8('0x46')][_0x22f8('0x1a')]);}return _0x2ff9a0[_0x22f8('0xdd')](_0x3c0127);}})['then'](function(_0x1f0a10){if(_0x1f0a10){return _0x1f0a10?{'count':_0x2130c4,'rows':_0x1f0a10}:null;}})[_0x22f8('0x20')](respondWithResult(_0x2abe75,null))['catch'](handleError(_0x2abe75,null));};exports[_0x22f8('0xdf')]=function(_0x345ce2,_0x107735){var _0x23fac9={};var _0x24e803={};var _0x1f524e;var _0x25deee;return db[_0x22f8('0x5e')]['findOne']({'where':{'id':_0x345ce2[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x107735,null))[_0x22f8('0x20')](function(_0x3b280d){if(_0x3b280d){_0x1f524e=_0x3b280d;_0x24e803[_0x22f8('0xd2')]=_['keys'](db['ChatGroup'][_0x22f8('0x3d')]);_0x24e803[_0x22f8('0x46')]=_[_0x22f8('0xd3')](_0x345ce2[_0x22f8('0x46')]);_0x24e803[_0x22f8('0xd5')]=_['intersection'](_0x24e803[_0x22f8('0xd2')],_0x24e803[_0x22f8('0x46')]);_0x23fac9[_0x22f8('0x4b')]=_['intersection'](_0x24e803[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x345ce2['query'][_0x22f8('0xd7')]));_0x23fac9[_0x22f8('0x4b')]=_0x23fac9[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x23fac9[_0x22f8('0x4b')]:_0x24e803[_0x22f8('0xd2')];_0x23fac9['order']=qs[_0x22f8('0xd9')](_0x345ce2[_0x22f8('0x46')][_0x22f8('0xd9')]);_0x23fac9[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x345ce2[_0x22f8('0x46')],_0x24e803[_0x22f8('0xd5')]));if(_0x345ce2[_0x22f8('0x46')][_0x22f8('0x34')]){_0x23fac9['where']=_['merge'](_0x23fac9[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x23fac9[_0x22f8('0x4b')],function(_0x4de3f4){var _0x3a9325={};_0x3a9325[_0x4de3f4]={'$like':'%'+_0x345ce2['query'][_0x22f8('0x34')]+'%'};return _0x3a9325;})});}_0x23fac9=_[_0x22f8('0x5c')]({},_0x23fac9,_0x345ce2[_0x22f8('0x5d')]);return _0x1f524e[_0x22f8('0xdf')](_0x23fac9);}})['then'](function(_0x397788){if(_0x397788){_0x25deee=_0x397788[_0x22f8('0x4f')];if(!_0x345ce2[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x23fac9[_0x22f8('0x1d')]=qs['limit'](_0x345ce2[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x23fac9[_0x22f8('0x1a')]=qs[_0x22f8('0x1a')](_0x345ce2['query'][_0x22f8('0x1a')]);}return _0x1f524e[_0x22f8('0xdf')](_0x23fac9);}})[_0x22f8('0x20')](function(_0x37e79b){if(_0x37e79b){return _0x37e79b?{'count':_0x25deee,'rows':_0x37e79b}:null;}})[_0x22f8('0x20')](respondWithResult(_0x107735,null))[_0x22f8('0x57')](handleError(_0x107735,null));};exports[_0x22f8('0xe0')]=function(_0x259924,_0x134b24){var _0x3a2de8={'raw':!![],'where':{}};var _0x19e13d={};var _0x5df27f={'count':0x0,'rows':[]};return db['User'][_0x22f8('0x9a')]({'where':{'id':_0x259924[_0x22f8('0x59')]['id']}})['then'](handleEntityNotFound(_0x134b24,null))[_0x22f8('0x20')](function(_0x407879){if(_0x407879){_0x19e13d['model']=_[_0x22f8('0xd3')](db[_0x22f8('0xe1')][_0x22f8('0x3d')]);_0x19e13d[_0x22f8('0x46')]=_['keys'](_0x259924[_0x22f8('0x46')]);_0x19e13d[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x19e13d[_0x22f8('0xd2')],_0x19e13d[_0x22f8('0x46')]);_0x3a2de8[_0x22f8('0x4b')]=_[_0x22f8('0xd6')](_0x19e13d[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x259924['query'][_0x22f8('0xd7')]));_0x3a2de8['attributes']=_0x3a2de8[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x3a2de8[_0x22f8('0x4b')]:_0x19e13d['model'];if(!_0x259924['query'][_0x22f8('0xdb')]('nolimit')){_0x3a2de8['limit']=qs['limit'](_0x259924[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x3a2de8[_0x22f8('0x1a')]=qs['offset'](_0x259924['query'][_0x22f8('0x1a')]);}_0x3a2de8[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0x259924[_0x22f8('0x46')][_0x22f8('0xd9')]);_0x3a2de8[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x259924[_0x22f8('0x46')],_0x19e13d[_0x22f8('0xd5')]));_0x3a2de8['where']['UserId']=_0x407879['id'];if(_0x259924['query'][_0x22f8('0x34')]){_0x3a2de8[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0x3a2de8[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x3a2de8['attributes'],function(_0x11fd44){var _0x48e5c9={};_0x48e5c9[_0x11fd44]={'$like':'%'+_0x259924[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x48e5c9;})});}_0x3a2de8=_['merge']({},_0x3a2de8,_0x259924['options']);return db[_0x22f8('0xe1')][_0x22f8('0x1c')]({'where':_0x3a2de8[_0x22f8('0x45')]})['then'](function(_0x460930){_0x5df27f[_0x22f8('0x1c')]=_0x460930;if(_0x259924[_0x22f8('0x46')][_0x22f8('0x47')]){_0x3a2de8[_0x22f8('0x5b')]=[{'all':!![]}];}return db[_0x22f8('0xe1')]['findAll'](_0x3a2de8);})[_0x22f8('0x20')](function(_0x1f06fe){_0x5df27f[_0x22f8('0x4e')]=_0x1f06fe;return _0x5df27f;});}})['then'](respondWithFilteredResult(_0x134b24,_0x3a2de8))['catch'](handleError(_0x134b24,null));};exports[_0x22f8('0xe2')]=function(_0x4532f7,_0x410fd1){var _0x1fc731={'raw':!![],'where':{}};var _0x175135={};var _0x536d3c={'count':0x0,'rows':[]};return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x4532f7['params']['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x410fd1,null))[_0x22f8('0x20')](function(_0x562a53){if(_0x562a53){_0x175135[_0x22f8('0xd2')]=_[_0x22f8('0xd3')](db[_0x22f8('0xe3')]['rawAttributes']);_0x175135[_0x22f8('0x46')]=_[_0x22f8('0xd3')](_0x4532f7[_0x22f8('0x46')]);_0x175135[_0x22f8('0xd5')]=_['intersection'](_0x175135[_0x22f8('0xd2')],_0x175135['query']);_0x1fc731['attributes']=_[_0x22f8('0xd6')](_0x175135[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x4532f7[_0x22f8('0x46')]['fields']));_0x1fc731[_0x22f8('0x4b')]=_0x1fc731[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x1fc731[_0x22f8('0x4b')]:_0x175135['model'];if(!_0x4532f7[_0x22f8('0x46')]['hasOwnProperty'](_0x22f8('0xdc'))){_0x1fc731['limit']=qs[_0x22f8('0x1d')](_0x4532f7[_0x22f8('0x46')]['limit']);_0x1fc731['offset']=qs[_0x22f8('0x1a')](_0x4532f7[_0x22f8('0x46')][_0x22f8('0x1a')]);}_0x1fc731[_0x22f8('0xd8')]=qs['sort'](_0x4532f7[_0x22f8('0x46')][_0x22f8('0xd9')]);_0x1fc731['where']=qs['filters'](_[_0x22f8('0xde')](_0x4532f7[_0x22f8('0x46')],_0x175135[_0x22f8('0xd5')]));_0x1fc731[_0x22f8('0x45')][_0x22f8('0xe4')]=_0x562a53['id'];if(_0x4532f7[_0x22f8('0x46')]['filter']){_0x1fc731[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0x1fc731[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x1fc731[_0x22f8('0x4b')],function(_0x3d0430){var _0x5b971d={};_0x5b971d[_0x3d0430]={'$like':'%'+_0x4532f7[_0x22f8('0x46')]['filter']+'%'};return _0x5b971d;})});}_0x1fc731=_[_0x22f8('0x5c')]({},_0x1fc731,_0x4532f7[_0x22f8('0x5d')]);return db[_0x22f8('0xe3')][_0x22f8('0x1c')]({'where':_0x1fc731['where']})[_0x22f8('0x20')](function(_0x2e437c){_0x536d3c[_0x22f8('0x1c')]=_0x2e437c;if(_0x4532f7[_0x22f8('0x46')]['includeAll']){_0x1fc731[_0x22f8('0x5b')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x1fc731);})['then'](function(_0x3f6e28){_0x536d3c[_0x22f8('0x4e')]=_0x3f6e28;return _0x536d3c;});}})[_0x22f8('0x20')](respondWithFilteredResult(_0x410fd1,_0x1fc731))[_0x22f8('0x57')](handleError(_0x410fd1,null));};exports['getChatInteractions']=function(_0x27ca7b,_0x40e4c1){var _0x2f95a0={};var _0x325e08={};var _0x531f50;var _0x26a2b2;return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x27ca7b['params']['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x40e4c1,null))[_0x22f8('0x20')](function(_0x27d31f){if(_0x27d31f){_0x531f50=_0x27d31f;_0x325e08[_0x22f8('0xd2')]=_[_0x22f8('0xd3')](db[_0x22f8('0xe5')][_0x22f8('0x3d')]);_0x325e08[_0x22f8('0x46')]=_[_0x22f8('0xd3')](_0x27ca7b[_0x22f8('0x46')]);_0x325e08[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x325e08[_0x22f8('0xd2')],_0x325e08['query']);_0x2f95a0[_0x22f8('0x4b')]=_['intersection'](_0x325e08[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x27ca7b['query'][_0x22f8('0xd7')]));_0x2f95a0[_0x22f8('0x4b')]=_0x2f95a0[_0x22f8('0x4b')]['length']?_0x2f95a0['attributes']:_0x325e08[_0x22f8('0xd2')];_0x2f95a0[_0x22f8('0xd8')]=qs['sort'](_0x27ca7b[_0x22f8('0x46')]['sort']);_0x2f95a0[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x27ca7b[_0x22f8('0x46')],_0x325e08[_0x22f8('0xd5')]));if(_0x27ca7b[_0x22f8('0x46')]['filter']){_0x2f95a0[_0x22f8('0x45')]=_['merge'](_0x2f95a0['where'],{'$or':_[_0x22f8('0x3e')](_0x2f95a0[_0x22f8('0x4b')],function(_0x2d93a3){var _0x5d379e={};_0x5d379e[_0x2d93a3]={'$like':'%'+_0x27ca7b[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x5d379e;})});}_0x2f95a0=_['merge']({},_0x2f95a0,_0x27ca7b['options']);return _0x531f50['getChatInteractions'](_0x2f95a0);}})[_0x22f8('0x20')](function(_0x5277c1){if(_0x5277c1){_0x26a2b2=_0x5277c1[_0x22f8('0x4f')];if(!_0x27ca7b[_0x22f8('0x46')]['hasOwnProperty'](_0x22f8('0xdc'))){_0x2f95a0['limit']=qs[_0x22f8('0x1d')](_0x27ca7b['query'][_0x22f8('0x1d')]);_0x2f95a0[_0x22f8('0x1a')]=qs[_0x22f8('0x1a')](_0x27ca7b[_0x22f8('0x46')][_0x22f8('0x1a')]);}return _0x531f50['getChatInteractions'](_0x2f95a0);}})[_0x22f8('0x20')](function(_0x55cfd5){if(_0x55cfd5){return _0x55cfd5?{'count':_0x26a2b2,'rows':_0x55cfd5}:null;}})['then'](respondWithResult(_0x40e4c1,null))[_0x22f8('0x57')](handleError(_0x40e4c1,null));};exports['getOpenchannelInteractions']=function(_0x4a07cd,_0x1b0501){var _0x80850a={};var _0x42d0b7={};var _0x57a59e;var _0x168fdc;return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x4a07cd[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x1b0501,null))[_0x22f8('0x20')](function(_0x3b09a9){if(_0x3b09a9){_0x57a59e=_0x3b09a9;_0x42d0b7['model']=_[_0x22f8('0xd3')](db['OpenchannelInteraction'][_0x22f8('0x3d')]);_0x42d0b7['query']=_[_0x22f8('0xd3')](_0x4a07cd['query']);_0x42d0b7['filters']=_[_0x22f8('0xd6')](_0x42d0b7[_0x22f8('0xd2')],_0x42d0b7[_0x22f8('0x46')]);_0x80850a[_0x22f8('0x4b')]=_[_0x22f8('0xd6')](_0x42d0b7[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x4a07cd[_0x22f8('0x46')]['fields']));_0x80850a[_0x22f8('0x4b')]=_0x80850a['attributes'][_0x22f8('0x4f')]?_0x80850a[_0x22f8('0x4b')]:_0x42d0b7['model'];_0x80850a[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0x4a07cd['query'][_0x22f8('0xd9')]);_0x80850a[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x4a07cd['query'],_0x42d0b7['filters']));if(_0x4a07cd[_0x22f8('0x46')][_0x22f8('0x34')]){_0x80850a[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0x80850a[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x80850a[_0x22f8('0x4b')],function(_0x24d5bd){var _0x4f5691={};_0x4f5691[_0x24d5bd]={'$like':'%'+_0x4a07cd[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x4f5691;})});}_0x80850a=_[_0x22f8('0x5c')]({},_0x80850a,_0x4a07cd[_0x22f8('0x5d')]);return _0x57a59e[_0x22f8('0xe6')](_0x80850a);}})['then'](function(_0x13c9d4){if(_0x13c9d4){_0x168fdc=_0x13c9d4['length'];if(!_0x4a07cd[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x80850a[_0x22f8('0x1d')]=qs[_0x22f8('0x1d')](_0x4a07cd['query']['limit']);_0x80850a[_0x22f8('0x1a')]=qs[_0x22f8('0x1a')](_0x4a07cd['query']['offset']);}return _0x57a59e[_0x22f8('0xe6')](_0x80850a);}})[_0x22f8('0x20')](function(_0x16df2f){if(_0x16df2f){return _0x16df2f?{'count':_0x168fdc,'rows':_0x16df2f}:null;}})[_0x22f8('0x20')](respondWithResult(_0x1b0501,null))['catch'](handleError(_0x1b0501,null));};exports[_0x22f8('0xe7')]=function(_0x2f6d94,_0xd8d9c3){var _0x2b60d5={'raw':!![],'where':{}};var _0x4379dc={};var _0x50ffc5={'count':0x0,'rows':[]};return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x2f6d94[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0xd8d9c3,null))[_0x22f8('0x20')](function(_0x364884){if(_0x364884){_0x4379dc['model']=_[_0x22f8('0xd3')](db[_0x22f8('0xe8')][_0x22f8('0x3d')]);_0x4379dc['query']=_['keys'](_0x2f6d94[_0x22f8('0x46')]);_0x4379dc[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x4379dc[_0x22f8('0xd2')],_0x4379dc[_0x22f8('0x46')]);_0x2b60d5['attributes']=_[_0x22f8('0xd6')](_0x4379dc[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x2f6d94['query'][_0x22f8('0xd7')]));_0x2b60d5['attributes']=_0x2b60d5[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x2b60d5[_0x22f8('0x4b')]:_0x4379dc[_0x22f8('0xd2')];if(!_0x2f6d94[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x2b60d5[_0x22f8('0x1d')]=qs[_0x22f8('0x1d')](_0x2f6d94[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x2b60d5[_0x22f8('0x1a')]=qs[_0x22f8('0x1a')](_0x2f6d94[_0x22f8('0x46')][_0x22f8('0x1a')]);}_0x2b60d5[_0x22f8('0xd8')]=qs['sort'](_0x2f6d94['query'][_0x22f8('0xd9')]);_0x2b60d5['where']=qs['filters'](_['pick'](_0x2f6d94[_0x22f8('0x46')],_0x4379dc[_0x22f8('0xd5')]));_0x2b60d5[_0x22f8('0x45')][_0x22f8('0xe4')]=_0x364884['id'];if(_0x2f6d94[_0x22f8('0x46')][_0x22f8('0x34')]){_0x2b60d5[_0x22f8('0x45')]=_['merge'](_0x2b60d5[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x2b60d5[_0x22f8('0x4b')],function(_0x187efe){var _0xb82486={};_0xb82486[_0x187efe]={'$like':'%'+_0x2f6d94[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0xb82486;})});}_0x2b60d5=_['merge']({},_0x2b60d5,_0x2f6d94['options']);return db[_0x22f8('0xe8')][_0x22f8('0x1c')]({'where':_0x2b60d5[_0x22f8('0x45')]})[_0x22f8('0x20')](function(_0xda644b){_0x50ffc5[_0x22f8('0x1c')]=_0xda644b;if(_0x2f6d94[_0x22f8('0x46')]['includeAll']){_0x2b60d5[_0x22f8('0x5b')]=[{'all':!![]}];}return db[_0x22f8('0xe8')][_0x22f8('0x4d')](_0x2b60d5);})[_0x22f8('0x20')](function(_0x80d275){_0x50ffc5[_0x22f8('0x4e')]=_0x80d275;return _0x50ffc5;});}})[_0x22f8('0x20')](respondWithFilteredResult(_0xd8d9c3,_0x2b60d5))['catch'](handleError(_0xd8d9c3,null));};exports['getSmsInteractions']=function(_0x5741bb,_0x43d3fb){var _0x185b52={};var _0x5e2672={};var _0x4aedd9;var _0xcc2c36;return db['User'][_0x22f8('0x9a')]({'where':{'id':_0x5741bb[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x43d3fb,null))[_0x22f8('0x20')](function(_0x4e698b){if(_0x4e698b){_0x4aedd9=_0x4e698b;_0x5e2672[_0x22f8('0xd2')]=_['keys'](db['SmsInteraction'][_0x22f8('0x3d')]);_0x5e2672[_0x22f8('0x46')]=_['keys'](_0x5741bb[_0x22f8('0x46')]);_0x5e2672['filters']=_[_0x22f8('0xd6')](_0x5e2672[_0x22f8('0xd2')],_0x5e2672[_0x22f8('0x46')]);_0x185b52['attributes']=_[_0x22f8('0xd6')](_0x5e2672[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x5741bb[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x185b52[_0x22f8('0x4b')]=_0x185b52[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x185b52[_0x22f8('0x4b')]:_0x5e2672[_0x22f8('0xd2')];_0x185b52[_0x22f8('0xd8')]=qs['sort'](_0x5741bb[_0x22f8('0x46')]['sort']);_0x185b52['where']=qs['filters'](_[_0x22f8('0xde')](_0x5741bb[_0x22f8('0x46')],_0x5e2672[_0x22f8('0xd5')]));if(_0x5741bb[_0x22f8('0x46')][_0x22f8('0x34')]){_0x185b52['where']=_[_0x22f8('0x5c')](_0x185b52[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x185b52[_0x22f8('0x4b')],function(_0x2b5a75){var _0x33dcbf={};_0x33dcbf[_0x2b5a75]={'$like':'%'+_0x5741bb[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x33dcbf;})});}_0x185b52=_[_0x22f8('0x5c')]({},_0x185b52,_0x5741bb[_0x22f8('0x5d')]);return _0x4aedd9['getSmsInteractions'](_0x185b52);}})[_0x22f8('0x20')](function(_0x2e7346){if(_0x2e7346){_0xcc2c36=_0x2e7346[_0x22f8('0x4f')];if(!_0x5741bb[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x185b52[_0x22f8('0x1d')]=qs[_0x22f8('0x1d')](_0x5741bb[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x185b52['offset']=qs['offset'](_0x5741bb['query'][_0x22f8('0x1a')]);}return _0x4aedd9[_0x22f8('0xe9')](_0x185b52);}})['then'](function(_0x57fbdf){if(_0x57fbdf){return _0x57fbdf?{'count':_0xcc2c36,'rows':_0x57fbdf}:null;}})['then'](respondWithResult(_0x43d3fb,null))[_0x22f8('0x57')](handleError(_0x43d3fb,null));};exports[_0x22f8('0xea')]=function(_0x4bf0cd,_0x1730e0){var _0x433cf3={};var _0x5b0f41={};var _0x2f9cbf;var _0x144610;return db[_0x22f8('0x5e')]['findOne']({'where':{'id':_0x4bf0cd[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x1730e0,null))[_0x22f8('0x20')](function(_0x29112f){if(_0x29112f){_0x2f9cbf=_0x29112f;_0x5b0f41['model']=_[_0x22f8('0xd3')](db[_0x22f8('0xeb')][_0x22f8('0x3d')]);_0x5b0f41[_0x22f8('0x46')]=_[_0x22f8('0xd3')](_0x4bf0cd[_0x22f8('0x46')]);_0x5b0f41[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x5b0f41[_0x22f8('0xd2')],_0x5b0f41[_0x22f8('0x46')]);_0x433cf3['attributes']=_['intersection'](_0x5b0f41[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x4bf0cd[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x433cf3[_0x22f8('0x4b')]=_0x433cf3[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x433cf3[_0x22f8('0x4b')]:_0x5b0f41[_0x22f8('0xd2')];_0x433cf3['order']=qs['sort'](_0x4bf0cd[_0x22f8('0x46')][_0x22f8('0xd9')]);_0x433cf3[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_['pick'](_0x4bf0cd[_0x22f8('0x46')],_0x5b0f41[_0x22f8('0xd5')]));if(_0x4bf0cd['query']['filter']){_0x433cf3[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0x433cf3[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x433cf3['attributes'],function(_0x20e31d){var _0x45f7ab={};_0x45f7ab[_0x20e31d]={'$like':'%'+_0x4bf0cd[_0x22f8('0x46')]['filter']+'%'};return _0x45f7ab;})});}_0x433cf3=_[_0x22f8('0x5c')]({},_0x433cf3,_0x4bf0cd[_0x22f8('0x5d')]);return _0x2f9cbf['getFaxInteractions'](_0x433cf3);}})['then'](function(_0x4946a2){if(_0x4946a2){_0x144610=_0x4946a2[_0x22f8('0x4f')];if(!_0x4bf0cd[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x433cf3['limit']=qs['limit'](_0x4bf0cd[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x433cf3[_0x22f8('0x1a')]=qs[_0x22f8('0x1a')](_0x4bf0cd['query'][_0x22f8('0x1a')]);}return _0x2f9cbf[_0x22f8('0xea')](_0x433cf3);}})[_0x22f8('0x20')](function(_0x2b18be){if(_0x2b18be){return _0x2b18be?{'count':_0x144610,'rows':_0x2b18be}:null;}})['then'](respondWithResult(_0x1730e0,null))[_0x22f8('0x57')](handleError(_0x1730e0,null));};exports['getWhatsappInteractions']=function(_0x5b4ef2,_0x5b7c83){var _0x29fb19={};var _0x2878c3={};var _0x1ca0d5;var _0x413268;return db[_0x22f8('0x5e')]['findOne']({'where':{'id':_0x5b4ef2[_0x22f8('0x59')]['id']}})['then'](handleEntityNotFound(_0x5b7c83,null))[_0x22f8('0x20')](function(_0x87e8f7){if(_0x87e8f7){_0x1ca0d5=_0x87e8f7;_0x2878c3[_0x22f8('0xd2')]=_['keys'](db[_0x22f8('0xec')][_0x22f8('0x3d')]);_0x2878c3[_0x22f8('0x46')]=_[_0x22f8('0xd3')](_0x5b4ef2[_0x22f8('0x46')]);_0x2878c3[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x2878c3[_0x22f8('0xd2')],_0x2878c3['query']);_0x29fb19[_0x22f8('0x4b')]=_[_0x22f8('0xd6')](_0x2878c3[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x5b4ef2[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x29fb19[_0x22f8('0x4b')]=_0x29fb19[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x29fb19[_0x22f8('0x4b')]:_0x2878c3[_0x22f8('0xd2')];_0x29fb19[_0x22f8('0xd8')]=qs['sort'](_0x5b4ef2['query'][_0x22f8('0xd9')]);_0x29fb19[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x5b4ef2['query'],_0x2878c3[_0x22f8('0xd5')]));if(_0x5b4ef2[_0x22f8('0x46')]['filter']){_0x29fb19[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0x29fb19[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x29fb19[_0x22f8('0x4b')],function(_0x52eadf){var _0x45a2a2={};_0x45a2a2[_0x52eadf]={'$like':'%'+_0x5b4ef2['query'][_0x22f8('0x34')]+'%'};return _0x45a2a2;})});}_0x29fb19=_[_0x22f8('0x5c')]({},_0x29fb19,_0x5b4ef2[_0x22f8('0x5d')]);return _0x1ca0d5[_0x22f8('0xed')](_0x29fb19);}})[_0x22f8('0x20')](function(_0x3b9108){if(_0x3b9108){_0x413268=_0x3b9108[_0x22f8('0x4f')];if(!_0x5b4ef2[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x29fb19['limit']=qs['limit'](_0x5b4ef2[_0x22f8('0x46')][_0x22f8('0x1d')]);_0x29fb19['offset']=qs[_0x22f8('0x1a')](_0x5b4ef2[_0x22f8('0x46')][_0x22f8('0x1a')]);}return _0x1ca0d5['getWhatsappInteractions'](_0x29fb19);}})[_0x22f8('0x20')](function(_0x546acf){if(_0x546acf){return _0x546acf?{'count':_0x413268,'rows':_0x546acf}:null;}})[_0x22f8('0x20')](respondWithResult(_0x5b7c83,null))['catch'](handleError(_0x5b7c83,null));};exports[_0x22f8('0xee')]=function(_0x36fec1,_0x21945d,_0x48dabc){var _0x5155a8;var _0x49b01c;var _0x3c45eb;var _0xfa6d87=!_[_0x22f8('0x6b')](_0x36fec1[_0x22f8('0x59')]['id'])?_0x36fec1['params']['id']:!_['isNil'](_0x36fec1[_0x22f8('0x31')]['id'])?_0x36fec1['user']['id']:null;return db['User'][_0x22f8('0x37')]({'where':{'id':_0xfa6d87,'role':{'$or':[_0x22f8('0x30'),_0x22f8('0x31'),'agent']}},'attributes':['id',_0x22f8('0x38'),_0x22f8('0xef'),_0x22f8('0xf0'),_0x22f8('0x2b'),_0x22f8('0x66'),'loginInPause']})[_0x22f8('0x20')](function(_0x2c8381){if(_0x2c8381){if(_0x2c8381[_0x22f8('0x2b')]===_0x22f8('0x2c')){_0x5155a8=_0x2c8381;if(_0x36fec1[_0x22f8('0x61')][_0x22f8('0xa2')]){_0x3c45eb=util[_0x22f8('0xab')](_0x22f8('0xf1'),_0x5155a8[_0x36fec1['body']['interface']]);}else if(_0x36fec1[_0x22f8('0x61')][_0x22f8('0xf2')]){_0x3c45eb=util[_0x22f8('0xab')]('SIP/%s',_0x36fec1[_0x22f8('0x61')]['intrf']);}else{_0x3c45eb=util['format'](_0x22f8('0xac'),_0x5155a8[_0x22f8('0x38')]);}socket['to'](util['format'](_0x22f8('0xf3'),_0x5155a8[_0x22f8('0x38')]))[_0x22f8('0x2d')]('user:forcelogout',{'user':{'id':_0x5155a8['id'],'name':_0x5155a8[_0x22f8('0x38')]},'ip':_0x36fec1[_0x22f8('0xf4')][_0x22f8('0xf5')]||_0x36fec1[_0x22f8('0xf6')][_0x22f8('0xf7')]||_0x36fec1[_0x22f8('0xf8')][_0x22f8('0xf7')]||_0x36fec1[_0x22f8('0xf6')][_0x22f8('0xf8')][_0x22f8('0xf7')]});return db[_0x22f8('0xad')]['destroy']({'where':{'membername':_0x5155a8['name']},'individualHooks':!![]});}}else{throw new db[(_0x22f8('0x95'))][(_0x22f8('0x96'))](_0x22f8('0xf9'));}})['then'](function(){if(_0x5155a8){return _0x5155a8[_0x22f8('0xfa')]({'raw':!![]});}})[_0x22f8('0x20')](function(_0x4c81bd){if(_0x5155a8){if(_0x4c81bd){_0x49b01c=_0x4c81bd;if(_0x49b01c[_0x22f8('0x4f')]){var _0x1a393c=_0x49b01c[_0x22f8('0x3e')](function(_0x379521){var _0x350e15={'membername':_0x5155a8['name'],'UserId':_0x5155a8['id'],'queue_name':_0x379521['name'],'VoiceQueueId':_0x379521['id'],'interface':_0x3c45eb,'paused':_0x5155a8[_0x22f8('0xa0')]||![],'penalty':_0x379521[_0x22f8('0xfb')]||0x0};return db['UserVoiceQueueRt'][_0x22f8('0xae')](_0x350e15);});return Promise['all'](_0x1a393c);}}}})[_0x22f8('0x20')](function(){if(_0x5155a8){return db[_0x22f8('0xfc')][_0x22f8('0x4d')]({'where':{'membername':_0x5155a8[_0x22f8('0x38')],'exitAt':null}});}})[_0x22f8('0x20')](function(_0x1d033f){if(_0x5155a8){var _0x1be8e1=[];_0x1d033f['forEach'](function(_0x16a3aa){_0x1be8e1[_0x22f8('0x4c')](_0x16a3aa[_0x22f8('0x2a')]({'exitAt':moment()[_0x22f8('0xab')](_0x22f8('0xfd'))}));});return Promise[_0x22f8('0x56')](_0x1be8e1);}})[_0x22f8('0x20')](function(){if(_0x5155a8){var _0x1b7020=[];var _0x285b3e=[];var _0x4d63b0=utils[_0x22f8('0xfe')]();var _0x4d8c8d={'membername':_0x5155a8[_0x22f8('0x38')],'interface':_0x3c45eb,'enterAt':moment()['format'](_0x22f8('0xfd')),'role':_0x5155a8[_0x22f8('0x2b')],'internal':_0x5155a8[_0x22f8('0x66')]};_0x4d63b0[_0x22f8('0xff')](function(_0xc26ab6){_0x1b7020[_0x22f8('0x4c')](_['merge']({'channel':_0xc26ab6,'type':'LOGIN','data1':_0x36fec1[_0x22f8('0x61')][_0x22f8('0x100')],'data2':_0x3c45eb},_0x4d8c8d));if(_0x5155a8[_0x22f8('0xa0')]){_0x285b3e[_0x22f8('0x4c')](_['merge']({'channel':_0xc26ab6,'type':'PAUSE','data1':_0x22f8('0x101')},_0x4d8c8d));}});return db[_0x22f8('0xfc')][_0x22f8('0x8d')](_0x1b7020[_0x22f8('0x102')](_0x285b3e),{'individualHooks':!![]});}})['then'](function(){if(_0x5155a8){return _0x5155a8['update']({'online':!![],'lastLoginAt':moment()['format'](_0x22f8('0xfd')),'voicePause':_0x5155a8['loginInPause']||![],'mailPause':_0x5155a8[_0x22f8('0xa0')]||![],'chatPause':_0x5155a8['loginInPause']||![],'faxPause':_0x5155a8[_0x22f8('0xa0')]||![],'smsPause':_0x5155a8[_0x22f8('0xa0')]||![],'openchannelPause':_0x5155a8[_0x22f8('0xa0')]||![],'whatsappPause':_0x5155a8[_0x22f8('0xa0')]||![],'pauseType':_0x5155a8[_0x22f8('0xa0')]?'LOGININPAUSE':null,'interface':_0x3c45eb,'lastPauseAt':moment()[_0x22f8('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x22f8('0x20')](function(_0x5767e2){if(_0x36fec1[_0x22f8('0x103')]){return _0x48dabc();}else{return Promise['resolve'](_0x5767e2)[_0x22f8('0x20')](respondWithResult(_0x21945d,null));}})['catch'](handleError(_0x21945d,null));};exports[_0x22f8('0x104')]=function(_0x44958d,_0x38b705){var _0x2fd14c;return db[_0x22f8('0x5e')]['find']({'where':{'id':_0x44958d[_0x22f8('0x59')]['id'],'role':_0x22f8('0x2c')},'attributes':['id','name',_0x22f8('0x2b')]})[_0x22f8('0x20')](handleEntityNotFound(_0x38b705,null))[_0x22f8('0x20')](function(_0xcd05ac){if(_0xcd05ac){_0x2fd14c=_0xcd05ac;return db[_0x22f8('0xad')][_0x22f8('0x2e')]({'where':{'membername':_0x2fd14c[_0x22f8('0x38')]},'individualHooks':!![]});}})[_0x22f8('0x20')](function(){return db[_0x22f8('0xfc')]['findAll']({'where':{'membername':_0x2fd14c[_0x22f8('0x38')],'exitAt':null}});})[_0x22f8('0x20')](function(_0x4df711){var _0x5a6ec6=[];_0x4df711['forEach'](function(_0x4d37f6){_0x5a6ec6[_0x22f8('0x4c')](_0x4d37f6[_0x22f8('0x2a')]({'exitAt':moment()[_0x22f8('0xab')](_0x22f8('0xfd'))}));});return Promise[_0x22f8('0x56')](_0x5a6ec6);})[_0x22f8('0x20')](function(){return _0x2fd14c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x22f8('0x20')](respondWithResult(_0x38b705,null))[_0x22f8('0x57')](handleError(_0x38b705,null));};exports[_0x22f8('0x105')]=function(_0x330df5,_0x2f801d){var _0x5235b4;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x330df5[_0x22f8('0x59')]['id']},'individualHooks':!![]})[_0x22f8('0x20')](function(){return db[_0x22f8('0x5e')][_0x22f8('0x37')]({'where':{'id':_0x330df5[_0x22f8('0x59')]['id'],'role':_0x22f8('0x2c')},'attributes':['id',_0x22f8('0x38'),_0x22f8('0x2b'),_0x22f8('0x66'),_0x22f8('0xa2'),_0x22f8('0x9f')]});})[_0x22f8('0x20')](handleEntityNotFound(_0x2f801d,null))['then'](function(_0x30206b){if(_0x30206b){_0x5235b4=_0x30206b;return respondWithRpcPromise(_0x22f8('0x106'),_0x22f8('0x105'),{'id':_0x5235b4['id'],'name':_0x5235b4[_0x22f8('0x38')],'pause':!![]});}})[_0x22f8('0x20')](function(){if(_0x5235b4){return db[_0x22f8('0xfc')]['findAll']({'where':{'membername':_0x5235b4[_0x22f8('0x38')],'type':_0x22f8('0x107'),'exitAt':null}});}})['then'](function(_0xe79a9){if(_0xe79a9[_0x22f8('0x4f')]){var _0x1de6e5=moment()[_0x22f8('0xab')](_0x22f8('0xfd'));for(var _0x194fc8=0x0,_0x47b4e3=_0xe79a9[_0x22f8('0x4f')];_0x194fc8<_0x47b4e3;_0x194fc8++){_0xe79a9[_0x194fc8]['updateAttributes']({'exitAt':_0x1de6e5});}}})['then'](function(){var _0x3fcbde=[];var _0x379575=utils[_0x22f8('0xfe')]();_0x379575[_0x22f8('0xff')](function(_0x4b5b46){_0x3fcbde[_0x22f8('0x4c')]({'channel':_0x4b5b46,'membername':_0x5235b4[_0x22f8('0x38')],'interface':_[_0x22f8('0x6b')](_0x5235b4[_0x22f8('0xa2')])?util[_0x22f8('0xab')]('SIP/%s',_0x5235b4[_0x22f8('0x38')]):_0x5235b4[_0x22f8('0xa2')],'type':_0x22f8('0x107'),'enterAt':moment()[_0x22f8('0xab')](_0x22f8('0xfd')),'data1':_0x330df5[_0x22f8('0x61')][_0x22f8('0x3f')]||_0x22f8('0x108'),'role':_0x5235b4['role'],'internal':_0x5235b4[_0x22f8('0x66')]});});return db['MemberReport'][_0x22f8('0x8d')](_0x3fcbde,{'individualHooks':!![]});})[_0x22f8('0x20')](function(){return _0x5235b4[_0x22f8('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x330df5[_0x22f8('0x61')][_0x22f8('0x3f')]||_0x22f8('0x108'),'lastPauseAt':moment()['format'](_0x22f8('0xfd'))});})[_0x22f8('0x20')](respondWithResult(_0x2f801d,null))[_0x22f8('0x57')](handleError(_0x2f801d,null));};exports['unpause']=function(_0x22293a,_0x2205eb){if(_0x22293a[_0x22f8('0x61')]['channel']&&!utils['isValidChannel'](_0x22293a['body'][_0x22f8('0x9e')])){throw new APIBadRequestError(util[_0x22f8('0xab')](_0x22f8('0x109'),_0x22293a['body'][_0x22f8('0x9e')]));}return db[_0x22f8('0x5e')]['find']({'where':{'id':_0x22293a['params']['id']},'attributes':['id','name','role',_0x22f8('0x66'),_0x22f8('0xa2'),_0x22f8('0x9f'),'voicePause',_0x22f8('0x10a'),'chatPause',_0x22f8('0x10b'),_0x22f8('0x10c'),_0x22f8('0x10d'),_0x22f8('0x10e'),_0x22f8('0x10f'),_0x22f8('0x110')]})[_0x22f8('0x20')](function(_0x12a8ab){if(!_0x12a8ab){throw new APINotFoundError(util[_0x22f8('0xab')]('User\x20with\x20id\x20%s\x20not\x20found',_0x22293a[_0x22f8('0x59')]['id']));}return _0x12a8ab[_0x22f8('0x111')](_0x22293a[_0x22f8('0x61')]['channel']);})[_0x22f8('0x20')](respondWithResult(_0x2205eb,null))[_0x22f8('0x57')](APIHandleError(_0x2205eb));};exports['getTeams']=function(_0x43ccff,_0x52898d){var _0x4cae0f={};var _0x1a9f9f={};var _0x1b7b40;var _0x580d03;return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x43ccff[_0x22f8('0x59')]['id']}})[_0x22f8('0x20')](handleEntityNotFound(_0x52898d,null))['then'](function(_0x47f03a){if(_0x47f03a){_0x1b7b40=_0x47f03a;_0x1a9f9f[_0x22f8('0xd2')]=_['keys'](db[_0x22f8('0x112')]['rawAttributes']);_0x1a9f9f[_0x22f8('0x46')]=_['keys'](_0x43ccff[_0x22f8('0x46')]);_0x1a9f9f[_0x22f8('0xd5')]=_[_0x22f8('0xd6')](_0x1a9f9f['model'],_0x1a9f9f[_0x22f8('0x46')]);_0x4cae0f[_0x22f8('0x4b')]=_[_0x22f8('0xd6')](_0x1a9f9f[_0x22f8('0xd2')],qs['fields'](_0x43ccff[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x4cae0f[_0x22f8('0x4b')]=_0x4cae0f[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x4cae0f[_0x22f8('0x4b')]:_0x1a9f9f[_0x22f8('0xd2')];_0x4cae0f[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0x43ccff[_0x22f8('0x46')]['sort']);_0x4cae0f[_0x22f8('0x45')]=qs['filters'](_['pick'](_0x43ccff[_0x22f8('0x46')],_0x1a9f9f[_0x22f8('0xd5')]));if(_0x43ccff[_0x22f8('0x46')][_0x22f8('0x34')]){_0x4cae0f[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0x4cae0f['where'],{'$or':_[_0x22f8('0x3e')](_0x4cae0f[_0x22f8('0x4b')],function(_0x2ae0c0){var _0x3dc839={};_0x3dc839[_0x2ae0c0]={'$like':'%'+_0x43ccff[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x3dc839;})});}_0x4cae0f=_[_0x22f8('0x5c')]({},_0x4cae0f,_0x43ccff[_0x22f8('0x5d')]);return _0x1b7b40[_0x22f8('0x113')](_0x4cae0f);}})[_0x22f8('0x20')](function(_0x57a84a){if(_0x57a84a){_0x580d03=_0x57a84a['length'];if(!_0x43ccff[_0x22f8('0x46')][_0x22f8('0xdb')](_0x22f8('0xdc'))){_0x4cae0f[_0x22f8('0x1d')]=qs[_0x22f8('0x1d')](_0x43ccff['query'][_0x22f8('0x1d')]);_0x4cae0f[_0x22f8('0x1a')]=qs[_0x22f8('0x1a')](_0x43ccff[_0x22f8('0x46')][_0x22f8('0x1a')]);}return _0x1b7b40[_0x22f8('0x113')](_0x4cae0f);}})[_0x22f8('0x20')](function(_0x1c8e3b){if(_0x1c8e3b){return _0x1c8e3b?{'count':_0x580d03,'rows':_0x1c8e3b}:null;}})[_0x22f8('0x20')](respondWithResult(_0x52898d,null))[_0x22f8('0x57')](handleError(_0x52898d,null));};exports[_0x22f8('0x114')]=function(_0x47f4c1,_0x1fb7d0){var _0x1fb8bc=_0x47f4c1['params']['id'];var _0x49e087=_0x47f4c1[_0x22f8('0x61')]?_0x47f4c1[_0x22f8('0x61')][_0x22f8('0x64')]:null;var _0x37be34=[];return Promise[_0x22f8('0x115')]()[_0x22f8('0x20')](function(){if(!_0x49e087)throw new APIBadRequestError(_0x22f8('0x116'));})[_0x22f8('0x20')](function(){return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x1fb8bc}});})['then'](function(_0x14e240){if(!_0x14e240)throw new APINotFoundError(util['format'](_0x22f8('0xca'),_0x47f4c1[_0x22f8('0x59')]['id']));return db[_0x22f8('0x6d')][_0x22f8('0x117')](function(_0x1a96e8){return _0x14e240['addTeams'](_0x49e087,{'transaction':_0x1a96e8})[_0x22f8('0x20')](function(){return db[_0x22f8('0x112')][_0x22f8('0x4d')]({'where':{'id':{'$in':_0x49e087}}});})['then'](function(_0x46e33a){var _0xb3be3=_[_0x22f8('0x3e')](_0x46e33a,function(_0x26249a){return _0x26249a[_0x22f8('0x118')]();});return Promise['all'](_0xb3be3);})['then'](function(_0x28d1b3){_0x37be34=_[_0x22f8('0x119')](_0x28d1b3);var _0x84a057=_['map'](_0x37be34,function(_0x5edd00){return _0x5edd00[_0x22f8('0x11a')](_0x14e240['id'],{'transaction':_0x1a96e8});});return Promise[_0x22f8('0x56')](_0x84a057);})[_0x22f8('0x20')](function(){if(!_0x14e240[_0x22f8('0x9f')])return;var _0x5d5890=_[_0x22f8('0x34')](_0x37be34,function(_0x2ca051){return _0x2ca051['getDataValue'](_0x22f8('0x9e'))==='Voice';});var _0x535dad=_[_0x22f8('0x3e')](_0x5d5890,function(_0x2057b8){return db[_0x22f8('0xad')]['upsert']({'membername':_0x14e240[_0x22f8('0x38')],'UserId':_0x14e240['id'],'queue_name':_0x2057b8[_0x22f8('0x38')],'VoiceQueueId':_0x2057b8['id'],'interface':_['isNil'](_0x14e240[_0x22f8('0xa2')])?util[_0x22f8('0xab')](_0x22f8('0xac'),_0x14e240['name']):_0x14e240[_0x22f8('0xa2')],'paused':_0x14e240[_0x22f8('0xa1')]||![],'penalty':_0x14e240[_0x22f8('0xa4')]},{'transaction':_0x1a96e8});});return Promise[_0x22f8('0x56')](_0x535dad);})[_0x22f8('0x20')](function(){return db[_0x22f8('0x11b')]['findAll']({'where':{'teamId':{'$in':_0x49e087}}});})['then'](function(_0x5d4ac6){var _0x15c945=_[_0x22f8('0x3e')](_0x5d4ac6,function(_0x37aa6e){return db[_0x22f8('0x11c')][_0x22f8('0x82')]({'UserId':_0x14e240['id'],'VoicePrefixId':_0x37aa6e['VoicePrefixId']},{'transaction':_0x1a96e8});});return Promise[_0x22f8('0x56')](_0x15c945);});});})[_0x22f8('0x20')](function(){for(var _0x3d5e5d=0x0;_0x3d5e5d<_0x37be34[_0x22f8('0x4f')];_0x3d5e5d++){var _0x496589=_0x37be34[_0x3d5e5d]['getDataValue'](_0x22f8('0x9e'));var _0x4033eb=_0x496589+'QueueId';socket['emit'](_0x22f8('0x31')+_0x496589+_0x22f8('0xa8'),{'UserId':_0x1fb8bc,['queueField']:_0x37be34[_0x3d5e5d]['id']});}})[_0x22f8('0x20')](respondWithStatusCode(_0x1fb7d0,null))['catch'](APIHandleError(_0x1fb7d0));};exports[_0x22f8('0x11d')]=function(_0x273f7c,_0x4e3b9a){var _0x151544=_0x273f7c[_0x22f8('0x59')]['id'];var _0x3ee200=null;if(_0x273f7c[_0x22f8('0x46')][_0x22f8('0x64')]){_0x3ee200=_[_0x22f8('0xb2')](_0x273f7c['query'][_0x22f8('0x64')])?_0x273f7c[_0x22f8('0x46')][_0x22f8('0x64')]:[_0x273f7c[_0x22f8('0x46')]['ids']];}var _0x7a0515=[];return Promise[_0x22f8('0x115')]()['then'](function(){if(!_0x3ee200)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x22f8('0x20')](function(){return db[_0x22f8('0x5e')]['findOne']({'where':{'id':_0x151544}});})[_0x22f8('0x20')](function(_0x34e59b){if(!_0x34e59b)throw new APINotFoundError(util[_0x22f8('0xab')](_0x22f8('0xca'),_0x273f7c['params']['id']));return db[_0x22f8('0x6d')]['transaction'](function(_0x300d02){return _0x34e59b[_0x22f8('0x11d')](_0x3ee200,{'transaction':_0x300d02})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x3ee200}}});})[_0x22f8('0x20')](function(_0x7709ab){var _0x46ee48=_['map'](_0x7709ab,function(_0x23e8e8){return _0x23e8e8[_0x22f8('0x118')]();});return Promise[_0x22f8('0x56')](_0x46ee48);})[_0x22f8('0x20')](function(_0x51fa2a){_0x7a0515=_[_0x22f8('0x119')](_0x51fa2a);var _0x9c15ba=_[_0x22f8('0x3e')](_0x7a0515,function(_0x1a18f9){return _0x1a18f9[_0x22f8('0x11e')](_0x34e59b['id'],{'transaction':_0x300d02});});return Promise['all'](_0x9c15ba);})['then'](function(){if(!_0x34e59b[_0x22f8('0x9f')])return;var _0x1ce6c6=_[_0x22f8('0x34')](_0x7a0515,function(_0x5ad7f7){return _0x5ad7f7['getDataValue'](_0x22f8('0x9e'))===_0x22f8('0x11f');});var _0x14ad1f=_[_0x22f8('0x3e')](_0x1ce6c6,function(_0x5f09c7){return db['UserVoiceQueueRt'][_0x22f8('0x2e')]({'where':{'VoiceQueueId':_0x5f09c7['id'],'UserId':_0x34e59b['id']},'transaction':_0x300d02});});return Promise[_0x22f8('0x56')](_0x14ad1f);})[_0x22f8('0x20')](function(){return db[_0x22f8('0x11b')][_0x22f8('0x4d')]({'where':{'teamId':{'$in':_0x3ee200}}});})['then'](function(_0xe09e8){var _0x3f6112=_['map'](_0xe09e8,function(_0x4ea707){return db['UserVoicePrefix'][_0x22f8('0x2e')]({'where':{'UserId':_0x34e59b['id'],'VoicePrefixId':_0x4ea707[_0x22f8('0x120')]}},{'transaction':_0x300d02});});return Promise[_0x22f8('0x56')](_0x3f6112);});});})['then'](function(){for(var _0x4602e5=0x0;_0x4602e5<_0x7a0515[_0x22f8('0x4f')];_0x4602e5++){var _0x2ea611=_0x7a0515[_0x4602e5][_0x22f8('0x121')](_0x22f8('0x9e'));var _0x40ab96=_0x2ea611+_0x22f8('0xa6');socket[_0x22f8('0x2d')](_0x22f8('0x31')+_0x2ea611+'Queue:remove',{'UserId':_0x151544,['queueField']:_0x7a0515[_0x4602e5]['id']});}})[_0x22f8('0x20')](respondWithStatusCode(_0x4e3b9a,null))['catch'](APIHandleError(_0x4e3b9a));};exports[_0x22f8('0x122')]=function(_0x5693db,_0x1b81fd){var _0x25feba={};var _0x2f800a={};var _0x40261c;var _0x1abbc2;return db[_0x22f8('0x5e')][_0x22f8('0x9a')]({'where':{'id':_0x5693db[_0x22f8('0x59')]['id']}})['then'](handleEntityNotFound(_0x1b81fd,null))[_0x22f8('0x20')](function(_0x1090ad){if(_0x1090ad){_0x40261c=_0x1090ad;_0x2f800a['model']=_[_0x22f8('0xd3')](db['CmList']['rawAttributes']);_0x2f800a[_0x22f8('0x46')]=_[_0x22f8('0xd3')](_0x5693db[_0x22f8('0x46')]);_0x2f800a['filters']=_[_0x22f8('0xd6')](_0x2f800a[_0x22f8('0xd2')],_0x2f800a[_0x22f8('0x46')]);_0x25feba[_0x22f8('0x4b')]=_[_0x22f8('0xd6')](_0x2f800a['model'],qs[_0x22f8('0xd7')](_0x5693db[_0x22f8('0x46')][_0x22f8('0xd7')]));_0x25feba['attributes']=_0x25feba[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0x25feba[_0x22f8('0x4b')]:_0x2f800a[_0x22f8('0xd2')];_0x25feba[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0x5693db[_0x22f8('0x46')][_0x22f8('0xd9')]);_0x25feba[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x5693db[_0x22f8('0x46')],_0x2f800a['filters']));if(_0x5693db[_0x22f8('0x46')]['filter']){_0x25feba[_0x22f8('0x45')]=_['merge'](_0x25feba[_0x22f8('0x45')],{'$or':_[_0x22f8('0x3e')](_0x25feba[_0x22f8('0x4b')],function(_0x5d3ed7){var _0x5e30b6={};_0x5e30b6[_0x5d3ed7]={'$like':'%'+_0x5693db[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x5e30b6;})});}_0x25feba=_[_0x22f8('0x5c')]({},_0x25feba,_0x5693db[_0x22f8('0x5d')]);return _0x40261c[_0x22f8('0x122')](_0x25feba);}})[_0x22f8('0x20')](function(_0x280f1f){if(_0x280f1f){_0x1abbc2=_0x280f1f['length'];if(!_0x5693db['query'][_0x22f8('0xdb')]('nolimit')){_0x25feba[_0x22f8('0x1d')]=qs['limit'](_0x5693db['query'][_0x22f8('0x1d')]);_0x25feba[_0x22f8('0x1a')]=qs['offset'](_0x5693db[_0x22f8('0x46')][_0x22f8('0x1a')]);}return _0x40261c[_0x22f8('0x122')](_0x25feba);}})[_0x22f8('0x20')](function(_0x224163){if(_0x224163){return _0x224163?{'count':_0x1abbc2,'rows':_0x224163}:null;}})[_0x22f8('0x20')](respondWithResult(_0x1b81fd,null))[_0x22f8('0x57')](handleError(_0x1b81fd,null));};exports[_0x22f8('0x123')]=function(_0x2a4281,_0x1c8375){var _0xdc9f5e={};var _0x158f57={};var _0x336c4c;return db['User'][_0x22f8('0x9a')]({'where':{'id':_0x2a4281[_0x22f8('0x59')]['id']}})['then'](handleEntityNotFound(_0x1c8375,null))[_0x22f8('0x20')](function(_0x48f5a0){if(_0x48f5a0){_0x336c4c=_0x48f5a0;_0x158f57[_0x22f8('0xd2')]=_['keys'](db[_0x22f8('0x5e')][_0x22f8('0x3d')]);_0x158f57['query']=_[_0x22f8('0xd3')](_0x2a4281[_0x22f8('0x46')]);_0x158f57['filters']=_[_0x22f8('0xd6')](_0x158f57['model'],_0x158f57[_0x22f8('0x46')]);_0xdc9f5e['attributes']=_[_0x22f8('0xd6')](_0x158f57[_0x22f8('0xd2')],qs[_0x22f8('0xd7')](_0x2a4281[_0x22f8('0x46')][_0x22f8('0xd7')]));_0xdc9f5e[_0x22f8('0x4b')]=_0xdc9f5e[_0x22f8('0x4b')][_0x22f8('0x4f')]?_0xdc9f5e[_0x22f8('0x4b')]:_0x158f57[_0x22f8('0xd2')];_0xdc9f5e[_0x22f8('0xd8')]=qs[_0x22f8('0xd9')](_0x2a4281[_0x22f8('0x46')][_0x22f8('0xd9')]);_0xdc9f5e[_0x22f8('0x45')]=qs[_0x22f8('0xd5')](_[_0x22f8('0xde')](_0x2a4281[_0x22f8('0x46')],_0x158f57[_0x22f8('0xd5')]));if(_0x2a4281[_0x22f8('0x46')]['filter']){_0xdc9f5e[_0x22f8('0x45')]=_[_0x22f8('0x5c')](_0xdc9f5e['where'],{'$or':_[_0x22f8('0x3e')](_0xdc9f5e[_0x22f8('0x4b')],function(_0x312a93){var _0x1e2701={};_0x1e2701[_0x312a93]={'$like':'%'+_0x2a4281[_0x22f8('0x46')][_0x22f8('0x34')]+'%'};return _0x1e2701;})});}_0xdc9f5e['model']=db[_0x22f8('0x5e')];_0xdc9f5e['as']=_0x22f8('0x8a');_0xdc9f5e=_['merge']({},_0xdc9f5e,_0x2a4281[_0x22f8('0x5d')]);return _0x336c4c[_0x22f8('0xfa')]({'include':[_0xdc9f5e]});}})[_0x22f8('0x20')](function(_0x3e8086){if(_0x3e8086){var _0x4fa7cf={},_0x285d3a=[];for(var _0x530637=0x0;_0x530637<_0x3e8086[_0x22f8('0x4f')];_0x530637+=0x1){for(var _0xfab63c=0x0,_0x10dda7;_0xfab63c<_0x3e8086[_0x530637][_0x22f8('0x8a')]['length'];_0xfab63c+=0x1){_0x10dda7=_0x3e8086[_0x530637]['Agents'][_0xfab63c][_0x22f8('0x2f')]({'plain':!![]});_0x4fa7cf[_0x10dda7['id']]=_0x10dda7;}}_0x4fa7cf=_[_0x22f8('0x124')](_0x4fa7cf);for(var _0x58f99e=qs[_0x22f8('0x1a')](_0x2a4281['query'][_0x22f8('0x1a')]);_0x58f99e<_0x4fa7cf['length']&&_0x285d3a[_0x22f8('0x4f')]=_0x224833[_0xa087('0x4a')]){throw new Error(_0xa087('0x4b'));}})[_0xa087('0x1c')](function(){if(_0x4a2784){return db[_0xa087('0x23')][_0xa087('0x4c')]({'where':{'membername':_0x4a2784[_0xa087('0x1f')]},'individualHooks':!![]});}})[_0xa087('0x1c')](function(){if(_0x4a2784){return _0x4a2784[_0xa087('0x4d')]({'raw':!![]});}})[_0xa087('0x1c')](function(_0x202b5e){if(_0x4a2784){if(_0x202b5e){var _0x483fb5=[];_0x2a90e6=_0x202b5e;if(_0x2a90e6[_0xa087('0x43')]){for(var _0x257048=0x0;_0x257048<_0x2a90e6[_0xa087('0x43')];_0x257048++){_0x483fb5[_0xa087('0x29')](db[_0xa087('0x23')][_0xa087('0x4e')]({'membername':_0x4a2784['name'],'UserId':_0x4a2784['id'],'queue_name':_0x2a90e6[_0x257048]['name'],'VoiceQueueId':_0x2a90e6[_0x257048]['id'],'interface':_0x13c8f7,'paused':_0x4a2784['loginInPause']||![],'penalty':_0x2a90e6[_0x257048][_0xa087('0x4f')]||0x0}));}return BPromise[_0xa087('0x44')](_0x483fb5);}}}})[_0xa087('0x1c')](function(){if(_0x4a2784){return db[_0xa087('0x33')][_0xa087('0x25')]({'where':{'membername':_0x4a2784[_0xa087('0x1f')],'exitAt':null}});}})[_0xa087('0x1c')](function(_0x3030d5){if(_0x4a2784){if(_0x3030d5&&_0x3030d5[_0xa087('0x43')]){var _0xb0459e=[];_0x3030d5[_0xa087('0x28')](function(_0x2d4a16){_0xb0459e[_0xa087('0x29')](_0x2d4a16['update']({'exitAt':moment()[_0xa087('0x2b')](_0xa087('0x26'))}));});return BPromise[_0xa087('0x44')](_0xb0459e);}}})['then'](function(){if(_0x4a2784){var _0x1f9d78=[];var _0x43cabf=[];var _0x59474c=utils[_0xa087('0x27')]();var _0xc566a5={'membername':_0x4a2784[_0xa087('0x1f')],'interface':_0x13c8f7,'enterAt':moment()[_0xa087('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4a2784[_0xa087('0x20')],'internal':_0x4a2784[_0xa087('0x31')]};_0x59474c[_0xa087('0x28')](function(_0x87d7f2){_0x1f9d78[_0xa087('0x29')](_[_0xa087('0x50')]({'channel':_0x87d7f2,'type':_0xa087('0x51'),'data1':'callysquare','data2':_0x13c8f7},_0xc566a5));if(_0x4a2784[_0xa087('0x47')]){_0x43cabf[_0xa087('0x29')](_[_0xa087('0x50')]({'channel':_0x87d7f2,'type':_0xa087('0x2d'),'data1':'LOGININPAUSE'},_0xc566a5));}});return db['MemberReport']['bulkCreate'](_0x1f9d78[_0xa087('0x52')](_0x43cabf),{'individualHooks':!![]});}})[_0xa087('0x1c')](function(){if(_0x4a2784){return _0x4a2784[_0xa087('0x24')]({'online':!![],'lastLoginAt':moment()[_0xa087('0x2b')](_0xa087('0x26')),'voicePause':_0x4a2784[_0xa087('0x47')]||![],'mailPause':_0x4a2784[_0xa087('0x47')]||![],'chatPause':_0x4a2784[_0xa087('0x47')]||![],'faxPause':_0x4a2784[_0xa087('0x47')]||![],'smsPause':_0x4a2784['loginInPause']||![],'openchannelPause':_0x4a2784[_0xa087('0x47')]||![],'pauseType':_0x4a2784['loginInPause']?_0xa087('0x53'):null,'lastPauseAt':moment()['format'](_0xa087('0x26')),'interface':_0x13c8f7});}})[_0xa087('0x1c')](function(_0x2da25f){_0x30dd36(_0x2da25f);})['catch'](function(_0x50cc47){_0x27243b(_0x4f029c['error'](0x1f4,_0x50cc47[_0xa087('0x1a')]));});});}; \ No newline at end of file +var _0xd3a4=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','User','findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowUser','find','PauseUser','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','SIP/%s','body','DEFAULT\x20PAUSE','bulkCreate','type','resolve','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','online','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','findOne','all','LoginUser','role','mobile','phone','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','UserVoiceQueue.penalty','getChannels','merge','loginInPause','PAUSE','LOGININPAUSE','lodash','util','moment'];(function(_0xbfb2ee,_0x317b2d){var _0x390f2e=function(_0x1f6783){while(--_0x1f6783){_0xbfb2ee['push'](_0xbfb2ee['shift']());}};_0x390f2e(++_0x317b2d);}(_0xd3a4,0xad));var _0x4d3a=function(_0x4165f1,_0xe35e6b){_0x4165f1=_0x4165f1-0x0;var _0xbe88a3=_0xd3a4[_0x4165f1];return _0xbe88a3;};'use strict';var _=require(_0x4d3a('0x0'));var util=require(_0x4d3a('0x1'));var moment=require(_0x4d3a('0x2'));var BPromise=require(_0x4d3a('0x3'));var Redis=require(_0x4d3a('0x4'));var db=require(_0x4d3a('0x5'))['db'];var utils=require(_0x4d3a('0x6'));var logger=require('../../config/logger')(_0x4d3a('0x7'));var config=require(_0x4d3a('0x8'));config[_0x4d3a('0x9')]=_[_0x4d3a('0xa')](config[_0x4d3a('0x9')],{'host':_0x4d3a('0xb'),'port':0x18eb});var socket=require(_0x4d3a('0xc'))(new Redis(config['redis']));require('./user.socket')[_0x4d3a('0xd')](socket);exports[_0x4d3a('0xe')]=function(_0x501972){var _0x43cc1a=this;return new Promise(function(_0x2a24e0,_0x565af7){return db[_0x4d3a('0xf')][_0x4d3a('0x10')]({'raw':_0x501972[_0x4d3a('0x11')]?_0x501972[_0x4d3a('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x501972[_0x4d3a('0x11')]?_0x501972['options'][_0x4d3a('0x12')]||null:null,'attributes':_0x501972[_0x4d3a('0x11')]?_0x501972[_0x4d3a('0x11')][_0x4d3a('0x13')]||null:null,'limit':_0x501972[_0x4d3a('0x11')]?_0x501972['options'][_0x4d3a('0x14')]||null:null,'include':_0x501972[_0x4d3a('0x11')]?_0x501972['options'][_0x4d3a('0x15')]?_[_0x4d3a('0x16')](_0x501972[_0x4d3a('0x11')][_0x4d3a('0x15')],function(_0x4b48bd){return{'model':db[_0x4b48bd[_0x4d3a('0x17')]],'as':_0x4b48bd['as'],'attributes':_0x4b48bd['attributes'],'include':_0x4b48bd[_0x4d3a('0x15')]?_[_0x4d3a('0x16')](_0x4b48bd[_0x4d3a('0x15')],function(_0x457ba6){return{'model':db[_0x457ba6[_0x4d3a('0x17')]],'as':_0x457ba6['as'],'attributes':_0x457ba6[_0x4d3a('0x13')],'include':_0x457ba6['include']?_['map'](_0x457ba6[_0x4d3a('0x15')],function(_0x4b5e2b){return{'model':db[_0x4b5e2b[_0x4d3a('0x17')]],'as':_0x4b5e2b['as'],'attributes':_0x4b5e2b[_0x4d3a('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4d3a('0x18')](function(_0x301353){logger[_0x4d3a('0x19')](_0x4d3a('0xe'),_0x501972);logger[_0x4d3a('0x1a')](_0x4d3a('0xe'),_0x501972,JSON[_0x4d3a('0x1b')](_0x301353));_0x2a24e0(_0x301353);})[_0x4d3a('0x1c')](function(_0x173fb9){logger[_0x4d3a('0x1d')](_0x4d3a('0xe'),_0x173fb9[_0x4d3a('0x1e')],_0x501972);_0x565af7(_0x43cc1a[_0x4d3a('0x1d')](0x1f4,_0x173fb9[_0x4d3a('0x1e')]));});});};exports[_0x4d3a('0x1f')]=function(_0x1142e1){var _0x30b9d3=this;return new Promise(function(_0xfafe53,_0xe66605){return db[_0x4d3a('0xf')][_0x4d3a('0x20')]({'raw':_0x1142e1[_0x4d3a('0x11')]?_0x1142e1[_0x4d3a('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x1142e1['options']?_0x1142e1[_0x4d3a('0x11')][_0x4d3a('0x12')]||null:null,'attributes':_0x1142e1[_0x4d3a('0x11')]?_0x1142e1[_0x4d3a('0x11')]['attributes']||null:null,'include':_0x1142e1['options']?_0x1142e1[_0x4d3a('0x11')][_0x4d3a('0x15')]?_['map'](_0x1142e1[_0x4d3a('0x11')][_0x4d3a('0x15')],function(_0x807484){return{'model':db[_0x807484[_0x4d3a('0x17')]],'as':_0x807484['as'],'attributes':_0x807484['attributes'],'include':_0x807484[_0x4d3a('0x15')]?_[_0x4d3a('0x16')](_0x807484[_0x4d3a('0x15')],function(_0xafd62e){return{'model':db[_0xafd62e[_0x4d3a('0x17')]],'as':_0xafd62e['as'],'attributes':_0xafd62e[_0x4d3a('0x13')],'include':_0xafd62e[_0x4d3a('0x15')]?_[_0x4d3a('0x16')](_0xafd62e[_0x4d3a('0x15')],function(_0x2eff41){return{'model':db[_0x2eff41[_0x4d3a('0x17')]],'as':_0x2eff41['as'],'attributes':_0x2eff41['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d3a('0x18')](function(_0x916d7){logger['info'](_0x4d3a('0x1f'),_0x1142e1);logger['debug']('ShowUser',_0x1142e1,JSON[_0x4d3a('0x1b')](_0x916d7));_0xfafe53(_0x916d7);})[_0x4d3a('0x1c')](function(_0x121611){logger[_0x4d3a('0x1d')](_0x4d3a('0x1f'),_0x121611[_0x4d3a('0x1e')],_0x1142e1);_0xe66605(_0x30b9d3[_0x4d3a('0x1d')](0x1f4,_0x121611[_0x4d3a('0x1e')]));});});};exports[_0x4d3a('0x21')]=function(_0x296134){var _0x58698a;return db['User'][_0x4d3a('0x20')]({'where':_0x296134['options'][_0x4d3a('0x12')]||{},'attributes':['id',_0x4d3a('0x22'),'role',_0x4d3a('0x23'),_0x4d3a('0x24')]})[_0x4d3a('0x18')](function(_0x55161b){if(!_0x55161b){throw new Error(util[_0x4d3a('0x25')](_0x4d3a('0x26'),_0x296134[_0x4d3a('0x27')]['id']));}_0x58698a=_0x55161b;return db[_0x4d3a('0x28')][_0x4d3a('0x29')]({'paused':0x1},{'where':{'UserId':_0x58698a['id']},'individualHooks':!![]});})[_0x4d3a('0x18')](function(){return db[_0x4d3a('0x2a')][_0x4d3a('0x10')]({'where':{'membername':_0x58698a[_0x4d3a('0x22')],'type':'PAUSE','exitAt':null}});})[_0x4d3a('0x18')](function(_0x159295){if(_0x159295&&_0x159295[_0x4d3a('0x2b')]){var _0xf57e57=moment()[_0x4d3a('0x25')](_0x4d3a('0x2c'));for(var _0xa31808=0x0,_0x5b6550=_0x159295['length'];_0xa31808<_0x5b6550;_0xa31808++){_0x159295[_0xa31808][_0x4d3a('0x2d')]({'exitAt':_0xf57e57});}}})[_0x4d3a('0x18')](function(){var _0x2412c2=[];var _0x39e26d=utils['getChannels']();_0x39e26d[_0x4d3a('0x2e')](function(_0x34abee){_0x2412c2[_0x4d3a('0x2f')]({'channel':_0x34abee,'membername':_0x58698a[_0x4d3a('0x22')],'interface':_['isNil'](_0x58698a[_0x4d3a('0x24')])?util[_0x4d3a('0x25')](_0x4d3a('0x30'),_0x58698a[_0x4d3a('0x22')]):_0x58698a[_0x4d3a('0x24')],'type':'PAUSE','enterAt':moment()[_0x4d3a('0x25')](_0x4d3a('0x2c')),'data1':_0x296134[_0x4d3a('0x31')]['type']||_0x4d3a('0x32'),'role':_0x58698a['role'],'internal':_0x58698a[_0x4d3a('0x23')],'uniqueid':_0x296134[_0x4d3a('0x31')]['uniqueid']||null});});return db[_0x4d3a('0x2a')][_0x4d3a('0x33')](_0x2412c2,{'individualHooks':!![]});})['then'](function(){return _0x58698a[_0x4d3a('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x296134[_0x4d3a('0x31')][_0x4d3a('0x34')]||_0x4d3a('0x32'),'lastPauseAt':moment()[_0x4d3a('0x25')](_0x4d3a('0x2c'))});})[_0x4d3a('0x1c')](function(_0xcd1593){throw _0xcd1593;});};exports['UnpauseUser']=function(_0x1a8bdb){return Promise[_0x4d3a('0x35')]()[_0x4d3a('0x18')](function(){if(_0x1a8bdb[_0x4d3a('0x31')]['channel']&&!utils[_0x4d3a('0x36')](_0x1a8bdb[_0x4d3a('0x31')]['channel'])){throw new Error(util['format'](_0x4d3a('0x37'),_0x1a8bdb[_0x4d3a('0x31')][_0x4d3a('0x38')]));}return db[_0x4d3a('0xf')]['findOne']({'where':_0x1a8bdb[_0x4d3a('0x11')]['where']||{},'attributes':['id',_0x4d3a('0x22'),'role',_0x4d3a('0x23'),_0x4d3a('0x24'),_0x4d3a('0x39'),'voicePause',_0x4d3a('0x3a'),_0x4d3a('0x3b'),_0x4d3a('0x3c'),_0x4d3a('0x3d'),_0x4d3a('0x3e'),_0x4d3a('0x3f'),_0x4d3a('0x40'),_0x4d3a('0x41')]});})[_0x4d3a('0x18')](function(_0xa5fe1d){if(!_0xa5fe1d){throw new Error(util['format'](_0x4d3a('0x26'),_0x1a8bdb[_0x4d3a('0x27')]['id']));}return _0xa5fe1d[_0x4d3a('0x42')](_0x1a8bdb['body'][_0x4d3a('0x38')],_0x4d3a('0x43'));})[_0x4d3a('0x1c')](function(_0x5e1911){throw _0x5e1911;});};exports[_0x4d3a('0x44')]=function(_0x4ba80b){var _0x49580e=this;return new Promise(function(_0x4395dd,_0x298e8a){var _0x5561d6;return db[_0x4d3a('0xf')][_0x4d3a('0x45')]({'where':_0x4ba80b['options'][_0x4d3a('0x12')]||{},'attributes':['id',_0x4d3a('0x22')]})[_0x4d3a('0x18')](function(_0x2e48cb){if(_0x2e48cb){_0x5561d6=_0x2e48cb;return db[_0x4d3a('0x28')]['destroy']({'where':{'membername':_0x5561d6['name']},'individualHooks':!![]});}})[_0x4d3a('0x18')](function(){if(_0x5561d6){return db[_0x4d3a('0x2a')][_0x4d3a('0x10')]({'where':{'membername':_0x5561d6[_0x4d3a('0x22')],'exitAt':null}});}})[_0x4d3a('0x18')](function(_0x239bf5){if(_0x5561d6){if(_0x239bf5&&_0x239bf5[_0x4d3a('0x2b')]){var _0x1b722f=[];_0x239bf5[_0x4d3a('0x2e')](function(_0x50d0b6){_0x1b722f[_0x4d3a('0x2f')](_0x50d0b6[_0x4d3a('0x29')]({'exitAt':moment()['format'](_0x4d3a('0x2c'))}));});return BPromise[_0x4d3a('0x46')](_0x1b722f);}}})[_0x4d3a('0x18')](function(){if(_0x5561d6){return _0x5561d6[_0x4d3a('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4d3a('0x18')](function(_0x539f21){_0x4395dd(_0x539f21);})[_0x4d3a('0x1c')](function(_0x3574fa){_0x298e8a(_0x49580e['error'](0x1f4,_0x3574fa[_0x4d3a('0x1e')]));});});};exports[_0x4d3a('0x47')]=function(_0x43cca4){var _0x4f3344=this;return new Promise(function(_0x53abbd,_0x18d16a){var _0x3d7c77;var _0x286adf;var _0x5f2fe7;var _0xe09ec6;return db[_0x4d3a('0xf')]['findOne']({'where':_0x43cca4[_0x4d3a('0x11')][_0x4d3a('0x12')]||{},'attributes':['id',_0x4d3a('0x22'),_0x4d3a('0x48'),_0x4d3a('0x49'),_0x4d3a('0x4a'),_0x4d3a('0x23'),'loginInPause',_0x4d3a('0x24')]})[_0x4d3a('0x18')](function(_0x1567d3){if(_0x1567d3){_0x3d7c77=_0x1567d3;_0xe09ec6=_0x43cca4[_0x4d3a('0x31')]['interface']?_0x43cca4[_0x4d3a('0x31')][_0x4d3a('0x24')]:util['format'](_0x4d3a('0x30'),_0x3d7c77['name']);return db[_0x4d3a('0xf')]['count']({'where':{'role':_0x4d3a('0x4b'),'online':!![],'id':{'$ne':_0x3d7c77['id']}}});}})[_0x4d3a('0x18')](function(_0x2b5b28){if(_0x2b5b28){_0x5f2fe7=_0x2b5b28;return require(_0x4d3a('0x4c'))[_0x4d3a('0x4d')]();}})[_0x4d3a('0x18')](function(_0xbf6483){if(_0xbf6483&&_0xbf6483[_0x4d3a('0x4e')]&&_0x5f2fe7>=_0xbf6483['agents']){throw new Error(_0x4d3a('0x4f'));}})[_0x4d3a('0x18')](function(){if(_0x3d7c77){return db[_0x4d3a('0x28')][_0x4d3a('0x50')]({'where':{'membername':_0x3d7c77[_0x4d3a('0x22')]},'individualHooks':!![]});}})['then'](function(){if(_0x3d7c77){return _0x3d7c77[_0x4d3a('0x51')]({'raw':!![]});}})[_0x4d3a('0x18')](function(_0x13778b){if(_0x3d7c77){if(_0x13778b){var _0x545a2f=[];_0x286adf=_0x13778b;if(_0x286adf['length']){for(var _0xc920bc=0x0;_0xc920bc<_0x286adf[_0x4d3a('0x2b')];_0xc920bc++){_0x545a2f[_0x4d3a('0x2f')](db[_0x4d3a('0x28')]['upsert']({'membername':_0x3d7c77['name'],'UserId':_0x3d7c77['id'],'queue_name':_0x286adf[_0xc920bc][_0x4d3a('0x22')],'VoiceQueueId':_0x286adf[_0xc920bc]['id'],'interface':_0xe09ec6,'paused':_0x3d7c77['loginInPause']||![],'penalty':_0x286adf[_0xc920bc][_0x4d3a('0x52')]||0x0}));}return BPromise['all'](_0x545a2f);}}}})[_0x4d3a('0x18')](function(){if(_0x3d7c77){return db[_0x4d3a('0x2a')][_0x4d3a('0x10')]({'where':{'membername':_0x3d7c77['name'],'exitAt':null}});}})[_0x4d3a('0x18')](function(_0x22077f){if(_0x3d7c77){if(_0x22077f&&_0x22077f[_0x4d3a('0x2b')]){var _0x32abd8=[];_0x22077f[_0x4d3a('0x2e')](function(_0x3b76b0){_0x32abd8[_0x4d3a('0x2f')](_0x3b76b0[_0x4d3a('0x29')]({'exitAt':moment()[_0x4d3a('0x25')](_0x4d3a('0x2c'))}));});return BPromise[_0x4d3a('0x46')](_0x32abd8);}}})[_0x4d3a('0x18')](function(){if(_0x3d7c77){var _0x391874=[];var _0x27b3c5=[];var _0x349530=utils[_0x4d3a('0x53')]();var _0x1d3a9d={'membername':_0x3d7c77[_0x4d3a('0x22')],'interface':_0xe09ec6,'enterAt':moment()[_0x4d3a('0x25')](_0x4d3a('0x2c')),'role':_0x3d7c77[_0x4d3a('0x48')],'internal':_0x3d7c77[_0x4d3a('0x23')]};_0x349530['forEach'](function(_0x29a95a){_0x391874['push'](_[_0x4d3a('0x54')]({'channel':_0x29a95a,'type':'LOGIN','data1':'callysquare','data2':_0xe09ec6},_0x1d3a9d));if(_0x3d7c77[_0x4d3a('0x55')]){_0x27b3c5['push'](_[_0x4d3a('0x54')]({'channel':_0x29a95a,'type':_0x4d3a('0x56'),'data1':_0x4d3a('0x57')},_0x1d3a9d));}});return db[_0x4d3a('0x2a')][_0x4d3a('0x33')](_0x391874['concat'](_0x27b3c5),{'individualHooks':!![]});}})[_0x4d3a('0x18')](function(){if(_0x3d7c77){return _0x3d7c77['update']({'online':!![],'lastLoginAt':moment()[_0x4d3a('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3d7c77['loginInPause']||![],'mailPause':_0x3d7c77['loginInPause']||![],'chatPause':_0x3d7c77[_0x4d3a('0x55')]||![],'faxPause':_0x3d7c77[_0x4d3a('0x55')]||![],'smsPause':_0x3d7c77[_0x4d3a('0x55')]||![],'openchannelPause':_0x3d7c77[_0x4d3a('0x55')]||![],'pauseType':_0x3d7c77[_0x4d3a('0x55')]?_0x4d3a('0x57'):null,'lastPauseAt':moment()[_0x4d3a('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xe09ec6});}})[_0x4d3a('0x18')](function(_0x5f537e){_0x53abbd(_0x5f537e);})[_0x4d3a('0x1c')](function(_0x15e601){_0x18d16a(_0x4f3344[_0x4d3a('0x1d')](0x1f4,_0x15e601['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0ea83ee..2f547dd 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 _0xf7ed=['save','remove','removeListener','register','length','user:'];(function(_0x1ab469,_0x21c8a2){var _0x3574b3=function(_0x469c21){while(--_0x469c21){_0x1ab469['push'](_0x1ab469['shift']());}};_0x3574b3(++_0x21c8a2);}(_0xf7ed,0x1ec));var _0xdf7e=function(_0x2ff4b9,_0x5d2705){_0x2ff4b9=_0x2ff4b9-0x0;var _0x258ce5=_0xf7ed[_0x2ff4b9];return _0x258ce5;};'use strict';var UserEvents=require('./user.events');var events=[_0xdf7e('0x0'),_0xdf7e('0x1'),'update'];function createListener(_0x5a0c0d,_0x528538){return function(_0xf101a3){_0x528538['emit'](_0x5a0c0d,_0xf101a3);};}function removeListener(_0x3c1161,_0x265763){return function(){UserEvents[_0xdf7e('0x2')](_0x3c1161,_0x265763);};}exports[_0xdf7e('0x3')]=function(_0xfa6b59){for(var _0x36638d=0x0,_0x52e2b3=events[_0xdf7e('0x4')];_0x36638d<_0x52e2b3;_0x36638d++){var _0x516c0e=events[_0x36638d];var _0x277750=createListener(_0xdf7e('0x5')+_0x516c0e,_0xfa6b59);UserEvents['on'](_0x516c0e,_0x277750);}}; \ No newline at end of file +var _0x8ff2=['emit','user:','./user.events','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8ff2,0x1b5));var _0x28ff=function(_0x24da49,_0x426bb1){_0x24da49=_0x24da49-0x0;var _0x48c42c=_0x8ff2[_0x24da49];return _0x48c42c;};'use strict';var UserEvents=require(_0x28ff('0x0'));var events=[_0x28ff('0x1'),'remove',_0x28ff('0x2')];function createListener(_0x13b023,_0x35ae16){return function(_0x1647df){_0x35ae16[_0x28ff('0x3')](_0x13b023,_0x1647df);};}function removeListener(_0x56b923,_0x14b16e){return function(){UserEvents['removeListener'](_0x56b923,_0x14b16e);};}exports['register']=function(_0xd49135){for(var _0x4137d4=0x0,_0x2d705a=events['length'];_0x4137d4<_0x2d705a;_0x4137d4++){var _0x3d2fc5=events[_0x4137d4];var _0x523264=createListener(_0x28ff('0x4')+_0x3d2fc5,_0xd49135);UserEvents['on'](_0x3d2fc5,_0x523264);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f8aa10e..0756fce 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c3a61,_0x354221){var _0x2a691d=function(_0xbfb624){while(--_0xbfb624){_0x1c3a61['push'](_0x1c3a61['shift']());}};_0x2a691d(++_0x354221);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x19ebf2,_0x10e06e){var _0x11a34e=function(_0x1e90b9){while(--_0x1e90b9){_0x19ebf2['push'](_0x19ebf2['shift']());}};_0x11a34e(++_0x10e06e);}(_0x70e0,0x17b));var _0x070e=function(_0x3199c5,_0x5c39b4){_0x3199c5=_0x3199c5-0x0;var _0x54da77=_0x70e0[_0x3199c5];return _0x54da77;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7e21f34..0d66d3f 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 _0x4070=['exports','INTEGER','sequelize'];(function(_0x78c423,_0xfda56a){var _0x27bfc8=function(_0x436b56){while(--_0x436b56){_0x78c423['push'](_0x78c423['shift']());}};_0x27bfc8(++_0xfda56a);}(_0x4070,0x1d3));var _0x0407=function(_0x1eb1f7,_0x1e5538){_0x1eb1f7=_0x1eb1f7-0x0;var _0x404144=_0x4070[_0x1eb1f7];return _0x404144;};'use strict';var Sequelize=require(_0x0407('0x0'));module[_0x0407('0x1')]={'penalty':{'type':Sequelize[_0x0407('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c40=['sequelize','exports'];(function(_0x3026e3,_0x4631f9){var _0x312a6b=function(_0x1013c4){while(--_0x1013c4){_0x3026e3['push'](_0x3026e3['shift']());}};_0x312a6b(++_0x4631f9);}(_0x3c40,0xf4));var _0x03c4=function(_0x58010d,_0x49b16a){_0x58010d=_0x58010d-0x0;var _0x4f93db=_0x3c40[_0x58010d];return _0x4f93db;};'use strict';var Sequelize=require(_0x03c4('0x0'));module[_0x03c4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0502f0d..23f4e43 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 _0xb478=['path','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x527e97,_0x2783ae){var _0xf4bc3e=function(_0x40d4e1){while(--_0x40d4e1){_0x527e97['push'](_0x527e97['shift']());}};_0xf4bc3e(++_0x2783ae);}(_0xb478,0x1e5));var _0x8b47=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xb478[_0x5bb4e8];return _0x2a86f2;};'use strict';var _=require(_0x8b47('0x0'));var util=require('util');var logger=require(_0x8b47('0x1'))('api');var moment=require(_0x8b47('0x2'));var BPromise=require(_0x8b47('0x3'));var rp=require(_0x8b47('0x4'));var fs=require('fs');var path=require(_0x8b47('0x5'));var rimraf=require('rimraf');var config=require(_0x8b47('0x6'));var attributes=require(_0x8b47('0x7'));module['exports']=function(_0x1f7dd3,_0x1fc478){return _0x1f7dd3[_0x8b47('0x8')](_0x8b47('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e2d=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x55b6bd,_0x53fe61){var _0x412bc8=function(_0x258676){while(--_0x258676){_0x55b6bd['push'](_0x55b6bd['shift']());}};_0x412bc8(++_0x53fe61);}(_0x3e2d,0x1dc));var _0xd3e2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3e2d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd3e2('0x0'));var util=require(_0xd3e2('0x1'));var logger=require(_0xd3e2('0x2'))(_0xd3e2('0x3'));var moment=require(_0xd3e2('0x4'));var BPromise=require(_0xd3e2('0x5'));var rp=require(_0xd3e2('0x6'));var fs=require('fs');var path=require(_0xd3e2('0x7'));var rimraf=require(_0xd3e2('0x8'));var config=require(_0xd3e2('0x9'));var attributes=require(_0xd3e2('0xa'));module['exports']=function(_0x4d7c9a,_0x1b25a4){return _0x4d7c9a[_0xd3e2('0xb')]('UserChatQueue',attributes,{'tableName':_0xd3e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 3810d53..91830cd 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 _0x6b09=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x6b09,0x1bc));var _0x96b0=function(_0x2300fa,_0x41c382){_0x2300fa=_0x2300fa-0x0;var _0x11fef0=_0x6b09[_0x2300fa];return _0x11fef0;};'use strict';var _=require(_0x96b0('0x0'));var util=require(_0x96b0('0x1'));var moment=require(_0x96b0('0x2'));var BPromise=require(_0x96b0('0x3'));var rs=require(_0x96b0('0x4'));var fs=require('fs');var Redis=require(_0x96b0('0x5'));var db=require(_0x96b0('0x6'))['db'];var utils=require(_0x96b0('0x7'));var logger=require('../../config/logger')(_0x96b0('0x8'));var config=require(_0x96b0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x96b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xae4e78,_0x203ec6,_0x52176b){return new BPromise(function(_0x5ee069,_0x8cf218){return client[_0x96b0('0xb')](_0xae4e78,_0x52176b)[_0x96b0('0xc')](function(_0x275a9d){logger[_0x96b0('0xd')](_0x96b0('0xe'),_0x203ec6,_0x96b0('0xf'));logger[_0x96b0('0x10')](_0x96b0('0x11'),_0x203ec6,'request\x20sent',JSON[_0x96b0('0x12')](_0x275a9d));if(_0x275a9d[_0x96b0('0x13')]){if(_0x275a9d['error'][_0x96b0('0x14')]===0x1f4){logger[_0x96b0('0x13')](_0x96b0('0xe'),_0x203ec6,_0x275a9d[_0x96b0('0x13')]['message']);return _0x8cf218(_0x275a9d[_0x96b0('0x13')]['message']);}logger[_0x96b0('0x13')](_0x96b0('0xe'),_0x203ec6,_0x275a9d['error'][_0x96b0('0x15')]);return _0x5ee069(_0x275a9d[_0x96b0('0x13')][_0x96b0('0x15')]);}else{logger[_0x96b0('0xd')](_0x96b0('0xe'),_0x203ec6,_0x96b0('0xf'));_0x5ee069(_0x275a9d[_0x96b0('0x16')][_0x96b0('0x15')]);}})['catch'](function(_0x48e172){logger['error'](_0x96b0('0xe'),_0x203ec6,_0x48e172);_0x8cf218(_0x48e172);});});} \ No newline at end of file +var _0xe854=['error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe854,0x87));var _0x4e85=function(_0xc59d5d,_0x5a6b47){_0xc59d5d=_0xc59d5d-0x0;var _0x3771b1=_0xe854[_0xc59d5d];return _0x3771b1;};'use strict';var _=require(_0x4e85('0x0'));var util=require('util');var moment=require(_0x4e85('0x1'));var BPromise=require('bluebird');var rs=require(_0x4e85('0x2'));var fs=require('fs');var Redis=require(_0x4e85('0x3'));var db=require(_0x4e85('0x4'))['db'];var utils=require(_0x4e85('0x5'));var logger=require(_0x4e85('0x6'))(_0x4e85('0x7'));var config=require(_0x4e85('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4e85('0x9')][_0x4e85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11324c,_0x3aad52,_0x344dc9){return new BPromise(function(_0x23a45e,_0x27f200){return client[_0x4e85('0xb')](_0x11324c,_0x344dc9)[_0x4e85('0xc')](function(_0x14c82e){logger[_0x4e85('0xd')](_0x4e85('0xe'),_0x3aad52,_0x4e85('0xf'));logger[_0x4e85('0x10')](_0x4e85('0x11'),_0x3aad52,_0x4e85('0xf'),JSON[_0x4e85('0x12')](_0x14c82e));if(_0x14c82e[_0x4e85('0x13')]){if(_0x14c82e[_0x4e85('0x13')]['code']===0x1f4){logger[_0x4e85('0x13')](_0x4e85('0xe'),_0x3aad52,_0x14c82e[_0x4e85('0x13')]['message']);return _0x27f200(_0x14c82e[_0x4e85('0x13')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3aad52,_0x14c82e[_0x4e85('0x13')][_0x4e85('0x14')]);return _0x23a45e(_0x14c82e[_0x4e85('0x13')][_0x4e85('0x14')]);}else{logger[_0x4e85('0xd')](_0x4e85('0xe'),_0x3aad52,_0x4e85('0xf'));_0x23a45e(_0x14c82e['result'][_0x4e85('0x14')]);}})[_0x4e85('0x15')](function(_0x5e3e62){logger[_0x4e85('0x13')](_0x4e85('0xe'),_0x3aad52,_0x5e3e62);_0x27f200(_0x5e3e62);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f0efda8..68b545d 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x80048c,_0x406d42){var _0x225061=function(_0x34fd9f){while(--_0x34fd9f){_0x80048c['push'](_0x80048c['shift']());}};_0x225061(++_0x406d42);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x125db0,_0x44f3dc){var _0x2186c0=function(_0x5cb612){while(--_0x5cb612){_0x125db0['push'](_0x125db0['shift']());}};_0x2186c0(++_0x44f3dc);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e551a80..4c3ec74 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 _0x8798=['INTEGER','STRING','exports'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x8798,0x12e));var _0x8879=function(_0x337b47,_0x3e1c9c){_0x337b47=_0x337b47-0x0;var _0x5db4ab=_0x8798[_0x337b47];return _0x5db4ab;};'use strict';var Sequelize=require('sequelize');module[_0x8879('0x0')]={'penalty':{'type':Sequelize[_0x8879('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8879('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8879('0x2')]}}; \ No newline at end of file +var _0x299c=['exports','STRING','sequelize'];(function(_0x1a95fc,_0x3b3fb8){var _0x442d44=function(_0x34b0ae){while(--_0x34b0ae){_0x1a95fc['push'](_0x1a95fc['shift']());}};_0x442d44(++_0x3b3fb8);}(_0x299c,0xd1));var _0xc299=function(_0x2ff1f1,_0x35808b){_0x2ff1f1=_0x2ff1f1-0x0;var _0x19f145=_0x299c[_0x2ff1f1];return _0x19f145;};'use strict';var Sequelize=require(_0xc299('0x0'));module[_0xc299('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc299('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3bac477..698866c 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 _0x0964=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','api'];(function(_0x440da0,_0x1b036e){var _0x14c252=function(_0x260040){while(--_0x260040){_0x440da0['push'](_0x440da0['shift']());}};_0x14c252(++_0x1b036e);}(_0x0964,0x15e));var _0x4096=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x0964[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0x4096('0x0'));var logger=require('../../config/logger')(_0x4096('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4096('0x2'));var fs=require('fs');var path=require(_0x4096('0x3'));var rimraf=require(_0x4096('0x4'));var config=require(_0x4096('0x5'));var attributes=require(_0x4096('0x6'));module[_0x4096('0x7')]=function(_0xc02c24,_0xb99659){return _0xc02c24[_0x4096('0x8')](_0x4096('0x9'),attributes,{'tableName':_0x4096('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23ba=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','api','moment','bluebird','path'];(function(_0x419d5f,_0xb04a60){var _0x4c84b0=function(_0x53bf60){while(--_0x53bf60){_0x419d5f['push'](_0x419d5f['shift']());}};_0x4c84b0(++_0xb04a60);}(_0x23ba,0x163));var _0xa23b=function(_0x32d792,_0x2bd941){_0x32d792=_0x32d792-0x0;var _0x1154f0=_0x23ba[_0x32d792];return _0x1154f0;};'use strict';var _=require(_0xa23b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa23b('0x1'));var moment=require(_0xa23b('0x2'));var BPromise=require(_0xa23b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa23b('0x4'));var rimraf=require(_0xa23b('0x5'));var config=require(_0xa23b('0x6'));var attributes=require(_0xa23b('0x7'));module[_0xa23b('0x8')]=function(_0x492cc1,_0x2b8915){return _0x492cc1[_0xa23b('0x9')](_0xa23b('0xa'),attributes,{'tableName':_0xa23b('0xb'),'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 f59dc0e..4144f26 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 _0x3cc3=['../../config/environment','jayson/promise','client','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14a44f,_0x2c9274){var _0x205f9c=function(_0x246777){while(--_0x246777){_0x14a44f['push'](_0x14a44f['shift']());}};_0x205f9c(++_0x2c9274);}(_0x3cc3,0x77));var _0x33cc=function(_0x32d66b,_0x2b0744){_0x32d66b=_0x32d66b-0x0;var _0x3332c3=_0x3cc3[_0x32d66b];return _0x3332c3;};'use strict';var _=require(_0x33cc('0x0'));var util=require(_0x33cc('0x1'));var moment=require(_0x33cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33cc('0x3'))['db'];var utils=require(_0x33cc('0x4'));var logger=require(_0x33cc('0x5'))(_0x33cc('0x6'));var config=require(_0x33cc('0x7'));var jayson=require(_0x33cc('0x8'));var client=jayson[_0x33cc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5787c2,_0x50ce96,_0x449a1e){return new BPromise(function(_0x2381cb,_0x4b927e){return client['request'](_0x5787c2,_0x449a1e)['then'](function(_0x44d23c){logger[_0x33cc('0xa')](_0x33cc('0xb'),_0x50ce96,'request\x20sent');logger[_0x33cc('0xc')](_0x33cc('0xd'),_0x50ce96,_0x33cc('0xe'),JSON['stringify'](_0x44d23c));if(_0x44d23c[_0x33cc('0xf')]){if(_0x44d23c[_0x33cc('0xf')]['code']===0x1f4){logger[_0x33cc('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x50ce96,_0x44d23c[_0x33cc('0xf')]['message']);return _0x4b927e(_0x44d23c['error'][_0x33cc('0x10')]);}logger['error'](_0x33cc('0xb'),_0x50ce96,_0x44d23c[_0x33cc('0xf')]['message']);return _0x2381cb(_0x44d23c[_0x33cc('0xf')]['message']);}else{logger[_0x33cc('0xa')](_0x33cc('0xb'),_0x50ce96,_0x33cc('0xe'));_0x2381cb(_0x44d23c[_0x33cc('0x11')][_0x33cc('0x10')]);}})['catch'](function(_0x342994){logger['error'](_0x33cc('0xb'),_0x50ce96,_0x342994);_0x4b927e(_0x342994);});});} \ No newline at end of file +var _0xebfe=['request','then','request\x20sent','error','message','info','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebfe,0x185));var _0xeebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebfe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeebf('0x0'));var util=require(_0xeebf('0x1'));var moment=require(_0xeebf('0x2'));var BPromise=require('bluebird');var rs=require(_0xeebf('0x3'));var fs=require('fs');var Redis=require(_0xeebf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeebf('0x5'));var config=require(_0xeebf('0x6'));var jayson=require(_0xeebf('0x7'));var client=jayson[_0xeebf('0x8')][_0xeebf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39fab2,_0x5c6a52,_0x44b13a){return new BPromise(function(_0x246209,_0x54cf75){return client[_0xeebf('0xa')](_0x39fab2,_0x44b13a)[_0xeebf('0xb')](function(_0x513850){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x5c6a52,_0xeebf('0xc'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5c6a52,_0xeebf('0xc'),JSON['stringify'](_0x513850));if(_0x513850[_0xeebf('0xd')]){if(_0x513850[_0xeebf('0xd')]['code']===0x1f4){logger[_0xeebf('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x5c6a52,_0x513850['error'][_0xeebf('0xe')]);return _0x54cf75(_0x513850['error'][_0xeebf('0xe')]);}logger[_0xeebf('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x5c6a52,_0x513850['error'][_0xeebf('0xe')]);return _0x246209(_0x513850[_0xeebf('0xd')][_0xeebf('0xe')]);}else{logger[_0xeebf('0xf')](_0xeebf('0x10'),_0x5c6a52,'request\x20sent');_0x246209(_0x513850[_0xeebf('0x11')]['message']);}})[_0xeebf('0x12')](function(_0xf4c238){logger['error'](_0xeebf('0x10'),_0x5c6a52,_0xf4c238);_0x54cf75(_0xf4c238);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e881cd7..bf56b4a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17c558,_0x205bff){var _0x12b55e=function(_0xe5aa37){while(--_0xe5aa37){_0x17c558['push'](_0x17c558['shift']());}};_0x12b55e(++_0x205bff);}(_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(_0x4cd976,_0x46adbb){var _0x521418=function(_0x159011){while(--_0x159011){_0x4cd976['push'](_0x4cd976['shift']());}};_0x521418(++_0x46adbb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xcb91[_0x31eb67];return _0x2a8cb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index dda18a6..691dc72 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 _0xd345=['INTEGER','sequelize','exports'];(function(_0x4dcf75,_0x12dbfa){var _0x38ea00=function(_0x3b4342){while(--_0x3b4342){_0x4dcf75['push'](_0x4dcf75['shift']());}};_0x38ea00(++_0x12dbfa);}(_0xd345,0x148));var _0x5d34=function(_0x164dc1,_0x3c57e1){_0x164dc1=_0x164dc1-0x0;var _0x2b3927=_0xd345[_0x164dc1];return _0x2b3927;};'use strict';var Sequelize=require(_0x5d34('0x0'));module[_0x5d34('0x1')]={'penalty':{'type':Sequelize[_0x5d34('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1f1=['exports','INTEGER'];(function(_0xa26210,_0x18c925){var _0x112e2d=function(_0x4d63dc){while(--_0x4d63dc){_0xa26210['push'](_0xa26210['shift']());}};_0x112e2d(++_0x18c925);}(_0xc1f1,0x122));var _0x1c1f=function(_0x2c7ff5,_0x504abe){_0x2c7ff5=_0x2c7ff5-0x0;var _0x42fef4=_0xc1f1[_0x2c7ff5];return _0x42fef4;};'use strict';var Sequelize=require('sequelize');module[_0x1c1f('0x0')]={'penalty':{'type':Sequelize[_0x1c1f('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 d9af262..8c4e2fe 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 _0xf457=['api','moment','bluebird','request-promise','rimraf','./userMailQueue.attributes','exports','UserMailQueue','lodash','util'];(function(_0x3294a7,_0x4a8cf7){var _0x44742a=function(_0x41deae){while(--_0x41deae){_0x3294a7['push'](_0x3294a7['shift']());}};_0x44742a(++_0x4a8cf7);}(_0xf457,0x18e));var _0x7f45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf457[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f45('0x0'));var util=require(_0x7f45('0x1'));var logger=require('../../config/logger')(_0x7f45('0x2'));var moment=require(_0x7f45('0x3'));var BPromise=require(_0x7f45('0x4'));var rp=require(_0x7f45('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f45('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f45('0x7'));module[_0x7f45('0x8')]=function(_0xff80d7,_0x5806b1){return _0xff80d7['define'](_0x7f45('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0da9=['lodash','util','../../config/logger','moment','bluebird','rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0da9,0xc8));var _0x90da=function(_0x1c3517,_0x29132c){_0x1c3517=_0x1c3517-0x0;var _0x414567=_0x0da9[_0x1c3517];return _0x414567;};'use strict';var _=require(_0x90da('0x0'));var util=require(_0x90da('0x1'));var logger=require(_0x90da('0x2'))('api');var moment=require(_0x90da('0x3'));var BPromise=require(_0x90da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x90da('0x5'));var config=require('../../config/environment');var attributes=require(_0x90da('0x6'));module[_0x90da('0x7')]=function(_0x47a4d0,_0x48e619){return _0x47a4d0[_0x90da('0x8')]('UserMailQueue',attributes,{'tableName':_0x90da('0x9'),'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 c9d41ce..6c228e3 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x13e10c,_0x43dff3){var _0x590b73=function(_0x509d4a){while(--_0x509d4a){_0x13e10c['push'](_0x13e10c['shift']());}};_0x590b73(++_0x43dff3);}(_0x4b84,0x1cc));var _0x44b8=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x4b84[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x492b1c,_0x58840e){_0x492b1c=_0x492b1c-0x0;var _0xfd2d4c=_0x008c[_0x492b1c];return _0xfd2d4c;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3ba074a..12ac3d2 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 _0xe888=['isAuthenticated','exports','util','connect-timeout','Router','../../components/interaction/service','./userNotification.controller','post'];(function(_0x3f6e6b,_0x40a09f){var _0x504212=function(_0x1237bf){while(--_0x1237bf){_0x3f6e6b['push'](_0x3f6e6b['shift']());}};_0x504212(++_0x40a09f);}(_0xe888,0x112));var _0x8e88=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xe888[_0x478c8a];return _0x3b6b3e;};'use strict';var multer=require('multer');var util=require(_0x8e88('0x0'));var path=require('path');var timeout=require(_0x8e88('0x1'));var express=require('express');var router=express[_0x8e88('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e88('0x3'));var config=require('../../config/environment');var controller=require(_0x8e88('0x4'));router[_0x8e88('0x5')]('/',auth[_0x8e88('0x6')](),controller['sendUserNotification']);module[_0x8e88('0x7')]=router; \ No newline at end of file +var _0xefc0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','post','exports','multer','util','path'];(function(_0x43f77e,_0x28d344){var _0xd6eb0d=function(_0x2d8cd8){while(--_0x2d8cd8){_0x43f77e['push'](_0x43f77e['shift']());}};_0xd6eb0d(++_0x28d344);}(_0xefc0,0xb1));var _0x0efc=function(_0x138a05,_0x2a7674){_0x138a05=_0x138a05-0x0;var _0x5eaa00=_0xefc0[_0x138a05];return _0x5eaa00;};'use strict';var multer=require(_0x0efc('0x0'));var util=require(_0x0efc('0x1'));var path=require(_0x0efc('0x2'));var timeout=require('connect-timeout');var express=require(_0x0efc('0x3'));var router=express[_0x0efc('0x4')]();var fs_extra=require(_0x0efc('0x5'));var auth=require(_0x0efc('0x6'));var interaction=require(_0x0efc('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x0efc('0x8')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x0efc('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2201168..bd1947b 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 _0xc7e0=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc7e0,0x180));var _0x0c7e=function(_0x5b8f80,_0x137a5d){_0x5b8f80=_0x5b8f80-0x0;var _0x5683b6=_0xc7e0[_0x5b8f80];return _0x5683b6;};'use strict';var Sequelize=require(_0x0c7e('0x0'));module['exports']={'body':{'type':Sequelize[_0x0c7e('0x1')]},'senderName':{'type':Sequelize[_0x0c7e('0x2')]},'recipientsId':{'type':Sequelize[_0x0c7e('0x1')]},'recipientsDescription':{'type':Sequelize[_0x0c7e('0x2')]},'beep':{'type':Sequelize[_0x0c7e('0x3')]}}; \ No newline at end of file +var _0x411a=['STRING','sequelize','exports','TEXT'];(function(_0x1ee88f,_0x49cfbd){var _0xed6238=function(_0x12ee49){while(--_0x12ee49){_0x1ee88f['push'](_0x1ee88f['shift']());}};_0xed6238(++_0x49cfbd);}(_0x411a,0x1ed));var _0xa411=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x411a[_0x1e3671];return _0x48d5f5;};'use strict';var Sequelize=require(_0xa411('0x0'));module[_0xa411('0x1')]={'body':{'type':Sequelize[_0xa411('0x2')]},'senderName':{'type':Sequelize[_0xa411('0x3')]},'recipientsId':{'type':Sequelize[_0xa411('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 6ecafc4..797e096 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 _0x00f6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','sendUserNotification','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','queue','replace','push','all','getAgents','map','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','fs-extra'];(function(_0x51bfdf,_0x4fddbd){var _0x2dd51f=function(_0x5dd66a){while(--_0x5dd66a){_0x51bfdf['push'](_0x51bfdf['shift']());}};_0x2dd51f(++_0x4fddbd);}(_0x00f6,0x174));var _0x600f=function(_0x2cc4bc,_0xa233fc){_0x2cc4bc=_0x2cc4bc-0x0;var _0x5ad557=_0x00f6[_0x2cc4bc];return _0x5ad557;};'use strict';var emlformat=require(_0x600f('0x0'));var rimraf=require(_0x600f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x600f('0x2'));var moment=require('moment');var BPromise=require(_0x600f('0x3'));var Mustache=require(_0x600f('0x4'));var util=require('util');var path=require(_0x600f('0x5'));var sox=require(_0x600f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x600f('0x7'));var _=require(_0x600f('0x8'));var squel=require(_0x600f('0x9'));var crypto=require(_0x600f('0xa'));var jsforce=require(_0x600f('0xb'));var deskjs=require(_0x600f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x600f('0xd'));var Papa=require(_0x600f('0xe'));var Redis=require(_0x600f('0xf'));var authService=require(_0x600f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x600f('0x11'))(_0x600f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x600f('0x13'));var db=require(_0x600f('0x14'))['db'];config['redis']=_[_0x600f('0x15')](config['redis'],{'host':_0x600f('0x16'),'port':0x18eb});var socket=require(_0x600f('0x17'))(new Redis(config['redis']));require(_0x600f('0x18'))[_0x600f('0x19')](socket);function respondWithStatusCode(_0x11095a,_0x14dac5){_0x14dac5=_0x14dac5||0xcc;return function(_0x52141b){if(_0x52141b){return _0x11095a['sendStatus'](_0x14dac5);}return _0x11095a[_0x600f('0x1a')](_0x14dac5)[_0x600f('0x1b')]();};}function respondWithResult(_0x39c579,_0x28dc02){_0x28dc02=_0x28dc02||0xc8;return function(_0x3a9213){if(_0x3a9213){return _0x39c579[_0x600f('0x1a')](_0x28dc02)[_0x600f('0x1c')](_0x3a9213);}};}function respondWithFilteredResult(_0x4932b0,_0x2b178e){return function(_0x3882e5){if(_0x3882e5){var _0x3bac2e=typeof _0x2b178e['offset']==='undefined'&&typeof _0x2b178e['limit']==='undefined';var _0x22f1a5=_0x3882e5[_0x600f('0x1d')];var _0x2b5983=_0x3bac2e?0x0:_0x2b178e[_0x600f('0x1e')];var _0x245979=_0x3bac2e?_0x3882e5[_0x600f('0x1d')]:_0x2b178e[_0x600f('0x1e')]+_0x2b178e[_0x600f('0x1f')];var _0x1d25e0;if(_0x245979>=_0x22f1a5){_0x245979=_0x22f1a5;_0x1d25e0=0xc8;}else{_0x1d25e0=0xce;}_0x4932b0['status'](_0x1d25e0);return _0x4932b0[_0x600f('0x20')](_0x600f('0x21'),_0x2b5983+'-'+_0x245979+'/'+_0x22f1a5)[_0x600f('0x1c')](_0x3882e5);}return null;};}function patchUpdates(_0x302445){return function(_0x3b2822){try{jsonpatch[_0x600f('0x22')](_0x3b2822,_0x302445,!![]);}catch(_0x331912){return BPromise[_0x600f('0x23')](_0x331912);}return _0x3b2822[_0x600f('0x24')]();};}function saveUpdates(_0x36644d,_0x4d0ba3){return function(_0x10db77){if(_0x10db77){return _0x10db77[_0x600f('0x25')](_0x36644d)[_0x600f('0x26')](function(_0x4bb721){return _0x4bb721;});}return null;};}function removeEntity(_0x5739e5,_0x4d15f2){return function(_0x49c7e8){if(_0x49c7e8){return _0x49c7e8['destroy']()['then'](function(){_0x5739e5[_0x600f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c80a,_0x39848f){return function(_0x289a77){if(!_0x289a77){_0x37c80a[_0x600f('0x27')](0x194);}return _0x289a77;};}function handleError(_0x5bc885,_0x1aa581){_0x1aa581=_0x1aa581||0x1f4;return function(_0x5547f9){logger['error'](_0x5547f9['stack']);if(_0x5547f9[_0x600f('0x28')]){delete _0x5547f9[_0x600f('0x28')];}_0x5bc885[_0x600f('0x1a')](_0x1aa581)[_0x600f('0x29')](_0x5547f9);};}exports[_0x600f('0x2a')]=function(_0x45ecd4,_0x58b5ea,_0x1e4906){if(!_0x45ecd4['body']['hasOwnProperty']('text')&&!_0x45ecd4['body'][_0x600f('0x2b')](_0x600f('0x2c'))){throw new db['Sequelize'][(_0x600f('0x2d'))](_0x600f('0x2e'));}else{if(_0x45ecd4[_0x600f('0x2f')][_0x600f('0x2b')]('TemplateId')&&!_0x45ecd4[_0x600f('0x2f')]['hasOwnProperty'](_0x600f('0x30'))){throw new db[(_0x600f('0x31'))]['ValidationError'](_0x600f('0x32'));}if(!_0x45ecd4[_0x600f('0x2f')][_0x600f('0x2b')](_0x600f('0x33'))){throw new db[(_0x600f('0x31'))]['ValidationError'](_0x600f('0x34'));}else{try{var _0x5f184d=JSON['parse'](_0x45ecd4[_0x600f('0x2f')]['recipients']);}catch(_0x3fc659){logger['error'](_0x3fc659);throw new db['Sequelize'][(_0x600f('0x2d'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x27e533=[_0x600f('0x35'),_0x600f('0x36'),'mailqueue',_0x600f('0x37'),'smsqueue',_0x600f('0x38'),_0x600f('0x39'),_0x600f('0x3a'),_0x600f('0x3b')];if(_[_0x600f('0x3c')](_0x5f184d,function(_0x508ecd){return!_[_0x600f('0x3d')](_0x27e533,_0x508ecd[_0x600f('0x3e')][_0x600f('0x3f')]());})){throw new db[(_0x600f('0x31'))][(_0x600f('0x2d'))](_0x600f('0x40'));}}}var _0x4f7d32={};_0x4f7d32[_0x600f('0x41')]=_0x45ecd4['body'][_0x600f('0x2b')]('senderName')?_0x45ecd4[_0x600f('0x2f')][_0x600f('0x41')]:_0x45ecd4[_0x600f('0x3b')][_0x600f('0x42')];_0x4f7d32['recipientsDescription']=_[_0x600f('0x43')](_0x45ecd4['body'][_0x600f('0x44')])?null:_0x45ecd4[_0x600f('0x2f')][_0x600f('0x44')];_0x4f7d32[_0x600f('0x45')]=_0x45ecd4[_0x600f('0x2f')][_0x600f('0x45')]||![];_0x4f7d32[_0x600f('0x46')]=_0x45ecd4[_0x600f('0x3b')]['id'];return getContent(_0x45ecd4['body'])['then'](function(_0x237fc){_0x4f7d32[_0x600f('0x2f')]=_0x237fc;return getRecipients(_0x5f184d);})[_0x600f('0x26')](function(_0x62efdb){_0x4f7d32[_0x600f('0x47')]=_[_0x600f('0x48')](_0x62efdb)[_0x600f('0x49')](',');return db[_0x600f('0x4a')][_0x600f('0x4b')](function(_0xf26c0){return db[_0x600f('0x4c')][_0x600f('0x4d')](_0x4f7d32,{'raw':!![],'transaction':_0xf26c0})['then'](function(_0x2c3ccd){var _0x26a427={'sender':_0x4f7d32[_0x600f('0x41')],'description':_0x4f7d32[_0x600f('0x44')],'content':_0x4f7d32['body'],'beep':_0x4f7d32[_0x600f('0x45')]};_0x62efdb[_0x600f('0x4e')](function(_0x5d6902){_0x26a427[_0x600f('0x4f')]=_0x5d6902;socket['emit']('userNotification:send',_0x26a427);});return _0x2c3ccd;});});})['then'](respondWithResult(_0x58b5ea,0xc9))[_0x600f('0x50')](handleError(_0x58b5ea,null));};function getContent(_0x2d8b8a){return new BPromise(function(_0x2935e3,_0x508931){if(_0x2d8b8a['text']){_0x2935e3(_0x2d8b8a[_0x600f('0x51')]);return;}return db[_0x600f('0x52')][_0x600f('0x53')]({'attributes':['html'],'where':{'id':_0x2d8b8a[_0x600f('0x2c')]},'raw':!![]})[_0x600f('0x26')](function(_0x222809){if(!_0x222809)throw new db[(_0x600f('0x31'))][(_0x600f('0x2d'))](_0x600f('0x54'));var _0x4bfb1c=Mustache[_0x600f('0x55')](_0x222809['html'],_0x2d8b8a['view']);_0x2935e3(_0x4bfb1c);})[_0x600f('0x50')](function(_0x370688){_0x508931(_0x370688);});});}function getRecipients(_0x3c9744){return new BPromise(function(_0x303206,_0xc8c480){var _0x3662e0=[];var _0x15c478=[];_0x3c9744[_0x600f('0x4e')](function(_0x1c952c){var _0x432a03=_[_0x600f('0x56')](_0x1c952c[_0x600f('0x3e')][_0x600f('0x3f')]());if(_0x432a03===_0x600f('0x57')){_0x3662e0=_[_0x600f('0x58')](_0x3662e0,_0x1c952c['ids']);}else{if(_[_0x600f('0x3d')](_0x432a03,_0x600f('0x59')))_0x432a03=_0x432a03[_0x600f('0x5a')](_0x600f('0x59'),'Queue');_0x1c952c['ids'][_0x600f('0x4e')](function(_0x430f9b){_0x15c478[_0x600f('0x5b')](getAgents(_0x432a03,_0x430f9b));});}});return BPromise[_0x600f('0x5c')](_0x15c478)['then'](function(_0x497c85){_0x3662e0=_[_0x600f('0x58')](_0x3662e0,_['flatten'](_0x497c85));_0x303206(_0x3662e0);})[_0x600f('0x50')](function(_0x22f992){_0xc8c480(_0x22f992);});});}function getAgents(_0x569e4e,_0x5e23a9){return new BPromise(function(_0x1759b1,_0x41e558){return db[_0x569e4e][_0x600f('0x53')]({'where':{'id':_0x5e23a9}})[_0x600f('0x26')](function(_0x3bf125){return _0x3bf125[_0x600f('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5257bf){var _0x428d21=_[_0x600f('0x5e')](_0x5257bf,'id');_0x1759b1(_0x428d21);});})[_0x600f('0x50')](function(_0x5320de){_0x41e558(_0x5320de);});});} \ No newline at end of file +var _0x7c10=['fullname','recipientsDescription','isEmpty','beep','SenderId','user','recipientsId','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','toLowerCase','User','union','ids','includes','queue','replace','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','error','chatqueue','mailqueue','openchannelqueue','voicequeue','team','some','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName'];(function(_0x3e0035,_0x4a5de1){var _0x248866=function(_0x59f27d){while(--_0x59f27d){_0x3e0035['push'](_0x3e0035['shift']());}};_0x248866(++_0x4a5de1);}(_0x7c10,0x1e3));var _0x07c1=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7c10[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x07c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07c1('0x1'));var jsonpatch=require(_0x07c1('0x2'));var rp=require(_0x07c1('0x3'));var moment=require(_0x07c1('0x4'));var BPromise=require(_0x07c1('0x5'));var Mustache=require(_0x07c1('0x6'));var util=require(_0x07c1('0x7'));var path=require(_0x07c1('0x8'));var sox=require(_0x07c1('0x9'));var csv=require('to-csv');var ejs=require(_0x07c1('0xa'));var fs=require('fs');var fs_extra=require(_0x07c1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x07c1('0xc'));var jsforce=require(_0x07c1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x07c1('0xe'));var querystring=require('querystring');var Papa=require(_0x07c1('0xf'));var Redis=require(_0x07c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07c1('0x11'));var as=require(_0x07c1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x07c1('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x07c1('0x14'));var db=require(_0x07c1('0x15'))['db'];config[_0x07c1('0x16')]=_[_0x07c1('0x17')](config[_0x07c1('0x16')],{'host':_0x07c1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07c1('0x16')]));require(_0x07c1('0x19'))['register'](socket);function respondWithStatusCode(_0x3d3e21,_0x35864e){_0x35864e=_0x35864e||0xcc;return function(_0x3db059){if(_0x3db059){return _0x3d3e21[_0x07c1('0x1a')](_0x35864e);}return _0x3d3e21[_0x07c1('0x1b')](_0x35864e)[_0x07c1('0x1c')]();};}function respondWithResult(_0xb8d3d7,_0x50adfb){_0x50adfb=_0x50adfb||0xc8;return function(_0x3acb7d){if(_0x3acb7d){return _0xb8d3d7[_0x07c1('0x1b')](_0x50adfb)[_0x07c1('0x1d')](_0x3acb7d);}};}function respondWithFilteredResult(_0x5ad9cd,_0x4eba7d){return function(_0x448309){if(_0x448309){var _0x220ecf=typeof _0x4eba7d[_0x07c1('0x1e')]===_0x07c1('0x1f')&&typeof _0x4eba7d[_0x07c1('0x20')]===_0x07c1('0x1f');var _0x3c8e0a=_0x448309[_0x07c1('0x21')];var _0x46f616=_0x220ecf?0x0:_0x4eba7d[_0x07c1('0x1e')];var _0x4fc3b9=_0x220ecf?_0x448309[_0x07c1('0x21')]:_0x4eba7d['offset']+_0x4eba7d[_0x07c1('0x20')];var _0x39b2b9;if(_0x4fc3b9>=_0x3c8e0a){_0x4fc3b9=_0x3c8e0a;_0x39b2b9=0xc8;}else{_0x39b2b9=0xce;}_0x5ad9cd[_0x07c1('0x1b')](_0x39b2b9);return _0x5ad9cd[_0x07c1('0x22')](_0x07c1('0x23'),_0x46f616+'-'+_0x4fc3b9+'/'+_0x3c8e0a)[_0x07c1('0x1d')](_0x448309);}return null;};}function patchUpdates(_0x8e0966){return function(_0x15f885){try{jsonpatch[_0x07c1('0x24')](_0x15f885,_0x8e0966,!![]);}catch(_0x72a843){return BPromise[_0x07c1('0x25')](_0x72a843);}return _0x15f885[_0x07c1('0x26')]();};}function saveUpdates(_0x175738,_0x152dc5){return function(_0x40736a){if(_0x40736a){return _0x40736a['update'](_0x175738)[_0x07c1('0x27')](function(_0x4809df){return _0x4809df;});}return null;};}function removeEntity(_0x13d345,_0x26c158){return function(_0x514214){if(_0x514214){return _0x514214[_0x07c1('0x28')]()[_0x07c1('0x27')](function(){_0x13d345[_0x07c1('0x1b')](0xcc)[_0x07c1('0x1c')]();});}};}function handleEntityNotFound(_0x40aa3e,_0x6c04e4){return function(_0x31b38d){if(!_0x31b38d){_0x40aa3e[_0x07c1('0x1a')](0x194);}return _0x31b38d;};}function handleError(_0x3f2b98,_0x29b6d0){_0x29b6d0=_0x29b6d0||0x1f4;return function(_0xd358f){logger['error'](_0xd358f[_0x07c1('0x29')]);if(_0xd358f[_0x07c1('0x2a')]){delete _0xd358f['name'];}_0x3f2b98[_0x07c1('0x1b')](_0x29b6d0)['send'](_0xd358f);};}exports[_0x07c1('0x2b')]=function(_0x47be6f,_0x34e8fe,_0x19e43b){if(!_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x2d')](_0x07c1('0x2e'))&&!_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x2d')](_0x07c1('0x2f'))){throw new db[(_0x07c1('0x30'))][(_0x07c1('0x31'))](_0x07c1('0x32'));}else{if(_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x2d')](_0x07c1('0x2f'))&&!_0x47be6f[_0x07c1('0x2c')]['hasOwnProperty'](_0x07c1('0x33'))){throw new db[(_0x07c1('0x30'))][(_0x07c1('0x31'))](_0x07c1('0x34'));}if(!_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x2d')](_0x07c1('0x35'))){throw new db[(_0x07c1('0x30'))][(_0x07c1('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3ba60c=JSON['parse'](_0x47be6f['body'][_0x07c1('0x35')]);}catch(_0x557739){logger[_0x07c1('0x36')](_0x557739);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x3330f5=[_0x07c1('0x37'),'faxqueue',_0x07c1('0x38'),_0x07c1('0x39'),'smsqueue',_0x07c1('0x3a'),'whatsappqueue',_0x07c1('0x3b'),'user'];if(_[_0x07c1('0x3c')](_0x3ba60c,function(_0x5937de){return!_['includes'](_0x3330f5,_0x5937de['model']['toLowerCase']());})){throw new db[(_0x07c1('0x30'))][(_0x07c1('0x31'))](_0x07c1('0x3d'));}}}var _0x2fbd10={};_0x2fbd10[_0x07c1('0x3e')]=_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x2d')](_0x07c1('0x3e'))?_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x3e')]:_0x47be6f['user'][_0x07c1('0x3f')];_0x2fbd10[_0x07c1('0x40')]=_[_0x07c1('0x41')](_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x40')])?null:_0x47be6f['body']['recipientsDescription'];_0x2fbd10[_0x07c1('0x42')]=_0x47be6f[_0x07c1('0x2c')][_0x07c1('0x42')]||![];_0x2fbd10[_0x07c1('0x43')]=_0x47be6f[_0x07c1('0x44')]['id'];return getContent(_0x47be6f[_0x07c1('0x2c')])[_0x07c1('0x27')](function(_0x54f518){_0x2fbd10[_0x07c1('0x2c')]=_0x54f518;return getRecipients(_0x3ba60c);})[_0x07c1('0x27')](function(_0x247c6b){_0x2fbd10[_0x07c1('0x45')]=_['sortBy'](_0x247c6b)['join'](',');return db['sequelize'][_0x07c1('0x46')](function(_0x258ed4){return db[_0x07c1('0x47')][_0x07c1('0x48')](_0x2fbd10,{'raw':!![],'transaction':_0x258ed4})['then'](function(_0x16c083){var _0x502a38={'sender':_0x2fbd10[_0x07c1('0x3e')],'description':_0x2fbd10['recipientsDescription'],'content':_0x2fbd10['body'],'beep':_0x2fbd10[_0x07c1('0x42')]};_0x247c6b[_0x07c1('0x49')](function(_0x356bd1){_0x502a38[_0x07c1('0x4a')]=_0x356bd1;socket[_0x07c1('0x4b')](_0x07c1('0x4c'),_0x502a38);});return _0x16c083;});});})[_0x07c1('0x27')](respondWithResult(_0x34e8fe,0xc9))[_0x07c1('0x4d')](handleError(_0x34e8fe,null));};function getContent(_0x2a8804){return new BPromise(function(_0x4fad61,_0x6c96ca){if(_0x2a8804['text']){_0x4fad61(_0x2a8804[_0x07c1('0x2e')]);return;}return db['Template']['findOne']({'attributes':['html'],'where':{'id':_0x2a8804[_0x07c1('0x2f')]},'raw':!![]})[_0x07c1('0x27')](function(_0x307e7d){if(!_0x307e7d)throw new db['Sequelize'][(_0x07c1('0x31'))](_0x07c1('0x4e'));var _0x566614=Mustache[_0x07c1('0x4f')](_0x307e7d[_0x07c1('0x50')],_0x2a8804[_0x07c1('0x33')]);_0x4fad61(_0x566614);})[_0x07c1('0x4d')](function(_0x4c2452){_0x6c96ca(_0x4c2452);});});}function getRecipients(_0x158531){return new BPromise(function(_0x491a7b,_0xcf4763){var _0x21cefa=[];var _0x3c4ee0=[];_0x158531[_0x07c1('0x49')](function(_0xe92871){var _0x42c96c=_[_0x07c1('0x51')](_0xe92871['model'][_0x07c1('0x52')]());if(_0x42c96c===_0x07c1('0x53')){_0x21cefa=_[_0x07c1('0x54')](_0x21cefa,_0xe92871[_0x07c1('0x55')]);}else{if(_[_0x07c1('0x56')](_0x42c96c,_0x07c1('0x57')))_0x42c96c=_0x42c96c[_0x07c1('0x58')](_0x07c1('0x57'),'Queue');_0xe92871[_0x07c1('0x55')]['forEach'](function(_0x4ca197){_0x3c4ee0['push'](getAgents(_0x42c96c,_0x4ca197));});}});return BPromise['all'](_0x3c4ee0)['then'](function(_0x477e68){_0x21cefa=_['union'](_0x21cefa,_[_0x07c1('0x59')](_0x477e68));_0x491a7b(_0x21cefa);})[_0x07c1('0x4d')](function(_0x22909f){_0xcf4763(_0x22909f);});});}function getAgents(_0x547da4,_0x2f3e2c){return new BPromise(function(_0x54abc0,_0x46e697){return db[_0x547da4]['findOne']({'where':{'id':_0x2f3e2c}})['then'](function(_0x3498b7){return _0x3498b7['getAgents']({'attributes':['id'],'raw':!![]})[_0x07c1('0x27')](function(_0x1d3624){var _0x2b059d=_[_0x07c1('0x5a')](_0x1d3624,'id');_0x54abc0(_0x2b059d);});})[_0x07c1('0x4d')](function(_0x5132c9){_0x46e697(_0x5132c9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e86cc76..0523054 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 _0x0a3b=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0a3b,0xec));var _0xb0a3=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x0a3b[_0x53bcc3];return _0x47c959;};'use strict';var EventEmitter=require(_0xb0a3('0x0'));var UserNotification=require(_0xb0a3('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb0a3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb0a3('0x3'),'afterDestroy':_0xb0a3('0x4')};function emitEvent(_0xb53728){return function(_0x263d3e,_0xb6bf06,_0x13b9cb){UserNotificationEvents[_0xb0a3('0x5')](_0xb53728+':'+_0x263d3e['id'],_0x263d3e);UserNotificationEvents['emit'](_0xb53728,_0x263d3e);_0x13b9cb(null);};}for(var e in events){if(events[_0xb0a3('0x6')](e)){var event=events[e];UserNotification[_0xb0a3('0x7')](e,emitEvent(event));}}module[_0xb0a3('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x5bc3=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0x251933,_0x38d004){var _0x5c79f5=function(_0x51cf3b){while(--_0x51cf3b){_0x251933['push'](_0x251933['shift']());}};_0x5c79f5(++_0x38d004);}(_0x5bc3,0x69));var _0x35bc=function(_0x1cc571,_0x2a45f2){_0x1cc571=_0x1cc571-0x0;var _0x1c70db=_0x5bc3[_0x1cc571];return _0x1c70db;};'use strict';var EventEmitter=require(_0x35bc('0x0'));var UserNotification=require(_0x35bc('0x1'))['db'][_0x35bc('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x35bc('0x3')](0x0);var events={'afterCreate':_0x35bc('0x4'),'afterUpdate':_0x35bc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x527198){return function(_0xcd3e0b,_0x476ee4,_0x1ce531){UserNotificationEvents['emit'](_0x527198+':'+_0xcd3e0b['id'],_0xcd3e0b);UserNotificationEvents[_0x35bc('0x6')](_0x527198,_0xcd3e0b);_0x1ce531(null);};}for(var e in events){if(events[_0x35bc('0x7')](e)){var event=events[e];UserNotification[_0x35bc('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 911a73b..1633380 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 _0x5620=['define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports'];(function(_0x983c3a,_0x5d570b){var _0x5cad8c=function(_0x881f16){while(--_0x881f16){_0x983c3a['push'](_0x983c3a['shift']());}};_0x5cad8c(++_0x5d570b);}(_0x5620,0x74));var _0x0562=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x5620[_0x199c03];return _0x11a7d4;};'use strict';var _=require(_0x0562('0x0'));var util=require(_0x0562('0x1'));var logger=require('../../config/logger')(_0x0562('0x2'));var moment=require(_0x0562('0x3'));var BPromise=require(_0x0562('0x4'));var rp=require(_0x0562('0x5'));var fs=require('fs');var path=require(_0x0562('0x6'));var rimraf=require('rimraf');var config=require(_0x0562('0x7'));var attributes=require(_0x0562('0x8'));module[_0x0562('0x9')]=function(_0x593a30,_0x116e45){return _0x593a30[_0x0562('0xa')]('UserNotification',attributes,{'tableName':_0x0562('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0562('0xc'),'collate':_0x0562('0xd')});}; \ No newline at end of file +var _0xdbfc=['./userNotification.attributes','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4a4248,_0x30660d){var _0x1a76ed=function(_0xbaf3c1){while(--_0xbaf3c1){_0x4a4248['push'](_0x4a4248['shift']());}};_0x1a76ed(++_0x30660d);}(_0xdbfc,0x198));var _0xcdbf=function(_0x588ae6,_0x2e6c77){_0x588ae6=_0x588ae6-0x0;var _0x3fbc7d=_0xdbfc[_0x588ae6];return _0x3fbc7d;};'use strict';var _=require(_0xcdbf('0x0'));var util=require(_0xcdbf('0x1'));var logger=require('../../config/logger')(_0xcdbf('0x2'));var moment=require(_0xcdbf('0x3'));var BPromise=require(_0xcdbf('0x4'));var rp=require(_0xcdbf('0x5'));var fs=require('fs');var path=require(_0xcdbf('0x6'));var rimraf=require('rimraf');var config=require(_0xcdbf('0x7'));var attributes=require(_0xcdbf('0x8'));module['exports']=function(_0x5f586,_0x76047b){return _0x5f586[_0xcdbf('0x9')]('UserNotification',attributes,{'tableName':_0xcdbf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdbf('0xb'),'collate':_0xcdbf('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c0266f1..7c5c05a 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 _0x624b=['catch','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x110d53,_0x59b52e){var _0x24c192=function(_0xb43ee3){while(--_0xb43ee3){_0x110d53['push'](_0x110d53['shift']());}};_0x24c192(++_0x59b52e);}(_0x624b,0xb1));var _0xb624=function(_0x537c51,_0x164a16){_0x537c51=_0x537c51-0x0;var _0x3962e0=_0x624b[_0x537c51];return _0x3962e0;};'use strict';var _=require('lodash');var util=require(_0xb624('0x0'));var moment=require(_0xb624('0x1'));var BPromise=require('bluebird');var rs=require(_0xb624('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb624('0x3'))(_0xb624('0x4'));var config=require('../../config/environment');var jayson=require(_0xb624('0x5'));var client=jayson[_0xb624('0x6')][_0xb624('0x7')]({'port':0x232a});config[_0xb624('0x8')]=_[_0xb624('0x9')](config[_0xb624('0x8')],{'host':_0xb624('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb624('0x8')]));require(_0xb624('0xb'))[_0xb624('0xc')](socket);function respondWithRpcPromise(_0x502765,_0x86ffad,_0x34d5b6){return new BPromise(function(_0x370646,_0x389e9e){return client[_0xb624('0xd')](_0x502765,_0x34d5b6)[_0xb624('0xe')](function(_0x957a83){logger[_0xb624('0xf')](_0xb624('0x10'),_0x86ffad,'request\x20sent');logger['debug'](_0xb624('0x11'),_0x86ffad,'request\x20sent',JSON['stringify'](_0x957a83));if(_0x957a83[_0xb624('0x12')]){if(_0x957a83[_0xb624('0x12')]['code']===0x1f4){logger[_0xb624('0x12')](_0xb624('0x10'),_0x86ffad,_0x957a83[_0xb624('0x12')][_0xb624('0x13')]);return _0x389e9e(_0x957a83['error']['message']);}logger[_0xb624('0x12')](_0xb624('0x10'),_0x86ffad,_0x957a83['error'][_0xb624('0x13')]);return _0x370646(_0x957a83[_0xb624('0x12')][_0xb624('0x13')]);}else{logger['info'](_0xb624('0x10'),_0x86ffad,'request\x20sent');_0x370646(_0x957a83[_0xb624('0x14')][_0xb624('0x13')]);}})[_0xb624('0x15')](function(_0x3667a8){logger[_0xb624('0x12')](_0xb624('0x10'),_0x86ffad,_0x3667a8);_0x389e9e(_0x3667a8);});});} \ No newline at end of file +var _0x9f20=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','request\x20sent','debug','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x596fce,_0x2e316c){var _0x576017=function(_0x30b46d){while(--_0x30b46d){_0x596fce['push'](_0x596fce['shift']());}};_0x576017(++_0x2e316c);}(_0x9f20,0x1a9));var _0x09f2=function(_0x2c48e4,_0x3b6e4a){_0x2c48e4=_0x2c48e4-0x0;var _0x32a4d0=_0x9f20[_0x2c48e4];return _0x32a4d0;};'use strict';var _=require(_0x09f2('0x0'));var util=require(_0x09f2('0x1'));var moment=require(_0x09f2('0x2'));var BPromise=require(_0x09f2('0x3'));var rs=require(_0x09f2('0x4'));var fs=require('fs');var Redis=require(_0x09f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x09f2('0x6'));var logger=require('../../config/logger')(_0x09f2('0x7'));var config=require('../../config/environment');var jayson=require(_0x09f2('0x8'));var client=jayson[_0x09f2('0x9')][_0x09f2('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x09f2('0xb')],{'host':_0x09f2('0xc'),'port':0x18eb});var socket=require(_0x09f2('0xd'))(new Redis(config['redis']));require(_0x09f2('0xe'))[_0x09f2('0xf')](socket);function respondWithRpcPromise(_0x43cbd7,_0x103156,_0x5e12e5){return new BPromise(function(_0x16e5e8,_0x2173d5){return client['request'](_0x43cbd7,_0x5e12e5)[_0x09f2('0x10')](function(_0x5450a3){logger[_0x09f2('0x11')]('UserNotification,\x20%s,\x20%s',_0x103156,_0x09f2('0x12'));logger[_0x09f2('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x103156,'request\x20sent',JSON[_0x09f2('0x14')](_0x5450a3));if(_0x5450a3[_0x09f2('0x15')]){if(_0x5450a3['error'][_0x09f2('0x16')]===0x1f4){logger[_0x09f2('0x15')](_0x09f2('0x17'),_0x103156,_0x5450a3['error'][_0x09f2('0x18')]);return _0x2173d5(_0x5450a3['error'][_0x09f2('0x18')]);}logger[_0x09f2('0x15')](_0x09f2('0x17'),_0x103156,_0x5450a3[_0x09f2('0x15')][_0x09f2('0x18')]);return _0x16e5e8(_0x5450a3[_0x09f2('0x15')][_0x09f2('0x18')]);}else{logger[_0x09f2('0x11')](_0x09f2('0x17'),_0x103156,_0x09f2('0x12'));_0x16e5e8(_0x5450a3[_0x09f2('0x19')]['message']);}})[_0x09f2('0x1a')](function(_0x3d7e15){logger['error'](_0x09f2('0x17'),_0x103156,_0x3d7e15);_0x2173d5(_0x3d7e15);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index cb806ab..a6b1b50 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 _0xbc69=['./userNotification.events','remove','removeListener','userNotification:'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xbc69,0xf0));var _0x9bc6=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xbc69[_0x266618];return _0x54dbf5;};'use strict';var UserNotificationEvents=require(_0x9bc6('0x0'));var events=['save',_0x9bc6('0x1'),'update'];function createListener(_0x62a5d4,_0x218b5c){return function(_0x2db951){_0x218b5c['emit'](_0x62a5d4,_0x2db951);};}function removeListener(_0x59f590,_0x1063b3){return function(){UserNotificationEvents[_0x9bc6('0x2')](_0x59f590,_0x1063b3);};}exports['register']=function(_0x5946d6){for(var _0x5eb05f=0x0,_0x2fa997=events['length'];_0x5eb05f<_0x2fa997;_0x5eb05f++){var _0x4ef58d=events[_0x5eb05f];var _0x627a68=createListener(_0x9bc6('0x3')+_0x4ef58d,_0x5946d6);UserNotificationEvents['on'](_0x4ef58d,_0x627a68);}}; \ No newline at end of file +var _0xda3a=['removeListener','register','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda3a,0x7f));var _0xada3=function(_0x362391,_0x3af928){_0x362391=_0x362391-0x0;var _0x25926b=_0xda3a[_0x362391];return _0x25926b;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xada3('0x0'),'remove',_0xada3('0x1')];function createListener(_0x228ae8,_0x51d950){return function(_0x26b6aa){_0x51d950[_0xada3('0x2')](_0x228ae8,_0x26b6aa);};}function removeListener(_0xa1068f,_0xc5b874){return function(){UserNotificationEvents[_0xada3('0x3')](_0xa1068f,_0xc5b874);};}exports[_0xada3('0x4')]=function(_0xdc6d1d){for(var _0x20d831=0x0,_0x5f05a0=events['length'];_0x20d831<_0x5f05a0;_0x20d831++){var _0x4ee764=events[_0x20d831];var _0x5b94f1=createListener('userNotification:'+_0x4ee764,_0xdc6d1d);UserNotificationEvents['on'](_0x4ee764,_0x5b94f1);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5118b7d..651572a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x605564,_0x1211a2){var _0x3f39bc=function(_0x191e34){while(--_0x191e34){_0x605564['push'](_0x605564['shift']());}};_0x3f39bc(++_0x1211a2);}(_0x70e0,0x17b));var _0x070e=function(_0x4bd615,_0x4fe9c3){_0x4bd615=_0x4bd615-0x0;var _0x19e508=_0x70e0[_0x4bd615];return _0x19e508;};'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(_0x5db600,_0x57d287){var _0x1bbd18=function(_0x1d0fcf){while(--_0x1d0fcf){_0x5db600['push'](_0x5db600['shift']());}};_0x1bbd18(++_0x57d287);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fbc6cf4..b651700 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 _0x5a12=['INTEGER','sequelize','exports'];(function(_0x112ade,_0x2cbc3c){var _0x47a795=function(_0x403119){while(--_0x403119){_0x112ade['push'](_0x112ade['shift']());}};_0x47a795(++_0x2cbc3c);}(_0x5a12,0x18a));var _0x25a1=function(_0xb0a0ec,_0x1d5049){_0xb0a0ec=_0xb0a0ec-0x0;var _0x2e4900=_0x5a12[_0xb0a0ec];return _0x2e4900;};'use strict';var Sequelize=require(_0x25a1('0x0'));module[_0x25a1('0x1')]={'penalty':{'type':Sequelize[_0x25a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe6cd=['sequelize','exports','INTEGER'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xe6cd,0x159));var _0xde6c=function(_0x50837b,_0x413961){_0x50837b=_0x50837b-0x0;var _0x2b1257=_0xe6cd[_0x50837b];return _0x2b1257;};'use strict';var Sequelize=require(_0xde6c('0x0'));module[_0xde6c('0x1')]={'penalty':{'type':Sequelize[_0xde6c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 0c03eef..d47ed18 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 _0x96c5=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x96c5,0x127));var _0x596c=function(_0x259949,_0x475f5d){_0x259949=_0x259949-0x0;var _0x36025f=_0x96c5[_0x259949];return _0x36025f;};'use strict';var _=require('lodash');var util=require(_0x596c('0x0'));var logger=require(_0x596c('0x1'))('api');var moment=require(_0x596c('0x2'));var BPromise=require(_0x596c('0x3'));var rp=require(_0x596c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x596c('0x5'));var config=require(_0x596c('0x6'));var attributes=require(_0x596c('0x7'));module[_0x596c('0x8')]=function(_0x364040,_0x1c46c5){return _0x364040[_0x596c('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9662=['exports','define','UserOpenchannelQueue','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x508459,_0x2191e9){var _0x3e4e4a=function(_0x18896c){while(--_0x18896c){_0x508459['push'](_0x508459['shift']());}};_0x3e4e4a(++_0x2191e9);}(_0x9662,0xa8));var _0x2966=function(_0x253da3,_0x5a0220){_0x253da3=_0x253da3-0x0;var _0x4a75c2=_0x9662[_0x253da3];return _0x4a75c2;};'use strict';var _=require(_0x2966('0x0'));var util=require(_0x2966('0x1'));var logger=require('../../config/logger')(_0x2966('0x2'));var moment=require(_0x2966('0x3'));var BPromise=require('bluebird');var rp=require(_0x2966('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2966('0x5'));var config=require(_0x2966('0x6'));var attributes=require(_0x2966('0x7'));module[_0x2966('0x8')]=function(_0x428f78,_0x431b2d){return _0x428f78[_0x2966('0x9')](_0x2966('0xa'),attributes,{'tableName':'user_has_openchannel_queues','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 635ce13..eb9c81d 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 _0x2fe6=['http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x156094,_0x59d195){var _0x4264db=function(_0x278a73){while(--_0x278a73){_0x156094['push'](_0x156094['shift']());}};_0x4264db(++_0x59d195);}(_0x2fe6,0xe8));var _0x62fe=function(_0x26c08e,_0x325782){_0x26c08e=_0x26c08e-0x0;var _0x2db1de=_0x2fe6[_0x26c08e];return _0x2db1de;};'use strict';var _=require(_0x62fe('0x0'));var util=require(_0x62fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x62fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62fe('0x3'))['db'];var utils=require(_0x62fe('0x4'));var logger=require(_0x62fe('0x5'))(_0x62fe('0x6'));var config=require('../../config/environment');var jayson=require(_0x62fe('0x7'));var client=jayson['client'][_0x62fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28f7af,_0x4b59d8,_0x326a4c){return new BPromise(function(_0x373845,_0x51bc0a){return client['request'](_0x28f7af,_0x326a4c)[_0x62fe('0x9')](function(_0x178f17){logger[_0x62fe('0xa')](_0x62fe('0xb'),_0x4b59d8,_0x62fe('0xc'));logger[_0x62fe('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4b59d8,_0x62fe('0xc'),JSON[_0x62fe('0xe')](_0x178f17));if(_0x178f17[_0x62fe('0xf')]){if(_0x178f17[_0x62fe('0xf')][_0x62fe('0x10')]===0x1f4){logger[_0x62fe('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b59d8,_0x178f17['error'][_0x62fe('0x11')]);return _0x51bc0a(_0x178f17[_0x62fe('0xf')][_0x62fe('0x11')]);}logger[_0x62fe('0xf')](_0x62fe('0xb'),_0x4b59d8,_0x178f17[_0x62fe('0xf')][_0x62fe('0x11')]);return _0x373845(_0x178f17[_0x62fe('0xf')][_0x62fe('0x11')]);}else{logger[_0x62fe('0xa')](_0x62fe('0xb'),_0x4b59d8,_0x62fe('0xc'));_0x373845(_0x178f17[_0x62fe('0x12')][_0x62fe('0x11')]);}})[_0x62fe('0x13')](function(_0x1f46e6){logger[_0x62fe('0xf')](_0x62fe('0xb'),_0x4b59d8,_0x1f46e6);_0x51bc0a(_0x1f46e6);});});} \ No newline at end of file +var _0x3444=['rpc','jayson/promise','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5da7e4,_0x4b1f03){var _0x3d65a3=function(_0x40d09f){while(--_0x40d09f){_0x5da7e4['push'](_0x5da7e4['shift']());}};_0x3d65a3(++_0x4b1f03);}(_0x3444,0x1ae));var _0x4344=function(_0x5f1378,_0x4e5fe2){_0x5f1378=_0x5f1378-0x0;var _0x4afdd8=_0x3444[_0x5f1378];return _0x4afdd8;};'use strict';var _=require('lodash');var util=require(_0x4344('0x0'));var moment=require(_0x4344('0x1'));var BPromise=require(_0x4344('0x2'));var rs=require(_0x4344('0x3'));var fs=require('fs');var Redis=require(_0x4344('0x4'));var db=require(_0x4344('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4344('0x6'))(_0x4344('0x7'));var config=require('../../config/environment');var jayson=require(_0x4344('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2399da,_0x1cd46e,_0x2be091){return new BPromise(function(_0x70acb5,_0x472d38){return client[_0x4344('0x9')](_0x2399da,_0x2be091)[_0x4344('0xa')](function(_0x4c6d23){logger[_0x4344('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cd46e,_0x4344('0xc'));logger[_0x4344('0xd')](_0x4344('0xe'),_0x1cd46e,_0x4344('0xc'),JSON['stringify'](_0x4c6d23));if(_0x4c6d23['error']){if(_0x4c6d23['error']['code']===0x1f4){logger[_0x4344('0xf')](_0x4344('0x10'),_0x1cd46e,_0x4c6d23['error']['message']);return _0x472d38(_0x4c6d23[_0x4344('0xf')]['message']);}logger[_0x4344('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cd46e,_0x4c6d23[_0x4344('0xf')][_0x4344('0x11')]);return _0x70acb5(_0x4c6d23[_0x4344('0xf')]['message']);}else{logger['info'](_0x4344('0x10'),_0x1cd46e,_0x4344('0xc'));_0x70acb5(_0x4c6d23['result'][_0x4344('0x11')]);}})[_0x4344('0x12')](function(_0x12e299){logger[_0x4344('0xf')](_0x4344('0x10'),_0x1cd46e,_0x12e299);_0x472d38(_0x12e299);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 054892f..2cb8543 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 _0x82eb=['/:id/clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','post'];(function(_0x90009e,_0x3000d0){var _0x5d8db7=function(_0x34e83e){while(--_0x34e83e){_0x90009e['push'](_0x90009e['shift']());}};_0x5d8db7(++_0x3000d0);}(_0x82eb,0xaa));var _0xb82e=function(_0x14fd26,_0x1d3c76){_0x14fd26=_0x14fd26-0x0;var _0x27bdf6=_0x82eb[_0x14fd26];return _0x27bdf6;};'use strict';var multer=require(_0xb82e('0x0'));var util=require(_0xb82e('0x1'));var path=require(_0xb82e('0x2'));var timeout=require(_0xb82e('0x3'));var express=require(_0xb82e('0x4'));var router=express[_0xb82e('0x5')]();var fs_extra=require(_0xb82e('0x6'));var auth=require(_0xb82e('0x7'));var interaction=require(_0xb82e('0x8'));var config=require(_0xb82e('0x9'));var controller=require(_0xb82e('0xa'));router['get']('/',auth[_0xb82e('0xb')](),controller[_0xb82e('0xc')]);router[_0xb82e('0xd')](_0xb82e('0xe'),auth[_0xb82e('0xb')](),controller[_0xb82e('0xf')]);router[_0xb82e('0xd')](_0xb82e('0x10'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x11')]);router[_0xb82e('0xd')](_0xb82e('0x12'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x13')]);router[_0xb82e('0xd')](_0xb82e('0x14'),auth[_0xb82e('0xb')](),controller['getResources']);router[_0xb82e('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb82e('0x16'),auth['isAuthenticated'](),controller['clone']);router[_0xb82e('0x15')](_0xb82e('0x12'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x17')]);router['post'](_0xb82e('0x14'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x18')]);router[_0xb82e('0x19')](_0xb82e('0x10'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x1a')]);router[_0xb82e('0x1b')](_0xb82e('0x10'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x1c')]);router[_0xb82e('0x1b')](_0xb82e('0x12'),auth[_0xb82e('0xb')](),controller[_0xb82e('0x1d')]);router[_0xb82e('0x1b')]('/:id/resources',auth[_0xb82e('0xb')](),controller[_0xb82e('0x1e')]);module[_0xb82e('0x1f')]=router; \ No newline at end of file +var _0xdcd6=['delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put'];(function(_0x46d5ca,_0x2d1f63){var _0x1b1636=function(_0x261874){while(--_0x261874){_0x46d5ca['push'](_0x46d5ca['shift']());}};_0x1b1636(++_0x2d1f63);}(_0xdcd6,0x125));var _0x6dcd=function(_0x11aee3,_0x51469d){_0x11aee3=_0x11aee3-0x0;var _0x4f563f=_0xdcd6[_0x11aee3];return _0x4f563f;};'use strict';var multer=require(_0x6dcd('0x0'));var util=require(_0x6dcd('0x1'));var path=require(_0x6dcd('0x2'));var timeout=require(_0x6dcd('0x3'));var express=require(_0x6dcd('0x4'));var router=express[_0x6dcd('0x5')]();var fs_extra=require(_0x6dcd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6dcd('0x7'));var config=require(_0x6dcd('0x8'));var controller=require(_0x6dcd('0x9'));router[_0x6dcd('0xa')]('/',auth[_0x6dcd('0xb')](),controller[_0x6dcd('0xc')]);router[_0x6dcd('0xa')](_0x6dcd('0xd'),auth[_0x6dcd('0xb')](),controller[_0x6dcd('0xe')]);router[_0x6dcd('0xa')](_0x6dcd('0xf'),auth[_0x6dcd('0xb')](),controller['show']);router[_0x6dcd('0xa')](_0x6dcd('0x10'),auth['isAuthenticated'](),controller[_0x6dcd('0x11')]);router[_0x6dcd('0xa')](_0x6dcd('0x12'),auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x13')]);router[_0x6dcd('0x14')]('/',auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x15')]);router['post'](_0x6dcd('0x16'),auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x17')]);router[_0x6dcd('0x14')]('/:id/sections',auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x18')]);router[_0x6dcd('0x14')](_0x6dcd('0x12'),auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x19')]);router[_0x6dcd('0x1a')]('/:id',auth[_0x6dcd('0xb')](),controller['update']);router[_0x6dcd('0x1b')](_0x6dcd('0xf'),auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x1c')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x6dcd('0x1d')]);router[_0x6dcd('0x1b')](_0x6dcd('0x12'),auth[_0x6dcd('0xb')](),controller[_0x6dcd('0x1e')]);module[_0x6dcd('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a97f6fa..f0f3da6 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 _0x5a58=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','getDataValue','crudPermissions'];(function(_0x1231da,_0x184460){var _0x1a647a=function(_0x72a740){while(--_0x72a740){_0x1231da['push'](_0x1231da['shift']());}};_0x1a647a(++_0x184460);}(_0x5a58,0x89));var _0x85a5=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x5a58[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x85a5('0x0'));module[_0x85a5('0x1')]={'name':{'type':Sequelize[_0x85a5('0x2')],'allowNull':![],'unique':_0x85a5('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4c3bbb){this[_0x85a5('0x4')]('crudPermissions',_0x4c3bbb?_0x4c3bbb['join'](''):[]);},'get':function(){return this[_0x85a5('0x5')]('crudPermissions')?this['getDataValue'](_0x85a5('0x6'))[_0x85a5('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x85a5('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x85a5('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x14cb=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x596de3,_0xf801c0){var _0xbf541f=function(_0x3b7460){while(--_0x3b7460){_0x596de3['push'](_0x596de3['shift']());}};_0xbf541f(++_0xf801c0);}(_0x14cb,0x101));var _0xb14c=function(_0x7a0872,_0x27782b){_0x7a0872=_0x7a0872-0x0;var _0x2fcc10=_0x14cb[_0x7a0872];return _0x2fcc10;};'use strict';var Sequelize=require(_0xb14c('0x0'));module[_0xb14c('0x1')]={'name':{'type':Sequelize[_0xb14c('0x2')],'allowNull':![],'unique':_0xb14c('0x3')},'crudPermissions':{'type':Sequelize[_0xb14c('0x2')],'set':function(_0x2b15d6){this[_0xb14c('0x4')](_0xb14c('0x5'),_0x2b15d6?_0x2b15d6[_0xb14c('0x6')](''):[]);},'get':function(){return this[_0xb14c('0x7')]('crudPermissions')?this[_0xb14c('0x7')]('crudPermissions')[_0xb14c('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb14c('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d5fcde0..d559a3a 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 _0x9a71=['length','merge','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','UserProfileSection','create','describe','addSections','each','push','ids','includes','isEmpty','subsections','enabled','concat','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','UserProfile','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','show','params','rawAttributes','includeAll','include','catch','body','clone'];(function(_0x159d45,_0x17fb85){var _0x28d24a=function(_0x5c1a23){while(--_0x5c1a23){_0x159d45['push'](_0x159d45['shift']());}};_0x28d24a(++_0x17fb85);}(_0x9a71,0x10b));var _0x19a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a71[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x19a7('0x0'));var rimraf=require(_0x19a7('0x1'));var zipdir=require(_0x19a7('0x2'));var jsonpatch=require(_0x19a7('0x3'));var rp=require(_0x19a7('0x4'));var moment=require(_0x19a7('0x5'));var BPromise=require(_0x19a7('0x6'));var Mustache=require(_0x19a7('0x7'));var util=require(_0x19a7('0x8'));var path=require(_0x19a7('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x19a7('0xa'));var fs=require('fs');var fs_extra=require(_0x19a7('0xb'));var _=require(_0x19a7('0xc'));var squel=require(_0x19a7('0xd'));var crypto=require(_0x19a7('0xe'));var jsforce=require(_0x19a7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x19a7('0x10'));var Redis=require(_0x19a7('0x11'));var authService=require(_0x19a7('0x12'));var qs=require(_0x19a7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19a7('0x14'));var logger=require('../../config/logger')(_0x19a7('0x15'));var utils=require('../../config/utils');var config=require(_0x19a7('0x16'));var licenseUtil=require(_0x19a7('0x17'));var db=require(_0x19a7('0x18'))['db'];config[_0x19a7('0x19')]=_['defaults'](config[_0x19a7('0x19')],{'host':_0x19a7('0x1a'),'port':0x18eb});var socket=require(_0x19a7('0x1b'))(new Redis(config[_0x19a7('0x19')]));require(_0x19a7('0x1c'))[_0x19a7('0x1d')](socket);function respondWithStatusCode(_0x470e6d,_0x7176eb){_0x7176eb=_0x7176eb||0xcc;return function(_0x5df9fc){if(_0x5df9fc){return _0x470e6d[_0x19a7('0x1e')](_0x7176eb);}return _0x470e6d[_0x19a7('0x1f')](_0x7176eb)[_0x19a7('0x20')]();};}function respondWithResult(_0x3eebec,_0x417abb){_0x417abb=_0x417abb||0xc8;return function(_0x565290){if(_0x565290){return _0x3eebec[_0x19a7('0x1f')](_0x417abb)[_0x19a7('0x21')](_0x565290);}};}function respondWithFilteredResult(_0x7279f4,_0x3e8be3){return function(_0x5de9b3){if(_0x5de9b3){var _0x2eea1a=typeof _0x3e8be3[_0x19a7('0x22')]==='undefined'&&typeof _0x3e8be3['limit']==='undefined';var _0x38d7fe=_0x5de9b3[_0x19a7('0x23')];var _0x4afe84=_0x2eea1a?0x0:_0x3e8be3[_0x19a7('0x22')];var _0x8966a1=_0x2eea1a?_0x5de9b3[_0x19a7('0x23')]:_0x3e8be3[_0x19a7('0x22')]+_0x3e8be3[_0x19a7('0x24')];var _0x474dce;if(_0x8966a1>=_0x38d7fe){_0x8966a1=_0x38d7fe;_0x474dce=0xc8;}else{_0x474dce=0xce;}_0x7279f4[_0x19a7('0x1f')](_0x474dce);return _0x7279f4[_0x19a7('0x25')](_0x19a7('0x26'),_0x4afe84+'-'+_0x8966a1+'/'+_0x38d7fe)['json'](_0x5de9b3);}return null;};}function patchUpdates(_0x20cff0){return function(_0x422422){try{jsonpatch['apply'](_0x422422,_0x20cff0,!![]);}catch(_0x5a5dc5){return BPromise[_0x19a7('0x27')](_0x5a5dc5);}return _0x422422[_0x19a7('0x28')]();};}function saveUpdates(_0x79e9c2,_0x40dd1c){return function(_0xe4e107){if(_0xe4e107){return _0xe4e107[_0x19a7('0x29')](_0x79e9c2)[_0x19a7('0x2a')](function(_0x5b79c9){return _0x5b79c9;});}return null;};}function removeEntity(_0x31d39c,_0x508893){return function(_0x25f2bf){if(_0x25f2bf){return _0x25f2bf[_0x19a7('0x2b')]()[_0x19a7('0x2a')](function(){_0x31d39c['status'](0xcc)[_0x19a7('0x20')]();});}};}function handleEntityNotFound(_0x3bce08,_0x450134){return function(_0x5c5a40){if(!_0x5c5a40){_0x3bce08['sendStatus'](0x194);}return _0x5c5a40;};}function handleError(_0x4adcfc,_0x206e76){_0x206e76=_0x206e76||0x1f4;return function(_0x406336){logger[_0x19a7('0x2c')](_0x406336['stack']);if(_0x406336['name']){delete _0x406336[_0x19a7('0x2d')];}_0x4adcfc[_0x19a7('0x1f')](_0x206e76)[_0x19a7('0x2e')](_0x406336);};}exports[_0x19a7('0x2f')]=function(_0x2a6015,_0x24dcc3){var _0x3f4cff={},_0x3cea8f={},_0x5a7258={'count':0x0,'rows':[]};var _0x212c88=_[_0x19a7('0x30')](db[_0x19a7('0x31')]['rawAttributes'],function(_0x5720b7){return{'name':_0x5720b7['fieldName'],'type':_0x5720b7[_0x19a7('0x32')][_0x19a7('0x33')]};});_0x3cea8f['model']=_[_0x19a7('0x30')](_0x212c88,'name');_0x3cea8f[_0x19a7('0x34')]=_[_0x19a7('0x35')](_0x2a6015[_0x19a7('0x34')]);_0x3cea8f[_0x19a7('0x36')]=_['intersection'](_0x3cea8f[_0x19a7('0x37')],_0x3cea8f[_0x19a7('0x34')]);_0x3f4cff[_0x19a7('0x38')]=_[_0x19a7('0x39')](_0x3cea8f[_0x19a7('0x37')],qs[_0x19a7('0x3a')](_0x2a6015[_0x19a7('0x34')][_0x19a7('0x3a')]));_0x3f4cff[_0x19a7('0x38')]=_0x3f4cff['attributes']['length']?_0x3f4cff['attributes']:_0x3cea8f[_0x19a7('0x37')];if(!_0x2a6015['query'][_0x19a7('0x3b')](_0x19a7('0x3c'))){_0x3f4cff[_0x19a7('0x24')]=qs[_0x19a7('0x24')](_0x2a6015[_0x19a7('0x34')][_0x19a7('0x24')]);_0x3f4cff[_0x19a7('0x22')]=qs[_0x19a7('0x22')](_0x2a6015[_0x19a7('0x34')][_0x19a7('0x22')]);}_0x3f4cff[_0x19a7('0x3d')]=qs[_0x19a7('0x3e')](_0x2a6015['query'][_0x19a7('0x3e')]);_0x3f4cff['where']=qs['filters'](_[_0x19a7('0x3f')](_0x2a6015[_0x19a7('0x34')],_0x3cea8f[_0x19a7('0x36')]),_0x212c88);if(_0x2a6015[_0x19a7('0x34')][_0x19a7('0x40')]){_0x3f4cff[_0x19a7('0x41')]=_['merge'](_0x3f4cff[_0x19a7('0x41')],{'$or':_[_0x19a7('0x30')](_0x212c88,function(_0x4e75ab){if(_0x4e75ab[_0x19a7('0x32')]!=='VIRTUAL'){var _0xde86bf={};_0xde86bf[_0x4e75ab['name']]={'$like':'%'+_0x2a6015[_0x19a7('0x34')][_0x19a7('0x40')]+'%'};return _0xde86bf;}})});}_0x3f4cff=_['merge']({},_0x3f4cff,_0x2a6015[_0x19a7('0x42')]);var _0x3d9248={'where':_0x3f4cff['where']};return db['UserProfile'][_0x19a7('0x23')](_0x3d9248)[_0x19a7('0x2a')](function(_0x2d5ae7){_0x5a7258[_0x19a7('0x23')]=_0x2d5ae7;if(_0x2a6015[_0x19a7('0x34')]['includeAll']){_0x3f4cff['include']=[{'all':!![]}];}return db[_0x19a7('0x31')]['findAll'](_0x3f4cff);})[_0x19a7('0x2a')](function(_0x4ecc86){_0x5a7258['rows']=_0x4ecc86;return _0x5a7258;})[_0x19a7('0x2a')](respondWithFilteredResult(_0x24dcc3,_0x3f4cff))['catch'](handleError(_0x24dcc3,null));};exports[_0x19a7('0x43')]=function(_0x177107,_0x237ac5){var _0x179642={'raw':![],'where':{'id':_0x177107[_0x19a7('0x44')]['id']}},_0xac9c21={};_0xac9c21[_0x19a7('0x37')]=_[_0x19a7('0x35')](db[_0x19a7('0x31')][_0x19a7('0x45')]);_0xac9c21[_0x19a7('0x34')]=_[_0x19a7('0x35')](_0x177107['query']);_0xac9c21['filters']=_[_0x19a7('0x39')](_0xac9c21['model'],_0xac9c21[_0x19a7('0x34')]);_0x179642[_0x19a7('0x38')]=_[_0x19a7('0x39')](_0xac9c21[_0x19a7('0x37')],qs['fields'](_0x177107[_0x19a7('0x34')][_0x19a7('0x3a')]));_0x179642[_0x19a7('0x38')]=_0x179642['attributes']['length']?_0x179642[_0x19a7('0x38')]:_0xac9c21[_0x19a7('0x37')];if(_0x177107[_0x19a7('0x34')][_0x19a7('0x46')]){_0x179642[_0x19a7('0x47')]=[{'all':!![]}];}_0x179642=_['merge']({},_0x179642,_0x177107[_0x19a7('0x42')]);return db[_0x19a7('0x31')]['find'](_0x179642)[_0x19a7('0x2a')](handleEntityNotFound(_0x237ac5,null))['then'](respondWithResult(_0x237ac5,null))[_0x19a7('0x48')](handleError(_0x237ac5,null));};exports['create']=function(_0x34ae6c,_0x8565a1){return db[_0x19a7('0x31')]['create'](_0x34ae6c[_0x19a7('0x49')],{})[_0x19a7('0x2a')](respondWithResult(_0x8565a1,0xc9))['catch'](handleError(_0x8565a1,null));};exports[_0x19a7('0x4a')]=function(_0x14086e,_0x59ae19){var _0x5b4443={'where':{'id':_0x14086e[_0x19a7('0x44')]['id']}},_0x2c48fe={};_0x2c48fe['model']=_[_0x19a7('0x35')](db[_0x19a7('0x31')]['rawAttributes']);_0x5b4443[_0x19a7('0x38')]=_[_0x19a7('0x39')](_0x2c48fe[_0x19a7('0x37')],qs[_0x19a7('0x3a')](_0x14086e[_0x19a7('0x34')][_0x19a7('0x3a')]));_0x5b4443[_0x19a7('0x38')]=_0x5b4443[_0x19a7('0x38')][_0x19a7('0x4b')]?_0x5b4443['attributes']:_0x2c48fe[_0x19a7('0x37')];if(_0x14086e[_0x19a7('0x34')][_0x19a7('0x46')]){_0x5b4443[_0x19a7('0x47')]=[{'all':!![]}];}_0x5b4443=_[_0x19a7('0x4c')]({},_0x5b4443,_0x14086e[_0x19a7('0x42')]);return db[_0x19a7('0x31')][_0x19a7('0x4d')](_0x5b4443)[_0x19a7('0x2a')](handleEntityNotFound(_0x59ae19,null))['then'](function(_0x122c0e){if(_0x122c0e){var _0x57de05=_0x122c0e[_0x19a7('0x4e')]({'plain':!![]});_0x57de05=qs[_0x19a7('0x4f')](_0x57de05,['id','createdAt',_0x19a7('0x50'),_0x19a7('0x51')]);_0x14086e['body']=_[_0x19a7('0x4f')](_0x14086e[_0x19a7('0x49')],['id',_0x19a7('0x52'),'updatedAt']);return db[_0x19a7('0x53')][_0x19a7('0x54')](function(_0x3ac87e){return db[_0x19a7('0x31')]['create'](_['merge'](_0x57de05,_0x14086e[_0x19a7('0x49')]),{'include':_0x14086e[_0x19a7('0x34')][_0x19a7('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x3ac87e})[_0x19a7('0x2a')](function(_0x24405b){var _0x5c6262=_0x24405b[_0x19a7('0x4e')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x14086e[_0x19a7('0x44')]['id']},'raw':!![]})[_0x19a7('0x2a')](function(_0x1b8afd){if(_0x1b8afd){return BPromise['each'](_0x1b8afd,function(_0x5a27e9){return new BPromise(function(_0x441d91,_0x30c542){if(_0x5a27e9[_0x19a7('0x55')]===null||_0x5a27e9[_0x19a7('0x55')]===0x1)_0x441d91(null);return db[_0x19a7('0x56')][_0x19a7('0x57')]({'where':{'sectionId':_0x5a27e9['id']},'raw':!![]})[_0x19a7('0x2a')](function(_0xcfe557){var _0x15244a=_[_0x19a7('0x30')](_0xcfe557,function(_0x258919){return qs['omit'](_0x258919,['id','createdAt',_0x19a7('0x50'),_0x19a7('0x58')]);});_0x441d91(_0x15244a);})[_0x19a7('0x48')](function(_0xba890c){_0x30c542(_0xba890c);});})[_0x19a7('0x2a')](function(_0x5d8f76){var _0x5156ae=qs[_0x19a7('0x4f')](_0x5a27e9,['id',_0x19a7('0x52'),_0x19a7('0x50')]);_0x5156ae[_0x19a7('0x59')]=_0x5c6262['id'];if(_0x5d8f76)_0x5156ae[_0x19a7('0x5a')]=_0x5d8f76;return _0x5156ae;})['then'](function(_0x522e86){return db[_0x19a7('0x5b')][_0x19a7('0x5c')](_0x522e86,{'include':[{'model':db[_0x19a7('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x3ac87e});});})[_0x19a7('0x2a')](function(){return _0x5c6262;});}});});});}})[_0x19a7('0x2a')](respondWithResult(_0x59ae19,0xc9))['catch'](handleError(_0x59ae19,null));};exports[_0x19a7('0x29')]=function(_0x5221b5,_0x131b87){if(_0x5221b5['body']['id']){delete _0x5221b5[_0x19a7('0x49')]['id'];}return db[_0x19a7('0x31')][_0x19a7('0x4d')]({'where':{'id':_0x5221b5[_0x19a7('0x44')]['id']}})[_0x19a7('0x2a')](handleEntityNotFound(_0x131b87,null))[_0x19a7('0x2a')](saveUpdates(_0x5221b5[_0x19a7('0x49')],null))[_0x19a7('0x2a')](respondWithResult(_0x131b87,null))[_0x19a7('0x48')](handleError(_0x131b87,null));};exports[_0x19a7('0x2b')]=function(_0x11f620,_0xe80cd3){return db[_0x19a7('0x31')][_0x19a7('0x4d')]({'where':{'id':_0x11f620[_0x19a7('0x44')]['id']}})[_0x19a7('0x2a')](handleEntityNotFound(_0xe80cd3,null))[_0x19a7('0x2a')](removeEntity(_0xe80cd3,null))['catch'](handleError(_0xe80cd3,null));};exports[_0x19a7('0x5d')]=function(_0xd7bc40,_0x3d5b70){return db[_0x19a7('0x31')][_0x19a7('0x5d')]()[_0x19a7('0x2a')](respondWithResult(_0x3d5b70,null))[_0x19a7('0x48')](handleError(_0x3d5b70,null));};exports[_0x19a7('0x5e')]=function(_0x86511b,_0x5a52fc){var _0x1bbeb6=_0x86511b['body'];return db['UserProfile']['find']({'where':{'id':_0x86511b[_0x19a7('0x44')]['id']}})[_0x19a7('0x2a')](handleEntityNotFound(_0x5a52fc,null))[_0x19a7('0x2a')](function(_0x3bbad1){if(_0x3bbad1){return db[_0x19a7('0x53')]['transaction'](function(_0x13659b){return db['UserProfileSection'][_0x19a7('0x2b')]({'where':{'userProfileId':_0x86511b['params']['id'],'sectionId':_['map'](_0x1bbeb6,function(_0x1cd37b){return _0x1cd37b['sectionId'];})},'transaction':_0x13659b})[_0x19a7('0x2a')](function(){var _0x471b61=_[_0x19a7('0x30')](_0x1bbeb6,function(_0x57a3a8){_0x57a3a8[_0x19a7('0x59')]=_0x86511b[_0x19a7('0x44')]['id'];return _0x57a3a8;});var _0x23b956=[];return BPromise[_0x19a7('0x5f')](_0x471b61,function(_0x1e7609){return db['UserProfileSection'][_0x19a7('0x5c')](_0x1e7609,{'include':[{'model':db[_0x19a7('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x13659b})[_0x19a7('0x2a')](function(_0x5dffcd){_0x23b956[_0x19a7('0x60')](_0x5dffcd[_0x19a7('0x4e')]({'plain':!![]}));});})[_0x19a7('0x2a')](function(){return _0x23b956;});});});}})[_0x19a7('0x2a')](function(_0xfab067){return _0xfab067;})[_0x19a7('0x2a')](respondWithResult(_0x5a52fc,null))[_0x19a7('0x48')](handleError(_0x5a52fc,null));};exports['removeSections']=function(_0x2259f5,_0x3d0bcf){var _0xdb3b70;return db[_0x19a7('0x31')][_0x19a7('0x4d')]({'where':{'id':_0x2259f5['params']['id']},'attributes':['id',_0x19a7('0x2d')]})[_0x19a7('0x2a')](handleEntityNotFound(_0x3d0bcf,null))[_0x19a7('0x2a')](function(_0x254b17){if(_0x254b17){_0xdb3b70=_0x254b17;return db[_0x19a7('0x5b')][_0x19a7('0x2b')]({'where':{'userProfileId':_0x2259f5[_0x19a7('0x44')]['id'],'sectionId':_0x2259f5[_0x19a7('0x34')][_0x19a7('0x61')]}});}})[_0x19a7('0x2a')](function(){return _0xdb3b70;})['then'](respondWithStatusCode(_0x3d0bcf,null))[_0x19a7('0x48')](handleError(_0x3d0bcf,null));};exports['getSections']=function(_0x3cc7c7,_0x184d62){var _0x457acb=[];var _0x168cd6=[];return db['UserProfileSection'][_0x19a7('0x57')]({'where':{'userProfileId':_0x3cc7c7[_0x19a7('0x44')]['id']},'raw':!![]})['then'](function(_0x3c9880){_0x457acb=_[_0x19a7('0x40')](_0x3c9880,function(_0x59f023){return _0x59f023['enabled']===0x1||_[_0x19a7('0x62')]([0x3eb,0x709],_0x59f023['sectionId']);});if(!_[_0x19a7('0x63')](_0x457acb)){return _[_0x19a7('0x30')](_0x457acb,function(_0x2d8d48){return _0x2d8d48[_0x19a7('0x58')];});}else{return;}})['then'](function(_0x1126f5){if(_0x1126f5)_0x168cd6=_0x1126f5;if(_[_0x19a7('0x62')](_0x168cd6,0x64)){var _0x423848=_['find'](_0x457acb,{'sectionId':0x64});return hasDefaultDashboard(_0x423848)['then'](function(_0x3527a1){return _[_0x19a7('0x30')](_0x457acb,function(_0x4b1aef){if(_0x4b1aef[_0x19a7('0x58')]===0x64){_0x4b1aef[_0x19a7('0x64')]=_0x3527a1;}return _0x4b1aef;});});}else{return;}})[_0x19a7('0x2a')](function(_0x719b5f){if(_0x719b5f)_0x457acb=_0x719b5f;if(_[_0x19a7('0x62')](_0x168cd6,0x3eb)){var _0x1d36f3=_[_0x19a7('0x4d')](_0x457acb,{'sectionId':0x3eb});return getCustomDashboards(_0x1d36f3)['then'](function(_0x34066f){return _[_0x19a7('0x30')](_0x457acb,function(_0x4c5b8d){if(_0x1d36f3[_0x19a7('0x65')]){if(_0x4c5b8d[_0x19a7('0x58')]===0x3eb){_0x4c5b8d['subsections']=_0x34066f;}}else{if(_0x4c5b8d[_0x19a7('0x58')]===0x64){if(!_0x4c5b8d[_0x19a7('0x64')]){_0x4c5b8d[_0x19a7('0x64')]=[];}_0x4c5b8d[_0x19a7('0x64')]=_0x4c5b8d[_0x19a7('0x64')][_0x19a7('0x66')](_0x34066f);}}return _0x4c5b8d;});});}else{return;}})[_0x19a7('0x2a')](function(_0x3471e0){if(_0x3471e0)_0x457acb=_0x3471e0;if(_[_0x19a7('0x62')](_0x168cd6,0x709)){var _0x38125e=_[_0x19a7('0x4d')](_0x457acb,{'sectionId':0x709});return getPlugins(_0x38125e)[_0x19a7('0x2a')](function(_0x54a764){if(_0x38125e[_0x19a7('0x65')]){return _['map'](_0x457acb,function(_0x225d00){if(_0x225d00[_0x19a7('0x58')]===0x709){_0x225d00[_0x19a7('0x64')]=_0x54a764;}return _0x225d00;});}else{var _0x83d8bb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x54a764};var _0x2b5e7d=_[_0x19a7('0x30')](_0x457acb);_0x2b5e7d[_0x19a7('0x60')](_0x83d8bb);return _0x2b5e7d;}});}else{return;}})['then'](function(_0x30a9f8){if(_0x30a9f8)_0x457acb=_0x30a9f8;return _[_0x19a7('0x40')](_0x457acb,['enabled',0x1]);})['then'](respondWithResult(_0x184d62,null))[_0x19a7('0x48')](handleError(_0x184d62,null));};function hasDefaultDashboard(_0x636ef3){var _0x4224c8=[0x65];return new BPromise(function(_0x4b135a,_0x1f97ae){try{if(_0x636ef3['autoAssociation']){_0x4b135a(_0x4224c8);}else{return db[_0x19a7('0x56')][_0x19a7('0x67')]({'where':{'sectionId':_0x636ef3['id']},'raw':!![]})[_0x19a7('0x2a')](function(_0x2b58f8){_0x2b58f8?_0x4b135a(_0x4224c8):_0x4b135a();});}}catch(_0x32dc2b){_0x1f97ae(_0x32dc2b);}});}function getCustomDashboards(_0x4e9681){var _0x3ba05d=[];return new BPromise(function(_0x42efb8,_0x35db71){try{if(_0x4e9681[_0x19a7('0x55')]){return db['Dashboard'][_0x19a7('0x57')]({'raw':!![]})[_0x19a7('0x2a')](function(_0x46a76f){_0x46a76f[_0x19a7('0x68')](function(_0x4c7887){_0x3ba05d[_0x19a7('0x60')](_0x4c7887['id']+0x1869f);});_0x42efb8(_0x3ba05d);});}else{return db[_0x19a7('0x56')][_0x19a7('0x57')]({'where':{'sectionId':_0x4e9681['id']},'raw':!![]})[_0x19a7('0x2a')](function(_0x12efd9){_0x12efd9[_0x19a7('0x68')](function(_0x13fa01){_0x3ba05d[_0x19a7('0x60')](_0x13fa01[_0x19a7('0x69')]+0x1869f);});_0x42efb8(_0x3ba05d);});}}catch(_0x2bde6d){_0x35db71(_0x2bde6d);}});}function getPlugins(_0x13486d){var _0x176caf=[];return new BPromise(function(_0x562788,_0x49e809){try{if(_0x13486d[_0x19a7('0x55')]){return db[_0x19a7('0x6a')][_0x19a7('0x57')]({'raw':!![]})[_0x19a7('0x2a')](function(_0xb56a8){_0xb56a8[_0x19a7('0x68')](function(_0x1b3d4c){_0x176caf[_0x19a7('0x60')](_0x1b3d4c['id']+0x15b38);});_0x562788(_0x176caf);});}else{return db[_0x19a7('0x56')][_0x19a7('0x57')]({'where':{'sectionId':_0x13486d['id']},'raw':!![]})[_0x19a7('0x2a')](function(_0x1c03aa){_0x1c03aa['forEach'](function(_0x5c0814){_0x176caf['push'](_0x5c0814['resourceId']+0x15b38);});_0x562788(_0x176caf);});}}catch(_0xb530e2){_0x49e809(_0xb530e2);}});}exports[_0x19a7('0x6b')]=function(_0xf166cb,_0x3ba673){return db[_0x19a7('0x31')][_0x19a7('0x4d')]({'where':{'id':_0xf166cb[_0x19a7('0x44')]['id']}})[_0x19a7('0x2a')](handleEntityNotFound(_0x3ba673,null))['then'](function(_0x1fa711){if(_0x1fa711){return db[_0x19a7('0x53')][_0x19a7('0x54')](function(_0x249b8d){return db[_0x19a7('0x5b')][_0x19a7('0x57')]({'where':{'userProfileId':_0xf166cb[_0x19a7('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x19a7('0x2a')](function(_0x1759fb){if(_0x1759fb){return db[_0x19a7('0x5b')][_0x19a7('0x2b')]({'where':{'userProfileId':_0xf166cb['params']['id'],'id':_[_0x19a7('0x30')](_0x1759fb,function(_0x2c7ea1){return _0x2c7ea1['id'];})},'transaction':_0x249b8d});}})[_0x19a7('0x2a')](function(_0x309414){var _0x2ec67e=_[_0x19a7('0x30')](_0xf166cb[_0x19a7('0x49')],function(_0x113998){_0x113998[_0x19a7('0x59')]=_0xf166cb[_0x19a7('0x44')]['id'];return _0x113998;});return db['UserProfileSection'][_0x19a7('0x6c')](_0x2ec67e,{'raw':!![],'transaction':_0x249b8d});})['then'](function(_0x1aab6d){var _0x18a836=_['filter'](_['map'](_0x1aab6d,function(_0x5d78be){return _0x5d78be[_0x19a7('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x18a836){return db[_0x19a7('0x5b')]['findAll']({'where':{'userProfileId':_0xf166cb[_0x19a7('0x44')]['id'],'sectionId':_[_0x19a7('0x30')](_0x18a836,function(_0x7ec4b1){return _0x7ec4b1['sectionId'];})},'attributes':['id',_0x19a7('0x58')],'raw':!![]})[_0x19a7('0x2a')](function(_0x563ee2){var _0x233bee=_[_0x19a7('0x30')](_0xf166cb[_0x19a7('0x49')],function(_0x45f2e2){_0x45f2e2[_0x19a7('0x59')]=_0xf166cb[_0x19a7('0x44')]['id'];return _0x45f2e2;});return db[_0x19a7('0x56')][_0x19a7('0x6c')](_0x233bee,{'raw':!![],'transaction':_0x249b8d});});}})[_0x19a7('0x48')](handleError(_0x3ba673,null));});}})[_0x19a7('0x2a')](function(_0x359a69){var _0x1e6f83=_['map'](_0x359a69,function(_0x5a7e8f){return _0x5a7e8f['get']({'plain':!![]});});})[_0x19a7('0x2a')](respondWithResult(_0x3ba673,null))[_0x19a7('0x48')](handleError(_0x3ba673,null));};exports[_0x19a7('0x6d')]=function(_0x6e5391,_0x419747,_0x2755d6){return db[_0x19a7('0x31')][_0x19a7('0x4d')]({'where':{'id':_0x6e5391[_0x19a7('0x44')]['id']}})[_0x19a7('0x2a')](handleEntityNotFound(_0x419747,null))[_0x19a7('0x2a')](function(_0x4fecd6){if(_0x4fecd6){return _0x4fecd6['removeResources'](_0x6e5391['query'][_0x19a7('0x61')]);}})[_0x19a7('0x2a')](respondWithStatusCode(_0x419747,null))['catch'](handleError(_0x419747,null));};exports[_0x19a7('0x6e')]=function(_0x3cd57d,_0x54f344){var _0x484d6d={};if(!_0x3cd57d['query'][_0x19a7('0x6f')])throw new Error(_0x19a7('0x70'));if(!_0x3cd57d[_0x19a7('0x34')]['hasOwnProperty'](_0x19a7('0x3c'))){_0x484d6d[_0x19a7('0x24')]=qs[_0x19a7('0x24')](_0x3cd57d['query'][_0x19a7('0x24')]);_0x484d6d[_0x19a7('0x22')]=qs[_0x19a7('0x22')](_0x3cd57d[_0x19a7('0x34')][_0x19a7('0x22')]);}return db['UserProfile'][_0x19a7('0x4d')]({'where':{'id':_0x3cd57d[_0x19a7('0x44')]['id']}})['then'](function(_0x1db3b2){if(!_0x1db3b2)throw new Error(_0x19a7('0x71')+_0x3cd57d[_0x19a7('0x44')]['id']);return db[_0x19a7('0x31')][_0x19a7('0x6e')](_0x3cd57d);})[_0x19a7('0x2a')](respondWithFilteredResult(_0x54f344,_0x484d6d))[_0x19a7('0x48')](handleError(_0x54f344,null));}; \ No newline at end of file +var _0xd47e=['each','autoAssociation','userProfileId','Resources','describe','addSections','sectionId','UserProfileResource','push','removeSections','ids','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','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','defaults','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','options','includeAll','include','UserProfile','findAll','catch','show','params','intersection','merge','find','create','body','get','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','UserProfileSection'];(function(_0x4713e4,_0x5687c4){var _0x2e2009=function(_0x87eae2){while(--_0x87eae2){_0x4713e4['push'](_0x4713e4['shift']());}};_0x2e2009(++_0x5687c4);}(_0xd47e,0x16f));var _0xed47=function(_0x566733,_0x23ceb9){_0x566733=_0x566733-0x0;var _0x3b4bda=_0xd47e[_0x566733];return _0x3b4bda;};'use strict';var emlformat=require(_0xed47('0x0'));var rimraf=require(_0xed47('0x1'));var zipdir=require(_0xed47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed47('0x3'));var moment=require(_0xed47('0x4'));var BPromise=require(_0xed47('0x5'));var Mustache=require(_0xed47('0x6'));var util=require(_0xed47('0x7'));var path=require(_0xed47('0x8'));var sox=require(_0xed47('0x9'));var csv=require(_0xed47('0xa'));var ejs=require(_0xed47('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed47('0xc'));var squel=require('squel');var crypto=require(_0xed47('0xd'));var jsforce=require(_0xed47('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed47('0xa'));var querystring=require(_0xed47('0xf'));var Papa=require(_0xed47('0x10'));var Redis=require(_0xed47('0x11'));var authService=require(_0xed47('0x12'));var qs=require(_0xed47('0x13'));var as=require(_0xed47('0x14'));var hardwareService=require(_0xed47('0x15'));var logger=require(_0xed47('0x16'))('api');var utils=require(_0xed47('0x17'));var config=require(_0xed47('0x18'));var licenseUtil=require(_0xed47('0x19'));var db=require(_0xed47('0x1a'))['db'];config['redis']=_[_0xed47('0x1b')](config['redis'],{'host':_0xed47('0x1c'),'port':0x18eb});var socket=require(_0xed47('0x1d'))(new Redis(config[_0xed47('0x1e')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x46026e,_0xc6fb19){_0xc6fb19=_0xc6fb19||0xcc;return function(_0x316b6b){if(_0x316b6b){return _0x46026e[_0xed47('0x1f')](_0xc6fb19);}return _0x46026e[_0xed47('0x20')](_0xc6fb19)[_0xed47('0x21')]();};}function respondWithResult(_0x32c437,_0x2b70a3){_0x2b70a3=_0x2b70a3||0xc8;return function(_0x2cfa7e){if(_0x2cfa7e){return _0x32c437['status'](_0x2b70a3)[_0xed47('0x22')](_0x2cfa7e);}};}function respondWithFilteredResult(_0x27acd8,_0x3caf2b){return function(_0x22043d){if(_0x22043d){var _0x1e119e=typeof _0x3caf2b[_0xed47('0x23')]===_0xed47('0x24')&&typeof _0x3caf2b[_0xed47('0x25')]===_0xed47('0x24');var _0x2e8c7f=_0x22043d[_0xed47('0x26')];var _0x55db55=_0x1e119e?0x0:_0x3caf2b['offset'];var _0x31af4e=_0x1e119e?_0x22043d[_0xed47('0x26')]:_0x3caf2b[_0xed47('0x23')]+_0x3caf2b['limit'];var _0x2ef60f;if(_0x31af4e>=_0x2e8c7f){_0x31af4e=_0x2e8c7f;_0x2ef60f=0xc8;}else{_0x2ef60f=0xce;}_0x27acd8[_0xed47('0x20')](_0x2ef60f);return _0x27acd8[_0xed47('0x27')](_0xed47('0x28'),_0x55db55+'-'+_0x31af4e+'/'+_0x2e8c7f)[_0xed47('0x22')](_0x22043d);}return null;};}function patchUpdates(_0x1c54a7){return function(_0x468ef1){try{jsonpatch[_0xed47('0x29')](_0x468ef1,_0x1c54a7,!![]);}catch(_0x137220){return BPromise['reject'](_0x137220);}return _0x468ef1['save']();};}function saveUpdates(_0x380d7e,_0x296a67){return function(_0x592194){if(_0x592194){return _0x592194[_0xed47('0x2a')](_0x380d7e)[_0xed47('0x2b')](function(_0x14ff0d){return _0x14ff0d;});}return null;};}function removeEntity(_0xc2ed82,_0x5995d2){return function(_0x3a1e4d){if(_0x3a1e4d){return _0x3a1e4d[_0xed47('0x2c')]()[_0xed47('0x2b')](function(){_0xc2ed82[_0xed47('0x20')](0xcc)[_0xed47('0x21')]();});}};}function handleEntityNotFound(_0x3d8bd8,_0x210d17){return function(_0x663fef){if(!_0x663fef){_0x3d8bd8[_0xed47('0x1f')](0x194);}return _0x663fef;};}function handleError(_0x39d522,_0x333776){_0x333776=_0x333776||0x1f4;return function(_0x7a90b0){logger[_0xed47('0x2d')](_0x7a90b0[_0xed47('0x2e')]);if(_0x7a90b0[_0xed47('0x2f')]){delete _0x7a90b0[_0xed47('0x2f')];}_0x39d522['status'](_0x333776)['send'](_0x7a90b0);};}exports[_0xed47('0x30')]=function(_0x1fb597,_0x4dd1bc){var _0x3cdd4c={},_0x325ce5={},_0x4480b8={'count':0x0,'rows':[]};var _0x1cd631=_[_0xed47('0x31')](db['UserProfile'][_0xed47('0x32')],function(_0x8bc7f5){return{'name':_0x8bc7f5[_0xed47('0x33')],'type':_0x8bc7f5['type'][_0xed47('0x34')]};});_0x325ce5[_0xed47('0x35')]=_[_0xed47('0x31')](_0x1cd631,_0xed47('0x2f'));_0x325ce5[_0xed47('0x36')]=_[_0xed47('0x37')](_0x1fb597[_0xed47('0x36')]);_0x325ce5[_0xed47('0x38')]=_['intersection'](_0x325ce5[_0xed47('0x35')],_0x325ce5[_0xed47('0x36')]);_0x3cdd4c[_0xed47('0x39')]=_['intersection'](_0x325ce5[_0xed47('0x35')],qs['fields'](_0x1fb597[_0xed47('0x36')][_0xed47('0x3a')]));_0x3cdd4c['attributes']=_0x3cdd4c[_0xed47('0x39')][_0xed47('0x3b')]?_0x3cdd4c[_0xed47('0x39')]:_0x325ce5[_0xed47('0x35')];if(!_0x1fb597[_0xed47('0x36')][_0xed47('0x3c')](_0xed47('0x3d'))){_0x3cdd4c[_0xed47('0x25')]=qs[_0xed47('0x25')](_0x1fb597['query'][_0xed47('0x25')]);_0x3cdd4c[_0xed47('0x23')]=qs['offset'](_0x1fb597[_0xed47('0x36')][_0xed47('0x23')]);}_0x3cdd4c[_0xed47('0x3e')]=qs['sort'](_0x1fb597[_0xed47('0x36')]['sort']);_0x3cdd4c[_0xed47('0x3f')]=qs[_0xed47('0x38')](_[_0xed47('0x40')](_0x1fb597['query'],_0x325ce5[_0xed47('0x38')]),_0x1cd631);if(_0x1fb597['query'][_0xed47('0x41')]){_0x3cdd4c['where']=_['merge'](_0x3cdd4c['where'],{'$or':_['map'](_0x1cd631,function(_0x3f0ec1){if(_0x3f0ec1[_0xed47('0x42')]!==_0xed47('0x43')){var _0x3d47a0={};_0x3d47a0[_0x3f0ec1['name']]={'$like':'%'+_0x1fb597['query'][_0xed47('0x41')]+'%'};return _0x3d47a0;}})});}_0x3cdd4c=_['merge']({},_0x3cdd4c,_0x1fb597[_0xed47('0x44')]);var _0x5edbbe={'where':_0x3cdd4c[_0xed47('0x3f')]};return db['UserProfile']['count'](_0x5edbbe)[_0xed47('0x2b')](function(_0x2fbaa2){_0x4480b8[_0xed47('0x26')]=_0x2fbaa2;if(_0x1fb597[_0xed47('0x36')][_0xed47('0x45')]){_0x3cdd4c[_0xed47('0x46')]=[{'all':!![]}];}return db[_0xed47('0x47')][_0xed47('0x48')](_0x3cdd4c);})[_0xed47('0x2b')](function(_0x5aa550){_0x4480b8['rows']=_0x5aa550;return _0x4480b8;})[_0xed47('0x2b')](respondWithFilteredResult(_0x4dd1bc,_0x3cdd4c))[_0xed47('0x49')](handleError(_0x4dd1bc,null));};exports[_0xed47('0x4a')]=function(_0xe5d59c,_0x1306c2){var _0x5f374f={'raw':![],'where':{'id':_0xe5d59c[_0xed47('0x4b')]['id']}},_0x103ef4={};_0x103ef4[_0xed47('0x35')]=_['keys'](db[_0xed47('0x47')]['rawAttributes']);_0x103ef4[_0xed47('0x36')]=_[_0xed47('0x37')](_0xe5d59c['query']);_0x103ef4[_0xed47('0x38')]=_[_0xed47('0x4c')](_0x103ef4[_0xed47('0x35')],_0x103ef4[_0xed47('0x36')]);_0x5f374f[_0xed47('0x39')]=_[_0xed47('0x4c')](_0x103ef4['model'],qs[_0xed47('0x3a')](_0xe5d59c['query']['fields']));_0x5f374f['attributes']=_0x5f374f[_0xed47('0x39')][_0xed47('0x3b')]?_0x5f374f[_0xed47('0x39')]:_0x103ef4['model'];if(_0xe5d59c[_0xed47('0x36')][_0xed47('0x45')]){_0x5f374f[_0xed47('0x46')]=[{'all':!![]}];}_0x5f374f=_[_0xed47('0x4d')]({},_0x5f374f,_0xe5d59c[_0xed47('0x44')]);return db[_0xed47('0x47')][_0xed47('0x4e')](_0x5f374f)[_0xed47('0x2b')](handleEntityNotFound(_0x1306c2,null))['then'](respondWithResult(_0x1306c2,null))['catch'](handleError(_0x1306c2,null));};exports['create']=function(_0x1cfc22,_0x5f1f72){return db[_0xed47('0x47')][_0xed47('0x4f')](_0x1cfc22[_0xed47('0x50')],{})[_0xed47('0x2b')](respondWithResult(_0x5f1f72,0xc9))[_0xed47('0x49')](handleError(_0x5f1f72,null));};exports['clone']=function(_0x49c218,_0x5cf4ca){var _0x35a277={'where':{'id':_0x49c218[_0xed47('0x4b')]['id']}},_0x260024={};_0x260024[_0xed47('0x35')]=_[_0xed47('0x37')](db['UserProfile'][_0xed47('0x32')]);_0x35a277['attributes']=_[_0xed47('0x4c')](_0x260024[_0xed47('0x35')],qs[_0xed47('0x3a')](_0x49c218[_0xed47('0x36')][_0xed47('0x3a')]));_0x35a277[_0xed47('0x39')]=_0x35a277[_0xed47('0x39')][_0xed47('0x3b')]?_0x35a277[_0xed47('0x39')]:_0x260024['model'];if(_0x49c218['query'][_0xed47('0x45')]){_0x35a277['include']=[{'all':!![]}];}_0x35a277=_[_0xed47('0x4d')]({},_0x35a277,_0x49c218[_0xed47('0x44')]);return db[_0xed47('0x47')][_0xed47('0x4e')](_0x35a277)[_0xed47('0x2b')](handleEntityNotFound(_0x5cf4ca,null))[_0xed47('0x2b')](function(_0x39c719){if(_0x39c719){var _0x2bf86f=_0x39c719[_0xed47('0x51')]({'plain':!![]});_0x2bf86f=qs['omit'](_0x2bf86f,['id',_0xed47('0x52'),_0xed47('0x53'),_0xed47('0x54')]);_0x49c218[_0xed47('0x50')]=_[_0xed47('0x55')](_0x49c218[_0xed47('0x50')],['id',_0xed47('0x52'),_0xed47('0x53')]);return db[_0xed47('0x56')][_0xed47('0x57')](function(_0x21e2d7){return db[_0xed47('0x47')]['create'](_[_0xed47('0x4d')](_0x2bf86f,_0x49c218[_0xed47('0x50')]),{'include':_0x49c218['query'][_0xed47('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x21e2d7})[_0xed47('0x2b')](function(_0x336e1d){var _0x144a88=_0x336e1d[_0xed47('0x51')]({'plain':!![]});return db[_0xed47('0x58')][_0xed47('0x48')]({'where':{'userProfileId':_0x49c218['params']['id']},'raw':!![]})[_0xed47('0x2b')](function(_0x4f97e9){if(_0x4f97e9){return BPromise[_0xed47('0x59')](_0x4f97e9,function(_0x480c60){return new BPromise(function(_0x1b07c2,_0x475d9e){if(_0x480c60[_0xed47('0x5a')]===null||_0x480c60['autoAssociation']===0x1)_0x1b07c2(null);return db['UserProfileResource'][_0xed47('0x48')]({'where':{'sectionId':_0x480c60['id']},'raw':!![]})[_0xed47('0x2b')](function(_0x4fa75b){var _0x5e4067=_[_0xed47('0x31')](_0x4fa75b,function(_0xbd205a){return qs[_0xed47('0x55')](_0xbd205a,['id',_0xed47('0x52'),_0xed47('0x53'),'sectionId']);});_0x1b07c2(_0x5e4067);})[_0xed47('0x49')](function(_0x52d873){_0x475d9e(_0x52d873);});})[_0xed47('0x2b')](function(_0x8db595){var _0x11ea8d=qs[_0xed47('0x55')](_0x480c60,['id',_0xed47('0x52'),'updatedAt']);_0x11ea8d[_0xed47('0x5b')]=_0x144a88['id'];if(_0x8db595)_0x11ea8d['Resources']=_0x8db595;return _0x11ea8d;})[_0xed47('0x2b')](function(_0x1f7fd8){return db[_0xed47('0x58')]['create'](_0x1f7fd8,{'include':[{'model':db['UserProfileResource'],'as':_0xed47('0x5c')}],'raw':!![],'transaction':_0x21e2d7});});})[_0xed47('0x2b')](function(){return _0x144a88;});}});});});}})['then'](respondWithResult(_0x5cf4ca,0xc9))[_0xed47('0x49')](handleError(_0x5cf4ca,null));};exports[_0xed47('0x2a')]=function(_0x331b72,_0x4a6d51){if(_0x331b72[_0xed47('0x50')]['id']){delete _0x331b72[_0xed47('0x50')]['id'];}return db[_0xed47('0x47')]['find']({'where':{'id':_0x331b72[_0xed47('0x4b')]['id']}})[_0xed47('0x2b')](handleEntityNotFound(_0x4a6d51,null))[_0xed47('0x2b')](saveUpdates(_0x331b72[_0xed47('0x50')],null))[_0xed47('0x2b')](respondWithResult(_0x4a6d51,null))[_0xed47('0x49')](handleError(_0x4a6d51,null));};exports[_0xed47('0x2c')]=function(_0x35acf4,_0x421f3a){return db[_0xed47('0x47')][_0xed47('0x4e')]({'where':{'id':_0x35acf4['params']['id']}})[_0xed47('0x2b')](handleEntityNotFound(_0x421f3a,null))[_0xed47('0x2b')](removeEntity(_0x421f3a,null))[_0xed47('0x49')](handleError(_0x421f3a,null));};exports['describe']=function(_0x56ca97,_0x573478){return db[_0xed47('0x47')][_0xed47('0x5d')]()[_0xed47('0x2b')](respondWithResult(_0x573478,null))[_0xed47('0x49')](handleError(_0x573478,null));};exports[_0xed47('0x5e')]=function(_0xf3f058,_0x22eb18){var _0x2f52ff=_0xf3f058[_0xed47('0x50')];return db[_0xed47('0x47')][_0xed47('0x4e')]({'where':{'id':_0xf3f058['params']['id']}})['then'](handleEntityNotFound(_0x22eb18,null))[_0xed47('0x2b')](function(_0xd6d208){if(_0xd6d208){return db[_0xed47('0x56')]['transaction'](function(_0x4fdddc){return db[_0xed47('0x58')]['destroy']({'where':{'userProfileId':_0xf3f058[_0xed47('0x4b')]['id'],'sectionId':_['map'](_0x2f52ff,function(_0x3ac89c){return _0x3ac89c[_0xed47('0x5f')];})},'transaction':_0x4fdddc})[_0xed47('0x2b')](function(){var _0x1b1957=_[_0xed47('0x31')](_0x2f52ff,function(_0x28bcda){_0x28bcda[_0xed47('0x5b')]=_0xf3f058[_0xed47('0x4b')]['id'];return _0x28bcda;});var _0x4ddeb4=[];return BPromise[_0xed47('0x59')](_0x1b1957,function(_0x4b91e9){return db[_0xed47('0x58')]['create'](_0x4b91e9,{'include':[{'model':db[_0xed47('0x60')],'as':_0xed47('0x5c')}],'raw':!![],'transaction':_0x4fdddc})[_0xed47('0x2b')](function(_0x44e9bb){_0x4ddeb4[_0xed47('0x61')](_0x44e9bb[_0xed47('0x51')]({'plain':!![]}));});})['then'](function(){return _0x4ddeb4;});});});}})[_0xed47('0x2b')](function(_0x3a3d77){return _0x3a3d77;})[_0xed47('0x2b')](respondWithResult(_0x22eb18,null))[_0xed47('0x49')](handleError(_0x22eb18,null));};exports[_0xed47('0x62')]=function(_0x40d5b9,_0x3ef542){var _0x46f795;return db[_0xed47('0x47')]['find']({'where':{'id':_0x40d5b9[_0xed47('0x4b')]['id']},'attributes':['id',_0xed47('0x2f')]})[_0xed47('0x2b')](handleEntityNotFound(_0x3ef542,null))[_0xed47('0x2b')](function(_0x5dc7f2){if(_0x5dc7f2){_0x46f795=_0x5dc7f2;return db[_0xed47('0x58')]['destroy']({'where':{'userProfileId':_0x40d5b9[_0xed47('0x4b')]['id'],'sectionId':_0x40d5b9['query'][_0xed47('0x63')]}});}})[_0xed47('0x2b')](function(){return _0x46f795;})[_0xed47('0x2b')](respondWithStatusCode(_0x3ef542,null))[_0xed47('0x49')](handleError(_0x3ef542,null));};exports['getSections']=function(_0x28fc93,_0x48ca27){var _0x546ab5=[];var _0x2cf432=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x28fc93[_0xed47('0x4b')]['id']},'raw':!![]})[_0xed47('0x2b')](function(_0x1f698a){_0x546ab5=_[_0xed47('0x41')](_0x1f698a,function(_0x34855f){return _0x34855f[_0xed47('0x64')]===0x1||_[_0xed47('0x65')]([0x3eb,0x709],_0x34855f[_0xed47('0x5f')]);});if(!_[_0xed47('0x66')](_0x546ab5)){return _[_0xed47('0x31')](_0x546ab5,function(_0x1e8812){return _0x1e8812[_0xed47('0x5f')];});}else{return;}})[_0xed47('0x2b')](function(_0x1690df){if(_0x1690df)_0x2cf432=_0x1690df;if(_[_0xed47('0x65')](_0x2cf432,0x64)){var _0x39ac4b=_['find'](_0x546ab5,{'sectionId':0x64});return hasDefaultDashboard(_0x39ac4b)[_0xed47('0x2b')](function(_0x1abe89){return _[_0xed47('0x31')](_0x546ab5,function(_0x3debbd){if(_0x3debbd['sectionId']===0x64){_0x3debbd[_0xed47('0x67')]=_0x1abe89;}return _0x3debbd;});});}else{return;}})[_0xed47('0x2b')](function(_0x3dd137){if(_0x3dd137)_0x546ab5=_0x3dd137;if(_['includes'](_0x2cf432,0x3eb)){var _0xedc51b=_[_0xed47('0x4e')](_0x546ab5,{'sectionId':0x3eb});return getCustomDashboards(_0xedc51b)[_0xed47('0x2b')](function(_0x1c59db){return _[_0xed47('0x31')](_0x546ab5,function(_0x40468a){if(_0xedc51b['enabled']){if(_0x40468a[_0xed47('0x5f')]===0x3eb){_0x40468a[_0xed47('0x67')]=_0x1c59db;}}else{if(_0x40468a[_0xed47('0x5f')]===0x64){if(!_0x40468a[_0xed47('0x67')]){_0x40468a['subsections']=[];}_0x40468a[_0xed47('0x67')]=_0x40468a[_0xed47('0x67')][_0xed47('0x68')](_0x1c59db);}}return _0x40468a;});});}else{return;}})[_0xed47('0x2b')](function(_0x160c14){if(_0x160c14)_0x546ab5=_0x160c14;if(_[_0xed47('0x65')](_0x2cf432,0x709)){var _0x4d71e1=_[_0xed47('0x4e')](_0x546ab5,{'sectionId':0x709});return getPlugins(_0x4d71e1)[_0xed47('0x2b')](function(_0x112608){if(_0x4d71e1[_0xed47('0x64')]){return _[_0xed47('0x31')](_0x546ab5,function(_0x374252){if(_0x374252[_0xed47('0x5f')]===0x709){_0x374252[_0xed47('0x67')]=_0x112608;}return _0x374252;});}else{var _0x30fa98={'sectionId':0x76c,'enabled':0x1,'subsections':_0x112608};var _0x15b5f7=_[_0xed47('0x31')](_0x546ab5);_0x15b5f7['push'](_0x30fa98);return _0x15b5f7;}});}else{return;}})['then'](function(_0x307ecb){if(_0x307ecb)_0x546ab5=_0x307ecb;return _[_0xed47('0x41')](_0x546ab5,[_0xed47('0x64'),0x1]);})['then'](respondWithResult(_0x48ca27,null))['catch'](handleError(_0x48ca27,null));};function hasDefaultDashboard(_0x4cb0c6){var _0x2be2db=[0x65];return new BPromise(function(_0x43d450,_0x5d0f39){try{if(_0x4cb0c6['autoAssociation']){_0x43d450(_0x2be2db);}else{return db[_0xed47('0x60')][_0xed47('0x69')]({'where':{'sectionId':_0x4cb0c6['id']},'raw':!![]})[_0xed47('0x2b')](function(_0x511b5f){_0x511b5f?_0x43d450(_0x2be2db):_0x43d450();});}}catch(_0x2fec71){_0x5d0f39(_0x2fec71);}});}function getCustomDashboards(_0x3d946b){var _0x57bd5d=[];return new BPromise(function(_0x1734f3,_0x666d24){try{if(_0x3d946b['autoAssociation']){return db[_0xed47('0x6a')]['findAll']({'raw':!![]})[_0xed47('0x2b')](function(_0x4ffc1b){_0x4ffc1b[_0xed47('0x6b')](function(_0x3d1dea){_0x57bd5d[_0xed47('0x61')](_0x3d1dea['id']+0x1869f);});_0x1734f3(_0x57bd5d);});}else{return db['UserProfileResource'][_0xed47('0x48')]({'where':{'sectionId':_0x3d946b['id']},'raw':!![]})['then'](function(_0x5d0a52){_0x5d0a52[_0xed47('0x6b')](function(_0x101f1c){_0x57bd5d[_0xed47('0x61')](_0x101f1c['resourceId']+0x1869f);});_0x1734f3(_0x57bd5d);});}}catch(_0x1ba4a3){_0x666d24(_0x1ba4a3);}});}function getPlugins(_0x2c805e){var _0x4d698d=[];return new BPromise(function(_0x5828b7,_0x4fef60){try{if(_0x2c805e['autoAssociation']){return db[_0xed47('0x6c')][_0xed47('0x48')]({'raw':!![]})[_0xed47('0x2b')](function(_0x4054e2){_0x4054e2[_0xed47('0x6b')](function(_0x8f920){_0x4d698d[_0xed47('0x61')](_0x8f920['id']+0x15b38);});_0x5828b7(_0x4d698d);});}else{return db[_0xed47('0x60')][_0xed47('0x48')]({'where':{'sectionId':_0x2c805e['id']},'raw':!![]})[_0xed47('0x2b')](function(_0x1c02f4){_0x1c02f4[_0xed47('0x6b')](function(_0x37cf16){_0x4d698d['push'](_0x37cf16[_0xed47('0x6d')]+0x15b38);});_0x5828b7(_0x4d698d);});}}catch(_0x469b90){_0x4fef60(_0x469b90);}});}exports['addResources']=function(_0x4fc308,_0x249702){return db[_0xed47('0x47')][_0xed47('0x4e')]({'where':{'id':_0x4fc308['params']['id']}})['then'](handleEntityNotFound(_0x249702,null))[_0xed47('0x2b')](function(_0xe5d8d8){if(_0xe5d8d8){return db[_0xed47('0x56')][_0xed47('0x57')](function(_0x5538c5){return db[_0xed47('0x58')]['findAll']({'where':{'userProfileId':_0x4fc308[_0xed47('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xed47('0x2b')](function(_0x23b831){if(_0x23b831){return db[_0xed47('0x58')][_0xed47('0x2c')]({'where':{'userProfileId':_0x4fc308[_0xed47('0x4b')]['id'],'id':_['map'](_0x23b831,function(_0x4a2a5d){return _0x4a2a5d['id'];})},'transaction':_0x5538c5});}})['then'](function(_0x412f6e){var _0x2c8f58=_[_0xed47('0x31')](_0x4fc308['body'],function(_0x3f0d7b){_0x3f0d7b[_0xed47('0x5b')]=_0x4fc308[_0xed47('0x4b')]['id'];return _0x3f0d7b;});return db[_0xed47('0x58')][_0xed47('0x6e')](_0x2c8f58,{'raw':!![],'transaction':_0x5538c5});})[_0xed47('0x2b')](function(_0x29d825){var _0x12c3b7=_[_0xed47('0x41')](_['map'](_0x29d825,function(_0x4d70a2){return _0x4d70a2['get']({'plain':!![]});}),{'includeAll':![]});if(_0x12c3b7){return db[_0xed47('0x58')][_0xed47('0x48')]({'where':{'userProfileId':_0x4fc308['params']['id'],'sectionId':_['map'](_0x12c3b7,function(_0x812b20){return _0x812b20[_0xed47('0x5f')];})},'attributes':['id',_0xed47('0x5f')],'raw':!![]})[_0xed47('0x2b')](function(_0x22a9cd){var _0xee056c=_['map'](_0x4fc308[_0xed47('0x50')],function(_0x26caa4){_0x26caa4[_0xed47('0x5b')]=_0x4fc308[_0xed47('0x4b')]['id'];return _0x26caa4;});return db[_0xed47('0x60')][_0xed47('0x6e')](_0xee056c,{'raw':!![],'transaction':_0x5538c5});});}})['catch'](handleError(_0x249702,null));});}})[_0xed47('0x2b')](function(_0x24c650){var _0x2068d6=_[_0xed47('0x31')](_0x24c650,function(_0x1f20bc){return _0x1f20bc[_0xed47('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x249702,null))['catch'](handleError(_0x249702,null));};exports[_0xed47('0x6f')]=function(_0x2abca9,_0xc656e6,_0x21c04e){return db['UserProfile'][_0xed47('0x4e')]({'where':{'id':_0x2abca9[_0xed47('0x4b')]['id']}})[_0xed47('0x2b')](handleEntityNotFound(_0xc656e6,null))[_0xed47('0x2b')](function(_0xd4b281){if(_0xd4b281){return _0xd4b281[_0xed47('0x6f')](_0x2abca9['query'][_0xed47('0x63')]);}})[_0xed47('0x2b')](respondWithStatusCode(_0xc656e6,null))[_0xed47('0x49')](handleError(_0xc656e6,null));};exports[_0xed47('0x70')]=function(_0x586271,_0x592c74){var _0x556cdd={};if(!_0x586271['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x586271[_0xed47('0x36')]['hasOwnProperty'](_0xed47('0x3d'))){_0x556cdd[_0xed47('0x25')]=qs[_0xed47('0x25')](_0x586271[_0xed47('0x36')][_0xed47('0x25')]);_0x556cdd['offset']=qs['offset'](_0x586271[_0xed47('0x36')]['offset']);}return db[_0xed47('0x47')][_0xed47('0x4e')]({'where':{'id':_0x586271[_0xed47('0x4b')]['id']}})[_0xed47('0x2b')](function(_0x44befb){if(!_0x44befb)throw new Error(_0xed47('0x71')+_0x586271[_0xed47('0x4b')]['id']);return db['UserProfile'][_0xed47('0x70')](_0x586271);})[_0xed47('0x2b')](respondWithFilteredResult(_0x592c74,_0x556cdd))['catch'](handleError(_0x592c74,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 29ea80f..e666237 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 _0xc43c=['hook','exports','events','../../mysqldb','UserProfile','remove','emit'];(function(_0x137b26,_0x176e50){var _0x353d0b=function(_0xd96029){while(--_0xd96029){_0x137b26['push'](_0x137b26['shift']());}};_0x353d0b(++_0x176e50);}(_0xc43c,0xd4));var _0xcc43=function(_0x301467,_0x124c6b){_0x301467=_0x301467-0x0;var _0x3aeef7=_0xc43c[_0x301467];return _0x3aeef7;};'use strict';var EventEmitter=require(_0xcc43('0x0'));var UserProfile=require(_0xcc43('0x1'))['db'][_0xcc43('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcc43('0x3')};function emitEvent(_0x482ebc){return function(_0x484b53,_0x4c59cc,_0x37e84f){UserProfileEvents[_0xcc43('0x4')](_0x482ebc+':'+_0x484b53['id'],_0x484b53);UserProfileEvents[_0xcc43('0x4')](_0x482ebc,_0x484b53);_0x37e84f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcc43('0x5')](e,emitEvent(event));}}module[_0xcc43('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x8f9d=['hasOwnProperty','hook','exports','events','UserProfile','save','update','remove','emit'];(function(_0x1f97e8,_0x445a4a){var _0x1ed77c=function(_0x1c990d){while(--_0x1c990d){_0x1f97e8['push'](_0x1f97e8['shift']());}};_0x1ed77c(++_0x445a4a);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xd8f9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd8f9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8f9('0x2'),'afterUpdate':_0xd8f9('0x3'),'afterDestroy':_0xd8f9('0x4')};function emitEvent(_0x354c26){return function(_0x1f9331,_0x1b82b8,_0x1d6420){UserProfileEvents['emit'](_0x354c26+':'+_0x1f9331['id'],_0x1f9331);UserProfileEvents[_0xd8f9('0x5')](_0x354c26,_0x1f9331);_0x1d6420(null);};}for(var e in events){if(events[_0xd8f9('0x6')](e)){var event=events[e];UserProfile[_0xd8f9('0x7')](e,emitEvent(event));}}module[_0xd8f9('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 bb1f54d..16d8720 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 _0x93f0=['Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','where','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','CustomReports','rows','ids','customSorting','order','extraQueryConditions','count','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','catch','model','associatedResources','map','resolve','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','CmContact','Lists','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappAccount','Team','voicequeues','queuecampaigns','agents','Users','admin','user','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Trigger','trunks','variables','plugins','Plugin','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','raw','mergeResources'];(function(_0x8cb470,_0x2b9757){var _0x2ca139=function(_0x5251be){while(--_0x5251be){_0x8cb470['push'](_0x8cb470['shift']());}};_0x2ca139(++_0x2b9757);}(_0x93f0,0xf0));var _0x093f=function(_0x597a14,_0xddbebd){_0x597a14=_0x597a14-0x0;var _0x2e0953=_0x93f0[_0x597a14];return _0x2e0953;};'use strict';var _=require(_0x093f('0x0'));var attributes=require(_0x093f('0x1'));var squel=require(_0x093f('0x2'));module[_0x093f('0x3')]=function(_0x3a6e5c){var _0x399ad9=_0x3a6e5c[_0x093f('0x4')];function _0x5c0afe(_0x3f4dd1,_0x37d6c5){return new Promise(function(_0x2acad6,_0x296eec){if(!_0x37d6c5)return _0x2acad6(null);var _0x185bb1=_0x37d6c5[_0x093f('0x5')]?{[_0x37d6c5[_0x093f('0x5')][_0x093f('0x6')]]:_0x37d6c5[_0x093f('0x5')][_0x093f('0x7')]}:undefined;return _0x399ad9[_0x3f4dd1][_0x093f('0x8')]({'where':_0x185bb1,'raw':!![]})[_0x093f('0x9')](function(_0x193ef6){_0x37d6c5['associatedResources']=_['map'](_0x193ef6,'id');_0x2acad6(_0x37d6c5);})[_0x093f('0xa')](function(_0x54a134){_0x296eec(_0x54a134);});});}function _0x419931(_0x571284,_0x143b08){return new Promise(function(_0x1afb78,_0x32365e){var _0x58f33f=_0x571284['filter']?{[_0x571284[_0x093f('0x5')][_0x093f('0x6')]]:_0x571284['filter'][_0x093f('0x7')]}:undefined;return _0x399ad9[_0x571284[_0x093f('0xb')]][_0x093f('0x8')]({'where':_0x58f33f,'raw':!![]})[_0x093f('0x9')](function(_0x3d4308){_0x143b08[_0x093f('0xc')]=_[_0x093f('0xd')](_0x3d4308,function(_0x13e559){return _0x13e559['name'];});_0x1afb78(_0x143b08);})[_0x093f('0xa')](function(_0x2121d4){_0x32365e(_0x2121d4);});});}function _0x373504(_0x50cc16,_0x5640f4,_0x145b4b){if(!_0x5640f4)return Promise[_0x093f('0xe')](null);return new Promise(function(_0x57fff8,_0x35efe5){return _0x399ad9['UserProfileResource'][_0x093f('0x8')]({'where':{'sectionId':_0x5640f4['id']},'raw':!![]})['then'](function(_0x1d6287){if(_0x50cc16[_0x093f('0x6')]&&_0x50cc16[_0x093f('0x6')]!=='id'){_0x5640f4[_0x093f('0xc')]=_[_0x093f('0xd')](_0x1d6287,function(_0x2b954a){return _0x2b954a[_0x50cc16[_0x093f('0x6')]];});}else{if(_0x145b4b===_0x093f('0xf')){_0x5640f4[_0x093f('0xc')]=_[_0x093f('0xd')](_0x1d6287,function(_0x4b8e6c){return{'id':_0x4b8e6c[_0x093f('0x10')],'type':_0x4b8e6c[_0x093f('0x11')]};});}else{_0x5640f4[_0x093f('0xc')]=_[_0x093f('0xd')](_0x1d6287,function(_0x30d0c3){return _0x30d0c3[_0x093f('0x10')];});}}_0x57fff8(_0x5640f4);})[_0x093f('0xa')](function(_0x24e2ee){_0x35efe5(_0x24e2ee);});});}function _0x3d1010(_0x2cedc8,_0x1dc39f){var _0x3af48a={'parentSections':[]};switch(_0x2cedc8['toLowerCase']()){case'squareprojects':_0x3af48a[_0x093f('0x12')]=_0x093f('0x13');break;case'odbc':_0x3af48a[_0x093f('0x12')]=_0x093f('0x14');break;case _0x093f('0x15'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x16');_0x3af48a[_0x093f('0x17')]=[{'name':_0x093f('0x18'),'field':_0x093f('0x19'),'foreignKey':_0x093f('0x1a')}];break;case _0x093f('0x1b'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x1c');break;case _0x093f('0x1d'):_0x3af48a['childModel']=_0x093f('0x1e');_0x3af48a[_0x093f('0x17')]=[{'name':_0x093f('0x1f'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x3af48a[_0x093f('0x12')]='CmList';break;case _0x093f('0x20'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x21');break;case'globalcustomfields':_0x3af48a[_0x093f('0x12')]=_0x093f('0x22');break;case'chatqueues':_0x3af48a[_0x093f('0x12')]=_0x093f('0x23');break;case _0x093f('0x24'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x25');break;case _0x093f('0x26'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x27');break;case _0x093f('0x28'):_0x3af48a['childModel']=_0x093f('0x29');break;case _0x093f('0x2a'):case _0x093f('0x2b'):case _0x093f('0x2c'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x2d');break;case _0x093f('0x2e'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x2f');break;case _0x093f('0x30'):_0x3af48a[_0x093f('0x12')]='VoiceMail';break;case _0x093f('0x31'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x32');_0x3af48a[_0x093f('0x17')]=[{'name':_0x093f('0x33'),'field':_0x093f('0x19'),'foreignKey':'membername','model':_0x093f('0x34'),'filter':{'field':_0x093f('0x35'),'value':[_0x093f('0x36')]}},{'name':'Telephones','field':_0x093f('0x19'),'foreignKey':_0x093f('0x37'),'model':_0x093f('0x34'),'filter':{'field':_0x093f('0x35'),'value':[_0x093f('0x38')]}},{'name':_0x093f('0x39'),'field':_0x093f('0x19'),'foreignKey':_0x093f('0x3a'),'model':_0x093f('0x3b'),'filter':{'field':_0x093f('0x11'),'value':[_0x093f('0x3c')]}},{'name':_0x093f('0x3d'),'field':_0x093f('0x19'),'foreignKey':_0x093f('0x3a'),'model':'VoiceQueue','filter':{'field':_0x093f('0x11'),'value':[_0x093f('0x3e')]}}];break;case _0x093f('0x3f'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x40');break;case _0x093f('0x41'):_0x3af48a[_0x093f('0x12')]='VoiceChanSpy';break;case _0x093f('0x42'):_0x3af48a['childModel']=_0x093f('0x43');break;case'ivrcampaigns':_0x3af48a['childModel']='Campaign';break;case _0x093f('0x44'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x45');break;case _0x093f('0x46'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x47');break;case _0x093f('0x48'):_0x3af48a[_0x093f('0x12')]='MailSubstatus';break;case _0x093f('0x49'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x4a');break;case _0x093f('0x4b'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x4c');break;case _0x093f('0x4d'):_0x3af48a[_0x093f('0x12')]='SmsQueue';break;case'smsaccounts':_0x3af48a[_0x093f('0x12')]=_0x093f('0x4e');break;case _0x093f('0x4f'):_0x3af48a[_0x093f('0x12')]='WhatsappQueue';break;case'whatsappaccounts':_0x3af48a[_0x093f('0x12')]=_0x093f('0x50');break;case'teams':_0x3af48a['childModel']=_0x093f('0x51');break;case _0x093f('0x52'):case _0x093f('0x53'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x3b');if(_0x1dc39f){_0x3af48a[_0x093f('0x17')]=[{'name':_0x093f('0x39')},{'name':'QueueCampaigns'}];}break;case'users':case _0x093f('0x54'):case'telephones':_0x3af48a['childModel']=_0x093f('0x34');if(_0x1dc39f){_0x3af48a['parentSections']=[{'name':_0x093f('0x55'),'filter':{'field':_0x093f('0x35'),'value':[_0x093f('0x56'),_0x093f('0x57')]},'ignore':!![]},{'name':_0x093f('0x33')},{'name':_0x093f('0x58')}];}break;case _0x093f('0x59'):_0x3af48a[_0x093f('0x12')]='ZendeskAccount';break;case _0x093f('0x5a'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x5b');break;case _0x093f('0x5c'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x5d');break;case'sugarcrmaccounts':_0x3af48a['childModel']=_0x093f('0x5e');break;case _0x093f('0x5f'):_0x3af48a['childModel']=_0x093f('0x60');break;case _0x093f('0x61'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x62');break;case'vtigeraccounts':_0x3af48a['childModel']=_0x093f('0x34');break;case'cannedanswers':_0x3af48a[_0x093f('0x12')]='CannedAnswer';break;case _0x093f('0x63'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x64');break;case _0x093f('0x65'):_0x3af48a['childModel']=_0x093f('0x66');break;case _0x093f('0x67'):_0x3af48a['childModel']='Interval';break;case'pauses':_0x3af48a[_0x093f('0x12')]=_0x093f('0x68');break;case _0x093f('0x69'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x6a');break;case _0x093f('0x6b'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x6c');break;case _0x093f('0x6d'):_0x3af48a[_0x093f('0x12')]=_0x093f('0x6e');break;case _0x093f('0x6f'):_0x3af48a[_0x093f('0x12')]='Template';break;case'triggers':_0x3af48a[_0x093f('0x12')]=_0x093f('0x70');break;case _0x093f('0x71'):_0x3af48a[_0x093f('0x12')]='Trunk';break;case _0x093f('0x72'):_0x3af48a[_0x093f('0x12')]='Variable';break;case _0x093f('0x73'):_0x3af48a['childModel']=_0x093f('0x74');break;case'extractedreports':_0x3af48a[_0x093f('0x12')]=_0x093f('0xf');_0x3af48a[_0x093f('0x17')]=[{'name':_0x093f('0x75'),'field':'id','foreignKey':_0x093f('0x76')}];break;case _0x093f('0x77'):_0x3af48a[_0x093f('0x12')]='AnalyticMetric';break;}return _0x3af48a;}function _0x7f913e(_0x2990d2,_0x55b521){var _0x5976ea=_0x2990d2[_0x093f('0x78')](0x0)[_0x093f('0x79')]()+_0x2990d2[_0x093f('0x7a')](0x1);var _0x149d5e={'type':_0x399ad9[_0x093f('0x7b')][_0x093f('0x7c')][_0x093f('0x7d')],'raw':!![]};return new Promise(function(_0x2865e8,_0x4bae06){var _0x16c0b1=squel[_0x093f('0x7e')]()[_0x093f('0x6')](_0x093f('0x7f')+_0x5976ea+_0x093f('0x80'),'id')['field'](_0x093f('0x81'))[_0x093f('0x82')](_0x093f('0x83')+_0x2990d2+_0x093f('0x84'),'ui')['where'](_0x093f('0x85'),_0x55b521['id']);return _0x399ad9[_0x093f('0x86')]['query'](_0x16c0b1[_0x093f('0x87')](),_0x149d5e)['then'](function(_0x450627){_0x55b521[_0x5976ea+_0x093f('0x88')]=_0x450627;_0x2865e8(_0x450627);})[_0x093f('0xa')](function(_0x9558fa){_0x4bae06(_0x9558fa);});});}return _0x3a6e5c[_0x093f('0x89')](_0x093f('0x8a'),attributes,{'tableName':_0x093f('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2b54e8){var _0x12bd54=require(_0x093f('0x8c'));var _0x4e2e60={'raw':_0x2b54e8[_0x093f('0x8d')][_0x093f('0x8e')],'where':{}};var _0x1de657={};var _0x354c2f={'count':0x0,'rows':[]};var _0x55e910=_0x2b54e8[_0x093f('0x8d')]['section'];var _0x4fb405=_0x2b54e8[_0x093f('0x8d')][_0x093f('0x8f')]||![];var _0x34ae1d=_0x3d1010(_0x55e910,_0x4fb405);if(!_0x34ae1d[_0x093f('0x12')])throw new Error(_0x093f('0x90')+_0x55e910+'\x27');var _0x17776b=[{'name':_0x55e910}];if(!_[_0x093f('0x91')](_0x34ae1d[_0x093f('0x17')]))_0x17776b=_0x34ae1d[_0x093f('0x17')];var _0x113d65=[];for(var _0x285c4d=0x0;_0x285c4d<_0x17776b[_0x093f('0x92')];_0x285c4d++){_0x113d65[_0x093f('0x93')](_0x399ad9[_0x093f('0x94')][_0x093f('0x95')]({'where':{'userProfileId':_0x2b54e8[_0x093f('0x96')]['id'],'name':_0x17776b[_0x285c4d][_0x093f('0x19')]},'raw':!![]}));}return Promise[_0x093f('0x97')](_0x113d65)[_0x093f('0x9')](function(_0x3b5731){var _0x42ee7a=_['filter'](_0x3b5731,function(_0x9b497d){return _0x9b497d?_0x9b497d:undefined;});var _0x3dea77=_['filter'](_0x17776b,[_0x093f('0x98'),!![]]);var _0x18c54c=_[_0x093f('0x91')](_0x42ee7a)&&_[_0x093f('0x91')](_0x3dea77)?null:_['union'](_0x3dea77,_0x42ee7a);if(!_0x18c54c)return null;var _0x278cb3=[];for(var _0x25f2f1=0x0;_0x25f2f1<_0x18c54c[_0x093f('0x92')];_0x25f2f1++){var _0x26be16=_[_0x093f('0x95')](_0x17776b,function(_0x363264){return _0x18c54c[_0x25f2f1]?_0x363264[_0x093f('0x19')]===_0x18c54c[_0x25f2f1][_0x093f('0x19')]:null;});if(_0x26be16){if(_0x18c54c[_0x25f2f1][_0x093f('0x98')]){_0x278cb3[_0x093f('0x93')](_0x5c0afe(_0x34ae1d['childModel'],_0x18c54c[_0x25f2f1]));}else{if(!_0x18c54c[_0x25f2f1][_0x093f('0x99')]){_0x278cb3[_0x093f('0x93')](_0x373504(_0x26be16,_0x18c54c[_0x25f2f1],_0x34ae1d[_0x093f('0x12')]));}else{if(_0x26be16[_0x093f('0xb')]){_0x278cb3[_0x093f('0x93')](_0x419931(_0x26be16,_0x18c54c[_0x25f2f1]));}}}}}return Promise[_0x093f('0x97')](_0x278cb3);})['then'](function(_0x54398d){var _0x32d417=_0x54398d;var _0x23bbdf=null;if(_0x32d417){_0x23bbdf=_0x32d417[_0x093f('0x92')]===0x1?_0x32d417[0x0]:null;}if(!_0x23bbdf&&!_0x32d417)return _0x354c2f;var _0x4f456e=_0x399ad9[_0x34ae1d[_0x093f('0x12')]][_0x093f('0x9a')];_0x1de657[_0x093f('0xb')]=_['keys'](_0x4f456e);_0x1de657[_0x093f('0x8d')]=_[_0x093f('0x9b')](_0x2b54e8['query']);_0x1de657[_0x093f('0x9c')]=_[_0x093f('0x9d')](_0x1de657[_0x093f('0xb')],_0x1de657[_0x093f('0x8d')]);_0x4e2e60[_0x093f('0x9e')]=_[_0x093f('0x9d')](_0x1de657[_0x093f('0xb')],_0x12bd54['fields'](_0x2b54e8['query'][_0x093f('0x9f')]));_0x4e2e60[_0x093f('0x9e')]=_0x4e2e60['attributes']['length']?_0x4e2e60[_0x093f('0x9e')]:_0x1de657[_0x093f('0xb')];if(!_0x2b54e8['query']['hasOwnProperty'](_0x093f('0xa0'))){_0x4e2e60['limit']=_0x12bd54['limit'](_0x2b54e8[_0x093f('0x8d')][_0x093f('0xa1')]);_0x4e2e60[_0x093f('0xa2')]=_0x12bd54[_0x093f('0xa2')](_0x2b54e8['query'][_0x093f('0xa2')]);}_0x4e2e60['order']=_0x12bd54[_0x093f('0xa3')](_0x2b54e8[_0x093f('0x8d')]['sort']);_0x4e2e60[_0x093f('0xa4')]=_0x12bd54[_0x093f('0x9c')](_['pick'](_0x2b54e8[_0x093f('0x8d')],_0x1de657[_0x093f('0x9c')]));if(_0x2b54e8['query'][_0x093f('0x5')]){_0x4e2e60['where']=_[_0x093f('0xa5')](_0x4e2e60[_0x093f('0xa4')],{'$or':_['map'](_0x4f456e,function(_0x26eccb){if(_0x26eccb['type'][_0x093f('0xa6')]!==_0x093f('0xa7')){var _0x5f483a={};_0x5f483a[_0x26eccb['field']]={'$like':'%'+_0x2b54e8[_0x093f('0x8d')]['filter']+'%'};return _0x5f483a;}})});}var _0x2aa0e5=[];var _0x4bc590=null;var _0x279757={};if(_0x23bbdf){_0x4bc590=_[_0x093f('0x95')](_0x17776b,['name',_0x23bbdf[_0x093f('0x19')]]);if(_0x4bc590[_0x093f('0x6')]){_0x279757={};if(_0x34ae1d[_0x093f('0x12')]===_0x093f('0xf')){_0x279757[_0x4bc590[_0x093f('0xa8')]]=_[_0x093f('0xd')](_0x23bbdf[_0x093f('0xc')],'id');}else{_0x279757[_0x4bc590[_0x093f('0xa8')]]=_0x23bbdf[_0x093f('0xc')];}_0x2aa0e5[_0x093f('0x93')](_0x279757);}else{_0x4e2e60[_0x093f('0xa4')]['id']=_0x23bbdf[_0x093f('0xc')];}}else{for(var _0x1d73a6=0x0;_0x1d73a6<_0x32d417[_0x093f('0x92')];_0x1d73a6++){_0x4bc590=_[_0x093f('0x95')](_0x17776b,[_0x093f('0x19'),_0x32d417[_0x1d73a6][_0x093f('0x19')]]);if(_0x4bc590[_0x093f('0x6')]){_0x279757={};_0x279757[_0x4bc590['foreignKey']]=_0x32d417[_0x1d73a6][_0x093f('0xc')];_0x2aa0e5[_0x093f('0x93')](_0x279757);}else{if(!_0x4e2e60[_0x093f('0xa4')]['id'])_0x4e2e60[_0x093f('0xa4')]['id']=[];_0x32d417[_0x1d73a6][_0x093f('0xc')][_0x093f('0xa9')](function(_0x7bc136){_0x4e2e60['where']['id'][_0x093f('0x93')](_0x7bc136);});}}}if(!_[_0x093f('0x91')](_0x2aa0e5)){_0x4e2e60[_0x093f('0xa4')]=_['merge'](_0x4e2e60[_0x093f('0xa4')],{'$and':{'$or':_0x2aa0e5}});}_0x4e2e60=_['merge']({},_0x4e2e60,_0x2b54e8[_0x093f('0xaa')]);if(_0x23bbdf&&!_0x23bbdf[_0x093f('0x99')]&&_0x34ae1d[_0x093f('0x12')]===_0x093f('0xf')){if(_0x2b54e8[_0x093f('0x8d')][_0x093f('0xab')]){_0x4e2e60[_0x093f('0xac')]=[{'all':!![]}];}return _0x399ad9[_0x34ae1d[_0x093f('0x12')]][_0x093f('0x8')](_0x4e2e60)[_0x093f('0x9')](function(_0x5dd371){var _0x1491c3=[];_0x5dd371['forEach'](function(_0x27c6d5){var _0x24b871;switch(_0x27c6d5[_0x093f('0xad')]){case _0x093f('0xae'):_0x24b871=_[_0x093f('0x95')](_0x23bbdf[_0x093f('0xc')],function(_0x44325c){return _0x44325c['id']===_0x27c6d5[_0x093f('0x76')]&&_0x44325c[_0x093f('0x11')]===_0x093f('0xaf');});break;case'custom':_0x24b871=_[_0x093f('0x95')](_0x23bbdf['associatedResources'],function(_0x23984d){return _0x23984d['id']===_0x27c6d5[_0x093f('0x76')]&&_0x23984d[_0x093f('0x11')]===_0x093f('0xb0');});break;}if(_0x24b871)_0x1491c3[_0x093f('0x93')](_0x27c6d5);});_0x354c2f['count']=_0x1491c3[_0x093f('0x92')];_0x354c2f[_0x093f('0xb1')]=_0x1491c3;return _0x354c2f;});}else{if(!_[_0x093f('0x91')](_0x2b54e8['query']['ids'])){_0x4e2e60['where']['id']=_0x4e2e60[_0x093f('0xa4')]['id']?_['intersection'](_0x4e2e60['where']['id'],_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb2')]):_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb2')];if(_0x2b54e8['query'][_0x093f('0xb3')]){_0x4e2e60[_0x093f('0xb4')]=_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb3')];}}if(_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb5')]){_0x4e2e60['where']=_[_0x093f('0xa5')](_0x4e2e60[_0x093f('0xa4')],{'$and':_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb5')]});}return _0x399ad9[_0x34ae1d[_0x093f('0x12')]][_0x093f('0xb6')]({'where':_0x4e2e60[_0x093f('0xa4')]})['then'](function(_0x135b6a){_0x354c2f[_0x093f('0xb6')]=_0x135b6a;if(_0x2b54e8['query']['includeAll']){if(_0x34ae1d[_0x093f('0x12')]==='CmContact'){_0x4e2e60[_0x093f('0xac')]=[{'model':_0x399ad9[_0x093f('0x6e')],'as':'Tags','attributes':['id',_0x093f('0x19'),_0x093f('0xb7')],'required':_0x2b54e8['query'][_0x093f('0xb8')]?!![]:![]},{'model':_0x399ad9[_0x093f('0x6e')],'as':_0x093f('0xb9'),'attributes':['id',_0x093f('0x19'),_0x093f('0xb7')],'through':_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb8')]?{'attributes':[],'where':{'TagId':_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb8')]||undefined}}:{},'required':_0x2b54e8[_0x093f('0x8d')][_0x093f('0xb8')]?!![]:![]}];}else{_0x4e2e60[_0x093f('0xac')]=[{'all':!![]}];}}return _0x399ad9[_0x34ae1d[_0x093f('0x12')]][_0x093f('0x8')](_0x4e2e60);})[_0x093f('0x9')](function(_0x2da2ec){_0x354c2f[_0x093f('0xb1')]=_0x2da2ec;if(_0x55e910===_0x093f('0x33')&&_0x2b54e8[_0x093f('0x8d')][_0x093f('0xba')]===_0x093f('0xbb')){var _0x77f79b=[];for(var _0x2995a7=0x0;_0x2995a7<_0x354c2f[_0x093f('0xb1')]['length'];_0x2995a7++){_0x77f79b[_0x093f('0x93')](_0x7f913e(_0x093f('0xbc'),_0x354c2f[_0x093f('0xb1')][_0x2995a7][_0x093f('0xbd')]));_0x77f79b[_0x093f('0x93')](_0x7f913e('sms',_0x354c2f[_0x093f('0xb1')][_0x2995a7][_0x093f('0xbd')]));_0x77f79b[_0x093f('0x93')](_0x7f913e(_0x093f('0xbe'),_0x354c2f[_0x093f('0xb1')][_0x2995a7][_0x093f('0xbd')]));_0x77f79b[_0x093f('0x93')](_0x7f913e('mail',_0x354c2f['rows'][_0x2995a7][_0x093f('0xbd')]));_0x77f79b[_0x093f('0x93')](_0x7f913e('openchannel',_0x354c2f[_0x093f('0xb1')][_0x2995a7]['dataValues']));_0x77f79b[_0x093f('0x93')](_0x7f913e(_0x093f('0xbf'),_0x354c2f[_0x093f('0xb1')][_0x2995a7]['dataValues']));}return Promise[_0x093f('0x97')](_0x77f79b)[_0x093f('0x9')](function(){return _0x354c2f;});}return _0x354c2f;});}});}}});}; \ No newline at end of file +var _0x4385=['openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','templates','Template','triggers','trunks','Trunk','Variable','Plugin','extractedreports','AnalyticExtractedReport','reportId','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','_interactions','where','sequelize','query','toString','define','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','union','ignore','autoAssociation','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','filters','pick','merge','VIRTUAL','foreignKey','forEach','options','include','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','includeAll','color','tag','ThroughTags','true','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','findAll','then','map','field','value','model','name','catch','resolve','UserProfileResource','associatedResources','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','contacts','CmContact','parentSections','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues'];(function(_0x2abddf,_0x2eedf0){var _0x448d7d=function(_0x467704){while(--_0x467704){_0x2abddf['push'](_0x2abddf['shift']());}};_0x448d7d(++_0x2eedf0);}(_0x4385,0x6f));var _0x5438=function(_0x5d7480,_0x2187ef){_0x5d7480=_0x5d7480-0x0;var _0x35bbf7=_0x4385[_0x5d7480];return _0x35bbf7;};'use strict';var _=require(_0x5438('0x0'));var attributes=require(_0x5438('0x1'));var squel=require(_0x5438('0x2'));module[_0x5438('0x3')]=function(_0x48ac7b){var _0x4c0c22=_0x48ac7b['models'];function _0x2b94d3(_0x2b11a6,_0x15739a){return new Promise(function(_0x525bc3,_0x139703){if(!_0x15739a)return _0x525bc3(null);var _0x5456b0=_0x15739a[_0x5438('0x4')]?{[_0x15739a[_0x5438('0x4')]['field']]:_0x15739a['filter']['value']}:undefined;return _0x4c0c22[_0x2b11a6][_0x5438('0x5')]({'where':_0x5456b0,'raw':!![]})[_0x5438('0x6')](function(_0x486d45){_0x15739a['associatedResources']=_[_0x5438('0x7')](_0x486d45,'id');_0x525bc3(_0x15739a);})['catch'](function(_0x3df046){_0x139703(_0x3df046);});});}function _0x156fd9(_0x9247e0,_0x3b971b){return new Promise(function(_0x13f20a,_0x3fcaf6){var _0x3c638b=_0x9247e0[_0x5438('0x4')]?{[_0x9247e0[_0x5438('0x4')][_0x5438('0x8')]]:_0x9247e0[_0x5438('0x4')][_0x5438('0x9')]}:undefined;return _0x4c0c22[_0x9247e0[_0x5438('0xa')]][_0x5438('0x5')]({'where':_0x3c638b,'raw':!![]})[_0x5438('0x6')](function(_0xf6f13b){_0x3b971b['associatedResources']=_[_0x5438('0x7')](_0xf6f13b,function(_0x49d570){return _0x49d570[_0x5438('0xb')];});_0x13f20a(_0x3b971b);})[_0x5438('0xc')](function(_0x50da2d){_0x3fcaf6(_0x50da2d);});});}function _0x1f727d(_0x5b769d,_0x3040ac,_0x1b3a3a){if(!_0x3040ac)return Promise[_0x5438('0xd')](null);return new Promise(function(_0x353440,_0x3aa084){return _0x4c0c22[_0x5438('0xe')][_0x5438('0x5')]({'where':{'sectionId':_0x3040ac['id']},'raw':!![]})[_0x5438('0x6')](function(_0x66c14d){if(_0x5b769d['field']&&_0x5b769d['field']!=='id'){_0x3040ac[_0x5438('0xf')]=_[_0x5438('0x7')](_0x66c14d,function(_0x53809e){return _0x53809e[_0x5b769d[_0x5438('0x8')]];});}else{if(_0x1b3a3a==='AnalyticExtractedReport'){_0x3040ac[_0x5438('0xf')]=_['map'](_0x66c14d,function(_0x5dff26){return{'id':_0x5dff26['resourceId'],'type':_0x5dff26['type']};});}else{_0x3040ac[_0x5438('0xf')]=_[_0x5438('0x7')](_0x66c14d,function(_0x2a583c){return _0x2a583c[_0x5438('0x10')];});}}_0x353440(_0x3040ac);})[_0x5438('0xc')](function(_0x45cb90){_0x3aa084(_0x45cb90);});});}function _0xee5065(_0x181745,_0x3334a3){var _0x514e7f={'parentSections':[]};switch(_0x181745[_0x5438('0x11')]()){case _0x5438('0x12'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x14');break;case _0x5438('0x15'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x16');break;case _0x5438('0x17'):_0x514e7f['childModel']='SquareRecording';_0x514e7f['parentSections']=[{'name':_0x5438('0x18'),'field':_0x5438('0xb'),'foreignKey':_0x5438('0x19')}];break;case _0x5438('0x1a'):_0x514e7f[_0x5438('0x13')]='JscriptyProject';break;case _0x5438('0x1b'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x1c');_0x514e7f[_0x5438('0x1d')]=[{'name':'Lists','field':'id','foreignKey':_0x5438('0x1e')}];break;case _0x5438('0x1f'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x20');break;case _0x5438('0x21'):_0x514e7f[_0x5438('0x13')]='CmCompany';break;case'globalcustomfields':_0x514e7f[_0x5438('0x13')]=_0x5438('0x22');break;case _0x5438('0x23'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x24');break;case'chatwebsites':_0x514e7f[_0x5438('0x13')]=_0x5438('0x25');break;case'faxqueues':_0x514e7f[_0x5438('0x13')]=_0x5438('0x26');break;case _0x5438('0x27'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x28');break;case _0x5438('0x29'):case _0x5438('0x2a'):case _0x5438('0x2b'):_0x514e7f['childModel']=_0x5438('0x2c');break;case _0x5438('0x2d'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x2e');break;case'voicemails':_0x514e7f[_0x5438('0x13')]=_0x5438('0x2f');break;case _0x5438('0x30'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x31');_0x514e7f[_0x5438('0x1d')]=[{'name':_0x5438('0x32'),'field':'name','foreignKey':_0x5438('0x33'),'model':_0x5438('0x34'),'filter':{'field':_0x5438('0x35'),'value':[_0x5438('0x36')]}},{'name':_0x5438('0x37'),'field':_0x5438('0xb'),'foreignKey':_0x5438('0x33'),'model':'User','filter':{'field':'role','value':[_0x5438('0x38')]}},{'name':_0x5438('0x39'),'field':_0x5438('0xb'),'foreignKey':_0x5438('0x3a'),'model':_0x5438('0x3b'),'filter':{'field':_0x5438('0x3c'),'value':[_0x5438('0x3d')]}},{'name':_0x5438('0x3e'),'field':_0x5438('0xb'),'foreignKey':_0x5438('0x3a'),'model':_0x5438('0x3b'),'filter':{'field':'type','value':[_0x5438('0x3f')]}}];break;case _0x5438('0x40'):_0x514e7f['childModel']=_0x5438('0x41');break;case _0x5438('0x42'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x43');break;case _0x5438('0x44'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x45');break;case'ivrcampaigns':_0x514e7f[_0x5438('0x13')]=_0x5438('0x46');break;case'mailqueues':_0x514e7f[_0x5438('0x13')]=_0x5438('0x47');break;case _0x5438('0x48'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x49');break;case _0x5438('0x4a'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x4b');break;case _0x5438('0x4c'):_0x514e7f[_0x5438('0x13')]='OpenchannelQueue';break;case _0x5438('0x4d'):_0x514e7f['childModel']=_0x5438('0x4e');break;case _0x5438('0x4f'):_0x514e7f[_0x5438('0x13')]='SmsQueue';break;case'smsaccounts':_0x514e7f['childModel']=_0x5438('0x50');break;case'whatsappqueues':_0x514e7f['childModel']=_0x5438('0x51');break;case _0x5438('0x52'):_0x514e7f[_0x5438('0x13')]='WhatsappAccount';break;case'teams':_0x514e7f[_0x5438('0x13')]=_0x5438('0x53');break;case _0x5438('0x54'):case _0x5438('0x55'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x3b');if(_0x3334a3){_0x514e7f['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x5438('0x56'):case _0x5438('0x57'):case'telephones':_0x514e7f[_0x5438('0x13')]=_0x5438('0x34');if(_0x3334a3){_0x514e7f[_0x5438('0x1d')]=[{'name':_0x5438('0x58'),'filter':{'field':_0x5438('0x35'),'value':[_0x5438('0x59'),_0x5438('0x5a')]},'ignore':!![]},{'name':_0x5438('0x32')},{'name':_0x5438('0x37')}];}break;case'zendeskaccounts':_0x514e7f[_0x5438('0x13')]='ZendeskAccount';break;case _0x5438('0x5b'):_0x514e7f['childModel']=_0x5438('0x5c');break;case _0x5438('0x5d'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x5e');break;case _0x5438('0x5f'):_0x514e7f[_0x5438('0x13')]='SugarcrmAccount';break;case _0x5438('0x60'):_0x514e7f['childModel']=_0x5438('0x61');break;case _0x5438('0x62'):_0x514e7f[_0x5438('0x13')]='ZohoAccount';break;case _0x5438('0x63'):_0x514e7f[_0x5438('0x13')]='User';break;case _0x5438('0x64'):_0x514e7f[_0x5438('0x13')]='CannedAnswer';break;case _0x5438('0x65'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x66');break;case _0x5438('0x67'):_0x514e7f['childModel']=_0x5438('0x68');break;case _0x5438('0x69'):_0x514e7f[_0x5438('0x13')]='Interval';break;case _0x5438('0x6a'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x6b');break;case _0x5438('0x6c'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x6d');break;case'sounds':_0x514e7f[_0x5438('0x13')]=_0x5438('0x6e');break;case _0x5438('0x6f'):_0x514e7f[_0x5438('0x13')]='Tag';break;case _0x5438('0x70'):_0x514e7f['childModel']=_0x5438('0x71');break;case _0x5438('0x72'):_0x514e7f['childModel']='Trigger';break;case _0x5438('0x73'):_0x514e7f[_0x5438('0x13')]=_0x5438('0x74');break;case'variables':_0x514e7f[_0x5438('0x13')]=_0x5438('0x75');break;case'plugins':_0x514e7f[_0x5438('0x13')]=_0x5438('0x76');break;case _0x5438('0x77'):_0x514e7f['childModel']=_0x5438('0x78');_0x514e7f['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x5438('0x79')}];break;case'metrics':_0x514e7f[_0x5438('0x13')]='AnalyticMetric';break;}return _0x514e7f;}function _0x3d370b(_0x2344e5,_0x4f947e){var _0x255619=_0x2344e5[_0x5438('0x7a')](0x0)['toUpperCase']()+_0x2344e5[_0x5438('0x7b')](0x1);var _0x1d76f3={'type':_0x4c0c22[_0x5438('0x7c')][_0x5438('0x7d')][_0x5438('0x7e')],'raw':!![]};return new Promise(function(_0x1732f4,_0xb522fc){var _0xd0cb63=squel[_0x5438('0x7f')]()[_0x5438('0x8')](_0x5438('0x80')+_0x255619+_0x5438('0x81'),'id')[_0x5438('0x8')](_0x5438('0x82'))[_0x5438('0x83')]('user_has_'+_0x2344e5+_0x5438('0x84'),'ui')[_0x5438('0x85')]('ui.UserId\x20=\x20?',_0x4f947e['id']);return _0x4c0c22[_0x5438('0x86')][_0x5438('0x87')](_0xd0cb63[_0x5438('0x88')](),_0x1d76f3)[_0x5438('0x6')](function(_0xaef003){_0x4f947e[_0x255619+'OpenTabs']=_0xaef003;_0x1732f4(_0xaef003);})[_0x5438('0xc')](function(_0x453103){_0xb522fc(_0x453103);});});}return _0x48ac7b[_0x5438('0x89')](_0x5438('0x8a'),attributes,{'tableName':_0x5438('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x15e83f){var _0x57eaf9=require('../../components/parsers/qs');var _0x1d1ef6={'raw':_0x15e83f[_0x5438('0x87')][_0x5438('0x8c')],'where':{}};var _0x29b416={};var _0x55dc43={'count':0x0,'rows':[]};var _0xdae744=_0x15e83f['query'][_0x5438('0x8d')];var _0x1227ad=_0x15e83f[_0x5438('0x87')]['mergeResources']||![];var _0x181862=_0xee5065(_0xdae744,_0x1227ad);if(!_0x181862[_0x5438('0x13')])throw new Error(_0x5438('0x8e')+_0xdae744+'\x27');var _0x497a69=[{'name':_0xdae744}];if(!_[_0x5438('0x8f')](_0x181862[_0x5438('0x1d')]))_0x497a69=_0x181862[_0x5438('0x1d')];var _0x519c94=[];for(var _0x2e0fef=0x0;_0x2e0fef<_0x497a69[_0x5438('0x90')];_0x2e0fef++){_0x519c94[_0x5438('0x91')](_0x4c0c22[_0x5438('0x92')][_0x5438('0x93')]({'where':{'userProfileId':_0x15e83f['params']['id'],'name':_0x497a69[_0x2e0fef][_0x5438('0xb')]},'raw':!![]}));}return Promise['all'](_0x519c94)[_0x5438('0x6')](function(_0x108bc2){var _0x57819b=_[_0x5438('0x4')](_0x108bc2,function(_0x56900e){return _0x56900e?_0x56900e:undefined;});var _0x2c49e3=_[_0x5438('0x4')](_0x497a69,['ignore',!![]]);var _0x183805=_[_0x5438('0x8f')](_0x57819b)&&_[_0x5438('0x8f')](_0x2c49e3)?null:_[_0x5438('0x94')](_0x2c49e3,_0x57819b);if(!_0x183805)return null;var _0x370243=[];for(var _0x261a2a=0x0;_0x261a2a<_0x183805['length'];_0x261a2a++){var _0x11a903=_['find'](_0x497a69,function(_0x7e2d0e){return _0x183805[_0x261a2a]?_0x7e2d0e[_0x5438('0xb')]===_0x183805[_0x261a2a][_0x5438('0xb')]:null;});if(_0x11a903){if(_0x183805[_0x261a2a][_0x5438('0x95')]){_0x370243[_0x5438('0x91')](_0x2b94d3(_0x181862[_0x5438('0x13')],_0x183805[_0x261a2a]));}else{if(!_0x183805[_0x261a2a][_0x5438('0x96')]){_0x370243[_0x5438('0x91')](_0x1f727d(_0x11a903,_0x183805[_0x261a2a],_0x181862[_0x5438('0x13')]));}else{if(_0x11a903[_0x5438('0xa')]){_0x370243[_0x5438('0x91')](_0x156fd9(_0x11a903,_0x183805[_0x261a2a]));}}}}}return Promise[_0x5438('0x97')](_0x370243);})[_0x5438('0x6')](function(_0x14463e){var _0x4ca085=_0x14463e;var _0x18a0a4=null;if(_0x4ca085){_0x18a0a4=_0x4ca085[_0x5438('0x90')]===0x1?_0x4ca085[0x0]:null;}if(!_0x18a0a4&&!_0x4ca085)return _0x55dc43;var _0x287287=_0x4c0c22[_0x181862[_0x5438('0x13')]][_0x5438('0x98')];_0x29b416[_0x5438('0xa')]=_[_0x5438('0x99')](_0x287287);_0x29b416['query']=_[_0x5438('0x99')](_0x15e83f[_0x5438('0x87')]);_0x29b416['filters']=_[_0x5438('0x9a')](_0x29b416['model'],_0x29b416['query']);_0x1d1ef6[_0x5438('0x9b')]=_['intersection'](_0x29b416['model'],_0x57eaf9[_0x5438('0x9c')](_0x15e83f[_0x5438('0x87')][_0x5438('0x9c')]));_0x1d1ef6[_0x5438('0x9b')]=_0x1d1ef6[_0x5438('0x9b')][_0x5438('0x90')]?_0x1d1ef6[_0x5438('0x9b')]:_0x29b416[_0x5438('0xa')];if(!_0x15e83f['query'][_0x5438('0x9d')](_0x5438('0x9e'))){_0x1d1ef6['limit']=_0x57eaf9[_0x5438('0x9f')](_0x15e83f[_0x5438('0x87')][_0x5438('0x9f')]);_0x1d1ef6[_0x5438('0xa0')]=_0x57eaf9['offset'](_0x15e83f[_0x5438('0x87')][_0x5438('0xa0')]);}_0x1d1ef6['order']=_0x57eaf9[_0x5438('0xa1')](_0x15e83f['query'][_0x5438('0xa1')]);_0x1d1ef6[_0x5438('0x85')]=_0x57eaf9[_0x5438('0xa2')](_[_0x5438('0xa3')](_0x15e83f[_0x5438('0x87')],_0x29b416[_0x5438('0xa2')]));if(_0x15e83f[_0x5438('0x87')][_0x5438('0x4')]){_0x1d1ef6[_0x5438('0x85')]=_[_0x5438('0xa4')](_0x1d1ef6[_0x5438('0x85')],{'$or':_['map'](_0x287287,function(_0x356d2f){if(_0x356d2f['type']['key']!==_0x5438('0xa5')){var _0x4c851e={};_0x4c851e[_0x356d2f[_0x5438('0x8')]]={'$like':'%'+_0x15e83f[_0x5438('0x87')]['filter']+'%'};return _0x4c851e;}})});}var _0x45a0cb=[];var _0x40a33d=null;var _0x20fe8d={};if(_0x18a0a4){_0x40a33d=_['find'](_0x497a69,[_0x5438('0xb'),_0x18a0a4['name']]);if(_0x40a33d[_0x5438('0x8')]){_0x20fe8d={};if(_0x181862['childModel']===_0x5438('0x78')){_0x20fe8d[_0x40a33d[_0x5438('0xa6')]]=_['map'](_0x18a0a4['associatedResources'],'id');}else{_0x20fe8d[_0x40a33d['foreignKey']]=_0x18a0a4['associatedResources'];}_0x45a0cb[_0x5438('0x91')](_0x20fe8d);}else{_0x1d1ef6[_0x5438('0x85')]['id']=_0x18a0a4[_0x5438('0xf')];}}else{for(var _0x1c1307=0x0;_0x1c1307<_0x4ca085[_0x5438('0x90')];_0x1c1307++){_0x40a33d=_[_0x5438('0x93')](_0x497a69,[_0x5438('0xb'),_0x4ca085[_0x1c1307][_0x5438('0xb')]]);if(_0x40a33d['field']){_0x20fe8d={};_0x20fe8d[_0x40a33d[_0x5438('0xa6')]]=_0x4ca085[_0x1c1307][_0x5438('0xf')];_0x45a0cb[_0x5438('0x91')](_0x20fe8d);}else{if(!_0x1d1ef6[_0x5438('0x85')]['id'])_0x1d1ef6[_0x5438('0x85')]['id']=[];_0x4ca085[_0x1c1307]['associatedResources'][_0x5438('0xa7')](function(_0x46c755){_0x1d1ef6[_0x5438('0x85')]['id'][_0x5438('0x91')](_0x46c755);});}}}if(!_['isEmpty'](_0x45a0cb)){_0x1d1ef6[_0x5438('0x85')]=_[_0x5438('0xa4')](_0x1d1ef6['where'],{'$and':{'$or':_0x45a0cb}});}_0x1d1ef6=_[_0x5438('0xa4')]({},_0x1d1ef6,_0x15e83f[_0x5438('0xa8')]);if(_0x18a0a4&&!_0x18a0a4[_0x5438('0x96')]&&_0x181862[_0x5438('0x13')]===_0x5438('0x78')){if(_0x15e83f['query']['includeAll']){_0x1d1ef6[_0x5438('0xa9')]=[{'all':!![]}];}return _0x4c0c22[_0x181862[_0x5438('0x13')]][_0x5438('0x5')](_0x1d1ef6)[_0x5438('0x6')](function(_0xf68ac1){var _0x40b239=[];_0xf68ac1[_0x5438('0xa7')](function(_0xc6ca09){var _0x847b9b;switch(_0xc6ca09[_0x5438('0xaa')]){case _0x5438('0xab'):_0x847b9b=_[_0x5438('0x93')](_0x18a0a4[_0x5438('0xf')],function(_0x15173d){return _0x15173d['id']===_0xc6ca09[_0x5438('0x79')]&&_0x15173d[_0x5438('0x3c')]===_0x5438('0xac');});break;case _0x5438('0xad'):_0x847b9b=_[_0x5438('0x93')](_0x18a0a4[_0x5438('0xf')],function(_0x14fa08){return _0x14fa08['id']===_0xc6ca09[_0x5438('0x79')]&&_0x14fa08[_0x5438('0x3c')]===_0x5438('0xae');});break;}if(_0x847b9b)_0x40b239[_0x5438('0x91')](_0xc6ca09);});_0x55dc43['count']=_0x40b239[_0x5438('0x90')];_0x55dc43[_0x5438('0xaf')]=_0x40b239;return _0x55dc43;});}else{if(!_[_0x5438('0x8f')](_0x15e83f['query'][_0x5438('0xb0')])){_0x1d1ef6[_0x5438('0x85')]['id']=_0x1d1ef6['where']['id']?_[_0x5438('0x9a')](_0x1d1ef6[_0x5438('0x85')]['id'],_0x15e83f['query'][_0x5438('0xb0')]):_0x15e83f[_0x5438('0x87')]['ids'];if(_0x15e83f[_0x5438('0x87')][_0x5438('0xb1')]){_0x1d1ef6['order']=_0x15e83f['query'][_0x5438('0xb1')];}}if(_0x15e83f['query'][_0x5438('0xb2')]){_0x1d1ef6[_0x5438('0x85')]=_[_0x5438('0xa4')](_0x1d1ef6[_0x5438('0x85')],{'$and':_0x15e83f['query'][_0x5438('0xb2')]});}return _0x4c0c22[_0x181862[_0x5438('0x13')]]['count']({'where':_0x1d1ef6[_0x5438('0x85')]})[_0x5438('0x6')](function(_0x6d0b04){_0x55dc43['count']=_0x6d0b04;if(_0x15e83f[_0x5438('0x87')][_0x5438('0xb3')]){if(_0x181862[_0x5438('0x13')]===_0x5438('0x1c')){_0x1d1ef6[_0x5438('0xa9')]=[{'model':_0x4c0c22['Tag'],'as':'Tags','attributes':['id',_0x5438('0xb'),_0x5438('0xb4')],'required':_0x15e83f['query'][_0x5438('0xb5')]?!![]:![]},{'model':_0x4c0c22['Tag'],'as':_0x5438('0xb6'),'attributes':['id',_0x5438('0xb'),'color'],'through':_0x15e83f[_0x5438('0x87')][_0x5438('0xb5')]?{'attributes':[],'where':{'TagId':_0x15e83f[_0x5438('0x87')][_0x5438('0xb5')]||undefined}}:{},'required':_0x15e83f[_0x5438('0x87')][_0x5438('0xb5')]?!![]:![]}];}else{_0x1d1ef6[_0x5438('0xa9')]=[{'all':!![]}];}}return _0x4c0c22[_0x181862[_0x5438('0x13')]]['findAll'](_0x1d1ef6);})[_0x5438('0x6')](function(_0x176079){_0x55dc43[_0x5438('0xaf')]=_0x176079;if(_0xdae744===_0x5438('0x32')&&_0x15e83f[_0x5438('0x87')]['openTabs']===_0x5438('0xb7')){var _0x18a950=[];for(var _0x2857c9=0x0;_0x2857c9<_0x55dc43[_0x5438('0xaf')][_0x5438('0x90')];_0x2857c9++){_0x18a950['push'](_0x3d370b('chat',_0x55dc43[_0x5438('0xaf')][_0x2857c9]['dataValues']));_0x18a950['push'](_0x3d370b('sms',_0x55dc43[_0x5438('0xaf')][_0x2857c9]['dataValues']));_0x18a950[_0x5438('0x91')](_0x3d370b('fax',_0x55dc43['rows'][_0x2857c9][_0x5438('0xb8')]));_0x18a950[_0x5438('0x91')](_0x3d370b(_0x5438('0xb9'),_0x55dc43[_0x5438('0xaf')][_0x2857c9][_0x5438('0xb8')]));_0x18a950[_0x5438('0x91')](_0x3d370b(_0x5438('0xba'),_0x55dc43[_0x5438('0xaf')][_0x2857c9][_0x5438('0xb8')]));_0x18a950['push'](_0x3d370b(_0x5438('0xbb'),_0x55dc43[_0x5438('0xaf')][_0x2857c9][_0x5438('0xb8')]));}return Promise[_0x5438('0x97')](_0x18a950)[_0x5438('0x6')](function(){return _0x55dc43;});}return _0x55dc43;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9a9c590..4e98ac2 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 _0xc7bd=['redis','localhost','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x485835,_0x81cd5){var _0x9e5251=function(_0x3d93ee){while(--_0x3d93ee){_0x485835['push'](_0x485835['shift']());}};_0x9e5251(++_0x81cd5);}(_0xc7bd,0x86));var _0xdc7b=function(_0x528761,_0x567136){_0x528761=_0x528761-0x0;var _0x5f37fe=_0xc7bd[_0x528761];return _0x5f37fe;};'use strict';var _=require('lodash');var util=require(_0xdc7b('0x0'));var moment=require(_0xdc7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xdc7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc7b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc7b('0x4'))(_0xdc7b('0x5'));var config=require(_0xdc7b('0x6'));var jayson=require(_0xdc7b('0x7'));var client=jayson[_0xdc7b('0x8')][_0xdc7b('0x9')]({'port':0x232a});config[_0xdc7b('0xa')]=_['defaults'](config[_0xdc7b('0xa')],{'host':_0xdc7b('0xb'),'port':0x18eb});var socket=require(_0xdc7b('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0xdc7b('0xd')](socket);function respondWithRpcPromise(_0x316a19,_0x167e40,_0x295800){return new BPromise(function(_0xec8041,_0x44d499){return client['request'](_0x316a19,_0x295800)[_0xdc7b('0xe')](function(_0x359a53){logger[_0xdc7b('0xf')](_0xdc7b('0x10'),_0x167e40,_0xdc7b('0x11'));logger[_0xdc7b('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x167e40,_0xdc7b('0x11'),JSON[_0xdc7b('0x13')](_0x359a53));if(_0x359a53['error']){if(_0x359a53[_0xdc7b('0x14')]['code']===0x1f4){logger[_0xdc7b('0x14')](_0xdc7b('0x10'),_0x167e40,_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);return _0x44d499(_0x359a53['error'][_0xdc7b('0x15')]);}logger[_0xdc7b('0x14')]('UserProfile,\x20%s,\x20%s',_0x167e40,_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);return _0xec8041(_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);}else{logger[_0xdc7b('0xf')](_0xdc7b('0x10'),_0x167e40,_0xdc7b('0x11'));_0xec8041(_0x359a53[_0xdc7b('0x16')]['message']);}})[_0xdc7b('0x17')](function(_0x54a99b){logger[_0xdc7b('0x14')]('UserProfile,\x20%s,\x20%s',_0x167e40,_0x54a99b);_0x44d499(_0x54a99b);});});} \ No newline at end of file +var _0xb5dd=['socket.io-emitter','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xcadc44,_0x9c47c1){var _0x10bc56=function(_0x2e4820){while(--_0x2e4820){_0xcadc44['push'](_0xcadc44['shift']());}};_0x10bc56(++_0x9c47c1);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var moment=require(_0xdb5d('0x2'));var BPromise=require(_0xdb5d('0x3'));var rs=require(_0xdb5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb5d('0x5'))['db'];var utils=require(_0xdb5d('0x6'));var logger=require(_0xdb5d('0x7'))('rpc');var config=require(_0xdb5d('0x8'));var jayson=require(_0xdb5d('0x9'));var client=jayson[_0xdb5d('0xa')][_0xdb5d('0xb')]({'port':0x232a});config[_0xdb5d('0xc')]=_[_0xdb5d('0xd')](config[_0xdb5d('0xc')],{'host':_0xdb5d('0xe'),'port':0x18eb});var socket=require(_0xdb5d('0xf'))(new Redis(config[_0xdb5d('0xc')]));require('./userProfile.socket')[_0xdb5d('0x10')](socket);function respondWithRpcPromise(_0x288b8f,_0x2a0f4a,_0x4fb3ab){return new BPromise(function(_0x541c31,_0xeb1c09){return client[_0xdb5d('0x11')](_0x288b8f,_0x4fb3ab)[_0xdb5d('0x12')](function(_0x56eb05){logger['info'](_0xdb5d('0x13'),_0x2a0f4a,_0xdb5d('0x14'));logger[_0xdb5d('0x15')](_0xdb5d('0x16'),_0x2a0f4a,_0xdb5d('0x14'),JSON[_0xdb5d('0x17')](_0x56eb05));if(_0x56eb05[_0xdb5d('0x18')]){if(_0x56eb05['error'][_0xdb5d('0x19')]===0x1f4){logger[_0xdb5d('0x18')](_0xdb5d('0x13'),_0x2a0f4a,_0x56eb05['error'][_0xdb5d('0x1a')]);return _0xeb1c09(_0x56eb05[_0xdb5d('0x18')][_0xdb5d('0x1a')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x2a0f4a,_0x56eb05[_0xdb5d('0x18')]['message']);return _0x541c31(_0x56eb05[_0xdb5d('0x18')][_0xdb5d('0x1a')]);}else{logger[_0xdb5d('0x1b')](_0xdb5d('0x13'),_0x2a0f4a,_0xdb5d('0x14'));_0x541c31(_0x56eb05[_0xdb5d('0x1c')][_0xdb5d('0x1a')]);}})['catch'](function(_0x21e981){logger['error'](_0xdb5d('0x13'),_0x2a0f4a,_0x21e981);_0xeb1c09(_0x21e981);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b640783..5363231 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 _0xbab2=['userProfile:','save','remove','emit','removeListener','register','length'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xbab2,0x78));var _0x2bab=function(_0x1fa2b6,_0xe483e){_0x1fa2b6=_0x1fa2b6-0x0;var _0x459223=_0xbab2[_0x1fa2b6];return _0x459223;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2bab('0x0'),_0x2bab('0x1'),'update'];function createListener(_0x4b3ee0,_0x2650eb){return function(_0x9f832){_0x2650eb[_0x2bab('0x2')](_0x4b3ee0,_0x9f832);};}function removeListener(_0x5784d9,_0x3010fe){return function(){UserProfileEvents[_0x2bab('0x3')](_0x5784d9,_0x3010fe);};}exports[_0x2bab('0x4')]=function(_0x3ce3ca){for(var _0x1ec373=0x0,_0xe80222=events[_0x2bab('0x5')];_0x1ec373<_0xe80222;_0x1ec373++){var _0x82ce0f=events[_0x1ec373];var _0x895c1=createListener(_0x2bab('0x6')+_0x82ce0f,_0x3ce3ca);UserProfileEvents['on'](_0x82ce0f,_0x895c1);}}; \ No newline at end of file +var _0x8bf2=['removeListener','register','length','userProfile:','remove','update','emit'];(function(_0x4a99db,_0x20f9a5){var _0xdce103=function(_0xa26fba){while(--_0xa26fba){_0x4a99db['push'](_0x4a99db['shift']());}};_0xdce103(++_0x20f9a5);}(_0x8bf2,0x12a));var _0x28bf=function(_0x11dd9d,_0x37a83){_0x11dd9d=_0x11dd9d-0x0;var _0x53188e=_0x8bf2[_0x11dd9d];return _0x53188e;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x28bf('0x0'),_0x28bf('0x1')];function createListener(_0x1a5317,_0x47f576){return function(_0xb84445){_0x47f576[_0x28bf('0x2')](_0x1a5317,_0xb84445);};}function removeListener(_0xc225f7,_0x118fa5){return function(){UserProfileEvents[_0x28bf('0x3')](_0xc225f7,_0x118fa5);};}exports[_0x28bf('0x4')]=function(_0x2a418d){for(var _0x1b9d36=0x0,_0x3e9e67=events[_0x28bf('0x5')];_0x1b9d36<_0x3e9e67;_0x1b9d36++){var _0x3961c0=events[_0x1b9d36];var _0xc6c444=createListener(_0x28bf('0x6')+_0x3961c0,_0x2a418d);UserProfileEvents['on'](_0x3961c0,_0xc6c444);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6819ebb..2a3e98e 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 _0x2d82=['get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x4a2f71,_0x552101){var _0x26fc92=function(_0x16ded5){while(--_0x16ded5){_0x4a2f71['push'](_0x4a2f71['shift']());}};_0x26fc92(++_0x552101);}(_0x2d82,0x97));var _0x22d8=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x2d82[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x22d8('0x0'));var util=require(_0x22d8('0x1'));var path=require('path');var timeout=require(_0x22d8('0x2'));var express=require(_0x22d8('0x3'));var router=express[_0x22d8('0x4')]();var fs_extra=require(_0x22d8('0x5'));var auth=require(_0x22d8('0x6'));var interaction=require(_0x22d8('0x7'));var config=require(_0x22d8('0x8'));var controller=require(_0x22d8('0x9'));router[_0x22d8('0xa')]('/',auth[_0x22d8('0xb')](),controller[_0x22d8('0xc')]);router['get']('/describe',auth[_0x22d8('0xb')](),controller[_0x22d8('0xd')]);router[_0x22d8('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x22d8('0xe')]);router[_0x22d8('0xf')]('/',auth[_0x22d8('0xb')](),controller[_0x22d8('0x10')]);router[_0x22d8('0x11')](_0x22d8('0x12'),auth[_0x22d8('0xb')](),controller[_0x22d8('0x13')]);router[_0x22d8('0x14')](_0x22d8('0x12'),auth[_0x22d8('0xb')](),controller[_0x22d8('0x15')]);module[_0x22d8('0x16')]=router; \ No newline at end of file +var _0xbe5d=['isAuthenticated','describe','/:id','create','put','update','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x78c2f2,_0x426a10){var _0x595ec3=function(_0x495c06){while(--_0x495c06){_0x78c2f2['push'](_0x78c2f2['shift']());}};_0x595ec3(++_0x426a10);}(_0xbe5d,0xd4));var _0xdbe5=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0xbe5d[_0x4d6bfd];return _0x243a46;};'use strict';var multer=require('multer');var util=require(_0xdbe5('0x0'));var path=require(_0xdbe5('0x1'));var timeout=require(_0xdbe5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdbe5('0x3'));var interaction=require(_0xdbe5('0x4'));var config=require(_0xdbe5('0x5'));var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdbe5('0x6')]);router[_0xdbe5('0x7')](_0xdbe5('0x8'),auth[_0xdbe5('0x9')](),controller[_0xdbe5('0xa')]);router[_0xdbe5('0x7')](_0xdbe5('0xb'),auth[_0xdbe5('0x9')](),controller['show']);router['post']('/',auth[_0xdbe5('0x9')](),controller[_0xdbe5('0xc')]);router[_0xdbe5('0xd')](_0xdbe5('0xb'),auth['isAuthenticated'](),controller[_0xdbe5('0xe')]);router[_0xdbe5('0xf')](_0xdbe5('0xb'),auth[_0xdbe5('0x9')](),controller[_0xdbe5('0x10')]);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 402c063..3fe3bf5 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 _0xf439=['exports','STRING','INTEGER','sequelize'];(function(_0x2a6cd6,_0x6daf22){var _0xc0635a=function(_0x251a03){while(--_0x251a03){_0x2a6cd6['push'](_0x2a6cd6['shift']());}};_0xc0635a(++_0x6daf22);}(_0xf439,0x7f));var _0x9f43=function(_0x496fde,_0x4dfb29){_0x496fde=_0x496fde-0x0;var _0x432a0a=_0xf439[_0x496fde];return _0x432a0a;};'use strict';var Sequelize=require(_0x9f43('0x0'));module[_0x9f43('0x1')]={'name':{'type':Sequelize[_0x9f43('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9f43('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9f43('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfb9c=['STRING','INTEGER','sequelize'];(function(_0xf6255e,_0x226182){var _0x48b476=function(_0x9d4c5e){while(--_0x9d4c5e){_0xf6255e['push'](_0xf6255e['shift']());}};_0x48b476(++_0x226182);}(_0xfb9c,0x134));var _0xcfb9=function(_0x40de6f,_0x3d5f9c){_0x40de6f=_0x40de6f-0x0;var _0x44a887=_0xfb9c[_0x40de6f];return _0x44a887;};'use strict';var Sequelize=require(_0xcfb9('0x0'));module['exports']={'name':{'type':Sequelize[_0xcfb9('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xcfb9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcfb9('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 27c69fc..3228919 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 _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x2656c8,_0x5b9cf9){var _0x4eff8b=function(_0x547623){while(--_0x547623){_0x2656c8['push'](_0x2656c8['shift']());}};_0x4eff8b(++_0x5b9cf9);}(_0x9582,0x95));var _0x2958=function(_0x43fc1b,_0x553fca){_0x43fc1b=_0x43fc1b-0x0;var _0x136d91=_0x9582[_0x43fc1b];return _0x136d91;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file +var _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','UserProfileResource','includeAll','include'];(function(_0x249e82,_0x432de5){var _0x3dde2a=function(_0x4c09b0){while(--_0x4c09b0){_0x249e82['push'](_0x249e82['shift']());}};_0x3dde2a(++_0x432de5);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5c3c[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['UserProfileResource'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['UserProfileResource'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['UserProfileResource'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['UserProfileResource'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c9ded6f..1d67491 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 _0x1da1=['request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x39ff5c,_0x3de001){var _0x1eba54=function(_0x1fcfaa){while(--_0x1fcfaa){_0x39ff5c['push'](_0x39ff5c['shift']());}};_0x1eba54(++_0x3de001);}(_0x1da1,0x1c5));var _0x11da=function(_0x4532c6,_0x1c75b4){_0x4532c6=_0x4532c6-0x0;var _0x41e24a=_0x1da1[_0x4532c6];return _0x41e24a;};'use strict';var _=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var logger=require(_0x11da('0x2'))(_0x11da('0x3'));var moment=require(_0x11da('0x4'));var BPromise=require(_0x11da('0x5'));var rp=require(_0x11da('0x6'));var fs=require('fs');var path=require(_0x11da('0x7'));var rimraf=require('rimraf');var config=require(_0x11da('0x8'));var attributes=require(_0x11da('0x9'));module[_0x11da('0xa')]=function(_0x583b1f,_0x4ad01b){return _0x583b1f[_0x11da('0xb')](_0x11da('0xc'),attributes,{'tableName':_0x11da('0xd'),'paranoid':![],'indexes':[{'name':_0x11da('0xe'),'fields':[_0x11da('0xf'),_0x11da('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8b1=['sectionId','lodash','util','api','moment','request-promise','path','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x2f49db,_0x58d5df){var _0x3a2ea4=function(_0x3e722c){while(--_0x3e722c){_0x2f49db['push'](_0x2f49db['shift']());}};_0x3a2ea4(++_0x58d5df);}(_0xe8b1,0x7a));var _0x1e8b=function(_0x34a923,_0x3ce38d){_0x34a923=_0x34a923-0x0;var _0x46442b=_0xe8b1[_0x34a923];return _0x46442b;};'use strict';var _=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var logger=require('../../config/logger')(_0x1e8b('0x2'));var moment=require(_0x1e8b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e8b('0x4'));var fs=require('fs');var path=require(_0x1e8b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x1e8b('0x6')]=function(_0x344b54,_0x591e78){return _0x344b54[_0x1e8b('0x7')](_0x1e8b('0x8'),attributes,{'tableName':_0x1e8b('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x1e8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a65187f..4d063f9 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 _0x5ab8=['result','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x496938,_0x518daf){var _0x48fec8=function(_0x26474c){while(--_0x26474c){_0x496938['push'](_0x496938['shift']());}};_0x48fec8(++_0x518daf);}(_0x5ab8,0x1d5));var _0x85ab=function(_0x256814,_0x6bdc0c){_0x256814=_0x256814-0x0;var _0x37ffc8=_0x5ab8[_0x256814];return _0x37ffc8;};'use strict';var _=require('lodash');var util=require(_0x85ab('0x0'));var moment=require('moment');var BPromise=require(_0x85ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x85ab('0x2'));var logger=require(_0x85ab('0x3'))(_0x85ab('0x4'));var config=require(_0x85ab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x85ab('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144072,_0x10daf3,_0x8f239a){return new BPromise(function(_0x191ff3,_0x44679b){return client[_0x85ab('0x7')](_0x144072,_0x8f239a)['then'](function(_0x235512){logger[_0x85ab('0x8')](_0x85ab('0x9'),_0x10daf3,_0x85ab('0xa'));logger[_0x85ab('0xb')](_0x85ab('0xc'),_0x10daf3,_0x85ab('0xa'),JSON[_0x85ab('0xd')](_0x235512));if(_0x235512[_0x85ab('0xe')]){if(_0x235512[_0x85ab('0xe')][_0x85ab('0xf')]===0x1f4){logger[_0x85ab('0xe')](_0x85ab('0x9'),_0x10daf3,_0x235512[_0x85ab('0xe')][_0x85ab('0x10')]);return _0x44679b(_0x235512[_0x85ab('0xe')][_0x85ab('0x10')]);}logger['error'](_0x85ab('0x9'),_0x10daf3,_0x235512[_0x85ab('0xe')][_0x85ab('0x10')]);return _0x191ff3(_0x235512[_0x85ab('0xe')][_0x85ab('0x10')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x10daf3,_0x85ab('0xa'));_0x191ff3(_0x235512[_0x85ab('0x11')][_0x85ab('0x10')]);}})['catch'](function(_0x1c564f){logger[_0x85ab('0xe')](_0x85ab('0x9'),_0x10daf3,_0x1c564f);_0x44679b(_0x1c564f);});});} \ No newline at end of file +var _0x6592=['debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x9353b,_0x11bb4a){var _0x58ad59=function(_0x55ba3b){while(--_0x55ba3b){_0x9353b['push'](_0x9353b['shift']());}};_0x58ad59(++_0x11bb4a);}(_0x6592,0x1bf));var _0x2659=function(_0x30ec8f,_0x544bbe){_0x30ec8f=_0x30ec8f-0x0;var _0x19f5c9=_0x6592[_0x30ec8f];return _0x19f5c9;};'use strict';var _=require(_0x2659('0x0'));var util=require(_0x2659('0x1'));var moment=require(_0x2659('0x2'));var BPromise=require(_0x2659('0x3'));var rs=require(_0x2659('0x4'));var fs=require('fs');var Redis=require(_0x2659('0x5'));var db=require(_0x2659('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2659('0x7'))('rpc');var config=require(_0x2659('0x8'));var jayson=require(_0x2659('0x9'));var client=jayson[_0x2659('0xa')][_0x2659('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21b257,_0x4d869c,_0x58416e){return new BPromise(function(_0x41089b,_0x13e045){return client['request'](_0x21b257,_0x58416e)[_0x2659('0xc')](function(_0x2e601c){logger[_0x2659('0xd')](_0x2659('0xe'),_0x4d869c,'request\x20sent');logger[_0x2659('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4d869c,_0x2659('0x10'),JSON['stringify'](_0x2e601c));if(_0x2e601c['error']){if(_0x2e601c[_0x2659('0x11')][_0x2659('0x12')]===0x1f4){logger[_0x2659('0x11')](_0x2659('0xe'),_0x4d869c,_0x2e601c[_0x2659('0x11')]['message']);return _0x13e045(_0x2e601c['error'][_0x2659('0x13')]);}logger[_0x2659('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x4d869c,_0x2e601c['error'][_0x2659('0x13')]);return _0x41089b(_0x2e601c[_0x2659('0x11')][_0x2659('0x13')]);}else{logger[_0x2659('0xd')](_0x2659('0xe'),_0x4d869c,_0x2659('0x10'));_0x41089b(_0x2e601c['result'][_0x2659('0x13')]);}})[_0x2659('0x14')](function(_0x2e002e){logger[_0x2659('0x11')](_0x2659('0xe'),_0x4d869c,_0x2e002e);_0x13e045(_0x2e002e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4d79c70..6e90efb 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 _0xd8a7=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post','put','delete','destroy'];(function(_0x1fd245,_0x5cedaf){var _0x76b8b5=function(_0x296668){while(--_0x296668){_0x1fd245['push'](_0x1fd245['shift']());}};_0x76b8b5(++_0x5cedaf);}(_0xd8a7,0x78));var _0x7d8a=function(_0x22bf71,_0x268556){_0x22bf71=_0x22bf71-0x0;var _0x296db1=_0xd8a7[_0x22bf71];return _0x296db1;};'use strict';var multer=require('multer');var util=require(_0x7d8a('0x0'));var path=require(_0x7d8a('0x1'));var timeout=require(_0x7d8a('0x2'));var express=require(_0x7d8a('0x3'));var router=express[_0x7d8a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7d8a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7d8a('0x6'));router[_0x7d8a('0x7')]('/',auth[_0x7d8a('0x8')](),controller['index']);router[_0x7d8a('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7d8a('0x9')]);router[_0x7d8a('0x7')](_0x7d8a('0xa'),auth['isAuthenticated'](),controller[_0x7d8a('0xb')]);router[_0x7d8a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7d8a('0xd')](_0x7d8a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7d8a('0xe')](_0x7d8a('0xa'),auth['isAuthenticated'](),controller[_0x7d8a('0xf')]);module[_0x7d8a('0x10')]=router; \ No newline at end of file +var _0x5472=['describe','/:id','post','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe'];(function(_0x3e16f3,_0x2a5c3f){var _0x545748=function(_0x18fbd0){while(--_0x18fbd0){_0x3e16f3['push'](_0x3e16f3['shift']());}};_0x545748(++_0x2a5c3f);}(_0x5472,0x131));var _0x2547=function(_0x25bbd6,_0x18f6d3){_0x25bbd6=_0x25bbd6-0x0;var _0x3a4c78=_0x5472[_0x25bbd6];return _0x3a4c78;};'use strict';var multer=require(_0x2547('0x0'));var util=require(_0x2547('0x1'));var path=require(_0x2547('0x2'));var timeout=require(_0x2547('0x3'));var express=require(_0x2547('0x4'));var router=express[_0x2547('0x5')]();var fs_extra=require(_0x2547('0x6'));var auth=require(_0x2547('0x7'));var interaction=require(_0x2547('0x8'));var config=require(_0x2547('0x9'));var controller=require(_0x2547('0xa'));router[_0x2547('0xb')]('/',auth[_0x2547('0xc')](),controller[_0x2547('0xd')]);router[_0x2547('0xb')](_0x2547('0xe'),auth[_0x2547('0xc')](),controller[_0x2547('0xf')]);router[_0x2547('0xb')](_0x2547('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x2547('0x11')]('/',auth[_0x2547('0xc')](),controller['create']);router['put'](_0x2547('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x2547('0x12')](_0x2547('0x10'),auth[_0x2547('0xc')](),controller[_0x2547('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index bd52ab4..bea9ec3 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x69d3,0xda));var _0x369d=function(_0x1815dd,_0x5701f5){_0x1815dd=_0x1815dd-0x0;var _0x48af20=_0x69d3[_0x1815dd];return _0x48af20;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}}; \ No newline at end of file +var _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x69d3,0xda));var _0x369d=function(_0x5d98aa,_0x59d9dc){_0x5d98aa=_0x5d98aa-0x0;var _0x16c4db=_0x69d3[_0x5d98aa];return _0x16c4db;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 279c093..33aad6a 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 _0x06c9=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','fields','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x16c9e8,_0x5c3c56){var _0x2d0716=function(_0xc63616){while(--_0xc63616){_0x16c9e8['push'](_0x16c9e8['shift']());}};_0x2d0716(++_0x5c3c56);}(_0x06c9,0x115));var _0x906c=function(_0x21f319,_0x25fa86){_0x21f319=_0x21f319-0x0;var _0x244aac=_0x06c9[_0x21f319];return _0x244aac;};'use strict';var emlformat=require(_0x906c('0x0'));var rimraf=require(_0x906c('0x1'));var zipdir=require(_0x906c('0x2'));var jsonpatch=require(_0x906c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x906c('0x4'));var Mustache=require(_0x906c('0x5'));var util=require(_0x906c('0x6'));var path=require(_0x906c('0x7'));var sox=require('sox');var csv=require(_0x906c('0x8'));var ejs=require(_0x906c('0x9'));var fs=require('fs');var fs_extra=require(_0x906c('0xa'));var _=require('lodash');var squel=require(_0x906c('0xb'));var crypto=require(_0x906c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x906c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x906c('0xe'));var Papa=require(_0x906c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x906c('0x10'));var hardwareService=require(_0x906c('0x11'));var logger=require(_0x906c('0x12'))('api');var utils=require(_0x906c('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x906c('0x14'))['db'];function respondWithStatusCode(_0xca97f6,_0x193e0c){_0x193e0c=_0x193e0c||0xcc;return function(_0x187c94){if(_0x187c94){return _0xca97f6[_0x906c('0x15')](_0x193e0c);}return _0xca97f6[_0x906c('0x16')](_0x193e0c)[_0x906c('0x17')]();};}function respondWithResult(_0x22e622,_0x2dd3db){_0x2dd3db=_0x2dd3db||0xc8;return function(_0x30f6e6){if(_0x30f6e6){return _0x22e622[_0x906c('0x16')](_0x2dd3db)[_0x906c('0x18')](_0x30f6e6);}};}function respondWithFilteredResult(_0xd0a8c6,_0x192571){return function(_0xb9ebc6){if(_0xb9ebc6){var _0x5bc6b7=typeof _0x192571[_0x906c('0x19')]==='undefined'&&typeof _0x192571[_0x906c('0x1a')]===_0x906c('0x1b');var _0x223d1e=_0xb9ebc6[_0x906c('0x1c')];var _0x2e47cc=_0x5bc6b7?0x0:_0x192571['offset'];var _0x20985d=_0x5bc6b7?_0xb9ebc6[_0x906c('0x1c')]:_0x192571[_0x906c('0x19')]+_0x192571[_0x906c('0x1a')];var _0x21dbc1;if(_0x20985d>=_0x223d1e){_0x20985d=_0x223d1e;_0x21dbc1=0xc8;}else{_0x21dbc1=0xce;}_0xd0a8c6[_0x906c('0x16')](_0x21dbc1);return _0xd0a8c6[_0x906c('0x1d')](_0x906c('0x1e'),_0x2e47cc+'-'+_0x20985d+'/'+_0x223d1e)[_0x906c('0x18')](_0xb9ebc6);}return null;};}function patchUpdates(_0x1d3b23){return function(_0x1e6138){try{jsonpatch[_0x906c('0x1f')](_0x1e6138,_0x1d3b23,!![]);}catch(_0x3224a0){return BPromise[_0x906c('0x20')](_0x3224a0);}return _0x1e6138['save']();};}function saveUpdates(_0x51a89d,_0x4383a6){return function(_0x566c3d){if(_0x566c3d){return _0x566c3d[_0x906c('0x21')](_0x51a89d)[_0x906c('0x22')](function(_0x5175b9){return _0x5175b9;});}return null;};}function removeEntity(_0x5e28ed,_0x3b61eb){return function(_0x12d322){if(_0x12d322){return _0x12d322[_0x906c('0x23')]()[_0x906c('0x22')](function(){_0x5e28ed[_0x906c('0x16')](0xcc)[_0x906c('0x17')]();});}};}function handleEntityNotFound(_0x157a30,_0x129832){return function(_0x52de7b){if(!_0x52de7b){_0x157a30[_0x906c('0x15')](0x194);}return _0x52de7b;};}function handleError(_0x1fe67b,_0x309ca3){_0x309ca3=_0x309ca3||0x1f4;return function(_0xb0e312){logger[_0x906c('0x24')](_0xb0e312[_0x906c('0x25')]);if(_0xb0e312[_0x906c('0x26')]){delete _0xb0e312[_0x906c('0x26')];}_0x1fe67b[_0x906c('0x16')](_0x309ca3)[_0x906c('0x27')](_0xb0e312);};}exports[_0x906c('0x28')]=function(_0x7b3a05,_0x56d61c){var _0x174c79={},_0xdbfc09={},_0x492b20={'count':0x0,'rows':[]};var _0x4c6edb=_[_0x906c('0x29')](db[_0x906c('0x2a')][_0x906c('0x2b')],function(_0x126a68){return{'name':_0x126a68[_0x906c('0x2c')],'type':_0x126a68[_0x906c('0x2d')][_0x906c('0x2e')]};});_0xdbfc09[_0x906c('0x2f')]=_[_0x906c('0x29')](_0x4c6edb,_0x906c('0x26'));_0xdbfc09[_0x906c('0x30')]=_['keys'](_0x7b3a05[_0x906c('0x30')]);_0xdbfc09[_0x906c('0x31')]=_[_0x906c('0x32')](_0xdbfc09['model'],_0xdbfc09[_0x906c('0x30')]);_0x174c79[_0x906c('0x33')]=_['intersection'](_0xdbfc09[_0x906c('0x2f')],qs['fields'](_0x7b3a05['query']['fields']));_0x174c79[_0x906c('0x33')]=_0x174c79[_0x906c('0x33')]['length']?_0x174c79['attributes']:_0xdbfc09[_0x906c('0x2f')];if(!_0x7b3a05[_0x906c('0x30')][_0x906c('0x34')](_0x906c('0x35'))){_0x174c79['limit']=qs[_0x906c('0x1a')](_0x7b3a05[_0x906c('0x30')][_0x906c('0x1a')]);_0x174c79[_0x906c('0x19')]=qs[_0x906c('0x19')](_0x7b3a05['query'][_0x906c('0x19')]);}_0x174c79[_0x906c('0x36')]=qs[_0x906c('0x37')](_0x7b3a05[_0x906c('0x30')][_0x906c('0x37')]);_0x174c79[_0x906c('0x38')]=qs[_0x906c('0x31')](_[_0x906c('0x39')](_0x7b3a05[_0x906c('0x30')],_0xdbfc09[_0x906c('0x31')]),_0x4c6edb);if(_0x7b3a05['query'][_0x906c('0x3a')]){_0x174c79[_0x906c('0x38')]=_[_0x906c('0x3b')](_0x174c79[_0x906c('0x38')],{'$or':_[_0x906c('0x29')](_0x4c6edb,function(_0x2b33e6){if(_0x2b33e6[_0x906c('0x2d')]!==_0x906c('0x3c')){var _0x571a40={};_0x571a40[_0x2b33e6[_0x906c('0x26')]]={'$like':'%'+_0x7b3a05['query']['filter']+'%'};return _0x571a40;}})});}_0x174c79=_['merge']({},_0x174c79,_0x7b3a05[_0x906c('0x3d')]);var _0x5bb18c={'where':_0x174c79[_0x906c('0x38')]};return db[_0x906c('0x2a')][_0x906c('0x1c')](_0x5bb18c)[_0x906c('0x22')](function(_0x43ee79){_0x492b20['count']=_0x43ee79;if(_0x7b3a05[_0x906c('0x30')][_0x906c('0x3e')]){_0x174c79[_0x906c('0x3f')]=[{'all':!![]}];}return db['UserProfileSection'][_0x906c('0x40')](_0x174c79);})[_0x906c('0x22')](function(_0x4d891a){_0x492b20['rows']=_0x4d891a;return _0x492b20;})[_0x906c('0x22')](respondWithFilteredResult(_0x56d61c,_0x174c79))['catch'](handleError(_0x56d61c,null));};exports[_0x906c('0x41')]=function(_0x4fab15,_0x25055d){var _0x2e335e={'raw':![],'where':{'id':_0x4fab15[_0x906c('0x42')]['id']}},_0x7cc487={};_0x7cc487[_0x906c('0x2f')]=_[_0x906c('0x43')](db[_0x906c('0x2a')][_0x906c('0x2b')]);_0x7cc487[_0x906c('0x30')]=_['keys'](_0x4fab15[_0x906c('0x30')]);_0x7cc487['filters']=_[_0x906c('0x32')](_0x7cc487[_0x906c('0x2f')],_0x7cc487[_0x906c('0x30')]);_0x2e335e[_0x906c('0x33')]=_['intersection'](_0x7cc487[_0x906c('0x2f')],qs[_0x906c('0x44')](_0x4fab15[_0x906c('0x30')][_0x906c('0x44')]));_0x2e335e[_0x906c('0x33')]=_0x2e335e[_0x906c('0x33')][_0x906c('0x45')]?_0x2e335e[_0x906c('0x33')]:_0x7cc487['model'];if(_0x4fab15['query']['includeAll']){_0x2e335e['include']=[{'all':!![]}];}_0x2e335e=_[_0x906c('0x3b')]({},_0x2e335e,_0x4fab15[_0x906c('0x3d')]);return db[_0x906c('0x2a')][_0x906c('0x46')](_0x2e335e)[_0x906c('0x22')](handleEntityNotFound(_0x25055d,null))[_0x906c('0x22')](respondWithResult(_0x25055d,null))[_0x906c('0x47')](handleError(_0x25055d,null));};exports['create']=function(_0xf1ab36,_0x5906b7){return db[_0x906c('0x2a')][_0x906c('0x48')](_0xf1ab36[_0x906c('0x49')],{})[_0x906c('0x22')](respondWithResult(_0x5906b7,0xc9))['catch'](handleError(_0x5906b7,null));};exports[_0x906c('0x21')]=function(_0x57fd86,_0x433c40){if(_0x57fd86[_0x906c('0x49')]['id']){delete _0x57fd86[_0x906c('0x49')]['id'];}return db['UserProfileSection'][_0x906c('0x46')]({'where':{'id':_0x57fd86[_0x906c('0x42')]['id']}})[_0x906c('0x22')](handleEntityNotFound(_0x433c40,null))[_0x906c('0x22')](saveUpdates(_0x57fd86[_0x906c('0x49')],null))['then'](respondWithResult(_0x433c40,null))['catch'](handleError(_0x433c40,null));};exports[_0x906c('0x23')]=function(_0x5e1387,_0x3c3cab){return db[_0x906c('0x2a')][_0x906c('0x46')]({'where':{'id':_0x5e1387[_0x906c('0x42')]['id']}})[_0x906c('0x22')](handleEntityNotFound(_0x3c3cab,null))[_0x906c('0x22')](removeEntity(_0x3c3cab,null))[_0x906c('0x47')](handleError(_0x3c3cab,null));};exports['describe']=function(_0x193a36,_0x2d8514){return db[_0x906c('0x2a')][_0x906c('0x4a')]()[_0x906c('0x22')](respondWithResult(_0x2d8514,null))['catch'](handleError(_0x2d8514,null));}; \ No newline at end of file +var _0x1f28=['where','merge','options','UserProfileSection','include','findAll','catch','includeAll','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','name','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1f28,0xe0));var _0x81f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1f28[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x81f2('0x0'));var rimraf=require(_0x81f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81f2('0x2'));var rp=require(_0x81f2('0x3'));var moment=require(_0x81f2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x81f2('0x5'));var util=require('util');var path=require(_0x81f2('0x6'));var sox=require(_0x81f2('0x7'));var csv=require(_0x81f2('0x8'));var ejs=require(_0x81f2('0x9'));var fs=require('fs');var fs_extra=require(_0x81f2('0xa'));var _=require(_0x81f2('0xb'));var squel=require(_0x81f2('0xc'));var crypto=require('crypto');var jsforce=require(_0x81f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x81f2('0x8'));var querystring=require(_0x81f2('0xe'));var Papa=require(_0x81f2('0xf'));var Redis=require('ioredis');var authService=require(_0x81f2('0x10'));var qs=require(_0x81f2('0x11'));var as=require(_0x81f2('0x12'));var hardwareService=require(_0x81f2('0x13'));var logger=require('../../config/logger')(_0x81f2('0x14'));var utils=require(_0x81f2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81f2('0x16'))['db'];function respondWithStatusCode(_0x3d8c85,_0x56795){_0x56795=_0x56795||0xcc;return function(_0x25b9b4){if(_0x25b9b4){return _0x3d8c85[_0x81f2('0x17')](_0x56795);}return _0x3d8c85[_0x81f2('0x18')](_0x56795)['end']();};}function respondWithResult(_0x45f130,_0x35b339){_0x35b339=_0x35b339||0xc8;return function(_0x56c3b3){if(_0x56c3b3){return _0x45f130[_0x81f2('0x18')](_0x35b339)[_0x81f2('0x19')](_0x56c3b3);}};}function respondWithFilteredResult(_0x70c299,_0x4c4727){return function(_0x116bc5){if(_0x116bc5){var _0x5553ac=typeof _0x4c4727[_0x81f2('0x1a')]==='undefined'&&typeof _0x4c4727[_0x81f2('0x1b')]==='undefined';var _0x559fc9=_0x116bc5[_0x81f2('0x1c')];var _0x3ab25a=_0x5553ac?0x0:_0x4c4727['offset'];var _0x33d3e3=_0x5553ac?_0x116bc5[_0x81f2('0x1c')]:_0x4c4727[_0x81f2('0x1a')]+_0x4c4727[_0x81f2('0x1b')];var _0x5aa683;if(_0x33d3e3>=_0x559fc9){_0x33d3e3=_0x559fc9;_0x5aa683=0xc8;}else{_0x5aa683=0xce;}_0x70c299[_0x81f2('0x18')](_0x5aa683);return _0x70c299['set'](_0x81f2('0x1d'),_0x3ab25a+'-'+_0x33d3e3+'/'+_0x559fc9)[_0x81f2('0x19')](_0x116bc5);}return null;};}function patchUpdates(_0x406a0d){return function(_0x4f2191){try{jsonpatch[_0x81f2('0x1e')](_0x4f2191,_0x406a0d,!![]);}catch(_0x1f2e95){return BPromise[_0x81f2('0x1f')](_0x1f2e95);}return _0x4f2191[_0x81f2('0x20')]();};}function saveUpdates(_0x779351,_0x308919){return function(_0x32d6ce){if(_0x32d6ce){return _0x32d6ce['update'](_0x779351)[_0x81f2('0x21')](function(_0x4c36d2){return _0x4c36d2;});}return null;};}function removeEntity(_0x13a086,_0x3fb125){return function(_0x4dc163){if(_0x4dc163){return _0x4dc163[_0x81f2('0x22')]()['then'](function(){_0x13a086[_0x81f2('0x18')](0xcc)[_0x81f2('0x23')]();});}};}function handleEntityNotFound(_0x2d5ad2,_0x12aaaa){return function(_0x434770){if(!_0x434770){_0x2d5ad2['sendStatus'](0x194);}return _0x434770;};}function handleError(_0x1d8a53,_0x30c0c4){_0x30c0c4=_0x30c0c4||0x1f4;return function(_0x38dedf){logger[_0x81f2('0x24')](_0x38dedf['stack']);if(_0x38dedf[_0x81f2('0x25')]){delete _0x38dedf[_0x81f2('0x25')];}_0x1d8a53[_0x81f2('0x18')](_0x30c0c4)['send'](_0x38dedf);};}exports[_0x81f2('0x26')]=function(_0x5e9023,_0x4cd26d){var _0x3fc653={},_0x5f237f={},_0x2dbabb={'count':0x0,'rows':[]};var _0x2b8740=_[_0x81f2('0x27')](db['UserProfileSection'][_0x81f2('0x28')],function(_0x2dab27){return{'name':_0x2dab27['fieldName'],'type':_0x2dab27[_0x81f2('0x29')][_0x81f2('0x2a')]};});_0x5f237f[_0x81f2('0x2b')]=_[_0x81f2('0x27')](_0x2b8740,_0x81f2('0x25'));_0x5f237f['query']=_[_0x81f2('0x2c')](_0x5e9023[_0x81f2('0x2d')]);_0x5f237f[_0x81f2('0x2e')]=_['intersection'](_0x5f237f[_0x81f2('0x2b')],_0x5f237f[_0x81f2('0x2d')]);_0x3fc653['attributes']=_[_0x81f2('0x2f')](_0x5f237f[_0x81f2('0x2b')],qs[_0x81f2('0x30')](_0x5e9023['query'][_0x81f2('0x30')]));_0x3fc653[_0x81f2('0x31')]=_0x3fc653['attributes']['length']?_0x3fc653[_0x81f2('0x31')]:_0x5f237f['model'];if(!_0x5e9023['query'][_0x81f2('0x32')](_0x81f2('0x33'))){_0x3fc653[_0x81f2('0x1b')]=qs[_0x81f2('0x1b')](_0x5e9023['query'][_0x81f2('0x1b')]);_0x3fc653[_0x81f2('0x1a')]=qs[_0x81f2('0x1a')](_0x5e9023[_0x81f2('0x2d')][_0x81f2('0x1a')]);}_0x3fc653[_0x81f2('0x34')]=qs[_0x81f2('0x35')](_0x5e9023[_0x81f2('0x2d')]['sort']);_0x3fc653['where']=qs[_0x81f2('0x2e')](_[_0x81f2('0x36')](_0x5e9023[_0x81f2('0x2d')],_0x5f237f[_0x81f2('0x2e')]),_0x2b8740);if(_0x5e9023[_0x81f2('0x2d')][_0x81f2('0x37')]){_0x3fc653[_0x81f2('0x38')]=_[_0x81f2('0x39')](_0x3fc653[_0x81f2('0x38')],{'$or':_[_0x81f2('0x27')](_0x2b8740,function(_0x47c464){if(_0x47c464[_0x81f2('0x29')]!=='VIRTUAL'){var _0x4b447b={};_0x4b447b[_0x47c464[_0x81f2('0x25')]]={'$like':'%'+_0x5e9023[_0x81f2('0x2d')]['filter']+'%'};return _0x4b447b;}})});}_0x3fc653=_['merge']({},_0x3fc653,_0x5e9023[_0x81f2('0x3a')]);var _0x325207={'where':_0x3fc653[_0x81f2('0x38')]};return db[_0x81f2('0x3b')][_0x81f2('0x1c')](_0x325207)[_0x81f2('0x21')](function(_0x5f188d){_0x2dbabb[_0x81f2('0x1c')]=_0x5f188d;if(_0x5e9023['query']['includeAll']){_0x3fc653[_0x81f2('0x3c')]=[{'all':!![]}];}return db[_0x81f2('0x3b')][_0x81f2('0x3d')](_0x3fc653);})[_0x81f2('0x21')](function(_0x33e214){_0x2dbabb['rows']=_0x33e214;return _0x2dbabb;})[_0x81f2('0x21')](respondWithFilteredResult(_0x4cd26d,_0x3fc653))[_0x81f2('0x3e')](handleError(_0x4cd26d,null));};exports['show']=function(_0x21191e,_0x139bda){var _0x3b5623={'raw':![],'where':{'id':_0x21191e['params']['id']}},_0x482017={};_0x482017['model']=_[_0x81f2('0x2c')](db[_0x81f2('0x3b')][_0x81f2('0x28')]);_0x482017[_0x81f2('0x2d')]=_['keys'](_0x21191e[_0x81f2('0x2d')]);_0x482017[_0x81f2('0x2e')]=_['intersection'](_0x482017[_0x81f2('0x2b')],_0x482017[_0x81f2('0x2d')]);_0x3b5623[_0x81f2('0x31')]=_[_0x81f2('0x2f')](_0x482017[_0x81f2('0x2b')],qs['fields'](_0x21191e[_0x81f2('0x2d')][_0x81f2('0x30')]));_0x3b5623['attributes']=_0x3b5623['attributes']['length']?_0x3b5623[_0x81f2('0x31')]:_0x482017[_0x81f2('0x2b')];if(_0x21191e[_0x81f2('0x2d')][_0x81f2('0x3f')]){_0x3b5623[_0x81f2('0x3c')]=[{'all':!![]}];}_0x3b5623=_[_0x81f2('0x39')]({},_0x3b5623,_0x21191e['options']);return db[_0x81f2('0x3b')][_0x81f2('0x40')](_0x3b5623)[_0x81f2('0x21')](handleEntityNotFound(_0x139bda,null))[_0x81f2('0x21')](respondWithResult(_0x139bda,null))[_0x81f2('0x3e')](handleError(_0x139bda,null));};exports[_0x81f2('0x41')]=function(_0x5aa50b,_0x4d34f8){return db[_0x81f2('0x3b')][_0x81f2('0x41')](_0x5aa50b[_0x81f2('0x42')],{})[_0x81f2('0x21')](respondWithResult(_0x4d34f8,0xc9))[_0x81f2('0x3e')](handleError(_0x4d34f8,null));};exports[_0x81f2('0x43')]=function(_0x11a152,_0x5c3d47){if(_0x11a152[_0x81f2('0x42')]['id']){delete _0x11a152[_0x81f2('0x42')]['id'];}return db[_0x81f2('0x3b')]['find']({'where':{'id':_0x11a152[_0x81f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c3d47,null))[_0x81f2('0x21')](saveUpdates(_0x11a152[_0x81f2('0x42')],null))[_0x81f2('0x21')](respondWithResult(_0x5c3d47,null))['catch'](handleError(_0x5c3d47,null));};exports[_0x81f2('0x22')]=function(_0x1133e0,_0x325c1e){return db[_0x81f2('0x3b')][_0x81f2('0x40')]({'where':{'id':_0x1133e0[_0x81f2('0x44')]['id']}})[_0x81f2('0x21')](handleEntityNotFound(_0x325c1e,null))[_0x81f2('0x21')](removeEntity(_0x325c1e,null))['catch'](handleError(_0x325c1e,null));};exports[_0x81f2('0x45')]=function(_0xf94d1c,_0xcbd3be){return db[_0x81f2('0x3b')]['describe']()[_0x81f2('0x21')](respondWithResult(_0xcbd3be,null))['catch'](handleError(_0xcbd3be,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 82c03e6..d5c96c1 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 _0x260b=['util','../../config/logger','path','rimraf','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x505bd4,_0x4eaf7c){var _0x416478=function(_0x2e0b21){while(--_0x2e0b21){_0x505bd4['push'](_0x505bd4['shift']());}};_0x416478(++_0x4eaf7c);}(_0x260b,0xa7));var _0xb260=function(_0xca91ed,_0x278f87){_0xca91ed=_0xca91ed-0x0;var _0x2829ec=_0x260b[_0xca91ed];return _0x2829ec;};'use strict';var _=require(_0xb260('0x0'));var util=require(_0xb260('0x1'));var logger=require(_0xb260('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb260('0x3'));var rimraf=require(_0xb260('0x4'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xb260('0x5')]=function(_0x2dc2f1,_0x18e432){return _0x2dc2f1[_0xb260('0x6')](_0xb260('0x7'),attributes,{'tableName':_0xb260('0x8'),'paranoid':![],'indexes':[{'name':_0xb260('0x9'),'fields':[_0xb260('0xa'),_0xb260('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58fe=['sectionId','userProfileId','util','api','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x602374,_0x3f5a68){var _0x16ac60=function(_0xa35edd){while(--_0xa35edd){_0x602374['push'](_0x602374['shift']());}};_0x16ac60(++_0x3f5a68);}(_0x58fe,0x160));var _0xe58f=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x58fe[_0x2fe689];return _0x35ea44;};'use strict';var _=require('lodash');var util=require(_0xe58f('0x0'));var logger=require('../../config/logger')(_0xe58f('0x1'));var moment=require(_0xe58f('0x2'));var BPromise=require(_0xe58f('0x3'));var rp=require(_0xe58f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe58f('0x5'));var config=require('../../config/environment');var attributes=require(_0xe58f('0x6'));module[_0xe58f('0x7')]=function(_0x89327c,_0x54e876){return _0x89327c[_0xe58f('0x8')](_0xe58f('0x9'),attributes,{'tableName':_0xe58f('0xa'),'paranoid':![],'indexes':[{'name':_0xe58f('0xb'),'fields':[_0xe58f('0xc'),_0xe58f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d177bf4..6eddda6 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 _0x99a0=['../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','rpc'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x99a0,0x121));var _0x099a=function(_0x29d8ad,_0x131a5d){_0x29d8ad=_0x29d8ad-0x0;var _0x9b2c7b=_0x99a0[_0x29d8ad];return _0x9b2c7b;};'use strict';var _=require(_0x099a('0x0'));var util=require(_0x099a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x099a('0x2'))['db'];var utils=require(_0x099a('0x3'));var logger=require('../../config/logger')(_0x099a('0x4'));var config=require(_0x099a('0x5'));var jayson=require(_0x099a('0x6'));var client=jayson[_0x099a('0x7')][_0x099a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaebf62,_0x5a5de5,_0x18f862){return new BPromise(function(_0x2da8c8,_0x268440){return client['request'](_0xaebf62,_0x18f862)[_0x099a('0x9')](function(_0x29255d){logger[_0x099a('0xa')](_0x099a('0xb'),_0x5a5de5,_0x099a('0xc'));logger[_0x099a('0xd')](_0x099a('0xe'),_0x5a5de5,_0x099a('0xc'),JSON[_0x099a('0xf')](_0x29255d));if(_0x29255d[_0x099a('0x10')]){if(_0x29255d[_0x099a('0x10')][_0x099a('0x11')]===0x1f4){logger[_0x099a('0x10')](_0x099a('0xb'),_0x5a5de5,_0x29255d[_0x099a('0x10')]['message']);return _0x268440(_0x29255d[_0x099a('0x10')]['message']);}logger[_0x099a('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x5a5de5,_0x29255d[_0x099a('0x10')][_0x099a('0x12')]);return _0x2da8c8(_0x29255d[_0x099a('0x10')][_0x099a('0x12')]);}else{logger[_0x099a('0xa')](_0x099a('0xb'),_0x5a5de5,'request\x20sent');_0x2da8c8(_0x29255d[_0x099a('0x13')][_0x099a('0x12')]);}})[_0x099a('0x14')](function(_0x371af7){logger['error'](_0x099a('0xb'),_0x5a5de5,_0x371af7);_0x268440(_0x371af7);});});} \ No newline at end of file +var _0xc130=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xc130,0x7c));var _0x0c13=function(_0x33c198,_0x487e2e){_0x33c198=_0x33c198-0x0;var _0x215652=_0xc130[_0x33c198];return _0x215652;};'use strict';var _=require(_0x0c13('0x0'));var util=require(_0x0c13('0x1'));var moment=require(_0x0c13('0x2'));var BPromise=require(_0x0c13('0x3'));var rs=require(_0x0c13('0x4'));var fs=require('fs');var Redis=require(_0x0c13('0x5'));var db=require(_0x0c13('0x6'))['db'];var utils=require(_0x0c13('0x7'));var logger=require(_0x0c13('0x8'))(_0x0c13('0x9'));var config=require(_0x0c13('0xa'));var jayson=require(_0x0c13('0xb'));var client=jayson[_0x0c13('0xc')][_0x0c13('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2eaff3,_0x14bc49,_0x36104f){return new BPromise(function(_0x400c1f,_0x4ba593){return client[_0x0c13('0xe')](_0x2eaff3,_0x36104f)[_0x0c13('0xf')](function(_0x582c1f){logger[_0x0c13('0x10')](_0x0c13('0x11'),_0x14bc49,_0x0c13('0x12'));logger['debug'](_0x0c13('0x13'),_0x14bc49,'request\x20sent',JSON[_0x0c13('0x14')](_0x582c1f));if(_0x582c1f[_0x0c13('0x15')]){if(_0x582c1f[_0x0c13('0x15')][_0x0c13('0x16')]===0x1f4){logger[_0x0c13('0x15')](_0x0c13('0x11'),_0x14bc49,_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);return _0x4ba593(_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x14bc49,_0x582c1f[_0x0c13('0x15')][_0x0c13('0x17')]);return _0x400c1f(_0x582c1f[_0x0c13('0x15')]['message']);}else{logger[_0x0c13('0x10')](_0x0c13('0x11'),_0x14bc49,_0x0c13('0x12'));_0x400c1f(_0x582c1f['result'][_0x0c13('0x17')]);}})[_0x0c13('0x18')](function(_0x2e5791){logger[_0x0c13('0x15')](_0x0c13('0x11'),_0x14bc49,_0x2e5791);_0x4ba593(_0x2e5791);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6571691..b4e8df8 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x174321,_0x2e5107){var _0x5f0776=function(_0x542362){while(--_0x542362){_0x174321['push'](_0x174321['shift']());}};_0x5f0776(++_0x2e5107);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2c5307,_0x2e66f7){var _0x221e49=function(_0x14aac1){while(--_0x14aac1){_0x2c5307['push'](_0x2c5307['shift']());}};_0x221e49(++_0x2e66f7);}(_0x70e0,0x17b));var _0x070e=function(_0x1de874,_0x1d70c0){_0x1de874=_0x1de874-0x0;var _0x4f515d=_0x70e0[_0x1de874];return _0x4f515d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8f93cb0..9006424 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 _0x6e6d=['sequelize'];(function(_0x223842,_0xcac853){var _0x2b4f29=function(_0x32a1ce){while(--_0x32a1ce){_0x223842['push'](_0x223842['shift']());}};_0x2b4f29(++_0xcac853);}(_0x6e6d,0xf7));var _0xd6e6=function(_0x5f0777,_0x38edb4){_0x5f0777=_0x5f0777-0x0;var _0x2a7757=_0x6e6d[_0x5f0777];return _0x2a7757;};'use strict';var Sequelize=require(_0xd6e6('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'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 9a30140..ecf5075 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 _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','lodash'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x583c,0x12b));var _0xc583=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x583c[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','user_has_sms_queues','bluebird'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x5d58,0x187));var _0x85d5=function(_0x3cb7fe,_0x3396cb){_0x3cb7fe=_0x3cb7fe-0x0;var _0x5c466f=_0x5d58[_0x3cb7fe];return _0x5c466f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./userSmsQueue.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('UserSmsQueue',attributes,{'tableName':_0x85d5('0x6'),'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 cab9e6e..8864ec5 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 _0x3d54=['then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x388c9b,_0x190d71){var _0xe8065b=function(_0x433cb3){while(--_0x433cb3){_0x388c9b['push'](_0x388c9b['shift']());}};_0xe8065b(++_0x190d71);}(_0x3d54,0x1dc));var _0x43d5=function(_0x1e06ca,_0x2ebc85){_0x1e06ca=_0x1e06ca-0x0;var _0x3e5802=_0x3d54[_0x1e06ca];return _0x3e5802;};'use strict';var _=require(_0x43d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43d5('0x1'));var fs=require('fs');var Redis=require(_0x43d5('0x2'));var db=require(_0x43d5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x43d5('0x4'))(_0x43d5('0x5'));var config=require(_0x43d5('0x6'));var jayson=require(_0x43d5('0x7'));var client=jayson['client'][_0x43d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580af0,_0x29f3e9,_0x45fcef){return new BPromise(function(_0x2125f6,_0x287f2f){return client[_0x43d5('0x9')](_0x580af0,_0x45fcef)[_0x43d5('0xa')](function(_0x2ca80b){logger['info'](_0x43d5('0xb'),_0x29f3e9,_0x43d5('0xc'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x29f3e9,_0x43d5('0xc'),JSON[_0x43d5('0xd')](_0x2ca80b));if(_0x2ca80b[_0x43d5('0xe')]){if(_0x2ca80b[_0x43d5('0xe')]['code']===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x29f3e9,_0x2ca80b[_0x43d5('0xe')][_0x43d5('0xf')]);return _0x287f2f(_0x2ca80b[_0x43d5('0xe')]['message']);}logger[_0x43d5('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x29f3e9,_0x2ca80b['error'][_0x43d5('0xf')]);return _0x2125f6(_0x2ca80b[_0x43d5('0xe')][_0x43d5('0xf')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x29f3e9,_0x43d5('0xc'));_0x2125f6(_0x2ca80b[_0x43d5('0x10')][_0x43d5('0xf')]);}})[_0x43d5('0x11')](function(_0x53d9e6){logger[_0x43d5('0xe')](_0x43d5('0xb'),_0x29f3e9,_0x53d9e6);_0x287f2f(_0x53d9e6);});});} \ No newline at end of file +var _0x1305=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x1305,0x6d));var _0x5130=function(_0x117be6,_0x46be3a){_0x117be6=_0x117be6-0x0;var _0xe1c2f7=_0x1305[_0x117be6];return _0xe1c2f7;};'use strict';var _=require('lodash');var util=require(_0x5130('0x0'));var moment=require('moment');var BPromise=require(_0x5130('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5130('0x2'));var db=require(_0x5130('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5130('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5130('0x5'));var client=jayson[_0x5130('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4673d2,_0x31b3a5,_0x24531a){return new BPromise(function(_0x3c44d0,_0x2ca021){return client[_0x5130('0x7')](_0x4673d2,_0x24531a)['then'](function(_0x4a27f2){logger[_0x5130('0x8')](_0x5130('0x9'),_0x31b3a5,'request\x20sent');logger[_0x5130('0xa')](_0x5130('0xb'),_0x31b3a5,'request\x20sent',JSON[_0x5130('0xc')](_0x4a27f2));if(_0x4a27f2[_0x5130('0xd')]){if(_0x4a27f2[_0x5130('0xd')]['code']===0x1f4){logger[_0x5130('0xd')](_0x5130('0x9'),_0x31b3a5,_0x4a27f2[_0x5130('0xd')][_0x5130('0xe')]);return _0x2ca021(_0x4a27f2[_0x5130('0xd')]['message']);}logger[_0x5130('0xd')](_0x5130('0x9'),_0x31b3a5,_0x4a27f2[_0x5130('0xd')][_0x5130('0xe')]);return _0x3c44d0(_0x4a27f2['error'][_0x5130('0xe')]);}else{logger[_0x5130('0x8')](_0x5130('0x9'),_0x31b3a5,_0x5130('0xf'));_0x3c44d0(_0x4a27f2['result'][_0x5130('0xe')]);}})[_0x5130('0x10')](function(_0x41ca17){logger[_0x5130('0xd')](_0x5130('0x9'),_0x31b3a5,_0x41ca17);_0x2ca021(_0x41ca17);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index dadec8e..97d70a9 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 _0x977a=['sequelize','exports','INTEGER'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x977a,0x1c5));var _0xa977=function(_0x41153e,_0x5b0fa2){_0x41153e=_0x41153e-0x0;var _0x46d431=_0x977a[_0x41153e];return _0x46d431;};'use strict';var Sequelize=require(_0xa977('0x0'));module[_0xa977('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xa977('0x2')]}}; \ No newline at end of file +var _0x319f=['sequelize','exports','INTEGER'];(function(_0x5dfc23,_0x440bfe){var _0x5f4624=function(_0x4078cf){while(--_0x4078cf){_0x5dfc23['push'](_0x5dfc23['shift']());}};_0x5f4624(++_0x440bfe);}(_0x319f,0x8a));var _0xf319=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x319f[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xf319('0x0'));module[_0xf319('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf319('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 1039233..bd357b2 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(_0x472f3e,_0x3fd870){var _0xe6ea23=function(_0x54c387){while(--_0x54c387){_0x472f3e['push'](_0x472f3e['shift']());}};_0xe6ea23(++_0x3fd870);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x37bd8c,_0x4f1ad6){var _0x3f893b=function(_0x1de477){while(--_0x1de477){_0x37bd8c['push'](_0x37bd8c['shift']());}};_0x3f893b(++_0x4f1ad6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 a9411fc..ef372bc 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1a3861,_0x10a9aa){var _0x5f4943=function(_0x8f26de){while(--_0x8f26de){_0x1a3861['push'](_0x1a3861['shift']());}};_0x5f4943(++_0x10a9aa);}(_0x70e0,0x17b));var _0x070e=function(_0x47a655,_0x2296d2){_0x47a655=_0x47a655-0x0;var _0x13bec1=_0x70e0[_0x47a655];return _0x13bec1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x527f5f,_0x221afc){var _0x5545f3=function(_0x2ea8e5){while(--_0x2ea8e5){_0x527f5f['push'](_0x527f5f['shift']());}};_0x5545f3(++_0x221afc);}(_0xe706,0xa3));var _0x6e70=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xe706[_0x5948dd];return _0xb1f8be;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e3dff9d..d33f6a3 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 _0x2e0a=['INTEGER','sequelize','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x2254b4,_0x2e0fd8){_0x2254b4=_0x2254b4-0x0;var _0x2d5f0c=_0x2e0a[_0x2254b4];return _0x2d5f0c;};'use strict';var Sequelize=require(_0xa2e0('0x0'));module[_0xa2e0('0x1')]={'penalty':{'type':Sequelize[_0xa2e0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba8e=['sequelize','exports'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0xba8e,0x1e6));var _0xeba8=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0xba8e[_0x53ddab];return _0x5819ac;};'use strict';var Sequelize=require(_0xeba8('0x0'));module[_0xeba8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 1fe27f6..c1fc552 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 _0xa0dd=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xa0dd,0x14e));var _0xda0d=function(_0x567cf1,_0x74adab){_0x567cf1=_0x567cf1-0x0;var _0x493065=_0xa0dd[_0x567cf1];return _0x493065;};'use strict';var _=require(_0xda0d('0x0'));var util=require(_0xda0d('0x1'));var logger=require(_0xda0d('0x2'))(_0xda0d('0x3'));var moment=require(_0xda0d('0x4'));var BPromise=require('bluebird');var rp=require(_0xda0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda0d('0x6'));var config=require(_0xda0d('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xda0d('0x8')]=function(_0x128a65,_0x31feff){return _0x128a65[_0xda0d('0x9')](_0xda0d('0xa'),attributes,{'tableName':_0xda0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8455=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue'];(function(_0x1ce7cf,_0x1706be){var _0x38fe5a=function(_0x55c697){while(--_0x55c697){_0x1ce7cf['push'](_0x1ce7cf['shift']());}};_0x38fe5a(++_0x1706be);}(_0x8455,0x104));var _0x5845=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8455[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5845('0x0'));var util=require('util');var logger=require(_0x5845('0x1'))(_0x5845('0x2'));var moment=require('moment');var BPromise=require(_0x5845('0x3'));var rp=require(_0x5845('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5845('0x5'));var config=require(_0x5845('0x6'));var attributes=require(_0x5845('0x7'));module[_0x5845('0x8')]=function(_0x38b7af,_0x495cfe){return _0x38b7af['define'](_0x5845('0x9'),attributes,{'tableName':'user_has_voice_queues','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 4392792..249a76e 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 _0x0814=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x106541,_0x372f73){var _0x175a49=function(_0x1add5c){while(--_0x1add5c){_0x106541['push'](_0x106541['shift']());}};_0x175a49(++_0x372f73);}(_0x0814,0x169));var _0x4081=function(_0x163a98,_0xbdc4f){_0x163a98=_0x163a98-0x0;var _0x2a8c80=_0x0814[_0x163a98];return _0x2a8c80;};'use strict';var _=require(_0x4081('0x0'));var util=require(_0x4081('0x1'));var moment=require(_0x4081('0x2'));var BPromise=require(_0x4081('0x3'));var rs=require(_0x4081('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4081('0x5'))['db'];var utils=require(_0x4081('0x6'));var logger=require(_0x4081('0x7'))(_0x4081('0x8'));var config=require(_0x4081('0x9'));var jayson=require(_0x4081('0xa'));var client=jayson['client'][_0x4081('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8c9d58,_0x50819d,_0x1622eb){return new BPromise(function(_0x493072,_0x4cff24){return client[_0x4081('0xc')](_0x8c9d58,_0x1622eb)[_0x4081('0xd')](function(_0x237458){logger[_0x4081('0xe')](_0x4081('0xf'),_0x50819d,'request\x20sent');logger[_0x4081('0x10')](_0x4081('0x11'),_0x50819d,_0x4081('0x12'),JSON['stringify'](_0x237458));if(_0x237458['error']){if(_0x237458['error'][_0x4081('0x13')]===0x1f4){logger[_0x4081('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x50819d,_0x237458[_0x4081('0x14')][_0x4081('0x15')]);return _0x4cff24(_0x237458['error'][_0x4081('0x15')]);}logger[_0x4081('0x14')](_0x4081('0xf'),_0x50819d,_0x237458['error'][_0x4081('0x15')]);return _0x493072(_0x237458[_0x4081('0x14')][_0x4081('0x15')]);}else{logger[_0x4081('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x50819d,_0x4081('0x12'));_0x493072(_0x237458[_0x4081('0x16')][_0x4081('0x15')]);}})['catch'](function(_0x49b32c){logger[_0x4081('0x14')](_0x4081('0xf'),_0x50819d,_0x49b32c);_0x4cff24(_0x49b32c);});});} \ No newline at end of file +var _0x11dc=['http','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1f727d,_0x36f98e){var _0x40cbc3=function(_0x491909){while(--_0x491909){_0x1f727d['push'](_0x1f727d['shift']());}};_0x40cbc3(++_0x36f98e);}(_0x11dc,0x18e));var _0xc11d=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x11dc[_0x34c027];return _0x47bff0;};'use strict';var _=require('lodash');var util=require(_0xc11d('0x0'));var moment=require(_0xc11d('0x1'));var BPromise=require(_0xc11d('0x2'));var rs=require(_0xc11d('0x3'));var fs=require('fs');var Redis=require(_0xc11d('0x4'));var db=require(_0xc11d('0x5'))['db'];var utils=require(_0xc11d('0x6'));var logger=require(_0xc11d('0x7'))(_0xc11d('0x8'));var config=require('../../config/environment');var jayson=require(_0xc11d('0x9'));var client=jayson['client'][_0xc11d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485ded,_0x5cc964,_0x1b0e8b){return new BPromise(function(_0x2cdea2,_0x52d4bf){return client[_0xc11d('0xb')](_0x485ded,_0x1b0e8b)[_0xc11d('0xc')](function(_0x175477){logger[_0xc11d('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc964,'request\x20sent');logger[_0xc11d('0xe')](_0xc11d('0xf'),_0x5cc964,_0xc11d('0x10'),JSON[_0xc11d('0x11')](_0x175477));if(_0x175477[_0xc11d('0x12')]){if(_0x175477[_0xc11d('0x12')][_0xc11d('0x13')]===0x1f4){logger['error'](_0xc11d('0x14'),_0x5cc964,_0x175477[_0xc11d('0x12')][_0xc11d('0x15')]);return _0x52d4bf(_0x175477['error'][_0xc11d('0x15')]);}logger[_0xc11d('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc964,_0x175477[_0xc11d('0x12')][_0xc11d('0x15')]);return _0x2cdea2(_0x175477[_0xc11d('0x12')][_0xc11d('0x15')]);}else{logger[_0xc11d('0xd')](_0xc11d('0x14'),_0x5cc964,_0xc11d('0x10'));_0x2cdea2(_0x175477[_0xc11d('0x16')][_0xc11d('0x15')]);}})[_0xc11d('0x17')](function(_0x534d5f){logger[_0xc11d('0x12')](_0xc11d('0x14'),_0x5cc964,_0x534d5f);_0x52d4bf(_0x534d5f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index cb4f488..55d9036 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x50f157,_0x280833){var _0x7e0178=function(_0x14eaf1){while(--_0x14eaf1){_0x50f157['push'](_0x50f157['shift']());}};_0x7e0178(++_0x280833);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x157298,_0x2f1dd2){var _0x43368c=function(_0x5848ff){while(--_0x5848ff){_0x157298['push'](_0x157298['shift']());}};_0x43368c(++_0x2f1dd2);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9af1781..d449c17 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 _0x1311=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x42e74a,_0x11567a){var _0x52bf86=function(_0x4955f7){while(--_0x4955f7){_0x42e74a['push'](_0x42e74a['shift']());}};_0x52bf86(++_0x11567a);}(_0x1311,0x1c4));var _0x1131=function(_0x166e26,_0x122952){_0x166e26=_0x166e26-0x0;var _0x537212=_0x1311[_0x166e26];return _0x537212;};'use strict';var Sequelize=require(_0x1131('0x0'));module[_0x1131('0x1')]={'uniqueid':{'type':Sequelize[_0x1131('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1131('0x3')},'membername':{'type':Sequelize[_0x1131('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1131('0x4')],'allowNull':![],'unique':_0x1131('0x5'),'comment':_0x1131('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1131('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x1131('0x4')],'allowNull':![],'unique':_0x1131('0x5'),'comment':_0x1131('0x3')},'penalty':{'type':Sequelize[_0x1131('0x2')](0xb),'defaultValue':0x0,'comment':_0x1131('0x3')},'paused':{'type':Sequelize[_0x1131('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xd217=['queue_interface','exports','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x1ee82a,_0x248308){var _0xcda8aa=function(_0xb18459){while(--_0xb18459){_0x1ee82a['push'](_0x1ee82a['shift']());}};_0xcda8aa(++_0x248308);}(_0xd217,0x141));var _0x7d21=function(_0x80ee31,_0x31e276){_0x80ee31=_0x80ee31-0x0;var _0x1c7877=_0xd217[_0x80ee31];return _0x1c7877;};'use strict';var Sequelize=require('sequelize');module[_0x7d21('0x0')]={'uniqueid':{'type':Sequelize[_0x7d21('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x7d21('0x2')],'allowNull':![],'comment':_0x7d21('0x3')},'UserId':{'type':Sequelize[_0x7d21('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7d21('0x2')],'allowNull':![],'unique':_0x7d21('0x4'),'comment':_0x7d21('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7d21('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x7d21('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x7d21('0x1')](0xb),'defaultValue':0x0,'comment':_0x7d21('0x3')},'paused':{'type':Sequelize[_0x7d21('0x1')](0xb),'defaultValue':0x0,'comment':_0x7d21('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5a68583..715bbe0 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 _0x3eed=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5100bc,_0x1e273f){var _0x598cd7=function(_0x2af552){while(--_0x2af552){_0x5100bc['push'](_0x5100bc['shift']());}};_0x598cd7(++_0x1e273f);}(_0x3eed,0x1c2));var _0xd3ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3eed[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xd3ee('0x0'));var UserVoiceQueueRt=require(_0xd3ee('0x1'))['db'][_0xd3ee('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd3ee('0x3')](0x0);var events={'afterCreate':_0xd3ee('0x4'),'afterUpdate':_0xd3ee('0x5'),'afterDestroy':_0xd3ee('0x6')};function emitEvent(_0x5a7581){return function(_0x412090,_0x32695e,_0x4551e6){UserVoiceQueueRtEvents[_0xd3ee('0x7')](_0x5a7581+':'+_0x412090['id'],_0x412090);UserVoiceQueueRtEvents[_0xd3ee('0x7')](_0x5a7581,_0x412090);_0x4551e6(null);};}for(var e in events){if(events[_0xd3ee('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xd3ee('0x9')](e,emitEvent(event));}}module[_0xd3ee('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9748=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x55c6f2,_0x5efaf9){var _0x185c3c=function(_0x1d6f0f){while(--_0x1d6f0f){_0x55c6f2['push'](_0x55c6f2['shift']());}};_0x185c3c(++_0x5efaf9);}(_0x9748,0x165));var _0x8974=function(_0x37fc31,_0x3e671f){_0x37fc31=_0x37fc31-0x0;var _0x4a7c06=_0x9748[_0x37fc31];return _0x4a7c06;};'use strict';var EventEmitter=require(_0x8974('0x0'));var UserVoiceQueueRt=require(_0x8974('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8974('0x2')](0x0);var events={'afterCreate':_0x8974('0x3'),'afterUpdate':_0x8974('0x4'),'afterDestroy':_0x8974('0x5')};function emitEvent(_0x37fbc9){return function(_0x145537,_0xe98cf3,_0x3adf3c){UserVoiceQueueRtEvents[_0x8974('0x6')](_0x37fbc9+':'+_0x145537['id'],_0x145537);UserVoiceQueueRtEvents[_0x8974('0x6')](_0x37fbc9,_0x145537);_0x3adf3c(null);};}for(var e in events){if(events[_0x8974('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 774d4df..13deb15 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 _0x56ac=['bluebird','request-promise','path','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util','../../config/logger','moment'];(function(_0x3a01b7,_0x4cf99c){var _0x53d120=function(_0x2b4913){while(--_0x2b4913){_0x3a01b7['push'](_0x3a01b7['shift']());}};_0x53d120(++_0x4cf99c);}(_0x56ac,0x178));var _0xc56a=function(_0x49c1ef,_0x29df55){_0x49c1ef=_0x49c1ef-0x0;var _0x44e4f6=_0x56ac[_0x49c1ef];return _0x44e4f6;};'use strict';var _=require(_0xc56a('0x0'));var util=require(_0xc56a('0x1'));var logger=require(_0xc56a('0x2'))('api');var moment=require(_0xc56a('0x3'));var BPromise=require(_0xc56a('0x4'));var rp=require(_0xc56a('0x5'));var fs=require('fs');var path=require(_0xc56a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc56a('0x7'));module[_0xc56a('0x8')]=function(_0x5d13d6,_0x2e604d){return _0x5d13d6['define'](_0xc56a('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2468=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x491948,_0x38e82b){var _0x571154=function(_0x5568c6){while(--_0x5568c6){_0x491948['push'](_0x491948['shift']());}};_0x571154(++_0x38e82b);}(_0x2468,0xe1));var _0x8246=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x2468[_0x11946c];return _0x383935;};'use strict';var _=require(_0x8246('0x0'));var util=require(_0x8246('0x1'));var logger=require(_0x8246('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8246('0x3'));var rp=require(_0x8246('0x4'));var fs=require('fs');var path=require(_0x8246('0x5'));var rimraf=require(_0x8246('0x6'));var config=require(_0x8246('0x7'));var attributes=require(_0x8246('0x8'));module[_0x8246('0x9')]=function(_0x2885ed,_0xe91f8d){return _0x2885ed['define'](_0x8246('0xa'),attributes,{'tableName':_0x8246('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 964a62e..393782d 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 _0x1d63=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where'];(function(_0x1863be,_0x3fb18f){var _0x5835e1=function(_0xaa0e92){while(--_0xaa0e92){_0x1863be['push'](_0x1863be['shift']());}};_0x5835e1(++_0x3fb18f);}(_0x1d63,0x16e));var _0x31d6=function(_0x195a2f,_0x6970dd){_0x195a2f=_0x195a2f-0x0;var _0x1b074a=_0x1d63[_0x195a2f];return _0x1b074a;};'use strict';var _=require(_0x31d6('0x0'));var util=require('util');var moment=require(_0x31d6('0x1'));var BPromise=require(_0x31d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x31d6('0x4'))(_0x31d6('0x5'));var config=require(_0x31d6('0x6'));var jayson=require(_0x31d6('0x7'));var client=jayson[_0x31d6('0x8')][_0x31d6('0x9')]({'port':0x232a});config['redis']=_[_0x31d6('0xa')](config[_0x31d6('0xb')],{'host':_0x31d6('0xc'),'port':0x18eb});var socket=require(_0x31d6('0xd'))(new Redis(config[_0x31d6('0xb')]));require('./userVoiceQueueRt.socket')[_0x31d6('0xe')](socket);function respondWithRpcPromise(_0x45c851,_0x27b11,_0x527050){return new BPromise(function(_0x169dfa,_0x34caad){return client['request'](_0x45c851,_0x527050)['then'](function(_0xfbce62){logger[_0x31d6('0xf')](_0x31d6('0x10'),_0x27b11,_0x31d6('0x11'));logger[_0x31d6('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x27b11,_0x31d6('0x11'),JSON[_0x31d6('0x13')](_0xfbce62));if(_0xfbce62['error']){if(_0xfbce62[_0x31d6('0x14')][_0x31d6('0x15')]===0x1f4){logger[_0x31d6('0x14')](_0x31d6('0x10'),_0x27b11,_0xfbce62['error'][_0x31d6('0x16')]);return _0x34caad(_0xfbce62[_0x31d6('0x14')][_0x31d6('0x16')]);}logger['error'](_0x31d6('0x10'),_0x27b11,_0xfbce62[_0x31d6('0x14')]['message']);return _0x169dfa(_0xfbce62[_0x31d6('0x14')][_0x31d6('0x16')]);}else{logger['info'](_0x31d6('0x10'),_0x27b11,_0x31d6('0x11'));_0x169dfa(_0xfbce62[_0x31d6('0x17')]['message']);}})[_0x31d6('0x18')](function(_0x4552aa){logger[_0x31d6('0x14')](_0x31d6('0x10'),_0x27b11,_0x4552aa);_0x34caad(_0x4552aa);});});}exports[_0x31d6('0x19')]=function(_0x2c0cb){var _0xcd02f8=this;return new Promise(function(_0x14558c,_0x403a8f){return db['UserVoiceQueueRt'][_0x31d6('0x1a')]({'raw':_0x2c0cb[_0x31d6('0x1b')]?_0x2c0cb['options'][_0x31d6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c0cb[_0x31d6('0x1b')]?_0x2c0cb[_0x31d6('0x1b')][_0x31d6('0x1d')]||null:null,'attributes':[[db[_0x31d6('0x1e')]['fn'](_0x31d6('0x1f'),db[_0x31d6('0x1e')]['fn']('IF',db[_0x31d6('0x1e')][_0x31d6('0x20')](_0x31d6('0x21')))),_0x31d6('0x22')]]})[_0x31d6('0x23')](function(_0x286abe){logger['info'](_0x31d6('0x19'),_0x2c0cb);logger[_0x31d6('0x12')](_0x31d6('0x19'),_0x2c0cb,JSON[_0x31d6('0x13')](_0x286abe));_0x14558c(_0x286abe);})['catch'](function(_0x2c6f40){logger['error'](_0x31d6('0x19'),_0x2c6f40[_0x31d6('0x16')],_0x2c0cb);_0x403a8f(_0xcd02f8[_0x31d6('0x14')](0x1f4,_0x2c6f40[_0x31d6('0x16')]));});});}; \ No newline at end of file +var _0x5b42=['stringify','error','code','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x756d5c,_0x3a4668){var _0x3cf8b7=function(_0x2bc363){while(--_0x2bc363){_0x756d5c['push'](_0x756d5c['shift']());}};_0x3cf8b7(++_0x3a4668);}(_0x5b42,0xbd));var _0x25b4=function(_0x5cb1a7,_0x4a07e0){_0x5cb1a7=_0x5cb1a7-0x0;var _0x5b44c9=_0x5b42[_0x5cb1a7];return _0x5b44c9;};'use strict';var _=require(_0x25b4('0x0'));var util=require(_0x25b4('0x1'));var moment=require(_0x25b4('0x2'));var BPromise=require(_0x25b4('0x3'));var rs=require(_0x25b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b4('0x6'))('rpc');var config=require(_0x25b4('0x7'));var jayson=require(_0x25b4('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x25b4('0x9')]=_['defaults'](config[_0x25b4('0x9')],{'host':_0x25b4('0xa'),'port':0x18eb});var socket=require(_0x25b4('0xb'))(new Redis(config[_0x25b4('0x9')]));require(_0x25b4('0xc'))[_0x25b4('0xd')](socket);function respondWithRpcPromise(_0x20134c,_0x44bd43,_0x3270aa){return new BPromise(function(_0x3d4cfb,_0x37e142){return client[_0x25b4('0xe')](_0x20134c,_0x3270aa)[_0x25b4('0xf')](function(_0x3cf143){logger[_0x25b4('0x10')](_0x25b4('0x11'),_0x44bd43,_0x25b4('0x12'));logger[_0x25b4('0x13')](_0x25b4('0x14'),_0x44bd43,_0x25b4('0x12'),JSON[_0x25b4('0x15')](_0x3cf143));if(_0x3cf143[_0x25b4('0x16')]){if(_0x3cf143[_0x25b4('0x16')][_0x25b4('0x17')]===0x1f4){logger[_0x25b4('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x44bd43,_0x3cf143['error'][_0x25b4('0x18')]);return _0x37e142(_0x3cf143[_0x25b4('0x16')][_0x25b4('0x18')]);}logger[_0x25b4('0x16')](_0x25b4('0x11'),_0x44bd43,_0x3cf143['error'][_0x25b4('0x18')]);return _0x3d4cfb(_0x3cf143[_0x25b4('0x16')]['message']);}else{logger[_0x25b4('0x10')](_0x25b4('0x11'),_0x44bd43,_0x25b4('0x12'));_0x3d4cfb(_0x3cf143[_0x25b4('0x19')][_0x25b4('0x18')]);}})['catch'](function(_0x3af0eb){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x44bd43,_0x3af0eb);_0x37e142(_0x3af0eb);});});}exports[_0x25b4('0x1a')]=function(_0x440e13){var _0x12a4b5=this;return new Promise(function(_0x39e256,_0x883ce6){return db['UserVoiceQueueRt'][_0x25b4('0x1b')]({'raw':_0x440e13['options']?_0x440e13[_0x25b4('0x1c')][_0x25b4('0x1d')]===undefined?!![]:![]:!![],'where':_0x440e13[_0x25b4('0x1c')]?_0x440e13[_0x25b4('0x1c')][_0x25b4('0x1e')]||null:null,'attributes':[[db[_0x25b4('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x25b4('0x20')](_0x25b4('0x21')))),'outboundQueuePauses']]})['then'](function(_0x4ac19a){logger[_0x25b4('0x10')](_0x25b4('0x1a'),_0x440e13);logger[_0x25b4('0x13')](_0x25b4('0x1a'),_0x440e13,JSON[_0x25b4('0x15')](_0x4ac19a));_0x39e256(_0x4ac19a);})[_0x25b4('0x22')](function(_0x270ddf){logger[_0x25b4('0x16')](_0x25b4('0x1a'),_0x270ddf[_0x25b4('0x18')],_0x440e13);_0x883ce6(_0x12a4b5[_0x25b4('0x16')](0x1f4,_0x270ddf[_0x25b4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4be2ae2..72a4f00 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 _0x6299=['register','remove','update','emit','removeListener'];(function(_0x1eb13a,_0x58fa50){var _0x8ff4ca=function(_0x5b8f3c){while(--_0x5b8f3c){_0x1eb13a['push'](_0x1eb13a['shift']());}};_0x8ff4ca(++_0x58fa50);}(_0x6299,0x169));var _0x9629=function(_0x438625,_0x4440ed){_0x438625=_0x438625-0x0;var _0x46b76c=_0x6299[_0x438625];return _0x46b76c;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9629('0x0'),_0x9629('0x1')];function createListener(_0x3cf1e1,_0x35868a){return function(_0x3c3ab2){_0x35868a[_0x9629('0x2')](_0x3cf1e1,_0x3c3ab2);};}function removeListener(_0x55d4ce,_0x327ee9){return function(){UserVoiceQueueRtEvents[_0x9629('0x3')](_0x55d4ce,_0x327ee9);};}exports[_0x9629('0x4')]=function(_0x1edc13){for(var _0x1206bf=0x0,_0x5d5981=events['length'];_0x1206bf<_0x5d5981;_0x1206bf++){var _0x2c5ca5=events[_0x1206bf];var _0x1754e6=createListener('userVoiceQueueRt:'+_0x2c5ca5,_0x1edc13);UserVoiceQueueRtEvents['on'](_0x2c5ca5,_0x1754e6);}}; \ No newline at end of file +var _0x6d19=['./userVoiceQueueRt.events','save','remove','update','removeListener','register','length','userVoiceQueueRt:'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x6d19,0x160));var _0x96d1=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x6d19[_0x5eef05];return _0x56d4b8;};'use strict';var UserVoiceQueueRtEvents=require(_0x96d1('0x0'));var events=[_0x96d1('0x1'),_0x96d1('0x2'),_0x96d1('0x3')];function createListener(_0x874fcb,_0x31518c){return function(_0x36405d){_0x31518c['emit'](_0x874fcb,_0x36405d);};}function removeListener(_0x186315,_0x394a34){return function(){UserVoiceQueueRtEvents[_0x96d1('0x4')](_0x186315,_0x394a34);};}exports[_0x96d1('0x5')]=function(_0x58854b){for(var _0x32b7d9=0x0,_0x230638=events[_0x96d1('0x6')];_0x32b7d9<_0x230638;_0x32b7d9++){var _0x58ade3=events[_0x32b7d9];var _0xba2d03=createListener(_0x96d1('0x7')+_0x58ade3,_0x58854b);UserVoiceQueueRtEvents['on'](_0x58ade3,_0xba2d03);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1a14599..67f622f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x44fce0,_0x92278a){var _0x5c1498=function(_0x2a42b6){while(--_0x2a42b6){_0x44fce0['push'](_0x44fce0['shift']());}};_0x5c1498(++_0x92278a);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x47f61e,_0x5e4865){var _0x914ccf=function(_0x2379bf){while(--_0x2379bf){_0x47f61e['push'](_0x47f61e['shift']());}};_0x914ccf(++_0x5e4865);}(_0xe706,0xa3));var _0x6e70=function(_0x4f485f,_0x1db0f7){_0x4f485f=_0x4f485f-0x0;var _0x1e998e=_0xe706[_0x4f485f];return _0x1e998e;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e0ffb11..6830e1c 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 _0xfe7f=['sequelize','exports','INTEGER'];(function(_0x2e18a9,_0x2ae8c2){var _0x39d8d7=function(_0x4729ef){while(--_0x4729ef){_0x2e18a9['push'](_0x2e18a9['shift']());}};_0x39d8d7(++_0x2ae8c2);}(_0xfe7f,0x99));var _0xffe7=function(_0x458c69,_0xb5f56){_0x458c69=_0x458c69-0x0;var _0x2e11eb=_0xfe7f[_0x458c69];return _0x2e11eb;};'use strict';var Sequelize=require(_0xffe7('0x0'));module[_0xffe7('0x1')]={'penalty':{'type':Sequelize[_0xffe7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2877=['INTEGER','exports'];(function(_0x17f2b7,_0x32a8b0){var _0x4164f6=function(_0x5608ad){while(--_0x5608ad){_0x17f2b7['push'](_0x17f2b7['shift']());}};_0x4164f6(++_0x32a8b0);}(_0x2877,0x1d3));var _0x7287=function(_0x2852b1,_0x246307){_0x2852b1=_0x2852b1-0x0;var _0x46b680=_0x2877[_0x2852b1];return _0x46b680;};'use strict';var Sequelize=require('sequelize');module[_0x7287('0x0')]={'penalty':{'type':Sequelize[_0x7287('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 35e67fa..775776b 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 _0x5a20=['request-promise','path','../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','../../config/logger','api','moment'];(function(_0x46d4d8,_0x16c74a){var _0x885405=function(_0x44fd29){while(--_0x44fd29){_0x46d4d8['push'](_0x46d4d8['shift']());}};_0x885405(++_0x16c74a);}(_0x5a20,0x8d));var _0x05a2=function(_0x497d84,_0x4fad8d){_0x497d84=_0x497d84-0x0;var _0x28b334=_0x5a20[_0x497d84];return _0x28b334;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x05a2('0x0'))(_0x05a2('0x1'));var moment=require(_0x05a2('0x2'));var BPromise=require('bluebird');var rp=require(_0x05a2('0x3'));var fs=require('fs');var path=require(_0x05a2('0x4'));var rimraf=require('rimraf');var config=require(_0x05a2('0x5'));var attributes=require(_0x05a2('0x6'));module['exports']=function(_0x3a726d,_0x2a0c22){return _0x3a726d[_0x05a2('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x05a2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd13=['path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcd13,0xa3));var _0x3cd1=function(_0xac5936,_0x49687c){_0xac5936=_0xac5936-0x0;var _0x48999e=_0xcd13[_0xac5936];return _0x48999e;};'use strict';var _=require(_0x3cd1('0x0'));var util=require(_0x3cd1('0x1'));var logger=require(_0x3cd1('0x2'))(_0x3cd1('0x3'));var moment=require(_0x3cd1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cd1('0x5'));var rimraf=require('rimraf');var config=require(_0x3cd1('0x6'));var attributes=require(_0x3cd1('0x7'));module[_0x3cd1('0x8')]=function(_0x43b4bb,_0x6dfff4){return _0x43b4bb[_0x3cd1('0x9')](_0x3cd1('0xa'),attributes,{'tableName':_0x3cd1('0xb'),'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 499a19b..c4258c2 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 _0xd01c=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xd01c,0xe3));var _0xcd01=function(_0x590c37,_0xf68236){_0x590c37=_0x590c37-0x0;var _0x4d6db6=_0xd01c[_0x590c37];return _0x4d6db6;};'use strict';var _=require(_0xcd01('0x0'));var util=require(_0xcd01('0x1'));var moment=require(_0xcd01('0x2'));var BPromise=require(_0xcd01('0x3'));var rs=require(_0xcd01('0x4'));var fs=require('fs');var Redis=require(_0xcd01('0x5'));var db=require(_0xcd01('0x6'))['db'];var utils=require(_0xcd01('0x7'));var logger=require(_0xcd01('0x8'))(_0xcd01('0x9'));var config=require('../../config/environment');var jayson=require(_0xcd01('0xa'));var client=jayson['client'][_0xcd01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dff5f,_0x3d4edd,_0x2a691f){return new BPromise(function(_0x43aeff,_0x19d78){return client[_0xcd01('0xc')](_0x3dff5f,_0x2a691f)[_0xcd01('0xd')](function(_0x5e3520){logger[_0xcd01('0xe')](_0xcd01('0xf'),_0x3d4edd,_0xcd01('0x10'));logger[_0xcd01('0x11')](_0xcd01('0x12'),_0x3d4edd,'request\x20sent',JSON[_0xcd01('0x13')](_0x5e3520));if(_0x5e3520['error']){if(_0x5e3520[_0xcd01('0x14')][_0xcd01('0x15')]===0x1f4){logger[_0xcd01('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d4edd,_0x5e3520['error']['message']);return _0x19d78(_0x5e3520[_0xcd01('0x14')]['message']);}logger[_0xcd01('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d4edd,_0x5e3520[_0xcd01('0x14')][_0xcd01('0x16')]);return _0x43aeff(_0x5e3520[_0xcd01('0x14')][_0xcd01('0x16')]);}else{logger['info'](_0xcd01('0xf'),_0x3d4edd,_0xcd01('0x10'));_0x43aeff(_0x5e3520[_0xcd01('0x17')]['message']);}})[_0xcd01('0x18')](function(_0x573cc6){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3d4edd,_0x573cc6);_0x19d78(_0x573cc6);});});} \ No newline at end of file +var _0xd596=['jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e47b7,_0x555c00){var _0x8e5a78=function(_0x32eaca){while(--_0x32eaca){_0x4e47b7['push'](_0x4e47b7['shift']());}};_0x8e5a78(++_0x555c00);}(_0xd596,0x9f));var _0x6d59=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd596[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var util=require(_0x6d59('0x0'));var moment=require(_0x6d59('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d59('0x2'));var fs=require('fs');var Redis=require(_0x6d59('0x3'));var db=require(_0x6d59('0x4'))['db'];var utils=require(_0x6d59('0x5'));var logger=require(_0x6d59('0x6'))(_0x6d59('0x7'));var config=require(_0x6d59('0x8'));var jayson=require(_0x6d59('0x9'));var client=jayson['client'][_0x6d59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31bba9,_0x1f6a08,_0x183eaf){return new BPromise(function(_0x24c0aa,_0x1e24fa){return client[_0x6d59('0xb')](_0x31bba9,_0x183eaf)[_0x6d59('0xc')](function(_0x4c69b8){logger[_0x6d59('0xd')](_0x6d59('0xe'),_0x1f6a08,_0x6d59('0xf'));logger[_0x6d59('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1f6a08,'request\x20sent',JSON['stringify'](_0x4c69b8));if(_0x4c69b8[_0x6d59('0x11')]){if(_0x4c69b8[_0x6d59('0x11')][_0x6d59('0x12')]===0x1f4){logger[_0x6d59('0x11')](_0x6d59('0xe'),_0x1f6a08,_0x4c69b8[_0x6d59('0x11')][_0x6d59('0x13')]);return _0x1e24fa(_0x4c69b8[_0x6d59('0x11')][_0x6d59('0x13')]);}logger['error'](_0x6d59('0xe'),_0x1f6a08,_0x4c69b8[_0x6d59('0x11')][_0x6d59('0x13')]);return _0x24c0aa(_0x4c69b8[_0x6d59('0x11')][_0x6d59('0x13')]);}else{logger[_0x6d59('0xd')](_0x6d59('0xe'),_0x1f6a08,_0x6d59('0xf'));_0x24c0aa(_0x4c69b8[_0x6d59('0x14')][_0x6d59('0x13')]);}})['catch'](function(_0x54181b){logger[_0x6d59('0x11')](_0x6d59('0xe'),_0x1f6a08,_0x54181b);_0x1e24fa(_0x54181b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8ddd91e..c706a00 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 _0x7ec2=['/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index'];(function(_0x58ad3e,_0x196bc8){var _0x42789f=function(_0x522b5f){while(--_0x522b5f){_0x58ad3e['push'](_0x58ad3e['shift']());}};_0x42789f(++_0x196bc8);}(_0x7ec2,0x15c));var _0x27ec=function(_0x182224,_0x12e21a){_0x182224=_0x182224-0x0;var _0xafba76=_0x7ec2[_0x182224];return _0xafba76;};'use strict';var multer=require(_0x27ec('0x0'));var util=require(_0x27ec('0x1'));var path=require(_0x27ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x27ec('0x3'));var router=express[_0x27ec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27ec('0x5'));var interaction=require(_0x27ec('0x6'));var config=require(_0x27ec('0x7'));var controller=require(_0x27ec('0x8'));router[_0x27ec('0x9')]('/',auth[_0x27ec('0xa')](),controller[_0x27ec('0xb')]);router[_0x27ec('0x9')](_0x27ec('0xc'),auth[_0x27ec('0xa')](),controller[_0x27ec('0xd')]);router[_0x27ec('0xe')]('/',auth[_0x27ec('0xa')](),controller[_0x27ec('0xf')]);router[_0x27ec('0x10')](_0x27ec('0xc'),auth[_0x27ec('0xa')](),controller[_0x27ec('0x11')]);router[_0x27ec('0x12')](_0x27ec('0xc'),auth[_0x27ec('0xa')](),controller['destroy']);module[_0x27ec('0x13')]=router; \ No newline at end of file +var _0x3ae9=['delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0xf97eb0,_0x1578b7){var _0xea70f4=function(_0x574c8d){while(--_0x574c8d){_0xf97eb0['push'](_0xf97eb0['shift']());}};_0xea70f4(++_0x1578b7);}(_0x3ae9,0xdb));var _0x93ae=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x3ae9[_0x4b2863];return _0x567d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93ae('0x0'));var timeout=require(_0x93ae('0x1'));var express=require(_0x93ae('0x2'));var router=express['Router']();var fs_extra=require(_0x93ae('0x3'));var auth=require(_0x93ae('0x4'));var interaction=require(_0x93ae('0x5'));var config=require(_0x93ae('0x6'));var controller=require('./variable.controller');router[_0x93ae('0x7')]('/',auth['isAuthenticated'](),controller[_0x93ae('0x8')]);router[_0x93ae('0x7')](_0x93ae('0x9'),auth[_0x93ae('0xa')](),controller[_0x93ae('0xb')]);router[_0x93ae('0xc')]('/',auth['isAuthenticated'](),controller[_0x93ae('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x93ae('0xe')]);router[_0x93ae('0xf')](_0x93ae('0x9'),auth[_0x93ae('0xa')](),controller[_0x93ae('0x10')]);module[_0x93ae('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2fc635e..7ef3a00 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 _0xba85=['sequelize','exports','STRING','name'];(function(_0xbc0206,_0x32d711){var _0x15719f=function(_0x4ab857){while(--_0x4ab857){_0xbc0206['push'](_0xbc0206['shift']());}};_0x15719f(++_0x32d711);}(_0xba85,0x78));var _0x5ba8=function(_0x41e68c,_0x568c84){_0x41e68c=_0x41e68c-0x0;var _0x1bc78b=_0xba85[_0x41e68c];return _0x1bc78b;};'use strict';var Sequelize=require(_0x5ba8('0x0'));module[_0x5ba8('0x1')]={'name':{'type':Sequelize[_0x5ba8('0x2')],'unique':_0x5ba8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb82a=['exports','STRING','name'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb82a,0x93));var _0xab82=function(_0x582856,_0x5c2ce4){_0x582856=_0x582856-0x0;var _0x4194f2=_0xb82a[_0x582856];return _0x4194f2;};'use strict';var Sequelize=require('sequelize');module[_0xab82('0x0')]={'name':{'type':Sequelize[_0xab82('0x1')],'unique':_0xab82('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 5b02da3..8f68189 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 _0xac0d=['bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','Variables','UserProfileResource','destroy','error','name','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Variable','then','includeAll','include','findAll','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','zip-dir'];(function(_0x4142b1,_0x1119af){var _0x346210=function(_0x5817af){while(--_0x5817af){_0x4142b1['push'](_0x4142b1['shift']());}};_0x346210(++_0x1119af);}(_0xac0d,0x1d9));var _0xdac0=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xac0d[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdac0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdac0('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdac0('0x2'));var sox=require(_0xdac0('0x3'));var csv=require(_0xdac0('0x4'));var ejs=require(_0xdac0('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdac0('0x6'));var crypto=require(_0xdac0('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xdac0('0x8'));var toCsv=require('to-csv');var querystring=require(_0xdac0('0x9'));var Papa=require(_0xdac0('0xa'));var Redis=require('ioredis');var authService=require(_0xdac0('0xb'));var qs=require(_0xdac0('0xc'));var as=require(_0xdac0('0xd'));var hardwareService=require(_0xdac0('0xe'));var logger=require('../../config/logger')(_0xdac0('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdac0('0x10'));var db=require(_0xdac0('0x11'))['db'];function respondWithStatusCode(_0x1e8871,_0x1a7ad9){_0x1a7ad9=_0x1a7ad9||0xcc;return function(_0x1d4a21){if(_0x1d4a21){return _0x1e8871[_0xdac0('0x12')](_0x1a7ad9);}return _0x1e8871[_0xdac0('0x13')](_0x1a7ad9)[_0xdac0('0x14')]();};}function respondWithResult(_0x52b090,_0x3aa06c){_0x3aa06c=_0x3aa06c||0xc8;return function(_0x1d6862){if(_0x1d6862){return _0x52b090['status'](_0x3aa06c)[_0xdac0('0x15')](_0x1d6862);}};}function respondWithFilteredResult(_0xb43d86,_0x373967){return function(_0x3fc00d){if(_0x3fc00d){var _0xfcd9a8=typeof _0x373967[_0xdac0('0x16')]===_0xdac0('0x17')&&typeof _0x373967[_0xdac0('0x18')]===_0xdac0('0x17');var _0x11a774=_0x3fc00d[_0xdac0('0x19')];var _0x17d7e5=_0xfcd9a8?0x0:_0x373967[_0xdac0('0x16')];var _0x3593c8=_0xfcd9a8?_0x3fc00d[_0xdac0('0x19')]:_0x373967[_0xdac0('0x16')]+_0x373967[_0xdac0('0x18')];var _0x5c7111;if(_0x3593c8>=_0x11a774){_0x3593c8=_0x11a774;_0x5c7111=0xc8;}else{_0x5c7111=0xce;}_0xb43d86[_0xdac0('0x13')](_0x5c7111);return _0xb43d86['set'](_0xdac0('0x1a'),_0x17d7e5+'-'+_0x3593c8+'/'+_0x11a774)[_0xdac0('0x15')](_0x3fc00d);}return null;};}function patchUpdates(_0xea5e2a){return function(_0x31d524){try{jsonpatch[_0xdac0('0x1b')](_0x31d524,_0xea5e2a,!![]);}catch(_0x47ec06){return BPromise[_0xdac0('0x1c')](_0x47ec06);}return _0x31d524[_0xdac0('0x1d')]();};}function saveUpdates(_0x4dd494,_0x3bcec9){return function(_0x264ca0){if(_0x264ca0){return _0x264ca0[_0xdac0('0x1e')](_0x4dd494)['then'](function(_0x2b5446){return _0x2b5446;});}return null;};}function removeEntity(_0x56b78b,_0x5316a8){return function(_0x19f67f){if(_0x19f67f){return _0x19f67f['destroy']()['then'](function(){var _0x1564ea=_0x19f67f[_0xdac0('0x1f')]({'plain':!![]});var _0x25dc33=_0xdac0('0x20');return db[_0xdac0('0x21')][_0xdac0('0x22')]({'where':{'type':_0x25dc33,'resourceId':_0x1564ea['id']}})['then'](function(){return _0x19f67f;});})['then'](function(){_0x56b78b[_0xdac0('0x13')](0xcc)[_0xdac0('0x14')]();});}};}function handleEntityNotFound(_0x51887b,_0x3a82e9){return function(_0x48b2f5){if(!_0x48b2f5){_0x51887b[_0xdac0('0x12')](0x194);}return _0x48b2f5;};}function handleError(_0x3393ba,_0x33414e){_0x33414e=_0x33414e||0x1f4;return function(_0x521241){logger[_0xdac0('0x23')](_0x521241['stack']);if(_0x521241[_0xdac0('0x24')]){delete _0x521241[_0xdac0('0x24')];}_0x3393ba['status'](_0x33414e)['send'](_0x521241);};}exports[_0xdac0('0x25')]=function(_0x5af07e,_0x37ed7b){var _0xac2daf={},_0x1463c7={},_0x5e3e32={'count':0x0,'rows':[]};var _0x2359b4=_[_0xdac0('0x26')](db['Variable'][_0xdac0('0x27')],function(_0x13efad){return{'name':_0x13efad['fieldName'],'type':_0x13efad[_0xdac0('0x28')][_0xdac0('0x29')]};});_0x1463c7[_0xdac0('0x2a')]=_[_0xdac0('0x26')](_0x2359b4,_0xdac0('0x24'));_0x1463c7[_0xdac0('0x2b')]=_[_0xdac0('0x2c')](_0x5af07e['query']);_0x1463c7['filters']=_[_0xdac0('0x2d')](_0x1463c7[_0xdac0('0x2a')],_0x1463c7[_0xdac0('0x2b')]);_0xac2daf['attributes']=_[_0xdac0('0x2d')](_0x1463c7['model'],qs[_0xdac0('0x2e')](_0x5af07e[_0xdac0('0x2b')][_0xdac0('0x2e')]));_0xac2daf[_0xdac0('0x2f')]=_0xac2daf['attributes'][_0xdac0('0x30')]?_0xac2daf['attributes']:_0x1463c7['model'];if(!_0x5af07e['query'][_0xdac0('0x31')](_0xdac0('0x32'))){_0xac2daf[_0xdac0('0x18')]=qs[_0xdac0('0x18')](_0x5af07e[_0xdac0('0x2b')]['limit']);_0xac2daf['offset']=qs[_0xdac0('0x16')](_0x5af07e[_0xdac0('0x2b')][_0xdac0('0x16')]);}_0xac2daf[_0xdac0('0x33')]=qs[_0xdac0('0x34')](_0x5af07e[_0xdac0('0x2b')][_0xdac0('0x34')]);_0xac2daf[_0xdac0('0x35')]=qs[_0xdac0('0x36')](_[_0xdac0('0x37')](_0x5af07e['query'],_0x1463c7['filters']),_0x2359b4);if(_0x5af07e[_0xdac0('0x2b')][_0xdac0('0x38')]){_0xac2daf[_0xdac0('0x35')]=_['merge'](_0xac2daf['where'],{'$or':_[_0xdac0('0x26')](_0x2359b4,function(_0x465dc4){if(_0x465dc4[_0xdac0('0x28')]!==_0xdac0('0x39')){var _0x45cf76={};_0x45cf76[_0x465dc4[_0xdac0('0x24')]]={'$like':'%'+_0x5af07e[_0xdac0('0x2b')][_0xdac0('0x38')]+'%'};return _0x45cf76;}})});}_0xac2daf=_[_0xdac0('0x3a')]({},_0xac2daf,_0x5af07e[_0xdac0('0x3b')]);var _0x3501c0={'where':_0xac2daf['where']};return db[_0xdac0('0x3c')]['count'](_0x3501c0)[_0xdac0('0x3d')](function(_0x23e75b){_0x5e3e32['count']=_0x23e75b;if(_0x5af07e[_0xdac0('0x2b')][_0xdac0('0x3e')]){_0xac2daf[_0xdac0('0x3f')]=[{'all':!![]}];}return db[_0xdac0('0x3c')][_0xdac0('0x40')](_0xac2daf);})[_0xdac0('0x3d')](function(_0x2b7eab){_0x5e3e32[_0xdac0('0x41')]=_0x2b7eab;return _0x5e3e32;})[_0xdac0('0x3d')](respondWithFilteredResult(_0x37ed7b,_0xac2daf))[_0xdac0('0x42')](handleError(_0x37ed7b,null));};exports[_0xdac0('0x43')]=function(_0x926da7,_0x4a254b){var _0x1c408f={'raw':!![],'where':{'id':_0x926da7[_0xdac0('0x44')]['id']}},_0x4cc93e={};_0x4cc93e[_0xdac0('0x2a')]=_[_0xdac0('0x2c')](db[_0xdac0('0x3c')][_0xdac0('0x27')]);_0x4cc93e['query']=_[_0xdac0('0x2c')](_0x926da7[_0xdac0('0x2b')]);_0x4cc93e[_0xdac0('0x36')]=_[_0xdac0('0x2d')](_0x4cc93e['model'],_0x4cc93e[_0xdac0('0x2b')]);_0x1c408f[_0xdac0('0x2f')]=_[_0xdac0('0x2d')](_0x4cc93e['model'],qs[_0xdac0('0x2e')](_0x926da7['query']['fields']));_0x1c408f[_0xdac0('0x2f')]=_0x1c408f[_0xdac0('0x2f')][_0xdac0('0x30')]?_0x1c408f[_0xdac0('0x2f')]:_0x4cc93e['model'];if(_0x926da7[_0xdac0('0x2b')][_0xdac0('0x3e')]){_0x1c408f['include']=[{'all':!![]}];}_0x1c408f=_[_0xdac0('0x3a')]({},_0x1c408f,_0x926da7[_0xdac0('0x3b')]);return db['Variable'][_0xdac0('0x45')](_0x1c408f)['then'](handleEntityNotFound(_0x4a254b,null))[_0xdac0('0x3d')](respondWithResult(_0x4a254b,null))[_0xdac0('0x42')](handleError(_0x4a254b,null));};exports[_0xdac0('0x46')]=function(_0x15c656,_0x492aaf){return db[_0xdac0('0x3c')][_0xdac0('0x46')](_0x15c656['body'],{})[_0xdac0('0x3d')](function(_0x54b99b){var _0x5d362a=_0x15c656[_0xdac0('0x47')]['get']({'plain':!![]});if(!_0x5d362a)throw new Error(_0xdac0('0x48'));if(_0x5d362a[_0xdac0('0x49')]===_0xdac0('0x47')){var _0x17b8ee=_0x54b99b['get']({'plain':!![]});var _0x3778ae='Variables';return db[_0xdac0('0x4a')][_0xdac0('0x45')]({'where':{'name':_0x3778ae,'userProfileId':_0x5d362a[_0xdac0('0x4b')]},'raw':!![]})[_0xdac0('0x3d')](function(_0x20f957){if(_0x20f957&&_0x20f957[_0xdac0('0x4c')]===0x0){return db[_0xdac0('0x21')][_0xdac0('0x46')]({'name':_0x17b8ee[_0xdac0('0x24')],'resourceId':_0x17b8ee['id'],'type':_0x20f957['name'],'sectionId':_0x20f957['id']},{})['then'](function(){return _0x54b99b;});}else{return _0x54b99b;}})['catch'](function(_0x490ef8){logger[_0xdac0('0x23')](_0xdac0('0x4d'),_0x490ef8);throw _0x490ef8;});}return _0x54b99b;})[_0xdac0('0x3d')](respondWithResult(_0x492aaf,0xc9))['catch'](handleError(_0x492aaf,null));};exports['update']=function(_0x29e428,_0x3374db){if(_0x29e428[_0xdac0('0x4e')]['id']){delete _0x29e428[_0xdac0('0x4e')]['id'];}return db[_0xdac0('0x3c')][_0xdac0('0x45')]({'where':{'id':_0x29e428[_0xdac0('0x44')]['id']}})[_0xdac0('0x3d')](handleEntityNotFound(_0x3374db,null))[_0xdac0('0x3d')](saveUpdates(_0x29e428[_0xdac0('0x4e')],null))[_0xdac0('0x3d')](respondWithResult(_0x3374db,null))[_0xdac0('0x42')](handleError(_0x3374db,null));};exports['destroy']=function(_0x2497c5,_0x2c099c){return db['Variable'][_0xdac0('0x45')]({'where':{'id':_0x2497c5[_0xdac0('0x44')]['id']}})[_0xdac0('0x3d')](handleEntityNotFound(_0x2c099c,null))[_0xdac0('0x3d')](removeEntity(_0x2c099c,null))[_0xdac0('0x42')](handleError(_0x2c099c,null));}; \ No newline at end of file +var _0x2fc2=['to-csv','fs-extra','lodash','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','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Variables','sendStatus','error','stack','name','index','map','Variable','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path'];(function(_0x2f0cd5,_0x586f30){var _0x145f7b=function(_0xc75c71){while(--_0xc75c71){_0x2f0cd5['push'](_0x2f0cd5['shift']());}};_0x145f7b(++_0x586f30);}(_0x2fc2,0x189));var _0x22fc=function(_0x355915,_0x40be18){_0x355915=_0x355915-0x0;var _0x9920e5=_0x2fc2[_0x355915];return _0x9920e5;};'use strict';var emlformat=require(_0x22fc('0x0'));var rimraf=require(_0x22fc('0x1'));var zipdir=require(_0x22fc('0x2'));var jsonpatch=require(_0x22fc('0x3'));var rp=require('request-promise');var moment=require(_0x22fc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x22fc('0x5'));var path=require(_0x22fc('0x6'));var sox=require('sox');var csv=require(_0x22fc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22fc('0x8'));var _=require(_0x22fc('0x9'));var squel=require('squel');var crypto=require(_0x22fc('0xa'));var jsforce=require(_0x22fc('0xb'));var deskjs=require(_0x22fc('0xc'));var toCsv=require(_0x22fc('0x7'));var querystring=require('querystring');var Papa=require(_0x22fc('0xd'));var Redis=require(_0x22fc('0xe'));var authService=require(_0x22fc('0xf'));var qs=require(_0x22fc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x22fc('0x11'));var logger=require(_0x22fc('0x12'))(_0x22fc('0x13'));var utils=require(_0x22fc('0x14'));var config=require(_0x22fc('0x15'));var licenseUtil=require(_0x22fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xca61df,_0x36d84c){_0x36d84c=_0x36d84c||0xcc;return function(_0x29b43f){if(_0x29b43f){return _0xca61df['sendStatus'](_0x36d84c);}return _0xca61df[_0x22fc('0x17')](_0x36d84c)[_0x22fc('0x18')]();};}function respondWithResult(_0x1cb85d,_0x44a81b){_0x44a81b=_0x44a81b||0xc8;return function(_0x42418d){if(_0x42418d){return _0x1cb85d[_0x22fc('0x17')](_0x44a81b)[_0x22fc('0x19')](_0x42418d);}};}function respondWithFilteredResult(_0x478fbb,_0x47c3f1){return function(_0x217353){if(_0x217353){var _0x392043=typeof _0x47c3f1['offset']===_0x22fc('0x1a')&&typeof _0x47c3f1[_0x22fc('0x1b')]==='undefined';var _0x2e5d75=_0x217353[_0x22fc('0x1c')];var _0x33ebd5=_0x392043?0x0:_0x47c3f1['offset'];var _0x546682=_0x392043?_0x217353['count']:_0x47c3f1[_0x22fc('0x1d')]+_0x47c3f1[_0x22fc('0x1b')];var _0xc114f5;if(_0x546682>=_0x2e5d75){_0x546682=_0x2e5d75;_0xc114f5=0xc8;}else{_0xc114f5=0xce;}_0x478fbb[_0x22fc('0x17')](_0xc114f5);return _0x478fbb[_0x22fc('0x1e')](_0x22fc('0x1f'),_0x33ebd5+'-'+_0x546682+'/'+_0x2e5d75)[_0x22fc('0x19')](_0x217353);}return null;};}function patchUpdates(_0x400364){return function(_0x31281b){try{jsonpatch[_0x22fc('0x20')](_0x31281b,_0x400364,!![]);}catch(_0x488ce0){return BPromise[_0x22fc('0x21')](_0x488ce0);}return _0x31281b[_0x22fc('0x22')]();};}function saveUpdates(_0x40c75e,_0xbf97c9){return function(_0x96a2ef){if(_0x96a2ef){return _0x96a2ef['update'](_0x40c75e)[_0x22fc('0x23')](function(_0x50484d){return _0x50484d;});}return null;};}function removeEntity(_0x188daf,_0x50dcb8){return function(_0x358898){if(_0x358898){return _0x358898[_0x22fc('0x24')]()[_0x22fc('0x23')](function(){var _0x52da15=_0x358898[_0x22fc('0x25')]({'plain':!![]});var _0x368f4f=_0x22fc('0x26');return db['UserProfileResource'][_0x22fc('0x24')]({'where':{'type':_0x368f4f,'resourceId':_0x52da15['id']}})[_0x22fc('0x23')](function(){return _0x358898;});})[_0x22fc('0x23')](function(){_0x188daf['status'](0xcc)[_0x22fc('0x18')]();});}};}function handleEntityNotFound(_0x36f423,_0x99d8eb){return function(_0x4a40e3){if(!_0x4a40e3){_0x36f423[_0x22fc('0x27')](0x194);}return _0x4a40e3;};}function handleError(_0x1ad85d,_0x55c811){_0x55c811=_0x55c811||0x1f4;return function(_0x60c92d){logger[_0x22fc('0x28')](_0x60c92d[_0x22fc('0x29')]);if(_0x60c92d['name']){delete _0x60c92d[_0x22fc('0x2a')];}_0x1ad85d[_0x22fc('0x17')](_0x55c811)['send'](_0x60c92d);};}exports[_0x22fc('0x2b')]=function(_0x26d6c1,_0x5424f2){var _0x53a871={},_0x37cef7={},_0x43d8f8={'count':0x0,'rows':[]};var _0xf36e41=_[_0x22fc('0x2c')](db[_0x22fc('0x2d')][_0x22fc('0x2e')],function(_0x17843d){return{'name':_0x17843d['fieldName'],'type':_0x17843d[_0x22fc('0x2f')][_0x22fc('0x30')]};});_0x37cef7[_0x22fc('0x31')]=_['map'](_0xf36e41,_0x22fc('0x2a'));_0x37cef7[_0x22fc('0x32')]=_[_0x22fc('0x33')](_0x26d6c1['query']);_0x37cef7[_0x22fc('0x34')]=_['intersection'](_0x37cef7[_0x22fc('0x31')],_0x37cef7[_0x22fc('0x32')]);_0x53a871[_0x22fc('0x35')]=_[_0x22fc('0x36')](_0x37cef7[_0x22fc('0x31')],qs['fields'](_0x26d6c1[_0x22fc('0x32')][_0x22fc('0x37')]));_0x53a871[_0x22fc('0x35')]=_0x53a871['attributes'][_0x22fc('0x38')]?_0x53a871['attributes']:_0x37cef7[_0x22fc('0x31')];if(!_0x26d6c1[_0x22fc('0x32')][_0x22fc('0x39')]('nolimit')){_0x53a871['limit']=qs['limit'](_0x26d6c1[_0x22fc('0x32')][_0x22fc('0x1b')]);_0x53a871[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x26d6c1[_0x22fc('0x32')][_0x22fc('0x1d')]);}_0x53a871[_0x22fc('0x3a')]=qs[_0x22fc('0x3b')](_0x26d6c1[_0x22fc('0x32')][_0x22fc('0x3b')]);_0x53a871[_0x22fc('0x3c')]=qs[_0x22fc('0x34')](_['pick'](_0x26d6c1[_0x22fc('0x32')],_0x37cef7['filters']),_0xf36e41);if(_0x26d6c1[_0x22fc('0x32')]['filter']){_0x53a871[_0x22fc('0x3c')]=_[_0x22fc('0x3d')](_0x53a871[_0x22fc('0x3c')],{'$or':_[_0x22fc('0x2c')](_0xf36e41,function(_0x48eec4){if(_0x48eec4['type']!==_0x22fc('0x3e')){var _0x24a37c={};_0x24a37c[_0x48eec4[_0x22fc('0x2a')]]={'$like':'%'+_0x26d6c1['query'][_0x22fc('0x3f')]+'%'};return _0x24a37c;}})});}_0x53a871=_[_0x22fc('0x3d')]({},_0x53a871,_0x26d6c1['options']);var _0x961f29={'where':_0x53a871[_0x22fc('0x3c')]};return db[_0x22fc('0x2d')][_0x22fc('0x1c')](_0x961f29)['then'](function(_0x2b12e7){_0x43d8f8['count']=_0x2b12e7;if(_0x26d6c1[_0x22fc('0x32')][_0x22fc('0x40')]){_0x53a871[_0x22fc('0x41')]=[{'all':!![]}];}return db[_0x22fc('0x2d')][_0x22fc('0x42')](_0x53a871);})[_0x22fc('0x23')](function(_0x518d6f){_0x43d8f8['rows']=_0x518d6f;return _0x43d8f8;})['then'](respondWithFilteredResult(_0x5424f2,_0x53a871))['catch'](handleError(_0x5424f2,null));};exports[_0x22fc('0x43')]=function(_0x559f60,_0x277f45){var _0x484507={'raw':!![],'where':{'id':_0x559f60[_0x22fc('0x44')]['id']}},_0x189088={};_0x189088['model']=_[_0x22fc('0x33')](db['Variable'][_0x22fc('0x2e')]);_0x189088[_0x22fc('0x32')]=_['keys'](_0x559f60[_0x22fc('0x32')]);_0x189088[_0x22fc('0x34')]=_[_0x22fc('0x36')](_0x189088['model'],_0x189088[_0x22fc('0x32')]);_0x484507[_0x22fc('0x35')]=_[_0x22fc('0x36')](_0x189088['model'],qs['fields'](_0x559f60[_0x22fc('0x32')][_0x22fc('0x37')]));_0x484507[_0x22fc('0x35')]=_0x484507[_0x22fc('0x35')][_0x22fc('0x38')]?_0x484507['attributes']:_0x189088['model'];if(_0x559f60[_0x22fc('0x32')][_0x22fc('0x40')]){_0x484507[_0x22fc('0x41')]=[{'all':!![]}];}_0x484507=_[_0x22fc('0x3d')]({},_0x484507,_0x559f60['options']);return db[_0x22fc('0x2d')][_0x22fc('0x45')](_0x484507)[_0x22fc('0x23')](handleEntityNotFound(_0x277f45,null))[_0x22fc('0x23')](respondWithResult(_0x277f45,null))[_0x22fc('0x46')](handleError(_0x277f45,null));};exports[_0x22fc('0x47')]=function(_0x243141,_0x110341){return db[_0x22fc('0x2d')][_0x22fc('0x47')](_0x243141['body'],{})[_0x22fc('0x23')](function(_0xe982fa){var _0x381f7e=_0x243141[_0x22fc('0x48')][_0x22fc('0x25')]({'plain':!![]});if(!_0x381f7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x381f7e[_0x22fc('0x49')]===_0x22fc('0x48')){var _0x5120f2=_0xe982fa[_0x22fc('0x25')]({'plain':!![]});var _0x1d6cc9=_0x22fc('0x26');return db[_0x22fc('0x4a')][_0x22fc('0x45')]({'where':{'name':_0x1d6cc9,'userProfileId':_0x381f7e[_0x22fc('0x4b')]},'raw':!![]})[_0x22fc('0x23')](function(_0x1661d7){if(_0x1661d7&&_0x1661d7[_0x22fc('0x4c')]===0x0){return db[_0x22fc('0x4d')][_0x22fc('0x47')]({'name':_0x5120f2[_0x22fc('0x2a')],'resourceId':_0x5120f2['id'],'type':_0x1661d7[_0x22fc('0x2a')],'sectionId':_0x1661d7['id']},{})[_0x22fc('0x23')](function(){return _0xe982fa;});}else{return _0xe982fa;}})[_0x22fc('0x46')](function(_0x2f8929){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f8929);throw _0x2f8929;});}return _0xe982fa;})[_0x22fc('0x23')](respondWithResult(_0x110341,0xc9))[_0x22fc('0x46')](handleError(_0x110341,null));};exports[_0x22fc('0x4e')]=function(_0x1053d7,_0x2466e9){if(_0x1053d7[_0x22fc('0x4f')]['id']){delete _0x1053d7[_0x22fc('0x4f')]['id'];}return db[_0x22fc('0x2d')]['find']({'where':{'id':_0x1053d7[_0x22fc('0x44')]['id']}})['then'](handleEntityNotFound(_0x2466e9,null))['then'](saveUpdates(_0x1053d7['body'],null))[_0x22fc('0x23')](respondWithResult(_0x2466e9,null))[_0x22fc('0x46')](handleError(_0x2466e9,null));};exports[_0x22fc('0x24')]=function(_0x3f840c,_0x545b84){return db[_0x22fc('0x2d')][_0x22fc('0x45')]({'where':{'id':_0x3f840c['params']['id']}})[_0x22fc('0x23')](handleEntityNotFound(_0x545b84,null))[_0x22fc('0x23')](removeEntity(_0x545b84,null))[_0x22fc('0x46')](handleError(_0x545b84,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 28d973e..c47b805 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 _0x9c1f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash'];(function(_0x1b7d88,_0x5e1b25){var _0x40e708=function(_0xbe778e){while(--_0xbe778e){_0x1b7d88['push'](_0x1b7d88['shift']());}};_0x40e708(++_0x5e1b25);}(_0x9c1f,0x195));var _0xf9c1=function(_0x2fc5f2,_0x50d6e4){_0x2fc5f2=_0x2fc5f2-0x0;var _0x14c14a=_0x9c1f[_0x2fc5f2];return _0x14c14a;};'use strict';var _=require(_0xf9c1('0x0'));var util=require(_0xf9c1('0x1'));var logger=require(_0xf9c1('0x2'))(_0xf9c1('0x3'));var moment=require(_0xf9c1('0x4'));var BPromise=require(_0xf9c1('0x5'));var rp=require(_0xf9c1('0x6'));var fs=require('fs');var path=require(_0xf9c1('0x7'));var rimraf=require(_0xf9c1('0x8'));var config=require(_0xf9c1('0x9'));var attributes=require(_0xf9c1('0xa'));module[_0xf9c1('0xb')]=function(_0x8d7a6a,_0x171faa){return _0x8d7a6a[_0xf9c1('0xc')](_0xf9c1('0xd'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae91=['../../config/logger','api','moment','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','util'];(function(_0x130297,_0x34f948){var _0x359305=function(_0x58b15c){while(--_0x58b15c){_0x130297['push'](_0x130297['shift']());}};_0x359305(++_0x34f948);}(_0xae91,0xfb));var _0x1ae9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae91[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x1ae9('0x0'));var logger=require(_0x1ae9('0x1'))(_0x1ae9('0x2'));var moment=require(_0x1ae9('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ae9('0x4'));var fs=require('fs');var path=require(_0x1ae9('0x5'));var rimraf=require(_0x1ae9('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ae9('0x7'));module[_0x1ae9('0x8')]=function(_0x599064,_0x2ea7d7){return _0x599064[_0x1ae9('0x9')](_0x1ae9('0xa'),attributes,{'tableName':_0x1ae9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 1e9fbb1..93f053d 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x5ba4df,_0x13a939){var _0x2b99b7=function(_0x1ee162){while(--_0x1ee162){_0x5ba4df['push'](_0x5ba4df['shift']());}};_0x2b99b7(++_0x13a939);}(_0x814b,0x1a2));var _0xb814=function(_0x369cf2,_0x47e28c){_0x369cf2=_0x369cf2-0x0;var _0x5c7d3e=_0x814b[_0x369cf2];return _0x5c7d3e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x5639e1,_0x421603){var _0x197e82=function(_0x150da4){while(--_0x150da4){_0x5639e1['push'](_0x5639e1['shift']());}};_0x197e82(++_0x421603);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x5fc3[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7196771..9ceb183 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 _0x9263=['../../components/auth/service','./version.controller','get','isAuthenticated','fetch','/reset','canUpdate','reset','restart','/migrations','migrations','exports','express','Router'];(function(_0x4c19eb,_0x7d7644){var _0x29553a=function(_0x418608){while(--_0x418608){_0x4c19eb['push'](_0x4c19eb['shift']());}};_0x29553a(++_0x7d7644);}(_0x9263,0x194));var _0x3926=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x9263[_0x9df060];return _0x338dfe;};'use strict';var express=require(_0x3926('0x0'));var router=express[_0x3926('0x1')]();var auth=require(_0x3926('0x2'));var controller=require(_0x3926('0x3'));router[_0x3926('0x4')]('/',controller['index']);router[_0x3926('0x4')]('/fetch',auth[_0x3926('0x5')](),auth['canUpdate'](),controller[_0x3926('0x6')]);router[_0x3926('0x4')](_0x3926('0x7'),auth[_0x3926('0x5')](),auth[_0x3926('0x8')](),controller[_0x3926('0x9')]);router['get']('/pull',auth[_0x3926('0x5')](),auth[_0x3926('0x8')](),controller['pull']);router[_0x3926('0x4')]('/restart',auth[_0x3926('0x5')](),controller[_0x3926('0xa')]);router[_0x3926('0x4')](_0x3926('0xb'),controller[_0x3926('0xc')]);module[_0x3926('0xd')]=router; \ No newline at end of file +var _0xf2ca=['isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','restart','migrations','express','./version.controller','get','index'];(function(_0x3e750b,_0x57619a){var _0xd1137=function(_0x1ddfe1){while(--_0x1ddfe1){_0x3e750b['push'](_0x3e750b['shift']());}};_0xd1137(++_0x57619a);}(_0xf2ca,0x182));var _0xaf2c=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xf2ca[_0x3c22e0];return _0x215811;};'use strict';var express=require(_0xaf2c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xaf2c('0x1'));router[_0xaf2c('0x2')]('/',controller[_0xaf2c('0x3')]);router[_0xaf2c('0x2')]('/fetch',auth[_0xaf2c('0x4')](),auth[_0xaf2c('0x5')](),controller[_0xaf2c('0x6')]);router[_0xaf2c('0x2')]('/reset',auth[_0xaf2c('0x4')](),auth[_0xaf2c('0x5')](),controller[_0xaf2c('0x7')]);router[_0xaf2c('0x2')](_0xaf2c('0x8'),auth[_0xaf2c('0x4')](),auth[_0xaf2c('0x5')](),controller[_0xaf2c('0x9')]);router[_0xaf2c('0x2')](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x2')]('/migrations',controller[_0xaf2c('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1660e41..4166e13 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 _0x2edc=['status','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','server','replace','.js','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','index','query','latest','fetch','tags','exports','2.0.0','json','error'];(function(_0x155838,_0x54d81f){var _0x4f12ca=function(_0x4962ea){while(--_0x4962ea){_0x155838['push'](_0x155838['shift']());}};_0x4f12ca(++_0x54d81f);}(_0x2edc,0x1e2));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0xc2ed('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc2ed('0x1'));var pkginfo=require(_0xc2ed('0x2'))(module,_0xc2ed('0x3'));var compareVersions=require(_0xc2ed('0x4'));var exec=require(_0xc2ed('0x5'))['exec'];var db=require(_0xc2ed('0x6'))['db'];var config=require(_0xc2ed('0x7'));var pm2=require(_0xc2ed('0x8'));var logger=require('../../config/logger')('update');var git=require('simple-git')(config['root']);exports[_0xc2ed('0x9')]=function(_0x1e804e,_0x180fb5){var _0xbf6695={'current':module['exports'][_0xc2ed('0x3')],'phonebar':0x2};if(_0x1e804e['query']&&_0x1e804e[_0xc2ed('0xa')][_0xc2ed('0xb')]){return git[_0xc2ed('0xc')]()[_0xc2ed('0xd')](function(_0x309e7d,_0x12244d){_0xbf6695[_0xc2ed('0xb')]=(_0x309e7d?module[_0xc2ed('0xe')][_0xc2ed('0x3')]:_0x12244d[_0xc2ed('0xb')])||_0xc2ed('0xf');return _0x180fb5['status'](0xc8)['json'](_0xbf6695);});}else{return _0x180fb5['status'](0xc8)[_0xc2ed('0x10')](_0xbf6695);}};exports[_0xc2ed('0xc')]=function(_0x1eb6ec,_0x59dee0){return git['fetch'](['origin','master'],function(_0x4ff326){if(_0x4ff326){logger[_0xc2ed('0x11')](_0x4ff326);return _0x59dee0[_0xc2ed('0x12')](0x1f4)['json'](_0x4ff326);}logger[_0xc2ed('0x13')](_0xc2ed('0x14'));return _0x59dee0['status'](0xc8)[_0xc2ed('0x10')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc2ed('0x15')]=function(_0x4bb6d0,_0x2252df){return git[_0xc2ed('0x15')]([_0xc2ed('0x16'),_0xc2ed('0x17')],function(_0xbd8af4){if(_0xbd8af4){logger['error'](_0xbd8af4);return _0x2252df['status'](0x1f4)[_0xc2ed('0x10')](_0xbd8af4);}logger[_0xc2ed('0x13')](_0xc2ed('0x18'));return _0x2252df['status'](0xc8)[_0xc2ed('0x10')]({'output':_0xc2ed('0x19')});});};exports[_0xc2ed('0x1a')]=function(_0x1b888a,_0xaeca92){exec('npm\x20install\x20--production',function(_0x5ba3ef,_0x4fe930,_0x34483d){logger[_0xc2ed('0x13')](_0x4fe930);logger[_0xc2ed('0x13')](_0x34483d);if(_0x5ba3ef){logger[_0xc2ed('0x11')](_0x5ba3ef);return _0xaeca92[_0xc2ed('0x12')](0x1f4)['json'](_0x5ba3ef);}return _0xaeca92[_0xc2ed('0x12')](0xc8)[_0xc2ed('0x10')]({'output':_0x4fe930});});};exports['restart']=function(_0x416bff,_0x2a0679){return pm2['restart'](_0xc2ed('0x1b'))[_0xc2ed('0x1c')](function(_0x237e94){logger[_0xc2ed('0x13')](_0xc2ed('0x1d'),_0x237e94);return _0x2a0679['status'](0xc8)[_0xc2ed('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc2ed('0x1e')](function(_0x149e54){logger[_0xc2ed('0x11')](_0x149e54);return _0x2a0679[_0xc2ed('0x12')](0x1f4)[_0xc2ed('0x10')](_0x149e54);});};exports[_0xc2ed('0x1f')]=function(_0x1b0edf,_0x4f68c0){var _0x2679d4=fs[_0xc2ed('0x20')](path[_0xc2ed('0x21')](config[_0xc2ed('0x22')],_0xc2ed('0x23'),_0xc2ed('0x1f')));var _0x230d6b=[];for(var _0x135e57=0x0;_0x135e57<_0x2679d4['length'];_0x135e57++){var _0x19750f=_0x2679d4[_0x135e57][_0xc2ed('0x24')](_0xc2ed('0x25'),'');if(compareVersions(module[_0xc2ed('0xe')]['version'],_0x19750f)===-0x1){_0x230d6b['push'](_0x19750f);}}if(_0x230d6b[_0xc2ed('0x26')]){var _0x1174d2=_0x230d6b[_0xc2ed('0x27')](compareVersions);var _0x314a37=new Umzug({'storage':_0xc2ed('0x28'),'storageOptions':{'model':db[_0xc2ed('0x29')],'modelName':'Migration','columnName':_0xc2ed('0x3')},'migrations':{'params':[db[_0xc2ed('0x28')][_0xc2ed('0x2a')](),db[_0xc2ed('0x28')][_0xc2ed('0x2b')],function(){throw new Error(_0xc2ed('0x2c'));}],'path':path[_0xc2ed('0x21')](config['root'],_0xc2ed('0x23'),_0xc2ed('0x1f')),'pattern':/\.js$/}});_0x314a37['up']({'migrations':_[_0xc2ed('0x2d')](_0x1174d2,function(_0x427760){return _0x427760+'.js';})})[_0xc2ed('0x1c')](function(){return _0x4f68c0[_0xc2ed('0x12')](0xc8)[_0xc2ed('0x10')]({'output':_0xc2ed('0x2e')+module['exports'][_0xc2ed('0x3')]+_0xc2ed('0x2f')+_['last'](_0x1174d2),'migrations':_[_0xc2ed('0x21')](_0x1174d2)});})['catch'](function(_0x21101a){if(_0x21101a instanceof db['sequelize'][_0xc2ed('0x30')]){return _0x4f68c0[_0xc2ed('0x12')](0xc8)[_0xc2ed('0x10')]({'output':_0xc2ed('0x31')});}else{return _0x4f68c0[_0xc2ed('0x12')](0x1f4)[_0xc2ed('0x10')](_0x21101a);}});}else{return _0x4f68c0[_0xc2ed('0x12')](0xc8)[_0xc2ed('0x10')]({'output':_0xc2ed('0x31')});}}; \ No newline at end of file +var _0xd98c=['sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xd98c,0xdf));var _0xcd98=function(_0xf99551,_0x5095a5){_0xf99551=_0xf99551-0x0;var _0x17739b=_0xd98c[_0xf99551];return _0x17739b;};'use strict';var Umzug=require(_0xcd98('0x0'));var path=require(_0xcd98('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xcd98('0x2'))(module,_0xcd98('0x3'));var compareVersions=require(_0xcd98('0x4'));var exec=require(_0xcd98('0x5'))['exec'];var db=require(_0xcd98('0x6'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0xcd98('0x7'))(_0xcd98('0x8'));var git=require(_0xcd98('0x9'))(config[_0xcd98('0xa')]);exports[_0xcd98('0xb')]=function(_0x88233f,_0x4efd39){var _0xf34524={'current':module[_0xcd98('0xc')]['version'],'phonebar':0x2};if(_0x88233f[_0xcd98('0xd')]&&_0x88233f[_0xcd98('0xd')][_0xcd98('0xe')]){return git[_0xcd98('0xf')]()[_0xcd98('0x10')](function(_0x148662,_0x1c3236){_0xf34524[_0xcd98('0xe')]=(_0x148662?module[_0xcd98('0xc')][_0xcd98('0x3')]:_0x1c3236[_0xcd98('0xe')])||_0xcd98('0x11');return _0x4efd39[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')](_0xf34524);});}else{return _0x4efd39['status'](0xc8)[_0xcd98('0x13')](_0xf34524);}};exports[_0xcd98('0xf')]=function(_0x4649e4,_0x11678a){return git[_0xcd98('0xf')]([_0xcd98('0x14'),'master'],function(_0x4d94a1){if(_0x4d94a1){logger[_0xcd98('0x15')](_0x4d94a1);return _0x11678a['status'](0x1f4)[_0xcd98('0x13')](_0x4d94a1);}logger[_0xcd98('0x16')](_0xcd98('0x17'));return _0x11678a[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')]({'output':_0xcd98('0x18')});});};exports[_0xcd98('0x19')]=function(_0x6fe20b,_0x26664e){return git[_0xcd98('0x19')]([_0xcd98('0x1a'),_0xcd98('0x1b')],function(_0x73f2b1){if(_0x73f2b1){logger[_0xcd98('0x15')](_0x73f2b1);return _0x26664e[_0xcd98('0x12')](0x1f4)[_0xcd98('0x13')](_0x73f2b1);}logger[_0xcd98('0x16')](_0xcd98('0x1c'));return _0x26664e[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0xcd98('0x1d')]=function(_0x5bb244,_0x5fe3ea){exec('npm\x20install\x20--production',function(_0x315c05,_0x1952a4,_0x332a85){logger[_0xcd98('0x16')](_0x1952a4);logger['info'](_0x332a85);if(_0x315c05){logger[_0xcd98('0x15')](_0x315c05);return _0x5fe3ea[_0xcd98('0x12')](0x1f4)[_0xcd98('0x13')](_0x315c05);}return _0x5fe3ea[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')]({'output':_0x1952a4});});};exports['restart']=function(_0x14a083,_0x5a2f7f){return pm2[_0xcd98('0x1e')]('motion2')['then'](function(_0xcb28db){logger[_0xcd98('0x16')](_0xcd98('0x1f'),_0xcb28db);return _0x5a2f7f['status'](0xc8)['json']({'output':_0xcd98('0x20')});})[_0xcd98('0x21')](function(_0x3202bf){logger[_0xcd98('0x15')](_0x3202bf);return _0x5a2f7f['status'](0x1f4)[_0xcd98('0x13')](_0x3202bf);});};exports[_0xcd98('0x22')]=function(_0x352086,_0x23513c){var _0x2de7ac=fs[_0xcd98('0x23')](path[_0xcd98('0x24')](config['root'],_0xcd98('0x25'),_0xcd98('0x22')));var _0x47b539=[];for(var _0x4aa613=0x0;_0x4aa613<_0x2de7ac[_0xcd98('0x26')];_0x4aa613++){var _0x28996d=_0x2de7ac[_0x4aa613][_0xcd98('0x27')](_0xcd98('0x28'),'');if(compareVersions(module[_0xcd98('0xc')][_0xcd98('0x3')],_0x28996d)===-0x1){_0x47b539[_0xcd98('0x29')](_0x28996d);}}if(_0x47b539[_0xcd98('0x26')]){var _0x1a9a8d=_0x47b539[_0xcd98('0x2a')](compareVersions);var _0x47fabe=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xcd98('0x2b')],'modelName':_0xcd98('0x2b'),'columnName':_0xcd98('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xcd98('0x2c')][_0xcd98('0x2d')],function(){throw new Error(_0xcd98('0x2e'));}],'path':path[_0xcd98('0x24')](config[_0xcd98('0xa')],'server',_0xcd98('0x22')),'pattern':/\.js$/}});_0x47fabe['up']({'migrations':_[_0xcd98('0x2f')](_0x1a9a8d,function(_0x368eee){return _0x368eee+_0xcd98('0x28');})})[_0xcd98('0x30')](function(){return _0x23513c[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')]({'output':_0xcd98('0x31')+module[_0xcd98('0xc')][_0xcd98('0x3')]+_0xcd98('0x32')+_['last'](_0x1a9a8d),'migrations':_[_0xcd98('0x24')](_0x1a9a8d)});})[_0xcd98('0x21')](function(_0x381d46){if(_0x381d46 instanceof db[_0xcd98('0x2c')][_0xcd98('0x33')]){return _0x23513c[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')]({'output':_0xcd98('0x34')});}else{return _0x23513c['status'](0x1f4)[_0xcd98('0x13')](_0x381d46);}});}else{return _0x23513c[_0xcd98('0x12')](0xc8)[_0xcd98('0x13')]({'output':_0xcd98('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5e5b2fd..0788adc 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 _0xea55=['isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','get','index','/describe'];(function(_0x5bd626,_0xdbf46d){var _0x2661ca=function(_0x421ff4){while(--_0x421ff4){_0x5bd626['push'](_0x5bd626['shift']());}};_0x2661ca(++_0xdbf46d);}(_0xea55,0x105));var _0x5ea5=function(_0x5a8114,_0x86fb8f){_0x5a8114=_0x5a8114-0x0;var _0x2bec41=_0xea55[_0x5a8114];return _0x2bec41;};'use strict';var multer=require(_0x5ea5('0x0'));var util=require(_0x5ea5('0x1'));var path=require(_0x5ea5('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ea5('0x3'));var router=express['Router']();var fs_extra=require(_0x5ea5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ea5('0x5'));var controller=require('./voiceAgentReport.controller');router[_0x5ea5('0x6')]('/',auth['isAuthenticated'](),controller[_0x5ea5('0x7')]);router[_0x5ea5('0x6')](_0x5ea5('0x8'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0xa')]);router['get'](_0x5ea5('0xb'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0xc')]);router[_0x5ea5('0xd')]('/',auth[_0x5ea5('0x9')](),controller['create']);router[_0x5ea5('0xe')](_0x5ea5('0xb'),auth[_0x5ea5('0x9')](),controller['update']);router[_0x5ea5('0xf')]('/:id',auth[_0x5ea5('0x9')](),controller[_0x5ea5('0x10')]);module[_0x5ea5('0x11')]=router; \ No newline at end of file +var _0xdaf2=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','update'];(function(_0x36d684,_0x4c8b0c){var _0x2fb56a=function(_0x4155b3){while(--_0x4155b3){_0x36d684['push'](_0x36d684['shift']());}};_0x2fb56a(++_0x4c8b0c);}(_0xdaf2,0x1cf));var _0x2daf=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xdaf2[_0x2d460c];return _0xf6fc4c;};'use strict';var multer=require('multer');var util=require(_0x2daf('0x0'));var path=require(_0x2daf('0x1'));var timeout=require('connect-timeout');var express=require(_0x2daf('0x2'));var router=express[_0x2daf('0x3')]();var fs_extra=require(_0x2daf('0x4'));var auth=require(_0x2daf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2daf('0x6'));var controller=require(_0x2daf('0x7'));router[_0x2daf('0x8')]('/',auth['isAuthenticated'](),controller[_0x2daf('0x9')]);router['get'](_0x2daf('0xa'),auth[_0x2daf('0xb')](),controller[_0x2daf('0xc')]);router[_0x2daf('0x8')](_0x2daf('0xd'),auth[_0x2daf('0xb')](),controller[_0x2daf('0xe')]);router[_0x2daf('0xf')]('/',auth[_0x2daf('0xb')](),controller['create']);router['put'](_0x2daf('0xd'),auth[_0x2daf('0xb')](),controller[_0x2daf('0x10')]);router[_0x2daf('0x11')](_0x2daf('0xd'),auth['isAuthenticated'](),controller[_0x2daf('0x12')]);module[_0x2daf('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 91931b4..1fea042 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 _0xb9e7=['STRING','DATE','INTEGER','BOOLEAN','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0xb9e7[_0x52b24f];return _0x46ea6b;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'type':{'type':Sequelize[_0x7b9e('0x1')]},'uniqueid':{'type':Sequelize[_0x7b9e('0x1')]},'calleridnum':{'type':Sequelize[_0x7b9e('0x1')]},'calleridname':{'type':Sequelize[_0x7b9e('0x1')]},'queue':{'type':Sequelize[_0x7b9e('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7b9e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7b9e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x7b9e('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x7b9e('0x2')]},'holdtime':{'type':Sequelize[_0x7b9e('0x3')]},'agentcomplete':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7b9e('0x3')]},'reason':{'type':Sequelize[_0x7b9e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7b9e('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7b9e('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7b9e('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b9e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7b9e('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7b9e('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7b9e('0x1')]},'destcalleridname':{'type':Sequelize[_0x7b9e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7b9e('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7b9e('0x1')]},'destaccountcode':{'type':Sequelize[_0x7b9e('0x1')]},'destcontext':{'type':Sequelize[_0x7b9e('0x1')]},'destexten':{'type':Sequelize[_0x7b9e('0x1')]},'destpriority':{'type':Sequelize[_0x7b9e('0x1')]},'destuniqueid':{'type':Sequelize[_0x7b9e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7b9e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7b9e('0x1')]},'transfer':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b9e('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7b9e('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xef0a=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0xef0a,0xdd));var _0xaef0=function(_0x8f2b5d,_0x3bbfb9){_0x8f2b5d=_0x8f2b5d-0x0;var _0xffcb82=_0xef0a[_0x8f2b5d];return _0xffcb82;};'use strict';var Sequelize=require(_0xaef0('0x0'));module[_0xaef0('0x1')]={'type':{'type':Sequelize[_0xaef0('0x2')]},'uniqueid':{'type':Sequelize[_0xaef0('0x2')]},'calleridnum':{'type':Sequelize[_0xaef0('0x2')]},'calleridname':{'type':Sequelize[_0xaef0('0x2')]},'queue':{'type':Sequelize[_0xaef0('0x2')]},'interface':{'type':Sequelize[_0xaef0('0x2')]},'membername':{'type':Sequelize[_0xaef0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaef0('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaef0('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xaef0('0x3')]},'agentdumpAt':{'type':Sequelize[_0xaef0('0x3')]},'holdtime':{'type':Sequelize[_0xaef0('0x4')]},'agentcomplete':{'type':Sequelize[_0xaef0('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaef0('0x4')]},'agentacw':{'type':Sequelize[_0xaef0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaef0('0x4')]},'reason':{'type':Sequelize[_0xaef0('0x2')]},'lastevent':{'type':Sequelize[_0xaef0('0x2')]},'channel':{'type':Sequelize[_0xaef0('0x2')]},'channelstate':{'type':Sequelize[_0xaef0('0x4')]},'channelstatedesc':{'type':Sequelize[_0xaef0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaef0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaef0('0x2')]},'accountcode':{'type':Sequelize[_0xaef0('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xaef0('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xaef0('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xaef0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaef0('0x2')]},'destcalleridname':{'type':Sequelize[_0xaef0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaef0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaef0('0x2')]},'destlanguage':{'type':Sequelize[_0xaef0('0x2')]},'destaccountcode':{'type':Sequelize[_0xaef0('0x2')]},'destcontext':{'type':Sequelize[_0xaef0('0x2')]},'destexten':{'type':Sequelize[_0xaef0('0x2')]},'destpriority':{'type':Sequelize[_0xaef0('0x2')]},'destuniqueid':{'type':Sequelize[_0xaef0('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaef0('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaef0('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaef0('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaef0('0x2')]},'transferuniqueid':{'type':Sequelize[_0xaef0('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 6ea591f..402103c 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(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 507d6bc..b727f6d 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 _0x7f42=['bluebird','path','../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x7f42,0x1dd));var _0x27f4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7f42[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x27f4('0x0'));var util=require('util');var logger=require(_0x27f4('0x1'))(_0x27f4('0x2'));var moment=require('moment');var BPromise=require(_0x27f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27f4('0x4'));var rimraf=require('rimraf');var config=require(_0x27f4('0x5'));var attributes=require('./voiceAgentReport.attributes');module[_0x27f4('0x6')]=function(_0x5c9286,_0x256ac9){return _0x5c9286[_0x27f4('0x7')](_0x27f4('0x8'),attributes,{'tableName':_0x27f4('0x9'),'paranoid':![],'indexes':[{'fields':[_0x27f4('0xa'),_0x27f4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb66=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb66,0x19f));var _0x6cb6=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xcb66[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var moment=require(_0x6cb6('0x3'));var BPromise=require(_0x6cb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb6('0x5'));var rimraf=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var attributes=require(_0x6cb6('0x8'));module[_0x6cb6('0x9')]=function(_0x506d14,_0x53078d){return _0x506d14[_0x6cb6('0xa')](_0x6cb6('0xb'),attributes,{'tableName':_0x6cb6('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6cb6('0xd'),_0x6cb6('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 97c28ae..9548386 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 _0xd130=['CreateVoiceAgentReport','stringify','UpdateVoiceAgentReport','update','raw','where','limit','lodash','util','bluebird','randomstring','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','create','body','options','debug'];(function(_0x47d871,_0x29b8ab){var _0x4ad663=function(_0x2e4240){while(--_0x2e4240){_0x47d871['push'](_0x47d871['shift']());}};_0x4ad663(++_0x29b8ab);}(_0xd130,0x146));var _0x0d13=function(_0x293b85,_0x5f5d5){_0x293b85=_0x293b85-0x0;var _0x4e2929=_0xd130[_0x293b85];return _0x4e2929;};'use strict';var _=require(_0x0d13('0x0'));var util=require(_0x0d13('0x1'));var moment=require('moment');var BPromise=require(_0x0d13('0x2'));var rs=require(_0x0d13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d13('0x4'));var config=require('../../config/environment');var jayson=require(_0x0d13('0x5'));var client=jayson[_0x0d13('0x6')][_0x0d13('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44b843,_0x3217ae,_0x35476e){return new BPromise(function(_0x514d41,_0x3dca91){return client[_0x0d13('0x8')](_0x44b843,_0x35476e)[_0x0d13('0x9')](function(_0x54eb61){logger[_0x0d13('0xa')](_0x0d13('0xb'),_0x3217ae,'request\x20sent');logger['debug'](_0x0d13('0xc'),_0x3217ae,'request\x20sent',JSON['stringify'](_0x54eb61));if(_0x54eb61['error']){if(_0x54eb61[_0x0d13('0xd')][_0x0d13('0xe')]===0x1f4){logger['error'](_0x0d13('0xb'),_0x3217ae,_0x54eb61['error'][_0x0d13('0xf')]);return _0x3dca91(_0x54eb61[_0x0d13('0xd')][_0x0d13('0xf')]);}logger['error'](_0x0d13('0xb'),_0x3217ae,_0x54eb61[_0x0d13('0xd')][_0x0d13('0xf')]);return _0x514d41(_0x54eb61[_0x0d13('0xd')][_0x0d13('0xf')]);}else{logger[_0x0d13('0xa')](_0x0d13('0xb'),_0x3217ae,_0x0d13('0x10'));_0x514d41(_0x54eb61['result']['message']);}})[_0x0d13('0x11')](function(_0x57836e){logger[_0x0d13('0xd')](_0x0d13('0xb'),_0x3217ae,_0x57836e);_0x3dca91(_0x57836e);});});}exports['CreateVoiceAgentReport']=function(_0x127746){var _0x19e8a0=this;return new Promise(function(_0x41cc94,_0x3eac1e){return db['VoiceAgentReport'][_0x0d13('0x12')](_0x127746[_0x0d13('0x13')],{'raw':_0x127746[_0x0d13('0x14')]?_0x127746[_0x0d13('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x0d13('0x9')](function(_0x4e04e0){logger[_0x0d13('0xa')]('CreateVoiceAgentReport',_0x127746);logger[_0x0d13('0x15')](_0x0d13('0x16'),_0x127746,JSON[_0x0d13('0x17')](_0x4e04e0));_0x41cc94(_0x4e04e0);})[_0x0d13('0x11')](function(_0x4f2b6a){logger[_0x0d13('0xd')](_0x0d13('0x16'),_0x4f2b6a['message'],_0x127746);_0x3eac1e(_0x19e8a0['error'](0x1f4,_0x4f2b6a[_0x0d13('0xf')]));});});};exports[_0x0d13('0x18')]=function(_0x4d3ddc){var _0x359d45=this;return new Promise(function(_0x5d019b,_0x483a3c){return db['VoiceAgentReport'][_0x0d13('0x19')](_0x4d3ddc['body'],{'raw':_0x4d3ddc[_0x0d13('0x14')]?_0x4d3ddc[_0x0d13('0x14')][_0x0d13('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d3ddc[_0x0d13('0x14')]?_0x4d3ddc[_0x0d13('0x14')][_0x0d13('0x1b')]||null:null,'attributes':_0x4d3ddc[_0x0d13('0x14')]?_0x4d3ddc[_0x0d13('0x14')]['attributes']||null:null,'limit':_0x4d3ddc['options']?_0x4d3ddc['options'][_0x0d13('0x1c')]||null:null})['then'](function(_0x2dfc62){logger[_0x0d13('0xa')]('UpdateVoiceAgentReport',_0x4d3ddc);logger[_0x0d13('0x15')](_0x0d13('0x18'),_0x4d3ddc,JSON[_0x0d13('0x17')](_0x2dfc62));_0x5d019b(_0x2dfc62);})[_0x0d13('0x11')](function(_0x33466e){logger[_0x0d13('0xd')](_0x0d13('0x18'),_0x33466e['message'],_0x4d3ddc);_0x483a3c(_0x359d45['error'](0x1f4,_0x33466e['message']));});});}; \ No newline at end of file +var _0x1b10=['http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x344128,_0x9b9e88){var _0x693fae=function(_0x3e2b2e){while(--_0x3e2b2e){_0x344128['push'](_0x344128['shift']());}};_0x693fae(++_0x9b9e88);}(_0x1b10,0x176));var _0x01b1=function(_0x1a0f0b,_0x14f695){_0x1a0f0b=_0x1a0f0b-0x0;var _0x5b7d46=_0x1b10[_0x1a0f0b];return _0x5b7d46;};'use strict';var _=require(_0x01b1('0x0'));var util=require(_0x01b1('0x1'));var moment=require(_0x01b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x01b1('0x3'));var fs=require('fs');var Redis=require(_0x01b1('0x4'));var db=require(_0x01b1('0x5'))['db'];var utils=require(_0x01b1('0x6'));var logger=require(_0x01b1('0x7'))('rpc');var config=require(_0x01b1('0x8'));var jayson=require(_0x01b1('0x9'));var client=jayson[_0x01b1('0xa')][_0x01b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da473,_0x7a901a,_0x3b3479){return new BPromise(function(_0x12eca4,_0x19ded6){return client[_0x01b1('0xc')](_0x2da473,_0x3b3479)[_0x01b1('0xd')](function(_0x1677a2){logger[_0x01b1('0xe')](_0x01b1('0xf'),_0x7a901a,_0x01b1('0x10'));logger[_0x01b1('0x11')](_0x01b1('0x12'),_0x7a901a,_0x01b1('0x10'),JSON[_0x01b1('0x13')](_0x1677a2));if(_0x1677a2[_0x01b1('0x14')]){if(_0x1677a2[_0x01b1('0x14')][_0x01b1('0x15')]===0x1f4){logger['error'](_0x01b1('0xf'),_0x7a901a,_0x1677a2[_0x01b1('0x14')][_0x01b1('0x16')]);return _0x19ded6(_0x1677a2[_0x01b1('0x14')]['message']);}logger[_0x01b1('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x7a901a,_0x1677a2['error'][_0x01b1('0x16')]);return _0x12eca4(_0x1677a2[_0x01b1('0x14')][_0x01b1('0x16')]);}else{logger[_0x01b1('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x7a901a,_0x01b1('0x10'));_0x12eca4(_0x1677a2[_0x01b1('0x17')][_0x01b1('0x16')]);}})[_0x01b1('0x18')](function(_0x4e9b85){logger[_0x01b1('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x7a901a,_0x4e9b85);_0x19ded6(_0x4e9b85);});});}exports['CreateVoiceAgentReport']=function(_0x158f4f){var _0xc3a93c=this;return new Promise(function(_0x1fe96a,_0x4487ea){return db[_0x01b1('0x19')][_0x01b1('0x1a')](_0x158f4f[_0x01b1('0x1b')],{'raw':_0x158f4f[_0x01b1('0x1c')]?_0x158f4f[_0x01b1('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5376a7){logger[_0x01b1('0xe')](_0x01b1('0x1d'),_0x158f4f);logger[_0x01b1('0x11')](_0x01b1('0x1d'),_0x158f4f,JSON[_0x01b1('0x13')](_0x5376a7));_0x1fe96a(_0x5376a7);})[_0x01b1('0x18')](function(_0x53571a){logger[_0x01b1('0x14')](_0x01b1('0x1d'),_0x53571a[_0x01b1('0x16')],_0x158f4f);_0x4487ea(_0xc3a93c[_0x01b1('0x14')](0x1f4,_0x53571a[_0x01b1('0x16')]));});});};exports[_0x01b1('0x1e')]=function(_0x1a245d){var _0xed14cc=this;return new Promise(function(_0x3516bb,_0x559b8d){return db[_0x01b1('0x19')][_0x01b1('0x1f')](_0x1a245d[_0x01b1('0x1b')],{'raw':_0x1a245d[_0x01b1('0x1c')]?_0x1a245d[_0x01b1('0x1c')][_0x01b1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a245d['options']?_0x1a245d[_0x01b1('0x1c')][_0x01b1('0x21')]||null:null,'attributes':_0x1a245d[_0x01b1('0x1c')]?_0x1a245d[_0x01b1('0x1c')][_0x01b1('0x22')]||null:null,'limit':_0x1a245d[_0x01b1('0x1c')]?_0x1a245d[_0x01b1('0x1c')]['limit']||null:null})['then'](function(_0xd8ad07){logger[_0x01b1('0xe')](_0x01b1('0x1e'),_0x1a245d);logger['debug'](_0x01b1('0x1e'),_0x1a245d,JSON[_0x01b1('0x13')](_0xd8ad07));_0x3516bb(_0xd8ad07);})[_0x01b1('0x18')](function(_0x3f20d9){logger[_0x01b1('0x14')](_0x01b1('0x1e'),_0x3f20d9['message'],_0x1a245d);_0x559b8d(_0xed14cc[_0x01b1('0x14')](0x1f4,_0x3f20d9[_0x01b1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a8d580c..4004fab 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 _0xffc1=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','updateWithRetry','delete','destroy','Router','../../components/auth/service'];(function(_0x1d621f,_0x432990){var _0x13d33b=function(_0x45d49e){while(--_0x45d49e){_0x1d621f['push'](_0x1d621f['shift']());}};_0x13d33b(++_0x432990);}(_0xffc1,0x8e));var _0x1ffc=function(_0x59e96a,_0x49234f){_0x59e96a=_0x59e96a-0x0;var _0x10ee58=_0xffc1[_0x59e96a];return _0x10ee58;};'use strict';var express=require('express');var router=express[_0x1ffc('0x0')]();var auth=require(_0x1ffc('0x1'));var controller=require('./voiceCallReport.controller');router[_0x1ffc('0x2')]('/',auth[_0x1ffc('0x3')](),controller[_0x1ffc('0x4')]);router[_0x1ffc('0x2')](_0x1ffc('0x5'),auth[_0x1ffc('0x3')](),controller[_0x1ffc('0x6')]);router[_0x1ffc('0x2')](_0x1ffc('0x7'),auth[_0x1ffc('0x3')](),controller[_0x1ffc('0x8')]);router[_0x1ffc('0x9')]('/',auth[_0x1ffc('0x3')](),controller[_0x1ffc('0xa')]);router[_0x1ffc('0xb')](_0x1ffc('0x7'),auth['isAuthenticated'](),controller[_0x1ffc('0xc')]);router[_0x1ffc('0xb')]('/with-retry/:id',auth[_0x1ffc('0x3')](),controller[_0x1ffc('0xd')]);router[_0x1ffc('0xe')](_0x1ffc('0x7'),auth[_0x1ffc('0x3')](),controller[_0x1ffc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9177=['post','create','put','update','updateWithRetry','delete','destroy','exports','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xf9c602,_0x521bfd){var _0x58a8e2=function(_0x219905){while(--_0x219905){_0xf9c602['push'](_0xf9c602['shift']());}};_0x58a8e2(++_0x521bfd);}(_0x9177,0x14c));var _0x7917=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x9177[_0x587dd0];return _0x56f153;};'use strict';var express=require('express');var router=express[_0x7917('0x0')]();var auth=require(_0x7917('0x1'));var controller=require(_0x7917('0x2'));router[_0x7917('0x3')]('/',auth[_0x7917('0x4')](),controller[_0x7917('0x5')]);router[_0x7917('0x3')](_0x7917('0x6'),auth[_0x7917('0x4')](),controller[_0x7917('0x7')]);router['get'](_0x7917('0x8'),auth[_0x7917('0x4')](),controller[_0x7917('0x9')]);router[_0x7917('0xa')]('/',auth[_0x7917('0x4')](),controller[_0x7917('0xb')]);router[_0x7917('0xc')](_0x7917('0x8'),auth[_0x7917('0x4')](),controller[_0x7917('0xd')]);router[_0x7917('0xc')]('/with-retry/:id',auth[_0x7917('0x4')](),controller[_0x7917('0xe')]);router[_0x7917('0xf')](_0x7917('0x8'),auth[_0x7917('0x4')](),controller[_0x7917('0x10')]);module[_0x7917('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 143ad0d..60a3f22 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 _0x429b=['DATE','INTEGER','sequelize','exports','STRING','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x38d8d8,_0x359c68){var _0x3d827e=function(_0xd50d38){while(--_0xd50d38){_0x38d8d8['push'](_0x38d8d8['shift']());}};_0x3d827e(++_0x359c68);}(_0x429b,0x70));var _0xb429=function(_0xb40d0e,_0x425f59){_0xb40d0e=_0xb40d0e-0x0;var _0x4ee608=_0x429b[_0xb40d0e];return _0x4ee608;};'use strict';var Sequelize=require(_0xb429('0x0'));module[_0xb429('0x1')]={'uniqueid':{'type':Sequelize[_0xb429('0x2')]},'type':{'type':Sequelize['ENUM'](_0xb429('0x3'),_0xb429('0x4'),'outbound',_0xb429('0x5'),_0xb429('0x6'),_0xb429('0x7'))},'tag':{'type':Sequelize[_0xb429('0x2')]},'accountcode':{'type':Sequelize[_0xb429('0x2')]},'source':{'type':Sequelize[_0xb429('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xb429('0x2')]},'callerid':{'type':Sequelize[_0xb429('0x2')]},'channel':{'type':Sequelize[_0xb429('0x2')]},'destinationchannel':{'type':Sequelize[_0xb429('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb429('0x8')]},'starttime':{'type':Sequelize[_0xb429('0x9')]},'systemanswertime':{'type':Sequelize[_0xb429('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb429('0x9')]},'duration':{'type':Sequelize[_0xb429('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb429('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb429('0x2')]},'amaflags':{'type':Sequelize[_0xb429('0x2')]},'userfield':{'type':Sequelize[_0xb429('0x2')]},'userDisposition':{'type':Sequelize[_0xb429('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xb429('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xb429('0x2')]},'note':{'type':Sequelize[_0xb429('0x2')]},'prefix':{'type':Sequelize[_0xb429('0x2')]},'routeid':{'type':Sequelize[_0xb429('0xa')]},'sipcallid':{'type':Sequelize[_0xb429('0x2')]}}; \ No newline at end of file +var _0xd70e=['DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xd70e,0x157));var _0xed70=function(_0x41170b,_0x4c94a1){_0x41170b=_0x41170b-0x0;var _0x2e672d=_0xd70e[_0x41170b];return _0x2e672d;};'use strict';var Sequelize=require(_0xed70('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xed70('0x1')](_0xed70('0x2'),_0xed70('0x3'),_0xed70('0x4'),_0xed70('0x5'),_0xed70('0x6'),_0xed70('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xed70('0x8')]},'source':{'type':Sequelize[_0xed70('0x8')]},'destination':{'type':Sequelize[_0xed70('0x8')]},'destinationcontext':{'type':Sequelize[_0xed70('0x8')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xed70('0x8')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xed70('0x8')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xed70('0x9')]},'systemanswertime':{'type':Sequelize[_0xed70('0x9')]},'answertime':{'type':Sequelize[_0xed70('0x9')]},'endtime':{'type':Sequelize[_0xed70('0x9')]},'duration':{'type':Sequelize[_0xed70('0xa')]},'billableseconds':{'type':Sequelize[_0xed70('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xed70('0x8')]},'amaflags':{'type':Sequelize[_0xed70('0x8')]},'userfield':{'type':Sequelize[_0xed70('0x8')]},'userDisposition':{'type':Sequelize[_0xed70('0x8')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xed70('0x8')]},'prefix':{'type':Sequelize[_0xed70('0x8')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xed70('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5a027c3..75e23c4 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 _0x75dc=['include','fullname','findAll','rows','catch','show','params','includeAll','find','create','body','describe','user','uniqueid','updateWithRetry','lodash','../../components/parsers/qs','promise-retry','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x122d0c,_0x105eac){var _0x529740=function(_0x3bf8a2){while(--_0x3bf8a2){_0x122d0c['push'](_0x122d0c['shift']());}};_0x529740(++_0x105eac);}(_0x75dc,0x1d7));var _0xc75d=function(_0x126f42,_0x57f1ad){_0x126f42=_0x126f42-0x0;var _0x219119=_0x75dc[_0x126f42];return _0x219119;};'use strict';var _=require(_0xc75d('0x0'));var qs=require(_0xc75d('0x1'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0xc75d('0x2'));function respondWithResult(_0x1f7e98,_0x2d1326){_0x2d1326=_0x2d1326||0xc8;return function(_0x21664a){if(_0x21664a){return _0x1f7e98[_0xc75d('0x3')](_0x2d1326)[_0xc75d('0x4')](_0x21664a);}};}function respondWithFilteredResult(_0x550399,_0x3428f0){return function(_0x1db578){if(_0x1db578){var _0x928edc=typeof _0x3428f0['offset']===_0xc75d('0x5')&&typeof _0x3428f0[_0xc75d('0x6')]===_0xc75d('0x5');var _0x274d40=_0x1db578['count'];var _0x264fcb=_0x928edc?0x0:_0x3428f0['offset'];var _0x5f1833=_0x928edc?_0x1db578[_0xc75d('0x7')]:_0x3428f0[_0xc75d('0x8')]+_0x3428f0[_0xc75d('0x6')];var _0x431843;if(_0x5f1833>=_0x274d40){_0x5f1833=_0x274d40;_0x431843=0xc8;}else{_0x431843=0xce;}_0x550399['status'](_0x431843);return _0x550399[_0xc75d('0x9')](_0xc75d('0xa'),_0x264fcb+'-'+_0x5f1833+'/'+_0x274d40)[_0xc75d('0x4')](_0x1db578);}return null;};}function saveUpdates(_0x1b0911){return function(_0x1a7984){if(_0x1a7984){return _0x1a7984[_0xc75d('0xb')](_0x1b0911)[_0xc75d('0xc')](function(_0x5898f6){return _0x5898f6;});}return null;};}function removeEntity(_0x46228e){return function(_0x2313be){if(_0x2313be){return _0x2313be[_0xc75d('0xd')]()[_0xc75d('0xc')](function(){_0x46228e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1208d7){return function(_0x182f56){if(!_0x182f56){_0x1208d7[_0xc75d('0xe')](0x194);}return _0x182f56;};}function handleError(_0x1b0bfc,_0x1d49b9){_0x1d49b9=_0x1d49b9||0x1f4;return function(_0x331d68){logger[_0xc75d('0xf')](_0x331d68['stack']);if(_0x331d68[_0xc75d('0x10')]){delete _0x331d68[_0xc75d('0x10')];}_0x1b0bfc[_0xc75d('0x3')](_0x1d49b9)[_0xc75d('0x11')](_0x331d68);};}exports[_0xc75d('0x12')]=function(_0x47f6b6,_0x319437){var _0x50e44f={},_0x54f089={},_0x3933c5={'count':0x0,'rows':[]};var _0x431948=_[_0xc75d('0x13')](db[_0xc75d('0x14')][_0xc75d('0x15')],function(_0x576117){return{'name':_0x576117[_0xc75d('0x16')],'type':_0x576117[_0xc75d('0x17')][_0xc75d('0x18')]};});_0x54f089[_0xc75d('0x19')]=_[_0xc75d('0x13')](_0x431948,_0xc75d('0x10'));_0x54f089[_0xc75d('0x1a')]=_[_0xc75d('0x1b')](_0x47f6b6['query']);_0x54f089[_0xc75d('0x1c')]=_[_0xc75d('0x1d')](_0x54f089[_0xc75d('0x19')],_0x54f089[_0xc75d('0x1a')]);_0x50e44f['attributes']=_[_0xc75d('0x1d')](_0x54f089[_0xc75d('0x19')],qs[_0xc75d('0x1e')](_0x47f6b6[_0xc75d('0x1a')][_0xc75d('0x1e')]));_0x50e44f[_0xc75d('0x1f')]=_0x50e44f['attributes'][_0xc75d('0x20')]?_0x50e44f[_0xc75d('0x1f')]:_0x54f089['model'];if(!_0x47f6b6['query'][_0xc75d('0x21')](_0xc75d('0x22'))){_0x50e44f[_0xc75d('0x6')]=qs[_0xc75d('0x6')](_0x47f6b6[_0xc75d('0x1a')][_0xc75d('0x6')]);_0x50e44f['offset']=qs['offset'](_0x47f6b6[_0xc75d('0x1a')][_0xc75d('0x8')]);}_0x50e44f['order']=qs[_0xc75d('0x23')](_0x47f6b6[_0xc75d('0x1a')][_0xc75d('0x23')]);_0x50e44f[_0xc75d('0x24')]=qs['filters'](_[_0xc75d('0x25')](_0x47f6b6[_0xc75d('0x1a')],_0x54f089[_0xc75d('0x1c')]),_0x431948);if(_0x47f6b6['query']['filter']){_0x50e44f[_0xc75d('0x24')]=_[_0xc75d('0x26')](_0x50e44f['where'],{'$or':_[_0xc75d('0x13')](_0x431948,function(_0x1a660d){if(_0x1a660d[_0xc75d('0x17')]!==_0xc75d('0x27')){var _0x71df28={};_0x71df28[_0x1a660d[_0xc75d('0x10')]]={'$like':'%'+_0x47f6b6[_0xc75d('0x1a')][_0xc75d('0x28')]+'%'};return _0x71df28;}})});}_0x50e44f=_[_0xc75d('0x26')]({},_0x50e44f,_0x47f6b6[_0xc75d('0x29')]);var _0x232d17={'where':_0x50e44f[_0xc75d('0x24')]};return db[_0xc75d('0x14')]['count'](_0x232d17)[_0xc75d('0xc')](function(_0xa2294b){_0x3933c5[_0xc75d('0x7')]=_0xa2294b;if(_0x47f6b6[_0xc75d('0x1a')]['includeAll']){_0x50e44f[_0xc75d('0x2a')]=[{'attributes':['id',_0xc75d('0x10'),_0xc75d('0x2b'),'alias'],'model':db['User'],'as':'User'}];}return db['VoiceCallReport'][_0xc75d('0x2c')](_0x50e44f);})[_0xc75d('0xc')](function(_0x5b97d8){_0x3933c5[_0xc75d('0x2d')]=_0x5b97d8;return _0x3933c5;})[_0xc75d('0xc')](respondWithFilteredResult(_0x319437,_0x50e44f))[_0xc75d('0x2e')](handleError(_0x319437,null));};exports[_0xc75d('0x2f')]=function(_0x2b2686,_0x3bf55f){var _0x2c254d={'raw':!![],'where':{'id':_0x2b2686[_0xc75d('0x30')]['id']}},_0x3a2e54={};_0x3a2e54[_0xc75d('0x19')]=_['keys'](db['VoiceCallReport'][_0xc75d('0x15')]);_0x3a2e54[_0xc75d('0x1a')]=_[_0xc75d('0x1b')](_0x2b2686[_0xc75d('0x1a')]);_0x3a2e54[_0xc75d('0x1c')]=_['intersection'](_0x3a2e54[_0xc75d('0x19')],_0x3a2e54[_0xc75d('0x1a')]);_0x2c254d[_0xc75d('0x1f')]=_[_0xc75d('0x1d')](_0x3a2e54[_0xc75d('0x19')],qs['fields'](_0x2b2686[_0xc75d('0x1a')][_0xc75d('0x1e')]));_0x2c254d['attributes']=_0x2c254d['attributes'][_0xc75d('0x20')]?_0x2c254d[_0xc75d('0x1f')]:_0x3a2e54[_0xc75d('0x19')];if(_0x2b2686[_0xc75d('0x1a')][_0xc75d('0x31')]){_0x2c254d[_0xc75d('0x2a')]=[{'all':!![]}];}_0x2c254d=_[_0xc75d('0x26')]({},_0x2c254d,_0x2b2686['options']);return db[_0xc75d('0x14')][_0xc75d('0x32')](_0x2c254d)['then'](handleEntityNotFound(_0x3bf55f,null))['then'](respondWithResult(_0x3bf55f,null))[_0xc75d('0x2e')](handleError(_0x3bf55f,null));};exports[_0xc75d('0x33')]=function(_0xd0160b,_0x5cc989){return db[_0xc75d('0x14')][_0xc75d('0x33')](_0xd0160b[_0xc75d('0x34')],{})[_0xc75d('0xc')](respondWithResult(_0x5cc989,0xc9))[_0xc75d('0x2e')](handleError(_0x5cc989,null));};exports[_0xc75d('0xd')]=function(_0x54aa52,_0x5b8f37){return db[_0xc75d('0x14')][_0xc75d('0x32')]({'where':{'id':_0x54aa52[_0xc75d('0x30')]['id']}})[_0xc75d('0xc')](handleEntityNotFound(_0x5b8f37,null))[_0xc75d('0xc')](removeEntity(_0x5b8f37,null))[_0xc75d('0x2e')](handleError(_0x5b8f37,null));};exports[_0xc75d('0x35')]=function(_0x19f7a8,_0x2cf2b9){return db[_0xc75d('0x14')][_0xc75d('0x35')]()[_0xc75d('0xc')](respondWithResult(_0x2cf2b9,null))[_0xc75d('0x2e')](handleError(_0x2cf2b9,null));};function findForUpdate(_0x17a2a5){return db[_0xc75d('0x14')][_0xc75d('0x32')]({'where':{'uniqueid':_0x17a2a5[_0xc75d('0x30')]['id'],'UserId':{'$or':[null,_0x17a2a5[_0xc75d('0x36')]['id']]}}});}exports[_0xc75d('0xb')]=function(_0x587199,_0x3c64f4){if(_0x587199[_0xc75d('0x34')][_0xc75d('0x37')]){delete _0x587199['body']['uniqueid'];}return findForUpdate(_0x587199)[_0xc75d('0xc')](handleEntityNotFound(_0x3c64f4,null))['then'](saveUpdates(_0x587199['body'],null))[_0xc75d('0xc')](respondWithResult(_0x3c64f4,null))[_0xc75d('0x2e')](handleError(_0x3c64f4,null));};exports[_0xc75d('0x38')]=function(_0x35a973,_0x5b7393,_0x254ca6){if(_0x35a973['body'][_0xc75d('0x37')]){delete _0x35a973[_0xc75d('0x34')][_0xc75d('0x37')];}promiseRetry(function(_0x3fd1eb){return findForUpdate(_0x35a973)[_0xc75d('0xc')](function(_0xd68231){if(_0xd68231!==null){return _0xd68231;}else{_0x3fd1eb(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x3e0b23){if(!_0x3e0b23){return new Promise(function(_0x35e9cd){_0x35e9cd(handleEntityNotFound(_0x5b7393)());});}else{return _0x3e0b23['update'](_0x35a973[_0xc75d('0x34')])['then'](function(_0x240887){return respondWithResult(_0x5b7393)(_0x240887);});}},function(){handleEntityNotFound(_0x5b7393)();});}; \ No newline at end of file +var _0x7382=['json','offset','limit','undefined','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','alias','User','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','describe','params','user','uniqueid','updateWithRetry','../../components/parsers/qs','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7382,0x111));var _0x2738=function(_0x3aa766,_0x1a51db){_0x3aa766=_0x3aa766-0x0;var _0x7a76fc=_0x7382[_0x3aa766];return _0x7a76fc;};'use strict';var _=require('lodash');var qs=require(_0x2738('0x0'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x55fe9a,_0x2fde8c){_0x2fde8c=_0x2fde8c||0xc8;return function(_0x169d7d){if(_0x169d7d){return _0x55fe9a[_0x2738('0x1')](_0x2fde8c)[_0x2738('0x2')](_0x169d7d);}};}function respondWithFilteredResult(_0x2c58b2,_0x5bb77c){return function(_0x1958d2){if(_0x1958d2){var _0x2bc38a=typeof _0x5bb77c[_0x2738('0x3')]==='undefined'&&typeof _0x5bb77c[_0x2738('0x4')]===_0x2738('0x5');var _0x2ad7ef=_0x1958d2['count'];var _0x476864=_0x2bc38a?0x0:_0x5bb77c[_0x2738('0x3')];var _0x367172=_0x2bc38a?_0x1958d2['count']:_0x5bb77c[_0x2738('0x3')]+_0x5bb77c[_0x2738('0x4')];var _0x2eb3ab;if(_0x367172>=_0x2ad7ef){_0x367172=_0x2ad7ef;_0x2eb3ab=0xc8;}else{_0x2eb3ab=0xce;}_0x2c58b2['status'](_0x2eb3ab);return _0x2c58b2['set'](_0x2738('0x6'),_0x476864+'-'+_0x367172+'/'+_0x2ad7ef)[_0x2738('0x2')](_0x1958d2);}return null;};}function saveUpdates(_0xf9d319){return function(_0x217902){if(_0x217902){return _0x217902[_0x2738('0x7')](_0xf9d319)[_0x2738('0x8')](function(_0x144fb2){return _0x144fb2;});}return null;};}function removeEntity(_0x26af9d){return function(_0x3d43cb){if(_0x3d43cb){return _0x3d43cb[_0x2738('0x9')]()[_0x2738('0x8')](function(){_0x26af9d['status'](0xcc)[_0x2738('0xa')]();});}};}function handleEntityNotFound(_0x2c6cfa){return function(_0x4fe443){if(!_0x4fe443){_0x2c6cfa[_0x2738('0xb')](0x194);}return _0x4fe443;};}function handleError(_0x4f3c03,_0xba2b73){_0xba2b73=_0xba2b73||0x1f4;return function(_0x488209){logger[_0x2738('0xc')](_0x488209['stack']);if(_0x488209[_0x2738('0xd')]){delete _0x488209[_0x2738('0xd')];}_0x4f3c03[_0x2738('0x1')](_0xba2b73)[_0x2738('0xe')](_0x488209);};}exports[_0x2738('0xf')]=function(_0x1e0f57,_0x42685a){var _0x26049a={},_0x587bbc={},_0x4407c1={'count':0x0,'rows':[]};var _0x56a75b=_[_0x2738('0x10')](db[_0x2738('0x11')]['rawAttributes'],function(_0x5a1d61){return{'name':_0x5a1d61[_0x2738('0x12')],'type':_0x5a1d61[_0x2738('0x13')][_0x2738('0x14')]};});_0x587bbc[_0x2738('0x15')]=_[_0x2738('0x10')](_0x56a75b,_0x2738('0xd'));_0x587bbc[_0x2738('0x16')]=_[_0x2738('0x17')](_0x1e0f57[_0x2738('0x16')]);_0x587bbc[_0x2738('0x18')]=_[_0x2738('0x19')](_0x587bbc['model'],_0x587bbc[_0x2738('0x16')]);_0x26049a['attributes']=_['intersection'](_0x587bbc[_0x2738('0x15')],qs[_0x2738('0x1a')](_0x1e0f57[_0x2738('0x16')][_0x2738('0x1a')]));_0x26049a[_0x2738('0x1b')]=_0x26049a[_0x2738('0x1b')][_0x2738('0x1c')]?_0x26049a[_0x2738('0x1b')]:_0x587bbc['model'];if(!_0x1e0f57[_0x2738('0x16')]['hasOwnProperty'](_0x2738('0x1d'))){_0x26049a[_0x2738('0x4')]=qs['limit'](_0x1e0f57[_0x2738('0x16')][_0x2738('0x4')]);_0x26049a['offset']=qs['offset'](_0x1e0f57['query']['offset']);}_0x26049a[_0x2738('0x1e')]=qs[_0x2738('0x1f')](_0x1e0f57[_0x2738('0x16')][_0x2738('0x1f')]);_0x26049a[_0x2738('0x20')]=qs[_0x2738('0x18')](_['pick'](_0x1e0f57[_0x2738('0x16')],_0x587bbc[_0x2738('0x18')]),_0x56a75b);if(_0x1e0f57[_0x2738('0x16')][_0x2738('0x21')]){_0x26049a[_0x2738('0x20')]=_['merge'](_0x26049a[_0x2738('0x20')],{'$or':_[_0x2738('0x10')](_0x56a75b,function(_0x358617){if(_0x358617[_0x2738('0x13')]!==_0x2738('0x22')){var _0x5ec788={};_0x5ec788[_0x358617[_0x2738('0xd')]]={'$like':'%'+_0x1e0f57['query']['filter']+'%'};return _0x5ec788;}})});}_0x26049a=_[_0x2738('0x23')]({},_0x26049a,_0x1e0f57[_0x2738('0x24')]);var _0x2845af={'where':_0x26049a[_0x2738('0x20')]};return db['VoiceCallReport'][_0x2738('0x25')](_0x2845af)[_0x2738('0x8')](function(_0x3ac3c4){_0x4407c1[_0x2738('0x25')]=_0x3ac3c4;if(_0x1e0f57[_0x2738('0x16')]['includeAll']){_0x26049a['include']=[{'attributes':['id',_0x2738('0xd'),'fullname',_0x2738('0x26')],'model':db[_0x2738('0x27')],'as':_0x2738('0x27')}];}return db[_0x2738('0x11')][_0x2738('0x28')](_0x26049a);})[_0x2738('0x8')](function(_0x7ae2e5){_0x4407c1[_0x2738('0x29')]=_0x7ae2e5;return _0x4407c1;})[_0x2738('0x8')](respondWithFilteredResult(_0x42685a,_0x26049a))[_0x2738('0x2a')](handleError(_0x42685a,null));};exports[_0x2738('0x2b')]=function(_0x1e3931,_0xf86fa9){var _0x1feea2={'raw':!![],'where':{'id':_0x1e3931['params']['id']}},_0x259c5e={};_0x259c5e[_0x2738('0x15')]=_[_0x2738('0x17')](db[_0x2738('0x11')][_0x2738('0x2c')]);_0x259c5e[_0x2738('0x16')]=_[_0x2738('0x17')](_0x1e3931['query']);_0x259c5e[_0x2738('0x18')]=_[_0x2738('0x19')](_0x259c5e[_0x2738('0x15')],_0x259c5e['query']);_0x1feea2[_0x2738('0x1b')]=_[_0x2738('0x19')](_0x259c5e['model'],qs['fields'](_0x1e3931[_0x2738('0x16')]['fields']));_0x1feea2[_0x2738('0x1b')]=_0x1feea2[_0x2738('0x1b')][_0x2738('0x1c')]?_0x1feea2[_0x2738('0x1b')]:_0x259c5e[_0x2738('0x15')];if(_0x1e3931[_0x2738('0x16')][_0x2738('0x2d')]){_0x1feea2[_0x2738('0x2e')]=[{'all':!![]}];}_0x1feea2=_['merge']({},_0x1feea2,_0x1e3931[_0x2738('0x24')]);return db[_0x2738('0x11')][_0x2738('0x2f')](_0x1feea2)[_0x2738('0x8')](handleEntityNotFound(_0xf86fa9,null))[_0x2738('0x8')](respondWithResult(_0xf86fa9,null))[_0x2738('0x2a')](handleError(_0xf86fa9,null));};exports[_0x2738('0x30')]=function(_0x18d283,_0xf37380){return db[_0x2738('0x11')][_0x2738('0x30')](_0x18d283[_0x2738('0x31')],{})[_0x2738('0x8')](respondWithResult(_0xf37380,0xc9))[_0x2738('0x2a')](handleError(_0xf37380,null));};exports[_0x2738('0x9')]=function(_0x9696b3,_0x171dbd){return db['VoiceCallReport'][_0x2738('0x2f')]({'where':{'id':_0x9696b3['params']['id']}})['then'](handleEntityNotFound(_0x171dbd,null))[_0x2738('0x8')](removeEntity(_0x171dbd,null))[_0x2738('0x2a')](handleError(_0x171dbd,null));};exports['describe']=function(_0x3c4488,_0x37ed5c){return db[_0x2738('0x11')][_0x2738('0x32')]()[_0x2738('0x8')](respondWithResult(_0x37ed5c,null))['catch'](handleError(_0x37ed5c,null));};function findForUpdate(_0x4730e6){return db[_0x2738('0x11')][_0x2738('0x2f')]({'where':{'uniqueid':_0x4730e6[_0x2738('0x33')]['id'],'UserId':{'$or':[null,_0x4730e6[_0x2738('0x34')]['id']]}}});}exports[_0x2738('0x7')]=function(_0x18e7b0,_0x43b6d2){if(_0x18e7b0[_0x2738('0x31')][_0x2738('0x35')]){delete _0x18e7b0[_0x2738('0x31')][_0x2738('0x35')];}return findForUpdate(_0x18e7b0)['then'](handleEntityNotFound(_0x43b6d2,null))['then'](saveUpdates(_0x18e7b0['body'],null))[_0x2738('0x8')](respondWithResult(_0x43b6d2,null))[_0x2738('0x2a')](handleError(_0x43b6d2,null));};exports[_0x2738('0x36')]=function(_0x22849d,_0x67ebac,_0x2ffa3b){if(_0x22849d[_0x2738('0x31')][_0x2738('0x35')]){delete _0x22849d['body'][_0x2738('0x35')];}promiseRetry(function(_0x287c25){return findForUpdate(_0x22849d)[_0x2738('0x8')](function(_0x107058){if(_0x107058!==null){return _0x107058;}else{_0x287c25(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x1e7e38){if(!_0x1e7e38){return new Promise(function(_0x192ade){_0x192ade(handleEntityNotFound(_0x67ebac)());});}else{return _0x1e7e38['update'](_0x22849d[_0x2738('0x31')])[_0x2738('0x8')](function(_0x3c5bcc){return respondWithResult(_0x67ebac)(_0x3c5bcc);});}},function(){handleEntityNotFound(_0x67ebac)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 76565eb..974bc3e 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 _0xca04=['../../config/environment','./voiceCallReport.attributes','VoiceCallReport','uniqueid','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2893bc,_0x5e1b7d){var _0x468114=function(_0x4a574e){while(--_0x4a574e){_0x2893bc['push'](_0x2893bc['shift']());}};_0x468114(++_0x5e1b7d);}(_0xca04,0xa4));var _0x4ca0=function(_0x409352,_0x5e7d69){_0x409352=_0x409352-0x0;var _0x5008e0=_0xca04[_0x409352];return _0x5008e0;};'use strict';var _=require(_0x4ca0('0x0'));var util=require('util');var logger=require(_0x4ca0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4ca0('0x2'));var rp=require(_0x4ca0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ca0('0x4'));var attributes=require(_0x4ca0('0x5'));module['exports']=function(_0x5c8a12,_0x2f98c1){return _0x5c8a12['define'](_0x4ca0('0x6'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4ca0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4deb=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x1ea277,_0x34218c){var _0x161aad=function(_0x30252e){while(--_0x30252e){_0x1ea277['push'](_0x1ea277['shift']());}};_0x161aad(++_0x34218c);}(_0x4deb,0x17a));var _0xb4de=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x4deb[_0x15b192];return _0x396e73;};'use strict';var _=require(_0xb4de('0x0'));var util=require(_0xb4de('0x1'));var logger=require('../../config/logger')(_0xb4de('0x2'));var moment=require(_0xb4de('0x3'));var BPromise=require(_0xb4de('0x4'));var rp=require(_0xb4de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4de('0x6'));var config=require(_0xb4de('0x7'));var attributes=require(_0xb4de('0x8'));module[_0xb4de('0x9')]=function(_0x58d73e,_0xa4b739){return _0x58d73e[_0xb4de('0xa')](_0xb4de('0xb'),attributes,{'tableName':_0xb4de('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb4de('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a113a34..d99bbb7 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 _0xc09b=['message','catch','GetVoiceCallReport','findAll','options','attributes','limit','map','include','model','stringify','VoiceCallReport','create','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x217472,_0xaf9c62){var _0x43a0fc=function(_0x829dad){while(--_0x829dad){_0x217472['push'](_0x217472['shift']());}};_0x43a0fc(++_0xaf9c62);}(_0xc09b,0xcb));var _0xbc09=function(_0x1f89fa,_0x120078){_0x1f89fa=_0x1f89fa-0x0;var _0x3e78f0=_0xc09b[_0x1f89fa];return _0x3e78f0;};'use strict';var _=require(_0xbc09('0x0'));var util=require(_0xbc09('0x1'));var moment=require(_0xbc09('0x2'));var BPromise=require(_0xbc09('0x3'));var rs=require(_0xbc09('0x4'));var fs=require('fs');var Redis=require(_0xbc09('0x5'));var db=require(_0xbc09('0x6'))['db'];var utils=require(_0xbc09('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc09('0x8')][_0xbc09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b684f,_0x1f17b0,_0x59b383){return new BPromise(function(_0xcf7112,_0x3e0de1){return client[_0xbc09('0xa')](_0x2b684f,_0x59b383)[_0xbc09('0xb')](function(_0x3309d4){logger[_0xbc09('0xc')](_0xbc09('0xd'),_0x1f17b0,_0xbc09('0xe'));logger[_0xbc09('0xf')](_0xbc09('0x10'),_0x1f17b0,'request\x20sent',JSON['stringify'](_0x3309d4));if(_0x3309d4[_0xbc09('0x11')]){if(_0x3309d4['error'][_0xbc09('0x12')]===0x1f4){logger[_0xbc09('0x11')](_0xbc09('0xd'),_0x1f17b0,_0x3309d4[_0xbc09('0x11')]['message']);return _0x3e0de1(_0x3309d4[_0xbc09('0x11')]['message']);}logger[_0xbc09('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1f17b0,_0x3309d4[_0xbc09('0x11')]['message']);return _0xcf7112(_0x3309d4[_0xbc09('0x11')][_0xbc09('0x13')]);}else{logger[_0xbc09('0xc')](_0xbc09('0xd'),_0x1f17b0,_0xbc09('0xe'));_0xcf7112(_0x3309d4['result']['message']);}})[_0xbc09('0x14')](function(_0x5d4b2e){logger[_0xbc09('0x11')](_0xbc09('0xd'),_0x1f17b0,_0x5d4b2e);_0x3e0de1(_0x5d4b2e);});});}exports[_0xbc09('0x15')]=function(_0x126980){var _0x1ade73=this;return new Promise(function(_0x3f8d03,_0x123828){return db['VoiceCallReport'][_0xbc09('0x16')]({'raw':_0x126980[_0xbc09('0x17')]?_0x126980[_0xbc09('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x126980[_0xbc09('0x17')]?_0x126980[_0xbc09('0x17')]['where']||null:null,'attributes':_0x126980[_0xbc09('0x17')]?_0x126980[_0xbc09('0x17')][_0xbc09('0x18')]||null:null,'limit':_0x126980[_0xbc09('0x17')]?_0x126980['options'][_0xbc09('0x19')]||null:null,'include':_0x126980[_0xbc09('0x17')]?_0x126980[_0xbc09('0x17')]['include']?_[_0xbc09('0x1a')](_0x126980[_0xbc09('0x17')][_0xbc09('0x1b')],function(_0x10353e){return{'model':db[_0x10353e[_0xbc09('0x1c')]],'as':_0x10353e['as'],'attributes':_0x10353e[_0xbc09('0x18')],'include':_0x10353e[_0xbc09('0x1b')]?_['map'](_0x10353e[_0xbc09('0x1b')],function(_0x307cd2){return{'model':db[_0x307cd2[_0xbc09('0x1c')]],'as':_0x307cd2['as'],'attributes':_0x307cd2[_0xbc09('0x18')],'include':_0x307cd2[_0xbc09('0x1b')]?_[_0xbc09('0x1a')](_0x307cd2[_0xbc09('0x1b')],function(_0xab644c){return{'model':db[_0xab644c['model']],'as':_0xab644c['as'],'attributes':_0xab644c[_0xbc09('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbc09('0xb')](function(_0x93e8fa){logger[_0xbc09('0xc')](_0xbc09('0x15'),_0x126980);logger[_0xbc09('0xf')](_0xbc09('0x15'),_0x126980,JSON[_0xbc09('0x1d')](_0x93e8fa));_0x3f8d03(_0x93e8fa);})[_0xbc09('0x14')](function(_0x1f11fe){logger[_0xbc09('0x11')](_0xbc09('0x15'),_0x1f11fe[_0xbc09('0x13')],_0x126980);_0x123828(_0x1ade73[_0xbc09('0x11')](0x1f4,_0x1f11fe[_0xbc09('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x43025c){var _0x5e4b55=this;return new Promise(function(_0x3c458c,_0x1eb914){return db[_0xbc09('0x1e')][_0xbc09('0x1f')](_0x43025c['body'],{'raw':_0x43025c[_0xbc09('0x17')]?_0x43025c[_0xbc09('0x17')][_0xbc09('0x20')]===undefined?!![]:![]:!![]})[_0xbc09('0xb')](function(_0x3472b4){logger[_0xbc09('0xc')](_0xbc09('0x21'),_0x43025c);logger['debug'](_0xbc09('0x21'),_0x43025c,JSON[_0xbc09('0x1d')](_0x3472b4));_0x3c458c(_0x3472b4);})[_0xbc09('0x14')](function(_0x3cc5ec){logger[_0xbc09('0x11')](_0xbc09('0x21'),_0x3cc5ec[_0xbc09('0x13')],_0x43025c);_0x1eb914(_0x5e4b55[_0xbc09('0x11')](0x1f4,_0x3cc5ec[_0xbc09('0x13')]));});});};exports[_0xbc09('0x22')]=function(_0x48fed8){var _0x22981e=this;return new Promise(function(_0x4bc266,_0x3f6f3c){return db[_0xbc09('0x1e')][_0xbc09('0x23')](_0x48fed8['body'],{'raw':_0x48fed8[_0xbc09('0x17')]?_0x48fed8[_0xbc09('0x17')][_0xbc09('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48fed8[_0xbc09('0x17')]?_0x48fed8[_0xbc09('0x17')][_0xbc09('0x24')]||null:null,'attributes':_0x48fed8[_0xbc09('0x17')]?_0x48fed8[_0xbc09('0x17')]['attributes']||null:null,'limit':_0x48fed8[_0xbc09('0x17')]?_0x48fed8[_0xbc09('0x17')][_0xbc09('0x19')]||null:null})['then'](function(_0x70da3){logger[_0xbc09('0xc')](_0xbc09('0x22'),_0x48fed8);logger[_0xbc09('0xf')](_0xbc09('0x22'),_0x48fed8,JSON[_0xbc09('0x1d')](_0x70da3));_0x4bc266(_0x70da3);})[_0xbc09('0x14')](function(_0x1233f1){logger[_0xbc09('0x11')](_0xbc09('0x22'),_0x1233f1['message'],_0x48fed8);_0x3f6f3c(_0x22981e[_0xbc09('0x11')](0x1f4,_0x1233f1[_0xbc09('0x13')]));});});}; \ No newline at end of file +var _0xa43a=['../../config/logger','rpc','../../config/environment','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','map','attributes','model','CreateVoiceCallReport','body','stringify','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4b8dc6,_0x57b059){var _0x15cde6=function(_0xb171ed){while(--_0xb171ed){_0x4b8dc6['push'](_0x4b8dc6['shift']());}};_0x15cde6(++_0x57b059);}(_0xa43a,0xe3));var _0xaa43=function(_0x2054d5,_0x4bd832){_0x2054d5=_0x2054d5-0x0;var _0x29c6a9=_0xa43a[_0x2054d5];return _0x29c6a9;};'use strict';var _=require(_0xaa43('0x0'));var util=require(_0xaa43('0x1'));var moment=require(_0xaa43('0x2'));var BPromise=require(_0xaa43('0x3'));var rs=require(_0xaa43('0x4'));var fs=require('fs');var Redis=require(_0xaa43('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa43('0x6'));var logger=require(_0xaa43('0x7'))(_0xaa43('0x8'));var config=require(_0xaa43('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaa43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f0558,_0x1107d1,_0x3ed199){return new BPromise(function(_0x51e1cf,_0x395b45){return client[_0xaa43('0xb')](_0x3f0558,_0x3ed199)[_0xaa43('0xc')](function(_0x4e2001){logger['info'](_0xaa43('0xd'),_0x1107d1,_0xaa43('0xe'));logger[_0xaa43('0xf')](_0xaa43('0x10'),_0x1107d1,_0xaa43('0xe'),JSON['stringify'](_0x4e2001));if(_0x4e2001[_0xaa43('0x11')]){if(_0x4e2001[_0xaa43('0x11')][_0xaa43('0x12')]===0x1f4){logger[_0xaa43('0x11')](_0xaa43('0xd'),_0x1107d1,_0x4e2001['error']['message']);return _0x395b45(_0x4e2001['error']['message']);}logger[_0xaa43('0x11')](_0xaa43('0xd'),_0x1107d1,_0x4e2001['error'][_0xaa43('0x13')]);return _0x51e1cf(_0x4e2001['error'][_0xaa43('0x13')]);}else{logger[_0xaa43('0x14')](_0xaa43('0xd'),_0x1107d1,_0xaa43('0xe'));_0x51e1cf(_0x4e2001[_0xaa43('0x15')]['message']);}})[_0xaa43('0x16')](function(_0xb91259){logger[_0xaa43('0x11')](_0xaa43('0xd'),_0x1107d1,_0xb91259);_0x395b45(_0xb91259);});});}exports[_0xaa43('0x17')]=function(_0x454000){var _0x315c34=this;return new Promise(function(_0x29c58b,_0x8c130){return db[_0xaa43('0x18')][_0xaa43('0x19')]({'raw':_0x454000[_0xaa43('0x1a')]?_0x454000[_0xaa43('0x1a')][_0xaa43('0x1b')]===undefined?!![]:![]:!![],'where':_0x454000['options']?_0x454000[_0xaa43('0x1a')]['where']||null:null,'attributes':_0x454000[_0xaa43('0x1a')]?_0x454000[_0xaa43('0x1a')]['attributes']||null:null,'limit':_0x454000[_0xaa43('0x1a')]?_0x454000['options'][_0xaa43('0x1c')]||null:null,'include':_0x454000['options']?_0x454000[_0xaa43('0x1a')][_0xaa43('0x1d')]?_[_0xaa43('0x1e')](_0x454000[_0xaa43('0x1a')][_0xaa43('0x1d')],function(_0x1f02de){return{'model':db[_0x1f02de['model']],'as':_0x1f02de['as'],'attributes':_0x1f02de[_0xaa43('0x1f')],'include':_0x1f02de[_0xaa43('0x1d')]?_[_0xaa43('0x1e')](_0x1f02de[_0xaa43('0x1d')],function(_0xe61c66){return{'model':db[_0xe61c66[_0xaa43('0x20')]],'as':_0xe61c66['as'],'attributes':_0xe61c66['attributes'],'include':_0xe61c66[_0xaa43('0x1d')]?_[_0xaa43('0x1e')](_0xe61c66[_0xaa43('0x1d')],function(_0x42ee6b){return{'model':db[_0x42ee6b[_0xaa43('0x20')]],'as':_0x42ee6b['as'],'attributes':_0x42ee6b['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa43('0xc')](function(_0xf6bac3){logger['info'](_0xaa43('0x17'),_0x454000);logger[_0xaa43('0xf')]('GetVoiceCallReport',_0x454000,JSON['stringify'](_0xf6bac3));_0x29c58b(_0xf6bac3);})[_0xaa43('0x16')](function(_0x423336){logger['error']('GetVoiceCallReport',_0x423336[_0xaa43('0x13')],_0x454000);_0x8c130(_0x315c34['error'](0x1f4,_0x423336[_0xaa43('0x13')]));});});};exports[_0xaa43('0x21')]=function(_0x18e1c5){var _0x2f0db6=this;return new Promise(function(_0x20e478,_0x4326ec){return db['VoiceCallReport']['create'](_0x18e1c5[_0xaa43('0x22')],{'raw':_0x18e1c5[_0xaa43('0x1a')]?_0x18e1c5[_0xaa43('0x1a')][_0xaa43('0x1b')]===undefined?!![]:![]:!![]})[_0xaa43('0xc')](function(_0x176e3a){logger[_0xaa43('0x14')]('CreateVoiceCallReport',_0x18e1c5);logger[_0xaa43('0xf')](_0xaa43('0x21'),_0x18e1c5,JSON[_0xaa43('0x23')](_0x176e3a));_0x20e478(_0x176e3a);})[_0xaa43('0x16')](function(_0x3a0eff){logger[_0xaa43('0x11')]('CreateVoiceCallReport',_0x3a0eff[_0xaa43('0x13')],_0x18e1c5);_0x4326ec(_0x2f0db6['error'](0x1f4,_0x3a0eff[_0xaa43('0x13')]));});});};exports[_0xaa43('0x24')]=function(_0x1676d0){var _0x4938c2=this;return new Promise(function(_0x53d3dd,_0x3ef44e){return db[_0xaa43('0x18')][_0xaa43('0x25')](_0x1676d0[_0xaa43('0x22')],{'raw':_0x1676d0[_0xaa43('0x1a')]?_0x1676d0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1676d0[_0xaa43('0x1a')]?_0x1676d0[_0xaa43('0x1a')][_0xaa43('0x26')]||null:null,'attributes':_0x1676d0[_0xaa43('0x1a')]?_0x1676d0[_0xaa43('0x1a')][_0xaa43('0x1f')]||null:null,'limit':_0x1676d0['options']?_0x1676d0[_0xaa43('0x1a')]['limit']||null:null})[_0xaa43('0xc')](function(_0x14545e){logger[_0xaa43('0x14')](_0xaa43('0x24'),_0x1676d0);logger[_0xaa43('0xf')]('UpdateVoiceCallReport',_0x1676d0,JSON[_0xaa43('0x23')](_0x14545e));_0x53d3dd(_0x14545e);})['catch'](function(_0x2f11d9){logger[_0xaa43('0x11')](_0xaa43('0x24'),_0x2f11d9[_0xaa43('0x13')],_0x1676d0);_0x3ef44e(_0x4938c2[_0xaa43('0x11')](0x1f4,_0x2f11d9[_0xaa43('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f6976ff..d9253ab 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 _0xd740=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','./voiceChanSpy.controller'];(function(_0x1780b0,_0x304ccc){var _0x7a41be=function(_0x4e1dfa){while(--_0x4e1dfa){_0x1780b0['push'](_0x1780b0['shift']());}};_0x7a41be(++_0x304ccc);}(_0xd740,0x1a9));var _0x0d74=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0xd740[_0x12aaee];return _0x37c350;};'use strict';var multer=require(_0x0d74('0x0'));var util=require('util');var path=require(_0x0d74('0x1'));var timeout=require(_0x0d74('0x2'));var express=require(_0x0d74('0x3'));var router=express[_0x0d74('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0d74('0x5'));var config=require('../../config/environment');var controller=require(_0x0d74('0x6'));router[_0x0d74('0x7')]('/',auth[_0x0d74('0x8')](),controller[_0x0d74('0x9')]);router[_0x0d74('0x7')](_0x0d74('0xa'),auth[_0x0d74('0x8')](),controller['show']);router[_0x0d74('0xb')]('/',auth['isAuthenticated'](),controller[_0x0d74('0xc')]);router['put'](_0x0d74('0xa'),auth[_0x0d74('0x8')](),controller[_0x0d74('0xd')]);router[_0x0d74('0xe')](_0x0d74('0xa'),auth[_0x0d74('0x8')](),controller[_0x0d74('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9299=['put','delete','util','path','connect-timeout','Router','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','post','create'];(function(_0x3a2069,_0x499edc){var _0x5a3d0a=function(_0x4881ef){while(--_0x4881ef){_0x3a2069['push'](_0x3a2069['shift']());}};_0x5a3d0a(++_0x499edc);}(_0x9299,0x106));var _0x9929=function(_0x149f4c,_0x3c5cce){_0x149f4c=_0x149f4c-0x0;var _0x277fe7=_0x9299[_0x149f4c];return _0x277fe7;};'use strict';var multer=require('multer');var util=require(_0x9929('0x0'));var path=require(_0x9929('0x1'));var timeout=require(_0x9929('0x2'));var express=require('express');var router=express[_0x9929('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9929('0x4'));var controller=require(_0x9929('0x5'));router['get']('/',auth[_0x9929('0x6')](),controller[_0x9929('0x7')]);router[_0x9929('0x8')]('/:id',auth[_0x9929('0x6')](),controller['show']);router[_0x9929('0x9')]('/',auth[_0x9929('0x6')](),controller[_0x9929('0xa')]);router[_0x9929('0xb')]('/:id',auth[_0x9929('0x6')](),controller['update']);router[_0x9929('0xc')]('/:id',auth[_0x9929('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7721ab7..96b2e03 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 _0xc730=['exports','STRING','name','join','getDataValue','options','split','BOOLEAN'];(function(_0x463a6e,_0x1b47b5){var _0x51d8c6=function(_0x21f507){while(--_0x21f507){_0x463a6e['push'](_0x463a6e['shift']());}};_0x51d8c6(++_0x1b47b5);}(_0xc730,0xd0));var _0x0c73=function(_0x5c49bc,_0x4672b0){_0x5c49bc=_0x5c49bc-0x0;var _0x4c1d44=_0xc730[_0x5c49bc];return _0x4c1d44;};'use strict';var Sequelize=require('sequelize');module[_0x0c73('0x0')]={'name':{'type':Sequelize[_0x0c73('0x1')]},'prefix':{'type':Sequelize[_0x0c73('0x1')],'unique':_0x0c73('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xdf0666){this['setDataValue']('options',_0xdf0666?_0xdf0666[_0x0c73('0x3')](''):[]);},'get':function(){return this[_0x0c73('0x4')](_0x0c73('0x5'))?this[_0x0c73('0x4')](_0x0c73('0x5'))[_0x0c73('0x6')](''):[];}},'auth':{'type':Sequelize[_0x0c73('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0c73('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda64=['split','BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x741334,_0x4dadd8){var _0x11f9e0=function(_0x96e2a5){while(--_0x96e2a5){_0x741334['push'](_0x741334['shift']());}};_0x11f9e0(++_0x4dadd8);}(_0xda64,0xd1));var _0x4da6=function(_0x2ba60c,_0x1c0221){_0x2ba60c=_0x2ba60c-0x0;var _0x2176b2=_0xda64[_0x2ba60c];return _0x2176b2;};'use strict';var Sequelize=require(_0x4da6('0x0'));module['exports']={'name':{'type':Sequelize[_0x4da6('0x1')]},'prefix':{'type':Sequelize[_0x4da6('0x1')],'unique':_0x4da6('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x152fcd){this[_0x4da6('0x3')](_0x4da6('0x4'),_0x152fcd?_0x152fcd[_0x4da6('0x5')](''):[]);},'get':function(){return this[_0x4da6('0x6')]('options')?this[_0x4da6('0x6')](_0x4da6('0x4'))[_0x4da6('0x7')](''):[];}},'auth':{'type':Sequelize[_0x4da6('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x4da6('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4da6('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 29d52cd..d4d3337 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 _0x9bb4=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','ChanSpies','UserProfileResource','destroy','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x3979d2,_0x1eb48c){var _0x4a402b=function(_0x1ea2be){while(--_0x1ea2be){_0x3979d2['push'](_0x3979d2['shift']());}};_0x4a402b(++_0x1eb48c);}(_0x9bb4,0xd5));var _0x49bb=function(_0x21aeb9,_0x57ebad){_0x21aeb9=_0x21aeb9-0x0;var _0x32cf0e=_0x9bb4[_0x21aeb9];return _0x32cf0e;};'use strict';var emlformat=require(_0x49bb('0x0'));var rimraf=require(_0x49bb('0x1'));var zipdir=require(_0x49bb('0x2'));var jsonpatch=require(_0x49bb('0x3'));var rp=require(_0x49bb('0x4'));var moment=require(_0x49bb('0x5'));var BPromise=require(_0x49bb('0x6'));var Mustache=require(_0x49bb('0x7'));var util=require(_0x49bb('0x8'));var path=require('path');var sox=require(_0x49bb('0x9'));var csv=require(_0x49bb('0xa'));var ejs=require(_0x49bb('0xb'));var fs=require('fs');var fs_extra=require(_0x49bb('0xc'));var _=require('lodash');var squel=require(_0x49bb('0xd'));var crypto=require(_0x49bb('0xe'));var jsforce=require(_0x49bb('0xf'));var deskjs=require(_0x49bb('0x10'));var toCsv=require(_0x49bb('0xa'));var querystring=require('querystring');var Papa=require(_0x49bb('0x11'));var Redis=require('ioredis');var authService=require(_0x49bb('0x12'));var qs=require(_0x49bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49bb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x49bb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x49bb('0x16'));var db=require(_0x49bb('0x17'))['db'];function respondWithStatusCode(_0xfab080,_0x3b85fc){_0x3b85fc=_0x3b85fc||0xcc;return function(_0x1ff6d1){if(_0x1ff6d1){return _0xfab080[_0x49bb('0x18')](_0x3b85fc);}return _0xfab080[_0x49bb('0x19')](_0x3b85fc)[_0x49bb('0x1a')]();};}function respondWithResult(_0x3beb36,_0x59472f){_0x59472f=_0x59472f||0xc8;return function(_0x13c850){if(_0x13c850){return _0x3beb36['status'](_0x59472f)[_0x49bb('0x1b')](_0x13c850);}};}function respondWithFilteredResult(_0x1f7573,_0x1f0210){return function(_0x230f20){if(_0x230f20){var _0x145d52=typeof _0x1f0210[_0x49bb('0x1c')]===_0x49bb('0x1d')&&typeof _0x1f0210[_0x49bb('0x1e')]==='undefined';var _0x2d76be=_0x230f20[_0x49bb('0x1f')];var _0x5b45c0=_0x145d52?0x0:_0x1f0210[_0x49bb('0x1c')];var _0x3d41f2=_0x145d52?_0x230f20['count']:_0x1f0210[_0x49bb('0x1c')]+_0x1f0210[_0x49bb('0x1e')];var _0x4af5e0;if(_0x3d41f2>=_0x2d76be){_0x3d41f2=_0x2d76be;_0x4af5e0=0xc8;}else{_0x4af5e0=0xce;}_0x1f7573[_0x49bb('0x19')](_0x4af5e0);return _0x1f7573[_0x49bb('0x20')]('Content-Range',_0x5b45c0+'-'+_0x3d41f2+'/'+_0x2d76be)[_0x49bb('0x1b')](_0x230f20);}return null;};}function patchUpdates(_0x5387ed){return function(_0x1728e9){try{jsonpatch['apply'](_0x1728e9,_0x5387ed,!![]);}catch(_0x47918a){return BPromise[_0x49bb('0x21')](_0x47918a);}return _0x1728e9['save']();};}function saveUpdates(_0x5b18f0,_0x16b8fa){return function(_0x1ade8b){if(_0x1ade8b){return _0x1ade8b[_0x49bb('0x22')](_0x5b18f0)[_0x49bb('0x23')](function(_0x4f2764){return _0x4f2764;});}return null;};}function removeEntity(_0x490c3e,_0x5cacdb){return function(_0x4eae24){if(_0x4eae24){return _0x4eae24['destroy']()[_0x49bb('0x23')](function(){var _0x570847=_0x4eae24['get']({'plain':!![]});var _0x6dac61=_0x49bb('0x24');return db[_0x49bb('0x25')][_0x49bb('0x26')]({'where':{'type':_0x6dac61,'resourceId':_0x570847['id']}})[_0x49bb('0x23')](function(){return _0x4eae24;});})['then'](function(){_0x490c3e[_0x49bb('0x19')](0xcc)[_0x49bb('0x1a')]();});}};}function handleEntityNotFound(_0x1a6afb,_0x712959){return function(_0x5370d7){if(!_0x5370d7){_0x1a6afb[_0x49bb('0x18')](0x194);}return _0x5370d7;};}function handleError(_0x3d025d,_0x3985a6){_0x3985a6=_0x3985a6||0x1f4;return function(_0x47540c){logger['error'](_0x47540c[_0x49bb('0x27')]);if(_0x47540c[_0x49bb('0x28')]){delete _0x47540c[_0x49bb('0x28')];}_0x3d025d[_0x49bb('0x19')](_0x3985a6)['send'](_0x47540c);};}exports[_0x49bb('0x29')]=function(_0x1537ef,_0x5cd7c2){var _0x38108d={},_0x56b65b={},_0x2fbea2={'count':0x0,'rows':[]};var _0x242371=_['map'](db[_0x49bb('0x2a')][_0x49bb('0x2b')],function(_0x521e09){return{'name':_0x521e09[_0x49bb('0x2c')],'type':_0x521e09[_0x49bb('0x2d')][_0x49bb('0x2e')]};});_0x56b65b[_0x49bb('0x2f')]=_[_0x49bb('0x30')](_0x242371,_0x49bb('0x28'));_0x56b65b[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x1537ef['query']);_0x56b65b[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x56b65b[_0x49bb('0x2f')],_0x56b65b[_0x49bb('0x31')]);_0x38108d['attributes']=_[_0x49bb('0x34')](_0x56b65b['model'],qs[_0x49bb('0x35')](_0x1537ef['query'][_0x49bb('0x35')]));_0x38108d['attributes']=_0x38108d[_0x49bb('0x36')][_0x49bb('0x37')]?_0x38108d['attributes']:_0x56b65b['model'];if(!_0x1537ef['query']['hasOwnProperty']('nolimit')){_0x38108d[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x1537ef[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x38108d[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x1537ef[_0x49bb('0x31')]['offset']);}_0x38108d['order']=qs[_0x49bb('0x38')](_0x1537ef[_0x49bb('0x31')]['sort']);_0x38108d[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_['pick'](_0x1537ef['query'],_0x56b65b[_0x49bb('0x33')]),_0x242371);if(_0x1537ef['query'][_0x49bb('0x3a')]){_0x38108d[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x38108d[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x242371,function(_0x72d90e){if(_0x72d90e[_0x49bb('0x2d')]!==_0x49bb('0x3c')){var _0x783852={};_0x783852[_0x72d90e[_0x49bb('0x28')]]={'$like':'%'+_0x1537ef[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x783852;}})});}_0x38108d=_[_0x49bb('0x3b')]({},_0x38108d,_0x1537ef[_0x49bb('0x3d')]);var _0x25c70e={'where':_0x38108d[_0x49bb('0x39')]};return db[_0x49bb('0x2a')][_0x49bb('0x1f')](_0x25c70e)[_0x49bb('0x23')](function(_0x41b969){_0x2fbea2[_0x49bb('0x1f')]=_0x41b969;if(_0x1537ef[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x38108d['include']=[{'all':!![]}];}return db[_0x49bb('0x2a')]['findAll'](_0x38108d);})[_0x49bb('0x23')](function(_0x1eac94){_0x2fbea2[_0x49bb('0x3f')]=_0x1eac94;return _0x2fbea2;})[_0x49bb('0x23')](respondWithFilteredResult(_0x5cd7c2,_0x38108d))[_0x49bb('0x40')](handleError(_0x5cd7c2,null));};exports['show']=function(_0x445e15,_0x31aaee){var _0x138f2b={'raw':![],'where':{'id':_0x445e15[_0x49bb('0x41')]['id']}},_0x46912f={};_0x46912f['model']=_[_0x49bb('0x32')](db[_0x49bb('0x2a')][_0x49bb('0x2b')]);_0x46912f[_0x49bb('0x31')]=_['keys'](_0x445e15['query']);_0x46912f[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x46912f[_0x49bb('0x2f')],_0x46912f[_0x49bb('0x31')]);_0x138f2b[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x46912f['model'],qs[_0x49bb('0x35')](_0x445e15['query'][_0x49bb('0x35')]));_0x138f2b[_0x49bb('0x36')]=_0x138f2b['attributes']['length']?_0x138f2b['attributes']:_0x46912f['model'];if(_0x445e15[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x138f2b[_0x49bb('0x42')]=[{'all':!![]}];}_0x138f2b=_[_0x49bb('0x3b')]({},_0x138f2b,_0x445e15['options']);return db['VoiceChanSpy'][_0x49bb('0x43')](_0x138f2b)[_0x49bb('0x23')](handleEntityNotFound(_0x31aaee,null))[_0x49bb('0x23')](respondWithResult(_0x31aaee,null))[_0x49bb('0x40')](handleError(_0x31aaee,null));};exports['create']=function(_0x3b0f01,_0x382bc4){return db['VoiceChanSpy'][_0x49bb('0x44')](_0x3b0f01[_0x49bb('0x45')],{})[_0x49bb('0x23')](function(_0x46bb56){var _0xbad45a=_0x3b0f01['user'][_0x49bb('0x46')]({'plain':!![]});if(!_0xbad45a)throw new Error(_0x49bb('0x47'));if(_0xbad45a[_0x49bb('0x48')]==='user'){var _0x266abf=_0x46bb56[_0x49bb('0x46')]({'plain':!![]});var _0x144a77=_0x49bb('0x24');return db[_0x49bb('0x49')]['find']({'where':{'name':_0x144a77,'userProfileId':_0xbad45a[_0x49bb('0x4a')]},'raw':!![]})[_0x49bb('0x23')](function(_0xfae9ab){if(_0xfae9ab&&_0xfae9ab[_0x49bb('0x4b')]===0x0){return db[_0x49bb('0x25')][_0x49bb('0x44')]({'name':_0x266abf[_0x49bb('0x28')],'resourceId':_0x266abf['id'],'type':_0xfae9ab[_0x49bb('0x28')],'sectionId':_0xfae9ab['id']},{})[_0x49bb('0x23')](function(){return _0x46bb56;});}else{return _0x46bb56;}})[_0x49bb('0x40')](function(_0x2ead0f){logger['error'](_0x49bb('0x4c'),_0x2ead0f);throw _0x2ead0f;});}return _0x46bb56;})[_0x49bb('0x23')](respondWithResult(_0x382bc4,0xc9))[_0x49bb('0x40')](handleError(_0x382bc4,null));};exports[_0x49bb('0x22')]=function(_0x10327c,_0x3fc2f1){if(_0x10327c[_0x49bb('0x45')]['id']){delete _0x10327c[_0x49bb('0x45')]['id'];}return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x10327c[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x3fc2f1,null))[_0x49bb('0x23')](saveUpdates(_0x10327c[_0x49bb('0x45')],null))[_0x49bb('0x23')](respondWithResult(_0x3fc2f1,null))[_0x49bb('0x40')](handleError(_0x3fc2f1,null));};exports[_0x49bb('0x26')]=function(_0x2656e5,_0x1f76d1){return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x2656e5[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x1f76d1,null))['then'](removeEntity(_0x1f76d1,null))[_0x49bb('0x40')](handleError(_0x1f76d1,null));}; \ No newline at end of file +var _0x4a47=['catch','show','params','VoiceChanSpy','find','create','body','user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','destroy','then','get','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4a47,0xb5));var _0x74a4=function(_0xd5fd5c,_0x3e2a66){_0xd5fd5c=_0xd5fd5c-0x0;var _0x3b0663=_0x4a47[_0xd5fd5c];return _0x3b0663;};'use strict';var emlformat=require(_0x74a4('0x0'));var rimraf=require(_0x74a4('0x1'));var zipdir=require(_0x74a4('0x2'));var jsonpatch=require(_0x74a4('0x3'));var rp=require(_0x74a4('0x4'));var moment=require('moment');var BPromise=require(_0x74a4('0x5'));var Mustache=require('mustache');var util=require(_0x74a4('0x6'));var path=require(_0x74a4('0x7'));var sox=require('sox');var csv=require(_0x74a4('0x8'));var ejs=require(_0x74a4('0x9'));var fs=require('fs');var fs_extra=require(_0x74a4('0xa'));var _=require('lodash');var squel=require(_0x74a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x74a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x74a4('0x8'));var querystring=require(_0x74a4('0xd'));var Papa=require(_0x74a4('0xe'));var Redis=require(_0x74a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74a4('0x10'));var as=require(_0x74a4('0x11'));var hardwareService=require(_0x74a4('0x12'));var logger=require(_0x74a4('0x13'))('api');var utils=require(_0x74a4('0x14'));var config=require(_0x74a4('0x15'));var licenseUtil=require(_0x74a4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509c1e,_0x43ffb8){_0x43ffb8=_0x43ffb8||0xcc;return function(_0x20eb02){if(_0x20eb02){return _0x509c1e[_0x74a4('0x17')](_0x43ffb8);}return _0x509c1e[_0x74a4('0x18')](_0x43ffb8)[_0x74a4('0x19')]();};}function respondWithResult(_0x1208ac,_0x391be4){_0x391be4=_0x391be4||0xc8;return function(_0x1d6f41){if(_0x1d6f41){return _0x1208ac[_0x74a4('0x18')](_0x391be4)[_0x74a4('0x1a')](_0x1d6f41);}};}function respondWithFilteredResult(_0xef93e8,_0x28c364){return function(_0xc6796e){if(_0xc6796e){var _0x3c9fc9=typeof _0x28c364[_0x74a4('0x1b')]===_0x74a4('0x1c')&&typeof _0x28c364['limit']===_0x74a4('0x1c');var _0x252172=_0xc6796e[_0x74a4('0x1d')];var _0x2c9130=_0x3c9fc9?0x0:_0x28c364['offset'];var _0xf224ef=_0x3c9fc9?_0xc6796e[_0x74a4('0x1d')]:_0x28c364[_0x74a4('0x1b')]+_0x28c364[_0x74a4('0x1e')];var _0x49bfd7;if(_0xf224ef>=_0x252172){_0xf224ef=_0x252172;_0x49bfd7=0xc8;}else{_0x49bfd7=0xce;}_0xef93e8[_0x74a4('0x18')](_0x49bfd7);return _0xef93e8[_0x74a4('0x1f')]('Content-Range',_0x2c9130+'-'+_0xf224ef+'/'+_0x252172)[_0x74a4('0x1a')](_0xc6796e);}return null;};}function patchUpdates(_0x2d3075){return function(_0x5438d2){try{jsonpatch['apply'](_0x5438d2,_0x2d3075,!![]);}catch(_0x1da998){return BPromise[_0x74a4('0x20')](_0x1da998);}return _0x5438d2[_0x74a4('0x21')]();};}function saveUpdates(_0x1828d7,_0x484802){return function(_0x4139af){if(_0x4139af){return _0x4139af['update'](_0x1828d7)['then'](function(_0x2dbecc){return _0x2dbecc;});}return null;};}function removeEntity(_0x404128,_0x2eabd8){return function(_0x5c3362){if(_0x5c3362){return _0x5c3362[_0x74a4('0x22')]()[_0x74a4('0x23')](function(){var _0x47c200=_0x5c3362[_0x74a4('0x24')]({'plain':!![]});var _0x258a42='ChanSpies';return db[_0x74a4('0x25')][_0x74a4('0x22')]({'where':{'type':_0x258a42,'resourceId':_0x47c200['id']}})[_0x74a4('0x23')](function(){return _0x5c3362;});})['then'](function(){_0x404128[_0x74a4('0x18')](0xcc)[_0x74a4('0x19')]();});}};}function handleEntityNotFound(_0x1510fd,_0x18f30a){return function(_0xe933f6){if(!_0xe933f6){_0x1510fd[_0x74a4('0x17')](0x194);}return _0xe933f6;};}function handleError(_0x5a0cb5,_0x52df4d){_0x52df4d=_0x52df4d||0x1f4;return function(_0x36472e){logger['error'](_0x36472e[_0x74a4('0x26')]);if(_0x36472e['name']){delete _0x36472e[_0x74a4('0x27')];}_0x5a0cb5['status'](_0x52df4d)['send'](_0x36472e);};}exports[_0x74a4('0x28')]=function(_0x376f29,_0x309846){var _0x4b833d={},_0x4abc27={},_0x5b9308={'count':0x0,'rows':[]};var _0x480770=_['map'](db['VoiceChanSpy'][_0x74a4('0x29')],function(_0x5ec4d5){return{'name':_0x5ec4d5[_0x74a4('0x2a')],'type':_0x5ec4d5[_0x74a4('0x2b')][_0x74a4('0x2c')]};});_0x4abc27['model']=_[_0x74a4('0x2d')](_0x480770,_0x74a4('0x27'));_0x4abc27[_0x74a4('0x2e')]=_[_0x74a4('0x2f')](_0x376f29[_0x74a4('0x2e')]);_0x4abc27[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x4abc27[_0x74a4('0x32')],_0x4abc27['query']);_0x4b833d[_0x74a4('0x33')]=_[_0x74a4('0x31')](_0x4abc27['model'],qs[_0x74a4('0x34')](_0x376f29['query']['fields']));_0x4b833d[_0x74a4('0x33')]=_0x4b833d[_0x74a4('0x33')][_0x74a4('0x35')]?_0x4b833d[_0x74a4('0x33')]:_0x4abc27[_0x74a4('0x32')];if(!_0x376f29[_0x74a4('0x2e')][_0x74a4('0x36')](_0x74a4('0x37'))){_0x4b833d[_0x74a4('0x1e')]=qs['limit'](_0x376f29[_0x74a4('0x2e')][_0x74a4('0x1e')]);_0x4b833d[_0x74a4('0x1b')]=qs[_0x74a4('0x1b')](_0x376f29[_0x74a4('0x2e')]['offset']);}_0x4b833d[_0x74a4('0x38')]=qs[_0x74a4('0x39')](_0x376f29['query'][_0x74a4('0x39')]);_0x4b833d[_0x74a4('0x3a')]=qs[_0x74a4('0x30')](_[_0x74a4('0x3b')](_0x376f29[_0x74a4('0x2e')],_0x4abc27[_0x74a4('0x30')]),_0x480770);if(_0x376f29['query'][_0x74a4('0x3c')]){_0x4b833d[_0x74a4('0x3a')]=_['merge'](_0x4b833d[_0x74a4('0x3a')],{'$or':_[_0x74a4('0x2d')](_0x480770,function(_0x1e9bad){if(_0x1e9bad[_0x74a4('0x2b')]!==_0x74a4('0x3d')){var _0x54b45b={};_0x54b45b[_0x1e9bad[_0x74a4('0x27')]]={'$like':'%'+_0x376f29[_0x74a4('0x2e')]['filter']+'%'};return _0x54b45b;}})});}_0x4b833d=_[_0x74a4('0x3e')]({},_0x4b833d,_0x376f29[_0x74a4('0x3f')]);var _0x13a04d={'where':_0x4b833d[_0x74a4('0x3a')]};return db['VoiceChanSpy']['count'](_0x13a04d)[_0x74a4('0x23')](function(_0x58e56b){_0x5b9308['count']=_0x58e56b;if(_0x376f29[_0x74a4('0x2e')][_0x74a4('0x40')]){_0x4b833d[_0x74a4('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x74a4('0x42')](_0x4b833d);})[_0x74a4('0x23')](function(_0x53207c){_0x5b9308[_0x74a4('0x43')]=_0x53207c;return _0x5b9308;})[_0x74a4('0x23')](respondWithFilteredResult(_0x309846,_0x4b833d))[_0x74a4('0x44')](handleError(_0x309846,null));};exports[_0x74a4('0x45')]=function(_0x53fc19,_0x42da26){var _0x33d6ba={'raw':![],'where':{'id':_0x53fc19[_0x74a4('0x46')]['id']}},_0x4cf3de={};_0x4cf3de[_0x74a4('0x32')]=_[_0x74a4('0x2f')](db[_0x74a4('0x47')][_0x74a4('0x29')]);_0x4cf3de[_0x74a4('0x2e')]=_[_0x74a4('0x2f')](_0x53fc19[_0x74a4('0x2e')]);_0x4cf3de[_0x74a4('0x30')]=_[_0x74a4('0x31')](_0x4cf3de[_0x74a4('0x32')],_0x4cf3de['query']);_0x33d6ba[_0x74a4('0x33')]=_['intersection'](_0x4cf3de[_0x74a4('0x32')],qs[_0x74a4('0x34')](_0x53fc19[_0x74a4('0x2e')]['fields']));_0x33d6ba[_0x74a4('0x33')]=_0x33d6ba[_0x74a4('0x33')]['length']?_0x33d6ba[_0x74a4('0x33')]:_0x4cf3de[_0x74a4('0x32')];if(_0x53fc19[_0x74a4('0x2e')][_0x74a4('0x40')]){_0x33d6ba[_0x74a4('0x41')]=[{'all':!![]}];}_0x33d6ba=_['merge']({},_0x33d6ba,_0x53fc19['options']);return db['VoiceChanSpy'][_0x74a4('0x48')](_0x33d6ba)[_0x74a4('0x23')](handleEntityNotFound(_0x42da26,null))[_0x74a4('0x23')](respondWithResult(_0x42da26,null))['catch'](handleError(_0x42da26,null));};exports[_0x74a4('0x49')]=function(_0x461148,_0x1c0ebf){return db[_0x74a4('0x47')]['create'](_0x461148[_0x74a4('0x4a')],{})[_0x74a4('0x23')](function(_0x5677f6){var _0x4ae863=_0x461148[_0x74a4('0x4b')][_0x74a4('0x24')]({'plain':!![]});if(!_0x4ae863)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ae863[_0x74a4('0x4c')]===_0x74a4('0x4b')){var _0x4feab2=_0x5677f6[_0x74a4('0x24')]({'plain':!![]});var _0x3c8df2=_0x74a4('0x4d');return db[_0x74a4('0x4e')][_0x74a4('0x48')]({'where':{'name':_0x3c8df2,'userProfileId':_0x4ae863[_0x74a4('0x4f')]},'raw':!![]})[_0x74a4('0x23')](function(_0x466993){if(_0x466993&&_0x466993[_0x74a4('0x50')]===0x0){return db[_0x74a4('0x25')][_0x74a4('0x49')]({'name':_0x4feab2[_0x74a4('0x27')],'resourceId':_0x4feab2['id'],'type':_0x466993[_0x74a4('0x27')],'sectionId':_0x466993['id']},{})[_0x74a4('0x23')](function(){return _0x5677f6;});}else{return _0x5677f6;}})['catch'](function(_0xf2bbca){logger['error'](_0x74a4('0x51'),_0xf2bbca);throw _0xf2bbca;});}return _0x5677f6;})[_0x74a4('0x23')](respondWithResult(_0x1c0ebf,0xc9))[_0x74a4('0x44')](handleError(_0x1c0ebf,null));};exports[_0x74a4('0x52')]=function(_0x7e745e,_0xa6330f){if(_0x7e745e[_0x74a4('0x4a')]['id']){delete _0x7e745e[_0x74a4('0x4a')]['id'];}return db['VoiceChanSpy'][_0x74a4('0x48')]({'where':{'id':_0x7e745e[_0x74a4('0x46')]['id']}})['then'](handleEntityNotFound(_0xa6330f,null))[_0x74a4('0x23')](saveUpdates(_0x7e745e['body'],null))[_0x74a4('0x23')](respondWithResult(_0xa6330f,null))[_0x74a4('0x44')](handleError(_0xa6330f,null));};exports[_0x74a4('0x22')]=function(_0xf51a2d,_0x34b37d){return db[_0x74a4('0x47')][_0x74a4('0x48')]({'where':{'id':_0xf51a2d['params']['id']}})[_0x74a4('0x23')](handleEntityNotFound(_0x34b37d,null))[_0x74a4('0x23')](removeEntity(_0x34b37d,null))[_0x74a4('0x44')](handleError(_0x34b37d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a876195..4702e9b 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 _0xd062=['prefix','system','push','merge','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','name','options','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0xd062,0xfd));var _0x2d06=function(_0x12c0fe,_0x2af9c8){_0x12c0fe=_0x12c0fe-0x0;var _0x4ac0b7=_0xd062[_0x12c0fe];return _0x4ac0b7;};'use strict';var _=require(_0x2d06('0x0'));var util=require(_0x2d06('0x1'));var BPromise=require(_0x2d06('0x2'));var attributes=require(_0x2d06('0x3'));var getUserApplications=function(_0x4896f2,_0x155c41,_0x31217b){var _0x2f42c6=0x1;var _0x15eebf=[];var _0x8625fd={'context':_0x155c41[_0x2d06('0x4')]||_0x2d06('0x5'),'exten':util['format']('%s%s',_0x4896f2[_0x2d06('0x6')],_0x31217b),'type':_0x2d06('0x7'),'isApp':![],'ChanSpyId':_0x4896f2['id'],'UserId':_0x155c41['id']};_0x15eebf[_0x2d06('0x8')](_[_0x2d06('0x9')]({'app':'Set','appdata':util[_0x2d06('0xa')](_0x2d06('0xb'),_0x2d06('0xc')),'priority':_0x2f42c6++},_0x8625fd));if(_0x4896f2[_0x2d06('0xd')]){_0x15eebf[_0x2d06('0x8')](_[_0x2d06('0x9')]({'app':_0x2d06('0xe'),'appdata':util[_0x2d06('0xa')](_0x2d06('0xf'),_0x4896f2[_0x2d06('0x10')]),'priority':_0x2f42c6++},_0x8625fd));}if(_0x4896f2['auth']){_0x15eebf[_0x2d06('0x8')](_[_0x2d06('0x9')]({'app':'Authenticate','appdata':_0x4896f2[_0x2d06('0x11')],'priority':_0x2f42c6++},_0x8625fd));}_0x15eebf[_0x2d06('0x8')](_[_0x2d06('0x9')]({'app':_0x2d06('0x12'),'appdata':util[_0x2d06('0xa')]('SIP/%s,%s',_0x155c41[_0x2d06('0x13')],_0x4896f2[_0x2d06('0x14')]?_0x4896f2['options']['join'](''):''),'priority':_0x2f42c6++},_0x8625fd));if(_0x4896f2['record']){_0x15eebf[_0x2d06('0x8')](_['merge']({'app':_0x2d06('0x15'),'priority':_0x2f42c6++},_0x8625fd));}return _0x15eebf;};var getChanSpyApplications=function(_0x11c4c0,_0x42c835){var _0x3ca2ee=[];for(var _0x1ce378=0x0,_0x591239=0x1;_0x1ce378<_0x42c835[_0x2d06('0x16')];_0x1ce378++,_0x591239=0x1){_0x3ca2ee=_0x3ca2ee[_0x2d06('0x17')](getUserApplications(_0x11c4c0,_0x42c835[_0x1ce378],_0x42c835[_0x1ce378][_0x2d06('0x18')]));if(_0x42c835[_0x1ce378][_0x2d06('0x18')]!=_0x42c835[_0x1ce378]['name']){_0x3ca2ee=_0x3ca2ee[_0x2d06('0x17')](getUserApplications(_0x11c4c0,_0x42c835[_0x1ce378],_0x42c835[_0x1ce378]['name']));}}return _0x3ca2ee;};var getChanSpyPromise=function(_0x48d829,_0x4e26a7){return new BPromise(function(_0x5771ee,_0x21bae7){return _0x48d829[_0x2d06('0x19')][_0x2d06('0x1a')]({'attributes':['id',_0x2d06('0x13'),_0x2d06('0x18')],'where':{'role':_0x2d06('0x1b'),'chanspy':!![]},'raw':!![]})[_0x2d06('0x1c')](function(_0x23e017){if(_0x23e017){return _0x5771ee(getChanSpyApplications(_0x4e26a7,_0x23e017));}return _0x5771ee([]);})[_0x2d06('0x1d')](function(_0x10b15d){_0x21bae7(_0x10b15d);});});};module[_0x2d06('0x1e')]=function(_0x416e73,_0x1b005c){var _0x5ba465=_0x416e73[_0x2d06('0x1f')];return _0x416e73[_0x2d06('0x20')](_0x2d06('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37df54,_0x522b91,_0x3c6467){return getChanSpyPromise(_0x5ba465,_0x37df54)[_0x2d06('0x1c')](function(_0x52c75d){if(_0x52c75d&&_0x52c75d['length']){return _0x5ba465[_0x2d06('0x22')]['bulkCreate'](_0x52c75d);}})[_0x2d06('0x1c')](function(){_0x3c6467();})[_0x2d06('0x1d')](function(_0xe8c70b){_0x3c6467(_0xe8c70b);});},'afterUpdate':function(_0x87f3dc,_0x422642,_0x52670b){return _0x5ba465[_0x2d06('0x22')]['destroy']({'where':{'ChanSpyId':_0x87f3dc['id']}})[_0x2d06('0x1c')](function(){return getChanSpyPromise(_0x5ba465,_0x87f3dc);})[_0x2d06('0x1c')](function(_0x53e6e3){if(_0x53e6e3&&_0x53e6e3[_0x2d06('0x16')]){return _0x5ba465['VoiceExtension'][_0x2d06('0x23')](_0x53e6e3);}})[_0x2d06('0x1c')](function(){_0x52670b();})[_0x2d06('0x1d')](function(_0x8ba1a7){_0x52670b(_0x8ba1a7);});},'afterDestroy':function(_0x5efe3a,_0x433caf,_0x602ce){return _0x5ba465['VoiceExtension'][_0x2d06('0x24')]({'where':{'ChanSpyId':_0x5efe3a['id']}})[_0x2d06('0x1c')](function(){_0x602ce();})['catch'](function(_0x789926){_0x602ce(_0x789926);});}}});}; \ No newline at end of file +var _0xfdec=['%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','format','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','length','bulkCreate','VoiceExtension','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xfdec,0x132));var _0xcfde=function(_0x26bdda,_0x3ae7ec){_0x26bdda=_0x26bdda-0x0;var _0x4c4761=_0xfdec[_0x26bdda];return _0x4c4761;};'use strict';var _=require(_0xcfde('0x0'));var util=require(_0xcfde('0x1'));var BPromise=require(_0xcfde('0x2'));var attributes=require(_0xcfde('0x3'));var getUserApplications=function(_0x258657,_0x38f576,_0x29f28c){var _0x21b4ed=0x1;var _0x3e702b=[];var _0x450920={'context':_0x38f576[_0xcfde('0x4')]||_0xcfde('0x5'),'exten':util['format'](_0xcfde('0x6'),_0x258657[_0xcfde('0x7')],_0x29f28c),'type':'system','isApp':![],'ChanSpyId':_0x258657['id'],'UserId':_0x38f576['id']};_0x3e702b[_0xcfde('0x8')](_[_0xcfde('0x9')]({'app':_0xcfde('0xa'),'appdata':util['format'](_0xcfde('0xb'),_0xcfde('0xc')),'priority':_0x21b4ed++},_0x450920));if(_0x258657[_0xcfde('0xd')]){_0x3e702b[_0xcfde('0x8')](_[_0xcfde('0x9')]({'app':'MixMonitor','appdata':util['format'](_0xcfde('0xe'),_0x258657[_0xcfde('0xf')]),'priority':_0x21b4ed++},_0x450920));}if(_0x258657[_0xcfde('0x10')]){_0x3e702b[_0xcfde('0x8')](_[_0xcfde('0x9')]({'app':'Authenticate','appdata':_0x258657[_0xcfde('0x11')],'priority':_0x21b4ed++},_0x450920));}_0x3e702b[_0xcfde('0x8')](_[_0xcfde('0x9')]({'app':_0xcfde('0x12'),'appdata':util[_0xcfde('0x13')](_0xcfde('0x14'),_0x38f576[_0xcfde('0x15')],_0x258657[_0xcfde('0x16')]?_0x258657[_0xcfde('0x16')][_0xcfde('0x17')](''):''),'priority':_0x21b4ed++},_0x450920));if(_0x258657['record']){_0x3e702b[_0xcfde('0x8')](_[_0xcfde('0x9')]({'app':_0xcfde('0x18'),'priority':_0x21b4ed++},_0x450920));}return _0x3e702b;};var getChanSpyApplications=function(_0x3927ad,_0x2e9cce){var _0x584d21=[];for(var _0x274008=0x0,_0x357774=0x1;_0x274008<_0x2e9cce['length'];_0x274008++,_0x357774=0x1){_0x584d21=_0x584d21[_0xcfde('0x19')](getUserApplications(_0x3927ad,_0x2e9cce[_0x274008],_0x2e9cce[_0x274008][_0xcfde('0x1a')]));if(_0x2e9cce[_0x274008][_0xcfde('0x1a')]!=_0x2e9cce[_0x274008][_0xcfde('0x15')]){_0x584d21=_0x584d21['concat'](getUserApplications(_0x3927ad,_0x2e9cce[_0x274008],_0x2e9cce[_0x274008][_0xcfde('0x15')]));}}return _0x584d21;};var getChanSpyPromise=function(_0x507708,_0x3990ba){return new BPromise(function(_0x143899,_0x1e2383){return _0x507708[_0xcfde('0x1b')][_0xcfde('0x1c')]({'attributes':['id',_0xcfde('0x15'),_0xcfde('0x1a')],'where':{'role':_0xcfde('0x1d'),'chanspy':!![]},'raw':!![]})[_0xcfde('0x1e')](function(_0x42dd02){if(_0x42dd02){return _0x143899(getChanSpyApplications(_0x3990ba,_0x42dd02));}return _0x143899([]);})[_0xcfde('0x1f')](function(_0x4701e6){_0x1e2383(_0x4701e6);});});};module[_0xcfde('0x20')]=function(_0x3b2e5e,_0xe12150){var _0x1c2c74=_0x3b2e5e[_0xcfde('0x21')];return _0x3b2e5e[_0xcfde('0x22')](_0xcfde('0x23'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x59f3a1,_0x6567a1,_0x186705){return getChanSpyPromise(_0x1c2c74,_0x59f3a1)[_0xcfde('0x1e')](function(_0x1acedd){if(_0x1acedd&&_0x1acedd[_0xcfde('0x24')]){return _0x1c2c74['VoiceExtension'][_0xcfde('0x25')](_0x1acedd);}})[_0xcfde('0x1e')](function(){_0x186705();})[_0xcfde('0x1f')](function(_0x41aaf5){_0x186705(_0x41aaf5);});},'afterUpdate':function(_0x59441f,_0x570746,_0x226614){return _0x1c2c74[_0xcfde('0x26')]['destroy']({'where':{'ChanSpyId':_0x59441f['id']}})['then'](function(){return getChanSpyPromise(_0x1c2c74,_0x59441f);})[_0xcfde('0x1e')](function(_0xb9d089){if(_0xb9d089&&_0xb9d089['length']){return _0x1c2c74[_0xcfde('0x26')][_0xcfde('0x25')](_0xb9d089);}})['then'](function(){_0x226614();})[_0xcfde('0x1f')](function(_0x34cecf){_0x226614(_0x34cecf);});},'afterDestroy':function(_0x35cb34,_0x57d495,_0x3701fb){return _0x1c2c74[_0xcfde('0x26')]['destroy']({'where':{'ChanSpyId':_0x35cb34['id']}})[_0xcfde('0x1e')](function(){_0x3701fb();})[_0xcfde('0x1f')](function(_0x1bfca8){_0x3701fb(_0x1bfca8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e68d907..26c13f2 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 _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(_0x26bae3,_0x28b494){var _0x3e5223=function(_0x4ee441){while(--_0x4ee441){_0x26bae3['push'](_0x26bae3['shift']());}};_0x3e5223(++_0x28b494);}(_0xb248,0xc6));var _0x8b24=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xb248[_0x13b02f];return _0x12e9a6;};'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 +var _0xb49a=['info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x153d15,_0x3d8136){var _0x46ff6a=function(_0x4573cd){while(--_0x4573cd){_0x153d15['push'](_0x153d15['shift']());}};_0x46ff6a(++_0x3d8136);}(_0xb49a,0xfb));var _0xab49=function(_0x39a71e,_0x128d6c){_0x39a71e=_0x39a71e-0x0;var _0x1d62fb=_0xb49a[_0x39a71e];return _0x1d62fb;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 84e01e1..6b9e23e 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 _0xb00e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x120bcf,_0x4d7792){var _0x139751=function(_0x3c223a){while(--_0x3c223a){_0x120bcf['push'](_0x120bcf['shift']());}};_0x139751(++_0x4d7792);}(_0xb00e,0x70));var _0xeb00=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xb00e[_0x590a38];return _0xf36626;};'use strict';var multer=require(_0xeb00('0x0'));var util=require(_0xeb00('0x1'));var path=require(_0xeb00('0x2'));var timeout=require(_0xeb00('0x3'));var express=require(_0xeb00('0x4'));var router=express[_0xeb00('0x5')]();var fs_extra=require(_0xeb00('0x6'));var auth=require(_0xeb00('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xeb00('0x8'));var controller=require(_0xeb00('0x9'));router[_0xeb00('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb00('0xa')]('/:id',auth[_0xeb00('0xb')](),controller[_0xeb00('0xc')]);router['post']('/',auth[_0xeb00('0xb')](),controller[_0xeb00('0xd')]);router['put'](_0xeb00('0xe'),auth[_0xeb00('0xb')](),controller[_0xeb00('0xf')]);router[_0xeb00('0x10')](_0xeb00('0xe'),auth[_0xeb00('0xb')](),controller[_0xeb00('0x11')]);module[_0xeb00('0x12')]=router; \ No newline at end of file +var _0x2c90=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x42fb06,_0xc8e815){var _0x5580ad=function(_0x4345ff){while(--_0x4345ff){_0x42fb06['push'](_0x42fb06['shift']());}};_0x5580ad(++_0xc8e815);}(_0x2c90,0xf4));var _0x02c9=function(_0x3dadd6,_0xfa076f){_0x3dadd6=_0x3dadd6-0x0;var _0x46e3b5=_0x2c90[_0x3dadd6];return _0x46e3b5;};'use strict';var multer=require(_0x02c9('0x0'));var util=require(_0x02c9('0x1'));var path=require(_0x02c9('0x2'));var timeout=require(_0x02c9('0x3'));var express=require('express');var router=express[_0x02c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x02c9('0x5'));var interaction=require(_0x02c9('0x6'));var config=require(_0x02c9('0x7'));var controller=require('./voiceContext.controller');router[_0x02c9('0x8')]('/',auth[_0x02c9('0x9')](),controller[_0x02c9('0xa')]);router[_0x02c9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x02c9('0xb')]);router[_0x02c9('0xc')]('/',auth[_0x02c9('0x9')](),controller[_0x02c9('0xd')]);router[_0x02c9('0xe')](_0x02c9('0xf'),auth[_0x02c9('0x9')](),controller[_0x02c9('0x10')]);router[_0x02c9('0x11')](_0x02c9('0xf'),auth[_0x02c9('0x9')](),controller[_0x02c9('0x12')]);module[_0x02c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fa2a173..428b946 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 _0xf5f9=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf5f9,0x183));var _0x9f5f=function(_0x592c99,_0x2429b1){_0x592c99=_0x592c99-0x0;var _0x44aa54=_0xf5f9[_0x592c99];return _0x44aa54;};'use strict';var Sequelize=require(_0x9f5f('0x0'));module[_0x9f5f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9f5f('0x2')},'description':{'type':Sequelize[_0x9f5f('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9f5f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0559=['BOOLEAN','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0559,0x1d9));var _0x9055=function(_0x51a58c,_0x5b0474){_0x51a58c=_0x51a58c-0x0;var _0x513149=_0x0559[_0x51a58c];return _0x513149;};'use strict';var Sequelize=require(_0x9055('0x0'));module[_0x9055('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x9055('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9055('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 7f50c8e..effcd3b 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 _0x393a=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','rows','show','params','length','includeAll','find','create','body','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','utf8','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x393a,0x117));var _0xa393=function(_0x35b4c6,_0x5e57a2){_0x35b4c6=_0x35b4c6-0x0;var _0xa45f4c=_0x393a[_0x35b4c6];return _0xa45f4c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa393('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa393('0x1'));var moment=require(_0xa393('0x2'));var BPromise=require(_0xa393('0x3'));var Mustache=require(_0xa393('0x4'));var util=require(_0xa393('0x5'));var path=require(_0xa393('0x6'));var sox=require(_0xa393('0x7'));var csv=require(_0xa393('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa393('0x9'));var _=require('lodash');var squel=require(_0xa393('0xa'));var crypto=require(_0xa393('0xb'));var jsforce=require(_0xa393('0xc'));var deskjs=require(_0xa393('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa393('0xe'));var Papa=require('papaparse');var Redis=require(_0xa393('0xf'));var authService=require(_0xa393('0x10'));var qs=require(_0xa393('0x11'));var as=require(_0xa393('0x12'));var hardwareService=require(_0xa393('0x13'));var logger=require('../../config/logger')(_0xa393('0x14'));var utils=require('../../config/utils');var config=require(_0xa393('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa393('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa393('0x17')][_0xa393('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3799a8,_0xd6202a,_0x282872,_0x444087){return new BPromise(function(_0x14e620,_0x2bc0be){var _0x20c947=_0x444087||client;return _0x20c947[_0xa393('0x19')](_0x3799a8,_0x282872)[_0xa393('0x1a')](function(_0x59234c){logger[_0xa393('0x1b')](_0xa393('0x1c'),_0xd6202a,_0xa393('0x1d'));logger[_0xa393('0x1e')](_0xa393('0x1f'),_0xd6202a,_0xa393('0x1d'),JSON[_0xa393('0x20')](_0x59234c));if(_0x59234c[_0xa393('0x21')]){if(_0x59234c[_0xa393('0x21')][_0xa393('0x22')]===0x1f4){logger['error'](_0xa393('0x1c'),_0xd6202a,_0x59234c[_0xa393('0x21')][_0xa393('0x23')]);return _0x2bc0be(_0x59234c['error']['message']);}logger[_0xa393('0x21')](_0xa393('0x1c'),_0xd6202a,_0x59234c[_0xa393('0x21')][_0xa393('0x23')]);return _0x14e620(_0x59234c[_0xa393('0x21')][_0xa393('0x23')]);}else{logger[_0xa393('0x1b')](_0xa393('0x1c'),_0xd6202a,_0xa393('0x1d'));_0x14e620(_0x59234c[_0xa393('0x24')][_0xa393('0x23')]);}})[_0xa393('0x25')](function(_0x1b627e){logger[_0xa393('0x21')]('VoiceContext,\x20%s,\x20%s',_0xd6202a,_0x1b627e);_0x2bc0be(_0x1b627e);});});}function respondWithStatusCode(_0x4aa551,_0x476c94){_0x476c94=_0x476c94||0xcc;return function(_0x483ae4){if(_0x483ae4){return _0x4aa551[_0xa393('0x26')](_0x476c94);}return _0x4aa551[_0xa393('0x27')](_0x476c94)[_0xa393('0x28')]();};}function respondWithResult(_0x247bda,_0x3c38d3){_0x3c38d3=_0x3c38d3||0xc8;return function(_0x17aac1){if(_0x17aac1){return _0x247bda[_0xa393('0x27')](_0x3c38d3)['json'](_0x17aac1);}};}function respondWithFilteredResult(_0x2ba90c,_0x24fb87){return function(_0x6c86bc){if(_0x6c86bc){var _0x36664c=typeof _0x24fb87[_0xa393('0x29')]===_0xa393('0x2a')&&typeof _0x24fb87[_0xa393('0x2b')]===_0xa393('0x2a');var _0x284ce9=_0x6c86bc[_0xa393('0x2c')];var _0x5f1610=_0x36664c?0x0:_0x24fb87[_0xa393('0x29')];var _0x329a19=_0x36664c?_0x6c86bc[_0xa393('0x2c')]:_0x24fb87[_0xa393('0x29')]+_0x24fb87[_0xa393('0x2b')];var _0x34979a;if(_0x329a19>=_0x284ce9){_0x329a19=_0x284ce9;_0x34979a=0xc8;}else{_0x34979a=0xce;}_0x2ba90c[_0xa393('0x27')](_0x34979a);return _0x2ba90c[_0xa393('0x2d')](_0xa393('0x2e'),_0x5f1610+'-'+_0x329a19+'/'+_0x284ce9)[_0xa393('0x2f')](_0x6c86bc);}return null;};}function patchUpdates(_0x467a22){return function(_0x1be777){try{jsonpatch[_0xa393('0x30')](_0x1be777,_0x467a22,!![]);}catch(_0x4196e8){return BPromise[_0xa393('0x31')](_0x4196e8);}return _0x1be777['save']();};}function saveUpdates(_0x3c6e02,_0x28fb51){return function(_0x376c73){if(_0x376c73){return _0x376c73[_0xa393('0x32')](_0x3c6e02)['then'](function(_0xac003){return _0xac003;});}return null;};}function removeEntity(_0x84a75c,_0x2a0069){return function(_0x2a592d){if(_0x2a592d){return _0x2a592d[_0xa393('0x33')]()[_0xa393('0x1a')](function(){var _0x1ecce6=_0x2a592d['get']({'plain':!![]});var _0x53ea06='Contexts';return db[_0xa393('0x34')]['destroy']({'where':{'type':_0x53ea06,'resourceId':_0x1ecce6['id']}})['then'](function(){return _0x2a592d;});})[_0xa393('0x1a')](function(){_0x84a75c[_0xa393('0x27')](0xcc)[_0xa393('0x28')]();});}};}function handleEntityNotFound(_0x12cf70,_0x5b72b5){return function(_0x1ff7b6){if(!_0x1ff7b6){_0x12cf70[_0xa393('0x26')](0x194);}return _0x1ff7b6;};}function handleError(_0x32b7e5,_0x5888b9){_0x5888b9=_0x5888b9||0x1f4;return function(_0x2818ca){logger[_0xa393('0x21')](_0x2818ca[_0xa393('0x35')]);if(_0x2818ca[_0xa393('0x36')]){delete _0x2818ca[_0xa393('0x36')];}_0x32b7e5[_0xa393('0x27')](_0x5888b9)[_0xa393('0x37')](_0x2818ca);};}exports[_0xa393('0x38')]=function(_0x3d3764,_0x2714d3){var _0x3e38a5={},_0x5a5d56={},_0x5430f={'count':0x0,'rows':[]};var _0x26694d=_[_0xa393('0x39')](db['VoiceContext'][_0xa393('0x3a')],function(_0x3886c0){return{'name':_0x3886c0[_0xa393('0x3b')],'type':_0x3886c0[_0xa393('0x3c')][_0xa393('0x3d')]};});_0x5a5d56[_0xa393('0x3e')]=_[_0xa393('0x39')](_0x26694d,_0xa393('0x36'));_0x5a5d56[_0xa393('0x3f')]=_[_0xa393('0x40')](_0x3d3764['query']);_0x5a5d56[_0xa393('0x41')]=_[_0xa393('0x42')](_0x5a5d56['model'],_0x5a5d56[_0xa393('0x3f')]);_0x3e38a5[_0xa393('0x43')]=_[_0xa393('0x42')](_0x5a5d56['model'],qs[_0xa393('0x44')](_0x3d3764[_0xa393('0x3f')][_0xa393('0x44')]));_0x3e38a5[_0xa393('0x43')]=_0x3e38a5[_0xa393('0x43')]['length']?_0x3e38a5[_0xa393('0x43')]:_0x5a5d56[_0xa393('0x3e')];if(!_0x3d3764[_0xa393('0x3f')][_0xa393('0x45')]('nolimit')){_0x3e38a5[_0xa393('0x2b')]=qs['limit'](_0x3d3764['query'][_0xa393('0x2b')]);_0x3e38a5[_0xa393('0x29')]=qs[_0xa393('0x29')](_0x3d3764['query'][_0xa393('0x29')]);}_0x3e38a5[_0xa393('0x46')]=qs[_0xa393('0x47')](_0x3d3764[_0xa393('0x3f')][_0xa393('0x47')]);_0x3e38a5[_0xa393('0x48')]=qs['filters'](_[_0xa393('0x49')](_0x3d3764[_0xa393('0x3f')],_0x5a5d56[_0xa393('0x41')]),_0x26694d);if(_0x3d3764[_0xa393('0x3f')][_0xa393('0x4a')]){_0x3e38a5[_0xa393('0x48')]=_[_0xa393('0x4b')](_0x3e38a5[_0xa393('0x48')],{'$or':_['map'](_0x26694d,function(_0x126ec0){if(_0x126ec0[_0xa393('0x3c')]!==_0xa393('0x4c')){var _0x158964={};_0x158964[_0x126ec0['name']]={'$like':'%'+_0x3d3764[_0xa393('0x3f')][_0xa393('0x4a')]+'%'};return _0x158964;}})});}_0x3e38a5=_[_0xa393('0x4b')]({},_0x3e38a5,_0x3d3764[_0xa393('0x4d')]);var _0x502ba3={'where':_0x3e38a5['where']};return db[_0xa393('0x4e')][_0xa393('0x2c')](_0x502ba3)[_0xa393('0x1a')](function(_0x24e3b8){_0x5430f[_0xa393('0x2c')]=_0x24e3b8;if(_0x3d3764[_0xa393('0x3f')]['includeAll']){_0x3e38a5[_0xa393('0x4f')]=[{'all':!![]}];}return db[_0xa393('0x4e')][_0xa393('0x50')](_0x3e38a5);})[_0xa393('0x1a')](function(_0x41e5f8){_0x5430f[_0xa393('0x51')]=_0x41e5f8;return _0x5430f;})['then'](respondWithFilteredResult(_0x2714d3,_0x3e38a5))[_0xa393('0x25')](handleError(_0x2714d3,null));};exports[_0xa393('0x52')]=function(_0x4aaa51,_0x851646){var _0x374666={'raw':![],'where':{'id':_0x4aaa51[_0xa393('0x53')]['id']}},_0x22ebe3={};_0x22ebe3['model']=_['keys'](db[_0xa393('0x4e')][_0xa393('0x3a')]);_0x22ebe3[_0xa393('0x3f')]=_[_0xa393('0x40')](_0x4aaa51['query']);_0x22ebe3[_0xa393('0x41')]=_['intersection'](_0x22ebe3['model'],_0x22ebe3[_0xa393('0x3f')]);_0x374666['attributes']=_['intersection'](_0x22ebe3['model'],qs[_0xa393('0x44')](_0x4aaa51[_0xa393('0x3f')]['fields']));_0x374666[_0xa393('0x43')]=_0x374666['attributes'][_0xa393('0x54')]?_0x374666[_0xa393('0x43')]:_0x22ebe3[_0xa393('0x3e')];if(_0x4aaa51[_0xa393('0x3f')][_0xa393('0x55')]){_0x374666[_0xa393('0x4f')]=[{'all':!![]}];}_0x374666=_[_0xa393('0x4b')]({},_0x374666,_0x4aaa51['options']);return db[_0xa393('0x4e')][_0xa393('0x56')](_0x374666)[_0xa393('0x1a')](handleEntityNotFound(_0x851646,null))[_0xa393('0x1a')](respondWithResult(_0x851646,null))[_0xa393('0x25')](handleError(_0x851646,null));};exports[_0xa393('0x57')]=function(_0x1af39a,_0x5a44d1,_0x584907){var _0x53ff79;return db[_0xa393('0x4e')][_0xa393('0x57')](_0x1af39a[_0xa393('0x58')],{'raw':!![]})[_0xa393('0x1a')](function(_0x23baf6){_0x53ff79=_0x23baf6;return db[_0xa393('0x4e')]['findAll']({'raw':!![]});})[_0xa393('0x1a')](function(_0x3e97ac){var _0x56281c=fs[_0xa393('0x59')](path['join'](config[_0xa393('0x5a')],_0xa393('0x5b')),'utf8');var _0x2b3b99=ejs[_0xa393('0x5c')](_0x56281c,{'contexts':_0x3e97ac||[]});fs[_0xa393('0x5d')](_0xa393('0x5e'),_0x2b3b99);})[_0xa393('0x1a')](function(){return respondWithRpcPromise(_0xa393('0x5f'),_0xa393('0x57'),{'module':_0xa393('0x60')});})[_0xa393('0x1a')](function(){var _0x16f4ac=_0x1af39a['user']['get']({'plain':!![]});if(!_0x16f4ac)throw new Error(_0xa393('0x61'));if(_0x16f4ac[_0xa393('0x62')]==='user'){var _0x1e0267=_0x53ff79[_0xa393('0x63')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa393('0x64'),'userProfileId':_0x16f4ac[_0xa393('0x65')]},'raw':!![]})['then'](function(_0xc1882a){if(_0xc1882a&&_0xc1882a[_0xa393('0x66')]===0x0){return db[_0xa393('0x34')][_0xa393('0x57')]({'name':_0x1e0267['name'],'resourceId':_0x1e0267['id'],'type':_0xc1882a['name'],'sectionId':_0xc1882a['id']},{})['then'](function(){return _0x53ff79;});}else{return _0x53ff79;}})['catch'](function(_0x1f434e){logger[_0xa393('0x21')](_0xa393('0x67'),_0x1f434e);throw _0x1f434e;});}return _0x53ff79;})[_0xa393('0x1a')](respondWithResult(_0x5a44d1,0xc9))[_0xa393('0x25')](handleError(_0x5a44d1,null));};exports[_0xa393('0x32')]=function(_0x633539,_0x5e7ae4,_0x16a2f0){var _0x74601c;return db['VoiceContext']['find']({'where':{'id':_0x633539[_0xa393('0x53')]['id']}})[_0xa393('0x1a')](handleEntityNotFound(_0x5e7ae4,null))[_0xa393('0x1a')](saveUpdates(_0x633539[_0xa393('0x58')],null))[_0xa393('0x1a')](function(_0x289d94){if(_0x289d94){_0x74601c=_0x289d94;return db[_0xa393('0x4e')]['findAll']({'raw':!![]});}})['then'](function(_0x4e5a1f){var _0x9ee234=fs[_0xa393('0x59')](path[_0xa393('0x68')](config[_0xa393('0x5a')],_0xa393('0x5b')),_0xa393('0x69'));var _0x43e75a=ejs[_0xa393('0x5c')](_0x9ee234,{'contexts':_0x4e5a1f||[]});fs[_0xa393('0x5d')](_0xa393('0x5e'),_0x43e75a);})[_0xa393('0x1a')](function(){return respondWithRpcPromise(_0xa393('0x5f'),_0xa393('0x32'),{'module':_0xa393('0x60')});})[_0xa393('0x1a')](function(){return _0x74601c;})[_0xa393('0x1a')](respondWithResult(_0x5e7ae4,null))[_0xa393('0x25')](handleError(_0x5e7ae4,null));};exports[_0xa393('0x33')]=function(_0x2f8dab,_0x39c720,_0x1005a1){var _0x16c032;return db['VoiceContext'][_0xa393('0x56')]({'where':{'id':_0x2f8dab[_0xa393('0x53')]['id']}})['then'](handleEntityNotFound(_0x39c720,null))[_0xa393('0x1a')](removeEntity(_0x39c720,null))[_0xa393('0x1a')](function(){return db[_0xa393('0x4e')][_0xa393('0x50')]({'raw':!![]});})['then'](function(_0x459ce5){var _0x5977a8=fs[_0xa393('0x59')](path[_0xa393('0x68')](config[_0xa393('0x5a')],_0xa393('0x5b')),'utf8');var _0x382330=ejs[_0xa393('0x5c')](_0x5977a8,{'contexts':_0x459ce5});fs[_0xa393('0x5d')](_0xa393('0x5e'),_0x382330);return respondWithRpcPromise(_0xa393('0x5f'),_0xa393('0x33'),{'module':_0xa393('0x60')});})['catch'](handleError(_0x39c720,null));}; \ No newline at end of file +var _0x9cec=['includeAll','include','findAll','rows','catch','show','params','length','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0x4dbe44,_0x3fa6b9){var _0x13a25a=function(_0x3ccbd8){while(--_0x3ccbd8){_0x4dbe44['push'](_0x4dbe44['shift']());}};_0x13a25a(++_0x3fa6b9);}(_0x9cec,0x153));var _0xc9ce=function(_0x2441d5,_0x49e5d3){_0x2441d5=_0x2441d5-0x0;var _0x3ef564=_0x9cec[_0x2441d5];return _0x3ef564;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9ce('0x0'));var zipdir=require(_0xc9ce('0x1'));var jsonpatch=require(_0xc9ce('0x2'));var rp=require(_0xc9ce('0x3'));var moment=require(_0xc9ce('0x4'));var BPromise=require(_0xc9ce('0x5'));var Mustache=require('mustache');var util=require(_0xc9ce('0x6'));var path=require(_0xc9ce('0x7'));var sox=require(_0xc9ce('0x8'));var csv=require(_0xc9ce('0x9'));var ejs=require(_0xc9ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc9ce('0xb'));var crypto=require(_0xc9ce('0xc'));var jsforce=require(_0xc9ce('0xd'));var deskjs=require(_0xc9ce('0xe'));var toCsv=require(_0xc9ce('0x9'));var querystring=require(_0xc9ce('0xf'));var Papa=require(_0xc9ce('0x10'));var Redis=require(_0xc9ce('0x11'));var authService=require(_0xc9ce('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9ce('0x13'));var logger=require(_0xc9ce('0x14'))(_0xc9ce('0x15'));var utils=require(_0xc9ce('0x16'));var config=require(_0xc9ce('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9ce('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc9ce('0x19')][_0xc9ce('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4f12aa,_0x1c0636,_0x25a691,_0x5ae12c){return new BPromise(function(_0x2b9f63,_0x22571a){var _0xc8a9a6=_0x5ae12c||client;return _0xc8a9a6[_0xc9ce('0x1b')](_0x4f12aa,_0x25a691)[_0xc9ce('0x1c')](function(_0x40243f){logger[_0xc9ce('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x1c0636,_0xc9ce('0x1e'));logger[_0xc9ce('0x1f')](_0xc9ce('0x20'),_0x1c0636,_0xc9ce('0x1e'),JSON['stringify'](_0x40243f));if(_0x40243f[_0xc9ce('0x21')]){if(_0x40243f[_0xc9ce('0x21')][_0xc9ce('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1c0636,_0x40243f[_0xc9ce('0x21')][_0xc9ce('0x23')]);return _0x22571a(_0x40243f['error']['message']);}logger[_0xc9ce('0x21')](_0xc9ce('0x24'),_0x1c0636,_0x40243f[_0xc9ce('0x21')][_0xc9ce('0x23')]);return _0x2b9f63(_0x40243f[_0xc9ce('0x21')][_0xc9ce('0x23')]);}else{logger[_0xc9ce('0x1d')](_0xc9ce('0x24'),_0x1c0636,_0xc9ce('0x1e'));_0x2b9f63(_0x40243f[_0xc9ce('0x25')]['message']);}})['catch'](function(_0x53b6c3){logger[_0xc9ce('0x21')](_0xc9ce('0x24'),_0x1c0636,_0x53b6c3);_0x22571a(_0x53b6c3);});});}function respondWithStatusCode(_0x695f6e,_0x530a0e){_0x530a0e=_0x530a0e||0xcc;return function(_0x508100){if(_0x508100){return _0x695f6e[_0xc9ce('0x26')](_0x530a0e);}return _0x695f6e[_0xc9ce('0x27')](_0x530a0e)[_0xc9ce('0x28')]();};}function respondWithResult(_0x22422c,_0x1b159d){_0x1b159d=_0x1b159d||0xc8;return function(_0x585737){if(_0x585737){return _0x22422c[_0xc9ce('0x27')](_0x1b159d)[_0xc9ce('0x29')](_0x585737);}};}function respondWithFilteredResult(_0x132f7e,_0x1902ad){return function(_0x4ae740){if(_0x4ae740){var _0x598bd2=typeof _0x1902ad[_0xc9ce('0x2a')]===_0xc9ce('0x2b')&&typeof _0x1902ad[_0xc9ce('0x2c')]===_0xc9ce('0x2b');var _0x158774=_0x4ae740['count'];var _0x5dfbdc=_0x598bd2?0x0:_0x1902ad[_0xc9ce('0x2a')];var _0x3bf694=_0x598bd2?_0x4ae740[_0xc9ce('0x2d')]:_0x1902ad[_0xc9ce('0x2a')]+_0x1902ad[_0xc9ce('0x2c')];var _0x5dffa9;if(_0x3bf694>=_0x158774){_0x3bf694=_0x158774;_0x5dffa9=0xc8;}else{_0x5dffa9=0xce;}_0x132f7e['status'](_0x5dffa9);return _0x132f7e[_0xc9ce('0x2e')](_0xc9ce('0x2f'),_0x5dfbdc+'-'+_0x3bf694+'/'+_0x158774)[_0xc9ce('0x29')](_0x4ae740);}return null;};}function patchUpdates(_0x2eaaf4){return function(_0x524096){try{jsonpatch[_0xc9ce('0x30')](_0x524096,_0x2eaaf4,!![]);}catch(_0x473786){return BPromise['reject'](_0x473786);}return _0x524096['save']();};}function saveUpdates(_0x5562ea,_0x5f1058){return function(_0x8d9658){if(_0x8d9658){return _0x8d9658[_0xc9ce('0x31')](_0x5562ea)[_0xc9ce('0x1c')](function(_0x36f751){return _0x36f751;});}return null;};}function removeEntity(_0x54d7d2,_0x557709){return function(_0x491ff3){if(_0x491ff3){return _0x491ff3[_0xc9ce('0x32')]()[_0xc9ce('0x1c')](function(){var _0x6e16b5=_0x491ff3[_0xc9ce('0x33')]({'plain':!![]});var _0x3f26bd=_0xc9ce('0x34');return db['UserProfileResource'][_0xc9ce('0x32')]({'where':{'type':_0x3f26bd,'resourceId':_0x6e16b5['id']}})['then'](function(){return _0x491ff3;});})['then'](function(){_0x54d7d2['status'](0xcc)[_0xc9ce('0x28')]();});}};}function handleEntityNotFound(_0x5da34a,_0x2d6dbc){return function(_0x2a77e9){if(!_0x2a77e9){_0x5da34a['sendStatus'](0x194);}return _0x2a77e9;};}function handleError(_0x1ea5b3,_0x1aca5e){_0x1aca5e=_0x1aca5e||0x1f4;return function(_0x40306e){logger[_0xc9ce('0x21')](_0x40306e[_0xc9ce('0x35')]);if(_0x40306e[_0xc9ce('0x36')]){delete _0x40306e['name'];}_0x1ea5b3[_0xc9ce('0x27')](_0x1aca5e)[_0xc9ce('0x37')](_0x40306e);};}exports[_0xc9ce('0x38')]=function(_0x5ce38b,_0x241b1a){var _0x54e474={},_0x1c10ae={},_0x294b01={'count':0x0,'rows':[]};var _0xaa6c8f=_[_0xc9ce('0x39')](db[_0xc9ce('0x3a')][_0xc9ce('0x3b')],function(_0x4bbb7a){return{'name':_0x4bbb7a[_0xc9ce('0x3c')],'type':_0x4bbb7a[_0xc9ce('0x3d')][_0xc9ce('0x3e')]};});_0x1c10ae[_0xc9ce('0x3f')]=_['map'](_0xaa6c8f,_0xc9ce('0x36'));_0x1c10ae['query']=_[_0xc9ce('0x40')](_0x5ce38b[_0xc9ce('0x41')]);_0x1c10ae[_0xc9ce('0x42')]=_[_0xc9ce('0x43')](_0x1c10ae[_0xc9ce('0x3f')],_0x1c10ae['query']);_0x54e474[_0xc9ce('0x44')]=_[_0xc9ce('0x43')](_0x1c10ae[_0xc9ce('0x3f')],qs[_0xc9ce('0x45')](_0x5ce38b[_0xc9ce('0x41')]['fields']));_0x54e474[_0xc9ce('0x44')]=_0x54e474[_0xc9ce('0x44')]['length']?_0x54e474[_0xc9ce('0x44')]:_0x1c10ae[_0xc9ce('0x3f')];if(!_0x5ce38b['query'][_0xc9ce('0x46')](_0xc9ce('0x47'))){_0x54e474[_0xc9ce('0x2c')]=qs['limit'](_0x5ce38b[_0xc9ce('0x41')][_0xc9ce('0x2c')]);_0x54e474[_0xc9ce('0x2a')]=qs[_0xc9ce('0x2a')](_0x5ce38b['query'][_0xc9ce('0x2a')]);}_0x54e474[_0xc9ce('0x48')]=qs[_0xc9ce('0x49')](_0x5ce38b['query']['sort']);_0x54e474[_0xc9ce('0x4a')]=qs['filters'](_['pick'](_0x5ce38b[_0xc9ce('0x41')],_0x1c10ae['filters']),_0xaa6c8f);if(_0x5ce38b['query']['filter']){_0x54e474[_0xc9ce('0x4a')]=_[_0xc9ce('0x4b')](_0x54e474[_0xc9ce('0x4a')],{'$or':_['map'](_0xaa6c8f,function(_0x3f34fd){if(_0x3f34fd[_0xc9ce('0x3d')]!==_0xc9ce('0x4c')){var _0x319fa0={};_0x319fa0[_0x3f34fd['name']]={'$like':'%'+_0x5ce38b[_0xc9ce('0x41')]['filter']+'%'};return _0x319fa0;}})});}_0x54e474=_[_0xc9ce('0x4b')]({},_0x54e474,_0x5ce38b['options']);var _0x524bbf={'where':_0x54e474[_0xc9ce('0x4a')]};return db[_0xc9ce('0x3a')]['count'](_0x524bbf)[_0xc9ce('0x1c')](function(_0x21e3fe){_0x294b01['count']=_0x21e3fe;if(_0x5ce38b[_0xc9ce('0x41')][_0xc9ce('0x4d')]){_0x54e474[_0xc9ce('0x4e')]=[{'all':!![]}];}return db[_0xc9ce('0x3a')][_0xc9ce('0x4f')](_0x54e474);})[_0xc9ce('0x1c')](function(_0xe5697e){_0x294b01[_0xc9ce('0x50')]=_0xe5697e;return _0x294b01;})[_0xc9ce('0x1c')](respondWithFilteredResult(_0x241b1a,_0x54e474))[_0xc9ce('0x51')](handleError(_0x241b1a,null));};exports[_0xc9ce('0x52')]=function(_0x377943,_0x5c6aa0){var _0x28b059={'raw':![],'where':{'id':_0x377943[_0xc9ce('0x53')]['id']}},_0x40ace0={};_0x40ace0['model']=_['keys'](db[_0xc9ce('0x3a')][_0xc9ce('0x3b')]);_0x40ace0['query']=_[_0xc9ce('0x40')](_0x377943[_0xc9ce('0x41')]);_0x40ace0[_0xc9ce('0x42')]=_[_0xc9ce('0x43')](_0x40ace0[_0xc9ce('0x3f')],_0x40ace0[_0xc9ce('0x41')]);_0x28b059[_0xc9ce('0x44')]=_[_0xc9ce('0x43')](_0x40ace0[_0xc9ce('0x3f')],qs['fields'](_0x377943[_0xc9ce('0x41')]['fields']));_0x28b059[_0xc9ce('0x44')]=_0x28b059[_0xc9ce('0x44')][_0xc9ce('0x54')]?_0x28b059[_0xc9ce('0x44')]:_0x40ace0['model'];if(_0x377943['query'][_0xc9ce('0x4d')]){_0x28b059[_0xc9ce('0x4e')]=[{'all':!![]}];}_0x28b059=_[_0xc9ce('0x4b')]({},_0x28b059,_0x377943['options']);return db['VoiceContext'][_0xc9ce('0x55')](_0x28b059)[_0xc9ce('0x1c')](handleEntityNotFound(_0x5c6aa0,null))[_0xc9ce('0x1c')](respondWithResult(_0x5c6aa0,null))[_0xc9ce('0x51')](handleError(_0x5c6aa0,null));};exports[_0xc9ce('0x56')]=function(_0x3f1704,_0x44721f,_0x479df7){var _0x42ae71;return db[_0xc9ce('0x3a')][_0xc9ce('0x56')](_0x3f1704[_0xc9ce('0x57')],{'raw':!![]})[_0xc9ce('0x1c')](function(_0x5b8bd4){_0x42ae71=_0x5b8bd4;return db[_0xc9ce('0x3a')][_0xc9ce('0x4f')]({'raw':!![]});})[_0xc9ce('0x1c')](function(_0x6c3f36){var _0x58a0d8=fs[_0xc9ce('0x58')](path[_0xc9ce('0x59')](config['root'],_0xc9ce('0x5a')),_0xc9ce('0x5b'));var _0x310494=ejs[_0xc9ce('0x5c')](_0x58a0d8,{'contexts':_0x6c3f36||[]});fs[_0xc9ce('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x310494);})[_0xc9ce('0x1c')](function(){return respondWithRpcPromise(_0xc9ce('0x5e'),_0xc9ce('0x56'),{'module':_0xc9ce('0x5f')});})[_0xc9ce('0x1c')](function(){var _0x269e75=_0x3f1704['user'][_0xc9ce('0x33')]({'plain':!![]});if(!_0x269e75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x269e75[_0xc9ce('0x60')]===_0xc9ce('0x61')){var _0x62ca2f=_0x42ae71[_0xc9ce('0x33')]({'plain':!![]});return db[_0xc9ce('0x62')][_0xc9ce('0x55')]({'where':{'name':_0xc9ce('0x34'),'userProfileId':_0x269e75[_0xc9ce('0x63')]},'raw':!![]})['then'](function(_0x4da03a){if(_0x4da03a&&_0x4da03a[_0xc9ce('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x62ca2f[_0xc9ce('0x36')],'resourceId':_0x62ca2f['id'],'type':_0x4da03a[_0xc9ce('0x36')],'sectionId':_0x4da03a['id']},{})['then'](function(){return _0x42ae71;});}else{return _0x42ae71;}})['catch'](function(_0x511259){logger[_0xc9ce('0x21')](_0xc9ce('0x65'),_0x511259);throw _0x511259;});}return _0x42ae71;})[_0xc9ce('0x1c')](respondWithResult(_0x44721f,0xc9))[_0xc9ce('0x51')](handleError(_0x44721f,null));};exports['update']=function(_0x5c4a6c,_0x3e648c,_0x5e4c82){var _0x9f9de2;return db['VoiceContext'][_0xc9ce('0x55')]({'where':{'id':_0x5c4a6c['params']['id']}})[_0xc9ce('0x1c')](handleEntityNotFound(_0x3e648c,null))[_0xc9ce('0x1c')](saveUpdates(_0x5c4a6c[_0xc9ce('0x57')],null))['then'](function(_0x158e9f){if(_0x158e9f){_0x9f9de2=_0x158e9f;return db[_0xc9ce('0x3a')][_0xc9ce('0x4f')]({'raw':!![]});}})['then'](function(_0x45033d){var _0x21a409=fs[_0xc9ce('0x58')](path['join'](config[_0xc9ce('0x66')],_0xc9ce('0x5a')),_0xc9ce('0x5b'));var _0x5b453a=ejs[_0xc9ce('0x5c')](_0x21a409,{'contexts':_0x45033d||[]});fs[_0xc9ce('0x5d')](_0xc9ce('0x67'),_0x5b453a);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});})['then'](function(){return _0x9f9de2;})[_0xc9ce('0x1c')](respondWithResult(_0x3e648c,null))[_0xc9ce('0x51')](handleError(_0x3e648c,null));};exports[_0xc9ce('0x32')]=function(_0x22a17f,_0x37437e,_0x36a5bc){var _0x14a73a;return db[_0xc9ce('0x3a')][_0xc9ce('0x55')]({'where':{'id':_0x22a17f[_0xc9ce('0x53')]['id']}})[_0xc9ce('0x1c')](handleEntityNotFound(_0x37437e,null))[_0xc9ce('0x1c')](removeEntity(_0x37437e,null))[_0xc9ce('0x1c')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xc9ce('0x1c')](function(_0x42b2ce){var _0x4cf5bb=fs[_0xc9ce('0x58')](path[_0xc9ce('0x59')](config[_0xc9ce('0x66')],_0xc9ce('0x5a')),_0xc9ce('0x5b'));var _0x18b76d=ejs[_0xc9ce('0x5c')](_0x4cf5bb,{'contexts':_0x42b2ce});fs[_0xc9ce('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x18b76d);return respondWithRpcPromise(_0xc9ce('0x5e'),_0xc9ce('0x32'),{'module':_0xc9ce('0x5f')});})[_0xc9ce('0x51')](handleError(_0x37437e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6b21ea2..63faea1 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 _0x9b37=['exports','define','voice_contexts','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x144f27,_0x47a2c5){var _0x2df030=function(_0x51b2ca){while(--_0x51b2ca){_0x144f27['push'](_0x144f27['shift']());}};_0x2df030(++_0x47a2c5);}(_0x9b37,0x184));var _0x79b3=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x9b37[_0x487ab4];return _0x3bef77;};'use strict';var _=require(_0x79b3('0x0'));var util=require(_0x79b3('0x1'));var logger=require(_0x79b3('0x2'))('api');var moment=require(_0x79b3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x79b3('0x4'));var rimraf=require(_0x79b3('0x5'));var config=require(_0x79b3('0x6'));var attributes=require(_0x79b3('0x7'));module[_0x79b3('0x8')]=function(_0x26c229,_0x12c947){return _0x26c229[_0x79b3('0x9')]('VoiceContext',attributes,{'tableName':_0x79b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff01=['rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xff01,0x130));var _0x1ff0=function(_0x3bc8c8,_0x2fe62f){_0x3bc8c8=_0x3bc8c8-0x0;var _0x36e987=_0xff01[_0x3bc8c8];return _0x36e987;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var logger=require(_0x1ff0('0x2'))(_0x1ff0('0x3'));var moment=require(_0x1ff0('0x4'));var BPromise=require(_0x1ff0('0x5'));var rp=require(_0x1ff0('0x6'));var fs=require('fs');var path=require(_0x1ff0('0x7'));var rimraf=require(_0x1ff0('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ff0('0x9'));module['exports']=function(_0x34c0f2,_0x43d97b){return _0x34c0f2[_0x1ff0('0xa')](_0x1ff0('0xb'),attributes,{'tableName':_0x1ff0('0xc'),'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 fd7d021..83f8fe1 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 _0xcd4d=['http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x19f483,_0x5e45c9){_0x19f483=_0x19f483-0x0;var _0x44cf95=_0xcd4d[_0x19f483];return _0x44cf95;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require(_0xdcd4('0x6'));var logger=require(_0xdcd4('0x7'))(_0xdcd4('0x8'));var config=require(_0xdcd4('0x9'));var jayson=require(_0xdcd4('0xa'));var client=jayson[_0xdcd4('0xb')][_0xdcd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302b60,_0x5b57f6,_0x17f848){return new BPromise(function(_0x198d6c,_0xc0cf59){return client['request'](_0x302b60,_0x17f848)[_0xdcd4('0xd')](function(_0x3cae6d){logger['info'](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));logger[_0xdcd4('0x10')](_0xdcd4('0x11'),_0x5b57f6,_0xdcd4('0xf'),JSON['stringify'](_0x3cae6d));if(_0x3cae6d[_0xdcd4('0x12')]){if(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x13')]===0x1f4){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error'][_0xdcd4('0x14')]);return _0xc0cf59(_0x3cae6d[_0xdcd4('0x12')]['message']);}logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error']['message']);return _0x198d6c(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x14')]);}else{logger[_0xdcd4('0x15')](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));_0x198d6c(_0x3cae6d[_0xdcd4('0x16')][_0xdcd4('0x14')]);}})[_0xdcd4('0x17')](function(_0xf57175){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0xf57175);_0xc0cf59(_0xf57175);});});} \ No newline at end of file +var _0xc04a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment'];(function(_0x250efc,_0x3d1afb){var _0x5bff28=function(_0x197a15){while(--_0x197a15){_0x250efc['push'](_0x250efc['shift']());}};_0x5bff28(++_0x3d1afb);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac04('0x0'));var util=require('util');var moment=require(_0xac04('0x1'));var BPromise=require('bluebird');var rs=require(_0xac04('0x2'));var fs=require('fs');var Redis=require(_0xac04('0x3'));var db=require(_0xac04('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac04('0x5'))(_0xac04('0x6'));var config=require(_0xac04('0x7'));var jayson=require(_0xac04('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f51d2,_0x4dab26,_0x2a6b1f){return new BPromise(function(_0x2f0311,_0xf1aed7){return client[_0xac04('0x9')](_0x4f51d2,_0x2a6b1f)[_0xac04('0xa')](function(_0x196ad0){logger[_0xac04('0xb')](_0xac04('0xc'),_0x4dab26,_0xac04('0xd'));logger['debug'](_0xac04('0xe'),_0x4dab26,'request\x20sent',JSON[_0xac04('0xf')](_0x196ad0));if(_0x196ad0[_0xac04('0x10')]){if(_0x196ad0[_0xac04('0x10')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4dab26,_0x196ad0['error'][_0xac04('0x11')]);return _0xf1aed7(_0x196ad0[_0xac04('0x10')][_0xac04('0x11')]);}logger['error'](_0xac04('0xc'),_0x4dab26,_0x196ad0[_0xac04('0x10')]['message']);return _0x2f0311(_0x196ad0[_0xac04('0x10')][_0xac04('0x11')]);}else{logger['info'](_0xac04('0xc'),_0x4dab26,_0xac04('0xd'));_0x2f0311(_0x196ad0['result']['message']);}})[_0xac04('0x12')](function(_0x592da0){logger[_0xac04('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4dab26,_0x592da0);_0xf1aed7(_0x592da0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 7c5c678..9054eef 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 _0x6f74=['./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x44281c,_0x46437f){var _0x209a89=function(_0x59e165){while(--_0x59e165){_0x44281c['push'](_0x44281c['shift']());}};_0x209a89(++_0x46437f);}(_0x6f74,0x16f));var _0x46f7=function(_0x40c760,_0x156f78){_0x40c760=_0x40c760-0x0;var _0x3fa39a=_0x6f74[_0x40c760];return _0x3fa39a;};'use strict';var multer=require(_0x46f7('0x0'));var util=require(_0x46f7('0x1'));var path=require('path');var timeout=require(_0x46f7('0x2'));var express=require(_0x46f7('0x3'));var router=express[_0x46f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46f7('0x5'));var interaction=require(_0x46f7('0x6'));var config=require('../../config/environment');var controller=require(_0x46f7('0x7'));router[_0x46f7('0x8')]('/',auth['isAuthenticated'](),controller[_0x46f7('0x9')]);router['get'](_0x46f7('0xa'),auth[_0x46f7('0xb')](),controller[_0x46f7('0xc')]);router[_0x46f7('0x8')](_0x46f7('0xd'),auth[_0x46f7('0xb')](),controller[_0x46f7('0xe')]);router[_0x46f7('0xf')]('/',auth['isAuthenticated'](),controller[_0x46f7('0x10')]);router[_0x46f7('0x11')]('/:id',auth[_0x46f7('0xb')](),controller[_0x46f7('0x12')]);router[_0x46f7('0x13')](_0x46f7('0xd'),auth[_0x46f7('0xb')](),controller[_0x46f7('0x14')]);module[_0x46f7('0x15')]=router; \ No newline at end of file +var _0x55da=['/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x5a1b43,_0x104412){var _0x26930b=function(_0x37929){while(--_0x37929){_0x5a1b43['push'](_0x5a1b43['shift']());}};_0x26930b(++_0x104412);}(_0x55da,0x16f));var _0xa55d=function(_0x3d8304,_0x3a115c){_0x3d8304=_0x3d8304-0x0;var _0x1ca763=_0x55da[_0x3d8304];return _0x1ca763;};'use strict';var multer=require('multer');var util=require(_0xa55d('0x0'));var path=require(_0xa55d('0x1'));var timeout=require(_0xa55d('0x2'));var express=require(_0xa55d('0x3'));var router=express[_0xa55d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa55d('0x5'));var interaction=require(_0xa55d('0x6'));var config=require(_0xa55d('0x7'));var controller=require('./voiceDialReport.controller');router[_0xa55d('0x8')]('/',auth[_0xa55d('0x9')](),controller[_0xa55d('0xa')]);router[_0xa55d('0x8')](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller[_0xa55d('0xc')]);router[_0xa55d('0x8')](_0xa55d('0xd'),auth['isAuthenticated'](),controller[_0xa55d('0xe')]);router[_0xa55d('0xf')]('/',auth[_0xa55d('0x9')](),controller[_0xa55d('0x10')]);router['put'](_0xa55d('0xd'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x11')]);router[_0xa55d('0x12')](_0xa55d('0xd'),auth[_0xa55d('0x9')](),controller['destroy']);module[_0xa55d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0e14cf8..3b75783 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 _0xe14d=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xe14d,0x1ee));var _0xde14=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xe14d[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'privilege':{'type':Sequelize[_0xde14('0x2')]},'channel':{'type':Sequelize[_0xde14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'calleridnum':{'type':Sequelize[_0xde14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'connectedlinename':{'type':Sequelize[_0xde14('0x2')]},'language':{'type':Sequelize[_0xde14('0x2')]},'accountcode':{'type':Sequelize[_0xde14('0x2')]},'context':{'type':Sequelize[_0xde14('0x2')]},'exten':{'type':Sequelize[_0xde14('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xde14('0x2')]},'destchannel':{'type':Sequelize[_0xde14('0x2')]},'destchannelstate':{'type':Sequelize[_0xde14('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde14('0x2')]},'destcalleridname':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xde14('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xde14('0x2')]},'destcontext':{'type':Sequelize[_0xde14('0x2')]},'destexten':{'type':Sequelize[_0xde14('0x2')]},'destpriority':{'type':Sequelize[_0xde14('0x3')]},'destuniqueid':{'type':Sequelize[_0xde14('0x2')]},'destlinkedid':{'type':Sequelize[_0xde14('0x2')]},'dialstring':{'type':Sequelize[_0xde14('0x2')]},'dialstatus':{'type':Sequelize[_0xde14('0x2')]},'starttime':{'type':Sequelize[_0xde14('0x4')]},'answertime':{'type':Sequelize[_0xde14('0x4')]},'endtime':{'type':Sequelize[_0xde14('0x4')]},'lastevent':{'type':Sequelize[_0xde14('0x2')],'comment':_0xde14('0x5')},'routeId':{'type':Sequelize[_0xde14('0x3')]},'duration':{'type':Sequelize[_0xde14('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3bebfd,_0x3f9c83){_0x3bebfd=_0x3bebfd-0x0;var _0x57c216=_0x8ef6[_0x3bebfd];return _0x57c216;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9dacc69..4c1046a 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 _0xf1b0=['offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count'];(function(_0x16e824,_0x23ab90){var _0x1745ea=function(_0x327e55){while(--_0x327e55){_0x16e824['push'](_0x16e824['shift']());}};_0x1745ea(++_0x23ab90);}(_0xf1b0,0x1c0));var _0x0f1b=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xf1b0[_0x54ea7a];return _0x65a10d;};'use strict';var emlformat=require(_0x0f1b('0x0'));var rimraf=require(_0x0f1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f1b('0x2'));var moment=require(_0x0f1b('0x3'));var BPromise=require(_0x0f1b('0x4'));var Mustache=require(_0x0f1b('0x5'));var util=require(_0x0f1b('0x6'));var path=require(_0x0f1b('0x7'));var sox=require(_0x0f1b('0x8'));var csv=require(_0x0f1b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f1b('0xa'));var _=require(_0x0f1b('0xb'));var squel=require(_0x0f1b('0xc'));var crypto=require(_0x0f1b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f1b('0xe'));var toCsv=require(_0x0f1b('0x9'));var querystring=require(_0x0f1b('0xf'));var Papa=require(_0x0f1b('0x10'));var Redis=require(_0x0f1b('0x11'));var authService=require(_0x0f1b('0x12'));var qs=require(_0x0f1b('0x13'));var as=require(_0x0f1b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f1b('0x15'))(_0x0f1b('0x16'));var utils=require(_0x0f1b('0x17'));var config=require(_0x0f1b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f1b('0x19'))['db'];function respondWithStatusCode(_0x3284cb,_0x78549c){_0x78549c=_0x78549c||0xcc;return function(_0x11fc33){if(_0x11fc33){return _0x3284cb['sendStatus'](_0x78549c);}return _0x3284cb[_0x0f1b('0x1a')](_0x78549c)[_0x0f1b('0x1b')]();};}function respondWithResult(_0xb17499,_0x1a1a2e){_0x1a1a2e=_0x1a1a2e||0xc8;return function(_0x1e64e1){if(_0x1e64e1){return _0xb17499[_0x0f1b('0x1a')](_0x1a1a2e)[_0x0f1b('0x1c')](_0x1e64e1);}};}function respondWithFilteredResult(_0x35c48f,_0x549c7b){return function(_0x5151e0){if(_0x5151e0){var _0xc8724b=typeof _0x549c7b['offset']===_0x0f1b('0x1d')&&typeof _0x549c7b[_0x0f1b('0x1e')]===_0x0f1b('0x1d');var _0x108096=_0x5151e0[_0x0f1b('0x1f')];var _0x1c1dd1=_0xc8724b?0x0:_0x549c7b[_0x0f1b('0x20')];var _0x4325dc=_0xc8724b?_0x5151e0[_0x0f1b('0x1f')]:_0x549c7b['offset']+_0x549c7b[_0x0f1b('0x1e')];var _0x2bbed4;if(_0x4325dc>=_0x108096){_0x4325dc=_0x108096;_0x2bbed4=0xc8;}else{_0x2bbed4=0xce;}_0x35c48f[_0x0f1b('0x1a')](_0x2bbed4);return _0x35c48f[_0x0f1b('0x21')](_0x0f1b('0x22'),_0x1c1dd1+'-'+_0x4325dc+'/'+_0x108096)['json'](_0x5151e0);}return null;};}function patchUpdates(_0x564108){return function(_0x3ed582){try{jsonpatch[_0x0f1b('0x23')](_0x3ed582,_0x564108,!![]);}catch(_0x2c6053){return BPromise[_0x0f1b('0x24')](_0x2c6053);}return _0x3ed582[_0x0f1b('0x25')]();};}function saveUpdates(_0x21460f,_0x1b34df){return function(_0x53e5d9){if(_0x53e5d9){return _0x53e5d9[_0x0f1b('0x26')](_0x21460f)[_0x0f1b('0x27')](function(_0x116b2b){return _0x116b2b;});}return null;};}function removeEntity(_0x2e4638,_0x6990c7){return function(_0x44dcf4){if(_0x44dcf4){return _0x44dcf4['destroy']()['then'](function(){_0x2e4638[_0x0f1b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab6bd,_0x1a878f){return function(_0x4fc4a7){if(!_0x4fc4a7){_0x5ab6bd[_0x0f1b('0x28')](0x194);}return _0x4fc4a7;};}function handleError(_0x4d090f,_0x4c99d4){_0x4c99d4=_0x4c99d4||0x1f4;return function(_0x3d742){logger[_0x0f1b('0x29')](_0x3d742[_0x0f1b('0x2a')]);if(_0x3d742[_0x0f1b('0x2b')]){delete _0x3d742['name'];}_0x4d090f['status'](_0x4c99d4)[_0x0f1b('0x2c')](_0x3d742);};}exports[_0x0f1b('0x2d')]=function(_0x14a216,_0x4caa59){var _0x4c0aed={},_0x31db86={},_0x1192c9={'count':0x0,'rows':[]};var _0x4371a1=_['map'](db[_0x0f1b('0x2e')][_0x0f1b('0x2f')],function(_0x493a3b){return{'name':_0x493a3b[_0x0f1b('0x30')],'type':_0x493a3b[_0x0f1b('0x31')][_0x0f1b('0x32')]};});_0x31db86[_0x0f1b('0x33')]=_['map'](_0x4371a1,'name');_0x31db86['query']=_[_0x0f1b('0x34')](_0x14a216[_0x0f1b('0x35')]);_0x31db86[_0x0f1b('0x36')]=_[_0x0f1b('0x37')](_0x31db86[_0x0f1b('0x33')],_0x31db86['query']);_0x4c0aed[_0x0f1b('0x38')]=_[_0x0f1b('0x37')](_0x31db86[_0x0f1b('0x33')],qs[_0x0f1b('0x39')](_0x14a216[_0x0f1b('0x35')][_0x0f1b('0x39')]));_0x4c0aed[_0x0f1b('0x38')]=_0x4c0aed[_0x0f1b('0x38')][_0x0f1b('0x3a')]?_0x4c0aed[_0x0f1b('0x38')]:_0x31db86[_0x0f1b('0x33')];if(!_0x14a216[_0x0f1b('0x35')][_0x0f1b('0x3b')](_0x0f1b('0x3c'))){_0x4c0aed[_0x0f1b('0x1e')]=qs[_0x0f1b('0x1e')](_0x14a216[_0x0f1b('0x35')]['limit']);_0x4c0aed[_0x0f1b('0x20')]=qs[_0x0f1b('0x20')](_0x14a216[_0x0f1b('0x35')][_0x0f1b('0x20')]);}_0x4c0aed[_0x0f1b('0x3d')]=qs[_0x0f1b('0x3e')](_0x14a216[_0x0f1b('0x35')][_0x0f1b('0x3e')]);_0x4c0aed[_0x0f1b('0x3f')]=qs[_0x0f1b('0x36')](_[_0x0f1b('0x40')](_0x14a216[_0x0f1b('0x35')],_0x31db86[_0x0f1b('0x36')]),_0x4371a1);if(_0x14a216['query'][_0x0f1b('0x41')]){_0x4c0aed[_0x0f1b('0x3f')]=_[_0x0f1b('0x42')](_0x4c0aed[_0x0f1b('0x3f')],{'$or':_[_0x0f1b('0x43')](_0x4371a1,function(_0x49fc49){if(_0x49fc49[_0x0f1b('0x31')]!==_0x0f1b('0x44')){var _0x5394ac={};_0x5394ac[_0x49fc49['name']]={'$like':'%'+_0x14a216[_0x0f1b('0x35')][_0x0f1b('0x41')]+'%'};return _0x5394ac;}})});}_0x4c0aed=_['merge']({},_0x4c0aed,_0x14a216[_0x0f1b('0x45')]);var _0x19d512={'where':_0x4c0aed[_0x0f1b('0x3f')]};return db[_0x0f1b('0x2e')][_0x0f1b('0x1f')](_0x19d512)['then'](function(_0x325383){_0x1192c9[_0x0f1b('0x1f')]=_0x325383;if(_0x14a216[_0x0f1b('0x35')][_0x0f1b('0x46')]){_0x4c0aed[_0x0f1b('0x47')]=[{'all':!![]}];}return db[_0x0f1b('0x2e')][_0x0f1b('0x48')](_0x4c0aed);})[_0x0f1b('0x27')](function(_0x183209){_0x1192c9[_0x0f1b('0x49')]=_0x183209;return _0x1192c9;})[_0x0f1b('0x27')](respondWithFilteredResult(_0x4caa59,_0x4c0aed))[_0x0f1b('0x4a')](handleError(_0x4caa59,null));};exports['show']=function(_0x1b2027,_0x121487){var _0x1bf39b={'raw':!![],'where':{'id':_0x1b2027[_0x0f1b('0x4b')]['id']}},_0x466fa1={};_0x466fa1[_0x0f1b('0x33')]=_[_0x0f1b('0x34')](db['VoiceDialReport'][_0x0f1b('0x2f')]);_0x466fa1['query']=_['keys'](_0x1b2027[_0x0f1b('0x35')]);_0x466fa1['filters']=_[_0x0f1b('0x37')](_0x466fa1[_0x0f1b('0x33')],_0x466fa1[_0x0f1b('0x35')]);_0x1bf39b[_0x0f1b('0x38')]=_[_0x0f1b('0x37')](_0x466fa1[_0x0f1b('0x33')],qs[_0x0f1b('0x39')](_0x1b2027[_0x0f1b('0x35')][_0x0f1b('0x39')]));_0x1bf39b[_0x0f1b('0x38')]=_0x1bf39b['attributes'][_0x0f1b('0x3a')]?_0x1bf39b['attributes']:_0x466fa1[_0x0f1b('0x33')];if(_0x1b2027['query'][_0x0f1b('0x46')]){_0x1bf39b['include']=[{'all':!![]}];}_0x1bf39b=_[_0x0f1b('0x42')]({},_0x1bf39b,_0x1b2027[_0x0f1b('0x45')]);return db[_0x0f1b('0x2e')][_0x0f1b('0x4c')](_0x1bf39b)[_0x0f1b('0x27')](handleEntityNotFound(_0x121487,null))['then'](respondWithResult(_0x121487,null))[_0x0f1b('0x4a')](handleError(_0x121487,null));};exports[_0x0f1b('0x4d')]=function(_0x4497aa,_0x4788ff){return db[_0x0f1b('0x2e')]['create'](_0x4497aa[_0x0f1b('0x4e')],{})[_0x0f1b('0x27')](respondWithResult(_0x4788ff,0xc9))['catch'](handleError(_0x4788ff,null));};exports[_0x0f1b('0x26')]=function(_0x304aed,_0x11577b){if(_0x304aed['body']['id']){delete _0x304aed[_0x0f1b('0x4e')]['id'];}return db['VoiceDialReport'][_0x0f1b('0x4c')]({'where':{'id':_0x304aed['params']['id']}})[_0x0f1b('0x27')](handleEntityNotFound(_0x11577b,null))[_0x0f1b('0x27')](saveUpdates(_0x304aed['body'],null))[_0x0f1b('0x27')](respondWithResult(_0x11577b,null))['catch'](handleError(_0x11577b,null));};exports['destroy']=function(_0x962404,_0x26cd2a){return db[_0x0f1b('0x2e')][_0x0f1b('0x4c')]({'where':{'id':_0x962404[_0x0f1b('0x4b')]['id']}})[_0x0f1b('0x27')](handleEntityNotFound(_0x26cd2a,null))[_0x0f1b('0x27')](removeEntity(_0x26cd2a,null))[_0x0f1b('0x4a')](handleError(_0x26cd2a,null));};exports['describe']=function(_0x3ece43,_0x5baed8){return db[_0x0f1b('0x2e')][_0x0f1b('0x4f')]()[_0x0f1b('0x27')](respondWithResult(_0x5baed8,null))[_0x0f1b('0x4a')](handleError(_0x5baed8,null));}; \ No newline at end of file +var _0x3ec3=['api','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','error','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2e1730,_0x5560db){var _0x22019f=function(_0x2b85a7){while(--_0x2b85a7){_0x2e1730['push'](_0x2e1730['shift']());}};_0x22019f(++_0x5560db);}(_0x3ec3,0x1ca));var _0x33ec=function(_0x2a5e62,_0x432b27){_0x2a5e62=_0x2a5e62-0x0;var _0x1b4cab=_0x3ec3[_0x2a5e62];return _0x1b4cab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33ec('0x0'));var zipdir=require(_0x33ec('0x1'));var jsonpatch=require(_0x33ec('0x2'));var rp=require(_0x33ec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x33ec('0x4'));var util=require(_0x33ec('0x5'));var path=require('path');var sox=require(_0x33ec('0x6'));var csv=require(_0x33ec('0x7'));var ejs=require(_0x33ec('0x8'));var fs=require('fs');var fs_extra=require(_0x33ec('0x9'));var _=require(_0x33ec('0xa'));var squel=require(_0x33ec('0xb'));var crypto=require('crypto');var jsforce=require(_0x33ec('0xc'));var deskjs=require(_0x33ec('0xd'));var toCsv=require(_0x33ec('0x7'));var querystring=require(_0x33ec('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x33ec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x33ec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33ec('0x11'))(_0x33ec('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23becf,_0x35d487){_0x35d487=_0x35d487||0xcc;return function(_0x4d5b86){if(_0x4d5b86){return _0x23becf[_0x33ec('0x13')](_0x35d487);}return _0x23becf[_0x33ec('0x14')](_0x35d487)[_0x33ec('0x15')]();};}function respondWithResult(_0xcea51a,_0x37d93f){_0x37d93f=_0x37d93f||0xc8;return function(_0x5e6552){if(_0x5e6552){return _0xcea51a[_0x33ec('0x14')](_0x37d93f)['json'](_0x5e6552);}};}function respondWithFilteredResult(_0x30b434,_0x30880d){return function(_0x392610){if(_0x392610){var _0x50c6e3=typeof _0x30880d[_0x33ec('0x16')]==='undefined'&&typeof _0x30880d['limit']===_0x33ec('0x17');var _0x125640=_0x392610['count'];var _0x4190ca=_0x50c6e3?0x0:_0x30880d['offset'];var _0x326c98=_0x50c6e3?_0x392610[_0x33ec('0x18')]:_0x30880d['offset']+_0x30880d[_0x33ec('0x19')];var _0x235fc0;if(_0x326c98>=_0x125640){_0x326c98=_0x125640;_0x235fc0=0xc8;}else{_0x235fc0=0xce;}_0x30b434[_0x33ec('0x14')](_0x235fc0);return _0x30b434[_0x33ec('0x1a')](_0x33ec('0x1b'),_0x4190ca+'-'+_0x326c98+'/'+_0x125640)[_0x33ec('0x1c')](_0x392610);}return null;};}function patchUpdates(_0x57b79b){return function(_0x310a87){try{jsonpatch['apply'](_0x310a87,_0x57b79b,!![]);}catch(_0x32ef87){return BPromise[_0x33ec('0x1d')](_0x32ef87);}return _0x310a87[_0x33ec('0x1e')]();};}function saveUpdates(_0x293e54,_0x390e8a){return function(_0x57a08c){if(_0x57a08c){return _0x57a08c[_0x33ec('0x1f')](_0x293e54)['then'](function(_0x4266ea){return _0x4266ea;});}return null;};}function removeEntity(_0x48d7c2,_0x4c7aa3){return function(_0x583b08){if(_0x583b08){return _0x583b08[_0x33ec('0x20')]()[_0x33ec('0x21')](function(){_0x48d7c2[_0x33ec('0x14')](0xcc)[_0x33ec('0x15')]();});}};}function handleEntityNotFound(_0x570322,_0x1807a8){return function(_0x2fca90){if(!_0x2fca90){_0x570322[_0x33ec('0x13')](0x194);}return _0x2fca90;};}function handleError(_0x3f352c,_0x2bf6a6){_0x2bf6a6=_0x2bf6a6||0x1f4;return function(_0x312feb){logger[_0x33ec('0x22')](_0x312feb['stack']);if(_0x312feb['name']){delete _0x312feb['name'];}_0x3f352c[_0x33ec('0x14')](_0x2bf6a6)['send'](_0x312feb);};}exports[_0x33ec('0x23')]=function(_0x4d82ae,_0x595963){var _0x5d08e7={},_0x39a825={},_0x124e63={'count':0x0,'rows':[]};var _0x567ebb=_[_0x33ec('0x24')](db[_0x33ec('0x25')][_0x33ec('0x26')],function(_0x50ac39){return{'name':_0x50ac39[_0x33ec('0x27')],'type':_0x50ac39[_0x33ec('0x28')][_0x33ec('0x29')]};});_0x39a825['model']=_[_0x33ec('0x24')](_0x567ebb,_0x33ec('0x2a'));_0x39a825[_0x33ec('0x2b')]=_[_0x33ec('0x2c')](_0x4d82ae[_0x33ec('0x2b')]);_0x39a825[_0x33ec('0x2d')]=_[_0x33ec('0x2e')](_0x39a825['model'],_0x39a825[_0x33ec('0x2b')]);_0x5d08e7['attributes']=_[_0x33ec('0x2e')](_0x39a825[_0x33ec('0x2f')],qs[_0x33ec('0x30')](_0x4d82ae['query'][_0x33ec('0x30')]));_0x5d08e7['attributes']=_0x5d08e7[_0x33ec('0x31')]['length']?_0x5d08e7[_0x33ec('0x31')]:_0x39a825[_0x33ec('0x2f')];if(!_0x4d82ae[_0x33ec('0x2b')]['hasOwnProperty'](_0x33ec('0x32'))){_0x5d08e7[_0x33ec('0x19')]=qs[_0x33ec('0x19')](_0x4d82ae[_0x33ec('0x2b')]['limit']);_0x5d08e7[_0x33ec('0x16')]=qs[_0x33ec('0x16')](_0x4d82ae['query'][_0x33ec('0x16')]);}_0x5d08e7['order']=qs[_0x33ec('0x33')](_0x4d82ae[_0x33ec('0x2b')][_0x33ec('0x33')]);_0x5d08e7['where']=qs['filters'](_[_0x33ec('0x34')](_0x4d82ae[_0x33ec('0x2b')],_0x39a825[_0x33ec('0x2d')]),_0x567ebb);if(_0x4d82ae[_0x33ec('0x2b')]['filter']){_0x5d08e7[_0x33ec('0x35')]=_['merge'](_0x5d08e7['where'],{'$or':_['map'](_0x567ebb,function(_0x4ae3fa){if(_0x4ae3fa[_0x33ec('0x28')]!==_0x33ec('0x36')){var _0x23d068={};_0x23d068[_0x4ae3fa['name']]={'$like':'%'+_0x4d82ae[_0x33ec('0x2b')][_0x33ec('0x37')]+'%'};return _0x23d068;}})});}_0x5d08e7=_[_0x33ec('0x38')]({},_0x5d08e7,_0x4d82ae[_0x33ec('0x39')]);var _0x478a2a={'where':_0x5d08e7[_0x33ec('0x35')]};return db[_0x33ec('0x25')]['count'](_0x478a2a)[_0x33ec('0x21')](function(_0x772ff){_0x124e63[_0x33ec('0x18')]=_0x772ff;if(_0x4d82ae[_0x33ec('0x2b')]['includeAll']){_0x5d08e7[_0x33ec('0x3a')]=[{'all':!![]}];}return db[_0x33ec('0x25')][_0x33ec('0x3b')](_0x5d08e7);})['then'](function(_0x11356d){_0x124e63[_0x33ec('0x3c')]=_0x11356d;return _0x124e63;})['then'](respondWithFilteredResult(_0x595963,_0x5d08e7))[_0x33ec('0x3d')](handleError(_0x595963,null));};exports['show']=function(_0x51d3fd,_0x59b9a1){var _0x3fa286={'raw':!![],'where':{'id':_0x51d3fd[_0x33ec('0x3e')]['id']}},_0x3d2703={};_0x3d2703[_0x33ec('0x2f')]=_[_0x33ec('0x2c')](db[_0x33ec('0x25')][_0x33ec('0x26')]);_0x3d2703[_0x33ec('0x2b')]=_[_0x33ec('0x2c')](_0x51d3fd['query']);_0x3d2703['filters']=_[_0x33ec('0x2e')](_0x3d2703[_0x33ec('0x2f')],_0x3d2703[_0x33ec('0x2b')]);_0x3fa286[_0x33ec('0x31')]=_['intersection'](_0x3d2703['model'],qs[_0x33ec('0x30')](_0x51d3fd[_0x33ec('0x2b')][_0x33ec('0x30')]));_0x3fa286[_0x33ec('0x31')]=_0x3fa286[_0x33ec('0x31')]['length']?_0x3fa286[_0x33ec('0x31')]:_0x3d2703['model'];if(_0x51d3fd[_0x33ec('0x2b')][_0x33ec('0x3f')]){_0x3fa286[_0x33ec('0x3a')]=[{'all':!![]}];}_0x3fa286=_[_0x33ec('0x38')]({},_0x3fa286,_0x51d3fd[_0x33ec('0x39')]);return db[_0x33ec('0x25')][_0x33ec('0x40')](_0x3fa286)[_0x33ec('0x21')](handleEntityNotFound(_0x59b9a1,null))[_0x33ec('0x21')](respondWithResult(_0x59b9a1,null))[_0x33ec('0x3d')](handleError(_0x59b9a1,null));};exports[_0x33ec('0x41')]=function(_0x3a06a8,_0x2d09b0){return db[_0x33ec('0x25')][_0x33ec('0x41')](_0x3a06a8[_0x33ec('0x42')],{})[_0x33ec('0x21')](respondWithResult(_0x2d09b0,0xc9))[_0x33ec('0x3d')](handleError(_0x2d09b0,null));};exports['update']=function(_0x143047,_0x47fdf8){if(_0x143047[_0x33ec('0x42')]['id']){delete _0x143047[_0x33ec('0x42')]['id'];}return db[_0x33ec('0x25')][_0x33ec('0x40')]({'where':{'id':_0x143047[_0x33ec('0x3e')]['id']}})[_0x33ec('0x21')](handleEntityNotFound(_0x47fdf8,null))[_0x33ec('0x21')](saveUpdates(_0x143047[_0x33ec('0x42')],null))[_0x33ec('0x21')](respondWithResult(_0x47fdf8,null))[_0x33ec('0x3d')](handleError(_0x47fdf8,null));};exports[_0x33ec('0x20')]=function(_0x5a4b1f,_0x2962d1){return db[_0x33ec('0x25')][_0x33ec('0x40')]({'where':{'id':_0x5a4b1f[_0x33ec('0x3e')]['id']}})[_0x33ec('0x21')](handleEntityNotFound(_0x2962d1,null))[_0x33ec('0x21')](removeEntity(_0x2962d1,null))['catch'](handleError(_0x2962d1,null));};exports[_0x33ec('0x43')]=function(_0x4570c8,_0x393580){return db[_0x33ec('0x25')][_0x33ec('0x43')]()[_0x33ec('0x21')](respondWithResult(_0x393580,null))['catch'](handleError(_0x393580,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 774c2e2..9b6785b 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 _0x84e7=['report_dial','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x84e7,0x122));var _0x784e=function(_0x2f86d2,_0x56aeda){_0x2f86d2=_0x2f86d2-0x0;var _0x5422da=_0x84e7[_0x2f86d2];return _0x5422da;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('VoiceDialReport',attributes,{'tableName':_0x784e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x784e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b27=['define','VoiceDialReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x612229,_0x136063){var _0x3f494c=function(_0x30728d){while(--_0x30728d){_0x612229['push'](_0x612229['shift']());}};_0x3f494c(++_0x136063);}(_0x6b27,0xc3));var _0x76b2=function(_0x50ce54,_0x11140e){_0x50ce54=_0x50ce54-0x0;var _0x1e509c=_0x6b27[_0x50ce54];return _0x1e509c;};'use strict';var _=require(_0x76b2('0x0'));var util=require('util');var logger=require(_0x76b2('0x1'))(_0x76b2('0x2'));var moment=require(_0x76b2('0x3'));var BPromise=require(_0x76b2('0x4'));var rp=require(_0x76b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76b2('0x6'));var config=require(_0x76b2('0x7'));var attributes=require(_0x76b2('0x8'));module['exports']=function(_0x4e50cc,_0x19443f){return _0x4e50cc[_0x76b2('0x9')](_0x76b2('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x76b2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6fd75ba..f9d7ca7 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 _0x5ae0=['request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','create','options','info','UpdateVoiceDialReport','update','body','raw','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0x5ae0,0x15f));var _0x05ae=function(_0x2fc231,_0x5da34f){_0x2fc231=_0x2fc231-0x0;var _0x5843f6=_0x5ae0[_0x2fc231];return _0x5843f6;};'use strict';var _=require(_0x05ae('0x0'));var util=require(_0x05ae('0x1'));var moment=require(_0x05ae('0x2'));var BPromise=require(_0x05ae('0x3'));var rs=require(_0x05ae('0x4'));var fs=require('fs');var Redis=require(_0x05ae('0x5'));var db=require(_0x05ae('0x6'))['db'];var utils=require(_0x05ae('0x7'));var logger=require(_0x05ae('0x8'))('rpc');var config=require(_0x05ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x05ae('0xa')][_0x05ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3430b1,_0x5bd0f4,_0x35f162){return new BPromise(function(_0x3cc0c3,_0x2d5a23){return client[_0x05ae('0xc')](_0x3430b1,_0x35f162)[_0x05ae('0xd')](function(_0x3e9b61){logger['info'](_0x05ae('0xe'),_0x5bd0f4,_0x05ae('0xf'));logger['debug'](_0x05ae('0x10'),_0x5bd0f4,_0x05ae('0xf'),JSON['stringify'](_0x3e9b61));if(_0x3e9b61['error']){if(_0x3e9b61[_0x05ae('0x11')][_0x05ae('0x12')]===0x1f4){logger[_0x05ae('0x11')](_0x05ae('0xe'),_0x5bd0f4,_0x3e9b61['error'][_0x05ae('0x13')]);return _0x2d5a23(_0x3e9b61[_0x05ae('0x11')][_0x05ae('0x13')]);}logger[_0x05ae('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x5bd0f4,_0x3e9b61[_0x05ae('0x11')][_0x05ae('0x13')]);return _0x3cc0c3(_0x3e9b61['error'][_0x05ae('0x13')]);}else{logger['info'](_0x05ae('0xe'),_0x5bd0f4,_0x05ae('0xf'));_0x3cc0c3(_0x3e9b61[_0x05ae('0x14')][_0x05ae('0x13')]);}})[_0x05ae('0x15')](function(_0x74a805){logger[_0x05ae('0x11')](_0x05ae('0xe'),_0x5bd0f4,_0x74a805);_0x2d5a23(_0x74a805);});});}exports[_0x05ae('0x16')]=function(_0x23d383){var _0x3e9e5c=this;return new Promise(function(_0x52e9e0,_0x13507b){return db['VoiceDialReport'][_0x05ae('0x17')](_0x23d383['body'],{'raw':_0x23d383[_0x05ae('0x18')]?_0x23d383[_0x05ae('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x05ae('0xd')](function(_0x3a32a7){logger[_0x05ae('0x19')]('CreateVoiceDialReport',_0x23d383);logger['debug'](_0x05ae('0x16'),_0x23d383,JSON['stringify'](_0x3a32a7));_0x52e9e0(_0x3a32a7);})['catch'](function(_0x29dea2){logger['error'](_0x05ae('0x16'),_0x29dea2[_0x05ae('0x13')],_0x23d383);_0x13507b(_0x3e9e5c[_0x05ae('0x11')](0x1f4,_0x29dea2[_0x05ae('0x13')]));});});};exports[_0x05ae('0x1a')]=function(_0x15a4ea){var _0x43c91b=this;return new Promise(function(_0x306126,_0x3f0173){return db['VoiceDialReport'][_0x05ae('0x1b')](_0x15a4ea[_0x05ae('0x1c')],{'raw':_0x15a4ea[_0x05ae('0x18')]?_0x15a4ea[_0x05ae('0x18')][_0x05ae('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15a4ea[_0x05ae('0x18')]?_0x15a4ea['options'][_0x05ae('0x1e')]||null:null,'attributes':_0x15a4ea['options']?_0x15a4ea['options']['attributes']||null:null,'limit':_0x15a4ea[_0x05ae('0x18')]?_0x15a4ea[_0x05ae('0x18')][_0x05ae('0x1f')]||null:null})[_0x05ae('0xd')](function(_0x506483){logger[_0x05ae('0x19')](_0x05ae('0x1a'),_0x15a4ea);logger[_0x05ae('0x20')]('UpdateVoiceDialReport',_0x15a4ea,JSON['stringify'](_0x506483));_0x306126(_0x506483);})[_0x05ae('0x15')](function(_0xa523b7){logger[_0x05ae('0x11')](_0x05ae('0x1a'),_0xa523b7[_0x05ae('0x13')],_0x15a4ea);_0x3f0173(_0x43c91b[_0x05ae('0x11')](0x1f4,_0xa523b7[_0x05ae('0x13')]));});});}; \ No newline at end of file +var _0x3811=['request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x1a3517,_0xa4e526){var _0x5ce98a=function(_0x20b4de){while(--_0x20b4de){_0x1a3517['push'](_0x1a3517['shift']());}};_0x5ce98a(++_0xa4e526);}(_0x3811,0x1ed));var _0x1381=function(_0x5a55ec,_0x1f1587){_0x5a55ec=_0x5a55ec-0x0;var _0x40cf17=_0x3811[_0x5a55ec];return _0x40cf17;};'use strict';var _=require(_0x1381('0x0'));var util=require(_0x1381('0x1'));var moment=require(_0x1381('0x2'));var BPromise=require(_0x1381('0x3'));var rs=require(_0x1381('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1381('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1381('0x6'))(_0x1381('0x7'));var config=require(_0x1381('0x8'));var jayson=require(_0x1381('0x9'));var client=jayson[_0x1381('0xa')][_0x1381('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b13a6,_0x3d26a1,_0x273ad9){return new BPromise(function(_0x8815bd,_0x50d392){return client[_0x1381('0xc')](_0x1b13a6,_0x273ad9)['then'](function(_0x1d87cd){logger[_0x1381('0xd')](_0x1381('0xe'),_0x3d26a1,'request\x20sent');logger[_0x1381('0xf')](_0x1381('0x10'),_0x3d26a1,_0x1381('0x11'),JSON[_0x1381('0x12')](_0x1d87cd));if(_0x1d87cd[_0x1381('0x13')]){if(_0x1d87cd[_0x1381('0x13')][_0x1381('0x14')]===0x1f4){logger[_0x1381('0x13')](_0x1381('0xe'),_0x3d26a1,_0x1d87cd[_0x1381('0x13')][_0x1381('0x15')]);return _0x50d392(_0x1d87cd['error'][_0x1381('0x15')]);}logger[_0x1381('0x13')](_0x1381('0xe'),_0x3d26a1,_0x1d87cd[_0x1381('0x13')][_0x1381('0x15')]);return _0x8815bd(_0x1d87cd[_0x1381('0x13')][_0x1381('0x15')]);}else{logger[_0x1381('0xd')](_0x1381('0xe'),_0x3d26a1,_0x1381('0x11'));_0x8815bd(_0x1d87cd[_0x1381('0x16')]['message']);}})[_0x1381('0x17')](function(_0x4ec5e6){logger[_0x1381('0x13')](_0x1381('0xe'),_0x3d26a1,_0x4ec5e6);_0x50d392(_0x4ec5e6);});});}exports[_0x1381('0x18')]=function(_0x2f6f25){var _0xb506a=this;return new Promise(function(_0x52848c,_0x312f35){return db[_0x1381('0x19')][_0x1381('0x1a')](_0x2f6f25[_0x1381('0x1b')],{'raw':_0x2f6f25['options']?_0x2f6f25[_0x1381('0x1c')][_0x1381('0x1d')]===undefined?!![]:![]:!![]})[_0x1381('0x1e')](function(_0x163903){logger[_0x1381('0xd')](_0x1381('0x18'),_0x2f6f25);logger[_0x1381('0xf')](_0x1381('0x18'),_0x2f6f25,JSON[_0x1381('0x12')](_0x163903));_0x52848c(_0x163903);})[_0x1381('0x17')](function(_0x387c4f){logger[_0x1381('0x13')](_0x1381('0x18'),_0x387c4f[_0x1381('0x15')],_0x2f6f25);_0x312f35(_0xb506a[_0x1381('0x13')](0x1f4,_0x387c4f[_0x1381('0x15')]));});});};exports[_0x1381('0x1f')]=function(_0x3ee27e){var _0x5e6393=this;return new Promise(function(_0x398f3c,_0x2d4e63){return db[_0x1381('0x19')]['update'](_0x3ee27e[_0x1381('0x1b')],{'raw':_0x3ee27e['options']?_0x3ee27e[_0x1381('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ee27e[_0x1381('0x1c')]?_0x3ee27e[_0x1381('0x1c')][_0x1381('0x20')]||null:null,'attributes':_0x3ee27e['options']?_0x3ee27e[_0x1381('0x1c')]['attributes']||null:null,'limit':_0x3ee27e[_0x1381('0x1c')]?_0x3ee27e[_0x1381('0x1c')][_0x1381('0x21')]||null:null})[_0x1381('0x1e')](function(_0x3cf9e3){logger[_0x1381('0xd')](_0x1381('0x1f'),_0x3ee27e);logger['debug'](_0x1381('0x1f'),_0x3ee27e,JSON[_0x1381('0x12')](_0x3cf9e3));_0x398f3c(_0x3cf9e3);})[_0x1381('0x17')](function(_0xe4ebe6){logger[_0x1381('0x13')](_0x1381('0x1f'),_0xe4ebe6[_0x1381('0x15')],_0x3ee27e);_0x2d4e63(_0x5e6393[_0x1381('0x13')](0x1f4,_0xe4ebe6[_0x1381('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 49d3242..199a0b4 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 _0x2bc3=['./voiceExtension.controller','get','isAuthenticated','index','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x2bc3,0xa4));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x32bc('0x0'));var util=require('util');var path=require(_0x32bc('0x1'));var timeout=require(_0x32bc('0x2'));var express=require(_0x32bc('0x3'));var router=express[_0x32bc('0x4')]();var fs_extra=require(_0x32bc('0x5'));var auth=require(_0x32bc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32bc('0x7'));router[_0x32bc('0x8')]('/',auth[_0x32bc('0x9')](),controller[_0x32bc('0xa')]);router[_0x32bc('0x8')]('/:id',auth[_0x32bc('0x9')](),controller['show']);router[_0x32bc('0xb')]('/',auth[_0x32bc('0x9')](),controller['create']);router['post'](_0x32bc('0xc'),auth[_0x32bc('0x9')](),controller[_0x32bc('0xd')]);router[_0x32bc('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x32bc('0xf')]);router[_0x32bc('0x10')]('/:id',auth[_0x32bc('0x9')](),controller[_0x32bc('0x11')]);module[_0x32bc('0x12')]=router; \ No newline at end of file +var _0x2271=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/applications'];(function(_0x12eec2,_0x5ebc4a){var _0x424a66=function(_0x14399e){while(--_0x14399e){_0x12eec2['push'](_0x12eec2['shift']());}};_0x424a66(++_0x5ebc4a);}(_0x2271,0x133));var _0x1227=function(_0x430755,_0x1cff8f){_0x430755=_0x430755-0x0;var _0x3a5e4e=_0x2271[_0x430755];return _0x3a5e4e;};'use strict';var multer=require(_0x1227('0x0'));var util=require(_0x1227('0x1'));var path=require(_0x1227('0x2'));var timeout=require('connect-timeout');var express=require(_0x1227('0x3'));var router=express[_0x1227('0x4')]();var fs_extra=require(_0x1227('0x5'));var auth=require(_0x1227('0x6'));var interaction=require(_0x1227('0x7'));var config=require(_0x1227('0x8'));var controller=require('./voiceExtension.controller');router[_0x1227('0x9')]('/',auth[_0x1227('0xa')](),controller[_0x1227('0xb')]);router['get'](_0x1227('0xc'),auth[_0x1227('0xa')](),controller[_0x1227('0xd')]);router[_0x1227('0xe')]('/',auth[_0x1227('0xa')](),controller['create']);router[_0x1227('0xe')](_0x1227('0xf'),auth['isAuthenticated'](),controller['addApplications']);router['put'](_0x1227('0xc'),auth[_0x1227('0xa')](),controller['update']);router[_0x1227('0x10')](_0x1227('0xc'),auth[_0x1227('0xa')](),controller[_0x1227('0x11')]);module[_0x1227('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f2e24a5..47c12e5 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 _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x7a4e44,_0x3c14d0){var _0x2037a2=function(_0x25aadc){while(--_0x25aadc){_0x7a4e44['push'](_0x7a4e44['shift']());}};_0x2037a2(++_0x3c14d0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file +var _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x26387d,_0x35c654){var _0x36c01a=function(_0x5c006d){while(--_0x5c006d){_0x26387d['push'](_0x26387d['shift']());}};_0x36c01a(++_0x35c654);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 84290ab..91e3b8d 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 _0x6797=['Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','filter','ignore','includes','value','type','UserProfileResource','error','name','index','map','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','options','includeAll','include','rows','catch','show','params','length','find','create','outbound','startsWith','body','concat','exten','user','get','role','InternalRoutes','internal','UserProfileSection','userProfileId','autoAssociation','update','pick','context','description','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set'];(function(_0x51515d,_0x2e1200){var _0x52f100=function(_0xd96955){while(--_0xd96955){_0x51515d['push'](_0x51515d['shift']());}};_0x52f100(++_0x2e1200);}(_0x6797,0x170));var _0x7679=function(_0x1a9342,_0x578e20){_0x1a9342=_0x1a9342-0x0;var _0x43d031=_0x6797[_0x1a9342];return _0x43d031;};'use strict';var _=require(_0x7679('0x0'));var Redis=require(_0x7679('0x1'));var qs=require(_0x7679('0x2'));var logger=require(_0x7679('0x3'))(_0x7679('0x4'));var config=require(_0x7679('0x5'));var db=require(_0x7679('0x6'))['db'];config['redis']=_[_0x7679('0x7')](config[_0x7679('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7679('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x7679('0xa')](socket);function respondWithStatusCode(_0x22790e,_0x594a80){_0x594a80=_0x594a80||0xcc;return function(_0x35eeb2){if(_0x35eeb2){return _0x22790e[_0x7679('0xb')](_0x594a80);}return _0x22790e['status'](_0x594a80)[_0x7679('0xc')]();};}function respondWithResult(_0x34dca8,_0x37078a){_0x37078a=_0x37078a||0xc8;return function(_0x34e20c){if(_0x34e20c){return _0x34dca8['status'](_0x37078a)[_0x7679('0xd')](_0x34e20c);}};}function respondWithFilteredResult(_0x30e10a,_0x375109){return function(_0x5407b9){if(_0x5407b9){var _0x34a697=typeof _0x375109[_0x7679('0xe')]===_0x7679('0xf')&&typeof _0x375109[_0x7679('0x10')]===_0x7679('0xf');var _0x4f943=_0x5407b9[_0x7679('0x11')];var _0x56ac14=_0x34a697?0x0:_0x375109['offset'];var _0x4ca178=_0x34a697?_0x5407b9[_0x7679('0x11')]:_0x375109[_0x7679('0xe')]+_0x375109['limit'];var _0x1102c1;if(_0x4ca178>=_0x4f943){_0x4ca178=_0x4f943;_0x1102c1=0xc8;}else{_0x1102c1=0xce;}_0x30e10a[_0x7679('0x12')](_0x1102c1);return _0x30e10a[_0x7679('0x13')](_0x7679('0x14'),_0x56ac14+'-'+_0x4ca178+'/'+_0x4f943)[_0x7679('0xd')](_0x5407b9);}return null;};}function removeEntity(_0x344d02){return function(_0x274568){if(_0x274568){return _0x274568[_0x7679('0x15')]()[_0x7679('0x16')](function(){var _0x399b38=_0x274568['get']({'plain':!![]});var _0x56876f=[{'name':_0x7679('0x17'),'value':_0x7679('0x18'),'ignore':![]},{'name':_0x7679('0x19'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x6a8b6f=_(_0x56876f)[_0x7679('0x1a')](_0x7679('0x1b'))['map']('value')['value']();if(_[_0x7679('0x1c')](_0x6a8b6f,_0x399b38['type'])){return;}var _0x35ad15=_['find'](_0x56876f,[_0x7679('0x1d'),_0x399b38[_0x7679('0x1e')]])['name'];return db[_0x7679('0x1f')]['destroy']({'where':{'type':_0x35ad15,'resourceId':_0x399b38['id']}})[_0x7679('0x16')](function(){return _0x274568;});})[_0x7679('0x16')](function(){_0x344d02[_0x7679('0x12')](0xcc)[_0x7679('0xc')]();});}};}function handleEntityNotFound(_0x347667){return function(_0x52cec6){if(!_0x52cec6){_0x347667[_0x7679('0xb')](0x194);}return _0x52cec6;};}function handleError(_0x4bc773,_0x10e098){_0x10e098=_0x10e098||0x1f4;return function(_0x3185ba){logger[_0x7679('0x20')](_0x3185ba['stack']);if(_0x3185ba[_0x7679('0x21')]){delete _0x3185ba['name'];}_0x4bc773[_0x7679('0x12')](_0x10e098)['send'](_0x3185ba);};}exports[_0x7679('0x22')]=function(_0x1cdbf2,_0x5c6048){var _0x2b9ba0={},_0x21fc8a={},_0x5a40e9={'count':0x0,'rows':[]};var _0x5a2982=_[_0x7679('0x23')](db[_0x7679('0x24')][_0x7679('0x25')],function(_0x2c37e4){return{'name':_0x2c37e4[_0x7679('0x26')],'type':_0x2c37e4[_0x7679('0x1e')][_0x7679('0x27')]};});_0x21fc8a[_0x7679('0x28')]=_[_0x7679('0x23')](_0x5a2982,'name');_0x21fc8a['query']=_[_0x7679('0x29')](_0x1cdbf2[_0x7679('0x2a')]);_0x21fc8a[_0x7679('0x2b')]=_[_0x7679('0x2c')](_0x21fc8a[_0x7679('0x28')],_0x21fc8a[_0x7679('0x2a')]);_0x2b9ba0[_0x7679('0x2d')]=_[_0x7679('0x2c')](_0x21fc8a['model'],qs[_0x7679('0x2e')](_0x1cdbf2['query'][_0x7679('0x2e')]));_0x2b9ba0[_0x7679('0x2d')]=_0x2b9ba0['attributes']['length']?_0x2b9ba0[_0x7679('0x2d')]:_0x21fc8a['model'];if(!_0x1cdbf2[_0x7679('0x2a')]['hasOwnProperty'](_0x7679('0x2f'))){_0x2b9ba0[_0x7679('0x10')]=qs[_0x7679('0x10')](_0x1cdbf2['query'][_0x7679('0x10')]);_0x2b9ba0[_0x7679('0xe')]=qs['offset'](_0x1cdbf2[_0x7679('0x2a')][_0x7679('0xe')]);}_0x2b9ba0[_0x7679('0x30')]=qs[_0x7679('0x31')](_0x1cdbf2['query'][_0x7679('0x31')]);_0x2b9ba0[_0x7679('0x32')]=qs[_0x7679('0x2b')](_['pick'](_0x1cdbf2['query'],_0x21fc8a[_0x7679('0x2b')]),_0x5a2982);if(_0x1cdbf2['query'][_0x7679('0x1a')]){_0x2b9ba0[_0x7679('0x32')]=_[_0x7679('0x33')](_0x2b9ba0[_0x7679('0x32')],{'$or':_['map'](_0x5a2982,function(_0x3b70d8){if(_0x3b70d8[_0x7679('0x1e')]!=='VIRTUAL'){var _0x1071ec={};_0x1071ec[_0x3b70d8['name']]={'$like':'%'+_0x1cdbf2['query'][_0x7679('0x1a')]+'%'};return _0x1071ec;}})});}_0x2b9ba0=_[_0x7679('0x33')]({},_0x2b9ba0,_0x1cdbf2[_0x7679('0x34')]);var _0x14aa8d={'where':_0x2b9ba0[_0x7679('0x32')]};return db[_0x7679('0x24')][_0x7679('0x11')](_0x14aa8d)[_0x7679('0x16')](function(_0x89179a){_0x5a40e9['count']=_0x89179a;if(_0x1cdbf2[_0x7679('0x2a')][_0x7679('0x35')]){_0x2b9ba0[_0x7679('0x36')]=[{'all':!![]}];}return db[_0x7679('0x24')]['findAll'](_0x2b9ba0);})[_0x7679('0x16')](function(_0x2e0902){_0x5a40e9[_0x7679('0x37')]=_0x2e0902;return _0x5a40e9;})[_0x7679('0x16')](respondWithFilteredResult(_0x5c6048,_0x2b9ba0))[_0x7679('0x38')](handleError(_0x5c6048,null));};exports[_0x7679('0x39')]=function(_0x964838,_0x54f31f){var _0x345769={'raw':![],'where':{'id':_0x964838[_0x7679('0x3a')]['id']}},_0x2038e3={};_0x2038e3[_0x7679('0x28')]=_[_0x7679('0x29')](db[_0x7679('0x24')]['rawAttributes']);_0x2038e3[_0x7679('0x2a')]=_['keys'](_0x964838[_0x7679('0x2a')]);_0x2038e3['filters']=_[_0x7679('0x2c')](_0x2038e3[_0x7679('0x28')],_0x2038e3[_0x7679('0x2a')]);_0x345769[_0x7679('0x2d')]=_[_0x7679('0x2c')](_0x2038e3[_0x7679('0x28')],qs[_0x7679('0x2e')](_0x964838[_0x7679('0x2a')][_0x7679('0x2e')]));_0x345769[_0x7679('0x2d')]=_0x345769[_0x7679('0x2d')][_0x7679('0x3b')]?_0x345769['attributes']:_0x2038e3[_0x7679('0x28')];if(_0x964838['query'][_0x7679('0x35')]){_0x345769[_0x7679('0x36')]=[{'all':!![]}];}_0x345769=_[_0x7679('0x33')]({},_0x345769,_0x964838[_0x7679('0x34')]);return db['VoiceExtension'][_0x7679('0x3c')](_0x345769)[_0x7679('0x16')](handleEntityNotFound(_0x54f31f,null))[_0x7679('0x16')](respondWithResult(_0x54f31f,null))[_0x7679('0x38')](handleError(_0x54f31f,null));};exports[_0x7679('0x15')]=function(_0x376276,_0x52198c){return db[_0x7679('0x24')]['find']({'where':{'id':_0x376276[_0x7679('0x3a')]['id']}})['then'](handleEntityNotFound(_0x52198c,null))[_0x7679('0x16')](removeEntity(_0x52198c,null))[_0x7679('0x38')](handleError(_0x52198c,null));};exports[_0x7679('0x3d')]=function(_0x8f0ea5,_0x547ccf){if(_0x8f0ea5['body'][_0x7679('0x1e')]===_0x7679('0x3e')&&!_[_0x7679('0x3f')](_0x8f0ea5[_0x7679('0x40')]['exten'],'_')){_0x8f0ea5['body']['exten']='_'[_0x7679('0x41')](_0x8f0ea5[_0x7679('0x40')][_0x7679('0x42')]);}return db[_0x7679('0x24')][_0x7679('0x3d')](_0x8f0ea5['body'],{'raw':![]})[_0x7679('0x16')](function(_0x1c123b){var _0x1a0705=_0x8f0ea5[_0x7679('0x43')][_0x7679('0x44')]({'plain':!![]});if(!_0x1a0705)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a0705[_0x7679('0x45')]===_0x7679('0x43')){var _0x5d956a=_0x1c123b[_0x7679('0x44')]({'plain':!![]});var _0x5a2dbe=[{'name':_0x7679('0x17'),'value':'inbound'},{'name':_0x7679('0x19'),'value':'outbound'},{'name':_0x7679('0x46'),'value':_0x7679('0x47')}];var _0x21aa9a=_[_0x7679('0x3c')](_0x5a2dbe,['value',_0x5d956a['type']])[_0x7679('0x21')];return db[_0x7679('0x48')][_0x7679('0x3c')]({'where':{'name':_0x21aa9a,'userProfileId':_0x1a0705[_0x7679('0x49')]},'raw':!![]})[_0x7679('0x16')](function(_0x516897){if(_0x516897&&_0x516897[_0x7679('0x4a')]===0x0){return db['UserProfileResource'][_0x7679('0x3d')]({'name':_0x5d956a['name'],'resourceId':_0x5d956a['id'],'type':_0x516897['name'],'sectionId':_0x516897['id']},{})[_0x7679('0x16')](function(){return _0x1c123b;});}else{return _0x1c123b;}})[_0x7679('0x38')](function(_0x3633e6){logger[_0x7679('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3633e6);throw _0x3633e6;});}return _0x1c123b;})[_0x7679('0x16')](respondWithResult(_0x547ccf,0xc9))[_0x7679('0x38')](handleError(_0x547ccf,null));};exports[_0x7679('0x4b')]=function(_0x541fbe,_0x300fb5){if(_0x541fbe[_0x7679('0x40')]['id']){delete _0x541fbe[_0x7679('0x40')]['id'];}return db['VoiceExtension'][_0x7679('0x3c')]({'where':{'id':_0x541fbe['params']['id']}})[_0x7679('0x16')](handleEntityNotFound(_0x300fb5,null))['then'](function(_0x28ad88){if(_0x28ad88){return db[_0x7679('0x24')][_0x7679('0x4b')](_[_0x7679('0x4c')](_0x541fbe[_0x7679('0x40')],[_0x7679('0x42'),_0x7679('0x4d'),_0x7679('0x4e'),'recordingFormat','cutdigits',_0x7679('0x4f'),_0x7679('0x50')]),{'where':{'context':_0x28ad88[_0x7679('0x4d')],'exten':_0x28ad88['exten']},'individualHooks':!![]})[_0x7679('0x16')](function(_0x43f971){return _0x43f971;});}return null;})['then'](respondWithStatusCode(_0x300fb5,null))['catch'](handleError(_0x300fb5,null));};exports[_0x7679('0x51')]=function(_0x211cb3,_0x5888c4){var _0x5a8daf=_0x211cb3[_0x7679('0x3a')]['id'];var _0x2cf087=_0x211cb3[_0x7679('0x40')];var _0x24d4e0=0xc8;var _0x10808e=null;return db[_0x7679('0x52')][_0x7679('0x53')]({'isolationLevel':db[_0x7679('0x52')][_0x7679('0x54')][_0x7679('0x55')][_0x7679('0x56')]},function(_0x2ab9d5){return db[_0x7679('0x24')][_0x7679('0x57')]({'where':{'id':_0x5a8daf},'transaction':_0x2ab9d5})[_0x7679('0x16')](function(_0x3e2e65){if(_0x3e2e65){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x5a8daf},'transaction':_0x2ab9d5})[_0x7679('0x16')](function(){var _0x4b8f12=_[_0x7679('0x23')](_0x2cf087,function(_0x557a11){_0x557a11[_0x7679('0x58')]=_0x5a8daf;_0x557a11[_0x7679('0x59')]=!![];return _0x557a11;});return _0x3e2e65[_0x7679('0x5a')](_0x4b8f12);})['then'](function(_0x3ce484){return db[_0x7679('0x24')][_0x7679('0x5b')](_0x3ce484,{'transaction':_0x2ab9d5});});}else{_0x24d4e0=0x194;_0x10808e=[];}});})[_0x7679('0x16')](function(){if(_0x24d4e0!==0x194){return db[_0x7679('0x24')][_0x7679('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5a8daf},'order':_0x7679('0x5d')})[_0x7679('0x16')](function(_0x3ece61){_0x10808e=_0x3ece61;});}})[_0x7679('0x38')](function(_0x2ac823){_0x24d4e0=0x1f4;logger[_0x7679('0x20')](_0x2ac823[_0x7679('0x5e')]);if(_0x2ac823[_0x7679('0x21')]){delete _0x2ac823[_0x7679('0x21')];}_0x10808e=_0x2ac823;})[_0x7679('0x5f')](function(){if(_0x10808e===null){_0x5888c4[_0x7679('0xb')](_0x24d4e0);}else{if(_0x24d4e0===0x1f4){_0x5888c4['status'](_0x24d4e0)[_0x7679('0x60')](_0x10808e);}else{_0x5888c4['status'](_0x24d4e0)[_0x7679('0xd')](_0x10808e);}}});}; \ No newline at end of file +var _0x9486=['error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','autoAssociation','update','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','destroy','then','InboundRoutes','inbound','InternalRoutes','filter','ignore','map','value','type','find','name','UserProfileResource'];(function(_0x280098,_0x25256d){var _0xa09be6=function(_0x5db1f0){while(--_0x5db1f0){_0x280098['push'](_0x280098['shift']());}};_0xa09be6(++_0x25256d);}(_0x9486,0x1ad));var _0x6948=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9486[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6948('0x0'));var Redis=require(_0x6948('0x1'));var qs=require(_0x6948('0x2'));var logger=require(_0x6948('0x3'))(_0x6948('0x4'));var config=require('../../config/environment');var db=require(_0x6948('0x5'))['db'];config[_0x6948('0x6')]=_[_0x6948('0x7')](config[_0x6948('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x6948('0x8')](socket);function respondWithStatusCode(_0x2a9fe5,_0x189f53){_0x189f53=_0x189f53||0xcc;return function(_0x2705d0){if(_0x2705d0){return _0x2a9fe5[_0x6948('0x9')](_0x189f53);}return _0x2a9fe5[_0x6948('0xa')](_0x189f53)[_0x6948('0xb')]();};}function respondWithResult(_0x265515,_0xd5dd9b){_0xd5dd9b=_0xd5dd9b||0xc8;return function(_0x44b831){if(_0x44b831){return _0x265515['status'](_0xd5dd9b)[_0x6948('0xc')](_0x44b831);}};}function respondWithFilteredResult(_0x1b7f9c,_0x3c1b3d){return function(_0x41a589){if(_0x41a589){var _0x2122fe=typeof _0x3c1b3d[_0x6948('0xd')]==='undefined'&&typeof _0x3c1b3d['limit']===_0x6948('0xe');var _0x2d1452=_0x41a589[_0x6948('0xf')];var _0x564361=_0x2122fe?0x0:_0x3c1b3d[_0x6948('0xd')];var _0x29d84e=_0x2122fe?_0x41a589[_0x6948('0xf')]:_0x3c1b3d[_0x6948('0xd')]+_0x3c1b3d['limit'];var _0x957242;if(_0x29d84e>=_0x2d1452){_0x29d84e=_0x2d1452;_0x957242=0xc8;}else{_0x957242=0xce;}_0x1b7f9c[_0x6948('0xa')](_0x957242);return _0x1b7f9c[_0x6948('0x10')](_0x6948('0x11'),_0x564361+'-'+_0x29d84e+'/'+_0x2d1452)[_0x6948('0xc')](_0x41a589);}return null;};}function removeEntity(_0x13cf18){return function(_0x32d827){if(_0x32d827){return _0x32d827[_0x6948('0x12')]()[_0x6948('0x13')](function(){var _0x306177=_0x32d827['get']({'plain':!![]});var _0x445b06=[{'name':_0x6948('0x14'),'value':_0x6948('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x6948('0x16'),'value':'internal','ignore':![]}];var _0x384b00=_(_0x445b06)[_0x6948('0x17')](_0x6948('0x18'))[_0x6948('0x19')](_0x6948('0x1a'))[_0x6948('0x1a')]();if(_['includes'](_0x384b00,_0x306177[_0x6948('0x1b')])){return;}var _0x108eea=_[_0x6948('0x1c')](_0x445b06,[_0x6948('0x1a'),_0x306177[_0x6948('0x1b')]])[_0x6948('0x1d')];return db[_0x6948('0x1e')][_0x6948('0x12')]({'where':{'type':_0x108eea,'resourceId':_0x306177['id']}})[_0x6948('0x13')](function(){return _0x32d827;});})['then'](function(){_0x13cf18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a33f3){return function(_0x3b99b5){if(!_0x3b99b5){_0x3a33f3[_0x6948('0x9')](0x194);}return _0x3b99b5;};}function handleError(_0x479e5e,_0x1e0231){_0x1e0231=_0x1e0231||0x1f4;return function(_0x357d69){logger[_0x6948('0x1f')](_0x357d69[_0x6948('0x20')]);if(_0x357d69[_0x6948('0x1d')]){delete _0x357d69[_0x6948('0x1d')];}_0x479e5e[_0x6948('0xa')](_0x1e0231)[_0x6948('0x21')](_0x357d69);};}exports[_0x6948('0x22')]=function(_0x55246d,_0x132d6a){var _0x2d2eb0={},_0x5ca96c={},_0x3279ad={'count':0x0,'rows':[]};var _0x4871f4=_[_0x6948('0x19')](db[_0x6948('0x23')][_0x6948('0x24')],function(_0x45e158){return{'name':_0x45e158[_0x6948('0x25')],'type':_0x45e158['type']['key']};});_0x5ca96c[_0x6948('0x26')]=_['map'](_0x4871f4,_0x6948('0x1d'));_0x5ca96c['query']=_['keys'](_0x55246d[_0x6948('0x27')]);_0x5ca96c['filters']=_[_0x6948('0x28')](_0x5ca96c[_0x6948('0x26')],_0x5ca96c[_0x6948('0x27')]);_0x2d2eb0[_0x6948('0x29')]=_['intersection'](_0x5ca96c[_0x6948('0x26')],qs[_0x6948('0x2a')](_0x55246d[_0x6948('0x27')][_0x6948('0x2a')]));_0x2d2eb0[_0x6948('0x29')]=_0x2d2eb0['attributes'][_0x6948('0x2b')]?_0x2d2eb0[_0x6948('0x29')]:_0x5ca96c[_0x6948('0x26')];if(!_0x55246d[_0x6948('0x27')][_0x6948('0x2c')](_0x6948('0x2d'))){_0x2d2eb0['limit']=qs[_0x6948('0x2e')](_0x55246d['query']['limit']);_0x2d2eb0[_0x6948('0xd')]=qs[_0x6948('0xd')](_0x55246d[_0x6948('0x27')]['offset']);}_0x2d2eb0[_0x6948('0x2f')]=qs[_0x6948('0x30')](_0x55246d[_0x6948('0x27')]['sort']);_0x2d2eb0['where']=qs[_0x6948('0x31')](_[_0x6948('0x32')](_0x55246d[_0x6948('0x27')],_0x5ca96c[_0x6948('0x31')]),_0x4871f4);if(_0x55246d[_0x6948('0x27')][_0x6948('0x17')]){_0x2d2eb0[_0x6948('0x33')]=_[_0x6948('0x34')](_0x2d2eb0[_0x6948('0x33')],{'$or':_['map'](_0x4871f4,function(_0x5abe03){if(_0x5abe03[_0x6948('0x1b')]!==_0x6948('0x35')){var _0x425222={};_0x425222[_0x5abe03['name']]={'$like':'%'+_0x55246d[_0x6948('0x27')][_0x6948('0x17')]+'%'};return _0x425222;}})});}_0x2d2eb0=_[_0x6948('0x34')]({},_0x2d2eb0,_0x55246d[_0x6948('0x36')]);var _0x126ba7={'where':_0x2d2eb0[_0x6948('0x33')]};return db['VoiceExtension'][_0x6948('0xf')](_0x126ba7)[_0x6948('0x13')](function(_0x1cacbb){_0x3279ad[_0x6948('0xf')]=_0x1cacbb;if(_0x55246d['query'][_0x6948('0x37')]){_0x2d2eb0[_0x6948('0x38')]=[{'all':!![]}];}return db[_0x6948('0x23')][_0x6948('0x39')](_0x2d2eb0);})['then'](function(_0x4ffc93){_0x3279ad[_0x6948('0x3a')]=_0x4ffc93;return _0x3279ad;})[_0x6948('0x13')](respondWithFilteredResult(_0x132d6a,_0x2d2eb0))[_0x6948('0x3b')](handleError(_0x132d6a,null));};exports[_0x6948('0x3c')]=function(_0x38629f,_0x43823d){var _0x10e789={'raw':![],'where':{'id':_0x38629f[_0x6948('0x3d')]['id']}},_0x5ecb0d={};_0x5ecb0d[_0x6948('0x26')]=_[_0x6948('0x3e')](db[_0x6948('0x23')][_0x6948('0x24')]);_0x5ecb0d[_0x6948('0x27')]=_[_0x6948('0x3e')](_0x38629f['query']);_0x5ecb0d[_0x6948('0x31')]=_[_0x6948('0x28')](_0x5ecb0d['model'],_0x5ecb0d[_0x6948('0x27')]);_0x10e789[_0x6948('0x29')]=_[_0x6948('0x28')](_0x5ecb0d['model'],qs[_0x6948('0x2a')](_0x38629f[_0x6948('0x27')]['fields']));_0x10e789[_0x6948('0x29')]=_0x10e789[_0x6948('0x29')][_0x6948('0x2b')]?_0x10e789[_0x6948('0x29')]:_0x5ecb0d[_0x6948('0x26')];if(_0x38629f[_0x6948('0x27')][_0x6948('0x37')]){_0x10e789[_0x6948('0x38')]=[{'all':!![]}];}_0x10e789=_[_0x6948('0x34')]({},_0x10e789,_0x38629f[_0x6948('0x36')]);return db[_0x6948('0x23')][_0x6948('0x1c')](_0x10e789)['then'](handleEntityNotFound(_0x43823d,null))['then'](respondWithResult(_0x43823d,null))[_0x6948('0x3b')](handleError(_0x43823d,null));};exports['destroy']=function(_0x2fe1e7,_0xf07bee){return db['VoiceExtension'][_0x6948('0x1c')]({'where':{'id':_0x2fe1e7[_0x6948('0x3d')]['id']}})[_0x6948('0x13')](handleEntityNotFound(_0xf07bee,null))[_0x6948('0x13')](removeEntity(_0xf07bee,null))[_0x6948('0x3b')](handleError(_0xf07bee,null));};exports[_0x6948('0x3f')]=function(_0x355eac,_0x4d0092){if(_0x355eac[_0x6948('0x40')]['type']===_0x6948('0x41')&&!_[_0x6948('0x42')](_0x355eac[_0x6948('0x40')][_0x6948('0x43')],'_')){_0x355eac[_0x6948('0x40')][_0x6948('0x43')]='_'[_0x6948('0x44')](_0x355eac[_0x6948('0x40')][_0x6948('0x43')]);}return db[_0x6948('0x23')][_0x6948('0x3f')](_0x355eac['body'],{'raw':![]})[_0x6948('0x13')](function(_0x8a74f5){var _0x220e40=_0x355eac[_0x6948('0x45')]['get']({'plain':!![]});if(!_0x220e40)throw new Error(_0x6948('0x46'));if(_0x220e40['role']===_0x6948('0x45')){var _0x41c606=_0x8a74f5['get']({'plain':!![]});var _0x492777=[{'name':_0x6948('0x14'),'value':_0x6948('0x15')},{'name':_0x6948('0x47'),'value':_0x6948('0x41')},{'name':_0x6948('0x16'),'value':'internal'}];var _0x19e5cc=_[_0x6948('0x1c')](_0x492777,[_0x6948('0x1a'),_0x41c606[_0x6948('0x1b')]])[_0x6948('0x1d')];return db[_0x6948('0x48')]['find']({'where':{'name':_0x19e5cc,'userProfileId':_0x220e40['userProfileId']},'raw':!![]})['then'](function(_0x2fd85a){if(_0x2fd85a&&_0x2fd85a[_0x6948('0x49')]===0x0){return db['UserProfileResource'][_0x6948('0x3f')]({'name':_0x41c606[_0x6948('0x1d')],'resourceId':_0x41c606['id'],'type':_0x2fd85a[_0x6948('0x1d')],'sectionId':_0x2fd85a['id']},{})[_0x6948('0x13')](function(){return _0x8a74f5;});}else{return _0x8a74f5;}})['catch'](function(_0x3d1f4){logger[_0x6948('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d1f4);throw _0x3d1f4;});}return _0x8a74f5;})[_0x6948('0x13')](respondWithResult(_0x4d0092,0xc9))[_0x6948('0x3b')](handleError(_0x4d0092,null));};exports['update']=function(_0x4157fa,_0x23b499){if(_0x4157fa['body']['id']){delete _0x4157fa[_0x6948('0x40')]['id'];}return db['VoiceExtension'][_0x6948('0x1c')]({'where':{'id':_0x4157fa['params']['id']}})[_0x6948('0x13')](handleEntityNotFound(_0x23b499,null))[_0x6948('0x13')](function(_0x591e54){if(_0x591e54){return db[_0x6948('0x23')][_0x6948('0x4a')](_[_0x6948('0x32')](_0x4157fa['body'],[_0x6948('0x43'),'context',_0x6948('0x4b'),_0x6948('0x4c'),_0x6948('0x4d'),_0x6948('0x4e'),'alias']),{'where':{'context':_0x591e54['context'],'exten':_0x591e54[_0x6948('0x43')]},'individualHooks':!![]})['then'](function(_0x69ac3e){return _0x69ac3e;});}return null;})[_0x6948('0x13')](respondWithStatusCode(_0x23b499,null))[_0x6948('0x3b')](handleError(_0x23b499,null));};exports[_0x6948('0x4f')]=function(_0x46512,_0x1fd2f5){var _0x5498a6=_0x46512[_0x6948('0x3d')]['id'];var _0xd1fe6=_0x46512['body'];var _0x1d1d35=0xc8;var _0xb73c15=null;return db[_0x6948('0x50')][_0x6948('0x51')]({'isolationLevel':db[_0x6948('0x50')][_0x6948('0x52')][_0x6948('0x53')][_0x6948('0x54')]},function(_0x2c7396){return db[_0x6948('0x23')][_0x6948('0x55')]({'where':{'id':_0x5498a6},'transaction':_0x2c7396})[_0x6948('0x13')](function(_0x44244f){if(_0x44244f){return db['VoiceExtension'][_0x6948('0x12')]({'where':{'VoiceExtensionId':_0x5498a6},'transaction':_0x2c7396})[_0x6948('0x13')](function(){var _0x34292f=_[_0x6948('0x19')](_0xd1fe6,function(_0x5a0935){_0x5a0935[_0x6948('0x56')]=_0x5498a6;_0x5a0935['isApp']=!![];return _0x5a0935;});return _0x44244f[_0x6948('0x57')](_0x34292f);})[_0x6948('0x13')](function(_0xf01b06){return db[_0x6948('0x23')][_0x6948('0x58')](_0xf01b06,{'transaction':_0x2c7396});});}else{_0x1d1d35=0x194;_0xb73c15=[];}});})['then'](function(){if(_0x1d1d35!==0x194){return db[_0x6948('0x23')][_0x6948('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5498a6},'order':_0x6948('0x5a')})[_0x6948('0x13')](function(_0x1f21f2){_0xb73c15=_0x1f21f2;});}})[_0x6948('0x3b')](function(_0x517c45){_0x1d1d35=0x1f4;logger[_0x6948('0x1f')](_0x517c45[_0x6948('0x20')]);if(_0x517c45[_0x6948('0x1d')]){delete _0x517c45[_0x6948('0x1d')];}_0xb73c15=_0x517c45;})[_0x6948('0x5b')](function(){if(_0xb73c15===null){_0x1fd2f5[_0x6948('0x9')](_0x1d1d35);}else{if(_0x1d1d35===0x1f4){_0x1fd2f5[_0x6948('0xa')](_0x1d1d35)[_0x6948('0x21')](_0xb73c15);}else{_0x1fd2f5['status'](_0x1d1d35)[_0x6948('0xc')](_0xb73c15);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index aa74767..871ff56 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 _0x5d0b=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x3fac04,_0x3c2a46){var _0x5d48f5=function(_0x33cc0e){while(--_0x33cc0e){_0x3fac04['push'](_0x3fac04['shift']());}};_0x5d48f5(++_0x3c2a46);}(_0x5d0b,0xc3));var _0xb5d0=function(_0x5615eb,_0x2f4f53){_0x5615eb=_0x5615eb-0x0;var _0x184f28=_0x5d0b[_0x5615eb];return _0x184f28;};'use strict';var EventEmitter=require(_0xb5d0('0x0'));var VoiceExtension=require(_0xb5d0('0x1'))['db'][_0xb5d0('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb5d0('0x3')](0x0);var events={'afterCreate':_0xb5d0('0x4'),'afterUpdate':_0xb5d0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x187f02){return function(_0x3ff6cd,_0x1255aa,_0x305cb5){VoiceExtensionEvents[_0xb5d0('0x6')](_0x187f02+':'+_0x3ff6cd['id'],_0x3ff6cd);VoiceExtensionEvents[_0xb5d0('0x6')](_0x187f02,_0x3ff6cd);_0x305cb5(null);};}for(var e in events){if(events[_0xb5d0('0x7')](e)){var event=events[e];VoiceExtension[_0xb5d0('0x8')](e,emitEvent(event));}}module[_0xb5d0('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9c5b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x8fd545,_0x67b7d8){var _0x3c6b5f=function(_0x153bb7){while(--_0x153bb7){_0x8fd545['push'](_0x8fd545['shift']());}};_0x3c6b5f(++_0x67b7d8);}(_0x9c5b,0x157));var _0xb9c5=function(_0x27c90d,_0x3a1e5d){_0x27c90d=_0x27c90d-0x0;var _0x3e5dcd=_0x9c5b[_0x27c90d];return _0x3e5dcd;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xb9c5('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb9c5('0x1')](0x0);var events={'afterCreate':_0xb9c5('0x2'),'afterUpdate':_0xb9c5('0x3'),'afterDestroy':_0xb9c5('0x4')};function emitEvent(_0x5ca553){return function(_0x58fb18,_0x718bfa,_0x395f14){VoiceExtensionEvents[_0xb9c5('0x5')](_0x5ca553+':'+_0x58fb18['id'],_0x58fb18);VoiceExtensionEvents['emit'](_0x5ca553,_0x58fb18);_0x395f14(null);};}for(var e in events){if(events[_0xb9c5('0x6')](e)){var event=events[e];VoiceExtension[_0xb9c5('0x7')](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 1b4d246..d71bde8 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 _0x393f=['appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','url','split','length','name','param','prefix','phone','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','then','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType'];(function(_0x36949f,_0xac8926){var _0x225ac9=function(_0x234feb){while(--_0x234feb){_0x36949f['push'](_0x36949f['shift']());}};_0x225ac9(++_0xac8926);}(_0x393f,0x153));var _0xf393=function(_0x2ebe72,_0x3e43e6){_0x2ebe72=_0x2ebe72-0x0;var _0x32785e=_0x393f[_0x2ebe72];return _0x32785e;};'use strict';var _=require(_0xf393('0x0'));var attributes=require(_0xf393('0x1'));module[_0xf393('0x2')]=function(_0xb8ee3e){var _0x923151=_0xb8ee3e[_0xf393('0x3')];function _0x2a8edb(_0x3de84e){var _0x2ff4ec=0x2;var _0xfb570a=[{'type':_0x3de84e['type'],'app':_0xf393('0x4'),'appdata':_0xf393('0x5')+_0x3de84e[_0xf393('0x6')],'context':_0x3de84e[_0xf393('0x7')],'exten':_0x3de84e[_0xf393('0x8')],'priority':_0x2ff4ec++,'VoiceExtensionId':_0x3de84e['id']}];if(_0x3de84e[_0xf393('0x6')]===_0xf393('0x9')){_0xfb570a[_0xf393('0xa')]({'type':'inbound','app':_0xf393('0x4'),'appdata':_0xf393('0xb')+_0x3de84e['id'],'context':_0x3de84e[_0xf393('0x7')],'exten':_0x3de84e['exten'],'priority':_0x2ff4ec++,'VoiceExtensionId':_0x3de84e['id']});}_0xfb570a[_0xf393('0xa')]({'type':_0x3de84e[_0xf393('0x6')],'app':_0xf393('0x4'),'appdata':_0xf393('0xc'),'context':_0x3de84e[_0xf393('0x7')],'exten':_0x3de84e['exten'],'priority':_0x2ff4ec++,'VoiceExtensionId':_0x3de84e['id']},{'type':_0x3de84e[_0xf393('0x6')],'app':_0xf393('0x4'),'appdata':_0xf393('0xd'),'context':_0x3de84e[_0xf393('0x7')],'exten':_0x3de84e[_0xf393('0x8')],'priority':_0x2ff4ec++,'VoiceExtensionId':_0x3de84e['id']},{'type':_0x3de84e[_0xf393('0x6')],'app':_0xf393('0x4'),'appdata':_0xf393('0xe'),'context':_0x3de84e[_0xf393('0x7')],'exten':_0x3de84e[_0xf393('0x8')],'priority':_0x2ff4ec++,'VoiceExtensionId':_0x3de84e['id']});return _0xfb570a;}function _0x3a70f3(_0x19c49f){var _0x4c5906=0x2;var _0x22ef7c=[{'type':_0xf393('0xf'),'app':'Set','appdata':_0xf393('0x10'),'context':_0x19c49f['context'],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':'CDR(destination)='+(_0x19c49f[_0xf393('0x11')]?_0xf393('0x12')+_0x19c49f[_0xf393('0x11')]+'}':_0xf393('0x13')),'context':_0x19c49f['context'],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':_0xf393('0xb')+_0x19c49f['id'],'context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f['exten'],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4c5906+0x2)+_0xf393('0x15')+(_0x4c5906+0x1)+')','context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':_0x19c49f[_0xf393('0x11')]?_0xf393('0x16')+_0x19c49f['cutdigits']+'}':_0xf393('0x17'),'context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f['exten'],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':'Set','appdata':_0xf393('0xc'),'context':_0x19c49f['context'],'exten':_0x19c49f['exten'],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':_0xf393('0xd'),'context':_0x19c49f['context'],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':_0xf393('0xe'),'context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':_0xf393('0x18')+_0x19c49f['id'],'context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']}];if(_0x19c49f[_0xf393('0x19')](_0xf393('0x1a'))&&_0x19c49f[_0xf393('0x1a')]!=='none'){_0x22ef7c[_0xf393('0xa')]({'type':_0xf393('0xf'),'app':_0xf393('0x4'),'appdata':_0xf393('0x1b'),'context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f[_0xf393('0x8')],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']},{'type':'outbound','app':_0xf393('0x4'),'appdata':_0xf393('0x1c')+_0x19c49f[_0xf393('0x1a')]||'wav','context':_0x19c49f[_0xf393('0x7')],'exten':_0x19c49f['exten'],'priority':_0x4c5906++,'VoiceExtensionId':_0x19c49f['id']});}return _0x22ef7c;}function _0x5f6cb3(_0x51bb27,_0x39cb29){var _0x451cad=[{'name':_0xf393('0x1d'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xf393('0x1e'),'param':0x2},{'name':_0xf393('0x1f'),'param':0x3}];var _0x2ba258={};var _0x419607=_0x39cb29[_0xf393('0x20')](',');var _0x3abfdc=[];for(var _0x106347=0x0;_0x106347<_0x451cad[_0xf393('0x21')];_0x106347++){switch(_0x451cad[_0x106347][_0xf393('0x22')]){case _0xf393('0x1d'):_0x2ba258['trunk']=_0x419607[_0x451cad[_0x106347][_0xf393('0x23')]][_0xf393('0x20')]('/')[0x1];_0x2ba258['phone']=_0x419607[_0x451cad[_0x106347][_0xf393('0x23')]]['split']('/')[0x2];_0x2ba258[_0xf393('0x24')]=_0x2ba258[_0xf393('0x25')]?_0x2ba258[_0xf393('0x25')][_0xf393('0x20')]('$')[0x0]:undefined;_0x2ba258[_0xf393('0x25')]=_0x51bb27[_0xf393('0x11')]?(_0x2ba258[_0xf393('0x24')]||'')+_0xf393('0x12')+_0x51bb27[_0xf393('0x11')]+'}':(_0x2ba258[_0xf393('0x24')]||'')+_0xf393('0x13');_0x3abfdc[_0x451cad[_0x106347]['param']]=[_0xf393('0x26'),_0x2ba258[_0xf393('0x1d')],_0x2ba258[_0xf393('0x25')]][_0xf393('0x27')]('/');break;case'options':_0x2ba258[_0xf393('0x1e')]=_0x419607[_0x451cad[_0x106347]['param']];if(_0x51bb27[_0xf393('0x1a')]!==_0xf393('0x28')){if(_0x2ba258[_0xf393('0x1e')][_0xf393('0x29')](_0xf393('0x2a'))<0x0){_0x2ba258['options']+=_0xf393('0x2a');}}else{_0x2ba258[_0xf393('0x1e')]=_0x2ba258[_0xf393('0x1e')]['replace']('U(xcally-mixmonitor-context)','');}_0x3abfdc[_0x451cad[_0x106347][_0xf393('0x23')]]=_0x2ba258[_0xf393('0x1e')];break;default:_0x3abfdc[_0x451cad[_0x106347][_0xf393('0x23')]]=_0x419607[_0x451cad[_0x106347][_0xf393('0x23')]];}}return _0x3abfdc[_0xf393('0x27')](',');}function _0x105161(_0x56eb6f,_0x104077,_0x28e11e){return new Promise(function(_0xf056a9,_0x17d6c0){var _0x97ead6=[];if(_[_0xf393('0x2b')](_0x104077))return _0xf056a9(_0x97ead6);_0x923151['Interval'][_0xf393('0x2c')]({'attributes':['id',_0xf393('0x2d'),'IntervalId'],'raw':!![]})[_0xf393('0x2e')](function(_0x1306eb){for(var _0x3c9cbd=0x0,_0x33fb7d=0x0;_0x3c9cbd<_0x104077[_0xf393('0x21')];_0x3c9cbd++,_0x33fb7d=0x0){var _0x592a8c=_0x104077[_0x3c9cbd];var _0x3b78c7=[];var _0x8c2645=[];delete _0x592a8c['id'];if(_0x592a8c[_0xf393('0x2d')]!=='*,*,*,*'){_0x592a8c[_0xf393('0x2f')]=[_0x592a8c[_0xf393('0x2d')]];}else{_0x592a8c[_0xf393('0x2f')]=_0x592a8c[_0xf393('0x30')]?_['map'](_[_0xf393('0x31')](_0x1306eb,{'IntervalId':_0x592a8c['IntervalId']}),_0xf393('0x2d')):[];}_0x592a8c['context']=_0x56eb6f[_0xf393('0x7')];_0x592a8c[_0xf393('0x8')]=_0x56eb6f[_0xf393('0x8')];if(_0x592a8c[_0xf393('0x6')])_0x592a8c['type']=_0x592a8c['type'][_0xf393('0x32')]();if(_0x56eb6f[_0xf393('0x6')]==='outbound'){if(_0x592a8c[_0xf393('0x19')](_0xf393('0x33'))&&_0x592a8c[_0xf393('0x33')]&&_0x592a8c[_0xf393('0x33')]!=='--'){_0x3b78c7['push']({'type':_0x592a8c[_0xf393('0x6')][_0xf393('0x32')](),'app':_0xf393('0x4'),'appdata':_0xf393('0x34')+_0x592a8c[_0xf393('0x33')],'context':_0x56eb6f[_0xf393('0x7')],'exten':_0x56eb6f['exten'],'priority':_0x592a8c['intervals']['length']+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});}_0x3b78c7[_0xf393('0xa')]({'type':_0x592a8c['type']['toLowerCase'](),'app':_0xf393('0x14'),'appdata':_0xf393('0x35')+(_0x592a8c['callerID']?_0xf393('0x36')+_0x592a8c[_0xf393('0x37')]+')':_0xf393('0x38')),'context':_0x56eb6f[_0xf393('0x7')],'exten':_0x56eb6f[_0xf393('0x8')],'priority':_0x592a8c['intervals'][_0xf393('0x21')]+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});}else{if(_0x592a8c[_0xf393('0x19')](_0xf393('0x39'))){if([_0xf393('0x3a'),_0xf393('0x3b')][_0xf393('0x3c')](_0x592a8c[_0xf393('0x3d')][_0xf393('0x32')]())&&_0x592a8c['appType']!==_0xf393('0x3e')){if(_0x592a8c[_0xf393('0x39')]){_0x3b78c7['push']({'type':_0x592a8c[_0xf393('0x6')]['toLowerCase'](),'app':_0xf393('0x14'),'appdata':_0xf393('0x3f'),'context':_0x56eb6f['context'],'exten':_0x56eb6f['exten'],'priority':_0x592a8c[_0xf393('0x2f')]['length']+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});_0x3b78c7[_0xf393('0xa')]({'type':_0x592a8c[_0xf393('0x6')][_0xf393('0x32')](),'app':_0xf393('0x4'),'appdata':_0xf393('0x40'),'context':_0x56eb6f[_0xf393('0x7')],'exten':_0x56eb6f[_0xf393('0x8')],'priority':_0x592a8c[_0xf393('0x2f')]['length']+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});}else{_0x3b78c7[_0xf393('0xa')]({'type':_0x592a8c[_0xf393('0x6')][_0xf393('0x32')](),'app':_0xf393('0x14'),'appdata':_0xf393('0x41'),'context':_0x56eb6f[_0xf393('0x7')],'exten':_0x56eb6f[_0xf393('0x8')],'priority':_0x592a8c[_0xf393('0x2f')][_0xf393('0x21')]+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});_0x3b78c7[_0xf393('0xa')]({'type':_0x592a8c[_0xf393('0x6')]['toLowerCase'](),'app':'Set','appdata':_0xf393('0x42'),'context':_0x56eb6f['context'],'exten':_0x56eb6f['exten'],'priority':_0x592a8c[_0xf393('0x2f')]['length']+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});}}}}for(var _0x49adbf=0x0;_0x49adbf<_0x592a8c[_0xf393('0x2f')]['length'];_0x49adbf++){var _0x204442=_0x28e11e+_0x592a8c['intervals'][_0xf393('0x21')];var _0x2284b4=_0x49adbf===_0x592a8c[_0xf393('0x2f')][_0xf393('0x21')]-0x1?_0x28e11e+_0x3b78c7['length']+_0x8c2645['length']+0x2:_0x28e11e+_0x49adbf+0x1;_0x3b78c7[_0xf393('0x43')](_0x49adbf,0x0,{'type':_0x56eb6f['type'],'app':_0xf393('0x44'),'appdata':_0x592a8c[_0xf393('0x2f')][_0x49adbf]+'?'+_0x56eb6f['context']+_0xf393('0x45')+_0x204442+':'+_0x56eb6f[_0xf393('0x7')]+',${EXTEN},'+_0x2284b4,'exten':_0x56eb6f[_0xf393('0x8')],'context':_0x56eb6f[_0xf393('0x7')],'priority':_0x28e11e+_0x49adbf,'VoiceExtensionId':_0x56eb6f['id']});}if(_0x592a8c[_0xf393('0x46')]==='outboundDial'){_0x592a8c['appdata']=_0x5f6cb3(_0x56eb6f,_0x592a8c[_0xf393('0x47')]);}if(_0x592a8c[_0xf393('0x46')]==='agi'){_0x3b78c7['push']({'type':_0x592a8c['type'][_0xf393('0x32')](),'app':_0xf393('0x4'),'appdata':_0xf393('0x48'),'context':_0x56eb6f[_0xf393('0x7')],'exten':_0x56eb6f[_0xf393('0x8')],'priority':_0x592a8c[_0xf393('0x2f')][_0xf393('0x21')]+_0x28e11e+_0x33fb7d++,'VoiceExtensionId':_0x56eb6f['id']});}_0x592a8c[_0xf393('0x49')]=_0x3b78c7[_0xf393('0x21')]?_[_0xf393('0x4a')](_0x3b78c7)[_0xf393('0x49')]+0x1:_0x28e11e;_0x97ead6=_[_0xf393('0x4b')](_0x97ead6,_0x3b78c7,[_0x592a8c],_0x8c2645);_0x28e11e=_['last'](_0x97ead6)['priority']+0x1;}return _0xf056a9(_0x97ead6);})[_0xf393('0x4c')](function(_0x4c0edf){_0x17d6c0(_0x4c0edf);});});}return _0xb8ee3e[_0xf393('0x4d')](_0xf393('0x4e'),attributes,{'tableName':_0xf393('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2e392e){var _0x4c6699=this[_0xf393('0x50')]({'plain':!![]});var _0x41ef17=_0x4c6699[_0xf393('0x6')]===_0xf393('0xf')?_0x3a70f3(_0x4c6699):_0x2a8edb(_0x4c6699);return _0x105161(_0x4c6699,_0x2e392e,_[_0xf393('0x4a')](_0x41ef17)[_0xf393('0x49')]+0x1)['then'](function(_0x42ab65){var _0x2a5c1a=_[_0xf393('0x4b')](_0x41ef17,_0x42ab65);_0x2a5c1a['push']({'type':_0x4c6699['type'],'app':_0xf393('0x51'),'exten':_0x4c6699['exten'],'context':_0x4c6699[_0xf393('0x7')],'priority':_[_0xf393('0x4a')](_0x2a5c1a)[_0xf393('0x49')]+0x1,'VoiceExtensionId':_0x4c6699['id']});return _0x2a5c1a;});}}});}; \ No newline at end of file +var _0xfc84=['catch','define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','push','inbound','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','timeout','options','url','split','name','trunk','phone','prefix','param','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','then','length','*,*,*,*','intervals','map','filter','IntervalId','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xfc84,0x1e5));var _0x4fc8=function(_0x46dc03,_0x29b493){_0x46dc03=_0x46dc03-0x0;var _0x5c79a1=_0xfc84[_0x46dc03];return _0x5c79a1;};'use strict';var _=require(_0x4fc8('0x0'));var attributes=require(_0x4fc8('0x1'));module[_0x4fc8('0x2')]=function(_0x12214d){var _0x523cb9=_0x12214d[_0x4fc8('0x3')];function _0x4c8766(_0x1a7203){var _0x452d10=0x2;var _0x1e112c=[{'type':_0x1a7203[_0x4fc8('0x4')],'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0x6')+_0x1a7203[_0x4fc8('0x4')],'context':_0x1a7203['context'],'exten':_0x1a7203[_0x4fc8('0x7')],'priority':_0x452d10++,'VoiceExtensionId':_0x1a7203['id']}];if(_0x1a7203[_0x4fc8('0x4')]==='inbound'){_0x1e112c[_0x4fc8('0x8')]({'type':_0x4fc8('0x9'),'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0xa')+_0x1a7203['id'],'context':_0x1a7203[_0x4fc8('0xb')],'exten':_0x1a7203['exten'],'priority':_0x452d10++,'VoiceExtensionId':_0x1a7203['id']});}_0x1e112c[_0x4fc8('0x8')]({'type':_0x1a7203[_0x4fc8('0x4')],'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0xc'),'context':_0x1a7203['context'],'exten':_0x1a7203['exten'],'priority':_0x452d10++,'VoiceExtensionId':_0x1a7203['id']},{'type':_0x1a7203[_0x4fc8('0x4')],'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0xd'),'context':_0x1a7203[_0x4fc8('0xb')],'exten':_0x1a7203[_0x4fc8('0x7')],'priority':_0x452d10++,'VoiceExtensionId':_0x1a7203['id']},{'type':_0x1a7203[_0x4fc8('0x4')],'app':'Set','appdata':_0x4fc8('0xe'),'context':_0x1a7203[_0x4fc8('0xb')],'exten':_0x1a7203[_0x4fc8('0x7')],'priority':_0x452d10++,'VoiceExtensionId':_0x1a7203['id']});return _0x1e112c;}function _0x3d622a(_0x3a87b7){var _0x424242=0x2;var _0x570af3=[{'type':_0x4fc8('0xf'),'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0x10'),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':_0x4fc8('0xf'),'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0x11')+(_0x3a87b7[_0x4fc8('0x12')]?'${EXTEN:'+_0x3a87b7[_0x4fc8('0x12')]+'}':_0x4fc8('0x13')),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':_0x4fc8('0xf'),'app':'Set','appdata':_0x4fc8('0xa')+_0x3a87b7['id'],'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':'outbound','app':_0x4fc8('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x424242+0x2)+_0x4fc8('0x15')+(_0x424242+0x1)+')','context':_0x3a87b7['context'],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':_0x4fc8('0xf'),'app':'Set','appdata':_0x3a87b7[_0x4fc8('0x12')]?_0x4fc8('0x16')+_0x3a87b7[_0x4fc8('0x12')]+'}':_0x4fc8('0x17'),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':'outbound','app':'Set','appdata':_0x4fc8('0xc'),'context':_0x3a87b7['context'],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':'outbound','app':'Set','appdata':_0x4fc8('0xd'),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':'outbound','app':_0x4fc8('0x5'),'appdata':_0x4fc8('0xe'),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7[_0x4fc8('0x7')],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':_0x4fc8('0xf'),'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0x18')+_0x3a87b7['id'],'context':_0x3a87b7['context'],'exten':_0x3a87b7['exten'],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']}];if(_0x3a87b7['hasOwnProperty']('recordingFormat')&&_0x3a87b7['recordingFormat']!==_0x4fc8('0x19')){_0x570af3[_0x4fc8('0x8')]({'type':_0x4fc8('0xf'),'app':'Set','appdata':_0x4fc8('0x1a'),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7['exten'],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']},{'type':_0x4fc8('0xf'),'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0x1b')+_0x3a87b7[_0x4fc8('0x1c')]||_0x4fc8('0x1d'),'context':_0x3a87b7[_0x4fc8('0xb')],'exten':_0x3a87b7['exten'],'priority':_0x424242++,'VoiceExtensionId':_0x3a87b7['id']});}return _0x570af3;}function _0x12e1b9(_0x2bd89b,_0x1cbba7){var _0x3f64b8=[{'name':'trunk','param':0x0},{'name':_0x4fc8('0x1e'),'param':0x1},{'name':_0x4fc8('0x1f'),'param':0x2},{'name':_0x4fc8('0x20'),'param':0x3}];var _0x2c4f9c={};var _0x1b5162=_0x1cbba7[_0x4fc8('0x21')](',');var _0x3f887d=[];for(var _0x596cfe=0x0;_0x596cfe<_0x3f64b8['length'];_0x596cfe++){switch(_0x3f64b8[_0x596cfe][_0x4fc8('0x22')]){case _0x4fc8('0x23'):_0x2c4f9c[_0x4fc8('0x23')]=_0x1b5162[_0x3f64b8[_0x596cfe]['param']][_0x4fc8('0x21')]('/')[0x1];_0x2c4f9c[_0x4fc8('0x24')]=_0x1b5162[_0x3f64b8[_0x596cfe]['param']]['split']('/')[0x2];_0x2c4f9c[_0x4fc8('0x25')]=_0x2c4f9c[_0x4fc8('0x24')]?_0x2c4f9c[_0x4fc8('0x24')][_0x4fc8('0x21')]('$')[0x0]:undefined;_0x2c4f9c[_0x4fc8('0x24')]=_0x2bd89b['cutdigits']?(_0x2c4f9c[_0x4fc8('0x25')]||'')+'${EXTEN:'+_0x2bd89b[_0x4fc8('0x12')]+'}':(_0x2c4f9c['prefix']||'')+_0x4fc8('0x13');_0x3f887d[_0x3f64b8[_0x596cfe][_0x4fc8('0x26')]]=['SIP',_0x2c4f9c['trunk'],_0x2c4f9c[_0x4fc8('0x24')]][_0x4fc8('0x27')]('/');break;case'options':_0x2c4f9c[_0x4fc8('0x1f')]=_0x1b5162[_0x3f64b8[_0x596cfe][_0x4fc8('0x26')]];if(_0x2bd89b[_0x4fc8('0x1c')]!==_0x4fc8('0x19')){if(_0x2c4f9c[_0x4fc8('0x1f')]['indexOf'](_0x4fc8('0x28'))<0x0){_0x2c4f9c['options']+=_0x4fc8('0x28');}}else{_0x2c4f9c['options']=_0x2c4f9c[_0x4fc8('0x1f')][_0x4fc8('0x29')]('U(xcally-mixmonitor-context)','');}_0x3f887d[_0x3f64b8[_0x596cfe]['param']]=_0x2c4f9c['options'];break;default:_0x3f887d[_0x3f64b8[_0x596cfe]['param']]=_0x1b5162[_0x3f64b8[_0x596cfe][_0x4fc8('0x26')]];}}return _0x3f887d['join'](',');}function _0x1cb47d(_0x51ffe1,_0x284a86,_0x475497){return new Promise(function(_0x50ba82,_0x1b0162){var _0x1ff2ad=[];if(_['isEmpty'](_0x284a86))return _0x50ba82(_0x1ff2ad);_0x523cb9[_0x4fc8('0x2a')][_0x4fc8('0x2b')]({'attributes':['id',_0x4fc8('0x2c'),'IntervalId'],'raw':!![]})[_0x4fc8('0x2d')](function(_0x4be889){for(var _0x1050f2=0x0,_0x1c07f9=0x0;_0x1050f2<_0x284a86[_0x4fc8('0x2e')];_0x1050f2++,_0x1c07f9=0x0){var _0x472c39=_0x284a86[_0x1050f2];var _0x2be79c=[];var _0xef50de=[];delete _0x472c39['id'];if(_0x472c39[_0x4fc8('0x2c')]!==_0x4fc8('0x2f')){_0x472c39[_0x4fc8('0x30')]=[_0x472c39[_0x4fc8('0x2c')]];}else{_0x472c39[_0x4fc8('0x30')]=_0x472c39['IntervalId']?_[_0x4fc8('0x31')](_[_0x4fc8('0x32')](_0x4be889,{'IntervalId':_0x472c39[_0x4fc8('0x33')]}),_0x4fc8('0x2c')):[];}_0x472c39[_0x4fc8('0xb')]=_0x51ffe1['context'];_0x472c39[_0x4fc8('0x7')]=_0x51ffe1[_0x4fc8('0x7')];if(_0x472c39['type'])_0x472c39[_0x4fc8('0x4')]=_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')]();if(_0x51ffe1[_0x4fc8('0x4')]===_0x4fc8('0xf')){if(_0x472c39[_0x4fc8('0x35')](_0x4fc8('0x36'))&&_0x472c39[_0x4fc8('0x36')]&&_0x472c39[_0x4fc8('0x36')]!=='--'){_0x2be79c['push']({'type':_0x472c39['type'][_0x4fc8('0x34')](),'app':'Set','appdata':_0x4fc8('0x37')+_0x472c39['tag'],'context':_0x51ffe1[_0x4fc8('0xb')],'exten':_0x51ffe1['exten'],'priority':_0x472c39[_0x4fc8('0x30')]['length']+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});}_0x2be79c[_0x4fc8('0x8')]({'type':_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')](),'app':'ExecIf','appdata':_0x4fc8('0x38')+(_0x472c39[_0x4fc8('0x39')]?'Set(CALLERID(all)='+_0x472c39[_0x4fc8('0x39')]+')':_0x4fc8('0x3a')),'context':_0x51ffe1[_0x4fc8('0xb')],'exten':_0x51ffe1['exten'],'priority':_0x472c39[_0x4fc8('0x30')][_0x4fc8('0x2e')]+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});}else{if(_0x472c39[_0x4fc8('0x35')](_0x4fc8('0x3b'))){if([_0x4fc8('0x3c'),_0x4fc8('0x3d')]['includes'](_0x472c39[_0x4fc8('0x3e')]['toLowerCase']())&&_0x472c39['appType']!==_0x4fc8('0x3f')){if(_0x472c39['answer']){_0x2be79c[_0x4fc8('0x8')]({'type':_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')](),'app':_0x4fc8('0x14'),'appdata':_0x4fc8('0x40'),'context':_0x51ffe1['context'],'exten':_0x51ffe1[_0x4fc8('0x7')],'priority':_0x472c39['intervals'][_0x4fc8('0x2e')]+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});_0x2be79c[_0x4fc8('0x8')]({'type':_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')](),'app':_0x4fc8('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x51ffe1[_0x4fc8('0xb')],'exten':_0x51ffe1[_0x4fc8('0x7')],'priority':_0x472c39[_0x4fc8('0x30')][_0x4fc8('0x2e')]+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});}else{_0x2be79c['push']({'type':_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x51ffe1[_0x4fc8('0xb')],'exten':_0x51ffe1['exten'],'priority':_0x472c39[_0x4fc8('0x30')]['length']+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});_0x2be79c['push']({'type':_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')](),'app':_0x4fc8('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x51ffe1[_0x4fc8('0xb')],'exten':_0x51ffe1['exten'],'priority':_0x472c39['intervals'][_0x4fc8('0x2e')]+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});}}}}for(var _0x58f57f=0x0;_0x58f57f<_0x472c39[_0x4fc8('0x30')]['length'];_0x58f57f++){var _0x57b684=_0x475497+_0x472c39[_0x4fc8('0x30')][_0x4fc8('0x2e')];var _0x1ae4b9=_0x58f57f===_0x472c39[_0x4fc8('0x30')][_0x4fc8('0x2e')]-0x1?_0x475497+_0x2be79c['length']+_0xef50de['length']+0x2:_0x475497+_0x58f57f+0x1;_0x2be79c[_0x4fc8('0x41')](_0x58f57f,0x0,{'type':_0x51ffe1[_0x4fc8('0x4')],'app':'GotoIfTime','appdata':_0x472c39['intervals'][_0x58f57f]+'?'+_0x51ffe1[_0x4fc8('0xb')]+',${EXTEN},'+_0x57b684+':'+_0x51ffe1[_0x4fc8('0xb')]+_0x4fc8('0x42')+_0x1ae4b9,'exten':_0x51ffe1[_0x4fc8('0x7')],'context':_0x51ffe1[_0x4fc8('0xb')],'priority':_0x475497+_0x58f57f,'VoiceExtensionId':_0x51ffe1['id']});}if(_0x472c39[_0x4fc8('0x43')]===_0x4fc8('0x44')){_0x472c39[_0x4fc8('0x45')]=_0x12e1b9(_0x51ffe1,_0x472c39[_0x4fc8('0x45')]);}if(_0x472c39[_0x4fc8('0x43')]===_0x4fc8('0x46')){_0x2be79c[_0x4fc8('0x8')]({'type':_0x472c39[_0x4fc8('0x4')][_0x4fc8('0x34')](),'app':_0x4fc8('0x5'),'appdata':_0x4fc8('0x47'),'context':_0x51ffe1[_0x4fc8('0xb')],'exten':_0x51ffe1[_0x4fc8('0x7')],'priority':_0x472c39[_0x4fc8('0x30')][_0x4fc8('0x2e')]+_0x475497+_0x1c07f9++,'VoiceExtensionId':_0x51ffe1['id']});}_0x472c39[_0x4fc8('0x48')]=_0x2be79c[_0x4fc8('0x2e')]?_[_0x4fc8('0x49')](_0x2be79c)['priority']+0x1:_0x475497;_0x1ff2ad=_[_0x4fc8('0x4a')](_0x1ff2ad,_0x2be79c,[_0x472c39],_0xef50de);_0x475497=_['last'](_0x1ff2ad)[_0x4fc8('0x48')]+0x1;}return _0x50ba82(_0x1ff2ad);})[_0x4fc8('0x4b')](function(_0x1f8cc4){_0x1b0162(_0x1f8cc4);});});}return _0x12214d[_0x4fc8('0x4c')](_0x4fc8('0x4d'),attributes,{'tableName':_0x4fc8('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x16bbc9){var _0x8c71c2=this['get']({'plain':!![]});var _0xf7131a=_0x8c71c2[_0x4fc8('0x4')]===_0x4fc8('0xf')?_0x3d622a(_0x8c71c2):_0x4c8766(_0x8c71c2);return _0x1cb47d(_0x8c71c2,_0x16bbc9,_[_0x4fc8('0x49')](_0xf7131a)[_0x4fc8('0x48')]+0x1)['then'](function(_0x577d82){var _0x61ceb6=_['concat'](_0xf7131a,_0x577d82);_0x61ceb6[_0x4fc8('0x8')]({'type':_0x8c71c2[_0x4fc8('0x4')],'app':_0x4fc8('0x4f'),'exten':_0x8c71c2['exten'],'context':_0x8c71c2[_0x4fc8('0xb')],'priority':_['last'](_0x61ceb6)[_0x4fc8('0x48')]+0x1,'VoiceExtensionId':_0x8c71c2['id']});return _0x61ceb6;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8146ed1..e1d6167 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 _0xee55=['VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','then','info'];(function(_0x5585ca,_0x4c6c65){var _0x415be9=function(_0x1cc36c){while(--_0x1cc36c){_0x5585ca['push'](_0x5585ca['shift']());}};_0x415be9(++_0x4c6c65);}(_0xee55,0x1a0));var _0x5ee5=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xee55[_0x455c6c];return _0x488242;};'use strict';var _=require(_0x5ee5('0x0'));var util=require('util');var moment=require(_0x5ee5('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ee5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ee5('0x3'))['db'];var utils=require(_0x5ee5('0x4'));var logger=require('../../config/logger')(_0x5ee5('0x5'));var config=require(_0x5ee5('0x6'));var jayson=require(_0x5ee5('0x7'));var client=jayson[_0x5ee5('0x8')][_0x5ee5('0x9')]({'port':0x232a});config[_0x5ee5('0xa')]=_[_0x5ee5('0xb')](config['redis'],{'host':_0x5ee5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5ee5('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d916b,_0x449e2f,_0x269586){return new BPromise(function(_0xd361f5,_0xf0d40c){return client['request'](_0x5d916b,_0x269586)[_0x5ee5('0xe')](function(_0x19109d){logger[_0x5ee5('0xf')](_0x5ee5('0x10'),_0x449e2f,'request\x20sent');logger['debug'](_0x5ee5('0x11'),_0x449e2f,_0x5ee5('0x12'),JSON[_0x5ee5('0x13')](_0x19109d));if(_0x19109d['error']){if(_0x19109d[_0x5ee5('0x14')][_0x5ee5('0x15')]===0x1f4){logger[_0x5ee5('0x14')](_0x5ee5('0x10'),_0x449e2f,_0x19109d[_0x5ee5('0x14')][_0x5ee5('0x16')]);return _0xf0d40c(_0x19109d[_0x5ee5('0x14')]['message']);}logger[_0x5ee5('0x14')](_0x5ee5('0x10'),_0x449e2f,_0x19109d[_0x5ee5('0x14')][_0x5ee5('0x16')]);return _0xd361f5(_0x19109d['error']['message']);}else{logger[_0x5ee5('0xf')](_0x5ee5('0x10'),_0x449e2f,_0x5ee5('0x12'));_0xd361f5(_0x19109d['result'][_0x5ee5('0x16')]);}})['catch'](function(_0x458eb0){logger['error'](_0x5ee5('0x10'),_0x449e2f,_0x458eb0);_0xf0d40c(_0x458eb0);});});}exports[_0x5ee5('0x17')]=function(_0x17417a){var _0x33f150=this;return new Promise(function(_0x1acf8f,_0x24ce1b){return db[_0x5ee5('0x18')][_0x5ee5('0x19')]({'raw':_0x17417a[_0x5ee5('0x1a')]?_0x17417a[_0x5ee5('0x1a')][_0x5ee5('0x1b')]===undefined?!![]:![]:!![],'where':_0x17417a[_0x5ee5('0x1a')]?_0x17417a[_0x5ee5('0x1a')][_0x5ee5('0x1c')]||null:null,'attributes':_0x17417a[_0x5ee5('0x1a')]?_0x17417a[_0x5ee5('0x1a')][_0x5ee5('0x1d')]||null:null,'limit':_0x17417a[_0x5ee5('0x1a')]?_0x17417a[_0x5ee5('0x1a')][_0x5ee5('0x1e')]||null:null,'include':_0x17417a['options']?_0x17417a['options'][_0x5ee5('0x1f')]?_[_0x5ee5('0x20')](_0x17417a[_0x5ee5('0x1a')]['include'],function(_0x1df98d){return{'model':db[_0x1df98d['model']],'as':_0x1df98d['as'],'attributes':_0x1df98d[_0x5ee5('0x1d')],'include':_0x1df98d[_0x5ee5('0x1f')]?_[_0x5ee5('0x20')](_0x1df98d['include'],function(_0x5f530c){return{'model':db[_0x5f530c[_0x5ee5('0x21')]],'as':_0x5f530c['as'],'attributes':_0x5f530c[_0x5ee5('0x1d')],'include':_0x5f530c[_0x5ee5('0x1f')]?_[_0x5ee5('0x20')](_0x5f530c[_0x5ee5('0x1f')],function(_0x14254a){return{'model':db[_0x14254a[_0x5ee5('0x21')]],'as':_0x14254a['as'],'attributes':_0x14254a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ee5('0xe')](function(_0x1947ae){logger[_0x5ee5('0xf')]('GetVoiceExtension',_0x17417a);logger[_0x5ee5('0x22')](_0x5ee5('0x17'),_0x17417a,JSON[_0x5ee5('0x13')](_0x1947ae));_0x1acf8f(_0x1947ae);})[_0x5ee5('0x23')](function(_0x287842){logger[_0x5ee5('0x14')](_0x5ee5('0x17'),_0x287842[_0x5ee5('0x16')],_0x17417a);_0x24ce1b(_0x33f150['error'](0x1f4,_0x287842[_0x5ee5('0x16')]));});});}; \ No newline at end of file +var _0xda19=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','map','model','include','catch','util','moment','randomstring'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xda19,0xd5));var _0x9da1=function(_0x4b13f8,_0x3ed4e1){_0x4b13f8=_0x4b13f8-0x0;var _0x2136d2=_0xda19[_0x4b13f8];return _0x2136d2;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});config[_0x9da1('0xa')]=_[_0x9da1('0xb')](config[_0x9da1('0xa')],{'host':_0x9da1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x9da1('0xd')](socket);function respondWithRpcPromise(_0x493d0b,_0x33cfe5,_0x1cca84){return new BPromise(function(_0x3ba3d3,_0x1ab988){return client[_0x9da1('0xe')](_0x493d0b,_0x1cca84)[_0x9da1('0xf')](function(_0x9fd032){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x33cfe5,_0x9da1('0x10'));logger['debug'](_0x9da1('0x11'),_0x33cfe5,_0x9da1('0x10'),JSON[_0x9da1('0x12')](_0x9fd032));if(_0x9fd032[_0x9da1('0x13')]){if(_0x9fd032['error'][_0x9da1('0x14')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x33cfe5,_0x9fd032[_0x9da1('0x13')]['message']);return _0x1ab988(_0x9fd032[_0x9da1('0x13')][_0x9da1('0x15')]);}logger[_0x9da1('0x13')](_0x9da1('0x16'),_0x33cfe5,_0x9fd032[_0x9da1('0x13')]['message']);return _0x3ba3d3(_0x9fd032[_0x9da1('0x13')][_0x9da1('0x15')]);}else{logger[_0x9da1('0x17')](_0x9da1('0x16'),_0x33cfe5,_0x9da1('0x10'));_0x3ba3d3(_0x9fd032[_0x9da1('0x18')]['message']);}})['catch'](function(_0x17205d){logger[_0x9da1('0x13')](_0x9da1('0x16'),_0x33cfe5,_0x17205d);_0x1ab988(_0x17205d);});});}exports[_0x9da1('0x19')]=function(_0x40a967){var _0x3b1645=this;return new Promise(function(_0xe56279,_0x47e5cf){return db[_0x9da1('0x1a')][_0x9da1('0x1b')]({'raw':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')][_0x9da1('0x1d')]===undefined?!![]:![]:!![],'where':_0x40a967['options']?_0x40a967['options'][_0x9da1('0x1e')]||null:null,'attributes':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')][_0x9da1('0x1f')]||null:null,'limit':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')]['limit']||null:null,'include':_0x40a967[_0x9da1('0x1c')]?_0x40a967[_0x9da1('0x1c')]['include']?_[_0x9da1('0x20')](_0x40a967[_0x9da1('0x1c')]['include'],function(_0x2fd49c){return{'model':db[_0x2fd49c[_0x9da1('0x21')]],'as':_0x2fd49c['as'],'attributes':_0x2fd49c['attributes'],'include':_0x2fd49c[_0x9da1('0x22')]?_[_0x9da1('0x20')](_0x2fd49c['include'],function(_0x5c09ed){return{'model':db[_0x5c09ed[_0x9da1('0x21')]],'as':_0x5c09ed['as'],'attributes':_0x5c09ed[_0x9da1('0x1f')],'include':_0x5c09ed['include']?_[_0x9da1('0x20')](_0x5c09ed['include'],function(_0x5a6f2d){return{'model':db[_0x5a6f2d['model']],'as':_0x5a6f2d['as'],'attributes':_0x5a6f2d[_0x9da1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9da1('0xf')](function(_0x24c6d5){logger[_0x9da1('0x17')](_0x9da1('0x19'),_0x40a967);logger['debug'](_0x9da1('0x19'),_0x40a967,JSON['stringify'](_0x24c6d5));_0xe56279(_0x24c6d5);})[_0x9da1('0x23')](function(_0x235ced){logger['error'](_0x9da1('0x19'),_0x235ced[_0x9da1('0x15')],_0x40a967);_0x47e5cf(_0x3b1645['error'](0x1f4,_0x235ced[_0x9da1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f3d32d3..49441bd 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x484e4a,_0x24691){var _0x59b8d8=function(_0x2d35c1){while(--_0x2d35c1){_0x484e4a['push'](_0x484e4a['shift']());}};_0x59b8d8(++_0x24691);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x814b,0x1a2));var _0xb814=function(_0x26e424,_0xfcf210){_0x26e424=_0x26e424-0x0;var _0x2c81d6=_0x814b[_0x26e424];return _0x2c81d6;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ba3040b..04a93bf 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 _0x687b=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2d8ae6,_0x2b9d58){var _0x557821=function(_0x11986c){while(--_0x11986c){_0x2d8ae6['push'](_0x2d8ae6['shift']());}};_0x557821(++_0x2b9d58);}(_0x687b,0x14a));var _0xb687=function(_0x3b6d58,_0xb29c70){_0x3b6d58=_0x3b6d58-0x0;var _0x64d7dc=_0x687b[_0x3b6d58];return _0x64d7dc;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/messages',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['delete'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=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(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x7ee1,0x8d));var _0x17ee=function(_0x48a20a,_0x1f3fc3){_0x48a20a=_0x48a20a-0x0;var _0x431f47=_0x7ee1[_0x48a20a];return _0x431f47;};'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 3dcc65b..14b5b77 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 _0x6f93=['INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','STRING','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x5ae03a,_0x1a9698){var _0x12733f=function(_0x58cf52){while(--_0x58cf52){_0x5ae03a['push'](_0x5ae03a['shift']());}};_0x12733f(++_0x1a9698);}(_0x6f93,0xd6));var _0x36f9=function(_0x5410c9,_0x5294bd){_0x5410c9=_0x5410c9-0x0;var _0x2a7c0e=_0x6f93[_0x5410c9];return _0x2a7c0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x36f9('0x0')]},'context':{'type':Sequelize[_0x36f9('0x0')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x36f9('0x0')],'defaultValue':'','allowNull':![],'unique':_0x36f9('0x1')},'password':{'type':Sequelize[_0x36f9('0x0')]},'fullname':{'type':Sequelize[_0x36f9('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x82c588){this[_0x36f9('0x2')](_0x36f9('0x3'),typeof _0x82c588===_0x36f9('0x4')&&_0x82c588['trim']()?_0x82c588[_0x36f9('0x5')]():null);}},'pager':{'type':Sequelize[_0x36f9('0x0')]},'tz':{'type':Sequelize[_0x36f9('0x0')],'defaultValue':_0x36f9('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x36f9('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x36f9('0x0')]},'review':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x36f9('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':_0x36f9('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x36f9('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x36f9('0x8')](_0x36f9('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x36f9('0x0')]},'emailbody':{'type':Sequelize[_0x36f9('0x0')]},'maxsecs':{'type':Sequelize[_0x36f9('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x36f9('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x36f9('0xb')],'get':function(){return this['getDataValue'](_0x36f9('0xc'))+_0x36f9('0xd')+this[_0x36f9('0xe')](_0x36f9('0xf'));}}}; \ No newline at end of file +var _0x49b9=['contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x49b9,0x6d));var _0x949b=function(_0x1f5cc2,_0x582935){_0x1f5cc2=_0x1f5cc2-0x0;var _0x238d8d=_0x49b9[_0x1f5cc2];return _0x238d8d;};'use strict';var Sequelize=require(_0x949b('0x0'));module[_0x949b('0x1')]={'customer_id':{'type':Sequelize[_0x949b('0x2')]},'context':{'type':Sequelize[_0x949b('0x2')],'defaultValue':'from-voicemail','unique':_0x949b('0x3')},'mailbox':{'type':Sequelize[_0x949b('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x949b('0x2')]},'fullname':{'type':Sequelize[_0x949b('0x2')]},'email':{'type':Sequelize[_0x949b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x21cd9b){this[_0x949b('0x4')]('email',typeof _0x21cd9b===_0x949b('0x5')&&_0x21cd9b['trim']()?_0x21cd9b[_0x949b('0x6')]():null);}},'pager':{'type':Sequelize[_0x949b('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x949b('0x7')},'attach':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':_0x949b('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x949b('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x949b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x949b('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':_0x949b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x949b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x949b('0x8')](_0x949b('0x9'),'no'),'defaultValue':_0x949b('0x9'),'allowNull':![]},'stamp':{'type':_0x949b('0xb')},'emailsubject':{'type':Sequelize[_0x949b('0x2')]},'emailbody':{'type':Sequelize[_0x949b('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x949b('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x949b('0xd')],'get':function(){return this[_0x949b('0xe')]('fullname')+'\x20-\x20'+this[_0x949b('0xe')](_0x949b('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5720008..56ed27d 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 _0xeffd=['create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','order','pick','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','type','merge','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find'];(function(_0x5ebe7e,_0x3c2685){var _0x482143=function(_0x11a462){while(--_0x11a462){_0x5ebe7e['push'](_0x5ebe7e['shift']());}};_0x482143(++_0x3c2685);}(_0xeffd,0x6b));var _0xdeff=function(_0x6acd99,_0x40b74b){_0x6acd99=_0x6acd99-0x0;var _0x3d4337=_0xeffd[_0x6acd99];return _0x3d4337;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){var _0x32add9=_0x15c425['get']({'plain':!![]});var _0xb08f19=_0xdeff('0x29');return db[_0xdeff('0x2a')][_0xdeff('0x28')]({'where':{'type':_0xb08f19,'resourceId':_0x32add9['id']}})[_0xdeff('0x27')](function(){return _0x15c425;});})[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bb72,_0x1a546c){return function(_0x53b168){if(!_0x53b168){_0x31bb72['sendStatus'](0x194);}return _0x53b168;};}function handleError(_0x830be4,_0x2ea8e9){_0x2ea8e9=_0x2ea8e9||0x1f4;return function(_0x16b2d0){logger[_0xdeff('0x2b')](_0x16b2d0[_0xdeff('0x2c')]);if(_0x16b2d0[_0xdeff('0x2d')]){delete _0x16b2d0[_0xdeff('0x2d')];}_0x830be4['status'](_0x2ea8e9)[_0xdeff('0x2e')](_0x16b2d0);};}exports[_0xdeff('0x2f')]=function(_0x34e258,_0x5045b8){var _0x59f7a0={},_0x346743={},_0x505e3f={'count':0x0,'rows':[]};var _0x69842a=_[_0xdeff('0x30')](db[_0xdeff('0x31')]['rawAttributes'],function(_0x189a51){return{'name':_0x189a51['fieldName'],'type':_0x189a51['type'][_0xdeff('0x32')]};});_0x346743[_0xdeff('0x33')]=_[_0xdeff('0x30')](_0x69842a,_0xdeff('0x2d'));_0x346743['query']=_[_0xdeff('0x34')](_0x34e258[_0xdeff('0x35')]);_0x346743[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x346743[_0xdeff('0x33')],_0x346743[_0xdeff('0x35')]);_0x59f7a0[_0xdeff('0x38')]=_['intersection'](_0x346743[_0xdeff('0x33')],qs['fields'](_0x34e258[_0xdeff('0x35')][_0xdeff('0x39')]));_0x59f7a0[_0xdeff('0x38')]=_0x59f7a0[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x59f7a0[_0xdeff('0x38')]:_0x346743['model'];if(!_0x34e258[_0xdeff('0x35')][_0xdeff('0x3b')]('nolimit')){_0x59f7a0[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x34e258[_0xdeff('0x35')][_0xdeff('0x21')]);_0x59f7a0[_0xdeff('0x1f')]=qs[_0xdeff('0x1f')](_0x34e258[_0xdeff('0x35')][_0xdeff('0x1f')]);}_0x59f7a0['order']=qs[_0xdeff('0x3c')](_0x34e258['query'][_0xdeff('0x3c')]);_0x59f7a0[_0xdeff('0x3d')]=qs[_0xdeff('0x36')](_['pick'](_0x34e258[_0xdeff('0x35')],_0x346743[_0xdeff('0x36')]),_0x69842a);if(_0x34e258[_0xdeff('0x35')][_0xdeff('0x3e')]){_0x59f7a0[_0xdeff('0x3d')]=_['merge'](_0x59f7a0[_0xdeff('0x3d')],{'$or':_['map'](_0x69842a,function(_0x393d75){if(_0x393d75[_0xdeff('0x3f')]!=='VIRTUAL'){var _0x30609b={};_0x30609b[_0x393d75[_0xdeff('0x2d')]]={'$like':'%'+_0x34e258[_0xdeff('0x35')][_0xdeff('0x3e')]+'%'};return _0x30609b;}})});}_0x59f7a0=_[_0xdeff('0x40')]({},_0x59f7a0,_0x34e258['options']);var _0x3d8a33={'where':_0x59f7a0[_0xdeff('0x3d')]};return db[_0xdeff('0x31')][_0xdeff('0x41')](_0x3d8a33)[_0xdeff('0x27')](function(_0x5dfbb3){_0x505e3f['count']=_0x5dfbb3;if(_0x34e258[_0xdeff('0x35')][_0xdeff('0x42')]){_0x59f7a0[_0xdeff('0x43')]=[{'all':!![]}];}return db[_0xdeff('0x31')][_0xdeff('0x44')](_0x59f7a0);})[_0xdeff('0x27')](function(_0x2cd68a){_0x505e3f['rows']=_0x2cd68a;return _0x505e3f;})[_0xdeff('0x27')](respondWithFilteredResult(_0x5045b8,_0x59f7a0))[_0xdeff('0x45')](handleError(_0x5045b8,null));};exports[_0xdeff('0x46')]=function(_0x54fa5b,_0x1c3532){var _0x2c5eee={'raw':!![],'where':{'id':_0x54fa5b[_0xdeff('0x47')]['id']}},_0x14dc7b={};_0x14dc7b['model']=_[_0xdeff('0x34')](db[_0xdeff('0x31')][_0xdeff('0x48')]);_0x14dc7b[_0xdeff('0x35')]=_[_0xdeff('0x34')](_0x54fa5b[_0xdeff('0x35')]);_0x14dc7b[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x14dc7b['model'],_0x14dc7b[_0xdeff('0x35')]);_0x2c5eee[_0xdeff('0x38')]=_[_0xdeff('0x37')](_0x14dc7b[_0xdeff('0x33')],qs[_0xdeff('0x39')](_0x54fa5b['query'][_0xdeff('0x39')]));_0x2c5eee[_0xdeff('0x38')]=_0x2c5eee[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x2c5eee[_0xdeff('0x38')]:_0x14dc7b['model'];if(_0x54fa5b[_0xdeff('0x35')]['includeAll']){_0x2c5eee[_0xdeff('0x43')]=[{'all':!![]}];}_0x2c5eee=_[_0xdeff('0x40')]({},_0x2c5eee,_0x54fa5b[_0xdeff('0x49')]);return db[_0xdeff('0x31')][_0xdeff('0x4a')](_0x2c5eee)[_0xdeff('0x27')](handleEntityNotFound(_0x1c3532,null))['then'](respondWithResult(_0x1c3532,null))['catch'](handleError(_0x1c3532,null));};exports[_0xdeff('0x4b')]=function(_0xf91a72,_0x3dc206){return db['VoiceMail']['create'](_0xf91a72[_0xdeff('0x4c')],{})[_0xdeff('0x27')](function(_0x497d9f){var _0x23f17d=_0xf91a72[_0xdeff('0x4d')][_0xdeff('0x4e')]({'plain':!![]});if(!_0x23f17d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23f17d[_0xdeff('0x4f')]===_0xdeff('0x4d')){var _0x1ca376=_0x497d9f['get']({'plain':!![]});var _0xce8379=_0xdeff('0x29');return db[_0xdeff('0x50')][_0xdeff('0x4a')]({'where':{'name':_0xce8379,'userProfileId':_0x23f17d[_0xdeff('0x51')]},'raw':!![]})[_0xdeff('0x27')](function(_0x2c7fa4){if(_0x2c7fa4&&_0x2c7fa4['autoAssociation']===0x0){return db[_0xdeff('0x2a')][_0xdeff('0x4b')]({'name':_0x1ca376['name'],'resourceId':_0x1ca376['id'],'type':_0x2c7fa4[_0xdeff('0x2d')],'sectionId':_0x2c7fa4['id']},{})[_0xdeff('0x27')](function(){return _0x497d9f;});}else{return _0x497d9f;}})[_0xdeff('0x45')](function(_0x33482b){logger[_0xdeff('0x2b')](_0xdeff('0x52'),_0x33482b);throw _0x33482b;});}return _0x497d9f;})[_0xdeff('0x27')](respondWithResult(_0x3dc206,0xc9))[_0xdeff('0x45')](handleError(_0x3dc206,null));};exports['update']=function(_0x1b7eb3,_0x3a518d){if(_0x1b7eb3[_0xdeff('0x4c')]['id']){delete _0x1b7eb3['body']['id'];}return db['VoiceMail'][_0xdeff('0x4a')]({'where':{'id':_0x1b7eb3[_0xdeff('0x47')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x3a518d,null))[_0xdeff('0x27')](saveUpdates(_0x1b7eb3[_0xdeff('0x4c')],null))[_0xdeff('0x27')](respondWithResult(_0x3a518d,null))['catch'](handleError(_0x3a518d,null));};exports['destroy']=function(_0x38338b,_0x1cc2c1){return db['VoiceMail']['find']({'where':{'id':_0x38338b[_0xdeff('0x47')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x1cc2c1,null))['then'](removeEntity(_0x1cc2c1,null))[_0xdeff('0x45')](handleError(_0x1cc2c1,null));};exports[_0xdeff('0x53')]=function(_0x577fa8,_0x14fa7f,_0xe731d8){return db['VoiceMail'][_0xdeff('0x54')]({'where':{'id':_0x577fa8[_0xdeff('0x47')]['id']}})['then'](handleEntityNotFound(_0x14fa7f,null))[_0xdeff('0x27')](function(_0x152187){var _0x2a83ac;var _0x592ea6={},_0x47e86d={};_0x47e86d[_0xdeff('0x33')]=_['keys'](db[_0xdeff('0x55')][_0xdeff('0x48')]);_0x47e86d[_0xdeff('0x35')]=_[_0xdeff('0x34')](_0x577fa8[_0xdeff('0x35')]);_0x47e86d['filters']=_['intersection'](_0x47e86d[_0xdeff('0x33')],_0x47e86d[_0xdeff('0x35')]);_0x592ea6[_0xdeff('0x38')]=_[_0xdeff('0x37')](_0x47e86d[_0xdeff('0x33')],qs[_0xdeff('0x39')](_0x577fa8['query'][_0xdeff('0x39')]));_0x592ea6['attributes']=_0x592ea6[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x592ea6[_0xdeff('0x38')]:_0x47e86d[_0xdeff('0x33')];if(!_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3b')](_0xdeff('0x56'))){_0x592ea6[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x577fa8['query'][_0xdeff('0x21')]);_0x592ea6['offset']=qs[_0xdeff('0x1f')](_0x577fa8[_0xdeff('0x35')]['offset']);}_0x592ea6[_0xdeff('0x57')]=qs['sort'](_0x577fa8[_0xdeff('0x35')]['sort']);_0x592ea6['where']=qs[_0xdeff('0x36')](_[_0xdeff('0x58')](_0x577fa8['query'],_0x47e86d[_0xdeff('0x36')]));if(_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3e')]){_0x592ea6[_0xdeff('0x3d')]=_[_0xdeff('0x40')](_0x592ea6[_0xdeff('0x3d')],{'$or':_[_0xdeff('0x30')](_0x592ea6[_0xdeff('0x38')],function(_0x46046a){var _0x517ca7={};_0x517ca7[_0x46046a]={'$like':'%'+_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3e')]+'%'};return _0x517ca7;})});}_0x592ea6['where']=_['merge'](_0x592ea6[_0xdeff('0x3d')],{'mailboxuser':_0x152187[_0xdeff('0x59')]});_0x592ea6=_['merge']({},_0x592ea6,_0x577fa8[_0xdeff('0x49')]);return db[_0xdeff('0x55')][_0xdeff('0x5a')](_0x592ea6)[_0xdeff('0x27')](respondWithFilteredResult(_0x14fa7f,_0x592ea6));})[_0xdeff('0x45')](handleError(_0x14fa7f,null));}; \ No newline at end of file +var _0xa5fa=['includeAll','include','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','stack','name','map','rawAttributes','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceMail'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x291cd6,_0x9e2da8){_0x291cd6=_0x291cd6-0x0;var _0x5927fe=_0xa5fa[_0x291cd6];return _0x5927fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];function respondWithStatusCode(_0x9aeae9,_0x252ae0){_0x252ae0=_0x252ae0||0xcc;return function(_0x48d1d3){if(_0x48d1d3){return _0x9aeae9[_0xaa5f('0x17')](_0x252ae0);}return _0x9aeae9['status'](_0x252ae0)[_0xaa5f('0x18')]();};}function respondWithResult(_0x23f872,_0x31eabc){_0x31eabc=_0x31eabc||0xc8;return function(_0x19aa27){if(_0x19aa27){return _0x23f872[_0xaa5f('0x19')](_0x31eabc)['json'](_0x19aa27);}};}function respondWithFilteredResult(_0x4fc828,_0x1f37fb){return function(_0x291042){if(_0x291042){var _0xb0bfb6=typeof _0x1f37fb[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x1f37fb[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x28407c=_0x291042[_0xaa5f('0x1d')];var _0x3d874f=_0xb0bfb6?0x0:_0x1f37fb[_0xaa5f('0x1a')];var _0x1019e8=_0xb0bfb6?_0x291042['count']:_0x1f37fb[_0xaa5f('0x1a')]+_0x1f37fb[_0xaa5f('0x1c')];var _0x1cbab5;if(_0x1019e8>=_0x28407c){_0x1019e8=_0x28407c;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x4fc828[_0xaa5f('0x19')](_0x1cbab5);return _0x4fc828[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x3d874f+'-'+_0x1019e8+'/'+_0x28407c)[_0xaa5f('0x20')](_0x291042);}return null;};}function patchUpdates(_0x194691){return function(_0x2d8fc3){try{jsonpatch[_0xaa5f('0x21')](_0x2d8fc3,_0x194691,!![]);}catch(_0x40c223){return BPromise[_0xaa5f('0x22')](_0x40c223);}return _0x2d8fc3[_0xaa5f('0x23')]();};}function saveUpdates(_0x5238a8,_0x1e917d){return function(_0x57082c){if(_0x57082c){return _0x57082c[_0xaa5f('0x24')](_0x5238a8)[_0xaa5f('0x25')](function(_0x561381){return _0x561381;});}return null;};}function removeEntity(_0x1baa2e,_0x1032ce){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0xaa5f('0x26')]()[_0xaa5f('0x25')](function(){var _0x32cd16=_0x5b9f0b[_0xaa5f('0x27')]({'plain':!![]});var _0x1f66c0=_0xaa5f('0x28');return db[_0xaa5f('0x29')][_0xaa5f('0x26')]({'where':{'type':_0x1f66c0,'resourceId':_0x32cd16['id']}})['then'](function(){return _0x5b9f0b;});})[_0xaa5f('0x25')](function(){_0x1baa2e[_0xaa5f('0x19')](0xcc)[_0xaa5f('0x18')]();});}};}function handleEntityNotFound(_0x5a7cf1,_0x3b17b6){return function(_0x269209){if(!_0x269209){_0x5a7cf1[_0xaa5f('0x17')](0x194);}return _0x269209;};}function handleError(_0x4e50ca,_0x5a90e5){_0x5a90e5=_0x5a90e5||0x1f4;return function(_0x479f29){logger['error'](_0x479f29[_0xaa5f('0x2a')]);if(_0x479f29['name']){delete _0x479f29[_0xaa5f('0x2b')];}_0x4e50ca['status'](_0x5a90e5)['send'](_0x479f29);};}exports['index']=function(_0x26a90d,_0x4ddebd){var _0x310828={},_0xc0bb03={},_0x555876={'count':0x0,'rows':[]};var _0x58f608=_[_0xaa5f('0x2c')](db['VoiceMail'][_0xaa5f('0x2d')],function(_0x36c306){return{'name':_0x36c306['fieldName'],'type':_0x36c306[_0xaa5f('0x2e')][_0xaa5f('0x2f')]};});_0xc0bb03[_0xaa5f('0x30')]=_['map'](_0x58f608,_0xaa5f('0x2b'));_0xc0bb03[_0xaa5f('0x31')]=_['keys'](_0x26a90d['query']);_0xc0bb03['filters']=_['intersection'](_0xc0bb03[_0xaa5f('0x30')],_0xc0bb03[_0xaa5f('0x31')]);_0x310828[_0xaa5f('0x32')]=_[_0xaa5f('0x33')](_0xc0bb03[_0xaa5f('0x30')],qs[_0xaa5f('0x34')](_0x26a90d[_0xaa5f('0x31')]['fields']));_0x310828[_0xaa5f('0x32')]=_0x310828[_0xaa5f('0x32')][_0xaa5f('0x35')]?_0x310828[_0xaa5f('0x32')]:_0xc0bb03[_0xaa5f('0x30')];if(!_0x26a90d[_0xaa5f('0x31')]['hasOwnProperty'](_0xaa5f('0x36'))){_0x310828[_0xaa5f('0x1c')]=qs[_0xaa5f('0x1c')](_0x26a90d[_0xaa5f('0x31')][_0xaa5f('0x1c')]);_0x310828['offset']=qs['offset'](_0x26a90d[_0xaa5f('0x31')][_0xaa5f('0x1a')]);}_0x310828[_0xaa5f('0x37')]=qs[_0xaa5f('0x38')](_0x26a90d['query'][_0xaa5f('0x38')]);_0x310828[_0xaa5f('0x39')]=qs[_0xaa5f('0x3a')](_[_0xaa5f('0x3b')](_0x26a90d[_0xaa5f('0x31')],_0xc0bb03[_0xaa5f('0x3a')]),_0x58f608);if(_0x26a90d[_0xaa5f('0x31')][_0xaa5f('0x3c')]){_0x310828[_0xaa5f('0x39')]=_[_0xaa5f('0x3d')](_0x310828[_0xaa5f('0x39')],{'$or':_['map'](_0x58f608,function(_0x42fc51){if(_0x42fc51[_0xaa5f('0x2e')]!==_0xaa5f('0x3e')){var _0x2dd9bb={};_0x2dd9bb[_0x42fc51[_0xaa5f('0x2b')]]={'$like':'%'+_0x26a90d[_0xaa5f('0x31')][_0xaa5f('0x3c')]+'%'};return _0x2dd9bb;}})});}_0x310828=_[_0xaa5f('0x3d')]({},_0x310828,_0x26a90d[_0xaa5f('0x3f')]);var _0x2dad6f={'where':_0x310828['where']};return db[_0xaa5f('0x40')]['count'](_0x2dad6f)[_0xaa5f('0x25')](function(_0x21f4bc){_0x555876[_0xaa5f('0x1d')]=_0x21f4bc;if(_0x26a90d['query'][_0xaa5f('0x41')]){_0x310828[_0xaa5f('0x42')]=[{'all':!![]}];}return db[_0xaa5f('0x40')]['findAll'](_0x310828);})[_0xaa5f('0x25')](function(_0x179be8){_0x555876[_0xaa5f('0x43')]=_0x179be8;return _0x555876;})[_0xaa5f('0x25')](respondWithFilteredResult(_0x4ddebd,_0x310828))['catch'](handleError(_0x4ddebd,null));};exports[_0xaa5f('0x44')]=function(_0x2b2b4c,_0x3aeded){var _0x38edcc={'raw':!![],'where':{'id':_0x2b2b4c[_0xaa5f('0x45')]['id']}},_0x311729={};_0x311729[_0xaa5f('0x30')]=_[_0xaa5f('0x46')](db['VoiceMail'][_0xaa5f('0x2d')]);_0x311729['query']=_[_0xaa5f('0x46')](_0x2b2b4c['query']);_0x311729[_0xaa5f('0x3a')]=_[_0xaa5f('0x33')](_0x311729['model'],_0x311729[_0xaa5f('0x31')]);_0x38edcc[_0xaa5f('0x32')]=_[_0xaa5f('0x33')](_0x311729['model'],qs['fields'](_0x2b2b4c['query'][_0xaa5f('0x34')]));_0x38edcc['attributes']=_0x38edcc[_0xaa5f('0x32')][_0xaa5f('0x35')]?_0x38edcc[_0xaa5f('0x32')]:_0x311729[_0xaa5f('0x30')];if(_0x2b2b4c['query'][_0xaa5f('0x41')]){_0x38edcc[_0xaa5f('0x42')]=[{'all':!![]}];}_0x38edcc=_[_0xaa5f('0x3d')]({},_0x38edcc,_0x2b2b4c[_0xaa5f('0x3f')]);return db[_0xaa5f('0x40')][_0xaa5f('0x47')](_0x38edcc)[_0xaa5f('0x25')](handleEntityNotFound(_0x3aeded,null))[_0xaa5f('0x25')](respondWithResult(_0x3aeded,null))[_0xaa5f('0x48')](handleError(_0x3aeded,null));};exports[_0xaa5f('0x49')]=function(_0x3ea553,_0x2de737){return db[_0xaa5f('0x40')][_0xaa5f('0x49')](_0x3ea553[_0xaa5f('0x4a')],{})[_0xaa5f('0x25')](function(_0x554e6d){var _0x3412f8=_0x3ea553[_0xaa5f('0x4b')][_0xaa5f('0x27')]({'plain':!![]});if(!_0x3412f8)throw new Error(_0xaa5f('0x4c'));if(_0x3412f8[_0xaa5f('0x4d')]===_0xaa5f('0x4b')){var _0x32bbed=_0x554e6d['get']({'plain':!![]});var _0xf5a6b6=_0xaa5f('0x28');return db[_0xaa5f('0x4e')][_0xaa5f('0x47')]({'where':{'name':_0xf5a6b6,'userProfileId':_0x3412f8['userProfileId']},'raw':!![]})[_0xaa5f('0x25')](function(_0x186c64){if(_0x186c64&&_0x186c64[_0xaa5f('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x32bbed['name'],'resourceId':_0x32bbed['id'],'type':_0x186c64['name'],'sectionId':_0x186c64['id']},{})['then'](function(){return _0x554e6d;});}else{return _0x554e6d;}})['catch'](function(_0x1f47a0){logger[_0xaa5f('0x50')](_0xaa5f('0x51'),_0x1f47a0);throw _0x1f47a0;});}return _0x554e6d;})[_0xaa5f('0x25')](respondWithResult(_0x2de737,0xc9))[_0xaa5f('0x48')](handleError(_0x2de737,null));};exports[_0xaa5f('0x24')]=function(_0x48c473,_0x584a3d){if(_0x48c473[_0xaa5f('0x4a')]['id']){delete _0x48c473[_0xaa5f('0x4a')]['id'];}return db['VoiceMail'][_0xaa5f('0x47')]({'where':{'id':_0x48c473[_0xaa5f('0x45')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x584a3d,null))[_0xaa5f('0x25')](saveUpdates(_0x48c473[_0xaa5f('0x4a')],null))[_0xaa5f('0x25')](respondWithResult(_0x584a3d,null))[_0xaa5f('0x48')](handleError(_0x584a3d,null));};exports['destroy']=function(_0x47c00d,_0x1be4fa){return db[_0xaa5f('0x40')]['find']({'where':{'id':_0x47c00d['params']['id']}})['then'](handleEntityNotFound(_0x1be4fa,null))[_0xaa5f('0x25')](removeEntity(_0x1be4fa,null))['catch'](handleError(_0x1be4fa,null));};exports[_0xaa5f('0x52')]=function(_0x5afc3c,_0x4c5bf6,_0x29b323){return db[_0xaa5f('0x40')][_0xaa5f('0x53')]({'where':{'id':_0x5afc3c['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x4c5bf6,null))[_0xaa5f('0x25')](function(_0x24bcf2){var _0x4fe60d;var _0x21d494={},_0x2fd00c={};_0x2fd00c['model']=_[_0xaa5f('0x46')](db[_0xaa5f('0x54')][_0xaa5f('0x2d')]);_0x2fd00c[_0xaa5f('0x31')]=_[_0xaa5f('0x46')](_0x5afc3c[_0xaa5f('0x31')]);_0x2fd00c[_0xaa5f('0x3a')]=_[_0xaa5f('0x33')](_0x2fd00c[_0xaa5f('0x30')],_0x2fd00c['query']);_0x21d494[_0xaa5f('0x32')]=_[_0xaa5f('0x33')](_0x2fd00c[_0xaa5f('0x30')],qs[_0xaa5f('0x34')](_0x5afc3c[_0xaa5f('0x31')][_0xaa5f('0x34')]));_0x21d494[_0xaa5f('0x32')]=_0x21d494[_0xaa5f('0x32')]['length']?_0x21d494[_0xaa5f('0x32')]:_0x2fd00c['model'];if(!_0x5afc3c[_0xaa5f('0x31')][_0xaa5f('0x55')](_0xaa5f('0x36'))){_0x21d494[_0xaa5f('0x1c')]=qs['limit'](_0x5afc3c[_0xaa5f('0x31')][_0xaa5f('0x1c')]);_0x21d494[_0xaa5f('0x1a')]=qs['offset'](_0x5afc3c[_0xaa5f('0x31')]['offset']);}_0x21d494[_0xaa5f('0x37')]=qs['sort'](_0x5afc3c[_0xaa5f('0x31')][_0xaa5f('0x38')]);_0x21d494[_0xaa5f('0x39')]=qs[_0xaa5f('0x3a')](_['pick'](_0x5afc3c[_0xaa5f('0x31')],_0x2fd00c[_0xaa5f('0x3a')]));if(_0x5afc3c['query']['filter']){_0x21d494[_0xaa5f('0x39')]=_[_0xaa5f('0x3d')](_0x21d494['where'],{'$or':_[_0xaa5f('0x2c')](_0x21d494[_0xaa5f('0x32')],function(_0x3047bd){var _0x4bb874={};_0x4bb874[_0x3047bd]={'$like':'%'+_0x5afc3c[_0xaa5f('0x31')][_0xaa5f('0x3c')]+'%'};return _0x4bb874;})});}_0x21d494['where']=_[_0xaa5f('0x3d')](_0x21d494[_0xaa5f('0x39')],{'mailboxuser':_0x24bcf2[_0xaa5f('0x56')]});_0x21d494=_['merge']({},_0x21d494,_0x5afc3c[_0xaa5f('0x3f')]);return db[_0xaa5f('0x54')]['findAndCountAll'](_0x21d494)[_0xaa5f('0x25')](respondWithFilteredResult(_0x4c5bf6,_0x21d494));})[_0xaa5f('0x48')](handleError(_0x4c5bf6,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b7b5243..2feb6f6 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 _0x28ac=['bluebird','request-promise','path','rimraf','../../config/environment','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x28ac,0x95));var _0xc28a=function(_0x5ded24,_0x24fbe8){_0x5ded24=_0x5ded24-0x0;var _0x354ea0=_0x28ac[_0x5ded24];return _0x354ea0;};'use strict';var _=require(_0xc28a('0x0'));var util=require(_0xc28a('0x1'));var logger=require(_0xc28a('0x2'))(_0xc28a('0x3'));var moment=require(_0xc28a('0x4'));var BPromise=require(_0xc28a('0x5'));var rp=require(_0xc28a('0x6'));var fs=require('fs');var path=require(_0xc28a('0x7'));var rimraf=require(_0xc28a('0x8'));var config=require(_0xc28a('0x9'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x366882,_0x2a4de8){return _0x366882['define'](_0xc28a('0xa'),attributes,{'tableName':_0xc28a('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xc28a('0xc'),_0xc28a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf14b=['../../config/environment','./voiceMail.attributes','exports','VoiceMail','mailbox','lodash','api','moment','request-promise','path','rimraf'];(function(_0xac2821,_0x136c33){var _0x1f4d3f=function(_0x4543b1){while(--_0x4543b1){_0xac2821['push'](_0xac2821['shift']());}};_0x1f4d3f(++_0x136c33);}(_0xf14b,0x10d));var _0xbf14=function(_0x39914e,_0x1ec745){_0x39914e=_0x39914e-0x0;var _0x56350b=_0xf14b[_0x39914e];return _0x56350b;};'use strict';var _=require(_0xbf14('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbf14('0x1'));var moment=require(_0xbf14('0x2'));var BPromise=require('bluebird');var rp=require(_0xbf14('0x3'));var fs=require('fs');var path=require(_0xbf14('0x4'));var rimraf=require(_0xbf14('0x5'));var config=require(_0xbf14('0x6'));var attributes=require(_0xbf14('0x7'));module[_0xbf14('0x8')]=function(_0x226fd7,_0x4f62ee){return _0x226fd7['define'](_0xbf14('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xbf14('0xa'),'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 611b34c..cb0fb29 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 _0x933b=['../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x28f0fc,_0x281463){var _0x54c520=function(_0x2b23ef){while(--_0x2b23ef){_0x28f0fc['push'](_0x28f0fc['shift']());}};_0x54c520(++_0x281463);}(_0x933b,0x87));var _0xb933=function(_0xd210d1,_0x2f7e70){_0xd210d1=_0xd210d1-0x0;var _0x560930=_0x933b[_0xd210d1];return _0x560930;};'use strict';var _=require(_0xb933('0x0'));var util=require(_0xb933('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb933('0x2'));var db=require(_0xb933('0x3'))['db'];var utils=require(_0xb933('0x4'));var logger=require(_0xb933('0x5'))(_0xb933('0x6'));var config=require('../../config/environment');var jayson=require(_0xb933('0x7'));var client=jayson['client'][_0xb933('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56439b,_0x1bd96e,_0x2f9461){return new BPromise(function(_0x5a98c7,_0x41dc7c){return client[_0xb933('0x9')](_0x56439b,_0x2f9461)[_0xb933('0xa')](function(_0x4de584){logger[_0xb933('0xb')](_0xb933('0xc'),_0x1bd96e,'request\x20sent');logger[_0xb933('0xd')](_0xb933('0xe'),_0x1bd96e,_0xb933('0xf'),JSON[_0xb933('0x10')](_0x4de584));if(_0x4de584[_0xb933('0x11')]){if(_0x4de584[_0xb933('0x11')]['code']===0x1f4){logger[_0xb933('0x11')](_0xb933('0xc'),_0x1bd96e,_0x4de584['error'][_0xb933('0x12')]);return _0x41dc7c(_0x4de584[_0xb933('0x11')][_0xb933('0x12')]);}logger[_0xb933('0x11')](_0xb933('0xc'),_0x1bd96e,_0x4de584[_0xb933('0x11')][_0xb933('0x12')]);return _0x5a98c7(_0x4de584['error'][_0xb933('0x12')]);}else{logger['info'](_0xb933('0xc'),_0x1bd96e,_0xb933('0xf'));_0x5a98c7(_0x4de584[_0xb933('0x13')][_0xb933('0x12')]);}})['catch'](function(_0x19556a){logger[_0xb933('0x11')]('VoiceMail,\x20%s,\x20%s',_0x1bd96e,_0x19556a);_0x41dc7c(_0x19556a);});});} \ No newline at end of file +var _0x8a14=['error','code','message','result','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8a14,0xee));var _0x48a1=function(_0x496212,_0x3afd48){_0x496212=_0x496212-0x0;var _0x3bfa25=_0x8a14[_0x496212];return _0x3bfa25;};'use strict';var _=require(_0x48a1('0x0'));var util=require('util');var moment=require(_0x48a1('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(_0x48a1('0x2'));var logger=require(_0x48a1('0x3'))(_0x48a1('0x4'));var config=require(_0x48a1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x48a1('0x6')][_0x48a1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x495fb0,_0x39878c,_0x5b19ac){return new BPromise(function(_0xc99d6b,_0x25a8e8){return client[_0x48a1('0x8')](_0x495fb0,_0x5b19ac)['then'](function(_0x21deab){logger[_0x48a1('0x9')](_0x48a1('0xa'),_0x39878c,_0x48a1('0xb'));logger[_0x48a1('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x39878c,'request\x20sent',JSON[_0x48a1('0xd')](_0x21deab));if(_0x21deab['error']){if(_0x21deab[_0x48a1('0xe')][_0x48a1('0xf')]===0x1f4){logger[_0x48a1('0xe')](_0x48a1('0xa'),_0x39878c,_0x21deab[_0x48a1('0xe')][_0x48a1('0x10')]);return _0x25a8e8(_0x21deab[_0x48a1('0xe')][_0x48a1('0x10')]);}logger[_0x48a1('0xe')](_0x48a1('0xa'),_0x39878c,_0x21deab[_0x48a1('0xe')][_0x48a1('0x10')]);return _0xc99d6b(_0x21deab[_0x48a1('0xe')][_0x48a1('0x10')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x39878c,_0x48a1('0xb'));_0xc99d6b(_0x21deab[_0x48a1('0x11')][_0x48a1('0x10')]);}})['catch'](function(_0x324bcb){logger[_0x48a1('0xe')](_0x48a1('0xa'),_0x39878c,_0x324bcb);_0x25a8e8(_0x324bcb);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f111401..5529de6 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 _0xa165=['show','/:id/download','download','post','create','/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x6ca661,_0x479e93){var _0x290881=function(_0x167d29){while(--_0x167d29){_0x6ca661['push'](_0x6ca661['shift']());}};_0x290881(++_0x479e93);}(_0xa165,0x1a7));var _0x5a16=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa165[_0x29d94e];return _0x106237;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5a16('0x0'));var timeout=require(_0x5a16('0x1'));var express=require(_0x5a16('0x2'));var router=express[_0x5a16('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5a16('0x4'));var config=require(_0x5a16('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x5a16('0x6')]('/',auth[_0x5a16('0x7')](),controller[_0x5a16('0x8')]);router[_0x5a16('0x6')]('/:id',auth[_0x5a16('0x7')](),controller[_0x5a16('0x9')]);router[_0x5a16('0x6')](_0x5a16('0xa'),auth[_0x5a16('0x7')](),controller[_0x5a16('0xb')]);router[_0x5a16('0xc')]('/',auth[_0x5a16('0x7')](),controller[_0x5a16('0xd')]);router['put'](_0x5a16('0xe'),auth[_0x5a16('0x7')](),controller[_0x5a16('0xf')]);router[_0x5a16('0x10')](_0x5a16('0xe'),auth[_0x5a16('0x7')](),controller['destroy']);module[_0x5a16('0x11')]=router; \ No newline at end of file +var _0x972c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x24d7c5,_0x36c07f){var _0x53418e=function(_0x1cfa41){while(--_0x1cfa41){_0x24d7c5['push'](_0x24d7c5['shift']());}};_0x53418e(++_0x36c07f);}(_0x972c,0x1ea));var _0xc972=function(_0x3f2ac5,_0x28d423){_0x3f2ac5=_0x3f2ac5-0x0;var _0xb28f59=_0x972c[_0x3f2ac5];return _0xb28f59;};'use strict';var multer=require('multer');var util=require(_0xc972('0x0'));var path=require(_0xc972('0x1'));var timeout=require(_0xc972('0x2'));var express=require(_0xc972('0x3'));var router=express[_0xc972('0x4')]();var fs_extra=require(_0xc972('0x5'));var auth=require(_0xc972('0x6'));var interaction=require(_0xc972('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xc972('0x8')]('/',auth['isAuthenticated'](),controller[_0xc972('0x9')]);router[_0xc972('0x8')](_0xc972('0xa'),auth[_0xc972('0xb')](),controller[_0xc972('0xc')]);router[_0xc972('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xc972('0xd')]('/',auth[_0xc972('0xb')](),controller[_0xc972('0xe')]);router['put'](_0xc972('0xa'),auth[_0xc972('0xb')](),controller[_0xc972('0xf')]);router[_0xc972('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc972('0x11')]);module[_0xc972('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 27e1361..029334c 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 _0x698a=['INTEGER','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x43f084,_0xb48804){var _0x2a6dde=function(_0x1fab7f){while(--_0x1fab7f){_0x43f084['push'](_0x43f084['shift']());}};_0x2a6dde(++_0xb48804);}(_0x698a,0x10a));var _0xa698=function(_0x44073b,_0x53116c){_0x44073b=_0x44073b-0x0;var _0x3757d4=_0x698a[_0x44073b];return _0x3757d4;};'use strict';var Sequelize=require(_0xa698('0x0'));module[_0xa698('0x1')]={'name':{'type':Sequelize[_0xa698('0x2')],'get':function(_0x14be69){return this[_0xa698('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xa698('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa698('0x6')](_0xa698('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa698('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa698('0x8')](_0xa698('0x9'))}}; \ No newline at end of file +var _0x1b4e=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x12e73c,_0x2cbe1d){var _0x4c41cb=function(_0x10283b){while(--_0x10283b){_0x12e73c['push'](_0x12e73c['shift']());}};_0x4c41cb(++_0x2cbe1d);}(_0x1b4e,0x1d0));var _0xe1b4=function(_0x28000f,_0x21fcb8){_0x28000f=_0x28000f-0x0;var _0x107670=_0x1b4e[_0x28000f];return _0x107670;};'use strict';var Sequelize=require(_0xe1b4('0x0'));module[_0xe1b4('0x1')]={'name':{'type':Sequelize[_0xe1b4('0x2')],'get':function(_0x35df06){return this[_0xe1b4('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe1b4('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe1b4('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe1b4('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xe1b4('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe1b4('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xe1b4('0x6')](_0xe1b4('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xe1b4('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe1b4('0x5')],'defaultValue':''},'stamp':{'type':_0xe1b4('0x8'),'defaultValue':Sequelize[_0xe1b4('0x9')](_0xe1b4('0xa'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3dad676..88983df 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 _0x08eb=['undefined','count','Content-Range','json','apply','save','update','then','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','find','create','body','destroy','params','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit'];(function(_0x3670b2,_0x407b64){var _0x288161=function(_0x2d4f47){while(--_0x2d4f47){_0x3670b2['push'](_0x3670b2['shift']());}};_0x288161(++_0x407b64);}(_0x08eb,0x1e2));var _0xb08e=function(_0x44f2a2,_0xc21903){_0x44f2a2=_0x44f2a2-0x0;var _0x1a27cb=_0x08eb[_0x44f2a2];return _0x1a27cb;};'use strict';var emlformat=require(_0xb08e('0x0'));var rimraf=require(_0xb08e('0x1'));var zipdir=require(_0xb08e('0x2'));var jsonpatch=require(_0xb08e('0x3'));var rp=require(_0xb08e('0x4'));var moment=require(_0xb08e('0x5'));var BPromise=require(_0xb08e('0x6'));var Mustache=require(_0xb08e('0x7'));var util=require(_0xb08e('0x8'));var path=require(_0xb08e('0x9'));var sox=require(_0xb08e('0xa'));var csv=require(_0xb08e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb08e('0xc'));var jsforce=require(_0xb08e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb08e('0xb'));var querystring=require(_0xb08e('0xe'));var Papa=require(_0xb08e('0xf'));var Redis=require(_0xb08e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb08e('0x11'));var logger=require(_0xb08e('0x12'))(_0xb08e('0x13'));var utils=require(_0xb08e('0x14'));var config=require(_0xb08e('0x15'));var licenseUtil=require(_0xb08e('0x16'));var db=require(_0xb08e('0x17'))['db'];function respondWithStatusCode(_0xb09188,_0x209e60){_0x209e60=_0x209e60||0xcc;return function(_0x103eee){if(_0x103eee){return _0xb09188[_0xb08e('0x18')](_0x209e60);}return _0xb09188[_0xb08e('0x19')](_0x209e60)['end']();};}function respondWithResult(_0x65e1dd,_0x3fa9b8){_0x3fa9b8=_0x3fa9b8||0xc8;return function(_0x147aeb){if(_0x147aeb){return _0x65e1dd[_0xb08e('0x19')](_0x3fa9b8)['json'](_0x147aeb);}};}function respondWithFilteredResult(_0x8a98f6,_0x273d8e){return function(_0x12efbf){if(_0x12efbf){var _0x1ff7e6=typeof _0x273d8e[_0xb08e('0x1a')]==='undefined'&&typeof _0x273d8e[_0xb08e('0x1b')]===_0xb08e('0x1c');var _0x3f35af=_0x12efbf[_0xb08e('0x1d')];var _0x24f4d1=_0x1ff7e6?0x0:_0x273d8e['offset'];var _0x22d11a=_0x1ff7e6?_0x12efbf[_0xb08e('0x1d')]:_0x273d8e[_0xb08e('0x1a')]+_0x273d8e[_0xb08e('0x1b')];var _0xf9e3ca;if(_0x22d11a>=_0x3f35af){_0x22d11a=_0x3f35af;_0xf9e3ca=0xc8;}else{_0xf9e3ca=0xce;}_0x8a98f6[_0xb08e('0x19')](_0xf9e3ca);return _0x8a98f6['set'](_0xb08e('0x1e'),_0x24f4d1+'-'+_0x22d11a+'/'+_0x3f35af)[_0xb08e('0x1f')](_0x12efbf);}return null;};}function patchUpdates(_0x2d03e0){return function(_0xb7483f){try{jsonpatch[_0xb08e('0x20')](_0xb7483f,_0x2d03e0,!![]);}catch(_0x16092b){return BPromise['reject'](_0x16092b);}return _0xb7483f[_0xb08e('0x21')]();};}function saveUpdates(_0x46813c,_0x4e9828){return function(_0x30c6ec){if(_0x30c6ec){return _0x30c6ec[_0xb08e('0x22')](_0x46813c)[_0xb08e('0x23')](function(_0x1c4370){return _0x1c4370;});}return null;};}function removeEntity(_0x5c2f3b,_0xf2c2a8){return function(_0x3b5983){if(_0x3b5983){return _0x3b5983['destroy']()[_0xb08e('0x23')](function(){_0x5c2f3b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7df5,_0x5546b8){return function(_0x35946a){if(!_0x35946a){_0x2f7df5['sendStatus'](0x194);}return _0x35946a;};}function handleError(_0x3ab527,_0x88b17){_0x88b17=_0x88b17||0x1f4;return function(_0x239d3d){logger[_0xb08e('0x24')](_0x239d3d[_0xb08e('0x25')]);if(_0x239d3d[_0xb08e('0x26')]){delete _0x239d3d['name'];}_0x3ab527['status'](_0x88b17)['send'](_0x239d3d);};}exports['index']=function(_0x557603,_0x3f85cd){var _0x469a44={},_0x5b1d25={},_0x4d85fa={'count':0x0,'rows':[]};var _0x36ca31=_[_0xb08e('0x27')](db[_0xb08e('0x28')][_0xb08e('0x29')],function(_0x15a02b){return{'name':_0x15a02b[_0xb08e('0x2a')],'type':_0x15a02b[_0xb08e('0x2b')][_0xb08e('0x2c')]};});_0x5b1d25[_0xb08e('0x2d')]=_['differenceBy'](_[_0xb08e('0x27')](_0x36ca31,_0xb08e('0x26')),['name']);_0x5b1d25[_0xb08e('0x2e')]=_['keys'](_0x557603[_0xb08e('0x2e')]);_0x5b1d25['filters']=_[_0xb08e('0x2f')](_0x5b1d25[_0xb08e('0x2d')],_0x5b1d25[_0xb08e('0x2e')]);_0x469a44[_0xb08e('0x30')]=_[_0xb08e('0x2f')](_0x5b1d25[_0xb08e('0x2d')],qs[_0xb08e('0x31')](_0x557603[_0xb08e('0x2e')][_0xb08e('0x31')]));_0x469a44['attributes']=_0x469a44[_0xb08e('0x30')][_0xb08e('0x32')]?_0x469a44[_0xb08e('0x30')]:_0x5b1d25[_0xb08e('0x2d')];if(!_0x557603[_0xb08e('0x2e')]['hasOwnProperty'](_0xb08e('0x33'))){_0x469a44[_0xb08e('0x1b')]=qs[_0xb08e('0x1b')](_0x557603[_0xb08e('0x2e')][_0xb08e('0x1b')]);_0x469a44[_0xb08e('0x1a')]=qs[_0xb08e('0x1a')](_0x557603[_0xb08e('0x2e')]['offset']);}_0x469a44[_0xb08e('0x34')]=qs[_0xb08e('0x35')](_0x557603[_0xb08e('0x2e')][_0xb08e('0x35')]);_0x469a44[_0xb08e('0x36')]=qs[_0xb08e('0x37')](_[_0xb08e('0x38')](_0x557603['query'],_0x5b1d25['filters']),_0x36ca31);if(_0x557603[_0xb08e('0x2e')]['filter']){_0x469a44[_0xb08e('0x36')]=_[_0xb08e('0x39')](_0x469a44[_0xb08e('0x36')],{'$or':_[_0xb08e('0x27')](_0x36ca31,function(_0x4e9518){if(_0x4e9518[_0xb08e('0x2b')]!==_0xb08e('0x3a')){var _0x18b355={};_0x18b355[_0x4e9518[_0xb08e('0x26')]]={'$like':'%'+_0x557603[_0xb08e('0x2e')][_0xb08e('0x3b')]+'%'};return _0x18b355;}})});}_0x469a44=_['merge']({},_0x469a44,_0x557603[_0xb08e('0x3c')]);var _0x346e9b={'where':_0x469a44['where']};return db[_0xb08e('0x28')][_0xb08e('0x1d')](_0x346e9b)[_0xb08e('0x23')](function(_0x5dadd7){_0x4d85fa[_0xb08e('0x1d')]=_0x5dadd7;if(_0x557603[_0xb08e('0x2e')][_0xb08e('0x3d')]){_0x469a44[_0xb08e('0x3e')]=[{'all':!![]}];}return db[_0xb08e('0x28')][_0xb08e('0x3f')](_0x469a44);})['then'](function(_0x5b0cad){_0x4d85fa['rows']=_0x5b0cad;return _0x4d85fa;})[_0xb08e('0x23')](respondWithFilteredResult(_0x3f85cd,_0x469a44))[_0xb08e('0x40')](handleError(_0x3f85cd,null));};exports[_0xb08e('0x41')]=function(_0xe9ebfe,_0x5a0d55){var _0x238136={'raw':!![],'where':{'id':_0xe9ebfe['params']['id']}},_0x1c2869={};_0x1c2869[_0xb08e('0x2d')]=_[_0xb08e('0x42')](db['VoiceMailMessage'][_0xb08e('0x29')]);_0x1c2869[_0xb08e('0x2e')]=_['keys'](_0xe9ebfe[_0xb08e('0x2e')]);_0x1c2869[_0xb08e('0x37')]=_['intersection'](_0x1c2869[_0xb08e('0x2d')],_0x1c2869[_0xb08e('0x2e')]);_0x238136[_0xb08e('0x30')]=_[_0xb08e('0x2f')](_0x1c2869[_0xb08e('0x2d')],qs[_0xb08e('0x31')](_0xe9ebfe[_0xb08e('0x2e')][_0xb08e('0x31')]));_0x238136[_0xb08e('0x30')]=_0x238136[_0xb08e('0x30')][_0xb08e('0x32')]?_0x238136[_0xb08e('0x30')]:_0x1c2869['model'];if(_0xe9ebfe[_0xb08e('0x2e')][_0xb08e('0x3d')]){_0x238136['include']=[{'all':!![]}];}_0x238136=_[_0xb08e('0x39')]({},_0x238136,_0xe9ebfe[_0xb08e('0x3c')]);return db[_0xb08e('0x28')][_0xb08e('0x43')](_0x238136)[_0xb08e('0x23')](handleEntityNotFound(_0x5a0d55,null))[_0xb08e('0x23')](respondWithResult(_0x5a0d55,null))[_0xb08e('0x40')](handleError(_0x5a0d55,null));};exports['create']=function(_0x490ec3,_0x3acd2b){return db[_0xb08e('0x28')][_0xb08e('0x44')](_0x490ec3['body'],{})[_0xb08e('0x23')](respondWithResult(_0x3acd2b,0xc9))[_0xb08e('0x40')](handleError(_0x3acd2b,null));};exports[_0xb08e('0x22')]=function(_0x204b99,_0x533479){if(_0x204b99[_0xb08e('0x45')]['id']){delete _0x204b99[_0xb08e('0x45')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x204b99['params']['id']}})[_0xb08e('0x23')](handleEntityNotFound(_0x533479,null))[_0xb08e('0x23')](saveUpdates(_0x204b99[_0xb08e('0x45')],null))['then'](respondWithResult(_0x533479,null))[_0xb08e('0x40')](handleError(_0x533479,null));};exports[_0xb08e('0x46')]=function(_0x443825,_0x3ebdea){return db[_0xb08e('0x28')][_0xb08e('0x43')]({'where':{'id':_0x443825[_0xb08e('0x47')]['id']}})[_0xb08e('0x23')](handleEntityNotFound(_0x3ebdea,null))['then'](removeEntity(_0x3ebdea,null))[_0xb08e('0x40')](handleError(_0x3ebdea,null));};exports[_0xb08e('0x48')]=function(_0x2d989b,_0xae8ce5,_0x222d33){return db['VoiceMailMessage']['find']({'where':{'id':_0x2d989b[_0xb08e('0x47')]['id']},'attributes':['id','recording',_0xb08e('0x49')]})['then'](handleEntityNotFound(_0xae8ce5,null))[_0xb08e('0x23')](function(_0x1d071d){if(_0x1d071d){if(!_0x1d071d[_0xb08e('0x4a')]){throw new db[(_0xb08e('0x4b'))][(_0xb08e('0x4c'))](_0xb08e('0x4d'));}var _0x2da9dd={'Content-Type':_0xb08e('0x4e'),'Content-Disposition':_0xb08e('0x4f')};if(_0x1d071d[_0xb08e('0x49')]){_0x2da9dd[_0xb08e('0x50')]=_0xb08e('0x51')+_0x1d071d[_0xb08e('0x49')]+_0xb08e('0x52');}_0xae8ce5[_0xb08e('0x53')](_0x2da9dd);return _0xae8ce5[_0xb08e('0x54')](new Buffer(_0x1d071d[_0xb08e('0x4a')]));}})['catch'](handleError(_0xae8ce5,null));}; \ No newline at end of file +var _0xc360=['fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','rows','catch','keys','length','includeAll','find','create','body','params','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','filters','intersection','attributes'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0xc360,0xd6));var _0x0c36=function(_0x2aaf7c,_0x5a9eca){_0x2aaf7c=_0x2aaf7c-0x0;var _0x56378=_0xc360[_0x2aaf7c];return _0x56378;};'use strict';var emlformat=require(_0x0c36('0x0'));var rimraf=require(_0x0c36('0x1'));var zipdir=require(_0x0c36('0x2'));var jsonpatch=require(_0x0c36('0x3'));var rp=require(_0x0c36('0x4'));var moment=require(_0x0c36('0x5'));var BPromise=require(_0x0c36('0x6'));var Mustache=require('mustache');var util=require(_0x0c36('0x7'));var path=require(_0x0c36('0x8'));var sox=require(_0x0c36('0x9'));var csv=require(_0x0c36('0xa'));var ejs=require(_0x0c36('0xb'));var fs=require('fs');var fs_extra=require(_0x0c36('0xc'));var _=require(_0x0c36('0xd'));var squel=require(_0x0c36('0xe'));var crypto=require(_0x0c36('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0c36('0x10'));var toCsv=require(_0x0c36('0xa'));var querystring=require(_0x0c36('0x11'));var Papa=require(_0x0c36('0x12'));var Redis=require(_0x0c36('0x13'));var authService=require(_0x0c36('0x14'));var qs=require(_0x0c36('0x15'));var as=require(_0x0c36('0x16'));var hardwareService=require(_0x0c36('0x17'));var logger=require(_0x0c36('0x18'))(_0x0c36('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0c36('0x1a'));var db=require(_0x0c36('0x1b'))['db'];function respondWithStatusCode(_0x189172,_0x484864){_0x484864=_0x484864||0xcc;return function(_0x20a24c){if(_0x20a24c){return _0x189172[_0x0c36('0x1c')](_0x484864);}return _0x189172[_0x0c36('0x1d')](_0x484864)['end']();};}function respondWithResult(_0x11dac8,_0x25a7c0){_0x25a7c0=_0x25a7c0||0xc8;return function(_0x23d697){if(_0x23d697){return _0x11dac8[_0x0c36('0x1d')](_0x25a7c0)['json'](_0x23d697);}};}function respondWithFilteredResult(_0x5b19f8,_0x368591){return function(_0x3dcda4){if(_0x3dcda4){var _0x5eb2ad=typeof _0x368591[_0x0c36('0x1e')]===_0x0c36('0x1f')&&typeof _0x368591[_0x0c36('0x20')]===_0x0c36('0x1f');var _0x4ea199=_0x3dcda4[_0x0c36('0x21')];var _0x222785=_0x5eb2ad?0x0:_0x368591[_0x0c36('0x1e')];var _0x15b776=_0x5eb2ad?_0x3dcda4[_0x0c36('0x21')]:_0x368591[_0x0c36('0x1e')]+_0x368591[_0x0c36('0x20')];var _0x1a24fb;if(_0x15b776>=_0x4ea199){_0x15b776=_0x4ea199;_0x1a24fb=0xc8;}else{_0x1a24fb=0xce;}_0x5b19f8[_0x0c36('0x1d')](_0x1a24fb);return _0x5b19f8[_0x0c36('0x22')](_0x0c36('0x23'),_0x222785+'-'+_0x15b776+'/'+_0x4ea199)['json'](_0x3dcda4);}return null;};}function patchUpdates(_0x3319f2){return function(_0x1d96ff){try{jsonpatch[_0x0c36('0x24')](_0x1d96ff,_0x3319f2,!![]);}catch(_0x448d64){return BPromise[_0x0c36('0x25')](_0x448d64);}return _0x1d96ff[_0x0c36('0x26')]();};}function saveUpdates(_0x5d3794,_0x31a65f){return function(_0x1954b1){if(_0x1954b1){return _0x1954b1[_0x0c36('0x27')](_0x5d3794)[_0x0c36('0x28')](function(_0x58104c){return _0x58104c;});}return null;};}function removeEntity(_0x4a168e,_0x26d95b){return function(_0x2b3fe6){if(_0x2b3fe6){return _0x2b3fe6['destroy']()['then'](function(){_0x4a168e[_0x0c36('0x1d')](0xcc)[_0x0c36('0x29')]();});}};}function handleEntityNotFound(_0xe3143d,_0x586218){return function(_0xaf1d9f){if(!_0xaf1d9f){_0xe3143d[_0x0c36('0x1c')](0x194);}return _0xaf1d9f;};}function handleError(_0xe44edb,_0x384dfd){_0x384dfd=_0x384dfd||0x1f4;return function(_0x234d22){logger['error'](_0x234d22[_0x0c36('0x2a')]);if(_0x234d22[_0x0c36('0x2b')]){delete _0x234d22[_0x0c36('0x2b')];}_0xe44edb[_0x0c36('0x1d')](_0x384dfd)[_0x0c36('0x2c')](_0x234d22);};}exports[_0x0c36('0x2d')]=function(_0x410375,_0x4e4272){var _0x39c070={},_0x10b497={},_0x49056c={'count':0x0,'rows':[]};var _0x38406f=_[_0x0c36('0x2e')](db[_0x0c36('0x2f')][_0x0c36('0x30')],function(_0x53fc4a){return{'name':_0x53fc4a['fieldName'],'type':_0x53fc4a['type'][_0x0c36('0x31')]};});_0x10b497[_0x0c36('0x32')]=_[_0x0c36('0x33')](_['map'](_0x38406f,_0x0c36('0x2b')),[_0x0c36('0x2b')]);_0x10b497[_0x0c36('0x34')]=_['keys'](_0x410375['query']);_0x10b497[_0x0c36('0x35')]=_[_0x0c36('0x36')](_0x10b497[_0x0c36('0x32')],_0x10b497[_0x0c36('0x34')]);_0x39c070[_0x0c36('0x37')]=_['intersection'](_0x10b497[_0x0c36('0x32')],qs[_0x0c36('0x38')](_0x410375[_0x0c36('0x34')][_0x0c36('0x38')]));_0x39c070[_0x0c36('0x37')]=_0x39c070['attributes']['length']?_0x39c070['attributes']:_0x10b497[_0x0c36('0x32')];if(!_0x410375[_0x0c36('0x34')][_0x0c36('0x39')](_0x0c36('0x3a'))){_0x39c070[_0x0c36('0x20')]=qs[_0x0c36('0x20')](_0x410375['query']['limit']);_0x39c070[_0x0c36('0x1e')]=qs['offset'](_0x410375[_0x0c36('0x34')][_0x0c36('0x1e')]);}_0x39c070[_0x0c36('0x3b')]=qs[_0x0c36('0x3c')](_0x410375[_0x0c36('0x34')][_0x0c36('0x3c')]);_0x39c070[_0x0c36('0x3d')]=qs[_0x0c36('0x35')](_[_0x0c36('0x3e')](_0x410375[_0x0c36('0x34')],_0x10b497[_0x0c36('0x35')]),_0x38406f);if(_0x410375['query']['filter']){_0x39c070['where']=_[_0x0c36('0x3f')](_0x39c070[_0x0c36('0x3d')],{'$or':_[_0x0c36('0x2e')](_0x38406f,function(_0x57d801){if(_0x57d801[_0x0c36('0x40')]!==_0x0c36('0x41')){var _0x1fa536={};_0x1fa536[_0x57d801[_0x0c36('0x2b')]]={'$like':'%'+_0x410375[_0x0c36('0x34')][_0x0c36('0x42')]+'%'};return _0x1fa536;}})});}_0x39c070=_[_0x0c36('0x3f')]({},_0x39c070,_0x410375[_0x0c36('0x43')]);var _0x52900c={'where':_0x39c070[_0x0c36('0x3d')]};return db['VoiceMailMessage'][_0x0c36('0x21')](_0x52900c)[_0x0c36('0x28')](function(_0x47e803){_0x49056c[_0x0c36('0x21')]=_0x47e803;if(_0x410375[_0x0c36('0x34')]['includeAll']){_0x39c070[_0x0c36('0x44')]=[{'all':!![]}];}return db[_0x0c36('0x2f')]['findAll'](_0x39c070);})['then'](function(_0x2841e5){_0x49056c[_0x0c36('0x45')]=_0x2841e5;return _0x49056c;})['then'](respondWithFilteredResult(_0x4e4272,_0x39c070))[_0x0c36('0x46')](handleError(_0x4e4272,null));};exports['show']=function(_0x1c512b,_0x4add29){var _0x3bfbb9={'raw':!![],'where':{'id':_0x1c512b['params']['id']}},_0x4183b8={};_0x4183b8[_0x0c36('0x32')]=_[_0x0c36('0x47')](db[_0x0c36('0x2f')][_0x0c36('0x30')]);_0x4183b8['query']=_[_0x0c36('0x47')](_0x1c512b['query']);_0x4183b8[_0x0c36('0x35')]=_[_0x0c36('0x36')](_0x4183b8[_0x0c36('0x32')],_0x4183b8['query']);_0x3bfbb9[_0x0c36('0x37')]=_[_0x0c36('0x36')](_0x4183b8[_0x0c36('0x32')],qs[_0x0c36('0x38')](_0x1c512b[_0x0c36('0x34')]['fields']));_0x3bfbb9[_0x0c36('0x37')]=_0x3bfbb9['attributes'][_0x0c36('0x48')]?_0x3bfbb9['attributes']:_0x4183b8[_0x0c36('0x32')];if(_0x1c512b[_0x0c36('0x34')][_0x0c36('0x49')]){_0x3bfbb9[_0x0c36('0x44')]=[{'all':!![]}];}_0x3bfbb9=_[_0x0c36('0x3f')]({},_0x3bfbb9,_0x1c512b[_0x0c36('0x43')]);return db[_0x0c36('0x2f')][_0x0c36('0x4a')](_0x3bfbb9)[_0x0c36('0x28')](handleEntityNotFound(_0x4add29,null))['then'](respondWithResult(_0x4add29,null))[_0x0c36('0x46')](handleError(_0x4add29,null));};exports[_0x0c36('0x4b')]=function(_0x103317,_0x3636b7){return db[_0x0c36('0x2f')][_0x0c36('0x4b')](_0x103317[_0x0c36('0x4c')],{})[_0x0c36('0x28')](respondWithResult(_0x3636b7,0xc9))[_0x0c36('0x46')](handleError(_0x3636b7,null));};exports[_0x0c36('0x27')]=function(_0x346f8d,_0xadc2b3){if(_0x346f8d[_0x0c36('0x4c')]['id']){delete _0x346f8d[_0x0c36('0x4c')]['id'];}return db[_0x0c36('0x2f')][_0x0c36('0x4a')]({'where':{'id':_0x346f8d[_0x0c36('0x4d')]['id']}})[_0x0c36('0x28')](handleEntityNotFound(_0xadc2b3,null))[_0x0c36('0x28')](saveUpdates(_0x346f8d[_0x0c36('0x4c')],null))[_0x0c36('0x28')](respondWithResult(_0xadc2b3,null))[_0x0c36('0x46')](handleError(_0xadc2b3,null));};exports[_0x0c36('0x4e')]=function(_0x253d0a,_0x380362){return db[_0x0c36('0x2f')][_0x0c36('0x4a')]({'where':{'id':_0x253d0a[_0x0c36('0x4d')]['id']}})['then'](handleEntityNotFound(_0x380362,null))[_0x0c36('0x28')](removeEntity(_0x380362,null))[_0x0c36('0x46')](handleError(_0x380362,null));};exports[_0x0c36('0x4f')]=function(_0xc8832,_0x573721,_0x24c2ed){return db[_0x0c36('0x2f')][_0x0c36('0x4a')]({'where':{'id':_0xc8832[_0x0c36('0x4d')]['id']},'attributes':['id',_0x0c36('0x50'),_0x0c36('0x51')]})[_0x0c36('0x28')](handleEntityNotFound(_0x573721,null))[_0x0c36('0x28')](function(_0x8eba54){if(_0x8eba54){if(!_0x8eba54[_0x0c36('0x50')]){throw new db[(_0x0c36('0x52'))][(_0x0c36('0x53'))](_0x0c36('0x54'));}var _0x1b0cd5={'Content-Type':_0x0c36('0x55'),'Content-Disposition':_0x0c36('0x56')};if(_0x8eba54[_0x0c36('0x51')]){_0x1b0cd5[_0x0c36('0x57')]=_0x0c36('0x58')+_0x8eba54['msg_id']+_0x0c36('0x59');}_0x573721['set'](_0x1b0cd5);return _0x573721[_0x0c36('0x2c')](new Buffer(_0x8eba54[_0x0c36('0x50')]));}})[_0x0c36('0x46')](handleError(_0x573721,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 009e7e8..1c56fc9 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 _0xcdec=['../../config/logger','api','moment','bluebird','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xcdec,0x15d));var _0xccde=function(_0x3096b7,_0x3cd00b){_0x3096b7=_0x3096b7-0x0;var _0x5ea2cc=_0xcdec[_0x3096b7];return _0x5ea2cc;};'use strict';var _=require(_0xccde('0x0'));var util=require(_0xccde('0x1'));var logger=require(_0xccde('0x2'))(_0xccde('0x3'));var moment=require(_0xccde('0x4'));var BPromise=require(_0xccde('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccde('0x6'));var rimraf=require(_0xccde('0x7'));var config=require('../../config/environment');var attributes=require(_0xccde('0x8'));module[_0xccde('0x9')]=function(_0x3913de,_0x51a101){return _0x3913de[_0xccde('0xa')](_0xccde('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xccde('0xc'),'fields':[_0xccde('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd7a7=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0xf23456,_0x71f861){var _0x28649a=function(_0x51dc56){while(--_0x51dc56){_0xf23456['push'](_0xf23456['shift']());}};_0x28649a(++_0x71f861);}(_0xd7a7,0xd4));var _0x7d7a=function(_0x142572,_0x249fc7){_0x142572=_0x142572-0x0;var _0x2f0577=_0xd7a7[_0x142572];return _0x2f0577;};'use strict';var _=require(_0x7d7a('0x0'));var util=require('util');var logger=require(_0x7d7a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d7a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d7a('0x3'));var rimraf=require(_0x7d7a('0x4'));var config=require(_0x7d7a('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0x7d7a('0x6')]=function(_0xbb19cc,_0x2f7f0a){return _0xbb19cc[_0x7d7a('0x7')](_0x7d7a('0x8'),attributes,{'tableName':_0x7d7a('0x9'),'paranoid':![],'indexes':[{'name':_0x7d7a('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0c44bd5..2f73f2d 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 _0x79db=['error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15f4bc,_0x5900a2){var _0x4fa96d=function(_0x3adece){while(--_0x3adece){_0x15f4bc['push'](_0x15f4bc['shift']());}};_0x4fa96d(++_0x5900a2);}(_0x79db,0x1a7));var _0xb79d=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x79db[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0xb79d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb79d('0x1'));var rs=require(_0xb79d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb79d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb79d('0x4'));var config=require(_0xb79d('0x5'));var jayson=require(_0xb79d('0x6'));var client=jayson[_0xb79d('0x7')][_0xb79d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12599c,_0x5b2dd5,_0x4baa62){return new BPromise(function(_0x333f6f,_0x5e8a1a){return client[_0xb79d('0x9')](_0x12599c,_0x4baa62)[_0xb79d('0xa')](function(_0x41f8c2){logger[_0xb79d('0xb')](_0xb79d('0xc'),_0x5b2dd5,_0xb79d('0xd'));logger[_0xb79d('0xe')](_0xb79d('0xf'),_0x5b2dd5,'request\x20sent',JSON[_0xb79d('0x10')](_0x41f8c2));if(_0x41f8c2[_0xb79d('0x11')]){if(_0x41f8c2[_0xb79d('0x11')][_0xb79d('0x12')]===0x1f4){logger[_0xb79d('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x5b2dd5,_0x41f8c2[_0xb79d('0x11')][_0xb79d('0x13')]);return _0x5e8a1a(_0x41f8c2[_0xb79d('0x11')][_0xb79d('0x13')]);}logger['error'](_0xb79d('0xc'),_0x5b2dd5,_0x41f8c2[_0xb79d('0x11')]['message']);return _0x333f6f(_0x41f8c2[_0xb79d('0x11')][_0xb79d('0x13')]);}else{logger[_0xb79d('0xb')](_0xb79d('0xc'),_0x5b2dd5,_0xb79d('0xd'));_0x333f6f(_0x41f8c2[_0xb79d('0x14')][_0xb79d('0x13')]);}})[_0xb79d('0x15')](function(_0xba6a5e){logger[_0xb79d('0x11')](_0xb79d('0xc'),_0x5b2dd5,_0xba6a5e);_0x5e8a1a(_0xba6a5e);});});} \ No newline at end of file +var _0xf545=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash','moment'];(function(_0x3a89dc,_0x54bb1e){var _0x11c5c9=function(_0x21bd68){while(--_0x21bd68){_0x3a89dc['push'](_0x3a89dc['shift']());}};_0x11c5c9(++_0x54bb1e);}(_0xf545,0x17a));var _0x5f54=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0xf545[_0x16eb19];return _0x312a25;};'use strict';var _=require(_0x5f54('0x0'));var util=require('util');var moment=require(_0x5f54('0x1'));var BPromise=require(_0x5f54('0x2'));var rs=require(_0x5f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f54('0x4'))['db'];var utils=require(_0x5f54('0x5'));var logger=require('../../config/logger')(_0x5f54('0x6'));var config=require('../../config/environment');var jayson=require(_0x5f54('0x7'));var client=jayson['client'][_0x5f54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16cc51,_0x518e2d,_0x1d1ac0){return new BPromise(function(_0x13a7c3,_0x169a01){return client[_0x5f54('0x9')](_0x16cc51,_0x1d1ac0)[_0x5f54('0xa')](function(_0x22a2e3){logger[_0x5f54('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x518e2d,_0x5f54('0xc'));logger[_0x5f54('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x518e2d,_0x5f54('0xc'),JSON[_0x5f54('0xe')](_0x22a2e3));if(_0x22a2e3[_0x5f54('0xf')]){if(_0x22a2e3['error']['code']===0x1f4){logger[_0x5f54('0xf')](_0x5f54('0x10'),_0x518e2d,_0x22a2e3[_0x5f54('0xf')][_0x5f54('0x11')]);return _0x169a01(_0x22a2e3[_0x5f54('0xf')][_0x5f54('0x11')]);}logger[_0x5f54('0xf')](_0x5f54('0x10'),_0x518e2d,_0x22a2e3[_0x5f54('0xf')][_0x5f54('0x11')]);return _0x13a7c3(_0x22a2e3[_0x5f54('0xf')][_0x5f54('0x11')]);}else{logger[_0x5f54('0xb')](_0x5f54('0x10'),_0x518e2d,'request\x20sent');_0x13a7c3(_0x22a2e3['result'][_0x5f54('0x11')]);}})[_0x5f54('0x12')](function(_0x5d95ca){logger[_0x5f54('0xf')](_0x5f54('0x10'),_0x518e2d,_0x5d95ca);_0x169a01(_0x5d95ca);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 60bdbdc..8ea9a19 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 _0xde0d=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','/:id/sounds','post','create','addSound','put','update','delete','removeSound','exports'];(function(_0x134a4a,_0x24241e){var _0x364072=function(_0x3926f5){while(--_0x3926f5){_0x134a4a['push'](_0x134a4a['shift']());}};_0x364072(++_0x24241e);}(_0xde0d,0xfc));var _0xdde0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xde0d[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xdde0('0x0'));var util=require('util');var path=require(_0xdde0('0x1'));var timeout=require(_0xdde0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdde0('0x3'));var auth=require(_0xdde0('0x4'));var interaction=require(_0xdde0('0x5'));var config=require(_0xdde0('0x6'));var controller=require(_0xdde0('0x7'));router[_0xdde0('0x8')]('/',auth['isAuthenticated'](),controller[_0xdde0('0x9')]);router['get'](_0xdde0('0xa'),auth[_0xdde0('0xb')](),controller['show']);router[_0xdde0('0x8')](_0xdde0('0xc'),auth[_0xdde0('0xb')](),controller['getSounds']);router[_0xdde0('0xd')]('/',auth[_0xdde0('0xb')](),controller[_0xdde0('0xe')]);router['post'](_0xdde0('0xc'),auth[_0xdde0('0xb')](),controller[_0xdde0('0xf')]);router[_0xdde0('0x10')](_0xdde0('0xa'),auth[_0xdde0('0xb')](),controller[_0xdde0('0x11')]);router['delete'](_0xdde0('0xa'),auth[_0xdde0('0xb')](),controller['destroy']);router[_0xdde0('0x12')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xdde0('0x13')]);module[_0xdde0('0x14')]=router; \ No newline at end of file +var _0x09dd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x09dd,0x15a));var _0xd09d=function(_0x2867a6,_0x10d905){_0x2867a6=_0x2867a6-0x0;var _0x4afc2b=_0x09dd[_0x2867a6];return _0x4afc2b;};'use strict';var multer=require(_0xd09d('0x0'));var util=require('util');var path=require(_0xd09d('0x1'));var timeout=require(_0xd09d('0x2'));var express=require(_0xd09d('0x3'));var router=express[_0xd09d('0x4')]();var fs_extra=require(_0xd09d('0x5'));var auth=require(_0xd09d('0x6'));var interaction=require(_0xd09d('0x7'));var config=require(_0xd09d('0x8'));var controller=require(_0xd09d('0x9'));router[_0xd09d('0xa')]('/',auth[_0xd09d('0xb')](),controller[_0xd09d('0xc')]);router[_0xd09d('0xa')](_0xd09d('0xd'),auth[_0xd09d('0xb')](),controller[_0xd09d('0xe')]);router[_0xd09d('0xa')](_0xd09d('0xf'),auth[_0xd09d('0xb')](),controller[_0xd09d('0x10')]);router[_0xd09d('0x11')]('/',auth['isAuthenticated'](),controller[_0xd09d('0x12')]);router['post'](_0xd09d('0xf'),auth[_0xd09d('0xb')](),controller[_0xd09d('0x13')]);router[_0xd09d('0x14')](_0xd09d('0xd'),auth[_0xd09d('0xb')](),controller[_0xd09d('0x15')]);router[_0xd09d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xd09d('0x17')]);router[_0xd09d('0x16')](_0xd09d('0x18'),auth['isAuthenticated'](),controller[_0xd09d('0x19')]);module[_0xd09d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4ebc9f6..687e90c 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 _0x6529=['mp3','alpha','BOOLEAN','sequelize','exports','STRING','ENUM','files','quietmp3'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6529,0x123));var _0x9652=function(_0x1d1f59,_0x53ebd8){_0x1d1f59=_0x1d1f59-0x0;var _0x2c3434=_0x6529[_0x1d1f59];return _0x2c3434;};'use strict';var Sequelize=require(_0x9652('0x0'));module[_0x9652('0x1')]={'name':{'type':Sequelize[_0x9652('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9652('0x3')]('custom',_0x9652('0x4'),'mp3nb','quietmp3nb',_0x9652('0x5'),_0x9652('0x6')),'allowNull':!![],'defaultValue':_0x9652('0x4')},'directory':{'type':Sequelize[_0x9652('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x9652('0x2')],'allowNull':!![],'defaultValue':_0x9652('0x7')},'format':{'type':Sequelize[_0x9652('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x9652('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x21e5=['quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','files','mp3nb','quietmp3nb'];(function(_0x186aec,_0x19abac){var _0x492357=function(_0x1ed92d){while(--_0x1ed92d){_0x186aec['push'](_0x186aec['shift']());}};_0x492357(++_0x19abac);}(_0x21e5,0x64));var _0x521e=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x21e5[_0x5b5eb4];return _0x42af53;};'use strict';var Sequelize=require(_0x521e('0x0'));module[_0x521e('0x1')]={'name':{'type':Sequelize[_0x521e('0x2')],'allowNull':![],'unique':_0x521e('0x3')},'mode':{'type':Sequelize[_0x521e('0x4')]('custom',_0x521e('0x5'),_0x521e('0x6'),_0x521e('0x7'),_0x521e('0x8'),_0x521e('0x9')),'allowNull':!![],'defaultValue':_0x521e('0x5')},'directory':{'type':Sequelize[_0x521e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x521e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x521e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x521e('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x521e('0x2')],'allowNull':!![]},'stamp':{'type':_0x521e('0xa')},'defaultEntry':{'type':Sequelize[_0x521e('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 7a4bcf3..3e901cb 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 _0x5fd1=['length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','rows','params','catch','body','find','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','sequelize','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','save_name','removeSound','id2','createdAt','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields'];(function(_0x5a0ebf,_0xa5bdcb){var _0x11cabf=function(_0x452efb){while(--_0x452efb){_0x5a0ebf['push'](_0x5a0ebf['shift']());}};_0x11cabf(++_0xa5bdcb);}(_0x5fd1,0x195));var _0x15fd=function(_0x5c3b67,_0x40c729){_0x5c3b67=_0x5c3b67-0x0;var _0x310f71=_0x5fd1[_0x5c3b67];return _0x310f71;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require(_0x15fd('0x1'));var zipdir=require(_0x15fd('0x2'));var jsonpatch=require(_0x15fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x15fd('0x4'));var Mustache=require('mustache');var util=require(_0x15fd('0x5'));var path=require(_0x15fd('0x6'));var sox=require(_0x15fd('0x7'));var csv=require(_0x15fd('0x8'));var ejs=require(_0x15fd('0x9'));var fs=require('fs');var fs_extra=require(_0x15fd('0xa'));var _=require('lodash');var squel=require(_0x15fd('0xb'));var crypto=require(_0x15fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x8'));var querystring=require(_0x15fd('0xe'));var Papa=require(_0x15fd('0xf'));var Redis=require(_0x15fd('0x10'));var authService=require(_0x15fd('0x11'));var qs=require(_0x15fd('0x12'));var as=require(_0x15fd('0x13'));var hardwareService=require(_0x15fd('0x14'));var logger=require(_0x15fd('0x15'))(_0x15fd('0x16'));var utils=require(_0x15fd('0x17'));var config=require(_0x15fd('0x18'));var licenseUtil=require(_0x15fd('0x19'));var db=require(_0x15fd('0x1a'))['db'];function respondWithStatusCode(_0x499bf6,_0x428dd5){_0x428dd5=_0x428dd5||0xcc;return function(_0x4fbb93){if(_0x4fbb93){return _0x499bf6['sendStatus'](_0x428dd5);}return _0x499bf6[_0x15fd('0x1b')](_0x428dd5)[_0x15fd('0x1c')]();};}function respondWithResult(_0x21556a,_0x3fa096){_0x3fa096=_0x3fa096||0xc8;return function(_0x40a7e4){if(_0x40a7e4){return _0x21556a[_0x15fd('0x1b')](_0x3fa096)[_0x15fd('0x1d')](_0x40a7e4);}};}function respondWithFilteredResult(_0x47123f,_0x230d76){return function(_0x451aa5){if(_0x451aa5){var _0x35d9cb=typeof _0x230d76[_0x15fd('0x1e')]===_0x15fd('0x1f')&&typeof _0x230d76['limit']===_0x15fd('0x1f');var _0x585309=_0x451aa5[_0x15fd('0x20')];var _0x1fc299=_0x35d9cb?0x0:_0x230d76['offset'];var _0x43160d=_0x35d9cb?_0x451aa5[_0x15fd('0x20')]:_0x230d76[_0x15fd('0x1e')]+_0x230d76['limit'];var _0x8927d1;if(_0x43160d>=_0x585309){_0x43160d=_0x585309;_0x8927d1=0xc8;}else{_0x8927d1=0xce;}_0x47123f[_0x15fd('0x1b')](_0x8927d1);return _0x47123f[_0x15fd('0x21')](_0x15fd('0x22'),_0x1fc299+'-'+_0x43160d+'/'+_0x585309)['json'](_0x451aa5);}return null;};}function patchUpdates(_0x3f7504){return function(_0x1c4c14){try{jsonpatch[_0x15fd('0x23')](_0x1c4c14,_0x3f7504,!![]);}catch(_0x3ae9b4){return BPromise[_0x15fd('0x24')](_0x3ae9b4);}return _0x1c4c14[_0x15fd('0x25')]();};}function saveUpdates(_0x1da8eb,_0x5d0bc7){return function(_0x5eee12){if(_0x5eee12){return _0x5eee12[_0x15fd('0x26')](_0x1da8eb)['then'](function(_0xcc012a){return _0xcc012a;});}return null;};}function removeEntity(_0x138ac3,_0x2f8859){return function(_0x35c967){if(_0x35c967){return _0x35c967[_0x15fd('0x27')]()[_0x15fd('0x28')](function(){var _0x5b0b63=_0x35c967['get']({'plain':!![]});var _0x5c9480=_0x15fd('0x29');return db[_0x15fd('0x2a')][_0x15fd('0x27')]({'where':{'type':_0x5c9480,'resourceId':_0x5b0b63['id']}})[_0x15fd('0x28')](function(){return _0x35c967;});})[_0x15fd('0x28')](function(){_0x138ac3[_0x15fd('0x1b')](0xcc)[_0x15fd('0x1c')]();});}};}function handleEntityNotFound(_0x5a1e59,_0x20fb18){return function(_0xdba1b7){if(!_0xdba1b7){_0x5a1e59['sendStatus'](0x194);}return _0xdba1b7;};}function handleError(_0x41de17,_0x15f8e3){_0x15f8e3=_0x15f8e3||0x1f4;return function(_0x583b24){logger[_0x15fd('0x2b')](_0x583b24[_0x15fd('0x2c')]);if(_0x583b24['name']){delete _0x583b24[_0x15fd('0x2d')];}_0x41de17['status'](_0x15f8e3)[_0x15fd('0x2e')](_0x583b24);};}exports[_0x15fd('0x2f')]=function(_0x414310,_0x10f423){var _0x5e6e0b={},_0x39b8a6={},_0x58e05e={'count':0x0,'rows':[]};var _0x51ae46=_['map'](db['VoiceMusicOnHold'][_0x15fd('0x30')],function(_0x5b4366){return{'name':_0x5b4366[_0x15fd('0x31')],'type':_0x5b4366['type'][_0x15fd('0x32')]};});_0x39b8a6['model']=_[_0x15fd('0x33')](_0x51ae46,_0x15fd('0x2d'));_0x39b8a6[_0x15fd('0x34')]=_[_0x15fd('0x35')](_0x414310[_0x15fd('0x34')]);_0x39b8a6[_0x15fd('0x36')]=_[_0x15fd('0x37')](_0x39b8a6[_0x15fd('0x38')],_0x39b8a6[_0x15fd('0x34')]);_0x5e6e0b[_0x15fd('0x39')]=_[_0x15fd('0x37')](_0x39b8a6['model'],qs[_0x15fd('0x3a')](_0x414310[_0x15fd('0x34')]['fields']));_0x5e6e0b['attributes']=_0x5e6e0b[_0x15fd('0x39')][_0x15fd('0x3b')]?_0x5e6e0b[_0x15fd('0x39')]:_0x39b8a6[_0x15fd('0x38')];if(!_0x414310['query'][_0x15fd('0x3c')](_0x15fd('0x3d'))){_0x5e6e0b[_0x15fd('0x3e')]=qs[_0x15fd('0x3e')](_0x414310[_0x15fd('0x34')][_0x15fd('0x3e')]);_0x5e6e0b[_0x15fd('0x1e')]=qs[_0x15fd('0x1e')](_0x414310[_0x15fd('0x34')][_0x15fd('0x1e')]);}_0x5e6e0b['order']=qs[_0x15fd('0x3f')](_0x414310[_0x15fd('0x34')][_0x15fd('0x3f')]);delete _0x414310[_0x15fd('0x34')][_0x15fd('0x3f')];_0x5e6e0b[_0x15fd('0x40')]=qs[_0x15fd('0x36')](_[_0x15fd('0x41')](_0x414310[_0x15fd('0x34')],_0x39b8a6[_0x15fd('0x36')]),_0x51ae46);if(_0x414310[_0x15fd('0x34')][_0x15fd('0x42')]){_0x5e6e0b[_0x15fd('0x40')]=_[_0x15fd('0x43')](_0x5e6e0b[_0x15fd('0x40')],{'$or':_[_0x15fd('0x33')](_0x51ae46,function(_0x2c634d){if(_0x2c634d[_0x15fd('0x44')]!==_0x15fd('0x45')){var _0x44c60c={};_0x44c60c[_0x2c634d[_0x15fd('0x2d')]]={'$like':'%'+_0x414310['query'][_0x15fd('0x42')]+'%'};return _0x44c60c;}})});}_0x5e6e0b=_[_0x15fd('0x43')]({},_0x5e6e0b,_0x414310[_0x15fd('0x46')]);var _0xf241e0={'where':_0x5e6e0b[_0x15fd('0x40')]};return db[_0x15fd('0x47')][_0x15fd('0x20')](_0xf241e0)[_0x15fd('0x28')](function(_0x570fef){_0x58e05e[_0x15fd('0x20')]=_0x570fef;if(_0x414310['query'][_0x15fd('0x48')]){_0x5e6e0b[_0x15fd('0x49')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x5e6e0b);})[_0x15fd('0x28')](function(_0x25112d){_0x58e05e[_0x15fd('0x4a')]=_0x25112d;return _0x58e05e;})[_0x15fd('0x28')](respondWithFilteredResult(_0x10f423,_0x5e6e0b))['catch'](handleError(_0x10f423,null));};exports['show']=function(_0x1510c0,_0x5c8f20){var _0x6bf25e={'raw':![],'where':{'id':_0x1510c0[_0x15fd('0x4b')]['id']}},_0x3fd03f={};_0x3fd03f[_0x15fd('0x38')]=_[_0x15fd('0x35')](db[_0x15fd('0x47')][_0x15fd('0x30')]);_0x3fd03f[_0x15fd('0x34')]=_[_0x15fd('0x35')](_0x1510c0[_0x15fd('0x34')]);_0x3fd03f[_0x15fd('0x36')]=_[_0x15fd('0x37')](_0x3fd03f[_0x15fd('0x38')],_0x3fd03f[_0x15fd('0x34')]);_0x6bf25e[_0x15fd('0x39')]=_[_0x15fd('0x37')](_0x3fd03f[_0x15fd('0x38')],qs[_0x15fd('0x3a')](_0x1510c0[_0x15fd('0x34')]['fields']));_0x6bf25e[_0x15fd('0x39')]=_0x6bf25e[_0x15fd('0x39')][_0x15fd('0x3b')]?_0x6bf25e[_0x15fd('0x39')]:_0x3fd03f['model'];if(_0x1510c0[_0x15fd('0x34')][_0x15fd('0x48')]){_0x6bf25e[_0x15fd('0x49')]=[{'all':!![]}];}_0x6bf25e=_[_0x15fd('0x43')]({},_0x6bf25e,_0x1510c0[_0x15fd('0x46')]);return db[_0x15fd('0x47')]['find'](_0x6bf25e)[_0x15fd('0x28')](handleEntityNotFound(_0x5c8f20,null))['then'](respondWithResult(_0x5c8f20,null))[_0x15fd('0x4c')](handleError(_0x5c8f20,null));};exports[_0x15fd('0x26')]=function(_0x85bdfc,_0xd6b1be){if(_0x85bdfc[_0x15fd('0x4d')]['id']){delete _0x85bdfc[_0x15fd('0x4d')]['id'];}return db['VoiceMusicOnHold'][_0x15fd('0x4e')]({'where':{'id':_0x85bdfc[_0x15fd('0x4b')]['id']}})[_0x15fd('0x28')](handleEntityNotFound(_0xd6b1be,null))['then'](saveUpdates(_0x85bdfc['body'],null))[_0x15fd('0x28')](respondWithResult(_0xd6b1be,null))[_0x15fd('0x4c')](handleError(_0xd6b1be,null));};exports['create']=function(_0x1cb1cf,_0x43ca55,_0x57a50b){return db['sequelize'][_0x15fd('0x4f')](function(_0x154304){if(_0x1cb1cf[_0x15fd('0x4d')][_0x15fd('0x50')]===_0x15fd('0x51')){_0x1cb1cf[_0x15fd('0x4d')][_0x15fd('0x52')]=path[_0x15fd('0x53')](config[_0x15fd('0x54')],_0x15fd('0x55'),_0x1cb1cf[_0x15fd('0x4d')]['name']);}return db[_0x15fd('0x47')]['create'](_0x1cb1cf['body'],{'transaction':_0x154304})[_0x15fd('0x28')](function(_0x5905cc){if(_0x1cb1cf[_0x15fd('0x4d')][_0x15fd('0x50')]===_0x15fd('0x51')){fs[_0x15fd('0x56')](_0x5905cc['directory'],parseInt('0777',0x8));}var _0x4b4011=_0x1cb1cf[_0x15fd('0x57')][_0x15fd('0x58')]({'plain':!![]});if(!_0x4b4011)throw new Error(_0x15fd('0x59'));if(_0x4b4011[_0x15fd('0x5a')]===_0x15fd('0x57')){var _0x140f9e=_0x5905cc[_0x15fd('0x58')]({'plain':!![]});return db[_0x15fd('0x5b')][_0x15fd('0x4e')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4b4011[_0x15fd('0x5c')]},'raw':!![]})[_0x15fd('0x28')](function(_0x262e96){if(_0x262e96&&_0x262e96[_0x15fd('0x5d')]===0x0){return db[_0x15fd('0x2a')][_0x15fd('0x5e')]({'name':_0x140f9e[_0x15fd('0x2d')],'resourceId':_0x140f9e['id'],'type':_0x262e96['name'],'sectionId':_0x262e96['id']},{})[_0x15fd('0x28')](function(){return _0x5905cc;});}else{return _0x5905cc;}})[_0x15fd('0x4c')](function(_0x113f53){logger[_0x15fd('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113f53);});}return _0x5905cc;});})[_0x15fd('0x28')](respondWithResult(_0x43ca55,0xc9))['catch'](handleError(_0x43ca55,null));};exports[_0x15fd('0x27')]=function(_0x1f5070,_0x4c0520,_0x5ae3f5){var _0x627ef;return db[_0x15fd('0x47')][_0x15fd('0x4e')]({'where':{'id':_0x1f5070[_0x15fd('0x4b')]['id']}})[_0x15fd('0x28')](function(_0x3c82ca){if(_0x3c82ca){return db[_0x15fd('0x5f')][_0x15fd('0x4f')](function(_0x243a09){return _0x3c82ca['destroy']({'transaction':_0x243a09,'raw':!![]})[_0x15fd('0x28')](function(_0x265581){if(_0x265581['directory']){fs[_0x15fd('0x60')](_0x265581[_0x15fd('0x52')])[_0x15fd('0x61')](function(_0x2a906d){fs[_0x15fd('0x62')](path[_0x15fd('0x53')](_0x265581[_0x15fd('0x52')],_0x2a906d));});fs['rmdirSync'](_0x265581[_0x15fd('0x52')]);}return _0x265581;});})[_0x15fd('0x4c')](function(_0x3b3e90){throw new db[(_0x15fd('0x63'))][(_0x15fd('0x64'))](_0x3b3e90[_0x15fd('0x65')]);});}})[_0x15fd('0x28')](handleEntityNotFound(_0x4c0520,null))[_0x15fd('0x28')](removeEntity(_0x4c0520,null))[_0x15fd('0x4c')](handleError(_0x4c0520,null));};exports[_0x15fd('0x66')]=function(_0x238d3f,_0x142033,_0x21ec4a){return db['sequelize']['transaction'](function(_0x54db66){var _0x583598;return db['VoiceMusicOnHold'][_0x15fd('0x4e')]({'where':{'id':_0x238d3f['params']['id']}})[_0x15fd('0x28')](function(_0x15c122){if(_0x15c122){_0x583598=_0x15c122;return _0x15c122[_0x15fd('0x66')](_0x238d3f[_0x15fd('0x4d')]['id'],{'transaction':_0x54db66});}})[_0x15fd('0x28')](function(_0x5bc954){if(_0x5bc954){return db[_0x15fd('0x67')][_0x15fd('0x68')]({'where':{'id':_0x238d3f['body']['id']},'attributes':['id',_0x15fd('0x2d'),'save_name',_0x15fd('0x69'),'createdAt'],'raw':!![]});}})[_0x15fd('0x28')](function(_0x55d825){if(_0x55d825){var _0x48c6be=path[_0x15fd('0x53')](config[_0x15fd('0x54')],_0x15fd('0x6a'),util[_0x15fd('0x6b')](_0x15fd('0x6c'),path[_0x15fd('0x6d')](_0x55d825['save_name'],path[_0x15fd('0x6e')](_0x55d825[_0x15fd('0x6f')])),_0x55d825['converted_format']));var _0x430806=path[_0x15fd('0x53')](config['root'],'server/files/moh',_0x583598[_0x15fd('0x2d')],util[_0x15fd('0x6b')](_0x15fd('0x6c'),_0x55d825[_0x15fd('0x2d')],_0x55d825[_0x15fd('0x69')]));fs['symlinkSync'](_0x48c6be,_0x430806);return _0x55d825;}})[_0x15fd('0x4c')](function(_0x175e9a){throw new db['Sequelize'][(_0x15fd('0x64'))](_0x175e9a[_0x15fd('0x65')]);});})[_0x15fd('0x28')](handleEntityNotFound(_0x142033,null))[_0x15fd('0x28')](respondWithResult(_0x142033,0xc9))['catch'](handleError(_0x142033,null));};exports['removeSound']=function(_0xa9084a,_0x59ddb2,_0x3e4d73){return db[_0x15fd('0x5f')][_0x15fd('0x4f')](function(_0x2e4668){var _0x40bad5;return db[_0x15fd('0x47')][_0x15fd('0x68')]({'where':{'id':_0xa9084a[_0x15fd('0x4b')]['id']}})[_0x15fd('0x28')](handleEntityNotFound(_0x59ddb2,null))[_0x15fd('0x28')](function(_0x243292){if(_0x243292){_0x40bad5=_0x243292;return _0x243292[_0x15fd('0x70')](_0xa9084a[_0x15fd('0x4b')]['id2']);}})['then'](function(_0x34fce3){if(_0x34fce3){return db[_0x15fd('0x67')]['findOne']({'where':{'id':_0xa9084a[_0x15fd('0x4b')][_0x15fd('0x71')]},'attributes':['id','name',_0x15fd('0x6f'),_0x15fd('0x69'),_0x15fd('0x72')],'raw':!![]});}})[_0x15fd('0x28')](function(_0x5aed47){if(_0x5aed47){fs[_0x15fd('0x62')](path[_0x15fd('0x53')](_0x40bad5[_0x15fd('0x52')],util[_0x15fd('0x6b')]('%s.%s',_0x5aed47[_0x15fd('0x2d')],_0x5aed47[_0x15fd('0x69')])));return _0x5aed47;}})[_0x15fd('0x4c')](function(_0x28f6d8){throw new db[(_0x15fd('0x63'))][(_0x15fd('0x64'))](_0x28f6d8[_0x15fd('0x65')]);});})['then'](handleEntityNotFound(_0x59ddb2,null))[_0x15fd('0x28')](respondWithStatusCode(_0x59ddb2,0xcc))[_0x15fd('0x4c')](handleError(_0x59ddb2,null));};exports[_0x15fd('0x73')]=function(_0x138234,_0x56f117,_0xe4f39e){var _0x4e743a={};var _0x55b2ab={};var _0x1518dd;var _0x49a0c7;return db[_0x15fd('0x47')][_0x15fd('0x68')]({'where':{'id':_0x138234['params']['id']}})[_0x15fd('0x28')](handleEntityNotFound(_0x56f117,null))[_0x15fd('0x28')](function(_0x5e7c9e){if(_0x5e7c9e){_0x1518dd=_0x5e7c9e;_0x55b2ab[_0x15fd('0x38')]=_[_0x15fd('0x35')](db[_0x15fd('0x67')][_0x15fd('0x30')]);_0x55b2ab[_0x15fd('0x34')]=_['keys'](_0x138234['query']);_0x55b2ab[_0x15fd('0x36')]=_['intersection'](_0x55b2ab[_0x15fd('0x38')],_0x55b2ab[_0x15fd('0x34')]);_0x4e743a['attributes']=_[_0x15fd('0x37')](_0x55b2ab[_0x15fd('0x38')],qs[_0x15fd('0x3a')](_0x138234[_0x15fd('0x34')][_0x15fd('0x3a')]));_0x4e743a[_0x15fd('0x39')]=_0x4e743a[_0x15fd('0x39')]['length']?_0x4e743a[_0x15fd('0x39')]:_0x55b2ab[_0x15fd('0x38')];_0x4e743a['order']=qs['sort'](_0x138234[_0x15fd('0x34')]['sort']);_0x4e743a[_0x15fd('0x40')]=qs[_0x15fd('0x36')](_['pick'](_0x138234[_0x15fd('0x34')],_0x55b2ab['filters']));if(_0x138234['query'][_0x15fd('0x42')]){_0x4e743a['where']=_[_0x15fd('0x43')](_0x4e743a[_0x15fd('0x40')],{'$or':_['map'](_0x4e743a['attributes'],function(_0x368fbf){var _0x4be5b4={};_0x4be5b4[_0x368fbf]={'$like':'%'+_0x138234[_0x15fd('0x34')]['filter']+'%'};return _0x4be5b4;})});}_0x4e743a=_['merge']({},_0x4e743a,_0x138234[_0x15fd('0x46')]);return _0x1518dd['getSounds'](_0x4e743a);}})[_0x15fd('0x28')](function(_0x2478b1){if(_0x2478b1){_0x49a0c7=_0x2478b1['length'];if(!_0x138234['query'][_0x15fd('0x3c')]('nolimit')){_0x4e743a[_0x15fd('0x3e')]=qs[_0x15fd('0x3e')](_0x138234['query'][_0x15fd('0x3e')]);_0x4e743a[_0x15fd('0x1e')]=qs[_0x15fd('0x1e')](_0x138234[_0x15fd('0x34')]['offset']);}return _0x1518dd[_0x15fd('0x73')](_0x4e743a);}})[_0x15fd('0x28')](function(_0x42daf6){if(_0x42daf6){return _0x42daf6?{'count':_0x49a0c7,'rows':_0x42daf6}:null;}})['then'](respondWithResult(_0x56f117,null))[_0x15fd('0x4c')](handleError(_0x56f117,null));}; \ No newline at end of file +var _0x2e24=['set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','sequelize','transaction','body','mode','files','directory','join','root','create','0777','user','role','MusicOnHolds','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','server/files/moh','symlinkSync','ValidationError','removeSound','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x2e24,0x135));var _0x42e2=function(_0x2771f6,_0x35055c){_0x2771f6=_0x2771f6-0x0;var _0x2d416b=_0x2e24[_0x2771f6];return _0x2d416b;};'use strict';var emlformat=require(_0x42e2('0x0'));var rimraf=require(_0x42e2('0x1'));var zipdir=require(_0x42e2('0x2'));var jsonpatch=require(_0x42e2('0x3'));var rp=require(_0x42e2('0x4'));var moment=require(_0x42e2('0x5'));var BPromise=require(_0x42e2('0x6'));var Mustache=require(_0x42e2('0x7'));var util=require(_0x42e2('0x8'));var path=require(_0x42e2('0x9'));var sox=require(_0x42e2('0xa'));var csv=require(_0x42e2('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42e2('0xc'));var _=require(_0x42e2('0xd'));var squel=require(_0x42e2('0xe'));var crypto=require(_0x42e2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x42e2('0x10'));var toCsv=require(_0x42e2('0xb'));var querystring=require(_0x42e2('0x11'));var Papa=require(_0x42e2('0x12'));var Redis=require('ioredis');var authService=require(_0x42e2('0x13'));var qs=require(_0x42e2('0x14'));var as=require(_0x42e2('0x15'));var hardwareService=require(_0x42e2('0x16'));var logger=require(_0x42e2('0x17'))('api');var utils=require(_0x42e2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x42e2('0x19'));var db=require(_0x42e2('0x1a'))['db'];function respondWithStatusCode(_0x4ecd8d,_0x7084b6){_0x7084b6=_0x7084b6||0xcc;return function(_0x48c53c){if(_0x48c53c){return _0x4ecd8d['sendStatus'](_0x7084b6);}return _0x4ecd8d['status'](_0x7084b6)['end']();};}function respondWithResult(_0x50ccf7,_0x36569){_0x36569=_0x36569||0xc8;return function(_0x177cd2){if(_0x177cd2){return _0x50ccf7[_0x42e2('0x1b')](_0x36569)[_0x42e2('0x1c')](_0x177cd2);}};}function respondWithFilteredResult(_0x115abf,_0x6d6dac){return function(_0x5a952b){if(_0x5a952b){var _0x2750c0=typeof _0x6d6dac[_0x42e2('0x1d')]===_0x42e2('0x1e')&&typeof _0x6d6dac[_0x42e2('0x1f')]==='undefined';var _0x61cfbc=_0x5a952b[_0x42e2('0x20')];var _0x1b6c15=_0x2750c0?0x0:_0x6d6dac['offset'];var _0x55b609=_0x2750c0?_0x5a952b[_0x42e2('0x20')]:_0x6d6dac[_0x42e2('0x1d')]+_0x6d6dac[_0x42e2('0x1f')];var _0x365b68;if(_0x55b609>=_0x61cfbc){_0x55b609=_0x61cfbc;_0x365b68=0xc8;}else{_0x365b68=0xce;}_0x115abf[_0x42e2('0x1b')](_0x365b68);return _0x115abf[_0x42e2('0x21')](_0x42e2('0x22'),_0x1b6c15+'-'+_0x55b609+'/'+_0x61cfbc)[_0x42e2('0x1c')](_0x5a952b);}return null;};}function patchUpdates(_0x291c97){return function(_0x490140){try{jsonpatch[_0x42e2('0x23')](_0x490140,_0x291c97,!![]);}catch(_0x30232c){return BPromise[_0x42e2('0x24')](_0x30232c);}return _0x490140[_0x42e2('0x25')]();};}function saveUpdates(_0x4cfd74,_0x28bea3){return function(_0x4a69e0){if(_0x4a69e0){return _0x4a69e0[_0x42e2('0x26')](_0x4cfd74)[_0x42e2('0x27')](function(_0x10b4ba){return _0x10b4ba;});}return null;};}function removeEntity(_0x481eb9,_0x234fa2){return function(_0x5354c7){if(_0x5354c7){return _0x5354c7[_0x42e2('0x28')]()[_0x42e2('0x27')](function(){var _0x8947ae=_0x5354c7[_0x42e2('0x29')]({'plain':!![]});var _0x254744='MusicOnHolds';return db[_0x42e2('0x2a')][_0x42e2('0x28')]({'where':{'type':_0x254744,'resourceId':_0x8947ae['id']}})[_0x42e2('0x27')](function(){return _0x5354c7;});})[_0x42e2('0x27')](function(){_0x481eb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a45c,_0x10ca53){return function(_0x5626e0){if(!_0x5626e0){_0x22a45c[_0x42e2('0x2b')](0x194);}return _0x5626e0;};}function handleError(_0x31f3e6,_0xc7fb87){_0xc7fb87=_0xc7fb87||0x1f4;return function(_0x31fe43){logger['error'](_0x31fe43['stack']);if(_0x31fe43[_0x42e2('0x2c')]){delete _0x31fe43[_0x42e2('0x2c')];}_0x31f3e6[_0x42e2('0x1b')](_0xc7fb87)[_0x42e2('0x2d')](_0x31fe43);};}exports[_0x42e2('0x2e')]=function(_0x5bafce,_0x1230be){var _0x4a0b12={},_0xe5ed2e={},_0x5b641b={'count':0x0,'rows':[]};var _0x16ba9d=_[_0x42e2('0x2f')](db[_0x42e2('0x30')][_0x42e2('0x31')],function(_0x2db7c){return{'name':_0x2db7c[_0x42e2('0x32')],'type':_0x2db7c['type'][_0x42e2('0x33')]};});_0xe5ed2e['model']=_['map'](_0x16ba9d,'name');_0xe5ed2e[_0x42e2('0x34')]=_['keys'](_0x5bafce['query']);_0xe5ed2e[_0x42e2('0x35')]=_['intersection'](_0xe5ed2e[_0x42e2('0x36')],_0xe5ed2e['query']);_0x4a0b12[_0x42e2('0x37')]=_[_0x42e2('0x38')](_0xe5ed2e['model'],qs[_0x42e2('0x39')](_0x5bafce[_0x42e2('0x34')][_0x42e2('0x39')]));_0x4a0b12[_0x42e2('0x37')]=_0x4a0b12['attributes'][_0x42e2('0x3a')]?_0x4a0b12['attributes']:_0xe5ed2e[_0x42e2('0x36')];if(!_0x5bafce[_0x42e2('0x34')]['hasOwnProperty'](_0x42e2('0x3b'))){_0x4a0b12[_0x42e2('0x1f')]=qs[_0x42e2('0x1f')](_0x5bafce[_0x42e2('0x34')][_0x42e2('0x1f')]);_0x4a0b12[_0x42e2('0x1d')]=qs['offset'](_0x5bafce[_0x42e2('0x34')]['offset']);}_0x4a0b12[_0x42e2('0x3c')]=qs[_0x42e2('0x3d')](_0x5bafce['query'][_0x42e2('0x3d')]);delete _0x5bafce[_0x42e2('0x34')]['sort'];_0x4a0b12[_0x42e2('0x3e')]=qs['filters'](_[_0x42e2('0x3f')](_0x5bafce[_0x42e2('0x34')],_0xe5ed2e['filters']),_0x16ba9d);if(_0x5bafce[_0x42e2('0x34')][_0x42e2('0x40')]){_0x4a0b12[_0x42e2('0x3e')]=_[_0x42e2('0x41')](_0x4a0b12['where'],{'$or':_[_0x42e2('0x2f')](_0x16ba9d,function(_0x15e103){if(_0x15e103[_0x42e2('0x42')]!==_0x42e2('0x43')){var _0x134024={};_0x134024[_0x15e103[_0x42e2('0x2c')]]={'$like':'%'+_0x5bafce[_0x42e2('0x34')][_0x42e2('0x40')]+'%'};return _0x134024;}})});}_0x4a0b12=_[_0x42e2('0x41')]({},_0x4a0b12,_0x5bafce[_0x42e2('0x44')]);var _0x3a36b9={'where':_0x4a0b12[_0x42e2('0x3e')]};return db[_0x42e2('0x30')]['count'](_0x3a36b9)[_0x42e2('0x27')](function(_0x35abd1){_0x5b641b[_0x42e2('0x20')]=_0x35abd1;if(_0x5bafce[_0x42e2('0x34')][_0x42e2('0x45')]){_0x4a0b12[_0x42e2('0x46')]=[{'all':!![]}];}return db[_0x42e2('0x30')]['findAll'](_0x4a0b12);})[_0x42e2('0x27')](function(_0x428701){_0x5b641b['rows']=_0x428701;return _0x5b641b;})['then'](respondWithFilteredResult(_0x1230be,_0x4a0b12))[_0x42e2('0x47')](handleError(_0x1230be,null));};exports[_0x42e2('0x48')]=function(_0x3337a7,_0x287773){var _0x33f566={'raw':![],'where':{'id':_0x3337a7[_0x42e2('0x49')]['id']}},_0x57a82c={};_0x57a82c[_0x42e2('0x36')]=_[_0x42e2('0x4a')](db['VoiceMusicOnHold'][_0x42e2('0x31')]);_0x57a82c[_0x42e2('0x34')]=_[_0x42e2('0x4a')](_0x3337a7[_0x42e2('0x34')]);_0x57a82c['filters']=_[_0x42e2('0x38')](_0x57a82c[_0x42e2('0x36')],_0x57a82c[_0x42e2('0x34')]);_0x33f566[_0x42e2('0x37')]=_[_0x42e2('0x38')](_0x57a82c[_0x42e2('0x36')],qs[_0x42e2('0x39')](_0x3337a7[_0x42e2('0x34')][_0x42e2('0x39')]));_0x33f566[_0x42e2('0x37')]=_0x33f566[_0x42e2('0x37')]['length']?_0x33f566[_0x42e2('0x37')]:_0x57a82c[_0x42e2('0x36')];if(_0x3337a7[_0x42e2('0x34')][_0x42e2('0x45')]){_0x33f566[_0x42e2('0x46')]=[{'all':!![]}];}_0x33f566=_[_0x42e2('0x41')]({},_0x33f566,_0x3337a7[_0x42e2('0x44')]);return db['VoiceMusicOnHold'][_0x42e2('0x4b')](_0x33f566)[_0x42e2('0x27')](handleEntityNotFound(_0x287773,null))['then'](respondWithResult(_0x287773,null))[_0x42e2('0x47')](handleError(_0x287773,null));};exports[_0x42e2('0x26')]=function(_0x1ba3ad,_0x4707d8){if(_0x1ba3ad['body']['id']){delete _0x1ba3ad['body']['id'];}return db[_0x42e2('0x30')][_0x42e2('0x4b')]({'where':{'id':_0x1ba3ad[_0x42e2('0x49')]['id']}})[_0x42e2('0x27')](handleEntityNotFound(_0x4707d8,null))[_0x42e2('0x27')](saveUpdates(_0x1ba3ad['body'],null))[_0x42e2('0x27')](respondWithResult(_0x4707d8,null))['catch'](handleError(_0x4707d8,null));};exports['create']=function(_0x29209e,_0x2f10bd,_0x469aba){return db[_0x42e2('0x4c')][_0x42e2('0x4d')](function(_0x4f8f49){if(_0x29209e[_0x42e2('0x4e')][_0x42e2('0x4f')]===_0x42e2('0x50')){_0x29209e[_0x42e2('0x4e')][_0x42e2('0x51')]=path[_0x42e2('0x52')](config[_0x42e2('0x53')],'server/files/moh',_0x29209e[_0x42e2('0x4e')][_0x42e2('0x2c')]);}return db[_0x42e2('0x30')][_0x42e2('0x54')](_0x29209e[_0x42e2('0x4e')],{'transaction':_0x4f8f49})[_0x42e2('0x27')](function(_0x37a60e){if(_0x29209e['body'][_0x42e2('0x4f')]===_0x42e2('0x50')){fs['mkdirSync'](_0x37a60e['directory'],parseInt(_0x42e2('0x55'),0x8));}var _0x5b4b8b=_0x29209e[_0x42e2('0x56')][_0x42e2('0x29')]({'plain':!![]});if(!_0x5b4b8b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b4b8b[_0x42e2('0x57')]==='user'){var _0x355295=_0x37a60e[_0x42e2('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x42e2('0x4b')]({'where':{'name':_0x42e2('0x58'),'userProfileId':_0x5b4b8b[_0x42e2('0x59')]},'raw':!![]})[_0x42e2('0x27')](function(_0x45dd29){if(_0x45dd29&&_0x45dd29['autoAssociation']===0x0){return db['UserProfileResource'][_0x42e2('0x54')]({'name':_0x355295[_0x42e2('0x2c')],'resourceId':_0x355295['id'],'type':_0x45dd29['name'],'sectionId':_0x45dd29['id']},{})[_0x42e2('0x27')](function(){return _0x37a60e;});}else{return _0x37a60e;}})[_0x42e2('0x47')](function(_0x3416b8){logger[_0x42e2('0x5a')](_0x42e2('0x5b'),_0x3416b8);});}return _0x37a60e;});})[_0x42e2('0x27')](respondWithResult(_0x2f10bd,0xc9))[_0x42e2('0x47')](handleError(_0x2f10bd,null));};exports[_0x42e2('0x28')]=function(_0xd1912e,_0x413d84,_0x35ca26){var _0x46f936;return db[_0x42e2('0x30')]['find']({'where':{'id':_0xd1912e['params']['id']}})[_0x42e2('0x27')](function(_0x391717){if(_0x391717){return db[_0x42e2('0x4c')][_0x42e2('0x4d')](function(_0x3e270a){return _0x391717[_0x42e2('0x28')]({'transaction':_0x3e270a,'raw':!![]})[_0x42e2('0x27')](function(_0xac758e){if(_0xac758e[_0x42e2('0x51')]){fs[_0x42e2('0x5c')](_0xac758e['directory'])[_0x42e2('0x5d')](function(_0x350b3f){fs[_0x42e2('0x5e')](path[_0x42e2('0x52')](_0xac758e[_0x42e2('0x51')],_0x350b3f));});fs[_0x42e2('0x5f')](_0xac758e[_0x42e2('0x51')]);}return _0xac758e;});})[_0x42e2('0x47')](function(_0x2ef474){throw new db[(_0x42e2('0x60'))]['ValidationError'](_0x2ef474[_0x42e2('0x61')]);});}})[_0x42e2('0x27')](handleEntityNotFound(_0x413d84,null))[_0x42e2('0x27')](removeEntity(_0x413d84,null))[_0x42e2('0x47')](handleError(_0x413d84,null));};exports['addSound']=function(_0x52c46f,_0x2beabf,_0x2970c2){return db[_0x42e2('0x4c')][_0x42e2('0x4d')](function(_0x220a5a){var _0x3475ff;return db[_0x42e2('0x30')][_0x42e2('0x4b')]({'where':{'id':_0x52c46f[_0x42e2('0x49')]['id']}})[_0x42e2('0x27')](function(_0x3d5229){if(_0x3d5229){_0x3475ff=_0x3d5229;return _0x3d5229[_0x42e2('0x62')](_0x52c46f['body']['id'],{'transaction':_0x220a5a});}})[_0x42e2('0x27')](function(_0x23d91b){if(_0x23d91b){return db[_0x42e2('0x63')][_0x42e2('0x64')]({'where':{'id':_0x52c46f['body']['id']},'attributes':['id',_0x42e2('0x2c'),_0x42e2('0x65'),_0x42e2('0x66'),_0x42e2('0x67')],'raw':!![]});}})[_0x42e2('0x27')](function(_0x136344){if(_0x136344){var _0x5a1f27=path['join'](config['root'],_0x42e2('0x68'),util[_0x42e2('0x69')](_0x42e2('0x6a'),path[_0x42e2('0x6b')](_0x136344[_0x42e2('0x65')],path['extname'](_0x136344[_0x42e2('0x65')])),_0x136344['converted_format']));var _0x1ae6fa=path['join'](config[_0x42e2('0x53')],_0x42e2('0x6c'),_0x3475ff[_0x42e2('0x2c')],util[_0x42e2('0x69')](_0x42e2('0x6a'),_0x136344[_0x42e2('0x2c')],_0x136344[_0x42e2('0x66')]));fs[_0x42e2('0x6d')](_0x5a1f27,_0x1ae6fa);return _0x136344;}})[_0x42e2('0x47')](function(_0x2fd876){throw new db[(_0x42e2('0x60'))][(_0x42e2('0x6e'))](_0x2fd876[_0x42e2('0x61')]);});})[_0x42e2('0x27')](handleEntityNotFound(_0x2beabf,null))['then'](respondWithResult(_0x2beabf,0xc9))[_0x42e2('0x47')](handleError(_0x2beabf,null));};exports[_0x42e2('0x6f')]=function(_0x19817e,_0x59044f,_0x1cde65){return db[_0x42e2('0x4c')][_0x42e2('0x4d')](function(_0x205318){var _0x29074d;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x19817e[_0x42e2('0x49')]['id']}})[_0x42e2('0x27')](handleEntityNotFound(_0x59044f,null))['then'](function(_0x5e47b9){if(_0x5e47b9){_0x29074d=_0x5e47b9;return _0x5e47b9[_0x42e2('0x6f')](_0x19817e[_0x42e2('0x49')]['id2']);}})[_0x42e2('0x27')](function(_0x52d4d8){if(_0x52d4d8){return db['Sound'][_0x42e2('0x64')]({'where':{'id':_0x19817e[_0x42e2('0x49')]['id2']},'attributes':['id',_0x42e2('0x2c'),'save_name',_0x42e2('0x66'),_0x42e2('0x67')],'raw':!![]});}})['then'](function(_0x19a48b){if(_0x19a48b){fs[_0x42e2('0x5e')](path[_0x42e2('0x52')](_0x29074d[_0x42e2('0x51')],util['format']('%s.%s',_0x19a48b['name'],_0x19a48b[_0x42e2('0x66')])));return _0x19a48b;}})['catch'](function(_0x3ce906){throw new db[(_0x42e2('0x60'))][(_0x42e2('0x6e'))](_0x3ce906[_0x42e2('0x61')]);});})[_0x42e2('0x27')](handleEntityNotFound(_0x59044f,null))[_0x42e2('0x27')](respondWithStatusCode(_0x59044f,0xcc))[_0x42e2('0x47')](handleError(_0x59044f,null));};exports['getSounds']=function(_0x2eec49,_0x43328b,_0x3d62e3){var _0x4525c1={};var _0x1b5414={};var _0x18d7ad;var _0xb209c9;return db['VoiceMusicOnHold'][_0x42e2('0x64')]({'where':{'id':_0x2eec49[_0x42e2('0x49')]['id']}})[_0x42e2('0x27')](handleEntityNotFound(_0x43328b,null))['then'](function(_0x1c0e82){if(_0x1c0e82){_0x18d7ad=_0x1c0e82;_0x1b5414['model']=_['keys'](db[_0x42e2('0x63')][_0x42e2('0x31')]);_0x1b5414[_0x42e2('0x34')]=_[_0x42e2('0x4a')](_0x2eec49['query']);_0x1b5414[_0x42e2('0x35')]=_[_0x42e2('0x38')](_0x1b5414['model'],_0x1b5414[_0x42e2('0x34')]);_0x4525c1['attributes']=_[_0x42e2('0x38')](_0x1b5414[_0x42e2('0x36')],qs['fields'](_0x2eec49[_0x42e2('0x34')][_0x42e2('0x39')]));_0x4525c1[_0x42e2('0x37')]=_0x4525c1[_0x42e2('0x37')][_0x42e2('0x3a')]?_0x4525c1['attributes']:_0x1b5414[_0x42e2('0x36')];_0x4525c1[_0x42e2('0x3c')]=qs['sort'](_0x2eec49[_0x42e2('0x34')][_0x42e2('0x3d')]);_0x4525c1[_0x42e2('0x3e')]=qs[_0x42e2('0x35')](_['pick'](_0x2eec49[_0x42e2('0x34')],_0x1b5414['filters']));if(_0x2eec49[_0x42e2('0x34')][_0x42e2('0x40')]){_0x4525c1[_0x42e2('0x3e')]=_[_0x42e2('0x41')](_0x4525c1[_0x42e2('0x3e')],{'$or':_[_0x42e2('0x2f')](_0x4525c1[_0x42e2('0x37')],function(_0xa5c29f){var _0x586d28={};_0x586d28[_0xa5c29f]={'$like':'%'+_0x2eec49[_0x42e2('0x34')][_0x42e2('0x40')]+'%'};return _0x586d28;})});}_0x4525c1=_['merge']({},_0x4525c1,_0x2eec49[_0x42e2('0x44')]);return _0x18d7ad[_0x42e2('0x70')](_0x4525c1);}})[_0x42e2('0x27')](function(_0x1cad9f){if(_0x1cad9f){_0xb209c9=_0x1cad9f[_0x42e2('0x3a')];if(!_0x2eec49['query'][_0x42e2('0x71')](_0x42e2('0x3b'))){_0x4525c1[_0x42e2('0x1f')]=qs[_0x42e2('0x1f')](_0x2eec49[_0x42e2('0x34')][_0x42e2('0x1f')]);_0x4525c1[_0x42e2('0x1d')]=qs[_0x42e2('0x1d')](_0x2eec49[_0x42e2('0x34')][_0x42e2('0x1d')]);}return _0x18d7ad[_0x42e2('0x70')](_0x4525c1);}})[_0x42e2('0x27')](function(_0x411bd2){if(_0x411bd2){return _0x411bd2?{'count':_0xb209c9,'rows':_0x411bd2}:null;}})[_0x42e2('0x27')](respondWithResult(_0x43328b,null))[_0x42e2('0x47')](handleError(_0x43328b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0cad189..abc9e6a 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 _0x7288=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x5fd828,_0xa7ede9){var _0x3c1eaa=function(_0x55a405){while(--_0x55a405){_0x5fd828['push'](_0x5fd828['shift']());}};_0x3c1eaa(++_0xa7ede9);}(_0x7288,0x1b5));var _0x8728=function(_0x42b2a1,_0x8cb069){_0x42b2a1=_0x42b2a1-0x0;var _0x29dcc5=_0x7288[_0x42b2a1];return _0x29dcc5;};'use strict';var _=require(_0x8728('0x0'));var util=require('util');var logger=require(_0x8728('0x1'))(_0x8728('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8728('0x3'));var fs=require('fs');var path=require(_0x8728('0x4'));var rimraf=require(_0x8728('0x5'));var config=require(_0x8728('0x6'));var attributes=require(_0x8728('0x7'));module[_0x8728('0x8')]=function(_0x9ea50a,_0x30d5c5){return _0x9ea50a[_0x8728('0x9')](_0x8728('0xa'),attributes,{'tableName':_0x8728('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x681c=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold'];(function(_0x86d665,_0x18cfd4){var _0x4d9575=function(_0x3d60dc){while(--_0x3d60dc){_0x86d665['push'](_0x86d665['shift']());}};_0x4d9575(++_0x18cfd4);}(_0x681c,0x160));var _0xc681=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x681c[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xc681('0x0'));var util=require('util');var logger=require(_0xc681('0x1'))(_0xc681('0x2'));var moment=require('moment');var BPromise=require(_0xc681('0x3'));var rp=require(_0xc681('0x4'));var fs=require('fs');var path=require(_0xc681('0x5'));var rimraf=require(_0xc681('0x6'));var config=require(_0xc681('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xc681('0x8')]=function(_0x23938a,_0x392ec1){return _0x23938a[_0xc681('0x9')](_0xc681('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 45a6d53..dbcc1cd 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x86e230,_0x391ef9){var _0x4eec84=function(_0x2af313){while(--_0x2af313){_0x86e230['push'](_0x86e230['shift']());}};_0x4eec84(++_0x391ef9);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3edb09,_0x2474f1){var _0x254b85=function(_0xa7b5c){while(--_0xa7b5c){_0x3edb09['push'](_0x3edb09['shift']());}};_0x254b85(++_0x2474f1);}(_0x70e0,0x17b));var _0x070e=function(_0x40cf46,_0x48d3f0){_0x40cf46=_0x40cf46-0x0;var _0x571ab7=_0x70e0[_0x40cf46];return _0x571ab7;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a83f05c..7381b1b 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 _0x8393=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0x4baa18,_0xc613b2){var _0x3912cc=function(_0x25d92f){while(--_0x25d92f){_0x4baa18['push'](_0x4baa18['shift']());}};_0x3912cc(++_0xc613b2);}(_0x8393,0x1e1));var _0x3839=function(_0x134ca9,_0x23d1d0){_0x134ca9=_0x134ca9-0x0;var _0x5413be=_0x8393[_0x134ca9];return _0x5413be;};'use strict';var multer=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var path=require(_0x3839('0x2'));var timeout=require(_0x3839('0x3'));var express=require('express');var router=express[_0x3839('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3839('0x5'));var interaction=require(_0x3839('0x6'));var config=require(_0x3839('0x7'));var controller=require(_0x3839('0x8'));router[_0x3839('0x9')]('/',auth[_0x3839('0xa')](),controller[_0x3839('0xb')]);router[_0x3839('0x9')]('/describe',auth[_0x3839('0xa')](),controller[_0x3839('0xc')]);router[_0x3839('0x9')](_0x3839('0xd'),auth[_0x3839('0xa')](),controller['show']);router[_0x3839('0x9')](_0x3839('0xe'),auth['isAuthenticated'](),controller[_0x3839('0xf')]);router[_0x3839('0x9')](_0x3839('0x10'),auth[_0x3839('0xa')](),controller[_0x3839('0x11')]);router[_0x3839('0x12')]('/',auth[_0x3839('0xa')](),controller[_0x3839('0x13')]);router[_0x3839('0x12')]('/:id/users',auth[_0x3839('0xa')](),controller['addAgents']);router['post'](_0x3839('0x10'),auth[_0x3839('0xa')](),controller['addTeams']);router[_0x3839('0x14')](_0x3839('0xd'),auth[_0x3839('0xa')](),controller[_0x3839('0x15')]);router[_0x3839('0x16')](_0x3839('0xd'),auth[_0x3839('0xa')](),controller[_0x3839('0x17')]);router[_0x3839('0x16')](_0x3839('0xe'),auth[_0x3839('0xa')](),controller['removeAgents']);router['delete'](_0x3839('0x10'),auth[_0x3839('0xa')](),controller['removeTeams']);module[_0x3839('0x18')]=router; \ No newline at end of file +var _0x0b31=['/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','delete','removeAgents','removeTeams','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x11714b,_0x196016){var _0xec763d=function(_0x6e0a24){while(--_0x6e0a24){_0x11714b['push'](_0x11714b['shift']());}};_0xec763d(++_0x196016);}(_0x0b31,0x1a2));var _0x10b3=function(_0x397b59,_0x51a350){_0x397b59=_0x397b59-0x0;var _0x5bb85e=_0x0b31[_0x397b59];return _0x5bb85e;};'use strict';var multer=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var path=require(_0x10b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10b3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10b3('0x4'));var interaction=require(_0x10b3('0x5'));var config=require(_0x10b3('0x6'));var controller=require(_0x10b3('0x7'));router[_0x10b3('0x8')]('/',auth[_0x10b3('0x9')](),controller[_0x10b3('0xa')]);router[_0x10b3('0x8')](_0x10b3('0xb'),auth['isAuthenticated'](),controller[_0x10b3('0xc')]);router[_0x10b3('0x8')](_0x10b3('0xd'),auth[_0x10b3('0x9')](),controller['show']);router[_0x10b3('0x8')](_0x10b3('0xe'),auth['isAuthenticated'](),controller[_0x10b3('0xf')]);router[_0x10b3('0x8')](_0x10b3('0x10'),auth[_0x10b3('0x9')](),controller[_0x10b3('0x11')]);router['post']('/',auth[_0x10b3('0x9')](),controller[_0x10b3('0x12')]);router[_0x10b3('0x13')](_0x10b3('0xe'),auth['isAuthenticated'](),controller[_0x10b3('0x14')]);router[_0x10b3('0x13')](_0x10b3('0x10'),auth[_0x10b3('0x9')](),controller[_0x10b3('0x15')]);router[_0x10b3('0x16')](_0x10b3('0xd'),auth[_0x10b3('0x9')](),controller['update']);router['delete']('/:id',auth[_0x10b3('0x9')](),controller['destroy']);router[_0x10b3('0x17')](_0x10b3('0xe'),auth['isAuthenticated'](),controller[_0x10b3('0x18')]);router[_0x10b3('0x17')]('/:id/teams',auth[_0x10b3('0x9')](),controller[_0x10b3('0x19')]);module[_0x10b3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a166d12..36b51f9 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 _0x4393=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue','name','INTEGER'];(function(_0x180afe,_0x4688c4){var _0x779bdc=function(_0x56f8fd){while(--_0x56f8fd){_0x180afe['push'](_0x180afe['shift']());}};_0x779bdc(++_0x4688c4);}(_0x4393,0x1a8));var _0x3439=function(_0x3a15c3,_0x4e60ee){_0x3a15c3=_0x3a15c3-0x0;var _0x3339e8=_0x4393[_0x3a15c3];return _0x3339e8;};'use strict';var Sequelize=require(_0x3439('0x0'));module[_0x3439('0x1')]={'name':{'type':Sequelize[_0x3439('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x3439('0x3')],'get':function(_0x5c9cb3){return _0x3439('0x4')+this[_0x3439('0x5')](_0x3439('0x6'))+'-';}},'description':{'type':Sequelize[_0x3439('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x3439('0x7')]}}; \ No newline at end of file +var _0x97f7=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x8b247d,_0x9401a9){var _0x4e10a3=function(_0x176b53){while(--_0x176b53){_0x8b247d['push'](_0x8b247d['shift']());}};_0x4e10a3(++_0x9401a9);}(_0x97f7,0x1a0));var _0x797f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x97f7[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x797f('0x0'));module[_0x797f('0x1')]={'name':{'type':Sequelize[_0x797f('0x2')],'allowNull':![],'unique':_0x797f('0x3')},'prefix':{'type':Sequelize[_0x797f('0x4')],'get':function(_0x1cb5ca){return _0x797f('0x5')+this[_0x797f('0x6')](_0x797f('0x3'))+'-';}},'description':{'type':Sequelize[_0x797f('0x2')]},'callerIdAll':{'type':Sequelize[_0x797f('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 416ce28..06ade17 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7916=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','length','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getTeams','Team','findAll','Agents','online','interface','flatMap','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x358717,_0x5cd4fb){var _0x232a6f=function(_0x3b8dd0){while(--_0x3b8dd0){_0x358717['push'](_0x358717['shift']());}};_0x232a6f(++_0x5cd4fb);}(_0x7916,0x128));var _0x6791=function(_0x70651e,_0xcae880){_0x70651e=_0x70651e-0x0;var _0x27e778=_0x7916[_0x70651e];return _0x27e778;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6791('0x1b')](socket);function respondWithStatusCode(_0x5122f9,_0x2a9151){_0x2a9151=_0x2a9151||0xcc;return function(_0x4c32a1){if(_0x4c32a1){return _0x5122f9[_0x6791('0x1c')](_0x2a9151);}return _0x5122f9[_0x6791('0x1d')](_0x2a9151)['end']();};}function respondWithResult(_0x3e4792,_0x4b80ed){_0x4b80ed=_0x4b80ed||0xc8;return function(_0x3856ac){if(_0x3856ac){return _0x3e4792[_0x6791('0x1d')](_0x4b80ed)['json'](_0x3856ac);}};}function respondWithFilteredResult(_0xbc35d,_0x36d7a1){return function(_0x5bec14){if(_0x5bec14){var _0x1872f5=typeof _0x36d7a1['offset']===_0x6791('0x1e')&&typeof _0x36d7a1[_0x6791('0x1f')]===_0x6791('0x1e');var _0x3a72ce=_0x5bec14[_0x6791('0x20')];var _0x2bc0ab=_0x1872f5?0x0:_0x36d7a1[_0x6791('0x21')];var _0x581d51=_0x1872f5?_0x5bec14[_0x6791('0x20')]:_0x36d7a1[_0x6791('0x21')]+_0x36d7a1['limit'];var _0x21ef16;if(_0x581d51>=_0x3a72ce){_0x581d51=_0x3a72ce;_0x21ef16=0xc8;}else{_0x21ef16=0xce;}_0xbc35d[_0x6791('0x1d')](_0x21ef16);return _0xbc35d['set'](_0x6791('0x22'),_0x2bc0ab+'-'+_0x581d51+'/'+_0x3a72ce)[_0x6791('0x23')](_0x5bec14);}return null;};}function patchUpdates(_0x15b9ab){return function(_0x12d83b){try{jsonpatch['apply'](_0x12d83b,_0x15b9ab,!![]);}catch(_0x3e17b3){return BPromise[_0x6791('0x24')](_0x3e17b3);}return _0x12d83b['save']();};}function saveUpdates(_0x53bb44,_0x4b23bc){return function(_0x372dae){if(_0x372dae){return _0x372dae['update'](_0x53bb44)[_0x6791('0x25')](function(_0x5409f1){return _0x5409f1;});}return null;};}function removeEntity(_0x54a092,_0x496273){return function(_0x5cadc){if(_0x5cadc){return _0x5cadc[_0x6791('0x26')]()[_0x6791('0x25')](function(){var _0x56a74e=_0x5cadc[_0x6791('0x27')]({'plain':!![]});var _0x30cc17='VoicePrefixes';return db[_0x6791('0x28')]['destroy']({'where':{'type':_0x30cc17,'resourceId':_0x56a74e['id']}})[_0x6791('0x25')](function(){return _0x5cadc;});})['then'](function(){_0x54a092['status'](0xcc)[_0x6791('0x29')]();});}};}function handleEntityNotFound(_0x551718,_0x2f56a2){return function(_0x34b006){if(!_0x34b006){_0x551718['sendStatus'](0x194);}return _0x34b006;};}function handleError(_0x240a9f,_0x273f79){_0x273f79=_0x273f79||0x1f4;return function(_0x234c5e){logger[_0x6791('0x2a')](_0x234c5e['stack']);if(_0x234c5e['name']){delete _0x234c5e[_0x6791('0x2b')];}_0x240a9f['status'](_0x273f79)[_0x6791('0x2c')](_0x234c5e);};}exports[_0x6791('0x2d')]=function(_0x30397e,_0x2b98b8){var _0x1d551b={},_0x127bfa={},_0x8e2101={'count':0x0,'rows':[]};var _0x14307e=_[_0x6791('0x2e')](db[_0x6791('0x2f')]['rawAttributes'],function(_0x28b3d4){return{'name':_0x28b3d4[_0x6791('0x30')],'type':_0x28b3d4[_0x6791('0x31')][_0x6791('0x32')]};});_0x127bfa[_0x6791('0x33')]=_[_0x6791('0x2e')](_0x14307e,'name');_0x127bfa['query']=_['keys'](_0x30397e[_0x6791('0x34')]);_0x127bfa[_0x6791('0x35')]=_[_0x6791('0x36')](_0x127bfa['model'],_0x127bfa['query']);_0x1d551b[_0x6791('0x37')]=_[_0x6791('0x36')](_0x127bfa[_0x6791('0x33')],qs[_0x6791('0x38')](_0x30397e['query'][_0x6791('0x38')]));_0x1d551b[_0x6791('0x37')]=_0x1d551b[_0x6791('0x37')]['length']?_0x1d551b[_0x6791('0x37')]:_0x127bfa['model'];if(!_0x30397e['query'][_0x6791('0x39')](_0x6791('0x3a'))){_0x1d551b['limit']=qs[_0x6791('0x1f')](_0x30397e[_0x6791('0x34')][_0x6791('0x1f')]);_0x1d551b[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x30397e['query'][_0x6791('0x21')]);}_0x1d551b[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x30397e['query'][_0x6791('0x3c')]);_0x1d551b[_0x6791('0x3d')]=qs[_0x6791('0x35')](_['pick'](_0x30397e[_0x6791('0x34')],_0x127bfa[_0x6791('0x35')]),_0x14307e);if(_0x30397e[_0x6791('0x34')][_0x6791('0x3e')]){_0x1d551b['where']=_[_0x6791('0x3f')](_0x1d551b[_0x6791('0x3d')],{'$or':_[_0x6791('0x2e')](_0x14307e,function(_0xd0f1c){if(_0xd0f1c[_0x6791('0x31')]!==_0x6791('0x40')){var _0x2688a9={};_0x2688a9[_0xd0f1c[_0x6791('0x2b')]]={'$like':'%'+_0x30397e[_0x6791('0x34')]['filter']+'%'};return _0x2688a9;}})});}_0x1d551b=_['merge']({},_0x1d551b,_0x30397e[_0x6791('0x41')]);var _0xe11675={'where':_0x1d551b['where']};return db[_0x6791('0x2f')][_0x6791('0x20')](_0xe11675)[_0x6791('0x25')](function(_0x3edb86){_0x8e2101[_0x6791('0x20')]=_0x3edb86;if(_0x30397e[_0x6791('0x34')][_0x6791('0x42')]){_0x1d551b['include']=[{'all':!![]}];}return db[_0x6791('0x2f')]['findAll'](_0x1d551b);})[_0x6791('0x25')](function(_0xfc170e){_0x8e2101[_0x6791('0x43')]=_0xfc170e;return _0x8e2101;})[_0x6791('0x25')](respondWithFilteredResult(_0x2b98b8,_0x1d551b))['catch'](handleError(_0x2b98b8,null));};exports[_0x6791('0x44')]=function(_0x4f0e2d,_0xeb9d45){var _0x3251e9={'raw':![],'where':{'id':_0x4f0e2d[_0x6791('0x45')]['id']}},_0x5a7fb6={};_0x5a7fb6[_0x6791('0x33')]=_[_0x6791('0x46')](db['VoicePrefix'][_0x6791('0x47')]);_0x5a7fb6[_0x6791('0x34')]=_[_0x6791('0x46')](_0x4f0e2d[_0x6791('0x34')]);_0x5a7fb6['filters']=_[_0x6791('0x36')](_0x5a7fb6[_0x6791('0x33')],_0x5a7fb6['query']);_0x3251e9[_0x6791('0x37')]=_['intersection'](_0x5a7fb6[_0x6791('0x33')],qs[_0x6791('0x38')](_0x4f0e2d[_0x6791('0x34')][_0x6791('0x38')]));_0x3251e9[_0x6791('0x37')]=_0x3251e9[_0x6791('0x37')][_0x6791('0x48')]?_0x3251e9[_0x6791('0x37')]:_0x5a7fb6[_0x6791('0x33')];if(_0x4f0e2d['query'][_0x6791('0x42')]){_0x3251e9['include']=[{'all':!![]}];}_0x3251e9=_[_0x6791('0x3f')]({},_0x3251e9,_0x4f0e2d[_0x6791('0x41')]);return db[_0x6791('0x2f')][_0x6791('0x49')](_0x3251e9)[_0x6791('0x25')](handleEntityNotFound(_0xeb9d45,null))['then'](respondWithResult(_0xeb9d45,null))[_0x6791('0x4a')](handleError(_0xeb9d45,null));};exports[_0x6791('0x26')]=function(_0x235b56,_0x3d22f3){return db[_0x6791('0x2f')]['find']({'where':{'id':_0x235b56[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x3d22f3,null))['then'](removeEntity(_0x3d22f3,null))[_0x6791('0x4a')](handleError(_0x3d22f3,null));};exports['describe']=function(_0x3d4b7e,_0x22a4d3){return db[_0x6791('0x2f')][_0x6791('0x4b')]()['then'](respondWithResult(_0x22a4d3,null))[_0x6791('0x4a')](handleError(_0x22a4d3,null));};exports[_0x6791('0x4c')]=function(_0x5655c8,_0x189b22){var _0x4370ab;return db[_0x6791('0x4d')]['transaction'](function(_0x355e97){return db[_0x6791('0x2f')]['create'](_0x5655c8[_0x6791('0x4e')],{'transaction':_0x355e97})[_0x6791('0x25')](function(_0x49d583){_0x4370ab=_0x49d583[_0x6791('0x27')]({'plain':!![]});return db[_0x6791('0x4f')][_0x6791('0x49')]({'where':{'id':_0x4370ab[_0x6791('0x50')]},'raw':!![]})['then'](function(_0x3c1076){return createVoicePrefixExtensions(_0x4370ab,_0x3c1076,_0x355e97);});});})[_0x6791('0x25')](function(){var _0x32f36b=_0x5655c8['user']['get']({'plain':!![]});if(!_0x32f36b)throw new Error(_0x6791('0x51'));if(_0x32f36b[_0x6791('0x52')]===_0x6791('0x53')){var _0x45756f=_0x4370ab;return db[_0x6791('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x32f36b[_0x6791('0x55')]},'raw':!![]})['then'](function(_0x51f071){if(_0x51f071&&_0x51f071[_0x6791('0x56')]===0x0){return db[_0x6791('0x28')][_0x6791('0x4c')]({'name':_0x45756f[_0x6791('0x2b')],'resourceId':_0x45756f['id'],'type':_0x51f071[_0x6791('0x2b')],'sectionId':_0x51f071['id']},{})[_0x6791('0x25')](function(){return _0x4370ab;});}else{return _0x4370ab;}})['catch'](function(_0x5a30f3){logger[_0x6791('0x2a')](_0x6791('0x57'),_0x5a30f3);throw _0x5a30f3;});}return _0x4370ab;})['then'](respondWithResult(_0x189b22,null))[_0x6791('0x4a')](handleError(_0x189b22,null));};function Extension(_0x535ecf,_0x473443,_0x15fb6c,_0x50cf85){this[_0x6791('0x58')]=_0x6791('0x59');this[_0x6791('0x5a')]=_0x535ecf;this['app']=_0x15fb6c;this[_0x6791('0x31')]=_0x6791('0x5b');this[_0x6791('0x5c')]=_0x6791('0x5d');this[_0x6791('0x5e')]=_0x473443;this['appdata']=_0x50cf85;}function createVoicePrefixExtensions(_0x54d0ba,_0x1a9acd,_0x13430e){return new BPromise(function(_0x5d2668,_0x329fc0){var _0x466a64=new Extension(formatPrefixName(_0x54d0ba[_0x6791('0x5f')]),0x1,_0x6791('0x60'),_0x6791('0x61'));_0x466a64[_0x6791('0x62')]=_0x54d0ba['id'];return db[_0x6791('0x4f')][_0x6791('0x4c')](_0x466a64,{'transaction':_0x13430e})['then'](function(_0x2c5f12){var _0x3b46bf=_0x2c5f12[_0x6791('0x27')]({'plain':!![]});var _0x1a9a2e=_['map'](addVoicePrefixExtensions(_0x54d0ba,_0x1a9acd),function(_0x16dff7){_0x16dff7[_0x6791('0x50')]=_0x3b46bf['id'];_0x16dff7[_0x6791('0x62')]=_0x54d0ba['id'];return _0x16dff7;});return db['VoiceExtension'][_0x6791('0x63')](_0x1a9a2e,{'transaction':_0x13430e})[_0x6791('0x25')](function(_0x99d4ee){if(!_0x99d4ee){return _0x329fc0(_0x6791('0x64'));}else{return _0x5d2668(_0x99d4ee);}})['catch'](function(_0x2c834f){return _0x329fc0(_0x2c834f);});});;});};function addVoicePrefixExtensions(_0x2843fb,_0x5522db){var _0x1114d4=[];var _0x901cc1=formatPrefixName(_0x2843fb[_0x6791('0x5f')]);_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x2,_0x6791('0x66'),_0x6791('0x67')+_0x2843fb['name']));if(_0x2843fb[_0x6791('0x68')]){_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x3,_0x6791('0x66'),'PREFIX-CALLERIDALL='+_0x2843fb[_0x6791('0x68')]));}else{_0x1114d4['push'](new Extension(_0x901cc1,0x3,_0x6791('0x60'),_0x6791('0x69')));}_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x4,_0x6791('0x6a'),_0x5522db[_0x6791('0x58')]+','+'${EXTEN:'+(0x8+_0x2843fb[_0x6791('0x2b')][_0x6791('0x48')])+'}'+','+0x1));return _0x1114d4;}function formatPrefixName(_0x375062){var _0x2accfa='_';for(var _0x5f158f=0x0;_0x5f158f<_0x375062[_0x6791('0x48')];_0x5f158f++){if(_0x375062[_0x6791('0x6b')](_0x5f158f)=='-'){_0x2accfa+=_0x375062['charAt'](_0x5f158f);}else{_0x2accfa+='['+_0x375062[_0x6791('0x6b')](_0x5f158f)+']';}}_0x2accfa+='.';return _0x2accfa;}exports[_0x6791('0x6c')]=function(_0x567302,_0x201465,_0x23b9b4){var _0x113d9f=_0x567302[_0x6791('0x4e')];_0x113d9f['prefix']=_0x6791('0x6d')+_0x113d9f[_0x6791('0x2b')]+'-';return db['sequelize'][_0x6791('0x6e')](function(_0x26c2aa){return db[_0x6791('0x2f')][_0x6791('0x6c')](_0x113d9f,{'where':{'id':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x26')]({'where':{'VoicePrefixId':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x49')]({'where':{'id':_0x113d9f[_0x6791('0x50')]},'raw':!![]})[_0x6791('0x25')](function(_0x4bbf2d){return createVoicePrefixExtensions(_0x113d9f,_0x4bbf2d,_0x26c2aa);});});});})[_0x6791('0x25')](function(){return db[_0x6791('0x2f')][_0x6791('0x6f')](_0x113d9f['id']);})[_0x6791('0x25')](respondWithResult(_0x201465,null))[_0x6791('0x4a')](handleError(_0x201465,null));};exports[_0x6791('0x70')]=function(_0x367dc9,_0x30b3e6,_0x4cca28){return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x367dc9['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x30b3e6,null))[_0x6791('0x25')](function(_0x410a66){if(_0x410a66){return _0x410a66['addAgents'](_0x367dc9[_0x6791('0x4e')]['ids'],_[_0x6791('0x71')](_0x367dc9[_0x6791('0x4e')],[_0x6791('0x72'),'id'])||{})[_0x6791('0x73')](function(_0x3a964a){for(var _0x2d15b5=0x0;_0x2d15b5<_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x6791('0x48')];_0x2d15b5+=0x1){socket[_0x6791('0x74')](_0x6791('0x75'),{'UserId':Number(_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x2d15b5]),'VoicePrefixId':Number(_0x367dc9[_0x6791('0x45')]['id'])});}return _0x3a964a;});}})[_0x6791('0x25')](respondWithResult(_0x30b3e6,null))[_0x6791('0x4a')](handleError(_0x30b3e6,null));};exports[_0x6791('0x76')]=function(_0x386bc7,_0xc6c959,_0x5cf7d7){return db['VoicePrefix']['find']({'where':{'id':_0x386bc7[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0xc6c959,null))[_0x6791('0x25')](function(_0x194a0b){if(_0x194a0b){return _0x194a0b[_0x6791('0x76')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])[_0x6791('0x25')](function(){if(_[_0x6791('0x77')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])){for(var _0x37ae6b=0x0;_0x37ae6b<_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x6791('0x48')];_0x37ae6b+=0x1){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x37ae6b]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}}else{socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6c959,null))[_0x6791('0x4a')](handleError(_0xc6c959,null));};exports['getAgents']=function(_0x8d9556,_0x11eb22,_0x4b262c){var _0x1c2864={};var _0x503041={};var _0x27e3bd;var _0x26e77c;return db['VoicePrefix'][_0x6791('0x79')]({'where':{'id':_0x8d9556[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x11eb22,null))['then'](function(_0x41fcf4){if(_0x41fcf4){_0x27e3bd=_0x41fcf4;_0x503041[_0x6791('0x33')]=_[_0x6791('0x46')](db[_0x6791('0x7a')][_0x6791('0x47')]);_0x503041[_0x6791('0x34')]=_['keys'](_0x8d9556[_0x6791('0x34')]);_0x503041[_0x6791('0x35')]=_[_0x6791('0x36')](_0x503041[_0x6791('0x33')],_0x503041[_0x6791('0x34')]);_0x1c2864[_0x6791('0x37')]=_[_0x6791('0x36')](_0x503041['model'],qs[_0x6791('0x38')](_0x8d9556['query'][_0x6791('0x38')]));_0x1c2864['attributes']=_0x1c2864[_0x6791('0x37')][_0x6791('0x48')]?_0x1c2864[_0x6791('0x37')]:_0x503041[_0x6791('0x33')];_0x1c2864[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x8d9556['query'][_0x6791('0x3c')]);_0x1c2864['where']=qs[_0x6791('0x35')](_['pick'](_0x8d9556['query'],_0x503041['filters']));if(_0x8d9556[_0x6791('0x34')][_0x6791('0x3e')]){_0x1c2864['where']=_[_0x6791('0x3f')](_0x1c2864['where'],{'$or':_[_0x6791('0x2e')](_0x1c2864[_0x6791('0x37')],function(_0x4f52c2){var _0x494435={};_0x494435[_0x4f52c2]={'$like':'%'+_0x8d9556['query'][_0x6791('0x3e')]+'%'};return _0x494435;})});}_0x1c2864=_[_0x6791('0x3f')]({},_0x1c2864,_0x8d9556[_0x6791('0x41')]);return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x20ded4){if(_0x20ded4){_0x26e77c=_0x20ded4[_0x6791('0x48')];if(!_0x8d9556[_0x6791('0x34')][_0x6791('0x39')]('nolimit')){_0x1c2864[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x8d9556[_0x6791('0x34')][_0x6791('0x1f')]);_0x1c2864[_0x6791('0x21')]=qs['offset'](_0x8d9556[_0x6791('0x34')][_0x6791('0x21')]);}return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x46aea7){if(_0x46aea7){return _0x46aea7?{'count':_0x26e77c,'rows':_0x46aea7}:null;}})[_0x6791('0x25')](respondWithResult(_0x11eb22,null))[_0x6791('0x4a')](handleError(_0x11eb22,null));};exports['getTeams']=function(_0x29e2a0,_0x1092d4,_0x370da4){var _0xdf1dd4={};var _0xa5eb83={};var _0x145814;var _0x5dcaab;return db[_0x6791('0x2f')]['findOne']({'where':{'id':_0x29e2a0['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x1092d4,null))[_0x6791('0x25')](function(_0x313d5d){if(_0x313d5d){_0x145814=_0x313d5d;_0xa5eb83['model']=_[_0x6791('0x46')](db['Team'][_0x6791('0x47')]);_0xa5eb83[_0x6791('0x34')]=_['keys'](_0x29e2a0[_0x6791('0x34')]);_0xa5eb83[_0x6791('0x35')]=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],_0xa5eb83[_0x6791('0x34')]);_0xdf1dd4['attributes']=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],qs[_0x6791('0x38')](_0x29e2a0['query']['fields']));_0xdf1dd4[_0x6791('0x37')]=_0xdf1dd4[_0x6791('0x37')]['length']?_0xdf1dd4[_0x6791('0x37')]:_0xa5eb83[_0x6791('0x33')];_0xdf1dd4[_0x6791('0x3b')]=qs['sort'](_0x29e2a0[_0x6791('0x34')]['sort']);_0xdf1dd4['where']=qs[_0x6791('0x35')](_['pick'](_0x29e2a0[_0x6791('0x34')],_0xa5eb83[_0x6791('0x35')]));if(_0x29e2a0[_0x6791('0x34')][_0x6791('0x3e')]){_0xdf1dd4[_0x6791('0x3d')]=_[_0x6791('0x3f')](_0xdf1dd4['where'],{'$or':_[_0x6791('0x2e')](_0xdf1dd4['attributes'],function(_0x221fad){var _0x4d6641={};_0x4d6641[_0x221fad]={'$like':'%'+_0x29e2a0['query'][_0x6791('0x3e')]+'%'};return _0x4d6641;})});}_0xdf1dd4=_[_0x6791('0x3f')]({},_0xdf1dd4,_0x29e2a0[_0x6791('0x41')]);return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})[_0x6791('0x25')](function(_0x11089f){if(_0x11089f){_0x5dcaab=_0x11089f[_0x6791('0x48')];if(!_0x29e2a0[_0x6791('0x34')][_0x6791('0x39')](_0x6791('0x3a'))){_0xdf1dd4[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x1f')]);_0xdf1dd4[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x21')]);}return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})['then'](function(_0xfef30e){if(_0xfef30e){return _0xfef30e?{'count':_0x5dcaab,'rows':_0xfef30e}:null;}})[_0x6791('0x25')](respondWithResult(_0x1092d4,null))[_0x6791('0x4a')](handleError(_0x1092d4,null));};exports['addTeams']=function(_0x4c6eb1,_0x4bce1d,_0x42d7fb){var _0x257efa=_0x4c6eb1['body'][_0x6791('0x72')];var _0x17c93e;return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x257efa},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id',_0x6791('0x2b'),_0x6791('0x7f'),'voicePause',_0x6791('0x80')],'raw':!![]}]})['then'](function(_0xd61243){if(_0xd61243){_0x17c93e=_0xd61243;var _0x123627=_[_0x6791('0x81')](_0xd61243,function(_0x5d5963){var _0x4d36de=_0x5d5963['get']({'plain':!![]});return _0x4d36de[_0x6791('0x7e')];});return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4c6eb1[_0x6791('0x45')]['id']}})['then'](function(_0x3b487a){return db[_0x6791('0x4d')][_0x6791('0x6e')](function(_0x3b0d8f){return _0x3b487a['addTeams'](_0x257efa,{'transaction':_0x3b0d8f})['then'](function(){return BPromise['each'](_0x17c93e,function(_0x3a7711){return db['TeamVoicePrefix'][_0x6791('0x82')]({'TeamId':_0x3a7711['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},{'transaction':_0x3b0d8f});});})[_0x6791('0x25')](function(){return BPromise[_0x6791('0x83')](_0x123627,function(_0x15a95b){return db[_0x6791('0x84')][_0x6791('0x85')]({'where':{'UserId':_0x15a95b['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},'transaction':_0x3b0d8f});});})['then'](function(){_0x123627[_0x6791('0x86')](function(_0x300c8b){socket['emit'](_0x6791('0x75'),{'UserId':_0x300c8b['id'],'VoicePrefixId':_0x3b487a['id']});});});});});}})[_0x6791('0x25')](respondWithStatusCode(_0x4bce1d,null))[_0x6791('0x4a')](handleError(_0x4bce1d,null));};exports[_0x6791('0x87')]=function(_0x4f88e4,_0x447ea6,_0x31a2c8){return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x6791('0x25')](handleEntityNotFound(_0x447ea6,null))['then'](function(_0x150a13){var _0x211721=_[_0x6791('0x2e')](_0x150a13,'id');var _0xb7986d=[];var _0x19cb72=[];var _0x5aad37=squel['select']();_0x5aad37[_0x6791('0x88')](_0x6791('0x89'))['from'](_0x6791('0x8a'),'tq')[_0x6791('0x8b')](_0x6791('0x8c'),'ut',_0x6791('0x8d'))[_0x6791('0x3d')](_0x6791('0x8e'),_0x4f88e4[_0x6791('0x45')]['id']);for(var _0x21a12c=0x0;_0x21a12c<_0x150a13[_0x6791('0x48')];_0x21a12c+=0x1){let _0x54a34f=_0x150a13[_0x21a12c];for(var _0x405e1c=0x0;_0x405e1c<_0x54a34f[_0x6791('0x7e')]['length'];_0x405e1c+=0x1){let _0x303ba8=_0x54a34f['Agents'][_0x405e1c];var _0x23bed3=_0x5aad37[_0x6791('0x8f')]();_0x23bed3[_0x6791('0x3d')](_0x6791('0x90'),_0x303ba8['id']);_0x19cb72[_0x6791('0x65')](db[_0x6791('0x4d')][_0x6791('0x34')](_0x23bed3[_0x6791('0x91')](),{'type':db[_0x6791('0x4d')][_0x6791('0x92')][_0x6791('0x93')]})[_0x6791('0x25')](function(_0x1f06d8){if(_0x1f06d8[_0x6791('0x48')]===0x1){return _0x303ba8['id'];}else{var _0x46d6ff=_[_0x6791('0x94')](_[_0x6791('0x2e')](_0x1f06d8,_0x6791('0x95')),function(_0x462e03){return _['includes'](_0x211721,_0x462e03);});if(_0x46d6ff){return _0x303ba8['id'];}}}));}}return BPromise[_0x6791('0x96')](_0x19cb72)['then'](function(_0x41385c){_0xb7986d=_(_0xb7986d)[_0x6791('0x97')](_0x41385c)[_0x6791('0x98')]()[_0x6791('0x99')]();return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4f88e4[_0x6791('0x45')]['id']}})[_0x6791('0x25')](function(_0x546bf7){return db[_0x6791('0x4d')]['transaction'](function(_0x54cf28){return _0x546bf7[_0x6791('0x87')](_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')],{'transaction':_0x54cf28})[_0x6791('0x25')](function(){if(!_[_0x6791('0x9a')](_0xb7986d)){return _0x546bf7[_0x6791('0x76')](_0xb7986d,{'transaction':_0x54cf28});}})[_0x6791('0x25')](function(){_0xb7986d['forEach'](function(_0x3b7b0f){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':_0x3b7b0f,'VoicePrefixId':_0x546bf7['id']});});});});});});})[_0x6791('0x25')](respondWithStatusCode(_0x447ea6,null))[_0x6791('0x4a')](handleError(_0x447ea6,null));}; \ No newline at end of file +var _0x93e9=['VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','${EXTEN:','length','charAt','body','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','options','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','catch','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','appdata','prefix','NoOp'];(function(_0x3b58c3,_0x586ef2){var _0x468424=function(_0x2cbfaf){while(--_0x2cbfaf){_0x3b58c3['push'](_0x3b58c3['shift']());}};_0x468424(++_0x586ef2);}(_0x93e9,0xcc));var _0x993e=function(_0x12239a,_0x508ba7){_0x12239a=_0x12239a-0x0;var _0x54b6e9=_0x93e9[_0x12239a];return _0x54b6e9;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);function respondWithStatusCode(_0x34ddda,_0x20f32a){_0x20f32a=_0x20f32a||0xcc;return function(_0x2a184b){if(_0x2a184b){return _0x34ddda[_0x993e('0x1e')](_0x20f32a);}return _0x34ddda[_0x993e('0x1f')](_0x20f32a)[_0x993e('0x20')]();};}function respondWithResult(_0x3df0e7,_0x125322){_0x125322=_0x125322||0xc8;return function(_0x1f267f){if(_0x1f267f){return _0x3df0e7[_0x993e('0x1f')](_0x125322)[_0x993e('0x21')](_0x1f267f);}};}function respondWithFilteredResult(_0x526e06,_0x22f7cc){return function(_0x1acd21){if(_0x1acd21){var _0x3cc2b9=typeof _0x22f7cc[_0x993e('0x22')]===_0x993e('0x23')&&typeof _0x22f7cc[_0x993e('0x24')]==='undefined';var _0x11cd41=_0x1acd21[_0x993e('0x25')];var _0x1eaf57=_0x3cc2b9?0x0:_0x22f7cc[_0x993e('0x22')];var _0x130a8a=_0x3cc2b9?_0x1acd21[_0x993e('0x25')]:_0x22f7cc[_0x993e('0x22')]+_0x22f7cc[_0x993e('0x24')];var _0x4bbe9c;if(_0x130a8a>=_0x11cd41){_0x130a8a=_0x11cd41;_0x4bbe9c=0xc8;}else{_0x4bbe9c=0xce;}_0x526e06[_0x993e('0x1f')](_0x4bbe9c);return _0x526e06['set'](_0x993e('0x26'),_0x1eaf57+'-'+_0x130a8a+'/'+_0x11cd41)[_0x993e('0x21')](_0x1acd21);}return null;};}function patchUpdates(_0x32b09e){return function(_0x5ba2a1){try{jsonpatch[_0x993e('0x27')](_0x5ba2a1,_0x32b09e,!![]);}catch(_0x13db4e){return BPromise[_0x993e('0x28')](_0x13db4e);}return _0x5ba2a1[_0x993e('0x29')]();};}function saveUpdates(_0x3b45ef,_0x328d22){return function(_0xa1c83e){if(_0xa1c83e){return _0xa1c83e[_0x993e('0x2a')](_0x3b45ef)[_0x993e('0x2b')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){return _0x4fe471[_0x993e('0x2c')]()[_0x993e('0x2b')](function(){var _0x52b727=_0x4fe471[_0x993e('0x2d')]({'plain':!![]});var _0x4f5cc1=_0x993e('0x2e');return db[_0x993e('0x2f')][_0x993e('0x2c')]({'where':{'type':_0x4f5cc1,'resourceId':_0x52b727['id']}})[_0x993e('0x2b')](function(){return _0x4fe471;});})['then'](function(){_0x3fe099['status'](0xcc)[_0x993e('0x20')]();});}};}function handleEntityNotFound(_0x466d63,_0x4a4f00){return function(_0x223af0){if(!_0x223af0){_0x466d63[_0x993e('0x1e')](0x194);}return _0x223af0;};}function handleError(_0x248354,_0x4c5ee3){_0x4c5ee3=_0x4c5ee3||0x1f4;return function(_0x2495b7){logger[_0x993e('0x30')](_0x2495b7[_0x993e('0x31')]);if(_0x2495b7[_0x993e('0x32')]){delete _0x2495b7[_0x993e('0x32')];}_0x248354['status'](_0x4c5ee3)[_0x993e('0x33')](_0x2495b7);};}exports['index']=function(_0x782298,_0x5ba163){var _0x1da357={},_0x567ed4={},_0x3b9c3c={'count':0x0,'rows':[]};var _0x2ce5d5=_[_0x993e('0x34')](db[_0x993e('0x35')][_0x993e('0x36')],function(_0x360e2d){return{'name':_0x360e2d['fieldName'],'type':_0x360e2d[_0x993e('0x37')]['key']};});_0x567ed4['model']=_[_0x993e('0x34')](_0x2ce5d5,'name');_0x567ed4[_0x993e('0x38')]=_[_0x993e('0x39')](_0x782298[_0x993e('0x38')]);_0x567ed4[_0x993e('0x3a')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],_0x567ed4[_0x993e('0x38')]);_0x1da357[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x782298[_0x993e('0x38')][_0x993e('0x3e')]));_0x1da357[_0x993e('0x3d')]=_0x1da357[_0x993e('0x3d')]['length']?_0x1da357[_0x993e('0x3d')]:_0x567ed4[_0x993e('0x3c')];if(!_0x782298[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1da357[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x782298[_0x993e('0x38')][_0x993e('0x24')]);_0x1da357['offset']=qs[_0x993e('0x22')](_0x782298['query'][_0x993e('0x22')]);}_0x1da357[_0x993e('0x41')]=qs[_0x993e('0x42')](_0x782298[_0x993e('0x38')][_0x993e('0x42')]);_0x1da357[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x782298['query'],_0x567ed4[_0x993e('0x3a')]),_0x2ce5d5);if(_0x782298['query'][_0x993e('0x45')]){_0x1da357['where']=_[_0x993e('0x46')](_0x1da357[_0x993e('0x43')],{'$or':_[_0x993e('0x34')](_0x2ce5d5,function(_0x1f1327){if(_0x1f1327[_0x993e('0x37')]!==_0x993e('0x47')){var _0xb728cf={};_0xb728cf[_0x1f1327[_0x993e('0x32')]]={'$like':'%'+_0x782298['query'][_0x993e('0x45')]+'%'};return _0xb728cf;}})});}_0x1da357=_['merge']({},_0x1da357,_0x782298['options']);var _0x1a2712={'where':_0x1da357[_0x993e('0x43')]};return db[_0x993e('0x35')]['count'](_0x1a2712)[_0x993e('0x2b')](function(_0x40719d){_0x3b9c3c[_0x993e('0x25')]=_0x40719d;if(_0x782298['query']['includeAll']){_0x1da357['include']=[{'all':!![]}];}return db[_0x993e('0x35')][_0x993e('0x48')](_0x1da357);})[_0x993e('0x2b')](function(_0x539c9d){_0x3b9c3c[_0x993e('0x49')]=_0x539c9d;return _0x3b9c3c;})[_0x993e('0x2b')](respondWithFilteredResult(_0x5ba163,_0x1da357))['catch'](handleError(_0x5ba163,null));};exports[_0x993e('0x4a')]=function(_0x5f7563,_0x5074a6){var _0x258795={'raw':![],'where':{'id':_0x5f7563[_0x993e('0x4b')]['id']}},_0x576ea={};_0x576ea['model']=_['keys'](db['VoicePrefix'][_0x993e('0x36')]);_0x576ea[_0x993e('0x38')]=_[_0x993e('0x39')](_0x5f7563[_0x993e('0x38')]);_0x576ea['filters']=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],_0x576ea[_0x993e('0x38')]);_0x258795[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],qs['fields'](_0x5f7563['query'][_0x993e('0x3e')]));_0x258795[_0x993e('0x3d')]=_0x258795['attributes']['length']?_0x258795[_0x993e('0x3d')]:_0x576ea[_0x993e('0x3c')];if(_0x5f7563[_0x993e('0x38')][_0x993e('0x4c')]){_0x258795[_0x993e('0x4d')]=[{'all':!![]}];}_0x258795=_[_0x993e('0x46')]({},_0x258795,_0x5f7563['options']);return db[_0x993e('0x35')]['find'](_0x258795)[_0x993e('0x2b')](handleEntityNotFound(_0x5074a6,null))[_0x993e('0x2b')](respondWithResult(_0x5074a6,null))[_0x993e('0x4e')](handleError(_0x5074a6,null));};exports[_0x993e('0x2c')]=function(_0x2cba37,_0x276b99){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x2cba37['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x276b99,null))[_0x993e('0x2b')](removeEntity(_0x276b99,null))[_0x993e('0x4e')](handleError(_0x276b99,null));};exports['describe']=function(_0x355912,_0x53c1e9){return db[_0x993e('0x35')][_0x993e('0x50')]()['then'](respondWithResult(_0x53c1e9,null))[_0x993e('0x4e')](handleError(_0x53c1e9,null));};exports[_0x993e('0x51')]=function(_0x579c43,_0x3809ef){var _0x207e27;return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x2e368e){return db['VoicePrefix']['create'](_0x579c43['body'],{'transaction':_0x2e368e})[_0x993e('0x2b')](function(_0x29f8a5){_0x207e27=_0x29f8a5[_0x993e('0x2d')]({'plain':!![]});return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x207e27[_0x993e('0x55')]},'raw':!![]})['then'](function(_0x3a897d){return createVoicePrefixExtensions(_0x207e27,_0x3a897d,_0x2e368e);});});})[_0x993e('0x2b')](function(){var _0x15c8ed=_0x579c43['user'][_0x993e('0x2d')]({'plain':!![]});if(!_0x15c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c8ed['role']===_0x993e('0x56')){var _0x37d7b1=_0x207e27;return db['UserProfileSection'][_0x993e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x15c8ed[_0x993e('0x57')]},'raw':!![]})[_0x993e('0x2b')](function(_0x4a0dbd){if(_0x4a0dbd&&_0x4a0dbd['autoAssociation']===0x0){return db[_0x993e('0x2f')][_0x993e('0x51')]({'name':_0x37d7b1[_0x993e('0x32')],'resourceId':_0x37d7b1['id'],'type':_0x4a0dbd[_0x993e('0x32')],'sectionId':_0x4a0dbd['id']},{})[_0x993e('0x2b')](function(){return _0x207e27;});}else{return _0x207e27;}})[_0x993e('0x4e')](function(_0x4f9225){logger[_0x993e('0x30')](_0x993e('0x58'),_0x4f9225);throw _0x4f9225;});}return _0x207e27;})['then'](respondWithResult(_0x3809ef,null))[_0x993e('0x4e')](handleError(_0x3809ef,null));};function Extension(_0x473e00,_0x1b2113,_0x5ebaec,_0x426341){this[_0x993e('0x59')]=_0x993e('0x5a');this['exten']=_0x473e00;this[_0x993e('0x5b')]=_0x5ebaec;this[_0x993e('0x37')]=_0x993e('0x5c');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x1b2113;this[_0x993e('0x5d')]=_0x426341;}function createVoicePrefixExtensions(_0x98d16c,_0x3a3d29,_0x411484){return new BPromise(function(_0xc62106,_0x55a347){var _0x18367f=new Extension(formatPrefixName(_0x98d16c[_0x993e('0x5e')]),0x1,_0x993e('0x5f'),'Voice\x20Prefix');_0x18367f[_0x993e('0x60')]=_0x98d16c['id'];return db[_0x993e('0x54')][_0x993e('0x51')](_0x18367f,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x5e4ab1){var _0x54417b=_0x5e4ab1[_0x993e('0x2d')]({'plain':!![]});var _0x51cec9=_['map'](addVoicePrefixExtensions(_0x98d16c,_0x3a3d29),function(_0x17c7f7){_0x17c7f7[_0x993e('0x55')]=_0x54417b['id'];_0x17c7f7[_0x993e('0x60')]=_0x98d16c['id'];return _0x17c7f7;});return db[_0x993e('0x54')][_0x993e('0x61')](_0x51cec9,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x211204){if(!_0x211204){return _0x55a347(_0x993e('0x62'));}else{return _0xc62106(_0x211204);}})[_0x993e('0x4e')](function(_0x113395){return _0x55a347(_0x113395);});});;});};function addVoicePrefixExtensions(_0x300a93,_0x44def2){var _0x2ddc16=[];var _0x609430=formatPrefixName(_0x300a93[_0x993e('0x5e')]);_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x2,'Set',_0x993e('0x64')+_0x300a93[_0x993e('0x32')]));if(_0x300a93['callerIdAll']){_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'Set',_0x993e('0x65')+_0x300a93[_0x993e('0x66')]));}else{_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'NoOp',_0x993e('0x67')));}_0x2ddc16['push'](new Extension(_0x609430,0x4,'goto',_0x44def2[_0x993e('0x59')]+','+_0x993e('0x68')+(0x8+_0x300a93[_0x993e('0x32')][_0x993e('0x69')])+'}'+','+0x1));return _0x2ddc16;}function formatPrefixName(_0x2a243a){var _0x5194de='_';for(var _0x120d51=0x0;_0x120d51<_0x2a243a[_0x993e('0x69')];_0x120d51++){if(_0x2a243a[_0x993e('0x6a')](_0x120d51)=='-'){_0x5194de+=_0x2a243a['charAt'](_0x120d51);}else{_0x5194de+='['+_0x2a243a[_0x993e('0x6a')](_0x120d51)+']';}}_0x5194de+='.';return _0x5194de;}exports['update']=function(_0x1ab10e,_0x6ef96,_0x42288d){var _0x5afba1=_0x1ab10e[_0x993e('0x6b')];_0x5afba1[_0x993e('0x5e')]=_0x993e('0x6c')+_0x5afba1[_0x993e('0x32')]+'-';return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x108cad){return db[_0x993e('0x35')][_0x993e('0x2a')](_0x5afba1,{'where':{'id':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db['VoiceExtension'][_0x993e('0x2c')]({'where':{'VoicePrefixId':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x5afba1[_0x993e('0x55')]},'raw':!![]})[_0x993e('0x2b')](function(_0x282c53){return createVoicePrefixExtensions(_0x5afba1,_0x282c53,_0x108cad);});});});})[_0x993e('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5afba1['id']);})[_0x993e('0x2b')](respondWithResult(_0x6ef96,null))['catch'](handleError(_0x6ef96,null));};exports[_0x993e('0x6d')]=function(_0x444da6,_0x2ce913,_0x49788e){return db[_0x993e('0x35')]['find']({'where':{'id':_0x444da6[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x2ce913,null))[_0x993e('0x2b')](function(_0x40768a){if(_0x40768a){return _0x40768a[_0x993e('0x6d')](_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')],_[_0x993e('0x6f')](_0x444da6['body'],['ids','id'])||{})[_0x993e('0x70')](function(_0x5a70ff){for(var _0x2fb182=0x0;_0x2fb182<_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x993e('0x69')];_0x2fb182+=0x1){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':Number(_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x2fb182]),'VoicePrefixId':Number(_0x444da6[_0x993e('0x4b')]['id'])});}return _0x5a70ff;});}})[_0x993e('0x2b')](respondWithResult(_0x2ce913,null))['catch'](handleError(_0x2ce913,null));};exports[_0x993e('0x73')]=function(_0x14347f,_0x4a0002,_0x4742d9){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x14347f[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x4a0002,null))[_0x993e('0x2b')](function(_0x4157b6){if(_0x4157b6){return _0x4157b6[_0x993e('0x73')](_0x14347f[_0x993e('0x38')]['ids'])[_0x993e('0x2b')](function(){if(_[_0x993e('0x74')](_0x14347f[_0x993e('0x38')][_0x993e('0x6e')])){for(var _0x53ce16=0x0;_0x53ce16<_0x14347f['query'][_0x993e('0x6e')]['length'];_0x53ce16+=0x1){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')][_0x53ce16]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}}else{socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a0002,null))[_0x993e('0x4e')](handleError(_0x4a0002,null));};exports[_0x993e('0x76')]=function(_0x3abd3a,_0x278c2a,_0x3f6347){var _0x1a3967={};var _0x1079e7={};var _0x5c634a;var _0x47c3b6;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x3abd3a[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x278c2a,null))[_0x993e('0x2b')](function(_0x53b0c8){if(_0x53b0c8){_0x5c634a=_0x53b0c8;_0x1079e7['model']=_['keys'](db[_0x993e('0x78')][_0x993e('0x36')]);_0x1079e7[_0x993e('0x38')]=_[_0x993e('0x39')](_0x3abd3a[_0x993e('0x38')]);_0x1079e7['filters']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],_0x1079e7[_0x993e('0x38')]);_0x1a3967['attributes']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x3e')]));_0x1a3967[_0x993e('0x3d')]=_0x1a3967['attributes'][_0x993e('0x69')]?_0x1a3967['attributes']:_0x1079e7['model'];_0x1a3967['order']=qs['sort'](_0x3abd3a[_0x993e('0x38')][_0x993e('0x42')]);_0x1a3967[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x3abd3a[_0x993e('0x38')],_0x1079e7[_0x993e('0x3a')]));if(_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]){_0x1a3967['where']=_[_0x993e('0x46')](_0x1a3967['where'],{'$or':_[_0x993e('0x34')](_0x1a3967[_0x993e('0x3d')],function(_0x3e7793){var _0x65c6f0={};_0x65c6f0[_0x3e7793]={'$like':'%'+_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x65c6f0;})});}_0x1a3967=_[_0x993e('0x46')]({},_0x1a3967,_0x3abd3a['options']);return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})[_0x993e('0x2b')](function(_0x285c93){if(_0x285c93){_0x47c3b6=_0x285c93['length'];if(!_0x3abd3a[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1a3967['limit']=qs[_0x993e('0x24')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x24')]);_0x1a3967[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x22')]);}return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})['then'](function(_0x412d21){if(_0x412d21){return _0x412d21?{'count':_0x47c3b6,'rows':_0x412d21}:null;}})['then'](respondWithResult(_0x278c2a,null))[_0x993e('0x4e')](handleError(_0x278c2a,null));};exports[_0x993e('0x79')]=function(_0x4d6d94,_0x505f28,_0x4e2ccf){var _0x4506cb={};var _0x31e947={};var _0x7800d4;var _0x4e1fcf;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x4d6d94[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x505f28,null))['then'](function(_0xc35545){if(_0xc35545){_0x7800d4=_0xc35545;_0x31e947['model']=_[_0x993e('0x39')](db['Team']['rawAttributes']);_0x31e947[_0x993e('0x38')]=_[_0x993e('0x39')](_0x4d6d94[_0x993e('0x38')]);_0x31e947[_0x993e('0x3a')]=_['intersection'](_0x31e947['model'],_0x31e947['query']);_0x4506cb[_0x993e('0x3d')]=_['intersection'](_0x31e947[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x3e')]));_0x4506cb[_0x993e('0x3d')]=_0x4506cb['attributes'][_0x993e('0x69')]?_0x4506cb[_0x993e('0x3d')]:_0x31e947['model'];_0x4506cb[_0x993e('0x41')]=qs['sort'](_0x4d6d94[_0x993e('0x38')][_0x993e('0x42')]);_0x4506cb[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x4d6d94[_0x993e('0x38')],_0x31e947[_0x993e('0x3a')]));if(_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]){_0x4506cb['where']=_[_0x993e('0x46')](_0x4506cb['where'],{'$or':_[_0x993e('0x34')](_0x4506cb[_0x993e('0x3d')],function(_0x50dd66){var _0x48acd5={};_0x48acd5[_0x50dd66]={'$like':'%'+_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x48acd5;})});}_0x4506cb=_['merge']({},_0x4506cb,_0x4d6d94[_0x993e('0x7a')]);return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0xc56e5a){if(_0xc56e5a){_0x4e1fcf=_0xc56e5a['length'];if(!_0x4d6d94[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x4506cb[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x4d6d94['query'][_0x993e('0x24')]);_0x4506cb[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x22')]);}return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0x5d2b00){if(_0x5d2b00){return _0x5d2b00?{'count':_0x4e1fcf,'rows':_0x5d2b00}:null;}})[_0x993e('0x2b')](respondWithResult(_0x505f28,null))['catch'](handleError(_0x505f28,null));};exports[_0x993e('0x7b')]=function(_0x8dc65,_0x4a5755,_0x43b5c5){var _0x4d53d1=_0x8dc65['body'][_0x993e('0x6e')];var _0x371be2;return db['Team'][_0x993e('0x48')]({'where':{'id':_0x4d53d1},'attributes':['id'],'include':[{'model':db[_0x993e('0x78')],'as':_0x993e('0x7c'),'attributes':['id',_0x993e('0x32'),'online',_0x993e('0x7d'),'interface'],'raw':!![]}]})[_0x993e('0x2b')](function(_0x5c9960){if(_0x5c9960){_0x371be2=_0x5c9960;var _0x4286a0=_[_0x993e('0x7e')](_0x5c9960,function(_0x2540e4){var _0x56a23a=_0x2540e4['get']({'plain':!![]});return _0x56a23a[_0x993e('0x7c')];});return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x8dc65[_0x993e('0x4b')]['id']}})['then'](function(_0x37409f){return db['sequelize'][_0x993e('0x53')](function(_0xa16043){return _0x37409f[_0x993e('0x7b')](_0x4d53d1,{'transaction':_0xa16043})['then'](function(){return BPromise[_0x993e('0x7f')](_0x371be2,function(_0x30f7a3){return db[_0x993e('0x80')][_0x993e('0x81')]({'TeamId':_0x30f7a3['id'],'VoicePrefixId':_0x8dc65[_0x993e('0x4b')]['id']},{'transaction':_0xa16043});});})[_0x993e('0x2b')](function(){return BPromise[_0x993e('0x7f')](_0x4286a0,function(_0x3e61d2){return db[_0x993e('0x82')]['findOrCreate']({'where':{'UserId':_0x3e61d2['id'],'VoicePrefixId':_0x8dc65['params']['id']},'transaction':_0xa16043});});})['then'](function(){_0x4286a0[_0x993e('0x83')](function(_0x47c230){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':_0x47c230['id'],'VoicePrefixId':_0x37409f['id']});});});});});}})[_0x993e('0x2b')](respondWithStatusCode(_0x4a5755,null))[_0x993e('0x4e')](handleError(_0x4a5755,null));};exports['removeTeams']=function(_0x548dfb,_0x123dcd,_0x4e7340){return db[_0x993e('0x84')][_0x993e('0x48')]({'where':{'id':_0x548dfb[_0x993e('0x38')][_0x993e('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x993e('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x123dcd,null))['then'](function(_0x242374){var _0x1a3779=_[_0x993e('0x34')](_0x242374,'id');var _0x366809=[];var _0x11ba3a=[];var _0x1b2ca0=squel[_0x993e('0x85')]();_0x1b2ca0[_0x993e('0x86')](_0x993e('0x87'))[_0x993e('0x88')](_0x993e('0x89'),'tq')[_0x993e('0x8a')]('user_has_teams','ut',_0x993e('0x8b'))[_0x993e('0x43')](_0x993e('0x8c'),_0x548dfb[_0x993e('0x4b')]['id']);for(var _0x23ecf0=0x0;_0x23ecf0<_0x242374[_0x993e('0x69')];_0x23ecf0+=0x1){let _0x2fcfaa=_0x242374[_0x23ecf0];for(var _0x5303c9=0x0;_0x5303c9<_0x2fcfaa[_0x993e('0x7c')]['length'];_0x5303c9+=0x1){let _0x5d5dc8=_0x2fcfaa[_0x993e('0x7c')][_0x5303c9];var _0x102393=_0x1b2ca0[_0x993e('0x8d')]();_0x102393['where'](_0x993e('0x8e'),_0x5d5dc8['id']);_0x11ba3a[_0x993e('0x63')](db[_0x993e('0x52')][_0x993e('0x38')](_0x102393[_0x993e('0x8f')](),{'type':db[_0x993e('0x52')][_0x993e('0x90')]['SELECT']})[_0x993e('0x2b')](function(_0x6ee3c0){if(_0x6ee3c0['length']===0x1){return _0x5d5dc8['id'];}else{var _0x58fee1=_[_0x993e('0x91')](_[_0x993e('0x34')](_0x6ee3c0,_0x993e('0x92')),function(_0x2f0669){return _[_0x993e('0x93')](_0x1a3779,_0x2f0669);});if(_0x58fee1){return _0x5d5dc8['id'];}}}));}}return BPromise['all'](_0x11ba3a)[_0x993e('0x2b')](function(_0x3725b5){_0x366809=_(_0x366809)['union'](_0x3725b5)[_0x993e('0x94')]()['value']();return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x548dfb['params']['id']}})[_0x993e('0x2b')](function(_0x5ee2e0){return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x289772){return _0x5ee2e0['removeTeams'](_0x548dfb['query'][_0x993e('0x6e')],{'transaction':_0x289772})[_0x993e('0x2b')](function(){if(!_[_0x993e('0x95')](_0x366809)){return _0x5ee2e0[_0x993e('0x73')](_0x366809,{'transaction':_0x289772});}})[_0x993e('0x2b')](function(){_0x366809[_0x993e('0x83')](function(_0x366f8f){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':_0x366f8f,'VoicePrefixId':_0x5ee2e0['id']});});});});});});})['then'](respondWithStatusCode(_0x123dcd,null))[_0x993e('0x4e')](handleError(_0x123dcd,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c0c9ad9..94b7c68 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 _0xe814=['hook','VoicePrefix','save','update','remove','emit'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0xe814,0x7f));var _0x4e81=function(_0x2acf29,_0x29dc7a){_0x2acf29=_0x2acf29-0x0;var _0x40fbef=_0xe814[_0x2acf29];return _0x40fbef;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x4e81('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e81('0x1'),'afterUpdate':_0x4e81('0x2'),'afterDestroy':_0x4e81('0x3')};function emitEvent(_0xabeee4){return function(_0x2c4b54,_0x52a022,_0x28f980){VoicePrefixEvents['emit'](_0xabeee4+':'+_0x2c4b54['id'],_0x2c4b54);VoicePrefixEvents[_0x4e81('0x4')](_0xabeee4,_0x2c4b54);_0x28f980(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x4e81('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xc905=['emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc905,0xdb));var _0x5c90=function(_0x1addaf,_0x2c6054){_0x1addaf=_0x1addaf-0x0;var _0x432c9e=_0xc905[_0x1addaf];return _0x432c9e;};'use strict';var EventEmitter=require(_0x5c90('0x0'));var VoicePrefix=require(_0x5c90('0x1'))['db'][_0x5c90('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5c90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5c90('0x4')};function emitEvent(_0x3345fa){return function(_0x1dc416,_0x5320aa,_0x1a60da){VoicePrefixEvents[_0x5c90('0x5')](_0x3345fa+':'+_0x1dc416['id'],_0x1dc416);VoicePrefixEvents[_0x5c90('0x5')](_0x3345fa,_0x1dc416);_0x1a60da(null);};}for(var e in events){if(events[_0x5c90('0x6')](e)){var event=events[e];VoicePrefix[_0x5c90('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 96bf5b3..abea277 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 _0xbc3c=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes'];(function(_0x3d3682,_0x3fef9b){var _0x459579=function(_0xf87972){while(--_0xf87972){_0x3d3682['push'](_0x3d3682['shift']());}};_0x459579(++_0x3fef9b);}(_0xbc3c,0xa2));var _0xcbc3=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xbc3c[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xcbc3('0x0'));var util=require(_0xcbc3('0x1'));var logger=require(_0xcbc3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcbc3('0x3'));var rp=require(_0xcbc3('0x4'));var fs=require('fs');var path=require(_0xcbc3('0x5'));var rimraf=require('rimraf');var config=require(_0xcbc3('0x6'));var attributes=require(_0xcbc3('0x7'));module['exports']=function(_0x25b219,_0x3876a1){return _0x25b219['define'](_0xcbc3('0x8'),attributes,{'tableName':_0xcbc3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf96=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xaf96,0x6a));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6af9('0x0'));var util=require(_0x6af9('0x1'));var logger=require(_0x6af9('0x2'))(_0x6af9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6af9('0x4'));var fs=require('fs');var path=require(_0x6af9('0x5'));var rimraf=require(_0x6af9('0x6'));var config=require(_0x6af9('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x6af9('0x8')]=function(_0x836f9d,_0xf6aa24){return _0x836f9d[_0x6af9('0x9')](_0x6af9('0xa'),attributes,{'tableName':_0x6af9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index a78fe02..61d69f0 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 _0x8a21=['error','code','message','request\x20sent','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ea82d,_0x44090a){var _0x4210a4=function(_0x47c8a9){while(--_0x47c8a9){_0x1ea82d['push'](_0x1ea82d['shift']());}};_0x4210a4(++_0x44090a);}(_0x8a21,0x1d8));var _0x18a2=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x8a21[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x18a2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x18a2('0x1'));var rs=require(_0x18a2('0x2'));var fs=require('fs');var Redis=require(_0x18a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x18a2('0x4'))(_0x18a2('0x5'));var config=require(_0x18a2('0x6'));var jayson=require(_0x18a2('0x7'));var client=jayson[_0x18a2('0x8')][_0x18a2('0x9')]({'port':0x232a});config[_0x18a2('0xa')]=_[_0x18a2('0xb')](config['redis'],{'host':_0x18a2('0xc'),'port':0x18eb});var socket=require(_0x18a2('0xd'))(new Redis(config[_0x18a2('0xa')]));require('./voicePrefix.socket')[_0x18a2('0xe')](socket);function respondWithRpcPromise(_0x3e9df9,_0x143d14,_0x3fda68){return new BPromise(function(_0x1f04e4,_0x54ce08){return client[_0x18a2('0xf')](_0x3e9df9,_0x3fda68)[_0x18a2('0x10')](function(_0x53007f){logger[_0x18a2('0x11')](_0x18a2('0x12'),_0x143d14,'request\x20sent');logger[_0x18a2('0x13')](_0x18a2('0x14'),_0x143d14,'request\x20sent',JSON[_0x18a2('0x15')](_0x53007f));if(_0x53007f[_0x18a2('0x16')]){if(_0x53007f[_0x18a2('0x16')][_0x18a2('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x143d14,_0x53007f[_0x18a2('0x16')]['message']);return _0x54ce08(_0x53007f[_0x18a2('0x16')]['message']);}logger[_0x18a2('0x16')](_0x18a2('0x12'),_0x143d14,_0x53007f[_0x18a2('0x16')]['message']);return _0x1f04e4(_0x53007f[_0x18a2('0x16')][_0x18a2('0x18')]);}else{logger[_0x18a2('0x11')](_0x18a2('0x12'),_0x143d14,_0x18a2('0x19'));_0x1f04e4(_0x53007f['result'][_0x18a2('0x18')]);}})['catch'](function(_0x922c0e){logger['error'](_0x18a2('0x12'),_0x143d14,_0x922c0e);_0x54ce08(_0x922c0e);});});} \ No newline at end of file +var _0xc319=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x4aebe3,_0x162044){var _0x2bb7be=function(_0x22c8d0){while(--_0x22c8d0){_0x4aebe3['push'](_0x4aebe3['shift']());}};_0x2bb7be(++_0x162044);}(_0xc319,0x12e));var _0x9c31=function(_0x138f77,_0x2c68d7){_0x138f77=_0x138f77-0x0;var _0x19b2e2=_0xc319[_0x138f77];return _0x19b2e2;};'use strict';var _=require(_0x9c31('0x0'));var util=require(_0x9c31('0x1'));var moment=require(_0x9c31('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c31('0x3'));var fs=require('fs');var Redis=require(_0x9c31('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c31('0x5'));var logger=require(_0x9c31('0x6'))(_0x9c31('0x7'));var config=require(_0x9c31('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9c31('0x9')][_0x9c31('0xa')]({'port':0x232a});config[_0x9c31('0xb')]=_[_0x9c31('0xc')](config[_0x9c31('0xb')],{'host':_0x9c31('0xd'),'port':0x18eb});var socket=require(_0x9c31('0xe'))(new Redis(config[_0x9c31('0xb')]));require(_0x9c31('0xf'))['register'](socket);function respondWithRpcPromise(_0x57a0b3,_0x5de62b,_0x1d8b8b){return new BPromise(function(_0x2c026b,_0x14a649){return client[_0x9c31('0x10')](_0x57a0b3,_0x1d8b8b)[_0x9c31('0x11')](function(_0x5eff74){logger[_0x9c31('0x12')](_0x9c31('0x13'),_0x5de62b,_0x9c31('0x14'));logger['debug'](_0x9c31('0x15'),_0x5de62b,_0x9c31('0x14'),JSON[_0x9c31('0x16')](_0x5eff74));if(_0x5eff74[_0x9c31('0x17')]){if(_0x5eff74[_0x9c31('0x17')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5de62b,_0x5eff74['error']['message']);return _0x14a649(_0x5eff74[_0x9c31('0x17')][_0x9c31('0x18')]);}logger['error'](_0x9c31('0x13'),_0x5de62b,_0x5eff74[_0x9c31('0x17')][_0x9c31('0x18')]);return _0x2c026b(_0x5eff74[_0x9c31('0x17')][_0x9c31('0x18')]);}else{logger['info'](_0x9c31('0x13'),_0x5de62b,'request\x20sent');_0x2c026b(_0x5eff74[_0x9c31('0x19')]['message']);}})[_0x9c31('0x1a')](function(_0x54c08a){logger[_0x9c31('0x17')](_0x9c31('0x13'),_0x5de62b,_0x54c08a);_0x14a649(_0x54c08a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8db961c..f1580dc 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 _0x9099=['length','./voicePrefix.events','remove','update','emit','removeListener','register'];(function(_0x32f74b,_0xd81c00){var _0x3a669d=function(_0x18509e){while(--_0x18509e){_0x32f74b['push'](_0x32f74b['shift']());}};_0x3a669d(++_0xd81c00);}(_0x9099,0x1ac));var _0x9909=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x9099[_0x3902c1];return _0x1266cc;};'use strict';var VoicePrefixEvents=require(_0x9909('0x0'));var events=['save',_0x9909('0x1'),_0x9909('0x2')];function createListener(_0x38e636,_0x2524d3){return function(_0x3fd4b4){_0x2524d3[_0x9909('0x3')](_0x38e636,_0x3fd4b4);};}function removeListener(_0x2168ff,_0x6eb0ac){return function(){VoicePrefixEvents[_0x9909('0x4')](_0x2168ff,_0x6eb0ac);};}exports[_0x9909('0x5')]=function(_0x3947ed){for(var _0x41c07e=0x0,_0x3b7391=events[_0x9909('0x6')];_0x41c07e<_0x3b7391;_0x41c07e++){var _0x54011f=events[_0x41c07e];var _0x6d755a=createListener('voicePrefix:'+_0x54011f,_0x3947ed);VoicePrefixEvents['on'](_0x54011f,_0x6d755a);}}; \ No newline at end of file +var _0x644a=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3c2b8a,_0x10f71f){var _0x210ff6=function(_0xe871c6){while(--_0xe871c6){_0x3c2b8a['push'](_0x3c2b8a['shift']());}};_0x210ff6(++_0x10f71f);}(_0x644a,0xfd));var _0xa644=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0x644a[_0x8560d3];return _0x33b1b5;};'use strict';var VoicePrefixEvents=require(_0xa644('0x0'));var events=[_0xa644('0x1'),_0xa644('0x2'),_0xa644('0x3')];function createListener(_0x3a3218,_0x48801b){return function(_0x1423b7){_0x48801b[_0xa644('0x4')](_0x3a3218,_0x1423b7);};}function removeListener(_0x526de6,_0x4f6ed9){return function(){VoicePrefixEvents[_0xa644('0x5')](_0x526de6,_0x4f6ed9);};}exports[_0xa644('0x6')]=function(_0x3e1ca6){for(var _0x5d78a7=0x0,_0xa4af13=events[_0xa644('0x7')];_0x5d78a7<_0xa4af13;_0x5d78a7++){var _0x4f8b23=events[_0x5d78a7];var _0x15995f=createListener(_0xa644('0x8')+_0x4f8b23,_0x3e1ca6);VoicePrefixEvents['on'](_0x4f8b23,_0x15995f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 5136a77..048f6ee 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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xb10b[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x26393b,_0x449a84){var _0x57230a=function(_0x583888){while(--_0x583888){_0x26393b['push'](_0x26393b['shift']());}};_0x57230a(++_0x449a84);}(_0xb10b,0x12a));var _0xbb10=function(_0x56a347,_0x54d322){_0x56a347=_0x56a347-0x0;var _0x2745f7=_0xb10b[_0x56a347];return _0x2745f7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0513731..8ef7bad 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 _0x4481=['#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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','inbound','default','ringall','fewestcalls','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','preview','booked','roundrobin','setDataValue','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x174f7e,_0x501f15){var _0x3a09fa=function(_0x328d67){while(--_0x328d67){_0x174f7e['push'](_0x174f7e['shift']());}};_0x3a09fa(++_0x501f15);}(_0x4481,0x12f));var _0x1448=function(_0x1c49c9,_0x4b4bd1){_0x1c49c9=_0x1c49c9-0x0;var _0x498251=_0x4481[_0x1c49c9];return _0x498251;};'use strict';var Sequelize=require('sequelize');module[_0x1448('0x0')]={'name':{'type':Sequelize[_0x1448('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1448('0x1')],'defaultValue':_0x1448('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x1448('0x2')]('rr',_0x1448('0x5'),'leastrecent',_0x1448('0x6'),'random',_0x1448('0x7'),_0x1448('0x8'),_0x1448('0x9'),_0x1448('0xa')),'allowNull':![],'defaultValue':_0x1448('0x5'),'set':function(_0x54edd7){this['setDataValue'](_0x1448('0xb'),_0x54edd7?_0x54edd7:_0x1448('0x7'));},'get':function(){var _0x292ec4=this[_0x1448('0xc')](_0x1448('0xd'));var _0x45819f=this[_0x1448('0xc')]('dialMethod');var _0x4fc801=this[_0x1448('0xc')](_0x1448('0xb'));if(_0x292ec4==='outbound'){if(_0x45819f===_0x1448('0xe')){return null;}if(_0x45819f===_0x1448('0xf')&&![_0x1448('0x7'),_0x1448('0x10')]['includes'](_0x4fc801)){this[_0x1448('0x11')](_0x1448('0xb'),'rrmemory');}}return _0x4fc801;}},'servicelevel':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1448('0x12')](0xb)},'timeout':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1448('0x1')]},'weight':{'type':Sequelize[_0x1448('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1448('0x2')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x1448('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1448('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1448('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x1448('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1448('0x2')]('yes','no'),'defaultValue':_0x1448('0x13')},'announce_holdtime':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no',_0x1448('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1448('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1448('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1448('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1448('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1448('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1448('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1448('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1448('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x1448('0x1')]},'queue_quantity2':{'type':Sequelize[_0x1448('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x1448('0x1')]},'queue_less_than':{'type':Sequelize[_0x1448('0x1')]},'periodic_announce':{'type':Sequelize[_0x1448('0x15')],'set':function(_0x52d4aa){this['setDataValue'](_0x1448('0x16'),_0x52d4aa?_0x52d4aa[_0x1448('0x17')](','):[]);},'get':function(){return this[_0x1448('0xc')](_0x1448('0x16'))?this[_0x1448('0xc')](_0x1448('0x16'))[_0x1448('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x1448('0x1')],'defaultValue':_0x1448('0x13'),'set':function(_0x516421){this[_0x1448('0x11')](_0x1448('0x19'),_0x516421?_0x516421[_0x1448('0x17')](','):undefined);},'get':function(){return this[_0x1448('0xc')](_0x1448('0x19'))?this[_0x1448('0xc')](_0x1448('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1448('0x1')],'defaultValue':'no','set':function(_0x3d5139){this[_0x1448('0x11')]('leavewhenempty',_0x3d5139?_0x3d5139[_0x1448('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0x1448('0x1a'))?this[_0x1448('0xc')](_0x1448('0x1a'))[_0x1448('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x1448('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1448('0x1')]},'description':{'type':Sequelize[_0x1448('0x1')]},'acw':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':0x0,'set':function(_0x349a11){this['setDataValue'](_0x1448('0x1c'),_0x349a11);if(_0x349a11){if(this[_0x1448('0xc')]('wrapuptime')<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1448('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':0x0,'comment':_0x1448('0x1d')},'dialMethod':{'type':Sequelize[_0x1448('0x2')](_0x1448('0xe'),_0x1448('0x1e'),_0x1448('0x1f'),_0x1448('0x20'),'booked'),'defaultValue':'progressive','comment':_0x1448('0x21')},'dialLimitChannel':{'type':Sequelize[_0x1448('0x12')](0x4)[_0x1448('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1448('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1448('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1448('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x1448('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1448('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1448('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x1448('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1448('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1448('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1448('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1448('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1448('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x1448('0x1')],'defaultValue':_0x1448('0x2b'),'comment':_0x1448('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x2d')},'dialQueueProject':{'type':Sequelize[_0x1448('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1448('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1448('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1448('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1448('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1448('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x33'),_0x1448('0x34'),_0x1448('0x35')),'defaultValue':_0x1448('0x33')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1448('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x1448('0x12')](0x9)[_0x1448('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1448('0x12')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1448('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1448('0x12')](0x9)[_0x1448('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1448('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1448('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x1448('0x12')](0x9)[_0x1448('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1448('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1448('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1448('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1448('0x12')](0x9)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1448('0x12')](0x9)[_0x1448('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1448('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':0x0,'comment':_0x1448('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1448('0x2')](_0x1448('0x3d'),_0x1448('0x3e')),'defaultValue':_0x1448('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x1448('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1448('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1448('0x3f')},'dialCutDigit':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1448('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1448('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1448('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1448('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1448('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1448('0x12')](0x5)[_0x1448('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1448('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':![],'comment':_0x1448('0x47'),'set':function(_0x3dc899){if(!_0x3dc899)this[_0x1448('0x11')](_0x1448('0x48'),null);this[_0x1448('0x11')](_0x1448('0x49'),_0x3dc899);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1448('0x12')](0x3)[_0x1448('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1448('0x1b')],'defaultValue':![]}}; \ No newline at end of file +var _0x7146=['onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','ENUM','outbound','inbound','ringall','leastrecent','fewestcalls','random','linear','rrordered','setDataValue','strategy','rrmemory','type','getDataValue','preview','booked','INTEGER','yes','all','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7146,0x1a0));var _0x6714=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7146[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x6714('0x0'));module['exports']={'name':{'type':Sequelize[_0x6714('0x1')],'allowNull':![],'unique':_0x6714('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6714('0x3')]('inbound',_0x6714('0x4')),'allowNull':![],'defaultValue':_0x6714('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x6714('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6714('0x3')]('rr',_0x6714('0x6'),_0x6714('0x7'),_0x6714('0x8'),_0x6714('0x9'),'rrmemory',_0x6714('0xa'),'wrandom',_0x6714('0xb')),'allowNull':![],'defaultValue':_0x6714('0x6'),'set':function(_0x596b64){this[_0x6714('0xc')](_0x6714('0xd'),_0x596b64?_0x596b64:_0x6714('0xe'));},'get':function(){var _0xc136bd=this['getDataValue'](_0x6714('0xf'));var _0x2d8873=this[_0x6714('0x10')]('dialMethod');var _0x24139e=this[_0x6714('0x10')](_0x6714('0xd'));if(_0xc136bd===_0x6714('0x4')){if(_0x2d8873===_0x6714('0x11')){return null;}if(_0x2d8873===_0x6714('0x12')&&![_0x6714('0xe'),'roundrobin']['includes'](_0x24139e)){this[_0x6714('0xc')](_0x6714('0xd'),_0x6714('0xe'));}}return _0x24139e;}},'servicelevel':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6714('0x13')](0xb)},'timeout':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6714('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defaultValue':_0x6714('0x14')},'autopause':{'type':Sequelize[_0x6714('0x3')]('yes','no',_0x6714('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6714('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6714('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6714('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6714('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6714('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6714('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defaultValue':_0x6714('0x14')},'announce_holdtime':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6714('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6714('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6714('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6714('0x1')]},'queue_youarenext':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6714('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6714('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x6714('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x6714('0x1')]},'queue_less_than':{'type':Sequelize[_0x6714('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x794667){this[_0x6714('0xc')](_0x6714('0x16'),_0x794667?_0x794667[_0x6714('0x17')](','):[]);},'get':function(){return this[_0x6714('0x10')]('periodic_announce')?this['getDataValue'](_0x6714('0x16'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x6714('0x1')],'defaultValue':_0x6714('0x14'),'set':function(_0x16dc0d){this['setDataValue'](_0x6714('0x18'),_0x16dc0d?_0x16dc0d['join'](','):undefined);},'get':function(){return this[_0x6714('0x10')](_0x6714('0x18'))?this[_0x6714('0x10')](_0x6714('0x18'))[_0x6714('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6714('0x1')],'defaultValue':'no','set':function(_0x198cb7){this[_0x6714('0xc')](_0x6714('0x1a'),_0x198cb7?_0x198cb7[_0x6714('0x17')](','):undefined);},'get':function(){return this[_0x6714('0x10')](_0x6714('0x1a'))?this[_0x6714('0x10')](_0x6714('0x1a'))[_0x6714('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x6714('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x6714('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6714('0x1')]},'description':{'type':Sequelize[_0x6714('0x1')]},'acw':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':0x0,'set':function(_0x3f2c8f){this[_0x6714('0xc')](_0x6714('0x1c'),_0x3f2c8f);if(_0x3f2c8f){if(this[_0x6714('0x10')](_0x6714('0x1d'))<0x2){this[_0x6714('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6714('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x11'),_0x6714('0x1e'),_0x6714('0x1f'),_0x6714('0x20'),_0x6714('0x12')),'defaultValue':_0x6714('0x1e'),'comment':_0x6714('0x21')},'dialLimitChannel':{'type':Sequelize[_0x6714('0x13')](0x4)[_0x6714('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x6714('0x13')](0x4)[_0x6714('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6714('0x23')},'dialPredictiveOptimization':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x24'),_0x6714('0x25')),'defaultValue':_0x6714('0x25'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6714('0x26')},'dialPredictiveInterval':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x6714('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6714('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x27')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x6714('0x28'),'comment':_0x6714('0x29')},'dialQueueTimeout':{'type':Sequelize[_0x6714('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x2a')},'dialQueueProject':{'type':Sequelize[_0x6714('0x1')],'comment':_0x6714('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6714('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x3,'comment':_0x6714('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6714('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6714('0x31')},'dialTimezone':{'type':Sequelize[_0x6714('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6714('0x1')],'defaultValue':_0x6714('0x32')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x33'),'never',_0x6714('0x34')),'defaultValue':_0x6714('0x33')},'dialAMDActive':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':0x0,'comment':_0x6714('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x6714('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6714('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x6714('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6714('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6714('0x13')](0x9)[_0x6714('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6714('0x13')](0x9)[_0x6714('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x6714('0x13')](0x9)[_0x6714('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6714('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6714('0x13')](0x9)[_0x6714('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6714('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6714('0x13')](0x9)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6714('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6714('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6714('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6714('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x6714('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6714('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':0x0,'comment':_0x6714('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6714('0x3')](_0x6714('0x3f'),_0x6714('0x40')),'defaultValue':_0x6714('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x6714('0x1')],'comment':_0x6714('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6714('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6714('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x6714('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6714('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6714('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6714('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6714('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6714('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6714('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6714('0x13')](0x5)[_0x6714('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6714('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6714('0x13')],'allowNull':!![],'comment':_0x6714('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':![],'comment':_0x6714('0x4c'),'set':function(_0x146355){if(!_0x146355)this['setDataValue'](_0x6714('0x4d'),null);this[_0x6714('0xc')]('mandatoryDisposition',_0x146355);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x6714('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6714('0x13')](0x3)[_0x6714('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x6714('0x1b')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 27afd2f..920bac7 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 _0x3e74=['phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','sendStatus','stack','name','status','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','clone','params','keys','omit','updatedAt','createdAt','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','sort','filters','pick','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','phone','scheduledAt','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x151d93,_0x4abb17){var _0x1c7a50=function(_0x43e161){while(--_0x43e161){_0x151d93['push'](_0x151d93['shift']());}};_0x1c7a50(++_0x4abb17);}(_0x3e74,0x175));var _0x43e7=function(_0x3ec3ea,_0x3cf163){_0x3ec3ea=_0x3ec3ea-0x0;var _0x2c95ce=_0x3e74[_0x3ec3ea];return _0x2c95ce;};'use strict';var moment=require(_0x43e7('0x0'));var BPromise=require('bluebird');var util=require(_0x43e7('0x1'));var _=require(_0x43e7('0x2'));var squel=require(_0x43e7('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x4'))('api');var config=require(_0x43e7('0x5'));var db=require(_0x43e7('0x6'))['db'];config[_0x43e7('0x7')]=_[_0x43e7('0x8')](config[_0x43e7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x9'))(new Redis(config[_0x43e7('0x7')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithStatusCode(_0x21f491,_0x516b4d){_0x516b4d=_0x516b4d||0xcc;return function(_0x212c6c){if(_0x212c6c){return _0x21f491['sendStatus'](_0x516b4d);}return _0x21f491['status'](_0x516b4d)[_0x43e7('0xc')]();};}function respondWithResult(_0x4139c9,_0x5c34f4){_0x5c34f4=_0x5c34f4||0xc8;return function(_0x2803d9){if(_0x2803d9){return _0x4139c9['status'](_0x5c34f4)[_0x43e7('0xd')](_0x2803d9);}};}function respondWithFilteredResult(_0x37302c,_0x4ebc8e){return function(_0x3eb206){if(_0x3eb206){var _0xc960ea=typeof _0x4ebc8e[_0x43e7('0xe')]===_0x43e7('0xf')&&typeof _0x4ebc8e['limit']==='undefined';var _0x2fcb36=_0x3eb206[_0x43e7('0x10')];var _0x44b0bd=_0xc960ea?0x0:_0x4ebc8e['offset'];var _0x5e641c=_0xc960ea?_0x3eb206[_0x43e7('0x10')]:_0x4ebc8e[_0x43e7('0xe')]+_0x4ebc8e[_0x43e7('0x11')];var _0x328445;if(_0x5e641c>=_0x2fcb36){_0x5e641c=_0x2fcb36;_0x328445=0xc8;}else{_0x328445=0xce;}_0x37302c['status'](_0x328445);return _0x37302c['set'](_0x43e7('0x12'),_0x44b0bd+'-'+_0x5e641c+'/'+_0x2fcb36)[_0x43e7('0xd')](_0x3eb206);}return null;};}function saveUpdates(_0x273a32){return function(_0x5d346f){if(_0x5d346f){return _0x5d346f['update'](_0x273a32)[_0x43e7('0x13')](function(_0x1ca758){return _0x1ca758;});}return null;};}function removeEntity(_0x9037d3){return function(_0x140657){if(_0x140657){return _0x140657[_0x43e7('0x14')]()[_0x43e7('0x13')](function(){var _0x619236=_0x140657[_0x43e7('0x15')]({'plain':!![]});var _0x2377a3=[{'name':_0x43e7('0x16'),'value':_0x43e7('0x17'),'ignore':![]},{'name':_0x43e7('0x18'),'value':'outbound','ignore':![]}];var _0xef1a5a=_(_0x2377a3)[_0x43e7('0x19')]('ignore')[_0x43e7('0x1a')](_0x43e7('0x1b'))[_0x43e7('0x1b')]();if(_[_0x43e7('0x1c')](_0xef1a5a,_0x619236[_0x43e7('0x1d')])){return;}var _0x2f4cb4=_['find'](_0x2377a3,[_0x43e7('0x1b'),_0x619236['type']])['name'];return db[_0x43e7('0x1e')][_0x43e7('0x14')]({'where':{'type':_0x2f4cb4,'resourceId':_0x619236['id']}})['then'](function(){return _0x140657;});})[_0x43e7('0x13')](function(){_0x9037d3['status'](0xcc)[_0x43e7('0xc')]();});}};}function handleEntityNotFound(_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x5c5e67[_0x43e7('0x1f')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x20')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x21')];}_0x20888b[_0x43e7('0x22')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={};var _0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x1a')](db[_0x43e7('0x25')][_0x43e7('0x26')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x27')],'type':_0x31b2a6[_0x43e7('0x1d')][_0x43e7('0x28')]};});_0x4690a6=qs[_0x43e7('0x29')](_0x50f9f5,_0x5087d7);var _0x2bde44={'where':_0x4690a6[_0x43e7('0x2a')]};return db['VoiceQueue'][_0x43e7('0x10')](_0x2bde44)[_0x43e7('0x13')](function(_0x3b8f78){_0x45b675[_0x43e7('0x10')]=_0x3b8f78;_0x4690a6[_0x43e7('0x2b')]=qs['include'](_0x5087d7[_0x43e7('0x2c')]);return db[_0x43e7('0x25')][_0x43e7('0x2d')](_0x4690a6);})[_0x43e7('0x13')](function(_0x4c61b9){_0x45b675['rows']=_0x4c61b9;return _0x45b675;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x2e')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x2f')]=function(_0x117c07,_0x234fe6){var _0x108313={'raw':![],'where':{'id':_0x117c07['params']['id']}},_0xde7ed={};_0xde7ed['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0xde7ed['query']=_['keys'](_0x117c07[_0x43e7('0x2c')]);_0xde7ed['filters']=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],_0xde7ed[_0x43e7('0x2c')]);_0x108313[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x117c07['query']['fields']));_0x108313['attributes']=_0x108313[_0x43e7('0x32')][_0x43e7('0x34')]?_0x108313[_0x43e7('0x32')]:_0xde7ed[_0x43e7('0x31')];if(_0x117c07[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x108313[_0x43e7('0x2b')]=[{'all':!![]}];}_0x108313=_[_0x43e7('0x36')]({},_0x108313,_0x117c07['options']);return db[_0x43e7('0x25')][_0x43e7('0x37')](_0x108313)['then'](handleEntityNotFound(_0x234fe6,null))[_0x43e7('0x13')](respondWithResult(_0x234fe6,null))['catch'](handleError(_0x234fe6,null));};exports[_0x43e7('0x38')]=function(_0x2ad008,_0x1c6f45){return db[_0x43e7('0x25')][_0x43e7('0x38')](_0x2ad008[_0x43e7('0x39')],{})['then'](function(_0x574a93){var _0x30dfa9=_0x2ad008[_0x43e7('0x3a')][_0x43e7('0x15')]({'plain':!![]});if(!_0x30dfa9)throw new Error(_0x43e7('0x3b'));if(_0x30dfa9[_0x43e7('0x3c')]==='user'){var _0x32a451=_0x574a93[_0x43e7('0x15')]({'plain':!![]});var _0x575439=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':_0x43e7('0x18'),'value':'outbound'}];var _0x3d81ae=_[_0x43e7('0x37')](_0x575439,[_0x43e7('0x1b'),_0x32a451[_0x43e7('0x1d')]])['name'];return db['UserProfileSection'][_0x43e7('0x37')]({'where':{'name':_0x3d81ae,'userProfileId':_0x30dfa9[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x36b770){if(_0x36b770&&_0x36b770['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x32a451[_0x43e7('0x21')],'resourceId':_0x32a451['id'],'type':_0x36b770['name'],'sectionId':_0x36b770['id']},{})[_0x43e7('0x13')](function(){return _0x574a93;});}else{return _0x574a93;}})['catch'](function(_0x5b28db){logger[_0x43e7('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28db);throw _0x5b28db;});}return _0x574a93;})[_0x43e7('0x13')](respondWithResult(_0x1c6f45,0xc9))[_0x43e7('0x2e')](handleError(_0x1c6f45,null));};exports[_0x43e7('0x3f')]=function(_0x99b9e1,_0x4fc5e8){var _0x91f1e4={'where':{'id':_0x99b9e1[_0x43e7('0x40')]['id']}},_0x2b9046={};_0x2b9046[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x25')]['rawAttributes']);_0x91f1e4['attributes']=_[_0x43e7('0x30')](_0x2b9046[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x99b9e1['query']['fields']));_0x91f1e4['attributes']=_0x91f1e4[_0x43e7('0x32')][_0x43e7('0x34')]?_0x91f1e4['attributes']:_0x2b9046[_0x43e7('0x31')];if(_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x91f1e4['include']=[{'all':!![]}];}_0x91f1e4=_['merge']({},_0x91f1e4,_0x99b9e1['options']);return db['VoiceQueue'][_0x43e7('0x37')](_0x91f1e4)[_0x43e7('0x13')](handleEntityNotFound(_0x4fc5e8,null))['then'](function(_0x23e7cb){if(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x15')]({'plain':!![]});_0x82d32f=qs[_0x43e7('0x42')](_0x82d32f,['id','createdAt',_0x43e7('0x43')]);_0x99b9e1['body']=_['omit'](_0x99b9e1[_0x43e7('0x39')],['id',_0x43e7('0x44'),_0x43e7('0x43')]);return db[_0x43e7('0x25')][_0x43e7('0x38')](_[_0x43e7('0x36')](_0x82d32f,_0x99b9e1[_0x43e7('0x39')]),{'include':_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]?[{'all':!![]}]:undefined})[_0x43e7('0x13')](function(_0x58dfd0){var _0x119d34=_0x99b9e1[_0x43e7('0x3a')]['get']({'plain':!![]});if(!_0x119d34)throw new Error(_0x43e7('0x3b'));if(_0x119d34['role']===_0x43e7('0x3a')){var _0x520857=_0x58dfd0[_0x43e7('0x15')]({'plain':!![]});var _0x1f561f=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x43e7('0x45')}];var _0x2ab7ee=_[_0x43e7('0x37')](_0x1f561f,[_0x43e7('0x1b'),_0x520857[_0x43e7('0x1d')]])[_0x43e7('0x21')];return db[_0x43e7('0x46')][_0x43e7('0x37')]({'where':{'name':_0x2ab7ee,'userProfileId':_0x119d34[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x312306){if(_0x312306&&_0x312306['autoAssociation']===0x0){return db[_0x43e7('0x1e')][_0x43e7('0x38')]({'name':_0x520857['name'],'resourceId':_0x520857['id'],'type':_0x312306[_0x43e7('0x21')],'sectionId':_0x312306['id']},{})[_0x43e7('0x13')](function(){return _0x58dfd0;});}else{return _0x58dfd0;}})[_0x43e7('0x2e')](function(_0x558d54){logger['error'](_0x43e7('0x47'),_0x558d54);throw _0x558d54;});}return _0x58dfd0;});}})[_0x43e7('0x13')](respondWithResult(_0x4fc5e8,0xc9))['catch'](handleError(_0x4fc5e8,null));};exports[_0x43e7('0x48')]=function(_0x54506d,_0x49a6ce){if(_0x54506d[_0x43e7('0x39')]['id']){delete _0x54506d[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x54506d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ce,null))[_0x43e7('0x13')](saveUpdates(_0x54506d[_0x43e7('0x39')],null))['then'](respondWithResult(_0x49a6ce,null))[_0x43e7('0x2e')](handleError(_0x49a6ce,null));};exports[_0x43e7('0x14')]=function(_0x296a0d,_0x5bb536){return db['VoiceQueue']['find']({'where':{'id':_0x296a0d[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x5bb536,null))[_0x43e7('0x13')](removeEntity(_0x5bb536,null))[_0x43e7('0x2e')](handleError(_0x5bb536,null));};exports['getHoppers']=function(_0x5a50fc,_0x1b27da){var _0x8b50bb={'raw':![],'where':{}};var _0x140438={};var _0x5dd349={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x5a50fc[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1b27da,null))[_0x43e7('0x13')](function(_0x3369b8){if(_0x3369b8){_0x140438[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x4a')][_0x43e7('0x26')]);_0x140438[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x5a50fc['query']);_0x140438['filters']=_[_0x43e7('0x30')](_0x140438['model'],_0x140438['query']);_0x8b50bb['attributes']=_[_0x43e7('0x30')](_0x140438[_0x43e7('0x31')],qs['fields'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x8b50bb[_0x43e7('0x32')]=_0x8b50bb['attributes'][_0x43e7('0x34')]?_0x8b50bb[_0x43e7('0x32')]:_0x140438[_0x43e7('0x31')];if(!_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x8b50bb[_0x43e7('0x11')]=qs['limit'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x8b50bb[_0x43e7('0xe')]=qs['offset'](_0x5a50fc['query'][_0x43e7('0xe')]);}_0x8b50bb['order']=qs['sort'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x8b50bb['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x5a50fc[_0x43e7('0x2c')],_0x140438[_0x43e7('0x4e')]));_0x8b50bb[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x3369b8['id'];if(_0x5a50fc[_0x43e7('0x2c')]['filter']){_0x8b50bb[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x8b50bb['where'],{'$or':_[_0x43e7('0x1a')](_0x8b50bb['attributes'],function(_0x26ee52){var _0x248936={};_0x248936[_0x26ee52]={'$like':'%'+_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x248936;})});}_0x8b50bb=_['merge']({},_0x8b50bb,_0x5a50fc[_0x43e7('0x51')]);return db[_0x43e7('0x4a')][_0x43e7('0x10')]({'where':_0x8b50bb['where']})[_0x43e7('0x13')](function(_0x38fa5b){_0x5dd349[_0x43e7('0x10')]=_0x38fa5b;if(_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x8b50bb['include']=[{'all':!![]}];}return db[_0x43e7('0x4a')][_0x43e7('0x2d')](_0x8b50bb);})[_0x43e7('0x13')](function(_0x2499ef){_0x5dd349[_0x43e7('0x52')]=_0x2499ef;return _0x5dd349;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x1b27da,_0x8b50bb))[_0x43e7('0x2e')](handleError(_0x1b27da,null));};exports['getHopperHistories']=function(_0x499ee9,_0x405faa){var _0x536477={'raw':!![],'where':{}};var _0x550036={};var _0x5b98bf={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x499ee9[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x405faa,null))[_0x43e7('0x13')](function(_0x1ae0c8){if(_0x1ae0c8){_0x550036['model']=_[_0x43e7('0x41')](db[_0x43e7('0x53')][_0x43e7('0x26')]);_0x550036['query']=_[_0x43e7('0x41')](_0x499ee9[_0x43e7('0x2c')]);_0x550036[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x550036[_0x43e7('0x31')],_0x550036[_0x43e7('0x2c')]);_0x536477[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x550036['model'],qs['fields'](_0x499ee9['query'][_0x43e7('0x33')]));_0x536477[_0x43e7('0x32')]=_0x536477['attributes'][_0x43e7('0x34')]?_0x536477[_0x43e7('0x32')]:_0x550036[_0x43e7('0x31')];if(!_0x499ee9[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x536477['limit']=qs[_0x43e7('0x11')](_0x499ee9[_0x43e7('0x2c')]['limit']);_0x536477['offset']=qs[_0x43e7('0xe')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x536477['order']=qs[_0x43e7('0x4d')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x536477[_0x43e7('0x2a')]=qs['filters'](_[_0x43e7('0x4f')](_0x499ee9['query'],_0x550036[_0x43e7('0x4e')]));_0x536477[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1ae0c8['id'];if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x536477[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x536477['where'],{'$or':_[_0x43e7('0x1a')](_0x536477[_0x43e7('0x32')],function(_0x1aea4e){var _0x6fb694={};_0x6fb694[_0x1aea4e]={'$like':'%'+_0x499ee9['query']['filter']+'%'};return _0x6fb694;})});}_0x536477=_['merge']({},_0x536477,_0x499ee9[_0x43e7('0x51')]);return db['CmHopperHistory'][_0x43e7('0x10')]({'where':_0x536477[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x7387f6){_0x5b98bf[_0x43e7('0x10')]=_0x7387f6;if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x536477[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x53')][_0x43e7('0x2d')](_0x536477);})[_0x43e7('0x13')](function(_0x5b3565){_0x5b98bf[_0x43e7('0x52')]=_0x5b3565;return _0x5b98bf;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x405faa,_0x536477))[_0x43e7('0x2e')](handleError(_0x405faa,null));};exports[_0x43e7('0x54')]=function(_0x206e54,_0x4ea4a9){var _0x5e04ec={'raw':!![],'where':{}};var _0x162a27={};var _0x3e3c82={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x206e54[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ea4a9,null))['then'](function(_0x1e869a){if(_0x1e869a){_0x162a27[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x55')][_0x43e7('0x26')]);_0x162a27['query']=_['keys'](_0x206e54[_0x43e7('0x2c')]);_0x162a27[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],_0x162a27['query']);_0x5e04ec[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x206e54['query'][_0x43e7('0x33')]));_0x5e04ec[_0x43e7('0x32')]=_0x5e04ec[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5e04ec[_0x43e7('0x32')]:_0x162a27['model'];if(!_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0x5e04ec[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5e04ec['offset']=qs[_0x43e7('0xe')](_0x206e54['query'][_0x43e7('0xe')]);}_0x5e04ec[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5e04ec[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x206e54[_0x43e7('0x2c')],_0x162a27['filters']));_0x5e04ec[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1e869a['id'];if(_0x206e54[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x5e04ec['where']=_['merge'](_0x5e04ec[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5e04ec[_0x43e7('0x32')],function(_0x4d30f7){var _0x12e7a8={};_0x12e7a8[_0x4d30f7]={'$like':'%'+_0x206e54['query']['filter']+'%'};return _0x12e7a8;})});}_0x5e04ec=_['merge']({},_0x5e04ec,_0x206e54[_0x43e7('0x51')]);return db['CmHopperFinal'][_0x43e7('0x10')]({'where':_0x5e04ec[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x2fea54){_0x3e3c82[_0x43e7('0x10')]=_0x2fea54;if(_0x206e54['query']['includeAll']){_0x5e04ec[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x55')]['findAll'](_0x5e04ec);})[_0x43e7('0x13')](function(_0x10fd28){_0x3e3c82[_0x43e7('0x52')]=_0x10fd28;return _0x3e3c82;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x4ea4a9,_0x5e04ec))[_0x43e7('0x2e')](handleError(_0x4ea4a9,null));};exports[_0x43e7('0x57')]=function(_0x399253,_0x32e698){var _0x39ce5e={'raw':!![],'where':{}};var _0x284617={};var _0x610819={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x399253[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x32e698,null))[_0x43e7('0x13')](function(_0x3286b1){if(_0x3286b1){_0x284617[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x58')][_0x43e7('0x26')]);_0x284617[_0x43e7('0x2c')]=_['keys'](_0x399253[_0x43e7('0x2c')]);_0x284617[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x284617[_0x43e7('0x31')],_0x284617['query']);_0x39ce5e[_0x43e7('0x32')]=_['intersection'](_0x284617[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x399253[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x39ce5e[_0x43e7('0x32')]=_0x39ce5e[_0x43e7('0x32')]['length']?_0x39ce5e[_0x43e7('0x32')]:_0x284617[_0x43e7('0x31')];if(!_0x399253[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x39ce5e['limit']=qs['limit'](_0x399253[_0x43e7('0x2c')]['limit']);_0x39ce5e[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x399253[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x39ce5e['order']=qs['sort'](_0x399253['query'][_0x43e7('0x4d')]);_0x39ce5e['where']=qs['filters'](_['pick'](_0x399253[_0x43e7('0x2c')],_0x284617[_0x43e7('0x4e')]));_0x39ce5e['where'][_0x43e7('0x50')]=_0x3286b1['id'];if(_0x399253['query'][_0x43e7('0x19')]){_0x39ce5e[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x39ce5e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x39ce5e['attributes'],function(_0x1f4162){var _0x449cb4={};_0x449cb4[_0x1f4162]={'$like':'%'+_0x399253[_0x43e7('0x2c')]['filter']+'%'};return _0x449cb4;})});}_0x39ce5e=_['merge']({},_0x39ce5e,_0x399253[_0x43e7('0x51')]);return db[_0x43e7('0x58')][_0x43e7('0x10')]({'where':_0x39ce5e[_0x43e7('0x2a')]})['then'](function(_0x385cc1){_0x610819[_0x43e7('0x10')]=_0x385cc1;if(_0x399253[_0x43e7('0x2c')]['includeAll']){_0x39ce5e[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x58')][_0x43e7('0x2d')](_0x39ce5e);})[_0x43e7('0x13')](function(_0x541ce8){_0x610819[_0x43e7('0x52')]=_0x541ce8;return _0x610819;});}})['then'](respondWithFilteredResult(_0x32e698,_0x39ce5e))[_0x43e7('0x2e')](handleError(_0x32e698,null));};exports[_0x43e7('0x59')]=function(_0x47f29f,_0x4e5484){var _0xc62dc9={};var _0x1480c6={};var _0x21d001;var _0x4600e5;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x47f29f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x4e5484,null))[_0x43e7('0x13')](function(_0xfc577b){if(_0xfc577b){_0x21d001=_0xfc577b;_0x1480c6[_0x43e7('0x31')]=_['keys'](db[_0x43e7('0x5a')]['rawAttributes']);_0x1480c6[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x47f29f[_0x43e7('0x2c')]);_0x1480c6['filters']=_[_0x43e7('0x30')](_0x1480c6[_0x43e7('0x31')],_0x1480c6[_0x43e7('0x2c')]);_0xc62dc9[_0x43e7('0x32')]=_['intersection'](_0x1480c6[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x47f29f['query']['fields']));_0xc62dc9['attributes']=_0xc62dc9[_0x43e7('0x32')][_0x43e7('0x34')]?_0xc62dc9[_0x43e7('0x32')]:_0x1480c6[_0x43e7('0x31')];_0xc62dc9[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0xc62dc9['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x47f29f[_0x43e7('0x2c')],_0x1480c6[_0x43e7('0x4e')]));if(_0x47f29f['query']['filter']){_0xc62dc9[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0xc62dc9[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0xc62dc9['attributes'],function(_0x2f529b){var _0x427cec={};_0x427cec[_0x2f529b]={'$like':'%'+_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x427cec;})});}_0xc62dc9=_[_0x43e7('0x36')]({},_0xc62dc9,_0x47f29f[_0x43e7('0x51')]);return _0x21d001['getTeams'](_0xc62dc9);}})[_0x43e7('0x13')](function(_0x52c974){if(_0x52c974){_0x4600e5=_0x52c974['length'];if(!_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0xc62dc9['limit']=qs[_0x43e7('0x11')](_0x47f29f[_0x43e7('0x2c')]['limit']);_0xc62dc9[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x21d001['getTeams'](_0xc62dc9);}})['then'](function(_0x2a084b){if(_0x2a084b){return _0x2a084b?{'count':_0x4600e5,'rows':_0x2a084b}:null;}})[_0x43e7('0x13')](respondWithResult(_0x4e5484,null))[_0x43e7('0x2e')](handleError(_0x4e5484,null));};exports['addTeams']=function(_0x49de67,_0x298239){var _0xf682ec=_0x49de67[_0x43e7('0x39')][_0x43e7('0x5b')];var _0x1e247f=_[_0x43e7('0x1a')](_0xf682ec,'id');return db[_0x43e7('0x5a')][_0x43e7('0x2d')]({'where':{'id':_0x1e247f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]}]})[_0x43e7('0x13')](function(_0x44fee0){if(_0x44fee0){var _0x41d130=_[_0x43e7('0x5e')](_0x44fee0,function(_0x5e87d6){var _0x21039a=_0x5e87d6[_0x43e7('0x15')]({'plain':!![]});_0x21039a[_0x43e7('0x5f')][_0x43e7('0x60')](function(_0x59f68a){_0x59f68a[_0x43e7('0x61')]=_[_0x43e7('0x37')](_0xf682ec,{'id':_0x21039a['id']})[_0x43e7('0x61')];});return _0x21039a[_0x43e7('0x5f')];});return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x49de67[_0x43e7('0x40')]['id']}})['then'](function(_0xc9356c){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0x3637d9){return _0xc9356c[_0x43e7('0x64')](_0x1e247f,{'transaction':_0x3637d9})['then'](function(){return BPromise[_0x43e7('0x65')](_0xf682ec,function(_0x25ddf8){return db['TeamVoiceQueue'][_0x43e7('0x66')]({'TeamId':_0x25ddf8['id'],'VoiceQueueId':_0x49de67[_0x43e7('0x40')]['id'],'penalty':_0x25ddf8['penalty']},{'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_0x41d130,function(_0x110154){return db[_0x43e7('0x67')][_0x43e7('0x68')]({'where':{'UserId':_0x110154['id'],'VoiceQueueId':_0x49de67['params']['id']},'defaults':{'penalty':_0x110154[_0x43e7('0x61')]},'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_['filter'](_0x41d130,{'online':!![]}),function(_0x32b788){return db[_0x43e7('0x69')]['upsert']({'membername':_0x32b788[_0x43e7('0x21')],'UserId':_0x32b788['id'],'queue_name':_0xc9356c[_0x43e7('0x21')],'VoiceQueueId':_0xc9356c['id'],'interface':_[_0x43e7('0x6a')](_0x32b788[_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x32b788['name']):_0x32b788[_0x43e7('0x5d')],'paused':_0x32b788[_0x43e7('0x6d')]||![],'penalty':_0x32b788[_0x43e7('0x61')]},{'transaction':_0x3637d9});});})['then'](function(){_0x41d130[_0x43e7('0x60')](function(_0x21901c){socket[_0x43e7('0x6e')](_0x43e7('0x6f'),{'UserId':_0x21901c['id'],'VoiceQueueId':_0xc9356c['id']});});});});});}})[_0x43e7('0x13')](respondWithStatusCode(_0x298239,null))[_0x43e7('0x2e')](handleError(_0x298239,null));};exports[_0x43e7('0x70')]=function(_0x1896b3,_0x4345a5){return db['Team'][_0x43e7('0x2d')]({'where':{'id':_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x43e7('0x72')],'as':_0x43e7('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x43e7('0x13')](handleEntityNotFound(_0x4345a5,null))[_0x43e7('0x13')](function(_0x3e8631){var _0x51e17c=_[_0x43e7('0x1a')](_0x3e8631,'id');var _0x6246c4=[];var _0xd0dca2=[];var _0xa721ba=squel[_0x43e7('0x73')]();_0xa721ba['field'](_0x43e7('0x74'))[_0x43e7('0x75')](_0x43e7('0x76'),'tq')[_0x43e7('0x77')](_0x43e7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x1896b3[_0x43e7('0x40')]['id']);for(var _0x339826=0x0;_0x339826<_0x3e8631[_0x43e7('0x34')];_0x339826+=0x1){let _0xc28ac6=_0x3e8631[_0x339826];for(var _0x4b0abd=0x0;_0x4b0abd<_0xc28ac6[_0x43e7('0x5f')][_0x43e7('0x34')];_0x4b0abd+=0x1){let _0x41d636=_0xc28ac6[_0x43e7('0x5f')][_0x4b0abd];var _0x19bdf7=_0xa721ba[_0x43e7('0x3f')]();_0x19bdf7[_0x43e7('0x2a')](_0x43e7('0x79'),_0x41d636['id']);_0xd0dca2[_0x43e7('0x7a')](db[_0x43e7('0x62')][_0x43e7('0x2c')](_0x19bdf7['toString'](),{'type':db['sequelize'][_0x43e7('0x7b')]['SELECT']})['then'](function(_0x4a0d5d){if(_0x4a0d5d[_0x43e7('0x34')]===0x1){return _0x41d636['id'];}else{var _0x5eae45=_[_0x43e7('0x7c')](_['map'](_0x4a0d5d,'TeamId'),function(_0x55f1df){return _[_0x43e7('0x1c')](_0x51e17c,_0x55f1df);});if(_0x5eae45){return _0x41d636['id'];}}}));}}return BPromise[_0x43e7('0x7d')](_0xd0dca2)[_0x43e7('0x13')](function(_0xd6ebb0){_0x6246c4=_(_0x6246c4)[_0x43e7('0x7e')](_0xd6ebb0)[_0x43e7('0x7f')]()[_0x43e7('0x1b')]();return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1896b3[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](function(_0x2a1218){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0xe14e67){return _0x2a1218[_0x43e7('0x70')](_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')],{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){if(!_[_0x43e7('0x80')](_0x6246c4)){return _0x2a1218['removeAgents'](_0x6246c4,{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x1896b3[_0x43e7('0x40')]['id'],'UserId':_0x6246c4},'transaction':_0xe14e67});});}})[_0x43e7('0x13')](function(){_0x6246c4[_0x43e7('0x60')](function(_0x32b33c){socket['emit'](_0x43e7('0x81'),{'UserId':_0x32b33c,'VoiceQueueId':_0x2a1218['id']});});});});});});})[_0x43e7('0x13')](respondWithStatusCode(_0x4345a5,null))['catch'](handleError(_0x4345a5,null));};exports[_0x43e7('0x82')]=function(_0x1a520e,_0xb4cf23){var _0x559145,_0x22b824;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1a520e[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0xb4cf23,null))['then'](function(_0x33b63b){if(_0x33b63b){_0x22b824=_0x33b63b;return _0x33b63b[_0x43e7('0x82')](_0x1a520e['body'][_0x43e7('0x71')],_['omit'](_0x1a520e['body'],['ids','id'])||{})['spread'](function(_0x255113){for(var _0x451fb5=0x0;_0x451fb5<_0x1a520e[_0x43e7('0x39')][_0x43e7('0x71')]['length'];_0x451fb5+=0x1){socket['emit'](_0x43e7('0x6f'),{'UserId':Number(_0x1a520e['body'][_0x43e7('0x71')][_0x451fb5]),'VoiceQueueId':Number(_0x1a520e['params']['id'])});}return _0x255113;});}})[_0x43e7('0x13')](function(_0x4cf7e9){_0x559145=_0x4cf7e9||[];if(_0x22b824){return db['User']['findAll']({'where':{'id':_0x1a520e['body'][_0x43e7('0x71')]},'attributes':['id',_0x43e7('0x21'),_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]});}})[_0x43e7('0x13')](function(_0x517289){if(!_['isEmpty'](_0x517289)){var _0x25fd39=[];for(var _0xb2aca0=0x0;_0xb2aca0<_0x517289[_0x43e7('0x34')];_0xb2aca0++){if(_0x517289[_0xb2aca0][_0x43e7('0x5c')]){_0x25fd39['push'](db[_0x43e7('0x69')]['upsert']({'membername':_0x517289[_0xb2aca0][_0x43e7('0x21')],'UserId':_0x517289[_0xb2aca0]['id'],'queue_name':_0x22b824[_0x43e7('0x21')],'VoiceQueueId':_0x22b824['id'],'interface':_[_0x43e7('0x6a')](_0x517289[_0xb2aca0][_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x517289[_0xb2aca0][_0x43e7('0x21')]):_0x517289[_0xb2aca0]['interface'],'paused':_0x517289[_0xb2aca0][_0x43e7('0x6d')]||![],'penalty':_0x1a520e[_0x43e7('0x39')]['penalty']||0x0}));}}return BPromise[_0x43e7('0x7d')](_0x25fd39);}})[_0x43e7('0x13')](function(){return _0x559145;})[_0x43e7('0x13')](respondWithResult(_0xb4cf23,null))[_0x43e7('0x2e')](handleError(_0xb4cf23,null));};exports[_0x43e7('0x83')]=function(_0x4fd17e,_0x3fd573){return db['VoiceQueue'][_0x43e7('0x37')]({'where':{'id':_0x4fd17e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3fd573,null))[_0x43e7('0x13')](function(_0x4446cb){if(_0x4446cb){return _0x4446cb[_0x43e7('0x83')](_0x4fd17e[_0x43e7('0x2c')]['ids'])[_0x43e7('0x13')](function(){if(_['isArray'](_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')])){for(var _0x34d476=0x0;_0x34d476<_0x4fd17e['query'][_0x43e7('0x71')][_0x43e7('0x34')];_0x34d476+=0x1){socket[_0x43e7('0x6e')](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')]['ids'][_0x34d476]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}}else{socket['emit'](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}});}})[_0x43e7('0x13')](function(_0x34ed9e){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x4fd17e[_0x43e7('0x40')]['id'],'UserId':_0x4fd17e['query'][_0x43e7('0x71')]}})[_0x43e7('0x13')](function(){return _0x34ed9e;});})[_0x43e7('0x13')](respondWithStatusCode(_0x3fd573,null))[_0x43e7('0x2e')](handleError(_0x3fd573,null));};exports[_0x43e7('0x84')]=function(_0xf9178f,_0x3bb7ab){var _0x2be8c7={};var _0x2bb14d={};var _0x57f7ea;var _0x240478;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0xf9178f[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb7ab,null))[_0x43e7('0x13')](function(_0x381e47){if(_0x381e47){_0x57f7ea=_0x381e47;_0x2bb14d['model']=_[_0x43e7('0x41')](db[_0x43e7('0x72')][_0x43e7('0x26')]);_0x2bb14d[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0xf9178f[_0x43e7('0x2c')]);_0x2bb14d[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2bb14d['model'],_0x2bb14d[_0x43e7('0x2c')]);_0x2be8c7[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2bb14d['model'],qs[_0x43e7('0x33')](_0xf9178f[_0x43e7('0x2c')]['fields']));_0x2be8c7[_0x43e7('0x32')]=_0x2be8c7[_0x43e7('0x32')]['length']?_0x2be8c7[_0x43e7('0x32')]:_0x2bb14d[_0x43e7('0x31')];_0x2be8c7[_0x43e7('0x56')]=qs['sort'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x2be8c7['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0xf9178f[_0x43e7('0x2c')],_0x2bb14d[_0x43e7('0x4e')]));if(_0xf9178f['query']['filter']){_0x2be8c7[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x2be8c7[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x2be8c7['attributes'],function(_0x1e6245){var _0x36860d={};_0x36860d[_0x1e6245]={'$like':'%'+_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x36860d;})});}_0x2be8c7=_['merge']({},_0x2be8c7,_0xf9178f[_0x43e7('0x51')]);return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x3ff5d6){if(_0x3ff5d6){_0x240478=_0x3ff5d6[_0x43e7('0x34')];if(!_0xf9178f['query']['hasOwnProperty']('nolimit')){_0x2be8c7[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0xf9178f[_0x43e7('0x2c')]['limit']);_0x2be8c7[_0x43e7('0xe')]=qs['offset'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x249a8d){if(_0x249a8d){return _0x249a8d?{'count':_0x240478,'rows':_0x249a8d}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3bb7ab,null))['catch'](handleError(_0x3bb7ab,null));};exports[_0x43e7('0x85')]=function(_0x202421,_0x12e4a3){var _0x16ca0e={};var _0x2f467b={};var _0x7f43b5;var _0x4637f6;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x202421[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x12e4a3,null))[_0x43e7('0x13')](function(_0x24e9a7){if(_0x24e9a7){_0x7f43b5=_0x24e9a7;_0x2f467b['model']=_[_0x43e7('0x41')](db[_0x43e7('0x69')]['rawAttributes']);_0x2f467b[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x202421['query']);_0x2f467b[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],_0x2f467b['query']);_0x16ca0e['attributes']=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x16ca0e[_0x43e7('0x32')]=_0x16ca0e[_0x43e7('0x32')][_0x43e7('0x34')]?_0x16ca0e['attributes']:_0x2f467b[_0x43e7('0x31')];_0x16ca0e[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x16ca0e[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x202421[_0x43e7('0x2c')],_0x2f467b[_0x43e7('0x4e')]));if(_0x202421[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x16ca0e['where']=_[_0x43e7('0x36')](_0x16ca0e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x16ca0e[_0x43e7('0x32')],function(_0x49f43c){var _0xad02f6={};_0xad02f6[_0x49f43c]={'$like':'%'+_0x202421['query'][_0x43e7('0x19')]+'%'};return _0xad02f6;})});}_0x16ca0e=_['merge']({},_0x16ca0e,_0x202421[_0x43e7('0x51')]);return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})[_0x43e7('0x13')](function(_0x4a500c){if(_0x4a500c){_0x4637f6=_0x4a500c[_0x43e7('0x34')];if(!_0x202421[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x16ca0e['limit']=qs[_0x43e7('0x11')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x16ca0e[_0x43e7('0xe')]=qs['offset'](_0x202421[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})['then'](function(_0x12c4f9){return _0x12c4f9?{'count':_0x4637f6,'rows':_0x12c4f9}:null;})[_0x43e7('0x13')](respondWithResult(_0x12e4a3,null))[_0x43e7('0x2e')](handleError(_0x12e4a3,null));};exports[_0x43e7('0x86')]=function(_0x77c2f,_0x1e4a25){var _0x5790b5={};var _0x3f057e={};var _0x505287;var _0x221938;return db[_0x43e7('0x25')]['findOne']({'where':{'id':_0x77c2f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1e4a25,null))['then'](function(_0x46aa47){if(_0x46aa47){_0x505287=_0x46aa47;_0x3f057e[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x87')]['rawAttributes']);_0x3f057e['query']=_[_0x43e7('0x41')](_0x77c2f[_0x43e7('0x2c')]);_0x3f057e[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x3f057e[_0x43e7('0x31')],_0x3f057e[_0x43e7('0x2c')]);_0x5790b5[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x3f057e['model'],qs[_0x43e7('0x33')](_0x77c2f[_0x43e7('0x2c')]['fields']));_0x5790b5[_0x43e7('0x32')]=_0x5790b5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5790b5[_0x43e7('0x32')]:_0x3f057e[_0x43e7('0x31')];_0x5790b5[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x77c2f['query'][_0x43e7('0x4d')]);_0x5790b5['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x77c2f['query'],_0x3f057e[_0x43e7('0x4e')]));if(_0x77c2f['query'][_0x43e7('0x19')]){_0x5790b5[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5790b5['where'],{'$or':_['map'](_0x5790b5[_0x43e7('0x32')],function(_0xcfecd2){var _0x4cd879={};_0x4cd879[_0xcfecd2]={'$like':'%'+_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x4cd879;})});}_0x5790b5=_[_0x43e7('0x36')]({},_0x5790b5,_0x77c2f['options']);return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0xb2eb62){if(_0xb2eb62){_0x221938=_0xb2eb62['length'];if(!_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x5790b5[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x77c2f[_0x43e7('0x2c')]['limit']);_0x5790b5[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x77c2f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0x34ab5a){if(_0x34ab5a){return _0x34ab5a?{'count':_0x221938,'rows':_0x34ab5a}:null;}})[_0x43e7('0x13')](respondWithResult(_0x1e4a25,null))[_0x43e7('0x2e')](handleError(_0x1e4a25,null));};exports[_0x43e7('0x88')]=function(_0x13133c,_0x288d6a){var _0x47ef9d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x56598f,_0x280668;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x13133c[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x288d6a,null))[_0x43e7('0x13')](function(_0x51dc07){if(_0x51dc07){_0x280668=_0x51dc07;return _0x51dc07['addLists'](_0x13133c[_0x43e7('0x39')][_0x43e7('0x71')],_['omit'](_0x13133c['body'],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x58a783){var _0x3d6659;_0x56598f=_0x58a783||[];var _0x57bcab=[];if(_0x58a783){for(var _0x5f4023=0x0;_0x5f4023<_0x58a783[_0x43e7('0x34')];_0x5f4023+=0x1){var _0x2be66d=_0x58a783[_0x5f4023]['get']({'plain':!![]});_0x280668['dialCheckDuplicateType']=_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]?_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]:_0x280668['dialCheckDuplicateType'];switch(_0x280668[_0x43e7('0x8a')]){case _0x43e7('0x8b'):_0x3d6659=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8d'),'ContactId','ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')]('phone',_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))['field'](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')]['toString']())[_0x43e7('0x2a')]('phone\x20IS\x20NOT\x20NULL')[_0x43e7('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x43e7('0x73')]()['field'](_0x43e7('0x95'))[_0x43e7('0x75')](_0x43e7('0x96'))[_0x43e7('0x2a')](_0x43e7('0x97'),_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]()))[_0x43e7('0x2a')](_0x43e7('0x98'),squel[_0x43e7('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x43e7('0x99'))['where']('VoiceQueueId\x20=\x20?',_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;case _0x43e7('0x9a'):_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0x99'))[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),'ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel['select']()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))['field'](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))['where'](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e'))['where'](_0x43e7('0x98'),squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x9f'))['from']('cm_hopper')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x13133c['params']['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;default:_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper')[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),'createdAt','updatedAt'],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))['field']('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),'ListId')[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))[_0x43e7('0x75')]('cm_contacts')[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();}_0x57bcab['push'](db['sequelize'][_0x43e7('0x2c')](_0x3d6659));}return BPromise[_0x43e7('0x7d')](_0x57bcab);}})[_0x43e7('0x13')](function(){var _0x3ac223=[];var _0x486780=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0xa1'))[_0x43e7('0x9d')]([_0x43e7('0xa2'),_0x43e7('0x8c'),_0x43e7('0xa3'),'createdAt',_0x43e7('0x43')],squel['select']()['field']('h.id')[_0x43e7('0x8e')](_0x43e7('0xa4'))[_0x43e7('0x8e')](_0x43e7('0xa5'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0xa6'),'ci')['join'](_0x43e7('0x99'),'h',_0x43e7('0xa7'))[_0x43e7('0x2a')](_0x43e7('0xa8'),_0x47ef9d)['where']('ci.ItemClass=?',_0x43e7('0xa9')))[_0x43e7('0x91')]();_0x3ac223['push'](db['sequelize'][_0x43e7('0x2c')](_0x486780));return BPromise[_0x43e7('0x7d')](_0x3ac223);})[_0x43e7('0x13')](function(){return _0x56598f;})[_0x43e7('0x13')](respondWithResult(_0x288d6a,null))[_0x43e7('0x2e')](handleError(_0x288d6a,null));};exports[_0x43e7('0xaa')]=function(_0x71807e,_0x314259){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x71807e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x314259,null))[_0x43e7('0x13')](function(_0x2613fc){if(_0x2613fc){return _0x2613fc[_0x43e7('0xaa')](_0x71807e['query'][_0x43e7('0x71')]);}})['then'](function(_0x17b298){if(_0x17b298){return db[_0x43e7('0x4a')][_0x43e7('0x14')]({'where':{'ListId':_0x71807e[_0x43e7('0x2c')]['ids'],'VoiceQueueId':_0x71807e['params']['id']}})[_0x43e7('0x13')](function(){return _0x17b298;});}})['then'](respondWithStatusCode(_0x314259,null))[_0x43e7('0x2e')](handleError(_0x314259,null));};exports[_0x43e7('0xab')]=function(_0x44c536,_0x3a9550){var _0x5dcd3f={};var _0x2e7f00={};var _0x2627e2;var _0x591517;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x44c536[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3a9550,null))[_0x43e7('0x13')](function(_0x5e042f){if(_0x5e042f){_0x2627e2=_0x5e042f;_0x2e7f00['model']=_[_0x43e7('0x41')](db[_0x43e7('0x87')][_0x43e7('0x26')]);_0x2e7f00[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x44c536[_0x43e7('0x2c')]);_0x2e7f00[_0x43e7('0x4e')]=_['intersection'](_0x2e7f00[_0x43e7('0x31')],_0x2e7f00[_0x43e7('0x2c')]);_0x5dcd3f[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2e7f00[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x5dcd3f[_0x43e7('0x32')]=_0x5dcd3f[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5dcd3f[_0x43e7('0x32')]:_0x2e7f00[_0x43e7('0x31')];_0x5dcd3f[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5dcd3f['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x44c536[_0x43e7('0x2c')],_0x2e7f00[_0x43e7('0x4e')]));if(_0x44c536[_0x43e7('0x2c')]['filter']){_0x5dcd3f[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5dcd3f[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5dcd3f[_0x43e7('0x32')],function(_0x5278fd){var _0x84b4f4={};_0x84b4f4[_0x5278fd]={'$like':'%'+_0x44c536['query']['filter']+'%'};return _0x84b4f4;})});}_0x5dcd3f=_['merge']({},_0x5dcd3f,_0x44c536[_0x43e7('0x51')]);return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x4ee587){if(_0x4ee587){_0x591517=_0x4ee587[_0x43e7('0x34')];if(!_0x44c536[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x5dcd3f[_0x43e7('0x11')]=qs['limit'](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5dcd3f[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x44c536[_0x43e7('0x2c')]['offset']);}return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x3b641e){if(_0x3b641e){return _0x3b641e?{'count':_0x591517,'rows':_0x3b641e}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3a9550,null))[_0x43e7('0x2e')](handleError(_0x3a9550,null));};exports['addBlackLists']=function(_0x5b046d,_0x4a0427){var _0xc3460c;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x5b046d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a0427,null))[_0x43e7('0x13')](function(_0x19c1d2){if(_0x19c1d2){return _0x19c1d2[_0x43e7('0xac')](_0x5b046d['body'][_0x43e7('0x71')],_['omit'](_0x5b046d[_0x43e7('0x39')],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x40cc83){var _0x148d72;_0xc3460c=_0x40cc83||[];var _0x1ceb94=[];if(_0x40cc83){for(var _0x19c29b=0x0;_0x19c29b<_0x40cc83[_0x43e7('0x34')];_0x19c29b+=0x1){var _0x38a8db=_0x40cc83[_0x19c29b]['get']({'plain':!![]});_0x148d72=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper_black')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('id','ContactId')[_0x43e7('0x8e')](_0x38a8db['CmListId'][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x5b046d[_0x43e7('0x40')]['id']['toString'](),_0x43e7('0x50'))[_0x43e7('0x8e')]('NOW()',_0x43e7('0x44'))[_0x43e7('0x8e')](_0x43e7('0xad'),_0x43e7('0x43'))[_0x43e7('0x75')](_0x43e7('0x93'))[_0x43e7('0x2a')]('deletedAt\x20IS\x20NULL')[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x38a8db[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();_0x1ceb94[_0x43e7('0x7a')](db[_0x43e7('0x62')]['query'](_0x148d72));}return BPromise[_0x43e7('0x7d')](_0x1ceb94);}})['then'](function(){return _0xc3460c;})[_0x43e7('0x13')](respondWithResult(_0x4a0427,null))[_0x43e7('0x2e')](handleError(_0x4a0427,null));};exports[_0x43e7('0xae')]=function(_0x1dc579,_0x6d9fb){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1dc579['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x6d9fb,null))['then'](function(_0x59ca95){if(_0x59ca95){return _0x59ca95[_0x43e7('0xae')](_0x1dc579['query']['ids']);}})[_0x43e7('0x13')](function(_0x759eb5){if(_0x759eb5){return db[_0x43e7('0x58')][_0x43e7('0x14')]({'where':{'ListId':_0x1dc579['query'][_0x43e7('0x71')],'VoiceQueueId':_0x1dc579['params']['id']}})[_0x43e7('0x13')](function(){return _0x759eb5;});}})[_0x43e7('0x13')](respondWithStatusCode(_0x6d9fb,null))[_0x43e7('0x2e')](handleError(_0x6d9fb,null));}; \ No newline at end of file +var _0x008c=['deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','into','fromQuery','COALESCE(phone,\x27\x27)','all','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','json','offset','undefined','count','set','Content-Range','then','inbound','map','value','includes','type','UserProfileResource','destroy','status','send','index','VoiceQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','VoiceQueues','QueueCampaigns','outbound','name','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','length','hasOwnProperty','nolimit','limit','sort','pick','VoiceQueueId','filter','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','isEmpty','UserVoiceQueueRt','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','cm_contacts'];(function(_0x46556e,_0x3057fd){var _0x55c49f=function(_0x955a89){while(--_0x955a89){_0x46556e['push'](_0x46556e['shift']());}};_0x55c49f(++_0x3057fd);}(_0x008c,0x188));var _0xc008=function(_0x25996d,_0x5b282e){_0x25996d=_0x25996d-0x0;var _0x12d802=_0x008c[_0x25996d];return _0x12d802;};'use strict';var moment=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));var squel=require(_0xc008('0x4'));var Redis=require('ioredis');var qs=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var db=require(_0xc008('0x9'))['db'];config[_0xc008('0xa')]=_[_0xc008('0xb')](config[_0xc008('0xa')],{'host':_0xc008('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0xa')]));require('./voiceQueue.socket')[_0xc008('0xd')](socket);function respondWithStatusCode(_0x5b64f8,_0x52041f){_0x52041f=_0x52041f||0xcc;return function(_0x27830d){if(_0x27830d){return _0x5b64f8[_0xc008('0xe')](_0x52041f);}return _0x5b64f8['status'](_0x52041f)['end']();};}function respondWithResult(_0x543eb8,_0x1eacfa){_0x1eacfa=_0x1eacfa||0xc8;return function(_0xc881aa){if(_0xc881aa){return _0x543eb8['status'](_0x1eacfa)[_0xc008('0xf')](_0xc881aa);}};}function respondWithFilteredResult(_0x332fd4,_0x2ea200){return function(_0x2a5b4e){if(_0x2a5b4e){var _0x9ffa93=typeof _0x2ea200[_0xc008('0x10')]===_0xc008('0x11')&&typeof _0x2ea200['limit']==='undefined';var _0x33f44c=_0x2a5b4e['count'];var _0x25e13f=_0x9ffa93?0x0:_0x2ea200[_0xc008('0x10')];var _0x2073ef=_0x9ffa93?_0x2a5b4e[_0xc008('0x12')]:_0x2ea200[_0xc008('0x10')]+_0x2ea200['limit'];var _0x5e894e;if(_0x2073ef>=_0x33f44c){_0x2073ef=_0x33f44c;_0x5e894e=0xc8;}else{_0x5e894e=0xce;}_0x332fd4['status'](_0x5e894e);return _0x332fd4[_0xc008('0x13')](_0xc008('0x14'),_0x25e13f+'-'+_0x2073ef+'/'+_0x33f44c)[_0xc008('0xf')](_0x2a5b4e);}return null;};}function saveUpdates(_0x3eb12a){return function(_0x4fe771){if(_0x4fe771){return _0x4fe771['update'](_0x3eb12a)['then'](function(_0x5c2668){return _0x5c2668;});}return null;};}function removeEntity(_0x46042b){return function(_0x462af5){if(_0x462af5){return _0x462af5['destroy']()[_0xc008('0x15')](function(){var _0x5906e6=_0x462af5['get']({'plain':!![]});var _0x543e5d=[{'name':'VoiceQueues','value':_0xc008('0x16'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x590a71=_(_0x543e5d)['filter']('ignore')[_0xc008('0x17')](_0xc008('0x18'))[_0xc008('0x18')]();if(_[_0xc008('0x19')](_0x590a71,_0x5906e6[_0xc008('0x1a')])){return;}var _0x110128=_['find'](_0x543e5d,[_0xc008('0x18'),_0x5906e6['type']])['name'];return db[_0xc008('0x1b')][_0xc008('0x1c')]({'where':{'type':_0x110128,'resourceId':_0x5906e6['id']}})[_0xc008('0x15')](function(){return _0x462af5;});})[_0xc008('0x15')](function(){_0x46042b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9){return function(_0x3f7b07){if(!_0x3f7b07){_0x5de1e9[_0xc008('0xe')](0x194);}return _0x3f7b07;};}function handleError(_0x92c582,_0x2e31c2){_0x2e31c2=_0x2e31c2||0x1f4;return function(_0x5bebd9){logger['error'](_0x5bebd9['stack']);if(_0x5bebd9['name']){delete _0x5bebd9['name'];}_0x92c582[_0xc008('0x1d')](_0x2e31c2)[_0xc008('0x1e')](_0x5bebd9);};}exports[_0xc008('0x1f')]=function(_0x529961,_0x24c14c){var _0x32390d={};var _0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x20')][_0xc008('0x21')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x22')]};});_0x32390d=qs[_0xc008('0x23')](_0x2a7d4f,_0x529961);var _0xf831f2={'where':_0x32390d[_0xc008('0x24')]};return db[_0xc008('0x20')][_0xc008('0x12')](_0xf831f2)[_0xc008('0x15')](function(_0x22d8e8){_0x209591[_0xc008('0x12')]=_0x22d8e8;_0x32390d[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x529961[_0xc008('0x26')]);return db['VoiceQueue'][_0xc008('0x27')](_0x32390d);})[_0xc008('0x15')](function(_0x499754){_0x209591[_0xc008('0x28')]=_0x499754;return _0x209591;})[_0xc008('0x15')](respondWithFilteredResult(_0x24c14c,_0x32390d))[_0xc008('0x29')](handleError(_0x24c14c,null));};exports[_0xc008('0x2a')]=function(_0xd0e05a,_0x3cd878){var _0x7cfbc5={'raw':![],'where':{'id':_0xd0e05a[_0xc008('0x2b')]['id']}},_0x470e79={};_0x470e79['model']=_[_0xc008('0x2c')](db[_0xc008('0x20')][_0xc008('0x21')]);_0x470e79[_0xc008('0x26')]=_[_0xc008('0x2c')](_0xd0e05a[_0xc008('0x26')]);_0x470e79[_0xc008('0x2d')]=_['intersection'](_0x470e79[_0xc008('0x2e')],_0x470e79[_0xc008('0x26')]);_0x7cfbc5['attributes']=_[_0xc008('0x2f')](_0x470e79[_0xc008('0x2e')],qs['fields'](_0xd0e05a[_0xc008('0x26')][_0xc008('0x30')]));_0x7cfbc5[_0xc008('0x31')]=_0x7cfbc5['attributes']['length']?_0x7cfbc5['attributes']:_0x470e79[_0xc008('0x2e')];if(_0xd0e05a['query'][_0xc008('0x32')]){_0x7cfbc5[_0xc008('0x25')]=[{'all':!![]}];}_0x7cfbc5=_[_0xc008('0x33')]({},_0x7cfbc5,_0xd0e05a[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x7cfbc5)[_0xc008('0x15')](handleEntityNotFound(_0x3cd878,null))[_0xc008('0x15')](respondWithResult(_0x3cd878,null))[_0xc008('0x29')](handleError(_0x3cd878,null));};exports[_0xc008('0x36')]=function(_0x3ebb83,_0xdfca2e){return db[_0xc008('0x20')][_0xc008('0x36')](_0x3ebb83['body'],{})[_0xc008('0x15')](function(_0x23c4db){var _0x30b7df=_0x3ebb83[_0xc008('0x37')]['get']({'plain':!![]});if(!_0x30b7df)throw new Error(_0xc008('0x38'));if(_0x30b7df[_0xc008('0x39')]===_0xc008('0x37')){var _0x36e7ae=_0x23c4db[_0xc008('0x3a')]({'plain':!![]});var _0x5706bb=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':_0xc008('0x3c'),'value':_0xc008('0x3d')}];var _0x7279e8=_['find'](_0x5706bb,[_0xc008('0x18'),_0x36e7ae[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')]['find']({'where':{'name':_0x7279e8,'userProfileId':_0x30b7df[_0xc008('0x40')]},'raw':!![]})[_0xc008('0x15')](function(_0x351d5c){if(_0x351d5c&&_0x351d5c['autoAssociation']===0x0){return db[_0xc008('0x1b')]['create']({'name':_0x36e7ae[_0xc008('0x3e')],'resourceId':_0x36e7ae['id'],'type':_0x351d5c['name'],'sectionId':_0x351d5c['id']},{})[_0xc008('0x15')](function(){return _0x23c4db;});}else{return _0x23c4db;}})[_0xc008('0x29')](function(_0x5a5d85){logger[_0xc008('0x41')](_0xc008('0x42'),_0x5a5d85);throw _0x5a5d85;});}return _0x23c4db;})[_0xc008('0x15')](respondWithResult(_0xdfca2e,0xc9))['catch'](handleError(_0xdfca2e,null));};exports[_0xc008('0x43')]=function(_0x2a9b5c,_0x200469){var _0x44fc5d={'where':{'id':_0x2a9b5c[_0xc008('0x2b')]['id']}},_0x347629={};_0x347629['model']=_['keys'](db['VoiceQueue'][_0xc008('0x21')]);_0x44fc5d[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x347629[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x2a9b5c[_0xc008('0x26')][_0xc008('0x30')]));_0x44fc5d[_0xc008('0x31')]=_0x44fc5d['attributes']['length']?_0x44fc5d['attributes']:_0x347629[_0xc008('0x2e')];if(_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]){_0x44fc5d['include']=[{'all':!![]}];}_0x44fc5d=_[_0xc008('0x33')]({},_0x44fc5d,_0x2a9b5c[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x44fc5d)[_0xc008('0x15')](handleEntityNotFound(_0x200469,null))[_0xc008('0x15')](function(_0x17ec90){if(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x3a')]({'plain':!![]});_0x405e87=qs[_0xc008('0x44')](_0x405e87,['id','createdAt','updatedAt']);_0x2a9b5c[_0xc008('0x45')]=_['omit'](_0x2a9b5c[_0xc008('0x45')],['id',_0xc008('0x46'),_0xc008('0x47')]);return db['VoiceQueue'][_0xc008('0x36')](_[_0xc008('0x33')](_0x405e87,_0x2a9b5c[_0xc008('0x45')]),{'include':_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]?[{'all':!![]}]:undefined})['then'](function(_0x3a7b3b){var _0x27b022=_0x2a9b5c['user'][_0xc008('0x3a')]({'plain':!![]});if(!_0x27b022)throw new Error(_0xc008('0x38'));if(_0x27b022['role']==='user'){var _0x2df905=_0x3a7b3b[_0xc008('0x3a')]({'plain':!![]});var _0x20947b=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':'QueueCampaigns','value':'outbound'}];var _0x34b72a=_['find'](_0x20947b,[_0xc008('0x18'),_0x2df905[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')][_0xc008('0x35')]({'where':{'name':_0x34b72a,'userProfileId':_0x27b022[_0xc008('0x40')]},'raw':!![]})['then'](function(_0x2ea742){if(_0x2ea742&&_0x2ea742[_0xc008('0x48')]===0x0){return db[_0xc008('0x1b')][_0xc008('0x36')]({'name':_0x2df905[_0xc008('0x3e')],'resourceId':_0x2df905['id'],'type':_0x2ea742['name'],'sectionId':_0x2ea742['id']},{})[_0xc008('0x15')](function(){return _0x3a7b3b;});}else{return _0x3a7b3b;}})['catch'](function(_0x535e6e){logger['error'](_0xc008('0x42'),_0x535e6e);throw _0x535e6e;});}return _0x3a7b3b;});}})[_0xc008('0x15')](respondWithResult(_0x200469,0xc9))[_0xc008('0x29')](handleError(_0x200469,null));};exports['update']=function(_0x3aeeab,_0x2d8361){if(_0x3aeeab[_0xc008('0x45')]['id']){delete _0x3aeeab['body']['id'];}return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x3aeeab[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2d8361,null))['then'](saveUpdates(_0x3aeeab[_0xc008('0x45')],null))['then'](respondWithResult(_0x2d8361,null))[_0xc008('0x29')](handleError(_0x2d8361,null));};exports[_0xc008('0x1c')]=function(_0x2ae14e,_0x943c91){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2ae14e['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x943c91,null))['then'](removeEntity(_0x943c91,null))['catch'](handleError(_0x943c91,null));};exports[_0xc008('0x49')]=function(_0x30aa1e,_0x56e755){var _0xb1befa={'raw':![],'where':{}};var _0xb8ba7={};var _0x3e373e={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x30aa1e[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x56e755,null))['then'](function(_0x16e052){if(_0x16e052){_0xb8ba7[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x4b')][_0xc008('0x21')]);_0xb8ba7[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x30aa1e[_0xc008('0x26')]);_0xb8ba7[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0xb8ba7[_0xc008('0x2e')],_0xb8ba7[_0xc008('0x26')]);_0xb1befa[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xb8ba7['model'],qs[_0xc008('0x30')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x30')]));_0xb1befa['attributes']=_0xb1befa[_0xc008('0x31')][_0xc008('0x4c')]?_0xb1befa['attributes']:_0xb8ba7['model'];if(!_0x30aa1e[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0xb1befa[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x4f')]);_0xb1befa[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x10')]);}_0xb1befa['order']=qs[_0xc008('0x50')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x50')]);_0xb1befa[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x30aa1e['query'],_0xb8ba7[_0xc008('0x2d')]));_0xb1befa[_0xc008('0x24')][_0xc008('0x52')]=_0x16e052['id'];if(_0x30aa1e['query'][_0xc008('0x53')]){_0xb1befa[_0xc008('0x24')]=_[_0xc008('0x33')](_0xb1befa['where'],{'$or':_[_0xc008('0x17')](_0xb1befa['attributes'],function(_0x50ee03){var _0xee7a85={};_0xee7a85[_0x50ee03]={'$like':'%'+_0x30aa1e[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0xee7a85;})});}_0xb1befa=_[_0xc008('0x33')]({},_0xb1befa,_0x30aa1e['options']);return db[_0xc008('0x4b')][_0xc008('0x12')]({'where':_0xb1befa['where']})[_0xc008('0x15')](function(_0x5233bb){_0x3e373e[_0xc008('0x12')]=_0x5233bb;if(_0x30aa1e['query'][_0xc008('0x32')]){_0xb1befa['include']=[{'all':!![]}];}return db[_0xc008('0x4b')][_0xc008('0x27')](_0xb1befa);})[_0xc008('0x15')](function(_0x47337b){_0x3e373e['rows']=_0x47337b;return _0x3e373e;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x56e755,_0xb1befa))[_0xc008('0x29')](handleError(_0x56e755,null));};exports[_0xc008('0x54')]=function(_0x1d49db,_0x321500){var _0x13ef78={'raw':!![],'where':{}};var _0xd9e3fd={};var _0x3b46e4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc008('0x4a')]({'where':{'id':_0x1d49db['params']['id']}})['then'](handleEntityNotFound(_0x321500,null))['then'](function(_0x406ead){if(_0x406ead){_0xd9e3fd[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x55')][_0xc008('0x21')]);_0xd9e3fd[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x1d49db[_0xc008('0x26')]);_0xd9e3fd[_0xc008('0x2d')]=_['intersection'](_0xd9e3fd[_0xc008('0x2e')],_0xd9e3fd[_0xc008('0x26')]);_0x13ef78[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xd9e3fd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1d49db[_0xc008('0x26')][_0xc008('0x30')]));_0x13ef78[_0xc008('0x31')]=_0x13ef78[_0xc008('0x31')][_0xc008('0x4c')]?_0x13ef78[_0xc008('0x31')]:_0xd9e3fd['model'];if(!_0x1d49db['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x13ef78[_0xc008('0x4f')]=qs['limit'](_0x1d49db[_0xc008('0x26')][_0xc008('0x4f')]);_0x13ef78['offset']=qs['offset'](_0x1d49db['query'][_0xc008('0x10')]);}_0x13ef78[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1d49db[_0xc008('0x26')][_0xc008('0x50')]);_0x13ef78[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x1d49db[_0xc008('0x26')],_0xd9e3fd[_0xc008('0x2d')]));_0x13ef78['where']['VoiceQueueId']=_0x406ead['id'];if(_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]){_0x13ef78[_0xc008('0x24')]=_[_0xc008('0x33')](_0x13ef78[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x13ef78['attributes'],function(_0x5794fe){var _0x68372f={};_0x68372f[_0x5794fe]={'$like':'%'+_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x68372f;})});}_0x13ef78=_['merge']({},_0x13ef78,_0x1d49db['options']);return db['CmHopperHistory']['count']({'where':_0x13ef78['where']})['then'](function(_0x276de2){_0x3b46e4['count']=_0x276de2;if(_0x1d49db[_0xc008('0x26')]['includeAll']){_0x13ef78[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x55')][_0xc008('0x27')](_0x13ef78);})['then'](function(_0x58f348){_0x3b46e4[_0xc008('0x28')]=_0x58f348;return _0x3b46e4;});}})['then'](respondWithFilteredResult(_0x321500,_0x13ef78))[_0xc008('0x29')](handleError(_0x321500,null));};exports[_0xc008('0x57')]=function(_0x544519,_0x7b7246){var _0x4db90b={'raw':!![],'where':{}};var _0x554cf4={};var _0x23bece={'count':0x0,'rows':[]};return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x544519[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x7b7246,null))[_0xc008('0x15')](function(_0x4bd290){if(_0x4bd290){_0x554cf4[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x58')][_0xc008('0x21')]);_0x554cf4[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x544519['query']);_0x554cf4[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],_0x554cf4['query']);_0x4db90b[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],qs['fields'](_0x544519['query']['fields']));_0x4db90b[_0xc008('0x31')]=_0x4db90b[_0xc008('0x31')][_0xc008('0x4c')]?_0x4db90b[_0xc008('0x31')]:_0x554cf4[_0xc008('0x2e')];if(!_0x544519[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x4db90b['limit']=qs[_0xc008('0x4f')](_0x544519[_0xc008('0x26')]['limit']);_0x4db90b['offset']=qs[_0xc008('0x10')](_0x544519[_0xc008('0x26')][_0xc008('0x10')]);}_0x4db90b[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x544519['query'][_0xc008('0x50')]);_0x4db90b[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x544519[_0xc008('0x26')],_0x554cf4[_0xc008('0x2d')]));_0x4db90b[_0xc008('0x24')]['VoiceQueueId']=_0x4bd290['id'];if(_0x544519[_0xc008('0x26')][_0xc008('0x53')]){_0x4db90b[_0xc008('0x24')]=_[_0xc008('0x33')](_0x4db90b['where'],{'$or':_[_0xc008('0x17')](_0x4db90b[_0xc008('0x31')],function(_0x57cf19){var _0x555e8a={};_0x555e8a[_0x57cf19]={'$like':'%'+_0x544519[_0xc008('0x26')]['filter']+'%'};return _0x555e8a;})});}_0x4db90b=_[_0xc008('0x33')]({},_0x4db90b,_0x544519[_0xc008('0x34')]);return db['CmHopperFinal'][_0xc008('0x12')]({'where':_0x4db90b[_0xc008('0x24')]})[_0xc008('0x15')](function(_0xbe42a2){_0x23bece[_0xc008('0x12')]=_0xbe42a2;if(_0x544519[_0xc008('0x26')][_0xc008('0x32')]){_0x4db90b[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x58')][_0xc008('0x27')](_0x4db90b);})['then'](function(_0x49e6d5){_0x23bece[_0xc008('0x28')]=_0x49e6d5;return _0x23bece;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x7b7246,_0x4db90b))['catch'](handleError(_0x7b7246,null));};exports[_0xc008('0x59')]=function(_0x1bdaa9,_0x698d5c){var _0x5f1e48={'raw':!![],'where':{}};var _0x303cdd={};var _0x38239a={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x1bdaa9[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x698d5c,null))[_0xc008('0x15')](function(_0x5bd010){if(_0x5bd010){_0x303cdd[_0xc008('0x2e')]=_['keys'](db[_0xc008('0x5a')][_0xc008('0x21')]);_0x303cdd[_0xc008('0x26')]=_['keys'](_0x1bdaa9[_0xc008('0x26')]);_0x303cdd[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],_0x303cdd[_0xc008('0x26')]);_0x5f1e48[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1bdaa9[_0xc008('0x26')]['fields']));_0x5f1e48[_0xc008('0x31')]=_0x5f1e48[_0xc008('0x31')][_0xc008('0x4c')]?_0x5f1e48[_0xc008('0x31')]:_0x303cdd[_0xc008('0x2e')];if(!_0x1bdaa9['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x5f1e48[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x4f')]);_0x5f1e48[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x10')]);}_0x5f1e48[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x50')]);_0x5f1e48[_0xc008('0x24')]=qs['filters'](_['pick'](_0x1bdaa9[_0xc008('0x26')],_0x303cdd[_0xc008('0x2d')]));_0x5f1e48[_0xc008('0x24')][_0xc008('0x52')]=_0x5bd010['id'];if(_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]){_0x5f1e48[_0xc008('0x24')]=_[_0xc008('0x33')](_0x5f1e48[_0xc008('0x24')],{'$or':_['map'](_0x5f1e48[_0xc008('0x31')],function(_0x2bbadf){var _0x54fd75={};_0x54fd75[_0x2bbadf]={'$like':'%'+_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x54fd75;})});}_0x5f1e48=_[_0xc008('0x33')]({},_0x5f1e48,_0x1bdaa9[_0xc008('0x34')]);return db[_0xc008('0x5a')][_0xc008('0x12')]({'where':_0x5f1e48['where']})[_0xc008('0x15')](function(_0x321532){_0x38239a[_0xc008('0x12')]=_0x321532;if(_0x1bdaa9[_0xc008('0x26')]['includeAll']){_0x5f1e48[_0xc008('0x25')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc008('0x27')](_0x5f1e48);})[_0xc008('0x15')](function(_0x5b47c3){_0x38239a[_0xc008('0x28')]=_0x5b47c3;return _0x38239a;});}})['then'](respondWithFilteredResult(_0x698d5c,_0x5f1e48))[_0xc008('0x29')](handleError(_0x698d5c,null));};exports['getTeams']=function(_0x5b387d,_0x5351f7){var _0x79dfea={};var _0x402b67={};var _0x48f40f;var _0x4fda8;return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x5b387d[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5351f7,null))[_0xc008('0x15')](function(_0x5843ee){if(_0x5843ee){_0x48f40f=_0x5843ee;_0x402b67[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x5b')][_0xc008('0x21')]);_0x402b67[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x5b387d[_0xc008('0x26')]);_0x402b67[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],_0x402b67[_0xc008('0x26')]);_0x79dfea['attributes']=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5b387d['query'][_0xc008('0x30')]));_0x79dfea[_0xc008('0x31')]=_0x79dfea[_0xc008('0x31')]['length']?_0x79dfea[_0xc008('0x31')]:_0x402b67['model'];_0x79dfea[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5b387d[_0xc008('0x26')]['sort']);_0x79dfea[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x5b387d[_0xc008('0x26')],_0x402b67[_0xc008('0x2d')]));if(_0x5b387d[_0xc008('0x26')][_0xc008('0x53')]){_0x79dfea['where']=_[_0xc008('0x33')](_0x79dfea[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x79dfea[_0xc008('0x31')],function(_0x5a61d6){var _0x46fba5={};_0x46fba5[_0x5a61d6]={'$like':'%'+_0x5b387d['query'][_0xc008('0x53')]+'%'};return _0x46fba5;})});}_0x79dfea=_[_0xc008('0x33')]({},_0x79dfea,_0x5b387d[_0xc008('0x34')]);return _0x48f40f[_0xc008('0x5c')](_0x79dfea);}})[_0xc008('0x15')](function(_0x9f266e){if(_0x9f266e){_0x4fda8=_0x9f266e[_0xc008('0x4c')];if(!_0x5b387d['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x79dfea[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5b387d['query'][_0xc008('0x4f')]);_0x79dfea['offset']=qs[_0xc008('0x10')](_0x5b387d[_0xc008('0x26')][_0xc008('0x10')]);}return _0x48f40f['getTeams'](_0x79dfea);}})['then'](function(_0x39bfc0){if(_0x39bfc0){return _0x39bfc0?{'count':_0x4fda8,'rows':_0x39bfc0}:null;}})['then'](respondWithResult(_0x5351f7,null))[_0xc008('0x29')](handleError(_0x5351f7,null));};exports[_0xc008('0x5d')]=function(_0x1c2e63,_0xaf3bed){var _0x58ae7b=_0x1c2e63[_0xc008('0x45')][_0xc008('0x5e')];var _0x537e5e=_['map'](_0x58ae7b,'id');return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x537e5e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc008('0x5f'),'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),_0xc008('0x61'),'interface'],'raw':!![]}]})[_0xc008('0x15')](function(_0x3721e8){if(_0x3721e8){var _0xc344a7=_[_0xc008('0x62')](_0x3721e8,function(_0x78b833){var _0x177733=_0x78b833[_0xc008('0x3a')]({'plain':!![]});_0x177733[_0xc008('0x5f')][_0xc008('0x63')](function(_0xa332b1){_0xa332b1[_0xc008('0x64')]=_[_0xc008('0x35')](_0x58ae7b,{'id':_0x177733['id']})[_0xc008('0x64')];});return _0x177733['Agents'];});return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1c2e63[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](function(_0x4447ba){return db[_0xc008('0x65')][_0xc008('0x66')](function(_0xe5d226){return _0x4447ba['addTeams'](_0x537e5e,{'transaction':_0xe5d226})['then'](function(){return BPromise[_0xc008('0x67')](_0x58ae7b,function(_0x3d33ed){return db[_0xc008('0x68')]['upsert']({'TeamId':_0x3d33ed['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id'],'penalty':_0x3d33ed[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_0xc344a7,function(_0x156ec3){return db[_0xc008('0x69')][_0xc008('0x6a')]({'where':{'UserId':_0x156ec3['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id']},'defaults':{'penalty':_0x156ec3[_0xc008('0x64')]},'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_[_0xc008('0x53')](_0xc344a7,{'online':!![]}),function(_0x4ffaa3){return db['UserVoiceQueueRt'][_0xc008('0x6b')]({'membername':_0x4ffaa3[_0xc008('0x3e')],'UserId':_0x4ffaa3['id'],'queue_name':_0x4447ba['name'],'VoiceQueueId':_0x4447ba['id'],'interface':_[_0xc008('0x6c')](_0x4ffaa3[_0xc008('0x6d')])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0x4ffaa3[_0xc008('0x3e')]):_0x4ffaa3[_0xc008('0x6d')],'paused':_0x4ffaa3[_0xc008('0x61')]||![],'penalty':_0x4ffaa3[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){_0xc344a7['forEach'](function(_0x51b305){socket['emit'](_0xc008('0x70'),{'UserId':_0x51b305['id'],'VoiceQueueId':_0x4447ba['id']});});});});});}})['then'](respondWithStatusCode(_0xaf3bed,null))[_0xc008('0x29')](handleError(_0xaf3bed,null));};exports[_0xc008('0x71')]=function(_0x2c6a48,_0x177e8e){return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')]},'attributes':['id'],'include':[{'model':db[_0xc008('0x73')],'as':_0xc008('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xc008('0x15')](handleEntityNotFound(_0x177e8e,null))[_0xc008('0x15')](function(_0x1fea74){var _0x304083=_[_0xc008('0x17')](_0x1fea74,'id');var _0x473f44=[];var _0x41d1ea=[];var _0x5c2ca1=squel[_0xc008('0x74')]();_0x5c2ca1['field'](_0xc008('0x75'))[_0xc008('0x76')](_0xc008('0x77'),'tq')['join'](_0xc008('0x78'),'ut',_0xc008('0x79'))[_0xc008('0x24')](_0xc008('0x7a'),_0x2c6a48[_0xc008('0x2b')]['id']);for(var _0x377754=0x0;_0x377754<_0x1fea74[_0xc008('0x4c')];_0x377754+=0x1){let _0x57b8da=_0x1fea74[_0x377754];for(var _0x1cad4b=0x0;_0x1cad4b<_0x57b8da[_0xc008('0x5f')][_0xc008('0x4c')];_0x1cad4b+=0x1){let _0xdb4cef=_0x57b8da['Agents'][_0x1cad4b];var _0x555e8c=_0x5c2ca1['clone']();_0x555e8c['where'](_0xc008('0x7b'),_0xdb4cef['id']);_0x41d1ea[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x555e8c['toString'](),{'type':db[_0xc008('0x65')][_0xc008('0x7d')][_0xc008('0x7e')]})['then'](function(_0x438195){if(_0x438195['length']===0x1){return _0xdb4cef['id'];}else{var _0x3d76b7=_['every'](_[_0xc008('0x17')](_0x438195,_0xc008('0x7f')),function(_0x1aaf89){return _[_0xc008('0x19')](_0x304083,_0x1aaf89);});if(_0x3d76b7){return _0xdb4cef['id'];}}}));}}return BPromise['all'](_0x41d1ea)[_0xc008('0x15')](function(_0x19dcb7){_0x473f44=_(_0x473f44)[_0xc008('0x80')](_0x19dcb7)[_0xc008('0x81')]()[_0xc008('0x18')]();return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2c6a48['params']['id']}})[_0xc008('0x15')](function(_0x30b6af){return db[_0xc008('0x65')]['transaction'](function(_0x5ba04f){return _0x30b6af[_0xc008('0x71')](_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')],{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){if(!_['isEmpty'](_0x473f44)){return _0x30b6af[_0xc008('0x82')](_0x473f44,{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2c6a48['params']['id'],'UserId':_0x473f44},'transaction':_0x5ba04f});});}})[_0xc008('0x15')](function(){_0x473f44['forEach'](function(_0x3744e1){socket['emit'](_0xc008('0x83'),{'UserId':_0x3744e1,'VoiceQueueId':_0x30b6af['id']});});});});});});})[_0xc008('0x15')](respondWithStatusCode(_0x177e8e,null))[_0xc008('0x29')](handleError(_0x177e8e,null));};exports[_0xc008('0x84')]=function(_0x5c24cd,_0x5effd6){var _0x23ba7e,_0x274739;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5c24cd[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5effd6,null))[_0xc008('0x15')](function(_0x272d98){if(_0x272d98){_0x274739=_0x272d98;return _0x272d98[_0xc008('0x84')](_0x5c24cd[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5c24cd[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{})[_0xc008('0x85')](function(_0x57687f){for(var _0x5ea13a=0x0;_0x5ea13a<_0x5c24cd[_0xc008('0x45')]['ids'][_0xc008('0x4c')];_0x5ea13a+=0x1){socket[_0xc008('0x86')]('userVoiceQueue:save',{'UserId':Number(_0x5c24cd['body'][_0xc008('0x72')][_0x5ea13a]),'VoiceQueueId':Number(_0x5c24cd[_0xc008('0x2b')]['id'])});}return _0x57687f;});}})[_0xc008('0x15')](function(_0x129cbf){_0x23ba7e=_0x129cbf||[];if(_0x274739){return db[_0xc008('0x73')][_0xc008('0x27')]({'where':{'id':_0x5c24cd['body'][_0xc008('0x72')]},'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),'voicePause',_0xc008('0x6d')],'raw':!![]});}})[_0xc008('0x15')](function(_0xcef0e4){if(!_[_0xc008('0x87')](_0xcef0e4)){var _0x49f92e=[];for(var _0x4ae026=0x0;_0x4ae026<_0xcef0e4[_0xc008('0x4c')];_0x4ae026++){if(_0xcef0e4[_0x4ae026]['online']){_0x49f92e[_0xc008('0x7c')](db[_0xc008('0x88')][_0xc008('0x6b')]({'membername':_0xcef0e4[_0x4ae026][_0xc008('0x3e')],'UserId':_0xcef0e4[_0x4ae026]['id'],'queue_name':_0x274739[_0xc008('0x3e')],'VoiceQueueId':_0x274739['id'],'interface':_['isNil'](_0xcef0e4[_0x4ae026]['interface'])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0xcef0e4[_0x4ae026][_0xc008('0x3e')]):_0xcef0e4[_0x4ae026][_0xc008('0x6d')],'paused':_0xcef0e4[_0x4ae026][_0xc008('0x61')]||![],'penalty':_0x5c24cd[_0xc008('0x45')][_0xc008('0x64')]||0x0}));}}return BPromise['all'](_0x49f92e);}})[_0xc008('0x15')](function(){return _0x23ba7e;})[_0xc008('0x15')](respondWithResult(_0x5effd6,null))[_0xc008('0x29')](handleError(_0x5effd6,null));};exports[_0xc008('0x82')]=function(_0x1afb32,_0x1c2263){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x1afb32[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x1c2263,null))[_0xc008('0x15')](function(_0x328284){if(_0x328284){return _0x328284['removeAgents'](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])['then'](function(){if(_[_0xc008('0x89')](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])){for(var _0x2598be=0x0;_0x2598be<_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0xc008('0x4c')];_0x2598be+=0x1){socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0x2598be]),'VoiceQueueId':Number(_0x1afb32['params']['id'])});}}else{socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]),'VoiceQueueId':Number(_0x1afb32[_0xc008('0x2b')]['id'])});}});}})[_0xc008('0x15')](function(_0x12f5d1){return db[_0xc008('0x88')][_0xc008('0x1c')]({'where':{'VoiceQueueId':_0x1afb32[_0xc008('0x2b')]['id'],'UserId':_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]}})[_0xc008('0x15')](function(){return _0x12f5d1;});})[_0xc008('0x15')](respondWithStatusCode(_0x1c2263,null))[_0xc008('0x29')](handleError(_0x1c2263,null));};exports[_0xc008('0x8a')]=function(_0x5c358b,_0x49688b){var _0x51fd86={};var _0x10778f={};var _0x237ffb;var _0x3f80f4;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x5c358b[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x49688b,null))['then'](function(_0x3e7099){if(_0x3e7099){_0x237ffb=_0x3e7099;_0x10778f['model']=_['keys'](db[_0xc008('0x73')][_0xc008('0x21')]);_0x10778f['query']=_[_0xc008('0x2c')](_0x5c358b[_0xc008('0x26')]);_0x10778f[_0xc008('0x2d')]=_['intersection'](_0x10778f[_0xc008('0x2e')],_0x10778f[_0xc008('0x26')]);_0x51fd86[_0xc008('0x31')]=_['intersection'](_0x10778f[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5c358b[_0xc008('0x26')][_0xc008('0x30')]));_0x51fd86[_0xc008('0x31')]=_0x51fd86[_0xc008('0x31')][_0xc008('0x4c')]?_0x51fd86[_0xc008('0x31')]:_0x10778f['model'];_0x51fd86[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5c358b[_0xc008('0x26')][_0xc008('0x50')]);_0x51fd86[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x5c358b[_0xc008('0x26')],_0x10778f[_0xc008('0x2d')]));if(_0x5c358b[_0xc008('0x26')][_0xc008('0x53')]){_0x51fd86[_0xc008('0x24')]=_[_0xc008('0x33')](_0x51fd86[_0xc008('0x24')],{'$or':_['map'](_0x51fd86[_0xc008('0x31')],function(_0x231318){var _0x3df369={};_0x3df369[_0x231318]={'$like':'%'+_0x5c358b[_0xc008('0x26')]['filter']+'%'};return _0x3df369;})});}_0x51fd86=_['merge']({},_0x51fd86,_0x5c358b[_0xc008('0x34')]);return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})['then'](function(_0x30e433){if(_0x30e433){_0x3f80f4=_0x30e433[_0xc008('0x4c')];if(!_0x5c358b[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x51fd86[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5c358b['query']['limit']);_0x51fd86[_0xc008('0x10')]=qs['offset'](_0x5c358b[_0xc008('0x26')][_0xc008('0x10')]);}return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})[_0xc008('0x15')](function(_0x2ea1db){if(_0x2ea1db){return _0x2ea1db?{'count':_0x3f80f4,'rows':_0x2ea1db}:null;}})[_0xc008('0x15')](respondWithResult(_0x49688b,null))[_0xc008('0x29')](handleError(_0x49688b,null));};exports[_0xc008('0x8b')]=function(_0x367873,_0x356a82){var _0x368c1f={};var _0x4fd0ff={};var _0x22772e;var _0x39fd43;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x367873[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x356a82,null))[_0xc008('0x15')](function(_0x506dc0){if(_0x506dc0){_0x22772e=_0x506dc0;_0x4fd0ff[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x88')]['rawAttributes']);_0x4fd0ff[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x367873[_0xc008('0x26')]);_0x4fd0ff[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],_0x4fd0ff['query']);_0x368c1f['attributes']=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x367873[_0xc008('0x26')][_0xc008('0x30')]));_0x368c1f['attributes']=_0x368c1f[_0xc008('0x31')]['length']?_0x368c1f[_0xc008('0x31')]:_0x4fd0ff[_0xc008('0x2e')];_0x368c1f['order']=qs[_0xc008('0x50')](_0x367873[_0xc008('0x26')][_0xc008('0x50')]);_0x368c1f[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x367873[_0xc008('0x26')],_0x4fd0ff[_0xc008('0x2d')]));if(_0x367873[_0xc008('0x26')][_0xc008('0x53')]){_0x368c1f['where']=_[_0xc008('0x33')](_0x368c1f[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x368c1f['attributes'],function(_0x43f96e){var _0x353cd5={};_0x353cd5[_0x43f96e]={'$like':'%'+_0x367873[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x353cd5;})});}_0x368c1f=_['merge']({},_0x368c1f,_0x367873[_0xc008('0x34')]);return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x9afcd6){if(_0x9afcd6){_0x39fd43=_0x9afcd6[_0xc008('0x4c')];if(!_0x367873['query'][_0xc008('0x4d')]('nolimit')){_0x368c1f['limit']=qs[_0xc008('0x4f')](_0x367873['query'][_0xc008('0x4f')]);_0x368c1f[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x367873[_0xc008('0x26')][_0xc008('0x10')]);}return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x5e9e9c){return _0x5e9e9c?{'count':_0x39fd43,'rows':_0x5e9e9c}:null;})[_0xc008('0x15')](respondWithResult(_0x356a82,null))[_0xc008('0x29')](handleError(_0x356a82,null));};exports[_0xc008('0x8c')]=function(_0x45fe90,_0xc046ce){var _0x46fc75={};var _0x59b5b9={};var _0x3c3ead;var _0x3c8a79;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x45fe90[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0xc046ce,null))[_0xc008('0x15')](function(_0x3aa9b4){if(_0x3aa9b4){_0x3c3ead=_0x3aa9b4;_0x59b5b9['model']=_['keys'](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x59b5b9['query']=_[_0xc008('0x2c')](_0x45fe90['query']);_0x59b5b9[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],_0x59b5b9[_0xc008('0x26')]);_0x46fc75[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],qs['fields'](_0x45fe90[_0xc008('0x26')]['fields']));_0x46fc75[_0xc008('0x31')]=_0x46fc75[_0xc008('0x31')][_0xc008('0x4c')]?_0x46fc75[_0xc008('0x31')]:_0x59b5b9[_0xc008('0x2e')];_0x46fc75[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x45fe90['query'][_0xc008('0x50')]);_0x46fc75[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x45fe90[_0xc008('0x26')],_0x59b5b9[_0xc008('0x2d')]));if(_0x45fe90[_0xc008('0x26')][_0xc008('0x53')]){_0x46fc75[_0xc008('0x24')]=_['merge'](_0x46fc75[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x46fc75[_0xc008('0x31')],function(_0x3e7c19){var _0x47d263={};_0x47d263[_0x3e7c19]={'$like':'%'+_0x45fe90['query']['filter']+'%'};return _0x47d263;})});}_0x46fc75=_[_0xc008('0x33')]({},_0x46fc75,_0x45fe90[_0xc008('0x34')]);return _0x3c3ead['getLists'](_0x46fc75);}})['then'](function(_0x5035ca){if(_0x5035ca){_0x3c8a79=_0x5035ca['length'];if(!_0x45fe90[_0xc008('0x26')][_0xc008('0x4d')]('nolimit')){_0x46fc75[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x45fe90[_0xc008('0x26')][_0xc008('0x4f')]);_0x46fc75[_0xc008('0x10')]=qs['offset'](_0x45fe90['query'][_0xc008('0x10')]);}return _0x3c3ead[_0xc008('0x8c')](_0x46fc75);}})[_0xc008('0x15')](function(_0x46f9ab){if(_0x46f9ab){return _0x46f9ab?{'count':_0x3c8a79,'rows':_0x46f9ab}:null;}})[_0xc008('0x15')](respondWithResult(_0xc046ce,null))[_0xc008('0x29')](handleError(_0xc046ce,null));};exports[_0xc008('0x8e')]=function(_0x5645bb,_0x2ebe07){var _0x3d6f0d=moment()[_0xc008('0x6e')](_0xc008('0x8f'));var _0x3be328,_0x3bcf94;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5645bb['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2ebe07,null))[_0xc008('0x15')](function(_0x11bcba){if(_0x11bcba){_0x3bcf94=_0x11bcba;return _0x11bcba[_0xc008('0x8e')](_0x5645bb[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5645bb[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0xefba5){var _0x202826;_0x3be328=_0xefba5||[];var _0x37e1f2=[];if(_0xefba5){for(var _0x5161f3=0x0;_0x5161f3<_0xefba5['length'];_0x5161f3+=0x1){var _0x43ec81=_0xefba5[_0x5161f3][_0xc008('0x3a')]({'plain':!![]});_0x3bcf94[_0xc008('0x90')]=_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]?_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]:_0x3bcf94['dialCheckDuplicateType'];switch(_0x3bcf94['dialCheckDuplicateType']){case'always':_0x202826=squel[_0xc008('0x91')]()['into']('cm_hopper')['fromQuery']([_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','scheduledAt')['field']('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),'VoiceQueueId')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')['field']('\x27'+_0x3d6f0d+'\x27','updatedAt')['from'](_0xc008('0x99'))['where'](_0xc008('0x9a'))[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81['CmListId']['toString']())[_0xc008('0x24')](_0xc008('0x9c'))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x9e'))[_0xc008('0x76')](_0xc008('0x9f'))[_0xc008('0x24')](_0xc008('0x7a'),_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')]()))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0xc008('0x76')](_0xc008('0xa0'))[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id']['toString']())))['toString']();break;case _0xc008('0xa1'):_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x93'),'ContactId',_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0x92'),_0xc008('0x92'))['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))[_0xc008('0x96')]('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81['CmListId'][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),_0xc008('0x52'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where'](_0xc008('0x9a'))['where']('ListId\x20=\x20?',_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL')[_0xc008('0x24')](_0xc008('0x9d'),squel['select']()[_0xc008('0x96')](_0xc008('0xa4'))['from']('cm_hopper')[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id'][_0xc008('0x98')]())))['toString']();break;default:_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),'scheduledAt','ContactId',_0xc008('0x95'),'VoiceQueueId',_0xc008('0x46'),'updatedAt'],squel['select']()['field'](_0xc008('0x92'),'phone')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))['field']('id','ContactId')[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))['field'](_0x5645bb['params']['id'][_0xc008('0x98')](),'VoiceQueueId')['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')['from']('cm_contacts')[_0xc008('0x24')]('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x37e1f2[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x202826));}return BPromise[_0xc008('0xa5')](_0x37e1f2);}})[_0xc008('0x15')](function(){var _0x262b79=[];var _0x15c5a2=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa6'))[_0xc008('0xa3')]([_0xc008('0xa7'),'phone',_0xc008('0xa8'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0xa9'))[_0xc008('0x96')](_0xc008('0xaa'))[_0xc008('0x96')](_0xc008('0xab'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')[_0xc008('0x76')](_0xc008('0xac'),'ci')[_0xc008('0xad')](_0xc008('0xa0'),'h',_0xc008('0xae'))[_0xc008('0x24')](_0xc008('0xaf'),_0x3d6f0d)['where'](_0xc008('0xb0'),'PHONE'))[_0xc008('0x98')]();_0x262b79[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x15c5a2));return BPromise[_0xc008('0xa5')](_0x262b79);})[_0xc008('0x15')](function(){return _0x3be328;})[_0xc008('0x15')](respondWithResult(_0x2ebe07,null))[_0xc008('0x29')](handleError(_0x2ebe07,null));};exports[_0xc008('0xb1')]=function(_0x471780,_0x4fae34){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x471780[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x4fae34,null))[_0xc008('0x15')](function(_0x1cc6a6){if(_0x1cc6a6){return _0x1cc6a6[_0xc008('0xb1')](_0x471780[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x471618){if(_0x471618){return db[_0xc008('0x4b')][_0xc008('0x1c')]({'where':{'ListId':_0x471780['query'][_0xc008('0x72')],'VoiceQueueId':_0x471780['params']['id']}})[_0xc008('0x15')](function(){return _0x471618;});}})[_0xc008('0x15')](respondWithStatusCode(_0x4fae34,null))[_0xc008('0x29')](handleError(_0x4fae34,null));};exports[_0xc008('0xb2')]=function(_0x370234,_0x3ff7d2){var _0x478794={};var _0x406de6={};var _0x34cbce;var _0x337acd;return db['VoiceQueue']['findOne']({'where':{'id':_0x370234['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3ff7d2,null))[_0xc008('0x15')](function(_0x2ccfcf){if(_0x2ccfcf){_0x34cbce=_0x2ccfcf;_0x406de6[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x406de6['query']=_[_0xc008('0x2c')](_0x370234[_0xc008('0x26')]);_0x406de6[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],_0x406de6['query']);_0x478794[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x370234[_0xc008('0x26')][_0xc008('0x30')]));_0x478794[_0xc008('0x31')]=_0x478794[_0xc008('0x31')][_0xc008('0x4c')]?_0x478794[_0xc008('0x31')]:_0x406de6[_0xc008('0x2e')];_0x478794['order']=qs[_0xc008('0x50')](_0x370234['query'][_0xc008('0x50')]);_0x478794[_0xc008('0x24')]=qs[_0xc008('0x2d')](_['pick'](_0x370234[_0xc008('0x26')],_0x406de6['filters']));if(_0x370234[_0xc008('0x26')][_0xc008('0x53')]){_0x478794[_0xc008('0x24')]=_[_0xc008('0x33')](_0x478794[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x478794[_0xc008('0x31')],function(_0x89601c){var _0x22bb2a={};_0x22bb2a[_0x89601c]={'$like':'%'+_0x370234[_0xc008('0x26')]['filter']+'%'};return _0x22bb2a;})});}_0x478794=_[_0xc008('0x33')]({},_0x478794,_0x370234['options']);return _0x34cbce['getBlackLists'](_0x478794);}})[_0xc008('0x15')](function(_0x55ad1f){if(_0x55ad1f){_0x337acd=_0x55ad1f[_0xc008('0x4c')];if(!_0x370234[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x478794['limit']=qs[_0xc008('0x4f')](_0x370234[_0xc008('0x26')][_0xc008('0x4f')]);_0x478794[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x370234['query'][_0xc008('0x10')]);}return _0x34cbce[_0xc008('0xb2')](_0x478794);}})['then'](function(_0x247e3a){if(_0x247e3a){return _0x247e3a?{'count':_0x337acd,'rows':_0x247e3a}:null;}})[_0xc008('0x15')](respondWithResult(_0x3ff7d2,null))[_0xc008('0x29')](handleError(_0x3ff7d2,null));};exports[_0xc008('0xb3')]=function(_0x252c44,_0x3b46db){var _0x482efd;return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x252c44[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3b46db,null))[_0xc008('0x15')](function(_0x2f217e){if(_0x2f217e){return _0x2f217e[_0xc008('0xb3')](_0x252c44[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x252c44['body'],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0x298783){var _0xe349bd;_0x482efd=_0x298783||[];var _0x50db48=[];if(_0x298783){for(var _0x384f2f=0x0;_0x384f2f<_0x298783[_0xc008('0x4c')];_0x384f2f+=0x1){var _0x367581=_0x298783[_0x384f2f][_0xc008('0x3a')]({'plain':!![]});_0xe349bd=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xb4'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel['select']()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('id',_0xc008('0x94'))['field'](_0x367581[_0xc008('0x97')][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x252c44[_0xc008('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0xc008('0x46'))['field']('NOW()',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where']('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x367581[_0xc008('0x97')][_0xc008('0x98')]())['where'](_0xc008('0x9c')))[_0xc008('0x98')]();_0x50db48['push'](db[_0xc008('0x65')]['query'](_0xe349bd));}return BPromise['all'](_0x50db48);}})[_0xc008('0x15')](function(){return _0x482efd;})[_0xc008('0x15')](respondWithResult(_0x3b46db,null))['catch'](handleError(_0x3b46db,null));};exports['removeBlackLists']=function(_0x1e3098,_0x9b997d){return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1e3098['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x9b997d,null))[_0xc008('0x15')](function(_0x1422ab){if(_0x1422ab){return _0x1422ab[_0xc008('0xb5')](_0x1e3098[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x41a8a6){if(_0x41a8a6){return db['CmHopperBlack'][_0xc008('0x1c')]({'where':{'ListId':_0x1e3098['query'][_0xc008('0x72')],'VoiceQueueId':_0x1e3098['params']['id']}})['then'](function(){return _0x41a8a6;});}})[_0xc008('0x15')](respondWithStatusCode(_0x9b997d,null))[_0xc008('0x29')](handleError(_0x9b997d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1554c77..b98a4ca 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 _0x6e01=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x43cc92,_0x429f41){var _0x5063f2=function(_0x1a58bf){while(--_0x1a58bf){_0x43cc92['push'](_0x43cc92['shift']());}};_0x5063f2(++_0x429f41);}(_0x6e01,0xaf));var _0x16e0=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x6e01[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0x16e0('0x0'));var VoiceQueue=require(_0x16e0('0x1'))['db'][_0x16e0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x16e0('0x3')](0x0);var events={'afterCreate':_0x16e0('0x4'),'afterUpdate':'update','afterDestroy':_0x16e0('0x5')};function emitEvent(_0x1f9180){return function(_0x5fa901,_0x230a3e,_0x7f9a71){VoiceQueueEvents['emit'](_0x1f9180+':'+_0x5fa901['id'],_0x5fa901);VoiceQueueEvents[_0x16e0('0x6')](_0x1f9180,_0x5fa901);_0x7f9a71(null);};}for(var e in events){if(events[_0x16e0('0x7')](e)){var event=events[e];VoiceQueue[_0x16e0('0x8')](e,emitEvent(event));}}module[_0x16e0('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x1618=['../../mysqldb','VoiceQueue','save','update','remove','emit','hook','exports'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1618,0x1d8));var _0x8161=function(_0xb2e7ed,_0xe7bb03){_0xb2e7ed=_0xb2e7ed-0x0;var _0xfa2cab=_0x1618[_0xb2e7ed];return _0xfa2cab;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x8161('0x0'))['db'][_0x8161('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8161('0x2'),'afterUpdate':_0x8161('0x3'),'afterDestroy':_0x8161('0x4')};function emitEvent(_0x3a2533){return function(_0x3aabd3,_0x2716d6,_0x484491){VoiceQueueEvents['emit'](_0x3a2533+':'+_0x3aabd3['id'],_0x3aabd3);VoiceQueueEvents[_0x8161('0x5')](_0x3a2533,_0x3aabd3);_0x484491(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x8161('0x6')](e,emitEvent(event));}}module[_0x8161('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 509fe5c..9225906 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5574d3,_0x1d1dba){var _0x3e405e=function(_0x532e0f){while(--_0x532e0f){_0x5574d3['push'](_0x5574d3['shift']());}};_0x3e405e(++_0x1d1dba);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x290062,_0x40901e){var _0x5df1ec=function(_0xf8b344){while(--_0xf8b344){_0x290062['push'](_0x290062['shift']());}};_0x5df1ec(++_0x40901e);}(_0x34e8,0x12c));var _0x834e=function(_0x136a35,_0x4ea094){_0x136a35=_0x136a35-0x0;var _0x3ab4f4=_0x34e8[_0x136a35];return _0x3ab4f4;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 4512fde..0fadf0a 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 _0x8098=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueue,\x20%s,\x20%s','result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','debug','ShowVoiceQueue','find','util','moment','randomstring'];(function(_0x264c19,_0x109ae7){var _0x27bf8b=function(_0x25a34a){while(--_0x25a34a){_0x264c19['push'](_0x264c19['shift']());}};_0x27bf8b(++_0x109ae7);}(_0x8098,0x183));var _0x8809=function(_0x22e921,_0x18d725){_0x22e921=_0x22e921-0x0;var _0x23405f=_0x8098[_0x22e921];return _0x23405f;};'use strict';var _=require('lodash');var util=require(_0x8809('0x0'));var moment=require(_0x8809('0x1'));var BPromise=require('bluebird');var rs=require(_0x8809('0x2'));var fs=require('fs');var Redis=require(_0x8809('0x3'));var db=require(_0x8809('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8809('0x5'))('rpc');var config=require(_0x8809('0x6'));var jayson=require(_0x8809('0x7'));var client=jayson[_0x8809('0x8')]['http']({'port':0x232a});config['redis']=_[_0x8809('0x9')](config[_0x8809('0xa')],{'host':_0x8809('0xb'),'port':0x18eb});var socket=require(_0x8809('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x8809('0xd')](socket);function respondWithRpcPromise(_0x297354,_0x1324ac,_0xbdb130){return new BPromise(function(_0x409335,_0xc9c60e){return client[_0x8809('0xe')](_0x297354,_0xbdb130)[_0x8809('0xf')](function(_0x4a53d0){logger[_0x8809('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x1324ac,_0x8809('0x11'));logger['debug'](_0x8809('0x12'),_0x1324ac,'request\x20sent',JSON[_0x8809('0x13')](_0x4a53d0));if(_0x4a53d0[_0x8809('0x14')]){if(_0x4a53d0['error']['code']===0x1f4){logger[_0x8809('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x1324ac,_0x4a53d0[_0x8809('0x14')][_0x8809('0x15')]);return _0xc9c60e(_0x4a53d0['error']['message']);}logger[_0x8809('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x1324ac,_0x4a53d0[_0x8809('0x14')][_0x8809('0x15')]);return _0x409335(_0x4a53d0[_0x8809('0x14')][_0x8809('0x15')]);}else{logger[_0x8809('0x10')](_0x8809('0x16'),_0x1324ac,_0x8809('0x11'));_0x409335(_0x4a53d0[_0x8809('0x17')]['message']);}})[_0x8809('0x18')](function(_0x454c3b){logger[_0x8809('0x14')](_0x8809('0x16'),_0x1324ac,_0x454c3b);_0xc9c60e(_0x454c3b);});});}exports['GetVoiceQueue']=function(_0x5ce452){var _0x448b92=this;return new Promise(function(_0x22a589,_0x58bd4c){return db[_0x8809('0x19')][_0x8809('0x1a')]({'raw':_0x5ce452['options']?_0x5ce452[_0x8809('0x1b')][_0x8809('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ce452['options']?_0x5ce452[_0x8809('0x1b')][_0x8809('0x1d')]||null:null,'attributes':_0x5ce452[_0x8809('0x1b')]?_0x5ce452[_0x8809('0x1b')][_0x8809('0x1e')]||null:null,'limit':_0x5ce452[_0x8809('0x1b')]?_0x5ce452[_0x8809('0x1b')][_0x8809('0x1f')]||null:null,'include':_0x5ce452[_0x8809('0x1b')]?_0x5ce452['options'][_0x8809('0x20')]?_[_0x8809('0x21')](_0x5ce452[_0x8809('0x1b')][_0x8809('0x20')],function(_0x17c6fd){return{'model':db[_0x17c6fd[_0x8809('0x22')]],'as':_0x17c6fd['as'],'attributes':_0x17c6fd[_0x8809('0x1e')],'include':_0x17c6fd[_0x8809('0x20')]?_['map'](_0x17c6fd['include'],function(_0x4e013b){return{'model':db[_0x4e013b[_0x8809('0x22')]],'as':_0x4e013b['as'],'attributes':_0x4e013b[_0x8809('0x1e')],'include':_0x4e013b['include']?_['map'](_0x4e013b[_0x8809('0x20')],function(_0x2e0920){return{'model':db[_0x2e0920[_0x8809('0x22')]],'as':_0x2e0920['as'],'attributes':_0x2e0920[_0x8809('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d0413){logger[_0x8809('0x10')](_0x8809('0x23'),_0x5ce452);logger[_0x8809('0x24')](_0x8809('0x23'),_0x5ce452,JSON[_0x8809('0x13')](_0x3d0413));_0x22a589(_0x3d0413);})[_0x8809('0x18')](function(_0x123415){logger[_0x8809('0x14')](_0x8809('0x23'),_0x123415[_0x8809('0x15')],_0x5ce452);_0x58bd4c(_0x448b92['error'](0x1f4,_0x123415[_0x8809('0x15')]));});});};exports[_0x8809('0x25')]=function(_0x40f518){var _0x4d4422=this;return new Promise(function(_0x1ad27a,_0x350b96){return db['VoiceQueue'][_0x8809('0x26')]({'raw':_0x40f518['options']?_0x40f518['options'][_0x8809('0x1c')]===undefined?!![]:![]:!![],'where':_0x40f518['options']?_0x40f518[_0x8809('0x1b')][_0x8809('0x1d')]||null:null,'attributes':_0x40f518[_0x8809('0x1b')]?_0x40f518[_0x8809('0x1b')][_0x8809('0x1e')]||null:null,'include':_0x40f518[_0x8809('0x1b')]?_0x40f518[_0x8809('0x1b')][_0x8809('0x20')]?_[_0x8809('0x21')](_0x40f518['options'][_0x8809('0x20')],function(_0x173da9){return{'model':db[_0x173da9['model']],'as':_0x173da9['as'],'attributes':_0x173da9[_0x8809('0x1e')],'include':_0x173da9[_0x8809('0x20')]?_['map'](_0x173da9[_0x8809('0x20')],function(_0x6a2171){return{'model':db[_0x6a2171[_0x8809('0x22')]],'as':_0x6a2171['as'],'attributes':_0x6a2171[_0x8809('0x1e')],'include':_0x6a2171[_0x8809('0x20')]?_['map'](_0x6a2171['include'],function(_0xef1c18){return{'model':db[_0xef1c18[_0x8809('0x22')]],'as':_0xef1c18['as'],'attributes':_0xef1c18['attributes']};}):[]};}):[]};}):[]:[]})[_0x8809('0xf')](function(_0x1fabad){logger[_0x8809('0x10')](_0x8809('0x25'),_0x40f518);logger[_0x8809('0x24')]('ShowVoiceQueue',_0x40f518,JSON[_0x8809('0x13')](_0x1fabad));_0x1ad27a(_0x1fabad);})[_0x8809('0x18')](function(_0x570b4b){logger['error'](_0x8809('0x25'),_0x570b4b[_0x8809('0x15')],_0x40f518);_0x350b96(_0x4d4422[_0x8809('0x14')](0x1f4,_0x570b4b['message']));});});}; \ No newline at end of file +var _0x2a75=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','catch','VoiceQueue','findAll','options','raw','attributes','include','model','map','GetVoiceQueue','find','where','ShowVoiceQueue','debug','util','moment','bluebird','randomstring','ioredis'];(function(_0x59a55b,_0x584ea6){var _0x2c3357=function(_0x878752){while(--_0x878752){_0x59a55b['push'](_0x59a55b['shift']());}};_0x2c3357(++_0x584ea6);}(_0x2a75,0x1e9));var _0x52a7=function(_0x579dec,_0x29684e){_0x579dec=_0x579dec-0x0;var _0x2b72f9=_0x2a75[_0x579dec];return _0x2b72f9;};'use strict';var _=require('lodash');var util=require(_0x52a7('0x0'));var moment=require(_0x52a7('0x1'));var BPromise=require(_0x52a7('0x2'));var rs=require(_0x52a7('0x3'));var fs=require('fs');var Redis=require(_0x52a7('0x4'));var db=require(_0x52a7('0x5'))['db'];var utils=require(_0x52a7('0x6'));var logger=require('../../config/logger')(_0x52a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x52a7('0x8'));var client=jayson[_0x52a7('0x9')][_0x52a7('0xa')]({'port':0x232a});config[_0x52a7('0xb')]=_[_0x52a7('0xc')](config[_0x52a7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x52a7('0xd'))(new Redis(config['redis']));require(_0x52a7('0xe'))[_0x52a7('0xf')](socket);function respondWithRpcPromise(_0x266c9c,_0x385356,_0x2f1d66){return new BPromise(function(_0x464083,_0x172ecb){return client[_0x52a7('0x10')](_0x266c9c,_0x2f1d66)[_0x52a7('0x11')](function(_0x2c44cc){logger[_0x52a7('0x12')](_0x52a7('0x13'),_0x385356,_0x52a7('0x14'));logger['debug'](_0x52a7('0x15'),_0x385356,_0x52a7('0x14'),JSON['stringify'](_0x2c44cc));if(_0x2c44cc[_0x52a7('0x16')]){if(_0x2c44cc[_0x52a7('0x16')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x385356,_0x2c44cc[_0x52a7('0x16')]['message']);return _0x172ecb(_0x2c44cc['error'][_0x52a7('0x17')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x385356,_0x2c44cc[_0x52a7('0x16')]['message']);return _0x464083(_0x2c44cc[_0x52a7('0x16')][_0x52a7('0x17')]);}else{logger[_0x52a7('0x12')](_0x52a7('0x13'),_0x385356,'request\x20sent');_0x464083(_0x2c44cc['result']['message']);}})[_0x52a7('0x18')](function(_0x4d1c28){logger[_0x52a7('0x16')](_0x52a7('0x13'),_0x385356,_0x4d1c28);_0x172ecb(_0x4d1c28);});});}exports['GetVoiceQueue']=function(_0x58d715){var _0x292ae4=this;return new Promise(function(_0x14e473,_0x3028c5){return db[_0x52a7('0x19')][_0x52a7('0x1a')]({'raw':_0x58d715['options']?_0x58d715[_0x52a7('0x1b')][_0x52a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x58d715['options']?_0x58d715[_0x52a7('0x1b')]['where']||null:null,'attributes':_0x58d715[_0x52a7('0x1b')]?_0x58d715['options'][_0x52a7('0x1d')]||null:null,'limit':_0x58d715[_0x52a7('0x1b')]?_0x58d715[_0x52a7('0x1b')]['limit']||null:null,'include':_0x58d715[_0x52a7('0x1b')]?_0x58d715[_0x52a7('0x1b')][_0x52a7('0x1e')]?_['map'](_0x58d715[_0x52a7('0x1b')][_0x52a7('0x1e')],function(_0x5590a1){return{'model':db[_0x5590a1[_0x52a7('0x1f')]],'as':_0x5590a1['as'],'attributes':_0x5590a1[_0x52a7('0x1d')],'include':_0x5590a1[_0x52a7('0x1e')]?_['map'](_0x5590a1[_0x52a7('0x1e')],function(_0x28b230){return{'model':db[_0x28b230[_0x52a7('0x1f')]],'as':_0x28b230['as'],'attributes':_0x28b230[_0x52a7('0x1d')],'include':_0x28b230[_0x52a7('0x1e')]?_[_0x52a7('0x20')](_0x28b230[_0x52a7('0x1e')],function(_0x40943f){return{'model':db[_0x40943f[_0x52a7('0x1f')]],'as':_0x40943f['as'],'attributes':_0x40943f[_0x52a7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x52a7('0x11')](function(_0x5482f2){logger[_0x52a7('0x12')](_0x52a7('0x21'),_0x58d715);logger['debug'](_0x52a7('0x21'),_0x58d715,JSON['stringify'](_0x5482f2));_0x14e473(_0x5482f2);})[_0x52a7('0x18')](function(_0x43145f){logger[_0x52a7('0x16')](_0x52a7('0x21'),_0x43145f['message'],_0x58d715);_0x3028c5(_0x292ae4[_0x52a7('0x16')](0x1f4,_0x43145f[_0x52a7('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x2f2158){var _0x428a46=this;return new Promise(function(_0x5272c8,_0x2dc3d0){return db[_0x52a7('0x19')][_0x52a7('0x22')]({'raw':_0x2f2158[_0x52a7('0x1b')]?_0x2f2158[_0x52a7('0x1b')][_0x52a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f2158[_0x52a7('0x1b')]?_0x2f2158[_0x52a7('0x1b')][_0x52a7('0x23')]||null:null,'attributes':_0x2f2158[_0x52a7('0x1b')]?_0x2f2158[_0x52a7('0x1b')]['attributes']||null:null,'include':_0x2f2158[_0x52a7('0x1b')]?_0x2f2158['options']['include']?_[_0x52a7('0x20')](_0x2f2158[_0x52a7('0x1b')]['include'],function(_0x12624e){return{'model':db[_0x12624e[_0x52a7('0x1f')]],'as':_0x12624e['as'],'attributes':_0x12624e[_0x52a7('0x1d')],'include':_0x12624e[_0x52a7('0x1e')]?_['map'](_0x12624e['include'],function(_0x46e875){return{'model':db[_0x46e875[_0x52a7('0x1f')]],'as':_0x46e875['as'],'attributes':_0x46e875[_0x52a7('0x1d')],'include':_0x46e875['include']?_[_0x52a7('0x20')](_0x46e875['include'],function(_0x5a632b){return{'model':db[_0x5a632b[_0x52a7('0x1f')]],'as':_0x5a632b['as'],'attributes':_0x5a632b['attributes']};}):[]};}):[]};}):[]:[]})[_0x52a7('0x11')](function(_0x7fafe8){logger[_0x52a7('0x12')](_0x52a7('0x24'),_0x2f2158);logger[_0x52a7('0x25')](_0x52a7('0x24'),_0x2f2158,JSON['stringify'](_0x7fafe8));_0x5272c8(_0x7fafe8);})[_0x52a7('0x18')](function(_0xc18403){logger['error'](_0x52a7('0x24'),_0xc18403['message'],_0x2f2158);_0x2dc3d0(_0x428a46[_0x52a7('0x16')](0x1f4,_0xc18403[_0x52a7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index fe78356..8a9f51e 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 _0xb565=['voiceQueue:','./voiceQueue.events','save','remove','emit','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb565,0xcc));var _0x5b56=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xb565[_0x1406ae];return _0x23a076;};'use strict';var VoiceQueueEvents=require(_0x5b56('0x0'));var events=[_0x5b56('0x1'),_0x5b56('0x2'),'update'];function createListener(_0x25efab,_0x5321bb){return function(_0x1df9b4){_0x5321bb[_0x5b56('0x3')](_0x25efab,_0x1df9b4);};}function removeListener(_0x423078,_0x22d835){return function(){VoiceQueueEvents['removeListener'](_0x423078,_0x22d835);};}exports[_0x5b56('0x4')]=function(_0x2afdf6){for(var _0x1f6159=0x0,_0x40e4b6=events[_0x5b56('0x5')];_0x1f6159<_0x40e4b6;_0x1f6159++){var _0x1c9ead=events[_0x1f6159];var _0x3258cf=createListener(_0x5b56('0x6')+_0x1c9ead,_0x2afdf6);VoiceQueueEvents['on'](_0x1c9ead,_0x3258cf);}}; \ No newline at end of file +var _0x8a89=['remove','update','emit','removeListener','register','length','./voiceQueue.events','save'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x8a89,0xb6));var _0x98a8=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0x8a89[_0x4e0eb6];return _0x46e432;};'use strict';var VoiceQueueEvents=require(_0x98a8('0x0'));var events=[_0x98a8('0x1'),_0x98a8('0x2'),_0x98a8('0x3')];function createListener(_0x1beced,_0x5498d0){return function(_0x32ffc8){_0x5498d0[_0x98a8('0x4')](_0x1beced,_0x32ffc8);};}function removeListener(_0x4e8b1b,_0x4c19cd){return function(){VoiceQueueEvents[_0x98a8('0x5')](_0x4e8b1b,_0x4c19cd);};}exports[_0x98a8('0x6')]=function(_0x35d4a1){for(var _0x1caa16=0x0,_0x18db22=events[_0x98a8('0x7')];_0x1caa16<_0x18db22;_0x1caa16++){var _0x29caa2=events[_0x1caa16];var _0x2683f9=createListener('voiceQueue:'+_0x29caa2,_0x35d4a1);VoiceQueueEvents['on'](_0x29caa2,_0x2683f9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 3528e4b..a54156d 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 _0xd786=['Router','fs-extra','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd786,0x171));var _0x6d78=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd786[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var path=require(_0x6d78('0x2'));var timeout=require(_0x6d78('0x3'));var express=require(_0x6d78('0x4'));var router=express[_0x6d78('0x5')]();var fs_extra=require(_0x6d78('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6d78('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6d78('0x8')]);router[_0x6d78('0x9')](_0x6d78('0xa'),auth[_0x6d78('0xb')](),controller[_0x6d78('0xc')]);router['get'](_0x6d78('0xd'),auth[_0x6d78('0xb')](),controller[_0x6d78('0xe')]);router['get'](_0x6d78('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d78('0x10')]('/',auth[_0x6d78('0xb')](),controller['create']);router[_0x6d78('0x11')](_0x6d78('0xf'),auth[_0x6d78('0xb')](),controller[_0x6d78('0x12')]);router[_0x6d78('0x13')](_0x6d78('0xf'),auth[_0x6d78('0xb')](),controller[_0x6d78('0x14')]);module[_0x6d78('0x15')]=router; \ No newline at end of file +var _0xf8af=['get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','post','create','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x48a6ff,_0x2fcbf8){var _0x5cb6c3=function(_0x3b0faf){while(--_0x3b0faf){_0x48a6ff['push'](_0x48a6ff['shift']());}};_0x5cb6c3(++_0x2fcbf8);}(_0xf8af,0x90));var _0xff8a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf8af[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xff8a('0x0'));var util=require(_0xff8a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xff8a('0x2'));var router=express[_0xff8a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xff8a('0x4'));var interaction=require(_0xff8a('0x5'));var config=require(_0xff8a('0x6'));var controller=require(_0xff8a('0x7'));router[_0xff8a('0x8')]('/',auth[_0xff8a('0x9')](),controller[_0xff8a('0xa')]);router[_0xff8a('0x8')](_0xff8a('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xff8a('0x8')](_0xff8a('0xc'),auth[_0xff8a('0x9')](),controller[_0xff8a('0xd')]);router['get'](_0xff8a('0xe'),auth[_0xff8a('0x9')](),controller['show']);router[_0xff8a('0xf')]('/',auth[_0xff8a('0x9')](),controller[_0xff8a('0x10')]);router['put'](_0xff8a('0xe'),auth[_0xff8a('0x9')](),controller['update']);router[_0xff8a('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xff8a('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 932815b..6f36ee7 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 _0x9634=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','STRING','DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','INTEGER','BOOLEAN'];(function(_0x4787f6,_0x5b95fb){var _0x3f2457=function(_0x51685f){while(--_0x51685f){_0x4787f6['push'](_0x4787f6['shift']());}};_0x3f2457(++_0x5b95fb);}(_0x9634,0x123));var _0x4963=function(_0x547bbd,_0x256130){_0x547bbd=_0x547bbd-0x0;var _0x54def7=_0x9634[_0x547bbd];return _0x54def7;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4963('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4963('0x0')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x4963('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0x4963('0x1')],'set':function(_0x3c6605){var _0x28542b=moment(_0x3c6605);var _0x529174=moment(this[_0x4963('0x2')](_0x4963('0x3')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3ce170=_0x28542b[_0x4963('0x4')](_0x529174,_0x4963('0x5'));this[_0x4963('0x6')]('queuecallerleaveAt',_0x3c6605);this[_0x4963('0x6')]('holdtime',_0x3ce170||null);}},'position':{'type':Sequelize[_0x4963('0x7')]},'count':{'type':Sequelize[_0x4963('0x7')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4963('0x1')]},'queuecallercomplete':{'type':Sequelize[_0x4963('0x8')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4963('0x1')]},'queuecallerexit':{'type':Sequelize[_0x4963('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4963('0x1')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x4963('0x9')},'originalposition':{'type':Sequelize[_0x4963('0x7')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4963('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4963('0x0')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x4963('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4963('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4963('0x0')]},'transfer':{'type':Sequelize[_0x4963('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4963('0x0')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4963('0x0')]},'transferuniqueid':{'type':Sequelize[_0x4963('0x0')]},'disposition':{'type':Sequelize[_0x4963('0x0')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4963('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0x4963('0x7')],'defaultValue':0x0},'note':{'type':Sequelize[_0x4963('0x0')]}}; \ No newline at end of file +var _0xd741=['DATE','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x4d4ddb,_0x141953){var _0x2d6e6f=function(_0x197a27){while(--_0x197a27){_0x4d4ddb['push'](_0x4d4ddb['shift']());}};_0x2d6e6f(++_0x141953);}(_0xd741,0x6a));var _0x1d74=function(_0x53b5f2,_0x1ad2a3){_0x53b5f2=_0x53b5f2-0x0;var _0x6daa1=_0xd741[_0x53b5f2];return _0x6daa1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1d74('0x0'));module[_0x1d74('0x1')]={'type':{'type':Sequelize[_0x1d74('0x2')]},'uniqueid':{'type':Sequelize[_0x1d74('0x2')]},'calleridnum':{'type':Sequelize[_0x1d74('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1d74('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x221504){var _0x25a21a=moment(_0x221504);var _0xeaa4db=moment(this['getDataValue']('queuecallerjoinAt'))[_0x1d74('0x3')](_0x1d74('0x4'));var _0x41e762=_0x25a21a[_0x1d74('0x5')](_0xeaa4db,'seconds');this[_0x1d74('0x6')](_0x1d74('0x7'),_0x221504);this['setDataValue'](_0x1d74('0x8'),_0x41e762||null);}},'position':{'type':Sequelize[_0x1d74('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1d74('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1d74('0xb')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x1d74('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1d74('0xb')]},'queuecallerexitreason':{'type':Sequelize[_0x1d74('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x1d74('0x9')]},'channel':{'type':Sequelize[_0x1d74('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1d74('0x2')]},'exten':{'type':Sequelize[_0x1d74('0x2')]},'priority':{'type':Sequelize[_0x1d74('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x1d74('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1d74('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1d74('0x2')]},'transfer':{'type':Sequelize[_0x1d74('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1d74('0x2')],'comment':_0x1d74('0xc')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x1d74('0x2')]},'disposition':{'type':Sequelize[_0x1d74('0x2')]},'secondDisposition':{'type':Sequelize[_0x1d74('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1d74('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x1d74('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1d74('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a08b260..a1e0a62 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 _0x0440=['name','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','getVoiceQueuesReport','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack'];(function(_0x248d1e,_0x26caa1){var _0x3d0745=function(_0x5b110e){while(--_0x5b110e){_0x248d1e['push'](_0x248d1e['shift']());}};_0x3d0745(++_0x26caa1);}(_0x0440,0x75));var _0x0044=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x0440[_0x10df1e];return _0x3e24fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0044('0x0'));var jsonpatch=require(_0x0044('0x1'));var rp=require('request-promise');var moment=require(_0x0044('0x2'));var BPromise=require(_0x0044('0x3'));var Mustache=require(_0x0044('0x4'));var util=require('util');var path=require(_0x0044('0x5'));var sox=require(_0x0044('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0044('0x7'));var _=require(_0x0044('0x8'));var squel=require(_0x0044('0x9'));var crypto=require(_0x0044('0xa'));var jsforce=require(_0x0044('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0044('0xc'));var querystring=require(_0x0044('0xd'));var Papa=require(_0x0044('0xe'));var Redis=require(_0x0044('0xf'));var authService=require(_0x0044('0x10'));var qs=require(_0x0044('0x11'));var as=require(_0x0044('0x12'));var hardwareService=require(_0x0044('0x13'));var logger=require('../../config/logger')(_0x0044('0x14'));var utils=require(_0x0044('0x15'));var config=require(_0x0044('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0044('0x17'))['db'];config[_0x0044('0x18')]=_['defaults'](config[_0x0044('0x18')],{'host':_0x0044('0x19'),'port':0x18eb});var socket=require(_0x0044('0x1a'))(new Redis(config[_0x0044('0x18')]));require('./voiceQueueReport.socket')[_0x0044('0x1b')](socket);function respondWithStatusCode(_0x59f5cc,_0x3d2098){_0x3d2098=_0x3d2098||0xcc;return function(_0x551145){if(_0x551145){return _0x59f5cc[_0x0044('0x1c')](_0x3d2098);}return _0x59f5cc[_0x0044('0x1d')](_0x3d2098)[_0x0044('0x1e')]();};}function respondWithResult(_0x581270,_0x24edc6){_0x24edc6=_0x24edc6||0xc8;return function(_0xa730f4){if(_0xa730f4){return _0x581270['status'](_0x24edc6)[_0x0044('0x1f')](_0xa730f4);}};}function respondWithFilteredResult(_0x1a7b23,_0x1c21a3){return function(_0x255fbb){if(_0x255fbb){var _0x58e572=typeof _0x1c21a3[_0x0044('0x20')]===_0x0044('0x21')&&typeof _0x1c21a3[_0x0044('0x22')]===_0x0044('0x21');var _0x259136=_0x255fbb[_0x0044('0x23')];var _0x4e8d6b=_0x58e572?0x0:_0x1c21a3['offset'];var _0x86d35d=_0x58e572?_0x255fbb[_0x0044('0x23')]:_0x1c21a3[_0x0044('0x20')]+_0x1c21a3[_0x0044('0x22')];var _0x39b011;if(_0x86d35d>=_0x259136){_0x86d35d=_0x259136;_0x39b011=0xc8;}else{_0x39b011=0xce;}_0x1a7b23['status'](_0x39b011);return _0x1a7b23[_0x0044('0x24')](_0x0044('0x25'),_0x4e8d6b+'-'+_0x86d35d+'/'+_0x259136)[_0x0044('0x1f')](_0x255fbb);}return null;};}function patchUpdates(_0xc71d07){return function(_0x35c2b0){try{jsonpatch[_0x0044('0x26')](_0x35c2b0,_0xc71d07,!![]);}catch(_0x440810){return BPromise['reject'](_0x440810);}return _0x35c2b0[_0x0044('0x27')]();};}function saveUpdates(_0x2b31af,_0x316988){return function(_0x4a0b12){if(_0x4a0b12){return _0x4a0b12[_0x0044('0x28')](_0x2b31af)['then'](function(_0x13f026){return _0x13f026;});}return null;};}function removeEntity(_0x365718,_0x3e458f){return function(_0x252dbe){if(_0x252dbe){return _0x252dbe[_0x0044('0x29')]()[_0x0044('0x2a')](function(){_0x365718[_0x0044('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2379e4,_0x51e63d){return function(_0x1c264c){if(!_0x1c264c){_0x2379e4[_0x0044('0x1c')](0x194);}return _0x1c264c;};}function handleError(_0x20a881,_0x3ab3c0){_0x3ab3c0=_0x3ab3c0||0x1f4;return function(_0x16f0ab){logger[_0x0044('0x2b')](_0x16f0ab[_0x0044('0x2c')]);if(_0x16f0ab['name']){delete _0x16f0ab[_0x0044('0x2d')];}_0x20a881[_0x0044('0x1d')](_0x3ab3c0)['send'](_0x16f0ab);};}exports[_0x0044('0x2e')]=function(_0x176734,_0x21cbb7){var _0x3b35dd={},_0x3cd012={},_0x6b5aa0={'count':0x0,'rows':[]};var _0x5b43ca=_[_0x0044('0x2f')](db['VoiceQueueReport'][_0x0044('0x30')],function(_0x4a2deb){return{'name':_0x4a2deb[_0x0044('0x31')],'type':_0x4a2deb[_0x0044('0x32')]['key']};});_0x3cd012['model']=_[_0x0044('0x2f')](_0x5b43ca,'name');_0x3cd012[_0x0044('0x33')]=_[_0x0044('0x34')](_0x176734[_0x0044('0x33')]);_0x3cd012[_0x0044('0x35')]=_['intersection'](_0x3cd012[_0x0044('0x36')],_0x3cd012[_0x0044('0x33')]);_0x3b35dd[_0x0044('0x37')]=_[_0x0044('0x38')](_0x3cd012[_0x0044('0x36')],qs['fields'](_0x176734[_0x0044('0x33')][_0x0044('0x39')]));_0x3b35dd[_0x0044('0x37')]=_0x3b35dd[_0x0044('0x37')][_0x0044('0x3a')]?_0x3b35dd['attributes']:_0x3cd012[_0x0044('0x36')];if(!_0x176734[_0x0044('0x33')][_0x0044('0x3b')](_0x0044('0x3c'))){_0x3b35dd['limit']=qs[_0x0044('0x22')](_0x176734['query'][_0x0044('0x22')]);_0x3b35dd[_0x0044('0x20')]=qs[_0x0044('0x20')](_0x176734[_0x0044('0x33')][_0x0044('0x20')]);}_0x3b35dd[_0x0044('0x3d')]=qs[_0x0044('0x3e')](_0x176734[_0x0044('0x33')][_0x0044('0x3e')]);_0x3b35dd[_0x0044('0x3f')]=qs[_0x0044('0x35')](_[_0x0044('0x40')](_0x176734[_0x0044('0x33')],_0x3cd012[_0x0044('0x35')]),_0x5b43ca);if(_0x176734[_0x0044('0x33')][_0x0044('0x41')]){_0x3b35dd[_0x0044('0x3f')]=_[_0x0044('0x42')](_0x3b35dd['where'],{'$or':_[_0x0044('0x2f')](_0x5b43ca,function(_0x53271c){if(_0x53271c['type']!==_0x0044('0x43')){var _0x4c7f44={};_0x4c7f44[_0x53271c['name']]={'$like':'%'+_0x176734[_0x0044('0x33')]['filter']+'%'};return _0x4c7f44;}})});}_0x3b35dd=_[_0x0044('0x42')]({},_0x3b35dd,_0x176734[_0x0044('0x44')]);var _0x34c097={'where':_0x3b35dd[_0x0044('0x3f')]};return db[_0x0044('0x45')][_0x0044('0x23')](_0x34c097)[_0x0044('0x2a')](function(_0x56bce2){_0x6b5aa0[_0x0044('0x23')]=_0x56bce2;if(_0x176734['query'][_0x0044('0x46')]){_0x3b35dd[_0x0044('0x47')]=[{'all':!![]}];}return db[_0x0044('0x45')][_0x0044('0x48')](_0x3b35dd);})['then'](function(_0xa222d2){_0x6b5aa0[_0x0044('0x49')]=_0xa222d2;return _0x6b5aa0;})[_0x0044('0x2a')](respondWithFilteredResult(_0x21cbb7,_0x3b35dd))[_0x0044('0x4a')](handleError(_0x21cbb7,null));};exports[_0x0044('0x4b')]=function(_0x3f5574,_0x66d0dd){var _0x1d54bf={'raw':![],'where':{'id':_0x3f5574[_0x0044('0x4c')]['id']}},_0x4dda1f={};_0x4dda1f['model']=_[_0x0044('0x34')](db[_0x0044('0x45')][_0x0044('0x30')]);_0x4dda1f['query']=_['keys'](_0x3f5574[_0x0044('0x33')]);_0x4dda1f[_0x0044('0x35')]=_[_0x0044('0x38')](_0x4dda1f['model'],_0x4dda1f[_0x0044('0x33')]);_0x1d54bf[_0x0044('0x37')]=_[_0x0044('0x38')](_0x4dda1f[_0x0044('0x36')],qs[_0x0044('0x39')](_0x3f5574[_0x0044('0x33')][_0x0044('0x39')]));_0x1d54bf[_0x0044('0x37')]=_0x1d54bf[_0x0044('0x37')][_0x0044('0x3a')]?_0x1d54bf[_0x0044('0x37')]:_0x4dda1f['model'];if(_0x3f5574[_0x0044('0x33')][_0x0044('0x46')]){_0x1d54bf[_0x0044('0x47')]=[{'all':!![]}];}_0x1d54bf=_[_0x0044('0x42')]({},_0x1d54bf,_0x3f5574[_0x0044('0x44')]);return db[_0x0044('0x45')][_0x0044('0x4d')](_0x1d54bf)['then'](handleEntityNotFound(_0x66d0dd,null))[_0x0044('0x2a')](respondWithResult(_0x66d0dd,null))['catch'](handleError(_0x66d0dd,null));};exports[_0x0044('0x4e')]=function(_0x452275,_0x3c1d65){return db['VoiceQueueReport'][_0x0044('0x4e')](_0x452275[_0x0044('0x4f')],{})['then'](respondWithResult(_0x3c1d65,0xc9))[_0x0044('0x4a')](handleError(_0x3c1d65,null));};exports['update']=function(_0x4aa36a,_0x36428a){if(_0x4aa36a[_0x0044('0x4f')]['id']){delete _0x4aa36a[_0x0044('0x4f')]['id'];}return db['VoiceQueueReport'][_0x0044('0x4d')]({'where':{'id':_0x4aa36a['params']['id']}})[_0x0044('0x2a')](handleEntityNotFound(_0x36428a,null))[_0x0044('0x2a')](saveUpdates(_0x4aa36a[_0x0044('0x4f')],null))[_0x0044('0x2a')](respondWithResult(_0x36428a,null))['catch'](handleError(_0x36428a,null));};exports[_0x0044('0x29')]=function(_0x3f6cd3,_0x11c9c3){return db['VoiceQueueReport']['find']({'where':{'id':_0x3f6cd3[_0x0044('0x4c')]['id']}})[_0x0044('0x2a')](handleEntityNotFound(_0x11c9c3,null))[_0x0044('0x2a')](removeEntity(_0x11c9c3,null))[_0x0044('0x4a')](handleError(_0x11c9c3,null));};exports['describe']=function(_0x42c16f,_0x1f33ff){return db[_0x0044('0x45')]['describe']()[_0x0044('0x2a')](respondWithResult(_0x1f33ff,null))[_0x0044('0x4a')](handleError(_0x1f33ff,null));};exports[_0x0044('0x50')]=function(_0x778fe3,_0x10d4f1){var _0x5b50e2={},_0x59f723={},_0x397812={'count':0x0,'rows':[]};_0x59f723[_0x0044('0x36')]=_[_0x0044('0x34')](db['VoiceQueueReport']['rawAttributes']);_0x59f723[_0x0044('0x33')]=_[_0x0044('0x34')](_0x778fe3[_0x0044('0x33')]);_0x59f723[_0x0044('0x35')]=_['intersection'](_0x59f723[_0x0044('0x36')],_0x59f723[_0x0044('0x33')]);_0x5b50e2[_0x0044('0x37')]=_['intersection'](_0x59f723[_0x0044('0x36')],qs[_0x0044('0x39')](_0x778fe3[_0x0044('0x33')][_0x0044('0x39')]));_0x5b50e2[_0x0044('0x37')]=_0x5b50e2['attributes'][_0x0044('0x3a')]?_0x5b50e2['attributes']:_0x59f723['model'];if(!_0x778fe3[_0x0044('0x33')][_0x0044('0x3b')](_0x0044('0x3c'))){_0x5b50e2[_0x0044('0x22')]=qs[_0x0044('0x22')](_0x778fe3[_0x0044('0x33')][_0x0044('0x22')]);_0x5b50e2[_0x0044('0x20')]=qs[_0x0044('0x20')](_0x778fe3[_0x0044('0x33')][_0x0044('0x20')]);}_0x5b50e2[_0x0044('0x3d')]=qs['sort'](_0x778fe3[_0x0044('0x33')][_0x0044('0x3e')]);_0x5b50e2['where']=qs[_0x0044('0x35')](_[_0x0044('0x40')](_0x778fe3['query'],_0x59f723['filters']));if(_0x778fe3[_0x0044('0x33')]['filter']){_0x5b50e2[_0x0044('0x3f')]=_[_0x0044('0x42')](_0x5b50e2[_0x0044('0x3f')],{'$or':_[_0x0044('0x2f')](_0x5b50e2[_0x0044('0x37')],function(_0x1d6dcf){var _0x3b9059={};_0x3b9059[_0x1d6dcf]={'$like':'%'+_0x778fe3[_0x0044('0x33')]['filter']+'%'};return _0x3b9059;})});}_0x5b50e2=_[_0x0044('0x42')]({},_0x5b50e2,_0x778fe3[_0x0044('0x44')]);var _0x41a989={'where':_0x5b50e2['where']};return db[_0x0044('0x45')][_0x0044('0x23')](_0x41a989)['then'](function(_0x3aeac1){_0x397812[_0x0044('0x23')]=_0x3aeac1;if(_0x778fe3['query'][_0x0044('0x46')]){_0x5b50e2[_0x0044('0x47')]=[{'all':!![]}];}return db[_0x0044('0x45')][_0x0044('0x48')](_0x5b50e2);})[_0x0044('0x2a')](function(_0xbac340){_0x397812['rows']=_0xbac340;return _0x397812;})[_0x0044('0x2a')](respondWithFilteredResult(_0x10d4f1,_0x5b50e2,'getVoiceQueuesReport'))[_0x0044('0x4a')](handleError(_0x10d4f1,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x9487=['pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','rows','params','length','include','find','catch','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where'];(function(_0x2700d5,_0x1b113b){var _0xdc3338=function(_0x1d07ed){while(--_0x1d07ed){_0x2700d5['push'](_0x2700d5['shift']());}};_0xdc3338(++_0x1b113b);}(_0x9487,0x1a1));var _0x7948=function(_0x41e968,_0x11e59f){_0x41e968=_0x41e968-0x0;var _0x930614=_0x9487[_0x41e968];return _0x930614;};'use strict';var emlformat=require(_0x7948('0x0'));var rimraf=require(_0x7948('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7948('0x2'));var rp=require('request-promise');var moment=require(_0x7948('0x3'));var BPromise=require(_0x7948('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7948('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7948('0x6'));var fs=require('fs');var fs_extra=require(_0x7948('0x7'));var _=require('lodash');var squel=require(_0x7948('0x8'));var crypto=require(_0x7948('0x9'));var jsforce=require(_0x7948('0xa'));var deskjs=require(_0x7948('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7948('0xc'));var Papa=require(_0x7948('0xd'));var Redis=require(_0x7948('0xe'));var authService=require(_0x7948('0xf'));var qs=require(_0x7948('0x10'));var as=require(_0x7948('0x11'));var hardwareService=require(_0x7948('0x12'));var logger=require(_0x7948('0x13'))('api');var utils=require(_0x7948('0x14'));var config=require(_0x7948('0x15'));var licenseUtil=require(_0x7948('0x16'));var db=require(_0x7948('0x17'))['db'];config[_0x7948('0x18')]=_[_0x7948('0x19')](config[_0x7948('0x18')],{'host':_0x7948('0x1a'),'port':0x18eb});var socket=require(_0x7948('0x1b'))(new Redis(config[_0x7948('0x18')]));require(_0x7948('0x1c'))[_0x7948('0x1d')](socket);function respondWithStatusCode(_0x37b677,_0x59af12){_0x59af12=_0x59af12||0xcc;return function(_0x42dfde){if(_0x42dfde){return _0x37b677['sendStatus'](_0x59af12);}return _0x37b677[_0x7948('0x1e')](_0x59af12)['end']();};}function respondWithResult(_0x45c87c,_0x1538e9){_0x1538e9=_0x1538e9||0xc8;return function(_0x34c70d){if(_0x34c70d){return _0x45c87c[_0x7948('0x1e')](_0x1538e9)[_0x7948('0x1f')](_0x34c70d);}};}function respondWithFilteredResult(_0x2b374c,_0x5a76ce){return function(_0x2ee025){if(_0x2ee025){var _0x315ac9=typeof _0x5a76ce['offset']===_0x7948('0x20')&&typeof _0x5a76ce[_0x7948('0x21')]==='undefined';var _0x16e71b=_0x2ee025[_0x7948('0x22')];var _0x2caf63=_0x315ac9?0x0:_0x5a76ce['offset'];var _0x48e556=_0x315ac9?_0x2ee025[_0x7948('0x22')]:_0x5a76ce['offset']+_0x5a76ce[_0x7948('0x21')];var _0x440d19;if(_0x48e556>=_0x16e71b){_0x48e556=_0x16e71b;_0x440d19=0xc8;}else{_0x440d19=0xce;}_0x2b374c['status'](_0x440d19);return _0x2b374c[_0x7948('0x23')](_0x7948('0x24'),_0x2caf63+'-'+_0x48e556+'/'+_0x16e71b)['json'](_0x2ee025);}return null;};}function patchUpdates(_0x536a69){return function(_0x4b2c78){try{jsonpatch['apply'](_0x4b2c78,_0x536a69,!![]);}catch(_0x5bf9){return BPromise['reject'](_0x5bf9);}return _0x4b2c78[_0x7948('0x25')]();};}function saveUpdates(_0x4b4f46,_0x37d408){return function(_0xd1a84e){if(_0xd1a84e){return _0xd1a84e[_0x7948('0x26')](_0x4b4f46)[_0x7948('0x27')](function(_0x2fb985){return _0x2fb985;});}return null;};}function removeEntity(_0x465dcf,_0x1b3e7c){return function(_0x3f9d31){if(_0x3f9d31){return _0x3f9d31['destroy']()['then'](function(){_0x465dcf[_0x7948('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x209f9e,_0x52bdec){return function(_0x23f47c){if(!_0x23f47c){_0x209f9e[_0x7948('0x28')](0x194);}return _0x23f47c;};}function handleError(_0x101a9,_0x46e9f3){_0x46e9f3=_0x46e9f3||0x1f4;return function(_0x4591c3){logger['error'](_0x4591c3[_0x7948('0x29')]);if(_0x4591c3['name']){delete _0x4591c3[_0x7948('0x2a')];}_0x101a9['status'](_0x46e9f3)[_0x7948('0x2b')](_0x4591c3);};}exports[_0x7948('0x2c')]=function(_0x39d294,_0x19ee35){var _0x43e91c={},_0x2f730f={},_0x14b251={'count':0x0,'rows':[]};var _0xc8c9ad=_[_0x7948('0x2d')](db['VoiceQueueReport'][_0x7948('0x2e')],function(_0x4e06f6){return{'name':_0x4e06f6[_0x7948('0x2f')],'type':_0x4e06f6[_0x7948('0x30')][_0x7948('0x31')]};});_0x2f730f[_0x7948('0x32')]=_['map'](_0xc8c9ad,_0x7948('0x2a'));_0x2f730f[_0x7948('0x33')]=_[_0x7948('0x34')](_0x39d294[_0x7948('0x33')]);_0x2f730f[_0x7948('0x35')]=_[_0x7948('0x36')](_0x2f730f['model'],_0x2f730f[_0x7948('0x33')]);_0x43e91c[_0x7948('0x37')]=_[_0x7948('0x36')](_0x2f730f[_0x7948('0x32')],qs[_0x7948('0x38')](_0x39d294[_0x7948('0x33')][_0x7948('0x38')]));_0x43e91c[_0x7948('0x37')]=_0x43e91c['attributes']['length']?_0x43e91c[_0x7948('0x37')]:_0x2f730f[_0x7948('0x32')];if(!_0x39d294[_0x7948('0x33')][_0x7948('0x39')](_0x7948('0x3a'))){_0x43e91c['limit']=qs['limit'](_0x39d294['query'][_0x7948('0x21')]);_0x43e91c[_0x7948('0x3b')]=qs[_0x7948('0x3b')](_0x39d294[_0x7948('0x33')][_0x7948('0x3b')]);}_0x43e91c[_0x7948('0x3c')]=qs[_0x7948('0x3d')](_0x39d294[_0x7948('0x33')][_0x7948('0x3d')]);_0x43e91c[_0x7948('0x3e')]=qs[_0x7948('0x35')](_[_0x7948('0x3f')](_0x39d294[_0x7948('0x33')],_0x2f730f[_0x7948('0x35')]),_0xc8c9ad);if(_0x39d294[_0x7948('0x33')][_0x7948('0x40')]){_0x43e91c[_0x7948('0x3e')]=_[_0x7948('0x41')](_0x43e91c[_0x7948('0x3e')],{'$or':_[_0x7948('0x2d')](_0xc8c9ad,function(_0x3bb7b5){if(_0x3bb7b5[_0x7948('0x30')]!==_0x7948('0x42')){var _0xb0c71f={};_0xb0c71f[_0x3bb7b5[_0x7948('0x2a')]]={'$like':'%'+_0x39d294[_0x7948('0x33')][_0x7948('0x40')]+'%'};return _0xb0c71f;}})});}_0x43e91c=_[_0x7948('0x41')]({},_0x43e91c,_0x39d294[_0x7948('0x43')]);var _0x282d6f={'where':_0x43e91c[_0x7948('0x3e')]};return db[_0x7948('0x44')][_0x7948('0x22')](_0x282d6f)['then'](function(_0x6ff662){_0x14b251[_0x7948('0x22')]=_0x6ff662;if(_0x39d294[_0x7948('0x33')][_0x7948('0x45')]){_0x43e91c['include']=[{'all':!![]}];}return db[_0x7948('0x44')]['findAll'](_0x43e91c);})['then'](function(_0xd152ad){_0x14b251[_0x7948('0x46')]=_0xd152ad;return _0x14b251;})[_0x7948('0x27')](respondWithFilteredResult(_0x19ee35,_0x43e91c))['catch'](handleError(_0x19ee35,null));};exports['show']=function(_0x1932ff,_0x1014b0){var _0x2b3523={'raw':![],'where':{'id':_0x1932ff[_0x7948('0x47')]['id']}},_0xab945e={};_0xab945e['model']=_[_0x7948('0x34')](db[_0x7948('0x44')]['rawAttributes']);_0xab945e[_0x7948('0x33')]=_['keys'](_0x1932ff[_0x7948('0x33')]);_0xab945e[_0x7948('0x35')]=_[_0x7948('0x36')](_0xab945e[_0x7948('0x32')],_0xab945e['query']);_0x2b3523[_0x7948('0x37')]=_[_0x7948('0x36')](_0xab945e[_0x7948('0x32')],qs[_0x7948('0x38')](_0x1932ff['query']['fields']));_0x2b3523[_0x7948('0x37')]=_0x2b3523['attributes'][_0x7948('0x48')]?_0x2b3523[_0x7948('0x37')]:_0xab945e['model'];if(_0x1932ff[_0x7948('0x33')][_0x7948('0x45')]){_0x2b3523[_0x7948('0x49')]=[{'all':!![]}];}_0x2b3523=_[_0x7948('0x41')]({},_0x2b3523,_0x1932ff['options']);return db[_0x7948('0x44')][_0x7948('0x4a')](_0x2b3523)['then'](handleEntityNotFound(_0x1014b0,null))[_0x7948('0x27')](respondWithResult(_0x1014b0,null))[_0x7948('0x4b')](handleError(_0x1014b0,null));};exports[_0x7948('0x4c')]=function(_0x285d01,_0x1d9711){return db[_0x7948('0x44')][_0x7948('0x4c')](_0x285d01[_0x7948('0x4d')],{})[_0x7948('0x27')](respondWithResult(_0x1d9711,0xc9))[_0x7948('0x4b')](handleError(_0x1d9711,null));};exports[_0x7948('0x26')]=function(_0x2be38b,_0x5481e7){if(_0x2be38b[_0x7948('0x4d')]['id']){delete _0x2be38b['body']['id'];}return db[_0x7948('0x44')][_0x7948('0x4a')]({'where':{'id':_0x2be38b['params']['id']}})[_0x7948('0x27')](handleEntityNotFound(_0x5481e7,null))[_0x7948('0x27')](saveUpdates(_0x2be38b[_0x7948('0x4d')],null))[_0x7948('0x27')](respondWithResult(_0x5481e7,null))[_0x7948('0x4b')](handleError(_0x5481e7,null));};exports['destroy']=function(_0x792ab1,_0x9d8bb2){return db[_0x7948('0x44')][_0x7948('0x4a')]({'where':{'id':_0x792ab1['params']['id']}})[_0x7948('0x27')](handleEntityNotFound(_0x9d8bb2,null))[_0x7948('0x27')](removeEntity(_0x9d8bb2,null))[_0x7948('0x4b')](handleError(_0x9d8bb2,null));};exports[_0x7948('0x4e')]=function(_0x98d876,_0x53f9f7){return db[_0x7948('0x44')]['describe']()[_0x7948('0x27')](respondWithResult(_0x53f9f7,null))[_0x7948('0x4b')](handleError(_0x53f9f7,null));};exports[_0x7948('0x4f')]=function(_0x2b135b,_0x3939e0){var _0x31b341={},_0x5dc54d={},_0x5c6579={'count':0x0,'rows':[]};_0x5dc54d[_0x7948('0x32')]=_[_0x7948('0x34')](db[_0x7948('0x44')][_0x7948('0x2e')]);_0x5dc54d['query']=_['keys'](_0x2b135b[_0x7948('0x33')]);_0x5dc54d[_0x7948('0x35')]=_[_0x7948('0x36')](_0x5dc54d[_0x7948('0x32')],_0x5dc54d[_0x7948('0x33')]);_0x31b341['attributes']=_['intersection'](_0x5dc54d['model'],qs[_0x7948('0x38')](_0x2b135b[_0x7948('0x33')][_0x7948('0x38')]));_0x31b341[_0x7948('0x37')]=_0x31b341[_0x7948('0x37')][_0x7948('0x48')]?_0x31b341['attributes']:_0x5dc54d[_0x7948('0x32')];if(!_0x2b135b[_0x7948('0x33')][_0x7948('0x39')](_0x7948('0x3a'))){_0x31b341[_0x7948('0x21')]=qs[_0x7948('0x21')](_0x2b135b[_0x7948('0x33')]['limit']);_0x31b341[_0x7948('0x3b')]=qs[_0x7948('0x3b')](_0x2b135b[_0x7948('0x33')][_0x7948('0x3b')]);}_0x31b341[_0x7948('0x3c')]=qs['sort'](_0x2b135b[_0x7948('0x33')]['sort']);_0x31b341[_0x7948('0x3e')]=qs['filters'](_[_0x7948('0x3f')](_0x2b135b['query'],_0x5dc54d['filters']));if(_0x2b135b['query'][_0x7948('0x40')]){_0x31b341[_0x7948('0x3e')]=_[_0x7948('0x41')](_0x31b341[_0x7948('0x3e')],{'$or':_[_0x7948('0x2d')](_0x31b341[_0x7948('0x37')],function(_0x44b60b){var _0x5acb37={};_0x5acb37[_0x44b60b]={'$like':'%'+_0x2b135b[_0x7948('0x33')][_0x7948('0x40')]+'%'};return _0x5acb37;})});}_0x31b341=_['merge']({},_0x31b341,_0x2b135b[_0x7948('0x43')]);var _0x2a0647={'where':_0x31b341[_0x7948('0x3e')]};return db[_0x7948('0x44')]['count'](_0x2a0647)[_0x7948('0x27')](function(_0x4715d3){_0x5c6579['count']=_0x4715d3;if(_0x2b135b[_0x7948('0x33')][_0x7948('0x45')]){_0x31b341[_0x7948('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x31b341);})['then'](function(_0x3aca90){_0x5c6579[_0x7948('0x46')]=_0x3aca90;return _0x5c6579;})[_0x7948('0x27')](respondWithFilteredResult(_0x3939e0,_0x31b341,_0x7948('0x4f')))[_0x7948('0x4b')](handleError(_0x3939e0,null,_0x7948('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8ca52d7..0454773 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 _0xc6e2=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x4c8685,_0xa0992e){var _0x258938=function(_0x206ab9){while(--_0x206ab9){_0x4c8685['push'](_0x4c8685['shift']());}};_0x258938(++_0xa0992e);}(_0xc6e2,0xa9));var _0x2c6e=function(_0x48a72e,_0xe6defd){_0x48a72e=_0x48a72e-0x0;var _0x11f270=_0xc6e2[_0x48a72e];return _0x11f270;};'use strict';var EventEmitter=require(_0x2c6e('0x0'));var VoiceQueueReport=require(_0x2c6e('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c6e('0x2'),'afterDestroy':_0x2c6e('0x3')};function emitEvent(_0x3b3721){return function(_0x636de2,_0x14b9f0,_0x35bdfc){VoiceQueueReportEvents[_0x2c6e('0x4')](_0x3b3721+':'+_0x636de2['id'],_0x636de2);VoiceQueueReportEvents[_0x2c6e('0x4')](_0x3b3721,_0x636de2);_0x35bdfc(null);};}for(var e in events){if(events[_0x2c6e('0x5')](e)){var event=events[e];VoiceQueueReport[_0x2c6e('0x6')](e,emitEvent(event));}}module[_0x2c6e('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x73e4=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x10626f,_0x19a36b){var _0x26e850=function(_0xbc4a37){while(--_0xbc4a37){_0x10626f['push'](_0x10626f['shift']());}};_0x26e850(++_0x19a36b);}(_0x73e4,0x1ae));var _0x473e=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x73e4[_0x9c8b4a];return _0x198bef;};'use strict';var EventEmitter=require(_0x473e('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x473e('0x1')](0x0);var events={'afterCreate':_0x473e('0x2'),'afterUpdate':_0x473e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x36641b){return function(_0x1d5179,_0x37b555,_0x5026b0){VoiceQueueReportEvents['emit'](_0x36641b+':'+_0x1d5179['id'],_0x1d5179);VoiceQueueReportEvents['emit'](_0x36641b,_0x1d5179);_0x5026b0(null);};}for(var e in events){if(events[_0x473e('0x4')](e)){var event=events[e];VoiceQueueReport[_0x473e('0x5')](e,emitEvent(event));}}module[_0x473e('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3e07ef7..708a37b 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 _0x11c5=['exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x11c5,0x19a));var _0x511c=function(_0x1ee7b5,_0x145536){_0x1ee7b5=_0x1ee7b5-0x0;var _0xff0c07=_0x11c5[_0x1ee7b5];return _0xff0c07;};'use strict';var _=require(_0x511c('0x0'));var util=require(_0x511c('0x1'));var logger=require(_0x511c('0x2'))(_0x511c('0x3'));var moment=require(_0x511c('0x4'));var BPromise=require(_0x511c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x511c('0x6'));var rimraf=require(_0x511c('0x7'));var config=require(_0x511c('0x8'));var attributes=require(_0x511c('0x9'));module[_0x511c('0xa')]=function(_0x2c350d,_0x522d79){return _0x2c350d['define'](_0x511c('0xb'),attributes,{'tableName':_0x511c('0xc'),'paranoid':![],'indexes':[{'fields':[_0x511c('0xd')]},{'fields':[_0x511c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf10=['request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','api','moment','bluebird'];(function(_0x4024b4,_0x5439fb){var _0x11e076=function(_0x5d4227){while(--_0x5d4227){_0x4024b4['push'](_0x4024b4['shift']());}};_0x11e076(++_0x5439fb);}(_0xbf10,0x130));var _0x0bf1=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xbf10[_0x9df060];return _0x338dfe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bf1('0x0'))(_0x0bf1('0x1'));var moment=require(_0x0bf1('0x2'));var BPromise=require(_0x0bf1('0x3'));var rp=require(_0x0bf1('0x4'));var fs=require('fs');var path=require(_0x0bf1('0x5'));var rimraf=require(_0x0bf1('0x6'));var config=require('../../config/environment');var attributes=require(_0x0bf1('0x7'));module[_0x0bf1('0x8')]=function(_0x372d29,_0x5328ea){return _0x372d29[_0x0bf1('0x9')](_0x0bf1('0xa'),attributes,{'tableName':_0x0bf1('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0bf1('0xc')]},{'fields':[_0x0bf1('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 dfc2dda..c9751a6 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 _0x3086=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','model','include','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2f6e8e,_0x54b70b){var _0x182d8e=function(_0x162ceb){while(--_0x162ceb){_0x2f6e8e['push'](_0x2f6e8e['shift']());}};_0x182d8e(++_0x54b70b);}(_0x3086,0x153));var _0x6308=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3086[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x6308('0x0'));var moment=require(_0x6308('0x1'));var BPromise=require('bluebird');var rs=require(_0x6308('0x2'));var fs=require('fs');var Redis=require(_0x6308('0x3'));var db=require(_0x6308('0x4'))['db'];var utils=require(_0x6308('0x5'));var logger=require(_0x6308('0x6'))(_0x6308('0x7'));var config=require(_0x6308('0x8'));var jayson=require(_0x6308('0x9'));var client=jayson[_0x6308('0xa')][_0x6308('0xb')]({'port':0x232a});config['redis']=_[_0x6308('0xc')](config[_0x6308('0xd')],{'host':_0x6308('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6308('0xd')]));require('./voiceQueueReport.socket')[_0x6308('0xf')](socket);function respondWithRpcPromise(_0x457923,_0x3746ac,_0x5d1ebe){return new BPromise(function(_0x2882ef,_0x3b414c){return client['request'](_0x457923,_0x5d1ebe)[_0x6308('0x10')](function(_0x277adf){logger[_0x6308('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x3746ac,'request\x20sent');logger[_0x6308('0x12')](_0x6308('0x13'),_0x3746ac,_0x6308('0x14'),JSON[_0x6308('0x15')](_0x277adf));if(_0x277adf[_0x6308('0x16')]){if(_0x277adf['error'][_0x6308('0x17')]===0x1f4){logger[_0x6308('0x16')](_0x6308('0x18'),_0x3746ac,_0x277adf[_0x6308('0x16')][_0x6308('0x19')]);return _0x3b414c(_0x277adf[_0x6308('0x16')][_0x6308('0x19')]);}logger['error'](_0x6308('0x18'),_0x3746ac,_0x277adf[_0x6308('0x16')][_0x6308('0x19')]);return _0x2882ef(_0x277adf[_0x6308('0x16')][_0x6308('0x19')]);}else{logger['info'](_0x6308('0x18'),_0x3746ac,_0x6308('0x14'));_0x2882ef(_0x277adf['result'][_0x6308('0x19')]);}})[_0x6308('0x1a')](function(_0x54b7e2){logger[_0x6308('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x3746ac,_0x54b7e2);_0x3b414c(_0x54b7e2);});});}exports['GetVoiceQueueReport']=function(_0x331943){var _0x41f6f6=this;return new Promise(function(_0x2c29e8,_0x195b35){return db[_0x6308('0x1b')][_0x6308('0x1c')]({'raw':_0x331943[_0x6308('0x1d')]?_0x331943['options'][_0x6308('0x1e')]===undefined?!![]:![]:!![],'where':_0x331943[_0x6308('0x1d')]?_0x331943['options'][_0x6308('0x1f')]||null:null,'attributes':_0x331943[_0x6308('0x1d')]?_0x331943[_0x6308('0x1d')][_0x6308('0x20')]||null:null,'limit':_0x331943[_0x6308('0x1d')]?_0x331943[_0x6308('0x1d')][_0x6308('0x21')]||null:null,'include':_0x331943['options']?_0x331943[_0x6308('0x1d')]['include']?_[_0x6308('0x22')](_0x331943[_0x6308('0x1d')]['include'],function(_0x36220e){return{'model':db[_0x36220e[_0x6308('0x23')]],'as':_0x36220e['as'],'attributes':_0x36220e[_0x6308('0x20')],'include':_0x36220e[_0x6308('0x24')]?_[_0x6308('0x22')](_0x36220e[_0x6308('0x24')],function(_0x424bcd){return{'model':db[_0x424bcd[_0x6308('0x23')]],'as':_0x424bcd['as'],'attributes':_0x424bcd['attributes'],'include':_0x424bcd['include']?_[_0x6308('0x22')](_0x424bcd[_0x6308('0x24')],function(_0x100f49){return{'model':db[_0x100f49[_0x6308('0x23')]],'as':_0x100f49['as'],'attributes':_0x100f49[_0x6308('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bdf27){logger[_0x6308('0x11')](_0x6308('0x25'),_0x331943);logger[_0x6308('0x12')]('GetVoiceQueueReport',_0x331943,JSON[_0x6308('0x15')](_0x5bdf27));_0x2c29e8(_0x5bdf27);})[_0x6308('0x1a')](function(_0x25ee7b){logger[_0x6308('0x16')](_0x6308('0x25'),_0x25ee7b[_0x6308('0x19')],_0x331943);_0x195b35(_0x41f6f6[_0x6308('0x16')](0x1f4,_0x25ee7b[_0x6308('0x19')]));});});};exports[_0x6308('0x26')]=function(_0x54dc80){var _0x22da94=this;return new Promise(function(_0x5e02ba,_0x215558){return db[_0x6308('0x1b')][_0x6308('0x27')](_0x54dc80[_0x6308('0x28')],{'raw':_0x54dc80[_0x6308('0x1d')]?_0x54dc80[_0x6308('0x1d')][_0x6308('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5120fd){logger['info'](_0x6308('0x26'),_0x54dc80);logger['debug']('CreateVoiceQueueReport',_0x54dc80,JSON['stringify'](_0x5120fd));_0x5e02ba(_0x5120fd);})[_0x6308('0x1a')](function(_0x4ee1f8){logger[_0x6308('0x16')](_0x6308('0x26'),_0x4ee1f8[_0x6308('0x19')],_0x54dc80);_0x215558(_0x22da94[_0x6308('0x16')](0x1f4,_0x4ee1f8[_0x6308('0x19')]));});});};exports[_0x6308('0x29')]=function(_0x5186ab){var _0x32b78c=this;return new Promise(function(_0x47a842,_0xbf3a04){return db[_0x6308('0x1b')][_0x6308('0x2a')](_0x5186ab[_0x6308('0x28')],{'raw':_0x5186ab[_0x6308('0x1d')]?_0x5186ab[_0x6308('0x1d')][_0x6308('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5186ab[_0x6308('0x1d')]?_0x5186ab[_0x6308('0x1d')][_0x6308('0x1f')]||null:null,'attributes':_0x5186ab['options']?_0x5186ab[_0x6308('0x1d')][_0x6308('0x20')]||null:null,'limit':_0x5186ab['options']?_0x5186ab[_0x6308('0x1d')]['limit']||null:null})[_0x6308('0x10')](function(_0xd6e4a7){logger[_0x6308('0x11')](_0x6308('0x29'),_0x5186ab);logger[_0x6308('0x12')](_0x6308('0x29'),_0x5186ab,JSON[_0x6308('0x15')](_0xd6e4a7));_0x47a842(_0xd6e4a7);})[_0x6308('0x1a')](function(_0x17e99d){logger['error'](_0x6308('0x29'),_0x17e99d[_0x6308('0x19')],_0x5186ab);_0xbf3a04(_0x32b78c[_0x6308('0x16')](0x1f4,_0x17e99d['message']));});});}; \ No newline at end of file +var _0xec9f=['findAll','options','raw','where','include','map','model','attributes','VoiceQueueReport','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','limit','lodash','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xec9f,0x177));var _0xfec9=function(_0x3d742c,_0x46c926){_0x3d742c=_0x3d742c-0x0;var _0x127ef1=_0xec9f[_0x3d742c];return _0x127ef1;};'use strict';var _=require(_0xfec9('0x0'));var util=require(_0xfec9('0x1'));var moment=require(_0xfec9('0x2'));var BPromise=require(_0xfec9('0x3'));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')(_0xfec9('0x4'));var config=require(_0xfec9('0x5'));var jayson=require(_0xfec9('0x6'));var client=jayson[_0xfec9('0x7')][_0xfec9('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfec9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfec9('0xa'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xfec9('0xb')](socket);function respondWithRpcPromise(_0x49c727,_0x2cfad3,_0x3817ec){return new BPromise(function(_0xbf5ff6,_0x3cb700){return client[_0xfec9('0xc')](_0x49c727,_0x3817ec)[_0xfec9('0xd')](function(_0x415a17){logger[_0xfec9('0xe')](_0xfec9('0xf'),_0x2cfad3,'request\x20sent');logger[_0xfec9('0x10')](_0xfec9('0x11'),_0x2cfad3,_0xfec9('0x12'),JSON[_0xfec9('0x13')](_0x415a17));if(_0x415a17[_0xfec9('0x14')]){if(_0x415a17['error']['code']===0x1f4){logger[_0xfec9('0x14')](_0xfec9('0xf'),_0x2cfad3,_0x415a17[_0xfec9('0x14')]['message']);return _0x3cb700(_0x415a17[_0xfec9('0x14')][_0xfec9('0x15')]);}logger[_0xfec9('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2cfad3,_0x415a17['error'][_0xfec9('0x15')]);return _0xbf5ff6(_0x415a17[_0xfec9('0x14')][_0xfec9('0x15')]);}else{logger[_0xfec9('0xe')](_0xfec9('0xf'),_0x2cfad3,'request\x20sent');_0xbf5ff6(_0x415a17[_0xfec9('0x16')][_0xfec9('0x15')]);}})[_0xfec9('0x17')](function(_0x636f54){logger[_0xfec9('0x14')](_0xfec9('0xf'),_0x2cfad3,_0x636f54);_0x3cb700(_0x636f54);});});}exports[_0xfec9('0x18')]=function(_0x4fe38d){var _0x47d0fb=this;return new Promise(function(_0x4373a8,_0x3864fc){return db['VoiceQueueReport'][_0xfec9('0x19')]({'raw':_0x4fe38d[_0xfec9('0x1a')]?_0x4fe38d['options'][_0xfec9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fe38d[_0xfec9('0x1a')]?_0x4fe38d[_0xfec9('0x1a')][_0xfec9('0x1c')]||null:null,'attributes':_0x4fe38d[_0xfec9('0x1a')]?_0x4fe38d[_0xfec9('0x1a')]['attributes']||null:null,'limit':_0x4fe38d[_0xfec9('0x1a')]?_0x4fe38d[_0xfec9('0x1a')]['limit']||null:null,'include':_0x4fe38d[_0xfec9('0x1a')]?_0x4fe38d[_0xfec9('0x1a')][_0xfec9('0x1d')]?_[_0xfec9('0x1e')](_0x4fe38d[_0xfec9('0x1a')][_0xfec9('0x1d')],function(_0x456d0e){return{'model':db[_0x456d0e[_0xfec9('0x1f')]],'as':_0x456d0e['as'],'attributes':_0x456d0e[_0xfec9('0x20')],'include':_0x456d0e[_0xfec9('0x1d')]?_[_0xfec9('0x1e')](_0x456d0e[_0xfec9('0x1d')],function(_0x313e03){return{'model':db[_0x313e03['model']],'as':_0x313e03['as'],'attributes':_0x313e03[_0xfec9('0x20')],'include':_0x313e03[_0xfec9('0x1d')]?_['map'](_0x313e03['include'],function(_0x4ca12f){return{'model':db[_0x4ca12f[_0xfec9('0x1f')]],'as':_0x4ca12f['as'],'attributes':_0x4ca12f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfec9('0xd')](function(_0x116705){logger[_0xfec9('0xe')](_0xfec9('0x18'),_0x4fe38d);logger['debug']('GetVoiceQueueReport',_0x4fe38d,JSON[_0xfec9('0x13')](_0x116705));_0x4373a8(_0x116705);})[_0xfec9('0x17')](function(_0x180ac9){logger[_0xfec9('0x14')]('GetVoiceQueueReport',_0x180ac9[_0xfec9('0x15')],_0x4fe38d);_0x3864fc(_0x47d0fb[_0xfec9('0x14')](0x1f4,_0x180ac9[_0xfec9('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0xf3c739){var _0x53acb6=this;return new Promise(function(_0x502b68,_0x3ae44f){return db[_0xfec9('0x21')][_0xfec9('0x22')](_0xf3c739['body'],{'raw':_0xf3c739[_0xfec9('0x1a')]?_0xf3c739[_0xfec9('0x1a')][_0xfec9('0x1b')]===undefined?!![]:![]:!![]})[_0xfec9('0xd')](function(_0x57c1a4){logger[_0xfec9('0xe')](_0xfec9('0x23'),_0xf3c739);logger[_0xfec9('0x10')](_0xfec9('0x23'),_0xf3c739,JSON[_0xfec9('0x13')](_0x57c1a4));_0x502b68(_0x57c1a4);})[_0xfec9('0x17')](function(_0x276d07){logger[_0xfec9('0x14')](_0xfec9('0x23'),_0x276d07[_0xfec9('0x15')],_0xf3c739);_0x3ae44f(_0x53acb6['error'](0x1f4,_0x276d07[_0xfec9('0x15')]));});});};exports[_0xfec9('0x24')]=function(_0x20ac19){var _0x11adf0=this;return new Promise(function(_0x2d3fa0,_0x1cc2d7){return db[_0xfec9('0x21')][_0xfec9('0x25')](_0x20ac19[_0xfec9('0x26')],{'raw':_0x20ac19['options']?_0x20ac19[_0xfec9('0x1a')][_0xfec9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ac19[_0xfec9('0x1a')]?_0x20ac19['options'][_0xfec9('0x1c')]||null:null,'attributes':_0x20ac19[_0xfec9('0x1a')]?_0x20ac19[_0xfec9('0x1a')][_0xfec9('0x20')]||null:null,'limit':_0x20ac19[_0xfec9('0x1a')]?_0x20ac19[_0xfec9('0x1a')][_0xfec9('0x27')]||null:null})[_0xfec9('0xd')](function(_0x49bd7c){logger[_0xfec9('0xe')]('UpdateVoiceQueueReport',_0x20ac19);logger[_0xfec9('0x10')]('UpdateVoiceQueueReport',_0x20ac19,JSON[_0xfec9('0x13')](_0x49bd7c));_0x2d3fa0(_0x49bd7c);})[_0xfec9('0x17')](function(_0x88f68c){logger[_0xfec9('0x14')](_0xfec9('0x24'),_0x88f68c[_0xfec9('0x15')],_0x20ac19);_0x1cc2d7(_0x11adf0[_0xfec9('0x14')](0x1f4,_0x88f68c[_0xfec9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6650b6b..e710838 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 _0x616c=['removeListener','register','length','voiceQueueReport:','save','remove','emit'];(function(_0x215ffe,_0x5e3188){var _0x1e329b=function(_0x3158b4){while(--_0x3158b4){_0x215ffe['push'](_0x215ffe['shift']());}};_0x1e329b(++_0x5e3188);}(_0x616c,0x1b6));var _0xc616=function(_0x3b2427,_0x5cab97){_0x3b2427=_0x3b2427-0x0;var _0xfc670c=_0x616c[_0x3b2427];return _0xfc670c;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc616('0x0'),_0xc616('0x1'),'update'];function createListener(_0x16e652,_0x6dd7fe){return function(_0x3069cd){_0x6dd7fe[_0xc616('0x2')](_0x16e652,_0x3069cd);};}function removeListener(_0x52b492,_0x5f2d88){return function(){VoiceQueueReportEvents[_0xc616('0x3')](_0x52b492,_0x5f2d88);};}exports[_0xc616('0x4')]=function(_0x1772f5){for(var _0x15f809=0x0,_0x2b8fb5=events[_0xc616('0x5')];_0x15f809<_0x2b8fb5;_0x15f809++){var _0x5ee2d4=events[_0x15f809];var _0x52b04e=createListener(_0xc616('0x6')+_0x5ee2d4,_0x1772f5);VoiceQueueReportEvents['on'](_0x5ee2d4,_0x52b04e);}}; \ No newline at end of file +var _0xa234=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener','register'];(function(_0x2b71d3,_0x4a8edc){var _0x4c27e1=function(_0x1315e7){while(--_0x1315e7){_0x2b71d3['push'](_0x2b71d3['shift']());}};_0x4c27e1(++_0x4a8edc);}(_0xa234,0x142));var _0x4a23=function(_0x3fd5da,_0x592cab){_0x3fd5da=_0x3fd5da-0x0;var _0x52c70c=_0xa234[_0x3fd5da];return _0x52c70c;};'use strict';var VoiceQueueReportEvents=require(_0x4a23('0x0'));var events=[_0x4a23('0x1'),_0x4a23('0x2'),_0x4a23('0x3')];function createListener(_0x30fee9,_0x4a36fd){return function(_0x1534e4){_0x4a36fd['emit'](_0x30fee9,_0x1534e4);};}function removeListener(_0x2ced97,_0x5d3a3b){return function(){VoiceQueueReportEvents[_0x4a23('0x4')](_0x2ced97,_0x5d3a3b);};}exports[_0x4a23('0x5')]=function(_0x21b7e0){for(var _0x21f137=0x0,_0x23987c=events[_0x4a23('0x6')];_0x21f137<_0x23987c;_0x21f137++){var _0x5edef3=events[_0x21f137];var _0x23e94d=createListener(_0x4a23('0x7')+_0x5edef3,_0x21b7e0);VoiceQueueReportEvents['on'](_0x5edef3,_0x23e94d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 74a6050..e95f685 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 _0x4b8a=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x4c3f7d,_0x56ce39){var _0x48c013=function(_0x49e4ef){while(--_0x49e4ef){_0x4c3f7d['push'](_0x4c3f7d['shift']());}};_0x48c013(++_0x56ce39);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4b8a[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xa4b8('0x0'));var path=require('path');var timeout=require(_0xa4b8('0x1'));var express=require(_0xa4b8('0x2'));var router=express[_0xa4b8('0x3')]();var fs_extra=require(_0xa4b8('0x4'));var auth=require(_0xa4b8('0x5'));var interaction=require(_0xa4b8('0x6'));var config=require(_0xa4b8('0x7'));var controller=require(_0xa4b8('0x8'));router[_0xa4b8('0x9')]('/',auth[_0xa4b8('0xa')](),controller[_0xa4b8('0xb')]);router[_0xa4b8('0x9')](_0xa4b8('0xc'),auth[_0xa4b8('0xa')](),controller['show']);router[_0xa4b8('0xd')]('/',auth[_0xa4b8('0xa')](),controller[_0xa4b8('0xe')]);router[_0xa4b8('0xf')](_0xa4b8('0xc'),auth[_0xa4b8('0xa')](),controller[_0xa4b8('0x10')]);router[_0xa4b8('0x11')](_0xa4b8('0xc'),auth[_0xa4b8('0xa')](),controller[_0xa4b8('0x12')]);module[_0xa4b8('0x13')]=router; \ No newline at end of file +var _0x4634=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','util'];(function(_0x23b980,_0x57697f){var _0x475354=function(_0x3ee3fb){while(--_0x3ee3fb){_0x23b980['push'](_0x23b980['shift']());}};_0x475354(++_0x57697f);}(_0x4634,0xe3));var _0x4463=function(_0x5c54ba,_0x3670ad){_0x5c54ba=_0x5c54ba-0x0;var _0x3c5355=_0x4634[_0x5c54ba];return _0x3c5355;};'use strict';var multer=require('multer');var util=require(_0x4463('0x0'));var path=require(_0x4463('0x1'));var timeout=require(_0x4463('0x2'));var express=require(_0x4463('0x3'));var router=express[_0x4463('0x4')]();var fs_extra=require(_0x4463('0x5'));var auth=require(_0x4463('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4463('0x7'));var controller=require(_0x4463('0x8'));router[_0x4463('0x9')]('/',auth['isAuthenticated'](),controller[_0x4463('0xa')]);router[_0x4463('0x9')](_0x4463('0xb'),auth[_0x4463('0xc')](),controller[_0x4463('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4463('0xe')]);router['put'](_0x4463('0xb'),auth[_0x4463('0xc')](),controller[_0x4463('0xf')]);router[_0x4463('0x10')](_0x4463('0xb'),auth[_0x4463('0xc')](),controller[_0x4463('0x11')]);module[_0x4463('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e2d63ae..c7bb13e 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 _0xbda0=['moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2f4a20,_0x38ae8d){var _0x570b34=function(_0x2ad72c){while(--_0x2ad72c){_0x2f4a20['push'](_0x2f4a20['shift']());}};_0x570b34(++_0x38ae8d);}(_0xbda0,0x1e6));var _0x0bda=function(_0x201e0,_0x188ead){_0x201e0=_0x201e0-0x0;var _0x219255=_0xbda0[_0x201e0];return _0x219255;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0bda('0x0'));module[_0x0bda('0x1')]={'time':{'type':Sequelize[_0x0bda('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0bda('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0bda('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0bda('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0bda('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0bda('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0bda('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x0bda('0x4')](_0x0bda('0x5'))}}; \ No newline at end of file +var _0x2d97=['moment','STRING','DATE','literal','sequelize'];(function(_0x112929,_0x7da466){var _0x333c16=function(_0x762dc0){while(--_0x762dc0){_0x112929['push'](_0x112929['shift']());}};_0x333c16(++_0x7da466);}(_0x2d97,0x194));var _0x72d9=function(_0x592dce,_0x30fe14){_0x592dce=_0x592dce-0x0;var _0x3dbe5e=_0x2d97[_0x592dce];return _0x3dbe5e;};'use strict';var Sequelize=require(_0x72d9('0x0'));var moment=require(_0x72d9('0x1'));module['exports']={'time':{'type':Sequelize[_0x72d9('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x72d9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x72d9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x72d9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x72d9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x72d9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x72d9('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x72d9('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 dc8b63c..e00d37a 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 _0x4c01=['includeAll','include','rows','catch','show','fields','options','create','body','find','params','zip-dir','fast-json-patch','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','intersection','length','attributes','sort','where','filter','merge','type'];(function(_0x49f83b,_0xc0d16f){var _0x450230=function(_0x3827f7){while(--_0x3827f7){_0x49f83b['push'](_0x49f83b['shift']());}};_0x450230(++_0xc0d16f);}(_0x4c01,0xa1));var _0x14c0=function(_0x48df3e,_0xc8c4de){_0x48df3e=_0x48df3e-0x0;var _0x5cad72=_0x4c01[_0x48df3e];return _0x5cad72;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14c0('0x0'));var jsonpatch=require(_0x14c0('0x1'));var rp=require('request-promise');var moment=require(_0x14c0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x14c0('0x3'));var util=require(_0x14c0('0x4'));var path=require(_0x14c0('0x5'));var sox=require(_0x14c0('0x6'));var csv=require(_0x14c0('0x7'));var ejs=require(_0x14c0('0x8'));var fs=require('fs');var fs_extra=require(_0x14c0('0x9'));var _=require(_0x14c0('0xa'));var squel=require(_0x14c0('0xb'));var crypto=require(_0x14c0('0xc'));var jsforce=require(_0x14c0('0xd'));var deskjs=require(_0x14c0('0xe'));var toCsv=require(_0x14c0('0x7'));var querystring=require(_0x14c0('0xf'));var Papa=require(_0x14c0('0x10'));var Redis=require(_0x14c0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x14c0('0x12'));var as=require(_0x14c0('0x13'));var hardwareService=require(_0x14c0('0x14'));var logger=require(_0x14c0('0x15'))(_0x14c0('0x16'));var utils=require(_0x14c0('0x17'));var config=require(_0x14c0('0x18'));var licenseUtil=require(_0x14c0('0x19'));var db=require(_0x14c0('0x1a'))['db'];function respondWithStatusCode(_0x320317,_0x291816){_0x291816=_0x291816||0xcc;return function(_0x292646){if(_0x292646){return _0x320317[_0x14c0('0x1b')](_0x291816);}return _0x320317[_0x14c0('0x1c')](_0x291816)[_0x14c0('0x1d')]();};}function respondWithResult(_0x3ca135,_0x51ce72){_0x51ce72=_0x51ce72||0xc8;return function(_0x4ac6d7){if(_0x4ac6d7){return _0x3ca135[_0x14c0('0x1c')](_0x51ce72)[_0x14c0('0x1e')](_0x4ac6d7);}};}function respondWithFilteredResult(_0x3f6832,_0x49ac10){return function(_0x4d04cf){if(_0x4d04cf){var _0x273392=typeof _0x49ac10[_0x14c0('0x1f')]===_0x14c0('0x20')&&typeof _0x49ac10[_0x14c0('0x21')]===_0x14c0('0x20');var _0x8f2ff3=_0x4d04cf['count'];var _0x5beb46=_0x273392?0x0:_0x49ac10[_0x14c0('0x1f')];var _0x478075=_0x273392?_0x4d04cf[_0x14c0('0x22')]:_0x49ac10['offset']+_0x49ac10[_0x14c0('0x21')];var _0x22c513;if(_0x478075>=_0x8f2ff3){_0x478075=_0x8f2ff3;_0x22c513=0xc8;}else{_0x22c513=0xce;}_0x3f6832[_0x14c0('0x1c')](_0x22c513);return _0x3f6832[_0x14c0('0x23')](_0x14c0('0x24'),_0x5beb46+'-'+_0x478075+'/'+_0x8f2ff3)[_0x14c0('0x1e')](_0x4d04cf);}return null;};}function patchUpdates(_0x1deeee){return function(_0x4590cc){try{jsonpatch[_0x14c0('0x25')](_0x4590cc,_0x1deeee,!![]);}catch(_0x56551d){return BPromise[_0x14c0('0x26')](_0x56551d);}return _0x4590cc[_0x14c0('0x27')]();};}function saveUpdates(_0x10d11a,_0x4e0501){return function(_0x317bd6){if(_0x317bd6){return _0x317bd6[_0x14c0('0x28')](_0x10d11a)[_0x14c0('0x29')](function(_0x1067f3){return _0x1067f3;});}return null;};}function removeEntity(_0x5d2b60,_0x502e90){return function(_0x37904a){if(_0x37904a){return _0x37904a['destroy']()['then'](function(){_0x5d2b60[_0x14c0('0x1c')](0xcc)[_0x14c0('0x1d')]();});}};}function handleEntityNotFound(_0x144cec,_0x596959){return function(_0x3ce7dc){if(!_0x3ce7dc){_0x144cec[_0x14c0('0x1b')](0x194);}return _0x3ce7dc;};}function handleError(_0x391a3b,_0x58bce8){_0x58bce8=_0x58bce8||0x1f4;return function(_0x8ec71){logger[_0x14c0('0x2a')](_0x8ec71[_0x14c0('0x2b')]);if(_0x8ec71[_0x14c0('0x2c')]){delete _0x8ec71[_0x14c0('0x2c')];}_0x391a3b['status'](_0x58bce8)[_0x14c0('0x2d')](_0x8ec71);};}exports[_0x14c0('0x2e')]=function(_0x32baf3,_0xe2535f){var _0x24e3ac={},_0x11450f={},_0x563709={'count':0x0,'rows':[]};var _0x1aa7d9=_[_0x14c0('0x2f')](db[_0x14c0('0x30')][_0x14c0('0x31')],function(_0x1b317a){return{'name':_0x1b317a[_0x14c0('0x32')],'type':_0x1b317a['type'][_0x14c0('0x33')]};});_0x11450f[_0x14c0('0x34')]=_[_0x14c0('0x2f')](_0x1aa7d9,_0x14c0('0x2c'));_0x11450f[_0x14c0('0x35')]=_[_0x14c0('0x36')](_0x32baf3[_0x14c0('0x35')]);_0x11450f[_0x14c0('0x37')]=_['intersection'](_0x11450f[_0x14c0('0x34')],_0x11450f['query']);_0x24e3ac['attributes']=_[_0x14c0('0x38')](_0x11450f[_0x14c0('0x34')],qs['fields'](_0x32baf3[_0x14c0('0x35')]['fields']));_0x24e3ac['attributes']=_0x24e3ac['attributes'][_0x14c0('0x39')]?_0x24e3ac[_0x14c0('0x3a')]:_0x11450f[_0x14c0('0x34')];if(!_0x32baf3[_0x14c0('0x35')]['hasOwnProperty']('nolimit')){_0x24e3ac['limit']=qs['limit'](_0x32baf3[_0x14c0('0x35')]['limit']);_0x24e3ac['offset']=qs['offset'](_0x32baf3[_0x14c0('0x35')]['offset']);}_0x24e3ac['order']=qs[_0x14c0('0x3b')](_0x32baf3['query'][_0x14c0('0x3b')]);_0x24e3ac[_0x14c0('0x3c')]=qs[_0x14c0('0x37')](_['pick'](_0x32baf3[_0x14c0('0x35')],_0x11450f[_0x14c0('0x37')]),_0x1aa7d9);if(_0x32baf3[_0x14c0('0x35')][_0x14c0('0x3d')]){_0x24e3ac[_0x14c0('0x3c')]=_[_0x14c0('0x3e')](_0x24e3ac['where'],{'$or':_[_0x14c0('0x2f')](_0x1aa7d9,function(_0x55a563){if(_0x55a563[_0x14c0('0x3f')]!=='VIRTUAL'){var _0x2b92ed={};_0x2b92ed[_0x55a563['name']]={'$like':'%'+_0x32baf3[_0x14c0('0x35')]['filter']+'%'};return _0x2b92ed;}})});}_0x24e3ac=_[_0x14c0('0x3e')]({},_0x24e3ac,_0x32baf3['options']);var _0x1bd069={'where':_0x24e3ac[_0x14c0('0x3c')]};return db[_0x14c0('0x30')][_0x14c0('0x22')](_0x1bd069)[_0x14c0('0x29')](function(_0x416702){_0x563709[_0x14c0('0x22')]=_0x416702;if(_0x32baf3[_0x14c0('0x35')][_0x14c0('0x40')]){_0x24e3ac[_0x14c0('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x24e3ac);})[_0x14c0('0x29')](function(_0x440e81){_0x563709[_0x14c0('0x42')]=_0x440e81;return _0x563709;})[_0x14c0('0x29')](respondWithFilteredResult(_0xe2535f,_0x24e3ac))[_0x14c0('0x43')](handleError(_0xe2535f,null));};exports[_0x14c0('0x44')]=function(_0x24f7cd,_0x5b44a3){var _0x43e204={'raw':!![],'where':{'id':_0x24f7cd['params']['id']}},_0x41497b={};_0x41497b[_0x14c0('0x34')]=_[_0x14c0('0x36')](db[_0x14c0('0x30')][_0x14c0('0x31')]);_0x41497b[_0x14c0('0x35')]=_['keys'](_0x24f7cd[_0x14c0('0x35')]);_0x41497b[_0x14c0('0x37')]=_[_0x14c0('0x38')](_0x41497b[_0x14c0('0x34')],_0x41497b[_0x14c0('0x35')]);_0x43e204[_0x14c0('0x3a')]=_[_0x14c0('0x38')](_0x41497b[_0x14c0('0x34')],qs[_0x14c0('0x45')](_0x24f7cd[_0x14c0('0x35')][_0x14c0('0x45')]));_0x43e204['attributes']=_0x43e204[_0x14c0('0x3a')][_0x14c0('0x39')]?_0x43e204[_0x14c0('0x3a')]:_0x41497b[_0x14c0('0x34')];if(_0x24f7cd['query']['includeAll']){_0x43e204[_0x14c0('0x41')]=[{'all':!![]}];}_0x43e204=_['merge']({},_0x43e204,_0x24f7cd[_0x14c0('0x46')]);return db[_0x14c0('0x30')]['find'](_0x43e204)[_0x14c0('0x29')](handleEntityNotFound(_0x5b44a3,null))[_0x14c0('0x29')](respondWithResult(_0x5b44a3,null))[_0x14c0('0x43')](handleError(_0x5b44a3,null));};exports[_0x14c0('0x47')]=function(_0x5afbc4,_0x2a4b10){return db[_0x14c0('0x30')][_0x14c0('0x47')](_0x5afbc4['body'],{})[_0x14c0('0x29')](respondWithResult(_0x2a4b10,0xc9))[_0x14c0('0x43')](handleError(_0x2a4b10,null));};exports[_0x14c0('0x28')]=function(_0x217b14,_0x38a7b1){if(_0x217b14['body']['id']){delete _0x217b14[_0x14c0('0x48')]['id'];}return db[_0x14c0('0x30')][_0x14c0('0x49')]({'where':{'id':_0x217b14[_0x14c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38a7b1,null))['then'](saveUpdates(_0x217b14[_0x14c0('0x48')],null))[_0x14c0('0x29')](respondWithResult(_0x38a7b1,null))[_0x14c0('0x43')](handleError(_0x38a7b1,null));};exports['destroy']=function(_0x1fbb55,_0x1e3ae1){return db['VoiceQueuesLog'][_0x14c0('0x49')]({'where':{'id':_0x1fbb55[_0x14c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e3ae1,null))[_0x14c0('0x29')](removeEntity(_0x1e3ae1,null))['catch'](handleError(_0x1e3ae1,null));}; \ No newline at end of file +var _0x5517=['send','index','map','VoiceQueuesLog','fieldName','type','key','query','keys','filters','model','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','params','rawAttributes','intersection','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name'];(function(_0x3dd574,_0xb3e6e0){var _0x462f83=function(_0x5948ad){while(--_0x5948ad){_0x3dd574['push'](_0x3dd574['shift']());}};_0x462f83(++_0xb3e6e0);}(_0x5517,0xad));var _0x7551=function(_0x7c9df1,_0x914efc){_0x7c9df1=_0x7c9df1-0x0;var _0x36d129=_0x5517[_0x7c9df1];return _0x36d129;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7551('0x0'));var zipdir=require(_0x7551('0x1'));var jsonpatch=require(_0x7551('0x2'));var rp=require(_0x7551('0x3'));var moment=require(_0x7551('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7551('0x5'));var util=require('util');var path=require(_0x7551('0x6'));var sox=require(_0x7551('0x7'));var csv=require('to-csv');var ejs=require(_0x7551('0x8'));var fs=require('fs');var fs_extra=require(_0x7551('0x9'));var _=require(_0x7551('0xa'));var squel=require(_0x7551('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7551('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7551('0xd'));var Redis=require(_0x7551('0xe'));var authService=require(_0x7551('0xf'));var qs=require(_0x7551('0x10'));var as=require(_0x7551('0x11'));var hardwareService=require(_0x7551('0x12'));var logger=require('../../config/logger')(_0x7551('0x13'));var utils=require(_0x7551('0x14'));var config=require(_0x7551('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7551('0x16'))['db'];function respondWithStatusCode(_0x32d858,_0x40600d){_0x40600d=_0x40600d||0xcc;return function(_0x35ba6e){if(_0x35ba6e){return _0x32d858[_0x7551('0x17')](_0x40600d);}return _0x32d858[_0x7551('0x18')](_0x40600d)['end']();};}function respondWithResult(_0x1f8944,_0x3a22b7){_0x3a22b7=_0x3a22b7||0xc8;return function(_0x1d2893){if(_0x1d2893){return _0x1f8944[_0x7551('0x18')](_0x3a22b7)[_0x7551('0x19')](_0x1d2893);}};}function respondWithFilteredResult(_0x5d3cbd,_0x488f02){return function(_0x1c20f1){if(_0x1c20f1){var _0x514747=typeof _0x488f02[_0x7551('0x1a')]===_0x7551('0x1b')&&typeof _0x488f02[_0x7551('0x1c')]===_0x7551('0x1b');var _0x20e4da=_0x1c20f1[_0x7551('0x1d')];var _0x3b2dc7=_0x514747?0x0:_0x488f02[_0x7551('0x1a')];var _0x2c2a73=_0x514747?_0x1c20f1[_0x7551('0x1d')]:_0x488f02[_0x7551('0x1a')]+_0x488f02[_0x7551('0x1c')];var _0x4847f9;if(_0x2c2a73>=_0x20e4da){_0x2c2a73=_0x20e4da;_0x4847f9=0xc8;}else{_0x4847f9=0xce;}_0x5d3cbd[_0x7551('0x18')](_0x4847f9);return _0x5d3cbd[_0x7551('0x1e')]('Content-Range',_0x3b2dc7+'-'+_0x2c2a73+'/'+_0x20e4da)[_0x7551('0x19')](_0x1c20f1);}return null;};}function patchUpdates(_0x1b964f){return function(_0x2b7fea){try{jsonpatch[_0x7551('0x1f')](_0x2b7fea,_0x1b964f,!![]);}catch(_0x5f5783){return BPromise[_0x7551('0x20')](_0x5f5783);}return _0x2b7fea['save']();};}function saveUpdates(_0x2863cd,_0x4fb224){return function(_0x239554){if(_0x239554){return _0x239554[_0x7551('0x21')](_0x2863cd)[_0x7551('0x22')](function(_0x43eaaa){return _0x43eaaa;});}return null;};}function removeEntity(_0x43c6bb,_0x3218e8){return function(_0x12477e){if(_0x12477e){return _0x12477e[_0x7551('0x23')]()['then'](function(){_0x43c6bb[_0x7551('0x18')](0xcc)[_0x7551('0x24')]();});}};}function handleEntityNotFound(_0x8c7e56,_0x3b5ab2){return function(_0x429641){if(!_0x429641){_0x8c7e56['sendStatus'](0x194);}return _0x429641;};}function handleError(_0x200af8,_0x3efb8a){_0x3efb8a=_0x3efb8a||0x1f4;return function(_0x44bac4){logger[_0x7551('0x25')](_0x44bac4[_0x7551('0x26')]);if(_0x44bac4[_0x7551('0x27')]){delete _0x44bac4[_0x7551('0x27')];}_0x200af8['status'](_0x3efb8a)[_0x7551('0x28')](_0x44bac4);};}exports[_0x7551('0x29')]=function(_0x42719b,_0x151d58){var _0x72adbe={},_0xa807de={},_0x3830d5={'count':0x0,'rows':[]};var _0x4a885b=_[_0x7551('0x2a')](db[_0x7551('0x2b')]['rawAttributes'],function(_0xa83d1e){return{'name':_0xa83d1e[_0x7551('0x2c')],'type':_0xa83d1e[_0x7551('0x2d')][_0x7551('0x2e')]};});_0xa807de['model']=_[_0x7551('0x2a')](_0x4a885b,'name');_0xa807de[_0x7551('0x2f')]=_[_0x7551('0x30')](_0x42719b['query']);_0xa807de[_0x7551('0x31')]=_['intersection'](_0xa807de[_0x7551('0x32')],_0xa807de[_0x7551('0x2f')]);_0x72adbe[_0x7551('0x33')]=_['intersection'](_0xa807de[_0x7551('0x32')],qs[_0x7551('0x34')](_0x42719b[_0x7551('0x2f')][_0x7551('0x34')]));_0x72adbe[_0x7551('0x33')]=_0x72adbe[_0x7551('0x33')]['length']?_0x72adbe[_0x7551('0x33')]:_0xa807de[_0x7551('0x32')];if(!_0x42719b[_0x7551('0x2f')]['hasOwnProperty']('nolimit')){_0x72adbe[_0x7551('0x1c')]=qs['limit'](_0x42719b[_0x7551('0x2f')][_0x7551('0x1c')]);_0x72adbe['offset']=qs[_0x7551('0x1a')](_0x42719b[_0x7551('0x2f')]['offset']);}_0x72adbe[_0x7551('0x35')]=qs['sort'](_0x42719b[_0x7551('0x2f')][_0x7551('0x36')]);_0x72adbe[_0x7551('0x37')]=qs[_0x7551('0x31')](_['pick'](_0x42719b[_0x7551('0x2f')],_0xa807de[_0x7551('0x31')]),_0x4a885b);if(_0x42719b['query'][_0x7551('0x38')]){_0x72adbe[_0x7551('0x37')]=_[_0x7551('0x39')](_0x72adbe[_0x7551('0x37')],{'$or':_['map'](_0x4a885b,function(_0x1c8c07){if(_0x1c8c07[_0x7551('0x2d')]!==_0x7551('0x3a')){var _0x92aded={};_0x92aded[_0x1c8c07[_0x7551('0x27')]]={'$like':'%'+_0x42719b[_0x7551('0x2f')][_0x7551('0x38')]+'%'};return _0x92aded;}})});}_0x72adbe=_[_0x7551('0x39')]({},_0x72adbe,_0x42719b[_0x7551('0x3b')]);var _0x21d74c={'where':_0x72adbe[_0x7551('0x37')]};return db['VoiceQueuesLog']['count'](_0x21d74c)[_0x7551('0x22')](function(_0xdbf34){_0x3830d5[_0x7551('0x1d')]=_0xdbf34;if(_0x42719b['query']['includeAll']){_0x72adbe[_0x7551('0x3c')]=[{'all':!![]}];}return db[_0x7551('0x2b')]['findAll'](_0x72adbe);})[_0x7551('0x22')](function(_0x55fd9b){_0x3830d5[_0x7551('0x3d')]=_0x55fd9b;return _0x3830d5;})[_0x7551('0x22')](respondWithFilteredResult(_0x151d58,_0x72adbe))[_0x7551('0x3e')](handleError(_0x151d58,null));};exports['show']=function(_0x3e0faf,_0x24f9d3){var _0x4ba5fb={'raw':!![],'where':{'id':_0x3e0faf[_0x7551('0x3f')]['id']}},_0x17247d={};_0x17247d['model']=_[_0x7551('0x30')](db[_0x7551('0x2b')][_0x7551('0x40')]);_0x17247d[_0x7551('0x2f')]=_[_0x7551('0x30')](_0x3e0faf[_0x7551('0x2f')]);_0x17247d['filters']=_[_0x7551('0x41')](_0x17247d['model'],_0x17247d[_0x7551('0x2f')]);_0x4ba5fb[_0x7551('0x33')]=_[_0x7551('0x41')](_0x17247d[_0x7551('0x32')],qs[_0x7551('0x34')](_0x3e0faf['query'][_0x7551('0x34')]));_0x4ba5fb[_0x7551('0x33')]=_0x4ba5fb[_0x7551('0x33')][_0x7551('0x42')]?_0x4ba5fb[_0x7551('0x33')]:_0x17247d['model'];if(_0x3e0faf[_0x7551('0x2f')][_0x7551('0x43')]){_0x4ba5fb[_0x7551('0x3c')]=[{'all':!![]}];}_0x4ba5fb=_[_0x7551('0x39')]({},_0x4ba5fb,_0x3e0faf[_0x7551('0x3b')]);return db[_0x7551('0x2b')][_0x7551('0x44')](_0x4ba5fb)[_0x7551('0x22')](handleEntityNotFound(_0x24f9d3,null))[_0x7551('0x22')](respondWithResult(_0x24f9d3,null))['catch'](handleError(_0x24f9d3,null));};exports[_0x7551('0x45')]=function(_0x3a9960,_0x5c184e){return db[_0x7551('0x2b')]['create'](_0x3a9960[_0x7551('0x46')],{})[_0x7551('0x22')](respondWithResult(_0x5c184e,0xc9))[_0x7551('0x3e')](handleError(_0x5c184e,null));};exports['update']=function(_0x22d51e,_0x145c9b){if(_0x22d51e[_0x7551('0x46')]['id']){delete _0x22d51e['body']['id'];}return db[_0x7551('0x2b')][_0x7551('0x44')]({'where':{'id':_0x22d51e[_0x7551('0x3f')]['id']}})['then'](handleEntityNotFound(_0x145c9b,null))[_0x7551('0x22')](saveUpdates(_0x22d51e[_0x7551('0x46')],null))[_0x7551('0x22')](respondWithResult(_0x145c9b,null))['catch'](handleError(_0x145c9b,null));};exports[_0x7551('0x23')]=function(_0x3a7fa7,_0x3e3c34){return db[_0x7551('0x2b')][_0x7551('0x44')]({'where':{'id':_0x3a7fa7[_0x7551('0x3f')]['id']}})[_0x7551('0x22')](handleEntityNotFound(_0x3e3c34,null))[_0x7551('0x22')](removeEntity(_0x3e3c34,null))[_0x7551('0x3e')](handleError(_0x3e3c34,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1f95179..31f08a7 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 _0xbe9a=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbe9a,0x1a4));var _0xabe9=function(_0x287b60,_0x582120){_0x287b60=_0x287b60-0x0;var _0x5e0c03=_0xbe9a[_0x287b60];return _0x5e0c03;};'use strict';var _=require(_0xabe9('0x0'));var util=require('util');var logger=require(_0xabe9('0x1'))(_0xabe9('0x2'));var moment=require(_0xabe9('0x3'));var BPromise=require('bluebird');var rp=require(_0xabe9('0x4'));var fs=require('fs');var path=require(_0xabe9('0x5'));var rimraf=require(_0xabe9('0x6'));var config=require(_0xabe9('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xabe9('0x8')]=function(_0x40b9aa,_0x1ee7e0){return _0x40b9aa[_0xabe9('0x9')](_0xabe9('0xa'),attributes,{'tableName':_0xabe9('0xb'),'paranoid':![],'indexes':[{'name':_0xabe9('0xc'),'fields':[_0xabe9('0xd'),_0xabe9('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdd70=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','api','bluebird'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0xdd70,0x7a));var _0x0dd7=function(_0xd0a70a,_0x44f3d5){_0xd0a70a=_0xd0a70a-0x0;var _0x2ca818=_0xdd70[_0xd0a70a];return _0x2ca818;};'use strict';var _=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var logger=require('../../config/logger')(_0x0dd7('0x2'));var moment=require('moment');var BPromise=require(_0x0dd7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dd7('0x4'));var rimraf=require(_0x0dd7('0x5'));var config=require(_0x0dd7('0x6'));var attributes=require(_0x0dd7('0x7'));module[_0x0dd7('0x8')]=function(_0xb18522,_0x14e232){return _0xb18522[_0x0dd7('0x9')](_0x0dd7('0xa'),attributes,{'tableName':_0x0dd7('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0dd7('0xc'),_0x0dd7('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 55b296f..48fae14 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 _0x22dd=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0xa665b,_0x553e3d){var _0x4d6e2d=function(_0x1dc3f4){while(--_0x1dc3f4){_0xa665b['push'](_0xa665b['shift']());}};_0x4d6e2d(++_0x553e3d);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var moment=require(_0xd22d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd22d('0x3'));var db=require(_0xd22d('0x4'))['db'];var utils=require(_0xd22d('0x5'));var logger=require(_0xd22d('0x6'))(_0xd22d('0x7'));var config=require(_0xd22d('0x8'));var jayson=require(_0xd22d('0x9'));var client=jayson[_0xd22d('0xa')][_0xd22d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a466f,_0x4de374,_0x40986a){return new BPromise(function(_0x3649df,_0x57fc19){return client[_0xd22d('0xc')](_0x3a466f,_0x40986a)['then'](function(_0x19064d){logger['info'](_0xd22d('0xd'),_0x4de374,_0xd22d('0xe'));logger[_0xd22d('0xf')](_0xd22d('0x10'),_0x4de374,_0xd22d('0xe'),JSON[_0xd22d('0x11')](_0x19064d));if(_0x19064d[_0xd22d('0x12')]){if(_0x19064d[_0xd22d('0x12')]['code']===0x1f4){logger[_0xd22d('0x12')](_0xd22d('0xd'),_0x4de374,_0x19064d['error'][_0xd22d('0x13')]);return _0x57fc19(_0x19064d[_0xd22d('0x12')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4de374,_0x19064d[_0xd22d('0x12')]['message']);return _0x3649df(_0x19064d[_0xd22d('0x12')]['message']);}else{logger[_0xd22d('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4de374,_0xd22d('0xe'));_0x3649df(_0x19064d[_0xd22d('0x15')]['message']);}})[_0xd22d('0x16')](function(_0x2bb3d5){logger[_0xd22d('0x12')](_0xd22d('0xd'),_0x4de374,_0x2bb3d5);_0x57fc19(_0x2bb3d5);});});} \ No newline at end of file +var _0x3ed9=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3647b8,_0x3fea45){var _0x9283d6=function(_0x5595a3){while(--_0x5595a3){_0x3647b8['push'](_0x3647b8['shift']());}};_0x9283d6(++_0x3fea45);}(_0x3ed9,0xe0));var _0x93ed=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x3ed9[_0x9d14e3];return _0x19bf32;};'use strict';var _=require(_0x93ed('0x0'));var util=require(_0x93ed('0x1'));var moment=require(_0x93ed('0x2'));var BPromise=require(_0x93ed('0x3'));var rs=require(_0x93ed('0x4'));var fs=require('fs');var Redis=require(_0x93ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93ed('0x6'));var logger=require('../../config/logger')(_0x93ed('0x7'));var config=require(_0x93ed('0x8'));var jayson=require(_0x93ed('0x9'));var client=jayson[_0x93ed('0xa')][_0x93ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1be7dc,_0x1021ca,_0x5bb1fd){return new BPromise(function(_0x400d2b,_0x495bad){return client[_0x93ed('0xc')](_0x1be7dc,_0x5bb1fd)[_0x93ed('0xd')](function(_0x4c0067){logger[_0x93ed('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1021ca,'request\x20sent');logger[_0x93ed('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1021ca,'request\x20sent',JSON[_0x93ed('0x10')](_0x4c0067));if(_0x4c0067[_0x93ed('0x11')]){if(_0x4c0067[_0x93ed('0x11')]['code']===0x1f4){logger['error'](_0x93ed('0x12'),_0x1021ca,_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);return _0x495bad(_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1021ca,_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);return _0x400d2b(_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);}else{logger[_0x93ed('0xe')](_0x93ed('0x12'),_0x1021ca,_0x93ed('0x14'));_0x400d2b(_0x4c0067[_0x93ed('0x15')][_0x93ed('0x13')]);}})[_0x93ed('0x16')](function(_0x355971){logger[_0x93ed('0x11')](_0x93ed('0x12'),_0x1021ca,_0x355971);_0x495bad(_0x355971);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 84a94b9..5f77fb0 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 _0x58e9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','update','delete','exports','multer','util','path'];(function(_0xa2091f,_0x14f3f3){var _0x3a34e4=function(_0x133fa4){while(--_0x133fa4){_0xa2091f['push'](_0xa2091f['shift']());}};_0x3a34e4(++_0x14f3f3);}(_0x58e9,0xba));var _0x958e=function(_0x48600a,_0x62b31f){_0x48600a=_0x48600a-0x0;var _0x3b1dbb=_0x58e9[_0x48600a];return _0x3b1dbb;};'use strict';var multer=require(_0x958e('0x0'));var util=require(_0x958e('0x1'));var path=require(_0x958e('0x2'));var timeout=require('connect-timeout');var express=require(_0x958e('0x3'));var router=express[_0x958e('0x4')]();var fs_extra=require(_0x958e('0x5'));var auth=require(_0x958e('0x6'));var interaction=require(_0x958e('0x7'));var config=require(_0x958e('0x8'));var controller=require(_0x958e('0x9'));router[_0x958e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x958e('0xa')](_0x958e('0xb'),auth[_0x958e('0xc')](),controller[_0x958e('0xd')]);router[_0x958e('0xa')](_0x958e('0xe'),auth[_0x958e('0xc')](),controller[_0x958e('0xf')]);router[_0x958e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x958e('0x10')]);router[_0x958e('0xa')](_0x958e('0x11'),controller[_0x958e('0x12')]);router[_0x958e('0xa')](_0x958e('0x13'),auth[_0x958e('0xc')](),controller['downloadTranscribe']);router[_0x958e('0x14')]('/',auth['isAuthenticated'](),controller[_0x958e('0x15')]);router['post'](_0x958e('0x13'),auth[_0x958e('0xc')](),controller[_0x958e('0x16')]);router[_0x958e('0x17')](_0x958e('0xe'),auth[_0x958e('0xc')](),controller[_0x958e('0x18')]);router[_0x958e('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x958e('0x1a')]=router; \ No newline at end of file +var _0xa74b=['get','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa74b,0x17c));var _0xba74=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa74b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xba74('0x0'));var util=require(_0xba74('0x1'));var path=require(_0xba74('0x2'));var timeout=require(_0xba74('0x3'));var express=require(_0xba74('0x4'));var router=express[_0xba74('0x5')]();var fs_extra=require(_0xba74('0x6'));var auth=require(_0xba74('0x7'));var interaction=require(_0xba74('0x8'));var config=require(_0xba74('0x9'));var controller=require(_0xba74('0xa'));router['get']('/',auth[_0xba74('0xb')](),controller['index']);router[_0xba74('0xc')](_0xba74('0xd'),auth['isAuthenticated'](),controller[_0xba74('0xe')]);router[_0xba74('0xc')](_0xba74('0xf'),auth[_0xba74('0xb')](),controller[_0xba74('0x10')]);router[_0xba74('0xc')](_0xba74('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xba74('0xc')](_0xba74('0x12'),controller[_0xba74('0x13')]);router[_0xba74('0xc')](_0xba74('0x14'),auth[_0xba74('0xb')](),controller[_0xba74('0x15')]);router['post']('/',auth[_0xba74('0xb')](),controller[_0xba74('0x16')]);router[_0xba74('0x17')]('/:id/transcribe',auth[_0xba74('0xb')](),controller[_0xba74('0x18')]);router['put'](_0xba74('0xf'),auth[_0xba74('0xb')](),controller[_0xba74('0x19')]);router[_0xba74('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xba74('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 041bd05..a1af7e8 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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 1245047..2315b70 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 _0xb948=['findOne','%s.cypher','Setting','transcribeAccountId','transcribeRegion','language','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','root','.txt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','VoiceRecording','rawAttributes','type','model','format','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','fields','include','find','create','body','params','describe','download','../../components/encryptor','uniqueid','decryptFile','secrets','recording','value','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','sequelize','MD5','col','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','runTranscribe'];(function(_0x446375,_0x20b208){var _0x209267=function(_0x33b9db){while(--_0x33b9db){_0x446375['push'](_0x446375['shift']());}};_0x209267(++_0x20b208);}(_0xb948,0x141));var _0x8b94=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xb948[_0x4fbb15];return _0x436338;};'use strict';var emlformat=require(_0x8b94('0x0'));var rimraf=require(_0x8b94('0x1'));var zipdir=require(_0x8b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b94('0x3'));var moment=require(_0x8b94('0x4'));var BPromise=require(_0x8b94('0x5'));var Mustache=require('mustache');var util=require(_0x8b94('0x6'));var path=require(_0x8b94('0x7'));var sox=require(_0x8b94('0x8'));var csv=require(_0x8b94('0x9'));var ejs=require(_0x8b94('0xa'));var fs=require('fs');var fs_extra=require(_0x8b94('0xb'));var _=require(_0x8b94('0xc'));var squel=require('squel');var crypto=require(_0x8b94('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8b94('0xe'));var toCsv=require(_0x8b94('0x9'));var querystring=require(_0x8b94('0xf'));var Papa=require('papaparse');var AWS=require(_0x8b94('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x8b94('0x11'));var authService=require(_0x8b94('0x12'));var qs=require(_0x8b94('0x13'));var as=require(_0x8b94('0x14'));var hardwareService=require(_0x8b94('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8b94('0x16'));var config=require(_0x8b94('0x17'));var licenseUtil=require(_0x8b94('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186afe,_0x49620f){_0x49620f=_0x49620f||0xcc;return function(_0x571e10){if(_0x571e10){return _0x186afe[_0x8b94('0x19')](_0x49620f);}return _0x186afe[_0x8b94('0x1a')](_0x49620f)['end']();};}function respondWithResult(_0x168b3b,_0x37e427){_0x37e427=_0x37e427||0xc8;return function(_0x5a9021){if(_0x5a9021){return _0x168b3b[_0x8b94('0x1a')](_0x37e427)['json'](_0x5a9021);}};}function respondWithFilteredResult(_0x4d97d3,_0x184ea7){return function(_0x413b65){if(_0x413b65){var _0x3b087f=typeof _0x184ea7[_0x8b94('0x1b')]==='undefined'&&typeof _0x184ea7[_0x8b94('0x1c')]===_0x8b94('0x1d');var _0x22085a=_0x413b65[_0x8b94('0x1e')];var _0x17e2ad=_0x3b087f?0x0:_0x184ea7[_0x8b94('0x1b')];var _0x46254d=_0x3b087f?_0x413b65[_0x8b94('0x1e')]:_0x184ea7[_0x8b94('0x1b')]+_0x184ea7[_0x8b94('0x1c')];var _0x17f1d2;if(_0x46254d>=_0x22085a){_0x46254d=_0x22085a;_0x17f1d2=0xc8;}else{_0x17f1d2=0xce;}_0x4d97d3[_0x8b94('0x1a')](_0x17f1d2);return _0x4d97d3[_0x8b94('0x1f')](_0x8b94('0x20'),_0x17e2ad+'-'+_0x46254d+'/'+_0x22085a)[_0x8b94('0x21')](_0x413b65);}return null;};}function patchUpdates(_0x58d23b){return function(_0x463d32){try{jsonpatch[_0x8b94('0x22')](_0x463d32,_0x58d23b,!![]);}catch(_0x6cf425){return BPromise[_0x8b94('0x23')](_0x6cf425);}return _0x463d32[_0x8b94('0x24')]();};}function saveUpdates(_0x25b249,_0x51c5cc){return function(_0x4bec57){if(_0x4bec57){return _0x4bec57[_0x8b94('0x25')](_0x25b249)[_0x8b94('0x26')](function(_0x32e2a8){return _0x32e2a8;});}return null;};}function removeEntity(_0xd243,_0xddab50){return function(_0x40d161){if(_0x40d161){return _0x40d161[_0x8b94('0x27')]()['then'](function(){_0xd243[_0x8b94('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc55b41,_0x2c7582){return function(_0x29cf59){if(!_0x29cf59){_0xc55b41[_0x8b94('0x19')](0x194);}return _0x29cf59;};}function handleError(_0x4b5cd6,_0x449f3b){_0x449f3b=_0x449f3b||0x1f4;return function(_0x13ff9f){logger[_0x8b94('0x28')](_0x13ff9f[_0x8b94('0x29')]);if(_0x13ff9f[_0x8b94('0x2a')]){delete _0x13ff9f[_0x8b94('0x2a')];}_0x4b5cd6[_0x8b94('0x1a')](_0x449f3b)['send'](_0x13ff9f);};}exports['index']=function(_0xea73ce,_0x33e6ab){var _0x54760a={},_0x16b657={},_0x26972f={'count':0x0,'rows':[]};var _0x5ab54c=_[_0x8b94('0x2b')](db[_0x8b94('0x2c')][_0x8b94('0x2d')],function(_0x5399e0){return{'name':_0x5399e0['fieldName'],'type':_0x5399e0[_0x8b94('0x2e')]['key']};});_0x16b657[_0x8b94('0x2f')]=_['differenceBy'](_[_0x8b94('0x2b')](_0x5ab54c,_0x8b94('0x2a')),[_0x8b94('0x30')]);_0x16b657[_0x8b94('0x31')]=_[_0x8b94('0x32')](_0xea73ce[_0x8b94('0x31')]);_0x16b657[_0x8b94('0x33')]=_[_0x8b94('0x34')](_0x16b657[_0x8b94('0x2f')],_0x16b657[_0x8b94('0x31')]);_0x54760a[_0x8b94('0x35')]=_[_0x8b94('0x34')](_0x16b657['model'],qs['fields'](_0xea73ce['query']['fields']));_0x54760a[_0x8b94('0x35')]=_0x54760a['attributes'][_0x8b94('0x36')]?_0x54760a['attributes']:_0x16b657[_0x8b94('0x2f')];if(!_0xea73ce['query'][_0x8b94('0x37')](_0x8b94('0x38'))){_0x54760a[_0x8b94('0x1c')]=qs['limit'](_0xea73ce[_0x8b94('0x31')]['limit']);_0x54760a[_0x8b94('0x1b')]=qs[_0x8b94('0x1b')](_0xea73ce['query']['offset']);}_0x54760a[_0x8b94('0x39')]=qs['sort'](_0xea73ce[_0x8b94('0x31')]['sort']);_0x54760a[_0x8b94('0x3a')]=qs[_0x8b94('0x33')](_[_0x8b94('0x3b')](_0xea73ce[_0x8b94('0x31')],_0x16b657[_0x8b94('0x33')]),_0x5ab54c);if(_0xea73ce['query'][_0x8b94('0x3c')]){_0x54760a['where']=_[_0x8b94('0x3d')](_0x54760a[_0x8b94('0x3a')],{'$or':_['map'](_0x5ab54c,function(_0x5b7c81){if(_0x5b7c81[_0x8b94('0x2e')]!==_0x8b94('0x3e')){var _0x524f33={};_0x524f33[_0x5b7c81[_0x8b94('0x2a')]]={'$like':'%'+_0xea73ce['query']['filter']+'%'};return _0x524f33;}})});}_0x54760a=_[_0x8b94('0x3d')]({},_0x54760a,_0xea73ce[_0x8b94('0x3f')]);var _0x43574a={'where':_0x54760a[_0x8b94('0x3a')]};return db['VoiceRecording'][_0x8b94('0x1e')](_0x43574a)[_0x8b94('0x26')](function(_0x720277){_0x26972f[_0x8b94('0x1e')]=_0x720277;if(_0xea73ce[_0x8b94('0x31')][_0x8b94('0x40')]){_0x54760a['include']=[{'all':!![]}];}return db[_0x8b94('0x2c')][_0x8b94('0x41')](_0x54760a);})[_0x8b94('0x26')](function(_0x22abc5){_0x26972f['rows']=_0x22abc5;return _0x26972f;})[_0x8b94('0x26')](respondWithFilteredResult(_0x33e6ab,_0x54760a))[_0x8b94('0x42')](handleError(_0x33e6ab,null));};exports[_0x8b94('0x43')]=function(_0x36e414,_0x34e3fc){var _0xa18e22={'raw':![],'where':{'id':_0x36e414['params']['id']}},_0x270dbc={};_0x270dbc[_0x8b94('0x2f')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x270dbc[_0x8b94('0x31')]=_[_0x8b94('0x32')](_0x36e414['query']);_0x270dbc[_0x8b94('0x33')]=_[_0x8b94('0x34')](_0x270dbc[_0x8b94('0x2f')],_0x270dbc[_0x8b94('0x31')]);_0xa18e22[_0x8b94('0x35')]=_[_0x8b94('0x34')](_0x270dbc[_0x8b94('0x2f')],qs[_0x8b94('0x44')](_0x36e414['query'][_0x8b94('0x44')]));_0xa18e22[_0x8b94('0x35')]=_0xa18e22[_0x8b94('0x35')][_0x8b94('0x36')]?_0xa18e22[_0x8b94('0x35')]:_0x270dbc[_0x8b94('0x2f')];if(_0x36e414[_0x8b94('0x31')]['includeAll']){_0xa18e22[_0x8b94('0x45')]=[{'all':!![]}];}_0xa18e22=_[_0x8b94('0x3d')]({},_0xa18e22,_0x36e414['options']);return db[_0x8b94('0x2c')][_0x8b94('0x46')](_0xa18e22)[_0x8b94('0x26')](handleEntityNotFound(_0x34e3fc,null))[_0x8b94('0x26')](respondWithResult(_0x34e3fc,null))['catch'](handleError(_0x34e3fc,null));};exports[_0x8b94('0x47')]=function(_0x2da1d1,_0x58071f){return db[_0x8b94('0x2c')][_0x8b94('0x47')](_0x2da1d1[_0x8b94('0x48')],{})[_0x8b94('0x26')](respondWithResult(_0x58071f,0xc9))['catch'](handleError(_0x58071f,null));};exports[_0x8b94('0x25')]=function(_0x27e1a9,_0x4b099d){if(_0x27e1a9[_0x8b94('0x48')]['id']){delete _0x27e1a9[_0x8b94('0x48')]['id'];}return db['VoiceRecording'][_0x8b94('0x46')]({'where':{'id':_0x27e1a9[_0x8b94('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b099d,null))[_0x8b94('0x26')](saveUpdates(_0x27e1a9[_0x8b94('0x48')],null))[_0x8b94('0x26')](respondWithResult(_0x4b099d,null))[_0x8b94('0x42')](handleError(_0x4b099d,null));};exports['describe']=function(_0x1a6e89,_0xc2c1aa){return db[_0x8b94('0x2c')][_0x8b94('0x4a')]()[_0x8b94('0x26')](respondWithResult(_0xc2c1aa,null))[_0x8b94('0x42')](handleError(_0xc2c1aa,null));};exports[_0x8b94('0x4b')]=function(_0x56362e,_0x26aa69,_0x3b0144){var _0x44e1d7=require(_0x8b94('0x4c'));var _0x4b6694=![];var _0x1e3cae={};if(_0x56362e['query'][_0x8b94('0x2e')]&&_0x56362e[_0x8b94('0x31')]['type']==='uniqueid'){_0x1e3cae[_0x8b94('0x4d')]=_0x56362e[_0x8b94('0x49')]['id'];}else{_0x1e3cae['id']=_0x56362e['params']['id'];}return db[_0x8b94('0x2c')][_0x8b94('0x46')]({'where':_0x1e3cae,'attributes':['id','value'],'raw':!![]})[_0x8b94('0x26')](handleEntityNotFound(_0x26aa69,null))[_0x8b94('0x26')](function(_0x5e2d69){if(_0x5e2d69){var _0x2c3777=_0x5e2d69['value'];var _0x201397=util[_0x8b94('0x30')]('%s.cypher',_0x2c3777);if(fs['existsSync'](_0x201397)){_0x4b6694=!![];return _0x44e1d7[_0x8b94('0x4e')](_0x201397,_0x2c3777,config[_0x8b94('0x4f')][_0x8b94('0x50')])[_0x8b94('0x26')](function(){return _0x5e2d69;});}return _0x5e2d69;}})[_0x8b94('0x26')](function(_0x387f8b){if(_0x387f8b){var _0x13c4f0=_0x387f8b[_0x8b94('0x51')];if(!fs[_0x8b94('0x52')](_0x13c4f0)){throw new db[(_0x8b94('0x53'))][(_0x8b94('0x54'))](_0x8b94('0x55'));}if(_0x387f8b[_0x8b94('0x56')]){return _0x26aa69[_0x8b94('0x4b')](_0x13c4f0,_0x387f8b[_0x8b94('0x56')]+path[_0x8b94('0x57')](_0x13c4f0),function(){if(_0x4b6694){fs[_0x8b94('0x58')](_0x13c4f0);}});}else{return _0x26aa69[_0x8b94('0x4b')](_0x13c4f0,function(_0x17c7dd){if(_0x4b6694){fs[_0x8b94('0x58')](_0x13c4f0);}});}}})[_0x8b94('0x42')](function(_0x4e8593){if(_0x4e8593[_0x8b94('0x59')]===_0x8b94('0x55')){_0x26aa69[_0x8b94('0x1a')](0x194)[_0x8b94('0x5a')]('Not\x20found');}else{return handleError(_0x26aa69,null);}});};exports[_0x8b94('0x5b')]=function(_0xa64937,_0x16c5a7,_0x33f2d6){var _0x492908=require(_0x8b94('0x4c'));var _0x102cf2=![];var _0x4a552c={'$and':[db['sequelize'][_0x8b94('0x3a')](db[_0x8b94('0x5c')]['fn'](_0x8b94('0x5d'),db['sequelize'][_0x8b94('0x5e')](_0x8b94('0x4d'))),_0xa64937['query'][_0x8b94('0x5f')])]};if(_0xa64937[_0x8b94('0x31')][_0x8b94('0x2e')]&&_0xa64937[_0x8b94('0x31')][_0x8b94('0x2e')]===_0x8b94('0x4d')){_0x4a552c[_0x8b94('0x60')]['push']({'uniqueid':_0xa64937[_0x8b94('0x49')]['id']});}else{_0x4a552c[_0x8b94('0x60')][_0x8b94('0x61')]({'id':_0xa64937[_0x8b94('0x49')]['id']});}return db[_0x8b94('0x2c')][_0x8b94('0x46')]({'where':_0x4a552c,'attributes':['id',_0x8b94('0x51')],'raw':!![]})[_0x8b94('0x26')](handleEntityNotFound(_0x16c5a7,null))[_0x8b94('0x26')](function(_0xcc2747){if(_0xcc2747){var _0x5139eb=util[_0x8b94('0x30')]('%s.cypher',_0xcc2747[_0x8b94('0x51')]);if(fs[_0x8b94('0x52')](_0x5139eb)){_0x102cf2=!![];return _0x492908[_0x8b94('0x4e')](_0x5139eb,_0xcc2747[_0x8b94('0x51')],config[_0x8b94('0x4f')][_0x8b94('0x50')])['then'](function(){return _0xcc2747;});}return _0xcc2747;}})['then'](function(_0x5ea17f){if(_0x5ea17f){if(!fs['existsSync'](_0x5ea17f[_0x8b94('0x51')])){throw new db['Sequelize']['ValidationError'](_0x8b94('0x55'));}if(_0x5ea17f['filename']){return _0x16c5a7['download'](_0x5ea17f[_0x8b94('0x51')],_0x5ea17f[_0x8b94('0x56')]+path[_0x8b94('0x57')](_0x5ea17f[_0x8b94('0x51')]),function(){if(_0x102cf2){fs[_0x8b94('0x58')](_0x5ea17f[_0x8b94('0x51')]);}});}else{return _0x16c5a7[_0x8b94('0x4b')](_0x5ea17f[_0x8b94('0x51')],function(_0x400819){if(_0x102cf2){fs['unlink'](_0x5ea17f['value']);}});}}})['catch'](handleError(_0x16c5a7,null));};exports['destroy']=function(_0x12e6c9,_0x3159f8){return db['VoiceRecording'][_0x8b94('0x46')]({'where':{'id':_0x12e6c9['params']['id']}})[_0x8b94('0x26')](function(_0x2cd02a){if(_['isNil'](_0x2cd02a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2cd02a;})[_0x8b94('0x26')](function(_0x1db2a8){var _0x45ccc4=_0x1db2a8['value'];logger[_0x8b94('0x62')](_0x8b94('0x63'),_0x45ccc4);if(!_[_0x8b94('0x64')](_0x1db2a8[_0x8b94('0x51')])&&fs[_0x8b94('0x52')](_0x45ccc4)){logger[_0x8b94('0x62')](_0x8b94('0x65')+_0x45ccc4+_0x8b94('0x66'));fs[_0x8b94('0x67')](_0x45ccc4);}_0x45ccc4=_0x45ccc4+_0x8b94('0x68');if(!_[_0x8b94('0x64')](_0x1db2a8['value'])&&fs['existsSync'](_0x45ccc4)){logger[_0x8b94('0x62')](_0x8b94('0x65')+_0x45ccc4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8b94('0x67')](_0x45ccc4);}return _0x1db2a8;})['then'](function(_0x33990d){if(!_0x33990d)throw new InternalError();return _0x33990d[_0x8b94('0x27')]();})[_0x8b94('0x26')](function(){_0x3159f8[_0x8b94('0x1a')](0xcc)[_0x8b94('0x69')]();})['catch'](handleError(_0x3159f8,null));};function getBucketslist(_0x313c68,_0x4c9d2d,_0x1cf3d8){return new Promise(function(_0x13ad7f,_0x31397f){var _0x448494=new AWS['S3']({'accessKeyId':_0x4c9d2d,'secretAccessKey':_0x313c68,'region':_0x1cf3d8});_0x448494[_0x8b94('0x6a')]({},function(_0x1f7125,_0x24218c){if(_0x1f7125){return _0x31397f(_0x1f7125);}else{return _0x13ad7f(_0x24218c);}});});}function createBucket(_0x2185d4,_0x23a5e5,_0x52e18b,_0x180a68){return new Promise(function(_0x51fb71,_0x16084c){var _0x5e3d51=new AWS['S3']({'accessKeyId':_0x23a5e5,'secretAccessKey':_0x2185d4,'region':_0x52e18b});_0x5e3d51[_0x8b94('0x6b')]({'Bucket':_0x180a68},function(_0x16f51a,_0xd08a27){if(_0x16f51a){return _0x16084c(_0x16f51a);}else{return _0x51fb71(_0xd08a27);}});});}function uploadFile(_0x4c80fb,_0x305c04,_0x28feaf,_0xbe04c9,_0x5296e6,_0xc37876){return new Promise(function(_0x4f3091,_0x2894e2){var _0x4884e7=new AWS['S3']({'accessKeyId':_0x305c04,'secretAccessKey':_0x4c80fb,'region':_0x28feaf});_0x4884e7['upload']({'Bucket':_0xbe04c9,'Key':_0x5296e6,'Body':_0xc37876},function(_0x5f27f7,_0x33c201){if(_0x5f27f7){return _0x2894e2(_0x5f27f7);}else{return _0x4f3091(_0x33c201);}});});}function startTranscribe(_0x4b1c15,_0x1508cb,_0x5098b4,_0x56bee3,_0x31980e,_0x599dce){return new Promise(function(_0x5c1caf,_0x46b1e1){var _0x439331=new AWS[(_0x8b94('0x6c'))]({'accessKeyId':_0x1508cb,'secretAccessKey':_0x4b1c15,'region':_0x5098b4});_0x439331['startTranscriptionJob']({'TranscriptionJobName':_0x56bee3,'LanguageCode':_0x31980e,'Media':{'MediaFileUri':_0x599dce}},function(_0x3a0b3f,_0x374382){if(_0x3a0b3f){return _0x46b1e1(_0x3a0b3f);}else{return _0x5c1caf(_0x374382);}});});}function transcribe(_0x2010cd,_0x35ee92,_0x140705,_0x511a1b,_0x489f9d,_0x572bce,_0x543414){return new Promise(function(_0x591641,_0x1079bc){var _0x1985b5={};logger[_0x8b94('0x62')](util[_0x8b94('0x30')](_0x8b94('0x6d'),_0x2010cd,_0x489f9d));return uploadFile(_0x35ee92,_0x140705,_0x511a1b,_0x489f9d,path[_0x8b94('0x6e')](_0x572bce),fs[_0x8b94('0x6f')](_0x572bce))['then'](function(_0x15abab){logger[_0x8b94('0x62')](util['format'](_0x8b94('0x70'),_0x2010cd,_0x489f9d,_0x15abab[_0x8b94('0x71')]));_0x1985b5[_0x8b94('0x72')]=_0x15abab[_0x8b94('0x73')];_0x1985b5[_0x8b94('0x74')]=_0x15abab[_0x8b94('0x71')];logger[_0x8b94('0x62')](util['format'](_0x8b94('0x75'),_0x2010cd));return startTranscribe(_0x35ee92,_0x140705,_0x511a1b,uuidv4(),_0x543414,_0x15abab['Location']);})[_0x8b94('0x26')](function(_0x436a9a){logger[_0x8b94('0x62')](util[_0x8b94('0x30')](_0x8b94('0x76'),_0x2010cd,_0x436a9a[_0x8b94('0x77')][_0x8b94('0x78')]));_0x1985b5[_0x8b94('0x79')]=_0x436a9a[_0x8b94('0x77')][_0x8b94('0x78')];_0x1985b5['transcribeStatus']=_0x436a9a[_0x8b94('0x77')]['TranscriptionJobStatus'];return _0x591641(_0x1985b5);})[_0x8b94('0x42')](function(_0x3500fa){return _0x1079bc(_0x3500fa);});});}exports[_0x8b94('0x7a')]=function(_0x407ae7,_0x289a00,_0x553777){var _0x2eaa24;var _0x57b14a;var _0x24eac1;var _0x2e302c=require(_0x8b94('0x4c'));return db[_0x8b94('0x2c')][_0x8b94('0x7b')]({'where':{'id':_0x407ae7[_0x8b94('0x49')]['id']}})[_0x8b94('0x26')](function(_0xd4adb1){if(_0xd4adb1){var _0x3698ad=util[_0x8b94('0x30')](_0x8b94('0x7c'),_0xd4adb1[_0x8b94('0x51')]);if(fs['existsSync'](_0x3698ad)){cypher=!![];return _0x2e302c[_0x8b94('0x4e')](_0x3698ad,_0xd4adb1[_0x8b94('0x51')],config[_0x8b94('0x4f')]['recording'])[_0x8b94('0x26')](function(){return _0xd4adb1;});}return _0xd4adb1;}})[_0x8b94('0x26')](function(_0x1f465f){if(!_0x1f465f){throw new db[(_0x8b94('0x53'))][(_0x8b94('0x54'))]('Voice\x20Recording\x20not\x20found');}_0x57b14a=_0x1f465f;return db[_0x8b94('0x7d')][_0x8b94('0x7b')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x289a00,null))['then'](function(_0x2df5cd){if(_0x2df5cd){_0x2eaa24=_0x2df5cd;if(!_0x2eaa24['transcribe']||!_0x2eaa24[_0x8b94('0x7e')]||!_0x2eaa24[_0x8b94('0x7f')]||!_0x2eaa24[_0x8b94('0x80')]||!_0x2eaa24[_0x8b94('0x72')]){throw new db[(_0x8b94('0x53'))][(_0x8b94('0x54'))]('Transcribe\x20not\x20configured');}if(_0x407ae7[_0x8b94('0x48')]['runSentiment']&&(!_0x2eaa24[_0x8b94('0x81')]||!_0x2eaa24['sentimentAccountId']||!_0x2eaa24[_0x8b94('0x82')]||!_0x2eaa24['language']||!_0x2eaa24[_0x8b94('0x72')])){throw new db['Sequelize']['ValidationError'](_0x8b94('0x83'));}return db[_0x8b94('0x84')][_0x8b94('0x7b')]({'where':{'id':_0x2eaa24[_0x8b94('0x7e')]}});}})['then'](function(_0x5c9c8){if(!_0x5c9c8){throw new db['Sequelize'][(_0x8b94('0x54'))](_0x8b94('0x85'));}if(!_0x5c9c8[_0x8b94('0x86')]||!_0x5c9c8[_0x8b94('0x87')]){throw new db['Sequelize'][(_0x8b94('0x54'))](_0x8b94('0x88'));}_0x24eac1=_0x5c9c8;return getBucketslist(_0x24eac1[_0x8b94('0x86')],_0x24eac1['data2'],_0x2eaa24['transcribeRegion']);})[_0x8b94('0x26')](function(_0x29ff38){if(_0x29ff38&&_0x29ff38[_0x8b94('0x89')]){var _0x136ba4=_[_0x8b94('0x46')](_0x29ff38[_0x8b94('0x89')],function(_0x3ea7ab){return _0x3ea7ab[_0x8b94('0x8a')]===_0x2eaa24[_0x8b94('0x72')];});if(!_0x136ba4){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x407ae7[_0x8b94('0x49')]['id'],_0x2eaa24[_0x8b94('0x72')]));return createBucket(_0x24eac1[_0x8b94('0x86')],_0x24eac1['data2'],_0x2eaa24['transcribeRegion'],_0x2eaa24[_0x8b94('0x72')]);}logger[_0x8b94('0x62')](util['format'](_0x8b94('0x8b'),_0x407ae7[_0x8b94('0x49')]['id'],_0x2eaa24[_0x8b94('0x72')]));return;}})[_0x8b94('0x26')](function(_0x5f24ed){if(_0x57b14a[_0x8b94('0x8c')]===_0x8b94('0x8d')){return transcribe(_0x407ae7[_0x8b94('0x49')]['id'],_0x24eac1[_0x8b94('0x86')],_0x24eac1[_0x8b94('0x87')],_0x2eaa24[_0x8b94('0x7f')],_0x2eaa24[_0x8b94('0x72')],_0x57b14a[_0x8b94('0x51')],_0x2eaa24['language']);}else{logger[_0x8b94('0x62')](util[_0x8b94('0x30')](_0x8b94('0x8e'),_0x407ae7['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x8b94('0x26')](function(_0x1b9400){if(_0x1b9400){_0x1b9400[_0x8b94('0x8f')]=_0x407ae7[_0x8b94('0x48')][_0x8b94('0x90')];return _0x57b14a[_0x8b94('0x91')](_0x1b9400);}})[_0x8b94('0x26')](respondWithResult(_0x289a00,null))[_0x8b94('0x42')](handleError(_0x289a00,null));};function writeFile(_0x494300,_0x31406b){return new Promise(function(_0x2a9d68,_0x37232e){fs['writeFile'](_0x31406b,_0x494300,function(_0x36d7fb,_0x15a7f3){if(_0x36d7fb){return _0x37232e(_0x36d7fb);}else{return _0x2a9d68(_0x15a7f3);}});});}exports['downloadTranscribe']=function(_0x5070d7,_0x50993f,_0x237f72){return db[_0x8b94('0x2c')][_0x8b94('0x7b')]({'where':{'id':_0x5070d7[_0x8b94('0x49')]['id']}})[_0x8b94('0x26')](handleEntityNotFound(_0x50993f))['then'](function(_0x361aae){if(_0x361aae&&_0x361aae['fileText']){var _0x31079b=_0x361aae['fileText'];var _0x714fbe=config[_0x8b94('0x92')]+'/server/files/transcribes/transcribe_'+_0x361aae['id']+_0x8b94('0x93');if(fs['existsSync'](_0x714fbe)){return _0x714fbe;}return writeFile(_0x31079b,_0x714fbe)['then'](function(){return _0x714fbe;});}else{throw new db['Sequelize'][(_0x8b94('0x54'))]('Transcript\x20not\x20available');}})[_0x8b94('0x26')](function(_0xc7689b){return _0x50993f[_0x8b94('0x4b')](_0xc7689b);})['catch'](handleError(_0x50993f));}; \ No newline at end of file +var _0x2edb=['Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','type','key','differenceBy','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','isNil','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1'];(function(_0x35c756,_0x385d52){var _0x15a025=function(_0x41e986){while(--_0x41e986){_0x35c756['push'](_0x35c756['shift']());}};_0x15a025(++_0x385d52);}(_0x2edb,0x1c2));var _0xb2ed=function(_0xacb435,_0x220f20){_0xacb435=_0xacb435-0x0;var _0x32b976=_0x2edb[_0xacb435];return _0x32b976;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2ed('0x0'));var zipdir=require(_0xb2ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb2ed('0x3'));var util=require(_0xb2ed('0x4'));var path=require(_0xb2ed('0x5'));var sox=require(_0xb2ed('0x6'));var csv=require(_0xb2ed('0x7'));var ejs=require(_0xb2ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2ed('0x9'));var squel=require('squel');var crypto=require(_0xb2ed('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2ed('0x7'));var querystring=require(_0xb2ed('0xb'));var Papa=require(_0xb2ed('0xc'));var AWS=require('aws-sdk');var uuidv4=require(_0xb2ed('0xd'));var Redis=require(_0xb2ed('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb2ed('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2ed('0x10'));var utils=require('../../config/utils');var config=require(_0xb2ed('0x11'));var licenseUtil=require(_0xb2ed('0x12'));var db=require(_0xb2ed('0x13'))['db'];function respondWithStatusCode(_0x3b1506,_0x6e1833){_0x6e1833=_0x6e1833||0xcc;return function(_0xd8f659){if(_0xd8f659){return _0x3b1506['sendStatus'](_0x6e1833);}return _0x3b1506[_0xb2ed('0x14')](_0x6e1833)['end']();};}function respondWithResult(_0xc5d423,_0x2d55f4){_0x2d55f4=_0x2d55f4||0xc8;return function(_0x37f2af){if(_0x37f2af){return _0xc5d423[_0xb2ed('0x14')](_0x2d55f4)[_0xb2ed('0x15')](_0x37f2af);}};}function respondWithFilteredResult(_0x196873,_0x93ef1d){return function(_0x4d2137){if(_0x4d2137){var _0x45074e=typeof _0x93ef1d[_0xb2ed('0x16')]===_0xb2ed('0x17')&&typeof _0x93ef1d[_0xb2ed('0x18')]===_0xb2ed('0x17');var _0x53fe23=_0x4d2137[_0xb2ed('0x19')];var _0x22d0e1=_0x45074e?0x0:_0x93ef1d[_0xb2ed('0x16')];var _0x2cace1=_0x45074e?_0x4d2137[_0xb2ed('0x19')]:_0x93ef1d['offset']+_0x93ef1d[_0xb2ed('0x18')];var _0xaf84cd;if(_0x2cace1>=_0x53fe23){_0x2cace1=_0x53fe23;_0xaf84cd=0xc8;}else{_0xaf84cd=0xce;}_0x196873[_0xb2ed('0x14')](_0xaf84cd);return _0x196873['set'](_0xb2ed('0x1a'),_0x22d0e1+'-'+_0x2cace1+'/'+_0x53fe23)[_0xb2ed('0x15')](_0x4d2137);}return null;};}function patchUpdates(_0x2b3627){return function(_0x3940ae){try{jsonpatch[_0xb2ed('0x1b')](_0x3940ae,_0x2b3627,!![]);}catch(_0x25e74a){return BPromise[_0xb2ed('0x1c')](_0x25e74a);}return _0x3940ae[_0xb2ed('0x1d')]();};}function saveUpdates(_0x3be162,_0x1f7b84){return function(_0x352556){if(_0x352556){return _0x352556[_0xb2ed('0x1e')](_0x3be162)[_0xb2ed('0x1f')](function(_0x382909){return _0x382909;});}return null;};}function removeEntity(_0x2d8694,_0x23502a){return function(_0x51dc6c){if(_0x51dc6c){return _0x51dc6c[_0xb2ed('0x20')]()[_0xb2ed('0x1f')](function(){_0x2d8694[_0xb2ed('0x14')](0xcc)[_0xb2ed('0x21')]();});}};}function handleEntityNotFound(_0x44784d,_0x36de41){return function(_0x224274){if(!_0x224274){_0x44784d[_0xb2ed('0x22')](0x194);}return _0x224274;};}function handleError(_0x5edd10,_0x22c373){_0x22c373=_0x22c373||0x1f4;return function(_0x41a7c9){logger[_0xb2ed('0x23')](_0x41a7c9['stack']);if(_0x41a7c9[_0xb2ed('0x24')]){delete _0x41a7c9[_0xb2ed('0x24')];}_0x5edd10[_0xb2ed('0x14')](_0x22c373)[_0xb2ed('0x25')](_0x41a7c9);};}exports[_0xb2ed('0x26')]=function(_0x13f5e0,_0x4a9b67){var _0x64129d={},_0x3b2ed1={},_0x53e241={'count':0x0,'rows':[]};var _0x6294b2=_[_0xb2ed('0x27')](db['VoiceRecording'][_0xb2ed('0x28')],function(_0xfb709c){return{'name':_0xfb709c['fieldName'],'type':_0xfb709c[_0xb2ed('0x29')][_0xb2ed('0x2a')]};});_0x3b2ed1['model']=_[_0xb2ed('0x2b')](_[_0xb2ed('0x27')](_0x6294b2,'name'),['format']);_0x3b2ed1[_0xb2ed('0x2c')]=_[_0xb2ed('0x2d')](_0x13f5e0[_0xb2ed('0x2c')]);_0x3b2ed1[_0xb2ed('0x2e')]=_['intersection'](_0x3b2ed1['model'],_0x3b2ed1[_0xb2ed('0x2c')]);_0x64129d[_0xb2ed('0x2f')]=_[_0xb2ed('0x30')](_0x3b2ed1['model'],qs[_0xb2ed('0x31')](_0x13f5e0[_0xb2ed('0x2c')]['fields']));_0x64129d[_0xb2ed('0x2f')]=_0x64129d['attributes'][_0xb2ed('0x32')]?_0x64129d['attributes']:_0x3b2ed1[_0xb2ed('0x33')];if(!_0x13f5e0[_0xb2ed('0x2c')][_0xb2ed('0x34')](_0xb2ed('0x35'))){_0x64129d[_0xb2ed('0x18')]=qs['limit'](_0x13f5e0[_0xb2ed('0x2c')][_0xb2ed('0x18')]);_0x64129d[_0xb2ed('0x16')]=qs['offset'](_0x13f5e0[_0xb2ed('0x2c')][_0xb2ed('0x16')]);}_0x64129d[_0xb2ed('0x36')]=qs[_0xb2ed('0x37')](_0x13f5e0['query'][_0xb2ed('0x37')]);_0x64129d[_0xb2ed('0x38')]=qs[_0xb2ed('0x2e')](_[_0xb2ed('0x39')](_0x13f5e0[_0xb2ed('0x2c')],_0x3b2ed1['filters']),_0x6294b2);if(_0x13f5e0['query']['filter']){_0x64129d[_0xb2ed('0x38')]=_[_0xb2ed('0x3a')](_0x64129d[_0xb2ed('0x38')],{'$or':_[_0xb2ed('0x27')](_0x6294b2,function(_0x1a9efc){if(_0x1a9efc['type']!==_0xb2ed('0x3b')){var _0x4289d5={};_0x4289d5[_0x1a9efc[_0xb2ed('0x24')]]={'$like':'%'+_0x13f5e0[_0xb2ed('0x2c')]['filter']+'%'};return _0x4289d5;}})});}_0x64129d=_[_0xb2ed('0x3a')]({},_0x64129d,_0x13f5e0[_0xb2ed('0x3c')]);var _0x1a17ca={'where':_0x64129d[_0xb2ed('0x38')]};return db[_0xb2ed('0x3d')][_0xb2ed('0x19')](_0x1a17ca)[_0xb2ed('0x1f')](function(_0x170b66){_0x53e241[_0xb2ed('0x19')]=_0x170b66;if(_0x13f5e0[_0xb2ed('0x2c')][_0xb2ed('0x3e')]){_0x64129d[_0xb2ed('0x3f')]=[{'all':!![]}];}return db[_0xb2ed('0x3d')][_0xb2ed('0x40')](_0x64129d);})[_0xb2ed('0x1f')](function(_0x2f9449){_0x53e241[_0xb2ed('0x41')]=_0x2f9449;return _0x53e241;})['then'](respondWithFilteredResult(_0x4a9b67,_0x64129d))[_0xb2ed('0x42')](handleError(_0x4a9b67,null));};exports[_0xb2ed('0x43')]=function(_0x3e90a1,_0x29387d){var _0x1f1bcf={'raw':![],'where':{'id':_0x3e90a1[_0xb2ed('0x44')]['id']}},_0x1ea550={};_0x1ea550[_0xb2ed('0x33')]=_[_0xb2ed('0x2d')](db[_0xb2ed('0x3d')]['rawAttributes']);_0x1ea550['query']=_['keys'](_0x3e90a1[_0xb2ed('0x2c')]);_0x1ea550['filters']=_[_0xb2ed('0x30')](_0x1ea550['model'],_0x1ea550[_0xb2ed('0x2c')]);_0x1f1bcf['attributes']=_[_0xb2ed('0x30')](_0x1ea550['model'],qs[_0xb2ed('0x31')](_0x3e90a1[_0xb2ed('0x2c')][_0xb2ed('0x31')]));_0x1f1bcf['attributes']=_0x1f1bcf[_0xb2ed('0x2f')][_0xb2ed('0x32')]?_0x1f1bcf[_0xb2ed('0x2f')]:_0x1ea550[_0xb2ed('0x33')];if(_0x3e90a1[_0xb2ed('0x2c')][_0xb2ed('0x3e')]){_0x1f1bcf[_0xb2ed('0x3f')]=[{'all':!![]}];}_0x1f1bcf=_['merge']({},_0x1f1bcf,_0x3e90a1['options']);return db[_0xb2ed('0x3d')][_0xb2ed('0x45')](_0x1f1bcf)[_0xb2ed('0x1f')](handleEntityNotFound(_0x29387d,null))[_0xb2ed('0x1f')](respondWithResult(_0x29387d,null))['catch'](handleError(_0x29387d,null));};exports[_0xb2ed('0x46')]=function(_0x9fbfd5,_0x234975){return db[_0xb2ed('0x3d')][_0xb2ed('0x46')](_0x9fbfd5[_0xb2ed('0x47')],{})['then'](respondWithResult(_0x234975,0xc9))['catch'](handleError(_0x234975,null));};exports[_0xb2ed('0x1e')]=function(_0x272ca3,_0xcaedee){if(_0x272ca3[_0xb2ed('0x47')]['id']){delete _0x272ca3[_0xb2ed('0x47')]['id'];}return db['VoiceRecording'][_0xb2ed('0x45')]({'where':{'id':_0x272ca3[_0xb2ed('0x44')]['id']}})[_0xb2ed('0x1f')](handleEntityNotFound(_0xcaedee,null))[_0xb2ed('0x1f')](saveUpdates(_0x272ca3[_0xb2ed('0x47')],null))[_0xb2ed('0x1f')](respondWithResult(_0xcaedee,null))[_0xb2ed('0x42')](handleError(_0xcaedee,null));};exports[_0xb2ed('0x48')]=function(_0x468e3e,_0x1df3e3){return db[_0xb2ed('0x3d')][_0xb2ed('0x48')]()[_0xb2ed('0x1f')](respondWithResult(_0x1df3e3,null))['catch'](handleError(_0x1df3e3,null));};exports[_0xb2ed('0x49')]=function(_0x1345a6,_0x209b9e,_0x1224c6){var _0x25a44f=require(_0xb2ed('0x4a'));var _0x45492c=![];var _0x19287d={};if(_0x1345a6[_0xb2ed('0x2c')]['type']&&_0x1345a6[_0xb2ed('0x2c')][_0xb2ed('0x29')]===_0xb2ed('0x4b')){_0x19287d['uniqueid']=_0x1345a6[_0xb2ed('0x44')]['id'];}else{_0x19287d['id']=_0x1345a6['params']['id'];}return db['VoiceRecording'][_0xb2ed('0x45')]({'where':_0x19287d,'attributes':['id',_0xb2ed('0x4c')],'raw':!![]})[_0xb2ed('0x1f')](handleEntityNotFound(_0x209b9e,null))[_0xb2ed('0x1f')](function(_0x6120e9){if(_0x6120e9){var _0x2b8049=_0x6120e9['value'];var _0xb398ff=util[_0xb2ed('0x4d')](_0xb2ed('0x4e'),_0x2b8049);if(fs['existsSync'](_0xb398ff)){_0x45492c=!![];return _0x25a44f[_0xb2ed('0x4f')](_0xb398ff,_0x2b8049,config[_0xb2ed('0x50')][_0xb2ed('0x51')])[_0xb2ed('0x1f')](function(){return _0x6120e9;});}return _0x6120e9;}})['then'](function(_0x47bb05){if(_0x47bb05){var _0x3c46b4=_0x47bb05[_0xb2ed('0x4c')];if(!fs[_0xb2ed('0x52')](_0x3c46b4)){throw new db[(_0xb2ed('0x53'))][(_0xb2ed('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x47bb05[_0xb2ed('0x55')]){return _0x209b9e[_0xb2ed('0x49')](_0x3c46b4,_0x47bb05[_0xb2ed('0x55')]+path[_0xb2ed('0x56')](_0x3c46b4),function(){if(_0x45492c){fs[_0xb2ed('0x57')](_0x3c46b4);}});}else{return _0x209b9e[_0xb2ed('0x49')](_0x3c46b4,function(_0x57baf2){if(_0x45492c){fs['unlink'](_0x3c46b4);}});}}})[_0xb2ed('0x42')](function(_0x4bdeb1){if(_0x4bdeb1[_0xb2ed('0x58')]===_0xb2ed('0x59')){_0x209b9e[_0xb2ed('0x14')](0x194)[_0xb2ed('0x25')]('Not\x20found');}else{return handleError(_0x209b9e,null);}});};exports[_0xb2ed('0x5a')]=function(_0x5d82da,_0x1d4ab7,_0x50a52e){var _0x3ed9cc=require(_0xb2ed('0x4a'));var _0x4b0f82=![];var _0x25ae44={'$and':[db[_0xb2ed('0x5b')][_0xb2ed('0x38')](db[_0xb2ed('0x5b')]['fn'](_0xb2ed('0x5c'),db[_0xb2ed('0x5b')]['col'](_0xb2ed('0x4b'))),_0x5d82da[_0xb2ed('0x2c')]['token'])]};if(_0x5d82da[_0xb2ed('0x2c')]['type']&&_0x5d82da['query'][_0xb2ed('0x29')]==='uniqueid'){_0x25ae44[_0xb2ed('0x5d')][_0xb2ed('0x5e')]({'uniqueid':_0x5d82da['params']['id']});}else{_0x25ae44[_0xb2ed('0x5d')]['push']({'id':_0x5d82da[_0xb2ed('0x44')]['id']});}return db[_0xb2ed('0x3d')][_0xb2ed('0x45')]({'where':_0x25ae44,'attributes':['id','value'],'raw':!![]})[_0xb2ed('0x1f')](handleEntityNotFound(_0x1d4ab7,null))[_0xb2ed('0x1f')](function(_0x2b18dd){if(_0x2b18dd){var _0x38789f=util[_0xb2ed('0x4d')](_0xb2ed('0x4e'),_0x2b18dd['value']);if(fs[_0xb2ed('0x52')](_0x38789f)){_0x4b0f82=!![];return _0x3ed9cc[_0xb2ed('0x4f')](_0x38789f,_0x2b18dd[_0xb2ed('0x4c')],config[_0xb2ed('0x50')]['recording'])[_0xb2ed('0x1f')](function(){return _0x2b18dd;});}return _0x2b18dd;}})[_0xb2ed('0x1f')](function(_0x461680){if(_0x461680){if(!fs[_0xb2ed('0x52')](_0x461680[_0xb2ed('0x4c')])){throw new db[(_0xb2ed('0x53'))][(_0xb2ed('0x54'))](_0xb2ed('0x59'));}if(_0x461680['filename']){return _0x1d4ab7[_0xb2ed('0x49')](_0x461680[_0xb2ed('0x4c')],_0x461680['filename']+path[_0xb2ed('0x56')](_0x461680[_0xb2ed('0x4c')]),function(){if(_0x4b0f82){fs['unlink'](_0x461680[_0xb2ed('0x4c')]);}});}else{return _0x1d4ab7[_0xb2ed('0x49')](_0x461680[_0xb2ed('0x4c')],function(_0x4b704d){if(_0x4b0f82){fs[_0xb2ed('0x57')](_0x461680[_0xb2ed('0x4c')]);}});}}})[_0xb2ed('0x42')](handleError(_0x1d4ab7,null));};exports['destroy']=function(_0x58470a,_0x493259){return db[_0xb2ed('0x3d')]['find']({'where':{'id':_0x58470a[_0xb2ed('0x44')]['id']}})[_0xb2ed('0x1f')](function(_0x5006d6){if(_['isNil'](_0x5006d6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5006d6;})[_0xb2ed('0x1f')](function(_0x2de106){var _0x1b283e=_0x2de106[_0xb2ed('0x4c')];logger[_0xb2ed('0x5f')](_0xb2ed('0x60'),_0x1b283e);if(!_['isNil'](_0x2de106[_0xb2ed('0x4c')])&&fs[_0xb2ed('0x52')](_0x1b283e)){logger[_0xb2ed('0x5f')](_0xb2ed('0x61')+_0x1b283e+_0xb2ed('0x62'));fs['unlinkSync'](_0x1b283e);}_0x1b283e=_0x1b283e+'.cypher';if(!_[_0xb2ed('0x63')](_0x2de106[_0xb2ed('0x4c')])&&fs[_0xb2ed('0x52')](_0x1b283e)){logger[_0xb2ed('0x5f')](_0xb2ed('0x61')+_0x1b283e+_0xb2ed('0x62'));fs[_0xb2ed('0x64')](_0x1b283e);}return _0x2de106;})[_0xb2ed('0x1f')](function(_0x2e022d){if(!_0x2e022d)throw new InternalError();return _0x2e022d['destroy']();})[_0xb2ed('0x1f')](function(){_0x493259[_0xb2ed('0x14')](0xcc)['end']();})[_0xb2ed('0x42')](handleError(_0x493259,null));};function getBucketslist(_0xb1204b,_0x48e144,_0x1d3403){return new Promise(function(_0x3cd7d5,_0x2d219c){var _0x499838=new AWS['S3']({'accessKeyId':_0x48e144,'secretAccessKey':_0xb1204b,'region':_0x1d3403});_0x499838[_0xb2ed('0x65')]({},function(_0x5edb27,_0x4a0948){if(_0x5edb27){return _0x2d219c(_0x5edb27);}else{return _0x3cd7d5(_0x4a0948);}});});}function createBucket(_0x303612,_0x29cf3f,_0x33189d,_0x1c1165){return new Promise(function(_0x245f92,_0x4093e0){var _0x32edaf=new AWS['S3']({'accessKeyId':_0x29cf3f,'secretAccessKey':_0x303612,'region':_0x33189d});_0x32edaf[_0xb2ed('0x66')]({'Bucket':_0x1c1165},function(_0x18c6a4,_0x21a566){if(_0x18c6a4){return _0x4093e0(_0x18c6a4);}else{return _0x245f92(_0x21a566);}});});}function uploadFile(_0x4abcba,_0x239f5b,_0xdd71c2,_0x5a404f,_0x689502,_0x36d411){return new Promise(function(_0x666a26,_0x284d9b){var _0x544275=new AWS['S3']({'accessKeyId':_0x239f5b,'secretAccessKey':_0x4abcba,'region':_0xdd71c2});_0x544275[_0xb2ed('0x67')]({'Bucket':_0x5a404f,'Key':_0x689502,'Body':_0x36d411},function(_0x49e0d8,_0x5a9653){if(_0x49e0d8){return _0x284d9b(_0x49e0d8);}else{return _0x666a26(_0x5a9653);}});});}function startTranscribe(_0xb110c0,_0x124768,_0x5423c4,_0xea2dc6,_0x2052f5,_0x393d32){return new Promise(function(_0x393b70,_0x46cd2e){var _0x4bd2f4=new AWS[(_0xb2ed('0x68'))]({'accessKeyId':_0x124768,'secretAccessKey':_0xb110c0,'region':_0x5423c4});_0x4bd2f4[_0xb2ed('0x69')]({'TranscriptionJobName':_0xea2dc6,'LanguageCode':_0x2052f5,'Media':{'MediaFileUri':_0x393d32}},function(_0x40609b,_0x556a19){if(_0x40609b){return _0x46cd2e(_0x40609b);}else{return _0x393b70(_0x556a19);}});});}function transcribe(_0x18db47,_0x485525,_0x183f8e,_0x2771cf,_0x5aa6e0,_0x515ff1,_0x2a5092){return new Promise(function(_0x2dc083,_0x50146a){var _0xa65e34={};logger['info'](util[_0xb2ed('0x4d')](_0xb2ed('0x6a'),_0x18db47,_0x5aa6e0));return uploadFile(_0x485525,_0x183f8e,_0x2771cf,_0x5aa6e0,path[_0xb2ed('0x6b')](_0x515ff1),fs[_0xb2ed('0x6c')](_0x515ff1))[_0xb2ed('0x1f')](function(_0x3c226b){logger[_0xb2ed('0x5f')](util[_0xb2ed('0x4d')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x18db47,_0x5aa6e0,_0x3c226b[_0xb2ed('0x6d')]));_0xa65e34[_0xb2ed('0x6e')]=_0x3c226b['Bucket'];_0xa65e34[_0xb2ed('0x6f')]=_0x3c226b[_0xb2ed('0x6d')];logger['info'](util['format'](_0xb2ed('0x70'),_0x18db47));return startTranscribe(_0x485525,_0x183f8e,_0x2771cf,uuidv4(),_0x2a5092,_0x3c226b['Location']);})[_0xb2ed('0x1f')](function(_0x2649ba){logger[_0xb2ed('0x5f')](util['format'](_0xb2ed('0x71'),_0x18db47,_0x2649ba['TranscriptionJob'][_0xb2ed('0x72')]));_0xa65e34['transcribeName']=_0x2649ba[_0xb2ed('0x73')][_0xb2ed('0x72')];_0xa65e34[_0xb2ed('0x74')]=_0x2649ba['TranscriptionJob'][_0xb2ed('0x75')];return _0x2dc083(_0xa65e34);})[_0xb2ed('0x42')](function(_0x789757){return _0x50146a(_0x789757);});});}exports[_0xb2ed('0x76')]=function(_0x16bdb8,_0x482e41,_0x2febc6){var _0x229f0e;var _0xfadf75;var _0x2515de;var _0x544c8f=require(_0xb2ed('0x4a'));return db[_0xb2ed('0x3d')][_0xb2ed('0x77')]({'where':{'id':_0x16bdb8[_0xb2ed('0x44')]['id']}})[_0xb2ed('0x1f')](function(_0x1f78d3){if(_0x1f78d3){var _0x4c462a=util[_0xb2ed('0x4d')](_0xb2ed('0x4e'),_0x1f78d3[_0xb2ed('0x4c')]);if(fs[_0xb2ed('0x52')](_0x4c462a)){cypher=!![];return _0x544c8f['decryptFile'](_0x4c462a,_0x1f78d3[_0xb2ed('0x4c')],config[_0xb2ed('0x50')][_0xb2ed('0x51')])[_0xb2ed('0x1f')](function(){return _0x1f78d3;});}return _0x1f78d3;}})[_0xb2ed('0x1f')](function(_0x192cd4){if(!_0x192cd4){throw new db[(_0xb2ed('0x53'))][(_0xb2ed('0x54'))](_0xb2ed('0x78'));}_0xfadf75=_0x192cd4;return db[_0xb2ed('0x79')]['findOne']({'where':{'id':0x1}});})[_0xb2ed('0x1f')](handleEntityNotFound(_0x482e41,null))[_0xb2ed('0x1f')](function(_0x319143){if(_0x319143){_0x229f0e=_0x319143;if(!_0x229f0e[_0xb2ed('0x7a')]||!_0x229f0e['transcribeAccountId']||!_0x229f0e[_0xb2ed('0x7b')]||!_0x229f0e[_0xb2ed('0x7c')]||!_0x229f0e[_0xb2ed('0x6e')]){throw new db['Sequelize'][(_0xb2ed('0x54'))](_0xb2ed('0x7d'));}if(_0x16bdb8[_0xb2ed('0x47')]['runSentiment']&&(!_0x229f0e['sentiment']||!_0x229f0e[_0xb2ed('0x7e')]||!_0x229f0e[_0xb2ed('0x7f')]||!_0x229f0e[_0xb2ed('0x7c')]||!_0x229f0e[_0xb2ed('0x6e')])){throw new db[(_0xb2ed('0x53'))][(_0xb2ed('0x54'))](_0xb2ed('0x80'));}return db['CloudProvider']['findOne']({'where':{'id':_0x229f0e[_0xb2ed('0x81')]}});}})[_0xb2ed('0x1f')](function(_0x1e4578){if(!_0x1e4578){throw new db['Sequelize'][(_0xb2ed('0x54'))](_0xb2ed('0x82'));}if(!_0x1e4578['data1']||!_0x1e4578[_0xb2ed('0x83')]){throw new db['Sequelize'][(_0xb2ed('0x54'))](_0xb2ed('0x84'));}_0x2515de=_0x1e4578;return getBucketslist(_0x2515de[_0xb2ed('0x85')],_0x2515de['data2'],_0x229f0e[_0xb2ed('0x7b')]);})[_0xb2ed('0x1f')](function(_0x62af24){if(_0x62af24&&_0x62af24[_0xb2ed('0x86')]){var _0x35cb64=_['find'](_0x62af24['Buckets'],function(_0x392e8d){return _0x392e8d[_0xb2ed('0x87')]===_0x229f0e[_0xb2ed('0x6e')];});if(!_0x35cb64){logger['info'](util['format'](_0xb2ed('0x88'),_0x16bdb8[_0xb2ed('0x44')]['id'],_0x229f0e['bucket']));return createBucket(_0x2515de[_0xb2ed('0x85')],_0x2515de['data2'],_0x229f0e[_0xb2ed('0x7b')],_0x229f0e[_0xb2ed('0x6e')]);}logger[_0xb2ed('0x5f')](util['format'](_0xb2ed('0x89'),_0x16bdb8[_0xb2ed('0x44')]['id'],_0x229f0e['bucket']));return;}})['then'](function(_0x1d86e0){if(_0xfadf75[_0xb2ed('0x74')]==='NEW'){return transcribe(_0x16bdb8[_0xb2ed('0x44')]['id'],_0x2515de[_0xb2ed('0x85')],_0x2515de[_0xb2ed('0x83')],_0x229f0e[_0xb2ed('0x7b')],_0x229f0e['bucket'],_0xfadf75[_0xb2ed('0x4c')],_0x229f0e[_0xb2ed('0x7c')]);}else{logger[_0xb2ed('0x5f')](util[_0xb2ed('0x4d')](_0xb2ed('0x8a'),_0x16bdb8['params']['id']));return{'transcribeStatus':_0xb2ed('0x8b')};}})[_0xb2ed('0x1f')](function(_0x42a6b4){if(_0x42a6b4){_0x42a6b4['tempSentiment']=_0x16bdb8[_0xb2ed('0x47')]['runSentiment'];return _0xfadf75[_0xb2ed('0x8c')](_0x42a6b4);}})[_0xb2ed('0x1f')](respondWithResult(_0x482e41,null))[_0xb2ed('0x42')](handleError(_0x482e41,null));};function writeFile(_0x320d48,_0x59ce8f){return new Promise(function(_0x201397,_0x3bb93e){fs[_0xb2ed('0x8d')](_0x59ce8f,_0x320d48,function(_0x22fe59,_0xc0528d){if(_0x22fe59){return _0x3bb93e(_0x22fe59);}else{return _0x201397(_0xc0528d);}});});}exports[_0xb2ed('0x8e')]=function(_0x1f1e5a,_0x308a85,_0x3482a5){return db[_0xb2ed('0x3d')][_0xb2ed('0x77')]({'where':{'id':_0x1f1e5a[_0xb2ed('0x44')]['id']}})[_0xb2ed('0x1f')](handleEntityNotFound(_0x308a85))[_0xb2ed('0x1f')](function(_0x2d22ba){if(_0x2d22ba&&_0x2d22ba[_0xb2ed('0x8f')]){var _0x50f2af=_0x2d22ba['fileText'];var _0x147a34=config[_0xb2ed('0x90')]+'/server/files/transcribes/transcribe_'+_0x2d22ba['id']+'.txt';if(fs['existsSync'](_0x147a34)){return _0x147a34;}return writeFile(_0x50f2af,_0x147a34)['then'](function(){return _0x147a34;});}else{throw new db['Sequelize']['ValidationError'](_0xb2ed('0x91'));}})[_0xb2ed('0x1f')](function(_0x3e19f5){return _0x308a85[_0xb2ed('0x49')](_0x3e19f5);})[_0xb2ed('0x42')](handleError(_0x308a85));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 476c3de..8113a18 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 _0x3074=['uniqueid','transcribeStatus','./voiceRecording.attributes','define','voice_recordings'];(function(_0x3b9bc8,_0x521569){var _0x2fdc2c=function(_0x9b6bc8){while(--_0x9b6bc8){_0x3b9bc8['push'](_0x3b9bc8['shift']());}};_0x2fdc2c(++_0x521569);}(_0x3074,0x1dd));var _0x4307=function(_0x17689a,_0x51d1cf){_0x17689a=_0x17689a-0x0;var _0x18f39f=_0x3074[_0x17689a];return _0x18f39f;};'use strict';var attributes=require(_0x4307('0x0'));module['exports']=function(_0x24f815,_0x393d68){return _0x24f815[_0x4307('0x1')]('VoiceRecording',attributes,{'tableName':_0x4307('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4307('0x3')]},{'name':_0x4307('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e35=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x35f1f0,_0x5a69a3){var _0x41cd13=function(_0x59ab8f){while(--_0x59ab8f){_0x35f1f0['push'](_0x35f1f0['shift']());}};_0x41cd13(++_0x5a69a3);}(_0x2e35,0x1d0));var _0x52e3=function(_0x33a786,_0x2b5e68){_0x33a786=_0x33a786-0x0;var _0xa3d8d8=_0x2e35[_0x33a786];return _0xa3d8d8;};'use strict';var attributes=require(_0x52e3('0x0'));module[_0x52e3('0x1')]=function(_0x1dc2a2,_0x5b86c0){return _0x1dc2a2[_0x52e3('0x2')](_0x52e3('0x3'),attributes,{'tableName':_0x52e3('0x4'),'paranoid':![],'indexes':[{'name':_0x52e3('0x5'),'fields':['uniqueid']},{'name':_0x52e3('0x6'),'fields':[_0x52e3('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c31173d..3820e1f 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 _0x7b84=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x7b84,0x17c));var _0x47b8=function(_0x1a5f8e,_0x1a9efd){_0x1a5f8e=_0x1a5f8e-0x0;var _0xf2c03f=_0x7b84[_0x1a5f8e];return _0xf2c03f;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('VoiceRecording,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['UpdateVoiceRecording']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['VoiceRecording']['update'](_0x4f7317['body'],{'raw':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1c')]||null:null,'attributes':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1e')]||null:null})[_0x47b8('0xe')](function(_0x54f6bc){logger[_0x47b8('0xf')](_0x47b8('0x1f'),_0x4f7317);logger['debug'](_0x47b8('0x1f'),_0x4f7317,JSON[_0x47b8('0x14')](_0x54f6bc));_0x36faf1(_0x54f6bc);})[_0x47b8('0x19')](function(_0x142fb6){logger['error'](_0x47b8('0x1f'),_0x142fb6[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195[_0x47b8('0x15')](0x1f4,_0x142fb6[_0x47b8('0x17')]));});});};exports[_0x47b8('0x20')]=function(_0xbf5ce9){var _0x40918f=this;return new Promise(function(_0x568c1e,_0x43fd49){var _0x1f719a=require('../../components/encryptor');var _0x195a66;return db[_0x47b8('0x21')][_0x47b8('0x22')]({'attributes':['id',_0x47b8('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x162d96){_0x195a66=_0x162d96;return db['VoiceRecording'][_0x47b8('0x24')](_0xbf5ce9[_0x47b8('0x25')]);})[_0x47b8('0xe')](function(_0x2e540d){if(_0x195a66['callRecordingEncryption']&&fs[_0x47b8('0x26')](_0x2e540d[_0x47b8('0x27')])){var _0x402e7c=util[_0x47b8('0x28')](_0x47b8('0x29'),_0x2e540d[_0x47b8('0x27')]);return _0x1f719a['encryptFile'](_0x2e540d['value'],_0x402e7c,config['secrets'][_0x47b8('0x2a')])[_0x47b8('0xe')](function(){fs[_0x47b8('0x2b')](_0x2e540d['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x2e540d;});}return _0x2e540d;})['then'](function(_0x347769){logger[_0x47b8('0xf')](_0x47b8('0x20'),_0xbf5ce9);logger[_0x47b8('0x12')](_0x47b8('0x20'),_0xbf5ce9,JSON[_0x47b8('0x14')](_0x347769));_0x568c1e(_0x347769);})[_0x47b8('0x19')](function(_0x460dcc){logger[_0x47b8('0x15')]('CreateVoiceRecording',_0x460dcc['message'],_0xbf5ce9);_0x43fd49(_0x40918f[_0x47b8('0x15')](0x1f4,_0x460dcc[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0x5fdc=['CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','info','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','catch'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x5fdc,0x127));var _0xc5fd=function(_0x4ccbe9,_0x16c1c1){_0x4ccbe9=_0x4ccbe9-0x0;var _0x65a1d1=_0x5fdc[_0x4ccbe9];return _0x65a1d1;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15ffe7,_0x5a2eb4,_0x5d86e5){return new BPromise(function(_0x493389,_0x224801){return client[_0xc5fd('0xe')](_0x15ffe7,_0x5d86e5)[_0xc5fd('0xf')](function(_0x45c91f){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5a2eb4,_0xc5fd('0x10'));logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x5a2eb4,_0xc5fd('0x10'),JSON[_0xc5fd('0x13')](_0x45c91f));if(_0x45c91f[_0xc5fd('0x14')]){if(_0x45c91f['error'][_0xc5fd('0x15')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x224801(_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);}logger[_0xc5fd('0x14')](_0xc5fd('0x17'),_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x493389(_0x45c91f['error'][_0xc5fd('0x16')]);}else{logger[_0xc5fd('0x18')](_0xc5fd('0x17'),_0x5a2eb4,_0xc5fd('0x10'));_0x493389(_0x45c91f['result']['message']);}})['catch'](function(_0x5529b3){logger['error'](_0xc5fd('0x17'),_0x5a2eb4,_0x5529b3);_0x224801(_0x5529b3);});});}exports[_0xc5fd('0x19')]=function(_0x27f611){var _0xd0a9f1=this;return new Promise(function(_0x2ee392,_0x3f981f){return db[_0xc5fd('0x1a')]['update'](_0x27f611[_0xc5fd('0x1b')],{'raw':_0x27f611[_0xc5fd('0x1c')]?_0x27f611[_0xc5fd('0x1c')][_0xc5fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f611[_0xc5fd('0x1c')]?_0x27f611['options'][_0xc5fd('0x1e')]||null:null,'attributes':_0x27f611[_0xc5fd('0x1c')]?_0x27f611[_0xc5fd('0x1c')][_0xc5fd('0x1f')]||null:null,'limit':_0x27f611['options']?_0x27f611['options'][_0xc5fd('0x20')]||null:null})[_0xc5fd('0xf')](function(_0x3d7211){logger[_0xc5fd('0x18')](_0xc5fd('0x19'),_0x27f611);logger[_0xc5fd('0x11')]('UpdateVoiceRecording',_0x27f611,JSON[_0xc5fd('0x13')](_0x3d7211));_0x2ee392(_0x3d7211);})[_0xc5fd('0x21')](function(_0x1a5174){logger[_0xc5fd('0x14')](_0xc5fd('0x19'),_0x1a5174[_0xc5fd('0x16')],_0x27f611);_0x3f981f(_0xd0a9f1[_0xc5fd('0x14')](0x1f4,_0x1a5174['message']));});});};exports[_0xc5fd('0x22')]=function(_0x48cd1d){var _0x2ee700=this;return new Promise(function(_0x231368,_0x44681d){var _0x2bee22=require('../../components/encryptor');var _0x176313;return db[_0xc5fd('0x23')][_0xc5fd('0x24')]({'attributes':['id',_0xc5fd('0x25')],'where':{'id':0x1},'raw':!![]})[_0xc5fd('0xf')](function(_0x209975){_0x176313=_0x209975;return db['VoiceRecording'][_0xc5fd('0x26')](_0x48cd1d['body']);})['then'](function(_0x12a962){if(_0x176313[_0xc5fd('0x25')]&&fs[_0xc5fd('0x27')](_0x12a962[_0xc5fd('0x28')])){var _0x7693c4=util[_0xc5fd('0x29')](_0xc5fd('0x2a'),_0x12a962[_0xc5fd('0x28')]);return _0x2bee22['encryptFile'](_0x12a962[_0xc5fd('0x28')],_0x7693c4,config[_0xc5fd('0x2b')][_0xc5fd('0x2c')])[_0xc5fd('0xf')](function(){fs[_0xc5fd('0x2d')](_0x12a962[_0xc5fd('0x28')]);logger[_0xc5fd('0x18')](_0xc5fd('0x2e'));return _0x12a962;});}return _0x12a962;})[_0xc5fd('0xf')](function(_0x466aa1){logger[_0xc5fd('0x18')](_0xc5fd('0x22'),_0x48cd1d);logger['debug'](_0xc5fd('0x22'),_0x48cd1d,JSON[_0xc5fd('0x13')](_0x466aa1));_0x231368(_0x466aa1);})[_0xc5fd('0x21')](function(_0x1fa329){logger[_0xc5fd('0x14')](_0xc5fd('0x22'),_0x1fa329[_0xc5fd('0x16')],_0x48cd1d);_0x44681d(_0x2ee700[_0xc5fd('0x14')](0x1f4,_0x1fa329[_0xc5fd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d917aeb..a3a7719 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 _0x732e=['isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id'];(function(_0x28ef4e,_0x202aa3){var _0x1aa097=function(_0x38ca63){while(--_0x38ca63){_0x28ef4e['push'](_0x28ef4e['shift']());}};_0x1aa097(++_0x202aa3);}(_0x732e,0x1d6));var _0xe732=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0x732e[_0x55b460];return _0x3ac537;};'use strict';var multer=require(_0xe732('0x0'));var util=require(_0xe732('0x1'));var path=require(_0xe732('0x2'));var timeout=require(_0xe732('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe732('0x4'));var auth=require(_0xe732('0x5'));var interaction=require(_0xe732('0x6'));var config=require(_0xe732('0x7'));var controller=require('./voiceTransferReport.controller');router[_0xe732('0x8')]('/',auth['isAuthenticated'](),controller[_0xe732('0x9')]);router[_0xe732('0x8')](_0xe732('0xa'),auth['isAuthenticated'](),controller[_0xe732('0xb')]);router[_0xe732('0x8')](_0xe732('0xc'),auth[_0xe732('0xd')](),controller[_0xe732('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe732('0xf')]);router[_0xe732('0x10')](_0xe732('0xc'),auth[_0xe732('0xd')](),controller[_0xe732('0x11')]);router[_0xe732('0x12')](_0xe732('0xc'),auth['isAuthenticated'](),controller[_0xe732('0x13')]);module[_0xe732('0x14')]=router; \ No newline at end of file +var _0x3a35=['post','create','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4c2d28,_0x599dd2){var _0x2466b4=function(_0x231a3e){while(--_0x231a3e){_0x4c2d28['push'](_0x4c2d28['shift']());}};_0x2466b4(++_0x599dd2);}(_0x3a35,0xdc));var _0x53a3=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3a35[_0x24237f];return _0x48298e;};'use strict';var multer=require('multer');var util=require(_0x53a3('0x0'));var path=require(_0x53a3('0x1'));var timeout=require('connect-timeout');var express=require(_0x53a3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x53a3('0x3'));var interaction=require(_0x53a3('0x4'));var config=require(_0x53a3('0x5'));var controller=require(_0x53a3('0x6'));router[_0x53a3('0x7')]('/',auth[_0x53a3('0x8')](),controller[_0x53a3('0x9')]);router['get'](_0x53a3('0xa'),auth[_0x53a3('0x8')](),controller[_0x53a3('0xb')]);router[_0x53a3('0x7')](_0x53a3('0xc'),auth['isAuthenticated'](),controller[_0x53a3('0xd')]);router[_0x53a3('0xe')]('/',auth[_0x53a3('0x8')](),controller[_0x53a3('0xf')]);router['put'](_0x53a3('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x53a3('0x8')](),controller[_0x53a3('0x10')]);module[_0x53a3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f87a7b5..a6f176e 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 _0xb6cf=['attended','STRING','ENUM','Yes','sequelize','moment'];(function(_0x357e77,_0x1dcc82){var _0x1e36f2=function(_0x5626bb){while(--_0x5626bb){_0x357e77['push'](_0x357e77['shift']());}};_0x1e36f2(++_0x1dcc82);}(_0xb6cf,0x1cc));var _0xfb6c=function(_0x22730b,_0x3aafcd){_0x22730b=_0x22730b-0x0;var _0x20af64=_0xb6cf[_0x22730b];return _0x20af64;};'use strict';var Sequelize=require(_0xfb6c('0x0'));var moment=require(_0xfb6c('0x1'));module['exports']={'type':{'type':Sequelize['ENUM']('blind',_0xfb6c('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xfb6c('0x3')]},'transferercalleridname':{'type':Sequelize[_0xfb6c('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfb6c('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xfb6c('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xfb6c('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xfb6c('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xfb6c('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xfb6c('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfb6c('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfb6c('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xfb6c('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xfb6c('0x3')]},'isexternal':{'type':Sequelize[_0xfb6c('0x4')](_0xfb6c('0x5'),'No')},'context':{'type':Sequelize[_0xfb6c('0x3')]},'extension':{'type':Sequelize[_0xfb6c('0x3')]}}; \ No newline at end of file +var _0xcb5c=['attended','STRING','Yes','moment','ENUM','blind'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xcb5c,0x12f));var _0xccb5=function(_0x58c5ac,_0x369d37){_0x58c5ac=_0x58c5ac-0x0;var _0x4af72a=_0xcb5c[_0x58c5ac];return _0x4af72a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xccb5('0x0'));module['exports']={'type':{'type':Sequelize[_0xccb5('0x1')](_0xccb5('0x2'),_0xccb5('0x3'))},'result':{'type':Sequelize[_0xccb5('0x4')]},'transfererchannel':{'type':Sequelize[_0xccb5('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xccb5('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xccb5('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xccb5('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xccb5('0x4')]},'transferercontext':{'type':Sequelize[_0xccb5('0x4')]},'transfererexten':{'type':Sequelize[_0xccb5('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xccb5('0x4')]},'transfereechannel':{'type':Sequelize[_0xccb5('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xccb5('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xccb5('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xccb5('0x4')]},'transfereecontext':{'type':Sequelize[_0xccb5('0x4')]},'transfereeexten':{'type':Sequelize[_0xccb5('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xccb5('0x4')]},'isexternal':{'type':Sequelize[_0xccb5('0x1')](_0xccb5('0x5'),'No')},'context':{'type':Sequelize[_0xccb5('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e1ac57d..2a68e8a 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 _0x48b3=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','include','find'];(function(_0x45ea74,_0x193efd){var _0x29a1af=function(_0x269f9){while(--_0x269f9){_0x45ea74['push'](_0x45ea74['shift']());}};_0x29a1af(++_0x193efd);}(_0x48b3,0xed));var _0x348b=function(_0x796790,_0x15a363){_0x796790=_0x796790-0x0;var _0x55e38a=_0x48b3[_0x796790];return _0x55e38a;};'use strict';var emlformat=require(_0x348b('0x0'));var rimraf=require(_0x348b('0x1'));var zipdir=require(_0x348b('0x2'));var jsonpatch=require(_0x348b('0x3'));var rp=require(_0x348b('0x4'));var moment=require(_0x348b('0x5'));var BPromise=require(_0x348b('0x6'));var Mustache=require(_0x348b('0x7'));var util=require(_0x348b('0x8'));var path=require(_0x348b('0x9'));var sox=require('sox');var csv=require(_0x348b('0xa'));var ejs=require(_0x348b('0xb'));var fs=require('fs');var fs_extra=require(_0x348b('0xc'));var _=require(_0x348b('0xd'));var squel=require(_0x348b('0xe'));var crypto=require(_0x348b('0xf'));var jsforce=require(_0x348b('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x348b('0x11'));var Papa=require(_0x348b('0x12'));var Redis=require(_0x348b('0x13'));var authService=require(_0x348b('0x14'));var qs=require(_0x348b('0x15'));var as=require(_0x348b('0x16'));var hardwareService=require(_0x348b('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x348b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x348b('0x19'));var db=require(_0x348b('0x1a'))['db'];function respondWithStatusCode(_0x4ba64c,_0x55629c){_0x55629c=_0x55629c||0xcc;return function(_0x295e4c){if(_0x295e4c){return _0x4ba64c[_0x348b('0x1b')](_0x55629c);}return _0x4ba64c['status'](_0x55629c)[_0x348b('0x1c')]();};}function respondWithResult(_0x18f426,_0x3b02d2){_0x3b02d2=_0x3b02d2||0xc8;return function(_0x3b4a71){if(_0x3b4a71){return _0x18f426[_0x348b('0x1d')](_0x3b02d2)[_0x348b('0x1e')](_0x3b4a71);}};}function respondWithFilteredResult(_0x51ed76,_0x4161f0){return function(_0x524dba){if(_0x524dba){var _0x358d52=typeof _0x4161f0['offset']===_0x348b('0x1f')&&typeof _0x4161f0[_0x348b('0x20')]===_0x348b('0x1f');var _0x5fb9d4=_0x524dba[_0x348b('0x21')];var _0x3e682e=_0x358d52?0x0:_0x4161f0[_0x348b('0x22')];var _0x3a9913=_0x358d52?_0x524dba[_0x348b('0x21')]:_0x4161f0[_0x348b('0x22')]+_0x4161f0['limit'];var _0x4071b9;if(_0x3a9913>=_0x5fb9d4){_0x3a9913=_0x5fb9d4;_0x4071b9=0xc8;}else{_0x4071b9=0xce;}_0x51ed76[_0x348b('0x1d')](_0x4071b9);return _0x51ed76[_0x348b('0x23')](_0x348b('0x24'),_0x3e682e+'-'+_0x3a9913+'/'+_0x5fb9d4)[_0x348b('0x1e')](_0x524dba);}return null;};}function patchUpdates(_0x4e5834){return function(_0x5dba45){try{jsonpatch[_0x348b('0x25')](_0x5dba45,_0x4e5834,!![]);}catch(_0x4b4477){return BPromise[_0x348b('0x26')](_0x4b4477);}return _0x5dba45['save']();};}function saveUpdates(_0x27683d,_0x144f2f){return function(_0x36981b){if(_0x36981b){return _0x36981b[_0x348b('0x27')](_0x27683d)[_0x348b('0x28')](function(_0x24bd4a){return _0x24bd4a;});}return null;};}function removeEntity(_0x24aef6,_0x3d9e33){return function(_0x166d4f){if(_0x166d4f){return _0x166d4f[_0x348b('0x29')]()['then'](function(){_0x24aef6[_0x348b('0x1d')](0xcc)[_0x348b('0x1c')]();});}};}function handleEntityNotFound(_0x185a90,_0x37a4ac){return function(_0x175059){if(!_0x175059){_0x185a90['sendStatus'](0x194);}return _0x175059;};}function handleError(_0x34d18c,_0x46ca56){_0x46ca56=_0x46ca56||0x1f4;return function(_0x291b56){logger['error'](_0x291b56[_0x348b('0x2a')]);if(_0x291b56[_0x348b('0x2b')]){delete _0x291b56[_0x348b('0x2b')];}_0x34d18c['status'](_0x46ca56)[_0x348b('0x2c')](_0x291b56);};}exports['index']=function(_0x5a1781,_0x45bd4a){var _0x52ba41={},_0x44750e={},_0x578acc={'count':0x0,'rows':[]};var _0x10c9e7=_[_0x348b('0x2d')](db[_0x348b('0x2e')][_0x348b('0x2f')],function(_0x27d62d){return{'name':_0x27d62d[_0x348b('0x30')],'type':_0x27d62d[_0x348b('0x31')]['key']};});_0x44750e[_0x348b('0x32')]=_[_0x348b('0x2d')](_0x10c9e7,_0x348b('0x2b'));_0x44750e['query']=_[_0x348b('0x33')](_0x5a1781[_0x348b('0x34')]);_0x44750e[_0x348b('0x35')]=_['intersection'](_0x44750e[_0x348b('0x32')],_0x44750e['query']);_0x52ba41[_0x348b('0x36')]=_['intersection'](_0x44750e[_0x348b('0x32')],qs[_0x348b('0x37')](_0x5a1781[_0x348b('0x34')][_0x348b('0x37')]));_0x52ba41[_0x348b('0x36')]=_0x52ba41[_0x348b('0x36')]['length']?_0x52ba41[_0x348b('0x36')]:_0x44750e['model'];if(!_0x5a1781[_0x348b('0x34')]['hasOwnProperty'](_0x348b('0x38'))){_0x52ba41[_0x348b('0x20')]=qs[_0x348b('0x20')](_0x5a1781[_0x348b('0x34')][_0x348b('0x20')]);_0x52ba41[_0x348b('0x22')]=qs[_0x348b('0x22')](_0x5a1781[_0x348b('0x34')][_0x348b('0x22')]);}_0x52ba41[_0x348b('0x39')]=qs[_0x348b('0x3a')](_0x5a1781[_0x348b('0x34')]['sort']);_0x52ba41['where']=qs['filters'](_[_0x348b('0x3b')](_0x5a1781[_0x348b('0x34')],_0x44750e[_0x348b('0x35')]),_0x10c9e7);if(_0x5a1781[_0x348b('0x34')][_0x348b('0x3c')]){_0x52ba41[_0x348b('0x3d')]=_[_0x348b('0x3e')](_0x52ba41['where'],{'$or':_[_0x348b('0x2d')](_0x10c9e7,function(_0x408a2a){if(_0x408a2a[_0x348b('0x31')]!==_0x348b('0x3f')){var _0x43d902={};_0x43d902[_0x408a2a[_0x348b('0x2b')]]={'$like':'%'+_0x5a1781[_0x348b('0x34')][_0x348b('0x3c')]+'%'};return _0x43d902;}})});}_0x52ba41=_[_0x348b('0x3e')]({},_0x52ba41,_0x5a1781[_0x348b('0x40')]);var _0x3a00f6={'where':_0x52ba41[_0x348b('0x3d')]};return db['VoiceTransferReport'][_0x348b('0x21')](_0x3a00f6)[_0x348b('0x28')](function(_0x117305){_0x578acc[_0x348b('0x21')]=_0x117305;if(_0x5a1781[_0x348b('0x34')][_0x348b('0x41')]){_0x52ba41['include']=[{'all':!![]}];}return db[_0x348b('0x2e')][_0x348b('0x42')](_0x52ba41);})[_0x348b('0x28')](function(_0x266360){_0x578acc[_0x348b('0x43')]=_0x266360;return _0x578acc;})[_0x348b('0x28')](respondWithFilteredResult(_0x45bd4a,_0x52ba41))[_0x348b('0x44')](handleError(_0x45bd4a,null));};exports[_0x348b('0x45')]=function(_0x46e500,_0xfb1c8b){var _0x4460be={'raw':!![],'where':{'id':_0x46e500[_0x348b('0x46')]['id']}},_0x138e86={};_0x138e86[_0x348b('0x32')]=_[_0x348b('0x33')](db[_0x348b('0x2e')][_0x348b('0x2f')]);_0x138e86[_0x348b('0x34')]=_[_0x348b('0x33')](_0x46e500[_0x348b('0x34')]);_0x138e86[_0x348b('0x35')]=_[_0x348b('0x47')](_0x138e86['model'],_0x138e86[_0x348b('0x34')]);_0x4460be[_0x348b('0x36')]=_['intersection'](_0x138e86[_0x348b('0x32')],qs[_0x348b('0x37')](_0x46e500[_0x348b('0x34')][_0x348b('0x37')]));_0x4460be['attributes']=_0x4460be[_0x348b('0x36')][_0x348b('0x48')]?_0x4460be['attributes']:_0x138e86['model'];if(_0x46e500[_0x348b('0x34')][_0x348b('0x41')]){_0x4460be[_0x348b('0x49')]=[{'all':!![]}];}_0x4460be=_['merge']({},_0x4460be,_0x46e500[_0x348b('0x40')]);return db[_0x348b('0x2e')][_0x348b('0x4a')](_0x4460be)[_0x348b('0x28')](handleEntityNotFound(_0xfb1c8b,null))[_0x348b('0x28')](respondWithResult(_0xfb1c8b,null))[_0x348b('0x44')](handleError(_0xfb1c8b,null));};exports[_0x348b('0x4b')]=function(_0x1bdbcd,_0x37ba72){return db['VoiceTransferReport']['create'](_0x1bdbcd['body'],{})['then'](respondWithResult(_0x37ba72,0xc9))['catch'](handleError(_0x37ba72,null));};exports['update']=function(_0x2bad66,_0x32ec52){if(_0x2bad66[_0x348b('0x4c')]['id']){delete _0x2bad66[_0x348b('0x4c')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x2bad66['params']['id']}})[_0x348b('0x28')](handleEntityNotFound(_0x32ec52,null))[_0x348b('0x28')](saveUpdates(_0x2bad66[_0x348b('0x4c')],null))['then'](respondWithResult(_0x32ec52,null))[_0x348b('0x44')](handleError(_0x32ec52,null));};exports[_0x348b('0x29')]=function(_0x333f49,_0x3862a8){return db[_0x348b('0x2e')][_0x348b('0x4a')]({'where':{'id':_0x333f49['params']['id']}})[_0x348b('0x28')](handleEntityNotFound(_0x3862a8,null))[_0x348b('0x28')](removeEntity(_0x3862a8,null))[_0x348b('0x44')](handleError(_0x3862a8,null));};exports[_0x348b('0x4d')]=function(_0x2392fe,_0x59126c){return db[_0x348b('0x2e')][_0x348b('0x4d')]()[_0x348b('0x28')](respondWithResult(_0x59126c,null))['catch'](handleError(_0x59126c,null));}; \ No newline at end of file +var _0x750c=['filter','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','model','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0xc45b9e,_0x40022d){var _0x35a945=function(_0x12472b){while(--_0x12472b){_0xc45b9e['push'](_0xc45b9e['shift']());}};_0x35a945(++_0x40022d);}(_0x750c,0x1b8));var _0xc750=function(_0x3c23c0,_0x20888f){_0x3c23c0=_0x3c23c0-0x0;var _0x370f3e=_0x750c[_0x3c23c0];return _0x370f3e;};'use strict';var emlformat=require(_0xc750('0x0'));var rimraf=require(_0xc750('0x1'));var zipdir=require(_0xc750('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc750('0x3'));var moment=require('moment');var BPromise=require(_0xc750('0x4'));var Mustache=require(_0xc750('0x5'));var util=require(_0xc750('0x6'));var path=require(_0xc750('0x7'));var sox=require(_0xc750('0x8'));var csv=require(_0xc750('0x9'));var ejs=require(_0xc750('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc750('0xb'));var squel=require('squel');var crypto=require(_0xc750('0xc'));var jsforce=require(_0xc750('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc750('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc750('0xf'));var as=require(_0xc750('0x10'));var hardwareService=require(_0xc750('0x11'));var logger=require(_0xc750('0x12'))('api');var utils=require(_0xc750('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc750('0x14'))['db'];function respondWithStatusCode(_0x365f0e,_0x4f7716){_0x4f7716=_0x4f7716||0xcc;return function(_0x438ba1){if(_0x438ba1){return _0x365f0e[_0xc750('0x15')](_0x4f7716);}return _0x365f0e[_0xc750('0x16')](_0x4f7716)[_0xc750('0x17')]();};}function respondWithResult(_0x2b4c8f,_0x3ee286){_0x3ee286=_0x3ee286||0xc8;return function(_0x2f80d4){if(_0x2f80d4){return _0x2b4c8f[_0xc750('0x16')](_0x3ee286)[_0xc750('0x18')](_0x2f80d4);}};}function respondWithFilteredResult(_0x4a9815,_0x5de4e3){return function(_0x119608){if(_0x119608){var _0x4072b2=typeof _0x5de4e3[_0xc750('0x19')]===_0xc750('0x1a')&&typeof _0x5de4e3[_0xc750('0x1b')]===_0xc750('0x1a');var _0x5972cc=_0x119608[_0xc750('0x1c')];var _0x5e6bf2=_0x4072b2?0x0:_0x5de4e3[_0xc750('0x19')];var _0x5cb6e1=_0x4072b2?_0x119608[_0xc750('0x1c')]:_0x5de4e3[_0xc750('0x19')]+_0x5de4e3[_0xc750('0x1b')];var _0x3d2f06;if(_0x5cb6e1>=_0x5972cc){_0x5cb6e1=_0x5972cc;_0x3d2f06=0xc8;}else{_0x3d2f06=0xce;}_0x4a9815[_0xc750('0x16')](_0x3d2f06);return _0x4a9815[_0xc750('0x1d')](_0xc750('0x1e'),_0x5e6bf2+'-'+_0x5cb6e1+'/'+_0x5972cc)['json'](_0x119608);}return null;};}function patchUpdates(_0x3e57dd){return function(_0x3e1f92){try{jsonpatch[_0xc750('0x1f')](_0x3e1f92,_0x3e57dd,!![]);}catch(_0x381698){return BPromise[_0xc750('0x20')](_0x381698);}return _0x3e1f92[_0xc750('0x21')]();};}function saveUpdates(_0x542da2,_0x54e657){return function(_0x56c57f){if(_0x56c57f){return _0x56c57f[_0xc750('0x22')](_0x542da2)['then'](function(_0x5e6b9f){return _0x5e6b9f;});}return null;};}function removeEntity(_0x526c90,_0x5207a5){return function(_0x4e5fda){if(_0x4e5fda){return _0x4e5fda[_0xc750('0x23')]()[_0xc750('0x24')](function(){_0x526c90[_0xc750('0x16')](0xcc)[_0xc750('0x17')]();});}};}function handleEntityNotFound(_0x2d603c,_0x55e852){return function(_0x58a7e0){if(!_0x58a7e0){_0x2d603c[_0xc750('0x15')](0x194);}return _0x58a7e0;};}function handleError(_0x41df55,_0x4ca87){_0x4ca87=_0x4ca87||0x1f4;return function(_0x123509){logger[_0xc750('0x25')](_0x123509['stack']);if(_0x123509[_0xc750('0x26')]){delete _0x123509['name'];}_0x41df55[_0xc750('0x16')](_0x4ca87)['send'](_0x123509);};}exports[_0xc750('0x27')]=function(_0x3ab8b9,_0x163709){var _0x4c90bd={},_0x9015a6={},_0x1198a4={'count':0x0,'rows':[]};var _0x61a36f=_[_0xc750('0x28')](db[_0xc750('0x29')][_0xc750('0x2a')],function(_0x2704a3){return{'name':_0x2704a3[_0xc750('0x2b')],'type':_0x2704a3[_0xc750('0x2c')][_0xc750('0x2d')]};});_0x9015a6['model']=_[_0xc750('0x28')](_0x61a36f,_0xc750('0x26'));_0x9015a6[_0xc750('0x2e')]=_['keys'](_0x3ab8b9[_0xc750('0x2e')]);_0x9015a6['filters']=_['intersection'](_0x9015a6[_0xc750('0x2f')],_0x9015a6[_0xc750('0x2e')]);_0x4c90bd['attributes']=_[_0xc750('0x30')](_0x9015a6[_0xc750('0x2f')],qs['fields'](_0x3ab8b9[_0xc750('0x2e')]['fields']));_0x4c90bd[_0xc750('0x31')]=_0x4c90bd[_0xc750('0x31')][_0xc750('0x32')]?_0x4c90bd['attributes']:_0x9015a6[_0xc750('0x2f')];if(!_0x3ab8b9[_0xc750('0x2e')][_0xc750('0x33')](_0xc750('0x34'))){_0x4c90bd[_0xc750('0x1b')]=qs[_0xc750('0x1b')](_0x3ab8b9[_0xc750('0x2e')][_0xc750('0x1b')]);_0x4c90bd[_0xc750('0x19')]=qs['offset'](_0x3ab8b9['query'][_0xc750('0x19')]);}_0x4c90bd['order']=qs[_0xc750('0x35')](_0x3ab8b9['query'][_0xc750('0x35')]);_0x4c90bd[_0xc750('0x36')]=qs[_0xc750('0x37')](_[_0xc750('0x38')](_0x3ab8b9[_0xc750('0x2e')],_0x9015a6['filters']),_0x61a36f);if(_0x3ab8b9[_0xc750('0x2e')][_0xc750('0x39')]){_0x4c90bd[_0xc750('0x36')]=_[_0xc750('0x3a')](_0x4c90bd[_0xc750('0x36')],{'$or':_['map'](_0x61a36f,function(_0x16d4a9){if(_0x16d4a9[_0xc750('0x2c')]!=='VIRTUAL'){var _0x23f3a4={};_0x23f3a4[_0x16d4a9[_0xc750('0x26')]]={'$like':'%'+_0x3ab8b9[_0xc750('0x2e')][_0xc750('0x39')]+'%'};return _0x23f3a4;}})});}_0x4c90bd=_[_0xc750('0x3a')]({},_0x4c90bd,_0x3ab8b9[_0xc750('0x3b')]);var _0x279212={'where':_0x4c90bd[_0xc750('0x36')]};return db['VoiceTransferReport'][_0xc750('0x1c')](_0x279212)[_0xc750('0x24')](function(_0x148ad6){_0x1198a4[_0xc750('0x1c')]=_0x148ad6;if(_0x3ab8b9[_0xc750('0x2e')][_0xc750('0x3c')]){_0x4c90bd[_0xc750('0x3d')]=[{'all':!![]}];}return db[_0xc750('0x29')]['findAll'](_0x4c90bd);})['then'](function(_0xdbe2e4){_0x1198a4[_0xc750('0x3e')]=_0xdbe2e4;return _0x1198a4;})[_0xc750('0x24')](respondWithFilteredResult(_0x163709,_0x4c90bd))[_0xc750('0x3f')](handleError(_0x163709,null));};exports[_0xc750('0x40')]=function(_0x4f89bf,_0x41d195){var _0x2c9ced={'raw':!![],'where':{'id':_0x4f89bf[_0xc750('0x41')]['id']}},_0x384bce={};_0x384bce[_0xc750('0x2f')]=_['keys'](db[_0xc750('0x29')][_0xc750('0x2a')]);_0x384bce[_0xc750('0x2e')]=_['keys'](_0x4f89bf[_0xc750('0x2e')]);_0x384bce[_0xc750('0x37')]=_['intersection'](_0x384bce['model'],_0x384bce[_0xc750('0x2e')]);_0x2c9ced[_0xc750('0x31')]=_['intersection'](_0x384bce[_0xc750('0x2f')],qs[_0xc750('0x42')](_0x4f89bf[_0xc750('0x2e')][_0xc750('0x42')]));_0x2c9ced[_0xc750('0x31')]=_0x2c9ced[_0xc750('0x31')][_0xc750('0x32')]?_0x2c9ced[_0xc750('0x31')]:_0x384bce['model'];if(_0x4f89bf[_0xc750('0x2e')][_0xc750('0x3c')]){_0x2c9ced[_0xc750('0x3d')]=[{'all':!![]}];}_0x2c9ced=_[_0xc750('0x3a')]({},_0x2c9ced,_0x4f89bf[_0xc750('0x3b')]);return db['VoiceTransferReport'][_0xc750('0x43')](_0x2c9ced)[_0xc750('0x24')](handleEntityNotFound(_0x41d195,null))[_0xc750('0x24')](respondWithResult(_0x41d195,null))[_0xc750('0x3f')](handleError(_0x41d195,null));};exports[_0xc750('0x44')]=function(_0x4ffdee,_0x5b3682){return db[_0xc750('0x29')][_0xc750('0x44')](_0x4ffdee['body'],{})[_0xc750('0x24')](respondWithResult(_0x5b3682,0xc9))[_0xc750('0x3f')](handleError(_0x5b3682,null));};exports[_0xc750('0x22')]=function(_0x2939e9,_0x13b5e8){if(_0x2939e9[_0xc750('0x45')]['id']){delete _0x2939e9['body']['id'];}return db[_0xc750('0x29')]['find']({'where':{'id':_0x2939e9[_0xc750('0x41')]['id']}})[_0xc750('0x24')](handleEntityNotFound(_0x13b5e8,null))['then'](saveUpdates(_0x2939e9[_0xc750('0x45')],null))[_0xc750('0x24')](respondWithResult(_0x13b5e8,null))[_0xc750('0x3f')](handleError(_0x13b5e8,null));};exports[_0xc750('0x23')]=function(_0x4a3161,_0x64d2d0){return db[_0xc750('0x29')][_0xc750('0x43')]({'where':{'id':_0x4a3161['params']['id']}})[_0xc750('0x24')](handleEntityNotFound(_0x64d2d0,null))[_0xc750('0x24')](removeEntity(_0x64d2d0,null))[_0xc750('0x3f')](handleError(_0x64d2d0,null));};exports[_0xc750('0x46')]=function(_0x2f1d13,_0x5335f2){return db[_0xc750('0x29')][_0xc750('0x46')]()['then'](respondWithResult(_0x5335f2,null))[_0xc750('0x3f')](handleError(_0x5335f2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 386cb17..d6c0cb8 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 _0x50e3=['rimraf','../../config/environment','exports','define','VoiceTransferReport','util','../../config/logger','api','bluebird'];(function(_0x40e628,_0x1905b8){var _0x5cf725=function(_0x58691c){while(--_0x58691c){_0x40e628['push'](_0x40e628['shift']());}};_0x5cf725(++_0x1905b8);}(_0x50e3,0x1be));var _0x350e=function(_0x2f8bc1,_0x2bcab0){_0x2f8bc1=_0x2f8bc1-0x0;var _0x3cc057=_0x50e3[_0x2f8bc1];return _0x3cc057;};'use strict';var _=require('lodash');var util=require(_0x350e('0x0'));var logger=require(_0x350e('0x1'))(_0x350e('0x2'));var moment=require('moment');var BPromise=require(_0x350e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x350e('0x4'));var config=require(_0x350e('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x350e('0x6')]=function(_0x3e163d,_0x2d1796){return _0x3e163d[_0x350e('0x7')](_0x350e('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5763=['./voiceTransferReport.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5c21b8,_0x3704c0){var _0x1fbff0=function(_0x283401){while(--_0x283401){_0x5c21b8['push'](_0x5c21b8['shift']());}};_0x1fbff0(++_0x3704c0);}(_0x5763,0xfe));var _0x3576=function(_0x108831,_0x5e4f70){_0x108831=_0x108831-0x0;var _0x4da77a=_0x5763[_0x108831];return _0x4da77a;};'use strict';var _=require(_0x3576('0x0'));var util=require('util');var logger=require(_0x3576('0x1'))(_0x3576('0x2'));var moment=require(_0x3576('0x3'));var BPromise=require(_0x3576('0x4'));var rp=require(_0x3576('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3576('0x6'));var config=require('../../config/environment');var attributes=require(_0x3576('0x7'));module['exports']=function(_0x51a7c4,_0x53e4c0){return _0x51a7c4[_0x3576('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 256c651..78b77f3 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 _0x8760=['create','body','options','raw','then','CreateVoiceTransferReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','VoiceTransferReport'];(function(_0x4e7304,_0x1328ab){var _0x25a4cb=function(_0xdcb6fe){while(--_0xdcb6fe){_0x4e7304['push'](_0x4e7304['shift']());}};_0x25a4cb(++_0x1328ab);}(_0x8760,0x172));var _0x0876=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8760[_0x543084];return _0x306a57;};'use strict';var _=require(_0x0876('0x0'));var util=require('util');var moment=require(_0x0876('0x1'));var BPromise=require(_0x0876('0x2'));var rs=require(_0x0876('0x3'));var fs=require('fs');var Redis=require(_0x0876('0x4'));var db=require(_0x0876('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0876('0x6'));var config=require(_0x0876('0x7'));var jayson=require(_0x0876('0x8'));var client=jayson['client'][_0x0876('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17fbbd,_0x4c1375,_0x35ff85){return new BPromise(function(_0x359b02,_0x1cc7d9){return client[_0x0876('0xa')](_0x17fbbd,_0x35ff85)['then'](function(_0x4f5e48){logger['info'](_0x0876('0xb'),_0x4c1375,'request\x20sent');logger[_0x0876('0xc')](_0x0876('0xd'),_0x4c1375,_0x0876('0xe'),JSON[_0x0876('0xf')](_0x4f5e48));if(_0x4f5e48['error']){if(_0x4f5e48[_0x0876('0x10')][_0x0876('0x11')]===0x1f4){logger[_0x0876('0x10')](_0x0876('0xb'),_0x4c1375,_0x4f5e48[_0x0876('0x10')]['message']);return _0x1cc7d9(_0x4f5e48[_0x0876('0x10')]['message']);}logger[_0x0876('0x10')](_0x0876('0xb'),_0x4c1375,_0x4f5e48[_0x0876('0x10')][_0x0876('0x12')]);return _0x359b02(_0x4f5e48[_0x0876('0x10')][_0x0876('0x12')]);}else{logger[_0x0876('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4c1375,_0x0876('0xe'));_0x359b02(_0x4f5e48['result'][_0x0876('0x12')]);}})[_0x0876('0x14')](function(_0x3491ca){logger['error'](_0x0876('0xb'),_0x4c1375,_0x3491ca);_0x1cc7d9(_0x3491ca);});});}exports['CreateVoiceTransferReport']=function(_0x343fbe){var _0x4a67a6=this;return new Promise(function(_0x3baf92,_0x330602){return db[_0x0876('0x15')][_0x0876('0x16')](_0x343fbe[_0x0876('0x17')],{'raw':_0x343fbe['options']?_0x343fbe[_0x0876('0x18')][_0x0876('0x19')]===undefined?!![]:![]:!![]})[_0x0876('0x1a')](function(_0x5326fc){logger[_0x0876('0x13')]('CreateVoiceTransferReport',_0x343fbe);logger['debug'](_0x0876('0x1b'),_0x343fbe,JSON[_0x0876('0xf')](_0x5326fc));_0x3baf92(_0x5326fc);})[_0x0876('0x14')](function(_0x3251b9){logger['error'](_0x0876('0x1b'),_0x3251b9['message'],_0x343fbe);_0x330602(_0x4a67a6['error'](0x1f4,_0x3251b9[_0x0876('0x12')]));});});}; \ No newline at end of file +var _0x29c3=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceTransferReport','create','body','options','debug','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x329f65,_0x338b62){var _0x10959d=function(_0x5f092c){while(--_0x5f092c){_0x329f65['push'](_0x329f65['shift']());}};_0x10959d(++_0x338b62);}(_0x29c3,0xcb));var _0x329c=function(_0x51af16,_0x2272ac){_0x51af16=_0x51af16-0x0;var _0x4ab25d=_0x29c3[_0x51af16];return _0x4ab25d;};'use strict';var _=require(_0x329c('0x0'));var util=require(_0x329c('0x1'));var moment=require(_0x329c('0x2'));var BPromise=require(_0x329c('0x3'));var rs=require(_0x329c('0x4'));var fs=require('fs');var Redis=require(_0x329c('0x5'));var db=require(_0x329c('0x6'))['db'];var utils=require(_0x329c('0x7'));var logger=require(_0x329c('0x8'))(_0x329c('0x9'));var config=require(_0x329c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x329c('0xb')][_0x329c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d277f,_0x14b6fd,_0x472a6c){return new BPromise(function(_0x25b0ad,_0x4215b4){return client[_0x329c('0xd')](_0x3d277f,_0x472a6c)[_0x329c('0xe')](function(_0x29bb73){logger[_0x329c('0xf')](_0x329c('0x10'),_0x14b6fd,'request\x20sent');logger['debug'](_0x329c('0x11'),_0x14b6fd,_0x329c('0x12'),JSON[_0x329c('0x13')](_0x29bb73));if(_0x29bb73[_0x329c('0x14')]){if(_0x29bb73[_0x329c('0x14')]['code']===0x1f4){logger[_0x329c('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x14b6fd,_0x29bb73[_0x329c('0x14')]['message']);return _0x4215b4(_0x29bb73['error'][_0x329c('0x15')]);}logger[_0x329c('0x14')](_0x329c('0x10'),_0x14b6fd,_0x29bb73[_0x329c('0x14')][_0x329c('0x15')]);return _0x25b0ad(_0x29bb73['error'][_0x329c('0x15')]);}else{logger[_0x329c('0xf')](_0x329c('0x10'),_0x14b6fd,_0x329c('0x12'));_0x25b0ad(_0x29bb73[_0x329c('0x16')][_0x329c('0x15')]);}})[_0x329c('0x17')](function(_0x1aa66e){logger[_0x329c('0x14')](_0x329c('0x10'),_0x14b6fd,_0x1aa66e);_0x4215b4(_0x1aa66e);});});}exports['CreateVoiceTransferReport']=function(_0xc9d78c){var _0x2fb39f=this;return new Promise(function(_0x3ea2dc,_0x5c163b){return db[_0x329c('0x18')][_0x329c('0x19')](_0xc9d78c[_0x329c('0x1a')],{'raw':_0xc9d78c[_0x329c('0x1b')]?_0xc9d78c[_0x329c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x329c('0xe')](function(_0xee8b03){logger[_0x329c('0xf')]('CreateVoiceTransferReport',_0xc9d78c);logger[_0x329c('0x1c')](_0x329c('0x1d'),_0xc9d78c,JSON[_0x329c('0x13')](_0xee8b03));_0x3ea2dc(_0xee8b03);})[_0x329c('0x17')](function(_0x4ed535){logger[_0x329c('0x14')](_0x329c('0x1d'),_0x4ed535[_0x329c('0x15')],_0xc9d78c);_0x5c163b(_0x2fb39f[_0x329c('0x14')](0x1f4,_0x4ed535[_0x329c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 45ba399..a567f17 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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x1395ab,_0x5cb8c7){var _0x37fbb9=function(_0x2734ef){while(--_0x2734ef){_0x1395ab['push'](_0x1395ab['shift']());}};_0x37fbb9(++_0x5cb8c7);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xb4e6[_0x333798];return _0x389f4e;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0xaa88=['/hold','/unhold','/calls','calls','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer'];(function(_0x593acf,_0x2172be){var _0x247d38=function(_0x177d7e){while(--_0x177d7e){_0x593acf['push'](_0x593acf['shift']());}};_0x247d38(++_0x2172be);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xaa88[_0x3e3bee];return _0x3ae14c;};'use strict';var express=require(_0x8aa8('0x0'));var router=express[_0x8aa8('0x1')]();var auth=require(_0x8aa8('0x2'));var controller=require(_0x8aa8('0x3'));router['post'](_0x8aa8('0x4'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x7')]);router[_0x8aa8('0x8')](_0x8aa8('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x8aa8('0xa')]);router['post'](_0x8aa8('0xb'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0xc')]);router['post'](_0x8aa8('0xd'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['hold']);router[_0x8aa8('0x8')](_0x8aa8('0xe'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['unhold']);router[_0x8aa8('0x8')](_0x8aa8('0xf'),auth['isAuthenticated'](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x8')]('/transfer',auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0889352..d849dc9 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 _0x5308=['calls\x20fired:','rows','conference','webbar:conference','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','ioredis','defaults','localhost','socket.io-emitter','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','info','emit','log','handleError:','error','status','name','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls'];(function(_0x522aac,_0x56a132){var _0x597c36=function(_0x5cfd97){while(--_0x5cfd97){_0x522aac['push'](_0x522aac['shift']());}};_0x597c36(++_0x56a132);}(_0x5308,0xd4));var _0x8530=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x5308[_0x1dbaf7];return _0x593f05;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8530('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x8530('0x1'));var util=require(_0x8530('0x2'));var BPromise=require(_0x8530('0x3'));var jayson=require(_0x8530('0x4'));var amiClient=jayson[_0x8530('0x5')][_0x8530('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x8530('0x7'));config['redis']=_[_0x8530('0x8')](config['redis'],{'host':_0x8530('0x9'),'port':0x18eb});var io=require(_0x8530('0xa'))(new Redis(config[_0x8530('0xb')]));var Schema=require(_0x8530('0xc'));var originateValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8530('0xe'),'required':[!![],_0x8530('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],_0x8530('0x10')]},'sessionId':{'type':_0x8530('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],_0x8530('0x10')]},'sessionId':{'type':_0x8530('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x8530('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8530('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],_0x8530('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],_0x8530('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8530('0xd'),'required':[!![],_0x8530('0x10')]}});function emit(_0x38f8bb,_0x4c535c,_0x377c89){logger[_0x8530('0x11')](_0x38f8bb,_0x4c535c,JSON['stringify'](_0x377c89));io['to'](_0x38f8bb)[_0x8530('0x12')](_0x4c535c,_0x377c89);}function handleError(_0x19e76e){return function(_0x44a864){console[_0x8530('0x13')](_0x8530('0x14'),_0x44a864,_0x44a864 instanceof RangeError);logger[_0x8530('0x15')](_0x44a864['stack']);if(_0x44a864 instanceof RangeError){if(_0x44a864['name']){delete _0x44a864['name'];}_0x19e76e[_0x8530('0x16')](0x194)['send'](_0x44a864);}else{if(_0x44a864[_0x8530('0x17')]){delete _0x44a864[_0x8530('0x17')];}_0x19e76e[_0x8530('0x16')](0x1f4)['send'](_0x44a864);}};}function checkError(){return function(_0x92eff2){if(!_0x92eff2){throw new RangeError('NotFound');}return _0x92eff2;};}function respondWithRpcPromise(_0x523e5c,_0x2790a3){return new BPromise(function(_0x1beb67,_0x64d285){var _0x3d50ab=amiClient;return _0x3d50ab['request'](_0x523e5c,_0x2790a3)[_0x8530('0x18')](function(_0x4cf521){if(_0x4cf521[_0x8530('0x15')]){if(_0x4cf521[_0x8530('0x15')][_0x8530('0x19')]===0x1f4){return _0x64d285(_0x4cf521[_0x8530('0x15')][_0x8530('0x1a')]);}return _0x1beb67(_0x4cf521['error']['message']);}else{_0x1beb67(_0x4cf521[_0x8530('0x1b')]);}})[_0x8530('0x1c')](function(_0x49f963){_0x64d285(_0x49f963);});});}function getAgent(_0x501764){return db[_0x8530('0x1d')][_0x8530('0x1e')]({'where':{'id':_0x501764,'role':'agent'}})[_0x8530('0x18')](checkError());}function getAgentCheckSession(_0x32ea12,_0x11d8a4){return new BPromise(function(_0x1d407d,_0x3aecc9){var _0x8c6e0d=respondWithRpcPromise(_0x8530('0x1f'));var _0x500493=getAgent(_0x32ea12);Promise[_0x8530('0x20')]([_0x8c6e0d,_0x500493])['then'](function(_0x34fc6a){var _0x1b342a=_0x34fc6a[0x0];var _0x245bc6=_0x34fc6a[0x1];var _0x2892b2=_[_0x8530('0x21')](_0x1b342a['rows'],function(_0x577c90){return _0x577c90[_0x8530('0x22')]==_0x245bc6['id']&&_0x577c90['sessionId']==_0x11d8a4;});if(_0x2892b2[_0x8530('0x23')]==0x1){_0x1d407d(_0x245bc6);}else{_0x3aecc9(new RangeError('sessionId\x20'+_0x11d8a4+_0x8530('0x24')));}});});}exports[_0x8530('0x25')]=function(_0x2e2b2a,_0x495acb){logger[_0x8530('0x11')](_0x8530('0x26'),_0x2e2b2a['body']);var _0x4cd085=originateValidation['validate'](_0x2e2b2a[_0x8530('0x27')]);if(_0x4cd085[_0x8530('0x23')]>0x0){return _0x495acb[_0x8530('0x16')](0x190)[_0x8530('0x28')](_0x4cd085);}var _0x1608f5=_0x2e2b2a[_0x8530('0x27')][_0x8530('0x29')];var _0xa3a77e=_0x2e2b2a[_0x8530('0x27')][_0x8530('0x2a')];var _0x3a9fa8=_0x2e2b2a[_0x8530('0x27')]['callerId'];var _0x445e44=_0x2e2b2a[_0x8530('0x27')]['callbackUrl'];return getAgent(_0x1608f5)[_0x8530('0x18')](function(_0x7a877c){logger[_0x8530('0x11')]('entityFound:',_0x7a877c['name']);emit(util[_0x8530('0x2b')]('user:%s',_0x7a877c['name']),_0x8530('0x2c'),{'callNumber':_0xa3a77e,'callerId':_0x3a9fa8,'callbackUrl':_0x445e44});return _0x495acb[_0x8530('0x16')](0xc8)[_0x8530('0x28')]({'error':![],'message':_0x8530('0x2d')});})[_0x8530('0x1c')](handleError(_0x495acb));};exports[_0x8530('0x2e')]=function(_0x3947fb,_0x191f6d){logger[_0x8530('0x11')](_0x8530('0x2f'),_0x3947fb['body']);var _0xc98c35=hangupValidation['validate'](_0x3947fb[_0x8530('0x27')]);if(_0xc98c35[_0x8530('0x23')]>0x0){return _0x191f6d[_0x8530('0x16')](0x190)[_0x8530('0x28')](_0xc98c35);}var _0x4d1a5c=_0x3947fb[_0x8530('0x27')][_0x8530('0x29')];var _0x59e73d=_0x3947fb[_0x8530('0x27')][_0x8530('0x30')];return getAgent(_0x4d1a5c)[_0x8530('0x18')](function(_0x901bd1){logger[_0x8530('0x11')](_0x8530('0x31'),_0x901bd1[_0x8530('0x17')]);emit(util[_0x8530('0x2b')](_0x8530('0x32'),_0x901bd1[_0x8530('0x17')]),'webbar:hangup',{'sessionId':_0x59e73d});return _0x191f6d[_0x8530('0x16')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x191f6d));};exports['answer']=function(_0x3e9833,_0x1d4132){logger['info']('answer\x20fired:',_0x3e9833[_0x8530('0x27')]);var _0x48011d=answerValidation[_0x8530('0xc')](_0x3e9833[_0x8530('0x27')]);if(_0x48011d[_0x8530('0x23')]>0x0){return _0x1d4132[_0x8530('0x16')](0x190)[_0x8530('0x28')](_0x48011d);}var _0x4c651e=_0x3e9833[_0x8530('0x27')][_0x8530('0x29')];var _0x4e0f0d=_0x3e9833[_0x8530('0x27')]['sessionId'];return getAgent(_0x4c651e)['then'](function(_0x5d40e5){logger['info'](_0x8530('0x31'),_0x5d40e5['name']);emit(util['format'](_0x8530('0x32'),_0x5d40e5['name']),_0x8530('0x33'),{'sessionId':_0x4e0f0d});return _0x1d4132[_0x8530('0x16')](0xc8)[_0x8530('0x28')]({'error':![],'message':_0x8530('0x34')});})['catch'](handleError(_0x1d4132));};exports[_0x8530('0x35')]=function(_0x32d9a9,_0x33e404){logger['info'](_0x8530('0x36'),_0x32d9a9[_0x8530('0x27')]);var _0x14b0d0=holdValidation['validate'](_0x32d9a9[_0x8530('0x27')]);if(_0x14b0d0[_0x8530('0x23')]>0x0){return _0x33e404['status'](0x190)[_0x8530('0x28')](_0x14b0d0);}var _0x274c16=_0x32d9a9[_0x8530('0x27')][_0x8530('0x29')];var _0x8f9c15=_0x32d9a9['body'][_0x8530('0x30')];return getAgent(_0x274c16)[_0x8530('0x18')](function(_0x5f3866){logger[_0x8530('0x11')]('entityFound:',_0x5f3866[_0x8530('0x17')]);emit(util[_0x8530('0x2b')](_0x8530('0x32'),_0x5f3866['name']),'webbar:hold',{'sessionId':_0x8f9c15});return _0x33e404[_0x8530('0x16')](0xc8)[_0x8530('0x28')]({'error':![],'message':'hold\x20executed!'});})[_0x8530('0x1c')](handleError(_0x33e404));};exports[_0x8530('0x37')]=function(_0x288941,_0x5a4d36){logger[_0x8530('0x11')](_0x8530('0x38'),_0x288941['body']);var _0x2cc127=unholdValidation[_0x8530('0xc')](_0x288941['body']);if(_0x2cc127[_0x8530('0x23')]>0x0){return _0x5a4d36['status'](0x190)[_0x8530('0x28')](_0x2cc127);}var _0x84ddca=_0x288941[_0x8530('0x27')][_0x8530('0x29')];var _0x245bb9=_0x288941[_0x8530('0x27')][_0x8530('0x30')];return getAgent(_0x84ddca)[_0x8530('0x18')](function(_0x53c42e){logger[_0x8530('0x11')]('entityFound:',_0x53c42e[_0x8530('0x17')]);emit(util[_0x8530('0x2b')](_0x8530('0x32'),_0x53c42e[_0x8530('0x17')]),_0x8530('0x39'),{'sessionId':_0x245bb9});return _0x5a4d36[_0x8530('0x16')](0xc8)[_0x8530('0x28')]({'error':![],'message':_0x8530('0x3a')});})[_0x8530('0x1c')](handleError(_0x5a4d36));};exports[_0x8530('0x3b')]=function(_0x58e099,_0x1ee066){logger[_0x8530('0x11')](_0x8530('0x3c'),_0x1ee066[_0x8530('0x27')]);var _0x11d35f=callsValidation['validate'](_0x58e099[_0x8530('0x27')]);if(_0x11d35f[_0x8530('0x23')]>0x0){return _0x1ee066[_0x8530('0x16')](0x190)[_0x8530('0x28')](_0x11d35f);}var _0x1c597a=_0x58e099['body'][_0x8530('0x29')];var _0x4f1de3=respondWithRpcPromise(_0x8530('0x1f'));var _0x103c37=getAgent(_0x1c597a);return Promise[_0x8530('0x20')]([_0x4f1de3,_0x103c37])[_0x8530('0x18')](function(_0x3af6e3){var _0x11afc6=_0x3af6e3[0x0];var _0x5766dd=_0x3af6e3[0x1];var _0x427b6d=_['filter'](_0x11afc6[_0x8530('0x3d')],function(_0x3f050f){return _0x3f050f[_0x8530('0x22')]==_0x5766dd['id'];});return _0x1ee066[_0x8530('0x16')](0xc8)['json']({'count':_0x427b6d[_0x8530('0x23')],'rows':_0x427b6d});})[_0x8530('0x1c')](handleError(_0x1ee066));};exports[_0x8530('0x3e')]=function(_0x5cc5aa,_0x25597c){logger['info']('conference\x20fired:',_0x5cc5aa['body']);var _0x47c0f4=conferenceValidation[_0x8530('0xc')](_0x5cc5aa[_0x8530('0x27')]);if(_0x47c0f4[_0x8530('0x23')]>0x0){return _0x25597c[_0x8530('0x16')](0x190)[_0x8530('0x28')](_0x47c0f4);}var _0x389848=_0x5cc5aa[_0x8530('0x27')][_0x8530('0x29')];return getAgent(_0x389848)['then'](function(_0x2a853d){logger['info'](_0x8530('0x31'),_0x2a853d[_0x8530('0x17')]);emit(util[_0x8530('0x2b')](_0x8530('0x32'),_0x2a853d[_0x8530('0x17')]),_0x8530('0x3f'));return _0x25597c['status'](0xc8)[_0x8530('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x25597c));};exports[_0x8530('0x40')]=function(_0x2e0967,_0x56fecb){logger['info'](_0x8530('0x41'),_0x2e0967[_0x8530('0x27')]);var _0x5d083f=transferValidation[_0x8530('0xc')](_0x2e0967[_0x8530('0x27')]);if(_0x5d083f[_0x8530('0x23')]>0x0){return _0x56fecb[_0x8530('0x16')](0x190)[_0x8530('0x28')](_0x5d083f);}var _0x53caa4=_0x2e0967[_0x8530('0x27')][_0x8530('0x29')];var _0x455de5=_0x2e0967[_0x8530('0x27')][_0x8530('0x30')];var _0x21d6b6=_0x2e0967[_0x8530('0x27')]['transferNumber'];return getAgent(_0x53caa4)['then'](function(_0x936ea6){logger[_0x8530('0x11')]('entityFound:',_0x936ea6[_0x8530('0x17')]);emit(util[_0x8530('0x2b')](_0x8530('0x32'),_0x936ea6[_0x8530('0x17')]),_0x8530('0x42'),{'sessionId':_0x455de5,'transferNumber':_0x21d6b6});return _0x56fecb['status'](0xc8)[_0x8530('0x28')]({'error':![],'message':_0x8530('0x43')});})[_0x8530('0x1c')](handleError(_0x56fecb));}; \ No newline at end of file +var _0xab8f=['lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','callNumber\x20is\x20required','string','number','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','error','stack','status','name','request','then','code','message','result','catch','User','agent','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','body','length','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path'];(function(_0x9aa273,_0x1c84bb){var _0x1d5145=function(_0x3f4a3f){while(--_0x3f4a3f){_0x9aa273['push'](_0x9aa273['shift']());}};_0x1d5145(++_0x1c84bb);}(_0xab8f,0x12b));var _0xfab8=function(_0x1ee068,_0x123a93){_0x1ee068=_0x1ee068-0x0;var _0x2091d6=_0xab8f[_0x1ee068];return _0x2091d6;};'use strict';var path=require(_0xfab8('0x0'));var fs=require('fs');var _=require(_0xfab8('0x1'));var db=require(_0xfab8('0x2'))['db'];var config=require(_0xfab8('0x3'));var util=require(_0xfab8('0x4'));var BPromise=require(_0xfab8('0x5'));var jayson=require(_0xfab8('0x6'));var amiClient=jayson[_0xfab8('0x7')][_0xfab8('0x8')]({'port':0x232a});var logger=require(_0xfab8('0x9'))(_0xfab8('0xa'));var Redis=require('ioredis');config[_0xfab8('0xb')]=_[_0xfab8('0xc')](config[_0xfab8('0xb')],{'host':_0xfab8('0xd'),'port':0x18eb});var io=require(_0xfab8('0xe'))(new Redis(config[_0xfab8('0xb')]));var Schema=require(_0xfab8('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xfab8('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xfab8('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfab8('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],_0xfab8('0x13')]},'sessionId':{'type':_0xfab8('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfab8('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xfab8('0x11'),'required':[!![],_0xfab8('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfab8('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],_0xfab8('0x13')]},'sessionId':{'type':_0xfab8('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],_0xfab8('0x13')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfab8('0x12'),'required':[!![],_0xfab8('0x13')]}});function emit(_0x24d6f8,_0x337250,_0x2f87d4){logger[_0xfab8('0x15')](_0x24d6f8,_0x337250,JSON['stringify'](_0x2f87d4));io['to'](_0x24d6f8)[_0xfab8('0x16')](_0x337250,_0x2f87d4);}function handleError(_0x2e98e3){return function(_0x51ea98){console[_0xfab8('0x17')]('handleError:',_0x51ea98,_0x51ea98 instanceof RangeError);logger[_0xfab8('0x18')](_0x51ea98[_0xfab8('0x19')]);if(_0x51ea98 instanceof RangeError){if(_0x51ea98['name']){delete _0x51ea98['name'];}_0x2e98e3[_0xfab8('0x1a')](0x194)['send'](_0x51ea98);}else{if(_0x51ea98[_0xfab8('0x1b')]){delete _0x51ea98[_0xfab8('0x1b')];}_0x2e98e3[_0xfab8('0x1a')](0x1f4)['send'](_0x51ea98);}};}function checkError(){return function(_0x502d0f){if(!_0x502d0f){throw new RangeError('NotFound');}return _0x502d0f;};}function respondWithRpcPromise(_0x50c2c6,_0x4f9bab){return new BPromise(function(_0x52bf74,_0x4792f4){var _0x1a28b8=amiClient;return _0x1a28b8[_0xfab8('0x1c')](_0x50c2c6,_0x4f9bab)[_0xfab8('0x1d')](function(_0x279b51){if(_0x279b51['error']){if(_0x279b51[_0xfab8('0x18')][_0xfab8('0x1e')]===0x1f4){return _0x4792f4(_0x279b51['error'][_0xfab8('0x1f')]);}return _0x52bf74(_0x279b51['error']['message']);}else{_0x52bf74(_0x279b51[_0xfab8('0x20')]);}})[_0xfab8('0x21')](function(_0x37e927){_0x4792f4(_0x37e927);});});}function getAgent(_0x3b41d0){return db[_0xfab8('0x22')]['findOne']({'where':{'id':_0x3b41d0,'role':_0xfab8('0x23')}})[_0xfab8('0x1d')](checkError());}function getAgentCheckSession(_0x5018ac,_0x3f2aaa){return new BPromise(function(_0x363eb0,_0x38d5b5){var _0x670180=respondWithRpcPromise('VoiceChannels');var _0x12e882=getAgent(_0x5018ac);Promise[_0xfab8('0x24')]([_0x670180,_0x12e882])['then'](function(_0x5cb3c3){var _0x421429=_0x5cb3c3[0x0];var _0xdfd783=_0x5cb3c3[0x1];var _0x2d459c=_[_0xfab8('0x25')](_0x421429[_0xfab8('0x26')],function(_0x1a884c){return _0x1a884c[_0xfab8('0x27')]==_0xdfd783['id']&&_0x1a884c[_0xfab8('0x28')]==_0x3f2aaa;});if(_0x2d459c['length']==0x1){_0x363eb0(_0xdfd783);}else{_0x38d5b5(new RangeError('sessionId\x20'+_0x3f2aaa+_0xfab8('0x29')));}});});}exports[_0xfab8('0x2a')]=function(_0x169fed,_0x247a70){logger['info']('originate\x20fired:',_0x169fed[_0xfab8('0x2b')]);var _0x3f24d5=originateValidation[_0xfab8('0xf')](_0x169fed[_0xfab8('0x2b')]);if(_0x3f24d5[_0xfab8('0x2c')]>0x0){return _0x247a70[_0xfab8('0x1a')](0x190)[_0xfab8('0x2d')](_0x3f24d5);}var _0x3efc32=_0x169fed['body'][_0xfab8('0x2e')];var _0x385f32=_0x169fed['body'][_0xfab8('0x2f')];var _0xc59717=_0x169fed[_0xfab8('0x2b')][_0xfab8('0x30')];var _0x3e93bf=_0x169fed[_0xfab8('0x2b')]['callbackUrl'];return getAgent(_0x3efc32)['then'](function(_0x2be558){logger['info'](_0xfab8('0x31'),_0x2be558[_0xfab8('0x1b')]);emit(util['format'](_0xfab8('0x32'),_0x2be558[_0xfab8('0x1b')]),_0xfab8('0x33'),{'callNumber':_0x385f32,'callerId':_0xc59717,'callbackUrl':_0x3e93bf});return _0x247a70['status'](0xc8)[_0xfab8('0x2d')]({'error':![],'message':_0xfab8('0x34')});})['catch'](handleError(_0x247a70));};exports['hangup']=function(_0x159f7d,_0x86354){logger[_0xfab8('0x15')]('hangup\x20fired:',_0x159f7d['body']);var _0x2921a3=hangupValidation[_0xfab8('0xf')](_0x159f7d[_0xfab8('0x2b')]);if(_0x2921a3[_0xfab8('0x2c')]>0x0){return _0x86354[_0xfab8('0x1a')](0x190)[_0xfab8('0x2d')](_0x2921a3);}var _0x3f7d53=_0x159f7d['body'][_0xfab8('0x2e')];var _0x3c2f1c=_0x159f7d[_0xfab8('0x2b')][_0xfab8('0x28')];return getAgent(_0x3f7d53)['then'](function(_0x54fc83){logger['info']('entityFound:',_0x54fc83[_0xfab8('0x1b')]);emit(util['format']('user:%s',_0x54fc83[_0xfab8('0x1b')]),_0xfab8('0x35'),{'sessionId':_0x3c2f1c});return _0x86354[_0xfab8('0x1a')](0xc8)[_0xfab8('0x2d')]({'error':![],'message':_0xfab8('0x36')});})[_0xfab8('0x21')](handleError(_0x86354));};exports['answer']=function(_0x29a4c9,_0x4105b1){logger[_0xfab8('0x15')](_0xfab8('0x37'),_0x29a4c9[_0xfab8('0x2b')]);var _0x4a1d1c=answerValidation[_0xfab8('0xf')](_0x29a4c9['body']);if(_0x4a1d1c[_0xfab8('0x2c')]>0x0){return _0x4105b1[_0xfab8('0x1a')](0x190)[_0xfab8('0x2d')](_0x4a1d1c);}var _0x5b2317=_0x29a4c9['body'][_0xfab8('0x2e')];var _0x2d4101=_0x29a4c9[_0xfab8('0x2b')][_0xfab8('0x28')];return getAgent(_0x5b2317)[_0xfab8('0x1d')](function(_0x8dba92){logger[_0xfab8('0x15')]('entityFound:',_0x8dba92[_0xfab8('0x1b')]);emit(util[_0xfab8('0x38')]('user:%s',_0x8dba92[_0xfab8('0x1b')]),'webbar:answer',{'sessionId':_0x2d4101});return _0x4105b1[_0xfab8('0x1a')](0xc8)['json']({'error':![],'message':_0xfab8('0x39')});})[_0xfab8('0x21')](handleError(_0x4105b1));};exports['hold']=function(_0x3b7696,_0x351fd5){logger[_0xfab8('0x15')](_0xfab8('0x3a'),_0x3b7696[_0xfab8('0x2b')]);var _0x33cfe8=holdValidation['validate'](_0x3b7696[_0xfab8('0x2b')]);if(_0x33cfe8[_0xfab8('0x2c')]>0x0){return _0x351fd5[_0xfab8('0x1a')](0x190)[_0xfab8('0x2d')](_0x33cfe8);}var _0x184d36=_0x3b7696['body'][_0xfab8('0x2e')];var _0x45b077=_0x3b7696['body']['sessionId'];return getAgent(_0x184d36)[_0xfab8('0x1d')](function(_0x43f201){logger[_0xfab8('0x15')]('entityFound:',_0x43f201[_0xfab8('0x1b')]);emit(util[_0xfab8('0x38')]('user:%s',_0x43f201[_0xfab8('0x1b')]),_0xfab8('0x3b'),{'sessionId':_0x45b077});return _0x351fd5[_0xfab8('0x1a')](0xc8)['json']({'error':![],'message':_0xfab8('0x3c')});})['catch'](handleError(_0x351fd5));};exports[_0xfab8('0x3d')]=function(_0x321266,_0x70109a){logger['info'](_0xfab8('0x3e'),_0x321266[_0xfab8('0x2b')]);var _0x53d204=unholdValidation['validate'](_0x321266[_0xfab8('0x2b')]);if(_0x53d204['length']>0x0){return _0x70109a[_0xfab8('0x1a')](0x190)['json'](_0x53d204);}var _0x316cee=_0x321266[_0xfab8('0x2b')][_0xfab8('0x2e')];var _0x789c72=_0x321266[_0xfab8('0x2b')][_0xfab8('0x28')];return getAgent(_0x316cee)[_0xfab8('0x1d')](function(_0x40563b){logger[_0xfab8('0x15')]('entityFound:',_0x40563b[_0xfab8('0x1b')]);emit(util[_0xfab8('0x38')]('user:%s',_0x40563b['name']),_0xfab8('0x3f'),{'sessionId':_0x789c72});return _0x70109a[_0xfab8('0x1a')](0xc8)[_0xfab8('0x2d')]({'error':![],'message':_0xfab8('0x40')});})[_0xfab8('0x21')](handleError(_0x70109a));};exports['calls']=function(_0x1e209b,_0x29fd2f){logger[_0xfab8('0x15')](_0xfab8('0x41'),_0x29fd2f[_0xfab8('0x2b')]);var _0x6c34e4=callsValidation[_0xfab8('0xf')](_0x1e209b[_0xfab8('0x2b')]);if(_0x6c34e4[_0xfab8('0x2c')]>0x0){return _0x29fd2f[_0xfab8('0x1a')](0x190)[_0xfab8('0x2d')](_0x6c34e4);}var _0x4ddb2e=_0x1e209b[_0xfab8('0x2b')][_0xfab8('0x2e')];var _0x56a126=respondWithRpcPromise(_0xfab8('0x42'));var _0x3c1ef8=getAgent(_0x4ddb2e);return Promise['all']([_0x56a126,_0x3c1ef8])[_0xfab8('0x1d')](function(_0x5721ed){var _0xbd28a8=_0x5721ed[0x0];var _0x1302ba=_0x5721ed[0x1];var _0x21bb6e=_[_0xfab8('0x25')](_0xbd28a8[_0xfab8('0x26')],function(_0x5229d0){return _0x5229d0['UserId']==_0x1302ba['id'];});return _0x29fd2f[_0xfab8('0x1a')](0xc8)[_0xfab8('0x2d')]({'count':_0x21bb6e[_0xfab8('0x2c')],'rows':_0x21bb6e});})['catch'](handleError(_0x29fd2f));};exports[_0xfab8('0x43')]=function(_0x2cddc7,_0x327c86){logger[_0xfab8('0x15')]('conference\x20fired:',_0x2cddc7[_0xfab8('0x2b')]);var _0x448f43=conferenceValidation[_0xfab8('0xf')](_0x2cddc7[_0xfab8('0x2b')]);if(_0x448f43[_0xfab8('0x2c')]>0x0){return _0x327c86[_0xfab8('0x1a')](0x190)['json'](_0x448f43);}var _0x174617=_0x2cddc7[_0xfab8('0x2b')]['userId'];return getAgent(_0x174617)[_0xfab8('0x1d')](function(_0x33355d){logger[_0xfab8('0x15')](_0xfab8('0x31'),_0x33355d[_0xfab8('0x1b')]);emit(util[_0xfab8('0x38')](_0xfab8('0x32'),_0x33355d[_0xfab8('0x1b')]),_0xfab8('0x44'));return _0x327c86[_0xfab8('0x1a')](0xc8)[_0xfab8('0x2d')]({'error':![],'message':_0xfab8('0x45')});})[_0xfab8('0x21')](handleError(_0x327c86));};exports[_0xfab8('0x46')]=function(_0x48ccc2,_0x57fac0){logger[_0xfab8('0x15')](_0xfab8('0x47'),_0x48ccc2[_0xfab8('0x2b')]);var _0xc7b932=transferValidation[_0xfab8('0xf')](_0x48ccc2[_0xfab8('0x2b')]);if(_0xc7b932['length']>0x0){return _0x57fac0[_0xfab8('0x1a')](0x190)[_0xfab8('0x2d')](_0xc7b932);}var _0x16b232=_0x48ccc2[_0xfab8('0x2b')][_0xfab8('0x2e')];var _0x1c6392=_0x48ccc2[_0xfab8('0x2b')]['sessionId'];var _0x46b3fc=_0x48ccc2[_0xfab8('0x2b')][_0xfab8('0x48')];return getAgent(_0x16b232)[_0xfab8('0x1d')](function(_0x135cb8){logger[_0xfab8('0x15')](_0xfab8('0x31'),_0x135cb8[_0xfab8('0x1b')]);emit(util[_0xfab8('0x38')]('user:%s',_0x135cb8[_0xfab8('0x1b')]),_0xfab8('0x49'),{'sessionId':_0x1c6392,'transferNumber':_0x46b3fc});return _0x57fac0['status'](0xc8)[_0xfab8('0x2d')]({'error':![],'message':_0xfab8('0x4a')});})[_0xfab8('0x21')](handleError(_0x57fac0));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7472bda..1da7b7a 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 _0xb7b4=['Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x2d7125,_0x595e62){var _0x14ce33=function(_0x113ca0){while(--_0x113ca0){_0x2d7125['push'](_0x2d7125['shift']());}};_0x14ce33(++_0x595e62);}(_0xb7b4,0x182));var _0x4b7b=function(_0x5226ed,_0x2b7ad3){_0x5226ed=_0x5226ed-0x0;var _0x383da6=_0xb7b4[_0x5226ed];return _0x383da6;};'use strict';var multer=require(_0x4b7b('0x0'));var util=require(_0x4b7b('0x1'));var path=require('path');var timeout=require(_0x4b7b('0x2'));var express=require(_0x4b7b('0x3'));var router=express[_0x4b7b('0x4')]();var fs_extra=require(_0x4b7b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b7b('0x6'));var controller=require(_0x4b7b('0x7'));router[_0x4b7b('0x8')]('/',auth[_0x4b7b('0x9')](),controller[_0x4b7b('0xa')]);router[_0x4b7b('0x8')](_0x4b7b('0xb'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0xc')]);router[_0x4b7b('0x8')](_0x4b7b('0xd'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0xe')]);router[_0x4b7b('0x8')](_0x4b7b('0xf'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x10')]);router[_0x4b7b('0x8')](_0x4b7b('0x11'),auth['isAuthenticated'](),controller[_0x4b7b('0x12')]);router[_0x4b7b('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4b7b('0x13')]);router['get'](_0x4b7b('0x14'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x15')]);router[_0x4b7b('0x16')]('/',auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x17')]);router[_0x4b7b('0x16')]('/:id/dispositions',auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x18')]);router[_0x4b7b('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4b7b('0x19')]);router[_0x4b7b('0x16')](_0x4b7b('0x1a'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x1b')]);router[_0x4b7b('0x16')]('/:id/applications',auth[_0x4b7b('0x9')](),controller['addApplications']);router['post'](_0x4b7b('0x1c'),controller[_0x4b7b('0x1d')]);router['post'](_0x4b7b('0x1e'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x1f')]);router[_0x4b7b('0x20')](_0x4b7b('0xd'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x21')]);router[_0x4b7b('0x22')](_0x4b7b('0xd'),auth[_0x4b7b('0x9')](),controller[_0x4b7b('0x23')]);router[_0x4b7b('0x22')](_0x4b7b('0xf'),auth['isAuthenticated'](),controller[_0x4b7b('0x24')]);router[_0x4b7b('0x22')](_0x4b7b('0x11'),auth[_0x4b7b('0x9')](),controller['removeAnswers']);router['delete'](_0x4b7b('0x1a'),auth['isAuthenticated'](),controller[_0x4b7b('0x25')]);module[_0x4b7b('0x26')]=router; \ No newline at end of file +var _0x613e=['util','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','destroy','/:id/canned_answers','removeAnswers','exports','multer'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x613e,0x131));var _0xe613=function(_0x32ff94,_0x4c03f4){_0x32ff94=_0x32ff94-0x0;var _0x439bc8=_0x613e[_0x32ff94];return _0x439bc8;};'use strict';var multer=require(_0xe613('0x0'));var util=require(_0xe613('0x1'));var path=require(_0xe613('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe613('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe613('0x4'));var config=require(_0xe613('0x5'));var controller=require('./whatsappAccount.controller');router[_0xe613('0x6')]('/',auth[_0xe613('0x7')](),controller[_0xe613('0x8')]);router[_0xe613('0x6')](_0xe613('0x9'),auth['isAuthenticated'](),controller[_0xe613('0xa')]);router[_0xe613('0x6')](_0xe613('0xb'),auth[_0xe613('0x7')](),controller[_0xe613('0xc')]);router[_0xe613('0x6')](_0xe613('0xd'),auth[_0xe613('0x7')](),controller['getDispositions']);router[_0xe613('0x6')]('/:id/canned_answers',auth[_0xe613('0x7')](),controller['getAnswers']);router[_0xe613('0x6')](_0xe613('0xe'),auth[_0xe613('0x7')](),controller[_0xe613('0xf')]);router[_0xe613('0x6')](_0xe613('0x10'),auth[_0xe613('0x7')](),controller[_0xe613('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe613('0x12')]);router[_0xe613('0x13')](_0xe613('0xd'),auth[_0xe613('0x7')](),controller[_0xe613('0x14')]);router['post']('/:id/canned_answers',auth[_0xe613('0x7')](),controller[_0xe613('0x15')]);router[_0xe613('0x13')]('/:id/users',auth[_0xe613('0x7')](),controller[_0xe613('0x16')]);router[_0xe613('0x13')](_0xe613('0x10'),auth[_0xe613('0x7')](),controller[_0xe613('0x17')]);router[_0xe613('0x13')](_0xe613('0x18'),controller[_0xe613('0x19')]);router['post']('/:id/send',auth[_0xe613('0x7')](),controller[_0xe613('0x1a')]);router[_0xe613('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xe613('0x1c')]);router[_0xe613('0x1d')](_0xe613('0xb'),auth[_0xe613('0x7')](),controller[_0xe613('0x1e')]);router['delete']('/:id/dispositions',auth[_0xe613('0x7')](),controller['removeDispositions']);router['delete'](_0xe613('0x1f'),auth[_0xe613('0x7')](),controller[_0xe613('0x20')]);router[_0xe613('0x1d')](_0xe613('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xe613('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index aa8545e..c08354e 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 _0x0f7d=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT'];(function(_0x47ea2a,_0x44acee){var _0x1e3f06=function(_0x40423a){while(--_0x40423a){_0x47ea2a['push'](_0x47ea2a['shift']());}};_0x1e3f06(++_0x44acee);}(_0x0f7d,0x1e6));var _0xd0f7=function(_0x57112d,_0x9ea573){_0x57112d=_0x57112d-0x0;var _0x3c32b9=_0x0f7d[_0x57112d];return _0x3c32b9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd0f7('0x0'));module[_0xd0f7('0x1')]={'name':{'type':Sequelize[_0xd0f7('0x2')],'unique':_0xd0f7('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd0f7('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd0f7('0x2')],'defaultValue':function(){return rs[_0xd0f7('0x4')]();}},'phone':{'type':Sequelize[_0xd0f7('0x2')]},'type':{'type':Sequelize[_0xd0f7('0x5')](_0xd0f7('0x6'),_0xd0f7('0x7'))},'accountSid':{'type':Sequelize[_0xd0f7('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xd0f7('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd0f7('0x8')],'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[_0xd0f7('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd0f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd0f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd0f7('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd0f7('0xa')],'comment':_0xd0f7('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4cfeec){if(!_0x4cfeec){this['setDataValue'](_0xd0f7('0xc'),null);}this[_0xd0f7('0xd')](_0xd0f7('0xe'),_0x4cfeec);}},'description':{'type':Sequelize[_0xd0f7('0x2')]}}; \ No newline at end of file +var _0xea0a=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue'];(function(_0x488e7c,_0x5e9931){var _0x4617f9=function(_0x4bdab8){while(--_0x4bdab8){_0x488e7c['push'](_0x488e7c['shift']());}};_0x4617f9(++_0x5e9931);}(_0xea0a,0x10f));var _0xaea0=function(_0x2a121b,_0x153a6f){_0x2a121b=_0x2a121b-0x0;var _0x11cc77=_0xea0a[_0x2a121b];return _0x11cc77;};'use strict';var Sequelize=require(_0xaea0('0x0'));var rs=require(_0xaea0('0x1'));module[_0xaea0('0x2')]={'name':{'type':Sequelize[_0xaea0('0x3')],'unique':_0xaea0('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xaea0('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xaea0('0x3')],'defaultValue':function(){return rs[_0xaea0('0x5')]();}},'phone':{'type':Sequelize[_0xaea0('0x3')]},'type':{'type':Sequelize[_0xaea0('0x6')](_0xaea0('0x7'),_0xaea0('0x8'))},'accountSid':{'type':Sequelize[_0xaea0('0x3')]},'baseUrl':{'type':Sequelize[_0xaea0('0x3')]},'authToken':{'type':Sequelize[_0xaea0('0x3')]},'notificationTemplate':{'type':Sequelize[_0xaea0('0x9')],'defaultValue':function(){return _0xaea0('0xa');}},'notificationSound':{'type':Sequelize[_0xaea0('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xaea0('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xaea0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaea0('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaea0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaea0('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaea0('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xaea0('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5abd67){if(!_0x5abd67){this[_0xaea0('0xd')]('mandatoryDispositionPauseId',null);}this[_0xaea0('0xd')](_0xaea0('0xe'),_0x5abd67);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6c3c399..a1ffee6 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 _0x9e38=['defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','filter','options','findAll','rows','show','length','includeAll','include','find','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','asc','CmContact','Sequelize','createdAt','updatedAt','difference','mobile','twilio','from','replace','whatsapp:','Body','messageId','notifications','ValidationError','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','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','*,*,*,*','Start','startRouting','receiveMessage','info','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x22c05f,_0x215a88){var _0x53637a=function(_0x2b7db5){while(--_0x2b7db5){_0x22c05f['push'](_0x22c05f['shift']());}};_0x53637a(++_0x215a88);}(_0x9e38,0x171));var _0x89e3=function(_0x57f100,_0xa53aca){_0x57f100=_0x57f100-0x0;var _0x4cac01=_0x9e38[_0x57f100];return _0x4cac01;};'use strict';var emlformat=require(_0x89e3('0x0'));var rimraf=require(_0x89e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89e3('0x2'));var rp=require(_0x89e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x89e3('0x4'));var util=require(_0x89e3('0x5'));var path=require(_0x89e3('0x6'));var sox=require(_0x89e3('0x7'));var csv=require(_0x89e3('0x8'));var ejs=require(_0x89e3('0x9'));var fs=require('fs');var fs_extra=require(_0x89e3('0xa'));var _=require(_0x89e3('0xb'));var squel=require(_0x89e3('0xc'));var crypto=require(_0x89e3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x89e3('0xe'));var toCsv=require(_0x89e3('0x8'));var querystring=require(_0x89e3('0xf'));var Papa=require(_0x89e3('0x10'));var Redis=require(_0x89e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x89e3('0x12'));var as=require(_0x89e3('0x13'));var hardwareService=require(_0x89e3('0x14'));var logger=require(_0x89e3('0x15'))(_0x89e3('0x16'));var utils=require('../../config/utils');var config=require(_0x89e3('0x17'));var licenseUtil=require(_0x89e3('0x18'));var db=require(_0x89e3('0x19'))['db'];config[_0x89e3('0x1a')]=_[_0x89e3('0x1b')](config[_0x89e3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x89e3('0x1c'))(new Redis(config[_0x89e3('0x1a')]));require(_0x89e3('0x1d'))[_0x89e3('0x1e')](socket);var jayson=require(_0x89e3('0x1f'));var client=jayson['client'][_0x89e3('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x8b768a,_0x4ab641,_0x47a728,_0xeedc96){return new BPromise(function(_0xd925a0,_0x342250){var _0x1dcdeb=_0xeedc96||client;return _0x1dcdeb['request'](_0x8b768a,_0x47a728)[_0x89e3('0x21')](function(_0x5302c2){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4ab641,_0x89e3('0x22'));logger['debug'](_0x89e3('0x23'),_0x4ab641,_0x89e3('0x22'),JSON['stringify'](_0x5302c2));if(_0x5302c2[_0x89e3('0x24')]){if(_0x5302c2[_0x89e3('0x24')][_0x89e3('0x25')]===0x1f4){logger['error'](_0x89e3('0x26'),_0x4ab641,_0x5302c2[_0x89e3('0x24')][_0x89e3('0x27')]);return _0x342250(_0x5302c2[_0x89e3('0x24')][_0x89e3('0x27')]);}logger[_0x89e3('0x24')](_0x89e3('0x26'),_0x4ab641,_0x5302c2['error']['message']);return _0xd925a0(_0x5302c2['error'][_0x89e3('0x27')]);}else{logger['info'](_0x89e3('0x26'),_0x4ab641,_0x89e3('0x22'));_0xd925a0(_0x5302c2[_0x89e3('0x28')]['message']);}})[_0x89e3('0x29')](function(_0x2b2f9d){logger[_0x89e3('0x24')](_0x89e3('0x26'),_0x4ab641,_0x2b2f9d);_0x342250(_0x2b2f9d);});});}function respondWithStatusCode(_0x5f0c79,_0x2b04c5){_0x2b04c5=_0x2b04c5||0xcc;return function(_0x2f2908){if(_0x2f2908){return _0x5f0c79['sendStatus'](_0x2b04c5);}return _0x5f0c79[_0x89e3('0x2a')](_0x2b04c5)[_0x89e3('0x2b')]();};}function respondWithResult(_0x503869,_0x24179c){_0x24179c=_0x24179c||0xc8;return function(_0xee3070){if(_0xee3070){return _0x503869[_0x89e3('0x2a')](_0x24179c)['json'](_0xee3070);}};}function respondWithFilteredResult(_0x1941d9,_0x4c0352){return function(_0x34f8f5){if(_0x34f8f5){var _0x4046c8=typeof _0x4c0352[_0x89e3('0x2c')]===_0x89e3('0x2d')&&typeof _0x4c0352['limit']==='undefined';var _0xc4092d=_0x34f8f5[_0x89e3('0x2e')];var _0x336c25=_0x4046c8?0x0:_0x4c0352['offset'];var _0x160c17=_0x4046c8?_0x34f8f5[_0x89e3('0x2e')]:_0x4c0352[_0x89e3('0x2c')]+_0x4c0352['limit'];var _0x283821;if(_0x160c17>=_0xc4092d){_0x160c17=_0xc4092d;_0x283821=0xc8;}else{_0x283821=0xce;}_0x1941d9[_0x89e3('0x2a')](_0x283821);return _0x1941d9['set'](_0x89e3('0x2f'),_0x336c25+'-'+_0x160c17+'/'+_0xc4092d)[_0x89e3('0x30')](_0x34f8f5);}return null;};}function patchUpdates(_0x11acaa){return function(_0x119c0b){try{jsonpatch[_0x89e3('0x31')](_0x119c0b,_0x11acaa,!![]);}catch(_0x51a3f1){return BPromise[_0x89e3('0x32')](_0x51a3f1);}return _0x119c0b[_0x89e3('0x33')]();};}function saveUpdates(_0x46b7d4,_0x843975){return function(_0x1afaec){if(_0x1afaec){return _0x1afaec[_0x89e3('0x34')](_0x46b7d4)['then'](function(_0x35077d){return _0x35077d;});}return null;};}function removeEntity(_0x340669,_0x4bad04){return function(_0x29dc65){if(_0x29dc65){return _0x29dc65[_0x89e3('0x35')]()[_0x89e3('0x21')](function(){var _0x3f8fa3=_0x29dc65['get']({'plain':!![]});var _0x3f91c7=_0x89e3('0x36');return db[_0x89e3('0x37')]['destroy']({'where':{'type':_0x3f91c7,'resourceId':_0x3f8fa3['id']}})[_0x89e3('0x21')](function(){return _0x29dc65;});})[_0x89e3('0x21')](function(){_0x340669[_0x89e3('0x2a')](0xcc)[_0x89e3('0x2b')]();});}};}function handleEntityNotFound(_0x8bb44e,_0x4921e5){return function(_0x7c4fd5){if(!_0x7c4fd5){_0x8bb44e[_0x89e3('0x38')](0x194);}return _0x7c4fd5;};}function handleError(_0xc80acf,_0x18b9d8){_0x18b9d8=_0x18b9d8||0x1f4;return function(_0x5336d6){logger[_0x89e3('0x24')](_0x5336d6[_0x89e3('0x39')]);if(_0x5336d6[_0x89e3('0x3a')]){delete _0x5336d6[_0x89e3('0x3a')];}_0xc80acf[_0x89e3('0x2a')](_0x18b9d8)[_0x89e3('0x3b')](_0x5336d6);};}exports['index']=function(_0x4e1942,_0x6962a1){var _0x4832fa={'include':[{'model':db[_0x89e3('0x3c')],'as':_0x89e3('0x3d')}]},_0x1671b0={},_0x4dc995={'count':0x0,'rows':[]};var _0x47da66=_[_0x89e3('0x3e')](db[_0x89e3('0x3f')][_0x89e3('0x40')],function(_0x2619ad){return{'name':_0x2619ad[_0x89e3('0x41')],'type':_0x2619ad[_0x89e3('0x42')]['key']};});_0x1671b0['model']=_[_0x89e3('0x3e')](_0x47da66,_0x89e3('0x3a'));_0x1671b0[_0x89e3('0x43')]=_[_0x89e3('0x44')](_0x4e1942[_0x89e3('0x43')]);_0x1671b0['filters']=_[_0x89e3('0x45')](_0x1671b0[_0x89e3('0x46')],_0x1671b0['query']);_0x4832fa['attributes']=_[_0x89e3('0x45')](_0x1671b0[_0x89e3('0x46')],qs[_0x89e3('0x47')](_0x4e1942['query'][_0x89e3('0x47')]));_0x4832fa['attributes']=_0x4832fa[_0x89e3('0x48')]['length']?_0x4832fa[_0x89e3('0x48')]:_0x1671b0['model'];if(!_0x4e1942['query'][_0x89e3('0x49')](_0x89e3('0x4a'))){_0x4832fa[_0x89e3('0x4b')]=qs['limit'](_0x4e1942[_0x89e3('0x43')][_0x89e3('0x4b')]);_0x4832fa[_0x89e3('0x2c')]=qs[_0x89e3('0x2c')](_0x4e1942[_0x89e3('0x43')][_0x89e3('0x2c')]);}_0x4832fa['order']=qs[_0x89e3('0x4c')](_0x4e1942[_0x89e3('0x43')][_0x89e3('0x4c')]);_0x4832fa[_0x89e3('0x4d')]=qs[_0x89e3('0x4e')](_[_0x89e3('0x4f')](_0x4e1942[_0x89e3('0x43')],_0x1671b0['filters']),_0x47da66);if(_0x4e1942['query']['filter']){_0x4832fa[_0x89e3('0x4d')]=_[_0x89e3('0x50')](_0x4832fa[_0x89e3('0x4d')],{'$or':_[_0x89e3('0x3e')](_0x47da66,function(_0x3e9e7e){if(_0x3e9e7e['type']!=='VIRTUAL'){var _0x4f047b={};_0x4f047b[_0x3e9e7e['name']]={'$like':'%'+_0x4e1942[_0x89e3('0x43')][_0x89e3('0x51')]+'%'};return _0x4f047b;}})});}_0x4832fa=_[_0x89e3('0x50')]({},_0x4832fa,_0x4e1942[_0x89e3('0x52')]);var _0x293f06={'where':_0x4832fa[_0x89e3('0x4d')]};return db[_0x89e3('0x3f')][_0x89e3('0x2e')](_0x293f06)[_0x89e3('0x21')](function(_0x5e27fb){_0x4dc995['count']=_0x5e27fb;if(_0x4e1942['query']['includeAll']){_0x4832fa['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x89e3('0x53')](_0x4832fa);})[_0x89e3('0x21')](function(_0x42df41){_0x4dc995[_0x89e3('0x54')]=_0x42df41;return _0x4dc995;})[_0x89e3('0x21')](respondWithFilteredResult(_0x6962a1,_0x4832fa))[_0x89e3('0x29')](handleError(_0x6962a1,null));};exports[_0x89e3('0x55')]=function(_0x51b980,_0x765e0){var _0x42fde2={'raw':![],'where':{'id':_0x51b980['params']['id']},'include':[{'model':db[_0x89e3('0x3c')],'as':_0x89e3('0x3d')}]},_0x3210f5={};_0x3210f5['model']=_[_0x89e3('0x44')](db['WhatsappAccount']['rawAttributes']);_0x3210f5[_0x89e3('0x43')]=_['keys'](_0x51b980[_0x89e3('0x43')]);_0x3210f5['filters']=_[_0x89e3('0x45')](_0x3210f5[_0x89e3('0x46')],_0x3210f5['query']);_0x42fde2[_0x89e3('0x48')]=_[_0x89e3('0x45')](_0x3210f5['model'],qs[_0x89e3('0x47')](_0x51b980[_0x89e3('0x43')][_0x89e3('0x47')]));_0x42fde2[_0x89e3('0x48')]=_0x42fde2[_0x89e3('0x48')][_0x89e3('0x56')]?_0x42fde2['attributes']:_0x3210f5[_0x89e3('0x46')];if(_0x51b980[_0x89e3('0x43')][_0x89e3('0x57')]){_0x42fde2[_0x89e3('0x58')]=[{'all':!![]}];}_0x42fde2=_['merge']({},_0x42fde2,_0x51b980[_0x89e3('0x52')]);return db['WhatsappAccount'][_0x89e3('0x59')](_0x42fde2)[_0x89e3('0x21')](handleEntityNotFound(_0x765e0,null))[_0x89e3('0x21')](respondWithResult(_0x765e0,null))[_0x89e3('0x29')](handleError(_0x765e0,null));};exports['create']=function(_0x340963,_0x2a53c8){return db[_0x89e3('0x3f')]['create'](_0x340963[_0x89e3('0x5a')],{})['then'](function(_0x9c974c){var _0x343fa2=_0x340963[_0x89e3('0x5b')][_0x89e3('0x5c')]({'plain':!![]});if(!_0x343fa2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x343fa2[_0x89e3('0x5d')]===_0x89e3('0x5b')){var _0x1518dd=_0x9c974c['get']({'plain':!![]});var _0x5ba946=_0x89e3('0x36');return db[_0x89e3('0x5e')]['find']({'where':{'name':_0x5ba946,'userProfileId':_0x343fa2[_0x89e3('0x5f')]},'raw':!![]})['then'](function(_0x2623dd){if(_0x2623dd&&_0x2623dd[_0x89e3('0x60')]===0x0){return db[_0x89e3('0x37')][_0x89e3('0x61')]({'name':_0x1518dd[_0x89e3('0x3a')],'resourceId':_0x1518dd['id'],'type':_0x2623dd[_0x89e3('0x3a')],'sectionId':_0x2623dd['id']},{})['then'](function(){return _0x9c974c;});}else{return _0x9c974c;}})[_0x89e3('0x29')](function(_0x55bf27){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55bf27);throw _0x55bf27;});}return _0x9c974c;})['then'](respondWithResult(_0x2a53c8,0xc9))[_0x89e3('0x29')](handleError(_0x2a53c8,null));};exports[_0x89e3('0x34')]=function(_0x1ff953,_0x5b4c03){if(_0x1ff953['body']['id']){delete _0x1ff953[_0x89e3('0x5a')]['id'];}return db[_0x89e3('0x3f')]['find']({'where':{'id':_0x1ff953[_0x89e3('0x62')]['id']},'include':[{'model':db[_0x89e3('0x3c')],'as':_0x89e3('0x3d')}]})[_0x89e3('0x21')](handleEntityNotFound(_0x5b4c03,null))[_0x89e3('0x21')](saveUpdates(_0x1ff953['body'],null))['then'](respondWithResult(_0x5b4c03,null))[_0x89e3('0x29')](handleError(_0x5b4c03,null));};exports[_0x89e3('0x35')]=function(_0x3b3bf6,_0x47f0a1){return db[_0x89e3('0x3f')][_0x89e3('0x59')]({'where':{'id':_0x3b3bf6[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x47f0a1,null))[_0x89e3('0x21')](removeEntity(_0x47f0a1,null))[_0x89e3('0x29')](handleError(_0x47f0a1,null));};exports[_0x89e3('0x63')]=function(_0x257dc7,_0x25e1ab){return db[_0x89e3('0x3f')]['describe']()[_0x89e3('0x21')](respondWithResult(_0x25e1ab,null))['catch'](handleError(_0x25e1ab,null));};exports[_0x89e3('0x64')]=function(_0x2e178a,_0xef749,_0x21ed44){if(_0x2e178a[_0x89e3('0x5a')]['id']){delete _0x2e178a['body']['id'];}return db['WhatsappAccount'][_0x89e3('0x59')]({'where':{'id':_0x2e178a[_0x89e3('0x62')]['id']}})['then'](handleEntityNotFound(_0xef749,null))[_0x89e3('0x21')](function(_0x30476b){if(_0x30476b){_0x2e178a['body'][_0x89e3('0x65')]=_0x30476b['id'];return db[_0x89e3('0x66')][_0x89e3('0x61')](_0x2e178a[_0x89e3('0x5a')]);}})['then'](respondWithResult(_0xef749,null))['catch'](handleError(_0xef749,null));};exports[_0x89e3('0x67')]=function(_0x1d6d15,_0x5eda9b,_0x2836c0){var _0x922853={'raw':![],'where':{}};var _0x59db59={};var _0x3454e9={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x89e3('0x68')]({'where':{'id':_0x1d6d15[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x5eda9b,null))[_0x89e3('0x21')](function(_0xfd232d){if(_0xfd232d){_0x59db59['model']=_['keys'](db[_0x89e3('0x66')][_0x89e3('0x40')]);_0x59db59['query']=_[_0x89e3('0x44')](_0x1d6d15[_0x89e3('0x43')]);_0x59db59[_0x89e3('0x4e')]=_['intersection'](_0x59db59[_0x89e3('0x46')],_0x59db59[_0x89e3('0x43')]);_0x922853['attributes']=_[_0x89e3('0x45')](_0x59db59[_0x89e3('0x46')],qs[_0x89e3('0x47')](_0x1d6d15[_0x89e3('0x43')][_0x89e3('0x47')]));_0x922853[_0x89e3('0x48')]=_0x922853['attributes']['length']?_0x922853[_0x89e3('0x48')]:_0x59db59['model'];if(!_0x1d6d15[_0x89e3('0x43')][_0x89e3('0x49')](_0x89e3('0x4a'))){_0x922853[_0x89e3('0x4b')]=qs['limit'](_0x1d6d15[_0x89e3('0x43')]['limit']);_0x922853[_0x89e3('0x2c')]=qs['offset'](_0x1d6d15[_0x89e3('0x43')][_0x89e3('0x2c')]);}_0x922853[_0x89e3('0x69')]=qs[_0x89e3('0x4c')](_0x1d6d15['query'][_0x89e3('0x4c')]);_0x922853['where']=qs[_0x89e3('0x4e')](_[_0x89e3('0x4f')](_0x1d6d15[_0x89e3('0x43')],_0x59db59[_0x89e3('0x4e')]));_0x922853[_0x89e3('0x4d')][_0x89e3('0x65')]=_0xfd232d['id'];if(_0x1d6d15[_0x89e3('0x43')][_0x89e3('0x51')]){_0x922853[_0x89e3('0x4d')]=_['merge'](_0x922853[_0x89e3('0x4d')],{'$or':_['map'](_0x922853['attributes'],function(_0x2c4d29){var _0x4ced43={};_0x4ced43[_0x2c4d29]={'$like':'%'+_0x1d6d15[_0x89e3('0x43')][_0x89e3('0x51')]+'%'};return _0x4ced43;})});}_0x922853=_['merge']({},_0x922853,_0x1d6d15[_0x89e3('0x52')]);return db[_0x89e3('0x66')][_0x89e3('0x2e')]({'where':_0x922853[_0x89e3('0x4d')]})[_0x89e3('0x21')](function(_0x41b2ed){_0x3454e9[_0x89e3('0x2e')]=_0x41b2ed;if(_0x1d6d15[_0x89e3('0x43')][_0x89e3('0x57')]){_0x922853['include']=[{'all':!![]}];}return db[_0x89e3('0x66')][_0x89e3('0x53')](_0x922853);})['then'](function(_0xcd0fae){_0x3454e9['rows']=_0xcd0fae;return _0x3454e9;});}})[_0x89e3('0x21')](respondWithFilteredResult(_0x5eda9b,_0x922853))[_0x89e3('0x29')](handleError(_0x5eda9b,null));};exports['removeDispositions']=function(_0xf30d80,_0x53962b,_0x59a493){return db[_0x89e3('0x3f')][_0x89e3('0x59')]({'where':{'id':_0xf30d80['params']['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x53962b,null))[_0x89e3('0x21')](function(_0x5eb073){if(_0x5eb073){return _0x5eb073[_0x89e3('0x6a')](_0xf30d80[_0x89e3('0x43')]['ids']);}})[_0x89e3('0x21')](respondWithStatusCode(_0x53962b,null))[_0x89e3('0x29')](handleError(_0x53962b,null));};exports[_0x89e3('0x6b')]=function(_0x57f711,_0x56fa64,_0x4c0a03){if(_0x57f711[_0x89e3('0x5a')]['id']){delete _0x57f711['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x57f711[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x56fa64,null))[_0x89e3('0x21')](function(_0x4f3e21){if(_0x4f3e21){_0x57f711[_0x89e3('0x5a')][_0x89e3('0x65')]=_0x4f3e21['id'];return db[_0x89e3('0x6c')][_0x89e3('0x61')](_0x57f711['body']);}})['then'](respondWithResult(_0x56fa64,null))[_0x89e3('0x29')](handleError(_0x56fa64,null));};exports[_0x89e3('0x6d')]=function(_0x57023f,_0x49ae60,_0x3d63c1){var _0x499fc0={'raw':![],'where':{}};var _0x107220={};var _0x19bf27={'count':0x0,'rows':[]};return db[_0x89e3('0x3f')]['findOne']({'where':{'id':_0x57023f[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x49ae60,null))[_0x89e3('0x21')](function(_0xb810cc){if(_0xb810cc){_0x107220[_0x89e3('0x46')]=_['keys'](db['CannedAnswer'][_0x89e3('0x40')]);_0x107220[_0x89e3('0x43')]=_[_0x89e3('0x44')](_0x57023f[_0x89e3('0x43')]);_0x107220[_0x89e3('0x4e')]=_[_0x89e3('0x45')](_0x107220[_0x89e3('0x46')],_0x107220[_0x89e3('0x43')]);_0x499fc0['attributes']=_[_0x89e3('0x45')](_0x107220[_0x89e3('0x46')],qs['fields'](_0x57023f[_0x89e3('0x43')][_0x89e3('0x47')]));_0x499fc0[_0x89e3('0x48')]=_0x499fc0[_0x89e3('0x48')][_0x89e3('0x56')]?_0x499fc0[_0x89e3('0x48')]:_0x107220[_0x89e3('0x46')];if(!_0x57023f['query'][_0x89e3('0x49')](_0x89e3('0x4a'))){_0x499fc0[_0x89e3('0x4b')]=qs['limit'](_0x57023f[_0x89e3('0x43')][_0x89e3('0x4b')]);_0x499fc0[_0x89e3('0x2c')]=qs[_0x89e3('0x2c')](_0x57023f['query'][_0x89e3('0x2c')]);}_0x499fc0['order']=qs[_0x89e3('0x4c')](_0x57023f['query'][_0x89e3('0x4c')]);_0x499fc0['where']=qs['filters'](_['pick'](_0x57023f[_0x89e3('0x43')],_0x107220[_0x89e3('0x4e')]));_0x499fc0[_0x89e3('0x4d')]['WhatsappAccountId']=_0xb810cc['id'];if(_0x57023f[_0x89e3('0x43')]['filter']){_0x499fc0[_0x89e3('0x4d')]=_[_0x89e3('0x50')](_0x499fc0[_0x89e3('0x4d')],{'$or':_[_0x89e3('0x3e')](_0x499fc0[_0x89e3('0x48')],function(_0x48d80f){var _0x4c7fd1={};_0x4c7fd1[_0x48d80f]={'$like':'%'+_0x57023f[_0x89e3('0x43')][_0x89e3('0x51')]+'%'};return _0x4c7fd1;})});}_0x499fc0=_[_0x89e3('0x50')]({},_0x499fc0,_0x57023f[_0x89e3('0x52')]);return db[_0x89e3('0x6c')][_0x89e3('0x2e')]({'where':_0x499fc0[_0x89e3('0x4d')]})[_0x89e3('0x21')](function(_0x29ba88){_0x19bf27[_0x89e3('0x2e')]=_0x29ba88;if(_0x57023f[_0x89e3('0x43')]['includeAll']){_0x499fc0[_0x89e3('0x58')]=[{'all':!![]}];}return db[_0x89e3('0x6c')][_0x89e3('0x53')](_0x499fc0);})[_0x89e3('0x21')](function(_0x2bb20f){_0x19bf27[_0x89e3('0x54')]=_0x2bb20f;return _0x19bf27;});}})['then'](respondWithFilteredResult(_0x49ae60,_0x499fc0))[_0x89e3('0x29')](handleError(_0x49ae60,null));};exports['removeAnswers']=function(_0x21ffba,_0x4ee311,_0x5efa89){return db[_0x89e3('0x3f')]['find']({'where':{'id':_0x21ffba[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x4ee311,null))[_0x89e3('0x21')](function(_0x4b720c){if(_0x4b720c){return _0x4b720c['removeAnswers'](_0x21ffba[_0x89e3('0x43')][_0x89e3('0x6e')]);}})[_0x89e3('0x21')](respondWithStatusCode(_0x4ee311,null))[_0x89e3('0x29')](handleError(_0x4ee311,null));};exports['addAgents']=function(_0x2b80b8,_0x3e174a,_0x1c6c18){return db[_0x89e3('0x3f')][_0x89e3('0x59')]({'where':{'id':_0x2b80b8['params']['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x3e174a,null))[_0x89e3('0x21')](function(_0x19d57d){if(_0x19d57d){return _0x19d57d[_0x89e3('0x6f')](_0x2b80b8[_0x89e3('0x5a')][_0x89e3('0x6e')],_[_0x89e3('0x70')](_0x2b80b8[_0x89e3('0x5a')],[_0x89e3('0x6e'),'id'])||{})[_0x89e3('0x71')](function(_0x236550){for(var _0xf9406e=0x0;_0xf9406e<_0x2b80b8['body'][_0x89e3('0x6e')][_0x89e3('0x56')];_0xf9406e+=0x1){socket[_0x89e3('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x2b80b8[_0x89e3('0x5a')][_0x89e3('0x6e')][_0xf9406e]),'WhatsappAccountId':Number(_0x2b80b8[_0x89e3('0x62')]['id'])});}return _0x236550;});}})[_0x89e3('0x21')](respondWithResult(_0x3e174a,null))[_0x89e3('0x29')](handleError(_0x3e174a,null));};exports[_0x89e3('0x73')]=function(_0x13d4d2,_0x19faf6,_0x106616){return db[_0x89e3('0x3f')][_0x89e3('0x59')]({'where':{'id':_0x13d4d2[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x19faf6,null))[_0x89e3('0x21')](function(_0x357227){if(_0x357227){return _0x357227[_0x89e3('0x73')](_0x13d4d2[_0x89e3('0x43')][_0x89e3('0x6e')])['then'](function(){if(_[_0x89e3('0x74')](_0x13d4d2[_0x89e3('0x43')][_0x89e3('0x6e')])){for(var _0x935799=0x0;_0x935799<_0x13d4d2['query'][_0x89e3('0x6e')][_0x89e3('0x56')];_0x935799+=0x1){socket[_0x89e3('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x13d4d2['query']['ids'][_0x935799]),'WhatsappAccountId':Number(_0x13d4d2[_0x89e3('0x62')]['id'])});}}else{socket[_0x89e3('0x72')](_0x89e3('0x75'),{'UserId':Number(_0x13d4d2[_0x89e3('0x43')]['ids']),'WhatsappAccountId':Number(_0x13d4d2[_0x89e3('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x19faf6,null))[_0x89e3('0x29')](handleError(_0x19faf6,null));};exports[_0x89e3('0x76')]=function(_0x9d3849,_0x3ada88,_0x5bb959){var _0x51f0ee={};var _0x30b206={};var _0x11bb47;var _0x998bef;return db[_0x89e3('0x3f')]['findOne']({'where':{'id':_0x9d3849[_0x89e3('0x62')]['id']}})['then'](handleEntityNotFound(_0x3ada88,null))[_0x89e3('0x21')](function(_0x180f65){if(_0x180f65){_0x11bb47=_0x180f65;_0x30b206[_0x89e3('0x46')]=_[_0x89e3('0x44')](db[_0x89e3('0x77')][_0x89e3('0x40')]);_0x30b206[_0x89e3('0x43')]=_[_0x89e3('0x44')](_0x9d3849['query']);_0x30b206[_0x89e3('0x4e')]=_['intersection'](_0x30b206[_0x89e3('0x46')],_0x30b206[_0x89e3('0x43')]);_0x51f0ee[_0x89e3('0x48')]=_[_0x89e3('0x45')](_0x30b206['model'],qs[_0x89e3('0x47')](_0x9d3849[_0x89e3('0x43')][_0x89e3('0x47')]));_0x51f0ee[_0x89e3('0x48')]=_0x51f0ee[_0x89e3('0x48')][_0x89e3('0x56')]?_0x51f0ee[_0x89e3('0x48')]:_0x30b206[_0x89e3('0x46')];_0x51f0ee[_0x89e3('0x69')]=qs['sort'](_0x9d3849['query'][_0x89e3('0x4c')]);_0x51f0ee['where']=qs['filters'](_['pick'](_0x9d3849[_0x89e3('0x43')],_0x30b206['filters']));if(_0x9d3849[_0x89e3('0x43')][_0x89e3('0x51')]){_0x51f0ee[_0x89e3('0x4d')]=_[_0x89e3('0x50')](_0x51f0ee['where'],{'$or':_['map'](_0x51f0ee[_0x89e3('0x48')],function(_0x507351){var _0x2651af={};_0x2651af[_0x507351]={'$like':'%'+_0x9d3849['query'][_0x89e3('0x51')]+'%'};return _0x2651af;})});}_0x51f0ee=_[_0x89e3('0x50')]({},_0x51f0ee,_0x9d3849[_0x89e3('0x52')]);return _0x11bb47[_0x89e3('0x76')](_0x51f0ee);}})['then'](function(_0x939309){if(_0x939309){_0x998bef=_0x939309['length'];if(!_0x9d3849[_0x89e3('0x43')][_0x89e3('0x49')]('nolimit')){_0x51f0ee[_0x89e3('0x4b')]=qs[_0x89e3('0x4b')](_0x9d3849[_0x89e3('0x43')][_0x89e3('0x4b')]);_0x51f0ee['offset']=qs[_0x89e3('0x2c')](_0x9d3849['query'][_0x89e3('0x2c')]);}return _0x11bb47[_0x89e3('0x76')](_0x51f0ee);}})['then'](function(_0x2ea2fb){if(_0x2ea2fb){return _0x2ea2fb?{'count':_0x998bef,'rows':_0x2ea2fb}:null;}})[_0x89e3('0x21')](respondWithResult(_0x3ada88,null))['catch'](handleError(_0x3ada88,null));};exports['addApplications']=function(_0x18b0a6,_0x1e794c){var _0x592a52=_0x18b0a6[_0x89e3('0x62')]['id'];var _0x4ba85a=_0x18b0a6['body'];var _0x3299a4=0xc8;var _0x23378c=null;return db[_0x89e3('0x78')][_0x89e3('0x79')]({'isolationLevel':db[_0x89e3('0x78')][_0x89e3('0x7a')][_0x89e3('0x7b')]['READ_COMMITTED']},function(_0x29e05f){return db[_0x89e3('0x3f')][_0x89e3('0x68')]({'where':{'id':_0x592a52},'transaction':_0x29e05f})[_0x89e3('0x21')](function(_0x5d8538){if(_0x5d8538){return db['WhatsappApplication'][_0x89e3('0x35')]({'where':{'WhatsappAccountId':_0x592a52},'transaction':_0x29e05f})[_0x89e3('0x21')](function(){var _0x15cc59=_['map'](_0x4ba85a,function(_0x1c39c4){_0x1c39c4[_0x89e3('0x65')]=_0x592a52;return _0x1c39c4;});return db['WhatsappApplication'][_0x89e3('0x7c')](_0x15cc59,{'transaction':_0x29e05f});});}else{_0x3299a4=0x194;_0x23378c=[];}});})[_0x89e3('0x21')](function(){if(_0x3299a4!==0x194){return db[_0x89e3('0x7d')][_0x89e3('0x7e')]({'where':{'WhatsappAccountId':_0x592a52},'order':_0x89e3('0x7f')})[_0x89e3('0x21')](function(_0x6c2f2b){_0x23378c=_0x6c2f2b;});}})[_0x89e3('0x29')](function(_0x9dce0a){_0x3299a4=0x1f4;logger[_0x89e3('0x24')](_0x9dce0a['stack']);if(_0x9dce0a[_0x89e3('0x3a')]){delete _0x9dce0a[_0x89e3('0x3a')];}_0x23378c=_0x9dce0a;})[_0x89e3('0x80')](function(){if(_0x23378c===null){_0x1e794c[_0x89e3('0x38')](_0x3299a4);}else{if(_0x3299a4===0x1f4){_0x1e794c['status'](_0x3299a4)['send'](_0x23378c);}else{_0x1e794c[_0x89e3('0x2a')](_0x3299a4)[_0x89e3('0x30')](_0x23378c);}}});};exports[_0x89e3('0x81')]=function(_0x42b994,_0x15934e,_0x3d1ec2){var _0x20df1e={};var _0x43f084={};var _0x248c32;var _0x389530;return db[_0x89e3('0x3f')][_0x89e3('0x68')]({'where':{'id':_0x42b994[_0x89e3('0x62')]['id']}})[_0x89e3('0x21')](handleEntityNotFound(_0x15934e,null))['then'](function(_0x3a4b96){if(_0x3a4b96){_0x248c32=_0x3a4b96;_0x43f084[_0x89e3('0x46')]=_['keys'](db[_0x89e3('0x7d')]['rawAttributes']);_0x43f084[_0x89e3('0x43')]=_['keys'](_0x42b994[_0x89e3('0x43')]);_0x43f084[_0x89e3('0x4e')]=_['intersection'](_0x43f084[_0x89e3('0x46')],_0x43f084[_0x89e3('0x43')]);_0x20df1e[_0x89e3('0x48')]=_[_0x89e3('0x45')](_0x43f084[_0x89e3('0x46')],qs[_0x89e3('0x47')](_0x42b994[_0x89e3('0x43')][_0x89e3('0x47')]));_0x20df1e['attributes']=_0x20df1e[_0x89e3('0x48')][_0x89e3('0x56')]?_0x20df1e[_0x89e3('0x48')]:_0x43f084[_0x89e3('0x46')];_0x20df1e['order']=qs[_0x89e3('0x4c')](_0x42b994[_0x89e3('0x43')]['sort']);_0x20df1e[_0x89e3('0x4d')]=qs[_0x89e3('0x4e')](_['pick'](_0x42b994[_0x89e3('0x43')],_0x43f084['filters']));if(_0x42b994[_0x89e3('0x43')][_0x89e3('0x51')]){_0x20df1e['where']=_['merge'](_0x20df1e[_0x89e3('0x4d')],{'$or':_[_0x89e3('0x3e')](_0x20df1e[_0x89e3('0x48')],function(_0x5221f3){var _0x57f56e={};_0x57f56e[_0x5221f3]={'$like':'%'+_0x42b994[_0x89e3('0x43')][_0x89e3('0x51')]+'%'};return _0x57f56e;})});}_0x20df1e=_['merge']({},_0x20df1e,_0x42b994[_0x89e3('0x52')]);return _0x248c32[_0x89e3('0x81')](_0x20df1e);}})['then'](function(_0x20c8bc){if(_0x20c8bc){_0x389530=_0x20c8bc[_0x89e3('0x56')];if(!_0x42b994[_0x89e3('0x43')][_0x89e3('0x49')](_0x89e3('0x4a'))){_0x20df1e['limit']=qs[_0x89e3('0x4b')](_0x42b994[_0x89e3('0x43')][_0x89e3('0x4b')]);_0x20df1e[_0x89e3('0x2c')]=qs[_0x89e3('0x2c')](_0x42b994[_0x89e3('0x43')][_0x89e3('0x2c')]);}return _0x248c32[_0x89e3('0x81')](_0x20df1e);}})['then'](function(_0x565d2a){if(_0x565d2a){return _0x565d2a?{'count':_0x389530,'rows':_0x565d2a}:null;}})[_0x89e3('0x21')](respondWithResult(_0x15934e,null))[_0x89e3('0x29')](handleError(_0x15934e,null));};exports[_0x89e3('0x82')]=function(_0x1e6d2e,_0x37de33,_0x26a378){var _0x4036e5={'channel':_0x89e3('0x83')};var _0xa79e7a=[];var _0x36b2d1=[];var _0x67d0af={};return db[_0x89e3('0x3f')][_0x89e3('0x59')]({'where':{'id':_0x1e6d2e[_0x89e3('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x89e3('0x84')}]})[_0x89e3('0x21')](handleEntityNotFound(_0x37de33,null))[_0x89e3('0x21')](function(_0x51395c){_0x4036e5[_0x89e3('0x85')]=_0x51395c;if(_0x4036e5['account']&&_0x4036e5[_0x89e3('0x85')][_0x89e3('0x42')]===_0x89e3('0x86')&&_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x87')]){if(_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x87')][_0x89e3('0x56')]===0x0)return;if(_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x87')][0x0][_0x89e3('0x88')]!==_0x89e3('0x89'))return;return db[_0x89e3('0x8a')][_0x89e3('0x34')]({'read':!![],'readAt':_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x87')][0x0]['timestamp']},{'where':{'messageId':_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x87')][0x0][_0x89e3('0x8b')]},'individualHooks':!![]})[_0x89e3('0x21')](function(_0x56d25e){return _0x37de33['status'](0xc8)[_0x89e3('0x30')](_0x56d25e);});}_0x4036e5[_0x89e3('0x8c')]=_['orderBy'](_0x51395c[_0x89e3('0x84')],['priority'],[_0x89e3('0x8d')]);if(_0x4036e5[_0x89e3('0x85')][_0x89e3('0x84')]){delete _0x4036e5[_0x89e3('0x85')][_0x89e3('0x84')];}return db[_0x89e3('0x8e')][_0x89e3('0x63')]()[_0x89e3('0x21')](function(_0x4beafc){if(!_0x4beafc){throw new db[(_0x89e3('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0xa79e7a=_['difference'](_[_0x89e3('0x44')](_0x4beafc),[_0x89e3('0x90'),_0x89e3('0x91')]);_0x36b2d1=_[_0x89e3('0x92')](_[_0x89e3('0x44')](_0x4beafc),[_0x89e3('0x90'),_0x89e3('0x91'),'CompanyId','ListId']);_0x4036e5[_0x89e3('0x5a')]={'mapKey':_0x89e3('0x93')};if(_0x4036e5[_0x89e3('0x85')]&&_0x4036e5['account'][_0x89e3('0x42')]===_0x89e3('0x94')){_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')]=_0x1e6d2e[_0x89e3('0x5a')]['From'][_0x89e3('0x96')](_0x89e3('0x97'),'');_0x4036e5['body'][_0x89e3('0x5a')]=_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x98')];_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x99')]=_0x1e6d2e[_0x89e3('0x5a')]['MessageSid'];}if(_0x4036e5[_0x89e3('0x85')]&&_0x4036e5[_0x89e3('0x85')]['type']===_0x89e3('0x86')){_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')]=_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x9a')][0x0][_0x89e3('0x95')];_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x5a')]=_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x9a')][0x0][_0x89e3('0x27')][_0x89e3('0x5a')];_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x99')]=_0x1e6d2e[_0x89e3('0x5a')][_0x89e3('0x9a')][0x0][_0x89e3('0x8b')];}if(_0x4036e5[_0x89e3('0x5a')]['id']){delete _0x4036e5['body']['id'];}if(_['isNil'](_0x4036e5['body']['from'])){throw new db[(_0x89e3('0x8f'))][(_0x89e3('0x9b'))]('from\x20is\x20mandatory');}if(_[_0x89e3('0x9c')](_0x4036e5['body'][_0x89e3('0x5a')])||_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x5a')]===''){throw new db[(_0x89e3('0x8f'))][(_0x89e3('0x9b'))](_0x89e3('0x9d'));}if(_[_0x89e3('0x9c')](_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x9e')])){throw new db['Sequelize'][(_0x89e3('0x9b'))](_0x89e3('0x9f')+_0x36b2d1);}if(!_[_0x89e3('0xa0')](_0x36b2d1,_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x9e')])){throw new db[(_0x89e3('0x8f'))][(_0x89e3('0x9b'))](_0x89e3('0xa1')+_0x36b2d1);}_0x67d0af[_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x9e')]]=_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')];return db[_0x89e3('0xa2')][_0x89e3('0x59')]({'where':{'id':_0x4036e5[_0x89e3('0x85')][_0x89e3('0xa3')]},'include':[{'model':db[_0x89e3('0x8e')],'as':_0x89e3('0xa4'),'where':_0x67d0af,'limit':0x1,'order':[[_0x89e3('0x91'),_0x89e3('0xa5')]]}]});})['then'](handleEntityNotFound(_0x37de33,null))[_0x89e3('0x21')](function(_0x23f624){if(_0x23f624){_0x4036e5[_0x89e3('0xa6')]=_['omit'](_0x23f624,[_0x89e3('0xa4')]);if(_0x23f624[_0x89e3('0xa4')][_0x89e3('0x56')]){return _0x23f624[_0x89e3('0xa4')][0x0];}var _0x42d76d=_[_0x89e3('0x1b')](_0x4036e5[_0x89e3('0x5a')],{'firstName':_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')],'ListId':_0x23f624['id']});_0x42d76d[_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x9e')]]=_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')];return db[_0x89e3('0x8e')][_0x89e3('0x61')](_0x42d76d,{'fields':_0xa79e7a,'raw':!![]});}})[_0x89e3('0x21')](handleEntityNotFound(_0x37de33,null))[_0x89e3('0x21')](function(_0x18c56b){if(_0x18c56b){_0x4036e5[_0x89e3('0xa7')]=_0x18c56b;var _0x5510d5={'ContactId':_0x18c56b['id'],'phone':_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')],'WhatsappAccountId':_0x1e6d2e[_0x89e3('0x62')]['id']};var _0x39a5ad={'ContactId':_0x18c56b['id'],'WhatsappAccountId':_0x1e6d2e['params']['id'],'closed':![]};return db[_0x89e3('0xa8')][_0x89e3('0x59')]({'where':_0x39a5ad})['then'](function(_0x5c4e51){if(_0x5c4e51){return[_0x5c4e51,![]];}return db['WhatsappInteraction']['create'](_0x5510d5)['then'](function(_0xc93770){return[_0xc93770,!![]];});});}})[_0x89e3('0x71')](function(_0x2a77da,_0x16e25c){_0x4036e5[_0x89e3('0xa9')]=_0x2a77da[_0x89e3('0x5c')]({'plain':!![]});_0x4036e5[_0x89e3('0xa9')][_0x89e3('0xaa')]=![];if(_0x16e25c){if(_0x4036e5[_0x89e3('0x85')][_0x89e3('0xab')]){_0x4036e5[_0x89e3('0x8c')][_0x89e3('0xac')]({'id':0x0,'priority':_0x4036e5[_0x89e3('0x8c')][_0x89e3('0x56')]+0x1,'app':_0x89e3('0xad'),'appdata':_0x89e3('0xae'),'interval':'*,*,*,*'});}_0x4036e5[_0x89e3('0xa9')][_0x89e3('0xaa')]=!![];}return db[_0x89e3('0x8a')][_0x89e3('0x61')]({'phone':_0x4036e5[_0x89e3('0x5a')][_0x89e3('0x95')],'messageId':_0x4036e5['body'][_0x89e3('0x99')],'body':_0x4036e5['body'][_0x89e3('0x5a')],'WhatsappAccountId':_0x1e6d2e[_0x89e3('0x62')]['id'],'WhatsappInteractionId':_0x2a77da['id'],'direction':'in','ContactId':_0x2a77da['ContactId'],'AttachmentId':_0x4036e5['body'][_0x89e3('0xaf')]});})[_0x89e3('0x21')](function(_0x1f00f5){_0x4036e5['message']=_0x1f00f5;if(!_0x4036e5['interaction']['UserId'])return;return db[_0x89e3('0x77')]['find']({'attributes':['id',_0x89e3('0x3a')],'where':{'id':_0x4036e5[_0x89e3('0xa9')][_0x89e3('0xb0')]}});})['then'](function(_0x1b8f9a){if(_0x1b8f9a){_0x4036e5[_0x89e3('0x8c')][_0x89e3('0xb1')]({'id':0x0,'priority':0x0,'app':_0x89e3('0xb2'),'appdata':_0x1b8f9a[_0x89e3('0x3a')]+','+(_0x4036e5[_0x89e3('0x85')][_0x89e3('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0x4036e5[_0x89e3('0xa9')][_0x89e3('0xb4')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x89e3('0x3a')],'where':{'id':_0x4036e5[_0x89e3('0xa9')]['queueId']}});})[_0x89e3('0x21')](function(_0x50bc29){if(_0x50bc29){_0x4036e5['applications'][_0x89e3('0xb1')]({'id':0x0,'priority':0x1,'app':_0x89e3('0xb5'),'appdata':_0x50bc29[_0x89e3('0x3a')]+','+(_0x4036e5['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x89e3('0xb6')});}return respondWithRpcPromise(_0x89e3('0xb7'),_0x89e3('0xb8'),_0x4036e5);})['then'](function(_0x5b929f){if(_0x5b929f){var _0x2b3a28=0xc8;var _0x21f5bf=_0x89e3('0xb9');logger[_0x89e3('0xba')](_0x89e3('0x23'),_0x21f5bf,_0x2b3a28,_0x89e3('0xbb'));logger[_0x89e3('0xbc')](_0x89e3('0xbd'),_0x21f5bf,_0x2b3a28,_0x89e3('0xbb'),JSON['stringify'](_0x5b929f));if(_0x4036e5[_0x89e3('0x85')][_0x89e3('0x42')]===_0x89e3('0x94')){return _0x37de33[_0x89e3('0x2a')](_0x2b3a28)[_0x89e3('0xbe')](_0x89e3('0xbf'),_0x89e3('0xc0'))[_0x89e3('0x3b')]('\x0a');}else{return _0x37de33[_0x89e3('0x2a')](_0x2b3a28)['json'](_0x5b929f);}}});})[_0x89e3('0x29')](handleError(_0x37de33,null));};exports[_0x89e3('0x3b')]=function(_0x4e5759,_0x227be4,_0xed5a7b){var _0x1969ac,_0x2cb938,_0x4b5a83;if(_[_0x89e3('0x9c')](_0x4e5759[_0x89e3('0x5a')]['body'])||_0x4e5759['body']['body']===''){throw new db[(_0x89e3('0x8f'))][(_0x89e3('0x9b'))](_0x89e3('0x9d'));}if(_[_0x89e3('0x9c')](_0x4e5759[_0x89e3('0x5a')]['to'])){throw new db[(_0x89e3('0x8f'))][(_0x89e3('0x9b'))](_0x89e3('0xc1'));}_0x1969ac=_0x4e5759[_0x89e3('0x5a')]['to'];return db['WhatsappAccount'][_0x89e3('0x59')]({'where':{'id':_0x4e5759[_0x89e3('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x89e3('0xc2'),'include':[{'model':db[_0x89e3('0x8e')],'as':_0x89e3('0xa4'),'where':{'mobile':_0x1969ac},'limit':0x1,'order':[['updatedAt',_0x89e3('0xa5')]]}]}]})[_0x89e3('0x21')](handleEntityNotFound(_0x227be4,null))[_0x89e3('0x21')](function(_0x5481be){if(_0x5481be&&_0x5481be[_0x89e3('0xc2')]){_0x2cb938=_0x5481be['get']({'plain':!![]});if(_0x2cb938[_0x89e3('0xc2')]&&_0x2cb938['List'][_0x89e3('0xa4')]['length']){return _0x2cb938[_0x89e3('0xc2')][_0x89e3('0xa4')][0x0];}return db[_0x89e3('0x8e')][_0x89e3('0x61')](_[_0x89e3('0x1b')](_0x4e5759[_0x89e3('0x5a')],{'firstName':_0x1969ac,'mobile':_0x1969ac,'phone':_0x1969ac,'ListId':_0x2cb938['ListId']}));}})[_0x89e3('0x21')](handleEntityNotFound(_0x227be4,null))[_0x89e3('0x21')](function(_0x3c9838){if(_0x3c9838){_0x4b5a83=_0x3c9838;return db[_0x89e3('0xa8')][_0x89e3('0x59')]({'where':{'ContactId':_0x4b5a83['id'],'closed':![],'WhatsappAccountId':_0x2cb938['id']}})['then'](function(_0xec8bc9){if(_0xec8bc9){return[_0xec8bc9,![]];}return db['WhatsappInteraction'][_0x89e3('0x61')]({'UserId':_0x4e5759[_0x89e3('0x5b')]['id'],'ContactId':_0x4b5a83['id'],'WhatsappAccountId':_0x2cb938['id'],'phone':_0x1969ac,'firstMsgDirection':_0x89e3('0xc3'),'Messages':[_[_0x89e3('0x50')](_0x4e5759[_0x89e3('0x5a')],{'read':![],'body':_0x4e5759['body'][_0x89e3('0x5a')],'phone':_0x1969ac,'WhatsappAccountId':_0x2cb938['id'],'UserId':_0x4e5759[_0x89e3('0x5b')]['id'],'ContactId':_0x4b5a83['id']})]},{'include':[{'model':db[_0x89e3('0x8a')],'as':_0x89e3('0xc4')}]})[_0x89e3('0x21')](function(_0x58b92f){return[_0x58b92f,!![]];});});}})[_0x89e3('0x71')](function(_0x3d275b,_0x438dae){if(_0x438dae){return _0x3d275b;}return db[_0x89e3('0x8a')]['create'](_[_0x89e3('0x50')](_0x4e5759['body'],{'read':![],'body':_0x4e5759[_0x89e3('0x5a')]['body'],'phone':_0x1969ac,'WhatsappAccountId':_0x2cb938['id'],'WhatsappInteractionId':_0x3d275b['id'],'UserId':_0x4e5759[_0x89e3('0x5b')]['id'],'ContactId':_0x4b5a83['id']}))['then'](function(_0x334205){_0x3d275b[_0x89e3('0xc5')][_0x89e3('0xc4')]=[];_0x3d275b[_0x89e3('0xc5')][_0x89e3('0xc4')][_0x89e3('0xac')](_0x334205[_0x89e3('0xc5')]);return _0x3d275b;});})['then'](respondWithResult(_0x227be4,null))[_0x89e3('0x29')](handleError(_0x227be4,null));}; \ No newline at end of file +var _0x44a8=['destroy','then','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','WhatsappApplication','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','twilio','From','replace','whatsapp:','Body','messageId','from','notifications','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','created','autoclose','push','close','interaction','ContactId','AttachmentId','User','UserId','unshift','*,*,*,*','WhatsappQueue','queue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update'];(function(_0x473a38,_0x1c0e5e){var _0x569d43=function(_0x4add6d){while(--_0x4add6d){_0x473a38['push'](_0x473a38['shift']());}};_0x569d43(++_0x1c0e5e);}(_0x44a8,0x8f));var _0x844a=function(_0x25a473,_0x117ca8){_0x25a473=_0x25a473-0x0;var _0xc0cac0=_0x44a8[_0x25a473];return _0xc0cac0;};'use strict';var emlformat=require(_0x844a('0x0'));var rimraf=require(_0x844a('0x1'));var zipdir=require(_0x844a('0x2'));var jsonpatch=require(_0x844a('0x3'));var rp=require('request-promise');var moment=require(_0x844a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x844a('0x5'));var util=require(_0x844a('0x6'));var path=require(_0x844a('0x7'));var sox=require('sox');var csv=require(_0x844a('0x8'));var ejs=require(_0x844a('0x9'));var fs=require('fs');var fs_extra=require(_0x844a('0xa'));var _=require(_0x844a('0xb'));var squel=require(_0x844a('0xc'));var crypto=require(_0x844a('0xd'));var jsforce=require(_0x844a('0xe'));var deskjs=require(_0x844a('0xf'));var toCsv=require(_0x844a('0x8'));var querystring=require(_0x844a('0x10'));var Papa=require('papaparse');var Redis=require(_0x844a('0x11'));var authService=require(_0x844a('0x12'));var qs=require(_0x844a('0x13'));var as=require(_0x844a('0x14'));var hardwareService=require(_0x844a('0x15'));var logger=require(_0x844a('0x16'))(_0x844a('0x17'));var utils=require(_0x844a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x844a('0x19'));var db=require(_0x844a('0x1a'))['db'];config['redis']=_[_0x844a('0x1b')](config[_0x844a('0x1c')],{'host':_0x844a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x844a('0x1e'))[_0x844a('0x1f')](socket);var jayson=require(_0x844a('0x20'));var client=jayson['client'][_0x844a('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3881f5,_0x10277d,_0x19a6e5,_0x6711a7){return new BPromise(function(_0x257301,_0x12a835){var _0x995294=_0x6711a7||client;return _0x995294[_0x844a('0x22')](_0x3881f5,_0x19a6e5)['then'](function(_0x66bb94){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x10277d,_0x844a('0x23'));logger[_0x844a('0x24')](_0x844a('0x25'),_0x10277d,_0x844a('0x23'),JSON[_0x844a('0x26')](_0x66bb94));if(_0x66bb94[_0x844a('0x27')]){if(_0x66bb94[_0x844a('0x27')][_0x844a('0x28')]===0x1f4){logger[_0x844a('0x27')](_0x844a('0x29'),_0x10277d,_0x66bb94[_0x844a('0x27')][_0x844a('0x2a')]);return _0x12a835(_0x66bb94[_0x844a('0x27')][_0x844a('0x2a')]);}logger[_0x844a('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x10277d,_0x66bb94[_0x844a('0x27')]['message']);return _0x257301(_0x66bb94[_0x844a('0x27')][_0x844a('0x2a')]);}else{logger[_0x844a('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x10277d,_0x844a('0x23'));_0x257301(_0x66bb94[_0x844a('0x2c')][_0x844a('0x2a')]);}})['catch'](function(_0x503f57){logger[_0x844a('0x27')](_0x844a('0x29'),_0x10277d,_0x503f57);_0x12a835(_0x503f57);});});}function respondWithStatusCode(_0x1246c5,_0x4243cc){_0x4243cc=_0x4243cc||0xcc;return function(_0x1ccf1e){if(_0x1ccf1e){return _0x1246c5[_0x844a('0x2d')](_0x4243cc);}return _0x1246c5['status'](_0x4243cc)[_0x844a('0x2e')]();};}function respondWithResult(_0x10da88,_0x4db40b){_0x4db40b=_0x4db40b||0xc8;return function(_0x34b245){if(_0x34b245){return _0x10da88[_0x844a('0x2f')](_0x4db40b)[_0x844a('0x30')](_0x34b245);}};}function respondWithFilteredResult(_0x18310f,_0x5e38f7){return function(_0x5d3ed6){if(_0x5d3ed6){var _0x432d9d=typeof _0x5e38f7[_0x844a('0x31')]===_0x844a('0x32')&&typeof _0x5e38f7['limit']===_0x844a('0x32');var _0x19d725=_0x5d3ed6['count'];var _0x4c0628=_0x432d9d?0x0:_0x5e38f7[_0x844a('0x31')];var _0x3cc9f8=_0x432d9d?_0x5d3ed6[_0x844a('0x33')]:_0x5e38f7[_0x844a('0x31')]+_0x5e38f7[_0x844a('0x34')];var _0x3eec7a;if(_0x3cc9f8>=_0x19d725){_0x3cc9f8=_0x19d725;_0x3eec7a=0xc8;}else{_0x3eec7a=0xce;}_0x18310f[_0x844a('0x2f')](_0x3eec7a);return _0x18310f[_0x844a('0x35')](_0x844a('0x36'),_0x4c0628+'-'+_0x3cc9f8+'/'+_0x19d725)[_0x844a('0x30')](_0x5d3ed6);}return null;};}function patchUpdates(_0xc710c8){return function(_0x31e033){try{jsonpatch[_0x844a('0x37')](_0x31e033,_0xc710c8,!![]);}catch(_0x5eb01b){return BPromise[_0x844a('0x38')](_0x5eb01b);}return _0x31e033['save']();};}function saveUpdates(_0x39a062,_0x1a0f5f){return function(_0x5b5a47){if(_0x5b5a47){return _0x5b5a47[_0x844a('0x39')](_0x39a062)['then'](function(_0xf88c3d){return _0xf88c3d;});}return null;};}function removeEntity(_0x4941a0,_0x58fe37){return function(_0x44bf35){if(_0x44bf35){return _0x44bf35[_0x844a('0x3a')]()[_0x844a('0x3b')](function(){var _0x69ac99=_0x44bf35[_0x844a('0x3c')]({'plain':!![]});var _0x4e2ad6=_0x844a('0x3d');return db[_0x844a('0x3e')][_0x844a('0x3a')]({'where':{'type':_0x4e2ad6,'resourceId':_0x69ac99['id']}})['then'](function(){return _0x44bf35;});})['then'](function(){_0x4941a0['status'](0xcc)[_0x844a('0x2e')]();});}};}function handleEntityNotFound(_0x3af9d2,_0x5b0b82){return function(_0x420823){if(!_0x420823){_0x3af9d2[_0x844a('0x2d')](0x194);}return _0x420823;};}function handleError(_0x5a934f,_0x356866){_0x356866=_0x356866||0x1f4;return function(_0x3cb1c3){logger['error'](_0x3cb1c3['stack']);if(_0x3cb1c3[_0x844a('0x3f')]){delete _0x3cb1c3[_0x844a('0x3f')];}_0x5a934f[_0x844a('0x2f')](_0x356866)[_0x844a('0x40')](_0x3cb1c3);};}exports[_0x844a('0x41')]=function(_0x5206f0,_0x45e357){var _0x3a9eea={'include':[{'model':db[_0x844a('0x42')],'as':_0x844a('0x43')}]},_0x626c20={},_0xfb9729={'count':0x0,'rows':[]};var _0x2237fd=_[_0x844a('0x44')](db[_0x844a('0x45')][_0x844a('0x46')],function(_0xf00122){return{'name':_0xf00122[_0x844a('0x47')],'type':_0xf00122[_0x844a('0x48')][_0x844a('0x49')]};});_0x626c20['model']=_[_0x844a('0x44')](_0x2237fd,_0x844a('0x3f'));_0x626c20[_0x844a('0x4a')]=_['keys'](_0x5206f0[_0x844a('0x4a')]);_0x626c20[_0x844a('0x4b')]=_['intersection'](_0x626c20[_0x844a('0x4c')],_0x626c20[_0x844a('0x4a')]);_0x3a9eea[_0x844a('0x4d')]=_[_0x844a('0x4e')](_0x626c20[_0x844a('0x4c')],qs['fields'](_0x5206f0[_0x844a('0x4a')][_0x844a('0x4f')]));_0x3a9eea['attributes']=_0x3a9eea[_0x844a('0x4d')][_0x844a('0x50')]?_0x3a9eea[_0x844a('0x4d')]:_0x626c20[_0x844a('0x4c')];if(!_0x5206f0['query'][_0x844a('0x51')]('nolimit')){_0x3a9eea['limit']=qs[_0x844a('0x34')](_0x5206f0[_0x844a('0x4a')][_0x844a('0x34')]);_0x3a9eea[_0x844a('0x31')]=qs[_0x844a('0x31')](_0x5206f0[_0x844a('0x4a')][_0x844a('0x31')]);}_0x3a9eea[_0x844a('0x52')]=qs[_0x844a('0x53')](_0x5206f0[_0x844a('0x4a')]['sort']);_0x3a9eea[_0x844a('0x54')]=qs[_0x844a('0x4b')](_[_0x844a('0x55')](_0x5206f0['query'],_0x626c20[_0x844a('0x4b')]),_0x2237fd);if(_0x5206f0[_0x844a('0x4a')]['filter']){_0x3a9eea['where']=_[_0x844a('0x56')](_0x3a9eea[_0x844a('0x54')],{'$or':_[_0x844a('0x44')](_0x2237fd,function(_0x27bdb6){if(_0x27bdb6[_0x844a('0x48')]!==_0x844a('0x57')){var _0xc02dd8={};_0xc02dd8[_0x27bdb6[_0x844a('0x3f')]]={'$like':'%'+_0x5206f0[_0x844a('0x4a')][_0x844a('0x58')]+'%'};return _0xc02dd8;}})});}_0x3a9eea=_[_0x844a('0x56')]({},_0x3a9eea,_0x5206f0[_0x844a('0x59')]);var _0x219fc5={'where':_0x3a9eea[_0x844a('0x54')]};return db['WhatsappAccount']['count'](_0x219fc5)[_0x844a('0x3b')](function(_0x10333c){_0xfb9729[_0x844a('0x33')]=_0x10333c;if(_0x5206f0['query'][_0x844a('0x5a')]){_0x3a9eea[_0x844a('0x5b')]=[{'all':!![]}];}return db[_0x844a('0x45')][_0x844a('0x5c')](_0x3a9eea);})[_0x844a('0x3b')](function(_0x2fe648){_0xfb9729[_0x844a('0x5d')]=_0x2fe648;return _0xfb9729;})[_0x844a('0x3b')](respondWithFilteredResult(_0x45e357,_0x3a9eea))[_0x844a('0x5e')](handleError(_0x45e357,null));};exports['show']=function(_0x512d97,_0x4c3566){var _0x552ca7={'raw':![],'where':{'id':_0x512d97[_0x844a('0x5f')]['id']},'include':[{'model':db[_0x844a('0x42')],'as':'mandatoryDispositionPause'}]},_0x3bf877={};_0x3bf877[_0x844a('0x4c')]=_[_0x844a('0x60')](db['WhatsappAccount'][_0x844a('0x46')]);_0x3bf877[_0x844a('0x4a')]=_[_0x844a('0x60')](_0x512d97[_0x844a('0x4a')]);_0x3bf877[_0x844a('0x4b')]=_[_0x844a('0x4e')](_0x3bf877[_0x844a('0x4c')],_0x3bf877[_0x844a('0x4a')]);_0x552ca7[_0x844a('0x4d')]=_[_0x844a('0x4e')](_0x3bf877[_0x844a('0x4c')],qs['fields'](_0x512d97[_0x844a('0x4a')][_0x844a('0x4f')]));_0x552ca7[_0x844a('0x4d')]=_0x552ca7['attributes']['length']?_0x552ca7['attributes']:_0x3bf877[_0x844a('0x4c')];if(_0x512d97[_0x844a('0x4a')][_0x844a('0x5a')]){_0x552ca7['include']=[{'all':!![]}];}_0x552ca7=_[_0x844a('0x56')]({},_0x552ca7,_0x512d97['options']);return db[_0x844a('0x45')][_0x844a('0x61')](_0x552ca7)[_0x844a('0x3b')](handleEntityNotFound(_0x4c3566,null))[_0x844a('0x3b')](respondWithResult(_0x4c3566,null))[_0x844a('0x5e')](handleError(_0x4c3566,null));};exports[_0x844a('0x62')]=function(_0x1e3d31,_0x3b1006){return db[_0x844a('0x45')][_0x844a('0x62')](_0x1e3d31['body'],{})['then'](function(_0x1e4c56){var _0x122f53=_0x1e3d31['user'][_0x844a('0x3c')]({'plain':!![]});if(!_0x122f53)throw new Error(_0x844a('0x63'));if(_0x122f53[_0x844a('0x64')]===_0x844a('0x65')){var _0x5ce335=_0x1e4c56[_0x844a('0x3c')]({'plain':!![]});var _0x4f5084=_0x844a('0x3d');return db[_0x844a('0x66')][_0x844a('0x61')]({'where':{'name':_0x4f5084,'userProfileId':_0x122f53[_0x844a('0x67')]},'raw':!![]})[_0x844a('0x3b')](function(_0x411d9d){if(_0x411d9d&&_0x411d9d['autoAssociation']===0x0){return db['UserProfileResource'][_0x844a('0x62')]({'name':_0x5ce335[_0x844a('0x3f')],'resourceId':_0x5ce335['id'],'type':_0x411d9d['name'],'sectionId':_0x411d9d['id']},{})[_0x844a('0x3b')](function(){return _0x1e4c56;});}else{return _0x1e4c56;}})[_0x844a('0x5e')](function(_0x4ea9d7){logger['error'](_0x844a('0x68'),_0x4ea9d7);throw _0x4ea9d7;});}return _0x1e4c56;})[_0x844a('0x3b')](respondWithResult(_0x3b1006,0xc9))['catch'](handleError(_0x3b1006,null));};exports[_0x844a('0x39')]=function(_0x55294d,_0x44e491){if(_0x55294d[_0x844a('0x69')]['id']){delete _0x55294d[_0x844a('0x69')]['id'];}return db[_0x844a('0x45')][_0x844a('0x61')]({'where':{'id':_0x55294d[_0x844a('0x5f')]['id']},'include':[{'model':db[_0x844a('0x42')],'as':_0x844a('0x43')}]})[_0x844a('0x3b')](handleEntityNotFound(_0x44e491,null))[_0x844a('0x3b')](saveUpdates(_0x55294d[_0x844a('0x69')],null))['then'](respondWithResult(_0x44e491,null))[_0x844a('0x5e')](handleError(_0x44e491,null));};exports['destroy']=function(_0x3c0528,_0x113c45){return db[_0x844a('0x45')][_0x844a('0x61')]({'where':{'id':_0x3c0528[_0x844a('0x5f')]['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x113c45,null))['then'](removeEntity(_0x113c45,null))['catch'](handleError(_0x113c45,null));};exports[_0x844a('0x6a')]=function(_0x5ef704,_0x1a918f){return db['WhatsappAccount'][_0x844a('0x6a')]()[_0x844a('0x3b')](respondWithResult(_0x1a918f,null))['catch'](handleError(_0x1a918f,null));};exports[_0x844a('0x6b')]=function(_0x4ea670,_0x5bae21,_0xd210ce){if(_0x4ea670['body']['id']){delete _0x4ea670[_0x844a('0x69')]['id'];}return db['WhatsappAccount'][_0x844a('0x61')]({'where':{'id':_0x4ea670['params']['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x5bae21,null))[_0x844a('0x3b')](function(_0x3ca3ad){if(_0x3ca3ad){_0x4ea670[_0x844a('0x69')][_0x844a('0x6c')]=_0x3ca3ad['id'];return db[_0x844a('0x6d')][_0x844a('0x62')](_0x4ea670[_0x844a('0x69')]);}})[_0x844a('0x3b')](respondWithResult(_0x5bae21,null))[_0x844a('0x5e')](handleError(_0x5bae21,null));};exports[_0x844a('0x6e')]=function(_0xb3fff4,_0x5e4f0d,_0xf10859){var _0x8a318b={'raw':![],'where':{}};var _0x1eecec={};var _0xf1703d={'count':0x0,'rows':[]};return db[_0x844a('0x45')][_0x844a('0x6f')]({'where':{'id':_0xb3fff4['params']['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x5e4f0d,null))[_0x844a('0x3b')](function(_0x287926){if(_0x287926){_0x1eecec[_0x844a('0x4c')]=_['keys'](db[_0x844a('0x6d')][_0x844a('0x46')]);_0x1eecec[_0x844a('0x4a')]=_[_0x844a('0x60')](_0xb3fff4[_0x844a('0x4a')]);_0x1eecec[_0x844a('0x4b')]=_['intersection'](_0x1eecec['model'],_0x1eecec['query']);_0x8a318b['attributes']=_[_0x844a('0x4e')](_0x1eecec[_0x844a('0x4c')],qs[_0x844a('0x4f')](_0xb3fff4['query'][_0x844a('0x4f')]));_0x8a318b[_0x844a('0x4d')]=_0x8a318b['attributes']['length']?_0x8a318b['attributes']:_0x1eecec[_0x844a('0x4c')];if(!_0xb3fff4[_0x844a('0x4a')][_0x844a('0x51')](_0x844a('0x70'))){_0x8a318b[_0x844a('0x34')]=qs['limit'](_0xb3fff4[_0x844a('0x4a')]['limit']);_0x8a318b[_0x844a('0x31')]=qs[_0x844a('0x31')](_0xb3fff4[_0x844a('0x4a')][_0x844a('0x31')]);}_0x8a318b[_0x844a('0x52')]=qs['sort'](_0xb3fff4[_0x844a('0x4a')][_0x844a('0x53')]);_0x8a318b[_0x844a('0x54')]=qs[_0x844a('0x4b')](_[_0x844a('0x55')](_0xb3fff4[_0x844a('0x4a')],_0x1eecec[_0x844a('0x4b')]));_0x8a318b[_0x844a('0x54')][_0x844a('0x6c')]=_0x287926['id'];if(_0xb3fff4['query'][_0x844a('0x58')]){_0x8a318b[_0x844a('0x54')]=_[_0x844a('0x56')](_0x8a318b[_0x844a('0x54')],{'$or':_[_0x844a('0x44')](_0x8a318b[_0x844a('0x4d')],function(_0x298ea3){var _0x15c125={};_0x15c125[_0x298ea3]={'$like':'%'+_0xb3fff4['query']['filter']+'%'};return _0x15c125;})});}_0x8a318b=_[_0x844a('0x56')]({},_0x8a318b,_0xb3fff4['options']);return db[_0x844a('0x6d')][_0x844a('0x33')]({'where':_0x8a318b[_0x844a('0x54')]})[_0x844a('0x3b')](function(_0x5a9007){_0xf1703d[_0x844a('0x33')]=_0x5a9007;if(_0xb3fff4[_0x844a('0x4a')][_0x844a('0x5a')]){_0x8a318b['include']=[{'all':!![]}];}return db[_0x844a('0x6d')]['findAll'](_0x8a318b);})[_0x844a('0x3b')](function(_0x4799a5){_0xf1703d[_0x844a('0x5d')]=_0x4799a5;return _0xf1703d;});}})[_0x844a('0x3b')](respondWithFilteredResult(_0x5e4f0d,_0x8a318b))['catch'](handleError(_0x5e4f0d,null));};exports['removeDispositions']=function(_0x432c6d,_0x377f7f,_0x217a0b){return db['WhatsappAccount'][_0x844a('0x61')]({'where':{'id':_0x432c6d['params']['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x377f7f,null))['then'](function(_0x421daf){if(_0x421daf){return _0x421daf[_0x844a('0x71')](_0x432c6d[_0x844a('0x4a')]['ids']);}})[_0x844a('0x3b')](respondWithStatusCode(_0x377f7f,null))[_0x844a('0x5e')](handleError(_0x377f7f,null));};exports['addAnswer']=function(_0x5d2ea2,_0xa1093b,_0x530b2e){if(_0x5d2ea2[_0x844a('0x69')]['id']){delete _0x5d2ea2[_0x844a('0x69')]['id'];}return db[_0x844a('0x45')][_0x844a('0x61')]({'where':{'id':_0x5d2ea2[_0x844a('0x5f')]['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0xa1093b,null))[_0x844a('0x3b')](function(_0x43daac){if(_0x43daac){_0x5d2ea2[_0x844a('0x69')]['WhatsappAccountId']=_0x43daac['id'];return db[_0x844a('0x72')][_0x844a('0x62')](_0x5d2ea2[_0x844a('0x69')]);}})[_0x844a('0x3b')](respondWithResult(_0xa1093b,null))['catch'](handleError(_0xa1093b,null));};exports[_0x844a('0x73')]=function(_0x42c9fc,_0x4aa662,_0x25edcf){var _0x4c8fa5={'raw':![],'where':{}};var _0x2fcead={};var _0x32c981={'count':0x0,'rows':[]};return db[_0x844a('0x45')][_0x844a('0x6f')]({'where':{'id':_0x42c9fc[_0x844a('0x5f')]['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x4aa662,null))[_0x844a('0x3b')](function(_0x5388f0){if(_0x5388f0){_0x2fcead[_0x844a('0x4c')]=_[_0x844a('0x60')](db[_0x844a('0x72')]['rawAttributes']);_0x2fcead[_0x844a('0x4a')]=_['keys'](_0x42c9fc[_0x844a('0x4a')]);_0x2fcead['filters']=_['intersection'](_0x2fcead[_0x844a('0x4c')],_0x2fcead[_0x844a('0x4a')]);_0x4c8fa5['attributes']=_['intersection'](_0x2fcead[_0x844a('0x4c')],qs[_0x844a('0x4f')](_0x42c9fc[_0x844a('0x4a')][_0x844a('0x4f')]));_0x4c8fa5[_0x844a('0x4d')]=_0x4c8fa5[_0x844a('0x4d')][_0x844a('0x50')]?_0x4c8fa5[_0x844a('0x4d')]:_0x2fcead[_0x844a('0x4c')];if(!_0x42c9fc[_0x844a('0x4a')][_0x844a('0x51')](_0x844a('0x70'))){_0x4c8fa5['limit']=qs[_0x844a('0x34')](_0x42c9fc[_0x844a('0x4a')][_0x844a('0x34')]);_0x4c8fa5[_0x844a('0x31')]=qs[_0x844a('0x31')](_0x42c9fc[_0x844a('0x4a')][_0x844a('0x31')]);}_0x4c8fa5['order']=qs[_0x844a('0x53')](_0x42c9fc[_0x844a('0x4a')][_0x844a('0x53')]);_0x4c8fa5[_0x844a('0x54')]=qs[_0x844a('0x4b')](_['pick'](_0x42c9fc['query'],_0x2fcead[_0x844a('0x4b')]));_0x4c8fa5[_0x844a('0x54')][_0x844a('0x6c')]=_0x5388f0['id'];if(_0x42c9fc[_0x844a('0x4a')][_0x844a('0x58')]){_0x4c8fa5['where']=_[_0x844a('0x56')](_0x4c8fa5[_0x844a('0x54')],{'$or':_['map'](_0x4c8fa5['attributes'],function(_0x17a10a){var _0x4206d5={};_0x4206d5[_0x17a10a]={'$like':'%'+_0x42c9fc[_0x844a('0x4a')][_0x844a('0x58')]+'%'};return _0x4206d5;})});}_0x4c8fa5=_[_0x844a('0x56')]({},_0x4c8fa5,_0x42c9fc[_0x844a('0x59')]);return db[_0x844a('0x72')][_0x844a('0x33')]({'where':_0x4c8fa5[_0x844a('0x54')]})[_0x844a('0x3b')](function(_0x369f1f){_0x32c981[_0x844a('0x33')]=_0x369f1f;if(_0x42c9fc[_0x844a('0x4a')][_0x844a('0x5a')]){_0x4c8fa5['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x844a('0x5c')](_0x4c8fa5);})[_0x844a('0x3b')](function(_0x4afb7c){_0x32c981[_0x844a('0x5d')]=_0x4afb7c;return _0x32c981;});}})[_0x844a('0x3b')](respondWithFilteredResult(_0x4aa662,_0x4c8fa5))[_0x844a('0x5e')](handleError(_0x4aa662,null));};exports[_0x844a('0x74')]=function(_0x414812,_0x4c5c3d,_0x48d212){return db['WhatsappAccount']['find']({'where':{'id':_0x414812[_0x844a('0x5f')]['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x4c5c3d,null))[_0x844a('0x3b')](function(_0x276130){if(_0x276130){return _0x276130['removeAnswers'](_0x414812[_0x844a('0x4a')][_0x844a('0x75')]);}})[_0x844a('0x3b')](respondWithStatusCode(_0x4c5c3d,null))[_0x844a('0x5e')](handleError(_0x4c5c3d,null));};exports[_0x844a('0x76')]=function(_0x352ada,_0x1804b0,_0x97e855){return db[_0x844a('0x45')]['find']({'where':{'id':_0x352ada['params']['id']}})['then'](handleEntityNotFound(_0x1804b0,null))[_0x844a('0x3b')](function(_0x271e08){if(_0x271e08){return _0x271e08[_0x844a('0x76')](_0x352ada[_0x844a('0x69')]['ids'],_[_0x844a('0x77')](_0x352ada[_0x844a('0x69')],[_0x844a('0x75'),'id'])||{})['spread'](function(_0x4a1e8b){for(var _0x42b0f5=0x0;_0x42b0f5<_0x352ada[_0x844a('0x69')]['ids']['length'];_0x42b0f5+=0x1){socket[_0x844a('0x78')]('userWhatsappAccount:save',{'UserId':Number(_0x352ada[_0x844a('0x69')][_0x844a('0x75')][_0x42b0f5]),'WhatsappAccountId':Number(_0x352ada['params']['id'])});}return _0x4a1e8b;});}})['then'](respondWithResult(_0x1804b0,null))['catch'](handleError(_0x1804b0,null));};exports[_0x844a('0x79')]=function(_0x44219a,_0x14eacb,_0x5437ae){return db[_0x844a('0x45')][_0x844a('0x61')]({'where':{'id':_0x44219a[_0x844a('0x5f')]['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x14eacb,null))['then'](function(_0x395ce6){if(_0x395ce6){return _0x395ce6[_0x844a('0x79')](_0x44219a[_0x844a('0x4a')]['ids'])[_0x844a('0x3b')](function(){if(_['isArray'](_0x44219a[_0x844a('0x4a')]['ids'])){for(var _0x39ef09=0x0;_0x39ef09<_0x44219a['query'][_0x844a('0x75')][_0x844a('0x50')];_0x39ef09+=0x1){socket[_0x844a('0x78')](_0x844a('0x7a'),{'UserId':Number(_0x44219a[_0x844a('0x4a')][_0x844a('0x75')][_0x39ef09]),'WhatsappAccountId':Number(_0x44219a[_0x844a('0x5f')]['id'])});}}else{socket['emit'](_0x844a('0x7a'),{'UserId':Number(_0x44219a[_0x844a('0x4a')][_0x844a('0x75')]),'WhatsappAccountId':Number(_0x44219a['params']['id'])});}});}})[_0x844a('0x3b')](respondWithStatusCode(_0x14eacb,null))[_0x844a('0x5e')](handleError(_0x14eacb,null));};exports['getAgents']=function(_0x52f619,_0x27199e,_0x2c1d1a){var _0x57c0d4={};var _0x5a95f6={};var _0x53003f;var _0x4a5e2b;return db[_0x844a('0x45')][_0x844a('0x6f')]({'where':{'id':_0x52f619['params']['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x27199e,null))[_0x844a('0x3b')](function(_0x44c764){if(_0x44c764){_0x53003f=_0x44c764;_0x5a95f6['model']=_[_0x844a('0x60')](db['User'][_0x844a('0x46')]);_0x5a95f6['query']=_[_0x844a('0x60')](_0x52f619[_0x844a('0x4a')]);_0x5a95f6[_0x844a('0x4b')]=_['intersection'](_0x5a95f6[_0x844a('0x4c')],_0x5a95f6[_0x844a('0x4a')]);_0x57c0d4[_0x844a('0x4d')]=_[_0x844a('0x4e')](_0x5a95f6['model'],qs[_0x844a('0x4f')](_0x52f619['query'][_0x844a('0x4f')]));_0x57c0d4[_0x844a('0x4d')]=_0x57c0d4[_0x844a('0x4d')]['length']?_0x57c0d4[_0x844a('0x4d')]:_0x5a95f6[_0x844a('0x4c')];_0x57c0d4['order']=qs['sort'](_0x52f619[_0x844a('0x4a')]['sort']);_0x57c0d4['where']=qs[_0x844a('0x4b')](_[_0x844a('0x55')](_0x52f619['query'],_0x5a95f6[_0x844a('0x4b')]));if(_0x52f619[_0x844a('0x4a')][_0x844a('0x58')]){_0x57c0d4[_0x844a('0x54')]=_['merge'](_0x57c0d4[_0x844a('0x54')],{'$or':_['map'](_0x57c0d4[_0x844a('0x4d')],function(_0x2007a8){var _0x22f38a={};_0x22f38a[_0x2007a8]={'$like':'%'+_0x52f619[_0x844a('0x4a')][_0x844a('0x58')]+'%'};return _0x22f38a;})});}_0x57c0d4=_['merge']({},_0x57c0d4,_0x52f619[_0x844a('0x59')]);return _0x53003f['getAgents'](_0x57c0d4);}})[_0x844a('0x3b')](function(_0x478ec2){if(_0x478ec2){_0x4a5e2b=_0x478ec2[_0x844a('0x50')];if(!_0x52f619['query']['hasOwnProperty'](_0x844a('0x70'))){_0x57c0d4['limit']=qs['limit'](_0x52f619[_0x844a('0x4a')][_0x844a('0x34')]);_0x57c0d4[_0x844a('0x31')]=qs[_0x844a('0x31')](_0x52f619['query'][_0x844a('0x31')]);}return _0x53003f[_0x844a('0x7b')](_0x57c0d4);}})[_0x844a('0x3b')](function(_0x1f9a12){if(_0x1f9a12){return _0x1f9a12?{'count':_0x4a5e2b,'rows':_0x1f9a12}:null;}})[_0x844a('0x3b')](respondWithResult(_0x27199e,null))[_0x844a('0x5e')](handleError(_0x27199e,null));};exports[_0x844a('0x7c')]=function(_0x43eb15,_0x1e3ba2){var _0x2f7cb6=_0x43eb15['params']['id'];var _0x5ef823=_0x43eb15['body'];var _0x138290=0xc8;var _0x28669a=null;return db[_0x844a('0x7d')][_0x844a('0x7e')]({'isolationLevel':db[_0x844a('0x7d')]['Transaction'][_0x844a('0x7f')][_0x844a('0x80')]},function(_0x59160d){return db[_0x844a('0x45')][_0x844a('0x6f')]({'where':{'id':_0x2f7cb6},'transaction':_0x59160d})[_0x844a('0x3b')](function(_0xd8247){if(_0xd8247){return db['WhatsappApplication'][_0x844a('0x3a')]({'where':{'WhatsappAccountId':_0x2f7cb6},'transaction':_0x59160d})[_0x844a('0x3b')](function(){var _0x51fffd=_[_0x844a('0x44')](_0x5ef823,function(_0x120542){_0x120542[_0x844a('0x6c')]=_0x2f7cb6;return _0x120542;});return db['WhatsappApplication'][_0x844a('0x81')](_0x51fffd,{'transaction':_0x59160d});});}else{_0x138290=0x194;_0x28669a=[];}});})[_0x844a('0x3b')](function(){if(_0x138290!==0x194){return db['WhatsappApplication'][_0x844a('0x82')]({'where':{'WhatsappAccountId':_0x2f7cb6},'order':_0x844a('0x83')})[_0x844a('0x3b')](function(_0x11ffeb){_0x28669a=_0x11ffeb;});}})[_0x844a('0x5e')](function(_0x14431c){_0x138290=0x1f4;logger[_0x844a('0x27')](_0x14431c['stack']);if(_0x14431c[_0x844a('0x3f')]){delete _0x14431c[_0x844a('0x3f')];}_0x28669a=_0x14431c;})[_0x844a('0x84')](function(){if(_0x28669a===null){_0x1e3ba2[_0x844a('0x2d')](_0x138290);}else{if(_0x138290===0x1f4){_0x1e3ba2[_0x844a('0x2f')](_0x138290)[_0x844a('0x40')](_0x28669a);}else{_0x1e3ba2[_0x844a('0x2f')](_0x138290)[_0x844a('0x30')](_0x28669a);}}});};exports[_0x844a('0x85')]=function(_0x57af2f,_0x38c195,_0x5d45b5){var _0x13d1f3={};var _0x3f8cd9={};var _0x3ac1b1;var _0xa8a751;return db[_0x844a('0x45')][_0x844a('0x6f')]({'where':{'id':_0x57af2f[_0x844a('0x5f')]['id']}})[_0x844a('0x3b')](handleEntityNotFound(_0x38c195,null))[_0x844a('0x3b')](function(_0x412466){if(_0x412466){_0x3ac1b1=_0x412466;_0x3f8cd9[_0x844a('0x4c')]=_[_0x844a('0x60')](db[_0x844a('0x86')][_0x844a('0x46')]);_0x3f8cd9[_0x844a('0x4a')]=_[_0x844a('0x60')](_0x57af2f[_0x844a('0x4a')]);_0x3f8cd9[_0x844a('0x4b')]=_[_0x844a('0x4e')](_0x3f8cd9['model'],_0x3f8cd9[_0x844a('0x4a')]);_0x13d1f3['attributes']=_[_0x844a('0x4e')](_0x3f8cd9[_0x844a('0x4c')],qs['fields'](_0x57af2f[_0x844a('0x4a')][_0x844a('0x4f')]));_0x13d1f3[_0x844a('0x4d')]=_0x13d1f3[_0x844a('0x4d')][_0x844a('0x50')]?_0x13d1f3[_0x844a('0x4d')]:_0x3f8cd9[_0x844a('0x4c')];_0x13d1f3['order']=qs[_0x844a('0x53')](_0x57af2f[_0x844a('0x4a')][_0x844a('0x53')]);_0x13d1f3[_0x844a('0x54')]=qs[_0x844a('0x4b')](_['pick'](_0x57af2f['query'],_0x3f8cd9[_0x844a('0x4b')]));if(_0x57af2f[_0x844a('0x4a')][_0x844a('0x58')]){_0x13d1f3[_0x844a('0x54')]=_[_0x844a('0x56')](_0x13d1f3[_0x844a('0x54')],{'$or':_['map'](_0x13d1f3[_0x844a('0x4d')],function(_0x467de4){var _0x50a83b={};_0x50a83b[_0x467de4]={'$like':'%'+_0x57af2f[_0x844a('0x4a')][_0x844a('0x58')]+'%'};return _0x50a83b;})});}_0x13d1f3=_[_0x844a('0x56')]({},_0x13d1f3,_0x57af2f[_0x844a('0x59')]);return _0x3ac1b1[_0x844a('0x85')](_0x13d1f3);}})[_0x844a('0x3b')](function(_0x56955a){if(_0x56955a){_0xa8a751=_0x56955a['length'];if(!_0x57af2f[_0x844a('0x4a')][_0x844a('0x51')](_0x844a('0x70'))){_0x13d1f3[_0x844a('0x34')]=qs['limit'](_0x57af2f['query']['limit']);_0x13d1f3['offset']=qs[_0x844a('0x31')](_0x57af2f[_0x844a('0x4a')][_0x844a('0x31')]);}return _0x3ac1b1[_0x844a('0x85')](_0x13d1f3);}})[_0x844a('0x3b')](function(_0x2661a0){if(_0x2661a0){return _0x2661a0?{'count':_0xa8a751,'rows':_0x2661a0}:null;}})['then'](respondWithResult(_0x38c195,null))[_0x844a('0x5e')](handleError(_0x38c195,null));};exports[_0x844a('0x87')]=function(_0x39d419,_0x3487b5,_0xa11711){var _0x1f5a20={'channel':_0x844a('0x88')};var _0x477729=[];var _0x35e944=[];var _0x189331={};return db['WhatsappAccount'][_0x844a('0x61')]({'where':{'id':_0x39d419[_0x844a('0x5f')]['id']},'include':[{'model':db[_0x844a('0x86')],'as':_0x844a('0x89')}]})[_0x844a('0x3b')](handleEntityNotFound(_0x3487b5,null))['then'](function(_0x46e085){_0x1f5a20[_0x844a('0x8a')]=_0x46e085;if(_0x1f5a20['account']&&_0x1f5a20[_0x844a('0x8a')][_0x844a('0x48')]===_0x844a('0x8b')&&_0x39d419[_0x844a('0x69')][_0x844a('0x8c')]){if(_0x39d419[_0x844a('0x69')]['statuses'][_0x844a('0x50')]===0x0)return;if(_0x39d419[_0x844a('0x69')][_0x844a('0x8c')][0x0][_0x844a('0x8d')]!==_0x844a('0x8e'))return;return db[_0x844a('0x8f')][_0x844a('0x39')]({'read':!![],'readAt':_0x39d419[_0x844a('0x69')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x39d419['body'][_0x844a('0x8c')][0x0][_0x844a('0x90')]},'individualHooks':!![]})['then'](function(_0x4bbaa2){return _0x3487b5[_0x844a('0x2f')](0xc8)[_0x844a('0x30')](_0x4bbaa2);});}_0x1f5a20[_0x844a('0x91')]=_[_0x844a('0x92')](_0x46e085[_0x844a('0x89')],[_0x844a('0x83')],[_0x844a('0x93')]);if(_0x1f5a20['account'][_0x844a('0x89')]){delete _0x1f5a20[_0x844a('0x8a')][_0x844a('0x89')];}return db[_0x844a('0x94')][_0x844a('0x6a')]()[_0x844a('0x3b')](function(_0x44265c){if(!_0x44265c){throw new db['Sequelize']['ValidationError'](_0x844a('0x95'));}_0x477729=_['difference'](_['keys'](_0x44265c),['createdAt',_0x844a('0x96')]);_0x35e944=_['difference'](_[_0x844a('0x60')](_0x44265c),[_0x844a('0x97'),_0x844a('0x96'),_0x844a('0x98'),'ListId']);_0x1f5a20['body']={'mapKey':'mobile'};if(_0x1f5a20[_0x844a('0x8a')]&&_0x1f5a20['account'][_0x844a('0x48')]===_0x844a('0x99')){_0x1f5a20[_0x844a('0x69')]['from']=_0x39d419[_0x844a('0x69')][_0x844a('0x9a')][_0x844a('0x9b')](_0x844a('0x9c'),'');_0x1f5a20[_0x844a('0x69')][_0x844a('0x69')]=_0x39d419[_0x844a('0x69')][_0x844a('0x9d')];_0x1f5a20[_0x844a('0x69')][_0x844a('0x9e')]=_0x39d419['body']['MessageSid'];}if(_0x1f5a20['account']&&_0x1f5a20['account']['type']===_0x844a('0x8b')){_0x1f5a20['body'][_0x844a('0x9f')]=_0x39d419[_0x844a('0x69')][_0x844a('0xa0')][0x0][_0x844a('0x9f')];_0x1f5a20['body']['body']=_0x39d419[_0x844a('0x69')][_0x844a('0xa0')][0x0]['message']['body'];_0x1f5a20[_0x844a('0x69')][_0x844a('0x9e')]=_0x39d419['body']['notifications'][0x0][_0x844a('0x90')];}if(_0x1f5a20[_0x844a('0x69')]['id']){delete _0x1f5a20['body']['id'];}if(_[_0x844a('0xa1')](_0x1f5a20['body'][_0x844a('0x9f')])){throw new db[(_0x844a('0xa2'))][(_0x844a('0xa3'))](_0x844a('0xa4'));}if(_['isNil'](_0x1f5a20[_0x844a('0x69')][_0x844a('0x69')])||_0x1f5a20['body'][_0x844a('0x69')]===''){throw new db[(_0x844a('0xa2'))]['ValidationError'](_0x844a('0xa5'));}if(_[_0x844a('0xa1')](_0x1f5a20['body'][_0x844a('0xa6')])){throw new db[(_0x844a('0xa2'))][(_0x844a('0xa3'))](_0x844a('0xa7')+_0x35e944);}if(!_[_0x844a('0xa8')](_0x35e944,_0x1f5a20[_0x844a('0x69')]['mapKey'])){throw new db[(_0x844a('0xa2'))][(_0x844a('0xa3'))](_0x844a('0xa9')+_0x35e944);}_0x189331[_0x1f5a20['body'][_0x844a('0xa6')]]=_0x1f5a20[_0x844a('0x69')]['from'];return db[_0x844a('0xaa')][_0x844a('0x61')]({'where':{'id':_0x1f5a20[_0x844a('0x8a')][_0x844a('0xab')]},'include':[{'model':db[_0x844a('0x94')],'as':_0x844a('0xac'),'where':_0x189331,'limit':0x1,'order':[[_0x844a('0x96'),_0x844a('0xad')]]}]});})[_0x844a('0x3b')](handleEntityNotFound(_0x3487b5,null))[_0x844a('0x3b')](function(_0xbbb313){if(_0xbbb313){_0x1f5a20[_0x844a('0xae')]=_['omit'](_0xbbb313,[_0x844a('0xac')]);if(_0xbbb313[_0x844a('0xac')]['length']){return _0xbbb313[_0x844a('0xac')][0x0];}var _0x30d50f=_[_0x844a('0x1b')](_0x1f5a20['body'],{'firstName':_0x1f5a20[_0x844a('0x69')]['from'],'ListId':_0xbbb313['id']});_0x30d50f[_0x1f5a20[_0x844a('0x69')]['mapKey']]=_0x1f5a20['body']['from'];return db[_0x844a('0x94')][_0x844a('0x62')](_0x30d50f,{'fields':_0x477729,'raw':!![]});}})[_0x844a('0x3b')](handleEntityNotFound(_0x3487b5,null))[_0x844a('0x3b')](function(_0x4a9f79){if(_0x4a9f79){_0x1f5a20[_0x844a('0xaf')]=_0x4a9f79;var _0x10b6a0={'ContactId':_0x4a9f79['id'],'phone':_0x1f5a20['body'][_0x844a('0x9f')],'WhatsappAccountId':_0x39d419['params']['id']};var _0x6f2a55={'ContactId':_0x4a9f79['id'],'WhatsappAccountId':_0x39d419[_0x844a('0x5f')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x844a('0x61')]({'where':_0x6f2a55})[_0x844a('0x3b')](function(_0x9d0c02){if(_0x9d0c02){return[_0x9d0c02,![]];}return db[_0x844a('0xb0')][_0x844a('0x62')](_0x10b6a0)[_0x844a('0x3b')](function(_0x4fd4fe){return[_0x4fd4fe,!![]];});});}})['spread'](function(_0x3a899b,_0x279505){_0x1f5a20['interaction']=_0x3a899b[_0x844a('0x3c')]({'plain':!![]});_0x1f5a20['interaction'][_0x844a('0xb1')]=![];if(_0x279505){if(_0x1f5a20[_0x844a('0x8a')][_0x844a('0xb2')]){_0x1f5a20['applications'][_0x844a('0xb3')]({'id':0x0,'priority':_0x1f5a20['applications'][_0x844a('0x50')]+0x1,'app':_0x844a('0xb4'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1f5a20[_0x844a('0xb5')][_0x844a('0xb1')]=!![];}return db[_0x844a('0x8f')]['create']({'phone':_0x1f5a20['body'][_0x844a('0x9f')],'messageId':_0x1f5a20['body'][_0x844a('0x9e')],'body':_0x1f5a20['body']['body'],'WhatsappAccountId':_0x39d419['params']['id'],'WhatsappInteractionId':_0x3a899b['id'],'direction':'in','ContactId':_0x3a899b[_0x844a('0xb6')],'AttachmentId':_0x1f5a20[_0x844a('0x69')][_0x844a('0xb7')]});})[_0x844a('0x3b')](function(_0x16ff97){_0x1f5a20[_0x844a('0x2a')]=_0x16ff97;if(!_0x1f5a20[_0x844a('0xb5')]['UserId'])return;return db[_0x844a('0xb8')][_0x844a('0x61')]({'attributes':['id','name'],'where':{'id':_0x1f5a20[_0x844a('0xb5')][_0x844a('0xb9')]}});})[_0x844a('0x3b')](function(_0x115e4b){if(_0x115e4b){_0x1f5a20['applications'][_0x844a('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x115e4b[_0x844a('0x3f')]+','+(_0x1f5a20[_0x844a('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0x844a('0xbb')});}if(!_0x1f5a20[_0x844a('0xb5')]['queueId'])return;return db[_0x844a('0xbc')]['find']({'attributes':['id',_0x844a('0x3f')],'where':{'id':_0x1f5a20[_0x844a('0xb5')]['queueId']}});})[_0x844a('0x3b')](function(_0x242a10){if(_0x242a10){_0x1f5a20[_0x844a('0x91')][_0x844a('0xba')]({'id':0x0,'priority':0x1,'app':_0x844a('0xbd'),'appdata':_0x242a10[_0x844a('0x3f')]+','+(_0x1f5a20[_0x844a('0x8a')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x844a('0xbe'),_0x844a('0xbf'),_0x1f5a20);})[_0x844a('0x3b')](function(_0x5ccfd0){if(_0x5ccfd0){var _0x18d9b2=0xc8;var _0x528bc8=_0x844a('0xc0');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x528bc8,_0x18d9b2,_0x844a('0xc1'));logger['debug'](_0x844a('0xc2'),_0x528bc8,_0x18d9b2,'entity\x20found',JSON[_0x844a('0x26')](_0x5ccfd0));if(_0x1f5a20[_0x844a('0x8a')][_0x844a('0x48')]==='twilio'){return _0x3487b5[_0x844a('0x2f')](_0x18d9b2)[_0x844a('0x35')]('Content-Type','text/xml')[_0x844a('0x40')]('\x0a');}else{return _0x3487b5[_0x844a('0x2f')](_0x18d9b2)['json'](_0x5ccfd0);}}});})[_0x844a('0x5e')](handleError(_0x3487b5,null));};exports[_0x844a('0x40')]=function(_0x3add08,_0x33420b,_0x1ef5b3){var _0x302f86,_0x4a837a,_0x19802c;if(_['isNil'](_0x3add08['body'][_0x844a('0x69')])||_0x3add08[_0x844a('0x69')]['body']===''){throw new db[(_0x844a('0xa2'))][(_0x844a('0xa3'))](_0x844a('0xa5'));}if(_[_0x844a('0xa1')](_0x3add08['body']['to'])){throw new db['Sequelize']['ValidationError'](_0x844a('0xc3'));}_0x302f86=_0x3add08[_0x844a('0x69')]['to'];return db[_0x844a('0x45')]['find']({'where':{'id':_0x3add08['params']['id']},'include':[{'model':db[_0x844a('0xaa')],'as':_0x844a('0xc4'),'include':[{'model':db[_0x844a('0x94')],'as':'Contacts','where':{'mobile':_0x302f86},'limit':0x1,'order':[[_0x844a('0x96'),_0x844a('0xad')]]}]}]})[_0x844a('0x3b')](handleEntityNotFound(_0x33420b,null))['then'](function(_0x31b04d){if(_0x31b04d&&_0x31b04d[_0x844a('0xc4')]){_0x4a837a=_0x31b04d[_0x844a('0x3c')]({'plain':!![]});if(_0x4a837a['List']&&_0x4a837a[_0x844a('0xc4')][_0x844a('0xac')][_0x844a('0x50')]){return _0x4a837a[_0x844a('0xc4')][_0x844a('0xac')][0x0];}return db[_0x844a('0x94')][_0x844a('0x62')](_[_0x844a('0x1b')](_0x3add08['body'],{'firstName':_0x302f86,'mobile':_0x302f86,'phone':_0x302f86,'ListId':_0x4a837a['ListId']}));}})['then'](handleEntityNotFound(_0x33420b,null))[_0x844a('0x3b')](function(_0x1c79e3){if(_0x1c79e3){_0x19802c=_0x1c79e3;return db[_0x844a('0xb0')]['find']({'where':{'ContactId':_0x19802c['id'],'closed':![],'WhatsappAccountId':_0x4a837a['id']}})[_0x844a('0x3b')](function(_0x20f4ac){if(_0x20f4ac){return[_0x20f4ac,![]];}return db[_0x844a('0xb0')][_0x844a('0x62')]({'UserId':_0x3add08[_0x844a('0x65')]['id'],'ContactId':_0x19802c['id'],'WhatsappAccountId':_0x4a837a['id'],'phone':_0x302f86,'firstMsgDirection':_0x844a('0xc5'),'Messages':[_[_0x844a('0x56')](_0x3add08[_0x844a('0x69')],{'read':![],'body':_0x3add08[_0x844a('0x69')]['body'],'phone':_0x302f86,'WhatsappAccountId':_0x4a837a['id'],'UserId':_0x3add08[_0x844a('0x65')]['id'],'ContactId':_0x19802c['id']})]},{'include':[{'model':db[_0x844a('0x8f')],'as':_0x844a('0xc6')}]})['then'](function(_0x15fcdb){return[_0x15fcdb,!![]];});});}})[_0x844a('0xc7')](function(_0x3d9baa,_0x730723){if(_0x730723){return _0x3d9baa;}return db[_0x844a('0x8f')][_0x844a('0x62')](_['merge'](_0x3add08[_0x844a('0x69')],{'read':![],'body':_0x3add08[_0x844a('0x69')][_0x844a('0x69')],'phone':_0x302f86,'WhatsappAccountId':_0x4a837a['id'],'WhatsappInteractionId':_0x3d9baa['id'],'UserId':_0x3add08[_0x844a('0x65')]['id'],'ContactId':_0x19802c['id']}))[_0x844a('0x3b')](function(_0x145283){_0x3d9baa[_0x844a('0xc8')][_0x844a('0xc6')]=[];_0x3d9baa['dataValues'][_0x844a('0xc6')][_0x844a('0xb3')](_0x145283[_0x844a('0xc8')]);return _0x3d9baa;});})[_0x844a('0x3b')](respondWithResult(_0x33420b,null))['catch'](handleError(_0x33420b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7ada849..1ce25d6 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 _0x9848=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9848,0x140));var _0x8984=function(_0x404ee7,_0x43837d){_0x404ee7=_0x404ee7-0x0;var _0x200ca6=_0x9848[_0x404ee7];return _0x200ca6;};'use strict';var EventEmitter=require(_0x8984('0x0'));var WhatsappAccount=require(_0x8984('0x1'))['db'][_0x8984('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8984('0x3')](0x0);var events={'afterCreate':_0x8984('0x4'),'afterUpdate':_0x8984('0x5'),'afterDestroy':_0x8984('0x6')};function emitEvent(_0x592faf){return function(_0x150d05,_0x2a8c9f,_0x53830a){WhatsappAccountEvents[_0x8984('0x7')](_0x592faf+':'+_0x150d05['id'],_0x150d05);WhatsappAccountEvents['emit'](_0x592faf,_0x150d05);_0x53830a(null);};}for(var e in events){if(events[_0x8984('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x8984('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xaf07=['events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x2effd0,_0x1bacad){var _0x4ea8d4=function(_0x5f2f78){while(--_0x5f2f78){_0x2effd0['push'](_0x2effd0['shift']());}};_0x4ea8d4(++_0x1bacad);}(_0xaf07,0xd0));var _0x7af0=function(_0x21fd66,_0x1fde86){_0x21fd66=_0x21fd66-0x0;var _0x39e3fc=_0xaf07[_0x21fd66];return _0x39e3fc;};'use strict';var EventEmitter=require(_0x7af0('0x0'));var WhatsappAccount=require(_0x7af0('0x1'))['db'][_0x7af0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7af0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7af0('0x4')};function emitEvent(_0x9685a3){return function(_0x2497d9,_0x49d628,_0x501ade){WhatsappAccountEvents[_0x7af0('0x5')](_0x9685a3+':'+_0x2497d9['id'],_0x2497d9);WhatsappAccountEvents[_0x7af0('0x5')](_0x9685a3,_0x2497d9);_0x501ade(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7af0('0x6')](e,emitEvent(event));}}module[_0x7af0('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d55ba36..4063d25 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 _0xf5f4=['../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xf5f4,0xf3));var _0x4f5f=function(_0x369725,_0x1b324d){_0x369725=_0x369725-0x0;var _0x33323a=_0xf5f4[_0x369725];return _0x33323a;};'use strict';var _=require(_0x4f5f('0x0'));var util=require(_0x4f5f('0x1'));var logger=require(_0x4f5f('0x2'))(_0x4f5f('0x3'));var moment=require(_0x4f5f('0x4'));var BPromise=require(_0x4f5f('0x5'));var rp=require(_0x4f5f('0x6'));var fs=require('fs');var path=require(_0x4f5f('0x7'));var rimraf=require(_0x4f5f('0x8'));var config=require(_0x4f5f('0x9'));var attributes=require(_0x4f5f('0xa'));module[_0x4f5f('0xb')]=function(_0x5d635a,_0x57f6a7){return _0x5d635a['define'](_0x4f5f('0xc'),attributes,{'tableName':_0x4f5f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8baf=['request-promise','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird'];(function(_0xb722ca,_0x1db27f){var _0x32c607=function(_0x4f34aa){while(--_0x4f34aa){_0xb722ca['push'](_0xb722ca['shift']());}};_0x32c607(++_0x1db27f);}(_0x8baf,0xab));var _0xf8ba=function(_0x244fbf,_0x1a4f78){_0x244fbf=_0x244fbf-0x0;var _0x1fffa1=_0x8baf[_0x244fbf];return _0x1fffa1;};'use strict';var _=require(_0xf8ba('0x0'));var util=require(_0xf8ba('0x1'));var logger=require('../../config/logger')(_0xf8ba('0x2'));var moment=require(_0xf8ba('0x3'));var BPromise=require(_0xf8ba('0x4'));var rp=require(_0xf8ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8ba('0x6'));module[_0xf8ba('0x7')]=function(_0xe0ceb6,_0x3d22eb){return _0xe0ceb6[_0xf8ba('0x8')](_0xf8ba('0x9'),attributes,{'tableName':_0xf8ba('0xa'),'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 27fd908..be40bf0 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 _0xaf90=['message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','request','info','debug','request\x20sent','stringify','error','code'];(function(_0x475eff,_0x8dcb5d){var _0x63a0df=function(_0x23c250){while(--_0x23c250){_0x475eff['push'](_0x475eff['shift']());}};_0x63a0df(++_0x8dcb5d);}(_0xaf90,0x93));var _0x0af9=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xaf90[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0af9('0x0'));var util=require(_0x0af9('0x1'));var moment=require(_0x0af9('0x2'));var BPromise=require(_0x0af9('0x3'));var rs=require(_0x0af9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0af9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0af9('0x6'));var client=jayson['client'][_0x0af9('0x7')]({'port':0x232a});config[_0x0af9('0x8')]=_[_0x0af9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0af9('0xa'))(new Redis(config[_0x0af9('0x8')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2917cd,_0x1b4ecb,_0x5ec6c3){return new BPromise(function(_0x3a8092,_0x1fe44a){return client[_0x0af9('0xb')](_0x2917cd,_0x5ec6c3)['then'](function(_0x150215){logger[_0x0af9('0xc')]('WhatsappAccount,\x20%s,\x20%s',_0x1b4ecb,'request\x20sent');logger[_0x0af9('0xd')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1b4ecb,_0x0af9('0xe'),JSON[_0x0af9('0xf')](_0x150215));if(_0x150215[_0x0af9('0x10')]){if(_0x150215[_0x0af9('0x10')][_0x0af9('0x11')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1b4ecb,_0x150215['error'][_0x0af9('0x12')]);return _0x1fe44a(_0x150215['error'][_0x0af9('0x12')]);}logger[_0x0af9('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x1b4ecb,_0x150215[_0x0af9('0x10')][_0x0af9('0x12')]);return _0x3a8092(_0x150215[_0x0af9('0x10')][_0x0af9('0x12')]);}else{logger[_0x0af9('0xc')](_0x0af9('0x13'),_0x1b4ecb,'request\x20sent');_0x3a8092(_0x150215[_0x0af9('0x14')][_0x0af9('0x12')]);}})[_0x0af9('0x15')](function(_0x5a1d43){logger[_0x0af9('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x1b4ecb,_0x5a1d43);_0x1fe44a(_0x5a1d43);});});}exports[_0x0af9('0x16')]=function(_0x583ffa){var _0x5e9a1f=this;return new Promise(function(_0x535eb8,_0xe77716){return db[_0x0af9('0x17')][_0x0af9('0x18')]({'raw':_0x583ffa['options']?_0x583ffa[_0x0af9('0x19')][_0x0af9('0x1a')]===undefined?!![]:![]:!![],'where':_0x583ffa[_0x0af9('0x19')]?_0x583ffa[_0x0af9('0x19')][_0x0af9('0x1b')]||null:null,'attributes':_0x583ffa[_0x0af9('0x19')]?_0x583ffa[_0x0af9('0x19')][_0x0af9('0x1c')]||null:null,'include':_0x583ffa[_0x0af9('0x19')]?_0x583ffa['options'][_0x0af9('0x1d')]?_[_0x0af9('0x1e')](_0x583ffa[_0x0af9('0x19')][_0x0af9('0x1d')],function(_0x931103){return{'model':db[_0x931103[_0x0af9('0x1f')]],'as':_0x931103['as'],'attributes':_0x931103[_0x0af9('0x1c')],'include':_0x931103[_0x0af9('0x1d')]?_[_0x0af9('0x1e')](_0x931103[_0x0af9('0x1d')],function(_0x3d7e8c){return{'model':db[_0x3d7e8c[_0x0af9('0x1f')]],'as':_0x3d7e8c['as'],'attributes':_0x3d7e8c['attributes'],'include':_0x3d7e8c[_0x0af9('0x1d')]?_['map'](_0x3d7e8c['include'],function(_0x32ffcc){return{'model':db[_0x32ffcc[_0x0af9('0x1f')]],'as':_0x32ffcc['as'],'attributes':_0x32ffcc[_0x0af9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0af9('0x20')](function(_0x5baa84){logger[_0x0af9('0xc')](_0x0af9('0x16'),_0x583ffa);logger[_0x0af9('0xd')](_0x0af9('0x16'),_0x583ffa,JSON[_0x0af9('0xf')](_0x5baa84));_0x535eb8(_0x5baa84);})['catch'](function(_0x22f688){logger[_0x0af9('0x10')]('ShowWhatsappAccount',_0x22f688['message'],_0x583ffa);_0xe77716(_0x5e9a1f[_0x0af9('0x10')](0x1f4,_0x22f688[_0x0af9('0x12')]));});});}; \ No newline at end of file +var _0x0a5f=['rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','debug','request\x20sent','stringify','code','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','options','raw','attributes','include','map','model','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x44881e,_0x2d2bd3){var _0x110f15=function(_0x3490a0){while(--_0x3490a0){_0x44881e['push'](_0x44881e['shift']());}};_0x110f15(++_0x2d2bd3);}(_0x0a5f,0x192));var _0xf0a5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0a5f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf0a5('0x0'));var util=require(_0xf0a5('0x1'));var moment=require(_0xf0a5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0a5('0x4'));var logger=require(_0xf0a5('0x5'))(_0xf0a5('0x6'));var config=require('../../config/environment');var jayson=require(_0xf0a5('0x7'));var client=jayson[_0xf0a5('0x8')][_0xf0a5('0x9')]({'port':0x232a});config['redis']=_[_0xf0a5('0xa')](config[_0xf0a5('0xb')],{'host':_0xf0a5('0xc'),'port':0x18eb});var socket=require(_0xf0a5('0xd'))(new Redis(config[_0xf0a5('0xb')]));require(_0xf0a5('0xe'))[_0xf0a5('0xf')](socket);function respondWithRpcPromise(_0xadbd86,_0x22238,_0x21e037){return new BPromise(function(_0x2ab86e,_0x5c0c70){return client['request'](_0xadbd86,_0x21e037)[_0xf0a5('0x10')](function(_0x14b2dc){logger[_0xf0a5('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x22238,'request\x20sent');logger[_0xf0a5('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x22238,_0xf0a5('0x13'),JSON[_0xf0a5('0x14')](_0x14b2dc));if(_0x14b2dc['error']){if(_0x14b2dc['error'][_0xf0a5('0x15')]===0x1f4){logger[_0xf0a5('0x16')](_0xf0a5('0x17'),_0x22238,_0x14b2dc[_0xf0a5('0x16')]['message']);return _0x5c0c70(_0x14b2dc[_0xf0a5('0x16')][_0xf0a5('0x18')]);}logger[_0xf0a5('0x16')](_0xf0a5('0x17'),_0x22238,_0x14b2dc[_0xf0a5('0x16')][_0xf0a5('0x18')]);return _0x2ab86e(_0x14b2dc[_0xf0a5('0x16')][_0xf0a5('0x18')]);}else{logger[_0xf0a5('0x11')](_0xf0a5('0x17'),_0x22238,_0xf0a5('0x13'));_0x2ab86e(_0x14b2dc[_0xf0a5('0x19')]['message']);}})[_0xf0a5('0x1a')](function(_0x16c654){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x22238,_0x16c654);_0x5c0c70(_0x16c654);});});}exports[_0xf0a5('0x1b')]=function(_0x4a7c0b){var _0x3abfd8=this;return new Promise(function(_0x321484,_0x23b64a){return db['WhatsappAccount']['find']({'raw':_0x4a7c0b['options']?_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a7c0b[_0xf0a5('0x1c')]?_0x4a7c0b['options']['where']||null:null,'attributes':_0x4a7c0b[_0xf0a5('0x1c')]?_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1e')]||null:null,'include':_0x4a7c0b[_0xf0a5('0x1c')]?_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1f')]?_[_0xf0a5('0x20')](_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1f')],function(_0x32901e){return{'model':db[_0x32901e[_0xf0a5('0x21')]],'as':_0x32901e['as'],'attributes':_0x32901e['attributes'],'include':_0x32901e['include']?_[_0xf0a5('0x20')](_0x32901e[_0xf0a5('0x1f')],function(_0x2924bb){return{'model':db[_0x2924bb[_0xf0a5('0x21')]],'as':_0x2924bb['as'],'attributes':_0x2924bb['attributes'],'include':_0x2924bb['include']?_[_0xf0a5('0x20')](_0x2924bb[_0xf0a5('0x1f')],function(_0x10a156){return{'model':db[_0x10a156[_0xf0a5('0x21')]],'as':_0x10a156['as'],'attributes':_0x10a156[_0xf0a5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0a5('0x10')](function(_0x361ab2){logger[_0xf0a5('0x11')]('ShowWhatsappAccount',_0x4a7c0b);logger[_0xf0a5('0x12')](_0xf0a5('0x1b'),_0x4a7c0b,JSON[_0xf0a5('0x14')](_0x361ab2));_0x321484(_0x361ab2);})[_0xf0a5('0x1a')](function(_0x1f8360){logger[_0xf0a5('0x16')]('ShowWhatsappAccount',_0x1f8360[_0xf0a5('0x18')],_0x4a7c0b);_0x23b64a(_0x3abfd8[_0xf0a5('0x16')](0x1f4,_0x1f8360[_0xf0a5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c5947e5..40cbe02 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 _0xab7b=['register','./whatsappAccount.events','save','remove','update','emit'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0xab7b,0xeb));var _0xbab7=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0xab7b[_0x41b29e];return _0xacd517;};'use strict';var WhatsappAccountEvents=require(_0xbab7('0x0'));var events=[_0xbab7('0x1'),_0xbab7('0x2'),_0xbab7('0x3')];function createListener(_0x3878a2,_0x443a3d){return function(_0x2c8858){_0x443a3d[_0xbab7('0x4')](_0x3878a2,_0x2c8858);};}function removeListener(_0x3bdb6f,_0x26318a){return function(){WhatsappAccountEvents['removeListener'](_0x3bdb6f,_0x26318a);};}exports[_0xbab7('0x5')]=function(_0x496ecc){for(var _0x1eccbb=0x0,_0x52e466=events['length'];_0x1eccbb<_0x52e466;_0x1eccbb++){var _0x4d9a44=events[_0x1eccbb];var _0x2831b0=createListener('whatsappAccount:'+_0x4d9a44,_0x496ecc);WhatsappAccountEvents['on'](_0x4d9a44,_0x2831b0);}}; \ No newline at end of file +var _0xe196=['save','remove','update','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x35e1fa,_0x3fe8b4){var _0x48ab21=function(_0x3855a2){while(--_0x3855a2){_0x35e1fa['push'](_0x35e1fa['shift']());}};_0x48ab21(++_0x3fe8b4);}(_0xe196,0x87));var _0x6e19=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe196[_0xa464c9];return _0x3d73c4;};'use strict';var WhatsappAccountEvents=require(_0x6e19('0x0'));var events=[_0x6e19('0x1'),_0x6e19('0x2'),_0x6e19('0x3')];function createListener(_0x58bd90,_0x183516){return function(_0xd4a902){_0x183516['emit'](_0x58bd90,_0xd4a902);};}function removeListener(_0x52737c,_0x5dc550){return function(){WhatsappAccountEvents[_0x6e19('0x4')](_0x52737c,_0x5dc550);};}exports[_0x6e19('0x5')]=function(_0x3caf0c){for(var _0x1750ad=0x0,_0x50d94b=events[_0x6e19('0x6')];_0x1750ad<_0x50d94b;_0x1750ad++){var _0xa413de=events[_0x1750ad];var _0x4bd5a2=createListener(_0x6e19('0x7')+_0xa413de,_0x3caf0c);WhatsappAccountEvents['on'](_0xa413de,_0x4bd5a2);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 2a0e717..b14804e 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 _0x2d8f=['index','/:id','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x4188ee,_0x27c7a8){var _0x1ee63a=function(_0xc1fecf){while(--_0xc1fecf){_0x4188ee['push'](_0x4188ee['shift']());}};_0x1ee63a(++_0x27c7a8);}(_0x2d8f,0x126));var _0xf2d8=function(_0x44fb02,_0x16bdbc){_0x44fb02=_0x44fb02-0x0;var _0x4d3aaa=_0x2d8f[_0x44fb02];return _0x4d3aaa;};'use strict';var multer=require(_0xf2d8('0x0'));var util=require(_0xf2d8('0x1'));var path=require(_0xf2d8('0x2'));var timeout=require(_0xf2d8('0x3'));var express=require(_0xf2d8('0x4'));var router=express['Router']();var fs_extra=require(_0xf2d8('0x5'));var auth=require(_0xf2d8('0x6'));var interaction=require(_0xf2d8('0x7'));var config=require(_0xf2d8('0x8'));var controller=require(_0xf2d8('0x9'));router[_0xf2d8('0xa')]('/',auth[_0xf2d8('0xb')](),controller[_0xf2d8('0xc')]);router[_0xf2d8('0xa')](_0xf2d8('0xd'),auth[_0xf2d8('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf2d8('0xe')](_0xf2d8('0xd'),auth['isAuthenticated'](),controller[_0xf2d8('0xf')]);router['delete'](_0xf2d8('0xd'),auth[_0xf2d8('0xb')](),controller[_0xf2d8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x151d=['delete','destroy','util','connect-timeout','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x151d,0x1f0));var _0xd151=function(_0xf8941c,_0x41b4c5){_0xf8941c=_0xf8941c-0x0;var _0x16a279=_0x151d[_0xf8941c];return _0x16a279;};'use strict';var multer=require('multer');var util=require(_0xd151('0x0'));var path=require('path');var timeout=require(_0xd151('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd151('0x2'));var controller=require('./whatsappApplication.controller');router[_0xd151('0x3')]('/',auth[_0xd151('0x4')](),controller['index']);router['get'](_0xd151('0x5'),auth['isAuthenticated'](),controller[_0xd151('0x6')]);router[_0xd151('0x7')]('/',auth[_0xd151('0x4')](),controller[_0xd151('0x8')]);router[_0xd151('0x9')]('/:id',auth[_0xd151('0x4')](),controller[_0xd151('0xa')]);router[_0xd151('0xb')](_0xd151('0x5'),auth[_0xd151('0x4')](),controller[_0xd151('0xc')]);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 b14e372..31dbff6 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 _0x6ca8=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x156f23,_0x48a789){var _0x1e7cd8=function(_0x446949){while(--_0x446949){_0x156f23['push'](_0x156f23['shift']());}};_0x1e7cd8(++_0x48a789);}(_0x6ca8,0x1a9));var _0x86ca=function(_0x5a89cb,_0x344813){_0x5a89cb=_0x5a89cb-0x0;var _0x34d9ef=_0x6ca8[_0x5a89cb];return _0x34d9ef;};'use strict';var Sequelize=require('sequelize');module[_0x86ca('0x0')]={'priority':{'type':Sequelize[_0x86ca('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x86ca('0x2')],'allowNull':![],'defaultValue':_0x86ca('0x3')},'appdata':{'type':Sequelize[_0x86ca('0x4')]()},'description':{'type':Sequelize[_0x86ca('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x86ca('0x5')}}; \ No newline at end of file +var _0x02ee=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x02ee,0x1ea));var _0xe02e=function(_0x36bb66,_0xa139de){_0x36bb66=_0x36bb66-0x0;var _0x534f59=_0x02ee[_0x36bb66];return _0x534f59;};'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/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 12b5cb1..c250c36 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','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','WhatsappApplication','fieldName','type','key'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xadb5,0xad));var _0x5adb=function(_0x2d41fc,_0x3bfa4f){_0x2d41fc=_0x2d41fc-0x0;var _0x4042cb=_0xadb5[_0x2d41fc];return _0x4042cb;};'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['WhatsappApplication']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['WhatsappApplication'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['WhatsappApplication'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0x2581=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x43b468,_0xfcc5f){var _0x4fab0a=function(_0x522e5b){while(--_0x522e5b){_0x43b468['push'](_0x43b468['shift']());}};_0x4fab0a(++_0xfcc5f);}(_0x2581,0xcb));var _0x1258=function(_0x148321,_0x1609db){_0x148321=_0x148321-0x0;var _0x9c64dd=_0x2581[_0x148321];return _0x9c64dd;};'use strict';var emlformat=require(_0x1258('0x0'));var rimraf=require(_0x1258('0x1'));var zipdir=require(_0x1258('0x2'));var jsonpatch=require(_0x1258('0x3'));var rp=require(_0x1258('0x4'));var moment=require('moment');var BPromise=require(_0x1258('0x5'));var Mustache=require(_0x1258('0x6'));var util=require(_0x1258('0x7'));var path=require(_0x1258('0x8'));var sox=require(_0x1258('0x9'));var csv=require(_0x1258('0xa'));var ejs=require(_0x1258('0xb'));var fs=require('fs');var fs_extra=require(_0x1258('0xc'));var _=require('lodash');var squel=require(_0x1258('0xd'));var crypto=require(_0x1258('0xe'));var jsforce=require(_0x1258('0xf'));var deskjs=require(_0x1258('0x10'));var toCsv=require(_0x1258('0xa'));var querystring=require(_0x1258('0x11'));var Papa=require(_0x1258('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1258('0x13'));var as=require(_0x1258('0x14'));var hardwareService=require(_0x1258('0x15'));var logger=require(_0x1258('0x16'))('api');var utils=require(_0x1258('0x17'));var config=require(_0x1258('0x18'));var licenseUtil=require(_0x1258('0x19'));var db=require(_0x1258('0x1a'))['db'];function respondWithStatusCode(_0x57ad9f,_0xc6993e){_0xc6993e=_0xc6993e||0xcc;return function(_0x3429d8){if(_0x3429d8){return _0x57ad9f[_0x1258('0x1b')](_0xc6993e);}return _0x57ad9f[_0x1258('0x1c')](_0xc6993e)[_0x1258('0x1d')]();};}function respondWithResult(_0x365038,_0x149ee6){_0x149ee6=_0x149ee6||0xc8;return function(_0x562286){if(_0x562286){return _0x365038[_0x1258('0x1c')](_0x149ee6)['json'](_0x562286);}};}function respondWithFilteredResult(_0x477502,_0x19775e){return function(_0x3e662d){if(_0x3e662d){var _0x26e676=typeof _0x19775e[_0x1258('0x1e')]==='undefined'&&typeof _0x19775e[_0x1258('0x1f')]===_0x1258('0x20');var _0x38d6e9=_0x3e662d['count'];var _0x97c02e=_0x26e676?0x0:_0x19775e[_0x1258('0x1e')];var _0x55c458=_0x26e676?_0x3e662d[_0x1258('0x21')]:_0x19775e[_0x1258('0x1e')]+_0x19775e[_0x1258('0x1f')];var _0xb0b379;if(_0x55c458>=_0x38d6e9){_0x55c458=_0x38d6e9;_0xb0b379=0xc8;}else{_0xb0b379=0xce;}_0x477502[_0x1258('0x1c')](_0xb0b379);return _0x477502[_0x1258('0x22')](_0x1258('0x23'),_0x97c02e+'-'+_0x55c458+'/'+_0x38d6e9)[_0x1258('0x24')](_0x3e662d);}return null;};}function patchUpdates(_0x3dade8){return function(_0x2d397a){try{jsonpatch[_0x1258('0x25')](_0x2d397a,_0x3dade8,!![]);}catch(_0x7ce367){return BPromise[_0x1258('0x26')](_0x7ce367);}return _0x2d397a[_0x1258('0x27')]();};}function saveUpdates(_0x1c6373,_0x54534a){return function(_0x282ef1){if(_0x282ef1){return _0x282ef1['update'](_0x1c6373)['then'](function(_0x4bdf96){return _0x4bdf96;});}return null;};}function removeEntity(_0x2c661a,_0x3e3a57){return function(_0x2a61f2){if(_0x2a61f2){return _0x2a61f2[_0x1258('0x28')]()[_0x1258('0x29')](function(){_0x2c661a[_0x1258('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec562,_0xe30e8d){return function(_0x1cbfd1){if(!_0x1cbfd1){_0x3ec562[_0x1258('0x1b')](0x194);}return _0x1cbfd1;};}function handleError(_0x14a77b,_0x8882fb){_0x8882fb=_0x8882fb||0x1f4;return function(_0x428c21){logger[_0x1258('0x2a')](_0x428c21[_0x1258('0x2b')]);if(_0x428c21[_0x1258('0x2c')]){delete _0x428c21[_0x1258('0x2c')];}_0x14a77b[_0x1258('0x1c')](_0x8882fb)[_0x1258('0x2d')](_0x428c21);};}exports['index']=function(_0x5a6365,_0x18ab7a){var _0x4fa3cf={},_0x152c33={},_0x6cd066={'count':0x0,'rows':[]};var _0x56a2b8=_[_0x1258('0x2e')](db[_0x1258('0x2f')][_0x1258('0x30')],function(_0x5b5743){return{'name':_0x5b5743['fieldName'],'type':_0x5b5743[_0x1258('0x31')][_0x1258('0x32')]};});_0x152c33['model']=_[_0x1258('0x2e')](_0x56a2b8,'name');_0x152c33[_0x1258('0x33')]=_[_0x1258('0x34')](_0x5a6365[_0x1258('0x33')]);_0x152c33[_0x1258('0x35')]=_[_0x1258('0x36')](_0x152c33['model'],_0x152c33['query']);_0x4fa3cf[_0x1258('0x37')]=_[_0x1258('0x36')](_0x152c33[_0x1258('0x38')],qs[_0x1258('0x39')](_0x5a6365[_0x1258('0x33')][_0x1258('0x39')]));_0x4fa3cf['attributes']=_0x4fa3cf['attributes'][_0x1258('0x3a')]?_0x4fa3cf[_0x1258('0x37')]:_0x152c33['model'];if(!_0x5a6365['query']['hasOwnProperty']('nolimit')){_0x4fa3cf[_0x1258('0x1f')]=qs[_0x1258('0x1f')](_0x5a6365[_0x1258('0x33')][_0x1258('0x1f')]);_0x4fa3cf[_0x1258('0x1e')]=qs[_0x1258('0x1e')](_0x5a6365[_0x1258('0x33')][_0x1258('0x1e')]);}_0x4fa3cf[_0x1258('0x3b')]=qs['sort'](_0x5a6365['query'][_0x1258('0x3c')]);_0x4fa3cf['where']=qs[_0x1258('0x35')](_['pick'](_0x5a6365[_0x1258('0x33')],_0x152c33[_0x1258('0x35')]),_0x56a2b8);if(_0x5a6365[_0x1258('0x33')][_0x1258('0x3d')]){_0x4fa3cf[_0x1258('0x3e')]=_[_0x1258('0x3f')](_0x4fa3cf[_0x1258('0x3e')],{'$or':_[_0x1258('0x2e')](_0x56a2b8,function(_0x4c376d){if(_0x4c376d[_0x1258('0x31')]!==_0x1258('0x40')){var _0x3c77e9={};_0x3c77e9[_0x4c376d[_0x1258('0x2c')]]={'$like':'%'+_0x5a6365[_0x1258('0x33')][_0x1258('0x3d')]+'%'};return _0x3c77e9;}})});}_0x4fa3cf=_['merge']({},_0x4fa3cf,_0x5a6365['options']);var _0x3d75fb={'where':_0x4fa3cf[_0x1258('0x3e')]};return db[_0x1258('0x2f')]['count'](_0x3d75fb)[_0x1258('0x29')](function(_0x592232){_0x6cd066['count']=_0x592232;if(_0x5a6365[_0x1258('0x33')][_0x1258('0x41')]){_0x4fa3cf[_0x1258('0x42')]=[{'all':!![]}];}return db[_0x1258('0x2f')][_0x1258('0x43')](_0x4fa3cf);})[_0x1258('0x29')](function(_0x455a18){_0x6cd066[_0x1258('0x44')]=_0x455a18;return _0x6cd066;})[_0x1258('0x29')](respondWithFilteredResult(_0x18ab7a,_0x4fa3cf))[_0x1258('0x45')](handleError(_0x18ab7a,null));};exports[_0x1258('0x46')]=function(_0x105f18,_0x24b415){var _0x365344={'raw':!![],'where':{'id':_0x105f18[_0x1258('0x47')]['id']}},_0x4f21b9={};_0x4f21b9[_0x1258('0x38')]=_[_0x1258('0x34')](db[_0x1258('0x2f')][_0x1258('0x30')]);_0x4f21b9[_0x1258('0x33')]=_[_0x1258('0x34')](_0x105f18['query']);_0x4f21b9[_0x1258('0x35')]=_[_0x1258('0x36')](_0x4f21b9[_0x1258('0x38')],_0x4f21b9[_0x1258('0x33')]);_0x365344[_0x1258('0x37')]=_[_0x1258('0x36')](_0x4f21b9[_0x1258('0x38')],qs[_0x1258('0x39')](_0x105f18[_0x1258('0x33')][_0x1258('0x39')]));_0x365344[_0x1258('0x37')]=_0x365344[_0x1258('0x37')][_0x1258('0x3a')]?_0x365344[_0x1258('0x37')]:_0x4f21b9[_0x1258('0x38')];if(_0x105f18[_0x1258('0x33')][_0x1258('0x41')]){_0x365344[_0x1258('0x42')]=[{'all':!![]}];}_0x365344=_[_0x1258('0x3f')]({},_0x365344,_0x105f18['options']);return db[_0x1258('0x2f')][_0x1258('0x48')](_0x365344)['then'](handleEntityNotFound(_0x24b415,null))['then'](respondWithResult(_0x24b415,null))[_0x1258('0x45')](handleError(_0x24b415,null));};exports[_0x1258('0x49')]=function(_0x2e7eb0,_0x5954b8){return db[_0x1258('0x2f')][_0x1258('0x49')](_0x2e7eb0[_0x1258('0x4a')],{})['then'](respondWithResult(_0x5954b8,0xc9))[_0x1258('0x45')](handleError(_0x5954b8,null));};exports[_0x1258('0x4b')]=function(_0x26eb2d,_0x36838d){if(_0x26eb2d['body']['id']){delete _0x26eb2d['body']['id'];}return db['WhatsappApplication'][_0x1258('0x48')]({'where':{'id':_0x26eb2d[_0x1258('0x47')]['id']}})['then'](handleEntityNotFound(_0x36838d,null))[_0x1258('0x29')](saveUpdates(_0x26eb2d[_0x1258('0x4a')],null))[_0x1258('0x29')](respondWithResult(_0x36838d,null))[_0x1258('0x45')](handleError(_0x36838d,null));};exports['destroy']=function(_0x3d7327,_0x4125e4){return db[_0x1258('0x2f')][_0x1258('0x48')]({'where':{'id':_0x3d7327['params']['id']}})[_0x1258('0x29')](handleEntityNotFound(_0x4125e4,null))[_0x1258('0x29')](removeEntity(_0x4125e4,null))[_0x1258('0x45')](handleError(_0x4125e4,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index df99de5..e410180 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 _0x093a=['api','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x448637,_0x53a5d1){var _0x20ff53=function(_0x4c5c21){while(--_0x4c5c21){_0x448637['push'](_0x448637['shift']());}};_0x20ff53(++_0x53a5d1);}(_0x093a,0x16a));var _0xa093=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x093a[_0x146be0];return _0x1bcc25;};'use strict';var _=require('lodash');var util=require(_0xa093('0x0'));var logger=require(_0xa093('0x1'))(_0xa093('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa093('0x3'));var fs=require('fs');var path=require(_0xa093('0x4'));var rimraf=require(_0xa093('0x5'));var config=require(_0xa093('0x6'));var attributes=require(_0xa093('0x7'));module[_0xa093('0x8')]=function(_0x2346f1,_0x145f58){return _0x2346f1[_0xa093('0x9')](_0xa093('0xa'),attributes,{'tableName':_0xa093('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa093('0xc'),'collate':_0xa093('0xd')});}; \ No newline at end of file +var _0x9b9b=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x8eb9e8,_0x1a255b){var _0x483383=function(_0x500ccd){while(--_0x500ccd){_0x8eb9e8['push'](_0x8eb9e8['shift']());}};_0x483383(++_0x1a255b);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4e0d05,_0x1252ef){_0x4e0d05=_0x4e0d05-0x0;var _0x568b50=_0x9b9b[_0x4e0d05];return _0x568b50;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9b9('0xc'),'collate':_0xb9b9('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9a552d9..9c32302 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2600ae,_0x280958){var _0x2ac8ed=function(_0x4f6f18){while(--_0x4f6f18){_0x2600ae['push'](_0x2600ae['shift']());}};_0x2ac8ed(++_0x280958);}(_0x84ab,0x12f));var _0xb84a=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x84ab[_0x186d17];return _0x5d4b89;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x55de53,_0x5da3e7){var _0x362fbe=function(_0x3ed4fd){while(--_0x3ed4fd){_0x55de53['push'](_0x55de53['shift']());}};_0x362fbe(++_0x5da3e7);}(_0x99e9,0xb4));var _0x999e=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x99e9[_0x1deb03];return _0x189fe7;};'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']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 0dbc787..c1316ac 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 _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x369633,_0x263fb9){var _0x1eda8c=function(_0x3b1b46){while(--_0x3b1b46){_0x369633['push'](_0x369633['shift']());}};_0x1eda8c(++_0x263fb9);}(_0x90b1,0x1bb));var _0x190b=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x90b1[_0x221ba2];return _0x47d08e;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0x8')](_0x190b('0xe'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x8')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller['download']);router[_0x190b('0x11')]('/',auth[_0x190b('0xa')](),controller['create']);router[_0x190b('0x11')](_0x190b('0xe'),auth[_0x190b('0xa')](),controller[_0x190b('0x12')]);router[_0x190b('0x11')](_0x190b('0x13'),auth[_0x190b('0xa')](),interaction[_0x190b('0x14')](_0x190b('0x15'),_0x190b('0x16')),controller[_0x190b('0x17')]);router[_0x190b('0x18')](_0x190b('0xc'),auth[_0x190b('0xa')](),interaction[_0x190b('0x14')](_0x190b('0x15'),_0x190b('0x19')),controller['update']);router[_0x190b('0x1a')]('/:id',auth[_0x190b('0xa')](),interaction[_0x190b('0x14')](_0x190b('0x15'),_0x190b('0x1b')),controller['destroy']);router[_0x190b('0x1a')](_0x190b('0x13'),auth[_0x190b('0xa')](),controller[_0x190b('0x1c')]);module[_0x190b('0x1d')]=router; \ No newline at end of file +var _0xe0ae=['update','delete','destroy','/:id/tags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update'];(function(_0x3f06c7,_0xd58ada){var _0x4aa19f=function(_0xaa7b3){while(--_0xaa7b3){_0x3f06c7['push'](_0x3f06c7['shift']());}};_0x4aa19f(++_0xd58ada);}(_0xe0ae,0xa1));var _0xee0a=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0xe0ae[_0x2c18a8];return _0x1e009a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0x7')](_0xee0a('0xb'),auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0x7')]('/:id/download',auth[_0xee0a('0x9')](),controller['download']);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xd')]('/:id/messages',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router['post']('/:id/tags',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),_0xee0a('0x11')),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x13'),auth[_0xee0a('0x9')](),interaction['tracked'](_0xee0a('0x10'),_0xee0a('0x14')),controller[_0xee0a('0x15')]);router[_0xee0a('0x16')]('/:id',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),'whatsappinteraction:destroy'),controller[_0xee0a('0x17')]);router[_0xee0a('0x16')](_0xee0a('0x18'),auth[_0xee0a('0x9')](),controller['removeTags']);module[_0xee0a('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c7a70e7..793de0f 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 _0xc74c=['out','BOOLEAN','INTEGER','sequelize','moment','DATE','STRING','ENUM'];(function(_0x5c967e,_0x452455){var _0x3cdabc=function(_0x12feae){while(--_0x12feae){_0x5c967e['push'](_0x5c967e['shift']());}};_0x3cdabc(++_0x452455);}(_0xc74c,0x163));var _0xcc74=function(_0xf4987c,_0x29b265){_0xf4987c=_0xf4987c-0x0;var _0x333056=_0xc74c[_0xf4987c];return _0x333056;};'use strict';var Sequelize=require(_0xcc74('0x0'));var moment=require(_0xcc74('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc74('0x2')]},'disposition':{'type':Sequelize[_0xcc74('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcc74('0x3')]},'note':{'type':Sequelize[_0xcc74('0x3')]},'phone':{'type':Sequelize[_0xcc74('0x3')]},'read1stAt':{'type':Sequelize[_0xcc74('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcc74('0x4')]('in',_0xcc74('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcc74('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcc74('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcc74('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xcc74('0x7')]}}; \ No newline at end of file +var _0x72fa=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x57824d,_0x1d67d7){var _0x4613ce=function(_0x1175da){while(--_0x1175da){_0x57824d['push'](_0x57824d['shift']());}};_0x4613ce(++_0x1d67d7);}(_0x72fa,0x78));var _0xa72f=function(_0x5b406e,_0xcd06bc){_0x5b406e=_0x5b406e-0x0;var _0xe7d242=_0x72fa[_0x5b406e];return _0xe7d242;};'use strict';var Sequelize=require(_0xa72f('0x0'));var moment=require(_0xa72f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xa72f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa72f('0x3')]},'disposition':{'type':Sequelize[_0xa72f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa72f('0x4')]},'phone':{'type':Sequelize[_0xa72f('0x4')]},'read1stAt':{'type':Sequelize[_0xa72f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa72f('0x5')]('in',_0xa72f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa72f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa72f('0x5')]('in',_0xa72f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa72f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa72f('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c62fe52..a8cc99b 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 _0x1fdc=['create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','WhatsappInteractionId','filter','merge','$gte','findAll','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','Contact','lastName','Messages','createdAt','direction','secret','read','push','get','mkdirSync','Whatsapp','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Attachment','basename','existsSync','pipe','createWriteStream','firstName','out','value','renderFile','views','transcript-','createPdfFromHTML','log','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','update','then','destroy','error','stack','name','send','map','WhatsappInteraction','fieldName','getOptions','whatsapp','query','user','catch','show','rawAttributes','keys','filters','intersection','model','attributes','fields','length','includeAll','include','options','find'];(function(_0x5f5c59,_0x169b7c){var _0x5a5f48=function(_0x5c6489){while(--_0x5c6489){_0x5f5c59['push'](_0x5f5c59['shift']());}};_0x5a5f48(++_0x169b7c);}(_0x1fdc,0xc4));var _0xc1fd=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x1fdc[_0x2a0350];return _0x425220;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xc1fd('0x0'));var BPromise=require(_0xc1fd('0x1'));var util=require(_0xc1fd('0x2'));var path=require(_0xc1fd('0x3'));var ejs=require(_0xc1fd('0x4'));var fs=require('fs');var _=require(_0xc1fd('0x5'));var Redis=require(_0xc1fd('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xc1fd('0x7'));var pdf=require(_0xc1fd('0x8'));var logger=require(_0xc1fd('0x9'))('api');var config=require('../../config/environment');var db=require(_0xc1fd('0xa'))['db'];config[_0xc1fd('0xb')]=_[_0xc1fd('0xc')](config['redis'],{'host':_0xc1fd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xc1fd('0xe')](socket);function respondWithStatusCode(_0x147630,_0x443c80){_0x443c80=_0x443c80||0xcc;return function(_0x3af187){if(_0x3af187){return _0x147630[_0xc1fd('0xf')](_0x443c80);}return _0x147630[_0xc1fd('0x10')](_0x443c80)[_0xc1fd('0x11')]();};}function respondWithResult(_0x1ca092,_0xcb0f1){_0xcb0f1=_0xcb0f1||0xc8;return function(_0x18aaa2){if(_0x18aaa2){return _0x1ca092[_0xc1fd('0x10')](_0xcb0f1)['json'](_0x18aaa2);}};}function respondWithFilteredResult(_0x55474e,_0x550d3d){return function(_0x2a1311){if(_0x2a1311){var _0x46b4dd=typeof _0x550d3d[_0xc1fd('0x12')]===_0xc1fd('0x13')&&typeof _0x550d3d[_0xc1fd('0x14')]==='undefined';var _0x145b03=_0x2a1311['count'];var _0x2ba8da=_0x46b4dd?0x0:_0x550d3d[_0xc1fd('0x12')];var _0x19ef98=_0x46b4dd?_0x2a1311['count']:_0x550d3d[_0xc1fd('0x12')]+_0x550d3d['limit'];var _0x7f2047;if(_0x19ef98>=_0x145b03){_0x19ef98=_0x145b03;_0x7f2047=0xc8;}else{_0x7f2047=0xce;}_0x55474e[_0xc1fd('0x10')](_0x7f2047);return _0x55474e[_0xc1fd('0x15')](_0xc1fd('0x16'),_0x2ba8da+'-'+_0x19ef98+'/'+_0x145b03)[_0xc1fd('0x17')](_0x2a1311);}return null;};}function saveUpdates(_0x5448db){return function(_0x3736a4){if(_0x3736a4){return _0x3736a4[_0xc1fd('0x18')](_0x5448db)[_0xc1fd('0x19')](function(_0x2f2205){return _0x2f2205;});}return null;};}function removeEntity(_0x2f99b3){return function(_0x4de910){if(_0x4de910){return _0x4de910[_0xc1fd('0x1a')]()[_0xc1fd('0x19')](function(){_0x2f99b3[_0xc1fd('0x10')](0xcc)[_0xc1fd('0x11')]();});}};}function handleEntityNotFound(_0x159397){return function(_0x3aa3a9){if(!_0x3aa3a9){_0x159397['sendStatus'](0x194);}return _0x3aa3a9;};}function handleError(_0x44d375,_0x59d382){_0x59d382=_0x59d382||0x1f4;return function(_0x1fc45a){logger[_0xc1fd('0x1b')](_0x1fc45a[_0xc1fd('0x1c')]);if(_0x1fc45a[_0xc1fd('0x1d')]){delete _0x1fc45a[_0xc1fd('0x1d')];}_0x44d375[_0xc1fd('0x10')](_0x59d382)[_0xc1fd('0x1e')](_0x1fc45a);};}exports['index']=function(_0x3a2eb7,_0x542fae){var _0x4ccb7d={};var _0x17dd67=_[_0xc1fd('0x1f')](db[_0xc1fd('0x20')]['rawAttributes'],function(_0x2cdae2){return{'name':_0x2cdae2[_0xc1fd('0x21')],'type':_0x2cdae2['type']['key']};});_0x4ccb7d=qs[_0xc1fd('0x22')](_0x17dd67,_0x3a2eb7);return interaction['findAll'](_0xc1fd('0x23'),_0x3a2eb7[_0xc1fd('0x24')],_0x3a2eb7[_0xc1fd('0x25')],_0x4ccb7d,_0x17dd67)['then'](respondWithFilteredResult(_0x542fae,_0x4ccb7d))[_0xc1fd('0x26')](handleError(_0x542fae,null));};exports[_0xc1fd('0x27')]=function(_0x3c0269,_0x7a3d1b){var _0x4b0221={'raw':![],'where':{'id':_0x3c0269['params']['id']}},_0x189a5d={};_0x189a5d['model']=_['keys'](db[_0xc1fd('0x20')][_0xc1fd('0x28')]);_0x189a5d['query']=_[_0xc1fd('0x29')](_0x3c0269[_0xc1fd('0x24')]);_0x189a5d[_0xc1fd('0x2a')]=_[_0xc1fd('0x2b')](_0x189a5d[_0xc1fd('0x2c')],_0x189a5d[_0xc1fd('0x24')]);_0x4b0221[_0xc1fd('0x2d')]=_[_0xc1fd('0x2b')](_0x189a5d[_0xc1fd('0x2c')],qs['fields'](_0x3c0269[_0xc1fd('0x24')][_0xc1fd('0x2e')]));_0x4b0221['attributes']=_0x4b0221[_0xc1fd('0x2d')][_0xc1fd('0x2f')]?_0x4b0221[_0xc1fd('0x2d')]:_0x189a5d['model'];if(_0x3c0269[_0xc1fd('0x24')][_0xc1fd('0x30')]){_0x4b0221[_0xc1fd('0x31')]=[{'all':!![]}];}_0x4b0221=_['merge']({},_0x4b0221,_0x3c0269[_0xc1fd('0x32')]);return db['WhatsappInteraction'][_0xc1fd('0x33')](_0x4b0221)['then'](handleEntityNotFound(_0x7a3d1b,null))[_0xc1fd('0x19')](respondWithResult(_0x7a3d1b,null))[_0xc1fd('0x26')](handleError(_0x7a3d1b,null));};exports[_0xc1fd('0x34')]=function(_0x2081fd,_0xee2a3d){return db[_0xc1fd('0x20')]['create'](_0x2081fd['body'],{})[_0xc1fd('0x19')](respondWithResult(_0xee2a3d,0xc9))[_0xc1fd('0x26')](handleError(_0xee2a3d,null));};exports[_0xc1fd('0x18')]=function(_0x25613e,_0x1d6a5e){if(_0x25613e[_0xc1fd('0x35')]['id']){delete _0x25613e[_0xc1fd('0x35')]['id'];}return db[_0xc1fd('0x20')][_0xc1fd('0x33')]({'where':{'id':_0x25613e['params']['id']}})[_0xc1fd('0x19')](handleEntityNotFound(_0x1d6a5e,null))[_0xc1fd('0x19')](saveUpdates(_0x25613e[_0xc1fd('0x35')],null))[_0xc1fd('0x19')](respondWithResult(_0x1d6a5e,null))[_0xc1fd('0x26')](handleError(_0x1d6a5e,null));};exports['destroy']=function(_0x42c891,_0x67480e){return db[_0xc1fd('0x20')][_0xc1fd('0x33')]({'where':{'id':_0x42c891[_0xc1fd('0x36')]['id']}})[_0xc1fd('0x19')](handleEntityNotFound(_0x67480e,null))[_0xc1fd('0x19')](removeEntity(_0x67480e,null))[_0xc1fd('0x26')](handleError(_0x67480e,null));};exports[_0xc1fd('0x37')]=function(_0xcd6edc,_0x27454c){return db[_0xc1fd('0x20')]['describe']()[_0xc1fd('0x19')](respondWithResult(_0x27454c,null))[_0xc1fd('0x26')](handleError(_0x27454c,null));};exports[_0xc1fd('0x38')]=function(_0x3504b1,_0x133970){return db[_0xc1fd('0x39')][_0xc1fd('0x33')]({'where':{'id':_0x3504b1[_0xc1fd('0x36')]['id']}})['then'](handleEntityNotFound(_0x133970,null))[_0xc1fd('0x19')](function(_0x1cfd72){if(_0x1cfd72){return _0x1cfd72[_0xc1fd('0x38')](_0x3504b1[_0xc1fd('0x35')][_0xc1fd('0x3a')],_[_0xc1fd('0x3b')](_0x3504b1[_0xc1fd('0x35')],[_0xc1fd('0x3a'),'id'])||{});}})[_0xc1fd('0x19')](respondWithResult(_0x133970,null))[_0xc1fd('0x26')](handleError(_0x133970,null));};exports[_0xc1fd('0x3c')]=function(_0xadb385,_0x2f26f1){var _0x11c089={'raw':![],'where':{}};var _0x12ede0={};var _0x31a851={'count':0x0,'rows':[]};return db[_0xc1fd('0x20')][_0xc1fd('0x3d')]({'where':{'id':_0xadb385[_0xc1fd('0x36')]['id']}})['then'](handleEntityNotFound(_0x2f26f1,null))[_0xc1fd('0x19')](function(_0x3cdf2b){if(_0x3cdf2b){_0x12ede0[_0xc1fd('0x2c')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x12ede0[_0xc1fd('0x24')]=_['keys'](_0xadb385[_0xc1fd('0x24')]);_0x12ede0[_0xc1fd('0x2a')]=_[_0xc1fd('0x2b')](_0x12ede0[_0xc1fd('0x2c')],_0x12ede0[_0xc1fd('0x24')]);_0x11c089[_0xc1fd('0x2d')]=_[_0xc1fd('0x2b')](_0x12ede0[_0xc1fd('0x2c')],qs[_0xc1fd('0x2e')](_0xadb385['query'][_0xc1fd('0x2e')]));_0x11c089[_0xc1fd('0x2d')]=_0x11c089['attributes'][_0xc1fd('0x2f')]?_0x11c089[_0xc1fd('0x2d')]:_0x12ede0[_0xc1fd('0x2c')];if(!_0xadb385[_0xc1fd('0x24')][_0xc1fd('0x3e')]('nolimit')){_0x11c089[_0xc1fd('0x14')]=qs[_0xc1fd('0x14')](_0xadb385[_0xc1fd('0x24')][_0xc1fd('0x14')]);_0x11c089[_0xc1fd('0x12')]=qs[_0xc1fd('0x12')](_0xadb385[_0xc1fd('0x24')][_0xc1fd('0x12')]);}_0x11c089[_0xc1fd('0x3f')]=qs[_0xc1fd('0x40')](_0xadb385['query'][_0xc1fd('0x40')]);_0x11c089[_0xc1fd('0x41')]=qs[_0xc1fd('0x2a')](_['pick'](_0xadb385[_0xc1fd('0x24')],_0x12ede0[_0xc1fd('0x2a')]));_0x11c089[_0xc1fd('0x41')][_0xc1fd('0x42')]=_0x3cdf2b['id'];if(_0xadb385[_0xc1fd('0x24')][_0xc1fd('0x43')]){_0x11c089[_0xc1fd('0x41')]=_[_0xc1fd('0x44')](_0x11c089[_0xc1fd('0x41')],{'$or':_[_0xc1fd('0x1f')](_0x11c089[_0xc1fd('0x2d')],function(_0x4dec56){var _0x53f223={};_0x53f223[_0x4dec56]={'$like':'%'+_0xadb385['query'][_0xc1fd('0x43')]+'%'};return _0x53f223;})});}if(_0xadb385[_0xc1fd('0x24')]['$gte']){var _0x5f1978=_0xadb385['query'][_0xc1fd('0x45')]['split'](',');var _0x46eaf7={};_0x46eaf7[_0x5f1978[0x0]]={'$gte':moment(_0x5f1978[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x11c089[_0xc1fd('0x41')]=_['merge'](_0x11c089[_0xc1fd('0x41')],_0x46eaf7);}_0x11c089=_['merge']({},_0x11c089,_0xadb385[_0xc1fd('0x32')]);return db['WhatsappMessage']['count']({'where':_0x11c089[_0xc1fd('0x41')]})[_0xc1fd('0x19')](function(_0x4339fc){_0x31a851['count']=_0x4339fc;if(_0xadb385[_0xc1fd('0x24')][_0xc1fd('0x30')]){_0x11c089[_0xc1fd('0x31')]=[{'all':!![]}];}return db[_0xc1fd('0x39')][_0xc1fd('0x46')](_0x11c089);})['then'](function(_0x6feeeb){_0x31a851['rows']=_0x6feeeb;return _0x31a851;});}})[_0xc1fd('0x19')](respondWithFilteredResult(_0x2f26f1,_0x11c089))['catch'](handleError(_0x2f26f1,null));};exports[_0xc1fd('0x47')]=function(_0x558b1c,_0x4db58e){return db[_0xc1fd('0x20')][_0xc1fd('0x33')]({'where':{'id':_0x558b1c[_0xc1fd('0x36')]['id']}})['then'](handleEntityNotFound(_0x4db58e,null))[_0xc1fd('0x19')](function(_0x4d1633){if(_0x4d1633){return _0x4d1633[_0xc1fd('0x48')](_0x558b1c[_0xc1fd('0x35')][_0xc1fd('0x3a')],_['omit'](_0x558b1c[_0xc1fd('0x35')],[_0xc1fd('0x3a'),'id'])||{})[_0xc1fd('0x49')](function(){return db[_0xc1fd('0x4a')][_0xc1fd('0x46')]({'attributes':['id','name',_0xc1fd('0x4b')],'where':{'id':_0x558b1c['body'][_0xc1fd('0x3a')]}});})['then'](function(_0xa92536){socket[_0xc1fd('0x4c')](_0xc1fd('0x4d'),{'id':Number(_0x558b1c[_0xc1fd('0x36')]['id']),'tags':_0xa92536||[]});return{'id':Number(_0x558b1c['params']['id']),'tags':_0xa92536||[]};});}})[_0xc1fd('0x19')](respondWithResult(_0x4db58e,null))[_0xc1fd('0x26')](handleError(_0x4db58e,null));};exports[_0xc1fd('0x4e')]=function(_0x1e0855,_0x1e13a0){return db['WhatsappInteraction'][_0xc1fd('0x33')]({'where':{'id':_0x1e0855[_0xc1fd('0x36')]['id']}})[_0xc1fd('0x19')](handleEntityNotFound(_0x1e13a0,null))[_0xc1fd('0x19')](function(_0x41d784){if(_0x41d784){return _0x41d784[_0xc1fd('0x4e')](_0x1e0855[_0xc1fd('0x24')]['ids']);}})[_0xc1fd('0x19')](respondWithStatusCode(_0x1e13a0,null))[_0xc1fd('0x26')](handleError(_0x1e13a0,null));};exports[_0xc1fd('0x4f')]=function(_0xbe2add,_0x2ea16d){var _0x447aac=moment()[_0xc1fd('0x50')]()[_0xc1fd('0x51')]();var _0x10513a=path[_0xc1fd('0x52')](config[_0xc1fd('0x53')],'server',_0xc1fd('0x54'),_0xc1fd('0x55'));var _0x155f07=path[_0xc1fd('0x52')](config[_0xc1fd('0x53')],_0xc1fd('0x56'),_0xc1fd('0x54'),_0xc1fd('0x57'));var _0x1de689=path[_0xc1fd('0x52')](_0x10513a,_0x447aac);var _0x1e1bce=util[_0xc1fd('0x58')](_0xc1fd('0x59'),_0xbe2add['params']['id'],_0x447aac);var _0x3e0e95=path[_0xc1fd('0x52')](_0x10513a,_0x1e1bce);var _0x2534fb=[];_0x2534fb['push']({'model':db[_0xc1fd('0x5a')],'as':_0xc1fd('0x5a'),'attributes':['id',_0xc1fd('0x5b')],'raw':!![]});_0x2534fb['push']({'model':db[_0xc1fd('0x5c')],'as':_0xc1fd('0x5d'),'attributes':['id','firstName',_0xc1fd('0x5e')],'raw':!![]});if(_0xbe2add[_0xc1fd('0x24')]['attachments']){_0x2534fb['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1c47ac=[{'model':db['WhatsappMessage'],'as':_0xc1fd('0x5f'),'attributes':['id',_0xc1fd('0x35'),_0xc1fd('0x60'),_0xc1fd('0x61'),_0xc1fd('0x62'),_0xc1fd('0x63')],'include':_0x2534fb}];_0x1c47ac[_0xc1fd('0x64')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id','name']});_0x1c47ac[_0xc1fd('0x64')]({'model':db[_0xc1fd('0x5a')],'as':'Owner','attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0xbe2add['params']['id']},'include':_0x1c47ac})[_0xc1fd('0x19')](handleEntityNotFound(_0x2ea16d,null))[_0xc1fd('0x19')](function(_0x12200a){if(_0x12200a){var _0xe4125f=_0x12200a[_0xc1fd('0x65')]({'plain':!![]});fs[_0xc1fd('0x66')](_0x1de689);var _0x1c221c={'channel':_0xc1fd('0x67'),'account':_0xe4125f[_0xc1fd('0x68')]['name'],'agent':_0xe4125f['Owner']?_0xe4125f[_0xc1fd('0x69')]['fullname']:_0xc1fd('0x6a'),'createdAt':moment(_0xe4125f[_0xc1fd('0x60')])[_0xc1fd('0x58')](_0xc1fd('0x6b'))[_0xc1fd('0x51')](),'closedAt':_0xe4125f[_0xc1fd('0x6c')]?moment(_0xe4125f[_0xc1fd('0x6d')])['format'](_0xc1fd('0x6b'))[_0xc1fd('0x51')]():'','disposition':_0xe4125f[_0xc1fd('0x6e')],'messages':_(_0xe4125f[_0xc1fd('0x5f')])[_0xc1fd('0x43')]({'secret':![]})[_0xc1fd('0x1f')](function(_0x476499){if(_0x476499['Attachment']){var _0x5e136c=path['join'](_0x155f07,_0x476499[_0xc1fd('0x6f')][_0xc1fd('0x70')]);if(fs[_0xc1fd('0x71')](_0x5e136c)){fs['createReadStream'](_0x5e136c)[_0xc1fd('0x72')](fs[_0xc1fd('0x73')](path[_0xc1fd('0x52')](_0x1de689,_0x476499['Attachment']['basename'])));}}return{'date':moment(_0x476499[_0xc1fd('0x60')])[_0xc1fd('0x58')](_0xc1fd('0x6b'))[_0xc1fd('0x51')](),'sender':_0x476499[_0xc1fd('0x61')]==='out'?_0x476499['User']?_0x476499['User'][_0xc1fd('0x5b')]:'System':_0x476499['Contact'][_0xc1fd('0x74')]+(_0x476499[_0xc1fd('0x5d')][_0xc1fd('0x5e')]?'\x20'+_0x476499['Contact'][_0xc1fd('0x5e')]:''),'body':_0x476499['Attachment']?_0x476499[_0xc1fd('0x6f')][_0xc1fd('0x70')]:_0x476499[_0xc1fd('0x35')],'direction':_0x476499[_0xc1fd('0x61')]===_0xc1fd('0x75')?'A':'C','secret':_0x476499[_0xc1fd('0x62')],'read':_0x476499['read'],'attachment':_0x476499[_0xc1fd('0x6f')]};})[_0xc1fd('0x76')]()};return ejs[_0xc1fd('0x77')](path['join'](config[_0xc1fd('0x53')],_0xc1fd('0x56'),_0xc1fd('0x78'),'downloadInteraction.ejs'),{'interaction':_0x1c221c})['then'](function(_0x422880){var _0x4e0c1f=path[_0xc1fd('0x52')](_0x1de689,_0xc1fd('0x79')+_0xe4125f['id']+'-'+_0x447aac+'.pdf');var _0xfb4211={'path':_0x4e0c1f,'channel':_0xc1fd('0x67'),'interactionId':_0xe4125f['id']};return pdf[_0xc1fd('0x7a')](_0x422880,_0xfb4211);})[_0xc1fd('0x19')](function(){return new BPromise(function(_0x54db29,_0x575658){zipdir(_0x1de689,{'saveTo':_0x3e0e95},function(_0x2f68e3,_0x31c239){if(_0x2f68e3)return _0x575658(_0x2f68e3);return _0x54db29(_0x31c239);});})[_0xc1fd('0x19')](function(){return new BPromise(function(_0x23589d,_0x55a97c){rimraf(_0x1de689,function(_0x17e64d){if(_0x17e64d)_0x55a97c(_0x17e64d);return _0x23589d();});});})[_0xc1fd('0x19')](function(){return _0x2ea16d['download'](_0x3e0e95,_0x1e1bce,function(_0x214f7c){if(_0x214f7c){console[_0xc1fd('0x7b')]('err',_0x214f7c);}else{fs['unlinkSync'](_0x3e0e95);}});});});}else{return _0x2ea16d['sendStatus'](0xc8);}})[_0xc1fd('0x26')](handleError(_0x2ea16d,null));}; \ No newline at end of file +var _0x253e=['sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','whatsapp','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','findAll','rows','addTags','setTags','Tag','color','emit','removeTags','toString','join','root','files','tmp','server','User','fullname','CmContact','Contact','firstName','push','Attachment','Messages','direction','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','map','existsSync','createReadStream','pipe','createdAt','System','lastName','basename','out','secret','value','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x253e,0x1ec));var _0xe253=function(_0x57c80f,_0x2cf181){_0x57c80f=_0x57c80f-0x0;var _0x3b700d=_0x253e[_0x57c80f];return _0x3b700d;};'use strict';var rimraf=require(_0xe253('0x0'));var zipdir=require(_0xe253('0x1'));var moment=require(_0xe253('0x2'));var BPromise=require(_0xe253('0x3'));var util=require(_0xe253('0x4'));var path=require('path');var ejs=require(_0xe253('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe253('0x6'));var interaction=require(_0xe253('0x7'));var qs=require(_0xe253('0x8'));var pdf=require(_0xe253('0x9'));var logger=require(_0xe253('0xa'))(_0xe253('0xb'));var config=require(_0xe253('0xc'));var db=require(_0xe253('0xd'))['db'];config['redis']=_[_0xe253('0xe')](config[_0xe253('0xf')],{'host':_0xe253('0x10'),'port':0x18eb});var socket=require(_0xe253('0x11'))(new Redis(config[_0xe253('0xf')]));require(_0xe253('0x12'))[_0xe253('0x13')](socket);function respondWithStatusCode(_0x45e25d,_0x2400e5){_0x2400e5=_0x2400e5||0xcc;return function(_0x4a0530){if(_0x4a0530){return _0x45e25d[_0xe253('0x14')](_0x2400e5);}return _0x45e25d['status'](_0x2400e5)[_0xe253('0x15')]();};}function respondWithResult(_0x90533d,_0x495cb5){_0x495cb5=_0x495cb5||0xc8;return function(_0x462859){if(_0x462859){return _0x90533d[_0xe253('0x16')](_0x495cb5)[_0xe253('0x17')](_0x462859);}};}function respondWithFilteredResult(_0x304588,_0x504fda){return function(_0x45eec6){if(_0x45eec6){var _0x28d2d1=typeof _0x504fda[_0xe253('0x18')]===_0xe253('0x19')&&typeof _0x504fda['limit']===_0xe253('0x19');var _0x4c4c12=_0x45eec6[_0xe253('0x1a')];var _0x481199=_0x28d2d1?0x0:_0x504fda[_0xe253('0x18')];var _0x8cacac=_0x28d2d1?_0x45eec6[_0xe253('0x1a')]:_0x504fda[_0xe253('0x18')]+_0x504fda[_0xe253('0x1b')];var _0x591e19;if(_0x8cacac>=_0x4c4c12){_0x8cacac=_0x4c4c12;_0x591e19=0xc8;}else{_0x591e19=0xce;}_0x304588[_0xe253('0x16')](_0x591e19);return _0x304588[_0xe253('0x1c')](_0xe253('0x1d'),_0x481199+'-'+_0x8cacac+'/'+_0x4c4c12)[_0xe253('0x17')](_0x45eec6);}return null;};}function saveUpdates(_0x4819c2){return function(_0x50d212){if(_0x50d212){return _0x50d212[_0xe253('0x1e')](_0x4819c2)[_0xe253('0x1f')](function(_0x3004dc){return _0x3004dc;});}return null;};}function removeEntity(_0x333bf6){return function(_0x4f17b1){if(_0x4f17b1){return _0x4f17b1[_0xe253('0x20')]()['then'](function(){_0x333bf6[_0xe253('0x16')](0xcc)[_0xe253('0x15')]();});}};}function handleEntityNotFound(_0x2fbd2b){return function(_0x4c99eb){if(!_0x4c99eb){_0x2fbd2b[_0xe253('0x14')](0x194);}return _0x4c99eb;};}function handleError(_0x1d183e,_0x2287b0){_0x2287b0=_0x2287b0||0x1f4;return function(_0x129b3e){logger[_0xe253('0x21')](_0x129b3e['stack']);if(_0x129b3e['name']){delete _0x129b3e[_0xe253('0x22')];}_0x1d183e[_0xe253('0x16')](_0x2287b0)[_0xe253('0x23')](_0x129b3e);};}exports[_0xe253('0x24')]=function(_0x59b7ef,_0x1b8222){var _0x556cb3={};var _0x19dfe5=_['map'](db[_0xe253('0x25')][_0xe253('0x26')],function(_0x7b2121){return{'name':_0x7b2121[_0xe253('0x27')],'type':_0x7b2121[_0xe253('0x28')]['key']};});_0x556cb3=qs['getOptions'](_0x19dfe5,_0x59b7ef);return interaction['findAll'](_0xe253('0x29'),_0x59b7ef[_0xe253('0x2a')],_0x59b7ef[_0xe253('0x2b')],_0x556cb3,_0x19dfe5)[_0xe253('0x1f')](respondWithFilteredResult(_0x1b8222,_0x556cb3))[_0xe253('0x2c')](handleError(_0x1b8222,null));};exports[_0xe253('0x2d')]=function(_0x136017,_0x5a5ef2){var _0x32d6e3={'raw':![],'where':{'id':_0x136017[_0xe253('0x2e')]['id']}},_0x44554e={};_0x44554e[_0xe253('0x2f')]=_[_0xe253('0x30')](db[_0xe253('0x25')]['rawAttributes']);_0x44554e[_0xe253('0x2a')]=_[_0xe253('0x30')](_0x136017[_0xe253('0x2a')]);_0x44554e['filters']=_[_0xe253('0x31')](_0x44554e[_0xe253('0x2f')],_0x44554e[_0xe253('0x2a')]);_0x32d6e3[_0xe253('0x32')]=_['intersection'](_0x44554e[_0xe253('0x2f')],qs['fields'](_0x136017[_0xe253('0x2a')][_0xe253('0x33')]));_0x32d6e3[_0xe253('0x32')]=_0x32d6e3[_0xe253('0x32')][_0xe253('0x34')]?_0x32d6e3[_0xe253('0x32')]:_0x44554e['model'];if(_0x136017['query'][_0xe253('0x35')]){_0x32d6e3[_0xe253('0x36')]=[{'all':!![]}];}_0x32d6e3=_[_0xe253('0x37')]({},_0x32d6e3,_0x136017[_0xe253('0x38')]);return db['WhatsappInteraction'][_0xe253('0x39')](_0x32d6e3)['then'](handleEntityNotFound(_0x5a5ef2,null))['then'](respondWithResult(_0x5a5ef2,null))[_0xe253('0x2c')](handleError(_0x5a5ef2,null));};exports[_0xe253('0x3a')]=function(_0x5b6ace,_0x584ceb){return db['WhatsappInteraction'][_0xe253('0x3a')](_0x5b6ace[_0xe253('0x3b')],{})['then'](respondWithResult(_0x584ceb,0xc9))[_0xe253('0x2c')](handleError(_0x584ceb,null));};exports[_0xe253('0x1e')]=function(_0x190f69,_0xc19cd8){if(_0x190f69[_0xe253('0x3b')]['id']){delete _0x190f69[_0xe253('0x3b')]['id'];}return db['WhatsappInteraction'][_0xe253('0x39')]({'where':{'id':_0x190f69[_0xe253('0x2e')]['id']}})['then'](handleEntityNotFound(_0xc19cd8,null))[_0xe253('0x1f')](saveUpdates(_0x190f69[_0xe253('0x3b')],null))[_0xe253('0x1f')](respondWithResult(_0xc19cd8,null))[_0xe253('0x2c')](handleError(_0xc19cd8,null));};exports[_0xe253('0x20')]=function(_0x92da5a,_0x1c2f02){return db['WhatsappInteraction'][_0xe253('0x39')]({'where':{'id':_0x92da5a[_0xe253('0x2e')]['id']}})[_0xe253('0x1f')](handleEntityNotFound(_0x1c2f02,null))[_0xe253('0x1f')](removeEntity(_0x1c2f02,null))[_0xe253('0x2c')](handleError(_0x1c2f02,null));};exports[_0xe253('0x3c')]=function(_0x1b2bc0,_0x3b88c0){return db['WhatsappInteraction']['describe']()[_0xe253('0x1f')](respondWithResult(_0x3b88c0,null))[_0xe253('0x2c')](handleError(_0x3b88c0,null));};exports[_0xe253('0x3d')]=function(_0x46f59b,_0x1a97b3){return db[_0xe253('0x3e')][_0xe253('0x39')]({'where':{'id':_0x46f59b[_0xe253('0x2e')]['id']}})[_0xe253('0x1f')](handleEntityNotFound(_0x1a97b3,null))['then'](function(_0x58920c){if(_0x58920c){return _0x58920c[_0xe253('0x3d')](_0x46f59b[_0xe253('0x3b')][_0xe253('0x3f')],_[_0xe253('0x40')](_0x46f59b[_0xe253('0x3b')],[_0xe253('0x3f'),'id'])||{});}})[_0xe253('0x1f')](respondWithResult(_0x1a97b3,null))['catch'](handleError(_0x1a97b3,null));};exports[_0xe253('0x41')]=function(_0x3fcdd4,_0x26ad07){var _0x1c129f={'raw':![],'where':{}};var _0x140f53={};var _0x3c8858={'count':0x0,'rows':[]};return db[_0xe253('0x25')][_0xe253('0x42')]({'where':{'id':_0x3fcdd4['params']['id']}})[_0xe253('0x1f')](handleEntityNotFound(_0x26ad07,null))[_0xe253('0x1f')](function(_0x589ecc){if(_0x589ecc){_0x140f53[_0xe253('0x2f')]=_[_0xe253('0x30')](db[_0xe253('0x3e')][_0xe253('0x26')]);_0x140f53[_0xe253('0x2a')]=_['keys'](_0x3fcdd4[_0xe253('0x2a')]);_0x140f53[_0xe253('0x43')]=_['intersection'](_0x140f53[_0xe253('0x2f')],_0x140f53['query']);_0x1c129f[_0xe253('0x32')]=_[_0xe253('0x31')](_0x140f53['model'],qs[_0xe253('0x33')](_0x3fcdd4['query'][_0xe253('0x33')]));_0x1c129f['attributes']=_0x1c129f[_0xe253('0x32')]['length']?_0x1c129f[_0xe253('0x32')]:_0x140f53[_0xe253('0x2f')];if(!_0x3fcdd4['query'][_0xe253('0x44')]('nolimit')){_0x1c129f[_0xe253('0x1b')]=qs['limit'](_0x3fcdd4['query']['limit']);_0x1c129f['offset']=qs[_0xe253('0x18')](_0x3fcdd4[_0xe253('0x2a')][_0xe253('0x18')]);}_0x1c129f['order']=qs[_0xe253('0x45')](_0x3fcdd4[_0xe253('0x2a')][_0xe253('0x45')]);_0x1c129f[_0xe253('0x46')]=qs['filters'](_[_0xe253('0x47')](_0x3fcdd4[_0xe253('0x2a')],_0x140f53['filters']));_0x1c129f[_0xe253('0x46')][_0xe253('0x48')]=_0x589ecc['id'];if(_0x3fcdd4[_0xe253('0x2a')]['filter']){_0x1c129f[_0xe253('0x46')]=_[_0xe253('0x37')](_0x1c129f[_0xe253('0x46')],{'$or':_['map'](_0x1c129f['attributes'],function(_0x3b2ae5){var _0x3b8118={};_0x3b8118[_0x3b2ae5]={'$like':'%'+_0x3fcdd4[_0xe253('0x2a')][_0xe253('0x49')]+'%'};return _0x3b8118;})});}if(_0x3fcdd4['query'][_0xe253('0x4a')]){var _0x1bee42=_0x3fcdd4['query'][_0xe253('0x4a')][_0xe253('0x4b')](',');var _0x4b66b7={};_0x4b66b7[_0x1bee42[0x0]]={'$gte':moment(_0x1bee42[0x1])[_0xe253('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1c129f[_0xe253('0x46')]=_[_0xe253('0x37')](_0x1c129f[_0xe253('0x46')],_0x4b66b7);}_0x1c129f=_['merge']({},_0x1c129f,_0x3fcdd4['options']);return db['WhatsappMessage'][_0xe253('0x1a')]({'where':_0x1c129f[_0xe253('0x46')]})[_0xe253('0x1f')](function(_0x230a99){_0x3c8858[_0xe253('0x1a')]=_0x230a99;if(_0x3fcdd4[_0xe253('0x2a')]['includeAll']){_0x1c129f[_0xe253('0x36')]=[{'all':!![]}];}return db[_0xe253('0x3e')][_0xe253('0x4d')](_0x1c129f);})[_0xe253('0x1f')](function(_0x5770c6){_0x3c8858[_0xe253('0x4e')]=_0x5770c6;return _0x3c8858;});}})[_0xe253('0x1f')](respondWithFilteredResult(_0x26ad07,_0x1c129f))['catch'](handleError(_0x26ad07,null));};exports[_0xe253('0x4f')]=function(_0x350c04,_0x485daf){return db[_0xe253('0x25')]['find']({'where':{'id':_0x350c04['params']['id']}})[_0xe253('0x1f')](handleEntityNotFound(_0x485daf,null))['then'](function(_0x7bbd2b){if(_0x7bbd2b){return _0x7bbd2b[_0xe253('0x50')](_0x350c04[_0xe253('0x3b')][_0xe253('0x3f')],_[_0xe253('0x40')](_0x350c04['body'],[_0xe253('0x3f'),'id'])||{})['spread'](function(){return db[_0xe253('0x51')][_0xe253('0x4d')]({'attributes':['id',_0xe253('0x22'),_0xe253('0x52')],'where':{'id':_0x350c04['body']['ids']}});})[_0xe253('0x1f')](function(_0x240608){socket[_0xe253('0x53')]('whatsappInteractionTags:save',{'id':Number(_0x350c04[_0xe253('0x2e')]['id']),'tags':_0x240608||[]});return{'id':Number(_0x350c04[_0xe253('0x2e')]['id']),'tags':_0x240608||[]};});}})[_0xe253('0x1f')](respondWithResult(_0x485daf,null))[_0xe253('0x2c')](handleError(_0x485daf,null));};exports['removeTags']=function(_0x48d1ea,_0x1271e0){return db[_0xe253('0x25')][_0xe253('0x39')]({'where':{'id':_0x48d1ea['params']['id']}})[_0xe253('0x1f')](handleEntityNotFound(_0x1271e0,null))[_0xe253('0x1f')](function(_0x16660b){if(_0x16660b){return _0x16660b[_0xe253('0x54')](_0x48d1ea[_0xe253('0x2a')][_0xe253('0x3f')]);}})[_0xe253('0x1f')](respondWithStatusCode(_0x1271e0,null))[_0xe253('0x2c')](handleError(_0x1271e0,null));};exports['download']=function(_0x12a975,_0x15cf90){var _0x171565=moment()['unix']()[_0xe253('0x55')]();var _0x2a42ab=path[_0xe253('0x56')](config[_0xe253('0x57')],'server',_0xe253('0x58'),_0xe253('0x59'));var _0x52a886=path['join'](config[_0xe253('0x57')],_0xe253('0x5a'),_0xe253('0x58'),'attachments');var _0x261654=path['join'](_0x2a42ab,_0x171565);var _0x5d0505=util[_0xe253('0x4c')]('transcript-%d-%s.zip',_0x12a975['params']['id'],_0x171565);var _0x3be5b9=path[_0xe253('0x56')](_0x2a42ab,_0x5d0505);var _0x20c8e0=[];_0x20c8e0['push']({'model':db[_0xe253('0x5b')],'as':'User','attributes':['id',_0xe253('0x5c')],'raw':!![]});_0x20c8e0['push']({'model':db[_0xe253('0x5d')],'as':_0xe253('0x5e'),'attributes':['id',_0xe253('0x5f'),'lastName'],'raw':!![]});if(_0x12a975['query']['attachments']){_0x20c8e0[_0xe253('0x60')]({'model':db[_0xe253('0x61')],'as':_0xe253('0x61'),'raw':!![]});}var _0xd6d562=[{'model':db[_0xe253('0x3e')],'as':_0xe253('0x62'),'attributes':['id','body','createdAt',_0xe253('0x63'),'secret','read'],'include':_0x20c8e0}];_0xd6d562[_0xe253('0x60')]({'model':db[_0xe253('0x64')],'as':_0xe253('0x65'),'attributes':['id','name']});_0xd6d562[_0xe253('0x60')]({'model':db[_0xe253('0x5b')],'as':_0xe253('0x66'),'attributes':['id',_0xe253('0x5c')]});return db[_0xe253('0x25')][_0xe253('0x39')]({'where':{'id':_0x12a975[_0xe253('0x2e')]['id']},'include':_0xd6d562})[_0xe253('0x1f')](handleEntityNotFound(_0x15cf90,null))[_0xe253('0x1f')](function(_0x584187){if(_0x584187){var _0x4ff4c9=_0x584187[_0xe253('0x67')]({'plain':!![]});fs['mkdirSync'](_0x261654);var _0x599233={'channel':_0xe253('0x68'),'account':_0x4ff4c9[_0xe253('0x65')][_0xe253('0x22')],'agent':_0x4ff4c9[_0xe253('0x66')]?_0x4ff4c9[_0xe253('0x66')]['fullname']:_0xe253('0x69'),'createdAt':moment(_0x4ff4c9['createdAt'])[_0xe253('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe253('0x55')](),'closedAt':_0x4ff4c9[_0xe253('0x6a')]?moment(_0x4ff4c9[_0xe253('0x6b')])[_0xe253('0x4c')](_0xe253('0x6c'))[_0xe253('0x55')]():'','disposition':_0x4ff4c9[_0xe253('0x6d')],'messages':_(_0x4ff4c9[_0xe253('0x62')])['filter']({'secret':![]})[_0xe253('0x6e')](function(_0x27bd1e){if(_0x27bd1e[_0xe253('0x61')]){var _0x5c2194=path['join'](_0x52a886,_0x27bd1e[_0xe253('0x61')]['basename']);if(fs[_0xe253('0x6f')](_0x5c2194)){fs[_0xe253('0x70')](_0x5c2194)[_0xe253('0x71')](fs['createWriteStream'](path[_0xe253('0x56')](_0x261654,_0x27bd1e['Attachment']['basename'])));}}return{'date':moment(_0x27bd1e[_0xe253('0x72')])[_0xe253('0x4c')](_0xe253('0x6c'))[_0xe253('0x55')](),'sender':_0x27bd1e[_0xe253('0x63')]==='out'?_0x27bd1e['User']?_0x27bd1e[_0xe253('0x5b')][_0xe253('0x5c')]:_0xe253('0x73'):_0x27bd1e['Contact'][_0xe253('0x5f')]+(_0x27bd1e[_0xe253('0x5e')][_0xe253('0x74')]?'\x20'+_0x27bd1e[_0xe253('0x5e')][_0xe253('0x74')]:''),'body':_0x27bd1e['Attachment']?_0x27bd1e[_0xe253('0x61')][_0xe253('0x75')]:_0x27bd1e[_0xe253('0x3b')],'direction':_0x27bd1e['direction']===_0xe253('0x76')?'A':'C','secret':_0x27bd1e[_0xe253('0x77')],'read':_0x27bd1e['read'],'attachment':_0x27bd1e[_0xe253('0x61')]};})[_0xe253('0x78')]()};return ejs['renderFile'](path[_0xe253('0x56')](config[_0xe253('0x57')],_0xe253('0x5a'),_0xe253('0x79'),_0xe253('0x7a')),{'interaction':_0x599233})[_0xe253('0x1f')](function(_0xc942ad){var _0x5f24fb=path[_0xe253('0x56')](_0x261654,_0xe253('0x7b')+_0x4ff4c9['id']+'-'+_0x171565+_0xe253('0x7c'));var _0x3d72f7={'path':_0x5f24fb,'channel':_0xe253('0x68'),'interactionId':_0x4ff4c9['id']};return pdf['createPdfFromHTML'](_0xc942ad,_0x3d72f7);})[_0xe253('0x1f')](function(){return new BPromise(function(_0x3c25dc,_0x78c415){zipdir(_0x261654,{'saveTo':_0x3be5b9},function(_0x41c109,_0x499429){if(_0x41c109)return _0x78c415(_0x41c109);return _0x3c25dc(_0x499429);});})['then'](function(){return new BPromise(function(_0x48b53d,_0x35afc0){rimraf(_0x261654,function(_0x31fcba){if(_0x31fcba)_0x35afc0(_0x31fcba);return _0x48b53d();});});})[_0xe253('0x1f')](function(){return _0x15cf90[_0xe253('0x7d')](_0x3be5b9,_0x5d0505,function(_0x5ae9f8){if(_0x5ae9f8){console[_0xe253('0x7e')](_0xe253('0x7f'),_0x5ae9f8);}else{fs['unlinkSync'](_0x3be5b9);}});});});}else{return _0x15cf90[_0xe253('0x14')](0xc8);}})[_0xe253('0x2c')](handleError(_0x15cf90,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 724f073..f96bf60 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 _0x95c5=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x445261,_0x331713){var _0x1ddd23=function(_0x43a98a){while(--_0x43a98a){_0x445261['push'](_0x445261['shift']());}};_0x1ddd23(++_0x331713);}(_0x95c5,0x153));var _0x595c=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x95c5[_0x420d8d];return _0x4865d7;};'use strict';var EventEmitter=require(_0x595c('0x0'));var WhatsappInteraction=require(_0x595c('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x595c('0x1'))['db'][_0x595c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x595c('0x3')](0x0);var events={'afterCreate':_0x595c('0x4'),'afterUpdate':_0x595c('0x5'),'afterDestroy':_0x595c('0x6')};function emitEvent(_0xf4369b){return function(_0x193dd9,_0x19a4f2,_0x46be42){_0x193dd9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xc9f937){_0x193dd9[_0x595c('0x7')](_0x595c('0x8'),_0xc9f937[_0x595c('0x9')](function(_0x1b85ab){return{'id':_0x1b85ab['id']};}));return WhatsappMessage[_0x595c('0xa')]({'where':{'WhatsappInteractionId':_0x193dd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x595c('0xb')](function(_0x359da2){_0x193dd9[_0x595c('0x7')]('unreadMessages',_0x359da2[_0x595c('0xc')]);WhatsappInteractionEvents[_0x595c('0xd')](_0xf4369b+':'+_0x193dd9['id'],_0x193dd9);WhatsappInteractionEvents[_0x595c('0xd')](_0xf4369b,_0x193dd9);_0x46be42(null);})['catch'](_0x46be42(null));};}for(var e in events){if(events[_0x595c('0xe')](e)){var event=events[e];WhatsappInteraction[_0x595c('0xf')](e,emitEvent(event));}}module[_0x595c('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xce3a=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x1ef9f2,_0x5693b6){var _0x4c3ac0=function(_0x284ff1){while(--_0x284ff1){_0x1ef9f2['push'](_0x1ef9f2['shift']());}};_0x4c3ac0(++_0x5693b6);}(_0xce3a,0x194));var _0xace3=function(_0x3d7135,_0x306d11){_0x3d7135=_0x3d7135-0x0;var _0x332a7a=_0xce3a[_0x3d7135];return _0x332a7a;};'use strict';var EventEmitter=require(_0xace3('0x0'));var WhatsappInteraction=require(_0xace3('0x1'))['db'][_0xace3('0x2')];var WhatsappMessage=require(_0xace3('0x1'))['db'][_0xace3('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xace3('0x4')](0x0);var events={'afterCreate':_0xace3('0x5'),'afterUpdate':_0xace3('0x6'),'afterDestroy':_0xace3('0x7')};function emitEvent(_0x80eaaf){return function(_0x17d5af,_0x47707b,_0x4c3ae9){_0x17d5af[_0xace3('0x8')]({'attributes':['id'],'raw':!![]})[_0xace3('0x9')](function(_0x4d5360){_0x17d5af[_0xace3('0xa')]('Users',_0x4d5360[_0xace3('0xb')](function(_0x5609f2){return{'id':_0x5609f2['id']};}));return WhatsappMessage[_0xace3('0xc')]({'where':{'WhatsappInteractionId':_0x17d5af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xace3('0x9')](function(_0x2bc454){_0x17d5af[_0xace3('0xa')](_0xace3('0xd'),_0x2bc454[_0xace3('0xe')]);WhatsappInteractionEvents[_0xace3('0xf')](_0x80eaaf+':'+_0x17d5af['id'],_0x17d5af);WhatsappInteractionEvents[_0xace3('0xf')](_0x80eaaf,_0x17d5af);_0x4c3ae9(null);})['catch'](_0x4c3ae9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xace3('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6da6083..b69ab39 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 _0xe66a=['WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x31df5c,_0x40790c){var _0x225d71=function(_0x1b7b42){while(--_0x1b7b42){_0x31df5c['push'](_0x31df5c['shift']());}};_0x225d71(++_0x40790c);}(_0xe66a,0x9b));var _0xae66=function(_0x11e557,_0x3a27e2){_0x11e557=_0x11e557-0x0;var _0x19edd5=_0xe66a[_0x11e557];return _0x19edd5;};'use strict';var _=require(_0xae66('0x0'));var util=require(_0xae66('0x1'));var logger=require(_0xae66('0x2'))(_0xae66('0x3'));var moment=require(_0xae66('0x4'));var BPromise=require(_0xae66('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae66('0x6'));var rimraf=require('rimraf');var config=require(_0xae66('0x7'));var attributes=require(_0xae66('0x8'));module[_0xae66('0x9')]=function(_0x2d55f7,_0x186fb5){return _0x2d55f7['define'](_0xae66('0xa'),attributes,{'tableName':_0xae66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd1ecd3,_0x256849,_0x10b2d6){if(_0xd1ecd3['changed'](_0xae66('0xc'))){_0xd1ecd3['closedAt']=moment()[_0xae66('0xd')](_0xae66('0xe'));}_0x10b2d6(null,_0xd1ecd3);}}});}; \ No newline at end of file +var _0xc2d3=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x51204b,_0x3ed15d){var _0x1b9d65=function(_0x537e33){while(--_0x537e33){_0x51204b['push'](_0x51204b['shift']());}};_0x1b9d65(++_0x3ed15d);}(_0xc2d3,0xfe));var _0x3c2d=function(_0x4702d2,_0x1208db){_0x4702d2=_0x4702d2-0x0;var _0x17a39d=_0xc2d3[_0x4702d2];return _0x17a39d;};'use strict';var _=require(_0x3c2d('0x0'));var util=require(_0x3c2d('0x1'));var logger=require(_0x3c2d('0x2'))(_0x3c2d('0x3'));var moment=require(_0x3c2d('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c2d('0x5'));var fs=require('fs');var path=require(_0x3c2d('0x6'));var rimraf=require('rimraf');var config=require(_0x3c2d('0x7'));var attributes=require(_0x3c2d('0x8'));module[_0x3c2d('0x9')]=function(_0x5d26da,_0x3af7b7){return _0x5d26da[_0x3c2d('0xa')](_0x3c2d('0xb'),attributes,{'tableName':_0x3c2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40135e,_0x5ef2ad,_0x74547c){if(_0x40135e[_0x3c2d('0xd')](_0x3c2d('0xe'))){_0x40135e[_0x3c2d('0xf')]=moment()[_0x3c2d('0x10')](_0x3c2d('0x11'));}_0x74547c(null,_0x40135e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4803676..3510e44 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 _0xfa40=['update','options','attributes','limit','AddTagsToWhatsappInteraction','find','where','body','ids','omit','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x5c5030,_0x58fbd8){var _0x3f6928=function(_0x59ae63){while(--_0x59ae63){_0x5c5030['push'](_0x5c5030['shift']());}};_0x3f6928(++_0x58fbd8);}(_0xfa40,0x81));var _0x0fa4=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xfa40[_0x152121];return _0x592a85;};'use strict';var _=require('lodash');var util=require(_0x0fa4('0x0'));var moment=require('moment');var BPromise=require(_0x0fa4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fa4('0x2'));var db=require(_0x0fa4('0x3'))['db'];var utils=require(_0x0fa4('0x4'));var logger=require(_0x0fa4('0x5'))('rpc');var config=require(_0x0fa4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0fa4('0x7')][_0x0fa4('0x8')]({'port':0x232a});config[_0x0fa4('0x9')]=_[_0x0fa4('0xa')](config[_0x0fa4('0x9')],{'host':_0x0fa4('0xb'),'port':0x18eb});var socket=require(_0x0fa4('0xc'))(new Redis(config[_0x0fa4('0x9')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3d653c,_0x285c0b,_0x12fae2){return new BPromise(function(_0x22a0bc,_0x30a973){return client['request'](_0x3d653c,_0x12fae2)[_0x0fa4('0xd')](function(_0x324980){logger[_0x0fa4('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x285c0b,_0x0fa4('0xf'));logger[_0x0fa4('0x10')](_0x0fa4('0x11'),_0x285c0b,_0x0fa4('0xf'),JSON[_0x0fa4('0x12')](_0x324980));if(_0x324980[_0x0fa4('0x13')]){if(_0x324980[_0x0fa4('0x13')][_0x0fa4('0x14')]===0x1f4){logger[_0x0fa4('0x13')](_0x0fa4('0x15'),_0x285c0b,_0x324980[_0x0fa4('0x13')][_0x0fa4('0x16')]);return _0x30a973(_0x324980['error']['message']);}logger[_0x0fa4('0x13')](_0x0fa4('0x15'),_0x285c0b,_0x324980[_0x0fa4('0x13')][_0x0fa4('0x16')]);return _0x22a0bc(_0x324980[_0x0fa4('0x13')]['message']);}else{logger['info'](_0x0fa4('0x15'),_0x285c0b,_0x0fa4('0xf'));_0x22a0bc(_0x324980[_0x0fa4('0x17')]['message']);}})[_0x0fa4('0x18')](function(_0x498c98){logger[_0x0fa4('0x13')](_0x0fa4('0x15'),_0x285c0b,_0x498c98);_0x30a973(_0x498c98);});});}exports[_0x0fa4('0x19')]=function(_0x3ff1a1){var _0x104e09=this;return new Promise(function(_0x3e63e4,_0x471b10){return db[_0x0fa4('0x1a')][_0x0fa4('0x1b')](_0x3ff1a1['body'],{'raw':_0x3ff1a1[_0x0fa4('0x1c')]?_0x3ff1a1[_0x0fa4('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff1a1[_0x0fa4('0x1c')]?_0x3ff1a1['options']['where']||null:null,'attributes':_0x3ff1a1[_0x0fa4('0x1c')]?_0x3ff1a1[_0x0fa4('0x1c')][_0x0fa4('0x1d')]||null:null,'limit':_0x3ff1a1[_0x0fa4('0x1c')]?_0x3ff1a1['options'][_0x0fa4('0x1e')]||null:null})['then'](function(_0x3d2849){logger[_0x0fa4('0xe')]('UpdateWhatsappInteraction',_0x3ff1a1);logger[_0x0fa4('0x10')](_0x0fa4('0x19'),_0x3ff1a1,JSON['stringify'](_0x3d2849));_0x3e63e4(_0x3d2849);})[_0x0fa4('0x18')](function(_0x412534){logger[_0x0fa4('0x13')](_0x0fa4('0x19'),_0x412534[_0x0fa4('0x16')],_0x3ff1a1);_0x471b10(_0x104e09[_0x0fa4('0x13')](0x1f4,_0x412534[_0x0fa4('0x16')]));});});};exports[_0x0fa4('0x1f')]=function(_0x4ca932){return new Promise(function(_0xf15ed8,_0x28f3e6){return db[_0x0fa4('0x1a')][_0x0fa4('0x20')]({'where':_0x4ca932[_0x0fa4('0x1c')]?_0x4ca932[_0x0fa4('0x1c')][_0x0fa4('0x21')]||null:null})[_0x0fa4('0xd')](function(_0x14061e){if(_0x14061e){return _0x14061e['addTags'](_0x4ca932[_0x0fa4('0x22')][_0x0fa4('0x23')],_[_0x0fa4('0x24')](_0x4ca932[_0x0fa4('0x22')],['ids','id'])||{});}})[_0x0fa4('0x25')](function(_0x24a41){logger['info']('AddTags',_0x4ca932);logger['debug'](_0x0fa4('0x26'),_0x4ca932,JSON[_0x0fa4('0x12')](_0x24a41));_0xf15ed8(_0x24a41);})[_0x0fa4('0x18')](function(_0x4461cc){logger['error'](_0x0fa4('0x26'),_0x4461cc[_0x0fa4('0x16')],_0x4ca932);_0x28f3e6(_this[_0x0fa4('0x13')](0x1f4,_0x4461cc[_0x0fa4('0x16')]));});});}; \ No newline at end of file +var _0x2572=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','update','body','raw','options','where','attributes','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0xdb4a46,_0x2391d4){var _0x3099e9=function(_0x158e42){while(--_0x158e42){_0xdb4a46['push'](_0xdb4a46['shift']());}};_0x3099e9(++_0x2391d4);}(_0x2572,0x110));var _0x2257=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2572[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var moment=require(_0x2257('0x2'));var BPromise=require(_0x2257('0x3'));var rs=require(_0x2257('0x4'));var fs=require('fs');var Redis=require(_0x2257('0x5'));var db=require(_0x2257('0x6'))['db'];var utils=require(_0x2257('0x7'));var logger=require(_0x2257('0x8'))('rpc');var config=require(_0x2257('0x9'));var jayson=require(_0x2257('0xa'));var client=jayson[_0x2257('0xb')][_0x2257('0xc')]({'port':0x232a});config[_0x2257('0xd')]=_[_0x2257('0xe')](config[_0x2257('0xd')],{'host':_0x2257('0xf'),'port':0x18eb});var socket=require(_0x2257('0x10'))(new Redis(config['redis']));require(_0x2257('0x11'))[_0x2257('0x12')](socket);function respondWithRpcPromise(_0x585a28,_0x36a281,_0x8f65b3){return new BPromise(function(_0x2d22d0,_0x4bab94){return client[_0x2257('0x13')](_0x585a28,_0x8f65b3)[_0x2257('0x14')](function(_0xe89b3a){logger[_0x2257('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x36a281,_0x2257('0x16'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x36a281,_0x2257('0x16'),JSON[_0x2257('0x17')](_0xe89b3a));if(_0xe89b3a[_0x2257('0x18')]){if(_0xe89b3a[_0x2257('0x18')][_0x2257('0x19')]===0x1f4){logger[_0x2257('0x18')](_0x2257('0x1a'),_0x36a281,_0xe89b3a['error']['message']);return _0x4bab94(_0xe89b3a[_0x2257('0x18')][_0x2257('0x1b')]);}logger[_0x2257('0x18')](_0x2257('0x1a'),_0x36a281,_0xe89b3a['error']['message']);return _0x2d22d0(_0xe89b3a[_0x2257('0x18')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x36a281,_0x2257('0x16'));_0x2d22d0(_0xe89b3a[_0x2257('0x1c')][_0x2257('0x1b')]);}})[_0x2257('0x1d')](function(_0x119136){logger[_0x2257('0x18')](_0x2257('0x1a'),_0x36a281,_0x119136);_0x4bab94(_0x119136);});});}exports[_0x2257('0x1e')]=function(_0x2c580f){var _0x14ec4d=this;return new Promise(function(_0x11eb88,_0x263108){return db['WhatsappInteraction'][_0x2257('0x1f')](_0x2c580f[_0x2257('0x20')],{'raw':_0x2c580f['options']?_0x2c580f['options'][_0x2257('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c580f['options']?_0x2c580f[_0x2257('0x22')][_0x2257('0x23')]||null:null,'attributes':_0x2c580f[_0x2257('0x22')]?_0x2c580f[_0x2257('0x22')][_0x2257('0x24')]||null:null,'limit':_0x2c580f[_0x2257('0x22')]?_0x2c580f[_0x2257('0x22')][_0x2257('0x25')]||null:null})[_0x2257('0x14')](function(_0x27a619){logger['info'](_0x2257('0x1e'),_0x2c580f);logger[_0x2257('0x26')]('UpdateWhatsappInteraction',_0x2c580f,JSON[_0x2257('0x17')](_0x27a619));_0x11eb88(_0x27a619);})[_0x2257('0x1d')](function(_0x4e0eaf){logger[_0x2257('0x18')](_0x2257('0x1e'),_0x4e0eaf['message'],_0x2c580f);_0x263108(_0x14ec4d[_0x2257('0x18')](0x1f4,_0x4e0eaf[_0x2257('0x1b')]));});});};exports[_0x2257('0x27')]=function(_0x33619a){return new Promise(function(_0x574c57,_0x8b9b1b){return db[_0x2257('0x28')]['find']({'where':_0x33619a[_0x2257('0x22')]?_0x33619a[_0x2257('0x22')][_0x2257('0x23')]||null:null})[_0x2257('0x14')](function(_0x203996){if(_0x203996){return _0x203996[_0x2257('0x29')](_0x33619a[_0x2257('0x20')][_0x2257('0x2a')],_[_0x2257('0x2b')](_0x33619a['body'],[_0x2257('0x2a'),'id'])||{});}})[_0x2257('0x2c')](function(_0x47dd70){logger['info'](_0x2257('0x2d'),_0x33619a);logger[_0x2257('0x26')](_0x2257('0x2d'),_0x33619a,JSON[_0x2257('0x17')](_0x47dd70));_0x574c57(_0x47dd70);})[_0x2257('0x1d')](function(_0x1db062){logger['error'](_0x2257('0x2d'),_0x1db062[_0x2257('0x1b')],_0x33619a);_0x8b9b1b(_this[_0x2257('0x18')](0x1f4,_0x1db062[_0x2257('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index fc5c0e0..847ec51 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 _0xb463=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','removeListener','register'];(function(_0x12838c,_0x186682){var _0x4a859d=function(_0x4358f7){while(--_0x4358f7){_0x12838c['push'](_0x12838c['shift']());}};_0x4a859d(++_0x186682);}(_0xb463,0x152));var _0x3b46=function(_0x167d03,_0x49c951){_0x167d03=_0x167d03-0x0;var _0x40359a=_0xb463[_0x167d03];return _0x40359a;};'use strict';var WhatsappInteractionEvents=require(_0x3b46('0x0'));var events=['save',_0x3b46('0x1'),_0x3b46('0x2')];function createListener(_0x3a5d58,_0x444dad){return function(_0x591548){_0x444dad['emit'](_0x3a5d58,_0x591548);};}function removeListener(_0x32cfcf,_0x12c5b9){return function(){WhatsappInteractionEvents[_0x3b46('0x3')](_0x32cfcf,_0x12c5b9);};}exports[_0x3b46('0x4')]=function(_0x3ee78c){for(var _0x2dc977=0x0,_0x41d55c=events[_0x3b46('0x5')];_0x2dc977<_0x41d55c;_0x2dc977++){var _0x10f35d=events[_0x2dc977];var _0x361339=createListener(_0x3b46('0x6')+_0x10f35d,_0x3ee78c);WhatsappInteractionEvents['on'](_0x10f35d,_0x361339);}}; \ No newline at end of file +var _0xb43a=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit'];(function(_0x10d103,_0x581dc8){var _0x34fe2d=function(_0x170bfb){while(--_0x170bfb){_0x10d103['push'](_0x10d103['shift']());}};_0x34fe2d(++_0x581dc8);}(_0xb43a,0x1f4));var _0xab43=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0xb43a[_0x29632e];return _0x426e04;};'use strict';var WhatsappInteractionEvents=require(_0xab43('0x0'));var events=[_0xab43('0x1'),'remove',_0xab43('0x2')];function createListener(_0x225087,_0x4b4425){return function(_0x1962eb){_0x4b4425[_0xab43('0x3')](_0x225087,_0x1962eb);};}function removeListener(_0xf599e5,_0x3c89fd){return function(){WhatsappInteractionEvents[_0xab43('0x4')](_0xf599e5,_0x3c89fd);};}exports[_0xab43('0x5')]=function(_0x4dfff6){for(var _0x4c064e=0x0,_0x24b0ce=events[_0xab43('0x6')];_0x4c064e<_0x24b0ce;_0x4c064e++){var _0x150f10=events[_0x4c064e];var _0x4aa000=createListener(_0xab43('0x7')+_0x150f10,_0x4dfff6);WhatsappInteractionEvents['on'](_0x150f10,_0x4aa000);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1610e3d..4c70c07 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 _0x8b66=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','tracked','whatsappmessage:create','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0x8b66,0x167));var _0x68b6=function(_0x8e6768,_0x997aad){_0x8e6768=_0x8e6768-0x0;var _0x4db9e9=_0x8b66[_0x8e6768];return _0x4db9e9;};'use strict';var multer=require('multer');var util=require(_0x68b6('0x0'));var path=require('path');var timeout=require(_0x68b6('0x1'));var express=require(_0x68b6('0x2'));var router=express[_0x68b6('0x3')]();var fs_extra=require(_0x68b6('0x4'));var auth=require(_0x68b6('0x5'));var interaction=require(_0x68b6('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x68b6('0x7')](),controller[_0x68b6('0x8')]);router[_0x68b6('0x9')](_0x68b6('0xa'),auth[_0x68b6('0x7')](),controller[_0x68b6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x68b6('0xc')]);router[_0x68b6('0xd')]('/',auth['isAuthenticated'](),interaction[_0x68b6('0xe')]('whatsapp',_0x68b6('0xf')),controller['create']);router[_0x68b6('0xd')]('/:id/status',controller[_0x68b6('0x10')]);router[_0x68b6('0x11')](_0x68b6('0x12'),auth[_0x68b6('0x7')](),controller[_0x68b6('0x13')]);router[_0x68b6('0x11')](_0x68b6('0x14'),auth[_0x68b6('0x7')](),controller[_0x68b6('0x15')]);router[_0x68b6('0x11')](_0x68b6('0x16'),auth['isAuthenticated'](),controller[_0x68b6('0x17')]);router[_0x68b6('0x18')](_0x68b6('0x12'),auth[_0x68b6('0x7')](),controller['destroy']);module[_0x68b6('0x19')]=router; \ No newline at end of file +var _0xd23f=['accept','/:id/reject','reject','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','/:id','isAuthenticated','show','whatsapp','whatsappmessage:create','create','post','/:id/status','put','update','/:id/accept'];(function(_0x20eddd,_0x3d8fc6){var _0x1d34f9=function(_0x5bdef5){while(--_0x5bdef5){_0x20eddd['push'](_0x20eddd['shift']());}};_0x1d34f9(++_0x3d8fc6);}(_0xd23f,0x17b));var _0xfd23=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd23f[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xfd23('0x0'));var util=require(_0xfd23('0x1'));var path=require('path');var timeout=require(_0xfd23('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfd23('0x3'));var auth=require(_0xfd23('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfd23('0x5'));var controller=require(_0xfd23('0x6'));router[_0xfd23('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd23('0x8')]);router['get'](_0xfd23('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xfd23('0x7')](_0xfd23('0xa'),auth[_0xfd23('0xb')](),controller[_0xfd23('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xfd23('0xd'),_0xfd23('0xe')),controller[_0xfd23('0xf')]);router[_0xfd23('0x10')](_0xfd23('0x11'),controller['status']);router[_0xfd23('0x12')](_0xfd23('0xa'),auth['isAuthenticated'](),controller[_0xfd23('0x13')]);router[_0xfd23('0x12')](_0xfd23('0x14'),auth[_0xfd23('0xb')](),controller[_0xfd23('0x15')]);router[_0xfd23('0x12')](_0xfd23('0x16'),auth[_0xfd23('0xb')](),controller[_0xfd23('0x17')]);router['delete'](_0xfd23('0xa'),auth[_0xfd23('0xb')](),controller['destroy']);module[_0xfd23('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 422fba3..86b50d7 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 _0x62c9=['out','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x291f2a,_0xd9c2e){var _0x26ac1c=function(_0x333458){while(--_0x333458){_0x291f2a['push'](_0x291f2a['shift']());}};_0x26ac1c(++_0xd9c2e);}(_0x62c9,0xe3));var _0x962c=function(_0xfc4610,_0x368e61){_0xfc4610=_0xfc4610-0x0;var _0x42b0a1=_0x62c9[_0xfc4610];return _0x42b0a1;};'use strict';var Sequelize=require(_0x962c('0x0'));module[_0x962c('0x1')]={'body':{'type':Sequelize[_0x962c('0x2')](_0x962c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x962c('0x4')]('in',_0x962c('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x962c('0x6')]},'secret':{'type':Sequelize[_0x962c('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf350=['STRING','TEXT','sequelize','medium','BOOLEAN','ENUM','out'];(function(_0x4b0daf,_0x3b4736){var _0x187e79=function(_0x1d1e58){while(--_0x1d1e58){_0x4b0daf['push'](_0x4b0daf['shift']());}};_0x187e79(++_0x3b4736);}(_0xf350,0x105));var _0x0f35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf350[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0f35('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x0f35('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0f35('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0f35('0x3')]('in',_0x0f35('0x4')),'defaultValue':_0x0f35('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0f35('0x5')](0xbe)},'phone':{'type':Sequelize[_0x0f35('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0f35('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 763f26e..cdba192 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 _0x4da0=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','stack','name','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','body','catch','update','find','destroy','describe','read','readAt','format','UserId','user','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp-interactions','whatsapp','WhatsappInteractionId','rejectMessage','contact','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x496ee9,_0x4dba12){var _0xb7016a=function(_0x11eb42){while(--_0x11eb42){_0x496ee9['push'](_0x496ee9['shift']());}};_0xb7016a(++_0x4dba12);}(_0x4da0,0x100));var _0x04da=function(_0x4dc9bc,_0x1ea4ff){_0x4dc9bc=_0x4dc9bc-0x0;var _0x1cd877=_0x4da0[_0x4dc9bc];return _0x1cd877;};'use strict';var emlformat=require(_0x04da('0x0'));var rimraf=require(_0x04da('0x1'));var zipdir=require(_0x04da('0x2'));var jsonpatch=require(_0x04da('0x3'));var rp=require(_0x04da('0x4'));var moment=require(_0x04da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x04da('0x6'));var util=require(_0x04da('0x7'));var path=require(_0x04da('0x8'));var sox=require(_0x04da('0x9'));var csv=require(_0x04da('0xa'));var ejs=require(_0x04da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04da('0xc'));var crypto=require(_0x04da('0xd'));var jsforce=require(_0x04da('0xe'));var deskjs=require(_0x04da('0xf'));var toCsv=require(_0x04da('0xa'));var querystring=require(_0x04da('0x10'));var Papa=require(_0x04da('0x11'));var Redis=require(_0x04da('0x12'));var authService=require(_0x04da('0x13'));var qs=require(_0x04da('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04da('0x15'));var logger=require(_0x04da('0x16'))(_0x04da('0x17'));var utils=require(_0x04da('0x18'));var config=require(_0x04da('0x19'));var licenseUtil=require(_0x04da('0x1a'));var db=require(_0x04da('0x1b'))['db'];config[_0x04da('0x1c')]=_[_0x04da('0x1d')](config[_0x04da('0x1c')],{'host':_0x04da('0x1e'),'port':0x18eb});var socket=require(_0x04da('0x1f'))(new Redis(config['redis']));require(_0x04da('0x20'))[_0x04da('0x21')](socket);var jayson=require(_0x04da('0x22'));var client=jayson[_0x04da('0x23')][_0x04da('0x24')]({'port':0x232c});var client9002=jayson[_0x04da('0x23')][_0x04da('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x519a72,_0x21781c,_0x4ac531,_0x4e0444){return new BPromise(function(_0x5ae515,_0x588c92){var _0x59aff6=_0x4e0444||client;return _0x59aff6[_0x04da('0x25')](_0x519a72,_0x4ac531)[_0x04da('0x26')](function(_0x25f656){logger['info'](_0x04da('0x27'),_0x21781c,_0x04da('0x28'));logger[_0x04da('0x29')](_0x04da('0x2a'),_0x21781c,_0x04da('0x28'),JSON[_0x04da('0x2b')](_0x25f656));if(_0x25f656[_0x04da('0x2c')]){if(_0x25f656['error'][_0x04da('0x2d')]===0x1f4){logger[_0x04da('0x2c')]('WhatsappMessage,\x20%s,\x20%s',_0x21781c,_0x25f656['error'][_0x04da('0x2e')]);return _0x588c92(_0x25f656[_0x04da('0x2c')][_0x04da('0x2e')]);}logger[_0x04da('0x2c')](_0x04da('0x27'),_0x21781c,_0x25f656[_0x04da('0x2c')][_0x04da('0x2e')]);return _0x5ae515(_0x25f656[_0x04da('0x2c')][_0x04da('0x2e')]);}else{logger['info'](_0x04da('0x27'),_0x21781c,_0x04da('0x28'));_0x5ae515(_0x25f656['result']['message']);}})['catch'](function(_0x390651){logger['error'](_0x04da('0x27'),_0x21781c,_0x390651);_0x588c92(_0x390651);});});}function respondWithStatusCode(_0xbe4f1b,_0x452e2f){_0x452e2f=_0x452e2f||0xcc;return function(_0x40f4b5){if(_0x40f4b5){return _0xbe4f1b[_0x04da('0x2f')](_0x452e2f);}return _0xbe4f1b[_0x04da('0x30')](_0x452e2f)[_0x04da('0x31')]();};}function respondWithResult(_0x24452d,_0x4d5c90){_0x4d5c90=_0x4d5c90||0xc8;return function(_0x3f7008){if(_0x3f7008){return _0x24452d[_0x04da('0x30')](_0x4d5c90)[_0x04da('0x32')](_0x3f7008);}};}function respondWithFilteredResult(_0x5219bd,_0x25f828){return function(_0x4caaf7){if(_0x4caaf7){var _0x3d6a0c=typeof _0x25f828['offset']===_0x04da('0x33')&&typeof _0x25f828[_0x04da('0x34')]==='undefined';var _0x5bb3a2=_0x4caaf7[_0x04da('0x35')];var _0x1b8e65=_0x3d6a0c?0x0:_0x25f828[_0x04da('0x36')];var _0xddc74d=_0x3d6a0c?_0x4caaf7[_0x04da('0x35')]:_0x25f828[_0x04da('0x36')]+_0x25f828[_0x04da('0x34')];var _0x3e8c32;if(_0xddc74d>=_0x5bb3a2){_0xddc74d=_0x5bb3a2;_0x3e8c32=0xc8;}else{_0x3e8c32=0xce;}_0x5219bd[_0x04da('0x30')](_0x3e8c32);return _0x5219bd[_0x04da('0x37')](_0x04da('0x38'),_0x1b8e65+'-'+_0xddc74d+'/'+_0x5bb3a2)[_0x04da('0x32')](_0x4caaf7);}return null;};}function patchUpdates(_0x447e8e){return function(_0x20f775){try{jsonpatch[_0x04da('0x39')](_0x20f775,_0x447e8e,!![]);}catch(_0x22240e){return BPromise[_0x04da('0x3a')](_0x22240e);}return _0x20f775[_0x04da('0x3b')]();};}function saveUpdates(_0x1780a8,_0x19b1bc){return function(_0x238e57){if(_0x238e57){return _0x238e57['update'](_0x1780a8)['then'](function(_0x512c7c){return _0x512c7c;});}return null;};}function removeEntity(_0x16f3b4,_0x12ec7a){return function(_0x4ff14a){if(_0x4ff14a){return _0x4ff14a['destroy']()['then'](function(){_0x16f3b4[_0x04da('0x30')](0xcc)[_0x04da('0x31')]();});}};}function handleEntityNotFound(_0x5c6bad,_0x74a920){return function(_0x530a5b){if(!_0x530a5b){_0x5c6bad[_0x04da('0x2f')](0x194);}return _0x530a5b;};}function handleError(_0x3202b1,_0x2d80f4){_0x2d80f4=_0x2d80f4||0x1f4;return function(_0x3f9963){logger['error'](_0x3f9963[_0x04da('0x3c')]);if(_0x3f9963[_0x04da('0x3d')]){delete _0x3f9963[_0x04da('0x3d')];}_0x3202b1[_0x04da('0x30')](_0x2d80f4)['send'](_0x3f9963);};}exports['index']=function(_0x528986,_0x25f5fe){var _0x2c3a5f={},_0x1c35e5={},_0x2d66f8={'count':0x0,'rows':[]};var _0x3437e2=_[_0x04da('0x3e')](db[_0x04da('0x3f')][_0x04da('0x40')],function(_0x584687){return{'name':_0x584687[_0x04da('0x41')],'type':_0x584687[_0x04da('0x42')][_0x04da('0x43')]};});_0x1c35e5['model']=_[_0x04da('0x3e')](_0x3437e2,_0x04da('0x3d'));_0x1c35e5[_0x04da('0x44')]=_[_0x04da('0x45')](_0x528986[_0x04da('0x44')]);_0x1c35e5['filters']=_[_0x04da('0x46')](_0x1c35e5['model'],_0x1c35e5['query']);_0x2c3a5f[_0x04da('0x47')]=_[_0x04da('0x46')](_0x1c35e5[_0x04da('0x48')],qs['fields'](_0x528986[_0x04da('0x44')][_0x04da('0x49')]));_0x2c3a5f[_0x04da('0x47')]=_0x2c3a5f[_0x04da('0x47')][_0x04da('0x4a')]?_0x2c3a5f[_0x04da('0x47')]:_0x1c35e5['model'];if(!_0x528986[_0x04da('0x44')][_0x04da('0x4b')](_0x04da('0x4c'))){_0x2c3a5f['limit']=qs[_0x04da('0x34')](_0x528986[_0x04da('0x44')]['limit']);_0x2c3a5f[_0x04da('0x36')]=qs[_0x04da('0x36')](_0x528986[_0x04da('0x44')][_0x04da('0x36')]);}_0x2c3a5f[_0x04da('0x4d')]=qs[_0x04da('0x4e')](_0x528986[_0x04da('0x44')]['sort']);_0x2c3a5f[_0x04da('0x4f')]=qs[_0x04da('0x50')](_['pick'](_0x528986[_0x04da('0x44')],_0x1c35e5[_0x04da('0x50')]),_0x3437e2);if(_0x528986['query'][_0x04da('0x51')]){_0x2c3a5f[_0x04da('0x4f')]=_[_0x04da('0x52')](_0x2c3a5f[_0x04da('0x4f')],{'$or':_[_0x04da('0x3e')](_0x3437e2,function(_0x2ff7c8){if(_0x2ff7c8[_0x04da('0x42')]!==_0x04da('0x53')){var _0x32513f={};_0x32513f[_0x2ff7c8[_0x04da('0x3d')]]={'$like':'%'+_0x528986[_0x04da('0x44')]['filter']+'%'};return _0x32513f;}})});}_0x2c3a5f=_[_0x04da('0x52')]({},_0x2c3a5f,_0x528986[_0x04da('0x54')]);var _0x267ed7={'where':_0x2c3a5f['where']};return db[_0x04da('0x3f')]['count'](_0x267ed7)[_0x04da('0x26')](function(_0x160125){_0x2d66f8[_0x04da('0x35')]=_0x160125;if(_0x528986['query']['includeAll']){_0x2c3a5f[_0x04da('0x55')]=[{'all':!![]}];}return db[_0x04da('0x3f')][_0x04da('0x56')](_0x2c3a5f);})['then'](function(_0x2f09e8){_0x2d66f8[_0x04da('0x57')]=_0x2f09e8;return _0x2d66f8;})['then'](respondWithFilteredResult(_0x25f5fe,_0x2c3a5f))['catch'](handleError(_0x25f5fe,null));};exports[_0x04da('0x58')]=function(_0x37cb75,_0x47d96d){var _0x4eb457={'raw':!![],'where':{'id':_0x37cb75[_0x04da('0x59')]['id']}},_0x2b4902={};_0x2b4902[_0x04da('0x48')]=_[_0x04da('0x45')](db[_0x04da('0x3f')][_0x04da('0x40')]);_0x2b4902[_0x04da('0x44')]=_['keys'](_0x37cb75[_0x04da('0x44')]);_0x2b4902['filters']=_[_0x04da('0x46')](_0x2b4902[_0x04da('0x48')],_0x2b4902[_0x04da('0x44')]);_0x4eb457[_0x04da('0x47')]=_[_0x04da('0x46')](_0x2b4902[_0x04da('0x48')],qs['fields'](_0x37cb75[_0x04da('0x44')][_0x04da('0x49')]));_0x4eb457[_0x04da('0x47')]=_0x4eb457['attributes'][_0x04da('0x4a')]?_0x4eb457['attributes']:_0x2b4902['model'];if(_0x37cb75[_0x04da('0x44')]['includeAll']){_0x4eb457[_0x04da('0x55')]=[{'all':!![]}];}_0x4eb457=_['merge']({},_0x4eb457,_0x37cb75[_0x04da('0x54')]);return db[_0x04da('0x3f')]['find'](_0x4eb457)[_0x04da('0x26')](handleEntityNotFound(_0x47d96d,null))[_0x04da('0x26')](respondWithResult(_0x47d96d,null))['catch'](handleError(_0x47d96d,null));};exports['create']=function(_0x1d893a,_0x5d86){return db[_0x04da('0x3f')]['create'](_0x1d893a[_0x04da('0x5a')],{})[_0x04da('0x26')](respondWithResult(_0x5d86,0xc9))[_0x04da('0x5b')](handleError(_0x5d86,null));};exports[_0x04da('0x5c')]=function(_0x5e0185,_0x291392){if(_0x5e0185[_0x04da('0x5a')]['id']){delete _0x5e0185[_0x04da('0x5a')]['id'];}return db[_0x04da('0x3f')][_0x04da('0x5d')]({'where':{'id':_0x5e0185['params']['id']}})[_0x04da('0x26')](handleEntityNotFound(_0x291392,null))[_0x04da('0x26')](saveUpdates(_0x5e0185[_0x04da('0x5a')],null))[_0x04da('0x26')](respondWithResult(_0x291392,null))['catch'](handleError(_0x291392,null));};exports[_0x04da('0x5e')]=function(_0x309954,_0x3f019d){return db[_0x04da('0x3f')][_0x04da('0x5d')]({'where':{'id':_0x309954[_0x04da('0x59')]['id']}})[_0x04da('0x26')](handleEntityNotFound(_0x3f019d,null))['then'](removeEntity(_0x3f019d,null))[_0x04da('0x5b')](handleError(_0x3f019d,null));};exports[_0x04da('0x5f')]=function(_0x4f70aa,_0x3b56cc){return db['WhatsappMessage'][_0x04da('0x5f')]()[_0x04da('0x26')](respondWithResult(_0x3b56cc,null))[_0x04da('0x5b')](handleError(_0x3b56cc,null));};var interaction_log=require(_0x04da('0x16'))('whatsapp-interactions');exports['accept']=function(_0x4ca737,_0x23fb28,_0x2d0082){var _0x51dd8c={'agent':{},'channel':'whatsapp'};if(_0x4ca737[_0x04da('0x5a')]['id']){delete _0x4ca737[_0x04da('0x5a')]['id'];}_0x4ca737['body'][_0x04da('0x60')]=!![];_0x4ca737[_0x04da('0x5a')][_0x04da('0x61')]=moment()[_0x04da('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ca737['body'][_0x04da('0x63')]=_0x4ca737['body'][_0x04da('0x63')]||_0x4ca737[_0x04da('0x64')]['id'];_0x51dd8c['agent']['id']=_0x4ca737['body'][_0x04da('0x63')];return db[_0x04da('0x3f')][_0x04da('0x5d')]({'where':{'id':_0x4ca737[_0x04da('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x23fb28,null))['then'](saveUpdates(_0x4ca737[_0x04da('0x5a')],null))[_0x04da('0x26')](function(_0x22e98d){if(_0x22e98d){_0x51dd8c[_0x04da('0x2e')]=_0x22e98d[_0x04da('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0x04da('0x5d')]({'where':{'id':_0x22e98d['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x23fb28,null))[_0x04da('0x26')](function(_0x1ee7e7){if(_0x1ee7e7){return _0x1ee7e7[_0x04da('0x5c')]({'UserId':_0x4ca737[_0x04da('0x5a')][_0x04da('0x63')],'read1stAt':_['isNil'](_0x1ee7e7[_0x04da('0x66')])?moment()[_0x04da('0x62')](_0x04da('0x67')):undefined});}return null;})[_0x04da('0x26')](function(_0xac185c){if(_0xac185c){_0x51dd8c[_0x04da('0x68')]=_0xac185c[_0x04da('0x65')]({'plain':!![]});interaction_log[_0x04da('0x69')](_0x04da('0x6a'),_0x4ca737[_0x04da('0x64')]['id'],_0x4ca737[_0x04da('0x64')]['name'],_0x4ca737[_0x04da('0x64')][_0x04da('0x6b')],_0x51dd8c[_0x04da('0x68')]['id'],_0x4ca737[_0x04da('0x5a')]?JSON['stringify'](_0x4ca737[_0x04da('0x5a')]):'null');return respondWithRpcPromise(_0x04da('0x6c'),_0x04da('0x6d'),_0x51dd8c);}return null;})[_0x04da('0x26')](function(_0x618c73){var _0x54da8d=_0x04da('0x6e')+_0x618c73['message'][_0x04da('0x6f')];return db['sequelize']['query'](_0x54da8d,{'type':db[_0x04da('0x70')][_0x04da('0x71')][_0x04da('0x72')],'raw':!![]})[_0x04da('0x26')](function(_0x2236b4){return _0x2236b4;});})[_0x04da('0x26')](function(_0x54003f){if(_0x54003f){_0x51dd8c['message']['contact']=_0x54003f[0x0];if(!_0x4ca737['body'][_0x04da('0x63')])return;return db[_0x04da('0x73')][_0x04da('0x5d')]({'where':{'id':_0x4ca737['body'][_0x04da('0x63')],'role':_0x04da('0x74')},'attributes':['id',_0x04da('0x3d'),_0x04da('0x75'),_0x04da('0x76'),'internal'],'raw':!![]});}return null;})[_0x04da('0x26')](function(_0x5c9d4a){if(!_0x5c9d4a)return null;_0x51dd8c[_0x04da('0x2e')][_0x04da('0x74')]=_0x5c9d4a;return _0x51dd8c;})[_0x04da('0x26')](function(_0x5817c4){if(_0x5817c4){if(_0x4ca737['body'][_0x04da('0x77')]){_0x51dd8c[_0x04da('0x2e')][_0x04da('0x78')]=util[_0x04da('0x62')](_0x04da('0x79'),_0x4ca737[_0x04da('0x64')][_0x04da('0x3d')]);_0x51dd8c[_0x04da('0x2e')][_0x04da('0x7a')]=_0x51dd8c[_0x04da('0x7a')];_0x51dd8c[_0x04da('0x2e')][_0x04da('0x7b')]=_0x51dd8c[_0x04da('0x7a')];_0x51dd8c['message'][_0x04da('0x7c')]=_0x04da('0x7d');return respondWithRpcPromise('EventManager',_0x04da('0x7e'),{'event':_0x04da('0x7f'),'message':_0x51dd8c[_0x04da('0x2e')]},client9002)['then'](function(){return _0x51dd8c;});}return _0x51dd8c;}return null;})[_0x04da('0x26')](respondWithResult(_0x23fb28,null))[_0x04da('0x5b')](handleError(_0x23fb28,null));};var interaction_log=require(_0x04da('0x16'))(_0x04da('0x80'));exports[_0x04da('0x3a')]=function(_0x750014,_0x392666,_0x37e146){var _0x3820e9={'agent':{},'channel':_0x04da('0x81')};if(_0x750014[_0x04da('0x5a')]['id']){delete _0x750014[_0x04da('0x5a')]['id'];}_0x750014[_0x04da('0x5a')]['UserId']=_0x750014[_0x04da('0x5a')][_0x04da('0x63')]||_0x750014[_0x04da('0x64')]['id'];_0x3820e9['agent']['id']=_0x750014['body'][_0x04da('0x63')];return db[_0x04da('0x3f')][_0x04da('0x5d')]({'where':{'id':_0x750014['params']['id'],'UserId':null}})[_0x04da('0x26')](handleEntityNotFound(_0x392666,null))['then'](function(_0x5f15d6){if(_0x5f15d6){_0x3820e9[_0x04da('0x2e')]=_0x5f15d6[_0x04da('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0x04da('0x5d')]({'where':{'id':_0x5f15d6[_0x04da('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x392666,null))[_0x04da('0x26')](function(_0xf4d160){if(_0xf4d160){_0x3820e9['interaction']=_0xf4d160['get']({'plain':!![]});interaction_log[_0x04da('0x69')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x750014[_0x04da('0x64')]['id'],_0x750014[_0x04da('0x64')][_0x04da('0x3d')],_0x750014['user'][_0x04da('0x6b')],_0x3820e9[_0x04da('0x68')]['id'],_0x750014[_0x04da('0x5a')]?JSON[_0x04da('0x2b')](_0x750014[_0x04da('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0x04da('0x83'),_0x3820e9);}return null;})[_0x04da('0x26')](function(_0x53099e){var _0x555259='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53099e['message'][_0x04da('0x6f')];return db['sequelize']['query'](_0x555259,{'type':db[_0x04da('0x70')][_0x04da('0x71')][_0x04da('0x72')],'raw':!![]})[_0x04da('0x26')](function(_0x44921f){return _0x44921f;});})[_0x04da('0x26')](function(_0x2c5ac6){if(_0x2c5ac6){_0x3820e9['message'][_0x04da('0x84')]=_0x2c5ac6[0x0];if(!_0x750014['body']['UserId'])return;return db['User'][_0x04da('0x5d')]({'where':{'id':_0x750014[_0x04da('0x5a')]['UserId'],'role':_0x04da('0x74')},'attributes':['id','name','fullname',_0x04da('0x76'),'internal'],'raw':!![]});}return null;})[_0x04da('0x26')](function(_0x347ed7){if(!_0x347ed7)return null;_0x3820e9[_0x04da('0x2e')][_0x04da('0x74')]=_0x347ed7;return _0x3820e9;})[_0x04da('0x26')](function(_0x58355b){if(_0x58355b){_0x58355b[_0x04da('0x2e')][_0x04da('0x78')]=util[_0x04da('0x62')]('SIP/%s',_0x750014[_0x04da('0x64')][_0x04da('0x3d')]);_0x58355b[_0x04da('0x2e')][_0x04da('0x7a')]=_0x3820e9[_0x04da('0x7a')];_0x58355b['message'][_0x04da('0x7b')]=_0x3820e9['channel'];_0x58355b[_0x04da('0x2e')][_0x04da('0x7c')]='reject';respondWithRpcPromise(_0x04da('0x7e'),_0x04da('0x7e'),{'event':'rejectmessage','message':_0x58355b[_0x04da('0x2e')]},client9002);return _0x3820e9;}return null;})[_0x04da('0x26')](respondWithResult(_0x392666,null))[_0x04da('0x5b')](handleError(_0x392666,null));};exports['status']=function(_0x533cbd,_0x5e9764,_0x53fd9d){if(_0x533cbd[_0x04da('0x5a')]['id']){delete _0x533cbd[_0x04da('0x5a')]['id'];}var _0x33d9a1;return db[_0x04da('0x3f')]['find']({'where':{'id':_0x533cbd['params']['id']}})[_0x04da('0x26')](handleEntityNotFound(_0x5e9764,null))[_0x04da('0x26')](function(_0x42d150){if(_0x42d150){_0x33d9a1=_0x42d150;return db[_0x04da('0x85')][_0x04da('0x5d')]({'where':{'id':_0x42d150[_0x04da('0x86')]}});}})[_0x04da('0x26')](handleEntityNotFound(_0x5e9764,null))[_0x04da('0x26')](function(_0xcf13c3){if(_0xcf13c3){logger['debug'](_0x04da('0x87'),_0x04da('0x30'),'received\x20delivery\x20report\x20from',_0xcf13c3[_0x04da('0x42')],util[_0x04da('0x88')](_0x533cbd[_0x04da('0x5a')],{'showHidden':![],'depth':null}));switch(_0xcf13c3[_0x04da('0x42')]){case _0x04da('0x89'):if(_0x533cbd['body'][_0x04da('0x8a')]&&_0x533cbd[_0x04da('0x5a')][_0x04da('0x8a')]===_0x33d9a1[_0x04da('0x8b')]&&_0x533cbd[_0x04da('0x5a')][_0x04da('0x8c')]&&_0x533cbd[_0x04da('0x5a')]['MessageStatus']===_0x04da('0x60')){return _0x33d9a1[_0x04da('0x5c')]({'read':!![]});}else{logger[_0x04da('0x2c')](_0x04da('0x8d'),'status',_0x04da('0x89'),util['inspect'](_0x533cbd[_0x04da('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x33d9a1;}})[_0x04da('0x26')](respondWithResult(_0x5e9764,null))[_0x04da('0x5b')](handleError(_0x5e9764,null));}; \ No newline at end of file +var _0x2dc9=['null','RejectMessage','rejectMessage','Sequelize','User','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageStatus','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','params','merge','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2dc9,0x11d));var _0x92dc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2dc9[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x92dc('0x0'));var rimraf=require(_0x92dc('0x1'));var zipdir=require(_0x92dc('0x2'));var jsonpatch=require(_0x92dc('0x3'));var rp=require(_0x92dc('0x4'));var moment=require(_0x92dc('0x5'));var BPromise=require(_0x92dc('0x6'));var Mustache=require(_0x92dc('0x7'));var util=require(_0x92dc('0x8'));var path=require(_0x92dc('0x9'));var sox=require('sox');var csv=require(_0x92dc('0xa'));var ejs=require(_0x92dc('0xb'));var fs=require('fs');var fs_extra=require(_0x92dc('0xc'));var _=require(_0x92dc('0xd'));var squel=require(_0x92dc('0xe'));var crypto=require('crypto');var jsforce=require(_0x92dc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x92dc('0xa'));var querystring=require('querystring');var Papa=require(_0x92dc('0x10'));var Redis=require('ioredis');var authService=require(_0x92dc('0x11'));var qs=require(_0x92dc('0x12'));var as=require(_0x92dc('0x13'));var hardwareService=require(_0x92dc('0x14'));var logger=require(_0x92dc('0x15'))('api');var utils=require(_0x92dc('0x16'));var config=require(_0x92dc('0x17'));var licenseUtil=require(_0x92dc('0x18'));var db=require(_0x92dc('0x19'))['db'];config['redis']=_[_0x92dc('0x1a')](config['redis'],{'host':_0x92dc('0x1b'),'port':0x18eb});var socket=require(_0x92dc('0x1c'))(new Redis(config[_0x92dc('0x1d')]));require(_0x92dc('0x1e'))['register'](socket);var jayson=require(_0x92dc('0x1f'));var client=jayson['client'][_0x92dc('0x20')]({'port':0x232c});var client9002=jayson[_0x92dc('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8ce4cc,_0xdbc19,_0x8e2076,_0x579495){return new BPromise(function(_0x33e7e9,_0x377a6d){var _0x269840=_0x579495||client;return _0x269840['request'](_0x8ce4cc,_0x8e2076)[_0x92dc('0x22')](function(_0x2fd2ba){logger[_0x92dc('0x23')](_0x92dc('0x24'),_0xdbc19,_0x92dc('0x25'));logger[_0x92dc('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdbc19,'request\x20sent',JSON['stringify'](_0x2fd2ba));if(_0x2fd2ba['error']){if(_0x2fd2ba[_0x92dc('0x27')][_0x92dc('0x28')]===0x1f4){logger['error'](_0x92dc('0x24'),_0xdbc19,_0x2fd2ba[_0x92dc('0x27')][_0x92dc('0x29')]);return _0x377a6d(_0x2fd2ba[_0x92dc('0x27')][_0x92dc('0x29')]);}logger['error'](_0x92dc('0x24'),_0xdbc19,_0x2fd2ba[_0x92dc('0x27')]['message']);return _0x33e7e9(_0x2fd2ba[_0x92dc('0x27')]['message']);}else{logger[_0x92dc('0x23')](_0x92dc('0x24'),_0xdbc19,_0x92dc('0x25'));_0x33e7e9(_0x2fd2ba[_0x92dc('0x2a')]['message']);}})[_0x92dc('0x2b')](function(_0x272792){logger[_0x92dc('0x27')](_0x92dc('0x24'),_0xdbc19,_0x272792);_0x377a6d(_0x272792);});});}function respondWithStatusCode(_0x5ee933,_0x4c17ad){_0x4c17ad=_0x4c17ad||0xcc;return function(_0x2e6893){if(_0x2e6893){return _0x5ee933['sendStatus'](_0x4c17ad);}return _0x5ee933[_0x92dc('0x2c')](_0x4c17ad)['end']();};}function respondWithResult(_0x56b985,_0x4e4fee){_0x4e4fee=_0x4e4fee||0xc8;return function(_0x52c711){if(_0x52c711){return _0x56b985[_0x92dc('0x2c')](_0x4e4fee)['json'](_0x52c711);}};}function respondWithFilteredResult(_0x93c6dc,_0x484388){return function(_0x4c4f21){if(_0x4c4f21){var _0x30c92d=typeof _0x484388[_0x92dc('0x2d')]===_0x92dc('0x2e')&&typeof _0x484388['limit']===_0x92dc('0x2e');var _0x2690e4=_0x4c4f21[_0x92dc('0x2f')];var _0x4c1f53=_0x30c92d?0x0:_0x484388['offset'];var _0x4bd7eb=_0x30c92d?_0x4c4f21[_0x92dc('0x2f')]:_0x484388['offset']+_0x484388[_0x92dc('0x30')];var _0x451bf2;if(_0x4bd7eb>=_0x2690e4){_0x4bd7eb=_0x2690e4;_0x451bf2=0xc8;}else{_0x451bf2=0xce;}_0x93c6dc[_0x92dc('0x2c')](_0x451bf2);return _0x93c6dc[_0x92dc('0x31')](_0x92dc('0x32'),_0x4c1f53+'-'+_0x4bd7eb+'/'+_0x2690e4)[_0x92dc('0x33')](_0x4c4f21);}return null;};}function patchUpdates(_0x1cae32){return function(_0x31cc78){try{jsonpatch[_0x92dc('0x34')](_0x31cc78,_0x1cae32,!![]);}catch(_0x284a86){return BPromise[_0x92dc('0x35')](_0x284a86);}return _0x31cc78['save']();};}function saveUpdates(_0x11d19a,_0x140ecb){return function(_0x3f1690){if(_0x3f1690){return _0x3f1690[_0x92dc('0x36')](_0x11d19a)[_0x92dc('0x22')](function(_0x1cc2fa){return _0x1cc2fa;});}return null;};}function removeEntity(_0xb4b489,_0x33b77f){return function(_0x38680d){if(_0x38680d){return _0x38680d[_0x92dc('0x37')]()[_0x92dc('0x22')](function(){_0xb4b489[_0x92dc('0x2c')](0xcc)[_0x92dc('0x38')]();});}};}function handleEntityNotFound(_0x47cd7d,_0x26f593){return function(_0x50a9c8){if(!_0x50a9c8){_0x47cd7d[_0x92dc('0x39')](0x194);}return _0x50a9c8;};}function handleError(_0x3dde4a,_0x1fa382){_0x1fa382=_0x1fa382||0x1f4;return function(_0x5ba2c1){logger['error'](_0x5ba2c1[_0x92dc('0x3a')]);if(_0x5ba2c1[_0x92dc('0x3b')]){delete _0x5ba2c1[_0x92dc('0x3b')];}_0x3dde4a[_0x92dc('0x2c')](_0x1fa382)[_0x92dc('0x3c')](_0x5ba2c1);};}exports[_0x92dc('0x3d')]=function(_0x14d370,_0x581631){var _0x1ebcc9={},_0x3b0913={},_0x15e1f8={'count':0x0,'rows':[]};var _0x1934a9=_[_0x92dc('0x3e')](db[_0x92dc('0x3f')]['rawAttributes'],function(_0x4f0420){return{'name':_0x4f0420[_0x92dc('0x40')],'type':_0x4f0420[_0x92dc('0x41')][_0x92dc('0x42')]};});_0x3b0913[_0x92dc('0x43')]=_[_0x92dc('0x3e')](_0x1934a9,_0x92dc('0x3b'));_0x3b0913[_0x92dc('0x44')]=_[_0x92dc('0x45')](_0x14d370[_0x92dc('0x44')]);_0x3b0913['filters']=_[_0x92dc('0x46')](_0x3b0913[_0x92dc('0x43')],_0x3b0913['query']);_0x1ebcc9[_0x92dc('0x47')]=_[_0x92dc('0x46')](_0x3b0913[_0x92dc('0x43')],qs[_0x92dc('0x48')](_0x14d370[_0x92dc('0x44')][_0x92dc('0x48')]));_0x1ebcc9[_0x92dc('0x47')]=_0x1ebcc9['attributes']['length']?_0x1ebcc9['attributes']:_0x3b0913[_0x92dc('0x43')];if(!_0x14d370[_0x92dc('0x44')][_0x92dc('0x49')]('nolimit')){_0x1ebcc9[_0x92dc('0x30')]=qs[_0x92dc('0x30')](_0x14d370[_0x92dc('0x44')]['limit']);_0x1ebcc9[_0x92dc('0x2d')]=qs[_0x92dc('0x2d')](_0x14d370[_0x92dc('0x44')][_0x92dc('0x2d')]);}_0x1ebcc9['order']=qs[_0x92dc('0x4a')](_0x14d370['query'][_0x92dc('0x4a')]);_0x1ebcc9[_0x92dc('0x4b')]=qs[_0x92dc('0x4c')](_['pick'](_0x14d370[_0x92dc('0x44')],_0x3b0913[_0x92dc('0x4c')]),_0x1934a9);if(_0x14d370[_0x92dc('0x44')][_0x92dc('0x4d')]){_0x1ebcc9[_0x92dc('0x4b')]=_['merge'](_0x1ebcc9['where'],{'$or':_[_0x92dc('0x3e')](_0x1934a9,function(_0x175746){if(_0x175746['type']!==_0x92dc('0x4e')){var _0x7e1142={};_0x7e1142[_0x175746[_0x92dc('0x3b')]]={'$like':'%'+_0x14d370['query']['filter']+'%'};return _0x7e1142;}})});}_0x1ebcc9=_['merge']({},_0x1ebcc9,_0x14d370[_0x92dc('0x4f')]);var _0x27d000={'where':_0x1ebcc9[_0x92dc('0x4b')]};return db['WhatsappMessage']['count'](_0x27d000)['then'](function(_0x381dea){_0x15e1f8[_0x92dc('0x2f')]=_0x381dea;if(_0x14d370['query'][_0x92dc('0x50')]){_0x1ebcc9[_0x92dc('0x51')]=[{'all':!![]}];}return db[_0x92dc('0x3f')]['findAll'](_0x1ebcc9);})[_0x92dc('0x22')](function(_0x59ad5d){_0x15e1f8[_0x92dc('0x52')]=_0x59ad5d;return _0x15e1f8;})[_0x92dc('0x22')](respondWithFilteredResult(_0x581631,_0x1ebcc9))[_0x92dc('0x2b')](handleError(_0x581631,null));};exports['show']=function(_0x8a292,_0x1c0011){var _0x22c33b={'raw':!![],'where':{'id':_0x8a292[_0x92dc('0x53')]['id']}},_0x3e7cb4={};_0x3e7cb4[_0x92dc('0x43')]=_[_0x92dc('0x45')](db[_0x92dc('0x3f')]['rawAttributes']);_0x3e7cb4[_0x92dc('0x44')]=_['keys'](_0x8a292['query']);_0x3e7cb4['filters']=_[_0x92dc('0x46')](_0x3e7cb4[_0x92dc('0x43')],_0x3e7cb4[_0x92dc('0x44')]);_0x22c33b['attributes']=_[_0x92dc('0x46')](_0x3e7cb4[_0x92dc('0x43')],qs[_0x92dc('0x48')](_0x8a292['query']['fields']));_0x22c33b['attributes']=_0x22c33b['attributes']['length']?_0x22c33b[_0x92dc('0x47')]:_0x3e7cb4[_0x92dc('0x43')];if(_0x8a292[_0x92dc('0x44')][_0x92dc('0x50')]){_0x22c33b[_0x92dc('0x51')]=[{'all':!![]}];}_0x22c33b=_[_0x92dc('0x54')]({},_0x22c33b,_0x8a292[_0x92dc('0x4f')]);return db[_0x92dc('0x3f')][_0x92dc('0x55')](_0x22c33b)[_0x92dc('0x22')](handleEntityNotFound(_0x1c0011,null))['then'](respondWithResult(_0x1c0011,null))['catch'](handleError(_0x1c0011,null));};exports[_0x92dc('0x56')]=function(_0x1242e1,_0xf9f099){return db[_0x92dc('0x3f')][_0x92dc('0x56')](_0x1242e1['body'],{})[_0x92dc('0x22')](respondWithResult(_0xf9f099,0xc9))[_0x92dc('0x2b')](handleError(_0xf9f099,null));};exports['update']=function(_0x402798,_0x43b60b){if(_0x402798[_0x92dc('0x57')]['id']){delete _0x402798['body']['id'];}return db['WhatsappMessage'][_0x92dc('0x55')]({'where':{'id':_0x402798[_0x92dc('0x53')]['id']}})[_0x92dc('0x22')](handleEntityNotFound(_0x43b60b,null))['then'](saveUpdates(_0x402798['body'],null))[_0x92dc('0x22')](respondWithResult(_0x43b60b,null))[_0x92dc('0x2b')](handleError(_0x43b60b,null));};exports[_0x92dc('0x37')]=function(_0x1f3f35,_0x50e25e){return db['WhatsappMessage'][_0x92dc('0x55')]({'where':{'id':_0x1f3f35[_0x92dc('0x53')]['id']}})[_0x92dc('0x22')](handleEntityNotFound(_0x50e25e,null))[_0x92dc('0x22')](removeEntity(_0x50e25e,null))['catch'](handleError(_0x50e25e,null));};exports[_0x92dc('0x58')]=function(_0x2f8569,_0x15d96e){return db[_0x92dc('0x3f')]['describe']()['then'](respondWithResult(_0x15d96e,null))['catch'](handleError(_0x15d96e,null));};var interaction_log=require('../../config/logger')(_0x92dc('0x59'));exports[_0x92dc('0x5a')]=function(_0xc8aa50,_0x2659d7,_0x5ffb61){var _0x259db2={'agent':{},'channel':_0x92dc('0x5b')};if(_0xc8aa50[_0x92dc('0x57')]['id']){delete _0xc8aa50['body']['id'];}_0xc8aa50[_0x92dc('0x57')][_0x92dc('0x5c')]=!![];_0xc8aa50['body'][_0x92dc('0x5d')]=moment()[_0x92dc('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0xc8aa50[_0x92dc('0x57')][_0x92dc('0x5f')]=_0xc8aa50['body'][_0x92dc('0x5f')]||_0xc8aa50[_0x92dc('0x60')]['id'];_0x259db2[_0x92dc('0x61')]['id']=_0xc8aa50[_0x92dc('0x57')][_0x92dc('0x5f')];return db[_0x92dc('0x3f')][_0x92dc('0x55')]({'where':{'id':_0xc8aa50[_0x92dc('0x53')]['id'],'UserId':null}})[_0x92dc('0x22')](handleEntityNotFound(_0x2659d7,null))[_0x92dc('0x22')](saveUpdates(_0xc8aa50['body'],null))[_0x92dc('0x22')](function(_0x30dbb4){if(_0x30dbb4){_0x259db2[_0x92dc('0x29')]=_0x30dbb4['get']({'plain':!![]});return db[_0x92dc('0x62')][_0x92dc('0x55')]({'where':{'id':_0x30dbb4[_0x92dc('0x63')]}});}return null;})[_0x92dc('0x22')](handleEntityNotFound(_0x2659d7,null))[_0x92dc('0x22')](function(_0x37be03){if(_0x37be03){return _0x37be03['update']({'UserId':_0xc8aa50[_0x92dc('0x57')]['UserId'],'read1stAt':_[_0x92dc('0x64')](_0x37be03[_0x92dc('0x65')])?moment()[_0x92dc('0x5e')](_0x92dc('0x66')):undefined});}return null;})[_0x92dc('0x22')](function(_0x3ef422){if(_0x3ef422){_0x259db2[_0x92dc('0x67')]=_0x3ef422[_0x92dc('0x68')]({'plain':!![]});interaction_log[_0x92dc('0x23')](_0x92dc('0x69'),_0xc8aa50[_0x92dc('0x60')]['id'],_0xc8aa50[_0x92dc('0x60')]['name'],_0xc8aa50[_0x92dc('0x60')][_0x92dc('0x6a')],_0x259db2[_0x92dc('0x67')]['id'],_0xc8aa50[_0x92dc('0x57')]?JSON['stringify'](_0xc8aa50[_0x92dc('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0x92dc('0x6b'),_0x259db2);}return null;})[_0x92dc('0x22')](function(_0x4ffd64){var _0x252889=_0x92dc('0x6c')+_0x4ffd64[_0x92dc('0x29')][_0x92dc('0x6d')];return db[_0x92dc('0x6e')][_0x92dc('0x44')](_0x252889,{'type':db['Sequelize'][_0x92dc('0x6f')][_0x92dc('0x70')],'raw':!![]})[_0x92dc('0x22')](function(_0x1939a8){return _0x1939a8;});})[_0x92dc('0x22')](function(_0x48d9ab){if(_0x48d9ab){_0x259db2[_0x92dc('0x29')][_0x92dc('0x71')]=_0x48d9ab[0x0];if(!_0xc8aa50[_0x92dc('0x57')]['UserId'])return;return db['User'][_0x92dc('0x55')]({'where':{'id':_0xc8aa50[_0x92dc('0x57')][_0x92dc('0x5f')],'role':_0x92dc('0x61')},'attributes':['id','name',_0x92dc('0x72'),_0x92dc('0x73'),_0x92dc('0x74')],'raw':!![]});}return null;})[_0x92dc('0x22')](function(_0x3352f0){if(!_0x3352f0)return null;_0x259db2[_0x92dc('0x29')][_0x92dc('0x61')]=_0x3352f0;return _0x259db2;})[_0x92dc('0x22')](function(_0x2af833){if(_0x2af833){if(_0xc8aa50[_0x92dc('0x57')]['manual']){_0x259db2[_0x92dc('0x29')][_0x92dc('0x75')]=util[_0x92dc('0x5e')](_0x92dc('0x76'),_0xc8aa50[_0x92dc('0x60')][_0x92dc('0x3b')]);_0x259db2[_0x92dc('0x29')][_0x92dc('0x77')]=_0x259db2['channel'];_0x259db2[_0x92dc('0x29')][_0x92dc('0x78')]=_0x259db2[_0x92dc('0x77')];_0x259db2['message']['event']=_0x92dc('0x5a');return respondWithRpcPromise(_0x92dc('0x79'),_0x92dc('0x79'),{'event':'acceptmessage','message':_0x259db2['message']},client9002)[_0x92dc('0x22')](function(){return _0x259db2;});}return _0x259db2;}return null;})[_0x92dc('0x22')](respondWithResult(_0x2659d7,null))[_0x92dc('0x2b')](handleError(_0x2659d7,null));};var interaction_log=require(_0x92dc('0x15'))(_0x92dc('0x59'));exports['reject']=function(_0x2c0015,_0x4b0842,_0x18941b){var _0x242070={'agent':{},'channel':_0x92dc('0x5b')};if(_0x2c0015['body']['id']){delete _0x2c0015[_0x92dc('0x57')]['id'];}_0x2c0015['body'][_0x92dc('0x5f')]=_0x2c0015[_0x92dc('0x57')][_0x92dc('0x5f')]||_0x2c0015[_0x92dc('0x60')]['id'];_0x242070['agent']['id']=_0x2c0015['body'][_0x92dc('0x5f')];return db['WhatsappMessage']['find']({'where':{'id':_0x2c0015['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b0842,null))[_0x92dc('0x22')](function(_0x423d08){if(_0x423d08){_0x242070[_0x92dc('0x29')]=_0x423d08['get']({'plain':!![]});return db[_0x92dc('0x62')][_0x92dc('0x55')]({'where':{'id':_0x423d08[_0x92dc('0x63')]}});}return null;})[_0x92dc('0x22')](handleEntityNotFound(_0x4b0842,null))[_0x92dc('0x22')](function(_0x1e554c){if(_0x1e554c){_0x242070[_0x92dc('0x67')]=_0x1e554c[_0x92dc('0x68')]({'plain':!![]});interaction_log['info'](_0x92dc('0x7a'),_0x2c0015[_0x92dc('0x60')]['id'],_0x2c0015[_0x92dc('0x60')][_0x92dc('0x3b')],_0x2c0015[_0x92dc('0x60')]['role'],_0x242070[_0x92dc('0x67')]['id'],_0x2c0015['body']?JSON['stringify'](_0x2c0015[_0x92dc('0x57')]):_0x92dc('0x7b'));return respondWithRpcPromise(_0x92dc('0x7c'),_0x92dc('0x7d'),_0x242070);}return null;})['then'](function(_0x194856){var _0x359a4c=_0x92dc('0x6c')+_0x194856[_0x92dc('0x29')][_0x92dc('0x6d')];return db['sequelize']['query'](_0x359a4c,{'type':db[_0x92dc('0x7e')][_0x92dc('0x6f')][_0x92dc('0x70')],'raw':!![]})[_0x92dc('0x22')](function(_0x575883){return _0x575883;});})[_0x92dc('0x22')](function(_0x354460){if(_0x354460){_0x242070[_0x92dc('0x29')][_0x92dc('0x71')]=_0x354460[0x0];if(!_0x2c0015[_0x92dc('0x57')]['UserId'])return;return db[_0x92dc('0x7f')][_0x92dc('0x55')]({'where':{'id':_0x2c0015[_0x92dc('0x57')][_0x92dc('0x5f')],'role':_0x92dc('0x61')},'attributes':['id','name',_0x92dc('0x72'),_0x92dc('0x73'),_0x92dc('0x74')],'raw':!![]});}return null;})['then'](function(_0x299322){if(!_0x299322)return null;_0x242070[_0x92dc('0x29')][_0x92dc('0x61')]=_0x299322;return _0x242070;})[_0x92dc('0x22')](function(_0x15cde2){if(_0x15cde2){_0x15cde2[_0x92dc('0x29')][_0x92dc('0x75')]=util[_0x92dc('0x5e')](_0x92dc('0x76'),_0x2c0015[_0x92dc('0x60')][_0x92dc('0x3b')]);_0x15cde2[_0x92dc('0x29')][_0x92dc('0x77')]=_0x242070['channel'];_0x15cde2[_0x92dc('0x29')][_0x92dc('0x78')]=_0x242070[_0x92dc('0x77')];_0x15cde2[_0x92dc('0x29')][_0x92dc('0x80')]='reject';respondWithRpcPromise(_0x92dc('0x79'),'EventManager',{'event':'rejectmessage','message':_0x15cde2[_0x92dc('0x29')]},client9002);return _0x242070;}return null;})['then'](respondWithResult(_0x4b0842,null))[_0x92dc('0x2b')](handleError(_0x4b0842,null));};exports[_0x92dc('0x2c')]=function(_0x40ba94,_0x50cbcb,_0xdd5335){if(_0x40ba94[_0x92dc('0x57')]['id']){delete _0x40ba94[_0x92dc('0x57')]['id'];}var _0x516cae;return db[_0x92dc('0x3f')][_0x92dc('0x55')]({'where':{'id':_0x40ba94[_0x92dc('0x53')]['id']}})[_0x92dc('0x22')](handleEntityNotFound(_0x50cbcb,null))[_0x92dc('0x22')](function(_0x21ed40){if(_0x21ed40){_0x516cae=_0x21ed40;return db[_0x92dc('0x81')]['find']({'where':{'id':_0x21ed40[_0x92dc('0x82')]}});}})[_0x92dc('0x22')](handleEntityNotFound(_0x50cbcb,null))[_0x92dc('0x22')](function(_0x428180){if(_0x428180){logger[_0x92dc('0x26')](_0x92dc('0x83'),_0x92dc('0x2c'),'received\x20delivery\x20report\x20from',_0x428180[_0x92dc('0x41')],util[_0x92dc('0x84')](_0x40ba94[_0x92dc('0x57')],{'showHidden':![],'depth':null}));switch(_0x428180['type']){case'twilio':if(_0x40ba94[_0x92dc('0x57')]['MessageSid']&&_0x40ba94['body'][_0x92dc('0x85')]===_0x516cae['messageId']&&_0x40ba94[_0x92dc('0x57')][_0x92dc('0x86')]&&_0x40ba94[_0x92dc('0x57')]['MessageStatus']===_0x92dc('0x5c')){return _0x516cae[_0x92dc('0x36')]({'read':!![]});}else{logger[_0x92dc('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x92dc('0x87'),util[_0x92dc('0x84')](_0x40ba94['body'],{'showHidden':![],'depth':null}));}break;}return _0x516cae;}})[_0x92dc('0x22')](respondWithResult(_0x50cbcb,null))[_0x92dc('0x2b')](handleError(_0x50cbcb,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e0833be..c2823ea 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 _0xf45e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x54fc1f,_0x1703c2){var _0x53f699=function(_0x3fad74){while(--_0x3fad74){_0x54fc1f['push'](_0x54fc1f['shift']());}};_0x53f699(++_0x1703c2);}(_0xf45e,0x115));var _0xef45=function(_0x2e970a,_0x4f164f){_0x2e970a=_0x2e970a-0x0;var _0x37da77=_0xf45e[_0x2e970a];return _0x37da77;};'use strict';var EventEmitter=require(_0xef45('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xef45('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef45('0x2'),'afterUpdate':_0xef45('0x3'),'afterDestroy':_0xef45('0x4')};function emitEvent(_0x1e94ee){return function(_0x37772f,_0x8b048c,_0x3cd579){WhatsappMessageEvents[_0xef45('0x5')](_0x1e94ee+':'+_0x37772f['id'],_0x37772f);WhatsappMessageEvents[_0xef45('0x5')](_0x1e94ee,_0x37772f);_0x3cd579(null);};}for(var e in events){if(events[_0xef45('0x6')](e)){var event=events[e];WhatsappMessage[_0xef45('0x7')](e,emitEvent(event));}}module[_0xef45('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5423=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5423,0xe3));var _0x3542=function(_0x22797d,_0x4ca6bb){_0x22797d=_0x22797d-0x0;var _0x5ddc1b=_0x5423[_0x22797d];return _0x5ddc1b;};'use strict';var EventEmitter=require(_0x3542('0x0'));var WhatsappMessage=require(_0x3542('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3542('0x2')](0x0);var events={'afterCreate':_0x3542('0x3'),'afterUpdate':'update','afterDestroy':_0x3542('0x4')};function emitEvent(_0x1202d5){return function(_0xf0835,_0x2a1864,_0x54ea2f){WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5+':'+_0xf0835['id'],_0xf0835);WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5,_0xf0835);_0x54ea2f(null);};}for(var e in events){if(events[_0x3542('0x6')](e)){var event=events[e];WhatsappMessage[_0x3542('0x7')](e,emitEvent(event));}}module[_0x3542('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 907f625..8ff6163 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 _0xa215=['whatsapp:','remote','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa215,0x142));var _0x5a21=function(_0x49b78f,_0x1ccdf7){_0x49b78f=_0x49b78f-0x0;var _0x544d2=_0xa215[_0x49b78f];return _0x544d2;};'use strict';var _=require(_0x5a21('0x0'));var util=require('util');var logger=require(_0x5a21('0x1'))(_0x5a21('0x2'));var moment=require('moment');var BPromise=require(_0x5a21('0x3'));var rp=require('request-promise');var fetch=require(_0x5a21('0x4'));var fs=require('fs');var path=require(_0x5a21('0x5'));var rimraf=require(_0x5a21('0x6'));var config=require(_0x5a21('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x5a21('0x8')]=function(_0x3e0792,_0x2ad7be){return _0x3e0792[_0x5a21('0x9')](_0x5a21('0xa'),attributes,{'tableName':_0x5a21('0xb'),'paranoid':![],'indexes':[{'name':_0x5a21('0xc'),'fields':[_0x5a21('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x5a21('0xd')],'type':_0x5a21('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x214909,_0x59012e,_0x59da9c){var _0x22666f=_0x3e0792[_0x5a21('0xf')];var _0x199fd6=_0x214909[_0x5a21('0x10')]({'plain':!![]});if(_0x199fd6['direction'][_0x5a21('0x11')]()==='in'||_0x199fd6[_0x5a21('0x12')][_0x5a21('0x11')]()==='out'&&!_0x199fd6[_0x5a21('0x13')]&&!_[_0x5a21('0x14')](_0x199fd6['UserId'])){_0x22666f[_0x5a21('0x15')][_0x5a21('0x16')]({'where':{'id':_0x199fd6[_0x5a21('0x17')]}})[_0x5a21('0x18')](function(_0x489806){if(_0x489806){_0x489806['update']({'lastMsgAt':_0x199fd6[_0x5a21('0x19')],'lastMsgDirection':_0x199fd6[_0x5a21('0x12')][_0x5a21('0x11')]()});}})[_0x5a21('0x1a')](function(_0x57c74a){console[_0x5a21('0x1b')](_0x57c74a);});}if(_0x199fd6[_0x5a21('0x12')]==='out'&&!_0x199fd6['secret']){var _0xf2ec12;_0x22666f[_0x5a21('0x1c')][_0x5a21('0x1d')]({'where':{'id':_0x199fd6[_0x5a21('0x1e')]},'raw':!![]})[_0x5a21('0x18')](function(_0x26db84){_0xf2ec12=_0x26db84;if(_0xf2ec12&&_0xf2ec12[_0x5a21('0x1f')]){switch(_0xf2ec12[_0x5a21('0x1f')]){case _0x5a21('0x20'):var _0x369c38=require(_0x5a21('0x20'));if(_0xf2ec12['accountSid']&&_0xf2ec12[_0x5a21('0x21')]&&_0xf2ec12[_0x5a21('0x22')]){var _0x1b24e2=new _0x369c38(_0xf2ec12[_0x5a21('0x23')],_0xf2ec12[_0x5a21('0x21')]);_0x1b24e2[_0x5a21('0x24')][_0x5a21('0x25')]({'body':_0x199fd6[_0x5a21('0xd')],'to':_0x5a21('0x26')+_0x199fd6[_0x5a21('0x22')],'from':_0x5a21('0x26')+_0xf2ec12[_0x5a21('0x22')],'statusCallback':_0xf2ec12[_0x5a21('0x27')]+'/api/whatsapp/messages/'+_0x199fd6['id']+_0x5a21('0x28')+_0xf2ec12['token']})[_0x5a21('0x18')](function(_0x5e0f0b){if(_0x5e0f0b[_0x5a21('0x29')]){return _0x214909['update']({'messageId':_0x5e0f0b['sid']});}})[_0x5a21('0x1a')](function(_0x2763d9){logger['error'](_0x5a21('0x2a'),'afterCreate','twilio',util[_0x5a21('0x2b')](_0x2763d9,{'showHidden':![],'depth':null}));});}else{logger[_0x5a21('0x1b')](_0x5a21('0x2a'),_0x5a21('0x2c'),_0x5a21('0x20'),_0x5a21('0x2d'));}break;case _0x5a21('0x2e'):var _0x445c33=_0xf2ec12[_0x5a21('0x23')];var _0x3680e7=_0xf2ec12[_0x5a21('0x21')];var _0x181b96=_0xf2ec12[_0x5a21('0x2f')]+_0x5a21('0x30')+_0x445c33+_0x5a21('0x31');var _0x8e14={'to':[_0x199fd6[_0x5a21('0x22')]],'message':{'type':_0x5a21('0x32'),'text':_0x199fd6[_0x5a21('0xd')]}};var _0x2783ed={'method':_0x5a21('0x33'),'uri':_0x181b96,'headers':{'Authorization':_0x5a21('0x34')+_0x3680e7,'Content-Type':_0x5a21('0x35')},'body':_0x8e14,'json':!![]};rp(_0x2783ed)['then'](function(_0x19d25d){if(_0x19d25d[_0x5a21('0x36')][0x0][_0x5a21('0x37')]){return _0x214909['update']({'messageId':_0x19d25d[_0x5a21('0x36')][0x0][_0x5a21('0x37')]});}})[_0x5a21('0x1a')](function(_0x18a17d){logger[_0x5a21('0x38')](_0x5a21('0x39'),_0x18a17d);});break;}}})[_0x5a21('0x3a')](function(){_0x59da9c();});}else{_0x59da9c();}}},'charset':'utf8mb4','collate':_0x5a21('0x3b')});}; \ No newline at end of file +var _0x30cb=['inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','./whatsappMessage.attributes','define','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','afterCreate'];(function(_0x36a3ff,_0x3fedcc){var _0x571318=function(_0x3f074c){while(--_0x3f074c){_0x36a3ff['push'](_0x36a3ff['shift']());}};_0x571318(++_0x3fedcc);}(_0x30cb,0x1c4));var _0xb30c=function(_0x19e08e,_0x178f46){_0x19e08e=_0x19e08e-0x0;var _0x14c229=_0x30cb[_0x19e08e];return _0x14c229;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var logger=require(_0xb30c('0x2'))(_0xb30c('0x3'));var moment=require(_0xb30c('0x4'));var BPromise=require(_0xb30c('0x5'));var rp=require(_0xb30c('0x6'));var fetch=require(_0xb30c('0x7'));var fs=require('fs');var path=require(_0xb30c('0x8'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb30c('0x9'));module['exports']=function(_0x14959d,_0x47b429){return _0x14959d[_0xb30c('0xa')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb30c('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0xb30c('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x233c38,_0x4e7490,_0xb3a257){var _0x484acc=_0x14959d[_0xb30c('0xd')];var _0x5bdc53=_0x233c38[_0xb30c('0xe')]({'plain':!![]});if(_0x5bdc53['direction']['toLowerCase']()==='in'||_0x5bdc53[_0xb30c('0xf')][_0xb30c('0x10')]()===_0xb30c('0x11')&&!_0x5bdc53[_0xb30c('0x12')]&&!_[_0xb30c('0x13')](_0x5bdc53[_0xb30c('0x14')])){_0x484acc[_0xb30c('0x15')][_0xb30c('0x16')]({'where':{'id':_0x5bdc53['WhatsappInteractionId']}})[_0xb30c('0x17')](function(_0x571468){if(_0x571468){_0x571468[_0xb30c('0x18')]({'lastMsgAt':_0x5bdc53[_0xb30c('0x19')],'lastMsgDirection':_0x5bdc53[_0xb30c('0xf')][_0xb30c('0x10')]()});}})[_0xb30c('0x1a')](function(_0x1f9b95){console[_0xb30c('0x1b')](_0x1f9b95);});}if(_0x5bdc53[_0xb30c('0xf')]===_0xb30c('0x11')&&!_0x5bdc53['secret']){var _0x20f557;_0x484acc[_0xb30c('0x1c')][_0xb30c('0x1d')]({'where':{'id':_0x5bdc53['WhatsappAccountId']},'raw':!![]})[_0xb30c('0x17')](function(_0x5bcbdf){_0x20f557=_0x5bcbdf;if(_0x20f557&&_0x20f557[_0xb30c('0x1e')]){switch(_0x20f557[_0xb30c('0x1e')]){case _0xb30c('0x1f'):var _0x51dd03=require(_0xb30c('0x1f'));if(_0x20f557[_0xb30c('0x20')]&&_0x20f557[_0xb30c('0x21')]&&_0x20f557[_0xb30c('0x22')]){var _0x30f5f8=new _0x51dd03(_0x20f557[_0xb30c('0x20')],_0x20f557[_0xb30c('0x21')]);_0x30f5f8[_0xb30c('0x23')][_0xb30c('0x24')]({'body':_0x5bdc53['body'],'to':'whatsapp:'+_0x5bdc53[_0xb30c('0x22')],'from':_0xb30c('0x25')+_0x20f557['phone'],'statusCallback':_0x20f557[_0xb30c('0x26')]+'/api/whatsapp/messages/'+_0x5bdc53['id']+_0xb30c('0x27')+_0x20f557[_0xb30c('0x28')]})[_0xb30c('0x17')](function(_0x1423f7){if(_0x1423f7['sid']){return _0x233c38[_0xb30c('0x18')]({'messageId':_0x1423f7[_0xb30c('0x29')]});}})['catch'](function(_0x5ab39){logger[_0xb30c('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb30c('0x2a'),_0xb30c('0x1f'),util[_0xb30c('0x2b')](_0x5ab39,{'showHidden':![],'depth':null}));});}else{logger[_0xb30c('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb30c('0x2a'),_0xb30c('0x1f'),_0xb30c('0x2c'));}break;case'sinch':var _0x4892a5=_0x20f557[_0xb30c('0x20')];var _0x2f10f1=_0x20f557[_0xb30c('0x21')];var _0x32d24b=_0x20f557['baseUrl']+'/whatsapp/v1/'+_0x4892a5+_0xb30c('0x2d');var _0x22ab74={'to':[_0x5bdc53[_0xb30c('0x22')]],'message':{'type':_0xb30c('0x2e'),'text':_0x5bdc53[_0xb30c('0xc')]}};var _0x10a113={'method':_0xb30c('0x2f'),'uri':_0x32d24b,'headers':{'Authorization':_0xb30c('0x30')+_0x2f10f1,'Content-Type':_0xb30c('0x31')},'body':_0x22ab74,'json':!![]};rp(_0x10a113)[_0xb30c('0x17')](function(_0x4fcf64){if(_0x4fcf64[_0xb30c('0x32')][0x0][_0xb30c('0x33')]){return _0x233c38[_0xb30c('0x18')]({'messageId':_0x4fcf64[_0xb30c('0x32')][0x0]['message_id']});}})['catch'](function(_0x1bca06){logger[_0xb30c('0x34')]('WhatsappMessage,\x20%s',_0x1bca06);});break;}}})['finally'](function(){_0xb3a257();});}else{_0xb3a257();}}},'charset':_0xb30c('0x35'),'collate':_0xb30c('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cb03521..8346c04 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 _0x5779=['redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4071ed,_0x5c63d9){var _0x4a3154=function(_0x520e5f){while(--_0x520e5f){_0x4071ed['push'](_0x4071ed['shift']());}};_0x4a3154(++_0x5c63d9);}(_0x5779,0x1d6));var _0x9577=function(_0x24bc4d,_0x9c3a5f){_0x24bc4d=_0x24bc4d-0x0;var _0x12920a=_0x5779[_0x24bc4d];return _0x12920a;};'use strict';var _=require('lodash');var util=require(_0x9577('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9577('0x1'));var fs=require('fs');var Redis=require(_0x9577('0x2'));var db=require(_0x9577('0x3'))['db'];var utils=require(_0x9577('0x4'));var logger=require(_0x9577('0x5'))(_0x9577('0x6'));var config=require(_0x9577('0x7'));var jayson=require(_0x9577('0x8'));var client=jayson['client'][_0x9577('0x9')]({'port':0x232a});config[_0x9577('0xa')]=_['defaults'](config[_0x9577('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9577('0xb'))(new Redis(config[_0x9577('0xa')]));require(_0x9577('0xc'))[_0x9577('0xd')](socket);function respondWithRpcPromise(_0x54f3c8,_0x1943b0,_0x456661){return new BPromise(function(_0x49e0da,_0x13993c){return client[_0x9577('0xe')](_0x54f3c8,_0x456661)[_0x9577('0xf')](function(_0x4d7531){logger['info'](_0x9577('0x10'),_0x1943b0,_0x9577('0x11'));logger['debug'](_0x9577('0x12'),_0x1943b0,_0x9577('0x11'),JSON[_0x9577('0x13')](_0x4d7531));if(_0x4d7531[_0x9577('0x14')]){if(_0x4d7531[_0x9577('0x14')][_0x9577('0x15')]===0x1f4){logger[_0x9577('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x1943b0,_0x4d7531[_0x9577('0x14')]['message']);return _0x13993c(_0x4d7531[_0x9577('0x14')]['message']);}logger[_0x9577('0x14')](_0x9577('0x10'),_0x1943b0,_0x4d7531['error'][_0x9577('0x16')]);return _0x49e0da(_0x4d7531[_0x9577('0x14')]['message']);}else{logger[_0x9577('0x17')](_0x9577('0x10'),_0x1943b0,'request\x20sent');_0x49e0da(_0x4d7531[_0x9577('0x18')]['message']);}})[_0x9577('0x19')](function(_0x4e7440){logger[_0x9577('0x14')](_0x9577('0x10'),_0x1943b0,_0x4e7440);_0x13993c(_0x4e7440);});});}exports[_0x9577('0x1a')]=function(_0x27c4a7){var _0xc694da=this;return new Promise(function(_0xe2389c,_0x5bcc29){return db[_0x9577('0x1b')][_0x9577('0x1c')](_0x27c4a7[_0x9577('0x1d')],{'raw':_0x27c4a7[_0x9577('0x1e')]?_0x27c4a7[_0x9577('0x1e')][_0x9577('0x1f')]===undefined?!![]:![]:!![]})[_0x9577('0xf')](function(_0x5cce54){logger[_0x9577('0x17')]('CreateWhatsappMessage',_0x27c4a7);logger['debug'](_0x9577('0x1a'),_0x27c4a7,JSON['stringify'](_0x5cce54));_0xe2389c(_0x5cce54);})[_0x9577('0x19')](function(_0x2228c9){logger['error'](_0x9577('0x1a'),_0x2228c9[_0x9577('0x16')],_0x27c4a7);_0x5bcc29(_0xc694da['error'](0x1f4,_0x2228c9[_0x9577('0x16')]));});});}; \ No newline at end of file +var _0x9605=['raw','CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','WhatsappMessage','body','options'];(function(_0x4a9755,_0xbf02e6){var _0x2d9460=function(_0x51a42a){while(--_0x51a42a){_0x4a9755['push'](_0x4a9755['shift']());}};_0x2d9460(++_0xbf02e6);}(_0x9605,0x146));var _0x5960=function(_0x38af0a,_0x405ec8){_0x38af0a=_0x38af0a-0x0;var _0x4855c5=_0x9605[_0x38af0a];return _0x4855c5;};'use strict';var _=require(_0x5960('0x0'));var util=require(_0x5960('0x1'));var moment=require('moment');var BPromise=require(_0x5960('0x2'));var rs=require(_0x5960('0x3'));var fs=require('fs');var Redis=require(_0x5960('0x4'));var db=require(_0x5960('0x5'))['db'];var utils=require(_0x5960('0x6'));var logger=require('../../config/logger')(_0x5960('0x7'));var config=require(_0x5960('0x8'));var jayson=require(_0x5960('0x9'));var client=jayson[_0x5960('0xa')][_0x5960('0xb')]({'port':0x232a});config[_0x5960('0xc')]=_[_0x5960('0xd')](config[_0x5960('0xc')],{'host':_0x5960('0xe'),'port':0x18eb});var socket=require(_0x5960('0xf'))(new Redis(config['redis']));require(_0x5960('0x10'))[_0x5960('0x11')](socket);function respondWithRpcPromise(_0x532937,_0x25c53a,_0x46c483){return new BPromise(function(_0x3aad2a,_0x596ad0){return client[_0x5960('0x12')](_0x532937,_0x46c483)[_0x5960('0x13')](function(_0x59f6bc){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x25c53a,_0x5960('0x14'));logger[_0x5960('0x15')](_0x5960('0x16'),_0x25c53a,_0x5960('0x14'),JSON[_0x5960('0x17')](_0x59f6bc));if(_0x59f6bc[_0x5960('0x18')]){if(_0x59f6bc['error'][_0x5960('0x19')]===0x1f4){logger[_0x5960('0x18')](_0x5960('0x1a'),_0x25c53a,_0x59f6bc[_0x5960('0x18')]['message']);return _0x596ad0(_0x59f6bc['error']['message']);}logger[_0x5960('0x18')](_0x5960('0x1a'),_0x25c53a,_0x59f6bc[_0x5960('0x18')][_0x5960('0x1b')]);return _0x3aad2a(_0x59f6bc[_0x5960('0x18')][_0x5960('0x1b')]);}else{logger[_0x5960('0x1c')](_0x5960('0x1a'),_0x25c53a,'request\x20sent');_0x3aad2a(_0x59f6bc[_0x5960('0x1d')]['message']);}})[_0x5960('0x1e')](function(_0x48a4ba){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x25c53a,_0x48a4ba);_0x596ad0(_0x48a4ba);});});}exports['CreateWhatsappMessage']=function(_0x43f1a7){var _0xd1af9e=this;return new Promise(function(_0x50193e,_0x343e01){return db[_0x5960('0x1f')]['create'](_0x43f1a7[_0x5960('0x20')],{'raw':_0x43f1a7['options']?_0x43f1a7[_0x5960('0x21')][_0x5960('0x22')]===undefined?!![]:![]:!![]})[_0x5960('0x13')](function(_0x141a5b){logger['info']('CreateWhatsappMessage',_0x43f1a7);logger['debug'](_0x5960('0x23'),_0x43f1a7,JSON[_0x5960('0x17')](_0x141a5b));_0x50193e(_0x141a5b);})[_0x5960('0x1e')](function(_0x16f1c6){logger[_0x5960('0x18')](_0x5960('0x23'),_0x16f1c6[_0x5960('0x1b')],_0x43f1a7);_0x343e01(_0xd1af9e['error'](0x1f4,_0x16f1c6[_0x5960('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index d3a7231..90c48c4 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 _0x7327=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7327,0x95));var _0x7732=function(_0x5e24b7,_0x41be8f){_0x5e24b7=_0x5e24b7-0x0;var _0x2b6ccc=_0x7327[_0x5e24b7];return _0x2b6ccc;};'use strict';var WhatsappMessageEvents=require(_0x7732('0x0'));var events=[_0x7732('0x1'),_0x7732('0x2'),_0x7732('0x3')];function createListener(_0x3f99c6,_0x145752){return function(_0x5d884a){_0x145752[_0x7732('0x4')](_0x3f99c6,_0x5d884a);};}function removeListener(_0x22a06a,_0x2b2b1d){return function(){WhatsappMessageEvents['removeListener'](_0x22a06a,_0x2b2b1d);};}exports['register']=function(_0x4f7a4f){for(var _0x51fad3=0x0,_0x5dc21d=events[_0x7732('0x5')];_0x51fad3<_0x5dc21d;_0x51fad3++){var _0x3deacf=events[_0x51fad3];var _0x554be2=createListener(_0x7732('0x6')+_0x3deacf,_0x4f7a4f);WhatsappMessageEvents['on'](_0x3deacf,_0x554be2);}}; \ No newline at end of file +var _0x24dd=['register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener'];(function(_0x4cb6da,_0x3d0f86){var _0x2ea5aa=function(_0x1c4126){while(--_0x1c4126){_0x4cb6da['push'](_0x4cb6da['shift']());}};_0x2ea5aa(++_0x3d0f86);}(_0x24dd,0x1f3));var _0xd24d=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x24dd[_0x1d9aa0];return _0x226868;};'use strict';var WhatsappMessageEvents=require(_0xd24d('0x0'));var events=[_0xd24d('0x1'),'remove',_0xd24d('0x2')];function createListener(_0xd0d059,_0x561162){return function(_0x14eb8e){_0x561162[_0xd24d('0x3')](_0xd0d059,_0x14eb8e);};}function removeListener(_0x250d69,_0x3039d4){return function(){WhatsappMessageEvents[_0xd24d('0x4')](_0x250d69,_0x3039d4);};}exports[_0xd24d('0x5')]=function(_0x236e49){for(var _0x3dbc46=0x0,_0x53d7e8=events[_0xd24d('0x6')];_0x3dbc46<_0x53d7e8;_0x3dbc46++){var _0x5d7007=events[_0x3dbc46];var _0x4e80f1=createListener(_0xd24d('0x7')+_0x5d7007,_0x236e49);WhatsappMessageEvents['on'](_0x5d7007,_0x4e80f1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b3f1ffd..9337df2 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 _0xcff2=['../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x53e6a1,_0x58a286){var _0x442242=function(_0x45c3ab){while(--_0x45c3ab){_0x53e6a1['push'](_0x53e6a1['shift']());}};_0x442242(++_0x58a286);}(_0xcff2,0x172));var _0x2cff=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0xcff2[_0x531e48];return _0x202971;};'use strict';var multer=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var path=require(_0x2cff('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cff('0x3'));var router=express[_0x2cff('0x4')]();var fs_extra=require(_0x2cff('0x5'));var auth=require(_0x2cff('0x6'));var interaction=require(_0x2cff('0x7'));var config=require(_0x2cff('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2cff('0x9')]);router[_0x2cff('0xa')](_0x2cff('0xb'),auth[_0x2cff('0xc')](),controller[_0x2cff('0xd')]);router[_0x2cff('0xa')](_0x2cff('0xe'),auth[_0x2cff('0xc')](),controller[_0x2cff('0xf')]);router['get']('/:id/members',auth[_0x2cff('0xc')](),controller[_0x2cff('0x10')]);router[_0x2cff('0xa')](_0x2cff('0x11'),auth['isAuthenticated'](),controller[_0x2cff('0x12')]);router[_0x2cff('0xa')](_0x2cff('0x13'),auth[_0x2cff('0xc')](),controller['getAgents']);router[_0x2cff('0x14')]('/',auth[_0x2cff('0xc')](),controller[_0x2cff('0x15')]);router[_0x2cff('0x14')](_0x2cff('0x11'),auth[_0x2cff('0xc')](),controller[_0x2cff('0x16')]);router[_0x2cff('0x14')](_0x2cff('0x13'),auth[_0x2cff('0xc')](),controller[_0x2cff('0x17')]);router['put'](_0x2cff('0xe'),auth[_0x2cff('0xc')](),controller[_0x2cff('0x18')]);router[_0x2cff('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2cff('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2cff('0x1a')]);router[_0x2cff('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x2cff('0x1b')]);module[_0x2cff('0x1c')]=router; \ No newline at end of file +var _0xb844=['../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e1ee7,_0x1cb9aa){var _0x2029e4=function(_0x30a12c){while(--_0x30a12c){_0x2e1ee7['push'](_0x2e1ee7['shift']());}};_0x2029e4(++_0x1cb9aa);}(_0xb844,0x1e0));var _0x4b84=function(_0x24e76e,_0x2bffc6){_0x24e76e=_0x24e76e-0x0;var _0x335b82=_0xb844[_0x24e76e];return _0x335b82;};'use strict';var multer=require(_0x4b84('0x0'));var util=require('util');var path=require(_0x4b84('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b84('0x2'));var router=express[_0x4b84('0x3')]();var fs_extra=require(_0x4b84('0x4'));var auth=require(_0x4b84('0x5'));var interaction=require(_0x4b84('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x4b84('0x7')]('/',auth[_0x4b84('0x8')](),controller['index']);router[_0x4b84('0x7')](_0x4b84('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4b84('0xa'),auth['isAuthenticated'](),controller[_0x4b84('0xb')]);router[_0x4b84('0x7')](_0x4b84('0xc'),auth['isAuthenticated'](),controller[_0x4b84('0xd')]);router[_0x4b84('0x7')]('/:id/teams',auth[_0x4b84('0x8')](),controller['getTeams']);router[_0x4b84('0x7')](_0x4b84('0xe'),auth[_0x4b84('0x8')](),controller[_0x4b84('0xf')]);router[_0x4b84('0x10')]('/',auth[_0x4b84('0x8')](),controller[_0x4b84('0x11')]);router[_0x4b84('0x10')](_0x4b84('0x12'),auth[_0x4b84('0x8')](),controller[_0x4b84('0x13')]);router[_0x4b84('0x10')](_0x4b84('0xe'),auth['isAuthenticated'](),controller[_0x4b84('0x14')]);router[_0x4b84('0x15')](_0x4b84('0xa'),auth[_0x4b84('0x8')](),controller[_0x4b84('0x16')]);router[_0x4b84('0x17')](_0x4b84('0xa'),auth['isAuthenticated'](),controller[_0x4b84('0x18')]);router[_0x4b84('0x17')](_0x4b84('0x12'),auth['isAuthenticated'](),controller[_0x4b84('0x19')]);router[_0x4b84('0x17')](_0x4b84('0xe'),auth[_0x4b84('0x8')](),controller['removeAgents']);module[_0x4b84('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ab76358..ab44157 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 _0xc874=['name','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x2ba0ff,_0x4704ad){var _0xe20460=function(_0x2b3d00){while(--_0x2b3d00){_0x2ba0ff['push'](_0x2ba0ff['shift']());}};_0xe20460(++_0x4704ad);}(_0xc874,0x154));var _0x4c87=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0xc874[_0x2cc0b3];return _0x1667ef;};'use strict';var Sequelize=require(_0x4c87('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c87('0x1')],'unique':_0x4c87('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4c87('0x3'),_0x4c87('0x4'),_0x4c87('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x984b=['ENUM','roundrobin','STRING','name','INTEGER'];(function(_0x3d8780,_0x52f6cc){var _0x5a9627=function(_0x32205a){while(--_0x32205a){_0x3d8780['push'](_0x3d8780['shift']());}};_0x5a9627(++_0x52f6cc);}(_0x984b,0xee));var _0xb984=function(_0x2d1e06,_0x4e44ba){_0x2d1e06=_0x2d1e06-0x0;var _0x1fc77c=_0x984b[_0x2d1e06];return _0x1fc77c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb984('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb984('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb984('0x2')]('rrmemory','beepall',_0xb984('0x3'))},'description':{'type':Sequelize[_0xb984('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0c51d86..21207d0 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 _0x4a16=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','limit','count','offset','set','Content-Range','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','stack','name','index','map','fieldName','type','key','getOptions','where','WhatsappQueue','include','query','findAll','rows','catch','model','keys','filters','intersection','fields','attributes','length','merge','find','create','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserWhatsappQueue','rawAttributes','hasOwnProperty','order','sort','WhatsappQueueId','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','pick','options','nolimit','addTeams','ids','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x4a16,0x76));var _0x64a1=function(_0x531ad2,_0xb17f7f){_0x531ad2=_0x531ad2-0x0;var _0x5c1877=_0x4a16[_0x531ad2];return _0x5c1877;};'use strict';var BPromise=require(_0x64a1('0x0'));var util=require(_0x64a1('0x1'));var _=require('lodash');var squel=require(_0x64a1('0x2'));var Redis=require(_0x64a1('0x3'));var qs=require(_0x64a1('0x4'));var logger=require(_0x64a1('0x5'))(_0x64a1('0x6'));var config=require(_0x64a1('0x7'));var db=require(_0x64a1('0x8'))['db'];config[_0x64a1('0x9')]=_[_0x64a1('0xa')](config[_0x64a1('0x9')],{'host':_0x64a1('0xb'),'port':0x18eb});var socket=require(_0x64a1('0xc'))(new Redis(config[_0x64a1('0x9')]));require(_0x64a1('0xd'))[_0x64a1('0xe')](socket);function respondWithStatusCode(_0x27f315,_0x10b543){_0x10b543=_0x10b543||0xcc;return function(_0x403dff){if(_0x403dff){return _0x27f315[_0x64a1('0xf')](_0x10b543);}return _0x27f315[_0x64a1('0x10')](_0x10b543)['end']();};}function respondWithResult(_0x1f66f3,_0xafbd3b){_0xafbd3b=_0xafbd3b||0xc8;return function(_0x49787e){if(_0x49787e){return _0x1f66f3[_0x64a1('0x10')](_0xafbd3b)['json'](_0x49787e);}};}function respondWithFilteredResult(_0x200462,_0x38e28a){return function(_0x4d37d8){if(_0x4d37d8){var _0x41993b=typeof _0x38e28a['offset']==='undefined'&&typeof _0x38e28a[_0x64a1('0x11')]==='undefined';var _0x511923=_0x4d37d8[_0x64a1('0x12')];var _0x41e5eb=_0x41993b?0x0:_0x38e28a[_0x64a1('0x13')];var _0x2f2b52=_0x41993b?_0x4d37d8[_0x64a1('0x12')]:_0x38e28a[_0x64a1('0x13')]+_0x38e28a[_0x64a1('0x11')];var _0x305ae7;if(_0x2f2b52>=_0x511923){_0x2f2b52=_0x511923;_0x305ae7=0xc8;}else{_0x305ae7=0xce;}_0x200462[_0x64a1('0x10')](_0x305ae7);return _0x200462[_0x64a1('0x14')](_0x64a1('0x15'),_0x41e5eb+'-'+_0x2f2b52+'/'+_0x511923)[_0x64a1('0x16')](_0x4d37d8);}return null;};}function saveUpdates(_0x4a1a9a){return function(_0x29501f){if(_0x29501f){return _0x29501f[_0x64a1('0x17')](_0x4a1a9a)[_0x64a1('0x18')](function(_0x29f551){return _0x29f551;});}return null;};}function removeEntity(_0x581175){return function(_0x2306ca){if(_0x2306ca){return _0x2306ca[_0x64a1('0x19')]()[_0x64a1('0x18')](function(){var _0x13831e=_0x2306ca[_0x64a1('0x1a')]({'plain':!![]});var _0x379b64=_0x64a1('0x1b');return db[_0x64a1('0x1c')][_0x64a1('0x19')]({'where':{'type':_0x379b64,'resourceId':_0x13831e['id']}})[_0x64a1('0x18')](function(){return _0x2306ca;});})[_0x64a1('0x18')](function(){_0x581175['status'](0xcc)[_0x64a1('0x1d')]();});}};}function handleEntityNotFound(_0x351ead){return function(_0x2fa0aa){if(!_0x2fa0aa){_0x351ead[_0x64a1('0xf')](0x194);}return _0x2fa0aa;};}function handleError(_0x4e772e,_0x347015){_0x347015=_0x347015||0x1f4;return function(_0x11e417){logger['error'](_0x11e417[_0x64a1('0x1e')]);if(_0x11e417[_0x64a1('0x1f')]){delete _0x11e417[_0x64a1('0x1f')];}_0x4e772e[_0x64a1('0x10')](_0x347015)['send'](_0x11e417);};}exports[_0x64a1('0x20')]=function(_0x3014e7,_0x581007){var _0x5299fd={};var _0x162969={'count':0x0,'rows':[]};var _0x23b0f5=_[_0x64a1('0x21')](db['WhatsappQueue']['rawAttributes'],function(_0x469626){return{'name':_0x469626[_0x64a1('0x22')],'type':_0x469626[_0x64a1('0x23')][_0x64a1('0x24')]};});_0x5299fd=qs[_0x64a1('0x25')](_0x23b0f5,_0x3014e7);var _0x27673a={'where':_0x5299fd[_0x64a1('0x26')]};return db[_0x64a1('0x27')][_0x64a1('0x12')](_0x27673a)[_0x64a1('0x18')](function(_0x48f50a){_0x162969[_0x64a1('0x12')]=_0x48f50a;_0x5299fd[_0x64a1('0x28')]=qs[_0x64a1('0x28')](_0x3014e7[_0x64a1('0x29')]);return db['WhatsappQueue'][_0x64a1('0x2a')](_0x5299fd);})['then'](function(_0x324f20){_0x162969[_0x64a1('0x2b')]=_0x324f20;return _0x162969;})[_0x64a1('0x18')](respondWithFilteredResult(_0x581007,_0x5299fd))[_0x64a1('0x2c')](handleError(_0x581007,null));};exports['show']=function(_0x5c58da,_0x5b9808){var _0x34e549={'raw':!![],'where':{'id':_0x5c58da['params']['id']}},_0x58fcdc={};_0x58fcdc[_0x64a1('0x2d')]=_[_0x64a1('0x2e')](db[_0x64a1('0x27')]['rawAttributes']);_0x58fcdc['query']=_[_0x64a1('0x2e')](_0x5c58da[_0x64a1('0x29')]);_0x58fcdc[_0x64a1('0x2f')]=_[_0x64a1('0x30')](_0x58fcdc['model'],_0x58fcdc['query']);_0x34e549['attributes']=_[_0x64a1('0x30')](_0x58fcdc['model'],qs['fields'](_0x5c58da['query'][_0x64a1('0x31')]));_0x34e549[_0x64a1('0x32')]=_0x34e549[_0x64a1('0x32')][_0x64a1('0x33')]?_0x34e549[_0x64a1('0x32')]:_0x58fcdc[_0x64a1('0x2d')];if(_0x5c58da[_0x64a1('0x29')]['includeAll']){_0x34e549[_0x64a1('0x28')]=[{'all':!![]}];}_0x34e549=_[_0x64a1('0x34')]({},_0x34e549,_0x5c58da['options']);return db[_0x64a1('0x27')][_0x64a1('0x35')](_0x34e549)[_0x64a1('0x18')](handleEntityNotFound(_0x5b9808,null))[_0x64a1('0x18')](respondWithResult(_0x5b9808,null))[_0x64a1('0x2c')](handleError(_0x5b9808,null));};exports[_0x64a1('0x36')]=function(_0x33c87a,_0x880ae4){return db[_0x64a1('0x27')][_0x64a1('0x36')](_0x33c87a['body'],{})[_0x64a1('0x18')](function(_0x253920){var _0x4fb87d=_0x33c87a['user'][_0x64a1('0x1a')]({'plain':!![]});if(!_0x4fb87d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fb87d[_0x64a1('0x37')]===_0x64a1('0x38')){var _0x5c8dbd=_0x253920[_0x64a1('0x1a')]({'plain':!![]});var _0x3eb52a=_0x64a1('0x1b');return db[_0x64a1('0x39')][_0x64a1('0x35')]({'where':{'name':_0x3eb52a,'userProfileId':_0x4fb87d[_0x64a1('0x3a')]},'raw':!![]})[_0x64a1('0x18')](function(_0x22e0da){if(_0x22e0da&&_0x22e0da['autoAssociation']===0x0){return db[_0x64a1('0x1c')]['create']({'name':_0x5c8dbd['name'],'resourceId':_0x5c8dbd['id'],'type':_0x22e0da['name'],'sectionId':_0x22e0da['id']},{})[_0x64a1('0x18')](function(){return _0x253920;});}else{return _0x253920;}})['catch'](function(_0x235105){logger[_0x64a1('0x3b')](_0x64a1('0x3c'),_0x235105);throw _0x235105;});}return _0x253920;})[_0x64a1('0x18')](respondWithResult(_0x880ae4,0xc9))['catch'](handleError(_0x880ae4,null));};exports['update']=function(_0x335ddf,_0x8ce872){if(_0x335ddf[_0x64a1('0x3d')]['id']){delete _0x335ddf[_0x64a1('0x3d')]['id'];}return db[_0x64a1('0x27')]['find']({'where':{'id':_0x335ddf[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](handleEntityNotFound(_0x8ce872,null))[_0x64a1('0x18')](saveUpdates(_0x335ddf[_0x64a1('0x3d')],null))[_0x64a1('0x18')](respondWithResult(_0x8ce872,null))[_0x64a1('0x2c')](handleError(_0x8ce872,null));};exports['destroy']=function(_0x36e06e,_0x1b75fa){return db[_0x64a1('0x27')][_0x64a1('0x35')]({'where':{'id':_0x36e06e[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](handleEntityNotFound(_0x1b75fa,null))['then'](removeEntity(_0x1b75fa,null))[_0x64a1('0x2c')](handleError(_0x1b75fa,null));};exports[_0x64a1('0x3f')]=function(_0x111345,_0x46be55){return db[_0x64a1('0x27')][_0x64a1('0x3f')]()[_0x64a1('0x18')](respondWithResult(_0x46be55,null))[_0x64a1('0x2c')](handleError(_0x46be55,null));};exports[_0x64a1('0x40')]=function(_0x40921f,_0x4beace){var _0x55ca69={'raw':!![],'where':{}},_0x2861b9={},_0x18478b;return db[_0x64a1('0x27')]['findOne']({'where':{'id':_0x40921f[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](handleEntityNotFound(_0x4beace,null))[_0x64a1('0x18')](function(_0x4b17d6){if(_0x4b17d6){_0x18478b=_0x4b17d6[_0x64a1('0x1a')]({'plain':!![]});_0x2861b9[_0x64a1('0x2d')]=_[_0x64a1('0x2e')](db[_0x64a1('0x41')][_0x64a1('0x42')]);_0x2861b9['query']=_[_0x64a1('0x2e')](_0x40921f[_0x64a1('0x29')]);_0x2861b9[_0x64a1('0x2f')]=_[_0x64a1('0x30')](_0x2861b9[_0x64a1('0x2d')],_0x2861b9[_0x64a1('0x29')]);_0x55ca69[_0x64a1('0x32')]=_['intersection'](_0x2861b9[_0x64a1('0x2d')],qs['fields'](_0x40921f[_0x64a1('0x29')]['fields']));_0x55ca69[_0x64a1('0x32')]=_0x55ca69[_0x64a1('0x32')][_0x64a1('0x33')]?_0x55ca69['attributes']:_0x2861b9['model'];if(!_0x40921f['query'][_0x64a1('0x43')]('nolimit')){_0x55ca69[_0x64a1('0x11')]=qs[_0x64a1('0x11')](_0x40921f[_0x64a1('0x29')][_0x64a1('0x11')]);_0x55ca69[_0x64a1('0x13')]=qs[_0x64a1('0x13')](_0x40921f[_0x64a1('0x29')][_0x64a1('0x13')]);}_0x55ca69[_0x64a1('0x44')]=qs[_0x64a1('0x45')](_0x40921f[_0x64a1('0x29')]['sort']);_0x55ca69[_0x64a1('0x26')]=qs[_0x64a1('0x2f')](_['pick'](_0x40921f[_0x64a1('0x29')],_0x2861b9[_0x64a1('0x2f')]));_0x55ca69['where'][_0x64a1('0x46')]=_0x4b17d6['id'];if(_0x40921f[_0x64a1('0x29')][_0x64a1('0x47')]){_0x55ca69[_0x64a1('0x26')]=_[_0x64a1('0x34')](_0x55ca69[_0x64a1('0x26')],{'$or':_[_0x64a1('0x21')](_0x55ca69[_0x64a1('0x32')],function(_0x23c29c){var _0x43a005={};_0x43a005[_0x23c29c]={'$like':'%'+_0x40921f['query'][_0x64a1('0x47')]+'%'};return _0x43a005;})});}_0x55ca69=_[_0x64a1('0x34')]({},_0x55ca69,_0x40921f['options']);return db[_0x64a1('0x41')][_0x64a1('0x2a')](_0x55ca69);}})['then'](function(_0x22235f){if(_0x22235f){return db[_0x64a1('0x48')][_0x64a1('0x49')]({'where':{'id':_[_0x64a1('0x21')](_0x22235f,'UserId'),'role':_0x64a1('0x4a')},'attributes':['id',_0x64a1('0x1f'),_0x64a1('0x4b'),_0x64a1('0x4c'),'createdAt']});}})[_0x64a1('0x18')](function(_0x52f444){if(_0x52f444){return{'count':_0x52f444['count'],'rows':_[_0x64a1('0x21')](_0x52f444[_0x64a1('0x2b')],function(_0x5b9893){return{'membername':_0x5b9893[_0x64a1('0x1f')],'UserId':_0x5b9893['id'],'queue_name':_0x18478b[_0x64a1('0x1f')],'WhatsappQueueId':_0x18478b['id'],'interface':util[_0x64a1('0x4d')](_0x64a1('0x4e'),_0x64a1('0x4f'),_0x5b9893[_0x64a1('0x1f')]),'penalty':0x0,'paused':_0x5b9893['whatsappPause'],'createdAt':_0x5b9893[_0x64a1('0x50')],'updatedAt':_0x5b9893[_0x64a1('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x64a1('0x18')](respondWithFilteredResult(_0x4beace,_0x55ca69))[_0x64a1('0x2c')](handleError(_0x4beace,null));};exports[_0x64a1('0x51')]=function(_0x2831b1,_0x254ef6){var _0x5070c0={};var _0x348e17={};var _0x2cd109;var _0x1a59c2;return db[_0x64a1('0x27')][_0x64a1('0x52')]({'where':{'id':_0x2831b1[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](handleEntityNotFound(_0x254ef6,null))[_0x64a1('0x18')](function(_0x508735){if(_0x508735){_0x2cd109=_0x508735;_0x348e17[_0x64a1('0x2d')]=_[_0x64a1('0x2e')](db[_0x64a1('0x53')][_0x64a1('0x42')]);_0x348e17[_0x64a1('0x29')]=_['keys'](_0x2831b1[_0x64a1('0x29')]);_0x348e17[_0x64a1('0x2f')]=_['intersection'](_0x348e17['model'],_0x348e17[_0x64a1('0x29')]);_0x5070c0[_0x64a1('0x32')]=_['intersection'](_0x348e17[_0x64a1('0x2d')],qs[_0x64a1('0x31')](_0x2831b1['query'][_0x64a1('0x31')]));_0x5070c0[_0x64a1('0x32')]=_0x5070c0[_0x64a1('0x32')][_0x64a1('0x33')]?_0x5070c0[_0x64a1('0x32')]:_0x348e17[_0x64a1('0x2d')];_0x5070c0[_0x64a1('0x44')]=qs[_0x64a1('0x45')](_0x2831b1[_0x64a1('0x29')]['sort']);_0x5070c0[_0x64a1('0x26')]=qs[_0x64a1('0x2f')](_[_0x64a1('0x54')](_0x2831b1[_0x64a1('0x29')],_0x348e17[_0x64a1('0x2f')]));if(_0x2831b1[_0x64a1('0x29')][_0x64a1('0x47')]){_0x5070c0['where']=_['merge'](_0x5070c0['where'],{'$or':_[_0x64a1('0x21')](_0x5070c0[_0x64a1('0x32')],function(_0x2a12c8){var _0x53cdf7={};_0x53cdf7[_0x2a12c8]={'$like':'%'+_0x2831b1[_0x64a1('0x29')][_0x64a1('0x47')]+'%'};return _0x53cdf7;})});}_0x5070c0=_[_0x64a1('0x34')]({},_0x5070c0,_0x2831b1[_0x64a1('0x55')]);return _0x2cd109[_0x64a1('0x51')](_0x5070c0);}})[_0x64a1('0x18')](function(_0xd61857){if(_0xd61857){_0x1a59c2=_0xd61857['length'];if(!_0x2831b1[_0x64a1('0x29')]['hasOwnProperty'](_0x64a1('0x56'))){_0x5070c0['limit']=qs['limit'](_0x2831b1[_0x64a1('0x29')]['limit']);_0x5070c0[_0x64a1('0x13')]=qs['offset'](_0x2831b1[_0x64a1('0x29')][_0x64a1('0x13')]);}return _0x2cd109[_0x64a1('0x51')](_0x5070c0);}})[_0x64a1('0x18')](function(_0x2ca686){if(_0x2ca686){return _0x2ca686?{'count':_0x1a59c2,'rows':_0x2ca686}:null;}})['then'](respondWithResult(_0x254ef6,null))['catch'](handleError(_0x254ef6,null));};exports[_0x64a1('0x57')]=function(_0x171513,_0x5b670e){var _0x460497=_0x171513[_0x64a1('0x3d')][_0x64a1('0x58')];return db[_0x64a1('0x53')]['findAll']({'where':{'id':_0x460497},'attributes':['id'],'include':[{'model':db['User'],'as':_0x64a1('0x59'),'attributes':['id',_0x64a1('0x1f'),_0x64a1('0x5a'),_0x64a1('0x5b'),'interface'],'raw':!![]}]})[_0x64a1('0x18')](function(_0x15abd3){if(_0x15abd3){var _0x6bf40a=_['flatMap'](_0x15abd3,function(_0x113a0e){var _0x2f9113=_0x113a0e[_0x64a1('0x1a')]({'plain':!![]});return _0x2f9113[_0x64a1('0x59')];});return db[_0x64a1('0x27')][_0x64a1('0x35')]({'where':{'id':_0x171513[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](function(_0x3591e9){return db[_0x64a1('0x5c')]['transaction'](function(_0x57b3c0){return _0x3591e9[_0x64a1('0x57')](_0x460497,{'transaction':_0x57b3c0})['then'](function(){return BPromise[_0x64a1('0x5d')](_0x6bf40a,function(_0x31a281){return db['UserWhatsappQueue'][_0x64a1('0x5e')]({'where':{'UserId':_0x31a281['id'],'WhatsappQueueId':_0x171513[_0x64a1('0x3e')]['id']},'transaction':_0x57b3c0});});})[_0x64a1('0x18')](function(){_0x6bf40a[_0x64a1('0x5f')](function(_0x3dd6a4){socket[_0x64a1('0x60')](_0x64a1('0x61'),{'UserId':_0x3dd6a4['id'],'WhatsappQueueId':_0x3591e9['id']});});});});});}})['then'](respondWithStatusCode(_0x5b670e,null))[_0x64a1('0x2c')](handleError(_0x5b670e,null));};exports['removeTeams']=function(_0x33f15e,_0x18884a){return db[_0x64a1('0x53')][_0x64a1('0x2a')]({'where':{'id':_0x33f15e[_0x64a1('0x29')][_0x64a1('0x58')]},'attributes':['id'],'include':[{'model':db[_0x64a1('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x64a1('0x18')](handleEntityNotFound(_0x18884a,null))[_0x64a1('0x18')](function(_0x2917f9){var _0x3bd176=_[_0x64a1('0x21')](_0x2917f9,'id');var _0xb232f7=[];var _0x4e706d=[];var _0x47d6f6=squel[_0x64a1('0x62')]();_0x47d6f6[_0x64a1('0x63')](_0x64a1('0x64'))[_0x64a1('0x65')](_0x64a1('0x66'),'tq')[_0x64a1('0x67')]('user_has_teams','ut',_0x64a1('0x68'))['where']('WhatsappQueueId\x20=\x20?',_0x33f15e['params']['id']);for(var _0xe6cff4=0x0;_0xe6cff4<_0x2917f9['length'];_0xe6cff4+=0x1){let _0x573418=_0x2917f9[_0xe6cff4];for(var _0x106222=0x0;_0x106222<_0x573418[_0x64a1('0x59')][_0x64a1('0x33')];_0x106222+=0x1){let _0x3b55ab=_0x573418[_0x64a1('0x59')][_0x106222];var _0x3e2c09=_0x47d6f6[_0x64a1('0x69')]();_0x3e2c09[_0x64a1('0x26')]('ut.UserId\x20=\x20?',_0x3b55ab['id']);_0x4e706d[_0x64a1('0x6a')](db[_0x64a1('0x5c')][_0x64a1('0x29')](_0x3e2c09[_0x64a1('0x6b')](),{'type':db[_0x64a1('0x5c')][_0x64a1('0x6c')][_0x64a1('0x6d')]})[_0x64a1('0x18')](function(_0x3477a2){if(_0x3477a2[_0x64a1('0x33')]===0x1){return _0x3b55ab['id'];}else{var _0x29ff60=_[_0x64a1('0x6e')](_['map'](_0x3477a2,_0x64a1('0x6f')),function(_0x5ed399){return _['includes'](_0x3bd176,_0x5ed399);});if(_0x29ff60){return _0x3b55ab['id'];}}}));}}return BPromise['all'](_0x4e706d)[_0x64a1('0x18')](function(_0x21d31f){_0xb232f7=_(_0xb232f7)[_0x64a1('0x70')](_0x21d31f)[_0x64a1('0x71')]()['value']();return db[_0x64a1('0x27')]['find']({'where':{'id':_0x33f15e[_0x64a1('0x3e')]['id']}})['then'](function(_0x4693cc){return db[_0x64a1('0x5c')][_0x64a1('0x72')](function(_0x5dbe02){return _0x4693cc[_0x64a1('0x73')](_0x33f15e['query']['ids'],{'transaction':_0x5dbe02})[_0x64a1('0x18')](function(){if(!_[_0x64a1('0x74')](_0xb232f7)){return _0x4693cc[_0x64a1('0x75')](_0xb232f7,{'transaction':_0x5dbe02});}})[_0x64a1('0x18')](function(){_0xb232f7[_0x64a1('0x5f')](function(_0x3b193){socket['emit'](_0x64a1('0x76'),{'UserId':_0x3b193,'WhatsappQueueId':_0x4693cc['id']});});});});});});})['then'](respondWithStatusCode(_0x18884a,null))[_0x64a1('0x2c')](handleError(_0x18884a,null));};exports[_0x64a1('0x77')]=function(_0x7ca6b4,_0x4d467c){return db['WhatsappQueue'][_0x64a1('0x35')]({'where':{'id':_0x7ca6b4[_0x64a1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4d467c,null))[_0x64a1('0x18')](function(_0x42297a){if(_0x42297a){return _0x42297a[_0x64a1('0x77')](_0x7ca6b4[_0x64a1('0x3d')]['ids'],_['omit'](_0x7ca6b4[_0x64a1('0x3d')],[_0x64a1('0x58'),'id'])||{})[_0x64a1('0x78')](function(_0x14662d){for(var _0x173a32=0x0;_0x173a32<_0x7ca6b4[_0x64a1('0x3d')]['ids'][_0x64a1('0x33')];_0x173a32+=0x1){socket[_0x64a1('0x60')](_0x64a1('0x61'),{'UserId':Number(_0x7ca6b4['body'][_0x64a1('0x58')][_0x173a32]),'WhatsappQueueId':Number(_0x7ca6b4[_0x64a1('0x3e')]['id'])});}return _0x14662d;});}})['then'](respondWithResult(_0x4d467c,null))[_0x64a1('0x2c')](handleError(_0x4d467c,null));};exports['removeAgents']=function(_0x404342,_0x3a00c7){return db[_0x64a1('0x27')][_0x64a1('0x35')]({'where':{'id':_0x404342[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](handleEntityNotFound(_0x3a00c7,null))['then'](function(_0x5e8cb2){if(_0x5e8cb2){return _0x5e8cb2[_0x64a1('0x75')](_0x404342['query'][_0x64a1('0x58')])[_0x64a1('0x18')](function(){if(_[_0x64a1('0x79')](_0x404342[_0x64a1('0x29')]['ids'])){for(var _0x274839=0x0;_0x274839<_0x404342[_0x64a1('0x29')]['ids'][_0x64a1('0x33')];_0x274839+=0x1){socket[_0x64a1('0x60')](_0x64a1('0x76'),{'UserId':Number(_0x404342[_0x64a1('0x29')][_0x64a1('0x58')][_0x274839]),'WhatsappQueueId':Number(_0x404342[_0x64a1('0x3e')]['id'])});}}else{socket[_0x64a1('0x60')](_0x64a1('0x76'),{'UserId':Number(_0x404342[_0x64a1('0x29')][_0x64a1('0x58')]),'WhatsappQueueId':Number(_0x404342[_0x64a1('0x3e')]['id'])});}});}})[_0x64a1('0x18')](respondWithStatusCode(_0x3a00c7,null))['catch'](handleError(_0x3a00c7,null));};exports[_0x64a1('0x7a')]=function(_0x316974,_0x400b29){var _0x1a0e30={};var _0x5f4ef5={};var _0x2fa82b;var _0x935d0b;return db[_0x64a1('0x27')][_0x64a1('0x52')]({'where':{'id':_0x316974[_0x64a1('0x3e')]['id']}})[_0x64a1('0x18')](handleEntityNotFound(_0x400b29,null))[_0x64a1('0x18')](function(_0x3a2cd8){if(_0x3a2cd8){_0x2fa82b=_0x3a2cd8;_0x5f4ef5[_0x64a1('0x2d')]=_[_0x64a1('0x2e')](db[_0x64a1('0x48')][_0x64a1('0x42')]);_0x5f4ef5['query']=_[_0x64a1('0x2e')](_0x316974[_0x64a1('0x29')]);_0x5f4ef5[_0x64a1('0x2f')]=_[_0x64a1('0x30')](_0x5f4ef5[_0x64a1('0x2d')],_0x5f4ef5[_0x64a1('0x29')]);_0x1a0e30['attributes']=_['intersection'](_0x5f4ef5[_0x64a1('0x2d')],qs[_0x64a1('0x31')](_0x316974[_0x64a1('0x29')][_0x64a1('0x31')]));_0x1a0e30[_0x64a1('0x32')]=_0x1a0e30[_0x64a1('0x32')][_0x64a1('0x33')]?_0x1a0e30['attributes']:_0x5f4ef5[_0x64a1('0x2d')];_0x1a0e30['order']=qs[_0x64a1('0x45')](_0x316974[_0x64a1('0x29')][_0x64a1('0x45')]);_0x1a0e30['where']=qs[_0x64a1('0x2f')](_['pick'](_0x316974[_0x64a1('0x29')],_0x5f4ef5[_0x64a1('0x2f')]));if(_0x316974['query'][_0x64a1('0x47')]){_0x1a0e30[_0x64a1('0x26')]=_['merge'](_0x1a0e30['where'],{'$or':_[_0x64a1('0x21')](_0x1a0e30['attributes'],function(_0x5505ca){var _0x439e56={};_0x439e56[_0x5505ca]={'$like':'%'+_0x316974[_0x64a1('0x29')][_0x64a1('0x47')]+'%'};return _0x439e56;})});}_0x1a0e30=_[_0x64a1('0x34')]({},_0x1a0e30,_0x316974['options']);return _0x2fa82b[_0x64a1('0x7a')](_0x1a0e30);}})['then'](function(_0x57d054){if(_0x57d054){_0x935d0b=_0x57d054[_0x64a1('0x33')];if(!_0x316974[_0x64a1('0x29')][_0x64a1('0x43')]('nolimit')){_0x1a0e30['limit']=qs[_0x64a1('0x11')](_0x316974[_0x64a1('0x29')][_0x64a1('0x11')]);_0x1a0e30['offset']=qs[_0x64a1('0x13')](_0x316974[_0x64a1('0x29')][_0x64a1('0x13')]);}return _0x2fa82b['getAgents'](_0x1a0e30);}})[_0x64a1('0x18')](function(_0x4d760d){if(_0x4d760d){return _0x4d760d?{'count':_0x935d0b,'rows':_0x4d760d}:null;}})['then'](respondWithResult(_0x400b29,null))[_0x64a1('0x2c')](handleError(_0x400b29,null));}; \ No newline at end of file +var _0x7bea=['set','update','then','get','WhatsappQueues','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','WhatsappQueue','include','query','findAll','rows','catch','show','params','model','keys','attributes','intersection','fields','length','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','where','WhatsappQueueId','filter','User','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','union','value','removeTeams','removeAgents','emit','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x32ec4e,_0x1573b4){var _0xbffcc3=function(_0x3f2e9c){while(--_0x3f2e9c){_0x32ec4e['push'](_0x32ec4e['shift']());}};_0xbffcc3(++_0x1573b4);}(_0x7bea,0xe0));var _0xa7be=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x7bea[_0x1558ab];return _0x53b64a;};'use strict';var BPromise=require(_0xa7be('0x0'));var util=require(_0xa7be('0x1'));var _=require(_0xa7be('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xa7be('0x3'));var logger=require(_0xa7be('0x4'))('api');var config=require(_0xa7be('0x5'));var db=require(_0xa7be('0x6'))['db'];config[_0xa7be('0x7')]=_[_0xa7be('0x8')](config[_0xa7be('0x7')],{'host':_0xa7be('0x9'),'port':0x18eb});var socket=require(_0xa7be('0xa'))(new Redis(config[_0xa7be('0x7')]));require('./whatsappQueue.socket')[_0xa7be('0xb')](socket);function respondWithStatusCode(_0x2e53c2,_0x2e0a76){_0x2e0a76=_0x2e0a76||0xcc;return function(_0x2244b5){if(_0x2244b5){return _0x2e53c2[_0xa7be('0xc')](_0x2e0a76);}return _0x2e53c2[_0xa7be('0xd')](_0x2e0a76)[_0xa7be('0xe')]();};}function respondWithResult(_0x150b50,_0x426321){_0x426321=_0x426321||0xc8;return function(_0x54ccd6){if(_0x54ccd6){return _0x150b50[_0xa7be('0xd')](_0x426321)[_0xa7be('0xf')](_0x54ccd6);}};}function respondWithFilteredResult(_0x1d7ecb,_0x314fb9){return function(_0x551401){if(_0x551401){var _0x586558=typeof _0x314fb9['offset']===_0xa7be('0x10')&&typeof _0x314fb9[_0xa7be('0x11')]===_0xa7be('0x10');var _0x271739=_0x551401[_0xa7be('0x12')];var _0x2ec7f8=_0x586558?0x0:_0x314fb9[_0xa7be('0x13')];var _0x55af66=_0x586558?_0x551401[_0xa7be('0x12')]:_0x314fb9[_0xa7be('0x13')]+_0x314fb9['limit'];var _0x5778ca;if(_0x55af66>=_0x271739){_0x55af66=_0x271739;_0x5778ca=0xc8;}else{_0x5778ca=0xce;}_0x1d7ecb[_0xa7be('0xd')](_0x5778ca);return _0x1d7ecb[_0xa7be('0x14')]('Content-Range',_0x2ec7f8+'-'+_0x55af66+'/'+_0x271739)[_0xa7be('0xf')](_0x551401);}return null;};}function saveUpdates(_0x2fcb5b){return function(_0x1dd12d){if(_0x1dd12d){return _0x1dd12d[_0xa7be('0x15')](_0x2fcb5b)['then'](function(_0x3a146c){return _0x3a146c;});}return null;};}function removeEntity(_0x4cd906){return function(_0x2178d2){if(_0x2178d2){return _0x2178d2['destroy']()[_0xa7be('0x16')](function(){var _0x2db8e2=_0x2178d2[_0xa7be('0x17')]({'plain':!![]});var _0x260b87=_0xa7be('0x18');return db['UserProfileResource'][_0xa7be('0x19')]({'where':{'type':_0x260b87,'resourceId':_0x2db8e2['id']}})[_0xa7be('0x16')](function(){return _0x2178d2;});})['then'](function(){_0x4cd906[_0xa7be('0xd')](0xcc)[_0xa7be('0xe')]();});}};}function handleEntityNotFound(_0x47258a){return function(_0x58d3e3){if(!_0x58d3e3){_0x47258a[_0xa7be('0xc')](0x194);}return _0x58d3e3;};}function handleError(_0x37a087,_0x1bf917){_0x1bf917=_0x1bf917||0x1f4;return function(_0x2956ee){logger[_0xa7be('0x1a')](_0x2956ee[_0xa7be('0x1b')]);if(_0x2956ee[_0xa7be('0x1c')]){delete _0x2956ee[_0xa7be('0x1c')];}_0x37a087[_0xa7be('0xd')](_0x1bf917)[_0xa7be('0x1d')](_0x2956ee);};}exports[_0xa7be('0x1e')]=function(_0x4436fe,_0x25b413){var _0x56b243={};var _0x4994a9={'count':0x0,'rows':[]};var _0x1c39f4=_[_0xa7be('0x1f')](db['WhatsappQueue'][_0xa7be('0x20')],function(_0xf93e8a){return{'name':_0xf93e8a[_0xa7be('0x21')],'type':_0xf93e8a[_0xa7be('0x22')][_0xa7be('0x23')]};});_0x56b243=qs[_0xa7be('0x24')](_0x1c39f4,_0x4436fe);var _0x39bb03={'where':_0x56b243['where']};return db[_0xa7be('0x25')][_0xa7be('0x12')](_0x39bb03)[_0xa7be('0x16')](function(_0x365cd4){_0x4994a9['count']=_0x365cd4;_0x56b243['include']=qs[_0xa7be('0x26')](_0x4436fe[_0xa7be('0x27')]);return db['WhatsappQueue'][_0xa7be('0x28')](_0x56b243);})[_0xa7be('0x16')](function(_0x3afae7){_0x4994a9[_0xa7be('0x29')]=_0x3afae7;return _0x4994a9;})['then'](respondWithFilteredResult(_0x25b413,_0x56b243))[_0xa7be('0x2a')](handleError(_0x25b413,null));};exports[_0xa7be('0x2b')]=function(_0x51ab31,_0x4258ae){var _0x42d491={'raw':!![],'where':{'id':_0x51ab31[_0xa7be('0x2c')]['id']}},_0x1ef063={};_0x1ef063[_0xa7be('0x2d')]=_[_0xa7be('0x2e')](db[_0xa7be('0x25')][_0xa7be('0x20')]);_0x1ef063['query']=_[_0xa7be('0x2e')](_0x51ab31['query']);_0x1ef063['filters']=_['intersection'](_0x1ef063[_0xa7be('0x2d')],_0x1ef063['query']);_0x42d491[_0xa7be('0x2f')]=_[_0xa7be('0x30')](_0x1ef063[_0xa7be('0x2d')],qs[_0xa7be('0x31')](_0x51ab31[_0xa7be('0x27')][_0xa7be('0x31')]));_0x42d491['attributes']=_0x42d491[_0xa7be('0x2f')][_0xa7be('0x32')]?_0x42d491[_0xa7be('0x2f')]:_0x1ef063[_0xa7be('0x2d')];if(_0x51ab31[_0xa7be('0x27')][_0xa7be('0x33')]){_0x42d491['include']=[{'all':!![]}];}_0x42d491=_[_0xa7be('0x34')]({},_0x42d491,_0x51ab31[_0xa7be('0x35')]);return db[_0xa7be('0x25')][_0xa7be('0x36')](_0x42d491)['then'](handleEntityNotFound(_0x4258ae,null))[_0xa7be('0x16')](respondWithResult(_0x4258ae,null))[_0xa7be('0x2a')](handleError(_0x4258ae,null));};exports[_0xa7be('0x37')]=function(_0x279fef,_0x5c3326){return db['WhatsappQueue']['create'](_0x279fef['body'],{})[_0xa7be('0x16')](function(_0x5ab703){var _0x58049f=_0x279fef['user'][_0xa7be('0x17')]({'plain':!![]});if(!_0x58049f)throw new Error(_0xa7be('0x38'));if(_0x58049f[_0xa7be('0x39')]==='user'){var _0x7fb6ee=_0x5ab703['get']({'plain':!![]});var _0x45b8f9='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x45b8f9,'userProfileId':_0x58049f['userProfileId']},'raw':!![]})[_0xa7be('0x16')](function(_0x5a0ef4){if(_0x5a0ef4&&_0x5a0ef4[_0xa7be('0x3a')]===0x0){return db[_0xa7be('0x3b')][_0xa7be('0x37')]({'name':_0x7fb6ee[_0xa7be('0x1c')],'resourceId':_0x7fb6ee['id'],'type':_0x5a0ef4[_0xa7be('0x1c')],'sectionId':_0x5a0ef4['id']},{})[_0xa7be('0x16')](function(){return _0x5ab703;});}else{return _0x5ab703;}})[_0xa7be('0x2a')](function(_0x470079){logger[_0xa7be('0x1a')](_0xa7be('0x3c'),_0x470079);throw _0x470079;});}return _0x5ab703;})[_0xa7be('0x16')](respondWithResult(_0x5c3326,0xc9))[_0xa7be('0x2a')](handleError(_0x5c3326,null));};exports[_0xa7be('0x15')]=function(_0xc5ec06,_0x5b9934){if(_0xc5ec06[_0xa7be('0x3d')]['id']){delete _0xc5ec06[_0xa7be('0x3d')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0xc5ec06[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](handleEntityNotFound(_0x5b9934,null))[_0xa7be('0x16')](saveUpdates(_0xc5ec06[_0xa7be('0x3d')],null))['then'](respondWithResult(_0x5b9934,null))[_0xa7be('0x2a')](handleError(_0x5b9934,null));};exports[_0xa7be('0x19')]=function(_0x30452e,_0x1b6933){return db[_0xa7be('0x25')][_0xa7be('0x36')]({'where':{'id':_0x30452e[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](handleEntityNotFound(_0x1b6933,null))[_0xa7be('0x16')](removeEntity(_0x1b6933,null))[_0xa7be('0x2a')](handleError(_0x1b6933,null));};exports[_0xa7be('0x3e')]=function(_0x477d29,_0x49dc82){return db[_0xa7be('0x25')][_0xa7be('0x3e')]()[_0xa7be('0x16')](respondWithResult(_0x49dc82,null))[_0xa7be('0x2a')](handleError(_0x49dc82,null));};exports[_0xa7be('0x3f')]=function(_0x50fb45,_0x4b6c0e){var _0x2c722b={'raw':!![],'where':{}},_0x4eb20c={},_0x44788c;return db['WhatsappQueue'][_0xa7be('0x40')]({'where':{'id':_0x50fb45[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](handleEntityNotFound(_0x4b6c0e,null))[_0xa7be('0x16')](function(_0x11d1ef){if(_0x11d1ef){_0x44788c=_0x11d1ef[_0xa7be('0x17')]({'plain':!![]});_0x4eb20c[_0xa7be('0x2d')]=_[_0xa7be('0x2e')](db[_0xa7be('0x41')][_0xa7be('0x20')]);_0x4eb20c[_0xa7be('0x27')]=_['keys'](_0x50fb45[_0xa7be('0x27')]);_0x4eb20c[_0xa7be('0x42')]=_[_0xa7be('0x30')](_0x4eb20c[_0xa7be('0x2d')],_0x4eb20c[_0xa7be('0x27')]);_0x2c722b['attributes']=_[_0xa7be('0x30')](_0x4eb20c[_0xa7be('0x2d')],qs[_0xa7be('0x31')](_0x50fb45[_0xa7be('0x27')][_0xa7be('0x31')]));_0x2c722b[_0xa7be('0x2f')]=_0x2c722b['attributes'][_0xa7be('0x32')]?_0x2c722b['attributes']:_0x4eb20c['model'];if(!_0x50fb45['query'][_0xa7be('0x43')](_0xa7be('0x44'))){_0x2c722b['limit']=qs[_0xa7be('0x11')](_0x50fb45[_0xa7be('0x27')][_0xa7be('0x11')]);_0x2c722b['offset']=qs[_0xa7be('0x13')](_0x50fb45['query'][_0xa7be('0x13')]);}_0x2c722b[_0xa7be('0x45')]=qs[_0xa7be('0x46')](_0x50fb45[_0xa7be('0x27')][_0xa7be('0x46')]);_0x2c722b[_0xa7be('0x47')]=qs[_0xa7be('0x42')](_['pick'](_0x50fb45[_0xa7be('0x27')],_0x4eb20c[_0xa7be('0x42')]));_0x2c722b[_0xa7be('0x47')][_0xa7be('0x48')]=_0x11d1ef['id'];if(_0x50fb45[_0xa7be('0x27')][_0xa7be('0x49')]){_0x2c722b['where']=_[_0xa7be('0x34')](_0x2c722b[_0xa7be('0x47')],{'$or':_['map'](_0x2c722b[_0xa7be('0x2f')],function(_0xecd50a){var _0x28b8e2={};_0x28b8e2[_0xecd50a]={'$like':'%'+_0x50fb45[_0xa7be('0x27')][_0xa7be('0x49')]+'%'};return _0x28b8e2;})});}_0x2c722b=_[_0xa7be('0x34')]({},_0x2c722b,_0x50fb45[_0xa7be('0x35')]);return db[_0xa7be('0x41')]['findAll'](_0x2c722b);}})[_0xa7be('0x16')](function(_0x834a01){if(_0x834a01){return db[_0xa7be('0x4a')]['findAndCountAll']({'where':{'id':_[_0xa7be('0x1f')](_0x834a01,'UserId'),'role':_0xa7be('0x4b')},'attributes':['id',_0xa7be('0x1c'),_0xa7be('0x4c'),_0xa7be('0x4d'),_0xa7be('0x4e')]});}})[_0xa7be('0x16')](function(_0x3d2f2c){if(_0x3d2f2c){return{'count':_0x3d2f2c[_0xa7be('0x12')],'rows':_['map'](_0x3d2f2c['rows'],function(_0x17ca25){return{'membername':_0x17ca25[_0xa7be('0x1c')],'UserId':_0x17ca25['id'],'queue_name':_0x44788c[_0xa7be('0x1c')],'WhatsappQueueId':_0x44788c['id'],'interface':util[_0xa7be('0x4f')](_0xa7be('0x50'),_0xa7be('0x51'),_0x17ca25['name']),'penalty':0x0,'paused':_0x17ca25[_0xa7be('0x4c')],'createdAt':_0x17ca25['createdAt'],'updatedAt':_0x17ca25[_0xa7be('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4b6c0e,_0x2c722b))[_0xa7be('0x2a')](handleError(_0x4b6c0e,null));};exports[_0xa7be('0x52')]=function(_0x28ea06,_0x332d48){var _0x39468b={};var _0x502543={};var _0x302a06;var _0x4f7843;return db['WhatsappQueue'][_0xa7be('0x40')]({'where':{'id':_0x28ea06['params']['id']}})[_0xa7be('0x16')](handleEntityNotFound(_0x332d48,null))['then'](function(_0x213ba8){if(_0x213ba8){_0x302a06=_0x213ba8;_0x502543[_0xa7be('0x2d')]=_[_0xa7be('0x2e')](db[_0xa7be('0x53')][_0xa7be('0x20')]);_0x502543[_0xa7be('0x27')]=_[_0xa7be('0x2e')](_0x28ea06[_0xa7be('0x27')]);_0x502543[_0xa7be('0x42')]=_[_0xa7be('0x30')](_0x502543[_0xa7be('0x2d')],_0x502543['query']);_0x39468b[_0xa7be('0x2f')]=_[_0xa7be('0x30')](_0x502543[_0xa7be('0x2d')],qs[_0xa7be('0x31')](_0x28ea06[_0xa7be('0x27')]['fields']));_0x39468b[_0xa7be('0x2f')]=_0x39468b[_0xa7be('0x2f')][_0xa7be('0x32')]?_0x39468b[_0xa7be('0x2f')]:_0x502543['model'];_0x39468b['order']=qs[_0xa7be('0x46')](_0x28ea06[_0xa7be('0x27')]['sort']);_0x39468b[_0xa7be('0x47')]=qs['filters'](_[_0xa7be('0x54')](_0x28ea06[_0xa7be('0x27')],_0x502543[_0xa7be('0x42')]));if(_0x28ea06['query'][_0xa7be('0x49')]){_0x39468b[_0xa7be('0x47')]=_['merge'](_0x39468b[_0xa7be('0x47')],{'$or':_[_0xa7be('0x1f')](_0x39468b['attributes'],function(_0x22ccc6){var _0x3c4bf4={};_0x3c4bf4[_0x22ccc6]={'$like':'%'+_0x28ea06['query'][_0xa7be('0x49')]+'%'};return _0x3c4bf4;})});}_0x39468b=_[_0xa7be('0x34')]({},_0x39468b,_0x28ea06[_0xa7be('0x35')]);return _0x302a06['getTeams'](_0x39468b);}})['then'](function(_0x5e96a5){if(_0x5e96a5){_0x4f7843=_0x5e96a5[_0xa7be('0x32')];if(!_0x28ea06[_0xa7be('0x27')][_0xa7be('0x43')](_0xa7be('0x44'))){_0x39468b[_0xa7be('0x11')]=qs[_0xa7be('0x11')](_0x28ea06['query']['limit']);_0x39468b[_0xa7be('0x13')]=qs[_0xa7be('0x13')](_0x28ea06[_0xa7be('0x27')][_0xa7be('0x13')]);}return _0x302a06[_0xa7be('0x52')](_0x39468b);}})[_0xa7be('0x16')](function(_0x2c4427){if(_0x2c4427){return _0x2c4427?{'count':_0x4f7843,'rows':_0x2c4427}:null;}})['then'](respondWithResult(_0x332d48,null))[_0xa7be('0x2a')](handleError(_0x332d48,null));};exports[_0xa7be('0x55')]=function(_0x2616cc,_0x202b85){var _0x1954c=_0x2616cc['body'][_0xa7be('0x56')];return db['Team'][_0xa7be('0x28')]({'where':{'id':_0x1954c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa7be('0x1c'),_0xa7be('0x57'),_0xa7be('0x58'),_0xa7be('0x59')],'raw':!![]}]})[_0xa7be('0x16')](function(_0x2044bb){if(_0x2044bb){var _0x491b5d=_[_0xa7be('0x5a')](_0x2044bb,function(_0x22ff65){var _0x4c06fe=_0x22ff65[_0xa7be('0x17')]({'plain':!![]});return _0x4c06fe[_0xa7be('0x5b')];});return db['WhatsappQueue'][_0xa7be('0x36')]({'where':{'id':_0x2616cc[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](function(_0x424d71){return db[_0xa7be('0x5c')][_0xa7be('0x5d')](function(_0x48f64e){return _0x424d71[_0xa7be('0x55')](_0x1954c,{'transaction':_0x48f64e})[_0xa7be('0x16')](function(){return BPromise[_0xa7be('0x5e')](_0x491b5d,function(_0x32e42b){return db[_0xa7be('0x41')][_0xa7be('0x5f')]({'where':{'UserId':_0x32e42b['id'],'WhatsappQueueId':_0x2616cc[_0xa7be('0x2c')]['id']},'transaction':_0x48f64e});});})[_0xa7be('0x16')](function(){_0x491b5d[_0xa7be('0x60')](function(_0x5d6cd8){socket['emit'](_0xa7be('0x61'),{'UserId':_0x5d6cd8['id'],'WhatsappQueueId':_0x424d71['id']});});});});});}})[_0xa7be('0x16')](respondWithStatusCode(_0x202b85,null))[_0xa7be('0x2a')](handleError(_0x202b85,null));};exports['removeTeams']=function(_0x547883,_0x35d1d9){return db[_0xa7be('0x53')][_0xa7be('0x28')]({'where':{'id':_0x547883[_0xa7be('0x27')][_0xa7be('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa7be('0x4a')],'as':_0xa7be('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xa7be('0x16')](handleEntityNotFound(_0x35d1d9,null))[_0xa7be('0x16')](function(_0x5e6e50){var _0x1c6cb7=_['map'](_0x5e6e50,'id');var _0x5c4c76=[];var _0x3700da=[];var _0x5547ba=squel[_0xa7be('0x62')]();_0x5547ba[_0xa7be('0x63')](_0xa7be('0x64'))[_0xa7be('0x65')](_0xa7be('0x66'),'tq')[_0xa7be('0x67')](_0xa7be('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa7be('0x47')](_0xa7be('0x69'),_0x547883['params']['id']);for(var _0x74475c=0x0;_0x74475c<_0x5e6e50[_0xa7be('0x32')];_0x74475c+=0x1){let _0x1fa8fb=_0x5e6e50[_0x74475c];for(var _0x12dd28=0x0;_0x12dd28<_0x1fa8fb[_0xa7be('0x5b')]['length'];_0x12dd28+=0x1){let _0x1839b0=_0x1fa8fb['Agents'][_0x12dd28];var _0x42f21b=_0x5547ba[_0xa7be('0x6a')]();_0x42f21b[_0xa7be('0x47')](_0xa7be('0x6b'),_0x1839b0['id']);_0x3700da[_0xa7be('0x6c')](db[_0xa7be('0x5c')]['query'](_0x42f21b['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xa7be('0x16')](function(_0x2ad6c5){if(_0x2ad6c5[_0xa7be('0x32')]===0x1){return _0x1839b0['id'];}else{var _0x76b3f9=_[_0xa7be('0x6d')](_[_0xa7be('0x1f')](_0x2ad6c5,_0xa7be('0x6e')),function(_0x1755a2){return _[_0xa7be('0x6f')](_0x1c6cb7,_0x1755a2);});if(_0x76b3f9){return _0x1839b0['id'];}}}));}}return BPromise['all'](_0x3700da)['then'](function(_0x3a3eb3){_0x5c4c76=_(_0x5c4c76)[_0xa7be('0x70')](_0x3a3eb3)['compact']()[_0xa7be('0x71')]();return db[_0xa7be('0x25')]['find']({'where':{'id':_0x547883[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](function(_0x4e1092){return db[_0xa7be('0x5c')][_0xa7be('0x5d')](function(_0x5f0fa){return _0x4e1092[_0xa7be('0x72')](_0x547883['query'][_0xa7be('0x56')],{'transaction':_0x5f0fa})[_0xa7be('0x16')](function(){if(!_['isEmpty'](_0x5c4c76)){return _0x4e1092[_0xa7be('0x73')](_0x5c4c76,{'transaction':_0x5f0fa});}})[_0xa7be('0x16')](function(){_0x5c4c76[_0xa7be('0x60')](function(_0x5b5285){socket[_0xa7be('0x74')](_0xa7be('0x75'),{'UserId':_0x5b5285,'WhatsappQueueId':_0x4e1092['id']});});});});});});})['then'](respondWithStatusCode(_0x35d1d9,null))[_0xa7be('0x2a')](handleError(_0x35d1d9,null));};exports[_0xa7be('0x76')]=function(_0xbf5071,_0x5e28b7){return db['WhatsappQueue']['find']({'where':{'id':_0xbf5071[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](handleEntityNotFound(_0x5e28b7,null))[_0xa7be('0x16')](function(_0x2f80d4){if(_0x2f80d4){return _0x2f80d4[_0xa7be('0x76')](_0xbf5071[_0xa7be('0x3d')]['ids'],_['omit'](_0xbf5071[_0xa7be('0x3d')],['ids','id'])||{})[_0xa7be('0x77')](function(_0x4b227c){for(var _0xd6a51=0x0;_0xd6a51<_0xbf5071[_0xa7be('0x3d')]['ids'][_0xa7be('0x32')];_0xd6a51+=0x1){socket[_0xa7be('0x74')](_0xa7be('0x61'),{'UserId':Number(_0xbf5071[_0xa7be('0x3d')][_0xa7be('0x56')][_0xd6a51]),'WhatsappQueueId':Number(_0xbf5071[_0xa7be('0x2c')]['id'])});}return _0x4b227c;});}})['then'](respondWithResult(_0x5e28b7,null))[_0xa7be('0x2a')](handleError(_0x5e28b7,null));};exports[_0xa7be('0x73')]=function(_0x1bde68,_0x1aa419){return db[_0xa7be('0x25')][_0xa7be('0x36')]({'where':{'id':_0x1bde68[_0xa7be('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1aa419,null))[_0xa7be('0x16')](function(_0x3c8f19){if(_0x3c8f19){return _0x3c8f19[_0xa7be('0x73')](_0x1bde68[_0xa7be('0x27')]['ids'])[_0xa7be('0x16')](function(){if(_[_0xa7be('0x78')](_0x1bde68['query']['ids'])){for(var _0x28c2ae=0x0;_0x28c2ae<_0x1bde68['query'][_0xa7be('0x56')][_0xa7be('0x32')];_0x28c2ae+=0x1){socket[_0xa7be('0x74')](_0xa7be('0x75'),{'UserId':Number(_0x1bde68['query']['ids'][_0x28c2ae]),'WhatsappQueueId':Number(_0x1bde68[_0xa7be('0x2c')]['id'])});}}else{socket[_0xa7be('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x1bde68[_0xa7be('0x27')][_0xa7be('0x56')]),'WhatsappQueueId':Number(_0x1bde68[_0xa7be('0x2c')]['id'])});}});}})[_0xa7be('0x16')](respondWithStatusCode(_0x1aa419,null))['catch'](handleError(_0x1aa419,null));};exports[_0xa7be('0x79')]=function(_0x24ff82,_0x336cec){var _0x21e7cf={};var _0xb48d8f={};var _0x405df8;var _0x3386b0;return db[_0xa7be('0x25')][_0xa7be('0x40')]({'where':{'id':_0x24ff82[_0xa7be('0x2c')]['id']}})[_0xa7be('0x16')](handleEntityNotFound(_0x336cec,null))['then'](function(_0x1670c5){if(_0x1670c5){_0x405df8=_0x1670c5;_0xb48d8f[_0xa7be('0x2d')]=_[_0xa7be('0x2e')](db[_0xa7be('0x4a')][_0xa7be('0x20')]);_0xb48d8f[_0xa7be('0x27')]=_[_0xa7be('0x2e')](_0x24ff82[_0xa7be('0x27')]);_0xb48d8f[_0xa7be('0x42')]=_[_0xa7be('0x30')](_0xb48d8f['model'],_0xb48d8f[_0xa7be('0x27')]);_0x21e7cf['attributes']=_[_0xa7be('0x30')](_0xb48d8f[_0xa7be('0x2d')],qs[_0xa7be('0x31')](_0x24ff82[_0xa7be('0x27')][_0xa7be('0x31')]));_0x21e7cf[_0xa7be('0x2f')]=_0x21e7cf[_0xa7be('0x2f')][_0xa7be('0x32')]?_0x21e7cf[_0xa7be('0x2f')]:_0xb48d8f[_0xa7be('0x2d')];_0x21e7cf[_0xa7be('0x45')]=qs[_0xa7be('0x46')](_0x24ff82[_0xa7be('0x27')][_0xa7be('0x46')]);_0x21e7cf['where']=qs['filters'](_[_0xa7be('0x54')](_0x24ff82[_0xa7be('0x27')],_0xb48d8f[_0xa7be('0x42')]));if(_0x24ff82['query']['filter']){_0x21e7cf[_0xa7be('0x47')]=_[_0xa7be('0x34')](_0x21e7cf[_0xa7be('0x47')],{'$or':_['map'](_0x21e7cf[_0xa7be('0x2f')],function(_0x5179a2){var _0x491b8b={};_0x491b8b[_0x5179a2]={'$like':'%'+_0x24ff82[_0xa7be('0x27')][_0xa7be('0x49')]+'%'};return _0x491b8b;})});}_0x21e7cf=_[_0xa7be('0x34')]({},_0x21e7cf,_0x24ff82[_0xa7be('0x35')]);return _0x405df8['getAgents'](_0x21e7cf);}})['then'](function(_0x344f41){if(_0x344f41){_0x3386b0=_0x344f41[_0xa7be('0x32')];if(!_0x24ff82[_0xa7be('0x27')][_0xa7be('0x43')](_0xa7be('0x44'))){_0x21e7cf[_0xa7be('0x11')]=qs['limit'](_0x24ff82['query'][_0xa7be('0x11')]);_0x21e7cf[_0xa7be('0x13')]=qs[_0xa7be('0x13')](_0x24ff82['query'][_0xa7be('0x13')]);}return _0x405df8[_0xa7be('0x79')](_0x21e7cf);}})[_0xa7be('0x16')](function(_0x2da674){if(_0x2da674){return _0x2da674?{'count':_0x3386b0,'rows':_0x2da674}:null;}})[_0xa7be('0x16')](respondWithResult(_0x336cec,null))['catch'](handleError(_0x336cec,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 38325eb..37ac383 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 _0x97a5=['WhatsappQueue','setMaxListeners','save','remove','emit','events','../../mysqldb'];(function(_0x55f493,_0x45b237){var _0x4f6a92=function(_0x2d2552){while(--_0x2d2552){_0x55f493['push'](_0x55f493['shift']());}};_0x4f6a92(++_0x45b237);}(_0x97a5,0x163));var _0x597a=function(_0x386c06,_0x387158){_0x386c06=_0x386c06-0x0;var _0x513310=_0x97a5[_0x386c06];return _0x513310;};'use strict';var EventEmitter=require(_0x597a('0x0'));var WhatsappQueue=require(_0x597a('0x1'))['db'][_0x597a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x597a('0x3')](0x0);var events={'afterCreate':_0x597a('0x4'),'afterUpdate':'update','afterDestroy':_0x597a('0x5')};function emitEvent(_0x1f33a2){return function(_0x54d0aa,_0x393827,_0x2347e4){WhatsappQueueEvents[_0x597a('0x6')](_0x1f33a2+':'+_0x54d0aa['id'],_0x54d0aa);WhatsappQueueEvents['emit'](_0x1f33a2,_0x54d0aa);_0x2347e4(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 +var _0xaa86=['update','remove','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x3fed0e,_0x165944){var _0x835399=function(_0x462743){while(--_0x462743){_0x3fed0e['push'](_0x3fed0e['shift']());}};_0x835399(++_0x165944);}(_0xaa86,0x1ab));var _0x6aa8=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xaa86[_0x18ab2a];return _0x16dcee;};'use strict';var EventEmitter=require(_0x6aa8('0x0'));var WhatsappQueue=require(_0x6aa8('0x1'))['db'][_0x6aa8('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6aa8('0x3')](0x0);var events={'afterCreate':_0x6aa8('0x4'),'afterUpdate':_0x6aa8('0x5'),'afterDestroy':_0x6aa8('0x6')};function emitEvent(_0x429fff){return function(_0x24ad03,_0xcfac09,_0xf240e8){WhatsappQueueEvents['emit'](_0x429fff+':'+_0x24ad03['id'],_0x24ad03);WhatsappQueueEvents['emit'](_0x429fff,_0x24ad03);_0xf240e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x6aa8('0x7')](e,emitEvent(event));}}module[_0x6aa8('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9ee3c34..76b30e3 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 _0x325f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x325f,0x183));var _0xf325=function(_0xca60aa,_0x6f8310){_0xca60aa=_0xca60aa-0x0;var _0x164daa=_0x325f[_0xca60aa];return _0x164daa;};'use strict';var _=require(_0xf325('0x0'));var util=require(_0xf325('0x1'));var logger=require(_0xf325('0x2'))(_0xf325('0x3'));var moment=require(_0xf325('0x4'));var BPromise=require(_0xf325('0x5'));var rp=require(_0xf325('0x6'));var fs=require('fs');var path=require(_0xf325('0x7'));var rimraf=require(_0xf325('0x8'));var config=require(_0xf325('0x9'));var attributes=require(_0xf325('0xa'));module[_0xf325('0xb')]=function(_0xd42976,_0x13dd48){return _0xd42976[_0xf325('0xc')](_0xf325('0xd'),attributes,{'tableName':_0xf325('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6a=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5f6a,0xfc));var _0xa5f6=function(_0x233b10,_0x2a7011){_0x233b10=_0x233b10-0x0;var _0x20e2a7=_0x5f6a[_0x233b10];return _0x20e2a7;};'use strict';var _=require('lodash');var util=require(_0xa5f6('0x0'));var logger=require(_0xa5f6('0x1'))(_0xa5f6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa5f6('0x3'));var fs=require('fs');var path=require(_0xa5f6('0x4'));var rimraf=require(_0xa5f6('0x5'));var config=require(_0xa5f6('0x6'));var attributes=require(_0xa5f6('0x7'));module['exports']=function(_0x7054ea,_0x29fa43){return _0x7054ea[_0xa5f6('0x8')](_0xa5f6('0x9'),attributes,{'tableName':_0xa5f6('0xa'),'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 907f11c..0626c34 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 _0x3655=['client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','model','GetWhatsappQueue','catch','ShowWhatsappQueue','find','map','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x2c8706,_0x4c7836){var _0x32f5c3=function(_0x130e11){while(--_0x130e11){_0x2c8706['push'](_0x2c8706['shift']());}};_0x32f5c3(++_0x4c7836);}(_0x3655,0x11a));var _0x5365=function(_0x5e06c3,_0x154aa1){_0x5e06c3=_0x5e06c3-0x0;var _0xd287dd=_0x3655[_0x5e06c3];return _0xd287dd;};'use strict';var _=require(_0x5365('0x0'));var util=require(_0x5365('0x1'));var moment=require(_0x5365('0x2'));var BPromise=require('bluebird');var rs=require(_0x5365('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5365('0x4'))['db'];var utils=require(_0x5365('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5365('0x6')]['http']({'port':0x232a});config[_0x5365('0x7')]=_['defaults'](config[_0x5365('0x7')],{'host':_0x5365('0x8'),'port':0x18eb});var socket=require(_0x5365('0x9'))(new Redis(config['redis']));require(_0x5365('0xa'))[_0x5365('0xb')](socket);function respondWithRpcPromise(_0x5def54,_0x4630d1,_0x302986){return new BPromise(function(_0xf71299,_0x19c7f2){return client[_0x5365('0xc')](_0x5def54,_0x302986)[_0x5365('0xd')](function(_0x2f84c9){logger[_0x5365('0xe')](_0x5365('0xf'),_0x4630d1,'request\x20sent');logger[_0x5365('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4630d1,_0x5365('0x11'),JSON[_0x5365('0x12')](_0x2f84c9));if(_0x2f84c9[_0x5365('0x13')]){if(_0x2f84c9[_0x5365('0x13')][_0x5365('0x14')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x4630d1,_0x2f84c9['error']['message']);return _0x19c7f2(_0x2f84c9[_0x5365('0x13')][_0x5365('0x15')]);}logger['error'](_0x5365('0xf'),_0x4630d1,_0x2f84c9[_0x5365('0x13')]['message']);return _0xf71299(_0x2f84c9[_0x5365('0x13')][_0x5365('0x15')]);}else{logger[_0x5365('0xe')](_0x5365('0xf'),_0x4630d1,_0x5365('0x11'));_0xf71299(_0x2f84c9[_0x5365('0x16')][_0x5365('0x15')]);}})['catch'](function(_0x5691cb){logger['error'](_0x5365('0xf'),_0x4630d1,_0x5691cb);_0x19c7f2(_0x5691cb);});});}exports['GetWhatsappQueue']=function(_0x4bfbdb){var _0x27d9f3=this;return new Promise(function(_0x57df66,_0x3d3609){return db['WhatsappQueue'][_0x5365('0x17')]({'raw':_0x4bfbdb[_0x5365('0x18')]?_0x4bfbdb['options'][_0x5365('0x19')]===undefined?!![]:![]:!![],'where':_0x4bfbdb[_0x5365('0x18')]?_0x4bfbdb[_0x5365('0x18')][_0x5365('0x1a')]||null:null,'attributes':_0x4bfbdb[_0x5365('0x18')]?_0x4bfbdb[_0x5365('0x18')][_0x5365('0x1b')]||null:null,'limit':_0x4bfbdb['options']?_0x4bfbdb[_0x5365('0x18')][_0x5365('0x1c')]||null:null,'include':_0x4bfbdb['options']?_0x4bfbdb[_0x5365('0x18')][_0x5365('0x1d')]?_['map'](_0x4bfbdb['options']['include'],function(_0x1207a9){return{'model':db[_0x1207a9[_0x5365('0x1e')]],'as':_0x1207a9['as'],'attributes':_0x1207a9[_0x5365('0x1b')],'include':_0x1207a9[_0x5365('0x1d')]?_['map'](_0x1207a9[_0x5365('0x1d')],function(_0x11afb5){return{'model':db[_0x11afb5['model']],'as':_0x11afb5['as'],'attributes':_0x11afb5['attributes'],'include':_0x11afb5[_0x5365('0x1d')]?_['map'](_0x11afb5[_0x5365('0x1d')],function(_0x2ce17c){return{'model':db[_0x2ce17c[_0x5365('0x1e')]],'as':_0x2ce17c['as'],'attributes':_0x2ce17c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dc496){logger[_0x5365('0xe')]('GetWhatsappQueue',_0x4bfbdb);logger['debug'](_0x5365('0x1f'),_0x4bfbdb,JSON['stringify'](_0x5dc496));_0x57df66(_0x5dc496);})[_0x5365('0x20')](function(_0x3ad981){logger[_0x5365('0x13')](_0x5365('0x1f'),_0x3ad981['message'],_0x4bfbdb);_0x3d3609(_0x27d9f3[_0x5365('0x13')](0x1f4,_0x3ad981['message']));});});};exports[_0x5365('0x21')]=function(_0x41a56d){var _0x11b191=this;return new Promise(function(_0x15ad45,_0x4e5a8b){return db['WhatsappQueue'][_0x5365('0x22')]({'raw':_0x41a56d['options']?_0x41a56d[_0x5365('0x18')][_0x5365('0x19')]===undefined?!![]:![]:!![],'where':_0x41a56d[_0x5365('0x18')]?_0x41a56d[_0x5365('0x18')][_0x5365('0x1a')]||null:null,'attributes':_0x41a56d[_0x5365('0x18')]?_0x41a56d[_0x5365('0x18')][_0x5365('0x1b')]||null:null,'include':_0x41a56d['options']?_0x41a56d['options']['include']?_[_0x5365('0x23')](_0x41a56d[_0x5365('0x18')]['include'],function(_0xfb8d85){return{'model':db[_0xfb8d85[_0x5365('0x1e')]],'as':_0xfb8d85['as'],'attributes':_0xfb8d85['attributes'],'include':_0xfb8d85[_0x5365('0x1d')]?_[_0x5365('0x23')](_0xfb8d85['include'],function(_0x1dcc24){return{'model':db[_0x1dcc24[_0x5365('0x1e')]],'as':_0x1dcc24['as'],'attributes':_0x1dcc24[_0x5365('0x1b')],'include':_0x1dcc24[_0x5365('0x1d')]?_[_0x5365('0x23')](_0x1dcc24[_0x5365('0x1d')],function(_0x123c6e){return{'model':db[_0x123c6e[_0x5365('0x1e')]],'as':_0x123c6e['as'],'attributes':_0x123c6e[_0x5365('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5365('0xd')](function(_0x4a0ed9){logger[_0x5365('0xe')](_0x5365('0x21'),_0x41a56d);logger[_0x5365('0x10')](_0x5365('0x21'),_0x41a56d,JSON[_0x5365('0x12')](_0x4a0ed9));_0x15ad45(_0x4a0ed9);})[_0x5365('0x20')](function(_0xa87e2a){logger['error'](_0x5365('0x21'),_0xa87e2a[_0x5365('0x15')],_0x41a56d);_0x4e5a8b(_0x11b191['error'](0x1f4,_0xa87e2a[_0x5365('0x15')]));});});}; \ No newline at end of file +var _0xeb42=['GetWhatsappQueue','WhatsappQueue','raw','options','where','attributes','include','map','model','info','ShowWhatsappQueue','find','lodash','util','moment','randomstring','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x203fc5,_0xca93b4){var _0x443614=function(_0x2d2624){while(--_0x2d2624){_0x203fc5['push'](_0x203fc5['shift']());}};_0x443614(++_0xca93b4);}(_0xeb42,0x98));var _0x2eb4=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0xeb42[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x2eb4('0x0'));var util=require(_0x2eb4('0x1'));var moment=require(_0x2eb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x2eb4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2eb4('0x4'))('rpc');var config=require(_0x2eb4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2eb4('0x6')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2eb4('0x7')],{'host':_0x2eb4('0x8'),'port':0x18eb});var socket=require(_0x2eb4('0x9'))(new Redis(config[_0x2eb4('0x7')]));require(_0x2eb4('0xa'))[_0x2eb4('0xb')](socket);function respondWithRpcPromise(_0x2bbc42,_0xdbf78d,_0x382612){return new BPromise(function(_0xebb775,_0x50c206){return client['request'](_0x2bbc42,_0x382612)[_0x2eb4('0xc')](function(_0x511b7f){logger['info'](_0x2eb4('0xd'),_0xdbf78d,'request\x20sent');logger[_0x2eb4('0xe')](_0x2eb4('0xf'),_0xdbf78d,_0x2eb4('0x10'),JSON[_0x2eb4('0x11')](_0x511b7f));if(_0x511b7f[_0x2eb4('0x12')]){if(_0x511b7f[_0x2eb4('0x12')][_0x2eb4('0x13')]===0x1f4){logger['error'](_0x2eb4('0xd'),_0xdbf78d,_0x511b7f['error'][_0x2eb4('0x14')]);return _0x50c206(_0x511b7f[_0x2eb4('0x12')]['message']);}logger[_0x2eb4('0x12')](_0x2eb4('0xd'),_0xdbf78d,_0x511b7f[_0x2eb4('0x12')][_0x2eb4('0x14')]);return _0xebb775(_0x511b7f[_0x2eb4('0x12')][_0x2eb4('0x14')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0xdbf78d,'request\x20sent');_0xebb775(_0x511b7f[_0x2eb4('0x15')]['message']);}})[_0x2eb4('0x16')](function(_0x35cf7a){logger[_0x2eb4('0x12')](_0x2eb4('0xd'),_0xdbf78d,_0x35cf7a);_0x50c206(_0x35cf7a);});});}exports[_0x2eb4('0x17')]=function(_0x178105){var _0x3bdbbf=this;return new Promise(function(_0x1a8c47,_0x4ec693){return db[_0x2eb4('0x18')]['findAll']({'raw':_0x178105['options']?_0x178105['options'][_0x2eb4('0x19')]===undefined?!![]:![]:!![],'where':_0x178105[_0x2eb4('0x1a')]?_0x178105['options'][_0x2eb4('0x1b')]||null:null,'attributes':_0x178105['options']?_0x178105[_0x2eb4('0x1a')][_0x2eb4('0x1c')]||null:null,'limit':_0x178105[_0x2eb4('0x1a')]?_0x178105[_0x2eb4('0x1a')]['limit']||null:null,'include':_0x178105[_0x2eb4('0x1a')]?_0x178105[_0x2eb4('0x1a')][_0x2eb4('0x1d')]?_[_0x2eb4('0x1e')](_0x178105[_0x2eb4('0x1a')][_0x2eb4('0x1d')],function(_0x301d85){return{'model':db[_0x301d85[_0x2eb4('0x1f')]],'as':_0x301d85['as'],'attributes':_0x301d85[_0x2eb4('0x1c')],'include':_0x301d85['include']?_['map'](_0x301d85['include'],function(_0x2aad78){return{'model':db[_0x2aad78[_0x2eb4('0x1f')]],'as':_0x2aad78['as'],'attributes':_0x2aad78[_0x2eb4('0x1c')],'include':_0x2aad78[_0x2eb4('0x1d')]?_[_0x2eb4('0x1e')](_0x2aad78[_0x2eb4('0x1d')],function(_0x50e7e7){return{'model':db[_0x50e7e7[_0x2eb4('0x1f')]],'as':_0x50e7e7['as'],'attributes':_0x50e7e7[_0x2eb4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2eb4('0xc')](function(_0xabd365){logger[_0x2eb4('0x20')]('GetWhatsappQueue',_0x178105);logger[_0x2eb4('0xe')]('GetWhatsappQueue',_0x178105,JSON[_0x2eb4('0x11')](_0xabd365));_0x1a8c47(_0xabd365);})[_0x2eb4('0x16')](function(_0x18270e){logger[_0x2eb4('0x12')](_0x2eb4('0x17'),_0x18270e[_0x2eb4('0x14')],_0x178105);_0x4ec693(_0x3bdbbf[_0x2eb4('0x12')](0x1f4,_0x18270e[_0x2eb4('0x14')]));});});};exports[_0x2eb4('0x21')]=function(_0x4112d0){var _0x28ce03=this;return new Promise(function(_0x2e8468,_0x327206){return db[_0x2eb4('0x18')][_0x2eb4('0x22')]({'raw':_0x4112d0[_0x2eb4('0x1a')]?_0x4112d0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4112d0['options']?_0x4112d0[_0x2eb4('0x1a')][_0x2eb4('0x1b')]||null:null,'attributes':_0x4112d0[_0x2eb4('0x1a')]?_0x4112d0[_0x2eb4('0x1a')][_0x2eb4('0x1c')]||null:null,'include':_0x4112d0[_0x2eb4('0x1a')]?_0x4112d0[_0x2eb4('0x1a')][_0x2eb4('0x1d')]?_[_0x2eb4('0x1e')](_0x4112d0[_0x2eb4('0x1a')][_0x2eb4('0x1d')],function(_0x5db542){return{'model':db[_0x5db542['model']],'as':_0x5db542['as'],'attributes':_0x5db542['attributes'],'include':_0x5db542[_0x2eb4('0x1d')]?_[_0x2eb4('0x1e')](_0x5db542[_0x2eb4('0x1d')],function(_0x3bcf4e){return{'model':db[_0x3bcf4e[_0x2eb4('0x1f')]],'as':_0x3bcf4e['as'],'attributes':_0x3bcf4e[_0x2eb4('0x1c')],'include':_0x3bcf4e[_0x2eb4('0x1d')]?_[_0x2eb4('0x1e')](_0x3bcf4e[_0x2eb4('0x1d')],function(_0x14fe5c){return{'model':db[_0x14fe5c['model']],'as':_0x14fe5c['as'],'attributes':_0x14fe5c[_0x2eb4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2eb4('0xc')](function(_0x3bb30f){logger['info'](_0x2eb4('0x21'),_0x4112d0);logger[_0x2eb4('0xe')](_0x2eb4('0x21'),_0x4112d0,JSON[_0x2eb4('0x11')](_0x3bb30f));_0x2e8468(_0x3bb30f);})['catch'](function(_0x12fff5){logger['error']('ShowWhatsappQueue',_0x12fff5['message'],_0x4112d0);_0x327206(_0x28ce03['error'](0x1f4,_0x12fff5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a8da21d..10b3c9d 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 _0x243a=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','register'];(function(_0x1bfae0,_0x5becff){var _0x3e837f=function(_0x5c3406){while(--_0x5c3406){_0x1bfae0['push'](_0x1bfae0['shift']());}};_0x3e837f(++_0x5becff);}(_0x243a,0x1a6));var _0xa243=function(_0x6a6c5f,_0x963075){_0x6a6c5f=_0x6a6c5f-0x0;var _0xe592e4=_0x243a[_0x6a6c5f];return _0xe592e4;};'use strict';var WhatsappQueueEvents=require(_0xa243('0x0'));var events=[_0xa243('0x1'),_0xa243('0x2'),_0xa243('0x3')];function createListener(_0x3a5e0c,_0x188f83){return function(_0x3a4de6){_0x188f83['emit'](_0x3a5e0c,_0x3a4de6);};}function removeListener(_0x566a12,_0x306c36){return function(){WhatsappQueueEvents['removeListener'](_0x566a12,_0x306c36);};}exports[_0xa243('0x4')]=function(_0x2dd019){for(var _0x1c5fb8=0x0,_0xe66901=events[_0xa243('0x5')];_0x1c5fb8<_0xe66901;_0x1c5fb8++){var _0x4e6237=events[_0x1c5fb8];var _0x4db7ac=createListener(_0xa243('0x6')+_0x4e6237,_0x2dd019);WhatsappQueueEvents['on'](_0x4e6237,_0x4db7ac);}}; \ No newline at end of file +var _0x6343=['register','length','whatsappQueue:','save','remove','update','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6343,0x1a0));var _0x3634=function(_0x2a28ee,_0x3ebfec){_0x2a28ee=_0x2a28ee-0x0;var _0x5e7262=_0x6343[_0x2a28ee];return _0x5e7262;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x3634('0x0'),_0x3634('0x1'),_0x3634('0x2')];function createListener(_0x43376f,_0x4e2bbd){return function(_0x21e528){_0x4e2bbd['emit'](_0x43376f,_0x21e528);};}function removeListener(_0x29139,_0x2c1494){return function(){WhatsappQueueEvents[_0x3634('0x3')](_0x29139,_0x2c1494);};}exports[_0x3634('0x4')]=function(_0x3310a1){for(var _0x3ca81f=0x0,_0x1db45d=events[_0x3634('0x5')];_0x3ca81f<_0x1db45d;_0x3ca81f++){var _0x1b8a28=events[_0x3ca81f];var _0x17d0e6=createListener(_0x3634('0x6')+_0x1b8a28,_0x3310a1);WhatsappQueueEvents['on'](_0x1b8a28,_0x17d0e6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 76141fe..2686e7f 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 _0xd45c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','create','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x13d2b5,_0x637906){var _0x21515b=function(_0x4f0caf){while(--_0x4f0caf){_0x13d2b5['push'](_0x13d2b5['shift']());}};_0x21515b(++_0x637906);}(_0xd45c,0x163));var _0xcd45=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd45c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xcd45('0x0'));var util=require('util');var path=require(_0xcd45('0x1'));var timeout=require(_0xcd45('0x2'));var express=require(_0xcd45('0x3'));var router=express[_0xcd45('0x4')]();var fs_extra=require(_0xcd45('0x5'));var auth=require(_0xcd45('0x6'));var interaction=require(_0xcd45('0x7'));var config=require(_0xcd45('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0xcd45('0x9')]('/',auth[_0xcd45('0xa')](),controller[_0xcd45('0xb')]);router[_0xcd45('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xcd45('0xc')]);router[_0xcd45('0x9')]('/:id',auth[_0xcd45('0xa')](),controller['show']);router['post']('/',auth[_0xcd45('0xa')](),controller[_0xcd45('0xd')]);router[_0xcd45('0xe')]('/:id',auth[_0xcd45('0xa')](),controller[_0xcd45('0xf')]);router['delete'](_0xcd45('0x10'),auth[_0xcd45('0xa')](),controller[_0xcd45('0x11')]);module[_0xcd45('0x12')]=router; \ No newline at end of file +var _0xa34e=['post','put','delete','destroy','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x387dc7,_0x54c5cc){var _0x1317b2=function(_0x5cc307){while(--_0x5cc307){_0x387dc7['push'](_0x387dc7['shift']());}};_0x1317b2(++_0x54c5cc);}(_0xa34e,0xe1));var _0xea34=function(_0x517ad3,_0x6181f5){_0x517ad3=_0x517ad3-0x0;var _0x4dbff4=_0xa34e[_0x517ad3];return _0x4dbff4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea34('0x0'));var timeout=require('connect-timeout');var express=require(_0xea34('0x1'));var router=express['Router']();var fs_extra=require(_0xea34('0x2'));var auth=require(_0xea34('0x3'));var interaction=require(_0xea34('0x4'));var config=require(_0xea34('0x5'));var controller=require(_0xea34('0x6'));router[_0xea34('0x7')]('/',auth[_0xea34('0x8')](),controller['index']);router['get'](_0xea34('0x9'),auth[_0xea34('0x8')](),controller[_0xea34('0xa')]);router['get'](_0xea34('0xb'),auth['isAuthenticated'](),controller[_0xea34('0xc')]);router[_0xea34('0xd')]('/',auth[_0xea34('0x8')](),controller['create']);router[_0xea34('0xe')](_0xea34('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xea34('0xf')](_0xea34('0xb'),auth[_0xea34('0x8')](),controller[_0xea34('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 83a2e8b..73ea664 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(_0x28493c,_0x6e47ee){var _0x445971=function(_0x3d603e){while(--_0x3d603e){_0x28493c['push'](_0x28493c['shift']());}};_0x445971(++_0x6e47ee);}(_0x7a54,0x106));var _0x47a5=function(_0x21a620,_0x8541db){_0x21a620=_0x21a620-0x0;var _0xb7c01e=_0x7a54[_0x21a620];return _0xb7c01e;};'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(_0x2ed2f3,_0x80490a){var _0x405e0d=function(_0x498cd9){while(--_0x498cd9){_0x2ed2f3['push'](_0x2ed2f3['shift']());}};_0x405e0d(++_0x80490a);}(_0x7a54,0x106));var _0x47a5=function(_0x57b9d1,_0x2fbe5e){_0x57b9d1=_0x57b9d1-0x0;var _0x15ce64=_0x7a54[_0x57b9d1];return _0x15ce64;};'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 3f6fc7e..0cad2bf 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 _0xdb94=['length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields'];(function(_0x1a2095,_0x52ba48){var _0x1d35ad=function(_0x5ecb71){while(--_0x5ecb71){_0x1a2095['push'](_0x1a2095['shift']());}};_0x1d35ad(++_0x52ba48);}(_0xdb94,0xab));var _0x4db9=function(_0x30baa6,_0x68246a){_0x30baa6=_0x30baa6-0x0;var _0x3761e3=_0xdb94[_0x30baa6];return _0x3761e3;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31222b,_0x5e644c){_0x5e644c=_0x5e644c||0xcc;return function(_0x571685){if(_0x571685){return _0x31222b[_0x4db9('0x17')](_0x5e644c);}return _0x31222b[_0x4db9('0x18')](_0x5e644c)['end']();};}function respondWithResult(_0xd37d63,_0x1f9638){_0x1f9638=_0x1f9638||0xc8;return function(_0x452896){if(_0x452896){return _0xd37d63[_0x4db9('0x18')](_0x1f9638)['json'](_0x452896);}};}function respondWithFilteredResult(_0x5e04ab,_0x102274){return function(_0x34de1a){if(_0x34de1a){var _0x4a037f=typeof _0x102274[_0x4db9('0x19')]===_0x4db9('0x1a')&&typeof _0x102274['limit']==='undefined';var _0x250a80=_0x34de1a[_0x4db9('0x1b')];var _0x462af3=_0x4a037f?0x0:_0x102274[_0x4db9('0x19')];var _0x1d3c33=_0x4a037f?_0x34de1a['count']:_0x102274[_0x4db9('0x19')]+_0x102274[_0x4db9('0x1c')];var _0x11012e;if(_0x1d3c33>=_0x250a80){_0x1d3c33=_0x250a80;_0x11012e=0xc8;}else{_0x11012e=0xce;}_0x5e04ab['status'](_0x11012e);return _0x5e04ab[_0x4db9('0x1d')](_0x4db9('0x1e'),_0x462af3+'-'+_0x1d3c33+'/'+_0x250a80)[_0x4db9('0x1f')](_0x34de1a);}return null;};}function patchUpdates(_0x4c92e8){return function(_0x46b522){try{jsonpatch[_0x4db9('0x20')](_0x46b522,_0x4c92e8,!![]);}catch(_0x4553c2){return BPromise[_0x4db9('0x21')](_0x4553c2);}return _0x46b522[_0x4db9('0x22')]();};}function saveUpdates(_0x159d9b,_0x3585d5){return function(_0x5aef3b){if(_0x5aef3b){return _0x5aef3b[_0x4db9('0x23')](_0x159d9b)[_0x4db9('0x24')](function(_0xcde40c){return _0xcde40c;});}return null;};}function removeEntity(_0x319475,_0x4aaa84){return function(_0x213daa){if(_0x213daa){return _0x213daa[_0x4db9('0x25')]()['then'](function(){_0x319475[_0x4db9('0x18')](0xcc)[_0x4db9('0x26')]();});}};}function handleEntityNotFound(_0x2987c6,_0x4dbb1b){return function(_0x3c8237){if(!_0x3c8237){_0x2987c6[_0x4db9('0x17')](0x194);}return _0x3c8237;};}function handleError(_0x43b95e,_0x2d330e){_0x2d330e=_0x2d330e||0x1f4;return function(_0x3f9f7e){logger[_0x4db9('0x27')](_0x3f9f7e[_0x4db9('0x28')]);if(_0x3f9f7e[_0x4db9('0x29')]){delete _0x3f9f7e[_0x4db9('0x29')];}_0x43b95e[_0x4db9('0x18')](_0x2d330e)[_0x4db9('0x2a')](_0x3f9f7e);};}exports[_0x4db9('0x2b')]=function(_0x2d646d,_0x20f133){var _0x583861={},_0x5031fe={},_0x3951b2={'count':0x0,'rows':[]};var _0x331279=_[_0x4db9('0x2c')](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x459131){return{'name':_0x459131['fieldName'],'type':_0x459131[_0x4db9('0x2f')]['key']};});_0x5031fe[_0x4db9('0x30')]=_[_0x4db9('0x2c')](_0x331279,_0x4db9('0x29'));_0x5031fe[_0x4db9('0x31')]=_[_0x4db9('0x32')](_0x2d646d['query']);_0x5031fe['filters']=_[_0x4db9('0x33')](_0x5031fe['model'],_0x5031fe[_0x4db9('0x31')]);_0x583861[_0x4db9('0x34')]=_['intersection'](_0x5031fe[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x2d646d[_0x4db9('0x31')]['fields']));_0x583861[_0x4db9('0x34')]=_0x583861['attributes'][_0x4db9('0x36')]?_0x583861[_0x4db9('0x34')]:_0x5031fe[_0x4db9('0x30')];if(!_0x2d646d['query']['hasOwnProperty'](_0x4db9('0x37'))){_0x583861[_0x4db9('0x1c')]=qs[_0x4db9('0x1c')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x1c')]);_0x583861[_0x4db9('0x19')]=qs[_0x4db9('0x19')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x19')]);}_0x583861['order']=qs[_0x4db9('0x38')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x38')]);_0x583861[_0x4db9('0x39')]=qs['filters'](_[_0x4db9('0x3a')](_0x2d646d[_0x4db9('0x31')],_0x5031fe[_0x4db9('0x3b')]),_0x331279);if(_0x2d646d['query'][_0x4db9('0x3c')]){_0x583861[_0x4db9('0x39')]=_[_0x4db9('0x3d')](_0x583861[_0x4db9('0x39')],{'$or':_['map'](_0x331279,function(_0x5a78b4){if(_0x5a78b4[_0x4db9('0x2f')]!==_0x4db9('0x3e')){var _0x32e62b={};_0x32e62b[_0x5a78b4[_0x4db9('0x29')]]={'$like':'%'+_0x2d646d[_0x4db9('0x31')]['filter']+'%'};return _0x32e62b;}})});}_0x583861=_[_0x4db9('0x3d')]({},_0x583861,_0x2d646d[_0x4db9('0x3f')]);var _0x23affc={'where':_0x583861[_0x4db9('0x39')]};return db[_0x4db9('0x2d')]['count'](_0x23affc)[_0x4db9('0x24')](function(_0x324765){_0x3951b2[_0x4db9('0x1b')]=_0x324765;if(_0x2d646d['query'][_0x4db9('0x40')]){_0x583861[_0x4db9('0x41')]=[{'all':!![]}];}return db[_0x4db9('0x2d')][_0x4db9('0x42')](_0x583861);})[_0x4db9('0x24')](function(_0x24aa2a){_0x3951b2[_0x4db9('0x43')]=_0x24aa2a;return _0x3951b2;})[_0x4db9('0x24')](respondWithFilteredResult(_0x20f133,_0x583861))[_0x4db9('0x44')](handleError(_0x20f133,null));};exports[_0x4db9('0x45')]=function(_0x4bb740,_0x56bd68){var _0x48aaf5={'raw':!![],'where':{'id':_0x4bb740[_0x4db9('0x46')]['id']}},_0x22a021={};_0x22a021['model']=_[_0x4db9('0x32')](db[_0x4db9('0x2d')]['rawAttributes']);_0x22a021['query']=_[_0x4db9('0x32')](_0x4bb740['query']);_0x22a021[_0x4db9('0x3b')]=_[_0x4db9('0x33')](_0x22a021['model'],_0x22a021[_0x4db9('0x31')]);_0x48aaf5[_0x4db9('0x34')]=_['intersection'](_0x22a021[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x4bb740[_0x4db9('0x31')]['fields']));_0x48aaf5['attributes']=_0x48aaf5[_0x4db9('0x34')][_0x4db9('0x36')]?_0x48aaf5[_0x4db9('0x34')]:_0x22a021[_0x4db9('0x30')];if(_0x4bb740[_0x4db9('0x31')][_0x4db9('0x40')]){_0x48aaf5[_0x4db9('0x41')]=[{'all':!![]}];}_0x48aaf5=_[_0x4db9('0x3d')]({},_0x48aaf5,_0x4bb740[_0x4db9('0x3f')]);return db[_0x4db9('0x2d')][_0x4db9('0x47')](_0x48aaf5)[_0x4db9('0x24')](handleEntityNotFound(_0x56bd68,null))[_0x4db9('0x24')](respondWithResult(_0x56bd68,null))['catch'](handleError(_0x56bd68,null));};exports[_0x4db9('0x48')]=function(_0x2faacf,_0x3852f0){return db[_0x4db9('0x2d')][_0x4db9('0x48')](_0x2faacf[_0x4db9('0x49')],{})[_0x4db9('0x24')](respondWithResult(_0x3852f0,0xc9))[_0x4db9('0x44')](handleError(_0x3852f0,null));};exports[_0x4db9('0x23')]=function(_0x2d6094,_0x10dccb){if(_0x2d6094['body']['id']){delete _0x2d6094['body']['id'];}return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0x2d6094[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x10dccb,null))[_0x4db9('0x24')](saveUpdates(_0x2d6094[_0x4db9('0x49')],null))[_0x4db9('0x24')](respondWithResult(_0x10dccb,null))[_0x4db9('0x44')](handleError(_0x10dccb,null));};exports['destroy']=function(_0xd8eae3,_0xcb832e){return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0xd8eae3[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0xcb832e,null))[_0x4db9('0x24')](removeEntity(_0xcb832e,null))[_0x4db9('0x44')](handleError(_0xcb832e,null));};exports['describe']=function(_0x45bc79,_0xd6701a){return db[_0x4db9('0x2d')][_0x4db9('0x4a')]()[_0x4db9('0x24')](respondWithResult(_0xd6701a,null))[_0x4db9('0x44')](handleError(_0xd6701a,null));}; \ No newline at end of file +var _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x33847d,_0x4b17cb){var _0x2d7843=function(_0xebd4ed){while(--_0xebd4ed){_0x33847d['push'](_0x33847d['shift']());}};_0x2d7843(++_0x4b17cb);}(_0x8f59,0x11d));var _0x98f5=function(_0x506002,_0x17ad62){_0x506002=_0x506002-0x0;var _0x5a020c=_0x8f59[_0x506002];return _0x5a020c;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];function respondWithStatusCode(_0x259abe,_0x1f00e8){_0x1f00e8=_0x1f00e8||0xcc;return function(_0x160626){if(_0x160626){return _0x259abe[_0x98f5('0x18')](_0x1f00e8);}return _0x259abe[_0x98f5('0x19')](_0x1f00e8)['end']();};}function respondWithResult(_0x24a7a9,_0xbade31){_0xbade31=_0xbade31||0xc8;return function(_0x5b8bab){if(_0x5b8bab){return _0x24a7a9[_0x98f5('0x19')](_0xbade31)[_0x98f5('0x1a')](_0x5b8bab);}};}function respondWithFilteredResult(_0xaa951a,_0x4ae70d){return function(_0x2437e7){if(_0x2437e7){var _0xc7a49b=typeof _0x4ae70d[_0x98f5('0x1b')]==='undefined'&&typeof _0x4ae70d[_0x98f5('0x1c')]===_0x98f5('0x1d');var _0x574644=_0x2437e7[_0x98f5('0x1e')];var _0x51a567=_0xc7a49b?0x0:_0x4ae70d[_0x98f5('0x1b')];var _0x9e42dd=_0xc7a49b?_0x2437e7[_0x98f5('0x1e')]:_0x4ae70d[_0x98f5('0x1b')]+_0x4ae70d[_0x98f5('0x1c')];var _0xa4477c;if(_0x9e42dd>=_0x574644){_0x9e42dd=_0x574644;_0xa4477c=0xc8;}else{_0xa4477c=0xce;}_0xaa951a['status'](_0xa4477c);return _0xaa951a[_0x98f5('0x1f')]('Content-Range',_0x51a567+'-'+_0x9e42dd+'/'+_0x574644)[_0x98f5('0x1a')](_0x2437e7);}return null;};}function patchUpdates(_0x191f23){return function(_0x5deca0){try{jsonpatch[_0x98f5('0x20')](_0x5deca0,_0x191f23,!![]);}catch(_0x2933d1){return BPromise[_0x98f5('0x21')](_0x2933d1);}return _0x5deca0[_0x98f5('0x22')]();};}function saveUpdates(_0x3b2d9d,_0x3dc7c2){return function(_0x38b46d){if(_0x38b46d){return _0x38b46d['update'](_0x3b2d9d)[_0x98f5('0x23')](function(_0x49ee4e){return _0x49ee4e;});}return null;};}function removeEntity(_0xcb10d6,_0x495889){return function(_0x44bfbb){if(_0x44bfbb){return _0x44bfbb[_0x98f5('0x24')]()[_0x98f5('0x23')](function(){_0xcb10d6[_0x98f5('0x19')](0xcc)[_0x98f5('0x25')]();});}};}function handleEntityNotFound(_0x18052d,_0x46dbd4){return function(_0x58d506){if(!_0x58d506){_0x18052d[_0x98f5('0x18')](0x194);}return _0x58d506;};}function handleError(_0x2b80a1,_0x5d7423){_0x5d7423=_0x5d7423||0x1f4;return function(_0x1a1c55){logger[_0x98f5('0x26')](_0x1a1c55[_0x98f5('0x27')]);if(_0x1a1c55[_0x98f5('0x28')]){delete _0x1a1c55[_0x98f5('0x28')];}_0x2b80a1[_0x98f5('0x19')](_0x5d7423)[_0x98f5('0x29')](_0x1a1c55);};}exports[_0x98f5('0x2a')]=function(_0x576c4b,_0x4c10b8){var _0x428c85={},_0x71661e={},_0x18bb29={'count':0x0,'rows':[]};var _0x209d15=_[_0x98f5('0x2b')](db[_0x98f5('0x2c')]['rawAttributes'],function(_0x29e1f5){return{'name':_0x29e1f5[_0x98f5('0x2d')],'type':_0x29e1f5[_0x98f5('0x2e')][_0x98f5('0x2f')]};});_0x71661e[_0x98f5('0x30')]=_[_0x98f5('0x2b')](_0x209d15,'name');_0x71661e[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x576c4b[_0x98f5('0x31')]);_0x71661e[_0x98f5('0x33')]=_['intersection'](_0x71661e[_0x98f5('0x30')],_0x71661e[_0x98f5('0x31')]);_0x428c85[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x71661e[_0x98f5('0x30')],qs[_0x98f5('0x36')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x36')]));_0x428c85[_0x98f5('0x34')]=_0x428c85[_0x98f5('0x34')][_0x98f5('0x37')]?_0x428c85[_0x98f5('0x34')]:_0x71661e[_0x98f5('0x30')];if(!_0x576c4b[_0x98f5('0x31')][_0x98f5('0x38')](_0x98f5('0x39'))){_0x428c85[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x1c')]);_0x428c85['offset']=qs[_0x98f5('0x1b')](_0x576c4b['query']['offset']);}_0x428c85[_0x98f5('0x3a')]=qs[_0x98f5('0x3b')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3b')]);_0x428c85['where']=qs[_0x98f5('0x33')](_[_0x98f5('0x3c')](_0x576c4b[_0x98f5('0x31')],_0x71661e['filters']),_0x209d15);if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3d')]){_0x428c85['where']=_[_0x98f5('0x3e')](_0x428c85[_0x98f5('0x3f')],{'$or':_[_0x98f5('0x2b')](_0x209d15,function(_0x580f19){if(_0x580f19[_0x98f5('0x2e')]!==_0x98f5('0x40')){var _0x19f045={};_0x19f045[_0x580f19[_0x98f5('0x28')]]={'$like':'%'+_0x576c4b[_0x98f5('0x31')]['filter']+'%'};return _0x19f045;}})});}_0x428c85=_['merge']({},_0x428c85,_0x576c4b[_0x98f5('0x41')]);var _0x14faf2={'where':_0x428c85[_0x98f5('0x3f')]};return db[_0x98f5('0x2c')][_0x98f5('0x1e')](_0x14faf2)[_0x98f5('0x23')](function(_0x58064e){_0x18bb29['count']=_0x58064e;if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x42')]){_0x428c85[_0x98f5('0x43')]=[{'all':!![]}];}return db[_0x98f5('0x2c')]['findAll'](_0x428c85);})['then'](function(_0x2dafcd){_0x18bb29[_0x98f5('0x44')]=_0x2dafcd;return _0x18bb29;})[_0x98f5('0x23')](respondWithFilteredResult(_0x4c10b8,_0x428c85))[_0x98f5('0x45')](handleError(_0x4c10b8,null));};exports['show']=function(_0x51ae92,_0x3db067){var _0x3a191f={'raw':!![],'where':{'id':_0x51ae92['params']['id']}},_0x372c33={};_0x372c33[_0x98f5('0x30')]=_['keys'](db[_0x98f5('0x2c')]['rawAttributes']);_0x372c33[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x51ae92[_0x98f5('0x31')]);_0x372c33['filters']=_[_0x98f5('0x35')](_0x372c33[_0x98f5('0x30')],_0x372c33['query']);_0x3a191f[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x372c33['model'],qs[_0x98f5('0x36')](_0x51ae92['query'][_0x98f5('0x36')]));_0x3a191f[_0x98f5('0x34')]=_0x3a191f['attributes']['length']?_0x3a191f['attributes']:_0x372c33['model'];if(_0x51ae92[_0x98f5('0x31')]['includeAll']){_0x3a191f[_0x98f5('0x43')]=[{'all':!![]}];}_0x3a191f=_[_0x98f5('0x3e')]({},_0x3a191f,_0x51ae92[_0x98f5('0x41')]);return db[_0x98f5('0x2c')][_0x98f5('0x46')](_0x3a191f)[_0x98f5('0x23')](handleEntityNotFound(_0x3db067,null))['then'](respondWithResult(_0x3db067,null))[_0x98f5('0x45')](handleError(_0x3db067,null));};exports[_0x98f5('0x47')]=function(_0x4b3fa8,_0x2c3cef){return db[_0x98f5('0x2c')][_0x98f5('0x47')](_0x4b3fa8['body'],{})[_0x98f5('0x23')](respondWithResult(_0x2c3cef,0xc9))[_0x98f5('0x45')](handleError(_0x2c3cef,null));};exports[_0x98f5('0x48')]=function(_0x1d4b3b,_0x4a0cda){if(_0x1d4b3b[_0x98f5('0x49')]['id']){delete _0x1d4b3b[_0x98f5('0x49')]['id'];}return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x1d4b3b[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a0cda,null))[_0x98f5('0x23')](saveUpdates(_0x1d4b3b[_0x98f5('0x49')],null))['then'](respondWithResult(_0x4a0cda,null))[_0x98f5('0x45')](handleError(_0x4a0cda,null));};exports['destroy']=function(_0x27ed57,_0x4cb157){return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x27ed57[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cb157,null))[_0x98f5('0x23')](removeEntity(_0x4cb157,null))[_0x98f5('0x45')](handleError(_0x4cb157,null));};exports[_0x98f5('0x4b')]=function(_0x2953e3,_0xde3d2d){return db[_0x98f5('0x2c')][_0x98f5('0x4b')]()[_0x98f5('0x23')](respondWithResult(_0xde3d2d,null))[_0x98f5('0x45')](handleError(_0xde3d2d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 038315b..658fca1 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 _0x2409=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2409,0xfa));var _0x9240=function(_0x249fea,_0x4c86c2){_0x249fea=_0x249fea-0x0;var _0x1be3c9=_0x2409[_0x249fea];return _0x1be3c9;};'use strict';var _=require(_0x9240('0x0'));var util=require(_0x9240('0x1'));var logger=require(_0x9240('0x2'))(_0x9240('0x3'));var moment=require(_0x9240('0x4'));var BPromise=require('bluebird');var rp=require(_0x9240('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9240('0x6'));var config=require(_0x9240('0x7'));var attributes=require(_0x9240('0x8'));module[_0x9240('0x9')]=function(_0x6a1594,_0x43f339){return _0x6a1594[_0x9240('0xa')](_0x9240('0xb'),attributes,{'tableName':_0x9240('0xc'),'paranoid':![],'indexes':[{'name':_0x9240('0xd'),'fields':[_0x9240('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2137=['../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x2137,0x7b));var _0x7213=function(_0x2f2004,_0x2ea89a){_0x2f2004=_0x2f2004-0x0;var _0x2ab262=_0x2137[_0x2f2004];return _0x2ab262;};'use strict';var _=require(_0x7213('0x0'));var util=require(_0x7213('0x1'));var logger=require(_0x7213('0x2'))('api');var moment=require(_0x7213('0x3'));var BPromise=require(_0x7213('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7213('0x5'));var rimraf=require(_0x7213('0x6'));var config=require(_0x7213('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x7213('0x8')]=function(_0x15980d,_0x20f95b){return _0x15980d[_0x7213('0x9')](_0x7213('0xa'),attributes,{'tableName':_0x7213('0xb'),'paranoid':![],'indexes':[{'name':_0x7213('0xc'),'fields':[_0x7213('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 760c7e3..b8a2f52 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 _0x40cb=['result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','attributes','limit','UpdateWhatsappQueueReport','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x3f2d78,_0x37d567){var _0x2d8bc8=function(_0x3f3965){while(--_0x3f3965){_0x3f2d78['push'](_0x3f2d78['shift']());}};_0x2d8bc8(++_0x37d567);}(_0x40cb,0x1ec));var _0xb40c=function(_0x2e3549,_0x16efc4){_0x2e3549=_0x2e3549-0x0;var _0x1bc76c=_0x40cb[_0x2e3549];return _0x1bc76c;};'use strict';var _=require(_0xb40c('0x0'));var util=require(_0xb40c('0x1'));var moment=require(_0xb40c('0x2'));var BPromise=require(_0xb40c('0x3'));var rs=require(_0xb40c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb40c('0x5'))['db'];var utils=require(_0xb40c('0x6'));var logger=require(_0xb40c('0x7'))(_0xb40c('0x8'));var config=require('../../config/environment');var jayson=require(_0xb40c('0x9'));var client=jayson[_0xb40c('0xa')][_0xb40c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31448b,_0x3fc9d9,_0xf52174){return new BPromise(function(_0x9b1729,_0x162a64){return client[_0xb40c('0xc')](_0x31448b,_0xf52174)[_0xb40c('0xd')](function(_0x4a09e7){logger[_0xb40c('0xe')](_0xb40c('0xf'),_0x3fc9d9,_0xb40c('0x10'));logger[_0xb40c('0x11')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3fc9d9,'request\x20sent',JSON['stringify'](_0x4a09e7));if(_0x4a09e7['error']){if(_0x4a09e7[_0xb40c('0x12')]['code']===0x1f4){logger[_0xb40c('0x12')](_0xb40c('0xf'),_0x3fc9d9,_0x4a09e7[_0xb40c('0x12')][_0xb40c('0x13')]);return _0x162a64(_0x4a09e7[_0xb40c('0x12')][_0xb40c('0x13')]);}logger['error'](_0xb40c('0xf'),_0x3fc9d9,_0x4a09e7[_0xb40c('0x12')][_0xb40c('0x13')]);return _0x9b1729(_0x4a09e7[_0xb40c('0x12')][_0xb40c('0x13')]);}else{logger['info'](_0xb40c('0xf'),_0x3fc9d9,'request\x20sent');_0x9b1729(_0x4a09e7[_0xb40c('0x14')]['message']);}})[_0xb40c('0x15')](function(_0x1753f6){logger[_0xb40c('0x12')](_0xb40c('0xf'),_0x3fc9d9,_0x1753f6);_0x162a64(_0x1753f6);});});}exports[_0xb40c('0x16')]=function(_0x1fc92c){var _0x28344c=this;return new Promise(function(_0x3698e7,_0x5ebf5e){return db[_0xb40c('0x17')][_0xb40c('0x18')](_0x1fc92c[_0xb40c('0x19')],{'raw':_0x1fc92c[_0xb40c('0x1a')]?_0x1fc92c[_0xb40c('0x1a')][_0xb40c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x549819){logger[_0xb40c('0xe')](_0xb40c('0x16'),_0x1fc92c);logger[_0xb40c('0x11')](_0xb40c('0x16'),_0x1fc92c,JSON['stringify'](_0x549819));_0x3698e7(_0x549819);})[_0xb40c('0x15')](function(_0x104d69){logger[_0xb40c('0x12')]('CreateWhatsappQueueReport',_0x104d69[_0xb40c('0x13')],_0x1fc92c);_0x5ebf5e(_0x28344c[_0xb40c('0x12')](0x1f4,_0x104d69['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x78d725){var _0xd6f446=this;return new Promise(function(_0x5afbb7,_0x5e3ca7){return db[_0xb40c('0x17')]['update'](_0x78d725[_0xb40c('0x19')],{'raw':_0x78d725[_0xb40c('0x1a')]?_0x78d725[_0xb40c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x78d725['options']?_0x78d725[_0xb40c('0x1a')]['where']||null:null,'attributes':_0x78d725[_0xb40c('0x1a')]?_0x78d725[_0xb40c('0x1a')][_0xb40c('0x1c')]||null:null,'limit':_0x78d725[_0xb40c('0x1a')]?_0x78d725['options'][_0xb40c('0x1d')]||null:null})[_0xb40c('0xd')](function(_0x43353d){logger[_0xb40c('0xe')]('UpdateWhatsappQueueReport',_0x78d725);logger[_0xb40c('0x11')](_0xb40c('0x1e'),_0x78d725,JSON[_0xb40c('0x1f')](_0x43353d));_0x5afbb7(_0x43353d);})['catch'](function(_0xb574c4){logger[_0xb40c('0x12')](_0xb40c('0x1e'),_0xb574c4[_0xb40c('0x13')],_0x78d725);_0x5e3ca7(_0xd6f446[_0xb40c('0x12')](0x1f4,_0xb574c4[_0xb40c('0x13')]));});});}; \ No newline at end of file +var _0xb4da=['body','options','catch','update','raw','where','attributes','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb4da,0xb2));var _0xab4d=function(_0x3674d4,_0x4ce93b){_0x3674d4=_0x3674d4-0x0;var _0x4b5cd4=_0xb4da[_0x3674d4];return _0x4b5cd4;};'use strict';var _=require(_0xab4d('0x0'));var util=require(_0xab4d('0x1'));var moment=require(_0xab4d('0x2'));var BPromise=require(_0xab4d('0x3'));var rs=require(_0xab4d('0x4'));var fs=require('fs');var Redis=require(_0xab4d('0x5'));var db=require(_0xab4d('0x6'))['db'];var utils=require(_0xab4d('0x7'));var logger=require('../../config/logger')(_0xab4d('0x8'));var config=require(_0xab4d('0x9'));var jayson=require(_0xab4d('0xa'));var client=jayson[_0xab4d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e16cb,_0x3e51d3,_0x3586fd){return new BPromise(function(_0x28b810,_0x7af8f0){return client[_0xab4d('0xc')](_0x5e16cb,_0x3586fd)[_0xab4d('0xd')](function(_0x2ad8d2){logger[_0xab4d('0xe')](_0xab4d('0xf'),_0x3e51d3,_0xab4d('0x10'));logger[_0xab4d('0x11')](_0xab4d('0x12'),_0x3e51d3,_0xab4d('0x10'),JSON[_0xab4d('0x13')](_0x2ad8d2));if(_0x2ad8d2['error']){if(_0x2ad8d2[_0xab4d('0x14')][_0xab4d('0x15')]===0x1f4){logger[_0xab4d('0x14')](_0xab4d('0xf'),_0x3e51d3,_0x2ad8d2[_0xab4d('0x14')][_0xab4d('0x16')]);return _0x7af8f0(_0x2ad8d2[_0xab4d('0x14')][_0xab4d('0x16')]);}logger[_0xab4d('0x14')](_0xab4d('0xf'),_0x3e51d3,_0x2ad8d2[_0xab4d('0x14')]['message']);return _0x28b810(_0x2ad8d2[_0xab4d('0x14')][_0xab4d('0x16')]);}else{logger['info'](_0xab4d('0xf'),_0x3e51d3,_0xab4d('0x10'));_0x28b810(_0x2ad8d2['result'][_0xab4d('0x16')]);}})['catch'](function(_0x280c04){logger[_0xab4d('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3e51d3,_0x280c04);_0x7af8f0(_0x280c04);});});}exports[_0xab4d('0x17')]=function(_0x42b12e){var _0x5f199d=this;return new Promise(function(_0x42e84e,_0x3f6f44){return db[_0xab4d('0x18')][_0xab4d('0x19')](_0x42b12e[_0xab4d('0x1a')],{'raw':_0x42b12e[_0xab4d('0x1b')]?_0x42b12e[_0xab4d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xab4d('0xd')](function(_0x376a01){logger[_0xab4d('0xe')]('CreateWhatsappQueueReport',_0x42b12e);logger['debug'](_0xab4d('0x17'),_0x42b12e,JSON['stringify'](_0x376a01));_0x42e84e(_0x376a01);})[_0xab4d('0x1c')](function(_0x4875b1){logger[_0xab4d('0x14')](_0xab4d('0x17'),_0x4875b1[_0xab4d('0x16')],_0x42b12e);_0x3f6f44(_0x5f199d[_0xab4d('0x14')](0x1f4,_0x4875b1[_0xab4d('0x16')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x84ac8e){var _0x17baf8=this;return new Promise(function(_0xb43b56,_0x3f57b1){return db[_0xab4d('0x18')][_0xab4d('0x1d')](_0x84ac8e[_0xab4d('0x1a')],{'raw':_0x84ac8e['options']?_0x84ac8e[_0xab4d('0x1b')][_0xab4d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x84ac8e[_0xab4d('0x1b')]?_0x84ac8e['options'][_0xab4d('0x1f')]||null:null,'attributes':_0x84ac8e[_0xab4d('0x1b')]?_0x84ac8e['options'][_0xab4d('0x20')]||null:null,'limit':_0x84ac8e['options']?_0x84ac8e['options']['limit']||null:null})[_0xab4d('0xd')](function(_0xf153ee){logger[_0xab4d('0xe')](_0xab4d('0x21'),_0x84ac8e);logger[_0xab4d('0x11')](_0xab4d('0x21'),_0x84ac8e,JSON[_0xab4d('0x13')](_0xf153ee));_0xb43b56(_0xf153ee);})[_0xab4d('0x1c')](function(_0x52e521){logger[_0xab4d('0x14')]('UpdateWhatsappQueueReport',_0x52e521[_0xab4d('0x16')],_0x84ac8e);_0x3f57b1(_0x17baf8[_0xab4d('0x14')](0x1f4,_0x52e521[_0xab4d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index cbd8509..470edca 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 _0x023b=['../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3d5ebc,_0x354479){var _0x1a9911=function(_0x1da1ea){while(--_0x1da1ea){_0x3d5ebc['push'](_0x3d5ebc['shift']());}};_0x1a9911(++_0x354479);}(_0x023b,0x7f));var _0xb023=function(_0x2dd578,_0x472cea){_0x2dd578=_0x2dd578-0x0;var _0x630798=_0x023b[_0x2dd578];return _0x630798;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb023('0x0'));var timeout=require(_0xb023('0x1'));var express=require(_0xb023('0x2'));var router=express[_0xb023('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb023('0x4'));var interaction=require(_0xb023('0x5'));var config=require(_0xb023('0x6'));var controller=require(_0xb023('0x7'));router['get']('/',auth[_0xb023('0x8')](),controller[_0xb023('0x9')]);router[_0xb023('0xa')](_0xb023('0xb'),auth['isAuthenticated'](),controller[_0xb023('0xc')]);router['get'](_0xb023('0xd'),auth[_0xb023('0x8')](),controller[_0xb023('0xe')]);router['post']('/',auth[_0xb023('0x8')](),controller[_0xb023('0xf')]);router['put'](_0xb023('0xd'),auth[_0xb023('0x8')](),controller[_0xb023('0x10')]);router['delete'](_0xb023('0xd'),auth[_0xb023('0x8')](),controller[_0xb023('0x11')]);module[_0xb023('0x12')]=router; \ No newline at end of file +var _0x9e3c=['destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','update'];(function(_0x905e,_0x276f75){var _0x107e81=function(_0x380537){while(--_0x380537){_0x905e['push'](_0x905e['shift']());}};_0x107e81(++_0x276f75);}(_0x9e3c,0x101));var _0xc9e3=function(_0x1eeb93,_0x34a11f){_0x1eeb93=_0x1eeb93-0x0;var _0x51610c=_0x9e3c[_0x1eeb93];return _0x51610c;};'use strict';var multer=require(_0xc9e3('0x0'));var util=require(_0xc9e3('0x1'));var path=require(_0xc9e3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc9e3('0x3')]();var fs_extra=require(_0xc9e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc9e3('0x5'));var config=require('../../config/environment');var controller=require(_0xc9e3('0x6'));router['get']('/',auth[_0xc9e3('0x7')](),controller[_0xc9e3('0x8')]);router[_0xc9e3('0x9')](_0xc9e3('0xa'),auth[_0xc9e3('0x7')](),controller[_0xc9e3('0xb')]);router['get'](_0xc9e3('0xc'),auth[_0xc9e3('0x7')](),controller['show']);router['post']('/',auth[_0xc9e3('0x7')](),controller[_0xc9e3('0xd')]);router['put'](_0xc9e3('0xc'),auth[_0xc9e3('0x7')](),controller[_0xc9e3('0xe')]);router['delete'](_0xc9e3('0xc'),auth[_0xc9e3('0x7')](),controller[_0xc9e3('0xf')]);module[_0xc9e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 824025c..18df72d 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 _0xb4f4=['agent','queue','sequelize','exports','ENUM','account'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xb4f4,0xda));var _0x4b4f=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xb4f4[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4b4f('0x2')](_0x4b4f('0x3'),_0x4b4f('0x4'),_0x4b4f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe6e4=['DATE','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x291029,_0x3ef8b1){var _0x4ce366=function(_0x2a4898){while(--_0x2a4898){_0x291029['push'](_0x291029['shift']());}};_0x4ce366(++_0x3ef8b1);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x212a7c,_0x26ef0d){_0x212a7c=_0x212a7c-0x0;var _0x1ab30f=_0xe6e4[_0x212a7c];return _0x1ab30f;};'use strict';var Sequelize=require(_0x4e6e('0x0'));module[_0x4e6e('0x1')]={'uniqueid':{'type':Sequelize[_0x4e6e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4e6e('0x3')](_0x4e6e('0x4'),_0x4e6e('0x5'),_0x4e6e('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4e6e('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7f8dca5..bbba35f 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 _0x45c8=['desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','limit','undefined','count','offset','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x45c8,0x8b));var _0x845c=function(_0x4bcfc3,_0x515e0f){_0x4bcfc3=_0x4bcfc3-0x0;var _0x389a3d=_0x45c8[_0x4bcfc3];return _0x389a3d;};'use strict';var emlformat=require(_0x845c('0x0'));var rimraf=require(_0x845c('0x1'));var zipdir=require(_0x845c('0x2'));var jsonpatch=require(_0x845c('0x3'));var rp=require(_0x845c('0x4'));var moment=require(_0x845c('0x5'));var BPromise=require(_0x845c('0x6'));var Mustache=require('mustache');var util=require(_0x845c('0x7'));var path=require('path');var sox=require(_0x845c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x845c('0x9'));var _=require(_0x845c('0xa'));var squel=require(_0x845c('0xb'));var crypto=require(_0x845c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x845c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x845c('0xe'));var authService=require(_0x845c('0xf'));var qs=require(_0x845c('0x10'));var as=require(_0x845c('0x11'));var hardwareService=require(_0x845c('0x12'));var logger=require(_0x845c('0x13'))(_0x845c('0x14'));var utils=require('../../config/utils');var config=require(_0x845c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x845c('0x16'))['db'];function respondWithStatusCode(_0x25030c,_0x5676aa){_0x5676aa=_0x5676aa||0xcc;return function(_0xe6c4f8){if(_0xe6c4f8){return _0x25030c['sendStatus'](_0x5676aa);}return _0x25030c[_0x845c('0x17')](_0x5676aa)[_0x845c('0x18')]();};}function respondWithResult(_0x4bc1bf,_0x671c7f){_0x671c7f=_0x671c7f||0xc8;return function(_0x44867b){if(_0x44867b){return _0x4bc1bf[_0x845c('0x17')](_0x671c7f)['json'](_0x44867b);}};}function respondWithFilteredResult(_0x49122b,_0x3566fa){return function(_0x2c6321){if(_0x2c6321){var _0x3380bd=typeof _0x3566fa['offset']==='undefined'&&typeof _0x3566fa[_0x845c('0x19')]===_0x845c('0x1a');var _0x1d4188=_0x2c6321[_0x845c('0x1b')];var _0x3b115a=_0x3380bd?0x0:_0x3566fa['offset'];var _0x492302=_0x3380bd?_0x2c6321[_0x845c('0x1b')]:_0x3566fa[_0x845c('0x1c')]+_0x3566fa[_0x845c('0x19')];var _0x3f0e0d;if(_0x492302>=_0x1d4188){_0x492302=_0x1d4188;_0x3f0e0d=0xc8;}else{_0x3f0e0d=0xce;}_0x49122b[_0x845c('0x17')](_0x3f0e0d);return _0x49122b['set'](_0x845c('0x1d'),_0x3b115a+'-'+_0x492302+'/'+_0x1d4188)[_0x845c('0x1e')](_0x2c6321);}return null;};}function patchUpdates(_0x19ddad){return function(_0x3591a4){try{jsonpatch['apply'](_0x3591a4,_0x19ddad,!![]);}catch(_0xeab85f){return BPromise[_0x845c('0x1f')](_0xeab85f);}return _0x3591a4[_0x845c('0x20')]();};}function saveUpdates(_0x7af79f,_0x14cc63){return function(_0x23f74b){if(_0x23f74b){return _0x23f74b['update'](_0x7af79f)[_0x845c('0x21')](function(_0x2e71f9){return _0x2e71f9;});}return null;};}function removeEntity(_0x4a73f5,_0x2b84dd){return function(_0x144451){if(_0x144451){return _0x144451[_0x845c('0x22')]()[_0x845c('0x21')](function(){_0x4a73f5[_0x845c('0x17')](0xcc)[_0x845c('0x18')]();});}};}function handleEntityNotFound(_0x19c12c,_0x499135){return function(_0x46f110){if(!_0x46f110){_0x19c12c[_0x845c('0x23')](0x194);}return _0x46f110;};}function handleError(_0x333296,_0x21cfa2){_0x21cfa2=_0x21cfa2||0x1f4;return function(_0x5955aa){logger[_0x845c('0x24')](_0x5955aa[_0x845c('0x25')]);if(_0x5955aa[_0x845c('0x26')]){delete _0x5955aa['name'];}_0x333296['status'](_0x21cfa2)[_0x845c('0x27')](_0x5955aa);};}exports[_0x845c('0x28')]=function(_0x50dee0,_0x1262bd){var _0x290c69={},_0x1365b2={},_0x1d48ca={'count':0x0,'rows':[]};var _0x1b3d2a=_[_0x845c('0x29')](db[_0x845c('0x2a')]['rawAttributes'],function(_0x1539dc){return{'name':_0x1539dc[_0x845c('0x2b')],'type':_0x1539dc[_0x845c('0x2c')][_0x845c('0x2d')]};});_0x1365b2[_0x845c('0x2e')]=_['map'](_0x1b3d2a,_0x845c('0x26'));_0x1365b2[_0x845c('0x2f')]=_[_0x845c('0x30')](_0x50dee0[_0x845c('0x2f')]);_0x1365b2[_0x845c('0x31')]=_[_0x845c('0x32')](_0x1365b2['model'],_0x1365b2[_0x845c('0x2f')]);_0x290c69[_0x845c('0x33')]=_[_0x845c('0x32')](_0x1365b2[_0x845c('0x2e')],qs[_0x845c('0x34')](_0x50dee0[_0x845c('0x2f')][_0x845c('0x34')]));_0x290c69[_0x845c('0x33')]=_0x290c69[_0x845c('0x33')]['length']?_0x290c69[_0x845c('0x33')]:_0x1365b2[_0x845c('0x2e')];if(!_0x50dee0[_0x845c('0x2f')][_0x845c('0x35')](_0x845c('0x36'))){_0x290c69[_0x845c('0x19')]=qs[_0x845c('0x19')](_0x50dee0['query'][_0x845c('0x19')]);_0x290c69['offset']=qs[_0x845c('0x1c')](_0x50dee0['query']['offset']);}_0x290c69[_0x845c('0x37')]=qs[_0x845c('0x38')](_0x50dee0[_0x845c('0x2f')]['sort']);_0x290c69[_0x845c('0x39')]=qs[_0x845c('0x31')](_[_0x845c('0x3a')](_0x50dee0[_0x845c('0x2f')],_0x1365b2['filters']),_0x1b3d2a);if(_0x50dee0[_0x845c('0x2f')][_0x845c('0x3b')]){_0x290c69[_0x845c('0x39')]=_['merge'](_0x290c69[_0x845c('0x39')],{'$or':_[_0x845c('0x29')](_0x1b3d2a,function(_0x53d6b2){if(_0x53d6b2[_0x845c('0x2c')]!==_0x845c('0x3c')){var _0x1ee52c={};_0x1ee52c[_0x53d6b2[_0x845c('0x26')]]={'$like':'%'+_0x50dee0[_0x845c('0x2f')]['filter']+'%'};return _0x1ee52c;}})});}_0x290c69=_[_0x845c('0x3d')]({},_0x290c69,_0x50dee0[_0x845c('0x3e')]);var _0x2f3ff5={'where':_0x290c69[_0x845c('0x39')]};return db['WhatsappTransferReport'][_0x845c('0x1b')](_0x2f3ff5)['then'](function(_0x1a7f0f){_0x1d48ca[_0x845c('0x1b')]=_0x1a7f0f;if(_0x50dee0['query']['includeAll']){_0x290c69[_0x845c('0x3f')]=[{'all':!![]}];}return db[_0x845c('0x2a')][_0x845c('0x40')](_0x290c69);})[_0x845c('0x21')](function(_0x225f1c){_0x1d48ca[_0x845c('0x41')]=_0x225f1c;return _0x1d48ca;})[_0x845c('0x21')](respondWithFilteredResult(_0x1262bd,_0x290c69))['catch'](handleError(_0x1262bd,null));};exports[_0x845c('0x42')]=function(_0x3c6d67,_0x32b153){var _0x31c686={'raw':!![],'where':{'id':_0x3c6d67[_0x845c('0x43')]['id']}},_0x229c16={};_0x229c16['model']=_[_0x845c('0x30')](db[_0x845c('0x2a')][_0x845c('0x44')]);_0x229c16[_0x845c('0x2f')]=_[_0x845c('0x30')](_0x3c6d67[_0x845c('0x2f')]);_0x229c16[_0x845c('0x31')]=_[_0x845c('0x32')](_0x229c16[_0x845c('0x2e')],_0x229c16[_0x845c('0x2f')]);_0x31c686[_0x845c('0x33')]=_['intersection'](_0x229c16[_0x845c('0x2e')],qs['fields'](_0x3c6d67[_0x845c('0x2f')][_0x845c('0x34')]));_0x31c686[_0x845c('0x33')]=_0x31c686[_0x845c('0x33')]['length']?_0x31c686[_0x845c('0x33')]:_0x229c16[_0x845c('0x2e')];if(_0x3c6d67['query'][_0x845c('0x45')]){_0x31c686[_0x845c('0x3f')]=[{'all':!![]}];}_0x31c686=_['merge']({},_0x31c686,_0x3c6d67[_0x845c('0x3e')]);return db[_0x845c('0x2a')][_0x845c('0x46')](_0x31c686)[_0x845c('0x21')](handleEntityNotFound(_0x32b153,null))[_0x845c('0x21')](respondWithResult(_0x32b153,null))[_0x845c('0x47')](handleError(_0x32b153,null));};exports[_0x845c('0x48')]=function(_0x2f78a8,_0x28934b){return db[_0x845c('0x2a')][_0x845c('0x48')](_0x2f78a8['body'],{})[_0x845c('0x21')](respondWithResult(_0x28934b,0xc9))['catch'](handleError(_0x28934b,null));};exports[_0x845c('0x49')]=function(_0x52dd6a,_0x1ae48b){if(_0x52dd6a[_0x845c('0x4a')]['id']){delete _0x52dd6a[_0x845c('0x4a')]['id'];}return db['WhatsappTransferReport'][_0x845c('0x46')]({'where':{'id':_0x52dd6a[_0x845c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ae48b,null))['then'](saveUpdates(_0x52dd6a['body'],null))['then'](respondWithResult(_0x1ae48b,null))[_0x845c('0x47')](handleError(_0x1ae48b,null));};exports[_0x845c('0x22')]=function(_0x2e3cde,_0x1d4dd6){return db[_0x845c('0x2a')]['find']({'where':{'id':_0x2e3cde['params']['id']}})['then'](handleEntityNotFound(_0x1d4dd6,null))[_0x845c('0x21')](removeEntity(_0x1d4dd6,null))[_0x845c('0x47')](handleError(_0x1d4dd6,null));};exports['describe']=function(_0x2371c3,_0xd60ab8){return db['WhatsappTransferReport'][_0x845c('0x4b')]()[_0x845c('0x21')](respondWithResult(_0xd60ab8,null))[_0x845c('0x47')](handleError(_0xd60ab8,null));}; \ No newline at end of file +var _0x0c8d=['end','json','offset','limit','undefined','count','status','set','apply','update','then','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','find','catch','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x0c8d,0x194));var _0xd0c8=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x0c8d[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0xd0c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0c8('0x2'));var moment=require(_0xd0c8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd0c8('0x4'));var csv=require(_0xd0c8('0x5'));var ejs=require(_0xd0c8('0x6'));var fs=require('fs');var fs_extra=require(_0xd0c8('0x7'));var _=require(_0xd0c8('0x8'));var squel=require(_0xd0c8('0x9'));var crypto=require('crypto');var jsforce=require(_0xd0c8('0xa'));var deskjs=require(_0xd0c8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd0c8('0xc'));var Redis=require(_0xd0c8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0c8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0c8('0xf'));var logger=require(_0xd0c8('0x10'))(_0xd0c8('0x11'));var utils=require(_0xd0c8('0x12'));var config=require(_0xd0c8('0x13'));var licenseUtil=require(_0xd0c8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bac76,_0x43bad4){_0x43bad4=_0x43bad4||0xcc;return function(_0x5789a8){if(_0x5789a8){return _0x3bac76[_0xd0c8('0x15')](_0x43bad4);}return _0x3bac76['status'](_0x43bad4)[_0xd0c8('0x16')]();};}function respondWithResult(_0x15ffbd,_0x50bf01){_0x50bf01=_0x50bf01||0xc8;return function(_0x3e1a12){if(_0x3e1a12){return _0x15ffbd['status'](_0x50bf01)[_0xd0c8('0x17')](_0x3e1a12);}};}function respondWithFilteredResult(_0xf8a922,_0x375a65){return function(_0x2afbab){if(_0x2afbab){var _0x358f76=typeof _0x375a65[_0xd0c8('0x18')]==='undefined'&&typeof _0x375a65[_0xd0c8('0x19')]===_0xd0c8('0x1a');var _0x4cb591=_0x2afbab[_0xd0c8('0x1b')];var _0x55e016=_0x358f76?0x0:_0x375a65[_0xd0c8('0x18')];var _0x16f33f=_0x358f76?_0x2afbab['count']:_0x375a65[_0xd0c8('0x18')]+_0x375a65['limit'];var _0x454c98;if(_0x16f33f>=_0x4cb591){_0x16f33f=_0x4cb591;_0x454c98=0xc8;}else{_0x454c98=0xce;}_0xf8a922[_0xd0c8('0x1c')](_0x454c98);return _0xf8a922[_0xd0c8('0x1d')]('Content-Range',_0x55e016+'-'+_0x16f33f+'/'+_0x4cb591)[_0xd0c8('0x17')](_0x2afbab);}return null;};}function patchUpdates(_0x403fe1){return function(_0x20d112){try{jsonpatch[_0xd0c8('0x1e')](_0x20d112,_0x403fe1,!![]);}catch(_0x40828d){return BPromise['reject'](_0x40828d);}return _0x20d112['save']();};}function saveUpdates(_0x965ace,_0x5a8871){return function(_0x56e37e){if(_0x56e37e){return _0x56e37e[_0xd0c8('0x1f')](_0x965ace)[_0xd0c8('0x20')](function(_0x354154){return _0x354154;});}return null;};}function removeEntity(_0x440860,_0x5426d2){return function(_0x4230f8){if(_0x4230f8){return _0x4230f8['destroy']()[_0xd0c8('0x20')](function(){_0x440860[_0xd0c8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545b07,_0x258d9a){return function(_0x1b3721){if(!_0x1b3721){_0x545b07[_0xd0c8('0x15')](0x194);}return _0x1b3721;};}function handleError(_0x57c744,_0x13d274){_0x13d274=_0x13d274||0x1f4;return function(_0x45b6e5){logger[_0xd0c8('0x21')](_0x45b6e5[_0xd0c8('0x22')]);if(_0x45b6e5[_0xd0c8('0x23')]){delete _0x45b6e5[_0xd0c8('0x23')];}_0x57c744[_0xd0c8('0x1c')](_0x13d274)[_0xd0c8('0x24')](_0x45b6e5);};}exports['index']=function(_0xec1137,_0x65ec5d){var _0x1c63c5={},_0x12b94c={},_0x1964be={'count':0x0,'rows':[]};var _0x4ef45d=_[_0xd0c8('0x25')](db[_0xd0c8('0x26')][_0xd0c8('0x27')],function(_0x3e8f44){return{'name':_0x3e8f44[_0xd0c8('0x28')],'type':_0x3e8f44[_0xd0c8('0x29')][_0xd0c8('0x2a')]};});_0x12b94c[_0xd0c8('0x2b')]=_['map'](_0x4ef45d,_0xd0c8('0x23'));_0x12b94c[_0xd0c8('0x2c')]=_[_0xd0c8('0x2d')](_0xec1137['query']);_0x12b94c[_0xd0c8('0x2e')]=_['intersection'](_0x12b94c[_0xd0c8('0x2b')],_0x12b94c[_0xd0c8('0x2c')]);_0x1c63c5['attributes']=_['intersection'](_0x12b94c[_0xd0c8('0x2b')],qs[_0xd0c8('0x2f')](_0xec1137[_0xd0c8('0x2c')][_0xd0c8('0x2f')]));_0x1c63c5[_0xd0c8('0x30')]=_0x1c63c5[_0xd0c8('0x30')]['length']?_0x1c63c5[_0xd0c8('0x30')]:_0x12b94c['model'];if(!_0xec1137[_0xd0c8('0x2c')][_0xd0c8('0x31')](_0xd0c8('0x32'))){_0x1c63c5['limit']=qs[_0xd0c8('0x19')](_0xec1137[_0xd0c8('0x2c')][_0xd0c8('0x19')]);_0x1c63c5[_0xd0c8('0x18')]=qs[_0xd0c8('0x18')](_0xec1137['query']['offset']);}_0x1c63c5[_0xd0c8('0x33')]=qs['sort'](_0xec1137['query'][_0xd0c8('0x34')]);_0x1c63c5[_0xd0c8('0x35')]=qs[_0xd0c8('0x2e')](_[_0xd0c8('0x36')](_0xec1137[_0xd0c8('0x2c')],_0x12b94c[_0xd0c8('0x2e')]),_0x4ef45d);if(_0xec1137[_0xd0c8('0x2c')][_0xd0c8('0x37')]){_0x1c63c5[_0xd0c8('0x35')]=_[_0xd0c8('0x38')](_0x1c63c5[_0xd0c8('0x35')],{'$or':_[_0xd0c8('0x25')](_0x4ef45d,function(_0xf0bc0a){if(_0xf0bc0a[_0xd0c8('0x29')]!==_0xd0c8('0x39')){var _0x168be3={};_0x168be3[_0xf0bc0a[_0xd0c8('0x23')]]={'$like':'%'+_0xec1137['query'][_0xd0c8('0x37')]+'%'};return _0x168be3;}})});}_0x1c63c5=_[_0xd0c8('0x38')]({},_0x1c63c5,_0xec1137[_0xd0c8('0x3a')]);var _0x37fb44={'where':_0x1c63c5[_0xd0c8('0x35')]};return db[_0xd0c8('0x26')]['count'](_0x37fb44)[_0xd0c8('0x20')](function(_0x50a1dd){_0x1964be[_0xd0c8('0x1b')]=_0x50a1dd;if(_0xec1137[_0xd0c8('0x2c')]['includeAll']){_0x1c63c5[_0xd0c8('0x3b')]=[{'all':!![]}];}return db[_0xd0c8('0x26')][_0xd0c8('0x3c')](_0x1c63c5);})[_0xd0c8('0x20')](function(_0x7c7072){_0x1964be[_0xd0c8('0x3d')]=_0x7c7072;return _0x1964be;})['then'](respondWithFilteredResult(_0x65ec5d,_0x1c63c5))['catch'](handleError(_0x65ec5d,null));};exports[_0xd0c8('0x3e')]=function(_0x2bd387,_0x23425f){var _0x407b3a={'raw':!![],'where':{'id':_0x2bd387[_0xd0c8('0x3f')]['id']}},_0x34ab1f={};_0x34ab1f[_0xd0c8('0x2b')]=_[_0xd0c8('0x2d')](db[_0xd0c8('0x26')][_0xd0c8('0x27')]);_0x34ab1f[_0xd0c8('0x2c')]=_['keys'](_0x2bd387[_0xd0c8('0x2c')]);_0x34ab1f[_0xd0c8('0x2e')]=_['intersection'](_0x34ab1f[_0xd0c8('0x2b')],_0x34ab1f[_0xd0c8('0x2c')]);_0x407b3a[_0xd0c8('0x30')]=_['intersection'](_0x34ab1f[_0xd0c8('0x2b')],qs[_0xd0c8('0x2f')](_0x2bd387[_0xd0c8('0x2c')][_0xd0c8('0x2f')]));_0x407b3a[_0xd0c8('0x30')]=_0x407b3a['attributes'][_0xd0c8('0x40')]?_0x407b3a[_0xd0c8('0x30')]:_0x34ab1f[_0xd0c8('0x2b')];if(_0x2bd387[_0xd0c8('0x2c')]['includeAll']){_0x407b3a[_0xd0c8('0x3b')]=[{'all':!![]}];}_0x407b3a=_[_0xd0c8('0x38')]({},_0x407b3a,_0x2bd387['options']);return db[_0xd0c8('0x26')][_0xd0c8('0x41')](_0x407b3a)[_0xd0c8('0x20')](handleEntityNotFound(_0x23425f,null))[_0xd0c8('0x20')](respondWithResult(_0x23425f,null))[_0xd0c8('0x42')](handleError(_0x23425f,null));};exports['create']=function(_0x24ada7,_0x3bbde7){return db[_0xd0c8('0x26')][_0xd0c8('0x43')](_0x24ada7[_0xd0c8('0x44')],{})[_0xd0c8('0x20')](respondWithResult(_0x3bbde7,0xc9))[_0xd0c8('0x42')](handleError(_0x3bbde7,null));};exports['update']=function(_0x542184,_0x28de16){if(_0x542184[_0xd0c8('0x44')]['id']){delete _0x542184['body']['id'];}return db[_0xd0c8('0x26')][_0xd0c8('0x41')]({'where':{'id':_0x542184['params']['id']}})[_0xd0c8('0x20')](handleEntityNotFound(_0x28de16,null))[_0xd0c8('0x20')](saveUpdates(_0x542184['body'],null))['then'](respondWithResult(_0x28de16,null))['catch'](handleError(_0x28de16,null));};exports[_0xd0c8('0x45')]=function(_0x32977b,_0x59661a){return db['WhatsappTransferReport'][_0xd0c8('0x41')]({'where':{'id':_0x32977b['params']['id']}})[_0xd0c8('0x20')](handleEntityNotFound(_0x59661a,null))[_0xd0c8('0x20')](removeEntity(_0x59661a,null))[_0xd0c8('0x42')](handleError(_0x59661a,null));};exports[_0xd0c8('0x46')]=function(_0x53f7db,_0x77c506){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x77c506,null))['catch'](handleError(_0x77c506,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7183a98..cd68138 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 _0x3ec7=['uniqueid','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x3a8697,_0x4e39e8){var _0xa4c873=function(_0x3479aa){while(--_0x3479aa){_0x3a8697['push'](_0x3a8697['shift']());}};_0xa4c873(++_0x4e39e8);}(_0x3ec7,0x198));var _0x73ec=function(_0x29f323,_0x1b6c3a){_0x29f323=_0x29f323-0x0;var _0x47c2f5=_0x3ec7[_0x29f323];return _0x47c2f5;};'use strict';var _=require(_0x73ec('0x0'));var util=require('util');var logger=require(_0x73ec('0x1'))('api');var moment=require(_0x73ec('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ec('0x3'));var rimraf=require(_0x73ec('0x4'));var config=require(_0x73ec('0x5'));var attributes=require(_0x73ec('0x6'));module['exports']=function(_0x1f92ef,_0x37cd5d){return _0x1f92ef[_0x73ec('0x7')](_0x73ec('0x8'),attributes,{'tableName':_0x73ec('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x73ec('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5c5=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','moment','bluebird','request-promise','path'];(function(_0x294c93,_0x537d2b){var _0x58dfa8=function(_0x292f5e){while(--_0x292f5e){_0x294c93['push'](_0x294c93['shift']());}};_0x58dfa8(++_0x537d2b);}(_0xf5c5,0x1e8));var _0x5f5c=function(_0x4a40eb,_0x1b4a72){_0x4a40eb=_0x4a40eb-0x0;var _0x179a8b=_0xf5c5[_0x4a40eb];return _0x179a8b;};'use strict';var _=require(_0x5f5c('0x0'));var util=require(_0x5f5c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f5c('0x2'));var BPromise=require(_0x5f5c('0x3'));var rp=require(_0x5f5c('0x4'));var fs=require('fs');var path=require(_0x5f5c('0x5'));var rimraf=require(_0x5f5c('0x6'));var config=require(_0x5f5c('0x7'));var attributes=require(_0x5f5c('0x8'));module[_0x5f5c('0x9')]=function(_0x2cb477,_0x22fda4){return _0x2cb477[_0x5f5c('0xa')](_0x5f5c('0xb'),attributes,{'tableName':_0x5f5c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 828edec..58b7188 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 _0x0556=['jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x0556,0xcb));var _0x6055=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x0556[_0x514c15];return _0x16283e;};'use strict';var _=require(_0x6055('0x0'));var util=require(_0x6055('0x1'));var moment=require('moment');var BPromise=require(_0x6055('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6055('0x3'));var logger=require(_0x6055('0x4'))(_0x6055('0x5'));var config=require(_0x6055('0x6'));var jayson=require(_0x6055('0x7'));var client=jayson[_0x6055('0x8')][_0x6055('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a2204,_0x251f7b,_0x39edf9){return new BPromise(function(_0x238798,_0x135306){return client[_0x6055('0xa')](_0x5a2204,_0x39edf9)['then'](function(_0x3ea951){logger[_0x6055('0xb')](_0x6055('0xc'),_0x251f7b,_0x6055('0xd'));logger[_0x6055('0xe')](_0x6055('0xf'),_0x251f7b,_0x6055('0xd'),JSON[_0x6055('0x10')](_0x3ea951));if(_0x3ea951['error']){if(_0x3ea951[_0x6055('0x11')][_0x6055('0x12')]===0x1f4){logger[_0x6055('0x11')](_0x6055('0xc'),_0x251f7b,_0x3ea951[_0x6055('0x11')]['message']);return _0x135306(_0x3ea951[_0x6055('0x11')]['message']);}logger[_0x6055('0x11')](_0x6055('0xc'),_0x251f7b,_0x3ea951[_0x6055('0x11')][_0x6055('0x13')]);return _0x238798(_0x3ea951[_0x6055('0x11')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x251f7b,_0x6055('0xd'));_0x238798(_0x3ea951['result'][_0x6055('0x13')]);}})[_0x6055('0x14')](function(_0x6a43ea){logger[_0x6055('0x11')](_0x6055('0xc'),_0x251f7b,_0x6a43ea);_0x135306(_0x6a43ea);});});} \ No newline at end of file +var _0x66dc=['WhatsappTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55dd60,_0x479fb7){var _0x505abb=function(_0x5429c9){while(--_0x5429c9){_0x55dd60['push'](_0x55dd60['shift']());}};_0x505abb(++_0x479fb7);}(_0x66dc,0x1a7));var _0xc66d=function(_0x2df0bf,_0x13990c){_0x2df0bf=_0x2df0bf-0x0;var _0x5c46a3=_0x66dc[_0x2df0bf];return _0x5c46a3;};'use strict';var _=require('lodash');var util=require(_0xc66d('0x0'));var moment=require(_0xc66d('0x1'));var BPromise=require(_0xc66d('0x2'));var rs=require(_0xc66d('0x3'));var fs=require('fs');var Redis=require(_0xc66d('0x4'));var db=require(_0xc66d('0x5'))['db'];var utils=require(_0xc66d('0x6'));var logger=require(_0xc66d('0x7'))(_0xc66d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc66d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c27c6,_0x5a18f6,_0x3a68a7){return new BPromise(function(_0xb9f8fe,_0x5417f8){return client['request'](_0x1c27c6,_0x3a68a7)['then'](function(_0x451fa3){logger[_0xc66d('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5a18f6,_0xc66d('0xb'));logger[_0xc66d('0xc')](_0xc66d('0xd'),_0x5a18f6,_0xc66d('0xb'),JSON[_0xc66d('0xe')](_0x451fa3));if(_0x451fa3[_0xc66d('0xf')]){if(_0x451fa3[_0xc66d('0xf')][_0xc66d('0x10')]===0x1f4){logger[_0xc66d('0xf')](_0xc66d('0x11'),_0x5a18f6,_0x451fa3[_0xc66d('0xf')][_0xc66d('0x12')]);return _0x5417f8(_0x451fa3[_0xc66d('0xf')][_0xc66d('0x12')]);}logger[_0xc66d('0xf')](_0xc66d('0x11'),_0x5a18f6,_0x451fa3[_0xc66d('0xf')]['message']);return _0xb9f8fe(_0x451fa3[_0xc66d('0xf')]['message']);}else{logger['info'](_0xc66d('0x11'),_0x5a18f6,'request\x20sent');_0xb9f8fe(_0x451fa3['result'][_0xc66d('0x12')]);}})[_0xc66d('0x13')](function(_0x8fe8d){logger[_0xc66d('0xf')](_0xc66d('0x11'),_0x5a18f6,_0x8fe8d);_0x5417f8(_0x8fe8d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 272e5f7..c36010e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1052=['./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash'];(function(_0x1be896,_0x424a13){var _0x385ccc=function(_0x4c1b5c){while(--_0x4c1b5c){_0x1be896['push'](_0x1be896['shift']());}};_0x385ccc(++_0x424a13);}(_0x1052,0xf4));var _0x2105=function(_0x15da77,_0x10872e){_0x15da77=_0x15da77-0x0;var _0x49642c=_0x1052[_0x15da77];return _0x49642c;};'use strict';var _=require(_0x2105('0x0'));var db=require(_0x2105('0x1'))['db'];var seedDb=require(_0x2105('0x2'));var checkLicense=require(_0x2105('0x3'));var rpc=require(_0x2105('0x4'));var config=require(_0x2105('0x5'));var logger=require(_0x2105('0x6'))(_0x2105('0x7'));var pm2=require(_0x2105('0x8'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x2105('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x2105('0xa'));var provider=require(_0x2105('0xb'));function main(){return db['sequelize'][_0x2105('0xc')]()[_0x2105('0xd')](function(){if(config[_0x2105('0xe')]){return seedDb['default']();}})['then'](function(){return checkLicense[_0x2105('0xf')]();})[_0x2105('0xd')](function(){return rpc[_0x2105('0x10')]();})['then'](function(_0x20e028){logger[_0x2105('0x11')](_0x20e028);return chat[_0x2105('0x12')]();})[_0x2105('0xd')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x2105('0x12')]();})[_0x2105('0xd')](function(){return transcribe[_0x2105('0x12')]();})[_0x2105('0xd')](function(){return provider[_0x2105('0x12')]();})[_0x2105('0xd')](function(_0x382ea5){logger[_0x2105('0x11')](_0x382ea5);return pm2[_0x2105('0x12')](pm2Config);})[_0x2105('0xd')](function(_0x59c7c5){var _0x42c92a=_0x59c7c5[_0x2105('0x13')](function(_0x1a3fa3){return typeof _0x1a3fa3[_0x2105('0x14')]==='number'&&_0x1a3fa3[_0x2105('0x14')]>=0x0;});if(_0x42c92a[_0x2105('0x15')]>0x0){throw new Error(_0x42c92a[_0x2105('0x15')]+_0x2105('0x16')+_[_0x2105('0x17')](_0x42c92a,function(_0x499942){return'\x22'+_0x499942[_0x2105('0x18')][_0x2105('0x19')]+'\x22';}));}logger['info'](_0x2105('0x1a'),_[_0x2105('0x17')](_[_0x2105('0x13')](_0x59c7c5,{'status':_0x2105('0x1b')}),_0x2105('0x19'))[_0x2105('0x1c')]());logger['info']('Offline\x20apps:',_[_0x2105('0x17')](_[_0x2105('0x13')](_0x59c7c5,function(_0x359abd){return _0x359abd[_0x2105('0x1d')]!==_0x2105('0x1b');}),_0x2105('0x19'))['join']()||_0x2105('0x1e'));console[_0x2105('0x1f')]('App\x20Ready!');})[_0x2105('0x20')](function(_0x1cc718){console[_0x2105('0x1f')](_0x2105('0x21'),_0x1cc718);logger['error'](_0x2105('0x22'),_0x1cc718);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x6688=['./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','status','online','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB'];(function(_0x4eeb49,_0x54b481){var _0x22ac76=function(_0x327ec8){while(--_0x327ec8){_0x4eeb49['push'](_0x4eeb49['shift']());}};_0x22ac76(++_0x54b481);}(_0x6688,0x10e));var _0x8668=function(_0x1e76c1,_0x5bb895){_0x1e76c1=_0x1e76c1-0x0;var _0x218957=_0x6688[_0x1e76c1];return _0x218957;};'use strict';var _=require(_0x8668('0x0'));var db=require(_0x8668('0x1'))['db'];var seedDb=require(_0x8668('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x8668('0x3'));var config=require(_0x8668('0x4'));var logger=require(_0x8668('0x5'))(_0x8668('0x6'));var pm2=require(_0x8668('0x7'));var pm2Config=require(_0x8668('0x8'));var schedule=require(_0x8668('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x8668('0xa'));var transcribe=require(_0x8668('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x8668('0xc')][_0x8668('0xd')]()[_0x8668('0xe')](function(){if(config[_0x8668('0xf')]){return seedDb[_0x8668('0x10')]();}})[_0x8668('0xe')](function(){return checkLicense[_0x8668('0x10')]();})[_0x8668('0xe')](function(){return rpc['listen']();})['then'](function(_0x545b4a){logger['info'](_0x545b4a);return chat[_0x8668('0x11')]();})[_0x8668('0xe')](function(){return whatsapp[_0x8668('0x11')]();})[_0x8668('0xe')](function(){return schedule[_0x8668('0x11')]();})['then'](function(){return transcribe['start']();})[_0x8668('0xe')](function(){return provider[_0x8668('0x11')]();})[_0x8668('0xe')](function(_0x48311a){logger[_0x8668('0x12')](_0x48311a);return pm2[_0x8668('0x11')](pm2Config);})[_0x8668('0xe')](function(_0x588c09){var _0x5dba71=_0x588c09[_0x8668('0x13')](function(_0x16fe4b){return typeof _0x16fe4b[_0x8668('0x14')]===_0x8668('0x15')&&_0x16fe4b['exitCode']>=0x0;});if(_0x5dba71['length']>0x0){throw new Error(_0x5dba71[_0x8668('0x16')]+_0x8668('0x17')+_[_0x8668('0x18')](_0x5dba71,function(_0x43a3c9){return'\x22'+_0x43a3c9[_0x8668('0x19')][_0x8668('0x1a')]+'\x22';}));}logger['info'](_0x8668('0x1b'),_['map'](_['filter'](_0x588c09,{'status':'online'}),'name')[_0x8668('0x1c')]());logger[_0x8668('0x12')](_0x8668('0x1d'),_['map'](_[_0x8668('0x13')](_0x588c09,function(_0x585220){return _0x585220[_0x8668('0x1e')]!==_0x8668('0x1f');}),_0x8668('0x1a'))['join']()||_0x8668('0x20'));console[_0x8668('0x21')](_0x8668('0x22'));})['catch'](function(_0x8c7ee){console[_0x8668('0x21')](_0x8668('0x23'),_0x8c7ee);logger[_0x8668('0x24')](_0x8668('0x25'),_0x8c7ee);process[_0x8668('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 250cced..1c12b01 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 _0xdb72=['blockDuration','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','query','forceDownload','status','json','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','getUuid','then','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key'];(function(_0x51eead,_0x432770){var _0x18a06b=function(_0x39cfff){while(--_0x39cfff){_0x51eead['push'](_0x51eead['shift']());}};_0x18a06b(++_0x432770);}(_0xdb72,0xbf));var _0x2db7=function(_0x1f75e8,_0x7fa97f){_0x1f75e8=_0x1f75e8-0x0;var _0x120699=_0xdb72[_0x1f75e8];return _0x120699;};'use strict';var db=require(_0x2db7('0x0'))['db'];var config=require(_0x2db7('0x1'));var hardwareConf=require(_0x2db7('0x2'));var licenseUtil=require(_0x2db7('0x3'));var encryptor=require(_0x2db7('0x4'));var _=require('lodash');var jwt=require(_0x2db7('0x5'));var expressJwt=require(_0x2db7('0x6'));var compose=require(_0x2db7('0x7'));var basicAuth=require(_0x2db7('0x8'));var crypto=require('crypto');var BPromise=require(_0x2db7('0x9'));var util=require(_0x2db7('0xa'));var moment=require(_0x2db7('0xb'));var validateJwt=expressJwt({'secret':config[_0x2db7('0xc')][_0x2db7('0xd')]});var userAttributes=['id',_0x2db7('0xe'),_0x2db7('0xf'),_0x2db7('0x10'),'internal','email',_0x2db7('0x11'),_0x2db7('0x12'),_0x2db7('0x13'),_0x2db7('0x14'),_0x2db7('0x15'),'mailPause',_0x2db7('0x16'),_0x2db7('0x17'),'openchannelPause',_0x2db7('0x18'),_0x2db7('0x19'),_0x2db7('0x1a'),_0x2db7('0x1b'),_0x2db7('0x1c'),'allowmessenger',_0x2db7('0x1d'),_0x2db7('0x1e'),_0x2db7('0x1f'),_0x2db7('0x20'),_0x2db7('0x21'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x2db7('0x22'),_0x2db7('0x23'),_0x2db7('0x24'),_0x2db7('0x25'),'phoneBarRemoteControlPort',_0x2db7('0x26'),'interface','userProfileId',_0x2db7('0x27'),_0x2db7('0x28'),_0x2db7('0x29'),_0x2db7('0x2a'),_0x2db7('0x2b'),_0x2db7('0x2c'),_0x2db7('0x2d'),_0x2db7('0x2e'),_0x2db7('0x2f'),'chatAutoanswerDelay',_0x2db7('0x30'),_0x2db7('0x31'),_0x2db7('0x32'),_0x2db7('0x33'),_0x2db7('0x34'),'openchannelAutoanswerDelay',_0x2db7('0x35'),_0x2db7('0x36'),'whatsappAutoanswer',_0x2db7('0x37'),_0x2db7('0x38')];exports[_0x2db7('0x39')]=function(){return this[_0x2db7('0x3a')](!![])[_0x2db7('0x3b')](function(_0x3488ed,_0x4abf21,_0x522535){if(_0x3488ed[_0x2db7('0x3c')]){_0x522535();}else{return db[_0x2db7('0x3d')][_0x2db7('0x3e')]({'where':{'id':_0x3488ed[_0x2db7('0x3f')]['id']},'attributes':['id',_0x2db7('0x40'),_0x2db7('0x41')],'raw':!![]})['then'](function(_0xeff38c){if(_0xeff38c&&_0xeff38c[_0x2db7('0x40')]&&!_0x3488ed[_0x2db7('0x42')][_0x2db7('0x43')]){return _0x4abf21[_0x2db7('0x44')](_0xeff38c[_0x2db7('0x41')]==='unmanaged'?0x195:0x193)[_0x2db7('0x45')]({'message':_0xeff38c[_0x2db7('0x41')]===_0x2db7('0x46')?_0x2db7('0x47'):_0x2db7('0x48')});}else{_0x522535();}})[_0x2db7('0x49')](function(_0x3db570){_0x522535(_0x3db570);});}});};exports[_0x2db7('0x3a')]=function isAuthenticated(_0x343806){return compose()[_0x2db7('0x3b')](function(_0x4ea3c2,_0x407892,_0x38a1ea){var _0x5d2f93;if(_0x4ea3c2['headers'][_0x2db7('0x4a')]){if(_[_0x2db7('0x4b')](_0x4ea3c2[_0x2db7('0x4c')][_0x2db7('0x4a')],_0x2db7('0x4d'))){var _0x45ed00=basicAuth(_0x4ea3c2);db[_0x2db7('0x4e')][_0x2db7('0x4f')]({'where':{'name':_0x45ed00['name']}})['then'](function(_0x4c8b41){if(!_0x4c8b41||!_0x4c8b41['authenticate'](_0x45ed00[_0x2db7('0x50')])){return _0x407892[_0x2db7('0x44')](0x191)[_0x2db7('0x45')]({'message':_0x2db7('0x51')});}_0x4ea3c2[_0x2db7('0x3c')]={'id':_0x4c8b41['id']};_0x38a1ea();})[_0x2db7('0x49')](function(_0x4b1905){_0x38a1ea(_0x4b1905);});}else if(_[_0x2db7('0x4b')](_0x4ea3c2['headers'][_0x2db7('0x4a')],'Bearer')){validateJwt(_0x4ea3c2,_0x407892,_0x38a1ea);}else{if(_0x343806){_0x38a1ea();}else{return _0x407892['status'](0x193)['json']({'message':_0x2db7('0x52')});}}}else if(_0x4ea3c2[_0x2db7('0x42')]['apikey']){try{var _0x3abb46={'audience':hardwareConf[_0x2db7('0x53')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4ea3c2['query']['apikey'],_0x3abb46)[_0x2db7('0x54')](function(_0x7bcd6){return db[_0x2db7('0x4e')][_0x2db7('0x4f')]({'where':{'id':_0x7bcd6[_0x2db7('0x55')]}})[_0x2db7('0x54')](function(_0x502e44){_0x5d2f93=_0x502e44;return db['Setting'][_0x2db7('0x3e')]({'where':{'id':0x1},'attributes':[_0x2db7('0x56'),'blockDuration'],'raw':!![]});})['then'](function(_0x1f88f9){if(!_0x5d2f93||!_[_0x2db7('0x57')](_0x5d2f93[_0x2db7('0x58')],_0x7bcd6[_0x2db7('0x59')])){return _0x407892[_0x2db7('0x44')](0x191)['json']({'message':_0x2db7('0x5a')});}if(_0x5d2f93[_0x2db7('0x5b')]){return _0x407892[_0x2db7('0x44')](0x191)[_0x2db7('0x45')]({'message':_0x2db7('0x5c')});}if(_0x5d2f93['blocked']){if(_0x1f88f9[_0x2db7('0x5d')]>0x0){if(moment(_0x5d2f93[_0x2db7('0x5e')])[_0x2db7('0x5f')](_0x1f88f9[_0x2db7('0x5d')],_0x2db7('0x60'))>moment()){return _0x407892[_0x2db7('0x44')](0x191)[_0x2db7('0x45')]({'message':_0x2db7('0x5c')});}}else{return _0x407892[_0x2db7('0x44')](0x191)[_0x2db7('0x45')]({'message':_0x2db7('0x5c')});}}_0x4ea3c2[_0x2db7('0x3c')]={'id':_0x5d2f93['id']};_0x38a1ea();});})[_0x2db7('0x49')](function(){return _0x407892['status'](0x191)[_0x2db7('0x45')]({'message':_0x2db7('0x5c')});});}catch(_0x1b888a){_0x38a1ea(_0x1b888a);}}else if(_0x343806){_0x38a1ea();}else{return _0x407892[_0x2db7('0x44')](0x193)['json']({'message':_0x2db7('0x52')});}})[_0x2db7('0x3b')](function(_0x2addc0,_0x347700,_0xb43a2a){if(_0x2addc0[_0x2db7('0x3c')]){db[_0x2db7('0x4e')]['find']({'where':{'id':_0x2addc0[_0x2db7('0x3c')]['id']},'attributes':userAttributes})[_0x2db7('0x54')](function(_0x14877a){if(!_0x14877a){return _0x347700[_0x2db7('0x44')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x2addc0[_0x2db7('0x3c')]=_0x14877a;_0xb43a2a();})['catch'](function(_0x1fbedf){_0xb43a2a(_0x1fbedf);});}else if(_0x343806){_0xb43a2a();}else{return _0x347700[_0x2db7('0x44')](0x194)[_0x2db7('0x45')]({'message':_0x2db7('0x61')});}});};exports[_0x2db7('0x62')]=function canUpdate(){return compose()[_0x2db7('0x3b')](function(_0x2e8eed,_0x438003,_0x3a4254){return licenseUtil[_0x2db7('0x63')]()[_0x2db7('0x54')](function(_0x24a65d){if(_0x24a65d[_0x2db7('0x64')]){_0x3a4254();}else{return _0x438003[_0x2db7('0x44')](0x193)[_0x2db7('0x45')]({'message':'Forbidden'});}})[_0x2db7('0x49')](function(_0x3445db){_0x3a4254(_0x3445db);});});};exports[_0x2db7('0x65')]=function isWebrtcLicence(){return compose()[_0x2db7('0x3b')](function(_0x295f51,_0x5e0775,_0xe62335){return licenseUtil[_0x2db7('0x63')]()['then'](function(_0x4b09f3){if(_0x4b09f3[_0x2db7('0x66')]){_0xe62335();}else{return _0x5e0775['status'](0x193)[_0x2db7('0x45')]({'message':_0x2db7('0x67')});}})[_0x2db7('0x49')](function(_0x19ef71){_0xe62335(_0x19ef71);});});};exports[_0x2db7('0x68')]=function(_0x4e7ae0,_0x422c6b,_0x32a0f0){_0x4e7ae0[_0x2db7('0x68')]=!![];return _0x32a0f0();};exports['signToken']=function signToken(_0x274479){return signJwt(_0x274479);};exports[_0x2db7('0x69')]=function(_0x32dbbc,_0x19fc7d){if(!_0x32dbbc[_0x2db7('0x3c')]){return _0x19fc7d[_0x2db7('0x44')](0x194)[_0x2db7('0x45')]({'message':_0x2db7('0x6a')});}var _0xc38de6={'payload':{'id':_0x32dbbc[_0x2db7('0x3c')]['id'],'role':_0x32dbbc[_0x2db7('0x3c')][_0x2db7('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0xc38de6)['then'](function(_0x5f0aa0){_0x19fc7d['cookie'](_0x2db7('0x6b'),_0x5f0aa0);_0x19fc7d[_0x2db7('0x6c')]('/dashboards/general');})[_0x2db7('0x49')](function(_0x3eb0e6){return _0x19fc7d['status'](0x1f4)['send'](_0x3eb0e6);});};exports[_0x2db7('0x6d')]=function(_0x12bcbd){if(_[_0x2db7('0x6e')](_0x12bcbd[_0x2db7('0x58')])||_[_0x2db7('0x6e')](_0x12bcbd[_0x2db7('0x6f')])){return null;}else{return createJwt(_0x12bcbd);}};exports[_0x2db7('0x70')]=function(_0x35aa73){_0x35aa73[_0x2db7('0x58')]=generateNonce();_0x35aa73[_0x2db7('0x6f')]=generateIssuedAt();return createJwt(_0x35aa73);};exports[_0x2db7('0x71')]=function(_0x207e5d,_0x1a8600){var _0x5762b9=_0x207e5d['query'][_0x2db7('0x72')];if(_0x5762b9){var _0x5c32a4={'nonce':_0x1a8600['apiKeyNonce'],'iat':_0x1a8600['apiKeyIat'],'audience':hardwareConf[_0x2db7('0x53')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5762b9,_0x5c32a4)[_0x2db7('0x54')](function(){return generateApiKey(_0x1a8600);});}else{throw{'message':_0x2db7('0x73')};}};exports[_0x2db7('0x74')]=function(_0x31d335){var _0x3e94f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e94f6[_0x2db7('0x75')](_0x31d335))throw new db[(_0x2db7('0x76'))][(_0x2db7('0x77'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x159e40,_0x4afa21,_0x32526d){var _0x4dee1b=encryptor[_0x2db7('0x78')](_0x4afa21)['split'](',');for(var _0x15c5af=0x0;_0x15c5af<_0x32526d;_0x15c5af++){if(!_0x4dee1b[_0x15c5af])break;if(_0x159e40[_0x2db7('0x79')]()===_0x4dee1b[_0x15c5af]['toLowerCase']()){var _0x16c8c7=util[_0x2db7('0x7a')](_0x2db7('0x7b'),_0x32526d);if(_0x32526d===0x1){_0x16c8c7=_0x2db7('0x7c');}throw new db[(_0x2db7('0x76'))][(_0x2db7('0x77'))](_0x16c8c7);}}return;};exports[_0x2db7('0x7d')]=function(_0x587e82,_0x16dbe0){var _0x5b5f6c=_0x16dbe0?encryptor[_0x2db7('0x78')](_0x16dbe0)[_0x2db7('0x7e')](','):[];if(_0x5b5f6c[_0x2db7('0x7f')]===0x5){_0x5b5f6c['splice'](-0x1,0x1);}_0x5b5f6c[_0x2db7('0x80')](_0x587e82);return encryptor[_0x2db7('0x81')](_0x5b5f6c[_0x2db7('0x82')](','));};function signJwt(_0x2d7302){var _0x2f3c37=BPromise['promisify'](jwt[_0x2db7('0x83')],{'context':jwt});var _0x592f66=_0x2d7302[_0x2db7('0x84')]||config[_0x2db7('0xc')][_0x2db7('0xd')];return new BPromise(function(_0x3c834b,_0x2a946a){_0x2f3c37(_0x2d7302[_0x2db7('0x85')],_0x592f66,_0x2d7302[_0x2db7('0x86')])[_0x2db7('0x54')](function(_0x4c39e3){_0x3c834b(_0x4c39e3);})['catch'](function(_0x16c41d){_0x2a946a(_0x16c41d);});});}function verifyJwt(_0x13fc6c,_0x4aae4c,_0x565ea4){var _0x2142b8=BPromise[_0x2db7('0x87')](jwt[_0x2db7('0x88')],{'context':jwt});var _0x573c38=_0x565ea4||config[_0x2db7('0xc')][_0x2db7('0xd')];return new BPromise(function(_0x137fd8,_0x35a714){_0x2142b8(_0x13fc6c,_0x573c38,_0x4aae4c)[_0x2db7('0x54')](function(_0x44dbc3){_0x137fd8(_0x44dbc3);})[_0x2db7('0x49')](function(_0x5643db){_0x35a714(_0x5643db);});});}function generateNonce(){return crypto[_0x2db7('0x89')](0x10)[_0x2db7('0x8a')](_0x2db7('0x8b'));}function generateIssuedAt(){return Math[_0x2db7('0x8c')](Date['now']()/0x3e8)[_0x2db7('0x8a')]();}function createJwt(_0x349d20){var _0x552ad1={'payload':{'iat':_0x349d20['apiKeyIat'],'nonce':_0x349d20[_0x2db7('0x58')]},'options':{'algorithm':_0x2db7('0x8d'),'subject':_0x349d20['id'][_0x2db7('0x8a')](),'issuer':hardwareConf[_0x2db7('0x53')](),'audience':hardwareConf[_0x2db7('0x53')]()}};return signJwt(_0x552ad1)[_0x2db7('0x54')](function(_0x14df8a){return{'iat':_0x349d20[_0x2db7('0x6f')],'nonce':_0x349d20[_0x2db7('0x58')],'token':_0x14df8a};});} \ No newline at end of file +var _0xb7b3=['smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','then','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','getLicense','Forbidden','isWebrtcLicence','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','join','sign','secret','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay'];(function(_0x4d7a8b,_0x3afdcd){var _0x9b5113=function(_0x1a529f){while(--_0x1a529f){_0x4d7a8b['push'](_0x4d7a8b['shift']());}};_0x9b5113(++_0x3afdcd);}(_0xb7b3,0xe3));var _0x3b7b=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0xb7b3[_0x5515a7];return _0x43f4bf;};'use strict';var db=require(_0x3b7b('0x0'))['db'];var config=require(_0x3b7b('0x1'));var hardwareConf=require(_0x3b7b('0x2'));var licenseUtil=require(_0x3b7b('0x3'));var encryptor=require(_0x3b7b('0x4'));var _=require('lodash');var jwt=require(_0x3b7b('0x5'));var expressJwt=require(_0x3b7b('0x6'));var compose=require(_0x3b7b('0x7'));var basicAuth=require(_0x3b7b('0x8'));var crypto=require('crypto');var BPromise=require(_0x3b7b('0x9'));var util=require(_0x3b7b('0xa'));var moment=require(_0x3b7b('0xb'));var validateJwt=expressJwt({'secret':config[_0x3b7b('0xc')][_0x3b7b('0xd')]});var userAttributes=['id','role',_0x3b7b('0xe'),_0x3b7b('0xf'),_0x3b7b('0x10'),_0x3b7b('0x11'),_0x3b7b('0x12'),_0x3b7b('0x13'),_0x3b7b('0x14'),_0x3b7b('0x15'),_0x3b7b('0x16'),_0x3b7b('0x17'),_0x3b7b('0x18'),_0x3b7b('0x19'),_0x3b7b('0x1a'),_0x3b7b('0x1b'),_0x3b7b('0x1c'),_0x3b7b('0x1d'),_0x3b7b('0x1e'),'crudPermissions',_0x3b7b('0x1f'),_0x3b7b('0x20'),_0x3b7b('0x21'),_0x3b7b('0x22'),_0x3b7b('0x23'),_0x3b7b('0x24'),_0x3b7b('0x25'),_0x3b7b('0x26'),_0x3b7b('0x27'),_0x3b7b('0x28'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x3b7b('0x29'),_0x3b7b('0x2a'),_0x3b7b('0x2b'),'privacyEnabled',_0x3b7b('0x2c'),'wssPort',_0x3b7b('0x2d'),_0x3b7b('0x2e'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x3b7b('0x2f'),_0x3b7b('0x30'),'emailAutoanswer','emailAutoanswerDelay',_0x3b7b('0x31'),'smsAutoanswerDelay',_0x3b7b('0x32'),_0x3b7b('0x33'),_0x3b7b('0x34'),_0x3b7b('0x35'),_0x3b7b('0x36'),_0x3b7b('0x37'),_0x3b7b('0x38')];exports[_0x3b7b('0x39')]=function(){return this[_0x3b7b('0x3a')](!![])['use'](function(_0x2fe1f4,_0x1035e9,_0x34ce75){if(_0x2fe1f4['user']){_0x34ce75();}else{return db[_0x3b7b('0x3b')][_0x3b7b('0x3c')]({'where':{'id':_0x2fe1f4[_0x3b7b('0x3d')]['id']},'attributes':['id',_0x3b7b('0x3e'),_0x3b7b('0x3f')],'raw':!![]})[_0x3b7b('0x40')](function(_0x360614){if(_0x360614&&_0x360614[_0x3b7b('0x3e')]&&!_0x2fe1f4['query'][_0x3b7b('0x41')]){return _0x1035e9[_0x3b7b('0x42')](_0x360614[_0x3b7b('0x3f')]===_0x3b7b('0x43')?0x195:0x193)[_0x3b7b('0x44')]({'message':_0x360614['disposition']===_0x3b7b('0x43')?_0x3b7b('0x45'):_0x3b7b('0x46')});}else{_0x34ce75();}})[_0x3b7b('0x47')](function(_0x1ec135){_0x34ce75(_0x1ec135);});}});};exports['isAuthenticated']=function isAuthenticated(_0x54aef2){return compose()[_0x3b7b('0x48')](function(_0x3fd4a8,_0x4b61de,_0x41c716){var _0x14355a;if(_0x3fd4a8[_0x3b7b('0x49')][_0x3b7b('0x4a')]){if(_[_0x3b7b('0x4b')](_0x3fd4a8[_0x3b7b('0x49')][_0x3b7b('0x4a')],_0x3b7b('0x4c'))){var _0x5c9edf=basicAuth(_0x3fd4a8);db[_0x3b7b('0x4d')][_0x3b7b('0x4e')]({'where':{'name':_0x5c9edf['name']}})['then'](function(_0x2cc26d){if(!_0x2cc26d||!_0x2cc26d['authenticate'](_0x5c9edf[_0x3b7b('0x4f')])){return _0x4b61de['status'](0x191)[_0x3b7b('0x44')]({'message':_0x3b7b('0x50')});}_0x3fd4a8[_0x3b7b('0x51')]={'id':_0x2cc26d['id']};_0x41c716();})[_0x3b7b('0x47')](function(_0x41c40c){_0x41c716(_0x41c40c);});}else if(_[_0x3b7b('0x4b')](_0x3fd4a8['headers'][_0x3b7b('0x4a')],_0x3b7b('0x52'))){validateJwt(_0x3fd4a8,_0x4b61de,_0x41c716);}else{if(_0x54aef2){_0x41c716();}else{return _0x4b61de[_0x3b7b('0x42')](0x193)['json']({'message':_0x3b7b('0x53')});}}}else if(_0x3fd4a8[_0x3b7b('0x54')][_0x3b7b('0x55')]){try{var _0x2c4f18={'audience':hardwareConf[_0x3b7b('0x56')](),'issuer':hardwareConf[_0x3b7b('0x56')]()};verifyJwt(_0x3fd4a8['query'][_0x3b7b('0x55')],_0x2c4f18)[_0x3b7b('0x40')](function(_0x19fa7b){return db[_0x3b7b('0x4d')]['find']({'where':{'id':_0x19fa7b[_0x3b7b('0x57')]}})[_0x3b7b('0x40')](function(_0x1f58be){_0x14355a=_0x1f58be;return db[_0x3b7b('0x58')][_0x3b7b('0x3c')]({'where':{'id':0x1},'attributes':[_0x3b7b('0x59'),'blockDuration'],'raw':!![]});})[_0x3b7b('0x40')](function(_0x4b182a){if(!_0x14355a||!_[_0x3b7b('0x5a')](_0x14355a[_0x3b7b('0x5b')],_0x19fa7b[_0x3b7b('0x5c')])){return _0x4b61de['status'](0x191)[_0x3b7b('0x44')]({'message':_0x3b7b('0x5d')});}if(_0x14355a['disabled']){return _0x4b61de['status'](0x191)[_0x3b7b('0x44')]({'message':_0x3b7b('0x5e')});}if(_0x14355a[_0x3b7b('0x5f')]){if(_0x4b182a[_0x3b7b('0x60')]>0x0){if(moment(_0x14355a[_0x3b7b('0x61')])[_0x3b7b('0x62')](_0x4b182a[_0x3b7b('0x60')],_0x3b7b('0x63'))>moment()){return _0x4b61de['status'](0x191)['json']({'message':_0x3b7b('0x5e')});}}else{return _0x4b61de[_0x3b7b('0x42')](0x191)[_0x3b7b('0x44')]({'message':_0x3b7b('0x5e')});}}_0x3fd4a8[_0x3b7b('0x51')]={'id':_0x14355a['id']};_0x41c716();});})[_0x3b7b('0x47')](function(){return _0x4b61de['status'](0x191)[_0x3b7b('0x44')]({'message':_0x3b7b('0x5e')});});}catch(_0x1c7014){_0x41c716(_0x1c7014);}}else if(_0x54aef2){_0x41c716();}else{return _0x4b61de[_0x3b7b('0x42')](0x193)[_0x3b7b('0x44')]({'message':'Unknown\x20authorization\x20format'});}})[_0x3b7b('0x48')](function(_0x6e87f1,_0x23a117,_0x242f55){if(_0x6e87f1['user']){db[_0x3b7b('0x4d')]['find']({'where':{'id':_0x6e87f1[_0x3b7b('0x51')]['id']},'attributes':userAttributes})[_0x3b7b('0x40')](function(_0x2802e8){if(!_0x2802e8){return _0x23a117['status'](0x194)['json']({'message':'User\x20not\x20found.'});}_0x6e87f1[_0x3b7b('0x51')]=_0x2802e8;_0x242f55();})[_0x3b7b('0x47')](function(_0x3496e0){_0x242f55(_0x3496e0);});}else if(_0x54aef2){_0x242f55();}else{return _0x23a117[_0x3b7b('0x42')](0x194)[_0x3b7b('0x44')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x3b7b('0x48')](function(_0x429d60,_0x13a38a,_0x3b08ca){return licenseUtil[_0x3b7b('0x64')]()[_0x3b7b('0x40')](function(_0x155a85){if(_0x155a85['update']){_0x3b08ca();}else{return _0x13a38a[_0x3b7b('0x42')](0x193)['json']({'message':_0x3b7b('0x65')});}})['catch'](function(_0x4fd9fa){_0x3b08ca(_0x4fd9fa);});});};exports[_0x3b7b('0x66')]=function isWebrtcLicence(){return compose()[_0x3b7b('0x48')](function(_0xeeba8f,_0x3dc671,_0xbc06e6){return licenseUtil[_0x3b7b('0x64')]()[_0x3b7b('0x40')](function(_0x50d0b1){if(_0x50d0b1['webrtc']){_0xbc06e6();}else{return _0x3dc671[_0x3b7b('0x42')](0x193)[_0x3b7b('0x44')]({'message':_0x3b7b('0x65')});}})[_0x3b7b('0x47')](function(_0x141ff6){_0xbc06e6(_0x141ff6);});});};exports[_0x3b7b('0x67')]=function(_0x4df5fb,_0xea0541,_0x558cb5){_0x4df5fb[_0x3b7b('0x67')]=!![];return _0x558cb5();};exports[_0x3b7b('0x68')]=function signToken(_0x145391){return signJwt(_0x145391);};exports['setTokenCookie']=function(_0x27fa29,_0x3ebcfe){if(!_0x27fa29['user']){return _0x3ebcfe[_0x3b7b('0x42')](0x194)['json']({'message':_0x3b7b('0x69')});}var _0x2e1f20={'payload':{'id':_0x27fa29[_0x3b7b('0x51')]['id'],'role':_0x27fa29['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x2e1f20)[_0x3b7b('0x40')](function(_0x5a0697){_0x3ebcfe[_0x3b7b('0x6a')](_0x3b7b('0x6b'),_0x5a0697);_0x3ebcfe[_0x3b7b('0x6c')]('/dashboards/general');})['catch'](function(_0x213efe){return _0x3ebcfe['status'](0x1f4)['send'](_0x213efe);});};exports[_0x3b7b('0x6d')]=function(_0x19b9d8){if(_[_0x3b7b('0x6e')](_0x19b9d8[_0x3b7b('0x5b')])||_[_0x3b7b('0x6e')](_0x19b9d8[_0x3b7b('0x6f')])){return null;}else{return createJwt(_0x19b9d8);}};exports[_0x3b7b('0x70')]=function(_0x39cd84){_0x39cd84['apiKeyNonce']=generateNonce();_0x39cd84[_0x3b7b('0x6f')]=generateIssuedAt();return createJwt(_0x39cd84);};exports[_0x3b7b('0x71')]=function(_0x564264,_0x56fd0a){var _0x1c9429=_0x564264[_0x3b7b('0x54')][_0x3b7b('0x55')];if(_0x1c9429){var _0x22dec3={'nonce':_0x56fd0a['apiKeyNonce'],'iat':_0x56fd0a[_0x3b7b('0x6f')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x3b7b('0x56')]()};return verifyJwt(_0x1c9429,_0x22dec3)[_0x3b7b('0x40')](function(){return generateApiKey(_0x56fd0a);});}else{throw{'message':_0x3b7b('0x72')};}};exports['validatePasswordPattern']=function(_0xd24b2c){var _0x1c7c37=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1c7c37['test'](_0xd24b2c))throw new db[(_0x3b7b('0x73'))][(_0x3b7b('0x74'))](_0x3b7b('0x75'));return;};exports[_0x3b7b('0x76')]=function(_0x379253,_0x24160b,_0x59a64b){var _0x3a170b=encryptor[_0x3b7b('0x77')](_0x24160b)['split'](',');for(var _0x2b7939=0x0;_0x2b7939<_0x59a64b;_0x2b7939++){if(!_0x3a170b[_0x2b7939])break;if(_0x379253[_0x3b7b('0x78')]()===_0x3a170b[_0x2b7939]['toLowerCase']()){var _0x447c45=util[_0x3b7b('0x79')](_0x3b7b('0x7a'),_0x59a64b);if(_0x59a64b===0x1){_0x447c45=_0x3b7b('0x7b');}throw new db[(_0x3b7b('0x73'))][(_0x3b7b('0x74'))](_0x447c45);}}return;};exports[_0x3b7b('0x7c')]=function(_0x1e3e41,_0x4c868a){var _0x5ac975=_0x4c868a?encryptor['decryptString'](_0x4c868a)['split'](','):[];if(_0x5ac975[_0x3b7b('0x7d')]===0x5){_0x5ac975[_0x3b7b('0x7e')](-0x1,0x1);}_0x5ac975[_0x3b7b('0x7f')](_0x1e3e41);return encryptor['encryptString'](_0x5ac975[_0x3b7b('0x80')](','));};function signJwt(_0x482016){var _0x47482a=BPromise['promisify'](jwt[_0x3b7b('0x81')],{'context':jwt});var _0x285675=_0x482016[_0x3b7b('0x82')]||config[_0x3b7b('0xc')][_0x3b7b('0xd')];return new BPromise(function(_0x42f074,_0x5ea5f1){_0x47482a(_0x482016[_0x3b7b('0x83')],_0x285675,_0x482016[_0x3b7b('0x84')])['then'](function(_0x290ce4){_0x42f074(_0x290ce4);})[_0x3b7b('0x47')](function(_0x50c4e3){_0x5ea5f1(_0x50c4e3);});});}function verifyJwt(_0x3da8a0,_0x25414c,_0x1b78f5){var _0x43bdf2=BPromise['promisify'](jwt[_0x3b7b('0x85')],{'context':jwt});var _0x5376c7=_0x1b78f5||config[_0x3b7b('0xc')]['session'];return new BPromise(function(_0x5ee300,_0x95ab5){_0x43bdf2(_0x3da8a0,_0x5376c7,_0x25414c)[_0x3b7b('0x40')](function(_0x405b01){_0x5ee300(_0x405b01);})[_0x3b7b('0x47')](function(_0x5800ae){_0x95ab5(_0x5800ae);});});}function generateNonce(){return crypto[_0x3b7b('0x86')](0x10)[_0x3b7b('0x87')](_0x3b7b('0x88'));}function generateIssuedAt(){return Math['floor'](Date[_0x3b7b('0x89')]()/0x3e8)['toString']();}function createJwt(_0x30442b){var _0x203c08={'payload':{'iat':_0x30442b[_0x3b7b('0x6f')],'nonce':_0x30442b['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x30442b['id'][_0x3b7b('0x87')](),'issuer':hardwareConf[_0x3b7b('0x56')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x203c08)[_0x3b7b('0x40')](function(_0x3aa114){return{'iat':_0x30442b[_0x3b7b('0x6f')],'nonce':_0x30442b[_0x3b7b('0x5b')],'token':_0x3aa114};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 60f20f8..cf85e98 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 _0x600c=['describe','CmContact','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','keys','lodash','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','where','default','fields','user','skip','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','getFilteredContacts','rows','catch'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x600c,0x1e2));var _0xc600=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x600c[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xc600('0x0'));var sqlUtils=require(_0xc600('0x1'));var db=require(_0xc600('0x2'))['db'];exports['findAll']=function(_0xdaf5f9,_0x35f4a4,_0x22210f,_0x4dd9f2){var _0x48d397={'count':0x0,'rows':[]};var _0x466191=sqlUtils[_0xc600('0x3')](_0x35f4a4,_0xdaf5f9);if(_0x466191){return Promise['resolve'](_0x48d397);}var _0x481500=sqlUtils[_0xc600('0x4')]();var _0x3f7947={};var _0x242303=![];var _0x4a3abb=![];return Promise[_0xc600('0x5')]()[_0xc600('0x6')](function(){if(_0xdaf5f9[_0xc600('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0xdaf5f9[_0xc600('0x7')],_0x4dd9f2);}else{return sqlUtils['parseQueryParameters'](_0xdaf5f9,_0x4dd9f2);}})['then'](function(_0x14c92f){_0x481500[_0xc600('0x8')](_0x14c92f[_0xc600('0x9')]);_0x481500[_0xc600('0x8')](_0x14c92f[_0xc600('0xa')]);_0x481500[_0xc600('0x8')](_0x14c92f['filter']);_0x481500[_0xc600('0x8')](_0x14c92f[_0xc600('0xb')]['clause']);_0x3f7947=_0x14c92f['tags'];_0x4a3abb=_0x14c92f[_0xc600('0xb')][_0xc600('0xc')];return sqlUtils[_0xc600('0xd')](_0x35f4a4,_0xdaf5f9,_0x4a3abb);})['then'](function(_0x39b7ff){_0x481500['where'](_0x39b7ff);var _0x459d80=_0xdaf5f9[_0xc600('0x7')]?_0x3f7947[_0xc600('0xe')]:_0xdaf5f9[_0xc600('0xf')];_0x242303=_0x459d80?!![]:![];return sqlUtils['countFilteredContacts'](_0x481500,_0x459d80);})[_0xc600('0x6')](function(_0x2a8a36){_0x48d397[_0xc600('0x10')]=_0x2a8a36;if(_0x48d397[_0xc600('0x10')]===0x0){return;}if(_0xdaf5f9[_0xc600('0x11')]){_0x4a3abb=!![];}return sqlUtils[_0xc600('0x12')](_0x481500,_0xdaf5f9[_0xc600('0xa')],_0x22210f,_0x242303,_0x3f7947['clause'],_0x4a3abb);})['then'](function(_0xda6dab){if(!_0xda6dab){return[];}return sqlUtils[_0xc600('0x13')](_0xda6dab,_0xdaf5f9,_0x22210f);})[_0xc600('0x6')](function(_0x75663a){_0x48d397[_0xc600('0x14')]=_0x75663a;return _0x48d397;})[_0xc600('0x15')](function(_0xbe256e){throw _0xbe256e;});};exports[_0xc600('0x16')]=function(){var _0x17b4de={};var _0x2dad01=[];return db[_0xc600('0x17')][_0xc600('0x16')]()['then'](function(_0xd85bdb){_0x17b4de=_0xd85bdb;var _0x7bb1d4=Object['keys'](_0x17b4de)[_0xc600('0x18')](function(_0x31ae0f){return _[_0xc600('0x19')](_0x31ae0f,_0xc600('0x1a'))?_0x31ae0f:undefined;});var _0x3f7523=_0x7bb1d4[_0xc600('0x1b')](function(_0x568d69){return db[_0xc600('0x1c')][_0xc600('0x1d')]({'where':{'id':_0x568d69[_0xc600('0x1e')](0x3)},'raw':!![]});});return Promise[_0xc600('0x1f')](_0x3f7523);})[_0xc600('0x6')](function(_0x4d31ee){for(var _0x2ceba8=0x0;_0x2ceba8<_0x4d31ee[_0xc600('0x20')];_0x2ceba8++){if(_0x4d31ee[_0x2ceba8]){var _0x14e127=_0xc600('0x1a')+_0x4d31ee[_0x2ceba8]['id'];_0x17b4de[_0x14e127][_0xc600('0x21')]=_0x4d31ee[_0x2ceba8][_0xc600('0x22')];}}_0x2dad01=_[_0xc600('0x1b')](Object[_0xc600('0x23')](_0x17b4de),function(_0x1628b0){return{'name':_0x1628b0,'type':_0x17b4de[_0x1628b0]['type']};});return _0x2dad01;})[_0xc600('0x15')](function(_0x40f289){throw _0x40f289;});}; \ No newline at end of file +var _0xec1d=['user','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','default','filter','clause','tags'];(function(_0x24a654,_0x2ca441){var _0x458651=function(_0x1ecda1){while(--_0x1ecda1){_0x24a654['push'](_0x24a654['shift']());}};_0x458651(++_0x2ca441);}(_0xec1d,0x1d3));var _0xdec1=function(_0x10174f,_0x3d369e){_0x10174f=_0x10174f-0x0;var _0x247077=_0xec1d[_0x10174f];return _0x247077;};'use strict';var _=require('lodash');var sqlUtils=require(_0xdec1('0x0'));var db=require(_0xdec1('0x1'))['db'];exports[_0xdec1('0x2')]=function(_0x5f65b7,_0x1918e0,_0x2c3c6c,_0x51b91c){var _0x5da618={'count':0x0,'rows':[]};var _0x3d3927=sqlUtils[_0xdec1('0x3')](_0x1918e0,_0x5f65b7);if(_0x3d3927){return Promise[_0xdec1('0x4')](_0x5da618);}var _0x351d0e=sqlUtils[_0xdec1('0x5')]();var _0x379048={};var _0xb12780=![];var _0x43201d=![];return Promise[_0xdec1('0x4')]()[_0xdec1('0x6')](function(){if(_0x5f65b7[_0xdec1('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x5f65b7[_0xdec1('0x7')],_0x51b91c);}else{return sqlUtils[_0xdec1('0x8')](_0x5f65b7,_0x51b91c);}})['then'](function(_0x2293d9){_0x351d0e[_0xdec1('0x9')](_0x2293d9[_0xdec1('0xa')]);_0x351d0e[_0xdec1('0x9')](_0x2293d9['fields']);_0x351d0e['where'](_0x2293d9[_0xdec1('0xb')]);_0x351d0e[_0xdec1('0x9')](_0x2293d9['user'][_0xdec1('0xc')]);_0x379048=_0x2293d9[_0xdec1('0xd')];_0x43201d=_0x2293d9[_0xdec1('0xe')]['skip'];return sqlUtils[_0xdec1('0xf')](_0x1918e0,_0x5f65b7,_0x43201d);})[_0xdec1('0x6')](function(_0x664bca){_0x351d0e[_0xdec1('0x9')](_0x664bca);var _0x57d946=_0x5f65b7[_0xdec1('0x7')]?_0x379048[_0xdec1('0x10')]:_0x5f65b7['tag'];_0xb12780=_0x57d946?!![]:![];return sqlUtils[_0xdec1('0x11')](_0x351d0e,_0x57d946);})[_0xdec1('0x6')](function(_0x206b20){_0x5da618['count']=_0x206b20;if(_0x5da618[_0xdec1('0x12')]===0x0){return;}if(_0x5f65b7[_0xdec1('0x13')]){_0x43201d=!![];}return sqlUtils[_0xdec1('0x14')](_0x351d0e,_0x5f65b7[_0xdec1('0x15')],_0x2c3c6c,_0xb12780,_0x379048['clause'],_0x43201d);})[_0xdec1('0x6')](function(_0x36a342){if(!_0x36a342){return[];}return sqlUtils[_0xdec1('0x16')](_0x36a342,_0x5f65b7,_0x2c3c6c);})[_0xdec1('0x6')](function(_0x3d164a){_0x5da618[_0xdec1('0x17')]=_0x3d164a;return _0x5da618;})[_0xdec1('0x18')](function(_0x2f4c54){throw _0x2f4c54;});};exports[_0xdec1('0x19')]=function(){var _0x160497={};var _0x2285ea=[];return db[_0xdec1('0x1a')][_0xdec1('0x19')]()[_0xdec1('0x6')](function(_0x17bfb7){_0x160497=_0x17bfb7;var _0x4d1bcd=Object[_0xdec1('0x1b')](_0x160497)[_0xdec1('0xb')](function(_0x4a4f69){return _[_0xdec1('0x1c')](_0x4a4f69,_0xdec1('0x1d'))?_0x4a4f69:undefined;});var _0x2efb61=_0x4d1bcd[_0xdec1('0x1e')](function(_0x16a482){return db[_0xdec1('0x1f')][_0xdec1('0x20')]({'where':{'id':_0x16a482['slice'](0x3)},'raw':!![]});});return Promise[_0xdec1('0x21')](_0x2efb61);})['then'](function(_0x1790f1){for(var _0x18f9c3=0x0;_0x18f9c3<_0x1790f1[_0xdec1('0x22')];_0x18f9c3++){if(_0x1790f1[_0x18f9c3]){var _0x37e9b0=_0xdec1('0x1d')+_0x1790f1[_0x18f9c3]['id'];_0x160497[_0x37e9b0][_0xdec1('0x23')]=_0x1790f1[_0x18f9c3][_0xdec1('0x24')];}}_0x2285ea=_[_0xdec1('0x1e')](Object['keys'](_0x160497),function(_0x33dca5){return{'name':_0x33dca5,'type':_0x160497[_0x33dca5][_0xdec1('0x24')]};});return _0x2285ea;})[_0xdec1('0x18')](function(_0x56fd87){throw _0x56fd87;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 2a24b69..74b8748 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 _0x0330=['escapeLIKESpecialChars','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','sqlOperator','length','conditions','fieldType','datetime','buildExpression','type','default','text','value','end','Tag','split','map','and','tags','ids','User','user','some','name','compact','Contact','push','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','clause','filter','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','having','order','subqry.','DESC','findAll','color','keyBy','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','SELECT','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','fax','email','CompanyId','createdAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x0330,0x172));var _0x0033=function(_0x2e80e2,_0x3be71f){_0x2e80e2=_0x2e80e2-0x0;var _0x43d951=_0x0330[_0x2e80e2];return _0x43d951;};'use strict';var _=require(_0x0033('0x0'));var squel=require('squel');var as=require(_0x0033('0x1'));var qs=require(_0x0033('0x2'));var utils=require(_0x0033('0x3'));var db=require(_0x0033('0x4'))['db'];function skipContactsQuery(_0x4b8587,_0x3b1ec6){var _0x1bb262=![];if(_0x4b8587[_0x0033('0x5')]===_0x0033('0x6')&&!_0x3b1ec6[_0x0033('0x7')]&&!_0x3b1ec6[_0x0033('0x8')]&&_0x3b1ec6['autocomplete']!=='true'){_0x1bb262=!![];}return _0x1bb262;}function getContactsSubquery(){return squel['select']()[_0x0033('0x9')]('cm_contacts','c')[_0x0033('0xa')](_0x0033('0xb'));}function applyJoinClauses(_0x4af2f7,_0x59994e){var _0x2a9e68=_0x59994e?'c':_0x0033('0xc');_0x4af2f7[_0x0033('0xd')](_0x0033('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x2a9e68+_0x0033('0xf'))[_0x0033('0xd')]('cm_contact_has_tags','ct',_0x0033('0x10')+_0x2a9e68+_0x0033('0xf'))['left_join'](_0x0033('0x11'),'t',_0x0033('0x12'));return _0x4af2f7;}function addFieldsToQuery(_0x230fa0,_0x52433c,_0x364df4,_0x3a7416,_0xecb5f2){var _0x3b846f=_0xecb5f2?'c':_0x0033('0xc');if(!_0x52433c){_0x52433c=['id',_0x0033('0x13'),_0x0033('0x14'),'phone','mobile',_0x0033('0x15'),_0x0033('0x16'),_0x0033('0x8'),_0x0033('0x17'),_0x0033('0x18'),'updatedAt',_0x0033('0x19'),_0x0033('0x1a')];}else if(!_0x52433c['includes']('id')){_0x52433c['push']('id');}var _0x39f73e=_0x364df4&&_0xecb5f2||!_0x364df4&&!_0xecb5f2;if(_0x3a7416){_0x39f73e=_0x3a7416&&_0xecb5f2||!_0x3a7416&&!_0xecb5f2;}_0x52433c[_0x0033('0x1b')](function(_0x546ce0){if(_0x546ce0==='TagIds'){if(_0x39f73e){_0x230fa0[_0x0033('0x1c')](_0x0033('0x1d'),_0x546ce0);}else if(_0x364df4||_0x3a7416){_0x230fa0[_0x0033('0x1c')](_0x3b846f+'.'+_0x546ce0);}}else{_0x230fa0['field'](_0x3b846f+'.'+_0x546ce0);}});return _0x230fa0;}function getSqlClauses(){var _0x42f4bb={'default':squel['expr'](),'fields':squel[_0x0033('0x1e')](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x0033('0x1e')](),'skip':![]}};return _0x42f4bb;}function parseTagParameter(_0x385312){var _0x147c08=squel['expr']();if(_0x385312){var _0x4ccdc2=utils[_0x0033('0x1f')](_0x385312);_0x4ccdc2[_0x0033('0x1b')](function(_0xb5f2eb){_0x147c08['or'](_0x0033('0x20'),'%,'+_0xb5f2eb+',%');});}return _0x147c08;}function parseSearchFilter(_0x365b92){var _0x57fd88=squel[_0x0033('0x1e')]();if(_0x365b92){var _0x53f8a8=_0x365b92[_0x0033('0x21')]('\x5c','\x5c\x5c')[_0x0033('0x21')](/'/g,'\x27\x27');var _0x219b3b=qs[_0x0033('0x22')](_0x53f8a8);if(_0x53f8a8['split']('\x20')['length']>0x1){_0x57fd88['or'](_0x0033('0x23'),qs[_0x0033('0x24')](_0x53f8a8,!![]),null);}else{if(qs[_0x0033('0x25')](_0x53f8a8)){_0x57fd88['or'](_0x0033('0x26'),_0x219b3b+'%');_0x57fd88['or'](_0x0033('0x27'),_0x219b3b+'%');_0x57fd88['or'](_0x0033('0x28'),_0x219b3b+'%');_0x57fd88['or']('c.fax\x20LIKE\x20?',_0x219b3b+'%');}else if(qs['isEmail'](_0x53f8a8)){_0x57fd88['or'](_0x0033('0x29'),_0x219b3b+'%');}else{_0x57fd88['or'](_0x0033('0x2a'),'%'+_0x219b3b+'%');_0x57fd88['or']('c.lastName\x20LIKE\x20?','%'+_0x219b3b+'%');_0x57fd88['or'](_0x0033('0x29'),'%'+_0x219b3b+'%');}}}return _0x57fd88;}function parseAdvancedSearchFilter(_0x416145,_0x409574){var _0x22cfdb=getSqlClauses();var _0x532237=as['parseSearch'](_0x416145);var _0x2cbb84=_0x532237[_0x0033('0x2b')];for(var _0x18888c=0x0;_0x18888c<_0x532237['conditions'][_0x0033('0x2c')];_0x18888c++){var _0x5db2fd=_0x532237[_0x0033('0x2d')][_0x18888c];var _0x35e1d3='c';var _0x14ecf2=_['find'](_0x409574,['name',_0x5db2fd['field']]);if(_0x14ecf2){if(_0x5db2fd['field']==='dateOfBirth'||_0x14ecf2[_0x0033('0x2e')]===_0x0033('0x2f')){_0x5db2fd['castTo']='DATE';}var _0x4e5026=as[_0x0033('0x30')](_0x35e1d3,_0x14ecf2[_0x0033('0x31')],_0x5db2fd);_0x22cfdb[_0x0033('0x32')][_0x2cbb84](_0x4e5026[_0x0033('0x33')],_0x4e5026['value']['start'],_0x4e5026[_0x0033('0x34')][_0x0033('0x35')]);}else{if(_0x5db2fd[_0x0033('0x1c')]===_0x0033('0x36')){var _0x199a1a=_0x5db2fd[_0x0033('0x34')][_0x0033('0x37')](',')[_0x0033('0x38')](function(_0x1a34e7){return Number(_0x1a34e7);});var _0x349fe3=parseTagParameter(_0x199a1a);_0x22cfdb['tags']['clause'][_0x0033('0x39')](_0x349fe3);_0x22cfdb[_0x0033('0x3a')][_0x0033('0x3b')]=_0x199a1a;}else if(_0x5db2fd['field']===_0x0033('0x3c')){_0x22cfdb[_0x0033('0x3d')]['clause'][_0x0033('0x39')]('uc.UserId\x20=\x20?',_0x5db2fd[_0x0033('0x34')]);_0x22cfdb['user']['skip']=!![];}}}return _0x22cfdb;}function parseModelFields(_0xb6696e,_0xf212dc){var _0x3b03d7=squel[_0x0033('0x1e')]();var _0x44de9b=_(_0xb6696e)['keys']()[_0x0033('0x38')](function(_0x1581f3){return _[_0x0033('0x3e')](_0xf212dc,[_0x0033('0x3f'),_0x1581f3])?_0x1581f3:undefined;})[_0x0033('0x40')]()[_0x0033('0x34')]();if(_0xb6696e[_0x0033('0x41')]){_0x44de9b[_0x0033('0x42')](_0x0033('0x41'));}if(_0xb6696e['User']){_0x44de9b[_0x0033('0x42')](_0x0033('0x3c'));}if(_0x44de9b['length']>0x0){_0x44de9b[_0x0033('0x1b')](function(_0x1fb064){if(_0x1fb064==='ListId'){_0x3b03d7[_0x0033('0x39')](_0x0033('0x43'),[][_0x0033('0x44')](_0xb6696e[_0x1fb064]));}else if(_0x1fb064===_0x0033('0x41')){var _0x467e11='%'+_0xb6696e[_0x1fb064]+'%';_0x3b03d7['and'](_0x0033('0x45'),_0x467e11);}else if(_0x1fb064===_0x0033('0x3c')){_0x3b03d7['and'](_0x0033('0x46'),_0xb6696e[_0x1fb064]);}else{_0x3b03d7['and']('c.'+_0x1fb064+'\x20=\x20?',_0xb6696e[_0x1fb064]);}});}return _0x3b03d7;}function parseQueryParameters(_0x2192c4,_0x35b84a){var _0x2eba4d=getSqlClauses();return Promise[_0x0033('0x47')]()[_0x0033('0x48')](function(){return parseModelFields(_0x2192c4,_0x35b84a);})['then'](function(_0x580ade){_0x2eba4d[_0x0033('0x49')]['and'](_0x580ade);return parseTagParameter(_0x2192c4[_0x0033('0x4a')]);})['then'](function(_0x9b4d06){_0x2eba4d['tags'][_0x0033('0x4b')][_0x0033('0x39')](_0x9b4d06);return parseSearchFilter(_0x2192c4[_0x0033('0x4c')]);})[_0x0033('0x48')](function(_0x8d0965){_0x2eba4d['filter']=_0x8d0965;return _0x2eba4d;});}function checkListsRestrictions(_0x1f13d6,_0x11b50d,_0x2cc8aa){var _0x18430d=squel[_0x0033('0x1e')]();return Promise['resolve']()['then'](function(){if(_0x11b50d['search']&&_0x1f13d6[_0x0033('0x5')]==='agent'&&!_0x2cc8aa){return _0x1f13d6['getLists']({'attributes':['id'],'raw':!![]});}})[_0x0033('0x48')](function(_0x41d7f4){if(_0x41d7f4){if(_0x41d7f4[_0x0033('0x2c')]===0x0){_0x18430d[_0x0033('0x39')](_0x0033('0x4d'));}else{_0x18430d[_0x0033('0x39')](_0x0033('0x43'),_[_0x0033('0x38')](_0x41d7f4,'id'));}}})[_0x0033('0x48')](function(){return _0x18430d;});}function buildContactsQuery(_0x11e239,_0x31e851,_0x58148d,_0x46063b,_0x54e978,_0x353e10){if(_0x31e851){_0x31e851=_0x58148d[_0x0033('0x4e')];}_0x11e239=addFieldsToQuery(_0x11e239,_0x31e851,_0x46063b,_0x353e10,!![]);var _0x369bf0=squel[_0x0033('0x4f')]();_0x369bf0=addFieldsToQuery(_0x369bf0,_0x31e851,_0x46063b,_0x353e10,![]);if(_0x46063b||_0x353e10){_0x11e239=applyJoinClauses(_0x11e239,!![]);_0x11e239[_0x0033('0x50')](_0x0033('0x51'));if(_0x58148d[_0x0033('0x52')]){_0x369bf0['limit'](_0x58148d['limit']);}if(_0x58148d['offset']){_0x369bf0[_0x0033('0x53')](_0x58148d[_0x0033('0x53')]);}}else{_0x369bf0=applyJoinClauses(_0x369bf0,![]);_0x369bf0['group']('subqry.id');if(_0x58148d[_0x0033('0x52')]){_0x11e239[_0x0033('0x52')](_0x58148d['limit']);}if(_0x58148d[_0x0033('0x53')]){_0x11e239[_0x0033('0x53')](_0x58148d[_0x0033('0x53')]);}}_0x369bf0[_0x0033('0x54')](_0x54e978);if(_0x58148d[_0x0033('0x55')]){_0x58148d[_0x0033('0x55')][_0x0033('0x1b')](function(_0x3d92bd){_0x11e239[_0x0033('0x55')]('c.'+_0x3d92bd[0x0],_0x3d92bd[0x1]==='DESC'?![]:!![]);_0x369bf0[_0x0033('0x55')](_0x0033('0x56')+_0x3d92bd[0x0],_0x3d92bd[0x1]===_0x0033('0x57')?![]:!![]);});}_0x369bf0[_0x0033('0x9')](_0x11e239,_0x0033('0xc'));return _0x369bf0;}function getFilteredContacts(_0x1b21e9){var _0x3c5042=[];return db[_0x0033('0x36')][_0x0033('0x58')]({'attributes':['id',_0x0033('0x3f'),_0x0033('0x59')],'raw':!![]})['then'](function(_0xb12c09){_0x3c5042=_[_0x0033('0x5a')](_0xb12c09,'id');var _0x5df49d={'type':db['Sequelize']['QueryTypes']['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x0033('0x5b')][_0x0033('0x5c')](_0x1b21e9[_0x0033('0x5d')](),_0x5df49d);})[_0x0033('0x48')](function(_0x27fb94){_0x27fb94[_0x0033('0x1b')](function(_0x2b486e){if(_0x2b486e[_0x0033('0x1a')]){_0x2b486e[_0x0033('0x5e')]=[];_0x2b486e[_0x0033('0x1a')][_0x0033('0x37')](',')[_0x0033('0x1b')](function(_0x4df873){_0x2b486e['Tags'][_0x0033('0x42')](_0x3c5042[_0x4df873]);});}delete _0x2b486e[_0x0033('0x1a')];});return _0x27fb94;});}function countFilteredContacts(_0x42352d,_0x4eb80c){var _0x3f93b5=_0x42352d['clone']();_0x3f93b5[_0x0033('0x1c')](_0x0033('0x5f'));_0x3f93b5=applyJoinClauses(_0x3f93b5,!![]);_0x42352d[_0x0033('0x50')](_0x0033('0x51'));var _0x879911=utils[_0x0033('0x1f')](_0x4eb80c);if(!_[_0x0033('0x60')](_0x879911)){_0x3f93b5['where'](_0x0033('0x61'),_0x879911);}var _0x5915a2={'type':db[_0x0033('0x62')][_0x0033('0x63')][_0x0033('0x64')],'raw':!![]};return db[_0x0033('0x5b')][_0x0033('0x5c')](_0x3f93b5[_0x0033('0x5d')](),_0x5915a2)['then'](function(_0x4e810d){return _0x4e810d[0x0][_0x0033('0x5f')];});}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 _0x48f5=['getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','isEmpty','where','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','autocomplete','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','ct.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','phone','mobile','email','createdAt','updatedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','escapeLIKESpecialChars','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','length','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','default','text','value','Tag','split','clause','and','User','user','uc.UserId\x20=\x20?','skip','map','some','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','fields','tag','tags','filter','search','role'];(function(_0x591d44,_0x2b43a3){var _0x41dd26=function(_0x4c91ee){while(--_0x4c91ee){_0x591d44['push'](_0x591d44['shift']());}};_0x41dd26(++_0x2b43a3);}(_0x48f5,0x1bc));var _0x548f=function(_0x25a3a1,_0x1a4f92){_0x25a3a1=_0x25a3a1-0x0;var _0x2ebae3=_0x48f5[_0x25a3a1];return _0x2ebae3;};'use strict';var _=require('lodash');var squel=require(_0x548f('0x0'));var as=require(_0x548f('0x1'));var qs=require(_0x548f('0x2'));var utils=require(_0x548f('0x3'));var db=require(_0x548f('0x4'))['db'];function skipContactsQuery(_0x28b473,_0x3ec8cc){var _0x2f61cf=![];if(_0x28b473['role']===_0x548f('0x5')&&!_0x3ec8cc['search']&&!_0x3ec8cc[_0x548f('0x6')]&&_0x3ec8cc[_0x548f('0x7')]!==_0x548f('0x8')){_0x2f61cf=!![];}return _0x2f61cf;}function getContactsSubquery(){return squel[_0x548f('0x9')]()['from'](_0x548f('0xa'),'c')['where'](_0x548f('0xb'));}function applyJoinClauses(_0x112127,_0x537868){var _0x4b6dd4=_0x537868?'c':_0x548f('0xc');_0x112127['left_join']('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x4b6dd4+'.id')[_0x548f('0xd')]('cm_contact_has_tags','ct',_0x548f('0xe')+_0x4b6dd4+_0x548f('0xf'))[_0x548f('0xd')]('tools_tags','t',_0x548f('0x10'));return _0x112127;}function addFieldsToQuery(_0x2fa495,_0x335d41,_0x4d3125,_0x50715d,_0x551ca6){var _0x54a3af=_0x551ca6?'c':'subqry';if(!_0x335d41){_0x335d41=['id','firstName','lastName',_0x548f('0x11'),_0x548f('0x12'),'fax',_0x548f('0x13'),_0x548f('0x6'),'CompanyId',_0x548f('0x14'),_0x548f('0x15'),'deletedAt',_0x548f('0x16')];}else if(!_0x335d41[_0x548f('0x17')]('id')){_0x335d41[_0x548f('0x18')]('id');}var _0x48f736=_0x4d3125&&_0x551ca6||!_0x4d3125&&!_0x551ca6;if(_0x50715d){_0x48f736=_0x50715d&&_0x551ca6||!_0x50715d&&!_0x551ca6;}_0x335d41[_0x548f('0x19')](function(_0xcfb9f3){if(_0xcfb9f3==='TagIds'){if(_0x48f736){_0x2fa495[_0x548f('0x1a')](_0x548f('0x1b'),_0xcfb9f3);}else if(_0x4d3125||_0x50715d){_0x2fa495[_0x548f('0x1a')](_0x54a3af+'.'+_0xcfb9f3);}}else{_0x2fa495[_0x548f('0x1a')](_0x54a3af+'.'+_0xcfb9f3);}});return _0x2fa495;}function getSqlClauses(){var _0x45ba2={'default':squel['expr'](),'fields':squel[_0x548f('0x1c')](),'filter':squel[_0x548f('0x1c')](),'tags':{'clause':squel[_0x548f('0x1c')](),'ids':null},'user':{'clause':squel[_0x548f('0x1c')](),'skip':![]}};return _0x45ba2;}function parseTagParameter(_0x12e99f){var _0x1a9dda=squel[_0x548f('0x1c')]();if(_0x12e99f){var _0x28ef2f=utils[_0x548f('0x1d')](_0x12e99f);_0x28ef2f[_0x548f('0x19')](function(_0x50c2f9){_0x1a9dda['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50c2f9+',%');});}return _0x1a9dda;}function parseSearchFilter(_0x1214ae){var _0xcbf6f8=squel[_0x548f('0x1c')]();if(_0x1214ae){var _0x13d407=_0x1214ae[_0x548f('0x1e')]('\x5c','\x5c\x5c')[_0x548f('0x1e')](/'/g,'\x27\x27');var _0x121a94=qs[_0x548f('0x1f')](_0x13d407);if(_0x13d407['split']('\x20')['length']>0x1){_0xcbf6f8['or'](_0x548f('0x20'),qs[_0x548f('0x21')](_0x13d407,!![]),null);}else{if(qs[_0x548f('0x22')](_0x13d407)){_0xcbf6f8['or']('c.id\x20LIKE\x20?',_0x121a94+'%');_0xcbf6f8['or']('c.phone\x20LIKE\x20?',_0x121a94+'%');_0xcbf6f8['or'](_0x548f('0x23'),_0x121a94+'%');_0xcbf6f8['or'](_0x548f('0x24'),_0x121a94+'%');}else if(qs[_0x548f('0x25')](_0x13d407)){_0xcbf6f8['or'](_0x548f('0x26'),_0x121a94+'%');}else{_0xcbf6f8['or'](_0x548f('0x27'),'%'+_0x121a94+'%');_0xcbf6f8['or'](_0x548f('0x28'),'%'+_0x121a94+'%');_0xcbf6f8['or']('c.email\x20LIKE\x20?','%'+_0x121a94+'%');}}}return _0xcbf6f8;}function parseAdvancedSearchFilter(_0x17cab0,_0x2340c3){var _0x3e23ea=getSqlClauses();var _0x390c74=as[_0x548f('0x29')](_0x17cab0);var _0xa0ec3f=_0x390c74['sqlOperator'];for(var _0x1d0600=0x0;_0x1d0600<_0x390c74[_0x548f('0x2a')][_0x548f('0x2b')];_0x1d0600++){var _0x34ba30=_0x390c74['conditions'][_0x1d0600];var _0x9e720f='c';var _0x285dd9=_[_0x548f('0x2c')](_0x2340c3,[_0x548f('0x2d'),_0x34ba30[_0x548f('0x1a')]]);if(_0x285dd9){if(_0x34ba30[_0x548f('0x1a')]===_0x548f('0x2e')||_0x285dd9[_0x548f('0x2f')]===_0x548f('0x30')){_0x34ba30[_0x548f('0x31')]=_0x548f('0x32');}var _0x5a1806=as['buildExpression'](_0x9e720f,_0x285dd9['type'],_0x34ba30);_0x3e23ea[_0x548f('0x33')][_0xa0ec3f](_0x5a1806[_0x548f('0x34')],_0x5a1806[_0x548f('0x35')]['start'],_0x5a1806[_0x548f('0x35')]['end']);}else{if(_0x34ba30[_0x548f('0x1a')]===_0x548f('0x36')){var _0x1cf6de=_0x34ba30['value'][_0x548f('0x37')](',')['map'](function(_0x581a60){return Number(_0x581a60);});var _0x4aef9b=parseTagParameter(_0x1cf6de);_0x3e23ea['tags'][_0x548f('0x38')][_0x548f('0x39')](_0x4aef9b);_0x3e23ea['tags']['ids']=_0x1cf6de;}else if(_0x34ba30['field']===_0x548f('0x3a')){_0x3e23ea[_0x548f('0x3b')]['clause'][_0x548f('0x39')](_0x548f('0x3c'),_0x34ba30[_0x548f('0x35')]);_0x3e23ea[_0x548f('0x3b')][_0x548f('0x3d')]=!![];}}}return _0x3e23ea;}function parseModelFields(_0x3cd6f7,_0x3feef3){var _0x5cfcbe=squel['expr']();var _0x124c87=_(_0x3cd6f7)['keys']()[_0x548f('0x3e')](function(_0x202d92){return _[_0x548f('0x3f')](_0x3feef3,[_0x548f('0x2d'),_0x202d92])?_0x202d92:undefined;})['compact']()[_0x548f('0x35')]();if(_0x3cd6f7['Contact']){_0x124c87[_0x548f('0x18')](_0x548f('0x40'));}if(_0x3cd6f7[_0x548f('0x3a')]){_0x124c87[_0x548f('0x18')](_0x548f('0x3a'));}if(_0x124c87[_0x548f('0x2b')]>0x0){_0x124c87[_0x548f('0x19')](function(_0x3b6d29){if(_0x3b6d29===_0x548f('0x6')){_0x5cfcbe[_0x548f('0x39')](_0x548f('0x41'),[][_0x548f('0x42')](_0x3cd6f7[_0x3b6d29]));}else if(_0x3b6d29===_0x548f('0x40')){var _0x52757c='%'+_0x3cd6f7[_0x3b6d29]+'%';_0x5cfcbe['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x52757c);}else if(_0x3b6d29===_0x548f('0x3a')){_0x5cfcbe[_0x548f('0x39')](_0x548f('0x3c'),_0x3cd6f7[_0x3b6d29]);}else{_0x5cfcbe['and']('c.'+_0x3b6d29+_0x548f('0x43'),_0x3cd6f7[_0x3b6d29]);}});}return _0x5cfcbe;}function parseQueryParameters(_0x1df458,_0x49d0ba){var _0x56395c=getSqlClauses();return Promise[_0x548f('0x44')]()[_0x548f('0x45')](function(){return parseModelFields(_0x1df458,_0x49d0ba);})[_0x548f('0x45')](function(_0x2b56ae){_0x56395c[_0x548f('0x46')][_0x548f('0x39')](_0x2b56ae);return parseTagParameter(_0x1df458[_0x548f('0x47')]);})[_0x548f('0x45')](function(_0xfe58d1){_0x56395c[_0x548f('0x48')][_0x548f('0x38')][_0x548f('0x39')](_0xfe58d1);return parseSearchFilter(_0x1df458['filter']);})[_0x548f('0x45')](function(_0x57db22){_0x56395c[_0x548f('0x49')]=_0x57db22;return _0x56395c;});}function checkListsRestrictions(_0x4b1fa0,_0x408715,_0x1a38b1){var _0x391be7=squel[_0x548f('0x1c')]();return Promise['resolve']()['then'](function(){if(_0x408715[_0x548f('0x4a')]&&_0x4b1fa0[_0x548f('0x4b')]===_0x548f('0x5')&&!_0x1a38b1){return _0x4b1fa0[_0x548f('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0x548f('0x45')](function(_0x25e489){if(_0x25e489){if(_0x25e489[_0x548f('0x2b')]===0x0){_0x391be7[_0x548f('0x39')](_0x548f('0x4d'));}else{_0x391be7[_0x548f('0x39')]('c.ListId\x20IN\x20?',_['map'](_0x25e489,'id'));}}})[_0x548f('0x45')](function(){return _0x391be7;});}function buildContactsQuery(_0x664d0a,_0x18c99b,_0x3c179e,_0x554128,_0x145373,_0x934884){if(_0x18c99b){_0x18c99b=_0x3c179e[_0x548f('0x4e')];}_0x664d0a=addFieldsToQuery(_0x664d0a,_0x18c99b,_0x554128,_0x934884,!![]);var _0x8b7775=squel[_0x548f('0x9')]();_0x8b7775=addFieldsToQuery(_0x8b7775,_0x18c99b,_0x554128,_0x934884,![]);if(_0x554128||_0x934884){_0x664d0a=applyJoinClauses(_0x664d0a,!![]);_0x664d0a[_0x548f('0x4f')](_0x548f('0x50'));if(_0x3c179e[_0x548f('0x51')]){_0x8b7775[_0x548f('0x51')](_0x3c179e[_0x548f('0x51')]);}if(_0x3c179e[_0x548f('0x52')]){_0x8b7775[_0x548f('0x52')](_0x3c179e[_0x548f('0x52')]);}}else{_0x8b7775=applyJoinClauses(_0x8b7775,![]);_0x8b7775[_0x548f('0x4f')](_0x548f('0x53'));if(_0x3c179e[_0x548f('0x51')]){_0x664d0a[_0x548f('0x51')](_0x3c179e['limit']);}if(_0x3c179e[_0x548f('0x52')]){_0x664d0a[_0x548f('0x52')](_0x3c179e[_0x548f('0x52')]);}}_0x8b7775[_0x548f('0x54')](_0x145373);if(_0x3c179e[_0x548f('0x55')]){_0x3c179e['order']['forEach'](function(_0xa7156c){_0x664d0a[_0x548f('0x55')]('c.'+_0xa7156c[0x0],_0xa7156c[0x1]===_0x548f('0x56')?![]:!![]);_0x8b7775[_0x548f('0x55')](_0x548f('0x57')+_0xa7156c[0x0],_0xa7156c[0x1]==='DESC'?![]:!![]);});}_0x8b7775[_0x548f('0x58')](_0x664d0a,'subqry');return _0x8b7775;}function getFilteredContacts(_0x1e5982){var _0x4f0dc1=[];return db['Tag'][_0x548f('0x59')]({'attributes':['id',_0x548f('0x2d'),'color'],'raw':!![]})[_0x548f('0x45')](function(_0x290dbb){_0x4f0dc1=_[_0x548f('0x5a')](_0x290dbb,'id');var _0x2033d7={'type':db[_0x548f('0x5b')][_0x548f('0x5c')][_0x548f('0x5d')],'model':db[_0x548f('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x548f('0x5f')][_0x548f('0x60')](_0x1e5982[_0x548f('0x61')](),_0x2033d7);})['then'](function(_0x215c40){_0x215c40[_0x548f('0x19')](function(_0x44a447){if(_0x44a447[_0x548f('0x16')]){_0x44a447[_0x548f('0x62')]=[];_0x44a447[_0x548f('0x16')][_0x548f('0x37')](',')['forEach'](function(_0x5e6972){_0x44a447['Tags']['push'](_0x4f0dc1[_0x5e6972]);});}delete _0x44a447[_0x548f('0x16')];});return _0x215c40;});}function countFilteredContacts(_0x4a6687,_0x566bac){var _0x5cdd92=_0x4a6687[_0x548f('0x63')]();_0x5cdd92[_0x548f('0x1a')]('COUNT(*)');_0x5cdd92=applyJoinClauses(_0x5cdd92,!![]);_0x4a6687['group']('c.id');var _0x27516a=utils[_0x548f('0x1d')](_0x566bac);if(!_[_0x548f('0x64')](_0x27516a)){_0x5cdd92[_0x548f('0x65')]('t.id\x20IN\x20?',_0x27516a);}var _0xc6db9c={'type':db[_0x548f('0x5b')][_0x548f('0x5c')][_0x548f('0x5d')],'raw':!![]};return db[_0x548f('0x5f')][_0x548f('0x60')](_0x5cdd92[_0x548f('0x61')](),_0xc6db9c)[_0x548f('0x45')](function(_0x4d3705){return _0x4d3705[0x0][_0x548f('0x66')];});}module[_0x548f('0x67')]={'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 255c4a9..3c318c5 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 _0x8b10=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','close','unlink','decryptFile','createDecipher','update','final','secret','utf8','base64','decryptString','bluebird','lodash','app','secrets','session','aes-256-ctr','encrypt','algorithm','join'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8b10,0x6b));var _0x08b1=function(_0x2d6d41,_0x42728d){_0x2d6d41=_0x2d6d41-0x0;var _0x4e36f0=_0x8b10[_0x2d6d41];return _0x4e36f0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x08b1('0x0'));var _=require(_0x08b1('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x08b1('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x08b1('0x3')][_0x08b1('0x4')],'algorithm':_0x08b1('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0x08b1('0x6')]&&config[_0x08b1('0x6')][_0x08b1('0x7')]){var isSupported=isAlgorithmSupported(config[_0x08b1('0x6')]['algorithm']);if(isSupported){fileOptions[_0x08b1('0x7')]=config[_0x08b1('0x6')][_0x08b1('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x08b1('0x8')](',\x20');logger['error'](config['encrypt'][_0x08b1('0x7')],_0x08b1('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x3f21bc){return AES_SUPPORTED_RX[_0x08b1('0xa')](_0x3f21bc);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x407c32){return getSupportedCiphers()['indexOf'](_0x407c32)>-0x1;}function combineOptions(_0x4666ef){var _0x5a42d8={};for(var _0x5938f3 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5938f3)){_0x5a42d8[_0x5938f3]=fileOptions[_0x5938f3];}}if(_0x4666ef){for(var _0x4993b2 in _0x4666ef){if(_0x4666ef['hasOwnProperty'](_0x4993b2)){_0x5a42d8[_0x4993b2]=_0x4666ef[_0x4993b2];}}}return _0x5a42d8;}exports[_0x08b1('0xb')]=function(_0x5ad069,_0x3acf79,_0x26e3f6,_0x47345f){return new BPromise(function(_0x128ec3,_0x4d0fbd){_0x47345f=combineOptions(_0x47345f);var _0x8af114=new Buffer(_0x26e3f6);var _0x290897=fs[_0x08b1('0xc')](_0x5ad069);var _0x59bc11=fs[_0x08b1('0xd')](_0x3acf79);var _0x1e744d=crypto[_0x08b1('0xe')](_0x47345f[_0x08b1('0x7')],_0x8af114);_0x290897['on'](_0x08b1('0xf'),function(_0x4ca5d8){var _0x28c148=new Buffer(_0x1e744d['update'](_0x4ca5d8),_0x08b1('0x10'));_0x59bc11[_0x08b1('0x11')](_0x28c148);});_0x290897['on']('end',function(){try{var _0x4b0411=new Buffer(_0x1e744d['final'](_0x08b1('0x10')),_0x08b1('0x10'));_0x59bc11[_0x08b1('0x11')](_0x4b0411);_0x59bc11[_0x08b1('0x12')]();_0x59bc11['on'](_0x08b1('0x13'),function(){return _0x128ec3(_0x3acf79);});}catch(_0x20dea7){fs[_0x08b1('0x14')](_0x3acf79);return _0x4d0fbd(_0x20dea7);}});});};exports[_0x08b1('0x15')]=function(_0xb97009,_0x4163bd,_0x58b9f1,_0x36aa68){return new BPromise(function(_0x2c8d2c,_0x2bfe5b){_0x36aa68=combineOptions(_0x36aa68);var _0x3a8571=new Buffer(_0x58b9f1);var _0x79eddb=fs['createReadStream'](_0xb97009);var _0x106020=fs['createWriteStream'](_0x4163bd);var _0x9743a0=crypto[_0x08b1('0x16')](_0x36aa68[_0x08b1('0x7')],_0x3a8571);_0x79eddb['on'](_0x08b1('0xf'),function(_0x4d456b){var _0xd06b89=new Buffer(_0x9743a0[_0x08b1('0x17')](_0x4d456b),_0x08b1('0x10'));_0x106020[_0x08b1('0x11')](_0xd06b89);});_0x79eddb['on'](_0x08b1('0x12'),function(){try{var _0x2decc7=new Buffer(_0x9743a0[_0x08b1('0x18')]('binary'),'binary');_0x106020['write'](_0x2decc7);_0x106020['end']();_0x106020['on'](_0x08b1('0x13'),function(){return _0x2c8d2c(_0x4163bd);});}catch(_0x26f359){fs[_0x08b1('0x14')](_0x4163bd);return _0x2bfe5b(_0x26f359);}});});};exports['encryptString']=function(_0x40cc7a,_0x47cacb,_0x2020cc){var _0x10cb08=_0x2020cc||stringOptions[_0x08b1('0x7')];var _0x5bc958=_0x47cacb||stringOptions[_0x08b1('0x19')];var _0x4ce516=crypto[_0x08b1('0xe')](_0x10cb08,_0x5bc958);var _0x5425f6=_0x4ce516[_0x08b1('0x17')](_0x40cc7a,_0x08b1('0x1a'),_0x08b1('0x1b'));_0x5425f6+=_0x4ce516['final'](_0x08b1('0x1b'));return _0x5425f6;};exports[_0x08b1('0x1c')]=function(_0x4dad96,_0x4a9a08,_0x489e0d){var _0x587869=_0x489e0d||stringOptions['algorithm'];var _0x22c7ed=_0x4a9a08||stringOptions['secret'];var _0x42bbdd=crypto['createDecipher'](_0x587869,_0x22c7ed);var _0x3b55ac=_0x42bbdd[_0x08b1('0x17')](_0x4dad96,_0x08b1('0x1b'),_0x08b1('0x1a'));_0x3b55ac+=_0x42bbdd[_0x08b1('0x18')](_0x08b1('0x1a'));return _0x3b55ac;}; \ No newline at end of file +var _0x5fb2=['base64','decryptString','secret','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','write','final','binary','end','close','unlink','createDecipher','data','encryptString','utf8'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0x5fb2,0x1d4));var _0x25fb=function(_0x2f9e6c,_0x2d85db){_0x2f9e6c=_0x2f9e6c-0x0;var _0xc246e6=_0x5fb2[_0x2f9e6c];return _0xc246e6;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x25fb('0x0'));var _=require(_0x25fb('0x1'));var config=require('../../config/environment');var logger=require(_0x25fb('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x25fb('0x3')][_0x25fb('0x4')],'algorithm':_0x25fb('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0x25fb('0x6')]&&config[_0x25fb('0x6')][_0x25fb('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x25fb('0x7')]);if(isSupported){fileOptions[_0x25fb('0x7')]=config[_0x25fb('0x6')][_0x25fb('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x25fb('0x6')][_0x25fb('0x7')],_0x25fb('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x147e90){return AES_SUPPORTED_RX[_0x25fb('0x9')](_0x147e90);}function getSupportedCiphers(){return crypto[_0x25fb('0xa')]()[_0x25fb('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x113ecc){return getSupportedCiphers()[_0x25fb('0xc')](_0x113ecc)>-0x1;}function combineOptions(_0x4c6680){var _0x50e15a={};for(var _0xf06bb7 in fileOptions){if(fileOptions[_0x25fb('0xd')](_0xf06bb7)){_0x50e15a[_0xf06bb7]=fileOptions[_0xf06bb7];}}if(_0x4c6680){for(var _0x273501 in _0x4c6680){if(_0x4c6680[_0x25fb('0xd')](_0x273501)){_0x50e15a[_0x273501]=_0x4c6680[_0x273501];}}}return _0x50e15a;}exports['encryptFile']=function(_0xf557b3,_0x295439,_0x318962,_0x1dc441){return new BPromise(function(_0x3c53fe,_0x1fdd0e){_0x1dc441=combineOptions(_0x1dc441);var _0x5a8c1a=new Buffer(_0x318962);var _0x3cac38=fs[_0x25fb('0xe')](_0xf557b3);var _0x310bb9=fs[_0x25fb('0xf')](_0x295439);var _0x10c77e=crypto[_0x25fb('0x10')](_0x1dc441[_0x25fb('0x7')],_0x5a8c1a);_0x3cac38['on']('data',function(_0x2b14e8){var _0xd6cb20=new Buffer(_0x10c77e[_0x25fb('0x11')](_0x2b14e8),'binary');_0x310bb9[_0x25fb('0x12')](_0xd6cb20);});_0x3cac38['on']('end',function(){try{var _0x294187=new Buffer(_0x10c77e[_0x25fb('0x13')](_0x25fb('0x14')),_0x25fb('0x14'));_0x310bb9[_0x25fb('0x12')](_0x294187);_0x310bb9[_0x25fb('0x15')]();_0x310bb9['on'](_0x25fb('0x16'),function(){return _0x3c53fe(_0x295439);});}catch(_0x364f83){fs[_0x25fb('0x17')](_0x295439);return _0x1fdd0e(_0x364f83);}});});};exports['decryptFile']=function(_0x23b7d5,_0x5a7bc6,_0x10a221,_0x44d5fd){return new BPromise(function(_0x526105,_0x307761){_0x44d5fd=combineOptions(_0x44d5fd);var _0x5ce5c1=new Buffer(_0x10a221);var _0x30352d=fs[_0x25fb('0xe')](_0x23b7d5);var _0x5aee56=fs[_0x25fb('0xf')](_0x5a7bc6);var _0x4e6e11=crypto[_0x25fb('0x18')](_0x44d5fd[_0x25fb('0x7')],_0x5ce5c1);_0x30352d['on'](_0x25fb('0x19'),function(_0x1c0da6){var _0x24f16d=new Buffer(_0x4e6e11['update'](_0x1c0da6),_0x25fb('0x14'));_0x5aee56[_0x25fb('0x12')](_0x24f16d);});_0x30352d['on']('end',function(){try{var _0x31677e=new Buffer(_0x4e6e11[_0x25fb('0x13')](_0x25fb('0x14')),'binary');_0x5aee56[_0x25fb('0x12')](_0x31677e);_0x5aee56['end']();_0x5aee56['on'](_0x25fb('0x16'),function(){return _0x526105(_0x5a7bc6);});}catch(_0x2866d2){fs['unlink'](_0x5a7bc6);return _0x307761(_0x2866d2);}});});};exports[_0x25fb('0x1a')]=function(_0xca92bf,_0x3c1a17,_0x3f6d38){var _0x438f9d=_0x3f6d38||stringOptions[_0x25fb('0x7')];var _0x41f75b=_0x3c1a17||stringOptions['secret'];var _0x475843=crypto[_0x25fb('0x10')](_0x438f9d,_0x41f75b);var _0x52dcb6=_0x475843[_0x25fb('0x11')](_0xca92bf,_0x25fb('0x1b'),_0x25fb('0x1c'));_0x52dcb6+=_0x475843[_0x25fb('0x13')](_0x25fb('0x1c'));return _0x52dcb6;};exports[_0x25fb('0x1d')]=function(_0x527378,_0x15551f,_0x29bd44){var _0x4fb968=_0x29bd44||stringOptions[_0x25fb('0x7')];var _0xc009fd=_0x15551f||stringOptions[_0x25fb('0x1e')];var _0x35596c=crypto[_0x25fb('0x18')](_0x4fb968,_0xc009fd);var _0x4e47ac=_0x35596c['update'](_0x527378,_0x25fb('0x1c'),_0x25fb('0x1b'));_0x4e47ac+=_0x35596c[_0x25fb('0x13')]('utf8');return _0x4e47ac;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 92f21ce..8f38a10 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 _0x966c=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','then','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','CSV','find','split','splitSizeCsv','sequelize','query','format'];(function(_0x1152b9,_0x492581){var _0x456704=function(_0x8738dd){while(--_0x8738dd){_0x1152b9['push'](_0x1152b9['shift']());}};_0x456704(++_0x492581);}(_0x966c,0x1c2));var _0xc966=function(_0x579186,_0x11fc17){_0x579186=_0x579186-0x0;var _0x1544f5=_0x966c[_0x579186];return _0x1544f5;};'use strict';var util=require(_0xc966('0x0'));var path=require(_0xc966('0x1'));var _=require('lodash');var csv=require(_0xc966('0x2'));var fs=require('fs');var BPromise=require(_0xc966('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xc966('0x4'));var db=require(_0xc966('0x5'))['db'];var dbH=require(_0xc966('0x5'))[_0xc966('0x6')];var logger=require(_0xc966('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc966('0x8')][0x2]);var QUERY=process[_0xc966('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d720f,_0x44d221){var _0x464644={'status':_0x2d720f};var _0x58627b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44d221){_0x464644[_0xc966('0x9')]=_0x44d221;}return db[_0xc966('0xa')][_0xc966('0xb')](_0x464644,_0x58627b);}function main(){var _0x450965=0x1388;var _0x3e5d24;logger[_0xc966('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc966('0xd')));return db['Setting'][_0xc966('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc966('0xf'),_0xc966('0x10')]})['then'](function(_0x4872eb){if(_0x4872eb){_0x3e5d24=_0x4872eb;_0x450965=_0x3e5d24[_0xc966('0x10')]||0x1388;}})['then'](function(){return dbH[_0xc966('0x11')][_0xc966('0x12')](util[_0xc966('0x13')](_0xc966('0x14'),QUERY),{'type':dbH[_0xc966('0x11')][_0xc966('0x15')][_0xc966('0x16')]});})['then'](function(_0x3432ba){if(!_0x3432ba[0x0][_0xc966('0x17')]){return analyticExtractedReport('Empty');}var _0x6d8207=[];var _0x5424f1=0x0;if(_0x3e5d24['split']){if(_0x3432ba&&_0x3432ba[_0xc966('0x18')]){var _0x45ed8e=_['range'](_0x3432ba[0x0][_0xc966('0x17')]/_0x450965);var _0x539e91=Number[_0xc966('0x19')](_0x3432ba[0x0][_0xc966('0x17')]/_0x450965)?_0x3432ba[0x0]['num']%_0x450965:0x0;_0x45ed8e[_0xc966('0x1a')](function(_0x917fa3){if(_0x917fa3>0x0){_0x5424f1+=_0x450965;}_0x6d8207[_0xc966('0x1b')](dbH[_0xc966('0x11')][_0xc966('0x12')](util['format'](_0xc966('0x1c'),QUERY,_0x450965,_0x5424f1),{'type':dbH[_0xc966('0x11')][_0xc966('0x15')][_0xc966('0x16')]}));});if(_0x539e91>0x0){_0x5424f1+=_0x450965;_0x6d8207[_0xc966('0x1b')](dbH[_0xc966('0x11')][_0xc966('0x12')](util[_0xc966('0x13')](_0xc966('0x1c'),QUERY,_0x539e91,_0x5424f1),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x6d8207[_0xc966('0x1b')](dbH['sequelize'][_0xc966('0x12')](QUERY,{'type':dbH[_0xc966('0x11')]['QueryTypes']['SELECT']}));}var _0x4dcc11=path[_0xc966('0x1d')](PATH);var _0x3a730b=path[_0xc966('0x1e')](PATH,_0xc966('0x1f'));var _0x5b7c3c=_0x3e5d24['split']&&_0x6d8207['length']>0x1;var _0xc689c8=[];if(!fs['existsSync'](path[_0xc966('0x20')](_0x4dcc11,_0x3a730b))&&_0x5b7c3c){fs[_0xc966('0x21')](path[_0xc966('0x20')](_0x4dcc11,_0x3a730b));}return BPromise[_0xc966('0x22')](_0x6d8207,function(_0x3106ec){_0xc689c8['push'](_0x3106ec);})[_0xc966('0x23')](function(){for(var _0x51c701=0x0;_0x51c701<_0xc689c8[_0xc966('0x18')];_0x51c701+=0x1){var _0x3d0e77;var _0x12a8a9=_0xc689c8[_0x51c701];if(_0x5b7c3c){_0x3d0e77=path[_0xc966('0x20')](_0x4dcc11,_0x3a730b,util[_0xc966('0x13')]('%s%d.%s',_0x3a730b,_0x51c701,_0xc966('0x24')));}else{_0x3d0e77=path[_0xc966('0x20')](_0x4dcc11,util[_0xc966('0x13')](_0xc966('0x25'),_0x3a730b,_0xc966('0x24')));}fs[_0xc966('0x26')](_0x3d0e77,csv(_0x12a8a9));}})[_0xc966('0x23')](function(){if(_0x5b7c3c){return new Promise(function(_0xe9cd1a){zipdir(path['join'](_0x4dcc11,_0x3a730b),{'saveTo':path[_0xc966('0x20')](_0x4dcc11,util[_0xc966('0x13')](_0xc966('0x25'),_0x3a730b,_0xc966('0x27')))},function(_0x1ff776,_0x5c053f){rimraf(path['join'](_0x4dcc11,_0x3a730b),function(){});_0xe9cd1a(_0xc966('0x28'));});});}})[_0xc966('0x23')](function(){logger[_0xc966('0xc')](util['format'](_0xc966('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x5b7c3c?util[_0xc966('0x13')](_0xc966('0x25'),_0x3a730b,_0x5b7c3c?_0xc966('0x27'):_0xc966('0x24')):null);});})[_0xc966('0x2a')](function(_0x5bfb45){logger[_0xc966('0xc')](util['format'](_0xc966('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0xc966('0x2c')](_0x5bfb45,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc966('0x2d'));})['finally'](function(){process[_0xc966('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x136c=['rimraf','../../mysqldb','dbH','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','mkdirSync','each','%s%d.%s','csv','join','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird'];(function(_0x15a417,_0x357c5a){var _0x1caeee=function(_0xd88c90){while(--_0xd88c90){_0x15a417['push'](_0x15a417['shift']());}};_0x1caeee(++_0x357c5a);}(_0x136c,0xf0));var _0xc136=function(_0x65eabb,_0x6b3974){_0x65eabb=_0x65eabb-0x0;var _0x18d251=_0x136c[_0x65eabb];return _0x18d251;};'use strict';var util=require(_0xc136('0x0'));var path=require(_0xc136('0x1'));var _=require(_0xc136('0x2'));var csv=require(_0xc136('0x3'));var fs=require('fs');var BPromise=require(_0xc136('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xc136('0x5'));var db=require(_0xc136('0x6'))['db'];var dbH=require(_0xc136('0x6'))[_0xc136('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc136('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc136('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2bf957,_0x571610){var _0x2edaa8={'status':_0x2bf957};var _0x33288b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x571610){_0x2edaa8['savename']=_0x571610;}return db['AnalyticExtractedReport'][_0xc136('0x9')](_0x2edaa8,_0x33288b);}function main(){var _0x49b3b8=0x1388;var _0x4a3fe1;logger[_0xc136('0xa')](util[_0xc136('0xb')](_0xc136('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xc136('0xd')][_0xc136('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc136('0xf'),'splitSizeCsv']})[_0xc136('0x10')](function(_0x6dddb0){if(_0x6dddb0){_0x4a3fe1=_0x6dddb0;_0x49b3b8=_0x4a3fe1[_0xc136('0x11')]||0x1388;}})[_0xc136('0x10')](function(){return dbH['sequelize'][_0xc136('0x12')](util[_0xc136('0xb')](_0xc136('0x13'),QUERY),{'type':dbH[_0xc136('0x14')][_0xc136('0x15')][_0xc136('0x16')]});})[_0xc136('0x10')](function(_0x603974){if(!_0x603974[0x0][_0xc136('0x17')]){return analyticExtractedReport(_0xc136('0x18'));}var _0x5749f6=[];var _0x367eb6=0x0;if(_0x4a3fe1[_0xc136('0xf')]){if(_0x603974&&_0x603974[_0xc136('0x19')]){var _0x5a794c=_[_0xc136('0x1a')](_0x603974[0x0][_0xc136('0x17')]/_0x49b3b8);var _0x17069c=Number['isInteger'](_0x603974[0x0]['num']/_0x49b3b8)?_0x603974[0x0][_0xc136('0x17')]%_0x49b3b8:0x0;_0x5a794c[_0xc136('0x1b')](function(_0x5cb2ac){if(_0x5cb2ac>0x0){_0x367eb6+=_0x49b3b8;}_0x5749f6[_0xc136('0x1c')](dbH[_0xc136('0x14')][_0xc136('0x12')](util[_0xc136('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x49b3b8,_0x367eb6),{'type':dbH[_0xc136('0x14')]['QueryTypes'][_0xc136('0x16')]}));});if(_0x17069c>0x0){_0x367eb6+=_0x49b3b8;_0x5749f6[_0xc136('0x1c')](dbH[_0xc136('0x14')]['query'](util[_0xc136('0xb')](_0xc136('0x1d'),QUERY,_0x17069c,_0x367eb6),{'type':dbH[_0xc136('0x14')]['QueryTypes'][_0xc136('0x16')]}));}}}else{_0x5749f6[_0xc136('0x1c')](dbH['sequelize'][_0xc136('0x12')](QUERY,{'type':dbH['sequelize'][_0xc136('0x15')][_0xc136('0x16')]}));}var _0xb4fdd9=path['dirname'](PATH);var _0x25cb27=path[_0xc136('0x1e')](PATH,_0xc136('0x1f'));var _0x6c3641=_0x4a3fe1[_0xc136('0xf')]&&_0x5749f6['length']>0x1;var _0x33b32b=[];if(!fs[_0xc136('0x20')](path['join'](_0xb4fdd9,_0x25cb27))&&_0x6c3641){fs[_0xc136('0x21')](path['join'](_0xb4fdd9,_0x25cb27));}return BPromise[_0xc136('0x22')](_0x5749f6,function(_0x1e6324){_0x33b32b[_0xc136('0x1c')](_0x1e6324);})[_0xc136('0x10')](function(){for(var _0x2bf680=0x0;_0x2bf680<_0x33b32b[_0xc136('0x19')];_0x2bf680+=0x1){var _0x49ad8d;var _0x3ed789=_0x33b32b[_0x2bf680];if(_0x6c3641){_0x49ad8d=path['join'](_0xb4fdd9,_0x25cb27,util[_0xc136('0xb')](_0xc136('0x23'),_0x25cb27,_0x2bf680,_0xc136('0x24')));}else{_0x49ad8d=path[_0xc136('0x25')](_0xb4fdd9,util[_0xc136('0xb')](_0xc136('0x26'),_0x25cb27,_0xc136('0x24')));}fs[_0xc136('0x27')](_0x49ad8d,csv(_0x3ed789));}})[_0xc136('0x10')](function(){if(_0x6c3641){return new Promise(function(_0x4f1e1d){zipdir(path[_0xc136('0x25')](_0xb4fdd9,_0x25cb27),{'saveTo':path['join'](_0xb4fdd9,util[_0xc136('0xb')]('%s.%s',_0x25cb27,'zip'))},function(_0x3de202,_0x2fde98){rimraf(path['join'](_0xb4fdd9,_0x25cb27),function(){});_0x4f1e1d('zip\x20finished');});});}})[_0xc136('0x10')](function(){logger[_0xc136('0xa')](util[_0xc136('0xb')](_0xc136('0x28'),EXTRACTED_REPORT_ID,_0xc136('0x29')));return analyticExtractedReport('Completed',_0x6c3641?util['format'](_0xc136('0x26'),_0x25cb27,_0x6c3641?_0xc136('0x2a'):_0xc136('0x24')):null);});})[_0xc136('0x2b')](function(_0x27d0f1){logger[_0xc136('0xa')](util[_0xc136('0xb')](_0xc136('0x2c'),EXTRACTED_REPORT_ID,_0xc136('0x29')),util[_0xc136('0x2d')](_0x27d0f1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc136('0x2e'));})[_0xc136('0x2f')](function(){process[_0xc136('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a59979b..2bf4110 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 _0x50a6=['length','body','push','concat','chunk','forEach','format','name','startDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','query','dirname','basename','.pdf','existsSync','join','each','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x50a6,0x163));var _0x650a=function(_0x3575ed,_0x3294bb){_0x3575ed=_0x3575ed-0x0;var _0x36cb29=_0x50a6[_0x3575ed];return _0x36cb29;};'use strict';var _=require(_0x650a('0x0'));var fs=require('fs');var util=require(_0x650a('0x1'));var path=require(_0x650a('0x2'));var moment=require(_0x650a('0x3'));var htmlToPdfmake=require(_0x650a('0x4'));var PdfPrinter=require(_0x650a('0x5'));var zipdir=require(_0x650a('0x6'));var rimraf=require(_0x650a('0x7'));var JSDOM=require(_0x650a('0x8'))[_0x650a('0x9')];var window=new JSDOM('')[_0x650a('0xa')];var BPromise=require('bluebird');var db=require(_0x650a('0xb'))['db'];var dbH=require('../../mysqldb')[_0x650a('0xc')];var logger=require(_0x650a('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x650a('0xe')][0x2]);var QUERY=process[_0x650a('0xe')][0x3];var PATH=process[_0x650a('0xe')][0x4];var NAME=process[_0x650a('0xe')][0x5];var FORMAT=_0x650a('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x30d7f1,_0x1f086b){var _0x3d3715={'status':_0x30d7f1};var _0x2e5a39={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f086b){_0x3d3715[_0x650a('0x10')]=_0x1f086b;}return db[_0x650a('0x11')][_0x650a('0x12')](_0x3d3715,_0x2e5a39);}function getHeaders(_0x4890cb){return _[_0x650a('0x13')](_0x4890cb,function(_0x5dca10){return{'text':_0x5dca10,'style':_0x650a('0x14')};});}function getRows(_0x250012,_0x37880a){return _[_0x650a('0x13')](_0x37880a,function(_0x286f07){return _(_0x286f07)[_0x650a('0x15')](_0x250012)[_0x650a('0x13')](function(_0x5cf09a){return _0x5cf09a?_[_0x650a('0x16')](_0x5cf09a):'';})[_0x650a('0x17')]();});}function createTable(_0xef363d,_0x1803cf){var _0x239a62={'widths':_[_0x650a('0x18')](Array(_0xef363d[_0x650a('0x19')]),0x91),'heights':function(_0x224e28){return _0x224e28===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xfb6ad9=getHeaders(_0xef363d);_0x239a62[_0x650a('0x1a')][_0x650a('0x1b')](_0xfb6ad9);var _0x10f477=getRows(_0xef363d,_0x1803cf);_0x239a62[_0x650a('0x1a')]=_0x239a62['body'][_0x650a('0x1c')](_0x10f477);return _0x239a62;}function createTables(_0x110d26){var _0x17dfa0=[];var _0x4671c8=_[_0x650a('0x1d')](Object['keys'](_0x110d26[0x0]),0x5);_0x4671c8[_0x650a('0x1e')](function(_0xe69d14){_0x17dfa0[_0x650a('0x1b')](createTable(_0xe69d14,_0x110d26));});return _0x17dfa0;}function getPDFDocDefinition(_0x3a3a01){var _0x1a2a24=util[_0x650a('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x650a('0x20')],moment(EXTRACTED_REPORT[_0x650a('0x21')])[_0x650a('0x1f')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x650a('0x1f')](FORMAT));var _0x335542=[];for(var _0x375939=0x0;_0x375939<_0x3a3a01['length'];_0x375939++){var _0x844145=[];if(_0x375939===0x0){_0x844145[_0x650a('0x1b')]({'text':_0x1a2a24,'style':_0x650a('0x22')});}var _0x4cb3e8={'table':_0x3a3a01[_0x375939]};if(_0x375939>0x0){_0x4cb3e8[_0x650a('0x23')]='before';_0x4cb3e8[_0x650a('0x24')]=[0x0,0x46,0x0,0x0];}_0x844145[_0x650a('0x1b')](_0x4cb3e8);_0x335542[_0x650a('0x1b')](_0x844145);}return{'pageSize':'A4','pageOrientation':_0x650a('0x25'),'content':_0x335542,'footer':function(_0x29866e,_0x4ce26a){return{'text':_0x29866e[_0x650a('0x16')]()+_0x650a('0x26')+_0x4ce26a,'style':_0x650a('0x27')};},'defaultStyle':{'font':_0x650a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x650a('0x29')},'footer':{'alignment':_0x650a('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b0840){var _0x2b8db8=0x1388;var _0x5a1c83;if(!_0x5b0840[0x0][_0x650a('0x2b')]){return analyticExtractedReport(_0x650a('0x2c'));}return db[_0x650a('0x2d')][_0x650a('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x650a('0x2f'),_0x650a('0x30')]})[_0x650a('0x31')](function(_0x5ccf17){if(_0x5ccf17){_0x5a1c83=_0x5ccf17;_0x2b8db8=_0x5a1c83[_0x650a('0x30')]||0x3e8;}})[_0x650a('0x31')](function(){var _0x513631=[];var _0x2a2c53=0x0;if(_0x5a1c83['split']){if(_0x5b0840&&_0x5b0840[_0x650a('0x19')]){var _0x1d0123=_[_0x650a('0x32')](_0x5b0840[0x0][_0x650a('0x2b')]/_0x2b8db8);var _0x2bc722=Number[_0x650a('0x33')](_0x5b0840[0x0][_0x650a('0x2b')]/_0x2b8db8)?_0x5b0840[0x0][_0x650a('0x2b')]%_0x2b8db8:0x0;_0x1d0123[_0x650a('0x1e')](function(_0x311643){if(_0x311643>0x0){_0x2a2c53+=_0x2b8db8;}_0x513631[_0x650a('0x1b')](dbH['sequelize']['query'](util[_0x650a('0x1f')](_0x650a('0x34'),QUERY,_0x2b8db8,_0x2a2c53),{'type':dbH['sequelize'][_0x650a('0x35')][_0x650a('0x36')]}));});if(_0x2bc722>0x0){_0x2a2c53+=_0x2b8db8;_0x513631[_0x650a('0x1b')](dbH[_0x650a('0x37')][_0x650a('0x38')](util[_0x650a('0x1f')](_0x650a('0x34'),QUERY,_0x2bc722,_0x2a2c53),{'type':dbH['sequelize']['QueryTypes'][_0x650a('0x36')]}));}}}else{_0x513631[_0x650a('0x1b')](dbH[_0x650a('0x37')][_0x650a('0x38')](QUERY,{'type':dbH[_0x650a('0x37')][_0x650a('0x35')]['SELECT']}));}var _0x4258c4=path[_0x650a('0x39')](PATH);var _0x4f2701=path[_0x650a('0x3a')](PATH,_0x650a('0x3b'));var _0x52c0e5=_0x5a1c83['split']&&_0x513631['length']>0x1;var _0xacc401=[];if(!fs[_0x650a('0x3c')](path[_0x650a('0x3d')](_0x4258c4,_0x4f2701))&&_0x52c0e5){fs['mkdirSync'](path[_0x650a('0x3d')](_0x4258c4,_0x4f2701));}return BPromise[_0x650a('0x3e')](_0x513631,function(_0x2deb82){_0xacc401[_0x650a('0x1b')](_0x2deb82);})[_0x650a('0x31')](function(){var _0x1f83f0=[];for(var _0x1006de=0x0;_0x1006de<_0xacc401['length'];_0x1006de+=0x1){var _0x4587f8=_0xacc401[_0x1006de];var _0x22de70=createTables(_['flatten'](_0x4587f8));var _0x1d8db9;var _0x4e5ac3=getPDFDocDefinition(_0x22de70);var _0x5572e3=getPDFPrinter();var _0x1995b7=_0x5572e3[_0x650a('0x3f')](_0x4e5ac3);if(_0x52c0e5){_0x1d8db9=path[_0x650a('0x3d')](_0x4258c4,_0x4f2701,util[_0x650a('0x1f')](_0x650a('0x40'),_0x4f2701,_0x1006de,_0x650a('0x41')));}else{_0x1d8db9=path['join'](_0x4258c4,util[_0x650a('0x1f')]('%s.%s',_0x4f2701,_0x650a('0x41')));}_0x1f83f0[_0x650a('0x1b')](writePDFDocument(_0x1995b7,_0x1d8db9));}return Promise[_0x650a('0x42')](_0x1f83f0);})[_0x650a('0x31')](function(){if(_0x52c0e5){return new Promise(function(_0x5019c1){zipdir(path[_0x650a('0x3d')](_0x4258c4,_0x4f2701),{'saveTo':path[_0x650a('0x3d')](_0x4258c4,util[_0x650a('0x1f')](_0x650a('0x43'),_0x4f2701,'zip'))},function(){rimraf(path[_0x650a('0x3d')](_0x4258c4,_0x4f2701),function(){});_0x5019c1(_0x650a('0x44'));});});}})[_0x650a('0x31')](function(){if(!_0x52c0e5)return;rimraf(path[_0x650a('0x3d')](_0x4258c4,_0x4f2701),function(){});})[_0x650a('0x31')](function(){logger[_0x650a('0x45')](util[_0x650a('0x1f')](_0x650a('0x46'),EXTRACTED_REPORT_ID,_0x650a('0x47')));return analyticExtractedReport(_0x650a('0x48'),_0x52c0e5?util[_0x650a('0x1f')](_0x650a('0x43'),_0x4f2701,_0x52c0e5?'zip':_0x650a('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x650a('0x45')](util[_0x650a('0x1f')](_0x650a('0x49'),EXTRACTED_REPORT_ID,_0x650a('0x47')));return db[_0x650a('0x11')][_0x650a('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x650a('0x31')](function(_0xa05d4){EXTRACTED_REPORT=_0xa05d4;return dbH[_0x650a('0x37')][_0x650a('0x38')](util[_0x650a('0x1f')](_0x650a('0x4b'),QUERY),{'type':dbH[_0x650a('0x37')][_0x650a('0x35')][_0x650a('0x36')]});})[_0x650a('0x31')](extractReport)[_0x650a('0x4c')](function(_0x482650){logger[_0x650a('0x45')](util[_0x650a('0x1f')](_0x650a('0x4d'),EXTRACTED_REPORT_ID,'PDF'),util[_0x650a('0x4e')](_0x482650,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x650a('0x4f')](function(){process[_0x650a('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x133035=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x650a('0x51'),'italics':__dirname+_0x650a('0x52'),'bolditalics':__dirname+_0x650a('0x53')}});return _0x133035;}function getPDFDocDefinitionFromHTML(_0x5424a9,_0x167d92){var _0x3c979a=util[_0x650a('0x1f')]('%s\x20#%d',_0x167d92[_0x650a('0x54')],_0x167d92[_0x650a('0x55')]);var _0x2cf196=moment()[_0x650a('0x1f')](_0x650a('0x56'))[_0x650a('0x16')]();var _0x17f478=htmlToPdfmake(_0x5424a9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x17f478],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x650a('0x57'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x650a('0x57')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x650a('0x22')}];},'footer':function(_0x262e46,_0xd1fae3){return[{'text':util['format'](_0x650a('0x58'),_0x3c979a,_0x262e46,_0xd1fae3,_0x2cf196),'style':_0x650a('0x27')}];}};}function writePDFDocument(_0x5ab9b0,_0x1e2dff){return new Promise(function(_0x3f8bb1,_0x4c30de){var _0xe0ad09=_0x5ab9b0[_0x650a('0x59')](fs[_0x650a('0x5a')](_0x1e2dff));_0xe0ad09['on'](_0x650a('0x5b'),function(){_0x3f8bb1(_0x650a('0x5b'));});_0xe0ad09['on'](_0x650a('0x5c'),function(_0x1609ae){_0x4c30de(_0x1609ae);});_0x5ab9b0[_0x650a('0x5d')]();});}exports[_0x650a('0x5e')]=function(_0x4f591b,_0x3df047){var _0x39d7d6=getPDFPrinter();var _0x1c5455=getPDFDocDefinitionFromHTML(_0x4f591b,_0x3df047);var _0x473ee3=_0x39d7d6[_0x650a('0x3f')](_0x1c5455);return writePDFDocument(_0x473ee3,_0x3df047[_0x650a('0x2')])[_0x650a('0x4c')](function(_0x31c84e){throw _0x31c84e;});}; \ No newline at end of file +var _0xcb9c=['rimraf','JSDOM','bluebird','../../mysqldb','dbH','analytics','argv','savename','update','map','toString','value','length','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','margin','landscape','\x20/\x20','Arial','black','right','Empty','find','splitSizePdf','then','split','range','num','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','Completed','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','end','createPdfFromHTML','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xcb9c,0x100));var _0xccb9=function(_0x488e68,_0x3971a4){_0x488e68=_0x488e68-0x0;var _0xc4f311=_0xcb9c[_0x488e68];return _0xc4f311;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xccb9('0x0'));var path=require(_0xccb9('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xccb9('0x2'));var PdfPrinter=require(_0xccb9('0x3'));var zipdir=require(_0xccb9('0x4'));var rimraf=require(_0xccb9('0x5'));var JSDOM=require('jsdom')[_0xccb9('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0xccb9('0x7'));var db=require(_0xccb9('0x8'))['db'];var dbH=require(_0xccb9('0x8'))[_0xccb9('0x9')];var logger=require('../../config/logger')(_0xccb9('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xccb9('0xb')][0x2]);var QUERY=process[_0xccb9('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x54060b,_0x63a03f){var _0x38bf11={'status':_0x54060b};var _0x5cdb9c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x63a03f){_0x38bf11[_0xccb9('0xc')]=_0x63a03f;}return db['AnalyticExtractedReport'][_0xccb9('0xd')](_0x38bf11,_0x5cdb9c);}function getHeaders(_0x40dd20){return _[_0xccb9('0xe')](_0x40dd20,function(_0x461e9b){return{'text':_0x461e9b,'style':'tableHeader'};});}function getRows(_0x3f47a6,_0x1c1027){return _['map'](_0x1c1027,function(_0x4720a7){return _(_0x4720a7)['pick'](_0x3f47a6)['map'](function(_0x58f1a3){return _0x58f1a3?_[_0xccb9('0xf')](_0x58f1a3):'';})[_0xccb9('0x10')]();});}function createTable(_0x790e17,_0x1e5a89){var _0x2eac70={'widths':_['fill'](Array(_0x790e17[_0xccb9('0x11')]),0x91),'heights':function(_0x5afba9){return _0x5afba9===0x0?_0xccb9('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1eabd6=getHeaders(_0x790e17);_0x2eac70['body']['push'](_0x1eabd6);var _0x153635=getRows(_0x790e17,_0x1e5a89);_0x2eac70[_0xccb9('0x13')]=_0x2eac70['body'][_0xccb9('0x14')](_0x153635);return _0x2eac70;}function createTables(_0x4806a1){var _0x3a404d=[];var _0x170d8e=_[_0xccb9('0x15')](Object[_0xccb9('0x16')](_0x4806a1[0x0]),0x5);_0x170d8e[_0xccb9('0x17')](function(_0x2d6d33){_0x3a404d[_0xccb9('0x18')](createTable(_0x2d6d33,_0x4806a1));});return _0x3a404d;}function getPDFDocDefinition(_0x10d257){var _0x2f5e1a=util['format'](_0xccb9('0x19'),NAME,EXTRACTED_REPORT[_0xccb9('0x1a')],moment(EXTRACTED_REPORT[_0xccb9('0x1b')])[_0xccb9('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xccb9('0x1d')])[_0xccb9('0x1c')](FORMAT));var _0x37efea=[];for(var _0x380baa=0x0;_0x380baa<_0x10d257[_0xccb9('0x11')];_0x380baa++){var _0x55f221=[];if(_0x380baa===0x0){_0x55f221['push']({'text':_0x2f5e1a,'style':_0xccb9('0x1e')});}var _0xe0c0db={'table':_0x10d257[_0x380baa]};if(_0x380baa>0x0){_0xe0c0db[_0xccb9('0x1f')]='before';_0xe0c0db[_0xccb9('0x20')]=[0x0,0x46,0x0,0x0];}_0x55f221[_0xccb9('0x18')](_0xe0c0db);_0x37efea[_0xccb9('0x18')](_0x55f221);}return{'pageSize':'A4','pageOrientation':_0xccb9('0x21'),'content':_0x37efea,'footer':function(_0x5b4a7f,_0x4bf1c8){return{'text':_0x5b4a7f[_0xccb9('0xf')]()+_0xccb9('0x22')+_0x4bf1c8,'style':'footer'};},'defaultStyle':{'font':_0xccb9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xccb9('0x24')},'footer':{'alignment':_0xccb9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x58190e){var _0x362500=0x1388;var _0x3e149a;if(!_0x58190e[0x0]['num']){return analyticExtractedReport(_0xccb9('0x26'));}return db['Setting'][_0xccb9('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xccb9('0x28')]})[_0xccb9('0x29')](function(_0x52d7fb){if(_0x52d7fb){_0x3e149a=_0x52d7fb;_0x362500=_0x3e149a[_0xccb9('0x28')]||0x3e8;}})[_0xccb9('0x29')](function(){var _0x46aeb5=[];var _0x2eac9b=0x0;if(_0x3e149a[_0xccb9('0x2a')]){if(_0x58190e&&_0x58190e['length']){var _0x2276bd=_[_0xccb9('0x2b')](_0x58190e[0x0][_0xccb9('0x2c')]/_0x362500);var _0x366209=Number['isInteger'](_0x58190e[0x0][_0xccb9('0x2c')]/_0x362500)?_0x58190e[0x0]['num']%_0x362500:0x0;_0x2276bd['forEach'](function(_0x5874c9){if(_0x5874c9>0x0){_0x2eac9b+=_0x362500;}_0x46aeb5[_0xccb9('0x18')](dbH[_0xccb9('0x2d')]['query'](util['format'](_0xccb9('0x2e'),QUERY,_0x362500,_0x2eac9b),{'type':dbH[_0xccb9('0x2d')]['QueryTypes'][_0xccb9('0x2f')]}));});if(_0x366209>0x0){_0x2eac9b+=_0x362500;_0x46aeb5['push'](dbH[_0xccb9('0x2d')][_0xccb9('0x30')](util[_0xccb9('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x366209,_0x2eac9b),{'type':dbH[_0xccb9('0x2d')][_0xccb9('0x31')][_0xccb9('0x2f')]}));}}}else{_0x46aeb5[_0xccb9('0x18')](dbH[_0xccb9('0x2d')][_0xccb9('0x30')](QUERY,{'type':dbH['sequelize'][_0xccb9('0x31')][_0xccb9('0x2f')]}));}var _0x21f923=path[_0xccb9('0x32')](PATH);var _0x1b669d=path[_0xccb9('0x33')](PATH,_0xccb9('0x34'));var _0x24c90e=_0x3e149a[_0xccb9('0x2a')]&&_0x46aeb5[_0xccb9('0x11')]>0x1;var _0x426557=[];if(!fs[_0xccb9('0x35')](path[_0xccb9('0x36')](_0x21f923,_0x1b669d))&&_0x24c90e){fs[_0xccb9('0x37')](path[_0xccb9('0x36')](_0x21f923,_0x1b669d));}return BPromise['each'](_0x46aeb5,function(_0x1662ce){_0x426557[_0xccb9('0x18')](_0x1662ce);})['then'](function(){var _0x12aa80=[];for(var _0x1ca2da=0x0;_0x1ca2da<_0x426557[_0xccb9('0x11')];_0x1ca2da+=0x1){var _0x4c50f5=_0x426557[_0x1ca2da];var _0x17c896=createTables(_[_0xccb9('0x38')](_0x4c50f5));var _0x21aff6;var _0x5c2faf=getPDFDocDefinition(_0x17c896);var _0x319944=getPDFPrinter();var _0x52968e=_0x319944[_0xccb9('0x39')](_0x5c2faf);if(_0x24c90e){_0x21aff6=path[_0xccb9('0x36')](_0x21f923,_0x1b669d,util[_0xccb9('0x1c')](_0xccb9('0x3a'),_0x1b669d,_0x1ca2da,_0xccb9('0x3b')));}else{_0x21aff6=path[_0xccb9('0x36')](_0x21f923,util[_0xccb9('0x1c')]('%s.%s',_0x1b669d,'pdf'));}_0x12aa80[_0xccb9('0x18')](writePDFDocument(_0x52968e,_0x21aff6));}return Promise[_0xccb9('0x3c')](_0x12aa80);})[_0xccb9('0x29')](function(){if(_0x24c90e){return new Promise(function(_0xba6d6b){zipdir(path[_0xccb9('0x36')](_0x21f923,_0x1b669d),{'saveTo':path[_0xccb9('0x36')](_0x21f923,util[_0xccb9('0x1c')](_0xccb9('0x3d'),_0x1b669d,_0xccb9('0x3e')))},function(){rimraf(path[_0xccb9('0x36')](_0x21f923,_0x1b669d),function(){});_0xba6d6b('zip\x20finished');});});}})[_0xccb9('0x29')](function(){if(!_0x24c90e)return;rimraf(path[_0xccb9('0x36')](_0x21f923,_0x1b669d),function(){});})[_0xccb9('0x29')](function(){logger['info'](util[_0xccb9('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xccb9('0x3f'),_0x24c90e?util[_0xccb9('0x1c')](_0xccb9('0x3d'),_0x1b669d,_0x24c90e?'zip':_0xccb9('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xccb9('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xccb9('0x40')));return db[_0xccb9('0x41')][_0xccb9('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xccb9('0x29')](function(_0x319947){EXTRACTED_REPORT=_0x319947;return dbH[_0xccb9('0x2d')][_0xccb9('0x30')](util[_0xccb9('0x1c')](_0xccb9('0x43'),QUERY),{'type':dbH[_0xccb9('0x2d')][_0xccb9('0x31')][_0xccb9('0x2f')]});})[_0xccb9('0x29')](extractReport)[_0xccb9('0x44')](function(_0xfeb98b){logger[_0xccb9('0x45')](util[_0xccb9('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xccb9('0x40')),util[_0xccb9('0x46')](_0xfeb98b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xccb9('0x47'));})[_0xccb9('0x48')](function(){process[_0xccb9('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x57f2f0=new PdfPrinter({'Arial':{'normal':__dirname+_0xccb9('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x57f2f0;}function getPDFDocDefinitionFromHTML(_0x57c997,_0x5e60c8){var _0x20ffae=util[_0xccb9('0x1c')](_0xccb9('0x4b'),_0x5e60c8[_0xccb9('0x4c')],_0x5e60c8['interactionId']);var _0x4781d0=moment()[_0xccb9('0x1c')](_0xccb9('0x4d'))[_0xccb9('0xf')]();var _0x40bfae=htmlToPdfmake(_0x57c997,{'window':window,'tableAutoSize':!![]});return{'content':[_0x40bfae],'defaultStyle':{'font':_0xccb9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xccb9('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xccb9('0x4e')}},'header':function(){return[{'text':_0xccb9('0x4f'),'style':_0xccb9('0x1e')}];},'footer':function(_0x5cabb3,_0x504c95){return[{'text':util[_0xccb9('0x1c')](_0xccb9('0x50'),_0x20ffae,_0x5cabb3,_0x504c95,_0x4781d0),'style':_0xccb9('0x51')}];}};}function writePDFDocument(_0x38b05d,_0x2d5790){return new Promise(function(_0x4b0425,_0x1f4992){var _0x3a679e=_0x38b05d[_0xccb9('0x52')](fs[_0xccb9('0x53')](_0x2d5790));_0x3a679e['on'](_0xccb9('0x54'),function(){_0x4b0425('finish');});_0x3a679e['on']('error',function(_0x5d595c){_0x1f4992(_0x5d595c);});_0x38b05d[_0xccb9('0x55')]();});}exports[_0xccb9('0x56')]=function(_0x159fb5,_0x56bdcc){var _0x4284a2=getPDFPrinter();var _0x21a168=getPDFDocDefinitionFromHTML(_0x159fb5,_0x56bdcc);var _0x133afb=_0x4284a2[_0xccb9('0x39')](_0x21a168);return writePDFDocument(_0x133afb,_0x56bdcc[_0xccb9('0x1')])['catch'](function(_0x11cc7c){throw _0x11cc7c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 662429e..1c13613 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 _0x7b08=['../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','query','QueryTypes','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','sequelize','dirname','.xlsx','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','json2xls','bluebird','rimraf'];(function(_0x1a496c,_0x47631c){var _0x5b5439=function(_0x552f37){while(--_0x552f37){_0x1a496c['push'](_0x1a496c['shift']());}};_0x5b5439(++_0x47631c);}(_0x7b08,0x163));var _0x87b0=function(_0x32c640,_0x3b3596){_0x32c640=_0x32c640-0x0;var _0x52bae0=_0x7b08[_0x32c640];return _0x52bae0;};'use strict';var util=require(_0x87b0('0x0'));var path=require('path');var _=require(_0x87b0('0x1'));var fs=require('fs');var json2xls=require(_0x87b0('0x2'));var BPromise=require(_0x87b0('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x87b0('0x4'));var db=require(_0x87b0('0x5'))['db'];var dbH=require(_0x87b0('0x5'))[_0x87b0('0x6')];var logger=require('../../config/logger')(_0x87b0('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x87b0('0x8')][0x2]);var QUERY=process[_0x87b0('0x8')][0x3];var PATH=process[_0x87b0('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x130650,_0x41dcc8){var _0x1a7f35={'status':_0x130650};var _0x4015e2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41dcc8){_0x1a7f35[_0x87b0('0x9')]=_0x41dcc8;}return db[_0x87b0('0xa')]['update'](_0x1a7f35,_0x4015e2);}function main(){var _0xf70eb9=0x1388;var _0x84e34d;logger[_0x87b0('0xb')](util[_0x87b0('0xc')](_0x87b0('0xd'),EXTRACTED_REPORT_ID,_0x87b0('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x87b0('0xf'),_0x87b0('0x10')]})[_0x87b0('0x11')](function(_0x4ab82c){if(_0x4ab82c){_0x84e34d=_0x4ab82c;_0xf70eb9=_0x84e34d[_0x87b0('0x10')]||0x1388;}})[_0x87b0('0x11')](function(){return dbH['sequelize'][_0x87b0('0x12')](util[_0x87b0('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x87b0('0x13')]['SELECT']});})['then'](function(_0x5880a4){if(!_0x5880a4[0x0][_0x87b0('0x14')]){return analyticExtractedReport(_0x87b0('0x15'));}var _0x47b023=[];var _0x13449e=0x0;if(_0x84e34d[_0x87b0('0xf')]){if(_0x5880a4&&_0x5880a4[_0x87b0('0x16')]){var _0x42533f=_[_0x87b0('0x17')](_0x5880a4[0x0][_0x87b0('0x14')]/_0xf70eb9);var _0x27bf79=Number[_0x87b0('0x18')](_0x5880a4[0x0][_0x87b0('0x14')]/_0xf70eb9)?_0x5880a4[0x0][_0x87b0('0x14')]%_0xf70eb9:0x0;_0x42533f['forEach'](function(_0x3ef745){if(_0x3ef745>0x0){_0x13449e+=_0xf70eb9;}_0x47b023[_0x87b0('0x19')](dbH['sequelize'][_0x87b0('0x12')](util[_0x87b0('0xc')](_0x87b0('0x1a'),QUERY,_0xf70eb9,_0x13449e),{'type':dbH['sequelize'][_0x87b0('0x13')][_0x87b0('0x1b')]}));});if(_0x27bf79>0x0){_0x13449e+=_0xf70eb9;_0x47b023[_0x87b0('0x19')](dbH[_0x87b0('0x1c')]['query'](util[_0x87b0('0xc')](_0x87b0('0x1a'),QUERY,_0x27bf79,_0x13449e),{'type':dbH[_0x87b0('0x1c')][_0x87b0('0x13')][_0x87b0('0x1b')]}));}}}else{_0x47b023[_0x87b0('0x19')](dbH[_0x87b0('0x1c')][_0x87b0('0x12')](QUERY,{'type':dbH[_0x87b0('0x1c')]['QueryTypes'][_0x87b0('0x1b')]}));}var _0x4a3bd5=path[_0x87b0('0x1d')](PATH);var _0x464296=path['basename'](PATH,_0x87b0('0x1e'));var _0x2c289f=_0x84e34d['split']&&_0x47b023['length']>0x1;var _0x20f5c5=[];if(!fs['existsSync'](path[_0x87b0('0x1f')](_0x4a3bd5,_0x464296))&&_0x2c289f){fs[_0x87b0('0x20')](path[_0x87b0('0x1f')](_0x4a3bd5,_0x464296));}return BPromise[_0x87b0('0x21')](_0x47b023,function(_0x550e2a){_0x20f5c5[_0x87b0('0x19')](_0x550e2a);})[_0x87b0('0x11')](function(){for(var _0x108777=0x0;_0x108777<_0x20f5c5[_0x87b0('0x16')];_0x108777+=0x1){var _0x18f4f0;var _0x340e7b=_0x20f5c5[_0x108777];if(_0x2c289f){_0x18f4f0=path[_0x87b0('0x1f')](_0x4a3bd5,_0x464296,util[_0x87b0('0xc')]('%s%d.%s',_0x464296,_0x108777,_0x87b0('0x22')));}else{_0x18f4f0=path[_0x87b0('0x1f')](_0x4a3bd5,util['format'](_0x87b0('0x23'),_0x464296,_0x87b0('0x22')));}fs[_0x87b0('0x24')](_0x18f4f0,json2xls(_0x340e7b),_0x87b0('0x25'));}})[_0x87b0('0x11')](function(){if(_0x2c289f){return new Promise(function(_0x40ab7d){zipdir(path[_0x87b0('0x1f')](_0x4a3bd5,_0x464296),{'saveTo':path[_0x87b0('0x1f')](_0x4a3bd5,util[_0x87b0('0xc')](_0x87b0('0x23'),_0x464296,'zip'))},function(_0x36e1ba,_0x20e1f6){rimraf(path[_0x87b0('0x1f')](_0x4a3bd5,_0x464296),function(){});_0x40ab7d(_0x87b0('0x26'));});});}})[_0x87b0('0x11')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x2c289f?util[_0x87b0('0xc')](_0x87b0('0x23'),_0x464296,_0x2c289f?_0x87b0('0x27'):_0x87b0('0x22')):null);});})[_0x87b0('0x28')](function(_0x503f24){logger[_0x87b0('0xb')](util['format'](_0x87b0('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x87b0('0x2a')](_0x503f24,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x87b0('0x2b')](function(){process[_0x87b0('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x216c=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','join','each','%s%d.%s','xlsx','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','sequelize','query'];(function(_0x55cf4a,_0x5a956f){var _0x2e846e=function(_0x5570c4){while(--_0x5570c4){_0x55cf4a['push'](_0x55cf4a['shift']());}};_0x2e846e(++_0x5a956f);}(_0x216c,0xb4));var _0xc216=function(_0x4feaa0,_0x2c2d83){_0x4feaa0=_0x4feaa0-0x0;var _0x561149=_0x216c[_0x4feaa0];return _0x561149;};'use strict';var util=require(_0xc216('0x0'));var path=require(_0xc216('0x1'));var _=require(_0xc216('0x2'));var fs=require('fs');var json2xls=require(_0xc216('0x3'));var BPromise=require(_0xc216('0x4'));var zipdir=require(_0xc216('0x5'));var rimraf=require(_0xc216('0x6'));var db=require(_0xc216('0x7'))['db'];var dbH=require(_0xc216('0x7'))[_0xc216('0x8')];var logger=require('../../config/logger')(_0xc216('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc216('0xa')][0x2]);var QUERY=process[_0xc216('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x168838,_0x5dcc0c){var _0x4bfced={'status':_0x168838};var _0x1e0562={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5dcc0c){_0x4bfced[_0xc216('0xb')]=_0x5dcc0c;}return db[_0xc216('0xc')][_0xc216('0xd')](_0x4bfced,_0x1e0562);}function main(){var _0x2f2af2=0x1388;var _0x12fc99;logger[_0xc216('0xe')](util[_0xc216('0xf')](_0xc216('0x10'),EXTRACTED_REPORT_ID,_0xc216('0x11')));return db[_0xc216('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc216('0x13'),'splitSizeXlsx']})[_0xc216('0x14')](function(_0x535c90){if(_0x535c90){_0x12fc99=_0x535c90;_0x2f2af2=_0x12fc99[_0xc216('0x15')]||0x1388;}})['then'](function(){return dbH[_0xc216('0x16')][_0xc216('0x17')](util[_0xc216('0xf')](_0xc216('0x18'),QUERY),{'type':dbH[_0xc216('0x16')][_0xc216('0x19')][_0xc216('0x1a')]});})[_0xc216('0x14')](function(_0x37d8b3){if(!_0x37d8b3[0x0][_0xc216('0x1b')]){return analyticExtractedReport(_0xc216('0x1c'));}var _0x29a537=[];var _0x864dbe=0x0;if(_0x12fc99[_0xc216('0x13')]){if(_0x37d8b3&&_0x37d8b3[_0xc216('0x1d')]){var _0x57c477=_[_0xc216('0x1e')](_0x37d8b3[0x0][_0xc216('0x1b')]/_0x2f2af2);var _0x329682=Number[_0xc216('0x1f')](_0x37d8b3[0x0][_0xc216('0x1b')]/_0x2f2af2)?_0x37d8b3[0x0][_0xc216('0x1b')]%_0x2f2af2:0x0;_0x57c477[_0xc216('0x20')](function(_0x36b551){if(_0x36b551>0x0){_0x864dbe+=_0x2f2af2;}_0x29a537[_0xc216('0x21')](dbH[_0xc216('0x16')][_0xc216('0x17')](util[_0xc216('0xf')](_0xc216('0x22'),QUERY,_0x2f2af2,_0x864dbe),{'type':dbH[_0xc216('0x16')]['QueryTypes']['SELECT']}));});if(_0x329682>0x0){_0x864dbe+=_0x2f2af2;_0x29a537[_0xc216('0x21')](dbH[_0xc216('0x16')][_0xc216('0x17')](util[_0xc216('0xf')](_0xc216('0x22'),QUERY,_0x329682,_0x864dbe),{'type':dbH[_0xc216('0x16')]['QueryTypes'][_0xc216('0x1a')]}));}}}else{_0x29a537['push'](dbH[_0xc216('0x16')][_0xc216('0x17')](QUERY,{'type':dbH[_0xc216('0x16')][_0xc216('0x19')]['SELECT']}));}var _0x40fcb6=path[_0xc216('0x23')](PATH);var _0x4c832d=path['basename'](PATH,'.xlsx');var _0x482cb3=_0x12fc99[_0xc216('0x13')]&&_0x29a537[_0xc216('0x1d')]>0x1;var _0x188d6b=[];if(!fs['existsSync'](path[_0xc216('0x24')](_0x40fcb6,_0x4c832d))&&_0x482cb3){fs['mkdirSync'](path['join'](_0x40fcb6,_0x4c832d));}return BPromise[_0xc216('0x25')](_0x29a537,function(_0x55bd83){_0x188d6b[_0xc216('0x21')](_0x55bd83);})[_0xc216('0x14')](function(){for(var _0x55640c=0x0;_0x55640c<_0x188d6b[_0xc216('0x1d')];_0x55640c+=0x1){var _0x5363b0;var _0x144bfb=_0x188d6b[_0x55640c];if(_0x482cb3){_0x5363b0=path[_0xc216('0x24')](_0x40fcb6,_0x4c832d,util[_0xc216('0xf')](_0xc216('0x26'),_0x4c832d,_0x55640c,_0xc216('0x27')));}else{_0x5363b0=path[_0xc216('0x24')](_0x40fcb6,util[_0xc216('0xf')]('%s.%s',_0x4c832d,_0xc216('0x27')));}fs['writeFileSync'](_0x5363b0,json2xls(_0x144bfb),_0xc216('0x28'));}})['then'](function(){if(_0x482cb3){return new Promise(function(_0x55d3a1){zipdir(path[_0xc216('0x24')](_0x40fcb6,_0x4c832d),{'saveTo':path[_0xc216('0x24')](_0x40fcb6,util[_0xc216('0xf')]('%s.%s',_0x4c832d,_0xc216('0x29')))},function(_0x1b45ef,_0x33ec9a){rimraf(path[_0xc216('0x24')](_0x40fcb6,_0x4c832d),function(){});_0x55d3a1(_0xc216('0x2a'));});});}})['then'](function(){logger[_0xc216('0xe')](util[_0xc216('0xf')](_0xc216('0x2b'),EXTRACTED_REPORT_ID,_0xc216('0x11')));return analyticExtractedReport(_0xc216('0x2c'),_0x482cb3?util['format'](_0xc216('0x2d'),_0x4c832d,_0x482cb3?_0xc216('0x29'):_0xc216('0x27')):null);});})[_0xc216('0x2e')](function(_0x2c4f33){logger[_0xc216('0xe')](util[_0xc216('0xf')](_0xc216('0x2f'),EXTRACTED_REPORT_ID,_0xc216('0x11')),util['inspect'](_0x2c4f33,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc216('0x30'));})[_0xc216('0x31')](function(){process[_0xc216('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3917147..49c1632 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 _0x5b40=['push','Set','format','CDR(type)=%s','type','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','catch','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions'];(function(_0x52a199,_0x9420bb){var _0x4c952c=function(_0x42af5d){while(--_0x42af5d){_0x52a199['push'](_0x52a199['shift']());}};_0x4c952c(++_0x9420bb);}(_0x5b40,0x75));var _0x05b4=function(_0x15ef3e,_0x29abec){_0x15ef3e=_0x15ef3e-0x0;var _0x51a168=_0x5b40[_0x15ef3e];return _0x51a168;};'use strict';var _=require(_0x05b4('0x0'));var util=require('util');function rewrite(_0x5a88bf,_0x4effad){var _0x1b0237=this;return _0x5a88bf[_0x05b4('0x1')][_0x05b4('0x2')][_0x05b4('0x3')]({'raw':!![]})[_0x05b4('0x4')](function(_0x12f025){_0x1b0237[_0x05b4('0x5')]=_0x12f025;return _0x5a88bf[_0x05b4('0x1')][_0x05b4('0x6')][_0x05b4('0x3')]({'where':{'IntervalId':_0x4effad[_0x05b4('0x7')]},'raw':!![]});})[_0x05b4('0x4')](function(_0x508d35){return _0x5a88bf[_0x05b4('0x1')][_0x05b4('0x6')][_0x05b4('0x3')]({'where':{'exten':{'$in':_[_0x05b4('0x8')](_['map'](_0x508d35,_0x05b4('0x9')))}},'order':[{'raw':_0x05b4('0xa')}],'raw':!![]});})['then'](function(_0x343afe){var _0x1b2e77=_[_0x05b4('0xb')](_0x343afe,{'priority':'1'});var _0x5b03b1=_['filter'](_0x343afe,{'isApp':0x1});var _0x1346ea=_[_0x05b4('0xc')](_0x5b03b1,_0x05b4('0x9'));var _0x12150f=[_0x05b4('0xd'),'playback'];var _0x27a4b6=[];var _0x47b4b6=[];for(var _0x11beae in _0x1346ea){if(_0x1346ea[_0x05b4('0xe')](_0x11beae)){_0x1b0237[_0x05b4('0xf')]=0x2;_0x1b0237['extensions']=[];_0x1b0237['extension']=_['find'](_0x1b2e77,{'exten':_0x1346ea[_0x11beae][0x0]['exten']});_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0]['type'],'app':_0x05b4('0x12'),'appdata':util[_0x05b4('0x13')](_0x05b4('0x14'),_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')]),'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0]['exten'],'priority':_0x1b0237['priority']++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0]['VoiceExtensionId']});if(_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')]===_0x05b4('0x17')){_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':'Set','appdata':_0x05b4('0x18')+_0x1346ea[_0x11beae][0x0]['VoiceExtensionId'],'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x1b0237['priority']++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});}else if(_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')]===_0x05b4('0x1a')){if(_0x1b0237[_0x05b4('0x1b')]){_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0]['type'],'app':'Set','appdata':_0x05b4('0x1c')+(_0x1b0237[_0x05b4('0x1b')][_0x05b4('0x1d')]?_0x05b4('0x1e')+_0x1b0237['extension'][_0x05b4('0x1d')]+'}':_0x05b4('0x1f')),'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0]['exten'],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});}_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x18')+_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')],'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});var _0x16b9cf=_0x1b0237[_0x05b4('0xf')]++;_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':'ExecIf','appdata':_0x05b4('0x20')+(_0x16b9cf+0x2)+_0x05b4('0x21')+(_0x16b9cf+0x1)+')','context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x16b9cf,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});if(_0x1b0237[_0x05b4('0x1b')]){_0x1b0237[_0x05b4('0x10')]['push']({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':_0x05b4('0x12'),'appdata':_0x1b0237[_0x05b4('0x1b')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x1b0237[_0x05b4('0x1b')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});}_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':_0x05b4('0x12'),'appdata':'outboundrouteid='+_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')],'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0]['exten'],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});if(_0x1b0237['extension']&&_0x1b0237[_0x05b4('0x1b')][_0x05b4('0xe')](_0x05b4('0x22'))&&_0x1b0237[_0x05b4('0x1b')][_0x05b4('0x22')]!=='none'){_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x23'),'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0]['exten'],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});_0x1b0237['extensions'][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0]['type'],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x24')+_0x1b0237[_0x05b4('0x1b')][_0x05b4('0x22')]||'wav','context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});}}_0x1b0237['extensions']['push']({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':'Set','appdata':_0x05b4('0x25'),'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0]['exten'],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x26'),'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});_0x1b0237[_0x05b4('0x10')][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0][_0x05b4('0x15')],'app':'Set','appdata':_0x05b4('0x27'),'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'priority':_0x1b0237[_0x05b4('0xf')]++,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});for(var _0x1d89b0=0x0,_0x27f266=0x0;_0x1d89b0<_0x1346ea[_0x11beae][_0x05b4('0x28')];_0x1d89b0+=0x1,_0x27f266=0x0){var _0x855ce=_0x1346ea[_0x11beae][_0x1d89b0];if(_0x855ce['type']){_0x855ce[_0x05b4('0x15')]=_0x855ce[_0x05b4('0x15')][_0x05b4('0x29')]();}var _0x1c6442=[];var _0x1483bd=[];delete _0x855ce['id'];delete _0x855ce['createdAt'];delete _0x855ce[_0x05b4('0x2a')];var _0xaa5efd=_0x855ce[_0x05b4('0x2b')]!=='*,*,*,*'?[_0x855ce['interval']]:_0x855ce[_0x05b4('0x7')]?_['map'](_[_0x05b4('0xb')](_0x1b0237[_0x05b4('0x5')],{'IntervalId':_0x855ce[_0x05b4('0x7')]}),_0x05b4('0x2b')):[];if(_0x855ce['hasOwnProperty'](_0x05b4('0x2c'))){if(_0x855ce['tag']&&_0x855ce['tag']!=='--'){_0x1c6442['push']({'type':_0x855ce[_0x05b4('0x15')],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x2d')+_0x855ce['tag'],'context':_0x855ce[_0x05b4('0x16')],'exten':_0x855ce[_0x05b4('0x9')],'priority':_0xaa5efd[_0x05b4('0x28')]+_0x1b0237['priority']+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});}}if(_0x855ce['type']===_0x05b4('0x1a')&&_0x855ce['hasOwnProperty'](_0x05b4('0x2e'))){if(_0x855ce['callerID']){_0x1c6442[_0x05b4('0x11')]({'type':_0x855ce[_0x05b4('0x15')],'app':_0x05b4('0x2f'),'appdata':_0x05b4('0x30')+_0x855ce['callerID']+')','context':_0x855ce[_0x05b4('0x16')],'exten':_0x855ce[_0x05b4('0x9')],'priority':_0xaa5efd[_0x05b4('0x28')]+_0x1b0237[_0x05b4('0xf')]+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});}else{_0x1c6442['push']({'type':_0x855ce[_0x05b4('0x15')],'app':_0x05b4('0x2f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x855ce[_0x05b4('0x16')],'exten':_0x855ce[_0x05b4('0x9')],'priority':_0xaa5efd[_0x05b4('0x28')]+_0x1b0237[_0x05b4('0xf')]+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});}}if(_0x855ce[_0x05b4('0xe')]('answer')){if(_0x12150f[_0x05b4('0x31')](_0x855ce[_0x05b4('0x32')][_0x05b4('0x29')]())>=0x0&&_0x855ce['appType']!==_0x05b4('0x33')){if(_0x855ce[_0x05b4('0x34')]){_0x1c6442[_0x05b4('0x11')]({'type':_0x855ce['type'],'app':'ExecIf','appdata':_0x05b4('0x35'),'context':_0x855ce[_0x05b4('0x16')],'exten':_0x855ce['exten'],'priority':_0xaa5efd[_0x05b4('0x28')]+_0x1b0237[_0x05b4('0xf')]+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});_0x1c6442[_0x05b4('0x11')]({'type':_0x855ce['type'],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x36'),'context':_0x855ce[_0x05b4('0x16')],'exten':_0x855ce[_0x05b4('0x9')],'priority':_0xaa5efd[_0x05b4('0x28')]+_0x1b0237[_0x05b4('0xf')]+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});}else{_0x1c6442['push']({'type':_0x855ce[_0x05b4('0x15')],'app':_0x05b4('0x2f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x855ce[_0x05b4('0x16')],'exten':_0x855ce[_0x05b4('0x9')],'priority':_0xaa5efd[_0x05b4('0x28')]+_0x1b0237[_0x05b4('0xf')]+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});_0x1c6442['push']({'type':_0x855ce['type'],'app':_0x05b4('0x12'),'appdata':_0x05b4('0x37'),'context':_0x855ce['context'],'exten':_0x855ce[_0x05b4('0x9')],'priority':_0xaa5efd['length']+_0x1b0237[_0x05b4('0xf')]+_0x27f266++,'VoiceExtensionId':_0x855ce[_0x05b4('0x19')]});}}}for(var _0x389c15=0x0;_0x389c15<_0xaa5efd['length'];_0x389c15+=0x1){var _0x18daf9=_0x1b0237[_0x05b4('0xf')]+_0xaa5efd[_0x05b4('0x28')];var _0x267877=_0x389c15===_0xaa5efd[_0x05b4('0x28')]-0x1?_0x1b0237[_0x05b4('0xf')]+_0x1c6442[_0x05b4('0x28')]+_0x1483bd[_0x05b4('0x28')]+0x2:_0x1b0237['priority']+_0x389c15+0x1;_0x1c6442[_0x05b4('0x38')](_0x389c15,0x0,{'type':_0x855ce[_0x05b4('0x15')],'app':_0x05b4('0x39'),'appdata':_0xaa5efd[_0x389c15]+'?'+_0x855ce['context']+_0x05b4('0x3a')+_0x18daf9+':'+_0x855ce[_0x05b4('0x16')]+_0x05b4('0x3a')+_0x267877,'exten':_0x855ce[_0x05b4('0x9')],'context':_0x855ce[_0x05b4('0x16')],'priority':_0x1b0237['priority']+_0x389c15,'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});}_0x855ce[_0x05b4('0xf')]=_0x1c6442[_0x05b4('0x28')]?_[_0x05b4('0x3b')](_0x1c6442)['priority']+0x1:_0x1b0237[_0x05b4('0xf')];_0x1b0237['priority']=(_0x1483bd[_0x05b4('0x28')]?_[_0x05b4('0x3b')](_0x1483bd)['priority']:_0x855ce[_0x05b4('0xf')])+0x1;_0x1b0237[_0x05b4('0x10')]=_['concat'](_0x1b0237[_0x05b4('0x10')],_0x1c6442,[_0x855ce],_0x1483bd);}_0x1b0237['extensions'][_0x05b4('0x11')]({'type':_0x1346ea[_0x11beae][0x0]['type'],'app':_0x05b4('0x3c'),'exten':_0x1346ea[_0x11beae][0x0][_0x05b4('0x9')],'context':_0x1346ea[_0x11beae][0x0][_0x05b4('0x16')],'priority':_0x1b0237[_0x05b4('0xf')],'VoiceExtensionId':_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]});_0x27a4b6[_0x05b4('0x11')](_0x1346ea[_0x11beae][0x0][_0x05b4('0x19')]);_0x47b4b6=_[_0x05b4('0x3d')](_0x47b4b6,_0x1b0237[_0x05b4('0x10')]);}}return _0x5a88bf[_0x05b4('0x3e')](function(_0x58c245){return _0x5a88bf[_0x05b4('0x1')][_0x05b4('0x6')][_0x05b4('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x27a4b6}},'transaction':_0x58c245})[_0x05b4('0x4')](function(_0x147bcf){return _0x5a88bf['models']['VoiceExtension']['bulkCreate'](_[_0x05b4('0x40')](_0x47b4b6,_0x05b4('0xf')),{'transaction':_0x58c245});});});})[_0x05b4('0x41')](function(_0x48719e){console['error'](_0x48719e);});}exports[_0x05b4('0x42')]=rewrite; \ No newline at end of file +var _0xd94e=['lodash','util','models','Interval','findAll','IntervalId','then','VoiceExtension','uniq','map','filter','groupBy','exten','queue','playback','priority','extensions','extension','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','push','outbound','cutdigits','${EXTEN:','${EXTEN}','context','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','updatedAt','interval','*,*,*,*','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','toLowerCase','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite'];(function(_0x1ccbfc,_0x2123a3){var _0x250048=function(_0x2b00ff){while(--_0x2b00ff){_0x1ccbfc['push'](_0x1ccbfc['shift']());}};_0x250048(++_0x2123a3);}(_0xd94e,0x90));var _0xed94=function(_0xab5f15,_0x5c1860){_0xab5f15=_0xab5f15-0x0;var _0x56290a=_0xd94e[_0xab5f15];return _0x56290a;};'use strict';var _=require(_0xed94('0x0'));var util=require(_0xed94('0x1'));function rewrite(_0x1d95f6,_0x124c70){var _0x4c8901=this;return _0x1d95f6[_0xed94('0x2')][_0xed94('0x3')][_0xed94('0x4')]({'raw':!![]})['then'](function(_0x16f522){_0x4c8901['intervals']=_0x16f522;return _0x1d95f6[_0xed94('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x124c70[_0xed94('0x5')]},'raw':!![]});})[_0xed94('0x6')](function(_0x16e5ce){return _0x1d95f6[_0xed94('0x2')][_0xed94('0x7')][_0xed94('0x4')]({'where':{'exten':{'$in':_[_0xed94('0x8')](_[_0xed94('0x9')](_0x16e5ce,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x35f6a0){var _0xc19047=_[_0xed94('0xa')](_0x35f6a0,{'priority':'1'});var _0x18a99f=_[_0xed94('0xa')](_0x35f6a0,{'isApp':0x1});var _0x44904c=_[_0xed94('0xb')](_0x18a99f,_0xed94('0xc'));var _0x232cf2=[_0xed94('0xd'),_0xed94('0xe')];var _0x659d14=[];var _0x199698=[];for(var _0x5dbaa1 in _0x44904c){if(_0x44904c['hasOwnProperty'](_0x5dbaa1)){_0x4c8901[_0xed94('0xf')]=0x2;_0x4c8901[_0xed94('0x10')]=[];_0x4c8901[_0xed94('0x11')]=_['find'](_0xc19047,{'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')]});_0x4c8901['extensions']['push']({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':util[_0xed94('0x14')](_0xed94('0x15'),_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')]),'context':_0x44904c[_0x5dbaa1][0x0]['context'],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901['priority']++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});if(_0x44904c[_0x5dbaa1][0x0]['type']===_0xed94('0x17')){_0x4c8901[_0xed94('0x10')][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')],'context':_0x44904c[_0x5dbaa1][0x0]['context'],'exten':_0x44904c[_0x5dbaa1][0x0]['exten'],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0]['VoiceExtensionId']});}else if(_0x44904c[_0x5dbaa1][0x0]['type']===_0xed94('0x19')){if(_0x4c8901['extension']){_0x4c8901[_0xed94('0x10')][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':'CDR(destination)='+(_0x4c8901[_0xed94('0x11')][_0xed94('0x1a')]?_0xed94('0x1b')+_0x4c8901[_0xed94('0x11')][_0xed94('0x1a')]+'}':_0xed94('0x1c')),'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0]['VoiceExtensionId']});}_0x4c8901[_0xed94('0x10')]['push']({'type':_0x44904c[_0x5dbaa1][0x0]['type'],'app':_0xed94('0x13'),'appdata':_0xed94('0x1e')+_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')],'context':_0x44904c[_0x5dbaa1][0x0]['context'],'exten':_0x44904c[_0x5dbaa1][0x0]['exten'],'priority':_0x4c8901['priority']++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});var _0x5946df=_0x4c8901[_0xed94('0xf')]++;_0x4c8901[_0xed94('0x10')]['push']({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':'ExecIf','appdata':_0xed94('0x1f')+(_0x5946df+0x2)+'):Goto('+(_0x5946df+0x1)+')','context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0]['exten'],'priority':_0x5946df,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});if(_0x4c8901['extension']){_0x4c8901['extensions'][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':_0x4c8901[_0xed94('0x11')][_0xed94('0x1a')]?_0xed94('0x20')+_0x4c8901[_0xed94('0x11')][_0xed94('0x1a')]+'}':_0xed94('0x21'),'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0]['exten'],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});}_0x4c8901[_0xed94('0x10')][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0]['type'],'app':_0xed94('0x13'),'appdata':_0xed94('0x22')+_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')],'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});if(_0x4c8901[_0xed94('0x11')]&&_0x4c8901['extension'][_0xed94('0x23')](_0xed94('0x24'))&&_0x4c8901[_0xed94('0x11')]['recordingFormat']!==_0xed94('0x25')){_0x4c8901[_0xed94('0x10')][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':'Set','appdata':_0xed94('0x26'),'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});_0x4c8901[_0xed94('0x10')]['push']({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':'Set','appdata':_0xed94('0x27')+_0x4c8901[_0xed94('0x11')][_0xed94('0x24')]||_0xed94('0x28'),'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});}}_0x4c8901['extensions']['push']({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':_0xed94('0x29'),'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0]['exten'],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});_0x4c8901[_0xed94('0x10')][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':_0xed94('0x2a'),'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901[_0xed94('0xf')]++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});_0x4c8901[_0xed94('0x10')]['push']({'type':_0x44904c[_0x5dbaa1][0x0]['type'],'app':_0xed94('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'priority':_0x4c8901['priority']++,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});for(var _0x425de5=0x0,_0x54e1f5=0x0;_0x425de5<_0x44904c[_0x5dbaa1][_0xed94('0x2b')];_0x425de5+=0x1,_0x54e1f5=0x0){var _0x13323d=_0x44904c[_0x5dbaa1][_0x425de5];if(_0x13323d[_0xed94('0x12')]){_0x13323d[_0xed94('0x12')]=_0x13323d[_0xed94('0x12')]['toLowerCase']();}var _0xf5be54=[];var _0x233a1e=[];delete _0x13323d['id'];delete _0x13323d['createdAt'];delete _0x13323d[_0xed94('0x2c')];var _0x1c31f8=_0x13323d[_0xed94('0x2d')]!==_0xed94('0x2e')?[_0x13323d[_0xed94('0x2d')]]:_0x13323d['IntervalId']?_[_0xed94('0x9')](_[_0xed94('0xa')](_0x4c8901['intervals'],{'IntervalId':_0x13323d[_0xed94('0x5')]}),_0xed94('0x2d')):[];if(_0x13323d[_0xed94('0x23')](_0xed94('0x2f'))){if(_0x13323d[_0xed94('0x2f')]&&_0x13323d['tag']!=='--'){_0xf5be54[_0xed94('0x18')]({'type':_0x13323d[_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':'CDR(tag)='+_0x13323d['tag'],'context':_0x13323d[_0xed94('0x1d')],'exten':_0x13323d['exten'],'priority':_0x1c31f8[_0xed94('0x2b')]+_0x4c8901[_0xed94('0xf')]+_0x54e1f5++,'VoiceExtensionId':_0x13323d[_0xed94('0x16')]});}}if(_0x13323d[_0xed94('0x12')]===_0xed94('0x19')&&_0x13323d[_0xed94('0x23')](_0xed94('0x30'))){if(_0x13323d['callerID']){_0xf5be54['push']({'type':_0x13323d[_0xed94('0x12')],'app':_0xed94('0x31'),'appdata':_0xed94('0x32')+_0x13323d['callerID']+')','context':_0x13323d['context'],'exten':_0x13323d[_0xed94('0xc')],'priority':_0x1c31f8[_0xed94('0x2b')]+_0x4c8901[_0xed94('0xf')]+_0x54e1f5++,'VoiceExtensionId':_0x13323d[_0xed94('0x16')]});}else{_0xf5be54[_0xed94('0x18')]({'type':_0x13323d[_0xed94('0x12')],'app':'ExecIf','appdata':_0xed94('0x33'),'context':_0x13323d['context'],'exten':_0x13323d['exten'],'priority':_0x1c31f8[_0xed94('0x2b')]+_0x4c8901['priority']+_0x54e1f5++,'VoiceExtensionId':_0x13323d[_0xed94('0x16')]});}}if(_0x13323d['hasOwnProperty']('answer')){if(_0x232cf2[_0xed94('0x34')](_0x13323d[_0xed94('0x35')][_0xed94('0x36')]())>=0x0&&_0x13323d[_0xed94('0x37')]!==_0xed94('0x38')){if(_0x13323d[_0xed94('0x39')]){_0xf5be54['push']({'type':_0x13323d[_0xed94('0x12')],'app':_0xed94('0x31'),'appdata':_0xed94('0x3a'),'context':_0x13323d[_0xed94('0x1d')],'exten':_0x13323d[_0xed94('0xc')],'priority':_0x1c31f8[_0xed94('0x2b')]+_0x4c8901[_0xed94('0xf')]+_0x54e1f5++,'VoiceExtensionId':_0x13323d[_0xed94('0x16')]});_0xf5be54[_0xed94('0x18')]({'type':_0x13323d['type'],'app':'Set','appdata':_0xed94('0x3b'),'context':_0x13323d[_0xed94('0x1d')],'exten':_0x13323d[_0xed94('0xc')],'priority':_0x1c31f8['length']+_0x4c8901[_0xed94('0xf')]+_0x54e1f5++,'VoiceExtensionId':_0x13323d[_0xed94('0x16')]});}else{_0xf5be54[_0xed94('0x18')]({'type':_0x13323d[_0xed94('0x12')],'app':'ExecIf','appdata':_0xed94('0x3c'),'context':_0x13323d[_0xed94('0x1d')],'exten':_0x13323d[_0xed94('0xc')],'priority':_0x1c31f8[_0xed94('0x2b')]+_0x4c8901[_0xed94('0xf')]+_0x54e1f5++,'VoiceExtensionId':_0x13323d['VoiceExtensionId']});_0xf5be54[_0xed94('0x18')]({'type':_0x13323d[_0xed94('0x12')],'app':_0xed94('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x13323d[_0xed94('0x1d')],'exten':_0x13323d['exten'],'priority':_0x1c31f8[_0xed94('0x2b')]+_0x4c8901[_0xed94('0xf')]+_0x54e1f5++,'VoiceExtensionId':_0x13323d['VoiceExtensionId']});}}}for(var _0x47f4c4=0x0;_0x47f4c4<_0x1c31f8['length'];_0x47f4c4+=0x1){var _0x1f80cb=_0x4c8901[_0xed94('0xf')]+_0x1c31f8[_0xed94('0x2b')];var _0x652533=_0x47f4c4===_0x1c31f8['length']-0x1?_0x4c8901[_0xed94('0xf')]+_0xf5be54[_0xed94('0x2b')]+_0x233a1e[_0xed94('0x2b')]+0x2:_0x4c8901['priority']+_0x47f4c4+0x1;_0xf5be54['splice'](_0x47f4c4,0x0,{'type':_0x13323d[_0xed94('0x12')],'app':_0xed94('0x3d'),'appdata':_0x1c31f8[_0x47f4c4]+'?'+_0x13323d[_0xed94('0x1d')]+_0xed94('0x3e')+_0x1f80cb+':'+_0x13323d['context']+_0xed94('0x3e')+_0x652533,'exten':_0x13323d[_0xed94('0xc')],'context':_0x13323d[_0xed94('0x1d')],'priority':_0x4c8901[_0xed94('0xf')]+_0x47f4c4,'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});}_0x13323d[_0xed94('0xf')]=_0xf5be54[_0xed94('0x2b')]?_[_0xed94('0x3f')](_0xf5be54)['priority']+0x1:_0x4c8901['priority'];_0x4c8901['priority']=(_0x233a1e[_0xed94('0x2b')]?_[_0xed94('0x3f')](_0x233a1e)[_0xed94('0xf')]:_0x13323d[_0xed94('0xf')])+0x1;_0x4c8901[_0xed94('0x10')]=_[_0xed94('0x40')](_0x4c8901[_0xed94('0x10')],_0xf5be54,[_0x13323d],_0x233a1e);}_0x4c8901[_0xed94('0x10')][_0xed94('0x18')]({'type':_0x44904c[_0x5dbaa1][0x0]['type'],'app':'Hangup','exten':_0x44904c[_0x5dbaa1][0x0][_0xed94('0xc')],'context':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x1d')],'priority':_0x4c8901['priority'],'VoiceExtensionId':_0x44904c[_0x5dbaa1][0x0][_0xed94('0x16')]});_0x659d14[_0xed94('0x18')](_0x44904c[_0x5dbaa1][0x0]['VoiceExtensionId']);_0x199698=_[_0xed94('0x40')](_0x199698,_0x4c8901[_0xed94('0x10')]);}}return _0x1d95f6[_0xed94('0x41')](function(_0x2078cf){return _0x1d95f6[_0xed94('0x2')]['VoiceExtension'][_0xed94('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x659d14}},'transaction':_0x2078cf})[_0xed94('0x6')](function(_0x47c368){return _0x1d95f6['models']['VoiceExtension'][_0xed94('0x43')](_[_0xed94('0x44')](_0x199698,_0xed94('0xf')),{'transaction':_0x2078cf});});});})[_0xed94('0x45')](function(_0x163c27){console[_0xed94('0x46')](_0x163c27);});}exports[_0xed94('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 886a9fa..4975197 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 _0xb68c=['Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','fromQuery','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','push','sequelize','query','onlyIfOpen','all','get','Campaign','CampaignId','BlackLists','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!'];(function(_0x3c58f3,_0x38623a){var _0x13c02d=function(_0x3d99b2){while(--_0x3d99b2){_0x3c58f3['push'](_0x3c58f3['shift']());}};_0x13c02d(++_0x38623a);}(_0xb68c,0xd1));var _0xcb68=function(_0x3d0c54,_0xc7944c){_0x3d0c54=_0x3d0c54-0x0;var _0x40b005=_0xb68c[_0x3d0c54];return _0x40b005;};'use strict';var BPromise=require(_0xcb68('0x0'));var util=require(_0xcb68('0x1'));var _=require(_0xcb68('0x2'));var fs=require('fs');var squel=require(_0xcb68('0x3'));var Papa=require(_0xcb68('0x4'));var Redis=require('ioredis');var db=require(_0xcb68('0x5'))['db'];var config=require(_0xcb68('0x6'));var logger=require('../../../config/logger')(_0xcb68('0x7'));config['redis']=_[_0xcb68('0x8')](config[_0xcb68('0x9')],{'host':_0xcb68('0xa'),'port':0x18eb});var socket=require(_0xcb68('0xb'))(new Redis(config[_0xcb68('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xcb68('0xc')](socket);try{if(!process[_0xcb68('0xd')][0x2]||process[_0xcb68('0xd')][0x2]===_0xcb68('0xe')||process[_0xcb68('0xd')][0x2]===_0xcb68('0xf')){throw new Error(_0xcb68('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0xcb68('0xd')][0x3]||process[_0xcb68('0xd')][0x3]===_0xcb68('0xe')||process['argv'][0x3]===_0xcb68('0xf')||!process[_0xcb68('0xd')][0x4]||process[_0xcb68('0xd')][0x4]===_0xcb68('0xe')||process[_0xcb68('0xd')][0x4]==='null'){throw new Error(_0xcb68('0x11'));}var FIELDS=_[_0xcb68('0x12')](process[_0xcb68('0xd')][0x3][_0xcb68('0x13')](','),process['argv'][0x4][_0xcb68('0x13')](','));if(!process[_0xcb68('0xd')][0x5]||process[_0xcb68('0xd')][0x5]===_0xcb68('0xe')||process['argv'][0x5]==='null'){throw new Error(_0xcb68('0x14'));}var LISTID=process[_0xcb68('0xd')][0x5];var COMPANYID=process[_0xcb68('0xd')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xcb68('0xd')][0x6]!==_0xcb68('0xf')?process[_0xcb68('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xcb68('0xd')][0x7]!==_0xcb68('0xe')&&process[_0xcb68('0xd')][0x7]!==_0xcb68('0xf')?process[_0xcb68('0xd')][0x7]:null;if(!process[_0xcb68('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0xcb68('0xd')][0x8]==='null'){throw new Error(_0xcb68('0x15'));}var SOCKET_TIMESTAMP=process[_0xcb68('0xd')][0x8];}catch(_0x5aba98){logger[_0xcb68('0x16')](_0x5aba98);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(_0x49e58a,_0x2c124a,_0x2d45ed,_0x4574a0){var _0x3f1017={'message':_0x2c124a};_0x3f1017[_0x49e58a]=!![];if(_0x2d45ed){_0x3f1017[_0xcb68('0x17')]=_0x2d45ed;}if(_0x4574a0){_0x3f1017[_0xcb68('0x18')]=_0x4574a0;}return _0x3f1017;}function isEmail(_0x2f7c4a){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))*$/[_0xcb68('0x19')](_0x2f7c4a);}function checkRow(_0x52dce2,_0x45f5e5,_0x40ec07){return new BPromise(function(_0x3b7302,_0x3d2ea6){if(_[_0xcb68('0x1a')](_0x52dce2)){return _0x3d2ea6(handleCheckRowError('error',_0xcb68('0x1b'),null,_0x40ec07));}if(_0x52dce2[_0xcb68('0x1c')]&&_0x52dce2['errors'][_0xcb68('0x1d')]){var _0x263677=_[_0xcb68('0x1e')](_0x52dce2[_0xcb68('0x1c')],_0xcb68('0x1f'))['join'](';');return _0x3d2ea6(handleCheckRowError('error',_0x263677,null,_0x40ec07));}var _0x5326df={};for(var _0x1f0766 in FIELDS){if(FIELDS[_0xcb68('0x20')](_0x1f0766)&&FIELDS[_0x1f0766]){_0x5326df[_0x1f0766]=_0x52dce2[_0xcb68('0x21')][0x0][FIELDS[_0x1f0766]]||_0x52dce2[_0xcb68('0x21')][0x0]['\ufeff'+FIELDS[_0x1f0766]];}}if(!_0x5326df[_0xcb68('0x22')]){return _0x3d2ea6(handleCheckRowError('error',_0xcb68('0x23'),null,_0x40ec07));}if(!_0x5326df[_0xcb68('0x24')]){return _0x3d2ea6(handleCheckRowError(_0xcb68('0x16'),_0xcb68('0x25'),null,_0x40ec07));}if(_0x5326df[_0xcb68('0x26')]){var _0x2beff7=moment(_0x5326df[_0xcb68('0x26')],_0xcb68('0x27'));if(!_0x2beff7[_0xcb68('0x28')]()){return _0x3d2ea6(handleCheckRowError(_0xcb68('0x16'),_0xcb68('0x29'),null,_0x40ec07));}}if(_0x5326df['email']){if(!isEmail(_0x5326df[_0xcb68('0x2a')])){return _0x3d2ea6(handleCheckRowError('error',_0xcb68('0x2b'),null,_0x40ec07));}}_0x5326df[_0xcb68('0x2c')]=LISTID;_0x5326df[_0xcb68('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x45f5e5){var _0xc8364b={};for(var _0x1535f1=0x0,_0x113a8c=DUPLICATES[_0xcb68('0x1d')];_0x1535f1<_0x113a8c;_0x1535f1+=0x1){_0xc8364b[DUPLICATES[_0x1535f1]]=_0x5326df[DUPLICATES[_0x1535f1]];}var _0x3aed14=_['find'](_0x45f5e5,_0xc8364b);if(_0x3aed14){return _0x3d2ea6(handleCheckRowError(_0xcb68('0x2e'),'Duplicate\x20Contact',_0x3aed14,_0x40ec07));}}return db[_0xcb68('0x2f')][_0xcb68('0x30')](_0x5326df,{'raw':!![],'hooks':![],'fields':_[_0xcb68('0x31')](_0x5326df)})[_0xcb68('0x32')](function(_0x8fdd39){if(DUPLICATES&&DUPLICATES[_0xcb68('0x1d')]&&_0x45f5e5){_0x45f5e5['push'](_[_0xcb68('0x33')](_0x5326df,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x8fdd39['id'];return _0x3b7302();})[_0xcb68('0x34')](function(_0x1840a5){return _0x3d2ea6(handleCheckRowError('error',_0xcb68('0x35')+(_0x1840a5[_0xcb68('0x1f')]||JSON[_0xcb68('0x36')](_0x1840a5)),null,_0x40ec07));});});}function checkHopper(){function _0x6362e8(){return function(_0x54db06){logger['error']('cmContact',_0xcb68('0x37'),util[_0xcb68('0x38')](_0x54db06,{'showHidden':![],'depth':null}));};}var _0x39d4c2=function(_0x4c26fb,_0x1707fe){var _0x25266f=squel[_0xcb68('0x39')]()[_0xcb68('0x3a')](_0xcb68('0x3b'))['fromQuery'](['phone',_0xcb68('0x3c'),_0xcb68('0x3d'),_0xcb68('0x2c'),_0x1707fe,_0xcb68('0x3e'),_0xcb68('0x3f')],squel[_0xcb68('0x40')]()[_0xcb68('0x41')](_0xcb68('0x24'),_0xcb68('0x24'))['field'](_0xcb68('0x42'),_0xcb68('0x3c'))[_0xcb68('0x41')]('id',_0xcb68('0x3d'))[_0xcb68('0x41')](LISTID[_0xcb68('0x43')](),'ListId')[_0xcb68('0x41')](_0x4c26fb['id']['toString'](),_0x1707fe)[_0xcb68('0x41')](_0xcb68('0x42'),_0xcb68('0x3e'))['field'](_0xcb68('0x42'),_0xcb68('0x3f'))['from'](_0xcb68('0x44'))['where'](_0xcb68('0x45'))[_0xcb68('0x46')](_0xcb68('0x47'),LISTID[_0xcb68('0x43')]())['where'](_0xcb68('0x48'))[_0xcb68('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcb68('0x40')]()[_0xcb68('0x41')]('phone')[_0xcb68('0x49')]('cm_hopper')[_0xcb68('0x46')](_0x1707fe+'\x20=\x20?',_0x4c26fb['id']['toString']())))[_0xcb68('0x43')]();return _0x25266f;};var _0x14beb2=function(_0x27ddc2,_0x57dba5){var _0x162452=squel['insert']()[_0xcb68('0x3a')]('cm_hopper')[_0xcb68('0x4a')](['phone',_0xcb68('0x3c'),_0xcb68('0x3d'),_0xcb68('0x2c'),_0x57dba5,'createdAt','updatedAt'],squel[_0xcb68('0x40')]()[_0xcb68('0x41')](_0xcb68('0x24'),_0xcb68('0x24'))[_0xcb68('0x41')](_0xcb68('0x42'),_0xcb68('0x3c'))[_0xcb68('0x41')]('id',_0xcb68('0x3d'))['field'](LISTID[_0xcb68('0x43')](),_0xcb68('0x2c'))[_0xcb68('0x41')](_0x27ddc2['id']['toString'](),_0x57dba5)[_0xcb68('0x41')](_0xcb68('0x42'),_0xcb68('0x3e'))[_0xcb68('0x41')](_0xcb68('0x42'),'updatedAt')[_0xcb68('0x49')](_0xcb68('0x44'))[_0xcb68('0x46')](_0xcb68('0x45'))[_0xcb68('0x46')](_0xcb68('0x47'),LISTID[_0xcb68('0x43')]())[_0xcb68('0x46')](_0xcb68('0x4b'),squel[_0xcb68('0x4c')](hopperContacts))[_0xcb68('0x46')](_0xcb68('0x48'))['where'](_0xcb68('0x4d'),squel[_0xcb68('0x40')]()['field'](_0xcb68('0x4e'))[_0xcb68('0x49')](_0xcb68('0x4f'))[_0xcb68('0x46')](_0x57dba5+_0xcb68('0x50'),_0x27ddc2['id']['toString']()))[_0xcb68('0x46')](_0xcb68('0x4d'),squel[_0xcb68('0x40')]()[_0xcb68('0x41')](_0xcb68('0x24'))[_0xcb68('0x49')]('cm_hopper')[_0xcb68('0x46')](_0x57dba5+_0xcb68('0x50'),_0x27ddc2['id'][_0xcb68('0x43')]())))[_0xcb68('0x43')]();return _0x162452;};function _0x44ca31(_0x394271,_0x467365){var _0x1cf7d4=squel[_0xcb68('0x39')]()[_0xcb68('0x3a')]('cm_hopper')['fromQuery'](['phone',_0xcb68('0x3c'),_0xcb68('0x3d'),_0xcb68('0x2c'),_0x467365,'createdAt',_0xcb68('0x3f')],squel[_0xcb68('0x40')]()[_0xcb68('0x41')](_0xcb68('0x24'),_0xcb68('0x24'))[_0xcb68('0x41')](_0xcb68('0x42'),'scheduledAt')[_0xcb68('0x41')]('id','ContactId')['field'](LISTID[_0xcb68('0x43')](),_0xcb68('0x2c'))[_0xcb68('0x41')](_0x394271['id']['toString'](),_0x467365)[_0xcb68('0x41')]('NOW()',_0xcb68('0x3e'))['field'](_0xcb68('0x42'),'updatedAt')[_0xcb68('0x49')](_0xcb68('0x44'))[_0xcb68('0x46')](_0xcb68('0x45'))[_0xcb68('0x46')](_0xcb68('0x47'),LISTID[_0xcb68('0x43')]())[_0xcb68('0x46')]('id\x20IN\x20?',squel[_0xcb68('0x4c')](hopperContacts))[_0xcb68('0x46')](_0xcb68('0x48')))['toString']();return _0x1cf7d4;}function _0x4b2a32(_0xfe95f4,_0x247cef){var _0x58a39e=squel[_0xcb68('0x39')]()['into']('cm_hopper_black')[_0xcb68('0x4a')]([_0xcb68('0x24'),_0xcb68('0x3d'),'ListId',_0x247cef,_0xcb68('0x3e'),_0xcb68('0x3f')],squel['select']()['field'](_0xcb68('0x24'),_0xcb68('0x24'))[_0xcb68('0x41')]('id',_0xcb68('0x3d'))[_0xcb68('0x41')](LISTID['toString'](),_0xcb68('0x2c'))[_0xcb68('0x41')](_0xfe95f4['id'][_0xcb68('0x43')](),_0x247cef)[_0xcb68('0x41')](_0xcb68('0x42'),'createdAt')['field']('NOW()',_0xcb68('0x3f'))['from'](_0xcb68('0x44'))[_0xcb68('0x46')](_0xcb68('0x45'))[_0xcb68('0x46')](_0xcb68('0x47'),LISTID[_0xcb68('0x43')]())[_0xcb68('0x46')](_0xcb68('0x4b'),squel['str'](hopperContacts))['where'](_0xcb68('0x48')))[_0xcb68('0x43')]();return _0x58a39e;}return db[_0xcb68('0x51')][_0xcb68('0x52')]({'where':{'type':_0xcb68('0x53')},'attributes':['id',_0xcb68('0x54')],'include':[{'model':db[_0xcb68('0x55')],'as':_0xcb68('0x56'),'where':{'id':LISTID}}]})[_0xcb68('0x32')](function(_0x586d31){var _0x56bdae=[];if(_0x586d31){var _0x2ea547;for(var _0x22604d=0x0,_0x3201d2;_0x22604d<_0x586d31[_0xcb68('0x1d')];_0x22604d+=0x1){_0x3201d2=_0x586d31[_0x22604d]['get']({'plain':!![]});switch(_0x3201d2[_0xcb68('0x54')]){case _0xcb68('0x57'):_0x56bdae[_0xcb68('0x58')](db[_0xcb68('0x59')][_0xcb68('0x5a')](_0x14beb2(_0x3201d2,'VoiceQueueId'))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));break;case _0xcb68('0x5b'):_0x56bdae['push'](db[_0xcb68('0x59')][_0xcb68('0x5a')](_0x39d4c2(_0x3201d2,'VoiceQueueId'))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));break;default:_0x56bdae['push'](db['sequelize']['query'](_0x44ca31(_0x3201d2,'VoiceQueueId'))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));}}}return _0x56bdae;})[_0xcb68('0x5c')]()['then'](function(){return db[_0xcb68('0x51')][_0xcb68('0x52')]({'where':{'type':_0xcb68('0x53')},'attributes':['id'],'include':[{'model':db[_0xcb68('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xcb68('0x32')](function(_0x388a51){var _0x49055f=[];if(_0x388a51){var _0x37b26c;for(var _0xe012d8=0x0,_0x359509;_0xe012d8<_0x388a51[_0xcb68('0x1d')];_0xe012d8+=0x1){_0x359509=_0x388a51[_0xe012d8][_0xcb68('0x5d')]({'plain':!![]});_0x49055f['push'](db[_0xcb68('0x59')][_0xcb68('0x5a')](_0x4b2a32(_0x359509,'VoiceQueueId'))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));}}return _0x49055f;})[_0xcb68('0x5c')]();})[_0xcb68('0x32')](function(){return db[_0xcb68('0x5e')]['findAll']({'attributes':['id',_0xcb68('0x54')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xcb68('0x32')](function(_0x39887d){var _0x28e67e=[];if(_0x39887d){for(var _0xf02997=0x0,_0x4a42f4;_0xf02997<_0x39887d[_0xcb68('0x1d')];_0xf02997+=0x1){_0x4a42f4=_0x39887d[_0xf02997][_0xcb68('0x5d')]({'plain':!![]});switch(_0x4a42f4[_0xcb68('0x54')]){case _0xcb68('0x57'):_0x28e67e[_0xcb68('0x58')](db[_0xcb68('0x59')][_0xcb68('0x5a')](_0x14beb2(_0x4a42f4,_0xcb68('0x5f')))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));break;case _0xcb68('0x5b'):_0x28e67e[_0xcb68('0x58')](db['sequelize'][_0xcb68('0x5a')](_0x39d4c2(_0x4a42f4,_0xcb68('0x5f')))['then'](function(){})[_0xcb68('0x34')](_0x6362e8()));break;default:_0x28e67e[_0xcb68('0x58')](db[_0xcb68('0x59')]['query'](_0x44ca31(_0x4a42f4,_0xcb68('0x5f')))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));}}}return _0x28e67e;})[_0xcb68('0x5c')]();})[_0xcb68('0x32')](function(){return db[_0xcb68('0x5e')][_0xcb68('0x52')]({'attributes':['id'],'include':[{'model':db[_0xcb68('0x55')],'as':_0xcb68('0x60'),'where':{'id':LISTID}}]})[_0xcb68('0x32')](function(_0x2395d1){var _0x291af9=[];if(_0x2395d1){for(var _0x26b5ca=0x0,_0x2681e8;_0x26b5ca<_0x2395d1['length'];_0x26b5ca+=0x1){_0x2681e8=_0x2395d1[_0x26b5ca][_0xcb68('0x5d')]({'plain':!![]});_0x291af9[_0xcb68('0x58')](db[_0xcb68('0x59')][_0xcb68('0x5a')](_0x4b2a32(_0x2681e8,'CampaignId'))[_0xcb68('0x32')](function(){})[_0xcb68('0x34')](_0x6362e8()));}}return _0x291af9;})['all']();})['catch'](function(_0x2dd46d){logger[_0xcb68('0x16')]('cmContact,\x20%s,\x20%s',_0xcb68('0x61'),_0x2dd46d['message']);});}var processPromises=function(_0x581520){return BPromise['all'](promises)['then'](function(_0xed78df){})[_0xcb68('0x34')](function(_0x3fac52){logger[_0xcb68('0x16')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x3fac52));})[_0xcb68('0x62')](function(){socket[_0xcb68('0x63')](_0xcb68('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x581520){return _0x581520[_0xcb68('0x65')]();}});};var endCsv=function(){return BPromise[_0xcb68('0x66')]()[_0xcb68('0x32')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xcb68('0x63')](_0xcb68('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xcb68('0x67')](FILEPATH);}catch(_0xdc6798){logger[_0xcb68('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xcb68('0x36')](_0xdc6798));}finally{process[_0xcb68('0x68')](0x0);}});};process['on'](_0xcb68('0x69'),function(){logger[_0xcb68('0x6a')](_0xcb68('0x6b'));endCsv();});function main(){return BPromise['resolve']()[_0xcb68('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcb68('0x13')](',');return db['CmContact'][_0xcb68('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xcb68('0x32')](function(_0x260885){var _0xc117c3=fs[_0xcb68('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xcb68('0x6d')](_0xc117c3,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3004a0,_0x1ae267){total+=0x1;var _0x49c7fc=total;promises[_0xcb68('0x58')](checkRow(_0x3004a0,_0x260885,_0x49c7fc)[_0xcb68('0x32')](function(){success+=0x1;})[_0xcb68('0x34')](function(_0x347946){if(_0x347946['error']){errors+=0x1;delete _0x347946['error'];}else if(_0x347946[_0xcb68('0x2e')]){duplicates+=0x1;delete _0x347946[_0xcb68('0x2e')];}rows[_0xcb68('0x58')](_0x347946);}));if(total%0xc8===0x0){_0x1ae267[_0xcb68('0x6e')]();return processPromises(_0x1ae267);}},'complete':function(){return processPromises()[_0xcb68('0x32')](function(){logger[_0xcb68('0x6a')](_0xcb68('0x6f'));endCsv();});},'error':function(_0x1e4a01,_0x3d95e6){logger[_0xcb68('0x6a')]('CSV\x20parse\x20error',JSON[_0xcb68('0x36')](_0x1e4a01));endCsv();}});})['catch'](function(_0x2573ff){logger['error'](_0xcb68('0x70'),JSON[_0xcb68('0x36')](_0x2573ff));});}main(); \ No newline at end of file +var _0xe8c1=['localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','error','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','Lists','then','get','always','VoiceQueueId','onlyIfOpen','sequelize','query','all','findAll','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults'];(function(_0x2ba4fb,_0x385d22){var _0x50974a=function(_0x159e09){while(--_0x159e09){_0x2ba4fb['push'](_0x2ba4fb['shift']());}};_0x50974a(++_0x385d22);}(_0xe8c1,0xd7));var _0x1e8c=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0xe8c1[_0x10791d];return _0x1b4f9c;};'use strict';var BPromise=require(_0x1e8c('0x0'));var util=require(_0x1e8c('0x1'));var _=require(_0x1e8c('0x2'));var fs=require('fs');var squel=require(_0x1e8c('0x3'));var Papa=require(_0x1e8c('0x4'));var Redis=require(_0x1e8c('0x5'));var db=require(_0x1e8c('0x6'))['db'];var config=require(_0x1e8c('0x7'));var logger=require(_0x1e8c('0x8'))('api');config[_0x1e8c('0x9')]=_[_0x1e8c('0xa')](config[_0x1e8c('0x9')],{'host':_0x1e8c('0xb'),'port':0x18eb});var socket=require(_0x1e8c('0xc'))(new Redis(config['redis']));require(_0x1e8c('0xd'))['register'](socket);try{if(!process[_0x1e8c('0xe')][0x2]||process[_0x1e8c('0xe')][0x2]===_0x1e8c('0xf')||process[_0x1e8c('0xe')][0x2]==='null'){throw new Error(_0x1e8c('0x10'));}var FILEPATH=process[_0x1e8c('0xe')][0x2];if(!process[_0x1e8c('0xe')][0x3]||process[_0x1e8c('0xe')][0x3]===_0x1e8c('0xf')||process[_0x1e8c('0xe')][0x3]===_0x1e8c('0x11')||!process[_0x1e8c('0xe')][0x4]||process[_0x1e8c('0xe')][0x4]==='undefined'||process[_0x1e8c('0xe')][0x4]===_0x1e8c('0x11')){throw new Error(_0x1e8c('0x12'));}var FIELDS=_[_0x1e8c('0x13')](process[_0x1e8c('0xe')][0x3][_0x1e8c('0x14')](','),process['argv'][0x4][_0x1e8c('0x14')](','));if(!process[_0x1e8c('0xe')][0x5]||process[_0x1e8c('0xe')][0x5]==='undefined'||process['argv'][0x5]===_0x1e8c('0x11')){throw new Error(_0x1e8c('0x15'));}var LISTID=process[_0x1e8c('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x1e8c('0xe')][0x6]!==_0x1e8c('0xf')&&process[_0x1e8c('0xe')][0x6]!==_0x1e8c('0x11')?process[_0x1e8c('0xe')][0x6]:null;var DUPLICATES=process[_0x1e8c('0xe')][0x7]&&process[_0x1e8c('0xe')][0x7]!==_0x1e8c('0xf')&&process['argv'][0x7]!==_0x1e8c('0x11')?process[_0x1e8c('0xe')][0x7]:null;if(!process[_0x1e8c('0xe')][0x8]||process[_0x1e8c('0xe')][0x8]===_0x1e8c('0xf')||process['argv'][0x8]===_0x1e8c('0x11')){throw new Error(_0x1e8c('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4d9166){logger['error'](_0x4d9166);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(_0x258658,_0x593de3,_0x216167,_0x285199){var _0x146163={'message':_0x593de3};_0x146163[_0x258658]=!![];if(_0x216167){_0x146163[_0x1e8c('0x17')]=_0x216167;}if(_0x285199){_0x146163['index']=_0x285199;}return _0x146163;}function isEmail(_0x34c8e1){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))*$/[_0x1e8c('0x18')](_0x34c8e1);}function checkRow(_0x104bd8,_0x48e618,_0x69207b){return new BPromise(function(_0x10220f,_0x236f49){if(_[_0x1e8c('0x19')](_0x104bd8)){return _0x236f49(handleCheckRowError(_0x1e8c('0x1a'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x69207b));}if(_0x104bd8[_0x1e8c('0x1b')]&&_0x104bd8['errors'][_0x1e8c('0x1c')]){var _0x27d9a5=_[_0x1e8c('0x1d')](_0x104bd8[_0x1e8c('0x1b')],_0x1e8c('0x1e'))[_0x1e8c('0x1f')](';');return _0x236f49(handleCheckRowError(_0x1e8c('0x1a'),_0x27d9a5,null,_0x69207b));}var _0x4aa11f={};for(var _0xac65ca in FIELDS){if(FIELDS[_0x1e8c('0x20')](_0xac65ca)&&FIELDS[_0xac65ca]){_0x4aa11f[_0xac65ca]=_0x104bd8['data'][0x0][FIELDS[_0xac65ca]]||_0x104bd8[_0x1e8c('0x21')][0x0]['\ufeff'+FIELDS[_0xac65ca]];}}if(!_0x4aa11f['firstName']){return _0x236f49(handleCheckRowError(_0x1e8c('0x1a'),_0x1e8c('0x22'),null,_0x69207b));}if(!_0x4aa11f[_0x1e8c('0x23')]){return _0x236f49(handleCheckRowError('error',_0x1e8c('0x24'),null,_0x69207b));}if(_0x4aa11f['birthDate']){var _0x518224=moment(_0x4aa11f[_0x1e8c('0x25')],_0x1e8c('0x26'));if(!_0x518224[_0x1e8c('0x27')]()){return _0x236f49(handleCheckRowError(_0x1e8c('0x1a'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x69207b));}}if(_0x4aa11f[_0x1e8c('0x28')]){if(!isEmail(_0x4aa11f[_0x1e8c('0x28')])){return _0x236f49(handleCheckRowError(_0x1e8c('0x1a'),_0x1e8c('0x29'),null,_0x69207b));}}_0x4aa11f[_0x1e8c('0x2a')]=LISTID;_0x4aa11f[_0x1e8c('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1e8c('0x1c')]&&_0x48e618){var _0x21b83a={};for(var _0x53065c=0x0,_0x4b7d22=DUPLICATES[_0x1e8c('0x1c')];_0x53065c<_0x4b7d22;_0x53065c+=0x1){_0x21b83a[DUPLICATES[_0x53065c]]=_0x4aa11f[DUPLICATES[_0x53065c]];}var _0x2878eb=_[_0x1e8c('0x2c')](_0x48e618,_0x21b83a);if(_0x2878eb){return _0x236f49(handleCheckRowError(_0x1e8c('0x2d'),_0x1e8c('0x2e'),_0x2878eb,_0x69207b));}}return db['CmContact'][_0x1e8c('0x2f')](_0x4aa11f,{'raw':!![],'hooks':![],'fields':_[_0x1e8c('0x30')](_0x4aa11f)})['then'](function(_0xe485bb){if(DUPLICATES&&DUPLICATES[_0x1e8c('0x1c')]&&_0x48e618){_0x48e618[_0x1e8c('0x31')](_['pick'](_0x4aa11f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xe485bb['id'];return _0x10220f();})[_0x1e8c('0x32')](function(_0x1dd366){return _0x236f49(handleCheckRowError(_0x1e8c('0x1a'),_0x1e8c('0x33')+(_0x1dd366[_0x1e8c('0x1e')]||JSON['stringify'](_0x1dd366)),null,_0x69207b));});});}function checkHopper(){function _0x5c0f41(){return function(_0x463f8b){logger['error']('cmContact',_0x1e8c('0x34'),util[_0x1e8c('0x35')](_0x463f8b,{'showHidden':![],'depth':null}));};}var _0xf1ff2c=function(_0x5545be,_0x2f4b79){var _0x49a49a=squel[_0x1e8c('0x36')]()[_0x1e8c('0x37')](_0x1e8c('0x38'))['fromQuery'](['phone',_0x1e8c('0x39'),_0x1e8c('0x3a'),_0x1e8c('0x2a'),_0x2f4b79,_0x1e8c('0x3b'),_0x1e8c('0x3c')],squel[_0x1e8c('0x3d')]()[_0x1e8c('0x3e')](_0x1e8c('0x23'),_0x1e8c('0x23'))['field'](_0x1e8c('0x3f'),'scheduledAt')[_0x1e8c('0x3e')]('id',_0x1e8c('0x3a'))[_0x1e8c('0x3e')](LISTID[_0x1e8c('0x40')](),'ListId')['field'](_0x5545be['id'][_0x1e8c('0x40')](),_0x2f4b79)['field'](_0x1e8c('0x3f'),_0x1e8c('0x3b'))['field']('NOW()','updatedAt')[_0x1e8c('0x41')](_0x1e8c('0x42'))[_0x1e8c('0x43')](_0x1e8c('0x44'))[_0x1e8c('0x43')](_0x1e8c('0x45'),LISTID[_0x1e8c('0x40')]())['where'](_0x1e8c('0x46'))[_0x1e8c('0x43')](_0x1e8c('0x47'),squel[_0x1e8c('0x3d')]()[_0x1e8c('0x3e')](_0x1e8c('0x23'))[_0x1e8c('0x41')](_0x1e8c('0x38'))['where'](_0x2f4b79+_0x1e8c('0x48'),_0x5545be['id']['toString']())))[_0x1e8c('0x40')]();return _0x49a49a;};var _0x19abcd=function(_0x482239,_0x45d1ae){var _0x1e1dba=squel['insert']()[_0x1e8c('0x37')](_0x1e8c('0x38'))[_0x1e8c('0x49')]([_0x1e8c('0x23'),_0x1e8c('0x39'),_0x1e8c('0x3a'),_0x1e8c('0x2a'),_0x45d1ae,'createdAt',_0x1e8c('0x3c')],squel[_0x1e8c('0x3d')]()['field'](_0x1e8c('0x23'),_0x1e8c('0x23'))[_0x1e8c('0x3e')](_0x1e8c('0x3f'),_0x1e8c('0x39'))[_0x1e8c('0x3e')]('id',_0x1e8c('0x3a'))[_0x1e8c('0x3e')](LISTID['toString'](),_0x1e8c('0x2a'))[_0x1e8c('0x3e')](_0x482239['id'][_0x1e8c('0x40')](),_0x45d1ae)['field']('NOW()',_0x1e8c('0x3b'))['field'](_0x1e8c('0x3f'),_0x1e8c('0x3c'))[_0x1e8c('0x41')](_0x1e8c('0x42'))[_0x1e8c('0x43')](_0x1e8c('0x44'))[_0x1e8c('0x43')](_0x1e8c('0x45'),LISTID[_0x1e8c('0x40')]())['where']('id\x20IN\x20?',squel[_0x1e8c('0x4a')](hopperContacts))[_0x1e8c('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x1e8c('0x43')](_0x1e8c('0x47'),squel[_0x1e8c('0x3d')]()['field'](_0x1e8c('0x4b'))['from'](_0x1e8c('0x4c'))[_0x1e8c('0x43')](_0x45d1ae+_0x1e8c('0x48'),_0x482239['id']['toString']()))['where'](_0x1e8c('0x47'),squel[_0x1e8c('0x3d')]()[_0x1e8c('0x3e')](_0x1e8c('0x23'))[_0x1e8c('0x41')](_0x1e8c('0x38'))[_0x1e8c('0x43')](_0x45d1ae+_0x1e8c('0x48'),_0x482239['id'][_0x1e8c('0x40')]())))[_0x1e8c('0x40')]();return _0x1e1dba;};function _0x136fbb(_0x492631,_0x139dc7){var _0x4371da=squel['insert']()[_0x1e8c('0x37')](_0x1e8c('0x38'))[_0x1e8c('0x49')]([_0x1e8c('0x23'),_0x1e8c('0x39'),_0x1e8c('0x3a'),_0x1e8c('0x2a'),_0x139dc7,_0x1e8c('0x3b'),_0x1e8c('0x3c')],squel[_0x1e8c('0x3d')]()['field'](_0x1e8c('0x23'),_0x1e8c('0x23'))[_0x1e8c('0x3e')](_0x1e8c('0x3f'),_0x1e8c('0x39'))[_0x1e8c('0x3e')]('id',_0x1e8c('0x3a'))[_0x1e8c('0x3e')](LISTID['toString'](),'ListId')[_0x1e8c('0x3e')](_0x492631['id'][_0x1e8c('0x40')](),_0x139dc7)[_0x1e8c('0x3e')]('NOW()',_0x1e8c('0x3b'))['field'](_0x1e8c('0x3f'),'updatedAt')[_0x1e8c('0x41')](_0x1e8c('0x42'))[_0x1e8c('0x43')](_0x1e8c('0x44'))[_0x1e8c('0x43')](_0x1e8c('0x45'),LISTID[_0x1e8c('0x40')]())[_0x1e8c('0x43')](_0x1e8c('0x4d'),squel[_0x1e8c('0x4a')](hopperContacts))[_0x1e8c('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x1e8c('0x40')]();return _0x4371da;}function _0x4136e3(_0x4776dd,_0x2c816a){var _0x2daffa=squel[_0x1e8c('0x36')]()[_0x1e8c('0x37')](_0x1e8c('0x4e'))[_0x1e8c('0x49')]([_0x1e8c('0x23'),_0x1e8c('0x3a'),_0x1e8c('0x2a'),_0x2c816a,_0x1e8c('0x3b'),'updatedAt'],squel['select']()[_0x1e8c('0x3e')](_0x1e8c('0x23'),'phone')[_0x1e8c('0x3e')]('id','ContactId')[_0x1e8c('0x3e')](LISTID[_0x1e8c('0x40')](),_0x1e8c('0x2a'))[_0x1e8c('0x3e')](_0x4776dd['id'][_0x1e8c('0x40')](),_0x2c816a)['field'](_0x1e8c('0x3f'),'createdAt')[_0x1e8c('0x3e')]('NOW()','updatedAt')[_0x1e8c('0x41')](_0x1e8c('0x42'))[_0x1e8c('0x43')](_0x1e8c('0x44'))[_0x1e8c('0x43')](_0x1e8c('0x45'),LISTID['toString']())[_0x1e8c('0x43')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x1e8c('0x46')))[_0x1e8c('0x40')]();return _0x2daffa;}return db[_0x1e8c('0x4f')]['findAll']({'where':{'type':_0x1e8c('0x50')},'attributes':['id',_0x1e8c('0x51')],'include':[{'model':db['CmList'],'as':_0x1e8c('0x52'),'where':{'id':LISTID}}]})[_0x1e8c('0x53')](function(_0x370c17){var _0x322850=[];if(_0x370c17){var _0x4ee11d;for(var _0x3a99ed=0x0,_0x5d565f;_0x3a99ed<_0x370c17['length'];_0x3a99ed+=0x1){_0x5d565f=_0x370c17[_0x3a99ed][_0x1e8c('0x54')]({'plain':!![]});switch(_0x5d565f['dialCheckDuplicateType']){case _0x1e8c('0x55'):_0x322850[_0x1e8c('0x31')](db['sequelize']['query'](_0x19abcd(_0x5d565f,_0x1e8c('0x56')))['then'](function(){})[_0x1e8c('0x32')](_0x5c0f41()));break;case _0x1e8c('0x57'):_0x322850['push'](db[_0x1e8c('0x58')][_0x1e8c('0x59')](_0xf1ff2c(_0x5d565f,_0x1e8c('0x56')))[_0x1e8c('0x53')](function(){})[_0x1e8c('0x32')](_0x5c0f41()));break;default:_0x322850['push'](db[_0x1e8c('0x58')][_0x1e8c('0x59')](_0x136fbb(_0x5d565f,_0x1e8c('0x56')))['then'](function(){})['catch'](_0x5c0f41()));}}}return _0x322850;})[_0x1e8c('0x5a')]()['then'](function(){return db['VoiceQueue'][_0x1e8c('0x5b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x1e8c('0x5c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1e8c('0x53')](function(_0x16110d){var _0x32f775=[];if(_0x16110d){var _0x591721;for(var _0x88abfd=0x0,_0x48e0b3;_0x88abfd<_0x16110d['length'];_0x88abfd+=0x1){_0x48e0b3=_0x16110d[_0x88abfd]['get']({'plain':!![]});_0x32f775[_0x1e8c('0x31')](db['sequelize'][_0x1e8c('0x59')](_0x4136e3(_0x48e0b3,'VoiceQueueId'))[_0x1e8c('0x53')](function(){})[_0x1e8c('0x32')](_0x5c0f41()));}}return _0x32f775;})[_0x1e8c('0x5a')]();})[_0x1e8c('0x53')](function(){return db[_0x1e8c('0x5d')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x1e8c('0x52'),'where':{'id':LISTID}}]})[_0x1e8c('0x53')](function(_0x17741a){var _0x198f6e=[];if(_0x17741a){for(var _0x416413=0x0,_0x9bb19d;_0x416413<_0x17741a['length'];_0x416413+=0x1){_0x9bb19d=_0x17741a[_0x416413][_0x1e8c('0x54')]({'plain':!![]});switch(_0x9bb19d['dialCheckDuplicateType']){case'always':_0x198f6e[_0x1e8c('0x31')](db['sequelize'][_0x1e8c('0x59')](_0x19abcd(_0x9bb19d,_0x1e8c('0x5e')))[_0x1e8c('0x53')](function(){})[_0x1e8c('0x32')](_0x5c0f41()));break;case _0x1e8c('0x57'):_0x198f6e[_0x1e8c('0x31')](db['sequelize'][_0x1e8c('0x59')](_0xf1ff2c(_0x9bb19d,'CampaignId'))[_0x1e8c('0x53')](function(){})['catch'](_0x5c0f41()));break;default:_0x198f6e[_0x1e8c('0x31')](db[_0x1e8c('0x58')][_0x1e8c('0x59')](_0x136fbb(_0x9bb19d,_0x1e8c('0x5e')))[_0x1e8c('0x53')](function(){})['catch'](_0x5c0f41()));}}}return _0x198f6e;})[_0x1e8c('0x5a')]();})[_0x1e8c('0x53')](function(){return db[_0x1e8c('0x5d')][_0x1e8c('0x5b')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x1e8c('0x5f'),'where':{'id':LISTID}}]})['then'](function(_0x44a675){var _0x3abe47=[];if(_0x44a675){for(var _0x33968c=0x0,_0x33f844;_0x33968c<_0x44a675[_0x1e8c('0x1c')];_0x33968c+=0x1){_0x33f844=_0x44a675[_0x33968c][_0x1e8c('0x54')]({'plain':!![]});_0x3abe47['push'](db['sequelize'][_0x1e8c('0x59')](_0x4136e3(_0x33f844,_0x1e8c('0x5e')))[_0x1e8c('0x53')](function(){})['catch'](_0x5c0f41()));}}return _0x3abe47;})[_0x1e8c('0x5a')]();})['catch'](function(_0x1fd4ad){logger['error'](_0x1e8c('0x60'),'generalCheckHopper',_0x1fd4ad[_0x1e8c('0x1e')]);});}var processPromises=function(_0x4a394e){return BPromise[_0x1e8c('0x5a')](promises)[_0x1e8c('0x53')](function(_0x2390bf){})[_0x1e8c('0x32')](function(_0x994e21){logger[_0x1e8c('0x1a')](_0x1e8c('0x61'),JSON[_0x1e8c('0x62')](_0x994e21));})[_0x1e8c('0x63')](function(){socket[_0x1e8c('0x64')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4a394e){return _0x4a394e['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x1e8c('0x53')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x1e8c('0x64')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x23d1bf){logger[_0x1e8c('0x1a')](_0x1e8c('0x65'),JSON['stringify'](_0x23d1bf));}finally{process[_0x1e8c('0x66')](0x0);}});};process['on'](_0x1e8c('0x67'),function(){logger[_0x1e8c('0x68')](_0x1e8c('0x69'));endCsv();});function main(){return BPromise[_0x1e8c('0x6a')]()[_0x1e8c('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1e8c('0x14')](',');return db[_0x1e8c('0x6b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1e8c('0x53')](function(_0x10b9ef){var _0x4e2714=fs[_0x1e8c('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1e8c('0x6d')](_0x4e2714,{'header':!![],'skipEmptyLines':!![],'step':function(_0xf168d5,_0x4c01cc){total+=0x1;var _0x17f1f6=total;promises[_0x1e8c('0x31')](checkRow(_0xf168d5,_0x10b9ef,_0x17f1f6)[_0x1e8c('0x53')](function(){success+=0x1;})[_0x1e8c('0x32')](function(_0x467753){if(_0x467753[_0x1e8c('0x1a')]){errors+=0x1;delete _0x467753['error'];}else if(_0x467753[_0x1e8c('0x2d')]){duplicates+=0x1;delete _0x467753[_0x1e8c('0x2d')];}rows[_0x1e8c('0x31')](_0x467753);}));if(total%0xc8===0x0){_0x4c01cc[_0x1e8c('0x6e')]();return processPromises(_0x4c01cc);}},'complete':function(){return processPromises()['then'](function(){logger[_0x1e8c('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xa1dcde,_0x1e0d0b){logger['info'](_0x1e8c('0x6f'),JSON[_0x1e8c('0x62')](_0xa1dcde));endCsv();}});})[_0x1e8c('0x32')](function(_0x345e0f){logger[_0x1e8c('0x1a')](_0x1e8c('0x70'),JSON[_0x1e8c('0x62')](_0x345e0f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6bf2990..4802ea5 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 _0x79c3=['.offset-cm_contacts.utcOffset\x20minute)','ListId','\x22onlyIfOpen\x22','ListId\x20=\x20?','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','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','error','exit','query','catch','message','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','spread','timezones','dialTimezone','utcOffset','set','offset','send','start','binding','server/files/tmp','.csv','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','rows','errors','data','find','hasOwnProperty','trim','replace','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','join','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','all','split','push','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','cm_hopper_black','ContactId','updatedAt','toString','date_add(cm_contacts.scheduledat,interval\x20'];(function(_0x519ff9,_0x37959c){var _0x6267ce=function(_0x2902a6){while(--_0x2902a6){_0x519ff9['push'](_0x519ff9['shift']());}};_0x6267ce(++_0x37959c);}(_0x79c3,0x126));var _0x379c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x79c3[_0x1facfa];return _0x9ec701;};'use strict';var fs=require('fs');var path=require(_0x379c('0x0'));var _=require(_0x379c('0x1'));var Papa=require(_0x379c('0x2'));var util=require(_0x379c('0x3'));var BPromise=require(_0x379c('0x4'));var moment=require(_0x379c('0x5'));var squel=require(_0x379c('0x6'));var Redis=require(_0x379c('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x379c('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x379c('0x9'))(_0x379c('0xa'));config['redis']=_[_0x379c('0xb')](config[_0x379c('0xc')],{'host':_0x379c('0xd'),'port':0x18eb});var socket=require(_0x379c('0xe'))(new Redis(config[_0x379c('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x379c('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x379c('0x10')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x93add0){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))*$/[_0x379c('0x11')](_0x93add0);}function selectNotIn(_0x3938be,_0x5c3376,_0x55f43c,_0x28b734,_0x553d88){return squel[_0x379c('0x12')]()[_0x379c('0x13')](_0x379c('0x14'))[_0x379c('0x15')](_0x28b734)[_0x379c('0x16')](_0x5c3376,null,_0x5c3376+'.id\x20=\x20'+_0x28b734+'.'+_0x55f43c)[_0x379c('0x17')](_0x28b734+'.'+_0x55f43c+_0x379c('0x18')+_0x3938be+'.'+_0x55f43c)[_0x379c('0x17')](_0x5c3376+'.dialCheckDuplicateType\x20IN\x20('+_0x553d88[_0x379c('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4f5c67,_0x5758ba){promisesAdditionalPhones=[];return db[_0x379c('0x19')][_0x379c('0x1a')]({'raw':!![],'attributes':['id',_0x379c('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x379c('0x1c')](function(_0x476caf){if(_0x476caf!==null){var _0xc50765=[];for(var _0x3c6e12=0x0;_0x3c6e12<_0x476caf[_0x379c('0x1d')];_0x3c6e12++){var _0x1cb1b3=_0x476caf[_0x3c6e12];_0xc50765['push'](insertAdditionalPhones(_0x1cb1b3));}}Promise[_0x379c('0x1e')](_0xc50765)[_0x379c('0x1c')](function(){_0x4f5c67({'val':0x1});});});});}function insertAdditionalPhones(_0x339246){return new Promise(function(_0x222179,_0x46bba6){var _0x4db339=_0x339246[_0x379c('0x1b')];var _0x53bae9=_0x4db339[_0x379c('0x1f')](';');var _0x27b12c=[];orderBy=0x0;for(var _0x1177c0=0x0;_0x1177c0<_0x53bae9[_0x379c('0x1d')];_0x1177c0++){_0x27b12c[_0x379c('0x20')](splitAdditionalPhone(_0x339246['id'],_0x53bae9[_0x1177c0]));}Promise[_0x379c('0x1e')](_0x27b12c)['then'](function(){_0x222179({'val':_0x53bae9[_0x379c('0x1d')]});});});}function splitAdditionalPhone(_0x3b9439,_0x38b322){return new Promise(function(_0x2dcf9c,_0x3acb2f){var _0x5d4911=_0x38b322[_0x379c('0x1f')](':');var _0x70f847=_0x5d4911[0x0];var _0x3e4a1f=_0x5d4911[0x1];if(!_[_0x379c('0x21')](_0x3e4a1f)){var _0x423235=_0x3e4a1f[_0x379c('0x1f')]('|');var _0x14d072=[];for(var _0x22b452=0x0;_0x22b452<_0x423235['length'];_0x22b452++){if(_0x423235[_0x22b452]!==''){var _0x15fa4b=_[_0x379c('0x22')](promisesAdditionalPhones,{'contactId':_0x3b9439,'phone':_0x423235[_0x22b452]});if(_0x15fa4b[_0x379c('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x379c('0x20')]({'contactId':_0x3b9439,'contactTypeId':_0x70f847,'phone':_0x423235[_0x22b452],'orderBy':orderBy});}}}_0x2dcf9c({'ok':0x1});}else _0x2dcf9c({'res':0x0});});}function createAdditionalPhone(_0x14cb94,_0x339ee9,_0x2a7515,_0x1badbd){var _0x496f83='';var _0x140b68='';var _0x37c1d3=_0x2a7515[_0x379c('0x1f')]('§');_0x496f83=_0x37c1d3[0x0];if(_0x37c1d3[_0x379c('0x1d')]==0x2)_0x140b68=_0x37c1d3[0x1];return new Promise(function(_0x4e0d0b,_0x1e36e1){return db[_0x379c('0x23')][_0x379c('0x24')]({'where':{'CmContactId':_0x14cb94,'item':_0x496f83}})['then'](function(_0x386289){if(_0x386289){return db[_0x379c('0x23')][_0x379c('0x25')]({'ItemTypeId':_0x339ee9,'description':_0x140b68,'OrderBy':_0x1badbd},{'where':{'CmContactId':_0x14cb94,'item':_0x496f83}})[_0x379c('0x1c')](function(_0x23ccff){_0x4e0d0b({'res':_0x379c('0x26')});});}else{return db[_0x379c('0x23')][_0x379c('0x27')]({'CmContactId':_0x14cb94,'item':_0x496f83,'description':_0x140b68,'ItemTypeId':_0x339ee9,'OrderBy':_0x1badbd,'ItemClass':_0x379c('0x28')})[_0x379c('0x1c')](function(_0x213f84){_0x4e0d0b({'res':_0x379c('0x29')});});}});});}function insertCmHopper(_0x494330,_0x4110b5,_0x58e198,_0x5f1383,_0x347bb4){var _0x2cc04c=[_0x379c('0x2a'),_0x379c('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x4110b5+'.'+_0x5f1383,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x379c('0x2c'),_0x379c('0x2d'),'\x22'+_0x347bb4+'\x22'];return squel['insert']()['into'](_0x379c('0x2e'))[_0x379c('0x2f')](['phone',_0x379c('0x30'),'ContactId','ListId',_0x5f1383,_0x379c('0x31'),'updatedAt',_0x379c('0x32'),_0x379c('0x33'),_0x379c('0x34')],squel['select']()[_0x379c('0x35')](_0x2cc04c)['from'](_0x4110b5)[_0x379c('0x16')](_0x379c('0x36'),null,_0x379c('0x37')+_0x4110b5+'.CmListId')[_0x379c('0x16')](_0x58e198,null,_0x58e198+_0x379c('0x38')+_0x4110b5+'.'+_0x5f1383)['where'](_0x4110b5+_0x379c('0x39'),_0x494330)[_0x379c('0x17')](_0x379c('0x3a'),NOW)[_0x379c('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4110b5,_0x58e198,_0x5f1383,_0x379c('0x2e'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x379c('0x17')](_0x379c('0x3b'),selectNotIn(_0x4110b5,_0x58e198,_0x5f1383,_0x379c('0x2e'),[_0x379c('0x3c')])))['toString']();}function insertCmHopperBlack(_0x5e1a98,_0x3d9dbd,_0x3d0471,_0x362b29){var _0xa171c9=['cm_contacts.phone',_0x379c('0x3d'),_0x379c('0x3e'),_0x3d9dbd+'.'+_0x362b29,_0x379c('0x3f'),_0x379c('0x40')];return squel[_0x379c('0x41')]()[_0x379c('0x42')](_0x379c('0x43'))['fromQuery'](['phone',_0x379c('0x44'),'ListId',_0x362b29,_0x379c('0x31'),_0x379c('0x45')],squel[_0x379c('0x12')]()['fields'](_0xa171c9)[_0x379c('0x15')](_0x3d9dbd)[_0x379c('0x16')](_0x379c('0x36'),null,_0x379c('0x37')+_0x3d9dbd+'.CmListId')[_0x379c('0x16')](_0x3d0471,null,_0x3d0471+'.id\x20=\x20'+_0x3d9dbd+'.'+_0x362b29)[_0x379c('0x17')](_0x3d9dbd+_0x379c('0x39'),_0x5e1a98)[_0x379c('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x379c('0x17')](_0x379c('0x3b'),squel[_0x379c('0x12')]()[_0x379c('0x13')]('phone')[_0x379c('0x15')](_0x379c('0x43'))[_0x379c('0x17')]('ListId\x20=\x20?',_0x5e1a98)[_0x379c('0x17')](_0x362b29+_0x379c('0x18')+_0x3d9dbd+'.'+_0x362b29)))[_0x379c('0x46')]();}function insertTzCmHopper(_0x747294,_0x1758e7,_0x543a66,_0x1503d4,_0x22f4bc,_0x2b2b05){var _0x18cf70=[_0x379c('0x2a'),_0x379c('0x47')+_0x2b2b05+_0x379c('0x48'),_0x379c('0x3d'),_0x379c('0x3e'),_0x1758e7+'.'+_0x1503d4,'cm_contacts.createdAt',_0x379c('0x40'),_0x379c('0x2c'),_0x379c('0x2d'),'\x22'+_0x22f4bc+'\x22'];var _0x4d231c=squel[_0x379c('0x41')]()[_0x379c('0x42')]('cm_hopper')[_0x379c('0x2f')]([_0x379c('0x14'),'scheduledat',_0x379c('0x44'),_0x379c('0x49'),_0x1503d4,'createdAt',_0x379c('0x45'),_0x379c('0x32'),_0x379c('0x33'),_0x379c('0x34')],squel[_0x379c('0x12')]()[_0x379c('0x35')](_0x18cf70)[_0x379c('0x15')](_0x1758e7)[_0x379c('0x16')](_0x379c('0x36'),null,_0x379c('0x37')+_0x1758e7+'.CmListId')[_0x379c('0x16')](_0x543a66,null,_0x543a66+_0x379c('0x38')+_0x1758e7+'.'+_0x1503d4)[_0x379c('0x16')](_0x2b2b05,null,_0x2b2b05+_0x379c('0x38')+_0x1758e7+'.'+_0x1503d4)[_0x379c('0x17')](_0x1758e7+'.CmListId\x20=\x20?',_0x747294)[_0x379c('0x17')](_0x379c('0x3a'),NOW)[_0x379c('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1758e7,_0x543a66,_0x1503d4,_0x379c('0x2e'),[_0x379c('0x3c'),_0x379c('0x4a')]))[_0x379c('0x17')](_0x379c('0x3b'),selectNotIn(_0x1758e7,_0x543a66,_0x1503d4,'cm_hopper',[_0x379c('0x3c')])))[_0x379c('0x46')]();return _0x4d231c;}function insertTzCmHopperBlack(_0x2ba161,_0x287c19,_0x13ccc4,_0x5edc1a){var _0x7c24df=[_0x379c('0x2a'),_0x379c('0x3d'),'cm_contacts.ListId',_0x287c19+'.'+_0x5edc1a,_0x379c('0x3f'),_0x379c('0x40')];return squel[_0x379c('0x41')]()[_0x379c('0x42')](_0x379c('0x43'))[_0x379c('0x2f')](['phone',_0x379c('0x44'),_0x379c('0x49'),_0x5edc1a,_0x379c('0x31'),_0x379c('0x45')],squel[_0x379c('0x12')]()['fields'](_0x7c24df)[_0x379c('0x15')](_0x287c19)[_0x379c('0x16')](_0x379c('0x36'),null,_0x379c('0x37')+_0x287c19+'.CmListId')['join'](_0x13ccc4,null,_0x13ccc4+_0x379c('0x38')+_0x287c19+'.'+_0x5edc1a)[_0x379c('0x17')](_0x287c19+_0x379c('0x39'),_0x2ba161)[_0x379c('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x379c('0x17')](_0x379c('0x3b'),squel[_0x379c('0x12')]()[_0x379c('0x13')](_0x379c('0x14'))[_0x379c('0x15')](_0x379c('0x43'))[_0x379c('0x17')](_0x379c('0x4b'),_0x2ba161)['where'](_0x5edc1a+_0x379c('0x18')+_0x287c19+'.'+_0x5edc1a)))['toString']();}function insertCmHopperAdditionalPhones(_0x3456a7){var _0x4cb80c=['cm_hopper.id',_0x379c('0x4c'),_0x379c('0x4d'),_0x379c('0x4e'),_0x379c('0x4f')];return squel[_0x379c('0x41')]()[_0x379c('0x42')](_0x379c('0x50'))['fromQuery']([_0x379c('0x51'),_0x379c('0x14'),_0x379c('0x52'),_0x379c('0x31'),_0x379c('0x45')],squel[_0x379c('0x12')]()[_0x379c('0x35')](_0x4cb80c)[_0x379c('0x15')]('cm_hopper')[_0x379c('0x16')](_0x379c('0x36'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x379c('0x53'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x379c('0x17')](_0x379c('0x54'),_0x3456a7)[_0x379c('0x17')](_0x379c('0x3a'),NOW))['toString']();}function insertCmContact(_0x403c2f,_0x323f1d,_0x260745,_0x11b8d6){var _0x125272=_[_0x379c('0x55')](_[_0x379c('0x56')](_0x11b8d6),[_0x379c('0x49'),'CompanyId',_0x379c('0x31'),_0x379c('0x45'),_0x379c('0x57')]);return squel[_0x379c('0x41')]()['into'](_0x379c('0x36'))[_0x379c('0x2f')](_0x125272,squel[_0x379c('0x12')]()[_0x379c('0x35')](_0x125272)[_0x379c('0x15')](_0x323f1d)[_0x379c('0x17')]('('+_0x260745[_0x379c('0x16')](',')+_0x379c('0x58'),squel[_0x379c('0x12')]()[_0x379c('0x35')](_0x260745)[_0x379c('0x15')](_0x379c('0x36'))[_0x379c('0x17')]('ListId\x20=\x20?',_0x403c2f)[_0x379c('0x17')](_0x379c('0x59')))[_0x379c('0x17')](_0x379c('0x5a'),squel[_0x379c('0x12')]()[_0x379c('0x13')](_0x379c('0x5b'),'min_id')['from'](_0x323f1d)['group'](_0x260745[_0x379c('0x16')](','))))[_0x379c('0x46')]();}function handleStop(){logger[_0x379c('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x333bf3){logger[_0x379c('0x5d')](_0x333bf3['message']);process[_0x379c('0x5e')](0x1);}function handleError(_0x326656,_0x7bba16){stats['errors'][_0x379c('0x20')]({'name':_0x7bba16['code'],'message':_0x7bba16['message'],'row':_0x326656});}function handleQuery(_0x267ef7){logger[_0x379c('0x5c')](_0x267ef7);return db['sequelize'][_0x379c('0x5f')](_0x267ef7)['spread'](function(_0x39d29a){results[_0x379c('0x20')](_0x39d29a);})[_0x379c('0x60')](function(_0x467af9){logger[_0x379c('0x5d')](_0x467af9[_0x379c('0x61')]);});}function updateTzCampaigns(_0x1c5614){return new Promise(function(_0x568eed,_0x332179){var _0x815d07=squel['select']()[_0x379c('0x35')](['campaigns.id',_0x379c('0x62')])[_0x379c('0x15')](_0x379c('0x63'))[_0x379c('0x16')](_0x379c('0x64'),null,_0x379c('0x65'))[_0x379c('0x17')](_0x379c('0x66')+_0x1c5614);db[_0x379c('0x67')]['query'](_0x815d07['toString']())['spread'](function(_0x3eb321){var _0x4e78f2=[];for(var _0x3c5363=0x0;_0x3c5363<_0x3eb321[_0x379c('0x1d')];_0x3c5363++){_0x4e78f2[_0x379c('0x20')](getTimezoneData(_0x3eb321[_0x3c5363],tmp_campaigns));}BPromise[_0x379c('0x1e')](_0x4e78f2)[_0x379c('0x1c')](function(){_0x568eed({'val':0x1});});})[_0x379c('0x60')](function(_0x2f5193){logger[_0x379c('0x5d')](_0x2f5193[_0x379c('0x61')]);_0x568eed({'val':0x0});});});}function updateTzVoiceQueues(_0x4c4991){return new Promise(function(_0x1e695e,_0x4a815e){var _0x2f442d=squel['select']()[_0x379c('0x35')]([_0x379c('0x68'),_0x379c('0x69')])[_0x379c('0x15')](_0x379c('0x6a'))[_0x379c('0x16')]('voice_queues_has_cm_lists',null,_0x379c('0x6b'))['where'](_0x379c('0x6c')+_0x4c4991);db[_0x379c('0x67')][_0x379c('0x5f')](_0x2f442d[_0x379c('0x46')]())[_0x379c('0x6d')](function(_0x5370b9){var _0x4d002a=[];for(var _0x48e078=0x0;_0x48e078<_0x5370b9[_0x379c('0x1d')];_0x48e078++){_0x4d002a['push'](getTimezoneData(_0x5370b9[_0x48e078],tmp_voice_queues));}BPromise[_0x379c('0x1e')](_0x4d002a)['then'](function(){_0x1e695e({'val':0x1});});})[_0x379c('0x60')](function(_0x40f198){logger['error'](_0x40f198[_0x379c('0x61')]);_0x1e695e({'val':0x0});});});}function getTimezoneData(_0x437921,_0x2a6cc7){return new Promise(function(_0x4890d0,_0x510cd0){var _0x3b3cb2=shared[_0x379c('0x6e')];var _0x243cc2=_0x3b3cb2[_0x437921[_0x379c('0x6f')]];if(_[_0x379c('0x21')](_0x243cc2)){_0x4890d0({'ret':0x1});}else{var _0x3de9f5=_0x243cc2[_0x379c('0x70')];var _0x5cf442=squel[_0x379c('0x41')]()[_0x379c('0x42')](_0x2a6cc7)[_0x379c('0x71')]('id',_0x437921['id'])['set'](_0x379c('0x72'),_0x3de9f5)[_0x379c('0x71')](_0x379c('0x6f'),_0x437921[_0x379c('0x6f')])[_0x379c('0x46')]();return db[_0x379c('0x67')]['query'](_0x5cf442)[_0x379c('0x6d')](function(_0x4ab435){_0x4890d0({'ret':0x1});})[_0x379c('0x60')](function(_0x2e76ea){logger[_0x379c('0x5d')](_0x2e76ea[_0x379c('0x61')]);_0x510cd0({'ret':0x1});});}});}function handleTZQuery(_0x4d2e7e){logger['info'](_0x4d2e7e);return db[_0x379c('0x67')][_0x379c('0x5f')](_0x4d2e7e)[_0x379c('0x6d')](function(_0x438513){})[_0x379c('0x60')](function(_0x44759d){logger[_0x379c('0x5d')](_0x44759d[_0x379c('0x61')]);});}function main(_0x50f77a,_0x24d4e4,_0x28bbe9,_0x336b5a){logger[_0x379c('0x5c')]('main',_0x50f77a,JSON['stringify'](_0x24d4e4));process[_0x379c('0x73')](_0x379c('0x74'));var _0x5683c2=_0x24d4e4[_0x379c('0x75')];var _0x2c88e5=_['clone'](_0x5683c2);var _0x1f59ee=_0x24d4e4['socket_timestamp'];var _0x5e760d=path['join'](config['root'],_0x379c('0x76'),_0x1f59ee+_0x379c('0x77'));hasTZ=_[_0x379c('0x56')](_0x5683c2)['includes'](_0x379c('0x6f'));var _0x211c9a=_[_0x379c('0x56')](_0x5683c2)['join']();logger[_0x379c('0x5c')](_0x379c('0x78'),_0x211c9a);db[_0x379c('0x79')][_0x379c('0x1a')]({'raw':!![],'attributes':['id','name']})[_0x379c('0x1c')](function(_0x2f01ef){for(var _0x2982a5=0x0;_0x2982a5<_0x2f01ef[_0x379c('0x1d')];_0x2982a5++){if(_0x2f01ef[_0x2982a5]['name']in _0x5683c2){contactItemTypes[_0x379c('0x20')](_0x2f01ef[_0x2982a5]);delete _0x2c88e5[_0x2f01ef[_0x2982a5][_0x379c('0x7a')]];hasAdditionalPhones=!![];}for(var _0x2f7031 in _0x5683c2){if(_0x2f01ef[_0x2982a5]['name']+_0x379c('0x7b')===_0x2f7031){phoneDescriptions['push']({'itemTypeId':_0x2f01ef[_0x2982a5]['id'],'description':_0x2f7031});delete _0x2c88e5[_0x2f7031];}}}if(hasAdditionalPhones)_0x2c88e5['AdditionalPhones']='';var _0x5341ef=_[_0x379c('0x56')](_0x2c88e5)[_0x379c('0x16')]();logger[_0x379c('0x5c')](_0x379c('0x78'),_0x5341ef);fs[_0x379c('0x7c')](_0x5e760d,_0x5341ef+'\x0a');Papa[_0x379c('0x7d')](fs[_0x379c('0x7e')](_0x50f77a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4ed709,_0x549b1a){try{for(var _0x3a9551=0x0,_0x2132b0=[];_0x3a9551<_0x4ed709['data'][_0x379c('0x1d')];_0x3a9551++){stats[_0x379c('0x7f')]+=0x1;if(_0x4ed709[_0x379c('0x80')][_0x3a9551]){handleError(_0x4ed709[_0x379c('0x81')][_0x3a9551],_0x4ed709[_0x379c('0x80')][_0x3a9551]);}else{var _0x57c643=[];var _0x335278=[];var _0x1154e0={};for(var _0x4568a0 in _0x5683c2){let _0x5d92e9=contactItemTypes['find'](_0x4d9ad7=>_0x4d9ad7[_0x379c('0x7a')]===_0x4568a0);let _0x5785b8=contactItemTypes[_0x379c('0x82')](_0x1caad5=>_0x1caad5[_0x379c('0x7a')]+_0x379c('0x7b')===_0x4568a0);if(_[_0x379c('0x21')](_0x5d92e9)&&_['isNil'](_0x5785b8)){if(_0x5683c2[_0x379c('0x83')](_0x4568a0)){if(_0x4ed709[_0x379c('0x81')][_0x3a9551][_0x5683c2[_0x4568a0]]){var _0x12a4db=_[_0x379c('0x84')](_0x4ed709[_0x379c('0x81')][_0x3a9551][_0x5683c2[_0x4568a0]][_0x379c('0x85')](/"/g,'\x27'));switch(_0x4568a0){case _0x379c('0x30'):var _0x30cefc=moment(_0x12a4db,_0x379c('0xf'),!![]);if(_0x30cefc['isValid']()){_0x2132b0[_0x379c('0x20')]('\x22'+_0x12a4db+'\x22');}else{_0x57c643[_0x379c('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x379c('0x32'):var _0x596a62=parseInt(_0x12a4db);_0x12a4db=_[_0x379c('0x86')](_0x596a62)||_0x596a62<0x0||_0x596a62>0x4?_0x336b5a?0x3:0x2:_0x596a62;_0x2132b0[_0x379c('0x20')]('\x22'+_0x12a4db+'\x22');break;case'UserId':var _0x5bd119=parseInt(_0x12a4db);if(_[_0x379c('0x87')](_0x5bd119)&&_[_0x379c('0x88')](_0x28bbe9,_0x5bd119)){_0x2132b0[_0x379c('0x20')]('\x22'+_0x5bd119+'\x22');}else{_0x57c643[_0x379c('0x20')](_0x379c('0x89'));}break;case _0x379c('0x8a'):if(isEmail(_0x12a4db)){_0x2132b0[_0x379c('0x20')]('\x22'+_0x12a4db+'\x22');}else{_0x57c643[_0x379c('0x20')](_0x379c('0x8b'));}break;case'dateOfBirth':var _0x3af5bc=moment(_0x12a4db,_0x379c('0x8c'),!![]);if(_0x3af5bc[_0x379c('0x8d')]()){_0x2132b0[_0x379c('0x20')]('\x22'+_0x12a4db+'\x22');}else{_0x57c643['push'](_0x379c('0x8e'));}break;case'dialTimezone':var _0x6254d2=shared[_0x379c('0x6e')];var _0x2e13ec=_0x6254d2[_0x12a4db];if(!_[_0x379c('0x21')](_0x2e13ec)){var _0x16410f=_0x2e13ec[_0x379c('0x70')];_0x2132b0[_0x379c('0x20')]('\x22'+_0x12a4db+'\x22');_0x2132b0['push']('\x22'+_0x16410f+'\x22');}break;default:_0x2132b0['push']('\x22'+_0x12a4db+'\x22');}}else{switch(_0x4568a0){case'firstName':case _0x379c('0x14'):_0x57c643[_0x379c('0x20')](_0x4568a0+'\x20not\x20specified');break;default:_0x2132b0['push']('\x22\x22');}}}}else{var _0x2d8b51='';if(!_[_0x379c('0x21')](_0x5d92e9)){if(!_0x1154e0[_0x379c('0x83')](_0x5d92e9['id'])){if(!_[_0x379c('0x21')](_0x4ed709[_0x379c('0x81')][_0x3a9551][_0x5683c2[_0x4568a0]])){var _0x12a4db=_['trim'](_0x4ed709['data'][_0x3a9551][_0x5683c2[_0x4568a0]][_0x379c('0x85')](/"/g,'\x27'));var _0x17a1e7=phoneDescriptions[_0x379c('0x82')](_0x4bfce1=>_0x4bfce1[_0x379c('0x8f')]===_0x5d92e9['id']);if(!_['isNil'](_0x17a1e7)){var _0x32a5c6=_[_0x379c('0x84')](_0x4ed709[_0x379c('0x81')][_0x3a9551][_0x5683c2[_0x17a1e7[_0x379c('0x90')]]][_0x379c('0x85')](/"/g,'\x27'));if(!_[_0x379c('0x21')](_0x32a5c6))_0x12a4db=_0x12a4db+'§'+_0x32a5c6;}if(_0x2d8b51=='')_0x2d8b51=_0x12a4db;else _0x2d8b51+='|'+_0x12a4db;}_0x335278[_0x379c('0x20')](_0x5d92e9['id']+':'+_0x2d8b51);_0x1154e0[_0x5d92e9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2132b0[_0x379c('0x20')]('\x22'+_0x335278[_0x379c('0x16')](';')+'\x22');}if(_0x57c643[_0x379c('0x1d')]){handleError(_0x4ed709[_0x379c('0x81')][_0x3a9551],{'code':'SystemRow','message':_0x57c643[_0x379c('0x16')]()});}else{fs[_0x379c('0x91')](_0x5e760d,_0x2132b0['join']()+'\x0a');}_0x2132b0=[];}if(!(stats[_0x379c('0x7f')]%0xc8)){socket[_0x379c('0x92')](_0x379c('0x93')+_0x1f59ee,stats);stats['errors']=[];}}if(stopped){logger[_0x379c('0x5c')](_0x379c('0x94'));_0x549b1a['abort']();}}catch(_0x304f11){handleError(_0x4ed709[_0x379c('0x81')][_0x3a9551],{'code':_0x379c('0x95'),'message':_0x304f11[_0x379c('0x61')]});logger[_0x379c('0x5d')]('step',_0x304f11['message']);}},'complete':function(){try{var _0x1ef46e=[];var _0x3b5fe4=[];var _0x3e6e3b=_0x379c('0x36');if(_0x24d4e4[_0x379c('0x96')]&&_0x24d4e4[_0x379c('0x96')][_0x379c('0x1d')]){_0x3e6e3b=_0x379c('0x97')+_0x1f59ee;_0x1ef46e[_0x379c('0x20')](_0x379c('0x98')+_0x3e6e3b+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x379c('0x99')+_0x1f59ee;tmp_voice_queues=_0x379c('0x9a')+_0x1f59ee;_0x3b5fe4[_0x379c('0x20')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x379c('0x9b'));_0x3b5fe4[_0x379c('0x20')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x379c('0x9b'));BPromise['each'](_0x3b5fe4,handleTZQuery)[_0x379c('0x1c')](function(_0x473a6a){updateTzCampaigns(_0x24d4e4[_0x379c('0x49')])[_0x379c('0x1c')](function(_0x1e5fca){updateTzVoiceQueues(_0x24d4e4[_0x379c('0x49')])[_0x379c('0x1c')](function(_0x357ffc){if(hasTZ)_0x5341ef=_0x5341ef[_0x379c('0x85')]('dialTimezone',_0x379c('0x9c'));var _0x423aef=util[_0x379c('0x10')](_0x379c('0x9d'),_0x5e760d,_0x3e6e3b,_0x5341ef,_0x24d4e4[_0x379c('0x49')],_0x24d4e4[_0x379c('0x9e')]||null,NOW,NOW);if(_[_0x379c('0x21')](_0x5683c2[_0x379c('0x30')])){_0x423aef+=_0x379c('0x9f');}_0x1ef46e[_0x379c('0x20')](_0x423aef);if(_0x24d4e4[_0x379c('0x96')]&&_0x24d4e4['duplicates'][_0x379c('0x1d')]){_0x1ef46e[_0x379c('0x20')](insertCmContact(_0x24d4e4[_0x379c('0x49')],_0x3e6e3b,_0x24d4e4[_0x379c('0x96')],_0x5683c2));_0x1ef46e['push']('DROP\x20TABLE\x20'+_0x3e6e3b+';');}BPromise['each'](_0x1ef46e,handleQuery)[_0x379c('0x1c')](function(_0x28af65){BPromise[_0x379c('0x1e')]([handleAdditionalPhones()])[_0x379c('0x1c')](function(){_0x1ef46e=[];for(var _0x31071d=0x0;_0x31071d\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','push','all','AdditionalPhones','length','split','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','phone','scheduledat','ContactId','priority','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','insert','into','createdAt','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','updatedAt','UserId','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','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','ListId','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','error','message','exit','errors','code','sequelize'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x9ffc,0x112));var _0xc9ff=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x9ffc[_0x24679e];return _0x291f21;};'use strict';var fs=require('fs');var path=require(_0xc9ff('0x0'));var _=require(_0xc9ff('0x1'));var Papa=require(_0xc9ff('0x2'));var util=require(_0xc9ff('0x3'));var BPromise=require(_0xc9ff('0x4'));var moment=require(_0xc9ff('0x5'));var squel=require(_0xc9ff('0x6'));var Redis=require(_0xc9ff('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0xc9ff('0x8'));var shared=require(_0xc9ff('0x9'));var logger=require('../../../config/logger')(_0xc9ff('0xa'));config[_0xc9ff('0xb')]=_[_0xc9ff('0xc')](config['redis'],{'host':_0xc9ff('0xd'),'port':0x18eb});var socket=require(_0xc9ff('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xc9ff('0xf')](_0xc9ff('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc9ff('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2b09df){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))*$/[_0xc9ff('0x11')](_0x2b09df);}function selectNotIn(_0x513ada,_0x28a6c0,_0x5b471a,_0x5ba21a,_0x4e0751){return squel[_0xc9ff('0x12')]()[_0xc9ff('0x13')]('phone')[_0xc9ff('0x14')](_0x5ba21a)[_0xc9ff('0x15')](_0x28a6c0,null,_0x28a6c0+'.id\x20=\x20'+_0x5ba21a+'.'+_0x5b471a)[_0xc9ff('0x16')](_0x5ba21a+'.'+_0x5b471a+'\x20=\x20'+_0x513ada+'.'+_0x5b471a)[_0xc9ff('0x16')](_0x28a6c0+_0xc9ff('0x17')+_0x4e0751['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1b0504,_0x2fff98){promisesAdditionalPhones=[];return db[_0xc9ff('0x18')][_0xc9ff('0x19')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc9ff('0x1a')](function(_0x181161){if(_0x181161!==null){var _0x15ce80=[];for(var _0x416be0=0x0;_0x416be0<_0x181161['length'];_0x416be0++){var _0x3d8104=_0x181161[_0x416be0];_0x15ce80[_0xc9ff('0x1b')](insertAdditionalPhones(_0x3d8104));}}Promise[_0xc9ff('0x1c')](_0x15ce80)['then'](function(){_0x1b0504({'val':0x1});});});});}function insertAdditionalPhones(_0x11493a){return new Promise(function(_0x16dc69,_0x34cb6d){var _0x90e30d=_0x11493a[_0xc9ff('0x1d')];var _0x59ebb3=_0x90e30d['split'](';');var _0x1175cb=[];orderBy=0x0;for(var _0x37fc5a=0x0;_0x37fc5a<_0x59ebb3[_0xc9ff('0x1e')];_0x37fc5a++){_0x1175cb[_0xc9ff('0x1b')](splitAdditionalPhone(_0x11493a['id'],_0x59ebb3[_0x37fc5a]));}Promise[_0xc9ff('0x1c')](_0x1175cb)['then'](function(){_0x16dc69({'val':_0x59ebb3[_0xc9ff('0x1e')]});});});}function splitAdditionalPhone(_0x2e68e7,_0x18902d){return new Promise(function(_0x1e384e,_0x5e3b05){var _0x399a07=_0x18902d[_0xc9ff('0x1f')](':');var _0x56ce41=_0x399a07[0x0];var _0x2cd2ca=_0x399a07[0x1];if(!_[_0xc9ff('0x20')](_0x2cd2ca)){var _0x3a3aea=_0x2cd2ca['split']('|');var _0x15eb8f=[];for(var _0x4244a9=0x0;_0x4244a9<_0x3a3aea[_0xc9ff('0x1e')];_0x4244a9++){if(_0x3a3aea[_0x4244a9]!==''){var _0x164b52=_[_0xc9ff('0x21')](promisesAdditionalPhones,{'contactId':_0x2e68e7,'phone':_0x3a3aea[_0x4244a9]});if(_0x164b52[_0xc9ff('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2e68e7,'contactTypeId':_0x56ce41,'phone':_0x3a3aea[_0x4244a9],'orderBy':orderBy});}}}_0x1e384e({'ok':0x1});}else _0x1e384e({'res':0x0});});}function createAdditionalPhone(_0x48adad,_0xb4ed97,_0x5a82d5,_0x12a090){var _0x19dcbf='';var _0x868b1d='';var _0x4ce9a4=_0x5a82d5[_0xc9ff('0x1f')]('§');_0x19dcbf=_0x4ce9a4[0x0];if(_0x4ce9a4[_0xc9ff('0x1e')]==0x2)_0x868b1d=_0x4ce9a4[0x1];return new Promise(function(_0x28c45d,_0x293fe7){return db[_0xc9ff('0x22')][_0xc9ff('0x23')]({'where':{'CmContactId':_0x48adad,'item':_0x19dcbf}})[_0xc9ff('0x1a')](function(_0x187859){if(_0x187859){return db[_0xc9ff('0x22')]['update']({'ItemTypeId':_0xb4ed97,'description':_0x868b1d,'OrderBy':_0x12a090},{'where':{'CmContactId':_0x48adad,'item':_0x19dcbf}})[_0xc9ff('0x1a')](function(_0x4e6365){_0x28c45d({'res':_0xc9ff('0x24')});});}else{return db[_0xc9ff('0x22')][_0xc9ff('0x25')]({'CmContactId':_0x48adad,'item':_0x19dcbf,'description':_0x868b1d,'ItemTypeId':_0xb4ed97,'OrderBy':_0x12a090,'ItemClass':_0xc9ff('0x26')})[_0xc9ff('0x1a')](function(_0x100eb5){_0x28c45d({'res':_0xc9ff('0x27')});});}});});}function insertCmHopper(_0x1a6574,_0x2133c,_0x4bb667,_0x1edcae,_0x4834fe){var _0x1d09ce=[_0xc9ff('0x28'),_0xc9ff('0x29'),'cm_contacts.id',_0xc9ff('0x2a'),_0x2133c+'.'+_0x1edcae,_0xc9ff('0x2b'),_0xc9ff('0x2c'),'cm_contacts.priority',_0xc9ff('0x2d'),'\x22'+_0x4834fe+'\x22'];return squel['insert']()['into'](_0xc9ff('0x2e'))[_0xc9ff('0x2f')]([_0xc9ff('0x30'),_0xc9ff('0x31'),_0xc9ff('0x32'),'ListId',_0x1edcae,'createdAt','updatedAt',_0xc9ff('0x33'),'UserId','recallme'],squel[_0xc9ff('0x12')]()[_0xc9ff('0x34')](_0x1d09ce)[_0xc9ff('0x14')](_0x2133c)[_0xc9ff('0x15')](_0xc9ff('0x35'),null,_0xc9ff('0x36')+_0x2133c+_0xc9ff('0x37'))[_0xc9ff('0x15')](_0x4bb667,null,_0x4bb667+'.id\x20=\x20'+_0x2133c+'.'+_0x1edcae)[_0xc9ff('0x16')](_0x2133c+_0xc9ff('0x38'),_0x1a6574)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc9ff('0x16')](_0xc9ff('0x39'),selectNotIn(_0x2133c,_0x4bb667,_0x1edcae,_0xc9ff('0x2e'),[_0xc9ff('0x3a'),_0xc9ff('0x3b')]))[_0xc9ff('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2133c,_0x4bb667,_0x1edcae,_0xc9ff('0x2e'),[_0xc9ff('0x3a')])))[_0xc9ff('0x3c')]();}function insertCmHopperBlack(_0x2da68c,_0x43d564,_0x1962cd,_0x4a771e){var _0x300151=[_0xc9ff('0x28'),_0xc9ff('0x3d'),'cm_contacts.ListId',_0x43d564+'.'+_0x4a771e,_0xc9ff('0x2b'),_0xc9ff('0x2c')];return squel[_0xc9ff('0x3e')]()[_0xc9ff('0x3f')]('cm_hopper_black')[_0xc9ff('0x2f')]([_0xc9ff('0x30'),_0xc9ff('0x32'),'ListId',_0x4a771e,_0xc9ff('0x40'),'updatedAt'],squel[_0xc9ff('0x12')]()[_0xc9ff('0x34')](_0x300151)[_0xc9ff('0x14')](_0x43d564)[_0xc9ff('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x43d564+_0xc9ff('0x37'))[_0xc9ff('0x15')](_0x1962cd,null,_0x1962cd+_0xc9ff('0x41')+_0x43d564+'.'+_0x4a771e)[_0xc9ff('0x16')](_0x43d564+_0xc9ff('0x38'),_0x2da68c)[_0xc9ff('0x16')](_0xc9ff('0x42'),NOW)[_0xc9ff('0x16')](_0xc9ff('0x39'),squel[_0xc9ff('0x12')]()[_0xc9ff('0x13')](_0xc9ff('0x30'))[_0xc9ff('0x14')](_0xc9ff('0x43'))[_0xc9ff('0x16')]('ListId\x20=\x20?',_0x2da68c)[_0xc9ff('0x16')](_0x4a771e+_0xc9ff('0x44')+_0x43d564+'.'+_0x4a771e)))['toString']();}function insertTzCmHopper(_0x59d034,_0x52fd14,_0x182f7c,_0x20a932,_0x558b9a,_0x5066b3){var _0x541c8c=[_0xc9ff('0x28'),_0xc9ff('0x45')+_0x5066b3+_0xc9ff('0x46'),_0xc9ff('0x3d'),_0xc9ff('0x2a'),_0x52fd14+'.'+_0x20a932,_0xc9ff('0x2b'),_0xc9ff('0x2c'),_0xc9ff('0x47'),'cm_contacts.UserId','\x22'+_0x558b9a+'\x22'];var _0x436f15=squel['insert']()['into']('cm_hopper')[_0xc9ff('0x2f')]([_0xc9ff('0x30'),_0xc9ff('0x31'),_0xc9ff('0x32'),'ListId',_0x20a932,_0xc9ff('0x40'),_0xc9ff('0x48'),'priority',_0xc9ff('0x49'),'recallme'],squel['select']()[_0xc9ff('0x34')](_0x541c8c)[_0xc9ff('0x14')](_0x52fd14)['join'](_0xc9ff('0x35'),null,_0xc9ff('0x36')+_0x52fd14+_0xc9ff('0x37'))[_0xc9ff('0x15')](_0x182f7c,null,_0x182f7c+_0xc9ff('0x41')+_0x52fd14+'.'+_0x20a932)['join'](_0x5066b3,null,_0x5066b3+_0xc9ff('0x41')+_0x52fd14+'.'+_0x20a932)[_0xc9ff('0x16')](_0x52fd14+_0xc9ff('0x38'),_0x59d034)[_0xc9ff('0x16')](_0xc9ff('0x42'),NOW)[_0xc9ff('0x16')](_0xc9ff('0x39'),selectNotIn(_0x52fd14,_0x182f7c,_0x20a932,_0xc9ff('0x2e'),[_0xc9ff('0x3a'),_0xc9ff('0x3b')]))[_0xc9ff('0x16')](_0xc9ff('0x39'),selectNotIn(_0x52fd14,_0x182f7c,_0x20a932,_0xc9ff('0x2e'),[_0xc9ff('0x3a')])))['toString']();return _0x436f15;}function insertTzCmHopperBlack(_0x2d4ef6,_0x36bd0b,_0x243062,_0x40998e){var _0x97e86f=[_0xc9ff('0x28'),'cm_contacts.id',_0xc9ff('0x2a'),_0x36bd0b+'.'+_0x40998e,_0xc9ff('0x2b'),'cm_contacts.updatedAt'];return squel[_0xc9ff('0x3e')]()[_0xc9ff('0x3f')]('cm_hopper_black')['fromQuery']([_0xc9ff('0x30'),'ContactId','ListId',_0x40998e,_0xc9ff('0x40'),'updatedAt'],squel[_0xc9ff('0x12')]()[_0xc9ff('0x34')](_0x97e86f)['from'](_0x36bd0b)[_0xc9ff('0x15')](_0xc9ff('0x35'),null,_0xc9ff('0x36')+_0x36bd0b+'.CmListId')[_0xc9ff('0x15')](_0x243062,null,_0x243062+_0xc9ff('0x41')+_0x36bd0b+'.'+_0x40998e)[_0xc9ff('0x16')](_0x36bd0b+_0xc9ff('0x38'),_0x2d4ef6)[_0xc9ff('0x16')](_0xc9ff('0x42'),NOW)[_0xc9ff('0x16')](_0xc9ff('0x39'),squel[_0xc9ff('0x12')]()['field']('phone')['from'](_0xc9ff('0x43'))[_0xc9ff('0x16')](_0xc9ff('0x4a'),_0x2d4ef6)[_0xc9ff('0x16')](_0x40998e+_0xc9ff('0x44')+_0x36bd0b+'.'+_0x40998e)))[_0xc9ff('0x3c')]();}function insertCmHopperAdditionalPhones(_0x3fd742){var _0x24d9cf=[_0xc9ff('0x4b'),_0xc9ff('0x4c'),_0xc9ff('0x4d'),_0xc9ff('0x4e'),_0xc9ff('0x4f')];return squel[_0xc9ff('0x3e')]()['into'](_0xc9ff('0x50'))[_0xc9ff('0x2f')]([_0xc9ff('0x51'),_0xc9ff('0x30'),_0xc9ff('0x52'),_0xc9ff('0x40'),_0xc9ff('0x48')],squel['select']()[_0xc9ff('0x34')](_0x24d9cf)[_0xc9ff('0x14')]('cm_hopper')[_0xc9ff('0x15')]('cm_contacts',null,_0xc9ff('0x53'))[_0xc9ff('0x15')](_0xc9ff('0x54'),null,_0xc9ff('0x55'))[_0xc9ff('0x16')]('cm_hopper.ListId\x20=\x20?',_0x3fd742)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0xc9ff('0x3c')]();}function insertCmContact(_0x551b3e,_0x4fb944,_0x107581,_0x45ac94){var _0x2c49b2=_['concat'](_[_0xc9ff('0x56')](_0x45ac94),[_0xc9ff('0x57'),_0xc9ff('0x58'),_0xc9ff('0x40'),'updatedAt',_0xc9ff('0x59')]);return squel[_0xc9ff('0x3e')]()[_0xc9ff('0x3f')](_0xc9ff('0x35'))[_0xc9ff('0x2f')](_0x2c49b2,squel['select']()['fields'](_0x2c49b2)[_0xc9ff('0x14')](_0x4fb944)[_0xc9ff('0x16')]('('+_0x107581[_0xc9ff('0x15')](',')+_0xc9ff('0x5a'),squel[_0xc9ff('0x12')]()[_0xc9ff('0x34')](_0x107581)[_0xc9ff('0x14')](_0xc9ff('0x35'))[_0xc9ff('0x16')]('ListId\x20=\x20?',_0x551b3e)[_0xc9ff('0x16')](_0xc9ff('0x5b')))[_0xc9ff('0x16')](_0xc9ff('0x5c'),squel[_0xc9ff('0x12')]()['field']('MIN(id)','min_id')[_0xc9ff('0x14')](_0x4fb944)['group'](_0x107581[_0xc9ff('0x15')](','))))['toString']();}function handleStop(){logger[_0xc9ff('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x53efd0){logger[_0xc9ff('0x5e')](_0x53efd0[_0xc9ff('0x5f')]);process[_0xc9ff('0x60')](0x1);}function handleError(_0xcbadf4,_0x337933){stats[_0xc9ff('0x61')][_0xc9ff('0x1b')]({'name':_0x337933[_0xc9ff('0x62')],'message':_0x337933[_0xc9ff('0x5f')],'row':_0xcbadf4});}function handleQuery(_0x22a977){logger['info'](_0x22a977);return db[_0xc9ff('0x63')][_0xc9ff('0x64')](_0x22a977)[_0xc9ff('0x65')](function(_0x2253cc){results['push'](_0x2253cc);})[_0xc9ff('0x66')](function(_0x47963c){logger['error'](_0x47963c['message']);});}function updateTzCampaigns(_0x3d6620){return new Promise(function(_0x37d6de,_0x19df22){var _0x4af767=squel[_0xc9ff('0x12')]()[_0xc9ff('0x34')]([_0xc9ff('0x67'),_0xc9ff('0x68')])[_0xc9ff('0x14')](_0xc9ff('0x69'))[_0xc9ff('0x15')](_0xc9ff('0x6a'),null,_0xc9ff('0x6b'))[_0xc9ff('0x16')](_0xc9ff('0x6c')+_0x3d6620);db['sequelize'][_0xc9ff('0x64')](_0x4af767['toString']())['spread'](function(_0xfb2461){var _0x3d28bb=[];for(var _0x1aaa74=0x0;_0x1aaa74<_0xfb2461[_0xc9ff('0x1e')];_0x1aaa74++){_0x3d28bb[_0xc9ff('0x1b')](getTimezoneData(_0xfb2461[_0x1aaa74],tmp_campaigns));}BPromise[_0xc9ff('0x1c')](_0x3d28bb)[_0xc9ff('0x1a')](function(){_0x37d6de({'val':0x1});});})[_0xc9ff('0x66')](function(_0x25804c){logger[_0xc9ff('0x5e')](_0x25804c['message']);_0x37d6de({'val':0x0});});});}function updateTzVoiceQueues(_0x387b5f){return new Promise(function(_0x3c48aa,_0x527bfd){var _0x25b6a1=squel['select']()['fields']([_0xc9ff('0x6d'),_0xc9ff('0x6e')])[_0xc9ff('0x14')](_0xc9ff('0x6f'))[_0xc9ff('0x15')](_0xc9ff('0x70'),null,_0xc9ff('0x71'))[_0xc9ff('0x16')](_0xc9ff('0x72')+_0x387b5f);db['sequelize'][_0xc9ff('0x64')](_0x25b6a1['toString']())[_0xc9ff('0x65')](function(_0x362784){var _0x22c0f0=[];for(var _0x5797d2=0x0;_0x5797d2<_0x362784['length'];_0x5797d2++){_0x22c0f0[_0xc9ff('0x1b')](getTimezoneData(_0x362784[_0x5797d2],tmp_voice_queues));}BPromise[_0xc9ff('0x1c')](_0x22c0f0)[_0xc9ff('0x1a')](function(){_0x3c48aa({'val':0x1});});})['catch'](function(_0x1c0c24){logger['error'](_0x1c0c24[_0xc9ff('0x5f')]);_0x3c48aa({'val':0x0});});});}function getTimezoneData(_0x5c606e,_0x228829){return new Promise(function(_0x14c0ee,_0x62c5d8){var _0x1b8cb2=shared['timezones'];var _0x12bbb1=_0x1b8cb2[_0x5c606e[_0xc9ff('0x73')]];if(_['isNil'](_0x12bbb1)){_0x14c0ee({'ret':0x1});}else{var _0x626c14=_0x12bbb1['utcOffset'];var _0x2a6e1d=squel['insert']()[_0xc9ff('0x3f')](_0x228829)[_0xc9ff('0x74')]('id',_0x5c606e['id'])[_0xc9ff('0x74')](_0xc9ff('0x75'),_0x626c14)[_0xc9ff('0x74')](_0xc9ff('0x73'),_0x5c606e[_0xc9ff('0x73')])[_0xc9ff('0x3c')]();return db['sequelize']['query'](_0x2a6e1d)[_0xc9ff('0x65')](function(_0x4aedad){_0x14c0ee({'ret':0x1});})[_0xc9ff('0x66')](function(_0x5dc9be){logger[_0xc9ff('0x5e')](_0x5dc9be[_0xc9ff('0x5f')]);_0x62c5d8({'ret':0x1});});}});}function handleTZQuery(_0x22c6d9){logger[_0xc9ff('0x5d')](_0x22c6d9);return db[_0xc9ff('0x63')]['query'](_0x22c6d9)['spread'](function(_0xe05cdb){})[_0xc9ff('0x66')](function(_0x300237){logger[_0xc9ff('0x5e')](_0x300237[_0xc9ff('0x5f')]);});}function main(_0x37cf67,_0x1bf8a2,_0x8d3b52,_0x1ab06d){logger[_0xc9ff('0x5d')](_0xc9ff('0x76'),_0x37cf67,JSON[_0xc9ff('0x77')](_0x1bf8a2));process[_0xc9ff('0x78')]('start');var _0x82a3ca=_0x1bf8a2['binding'];var _0x49d9a1=_[_0xc9ff('0x79')](_0x82a3ca);var _0x180705=_0x1bf8a2[_0xc9ff('0x7a')];var _0xf7da8c=path[_0xc9ff('0x15')](config[_0xc9ff('0x7b')],'server/files/tmp',_0x180705+_0xc9ff('0x7c'));hasTZ=_['keys'](_0x82a3ca)[_0xc9ff('0x7d')](_0xc9ff('0x73'));var _0x365b85=_[_0xc9ff('0x56')](_0x82a3ca)['join']();logger['info'](_0xc9ff('0x7e'),_0x365b85);db[_0xc9ff('0x7f')]['findAll']({'raw':!![],'attributes':['id',_0xc9ff('0x80')]})[_0xc9ff('0x1a')](function(_0xe76eef){for(var _0x3c1e6e=0x0;_0x3c1e6e<_0xe76eef['length'];_0x3c1e6e++){if(_0xe76eef[_0x3c1e6e][_0xc9ff('0x80')]in _0x82a3ca){contactItemTypes[_0xc9ff('0x1b')](_0xe76eef[_0x3c1e6e]);delete _0x49d9a1[_0xe76eef[_0x3c1e6e][_0xc9ff('0x80')]];hasAdditionalPhones=!![];}for(var _0xb7786e in _0x82a3ca){if(_0xe76eef[_0x3c1e6e][_0xc9ff('0x80')]+_0xc9ff('0x81')===_0xb7786e){phoneDescriptions[_0xc9ff('0x1b')]({'itemTypeId':_0xe76eef[_0x3c1e6e]['id'],'description':_0xb7786e});delete _0x49d9a1[_0xb7786e];}}}if(hasAdditionalPhones)_0x49d9a1[_0xc9ff('0x1d')]='';var _0x281c47=_[_0xc9ff('0x56')](_0x49d9a1)[_0xc9ff('0x15')]();logger[_0xc9ff('0x5d')](_0xc9ff('0x7e'),_0x281c47);fs[_0xc9ff('0x82')](_0xf7da8c,_0x281c47+'\x0a');Papa[_0xc9ff('0x83')](fs['createReadStream'](_0x37cf67),{'header':!![],'skipEmptyLines':!![],'step':function(_0x159859,_0x175852){try{for(var _0x507531=0x0,_0x177862=[];_0x507531<_0x159859[_0xc9ff('0x84')]['length'];_0x507531++){stats[_0xc9ff('0x85')]+=0x1;if(_0x159859[_0xc9ff('0x61')][_0x507531]){handleError(_0x159859['data'][_0x507531],_0x159859['errors'][_0x507531]);}else{var _0x41caf5=[];var _0xd2e6bb=[];var _0x4c42cb={};for(var _0xe6fdba in _0x82a3ca){let _0x42f569=contactItemTypes[_0xc9ff('0x86')](_0x17d90e=>_0x17d90e[_0xc9ff('0x80')]===_0xe6fdba);let _0x21159f=contactItemTypes['find'](_0x4fd3a9=>_0x4fd3a9[_0xc9ff('0x80')]+'_description'===_0xe6fdba);if(_[_0xc9ff('0x20')](_0x42f569)&&_[_0xc9ff('0x20')](_0x21159f)){if(_0x82a3ca[_0xc9ff('0x87')](_0xe6fdba)){if(_0x159859[_0xc9ff('0x84')][_0x507531][_0x82a3ca[_0xe6fdba]]){var _0x4e9800=_[_0xc9ff('0x88')](_0x159859[_0xc9ff('0x84')][_0x507531][_0x82a3ca[_0xe6fdba]][_0xc9ff('0x89')](/"/g,'\x27'));switch(_0xe6fdba){case _0xc9ff('0x31'):var _0x42139b=moment(_0x4e9800,_0xc9ff('0x10'),!![]);if(_0x42139b[_0xc9ff('0x8a')]()){_0x177862[_0xc9ff('0x1b')]('\x22'+_0x4e9800+'\x22');}else{_0x41caf5[_0xc9ff('0x1b')](_0xc9ff('0x8b'));}break;case'priority':var _0x32e31e=parseInt(_0x4e9800);_0x4e9800=_[_0xc9ff('0x8c')](_0x32e31e)||_0x32e31e<0x0||_0x32e31e>0x4?_0x1ab06d?0x3:0x2:_0x32e31e;_0x177862['push']('\x22'+_0x4e9800+'\x22');break;case'UserId':var _0x489131=parseInt(_0x4e9800);if(_[_0xc9ff('0x8d')](_0x489131)&&_['includes'](_0x8d3b52,_0x489131)){_0x177862[_0xc9ff('0x1b')]('\x22'+_0x489131+'\x22');}else{_0x41caf5[_0xc9ff('0x1b')]('agent\x20not\x20exists');}break;case _0xc9ff('0x8e'):if(isEmail(_0x4e9800)){_0x177862[_0xc9ff('0x1b')]('\x22'+_0x4e9800+'\x22');}else{_0x41caf5[_0xc9ff('0x1b')](_0xc9ff('0x8f'));}break;case'dateOfBirth':var _0x4af508=moment(_0x4e9800,_0xc9ff('0x90'),!![]);if(_0x4af508[_0xc9ff('0x8a')]()){_0x177862[_0xc9ff('0x1b')]('\x22'+_0x4e9800+'\x22');}else{_0x41caf5['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xc9ff('0x73'):var _0x24a671=shared['timezones'];var _0x22cec0=_0x24a671[_0x4e9800];if(!_['isNil'](_0x22cec0)){var _0x3479f7=_0x22cec0[_0xc9ff('0x91')];_0x177862['push']('\x22'+_0x4e9800+'\x22');_0x177862[_0xc9ff('0x1b')]('\x22'+_0x3479f7+'\x22');}break;default:_0x177862[_0xc9ff('0x1b')]('\x22'+_0x4e9800+'\x22');}}else{switch(_0xe6fdba){case _0xc9ff('0x92'):case'phone':_0x41caf5[_0xc9ff('0x1b')](_0xe6fdba+_0xc9ff('0x93'));break;default:_0x177862[_0xc9ff('0x1b')]('\x22\x22');}}}}else{var _0x3166f='';if(!_['isNil'](_0x42f569)){if(!_0x4c42cb[_0xc9ff('0x87')](_0x42f569['id'])){if(!_['isNil'](_0x159859[_0xc9ff('0x84')][_0x507531][_0x82a3ca[_0xe6fdba]])){var _0x4e9800=_[_0xc9ff('0x88')](_0x159859['data'][_0x507531][_0x82a3ca[_0xe6fdba]]['replace'](/"/g,'\x27'));var _0x120d8a=phoneDescriptions[_0xc9ff('0x86')](_0x4c1149=>_0x4c1149[_0xc9ff('0x94')]===_0x42f569['id']);if(!_[_0xc9ff('0x20')](_0x120d8a)){var _0x4cc929=_['trim'](_0x159859[_0xc9ff('0x84')][_0x507531][_0x82a3ca[_0x120d8a[_0xc9ff('0x95')]]]['replace'](/"/g,'\x27'));if(!_[_0xc9ff('0x20')](_0x4cc929))_0x4e9800=_0x4e9800+'§'+_0x4cc929;}if(_0x3166f=='')_0x3166f=_0x4e9800;else _0x3166f+='|'+_0x4e9800;}_0xd2e6bb[_0xc9ff('0x1b')](_0x42f569['id']+':'+_0x3166f);_0x4c42cb[_0x42f569['id']]=0x1;}}}}if(hasAdditionalPhones){_0x177862[_0xc9ff('0x1b')]('\x22'+_0xd2e6bb[_0xc9ff('0x15')](';')+'\x22');}if(_0x41caf5[_0xc9ff('0x1e')]){handleError(_0x159859['data'][_0x507531],{'code':_0xc9ff('0x96'),'message':_0x41caf5['join']()});}else{fs[_0xc9ff('0x97')](_0xf7da8c,_0x177862[_0xc9ff('0x15')]()+'\x0a');}_0x177862=[];}if(!(stats[_0xc9ff('0x85')]%0xc8)){socket[_0xc9ff('0x98')]('contact:import:'+_0x180705,stats);stats[_0xc9ff('0x61')]=[];}}if(stopped){logger[_0xc9ff('0x5d')](_0xc9ff('0x99'));_0x175852[_0xc9ff('0x9a')]();}}catch(_0x530691){handleError(_0x159859[_0xc9ff('0x84')][_0x507531],{'code':_0xc9ff('0x9b'),'message':_0x530691[_0xc9ff('0x5f')]});logger[_0xc9ff('0x5e')](_0xc9ff('0x9c'),_0x530691['message']);}},'complete':function(){try{var _0x3a5de6=[];var _0x101768=[];var _0x225930='cm_contacts';if(_0x1bf8a2['duplicates']&&_0x1bf8a2[_0xc9ff('0x9d')]['length']){_0x225930=_0xc9ff('0x9e')+_0x180705;_0x3a5de6[_0xc9ff('0x1b')](_0xc9ff('0x9f')+_0x225930+_0xc9ff('0xa0'));}tmp_campaigns='campaigns_'+_0x180705;tmp_voice_queues='voice_queues_'+_0x180705;_0x101768['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0xc9ff('0xa1'));_0x101768[_0xc9ff('0x1b')](_0xc9ff('0x9f')+tmp_voice_queues+_0xc9ff('0xa1'));BPromise['each'](_0x101768,handleTZQuery)[_0xc9ff('0x1a')](function(_0x50405c){updateTzCampaigns(_0x1bf8a2[_0xc9ff('0x57')])[_0xc9ff('0x1a')](function(_0x198a55){updateTzVoiceQueues(_0x1bf8a2[_0xc9ff('0x57')])[_0xc9ff('0x1a')](function(_0x2076e4){if(hasTZ)_0x281c47=_0x281c47[_0xc9ff('0x89')](_0xc9ff('0x73'),'dialTimezone,utcOffset');var _0x282c3c=util[_0xc9ff('0xf')]('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',_0xf7da8c,_0x225930,_0x281c47,_0x1bf8a2['ListId'],_0x1bf8a2[_0xc9ff('0x58')]||null,NOW,NOW);if(_[_0xc9ff('0x20')](_0x82a3ca[_0xc9ff('0x31')])){_0x282c3c+=_0xc9ff('0xa2');}_0x3a5de6[_0xc9ff('0x1b')](_0x282c3c);if(_0x1bf8a2['duplicates']&&_0x1bf8a2[_0xc9ff('0x9d')][_0xc9ff('0x1e')]){_0x3a5de6[_0xc9ff('0x1b')](insertCmContact(_0x1bf8a2[_0xc9ff('0x57')],_0x225930,_0x1bf8a2['duplicates'],_0x82a3ca));_0x3a5de6[_0xc9ff('0x1b')](_0xc9ff('0xa3')+_0x225930+';');}BPromise['each'](_0x3a5de6,handleQuery)['then'](function(_0x41c453){BPromise['all']([handleAdditionalPhones()])[_0xc9ff('0x1a')](function(){_0x3a5de6=[];for(var _0x726d7b=0x0;_0x726d7b\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','phone','AdditionalPhones','all','then','catch','error','message','split','push','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt'];(function(_0x2a05a0,_0x1e0ce2){var _0x3e70ae=function(_0x338d78){while(--_0x338d78){_0x2a05a0['push'](_0x2a05a0['shift']());}};_0x3e70ae(++_0x1e0ce2);}(_0x2c5b,0x193));var _0xb2c5=function(_0x27255d,_0x360ee4){_0x27255d=_0x27255d-0x0;var _0x3c73fc=_0x2c5b[_0x27255d];return _0x3c73fc;};'use strict';var fs=require('fs');var path=require(_0xb2c5('0x0'));var _=require('lodash');var Papa=require(_0xb2c5('0x1'));var util=require(_0xb2c5('0x2'));var BPromise=require(_0xb2c5('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xb2c5('0x4'));var db=require(_0xb2c5('0x5'))['db'];var config=require(_0xb2c5('0x6'));var logger=require(_0xb2c5('0x7'))('import');config[_0xb2c5('0x8')]=_[_0xb2c5('0x9')](config[_0xb2c5('0x8')],{'host':_0xb2c5('0xa'),'port':0x18eb});var socket=require(_0xb2c5('0xb'))(new Redis(config[_0xb2c5('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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xb2c5('0xc')+moment()[_0xb2c5('0xd')](_0xb2c5('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x58979f){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))*$/[_0xb2c5('0xf')](_0x58979f);}function selectNotIn(_0x79a3b9,_0x4876d4,_0x51d47a,_0x2a369b,_0x2e533e){return squel[_0xb2c5('0x10')]()[_0xb2c5('0x11')]('phone')[_0xb2c5('0x12')](_0x2a369b)[_0xb2c5('0x13')](_0x4876d4,null,_0x4876d4+_0xb2c5('0x14')+_0x2a369b+'.'+_0x51d47a)[_0xb2c5('0x15')](_0x2a369b+'.'+_0x51d47a+'\x20=\x20'+_0x79a3b9+'.'+_0x51d47a)['where'](_0x4876d4+_0xb2c5('0x16')+_0x2e533e[_0xb2c5('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x409398,_0xd516b8){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb2c5('0x17')][_0xb2c5('0x18')](_0xb2c5('0x19')+tempTableName)[_0xb2c5('0x1a')](function(_0x6ede6){if(_0x6ede6!==null){var _0x53e60b=[];for(var _0xb6a3ea=0x0;_0xb6a3ea<_0x6ede6[_0xb2c5('0x1b')];_0xb6a3ea++){var _0x4419db=_0x6ede6[_0xb6a3ea];if(!_['isNil'](_0x4419db[_0xb2c5('0x1c')])){if(!_['isNil'](_0x4419db[_0xb2c5('0x1d')]))_0x53e60b['push'](insertAdditionalPhones(_0x4419db));promisesContact['push']({'contact':_0x4419db});}}}Promise[_0xb2c5('0x1e')](_0x53e60b)[_0xb2c5('0x1f')](function(){_0x409398({'val':0x1});});})[_0xb2c5('0x20')](function(_0x434f04){logger[_0xb2c5('0x21')](_0x434f04[_0xb2c5('0x22')]);});});}function insertAdditionalPhones(_0x15784a){return new Promise(function(_0xccbb12,_0x130123){var _0xcb297b=_0x15784a[_0xb2c5('0x1d')];if(_['isNil'](_0xcb297b))_0x130123({'val':0x0});else{var _0x14b490=_0xcb297b[_0xb2c5('0x23')](';');var _0x3d24f2=[];orderBy=0x0;for(var _0x50cc75=0x0;_0x50cc75<_0x14b490[_0xb2c5('0x1b')];_0x50cc75++){_0x3d24f2[_0xb2c5('0x24')](splitAdditionalPhone(_0x15784a['id'],_0x14b490[_0x50cc75]));}Promise['all'](_0x3d24f2)[_0xb2c5('0x1f')](function(){_0xccbb12({'val':_0x14b490[_0xb2c5('0x1b')]});});}});}function splitAdditionalPhone(_0x7e3814,_0x48d61d){return new Promise(function(_0x817101,_0x49d615){var _0x1bf599=_0x48d61d[_0xb2c5('0x23')](':');var _0x25ba5f=_0x1bf599[0x0];var _0x123b7c=_0x1bf599[0x1];if(_0x123b7c!==''){var _0x439109=_0x123b7c[_0xb2c5('0x23')]('|');var _0x4ccd68=[];for(var _0x3147b3=0x0;_0x3147b3<_0x439109[_0xb2c5('0x1b')];_0x3147b3++){if(_0x439109[_0x3147b3]!==''){var _0x4df7d6=_[_0xb2c5('0x25')](promisesAdditionalPhones,{'contactId':_0x7e3814,'phone':_0x439109[_0x3147b3]});if(_0x4df7d6['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x7e3814,'contactTypeId':_0x25ba5f,'phone':_0x439109[_0x3147b3],'orderBy':orderBy});}}}_0x817101({'ok':0x1});}else _0x817101({'res':0x0});});}function createAdditionalPhone(_0x5cfacc,_0x53a524,_0xe69b01,_0x19d5b9){var _0x4f0f0f='';var _0x2926c0='';var _0x214e73=_0xe69b01['split']('§');_0x4f0f0f=_0x214e73[0x0];if(_0x214e73['length']==0x2)_0x2926c0=_0x214e73[0x1];return new Promise(function(_0x38d5a9,_0x29e5ec){return db[_0xb2c5('0x26')][_0xb2c5('0x27')]({'where':{'CmContactId':_0x5cfacc,'item':_0x4f0f0f}})['then'](function(_0x5ce606){if(_0x5ce606){return db[_0xb2c5('0x26')][_0xb2c5('0x28')]({'ItemTypeId':_0x53a524,'description':_0x2926c0,'OrderBy':_0x19d5b9},{'where':{'CmContactId':_0x5cfacc,'item':_0x4f0f0f}})[_0xb2c5('0x1f')](function(_0x33e881){_0x38d5a9({'res':_0xb2c5('0x29')});});}else{return db[_0xb2c5('0x26')][_0xb2c5('0x2a')]({'CmContactId':_0x5cfacc,'item':_0x4f0f0f,'ItemTypeId':_0x53a524,'description':_0x2926c0,'OrderBy':_0x19d5b9,'ItemClass':_0xb2c5('0x2b')})['then'](function(_0x183a3c){_0x38d5a9({'res':_0xb2c5('0x2c')});});}});});}function updateContact(_0x519a01){return new Promise(function(_0x3a85cd,_0x1d6f97){var _0xcc291a=_0x519a01['id'];delete _0x519a01['id'];return db[_0xb2c5('0x2d')][_0xb2c5('0x28')](_0x519a01,{'where':{'id':_0xcc291a}})['then'](function(_0x5c6320){updatedRows+=0x1;return db['CmHopper'][_0xb2c5('0x28')]({'phone':_0x519a01[_0xb2c5('0x1c')]},{'where':{'ContactId':_0xcc291a}})[_0xb2c5('0x1f')](function(_0x3365d9){_0x3a85cd({'ret':'OK'});});});});}function insertCmHopper(_0x59bf79,_0x2b97d8,_0x4972bc,_0x420f77,_0x30950a){var _0x15dcd8=['cm_contacts.phone',_0xb2c5('0x2e'),_0xb2c5('0x2f'),_0xb2c5('0x30'),_0x2b97d8+'.'+_0x420f77,_0xb2c5('0x31'),'cm_contacts.updatedAt',_0xb2c5('0x32'),_0xb2c5('0x33'),'\x22'+_0x30950a+'\x22'];return squel[_0xb2c5('0x34')]()[_0xb2c5('0x35')](_0xb2c5('0x36'))[_0xb2c5('0x37')]([_0xb2c5('0x1c'),'scheduledat',_0xb2c5('0x38'),_0xb2c5('0x39'),_0x420f77,'createdAt','updatedAt','priority',_0xb2c5('0x3a'),_0xb2c5('0x3b')],squel[_0xb2c5('0x10')]()['fields'](_0x15dcd8)[_0xb2c5('0x12')](_0x2b97d8)[_0xb2c5('0x13')]('cm_contacts',null,_0xb2c5('0x3c')+_0x2b97d8+_0xb2c5('0x3d'))[_0xb2c5('0x13')](_0x4972bc,null,_0x4972bc+_0xb2c5('0x14')+_0x2b97d8+'.'+_0x420f77)['where'](_0x2b97d8+'.CmListId\x20=\x20?',_0x59bf79)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb2c5('0x3e'),selectNotIn(_0x2b97d8,_0x4972bc,_0x420f77,_0xb2c5('0x36'),[_0xb2c5('0x3f'),_0xb2c5('0x40')]))[_0xb2c5('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2b97d8,_0x4972bc,_0x420f77,_0xb2c5('0x36'),[_0xb2c5('0x3f')])))[_0xb2c5('0x41')]();}function insertCmHopperBlack(_0x5e4904,_0x56b9a3,_0x54ff6f,_0x59d65c){var _0x679aa1=[_0xb2c5('0x42'),_0xb2c5('0x2f'),_0xb2c5('0x30'),_0x56b9a3+'.'+_0x59d65c,_0xb2c5('0x31'),_0xb2c5('0x43')];return squel['insert']()[_0xb2c5('0x35')](_0xb2c5('0x44'))['fromQuery'](['phone',_0xb2c5('0x38'),'ListId',_0x59d65c,_0xb2c5('0x45'),_0xb2c5('0x46')],squel[_0xb2c5('0x10')]()[_0xb2c5('0x47')](_0x679aa1)['from'](_0x56b9a3)[_0xb2c5('0x13')](_0xb2c5('0x48'),null,'cm_contacts.ListId\x20=\x20'+_0x56b9a3+_0xb2c5('0x3d'))[_0xb2c5('0x13')](_0x54ff6f,null,_0x54ff6f+_0xb2c5('0x14')+_0x56b9a3+'.'+_0x59d65c)[_0xb2c5('0x15')](_0x56b9a3+_0xb2c5('0x49'),_0x5e4904)[_0xb2c5('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb2c5('0x15')](_0xb2c5('0x3e'),squel[_0xb2c5('0x10')]()['field'](_0xb2c5('0x1c'))[_0xb2c5('0x12')](_0xb2c5('0x44'))['where'](_0xb2c5('0x4a'),_0x5e4904)[_0xb2c5('0x15')](_0x59d65c+'\x20=\x20?',_0x56b9a3+'.'+_0x59d65c)))[_0xb2c5('0x41')]();}function insertCmHopperAdditionalPhones(_0x15d694){var _0x20501d=[_0xb2c5('0x4b'),_0xb2c5('0x4c'),'cm_contact_has_items.OrderBy',_0xb2c5('0x4d'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0xb2c5('0x4e'))[_0xb2c5('0x37')]([_0xb2c5('0x4f'),'phone',_0xb2c5('0x50'),_0xb2c5('0x45'),_0xb2c5('0x46')],squel[_0xb2c5('0x10')]()[_0xb2c5('0x47')](_0x20501d)[_0xb2c5('0x12')](_0xb2c5('0x36'))['join'](_0xb2c5('0x48'),null,_0xb2c5('0x51'))[_0xb2c5('0x13')](_0xb2c5('0x52'),null,_0xb2c5('0x53'))[_0xb2c5('0x15')](_0xb2c5('0x54'),_0x15d694)[_0xb2c5('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb2c5('0x41')]();}function insertCmContact(_0x21794e,_0x3fe11e,_0x47ea0e,_0x4c4dd1){var _0x2cb6e5=_[_0xb2c5('0x55')](_['keys'](_0x4c4dd1),[_0xb2c5('0x39'),'CompanyId',_0xb2c5('0x45'),_0xb2c5('0x46')]);return squel[_0xb2c5('0x34')]()[_0xb2c5('0x35')](_0xb2c5('0x48'))[_0xb2c5('0x37')](_0x2cb6e5,squel[_0xb2c5('0x10')]()['fields'](_0x2cb6e5)[_0xb2c5('0x12')](_0x3fe11e)['where']('('+_0x47ea0e['join'](',')+_0xb2c5('0x56'),squel[_0xb2c5('0x10')]()[_0xb2c5('0x47')](_0x47ea0e)[_0xb2c5('0x12')](_0xb2c5('0x48'))[_0xb2c5('0x15')](_0xb2c5('0x4a'),_0x21794e))['where'](_0xb2c5('0x57'),squel[_0xb2c5('0x10')]()['field']('MIN(id)',_0xb2c5('0x58'))[_0xb2c5('0x12')](_0x3fe11e)[_0xb2c5('0x59')](_0x47ea0e[_0xb2c5('0x13')](','))))[_0xb2c5('0x41')]();}function handleStop(){logger[_0xb2c5('0x5a')](_0xb2c5('0x5b'));stopped=!![];}function handleUncaughtException(_0x537d2f){logger[_0xb2c5('0x21')](_0x537d2f[_0xb2c5('0x22')]);process[_0xb2c5('0x5c')](0x1);}function handleError(_0x1f180e,_0x2fe21f){stats[_0xb2c5('0x5d')][_0xb2c5('0x24')]({'name':_0x2fe21f[_0xb2c5('0x5e')],'message':_0x2fe21f[_0xb2c5('0x22')],'row':_0x1f180e});}function handleQuery(_0x3d5a72){logger[_0xb2c5('0x5a')](_0x3d5a72);return db['sequelize']['query'](_0x3d5a72)[_0xb2c5('0x1a')](function(_0x2a4680){results[_0xb2c5('0x24')](_0x2a4680);})[_0xb2c5('0x20')](function(_0x1201a3){logger[_0xb2c5('0x21')](_0x1201a3[_0xb2c5('0x22')]);});}function main(_0x5a3301,_0x54127a,_0x4bc5ed,_0x276f2b){logger[_0xb2c5('0x5a')](_0xb2c5('0x5f'),_0x5a3301,JSON[_0xb2c5('0x60')](_0x54127a));process[_0xb2c5('0x61')]('start');var _0x2800ef=_0x54127a[_0xb2c5('0x62')];var _0x48b53f=_[_0xb2c5('0x63')](_0x2800ef);var _0x254817=_0x54127a[_0xb2c5('0x64')];var _0x42c320=path[_0xb2c5('0x13')](config[_0xb2c5('0x65')],'server/files/tmp',_0x254817+_0xb2c5('0x66'));logger[_0xb2c5('0x5a')](_0xb2c5('0x67'),_0x54127a);db[_0xb2c5('0x68')][_0xb2c5('0x69')]({'raw':!![],'attributes':['id',_0xb2c5('0x6a')]})[_0xb2c5('0x1f')](function(_0x349a97){for(var _0x57a818=0x0;_0x57a818<_0x349a97[_0xb2c5('0x1b')];_0x57a818++){if(_0x349a97[_0x57a818][_0xb2c5('0x6a')]in _0x2800ef){contactItemTypes[_0xb2c5('0x24')](_0x349a97[_0x57a818]);delete _0x48b53f[_0x349a97[_0x57a818][_0xb2c5('0x6a')]];hasAdditionalPhones=!![];}for(var _0x450d5d in _0x2800ef){if(_0x349a97[_0x57a818][_0xb2c5('0x6a')]+_0xb2c5('0x6b')===_0x450d5d){phoneDescriptions[_0xb2c5('0x24')]({'itemTypeId':_0x349a97[_0x57a818]['id'],'description':_0x450d5d});delete _0x48b53f[_0x450d5d];}}}if(hasAdditionalPhones)_0x48b53f[_0xb2c5('0x1d')]='';var _0x22f39f=_['keys'](_0x48b53f)[_0xb2c5('0x13')]();logger[_0xb2c5('0x5a')](_0xb2c5('0x6c'),_0x22f39f);fs[_0xb2c5('0x6d')](_0x42c320,_0x22f39f+'\x0a');Papa[_0xb2c5('0x6e')](fs[_0xb2c5('0x6f')](_0x5a3301),{'header':!![],'skipEmptyLines':!![],'step':function(_0x32e631,_0x53985e){try{for(var _0x32201a=0x0,_0x253776=[];_0x32201a<_0x32e631[_0xb2c5('0x70')]['length'];_0x32201a++){stats[_0xb2c5('0x71')]+=0x1;if(_0x32e631[_0xb2c5('0x5d')][_0x32201a]){handleError(_0x32e631[_0xb2c5('0x70')][_0x32201a],_0x32e631[_0xb2c5('0x5d')][_0x32201a]);}else{var _0x404af5=[];var _0x375eae=[];var _0x492be2={};for(var _0x4146fa in _0x2800ef){let _0xdacfa3=contactItemTypes['find'](_0x480b1c=>_0x480b1c[_0xb2c5('0x6a')]===_0x4146fa);let _0x5b0418=contactItemTypes[_0xb2c5('0x72')](_0x1be8d1=>_0x1be8d1[_0xb2c5('0x6a')]+_0xb2c5('0x6b')===_0x4146fa);if(_[_0xb2c5('0x73')](_0xdacfa3)&&_[_0xb2c5('0x73')](_0x5b0418)){if(_0x2800ef[_0xb2c5('0x74')](_0x4146fa)){if(_0x32e631[_0xb2c5('0x70')][_0x32201a][_0x2800ef[_0x4146fa]]){var _0x20176d=_[_0xb2c5('0x75')](_0x32e631['data'][_0x32201a][_0x2800ef[_0x4146fa]]['replace'](/"/g,'\x27'));switch(_0x4146fa){case _0xb2c5('0x76'):var _0x163549=moment(_0x20176d,_0xb2c5('0x77'),!![]);if(_0x163549[_0xb2c5('0x78')]()){_0x253776['push']('\x22'+_0x20176d+'\x22');}else{_0x404af5['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x2582be=parseInt(_0x20176d);_0x20176d=_[_0xb2c5('0x79')](_0x2582be)||_0x2582be<0x0||_0x2582be>0x4?_0x276f2b?0x3:0x2:_0x2582be;_0x253776[_0xb2c5('0x24')]('\x22'+_0x20176d+'\x22');break;case _0xb2c5('0x3a'):var _0x3ba5ac=parseInt(_0x20176d);if(_[_0xb2c5('0x7a')](_0x3ba5ac)&&_[_0xb2c5('0x7b')](_0x4bc5ed,_0x3ba5ac)){_0x253776[_0xb2c5('0x24')]('\x22'+_0x3ba5ac+'\x22');}else{_0x404af5[_0xb2c5('0x24')](_0xb2c5('0x7c'));}break;case _0xb2c5('0x7d'):if(isEmail(_0x20176d)){_0x253776[_0xb2c5('0x24')]('\x22'+_0x20176d+'\x22');}else{_0x404af5[_0xb2c5('0x24')](_0xb2c5('0x7e'));}break;case _0xb2c5('0x7f'):var _0x5e0228=moment(_0x20176d,'YYYY-MM-DD',!![]);if(_0x5e0228['isValid']()){_0x253776[_0xb2c5('0x24')]('\x22'+_0x20176d+'\x22');}else{_0x404af5[_0xb2c5('0x24')](_0xb2c5('0x80'));}break;default:_0x253776[_0xb2c5('0x24')]('\x22'+_0x20176d+'\x22');}}else{switch(_0x4146fa){case _0xb2c5('0x81'):case _0xb2c5('0x1c'):_0x404af5[_0xb2c5('0x24')](_0x4146fa+'\x20not\x20specified');break;default:_0x253776['push']('\x22\x22');}}}}else{var _0x4e14e9='';if(!_['isNil'](_0xdacfa3)){if(!_0x492be2['hasOwnProperty'](_0xdacfa3['id'])){for(var _0x48d01b=0x0;_0x48d01b<_0x2800ef[_0x4146fa][_0xb2c5('0x1b')];_0x48d01b++){var _0x20176d=_[_0xb2c5('0x75')](_0x32e631[_0xb2c5('0x70')][_0x32201a][_0x2800ef[_0x4146fa][_0x48d01b]][_0xb2c5('0x82')](/"/g,'\x27'));var _0x3c4ead=phoneDescriptions[_0xb2c5('0x72')](_0xebc8ef=>_0xebc8ef[_0xb2c5('0x83')]===_0xdacfa3['id']);if(!_['isNil'](_0x3c4ead)){var _0x5e7ab9=_[_0xb2c5('0x75')](_0x32e631[_0xb2c5('0x70')][_0x32201a][_0x2800ef[_0x3c4ead[_0xb2c5('0x84')]][0x0]][_0xb2c5('0x82')](/"/g,'\x27'));if(!_[_0xb2c5('0x73')](_0x5e7ab9))_0x20176d=_0x20176d+'§'+_0x5e7ab9;}if(_0x4e14e9=='')_0x4e14e9=_0x20176d;else _0x4e14e9+='|'+_0x20176d;}_0x375eae['push'](_0xdacfa3['id']+':'+_0x4e14e9);_0x492be2[_0xdacfa3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x253776[_0xb2c5('0x24')]('\x22'+_0x375eae[_0xb2c5('0x13')](';')+'\x22');}if(_0x404af5[_0xb2c5('0x1b')]){handleError(_0x32e631[_0xb2c5('0x70')][_0x32201a],{'code':_0xb2c5('0x85'),'message':_0x404af5[_0xb2c5('0x13')]()});}else{fs[_0xb2c5('0x86')](_0x42c320,_0x253776[_0xb2c5('0x13')]()+'\x0a');}_0x253776=[];}if(!(stats[_0xb2c5('0x71')]%0xc8)){socket[_0xb2c5('0x87')](_0xb2c5('0x88')+_0x254817,stats);stats[_0xb2c5('0x5d')]=[];}}if(stopped){logger[_0xb2c5('0x5a')]('Abort\x20parser');_0x53985e['abort']();}}catch(_0xa09c89){handleError(_0x32e631[_0xb2c5('0x70')][_0x32201a],{'code':_0xb2c5('0x89'),'message':_0xa09c89[_0xb2c5('0x22')]});logger[_0xb2c5('0x21')](_0xb2c5('0x8a'),_0xa09c89[_0xb2c5('0x22')]);}},'complete':function(){try{var _0x477e6d=[];var _0x547794=tempTableName;_0x477e6d[_0xb2c5('0x24')](_0xb2c5('0x8b')+_0x547794+_0xb2c5('0x8c'));logger[_0xb2c5('0x5a')](_0xb2c5('0x8d'),contactItemTypes[_0xb2c5('0x1b')]);var _0x43486e=util[_0xb2c5('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x42c320,_0x547794,_0x22f39f,_0x54127a[_0xb2c5('0x39')],_0x54127a['CompanyId']||null,NOW,NOW);if(_[_0xb2c5('0x73')](_0x2800ef[_0xb2c5('0x76')])){_0x43486e+=',\x20scheduledAt\x20=\x20NOW()';}_0x477e6d[_0xb2c5('0x24')](_0x43486e);BPromise[_0xb2c5('0x8e')](_0x477e6d,handleQuery)['then'](function(_0x595e0b){BPromise[_0xb2c5('0x1e')]([handleAdditionalPhones()])[_0xb2c5('0x1f')](function(){_0x477e6d=[];for(var _0x2d3224=0x0;_0x2d3224\x20\x20','root','existsSync','argv','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','length','isNil','AdditionalPhones','push','then','catch','error','message','split','all','filter','findOne','CmContactHasItem','update','updated','create','PHONE','CmContact','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.ListId','cm_hopper_black','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','exit','code','info','main','stringify','send','clone','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','parse','createReadStream','data','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','contact','contactTypeId','orderBy','DROP\x20TABLE\x20'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x129f,0x13f));var _0xf129=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x129f[_0x3ff085];return _0x2b68c3;};'use strict';var fs=require('fs');var path=require(_0xf129('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xf129('0x1'));var BPromise=require(_0xf129('0x2'));var moment=require(_0xf129('0x3'));var squel=require(_0xf129('0x4'));var Redis=require(_0xf129('0x5'));var db=require(_0xf129('0x6'))['db'];var config=require(_0xf129('0x7'));var logger=require(_0xf129('0x8'))('import');config[_0xf129('0x9')]=_[_0xf129('0xa')](config[_0xf129('0x9')],{'host':_0xf129('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf129('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xf129('0xd')+moment()[_0xf129('0xc')](_0xf129('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x200e06){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))*$/[_0xf129('0xf')](_0x200e06);}function selectNotIn(_0x4fed21,_0x3e5859,_0x3ee5f3,_0x46c758,_0x5d721f){return squel[_0xf129('0x10')]()[_0xf129('0x11')](_0xf129('0x12'))['from'](_0x46c758)[_0xf129('0x13')](_0x3e5859,null,_0x3e5859+_0xf129('0x14')+_0x46c758+'.'+_0x3ee5f3)[_0xf129('0x15')](_0x46c758+'.'+_0x3ee5f3+'\x20=\x20'+_0x4fed21+'.'+_0x3ee5f3)[_0xf129('0x15')](_0x3e5859+_0xf129('0x16')+_0x5d721f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2f2807,_0x4f548a){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf129('0x17')][_0xf129('0x18')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0xcb63c4){if(_0xcb63c4!==null){var _0x183902=[];for(var _0x47e227=0x0;_0x47e227<_0xcb63c4[_0xf129('0x19')];_0x47e227++){var _0x1d0eaa=_0xcb63c4[_0x47e227];if(!_['isNil'](_0x1d0eaa[_0xf129('0x12')])){if(!_[_0xf129('0x1a')](_0x1d0eaa[_0xf129('0x1b')]))_0x183902[_0xf129('0x1c')](insertAdditionalPhones(_0x1d0eaa));promisesContact['push']({'contact':_0x1d0eaa});}}}Promise['all'](_0x183902)[_0xf129('0x1d')](function(){_0x2f2807({'val':0x1});});})[_0xf129('0x1e')](function(_0x87334c){logger[_0xf129('0x1f')](_0x87334c[_0xf129('0x20')]);});});}function insertAdditionalPhones(_0x336dbc){return new Promise(function(_0xbd9489,_0x4e7744){var _0x11852d=_0x336dbc['AdditionalPhones'];if(_['isNil'](_0x11852d))_0x4e7744({'val':0x0});else{var _0x5b0fff=_0x11852d[_0xf129('0x21')](';');var _0x876b93=[];orderBy=0x0;for(var _0x199877=0x0;_0x199877<_0x5b0fff[_0xf129('0x19')];_0x199877++){_0x876b93[_0xf129('0x1c')](splitAdditionalPhone(_0x336dbc['id'],_0x5b0fff[_0x199877]));}Promise[_0xf129('0x22')](_0x876b93)[_0xf129('0x1d')](function(){_0xbd9489({'val':_0x5b0fff['length']});});}});}function splitAdditionalPhone(_0x4a2a01,_0x3d099a){return new Promise(function(_0xa859a1,_0x5dce81){var _0x2de3c2=_0x3d099a[_0xf129('0x21')](':');var _0xd44ece=_0x2de3c2[0x0];var _0x4ec979=_0x2de3c2[0x1];if(_0x4ec979!==''){var _0x8cb2fe=_0x4ec979['split']('|');var _0x5ad36d=[];for(var _0x35a432=0x0;_0x35a432<_0x8cb2fe[_0xf129('0x19')];_0x35a432++){if(_0x8cb2fe[_0x35a432]!==''){var _0x259555=_[_0xf129('0x23')](promisesAdditionalPhones,{'contactId':_0x4a2a01,'phone':_0x8cb2fe[_0x35a432]});if(_0x259555[_0xf129('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xf129('0x1c')]({'contactId':_0x4a2a01,'contactTypeId':_0xd44ece,'phone':_0x8cb2fe[_0x35a432],'orderBy':orderBy});}}}_0xa859a1({'ok':0x1});}else _0xa859a1({'res':0x0});});}function createAdditionalPhone(_0x39414c,_0xdee972,_0x3aa38f,_0x58ad4f){var _0x19225a='';var _0x391fe6='';var _0xaf4806=_0x3aa38f[_0xf129('0x21')]('§');_0x19225a=_0xaf4806[0x0];if(_0xaf4806['length']==0x2)_0x391fe6=_0xaf4806[0x1];return new Promise(function(_0x4da2bf,_0x112424){return db['CmContactHasItem'][_0xf129('0x24')]({'where':{'CmContactId':_0x39414c,'item':_0x19225a}})['then'](function(_0x2c1eac){if(_0x2c1eac){return db[_0xf129('0x25')][_0xf129('0x26')]({'ItemTypeId':_0xdee972,'description':_0x391fe6,'OrderBy':_0x58ad4f},{'where':{'CmContactId':_0x39414c,'item':_0x19225a}})[_0xf129('0x1d')](function(_0x35eb9b){_0x4da2bf({'res':_0xf129('0x27')});});}else{return db[_0xf129('0x25')][_0xf129('0x28')]({'CmContactId':_0x39414c,'item':_0x19225a,'ItemTypeId':_0xdee972,'description':_0x391fe6,'OrderBy':_0x58ad4f,'ItemClass':_0xf129('0x29')})['then'](function(_0x4765a7){_0x4da2bf({'res':'inserted'});});}});});}function updateContact(_0x3df15f){return new Promise(function(_0xc5b71,_0x3f9888){var _0x5137ea=_0x3df15f['id'];delete _0x3df15f['id'];return db[_0xf129('0x2a')][_0xf129('0x26')](_0x3df15f,{'where':{'id':_0x5137ea}})[_0xf129('0x1d')](function(_0x80c4fb){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x3df15f['phone']},{'where':{'ContactId':_0x5137ea}})[_0xf129('0x1d')](function(_0x5ef7ee){_0xc5b71({'ret':'OK'});});});});}function insertCmHopper(_0x26a47a,_0x7aad08,_0x16e89d,_0x4569f7,_0x3ce90e){var _0x319141=['cm_contacts.phone','cm_contacts.scheduledat',_0xf129('0x2b'),'cm_contacts.ListId',_0x7aad08+'.'+_0x4569f7,_0xf129('0x2c'),_0xf129('0x2d'),'cm_contacts.priority',_0xf129('0x2e'),'\x22'+_0x3ce90e+'\x22'];return squel[_0xf129('0x2f')]()[_0xf129('0x30')](_0xf129('0x31'))[_0xf129('0x32')](['phone',_0xf129('0x33'),_0xf129('0x34'),_0xf129('0x35'),_0x4569f7,_0xf129('0x36'),_0xf129('0x37'),_0xf129('0x38'),_0xf129('0x39'),_0xf129('0x3a')],squel[_0xf129('0x10')]()[_0xf129('0x3b')](_0x319141)[_0xf129('0x3c')](_0x7aad08)[_0xf129('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x7aad08+'.CmListId')[_0xf129('0x13')](_0x16e89d,null,_0x16e89d+_0xf129('0x14')+_0x7aad08+'.'+_0x4569f7)['where'](_0x7aad08+_0xf129('0x3d'),_0x26a47a)[_0xf129('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf129('0x15')](_0xf129('0x3e'),selectNotIn(_0x7aad08,_0x16e89d,_0x4569f7,_0xf129('0x31'),['\x22always\x22','\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x7aad08,_0x16e89d,_0x4569f7,_0xf129('0x31'),[_0xf129('0x3f')])))['toString']();}function insertCmHopperBlack(_0x3c6fe9,_0x407d90,_0x18e94c,_0x5d6d33){var _0x44e67d=['cm_contacts.phone',_0xf129('0x2b'),_0xf129('0x40'),_0x407d90+'.'+_0x5d6d33,'cm_contacts.createdAt',_0xf129('0x2d')];return squel[_0xf129('0x2f')]()[_0xf129('0x30')](_0xf129('0x41'))[_0xf129('0x32')]([_0xf129('0x12'),_0xf129('0x34'),'ListId',_0x5d6d33,'createdAt',_0xf129('0x37')],squel[_0xf129('0x10')]()[_0xf129('0x3b')](_0x44e67d)[_0xf129('0x3c')](_0x407d90)[_0xf129('0x13')](_0xf129('0x42'),null,_0xf129('0x43')+_0x407d90+_0xf129('0x44'))[_0xf129('0x13')](_0x18e94c,null,_0x18e94c+_0xf129('0x14')+_0x407d90+'.'+_0x5d6d33)[_0xf129('0x15')](_0x407d90+'.CmListId\x20=\x20?',_0x3c6fe9)['where'](_0xf129('0x45'),NOW)['where'](_0xf129('0x3e'),squel[_0xf129('0x10')]()[_0xf129('0x11')](_0xf129('0x12'))[_0xf129('0x3c')](_0xf129('0x41'))[_0xf129('0x15')](_0xf129('0x46'),_0x3c6fe9)[_0xf129('0x15')](_0x5d6d33+_0xf129('0x47'),_0x407d90+'.'+_0x5d6d33)))[_0xf129('0x48')]();}function insertCmHopperAdditionalPhones(_0x2bfef0){var _0x276504=[_0xf129('0x49'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xf129('0x4a'),_0xf129('0x4b')];return squel[_0xf129('0x2f')]()[_0xf129('0x30')](_0xf129('0x4c'))[_0xf129('0x32')]([_0xf129('0x4d'),_0xf129('0x12'),_0xf129('0x4e'),_0xf129('0x36'),_0xf129('0x37')],squel[_0xf129('0x10')]()[_0xf129('0x3b')](_0x276504)[_0xf129('0x3c')](_0xf129('0x31'))[_0xf129('0x13')](_0xf129('0x42'),null,_0xf129('0x4f'))['join'](_0xf129('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf129('0x15')](_0xf129('0x51'),_0x2bfef0)[_0xf129('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x1baf8f,_0x1d9de7,_0x1c08b8,_0xdd3c6a){var _0x257262=_[_0xf129('0x52')](_[_0xf129('0x53')](_0xdd3c6a),[_0xf129('0x35'),_0xf129('0x54'),_0xf129('0x36'),_0xf129('0x37')]);return squel[_0xf129('0x2f')]()[_0xf129('0x30')](_0xf129('0x42'))[_0xf129('0x32')](_0x257262,squel['select']()[_0xf129('0x3b')](_0x257262)[_0xf129('0x3c')](_0x1d9de7)[_0xf129('0x15')]('('+_0x1c08b8[_0xf129('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0xf129('0x10')]()['fields'](_0x1c08b8)[_0xf129('0x3c')](_0xf129('0x42'))[_0xf129('0x15')]('ListId\x20=\x20?',_0x1baf8f))[_0xf129('0x15')](_0xf129('0x55'),squel['select']()['field'](_0xf129('0x56'),_0xf129('0x57'))['from'](_0x1d9de7)[_0xf129('0x58')](_0x1c08b8['join'](','))))[_0xf129('0x48')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x436817){logger[_0xf129('0x1f')](_0x436817['message']);process[_0xf129('0x59')](0x1);}function handleError(_0x337a75,_0x287b4a){stats['errors']['push']({'name':_0x287b4a[_0xf129('0x5a')],'message':_0x287b4a[_0xf129('0x20')],'row':_0x337a75});}function handleQuery(_0x3fb5a9){logger['info'](_0x3fb5a9);return db[_0xf129('0x17')][_0xf129('0x18')](_0x3fb5a9)['spread'](function(_0x44a403){results[_0xf129('0x1c')](_0x44a403);})[_0xf129('0x1e')](function(_0xf84af6){logger[_0xf129('0x1f')](_0xf84af6[_0xf129('0x20')]);});}function main(_0xa65fb1,_0x288cf9,_0x1d102c,_0x391c20){logger[_0xf129('0x5b')](_0xf129('0x5c'),_0xa65fb1,JSON[_0xf129('0x5d')](_0x288cf9));process[_0xf129('0x5e')]('start');var _0x4b54fa=_0x288cf9['binding'];var _0x2519fe=_[_0xf129('0x5f')](_0x4b54fa);var _0xc460a7=_0x288cf9['socket_timestamp'];var _0x27d08f=path[_0xf129('0x13')](config['root'],_0xf129('0x60'),_0xc460a7+_0xf129('0x61'));logger[_0xf129('0x5b')](_0xf129('0x62'),_0x288cf9);db[_0xf129('0x63')][_0xf129('0x64')]({'raw':!![],'attributes':['id',_0xf129('0x65')]})[_0xf129('0x1d')](function(_0x3d8094){for(var _0x515815=0x0;_0x515815<_0x3d8094[_0xf129('0x19')];_0x515815++){if(_0x3d8094[_0x515815][_0xf129('0x65')]in _0x4b54fa){contactItemTypes['push'](_0x3d8094[_0x515815]);delete _0x2519fe[_0x3d8094[_0x515815][_0xf129('0x65')]];hasAdditionalPhones=!![];}for(var _0x4ed180 in _0x4b54fa){if(_0x3d8094[_0x515815]['name']+_0xf129('0x66')===_0x4ed180){phoneDescriptions[_0xf129('0x1c')]({'itemTypeId':_0x3d8094[_0x515815]['id'],'description':_0x4ed180});delete _0x2519fe[_0x4ed180];}}}if(hasAdditionalPhones)_0x2519fe[_0xf129('0x1b')]='';var _0x4023cc=_[_0xf129('0x53')](_0x2519fe)[_0xf129('0x13')]();logger[_0xf129('0x5b')]('header',_0x4023cc);fs['writeFileSync'](_0x27d08f,_0x4023cc+'\x0a');Papa[_0xf129('0x67')](fs[_0xf129('0x68')](_0xa65fb1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bd072,_0x4db588){try{for(var _0x176892=0x0,_0x2c08ad=[];_0x176892<_0x1bd072[_0xf129('0x69')][_0xf129('0x19')];_0x176892++){stats['rows']+=0x1;if(_0x1bd072[_0xf129('0x6a')][_0x176892]){handleError(_0x1bd072[_0xf129('0x69')][_0x176892],_0x1bd072[_0xf129('0x6a')][_0x176892]);}else{var _0x2da166=[];var _0x5db97f=[];var _0x572532={};for(var _0x49e8e9 in _0x4b54fa){let _0x4955b2=contactItemTypes[_0xf129('0x6b')](_0x454f5d=>_0x454f5d[_0xf129('0x65')]===_0x49e8e9);let _0x44985a=contactItemTypes[_0xf129('0x6b')](_0x4c4c66=>_0x4c4c66[_0xf129('0x65')]+_0xf129('0x66')===_0x49e8e9);if(_[_0xf129('0x1a')](_0x4955b2)&&_[_0xf129('0x1a')](_0x44985a)){if(_0x4b54fa[_0xf129('0x6c')](_0x49e8e9)){if(_0x1bd072['data'][_0x176892][_0x4b54fa[_0x49e8e9]]){var _0x126df3=_[_0xf129('0x6d')](_0x1bd072['data'][_0x176892][_0x4b54fa[_0x49e8e9]][_0xf129('0x6e')](/"/g,'\x27'));switch(_0x49e8e9){case _0xf129('0x33'):var _0x41f0cb=moment(_0x126df3,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x41f0cb[_0xf129('0x6f')]()){_0x2c08ad[_0xf129('0x1c')]('\x22'+_0x126df3+'\x22');}else{_0x2da166['push'](_0xf129('0x70'));}break;case'priority':var _0x113dad=parseInt(_0x126df3);_0x126df3=_[_0xf129('0x71')](_0x113dad)||_0x113dad<0x0||_0x113dad>0x4?_0x391c20?0x3:0x2:_0x113dad;_0x2c08ad[_0xf129('0x1c')]('\x22'+_0x126df3+'\x22');break;case _0xf129('0x39'):var _0x12709b=parseInt(_0x126df3);if(_[_0xf129('0x72')](_0x12709b)&&_[_0xf129('0x73')](_0x1d102c,_0x12709b)){_0x2c08ad[_0xf129('0x1c')]('\x22'+_0x12709b+'\x22');}else{_0x2da166[_0xf129('0x1c')]('agent\x20not\x20exists');}break;case _0xf129('0x74'):if(isEmail(_0x126df3)){_0x2c08ad[_0xf129('0x1c')]('\x22'+_0x126df3+'\x22');}else{_0x2da166[_0xf129('0x1c')](_0xf129('0x75'));}break;case _0xf129('0x76'):var _0x4a1650=moment(_0x126df3,_0xf129('0x77'),!![]);if(_0x4a1650[_0xf129('0x6f')]()){_0x2c08ad[_0xf129('0x1c')]('\x22'+_0x126df3+'\x22');}else{_0x2da166[_0xf129('0x1c')](_0xf129('0x78'));}break;default:_0x2c08ad['push']('\x22'+_0x126df3+'\x22');}}else{switch(_0x49e8e9){case'firstName':case'phone':_0x2da166[_0xf129('0x1c')](_0x49e8e9+_0xf129('0x79'));break;default:_0x2c08ad[_0xf129('0x1c')]('\x22\x22');}}}}else{var _0x315952='';if(!_[_0xf129('0x1a')](_0x4955b2)){if(!_0x572532[_0xf129('0x6c')](_0x4955b2['id'])){for(var _0x3223bd=0x0;_0x3223bd<_0x4b54fa[_0x49e8e9][_0xf129('0x19')];_0x3223bd++){var _0x126df3=_[_0xf129('0x6d')](_0x1bd072[_0xf129('0x69')][_0x176892][_0x4b54fa[_0x49e8e9][_0x3223bd]][_0xf129('0x6e')](/"/g,'\x27'));var _0x216aa8=phoneDescriptions[_0xf129('0x6b')](_0x15a97e=>_0x15a97e[_0xf129('0x7a')]===_0x4955b2['id']);if(!_[_0xf129('0x1a')](_0x216aa8)){var _0x4b0d8c=_['trim'](_0x1bd072[_0xf129('0x69')][_0x176892][_0x4b54fa[_0x216aa8[_0xf129('0x7b')]][0x0]][_0xf129('0x6e')](/"/g,'\x27'));if(!_[_0xf129('0x1a')](_0x4b0d8c))_0x126df3=_0x126df3+'§'+_0x4b0d8c;}if(_0x315952=='')_0x315952=_0x126df3;else _0x315952+='|'+_0x126df3;}_0x5db97f['push'](_0x4955b2['id']+':'+_0x315952);_0x572532[_0x4955b2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2c08ad[_0xf129('0x1c')]('\x22'+_0x5db97f[_0xf129('0x13')](';')+'\x22');}if(_0x2da166[_0xf129('0x19')]){handleError(_0x1bd072['data'][_0x176892],{'code':_0xf129('0x7c'),'message':_0x2da166[_0xf129('0x13')]()});}else{fs[_0xf129('0x7d')](_0x27d08f,_0x2c08ad[_0xf129('0x13')]()+'\x0a');}_0x2c08ad=[];}if(!(stats['rows']%0xc8)){socket[_0xf129('0x7e')](_0xf129('0x7f')+_0xc460a7,stats);stats[_0xf129('0x6a')]=[];}}if(stopped){logger[_0xf129('0x5b')](_0xf129('0x80'));_0x4db588[_0xf129('0x81')]();}}catch(_0x2905c7){handleError(_0x1bd072['data'][_0x176892],{'code':_0xf129('0x82'),'message':_0x2905c7[_0xf129('0x20')]});logger[_0xf129('0x1f')](_0xf129('0x83'),_0x2905c7[_0xf129('0x20')]);}},'complete':function(){try{var _0xd12b53=[];var _0x1b1372=tempTableName;_0xd12b53['push'](_0xf129('0x84')+_0x1b1372+_0xf129('0x85'));logger['info'](_0xf129('0x86'),contactItemTypes['length']);var _0x199911=util[_0xf129('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x27d08f,_0x1b1372,_0x4023cc,_0x288cf9[_0xf129('0x35')],_0x288cf9['CompanyId']||null,NOW,NOW);if(_[_0xf129('0x1a')](_0x4b54fa[_0xf129('0x33')])){_0x199911+=_0xf129('0x87');}_0xd12b53[_0xf129('0x1c')](_0x199911);BPromise['each'](_0xd12b53,handleQuery)[_0xf129('0x1d')](function(_0x26ee7c){BPromise[_0xf129('0x22')]([handleAdditionalPhones()])[_0xf129('0x1d')](function(){_0xd12b53=[];for(var _0x30c9a0=0x0;_0x30c9a0\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','unreadMessages','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','from','getInteractionFK','user_has_','u.fullname','ui.','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','type','default','value','read','and','Contact','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','split','tags','clause','ids','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','plainBody','body','keys','some'];(function(_0xe7516,_0x88d3dd){var _0x4fedd6=function(_0x2583ed){while(--_0x2583ed){_0xe7516['push'](_0xe7516['shift']());}};_0x4fedd6(++_0x88d3dd);}(_0x2501,0xe9));var _0x1250=function(_0x78902d,_0x161aa5){_0x78902d=_0x78902d-0x0;var _0x399b0b=_0x2501[_0x78902d];return _0x399b0b;};'use strict';var _=require('lodash');var squel=require(_0x1250('0x0'));var as=require(_0x1250('0x1'));var qs=require(_0x1250('0x2'));var updateInteraction=require(_0x1250('0x3'))['updateInteraction'];var utils=require(_0x1250('0x4'));var db=require(_0x1250('0x5'))['db'];function skipInteractionsQuery(_0x2b6d81,_0x3ca8f1,_0x5aee0a){var _0x492a50=![];var _0xe1f995=utils[_0x1250('0x6')](_0x2b6d81);if(_0x3ca8f1[_0x1250('0x7')]===_0x1250('0x8')&&!_0x5aee0a[_0x1250('0x9')]&&!_0x5aee0a[_0xe1f995]){_0x492a50=!![];}return _0x492a50;}function getTagsQuery(){return squel[_0x1250('0xa')]()[_0x1250('0xb')]('id')['field'](_0x1250('0xc'))[_0x1250('0xb')]('color')[_0x1250('0xd')]('tools_tags');}function getUsersQuery(_0x4f0b4b,_0x430f1f){var _0x52dd6a=utils[_0x1250('0xe')](_0x4f0b4b);var _0x30a8cc=_0x1250('0xf')+_0x4f0b4b+'_interactions';var _0x1b2196=squel[_0x1250('0xa')]()['field']('u.id')['field'](_0x1250('0x10'))['field'](_0x1250('0x11')+_0x52dd6a)['from'](_0x30a8cc,'ui')['left_join']('users','u',_0x1250('0x12'));if(_0x430f1f[_0x1250('0x13')]>0x0){_0x1b2196[_0x1250('0x14')](_0x1250('0x11')+_0x52dd6a+_0x1250('0x15'),_[_0x1250('0x16')](_0x430f1f,'id'));}return _0x1b2196;}function getInteractionsQuery(_0x2323f6){var _0x1bac0a=utils['getInteractionsTables'](_0x2323f6);var _0x28bf25=utils['getAccountFK'](_0x2323f6);var _0x202feb=utils['getInteractionFK'](_0x2323f6);return squel[_0x1250('0xa')]()[_0x1250('0xd')](_0x1bac0a[_0x1250('0x17')],'i')[_0x1250('0x18')](_0x1250('0x19'),'c',_0x1250('0x1a'))[_0x1250('0x18')](_0x1250('0x1b'),'o','o.id\x20=\x20i.UserId')[_0x1250('0x18')](_0x1bac0a['accounts'],'a','a.id\x20=\x20i.'+_0x28bf25)[_0x1250('0x18')](_0x1bac0a[_0x1250('0x1c')],'me',_0x1250('0x1d')+_0x202feb+'\x20=\x20i.id')[_0x1250('0x18')](_0x1bac0a['interactionsTags'],'it','it.'+_0x202feb+_0x1250('0x1e'))[_0x1250('0x18')]('tools_tags','t',_0x1250('0x1f'));}function getSqlClauses(){var _0x52e9db={'body':squel['expr'](),'contact':squel[_0x1250('0x20')](),'default':squel[_0x1250('0x20')](),'fields':squel['expr'](),'filter':squel[_0x1250('0x20')](),'read':squel[_0x1250('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x1250('0x20')]()};return _0x52e9db;}function parseTagParameter(_0x216535){var _0x19847a=squel['expr']();if(_0x216535){var _0x103674=utils[_0x1250('0x21')](_0x216535);_0x103674[_0x1250('0x22')](function(_0x3697f0){_0x19847a['or'](_0x1250('0x23'),'%,'+_0x3697f0+',%');});}return _0x19847a;}function parseReadParameter(_0x36be42){var _0x15c2db='';if(_0x36be42){_0x15c2db='unreadMessages\x20{OPERATOR}\x200';if(_0x36be42==='1'){_0x15c2db=_0x15c2db[_0x1250('0x24')]('{OPERATOR}','=');}else{_0x15c2db=_0x15c2db[_0x1250('0x24')](_0x1250('0x25'),'>');}}return _0x15c2db;}function parseSearchFilter(_0x2eeadc,_0x90479f){var _0x420ec3=squel[_0x1250('0x20')]();if(_0x90479f){var _0x4eaf0f=_0x90479f[_0x1250('0x24')]('\x5c','\x5c\x5c')[_0x1250('0x24')](/'/g,'\x27\x27');var _0x68284a=qs[_0x1250('0x26')](_0x4eaf0f);if(qs[_0x1250('0x27')](_0x4eaf0f)){_0x420ec3['or']('i.id\x20LIKE\x20?',_0x68284a+'%');if([_0x1250('0x28'),_0x1250('0x29')][_0x1250('0x2a')](_0x2eeadc)){_0x420ec3['or'](_0x1250('0x2b'),_0x68284a+'%');}else if(_0x2eeadc===_0x1250('0x2c')){_0x420ec3['or']('i.fax\x20LIKE\x20?',_0x68284a+'%');}else if(_0x2eeadc===_0x1250('0x2d')){_0x420ec3['or']('i.from\x20LIKE\x20?',_0x68284a+'%');}}else if(_0x2eeadc===_0x1250('0x2e')&&qs[_0x1250('0x2f')](_0x4eaf0f)){_0x420ec3['or']('c.email\x20LIKE\x20?',_0x68284a+'%');}else{if(_0x2eeadc===_0x1250('0x2e')){_0x420ec3['or'](_0x1250('0x30'),qs[_0x1250('0x31')](_0x4eaf0f,!![]))['or'](_0x1250('0x32'),qs[_0x1250('0x31')](_0x4eaf0f));}else if(_0x2eeadc!==_0x1250('0x2c')){_0x420ec3['or'](_0x1250('0x33'),qs[_0x1250('0x31')](_0x4eaf0f));}_0x420ec3['or'](_0x1250('0x34'),qs['getFullTextValue'](_0x4eaf0f,!![]),null);}}return _0x420ec3;}function parseAdvancedSearchFilter(_0x31006d,_0x16f1b1){var _0x4217e6=getSqlClauses();var _0x3cf30d=as['parseSearch'](_0x31006d);var _0x21c635=_0x3cf30d[_0x1250('0x35')];for(var _0x3aa06d=0x0;_0x3aa06d<_0x3cf30d[_0x1250('0x36')][_0x1250('0x13')];_0x3aa06d++){var _0x2ac49a=_0x3cf30d[_0x1250('0x36')][_0x3aa06d];var _0x57d1a0='i';var _0x110fdf=_[_0x1250('0x37')](_0x16f1b1,[_0x1250('0xc'),_0x2ac49a['field']]);if(_0x110fdf){var _0x54bf25=as[_0x1250('0x38')](_0x57d1a0,_0x110fdf[_0x1250('0x39')],_0x2ac49a);_0x4217e6[_0x1250('0x3a')][_0x21c635](_0x54bf25['text'],_0x54bf25[_0x1250('0x3b')]['start'],_0x54bf25['value']['end']);}else{switch(_0x2ac49a[_0x1250('0xb')]){case'unreadMessages':var _0x33c652=parseReadParameter(_0x2ac49a[_0x1250('0x3b')]);_0x4217e6[_0x1250('0x3c')][_0x1250('0x3d')](_0x33c652);break;case _0x1250('0x3e'):if(_0x2ac49a['operator']===_0x1250('0x3f')){if(_0x2ac49a[_0x1250('0x3b')]['split']('\x20')[_0x1250('0x13')]>0x1){_0x4217e6[_0x1250('0x40')][_0x21c635](_0x1250('0x34'),qs[_0x1250('0x31')](_0x2ac49a[_0x1250('0x3b')],!![]),null);}else{var _0x590cf0='%'+_0x2ac49a[_0x1250('0x3b')]+'%';_0x4217e6[_0x1250('0x40')][_0x21c635](_0x1250('0x41'),_0x590cf0,_0x590cf0,_0x590cf0);}}else{_0x110fdf=_[_0x1250('0x37')](_0x16f1b1,[_0x1250('0xc'),'ContactId']);_0x2ac49a[_0x1250('0xb')]=_0x1250('0x42');_0x54bf25=as[_0x1250('0x38')](_0x57d1a0,_0x110fdf[_0x1250('0x39')],_0x2ac49a);_0x4217e6['contact'][_0x21c635](_0x54bf25[_0x1250('0x43')],_0x54bf25[_0x1250('0x3b')][_0x1250('0x44')],_0x54bf25[_0x1250('0x3b')][_0x1250('0x45')]);}break;case _0x1250('0x46'):var _0x54aa38=_0x2ac49a['value'][_0x1250('0x47')](',')[_0x1250('0x16')](function(_0x51f1a9){return Number(_0x51f1a9);});var _0x177516=parseTagParameter(_0x54aa38);_0x4217e6[_0x1250('0x48')][_0x1250('0x49')][_0x1250('0x3d')](_0x177516);_0x4217e6[_0x1250('0x48')][_0x1250('0x4a')]=_0x54aa38;break;case'User':if(_0x2ac49a[_0x1250('0x4b')]===_0x1250('0x3f')){_0x4217e6[_0x1250('0x4c')][_0x21c635](_0x1250('0x4d'),'%'+_0x2ac49a[_0x1250('0x3b')]+'%',null);}else{_0x110fdf=_[_0x1250('0x37')](_0x16f1b1,[_0x1250('0xc'),'UserId']);_0x2ac49a[_0x1250('0xb')]=_0x1250('0x4e');_0x54bf25=as[_0x1250('0x38')](_0x57d1a0,_0x110fdf[_0x1250('0x39')],_0x2ac49a);_0x4217e6[_0x1250('0x4c')][_0x21c635](_0x54bf25[_0x1250('0x43')],_0x54bf25[_0x1250('0x3b')][_0x1250('0x44')],_0x54bf25[_0x1250('0x3b')][_0x1250('0x45')]);}break;case'body':case _0x1250('0x4f'):_0x54bf25=as[_0x1250('0x38')]('me',null,_0x2ac49a);_0x4217e6[_0x1250('0x50')][_0x21c635](_0x54bf25[_0x1250('0x43')],_0x54bf25[_0x1250('0x3b')]['start'],_0x54bf25[_0x1250('0x3b')][_0x1250('0x45')]);break;}}}return _0x4217e6;}function parseModelFields(_0x87831c,_0x8a9fb7,_0x57cd9a){var _0x159237=utils[_0x1250('0x6')](_0x87831c);var _0x399107=squel[_0x1250('0x20')]();var _0x3e16b8=_(_0x8a9fb7)[_0x1250('0x51')]()[_0x1250('0x16')](function(_0x1610eb){return _[_0x1250('0x52')](_0x57cd9a,['name',_0x1610eb])?_0x1610eb:undefined;})['compact']()[_0x1250('0x3b')]();if(_0x3e16b8[_0x1250('0x13')]>0x0){_0x3e16b8['forEach'](function(_0x2acabe){if(_0x2acabe===_0x159237){_0x399107['and']('i.'+_0x159237+_0x1250('0x15'),[]['concat'](_0x8a9fb7[_0x2acabe]));}else if(_0x2acabe===_0x1250('0x53')){var _0x5a19d4=JSON[_0x1250('0x54')](_0x8a9fb7[_0x2acabe])[_0x1250('0x55')];var _0x25c6e6=JSON[_0x1250('0x54')](_0x8a9fb7[_0x2acabe])[_0x1250('0x56')];_0x399107[_0x1250('0x3d')](_0x1250('0x57'),_0x5a19d4,_0x25c6e6);}else{if(_0x8a9fb7[_0x2acabe]===_0x1250('0x58')){_0x399107['and']('i.'+_0x2acabe+_0x1250('0x59'));}else{_0x399107[_0x1250('0x3d')]('i.'+_0x2acabe+_0x1250('0x5a'),_0x8a9fb7[_0x2acabe]);}}});}return _0x399107;}function parseQueryParameters(_0xee6bad,_0x330661,_0x12d711){var _0x26fa11=getSqlClauses();return Promise[_0x1250('0x5b')]()[_0x1250('0x5c')](function(){return parseModelFields(_0xee6bad,_0x330661,_0x12d711);})[_0x1250('0x5c')](function(_0x2e04c9){_0x26fa11[_0x1250('0x5d')][_0x1250('0x3d')](_0x2e04c9);return parseReadParameter(_0x330661[_0x1250('0x3c')]);})[_0x1250('0x5c')](function(_0x21827e){_0x26fa11[_0x1250('0x3c')]['and'](_0x21827e);return parseTagParameter(_0x330661[_0x1250('0x5e')]);})[_0x1250('0x5c')](function(_0xa09779){_0x26fa11[_0x1250('0x48')][_0x1250('0x49')]['and'](_0xa09779);return parseSearchFilter(_0xee6bad,_0x330661[_0x1250('0x5f')]);})['then'](function(_0x451a6e){_0x26fa11[_0x1250('0x5f')]=_0x451a6e;return _0x26fa11;});}function checkAccountsRestrictions(_0x1c3e38,_0x38fc61,_0x53b540){var _0x22bee1=utils[_0x1250('0x6')](_0x1c3e38);var _0x2fbd9a='get'+_[_0x1250('0x60')](_0x1c3e38)+(_0x1c3e38===_0x1250('0x61')?'Websites':_0x1250('0x62'));var _0x4c0305=squel['expr']();return Promise['resolve']()[_0x1250('0x5c')](function(){if(_0x53b540[_0x1250('0x9')]&&_0x38fc61[_0x1250('0x7')]===_0x1250('0x8')){return _0x38fc61[_0x2fbd9a]({'attributes':['id'],'raw':!![]});}})[_0x1250('0x5c')](function(_0x4dcf10){if(_0x4dcf10){if(_0x4dcf10['length']===0x0){_0x4c0305[_0x1250('0x3d')]('i.'+_0x22bee1+'\x20IS\x20NULL');}else{_0x4c0305[_0x1250('0x3d')]('i.'+_0x22bee1+_0x1250('0x15'),_[_0x1250('0x16')](_0x4dcf10,'id'));}}else if(!_0x53b540[_0x22bee1]){_0x4c0305[_0x1250('0x3d')]('i.'+_0x22bee1+_0x1250('0x63'));}})[_0x1250('0x5c')](function(){return _0x4c0305;});}function getClosedOrderClause(_0x1b8444,_0x5d07dc){var _0x3c2d7b='';var _0x5b90b0=[_0x1250('0x64'),_0x1250('0x65'),_0x1250('0x66')];if(_0x1b8444===_0x1250('0x2e')){_0x5b90b0[_0x1250('0x67')](_0x1250('0x68'));}if(_0x5d07dc[_0x1250('0x69')]==='0'&&_0x1b8444===_0x1250('0x2e')){_0x3c2d7b='i.substatus';}else{if(_0x5d07dc[_0x1250('0x69')]==='1'){_0x5b90b0[_0x1250('0x6a')]();}_0x3c2d7b='CONCAT_WS(\x27\x27,\x20'+_0x5b90b0[_0x1250('0x6b')](',\x20')+')';}return _0x3c2d7b;}function getFilteredInteractions(_0x833e42,_0x45870a,_0x5f30b5,_0x2a3635){var _0x3d3cc4=utils[_0x1250('0xe')](_0x833e42);var _0x3841e4=_['capitalize'](_0x833e42)+'Interaction';var _0xc603e3=[];var _0x14e7e9=getTagsQuery();var _0x2f8fcf={'type':db[_0x1250('0x6c')][_0x1250('0x6d')][_0x1250('0x6e')],'raw':!![]};var _0x514458=[];var _0x4dbe5f=[];return db[_0x1250('0x6f')]['query'](_0x14e7e9[_0x1250('0x70')](),_0x2f8fcf)[_0x1250('0x5c')](function(_0x5c6394){_0xc603e3=_[_0x1250('0x71')](_0x5c6394,'id');_0x2f8fcf=_[_0x1250('0x72')](_0x2f8fcf,{'model':db[_0x3841e4],'mapToModel':!![],'nest':!![]});if(_0x5f30b5[_0x1250('0x5d')]){_0x2a3635['attributes'][_0x1250('0x22')](function(_0xdb29a){_0x45870a['field']('i.'+_0xdb29a);});}else{_0x45870a['field'](_0x1250('0x73'),'unreadMessages');_0x45870a[_0x1250('0xb')](_0x1250('0x74'),_0x1250('0x75'));_0x45870a[_0x1250('0xb')]('a.mandatoryDisposition',_0x1250('0x76'));if(_0x833e42===_0x1250('0x2e')){_0x45870a[_0x1250('0xb')](_0x1250('0x77'),_0x1250('0x78'));_0x45870a['field'](_0x1250('0x79'),_0x1250('0x7a'));_0x45870a[_0x1250('0xb')]('i.id');_0x45870a[_0x1250('0xb')]('i.createdAt');_0x45870a[_0x1250('0xb')](_0x1250('0x7b'));_0x45870a['field']('i.closed');_0x45870a['field'](_0x1250('0x7c'));_0x45870a['field'](_0x1250('0x7d'));_0x45870a[_0x1250('0xb')]('i.lastMsgAt');_0x45870a['field'](_0x1250('0x7e'));_0x45870a[_0x1250('0xb')]('i.subject');_0x45870a[_0x1250('0xb')](_0x1250('0x66'));_0x45870a[_0x1250('0xb')](_0x1250('0x65'));_0x45870a[_0x1250('0xb')]('i.thirdDisposition');_0x45870a[_0x1250('0xb')](_0x1250('0x68'));_0x45870a['field'](_0x1250('0x7f'));_0x45870a[_0x1250('0xb')]('i.ContactId');_0x45870a['field'](_0x1250('0x80'));_0x45870a[_0x1250('0xb')](_0x1250('0x81'));}else if(_0x833e42===_0x1250('0x2d')){_0x45870a[_0x1250('0xb')]('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',_0x1250('0x7a'));}else{_0x45870a[_0x1250('0xb')](_0x1250('0x82'),_0x1250('0x7a'));}if(_0x833e42!==_0x1250('0x2e')){_0x45870a[_0x1250('0xb')](_0x1250('0x83'));}_0x45870a[_0x1250('0xb')](_0x1250('0x84'),_0x1250('0x85'));_0x45870a[_0x1250('0xb')](_0x1250('0x86'),'Contact.lastName');_0x45870a[_0x1250('0xb')]('c.email','Contact.email');_0x45870a[_0x1250('0xb')](_0x1250('0x87'),'Contact.phone');_0x45870a[_0x1250('0xb')](_0x1250('0x88'),_0x1250('0x89'));_0x45870a[_0x1250('0xb')](_0x1250('0x8a'),_0x1250('0x8b'));_0x45870a['field'](_0x1250('0x8c'),_0x1250('0x8d'));_0x45870a[_0x1250('0xb')](_0x1250('0x8e'),_0x1250('0x8f'));_0x45870a['field'](_0x1250('0x90'),_0x1250('0x91'));}if(_0x2a3635[_0x1250('0x92')]){_0x45870a[_0x1250('0x92')](_0x2a3635[_0x1250('0x92')]);}if(_0x2a3635['offset']){_0x45870a['offset'](_0x2a3635[_0x1250('0x93')]);}return db[_0x1250('0x6f')][_0x1250('0x94')](_0x45870a[_0x1250('0x70')](),_0x2f8fcf);})[_0x1250('0x5c')](function(_0x28b3c3){_0x514458=_0x28b3c3;var _0x104e56=getUsersQuery(_0x833e42,_0x514458);return db[_0x1250('0x6f')][_0x1250('0x94')](_0x104e56['toString'](),_0x2f8fcf);})[_0x1250('0x5c')](function(_0x18de7f){_0x4dbe5f=_[_0x1250('0x95')](_0x18de7f,_0x3d3cc4);if(_0x833e42==='mail'){return db['Setting'][_0x1250('0x96')]({'attributes':[_0x1250('0x97')],'raw':!![]});}})['then'](function(_0x3606bf){var _0x3a0c37=_0x3606bf?_0x3606bf[_0x1250('0x97')]:undefined;var _0x19f3b8=_0x514458['map'](function(_0x34df61){return updateInteraction(_0x34df61,_0xc603e3,_0x4dbe5f,_0x3a0c37);});return Promise[_0x1250('0x98')](_0x19f3b8);});}function countFilteredInteractions(_0x43a892,_0x3e4336){var _0x414106=_0x43a892[_0x1250('0x99')]();_0x414106[_0x1250('0xb')](_0x1250('0x9a'));_0x414106[_0x1250('0xb')](_0x1250('0x73'),_0x1250('0x9b'));var _0x204b34=utils[_0x1250('0x21')](_0x3e4336);if(!_['isEmpty'](_0x204b34)){_0x414106[_0x1250('0x14')](_0x1250('0x9c'),_0x204b34);}var _0x334dba={'type':db[_0x1250('0x6c')]['QueryTypes'][_0x1250('0x6e')],'raw':!![]};return db[_0x1250('0x6f')][_0x1250('0x94')](_0x414106['toString'](),_0x334dba);}module[_0x1250('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x431c=['parseSearch','sqlOperator','conditions','find','type','default','text','value','start','end','unreadMessages','and','Contact','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','tags','User','$substring','user','UserId','buildExpression','body','plainBody','some','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','tag','filter','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','QueryTypes','SELECT','sequelize','query','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','from','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','length','\x20IN\x20?','map','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','i.id\x20LIKE\x20?','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.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)'];(function(_0x2f5fea,_0x3ba2c0){var _0x36fe14=function(_0x3bbfc0){while(--_0x3bbfc0){_0x2f5fea['push'](_0x2f5fea['shift']());}};_0x36fe14(++_0x3ba2c0);}(_0x431c,0x1a4));var _0xc431=function(_0x270682,_0x2edc51){_0x270682=_0x270682-0x0;var _0x3c8e0b=_0x431c[_0x270682];return _0x3c8e0b;};'use strict';var _=require(_0xc431('0x0'));var squel=require(_0xc431('0x1'));var as=require(_0xc431('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xc431('0x3'))['updateInteraction'];var utils=require(_0xc431('0x4'));var db=require(_0xc431('0x5'))['db'];function skipInteractionsQuery(_0x717621,_0x146e0f,_0x2807bc){var _0x90b02e=![];var _0x4e023e=utils[_0xc431('0x6')](_0x717621);if(_0x146e0f[_0xc431('0x7')]===_0xc431('0x8')&&!_0x2807bc[_0xc431('0x9')]&&!_0x2807bc[_0x4e023e]){_0x90b02e=!![];}return _0x90b02e;}function getTagsQuery(){return squel[_0xc431('0xa')]()[_0xc431('0xb')]('id')[_0xc431('0xb')](_0xc431('0xc'))[_0xc431('0xb')]('color')[_0xc431('0xd')]('tools_tags');}function getUsersQuery(_0x5d12b2,_0x53d8c7){var _0x1a4981=utils[_0xc431('0xe')](_0x5d12b2);var _0x5c6d1d=_0xc431('0xf')+_0x5d12b2+_0xc431('0x10');var _0x2e3cc7=squel[_0xc431('0xa')]()[_0xc431('0xb')](_0xc431('0x11'))['field'](_0xc431('0x12'))['field'](_0xc431('0x13')+_0x1a4981)[_0xc431('0xd')](_0x5c6d1d,'ui')[_0xc431('0x14')](_0xc431('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x53d8c7[_0xc431('0x16')]>0x0){_0x2e3cc7['where'](_0xc431('0x13')+_0x1a4981+_0xc431('0x17'),_[_0xc431('0x18')](_0x53d8c7,'id'));}return _0x2e3cc7;}function getInteractionsQuery(_0xa5a891){var _0x109475=utils['getInteractionsTables'](_0xa5a891);var _0x28c52d=utils[_0xc431('0x6')](_0xa5a891);var _0x50ad80=utils[_0xc431('0xe')](_0xa5a891);return squel[_0xc431('0xa')]()[_0xc431('0xd')](_0x109475['interactions'],'i')[_0xc431('0x14')](_0xc431('0x19'),'c',_0xc431('0x1a'))[_0xc431('0x14')](_0xc431('0x15'),'o',_0xc431('0x1b'))['left_join'](_0x109475[_0xc431('0x1c')],'a','a.id\x20=\x20i.'+_0x28c52d)[_0xc431('0x14')](_0x109475[_0xc431('0x1d')],'me',_0xc431('0x1e')+_0x50ad80+_0xc431('0x1f'))[_0xc431('0x14')](_0x109475['interactionsTags'],'it',_0xc431('0x20')+_0x50ad80+_0xc431('0x1f'))[_0xc431('0x14')](_0xc431('0x21'),'t',_0xc431('0x22'));}function getSqlClauses(){var _0x10b739={'body':squel[_0xc431('0x23')](),'contact':squel[_0xc431('0x23')](),'default':squel['expr'](),'fields':squel[_0xc431('0x23')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0xc431('0x23')](),'ids':null},'user':squel[_0xc431('0x23')]()};return _0x10b739;}function parseTagParameter(_0x508bc3){var _0x2d0092=squel[_0xc431('0x23')]();if(_0x508bc3){var _0x196aa8=utils[_0xc431('0x24')](_0x508bc3);_0x196aa8[_0xc431('0x25')](function(_0x5947d9){_0x2d0092['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5947d9+',%');});}return _0x2d0092;}function parseReadParameter(_0x1c4789){var _0xd7b00d='';if(_0x1c4789){_0xd7b00d=_0xc431('0x26');if(_0x1c4789==='1'){_0xd7b00d=_0xd7b00d['replace']('{OPERATOR}','=');}else{_0xd7b00d=_0xd7b00d[_0xc431('0x27')]('{OPERATOR}','>');}}return _0xd7b00d;}function parseSearchFilter(_0x4a730e,_0x4b413c){var _0x1e5af0=squel[_0xc431('0x23')]();if(_0x4b413c){var _0x746aba=_0x4b413c[_0xc431('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x58c1c2=qs['escapeLIKESpecialChars'](_0x746aba);if(qs[_0xc431('0x28')](_0x746aba)){_0x1e5af0['or'](_0xc431('0x29'),_0x58c1c2+'%');if(['sms',_0xc431('0x2a')]['includes'](_0x4a730e)){_0x1e5af0['or'](_0xc431('0x2b'),_0x58c1c2+'%');}else if(_0x4a730e===_0xc431('0x2c')){_0x1e5af0['or'](_0xc431('0x2d'),_0x58c1c2+'%');}else if(_0x4a730e===_0xc431('0x2e')){_0x1e5af0['or']('i.from\x20LIKE\x20?',_0x58c1c2+'%');}}else if(_0x4a730e===_0xc431('0x2f')&&qs[_0xc431('0x30')](_0x746aba)){_0x1e5af0['or'](_0xc431('0x31'),_0x58c1c2+'%');}else{if(_0x4a730e===_0xc431('0x2f')){_0x1e5af0['or'](_0xc431('0x32'),qs[_0xc431('0x33')](_0x746aba,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc431('0x33')](_0x746aba));}else if(_0x4a730e!==_0xc431('0x2c')){_0x1e5af0['or'](_0xc431('0x34'),qs[_0xc431('0x33')](_0x746aba));}_0x1e5af0['or'](_0xc431('0x35'),qs['getFullTextValue'](_0x746aba,!![]),null);}}return _0x1e5af0;}function parseAdvancedSearchFilter(_0x8b1dd4,_0x54ab92){var _0x1c8e9f=getSqlClauses();var _0x58e600=as[_0xc431('0x36')](_0x8b1dd4);var _0x3897a1=_0x58e600[_0xc431('0x37')];for(var _0x1a8667=0x0;_0x1a8667<_0x58e600[_0xc431('0x38')]['length'];_0x1a8667++){var _0x550bc1=_0x58e600['conditions'][_0x1a8667];var _0x43ee41='i';var _0x15179b=_[_0xc431('0x39')](_0x54ab92,[_0xc431('0xc'),_0x550bc1[_0xc431('0xb')]]);if(_0x15179b){var _0x4da734=as['buildExpression'](_0x43ee41,_0x15179b[_0xc431('0x3a')],_0x550bc1);_0x1c8e9f[_0xc431('0x3b')][_0x3897a1](_0x4da734[_0xc431('0x3c')],_0x4da734[_0xc431('0x3d')][_0xc431('0x3e')],_0x4da734[_0xc431('0x3d')][_0xc431('0x3f')]);}else{switch(_0x550bc1[_0xc431('0xb')]){case _0xc431('0x40'):var _0x36d35f=parseReadParameter(_0x550bc1[_0xc431('0x3d')]);_0x1c8e9f['read'][_0xc431('0x41')](_0x36d35f);break;case _0xc431('0x42'):if(_0x550bc1['operator']==='$substring'){if(_0x550bc1[_0xc431('0x3d')][_0xc431('0x43')]('\x20')[_0xc431('0x16')]>0x1){_0x1c8e9f[_0xc431('0x44')][_0x3897a1](_0xc431('0x35'),qs[_0xc431('0x33')](_0x550bc1[_0xc431('0x3d')],!![]),null);}else{var _0x581b49='%'+_0x550bc1[_0xc431('0x3d')]+'%';_0x1c8e9f['contact'][_0x3897a1](_0xc431('0x45'),_0x581b49,_0x581b49,_0x581b49);}}else{_0x15179b=_[_0xc431('0x39')](_0x54ab92,['name',_0xc431('0x46')]);_0x550bc1['field']='ContactId';_0x4da734=as['buildExpression'](_0x43ee41,_0x15179b['type'],_0x550bc1);_0x1c8e9f[_0xc431('0x44')][_0x3897a1](_0x4da734[_0xc431('0x3c')],_0x4da734[_0xc431('0x3d')][_0xc431('0x3e')],_0x4da734['value'][_0xc431('0x3f')]);}break;case'Tag':var _0x4f1c7a=_0x550bc1[_0xc431('0x3d')][_0xc431('0x43')](',')[_0xc431('0x18')](function(_0xa2bfa7){return Number(_0xa2bfa7);});var _0x20a1b7=parseTagParameter(_0x4f1c7a);_0x1c8e9f[_0xc431('0x47')]['clause'][_0xc431('0x41')](_0x20a1b7);_0x1c8e9f['tags']['ids']=_0x4f1c7a;break;case _0xc431('0x48'):if(_0x550bc1['operator']===_0xc431('0x49')){_0x1c8e9f[_0xc431('0x4a')][_0x3897a1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x550bc1[_0xc431('0x3d')]+'%',null);}else{_0x15179b=_['find'](_0x54ab92,['name',_0xc431('0x4b')]);_0x550bc1[_0xc431('0xb')]=_0xc431('0x4b');_0x4da734=as[_0xc431('0x4c')](_0x43ee41,_0x15179b[_0xc431('0x3a')],_0x550bc1);_0x1c8e9f[_0xc431('0x4a')][_0x3897a1](_0x4da734[_0xc431('0x3c')],_0x4da734['value'][_0xc431('0x3e')],_0x4da734[_0xc431('0x3d')][_0xc431('0x3f')]);}break;case _0xc431('0x4d'):case _0xc431('0x4e'):_0x4da734=as['buildExpression']('me',null,_0x550bc1);_0x1c8e9f[_0xc431('0x4d')][_0x3897a1](_0x4da734[_0xc431('0x3c')],_0x4da734[_0xc431('0x3d')][_0xc431('0x3e')],_0x4da734[_0xc431('0x3d')][_0xc431('0x3f')]);break;}}}return _0x1c8e9f;}function parseModelFields(_0x3415de,_0x1520d4,_0x4d6b25){var _0x9cd2b6=utils['getAccountFK'](_0x3415de);var _0x350537=squel[_0xc431('0x23')]();var _0x5dc8f9=_(_0x1520d4)['keys']()['map'](function(_0x49b9a8){return _[_0xc431('0x4f')](_0x4d6b25,[_0xc431('0xc'),_0x49b9a8])?_0x49b9a8:undefined;})['compact']()[_0xc431('0x3d')]();if(_0x5dc8f9['length']>0x0){_0x5dc8f9[_0xc431('0x25')](function(_0x4d8fd4){if(_0x4d8fd4===_0x9cd2b6){_0x350537[_0xc431('0x41')]('i.'+_0x9cd2b6+_0xc431('0x17'),[]['concat'](_0x1520d4[_0x4d8fd4]));}else if(_0x4d8fd4===_0xc431('0x50')){var _0x3f7572=JSON[_0xc431('0x51')](_0x1520d4[_0x4d8fd4])[_0xc431('0x52')];var _0x5a7864=JSON[_0xc431('0x51')](_0x1520d4[_0x4d8fd4])['$lte'];_0x350537['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3f7572,_0x5a7864);}else{if(_0x1520d4[_0x4d8fd4]==='null'){_0x350537[_0xc431('0x41')]('i.'+_0x4d8fd4+_0xc431('0x53'));}else{_0x350537[_0xc431('0x41')]('i.'+_0x4d8fd4+_0xc431('0x54'),_0x1520d4[_0x4d8fd4]);}}});}return _0x350537;}function parseQueryParameters(_0xc4ab6c,_0x5566d6,_0x483d4f){var _0x4d4f2b=getSqlClauses();return Promise[_0xc431('0x55')]()['then'](function(){return parseModelFields(_0xc4ab6c,_0x5566d6,_0x483d4f);})[_0xc431('0x56')](function(_0xf1a915){_0x4d4f2b['fields'][_0xc431('0x41')](_0xf1a915);return parseReadParameter(_0x5566d6[_0xc431('0x57')]);})[_0xc431('0x56')](function(_0x1fa9a8){_0x4d4f2b['read'][_0xc431('0x41')](_0x1fa9a8);return parseTagParameter(_0x5566d6[_0xc431('0x58')]);})[_0xc431('0x56')](function(_0x1221b1){_0x4d4f2b['tags']['clause'][_0xc431('0x41')](_0x1221b1);return parseSearchFilter(_0xc4ab6c,_0x5566d6[_0xc431('0x59')]);})['then'](function(_0x24f23b){_0x4d4f2b['filter']=_0x24f23b;return _0x4d4f2b;});}function checkAccountsRestrictions(_0x56b6e7,_0x5767d8,_0x3b977a){var _0x2fbcc6=utils[_0xc431('0x6')](_0x56b6e7);var _0x46f282='get'+_['capitalize'](_0x56b6e7)+(_0x56b6e7===_0xc431('0x5a')?_0xc431('0x5b'):_0xc431('0x5c'));var _0x387230=squel[_0xc431('0x23')]();return Promise[_0xc431('0x55')]()[_0xc431('0x56')](function(){if(_0x3b977a[_0xc431('0x9')]&&_0x5767d8['role']===_0xc431('0x8')){return _0x5767d8[_0x46f282]({'attributes':['id'],'raw':!![]});}})[_0xc431('0x56')](function(_0x221bd9){if(_0x221bd9){if(_0x221bd9[_0xc431('0x16')]===0x0){_0x387230[_0xc431('0x41')]('i.'+_0x2fbcc6+_0xc431('0x53'));}else{_0x387230['and']('i.'+_0x2fbcc6+_0xc431('0x17'),_[_0xc431('0x18')](_0x221bd9,'id'));}}else if(!_0x3b977a[_0x2fbcc6]){_0x387230[_0xc431('0x41')]('i.'+_0x2fbcc6+_0xc431('0x5d'));}})['then'](function(){return _0x387230;});}function getClosedOrderClause(_0x1509b6,_0x11ef3a){var _0x7a66cc='';var _0x50ed0c=[_0xc431('0x5e'),'i.secondDisposition',_0xc431('0x5f')];if(_0x1509b6==='mail'){_0x50ed0c[_0xc431('0x60')](_0xc431('0x61'));}if(_0x11ef3a['closed']==='0'&&_0x1509b6===_0xc431('0x2f')){_0x7a66cc=_0xc431('0x61');}else{if(_0x11ef3a[_0xc431('0x62')]==='1'){_0x50ed0c[_0xc431('0x63')]();}_0x7a66cc=_0xc431('0x64')+_0x50ed0c[_0xc431('0x65')](',\x20')+')';}return _0x7a66cc;}function getFilteredInteractions(_0x535fab,_0x4ab37a,_0x27bfe6,_0x19a709){var _0x131cab=utils[_0xc431('0xe')](_0x535fab);var _0x10e4bd=_['capitalize'](_0x535fab)+'Interaction';var _0x3c1783=[];var _0x2eb0ac=getTagsQuery();var _0x2d9d13={'type':db['Sequelize'][_0xc431('0x66')][_0xc431('0x67')],'raw':!![]};var _0x43b08e=[];var _0x5dc372=[];return db[_0xc431('0x68')][_0xc431('0x69')](_0x2eb0ac['toString'](),_0x2d9d13)['then'](function(_0x25268a){_0x3c1783=_['keyBy'](_0x25268a,'id');_0x2d9d13=_[_0xc431('0x6a')](_0x2d9d13,{'model':db[_0x10e4bd],'mapToModel':!![],'nest':!![]});if(_0x27bfe6[_0xc431('0x6b')]){_0x19a709[_0xc431('0x6c')]['forEach'](function(_0x1b1dce){_0x4ab37a['field']('i.'+_0x1b1dce);});}else{_0x4ab37a[_0xc431('0xb')](_0xc431('0x6d'),'unreadMessages');_0x4ab37a[_0xc431('0xb')]('a.key',_0xc431('0x6e'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x6f'),_0xc431('0x70'));if(_0x535fab===_0xc431('0x2f')){_0x4ab37a[_0xc431('0xb')]('a.email',_0xc431('0x71'));_0x4ab37a['field'](_0xc431('0x72'),_0xc431('0x73'));_0x4ab37a['field'](_0xc431('0x74'));_0x4ab37a[_0xc431('0xb')]('i.createdAt');_0x4ab37a[_0xc431('0xb')](_0xc431('0x75'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x76'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x77'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x78'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x79'));_0x4ab37a['field'](_0xc431('0x7a'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x7b'));_0x4ab37a[_0xc431('0xb')]('i.disposition');_0x4ab37a[_0xc431('0xb')]('i.secondDisposition');_0x4ab37a[_0xc431('0xb')](_0xc431('0x5e'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x61'));_0x4ab37a[_0xc431('0xb')]('i.to');_0x4ab37a[_0xc431('0xb')](_0xc431('0x7c'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x7d'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x7e'));}else if(_0x535fab===_0xc431('0x2e')){_0x4ab37a['field'](_0xc431('0x7f'),_0xc431('0x73'));}else{_0x4ab37a['field'](_0xc431('0x80'),'contactName');}if(_0x535fab!==_0xc431('0x2f')){_0x4ab37a[_0xc431('0xb')](_0xc431('0x81'));}_0x4ab37a['field'](_0xc431('0x82'),_0xc431('0x83'));_0x4ab37a['field'](_0xc431('0x84'),_0xc431('0x85'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x86'),_0xc431('0x87'));_0x4ab37a['field'](_0xc431('0x88'),'Contact.phone');_0x4ab37a['field'](_0xc431('0x89'),'Contact.mobile');_0x4ab37a[_0xc431('0xb')](_0xc431('0x8a'),_0xc431('0x8b'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x8c'),'Owner.fullname');_0x4ab37a[_0xc431('0xb')](_0xc431('0x8d'),_0xc431('0x8e'));_0x4ab37a[_0xc431('0xb')](_0xc431('0x8f'),_0xc431('0x90'));}if(_0x19a709[_0xc431('0x91')]){_0x4ab37a[_0xc431('0x91')](_0x19a709['limit']);}if(_0x19a709[_0xc431('0x92')]){_0x4ab37a['offset'](_0x19a709[_0xc431('0x92')]);}return db[_0xc431('0x68')][_0xc431('0x69')](_0x4ab37a[_0xc431('0x93')](),_0x2d9d13);})[_0xc431('0x56')](function(_0x1ac216){_0x43b08e=_0x1ac216;var _0x15afaf=getUsersQuery(_0x535fab,_0x43b08e);return db[_0xc431('0x68')]['query'](_0x15afaf[_0xc431('0x93')](),_0x2d9d13);})['then'](function(_0x368a8b){_0x5dc372=_[_0xc431('0x94')](_0x368a8b,_0x131cab);if(_0x535fab===_0xc431('0x2f')){return db['Setting'][_0xc431('0x95')]({'attributes':[_0xc431('0x96')],'raw':!![]});}})[_0xc431('0x56')](function(_0x20e556){var _0x1c4bef=_0x20e556?_0x20e556['enableEmailPreview']:undefined;var _0x31a749=_0x43b08e[_0xc431('0x18')](function(_0x378776){return updateInteraction(_0x378776,_0x3c1783,_0x5dc372,_0x1c4bef);});return Promise['all'](_0x31a749);});}function countFilteredInteractions(_0x24150d,_0x36568a){var _0x2d01f9=_0x24150d[_0xc431('0x97')]();_0x2d01f9['field'](_0xc431('0x98'));_0x2d01f9[_0xc431('0xb')](_0xc431('0x6d'),_0xc431('0x40'));var _0x55bb06=utils[_0xc431('0x24')](_0x36568a);if(!_[_0xc431('0x99')](_0x55bb06)){_0x2d01f9[_0xc431('0x9a')](_0xc431('0x9b'),_0x55bb06);}var _0x1da086={'type':db[_0xc431('0x9c')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xc431('0x68')][_0xc431('0x69')](_0x2d01f9[_0xc431('0x93')](),_0x1da086);}module[_0xc431('0x9d')]={'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 13917b6..351676a 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 _0x822b=['forEach','push','waiting','talking','answered','unmanaged','total','disposition','abandoned','UserId','MailMessage','findOne','out','plainBody','lastMsgText','trimStart','updateInteraction','then','Users','TagIds','Tags','catch','lodash','map','fullname','split'];(function(_0x57d6da,_0x42d406){var _0x5c9dd8=function(_0x36b152){while(--_0x36b152){_0x57d6da['push'](_0x57d6da['shift']());}};_0x5c9dd8(++_0x42d406);}(_0x822b,0x64));var _0xb822=function(_0x28666a,_0x3dc25d){_0x28666a=_0x28666a-0x0;var _0x19d752=_0x822b[_0x28666a];return _0x19d752;};'use strict';var _=require(_0xb822('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x27a709,_0x2a12fc){return new Promise(function(_0x28ec4b,_0x1ffb99){try{var _0x56b5b9=[];if(_0x2a12fc[_0x27a709]){_0x56b5b9=_0x2a12fc[_0x27a709][_0xb822('0x1')](function(_0x1a1d26){return{'id':_0x1a1d26['id'],'fullname':_0x1a1d26[_0xb822('0x2')]};});}return _0x28ec4b(_0x56b5b9);}catch(_0x17ea44){_0x1ffb99(_0x17ea44);}});}function getInteractionTags(_0x2bf341,_0x27c844){var _0x3c4104=[];if(_0x2bf341){_0x2bf341[_0xb822('0x3')](',')[_0xb822('0x4')](function(_0x49a980){_0x3c4104[_0xb822('0x5')](_0x27c844[_0x49a980]);});}return _0x3c4104;}function updateWaitingCounter(_0x4817b3){if(_0x4817b3[_0xb822('0x6')]){_0x4817b3['waiting']-=0x1;}}function updateInteractionCounters(_0x2739d2){_0x2739d2[_0xb822('0x6')]=0x0;_0x2739d2[_0xb822('0x7')]=0x0;_0x2739d2[_0xb822('0x8')]=0x0;_0x2739d2[_0xb822('0x9')]=0x0;_0x2739d2['abandoned']=0x0;_0x2739d2[_0xb822('0xa')]=0x0;if(_0x2739d2['closed']){if(_0x2739d2[_0xb822('0xb')]==='abandoned'){_0x2739d2[_0xb822('0xc')]+=0x1;updateWaitingCounter(_0x2739d2);}if(_0x2739d2['UserId']){_0x2739d2['answered']+=0x1;if(_0x2739d2[_0xb822('0x7')]){_0x2739d2[_0xb822('0x7')]-=0x1;}}else{if(_0x2739d2[_0xb822('0xb')]){_0x2739d2[_0xb822('0x9')]+=0x1;updateWaitingCounter(_0x2739d2);}}}else{if(!_0x2739d2[_0xb822('0xd')]){_0x2739d2[_0xb822('0x6')]+=0x1;}if(_0x2739d2['UserId']){_0x2739d2[_0xb822('0x7')]+=0x1;updateWaitingCounter(_0x2739d2);}}_0x2739d2[_0xb822('0xa')]+=0x1;return _0x2739d2;}function getLastMessageText(_0x322e41){return db[_0xb822('0xe')][_0xb822('0xf')]({'where':{'$and':[{'MailInteractionId':_0x322e41['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb822('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x286e0c){if(_0x286e0c&&_0x286e0c[_0xb822('0x11')]){_0x322e41[_0xb822('0x12')]=_[_0xb822('0x13')](_0x286e0c['plainBody']);}return _0x322e41;})['catch'](function(_0xfd2aed){throw _0xfd2aed;});}exports[_0xb822('0x14')]=function(_0x2be8d9,_0x17754d,_0x3ab11b,_0x244297){return new Promise(function(_0x2eebd4,_0x41d3cf){return getInteractionUsers(_0x2be8d9['id'],_0x3ab11b)[_0xb822('0x15')](function(_0xb504b8){_0x2be8d9[_0xb822('0x16')]=_0xb504b8;return getInteractionTags(_0x2be8d9[_0xb822('0x17')],_0x17754d);})[_0xb822('0x15')](function(_0x527604){_0x2be8d9[_0xb822('0x18')]=_0x527604;delete _0x2be8d9[_0xb822('0x17')];return updateInteractionCounters(_0x2be8d9);})[_0xb822('0x15')](function(_0x16bdfe){if(_0x244297){return getLastMessageText(_0x16bdfe);}else{return _0x16bdfe;}})[_0xb822('0x15')](function(_0x4d43d5){_0x2eebd4(_0x4d43d5);})[_0xb822('0x19')](function(_0x1b7a25){_0x41d3cf(_0x1b7a25);});});}; \ No newline at end of file +var _0xc640=['split','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','findOne','plainBody','then','trimStart','catch','updateInteraction','TagIds','Tags','lodash','map','fullname'];(function(_0x5f1733,_0x5775d2){var _0x84575=function(_0x5d7633){while(--_0x5d7633){_0x5f1733['push'](_0x5f1733['shift']());}};_0x84575(++_0x5775d2);}(_0xc640,0x16d));var _0x0c64=function(_0x2fc58b,_0x144950){_0x2fc58b=_0x2fc58b-0x0;var _0x260545=_0xc640[_0x2fc58b];return _0x260545;};'use strict';var _=require(_0x0c64('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4befd2,_0x506cf4){return new Promise(function(_0x4729a7,_0x86e0ea){try{var _0x520ed1=[];if(_0x506cf4[_0x4befd2]){_0x520ed1=_0x506cf4[_0x4befd2][_0x0c64('0x1')](function(_0x477ca2){return{'id':_0x477ca2['id'],'fullname':_0x477ca2[_0x0c64('0x2')]};});}return _0x4729a7(_0x520ed1);}catch(_0x56d189){_0x86e0ea(_0x56d189);}});}function getInteractionTags(_0x269419,_0x591cfe){var _0x57e0c7=[];if(_0x269419){_0x269419[_0x0c64('0x3')](',')[_0x0c64('0x4')](function(_0x242d06){_0x57e0c7[_0x0c64('0x5')](_0x591cfe[_0x242d06]);});}return _0x57e0c7;}function updateWaitingCounter(_0x40e509){if(_0x40e509[_0x0c64('0x6')]){_0x40e509[_0x0c64('0x6')]-=0x1;}}function updateInteractionCounters(_0x35a67c){_0x35a67c['waiting']=0x0;_0x35a67c[_0x0c64('0x7')]=0x0;_0x35a67c[_0x0c64('0x8')]=0x0;_0x35a67c[_0x0c64('0x9')]=0x0;_0x35a67c[_0x0c64('0xa')]=0x0;_0x35a67c['total']=0x0;if(_0x35a67c[_0x0c64('0xb')]){if(_0x35a67c[_0x0c64('0xc')]==='abandoned'){_0x35a67c[_0x0c64('0xa')]+=0x1;updateWaitingCounter(_0x35a67c);}if(_0x35a67c['UserId']){_0x35a67c[_0x0c64('0x8')]+=0x1;if(_0x35a67c[_0x0c64('0x7')]){_0x35a67c['talking']-=0x1;}}else{if(_0x35a67c[_0x0c64('0xc')]){_0x35a67c[_0x0c64('0x9')]+=0x1;updateWaitingCounter(_0x35a67c);}}}else{if(!_0x35a67c[_0x0c64('0xd')]){_0x35a67c[_0x0c64('0x6')]+=0x1;}if(_0x35a67c[_0x0c64('0xd')]){_0x35a67c[_0x0c64('0x7')]+=0x1;updateWaitingCounter(_0x35a67c);}}_0x35a67c[_0x0c64('0xe')]+=0x1;return _0x35a67c;}function getLastMessageText(_0x5ad06e){return db['MailMessage'][_0x0c64('0xf')]({'where':{'$and':[{'MailInteractionId':_0x5ad06e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0c64('0x10')],'order':'-id','raw':!![]})[_0x0c64('0x11')](function(_0x2239c8){if(_0x2239c8&&_0x2239c8[_0x0c64('0x10')]){_0x5ad06e['lastMsgText']=_[_0x0c64('0x12')](_0x2239c8['plainBody']);}return _0x5ad06e;})[_0x0c64('0x13')](function(_0x4009a4){throw _0x4009a4;});}exports[_0x0c64('0x14')]=function(_0x21476d,_0xbcf159,_0x3f3f4d,_0x81eb27){return new Promise(function(_0x389dbe,_0x4729e9){return getInteractionUsers(_0x21476d['id'],_0x3f3f4d)[_0x0c64('0x11')](function(_0x292f2a){_0x21476d['Users']=_0x292f2a;return getInteractionTags(_0x21476d[_0x0c64('0x15')],_0xbcf159);})[_0x0c64('0x11')](function(_0x5f111a){_0x21476d[_0x0c64('0x16')]=_0x5f111a;delete _0x21476d['TagIds'];return updateInteractionCounters(_0x21476d);})['then'](function(_0x32de1d){if(_0x81eb27){return getLastMessageText(_0x32de1d);}else{return _0x32de1d;}})[_0x0c64('0x11')](function(_0x1811c9){_0x389dbe(_0x1811c9);})[_0x0c64('0x13')](function(_0x4adf73){_0x4729e9(_0x4adf73);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index ae2c7cc..8898bbc 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 _0x6172=['chat','_interaction_has_tags','user_has_','_interactions','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','Interaction','findOne','then','update','info','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','Account','InteractionId','upperFirst','unknown'];(function(_0x2d3a71,_0x263bf3){var _0x1dc822=function(_0x85743f){while(--_0x85743f){_0x2d3a71['push'](_0x2d3a71['shift']());}};_0x1dc822(++_0x263bf3);}(_0x6172,0x68));var _0x2617=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6172[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0x2617('0x0'))['db'];var loggers={'openchannel':require(_0x2617('0x1'))(_0x2617('0x2')),'mail':require(_0x2617('0x1'))(_0x2617('0x3')),'fax':require(_0x2617('0x1'))(_0x2617('0x4')),'sms':require(_0x2617('0x1'))('sms-interactions'),'chat':require(_0x2617('0x1'))(_0x2617('0x5')),'whatsapp':require(_0x2617('0x1'))(_0x2617('0x6'))};function getAccountFK(_0x41d3b7){return _[_0x2617('0x7')](_0x41d3b7)+(_0x41d3b7==='chat'?'Website':_0x2617('0x8'))+'Id';}function getInteractionFK(_0x9cac5){return _[_0x2617('0x7')](_0x9cac5)+_0x2617('0x9');}function getInteractionId(_0x2242bb,_0x2e397a,_0x4b1d54){if(_0x2242bb&&_0x2242bb[_[_0x2617('0xa')](_0x4b1d54)+_0x2617('0x9')]){return _0x2242bb[_[_0x2617('0xa')](_0x4b1d54)+'InteractionId'];}else if(_0x2242bb&&_0x2242bb['id']){return _0x2242bb['id'];}else if(_0x2e397a&&_0x2e397a['id']){return _0x2e397a['id'];}else{return _0x2617('0xb');}}function getInteractionsTables(_0x3bb69c){return{'accounts':_0x3bb69c+'_'+(_0x3bb69c===_0x2617('0xc')?'websites':'accounts'),'interactions':_0x3bb69c+'_interactions','interactionsTags':_0x3bb69c+_0x2617('0xd'),'messages':_0x3bb69c+'_messages','userInteractions':_0x2617('0xe')+_0x3bb69c+_0x2617('0xf')};}function getSelectedTags(_0x25a37c){var _0x34d029=[];if(_0x25a37c){_0x34d029=Array[_0x2617('0x10')](_0x25a37c)?_0x25a37c:[_0x25a37c];}return _0x34d029;}function log(_0x33ac4a,_0x29b552,_0xe0dcdf,_0x395c66,_0x424c05,_0x18eed2){loggers[_0x424c05['toLowerCase']()][_0x33ac4a](_0x2617('0x11'),_0x18eed2['toUpperCase'](),_0x29b552?_0x29b552['id']:null,_0x29b552?_0x29b552['name']:null,_0x29b552?_0x29b552[_0x2617('0x12')]:null,getInteractionId(_0xe0dcdf,_0x395c66,_0x424c05),_0xe0dcdf?JSON[_0x2617('0x13')](_0xe0dcdf):_0x2617('0x14'));}function updateUser(_0x1c7ad1,_0x4a61c9,_0x38b87a,_0x5cc9ca,_0x5bfaf9){db[_[_0x2617('0xa')](_0x5cc9ca)+_0x2617('0x15')][_0x2617('0x16')]({'where':{'id':getInteractionId(_0x4a61c9,_0x38b87a,_0x5cc9ca)}})[_0x2617('0x17')](function(_0x4830e8){if(_0x4830e8){return _0x4830e8[_0x2617('0x18')]({'UserId':_0x1c7ad1?_0x1c7ad1['id']:null});}})[_0x2617('0x17')](function(_0xd454d8){if(_0xd454d8){log(_0x2617('0x19'),_0x1c7ad1,_0x4a61c9,_0x38b87a,_0x5cc9ca,_0x5bfaf9);}})[_0x2617('0x1a')](function(){log(_0x2617('0x1b'),_0x1c7ad1,_0x4a61c9,_0x38b87a,_0x5cc9ca,_0x5bfaf9);});}module[_0x2617('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x3092=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','upperFirst','InteractionId','websites','accounts','_interactions','_messages','isArray'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x3092,0x89));var _0x2309=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x3092[_0x178f52];return _0x556f99;};'use strict';var _=require(_0x2309('0x0'));var db=require(_0x2309('0x1'))['db'];var loggers={'openchannel':require(_0x2309('0x2'))(_0x2309('0x3')),'mail':require(_0x2309('0x2'))(_0x2309('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x2309('0x5')),'chat':require('../../config/logger')(_0x2309('0x6')),'whatsapp':require(_0x2309('0x2'))(_0x2309('0x7'))};function getAccountFK(_0x1959a4){return _[_0x2309('0x8')](_0x1959a4)+(_0x1959a4===_0x2309('0x9')?'Website':_0x2309('0xa'))+'Id';}function getInteractionFK(_0x2c8c3b){return _[_0x2309('0x8')](_0x2c8c3b)+'InteractionId';}function getInteractionId(_0x4a34be,_0x6bfbb3,_0x42db43){if(_0x4a34be&&_0x4a34be[_[_0x2309('0xb')](_0x42db43)+_0x2309('0xc')]){return _0x4a34be[_[_0x2309('0xb')](_0x42db43)+_0x2309('0xc')];}else if(_0x4a34be&&_0x4a34be['id']){return _0x4a34be['id'];}else if(_0x6bfbb3&&_0x6bfbb3['id']){return _0x6bfbb3['id'];}else{return'unknown';}}function getInteractionsTables(_0x561aec){return{'accounts':_0x561aec+'_'+(_0x561aec==='chat'?_0x2309('0xd'):_0x2309('0xe')),'interactions':_0x561aec+_0x2309('0xf'),'interactionsTags':_0x561aec+'_interaction_has_tags','messages':_0x561aec+_0x2309('0x10'),'userInteractions':'user_has_'+_0x561aec+_0x2309('0xf')};}function getSelectedTags(_0x45700e){var _0xe22588=[];if(_0x45700e){_0xe22588=Array[_0x2309('0x11')](_0x45700e)?_0x45700e:[_0x45700e];}return _0xe22588;}function log(_0x3bd456,_0x1c4196,_0x111c11,_0x49a813,_0x4cde45,_0x5ccacd){loggers[_0x4cde45[_0x2309('0x12')]()][_0x3bd456](_0x2309('0x13'),_0x5ccacd[_0x2309('0x14')](),_0x1c4196?_0x1c4196['id']:null,_0x1c4196?_0x1c4196[_0x2309('0x15')]:null,_0x1c4196?_0x1c4196[_0x2309('0x16')]:null,getInteractionId(_0x111c11,_0x49a813,_0x4cde45),_0x111c11?JSON[_0x2309('0x17')](_0x111c11):_0x2309('0x18'));}function updateUser(_0x5726d5,_0x2de0ca,_0x2b851e,_0x5930fd,_0x20c72a){db[_[_0x2309('0xb')](_0x5930fd)+_0x2309('0x19')][_0x2309('0x1a')]({'where':{'id':getInteractionId(_0x2de0ca,_0x2b851e,_0x5930fd)}})['then'](function(_0x592318){if(_0x592318){return _0x592318['update']({'UserId':_0x5726d5?_0x5726d5['id']:null});}})[_0x2309('0x1b')](function(_0x4beee5){if(_0x4beee5){log(_0x2309('0x1c'),_0x5726d5,_0x2de0ca,_0x2b851e,_0x5930fd,_0x20c72a);}})['catch'](function(){log(_0x2309('0x1d'),_0x5726d5,_0x2de0ca,_0x2b851e,_0x5930fd,_0x20c72a);});}module[_0x2309('0x1e')]={'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 526b151..929486a 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 _0x13a8=['data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','parse','use','then','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','user','crypto','util','../../mysqldb','../../config/environment'];(function(_0x3c68fa,_0x28f154){var _0x18a2bb=function(_0x7299){while(--_0x7299){_0x3c68fa['push'](_0x3c68fa['shift']());}};_0x18a2bb(++_0x28f154);}(_0x13a8,0x178));var _0x813a=function(_0x5d1927,_0x123ef9){_0x5d1927=_0x5d1927-0x0;var _0x4c6235=_0x13a8[_0x5d1927];return _0x4c6235;};'use strict';var crypto=require(_0x813a('0x0'));var util=require(_0x813a('0x1'));var compose=require('composable-middleware');var db=require(_0x813a('0x2'))['db'];var config=require(_0x813a('0x3'));function getValueFromLicense(_0x1861f1,_0x3e3112){if(_0x1861f1&&_0x3e3112){if(_0x3e3112[_0x813a('0x4')]&&_0x3e3112[_0x813a('0x5')]){var _0x3c106a=_0x3e3112[_0x813a('0x4')];var _0x14bc07=_0x3e3112[_0x813a('0x5')];var _0x53a5dc=_0x3c106a[_0x813a('0x6')]('-')[0x4];var _0x4b89b3=_0x3c106a[_0x813a('0x6')]('-')[0x0];var _0x4e387b=crypto[_0x813a('0x7')](_0x813a('0x8'),util['format'](_0x813a('0x9'),_0x53a5dc,_0x3c106a,_0x4b89b3));var _0x9427e=_0x4e387b['update'](_0x14bc07,_0x813a('0xa'),_0x813a('0xb'));_0x9427e+=_0x4e387b['final'](_0x813a('0xb'));var _0x12396d=JSON[_0x813a('0xc')](_0x9427e);return _0x12396d['hasOwnProperty'](_0x1861f1)?_0x12396d[_0x1861f1]:null;}}return null;}function isLimit(_0x11ef80,_0x4162cb,_0x57a8bf,_0x5626b0){var _0x8f58a9=_0x4162cb;return compose()[_0x813a('0xd')](function(_0x191044,_0x19d92e,_0x3b8c52){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x22a03b){var _0x47b897=getValueFromLicense(_0x11ef80,_0x22a03b);return _0x47b897?_0x47b897:_0x8f58a9;})[_0x813a('0xe')](function(_0x6e4cf1){_0x8f58a9=_0x6e4cf1;return _0x57a8bf['count'](_0x5626b0);})['then'](function(_0x32468b){if(_0x32468b>=_0x8f58a9){return _0x19d92e[_0x813a('0xf')](0x193)['json']({'message':util[_0x813a('0x10')](_0x813a('0x11'),_0x11ef80)});}_0x3b8c52();})['catch'](function(_0x19d1c5){_0x3b8c52(_0x19d1c5);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x813a('0x12')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x1e44=['json','catch','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1e44,0x1b5));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x41e4('0x0'));var util=require(_0x41e4('0x1'));var compose=require('composable-middleware');var db=require(_0x41e4('0x2'))['db'];var config=require(_0x41e4('0x3'));function getValueFromLicense(_0x460afa,_0x17451b){if(_0x460afa&&_0x17451b){if(_0x17451b[_0x41e4('0x4')]&&_0x17451b[_0x41e4('0x5')]){var _0x1a2b5d=_0x17451b[_0x41e4('0x4')];var _0x5c828d=_0x17451b[_0x41e4('0x5')];var _0x27460f=_0x1a2b5d[_0x41e4('0x6')]('-')[0x4];var _0x6869dd=_0x1a2b5d[_0x41e4('0x6')]('-')[0x0];var _0x62c0db=crypto[_0x41e4('0x7')](_0x41e4('0x8'),util[_0x41e4('0x9')]('%s:%s:%s',_0x27460f,_0x1a2b5d,_0x6869dd));var _0x2b83ff=_0x62c0db[_0x41e4('0xa')](_0x5c828d,_0x41e4('0xb'),_0x41e4('0xc'));_0x2b83ff+=_0x62c0db[_0x41e4('0xd')](_0x41e4('0xc'));var _0x5e235f=JSON[_0x41e4('0xe')](_0x2b83ff);return _0x5e235f[_0x41e4('0xf')](_0x460afa)?_0x5e235f[_0x460afa]:null;}}return null;}function isLimit(_0x3ba209,_0x2a4499,_0x3f8c83,_0x5bb9cc){var _0x42fd6c=_0x2a4499;return compose()[_0x41e4('0x10')](function(_0x523d32,_0x537f7e,_0x58c35b){return db[_0x41e4('0x11')][_0x41e4('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x41e4('0x13')](function(_0x774237){var _0x1c0d67=getValueFromLicense(_0x3ba209,_0x774237);return _0x1c0d67?_0x1c0d67:_0x42fd6c;})[_0x41e4('0x13')](function(_0x18d35f){_0x42fd6c=_0x18d35f;return _0x3f8c83[_0x41e4('0x14')](_0x5bb9cc);})[_0x41e4('0x13')](function(_0x53fd8d){if(_0x53fd8d>=_0x42fd6c){return _0x537f7e[_0x41e4('0x15')](0x193)[_0x41e4('0x16')]({'message':util[_0x41e4('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3ba209)});}_0x58c35b();})[_0x41e4('0x17')](function(_0x2785db){_0x58c35b(_0x2785db);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x41e4('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x41e4('0x19')}]}});}exports[_0x41e4('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0b629d3..62174c5 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 _0x3a1e=['<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','utcOffset','hours','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','slice','forEach','shift','match','split','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$startsWith','LIKE\x20?','$lt'];(function(_0x2b6379,_0x3cc5f1){var _0x53e2dd=function(_0xc26602){while(--_0xc26602){_0x2b6379['push'](_0x2b6379['shift']());}};_0x53e2dd(++_0x3cc5f1);}(_0x3a1e,0x1de));var _0xe3a1=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x3a1e[_0x5b5eb4];return _0x42af53;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xe3a1('0x0')]=function(_0x2096f7){var _0x3d7238={'conditions':[]};_0x3d7238[_0xe3a1('0x1')]=_[_0xe3a1('0x2')](_0x2096f7,_0xe3a1('0x3'))?'or':_0xe3a1('0x4');var _0x22eba0=_0x2096f7[_0xe3a1('0x5')](_0xe3a1('0x6'),'')[_0xe3a1('0x5')](_0xe3a1('0x3'),'')['split']('||');for(var _0x1304a6=0x0;_0x1304a6<_0x22eba0[_0xe3a1('0x7')];_0x1304a6++){var _0x156298=_0x22eba0[_0x1304a6]['split'](':=');var _0x415ff7=_0x156298[0x0];var _0x570fc0=_0x156298[_0xe3a1('0x8')](0x1);_0x570fc0[_0xe3a1('0x9')](function(_0x1fc3c5){var _0x5ddf1d=_0x1fc3c5['split']('[')[_0xe3a1('0xa')]();var _0x51eb32=_0x1fc3c5[_0xe3a1('0xb')](/\[(.*?)\]/g);_0x51eb32[_0xe3a1('0x9')](function(_0x20b1a4){var _0x1f4777=_0x20b1a4[_0xe3a1('0xc')]('[')[_0xe3a1('0xd')](function(_0x47cc98){return _0x47cc98[_0xe3a1('0xe')](']')>-0x1;})['map'](function(_0x598465){return _0x598465[_0xe3a1('0xc')](']')[0x0];})[0x0];_0x3d7238[_0xe3a1('0xf')][_0xe3a1('0x10')]({'field':_0x415ff7,'operator':_0x5ddf1d,'value':_0x1f4777});});});}return _0x3d7238;};exports[_0xe3a1('0x11')]=function(_0x424427,_0x4f6c51,_0x4b5ee7){var _0x4dc64c={};if(_0x4f6c51===_0xe3a1('0x12')){if(_0x4b5ee7[_0xe3a1('0x13')]===_0xe3a1('0x14')){_0x4b5ee7[_0xe3a1('0x13')]=_0xe3a1('0x15');_0x4b5ee7[_0xe3a1('0x16')]+=','+_0x4b5ee7['value'];}else if(_[_0xe3a1('0x17')]([_0xe3a1('0x18'),_0xe3a1('0x19')],_0x4b5ee7[_0xe3a1('0x13')])){_0x4b5ee7[_0xe3a1('0x16')]=moment(_0x4b5ee7['value'])[_0xe3a1('0x1a')](0x1,_0xe3a1('0x1b'))[_0xe3a1('0x1c')](_0xe3a1('0x1d'));}}if(_0x4b5ee7[_0xe3a1('0x1e')]){_0x4f6c51=_0x4b5ee7[_0xe3a1('0x1e')];_0x4dc64c['text']='CAST('+_0x424427+'.'+_0x4b5ee7[_0xe3a1('0x1f')]+_0xe3a1('0x20')+_0x4b5ee7[_0xe3a1('0x1e')]+')\x20'+parseOperator(_0x4b5ee7[_0xe3a1('0x13')]);}else{_0x4dc64c[_0xe3a1('0x21')]=_0x424427+'.'+_0x4b5ee7[_0xe3a1('0x1f')]+'\x20'+parseOperator(_0x4b5ee7[_0xe3a1('0x13')]);}if(_['includes'](['$ne',_0xe3a1('0x22')],_0x4b5ee7[_0xe3a1('0x13')]))_0x4dc64c[_0xe3a1('0x21')]='('+_0x4dc64c[_0xe3a1('0x21')]+_0xe3a1('0x23')+_0x424427+'.'+_0x4b5ee7[_0xe3a1('0x1f')]+'\x20IS\x20NULL)';_0x4dc64c[_0xe3a1('0x16')]=parseValue(_0x4f6c51,_0x4b5ee7[_0xe3a1('0x13')],_0x4b5ee7[_0xe3a1('0x16')]);return _0x4dc64c;};function parseOperator(_0x24a4e0){var _0x4efd74;switch(_0x24a4e0){case _0xe3a1('0x24'):_0x4efd74='IN\x20?';break;case _0xe3a1('0x22'):_0x4efd74=_0xe3a1('0x25');break;case'$eq':_0x4efd74=_0xe3a1('0x26');break;case'$ne':_0x4efd74='<>\x20?';break;case'$substring':case _0xe3a1('0x27'):case'$endsWith':_0x4efd74=_0xe3a1('0x28');break;case _0xe3a1('0x29'):_0x4efd74=_0xe3a1('0x2a');break;case _0xe3a1('0x18'):_0x4efd74=_0xe3a1('0x2b');break;case _0xe3a1('0x19'):_0x4efd74=_0xe3a1('0x2c');break;case _0xe3a1('0x2d'):_0x4efd74=_0xe3a1('0x2e');break;case _0xe3a1('0x15'):_0x4efd74=_0xe3a1('0x2f');break;}return _0x4efd74;}function parseValue(_0x590112,_0x4a04fd,_0x3ea98e){var _0x54405a={'start':undefined,'end':undefined};switch(_0x4a04fd){case _0xe3a1('0x24'):case _0xe3a1('0x22'):_0x54405a[_0xe3a1('0x30')]=_0x3ea98e[_0xe3a1('0xc')](',');break;case _0xe3a1('0x31'):_0x54405a[_0xe3a1('0x30')]='%'+_0x3ea98e+'%';break;case'$startsWith':_0x54405a['start']=_0x3ea98e+'%';break;case'$endsWith':_0x54405a[_0xe3a1('0x30')]='%'+_0x3ea98e;break;case _0xe3a1('0x15'):var _0x5e5c4c=_0x3ea98e[_0xe3a1('0xc')](',');var _0x3ea98e=_0x5e5c4c[_0xe3a1('0xa')]();var _0x4fce34=_0x5e5c4c['pop']();if(_0x590112==='DATE'){_0x3ea98e=moment(_0x3ea98e)[_0xe3a1('0x32')](0x0,!![])[_0xe3a1('0x1c')]();_0x4fce34=moment(_0x4fce34)[_0xe3a1('0x32')](0x0,!![])[_0xe3a1('0x1a')](0x17,_0xe3a1('0x33'))[_0xe3a1('0x1a')](0x3b,'minutes')['add'](0x3b,'seconds')[_0xe3a1('0x1c')]();}_0x54405a={'start':_0x3ea98e,'end':_0x4fce34};break;default:_0x54405a[_0xe3a1('0x30')]=_0x3ea98e;break;}return _0x54405a;} \ No newline at end of file +var _0x78d0=['length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$lte','format','castTo','text','CAST(','\x20AS\x20','field','includes','$notIn','$in','NOT\x20IN\x20?','$ne','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','>=\x20?','start','$substring','pop','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','split'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x78d0,0x1d5));var _0x078d=function(_0x54394,_0x303f07){_0x54394=_0x54394-0x0;var _0x4b37d8=_0x78d0[_0x54394];return _0x4b37d8;};'use strict';var _=require(_0x078d('0x0'));var moment=require(_0x078d('0x1'));exports[_0x078d('0x2')]=function(_0xed954){var _0x3e8af0={'conditions':[]};_0x3e8af0[_0x078d('0x3')]=_['startsWith'](_0xed954,_0x078d('0x4'))?'or':_0x078d('0x5');var _0xe8afa1=_0xed954[_0x078d('0x6')]('[$and]','')['replace'](_0x078d('0x4'),'')[_0x078d('0x7')]('||');for(var _0x5676ee=0x0;_0x5676ee<_0xe8afa1[_0x078d('0x8')];_0x5676ee++){var _0x32f7c1=_0xe8afa1[_0x5676ee][_0x078d('0x7')](':=');var _0x40e0a7=_0x32f7c1[0x0];var _0x182e01=_0x32f7c1[_0x078d('0x9')](0x1);_0x182e01[_0x078d('0xa')](function(_0x2cb11c){var _0x20ac2a=_0x2cb11c['split']('[')[_0x078d('0xb')]();var _0x13087f=_0x2cb11c[_0x078d('0xc')](/\[(.*?)\]/g);_0x13087f[_0x078d('0xa')](function(_0x2a69a9){var _0x333f59=_0x2a69a9[_0x078d('0x7')]('[')[_0x078d('0xd')](function(_0x571a7d){return _0x571a7d[_0x078d('0xe')](']')>-0x1;})[_0x078d('0xf')](function(_0x6a1063){return _0x6a1063[_0x078d('0x7')](']')[0x0];})[0x0];_0x3e8af0[_0x078d('0x10')][_0x078d('0x11')]({'field':_0x40e0a7,'operator':_0x20ac2a,'value':_0x333f59});});});}return _0x3e8af0;};exports[_0x078d('0x12')]=function(_0x54b62f,_0x3cc53b,_0x2a7fa3){var _0x4810c9={};if(_0x3cc53b===_0x078d('0x13')){if(_0x2a7fa3[_0x078d('0x14')]===_0x078d('0x15')){_0x2a7fa3[_0x078d('0x14')]=_0x078d('0x16');_0x2a7fa3['value']+=','+_0x2a7fa3[_0x078d('0x17')];}else if(_['includes'](['$gt',_0x078d('0x18')],_0x2a7fa3[_0x078d('0x14')])){_0x2a7fa3['value']=moment(_0x2a7fa3['value'])['add'](0x1,'days')[_0x078d('0x19')]('YYYY-MM-DD');}}if(_0x2a7fa3[_0x078d('0x1a')]){_0x3cc53b=_0x2a7fa3[_0x078d('0x1a')];_0x4810c9[_0x078d('0x1b')]=_0x078d('0x1c')+_0x54b62f+'.'+_0x2a7fa3['field']+_0x078d('0x1d')+_0x2a7fa3['castTo']+')\x20'+parseOperator(_0x2a7fa3['operator']);}else{_0x4810c9[_0x078d('0x1b')]=_0x54b62f+'.'+_0x2a7fa3[_0x078d('0x1e')]+'\x20'+parseOperator(_0x2a7fa3[_0x078d('0x14')]);}if(_[_0x078d('0x1f')](['$ne',_0x078d('0x20')],_0x2a7fa3[_0x078d('0x14')]))_0x4810c9[_0x078d('0x1b')]='('+_0x4810c9[_0x078d('0x1b')]+'\x20OR\x20'+_0x54b62f+'.'+_0x2a7fa3[_0x078d('0x1e')]+'\x20IS\x20NULL)';_0x4810c9[_0x078d('0x17')]=parseValue(_0x3cc53b,_0x2a7fa3['operator'],_0x2a7fa3['value']);return _0x4810c9;};function parseOperator(_0x5cd891){var _0x114274;switch(_0x5cd891){case _0x078d('0x21'):_0x114274='IN\x20?';break;case _0x078d('0x20'):_0x114274=_0x078d('0x22');break;case _0x078d('0x15'):_0x114274='=\x20?';break;case _0x078d('0x23'):_0x114274=_0x078d('0x24');break;case'$substring':case _0x078d('0x25'):case _0x078d('0x26'):_0x114274=_0x078d('0x27');break;case _0x078d('0x28'):_0x114274=_0x078d('0x29');break;case _0x078d('0x2a'):_0x114274=_0x078d('0x2b');break;case'$lte':_0x114274='<=\x20?';break;case _0x078d('0x2c'):_0x114274=_0x078d('0x2d');break;case _0x078d('0x16'):_0x114274='BETWEEN\x20?\x20AND\x20?';break;}return _0x114274;}function parseValue(_0xbde0b6,_0x4d392c,_0x4148ef){var _0x1b421b={'start':undefined,'end':undefined};switch(_0x4d392c){case _0x078d('0x21'):case _0x078d('0x20'):_0x1b421b[_0x078d('0x2e')]=_0x4148ef['split'](',');break;case _0x078d('0x2f'):_0x1b421b[_0x078d('0x2e')]='%'+_0x4148ef+'%';break;case _0x078d('0x25'):_0x1b421b[_0x078d('0x2e')]=_0x4148ef+'%';break;case'$endsWith':_0x1b421b[_0x078d('0x2e')]='%'+_0x4148ef;break;case _0x078d('0x16'):var _0x445469=_0x4148ef[_0x078d('0x7')](',');var _0x4148ef=_0x445469[_0x078d('0xb')]();var _0x3e016a=_0x445469[_0x078d('0x30')]();if(_0xbde0b6===_0x078d('0x13')){_0x4148ef=moment(_0x4148ef)['utcOffset'](0x0,!![])[_0x078d('0x19')]();_0x3e016a=moment(_0x3e016a)[_0x078d('0x31')](0x0,!![])[_0x078d('0x32')](0x17,'hours')[_0x078d('0x32')](0x3b,_0x078d('0x33'))[_0x078d('0x32')](0x3b,_0x078d('0x34'))[_0x078d('0x19')]();}_0x1b421b={'start':_0x4148ef,'end':_0x3e016a};break;default:_0x1b421b[_0x078d('0x2e')]=_0x4148ef;break;}return _0x1b421b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d0d5bc6..924c2d2 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 _0xb48e=['lower','include','includeAll','push','escapeLIKESpecialChars','sequelize','moment','parse','keys','includes','model','fields','raw','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','name','uniqueid','isArray','split','limit','sort','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','{EXPR}','replace','trim','forEach','join','getOptions','query','$id','map','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns','value','merge','VIRTUAL'];(function(_0x2d5a3e,_0x1a5d68){var _0x56843b=function(_0x1279cb){while(--_0x1279cb){_0x2d5a3e['push'](_0x2d5a3e['shift']());}};_0x56843b(++_0x1a5d68);}(_0xb48e,0x87));var _0xeb48=function(_0x56020e,_0x20e5a5){_0x56020e=_0x56020e-0x0;var _0x307b9d=_0xb48e[_0x56020e];return _0x307b9d;};'use strict';var _=require('lodash');var sequelize=require(_0xeb48('0x0'));var moment=require(_0xeb48('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2224c3){var _0x787b2b=['ne'];try{var _0x32008d=JSON[_0xeb48('0x2')](_0x2224c3);var _0x479cf4=Object[_0xeb48('0x3')](_0x32008d)[0x0];return _0x787b2b[_0xeb48('0x4')](_0x479cf4);}catch(_0xdebdc4){return![];}}function getOperatorValue(_0x5a44eb){var _0xec92ad=JSON[_0xeb48('0x2')](_0x5a44eb);var _0xa07f13=Object[_0xeb48('0x3')](_0xec92ad)[0x0];var _0x1179b3=_0xec92ad[_0xa07f13];return{['$'+_0xa07f13]:_0x1179b3};}function parseIncludeModel(_0x25973e){var _0x9b2abc=JSON[_0xeb48('0x2')](_0x25973e);return{'model':db[_0x9b2abc[_0xeb48('0x5')]],'as':_0x9b2abc['alias'],'attributes':_0x9b2abc[_0xeb48('0x6')],'raw':_0x9b2abc[_0xeb48('0x7')]};}exports[_0xeb48('0x6')]=function(_0x957e91){var _0xf01075=null;if(_0x957e91){_0xf01075=_0x957e91['split'](',');}return _0xf01075;};exports[_0xeb48('0x8')]=function(_0x50e721,_0xe8fa05){var _0x1c3d12={};if(!_[_0xeb48('0x9')](_0x50e721)){_[_0xeb48('0xa')](_0x50e721,function(_0x3b95e5,_0x337b5c){try{if(_0xe8fa05){var _0x41fa1d=_['find'](_0xe8fa05,{'name':_0x337b5c})||{};if(hasSequelizeOperator(_0x3b95e5)){_0x1c3d12[_0x337b5c]=getOperatorValue(_0x3b95e5);}else if(_0x41fa1d[_0xeb48('0xb')]===_0xeb48('0xc')&&_[_0xeb48('0xd')](_0x3b95e5)){var _0x2ca6c3=JSON['parse'](_0x3b95e5);var _0x1b7f13={'$gte':moment(moment(_0x2ca6c3[_0xeb48('0xe')])[_0xeb48('0xf')](_0xeb48('0x10')))['utc']()[_0xeb48('0xf')](),'$lte':moment(moment(_0x2ca6c3['$lte'])[_0xeb48('0xf')](_0xeb48('0x10')))['utc']()['subtract'](0x1,'s')[_0xeb48('0xf')]()};_0x1c3d12[_0x337b5c]=_0x1b7f13;}else if(_0x41fa1d[_0xeb48('0x11')]===_0xeb48('0x12')){_0x1c3d12[_0x337b5c]=_0x3b95e5;}else{_0x1c3d12[_0x337b5c]=_[_0xeb48('0x13')](_0x3b95e5)?_0x3b95e5:JSON[_0xeb48('0x2')](_0x3b95e5);}}else{_0x1c3d12[_0x337b5c]=_[_0xeb48('0x13')](_0x3b95e5)?_0x3b95e5:JSON[_0xeb48('0x2')](_0x3b95e5);}}catch(_0x53cd55){_0x1c3d12[_0x337b5c]=_0x3b95e5[_0xeb48('0x14')](',');}});}return _0x1c3d12;};exports[_0xeb48('0x15')]=function(_0x239c56){_0x239c56=parseInt(_0x239c56,0xa);if(!_0x239c56||_0x239c56<0x0){_0x239c56=LIMIT_VALUE;}return _0x239c56;};exports['offset']=function(_0x11bc10){_0x11bc10=parseInt(_0x11bc10,0xa);if(!_0x11bc10||_0x11bc10<0x0){_0x11bc10=0x0;}return _0x11bc10;};exports[_0xeb48('0x16')]=function(_0x58aec8){var _0xf7a39,_0x1f1ebb=null;if(_0x58aec8){_0xf7a39=_0x58aec8[_0xeb48('0x14')](',');_0x1f1ebb=_['map'](_0xf7a39,function(_0x55ec24){if(_0x55ec24[_0xeb48('0x17')]('-')===0x0){return[_0x55ec24===_0xeb48('0x18')?sequelize[_0xeb48('0x19')](sequelize[_0xeb48('0x1a')](_0xeb48('0x18')),_0xeb48('0x1b')):_0x55ec24[_0xeb48('0x1c')](0x1),'DESC'];}else{return[_0x55ec24==='priority'?sequelize['cast'](sequelize[_0xeb48('0x1a')]('priority'),'unsigned'):_0x55ec24,'ASC'];}});}return _0x1f1ebb;};exports[_0xeb48('0x1d')]=function(_0x1dbba6,_0x4f0406){if(_['isEmpty'](_0x1dbba6)){return _0x1dbba6;}if(_['isArray'](_0x1dbba6)){for(var _0x4992b6=0x0;_0x4992b6<_0x1dbba6[_0xeb48('0x1e')];_0x4992b6+=0x1){_0x1dbba6[_0x4992b6]=this[_0xeb48('0x1d')](_0x1dbba6[_0x4992b6],_0x4f0406);}return _0x1dbba6;}if(!_[_0xeb48('0x1f')](_0x1dbba6)){return _0x1dbba6;}if(_['isString'](_0x4f0406)){_0x4f0406=[_0x4f0406];}if(!_[_0xeb48('0x13')](_0x4f0406)){return _0x1dbba6;}for(var _0x4e7f41=0x0;_0x4e7f41<_0x4f0406[_0xeb48('0x1e')];_0x4e7f41+=0x1){_[_0xeb48('0x20')](_0x1dbba6,_0x4f0406[_0x4e7f41]);}for(var _0x18b211 in _0x1dbba6){if(_0x1dbba6[_0xeb48('0x21')](_0x18b211)){_0x1dbba6[_0x18b211]=this['omit'](_0x1dbba6[_0x18b211],_0x4f0406);}}return _0x1dbba6;};exports[_0xeb48('0x22')]=function(_0x8cee94){return _0x8cee94[_0xeb48('0x23')](RegExp(_0xeb48('0x24')))?!![]:![];};exports[_0xeb48('0x25')]=function(_0x29c3b2){return _0x29c3b2[_0xeb48('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x268776,_0x5e46e4){var _0x344f45=[];var _0x1bc3c1=/([^:]")"+/g;var _0x51ce9b=/[*<>~@-]/g;var _0x233a3a=/[ `!@#$%^&*()_\-?~<>]/;var _0x4355ca=/[ ,]+/;var _0x5b70db=_0x5e46e4?'\x22{EXPR}\x22':_0xeb48('0x26');if(_0x5e46e4){_0x268776=_0x268776[_0xeb48('0x27')](_0x51ce9b,'\x20')[_0xeb48('0x28')]();}_0x268776['split'](_0x4355ca)[_0xeb48('0x29')](function(_0x2bbf83){_0x2bbf83=_0x2bbf83['replace'](_0x1bc3c1,'$1');_0x2bbf83='+'+_0x2bbf83+'*';var _0x54894d=_0x2bbf83[_0xeb48('0x23')](_0x233a3a);if(_0x54894d){_0x2bbf83='\x22'+_0x2bbf83+'\x22';}_0x344f45['push'](_0x2bbf83);});_0x5b70db=_0x5b70db[_0xeb48('0x27')](_0xeb48('0x26'),_0x344f45[_0xeb48('0x2a')]('\x20'));return _0x5b70db;};exports[_0xeb48('0x2b')]=function(_0x1bb189,_0x546107,_0xf42a80){var _0x3a23b4={},_0x4c11e8={};if(_0x546107[_0xeb48('0x2c')][_0xeb48('0x2d')]){_0x546107['query']['id']=_0x546107[_0xeb48('0x2c')]['$id'];delete _0x546107['query'][_0xeb48('0x2d')];}_0x3a23b4[_0xeb48('0x5')]=_[_0xeb48('0x2e')](_0x1bb189,_0xeb48('0x11'));_0x3a23b4[_0xeb48('0x2c')]=_[_0xeb48('0x3')](_0x546107['query']);_0x3a23b4[_0xeb48('0x8')]=_[_0xeb48('0x2f')](_0x3a23b4[_0xeb48('0x5')],_0x3a23b4[_0xeb48('0x2c')]);_0x4c11e8[_0xeb48('0x30')]=_[_0xeb48('0x2f')](_0x3a23b4[_0xeb48('0x5')],this[_0xeb48('0x6')](_0x546107['query'][_0xeb48('0x6')]));_0x4c11e8[_0xeb48('0x30')]=_0x4c11e8[_0xeb48('0x30')][_0xeb48('0x1e')]?_0x4c11e8[_0xeb48('0x30')]:_0x3a23b4['model'];if(!_0x546107['query'][_0xeb48('0x21')](_0xeb48('0x31'))){_0x4c11e8[_0xeb48('0x15')]=this[_0xeb48('0x15')](_0x546107['query'][_0xeb48('0x15')]);_0x4c11e8[_0xeb48('0x32')]=this[_0xeb48('0x32')](_0x546107['query'][_0xeb48('0x32')]);}_0x4c11e8[_0xeb48('0x33')]=this[_0xeb48('0x16')](_0x546107['query'][_0xeb48('0x16')]);_0x4c11e8[_0xeb48('0x34')]=this[_0xeb48('0x8')](_[_0xeb48('0x35')](_0x546107['query'],_0x3a23b4[_0xeb48('0x8')]),_0x1bb189);if(_0x546107['query']['filter']){var _0x54ab89=_0x1bb189;var _0x2074e1=_0x546107[_0xeb48('0x2c')][_0xeb48('0x36')];if(typeof _0x2074e1===_0xeb48('0x37')){_0x54ab89=_['filter'](_0x1bb189,function(_0x326260){return _[_0xeb48('0x4')](_0x2074e1[_0xeb48('0x38')],_0x326260[_0xeb48('0x11')]);});_0x2074e1=_0x2074e1[_0xeb48('0x39')];}_0x4c11e8[_0xeb48('0x34')]=_[_0xeb48('0x3a')](_0x4c11e8[_0xeb48('0x34')],{'$or':_[_0xeb48('0x2e')](_0x54ab89,function(_0x10c5a6){if(_0x10c5a6['type']!==_0xeb48('0x3b')){if(_0xf42a80){return sequelize[_0xeb48('0x34')](sequelize['fn'](_0xeb48('0x3c'),sequelize[_0xeb48('0x1a')](_0x10c5a6[_0xeb48('0x11')])),{'$like':sequelize['fn'](_0xeb48('0x3c'),'%'+_0x546107[_0xeb48('0x2c')][_0xeb48('0x36')]+'%')});}else{var _0x15a095={};_0x15a095[_0x10c5a6['name']]={'$like':'%'+_0x546107[_0xeb48('0x2c')][_0xeb48('0x36')]+'%'};return _0x15a095;}}})});}_0x4c11e8=_[_0xeb48('0x3a')]({},_0x4c11e8,_0x546107['options']);return _0x4c11e8;};exports[_0xeb48('0x3d')]=function(_0x598f78){var _0x4b2c5e=[];if(_0x598f78[_0xeb48('0x3e')]){_0x4b2c5e['push']({'all':!![]});}else if(_0x598f78['include']){if(Array[_0xeb48('0x13')](_0x598f78[_0xeb48('0x3d')])){_0x4b2c5e=Object[_0xeb48('0x3')](_0x598f78[_0xeb48('0x3d')])[_0xeb48('0x2e')](function(_0x57f59b){return parseIncludeModel(_0x598f78['include'][_0x57f59b]);});}else{var _0x55b350=parseIncludeModel(_0x598f78[_0xeb48('0x3d')]);_0x4b2c5e[_0xeb48('0x3f')](_0x55b350);}}return _0x4b2c5e;};exports[_0xeb48('0x40')]=function(_0x2136f2){return _0x2136f2[_0xeb48('0x27')](/[%_^-]/g,function(_0x1ccf56){return'\x5c'+_0x1ccf56;});}; \ No newline at end of file +var _0x565b=['map','priority','cast','unsigned','substr','DESC','col','omit','length','isString','unset','hasOwnProperty','isNumeric','isEmail','match','\x22{EXPR}\x22','{EXPR}','replace','forEach','push','join','getOptions','query','$id','intersection','attributes','nolimit','order','filter','object','columns','value','where','merge','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','fields','raw','split','filters','forOwn','find','type','DATE','isPlainObject','format','utc','$lte','YYYY-MM-DD','name','uniqueid','isArray','limit','offset','sort'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x565b,0x6a));var _0xb565=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x565b[_0x7c0074];return _0x13e95b;};'use strict';var _=require(_0xb565('0x0'));var sequelize=require(_0xb565('0x1'));var moment=require(_0xb565('0x2'));var db=require(_0xb565('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x307cdb){var _0x42c471=['ne'];try{var _0x3a5c38=JSON['parse'](_0x307cdb);var _0x1a420b=Object[_0xb565('0x4')](_0x3a5c38)[0x0];return _0x42c471[_0xb565('0x5')](_0x1a420b);}catch(_0x552691){return![];}}function getOperatorValue(_0x508ec7){var _0x100e9c=JSON[_0xb565('0x6')](_0x508ec7);var _0x33159b=Object[_0xb565('0x4')](_0x100e9c)[0x0];var _0x5b574c=_0x100e9c[_0x33159b];return{['$'+_0x33159b]:_0x5b574c};}function parseIncludeModel(_0x290d2a){var _0x5b4753=JSON[_0xb565('0x6')](_0x290d2a);return{'model':db[_0x5b4753[_0xb565('0x7')]],'as':_0x5b4753[_0xb565('0x8')],'attributes':_0x5b4753[_0xb565('0x9')],'raw':_0x5b4753[_0xb565('0xa')]};}exports[_0xb565('0x9')]=function(_0x402841){var _0x24eafd=null;if(_0x402841){_0x24eafd=_0x402841[_0xb565('0xb')](',');}return _0x24eafd;};exports[_0xb565('0xc')]=function(_0x3285d2,_0x43cc61){var _0x25ef5d={};if(!_['isEmpty'](_0x3285d2)){_[_0xb565('0xd')](_0x3285d2,function(_0x10f9dc,_0x57c8a4){try{if(_0x43cc61){var _0x4605bb=_[_0xb565('0xe')](_0x43cc61,{'name':_0x57c8a4})||{};if(hasSequelizeOperator(_0x10f9dc)){_0x25ef5d[_0x57c8a4]=getOperatorValue(_0x10f9dc);}else if(_0x4605bb[_0xb565('0xf')]===_0xb565('0x10')&&_[_0xb565('0x11')](_0x10f9dc)){var _0x2ae395=JSON[_0xb565('0x6')](_0x10f9dc);var _0xb0644f={'$gte':moment(moment(_0x2ae395['$gte'])[_0xb565('0x12')]('YYYY-MM-DD'))[_0xb565('0x13')]()[_0xb565('0x12')](),'$lte':moment(moment(_0x2ae395[_0xb565('0x14')])['format'](_0xb565('0x15')))['utc']()['subtract'](0x1,'s')[_0xb565('0x12')]()};_0x25ef5d[_0x57c8a4]=_0xb0644f;}else if(_0x4605bb[_0xb565('0x16')]===_0xb565('0x17')){_0x25ef5d[_0x57c8a4]=_0x10f9dc;}else{_0x25ef5d[_0x57c8a4]=_['isArray'](_0x10f9dc)?_0x10f9dc:JSON['parse'](_0x10f9dc);}}else{_0x25ef5d[_0x57c8a4]=_[_0xb565('0x18')](_0x10f9dc)?_0x10f9dc:JSON[_0xb565('0x6')](_0x10f9dc);}}catch(_0x3fc598){_0x25ef5d[_0x57c8a4]=_0x10f9dc[_0xb565('0xb')](',');}});}return _0x25ef5d;};exports[_0xb565('0x19')]=function(_0x2ca93d){_0x2ca93d=parseInt(_0x2ca93d,0xa);if(!_0x2ca93d||_0x2ca93d<0x0){_0x2ca93d=LIMIT_VALUE;}return _0x2ca93d;};exports[_0xb565('0x1a')]=function(_0x27e398){_0x27e398=parseInt(_0x27e398,0xa);if(!_0x27e398||_0x27e398<0x0){_0x27e398=0x0;}return _0x27e398;};exports[_0xb565('0x1b')]=function(_0x37252b){var _0x38d113,_0x513b05=null;if(_0x37252b){_0x38d113=_0x37252b[_0xb565('0xb')](',');_0x513b05=_[_0xb565('0x1c')](_0x38d113,function(_0x564b84){if(_0x564b84['indexOf']('-')===0x0){return[_0x564b84===_0xb565('0x1d')?sequelize[_0xb565('0x1e')](sequelize['col'](_0xb565('0x1d')),_0xb565('0x1f')):_0x564b84[_0xb565('0x20')](0x1),_0xb565('0x21')];}else{return[_0x564b84===_0xb565('0x1d')?sequelize[_0xb565('0x1e')](sequelize[_0xb565('0x22')](_0xb565('0x1d')),_0xb565('0x1f')):_0x564b84,'ASC'];}});}return _0x513b05;};exports[_0xb565('0x23')]=function(_0x145b0c,_0xa6f47a){if(_['isEmpty'](_0x145b0c)){return _0x145b0c;}if(_['isArray'](_0x145b0c)){for(var _0x333e7d=0x0;_0x333e7d<_0x145b0c[_0xb565('0x24')];_0x333e7d+=0x1){_0x145b0c[_0x333e7d]=this[_0xb565('0x23')](_0x145b0c[_0x333e7d],_0xa6f47a);}return _0x145b0c;}if(!_['isObject'](_0x145b0c)){return _0x145b0c;}if(_[_0xb565('0x25')](_0xa6f47a)){_0xa6f47a=[_0xa6f47a];}if(!_[_0xb565('0x18')](_0xa6f47a)){return _0x145b0c;}for(var _0x478652=0x0;_0x478652<_0xa6f47a[_0xb565('0x24')];_0x478652+=0x1){_[_0xb565('0x26')](_0x145b0c,_0xa6f47a[_0x478652]);}for(var _0x1057a9 in _0x145b0c){if(_0x145b0c[_0xb565('0x27')](_0x1057a9)){_0x145b0c[_0x1057a9]=this[_0xb565('0x23')](_0x145b0c[_0x1057a9],_0xa6f47a);}}return _0x145b0c;};exports[_0xb565('0x28')]=function(_0x169480){return _0x169480['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xb565('0x29')]=function(_0xb3e75c){return _0xb3e75c[_0xb565('0x2a')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5a5f90,_0x4760dc){var _0x52909c=[];var _0x55649f=/([^:]")"+/g;var _0x3e0a46=/[*<>~@-]/g;var _0x481c2e=/[ `!@#$%^&*()_\-?~<>]/;var _0x45d28b=/[ ,]+/;var _0x461508=_0x4760dc?_0xb565('0x2b'):_0xb565('0x2c');if(_0x4760dc){_0x5a5f90=_0x5a5f90[_0xb565('0x2d')](_0x3e0a46,'\x20')['trim']();}_0x5a5f90['split'](_0x45d28b)[_0xb565('0x2e')](function(_0x44bbb0){_0x44bbb0=_0x44bbb0[_0xb565('0x2d')](_0x55649f,'$1');_0x44bbb0='+'+_0x44bbb0+'*';var _0x47f2f4=_0x44bbb0[_0xb565('0x2a')](_0x481c2e);if(_0x47f2f4){_0x44bbb0='\x22'+_0x44bbb0+'\x22';}_0x52909c[_0xb565('0x2f')](_0x44bbb0);});_0x461508=_0x461508[_0xb565('0x2d')](_0xb565('0x2c'),_0x52909c[_0xb565('0x30')]('\x20'));return _0x461508;};exports[_0xb565('0x31')]=function(_0xebedd0,_0x1b6639,_0x236a98){var _0x3bb2fb={},_0x19e891={};if(_0x1b6639[_0xb565('0x32')][_0xb565('0x33')]){_0x1b6639['query']['id']=_0x1b6639[_0xb565('0x32')][_0xb565('0x33')];delete _0x1b6639[_0xb565('0x32')][_0xb565('0x33')];}_0x3bb2fb[_0xb565('0x7')]=_[_0xb565('0x1c')](_0xebedd0,_0xb565('0x16'));_0x3bb2fb[_0xb565('0x32')]=_[_0xb565('0x4')](_0x1b6639['query']);_0x3bb2fb[_0xb565('0xc')]=_[_0xb565('0x34')](_0x3bb2fb[_0xb565('0x7')],_0x3bb2fb[_0xb565('0x32')]);_0x19e891[_0xb565('0x35')]=_[_0xb565('0x34')](_0x3bb2fb[_0xb565('0x7')],this['fields'](_0x1b6639[_0xb565('0x32')][_0xb565('0x9')]));_0x19e891[_0xb565('0x35')]=_0x19e891[_0xb565('0x35')][_0xb565('0x24')]?_0x19e891['attributes']:_0x3bb2fb['model'];if(!_0x1b6639['query']['hasOwnProperty'](_0xb565('0x36'))){_0x19e891['limit']=this[_0xb565('0x19')](_0x1b6639[_0xb565('0x32')][_0xb565('0x19')]);_0x19e891[_0xb565('0x1a')]=this['offset'](_0x1b6639[_0xb565('0x32')][_0xb565('0x1a')]);}_0x19e891[_0xb565('0x37')]=this[_0xb565('0x1b')](_0x1b6639[_0xb565('0x32')][_0xb565('0x1b')]);_0x19e891['where']=this[_0xb565('0xc')](_['pick'](_0x1b6639[_0xb565('0x32')],_0x3bb2fb[_0xb565('0xc')]),_0xebedd0);if(_0x1b6639[_0xb565('0x32')][_0xb565('0x38')]){var _0x5f908a=_0xebedd0;var _0x419ed5=_0x1b6639[_0xb565('0x32')]['filter'];if(typeof _0x419ed5===_0xb565('0x39')){_0x5f908a=_[_0xb565('0x38')](_0xebedd0,function(_0x2b9efc){return _[_0xb565('0x5')](_0x419ed5[_0xb565('0x3a')],_0x2b9efc[_0xb565('0x16')]);});_0x419ed5=_0x419ed5[_0xb565('0x3b')];}_0x19e891[_0xb565('0x3c')]=_[_0xb565('0x3d')](_0x19e891[_0xb565('0x3c')],{'$or':_[_0xb565('0x1c')](_0x5f908a,function(_0x38d058){if(_0x38d058[_0xb565('0xf')]!=='VIRTUAL'){if(_0x236a98){return sequelize[_0xb565('0x3c')](sequelize['fn'](_0xb565('0x3e'),sequelize[_0xb565('0x22')](_0x38d058['name'])),{'$like':sequelize['fn'](_0xb565('0x3e'),'%'+_0x1b6639[_0xb565('0x32')][_0xb565('0x38')]+'%')});}else{var _0x1d4df2={};_0x1d4df2[_0x38d058[_0xb565('0x16')]]={'$like':'%'+_0x1b6639[_0xb565('0x32')]['filter']+'%'};return _0x1d4df2;}}})});}_0x19e891=_[_0xb565('0x3d')]({},_0x19e891,_0x1b6639[_0xb565('0x3f')]);return _0x19e891;};exports[_0xb565('0x40')]=function(_0x2455bb){var _0x4b47cb=[];if(_0x2455bb[_0xb565('0x41')]){_0x4b47cb[_0xb565('0x2f')]({'all':!![]});}else if(_0x2455bb['include']){if(Array[_0xb565('0x18')](_0x2455bb[_0xb565('0x40')])){_0x4b47cb=Object[_0xb565('0x4')](_0x2455bb['include'])[_0xb565('0x1c')](function(_0x458f8d){return parseIncludeModel(_0x2455bb[_0xb565('0x40')][_0x458f8d]);});}else{var _0x2a502e=parseIncludeModel(_0x2455bb['include']);_0x4b47cb[_0xb565('0x2f')](_0x2a502e);}}return _0x4b47cb;};exports[_0xb565('0x42')]=function(_0x163e6e){return _0x163e6e['replace'](/[%_^-]/g,function(_0x3e4e42){return'\x5c'+_0x3e4e42;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 71da8fe..e312ba4 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 _0x96f2=['faxStatus','mailStatus','openchannelStatus','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','busy','getAgentStatus','isArray','Queue','getAgents','all','flatten','value','map','getAgentIdsByStatus','resolve','includes','User','openchannelPause','pauseType','find','getSortedAgentsIdsByStatus','split','globalStatus','order','startsWith','DESC','ASC','fullname,internal','fullname','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','address','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','smsStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','mailPause','whatsappStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','chatCapacity','mailCapacity','openchannelCapacity','chatCurrentCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','voiceStatus','idle','chatStatus'];(function(_0x5d3c55,_0xb01203){var _0x142123=function(_0x1dfc1b){while(--_0x1dfc1b){_0x5d3c55['push'](_0x5d3c55['shift']());}};_0x142123(++_0xb01203);}(_0x96f2,0xb0));var _0x296f=function(_0xdea59a,_0x44f121){_0xdea59a=_0xdea59a-0x0;var _0x4ef008=_0x96f2[_0xdea59a];return _0x4ef008;};'use strict';var _=require(_0x296f('0x0'));var jayson=require('jayson/promise');var db=require(_0x296f('0x1'))['db'];var amiClient=jayson[_0x296f('0x2')][_0x296f('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x296f('0x3')]({'port':0x232c});function isAgentPaused(_0x333b22,_0x334a4e){var _0x57f54e=[_0x333b22[_0x296f('0x4')],_0x333b22[_0x296f('0x5')],_0x333b22['mailPause'],_0x333b22['openchannelPause'],_0x333b22[_0x296f('0x6')],_0x333b22[_0x296f('0x7')],_0x333b22[_0x296f('0x8')]];if(!_0x334a4e)return _[_0x296f('0x9')](_0x57f54e);var _0x30ed43=_[_0x296f('0xa')](_0x57f54e);return _0x30ed43[_0x296f('0xb')]>0x0&&_0x30ed43[_0x296f('0xb')]<_0x57f54e[_0x296f('0xb')]?!![]:![];}function isIdle(_0x3729ab){return _0x3729ab==='idle'||_0x3729ab===_0x296f('0xc')||_0x3729ab===_0x296f('0xd')||_0x3729ab===_0x296f('0xe')||_['isNil'](_0x3729ab);}function isAgentIdle(_0x2e2307){if(_0x2e2307[_0x296f('0xf')]!==_0x296f('0x10')&&_0x2e2307[_0x296f('0x7')]){_0x2e2307['voiceStatus']='pause';return![];}return _['every']([_0x2e2307[_0x296f('0x11')],_0x2e2307[_0x296f('0x12')],_0x2e2307[_0x296f('0x13')],_0x2e2307[_0x296f('0x14')],_0x2e2307['smsStatus'],_0x2e2307[_0x296f('0xf')],_0x2e2307['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x296f('0x15'),{})[_0x296f('0x16')](function(_0x33654c){if(_0x33654c[_0x296f('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4a2aaa=_0x33654c[_0x296f('0x18')];return routingClient['request'](_0x296f('0x15'),{})[_0x296f('0x16')](function(_0xfc0b87){if(_0xfc0b87['error']){throw new Error(_0x296f('0x19'));}var _0x3b7db8=_0xfc0b87['result'];return _[_0x296f('0x1a')]({},_0x4a2aaa,_0x3b7db8);});})[_0x296f('0x1b')](function(_0x51498d){throw _0x51498d;});}exports[_0x296f('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x5cedbc){var _0x132005=_0x296f('0xc');if(isAgentPaused(_0x5cedbc))_0x132005=_0x296f('0x1d');else if(isAgentPaused(_0x5cedbc,!![]))_0x132005='*pause';else if(isAgentIdle(_0x5cedbc))_0x132005=_0x296f('0x10');else _0x132005=_0x296f('0x1e');return _0x132005;}exports[_0x296f('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x56cb8a,_0x2a9a1c){var _0x108c9b=_[_0x296f('0x20')](_0x56cb8a)?_0x56cb8a:[_0x56cb8a];var _0x52438b=_['startCase'](_0x2a9a1c)+_0x296f('0x21');var _0x58bddc=_['map'](_0x108c9b,function(_0xf39fb){return db[_0x52438b]['findOne']({'where':{'id':_0xf39fb}})['then'](function(_0x579977){if(!_0x579977)return[];return _0x579977[_0x296f('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x296f('0x23')](_0x58bddc)[_0x296f('0x16')](function(_0x371db0){var _0x2b8078=_(_0x371db0)[_0x296f('0x24')]()['map']('id')['uniq']()[_0x296f('0x25')]();return _0x2b8078;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0xc47d1f,_0x1de36c,_0x436865){try{if(_0x1de36c[_0x296f('0xb')]>0x0){_0xc47d1f=_0xc47d1f[_0x296f('0xa')](function(_0x28d624){return _0x1de36c['includes'](_0x28d624['id']);});}var _0x3e66a5=_0xc47d1f['filter'](function(_0x167607){var _0x288c3e=_0x296f('0x1e');if(isAgentIdle(_0x167607)){_0x288c3e=_0x296f('0x10');}return _0x288c3e===_0x436865;});return _[_0x296f('0x26')](_0x3e66a5,'id');}catch(_0xdf21e8){throw _0xdf21e8;}}exports[_0x296f('0x27')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f944f,_0x3d43c6,_0x99f238){return Promise[_0x296f('0x28')]()[_0x296f('0x16')](function(){if(_0x3d43c6[_0x296f('0xb')]>0x0){_0x2f944f=_0x2f944f['filter'](function(_0xd5c83a){return _0x3d43c6[_0x296f('0x29')](_0xd5c83a['id']);});}return _0x2f944f;})[_0x296f('0x16')](function(){return db[_0x296f('0x2a')]['findAll']({'attributes':['id','name','fullname',_0x296f('0x4'),_0x296f('0x5'),'mailPause',_0x296f('0x2b'),_0x296f('0x6'),'voicePause','whatsappPause',_0x296f('0x2c')],'where':{'id':{'$in':_[_0x296f('0x26')](_0x2f944f,'id')}},'raw':!![]});})['then'](function(_0xaacb54){return _0xaacb54[_0x296f('0x26')](function(_0x1f57de){var _0x103abd=_[_0x296f('0x2d')](_0x2f944f,['id',_0x1f57de['id']]);var _0x322031=filterAgentAttributes(_0x103abd);_['merge'](_0x1f57de,_0x322031);_0x1f57de['globalStatus']=getAgentStatus(_0x1f57de);return _0x1f57de;});})['then'](function(_0x335964){var _0x505aab=sortAgentsByStatus(_0x335964,_0x99f238);return _['map'](_0x505aab,'id');})[_0x296f('0x1b')](function(_0x1a59a6){throw _0x1a59a6;});}exports[_0x296f('0x2e')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x10a5c5){var _0x29b943={'fields':[],'order':null};var _0x3e381d=_0x10a5c5[_0x296f('0x2f')](',');_0x29b943['fields']=_[_0x296f('0xa')](_0x3e381d,function(_0x12dad2){if(!_0x12dad2[_0x296f('0x29')](_0x296f('0x30'))){return!![];}_0x29b943[_0x296f('0x31')]=_[_0x296f('0x32')](_0x12dad2,'-')?_0x296f('0x33'):_0x296f('0x34');return![];});return _0x29b943;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x27b9a9){if(!_0x27b9a9){_0x27b9a9=_0x296f('0x35');}if(_0x27b9a9['includes'](_0x296f('0x36'))&&!_0x27b9a9[_0x296f('0x29')]('internal')){var _0x597096=_0x27b9a9[_0x296f('0x37')](0x0,_0x27b9a9[_0x296f('0x38')](_0x296f('0x36')));_0x27b9a9+=','+_0x597096+_0x296f('0x39');}return _0x27b9a9;}exports[_0x296f('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x1b77ea,_0x3c1162){var _0xcac3e4=_0x1b77ea[_0x296f('0x3b')](function(_0x54d10b,_0x3145a4){if(_0x54d10b['globalStatus']===_0x3145a4[_0x296f('0x30')]){if(_0x54d10b[_0x296f('0x30')]===_0x296f('0x1d')){if(_0x3c1162===_0x296f('0x33')){return(_0x54d10b['pauseType']||'')<(_0x3145a4[_0x296f('0x2c')]||'')||_0x54d10b['fullname'][_0x296f('0x3c')]()>_0x3145a4['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x54d10b['pauseType']||'')<(_0x3145a4[_0x296f('0x2c')]||'')||_0x54d10b[_0x296f('0x36')][_0x296f('0x3c')]()>_0x3145a4[_0x296f('0x36')][_0x296f('0x3c')]()?-0x1:0x1;}}else{if(_0x3c1162===_0x296f('0x33')){return _0x54d10b[_0x296f('0x36')]['toLowerCase']()<_0x3145a4['fullname'][_0x296f('0x3c')]()?0x1:-0x1;}else{return _0x54d10b['fullname'][_0x296f('0x3c')]()<_0x3145a4[_0x296f('0x36')][_0x296f('0x3c')]()?-0x1:0x1;}}}else{if(_0x3c1162===_0x296f('0x33')){return _0x54d10b[_0x296f('0x30')]<_0x3145a4[_0x296f('0x30')]?0x1:-0x1;}else{return _0x54d10b[_0x296f('0x30')]<_0x3145a4[_0x296f('0x30')]?-0x1:0x1;}}});return _0xcac3e4;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x4b6420){var _0x2dbb86=[_0x296f('0x3d'),_0x296f('0x3e'),_0x296f('0x3f'),_0x296f('0x40'),_0x296f('0x2c'),'lastPauseAt','internal',_0x296f('0x41'),_0x296f('0x4'),'openchannelPause','mailPause',_0x296f('0x6'),_0x296f('0x8'),'faxPause',_0x296f('0x7'),'chatCapacity','openchannelCapacity','mailCapacity',_0x296f('0x42'),_0x296f('0x43'),_0x296f('0x44'),'chatCurrentCapacity',_0x296f('0x45'),_0x296f('0x46'),_0x296f('0x47'),'whatsappCurrentCapacity',_0x296f('0x48'),_0x296f('0x11'),'openchannelStatus',_0x296f('0x13'),_0x296f('0x49'),'whatsappStatus',_0x296f('0x12'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x296f('0x4a'),_0x296f('0x4b'),'whatsappStatusTime',_0x296f('0x4c'),_0x296f('0x4d'),_0x296f('0x4e'),_0x296f('0x4f'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x296f('0x50')];var _0x5425bc=[_0x296f('0x4'),_0x296f('0x2b'),'mailPause',_0x296f('0x6'),_0x296f('0x8'),_0x296f('0x5'),'voicePause',_0x296f('0x3e')];var _0x238b92=_(_0x4b6420)[_0x296f('0x51')](_0x5425bc)[_0x296f('0x52')](_0x2dbb86)[_0x296f('0x25')]();return _0x238b92;}exports[_0x296f('0x53')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x296f('0x36'),'role',_0x296f('0x39'),_0x296f('0x3e'),_0x296f('0x30'),_0x296f('0x3d'),_0x296f('0x3f'),_0x296f('0x2c'),_0x296f('0x40'),'faxPause',_0x296f('0x4'),_0x296f('0x54'),'openchannelPause',_0x296f('0x6'),_0x296f('0x7'),'whatsappPause',_0x296f('0x11'),_0x296f('0x12'),_0x296f('0x13'),'openchannelStatus',_0x296f('0x49'),_0x296f('0xf'),_0x296f('0x55'),_0x296f('0x56'),'faxStatusTime',_0x296f('0x4a'),_0x296f('0x57'),'smsStatusTime',_0x296f('0x4d'),_0x296f('0x58'),_0x296f('0x59'),_0x296f('0x44'),_0x296f('0x5a'),_0x296f('0x5b'),_0x296f('0x42'),_0x296f('0x43'),_0x296f('0x5c'),_0x296f('0x48'),'mailCurrentCapacity',_0x296f('0x45'),'smsCurrentCapacity',_0x296f('0x5d'),_0x296f('0x5e'),_0x296f('0x50'),_0x296f('0x4f'),_0x296f('0x5f'),'queue','screenrecording'];}exports[_0x296f('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xb114=['smsPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','ringing','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','then','error','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','pause','busy','getAgentStatus','isArray','startCase','Queue','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','map','getAgentIdsByStatus','resolve','User','fullname','faxPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','sort','toLowerCase','DESC','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','filterAgentAttributes','name','role','whatsappStatusTime','onhold','queue','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','mailPause','openchannelPause'];(function(_0xcc6812,_0x5cdc5b){var _0x1815ea=function(_0x5b340e){while(--_0x5b340e){_0xcc6812['push'](_0xcc6812['shift']());}};_0x1815ea(++_0x5cdc5b);}(_0xb114,0x11f));var _0x4b11=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb114[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x4b11('0x0'));var jayson=require('jayson/promise');var db=require(_0x4b11('0x1'))['db'];var amiClient=jayson[_0x4b11('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4b11('0x2')][_0x4b11('0x3')]({'port':0x232c});function isAgentPaused(_0x1e2928,_0x12de1d){var _0x1ad72f=[_0x1e2928[_0x4b11('0x4')],_0x1e2928['faxPause'],_0x1e2928[_0x4b11('0x5')],_0x1e2928[_0x4b11('0x6')],_0x1e2928[_0x4b11('0x7')],_0x1e2928[_0x4b11('0x8')],_0x1e2928[_0x4b11('0x9')]];if(!_0x12de1d)return _[_0x4b11('0xa')](_0x1ad72f);var _0x25ff0a=_['filter'](_0x1ad72f);return _0x25ff0a[_0x4b11('0xb')]>0x0&&_0x25ff0a['length']<_0x1ad72f[_0x4b11('0xb')]?!![]:![];}function isIdle(_0x7f1ed0){return _0x7f1ed0===_0x4b11('0xc')||_0x7f1ed0===_0x4b11('0xd')||_0x7f1ed0===_0x4b11('0xe')||_0x7f1ed0===_0x4b11('0xf')||_['isNil'](_0x7f1ed0);}function isAgentIdle(_0x2ca996){if(_0x2ca996[_0x4b11('0x10')]!==_0x4b11('0xc')&&_0x2ca996[_0x4b11('0x8')]){_0x2ca996['voiceStatus']='pause';return![];}return _[_0x4b11('0xa')]([_0x2ca996[_0x4b11('0x11')],_0x2ca996[_0x4b11('0x12')],_0x2ca996[_0x4b11('0x13')],_0x2ca996[_0x4b11('0x14')],_0x2ca996[_0x4b11('0x15')],_0x2ca996[_0x4b11('0x10')],_0x2ca996[_0x4b11('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x4b11('0x17')](function(_0x26c3e2){if(_0x26c3e2[_0x4b11('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4b5fac=_0x26c3e2['result'];return routingClient[_0x4b11('0x19')](_0x4b11('0x1a'),{})[_0x4b11('0x17')](function(_0xf14a7f){if(_0xf14a7f[_0x4b11('0x18')]){throw new Error(_0x4b11('0x1b'));}var _0x40579b=_0xf14a7f[_0x4b11('0x1c')];return _[_0x4b11('0x1d')]({},_0x4b5fac,_0x40579b);});})[_0x4b11('0x1e')](function(_0x50a977){throw _0x50a977;});}exports[_0x4b11('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x15fc32){var _0x34b94f='unknown';if(isAgentPaused(_0x15fc32))_0x34b94f=_0x4b11('0x20');else if(isAgentPaused(_0x15fc32,!![]))_0x34b94f='*pause';else if(isAgentIdle(_0x15fc32))_0x34b94f=_0x4b11('0xc');else _0x34b94f=_0x4b11('0x21');return _0x34b94f;}exports[_0x4b11('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x12a7cc,_0x113a1e){var _0x28b219=_[_0x4b11('0x23')](_0x12a7cc)?_0x12a7cc:[_0x12a7cc];var _0x2c9f15=_[_0x4b11('0x24')](_0x113a1e)+_0x4b11('0x25');var _0x3e9a73=_['map'](_0x28b219,function(_0x34212b){return db[_0x2c9f15]['findOne']({'where':{'id':_0x34212b}})[_0x4b11('0x17')](function(_0x51ab68){if(!_0x51ab68)return[];return _0x51ab68['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4b11('0x26')](_0x3e9a73)[_0x4b11('0x17')](function(_0x39c860){var _0x347d32=_(_0x39c860)[_0x4b11('0x27')]()['map']('id')[_0x4b11('0x28')]()[_0x4b11('0x29')]();return _0x347d32;});}exports[_0x4b11('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3e099f,_0xcdd632,_0x222c42){try{if(_0xcdd632[_0x4b11('0xb')]>0x0){_0x3e099f=_0x3e099f[_0x4b11('0x2b')](function(_0x5897ea){return _0xcdd632[_0x4b11('0x2c')](_0x5897ea['id']);});}var _0x15d27d=_0x3e099f['filter'](function(_0x25e87f){var _0x37301d=_0x4b11('0x21');if(isAgentIdle(_0x25e87f)){_0x37301d=_0x4b11('0xc');}return _0x37301d===_0x222c42;});return _[_0x4b11('0x2d')](_0x15d27d,'id');}catch(_0x704ada){throw _0x704ada;}}exports[_0x4b11('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x582d54,_0x409b01,_0x23941b){return Promise[_0x4b11('0x2f')]()['then'](function(){if(_0x409b01[_0x4b11('0xb')]>0x0){_0x582d54=_0x582d54[_0x4b11('0x2b')](function(_0x36f517){return _0x409b01[_0x4b11('0x2c')](_0x36f517['id']);});}return _0x582d54;})[_0x4b11('0x17')](function(){return db[_0x4b11('0x30')]['findAll']({'attributes':['id','name',_0x4b11('0x31'),_0x4b11('0x4'),_0x4b11('0x32'),_0x4b11('0x5'),_0x4b11('0x6'),_0x4b11('0x7'),_0x4b11('0x8'),'whatsappPause',_0x4b11('0x33')],'where':{'id':{'$in':_[_0x4b11('0x2d')](_0x582d54,'id')}},'raw':!![]});})[_0x4b11('0x17')](function(_0x24a8f8){return _0x24a8f8[_0x4b11('0x2d')](function(_0x5a7e1d){var _0x52db82=_[_0x4b11('0x34')](_0x582d54,['id',_0x5a7e1d['id']]);var _0x16f977=filterAgentAttributes(_0x52db82);_[_0x4b11('0x1d')](_0x5a7e1d,_0x16f977);_0x5a7e1d[_0x4b11('0x35')]=getAgentStatus(_0x5a7e1d);return _0x5a7e1d;});})['then'](function(_0x5332bd){var _0x4ae98c=sortAgentsByStatus(_0x5332bd,_0x23941b);return _[_0x4b11('0x2d')](_0x4ae98c,'id');})[_0x4b11('0x1e')](function(_0x55c05f){throw _0x55c05f;});}exports[_0x4b11('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4a6735){var _0x2e6623={'fields':[],'order':null};var _0x1b3c26=_0x4a6735[_0x4b11('0x37')](',');_0x2e6623[_0x4b11('0x38')]=_[_0x4b11('0x2b')](_0x1b3c26,function(_0x27e2fc){if(!_0x27e2fc[_0x4b11('0x2c')](_0x4b11('0x35'))){return!![];}_0x2e6623[_0x4b11('0x39')]=_[_0x4b11('0x3a')](_0x27e2fc,'-')?'DESC':'ASC';return![];});return _0x2e6623;}exports[_0x4b11('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x70a91){if(!_0x70a91){_0x70a91=_0x4b11('0x3c');}if(_0x70a91[_0x4b11('0x2c')](_0x4b11('0x31'))&&!_0x70a91[_0x4b11('0x2c')](_0x4b11('0x3d'))){var _0x34c285=_0x70a91[_0x4b11('0x3e')](0x0,_0x70a91[_0x4b11('0x3f')]('fullname'));_0x70a91+=','+_0x34c285+'internal';}return _0x70a91;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x24e664,_0x21b205){var _0x8f7bd7=_0x24e664[_0x4b11('0x40')](function(_0xb2ec0f,_0x2884f1){if(_0xb2ec0f[_0x4b11('0x35')]===_0x2884f1[_0x4b11('0x35')]){if(_0xb2ec0f[_0x4b11('0x35')]===_0x4b11('0x20')){if(_0x21b205==='DESC'){return(_0xb2ec0f[_0x4b11('0x33')]||'')<(_0x2884f1[_0x4b11('0x33')]||'')||_0xb2ec0f['fullname'][_0x4b11('0x41')]()>_0x2884f1[_0x4b11('0x31')][_0x4b11('0x41')]()?0x1:-0x1;}else{return(_0xb2ec0f[_0x4b11('0x33')]||'')<(_0x2884f1['pauseType']||'')||_0xb2ec0f[_0x4b11('0x31')][_0x4b11('0x41')]()>_0x2884f1['fullname'][_0x4b11('0x41')]()?-0x1:0x1;}}else{if(_0x21b205===_0x4b11('0x42')){return _0xb2ec0f['fullname'][_0x4b11('0x41')]()<_0x2884f1[_0x4b11('0x31')][_0x4b11('0x41')]()?0x1:-0x1;}else{return _0xb2ec0f['fullname'][_0x4b11('0x41')]()<_0x2884f1[_0x4b11('0x31')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x21b205===_0x4b11('0x42')){return _0xb2ec0f[_0x4b11('0x35')]<_0x2884f1[_0x4b11('0x35')]?0x1:-0x1;}else{return _0xb2ec0f[_0x4b11('0x35')]<_0x2884f1[_0x4b11('0x35')]?-0x1:0x1;}}});return _0x8f7bd7;}exports[_0x4b11('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x3ba91f){var _0x5c76bf=['userpic',_0x4b11('0x44'),_0x4b11('0x45'),_0x4b11('0x46'),_0x4b11('0x33'),_0x4b11('0x46'),_0x4b11('0x3d'),'address',_0x4b11('0x4'),'openchannelPause',_0x4b11('0x5'),_0x4b11('0x7'),_0x4b11('0x9'),_0x4b11('0x32'),_0x4b11('0x8'),_0x4b11('0x47'),_0x4b11('0x48'),_0x4b11('0x49'),_0x4b11('0x4a'),_0x4b11('0x4b'),'faxCapacity','chatCurrentCapacity',_0x4b11('0x4c'),_0x4b11('0x4d'),_0x4b11('0x4e'),_0x4b11('0x4f'),_0x4b11('0x50'),_0x4b11('0x11'),'openchannelStatus','mailStatus','smsStatus',_0x4b11('0x16'),_0x4b11('0x12'),'voiceStatus',_0x4b11('0x51'),_0x4b11('0x52'),'mailStatusTime',_0x4b11('0x53'),'whatsappStatusTime',_0x4b11('0x54'),_0x4b11('0x55'),'queue',_0x4b11('0x56'),_0x4b11('0x57'),_0x4b11('0x58'),_0x4b11('0x59')];var _0x5071f3=['chatPause','openchannelPause',_0x4b11('0x5'),'smsPause',_0x4b11('0x9'),_0x4b11('0x32'),'voicePause','online'];var _0x303e15=_(_0x3ba91f)['omit'](_0x5071f3)[_0x4b11('0x5a')](_0x5c76bf)[_0x4b11('0x29')]();return _0x303e15;}exports[_0x4b11('0x5b')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x4b11('0x5c'),_0x4b11('0x31'),_0x4b11('0x5d'),_0x4b11('0x3d'),'online',_0x4b11('0x35'),'userpic',_0x4b11('0x45'),_0x4b11('0x33'),_0x4b11('0x46'),_0x4b11('0x32'),_0x4b11('0x4'),_0x4b11('0x5'),_0x4b11('0x6'),'smsPause',_0x4b11('0x8'),'whatsappPause',_0x4b11('0x11'),_0x4b11('0x12'),_0x4b11('0x13'),_0x4b11('0x14'),_0x4b11('0x15'),_0x4b11('0x10'),_0x4b11('0x16'),_0x4b11('0x51'),_0x4b11('0x54'),'mailStatusTime',_0x4b11('0x52'),_0x4b11('0x53'),_0x4b11('0x55'),_0x4b11('0x5e'),'chatCapacity','faxCapacity',_0x4b11('0x49'),_0x4b11('0x48'),_0x4b11('0x4a'),_0x4b11('0x4b'),'chatCurrentCapacity',_0x4b11('0x50'),_0x4b11('0x4d'),_0x4b11('0x4c'),_0x4b11('0x4e'),'whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent',_0x4b11('0x59'),_0x4b11('0x56'),_0x4b11('0x5f'),_0x4b11('0x60'),_0x4b11('0x57')];}exports[_0x4b11('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index a537c3a..404d8e0 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 _0x18c3=['dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','loggedInDb','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','invalid','onHold','talking','unavailable','unknown','pTalking','originated','message','statusMessage'];(function(_0x56c87f,_0x733dd1){var _0x551d4c=function(_0x2c8cca){while(--_0x2c8cca){_0x56c87f['push'](_0x56c87f['shift']());}};_0x551d4c(++_0x733dd1);}(_0x18c3,0x152));var _0x318c=function(_0x5d3472,_0x59913c){_0x5d3472=_0x5d3472-0x0;var _0x55f56a=_0x18c3[_0x5d3472];return _0x55f56a;};'use strict';var _=require(_0x318c('0x0'));var jayson=require(_0x318c('0x1'));var util=require(_0x318c('0x2'));var amiClient=jayson[_0x318c('0x3')][_0x318c('0x4')]({'port':0x232a});var routingClient=jayson[_0x318c('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x318c('0x5'),_0x318c('0x6'),_0x318c('0x7'),_0x318c('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x318c('0x9'),'inUse',_0x318c('0xa'),'loggedInDb','notInUse',_0x318c('0xb'),'ringing','ringInUse',_0x318c('0xc'),_0x318c('0xd'),_0x318c('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x318c('0xf'),_0x318c('0x10'),_0x318c('0x11'),_0x318c('0x12'),_0x318c('0x13'),_0x318c('0x14'),'Trunk',_0x318c('0x15'),_0x318c('0x16'),_0x318c('0x17'),_0x318c('0x18'),_0x318c('0x19'),_0x318c('0x1a'),_0x318c('0x1b'),_0x318c('0x1c'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x318c('0x1d'),_0x318c('0x1e'),_0x318c('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0x318c('0x20'),_0x318c('0x21')];function getRealtimeQueues(_0x578bfc,_0xe44a12){var _0x2940c6=_0xe44a12==='voice'?amiClient:routingClient;return _0x2940c6[_0x318c('0x22')](_['startCase'](_0xe44a12)+'Queues',_0x578bfc)[_0x318c('0x23')](function(_0x6492ea){if(_0x6492ea[_0x318c('0x24')])throw new Error(util[_0x318c('0x25')](_0x318c('0x26'),_0xe44a12));return _0x6492ea[_0x318c('0x27')];})[_0x318c('0x28')](function(_0x4ba32e){throw _0x4ba32e;});}exports[_0x318c('0x29')]=getRealtimeQueues;function initializeQueues(_0x10e7ae,_0x56070a,_0x31aee2,_0x432c75){var _0xc8ea2b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x31aee2==='voice'){if(_0x432c75==='inbound'){_0xc8ea2b=_0xc8ea2b[_0x318c('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x432c75===_0x318c('0x2b')){_0xc8ea2b=_0xc8ea2b['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x10e7ae[_0x318c('0x2c')](function(_0x43d680){var _0x56e09d=_0x43d680[_0x318c('0x2d')]({'plain':!![]});_0x56e09d[_0x318c('0x7')]=0x0;_0x56e09d[_0x318c('0x2e')]=0x0;_0x56e09d[_0x318c('0x6')]=0x0;_0x56e09d[_0x318c('0x5')]=0x0;_0x56e09d[_0x318c('0x8')]=0x0;if(_0x31aee2==='voice'){_0x56e09d['talking']=0x0;_0x56e09d['busy']=0x0;if(_0x432c75===_0x318c('0x2b')){_0x56e09d['pTalking']=0x0;_0x56e09d[_0x318c('0x10')]=0x0;}}var _0x1e4fb1=_[_0x318c('0x2f')](_0x56070a,['id',_0x56e09d['id']]);if(_0x1e4fb1){_[_0x318c('0x30')](_0x56e09d,_[_0x318c('0x31')](_0x1e4fb1,_0xc8ea2b));}return _0x56e09d;});}exports[_0x318c('0x32')]=initializeQueues; \ No newline at end of file +var _0xe1b2=['result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','paused','busy','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','waiting','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe1b2,0x80));var _0x2e1b=function(_0x5b95df,_0x59dcc5){_0x5b95df=_0x5b95df-0x0;var _0x50df95=_0xe1b2[_0x5b95df];return _0x50df95;};'use strict';var _=require(_0x2e1b('0x0'));var jayson=require(_0x2e1b('0x1'));var util=require(_0x2e1b('0x2'));var amiClient=jayson[_0x2e1b('0x3')][_0x2e1b('0x4')]({'port':0x232a});var routingClient=jayson[_0x2e1b('0x3')][_0x2e1b('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x2e1b('0x5'),_0x2e1b('0x6'),'paused',_0x2e1b('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x2e1b('0x8'),_0x2e1b('0x9'),'loggedInDb',_0x2e1b('0xa'),_0x2e1b('0xb'),_0x2e1b('0xc'),_0x2e1b('0xd'),_0x2e1b('0xe'),_0x2e1b('0xf'),_0x2e1b('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x2e1b('0x11'),_0x2e1b('0x12'),'message','statusMessage',_0x2e1b('0x13'),_0x2e1b('0x14'),_0x2e1b('0x15'),_0x2e1b('0x16'),_0x2e1b('0x17'),_0x2e1b('0x18'),_0x2e1b('0x19'),_0x2e1b('0x1a'),_0x2e1b('0x1b'),_0x2e1b('0x1c'),_0x2e1b('0x1d'),_0x2e1b('0x1e'),_0x2e1b('0x1f'),_0x2e1b('0x20'),_0x2e1b('0x21'),'predictiveIntervalDroppedCallsTimeout',_0x2e1b('0x22'),_0x2e1b('0x23'),_0x2e1b('0x24')];function getRealtimeQueues(_0x37dfc7,_0x43604a){var _0x349294=_0x43604a===_0x2e1b('0x25')?amiClient:routingClient;return _0x349294[_0x2e1b('0x26')](_[_0x2e1b('0x27')](_0x43604a)+_0x2e1b('0x28'),_0x37dfc7)[_0x2e1b('0x29')](function(_0x305e51){if(_0x305e51[_0x2e1b('0x2a')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x43604a));return _0x305e51[_0x2e1b('0x2b')];})[_0x2e1b('0x2c')](function(_0x356965){throw _0x356965;});}exports[_0x2e1b('0x2d')]=getRealtimeQueues;function initializeQueues(_0x745dbf,_0x11d6ec,_0x26ee3c,_0x635e24){var _0x18cb8a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x26ee3c===_0x2e1b('0x25')){if(_0x635e24===_0x2e1b('0x2e')){_0x18cb8a=_0x18cb8a[_0x2e1b('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x635e24===_0x2e1b('0x30')){_0x18cb8a=_0x18cb8a['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x745dbf[_0x2e1b('0x31')](function(_0x34ec83){var _0x335004=_0x34ec83[_0x2e1b('0x32')]({'plain':!![]});_0x335004[_0x2e1b('0x33')]=0x0;_0x335004['loggedInDb']=0x0;_0x335004['loggedIn']=0x0;_0x335004[_0x2e1b('0x5')]=0x0;_0x335004['waiting']=0x0;if(_0x26ee3c===_0x2e1b('0x25')){_0x335004['talking']=0x0;_0x335004[_0x2e1b('0x34')]=0x0;if(_0x635e24==='outbound'){_0x335004['pTalking']=0x0;_0x335004['originated']=0x0;}}var _0x13a274=_[_0x2e1b('0x35')](_0x11d6ec,['id',_0x335004['id']]);if(_0x13a274){_[_0x2e1b('0x36')](_0x335004,_[_0x2e1b('0x37')](_0x13a274,_0x18cb8a));}return _0x335004;});}exports[_0x2e1b('0x38')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 860990d..6a462c7 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(_0x1c2434,_0x28868c){var _0x3a601=function(_0x4aa1c5){while(--_0x4aa1c5){_0x1c2434['push'](_0x1c2434['shift']());}};_0x3a601(++_0x28868c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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(_0x4bd1de,_0x1ba648){var _0x38bd31=function(_0x398e30){while(--_0x398e30){_0x4bd1de['push'](_0x4bd1de['shift']());}};_0x38bd31(++_0x1ba648);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 1ccb6af..19a3509 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 _0xfc41=['length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','createHash','digest','hex','substring','lodash','execSync','../environment','networkInterfaces','orderBy','keys'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0xfc41,0x1c1));var _0x1fc4=function(_0x4b3638,_0x2a46fd){_0x4b3638=_0x4b3638-0x0;var _0xf5c8a9=_0xfc41[_0x4b3638];return _0xf5c8a9;};'use strict';var _=require(_0x1fc4('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x1fc4('0x1')];var config=require(_0x1fc4('0x2'));function getInterfaces(){var _0x20312a=[];var _0x302868=os[_0x1fc4('0x3')]();var _0x446d92=_[_0x1fc4('0x4')](_[_0x1fc4('0x5')](_0x302868));for(var _0x6b5d2f=0x0;_0x6b5d2f<_0x446d92[_0x1fc4('0x6')];_0x6b5d2f++){var _0x4ed943=_0x302868[_0x446d92[_0x6b5d2f]][_0x1fc4('0x7')](function(_0x3d71e1){return _0x3d71e1['family']===_0x1fc4('0x8')&&_0x3d71e1['internal']===![];});_0x20312a=_0x20312a[_0x1fc4('0x9')](_0x4ed943);}return _0x20312a;}function getFirstInterface(){var _0x55d91f=_[_0x1fc4('0xa')](getInterfaces());return{'macAddress':_0x55d91f&&_0x55d91f[_0x1fc4('0xb')]?_0x55d91f[_0x1fc4('0xb')]:_0x1fc4('0xc'),'ipAddress':_0x55d91f&&_0x55d91f['address']?_0x55d91f[_0x1fc4('0xd')]:_0x1fc4('0xe')};}exports[_0x1fc4('0xf')]=getFirstInterface;function getCPUhash(){var _0x299b9e=_['orderBy'](os[_0x1fc4('0x10')]()[_0x1fc4('0x11')](function(_0x3fe661){return _0x3fe661[_0x1fc4('0x12')];}))[_0x1fc4('0x13')](':');return crypto['createHash'](_0x1fc4('0x14'))[_0x1fc4('0x15')](_0x299b9e)['digest']('hex');}exports[_0x1fc4('0x16')]=function(){var _0x22b848=os[_0x1fc4('0x17')]();var _0x58c889=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x58c889[_0x1fc4('0x18')](config['licenseToken'])){return config[_0x1fc4('0x19')];}else if(_0x22b848==='win32'){return exec(_0x1fc4('0x1a'),{'encoding':_0x1fc4('0x1b')})[_0x1fc4('0x1c')]('\x0d\x0a','');}else{var _0x1f98a1=getFirstInterface();var _0x20a0aa=getCPUhash();var _0x31f28d=_0x20a0aa+'|'+os['hostname']()+'|'+_0x1f98a1[_0x1fc4('0x1d')]+'|'+_0x1f98a1[_0x1fc4('0x1e')];var _0x276ee6=crypto[_0x1fc4('0x1f')]('md5')[_0x1fc4('0x15')](_0x31f28d)[_0x1fc4('0x20')](_0x1fc4('0x21'));return _0x276ee6[_0x1fc4('0x22')](0x0,0x8)+'-'+_0x276ee6[_0x1fc4('0x22')](0x8,0xc)+'-'+_0x276ee6['substring'](0xc,0x10)+'-'+_0x276ee6['substring'](0x10,0x14)+'-'+_0x276ee6['substring'](0x14);}}; \ No newline at end of file +var _0xbf95=['hostname','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','concat','mac','address','getFirstInterface','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0xbf95,0x16f));var _0x5bf9=function(_0x5657d4,_0x51c35f){_0x5657d4=_0x5657d4-0x0;var _0x11c737=_0xbf95[_0x5657d4];return _0x11c737;};'use strict';var _=require(_0x5bf9('0x0'));var os=require('os');var crypto=require(_0x5bf9('0x1'));var machine=require(_0x5bf9('0x2'));var exec=require(_0x5bf9('0x3'))[_0x5bf9('0x4')];var config=require(_0x5bf9('0x5'));function getInterfaces(){var _0x2159fd=[];var _0x468a60=os[_0x5bf9('0x6')]();var _0x517635=_[_0x5bf9('0x7')](_[_0x5bf9('0x8')](_0x468a60));for(var _0x4b0e8f=0x0;_0x4b0e8f<_0x517635[_0x5bf9('0x9')];_0x4b0e8f++){var _0x2aaa41=_0x468a60[_0x517635[_0x4b0e8f]]['filter'](function(_0x3d01ca){return _0x3d01ca['family']==='IPv4'&&_0x3d01ca['internal']===![];});_0x2159fd=_0x2159fd[_0x5bf9('0xa')](_0x2aaa41);}return _0x2159fd;}function getFirstInterface(){var _0x37432f=_['head'](getInterfaces());return{'macAddress':_0x37432f&&_0x37432f[_0x5bf9('0xb')]?_0x37432f[_0x5bf9('0xb')]:'00:00:00:00:00:00','ipAddress':_0x37432f&&_0x37432f[_0x5bf9('0xc')]?_0x37432f['address']:'127.0.0.1'};}exports[_0x5bf9('0xd')]=getFirstInterface;function getCPUhash(){var _0x426e3e=_[_0x5bf9('0x7')](os[_0x5bf9('0xe')]()[_0x5bf9('0xf')](function(_0x2cec4d){return _0x2cec4d[_0x5bf9('0x10')];}))[_0x5bf9('0x11')](':');return crypto[_0x5bf9('0x12')](_0x5bf9('0x13'))[_0x5bf9('0x14')](_0x426e3e)['digest'](_0x5bf9('0x15'));}exports[_0x5bf9('0x16')]=function(){var _0x11be15=os[_0x5bf9('0x17')]();var _0x189331=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x189331[_0x5bf9('0x18')](config[_0x5bf9('0x19')])){return config[_0x5bf9('0x19')];}else if(_0x11be15===_0x5bf9('0x1a')){return exec(_0x5bf9('0x1b'),{'encoding':_0x5bf9('0x1c')})['replace']('\x0d\x0a','');}else{var _0x459f18=getFirstInterface();var _0x455070=getCPUhash();var _0x46a4dd=_0x455070+'|'+os[_0x5bf9('0x1d')]()+'|'+_0x459f18['macAddress']+'|'+_0x459f18[_0x5bf9('0x1e')];var _0x5ae0f3=crypto['createHash'](_0x5bf9('0x13'))['update'](_0x46a4dd)[_0x5bf9('0x1f')]('hex');return _0x5ae0f3['substring'](0x0,0x8)+'-'+_0x5ae0f3['substring'](0x8,0xc)+'-'+_0x5ae0f3[_0x5bf9('0x20')](0xc,0x10)+'-'+_0x5ae0f3['substring'](0x10,0x14)+'-'+_0x5ae0f3['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 106977a..de2a360 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 _0xcaae=['error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xcaae,0x16f));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xecaa('0x0'));var moment=require('moment');var rp=require(_0xecaa('0x1'));var BPromise=require(_0xecaa('0x2'));var pkginfo=require(_0xecaa('0x3'))(module,_0xecaa('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xecaa('0x5'));var hardware=require(_0xecaa('0x6'));var logger=require('../logger')(_0xecaa('0x7'));var HOST=_0xecaa('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x43a0af){return new BPromise(function(_0xa4494a,_0x502c95){var _0xadd310=util[_0xecaa('0x9')](_0xecaa('0xa'),HOST,_0x43a0af,module['exports'][_0xecaa('0x4')]);if(oldToken){_0xadd310=util[_0xecaa('0x9')](_0xecaa('0xb'),HOST,_0x43a0af,module[_0xecaa('0xc')]['version'],oldToken);}var _0x361bd4={'uri':_0xadd310,'method':_0xecaa('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x361bd4)[_0xecaa('0xe')](function(_0x41910b){_0xa4494a(_0x41910b);})[_0xecaa('0xf')](function(_0x50955f){_0x502c95(_0x50955f);});});}function manageLicense(_0x57976a,_0x2d5966){var _0x2eb4da=_0x2d5966[_0xecaa('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x2eb4da[_0xecaa('0x11')]!==_0x57976a&&!_0x2eb4da[_0xecaa('0x12')]){oldToken=_0x2eb4da[_0xecaa('0x11')];}httpRequest(_0x57976a)[_0xecaa('0xe')](function(_0x55881d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x55881d[_0xecaa('0x13')]){isOldTokenSent=![];if(!_0x2eb4da['license']&&_0x2eb4da[_0xecaa('0x7')]!=_0x55881d[_0xecaa('0x7')]||_0x2eb4da['license']&&_0x2eb4da['data2']){logger[_0xecaa('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2eb4da[_0xecaa('0x7')]&&!_0x2eb4da[_0xecaa('0x12')]&&_0x2eb4da[_0xecaa('0x7')]!=_0x55881d[_0xecaa('0x7')]){logger[_0xecaa('0x14')](_0xecaa('0x15'));}if(_0x2eb4da['license']&&!_0x2eb4da[_0xecaa('0x12')]&&_0x2eb4da[_0xecaa('0x7')]==_0x55881d['license']){return _0x2d5966;}return _0x2d5966[_0xecaa('0x16')]({'data1':_0x57976a,'data2':null,'license':_0x55881d[_0xecaa('0x7')]});}else{if(_0x55881d[_0xecaa('0x7')]||_0x2eb4da[_0xecaa('0x7')]){if(!_0x2eb4da[_0xecaa('0x12')]){if(_0x2eb4da[_0xecaa('0x11')]==_0x57976a){GRAY_PERIOD_REASON=_0xecaa('0x17');logger[_0xecaa('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0xecaa('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2eb4da[_0xecaa('0x11')],_0x57976a);}logger[_0xecaa('0x14')](_0xecaa('0x18'),GRAY_PERIOD_REASON[_0xecaa('0x19')](),moment()['format'](_0xecaa('0x1a')));return _0x2d5966[_0xecaa('0x16')]({'data2':encryptor[_0xecaa('0x1b')](moment()[_0xecaa('0x9')](_0xecaa('0x1a')))});}else{if(moment()[_0xecaa('0x1c')](encryptor[_0xecaa('0x1d')](_0x2eb4da[_0xecaa('0x12')]),_0xecaa('0x1e'))>DAYS){logger[_0xecaa('0x14')](_0xecaa('0x1f'),moment()[_0xecaa('0x9')](_0xecaa('0x1a')));isOldTokenSent=![];return _0x2d5966[_0xecaa('0x16')]({'data1':_0x57976a,'data2':null,'license':null});}}}else{if(_0x2eb4da[_0xecaa('0x11')]!=_0x57976a){logger[_0xecaa('0x14')](_0xecaa('0x20'),_0x2eb4da[_0xecaa('0x11')],_0x57976a);return _0x2d5966[_0xecaa('0x16')]({'data1':_0x57976a,'data2':null,'license':null});}}}return _0x2d5966;})[_0xecaa('0xe')](function(_0x34c239){_0x2d5966=_0x34c239;})['catch'](function(_0x55fb74){logger[_0xecaa('0x21')](_0x55fb74['message']);})[_0xecaa('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xecaa('0x23')](),_0x2d5966);},TIME);});}function defaultLicense(){var _0x3ea8d8=hardware[_0xecaa('0x23')]();if(_0x3ea8d8){return db[_0xecaa('0x24')][_0xecaa('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x3ea8d8}})['spread'](function(_0x41d9ec,_0x81f504){logger[_0xecaa('0x14')](_0xecaa('0x26'),_0x3ea8d8);manageLicense(_0x3ea8d8,_0x41d9ec);})[_0xecaa('0xf')](function(_0x185976){logger[_0xecaa('0x21')](_0x185976[_0xecaa('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x1a89=['%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','then','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x1a89,0x123));var _0x91a8=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x1a89[_0x15bc81];return _0x59440e;};'use strict';var util=require(_0x91a8('0x0'));var moment=require('moment');var rp=require(_0x91a8('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x91a8('0x2'))(module,_0x91a8('0x3'));var db=require(_0x91a8('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x91a8('0x5'));var logger=require(_0x91a8('0x6'))(_0x91a8('0x7'));var HOST=_0x91a8('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc19912){return new BPromise(function(_0x2f5822,_0x459310){var _0x56e913=util[_0x91a8('0x9')](_0x91a8('0xa'),HOST,_0xc19912,module[_0x91a8('0xb')][_0x91a8('0x3')]);if(oldToken){_0x56e913=util[_0x91a8('0x9')](_0x91a8('0xc'),HOST,_0xc19912,module[_0x91a8('0xb')][_0x91a8('0x3')],oldToken);}var _0x42753e={'uri':_0x56e913,'method':_0x91a8('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x42753e)['then'](function(_0x195d3f){_0x2f5822(_0x195d3f);})[_0x91a8('0xe')](function(_0x4a78e1){_0x459310(_0x4a78e1);});});}function manageLicense(_0x2686df,_0x4cf693){var _0x22b4fb=_0x4cf693[_0x91a8('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x22b4fb[_0x91a8('0x10')]!==_0x2686df&&!_0x22b4fb['data2']){oldToken=_0x22b4fb['data1'];}httpRequest(_0x2686df)[_0x91a8('0x11')](function(_0x926831){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x926831[_0x91a8('0x12')]){isOldTokenSent=![];if(!_0x22b4fb[_0x91a8('0x7')]&&_0x22b4fb[_0x91a8('0x7')]!=_0x926831['license']||_0x22b4fb[_0x91a8('0x7')]&&_0x22b4fb[_0x91a8('0x13')]){logger[_0x91a8('0x14')](_0x91a8('0x15'));}if(_0x22b4fb[_0x91a8('0x7')]&&!_0x22b4fb[_0x91a8('0x13')]&&_0x22b4fb[_0x91a8('0x7')]!=_0x926831[_0x91a8('0x7')]){logger['info'](_0x91a8('0x16'));}if(_0x22b4fb['license']&&!_0x22b4fb[_0x91a8('0x13')]&&_0x22b4fb[_0x91a8('0x7')]==_0x926831[_0x91a8('0x7')]){return _0x4cf693;}return _0x4cf693[_0x91a8('0x17')]({'data1':_0x2686df,'data2':null,'license':_0x926831[_0x91a8('0x7')]});}else{if(_0x926831[_0x91a8('0x7')]||_0x22b4fb[_0x91a8('0x7')]){if(!_0x22b4fb[_0x91a8('0x13')]){if(_0x22b4fb[_0x91a8('0x10')]==_0x2686df){GRAY_PERIOD_REASON=_0x91a8('0x18');logger[_0x91a8('0x14')](_0x91a8('0x19'));}else{GRAY_PERIOD_REASON=_0x91a8('0x1a');logger[_0x91a8('0x14')](_0x91a8('0x1b'),_0x22b4fb[_0x91a8('0x10')],_0x2686df);}logger[_0x91a8('0x14')](_0x91a8('0x1c'),GRAY_PERIOD_REASON[_0x91a8('0x1d')](),moment()[_0x91a8('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x4cf693[_0x91a8('0x17')]({'data2':encryptor['encryptString'](moment()[_0x91a8('0x9')](_0x91a8('0x1e')))});}else{if(moment()[_0x91a8('0x1f')](encryptor[_0x91a8('0x20')](_0x22b4fb['data2']),_0x91a8('0x21'))>DAYS){logger['info'](_0x91a8('0x22'),moment()[_0x91a8('0x9')](_0x91a8('0x1e')));isOldTokenSent=![];return _0x4cf693[_0x91a8('0x17')]({'data1':_0x2686df,'data2':null,'license':null});}}}else{if(_0x22b4fb[_0x91a8('0x10')]!=_0x2686df){logger[_0x91a8('0x14')](_0x91a8('0x1b'),_0x22b4fb[_0x91a8('0x10')],_0x2686df);return _0x4cf693[_0x91a8('0x17')]({'data1':_0x2686df,'data2':null,'license':null});}}}return _0x4cf693;})[_0x91a8('0x11')](function(_0x21e95f){_0x4cf693=_0x21e95f;})[_0x91a8('0xe')](function(_0xb81332){logger[_0x91a8('0x23')](_0xb81332[_0x91a8('0x24')]);})[_0x91a8('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x91a8('0x26')](),_0x4cf693);},TIME);});}function defaultLicense(){var _0x277b8c=hardware['getUuid']();if(_0x277b8c){return db[_0x91a8('0x27')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x277b8c}})[_0x91a8('0x28')](function(_0x57e2ab,_0x210c34){logger['info'](_0x91a8('0x29'),_0x277b8c);manageLicense(_0x277b8c,_0x57e2ab);})[_0x91a8('0xe')](function(_0x477bdc){logger['error'](_0x477bdc[_0x91a8('0x24')]);});}}exports[_0x91a8('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4f53a42..cf65d7d 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 _0x9c6f=['User','findAll','role','COUNT','col','count','user','telephone','users','admin','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','uuid','machineUuid','gray','deadline','days','grayReason','changed','disabled','message'];(function(_0x3b9838,_0x45b29e){var _0xf29ca1=function(_0x1850ca){while(--_0x1850ca){_0x3b9838['push'](_0x3b9838['shift']());}};_0xf29ca1(++_0x45b29e);}(_0x9c6f,0xc1));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf9c6('0x0'));var _=require(_0xf9c6('0x1'));var moment=require(_0xf9c6('0x2'));var BPromise=require(_0xf9c6('0x3'));var hardware=require(_0xf9c6('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xf9c6('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf9c6('0x6'),'machineUuid':hardware[_0xf9c6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xf9c6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x343f65){return new BPromise(function(_0x12d5bd,_0x3f2c8c){return db[_0xf9c6('0x8')][_0xf9c6('0x9')](_[_0xf9c6('0xa')](_0x343f65,{'raw':!![],'where':{'id':0x1}}))[_0xf9c6('0xb')](function(_0xed352a){return checkLicense(_0xed352a,null);})['then'](function(_0x16f905){_0x12d5bd(_0x16f905);return;})[_0xf9c6('0xc')](function(_0x1c5f1c){_0x3f2c8c(_0x1c5f1c);});});}function checkLicense(_0x46c734,_0x593642){if(!_0x46c734){demoLicense['uuid']=_0x46c734[_0xf9c6('0xd')];return demoLicense;}try{var _0x54e6e4=_0x593642||_0x46c734[_0xf9c6('0xe')];if(_[_0xf9c6('0xf')](_0x54e6e4)){throw new Error(_0xf9c6('0x10'));}var _0x543906=_0x46c734[_0xf9c6('0xd')];var _0x1c00de=_0x46c734[_0xf9c6('0x11')];var _0x533c59=_0x543906['split']('-')[0x4];var _0x4cfad3=_0x543906[_0xf9c6('0x12')]('-')[0x0];var _0x3f162a=encryptor[_0xf9c6('0x13')](_0x54e6e4,util[_0xf9c6('0x14')](_0xf9c6('0x15'),_0x533c59,_0x543906,_0x4cfad3));var _0x15348a=JSON[_0xf9c6('0x16')](_0x3f162a);_0x15348a['demo']=![];_0x15348a[_0xf9c6('0x17')]=_0x543906;_0x15348a[_0xf9c6('0x18')]=hardware[_0xf9c6('0x7')]();if(_0x1c00de){var _0x3f9b19=encryptor['decryptString'](_0x1c00de);_0x15348a[_0xf9c6('0x19')]=_0x3f9b19;_0x15348a[_0xf9c6('0x1a')]=moment(_0x3f9b19)['add'](0x7,_0xf9c6('0x1b'))[_0xf9c6('0x14')]();_0x15348a[_0xf9c6('0x1c')]=_0x15348a[_0xf9c6('0x17')]!=_0x15348a[_0xf9c6('0x18')]?_0xf9c6('0x1d'):_0xf9c6('0x1e');}return _0x15348a;}catch(_0x218872){breakingLicense[_0xf9c6('0x17')]=_0x46c734[_0xf9c6('0xd')];breakingLicense[_0xf9c6('0x1f')]=_0x218872[_0xf9c6('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1808b6,_0x1ece55){getLicense()[_0xf9c6('0xb')](function(_0x167dc8){return db[_0xf9c6('0x20')][_0xf9c6('0x21')]({'attributes':[_0xf9c6('0x22'),[db['sequelize']['fn'](_0xf9c6('0x23'),db['sequelize'][_0xf9c6('0x24')](_0xf9c6('0x22'))),_0xf9c6('0x25')]],'group':_0xf9c6('0x22'),'where':{'role':{'$or':['admin',_0xf9c6('0x26'),_0xf9c6('0x27')]}},'raw':!![]})[_0xf9c6('0xb')](function(_0x6d2854){var _0x4f6391={'user':_0x167dc8[_0xf9c6('0x28')]||0x0,'telephone':_0x167dc8['telephones']||0x0};_0x6d2854['forEach'](function(_0xa08043){var _0x3a6af0=_0xa08043[_0xf9c6('0x22')]===_0xf9c6('0x29')?'user':_0xa08043[_0xf9c6('0x22')];_0x4f6391[_0x3a6af0]-=_0xa08043[_0xf9c6('0x25')];if(_0x4f6391[_0x3a6af0]<0x0)_0x4f6391[_0x3a6af0]=0x0;});_0x1808b6(_0x4f6391);return;});})[_0xf9c6('0xc')](function(_0x3a634f){_0x1ece55(_0x3a634f);});});}function checkUserLimits(_0x421c22){return new BPromise(function(_0x4f9b13,_0x5b6699){getLimits()['then'](function(_0x5a1cee){var _0x1ce378=_['pick'](_[_0xf9c6('0x2a')](_0x421c22,_0xf9c6('0x22')),['admin',_0xf9c6('0x26'),_0xf9c6('0x27')]);var _0x2bcc01=(_0x1ce378['admin']||0x0)+(_0x1ce378[_0xf9c6('0x26')]||0x0);var _0x29504c=_0x1ce378[_0xf9c6('0x27')]||0x0;if(_0x2bcc01>_0x5a1cee[_0xf9c6('0x26')])return _0x5b6699(_0xf9c6('0x2b'));if(_0x29504c>_0x5a1cee[_0xf9c6('0x27')])return _0x5b6699(_0xf9c6('0x2c'));return _0x4f9b13();})[_0xf9c6('0xc')](function(_0x18fceb){_0x5b6699(_0x18fceb);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3271=['disabled','message','User','role','sequelize','COUNT','col','admin','user','telephone','telephones','forEach','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','data1','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','format','grayReason','changed'];(function(_0x1cb2ca,_0x519f6d){var _0x23e90f=function(_0x350d87){while(--_0x350d87){_0x1cb2ca['push'](_0x1cb2ca['shift']());}};_0x23e90f(++_0x519f6d);}(_0x3271,0xd7));var _0x1327=function(_0x391b66,_0x434d52){_0x391b66=_0x391b66-0x0;var _0x2521ca=_0x3271[_0x391b66];return _0x2521ca;};'use strict';var util=require(_0x1327('0x0'));var _=require(_0x1327('0x1'));var moment=require(_0x1327('0x2'));var BPromise=require(_0x1327('0x3'));var hardware=require(_0x1327('0x4'));var encryptor=require(_0x1327('0x5'));var db=require(_0x1327('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1327('0x7'),'machineUuid':hardware[_0x1327('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1327('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1327('0xa'),'machineUuid':hardware[_0x1327('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3cada3){return new BPromise(function(_0x4e187b,_0x30c99a){return db[_0x1327('0xb')][_0x1327('0xc')](_['defaults'](_0x3cada3,{'raw':!![],'where':{'id':0x1}}))[_0x1327('0xd')](function(_0x70f92f){return checkLicense(_0x70f92f,null);})[_0x1327('0xd')](function(_0x4597f9){_0x4e187b(_0x4597f9);return;})['catch'](function(_0x103621){_0x30c99a(_0x103621);});});}function checkLicense(_0x4af4a,_0xfce235){if(!_0x4af4a){demoLicense['uuid']=_0x4af4a[_0x1327('0xe')];return demoLicense;}try{var _0x359c0b=_0xfce235||_0x4af4a['license'];if(_['isEmpty'](_0x359c0b)){throw new Error(_0x1327('0xf'));}var _0x7e0835=_0x4af4a[_0x1327('0xe')];var _0x5f0ae5=_0x4af4a[_0x1327('0x10')];var _0x36e40e=_0x7e0835[_0x1327('0x11')]('-')[0x4];var _0x3c2d50=_0x7e0835[_0x1327('0x11')]('-')[0x0];var _0x2c5e0a=encryptor[_0x1327('0x12')](_0x359c0b,util['format'](_0x1327('0x13'),_0x36e40e,_0x7e0835,_0x3c2d50));var _0x3c3ea6=JSON[_0x1327('0x14')](_0x2c5e0a);_0x3c3ea6[_0x1327('0x15')]=![];_0x3c3ea6[_0x1327('0x16')]=_0x7e0835;_0x3c3ea6[_0x1327('0x17')]=hardware[_0x1327('0x8')]();if(_0x5f0ae5){var _0x448385=encryptor[_0x1327('0x12')](_0x5f0ae5);_0x3c3ea6[_0x1327('0x18')]=_0x448385;_0x3c3ea6[_0x1327('0x19')]=moment(_0x448385)[_0x1327('0x1a')](0x7,'days')[_0x1327('0x1b')]();_0x3c3ea6[_0x1327('0x1c')]=_0x3c3ea6[_0x1327('0x16')]!=_0x3c3ea6[_0x1327('0x17')]?_0x1327('0x1d'):_0x1327('0x1e');}return _0x3c3ea6;}catch(_0x56a054){breakingLicense['uuid']=_0x4af4a['data1'];breakingLicense[_0x1327('0x1f')]=_0x56a054[_0x1327('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2ddfcd,_0x450d0c){getLicense()[_0x1327('0xd')](function(_0x4801f2){return db[_0x1327('0x20')]['findAll']({'attributes':[_0x1327('0x21'),[db[_0x1327('0x22')]['fn'](_0x1327('0x23'),db[_0x1327('0x22')][_0x1327('0x24')](_0x1327('0x21'))),'count']],'group':_0x1327('0x21'),'where':{'role':{'$or':[_0x1327('0x25'),_0x1327('0x26'),_0x1327('0x27')]}},'raw':!![]})[_0x1327('0xd')](function(_0x221a8b){var _0x3e2615={'user':_0x4801f2['users']||0x0,'telephone':_0x4801f2[_0x1327('0x28')]||0x0};_0x221a8b[_0x1327('0x29')](function(_0x271b9f){var _0x30f448=_0x271b9f[_0x1327('0x21')]===_0x1327('0x25')?_0x1327('0x26'):_0x271b9f[_0x1327('0x21')];_0x3e2615[_0x30f448]-=_0x271b9f[_0x1327('0x2a')];if(_0x3e2615[_0x30f448]<0x0)_0x3e2615[_0x30f448]=0x0;});_0x2ddfcd(_0x3e2615);return;});})[_0x1327('0x2b')](function(_0x264b9c){_0x450d0c(_0x264b9c);});});}function checkUserLimits(_0x209bd7){return new BPromise(function(_0x2b1ed2,_0x34bdd4){getLimits()[_0x1327('0xd')](function(_0x40b8b3){var _0x22ddb1=_[_0x1327('0x2c')](_[_0x1327('0x2d')](_0x209bd7,_0x1327('0x21')),[_0x1327('0x25'),'user',_0x1327('0x27')]);var _0x23ce8b=(_0x22ddb1[_0x1327('0x25')]||0x0)+(_0x22ddb1[_0x1327('0x26')]||0x0);var _0x1b56b9=_0x22ddb1[_0x1327('0x27')]||0x0;if(_0x23ce8b>_0x40b8b3['user'])return _0x34bdd4(_0x1327('0x2e'));if(_0x1b56b9>_0x40b8b3[_0x1327('0x27')])return _0x34bdd4(_0x1327('0x2f'));return _0x2b1ed2();})[_0x1327('0x2b')](function(_0x2e7848){_0x34bdd4(_0x2e7848);});});}module[_0x1327('0x30')]={'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 872c6f8..23088c6 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 _0x065e=['secret','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x065e,0x1a7));var _0xe065=function(_0x17cc31,_0x33c0a5){_0x17cc31=_0x17cc31-0x0;var _0x273211=_0x065e[_0x17cc31];return _0x273211;};'use strict';module[_0xe065('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe065('0x1'),'DEBUG':''}; \ No newline at end of file +var _0x4024=['secret','exports','http://localhost:9000','app-id'];(function(_0x55f381,_0x542afb){var _0x1a2f84=function(_0x3f991c){while(--_0x3f991c){_0x55f381['push'](_0x55f381['shift']());}};_0x1a2f84(++_0x542afb);}(_0x4024,0x89));var _0x4402=function(_0x137420,_0x3e0b25){_0x137420=_0x137420-0x0;var _0x475ec1=_0x4024[_0x137420];return _0x475ec1;};'use strict';module[_0x4402('0x0')]={'DOMAIN':_0x4402('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4402('0x2'),'GOOGLE_SECRET':_0x4402('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 517c220..4cb3ee2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4582=['exports','../utils/loggers','fileLogger'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x4582,0x1e4));var _0x2458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4582[_0x3dd15e];return _0x231fd0;};'use strict';var fileLogger=require(_0x2458('0x0'))[_0x2458('0x1')];module[_0x2458('0x2')]=fileLogger; \ No newline at end of file +var _0x3263=['exports','fileLogger'];(function(_0x32b0e5,_0x1f9871){var _0x30bc9f=function(_0x509b18){while(--_0x509b18){_0x32b0e5['push'](_0x32b0e5['shift']());}};_0x30bc9f(++_0x1f9871);}(_0x3263,0x19d));var _0x3326=function(_0x3ba69c,_0x3e370c){_0x3ba69c=_0x3ba69c-0x0;var _0x1c722b=_0x3263[_0x3ba69c];return _0x1c722b;};'use strict';var fileLogger=require('../utils/loggers')[_0x3326('0x0')];module[_0x3326('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 37f103d..aea2dff 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 _0x7d95=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','legacy-libs','join','../../services/express/index.js'];(function(_0x4b630,_0x151f86){var _0x24f855=function(_0x2ead2a){while(--_0x2ead2a){_0x4b630['push'](_0x4b630['shift']());}};_0x24f855(++_0x151f86);}(_0x7d95,0xf7));var _0x57d9=function(_0x4222b5,_0x37422c){_0x4222b5=_0x4222b5-0x0;var _0x425d4c=_0x7d95[_0x4222b5];return _0x425d4c;};'use strict';var path=require(_0x57d9('0x0'));var cfg=require(_0x57d9('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg['root'],_0x57d9('0x2')))};var pm2config={'apps':[{'name':'express','script':path[_0x57d9('0x3')](__dirname,_0x57d9('0x4')),'env':env},{'name':_0x57d9('0x5'),'script':path[_0x57d9('0x3')](__dirname,_0x57d9('0x6')),'env':env},{'name':'agi','script':path[_0x57d9('0x3')](__dirname,_0x57d9('0x7')),'env':env},{'name':_0x57d9('0x8'),'script':path['join'](__dirname,_0x57d9('0x9')),'env':env},{'name':_0x57d9('0xa'),'script':path[_0x57d9('0x3')](__dirname,_0x57d9('0xb')),'env':env},{'name':_0x57d9('0xc'),'script':path[_0x57d9('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x57d9('0xd')]=pm2config; \ No newline at end of file +var _0x1a74=['legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root'];(function(_0x3211e8,_0x18da74){var _0x3db240=function(_0xd9c96c){while(--_0xd9c96c){_0x3211e8['push'](_0x3211e8['shift']());}};_0x3db240(++_0x18da74);}(_0x1a74,0xdb));var _0x41a7=function(_0x155c73,_0x45c2aa){_0x155c73=_0x155c73-0x0;var _0x58f4a2=_0x1a74[_0x155c73];return _0x58f4a2;};'use strict';var path=require(_0x41a7('0x0'));var cfg=require(_0x41a7('0x1'));var env={'NODE_PATH':path[_0x41a7('0x2')](path[_0x41a7('0x3')](cfg[_0x41a7('0x4')],_0x41a7('0x5')))};var pm2config={'apps':[{'name':_0x41a7('0x6'),'script':path[_0x41a7('0x3')](__dirname,_0x41a7('0x7')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x41a7('0x8')),'env':env},{'name':_0x41a7('0x9'),'script':path[_0x41a7('0x3')](__dirname,_0x41a7('0xa')),'env':env},{'name':_0x41a7('0xb'),'script':path[_0x41a7('0x3')](__dirname,_0x41a7('0xc')),'env':env},{'name':_0x41a7('0xd'),'script':path[_0x41a7('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x41a7('0x3')](__dirname,_0x41a7('0xe')),'env':env}]};module[_0x41a7('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2454eec..39d7040 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 _0xb4a8=['connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x48c996,_0x38a3f0){var _0x3f0366=function(_0x7de3fe){while(--_0x7de3fe){_0x48c996['push'](_0x48c996['shift']());}};_0x3f0366(++_0x38a3f0);}(_0xb4a8,0x80));var _0x8b4a=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0xb4a8[_0x58c851];return _0x534d8a;};'use strict';var pm2=require(_0x8b4a('0x0'));var BPromise=require(_0x8b4a('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1bb831,_0xce7d74){return pm2[_0x8b4a('0x2')](function(_0x50bc69){if(_0x50bc69){return _0xce7d74(_0x50bc69);}return _0x1bb831('connected');});});};exports[_0x8b4a('0x3')]=function(_0x2fa302){return connect()[_0x8b4a('0x4')](function(){return new BPromise(function(_0x29e3f7,_0x46eb36){return pm2[_0x8b4a('0x3')](_0x2fa302,function(_0x46252c,_0x297455){if(_0x46252c){return _0x46eb36(_0x46252c);}pm2[_0x8b4a('0x5')]();return _0x29e3f7(_0x297455);});});});};exports[_0x8b4a('0x6')]=function(_0x2588de){return connect()[_0x8b4a('0x4')](function(){return new BPromise(function(_0x20565e,_0x1c12c0){return pm2[_0x8b4a('0x6')](_0x2588de,function(_0x3515bc,_0x4ac5fa){if(_0x3515bc){return _0x1c12c0(_0x3515bc);}pm2[_0x8b4a('0x5')]();return _0x20565e(_0x4ac5fa);});});});};exports[_0x8b4a('0x7')]=function(_0x3f4e94){return connect()[_0x8b4a('0x4')](function(){return new BPromise(function(_0x481af9,_0x4c7e2a){return pm2[_0x8b4a('0x7')](_0x3f4e94,function(_0x179fd6,_0x551528){if(_0x179fd6){return _0x4c7e2a(_0x179fd6);}pm2['disconnect']();return _0x481af9(_0x551528);});});});};exports['list']=function(){return connect()[_0x8b4a('0x4')](function(){return new BPromise(function(_0x48c28e,_0x46eda6){return pm2[_0x8b4a('0x8')](function(_0x351874,_0x1554ca){if(_0x351874){return _0x46eda6(_0x351874);}pm2[_0x8b4a('0x5')]();return _0x48c28e(_0x1554ca);});});});};exports['describe']=function(_0x461d7b){return connect()['then'](function(){return new BPromise(function(_0xd84887,_0x5655c5){return pm2[_0x8b4a('0x9')](_0x461d7b,function(_0x1b08ae,_0x15a9e4){if(_0x1b08ae){return _0x5655c5(_0x1b08ae);}pm2[_0x8b4a('0x5')]();return _0xd84887(_0x15a9e4);});});});};exports[_0x8b4a('0xa')]=function(_0xca3b84){return connect()[_0x8b4a('0x4')](function(){return new BPromise(function(_0xc3e894,_0x197517){return pm2[_0x8b4a('0xa')](_0xca3b84,function(_0x58db7e,_0x32b98e){if(_0x58db7e){return _0x197517(_0x58db7e);}pm2['disconnect']();return _0xc3e894(_0x32b98e);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x519036,_0x3eb6fb){return pm2[_0x8b4a('0xb')](function(_0x36af79){if(_0x36af79){return _0x3eb6fb(_0x36af79);}return _0x519036(_0x8b4a('0xc'));});});});}; \ No newline at end of file +var _0x0190=['then','stop','disconnect','restart','list','delete','saved','bluebird','./config','connect','start'];(function(_0x1bae71,_0x1207ec){var _0x299b2a=function(_0x187bc9){while(--_0x187bc9){_0x1bae71['push'](_0x1bae71['shift']());}};_0x299b2a(++_0x1207ec);}(_0x0190,0x172));var _0x0019=function(_0x1171ec,_0x3951c1){_0x1171ec=_0x1171ec-0x0;var _0x2cd0c7=_0x0190[_0x1171ec];return _0x2cd0c7;};'use strict';var pm2=require('pm2');var BPromise=require(_0x0019('0x0'));var config=require(_0x0019('0x1'));function connect(){return new BPromise(function(_0x3c0b0f,_0x451202){return pm2[_0x0019('0x2')](function(_0x4eef8f){if(_0x4eef8f){return _0x451202(_0x4eef8f);}return _0x3c0b0f('connected');});});};exports[_0x0019('0x3')]=function(_0x37e98d){return connect()[_0x0019('0x4')](function(){return new BPromise(function(_0x487825,_0x4ddc41){return pm2[_0x0019('0x3')](_0x37e98d,function(_0x4defd8,_0x51999e){if(_0x4defd8){return _0x4ddc41(_0x4defd8);}pm2['disconnect']();return _0x487825(_0x51999e);});});});};exports[_0x0019('0x5')]=function(_0x1a4885){return connect()[_0x0019('0x4')](function(){return new BPromise(function(_0xe870f0,_0x31c80c){return pm2['stop'](_0x1a4885,function(_0x551729,_0x38befb){if(_0x551729){return _0x31c80c(_0x551729);}pm2[_0x0019('0x6')]();return _0xe870f0(_0x38befb);});});});};exports[_0x0019('0x7')]=function(_0xff8ff9){return connect()[_0x0019('0x4')](function(){return new BPromise(function(_0x1ed4dd,_0x47e3ae){return pm2[_0x0019('0x7')](_0xff8ff9,function(_0x4294bc,_0x2c935a){if(_0x4294bc){return _0x47e3ae(_0x4294bc);}pm2[_0x0019('0x6')]();return _0x1ed4dd(_0x2c935a);});});});};exports[_0x0019('0x8')]=function(){return connect()[_0x0019('0x4')](function(){return new BPromise(function(_0x558c5b,_0x264461){return pm2[_0x0019('0x8')](function(_0x81451a,_0x1b4f74){if(_0x81451a){return _0x264461(_0x81451a);}pm2[_0x0019('0x6')]();return _0x558c5b(_0x1b4f74);});});});};exports['describe']=function(_0x109fee){return connect()['then'](function(){return new BPromise(function(_0x4e6395,_0x3e3910){return pm2['describe'](_0x109fee,function(_0x518370,_0x15a943){if(_0x518370){return _0x3e3910(_0x518370);}pm2['disconnect']();return _0x4e6395(_0x15a943);});});});};exports[_0x0019('0x9')]=function(_0x5f565b){return connect()['then'](function(){return new BPromise(function(_0x5bba33,_0x2854d8){return pm2[_0x0019('0x9')](_0x5f565b,function(_0x3caba4,_0x57fef3){if(_0x3caba4){return _0x2854d8(_0x3caba4);}pm2[_0x0019('0x6')]();return _0x5bba33(_0x57fef3);});});});};exports['dump']=function(){return connect()[_0x0019('0x4')](function(){return new BPromise(function(_0x2554db,_0x4a20f7){return pm2['dump'](function(_0x13879c){if(_0x13879c){return _0x4a20f7(_0x13879c);}return _0x2554db(_0x0019('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 0e63f07..db13f10 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 _0xe40a=['find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','util','../../config/environment','../logger','redis','defaults','localhost','Setting'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe40a,0xd2));var _0xae40=function(_0x3e33bc,_0x277777){_0x3e33bc=_0x3e33bc-0x0;var _0x49d40f=_0xe40a[_0x3e33bc];return _0x49d40f;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0xae40('0x0'));var config=require(_0xae40('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xae40('0x2'))('schedule');config[_0xae40('0x3')]=_[_0xae40('0x4')](config[_0xae40('0x3')],{'host':_0xae40('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x1d3500=0x0;var _0x516e2c=[];return db[_0xae40('0x6')][_0xae40('0x7')]({'raw':!![],'attributes':['id',_0xae40('0x8')],'where':{'id':0x1}})[_0xae40('0x9')](function(_0x107376){_0x1d3500=_0x107376[_0xae40('0x8')];if(_0x1d3500){return db[_0xae40('0xa')][_0xae40('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xae40('0xc')](_0x107376[_0xae40('0x8')],_0xae40('0xd'))}}});}else{return[];}})['then'](function(_0xcd4d7b){if(_0xcd4d7b&&_0xcd4d7b[_0xae40('0xe')]){_0x516e2c=_['map'](_0xcd4d7b||[],'id');logger['info'](_0xae40('0xf'),_0x516e2c[_0xae40('0x10')]());return db[_0xae40('0xa')][_0xae40('0x11')]({'closeReason':_0xae40('0x12'),'disposition':_0xae40('0x13'),'closed':!![],'closedAt':moment()[_0xae40('0x14')](_0xae40('0x15'))},{'where':{'id':_0x516e2c}});}})[_0xae40('0x9')](function(){if(_0x516e2c&&_0x516e2c[_0xae40('0xe')]){logger[_0xae40('0x16')](_0xae40('0x17'),_0x516e2c[_0xae40('0x10')]());for(var _0x320300=0x0;_0x320300<_0x516e2c[_0xae40('0xe')];_0x320300++){io[_0xae40('0x18')](_0xae40('0x19'),{'id':_0x516e2c[_0x320300],'closed':!![]});}}})[_0xae40('0x1a')](function(_0xe96516){logger[_0xae40('0x1b')](_0xae40('0x1c'),_0xe96516?util[_0xae40('0x1d')](_0xe96516,{'showHidden':![],'depth':null}):'');});}exports[_0xae40('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x90e0=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','schedule','redis','defaults','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0x120006,_0x44dd34){var _0x1199e0=function(_0x33663){while(--_0x33663){_0x120006['push'](_0x120006['shift']());}};_0x1199e0(++_0x44dd34);}(_0x90e0,0xd4));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x090e('0x0'));var moment=require(_0x090e('0x1'));var Redis=require(_0x090e('0x2'));var util=require(_0x090e('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x090e('0x4'));config[_0x090e('0x5')]=_[_0x090e('0x6')](config[_0x090e('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x090e('0x5')]));function closeInteractions(){var _0x4d739a=0x0;var _0x2eec7f=[];return db['Setting'][_0x090e('0x7')]({'raw':!![],'attributes':['id',_0x090e('0x8')],'where':{'id':0x1}})['then'](function(_0x5c0174){_0x4d739a=_0x5c0174['chatTimeout'];if(_0x4d739a){return db[_0x090e('0x9')][_0x090e('0xa')]({'raw':!![],'attributes':['id',_0x090e('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5c0174[_0x090e('0x8')],_0x090e('0xc'))}}});}else{return[];}})[_0x090e('0xd')](function(_0x382dd1){if(_0x382dd1&&_0x382dd1[_0x090e('0xe')]){_0x2eec7f=_[_0x090e('0xf')](_0x382dd1||[],'id');logger['info'](_0x090e('0x10'),_0x2eec7f[_0x090e('0x11')]());return db[_0x090e('0x9')][_0x090e('0x12')]({'closeReason':_0x090e('0x13'),'disposition':_0x090e('0x14'),'closed':!![],'closedAt':moment()[_0x090e('0x15')](_0x090e('0x16'))},{'where':{'id':_0x2eec7f}});}})[_0x090e('0xd')](function(){if(_0x2eec7f&&_0x2eec7f['length']){logger[_0x090e('0x17')](_0x090e('0x18'),_0x2eec7f[_0x090e('0x11')]());for(var _0x4914a8=0x0;_0x4914a8<_0x2eec7f[_0x090e('0xe')];_0x4914a8++){io['emit']('chatInteraction:update',{'id':_0x2eec7f[_0x4914a8],'closed':!![]});}}})['catch'](function(_0x2059e5){logger[_0x090e('0x19')](_0x090e('0x1a'),_0x2059e5?util[_0x090e('0x1b')](_0x2059e5,{'showHidden':![],'depth':null}):'');});}exports[_0x090e('0x1c')]=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 bc5bc58..4af40ce 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 _0x2cff=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x5da048,_0xca5c85){var _0x13dfc5=function(_0x1ac05f){while(--_0x1ac05f){_0x5da048['push'](_0x5da048['shift']());}};_0x13dfc5(++_0xca5c85);}(_0x2cff,0xd2));var _0xf2cf=function(_0x1c9bb8,_0x407240){_0x1c9bb8=_0x1c9bb8-0x0;var _0x518423=_0x2cff[_0x1c9bb8];return _0x518423;};'use strict';function start(){var _0x1edd2f=require(_0xf2cf('0x0'));return _0x1edd2f[_0xf2cf('0x1')]();}module[_0xf2cf('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xaf2f=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf2f,0x126));var _0xfaf2=function(_0x398a8b,_0x1812e5){_0x398a8b=_0x398a8b-0x0;var _0x3667c6=_0xaf2f[_0x398a8b];return _0x3667c6;};'use strict';function start(){var _0x5eb8c4=require(_0xfaf2('0x0'));return _0x5eb8c4[_0xfaf2('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 49ea961..8bc9822 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 _0xdaf0=['existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','error','request','SendMail','then','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','job','operation','stop','case\x20completed','data','case\x20empty','Unrecognized\x20status:','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','endAt','add','start','exists','stop\x20cron','startAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','AnalyticExtractedReport','findOne','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','basename','zip'];(function(_0x141be4,_0x4d8921){var _0x555277=function(_0x2c6617){while(--_0x2c6617){_0x141be4['push'](_0x141be4['shift']());}};_0x555277(++_0x4d8921);}(_0xdaf0,0x12f));var _0x0daf=function(_0x2a52b1,_0x3b1a4b){_0x2a52b1=_0x2a52b1-0x0;var _0x31c354=_0xdaf0[_0x2a52b1];return _0x31c354;};'use strict';var fs=require('fs');var util=require(_0x0daf('0x0'));var path=require(_0x0daf('0x1'));var _=require(_0x0daf('0x2'));var moment=require(_0x0daf('0x3'));var CronJobManager=require(_0x0daf('0x4'));var jayson=require(_0x0daf('0x5'));var BPromise=require(_0x0daf('0x6'));var logger=require(_0x0daf('0x7'))(_0x0daf('0x8'));var db=require(_0x0daf('0x9'))['db'];const retry=require(_0x0daf('0xa'));var analyticCustomReportController=require(_0x0daf('0xb'));var analyticDefaultReportController=require(_0x0daf('0xc'));var client=jayson[_0x0daf('0xd')][_0x0daf('0xe')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x22fe82){const _0x47a2b7={};if(typeof _0x22fe82==='number'){_0x47a2b7['id']=_0x22fe82;}return db[_0x0daf('0xf')][_0x0daf('0x10')]({'where':_0x47a2b7})['then'](function(_0x51eeaf){return _0x51eeaf;})['catch'](function(_0x3631c1){logger['error'](_0x3631c1);});}function handleSendEmail(_0x131c48,_0x5afa13){logger[_0x0daf('0x11')](_0x0daf('0x12'),_0x131c48[_0x0daf('0x13')]);var _0x20b140=!![];var _0x115a52=_0x131c48[_0x0daf('0x14')][_0x0daf('0x15')]();var _0x2fd9e4={'account':_0x115a52,'message':{'from':util[_0x0daf('0x16')](_0x0daf('0x17'),_0x131c48[_0x0daf('0x14')][_0x0daf('0x18')],_0x131c48['MailAccount'][_0x0daf('0x13')]||_0x131c48[_0x0daf('0x14')][_0x0daf('0x19')]['user']),'to':_0x131c48[_0x0daf('0x13')],'cc':_0x131c48['cc'],'bcc':_0x131c48['bcc'],'subject':util[_0x0daf('0x16')](_0x0daf('0x1a'),_0x5afa13[_0x0daf('0x18')],_0x131c48[_0x0daf('0x1b')],_0x131c48[_0x0daf('0x1c')])}};var _0x105202=path[_0x0daf('0x1d')](__dirname,'../../files/reports');var _0x546143=_0x5afa13[_0x0daf('0x1e')];var _0x4397f0=util[_0x0daf('0x16')]('%s.%s',path[_0x0daf('0x1f')](_0x5afa13[_0x0daf('0x1e')],path['extname'](_0x5afa13[_0x0daf('0x1e')])),_0x0daf('0x20'));var _0x2096a3=path[_0x0daf('0x1d')](_0x105202,_0x546143);var _0xb5ebbb=path[_0x0daf('0x1d')](_0x105202,_0x4397f0);if(fs[_0x0daf('0x21')](_0x2096a3)){_0x5afa13[_0x0daf('0x22')]='Sent';_0x2fd9e4[_0x0daf('0x23')][_0x0daf('0x24')]=[{'filename':_0x546143,'path':_0x2096a3}];_0x2fd9e4[_0x0daf('0x23')][_0x0daf('0x25')]=util[_0x0daf('0x16')](_0x0daf('0x26'),JSON[_0x0daf('0x27')](_0x5afa13,null,0x2));}else if(fs[_0x0daf('0x21')](_0xb5ebbb)){_0x5afa13[_0x0daf('0x22')]=_0x0daf('0x28');_0x2fd9e4['message'][_0x0daf('0x24')]=[{'filename':_0x4397f0,'path':_0xb5ebbb}];}else{if(_0x5afa13['status']==='Empty'){_0x2fd9e4[_0x0daf('0x23')][_0x0daf('0x25')]=_0x0daf('0x29');if(!_0x131c48['sendIfEmpty']){_0x20b140=![];logger[_0x0daf('0x11')](_0x0daf('0x2a'));}}else if(_0x5afa13[_0x0daf('0x22')]===_0x0daf('0x2b')){_0x2fd9e4[_0x0daf('0x23')][_0x0daf('0x25')]=_0x0daf('0x2c');}else if(_0x5afa13[_0x0daf('0x22')]===_0x0daf('0x2d')){_0x2fd9e4['message']['text']='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x5afa13[_0x0daf('0x22')]===_0x0daf('0x2e')){_0x2fd9e4[_0x0daf('0x23')][_0x0daf('0x25')]=_0x0daf('0x2f');}else{logger[_0x0daf('0x30')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x5afa13[_0x0daf('0x22')]);}}if(_0x20b140){return client[_0x0daf('0x31')](_0x0daf('0x32'),_0x2fd9e4)[_0x0daf('0x33')](function(_0x375bc1){if(_0x375bc1[_0x0daf('0x30')]){return logger[_0x0daf('0x30')](_0x0daf('0x34'),JSON[_0x0daf('0x27')](_0x375bc1));}return logger[_0x0daf('0x11')]('email\x20sent');})['catch'](function(_0x40de05){return logger[_0x0daf('0x30')]('error\x20mail',JSON[_0x0daf('0x27')](_0x40de05));});}}function handleError(){return function(_0x1d8b0b){return logger[_0x0daf('0x30')](JSON[_0x0daf('0x27')](_0x1d8b0b));};}function loading(_0xdbeb06){logger['info'](_0x0daf('0x35'));if(_0xdbeb06[_0x0daf('0x36')]===_0xdbeb06[_0x0daf('0x37')][_0x0daf('0x38')]){handleSendEmail(_0xdbeb06[_0x0daf('0x39')],_0xdbeb06['data']);_0xdbeb06[_0x0daf('0x3a')][_0x0daf('0x3b')]();}else{_0xdbeb06[_0x0daf('0x3a')][_0x0daf('0xa')]('still\x20loading');}}function completed(_0x576149){logger[_0x0daf('0x11')](_0x0daf('0x3c'));handleSendEmail(_0x576149[_0x0daf('0x39')],_0x576149[_0x0daf('0x3d')]);_0x576149['operation']['stop']();}function empty(_0x2827ce){logger[_0x0daf('0x11')](_0x0daf('0x3e'));handleSendEmail(_0x2827ce['job'],_0x2827ce[_0x0daf('0x3d')]);_0x2827ce[_0x0daf('0x3a')]['stop']();}function failed(_0x29ebd1){logger[_0x0daf('0x11')]('case\x20failed');handleSendEmail(_0x29ebd1['job'],_0x29ebd1[_0x0daf('0x3d')]);_0x29ebd1[_0x0daf('0x3a')][_0x0daf('0x3b')]();}function urecognized(_0x5e8ff8){logger['error'](_0x0daf('0x3f'),_0x5e8ff8[_0x0daf('0x40')][_0x0daf('0x41')][_0x0daf('0x22')]);_0x5e8ff8[_0x0daf('0x3a')][_0x0daf('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x348e28,_0x39d21e){const _0x9956d3={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x354a79=retry['operation'](_0x9956d3);_0x354a79[_0x0daf('0x42')](_0xb921f0=>{logger[_0x0daf('0x11')](_0x0daf('0x43')+_0x348e28['id']+_0x0daf('0x44')+_0xb921f0);try{getReportData(_0x39d21e['id'])['then'](function(_0x729859){_0x39d21e=_0x729859;logger[_0x0daf('0x11')](_0x0daf('0x45'),_0x729859[_0x0daf('0x41')]['status']);if(!reportStatusStrategies[_0x729859['dataValues'][_0x0daf('0x22')]]){logger[_0x0daf('0x30')](_0x0daf('0x45'),_0x729859[_0x0daf('0x41')][_0x0daf('0x22')]);_0x354a79[_0x0daf('0xa')]();}reportStatusStrategies[_0x729859[_0x0daf('0x41')][_0x0daf('0x22')]]({'operation':_0x354a79,'currentAttempt':_0xb921f0,'retryOptions':_0x9956d3,'job':_0x348e28,'data':_0x39d21e,'entity':_0x729859});});}catch(_0x3b15f4){_0x354a79['retry'](_0x3b15f4);}});}function handleResult(_0x15d5a0){return function(_0xc6a1fb){if(_0x15d5a0[_0x0daf('0x46')]&&_0x15d5a0['MailAccount']&&_0x15d5a0[_0x0daf('0x14')][_0x0daf('0x19')]&&!_[_0x0daf('0x47')](_0x15d5a0[_0x0daf('0x13')])){retryer(_0x15d5a0,_0xc6a1fb);}};}function handleJob(_0x48d93f){return function(){try{if(_[_0x0daf('0x47')](_0x48d93f[_0x0daf('0x1b')])){return logger[_0x0daf('0x11')](_0x0daf('0x48'));}if(_[_0x0daf('0x47')](_0x48d93f['subtractUnit'])){return logger[_0x0daf('0x11')](_0x0daf('0x49'));}var _0x3d2d79={'startDate':moment()[_0x0daf('0x4a')](_0x48d93f[_0x0daf('0x1b')],_0x48d93f[_0x0daf('0x1c')])[_0x0daf('0x16')](_0x0daf('0x4b')),'endDate':moment()[_0x0daf('0x16')](_0x0daf('0x4b')),'type':_0x0daf('0x4c'),'output':_0x48d93f[_0x0daf('0x4d')],'name':_0x48d93f[_0x0daf('0x18')]};if(!_[_0x0daf('0x47')](_0x48d93f[_0x0daf('0x4e')])){logger[_0x0daf('0x11')]('exec\x20defaul\x20report\x20id:%s',_0x48d93f[_0x0daf('0x4e')]);return analyticDefaultReportController[_0x0daf('0x4f')]({'id':_0x48d93f[_0x0daf('0x4e')]},_0x3d2d79)[_0x0daf('0x33')](handleResult(_0x48d93f))[_0x0daf('0x50')](handleError());}if(!_[_0x0daf('0x47')](_0x48d93f[_0x0daf('0x51')])){logger[_0x0daf('0x11')](_0x0daf('0x52'),_0x48d93f[_0x0daf('0x51')]);return analyticCustomReportController[_0x0daf('0x4f')]({'id':_0x48d93f[_0x0daf('0x51')]},_0x3d2d79)[_0x0daf('0x33')](handleResult(_0x48d93f))[_0x0daf('0x50')](handleError());}}catch(_0x49f48d){logger[_0x0daf('0x30')](JSON[_0x0daf('0x27')](_0x49f48d));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x17e514){var _0x2a0a52={};if(_0x17e514){_0x2a0a52['id']=_0x17e514;}return db[_0x0daf('0x53')][_0x0daf('0x54')]({'where':_0x2a0a52,'include':[{'model':db[_0x0daf('0x14')],'attributes':['id','name',_0x0daf('0x13')],'include':[{'model':db[_0x0daf('0x55')],'as':_0x0daf('0x19'),'include':[{'model':db['CloudProvider'],'as':_0x0daf('0x56')}]}]}]})[_0x0daf('0x33')](function(_0x4fed18){var _0x1926bf=_[_0x0daf('0x57')](manager[_0x0daf('0x58')]);var _0x318eca=_[_0x0daf('0x59')](_0x4fed18,function(_0x1a395a){return _0x1a395a['id'][_0x0daf('0x5a')]();});var _0x320387=_[_0x0daf('0x5b')](_0x4fed18,function(_0x45817a){return _0x45817a['id'][_0x0daf('0x5a')]();});var _0x39a0d1=_0x17e514?_0x318eca:_[_0x0daf('0x5c')](_0x318eca,_0x1926bf);var _0x29757a=_[_0x0daf('0x5d')](_0x318eca,_0x1926bf);var _0x1be842=_[_0x0daf('0x5c')](_0x1926bf,_0x318eca);var _0x647365;var _0x4f546f;for(_0x647365=0x0;_0x647365<_0x1be842[_0x0daf('0x5e')]&&!_0x17e514;_0x647365+=0x1){_0x4f546f=_0x1be842[_0x647365][_0x0daf('0x5a')]();if(manager['exists'](_0x4f546f)){manager['stop'](_0x4f546f);manager[_0x0daf('0x5f')](_0x4f546f);logger[_0x0daf('0x11')](_0x0daf('0x60'),_0x4f546f);}}logger[_0x0daf('0x11')](_0x0daf('0x61'),JSON[_0x0daf('0x27')](_0x39a0d1));for(_0x647365=0x0;_0x647365<_0x39a0d1[_0x0daf('0x5e')];_0x647365+=0x1){_0x4f546f=_0x39a0d1[_0x647365][_0x0daf('0x5a')]();if(_0x17e514){logger[_0x0daf('0x11')](JSON['stringify'](_0x320387[_0x4f546f]));BPromise[_0x0daf('0x62')]()[_0x0daf('0x33')](handleJob(_0x320387[_0x4f546f]));logger['info'](_0x0daf('0x63'),_0x320387[_0x4f546f][_0x0daf('0x18')],_0x320387[_0x4f546f][_0x0daf('0x64')]);}else if(_0x320387[_0x4f546f]['cron']&&_0x320387[_0x4f546f][_0x0daf('0x65')]&&moment()[_0x0daf('0x66')](_0x320387[_0x4f546f]['startAt'],_0x320387[_0x4f546f][_0x0daf('0x67')])){manager[_0x0daf('0x68')](_0x4f546f,_0x320387[_0x4f546f][_0x0daf('0x64')],handleJob(_0x320387[_0x4f546f]));manager[_0x0daf('0x69')](_0x4f546f);logger[_0x0daf('0x11')]('add\x20cron',_0x320387[_0x4f546f][_0x0daf('0x18')],_0x320387[_0x4f546f][_0x0daf('0x64')]);}else if(manager[_0x0daf('0x6a')](_0x4f546f)){manager[_0x0daf('0x3b')](_0x4f546f);manager['deleteJob'](_0x4f546f);logger[_0x0daf('0x11')](_0x0daf('0x6b'),_0x320387[_0x4f546f][_0x0daf('0x18')],_0x320387[_0x4f546f][_0x0daf('0x64')]);}}for(_0x647365=0x0,_0x4f546f;_0x647365<_0x29757a[_0x0daf('0x5e')]&&!_0x17e514;_0x647365+=0x1){_0x4f546f=_0x29757a[_0x647365][_0x0daf('0x5a')]();if(manager[_0x0daf('0x6a')](_0x4f546f)){if(_0x320387[_0x4f546f][_0x0daf('0x64')]&&_0x320387[_0x4f546f][_0x0daf('0x65')]&&moment()['isBetween'](_0x320387[_0x4f546f][_0x0daf('0x6c')],_0x320387[_0x4f546f][_0x0daf('0x67')])){manager[_0x0daf('0x6d')](_0x4f546f,_0x320387[_0x4f546f][_0x0daf('0x64')],handleJob(_0x320387[_0x4f546f]));logger['info'](_0x0daf('0x6e'),_0x320387[_0x4f546f][_0x0daf('0x18')],_0x320387[_0x4f546f][_0x0daf('0x64')]);}else{manager[_0x0daf('0x3b')](_0x4f546f);manager[_0x0daf('0x5f')](_0x4f546f);logger[_0x0daf('0x11')](_0x0daf('0x6b'),_0x320387[_0x4f546f]['name'],_0x320387[_0x4f546f]['cron']);}}}})[_0x0daf('0x50')](function(_0x121c3a){logger[_0x0daf('0x30')](JSON[_0x0daf('0x27')](_0x121c3a));});}exports[_0x0daf('0x6f')]=function(_0x3b559f){return getJobs(_0x3b559f);};exports[_0x0daf('0x69')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf6dc=['email','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','SendMail','error\x20mail','email\x20sent','retryOptions','job','data','stop','operation','case\x20completed','case\x20empty','case\x20failed','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','CloudProvider','keys','jobs','map','toString','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','active','isBetween','startAt','endAt','add','add\x20cron','cron','stop\x20cron','run','start','util','path','lodash','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','number','AnalyticExtractedReport','then','catch','error'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xf6dc,0xbd));var _0xcf6d=function(_0x2d3ba0,_0x257709){_0x2d3ba0=_0x2d3ba0-0x0;var _0x284cd3=_0xf6dc[_0x2d3ba0];return _0x284cd3;};'use strict';var fs=require('fs');var util=require(_0xcf6d('0x0'));var path=require(_0xcf6d('0x1'));var _=require(_0xcf6d('0x2'));var moment=require('moment');var CronJobManager=require(_0xcf6d('0x3'));var jayson=require(_0xcf6d('0x4'));var BPromise=require(_0xcf6d('0x5'));var logger=require('../logger')(_0xcf6d('0x6'));var db=require(_0xcf6d('0x7'))['db'];const retry=require(_0xcf6d('0x8'));var analyticCustomReportController=require(_0xcf6d('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x3dbbc4){const _0x1c5181={};if(typeof _0x3dbbc4===_0xcf6d('0xa')){_0x1c5181['id']=_0x3dbbc4;}return db[_0xcf6d('0xb')]['findOne']({'where':_0x1c5181})[_0xcf6d('0xc')](function(_0x1a065a){return _0x1a065a;})[_0xcf6d('0xd')](function(_0x4890df){logger[_0xcf6d('0xe')](_0x4890df);});}function handleSendEmail(_0x347613,_0x273df5){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x347613[_0xcf6d('0xf')]);var _0x3acf91=!![];var _0x556392=_0x347613['MailAccount']['getSmtpOptions']();var _0x551a82={'account':_0x556392,'message':{'from':util[_0xcf6d('0x10')](_0xcf6d('0x11'),_0x347613[_0xcf6d('0x12')][_0xcf6d('0x13')],_0x347613[_0xcf6d('0x12')][_0xcf6d('0xf')]||_0x347613[_0xcf6d('0x12')][_0xcf6d('0x14')]['user']),'to':_0x347613[_0xcf6d('0xf')],'cc':_0x347613['cc'],'bcc':_0x347613[_0xcf6d('0x15')],'subject':util[_0xcf6d('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x273df5[_0xcf6d('0x13')],_0x347613[_0xcf6d('0x16')],_0x347613[_0xcf6d('0x17')])}};var _0x387f16=path[_0xcf6d('0x18')](__dirname,_0xcf6d('0x19'));var _0x3cd146=_0x273df5[_0xcf6d('0x1a')];var _0x3392f9=util['format'](_0xcf6d('0x1b'),path[_0xcf6d('0x1c')](_0x273df5[_0xcf6d('0x1a')],path['extname'](_0x273df5['savename'])),_0xcf6d('0x1d'));var _0x4128b5=path['join'](_0x387f16,_0x3cd146);var _0xab434f=path[_0xcf6d('0x18')](_0x387f16,_0x3392f9);if(fs[_0xcf6d('0x1e')](_0x4128b5)){_0x273df5[_0xcf6d('0x1f')]=_0xcf6d('0x20');_0x551a82[_0xcf6d('0x21')]['attachments']=[{'filename':_0x3cd146,'path':_0x4128b5}];_0x551a82['message'][_0xcf6d('0x22')]=util[_0xcf6d('0x10')](_0xcf6d('0x23'),JSON[_0xcf6d('0x24')](_0x273df5,null,0x2));}else if(fs['existsSync'](_0xab434f)){_0x273df5['status']=_0xcf6d('0x20');_0x551a82['message'][_0xcf6d('0x25')]=[{'filename':_0x3392f9,'path':_0xab434f}];}else{if(_0x273df5['status']===_0xcf6d('0x26')){_0x551a82[_0xcf6d('0x21')][_0xcf6d('0x22')]=_0xcf6d('0x27');if(!_0x347613[_0xcf6d('0x28')]){_0x3acf91=![];logger[_0xcf6d('0x29')](_0xcf6d('0x2a'));}}else if(_0x273df5[_0xcf6d('0x1f')]===_0xcf6d('0x2b')){_0x551a82[_0xcf6d('0x21')][_0xcf6d('0x22')]=_0xcf6d('0x2c');}else if(_0x273df5[_0xcf6d('0x1f')]===_0xcf6d('0x2d')){_0x551a82['message'][_0xcf6d('0x22')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x273df5[_0xcf6d('0x1f')]===_0xcf6d('0x2e')){_0x551a82[_0xcf6d('0x21')][_0xcf6d('0x22')]=_0xcf6d('0x2f');}else{logger[_0xcf6d('0xe')](_0xcf6d('0x30'),_0x273df5[_0xcf6d('0x1f')]);}}if(_0x3acf91){return client['request'](_0xcf6d('0x31'),_0x551a82)[_0xcf6d('0xc')](function(_0x53cb63){if(_0x53cb63['error']){return logger[_0xcf6d('0xe')](_0xcf6d('0x32'),JSON[_0xcf6d('0x24')](_0x53cb63));}return logger[_0xcf6d('0x29')](_0xcf6d('0x33'));})['catch'](function(_0x2f0334){return logger[_0xcf6d('0xe')](_0xcf6d('0x32'),JSON[_0xcf6d('0x24')](_0x2f0334));});}}function handleError(){return function(_0x4d5d34){return logger['error'](JSON['stringify'](_0x4d5d34));};}function loading(_0x30a1a3){logger[_0xcf6d('0x29')]('case\x20loading');if(_0x30a1a3['currentAttempt']===_0x30a1a3[_0xcf6d('0x34')]['retries']){handleSendEmail(_0x30a1a3[_0xcf6d('0x35')],_0x30a1a3[_0xcf6d('0x36')]);_0x30a1a3['operation'][_0xcf6d('0x37')]();}else{_0x30a1a3[_0xcf6d('0x38')]['retry']('still\x20loading');}}function completed(_0x32d945){logger[_0xcf6d('0x29')](_0xcf6d('0x39'));handleSendEmail(_0x32d945['job'],_0x32d945['data']);_0x32d945['operation'][_0xcf6d('0x37')]();}function empty(_0x57f9ee){logger[_0xcf6d('0x29')](_0xcf6d('0x3a'));handleSendEmail(_0x57f9ee[_0xcf6d('0x35')],_0x57f9ee[_0xcf6d('0x36')]);_0x57f9ee[_0xcf6d('0x38')][_0xcf6d('0x37')]();}function failed(_0x55699b){logger[_0xcf6d('0x29')](_0xcf6d('0x3b'));handleSendEmail(_0x55699b[_0xcf6d('0x35')],_0x55699b[_0xcf6d('0x36')]);_0x55699b[_0xcf6d('0x38')]['stop']();}function urecognized(_0x596936){logger['error'](_0xcf6d('0x3c'),_0x596936[_0xcf6d('0x3d')][_0xcf6d('0x3e')][_0xcf6d('0x1f')]);_0x596936[_0xcf6d('0x38')][_0xcf6d('0x37')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x4fbc66,_0x5a1033){const _0x17e9fa={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x2eed0f=retry[_0xcf6d('0x38')](_0x17e9fa);_0x2eed0f['attempt'](_0x41dc51=>{logger[_0xcf6d('0x29')](_0xcf6d('0x3f')+_0x4fbc66['id']+_0xcf6d('0x40')+_0x41dc51);try{getReportData(_0x5a1033['id'])[_0xcf6d('0xc')](function(_0x2062df){_0x5a1033=_0x2062df;logger[_0xcf6d('0x29')](_0xcf6d('0x41'),_0x2062df['dataValues'][_0xcf6d('0x1f')]);if(!reportStatusStrategies[_0x2062df[_0xcf6d('0x3e')][_0xcf6d('0x1f')]]){logger['error'](_0xcf6d('0x41'),_0x2062df[_0xcf6d('0x3e')][_0xcf6d('0x1f')]);_0x2eed0f['retry']();}reportStatusStrategies[_0x2062df[_0xcf6d('0x3e')][_0xcf6d('0x1f')]]({'operation':_0x2eed0f,'currentAttempt':_0x41dc51,'retryOptions':_0x17e9fa,'job':_0x4fbc66,'data':_0x5a1033,'entity':_0x2062df});});}catch(_0x5b0f65){_0x2eed0f['retry'](_0x5b0f65);}});}function handleResult(_0x4e8cc2){return function(_0x4d0108){if(_0x4e8cc2[_0xcf6d('0x42')]&&_0x4e8cc2[_0xcf6d('0x12')]&&_0x4e8cc2[_0xcf6d('0x12')][_0xcf6d('0x14')]&&!_[_0xcf6d('0x43')](_0x4e8cc2['email'])){retryer(_0x4e8cc2,_0x4d0108);}};}function handleJob(_0x5a6727){return function(){try{if(_['isNil'](_0x5a6727[_0xcf6d('0x16')])){return logger[_0xcf6d('0x29')](_0xcf6d('0x44'));}if(_['isNil'](_0x5a6727['subtractUnit'])){return logger['info'](_0xcf6d('0x45'));}var _0x461227={'startDate':moment()[_0xcf6d('0x46')](_0x5a6727[_0xcf6d('0x16')],_0x5a6727['subtractUnit'])['format'](_0xcf6d('0x47')),'endDate':moment()[_0xcf6d('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xcf6d('0x48'),'output':_0x5a6727[_0xcf6d('0x49')],'name':_0x5a6727['name']};if(!_[_0xcf6d('0x43')](_0x5a6727[_0xcf6d('0x4a')])){logger[_0xcf6d('0x29')](_0xcf6d('0x4b'),_0x5a6727['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5a6727[_0xcf6d('0x4a')]},_0x461227)[_0xcf6d('0xc')](handleResult(_0x5a6727))[_0xcf6d('0xd')](handleError());}if(!_[_0xcf6d('0x43')](_0x5a6727[_0xcf6d('0x4c')])){logger['info'](_0xcf6d('0x4d'),_0x5a6727[_0xcf6d('0x4c')]);return analyticCustomReportController['runReport']({'id':_0x5a6727[_0xcf6d('0x4c')]},_0x461227)[_0xcf6d('0xc')](handleResult(_0x5a6727))[_0xcf6d('0xd')](handleError());}}catch(_0x1c230e){logger[_0xcf6d('0xe')](JSON['stringify'](_0x1c230e));}return logger['info'](_0xcf6d('0x4e'));};}function getJobs(_0x1f903f){var _0x55210b={};if(_0x1f903f){_0x55210b['id']=_0x1f903f;}return db['Schedule'][_0xcf6d('0x4f')]({'where':_0x55210b,'include':[{'model':db[_0xcf6d('0x12')],'attributes':['id',_0xcf6d('0x13'),_0xcf6d('0xf')],'include':[{'model':db['MailServerOut'],'as':_0xcf6d('0x14'),'include':[{'model':db[_0xcf6d('0x50')],'as':_0xcf6d('0x50')}]}]}]})[_0xcf6d('0xc')](function(_0x476155){var _0x49f45b=_[_0xcf6d('0x51')](manager[_0xcf6d('0x52')]);var _0x1055ec=_[_0xcf6d('0x53')](_0x476155,function(_0x1d8a29){return _0x1d8a29['id'][_0xcf6d('0x54')]();});var _0x22654e=_['keyBy'](_0x476155,function(_0x2bdafe){return _0x2bdafe['id']['toString']();});var _0xaca41d=_0x1f903f?_0x1055ec:_['difference'](_0x1055ec,_0x49f45b);var _0x410921=_['intersection'](_0x1055ec,_0x49f45b);var _0x13dfa8=_['difference'](_0x49f45b,_0x1055ec);var _0x433286;var _0x5887bb;for(_0x433286=0x0;_0x433286<_0x13dfa8[_0xcf6d('0x55')]&&!_0x1f903f;_0x433286+=0x1){_0x5887bb=_0x13dfa8[_0x433286][_0xcf6d('0x54')]();if(manager[_0xcf6d('0x56')](_0x5887bb)){manager[_0xcf6d('0x37')](_0x5887bb);manager[_0xcf6d('0x57')](_0x5887bb);logger[_0xcf6d('0x29')](_0xcf6d('0x58'),_0x5887bb);}}logger[_0xcf6d('0x29')](_0xcf6d('0x59'),JSON['stringify'](_0xaca41d));for(_0x433286=0x0;_0x433286<_0xaca41d['length'];_0x433286+=0x1){_0x5887bb=_0xaca41d[_0x433286]['toString']();if(_0x1f903f){logger[_0xcf6d('0x29')](JSON['stringify'](_0x22654e[_0x5887bb]));BPromise[_0xcf6d('0x5a')]()[_0xcf6d('0xc')](handleJob(_0x22654e[_0x5887bb]));logger[_0xcf6d('0x29')](_0xcf6d('0x5b'),_0x22654e[_0x5887bb][_0xcf6d('0x13')],_0x22654e[_0x5887bb]['cron']);}else if(_0x22654e[_0x5887bb]['cron']&&_0x22654e[_0x5887bb][_0xcf6d('0x5c')]&&moment()[_0xcf6d('0x5d')](_0x22654e[_0x5887bb][_0xcf6d('0x5e')],_0x22654e[_0x5887bb][_0xcf6d('0x5f')])){manager[_0xcf6d('0x60')](_0x5887bb,_0x22654e[_0x5887bb]['cron'],handleJob(_0x22654e[_0x5887bb]));manager['start'](_0x5887bb);logger[_0xcf6d('0x29')](_0xcf6d('0x61'),_0x22654e[_0x5887bb][_0xcf6d('0x13')],_0x22654e[_0x5887bb][_0xcf6d('0x62')]);}else if(manager[_0xcf6d('0x56')](_0x5887bb)){manager['stop'](_0x5887bb);manager[_0xcf6d('0x57')](_0x5887bb);logger[_0xcf6d('0x29')](_0xcf6d('0x63'),_0x22654e[_0x5887bb][_0xcf6d('0x13')],_0x22654e[_0x5887bb][_0xcf6d('0x62')]);}}for(_0x433286=0x0,_0x5887bb;_0x433286<_0x410921[_0xcf6d('0x55')]&&!_0x1f903f;_0x433286+=0x1){_0x5887bb=_0x410921[_0x433286][_0xcf6d('0x54')]();if(manager[_0xcf6d('0x56')](_0x5887bb)){if(_0x22654e[_0x5887bb]['cron']&&_0x22654e[_0x5887bb][_0xcf6d('0x5c')]&&moment()[_0xcf6d('0x5d')](_0x22654e[_0x5887bb][_0xcf6d('0x5e')],_0x22654e[_0x5887bb][_0xcf6d('0x5f')])){manager['update'](_0x5887bb,_0x22654e[_0x5887bb][_0xcf6d('0x62')],handleJob(_0x22654e[_0x5887bb]));logger['info']('update\x20cron',_0x22654e[_0x5887bb]['name'],_0x22654e[_0x5887bb][_0xcf6d('0x62')]);}else{manager[_0xcf6d('0x37')](_0x5887bb);manager[_0xcf6d('0x57')](_0x5887bb);logger[_0xcf6d('0x29')](_0xcf6d('0x63'),_0x22654e[_0x5887bb][_0xcf6d('0x13')],_0x22654e[_0x5887bb][_0xcf6d('0x62')]);}}}})[_0xcf6d('0xd')](function(_0x1011be){logger[_0xcf6d('0xe')](JSON[_0xcf6d('0x24')](_0x1011be));});}exports[_0xcf6d('0x64')]=function(_0x224840){return getJobs(_0x224840);};exports[_0xcf6d('0x65')]=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 359a478..8306447 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 _0xa03c=['findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','start','lodash','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','Mixed','SentimentScore','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','Sentiment','Positive','Negative','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xa03c,0x94));var _0xca03=function(_0x128495,_0x25a304){_0x128495=_0x128495-0x0;var _0xcb1a0e=_0xa03c[_0x128495];return _0xcb1a0e;};var _=require(_0xca03('0x0'));var AWS=require('aws-sdk');var rp=require(_0xca03('0x1'));var util=require(_0xca03('0x2'));var BPromise=require(_0xca03('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xca03('0x4'))(_0xca03('0x5'));function getTranscriptionJob(_0x61cd34,_0x481715,_0x3dc5ef,_0x1bf647){return new Promise(function(_0x2f0ace,_0x20cf52){var _0x27aac6=new AWS[(_0xca03('0x6'))]({'accessKeyId':_0x481715,'secretAccessKey':_0x61cd34,'region':_0x3dc5ef});_0x27aac6['getTranscriptionJob']({'TranscriptionJobName':_0x1bf647},function(_0x1832cc,_0x18ddee){if(_0x1832cc){return _0x20cf52(_0x1832cc);}else{return _0x2f0ace(_0x18ddee);}});});}function sentiment(_0x2e9c92,_0x51cdb4,_0x31e7be,_0x9f510d,_0x34f897){return new Promise(function(_0x2a0468,_0x17b38d){var _0x3cea29=new AWS['Comprehend']({'accessKeyId':_0x51cdb4,'secretAccessKey':_0x2e9c92,'region':_0x31e7be});_0x3cea29[_0xca03('0x7')]({'Text':_0x9f510d,'LanguageCode':_0x34f897[_0xca03('0x8')](0x0,0x2)},function(_0x14c74a,_0x2571b8){if(_0x14c74a){return _0x17b38d(_0x14c74a);}else{return _0x2a0468(_0x2571b8);}});});}function checkTranscribeJob(_0x1a6abb,_0xfad3cc,_0x26c060){var _0x2623bb;return new BPromise(function(_0xb3ab63,_0xc50414){logger[_0xca03('0x9')](util[_0xca03('0xa')](_0xca03('0xb'),_0x1a6abb['id'],_0x1a6abb[_0xca03('0xc')]));return getTranscriptionJob(_0x26c060[_0xca03('0xd')],_0x26c060[_0xca03('0xe')],_0xfad3cc[_0xca03('0xf')],_0x1a6abb[_0xca03('0xc')])[_0xca03('0x10')](function(_0x5b9801){logger[_0xca03('0x9')](util[_0xca03('0xa')](_0xca03('0x11'),_0x1a6abb['id'],_0x1a6abb[_0xca03('0xc')],_0x5b9801[_0xca03('0x12')][_0xca03('0x13')]));if(!_0x1a6abb[_0xca03('0x14')]){switch(_0x5b9801[_0xca03('0x12')]['TranscriptionJobStatus']){case _0xca03('0x15'):var _0x56eab4={'transcribeStatus':_0x5b9801['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x5b9801[_0xca03('0x12')][_0xca03('0x16')][_0xca03('0x17')]};logger[_0xca03('0x9')](util['format'](_0xca03('0x18'),_0x1a6abb['id']));return rp({'uri':_0x5b9801['TranscriptionJob'][_0xca03('0x16')][_0xca03('0x17')],'json':!![]})[_0xca03('0x10')](function(_0x20e22a){logger[_0xca03('0x9')](util[_0xca03('0xa')](_0xca03('0x19'),_0x1a6abb['id']));if(_0x20e22a&&_0x20e22a[_0xca03('0x1a')]&&_0x20e22a[_0xca03('0x1a')][_0xca03('0x1b')]&&_0x20e22a['results'][_0xca03('0x1b')][_0xca03('0x1c')]){_0x56eab4[_0xca03('0x14')]='';for(var _0x2d05cb=0x0;_0x2d05cb<_0x20e22a['results'][_0xca03('0x1b')][_0xca03('0x1c')];_0x2d05cb++){_0x56eab4[_0xca03('0x14')]+=_0x20e22a['results'][_0xca03('0x1b')][_0x2d05cb]['transcript']+'';}}return _0x1a6abb[_0xca03('0x1d')](_0x56eab4);})['then'](function(){logger[_0xca03('0x9')](util['format'](_0xca03('0x1e'),_0x1a6abb['id']));if(!_0x1a6abb[_0xca03('0x1f')]){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))](_0xca03('0x22'));}if(!_0xfad3cc[_0xca03('0x23')]||!_0xfad3cc['sentimentAccountId']||!_0xfad3cc['sentimentRegion']||!_0xfad3cc['language']||!_0xfad3cc[_0xca03('0x24')]){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))](_0xca03('0x25'));}if(!_0x56eab4[_0xca03('0x14')]){throw new Error(_0xca03('0x26'));}if(_0xfad3cc[_0xca03('0x27')]===_0x26c060['id']){return _0x26c060;}else{return db[_0xca03('0x28')][_0xca03('0x29')]({'where':{'id':_settings[_0xca03('0x27')]}});}})['then'](function(_0x1baa05){if(!_0x1baa05){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1baa05[_0xca03('0xd')]||!_0x1baa05[_0xca03('0xe')]){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))](_0xca03('0x2a'));}_0x2623bb=_0x1baa05;logger[_0xca03('0x9')](util[_0xca03('0xa')](_0xca03('0x2b'),_0x1a6abb['id']));return sentiment(_0x2623bb[_0xca03('0xd')],_0x2623bb['data2'],_0xfad3cc[_0xca03('0x2c')],_0x56eab4['fileText'],_0xfad3cc[_0xca03('0x2d')]);})[_0xca03('0x10')](function(_0x5bc1e6){logger[_0xca03('0x9')](util[_0xca03('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1a6abb['id']));return _0x1a6abb[_0xca03('0x1d')]({'sentiment':_0x5bc1e6['Sentiment'],'sPositive':_0x5bc1e6['SentimentScore']['Positive'],'sNegative':_0x5bc1e6['SentimentScore']['Negative'],'sMixed':_0x5bc1e6['SentimentScore'][_0xca03('0x2e')],'sNeutral':_0x5bc1e6[_0xca03('0x2f')][_0xca03('0x30')]});})[_0xca03('0x10')](function(){logger[_0xca03('0x9')](util[_0xca03('0xa')](_0xca03('0x1e'),_0x1a6abb['id']));_0xb3ab63();});case _0xca03('0x31'):return _0x1a6abb[_0xca03('0x1d')]({'transcribeStatus':_0xca03('0x31'),'failureReason':_0x5b9801['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util[_0xca03('0xa')](_0xca03('0x1e'),_0x1a6abb['id']));_0xb3ab63();});default:logger[_0xca03('0x9')](util[_0xca03('0xa')](_0xca03('0x32'),_0x1a6abb['id']));break;}}else{return BPromise[_0xca03('0x33')]()[_0xca03('0x10')](function(){if(!_0x1a6abb[_0xca03('0x1f')]){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))](_0xca03('0x22'));}if(!_0xfad3cc[_0xca03('0x23')]||!_0xfad3cc[_0xca03('0x27')]||!_0xfad3cc[_0xca03('0x2c')]||!_0xfad3cc[_0xca03('0x2d')]||!_0xfad3cc['bucket']){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1a6abb[_0xca03('0x14')]){throw new Error(_0xca03('0x26'));}if(_0xfad3cc['sentimentAccountId']===_0x26c060['id']){return _0x26c060;}else{return db[_0xca03('0x28')][_0xca03('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x584747){if(!_0x584747){throw new db['Sequelize']['ValidationError'](_0xca03('0x34'));}if(!_0x584747[_0xca03('0xd')]||!_0x584747['data2']){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))](_0xca03('0x2a'));}_0x2623bb=_0x584747;logger['info'](util['format'](_0xca03('0x2b'),_0x1a6abb['id']));return sentiment(_0x2623bb['data1'],_0x2623bb[_0xca03('0xe')],_0xfad3cc[_0xca03('0x2c')],_0x1a6abb[_0xca03('0x14')],_0xfad3cc[_0xca03('0x2d')]);})[_0xca03('0x10')](function(_0x278704){logger[_0xca03('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1a6abb['id']));return _0x1a6abb[_0xca03('0x1d')]({'sentiment':_0x278704[_0xca03('0x35')],'sPositive':_0x278704[_0xca03('0x2f')][_0xca03('0x36')],'sNegative':_0x278704[_0xca03('0x2f')][_0xca03('0x37')],'sMixed':_0x278704[_0xca03('0x2f')][_0xca03('0x2e')],'sNeutral':_0x278704['SentimentScore'][_0xca03('0x30')],'transcribeStatus':_0xca03('0x15')});})['then'](function(){logger[_0xca03('0x9')](util['format'](_0xca03('0x1e'),_0x1a6abb['id']));_0xb3ab63();});}})[_0xca03('0x38')](function(_0x1a0194){if(_0x1a0194){if(!_0x1a0194[_0xca03('0x39')]||_0x1a0194[_0xca03('0x39')]!==_0xca03('0x3a')){logger['error'](util[_0xca03('0xa')](_0xca03('0x3b'),_0x1a6abb['id']),util[_0xca03('0x3c')](_0x1a0194,{'showHidden':![],'depth':null}));}}_0xb3ab63();});});}function checkTranscribe(){var _0x251344;var _0x474223;var _0x1609b8;return db[_0xca03('0x3d')][_0xca03('0x3e')]({'where':{'transcribeStatus':_0xca03('0x3f')}})['then'](function(_0x2eb6c3){if(!_0x2eb6c3||!_0x2eb6c3[_0xca03('0x1c')]){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))](_0xca03('0x40'));}_0x251344=_0x2eb6c3;return db[_0xca03('0x41')][_0xca03('0x29')]({'where':{'id':0x1}});})['then'](function(_0x517b4d){if(!_0x517b4d){throw new db['Sequelize'][(_0xca03('0x21'))](_0xca03('0x42'));}_0x474223=_0x517b4d;if(!_0x474223[_0xca03('0x5')]||!_0x474223[_0xca03('0x43')]||!_0x474223['transcribeRegion']||!_0x474223[_0xca03('0x2d')]||!_0x474223['bucket']){throw new db[(_0xca03('0x20'))][(_0xca03('0x21'))]('Transcribe\x20not\x20configured');}return db[_0xca03('0x28')][_0xca03('0x29')]({'where':{'id':_0x474223[_0xca03('0x43')]}});})[_0xca03('0x10')](function(_0x3a0a68){if(!_0x3a0a68){throw new db['Sequelize'][(_0xca03('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3a0a68[_0xca03('0xd')]||!_0x3a0a68['data2']){throw new db['Sequelize'][(_0xca03('0x21'))](_0xca03('0x2a'));}_0x1609b8=_0x3a0a68;var _0x31aa4d=[];_0x251344['forEach'](function(_0x1b4a92){_0x31aa4d[_0xca03('0x44')](checkTranscribeJob(_0x1b4a92,_0x474223,_0x1609b8));});return BPromise['all'](_0x31aa4d);})[_0xca03('0x38')](function(_0x57ecec){if(_0x57ecec){if(!_0x57ecec['name']||_0x57ecec[_0xca03('0x39')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x57ecec,{'showHidden':![],'depth':null}));}}});}exports[_0xca03('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7b37=['util','bluebird','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b37,0xd9));var _0x77b3=function(_0x49e3a4,_0x263356){_0x49e3a4=_0x49e3a4-0x0;var _0x1e36a5=_0x7b37[_0x49e3a4];return _0x1e36a5;};var _=require(_0x77b3('0x0'));var AWS=require(_0x77b3('0x1'));var rp=require('request-promise');var util=require(_0x77b3('0x2'));var BPromise=require(_0x77b3('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x77b3('0x4'))('transcribe');function getTranscriptionJob(_0x2719f2,_0x2c94ea,_0x2d64f7,_0x579ea7){return new Promise(function(_0x3acdea,_0x32345c){var _0x515f06=new AWS['TranscribeService']({'accessKeyId':_0x2c94ea,'secretAccessKey':_0x2719f2,'region':_0x2d64f7});_0x515f06[_0x77b3('0x5')]({'TranscriptionJobName':_0x579ea7},function(_0x5b3fb4,_0x35becb){if(_0x5b3fb4){return _0x32345c(_0x5b3fb4);}else{return _0x3acdea(_0x35becb);}});});}function sentiment(_0x37fafb,_0x4b3a98,_0x46dc45,_0x31b2ac,_0x24f2a1){return new Promise(function(_0x27bfa6,_0x203a71){var _0x29c263=new AWS[(_0x77b3('0x6'))]({'accessKeyId':_0x4b3a98,'secretAccessKey':_0x37fafb,'region':_0x46dc45});_0x29c263[_0x77b3('0x7')]({'Text':_0x31b2ac,'LanguageCode':_0x24f2a1[_0x77b3('0x8')](0x0,0x2)},function(_0x3e100c,_0x58f30a){if(_0x3e100c){return _0x203a71(_0x3e100c);}else{return _0x27bfa6(_0x58f30a);}});});}function checkTranscribeJob(_0x13bc8e,_0x48adca,_0x804b7){var _0x16692f;return new BPromise(function(_0x3ee308,_0x363de1){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0xb'),_0x13bc8e['id'],_0x13bc8e[_0x77b3('0xc')]));return getTranscriptionJob(_0x804b7[_0x77b3('0xd')],_0x804b7[_0x77b3('0xe')],_0x48adca['transcribeRegion'],_0x13bc8e[_0x77b3('0xc')])[_0x77b3('0xf')](function(_0x1c995c){logger[_0x77b3('0x9')](util['format'](_0x77b3('0x10'),_0x13bc8e['id'],_0x13bc8e['transcribeName'],_0x1c995c['TranscriptionJob'][_0x77b3('0x11')]));if(!_0x13bc8e[_0x77b3('0x12')]){switch(_0x1c995c[_0x77b3('0x13')][_0x77b3('0x11')]){case'COMPLETED':var _0x26f445={'transcribeStatus':_0x1c995c['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x1c995c[_0x77b3('0x13')][_0x77b3('0x14')][_0x77b3('0x15')]};logger['info'](util[_0x77b3('0xa')](_0x77b3('0x16'),_0x13bc8e['id']));return rp({'uri':_0x1c995c[_0x77b3('0x13')][_0x77b3('0x14')][_0x77b3('0x15')],'json':!![]})[_0x77b3('0xf')](function(_0x174058){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x17'),_0x13bc8e['id']));if(_0x174058&&_0x174058['results']&&_0x174058[_0x77b3('0x18')]['transcripts']&&_0x174058[_0x77b3('0x18')]['transcripts'][_0x77b3('0x19')]){_0x26f445[_0x77b3('0x12')]='';for(var _0x37de70=0x0;_0x37de70<_0x174058[_0x77b3('0x18')][_0x77b3('0x1a')]['length'];_0x37de70++){_0x26f445['fileText']+=_0x174058[_0x77b3('0x18')][_0x77b3('0x1a')][_0x37de70][_0x77b3('0x1b')]+'';}}return _0x13bc8e['update'](_0x26f445);})[_0x77b3('0xf')](function(){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x1c'),_0x13bc8e['id']));if(!_0x13bc8e[_0x77b3('0x1d')]){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x1f'));}if(!_0x48adca[_0x77b3('0x20')]||!_0x48adca['sentimentAccountId']||!_0x48adca['sentimentRegion']||!_0x48adca[_0x77b3('0x21')]||!_0x48adca[_0x77b3('0x22')]){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x24'));}if(!_0x26f445[_0x77b3('0x12')]){throw new Error(_0x77b3('0x25'));}if(_0x48adca[_0x77b3('0x26')]===_0x804b7['id']){return _0x804b7;}else{return db[_0x77b3('0x27')][_0x77b3('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x17b4ec){if(!_0x17b4ec){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x29'));}if(!_0x17b4ec[_0x77b3('0xd')]||!_0x17b4ec[_0x77b3('0xe')]){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x2a'));}_0x16692f=_0x17b4ec;logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x2b'),_0x13bc8e['id']));return sentiment(_0x16692f[_0x77b3('0xd')],_0x16692f[_0x77b3('0xe')],_0x48adca[_0x77b3('0x2c')],_0x26f445['fileText'],_0x48adca['language']);})[_0x77b3('0xf')](function(_0x5ed77f){logger['info'](util['format'](_0x77b3('0x2d'),_0x13bc8e['id']));return _0x13bc8e[_0x77b3('0x2e')]({'sentiment':_0x5ed77f[_0x77b3('0x2f')],'sPositive':_0x5ed77f[_0x77b3('0x30')]['Positive'],'sNegative':_0x5ed77f[_0x77b3('0x30')][_0x77b3('0x31')],'sMixed':_0x5ed77f[_0x77b3('0x30')][_0x77b3('0x32')],'sNeutral':_0x5ed77f['SentimentScore'][_0x77b3('0x33')]});})[_0x77b3('0xf')](function(){logger['info'](util['format'](_0x77b3('0x1c'),_0x13bc8e['id']));_0x3ee308();});case _0x77b3('0x34'):return _0x13bc8e['update']({'transcribeStatus':_0x77b3('0x34'),'failureReason':_0x1c995c['TranscriptionJob'][_0x77b3('0x35')]})[_0x77b3('0xf')](function(){logger[_0x77b3('0x9')](util['format'](_0x77b3('0x1c'),_0x13bc8e['id']));_0x3ee308();});default:logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x36'),_0x13bc8e['id']));break;}}else{return BPromise['resolve']()[_0x77b3('0xf')](function(){if(!_0x13bc8e[_0x77b3('0x1d')]){throw new db['Sequelize'][(_0x77b3('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x48adca[_0x77b3('0x20')]||!_0x48adca[_0x77b3('0x26')]||!_0x48adca[_0x77b3('0x2c')]||!_0x48adca[_0x77b3('0x21')]||!_0x48adca[_0x77b3('0x22')]){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x24'));}if(!_0x13bc8e[_0x77b3('0x12')]){throw new Error(_0x77b3('0x25'));}if(_0x48adca[_0x77b3('0x26')]===_0x804b7['id']){return _0x804b7;}else{return db[_0x77b3('0x27')][_0x77b3('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x77b3('0xf')](function(_0x10568f){if(!_0x10568f){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x29'));}if(!_0x10568f['data1']||!_0x10568f[_0x77b3('0xe')]){throw new db['Sequelize'][(_0x77b3('0x23'))](_0x77b3('0x2a'));}_0x16692f=_0x10568f;logger[_0x77b3('0x9')](util[_0x77b3('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x13bc8e['id']));return sentiment(_0x16692f[_0x77b3('0xd')],_0x16692f[_0x77b3('0xe')],_0x48adca[_0x77b3('0x2c')],_0x13bc8e[_0x77b3('0x12')],_0x48adca['language']);})[_0x77b3('0xf')](function(_0x5bba05){logger['info'](util[_0x77b3('0xa')](_0x77b3('0x2d'),_0x13bc8e['id']));return _0x13bc8e[_0x77b3('0x2e')]({'sentiment':_0x5bba05[_0x77b3('0x2f')],'sPositive':_0x5bba05[_0x77b3('0x30')][_0x77b3('0x37')],'sNegative':_0x5bba05[_0x77b3('0x30')][_0x77b3('0x31')],'sMixed':_0x5bba05['SentimentScore'][_0x77b3('0x32')],'sNeutral':_0x5bba05[_0x77b3('0x30')][_0x77b3('0x33')],'transcribeStatus':'COMPLETED'});})[_0x77b3('0xf')](function(){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x1c'),_0x13bc8e['id']));_0x3ee308();});}})[_0x77b3('0x38')](function(_0x2f373a){if(_0x2f373a){if(!_0x2f373a[_0x77b3('0x39')]||_0x2f373a[_0x77b3('0x39')]!==_0x77b3('0x3a')){logger[_0x77b3('0x3b')](util[_0x77b3('0xa')](_0x77b3('0x3c'),_0x13bc8e['id']),util[_0x77b3('0x3d')](_0x2f373a,{'showHidden':![],'depth':null}));}}_0x3ee308();});});}function checkTranscribe(){var _0xe26db1;var _0xc8b1bb;var _0x127a14;return db['VoiceRecording'][_0x77b3('0x3e')]({'where':{'transcribeStatus':_0x77b3('0x3f')}})[_0x77b3('0xf')](function(_0x45c38b){if(!_0x45c38b||!_0x45c38b[_0x77b3('0x19')]){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x40'));}_0xe26db1=_0x45c38b;return db['Setting'][_0x77b3('0x28')]({'where':{'id':0x1}});})[_0x77b3('0xf')](function(_0x1cdff7){if(!_0x1cdff7){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x41'));}_0xc8b1bb=_0x1cdff7;if(!_0xc8b1bb[_0x77b3('0x42')]||!_0xc8b1bb[_0x77b3('0x43')]||!_0xc8b1bb[_0x77b3('0x44')]||!_0xc8b1bb[_0x77b3('0x21')]||!_0xc8b1bb[_0x77b3('0x22')]){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x45'));}return db[_0x77b3('0x27')][_0x77b3('0x28')]({'where':{'id':_0xc8b1bb['transcribeAccountId']}});})['then'](function(_0x142aff){if(!_0x142aff){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x29'));}if(!_0x142aff[_0x77b3('0xd')]||!_0x142aff[_0x77b3('0xe')]){throw new db['Sequelize'][(_0x77b3('0x23'))](_0x77b3('0x2a'));}_0x127a14=_0x142aff;var _0x280eb7=[];_0xe26db1['forEach'](function(_0x106309){_0x280eb7[_0x77b3('0x46')](checkTranscribeJob(_0x106309,_0xc8b1bb,_0x127a14));});return BPromise[_0x77b3('0x47')](_0x280eb7);})[_0x77b3('0x38')](function(_0x3dd7b9){if(_0x3dd7b9){if(!_0x3dd7b9['name']||_0x3dd7b9[_0x77b3('0x39')]!==_0x77b3('0x3a')){logger[_0x77b3('0x3b')](util[_0x77b3('0x3d')](_0x3dd7b9,{'showHidden':![],'depth':null}));}}});}exports[_0x77b3('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 ea353d0..7851ed3 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 _0xf5bc=['map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','inspect','start','lodash','moment','../../mysqldb','schedule','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0xf5bc,0xb1));var _0xcf5b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf5bc[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xcf5b('0x0'));var moment=require(_0xcf5b('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require(_0xcf5b('0x2'))['db'];var logger=require('../logger')(_0xcf5b('0x3'));config[_0xcf5b('0x4')]=_['defaults'](config[_0xcf5b('0x4')],{'host':_0xcf5b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcf5b('0x4')]));function closeInteractions(){var _0x2ed858=[];return db[_0xcf5b('0x6')][_0xcf5b('0x7')]({'raw':!![],'attributes':['id',_0xcf5b('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xcf5b('0x9')](0x18,_0xcf5b('0xa'))}}})['then'](function(_0x3886a7){if(_0x3886a7&&_0x3886a7[_0xcf5b('0xb')]){_0x2ed858=_[_0xcf5b('0xc')](_0x3886a7||[],'id');logger['info'](_0xcf5b('0xd'),_0x2ed858[_0xcf5b('0xe')]());return db[_0xcf5b('0x6')][_0xcf5b('0xf')]({'closeReason':_0xcf5b('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xcf5b('0x11')](_0xcf5b('0x12'))},{'where':{'id':_0x2ed858}});}})[_0xcf5b('0x13')](function(){if(_0x2ed858&&_0x2ed858[_0xcf5b('0xb')]){logger[_0xcf5b('0x14')](_0xcf5b('0x15'),_0x2ed858['join']());for(var _0x2a406f=0x0;_0x2a406f<_0x2ed858['length'];_0x2a406f++){io[_0xcf5b('0x16')](_0xcf5b('0x17'),{'id':_0x2ed858[_0x2a406f],'closed':!![]});}}})['catch'](function(_0x23385a){logger[_0xcf5b('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x23385a?util[_0xcf5b('0x19')](_0x23385a,{'showHidden':![],'depth':null}):'');});}exports[_0xcf5b('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x866e=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map'];(function(_0xf9f831,_0x53f4e2){var _0xd0cac7=function(_0x5d1686){while(--_0x5d1686){_0xf9f831['push'](_0xf9f831['shift']());}};_0xd0cac7(++_0x53f4e2);}(_0x866e,0xaf));var _0xe866=function(_0x47fc64,_0x1b4bfd){_0x47fc64=_0x47fc64-0x0;var _0x43390e=_0x866e[_0x47fc64];return _0x43390e;};'use strict';var _=require(_0xe866('0x0'));var moment=require(_0xe866('0x1'));var Redis=require(_0xe866('0x2'));var util=require(_0xe866('0x3'));var config=require(_0xe866('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xe866('0x5'));config[_0xe866('0x6')]=_[_0xe866('0x7')](config['redis'],{'host':_0xe866('0x8'),'port':0x18eb});var io=require(_0xe866('0x9'))(new Redis(config[_0xe866('0x6')]));function closeInteractions(){var _0x586fe7=[];return db[_0xe866('0xa')][_0xe866('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe866('0xc')](0x18,_0xe866('0xd'))}}})[_0xe866('0xe')](function(_0x138395){if(_0x138395&&_0x138395[_0xe866('0xf')]){_0x586fe7=_[_0xe866('0x10')](_0x138395||[],'id');logger[_0xe866('0x11')](_0xe866('0x12'),_0x586fe7['join']());return db[_0xe866('0xa')][_0xe866('0x13')]({'closeReason':_0xe866('0x14'),'disposition':_0xe866('0x15'),'closed':!![],'closedAt':moment()[_0xe866('0x16')](_0xe866('0x17'))},{'where':{'id':_0x586fe7}});}})[_0xe866('0xe')](function(){if(_0x586fe7&&_0x586fe7[_0xe866('0xf')]){logger[_0xe866('0x11')](_0xe866('0x18'),_0x586fe7[_0xe866('0x19')]());for(var _0x52451b=0x0;_0x52451b<_0x586fe7['length'];_0x52451b++){io[_0xe866('0x1a')](_0xe866('0x1b'),{'id':_0x586fe7[_0x52451b],'closed':!![]});}}})['catch'](function(_0x4f9994){logger[_0xe866('0x1c')](_0xe866('0x1d'),_0x4f9994?util[_0xe866('0x1e')](_0x4f9994,{'showHidden':![],'depth':null}):'');});}exports[_0xe866('0x1f')]=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 9f48abd..502fe41 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02aa=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','now','innocenzo.biondo','CmContact','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02aa,0xdb));var _0xa02a=function(_0x5bf493,_0x3c46bf){_0x5bf493=_0x5bf493-0x0;var _0x5e69b1=_0x02aa[_0x5bf493];return _0x5e69b1;};'use strict';var util=require(_0xa02a('0x0'));var db=require(_0xa02a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa02a('0x2')]({'id':i,'firstName':_0xa02a('0x3')+i,'lastName':_0xa02a('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa02a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xa02a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa02a('0x5')](),'updatedAt':Date[_0xa02a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xa02a('0x3')+i,'lastName':_0xa02a('0x4')+i,'phone':0xf879fb460+i,'email':_0xa02a('0x6')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa02a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa02a('0x5')](),'updatedAt':Date[_0xa02a('0x5')]()});}db[_0xa02a('0x7')][_0xa02a('0x8')]({'where':{}})[_0xa02a('0x9')](function(){return db[_0xa02a('0x7')][_0xa02a('0xa')](contacts);})[_0xa02a('0x9')](function(){console[_0xa02a('0xb')](_0xa02a('0xc'),_0xa02a('0xd'));return db[_0xa02a('0xe')][_0xa02a('0x8')]({'where':{}});})['then'](function(){return db[_0xa02a('0xe')][_0xa02a('0xa')](hopper);})[_0xa02a('0x9')](function(){console[_0xa02a('0xb')](_0xa02a('0xc'),_0xa02a('0xf'));return db[_0xa02a('0x7')]['bulkCreate'](contacts2);})[_0xa02a('0x9')](function(){console[_0xa02a('0xb')](_0xa02a('0xc'),_0xa02a('0x10'));return db[_0xa02a('0xe')]['bulkCreate'](hopper2);})[_0xa02a('0x9')](function(){console[_0xa02a('0xb')]('finished\x20populating',_0xa02a('0x11'));})[_0xa02a('0x12')](function(_0x4ef678){console['log'](_0x4ef678);}); \ No newline at end of file +var _0xf6bf=['CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','hopper1','log','hopper2','util','push','Innocenzo','innocenzo.biondo','@xcally.com','now'];(function(_0x1e7374,_0x5392ad){var _0x2a299d=function(_0x57d05e){while(--_0x57d05e){_0x1e7374['push'](_0x1e7374['shift']());}};_0x2a299d(++_0x5392ad);}(_0xf6bf,0x13a));var _0xff6b=function(_0x7054ec,_0x62f54e){_0x7054ec=_0x7054ec-0x0;var _0x5b543e=_0xf6bf[_0x7054ec];return _0x5b543e;};'use strict';var util=require(_0xff6b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xff6b('0x1')]({'id':i,'firstName':_0xff6b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xff6b('0x3')+i+_0xff6b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xff6b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xff6b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xff6b('0x5')](),'updatedAt':Date[_0xff6b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xff6b('0x1')]({'id':i,'firstName':_0xff6b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xff6b('0x3')+i+_0xff6b('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xff6b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xff6b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xff6b('0x5')](),'updatedAt':Date[_0xff6b('0x5')]()});}db[_0xff6b('0x6')][_0xff6b('0x7')]({'where':{}})[_0xff6b('0x8')](function(){return db['CmContact'][_0xff6b('0x9')](contacts);})[_0xff6b('0x8')](function(){console['log'](_0xff6b('0xa'),_0xff6b('0xb'));return db[_0xff6b('0xc')][_0xff6b('0x7')]({'where':{}});})['then'](function(){return db[_0xff6b('0xc')][_0xff6b('0x9')](hopper);})[_0xff6b('0x8')](function(){console['log'](_0xff6b('0xa'),_0xff6b('0xd'));return db['CmContact']['bulkCreate'](contacts2);})[_0xff6b('0x8')](function(){console[_0xff6b('0xe')](_0xff6b('0xa'),'contacts2');return db[_0xff6b('0xc')]['bulkCreate'](hopper2);})[_0xff6b('0x8')](function(){console['log'](_0xff6b('0xa'),_0xff6b('0xf'));})['catch'](function(_0x2deb6a){console[_0xff6b('0xe')](_0x2deb6a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 68136fb..603552d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcda1=['log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then'];(function(_0x49df93,_0x2bb7ac){var _0x471bac=function(_0x3dbdc5){while(--_0x3dbdc5){_0x49df93['push'](_0x49df93['shift']());}};_0x471bac(++_0x2bb7ac);}(_0xcda1,0x1bc));var _0x1cda=function(_0xf321e7,_0x1396d1){_0xf321e7=_0xf321e7-0x0;var _0x1f69b3=_0xcda1[_0xf321e7];return _0x1f69b3;};'use strict';var util=require(_0x1cda('0x0'));var db=require(_0x1cda('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1cda('0x2')](_0x1cda('0x3'),_0x1cda('0x4'),i),'fullname':util[_0x1cda('0x2')](_0x1cda('0x3'),'agent',i),'email':util['format'](_0x1cda('0x5'),_0x1cda('0x4'),i),'role':_0x1cda('0x4'),'password':_0x1cda('0x6'),'internal':0xfa0+i,'type':_0x1cda('0x7'),'transport':[_0x1cda('0x8'),'ws',_0x1cda('0x9')],'disallow':[_0x1cda('0xa')],'allow':[_0x1cda('0xb')],'defaultuser':util[_0x1cda('0x2')](_0x1cda('0x3'),_0x1cda('0x4'),i),'encryption':_0x1cda('0xc'),'avpf':'yes','force_avp':'yes','icesupport':_0x1cda('0xc'),'dtlsenable':_0x1cda('0xc'),'dtlsverify':'no','dtlscertfile':_0x1cda('0xd'),'dtlsprivatekey':_0x1cda('0xe'),'dtlssetup':_0x1cda('0xf'),'callerid':util['format'](_0x1cda('0x10'),util[_0x1cda('0x2')](_0x1cda('0x3'),_0x1cda('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x1cda('0x11')](function(){console[_0x1cda('0x12')](_0x1cda('0x13'));})[_0x1cda('0x14')](function(_0x51ed32){console[_0x1cda('0x12')](_0x51ed32);}); \ No newline at end of file +var _0x82d4=['bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x82d4,0x8a));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var db=require(_0x482d('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x482d('0x1')]({'name':util[_0x482d('0x2')](_0x482d('0x3'),'agent',i),'fullname':util[_0x482d('0x2')](_0x482d('0x3'),_0x482d('0x4'),i),'email':util['format'](_0x482d('0x5'),_0x482d('0x4'),i),'role':_0x482d('0x4'),'password':_0x482d('0x6'),'internal':0xfa0+i,'type':_0x482d('0x7'),'transport':[_0x482d('0x8'),'ws','wss'],'disallow':[_0x482d('0x9')],'allow':[_0x482d('0xa')],'defaultuser':util[_0x482d('0x2')](_0x482d('0x3'),_0x482d('0x4'),i),'encryption':_0x482d('0xb'),'avpf':_0x482d('0xb'),'force_avp':_0x482d('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x482d('0xc'),'callerid':util[_0x482d('0x2')](_0x482d('0xd'),util['format'](_0x482d('0x3'),_0x482d('0x4'),i),0xfa0+i)});}db['User'][_0x482d('0xe')](users)[_0x482d('0xf')](function(){console[_0x482d('0x10')](_0x482d('0x11'));})[_0x482d('0x12')](function(_0x32419c){console['log'](_0x32419c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 22fc95e..3511503 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1c5=['VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','ChatQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','address','request','connection','remoteAddress','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','role','agent','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','type','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push'];(function(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0xa1c5,0x96));var _0x5a1c=function(_0x1335da,_0x2b0be6){_0x1335da=_0x1335da-0x0;var _0x334e4f=_0xa1c5[_0x1335da];return _0x334e4f;};'use strict';var _=require(_0x5a1c('0x0'));var util=require(_0x5a1c('0x1'));var BPromise=require(_0x5a1c('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x5a1c('0x3')],'include':[{'as':_0x5a1c('0x4'),'model':db[_0x5a1c('0x5')],'attributes':['id','name',_0x5a1c('0x6')],'raw':!![],'where':{'role':_0x5a1c('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5a1c('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x5a1c('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x5a1c('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5a1c('0x3'),'type'],'where':{'type':_0x5a1c('0x8')}};function getAssociatedResources(_0x106524,_0x192f9f,_0x2214b7){return db[_0x5a1c('0x9')]['findOne']({'where':{'name':_0x106524,'userProfileId':_0x192f9f},'raw':!![]})[_0x5a1c('0xa')](function(_0x4a255c){if(_0x4a255c){if(_0x4a255c[_0x5a1c('0xb')]){switch(_0x106524){case _0x5a1c('0xc'):case'ChatQueues':case _0x5a1c('0xd'):case _0x5a1c('0xe'):case'MailQueues':case _0x5a1c('0xf'):case _0x5a1c('0x10'):return db[_0x2214b7]['findAll'](queryQueues);case _0x5a1c('0x11'):return db[_0x2214b7][_0x5a1c('0x12')](queryTelephones);case'Trunks':return db[_0x2214b7]['findAll'](queryTrunks);case _0x5a1c('0x13'):return db[_0x2214b7]['findAll'](queryCampaigns);}}else{return db[_0x5a1c('0x14')][_0x5a1c('0x12')]({'attributes':[_0x5a1c('0x15')],'where':{'sectionId':_0x4a255c['id']},'raw':!![]})['then'](function(_0x5af07e){if(_0x5af07e){var _0x4404e7={'where':{'id':_[_0x5a1c('0x16')](_0x5af07e,_0x5a1c('0x15'))},'raw':!![]};switch(_0x2214b7){case _0x5a1c('0x5'):_0x4404e7[_0x5a1c('0x17')]['role']=_0x5a1c('0x18');break;case _0x5a1c('0x19'):_0x4404e7[_0x5a1c('0x17')][_0x5a1c('0x1a')]=_0x5a1c('0x8');break;}return db[_0x2214b7]['findAll'](_0x4404e7);}else{return[];}});}}else{return[];}})[_0x5a1c('0xa')](function(_0x3e2a9f){return _0x3e2a9f;});}function joinOrLeaveQueues(_0x2ec45c,_0x246e69,_0x493073,_0xfeb722){_0x2ec45c[_0x246e69](util[_0x5a1c('0x1b')](_0x5a1c('0x1c'),_0x493073,_0xfeb722[_0x5a1c('0x3')]));if(_0xfeb722['Agents']){for(var _0x29eb79=0x0;_0x29eb79<_0xfeb722[_0x5a1c('0x4')][_0x5a1c('0x1d')];_0x29eb79+=0x1){_0x2ec45c[_0x246e69](util[_0x5a1c('0x1b')](_0x5a1c('0x1e'),_0xfeb722['Agents'][_0x29eb79][_0x5a1c('0x3')]));}}}function joinOrLeave(_0x2cafb4,_0x40d43e,_0x45311d){var _0x10eb4b;if(_0x2cafb4[_0x5a1c('0x1f')][_0x5a1c('0x20')]['id']){db[_0x5a1c('0x5')][_0x5a1c('0x21')]({'attributes':['id','name',_0x5a1c('0x6'),_0x5a1c('0x22')],'where':{'id':_0x2cafb4[_0x5a1c('0x1f')][_0x5a1c('0x20')]['id']},'include':[{'model':db[_0x5a1c('0x23')],'as':_0x5a1c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x5a1c('0x25')],'as':_0x5a1c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x5a1c('0x27')],'as':_0x5a1c('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x5a1c('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x5a1c('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x5a1c('0x2b')],'as':_0x5a1c('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1f31dd){if(_0x1f31dd){_0x10eb4b=_0x1f31dd;_0x2cafb4[_0x40d43e](util[_0x5a1c('0x1b')](_0x5a1c('0x1e'),_0x1f31dd['name']));var _0x4d5a0a=[];switch(_0x1f31dd[_0x5a1c('0x6')]){case _0x5a1c('0x2d'):_0x2cafb4[_0x40d43e]('voice:inbound');_0x2cafb4[_0x40d43e](_0x5a1c('0x2e'));if(queryQueues[_0x5a1c('0x2f')](_0x5a1c('0x30'))){delete queryQueues[_0x5a1c('0x30')];}_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x32')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x33')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x34')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x35')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x36')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a['push'](db[_0x5a1c('0x37')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x38')][_0x5a1c('0x12')](queryQueues));_0x4d5a0a[_0x5a1c('0x31')](db['User'][_0x5a1c('0x12')](queryTelephones));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x39')][_0x5a1c('0x12')](queryTrunks));_0x4d5a0a['push'](db['Campaign']['findAll'](queryCampaigns));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x5')][_0x5a1c('0x12')](queryAgents));break;case'user':_0x2cafb4[_0x40d43e](_0x5a1c('0x3a'));_0x2cafb4[_0x40d43e](_0x5a1c('0x2e'));_0x4d5a0a['push'](getAssociatedResources(_0x5a1c('0xc'),_0x1f31dd[_0x5a1c('0x22')],'VoiceQueue'));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources(_0x5a1c('0x3b'),_0x1f31dd['userProfileId'],_0x5a1c('0x33')));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources('FaxQueues',_0x1f31dd[_0x5a1c('0x22')],_0x5a1c('0x34')));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources(_0x5a1c('0xe'),_0x1f31dd[_0x5a1c('0x22')],_0x5a1c('0x35')));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources('MailQueues',_0x1f31dd['userProfileId'],'MailQueue'));_0x4d5a0a['push'](getAssociatedResources('OpenchannelQueues',_0x1f31dd[_0x5a1c('0x22')],'OpenchannelQueue'));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources(_0x5a1c('0x10'),_0x1f31dd[_0x5a1c('0x22')],_0x5a1c('0x38')));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources(_0x5a1c('0x11'),_0x1f31dd['userProfileId'],_0x5a1c('0x5')));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources(_0x5a1c('0x3c'),_0x1f31dd[_0x5a1c('0x22')],_0x5a1c('0x39')));_0x4d5a0a[_0x5a1c('0x31')](getAssociatedResources(_0x5a1c('0x13'),_0x1f31dd[_0x5a1c('0x22')],'Campaign'));_0x4d5a0a[_0x5a1c('0x31')](db[_0x5a1c('0x5')]['findAll'](queryAgents));break;case _0x5a1c('0x7'):_0x2cafb4[_0x40d43e]('voice:inbound');_0x2cafb4[_0x40d43e](_0x5a1c('0x2e'));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd[_0x5a1c('0x3d')]({'attributes':['id',_0x5a1c('0x3')]}));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd[_0x5a1c('0x3e')]({'attributes':['id',_0x5a1c('0x3')]}));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd[_0x5a1c('0x3f')]({'attributes':['id',_0x5a1c('0x3')]}));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd[_0x5a1c('0x40')]({'attributes':['id',_0x5a1c('0x3')]}));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd[_0x5a1c('0x41')]({'attributes':['id',_0x5a1c('0x3')]}));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd[_0x5a1c('0x42')]({'attributes':['id',_0x5a1c('0x3')]}));_0x4d5a0a[_0x5a1c('0x31')](_0x1f31dd['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x5a1c('0x43')](_0x4d5a0a);}})[_0x5a1c('0xa')](function(_0x5e12a6){if(_0x5e12a6&&_0x5e12a6['length']){for(var _0x5895fb=0x0;_0x5895fb<_0x5e12a6[_0x5a1c('0x1d')];_0x5895fb+=0x1){for(var _0x5911a0=0x0;_0x5911a0<_0x5e12a6[_0x5895fb][_0x5a1c('0x1d')];_0x5911a0+=0x1){switch(_0x5895fb){case 0x0:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,_0x5a1c('0x44'),_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x1:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,'chat',_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x2:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,_0x5a1c('0x45'),_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x3:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,_0x5a1c('0x46'),_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x4:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,_0x5a1c('0x47'),_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x5:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,_0x5a1c('0x48'),_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x6:joinOrLeaveQueues(_0x2cafb4,_0x40d43e,_0x5a1c('0x49'),_0x5e12a6[_0x5895fb][_0x5911a0]);break;case 0x7:if(_0x10eb4b['role']!=='agent')_0x2cafb4[_0x40d43e](util[_0x5a1c('0x1b')](_0x5a1c('0x4a'),_0x5e12a6[_0x5895fb][_0x5911a0][_0x5a1c('0x3')]));break;case 0x8:if(_0x10eb4b[_0x5a1c('0x6')]!==_0x5a1c('0x7'))_0x2cafb4[_0x40d43e](util[_0x5a1c('0x1b')](_0x5a1c('0x4b'),_0x5e12a6[_0x5895fb][_0x5911a0][_0x5a1c('0x3')]));break;case 0x9:if(_0x10eb4b[_0x5a1c('0x6')]!=='agent')_0x2cafb4[_0x40d43e](util[_0x5a1c('0x1b')](_0x5a1c('0x4c'),_0x5e12a6[_0x5895fb][_0x5911a0][_0x5a1c('0x1a')],_0x5e12a6[_0x5895fb][_0x5911a0][_0x5a1c('0x3')]));break;case 0xa:_0x2cafb4[_0x40d43e](util[_0x5a1c('0x1b')](_0x5a1c('0x1e'),_0x5e12a6[_0x5895fb][_0x5911a0][_0x5a1c('0x3')]));break;}}}}})['then'](function(){if(_0x40d43e===_0x5a1c('0x4d')){var _0x125c05=_['map'](_0x10eb4b[_0x5a1c('0x24')],'id');return _0x10eb4b[_0x5a1c('0x4e')](_0x125c05)[_0x5a1c('0xa')](function(){for(var _0x49094c=0x0;_0x49094c<_0x125c05[_0x5a1c('0x1d')];_0x49094c+=0x1){_0x45311d[_0x5a1c('0x4f')](_0x5a1c('0x50'),{'ChatInteractionId':Number(_0x125c05[_0x49094c]),'UserId':Number(_0x10eb4b['id'])});}});}})['then'](function(){if(_0x40d43e===_0x5a1c('0x4d')){var _0x19155a=_[_0x5a1c('0x16')](_0x10eb4b['MailInteractions'],'id');return _0x10eb4b[_0x5a1c('0x51')](_0x19155a)[_0x5a1c('0xa')](function(){for(var _0x58bc4e=0x0;_0x58bc4e<_0x19155a[_0x5a1c('0x1d')];_0x58bc4e+=0x1){_0x45311d[_0x5a1c('0x4f')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x19155a[_0x58bc4e]),'UserId':Number(_0x10eb4b['id'])});}});}})['then'](function(){if(_0x40d43e===_0x5a1c('0x4d')){var _0x533330=_[_0x5a1c('0x16')](_0x10eb4b['FaxInteractions'],'id');return _0x10eb4b[_0x5a1c('0x52')](_0x533330)[_0x5a1c('0xa')](function(){for(var _0x2215d2=0x0;_0x2215d2<_0x533330[_0x5a1c('0x1d')];_0x2215d2+=0x1){_0x45311d[_0x5a1c('0x4f')](_0x5a1c('0x53'),{'FaxInteractionId':Number(_0x533330[_0x2215d2]),'UserId':Number(_0x10eb4b['id'])});}});}})[_0x5a1c('0xa')](function(){if(_0x40d43e===_0x5a1c('0x4d')){var _0x3c0a93=_['map'](_0x10eb4b['SmsInteractions'],'id');return _0x10eb4b['removeSmsInteractions'](_0x3c0a93)[_0x5a1c('0xa')](function(){for(var _0x198e4e=0x0;_0x198e4e<_0x3c0a93['length'];_0x198e4e+=0x1){_0x45311d[_0x5a1c('0x4f')](_0x5a1c('0x54'),{'SmsInteractionId':Number(_0x3c0a93[_0x198e4e]),'UserId':Number(_0x10eb4b['id'])});}});}})[_0x5a1c('0xa')](function(){if(_0x40d43e==='leave'){var _0x58e474=_[_0x5a1c('0x16')](_0x10eb4b[_0x5a1c('0x2a')],'id');return _0x10eb4b['removeOpenchannelInteractions'](_0x58e474)[_0x5a1c('0xa')](function(){for(var _0x3a1911=0x0;_0x3a1911<_0x58e474['length'];_0x3a1911+=0x1){_0x45311d[_0x5a1c('0x4f')](_0x5a1c('0x55'),{'OpenchannelInteractionId':Number(_0x58e474[_0x3a1911]),'UserId':Number(_0x10eb4b['id'])});}});}})['then'](function(){if(_0x40d43e==='leave'){var _0x5ced8b=_[_0x5a1c('0x16')](_0x10eb4b[_0x5a1c('0x2c')],'id');return _0x10eb4b[_0x5a1c('0x56')](_0x5ced8b)[_0x5a1c('0xa')](function(){for(var _0x407e09=0x0;_0x407e09<_0x5ced8b[_0x5a1c('0x1d')];_0x407e09+=0x1){_0x45311d['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x5ced8b[_0x407e09]),'UserId':Number(_0x10eb4b['id'])});}});}})[_0x5a1c('0x57')](function(_0x4cdc62){_0x2cafb4['log'](_0x4cdc62);});}}function onDisconnect(_0x32597a,_0x1eea51){joinOrLeave(_0x32597a,'leave',_0x1eea51);}function onConnect(_0x597051){joinOrLeave(_0x597051,_0x5a1c('0x58'));}exports[_0x5a1c('0x59')]=function(_0x534513){_0x534513['on']('connection',function(_0xac404f){_0xac404f['setMaxListeners'](0x0);_0xac404f[_0x5a1c('0x5a')]=_0xac404f[_0x5a1c('0x5b')][_0x5a1c('0x5c')][_0x5a1c('0x5d')]+':'+_0xac404f[_0x5a1c('0x5b')][_0x5a1c('0x5c')]['remotePort'];_0xac404f['connectedAt']=new Date();_0xac404f[_0x5a1c('0x5e')]=function(_0x5be5aa){console[_0x5a1c('0x5e')](_0x5a1c('0x5f')+_0xac404f[_0x5a1c('0x60')][_0x5a1c('0x3')]+'['+_0xac404f[_0x5a1c('0x5a')]+']',_0x5be5aa);};_0xac404f['on'](_0x5a1c('0x61'),function(){onDisconnect(_0xac404f,_0x534513);_0xac404f[_0x5a1c('0x5e')](_0x5a1c('0x62'));});onConnect(_0xac404f);_0xac404f['log'](_0x5a1c('0x63'));});}; \ No newline at end of file +var _0x4cad=['ChatQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Trunk','VoiceQueue','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','leave','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request','connectedAt','log','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','type','ivr','UserProfileSection','then','VoiceQueues'];(function(_0x38bb32,_0x1fcb7d){var _0x461b6f=function(_0x49474c){while(--_0x49474c){_0x38bb32['push'](_0x38bb32['shift']());}};_0x461b6f(++_0x1fcb7d);}(_0x4cad,0x179));var _0xd4ca=function(_0x2d7bad,_0x3b5199){_0x2d7bad=_0x2d7bad-0x0;var _0xc3cab2=_0x4cad[_0x2d7bad];return _0xc3cab2;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var BPromise=require(_0xd4ca('0x2'));var db=require(_0xd4ca('0x3'))['db'];var config=require(_0xd4ca('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xd4ca('0x5'),'model':db[_0xd4ca('0x6')],'attributes':['id',_0xd4ca('0x7'),_0xd4ca('0x8')],'raw':!![],'where':{'role':_0xd4ca('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd4ca('0x7')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd4ca('0xa')],'where':{'type':_0xd4ca('0xb')}};function getAssociatedResources(_0x46c3bf,_0x310286,_0x2420e8){return db[_0xd4ca('0xc')]['findOne']({'where':{'name':_0x46c3bf,'userProfileId':_0x310286},'raw':!![]})[_0xd4ca('0xd')](function(_0x382bb4){if(_0x382bb4){if(_0x382bb4['autoAssociation']){switch(_0x46c3bf){case _0xd4ca('0xe'):case _0xd4ca('0xf'):case'FaxQueues':case _0xd4ca('0x10'):case'MailQueues':case _0xd4ca('0x11'):case'WhatsappQueues':return db[_0x2420e8][_0xd4ca('0x12')](queryQueues);case _0xd4ca('0x13'):return db[_0x2420e8][_0xd4ca('0x12')](queryTelephones);case _0xd4ca('0x14'):return db[_0x2420e8]['findAll'](queryTrunks);case _0xd4ca('0x15'):return db[_0x2420e8][_0xd4ca('0x12')](queryCampaigns);}}else{return db[_0xd4ca('0x16')][_0xd4ca('0x12')]({'attributes':[_0xd4ca('0x17')],'where':{'sectionId':_0x382bb4['id']},'raw':!![]})[_0xd4ca('0xd')](function(_0x43cd03){if(_0x43cd03){var _0x12a302={'where':{'id':_[_0xd4ca('0x18')](_0x43cd03,'resourceId')},'raw':!![]};switch(_0x2420e8){case _0xd4ca('0x6'):_0x12a302[_0xd4ca('0x19')][_0xd4ca('0x8')]=_0xd4ca('0x1a');break;case _0xd4ca('0x1b'):_0x12a302[_0xd4ca('0x19')][_0xd4ca('0xa')]=_0xd4ca('0xb');break;}return db[_0x2420e8][_0xd4ca('0x12')](_0x12a302);}else{return[];}});}}else{return[];}})['then'](function(_0x1151bd){return _0x1151bd;});}function joinOrLeaveQueues(_0x17e59f,_0x44c043,_0x3661db,_0x12e211){_0x17e59f[_0x44c043](util['format'](_0xd4ca('0x1c'),_0x3661db,_0x12e211[_0xd4ca('0x7')]));if(_0x12e211[_0xd4ca('0x5')]){for(var _0xbd2d6f=0x0;_0xbd2d6f<_0x12e211[_0xd4ca('0x5')][_0xd4ca('0x1d')];_0xbd2d6f+=0x1){_0x17e59f[_0x44c043](util[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x12e211[_0xd4ca('0x5')][_0xbd2d6f][_0xd4ca('0x7')]));}}}function joinOrLeave(_0x2c705e,_0x46bfb3,_0x4300d1){var _0x4b7798;if(_0x2c705e[_0xd4ca('0x20')][_0xd4ca('0x21')]['id']){db[_0xd4ca('0x6')][_0xd4ca('0x22')]({'attributes':['id','name',_0xd4ca('0x8'),_0xd4ca('0x23')],'where':{'id':_0x2c705e[_0xd4ca('0x20')][_0xd4ca('0x21')]['id']},'include':[{'model':db[_0xd4ca('0x24')],'as':_0xd4ca('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x27')],'as':_0xd4ca('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x29')],'as':_0xd4ca('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xd4ca('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xd4ca('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xd4ca('0xd')](function(_0x2bff12){if(_0x2bff12){_0x4b7798=_0x2bff12;_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x2bff12[_0xd4ca('0x7')]));var _0x2f4483=[];switch(_0x2bff12[_0xd4ca('0x8')]){case'admin':_0x2c705e[_0x46bfb3](_0xd4ca('0x2d'));_0x2c705e[_0x46bfb3](_0xd4ca('0x2e'));if(queryQueues[_0xd4ca('0x2f')](_0xd4ca('0x30'))){delete queryQueues[_0xd4ca('0x30')];}_0x2f4483[_0xd4ca('0x31')](db['VoiceQueue']['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x32')]['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x33')]['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db['SmsQueue'][_0xd4ca('0x12')](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x34')]['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db['OpenchannelQueue']['findAll'](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x35')][_0xd4ca('0x12')](queryQueues));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x6')][_0xd4ca('0x12')](queryTelephones));_0x2f4483[_0xd4ca('0x31')](db[_0xd4ca('0x36')][_0xd4ca('0x12')](queryTrunks));_0x2f4483['push'](db[_0xd4ca('0x1b')][_0xd4ca('0x12')](queryCampaigns));_0x2f4483[_0xd4ca('0x31')](db['User'][_0xd4ca('0x12')](queryAgents));break;case'user':_0x2c705e[_0x46bfb3](_0xd4ca('0x2d'));_0x2c705e[_0x46bfb3](_0xd4ca('0x2e'));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0xe'),_0x2bff12['userProfileId'],_0xd4ca('0x37')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources('ChatQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x32')));_0x2f4483['push'](getAssociatedResources('FaxQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x33')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0x10'),_0x2bff12['userProfileId'],'SmsQueue'));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources('MailQueues',_0x2bff12['userProfileId'],_0xd4ca('0x34')));_0x2f4483['push'](getAssociatedResources('OpenchannelQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x38')));_0x2f4483['push'](getAssociatedResources('WhatsappQueues',_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x35')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0x13'),_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x6')));_0x2f4483['push'](getAssociatedResources(_0xd4ca('0x14'),_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x36')));_0x2f4483[_0xd4ca('0x31')](getAssociatedResources(_0xd4ca('0x15'),_0x2bff12[_0xd4ca('0x23')],_0xd4ca('0x1b')));_0x2f4483[_0xd4ca('0x31')](db['User'][_0xd4ca('0x12')](queryAgents));break;case _0xd4ca('0x9'):_0x2c705e[_0x46bfb3]('voice:inbound');_0x2c705e[_0x46bfb3](_0xd4ca('0x2e'));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x39')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3a')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483['push'](_0x2bff12[_0xd4ca('0x3b')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3c')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3d')]({'attributes':['id','name']}));_0x2f4483['push'](_0x2bff12[_0xd4ca('0x3e')]({'attributes':['id',_0xd4ca('0x7')]}));_0x2f4483[_0xd4ca('0x31')](_0x2bff12[_0xd4ca('0x3f')]({'attributes':['id','name']}));break;}return BPromise[_0xd4ca('0x40')](_0x2f4483);}})[_0xd4ca('0xd')](function(_0x59d8c6){if(_0x59d8c6&&_0x59d8c6[_0xd4ca('0x1d')]){for(var _0x1472c8=0x0;_0x1472c8<_0x59d8c6[_0xd4ca('0x1d')];_0x1472c8+=0x1){for(var _0x8e57c=0x0;_0x8e57c<_0x59d8c6[_0x1472c8][_0xd4ca('0x1d')];_0x8e57c+=0x1){switch(_0x1472c8){case 0x0:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x41'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x1:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x42'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x2:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x43'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x3:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x44'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x4:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x45'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x5:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,'openchannel',_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x6:joinOrLeaveQueues(_0x2c705e,_0x46bfb3,_0xd4ca('0x46'),_0x59d8c6[_0x1472c8][_0x8e57c]);break;case 0x7:if(_0x4b7798['role']!==_0xd4ca('0x9'))_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x47'),_0x59d8c6[_0x1472c8][_0x8e57c]['name']));break;case 0x8:if(_0x4b7798[_0xd4ca('0x8')]!==_0xd4ca('0x9'))_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x48'),_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0x7')]));break;case 0x9:if(_0x4b7798[_0xd4ca('0x8')]!=='agent')_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x49'),_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0xa')],_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0x7')]));break;case 0xa:_0x2c705e[_0x46bfb3](util[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x59d8c6[_0x1472c8][_0x8e57c][_0xd4ca('0x7')]));break;}}}}})['then'](function(){if(_0x46bfb3==='leave'){var _0x1592be=_[_0xd4ca('0x18')](_0x4b7798['ChatInteractions'],'id');return _0x4b7798[_0xd4ca('0x4a')](_0x1592be)[_0xd4ca('0xd')](function(){for(var _0x29c63a=0x0;_0x29c63a<_0x1592be['length'];_0x29c63a+=0x1){_0x4300d1['emit'](_0xd4ca('0x4b'),{'ChatInteractionId':Number(_0x1592be[_0x29c63a]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0xd')](function(){if(_0x46bfb3==='leave'){var _0x94cbc1=_['map'](_0x4b7798['MailInteractions'],'id');return _0x4b7798[_0xd4ca('0x4c')](_0x94cbc1)[_0xd4ca('0xd')](function(){for(var _0x5f22a2=0x0;_0x5f22a2<_0x94cbc1['length'];_0x5f22a2+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x4e'),{'MailInteractionId':Number(_0x94cbc1[_0x5f22a2]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0xd')](function(){if(_0x46bfb3==='leave'){var _0x20ed9b=_[_0xd4ca('0x18')](_0x4b7798[_0xd4ca('0x28')],'id');return _0x4b7798['removeFaxInteractions'](_0x20ed9b)[_0xd4ca('0xd')](function(){for(var _0x31d1a1=0x0;_0x31d1a1<_0x20ed9b['length'];_0x31d1a1+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x4f'),{'FaxInteractionId':Number(_0x20ed9b[_0x31d1a1]),'UserId':Number(_0x4b7798['id'])});}});}})['then'](function(){if(_0x46bfb3===_0xd4ca('0x50')){var _0x4cb261=_[_0xd4ca('0x18')](_0x4b7798['SmsInteractions'],'id');return _0x4b7798[_0xd4ca('0x51')](_0x4cb261)[_0xd4ca('0xd')](function(){for(var _0x193a5a=0x0;_0x193a5a<_0x4cb261[_0xd4ca('0x1d')];_0x193a5a+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x52'),{'SmsInteractionId':Number(_0x4cb261[_0x193a5a]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0xd')](function(){if(_0x46bfb3===_0xd4ca('0x50')){var _0x1629e5=_[_0xd4ca('0x18')](_0x4b7798['OpenchannelInteractions'],'id');return _0x4b7798[_0xd4ca('0x53')](_0x1629e5)[_0xd4ca('0xd')](function(){for(var _0x2dd1bd=0x0;_0x2dd1bd<_0x1629e5['length'];_0x2dd1bd+=0x1){_0x4300d1[_0xd4ca('0x4d')](_0xd4ca('0x54'),{'OpenchannelInteractionId':Number(_0x1629e5[_0x2dd1bd]),'UserId':Number(_0x4b7798['id'])});}});}})['then'](function(){if(_0x46bfb3===_0xd4ca('0x50')){var _0x2fc89f=_[_0xd4ca('0x18')](_0x4b7798[_0xd4ca('0x2c')],'id');return _0x4b7798[_0xd4ca('0x55')](_0x2fc89f)[_0xd4ca('0xd')](function(){for(var _0x17ca49=0x0;_0x17ca49<_0x2fc89f[_0xd4ca('0x1d')];_0x17ca49+=0x1){_0x4300d1[_0xd4ca('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2fc89f[_0x17ca49]),'UserId':Number(_0x4b7798['id'])});}});}})[_0xd4ca('0x56')](function(_0x3d320f){_0x2c705e['log'](_0x3d320f);});}}function onDisconnect(_0x3a4451,_0x5a54f5){joinOrLeave(_0x3a4451,_0xd4ca('0x50'),_0x5a54f5);}function onConnect(_0x3d2f9d){joinOrLeave(_0x3d2f9d,_0xd4ca('0x57'));}exports[_0xd4ca('0x58')]=function(_0x4b37ae){_0x4b37ae['on'](_0xd4ca('0x59'),function(_0xc0bd5a){_0xc0bd5a[_0xd4ca('0x5a')](0x0);_0xc0bd5a[_0xd4ca('0x5b')]=_0xc0bd5a[_0xd4ca('0x5c')][_0xd4ca('0x59')]['remoteAddress']+':'+_0xc0bd5a[_0xd4ca('0x5c')][_0xd4ca('0x59')]['remotePort'];_0xc0bd5a[_0xd4ca('0x5d')]=new Date();_0xc0bd5a[_0xd4ca('0x5e')]=function(_0x300c1e){console[_0xd4ca('0x5e')](_0xd4ca('0x5f')+_0xc0bd5a[_0xd4ca('0x60')]['name']+'['+_0xc0bd5a[_0xd4ca('0x5b')]+']',_0x300c1e);};_0xc0bd5a['on']('disconnect',function(){onDisconnect(_0xc0bd5a,_0x4b37ae);_0xc0bd5a[_0xd4ca('0x5e')]('DISCONNECTED');});onConnect(_0xc0bd5a);_0xc0bd5a[_0xd4ca('0x5e')](_0xd4ca('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ae4b273..8792633 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 _0x2b53=['triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','code','catch','error','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','contact','UserId','interface','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','motionChannel','format','changed','closed','substatus','QueryTypes','SELECT','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','../../mysqldb','jayson/promise','../logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2b53,0xdb));var _0x32b5=function(_0x25f1ad,_0x531ee6){_0x25f1ad=_0x25f1ad-0x0;var _0x1fae9c=_0x2b53[_0x25f1ad];return _0x1fae9c;};'use strict';var util=require('util');var db=require(_0x32b5('0x0'))['db'];var jayson=require(_0x32b5('0x1'));var logger=require(_0x32b5('0x2'))(_0x32b5('0x3'));var client=jayson[_0x32b5('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x32b5('0x5'),'model':_0x32b5('0x6'),'event':_0x32b5('0x7'),'condition':_0x32b5('0x8'),'callback':afterCreate},{'channel':_0x32b5('0x5'),'model':_0x32b5('0x6'),'event':_0x32b5('0x9'),'condition':_0x32b5('0xa'),'callback':afterUpdate},{'channel':_0x32b5('0x5'),'model':'ChatMessage','event':_0x32b5('0x7'),'condition':_0x32b5('0xb'),'callback':afterCreateMessage},{'channel':_0x32b5('0x5'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x32b5('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x32b5('0xc'),'model':_0x32b5('0xd'),'event':_0x32b5('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x32b5('0xc'),'model':_0x32b5('0xd'),'event':_0x32b5('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x32b5('0xc'),'model':_0x32b5('0xe'),'event':_0x32b5('0x7'),'condition':_0x32b5('0xb'),'callback':afterCreateMessage},{'channel':_0x32b5('0xf'),'model':'WhatsappInteraction','event':_0x32b5('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x32b5('0xf'),'model':_0x32b5('0x10'),'event':_0x32b5('0x9'),'condition':_0x32b5('0xa'),'callback':afterUpdate},{'channel':_0x32b5('0xf'),'model':_0x32b5('0x11'),'event':_0x32b5('0x7'),'condition':_0x32b5('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x32b5('0x12'),'event':_0x32b5('0x7'),'condition':_0x32b5('0x8'),'callback':afterCreate},{'channel':_0x32b5('0x13'),'model':_0x32b5('0x12'),'event':_0x32b5('0x9'),'condition':_0x32b5('0xa'),'callback':afterUpdate},{'channel':_0x32b5('0x13'),'model':_0x32b5('0x14'),'event':_0x32b5('0x7'),'condition':_0x32b5('0xb'),'callback':afterCreateMessage},{'channel':_0x32b5('0x15'),'model':'MailInteraction','event':'afterCreate','condition':_0x32b5('0x8'),'callback':afterCreate},{'channel':_0x32b5('0x15'),'model':_0x32b5('0x16'),'event':_0x32b5('0x9'),'condition':_0x32b5('0xa'),'callback':afterUpdate},{'channel':_0x32b5('0x15'),'model':_0x32b5('0x17'),'event':_0x32b5('0x7'),'condition':_0x32b5('0xb'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x32b5('0x18'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x32b5('0x18'),'event':_0x32b5('0x9'),'condition':_0x32b5('0xa'),'callback':afterUpdate},{'channel':_0x32b5('0x19'),'model':_0x32b5('0x1a'),'event':'afterCreate','condition':_0x32b5('0xb'),'callback':afterCreateMessage}];function request(_0x391e28){return client[_0x32b5('0x1b')](_0x32b5('0x1c'),_0x391e28)[_0x32b5('0x1d')](function(_0x3d66ed){logger[_0x32b5('0x1e')](_0x32b5('0x1f'),_0x32b5('0x1c'),_0x3d66ed);if(_0x3d66ed['error']){if(_0x3d66ed['error'][_0x32b5('0x20')]===0x1f4){logger['error'](_0x32b5('0x1f'),_0x32b5('0x1c'),_0x3d66ed['error']);}}})[_0x32b5('0x21')](function(_0x320950){logger[_0x32b5('0x22')]('Trigger,\x20%s','EventManager',_0x320950);});}function afterCreateMessage(_0x530e2d){return function(_0x4f260e){_0x4f260e=_0x4f260e['get']({'plain':!![]});_0x4f260e[_0x32b5('0x23')]=_0x530e2d;_0x4f260e['motionChannel']=_0x530e2d;_0x4f260e[_0x32b5('0x24')]=_0x4f260e[_0x32b5('0x25')];Promise[_0x32b5('0x26')]()[_0x32b5('0x1d')](function(){if(typeof _0x4f260e[_0x32b5('0x27')]===_0x32b5('0x28'))return null;var _0x24869d=_0x32b5('0x29')+_0x4f260e[_0x32b5('0x27')];return db[_0x32b5('0x2a')][_0x32b5('0x2b')](_0x24869d,{'type':db[_0x32b5('0x2c')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x32b5('0x1d')](function(_0x37aaed){if(_0x37aaed){_0x4f260e[_0x32b5('0x2d')]=_0x37aaed[0x0];}if(typeof _0x4f260e[_0x32b5('0x2e')]===_0x32b5('0x28'))return;return getAgent(_0x4f260e[_0x32b5('0x2e')]);})['then'](function(_0x3d3aad){if(_0x3d3aad){_0x4f260e[_0x32b5('0x2f')]=util['format'](_0x32b5('0x30'),_0x3d3aad[_0x32b5('0x31')]);_0x4f260e[_0x32b5('0x32')]=_0x3d3aad;_0x4f260e['channel']=_0x530e2d;return request({'event':_0x32b5('0x33'),'message':_0x4f260e});}else{return request({'event':_0x32b5('0x34'),'message':_0x4f260e});}})[_0x32b5('0x21')](function(_0x2fba8e){logger[_0x32b5('0x22')](_0x32b5('0x1f'),_0x32b5('0x35'),_0x2fba8e);});};}function afterCreateOfflineMessage(_0x1ce64b){return function(_0x411e2f){_0x411e2f=_0x411e2f[_0x32b5('0x36')]({'plain':!![]});_0x411e2f['channel']=_0x1ce64b;_0x411e2f['motionChannel']=_0x1ce64b;_0x411e2f[_0x32b5('0x24')]='offlineMessage';return request({'event':_0x411e2f[_0x32b5('0x24')],'message':_0x411e2f});};}function afterCreate(_0x1da0fe,_0xa87092){return function(_0x5ec776){_0x5ec776=_0x5ec776[_0x32b5('0x36')]({'plain':!![]});_0x5ec776[_0x32b5('0x23')]=_0x1da0fe;_0x5ec776[_0x32b5('0x37')]=_0x1da0fe;_0x5ec776[_0x32b5('0x24')]='opened';Promise[_0x32b5('0x26')]()[_0x32b5('0x1d')](function(){var _0xa8af88=_0x32b5('0x29')+_0x5ec776[_0x32b5('0x27')];return db['sequelize'][_0x32b5('0x2b')](_0xa8af88,{'type':db[_0x32b5('0x2c')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x32b5('0x1d')](function(_0x8651a5){if(_0x8651a5){_0x5ec776[_0x32b5('0x2d')]=_0x8651a5[0x0];}if(typeof _0x5ec776[_0x32b5('0x2e')]==='undefined')return;return getAgent(_0x5ec776['UserId']);})[_0x32b5('0x1d')](function(_0x5e4e04){if(_0x5e4e04){_0x5ec776[_0x32b5('0x2f')]=util[_0x32b5('0x38')](_0x32b5('0x30'),_0x5e4e04[_0x32b5('0x31')]);_0x5ec776[_0x32b5('0x32')]=_0x5e4e04;}return request({'event':_0xa87092,'message':_0x5ec776});})[_0x32b5('0x21')](function(_0x83872b){logger[_0x32b5('0x22')](_0x32b5('0x1f'),'AfterCreate',_0x83872b);});};}function afterUpdate(_0x216610){return function(_0x5368ae){var _0x4cd593=_0x5368ae[_0x32b5('0x39')]('closed')&&_0x5368ae[_0x32b5('0x3a')];var _0x338739=_0x5368ae[_0x32b5('0x39')]('substatus');if(_0x4cd593||_0x338739){var _0x488185=_0x4cd593?'closedinteraction':_0x32b5('0x3b');var _0x40f5ba=_0x5368ae[_0x32b5('0x36')]({'plain':!![]});_0x40f5ba[_0x32b5('0x23')]=_0x216610;_0x40f5ba[_0x32b5('0x37')]=_0x216610;_0x40f5ba['event']=_0x4cd593?'closed':_0x32b5('0x3b');var _0x42b1be=_0x32b5('0x29')+_0x40f5ba['ContactId'];return db[_0x32b5('0x2a')]['query'](_0x42b1be,{'type':db[_0x32b5('0x2c')][_0x32b5('0x3c')][_0x32b5('0x3d')],'raw':!![]})[_0x32b5('0x1d')](function(_0x53ba0f){if(_0x53ba0f){_0x40f5ba['contact']=_0x53ba0f[0x0];}if(typeof _0x40f5ba[_0x32b5('0x2e')]===_0x32b5('0x28'))return;return getAgent(_0x40f5ba['UserId']);})['then'](function(_0x55e347){if(_0x55e347){_0x40f5ba[_0x32b5('0x2f')]=util[_0x32b5('0x38')](_0x32b5('0x30'),_0x55e347[_0x32b5('0x31')]);_0x40f5ba[_0x32b5('0x32')]=_0x55e347;}return request({'event':_0x488185,'message':_0x40f5ba});})['catch'](function(_0x3013ea){logger['error'](_0x32b5('0x1f'),'AfterUpdate',_0x3013ea);});}};}function getAgent(_0x2c1d9e){return db['User'][_0x32b5('0x3e')]({'where':{'id':_0x2c1d9e},'attributes':['id','name',_0x32b5('0x3f'),_0x32b5('0x40'),_0x32b5('0x41')],'raw':!![]})[_0x32b5('0x1d')](function(_0x22e5c7){return _0x22e5c7;});}exports[_0x32b5('0x42')]=function(){for(var _0x48e57a=0x0;_0x48e57a=_0xab7d9[_0x9d18('0x14')]){throw Error(_0x9d18('0x15'));}_0x55428f(_0x2d2f62);})[_0x9d18('0x16')](function(_0x40cfed){_0x551a37(_0x40cfed);});});}; \ No newline at end of file +var _0x9867=['mail','chat','fax','sms','whatsapp','openchannel','getChannels','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice'];(function(_0x2269d2,_0x3ac498){var _0x27acfa=function(_0x249cf5){while(--_0x249cf5){_0x2269d2['push'](_0x2269d2['shift']());}};_0x27acfa(++_0x3ac498);}(_0x9867,0xca));var _0x7986=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9867[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7986('0x0'));var BPromise=require(_0x7986('0x1'));var db=require(_0x7986('0x2'))['db'];var util=require(_0x7986('0x3'));var channels=[_0x7986('0x4'),_0x7986('0x5'),_0x7986('0x6'),_0x7986('0x7'),_0x7986('0x8'),_0x7986('0x9'),_0x7986('0xa')];exports[_0x7986('0xb')]=function(){return channels;};exports['isValidChannel']=function(_0x58c33d){_0x58c33d=_0x58c33d['toLowerCase']();return _['includes'](channels,_0x58c33d);};exports[_0x7986('0xc')]=function(_0x18c36e,_0xf0d4ae,_0x341b39,_0x43e40e){var _0x2c55eb={'loginAttempts':_0xf0d4ae,'blocked':_0x341b39};if(!_[_0x7986('0xd')](_0x43e40e)){_0x2c55eb[_0x7986('0xe')]=_0x43e40e;}return _0x18c36e[_0x7986('0xf')](_0x2c55eb);};exports[_0x7986('0x10')]=function(_0x2a02ac){return new BPromise(function(_0x1c24bc,_0x1d785d){var _0x920786=0x0;if(_0x2a02ac[_0x7986('0x11')]!=='agent'){_0x1c24bc(_0x2a02ac);}db[_0x7986('0x12')][_0x7986('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2a02ac['id']}}})[_0x7986('0x14')](function(_0x616e99){_0x920786=_0x616e99;return util[_0x7986('0x10')]();})[_0x7986('0x14')](function(_0x5cff98){if(_0x5cff98&&_0x5cff98[_0x7986('0x15')]&&_0x920786>=_0x5cff98['agents']){throw Error(_0x7986('0x16'));}_0x1c24bc(_0x2a02ac);})['catch'](function(_0x5bcc67){_0x1d785d(_0x5bcc67);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index c023b10..2d01890 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b34=['inherits','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval','Conflict','error','statusMessage','status','send','exports','util','../config/logger','api','name','message','Bad\x20Request','Forbidden'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x2b34,0x125));var _0x42b3=function(_0x24529e,_0x20b864){_0x24529e=_0x24529e-0x0;var _0x4f37ba=_0x2b34[_0x24529e];return _0x4f37ba;};'use strict';var util=require(_0x42b3('0x0'));var logger=require(_0x42b3('0x1'))(_0x42b3('0x2'));var APIError=function(_0x56ec56,_0x54f48b){this['message']=_0x56ec56||'Internal\x20Server\x20Error';this[_0x42b3('0x3')]=_0x54f48b||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x261907){this[_0x42b3('0x4')]=_0x261907||'Bad\x20Request';this['name']=_0x42b3('0x5');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xbe88d2){this[_0x42b3('0x4')]=_0xbe88d2||_0x42b3('0x6');this[_0x42b3('0x3')]=_0x42b3('0x6');util[_0x42b3('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3fb59b){this[_0x42b3('0x4')]=_0x3fb59b||_0x42b3('0x8');this['name']=_0x42b3('0x9');util[_0x42b3('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2689e9){this[_0x42b3('0x4')]=_0x2689e9||_0x42b3('0xa');this['name']=_0x42b3('0xb');this[_0x42b3('0xc')]=0x193;this['details']={'type':_0x42b3('0xd')};util[_0x42b3('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x761e94){this[_0x42b3('0x4')]=_0x761e94||'Resource\x20Conflict';this[_0x42b3('0x3')]=_0x42b3('0xe');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x9d95ea){switch(_0x9d95ea){case _0x42b3('0x5'):return 0x190;case'Forbidden',_0x42b3('0xb'):return 0x193;case _0x42b3('0x9'):return 0x194;case _0x42b3('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xbd68da){if(_0xbd68da===_0x42b3('0xb'))return _0xbd68da;return null;}function handleError(_0x3fdd9b){return function(_0x3eba37){logger[_0x42b3('0xf')](_0x3eba37['stack']);var _0x13d453=getStatusCode(_0x3eba37[_0x42b3('0x3')]);var _0x14a953=getCustomStatusMessage(_0x3eba37[_0x42b3('0x3')]);if(_0x3eba37[_0x42b3('0x3')]){delete _0x3eba37[_0x42b3('0x3')];}if(_0x14a953){_0x3fdd9b[_0x42b3('0x10')]=_0x14a953;}return _0x3fdd9b[_0x42b3('0x11')](_0x13d453)[_0x42b3('0x12')](_0x3eba37);};}module[_0x42b3('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x4874=['Conflict','error','stack','status','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Not\x20Found','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4874,0xf5));var _0x4487=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x4874[_0xc8a931];return _0x28bd27;};'use strict';var util=require('util');var logger=require(_0x4487('0x0'))(_0x4487('0x1'));var APIError=function(_0x5adc0d,_0x1c9cc0){this[_0x4487('0x2')]=_0x5adc0d||_0x4487('0x3');this[_0x4487('0x4')]=_0x1c9cc0||_0x4487('0x5');util[_0x4487('0x6')](APIError,Error);};var APIBadRequestError=function(_0x2b8616){this['message']=_0x2b8616||'Bad\x20Request';this[_0x4487('0x4')]=_0x4487('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x226c0a){this[_0x4487('0x2')]=_0x226c0a||'Forbidden';this[_0x4487('0x4')]=_0x4487('0x8');util[_0x4487('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x318e8b){this['message']=_0x318e8b||'Entity\x20not\x20found';this[_0x4487('0x4')]=_0x4487('0x9');util[_0x4487('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x54c60a){this[_0x4487('0x2')]=_0x54c60a||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x4487('0x4')]=_0x4487('0xa');this[_0x4487('0xb')]=0x193;this[_0x4487('0xc')]={'type':_0x4487('0xd')};util[_0x4487('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x2220b9){this[_0x4487('0x2')]=_0x2220b9||_0x4487('0xe');this['name']=_0x4487('0xf');util[_0x4487('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x445c69){switch(_0x445c69){case'Bad\x20Request':return 0x190;case _0x4487('0x8'),_0x4487('0xa'):return 0x193;case _0x4487('0x9'):return 0x194;case _0x4487('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x38e204){if(_0x38e204==='Out\x20Of\x20Interval')return _0x38e204;return null;}function handleError(_0xd433b0){return function(_0x250812){logger[_0x4487('0x10')](_0x250812[_0x4487('0x11')]);var _0x4877c5=getStatusCode(_0x250812[_0x4487('0x4')]);var _0x4dbf78=getCustomStatusMessage(_0x250812['name']);if(_0x250812[_0x4487('0x4')]){delete _0x250812[_0x4487('0x4')];}if(_0x4dbf78){_0xd433b0['statusMessage']=_0x4dbf78;}return _0xd433b0[_0x4487('0x12')](_0x4877c5)['send'](_0x250812);};}module[_0x4487('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 657218f..c090f2d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1394=['404','status','render','exports'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x1394,0xb3));var _0x4139=function(_0x1464fa,_0x2c394d){_0x1464fa=_0x1464fa-0x0;var _0x4d298a=_0x1394[_0x1464fa];return _0x4d298a;};'use strict';module[_0x4139('0x0')][0x194]=function pageNotFound(_0x21184c,_0x2c6530){var _0x5ea305=_0x4139('0x1');var _0x50a7fd=0x194;var _0x35aed2={'status':_0x50a7fd};_0x2c6530[_0x4139('0x2')](_0x35aed2['status']);_0x2c6530[_0x4139('0x3')](_0x5ea305,{},function(_0x4c0306,_0x1962f2){if(_0x4c0306){return _0x2c6530[_0x4139('0x2')](_0x35aed2[_0x4139('0x2')])['json'](_0x35aed2);}_0x2c6530['send'](_0x1962f2);});}; \ No newline at end of file +var _0x9372=['send','exports','404','status','render','json'];(function(_0x294917,_0x56603e){var _0x53ccf9=function(_0x593220){while(--_0x593220){_0x294917['push'](_0x294917['shift']());}};_0x53ccf9(++_0x56603e);}(_0x9372,0x175));var _0x2937=function(_0x5774b0,_0x536ca7){_0x5774b0=_0x5774b0-0x0;var _0x193989=_0x9372[_0x5774b0];return _0x193989;};'use strict';module[_0x2937('0x0')][0x194]=function pageNotFound(_0x346b9f,_0x41fa47){var _0x10f466=_0x2937('0x1');var _0x3c2e4c=0x194;var _0x572bb3={'status':_0x3c2e4c};_0x41fa47['status'](_0x572bb3[_0x2937('0x2')]);_0x41fa47[_0x2937('0x3')](_0x10f466,{},function(_0x218a08,_0x4beede){if(_0x218a08){return _0x41fa47['status'](_0x572bb3[_0x2937('0x2')])[_0x2937('0x4')](_0x572bb3);}_0x41fa47[_0x2937('0x5')](_0x4beede);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 654e4cf..07329bb 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d1f=['VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','UserSetting','userSetting','cascade','hasMany','VoiceRecording','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteraction','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','VoicePrefixes','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','Trunk','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','restrict','Imap','Smtp','Disposition','Answers','Interactions','List','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Attachment','ChatWebsiteId','TagId','Items','Dispositions','FaxAccountId','FaxApplication','Exntensions','FaxMessage','mandatoryDispositionPauseId','FaxInteractionId','Owner','fax_interaction_has_tags','Users','Interaction','AttachmentId','team_has_fax_queues','ListId','SmsAccountId','IntervalId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','Phones','CmContactId','cm_contact_has_tags','CmHopperId','Queue','Campaign','CampaignId','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','DeskAccount','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','CloudProviderId','Dynamics365Field','FromId','ToId','JscriptyQuestionReport','ProjectId','team_has_sms_queues','team_has_whatsapp_queues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromUserId','ToChatQueueId','ToAccount','FaxTransferReport','FromFaxAccountId','ToUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','xC@LL1234','127.0.0.1','name','sequelizeHistory','motion2','xcall','mysql','utf8mb4','utf8','utf8_general_ci','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model'];(function(_0x33732f,_0x537323){var _0x248736=function(_0x5521b8){while(--_0x5521b8){_0x33732f['push'](_0x33732f['shift']());}};_0x248736(++_0x537323);}(_0x7d1f,0x10f));var _0xf7d1=function(_0x44ee49,_0x188106){_0x44ee49=_0x44ee49-0x0;var _0x27e526=_0x7d1f[_0x44ee49];return _0x27e526;};'use strict';var config=require(_0xf7d1('0x0'));var Sequelize=require(_0xf7d1('0x1'));var _=require(_0xf7d1('0x2'));var jstz=require(_0xf7d1('0x3'));var timezone=jstz['determine']();config[_0xf7d1('0x1')]=_['defaultsDeep'](config[_0xf7d1('0x1')],{'database':'motion2','username':'xcall','password':_0xf7d1('0x4'),'options':{'host':_0xf7d1('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf7d1('0x6')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0xf7d1('0x7')]=_['defaultsDeep'](config[_0xf7d1('0x7')],{'database':_0xf7d1('0x8'),'username':_0xf7d1('0x9'),'password':_0xf7d1('0x4'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xf7d1('0xa'),'dialectOptions':{'charset':_0xf7d1('0xb')},'logging':![],'timezone':timezone[_0xf7d1('0x6')](),'define':{'charset':_0xf7d1('0xc'),'collate':_0xf7d1('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf7d1('0x1')][_0xf7d1('0xe')],config[_0xf7d1('0x1')][_0xf7d1('0xf')],config[_0xf7d1('0x1')][_0xf7d1('0x10')],config['sequelize'][_0xf7d1('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf7d1('0x7')][_0xf7d1('0xe')],config[_0xf7d1('0x7')][_0xf7d1('0xf')],config[_0xf7d1('0x7')][_0xf7d1('0x10')],config[_0xf7d1('0x7')]['options'])};db[_0xf7d1('0x12')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/user/user.model');db[_0xf7d1('0x14')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x15'));db[_0xf7d1('0x16')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x17'));db[_0xf7d1('0x18')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x19'));db[_0xf7d1('0x1a')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x1b'));db[_0xf7d1('0x1c')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x1d'));db['VoiceRecording']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x1e'));db[_0xf7d1('0x1f')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x20'));db[_0xf7d1('0x21')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x22'));db[_0xf7d1('0x23')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x24'));db[_0xf7d1('0x25')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x26'));db['VoiceQueueReport']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x27'));db[_0xf7d1('0x28')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x29'));db['Trunk']=db['sequelize'][_0xf7d1('0x13')]('../api/trunk/trunk.model');db[_0xf7d1('0x2a')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x2b'));db[_0xf7d1('0x2c')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x2d'));db['UserVoiceQueue']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x2e'));db[_0xf7d1('0x2f')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x30'));db[_0xf7d1('0x31')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x32'));db['UserFaxQueue']=db[_0xf7d1('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize']['import'](_0xf7d1('0x33'));db[_0xf7d1('0x34')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xf7d1('0x35')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x36'));db['MailServerIn']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x37'));db[_0xf7d1('0x38')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x39'));db[_0xf7d1('0x3a')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/mailAccount/mailAccount.model');db[_0xf7d1('0x3b')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x3c'));db[_0xf7d1('0x3d')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0xf7d1('0x3e')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x3f'));db[_0xf7d1('0x40')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x41'));db[_0xf7d1('0x42')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x43'));db[_0xf7d1('0x44')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x45'));db[_0xf7d1('0x46')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/dashboard/dashboard.model');db[_0xf7d1('0x47')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x48'));db[_0xf7d1('0x49')]=db[_0xf7d1('0x1')]['import']('../api/faxAccount/faxAccount.model');db['FaxApplication']=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db[_0xf7d1('0x4a')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x4b'));db['FaxMessage']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/faxMessage/faxMessage.model');db[_0xf7d1('0x4c')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x4d'));db[_0xf7d1('0x4e')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x4f'));db['SmsAccount']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x50'));db[_0xf7d1('0x51')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x52'));db[_0xf7d1('0x53')]=db['sequelize']['import'](_0xf7d1('0x54'));db[_0xf7d1('0x55')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x56'));db[_0xf7d1('0x57')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x58'));db['OpenchannelApplication']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x59'));db[_0xf7d1('0x5a')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xf7d1('0x5b')]=db['sequelize']['import'](_0xf7d1('0x5c'));db[_0xf7d1('0x5d')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x5e'));db['ChatWebsite']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xf7d1('0x5f')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x60'));db[_0xf7d1('0x61')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x62'));db[_0xf7d1('0x63')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x64'));db[_0xf7d1('0x65')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x66'));db[_0xf7d1('0x67')]=db[_0xf7d1('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xf7d1('0x68')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x69'));db[_0xf7d1('0x6a')]=db['sequelize'][_0xf7d1('0x13')]('../api/chatGroup/chatGroup.model');db[_0xf7d1('0x6b')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x6c'));db[_0xf7d1('0x6d')]=db[_0xf7d1('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xf7d1('0x6e')]=db[_0xf7d1('0x1')]['import']('../api/cmContact/cmContact.model');db[_0xf7d1('0x6f')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x70'));db[_0xf7d1('0x71')]=db['sequelize'][_0xf7d1('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xf7d1('0x72')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x73'));db[_0xf7d1('0x74')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x75'));db['ReportAgentPreview']=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x76'));db['CmCustomField']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x77'));db[_0xf7d1('0x78')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x79'));db[_0xf7d1('0x7a')]=db['sequelize'][_0xf7d1('0x13')]('../api/automation/automation.model');db[_0xf7d1('0x7b')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x7c'));db['Disposition']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x7d'));db[_0xf7d1('0x7e')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x7f'));db['Interval']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x80'));db[_0xf7d1('0x81')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x82'));db[_0xf7d1('0x83')]=db['sequelize'][_0xf7d1('0x13')]('../api/cdr/cdr.model');db[_0xf7d1('0x84')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x85'));db['Schedule']=db[_0xf7d1('0x1')]['import']('../api/schedule/schedule.model');db[_0xf7d1('0x86')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x87'));db[_0xf7d1('0x88')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x89'));db[_0xf7d1('0x8a')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x8b'));db[_0xf7d1('0x8c')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x8d'));db[_0xf7d1('0x8e')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x8f'));db[_0xf7d1('0x90')]=db['sequelize']['import'](_0xf7d1('0x91'));db[_0xf7d1('0x92')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x93'));db[_0xf7d1('0x94')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x95'));db['Integration']=db['sequelize']['import'](_0xf7d1('0x96'));db[_0xf7d1('0x97')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x98'));db['AnalyticCustomReport']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x99'));db[_0xf7d1('0x9a')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x9b'));db['AnalyticExtractedReport']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xf7d1('0x9c')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x9d'));db[_0xf7d1('0x9e')]=db['sequelize']['import'](_0xf7d1('0x9f'));db[_0xf7d1('0xa0')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0xa1'));db['SalesforceAccount']=db[_0xf7d1('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xa2'));db['SalesforceField']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xa3'));db[_0xf7d1('0xa4')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xa5'));db[_0xf7d1('0xa6')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xa7'));db[_0xf7d1('0xa8')]=db['sequelize']['import'](_0xf7d1('0xa9'));db['DeskAccount']=db['sequelize'][_0xf7d1('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xf7d1('0xaa')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0xab'));db[_0xf7d1('0xac')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xad'));db[_0xf7d1('0xae')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0xf7d1('0xaf')]=db[_0xf7d1('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize']['import'](_0xf7d1('0xb0'));db[_0xf7d1('0xb1')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xf7d1('0xb2')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xb3'));db[_0xf7d1('0xb4')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0xb5'));db['FreshdeskConfiguration']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xf7d1('0xb6')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xf7d1('0xb7')]=db[_0xf7d1('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xf7d1('0xb8')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xb9'));db[_0xf7d1('0xba')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xbb'));db[_0xf7d1('0xbc')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xbd'));db[_0xf7d1('0xbe')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xbf'));db[_0xf7d1('0xc0')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xf7d1('0xc1')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xf7d1('0xc2')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0xc3'));db['Dynamics365Field']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xc4'));db[_0xf7d1('0xc5')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xf7d1('0xc6')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xc7'));db[_0xf7d1('0xc8')]=db[_0xf7d1('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xf7d1('0xc9')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x96'));db['Network']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xca'));db[_0xf7d1('0xcb')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xcc'));db[_0xf7d1('0xcd')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xce'));db[_0xf7d1('0xcf')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xd0'));db['JscriptyQuestionReport']=db[_0xf7d1('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xf7d1('0xd1')]=db['sequelize'][_0xf7d1('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xf7d1('0xd2')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xd3'));db[_0xf7d1('0xd4')]=db['sequelize']['import'](_0xf7d1('0xd5'));db[_0xf7d1('0xd6')]=db['sequelize']['import'](_0xf7d1('0xd7'));db[_0xf7d1('0xd8')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/setting/setting.model');db[_0xf7d1('0xd9')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xda'));db[_0xf7d1('0xdb')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xdc'));db[_0xf7d1('0xdd')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xde'));db[_0xf7d1('0xdf')]=db['sequelize']['import'](_0xf7d1('0xe0'));db[_0xf7d1('0xe1')]=db['sequelize'][_0xf7d1('0x13')]('../api/team/team.model');db[_0xf7d1('0xe2')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0xe3'));db['Campaign']=db['sequelize'][_0xf7d1('0x13')]('../api/campaign/campaign.model');db[_0xf7d1('0xe4')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xe5'));db['Attachment']=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xe6'));db[_0xf7d1('0xe7')]=db['sequelize']['import'](_0xf7d1('0xe8'));db[_0xf7d1('0xe9')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xea'));db['FaxTransferReport']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xf7d1('0xeb')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xec'));db['SmsTransferReport']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xf7d1('0x1')]['import']('../api/cmList/cmList.model');db[_0xf7d1('0xed')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xee'));db[_0xf7d1('0xef')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xf0'));db[_0xf7d1('0xf1')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0xf2'));db[_0xf7d1('0xf3')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xf4'));db[_0xf7d1('0xf5')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xf6'));db[_0xf7d1('0xf7')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xf8'));db[_0xf7d1('0xf9')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xfa'));db['WhatsappInteraction']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xfb'));db['WhatsappMessage']=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0xf7d1('0xfc')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0xfd'));db[_0xf7d1('0xfe')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0xff'));db[_0xf7d1('0x100')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x101'));db[_0xf7d1('0x102')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x103'));db[_0xf7d1('0x104')]=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x105'));db[_0xf7d1('0x106')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')](_0xf7d1('0x107'));db[_0xf7d1('0x108')]=db[_0xf7d1('0x1')][_0xf7d1('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0xf7d1('0x1')]['import'](_0xf7d1('0x109'));db[_0xf7d1('0x10a')]=db['sequelize'][_0xf7d1('0x13')](_0xf7d1('0x10b'));db[_0xf7d1('0x12')][_0xf7d1('0x10c')](db[_0xf7d1('0x1f')],{'as':_0xf7d1('0x1f'),'onDelete':'cascade','foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x10c')](db[_0xf7d1('0x10e')],{'as':_0xf7d1('0x10f'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x112')],{'as':'Recordings','foreignKey':_0xf7d1('0x10d')});db['User'][_0xf7d1('0x111')](db[_0xf7d1('0x2c')],{'as':_0xf7d1('0x113'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xf7d1('0x18')],{'as':_0xf7d1('0x114'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x72')],{'as':_0xf7d1('0x115'),'foreignKey':'UserId'});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x74')],{'as':_0xf7d1('0x116'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x117')],{'as':_0xf7d1('0x117'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x5a')],{'as':_0xf7d1('0x118'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')]['hasMany'](db[_0xf7d1('0x63')],{'as':'ChatInteractions','foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x119')],{'as':'SmsInteractions','foreignKey':_0xf7d1('0x10d')});db['User']['hasMany'](db[_0xf7d1('0x4a')],{'as':_0xf7d1('0x11a'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x3e')],{'as':'MailInteractions','foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db[_0xf7d1('0x11b')],{'as':_0xf7d1('0x11c'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x12')]['hasMany'](db[_0xf7d1('0xf5')],{'as':_0xf7d1('0x11d'),'foreignKey':_0xf7d1('0x11e')});db[_0xf7d1('0x12')][_0xf7d1('0x111')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xf7d1('0x10d'),'onDelete':'SET\x20NULL'});db[_0xf7d1('0x12')][_0xf7d1('0x11f')](db[_0xf7d1('0xef')],{'as':_0xf7d1('0xef'),'foreignKey':_0xf7d1('0x120')});db[_0xf7d1('0x12')]['belongsToMany'](db['ChatGroup'],{'as':_0xf7d1('0x121'),'through':'chat_group_has_users'});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x123'),'through':_0xf7d1('0x124')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x126'),'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['Team'],{'through':_0xf7d1('0x127')});db['User'][_0xf7d1('0x122')](db['MailInteraction'],{'as':'MailInteractions','through':_0xf7d1('0x128')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x63')],{'as':_0xf7d1('0x129'),'through':_0xf7d1('0x12a')});db[_0xf7d1('0x12')]['belongsToMany'](db['FaxInteraction'],{'as':_0xf7d1('0x11a'),'through':_0xf7d1('0x12b')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x119')],{'as':_0xf7d1('0x12c'),'through':_0xf7d1('0x12d')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x5a')],{'as':_0xf7d1('0x118'),'through':_0xf7d1('0x12e')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x11b')],{'as':_0xf7d1('0x11c'),'through':_0xf7d1('0x12f')});db[_0xf7d1('0x12')]['belongsToMany'](db[_0xf7d1('0x1c')],{'as':'VoiceQueues','through':_0xf7d1('0x130'),'required':![]});db['User'][_0xf7d1('0x122')](db['VoicePrefix'],{'as':_0xf7d1('0x131'),'through':'UserVoicePrefix','required':![]});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x3b')],{'as':'MailQueues','through':_0xf7d1('0x31'),'required':![]});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db['ChatQueue'],{'as':_0xf7d1('0x132'),'through':_0xf7d1('0x2f'),'required':![],'hooks':!![]});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x4c')],{'as':_0xf7d1('0x133'),'through':_0xf7d1('0x134'),'required':![]});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x55')],{'as':_0xf7d1('0x135'),'through':_0xf7d1('0x136'),'required':![]});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x5d')],{'as':_0xf7d1('0x137'),'through':_0xf7d1('0x34'),'required':![]});db['User'][_0xf7d1('0x122')](db[_0xf7d1('0x100')],{'as':_0xf7d1('0x138'),'through':_0xf7d1('0x35'),'required':![]});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x125')],{'through':_0xf7d1('0x139')});db['User'][_0xf7d1('0x122')](db[_0xf7d1('0x13a')],{'as':_0xf7d1('0x13b'),'through':_0xf7d1('0x13c')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0x49')],{'as':'FaxAccounts','through':_0xf7d1('0x13d')});db['User'][_0xf7d1('0x122')](db[_0xf7d1('0x3a')],{'as':'MailAccounts','through':_0xf7d1('0x13e')});db['User'][_0xf7d1('0x122')](db['OpenchannelAccount'],{'as':_0xf7d1('0x13f'),'through':'user_has_openchannel_accounts'});db[_0xf7d1('0x12')]['belongsToMany'](db[_0xf7d1('0x140')],{'as':_0xf7d1('0x141'),'through':_0xf7d1('0x142')});db[_0xf7d1('0x12')][_0xf7d1('0x122')](db[_0xf7d1('0xf7')],{'as':'WhatsappAccounts','through':_0xf7d1('0x143')});db[_0xf7d1('0x14')][_0xf7d1('0x111')](db[_0xf7d1('0x18')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0xf7d1('0x18')],{'onDelete':'cascade'});db[_0xf7d1('0x18')][_0xf7d1('0x111')](db[_0xf7d1('0x18')],{'as':_0xf7d1('0x144'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x1a')][_0xf7d1('0x122')](db[_0xf7d1('0x86')],{'as':_0xf7d1('0x145'),'through':_0xf7d1('0x146')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db[_0xf7d1('0x2c')],{'as':_0xf7d1('0x147'),'foreignKey':_0xf7d1('0x148')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db[_0xf7d1('0x6f')],{'as':'Hoppers','foreignKey':_0xf7d1('0x148')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db[_0xf7d1('0x72')],{'as':'HopperFinals','foreignKey':_0xf7d1('0x148')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db['CmHopperHistory'],{'as':_0xf7d1('0x149'),'foreignKey':_0xf7d1('0x148')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db[_0xf7d1('0x117')],{'as':_0xf7d1('0x117'),'foreignKey':_0xf7d1('0x148')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db[_0xf7d1('0x71')],{'as':_0xf7d1('0x14a'),'foreignKey':_0xf7d1('0x148')});db[_0xf7d1('0x1c')][_0xf7d1('0x111')](db[_0xf7d1('0x14b')],{'as':_0xf7d1('0x14c'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xf7d1('0x11f')](db['Trunk'],{'as':'Trunk','foreignKey':_0xf7d1('0x14d')});db[_0xf7d1('0x1c')][_0xf7d1('0x11f')](db[_0xf7d1('0x14e')],{'as':_0xf7d1('0x14f'),'foreignKey':_0xf7d1('0x150')});db['VoiceQueue'][_0xf7d1('0x11f')](db[_0xf7d1('0x151')],{'as':_0xf7d1('0x151'),'foreignKey':'IntervalId'});db[_0xf7d1('0x1c')][_0xf7d1('0x11f')](db[_0xf7d1('0x81')],{'as':_0xf7d1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf7d1('0x1c')][_0xf7d1('0x122')](db['CmList'],{'as':_0xf7d1('0x126'),'through':_0xf7d1('0x153')});db[_0xf7d1('0x1c')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':'Agents','through':_0xf7d1('0x130')});db[_0xf7d1('0x1c')][_0xf7d1('0x122')](db[_0xf7d1('0xe1')],{'as':_0xf7d1('0x154'),'through':_0xf7d1('0x104')});db[_0xf7d1('0x1c')][_0xf7d1('0x122')](db['CmList'],{'as':_0xf7d1('0x155'),'through':_0xf7d1('0x156')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0xf7d1('0x12'),'foreignKey':'UserId'});db[_0xf7d1('0x157')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x12'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x1f')]['hasMany'](db['VoiceMailMessage'],{'as':_0xf7d1('0x158'),'onDelete':'cascade','foreignKey':_0xf7d1('0x159'),'sourceKey':_0xf7d1('0x15a')});db[_0xf7d1('0x21')][_0xf7d1('0x11f')](db[_0xf7d1('0x1f')],{'foreignKey':_0xf7d1('0x159'),'targetKey':'mailbox'});db[_0xf7d1('0x23')]['hasMany'](db[_0xf7d1('0x15b')],{'as':'QueueCalls','foreignKey':_0xf7d1('0x15c'),'constraints':![]});db[_0xf7d1('0x23')][_0xf7d1('0x111')](db['VoiceAgentReport'],{'as':_0xf7d1('0x15d'),'foreignKey':_0xf7d1('0x15c'),'constraints':![]});db[_0xf7d1('0x23')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x12'),'foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x160')][_0xf7d1('0x11f')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xf7d1('0x161')});db[_0xf7d1('0x160')][_0xf7d1('0x11f')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xf7d1('0x38')][_0xf7d1('0x11f')](db[_0xf7d1('0x3a')],{'as':_0xf7d1('0x3a'),'foreignKey':_0xf7d1('0x161')});db[_0xf7d1('0x38')]['belongsTo'](db[_0xf7d1('0x102')],{'as':_0xf7d1('0x102'),'foreignKey':'CloudProviderId','onDelete':_0xf7d1('0x162')});db['MailAccount'][_0xf7d1('0x10c')](db[_0xf7d1('0x160')],{'as':_0xf7d1('0x163'),'onDelete':_0xf7d1('0x110')});db['MailAccount'][_0xf7d1('0x10c')](db['MailServerOut'],{'as':_0xf7d1('0x164'),'onDelete':'cascade'});db[_0xf7d1('0x3a')][_0xf7d1('0x111')](db[_0xf7d1('0x165')],{'as':'Dispositions','foreignKey':_0xf7d1('0x161'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x3a')][_0xf7d1('0x111')](db['CannedAnswer'],{'as':_0xf7d1('0x166'),'foreignKey':'MailAccountId'});db[_0xf7d1('0x3a')][_0xf7d1('0x111')](db[_0xf7d1('0x40')],{'as':'Messages','foreignKey':_0xf7d1('0x161')});db[_0xf7d1('0x3a')][_0xf7d1('0x111')](db['MailInteraction'],{'as':_0xf7d1('0x167')});db[_0xf7d1('0x3a')][_0xf7d1('0x111')](db[_0xf7d1('0x42')],{'as':_0xf7d1('0x144'),'foreignKey':_0xf7d1('0x161'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x3a')][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':'ListId'});db[_0xf7d1('0x3a')][_0xf7d1('0x11f')](db[_0xf7d1('0x90')],{'as':_0xf7d1('0x90'),'foreignKey':_0xf7d1('0x169')});db[_0xf7d1('0x3a')][_0xf7d1('0x11f')](db[_0xf7d1('0x81')],{'as':_0xf7d1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf7d1('0x3a')][_0xf7d1('0x122')](db['User'],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x13e')});db[_0xf7d1('0x3b')]['belongsToMany'](db['User'],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x31')});db[_0xf7d1('0x3b')]['belongsToMany'](db['Team'],{'through':_0xf7d1('0x16b'),'as':_0xf7d1('0x154')});db[_0xf7d1('0x3e')]['hasMany'](db['MailMessage'],{'as':_0xf7d1('0x158'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x16c')});db['MailInteraction'][_0xf7d1('0x11f')](db['MailAccount'],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x161')});db[_0xf7d1('0x3e')][_0xf7d1('0x11f')](db['CmContact'],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x3e')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':'Owner','foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x3e')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':'mail_interaction_has_tags','as':_0xf7d1('0x16e')});db[_0xf7d1('0x3e')]['belongsToMany'](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x16f'),'as':_0xf7d1('0x170')});db[_0xf7d1('0x3e')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':'Users','through':_0xf7d1('0x128'),'foreignKey':'MailInteractionId'});db[_0xf7d1('0x40')][_0xf7d1('0x111')](db[_0xf7d1('0x171')],{'as':'Attachments','onDelete':'cascade'});db[_0xf7d1('0x40')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x12')});db[_0xf7d1('0x40')][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'onDelete':'cascade','as':'Contact'});db[_0xf7d1('0x40')]['belongsTo'](db[_0xf7d1('0x3e')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xf7d1('0x40')]['belongsTo'](db['MailAccount'],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x161')});db['MailMessage'][_0xf7d1('0x11f')](db[_0xf7d1('0x13a')],{'as':'ChatWebsite','foreignKey':_0xf7d1('0x172')});db[_0xf7d1('0x40')]['belongsTo'](db[_0xf7d1('0x67')],{'as':_0xf7d1('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0xf7d1('0x42')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x42')][_0xf7d1('0x11f')](db['MailQueue'],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x42')][_0xf7d1('0x11f')](db[_0xf7d1('0x3a')],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x42')][_0xf7d1('0x11f')](db[_0xf7d1('0x151')],{'onDelete':_0xf7d1('0x162'),'foreignKey':'IntervalId'});db['MailApplication'][_0xf7d1('0x11f')](db[_0xf7d1('0x88')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x173')});db['MailQueueReport']['belongsTo'](db[_0xf7d1('0x3a')],{});db[_0xf7d1('0x44')][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':'ListId'});db[_0xf7d1('0x44')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x44')][_0xf7d1('0x11f')](db[_0xf7d1('0x3e')],{});db[_0xf7d1('0x44')][_0xf7d1('0x11f')](db[_0xf7d1('0x40')],{});db[_0xf7d1('0x44')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{});db['MailQueueReport'][_0xf7d1('0x11f')](db['MailQueue'],{});db[_0xf7d1('0x46')][_0xf7d1('0x111')](db[_0xf7d1('0x47')],{'as':_0xf7d1('0x174'),'onDelete':_0xf7d1('0x110')});db['FaxAccount'][_0xf7d1('0x111')](db['Disposition'],{'as':_0xf7d1('0x175'),'foreignKey':_0xf7d1('0x176'),'onDelete':'cascade'});db['FaxAccount'][_0xf7d1('0x111')](db['CannedAnswer'],{'as':_0xf7d1('0x166'),'foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0xf7d1('0x167')});db[_0xf7d1('0x49')][_0xf7d1('0x111')](db[_0xf7d1('0x177')],{'as':_0xf7d1('0x144'),'foreignKey':_0xf7d1('0x176'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x49')]['hasMany'](db[_0xf7d1('0x18')],{'as':_0xf7d1('0x178'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x49')]['hasMany'](db[_0xf7d1('0x179')],{'as':_0xf7d1('0x158')});db[_0xf7d1('0x49')][_0xf7d1('0x11f')](db[_0xf7d1('0x14e')],{'as':_0xf7d1('0x14e')});db[_0xf7d1('0x49')][_0xf7d1('0x11f')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xf7d1('0x49')][_0xf7d1('0x11f')](db[_0xf7d1('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xf7d1('0x17a')});db[_0xf7d1('0x49')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x13d')});db[_0xf7d1('0x177')]['belongsTo'](db[_0xf7d1('0x12')],{'onDelete':_0xf7d1('0x162')});db['FaxApplication'][_0xf7d1('0x11f')](db[_0xf7d1('0x4c')],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x177')][_0xf7d1('0x11f')](db[_0xf7d1('0x49')],{'onDelete':'restrict'});db[_0xf7d1('0x177')][_0xf7d1('0x11f')](db[_0xf7d1('0x88')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x173')});db[_0xf7d1('0x4a')][_0xf7d1('0x111')](db['FaxMessage'],{'as':_0xf7d1('0x158'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x17b')});db[_0xf7d1('0x4a')]['belongsTo'](db['FaxAccount'],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x176')});db['FaxInteraction'][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x4a')][_0xf7d1('0x11f')](db['User'],{'as':_0xf7d1('0x17c'),'foreignKey':'UserId'});db[_0xf7d1('0x4a')]['belongsToMany'](db[_0xf7d1('0x88')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0xf7d1('0x4a')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x17d'),'as':'ThroughTags'});db['FaxInteraction'][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x17e'),'through':_0xf7d1('0x12b'),'foreignKey':_0xf7d1('0x17b')});db[_0xf7d1('0x179')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'onDelete':'cascade','as':_0xf7d1('0x12')});db['FaxMessage'][_0xf7d1('0x11f')](db[_0xf7d1('0x4a')],{'as':_0xf7d1('0x17f'),'foreignKey':_0xf7d1('0x17b')});db['FaxMessage'][_0xf7d1('0x11f')](db['CmContact'],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x15e')});db['FaxMessage'][_0xf7d1('0x11f')](db[_0xf7d1('0x171')],{'as':_0xf7d1('0x171'),'foreignKey':_0xf7d1('0x180')});db['FaxMessage'][_0xf7d1('0x11f')](db[_0xf7d1('0x49')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x176')});db['FaxQueue'][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x134')});db[_0xf7d1('0x4c')]['belongsToMany'](db['Team'],{'through':_0xf7d1('0x181'),'as':_0xf7d1('0x154')});db['FaxQueueReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x49')],{});db['FaxQueueReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':'List','foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0x4e')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db['FaxInteraction'],{});db[_0xf7d1('0x4e')][_0xf7d1('0x11f')](db[_0xf7d1('0x179')],{});db[_0xf7d1('0x4e')]['belongsTo'](db[_0xf7d1('0x12')],{});db[_0xf7d1('0x4e')][_0xf7d1('0x11f')](db[_0xf7d1('0x4c')],{});db[_0xf7d1('0x140')][_0xf7d1('0x111')](db[_0xf7d1('0x165')],{'as':_0xf7d1('0x175'),'foreignKey':_0xf7d1('0x183'),'onDelete':'cascade'});db['SmsAccount'][_0xf7d1('0x111')](db['CannedAnswer'],{'as':_0xf7d1('0x166'),'foreignKey':_0xf7d1('0x183')});db[_0xf7d1('0x140')]['hasMany'](db[_0xf7d1('0x53')],{'as':_0xf7d1('0x158'),'foreignKey':_0xf7d1('0x183')});db[_0xf7d1('0x140')]['hasMany'](db[_0xf7d1('0x119')],{'as':_0xf7d1('0x167')});db[_0xf7d1('0x140')]['hasMany'](db[_0xf7d1('0x51')],{'as':_0xf7d1('0x144'),'foreignKey':'SmsAccountId','onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x140')]['belongsTo'](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':'ListId'});db['SmsAccount'][_0xf7d1('0x11f')](db[_0xf7d1('0x81')],{'as':_0xf7d1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf7d1('0x140')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x142')});db[_0xf7d1('0x51')][_0xf7d1('0x11f')](db['User'],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x51')][_0xf7d1('0x11f')](db[_0xf7d1('0x55')],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x51')][_0xf7d1('0x11f')](db['SmsAccount'],{'onDelete':_0xf7d1('0x162')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x184')});db['SmsApplication'][_0xf7d1('0x11f')](db[_0xf7d1('0x88')],{'onDelete':'restrict','foreignKey':_0xf7d1('0x173')});db[_0xf7d1('0x119')][_0xf7d1('0x111')](db[_0xf7d1('0x53')],{'as':_0xf7d1('0x158'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x185')});db[_0xf7d1('0x119')][_0xf7d1('0x11f')](db['SmsAccount'],{'as':_0xf7d1('0x16d'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0xf7d1('0x119')][_0xf7d1('0x11f')](db['User'],{'as':_0xf7d1('0x17c'),'foreignKey':'UserId'});db[_0xf7d1('0x119')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x186'),'as':'Tags'});db['SmsInteraction'][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':'sms_interaction_has_tags','as':_0xf7d1('0x170')});db[_0xf7d1('0x119')][_0xf7d1('0x122')](db['User'],{'as':_0xf7d1('0x17e'),'through':_0xf7d1('0x12d'),'foreignKey':'SmsInteractionId'});db[_0xf7d1('0x53')]['belongsTo'](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x12')});db['SmsMessage'][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'onDelete':'cascade','as':_0xf7d1('0x15e')});db['SmsMessage'][_0xf7d1('0x11f')](db['SmsInteraction'],{'onDelete':'cascade','as':_0xf7d1('0x17f'),'foreignKey':'SmsInteractionId'});db[_0xf7d1('0x53')][_0xf7d1('0x11f')](db['SmsAccount'],{'as':'Account','foreignKey':_0xf7d1('0x183')});db[_0xf7d1('0x55')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x136'),'foreignKey':_0xf7d1('0x187')});db[_0xf7d1('0x55')][_0xf7d1('0x122')](db[_0xf7d1('0xe1')],{'through':'team_has_sms_queues','as':_0xf7d1('0x154')});db[_0xf7d1('0x57')]['hasMany'](db[_0xf7d1('0x165')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db['OpenchannelAccount'][_0xf7d1('0x111')](db[_0xf7d1('0x7b')],{'as':_0xf7d1('0x166'),'foreignKey':_0xf7d1('0x188')});db[_0xf7d1('0x57')][_0xf7d1('0x111')](db[_0xf7d1('0x5a')],{'as':_0xf7d1('0x167'),'foreignKey':_0xf7d1('0x188')});db[_0xf7d1('0x57')][_0xf7d1('0x111')](db['OpenchannelMessage'],{'as':_0xf7d1('0x158'),'foreignKey':_0xf7d1('0x188')});db['OpenchannelAccount'][_0xf7d1('0x111')](db[_0xf7d1('0x189')],{'as':_0xf7d1('0x144'),'foreignKey':'OpenchannelAccountId','onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x57')]['belongsTo'](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':'ListId'});db[_0xf7d1('0x57')]['belongsTo'](db[_0xf7d1('0x81')],{'as':_0xf7d1('0x152'),'foreignKey':_0xf7d1('0x17a')});db[_0xf7d1('0x57')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x18a')});db[_0xf7d1('0x189')][_0xf7d1('0x11f')](db['User'],{'onDelete':_0xf7d1('0x162')});db['OpenchannelApplication']['belongsTo'](db[_0xf7d1('0x5d')],{'onDelete':_0xf7d1('0x162'),'foreignKey':'OpenchannelQueueId'});db[_0xf7d1('0x189')][_0xf7d1('0x11f')](db[_0xf7d1('0x57')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x188')});db[_0xf7d1('0x189')][_0xf7d1('0x11f')](db['Interval'],{'onDelete':_0xf7d1('0x162'),'foreignKey':'IntervalId'});db[_0xf7d1('0x189')][_0xf7d1('0x11f')](db[_0xf7d1('0x88')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x173')});db[_0xf7d1('0x5a')][_0xf7d1('0x111')](db['OpenchannelMessage'],{'as':_0xf7d1('0x158'),'onDelete':'cascade','foreignKey':_0xf7d1('0x18b')});db[_0xf7d1('0x5a')]['belongsTo'](db[_0xf7d1('0x57')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x188')});db[_0xf7d1('0x5a')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x5a')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x5a')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x18c'),'as':'Tags'});db['OpenchannelInteraction'][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x18c'),'as':_0xf7d1('0x170')});db[_0xf7d1('0x5a')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x17e'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0xf7d1('0x5b')][_0xf7d1('0x11f')](db['User'],{'onDelete':'cascade','as':_0xf7d1('0x12')});db[_0xf7d1('0x5b')][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x15e')});db[_0xf7d1('0x5b')]['belongsTo'](db[_0xf7d1('0x5a')],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x17f'),'foreignKey':_0xf7d1('0x18b')});db[_0xf7d1('0x5b')][_0xf7d1('0x11f')](db['Attachment'],{'as':_0xf7d1('0x171'),'foreignKey':_0xf7d1('0x180')});db['OpenchannelMessage'][_0xf7d1('0x11f')](db['OpenchannelAccount'],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x188')});db[_0xf7d1('0x5d')]['belongsToMany'](db['User'],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x34'),'foreignKey':_0xf7d1('0x18d')});db[_0xf7d1('0x5d')][_0xf7d1('0x122')](db['Team'],{'through':_0xf7d1('0x18e'),'as':_0xf7d1('0x154')});db[_0xf7d1('0x13a')][_0xf7d1('0x111')](db[_0xf7d1('0x165')],{'as':'Dispositions','foreignKey':_0xf7d1('0x172'),'onDelete':'cascade'});db[_0xf7d1('0x13a')][_0xf7d1('0x111')](db[_0xf7d1('0x7b')],{'as':_0xf7d1('0x166'),'foreignKey':_0xf7d1('0x172')});db['ChatWebsite'][_0xf7d1('0x111')](db['ChatProactiveAction'],{'as':_0xf7d1('0x18f')});db[_0xf7d1('0x13a')][_0xf7d1('0x111')](db[_0xf7d1('0x63')],{'as':_0xf7d1('0x167')});db[_0xf7d1('0x13a')]['hasMany'](db[_0xf7d1('0x61')],{'as':_0xf7d1('0x144'),'foreignKey':_0xf7d1('0x172'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x13a')][_0xf7d1('0x111')](db[_0xf7d1('0x65')],{'as':_0xf7d1('0x158')});db['ChatWebsite'][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':_0xf7d1('0x182')});db['ChatWebsite'][_0xf7d1('0x11f')](db[_0xf7d1('0x151')],{'as':_0xf7d1('0x151'),'foreignKey':_0xf7d1('0x184')});db['ChatWebsite'][_0xf7d1('0x11f')](db[_0xf7d1('0x3a')],{'as':_0xf7d1('0x3a'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0xf7d1('0x11f')](db[_0xf7d1('0x81')],{'as':_0xf7d1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf7d1('0x13a')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x13c')});db[_0xf7d1('0x5f')][_0xf7d1('0x11f')](db[_0xf7d1('0x57')],{});db[_0xf7d1('0x5f')]['belongsTo'](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0x5f')][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'as':'Contact','foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x5f')]['belongsTo'](db[_0xf7d1('0x5a')],{});db[_0xf7d1('0x5f')][_0xf7d1('0x11f')](db[_0xf7d1('0x5b')],{});db[_0xf7d1('0x5f')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{});db[_0xf7d1('0x5f')][_0xf7d1('0x11f')](db[_0xf7d1('0x5d')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0xf7d1('0x190'),'foreignKey':'UserId','onDelete':'restrict'});db[_0xf7d1('0x61')][_0xf7d1('0x11f')](db[_0xf7d1('0x68')],{'as':'Queue','foreignKey':_0xf7d1('0x191'),'onDelete':'restrict'});db[_0xf7d1('0x61')]['belongsTo'](db[_0xf7d1('0x13a')],{'as':_0xf7d1('0x192'),'foreignKey':_0xf7d1('0x172'),'onDelete':_0xf7d1('0x162')});db['ChatApplication'][_0xf7d1('0x11f')](db[_0xf7d1('0x88')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x173')});db['ChatInteraction'][_0xf7d1('0x111')](db['ChatMessage'],{'as':_0xf7d1('0x158'),'onDelete':_0xf7d1('0x110'),'foreignKey':'ChatInteractionId'});db[_0xf7d1('0x63')][_0xf7d1('0x11f')](db['ChatWebsite'],{'as':_0xf7d1('0x16d'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':'ContactId'});db[_0xf7d1('0x63')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x17c'),'foreignKey':_0xf7d1('0x10d')});db['ChatInteraction'][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':'chat_interaction_has_tags','as':_0xf7d1('0x16e')});db['ChatInteraction'][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x193'),'as':_0xf7d1('0x170')});db['ChatInteraction'][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':'Users','through':_0xf7d1('0x12a'),'foreignKey':_0xf7d1('0x194')});db[_0xf7d1('0x65')][_0xf7d1('0x11f')](db['User'],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x12')});db[_0xf7d1('0x65')][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db['ChatMessage'][_0xf7d1('0x11f')](db[_0xf7d1('0x63')],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x17f'),'foreignKey':'ChatInteractionId'});db[_0xf7d1('0x65')][_0xf7d1('0x11f')](db[_0xf7d1('0x171')],{'as':_0xf7d1('0x171'),'foreignKey':_0xf7d1('0x180')});db[_0xf7d1('0x65')][_0xf7d1('0x11f')](db[_0xf7d1('0x13a')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xf7d1('0x67')]['hasMany'](db[_0xf7d1('0x171')],{'as':_0xf7d1('0x195'),'foreignKey':_0xf7d1('0x196'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x67')]['belongsTo'](db[_0xf7d1('0x6e')],{'onDelete':'cascade','as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x67')][_0xf7d1('0x11f')](db['ChatWebsite'],{'as':_0xf7d1('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0xf7d1('0x68')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x2f'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0xf7d1('0xe1')],{'through':_0xf7d1('0x197'),'as':_0xf7d1('0x154')});db['ChatGroup'][_0xf7d1('0x111')](db[_0xf7d1('0xcd')],{'as':_0xf7d1('0x158'),'foreignKey':_0xf7d1('0x198'),'onDelete':_0xf7d1('0x110')});db['ChatGroup'][_0xf7d1('0x122')](db['User'],{'as':_0xf7d1('0x147'),'through':_0xf7d1('0x199')});db['ChatProactiveAction'][_0xf7d1('0x11f')](db[_0xf7d1('0x13a')],{'as':_0xf7d1('0x192'),'foreignKey':_0xf7d1('0x172')});db[_0xf7d1('0x6d')][_0xf7d1('0x111')](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x123'),'foreignKey':_0xf7d1('0x19a')});db[_0xf7d1('0x6e')][_0xf7d1('0x111')](db[_0xf7d1('0x8c')],{'as':_0xf7d1('0x19b'),'foreignKey':_0xf7d1('0x19c')});db[_0xf7d1('0x6e')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0xf7d1('0x6e')][_0xf7d1('0x111')](db[_0xf7d1('0x72')],{'as':_0xf7d1('0x115'),'foreignKey':_0xf7d1('0x15f')});db['CmContact'][_0xf7d1('0x111')](db[_0xf7d1('0x74')],{'as':_0xf7d1('0x149'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x6e')][_0xf7d1('0x111')](db[_0xf7d1('0x117')],{'as':_0xf7d1('0x117'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x6e')]['hasMany'](db[_0xf7d1('0x14b')],{'as':_0xf7d1('0x14c'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0x6e')][_0xf7d1('0x111')](db[_0xf7d1('0x5a')],{'as':_0xf7d1('0x118'),'foreignKey':_0xf7d1('0x15f'),'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x6e')]['hasMany'](db[_0xf7d1('0x63')],{'as':_0xf7d1('0x129'),'foreignKey':_0xf7d1('0x15f'),'onDelete':_0xf7d1('0x162')});db['CmContact'][_0xf7d1('0x111')](db['SmsInteraction'],{'as':_0xf7d1('0x12c'),'foreignKey':_0xf7d1('0x15f'),'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x6e')][_0xf7d1('0x111')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xf7d1('0x15f'),'onDelete':'restrict'});db[_0xf7d1('0x6e')][_0xf7d1('0x111')](db[_0xf7d1('0x3e')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x6e')]['belongsTo'](db['CmCompany'],{'as':'Company','foreignKey':_0xf7d1('0x19a')});db[_0xf7d1('0x6e')][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':_0xf7d1('0x182'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x6e')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x17e'),'through':_0xf7d1('0x124')});db['CmContact'][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'as':_0xf7d1('0x16e'),'through':_0xf7d1('0x19d')});db[_0xf7d1('0x6e')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':'cm_contact_has_tags','as':_0xf7d1('0x170')});db[_0xf7d1('0x6f')]['hasMany'](db[_0xf7d1('0x8e')],{'as':'AdditionalPhones','foreignKey':_0xf7d1('0x19e')});db[_0xf7d1('0x6f')][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x6f')][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':'List','foreignKey':_0xf7d1('0x182'),'onDelete':'cascade'});db[_0xf7d1('0x6f')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':'Agent','foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x6f')][_0xf7d1('0x11f')](db['VoiceQueue'],{'as':_0xf7d1('0x19f'),'foreignKey':_0xf7d1('0x148'),'onDelete':_0xf7d1('0x110')});db['CmHopper'][_0xf7d1('0x11f')](db[_0xf7d1('0x1a0')],{'as':_0xf7d1('0x1a0'),'foreignKey':_0xf7d1('0x1a1'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x6f')]['belongsTo'](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x17c'),'foreignKey':'OwnerId'});db[_0xf7d1('0x71')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xf7d1('0x71')][_0xf7d1('0x11f')](db['CmList'],{'as':_0xf7d1('0x168'),'foreignKey':_0xf7d1('0x182'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x71')][_0xf7d1('0x11f')](db[_0xf7d1('0x1c')],{'as':_0xf7d1('0x19f'),'foreignKey':'VoiceQueueId','onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x71')]['belongsTo'](db['Campaign'],{'as':_0xf7d1('0x1a0'),'foreignKey':_0xf7d1('0x1a1'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x7a')][_0xf7d1('0x111')](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xf7d1('0x1a2'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x7a')][_0xf7d1('0x111')](db[_0xf7d1('0x7e')],{'as':{'plural':_0xf7d1('0x1a3'),'singular':_0xf7d1('0x1a4')},'foreignKey':_0xf7d1('0x1a5'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x7a')][_0xf7d1('0x111')](db['Action'],{'as':_0xf7d1('0x1a6'),'foreignKey':_0xf7d1('0x1a7'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x165')][_0xf7d1('0x111')](db['Disposition'],{'as':_0xf7d1('0x175'),'foreignKey':_0xf7d1('0x1a8'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x151')]['hasMany'](db[_0xf7d1('0x151')],{'as':_0xf7d1('0x1a9'),'foreignKey':_0xf7d1('0x184'),'onDelete':_0xf7d1('0x110'),'hooks':!![],'required':![]});db[_0xf7d1('0x151')][_0xf7d1('0x111')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xf7d1('0x184'),'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x151')]['hasMany'](db[_0xf7d1('0x42')],{'as':_0xf7d1('0x1aa'),'foreignKey':_0xf7d1('0x184')});db[_0xf7d1('0x151')][_0xf7d1('0x111')](db[_0xf7d1('0x61')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0xf7d1('0x151')][_0xf7d1('0x111')](db[_0xf7d1('0x177')],{'as':_0xf7d1('0x1ab'),'foreignKey':_0xf7d1('0x184')});db[_0xf7d1('0x151')]['hasMany'](db[_0xf7d1('0x51')],{'as':'SmsApplications','foreignKey':_0xf7d1('0x184')});db[_0xf7d1('0x1ac')][_0xf7d1('0x11f')](db['MailAccount'],{});db[_0xf7d1('0x1ac')][_0xf7d1('0x11f')](db[_0xf7d1('0x9a')],{'foreignKey':_0xf7d1('0x1ad')});db['Schedule']['belongsTo'](db[_0xf7d1('0x1ae')],{'foreignKey':_0xf7d1('0x1af')});db['Sound'][_0xf7d1('0x122')](db['VoiceMusicOnHold'],{'as':_0xf7d1('0x1b0'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0xf7d1('0x88')][_0xf7d1('0x122')](db[_0xf7d1('0x6e')],{'through':'cm_contact_has_tags'});db[_0xf7d1('0x88')][_0xf7d1('0x122')](db[_0xf7d1('0x63')],{'through':_0xf7d1('0x193')});db[_0xf7d1('0x88')]['belongsToMany'](db[_0xf7d1('0x3e')],{'through':'mail_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0xf7d1('0x119')],{'through':_0xf7d1('0x186')});db[_0xf7d1('0x88')][_0xf7d1('0x122')](db[_0xf7d1('0x4a')],{'through':'fax_interaction_has_tags'});db[_0xf7d1('0x88')]['belongsToMany'](db[_0xf7d1('0x5a')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xf7d1('0x122')](db[_0xf7d1('0x11b')],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem'][_0xf7d1('0x11f')](db[_0xf7d1('0x8a')],{'as':_0xf7d1('0x1b1'),'foreignKey':_0xf7d1('0x1b2')});db[_0xf7d1('0x8e')]['belongsTo'](db[_0xf7d1('0x6f')],{'as':_0xf7d1('0x1b3'),'foreignKey':_0xf7d1('0x19e')});db[_0xf7d1('0x8c')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':'Contact','foreignKey':_0xf7d1('0x19c')});db[_0xf7d1('0x92')][_0xf7d1('0x111')](db[_0xf7d1('0x7e')],{'as':{'plural':'AllConditions','singular':_0xf7d1('0x1b4')},'foreignKey':_0xf7d1('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xf7d1('0x92')]['hasMany'](db[_0xf7d1('0x7e')],{'as':{'plural':_0xf7d1('0x1b6'),'singular':'AnyCondition'},'foreignKey':_0xf7d1('0x1b7'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x92')][_0xf7d1('0x111')](db[_0xf7d1('0x78')],{'as':_0xf7d1('0x1a6'),'foreignKey':_0xf7d1('0x1b8'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db[_0xf7d1('0x1ae')][_0xf7d1('0x111')](db[_0xf7d1('0x9e')],{'as':_0xf7d1('0x1b9'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1af'),'hooks':!![]});db[_0xf7d1('0x9a')]['hasMany'](db[_0xf7d1('0x9e')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xf7d1('0x1ad')});db[_0xf7d1('0x9c')][_0xf7d1('0x111')](db[_0xf7d1('0x9e')],{'as':'Fields','onDelete':_0xf7d1('0x110'),'foreignKey':'MetricId'});db['AnalyticFieldReport']['belongsTo'](db[_0xf7d1('0x9c')],{'foreignKey':_0xf7d1('0x1ba')});db[_0xf7d1('0x1bb')][_0xf7d1('0x111')](db[_0xf7d1('0x1bc')],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0x1bc')][_0xf7d1('0x111')](db[_0xf7d1('0x1bf')],{'as':_0xf7d1('0x1c0'),'onDelete':_0xf7d1('0x110'),'foreignKey':'SubjectId'});db[_0xf7d1('0x1bc')][_0xf7d1('0x111')](db[_0xf7d1('0x1bf')],{'as':_0xf7d1('0x1c1'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0x1bc')][_0xf7d1('0x111')](db[_0xf7d1('0x1bf')],{'as':_0xf7d1('0x1b9'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0x1bc')][_0xf7d1('0x11f')](db[_0xf7d1('0x1bb')],{'as':'Account','foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0x1bf')]['hasMany'](db[_0xf7d1('0x1bf')],{'as':_0xf7d1('0x1c4'),'foreignKey':_0xf7d1('0x1c5')});db['SalesforceField'][_0xf7d1('0x111')](db['SalesforceField'],{'as':_0xf7d1('0x1c6'),'foreignKey':'DescriptionId'});db[_0xf7d1('0x1bf')][_0xf7d1('0x111')](db['SalesforceField'],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db['SalesforceField']['belongsTo'](db['Variable'],{'as':_0xf7d1('0x94'),'foreignKey':'VariableId'});db['SugarcrmAccount']['hasMany'](db[_0xf7d1('0xa6')],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xa6')][_0xf7d1('0x111')](db[_0xf7d1('0xa8')],{'as':_0xf7d1('0x1c0'),'onDelete':_0xf7d1('0x110'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0xf7d1('0x111')](db[_0xf7d1('0xa8')],{'as':_0xf7d1('0x1c1'),'onDelete':'cascade','foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xa6')][_0xf7d1('0x111')](db[_0xf7d1('0xa8')],{'as':_0xf7d1('0x1b9'),'onDelete':_0xf7d1('0x110'),'foreignKey':'FieldId'});db[_0xf7d1('0xa6')][_0xf7d1('0x11f')](db[_0xf7d1('0xa4')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xa8')][_0xf7d1('0x111')](db[_0xf7d1('0xa8')],{'as':'Subject','foreignKey':_0xf7d1('0x1c5')});db['SugarcrmField'][_0xf7d1('0x111')](db['SugarcrmField'],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0xf7d1('0x111')](db[_0xf7d1('0xa8')],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xa8')]['belongsTo'](db[_0xf7d1('0x94')],{'as':_0xf7d1('0x94'),'foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0x1c9')]['hasMany'](db[_0xf7d1('0xaa')],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db['DeskConfiguration'][_0xf7d1('0x111')](db[_0xf7d1('0xac')],{'as':'Subjects','onDelete':_0xf7d1('0x110'),'foreignKey':'SubjectId'});db[_0xf7d1('0xaa')][_0xf7d1('0x111')](db[_0xf7d1('0xac')],{'as':_0xf7d1('0x1c1'),'onDelete':'cascade','foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xaa')][_0xf7d1('0x111')](db[_0xf7d1('0xac')],{'as':_0xf7d1('0x1b9'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c3')});db['DeskConfiguration'][_0xf7d1('0x11f')](db[_0xf7d1('0x1c9')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xaa')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':_0xf7d1('0x1ca')});db[_0xf7d1('0xac')][_0xf7d1('0x111')](db[_0xf7d1('0xac')],{'as':'Subject','foreignKey':_0xf7d1('0x1c5')});db['DeskField'][_0xf7d1('0x111')](db[_0xf7d1('0xac')],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xac')][_0xf7d1('0x111')](db['DeskField'],{'as':'Field','foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xac')][_0xf7d1('0x11f')](db['Variable'],{'as':_0xf7d1('0x94'),'foreignKey':'VariableId'});db[_0xf7d1('0xae')][_0xf7d1('0x111')](db[_0xf7d1('0xaf')],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xaf')][_0xf7d1('0x111')](db[_0xf7d1('0x1cb')],{'as':_0xf7d1('0x1c0'),'onDelete':_0xf7d1('0x110'),'foreignKey':'SubjectId'});db[_0xf7d1('0xaf')][_0xf7d1('0x111')](db['ZohoField'],{'as':_0xf7d1('0x1c1'),'onDelete':'cascade','foreignKey':_0xf7d1('0x1c2')});db['ZohoConfiguration'][_0xf7d1('0x111')](db[_0xf7d1('0x1cb')],{'as':_0xf7d1('0x1b9'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xaf')][_0xf7d1('0x11f')](db[_0xf7d1('0xae')],{'as':_0xf7d1('0x16d'),'foreignKey':'AccountId'});db[_0xf7d1('0x1cb')][_0xf7d1('0x111')](db[_0xf7d1('0x1cb')],{'as':_0xf7d1('0x1c4'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0x1cb')][_0xf7d1('0x111')](db[_0xf7d1('0x1cb')],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0x1cb')][_0xf7d1('0x111')](db[_0xf7d1('0x1cb')],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0x1cb')][_0xf7d1('0x11f')](db[_0xf7d1('0x94')],{'as':_0xf7d1('0x94'),'foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0xb1')][_0xf7d1('0x111')](db['ZendeskConfiguration'],{'as':_0xf7d1('0x1bd'),'onDelete':'cascade','foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xb2')][_0xf7d1('0x111')](db[_0xf7d1('0xb4')],{'as':_0xf7d1('0x1c0'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0xb2')][_0xf7d1('0x111')](db[_0xf7d1('0xb4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xf7d1('0xb2')][_0xf7d1('0x111')](db[_0xf7d1('0xb4')],{'as':_0xf7d1('0x1b9'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xb2')][_0xf7d1('0x11f')](db[_0xf7d1('0xb1')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xb2')]['belongsToMany'](db['Tag'],{'through':_0xf7d1('0x1cc')});db[_0xf7d1('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0xf7d1('0x1c4'),'foreignKey':'SubjectId'});db[_0xf7d1('0xb4')][_0xf7d1('0x111')](db[_0xf7d1('0xb4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf7d1('0xb4')][_0xf7d1('0x111')](db['ZendeskField'],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xb4')][_0xf7d1('0x11f')](db[_0xf7d1('0x94')],{'as':_0xf7d1('0x94'),'foreignKey':'VariableId'});db[_0xf7d1('0x1cd')][_0xf7d1('0x111')](db[_0xf7d1('0x1ce')],{'as':'Configurations','onDelete':_0xf7d1('0x110'),'foreignKey':'AccountId'});db[_0xf7d1('0x1ce')][_0xf7d1('0x111')](db['FreshdeskField'],{'as':_0xf7d1('0x1c0'),'onDelete':'cascade','foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0x1ce')]['hasMany'](db['FreshdeskField'],{'as':_0xf7d1('0x1c1'),'onDelete':_0xf7d1('0x110'),'foreignKey':'DescriptionId'});db[_0xf7d1('0x1ce')][_0xf7d1('0x111')](db[_0xf7d1('0xb6')],{'as':_0xf7d1('0x1b9'),'onDelete':'cascade','foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0x1ce')][_0xf7d1('0x11f')](db[_0xf7d1('0x1cd')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1be')});db['FreshdeskConfiguration'][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xf7d1('0xb6')][_0xf7d1('0x111')](db['FreshdeskField'],{'as':_0xf7d1('0x1c4'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xb6')][_0xf7d1('0x111')](db[_0xf7d1('0xb6')],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xb6')][_0xf7d1('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0xb7')][_0xf7d1('0x111')](db[_0xf7d1('0xb8')],{'as':'Configurations','onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xb8')][_0xf7d1('0x111')](db[_0xf7d1('0xba')],{'as':_0xf7d1('0x1c0'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0xb8')]['hasMany'](db[_0xf7d1('0xba')],{'as':_0xf7d1('0x1c1'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xb8')][_0xf7d1('0x111')](db[_0xf7d1('0xba')],{'as':'Fields','foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xb8')]['belongsTo'](db[_0xf7d1('0xb7')],{'as':_0xf7d1('0x16d'),'foreignKey':'AccountId'});db[_0xf7d1('0xba')]['hasMany'](db[_0xf7d1('0xba')],{'as':_0xf7d1('0x1c4'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0xba')][_0xf7d1('0x111')](db['VtigerField'],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xba')][_0xf7d1('0x111')](db[_0xf7d1('0xba')],{'as':_0xf7d1('0x1c7'),'foreignKey':'FieldId'});db[_0xf7d1('0xba')]['belongsTo'](db[_0xf7d1('0x94')],{'as':'Variable','foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0xbc')][_0xf7d1('0x111')](db[_0xf7d1('0xbe')],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xbe')][_0xf7d1('0x111')](db['ServicenowField'],{'as':_0xf7d1('0x1c0'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0xbe')][_0xf7d1('0x111')](db[_0xf7d1('0xc0')],{'as':_0xf7d1('0x1c1'),'foreignKey':_0xf7d1('0x1c2')});db['ServicenowConfiguration']['hasMany'](db[_0xf7d1('0xc0')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db[_0xf7d1('0xbc')],{'as':_0xf7d1('0x16d'),'foreignKey':'AccountId'});db['ServicenowField'][_0xf7d1('0x111')](db[_0xf7d1('0xc0')],{'as':_0xf7d1('0x1c4'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0xc0')][_0xf7d1('0x111')](db[_0xf7d1('0xc0')],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xc0')][_0xf7d1('0x111')](db[_0xf7d1('0xc0')],{'as':_0xf7d1('0x1c7'),'foreignKey':'FieldId'});db[_0xf7d1('0xc0')][_0xf7d1('0x11f')](db[_0xf7d1('0x94')],{'as':_0xf7d1('0x94'),'foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0xc1')][_0xf7d1('0x111')](db[_0xf7d1('0xc2')],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xc1')][_0xf7d1('0x11f')](db['CloudProvider'],{'as':_0xf7d1('0x102'),'foreignKey':_0xf7d1('0x1cf')});db[_0xf7d1('0xc2')][_0xf7d1('0x111')](db['Dynamics365Field'],{'as':_0xf7d1('0x1c0'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c5')});db['Dynamics365Configuration']['hasMany'](db[_0xf7d1('0x1d0')],{'as':_0xf7d1('0x1c1'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c2')});db['Dynamics365Configuration'][_0xf7d1('0x111')](db['Dynamics365Field'],{'as':_0xf7d1('0x1b9'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1c3')});db['Dynamics365Configuration']['belongsTo'](db[_0xf7d1('0xc1')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0x1d0')][_0xf7d1('0x111')](db[_0xf7d1('0x1d0')],{'as':_0xf7d1('0x1c4'),'foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0x1d0')][_0xf7d1('0x111')](db[_0xf7d1('0x1d0')],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0x1d0')]['hasMany'](db['Dynamics365Field'],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0x1d0')]['belongsTo'](db[_0xf7d1('0x94')],{'as':_0xf7d1('0x94'),'foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0xc5')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0xf7d1('0x1bd'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1be')});db['FreshsalesConfiguration']['hasMany'](db[_0xf7d1('0xc8')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xf7d1('0xc6')][_0xf7d1('0x111')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xf7d1('0x1c2')});db[_0xf7d1('0xc6')][_0xf7d1('0x111')](db[_0xf7d1('0xc8')],{'as':_0xf7d1('0x1b9'),'foreignKey':_0xf7d1('0x1c3')});db[_0xf7d1('0xc6')][_0xf7d1('0x11f')](db[_0xf7d1('0xc5')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1be')});db[_0xf7d1('0xc8')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xf7d1('0x1c5')});db[_0xf7d1('0xc8')][_0xf7d1('0x111')](db[_0xf7d1('0xc8')],{'as':_0xf7d1('0x1c6'),'foreignKey':_0xf7d1('0x1c2')});db['FreshsalesField']['hasMany'](db[_0xf7d1('0xc8')],{'as':_0xf7d1('0x1c7'),'foreignKey':_0xf7d1('0x1c3')});db['FreshsalesField'][_0xf7d1('0x11f')](db[_0xf7d1('0x94')],{'as':_0xf7d1('0x94'),'foreignKey':_0xf7d1('0x1c8')});db[_0xf7d1('0xcb')]['belongsTo'](db[_0xf7d1('0x13a')],{});db['ChatQueueReport']['belongsTo'](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x168'),'foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0xcb')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0xcb')]['belongsTo'](db['ChatInteraction'],{});db[_0xf7d1('0xcb')]['belongsTo'](db[_0xf7d1('0x65')],{});db[_0xf7d1('0xcb')]['belongsTo'](db[_0xf7d1('0x12')],{});db[_0xf7d1('0xcb')]['belongsTo'](db[_0xf7d1('0x68')],{});db[_0xf7d1('0xcd')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1d1')});db['ChatInternalMessage']['belongsTo'](db[_0xf7d1('0x12')],{'onDelete':'cascade','foreignKey':_0xf7d1('0x1d2')});db[_0xf7d1('0x14b')][_0xf7d1('0x111')](db[_0xf7d1('0x1d3')],{'foreignKey':'SessionId','onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x14b')][_0xf7d1('0x111')](db[_0xf7d1('0xcf')],{'foreignKey':'SessionId','onDelete':_0xf7d1('0x110')});db[_0xf7d1('0xd1')][_0xf7d1('0x11f')](db[_0xf7d1('0x140')],{});db[_0xf7d1('0xd1')][_0xf7d1('0x11f')](db['CmList'],{'as':'List','foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0xd1')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':_0xf7d1('0x15f')});db[_0xf7d1('0xd1')][_0xf7d1('0x11f')](db['SmsInteraction'],{});db[_0xf7d1('0xd1')]['belongsTo'](db[_0xf7d1('0x53')],{});db[_0xf7d1('0xd1')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{});db['SmsQueueReport'][_0xf7d1('0x11f')](db['SmsQueue'],{});db['JscriptyProject'][_0xf7d1('0x111')](db['JscriptySessionReport'],{'foreignKey':_0xf7d1('0x1d4')});db[_0xf7d1('0xd6')][_0xf7d1('0x111')](db[_0xf7d1('0x1d3')],{'foreignKey':_0xf7d1('0x1d4')});db[_0xf7d1('0xd6')][_0xf7d1('0x111')](db[_0xf7d1('0xcf')],{'foreignKey':'ProjectId'});db['Team'][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x127')});db[_0xf7d1('0xe1')][_0xf7d1('0x122')](db['VoiceQueue'],{'through':_0xf7d1('0x104'),'as':'VoiceQueues'});db[_0xf7d1('0xe1')][_0xf7d1('0x122')](db[_0xf7d1('0x3b')],{'through':_0xf7d1('0x16b'),'as':'MailQueues'});db[_0xf7d1('0xe1')][_0xf7d1('0x122')](db[_0xf7d1('0x68')],{'through':_0xf7d1('0x197'),'as':_0xf7d1('0x132')});db[_0xf7d1('0xe1')][_0xf7d1('0x122')](db[_0xf7d1('0x4c')],{'through':_0xf7d1('0x181'),'as':'FaxQueues'});db[_0xf7d1('0xe1')][_0xf7d1('0x122')](db[_0xf7d1('0x55')],{'through':_0xf7d1('0x1d5'),'as':_0xf7d1('0x135')});db[_0xf7d1('0xe1')][_0xf7d1('0x122')](db[_0xf7d1('0x5d')],{'through':_0xf7d1('0x18e'),'as':_0xf7d1('0x137')});db['Team'][_0xf7d1('0x122')](db[_0xf7d1('0x100')],{'through':_0xf7d1('0x1d6'),'as':_0xf7d1('0x138')});db['Team'][_0xf7d1('0x122')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db['Campaign'][_0xf7d1('0x111')](db[_0xf7d1('0x6f')],{'as':'Hoppers','foreignKey':_0xf7d1('0x1a1')});db[_0xf7d1('0x1a0')][_0xf7d1('0x111')](db[_0xf7d1('0x72')],{'as':_0xf7d1('0x115'),'foreignKey':_0xf7d1('0x1a1')});db[_0xf7d1('0x1a0')]['hasMany'](db['CmHopperHistory'],{'as':_0xf7d1('0x149'),'foreignKey':'CampaignId'});db[_0xf7d1('0x1a0')][_0xf7d1('0x111')](db[_0xf7d1('0x71')],{'as':_0xf7d1('0x14a'),'foreignKey':_0xf7d1('0x1a1')});db[_0xf7d1('0x1a0')][_0xf7d1('0x11f')](db['Trunk'],{'as':_0xf7d1('0x14e'),'foreignKey':'TrunkId'});db[_0xf7d1('0x1a0')][_0xf7d1('0x11f')](db[_0xf7d1('0x14e')],{'as':_0xf7d1('0x14f'),'foreignKey':_0xf7d1('0x150')});db[_0xf7d1('0x1a0')]['belongsTo'](db[_0xf7d1('0x151')],{'as':_0xf7d1('0x151'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db['SquareProject'],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xf7d1('0x1a0')]['belongsToMany'](db[_0xf7d1('0x125')],{'as':'Lists','through':_0xf7d1('0x1d7')});db[_0xf7d1('0x1a0')][_0xf7d1('0x122')](db[_0xf7d1('0x125')],{'as':_0xf7d1('0x155'),'through':_0xf7d1('0x1d8')});db[_0xf7d1('0x171')][_0xf7d1('0x11f')](db['ChatOfflineMessage'],{'as':_0xf7d1('0x67'),'foreignKey':_0xf7d1('0x196')});db[_0xf7d1('0xe9')][_0xf7d1('0x11f')](db[_0xf7d1('0x40')],{});db[_0xf7d1('0xe9')][_0xf7d1('0x11f')](db[_0xf7d1('0x3e')],{});db[_0xf7d1('0xe9')]['belongsTo'](db[_0xf7d1('0x3a')],{'foreignKey':_0xf7d1('0x1d9'),'as':_0xf7d1('0x1da')});db[_0xf7d1('0xe9')]['belongsTo'](db[_0xf7d1('0x12')],{'foreignKey':'FromUserId','as':_0xf7d1('0x1db')});db[_0xf7d1('0xe9')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'foreignKey':'ToUserId','as':_0xf7d1('0x1dc')});db['MailTransferReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x3b')],{'foreignKey':_0xf7d1('0x1dd'),'as':_0xf7d1('0x1de')});db[_0xf7d1('0xe9')][_0xf7d1('0x11f')](db['MailAccount'],{'foreignKey':_0xf7d1('0x1df'),'as':'ToAccount'});db[_0xf7d1('0x1e0')][_0xf7d1('0x11f')](db['ChatMessage'],{});db[_0xf7d1('0x1e0')]['belongsTo'](db[_0xf7d1('0x63')],{});db[_0xf7d1('0x1e0')][_0xf7d1('0x11f')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xf7d1('0x1e0')]['belongsTo'](db[_0xf7d1('0x12')],{'foreignKey':_0xf7d1('0x1e1'),'as':_0xf7d1('0x1db')});db[_0xf7d1('0x1e0')][_0xf7d1('0x11f')](db['User'],{'foreignKey':'ToUserId','as':_0xf7d1('0x1dc')});db[_0xf7d1('0x1e0')][_0xf7d1('0x11f')](db[_0xf7d1('0x68')],{'foreignKey':_0xf7d1('0x1e2'),'as':_0xf7d1('0x1de')});db[_0xf7d1('0x1e0')][_0xf7d1('0x11f')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xf7d1('0x1e3')});db[_0xf7d1('0x1e4')][_0xf7d1('0x11f')](db['FaxMessage'],{});db[_0xf7d1('0x1e4')][_0xf7d1('0x11f')](db[_0xf7d1('0x4a')],{});db[_0xf7d1('0x1e4')][_0xf7d1('0x11f')](db[_0xf7d1('0x49')],{'foreignKey':_0xf7d1('0x1e5'),'as':_0xf7d1('0x1da')});db[_0xf7d1('0x1e4')]['belongsTo'](db[_0xf7d1('0x12')],{'foreignKey':_0xf7d1('0x1e1'),'as':_0xf7d1('0x1db')});db[_0xf7d1('0x1e4')]['belongsTo'](db[_0xf7d1('0x12')],{'foreignKey':_0xf7d1('0x1e6'),'as':'ToAgent'});db[_0xf7d1('0x1e4')][_0xf7d1('0x11f')](db['FaxQueue'],{'foreignKey':_0xf7d1('0x1e7'),'as':_0xf7d1('0x1de')});db[_0xf7d1('0x1e4')][_0xf7d1('0x11f')](db[_0xf7d1('0x49')],{'foreignKey':_0xf7d1('0x1e8'),'as':_0xf7d1('0x1e3')});db[_0xf7d1('0xeb')][_0xf7d1('0x11f')](db[_0xf7d1('0x5b')],{});db['OpenchannelTransferReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x5a')],{});db[_0xf7d1('0xeb')][_0xf7d1('0x11f')](db['OpenchannelAccount'],{'foreignKey':_0xf7d1('0x1e9'),'as':_0xf7d1('0x1da')});db[_0xf7d1('0xeb')]['belongsTo'](db['User'],{'foreignKey':_0xf7d1('0x1e1'),'as':'FromAgent'});db[_0xf7d1('0xeb')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'foreignKey':_0xf7d1('0x1e6'),'as':'ToAgent'});db[_0xf7d1('0xeb')]['belongsTo'](db[_0xf7d1('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0xf7d1('0x1de')});db[_0xf7d1('0xeb')][_0xf7d1('0x11f')](db[_0xf7d1('0x57')],{'foreignKey':_0xf7d1('0x1ea'),'as':_0xf7d1('0x1e3')});db[_0xf7d1('0x1eb')][_0xf7d1('0x11f')](db['SmsMessage'],{});db['SmsTransferReport']['belongsTo'](db[_0xf7d1('0x119')],{});db['SmsTransferReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x140')],{'foreignKey':_0xf7d1('0x1ec'),'as':_0xf7d1('0x1da')});db[_0xf7d1('0x1eb')]['belongsTo'](db[_0xf7d1('0x12')],{'foreignKey':_0xf7d1('0x1e1'),'as':_0xf7d1('0x1db')});db[_0xf7d1('0x1eb')]['belongsTo'](db['User'],{'foreignKey':_0xf7d1('0x1e6'),'as':_0xf7d1('0x1dc')});db[_0xf7d1('0x1eb')]['belongsTo'](db[_0xf7d1('0x55')],{'foreignKey':'ToSmsQueueId','as':_0xf7d1('0x1de')});db['SmsTransferReport']['belongsTo'](db[_0xf7d1('0x140')],{'foreignKey':'ToSmsAccountId','as':_0xf7d1('0x1e3')});db[_0xf7d1('0x125')]['hasMany'](db['Disposition'],{'as':_0xf7d1('0x175'),'foreignKey':_0xf7d1('0x182'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0x125')][_0xf7d1('0x111')](db[_0xf7d1('0x1ed')],{'as':_0xf7d1('0x1ee'),'foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0x125')]['hasMany'](db['CmContact'],{'as':_0xf7d1('0x123'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x182')});db['CmList']['hasMany'](db[_0xf7d1('0x72')],{'as':_0xf7d1('0x115'),'foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0x125')][_0xf7d1('0x111')](db['CmHopperHistory'],{'as':_0xf7d1('0x116'),'foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0x125')][_0xf7d1('0x111')](db[_0xf7d1('0x117')],{'as':_0xf7d1('0x117'),'foreignKey':_0xf7d1('0x182')});db[_0xf7d1('0x125')][_0xf7d1('0x122')](db[_0xf7d1('0x1c')],{'as':_0xf7d1('0x1ef'),'through':'voice_queues_has_cm_lists'});db[_0xf7d1('0x125')][_0xf7d1('0x122')](db['User'],{'as':_0xf7d1('0x16a'),'through':'cm_user_has_lists'});db[_0xf7d1('0xed')]['hasMany'](db[_0xf7d1('0x18')],{'as':_0xf7d1('0x114'),'onDelete':_0xf7d1('0x110')});db['VoicePrefix'][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':'Agents','through':'UserVoicePrefix'});db['VoicePrefix']['belongsToMany'](db[_0xf7d1('0xe1')],{'through':_0xf7d1('0x106'),'as':_0xf7d1('0x154')});db[_0xf7d1('0xef')]['hasMany'](db[_0xf7d1('0x12')],{'as':'Users','foreignKey':'userProfileId'});db[_0xf7d1('0xef')]['hasMany'](db[_0xf7d1('0xf1')],{'as':_0xf7d1('0x1f0'),'foreignKey':_0xf7d1('0x120'),'onDelete':'cascade'});db[_0xf7d1('0xf1')][_0xf7d1('0x111')](db[_0xf7d1('0xf3')],{'as':_0xf7d1('0x1f1'),'foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0xf7d1('0x165')],{'as':_0xf7d1('0x175'),'foreignKey':_0xf7d1('0x1f2'),'onDelete':'cascade'});db[_0xf7d1('0xf7')][_0xf7d1('0x111')](db[_0xf7d1('0x7b')],{'as':'Answers','foreignKey':_0xf7d1('0x1f2')});db[_0xf7d1('0xf7')]['hasMany'](db[_0xf7d1('0x1f3')],{'as':_0xf7d1('0x158'),'foreignKey':'WhatsappAccountId'});db[_0xf7d1('0xf7')][_0xf7d1('0x111')](db[_0xf7d1('0x11b')],{'as':_0xf7d1('0x167')});db[_0xf7d1('0xf7')][_0xf7d1('0x111')](db['WhatsappApplication'],{'as':_0xf7d1('0x144'),'foreignKey':_0xf7d1('0x1f2'),'onDelete':_0xf7d1('0x110')});db[_0xf7d1('0xf7')][_0xf7d1('0x11f')](db['CmList'],{'as':_0xf7d1('0x168'),'foreignKey':_0xf7d1('0x182')});db['WhatsappAccount'][_0xf7d1('0x11f')](db[_0xf7d1('0x81')],{'as':_0xf7d1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf7d1('0xf7')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x143')});db[_0xf7d1('0xf9')]['belongsTo'](db[_0xf7d1('0x12')],{'onDelete':_0xf7d1('0x162')});db['WhatsappApplication'][_0xf7d1('0x11f')](db[_0xf7d1('0x100')],{'onDelete':_0xf7d1('0x162')});db[_0xf7d1('0xf9')]['belongsTo'](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0xf7d1('0xf9')]['belongsTo'](db[_0xf7d1('0x151')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x184')});db[_0xf7d1('0xf9')]['belongsTo'](db[_0xf7d1('0x88')],{'onDelete':_0xf7d1('0x162'),'foreignKey':_0xf7d1('0x173')});db[_0xf7d1('0x11b')]['hasMany'](db[_0xf7d1('0x1f3')],{'as':_0xf7d1('0x158'),'onDelete':_0xf7d1('0x110'),'foreignKey':_0xf7d1('0x1f4')});db[_0xf7d1('0x11b')][_0xf7d1('0x11f')](db[_0xf7d1('0xf7')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1f2')});db[_0xf7d1('0x11b')]['belongsTo'](db[_0xf7d1('0x6e')],{'as':_0xf7d1('0x15e'),'foreignKey':'ContactId'});db[_0xf7d1('0x11b')]['belongsTo'](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x17c'),'foreignKey':_0xf7d1('0x10d')});db[_0xf7d1('0x11b')]['belongsToMany'](db['Tag'],{'through':_0xf7d1('0x1f5'),'as':_0xf7d1('0x16e')});db[_0xf7d1('0x11b')][_0xf7d1('0x122')](db[_0xf7d1('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0xf7d1('0x170')});db[_0xf7d1('0x11b')][_0xf7d1('0x122')](db['User'],{'as':_0xf7d1('0x17e'),'through':_0xf7d1('0x12f'),'foreignKey':'WhatsappInteractionId'});db[_0xf7d1('0x1f3')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x12')});db[_0xf7d1('0x1f3')][_0xf7d1('0x11f')](db[_0xf7d1('0x6e')],{'onDelete':_0xf7d1('0x110'),'as':_0xf7d1('0x15e')});db[_0xf7d1('0x1f3')][_0xf7d1('0x11f')](db[_0xf7d1('0x11b')],{'onDelete':'cascade','as':_0xf7d1('0x17f'),'foreignKey':_0xf7d1('0x1f4')});db[_0xf7d1('0x1f3')]['belongsTo'](db[_0xf7d1('0xf7')],{'as':_0xf7d1('0x16d'),'foreignKey':_0xf7d1('0x1f2')});db[_0xf7d1('0xfc')][_0xf7d1('0x11f')](db['WhatsappAccount'],{});db[_0xf7d1('0xfc')][_0xf7d1('0x11f')](db[_0xf7d1('0x125')],{'as':'List','foreignKey':_0xf7d1('0x182')});db['WhatsappQueueReport']['belongsTo'](db[_0xf7d1('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappQueueReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x11b')],{});db[_0xf7d1('0xfc')][_0xf7d1('0x11f')](db[_0xf7d1('0x100')],{});db[_0xf7d1('0xfc')][_0xf7d1('0x11f')](db[_0xf7d1('0x1f3')],{});db['WhatsappQueueReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{});db['WhatsappTransferReport'][_0xf7d1('0x11f')](db[_0xf7d1('0x1f3')],{});db[_0xf7d1('0xfe')][_0xf7d1('0x11f')](db[_0xf7d1('0x11b')],{});db[_0xf7d1('0xfe')][_0xf7d1('0x11f')](db[_0xf7d1('0xf7')],{'foreignKey':_0xf7d1('0x1f6'),'as':_0xf7d1('0x1da')});db['WhatsappTransferReport'][_0xf7d1('0x11f')](db['WhatsappAccount'],{'foreignKey':_0xf7d1('0x1f7'),'as':_0xf7d1('0x1e3')});db[_0xf7d1('0xfe')][_0xf7d1('0x11f')](db[_0xf7d1('0x100')],{'foreignKey':_0xf7d1('0x1f8'),'as':_0xf7d1('0x1de')});db[_0xf7d1('0xfe')][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'foreignKey':_0xf7d1('0x1e1'),'as':_0xf7d1('0x1db')});db[_0xf7d1('0xfe')][_0xf7d1('0x11f')](db['User'],{'foreignKey':_0xf7d1('0x1e6'),'as':_0xf7d1('0x1dc')});db[_0xf7d1('0x100')][_0xf7d1('0x122')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x16a'),'through':_0xf7d1('0x35'),'foreignKey':_0xf7d1('0x1f9')});db[_0xf7d1('0x100')]['belongsToMany'](db[_0xf7d1('0xe1')],{'through':_0xf7d1('0x1d6'),'as':_0xf7d1('0x154')});db['UserSetting'][_0xf7d1('0x11f')](db[_0xf7d1('0x12')],{'as':_0xf7d1('0x1fa'),'foreignKey':_0xf7d1('0x10d'),'onDelete':_0xf7d1('0x110'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0xf7d1('0xc1')],{'as':'Dynamics365Account','onDelete':_0xf7d1('0x162')});db[_0xf7d1('0x102')][_0xf7d1('0x10c')](db['MailServerIn'],{'as':_0xf7d1('0x163'),'onDelete':'restrict'});db[_0xf7d1('0x102')][_0xf7d1('0x10c')](db[_0xf7d1('0x38')],{'as':_0xf7d1('0x164'),'onDelete':'restrict'});module[_0xf7d1('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2902=['sms_interaction_has_tags','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueue','Website','ChatInteractionId','Attachments','team_has_chat_queues','chat_group_has_users','CmCompany','CompanyId','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','AutomationAnyId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','chat_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','Description','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','ServicenowField','FreshsalesField','FromId','ChatInternalMessage','ToId','SessionId','ProjectId','JscriptyProject','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','UserProfile','UserProfileSections','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','UserWhatsappQueue','WhatsappQueueId','UserSetting','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','sequelizeHistory','mysql','utf8_general_ci','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','userSetting','hasMany','Recordings','UserId','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','userProfileId','belongsToMany','Groups','CmContact','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','WhatsappInteraction','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','cm_user_has_lists','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','belongsTo','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Answers','MailAccountId','Interactions','List','ListId','team_has_mail_queues','Teams','Account','Owner','Tag','Tags','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','MailQueueReport','FaxApplication','FaxAccountId','Pause','Agents','FaxInteractionId','fax_interaction_has_tags','AttachmentId','Dispositions','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2902,0x77));var _0x2290=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0x2902[_0x5af59e];return _0x4240df;};'use strict';var config=require(_0x2290('0x0'));var Sequelize=require(_0x2290('0x1'));var _=require(_0x2290('0x2'));var jstz=require(_0x2290('0x3'));var timezone=jstz['determine']();config[_0x2290('0x1')]=_[_0x2290('0x4')](config[_0x2290('0x1')],{'database':'motion2','username':_0x2290('0x5'),'password':_0x2290('0x6'),'options':{'host':_0x2290('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2290('0x8')},'logging':![],'timezone':timezone[_0x2290('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x2290('0xa')]=_[_0x2290('0x4')](config[_0x2290('0xa')],{'database':'motion2','username':_0x2290('0x5'),'password':'xC@LL1234','options':{'host':_0x2290('0x7'),'port':0xcea,'dialect':_0x2290('0xb'),'dialectOptions':{'charset':_0x2290('0x8')},'logging':![],'timezone':timezone[_0x2290('0x9')](),'define':{'charset':'utf8','collate':_0x2290('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2290('0x1')][_0x2290('0xd')],config[_0x2290('0x1')][_0x2290('0xe')],config[_0x2290('0x1')][_0x2290('0xf')],config[_0x2290('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2290('0xa')]['database'],config[_0x2290('0xa')][_0x2290('0xe')],config[_0x2290('0xa')][_0x2290('0xf')],config['sequelizeHistory']['options'])};db[_0x2290('0x10')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x12'));db[_0x2290('0x13')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x14'));db[_0x2290('0x15')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x16'));db[_0x2290('0x17')]=db[_0x2290('0x1')]['import'](_0x2290('0x18'));db[_0x2290('0x19')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x1a'));db[_0x2290('0x1b')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x1c'));db[_0x2290('0x1d')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x1e'));db[_0x2290('0x1f')]=db[_0x2290('0x1')]['import'](_0x2290('0x20'));db[_0x2290('0x21')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/voiceMail/voiceMail.model');db[_0x2290('0x22')]=db[_0x2290('0x1')]['import'](_0x2290('0x23'));db[_0x2290('0x24')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x25'));db[_0x2290('0x26')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x27'));db[_0x2290('0x28')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x29'));db['VoiceQueueReport']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x2a'));db[_0x2290('0x2b')]=db['sequelize']['import'](_0x2290('0x2c'));db[_0x2290('0x2d')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/trunk/trunk.model');db[_0x2290('0x2e')]=db[_0x2290('0x1')]['import'](_0x2290('0x2f'));db[_0x2290('0x30')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x2290('0x31')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x32'));db['UserChatQueue']=db['sequelize'][_0x2290('0x11')](_0x2290('0x33'));db['UserMailQueue']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x34'));db[_0x2290('0x35')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/userFaxQueue/userFaxQueue.model');db[_0x2290('0x36')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x37'));db['UserOpenchannelQueue']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x38'));db['UserWhatsappQueue']=db['sequelize'][_0x2290('0x11')](_0x2290('0x39'));db['MailServerIn']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x3a'));db[_0x2290('0x3b')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x3c'));db[_0x2290('0x3d')]=db[_0x2290('0x1')]['import'](_0x2290('0x3e'));db[_0x2290('0x3f')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x40'));db['MailSubstatus']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x41'));db[_0x2290('0x42')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/mailInteraction/mailInteraction.model');db[_0x2290('0x43')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/mailMessage/mailMessage.model');db[_0x2290('0x44')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x45'));db['MailQueueReport']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x46'));db[_0x2290('0x47')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/dashboard/dashboard.model');db[_0x2290('0x48')]=db[_0x2290('0x1')]['import'](_0x2290('0x49'));db[_0x2290('0x4a')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x4b'));db['FaxApplication']=db[_0x2290('0x1')][_0x2290('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x4c'));db[_0x2290('0x4d')]=db[_0x2290('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0x2290('0x4e')]=db['sequelize'][_0x2290('0x11')]('../api/faxQueue/faxQueue.model');db[_0x2290('0x4f')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x50'));db['SmsAccount']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x51'));db[_0x2290('0x52')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x53'));db[_0x2290('0x54')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x2290('0x1')]['import'](_0x2290('0x55'));db[_0x2290('0x56')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x57'));db['OpenchannelAccount']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x58'));db['OpenchannelApplication']=db[_0x2290('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x2290('0x59')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x5a'));db[_0x2290('0x5b')]=db[_0x2290('0x1')]['import'](_0x2290('0x5c'));db[_0x2290('0x5d')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x5e'));db['ChatWebsite']=db[_0x2290('0x1')]['import'](_0x2290('0x5f'));db['OpenchannelQueueReport']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x60'));db[_0x2290('0x61')]=db[_0x2290('0x1')]['import'](_0x2290('0x62'));db[_0x2290('0x63')]=db[_0x2290('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x2290('0x64')]=db[_0x2290('0x1')]['import'](_0x2290('0x65'));db[_0x2290('0x66')]=db[_0x2290('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x67'));db[_0x2290('0x68')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x69'));db[_0x2290('0x6a')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x6b'));db['CmCompany']=db[_0x2290('0x1')][_0x2290('0x11')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x6c'));db[_0x2290('0x6d')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/cmHopper/cmHopper.model');db[_0x2290('0x6e')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x6f'));db[_0x2290('0x70')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x71'));db[_0x2290('0x72')]=db['sequelize'][_0x2290('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x2290('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x2290('0x73')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x74'));db[_0x2290('0x75')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/action/action.model');db[_0x2290('0x76')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x77'));db[_0x2290('0x78')]=db[_0x2290('0x1')]['import'](_0x2290('0x79'));db[_0x2290('0x7a')]=db[_0x2290('0x1')]['import'](_0x2290('0x7b'));db['Condition']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x7c'));db[_0x2290('0x7d')]=db[_0x2290('0x1')]['import'](_0x2290('0x7e'));db['Pause']=db[_0x2290('0x1')]['import'](_0x2290('0x7f'));db[_0x2290('0x80')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x81'));db[_0x2290('0x82')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x83'));db[_0x2290('0x84')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x85'));db[_0x2290('0x86')]=db[_0x2290('0x1')]['import'](_0x2290('0x87'));db['Tag']=db[_0x2290('0x1')][_0x2290('0x11')]('../api/tag/tag.model');db[_0x2290('0x88')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x89'));db['CmContactHasItem']=db[_0x2290('0x1')]['import'](_0x2290('0x8a'));db[_0x2290('0x8b')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x2290('0x8c')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x8d'));db[_0x2290('0x8e')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x8f'));db[_0x2290('0x90')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/variable/variable.model');db[_0x2290('0x91')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x92'));db[_0x2290('0x93')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x94'));db[_0x2290('0x95')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x96'));db[_0x2290('0x97')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x98'));db[_0x2290('0x99')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x9a'));db[_0x2290('0x9b')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x9c'));db[_0x2290('0x9d')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x9e'));db['AnalyticTreeReport']=db[_0x2290('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x2290('0x9f')]=db['sequelize']['import'](_0x2290('0xa0'));db[_0x2290('0xa1')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xa2'));db['SalesforceField']=db['sequelize'][_0x2290('0x11')](_0x2290('0xa3'));db[_0x2290('0xa4')]=db['sequelize']['import'](_0x2290('0xa5'));db[_0x2290('0xa6')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xa7'));db[_0x2290('0xa8')]=db['sequelize'][_0x2290('0x11')](_0x2290('0xa9'));db[_0x2290('0xaa')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xab'));db[_0x2290('0xac')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x2290('0xad')]=db['sequelize'][_0x2290('0x11')](_0x2290('0xae'));db[_0x2290('0xaf')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xb0'));db['ZohoConfiguration']=db[_0x2290('0x1')][_0x2290('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x2290('0xb1')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize'][_0x2290('0x11')](_0x2290('0xb2'));db[_0x2290('0xb3')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xb4'));db[_0x2290('0xb5')]=db['sequelize'][_0x2290('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0x2290('0xb6')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xb7'));db['FreshdeskConfiguration']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xb8'));db[_0x2290('0xb9')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xba'));db[_0x2290('0xbb')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xbc'));db[_0x2290('0xbd')]=db[_0x2290('0x1')]['import'](_0x2290('0xbe'));db[_0x2290('0xbf')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xc0'));db[_0x2290('0xc1')]=db['sequelize'][_0x2290('0x11')](_0x2290('0xc2'));db[_0x2290('0xc3')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xc4'));db['ServicenowField']=db['sequelize'][_0x2290('0x11')](_0x2290('0xc5'));db[_0x2290('0xc6')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xc7'));db[_0x2290('0xc8')]=db[_0x2290('0x1')]['import'](_0x2290('0xc9'));db[_0x2290('0xca')]=db['sequelize'][_0x2290('0x11')](_0x2290('0xcb'));db[_0x2290('0xcc')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xcd'));db[_0x2290('0xce')]=db[_0x2290('0x1')]['import'](_0x2290('0xcf'));db['FreshsalesField']=db[_0x2290('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x2290('0x91')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x92'));db[_0x2290('0xd0')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/network/network.model');db[_0x2290('0xd1')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xd2'));db['ChatInternalMessage']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xd3'));db[_0x2290('0xd4')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xd5'));db[_0x2290('0xd6')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xd7'));db['JscriptySessionReport']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xd8'));db[_0x2290('0xd9')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xda'));db[_0x2290('0xdb')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/squareReport/squareReport.model');db[_0x2290('0xdc')]=db['sequelize'][_0x2290('0x11')](_0x2290('0xdd'));db['JscriptyProject']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xde'));db[_0x2290('0xdf')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xe0'));db[_0x2290('0xe1')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xe2'));db[_0x2290('0xe3')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xe4'));db[_0x2290('0xe5')]=db[_0x2290('0x1')]['import'](_0x2290('0xe6'));db[_0x2290('0xe7')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xe8'));db['Team']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xe9'));db['License']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xea'));db[_0x2290('0xeb')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/campaign/campaign.model');db['Migration']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xec'));db[_0x2290('0xed')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/attachment/attachment.model');db[_0x2290('0xee')]=db['sequelize'][_0x2290('0x11')]('../api/plugin/plugin.model');db[_0x2290('0xef')]=db['sequelize']['import'](_0x2290('0xf0'));db[_0x2290('0xf1')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xf2'));db[_0x2290('0xf3')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xf4'));db['SmsTransferReport']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xf5'));db[_0x2290('0xf6')]=db[_0x2290('0x1')][_0x2290('0x11')]('../api/cmList/cmList.model');db[_0x2290('0xf7')]=db[_0x2290('0x1')]['import'](_0x2290('0xf8'));db['UserProfile']=db['sequelize'][_0x2290('0x11')](_0x2290('0xf9'));db[_0x2290('0xfa')]=db[_0x2290('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x2290('0xfb')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xfc'));db[_0x2290('0xfd')]=db['sequelize'][_0x2290('0x11')](_0x2290('0xfe'));db['WhatsappAccount']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0xff'));db['WhatsappApplication']=db['sequelize'][_0x2290('0x11')](_0x2290('0x100'));db['WhatsappInteraction']=db[_0x2290('0x1')]['import'](_0x2290('0x101'));db[_0x2290('0x102')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x103'));db['WhatsappQueueReport']=db['sequelize']['import'](_0x2290('0x104'));db[_0x2290('0x105')]=db[_0x2290('0x1')]['import'](_0x2290('0x106'));db['WhatsappQueue']=db['sequelize'][_0x2290('0x11')](_0x2290('0x107'));db['CloudProvider']=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x108'));db[_0x2290('0x109')]=db[_0x2290('0x1')][_0x2290('0x11')](_0x2290('0x10a'));db[_0x2290('0x10b')]=db['sequelize'][_0x2290('0x11')](_0x2290('0x10c'));db['UserVoicePrefix']=db['sequelize'][_0x2290('0x11')](_0x2290('0x10d'));db['UserSetting']=db[_0x2290('0x1')][_0x2290('0x11')]('../api/user-setting/user-setting.model');db[_0x2290('0x10e')]=db[_0x2290('0x1')]['import'](_0x2290('0x10f'));db['User'][_0x2290('0x110')](db[_0x2290('0x21')],{'as':_0x2290('0x21'),'onDelete':_0x2290('0x111'),'foreignKey':'UserId'});db[_0x2290('0x10')]['hasOne'](db['UserSetting'],{'as':_0x2290('0x112'),'onDelete':_0x2290('0x111'),'foreignKey':'UserId'});db['User'][_0x2290('0x113')](db[_0x2290('0x1d')],{'as':_0x2290('0x114'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x10')]['hasMany'](db[_0x2290('0x30')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x2290('0x10')]['hasMany'](db[_0x2290('0x17')],{'as':_0x2290('0x116'),'onDelete':_0x2290('0x111'),'hooks':!![]});db[_0x2290('0x10')]['hasMany'](db[_0x2290('0x70')],{'as':_0x2290('0x117'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0x72')],{'as':_0x2290('0x118'),'foreignKey':'UserId'});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0x119')],{'as':_0x2290('0x119'),'foreignKey':_0x2290('0x115')});db['User'][_0x2290('0x113')](db[_0x2290('0x59')],{'as':_0x2290('0x11a'),'foreignKey':_0x2290('0x115')});db['User']['hasMany'](db[_0x2290('0x63')],{'as':_0x2290('0x11b'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0x54')],{'as':_0x2290('0x11c'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0x11d')],{'as':_0x2290('0x11e'),'foreignKey':'UserId'});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0x42')],{'as':_0x2290('0x11f'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x10')][_0x2290('0x113')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x2290('0x115')});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0xfd')],{'as':_0x2290('0x120'),'foreignKey':_0x2290('0x121')});db[_0x2290('0x10')][_0x2290('0x113')](db[_0x2290('0x6d')],{'as':_0x2290('0x122'),'foreignKey':'UserId','onDelete':_0x2290('0x123')});db[_0x2290('0x10')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x2290('0x124')});db['User'][_0x2290('0x125')](db['ChatGroup'],{'as':_0x2290('0x126'),'through':'chat_group_has_users'});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x127')],{'as':_0x2290('0x128'),'through':_0x2290('0x129')});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0xf6')],{'as':_0x2290('0x12a'),'through':'cm_user_has_lists'});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x12b')],{'through':_0x2290('0x12c')});db[_0x2290('0x10')][_0x2290('0x125')](db['MailInteraction'],{'as':_0x2290('0x11f'),'through':_0x2290('0x12d')});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x63')],{'as':_0x2290('0x11b'),'through':_0x2290('0x12e')});db[_0x2290('0x10')]['belongsToMany'](db[_0x2290('0x11d')],{'as':_0x2290('0x11e'),'through':'user_has_fax_interactions'});db[_0x2290('0x10')][_0x2290('0x125')](db['SmsInteraction'],{'as':_0x2290('0x11c'),'through':'user_has_sms_interactions'});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x59')],{'as':_0x2290('0x11a'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db[_0x2290('0x12f')],{'as':'WhatsappInteractions','through':_0x2290('0x130')});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x1b')],{'as':_0x2290('0x131'),'through':_0x2290('0x31'),'required':![]});db[_0x2290('0x10')]['belongsToMany'](db[_0x2290('0xf7')],{'as':_0x2290('0x132'),'through':'UserVoicePrefix','required':![]});db['User'][_0x2290('0x125')](db['MailQueue'],{'as':_0x2290('0x133'),'through':_0x2290('0x134'),'required':![]});db[_0x2290('0x10')][_0x2290('0x125')](db['ChatQueue'],{'as':'ChatQueues','through':_0x2290('0x135'),'required':![],'hooks':!![]});db[_0x2290('0x10')][_0x2290('0x125')](db['FaxQueue'],{'as':_0x2290('0x136'),'through':_0x2290('0x35'),'required':![]});db[_0x2290('0x10')]['belongsToMany'](db[_0x2290('0x56')],{'as':_0x2290('0x137'),'through':'UserSmsQueue','required':![]});db[_0x2290('0x10')]['belongsToMany'](db[_0x2290('0x5d')],{'as':_0x2290('0x138'),'through':_0x2290('0x139'),'required':![]});db[_0x2290('0x10')]['belongsToMany'](db[_0x2290('0x13a')],{'as':_0x2290('0x13b'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x2290('0x125')](db[_0x2290('0xf6')],{'through':_0x2290('0x13c')});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x13d')],{'as':'ChatWebsites','through':_0x2290('0x13e')});db['User'][_0x2290('0x125')](db[_0x2290('0x4a')],{'as':_0x2290('0x13f'),'through':_0x2290('0x140')});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x3d')],{'as':_0x2290('0x141'),'through':_0x2290('0x142')});db['User'][_0x2290('0x125')](db[_0x2290('0x143')],{'as':_0x2290('0x144'),'through':_0x2290('0x145')});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x146')],{'as':_0x2290('0x147'),'through':'user_has_sms_accounts'});db[_0x2290('0x10')][_0x2290('0x125')](db[_0x2290('0x148')],{'as':_0x2290('0x149'),'through':_0x2290('0x14a')});db[_0x2290('0x13')][_0x2290('0x113')](db['VoiceExtension'],{'as':_0x2290('0x14b'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x14c')});db[_0x2290('0x15')]['hasMany'](db['VoiceExtension'],{'onDelete':_0x2290('0x111')});db[_0x2290('0x17')][_0x2290('0x113')](db['VoiceExtension'],{'as':_0x2290('0x14d'),'onDelete':_0x2290('0x111')});db[_0x2290('0x19')][_0x2290('0x125')](db[_0x2290('0x86')],{'as':_0x2290('0x14e'),'through':_0x2290('0x14f')});db[_0x2290('0x1b')][_0x2290('0x113')](db['UserVoiceQueueRt'],{'as':_0x2290('0x150'),'foreignKey':_0x2290('0x151')});db[_0x2290('0x1b')][_0x2290('0x113')](db['CmHopper'],{'as':_0x2290('0x122'),'foreignKey':_0x2290('0x151')});db[_0x2290('0x1b')][_0x2290('0x113')](db[_0x2290('0x70')],{'as':_0x2290('0x117'),'foreignKey':_0x2290('0x151')});db[_0x2290('0x1b')][_0x2290('0x113')](db['CmHopperHistory'],{'as':_0x2290('0x152'),'foreignKey':_0x2290('0x151')});db[_0x2290('0x1b')]['hasMany'](db[_0x2290('0x119')],{'as':_0x2290('0x119'),'foreignKey':_0x2290('0x151')});db[_0x2290('0x1b')][_0x2290('0x113')](db[_0x2290('0x6e')],{'as':_0x2290('0x153'),'foreignKey':_0x2290('0x151')});db['VoiceQueue']['hasMany'](db[_0x2290('0x154')],{'as':_0x2290('0x155'),'foreignKey':_0x2290('0x151')});db[_0x2290('0x1b')][_0x2290('0x156')](db[_0x2290('0x2d')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x2290('0x1b')][_0x2290('0x156')](db[_0x2290('0x2d')],{'as':'TrunkBackup','foreignKey':_0x2290('0x157')});db[_0x2290('0x1b')]['belongsTo'](db[_0x2290('0x7d')],{'as':_0x2290('0x7d'),'foreignKey':'IntervalId'});db[_0x2290('0x1b')][_0x2290('0x156')](db['Pause'],{'as':_0x2290('0x158'),'foreignKey':_0x2290('0x159')});db[_0x2290('0x1b')][_0x2290('0x125')](db[_0x2290('0xf6')],{'as':'Lists','through':_0x2290('0x15a')});db['VoiceQueue']['belongsToMany'](db[_0x2290('0x10')],{'as':'Agents','through':_0x2290('0x31')});db[_0x2290('0x1b')][_0x2290('0x125')](db[_0x2290('0x12b')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x2290('0x1b')]['belongsToMany'](db[_0x2290('0xf6')],{'as':_0x2290('0x15b'),'through':_0x2290('0x15c')});db[_0x2290('0x1d')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x10'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x1f')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x10'),'foreignKey':'UserId'});db[_0x2290('0x21')][_0x2290('0x113')](db['VoiceMailMessage'],{'as':_0x2290('0x15d'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x15e'),'sourceKey':_0x2290('0x15f')});db[_0x2290('0x22')][_0x2290('0x156')](db[_0x2290('0x21')],{'foreignKey':_0x2290('0x15e'),'targetKey':_0x2290('0x15f')});db[_0x2290('0x24')]['hasMany'](db['VoiceQueueReport'],{'as':_0x2290('0x160'),'foreignKey':_0x2290('0x161'),'constraints':![]});db[_0x2290('0x24')][_0x2290('0x113')](db[_0x2290('0x28')],{'as':'AgentReports','foreignKey':_0x2290('0x161'),'constraints':![]});db[_0x2290('0x24')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x10'),'foreignKey':_0x2290('0x115')});db['VoiceCallReport'][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x164')][_0x2290('0x156')](db[_0x2290('0x3d')],{'as':_0x2290('0x3d'),'foreignKey':'MailAccountId'});db[_0x2290('0x164')][_0x2290('0x156')](db[_0x2290('0x165')],{'as':_0x2290('0x165'),'foreignKey':_0x2290('0x166'),'onDelete':_0x2290('0x167')});db[_0x2290('0x3b')]['belongsTo'](db[_0x2290('0x3d')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerOut'][_0x2290('0x156')](db['CloudProvider'],{'as':_0x2290('0x165'),'foreignKey':_0x2290('0x166'),'onDelete':_0x2290('0x167')});db[_0x2290('0x3d')][_0x2290('0x110')](db['MailServerIn'],{'as':_0x2290('0x168'),'onDelete':_0x2290('0x111')});db[_0x2290('0x3d')]['hasOne'](db['MailServerOut'],{'as':_0x2290('0x169'),'onDelete':'cascade'});db[_0x2290('0x3d')][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':_0x2290('0x111')});db[_0x2290('0x3d')][_0x2290('0x113')](db[_0x2290('0x78')],{'as':_0x2290('0x16a'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x2290('0x113')](db[_0x2290('0x43')],{'as':_0x2290('0x15d'),'foreignKey':_0x2290('0x16b')});db['MailAccount'][_0x2290('0x113')](db[_0x2290('0x42')],{'as':_0x2290('0x16c')});db['MailAccount'][_0x2290('0x113')](db[_0x2290('0x44')],{'as':'Applications','foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x2290('0x3d')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0x3d')]['belongsTo'](db['Template'],{'as':_0x2290('0x8c'),'foreignKey':'TemplateId'});db[_0x2290('0x3d')][_0x2290('0x156')](db['Pause'],{'as':_0x2290('0x158'),'foreignKey':_0x2290('0x159')});db[_0x2290('0x3d')][_0x2290('0x125')](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x2290('0x3f')][_0x2290('0x125')](db[_0x2290('0x10')],{'as':'Agents','through':_0x2290('0x134')});db[_0x2290('0x3f')]['belongsToMany'](db['Team'],{'through':_0x2290('0x16f'),'as':_0x2290('0x170')});db['MailInteraction'][_0x2290('0x113')](db[_0x2290('0x43')],{'as':_0x2290('0x15d'),'onDelete':_0x2290('0x111'),'foreignKey':'MailInteractionId'});db[_0x2290('0x42')]['belongsTo'](db[_0x2290('0x3d')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x16b')});db['MailInteraction'][_0x2290('0x156')](db[_0x2290('0x127')],{'as':'Contact','foreignKey':'ContactId'});db[_0x2290('0x42')][_0x2290('0x156')](db['User'],{'as':_0x2290('0x172'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x42')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':'mail_interaction_has_tags','as':_0x2290('0x174')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0x2290('0x175'),'as':_0x2290('0x176')});db[_0x2290('0x42')]['belongsToMany'](db['User'],{'as':_0x2290('0x177'),'through':'user_has_mail_interactions','foreignKey':_0x2290('0x178')});db[_0x2290('0x43')][_0x2290('0x113')](db[_0x2290('0xed')],{'as':'Attachments','onDelete':_0x2290('0x111')});db[_0x2290('0x43')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x10')});db[_0x2290('0x43')][_0x2290('0x156')](db[_0x2290('0x127')],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x162')});db[_0x2290('0x43')][_0x2290('0x156')](db[_0x2290('0x42')],{'as':_0x2290('0x179'),'foreignKey':_0x2290('0x178')});db[_0x2290('0x43')]['belongsTo'](db[_0x2290('0x3d')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x16b')});db[_0x2290('0x43')][_0x2290('0x156')](db[_0x2290('0x13d')],{'as':'ChatWebsite','foreignKey':_0x2290('0x17a')});db[_0x2290('0x43')][_0x2290('0x156')](db[_0x2290('0x66')],{'as':_0x2290('0x66'),'foreignKey':_0x2290('0x17b')});db[_0x2290('0x44')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x44')][_0x2290('0x156')](db[_0x2290('0x3f')],{'onDelete':'restrict'});db[_0x2290('0x44')]['belongsTo'](db['MailAccount'],{'onDelete':_0x2290('0x167')});db[_0x2290('0x44')][_0x2290('0x156')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2290('0x17c')});db['MailApplication'][_0x2290('0x156')](db[_0x2290('0x173')],{'onDelete':_0x2290('0x167'),'foreignKey':_0x2290('0x17d')});db[_0x2290('0x17e')][_0x2290('0x156')](db[_0x2290('0x3d')],{});db[_0x2290('0x17e')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':'ListId'});db['MailQueueReport'][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x17e')][_0x2290('0x156')](db[_0x2290('0x42')],{});db[_0x2290('0x17e')]['belongsTo'](db[_0x2290('0x43')],{});db['MailQueueReport'][_0x2290('0x156')](db['User'],{});db[_0x2290('0x17e')]['belongsTo'](db[_0x2290('0x3f')],{});db[_0x2290('0x47')][_0x2290('0x113')](db[_0x2290('0x48')],{'as':'Items','onDelete':_0x2290('0x111')});db[_0x2290('0x4a')][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x2290('0x111')});db['FaxAccount'][_0x2290('0x113')](db[_0x2290('0x78')],{'as':_0x2290('0x16a'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x2290('0x113')](db[_0x2290('0x11d')],{'as':_0x2290('0x16c')});db['FaxAccount'][_0x2290('0x113')](db[_0x2290('0x17f')],{'as':_0x2290('0x14d'),'foreignKey':_0x2290('0x180'),'onDelete':_0x2290('0x111')});db['FaxAccount'][_0x2290('0x113')](db[_0x2290('0x17')],{'as':'Exntensions','onDelete':_0x2290('0x111')});db[_0x2290('0x4a')]['hasMany'](db['FaxMessage'],{'as':_0x2290('0x15d')});db['FaxAccount'][_0x2290('0x156')](db['Trunk'],{'as':_0x2290('0x2d')});db['FaxAccount'][_0x2290('0x156')](db['CmList'],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0x4a')][_0x2290('0x156')](db[_0x2290('0x181')],{'as':'mandatoryDispositionPause','foreignKey':_0x2290('0x159')});db[_0x2290('0x4a')][_0x2290('0x125')](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x140')});db[_0x2290('0x17f')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':'restrict'});db[_0x2290('0x17f')][_0x2290('0x156')](db[_0x2290('0x4e')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x17f')]['belongsTo'](db[_0x2290('0x4a')],{'onDelete':'restrict'});db[_0x2290('0x17f')][_0x2290('0x156')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x2290('0x17d')});db[_0x2290('0x11d')][_0x2290('0x113')](db[_0x2290('0x4d')],{'as':_0x2290('0x15d'),'onDelete':'cascade','foreignKey':_0x2290('0x183')});db[_0x2290('0x11d')][_0x2290('0x156')](db['FaxAccount'],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x180')});db['FaxInteraction']['belongsTo'](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x2290('0x156')](db[_0x2290('0x10')],{'as':'Owner','foreignKey':_0x2290('0x115')});db[_0x2290('0x11d')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x184'),'as':_0x2290('0x174')});db[_0x2290('0x11d')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x184'),'as':_0x2290('0x176')});db[_0x2290('0x11d')]['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x177'),'through':'user_has_fax_interactions','foreignKey':_0x2290('0x183')});db[_0x2290('0x4d')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x10')});db['FaxMessage']['belongsTo'](db[_0x2290('0x11d')],{'as':_0x2290('0x179'),'foreignKey':_0x2290('0x183')});db[_0x2290('0x4d')][_0x2290('0x156')](db[_0x2290('0x127')],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x162')});db['FaxMessage'][_0x2290('0x156')](db[_0x2290('0xed')],{'as':_0x2290('0xed'),'foreignKey':_0x2290('0x185')});db[_0x2290('0x4d')][_0x2290('0x156')](db[_0x2290('0x4a')],{'as':'Account','foreignKey':_0x2290('0x180')});db[_0x2290('0x4e')][_0x2290('0x125')](db['User'],{'as':_0x2290('0x182'),'through':_0x2290('0x35')});db[_0x2290('0x4e')][_0x2290('0x125')](db[_0x2290('0x12b')],{'through':'team_has_fax_queues','as':_0x2290('0x170')});db[_0x2290('0x4f')][_0x2290('0x156')](db['FaxAccount'],{});db[_0x2290('0x4f')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e')});db['FaxQueueReport'][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db['FaxQueueReport']['belongsTo'](db[_0x2290('0x11d')],{});db[_0x2290('0x4f')][_0x2290('0x156')](db[_0x2290('0x4d')],{});db[_0x2290('0x4f')][_0x2290('0x156')](db[_0x2290('0x10')],{});db['FaxQueueReport'][_0x2290('0x156')](db[_0x2290('0x4e')],{});db[_0x2290('0x146')][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':_0x2290('0x186'),'foreignKey':_0x2290('0x187'),'onDelete':_0x2290('0x111')});db[_0x2290('0x146')][_0x2290('0x113')](db[_0x2290('0x78')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x2290('0x113')](db[_0x2290('0x188')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x2290('0x146')][_0x2290('0x113')](db['SmsInteraction'],{'as':'Interactions'});db[_0x2290('0x146')][_0x2290('0x113')](db[_0x2290('0x52')],{'as':_0x2290('0x14d'),'foreignKey':'SmsAccountId','onDelete':_0x2290('0x111')});db[_0x2290('0x146')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0x146')][_0x2290('0x156')](db[_0x2290('0x181')],{'as':_0x2290('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2290('0x146')][_0x2290('0x125')](db['User'],{'as':'Agents','through':_0x2290('0x189')});db[_0x2290('0x52')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':_0x2290('0x167')});db['SmsApplication'][_0x2290('0x156')](db[_0x2290('0x56')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x2290('0x146')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x52')][_0x2290('0x156')](db[_0x2290('0x7d')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x2290('0x52')][_0x2290('0x156')](db[_0x2290('0x173')],{'onDelete':_0x2290('0x167'),'foreignKey':_0x2290('0x17d')});db['SmsInteraction']['hasMany'](db[_0x2290('0x188')],{'as':_0x2290('0x15d'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x18a')});db[_0x2290('0x54')][_0x2290('0x156')](db[_0x2290('0x146')],{'as':'Account','foreignKey':_0x2290('0x187')});db[_0x2290('0x54')]['belongsTo'](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x54')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':'Owner','foreignKey':_0x2290('0x115')});db[_0x2290('0x54')]['belongsToMany'](db[_0x2290('0x173')],{'through':_0x2290('0x18b'),'as':_0x2290('0x174')});db[_0x2290('0x54')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x18b'),'as':_0x2290('0x176')});db['SmsInteraction']['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x177'),'through':_0x2290('0x18c'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x2290('0x10')],{'as':_0x2290('0x10')});db['SmsMessage'][_0x2290('0x156')](db[_0x2290('0x127')],{'onDelete':_0x2290('0x111'),'as':'Contact'});db[_0x2290('0x188')][_0x2290('0x156')](db[_0x2290('0x54')],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x179'),'foreignKey':_0x2290('0x18a')});db['SmsMessage']['belongsTo'](db[_0x2290('0x146')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x187')});db[_0x2290('0x56')][_0x2290('0x125')](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x36'),'foreignKey':'SmsQueueId'});db[_0x2290('0x56')]['belongsToMany'](db[_0x2290('0x12b')],{'through':_0x2290('0x18d'),'as':_0x2290('0x170')});db['OpenchannelAccount'][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':_0x2290('0x186'),'foreignKey':'OpenchannelAccountId','onDelete':_0x2290('0x111')});db['OpenchannelAccount'][_0x2290('0x113')](db[_0x2290('0x78')],{'as':_0x2290('0x16a'),'foreignKey':_0x2290('0x18e')});db[_0x2290('0x143')][_0x2290('0x113')](db[_0x2290('0x59')],{'as':'Interactions','foreignKey':_0x2290('0x18e')});db[_0x2290('0x143')][_0x2290('0x113')](db['OpenchannelMessage'],{'as':_0x2290('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x2290('0x143')]['hasMany'](db[_0x2290('0x18f')],{'as':'Applications','foreignKey':_0x2290('0x18e'),'onDelete':'cascade'});db[_0x2290('0x143')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':'ListId'});db[_0x2290('0x143')][_0x2290('0x156')](db['Pause'],{'as':_0x2290('0x158'),'foreignKey':_0x2290('0x159')});db[_0x2290('0x143')]['belongsToMany'](db[_0x2290('0x10')],{'as':'Agents','through':_0x2290('0x145')});db['OpenchannelApplication']['belongsTo'](db[_0x2290('0x10')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x18f')][_0x2290('0x156')](db[_0x2290('0x5d')],{'onDelete':_0x2290('0x167'),'foreignKey':_0x2290('0x190')});db[_0x2290('0x18f')][_0x2290('0x156')](db[_0x2290('0x143')],{'onDelete':_0x2290('0x167'),'foreignKey':_0x2290('0x18e')});db[_0x2290('0x18f')][_0x2290('0x156')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2290('0x17c')});db['OpenchannelApplication'][_0x2290('0x156')](db['Tag'],{'onDelete':_0x2290('0x167'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x2290('0x113')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x2290('0x111'),'foreignKey':'OpenchannelInteractionId'});db[_0x2290('0x59')][_0x2290('0x156')](db[_0x2290('0x143')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x18e')});db[_0x2290('0x59')][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db['OpenchannelInteraction'][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x172'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x59')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x191'),'as':_0x2290('0x174')});db[_0x2290('0x59')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x191'),'as':'ThroughTags'});db[_0x2290('0x59')]['belongsToMany'](db['User'],{'as':_0x2290('0x177'),'through':_0x2290('0x192'),'foreignKey':_0x2290('0x193')});db[_0x2290('0x5b')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':'cascade','as':_0x2290('0x10')});db[_0x2290('0x5b')]['belongsTo'](db['CmContact'],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x162')});db['OpenchannelMessage'][_0x2290('0x156')](db[_0x2290('0x59')],{'onDelete':'cascade','as':_0x2290('0x179'),'foreignKey':_0x2290('0x193')});db[_0x2290('0x5b')][_0x2290('0x156')](db[_0x2290('0xed')],{'as':_0x2290('0xed'),'foreignKey':_0x2290('0x185')});db[_0x2290('0x5b')][_0x2290('0x156')](db['OpenchannelAccount'],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x18e')});db[_0x2290('0x5d')]['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x139'),'foreignKey':'OpenchannelQueueId'});db[_0x2290('0x5d')]['belongsToMany'](db[_0x2290('0x12b')],{'through':_0x2290('0x194'),'as':_0x2290('0x170')});db[_0x2290('0x13d')][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':_0x2290('0x186'),'foreignKey':_0x2290('0x17a'),'onDelete':_0x2290('0x111')});db['ChatWebsite']['hasMany'](db[_0x2290('0x78')],{'as':_0x2290('0x16a'),'foreignKey':_0x2290('0x17a')});db['ChatWebsite'][_0x2290('0x113')](db[_0x2290('0x6a')],{'as':_0x2290('0x195')});db[_0x2290('0x13d')]['hasMany'](db['ChatInteraction'],{'as':'Interactions'});db['ChatWebsite']['hasMany'](db[_0x2290('0x61')],{'as':_0x2290('0x14d'),'foreignKey':_0x2290('0x17a'),'onDelete':_0x2290('0x111')});db[_0x2290('0x13d')][_0x2290('0x113')](db['ChatMessage'],{'as':_0x2290('0x15d')});db['ChatWebsite'][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':'ListId'});db[_0x2290('0x13d')][_0x2290('0x156')](db[_0x2290('0x7d')],{'as':_0x2290('0x7d'),'foreignKey':_0x2290('0x17c')});db['ChatWebsite'][_0x2290('0x156')](db[_0x2290('0x3d')],{'as':_0x2290('0x3d'),'foreignKey':'MailAccountId'});db[_0x2290('0x13d')]['belongsTo'](db[_0x2290('0x181')],{'as':_0x2290('0x158'),'foreignKey':_0x2290('0x159')});db[_0x2290('0x13d')]['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x13e')});db['OpenchannelQueueReport'][_0x2290('0x156')](db[_0x2290('0x143')],{});db[_0x2290('0x196')]['belongsTo'](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0x196')][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':'ContactId'});db[_0x2290('0x196')][_0x2290('0x156')](db['OpenchannelInteraction'],{});db[_0x2290('0x196')][_0x2290('0x156')](db[_0x2290('0x5b')],{});db[_0x2290('0x196')][_0x2290('0x156')](db[_0x2290('0x10')],{});db[_0x2290('0x196')]['belongsTo'](db[_0x2290('0x5d')],{});db[_0x2290('0x61')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x197'),'foreignKey':'UserId','onDelete':_0x2290('0x167')});db[_0x2290('0x61')][_0x2290('0x156')](db[_0x2290('0x198')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x2290('0x61')][_0x2290('0x156')](db[_0x2290('0x13d')],{'as':_0x2290('0x199'),'foreignKey':_0x2290('0x17a'),'onDelete':_0x2290('0x167')});db[_0x2290('0x61')]['belongsTo'](db[_0x2290('0x173')],{'onDelete':'restrict','foreignKey':_0x2290('0x17d')});db[_0x2290('0x63')][_0x2290('0x113')](db[_0x2290('0x64')],{'as':_0x2290('0x15d'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x19a')});db[_0x2290('0x63')][_0x2290('0x156')](db['ChatWebsite'],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x17a')});db[_0x2290('0x63')]['belongsTo'](db[_0x2290('0x127')],{'as':'Contact','foreignKey':'ContactId'});db[_0x2290('0x63')]['belongsTo'](db['User'],{'as':_0x2290('0x172'),'foreignKey':_0x2290('0x115')});db['ChatInteraction'][_0x2290('0x125')](db[_0x2290('0x173')],{'through':'chat_interaction_has_tags','as':_0x2290('0x174')});db['ChatInteraction'][_0x2290('0x125')](db[_0x2290('0x173')],{'through':'chat_interaction_has_tags','as':_0x2290('0x176')});db[_0x2290('0x63')][_0x2290('0x125')](db['User'],{'as':'Users','through':_0x2290('0x12e'),'foreignKey':_0x2290('0x19a')});db['ChatMessage'][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':'cascade','as':_0x2290('0x10')});db['ChatMessage'][_0x2290('0x156')](db[_0x2290('0x127')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x2290('0x163')});db[_0x2290('0x64')][_0x2290('0x156')](db['ChatInteraction'],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x179'),'foreignKey':_0x2290('0x19a')});db[_0x2290('0x64')][_0x2290('0x156')](db[_0x2290('0xed')],{'as':_0x2290('0xed'),'foreignKey':_0x2290('0x185')});db[_0x2290('0x64')][_0x2290('0x156')](db[_0x2290('0x13d')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x17a')});db[_0x2290('0x66')][_0x2290('0x113')](db['Attachment'],{'as':_0x2290('0x19b'),'foreignKey':_0x2290('0x17b'),'onDelete':'cascade','hooks':!![]});db[_0x2290('0x66')][_0x2290('0x156')](db[_0x2290('0x127')],{'onDelete':'cascade','as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x66')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2290('0x17a')});db[_0x2290('0x198')][_0x2290('0x125')](db['User'],{'as':_0x2290('0x182'),'through':_0x2290('0x135'),'hooks':!![]});db[_0x2290('0x198')][_0x2290('0x125')](db[_0x2290('0x12b')],{'through':_0x2290('0x19c'),'as':_0x2290('0x170')});db['ChatGroup'][_0x2290('0x113')](db['ChatInternalMessage'],{'as':_0x2290('0x15d'),'foreignKey':'ChatGroupId','onDelete':_0x2290('0x111')});db[_0x2290('0x68')][_0x2290('0x125')](db['User'],{'as':_0x2290('0x150'),'through':_0x2290('0x19d')});db['ChatProactiveAction'][_0x2290('0x156')](db[_0x2290('0x13d')],{'as':_0x2290('0x199'),'foreignKey':_0x2290('0x17a')});db[_0x2290('0x19e')]['hasMany'](db['CmContact'],{'as':_0x2290('0x128'),'foreignKey':_0x2290('0x19f')});db[_0x2290('0x127')][_0x2290('0x113')](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x2290('0x1a0')});db[_0x2290('0x127')][_0x2290('0x113')](db[_0x2290('0x6d')],{'as':_0x2290('0x122'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x127')][_0x2290('0x113')](db[_0x2290('0x70')],{'as':'HopperFinals','foreignKey':_0x2290('0x163')});db[_0x2290('0x127')][_0x2290('0x113')](db['CmHopperHistory'],{'as':_0x2290('0x152'),'foreignKey':'ContactId'});db[_0x2290('0x127')][_0x2290('0x113')](db['ReportAgentPreview'],{'as':_0x2290('0x119'),'foreignKey':_0x2290('0x163')});db['CmContact'][_0x2290('0x113')](db[_0x2290('0x154')],{'as':_0x2290('0x155'),'foreignKey':_0x2290('0x163')});db['CmContact'][_0x2290('0x113')](db['OpenchannelInteraction'],{'as':_0x2290('0x11a'),'foreignKey':_0x2290('0x163'),'onDelete':'restrict'});db[_0x2290('0x127')][_0x2290('0x113')](db[_0x2290('0x63')],{'as':_0x2290('0x11b'),'foreignKey':_0x2290('0x163'),'onDelete':_0x2290('0x167')});db['CmContact']['hasMany'](db[_0x2290('0x54')],{'as':_0x2290('0x11c'),'foreignKey':'ContactId','onDelete':_0x2290('0x167')});db['CmContact'][_0x2290('0x113')](db['FaxInteraction'],{'as':_0x2290('0x11e'),'foreignKey':_0x2290('0x163'),'onDelete':_0x2290('0x167')});db[_0x2290('0x127')][_0x2290('0x113')](db[_0x2290('0x42')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x2290('0x167')});db[_0x2290('0x127')]['belongsTo'](db[_0x2290('0x19e')],{'as':_0x2290('0x1a1'),'foreignKey':_0x2290('0x19f')});db[_0x2290('0x127')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':'ListId','onDelete':_0x2290('0x111')});db[_0x2290('0x127')][_0x2290('0x125')](db['User'],{'as':_0x2290('0x177'),'through':'cm_user_has_contacts'});db[_0x2290('0x127')]['belongsToMany'](db[_0x2290('0x173')],{'as':_0x2290('0x174'),'through':_0x2290('0x1a2')});db[_0x2290('0x127')]['belongsToMany'](db['Tag'],{'through':_0x2290('0x1a2'),'as':_0x2290('0x176')});db[_0x2290('0x6d')][_0x2290('0x113')](db[_0x2290('0x8b')],{'as':_0x2290('0x1a3'),'foreignKey':_0x2290('0x1a4')});db['CmHopper'][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163'),'onDelete':_0x2290('0x111')});db[_0x2290('0x6d')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e'),'onDelete':_0x2290('0x111')});db[_0x2290('0x6d')]['belongsTo'](db[_0x2290('0x10')],{'as':_0x2290('0x197'),'foreignKey':_0x2290('0x115')});db['CmHopper'][_0x2290('0x156')](db['VoiceQueue'],{'as':_0x2290('0x1a5'),'foreignKey':'VoiceQueueId','onDelete':_0x2290('0x111')});db[_0x2290('0x6d')][_0x2290('0x156')](db[_0x2290('0xeb')],{'as':'Campaign','foreignKey':_0x2290('0x1a6'),'onDelete':_0x2290('0x111')});db['CmHopper'][_0x2290('0x156')](db[_0x2290('0x10')],{'as':'Owner','foreignKey':_0x2290('0x1a7')});db[_0x2290('0x6e')][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':'ContactId','onDelete':_0x2290('0x111')});db['CmHopperBlack'][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':'List','foreignKey':'ListId','onDelete':_0x2290('0x111')});db[_0x2290('0x6e')][_0x2290('0x156')](db[_0x2290('0x1b')],{'as':_0x2290('0x1a5'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x2290('0x6e')][_0x2290('0x156')](db[_0x2290('0xeb')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x2290('0x111')});db[_0x2290('0x76')][_0x2290('0x113')](db[_0x2290('0x1a8')],{'as':{'plural':'All','singular':_0x2290('0x1a9')},'foreignKey':_0x2290('0x1aa'),'onDelete':_0x2290('0x111'),'hooks':!![]});db[_0x2290('0x76')][_0x2290('0x113')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x2290('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x2290('0x76')][_0x2290('0x113')](db[_0x2290('0x75')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x2290('0x111'),'hooks':!![]});db[_0x2290('0x7a')][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':_0x2290('0x186'),'foreignKey':_0x2290('0x1ac'),'onDelete':_0x2290('0x111')});db[_0x2290('0x7d')][_0x2290('0x113')](db[_0x2290('0x7d')],{'as':_0x2290('0x1ad'),'foreignKey':'IntervalId','onDelete':_0x2290('0x111'),'hooks':!![],'required':![]});db[_0x2290('0x7d')][_0x2290('0x113')](db['VoiceExtension'],{'as':_0x2290('0x116'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x2290('0x7d')][_0x2290('0x113')](db[_0x2290('0x44')],{'as':_0x2290('0x1ae'),'foreignKey':_0x2290('0x17c')});db[_0x2290('0x7d')][_0x2290('0x113')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x2290('0x17c')});db[_0x2290('0x7d')][_0x2290('0x113')](db[_0x2290('0x17f')],{'as':_0x2290('0x1af'),'foreignKey':_0x2290('0x17c')});db[_0x2290('0x7d')][_0x2290('0x113')](db[_0x2290('0x52')],{'as':_0x2290('0x1b0'),'foreignKey':_0x2290('0x17c')});db['Schedule'][_0x2290('0x156')](db[_0x2290('0x3d')],{});db[_0x2290('0x84')][_0x2290('0x156')](db[_0x2290('0x97')],{'foreignKey':_0x2290('0x1b1')});db[_0x2290('0x84')]['belongsTo'](db[_0x2290('0x95')],{'foreignKey':_0x2290('0x1b2')});db['Sound'][_0x2290('0x125')](db[_0x2290('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x2290('0x167')});db[_0x2290('0x173')]['belongsToMany'](db[_0x2290('0x127')],{'through':_0x2290('0x1a2')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x2290('0x1b3')});db[_0x2290('0x173')][_0x2290('0x125')](db[_0x2290('0x42')],{'through':_0x2290('0x175')});db[_0x2290('0x173')][_0x2290('0x125')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db['Tag']['belongsToMany'](db['FaxInteraction'],{'through':_0x2290('0x184')});db[_0x2290('0x173')][_0x2290('0x125')](db[_0x2290('0x59')],{'through':_0x2290('0x191')});db[_0x2290('0x173')][_0x2290('0x125')](db['WhatsappInteraction'],{'through':_0x2290('0x1b4')});db[_0x2290('0x1b5')]['belongsTo'](db['ContactItemType'],{'as':_0x2290('0x1b6'),'foreignKey':'ItemTypeId'});db[_0x2290('0x8b')]['belongsTo'](db[_0x2290('0x6d')],{'as':_0x2290('0x1b7'),'foreignKey':'CmHopperId'});db[_0x2290('0x1b5')]['belongsTo'](db['CmContact'],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x1a0')});db[_0x2290('0x8e')][_0x2290('0x113')](db[_0x2290('0x1a8')],{'as':{'plural':_0x2290('0x1b8'),'singular':_0x2290('0x1b9')},'foreignKey':_0x2290('0x1ba'),'onDelete':_0x2290('0x111'),'hooks':!![]});db[_0x2290('0x8e')][_0x2290('0x113')](db[_0x2290('0x1a8')],{'as':{'plural':_0x2290('0x1bb'),'singular':_0x2290('0x1bc')},'foreignKey':_0x2290('0x1bd'),'onDelete':_0x2290('0x111'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x2290('0x75')],{'as':_0x2290('0x1be'),'foreignKey':_0x2290('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x2290('0x95')]['hasMany'](db[_0x2290('0x9d')],{'as':_0x2290('0x1c0'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1b2'),'hooks':!![]});db[_0x2290('0x97')][_0x2290('0x113')](db['AnalyticFieldReport'],{'as':_0x2290('0x1c0'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1b1')});db[_0x2290('0x9b')][_0x2290('0x113')](db[_0x2290('0x9d')],{'as':_0x2290('0x1c0'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c1')});db[_0x2290('0x9d')]['belongsTo'](db[_0x2290('0x9b')],{'foreignKey':'MetricId'});db[_0x2290('0x9f')][_0x2290('0x113')](db[_0x2290('0xa1')],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xa1')][_0x2290('0x113')](db[_0x2290('0x1c4')],{'as':_0x2290('0x1c5'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xa1')]['hasMany'](db[_0x2290('0x1c4')],{'as':_0x2290('0x1c7'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c8')});db[_0x2290('0xa1')]['hasMany'](db[_0x2290('0x1c4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2290('0x1c9')});db[_0x2290('0xa1')][_0x2290('0x156')](db[_0x2290('0x9f')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0x1c4')]['hasMany'](db[_0x2290('0x1c4')],{'as':_0x2290('0x1ca'),'foreignKey':'SubjectId'});db[_0x2290('0x1c4')][_0x2290('0x113')](db['SalesforceField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2290('0x1c4')]['hasMany'](db[_0x2290('0x1c4')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0x1c4')]['belongsTo'](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db[_0x2290('0xa4')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xa6')]['hasMany'](db[_0x2290('0xa8')],{'as':_0x2290('0x1c5'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xa6')][_0x2290('0x113')](db[_0x2290('0xa8')],{'as':_0x2290('0x1c7'),'onDelete':'cascade','foreignKey':_0x2290('0x1c8')});db[_0x2290('0xa6')][_0x2290('0x113')](db['SugarcrmField'],{'as':_0x2290('0x1c0'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c9')});db['SugarcrmConfiguration']['belongsTo'](db[_0x2290('0xa4')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xa8')]['hasMany'](db[_0x2290('0xa8')],{'as':_0x2290('0x1ca'),'foreignKey':'SubjectId'});db[_0x2290('0xa8')][_0x2290('0x113')](db[_0x2290('0xa8')],{'as':'Description','foreignKey':_0x2290('0x1c8')});db[_0x2290('0xa8')][_0x2290('0x113')](db['SugarcrmField'],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0xa8')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db['DeskAccount'][_0x2290('0x113')](db[_0x2290('0xac')],{'as':'Configurations','onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xac')][_0x2290('0x113')](db[_0x2290('0xad')],{'as':'Subjects','onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c6')});db['DeskConfiguration'][_0x2290('0x113')](db['DeskField'],{'as':_0x2290('0x1c7'),'onDelete':'cascade','foreignKey':_0x2290('0x1c8')});db['DeskConfiguration'][_0x2290('0x113')](db[_0x2290('0xad')],{'as':_0x2290('0x1c0'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c9')});db['DeskConfiguration']['belongsTo'](db[_0x2290('0xaa')],{'as':'Account','foreignKey':_0x2290('0x1c3')});db[_0x2290('0xac')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':'int_desk_configuration_has_tags'});db[_0x2290('0xad')][_0x2290('0x113')](db['DeskField'],{'as':_0x2290('0x1ca'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xad')][_0x2290('0x113')](db[_0x2290('0xad')],{'as':_0x2290('0x1cd'),'foreignKey':'DescriptionId'});db[_0x2290('0xad')][_0x2290('0x113')](db[_0x2290('0xad')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0xad')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db['ZohoAccount'][_0x2290('0x113')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0x2290('0x111'),'foreignKey':'AccountId'});db[_0x2290('0x1ce')][_0x2290('0x113')](db[_0x2290('0xb1')],{'as':_0x2290('0x1c5'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0x1ce')][_0x2290('0x113')](db[_0x2290('0xb1')],{'as':_0x2290('0x1c7'),'onDelete':'cascade','foreignKey':_0x2290('0x1c8')});db[_0x2290('0x1ce')][_0x2290('0x113')](db[_0x2290('0xb1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2290('0x1c9')});db[_0x2290('0x1ce')][_0x2290('0x156')](db[_0x2290('0xaf')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xb1')][_0x2290('0x113')](db[_0x2290('0xb1')],{'as':'Subject','foreignKey':_0x2290('0x1c6')});db[_0x2290('0xb1')]['hasMany'](db[_0x2290('0xb1')],{'as':_0x2290('0x1cd'),'foreignKey':_0x2290('0x1c8')});db[_0x2290('0xb1')][_0x2290('0x113')](db[_0x2290('0xb1')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db['ZohoField'][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db[_0x2290('0x1cf')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xb3')][_0x2290('0x113')](db[_0x2290('0xb5')],{'as':_0x2290('0x1c5'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xb3')][_0x2290('0x113')](db[_0x2290('0xb5')],{'as':_0x2290('0x1c7'),'foreignKey':_0x2290('0x1c8')});db[_0x2290('0xb3')]['hasMany'](db[_0x2290('0xb5')],{'as':_0x2290('0x1c0'),'foreignKey':'FieldId'});db[_0x2290('0xb3')]['belongsTo'](db['ZendeskAccount'],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xb3')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x1d0')});db[_0x2290('0xb5')]['hasMany'](db['ZendeskField'],{'as':_0x2290('0x1ca'),'foreignKey':'SubjectId'});db[_0x2290('0xb5')]['hasMany'](db[_0x2290('0xb5')],{'as':_0x2290('0x1cd'),'foreignKey':'DescriptionId'});db[_0x2290('0xb5')][_0x2290('0x113')](db[_0x2290('0xb5')],{'as':_0x2290('0x1cb'),'foreignKey':'FieldId'});db[_0x2290('0xb5')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db['FreshdeskAccount'][_0x2290('0x113')](db[_0x2290('0x1d1')],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0x1d1')]['hasMany'](db[_0x2290('0xb9')],{'as':'Subjects','onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c6')});db['FreshdeskConfiguration'][_0x2290('0x113')](db[_0x2290('0xb9')],{'as':'Descriptions','onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c8')});db[_0x2290('0x1d1')][_0x2290('0x113')](db[_0x2290('0xb9')],{'as':_0x2290('0x1c0'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0x1d1')][_0x2290('0x156')](db[_0x2290('0xb6')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x2290('0x173')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x2290('0xb9')][_0x2290('0x113')](db['FreshdeskField'],{'as':_0x2290('0x1ca'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xb9')]['hasMany'](db[_0x2290('0xb9')],{'as':_0x2290('0x1cd'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0x2290('0xb9')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0xb9')][_0x2290('0x156')](db['Variable'],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db[_0x2290('0xbb')]['hasMany'](db['VtigerConfiguration'],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xbd')][_0x2290('0x113')](db[_0x2290('0xbf')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x2290('0xbd')][_0x2290('0x113')](db[_0x2290('0xbf')],{'as':_0x2290('0x1c7'),'foreignKey':_0x2290('0x1c8')});db[_0x2290('0xbd')][_0x2290('0x113')](db['VtigerField'],{'as':_0x2290('0x1c0'),'foreignKey':'FieldId'});db['VtigerConfiguration']['belongsTo'](db[_0x2290('0xbb')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xbf')][_0x2290('0x113')](db['VtigerField'],{'as':_0x2290('0x1ca'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xbf')]['hasMany'](db[_0x2290('0xbf')],{'as':_0x2290('0x1cd'),'foreignKey':_0x2290('0x1c8')});db[_0x2290('0xbf')][_0x2290('0x113')](db[_0x2290('0xbf')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0xbf')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':'VariableId'});db[_0x2290('0xc1')][_0x2290('0x113')](db[_0x2290('0xc3')],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xc3')][_0x2290('0x113')](db[_0x2290('0x1d2')],{'as':'Subjects','foreignKey':_0x2290('0x1c6')});db[_0x2290('0xc3')][_0x2290('0x113')](db[_0x2290('0x1d2')],{'as':_0x2290('0x1c7'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x2290('0x113')](db[_0x2290('0x1d2')],{'as':'Fields','foreignKey':_0x2290('0x1c9')});db[_0x2290('0xc3')][_0x2290('0x156')](db[_0x2290('0xc1')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1c3')});db['ServicenowField']['hasMany'](db[_0x2290('0x1d2')],{'as':_0x2290('0x1ca'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0x1d2')][_0x2290('0x113')](db[_0x2290('0x1d2')],{'as':'Description','foreignKey':_0x2290('0x1c8')});db[_0x2290('0x1d2')][_0x2290('0x113')](db[_0x2290('0x1d2')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0x1d2')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db['Dynamics365Account'][_0x2290('0x113')](db[_0x2290('0xc8')],{'as':_0x2290('0x1c2'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c3')});db[_0x2290('0xc6')][_0x2290('0x156')](db[_0x2290('0x165')],{'as':_0x2290('0x165'),'foreignKey':_0x2290('0x166')});db[_0x2290('0xc8')][_0x2290('0x113')](db[_0x2290('0xca')],{'as':_0x2290('0x1c5'),'onDelete':'cascade','foreignKey':_0x2290('0x1c6')});db[_0x2290('0xc8')][_0x2290('0x113')](db[_0x2290('0xca')],{'as':'Descriptions','onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1c8')});db['Dynamics365Configuration']['hasMany'](db[_0x2290('0xca')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2290('0x1c9')});db[_0x2290('0xc8')][_0x2290('0x156')](db[_0x2290('0xc6')],{'as':'Account','foreignKey':_0x2290('0x1c3')});db[_0x2290('0xca')][_0x2290('0x113')](db[_0x2290('0xca')],{'as':_0x2290('0x1ca'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xca')][_0x2290('0x113')](db[_0x2290('0xca')],{'as':'Description','foreignKey':_0x2290('0x1c8')});db[_0x2290('0xca')][_0x2290('0x113')](db[_0x2290('0xca')],{'as':_0x2290('0x1cb'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0xca')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db['FreshsalesAccount'][_0x2290('0x113')](db['FreshsalesConfiguration'],{'as':_0x2290('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2290('0xce')][_0x2290('0x113')](db[_0x2290('0x1d3')],{'as':_0x2290('0x1c5'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0xce')][_0x2290('0x113')](db[_0x2290('0x1d3')],{'as':_0x2290('0x1c7'),'foreignKey':'DescriptionId'});db[_0x2290('0xce')][_0x2290('0x113')](db[_0x2290('0x1d3')],{'as':_0x2290('0x1c0'),'foreignKey':_0x2290('0x1c9')});db[_0x2290('0xce')][_0x2290('0x156')](db[_0x2290('0xcc')],{'as':'Account','foreignKey':_0x2290('0x1c3')});db[_0x2290('0x1d3')][_0x2290('0x113')](db[_0x2290('0x1d3')],{'as':_0x2290('0x1ca'),'foreignKey':_0x2290('0x1c6')});db[_0x2290('0x1d3')][_0x2290('0x113')](db['FreshsalesField'],{'as':_0x2290('0x1cd'),'foreignKey':'DescriptionId'});db[_0x2290('0x1d3')][_0x2290('0x113')](db[_0x2290('0x1d3')],{'as':_0x2290('0x1cb'),'foreignKey':'FieldId'});db[_0x2290('0x1d3')][_0x2290('0x156')](db[_0x2290('0x90')],{'as':_0x2290('0x90'),'foreignKey':_0x2290('0x1cc')});db[_0x2290('0xd1')]['belongsTo'](db[_0x2290('0x13d')],{});db['ChatQueueReport'][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':'List','foreignKey':_0x2290('0x16e')});db[_0x2290('0xd1')][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0xd1')]['belongsTo'](db['ChatInteraction'],{});db[_0x2290('0xd1')][_0x2290('0x156')](db[_0x2290('0x64')],{});db[_0x2290('0xd1')][_0x2290('0x156')](db[_0x2290('0x10')],{});db[_0x2290('0xd1')]['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':'cascade','foreignKey':_0x2290('0x1d4')});db[_0x2290('0x1d5')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1d6')});db[_0x2290('0x154')][_0x2290('0x113')](db[_0x2290('0xd6')],{'foreignKey':'SessionId','onDelete':_0x2290('0x111')});db[_0x2290('0x154')][_0x2290('0x113')](db[_0x2290('0xd4')],{'foreignKey':_0x2290('0x1d7'),'onDelete':'cascade'});db[_0x2290('0xd9')][_0x2290('0x156')](db[_0x2290('0x146')],{});db['SmsQueueReport'][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0xd9')]['belongsTo'](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0xd9')][_0x2290('0x156')](db[_0x2290('0x54')],{});db['SmsQueueReport'][_0x2290('0x156')](db['SmsMessage'],{});db[_0x2290('0xd9')]['belongsTo'](db[_0x2290('0x10')],{});db['SmsQueueReport'][_0x2290('0x156')](db[_0x2290('0x56')],{});db['JscriptyProject'][_0x2290('0x113')](db[_0x2290('0x154')],{'foreignKey':_0x2290('0x1d8')});db[_0x2290('0x1d9')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x2290('0x113')](db[_0x2290('0xd4')],{'foreignKey':_0x2290('0x1d8')});db[_0x2290('0x12b')]['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x12c')});db['Team']['belongsToMany'](db[_0x2290('0x1b')],{'through':'TeamVoiceQueue','as':_0x2290('0x131')});db[_0x2290('0x12b')][_0x2290('0x125')](db[_0x2290('0x3f')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x2290('0x12b')][_0x2290('0x125')](db['ChatQueue'],{'through':_0x2290('0x19c'),'as':'ChatQueues'});db[_0x2290('0x12b')]['belongsToMany'](db[_0x2290('0x4e')],{'through':'team_has_fax_queues','as':_0x2290('0x136')});db[_0x2290('0x12b')][_0x2290('0x125')](db[_0x2290('0x56')],{'through':_0x2290('0x18d'),'as':'SmsQueues'});db['Team'][_0x2290('0x125')](db[_0x2290('0x5d')],{'through':_0x2290('0x194'),'as':_0x2290('0x138')});db[_0x2290('0x12b')][_0x2290('0x125')](db[_0x2290('0x13a')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x2290('0x12b')][_0x2290('0x125')](db[_0x2290('0xf7')],{'through':_0x2290('0x10b'),'as':_0x2290('0x132')});db[_0x2290('0xeb')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2290('0x1a6')});db[_0x2290('0xeb')][_0x2290('0x113')](db['CmHopperHistory'],{'as':_0x2290('0x152'),'foreignKey':_0x2290('0x1a6')});db[_0x2290('0xeb')][_0x2290('0x113')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x2290('0x1a6')});db[_0x2290('0xeb')]['belongsTo'](db[_0x2290('0x2d')],{'as':_0x2290('0x2d'),'foreignKey':_0x2290('0x1da')});db[_0x2290('0xeb')][_0x2290('0x156')](db['Trunk'],{'as':_0x2290('0x1db'),'foreignKey':_0x2290('0x157')});db['Campaign'][_0x2290('0x156')](db[_0x2290('0x7d')],{'as':_0x2290('0x7d'),'foreignKey':_0x2290('0x17c')});db[_0x2290('0xeb')][_0x2290('0x156')](db[_0x2290('0xe3')],{'as':_0x2290('0xe3'),'foreignKey':_0x2290('0x1dc')});db[_0x2290('0xeb')]['belongsToMany'](db[_0x2290('0xf6')],{'as':_0x2290('0x12a'),'through':_0x2290('0x1dd')});db[_0x2290('0xeb')][_0x2290('0x125')](db[_0x2290('0xf6')],{'as':_0x2290('0x15b'),'through':_0x2290('0x1de')});db['Attachment'][_0x2290('0x156')](db['ChatOfflineMessage'],{'as':_0x2290('0x66'),'foreignKey':_0x2290('0x17b')});db['MailTransferReport'][_0x2290('0x156')](db[_0x2290('0x43')],{});db[_0x2290('0xef')][_0x2290('0x156')](db['MailInteraction'],{});db[_0x2290('0xef')][_0x2290('0x156')](db['MailAccount'],{'foreignKey':_0x2290('0x1df'),'as':_0x2290('0x1e0')});db[_0x2290('0xef')]['belongsTo'](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e1'),'as':_0x2290('0x1e2')});db['MailTransferReport']['belongsTo'](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e3'),'as':_0x2290('0x1e4')});db['MailTransferReport']['belongsTo'](db[_0x2290('0x3f')],{'foreignKey':_0x2290('0x1e5'),'as':_0x2290('0x1e6')});db[_0x2290('0xef')][_0x2290('0x156')](db[_0x2290('0x3d')],{'foreignKey':_0x2290('0x1e7'),'as':_0x2290('0x1e8')});db[_0x2290('0xf1')][_0x2290('0x156')](db[_0x2290('0x64')],{});db[_0x2290('0xf1')][_0x2290('0x156')](db[_0x2290('0x63')],{});db[_0x2290('0xf1')][_0x2290('0x156')](db['ChatWebsite'],{'foreignKey':_0x2290('0x1e9'),'as':_0x2290('0x1e0')});db[_0x2290('0xf1')]['belongsTo'](db[_0x2290('0x10')],{'foreignKey':'FromUserId','as':_0x2290('0x1e2')});db['ChatTransferReport'][_0x2290('0x156')](db[_0x2290('0x10')],{'foreignKey':'ToUserId','as':_0x2290('0x1e4')});db['ChatTransferReport'][_0x2290('0x156')](db[_0x2290('0x198')],{'foreignKey':'ToChatQueueId','as':_0x2290('0x1e6')});db[_0x2290('0xf1')][_0x2290('0x156')](db[_0x2290('0x13d')],{'foreignKey':_0x2290('0x1ea'),'as':_0x2290('0x1e8')});db[_0x2290('0xf3')][_0x2290('0x156')](db[_0x2290('0x4d')],{});db[_0x2290('0xf3')][_0x2290('0x156')](db['FaxInteraction'],{});db[_0x2290('0xf3')]['belongsTo'](db[_0x2290('0x4a')],{'foreignKey':_0x2290('0x1eb'),'as':_0x2290('0x1e0')});db['FaxTransferReport']['belongsTo'](db[_0x2290('0x10')],{'foreignKey':'FromUserId','as':_0x2290('0x1e2')});db[_0x2290('0xf3')][_0x2290('0x156')](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e3'),'as':_0x2290('0x1e4')});db[_0x2290('0xf3')][_0x2290('0x156')](db[_0x2290('0x4e')],{'foreignKey':'ToFaxQueueId','as':_0x2290('0x1e6')});db[_0x2290('0xf3')]['belongsTo'](db[_0x2290('0x4a')],{'foreignKey':_0x2290('0x1ec'),'as':_0x2290('0x1e8')});db[_0x2290('0x1ed')][_0x2290('0x156')](db[_0x2290('0x5b')],{});db[_0x2290('0x1ed')][_0x2290('0x156')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x2290('0x156')](db[_0x2290('0x143')],{'foreignKey':_0x2290('0x1ee'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x2290('0x156')](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e1'),'as':_0x2290('0x1e2')});db['OpenchannelTransferReport'][_0x2290('0x156')](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e3'),'as':'ToAgent'});db[_0x2290('0x1ed')][_0x2290('0x156')](db[_0x2290('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0x2290('0x1e6')});db['OpenchannelTransferReport'][_0x2290('0x156')](db[_0x2290('0x143')],{'foreignKey':_0x2290('0x1ef'),'as':'ToAccount'});db[_0x2290('0x1f0')]['belongsTo'](db['SmsMessage'],{});db[_0x2290('0x1f0')][_0x2290('0x156')](db[_0x2290('0x54')],{});db[_0x2290('0x1f0')][_0x2290('0x156')](db[_0x2290('0x146')],{'foreignKey':_0x2290('0x1f1'),'as':_0x2290('0x1e0')});db['SmsTransferReport']['belongsTo'](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e1'),'as':'FromAgent'});db[_0x2290('0x1f0')]['belongsTo'](db[_0x2290('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x2290('0x1f0')][_0x2290('0x156')](db[_0x2290('0x56')],{'foreignKey':'ToSmsQueueId','as':_0x2290('0x1e6')});db[_0x2290('0x1f0')]['belongsTo'](db[_0x2290('0x146')],{'foreignKey':_0x2290('0x1f2'),'as':'ToAccount'});db[_0x2290('0xf6')][_0x2290('0x113')](db[_0x2290('0x7a')],{'as':_0x2290('0x186'),'foreignKey':_0x2290('0x16e'),'onDelete':_0x2290('0x111')});db[_0x2290('0xf6')]['hasMany'](db[_0x2290('0x73')],{'as':_0x2290('0x1f3'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0xf6')]['hasMany'](db[_0x2290('0x127')],{'as':_0x2290('0x128'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x2290('0xf6')][_0x2290('0x113')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2290('0x16e')});db['CmList']['hasMany'](db[_0x2290('0x72')],{'as':'HopperHistory','foreignKey':_0x2290('0x16e')});db['CmList'][_0x2290('0x113')](db[_0x2290('0x119')],{'as':_0x2290('0x119'),'foreignKey':_0x2290('0x16e')});db[_0x2290('0xf6')]['belongsToMany'](db[_0x2290('0x1b')],{'as':_0x2290('0x1f4'),'through':'voice_queues_has_cm_lists'});db[_0x2290('0xf6')]['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x13c')});db['VoicePrefix'][_0x2290('0x113')](db[_0x2290('0x17')],{'as':_0x2290('0x116'),'onDelete':_0x2290('0x111')});db[_0x2290('0xf7')][_0x2290('0x125')](db[_0x2290('0x10')],{'as':'Agents','through':'UserVoicePrefix'});db['VoicePrefix'][_0x2290('0x125')](db[_0x2290('0x12b')],{'through':_0x2290('0x10b'),'as':_0x2290('0x170')});db['UserProfile'][_0x2290('0x113')](db[_0x2290('0x10')],{'as':'Users','foreignKey':_0x2290('0x124')});db[_0x2290('0x1f5')][_0x2290('0x113')](db['UserProfileSection'],{'as':_0x2290('0x1f6'),'foreignKey':'userProfileId','onDelete':_0x2290('0x111')});db[_0x2290('0xfa')]['hasMany'](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x2290('0x1f7'),'onDelete':'cascade'});db[_0x2290('0x148')]['hasMany'](db['Disposition'],{'as':_0x2290('0x186'),'foreignKey':_0x2290('0x1f8'),'onDelete':_0x2290('0x111')});db[_0x2290('0x148')][_0x2290('0x113')](db[_0x2290('0x78')],{'as':_0x2290('0x16a'),'foreignKey':_0x2290('0x1f8')});db[_0x2290('0x148')][_0x2290('0x113')](db[_0x2290('0x102')],{'as':'Messages','foreignKey':_0x2290('0x1f8')});db[_0x2290('0x148')][_0x2290('0x113')](db[_0x2290('0x12f')],{'as':_0x2290('0x16c')});db[_0x2290('0x148')][_0x2290('0x113')](db[_0x2290('0x1f9')],{'as':_0x2290('0x14d'),'foreignKey':_0x2290('0x1f8'),'onDelete':_0x2290('0x111')});db[_0x2290('0x148')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':'List','foreignKey':_0x2290('0x16e')});db[_0x2290('0x148')][_0x2290('0x156')](db[_0x2290('0x181')],{'as':_0x2290('0x158'),'foreignKey':_0x2290('0x159')});db['WhatsappAccount'][_0x2290('0x125')](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x14a')});db[_0x2290('0x1f9')][_0x2290('0x156')](db[_0x2290('0x10')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x1f9')][_0x2290('0x156')](db[_0x2290('0x13a')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x1f9')][_0x2290('0x156')](db[_0x2290('0x148')],{'onDelete':_0x2290('0x167')});db[_0x2290('0x1f9')][_0x2290('0x156')](db[_0x2290('0x7d')],{'onDelete':_0x2290('0x167'),'foreignKey':'IntervalId'});db[_0x2290('0x1f9')][_0x2290('0x156')](db[_0x2290('0x173')],{'onDelete':_0x2290('0x167'),'foreignKey':_0x2290('0x17d')});db['WhatsappInteraction'][_0x2290('0x113')](db[_0x2290('0x102')],{'as':_0x2290('0x15d'),'onDelete':_0x2290('0x111'),'foreignKey':_0x2290('0x1fa')});db[_0x2290('0x12f')]['belongsTo'](db[_0x2290('0x148')],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1f8')});db[_0x2290('0x12f')]['belongsTo'](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x12f')]['belongsTo'](db['User'],{'as':_0x2290('0x172'),'foreignKey':_0x2290('0x115')});db[_0x2290('0x12f')][_0x2290('0x125')](db[_0x2290('0x173')],{'through':_0x2290('0x1b4'),'as':'Tags'});db[_0x2290('0x12f')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x2290('0x1fa')});db['WhatsappMessage'][_0x2290('0x156')](db[_0x2290('0x10')],{'as':_0x2290('0x10')});db[_0x2290('0x102')][_0x2290('0x156')](db[_0x2290('0x127')],{'onDelete':_0x2290('0x111'),'as':'Contact'});db[_0x2290('0x102')][_0x2290('0x156')](db[_0x2290('0x12f')],{'onDelete':_0x2290('0x111'),'as':_0x2290('0x179'),'foreignKey':_0x2290('0x1fa')});db[_0x2290('0x102')][_0x2290('0x156')](db['WhatsappAccount'],{'as':_0x2290('0x171'),'foreignKey':_0x2290('0x1f8')});db[_0x2290('0x1fb')][_0x2290('0x156')](db[_0x2290('0x148')],{});db[_0x2290('0x1fb')][_0x2290('0x156')](db[_0x2290('0xf6')],{'as':_0x2290('0x16d'),'foreignKey':'ListId'});db[_0x2290('0x1fb')][_0x2290('0x156')](db[_0x2290('0x127')],{'as':_0x2290('0x162'),'foreignKey':_0x2290('0x163')});db[_0x2290('0x1fb')][_0x2290('0x156')](db[_0x2290('0x12f')],{});db[_0x2290('0x1fb')][_0x2290('0x156')](db[_0x2290('0x13a')],{});db[_0x2290('0x1fb')][_0x2290('0x156')](db[_0x2290('0x102')],{});db[_0x2290('0x1fb')]['belongsTo'](db[_0x2290('0x10')],{});db[_0x2290('0x105')][_0x2290('0x156')](db[_0x2290('0x102')],{});db[_0x2290('0x105')][_0x2290('0x156')](db['WhatsappInteraction'],{});db[_0x2290('0x105')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x2290('0x1fc'),'as':'FromAccount'});db[_0x2290('0x105')][_0x2290('0x156')](db[_0x2290('0x148')],{'foreignKey':_0x2290('0x1fd'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x2290('0x156')](db[_0x2290('0x13a')],{'foreignKey':'ToQueueId','as':_0x2290('0x1e6')});db[_0x2290('0x105')][_0x2290('0x156')](db[_0x2290('0x10')],{'foreignKey':_0x2290('0x1e1'),'as':_0x2290('0x1e2')});db[_0x2290('0x105')][_0x2290('0x156')](db[_0x2290('0x10')],{'foreignKey':'ToUserId','as':_0x2290('0x1e4')});db['WhatsappQueue']['belongsToMany'](db[_0x2290('0x10')],{'as':_0x2290('0x182'),'through':_0x2290('0x1fe'),'foreignKey':_0x2290('0x1ff')});db[_0x2290('0x13a')][_0x2290('0x125')](db[_0x2290('0x12b')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x2290('0x200')][_0x2290('0x156')](db[_0x2290('0x10')],{'as':'user','foreignKey':_0x2290('0x115'),'onDelete':_0x2290('0x111'),'hooks':!![]});db[_0x2290('0x165')][_0x2290('0x110')](db[_0x2290('0xc6')],{'as':_0x2290('0xc6'),'onDelete':'restrict'});db['CloudProvider'][_0x2290('0x110')](db[_0x2290('0x164')],{'as':_0x2290('0x168'),'onDelete':_0x2290('0x167')});db[_0x2290('0x165')][_0x2290('0x110')](db[_0x2290('0x3b')],{'as':_0x2290('0x169'),'onDelete':_0x2290('0x167')});module[_0x2290('0x201')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ef9a167..dda04ee 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x611a=['./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','3.12.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/contexts','/api/voice/mohs','/api/voice/queues','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports'];(function(_0x329dd0,_0x47e04f){var _0x4f5b90=function(_0x7d2728){while(--_0x7d2728){_0x329dd0['push'](_0x329dd0['shift']());}};_0x4f5b90(++_0x47e04f);}(_0x611a,0x163));var _0xa611=function(_0x28134c,_0x520058){_0x28134c=_0x28134c-0x0;var _0x30e58e=_0x611a[_0x28134c];return _0x30e58e;};'use strict';var path=require('path');var express=require(_0xa611('0x0'));var errors=require(_0xa611('0x1'));var config=require(_0xa611('0x2'));var setupLoggers=require(_0xa611('0x3'))[_0xa611('0x4')];var clientSideLogs=require(_0xa611('0x5'));exports[_0xa611('0x6')]=function(_0x1fe0cd){return setupLoggers(_0x1fe0cd)[_0xa611('0x7')](function(){_0x1fe0cd[_0xa611('0x8')](_0xa611('0x9'),require(_0xa611('0xa')));_0x1fe0cd[_0xa611('0x8')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x1fe0cd['use'](_0xa611('0xb'),require('./api/voiceContext'));_0x1fe0cd[_0xa611('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x1fe0cd['use'](_0xa611('0xc'),require('./api/voiceMusicOnHold'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xd'),require('./api/voiceQueue'));_0x1fe0cd['use']('/api/voice/recordings',require('./api/voiceRecording'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xe'),require(_0xa611('0xf')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x10'),require(_0xa611('0x11')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x12'),require('./api/voiceMailMessage'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x13'),require(_0xa611('0x14')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x15'),require(_0xa611('0x16')));_0x1fe0cd[_0xa611('0x8')]('/api/voice/agents/reports',require(_0xa611('0x17')));_0x1fe0cd['use']('/api/voice/queues/reports',require(_0xa611('0x18')));_0x1fe0cd['use'](_0xa611('0x19'),require(_0xa611('0x1a')));_0x1fe0cd['use'](_0xa611('0x1b'),require(_0xa611('0x1c')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x1d'),require(_0xa611('0x1e')));_0x1fe0cd[_0xa611('0x8')]('/api/mail/out_servers',require(_0xa611('0x1f')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x20'),require(_0xa611('0x21')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x22'),require(_0xa611('0x23')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x24'),require(_0xa611('0x25')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x26'),require(_0xa611('0x27')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x28'),require(_0xa611('0x29')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x2a'),require(_0xa611('0x2b')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x2c'),require(_0xa611('0x2d')));_0x1fe0cd[_0xa611('0x8')]('/api/dashboards',require(_0xa611('0x2e')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x2f'),require(_0xa611('0x30')));_0x1fe0cd['use']('/api/fax/accounts',require('./api/faxAccount'));_0x1fe0cd['use']('/api/fax/applications',require(_0xa611('0x31')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x32'),require('./api/faxInteraction'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x33'),require(_0xa611('0x34')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x35'),require(_0xa611('0x36')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x37'),require(_0xa611('0x38')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x39'),require(_0xa611('0x3a')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x3b'),require('./api/smsApplication'));_0x1fe0cd['use'](_0xa611('0x3c'),require('./api/smsInteraction'));_0x1fe0cd[_0xa611('0x8')]('/api/sms/messages',require(_0xa611('0x3d')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x3e'),require(_0xa611('0x3f')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x40'),require(_0xa611('0x41')));_0x1fe0cd['use']('/api/openchannel/applications',require(_0xa611('0x42')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x43'),require('./api/openchannelInteraction'));_0x1fe0cd['use'](_0xa611('0x44'),require(_0xa611('0x45')));_0x1fe0cd['use'](_0xa611('0x46'),require('./api/openchannelQueue'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x47'),require('./api/chatWebsite'));_0x1fe0cd[_0xa611('0x8')]('/api/openchannel/reports/queue',require(_0xa611('0x48')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x49'),require(_0xa611('0x4a')));_0x1fe0cd['use'](_0xa611('0x4b'),require(_0xa611('0x4c')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x4d'),require(_0xa611('0x4e')));_0x1fe0cd['use'](_0xa611('0x4f'),require('./api/chatOfflineMessage'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x50'),require(_0xa611('0x51')));_0x1fe0cd[_0xa611('0x8')]('/api/chat/groups',require(_0xa611('0x52')));_0x1fe0cd[_0xa611('0x8')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x53'),require(_0xa611('0x54')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x55'),require('./api/cmContact'));_0x1fe0cd[_0xa611('0x8')]('/api/cm/hopper',require(_0xa611('0x56')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x57'),require(_0xa611('0x58')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x59'),require(_0xa611('0x5a')));_0x1fe0cd['use'](_0xa611('0x5b'),require(_0xa611('0x5c')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x5d'),require('./api/cmCustomField'));_0x1fe0cd[_0xa611('0x8')]('/api/actions',require(_0xa611('0x5e')));_0x1fe0cd['use'](_0xa611('0x5f'),require(_0xa611('0x60')));_0x1fe0cd['use'](_0xa611('0x61'),require(_0xa611('0x62')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x63'),require('./api/disposition'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x64'),require('./api/condition'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x65'),require(_0xa611('0x66')));_0x1fe0cd['use'](_0xa611('0x67'),require('./api/pause'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x68'),require(_0xa611('0x69')));_0x1fe0cd['use'](_0xa611('0x6a'),require(_0xa611('0x6b')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x6c'),require(_0xa611('0x6d')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x6e'),require('./api/sound'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x6f'),require(_0xa611('0x70')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x71'),require(_0xa611('0x72')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x73'),require(_0xa611('0x74')));_0x1fe0cd[_0xa611('0x8')]('/api/cm_hopper_additional_phones',require(_0xa611('0x75')));_0x1fe0cd[_0xa611('0x8')]('/api/templates',require(_0xa611('0x76')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x77'),require(_0xa611('0x78')));_0x1fe0cd[_0xa611('0x8')]('/api/variables',require(_0xa611('0x79')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x7a'),require('./api/integration'));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/reports',require(_0xa611('0x7b')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x7c'),require(_0xa611('0x7d')));_0x1fe0cd['use'](_0xa611('0x7e'),require(_0xa611('0x7f')));_0x1fe0cd['use'](_0xa611('0x80'),require(_0xa611('0x81')));_0x1fe0cd['use'](_0xa611('0x82'),require('./api/analyticMetric'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x83'),require(_0xa611('0x84')));_0x1fe0cd[_0xa611('0x8')]('/api/analytics/tree_reports',require(_0xa611('0x85')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x86'),require(_0xa611('0x87')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x88'),require(_0xa611('0x89')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/salesforce/fields',require(_0xa611('0x8a')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x8b'),require(_0xa611('0x8c')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x8d'),require(_0xa611('0x8e')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x8f'),require(_0xa611('0x90')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x91'),require(_0xa611('0x92')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/desk/fields',require(_0xa611('0x93')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x94'),require(_0xa611('0x95')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/zoho/fields',require(_0xa611('0x96')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/zendesk/accounts',require(_0xa611('0x97')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x98'),require(_0xa611('0x99')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x9a'),require('./api/intZendeskField'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x9b'),require(_0xa611('0x9c')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x9d'),require(_0xa611('0x9e')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/freshdesk/fields',require(_0xa611('0x9f')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xa0'),require('./api/intVtigerAccount'));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xa1'),require(_0xa611('0xa2')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/servicenow/accounts',require(_0xa611('0xa3')));_0x1fe0cd[_0xa611('0x8')]('/api/integrations/servicenow/configurations',require(_0xa611('0xa4')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xa5'),require('./api/intServicenowField'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xa6'),require(_0xa611('0xa7')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xa8'),require(_0xa611('0xa9')));_0x1fe0cd['use'](_0xa611('0xaa'),require('./api/intDynamics365Field'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xab'),require('./api/intFreshsalesAccount'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xac'),require(_0xa611('0xad')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xae'),require(_0xa611('0xaf')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xb0'),require(_0xa611('0xb1')));_0x1fe0cd[_0xa611('0x8')]('/api/chat/reports/queue',require(_0xa611('0xb2')));_0x1fe0cd['use']('/api/chat/internal/messages',require(_0xa611('0xb3')));_0x1fe0cd['use'](_0xa611('0xb4'),require(_0xa611('0xb5')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xb6'),require(_0xa611('0xb7')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xb8'),require(_0xa611('0xb9')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xba'),require(_0xa611('0xbb')));_0x1fe0cd[_0xa611('0x8')]('/api/square/reports',require(_0xa611('0xbc')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xbd'),require(_0xa611('0xbe')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xbf'),require('./api/jscriptyProject'));_0x1fe0cd[_0xa611('0x8')]('/api/settings',require('./api/setting'));_0x1fe0cd['use'](_0xa611('0xc0'),require('./api/squareOdbc'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xc1'),require(_0xa611('0xc2')));_0x1fe0cd['use'](_0xa611('0xc3'),require(_0xa611('0xc4')));_0x1fe0cd['use'](_0xa611('0xc5'),require('./api/squareMessage'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xc6'),require('./api/team'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xc7'),require('./api/license'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xc8'),require(_0xa611('0xc9')));_0x1fe0cd['use'](_0xa611('0xca'),require(_0xa611('0xcb')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xcc'),require(_0xa611('0xcd')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xce'),require('./api/plugin'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xcf'),require('./api/mailTransferReport'));_0x1fe0cd['use'](_0xa611('0xd0'),require('./api/chatTransferReport'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xd1'),require(_0xa611('0xd2')));_0x1fe0cd[_0xa611('0x8')]('/api/openchannel/reports/transfer',require(_0xa611('0xd3')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xd4'),require('./api/smsTransferReport'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xd5'),require(_0xa611('0xd6')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xd7'),require(_0xa611('0xd8')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xd9'),require(_0xa611('0xda')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xdb'),require(_0xa611('0xdc')));_0x1fe0cd['use']('/api/userProfile/resources',require(_0xa611('0xdd')));_0x1fe0cd[_0xa611('0x8')]('/api/userNotifications',require('./api/userNotification'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xde'),require(_0xa611('0xdf')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xe0'),require(_0xa611('0xe1')));_0x1fe0cd[_0xa611('0x8')]('/api/whatsapp/interactions',require(_0xa611('0xe2')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xe3'),require(_0xa611('0xe4')));_0x1fe0cd['use']('/api/whatsapp/reports/queue',require(_0xa611('0xe5')));_0x1fe0cd['use'](_0xa611('0xe6'),require(_0xa611('0xe7')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xe8'),require(_0xa611('0xe9')));_0x1fe0cd[_0xa611('0x8')]('/api/cloudProviders',require(_0xa611('0xea')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xeb'),require(_0xa611('0xec')));_0x1fe0cd['use'](_0xa611('0xed'),require('./api/user-setting'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xee'),require(_0xa611('0xef')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xf0'),require('./api/authLocal'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xf1'),require(_0xa611('0xf2')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xf3'),require('./api/authActiveDirectory'));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xf4'),require(_0xa611('0xf5')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xf6'),require(_0xa611('0xf7')));_0x1fe0cd[_0xa611('0x8')]('/api/version',require('./api/version'));_0x1fe0cd['use'](_0xa611('0xf8'),require(_0xa611('0xf9')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xfa'),require(_0xa611('0xfb')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xfc'),require(_0xa611('0xfd')));_0x1fe0cd[_0xa611('0x8')](_0xa611('0xfe'),clientSideLogs);_0x1fe0cd[_0xa611('0x8')](_0xa611('0xff'),express[_0xa611('0x100')](path['join'](config[_0xa611('0x101')],_0xa611('0xff'))));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x102'),express[_0xa611('0x100')](path[_0xa611('0x103')](config[_0xa611('0x101')],_0xa611('0x102'))));_0x1fe0cd['use'](_0xa611('0x104'),express['static'](path['join'](config['root'],_0xa611('0x104'))));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x105'),express[_0xa611('0x100')](path[_0xa611('0x103')](config['root'],'snippet',_0xa611('0x106'))));_0x1fe0cd[_0xa611('0x8')](_0xa611('0x107'),express[_0xa611('0x100')](path[_0xa611('0x103')](config[_0xa611('0x101')],_0xa611('0x108'))));_0x1fe0cd[_0xa611('0x109')](_0xa611('0x10a'))['get'](errors[0x194]);_0x1fe0cd[_0xa611('0x109')]('/*')[_0xa611('0x10b')](function(_0x440c3c,_0xd0bd69){_0xd0bd69['sendFile'](path['resolve'](_0x1fe0cd[_0xa611('0x10b')](_0xa611('0x10c'))+_0xa611('0x10d')));});return _0x1fe0cd;});}; \ No newline at end of file +var _0xea64=['/api/logs','/apidoc','static','join','/www','root','/demo','/snippet','3.12.1','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./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/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/network','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','./api/squareRecording','./api/squareMessage','./api/team','./api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar'];(function(_0x422ac3,_0x48bbd4){var _0x53c0d4=function(_0x4b50f6){while(--_0x4b50f6){_0x422ac3['push'](_0x422ac3['shift']());}};_0x53c0d4(++_0x48bbd4);}(_0xea64,0x125));var _0x4ea6=function(_0x5182ca,_0x4199c6){_0x5182ca=_0x5182ca-0x0;var _0x421787=_0xea64[_0x5182ca];return _0x421787;};'use strict';var path=require(_0x4ea6('0x0'));var express=require(_0x4ea6('0x1'));var errors=require(_0x4ea6('0x2'));var config=require(_0x4ea6('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x4ea6('0x4'));exports[_0x4ea6('0x5')]=function(_0x45d483){return setupLoggers(_0x45d483)[_0x4ea6('0x6')](function(){_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x8'),require(_0x4ea6('0x9')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xa'),require(_0x4ea6('0xb')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xc'),require(_0x4ea6('0xd')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe'),require(_0x4ea6('0xf')));_0x45d483[_0x4ea6('0x7')]('/api/voice/mohs',require(_0x4ea6('0x10')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x11'),require(_0x4ea6('0x12')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x13'),require('./api/voiceRecording'));_0x45d483[_0x4ea6('0x7')]('/api/screen/recordings',require(_0x4ea6('0x14')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x15'),require('./api/voiceMail'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x16'),require(_0x4ea6('0x17')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x18'),require(_0x4ea6('0x19')));_0x45d483['use']('/api/voice/dials/reports',require(_0x4ea6('0x1a')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x1b'),require(_0x4ea6('0x1c')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x1d'),require(_0x4ea6('0x1e')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x1f'),require(_0x4ea6('0x20')));_0x45d483['use'](_0x4ea6('0x21'),require(_0x4ea6('0x22')));_0x45d483[_0x4ea6('0x7')]('/api/voice/transfers/reports',require(_0x4ea6('0x23')));_0x45d483['use'](_0x4ea6('0x24'),require(_0x4ea6('0x25')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x26'),require('./api/mailAccount'));_0x45d483['use'](_0x4ea6('0x27'),require(_0x4ea6('0x28')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x29'),require(_0x4ea6('0x2a')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x2b'),require('./api/mailInteraction'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x2c'),require(_0x4ea6('0x2d')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x2e'),require(_0x4ea6('0x2f')));_0x45d483['use'](_0x4ea6('0x30'),require(_0x4ea6('0x31')));_0x45d483['use']('/api/dashboards',require(_0x4ea6('0x32')));_0x45d483[_0x4ea6('0x7')]('/api/dashboards/items',require(_0x4ea6('0x33')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x34'),require(_0x4ea6('0x35')));_0x45d483['use'](_0x4ea6('0x36'),require(_0x4ea6('0x37')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x38'),require(_0x4ea6('0x39')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x3a'),require('./api/faxMessage'));_0x45d483['use'](_0x4ea6('0x3b'),require(_0x4ea6('0x3c')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x3d'),require(_0x4ea6('0x3e')));_0x45d483[_0x4ea6('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x3f'),require(_0x4ea6('0x40')));_0x45d483[_0x4ea6('0x7')]('/api/sms/interactions',require(_0x4ea6('0x41')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x42'),require(_0x4ea6('0x43')));_0x45d483[_0x4ea6('0x7')]('/api/sms/queues',require(_0x4ea6('0x44')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x45'),require(_0x4ea6('0x46')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x47'),require(_0x4ea6('0x48')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x49'),require(_0x4ea6('0x4a')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x4b'),require('./api/openchannelMessage'));_0x45d483[_0x4ea6('0x7')]('/api/openchannel/queues',require(_0x4ea6('0x4c')));_0x45d483['use'](_0x4ea6('0x4d'),require(_0x4ea6('0x4e')));_0x45d483[_0x4ea6('0x7')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x4f'),require(_0x4ea6('0x50')));_0x45d483['use'](_0x4ea6('0x51'),require('./api/chatInteraction'));_0x45d483['use'](_0x4ea6('0x52'),require(_0x4ea6('0x53')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x54'),require(_0x4ea6('0x55')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x56'),require(_0x4ea6('0x57')));_0x45d483['use']('/api/chat/groups',require(_0x4ea6('0x58')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x59'),require(_0x4ea6('0x5a')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x5b'),require(_0x4ea6('0x5c')));_0x45d483['use'](_0x4ea6('0x5d'),require('./api/cmContact'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x5e'),require(_0x4ea6('0x5f')));_0x45d483[_0x4ea6('0x7')]('/api/cm/hopper_black',require(_0x4ea6('0x60')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x61'),require(_0x4ea6('0x62')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x63'),require(_0x4ea6('0x64')));_0x45d483[_0x4ea6('0x7')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x45d483[_0x4ea6('0x7')]('/api/actions',require(_0x4ea6('0x65')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x66'),require(_0x4ea6('0x67')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x68'),require(_0x4ea6('0x69')));_0x45d483['use'](_0x4ea6('0x6a'),require(_0x4ea6('0x6b')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x6c'),require(_0x4ea6('0x6d')));_0x45d483[_0x4ea6('0x7')]('/api/intervals',require(_0x4ea6('0x6e')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x6f'),require('./api/pause'));_0x45d483[_0x4ea6('0x7')]('/api/cdr',require(_0x4ea6('0x70')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x71'),require('./api/voiceQueuesLog'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x72'),require('./api/schedule'));_0x45d483['use'](_0x4ea6('0x73'),require('./api/sound'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x74'),require('./api/tag'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x75'),require(_0x4ea6('0x76')));_0x45d483['use'](_0x4ea6('0x77'),require('./api/cmContactHasItem'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x78'),require(_0x4ea6('0x79')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x7a'),require('./api/template'));_0x45d483['use']('/api/triggers',require(_0x4ea6('0x7b')));_0x45d483['use'](_0x4ea6('0x7c'),require(_0x4ea6('0x7d')));_0x45d483['use']('/api/integrations',require(_0x4ea6('0x7e')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x7f'),require('./api/integrationReport'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x80'),require(_0x4ea6('0x81')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x82'),require(_0x4ea6('0x83')));_0x45d483['use'](_0x4ea6('0x84'),require(_0x4ea6('0x85')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x86'),require('./api/analyticMetric'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x87'),require(_0x4ea6('0x88')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x89'),require('./api/analyticTreeReport'));_0x45d483['use'](_0x4ea6('0x8a'),require(_0x4ea6('0x8b')));_0x45d483['use'](_0x4ea6('0x8c'),require(_0x4ea6('0x8d')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x8e'),require(_0x4ea6('0x8f')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x90'),require(_0x4ea6('0x91')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x92'),require(_0x4ea6('0x93')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x94'),require(_0x4ea6('0x95')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x96'),require(_0x4ea6('0x97')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x98'),require(_0x4ea6('0x99')));_0x45d483[_0x4ea6('0x7')]('/api/integrations/desk/fields',require(_0x4ea6('0x9a')));_0x45d483[_0x4ea6('0x7')]('/api/integrations/zoho/accounts',require(_0x4ea6('0x9b')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x9c'),require(_0x4ea6('0x9d')));_0x45d483[_0x4ea6('0x7')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x9e'),require(_0x4ea6('0x9f')));_0x45d483['use']('/api/integrations/zendesk/configurations',require(_0x4ea6('0xa0')));_0x45d483[_0x4ea6('0x7')]('/api/integrations/zendesk/fields',require(_0x4ea6('0xa1')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xa2'),require(_0x4ea6('0xa3')));_0x45d483['use'](_0x4ea6('0xa4'),require(_0x4ea6('0xa5')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xa6'),require(_0x4ea6('0xa7')));_0x45d483[_0x4ea6('0x7')]('/api/integrations/vtiger/accounts',require(_0x4ea6('0xa8')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xa9'),require(_0x4ea6('0xaa')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xab'),require(_0x4ea6('0xac')));_0x45d483['use'](_0x4ea6('0xad'),require(_0x4ea6('0xae')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xaf'),require(_0x4ea6('0xb0')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xb1'),require('./api/intServicenowField'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xb2'),require(_0x4ea6('0xb3')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xb4'),require(_0x4ea6('0xb5')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xb6'),require(_0x4ea6('0xb7')));_0x45d483[_0x4ea6('0x7')]('/api/integrations/freshsales/accounts',require(_0x4ea6('0xb8')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xb9'),require('./api/intFreshsalesConfiguration'));_0x45d483['use'](_0x4ea6('0xba'),require('./api/intFreshsalesField'));_0x45d483[_0x4ea6('0x7')]('/api/networks',require(_0x4ea6('0xbb')));_0x45d483[_0x4ea6('0x7')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xbc'),require('./api/chatInternalMessage'));_0x45d483['use'](_0x4ea6('0xbd'),require(_0x4ea6('0xbe')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xbf'),require(_0x4ea6('0xc0')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xc1'),require(_0x4ea6('0xc2')));_0x45d483['use'](_0x4ea6('0xc3'),require('./api/smsQueueReport'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xc4'),require('./api/squareReport'));_0x45d483['use']('/api/square/details/reports',require(_0x4ea6('0xc5')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xc6'),require(_0x4ea6('0xc7')));_0x45d483['use'](_0x4ea6('0xc8'),require(_0x4ea6('0xc9')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xca'),require('./api/squareOdbc'));_0x45d483[_0x4ea6('0x7')]('/api/square/projects',require(_0x4ea6('0xcb')));_0x45d483[_0x4ea6('0x7')]('/api/square/recordings',require(_0x4ea6('0xcc')));_0x45d483['use']('/api/square/messages',require(_0x4ea6('0xcd')));_0x45d483[_0x4ea6('0x7')]('/api/teams',require(_0x4ea6('0xce')));_0x45d483[_0x4ea6('0x7')]('/api/license',require(_0x4ea6('0xcf')));_0x45d483[_0x4ea6('0x7')]('/api/campaigns',require('./api/campaign'));_0x45d483['use'](_0x4ea6('0xd0'),require(_0x4ea6('0xd1')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xd2'),require(_0x4ea6('0xd3')));_0x45d483['use']('/api/plugins',require(_0x4ea6('0xd4')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xd5'),require('./api/mailTransferReport'));_0x45d483['use'](_0x4ea6('0xd6'),require(_0x4ea6('0xd7')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xd8'),require(_0x4ea6('0xd9')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xda'),require('./api/openchannelTransferReport'));_0x45d483[_0x4ea6('0x7')]('/api/sms/reports/transfer',require(_0x4ea6('0xdb')));_0x45d483[_0x4ea6('0x7')]('/api/cm/lists',require('./api/cmList'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xdc'),require(_0x4ea6('0xdd')));_0x45d483['use'](_0x4ea6('0xde'),require(_0x4ea6('0xdf')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe0'),require(_0x4ea6('0xe1')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe2'),require('./api/userProfileResource'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe3'),require(_0x4ea6('0xe4')));_0x45d483['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x45d483[_0x4ea6('0x7')]('/api/whatsapp/applications',require(_0x4ea6('0xe5')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe6'),require('./api/whatsappInteraction'));_0x45d483[_0x4ea6('0x7')]('/api/whatsapp/messages',require(_0x4ea6('0xe7')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe8'),require('./api/whatsappQueueReport'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xe9'),require(_0x4ea6('0xea')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xeb'),require(_0x4ea6('0xec')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xed'),require('./api/cloudProvider'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xee'),require(_0x4ea6('0xef')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xf0'),require('./api/user-setting'));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xf1'),require(_0x4ea6('0xf2')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xf3'),require(_0x4ea6('0xf4')));_0x45d483['use'](_0x4ea6('0xf5'),require(_0x4ea6('0xf6')));_0x45d483['use']('/api/auth/activedirectory',require(_0x4ea6('0xf7')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xf8'),require(_0x4ea6('0xf9')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xfa'),require(_0x4ea6('0xfb')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xfc'),require(_0x4ea6('0xfd')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0xfe'),require(_0x4ea6('0xff')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x100'),require('./api/pm2'));_0x45d483['use'](_0x4ea6('0x101'),require(_0x4ea6('0x102')));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x103'),clientSideLogs);_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x104'),express[_0x4ea6('0x105')](path[_0x4ea6('0x106')](config['root'],_0x4ea6('0x104'))));_0x45d483['use'](_0x4ea6('0x107'),express[_0x4ea6('0x105')](path[_0x4ea6('0x106')](config['root'],_0x4ea6('0x107'))));_0x45d483[_0x4ea6('0x7')]('/demo',express[_0x4ea6('0x105')](path[_0x4ea6('0x106')](config[_0x4ea6('0x108')],_0x4ea6('0x109'))));_0x45d483[_0x4ea6('0x7')](_0x4ea6('0x10a'),express[_0x4ea6('0x105')](path[_0x4ea6('0x106')](config['root'],'snippet',_0x4ea6('0x10b'))));_0x45d483[_0x4ea6('0x7')]('/plugins',express[_0x4ea6('0x105')](path[_0x4ea6('0x106')](config[_0x4ea6('0x108')],_0x4ea6('0x10c'))));_0x45d483[_0x4ea6('0x10d')](_0x4ea6('0x10e'))[_0x4ea6('0x10f')](errors[0x194]);_0x45d483['route']('/*')[_0x4ea6('0x10f')](function(_0x29278d,_0x265920){_0x265920[_0x4ea6('0x110')](path[_0x4ea6('0x111')](_0x45d483[_0x4ea6('0x10f')](_0x4ea6('0x112'))+_0x4ea6('0x113')));});return _0x45d483;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4dba39a..602321f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8876=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.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'];(function(_0x10b4f4,_0x4f1ca0){var _0x187294=function(_0x342ed2){while(--_0x342ed2){_0x10b4f4['push'](_0x10b4f4['shift']());}};_0x187294(++_0x4f1ca0);}(_0x8876,0xa0));var _0x6887=function(_0x1ff662,_0x49af3a){_0x1ff662=_0x1ff662-0x0;var _0x201aba=_0x8876[_0x1ff662];return _0x201aba;};'use strict';var jayson=require('jayson/promise');var _=require(_0x6887('0x0'));var config=require(_0x6887('0x1'));exports[_0x6887('0x2')]=function(){return new Promise(function(_0x449107,_0x2d6ee1){var _0xb10ba4={};_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/user/user.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x4')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/voiceQueue/voiceQueue.rpc'));_0xb10ba4=_['merge'](_0xb10ba4,require('../api/voiceRecording/voiceRecording.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x5')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x6')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x7')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x8')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x9')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0xa')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0xb')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/mailServerIn/mailServerIn.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/mailAccount/mailAccount.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0xc')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/mailInteraction/mailInteraction.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/mailMessage/mailMessage.rpc'));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0xd')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0xe')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0xf')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x10')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/faxInteraction/faxInteraction.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x11')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x12')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x13')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x14')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/smsMessage/smsMessage.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x15')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x16')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x17')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x18')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x19')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x1a')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/chatInteraction/chatInteraction.rpc'));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x1b')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x1c')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x1d')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x1e')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x1f')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xb10ba4=_['merge'](_0xb10ba4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x20')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/pause/pause.rpc'));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x21')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x22')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/template/template.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x23')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x24')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x25')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x26')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x27')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x28')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x29')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x2a')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x2b')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x2c')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x2d')));_0xb10ba4=_['merge'](_0xb10ba4,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x2e')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x2f')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x30')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x31')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x32')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x33')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x34')));_0xb10ba4=_['merge'](_0xb10ba4,require(_0x6887('0x35')));_0xb10ba4=_['merge'](_0xb10ba4,require('../api/squareMessage/squareMessage.rpc'));_0xb10ba4=_['merge'](_0xb10ba4,require('../api/campaign/campaign.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/attachment/attachment.rpc'));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x36')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x37')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x38')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x39')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require(_0x6887('0x3a')));_0xb10ba4=_[_0x6887('0x3')](_0xb10ba4,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x271c4d=jayson['server'](_0xb10ba4)[_0x6887('0x3b')]();var _0x1e9529=config[_0x6887('0x3c')][_0x6887('0x3d')]||config[_0x6887('0x3d')]+0x1;var _0x20abed=config[_0x6887('0x3c')]['ip']||'localhost';_0x271c4d['on'](_0x6887('0x3e'),function(_0x3c5d73){return _0x2d6ee1(_0x3c5d73);});_0x271c4d[_0x6887('0x2')](_0x1e9529,_0x20abed,function(){console['log'](_0x6887('0x3f'),_0x20abed,_0x1e9529);require(_0x6887('0x40'))[_0x6887('0x41')]();return _0x449107(_0x6887('0x42')+_0x20abed+':'+_0x1e9529);});});}; \ No newline at end of file +var _0x3a5a=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/intSalesforceAccount/intSalesforceAccount.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/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.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','server','http','rpc','port','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x5e7634,_0x5356a1){var _0x563eb3=function(_0x1f73f7){while(--_0x1f73f7){_0x5e7634['push'](_0x5e7634['shift']());}};_0x563eb3(++_0x5356a1);}(_0x3a5a,0x167));var _0xa3a5=function(_0x32cf9b,_0x4b0dca){_0x32cf9b=_0x32cf9b-0x0;var _0x3af8c6=_0x3a5a[_0x32cf9b];return _0x3af8c6;};'use strict';var jayson=require(_0xa3a5('0x0'));var _=require(_0xa3a5('0x1'));var config=require(_0xa3a5('0x2'));exports[_0xa3a5('0x3')]=function(){return new Promise(function(_0x38f4c9,_0x255a0d){var _0x52df17={};_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x5')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x6')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/voiceQueue/voiceQueue.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x7')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x8')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x9')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0xa')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0xb')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0xc')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0xd')));_0x52df17=_['merge'](_0x52df17,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0xe')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0xf')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x10')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x11')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x12')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x13')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x14')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x15')));_0x52df17=_['merge'](_0x52df17,require('../api/faxAccount/faxAccount.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/faxApplication/faxApplication.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x16')));_0x52df17=_['merge'](_0x52df17,require('../api/faxMessage/faxMessage.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x17')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x18')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x19')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x1a')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x1b')));_0x52df17=_['merge'](_0x52df17,require('../api/smsQueue/smsQueue.rpc'));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x1c')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x1d')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x52df17=_['merge'](_0x52df17,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x1e')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x1f')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x20')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x21')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x22')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x23')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x24')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x25')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x26')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x27')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x28')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x29')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x2a')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/template/template.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/trigger/trigger.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/variable/variable.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x2b')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x2c')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x2d')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x2e')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x2f')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x30')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x31')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x32')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x33')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x34')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x35')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x36')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x37')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x38')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x39')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x3a')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x3b')));_0x52df17=_['merge'](_0x52df17,require('../api/squareMessage/squareMessage.rpc'));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x3c')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x3d')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x3e')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x3f')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require(_0xa3a5('0x40')));_0x52df17=_[_0xa3a5('0x4')](_0x52df17,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x41')));_0x52df17=_['merge'](_0x52df17,require(_0xa3a5('0x42')));var _0x309725=jayson[_0xa3a5('0x43')](_0x52df17)[_0xa3a5('0x44')]();var _0x494944=config[_0xa3a5('0x45')]['port']||config[_0xa3a5('0x46')]+0x1;var _0x588905=config['rpc']['ip']||'localhost';_0x309725['on'](_0xa3a5('0x47'),function(_0x1e449b){return _0x255a0d(_0x1e449b);});_0x309725[_0xa3a5('0x3')](_0x494944,_0x588905,function(){console[_0xa3a5('0x48')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x588905,_0x494944);require(_0xa3a5('0x49'))[_0xa3a5('0x4a')]();return _0x38f4c9(_0xa3a5('0x4b')+_0x588905+':'+_0x494944);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d016750..1ff1199 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 _0x7880=['match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join','sendRequest','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','substring','search','function','result=','indexOf','startsWith','split','length'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7880,0x10f));var _0x0788=function(_0x3d95e9,_0x45bb17){_0x3d95e9=_0x3d95e9-0x0;var _0x472c9a=_0x7880[_0x3d95e9];return _0x472c9a;};'use strict';var util=require(_0x0788('0x0'));var _=require('lodash');var EventEmitter=require(_0x0788('0x1'))[_0x0788('0x2')];var AGIReply=require(_0x0788('0x3'));var AGIError=require(_0x0788('0x4'));function AGIChannel(_0x2caf5c){var _0x509799=this,_0x563529=new AGIReply(),_0x10143c=![],_0x487b5b={};EventEmitter[_0x0788('0x5')](_0x509799);_0x2caf5c[_0x0788('0x6')](_0x0788('0x7'));_0x2caf5c['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x563529[_0x0788('0x6')](_0x0788('0x7'));_0x563529['on']('headers',function(_0x1662a2){for(var _0x466e68 in _0x1662a2){_0x509799[_0x466e68]=_0x1662a2[_0x466e68];}_0x509799[_0x0788('0x8')](_0x0788('0x9'));});_0x563529['on'](_0x0788('0xa'),function(_0x14552f){if(_0x14552f[_0x0788('0xb')]()==_0x0788('0xc')){_0x509799[_0x0788('0x8')](_0x0788('0xc'));return;}if(_0x14552f[_0x0788('0xd')](0x0,0xb)=='520-Invalid'){_0x10143c=!![];}if(_0x10143c){_0x487b5b['rx']+=_0x14552f+'\x0a';if(_0x14552f[_0x0788('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x10143c=![];}}else{_0x487b5b['rx']=_0x14552f;}if(_0x10143c){return;}if(typeof _0x487b5b['cb']==_0x0788('0xf')){var _0x9d3024=_0x487b5b['rx'][_0x0788('0xd')](0x0,0x3),_0x107260=null,_0x3e4863=null;_0x9d3024=parseInt(_0x9d3024);if(isNaN(_0x9d3024)){_0x487b5b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x9d3024!=0xc8){_0x487b5b['cb'](null,{'code':_0x9d3024,'result':-0x1,'extra':'KO'});return;}_0x107260=_0x487b5b['rx'][_0x0788('0xd')](0x4)['replace'](_0x0788('0x10'),'');if(_0x107260['indexOf']('\x20')!=-0x1){_0x107260=_0x107260['substr'](0x0,_0x107260[_0x0788('0x11')]('\x20'));}if(_[_0x0788('0x12')](_0x107260,'-1')){_0x107260=parseInt(_0x107260);}_0x3e4863=_0x487b5b['rx'][_0x0788('0x13')]('\x20');if(_0x3e4863['length']==0x3){_0x3e4863=_0x3e4863[0x2][_0x0788('0xd')](0x1,_0x3e4863[0x2][_0x0788('0x14')]-0x1);}else if(_0x3e4863['length']>0x3){var _0x334f58=/\((.+)\)/;var _0x286731=_0x487b5b['rx'][_0x0788('0x15')](_0x334f58);if(_0x286731){_0x3e4863=_0x286731[0x1];}else{_0x3e4863=null;}}else{_0x3e4863=null;}_0x487b5b['cb'](null,{'code':_0x9d3024,'result':_0x107260,'extra':_0x3e4863});}});_0x2caf5c['on']('error',function(_0x5e9ea6){_0x509799[_0x0788('0x8')](_0x0788('0x16'),new AGIError('E_AGI_SOCKET_ERROR',_0x5e9ea6[_0x0788('0x17')]));});_0x2caf5c['on'](_0x0788('0x18'),function(){_0x509799[_0x0788('0x8')](_0x0788('0x18'),new AGIError(_0x0788('0x19')));});_0x2caf5c['on'](_0x0788('0x1a'),function(){_0x509799[_0x0788('0x8')](_0x0788('0x1a'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2caf5c[_0x0788('0x1b')]();});_0x2caf5c[_0x0788('0x1c')](_0x563529);this[_0x0788('0x1d')]=function(_0x3f1de2,_0x2444fc){var _0x3f1de2=_0x3f1de2||'',_0x2444fc=typeof _0x2444fc=='function'?_0x2444fc:new Function();_0x487b5b={'tx':_0x3f1de2,'rx':'','cb':_0x2444fc};_0x2caf5c[_0x0788('0x1e')](_0x3f1de2+'\x0a');},this[_0x0788('0x18')]=function(){_0x2caf5c[_0x0788('0x1b')]();};}util[_0x0788('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x2820e4){return this[_0x0788('0x1d')]['sync'](this,_0x2820e4);};AGIChannel[_0x0788('0x20')][_0x0788('0x21')]=function(){return this['sendRequest'](_0x0788('0x22'));};AGIChannel[_0x0788('0x20')][_0x0788('0x23')]=function(_0x20da9f,_0x4bfc25,_0x2c3cd0){_0x20da9f=_0x20da9f===undefined?'beep':_0x20da9f;_0x4bfc25=_0x4bfc25===undefined?'5':_0x4bfc25;_0x2c3cd0=_0x2c3cd0===undefined?'1':_0x2c3cd0;return this['sendRequest'](util[_0x0788('0x24')](_0x0788('0x25'),_0x20da9f,_0x4bfc25*0x3e8,_0x2c3cd0));};AGIChannel[_0x0788('0x20')][_0x0788('0x26')]=function(_0x593980){_0x593980=_0x593980||'NO\x20MESSAGE';return this['sendRequest'](util[_0x0788('0x24')](_0x0788('0x27'),_0x593980));};AGIChannel['prototype'][_0x0788('0x28')]=function(_0x333262,_0x519fd4){if(_[_0x0788('0x29')](_0x519fd4)){return this['sendRequest'](util[_0x0788('0x24')]('EXEC\x20%s\x20%s',_0x333262,_0x519fd4[_0x0788('0x2a')](',')));}return this[_0x0788('0x2b')](util[_0x0788('0x24')]('EXEC\x20%s\x20%s',_0x333262,_0x519fd4));};AGIChannel['prototype'][_0x0788('0x2c')]=function(_0x3af006){return this[_0x0788('0x2b')](util['format'](_0x0788('0x2d'),_0x3af006));};AGIChannel['prototype'][_0x0788('0x2e')]=function(_0x38dcad){return this[_0x0788('0x2b')](util[_0x0788('0x24')](_0x0788('0x2f'),_0x38dcad));};AGIChannel[_0x0788('0x20')]['setPriority']=function(_0x2659be){return this[_0x0788('0x2b')](util[_0x0788('0x24')](_0x0788('0x30'),_0x2659be));};AGIChannel[_0x0788('0x20')][_0x0788('0xc')]=function(){return this[_0x0788('0x2b')](_0x0788('0x31'));};AGIChannel[_0x0788('0x20')][_0x0788('0x32')]=function(_0x2614ff,_0x5f5a35){var _0x1172cc=_[_0x0788('0x33')](_0x5f5a35)||_[_0x0788('0x34')](_0x5f5a35)?_0x5f5a35[_0x0788('0x35')]():_0x5f5a35;return this[_0x0788('0x2b')](util[_0x0788('0x24')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2614ff,_0x1172cc?_0x1172cc[_0x0788('0x35')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0788('0x20')][_0x0788('0x36')]=function(_0x34596c,_0x4fbbfd){return this[_0x0788('0x2b')](util[_0x0788('0x24')]('SAY\x20NUMBER\x20%s\x20%s',_0x34596c,_0x4fbbfd));};AGIChannel[_0x0788('0x20')][_0x0788('0x37')]=function(_0x72750f,_0x16a56b){return this[_0x0788('0x2b')](util[_0x0788('0x24')](_0x0788('0x38'),_0x72750f,_0x16a56b));};AGIChannel[_0x0788('0x20')]['sayPhonetic']=function(_0x350125,_0x417bb6){return this[_0x0788('0x2b')](util[_0x0788('0x24')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x350125,_0x417bb6));};AGIChannel[_0x0788('0x20')][_0x0788('0x39')]=function(_0x15e3ce,_0x2de3b0,_0x1fea43){_0x2de3b0=_0x2de3b0||this['extension'];_0x1fea43=_0x1fea43||0x1;this[_0x0788('0x2c')](_0x15e3ce);this['setExtension'](_0x2de3b0);this[_0x0788('0x3a')](_0x1fea43);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0x15e3ce,_0x2de3b0,_0x1fea43));};AGIChannel[_0x0788('0x20')][_0x0788('0x3b')]=function(_0x3e16a0){return this[_0x0788('0x2b')](util[_0x0788('0x24')](_0x0788('0x3c'),_0x3e16a0));};AGIChannel[_0x0788('0x20')][_0x0788('0x3d')]=function(_0x3265ab,_0x3fd7c5,_0x35b018,_0x267554,_0x424900,_0x12b2d2){_0x3fd7c5=_0x3fd7c5||_0x0788('0x3e');_0x35b018=_0x35b018||'';_0x267554=_0x267554===undefined?-0x1:_0x267554==='-1'?-0x1:_0x267554*0x3e8;_0x424900=_0x424900===undefined?'':'s='+_0x424900;_0x12b2d2=_0x12b2d2?_0x0788('0x3f'):'';return this[_0x0788('0x2b')](util[_0x0788('0x24')](_0x0788('0x40'),_0x3265ab,_0x3fd7c5,_0x35b018,_0x267554,_0x12b2d2,_0x424900));};AGIChannel[_0x0788('0x20')][_0x0788('0x41')]=function(_0x5285c0,_0x3da9e8){_0x3da9e8=_0x3da9e8||'';return this[_0x0788('0x2b')](util[_0x0788('0x24')](_0x0788('0x42'),_0x5285c0,_0x3da9e8));};AGIChannel['prototype']['agi']=function(_0x427731){return this[_0x0788('0x28')](_0x0788('0x43'),_0x427731);};AGIChannel[_0x0788('0x20')][_0x0788('0x44')]=function(_0x39a636){return this[_0x0788('0x28')](_0x0788('0x45'),_0x39a636);};AGIChannel['prototype'][_0x0788('0x16')]=function(_0x201bb4,_0x31a409){this['noop'](util['format'](_0x0788('0x46'),_0x201bb4['id'],_0x201bb4[_0x0788('0x47')],_0x31a409));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0788('0x48')]=AGIChannel; \ No newline at end of file +var _0xbd3c=['destroy','inherits','prototype','sendRequest','command','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','./error','call','setEncoding','setTimeout','utf8','emit','ready','line','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','pipe','write'];(function(_0x18cb8d,_0x272da9){var _0x35c5ae=function(_0x34ee9a){while(--_0x34ee9a){_0x18cb8d['push'](_0x18cb8d['shift']());}};_0x35c5ae(++_0x272da9);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x3d0475,_0x5dcd43){_0x3d0475=_0x3d0475-0x0;var _0x4de6ee=_0xbd3c[_0x3d0475];return _0x4de6ee;};'use strict';var util=require(_0xcbd3('0x0'));var _=require(_0xcbd3('0x1'));var EventEmitter=require(_0xcbd3('0x2'))['EventEmitter'];var AGIReply=require(_0xcbd3('0x3'));var AGIError=require(_0xcbd3('0x4'));function AGIChannel(_0x45274b){var _0x47ff9b=this,_0x505967=new AGIReply(),_0x2b7178=![],_0x5c280d={};EventEmitter[_0xcbd3('0x5')](_0x47ff9b);_0x45274b[_0xcbd3('0x6')]('utf8');_0x45274b[_0xcbd3('0x7')](0x8*0x3c*0x3c*0x3e8);_0x505967[_0xcbd3('0x6')](_0xcbd3('0x8'));_0x505967['on']('headers',function(_0x18fb60){for(var _0x258d74 in _0x18fb60){_0x47ff9b[_0x258d74]=_0x18fb60[_0x258d74];}_0x47ff9b[_0xcbd3('0x9')](_0xcbd3('0xa'));});_0x505967['on'](_0xcbd3('0xb'),function(_0x5826e6){if(_0x5826e6['toLowerCase']()==_0xcbd3('0xc')){_0x47ff9b[_0xcbd3('0x9')]('hangup');return;}if(_0x5826e6['substring'](0x0,0xb)=='520-Invalid'){_0x2b7178=!![];}if(_0x2b7178){_0x5c280d['rx']+=_0x5826e6+'\x0a';if(_0x5826e6[_0xcbd3('0xd')](_0xcbd3('0xe'))!=-0x1){_0x2b7178=![];}}else{_0x5c280d['rx']=_0x5826e6;}if(_0x2b7178){return;}if(typeof _0x5c280d['cb']==_0xcbd3('0xf')){var _0x488258=_0x5c280d['rx'][_0xcbd3('0x10')](0x0,0x3),_0x6e7d38=null,_0x267d31=null;_0x488258=parseInt(_0x488258);if(isNaN(_0x488258)){_0x5c280d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xcbd3('0x11')});return;}if(_0x488258!=0xc8){_0x5c280d['cb'](null,{'code':_0x488258,'result':-0x1,'extra':'KO'});return;}_0x6e7d38=_0x5c280d['rx'][_0xcbd3('0x10')](0x4)[_0xcbd3('0x12')]('result=','');if(_0x6e7d38[_0xcbd3('0x13')]('\x20')!=-0x1){_0x6e7d38=_0x6e7d38['substr'](0x0,_0x6e7d38[_0xcbd3('0x13')]('\x20'));}if(_[_0xcbd3('0x14')](_0x6e7d38,'-1')){_0x6e7d38=parseInt(_0x6e7d38);}_0x267d31=_0x5c280d['rx'][_0xcbd3('0x15')]('\x20');if(_0x267d31['length']==0x3){_0x267d31=_0x267d31[0x2][_0xcbd3('0x10')](0x1,_0x267d31[0x2]['length']-0x1);}else if(_0x267d31[_0xcbd3('0x16')]>0x3){var _0x5941a5=/\((.+)\)/;var _0x460c02=_0x5c280d['rx'][_0xcbd3('0x17')](_0x5941a5);if(_0x460c02){_0x267d31=_0x460c02[0x1];}else{_0x267d31=null;}}else{_0x267d31=null;}_0x5c280d['cb'](null,{'code':_0x488258,'result':_0x6e7d38,'extra':_0x267d31});}});_0x45274b['on'](_0xcbd3('0x18'),function(_0x115336){_0x47ff9b[_0xcbd3('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x115336[_0xcbd3('0x19')]));});_0x45274b['on'](_0xcbd3('0x1a'),function(){_0x47ff9b[_0xcbd3('0x9')]('close',new AGIError(_0xcbd3('0x1b')));});_0x45274b['on']('timeout',function(){_0x47ff9b[_0xcbd3('0x9')]('timeout',new AGIError(_0xcbd3('0x1c')));_0x45274b['destroy']();});_0x45274b[_0xcbd3('0x1d')](_0x505967);this['command']=function(_0x5f0bcb,_0x3e86c1){var _0x5f0bcb=_0x5f0bcb||'',_0x3e86c1=typeof _0x3e86c1=='function'?_0x3e86c1:new Function();_0x5c280d={'tx':_0x5f0bcb,'rx':'','cb':_0x3e86c1};_0x45274b[_0xcbd3('0x1e')](_0x5f0bcb+'\x0a');},this[_0xcbd3('0x1a')]=function(){_0x45274b[_0xcbd3('0x1f')]();};}util[_0xcbd3('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x22')]=function(_0x32d34f){return this[_0xcbd3('0x23')]['sync'](this,_0x32d34f);};AGIChannel[_0xcbd3('0x21')]['answer']=function(){return this[_0xcbd3('0x22')]('ANSWER');};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x24')]=function(_0x4fb411,_0x21520a,_0x52cc97){_0x4fb411=_0x4fb411===undefined?_0xcbd3('0x25'):_0x4fb411;_0x21520a=_0x21520a===undefined?'5':_0x21520a;_0x52cc97=_0x52cc97===undefined?'1':_0x52cc97;return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x27'),_0x4fb411,_0x21520a*0x3e8,_0x52cc97));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x28')]=function(_0x15349e){_0x15349e=_0x15349e||'NO\x20MESSAGE';return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x29'),_0x15349e));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x2a')]=function(_0x45aadb,_0x3a74e2){if(_[_0xcbd3('0x2b')](_0x3a74e2)){return this[_0xcbd3('0x22')](util['format'](_0xcbd3('0x2c'),_0x45aadb,_0x3a74e2['join'](',')));}return this['sendRequest'](util[_0xcbd3('0x26')](_0xcbd3('0x2c'),_0x45aadb,_0x3a74e2));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x2d')]=function(_0x20ed3b){return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')]('SET\x20CONTEXT\x20%s',_0x20ed3b));};AGIChannel[_0xcbd3('0x21')]['setExtension']=function(_0x9869ce){return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x2e'),_0x9869ce));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x2f')]=function(_0x101266){return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')]('SET\x20PRIORITY\x20%s',_0x101266));};AGIChannel['prototype'][_0xcbd3('0xc')]=function(){return this['sendRequest'](_0xcbd3('0x30'));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x31')]=function(_0x2ea7a2,_0x15a44f){var _0x35046c=_['isBoolean'](_0x15a44f)||_[_0xcbd3('0x32')](_0x15a44f)?_0x15a44f[_0xcbd3('0x33')]():_0x15a44f;return this['sendRequest'](util[_0xcbd3('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2ea7a2,_0x35046c?_0x35046c[_0xcbd3('0x33')]()[_0xcbd3('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x34')]=function(_0x55147f,_0x5866c5){return this[_0xcbd3('0x22')](util['format'](_0xcbd3('0x35'),_0x55147f,_0x5866c5));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x36')]=function(_0x4a2449,_0xf5652e){return this[_0xcbd3('0x22')](util['format'](_0xcbd3('0x37'),_0x4a2449,_0xf5652e));};AGIChannel[_0xcbd3('0x21')]['sayPhonetic']=function(_0x296784,_0x1fc203){return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x38'),_0x296784,_0x1fc203));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x39')]=function(_0x17db0f,_0x5275e8,_0x3784cc){_0x5275e8=_0x5275e8||this[_0xcbd3('0x3a')];_0x3784cc=_0x3784cc||0x1;this[_0xcbd3('0x2d')](_0x17db0f);this[_0xcbd3('0x3b')](_0x5275e8);this[_0xcbd3('0x2f')](_0x3784cc);return this['noop'](util[_0xcbd3('0x26')](_0xcbd3('0x3c'),_0x17db0f,_0x5275e8,_0x3784cc));};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x3d')]=function(_0x45f75b){return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x3e'),_0x45f75b));};AGIChannel['prototype'][_0xcbd3('0x3f')]=function(_0x14b681,_0x148a11,_0x1848f3,_0xb486c6,_0x4eb4c3,_0x439429){_0x148a11=_0x148a11||_0xcbd3('0x40');_0x1848f3=_0x1848f3||'';_0xb486c6=_0xb486c6===undefined?-0x1:_0xb486c6==='-1'?-0x1:_0xb486c6*0x3e8;_0x4eb4c3=_0x4eb4c3===undefined?'':'s='+_0x4eb4c3;_0x439429=_0x439429?_0xcbd3('0x41'):'';return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x42'),_0x14b681,_0x148a11,_0x1848f3,_0xb486c6,_0x439429,_0x4eb4c3));};AGIChannel['prototype'][_0xcbd3('0x43')]=function(_0xfaadf2,_0x507e1c){_0x507e1c=_0x507e1c||'';return this[_0xcbd3('0x22')](util[_0xcbd3('0x26')](_0xcbd3('0x44'),_0xfaadf2,_0x507e1c));};AGIChannel[_0xcbd3('0x21')]['agi']=function(_0x482e3c){return this[_0xcbd3('0x2a')](_0xcbd3('0x45'),_0x482e3c);};AGIChannel[_0xcbd3('0x21')][_0xcbd3('0x46')]=function(_0x21125b){return this[_0xcbd3('0x2a')](_0xcbd3('0x47'),_0x21125b);};AGIChannel[_0xcbd3('0x21')]['error']=function(_0x33eb4f,_0x557ea0){this[_0xcbd3('0x28')](util['format'](_0xcbd3('0x48'),_0x33eb4f['id'],_0x33eb4f[_0xcbd3('0x49')],_0x557ea0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcbd3('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e2aae8d..c192afb 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 _0xea2b=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','exports','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x3cb98e,_0x2ce8ad){var _0x22eb26=function(_0x396cb6){while(--_0x396cb6){_0x3cb98e['push'](_0x3cb98e['shift']());}};_0x22eb26(++_0x2ce8ad);}(_0xea2b,0x116));var _0xbea2=function(_0x2269f5,_0x29d689){_0x2269f5=_0x2269f5-0x0;var _0xc7401f=_0xea2b[_0x2269f5];return _0xc7401f;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xbea2('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xbea2('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xbea2('0x2'),'E_AGI_SOCKET_ERROR':_0xbea2('0x3'),'E_AGI_SOCKET_CLOSE':_0xbea2('0x4'),'E_AGI_SOCKET_TIMEOUT':_0xbea2('0x5'),'E_AGI_COMMAND_EMPTY':_0xbea2('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbea2('0x7'),'E_AGI_IVR_ENTRY':_0xbea2('0x8')};function AGIError(_0x273a29){var _0x273a29=_0x273a29||null,_0x337e36=_0x337e36||[],_0x504604=0x1,_0x286da3='';if(!error[_0x273a29]){_0x273a29=_0xbea2('0x9');}_0x337e36[_0xbea2('0xa')](error[_0x273a29]);while(arguments[_0x504604]){_0x337e36[_0xbea2('0xa')](arguments[_0x504604]);_0x504604++;}_0x286da3=util[_0xbea2('0xb')]['apply'](util,_0x337e36);this[_0xbea2('0xc')]=_0x286da3;this['name']=_0x273a29;}module[_0xbea2('0xd')]=AGIError; \ No newline at end of file +var _0xe32b=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','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\x20timeout.','Empty\x20command.'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe32b,0xc8));var _0xbe32=function(_0x5940cd,_0x2fcacc){_0x5940cd=_0x5940cd-0x0;var _0x54b550=_0xe32b[_0x5940cd];return _0x54b550;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xbe32('0x0'),'E_AGI_ARGUMENT_PORT':_0xbe32('0x1'),'E_AGI_SERVER_ERROR':_0xbe32('0x2'),'E_AGI_SERVER_CLOSE':_0xbe32('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xbe32('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xbe32('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xbe32('0x6'),'E_AGI_COMMAND_EMPTY':_0xbe32('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbe32('0x8'),'E_AGI_IVR_ENTRY':_0xbe32('0x9')};function AGIError(_0x5e5eef){var _0x5e5eef=_0x5e5eef||null,_0x385ddb=_0x385ddb||[],_0x456009=0x1,_0x51404d='';if(!error[_0x5e5eef]){_0x5e5eef=_0xbe32('0xa');}_0x385ddb[_0xbe32('0xb')](error[_0x5e5eef]);while(arguments[_0x456009]){_0x385ddb[_0xbe32('0xb')](arguments[_0x456009]);_0x456009++;}_0x51404d=util[_0xbe32('0xc')][_0xbe32('0xd')](util,_0x385ddb);this[_0xbe32('0xe')]=_0x51404d;this[_0xbe32('0xf')]=_0x5e5eef;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 31cfe6e..4440963 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 _0x9c0b=['events','EventEmitter','ioredis','./error','defaults','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','lodash'];(function(_0x3cf0a5,_0x7922b6){var _0x25b201=function(_0x392df9){while(--_0x392df9){_0x3cf0a5['push'](_0x3cf0a5['shift']());}};_0x25b201(++_0x7922b6);}(_0x9c0b,0xc2));var _0xb9c0=function(_0x546f24,_0x485e39){_0x546f24=_0x546f24-0x0;var _0x6c3dac=_0x9c0b[_0x546f24];return _0x6c3dac;};'use strict';var _=require(_0xb9c0('0x0'));var EventEmitter=require(_0xb9c0('0x1'))[_0xb9c0('0x2')];var Redis=require(_0xb9c0('0x3'));var AGIError=require(_0xb9c0('0x4'));var config=require('../../config/environment');config['redis']=_[_0xb9c0('0x5')](config[_0xb9c0('0x6')],{'host':_0xb9c0('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xb9c0('0x6')]);sub[_0xb9c0('0x8')](_0xb9c0('0x9'),function(_0x6beea5){if(_0x6beea5)return eventEmitter[_0xb9c0('0xa')](_0xb9c0('0xb'),new AGIError(_0xb9c0('0xc'),_0x6beea5));});sub['on'](_0xb9c0('0xd'),function(_0x19a859,_0x14b745){if(_0x19a859!==_0xb9c0('0x9'))return;try{var _0x1b540c=JSON[_0xb9c0('0xe')](_0x14b745);eventEmitter[_0xb9c0('0xa')]('projectUpdate',_0x1b540c);}catch(_0xa23f40){eventEmitter[_0xb9c0('0xa')](_0xb9c0('0xb'),new AGIError(_0xb9c0('0xc'),_0xa23f40));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x1cc8=['E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','lodash','events','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','agi','error'];(function(_0x449e6f,_0x1f7bca){var _0x5201d0=function(_0x136770){while(--_0x136770){_0x449e6f['push'](_0x449e6f['shift']());}};_0x5201d0(++_0x1f7bca);}(_0x1cc8,0x1b8));var _0x81cc=function(_0x4da20a,_0x2d5f40){_0x4da20a=_0x4da20a-0x0;var _0x2439e9=_0x1cc8[_0x4da20a];return _0x2439e9;};'use strict';var _=require(_0x81cc('0x0'));var EventEmitter=require(_0x81cc('0x1'))[_0x81cc('0x2')];var Redis=require(_0x81cc('0x3'));var AGIError=require('./error');var config=require(_0x81cc('0x4'));config[_0x81cc('0x5')]=_[_0x81cc('0x6')](config[_0x81cc('0x5')],{'host':_0x81cc('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x81cc('0x8'),function(_0x2fafe0){if(_0x2fafe0)return eventEmitter['emit'](_0x81cc('0x9'),new AGIError(_0x81cc('0xa'),_0x2fafe0));});sub['on'](_0x81cc('0xb'),function(_0x452c6f,_0x2bd641){if(_0x452c6f!==_0x81cc('0x8'))return;try{var _0x3ac011=JSON[_0x81cc('0xc')](_0x2bd641);eventEmitter[_0x81cc('0xd')](_0x81cc('0xe'),_0x3ac011);}catch(_0x32d261){eventEmitter[_0x81cc('0xd')](_0x81cc('0x9'),new AGIError(_0x81cc('0xa'),_0x32d261));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a6d5591..98f40f4 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 _0xb37b=['agicommand','vswitch','target','default','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split'];(function(_0x534f7c,_0x3eb489){var _0x5c3e22=function(_0x5dd4a4){while(--_0x5dd4a4){_0x534f7c['push'](_0x534f7c['shift']());}};_0x5c3e22(++_0x3eb489);}(_0xb37b,0x84));var _0xbb37=function(_0x179797,_0x11255b){_0x179797=_0x179797-0x0;var _0x700fe1=_0xb37b[_0x179797];return _0x700fe1;};'use strict';var _=require(_0xbb37('0x0'));var logger=require(_0xbb37('0x1'))(_0xbb37('0x2'));var verticesWithRetry=[_0xbb37('0x3'),'getdigits',_0xbb37('0x4')];var Graph=function(){this[_0xbb37('0x5')]={};this[_0xbb37('0x6')]={};this[_0xbb37('0x7')]=0x0;};Graph[_0xbb37('0x8')][_0xbb37('0x9')]=function(_0x1c6382){this[_0xbb37('0x5')][_0x1c6382['id']]=_0x1c6382;this[_0xbb37('0x6')][_0x1c6382['id']]=[];};Graph['prototype'][_0xbb37('0xa')]=function(_0x40fff6,_0x447d4d,_0x499aff){this[_0xbb37('0x6')][_0x40fff6][_0xbb37('0xb')]({'target':_0x447d4d,'condition':_0x499aff});this[_0xbb37('0x7')]+=0x1;};Graph[_0xbb37('0x8')][_0xbb37('0xc')]=function(){return _['size'](this[_0xbb37('0x5')]);};Graph[_0xbb37('0x8')][_0xbb37('0xd')]=function(){return this[_0xbb37('0x7')];};Graph[_0xbb37('0x8')][_0xbb37('0xe')]=function(_0x2ff992){return this[_0xbb37('0x5')][_0x2ff992];};Graph['prototype'][_0xbb37('0xf')]=function(_0x4d9fcd,_0x108c94){if(!this[_0xbb37('0x5')][_0x4d9fcd]){return logger[_0xbb37('0x10')](_0xbb37('0x11'));}var _0x102046=_0x108c94(this['vertices'][_0x4d9fcd]);if(!_0x102046){return logger[_0xbb37('0x10')](_0xbb37('0x12'));}if(this[_0xbb37('0x6')][_0x4d9fcd]['length']===0x0){return logger['info'](_0xbb37('0x13'));}for(var _0xee4929=0x0,_0x2e53bc=[],_0x156084=![];_0xee4929\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','push','env'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcba,0x15b));var _0xafcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xafcb('0x0'));var syncho=require(_0xafcb('0x1'));var util=require('util');var config=require(_0xafcb('0x2'));var logger=require(_0xafcb('0x3'))(_0xafcb('0x4'));var utilLicense=require(_0xafcb('0x5'));var rpc=require(_0xafcb('0x6'));var Project=require(_0xafcb('0x7'));var AGIEmitter=require(_0xafcb('0x8'))[_0xafcb('0x9')];var projects=[];config[_0xafcb('0x4')]=_[_0xafcb('0xa')](config[_0xafcb('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xafcb('0xb'),projectUpdateHandler);function connectionHandler(_0x3177b4){process[_0xafcb('0xc')](function(){syncho(function(){try{setChannelVariables(_0x3177b4);agiHandler(_0x3177b4);}catch(_0x1796ee){logger[_0xafcb('0xd')](_0x1796ee[_0xafcb('0xe')]);}});});}function projectUpdateHandler(_0x5da77e){try{var _0x30b155=_[_0xafcb('0xf')](projects,['id',_0x5da77e['id']]);if(_0x30b155>-0x1){if(_0x5da77e[_0xafcb('0x10')]===!![]){projects['splice'](_0x30b155,0x1);}else{projects[_0x30b155]=_0x5da77e;}}else{projects[_0xafcb('0x11')](_0x5da77e);}}catch(_0x3fedd1){logger['error'](_0x3fedd1[_0xafcb('0xe')]);}}function listeningHandler(){var _0x3ddb15=config[_0xafcb('0x12')]===_0xafcb('0x13')||![];console['log'](_0xafcb('0x14'),config[_0xafcb('0x4')][_0xafcb('0x15')]);logger[_0xafcb('0x16')](util[_0xafcb('0x17')](_0xafcb('0x18'),_0x3ddb15?config[_0xafcb('0x4')]['ip']:_0xafcb('0x19'),config[_0xafcb('0x4')][_0xafcb('0x15')]));}function errorHandler(_0x312d6c){if(_0x312d6c&&_0x312d6c[_0xafcb('0x1a')]&&_0x312d6c['message']){logger[_0xafcb('0xd')](util['format']('[%s]\x20%s',_0x312d6c[_0xafcb('0x1a')],_0x312d6c['message']));}else{logger['error'](util[_0xafcb('0x17')](_0xafcb('0x1b'),_0x312d6c[_0xafcb('0xe')]));}}function closeHandler(){logger['info'](util['format'](_0xafcb('0x1c'),this[_0xafcb('0x1d')],this[_0xafcb('0x1e')],this[_0xafcb('0x1f')],this[_0xafcb('0x20')],this[_0xafcb('0x21')]));try{createSquareReport(this);}catch(_0x757fd2){logger[_0xafcb('0xd')](_0x757fd2[_0xafcb('0xe')]);}}function timeoutHandler(){logger[_0xafcb('0x16')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xafcb('0x1d')],this[_0xafcb('0x1e')],this[_0xafcb('0x1f')],this[_0xafcb('0x20')],this[_0xafcb('0x21')]));}function hangupHandler(){logger[_0xafcb('0x16')](util['format'](_0xafcb('0x22'),this['arg_1'],this['calleridname'],this[_0xafcb('0x1f')],this[_0xafcb('0x20')],this['uniqueid']));this[_0xafcb('0x23')]=!![];}function createSquareReport(_0x2b1bf2,_0x29847e){rpc[_0xafcb('0x24')](_0x2b1bf2)[_0xafcb('0x25')](function(_0x1a3a7e){if(_0x29847e){_0x29847e(null,_0x1a3a7e);}})[_0xafcb('0x26')](function(_0x192859){if(_0x29847e){_0x29847e(null,_0x192859);}});}function setChannelVariables(_0x1f2d93){for(var _0x567c38 in _0x1f2d93){if(_0x1f2d93[_0xafcb('0x27')](_0x567c38)){if(_0x567c38[_0xafcb('0x28')]('agi_')===0x0){_0x1f2d93[_0x567c38[_0xafcb('0x29')](0x4)]=_0x1f2d93[_0x567c38];delete _0x1f2d93[_0x567c38];}}}}function agiHandler(_0x500819){logger[_0xafcb('0x2a')](_0xafcb('0x2b'),JSON[_0xafcb('0x2c')](_0x500819,null,0x2));logger[_0xafcb('0x16')](util[_0xafcb('0x17')](_0xafcb('0x2d'),_0x500819['arg_1'],_0x500819[_0xafcb('0x1e')],_0x500819[_0xafcb('0x1f')],_0x500819[_0xafcb('0x20')],_0x500819[_0xafcb('0x21')]));_0x500819['on']('error',errorHandler);_0x500819['on'](_0xafcb('0x2e'),closeHandler);_0x500819['on'](_0xafcb('0x2f'),timeoutHandler);_0x500819[_0xafcb('0x23')]=![];_0x500819['on'](_0xafcb('0x30'),hangupHandler);var _0x212de1=_[_0xafcb('0x31')](projects,['name',_0x500819[_0xafcb('0x1d')]]);if(!_0x212de1)return Project[_0xafcb('0x32')](_0x500819);if(!_0x212de1[_0xafcb('0x13')])return Project[_0xafcb('0x33')](_0x500819);return Project['initialize'](_0x212de1,_0x500819);}function main(){var _0x3ca134;return utilLicense[_0xafcb('0x34')]()['then'](function(_0x4d02f6){if(!_0x4d02f6)return;if(_0x4d02f6[_0xafcb('0x35')]){if(_0x4d02f6['callysquare']&&_0x4d02f6[_0xafcb('0x36')]>0x0){logger[_0xafcb('0x16')](util[_0xafcb('0x17')](_0xafcb('0x37'),_0x4d02f6[_0xafcb('0x36')]));_0x3ca134=_0x4d02f6[_0xafcb('0x36')];}else{logger[_0xafcb('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xafcb('0x16')](_0xafcb('0x38'));_0x3ca134=-0x1;}})['then'](function(){return Project[_0xafcb('0x39')]();})['then'](function(_0x259f16){projects=_0x259f16;return;})[_0xafcb('0x26')](function(_0x32944a){logger[_0xafcb('0xd')](_0xafcb('0x3a'),_0x32944a[_0xafcb('0xe')]);})[_0xafcb('0x3b')](function(){var _0x354367=require('./server')(config[_0xafcb('0x4')]['port'],config['agi']['ip'],_0x3ca134);_0x354367['on'](_0xafcb('0xd'),errorHandler);_0x354367['on'](_0xafcb('0x3c'),listeningHandler);_0x354367['on']('connection',connectionHandler);_0x354367['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x3039=['[LICENSE]','finally','./server','lodash','util','../../config/environment','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','nextTick','error','findIndex','deleted','splice','stack','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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_','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch'];(function(_0x27ee1c,_0x5d93b7){var _0x226db3=function(_0x55f2a2){while(--_0x55f2a2){_0x27ee1c['push'](_0x27ee1c['shift']());}};_0x226db3(++_0x5d93b7);}(_0x3039,0x1cb));var _0x9303=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3039[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9303('0x0'));var syncho=require('syncho');var util=require(_0x9303('0x1'));var config=require(_0x9303('0x2'));var logger=require(_0x9303('0x3'))(_0x9303('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9303('0x5'));var Project=require(_0x9303('0x6'));var AGIEmitter=require(_0x9303('0x7'))[_0x9303('0x8')];var projects=[];config[_0x9303('0x4')]=_[_0x9303('0x9')](config[_0x9303('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4d9fe9){process[_0x9303('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4d9fe9);agiHandler(_0x4d9fe9);}catch(_0x436096){logger[_0x9303('0xb')](_0x436096['stack']);}});});}function projectUpdateHandler(_0x1336cf){try{var _0x5af3d5=_[_0x9303('0xc')](projects,['id',_0x1336cf['id']]);if(_0x5af3d5>-0x1){if(_0x1336cf[_0x9303('0xd')]===!![]){projects[_0x9303('0xe')](_0x5af3d5,0x1);}else{projects[_0x5af3d5]=_0x1336cf;}}else{projects['push'](_0x1336cf);}}catch(_0x113182){logger[_0x9303('0xb')](_0x113182[_0x9303('0xf')]);}}function listeningHandler(){var _0x5b2c13=config[_0x9303('0x10')]===_0x9303('0x11')||![];console[_0x9303('0x12')](_0x9303('0x13'),config[_0x9303('0x4')][_0x9303('0x14')]);logger[_0x9303('0x15')](util[_0x9303('0x16')](_0x9303('0x17'),_0x5b2c13?config[_0x9303('0x4')]['ip']:_0x9303('0x18'),config['agi'][_0x9303('0x14')]));}function errorHandler(_0x3e6b68){if(_0x3e6b68&&_0x3e6b68[_0x9303('0x19')]&&_0x3e6b68[_0x9303('0x1a')]){logger[_0x9303('0xb')](util['format'](_0x9303('0x1b'),_0x3e6b68[_0x9303('0x19')],_0x3e6b68[_0x9303('0x1a')]));}else{logger[_0x9303('0xb')](util[_0x9303('0x16')](_0x9303('0x1c'),_0x3e6b68[_0x9303('0xf')]));}}function closeHandler(){logger[_0x9303('0x15')](util[_0x9303('0x16')](_0x9303('0x1d'),this[_0x9303('0x1e')],this[_0x9303('0x1f')],this[_0x9303('0x20')],this[_0x9303('0x21')],this[_0x9303('0x22')]));try{createSquareReport(this);}catch(_0x468d25){logger['error'](_0x468d25[_0x9303('0xf')]);}}function timeoutHandler(){logger[_0x9303('0x15')](util['format'](_0x9303('0x23'),this[_0x9303('0x1e')],this[_0x9303('0x1f')],this[_0x9303('0x20')],this[_0x9303('0x21')],this[_0x9303('0x22')]));}function hangupHandler(){logger[_0x9303('0x15')](util[_0x9303('0x16')](_0x9303('0x24'),this[_0x9303('0x1e')],this[_0x9303('0x1f')],this[_0x9303('0x20')],this['dnid'],this[_0x9303('0x22')]));this[_0x9303('0x25')]=!![];}function createSquareReport(_0xca05e,_0x240b8e){rpc[_0x9303('0x26')](_0xca05e)[_0x9303('0x27')](function(_0x7fb3e7){if(_0x240b8e){_0x240b8e(null,_0x7fb3e7);}})['catch'](function(_0x642867){if(_0x240b8e){_0x240b8e(null,_0x642867);}});}function setChannelVariables(_0x2eebc3){for(var _0x6f8b91 in _0x2eebc3){if(_0x2eebc3[_0x9303('0x28')](_0x6f8b91)){if(_0x6f8b91[_0x9303('0x29')](_0x9303('0x2a'))===0x0){_0x2eebc3[_0x6f8b91['substring'](0x4)]=_0x2eebc3[_0x6f8b91];delete _0x2eebc3[_0x6f8b91];}}}}function agiHandler(_0x42a4cb){logger['debug'](_0x9303('0x2b'),JSON['stringify'](_0x42a4cb,null,0x2));logger[_0x9303('0x15')](util[_0x9303('0x16')](_0x9303('0x2c'),_0x42a4cb[_0x9303('0x1e')],_0x42a4cb[_0x9303('0x1f')],_0x42a4cb[_0x9303('0x20')],_0x42a4cb[_0x9303('0x21')],_0x42a4cb['uniqueid']));_0x42a4cb['on'](_0x9303('0xb'),errorHandler);_0x42a4cb['on'](_0x9303('0x2d'),closeHandler);_0x42a4cb['on'](_0x9303('0x2e'),timeoutHandler);_0x42a4cb[_0x9303('0x25')]=![];_0x42a4cb['on'](_0x9303('0x2f'),hangupHandler);var _0xc6cd02=_['find'](projects,[_0x9303('0x19'),_0x42a4cb['arg_1']]);if(!_0xc6cd02)return Project[_0x9303('0x30')](_0x42a4cb);if(!_0xc6cd02[_0x9303('0x11')])return Project['handleUnpublished'](_0x42a4cb);return Project['initialize'](_0xc6cd02,_0x42a4cb);}function main(){var _0x20c5c4;return utilLicense['getLicense']()['then'](function(_0x7862e5){if(!_0x7862e5)return;if(_0x7862e5[_0x9303('0x31')]){if(_0x7862e5['callysquare']&&_0x7862e5['callysquare']>0x0){logger['info'](util[_0x9303('0x16')](_0x9303('0x32'),_0x7862e5['callysquare']));_0x20c5c4=_0x7862e5[_0x9303('0x33')];}else{logger[_0x9303('0x15')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x9303('0x34'));_0x20c5c4=-0x1;}})[_0x9303('0x27')](function(){return Project['getAll']();})[_0x9303('0x27')](function(_0x456974){projects=_0x456974;return;})[_0x9303('0x35')](function(_0x387f05){logger['error'](_0x9303('0x36'),_0x387f05[_0x9303('0xf')]);})[_0x9303('0x37')](function(){var _0x5c0b10=require(_0x9303('0x38'))(config[_0x9303('0x4')][_0x9303('0x14')],config[_0x9303('0x4')]['ip'],_0x20c5c4);_0x5c0b10['on'](_0x9303('0xb'),errorHandler);_0x5c0b10['on']('listening',listeningHandler);_0x5c0b10['on']('connection',connectionHandler);_0x5c0b10['on'](_0x9303('0x2d'),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 c64c142..798fc89 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 _0xc89a=['SendMail','bluebird','jayson/promise','client','request','error','catch','sendMailMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc89a,0xc1));var _0xac89=function(_0x16995b,_0x5f1c07){_0x16995b=_0x16995b-0x0;var _0x3ed5d8=_0xc89a[_0x16995b];return _0x3ed5d8;};'use strict';var BPromise=require(_0xac89('0x0'));var jayson=require(_0xac89('0x1'));var client=jayson[_0xac89('0x2')]['http']({'port':0x232b});function request(_0x5abc50,_0x14a0d2){return new BPromise(function(_0x198e97,_0x148691){return client[_0xac89('0x3')](_0x5abc50,_0x14a0d2)['then'](function(_0xacc4b6){if(_0xacc4b6[_0xac89('0x4')]){return _0x148691(_0xacc4b6[_0xac89('0x4')]['message']);}else{return _0x198e97(_0xacc4b6['result']);}})[_0xac89('0x5')](function(_0x219208){return _0x148691(_0x219208);});});}exports[_0xac89('0x6')]=function(_0x7291af,_0x5c98a7){return request(_0xac89('0x7'),{'account':_0x7291af,'message':_0x5c98a7});}; \ No newline at end of file +var _0x7e51=['jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','bluebird'];(function(_0x23a7a8,_0x55dc4e){var _0x35d90d=function(_0x5740df){while(--_0x5740df){_0x23a7a8['push'](_0x23a7a8['shift']());}};_0x35d90d(++_0x55dc4e);}(_0x7e51,0xb3));var _0x17e5=function(_0x28bbef,_0x516889){_0x28bbef=_0x28bbef-0x0;var _0x430048=_0x7e51[_0x28bbef];return _0x430048;};'use strict';var BPromise=require(_0x17e5('0x0'));var jayson=require(_0x17e5('0x1'));var client=jayson['client'][_0x17e5('0x2')]({'port':0x232b});function request(_0x570489,_0x410c8f){return new BPromise(function(_0x4333ba,_0x28623b){return client[_0x17e5('0x3')](_0x570489,_0x410c8f)[_0x17e5('0x4')](function(_0x40c83e){if(_0x40c83e[_0x17e5('0x5')]){return _0x28623b(_0x40c83e[_0x17e5('0x5')][_0x17e5('0x6')]);}else{return _0x4333ba(_0x40c83e[_0x17e5('0x7')]);}})[_0x17e5('0x8')](function(_0x169119){return _0x28623b(_0x169119);});});}exports[_0x17e5('0x9')]=function(_0x5ac80f,_0x11498a){return request('SendMail',{'account':_0x5ac80f,'message':_0x11498a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index adbdf42..456a46b 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 _0x1c21=['stack','agicommand','retry','maxRetry','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','clear','gotoc','info','context','extension','priority','code','evtHangup','response','isUndefined','result','agicommand\x20not\x20found','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects'];(function(_0x3d7a76,_0x53bd03){var _0x5e5526=function(_0x2031d2){while(--_0x2031d2){_0x3d7a76['push'](_0x3d7a76['shift']());}};_0x5e5526(++_0x53bd03);}(_0x1c21,0xf0));var _0x11c2=function(_0x414e8b,_0x19210e){_0x414e8b=_0x414e8b-0x0;var _0x1c342c=_0x1c21[_0x414e8b];return _0x1c342c;};'use strict';var _=require(_0x11c2('0x0'));var moment=require(_0x11c2('0x1'));var parser=require(_0x11c2('0x2'));var util=require(_0x11c2('0x3'));var logger=require(_0x11c2('0x4'))(_0x11c2('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x11c2('0x6'));var Graph=require(_0x11c2('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x11c2('0x8')]()[_0x11c2('0x9')](function(_0x112646){logger[_0x11c2('0xa')](_0x11c2('0xb'),_0x112646[_0x11c2('0xc')]);return[];});}function addVertex(_0x3ec316,_0x1149be,_0x59ed2f){_0x1149be[_0x11c2('0xd')]=_0x59ed2f;if(_0x1149be['hasOwnProperty'](_0x11c2('0xe'))){_0x1149be[_0x11c2('0xf')]=parseInt(_0x1149be[_0x11c2('0xe')],0xa);}_0x3ec316['addVertex'](_[_0x11c2('0x10')](_0x1149be,_0x11c2('0x11')));}function initGraph(_0x24cafa,_0x67e1db){var _0x1e9c55=new Graph();for(var _0x1b59c8 in _0x24cafa){if(_0x24cafa[_0x11c2('0x12')](_0x1b59c8)){if(_[_0x11c2('0x13')](_0x24cafa[_0x1b59c8])){for(var _0x23ba1e=0x0;_0x23ba1e<_0x24cafa[_0x1b59c8][_0x11c2('0x14')];_0x23ba1e+=0x1){addVertex(_0x1e9c55,_0x24cafa[_0x1b59c8][_0x23ba1e],_0x1b59c8);}}else{addVertex(_0x1e9c55,_0x24cafa[_0x1b59c8],_0x1b59c8);}}}for(var _0x171c29=0x0;_0x171c29<_0x67e1db['length'];_0x171c29+=0x1){if(_0x67e1db[_0x171c29][_0x11c2('0x15')]&&_0x67e1db[_0x171c29][_0x11c2('0x16')]){_0x1e9c55[_0x11c2('0x17')](_0x67e1db[_0x171c29]['source'],_0x67e1db[_0x171c29][_0x11c2('0x16')],_0x67e1db[_0x171c29][_0x11c2('0x18')]);}}return _0x1e9c55;}function getRoot(_0x3b3feb){return parser[_0x11c2('0x19')](_0x3b3feb,{'object':!![]})[_0x11c2('0x1a')][_0x11c2('0x1b')];}function inspect(_0x224e7b){return util[_0x11c2('0x1c')](_0x224e7b,{'showHidden':![],'depth':null});}function initialize(_0x5946aa,_0xe28e3){var _0x2d91fb=getRoot(_0x5946aa['production']);if(!_0x2d91fb||!_0x2d91fb[_0x11c2('0x1d')])return;var _0x4c1e84,_0x360d6c,_0x18c7d6;logger[_0x11c2('0x1e')](_0x11c2('0x1b'),JSON[_0x11c2('0x1f')](_0x2d91fb,null,0x2));_0xe28e3[_0x11c2('0x20')]=moment()[_0x11c2('0x21')](_0x11c2('0x22'));_0x4c1e84=initGraph(_[_0x11c2('0x10')](_0x2d91fb,_0x11c2('0x11')),_0x2d91fb[_0x11c2('0x11')]);_0x360d6c=new Vertices(_0xe28e3,rpc,mailRpc);logger['info'](util[_0x11c2('0x21')](_0x11c2('0x23'),_0xe28e3[_0x11c2('0x24')],_0xe28e3[_0x11c2('0x25')],_0xe28e3[_0x11c2('0x26')],_0xe28e3[_0x11c2('0x27')],_0xe28e3['uniqueid']));_0x4c1e84[_0x11c2('0x28')](_0x2d91fb[_0x11c2('0x1d')]['id'],function(_0x2f6958){try{_0x2f6958=_0x360d6c[_0x11c2('0x29')](_0x2f6958);logger['debug']('vertex',JSON[_0x11c2('0x1f')](_0x2f6958,null,0x2));if(_0x2f6958[_0x11c2('0xd')]===_0x11c2('0x2a')){logger[_0x11c2('0x2b')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xe28e3[_0x11c2('0x2c')]=_0x2f6958[_0x11c2('0x2c')]||_0xe28e3[_0x11c2('0x2c')];_0xe28e3[_0x11c2('0x2d')]=_0x2f6958[_0x11c2('0x2d')];_0xe28e3['priority']=_0x2f6958[_0x11c2('0x2e')]?_0x2f6958[_0x11c2('0x2e')]-0x1:0x1;return null;}else if(_0x2f6958&&_0x360d6c[_0x2f6958[_0x11c2('0xd')]]){_0x18c7d6=_0x360d6c[_0x2f6958[_0x11c2('0xd')]](_0x2f6958);logger[_0x11c2('0x2b')]('response',JSON['stringify'](_0x18c7d6,null,0x2));if(_0x18c7d6&&_0x18c7d6[_0x11c2('0x2f')]===AGI_CODE_SUCCESS&&_0x18c7d6['result']!==AGI_RESULT_ERROR&&!_0xe28e3[_0x11c2('0x30')]){logger[_0x11c2('0x1e')](_0x11c2('0x31'),inspect(_0x18c7d6));return _[_0x11c2('0x32')](_0x18c7d6[_0x11c2('0x33')])?null:_0x18c7d6[_0x11c2('0x33')]['toString']();}else{logger['error'](_0x11c2('0x31'),inspect(_0x18c7d6));return null;}}else{logger[_0x11c2('0xa')](_0x11c2('0x34'));return null;}}catch(_0xbcd730){logger[_0x11c2('0xa')](_0xbcd730[_0x11c2('0xc')]);return null;}});if(_0x2d91fb[_0x11c2('0x35')]){logger[_0x11c2('0x2b')](util[_0x11c2('0x21')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xe28e3['arg_1'],_0xe28e3['calleridname'],_0xe28e3[_0x11c2('0x26')],_0xe28e3[_0x11c2('0x27')],_0xe28e3['uniqueid']));_0x4c1e84[_0x11c2('0x28')](_0x2d91fb['finally']['id'],function(_0x503bc3){try{_0x503bc3=_0x360d6c[_0x11c2('0x29')](_0x503bc3);logger[_0x11c2('0x1e')](_0x11c2('0x36'),JSON[_0x11c2('0x1f')](_0x503bc3,null,0x2));if(_0x503bc3&&_0x360d6c[_0x503bc3[_0x11c2('0xd')]]){_0x18c7d6=_0x360d6c[_0x503bc3['agicommand']](_0x503bc3);if(_0x18c7d6){logger[_0x11c2('0x1e')]('response',inspect(_0x18c7d6));return _['isUndefined'](_0x18c7d6[_0x11c2('0x33')])?null:_0x18c7d6[_0x11c2('0x33')]['toString']();}else{logger[_0x11c2('0xa')]('response',inspect(_0x18c7d6));return null;}}else{logger[_0x11c2('0xa')](_0x11c2('0x34'));return null;}}catch(_0x2139e7){logger[_0x11c2('0xa')](_0x2139e7[_0x11c2('0xc')]);return null;}});}logger['info'](util[_0x11c2('0x21')](_0x11c2('0x37'),_0xe28e3['arg_1'],_0xe28e3['calleridname'],_0xe28e3['callerid'],_0xe28e3[_0x11c2('0x27')],_0xe28e3[_0x11c2('0x38')]));logger[_0x11c2('0x2b')](util[_0x11c2('0x21')](_0x11c2('0x39'),_0xe28e3[_0x11c2('0x2c')],_0xe28e3[_0x11c2('0x2d')],parseInt(_0xe28e3[_0x11c2('0x2e')],0xa)+0x1));_0xe28e3[_0x11c2('0x3a')](_0xe28e3[_0x11c2('0x2c')],_0xe28e3[_0x11c2('0x2d')],parseInt(_0xe28e3[_0x11c2('0x2e')],0xa)+0x1);_0xe28e3['close']();}function handleNotFound(_0x3e2b18){logger[_0x11c2('0xa')](util[_0x11c2('0x21')](_0x11c2('0x3b'),_0x3e2b18[_0x11c2('0x24')]));_0x3e2b18[_0x11c2('0x3a')](_0x3e2b18[_0x11c2('0x2c')],_0x3e2b18[_0x11c2('0x2d')],parseInt(_0x3e2b18[_0x11c2('0x2e')],0xa)+0x1);_0x3e2b18['close']();}function handleUnpublished(_0x588dd7){logger[_0x11c2('0xa')](util[_0x11c2('0x21')](_0x11c2('0x3c'),_0x588dd7[_0x11c2('0x24')]));_0x588dd7[_0x11c2('0x3a')](_0x588dd7[_0x11c2('0x2c')],_0x588dd7[_0x11c2('0x2d')],parseInt(_0x588dd7[_0x11c2('0x2e')],0xa)+0x1);_0x588dd7[_0x11c2('0x3d')]();}module[_0x11c2('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa557=['gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','traverseBFS','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','production','start','debug','stringify','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','clear','vertex'];(function(_0xd93447,_0x34d217){var _0x26c758=function(_0x53559f){while(--_0x53559f){_0xd93447['push'](_0xd93447['shift']());}};_0x26c758(++_0x34d217);}(_0xa557,0x153));var _0x7a55=function(_0x3104e3,_0x55795f){_0x3104e3=_0x3104e3-0x0;var _0x186821=_0xa557[_0x3104e3];return _0x186821;};'use strict';var _=require('lodash');var moment=require(_0x7a55('0x0'));var parser=require(_0x7a55('0x1'));var util=require(_0x7a55('0x2'));var logger=require(_0x7a55('0x3'))(_0x7a55('0x4'));var rpc=require(_0x7a55('0x5'));var mailRpc=require(_0x7a55('0x6'));var Graph=require(_0x7a55('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x7a55('0x8')](function(_0x3107ad){logger[_0x7a55('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x3107ad[_0x7a55('0xa')]);return[];});}function addVertex(_0x2f2fe0,_0x21bd4f,_0x362096){_0x21bd4f[_0x7a55('0xb')]=_0x362096;if(_0x21bd4f[_0x7a55('0xc')](_0x7a55('0xd'))){_0x21bd4f[_0x7a55('0xe')]=parseInt(_0x21bd4f[_0x7a55('0xd')],0xa);}_0x2f2fe0[_0x7a55('0xf')](_[_0x7a55('0x10')](_0x21bd4f,'mxCell'));}function initGraph(_0x4e97d0,_0x556f5f){var _0x34b617=new Graph();for(var _0x4665c9 in _0x4e97d0){if(_0x4e97d0[_0x7a55('0xc')](_0x4665c9)){if(_[_0x7a55('0x11')](_0x4e97d0[_0x4665c9])){for(var _0x23944e=0x0;_0x23944e<_0x4e97d0[_0x4665c9][_0x7a55('0x12')];_0x23944e+=0x1){addVertex(_0x34b617,_0x4e97d0[_0x4665c9][_0x23944e],_0x4665c9);}}else{addVertex(_0x34b617,_0x4e97d0[_0x4665c9],_0x4665c9);}}}for(var _0x1c6874=0x0;_0x1c6874<_0x556f5f[_0x7a55('0x12')];_0x1c6874+=0x1){if(_0x556f5f[_0x1c6874][_0x7a55('0x13')]&&_0x556f5f[_0x1c6874]['target']){_0x34b617[_0x7a55('0x14')](_0x556f5f[_0x1c6874][_0x7a55('0x13')],_0x556f5f[_0x1c6874][_0x7a55('0x15')],_0x556f5f[_0x1c6874]['value']);}}return _0x34b617;}function getRoot(_0x11eb88){return parser[_0x7a55('0x16')](_0x11eb88,{'object':!![]})[_0x7a55('0x17')][_0x7a55('0x18')];}function inspect(_0x3a526a){return util['inspect'](_0x3a526a,{'showHidden':![],'depth':null});}function initialize(_0x1caa6c,_0x5dfadf){var _0x590acf=getRoot(_0x1caa6c[_0x7a55('0x19')]);if(!_0x590acf||!_0x590acf[_0x7a55('0x1a')])return;var _0xe8aebd,_0x35276a,_0x46a018;logger[_0x7a55('0x1b')](_0x7a55('0x18'),JSON[_0x7a55('0x1c')](_0x590acf,null,0x2));_0x5dfadf['joinAt']=moment()['format'](_0x7a55('0x1d'));_0xe8aebd=initGraph(_['omit'](_0x590acf,_0x7a55('0x1e')),_0x590acf[_0x7a55('0x1e')]);_0x35276a=new Vertices(_0x5dfadf,rpc,mailRpc);logger[_0x7a55('0x1f')](util[_0x7a55('0x20')](_0x7a55('0x21'),_0x5dfadf[_0x7a55('0x22')],_0x5dfadf[_0x7a55('0x23')],_0x5dfadf[_0x7a55('0x24')],_0x5dfadf['dnid'],_0x5dfadf['uniqueid']));_0xe8aebd['traverseBFS'](_0x590acf['start']['id'],function(_0x598ee9){try{_0x598ee9=_0x35276a[_0x7a55('0x25')](_0x598ee9);logger[_0x7a55('0x1b')](_0x7a55('0x26'),JSON['stringify'](_0x598ee9,null,0x2));if(_0x598ee9[_0x7a55('0xb')]===_0x7a55('0x27')){logger[_0x7a55('0x1f')](_0x7a55('0x28'));_0x5dfadf[_0x7a55('0x29')]=_0x598ee9['context']||_0x5dfadf[_0x7a55('0x29')];_0x5dfadf['extension']=_0x598ee9[_0x7a55('0x2a')];_0x5dfadf[_0x7a55('0x2b')]=_0x598ee9['priority']?_0x598ee9['priority']-0x1:0x1;return null;}else if(_0x598ee9&&_0x35276a[_0x598ee9['agicommand']]){_0x46a018=_0x35276a[_0x598ee9[_0x7a55('0xb')]](_0x598ee9);logger[_0x7a55('0x1f')](_0x7a55('0x2c'),JSON[_0x7a55('0x1c')](_0x46a018,null,0x2));if(_0x46a018&&_0x46a018[_0x7a55('0x2d')]===AGI_CODE_SUCCESS&&_0x46a018['result']!==AGI_RESULT_ERROR&&!_0x5dfadf[_0x7a55('0x2e')]){logger['debug'](_0x7a55('0x2c'),inspect(_0x46a018));return _[_0x7a55('0x2f')](_0x46a018[_0x7a55('0x30')])?null:_0x46a018[_0x7a55('0x30')][_0x7a55('0x31')]();}else{logger['error'](_0x7a55('0x2c'),inspect(_0x46a018));return null;}}else{logger[_0x7a55('0x9')](_0x7a55('0x32'));return null;}}catch(_0x396b61){logger[_0x7a55('0x9')](_0x396b61[_0x7a55('0xa')]);return null;}});if(_0x590acf['finally']){logger[_0x7a55('0x1f')](util[_0x7a55('0x20')](_0x7a55('0x33'),_0x5dfadf[_0x7a55('0x22')],_0x5dfadf[_0x7a55('0x23')],_0x5dfadf['callerid'],_0x5dfadf[_0x7a55('0x34')],_0x5dfadf[_0x7a55('0x35')]));_0xe8aebd[_0x7a55('0x36')](_0x590acf[_0x7a55('0x37')]['id'],function(_0x3a018f){try{_0x3a018f=_0x35276a[_0x7a55('0x25')](_0x3a018f);logger['debug']('vertex',JSON[_0x7a55('0x1c')](_0x3a018f,null,0x2));if(_0x3a018f&&_0x35276a[_0x3a018f[_0x7a55('0xb')]]){_0x46a018=_0x35276a[_0x3a018f[_0x7a55('0xb')]](_0x3a018f);if(_0x46a018){logger[_0x7a55('0x1b')](_0x7a55('0x2c'),inspect(_0x46a018));return _[_0x7a55('0x2f')](_0x46a018[_0x7a55('0x30')])?null:_0x46a018[_0x7a55('0x30')]['toString']();}else{logger[_0x7a55('0x9')](_0x7a55('0x2c'),inspect(_0x46a018));return null;}}else{logger[_0x7a55('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x11f2e6){logger['error'](_0x11f2e6[_0x7a55('0xa')]);return null;}});}logger[_0x7a55('0x1f')](util[_0x7a55('0x20')](_0x7a55('0x38'),_0x5dfadf[_0x7a55('0x22')],_0x5dfadf[_0x7a55('0x23')],_0x5dfadf[_0x7a55('0x24')],_0x5dfadf[_0x7a55('0x34')],_0x5dfadf['uniqueid']));logger['info'](util[_0x7a55('0x20')](_0x7a55('0x39'),_0x5dfadf[_0x7a55('0x29')],_0x5dfadf[_0x7a55('0x2a')],parseInt(_0x5dfadf['priority'],0xa)+0x1));_0x5dfadf[_0x7a55('0x3a')](_0x5dfadf[_0x7a55('0x29')],_0x5dfadf[_0x7a55('0x2a')],parseInt(_0x5dfadf['priority'],0xa)+0x1);_0x5dfadf[_0x7a55('0x3b')]();}function handleNotFound(_0x1c8a9e){logger[_0x7a55('0x9')](util[_0x7a55('0x20')](_0x7a55('0x3c'),_0x1c8a9e['arg_1']));_0x1c8a9e[_0x7a55('0x3a')](_0x1c8a9e['context'],_0x1c8a9e[_0x7a55('0x2a')],parseInt(_0x1c8a9e[_0x7a55('0x2b')],0xa)+0x1);_0x1c8a9e['close']();}function handleUnpublished(_0x457d3e){logger[_0x7a55('0x9')](util[_0x7a55('0x20')](_0x7a55('0x3d'),_0x457d3e[_0x7a55('0x22')]));_0x457d3e['continueAt'](_0x457d3e['context'],_0x457d3e[_0x7a55('0x2a')],parseInt(_0x457d3e['priority'],0xa)+0x1);_0x457d3e['close']();}module[_0x7a55('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fed4af3..549a7f6 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 _0xfb0d=['emit','exports','util','stream','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','slice','trim','length'];(function(_0x2ee974,_0x1cceb5){var _0x20c5fb=function(_0xc54e84){while(--_0xc54e84){_0x2ee974['push'](_0x2ee974['shift']());}};_0x20c5fb(++_0x1cceb5);}(_0xfb0d,0xf0));var _0xdfb0=function(_0x386128,_0x5aac2a){_0x386128=_0x386128-0x0;var _0x3754d5=_0xfb0d[_0x386128];return _0x3754d5;};'use strict';var util=require(_0xdfb0('0x0'));var Transform=require(_0xdfb0('0x1'))['Transform'];function AGIReply(_0x4ee312){Transform[_0xdfb0('0x2')](this,_0x4ee312);this[_0xdfb0('0x3')]='';this[_0xdfb0('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xdfb0('0x5')][_0xdfb0('0x6')]=function(_0x265fb1,_0x599f4a,_0x4673a8){var _0x53b0d3='\x0a',_0x551896=['\x0a\x0a',_0xdfb0('0x7')],_0x2b55c6=-0x1,_0x24474d=-0x1,_0xc524f7='',_0x470d72=0x0,_0x32fb80='',_0x23f274='';this[_0xdfb0('0x3')]+=_0x265fb1[_0xdfb0('0x8')]();_0x32fb80=this[_0xdfb0('0x3')];if(!this['_inBody']){_0x470d72=0x0;while(_0x551896[_0x470d72]){while((_0x24474d=_0x32fb80['indexOf'](_0x551896[_0x470d72]))!=-0x1){_0xc524f7=_0x551896[_0x470d72];_0x23f274=_0x32fb80[_0xdfb0('0x9')](0x0,_0x24474d);_0x32fb80=_0x32fb80[_0xdfb0('0x9')](_0x24474d+_0xc524f7['length']);var _0x29e144=_0x23f274[_0xdfb0('0xa')](_0x53b0d3),_0x2932d9=0x0,_0x14be22={},_0x55a371='',_0x723429='',_0x4a3c1b=-0x1;while(_0x29e144[_0x2932d9]){_0x4a3c1b=_0x29e144[_0x2932d9][_0xdfb0('0xb')](':');if(_0x4a3c1b!=-0x1){_0x55a371=_0x29e144[_0x2932d9][_0xdfb0('0xc')](0x0,_0x4a3c1b)[_0xdfb0('0xd')]();_0x723429=_0x29e144[_0x2932d9]['slice'](_0x4a3c1b+0x1)[_0xdfb0('0xd')]();if(_0x55a371[_0xdfb0('0xe')]>0x0){_0x14be22[_0x55a371]=_0x723429;}}else{}_0x2932d9++;}this['emit']('headers',_0x14be22);this[_0xdfb0('0x4')]=!![];}_0x470d72++;}this[_0xdfb0('0x3')]=_0x32fb80;}else{while((_0x2b55c6=_0x32fb80[_0xdfb0('0xb')](_0x53b0d3))!=-0x1){_0x23f274=_0x32fb80[_0xdfb0('0x9')](0x0,_0x2b55c6);this[_0xdfb0('0xf')]('line',_0x23f274);_0x32fb80=_0x32fb80[_0xdfb0('0x9')](_0x2b55c6+_0x53b0d3[_0xdfb0('0xe')]);}this[_0xdfb0('0x3')]=_0x32fb80;}_0x4673a8();};module[_0xdfb0('0x10')]=AGIReply; \ No newline at end of file +var _0xcfc0=['inherits','prototype','_transform','substring','indexOf','slice','trim','length','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody'];(function(_0x1131f3,_0x15d17e){var _0x3a4c41=function(_0x15a9b9){while(--_0x15a9b9){_0x1131f3['push'](_0x1131f3['shift']());}};_0x3a4c41(++_0x15d17e);}(_0xcfc0,0x1e7));var _0x0cfc=function(_0x4ca91f,_0x399dc6){_0x4ca91f=_0x4ca91f-0x0;var _0xf593f6=_0xcfc0[_0x4ca91f];return _0xf593f6;};'use strict';var util=require(_0x0cfc('0x0'));var Transform=require(_0x0cfc('0x1'))[_0x0cfc('0x2')];function AGIReply(_0x55f02c){Transform[_0x0cfc('0x3')](this,_0x55f02c);this[_0x0cfc('0x4')]='';this[_0x0cfc('0x5')]=![];}util[_0x0cfc('0x6')](AGIReply,Transform);AGIReply[_0x0cfc('0x7')][_0x0cfc('0x8')]=function(_0x1d35cf,_0x523745,_0x2cff61){var _0x39bdeb='\x0a',_0x5738fe=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x50026f=-0x1,_0x21e635=-0x1,_0x564519='',_0x483870=0x0,_0x559167='',_0x138d44='';this[_0x0cfc('0x4')]+=_0x1d35cf['toString']();_0x559167=this[_0x0cfc('0x4')];if(!this[_0x0cfc('0x5')]){_0x483870=0x0;while(_0x5738fe[_0x483870]){while((_0x21e635=_0x559167['indexOf'](_0x5738fe[_0x483870]))!=-0x1){_0x564519=_0x5738fe[_0x483870];_0x138d44=_0x559167['substring'](0x0,_0x21e635);_0x559167=_0x559167[_0x0cfc('0x9')](_0x21e635+_0x564519['length']);var _0x5b38bc=_0x138d44['split'](_0x39bdeb),_0x462b0e=0x0,_0x235c87={},_0x64e430='',_0x14cc22='',_0x26b167=-0x1;while(_0x5b38bc[_0x462b0e]){_0x26b167=_0x5b38bc[_0x462b0e][_0x0cfc('0xa')](':');if(_0x26b167!=-0x1){_0x64e430=_0x5b38bc[_0x462b0e][_0x0cfc('0xb')](0x0,_0x26b167)[_0x0cfc('0xc')]();_0x14cc22=_0x5b38bc[_0x462b0e][_0x0cfc('0xb')](_0x26b167+0x1)[_0x0cfc('0xc')]();if(_0x64e430[_0x0cfc('0xd')]>0x0){_0x235c87[_0x64e430]=_0x14cc22;}}else{}_0x462b0e++;}this['emit'](_0x0cfc('0xe'),_0x235c87);this[_0x0cfc('0x5')]=!![];}_0x483870++;}this['_localBuffer']=_0x559167;}else{while((_0x50026f=_0x559167[_0x0cfc('0xa')](_0x39bdeb))!=-0x1){_0x138d44=_0x559167[_0x0cfc('0x9')](0x0,_0x50026f);this['emit'](_0x0cfc('0xf'),_0x138d44);_0x559167=_0x559167[_0x0cfc('0x9')](_0x50026f+_0x39bdeb['length']);}this[_0x0cfc('0x4')]=_0x559167;}_0x2cff61();};module[_0x0cfc('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 425e169..aaae0c3 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 _0x8c52=['ListId','CreateCmContact','ShowPause','agentLogin','agentPause','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','client','http','request','then','error','getSquareProjects','GetSquareProjects','name','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x566a4c,_0x378170){var _0x33ff5b=function(_0x5f41b3){while(--_0x5f41b3){_0x566a4c['push'](_0x566a4c['shift']());}};_0x33ff5b(++_0x378170);}(_0x8c52,0x7e));var _0x28c5=function(_0x2f4d5f,_0xda7f63){_0x2f4d5f=_0x2f4d5f-0x0;var _0x13dfeb=_0x8c52[_0x2f4d5f];return _0x13dfeb;};'use strict';var _=require(_0x28c5('0x0'));var moment=require('moment');var jayson=require(_0x28c5('0x1'));var client=jayson[_0x28c5('0x2')][_0x28c5('0x3')]({'port':0x2329});function request(_0x37c10f,_0x398f22){return new Promise(function(_0x41668f,_0x412a0a){return client[_0x28c5('0x4')](_0x37c10f,_0x398f22)[_0x28c5('0x5')](function(_0x7f67){if(_0x7f67[_0x28c5('0x6')]){return _0x412a0a(_0x7f67[_0x28c5('0x6')]['message']);}else{return _0x41668f(_0x7f67['result']);}})['catch'](function(_0x5099e8){return _0x412a0a(_0x5099e8);});});}exports[_0x28c5('0x7')]=function(){return request(_0x28c5('0x8'),{'options':{'raw':![],'attributes':['id',_0x28c5('0x9'),'production']}});};exports[_0x28c5('0xa')]=function(_0x193b2b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x193b2b},'attributes':[_0x28c5('0xb')]}});};exports[_0x28c5('0xc')]=function(_0xbf75f2){return request(_0x28c5('0xd'),{'options':{'raw':![],'where':{'id':_0xbf75f2},'include':[{'model':_0x28c5('0xe'),'as':_0x28c5('0xf'),'include':[{'model':_0x28c5('0x10'),'as':_0x28c5('0x10')}]}],'attributes':['id',_0x28c5('0x9'),_0x28c5('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x168f0f){return request(_0x28c5('0x12'),{'options':{'where':{'id':_0x168f0f},'attributes':[_0x28c5('0x9')]}});};exports[_0x28c5('0x13')]=function(_0x57cfde){return request(_0x28c5('0x14'),{'options':{'where':{'id':_0x57cfde},'attributes':[_0x28c5('0x9')]}});};exports[_0x28c5('0x15')]=function(_0x20f186){return request(_0x28c5('0x16'),{'options':{'where':{'id':_0x20f186},'attributes':[_0x28c5('0x9')]}});};exports[_0x28c5('0x17')]=function(_0x583349){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x583349},'attributes':[_0x28c5('0x18')]}});};exports[_0x28c5('0x19')]=function(_0x19fc7f){return request(_0x28c5('0x1a'),{'options':{'where':{'id':_0x19fc7f},'attributes':[_0x28c5('0x9')]}});};exports['getContactByPhone']=function(_0x5d6edd){return request(_0x28c5('0x1b'),{'options':{'where':{'phone':_0x5d6edd[_0x28c5('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x12b55e){return request(_0x28c5('0x1d'),{'options':{'where':{'id':_0x12b55e},'attributes':['name']}});};exports['getSoundById']=function(_0x59d964){return request(_0x28c5('0x1e'),{'options':{'where':{'id':_0x59d964},'attributes':[_0x28c5('0x1f')]}});};exports[_0x28c5('0x20')]=function(_0x345e4a){return request(_0x28c5('0x21'),{'options':{'raw':![],'where':{'id':_0x345e4a},'include':[{'model':_0x28c5('0x22'),'as':_0x28c5('0x23')}]}});};exports[_0x28c5('0x24')]=function(_0x37a3fe){return request('ShowSmsAccount',{'options':{'where':{'id':_0x37a3fe},'attributes':['id',_0x28c5('0x9')]}});};exports[_0x28c5('0x25')]=function(_0x3b1f32){return request(_0x28c5('0x26'),{'body':_0x3b1f32});};exports[_0x28c5('0x27')]=function(_0x5a5370){return request('CreateSquareDetailsReport',{'body':_0x5a5370});};exports['createSquareReport']=function(_0x1ac028){return request(_0x28c5('0x28'),{'body':_[_0x28c5('0x29')](_0x1ac028,{'project_name':_0x1ac028[_0x28c5('0x2a')],'prev_project_name':_0x1ac028[_0x28c5('0x2b')]||'','is_subproject':_0x1ac028[_0x28c5('0x2b')]?!![]:![],'leaveAt':moment()[_0x28c5('0x2c')](_0x28c5('0x2d'))})});};exports['createSquareRecording']=function(_0x1c5c55){return request(_0x28c5('0x2e'),{'body':_0x1c5c55});};exports[_0x28c5('0x2f')]=function(_0x511fb3){return request(_0x28c5('0x30'),{'body':_0x511fb3});};exports[_0x28c5('0x31')]=function(_0x489e2a){return request(_0x28c5('0x32'),{'options':{'raw':![],'where':{'phone':_0x489e2a[_0x28c5('0x1c')],'ListId':_0x489e2a[_0x28c5('0x33')]}}})[_0x28c5('0x5')](function(_0x597420){if(_0x597420){return _0x597420;}return request(_0x28c5('0x34'),{'body':_0x489e2a});});};exports['getPauseById']=function(_0x17721a){return request(_0x28c5('0x35'),{'options':{'where':{'id':_0x17721a},'attributes':[_0x28c5('0x9')]}});};exports[_0x28c5('0x36')]=function(_0x512573,_0x3b80e1){return request('LoginUser',{'body':{'interface':_0x3b80e1},'options':{'where':_0x512573}});};exports[_0x28c5('0x37')]=function(_0x3323f7,_0x46d6a2,_0x1efa1f){return request('PauseUser',{'body':{'type':_0x46d6a2,'uniqueid':_0x1efa1f},'options':{'where':_0x3323f7}});};exports[_0x28c5('0x38')]=function(_0x3bf542){return request('UnpauseUser',{'body':{},'options':{'where':_0x3bf542}});};exports[_0x28c5('0x39')]=function(_0x10aaec){return request(_0x28c5('0x3a'),{'body':{},'options':{'where':_0x10aaec}});}; \ No newline at end of file +var _0xb2b3=['error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','then'];(function(_0x243ed1,_0x44b528){var _0x4a978c=function(_0x2a6a79){while(--_0x2a6a79){_0x243ed1['push'](_0x243ed1['shift']());}};_0x4a978c(++_0x44b528);}(_0xb2b3,0x71));var _0x3b2b=function(_0x124201,_0x58f60d){_0x124201=_0x124201-0x0;var _0x54ebd7=_0xb2b3[_0x124201];return _0x54ebd7;};'use strict';var _=require(_0x3b2b('0x0'));var moment=require(_0x3b2b('0x1'));var jayson=require(_0x3b2b('0x2'));var client=jayson[_0x3b2b('0x3')][_0x3b2b('0x4')]({'port':0x2329});function request(_0x3de73b,_0x2059f0){return new Promise(function(_0x4dad94,_0x3eff63){return client[_0x3b2b('0x5')](_0x3de73b,_0x2059f0)[_0x3b2b('0x6')](function(_0x45e179){if(_0x45e179[_0x3b2b('0x7')]){return _0x3eff63(_0x45e179[_0x3b2b('0x7')][_0x3b2b('0x8')]);}else{return _0x4dad94(_0x45e179[_0x3b2b('0x9')]);}})[_0x3b2b('0xa')](function(_0x3ec416){return _0x3eff63(_0x3ec416);});});}exports[_0x3b2b('0xb')]=function(){return request(_0x3b2b('0xc'),{'options':{'raw':![],'attributes':['id','name',_0x3b2b('0xd')]}});};exports[_0x3b2b('0xe')]=function(_0xd2f168){return request(_0x3b2b('0xf'),{'options':{'raw':![],'where':{'name':_0xd2f168},'attributes':[_0x3b2b('0xd')]}});};exports[_0x3b2b('0x10')]=function(_0x4e66fe){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4e66fe},'include':[{'model':_0x3b2b('0x11'),'as':_0x3b2b('0x12'),'include':[{'model':_0x3b2b('0x13'),'as':_0x3b2b('0x13')}]}],'attributes':['id','name',_0x3b2b('0x14')],'smtp':!![]}});};exports[_0x3b2b('0x15')]=function(_0x23b81b){return request(_0x3b2b('0xf'),{'options':{'where':{'id':_0x23b81b},'attributes':[_0x3b2b('0x16')]}});};exports[_0x3b2b('0x17')]=function(_0x52b63f){return request(_0x3b2b('0x18'),{'options':{'where':{'id':_0x52b63f},'attributes':[_0x3b2b('0x16')]}});};exports['getVariableById']=function(_0x3224ec){return request(_0x3b2b('0x19'),{'options':{'where':{'id':_0x3224ec},'attributes':[_0x3b2b('0x16')]}});};exports['getSquareOdbcById']=function(_0x2ab175){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2ab175},'attributes':[_0x3b2b('0x1a')]}});};exports[_0x3b2b('0x1b')]=function(_0x57a2b4){return request('ShowUser',{'options':{'where':{'id':_0x57a2b4},'attributes':[_0x3b2b('0x16')]}});};exports['getContactByPhone']=function(_0x157155){return request(_0x3b2b('0x1c'),{'options':{'where':{'phone':_0x157155['phone']},'attributes':['id']}});};exports[_0x3b2b('0x1d')]=function(_0x4ff5e3){return request(_0x3b2b('0x1e'),{'options':{'where':{'id':_0x4ff5e3},'attributes':[_0x3b2b('0x16')]}});};exports['getSoundById']=function(_0x59abc3){return request(_0x3b2b('0x1f'),{'options':{'where':{'id':_0x59abc3},'attributes':[_0x3b2b('0x20')]}});};exports[_0x3b2b('0x21')]=function(_0x46db63){return request(_0x3b2b('0x22'),{'options':{'raw':![],'where':{'id':_0x46db63},'include':[{'model':_0x3b2b('0x23'),'as':_0x3b2b('0x24')}]}});};exports[_0x3b2b('0x25')]=function(_0x1273e7){return request(_0x3b2b('0x26'),{'options':{'where':{'id':_0x1273e7},'attributes':['id',_0x3b2b('0x16')]}});};exports['createSmsMessage']=function(_0x20c1bc){return request(_0x3b2b('0x27'),{'body':_0x20c1bc});};exports[_0x3b2b('0x28')]=function(_0x50e95c){return request(_0x3b2b('0x29'),{'body':_0x50e95c});};exports['createSquareReport']=function(_0x19f358){return request('CreateSquareReport',{'body':_[_0x3b2b('0x2a')](_0x19f358,{'project_name':_0x19f358['arg_1'],'prev_project_name':_0x19f358['arg_2']||'','is_subproject':_0x19f358[_0x3b2b('0x2b')]?!![]:![],'leaveAt':moment()[_0x3b2b('0x2c')](_0x3b2b('0x2d'))})});};exports[_0x3b2b('0x2e')]=function(_0x73967){return request(_0x3b2b('0x2f'),{'body':_0x73967});};exports[_0x3b2b('0x30')]=function(_0x185830){return request(_0x3b2b('0x31'),{'body':_0x185830});};exports['createCmContact']=function(_0x4ed952){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4ed952['phone'],'ListId':_0x4ed952[_0x3b2b('0x32')]}}})[_0x3b2b('0x6')](function(_0x3a1ff8){if(_0x3a1ff8){return _0x3a1ff8;}return request(_0x3b2b('0x33'),{'body':_0x4ed952});});};exports[_0x3b2b('0x34')]=function(_0x34fc22){return request(_0x3b2b('0x35'),{'options':{'where':{'id':_0x34fc22},'attributes':['name']}});};exports[_0x3b2b('0x36')]=function(_0x54f942,_0x48a62a){return request(_0x3b2b('0x37'),{'body':{'interface':_0x48a62a},'options':{'where':_0x54f942}});};exports[_0x3b2b('0x38')]=function(_0x281f1a,_0x107285,_0x5040e2){return request('PauseUser',{'body':{'type':_0x107285,'uniqueid':_0x5040e2},'options':{'where':_0x281f1a}});};exports[_0x3b2b('0x39')]=function(_0x3a7b4b){return request(_0x3b2b('0x3a'),{'body':{},'options':{'where':_0x3a7b4b}});};exports[_0x3b2b('0x3b')]=function(_0x2b745e){return request('LogoutUser',{'body':{},'options':{'where':_0x2b745e}});}; \ 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 17eb47c..43556d9 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 _0x56a6=['exports','./polly','./lex'];(function(_0x1c3c0d,_0x2ab2c2){var _0x1fb5fe=function(_0x53b483){while(--_0x53b483){_0x1c3c0d['push'](_0x1c3c0d['shift']());}};_0x1fb5fe(++_0x2ab2c2);}(_0x56a6,0x17b));var _0x656a=function(_0x16255f,_0x17b36c){_0x16255f=_0x16255f-0x0;var _0x274655=_0x56a6[_0x16255f];return _0x274655;};var polly=require(_0x656a('0x0'));var lex=require(_0x656a('0x1'));module[_0x656a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1561=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1561,0x1bd));var _0x1156=function(_0xf76753,_0x307261){_0xf76753=_0xf76753-0x0;var _0x2110cd=_0x1561[_0xf76753];return _0x2110cd;};var polly=require('./polly');var lex=require('./lex');module[_0x1156('0x0')]={'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 86c84fb..319f0f9 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 _0x4ea3=['./lib/api','exports'];(function(_0x4779b6,_0xb43d06){var _0x5b15ce=function(_0x4f2130){while(--_0x4f2130){_0x4779b6['push'](_0x4779b6['shift']());}};_0x5b15ce(++_0xb43d06);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ No newline at end of file +var _0xb4e6=['./lib/api'];(function(_0x20b1ca,_0xcaa99b){var _0x13a457=function(_0x49b381){while(--_0x49b381){_0x20b1ca['push'](_0x20b1ca['shift']());}};_0x13a457(++_0xcaa99b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb4e6[_0x18ab2a];return _0x16dcee;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);}; \ 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 9a4ae28..ea7a946 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(_0x46f5ad,_0x4950d7){var _0x128b3a=function(_0x627769){while(--_0x627769){_0x46f5ad['push'](_0x46f5ad['shift']());}};_0x128b3a(++_0x4950d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x402947,_0x29ba68){var _0x2d88fe=function(_0x34a6c4){while(--_0x34a6c4){_0x402947['push'](_0x402947['shift']());}};_0x2d88fe(++_0x29ba68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 3bce0c3..6111e16 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 _0x1de0=['./lib/api'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x1de0,0x122));var _0x01de=function(_0x150bbe,_0x412085){_0x150bbe=_0x150bbe-0x0;var _0x3418d5=_0x1de0[_0x150bbe];return _0x3418d5;};'use strict';var polly=require(_0x01de('0x0'));module['exports']=function(_0xcd2277,_0x400e74,_0x1d5852,_0x2f07da,_0x92f7d4,_0x2b74dc,_0x367dd9){return polly(_0xcd2277,_0x400e74,_0x1d5852,_0x2f07da,_0x92f7d4,_0x2b74dc,_0x367dd9);}; \ No newline at end of file +var _0xe691=['./lib/api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe691,0x85));var _0x1e69=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0xe691[_0x558e45];return _0x3e9075;};'use strict';var polly=require(_0x1e69('0x0'));module['exports']=function(_0x183ac7,_0x2656d4,_0x26e30c,_0x32ef71,_0x57d92e,_0xc9067b,_0x177b19){return polly(_0x183ac7,_0x2656d4,_0x26e30c,_0x32ef71,_0x57d92e,_0xc9067b,_0x177b19);}; \ 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 ce37b0f..2c24ae3 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 _0xc311=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xc311,0x131));var _0x1c31=function(_0x3315ff,_0x321860){_0x3315ff=_0x3315ff-0x0;var _0xec5af2=_0xc311[_0x3315ff];return _0xec5af2;};'use strict';var fs=require('fs');var path=require(_0x1c31('0x0'));var BPromise=require(_0x1c31('0x1'));var rs=require(_0x1c31('0x2'));var AWS=require(_0x1c31('0x3'));function pollyResult(_0x41f715,_0x57fea3,_0x27c02a){return new BPromise(function(_0x17f034,_0x494d09){_0x41f715[_0x1c31('0x4')](_0x57fea3,function(_0x462de2,_0x2d0bdd){if(_0x462de2){_0x494d09(_0x462de2);}else if(_0x2d0bdd){if(_0x2d0bdd[_0x1c31('0x5')]instanceof Buffer){fs[_0x1c31('0x6')](_0x27c02a,_0x2d0bdd['AudioStream'],function(_0x12c8f3){if(_0x12c8f3){_0x494d09(_0x12c8f3);}else{_0x17f034();}});}else{_0x494d09(new Error(_0x1c31('0x7')));}}else{_0x494d09(new Error(_0x1c31('0x8')));}});});}module[_0x1c31('0x9')]=function(_0x3aa5e3,_0x26559b,_0x5df3fb,_0x3fc070,_0x2df1ca,_0x38b7b7,_0x586b74){var _0x5db170=new AWS[(_0x1c31('0xa'))]({'accessKeyId':_0x3aa5e3,'secretAccessKey':_0x26559b,'region':_0x5df3fb});var _0x2d9c19={'Text':_0x2df1ca,'TextType':_0x38b7b7||_0x1c31('0xb'),'OutputFormat':_0x1c31('0xc'),'VoiceId':_0x3fc070};return pollyResult(_0x5db170,_0x2d9c19,_0x586b74);}; \ No newline at end of file +var _0xdce2=['path','bluebird','aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3'];(function(_0x39adb9,_0x2244c8){var _0x122e2c=function(_0xd714d3){while(--_0xd714d3){_0x39adb9['push'](_0x39adb9['shift']());}};_0x122e2c(++_0x2244c8);}(_0xdce2,0x98));var _0x2dce=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xdce2[_0x24259d];return _0x5a701;};'use strict';var fs=require('fs');var path=require(_0x2dce('0x0'));var BPromise=require(_0x2dce('0x1'));var rs=require('randomstring');var AWS=require(_0x2dce('0x2'));function pollyResult(_0x1dd427,_0x17da71,_0x9fc7b1){return new BPromise(function(_0x3892e1,_0x42964c){_0x1dd427['synthesizeSpeech'](_0x17da71,function(_0x810438,_0x24ad28){if(_0x810438){_0x42964c(_0x810438);}else if(_0x24ad28){if(_0x24ad28['AudioStream']instanceof Buffer){fs['writeFile'](_0x9fc7b1,_0x24ad28[_0x2dce('0x3')],function(_0x2a71f1){if(_0x2a71f1){_0x42964c(_0x2a71f1);}else{_0x3892e1();}});}else{_0x42964c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x42964c(new Error(_0x2dce('0x4')));}});});}module[_0x2dce('0x5')]=function(_0x54fba0,_0x12735e,_0x27f844,_0x116f0,_0xfe49d8,_0x2a03e3,_0x40dd1d){var _0x3a4928=new AWS[(_0x2dce('0x6'))]({'accessKeyId':_0x54fba0,'secretAccessKey':_0x12735e,'region':_0x27f844});var _0x366f22={'Text':_0xfe49d8,'TextType':_0x2a03e3||'text','OutputFormat':_0x2dce('0x7'),'VoiceId':_0x116f0};return pollyResult(_0x3a4928,_0x366f22,_0x40dd1d);}; \ 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 4b3b1b6..569294d 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 _0xfc8b=['exports'];(function(_0x53da0b,_0x12a0af){var _0x1b11c3=function(_0x33ea09){while(--_0x33ea09){_0x53da0b['push'](_0x53da0b['shift']());}};_0x1b11c3(++_0x12a0af);}(_0xfc8b,0xce));var _0xbfc8=function(_0xa51e46,_0x4c2d7d){_0xa51e46=_0xa51e46-0x0;var _0x59e518=_0xfc8b[_0xa51e46];return _0x59e518;};'use strict';var asr=require('./lib/api');module[_0xbfc8('0x0')]=function(_0x24ae19,_0x3d23cd,_0x5a7a88,_0x59e368){return asr(_0x24ae19,_0x3d23cd,_0x5a7a88);}; \ No newline at end of file +var _0x4e1e=['exports','./lib/api'];(function(_0x9ca5f6,_0x116580){var _0xefa1d4=function(_0x406492){while(--_0x406492){_0x9ca5f6['push'](_0x9ca5f6['shift']());}};_0xefa1d4(++_0x116580);}(_0x4e1e,0x8d));var _0xe4e1=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x4e1e[_0x396466];return _0x5e9ab4;};'use strict';var asr=require(_0xe4e1('0x0'));module[_0xe4e1('0x1')]=function(_0x145662,_0x1f4484,_0x24918f,_0x37cc8f){return asr(_0x145662,_0x1f4484,_0x24918f);}; \ 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 5503301..db0e72c 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 _0x4a81=['exports','filepath\x20should\x20be\x20a\x20string','length','undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x4a81,0x1b7));var _0x14a8=function(_0x570c0b,_0x322262){_0x570c0b=_0x570c0b-0x0;var _0x1e1b2f=_0x4a81[_0x570c0b];return _0x1e1b2f;};'use strict';var url=require(_0x14a8('0x0'));var BPromise=require(_0x14a8('0x1'));var fs=require('fs');var host=_0x14a8('0x2');module[_0x14a8('0x3')]=function(_0x4a7f9e,_0x5845a3,_0x45869b){return new BPromise(function(_0x53309b,_0x39c3d4){var _0x3363f8;if(typeof _0x4a7f9e!=='string'||_0x4a7f9e['length']===0x0){return _0x39c3d4(_0x14a8('0x4'));}if(typeof _0x5845a3!=='string'||_0x5845a3[_0x14a8('0x5')]===0x0){return _0x39c3d4('key\x20should\x20be\x20a\x20string');}if(typeof _0x45869b!==_0x14a8('0x6')&&(typeof _0x45869b!==_0x14a8('0x7')||_0x45869b[_0x14a8('0x5')]===0x0)){return _0x39c3d4(_0x14a8('0x8'));}try{_0x3363f8=fs[_0x14a8('0x9')](_0x4a7f9e)['toString']('base64');}catch(_0x1a6f60){return _0x39c3d4(_0x1a6f60);}return _0x53309b({'method':_0x14a8('0xa'),'uri':host+_0x14a8('0xb')+_0x5845a3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x14a8('0xc'),'languageCode':_0x45869b},'audio':{'content':_0x3363f8}},'json':!![]});});}; \ No newline at end of file +var _0xe644=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x35031c,_0x3807cd){var _0x35cb18=function(_0x698362){while(--_0x698362){_0x35031c['push'](_0x35031c['shift']());}};_0x35cb18(++_0x3807cd);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0x4e64('0x0'));var BPromise=require(_0x4e64('0x1'));var fs=require('fs');var host=_0x4e64('0x2');module[_0x4e64('0x3')]=function(_0x18e17a,_0x1c5c75,_0x5e2d61){return new BPromise(function(_0x29c930,_0x7b06ee){var _0x2f5ef0;if(typeof _0x18e17a!==_0x4e64('0x4')||_0x18e17a[_0x4e64('0x5')]===0x0){return _0x7b06ee(_0x4e64('0x6'));}if(typeof _0x1c5c75!=='string'||_0x1c5c75[_0x4e64('0x5')]===0x0){return _0x7b06ee(_0x4e64('0x7'));}if(typeof _0x5e2d61!=='undefined'&&(typeof _0x5e2d61!=='string'||_0x5e2d61[_0x4e64('0x5')]===0x0)){return _0x7b06ee('lang\x20should\x20be\x20a\x20string');}try{_0x2f5ef0=fs['readFileSync'](_0x18e17a)[_0x4e64('0x8')](_0x4e64('0x9'));}catch(_0x4323bb){return _0x7b06ee(_0x4323bb);}return _0x29c930({'method':_0x4e64('0xa'),'uri':host+_0x4e64('0xb')+_0x1c5c75,'body':{'config':{'encoding':_0x4e64('0xc'),'sampleRateHertz':'8000','languageCode':_0x5e2d61},'audio':{'content':_0x2f5ef0}},'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 10cb4be..55d8d1b 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x4ab1=['./asr'];(function(_0x471103,_0x25a3e6){var _0x26829a=function(_0x54664c){while(--_0x54664c){_0x471103['push'](_0x471103['shift']());}};_0x26829a(++_0x25a3e6);}(_0x4ab1,0xfc));var _0x14ab=function(_0x340b5f,_0x1dabc7){_0x340b5f=_0x340b5f-0x0;var _0x150ddf=_0x4ab1[_0x340b5f];return _0x150ddf;};var asr=require(_0x14ab('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index f3f2212..5857ac4 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 _0xb55e=['statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','error','pipe','end','data','wav','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','ssml','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','google-tts-api','url','util','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb55e,0xed));var _0xeb55=function(_0x4be0e2,_0x259c84){_0x4be0e2=_0x4be0e2-0x0;var _0x565fa3=_0xb55e[_0x4be0e2];return _0x565fa3;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xeb55('0x0'));var dialogflow=require(_0xeb55('0x1'));var fs=require('fs');var http=require(_0xeb55('0x2'));var https=require(_0xeb55('0x3'));var md5=require(_0xeb55('0x4'));var path=require(_0xeb55('0x5'));var querystring=require(_0xeb55('0x6'));var rp=require(_0xeb55('0x7'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0xeb55('0x8'));var urlParse=require(_0xeb55('0x9'))['parse'];var util=require(_0xeb55('0xa'));var aws=require('./aws');var google=require(_0xeb55('0xb'));var sestek=require(_0xeb55('0xc'));var tilde=require(_0xeb55('0xd'));var logger=require(_0xeb55('0xe'))('agi');var ISPEECH_API=_0xeb55('0xf');function downloadFile(_0x5c034b,_0x1301ca){return new BPromise(function(_0x358c83,_0x3e8a7c){var _0x5907e0=urlParse(_0x5c034b);var _0x132067=_0x5907e0[_0xeb55('0x10')]===_0xeb55('0x11')?https:http;var _0x5b09b3={'host':_0x5907e0[_0xeb55('0x12')],'path':_0x5907e0['path'],'headers':{'user-agent':_0xeb55('0x13')}};_0x132067[_0xeb55('0x14')](_0x5b09b3,function(_0x4d3232){if(_0x4d3232[_0xeb55('0x15')]!==0xc8){logger['error'](_0xeb55('0x16')+_0x5c034b+_0xeb55('0x17')+_0x4d3232['statusCode']+'\x20('+_0x4d3232[_0xeb55('0x18')]+')');_0x3e8a7c(new Error(_0xeb55('0x16')+_0x5c034b+'\x20failed,\x20status\x20code\x20=\x20'+_0x4d3232[_0xeb55('0x15')]+'\x20('+_0x4d3232[_0xeb55('0x18')]+')'));return;}var _0x2b0dbc=fs[_0xeb55('0x19')](_0x1301ca);_0x2b0dbc['on'](_0xeb55('0x1a'),function(){logger[_0xeb55('0x1b')](_0xeb55('0x1c'));_0x2b0dbc['close'](_0x358c83);});_0x2b0dbc['on']('error',function(_0x4981ba){fs[_0xeb55('0x1d')](_0x1301ca);logger[_0xeb55('0x1e')]('download\x20error',_0x4981ba);_0x3e8a7c(_0x4981ba);});_0x4d3232[_0xeb55('0x1f')](_0x2b0dbc);})['on'](_0xeb55('0x1e'),function(_0x4b2f6c){logger[_0xeb55('0x1e')](_0x4b2f6c);_0x3e8a7c(_0x4b2f6c);})[_0xeb55('0x20')]();});}function uploadFile(_0xae9021){return new BPromise(function(_0x18d800,_0xfbcb22){var _0x5e5528=urlParse(_0xae9021);var _0x52080e=_0x5e5528['protocol']===_0xeb55('0x11')?https:http;var _0x529dde={'host':_0x5e5528[_0xeb55('0x12')],'path':_0x5e5528[_0xeb55('0x5')],'headers':{'user-agent':_0xeb55('0x13')}};_0x52080e[_0xeb55('0x14')](_0x529dde,function(_0x36e262){if(_0x36e262[_0xeb55('0x15')]!==0xc8){_0xfbcb22(new Error(_0xeb55('0x16')+_0xae9021+_0xeb55('0x17')+_0x36e262[_0xeb55('0x15')]+'\x20('+_0x36e262[_0xeb55('0x18')]+')'));return;}var _0x256b8f='';_0x36e262['on'](_0xeb55('0x21'),function(_0x194f0d){_0x256b8f+=_0x194f0d;});_0x36e262['on']('end',function(){_0x18d800(_0x256b8f);});})['on']('error',function(_0x439d85){_0xfbcb22(_0x439d85);})[_0xeb55('0x20')]();});}function convertFile(_0x39b59b,_0x921c6f){return new BPromise(function(_0x474ad7,_0x162444){var _0x67320e=sox['transcode'](_0x39b59b,_0x921c6f,{'sampleRate':0x1f40,'format':_0xeb55('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x67320e['on'](_0xeb55('0x1e'),function(_0x505ed3){logger[_0xeb55('0x1e')]('error\x20convert',_0x505ed3);_0x162444(_0x505ed3);});_0x67320e['on']('end',function(){logger[_0xeb55('0x1b')](_0xeb55('0x23'));_0x474ad7();});_0x67320e['start']();});}function base64Decode(_0x168923,_0x1cf711){var _0x40d9d4=path[_0xeb55('0x24')](__dirname,_0xeb55('0x25'),rs[_0xeb55('0x26')](0x4)+_0xeb55('0x27'));fs[_0xeb55('0x28')](_0x40d9d4,_0x168923,_0xeb55('0x29'));return convertFile(_0x40d9d4,_0x1cf711)['then'](function(){try{fs[_0xeb55('0x1d')](_0x40d9d4);fs[_0xeb55('0x2a')](_0x1cf711,_0xeb55('0x2b'));}catch(_0x28dc7d){logger[_0xeb55('0x1e')](_0x28dc7d);}return _0x1cf711[_0xeb55('0x2c')]('.')[0x0];});}function base64Encode(_0x1e2004){var _0x178690=fs['readFileSync'](_0x1e2004);return new Buffer(_0x178690)[_0xeb55('0x2d')]('base64');}exports['googleCloudTTS']=function(_0x3bceaf,_0x55f0ea,_0x5194fc,_0x58a811,_0x1d1ce7,_0x519254){var _0x26d34c,_0x58b26d;var _0x17db8a=_0xeb55('0x2e');var _0x19f31f='?key='+_0x3bceaf;var _0x34b5aa={};if(_0x55f0ea===_0xeb55('0x2f')){_0x34b5aa['input']={'ssml':_0x5194fc};}else{_0x34b5aa['input']={'text':_0x5194fc};};_0x34b5aa['voice']={'languageCode':_0x58a811,'ssmlGender':_0x1d1ce7};_0x34b5aa[_0xeb55('0x30')]={'audioEncoding':_0xeb55('0x31'),'sampleRateHertz':0x1f40};var _0xd429b5={'url':_0x17db8a+_0xeb55('0x32')+_0x19f31f,'method':_0xeb55('0x33'),'json':!![],'body':_0x34b5aa};return rp(_0xd429b5)[_0xeb55('0x34')](function(_0x49b85e){return new BPromise(function(_0x5f2a7c,_0x45fa3c){_0x26d34c=path[_0xeb55('0x24')](__dirname,'tmp',rs[_0xeb55('0x26')](0x4)+_0xeb55('0x35'));var _0x4c4c0=Buffer[_0xeb55('0x36')](_0x49b85e[_0xeb55('0x37')],'base64');return fs[_0xeb55('0x38')](_0x26d34c,_0x4c4c0,function(_0x171ad5){_0x45fa3c(_0x171ad5);},function(_0x332372){fs[_0xeb55('0x2a')](_0x26d34c,'777');_0x5f2a7c(_0x332372);});});})[_0xeb55('0x34')](function(_0x969eb2){_0x58b26d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xeb55('0x27'));return convertFile(_0x26d34c,_0x58b26d);})[_0xeb55('0x34')](function(){try{fs[_0xeb55('0x1d')](_0x26d34c);fs[_0xeb55('0x2a')](_0x58b26d,_0xeb55('0x2b'));}catch(_0x380f0d){logger[_0xeb55('0x1e')](_0x380f0d);}logger['info']('googleCloudTTS\x20path',_0x58b26d[_0xeb55('0x2c')]('.')[0x0]);return _0x58b26d[_0xeb55('0x2c')]('.')[0x0];});};exports[_0xeb55('0x39')]=function(_0x3e6e23,_0x17d749){var _0x436ae5=_0xeb55('0x3a');var _0x169a3a,_0x79d69a;var _0x4bd2ed;var _0x41f3b4={'encoding':_0xeb55('0x3b'),'method':_0xeb55('0x33'),'timeout':0x2710,'url':_0x436ae5,'headers':{'Content-Type':_0xeb55('0x3c')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0xeb55('0x3d')]([_0x3e6e23,_0x17d749||'en',![],_0xeb55('0x3e')]),null,_0xeb55('0x3f')]]]))};return rp(_0x41f3b4)[_0xeb55('0x34')](function(_0x212f39){try{_0x4bd2ed=eval(_0x212f39['slice'](0x5))[0x0][0x2];}catch(_0x4eebb2){throw new Error(_0xeb55('0x40')+_0x212f39[_0xeb55('0x21')]);}if(!_0x4bd2ed){if(_0x3e6e23[_0xeb55('0x41')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xeb55('0x42')+_0x17d749+'\x22\x20might\x20not\x20exist');}}try{_0x4bd2ed=eval(_0x4bd2ed)[0x0];}catch(_0x48f17f){throw new Error(_0xeb55('0x40')+res['data']);}const _0x452a93=_0x4bd2ed;_0x169a3a=path['resolve'](__dirname,_0xeb55('0x25'),rs['generate'](0x4)+_0xeb55('0x35'));fs[_0xeb55('0x28')](_0x169a3a,_0x4bd2ed,{'encoding':_0xeb55('0x29')});_0x79d69a=path['resolve'](__dirname,'tmp',rs[_0xeb55('0x26')](0x4)+_0xeb55('0x27'));return convertFile(_0x169a3a,_0x79d69a);})[_0xeb55('0x34')](function(){try{fs['unlink'](_0x169a3a);fs[_0xeb55('0x2a')](_0x79d69a,'777');}catch(_0x5e8041){logger[_0xeb55('0x1e')](_0x5e8041);}logger[_0xeb55('0x1b')](_0xeb55('0x43'),_0x79d69a[_0xeb55('0x2c')]('.')[0x0]);return _0x79d69a['split']('.')[0x0];});};exports[_0xeb55('0x44')]=function(_0x3755e6,_0xa96e91,_0x11ffab){return google[_0xeb55('0x45')](_0x3755e6,_0xa96e91,_0x11ffab)[_0xeb55('0x34')](function(_0x40b012){logger[_0xeb55('0x1b')](_0x40b012['uri']);return rp(_0x40b012);})['then'](function(_0x22b4cd){var _0x13d41d='';var _0x3cd9e2=0x0;try{fs[_0xeb55('0x1d')](_0x3755e6);}catch(_0x121b14){logger['error'](_0x121b14);}if(_0x22b4cd&&_0x22b4cd['results']){_0x13d41d=_0x22b4cd[_0xeb55('0x46')][_0xeb55('0x47')](function(_0x2fdedc){return _0x2fdedc&&_0x2fdedc[_0xeb55('0x48')][0x0]&&_0x2fdedc[_0xeb55('0x48')][0x0][_0xeb55('0x49')]?_0x2fdedc['alternatives'][0x0]['transcript']:'';})[_0xeb55('0x4a')]('\x0a');_0x3cd9e2=_0x22b4cd[_0xeb55('0x46')][_0xeb55('0x47')](function(_0x2dcfed){return _0x2dcfed&&_0x2dcfed['alternatives'][0x0]&&_0x2dcfed[_0xeb55('0x48')][0x0][_0xeb55('0x4b')]?_0x2dcfed[_0xeb55('0x48')][0x0]['confidence']:0x0;})[_0xeb55('0x4a')]('\x0a');}logger[_0xeb55('0x1b')]('googleASR\x20transcription',_0x13d41d);logger['info'](_0xeb55('0x4c'),_0x3cd9e2);return{'transcript':_0x13d41d,'confidence':_0x3cd9e2};})[_0xeb55('0x4d')](function(_0x99ebf0){logger[_0xeb55('0x1e')]('[%s]\x20%s:%s',_0x99ebf0[_0xeb55('0x15')],_0x99ebf0['name'],_0x99ebf0[_0xeb55('0x4e')]);});};exports[_0xeb55('0x4f')]=function(_0x4dda4c,_0x44e6db,_0x25536a,_0x30e6e5){var _0x57f0bb=apiai(_0x44e6db,{'language':_0x30e6e5||'en'});return _0x57f0bb[_0xeb55('0x50')](_0x25536a,{'sessionId':md5(_0x4dda4c)})[_0xeb55('0x34')](function(_0x33847e){logger[_0xeb55('0x1b')](JSON[_0xeb55('0x3d')](_0x33847e));return{'source':_0x33847e[_0xeb55('0x51')][_0xeb55('0x52')],'resolvedQuery':_0x33847e['result'][_0xeb55('0x53')],'action':_0x33847e[_0xeb55('0x51')][_0xeb55('0x54')],'actionIncomplete':_0x33847e[_0xeb55('0x51')][_0xeb55('0x55')],'speech':_0x33847e['result']['fulfillment']['speech'],'score':_0x33847e['result']['score'],'statusCode':_0x33847e[_0xeb55('0x56')][_0xeb55('0x57')],'endConversation':_0x33847e['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x33847e[_0xeb55('0x51')][_0xeb55('0x58')][_0xeb55('0x59')]};});};exports[_0xeb55('0x5a')]=function(_0x593ef3,_0x26a28a,_0x45f9e4,_0x187dcb,_0x3f7d29,_0x5b1832){var _0x251f3c=_0x187dcb[_0xeb55('0x5b')](/\\n/g,'\x0a');var _0x2d8b75={'credentials':{'private_key':_0x251f3c,'client_email':_0x45f9e4}};var _0x4b0acd=new dialogflow[(_0xeb55('0x5c'))](_0x2d8b75);var _0x5e57f2=_0x4b0acd[_0xeb55('0x5d')](_0x26a28a,md5(_0x593ef3));var _0x452f48={'session':_0x5e57f2,'queryInput':{'text':{'text':_0x3f7d29,'languageCode':_0x5b1832}}};return _0x4b0acd[_0xeb55('0x5e')](_0x452f48)[_0xeb55('0x34')](function(_0x27fc03){if(_0x27fc03&&_0x27fc03['length']){logger[_0xeb55('0x1b')](_0xeb55('0x5f'),JSON[_0xeb55('0x3d')](_0x27fc03));var _0x1cdaaa=_0x27fc03[0x0];if(_0x1cdaaa){var _0x45d228={'action':_0x1cdaaa[_0xeb55('0x60')]['action'],'allRequiredParamsPresent':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x61')],'endConversation':_0x1cdaaa[_0xeb55('0x60')]['diagnosticInfo']&&_0x1cdaaa['queryResult'][_0xeb55('0x62')][_0xeb55('0x63')]?_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x62')][_0xeb55('0x63')][_0xeb55('0x64')]['boolValue']:![],'fulfillmentText':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x65')],'intentName':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x66')][_0xeb55('0x67')],'intentDisplayName':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x66')][_0xeb55('0x68')],'isFallbackIntent':_0x1cdaaa['queryResult'][_0xeb55('0x66')][_0xeb55('0x69')],'languageCode':_0x1cdaaa['queryResult'][_0xeb55('0x6a')],'queryText':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x6b')],'responseId':_0x1cdaaa[_0xeb55('0x6c')],'score':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x6d')],'speech':_0x1cdaaa[_0xeb55('0x60')][_0xeb55('0x65')],'providerResponse':JSON[_0xeb55('0x3d')](_0x27fc03)};return _0x45d228;}}});};exports[_0xeb55('0x6e')]=function(_0x35cce0,_0x42d858,_0x48111b,_0xc60684){return tilde['asr'](_0x35cce0,_0x42d858,_0x48111b,_0xc60684)[_0xeb55('0x34')](function(_0x47c217){try{fs[_0xeb55('0x1d')](_0x35cce0);}catch(_0x68e7e3){logger[_0xeb55('0x1e')](_0x68e7e3);}logger['info'](_0xeb55('0x6f'),_0x47c217['transcript']);logger[_0xeb55('0x1b')](_0xeb55('0x70'),_0x47c217[_0xeb55('0x4b')]);return _0x47c217;});};exports[_0xeb55('0x71')]=function(_0x2be26f,_0x7fcaef,_0x2843db,_0x32cfe2,_0x321115,_0x69ff7){var _0x1b2108=path[_0xeb55('0x24')](__dirname,_0xeb55('0x25'),rs['generate'](0x4)+_0xeb55('0x35'));var _0x531efc;return aws[_0xeb55('0x72')](_0x2be26f,_0x7fcaef,_0x2843db,_0x32cfe2,_0x321115,_0x69ff7,_0x1b2108)[_0xeb55('0x34')](function(){_0x531efc=path[_0xeb55('0x24')](__dirname,_0xeb55('0x25'),rs[_0xeb55('0x26')](0x4)+'.wav');return convertFile(_0x1b2108,_0x531efc);})[_0xeb55('0x34')](function(){try{fs[_0xeb55('0x1d')](_0x1b2108);fs[_0xeb55('0x2a')](_0x531efc,'777');}catch(_0x234719){logger[_0xeb55('0x1e')](_0x234719);}return _0x531efc[_0xeb55('0x2c')]('.')[0x0];});};exports[_0xeb55('0x73')]=function(_0x3db1fc,_0x47f5c1,_0x524772,_0x1f01e8,_0x218f10,_0x1b9107){return aws[_0xeb55('0x74')](_0x3db1fc,_0x47f5c1,_0x524772,_0x1f01e8,_0x218f10,_0x1b9107)['then'](function(_0x13aa33){logger[_0xeb55('0x1b')](JSON[_0xeb55('0x3d')](_0x13aa33));return _0x13aa33;});};exports['ispeechTTS']=function(_0x2e0139,_0x1a942c,_0xd557ed,_0x423b70){var _0x5163d1=util[_0xeb55('0x75')](_0xeb55('0x76'),ISPEECH_API,_0x2e0139,encodeURIComponent(_0x1a942c),_0xd557ed,_0x423b70);var _0x314dd5=path[_0xeb55('0x24')](__dirname,_0xeb55('0x25'),rs[_0xeb55('0x26')](0x4)+_0xeb55('0x35'));var _0xc0abc6;return downloadFile(_0x5163d1,_0x314dd5)['then'](function(){_0xc0abc6=path[_0xeb55('0x24')](__dirname,_0xeb55('0x25'),rs['generate'](0x4)+_0xeb55('0x27'));return convertFile(_0x314dd5,_0xc0abc6);})[_0xeb55('0x34')](function(){try{fs[_0xeb55('0x1d')](_0x314dd5);fs[_0xeb55('0x2a')](_0xc0abc6,_0xeb55('0x2b'));}catch(_0x3b3d1f){logger['error'](_0x3b3d1f);}return _0xc0abc6[_0xeb55('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x46dc0a,_0x4493e6,_0x308f02,_0x1da65b){var _0x3b672b=util[_0xeb55('0x75')](_0xeb55('0x77'),ISPEECH_API,_0x4493e6,_0x308f02,base64Encode(_0x46dc0a),_0x1da65b?util[_0xeb55('0x75')](_0xeb55('0x78'),encodeURIComponent(_0x1da65b)):_0xeb55('0x79'));return uploadFile(_0x3b672b)['then'](function(_0x3ed4fd){return querystring[_0xeb55('0x7a')](_0x3ed4fd);});};exports['sestekNDA']=function(_0x2f0aef,_0x35db2b){return sestek[_0xeb55('0x7b')](_0x2f0aef,_0x35db2b)['then'](function(_0x1418c2){logger[_0xeb55('0x1b')](JSON['stringify'](_0x1418c2));var _0x1ba2b1={'speech':_0x1418c2['text'],'action':_0x1418c2[_0xeb55('0x7c')]?_0x1418c2['channelData'][_0xeb55('0x7d')]:undefined,'actiondata':_0x1418c2['channelData']?_0x1418c2[_0xeb55('0x7c')][_0xeb55('0x7e')]:undefined};if(_0x1418c2['channelData']&&_0x1418c2[_0xeb55('0x7c')][_0xeb55('0x7f')]){return base64Decode(_0x1418c2['channelData']['AudioFromTts']['Data'],path['resolve'](__dirname,_0xeb55('0x25'),rs['generate'](0x4)+'.wav'))[_0xeb55('0x34')](function(_0x1f21c9){_0x1ba2b1[_0xeb55('0x80')]=_0x1f21c9;return _0x1ba2b1;});}return _0x1ba2b1;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x505b=['http','https','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','info','finish\x20download\x20file','close','unlink','download\x20error','end','https:','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','then','chmodSync','777','split','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','tmp','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','speech','score','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','dialogflow'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x505b,0x83));var _0xb505=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x505b[_0x4e676e];return _0x336a3c;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xb505('0x0'));var fs=require('fs');var http=require(_0xb505('0x1'));var https=require(_0xb505('0x2'));var md5=require('md5');var path=require(_0xb505('0x3'));var querystring=require('querystring');var rp=require(_0xb505('0x4'));var rs=require(_0xb505('0x5'));var sox=require(_0xb505('0x6'));var tts=require(_0xb505('0x7'));var urlParse=require(_0xb505('0x8'))[_0xb505('0x9')];var util=require(_0xb505('0xa'));var aws=require(_0xb505('0xb'));var google=require(_0xb505('0xc'));var sestek=require('./sestek');var tilde=require(_0xb505('0xd'));var logger=require(_0xb505('0xe'))(_0xb505('0xf'));var ISPEECH_API=_0xb505('0x10');function downloadFile(_0x3f4a76,_0x503b7e){return new BPromise(function(_0x3e1e7b,_0x4f91a3){var _0x58da0d=urlParse(_0x3f4a76);var _0x4cce12=_0x58da0d[_0xb505('0x11')]==='https:'?https:http;var _0x32e022={'host':_0x58da0d[_0xb505('0x12')],'path':_0x58da0d[_0xb505('0x3')],'headers':{'user-agent':_0xb505('0x13')}};_0x4cce12['get'](_0x32e022,function(_0x345fd7){if(_0x345fd7[_0xb505('0x14')]!==0xc8){logger[_0xb505('0x15')]('request\x20to\x20'+_0x3f4a76+_0xb505('0x16')+_0x345fd7[_0xb505('0x14')]+'\x20('+_0x345fd7[_0xb505('0x17')]+')');_0x4f91a3(new Error(_0xb505('0x18')+_0x3f4a76+_0xb505('0x16')+_0x345fd7[_0xb505('0x14')]+'\x20('+_0x345fd7['statusMessage']+')'));return;}var _0x28c2e0=fs['createWriteStream'](_0x503b7e);_0x28c2e0['on']('finish',function(){logger[_0xb505('0x19')](_0xb505('0x1a'));_0x28c2e0[_0xb505('0x1b')](_0x3e1e7b);});_0x28c2e0['on'](_0xb505('0x15'),function(_0x474238){fs[_0xb505('0x1c')](_0x503b7e);logger[_0xb505('0x15')](_0xb505('0x1d'),_0x474238);_0x4f91a3(_0x474238);});_0x345fd7['pipe'](_0x28c2e0);})['on'](_0xb505('0x15'),function(_0x2d5f98){logger['error'](_0x2d5f98);_0x4f91a3(_0x2d5f98);})[_0xb505('0x1e')]();});}function uploadFile(_0x3f14a){return new BPromise(function(_0x46ecfd,_0x176bde){var _0x51cfa8=urlParse(_0x3f14a);var _0x2cb91a=_0x51cfa8[_0xb505('0x11')]===_0xb505('0x1f')?https:http;var _0x395289={'host':_0x51cfa8[_0xb505('0x12')],'path':_0x51cfa8[_0xb505('0x3')],'headers':{'user-agent':_0xb505('0x13')}};_0x2cb91a['get'](_0x395289,function(_0x431a74){if(_0x431a74[_0xb505('0x14')]!==0xc8){_0x176bde(new Error(_0xb505('0x18')+_0x3f14a+_0xb505('0x16')+_0x431a74['statusCode']+'\x20('+_0x431a74[_0xb505('0x17')]+')'));return;}var _0x1389ec='';_0x431a74['on'](_0xb505('0x20'),function(_0x309fce){_0x1389ec+=_0x309fce;});_0x431a74['on'](_0xb505('0x1e'),function(){_0x46ecfd(_0x1389ec);});})['on'](_0xb505('0x15'),function(_0x107d66){_0x176bde(_0x107d66);})[_0xb505('0x1e')]();});}function convertFile(_0xfc1625,_0x13c849){return new BPromise(function(_0x479150,_0x52f8c8){var _0x30dd96=sox['transcode'](_0xfc1625,_0x13c849,{'sampleRate':0x1f40,'format':_0xb505('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x30dd96['on'](_0xb505('0x15'),function(_0x29d679){logger[_0xb505('0x15')](_0xb505('0x22'),_0x29d679);_0x52f8c8(_0x29d679);});_0x30dd96['on'](_0xb505('0x1e'),function(){logger[_0xb505('0x19')](_0xb505('0x23'));_0x479150();});_0x30dd96[_0xb505('0x24')]();});}function base64Decode(_0x1d2bcd,_0x2918be){var _0x372d4c=path[_0xb505('0x25')](__dirname,'tmp',rs[_0xb505('0x26')](0x4)+_0xb505('0x27'));fs[_0xb505('0x28')](_0x372d4c,_0x1d2bcd,'base64');return convertFile(_0x372d4c,_0x2918be)[_0xb505('0x29')](function(){try{fs[_0xb505('0x1c')](_0x372d4c);fs[_0xb505('0x2a')](_0x2918be,_0xb505('0x2b'));}catch(_0x38b0b8){logger['error'](_0x38b0b8);}return _0x2918be[_0xb505('0x2c')]('.')[0x0];});}function base64Encode(_0x749f71){var _0x229c35=fs['readFileSync'](_0x749f71);return new Buffer(_0x229c35)['toString'](_0xb505('0x2d'));}exports[_0xb505('0x2e')]=function(_0x13645d,_0x30a6dd,_0x46c6b0,_0x4c50db,_0x4591db,_0x44407d){var _0x197efc,_0x53dc8e;var _0x42a657=_0xb505('0x2f');var _0x467b3a=_0xb505('0x30')+_0x13645d;var _0x30e71b={};if(_0x30a6dd===_0xb505('0x31')){_0x30e71b['input']={'ssml':_0x46c6b0};}else{_0x30e71b[_0xb505('0x32')]={'text':_0x46c6b0};};_0x30e71b['voice']={'languageCode':_0x4c50db,'ssmlGender':_0x4591db};_0x30e71b[_0xb505('0x33')]={'audioEncoding':_0xb505('0x34'),'sampleRateHertz':0x1f40};var _0x3781b3={'url':_0x42a657+_0xb505('0x35')+_0x467b3a,'method':_0xb505('0x36'),'json':!![],'body':_0x30e71b};return rp(_0x3781b3)[_0xb505('0x29')](function(_0x10832b){return new BPromise(function(_0x5f32b,_0x550e0e){_0x197efc=path['resolve'](__dirname,'tmp',rs[_0xb505('0x26')](0x4)+_0xb505('0x37'));var _0x587cf6=Buffer[_0xb505('0x38')](_0x10832b[_0xb505('0x39')],_0xb505('0x2d'));return fs[_0xb505('0x3a')](_0x197efc,_0x587cf6,function(_0x496ab9){_0x550e0e(_0x496ab9);},function(_0x4c647e){fs[_0xb505('0x2a')](_0x197efc,_0xb505('0x2b'));_0x5f32b(_0x4c647e);});});})['then'](function(_0x3e02ff){_0x53dc8e=path[_0xb505('0x25')](__dirname,_0xb505('0x3b'),rs[_0xb505('0x26')](0x4)+'.wav');return convertFile(_0x197efc,_0x53dc8e);})[_0xb505('0x29')](function(){try{fs[_0xb505('0x1c')](_0x197efc);fs[_0xb505('0x2a')](_0x53dc8e,'777');}catch(_0x295bf5){logger[_0xb505('0x15')](_0x295bf5);}logger[_0xb505('0x19')](_0xb505('0x3c'),_0x53dc8e[_0xb505('0x2c')]('.')[0x0]);return _0x53dc8e[_0xb505('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x282e20,_0x13de06){var _0x3aa5e9=_0xb505('0x3d');var _0x3e8d23,_0x5bf523;var _0x543f58;var _0x17ce82={'encoding':_0xb505('0x3e'),'method':_0xb505('0x36'),'timeout':0x2710,'url':_0x3aa5e9,'headers':{'Content-Type':_0xb505('0x3f')},'body':_0xb505('0x40')+encodeURIComponent(JSON['stringify']([[[_0xb505('0x41'),JSON[_0xb505('0x42')]([_0x282e20,_0x13de06||'en',![],'null']),null,_0xb505('0x43')]]]))};return rp(_0x17ce82)[_0xb505('0x29')](function(_0x2b1e13){try{_0x543f58=eval(_0x2b1e13[_0xb505('0x44')](0x5))[0x0][0x2];}catch(_0x3db13b){throw new Error(_0xb505('0x45')+_0x2b1e13['data']);}if(!_0x543f58){if(_0x282e20[_0xb505('0x46')]>0xc8){throw new Error(_0xb505('0x47'));}else{throw new Error(_0xb505('0x48')+_0x13de06+'\x22\x20might\x20not\x20exist');}}try{_0x543f58=eval(_0x543f58)[0x0];}catch(_0x50885c){throw new Error(_0xb505('0x45')+res[_0xb505('0x20')]);}const _0x320d33=_0x543f58;_0x3e8d23=path[_0xb505('0x25')](__dirname,_0xb505('0x3b'),rs[_0xb505('0x26')](0x4)+_0xb505('0x37'));fs[_0xb505('0x28')](_0x3e8d23,_0x543f58,{'encoding':_0xb505('0x2d')});_0x5bf523=path['resolve'](__dirname,_0xb505('0x3b'),rs[_0xb505('0x26')](0x4)+_0xb505('0x27'));return convertFile(_0x3e8d23,_0x5bf523);})[_0xb505('0x29')](function(){try{fs['unlink'](_0x3e8d23);fs[_0xb505('0x2a')](_0x5bf523,_0xb505('0x2b'));}catch(_0x49db0c){logger[_0xb505('0x15')](_0x49db0c);}logger['info'](_0xb505('0x49'),_0x5bf523['split']('.')[0x0]);return _0x5bf523[_0xb505('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x41d256,_0x3a5b0a,_0xcda45b){return google['asr'](_0x41d256,_0x3a5b0a,_0xcda45b)[_0xb505('0x29')](function(_0x50ee46){logger[_0xb505('0x19')](_0x50ee46[_0xb505('0x4a')]);return rp(_0x50ee46);})[_0xb505('0x29')](function(_0x45498c){var _0x128b84='';var _0x42115c=0x0;try{fs[_0xb505('0x1c')](_0x41d256);}catch(_0xcb48eb){logger[_0xb505('0x15')](_0xcb48eb);}if(_0x45498c&&_0x45498c[_0xb505('0x4b')]){_0x128b84=_0x45498c['results'][_0xb505('0x4c')](function(_0x1111bb){return _0x1111bb&&_0x1111bb['alternatives'][0x0]&&_0x1111bb[_0xb505('0x4d')][0x0][_0xb505('0x4e')]?_0x1111bb['alternatives'][0x0][_0xb505('0x4e')]:'';})['join']('\x0a');_0x42115c=_0x45498c[_0xb505('0x4b')]['map'](function(_0x238c99){return _0x238c99&&_0x238c99[_0xb505('0x4d')][0x0]&&_0x238c99['alternatives'][0x0][_0xb505('0x4f')]?_0x238c99[_0xb505('0x4d')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xb505('0x19')](_0xb505('0x50'),_0x128b84);logger[_0xb505('0x19')]('googleASR\x20confidence',_0x42115c);return{'transcript':_0x128b84,'confidence':_0x42115c};})[_0xb505('0x51')](function(_0x1e7cc6){logger[_0xb505('0x15')]('[%s]\x20%s:%s',_0x1e7cc6['statusCode'],_0x1e7cc6[_0xb505('0x52')],_0x1e7cc6[_0xb505('0x53')]);});};exports[_0xb505('0x54')]=function(_0x5aea2c,_0x116ccb,_0x2e8f76,_0x5005d4){var _0x3e17bf=apiai(_0x116ccb,{'language':_0x5005d4||'en'});return _0x3e17bf[_0xb505('0x55')](_0x2e8f76,{'sessionId':md5(_0x5aea2c)})[_0xb505('0x29')](function(_0x2556a3){logger[_0xb505('0x19')](JSON[_0xb505('0x42')](_0x2556a3));return{'source':_0x2556a3['result'][_0xb505('0x56')],'resolvedQuery':_0x2556a3[_0xb505('0x57')][_0xb505('0x58')],'action':_0x2556a3['result'][_0xb505('0x59')],'actionIncomplete':_0x2556a3['result'][_0xb505('0x5a')],'speech':_0x2556a3[_0xb505('0x57')]['fulfillment'][_0xb505('0x5b')],'score':_0x2556a3[_0xb505('0x57')][_0xb505('0x5c')],'statusCode':_0x2556a3['status'][_0xb505('0x5d')],'endConversation':_0x2556a3['result'][_0xb505('0x5e')][_0xb505('0x5f')]||![],'isFallbackIntent':_0x2556a3['result'][_0xb505('0x5e')]['isFallbackIntent']};});};exports[_0xb505('0x60')]=function(_0x29da1c,_0x211601,_0xb8f2a9,_0x56c0ec,_0x227338,_0xb9ec4d){var _0x241e59=_0x56c0ec[_0xb505('0x61')](/\\n/g,'\x0a');var _0x263467={'credentials':{'private_key':_0x241e59,'client_email':_0xb8f2a9}};var _0x33f17c=new dialogflow[(_0xb505('0x62'))](_0x263467);var _0x21f7d6=_0x33f17c['sessionPath'](_0x211601,md5(_0x29da1c));var _0x1b7ebd={'session':_0x21f7d6,'queryInput':{'text':{'text':_0x227338,'languageCode':_0xb9ec4d}}};return _0x33f17c[_0xb505('0x63')](_0x1b7ebd)[_0xb505('0x29')](function(_0x4f0400){if(_0x4f0400&&_0x4f0400[_0xb505('0x46')]){logger[_0xb505('0x19')](_0xb505('0x64'),JSON[_0xb505('0x42')](_0x4f0400));var _0x230aee=_0x4f0400[0x0];if(_0x230aee){var _0x13db05={'action':_0x230aee['queryResult'][_0xb505('0x59')],'allRequiredParamsPresent':_0x230aee[_0xb505('0x65')][_0xb505('0x66')],'endConversation':_0x230aee['queryResult']['diagnosticInfo']&&_0x230aee[_0xb505('0x65')][_0xb505('0x67')]['fields']?_0x230aee[_0xb505('0x65')][_0xb505('0x67')]['fields'][_0xb505('0x68')][_0xb505('0x69')]:![],'fulfillmentText':_0x230aee[_0xb505('0x65')][_0xb505('0x6a')],'intentName':_0x230aee[_0xb505('0x65')]['intent'][_0xb505('0x52')],'intentDisplayName':_0x230aee[_0xb505('0x65')][_0xb505('0x6b')][_0xb505('0x6c')],'isFallbackIntent':_0x230aee[_0xb505('0x65')]['intent'][_0xb505('0x6d')],'languageCode':_0x230aee[_0xb505('0x65')]['languageCode'],'queryText':_0x230aee['queryResult']['queryText'],'responseId':_0x230aee[_0xb505('0x6e')],'score':_0x230aee[_0xb505('0x65')][_0xb505('0x6f')],'speech':_0x230aee[_0xb505('0x65')]['fulfillmentText'],'providerResponse':JSON[_0xb505('0x42')](_0x4f0400)};return _0x13db05;}}});};exports['tildeASR']=function(_0x31f50e,_0x49aa3a,_0x3823b5,_0x3702cf){return tilde['asr'](_0x31f50e,_0x49aa3a,_0x3823b5,_0x3702cf)[_0xb505('0x29')](function(_0xbbe99c){try{fs[_0xb505('0x1c')](_0x31f50e);}catch(_0x5338a2){logger[_0xb505('0x15')](_0x5338a2);}logger[_0xb505('0x19')](_0xb505('0x70'),_0xbbe99c[_0xb505('0x4e')]);logger[_0xb505('0x19')](_0xb505('0x71'),_0xbbe99c['confidence']);return _0xbbe99c;});};exports['awsPolly']=function(_0x739652,_0x43ad7e,_0x5713df,_0xae5f11,_0x53797e,_0x194d20){var _0x366253=path[_0xb505('0x25')](__dirname,_0xb505('0x3b'),rs['generate'](0x4)+_0xb505('0x37'));var _0x121b12;return aws[_0xb505('0x72')](_0x739652,_0x43ad7e,_0x5713df,_0xae5f11,_0x53797e,_0x194d20,_0x366253)['then'](function(){_0x121b12=path[_0xb505('0x25')](__dirname,'tmp',rs[_0xb505('0x26')](0x4)+'.wav');return convertFile(_0x366253,_0x121b12);})['then'](function(){try{fs[_0xb505('0x1c')](_0x366253);fs['chmodSync'](_0x121b12,_0xb505('0x2b'));}catch(_0x271e64){logger[_0xb505('0x15')](_0x271e64);}return _0x121b12['split']('.')[0x0];});};exports[_0xb505('0x73')]=function(_0x1edabe,_0xd8c1de,_0x1e5aee,_0x15b9f2,_0xbd4955,_0x5be8b0){return aws[_0xb505('0x74')](_0x1edabe,_0xd8c1de,_0x1e5aee,_0x15b9f2,_0xbd4955,_0x5be8b0)[_0xb505('0x29')](function(_0x2a77db){logger[_0xb505('0x19')](JSON[_0xb505('0x42')](_0x2a77db));return _0x2a77db;});};exports[_0xb505('0x75')]=function(_0x1540e1,_0x23eff3,_0x125dc6,_0x52b458){var _0x1468ab=util[_0xb505('0x76')](_0xb505('0x77'),ISPEECH_API,_0x1540e1,encodeURIComponent(_0x23eff3),_0x125dc6,_0x52b458);var _0x1a2d65=path['resolve'](__dirname,_0xb505('0x3b'),rs[_0xb505('0x26')](0x4)+_0xb505('0x37'));var _0x1c8fe4;return downloadFile(_0x1468ab,_0x1a2d65)[_0xb505('0x29')](function(){_0x1c8fe4=path[_0xb505('0x25')](__dirname,'tmp',rs[_0xb505('0x26')](0x4)+'.wav');return convertFile(_0x1a2d65,_0x1c8fe4);})['then'](function(){try{fs[_0xb505('0x1c')](_0x1a2d65);fs['chmodSync'](_0x1c8fe4,'777');}catch(_0x4dcb1a){logger[_0xb505('0x15')](_0x4dcb1a);}return _0x1c8fe4[_0xb505('0x2c')]('.')[0x0];});};exports[_0xb505('0x78')]=function(_0xc2f3e0,_0x3c0916,_0x1051bd,_0xfe0617){var _0x56bd9d=util[_0xb505('0x76')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3c0916,_0x1051bd,base64Encode(_0xc2f3e0),_0xfe0617?util[_0xb505('0x76')](_0xb505('0x79'),encodeURIComponent(_0xfe0617)):_0xb505('0x7a'));return uploadFile(_0x56bd9d)[_0xb505('0x29')](function(_0x281417){return querystring[_0xb505('0x9')](_0x281417);});};exports[_0xb505('0x7b')]=function(_0x4c5130,_0x30588e){return sestek[_0xb505('0x7c')](_0x4c5130,_0x30588e)[_0xb505('0x29')](function(_0x242e0d){logger[_0xb505('0x19')](JSON['stringify'](_0x242e0d));var _0x1a0df6={'speech':_0x242e0d[_0xb505('0x7d')],'action':_0x242e0d['channelData']?_0x242e0d[_0xb505('0x7e')][_0xb505('0x7f')]:undefined,'actiondata':_0x242e0d[_0xb505('0x7e')]?_0x242e0d['channelData'][_0xb505('0x80')]:undefined};if(_0x242e0d['channelData']&&_0x242e0d[_0xb505('0x7e')][_0xb505('0x81')]){return base64Decode(_0x242e0d['channelData'][_0xb505('0x81')]['Data'],path[_0xb505('0x25')](__dirname,'tmp',rs[_0xb505('0x26')](0x4)+'.wav'))[_0xb505('0x29')](function(_0x2a6d99){_0x1a0df6[_0xb505('0x82')]=_0x2a6d99;return _0x1a0df6;});}return _0x1a0df6;});};exports[_0xb505('0x83')]=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 ae76d43..edbd020 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 _0xd22b=['./nda','exports'];(function(_0x543186,_0x51eba2){var _0xcb3a57=function(_0x419500){while(--_0x419500){_0x543186['push'](_0x543186['shift']());}};_0xcb3a57(++_0x51eba2);}(_0xd22b,0x170));var _0xbd22=function(_0x4fabd5,_0x501427){_0x4fabd5=_0x4fabd5-0x0;var _0x531604=_0xd22b[_0x4fabd5];return _0x531604;};var nda=require(_0xbd22('0x0'));module[_0xbd22('0x1')]={'nda':nda}; \ No newline at end of file +var _0x2aa9=['exports','./nda'];(function(_0x558c4f,_0x8934c4){var _0x5e9c61=function(_0x572f6c){while(--_0x572f6c){_0x558c4f['push'](_0x558c4f['shift']());}};_0x5e9c61(++_0x8934c4);}(_0x2aa9,0x1a7));var _0x92aa=function(_0x4c24da,_0x519109){_0x4c24da=_0x4c24da-0x0;var _0x234dc2=_0x2aa9[_0x4c24da];return _0x234dc2;};var nda=require(_0x92aa('0x0'));module[_0x92aa('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 72d2cf5..b54edcb 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 _0x3d7f=['stringify','request-promise','../../../../../config/logger','exports','ndauth_url','/token','password','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info'];(function(_0x4f65a2,_0x28563d){var _0x541777=function(_0x46af38){while(--_0x46af38){_0x4f65a2['push'](_0x4f65a2['shift']());}};_0x541777(++_0x28563d);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x3d7f[_0x4e6ae6];return _0x23c108;};'use strict';var rp=require(_0xf3d7('0x0'));var url=require('url');var logger=require(_0xf3d7('0x1'))('agi');module[_0xf3d7('0x2')]=function(_0x937b4c,_0x2b0930){var _0x33289c={'method':'POST','uri':url['resolve'](_0x2b0930[_0xf3d7('0x3')],_0xf3d7('0x4')),'form':{'grant_type':'password','username':_0x2b0930['username'],'password':_0x2b0930[_0xf3d7('0x5')]},'json':!![]};return rp(_0x33289c)[_0xf3d7('0x6')](function(_0x4fffe9){var _0x50fce6={'method':_0xf3d7('0x7'),'uri':url[_0xf3d7('0x8')](_0x2b0930[_0xf3d7('0x9')],_0xf3d7('0xa')),'body':{'type':_0x2b0930[_0xf3d7('0xb')]||_0xf3d7('0xc'),'channelId':_0xf3d7('0xd'),'conversation':{'id':_0x937b4c[_0xf3d7('0xe')]},'from':{'id':_0x937b4c[_0xf3d7('0xf')],'name':_0x937b4c[_0xf3d7('0x10')]},'recipient':{'id':_0x937b4c[_0xf3d7('0x11')],'name':_0x937b4c['extension']},'text':_0x2b0930['text'],'channelData':{}},'headers':{'Authorization':_0xf3d7('0x12')+_0x4fffe9[_0xf3d7('0x13')]},'json':!![]};if(_0x2b0930['project']){_0x50fce6[_0xf3d7('0x14')][_0xf3d7('0x15')][_0xf3d7('0x16')]=_0x2b0930['project'];}if(_0x2b0930[_0xf3d7('0x17')]=='1'){_0x50fce6[_0xf3d7('0x14')][_0xf3d7('0x15')][_0xf3d7('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf3d7('0x19')};}if(_0x2b0930[_0xf3d7('0x1a')]){_0x50fce6['body'][_0xf3d7('0x15')][_0xf3d7('0x1b')]=_0x2b0930[_0xf3d7('0x1a')];if(_0x2b0930[_0xf3d7('0x1c')]){_0x50fce6[_0xf3d7('0x14')][_0xf3d7('0x15')][_0xf3d7('0x1d')]=_0x2b0930['custom_action_data'];}}logger[_0xf3d7('0x1e')](JSON[_0xf3d7('0x1f')](_0x50fce6));return rp(_0x50fce6);});}; \ No newline at end of file +var _0x205d=['../../../../../config/logger','resolve','ndauth_url','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x205d,0xf6));var _0xd205=function(_0xfe4a8d,_0x33d75d){_0xfe4a8d=_0xfe4a8d-0x0;var _0x1bf633=_0x205d[_0xfe4a8d];return _0x1bf633;};'use strict';var rp=require(_0xd205('0x0'));var url=require(_0xd205('0x1'));var logger=require(_0xd205('0x2'))('agi');module['exports']=function(_0x1eaf09,_0xbd11c7){var _0x3f3c23={'method':'POST','uri':url[_0xd205('0x3')](_0xbd11c7[_0xd205('0x4')],_0xd205('0x5')),'form':{'grant_type':_0xd205('0x6'),'username':_0xbd11c7['username'],'password':_0xbd11c7[_0xd205('0x6')]},'json':!![]};return rp(_0x3f3c23)[_0xd205('0x7')](function(_0xdb99a8){var _0x372211={'method':_0xd205('0x8'),'uri':url[_0xd205('0x3')](_0xbd11c7[_0xd205('0x9')],_0xd205('0xa')),'body':{'type':_0xbd11c7[_0xd205('0xb')]||'message','channelId':_0xd205('0xc'),'conversation':{'id':_0x1eaf09[_0xd205('0xd')]},'from':{'id':_0x1eaf09[_0xd205('0xe')],'name':_0x1eaf09[_0xd205('0xf')]},'recipient':{'id':_0x1eaf09['dnid'],'name':_0x1eaf09[_0xd205('0x10')]},'text':_0xbd11c7[_0xd205('0x11')],'channelData':{}},'headers':{'Authorization':_0xd205('0x12')+_0xdb99a8[_0xd205('0x13')]},'json':!![]};if(_0xbd11c7[_0xd205('0x14')]){_0x372211[_0xd205('0x15')][_0xd205('0x16')]['ProjectName']=_0xbd11c7[_0xd205('0x14')];}if(_0xbd11c7[_0xd205('0x17')]=='1'){_0x372211[_0xd205('0x15')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd205('0x18')};}if(_0xbd11c7['custom_action']){_0x372211[_0xd205('0x15')]['channelData'][_0xd205('0x19')]=_0xbd11c7[_0xd205('0x1a')];if(_0xbd11c7[_0xd205('0x1b')]){_0x372211[_0xd205('0x15')]['channelData'][_0xd205('0x1c')]=_0xbd11c7[_0xd205('0x1b')];}}logger[_0xd205('0x1d')](JSON[_0xd205('0x1e')](_0x372211));return rp(_0x372211);});}; \ 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 53a17a3..3714fcb 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 _0xd02e=['exports','./lib/api'];(function(_0x17d84f,_0x4b29e3){var _0x314944=function(_0x252a44){while(--_0x252a44){_0x17d84f['push'](_0x17d84f['shift']());}};_0x314944(++_0x4b29e3);}(_0xd02e,0x8b));var _0xed02=function(_0x4961c0,_0x247e5c){_0x4961c0=_0x4961c0-0x0;var _0xd56269=_0xd02e[_0x4961c0];return _0xd56269;};'use strict';var asr=require(_0xed02('0x0'));module[_0xed02('0x1')]=function(_0x39cd4b,_0x4e1296,_0x3229da,_0x45aafc){return asr(_0x39cd4b,_0x4e1296,_0x3229da,_0x45aafc);}; \ No newline at end of file +var _0x867f=['./lib/api','exports'];(function(_0x144e6f,_0x160fe4){var _0x18030=function(_0x342b93){while(--_0x342b93){_0x144e6f['push'](_0x144e6f['shift']());}};_0x18030(++_0x160fe4);}(_0x867f,0xbc));var _0xf867=function(_0x12c32c,_0x13af3b){_0x12c32c=_0x12c32c-0x0;var _0x39b809=_0x867f[_0x12c32c];return _0x39b809;};'use strict';var asr=require(_0xf867('0x0'));module[_0xf867('0x1')]=function(_0x23c981,_0x1ef9a7,_0x22574c,_0x2b5d98){return asr(_0x23c981,_0x1ef9a7,_0x22574c,_0x2b5d98);}; \ 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 0e038e6..778da71 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 _0x0ae4=['Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','close','Tilde\x20ASR\x20send\x20error','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood'];(function(_0x11e790,_0x53d609){var _0x12902f=function(_0xf17c5b){while(--_0xf17c5b){_0x11e790['push'](_0x11e790['shift']());}};_0x12902f(++_0x53d609);}(_0x0ae4,0xc6));var _0x40ae=function(_0x5d7498,_0x47cfb8){_0x5d7498=_0x5d7498-0x0;var _0x4b868a=_0x0ae4[_0x5d7498];return _0x4b868a;};'use strict';var BPromise=require('bluebird');var _=require(_0x40ae('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x40ae('0x1'));var crypto=require(_0x40ae('0x2'));var logger=require(_0x40ae('0x3'))(_0x40ae('0x4'));module['exports']=function(_0x229b4d,_0x4ff04b,_0x2f2759,_0x323e02){return new BPromise(function(_0x2a093f,_0x377038){logger[_0x40ae('0x5')](_0x40ae('0x6'),_0x323e02||_0x40ae('0x7'));var _0x4c937f=new WebSocket(_0x323e02||_0x40ae('0x7'),{'perMessageDeflate':![]});var _0x4c9056='';var _0x3d6da1='0';var _0xfdbaff='1';var _0x12a6a3=_0x40ae('0x8');function _0x136be5(_0x5a83e4){var _0x21e489=crypto[_0x40ae('0x9')]('sha1');_0x21e489['update'](_0x5a83e4);return _0x21e489['digest'](_0x40ae('0xa'));}function _0x453239(){try{logger[_0x40ae('0x5')](_0x40ae('0xb'));var _0x39fff6=moment()[_0x40ae('0xc')]();var _0x25aaf3=_0x136be5(_0x39fff6+_0x4ff04b+_0x2f2759);_0x4c937f[_0x40ae('0xd')](JSON[_0x40ae('0xe')]({'appID':_0x4ff04b,'timestamp':_0x39fff6,'appKey':_0x25aaf3}));var _0x46d5f1=fs['createReadStream'](_0x229b4d);_0x46d5f1['on']('data',function(_0xd7717a){_0x4c937f[_0x40ae('0xd')](_0xd7717a);});_0x46d5f1['on'](_0x40ae('0xf'),function(){_0x4c937f[_0x40ae('0xd')]('EOS');});}catch(_0x340cdc){logger['error'](_0x40ae('0x10'),JSON[_0x40ae('0xe')](_0x340cdc));_0x4c937f['terminate']();}}function _0x4a3ab8(_0x112067){try{if(_0x112067){var _0x44d509=JSON[_0x40ae('0x11')](_0x112067);switch(_0x44d509[_0x40ae('0x12')]){case 0x0:if(_0x44d509[_0x40ae('0x13')]){if(_0x44d509['result']['final']){logger[_0x40ae('0x5')](_0x40ae('0x14'),JSON['stringify'](_0x44d509['result'][_0x40ae('0x15')]));_0x4c9056=_0x44d509[_0x40ae('0x13')][_0x40ae('0x15')][0x0][_0x40ae('0x16')];_0x3d6da1=_0x44d509[_0x40ae('0x13')][_0x40ae('0x15')][0x0][_0x40ae('0x17')];_0xfdbaff='0';_0x12a6a3=_0x40ae('0x18');_0x4c937f[_0x40ae('0x19')]();}}break;case 0x1:logger[_0x40ae('0x5')](_0x40ae('0x8'));_0xfdbaff='1';_0x12a6a3='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x40ae('0x5')](_0x40ae('0x1a'));_0xfdbaff='2';_0x12a6a3=_0x40ae('0x1a');break;case 0x9:logger[_0x40ae('0x5')](_0x40ae('0x1b'));_0xfdbaff='9';_0x12a6a3=_0x40ae('0x1b');break;case 0xa:logger[_0x40ae('0x5')]('Authentication\x20failed.');_0xfdbaff='10';_0x12a6a3=_0x40ae('0x1c');break;case 0xb:logger['info'](_0x40ae('0x1d'));_0xfdbaff='11';_0x12a6a3=_0x40ae('0x1d');}}}catch(_0x2e5cbf){logger[_0x40ae('0x1e')](_0x40ae('0x1f'),JSON[_0x40ae('0xe')](_0x2e5cbf));_0x4c937f['terminate']();}}function _0x90f2f4(){logger[_0x40ae('0x5')](_0x40ae('0x20'));_0x2a093f({'transcript':_0x4c9056,'confidence':_0x3d6da1,'status':_0xfdbaff,'status_message':_0x12a6a3});}function _0x3c0ab7(_0xfdf8a3){logger['error'](_0x40ae('0x21'));if(!_[_0x40ae('0x22')](_0xfdf8a3)){logger[_0x40ae('0x1e')](_['isObject'](_0xfdf8a3)?JSON['stringify'](_0xfdf8a3):_0xfdf8a3);}}_0x4c937f['on'](_0x40ae('0x23'),_0x453239);_0x4c937f['on'](_0x40ae('0x24'),_0x4a3ab8);_0x4c937f['on'](_0x40ae('0xf'),_0x90f2f4);_0x4c937f['on']('error',_0x3c0ab7);});}; \ No newline at end of file +var _0x9566=['parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','close','send','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x17067f,_0xa05391){var _0x141e2b=function(_0x487c83){while(--_0x487c83){_0x17067f['push'](_0x17067f['shift']());}};_0x141e2b(++_0xa05391);}(_0x9566,0x131));var _0x6956=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9566[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require(_0x6956('0x0'));var _=require(_0x6956('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6956('0x2'));var crypto=require(_0x6956('0x3'));var logger=require(_0x6956('0x4'))('agi');module['exports']=function(_0x3a87a6,_0x29dcf0,_0x507079,_0x142c13){return new BPromise(function(_0x5eb31e,_0x2b416c){logger['info']('Tilde\x20URI',_0x142c13||_0x6956('0x5'));var _0x47e142=new WebSocket(_0x142c13||_0x6956('0x5'),{'perMessageDeflate':![]});var _0x1ca1a2='';var _0x67e01a='0';var _0xe58138='1';var _0x466c19=_0x6956('0x6');function _0x5155da(_0x368ac9){var _0x27af=crypto['createHash'](_0x6956('0x7'));_0x27af[_0x6956('0x8')](_0x368ac9);return _0x27af['digest'](_0x6956('0x9'));}function _0x3117f5(){try{logger['info'](_0x6956('0xa'));var _0x59450a=moment()['unix']();var _0x1e7e82=_0x5155da(_0x59450a+_0x29dcf0+_0x507079);_0x47e142['send'](JSON[_0x6956('0xb')]({'appID':_0x29dcf0,'timestamp':_0x59450a,'appKey':_0x1e7e82}));var _0x172b78=fs[_0x6956('0xc')](_0x3a87a6);_0x172b78['on'](_0x6956('0xd'),function(_0x549335){_0x47e142['send'](_0x549335);});_0x172b78['on'](_0x6956('0xe'),function(){_0x47e142[_0x6956('0xf')](_0x6956('0x10'));});}catch(_0x4f85fd){logger[_0x6956('0x11')](_0x6956('0x12'),JSON[_0x6956('0xb')](_0x4f85fd));_0x47e142['terminate']();}}function _0x439526(_0x811d15){try{if(_0x811d15){var _0x582860=JSON[_0x6956('0x13')](_0x811d15);switch(_0x582860[_0x6956('0x14')]){case 0x0:if(_0x582860[_0x6956('0x15')]){if(_0x582860[_0x6956('0x15')]['final']){logger['info'](_0x6956('0x16'),JSON[_0x6956('0xb')](_0x582860[_0x6956('0x15')][_0x6956('0x17')]));_0x1ca1a2=_0x582860['result'][_0x6956('0x17')][0x0][_0x6956('0x18')];_0x67e01a=_0x582860[_0x6956('0x15')][_0x6956('0x17')][0x0][_0x6956('0x19')];_0xe58138='0';_0x466c19=_0x6956('0x1a');_0x47e142[_0x6956('0x1b')]();}}break;case 0x1:logger[_0x6956('0x1c')](_0x6956('0x6'));_0xe58138='1';_0x466c19=_0x6956('0x6');break;case 0x2:logger[_0x6956('0x1c')](_0x6956('0x1d'));_0xe58138='2';_0x466c19=_0x6956('0x1d');break;case 0x9:logger[_0x6956('0x1c')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xe58138='9';_0x466c19=_0x6956('0x1e');break;case 0xa:logger['info'](_0x6956('0x1f'));_0xe58138='10';_0x466c19=_0x6956('0x1f');break;case 0xb:logger['info'](_0x6956('0x20'));_0xe58138='11';_0x466c19=_0x6956('0x20');}}}catch(_0x218288){logger[_0x6956('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x218288));_0x47e142[_0x6956('0x1b')]();}}function _0x135b91(){logger[_0x6956('0x1c')]('Close\x20Tilde\x20ASR\x20socket');_0x5eb31e({'transcript':_0x1ca1a2,'confidence':_0x67e01a,'status':_0xe58138,'status_message':_0x466c19});}function _0x4151bd(_0x2b3d65){logger[_0x6956('0x11')](_0x6956('0x21'));if(!_['isNil'](_0x2b3d65)){logger[_0x6956('0x11')](_['isObject'](_0x2b3d65)?JSON['stringify'](_0x2b3d65):_0x2b3d65);}}_0x47e142['on'](_0x6956('0x22'),_0x3117f5);_0x47e142['on'](_0x6956('0x23'),_0x439526);_0x47e142['on'](_0x6956('0xe'),_0x135b91);_0x47e142['on'](_0x6956('0x11'),_0x4151bd);});}; \ 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 e886644..d30b036 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 _0xc604=['./asr','exports'];(function(_0x5eef0c,_0x2d06d0){var _0x14ac6b=function(_0x292954){while(--_0x292954){_0x5eef0c['push'](_0x5eef0c['shift']());}};_0x14ac6b(++_0x2d06d0);}(_0xc604,0x124));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};var asr=require(_0x4c60('0x0'));module[_0x4c60('0x1')]={'asr':asr}; \ No newline at end of file +var _0x083e=['exports','./asr'];(function(_0x1d773c,_0xae70b){var _0x53a690=function(_0x434888){while(--_0x434888){_0x1d773c['push'](_0x1d773c['shift']());}};_0x53a690(++_0xae70b);}(_0x083e,0xd7));var _0xe083=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x083e[_0x55fb83];return _0x59a87a;};var asr=require(_0xe083('0x0'));module[_0xe083('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e445fda..72b44d5 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _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(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xe706,0xa3));var _0x6e70=function(_0x23bcd4,_0xd3deb0){_0x23bcd4=_0x23bcd4-0x0;var _0x4cb792=_0xe706[_0x23bcd4];return _0x4cb792;};'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 d7ac1a7..db67c49 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 _0xbd50=['uniqueid','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','isEmpty','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','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','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','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','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','mailRpc','prototype','getVariableById','then','catch','getVoiceQueue','rpc','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','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','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','callerid','createSquareRecording'];(function(_0x29a611,_0x12787f){var _0x15cf86=function(_0x15e039){while(--_0x15e039){_0x29a611['push'](_0x29a611['shift']());}};_0x15cf86(++_0x12787f);}(_0xbd50,0x196));var _0x0bd5=function(_0x49448d,_0x144746){_0x49448d=_0x49448d-0x0;var _0x1b4b54=_0xbd50[_0x49448d];return _0x1b4b54;};'use strict';var fs=require('fs');var util=require(_0x0bd5('0x0'));var _=require(_0x0bd5('0x1'));var sh=require(_0x0bd5('0x2'));var odbc=require('odbc')();var rs=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var Mustache=require(_0x0bd5('0x5'));var rp=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('agi');var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x0bd5('0x8');var recursiveMapAttributes=[_0x0bd5('0x9'),_0x0bd5('0xa')];var verticesWithRetry=[_0x0bd5('0xb'),_0x0bd5('0xc'),'getsecretdigits'];var AGIVertices=function(_0x47e78d,_0x1a5cb9,_0x25e31e){this[_0x0bd5('0xd')]=_0x47e78d;this['rpc']=_0x1a5cb9;this[_0x0bd5('0xe')]=_0x25e31e;};AGIVertices[_0x0bd5('0xf')]['getVariable']=function(_0x210f45,_0x7db86e){this['rpc'][_0x0bd5('0x10')](_0x210f45)[_0x0bd5('0x11')](function(_0x1aa818){_0x7db86e(null,_0x1aa818?_0x1aa818['name']:![]);})[_0x0bd5('0x12')](function(_0x23982f){_0x7db86e(_0x23982f);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x13')]=function(_0xfa1eed,_0x557be0){this[_0x0bd5('0x14')][_0x0bd5('0x15')](_0xfa1eed)['then'](function(_0x78f9b8){_0x557be0(null,_0x78f9b8?_0x78f9b8[_0x0bd5('0x16')]:![]);})['catch'](function(_0x31349f){_0x557be0(_0x31349f);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x17')]=function(_0xc22553,_0x55d565){this[_0x0bd5('0x14')][_0x0bd5('0x18')](_0xc22553)[_0x0bd5('0x11')](function(_0x277b32){_0x55d565(null,_0x277b32?_0x277b32[_0x0bd5('0x16')]:![]);})[_0x0bd5('0x12')](function(_0xc58e12){_0x55d565(_0xc58e12);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x19')]=function(_0x20c667,_0x27bc1e){this[_0x0bd5('0x14')][_0x0bd5('0x1a')](_0x20c667)[_0x0bd5('0x11')](function(_0x527c37){_0x27bc1e(null,_0x527c37?_0x527c37['dsn']:![]);})['catch'](function(_0x4ed64e){_0x27bc1e(_0x4ed64e);});};AGIVertices['prototype'][_0x0bd5('0x1b')]=function(_0x86381d,_0x13ce46){this[_0x0bd5('0x14')][_0x0bd5('0x1c')](_0x86381d)['then'](function(_0x440f85){_0x13ce46(null,_0x440f85?_0x440f85[_0x0bd5('0x16')]:![]);})[_0x0bd5('0x12')](function(_0x5a8139){_0x13ce46(_0x5a8139);});};AGIVertices[_0x0bd5('0xf')]['getTrunk']=function(_0x4969e6,_0x14c319){this[_0x0bd5('0x14')][_0x0bd5('0x1d')](_0x4969e6)['then'](function(_0x42428c){_0x14c319(null,_0x42428c?_0x42428c['name']:![]);})[_0x0bd5('0x12')](function(_0x3ffb08){_0x14c319(_0x3ffb08);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1e')]=function(_0x3ff237,_0x2023d5){var _0x19bb5e=this;this[_0x0bd5('0x14')][_0x0bd5('0x1f')](_0x3ff237)[_0x0bd5('0x11')](function(_0x15561b){_0x2023d5(null,_0x15561b?_0x19bb5e[_0x0bd5('0x20')](_0x15561b[_0x0bd5('0x21')]):![]);})[_0x0bd5('0x12')](function(_0x5e5a33){_0x2023d5(_0x5e5a33);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x22')]=function(_0x4c799f,_0x20e6c3){this[_0x0bd5('0x14')]['getMailAccountById'](_0x4c799f)[_0x0bd5('0x11')](function(_0x1b7cf4){_0x20e6c3(null,_0x1b7cf4?_0x1b7cf4:![]);})[_0x0bd5('0x12')](function(_0x25a35b){_0x20e6c3(_0x25a35b);});};AGIVertices['prototype'][_0x0bd5('0x23')]=function(_0x366e8c,_0x622d46,_0x24ef4a){this[_0x0bd5('0xe')][_0x0bd5('0x23')](_0x366e8c,_0x622d46)['then'](function(){_0x24ef4a(null);})[_0x0bd5('0x12')](function(_0x589ea2){_0x24ef4a(_0x589ea2);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x24')]=function(_0x444ddb,_0x132e02){this[_0x0bd5('0x14')][_0x0bd5('0x25')](_0x444ddb)[_0x0bd5('0x11')](function(_0x24f7d5){if(_0x24f7d5){if(_0x24f7d5[_0x0bd5('0x26')]){_0x132e02(null,[_0x24f7d5[_0x0bd5('0x27')]]);}else{_0x132e02(null,_[_0x0bd5('0x28')](_0x24f7d5[_0x0bd5('0x29')],_0x0bd5('0x27')));}}else{_0x132e02(null,![]);}})['catch'](function(_0x3e153a){_0x132e02(_0x3e153a);});};AGIVertices[_0x0bd5('0xf')]['getSoundPath']=function(_0x50b9ce){return util[_0x0bd5('0x2a')](_0x0bd5('0x2b'),FILES_PATH,_0x50b9ce);};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x2c')]=function(_0x1dd2e1,_0x387e24,_0x22c10c){odbc[_0x0bd5('0x2d')](_0x1dd2e1,function(_0x44b2ce){if(_0x44b2ce){logger[_0x0bd5('0x2e')](_0x0bd5('0x2f'),_0x44b2ce);_0x22c10c(_0x44b2ce);}else{logger[_0x0bd5('0x30')](_0x0bd5('0x31'));odbc['query'](_0x387e24,function(_0x109f54,_0x5b915c){if(_0x109f54){logger[_0x0bd5('0x30')](_0x0bd5('0x32'),_0x387e24);_0x22c10c(_0x109f54);}else{logger[_0x0bd5('0x30')](_0x0bd5('0x33'),_0x387e24);odbc[_0x0bd5('0x34')](function(_0x18e408){if(_0x18e408){logger['error'](_0x0bd5('0x35'),_0x18e408);}_0x22c10c(null,_0x5b915c);});}});}});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x36')]=function(_0x1a9dda,_0x1c73be){this[_0x0bd5('0x14')][_0x0bd5('0x37')](_0x1a9dda)[_0x0bd5('0x11')](function(_0x1c2ef8){_0x1c73be(null,_0x1c2ef8?_0x1c2ef8:![]);})['catch'](function(_0x177aa3){_0x1c73be(_0x177aa3);});};AGIVertices['prototype'][_0x0bd5('0x38')]=function(_0xc17464,_0x480b8b){this[_0x0bd5('0x14')][_0x0bd5('0x38')](_0xc17464)[_0x0bd5('0x11')](function(_0x3ec4b0){_0x480b8b(null,_0x3ec4b0);})[_0x0bd5('0x12')](function(_0x1a8d55){_0x480b8b(_0x1a8d55);});};AGIVertices[_0x0bd5('0xf')]['createSquareDetailsReport']=function(_0x4d3ca5,_0x994f24,_0x545b63){this['rpc'][_0x0bd5('0x39')]({'uniqueid':this[_0x0bd5('0xd')]['uniqueid'],'node':_0x4d3ca5['label'],'application':_0x4d3ca5['agicommand'],'data':_0x994f24||null,'project_name':this[_0x0bd5('0xd')]['arg_1'],'callerid':this['channel'][_0x0bd5('0x3a')]})[_0x0bd5('0x11')](function(_0x49e46a){if(_0x545b63){_0x545b63(null,_0x49e46a);}})['catch'](function(_0xb46d84){if(_0x545b63){_0x545b63(_0xb46d84);}});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x3b')]=function(_0xa36962,_0x56a702,_0x290342,_0x44f485){this[_0x0bd5('0x14')][_0x0bd5('0x3b')]({'uniqueid':this[_0x0bd5('0xd')][_0x0bd5('0x3c')],'callerid':this['channel'][_0x0bd5('0x3a')],'calleridname':this[_0x0bd5('0xd')][_0x0bd5('0x3d')],'context':this['channel'][_0x0bd5('0x3e')],'extension':this[_0x0bd5('0xd')][_0x0bd5('0x3f')],'priority':this['channel'][_0x0bd5('0x40')],'accountcode':this[_0x0bd5('0xd')][_0x0bd5('0x41')],'dnid':this[_0x0bd5('0xd')][_0x0bd5('0x42')],'projectName':this['channel'][_0x0bd5('0x43')],'saveName':_0x56a702,'filename':_0xa36962[_0x0bd5('0x44')]||_0x56a702,'savePath':_0x290342})['then'](function(_0x2db9b0){_0x44f485(null,_0x2db9b0);})[_0x0bd5('0x12')](function(_0x146bdc){_0x44f485(_0x146bdc);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x45')]=function(_0x508aa8,_0x109793,_0x128df9,_0x5cd889,_0x70d7ce){this['rpc'][_0x0bd5('0x45')]({'uniqueid':this[_0x0bd5('0xd')][_0x0bd5('0x3c')],'body':_0x508aa8,'direction':_0x109793,'providerName':_0x128df9,'providerResponse':_0x5cd889})[_0x0bd5('0x11')](function(_0x5f54bb){if(_0x70d7ce){_0x70d7ce(null,_0x5f54bb);}})[_0x0bd5('0x12')](function(_0x4cb674){if(_0x70d7ce){_0x70d7ce(_0x4cb674);}});};AGIVertices['prototype'][_0x0bd5('0x46')]=function(_0x1b473f,_0x172393){this['rpc'][_0x0bd5('0x46')]({'firstName':_['isEmpty'](_0x1b473f[_0x0bd5('0x16')])||_[_0x0bd5('0x47')](_0x1b473f[_0x0bd5('0x16')])?'callback_'+Math['random']():_0x1b473f['name'],'lastName':_[_0x0bd5('0x48')](_0x1b473f[_0x0bd5('0x49')])||_[_0x0bd5('0x47')](_0x1b473f['lastName'])?null:_0x1b473f[_0x0bd5('0x49')],'phone':_0x1b473f[_0x0bd5('0x4a')],'ListId':_0x1b473f['list_id'],'scheduledat':_0x1b473f[_0x0bd5('0x4b')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x0bd5('0x4c'),'description':_0x0bd5('0x4d')+_0x1b473f[_0x0bd5('0x4b')][_0x0bd5('0x4e')](),'priority':_0x1b473f['callback_priority']})[_0x0bd5('0x11')](function(_0x3316ba){_0x172393(null,_0x3316ba);})[_0x0bd5('0x12')](function(_0x5cf2f2){_0x172393(_0x5cf2f2);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x4f')]=function(_0x374701,_0x4851fb){this['rpc'][_0x0bd5('0x50')](_0x374701)['then'](function(_0x3e20e9){_0x4851fb(null,_0x3e20e9?_0x3e20e9[_0x0bd5('0x16')]:![]);})[_0x0bd5('0x12')](function(_0x5e7bcd){_0x4851fb(_0x5e7bcd);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x51')]=function(_0x3eaea6,_0x38aae5,_0x5e93fa){var _0x3c0d59={'role':_0x0bd5('0x52')};_0x3c0d59[_0x3eaea6]=this[_0x0bd5('0xd')][_0x0bd5('0x3a')];this[_0x0bd5('0x14')]['agentPause'](_0x3c0d59,_0x38aae5,this[_0x0bd5('0xd')]['uniqueid'])[_0x0bd5('0x11')](function(_0x5d6cb3){_0x5e93fa(null,_['isNil'](_0x5d6cb3)?![]:!![]);})[_0x0bd5('0x12')](function(_0x55883d){logger[_0x0bd5('0x2e')](_0x55883d);_0x5e93fa(null,![]);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x53')]=function(_0x5c84f9,_0x4f7e86){var _0x27609f={'role':'agent'};_0x27609f[_0x5c84f9]=this[_0x0bd5('0xd')][_0x0bd5('0x3a')];this['rpc'][_0x0bd5('0x53')](_0x27609f)['then'](function(_0x45ccf5){_0x4f7e86(null,_[_0x0bd5('0x47')](_0x45ccf5)?![]:!![]);})[_0x0bd5('0x12')](function(_0x18cb9b){logger[_0x0bd5('0x2e')](_0x18cb9b);_0x4f7e86(null,![]);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x54')]=function(_0x4ad449,_0x33ad3f){var _0x1e5e7d={'role':_0x0bd5('0x52')};_0x1e5e7d[_0x4ad449]=this['channel']['callerid'];this[_0x0bd5('0x14')][_0x0bd5('0x54')](_0x1e5e7d)[_0x0bd5('0x11')](function(_0x42dc72){_0x33ad3f(null,_[_0x0bd5('0x47')](_0x42dc72)?![]:!![]);})[_0x0bd5('0x12')](function(_0x1db7f2){logger[_0x0bd5('0x2e')](_0x1db7f2);_0x33ad3f(null,![]);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x55')]=function(_0x11c266,_0x377869){var _0x30b87e={'role':_0x0bd5('0x52')};_0x30b87e[_0x11c266]=this[_0x0bd5('0xd')][_0x0bd5('0x3a')];var _0x29d9d8=_0x11c266!=_0x0bd5('0x56')?util['format'](_0x0bd5('0x57'),_0x0bd5('0x58'),this['channel'][_0x0bd5('0x3a')]):undefined;this['rpc'][_0x0bd5('0x55')](_0x30b87e,_0x29d9d8)[_0x0bd5('0x11')](function(_0x4f7170){_0x377869(null,_[_0x0bd5('0x47')](_0x4f7170)?![]:!![]);})[_0x0bd5('0x12')](function(_0x1510bd){logger[_0x0bd5('0x2e')](_0x1510bd);_0x377869(null,![]);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x59')]=function(_0x2fbea8,_0x1a5708){sh[_0x0bd5('0x5a')](_['trim'](_0x2fbea8),function(_0x196c1c,_0x3be572){var _0x583835=_0x3be572[_0x0bd5('0x5b')](/(\r\n|\n|\r)/gm,'');_0x1a5708(null,_0x583835);});};AGIVertices[_0x0bd5('0xf')]['googleCloudTTS']=function(_0x215491,_0x333303){scripts['googleCloudTTS'](_0x215491[_0x0bd5('0x5c')],_0x215491['google_cloud_tts_text_type']||_0x0bd5('0x5d'),_0x215491[_0x0bd5('0x5d')],_0x215491[_0x0bd5('0x5e')]||_0x0bd5('0x5f'),_0x215491[_0x0bd5('0x60')]||_0x0bd5('0x61'),_0x215491[_0x0bd5('0x62')]||_0x0bd5('0x63'))[_0x0bd5('0x11')](function(_0x1812a4){_0x333303(null,_0x1812a4);})[_0x0bd5('0x12')](function(_0x1182b4){_0x333303(_0x1182b4);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x64')]=function(_0x580a90,_0x2707f7){scripts[_0x0bd5('0x64')](_0x580a90[_0x0bd5('0x5d')],_0x580a90[_0x0bd5('0x65')]||'en',0x1)[_0x0bd5('0x11')](function(_0xf5ef66){_0x2707f7(null,_0xf5ef66);})['catch'](function(_0x1500f2){_0x2707f7(_0x1500f2);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x66')]=function(_0x371b77,_0x3bc8cc){var _0x116e67={'uri':_0x371b77[_0x0bd5('0x67')],'method':_0x371b77['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x371b77['timeout'])==='number'&&parseInt(_0x371b77[_0x0bd5('0x68')])>=0x1?parseInt(_0x371b77[_0x0bd5('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x0bd5('0x69')]([_0x0bd5('0x6a'),_0x0bd5('0x6b')],_0x116e67['method'][_0x0bd5('0x6c')]())){try{_0x116e67[_0x0bd5('0x6d')]=_0x371b77['rawBody']?JSON[_0x0bd5('0x6e')](_0x371b77[_0x0bd5('0xa')]):{};}catch(_0x1a812e){logger[_0x0bd5('0x2e')](_0x0bd5('0x6f'),_0x1a812e);}}try{_0x116e67[_0x0bd5('0x70')]=_0x371b77[_0x0bd5('0x9')]?JSON[_0x0bd5('0x6e')](_0x371b77[_0x0bd5('0x9')]):{};}catch(_0x32110c){logger[_0x0bd5('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x32110c);}if(_0x371b77[_0x0bd5('0x71')]){try{var _0x3a0719=require(_0x371b77[_0x0bd5('0x71')])[_0x0bd5('0x72')](this,_0x116e67);_0x116e67[_0x0bd5('0x73')]=Mustache['render'](_0x371b77[_0x0bd5('0x67')],_0x3a0719,{},['$$','$$']);if(_0x116e67[_0x0bd5('0x70')]){_0x116e67[_0x0bd5('0x70')]=JSON[_0x0bd5('0x6e')](Mustache[_0x0bd5('0x74')](JSON[_0x0bd5('0x75')](_0x116e67[_0x0bd5('0x70')]),_0x3a0719,{},['$$','$$']));}if(_0x116e67[_0x0bd5('0x6d')]){_0x116e67[_0x0bd5('0x6d')]=JSON[_0x0bd5('0x6e')](Mustache[_0x0bd5('0x74')](JSON[_0x0bd5('0x75')](_0x116e67[_0x0bd5('0x6d')]),_0x3a0719,{},['$$','$$']));}}catch(_0xcbb2fc){logger[_0x0bd5('0x2e')](_0x0bd5('0x76'),_0xcbb2fc);}}rp(_0x116e67)[_0x0bd5('0x11')](function(_0x14653e){var _0x6afdff={'statusCode':_0x14653e['statusCode']||0xc8,'statusMessage':_0x14653e['statusMessage']||'OK','headers':_0x14653e[_0x0bd5('0x70')]||{},'body':_0x14653e[_0x0bd5('0x6d')]||{}};_0x3bc8cc(null,_0x6afdff);})[_0x0bd5('0x12')](function(_0xc53281){var _0x25b65b={'statusCode':_0xc53281['statusCode']||0x1f4,'statusMessage':_0xc53281[_0x0bd5('0x77')]||_0x0bd5('0x78'),'headers':_0xc53281[_0x0bd5('0x79')][_0x0bd5('0x70')]||{},'body':_0xc53281[_0x0bd5('0x79')]['body']||{}};_0x3bc8cc(null,_0x25b65b);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x7a')]=function(_0x7c1d11,_0x200df8){scripts[_0x0bd5('0x7a')](this[_0x0bd5('0xd')][_0x0bd5('0x3c')],_0x7c1d11[_0x0bd5('0x7b')],_0x7c1d11[_0x0bd5('0x5d')],_0x7c1d11[_0x0bd5('0x7c')]||'en')[_0x0bd5('0x11')](function(_0x48a77d){_0x200df8(null,_0x48a77d);})[_0x0bd5('0x12')](function(_0x26ad0c){_0x200df8(_0x26ad0c);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x7d')]=function(_0x2c77eb,_0x46a5ee){scripts[_0x0bd5('0x7d')](this[_0x0bd5('0xd')]['uniqueid'],_0x2c77eb[_0x0bd5('0x7e')],_0x2c77eb[_0x0bd5('0x7f')],_0x2c77eb[_0x0bd5('0x80')],_0x2c77eb[_0x0bd5('0x5d')],_0x2c77eb[_0x0bd5('0x81')]||'en')[_0x0bd5('0x11')](function(_0x3ee6bf){_0x46a5ee(null,_0x3ee6bf);})[_0x0bd5('0x12')](function(_0x97d31b){_0x46a5ee(_0x97d31b);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x82')]=function(_0x112e85,_0x23a041){scripts[_0x0bd5('0x82')](this[_0x0bd5('0xd')],_0x112e85)[_0x0bd5('0x11')](function(_0x54ba20){_0x23a041(null,_0x54ba20);})[_0x0bd5('0x12')](function(_0x331841){_0x23a041(_0x331841);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x83')]=function(_0x323f48,_0x2cd599){scripts[_0x0bd5('0x83')](_0x323f48[_0x0bd5('0x7b')],_0x323f48[_0x0bd5('0x5d')],_0x323f48['ispeech_tts_language']||_0x0bd5('0x5f'),_0x323f48[_0x0bd5('0x84')])[_0x0bd5('0x11')](function(_0x505d41){_0x2cd599(null,_0x505d41);})[_0x0bd5('0x12')](function(_0x1d5c3a){_0x2cd599(_0x1d5c3a);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x85')]=function(_0x1e7d05,_0x2fd908,_0x533297){scripts[_0x0bd5('0x85')](_0x2fd908,_0x1e7d05['key'],_0x1e7d05[_0x0bd5('0x86')]||'en-US',this['isConfigured'](_0x1e7d05[_0x0bd5('0x87')])?_0x1e7d05[_0x0bd5('0x87')]:undefined)[_0x0bd5('0x11')](function(_0x1e0a98){_0x533297(null,_0x1e0a98);})['catch'](function(_0xb303d9){_0x533297(_0xb303d9);});};AGIVertices[_0x0bd5('0xf')]['awsPolly']=function(_0x8e94cf,_0x3609db){scripts[_0x0bd5('0x88')](_0x8e94cf[_0x0bd5('0x89')],_0x8e94cf[_0x0bd5('0x8a')],_0x8e94cf[_0x0bd5('0x8b')],_0x8e94cf[_0x0bd5('0x8c')]||_0x0bd5('0x8d'),_0x8e94cf[_0x0bd5('0x5d')],_0x8e94cf[_0x0bd5('0x8e')]||_0x0bd5('0x5d'))[_0x0bd5('0x11')](function(_0xaea5ef){_0x3609db(null,_0xaea5ef);})[_0x0bd5('0x12')](function(_0x2220f5){_0x3609db(_0x2220f5);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x8f')]=function(_0x12da8d,_0x2eee49){scripts[_0x0bd5('0x8f')](this[_0x0bd5('0xd')][_0x0bd5('0x3c')],_0x12da8d[_0x0bd5('0x89')],_0x12da8d[_0x0bd5('0x8a')],_0x12da8d[_0x0bd5('0x90')],_0x12da8d[_0x0bd5('0x5d')],_0x12da8d['aws_bot_name'])[_0x0bd5('0x11')](function(_0x4b65f6){_0x2eee49(null,_0x4b65f6);})[_0x0bd5('0x12')](function(_0x467a37){_0x2eee49(_0x467a37);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x91')]=function(_0x105048,_0xeffd4d,_0x1fa5c7){scripts[_0x0bd5('0x91')](_0xeffd4d,_0x105048[_0x0bd5('0x7b')],_0x105048['google_asr_language']||'en-US')[_0x0bd5('0x11')](function(_0x392bdc){_0x1fa5c7(null,_0x392bdc);})['catch'](function(_0x3771b7){_0x1fa5c7(_0x3771b7);});};AGIVertices['prototype'][_0x0bd5('0x92')]=function(_0x1e754a,_0x240ed8,_0x40a5d0){scripts['tildeASR'](_0x240ed8,_0x1e754a[_0x0bd5('0x93')],_0x1e754a[_0x0bd5('0x94')],_0x1e754a[_0x0bd5('0x73')])[_0x0bd5('0x11')](function(_0x5d2896){_0x40a5d0(null,_0x5d2896);})[_0x0bd5('0x12')](function(_0x327708){_0x40a5d0(_0x327708);});};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x95')]=function(_0x31d2e0){var _0x32c424=_[_0x0bd5('0x69')](verticesWithRetry,_0x31d2e0[_0x0bd5('0x96')])?_0x31d2e0:_[_0x0bd5('0x97')](_0x31d2e0);for(var _0x42a7b0 in _0x32c424){if(_0x32c424[_0x0bd5('0x98')](_0x42a7b0)){if(_0x32c424[_0x42a7b0]&&_[_0x0bd5('0x99')](_0x32c424[_0x42a7b0])){if(_['includes'](recursiveMapAttributes,_0x42a7b0)){_0x32c424[_0x42a7b0]=this[_0x0bd5('0x9a')](_0x32c424[_0x42a7b0]);}else{_0x32c424[_0x42a7b0]=this[_0x0bd5('0x9b')](_0x32c424[_0x42a7b0]);}}}}return _0x32c424;};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x9c')]=function(_0x29db27){for(var _0x74b27 in _0x29db27){if(_0x29db27[_0x0bd5('0x98')](_0x74b27)){if(_[_0x0bd5('0x9d')](_0x29db27[_0x74b27])){this[_0x0bd5('0x9c')](_0x29db27[_0x74b27]);}else if(_[_0x0bd5('0x9e')](_0x29db27[_0x74b27])){for(var _0x2a05bc=0x0;_0x2a05bc<_0x29db27[_0x74b27]['length'];_0x2a05bc++){this[_0x0bd5('0x9c')](_0x29db27[_0x74b27][_0x2a05bc]);}}else if(_['isString'](_0x29db27[_0x74b27])){_0x29db27[_0x74b27]=this[_0x0bd5('0x9b')](_0x29db27[_0x74b27]);}}}};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x9f')]=function(_0x57e61b,_0x509e4d){for(var _0x57d9dd in _0x57e61b){if(_0x57e61b[_0x0bd5('0x98')](_0x57d9dd)){if(_[_0x0bd5('0x9d')](_0x57e61b[_0x57d9dd])){if(!_[_0x0bd5('0x48')](_0x57e61b[_0x57d9dd])){this[_0x0bd5('0x9f')](_0x57e61b[_0x57d9dd],util[_0x0bd5('0x2a')](_0x0bd5('0xa0'),_0x509e4d,_0x57d9dd));}}else if(_[_0x0bd5('0x9e')](_0x57e61b[_0x57d9dd])){for(var _0xe74312=0x0;_0xe74312<_0x57e61b[_0x57d9dd][_0x0bd5('0xa1')];_0xe74312++){this[_0x0bd5('0x9f')](_0x57e61b[_0x57d9dd][_0xe74312],util[_0x0bd5('0x2a')]('%s.%s',_0x509e4d,_0x57d9dd+'['+_0xe74312+']'));}}else{if(!_[_0x0bd5('0x47')](_0x57e61b[_0x57d9dd])){this[_0x0bd5('0xd')]['setVariable'](util['format'](_0x0bd5('0xa0'),_0x509e4d,_0x57d9dd),_0x57e61b[_0x57d9dd]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x4145b8){try{var _0x26c6db=JSON[_0x0bd5('0x6e')](_0x4145b8);this[_0x0bd5('0x9c')](_0x26c6db);return JSON[_0x0bd5('0x75')](_0x26c6db);}catch(_0x36e17c){return this[_0x0bd5('0x9b')](_0x4145b8);}};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x9b')]=function(_0xa965e5){var _0xa2096c=_0xa965e5['split']('{');for(var _0x137649=0x1;_0x137649<_0xa2096c[_0x0bd5('0xa1')];_0x137649+=0x1){var _0x41aeec=_0xa2096c[_0x137649][_0x0bd5('0xa2')]('}');if(_0x41aeec[_0x0bd5('0xa1')]>0x1){_0xa965e5=_0xa965e5[_0x0bd5('0xa3')]('{'+_0x41aeec[0x0]+'}',this[_0x0bd5('0xd')][_0x0bd5('0xa4')](_0x41aeec[0x0])[_0x0bd5('0xa5')]||_0x41aeec[0x0]);}}if(_0xa2096c[_0x0bd5('0xa1')]===0x1){return _0xa965e5[_0x0bd5('0x4e')]();}return this[_0x0bd5('0x9b')](_0xa965e5);};AGIVertices['prototype'][_0x0bd5('0xa6')]=function(_0x5d8f36,_0x337ed1){var _0x4b24f2=this[_0x0bd5('0xd')][_0x0bd5('0xa4')](_0x5d8f36);if(_0x4b24f2[_0x0bd5('0xa7')]===-0x1){return _0x4b24f2;}logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xa8'),_0x337ed1,_0x4b24f2[_0x0bd5('0xa5')]));return this[_0x0bd5('0xd')][_0x0bd5('0xa9')](_0x337ed1,_0x4b24f2[_0x0bd5('0xa5')]);};AGIVertices['prototype'][_0x0bd5('0xaa')]=function(_0x365b22){return _0x365b22&&_0x365b22!=='0'&&_0x365b22!=='-1'&&_0x365b22!=='';};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xab')]=function(_0x26c4c5){this[_0x0bd5('0x39')][_0x0bd5('0x72')](this,_0x26c4c5,'-');_0x26c4c5[_0x0bd5('0xac')]=_0x26c4c5[_0x0bd5('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xad')]=function(_0x315e4a){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xae'),_0x315e4a[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x315e4a['text'])){return this['channel'][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}var _0x2a8c09='\x22'+_0x315e4a['text']+'\x22';if(this[_0x0bd5('0xaa')](_0x315e4a[_0x0bd5('0x79')])){_0x2a8c09+=','+_0x315e4a[_0x0bd5('0x79')];}var _0x545fde=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0xb2'),_0x2a8c09);if(_0x545fde[_0x0bd5('0xa7')]===-0x1){return _0x545fde;}return this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2a8c09));};AGIVertices[_0x0bd5('0xf')]['mrcprecog']=function(_0x39a94f){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xb3'),_0x39a94f[_0x0bd5('0xaf')]));if(!this['isConfigured'](_0x39a94f[_0x0bd5('0xb4')])){return this['channel'][_0x0bd5('0xb0')]('no\x20grammar\x20configured');}var _0x5807ba=_0x39a94f[_0x0bd5('0xb4')];if(this[_0x0bd5('0xaa')](_0x39a94f[_0x0bd5('0x79')])){_0x5807ba+=','+_0x39a94f[_0x0bd5('0x79')];}var _0x4f9dd1=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0xb5'),_0x5807ba);if(_0x4f9dd1[_0x0bd5('0xa7')]===-0x1){return _0x4f9dd1;}var _0x5a05b4=this[_0x0bd5('0xa6')](_0x0bd5('0xb6'),_0x0bd5('0xb7'));if(_0x5a05b4[_0x0bd5('0xa7')]===-0x1){return _0x5a05b4;}var _0x20c7c6=this[_0x0bd5('0xa6')](_0x0bd5('0xb8'),_0x0bd5('0xb9'));if(_0x20c7c6[_0x0bd5('0xa7')]===-0x1){return _0x20c7c6;}var _0x466e41=this['getAndSetVariable'](_0x0bd5('0xba'),'MRCP_RECOG_INSTANCE');if(_0x466e41[_0x0bd5('0xa7')]===-0x1){return _0x466e41;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xbb'),_0x5807ba));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xbc')]=function(_0x4b656e){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0xbd'),_0x4b656e[_0x0bd5('0xaf')]));return this['channel'][_0x0bd5('0xbc')]([_0x4b656e[_0x0bd5('0xbe')],_0x4b656e[_0x0bd5('0xbf')]]);};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xc0')]=function(_0x20ff57){logger['info'](util['format'](_0x0bd5('0xc1'),_0x20ff57['label']));if(this[_0x0bd5('0xaa')](_0x20ff57[_0x0bd5('0x68')])){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xc2'),_0x20ff57[_0x0bd5('0x68')]));var _0x3da9b5=this[_0x0bd5('0xd')][_0x0bd5('0xc3')](_0x20ff57[_0x0bd5('0x68')]);if(_0x3da9b5[_0x0bd5('0xa7')]===-0x1){return _0x3da9b5;}}return this['channel'][_0x0bd5('0xc0')]();};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x4c')]=function(_0x2f1461){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xc4'),_0x2f1461[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x2f1461[_0x0bd5('0xc5')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x2f1461,_0x0bd5('0xc6'));}_0x2f1461[_0x0bd5('0x4b')]=moment();if(this[_0x0bd5('0xaa')](_0x2f1461[_0x0bd5('0xc7')])){_0x2f1461[_0x0bd5('0x4b')]=moment()[_0x0bd5('0xc8')](_0x2f1461[_0x0bd5('0xc7')],_0x0bd5('0xc9'));}if(!this[_0x0bd5('0xaa')](_0x2f1461['callback_priority'])){_0x2f1461[_0x0bd5('0xca')]=0x2;}this[_0x0bd5('0x46')][_0x0bd5('0x72')](this,_0x2f1461);return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xcb'),_0x2f1461[_0x0bd5('0x4a')],_0x2f1461[_0x0bd5('0xc5')],_0x2f1461['scheduledAt']));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xcc')]=function(_0x3263a7){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0xcd'),_0x3263a7['label']));var _0x2a50a2=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x3263a7['application'],_0x3263a7[_0x0bd5('0x79')]);if(_0x2a50a2[_0x0bd5('0xa7')]===-0x1){return _0x2a50a2;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xce'),_0x3263a7[_0x0bd5('0xcf')],_0x3263a7[_0x0bd5('0x79')]));};AGIVertices[_0x0bd5('0xf')]['lumenvoxtts']=function(_0x1a5c39){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0xd0'),_0x1a5c39[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x1a5c39['text'])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0xb1'));}var _0x4996fc='\x22'+_0x1a5c39['text']+'\x22';if(this['isConfigured'](_0x1a5c39[_0x0bd5('0x79')])){_0x4996fc+=','+_0x1a5c39[_0x0bd5('0x79')];}var _0x3e7ce1=this[_0x0bd5('0xd')][_0x0bd5('0x5a')]('MRCPSynth',_0x4996fc);if(_0x3e7ce1[_0x0bd5('0xa7')]===-0x1){return _0x3e7ce1;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4996fc));};AGIVertices['prototype']['sestektts']=function(_0x394de9){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0xd1'),_0x394de9['label']));if(!this[_0x0bd5('0xaa')](_0x394de9[_0x0bd5('0x5d')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}var _0x3b617f='\x22'+_0x394de9['text']+'\x22';if(this[_0x0bd5('0xaa')](_0x394de9[_0x0bd5('0x79')])){_0x3b617f+=','+_0x394de9[_0x0bd5('0x79')];}var _0x4a3e68=this['channel'][_0x0bd5('0x5a')](_0x0bd5('0xb2'),_0x3b617f);if(_0x4a3e68[_0x0bd5('0xa7')]===-0x1){return _0x4a3e68;}return this['channel'][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xd2'),_0x3b617f));};AGIVertices['prototype'][_0x0bd5('0xd3')]=function(_0x277dbe){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xd4'),_0x277dbe[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x277dbe['grammar'])){return this[_0x0bd5('0xd')]['noop']('no\x20grammar\x20configured');}var _0x2f066b=_0x277dbe[_0x0bd5('0xb4')];if(this[_0x0bd5('0xaa')](_0x277dbe[_0x0bd5('0x79')])){_0x2f066b+=','+_0x277dbe[_0x0bd5('0x79')];}var _0x221cf6=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0xb5'),_0x2f066b);if(_0x221cf6[_0x0bd5('0xa7')]===-0x1){return _0x221cf6;}var _0x30ffcc=this['getAndSetVariable'](_0x0bd5('0xb6'),_0x0bd5('0xd5'));if(_0x30ffcc['result']===-0x1){return _0x30ffcc;}var _0x3ac7da=this[_0x0bd5('0xa6')](_0x0bd5('0xb8'),_0x0bd5('0xd6'));if(_0x3ac7da[_0x0bd5('0xa7')]===-0x1){return _0x3ac7da;}var _0x163832=this['getAndSetVariable'](_0x0bd5('0xba'),_0x0bd5('0xd7'));if(_0x163832[_0x0bd5('0xa7')]===-0x1){return _0x163832;}return this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')](_0x0bd5('0xbb'),_0x2f066b));};AGIVertices['prototype'][_0x0bd5('0xd8')]=function(_0x3d3073){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0xd9'),_0x3d3073['label']));if(!this['isConfigured'](_0x3d3073[_0x0bd5('0xb4')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xda'));}var _0x56a475=_0x3d3073['grammar'];if(this[_0x0bd5('0xaa')](_0x3d3073[_0x0bd5('0x79')])){_0x56a475+=','+_0x3d3073[_0x0bd5('0x79')];}var _0x440d03=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0xb5'),_0x56a475);if(_0x440d03['result']===-0x1){return _0x440d03;}var _0xf69970=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x0bd5('0xdb'));if(_0xf69970[_0x0bd5('0xa7')]===-0x1){return _0xf69970;}var _0x101ada=this[_0x0bd5('0xa6')]('RECOG_INPUT()',_0x0bd5('0xdc'));if(_0x101ada[_0x0bd5('0xa7')]===-0x1){return _0x101ada;}var _0xb325b7=this[_0x0bd5('0xa6')](_0x0bd5('0xba'),_0x0bd5('0xdd'));if(_0xb325b7[_0x0bd5('0xa7')]===-0x1){return _0xb325b7;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0xbb'),_0x56a475));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xde')]=function(_0x17a446){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xdf'),_0x17a446[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x17a446['odbc_id'])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x17a446,_0x0bd5('0xe0'));}var _0x8628fd=this[_0x0bd5('0x19')][_0x0bd5('0x72')](this,_0x17a446[_0x0bd5('0xe1')]);if(!_0x8628fd){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x17a446,'no\x20odbc\x20database\x20found');}if(!this[_0x0bd5('0xaa')](_0x17a446[_0x0bd5('0xe2')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x17a446,_0x0bd5('0xe3'));}var _0x284fbf=_0x17a446['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('query:\x20%s',_0x284fbf));var _0x187367=this[_0x0bd5('0x2c')][_0x0bd5('0x72')](this,_0x8628fd,_0x284fbf);this[_0x0bd5('0x39')][_0x0bd5('0x72')](this,_0x17a446,_0x284fbf);if(!this[_0x0bd5('0xaa')](_0x17a446[_0x0bd5('0xe4')])){return this['channel'][_0x0bd5('0xb0')](_0x0bd5('0xe5'));}var _0x4fd105=this[_0x0bd5('0xa4')]['sync'](this,_0x17a446[_0x0bd5('0xe4')]);if(!_0x4fd105){return this['channel']['error'](_0x17a446,_0x0bd5('0xe6'));}var _0x2a3d44=this;_0x187367[_0x0bd5('0xe7')](function(_0x7e0bac,_0x303cbb){Object[_0x0bd5('0xe8')](_0x7e0bac)[_0x0bd5('0xe7')](function(_0xd0cf36){_0x2a3d44['channel'][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0xe9'),_0x4fd105,_0x303cbb,_0xd0cf36),_0x7e0bac[_0xd0cf36]);});});this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0xea'),_0x4fd105),_0x187367['length']);return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xeb'),_0x4fd105));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xec')]=function(_0x49363b){logger[_0x0bd5('0xed')](util['format'](_0x0bd5('0xee'),_0x49363b[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x49363b[_0x0bd5('0xef')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x49363b,'no\x20user\x20selected');}var _0x48a214=this[_0x0bd5('0x1b')][_0x0bd5('0x72')](this,_0x49363b[_0x0bd5('0xef')]);if(!_0x48a214){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x49363b,_0x0bd5('0xf0'));}var _0x5e6752=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0xf1'),[util['format'](_0x0bd5('0xf2'),_0x48a214),_0x49363b['timeout'],_0x49363b['opts'],_0x49363b[_0x0bd5('0x67')]]);if(_0x5e6752[_0x0bd5('0xa7')]===-0x1){return _0x5e6752;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format']('Executed\x20command\x20%s',_0x0bd5('0xf1')));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xf3')]=function(_0x207acf){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x207acf[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x207acf['key'])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0xf4'));}if(!this[_0x0bd5('0xaa')](_0x207acf['text'])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}this[_0x0bd5('0xd')][_0x0bd5('0xf5')]=!![];this['createSquareDetailsReport'](_0x207acf);this[_0x0bd5('0x45')](_0x207acf[_0x0bd5('0x5d')],'in','','');this['channel']['noop'](util[_0x0bd5('0x2a')](_0x0bd5('0xf6'),_0x207acf[_0x0bd5('0x5d')]));var _0x24da0a=this[_0x0bd5('0x7a')][_0x0bd5('0x72')](this,_0x207acf);if(_0x24da0a){for(var _0x214875 in _0x24da0a){if(_0x24da0a['hasOwnProperty'](_0x214875)){this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0xf7'),_0x214875[_0x0bd5('0x6c')]()),_0x24da0a[_0x214875]);}}this[_0x0bd5('0x45')](_0x24da0a[_0x0bd5('0xf8')],_0x0bd5('0xf9'),_0x0bd5('0xf3'),'');return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0xfa'),_0x24da0a[_0x0bd5('0xf8')]));}return this[_0x0bd5('0xd')]['error'](_0x207acf,_0x0bd5('0xfb'));};AGIVertices[_0x0bd5('0xf')]['dialogflowV2']=function(_0x2b61e7){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0xfc'),_0x2b61e7[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x2b61e7[_0x0bd5('0x7e')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xfd'));}if(!this[_0x0bd5('0xaa')](_0x2b61e7[_0x0bd5('0x7f')])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0xfe'));}if(!this[_0x0bd5('0xaa')](_0x2b61e7[_0x0bd5('0x80')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xff'));}if(!this[_0x0bd5('0xaa')](_0x2b61e7[_0x0bd5('0x81')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x100'));}if(!this['isConfigured'](_0x2b61e7['text'])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}this[_0x0bd5('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x2b61e7);this[_0x0bd5('0x45')](_0x2b61e7[_0x0bd5('0x5d')],'in','','');this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x101'),_0x2b61e7[_0x0bd5('0x5d')]));var _0x27e296=this[_0x0bd5('0x7d')][_0x0bd5('0x72')](this,_0x2b61e7);if(_0x27e296){for(var _0x70396c in _0x27e296){if(_0x27e296[_0x0bd5('0x98')](_0x70396c)){if(_0x70396c!==_0x0bd5('0x102')){this['channel'][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0xf7'),_0x70396c[_0x0bd5('0x6c')]()),_0x27e296[_0x70396c]);}}}this[_0x0bd5('0x45')](_0x27e296[_0x0bd5('0xf8')],_0x0bd5('0xf9'),_0x0bd5('0x103'),_0x27e296[_0x0bd5('0x102')]);return this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')](_0x0bd5('0x104'),_0x27e296[_0x0bd5('0xf8')]));}return this[_0x0bd5('0xd')]['error'](_0x2b61e7,_0x0bd5('0x105'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x106')]=function(_0x47fc7a){logger['info'](util['format'](_0x0bd5('0x107'),_0x47fc7a[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x47fc7a['ndauth_url'])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0x108'));}if(!this[_0x0bd5('0xaa')](_0x47fc7a['username'])){return this['channel'][_0x0bd5('0xb0')](_0x0bd5('0x109'));}if(!this[_0x0bd5('0xaa')](_0x47fc7a[_0x0bd5('0x10a')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x10b'));}if(!this['isConfigured'](_0x47fc7a[_0x0bd5('0x10c')])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0xb1'));}this['channel']['bot']=!![];this[_0x0bd5('0x39')](_0x47fc7a);this[_0x0bd5('0x45')](_0x47fc7a[_0x0bd5('0x5d')],'in','','');this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x10d'),_0x47fc7a[_0x0bd5('0x5d')]));var _0x85338b=this[_0x0bd5('0x82')][_0x0bd5('0x72')](this,_0x47fc7a);if(_0x85338b){for(var _0xbf22de in _0x85338b){if(_0x85338b['hasOwnProperty'](_0xbf22de)){this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0x10e'),_0xbf22de[_0x0bd5('0x6c')]()),_0x85338b[_0xbf22de]);}}this[_0x0bd5('0x45')](_0x85338b[_0x0bd5('0xf8')],'out','sesteknda','');if(_0x85338b[_0x0bd5('0x10f')]){this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')](_0x0bd5('0x110'),_0x85338b['audiofile']));var _0x2c67b1=this[_0x0bd5('0xd')][_0x0bd5('0x111')](_0x85338b[_0x0bd5('0x10f')]);try{fs['unlink'](_0x85338b[_0x0bd5('0x10f')]+'.wav');}catch(_0x27fe1e){logger[_0x0bd5('0x2e')](_0x27fe1e);}return _0x2c67b1;}else{return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x112'),_0x85338b['speech']));}}return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x47fc7a,_0x0bd5('0x113'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x114')]=function(_0x1c44b6){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x115'),_0x1c44b6['label']));return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x114'));};AGIVertices['prototype'][_0x0bd5('0x116')]=function(_0xfa2e4d){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x117'),_0xfa2e4d[_0x0bd5('0xaf')]));var _0x32d781='';if(_0xfa2e4d[_0x0bd5('0x118')]){if(!this[_0x0bd5('0xaa')](_0xfa2e4d['trunk_id'])){return this[_0x0bd5('0xd')]['error'](_0xfa2e4d,_0x0bd5('0x119'));}else{var _0x4a43d6=parseInt(_0xfa2e4d['trunk_id'],0xa);if(isNaN(_0x4a43d6)){_0x32d781=_0xfa2e4d[_0x0bd5('0x118')];}else{_0x32d781=this[_0x0bd5('0x11a')][_0x0bd5('0x72')](this,_0xfa2e4d[_0x0bd5('0x118')]);if(!_0x32d781){return this[_0x0bd5('0xd')]['error'](_0xfa2e4d,_0x0bd5('0x11b'));}}}}else if(_0xfa2e4d[_0x0bd5('0x11c')]){_0x32d781=_0xfa2e4d[_0x0bd5('0x11c')];}else{return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0xfa2e4d,'no\x20trunk\x20selected');}var _0x57dd7c=this[_0x0bd5('0xd')][_0x0bd5('0x5a')]('DIAL',[util[_0x0bd5('0x2a')](_0x0bd5('0x11d'),_0x32d781,_0xfa2e4d['phone']),_0xfa2e4d['timeout'],_0xfa2e4d[_0x0bd5('0x11e')],_0xfa2e4d[_0x0bd5('0x67')]]);if(_0x57dd7c[_0x0bd5('0xa7')]===-0x1){return _0x57dd7c;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x11f'),_0x0bd5('0xf1')));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x120')]=function(_0x3aa0a8){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x121'),_0x3aa0a8['label']));return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0x120'));};AGIVertices['prototype'][_0x0bd5('0xc')]=function(_0x1a15f1){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1a15f1[_0x0bd5('0xaf')]));if(_0x1a15f1[_0x0bd5('0xac')]===0x0){return this['maxRetry'](_0x1a15f1);}_0x1a15f1[_0x0bd5('0xac')]-=0x1;if(!this[_0x0bd5('0xaa')](_0x1a15f1[_0x0bd5('0x122')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x1a15f1,_0x0bd5('0x123'));}var _0x5b19d3=this['getSound'][_0x0bd5('0x72')](this,_0x1a15f1['file_id']);if(!_0x5b19d3){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x1a15f1,_0x0bd5('0x124'));}if(!this['isConfigured'](_0x1a15f1['variable_id'])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x0bd5('0xe5'));}var _0x4989be=this[_0x0bd5('0xd')][_0x0bd5('0x125')](_0x5b19d3,_0x1a15f1[_0x0bd5('0x126')],_0x1a15f1['maxdigit']);var _0x2add71=_0x4989be[_0x0bd5('0xa7')]?_0x4989be[_0x0bd5('0xa7')][_0x0bd5('0x4e')]():'';logger['info'](_0x0bd5('0x127'),JSON[_0x0bd5('0x75')](_0x4989be));if(_0x4989be['result']===-0x1){this['createSquareDetailsReport'][_0x0bd5('0x72')](this,_0x1a15f1,_0x2add71);return _0x4989be;}else if(_0x4989be['extra']===_0x0bd5('0x68')){_0x4989be[_0x0bd5('0xa7')]=_0x2add71[_0x0bd5('0xa1')]>=parseInt(_0x1a15f1[_0x0bd5('0x128')])?'x':'i';}else{_0x4989be[_0x0bd5('0xa7')]=_0x2add71[_0x0bd5('0xa1')]>=parseInt(_0x1a15f1[_0x0bd5('0x128')])&&_0x2add71[_0x0bd5('0xa1')]<=parseInt(_0x1a15f1[_0x0bd5('0x129')])?'x':'i';}var _0x54738d=this[_0x0bd5('0xa4')][_0x0bd5('0x72')](this,_0x1a15f1[_0x0bd5('0xe4')]);if(!_0x54738d){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x1a15f1,'no\x20variable\x20found');}this['channel'][_0x0bd5('0xa9')](_0x54738d,_0x2add71);if(this[_0x0bd5('0xaa')](_0x1a15f1[_0x0bd5('0x12a')])){var _0x173e0b=parseInt(_0x1a15f1[_0x0bd5('0x12a')],0xa);var _0xaf06bd=rs[_0x0bd5('0x12b')]({'charset':'*','length':_0x173e0b});var _0x183052=_0x2add71[_0x0bd5('0xa1')];if(_0x183052>0x0){if(_0x183052>_0x173e0b){this[_0x0bd5('0x39')][_0x0bd5('0x72')](this,_0x1a15f1,_0x1a15f1[_0x0bd5('0x12c')]===_0x0bd5('0x12d')?_0xaf06bd+_0x2add71[_0x0bd5('0x12e')](_0x173e0b):_0x2add71[_0x0bd5('0x12e')](0x0,_0x183052-_0x173e0b)+_0xaf06bd);}else{this[_0x0bd5('0x39')][_0x0bd5('0x72')](this,_0x1a15f1,rs['generate']({'charset':'*','length':_0x183052}));}}else{this[_0x0bd5('0x39')]['sync'](this,_0x1a15f1,'');}}else{this[_0x0bd5('0x39')]['sync'](this,_0x1a15f1,_0x2add71);}return _0x4989be;};AGIVertices['prototype'][_0x0bd5('0x12f')]=function(_0x259463){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x259463[_0x0bd5('0xaf')]));return this['getdigits'](_0x259463);};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x130')]=function(_0x5e5211){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x131'),_0x5e5211[_0x0bd5('0xaf')]));this[_0x0bd5('0x39')]['sync'](this,_0x5e5211,_0x5e5211['goalname']);return this['channel'][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('GOAL\x20%s',_0x5e5211['goalname']));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x132')]=function(_0x284191){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x284191[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x284191['aws_access_key_id'])||!this[_0x0bd5('0xaa')](_0x284191[_0x0bd5('0x8a')])){return this['channel'][_0x0bd5('0xb0')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x0bd5('0xaa')](_0x284191['text'])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0xb1'));}this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x133'),_0x284191['text']));var _0x194aca=this[_0x0bd5('0x88')][_0x0bd5('0x72')](this,_0x284191);if(_0x194aca){this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x134'),_0x194aca));var _0x4f0c4b=this['channel'][_0x0bd5('0x111')](_0x194aca);try{fs[_0x0bd5('0x135')](_0x194aca+_0x0bd5('0x136'));}catch(_0x5e84a1){logger['error'](_0x5e84a1);}return _0x4f0c4b;}return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x284191,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x137')]=function(_0x4c522d){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x138'),_0x4c522d[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x4c522d['aws_access_key_id'])||!this['isConfigured'](_0x4c522d[_0x0bd5('0x8a')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x0bd5('0xaa')](_0x4c522d[_0x0bd5('0x139')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x13a'));}if(!this['isConfigured'](_0x4c522d[_0x0bd5('0x5d')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}this['channel'][_0x0bd5('0xf5')]=!![];this[_0x0bd5('0x39')](_0x4c522d);this[_0x0bd5('0x45')](_0x4c522d[_0x0bd5('0x5d')],'in','','');this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x4c522d[_0x0bd5('0x5d')]));var _0x309a34=this[_0x0bd5('0x8f')][_0x0bd5('0x72')](this,_0x4c522d);if(_0x309a34){for(var _0x3810ff in _0x309a34){if(_0x309a34[_0x0bd5('0x98')](_0x3810ff)&&_[_0x0bd5('0x99')](_0x309a34[_0x3810ff])){this[_0x0bd5('0xd')]['setVariable'](util[_0x0bd5('0x2a')](_0x0bd5('0x13b'),_0x3810ff[_0x0bd5('0x6c')]()),_0x309a34[_0x3810ff]);}}if(_[_0x0bd5('0x47')](_0x309a34[_0x0bd5('0x77')])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0x13c'));}else{this['createSquareMessage'](_0x309a34[_0x0bd5('0x77')],_0x0bd5('0xf9'),_0x0bd5('0x13d'),'');return this['channel'][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x13e'),_0x309a34[_0x0bd5('0x77')]));}}return this[_0x0bd5('0xd')]['error'](_0x4c522d,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x13f')]=function(_0x25f5c4){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x140'),_0x25f5c4[_0x0bd5('0xaf')],_0x25f5c4[_0x0bd5('0x68')]));if(!this[_0x0bd5('0xaa')](_0x25f5c4[_0x0bd5('0x7b')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xf4'));}var _0xd23950=_0x0bd5('0x141');var _0x2e48f6=util[_0x0bd5('0x2a')](_0x0bd5('0x142'),FILES_PATH,rs[_0x0bd5('0x12b')](0x4));var _0x3ff8e9=util[_0x0bd5('0x2a')](_0x0bd5('0xa0'),_0x2e48f6,_0xd23950);var _0x1b9646=!![];if(_0x25f5c4[_0x0bd5('0x143')]===_0x0bd5('0x144')){_0x1b9646=![];}var _0x1e63e9=this[_0x0bd5('0xd')][_0x0bd5('0x145')](_0x2e48f6,_0xd23950,_0x25f5c4[_0x0bd5('0x146')],_0x25f5c4[_0x0bd5('0x68')],undefined,_0x1b9646);if(_0x1e63e9['result']!==-0x1){this['channel'][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x147'),_0x3ff8e9));var _0x2c8810=this['googleASR']['sync'](this,_0x25f5c4,_0x3ff8e9);if(_0x2c8810){for(var _0x419a33 in _0x2c8810){if(_0x2c8810['hasOwnProperty'](_0x419a33)){this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util['format'](_0x0bd5('0x148'),_0x419a33[_0x0bd5('0x6c')]()),_0x2c8810[_0x419a33]);}}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x149'),JSON[_0x0bd5('0x75')](_0x2c8810)));}}return _0x1e63e9;};AGIVertices['prototype'][_0x0bd5('0x14a')]=function(_0x3c245c){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3c245c[_0x0bd5('0xaf')]));if(!this['isConfigured'](_0x3c245c[_0x0bd5('0x93')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x14b'));}if(!this[_0x0bd5('0xaa')](_0x3c245c[_0x0bd5('0x94')])){return this['channel'][_0x0bd5('0xb0')](_0x0bd5('0x14c'));}var _0x48bd5d='wav';var _0x2c810e=util['format'](_0x0bd5('0x142'),FILES_PATH,rs[_0x0bd5('0x12b')](0x4));var _0xa8847=util[_0x0bd5('0x2a')](_0x0bd5('0xa0'),_0x2c810e,_0x48bd5d);var _0x112958=!![];if(_0x3c245c[_0x0bd5('0x143')]==='NOBEEP'){_0x112958=![];}var _0x463f05=this[_0x0bd5('0xd')][_0x0bd5('0x145')](_0x2c810e,_0x48bd5d,_0x3c245c['intKey'],_0x3c245c['timeout'],undefined,_0x112958);if(_0x463f05[_0x0bd5('0xa7')]!==-0x1){this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')]('tilde\x20%s\x20file\x20created',_0xa8847));var _0x376080=this[_0x0bd5('0x92')][_0x0bd5('0x72')](this,_0x3c245c,_0xa8847);if(_0x376080){for(var _0x44b594 in _0x376080){if(_0x376080[_0x0bd5('0x98')](_0x44b594)){this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0x14d'),_0x44b594[_0x0bd5('0x6c')]()),_0x376080[_0x44b594]);}}return this['channel']['noop'](util['format'](_0x0bd5('0x14e'),JSON['stringify'](_0x376080)));}}return _0x463f05;};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x14f')]=function(_0x4087bb){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x150'),_0x4087bb[_0x0bd5('0xaf')]));return this[_0x0bd5('0xd')][_0x0bd5('0x151')](_0x4087bb[_0x0bd5('0x3e')],_0x4087bb[_0x0bd5('0x3f')],_0x4087bb[_0x0bd5('0x40')]);};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x152')]=function(_0x14f58f){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x14f58f[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x14f58f[_0x0bd5('0x153')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x14f58f,'no\x20condition\x20configured');}try{var _0x44bde8=eval(_0x14f58f[_0x0bd5('0x153')])?_0x0bd5('0x154'):_0x0bd5('0x155');this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x156'),_0x14f58f[_0x0bd5('0x153')],_0x44bde8));return{'code':0xc8,'result':_0x44bde8};}catch(_0x4f063e){return{'code':0xc8,'result':_0x0bd5('0x155')};}};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x157')]=function(_0x1f6da5){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1f6da5[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x1f6da5[_0x0bd5('0x158')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x1f6da5,_0x0bd5('0x159'));}var _0x3936a2=this['getIntervals']['sync'](this,_0x1f6da5[_0x0bd5('0x158')]);if(!_0x3936a2){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x1f6da5,'no\x20intervals\x20found');}for(var _0x2e50ca=0x0;_0x2e50ca<_0x3936a2[_0x0bd5('0xa1')];_0x2e50ca+=0x1){var _0x26c6d7=this[_0x0bd5('0xd')][_0x0bd5('0xa4')](util[_0x0bd5('0x2a')](_0x0bd5('0x15a'),_0x3936a2[_0x2e50ca]));if(_0x26c6d7[_0x0bd5('0xa7')]===-0x1){return _0x26c6d7;}logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x15b'),_0x3936a2[_0x2e50ca],_0x26c6d7[_0x0bd5('0xa5')]));if(_0x26c6d7[_0x0bd5('0xa5')]===_0x0bd5('0x154')){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x15b'),_0x3936a2[_0x2e50ca],_0x0bd5('0x154')));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x15b'),_0x3936a2[_0x2e50ca],_0x0bd5('0x154')));return{'code':0xc8,'result':_0x0bd5('0x154')};}else{logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x15b'),_0x3936a2[_0x2e50ca],'false'));this['channel'][_0x0bd5('0xb0')](util['format']('IFTIME\x20%s\x20%s',_0x3936a2[_0x2e50ca],_0x0bd5('0x155')));}}return{'code':0xc8,'result':_0x0bd5('0x155')};};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x15c')]=function(_0x7463ae){logger['info'](util[_0x0bd5('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x7463ae[_0x0bd5('0xaf')]));return this['channel'][_0x0bd5('0x15c')]();};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x15d')]=function(_0x592215){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x15e'),_0x592215[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x592215[_0x0bd5('0x7b')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xf4'));}var _0x33f0c0=_0x0bd5('0x141');var _0x6e88fa=util['format'](_0x0bd5('0x142'),FILES_PATH,rs[_0x0bd5('0x12b')](0x4));var _0x4faba1=util['format'](_0x0bd5('0xa0'),_0x6e88fa,_0x33f0c0);var _0x18009d=!![];if(_0x592215[_0x0bd5('0x143')]===_0x0bd5('0x144')){_0x18009d=![];}var _0x597660=this['channel'][_0x0bd5('0x145')](_0x6e88fa,_0x33f0c0,_0x592215[_0x0bd5('0x146')],_0x592215[_0x0bd5('0x68')],undefined,_0x18009d);if(_0x597660['result']!==-0x1){this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('ispeech\x20%s\x20file\x20created',_0x4faba1));var _0x43faa5=this[_0x0bd5('0x85')][_0x0bd5('0x72')](this,_0x592215,_0x4faba1);if(_0x43faa5){for(var _0x9605c1 in _0x43faa5){if(_0x43faa5['hasOwnProperty'](_0x9605c1)){this['channel'][_0x0bd5('0xa9')](util[_0x0bd5('0x2a')](_0x0bd5('0x15f'),_0x9605c1[_0x0bd5('0x6c')]()),_0x43faa5[_0x9605c1]);}}return this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')](_0x0bd5('0x160'),JSON['stringify'](_0x43faa5)));}}return _0x597660;};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x161')]=function(_0x277363){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x277363[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x277363[_0x0bd5('0x7b')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xf4'));}if(!this['isConfigured'](_0x277363['text'])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x162'),_0x277363['text']));var _0xb64926=this['ispeechTTS'][_0x0bd5('0x72')](this,_0x277363);if(_0xb64926){this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x163'),_0xb64926));var _0x3af7b0=this['channel'][_0x0bd5('0x111')](_0xb64926,_0x277363['intKey']);try{fs[_0x0bd5('0x135')](_0xb64926+_0x0bd5('0x136'));}catch(_0x41adb7){logger[_0x0bd5('0x2e')](_0x41adb7);}return _0x3af7b0;}return this['channel'][_0x0bd5('0x2e')](_0x277363,_0x0bd5('0x164'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x165')]=function(_0x357f6c){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x166'),_0x357f6c[_0x0bd5('0xaf')]));if(!this['isConfigured'](_0x357f6c[_0x0bd5('0x167')])){return this[_0x0bd5('0xd')]['error'](_0x357f6c,_0x0bd5('0x168'));}logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x169'),this[_0x0bd5('0xd')]['callerid'],_0x357f6c['findBy']));var _0x3017d9=this[_0x0bd5('0x55')]['sync'](this,_0x357f6c[_0x0bd5('0x167')]);if(_0x3017d9){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x16a'),this['channel'][_0x0bd5('0x3a')],_0x357f6c['findBy']));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x16a'),this[_0x0bd5('0xd')]['callerid'],_0x357f6c[_0x0bd5('0x167')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x16b'),this[_0x0bd5('0xd')]['callerid'],_0x357f6c[_0x0bd5('0x167')]));this['channel'][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x16b'),this['channel']['callerid'],_0x357f6c['findBy']));return{'code':0xc8,'result':_0x0bd5('0x16c')};}};AGIVertices[_0x0bd5('0xf')]['logout']=function(_0x43c805){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x43c805[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x43c805[_0x0bd5('0x167')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x43c805,_0x0bd5('0x168'));}logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x169'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x43c805[_0x0bd5('0x167')]));var _0x145e75=this['agentLogout'][_0x0bd5('0x72')](this,_0x43c805['findBy']);if(_0x145e75){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x16a'),this['channel'][_0x0bd5('0x3a')],_0x43c805[_0x0bd5('0x167')]));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x16a'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x43c805[_0x0bd5('0x167')]));return{'code':0xc8,'result':_0x0bd5('0x16d')};}else{logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x16b'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x43c805['findBy']));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x16b'),this['channel'][_0x0bd5('0x3a')],_0x43c805['findBy']));return{'code':0xc8,'result':_0x0bd5('0x16c')};}};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x16e')]=function(_0x3f907d){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x16f'),_0x3f907d['label']));if(!this[_0x0bd5('0xaa')](_0x3f907d[_0x0bd5('0x170')])){return this['channel'][_0x0bd5('0x2e')](_0x3f907d,'no\x20operation\x20configured');}this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x171'),_0x3f907d['operation']));var _0x171751=eval(_0x3f907d[_0x0bd5('0x170')]);if(!this[_0x0bd5('0xaa')](_0x3f907d[_0x0bd5('0xe4')])){return this['channel'][_0x0bd5('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1bf149=this[_0x0bd5('0xa4')][_0x0bd5('0x72')](this,_0x3f907d[_0x0bd5('0xe4')]);if(!_0x1bf149){return this['channel'][_0x0bd5('0x2e')](_0x3f907d,_0x0bd5('0xe6'));}if(_[_0x0bd5('0x9e')](_0x171751)){var _0x7109de=this;_0x171751[_0x0bd5('0xe7')](function(_0x4213e9,_0x406e53){_0x7109de['channel'][_0x0bd5('0xa9')](util['format'](_0x0bd5('0x172'),_0x1bf149,_0x406e53),_0x4213e9);});return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x173'),_0x1bf149));}else{return this[_0x0bd5('0xd')][_0x0bd5('0xa9')](_0x1bf149,_0x171751);}};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xb')]=function(_0x536b9f){logger['info'](util['format'](_0x0bd5('0x174'),_0x536b9f[_0x0bd5('0xaf')]));if(_0x536b9f[_0x0bd5('0xac')]===0x0){return this[_0x0bd5('0xab')](_0x536b9f);}_0x536b9f['retry']-=0x1;if(!this[_0x0bd5('0xaa')](_0x536b9f[_0x0bd5('0x122')])){return this['channel'][_0x0bd5('0x2e')](_0x536b9f,_0x0bd5('0x123'));}var _0x2a2059=this[_0x0bd5('0x1e')]['sync'](this,_0x536b9f[_0x0bd5('0x122')]);if(!_0x2a2059){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x536b9f,'no\x20file\x20audio\x20found');}var _0x1f6463=this[_0x0bd5('0xd')]['getData'](_0x2a2059,_0x536b9f[_0x0bd5('0x126')],_0x536b9f['digit']);var _0x3e3704=_0x1f6463[_0x0bd5('0xa7')];if(_0x1f6463[_0x0bd5('0xa7')]===-0x1){this['createSquareDetailsReport'][_0x0bd5('0x72')](this,_0x536b9f,'-1');return _0x1f6463;}else if(_0x1f6463[_0x0bd5('0xa5')]===_0x0bd5('0x68')){_0x1f6463[_0x0bd5('0xa7')]=_0x1f6463['result'][_0x0bd5('0xa1')]>0x0?_0x1f6463[_0x0bd5('0xa7')]:'t';}else if(_[_0x0bd5('0x48')](_0x1f6463[_0x0bd5('0xa7')])){_0x1f6463[_0x0bd5('0xa7')]='#';_0x3e3704='#';}if(!this['isConfigured'](_0x536b9f[_0x0bd5('0xe4')])){this[_0x0bd5('0xd')][_0x0bd5('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4bec93=this['getVariable'][_0x0bd5('0x72')](this,_0x536b9f[_0x0bd5('0xe4')]);if(!_0x4bec93){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x536b9f,_0x0bd5('0xe6'));}this['channel'][_0x0bd5('0xa9')](_0x4bec93,_0x3e3704);}this[_0x0bd5('0x39')]['sync'](this,_0x536b9f,_0x3e3704);return _0x1f6463;};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0xb0')]=function(_0x12d23d){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x175'),_0x12d23d['label']));return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x12d23d[_0x0bd5('0x176')]||_0x12d23d['label']);};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x177')]=function(_0x4b91aa){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x178'),_0x4b91aa[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x4b91aa['findBy'])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x4b91aa,_0x0bd5('0x168'));}logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x169'),this[_0x0bd5('0xd')]['callerid'],_0x4b91aa[_0x0bd5('0x167')]));var _0x2b99b6=this[_0x0bd5('0x4f')]['sync'](this,_0x4b91aa[_0x0bd5('0x179')]);var _0x23e35a=this[_0x0bd5('0x51')][_0x0bd5('0x72')](this,_0x4b91aa[_0x0bd5('0x167')],_0x2b99b6);if(_0x23e35a){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x16a'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x4b91aa[_0x0bd5('0x167')]));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x4b91aa[_0x0bd5('0x167')]));return{'code':0xc8,'result':_0x0bd5('0x16d')};}else{logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x16b'),this[_0x0bd5('0xd')]['callerid'],_0x4b91aa[_0x0bd5('0x167')]));this['channel'][_0x0bd5('0xb0')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0bd5('0x3a')],_0x4b91aa['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0bd5('0xf')]['playback']=function(_0x3d96fc){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3d96fc['label']));if(!this[_0x0bd5('0xaa')](_0x3d96fc['file_id'])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x3d96fc,'no\x20file\x20audio\x20selected');}var _0x4b3285=this[_0x0bd5('0x1e')][_0x0bd5('0x72')](this,_0x3d96fc[_0x0bd5('0x122')]);if(!_0x4b3285){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x3d96fc,_0x0bd5('0x124'));}var _0x1504e5=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0x17a'),[_0x4b3285,_0x3d96fc[_0x0bd5('0x11e')]]);if(_0x1504e5['result']===-0x1){return _0x1504e5;}return this[_0x0bd5('0xd')]['noop'](util[_0x0bd5('0x2a')](_0x0bd5('0xce'),'PLAYBACK',_0x4b3285));};AGIVertices['prototype']['queue']=function(_0x465452){logger['info'](util[_0x0bd5('0x2a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x465452[_0x0bd5('0xaf')]));if(!this['isConfigured'](_0x465452['queue_id'])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x465452,_0x0bd5('0x17b'));}var _0x316e4c='';var _0x4edadd=parseInt(_0x465452[_0x0bd5('0x17c')],0xa);if(isNaN(_0x4edadd)){_0x316e4c=_0x465452[_0x0bd5('0x17c')];}else{_0x316e4c=this[_0x0bd5('0x13')][_0x0bd5('0x72')](this,_0x465452['queue_id']);if(!_0x316e4c){return this[_0x0bd5('0xd')]['error'](_0x465452,'no\x20queue\x20found');}}var _0x4010d7='';if(this[_0x0bd5('0xaa')](_0x465452['file_id'])){var _0x31beee=this[_0x0bd5('0x1e')][_0x0bd5('0x72')](this,_0x465452[_0x0bd5('0x122')]);if(_0x31beee){_0x4010d7=_0x31beee;}}this[_0x0bd5('0x39')]['sync'](this,_0x465452,_0x316e4c);if(_0x465452[_0x0bd5('0x11e')]['indexOf']('x')<0x0){_0x465452['opts']+='x';}if(_0x465452['opts'][_0x0bd5('0x17d')]('X')<0x0){_0x465452[_0x0bd5('0x11e')]+='X';}this[_0x0bd5('0xd')][_0x0bd5('0xa9')](_0x0bd5('0x17e'),_0x316e4c?_0x316e4c['toLowerCase']():'');var _0x1a22db=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0x17f'),[_0x316e4c,_0x465452[_0x0bd5('0x11e')],_0x465452[_0x0bd5('0x67')],_0x4010d7,_0x465452[_0x0bd5('0x68')],_0x465452[_0x0bd5('0xbc')],_0x465452[_0x0bd5('0x180')],_0x465452[_0x0bd5('0x181')],'',_0x465452[_0x0bd5('0x182')]]);if(_0x1a22db['result']===-0x1){return _0x1a22db;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xce'),_0x0bd5('0x17f'),_0x316e4c));};AGIVertices[_0x0bd5('0xf')]['record']=function(_0x28d03a){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x183'),_0x28d03a[_0x0bd5('0xaf')]));var _0x4655f1=_0x28d03a[_0x0bd5('0x184')]||_0x0bd5('0x141');var _0x5ba2ec=util[_0x0bd5('0x2a')](_0x0bd5('0x185'),this[_0x0bd5('0xd')][_0x0bd5('0x3c')],rs[_0x0bd5('0x12b')](0x5));var _0x4e77c9=util[_0x0bd5('0x2a')](_0x0bd5('0x186'),FILES_PATH,_0x5ba2ec,_0x4655f1);var _0x38f391=util[_0x0bd5('0x2a')]('%s/recordings/%s',FILES_PATH,_0x5ba2ec);this[_0x0bd5('0x3b')][_0x0bd5('0x72')](this,_0x28d03a,_0x5ba2ec,_0x4e77c9);this[_0x0bd5('0xd')][_0x0bd5('0xa9')](_0x0bd5('0x187'),_0x5ba2ec);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x38f391,_0x4655f1,_0x28d03a[_0x0bd5('0x188')],_0x28d03a[_0x0bd5('0x68')]);return this[_0x0bd5('0xd')]['recordFile'](_0x38f391,_0x4655f1,_0x28d03a[_0x0bd5('0x188')],_0x28d03a[_0x0bd5('0x68')],undefined,!![]);};AGIVertices[_0x0bd5('0xf')]['restapi']=function(_0xb556c6){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x189'),_0xb556c6[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0xb556c6['url'])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x18a'));}var _0x3c45bf=this[_0x0bd5('0x66')][_0x0bd5('0x72')](this,_0xb556c6);logger['info'](util[_0x0bd5('0x2a')]('Response:',util[_0x0bd5('0x18b')](_0x3c45bf,{'showHidden':![],'depth':null})));if(!this[_0x0bd5('0xaa')](_0xb556c6[_0x0bd5('0xe4')])){return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0x18c'));}var _0x118a01=this[_0x0bd5('0xa4')][_0x0bd5('0x72')](this,_0xb556c6[_0x0bd5('0xe4')]);if(!_0x118a01){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0xb556c6,_0x0bd5('0xe6'));}this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util['format'](_0x0bd5('0x18d'),_0x118a01),_0x3c45bf[_0x0bd5('0x18e')]?_0x3c45bf[_0x0bd5('0x18e')]:_0x0bd5('0x18f'));this[_0x0bd5('0xd')][_0x0bd5('0xa9')](util['format'](_0x0bd5('0x190'),_0x118a01),_0x3c45bf[_0x0bd5('0x191')]?_0x3c45bf[_0x0bd5('0x191')]:'OK');if(_0x3c45bf[_0x0bd5('0x6d')]){try{this[_0x0bd5('0x9f')](_0x3c45bf['body'],_0x118a01);}catch(_0x2be7e2){logger[_0x0bd5('0x2e')](util[_0x0bd5('0x2a')](_0x0bd5('0x192'),_0x118a01));}}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0xeb'),_0x118a01));};AGIVertices[_0x0bd5('0xf')]['saydigits']=function(_0x23bfb7){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x193'),_0x23bfb7['label']));return this[_0x0bd5('0xd')][_0x0bd5('0x194')](_0x23bfb7['digits']['replace'](/\s+/g,''),_0x23bfb7[_0x0bd5('0x188')]);};AGIVertices[_0x0bd5('0xf')]['saynumber']=function(_0x497cdf){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x195'),_0x497cdf['label']));return this[_0x0bd5('0xd')]['sayNumber'](_0x497cdf['number'][_0x0bd5('0x5b')](/\s+/g,''),_0x497cdf[_0x0bd5('0x188')]);};AGIVertices[_0x0bd5('0xf')]['sayphonetic']=function(_0x4cbb81){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x196'),_0x4cbb81[_0x0bd5('0xaf')]));return this[_0x0bd5('0xd')]['sayPhonetic'](_0x4cbb81[_0x0bd5('0x5d')],_0x4cbb81[_0x0bd5('0x188')]);};AGIVertices[_0x0bd5('0xf')]['sendMail']=function(_0x1827f9){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x197'),_0x1827f9['label']));if(!this[_0x0bd5('0xaa')](_0x1827f9[_0x0bd5('0x198')])){return this['channel'][_0x0bd5('0xb0')](_0x0bd5('0x199'));}var _0x14dbae=this[_0x0bd5('0x22')][_0x0bd5('0x72')](this,_0x1827f9[_0x0bd5('0x198')]);if(!_0x14dbae||!_0x14dbae[_0x0bd5('0x19a')]){return this[_0x0bd5('0xd')]['error'](_0x1827f9,_0x0bd5('0x19b'));}var _0x41215a={'from':util[_0x0bd5('0x2a')](_0x0bd5('0x19c'),_0x14dbae['name'],_0x14dbae[_0x0bd5('0x19d')]||_0x14dbae['Smtp']['user']),'to':_0x1827f9['to']||'','cc':_0x1827f9['cc']||'','bcc':_0x1827f9['bcc']||'','subject':_0x1827f9['subject'],'html':_0x1827f9[_0x0bd5('0x5d')],'text':_0x1827f9[_0x0bd5('0x5d')]};if(this[_0x0bd5('0xaa')](_0x1827f9[_0x0bd5('0x19e')])){}logger[_0x0bd5('0xed')](_0x0bd5('0x19f'),JSON[_0x0bd5('0x75')](_0x41215a));this[_0x0bd5('0x39')][_0x0bd5('0x72')](this,_0x1827f9,_0x1827f9[_0x0bd5('0x198')]);this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x1a0'),_0x14dbae[_0x0bd5('0x16')]));this['sendMailMessage'][_0x0bd5('0x72')](this,_0x14dbae[_0x0bd5('0x1a1')],_0x41215a);return this['channel'][_0x0bd5('0xb0')](_0x0bd5('0x1a2'));};AGIVertices[_0x0bd5('0xf')]['sendFax']=function(_0x1d1b6f){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x1a3'),_0x1d1b6f[_0x0bd5('0xaf')]));return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x1a4'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1a5')]=function(_0x23ce8c){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x23ce8c['label']));if(!this[_0x0bd5('0xaa')](_0x23ce8c['sms_account_id'])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x1a6'));}var _0x3f0cd7=this[_0x0bd5('0x36')][_0x0bd5('0x72')](this,_0x23ce8c[_0x0bd5('0x1a7')]);if(!_0x3f0cd7){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x23ce8c,_0x0bd5('0x1a8'));}var _0x42dd38={'body':_0x23ce8c[_0x0bd5('0x1a9')],'phone':_0x23ce8c['to']||'','SmsAccountId':_0x3f0cd7['id']};logger[_0x0bd5('0xed')]('sendSMS\x20message',JSON['stringify'](_0x42dd38));this[_0x0bd5('0x39')][_0x0bd5('0x72')](this,_0x23ce8c,_0x23ce8c[_0x0bd5('0x1a7')]);this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x1aa'),_0x3f0cd7['name']));this[_0x0bd5('0x38')][_0x0bd5('0x72')](this,_0x42dd38);return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x1ab'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1ac')]=function(_0x15add0){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x15add0[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x15add0[_0x0bd5('0xe4')])){return this[_0x0bd5('0xd')]['error'](_0x15add0,_0x0bd5('0x1ad'));}var _0x536880=this[_0x0bd5('0xa4')][_0x0bd5('0x72')](this,_0x15add0[_0x0bd5('0xe4')]);if(!_0x536880){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x15add0,_0x0bd5('0xe6'));}return this['channel'][_0x0bd5('0xa9')](_0x536880,_0x15add0['variable_value']);};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1ae')]=function(_0x3a412b){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x1af'),_0x3a412b['label']));this[_0x0bd5('0xd')][_0x0bd5('0xb0')]('START\x20CALLY\x20SQUARE');var _0x41b6df=this['channel'][_0x0bd5('0xa4')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x41b6df[_0x0bd5('0xa5')])){this[_0x0bd5('0xd')][_0x0bd5('0x3c')]=_0x41b6df[_0x0bd5('0xa5')];}if(_0x3a412b[_0x0bd5('0xc0')]===_0x0bd5('0x1b0')){this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x1b1'));return this[_0x0bd5('0xd')]['answer']();}return this[_0x0bd5('0xd')]['noop'](_0x0bd5('0x1b2'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1b3')]=function(_0x282953){logger['info'](util[_0x0bd5('0x2a')](_0x0bd5('0x1b4'),_0x282953['label']));if(!this[_0x0bd5('0xaa')](_0x282953['project_id'])){return this[_0x0bd5('0xd')]['error'](_0x282953,_0x0bd5('0x1b5'));}var _0x3c24d2=this['getSquareProject'][_0x0bd5('0x72')](this,_0x282953['project_id']);if(!this['isConfigured'](_0x3c24d2)){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x282953,util['format'](_0x0bd5('0x1b6'),_0x282953[_0x0bd5('0x1b7')]));}if(_0x3c24d2===this[_0x0bd5('0xd')]['arg_1']){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x282953,_0x0bd5('0x1b8'));}this['createSquareDetailsReport']['sync'](this,_0x282953,_0x3c24d2);var _0xdb0a02=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0x1b9'),util[_0x0bd5('0x2a')](_0x0bd5('0x1ba'),config[_0x0bd5('0xbc')]['host']||_0x0bd5('0x1bb'),_0x3c24d2,this[_0x0bd5('0xd')][_0x0bd5('0x43')]));if(_0xdb0a02['result']===-0x1){return _0xdb0a02;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')]('Executed\x20command\x20%s\x20%s',_0x0bd5('0x1b9'),_0x3c24d2));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1bc')]=function(_0x3797c2){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x1bd'),_0x3797c2[_0x0bd5('0xaf')]));var _0x50d6d4=this[_0x0bd5('0x59')]['sync'](this,_0x3797c2['command']);this['createSquareDetailsReport'][_0x0bd5('0x72')](this,_0x3797c2,_0x3797c2[_0x0bd5('0xbe')]);if(this[_0x0bd5('0xaa')](_0x3797c2[_0x0bd5('0xe4')])){var _0xa4bc74=this[_0x0bd5('0xa4')]['sync'](this,_0x3797c2[_0x0bd5('0xe4')]);if(_0xa4bc74){this[_0x0bd5('0xd')][_0x0bd5('0xa9')](_0xa4bc74,_0x50d6d4);return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x1be'),_0x3797c2[_0x0bd5('0xbe')],_0xa4bc74));}}return this['channel'][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x1bf'),_0x3797c2[_0x0bd5('0xbe')]));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1c0')]=function(_0xf92b03){logger['info'](util['format'](_0x0bd5('0x1c1'),_0xf92b03[_0x0bd5('0xaf')]));_0xf92b03[_0x0bd5('0x5d')]=_0xf92b03[_0x0bd5('0x5d')][_0x0bd5('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0bd5('0xaa')](_0xf92b03[_0x0bd5('0x5c')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0x1c2'));}if(!this[_0x0bd5('0xaa')](_0xf92b03[_0x0bd5('0x5d')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x1c3'),_0xf92b03[_0x0bd5('0x5d')]));var _0x452a90=this['googleCloudTTS'][_0x0bd5('0x72')](this,_0xf92b03);if(_0x452a90){this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x1c4'),_0x452a90));var _0x3ba9eb=this['channel'][_0x0bd5('0x111')](_0x452a90);try{fs[_0x0bd5('0x135')](_0x452a90+_0x0bd5('0x136'));}catch(_0x2aae79){logger[_0x0bd5('0x2e')](_0x2aae79);}return _0x3ba9eb;}return this[_0x0bd5('0xd')]['error'](_0xf92b03,_0x0bd5('0x1c5'));};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1c6')]=function(_0x27cdf0){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x1c7'),_0x27cdf0[_0x0bd5('0xaf')]));_0x27cdf0[_0x0bd5('0x5d')]=_0x27cdf0[_0x0bd5('0x5d')][_0x0bd5('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0bd5('0xaa')](_0x27cdf0[_0x0bd5('0x5d')])){return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](_0x0bd5('0xb1'));}this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x1c8'),_0x27cdf0[_0x0bd5('0x5d')]));var _0x3f8b2f=this[_0x0bd5('0x64')]['sync'](this,_0x27cdf0);if(_0x3f8b2f){this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x1c9'),_0x3f8b2f));var _0x75e291=this['channel'][_0x0bd5('0x111')](_0x3f8b2f);try{fs[_0x0bd5('0x135')](_0x3f8b2f+'.wav');}catch(_0x4c23a4){logger[_0x0bd5('0x2e')](_0x4c23a4);}return _0x75e291;}return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x27cdf0,_0x0bd5('0x1ca'));};AGIVertices['prototype'][_0x0bd5('0x1cb')]=function(_0x1685b4){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1685b4[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x1685b4[_0x0bd5('0x167')])){return this[_0x0bd5('0xd')][_0x0bd5('0x2e')](_0x1685b4,_0x0bd5('0x168'));}logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x169'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x1685b4[_0x0bd5('0x167')]));var _0x2e3f18=this[_0x0bd5('0x53')][_0x0bd5('0x72')](this,_0x1685b4[_0x0bd5('0x167')]);if(_0x2e3f18){logger[_0x0bd5('0x30')](util['format'](_0x0bd5('0x16a'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x1685b4[_0x0bd5('0x167')]));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util['format'](_0x0bd5('0x16a'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x1685b4[_0x0bd5('0x167')]));return{'code':0xc8,'result':_0x0bd5('0x16d')};}else{logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0bd5('0x3a')],_0x1685b4[_0x0bd5('0x167')]));this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0x16b'),this[_0x0bd5('0xd')][_0x0bd5('0x3a')],_0x1685b4['findBy']));return{'code':0xc8,'result':_0x0bd5('0x16c')};}};AGIVertices[_0x0bd5('0xf')][_0x0bd5('0x1cc')]=function(_0x50911a){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x50911a[_0x0bd5('0xaf')]));var _0x2f083b=this[_0x0bd5('0xd')][_0x0bd5('0x5a')](_0x0bd5('0x1cd'),[_0x50911a[_0x0bd5('0x1ce')],_0x50911a[_0x0bd5('0x79')]]);if(_0x2f083b['result']===-0x1){return _0x2f083b;}return this[_0x0bd5('0xd')][_0x0bd5('0xb0')](util[_0x0bd5('0x2a')](_0x0bd5('0xce'),_0x0bd5('0x1cd'),_0x50911a[_0x0bd5('0x1ce')]));};AGIVertices[_0x0bd5('0xf')]['vswitch']=function(_0x31e58e){logger[_0x0bd5('0x30')](util[_0x0bd5('0x2a')](_0x0bd5('0x1cf'),_0x31e58e[_0x0bd5('0xaf')]));if(!this[_0x0bd5('0xaa')](_0x31e58e['variable_id'])){return this[_0x0bd5('0xd')]['error'](_0x31e58e,_0x0bd5('0x1ad'));}var _0x49077c=this[_0x0bd5('0xa4')][_0x0bd5('0x72')](this,_0x31e58e[_0x0bd5('0xe4')]);if(!_0x49077c){return this[_0x0bd5('0xd')]['error'](_0x31e58e,_0x0bd5('0xe6'));}var _0x161c39=this[_0x0bd5('0xd')][_0x0bd5('0xa4')](_0x49077c);return{'code':0xc8,'result':_0x161c39[_0x0bd5('0xa5')]?_0x161c39[_0x0bd5('0xa5')]:'-'};};String[_0x0bd5('0xf')][_0x0bd5('0xa3')]=function(_0x6d1308,_0x1c8003){return this['split'](_0x6d1308)[_0x0bd5('0x1d0')](_0x1c8003);};module[_0x0bd5('0x1d1')]=AGIVertices; \ No newline at end of file +var _0xb43b=['no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','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\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sendMail','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','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','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','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','catch','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','POST','PUT','method','toUpperCase','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','key','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','clear','includes','clone','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','saveRestApiResult','isEmpty','%s.%s','isArray','length','split','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','setVariable','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb43b,0xbf));var _0xbb43=function(_0x4d7d7e,_0x222d07){_0x4d7d7e=_0x4d7d7e-0x0;var _0x51b030=_0xb43b[_0x4d7d7e];return _0x51b030;};'use strict';var fs=require('fs');var util=require(_0xbb43('0x0'));var _=require('lodash');var sh=require(_0xbb43('0x1'));var odbc=require(_0xbb43('0x2'))();var rs=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var Mustache=require(_0xbb43('0x5'));var rp=require(_0xbb43('0x6'));var logger=require(_0xbb43('0x7'))(_0xbb43('0x8'));var config=require(_0xbb43('0x9'));var scripts=require(_0xbb43('0xa'));var FILES_PATH=_0xbb43('0xb');var recursiveMapAttributes=['rawHeaders',_0xbb43('0xc')];var verticesWithRetry=['menu','getdigits',_0xbb43('0xd')];var AGIVertices=function(_0x120d67,_0x20ed03,_0x2239d8){this[_0xbb43('0xe')]=_0x120d67;this['rpc']=_0x20ed03;this[_0xbb43('0xf')]=_0x2239d8;};AGIVertices[_0xbb43('0x10')][_0xbb43('0x11')]=function(_0x2c28be,_0x5a4589){this[_0xbb43('0x12')][_0xbb43('0x13')](_0x2c28be)['then'](function(_0x516580){_0x5a4589(null,_0x516580?_0x516580['name']:![]);})[_0xbb43('0x14')](function(_0x5d0ccc){_0x5a4589(_0x5d0ccc);});};AGIVertices[_0xbb43('0x10')]['getVoiceQueue']=function(_0x2b0f1d,_0x217a4e){this[_0xbb43('0x12')][_0xbb43('0x15')](_0x2b0f1d)[_0xbb43('0x16')](function(_0x4f16d7){_0x217a4e(null,_0x4f16d7?_0x4f16d7[_0xbb43('0x17')]:![]);})['catch'](function(_0x199726){_0x217a4e(_0x199726);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x18')]=function(_0x10c91b,_0x3be44b){this[_0xbb43('0x12')][_0xbb43('0x19')](_0x10c91b)[_0xbb43('0x16')](function(_0x20b839){_0x3be44b(null,_0x20b839?_0x20b839[_0xbb43('0x17')]:![]);})[_0xbb43('0x14')](function(_0x4cb0b2){_0x3be44b(_0x4cb0b2);});};AGIVertices[_0xbb43('0x10')]['getSquareOdbc']=function(_0x44fd04,_0x5f4b4f){this[_0xbb43('0x12')][_0xbb43('0x1a')](_0x44fd04)['then'](function(_0x19c785){_0x5f4b4f(null,_0x19c785?_0x19c785[_0xbb43('0x1b')]:![]);})[_0xbb43('0x14')](function(_0x6f34d6){_0x5f4b4f(_0x6f34d6);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x1c')]=function(_0xee1084,_0x1e83cd){this[_0xbb43('0x12')][_0xbb43('0x1d')](_0xee1084)[_0xbb43('0x16')](function(_0x434ff5){_0x1e83cd(null,_0x434ff5?_0x434ff5[_0xbb43('0x17')]:![]);})[_0xbb43('0x14')](function(_0x500af4){_0x1e83cd(_0x500af4);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x1e')]=function(_0x54a9aa,_0x464b4a){this[_0xbb43('0x12')][_0xbb43('0x1f')](_0x54a9aa)['then'](function(_0x4ea4c5){_0x464b4a(null,_0x4ea4c5?_0x4ea4c5[_0xbb43('0x17')]:![]);})[_0xbb43('0x14')](function(_0x5b21b6){_0x464b4a(_0x5b21b6);});};AGIVertices['prototype'][_0xbb43('0x20')]=function(_0xb9fe3b,_0x268fb5){var _0x4bb859=this;this[_0xbb43('0x12')][_0xbb43('0x21')](_0xb9fe3b)[_0xbb43('0x16')](function(_0x1a6e2b){_0x268fb5(null,_0x1a6e2b?_0x4bb859['getSoundPath'](_0x1a6e2b[_0xbb43('0x22')]):![]);})[_0xbb43('0x14')](function(_0x821beb){_0x268fb5(_0x821beb);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x23')]=function(_0x41da98,_0x2860d8){this['rpc'][_0xbb43('0x24')](_0x41da98)[_0xbb43('0x16')](function(_0x3c46c6){_0x2860d8(null,_0x3c46c6?_0x3c46c6:![]);})['catch'](function(_0x359b25){_0x2860d8(_0x359b25);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x25')]=function(_0x168374,_0x2b3350,_0x2459a7){this[_0xbb43('0xf')][_0xbb43('0x25')](_0x168374,_0x2b3350)[_0xbb43('0x16')](function(){_0x2459a7(null);})['catch'](function(_0x5253a4){_0x2459a7(_0x5253a4);});};AGIVertices['prototype']['getIntervals']=function(_0x352249,_0x1186fd){this[_0xbb43('0x12')][_0xbb43('0x26')](_0x352249)[_0xbb43('0x16')](function(_0xa153c9){if(_0xa153c9){if(_0xa153c9[_0xbb43('0x27')]){_0x1186fd(null,[_0xa153c9[_0xbb43('0x28')]]);}else{_0x1186fd(null,_['map'](_0xa153c9[_0xbb43('0x29')],_0xbb43('0x28')));}}else{_0x1186fd(null,![]);}})[_0xbb43('0x14')](function(_0x5cbb05){_0x1186fd(_0x5cbb05);});};AGIVertices['prototype'][_0xbb43('0x2a')]=function(_0x42ae94){return util[_0xbb43('0x2b')](_0xbb43('0x2c'),FILES_PATH,_0x42ae94);};AGIVertices['prototype'][_0xbb43('0x2d')]=function(_0x4ab8e5,_0x3ba581,_0x10014c){odbc[_0xbb43('0x2e')](_0x4ab8e5,function(_0x181877){if(_0x181877){logger[_0xbb43('0x2f')](_0xbb43('0x30'),_0x181877);_0x10014c(_0x181877);}else{logger[_0xbb43('0x31')](_0xbb43('0x32'));odbc[_0xbb43('0x33')](_0x3ba581,function(_0xa48590,_0xfeaa38){if(_0xa48590){logger[_0xbb43('0x31')]('Error\x20executing\x20query\x20%s',_0x3ba581);_0x10014c(_0xa48590);}else{logger[_0xbb43('0x31')](_0xbb43('0x34'),_0x3ba581);odbc[_0xbb43('0x35')](function(_0x2db230){if(_0x2db230){logger[_0xbb43('0x2f')](_0xbb43('0x36'),_0x2db230);}_0x10014c(null,_0xfeaa38);});}});}});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x37')]=function(_0x92d7cf,_0x2d7de8){this[_0xbb43('0x12')][_0xbb43('0x38')](_0x92d7cf)[_0xbb43('0x16')](function(_0x3a3371){_0x2d7de8(null,_0x3a3371?_0x3a3371:![]);})[_0xbb43('0x14')](function(_0x4a76a8){_0x2d7de8(_0x4a76a8);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x39')]=function(_0x38af31,_0x1b5646){this[_0xbb43('0x12')][_0xbb43('0x39')](_0x38af31)['then'](function(_0x13e9f7){_0x1b5646(null,_0x13e9f7);})[_0xbb43('0x14')](function(_0x550dd6){_0x1b5646(_0x550dd6);});};AGIVertices['prototype'][_0xbb43('0x3a')]=function(_0x1eb63f,_0x26aa10,_0xa6aacb){this[_0xbb43('0x12')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xbb43('0x3b')],'node':_0x1eb63f[_0xbb43('0x3c')],'application':_0x1eb63f[_0xbb43('0x3d')],'data':_0x26aa10||null,'project_name':this[_0xbb43('0xe')][_0xbb43('0x3e')],'callerid':this[_0xbb43('0xe')][_0xbb43('0x3f')]})[_0xbb43('0x16')](function(_0x475e26){if(_0xa6aacb){_0xa6aacb(null,_0x475e26);}})[_0xbb43('0x14')](function(_0x5ec957){if(_0xa6aacb){_0xa6aacb(_0x5ec957);}});};AGIVertices['prototype'][_0xbb43('0x40')]=function(_0x31891b,_0x5aa780,_0x13eb0f,_0x1e4eff){this[_0xbb43('0x12')][_0xbb43('0x40')]({'uniqueid':this[_0xbb43('0xe')][_0xbb43('0x3b')],'callerid':this[_0xbb43('0xe')]['callerid'],'calleridname':this[_0xbb43('0xe')][_0xbb43('0x41')],'context':this['channel'][_0xbb43('0x42')],'extension':this[_0xbb43('0xe')]['extension'],'priority':this[_0xbb43('0xe')][_0xbb43('0x43')],'accountcode':this[_0xbb43('0xe')][_0xbb43('0x44')],'dnid':this[_0xbb43('0xe')][_0xbb43('0x45')],'projectName':this[_0xbb43('0xe')][_0xbb43('0x3e')],'saveName':_0x5aa780,'filename':_0x31891b[_0xbb43('0x46')]||_0x5aa780,'savePath':_0x13eb0f})[_0xbb43('0x16')](function(_0x38cc4d){_0x1e4eff(null,_0x38cc4d);})[_0xbb43('0x14')](function(_0x5a2694){_0x1e4eff(_0x5a2694);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x47')]=function(_0x50096a,_0x7089bb,_0x4ab63b,_0x33d21b,_0x4998fb){this[_0xbb43('0x12')]['createSquareMessage']({'uniqueid':this[_0xbb43('0xe')][_0xbb43('0x3b')],'body':_0x50096a,'direction':_0x7089bb,'providerName':_0x4ab63b,'providerResponse':_0x33d21b})[_0xbb43('0x16')](function(_0x535347){if(_0x4998fb){_0x4998fb(null,_0x535347);}})[_0xbb43('0x14')](function(_0x218da6){if(_0x4998fb){_0x4998fb(_0x218da6);}});};AGIVertices[_0xbb43('0x10')]['createCmContact']=function(_0xd485c7,_0x3b53b9){this['rpc'][_0xbb43('0x48')]({'firstName':_['isEmpty'](_0xd485c7[_0xbb43('0x17')])||_[_0xbb43('0x49')](_0xd485c7['name'])?_0xbb43('0x4a')+Math[_0xbb43('0x4b')]():_0xd485c7[_0xbb43('0x17')],'lastName':_['isEmpty'](_0xd485c7[_0xbb43('0x4c')])||_['isNil'](_0xd485c7[_0xbb43('0x4c')])?null:_0xd485c7[_0xbb43('0x4c')],'phone':_0xd485c7[_0xbb43('0x4d')],'ListId':_0xd485c7['list_id'],'scheduledat':_0xd485c7[_0xbb43('0x4e')],'callbackUniqueid':this[_0xbb43('0xe')]['uniqueid'],'tags':'callback','description':_0xbb43('0x4f')+_0xd485c7[_0xbb43('0x4e')]['toString'](),'priority':_0xd485c7['callback_priority']})[_0xbb43('0x16')](function(_0x51ca4f){_0x3b53b9(null,_0x51ca4f);})[_0xbb43('0x14')](function(_0x4664e3){_0x3b53b9(_0x4664e3);});};AGIVertices[_0xbb43('0x10')]['getPause']=function(_0x5978c9,_0x52ec91){this['rpc']['getPauseById'](_0x5978c9)[_0xbb43('0x16')](function(_0x31d265){_0x52ec91(null,_0x31d265?_0x31d265[_0xbb43('0x17')]:![]);})[_0xbb43('0x14')](function(_0xbf2f4d){_0x52ec91(_0xbf2f4d);});};AGIVertices['prototype'][_0xbb43('0x50')]=function(_0x529455,_0x6e7c04,_0x4b5e4b){var _0x2ad30b={'role':_0xbb43('0x51')};_0x2ad30b[_0x529455]=this[_0xbb43('0xe')][_0xbb43('0x3f')];this['rpc'][_0xbb43('0x50')](_0x2ad30b,_0x6e7c04,this['channel'][_0xbb43('0x3b')])[_0xbb43('0x16')](function(_0x512619){_0x4b5e4b(null,_[_0xbb43('0x49')](_0x512619)?![]:!![]);})[_0xbb43('0x14')](function(_0x5cde88){logger[_0xbb43('0x2f')](_0x5cde88);_0x4b5e4b(null,![]);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x52')]=function(_0x19987b,_0x41c915){var _0x42221e={'role':_0xbb43('0x51')};_0x42221e[_0x19987b]=this[_0xbb43('0xe')]['callerid'];this[_0xbb43('0x12')]['agentUnpause'](_0x42221e)[_0xbb43('0x16')](function(_0x2e70bf){_0x41c915(null,_['isNil'](_0x2e70bf)?![]:!![]);})[_0xbb43('0x14')](function(_0x2e49e2){logger[_0xbb43('0x2f')](_0x2e49e2);_0x41c915(null,![]);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x53')]=function(_0x88a62a,_0x1233ba){var _0x2274a1={'role':'agent'};_0x2274a1[_0x88a62a]=this[_0xbb43('0xe')][_0xbb43('0x3f')];this[_0xbb43('0x12')][_0xbb43('0x53')](_0x2274a1)['then'](function(_0x226f27){_0x1233ba(null,_['isNil'](_0x226f27)?![]:!![]);})[_0xbb43('0x14')](function(_0x5102fb){logger[_0xbb43('0x2f')](_0x5102fb);_0x1233ba(null,![]);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x54')]=function(_0x265d2d,_0x3b8363){var _0x43468e={'role':_0xbb43('0x51')};_0x43468e[_0x265d2d]=this[_0xbb43('0xe')][_0xbb43('0x3f')];var _0x32483f=_0x265d2d!='internal'?util[_0xbb43('0x2b')]('%s/%s@from-sip/n',_0xbb43('0x55'),this[_0xbb43('0xe')][_0xbb43('0x3f')]):undefined;this[_0xbb43('0x12')][_0xbb43('0x54')](_0x43468e,_0x32483f)[_0xbb43('0x16')](function(_0x238a86){_0x3b8363(null,_[_0xbb43('0x49')](_0x238a86)?![]:!![]);})['catch'](function(_0x405665){logger['error'](_0x405665);_0x3b8363(null,![]);});};AGIVertices['prototype'][_0xbb43('0x56')]=function(_0x4be7f7,_0x7b2e43){sh[_0xbb43('0x57')](_['trim'](_0x4be7f7),function(_0x221727,_0x347c53){var _0x52bd44=_0x347c53[_0xbb43('0x58')](/(\r\n|\n|\r)/gm,'');_0x7b2e43(null,_0x52bd44);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x59')]=function(_0x14678c,_0x40ac8c){scripts[_0xbb43('0x59')](_0x14678c[_0xbb43('0x5a')],_0x14678c[_0xbb43('0x5b')]||_0xbb43('0x5c'),_0x14678c[_0xbb43('0x5c')],_0x14678c[_0xbb43('0x5d')]||_0xbb43('0x5e'),_0x14678c[_0xbb43('0x5f')]||_0xbb43('0x60'),_0x14678c[_0xbb43('0x61')]||_0xbb43('0x62'))[_0xbb43('0x16')](function(_0x40ab00){_0x40ac8c(null,_0x40ab00);})[_0xbb43('0x14')](function(_0x21fc9d){_0x40ac8c(_0x21fc9d);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x63')]=function(_0x475740,_0x38ae0e){scripts[_0xbb43('0x63')](_0x475740[_0xbb43('0x5c')],_0x475740[_0xbb43('0x64')]||'en',0x1)[_0xbb43('0x16')](function(_0x422ba7){_0x38ae0e(null,_0x422ba7);})[_0xbb43('0x14')](function(_0x498089){_0x38ae0e(_0x498089);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x65')]=function(_0x1d178a,_0x146ebc){var _0x1b66ba={'uri':_0x1d178a[_0xbb43('0x66')],'method':_0x1d178a['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1d178a[_0xbb43('0x67')])===_0xbb43('0x68')&&parseInt(_0x1d178a['timeout'])>=0x1?parseInt(_0x1d178a['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xbb43('0x69'),_0xbb43('0x6a')],_0x1b66ba[_0xbb43('0x6b')][_0xbb43('0x6c')]())){try{_0x1b66ba['body']=_0x1d178a['rawBody']?JSON[_0xbb43('0x6d')](_0x1d178a['rawBody']):{};}catch(_0x308199){logger[_0xbb43('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x308199);}}try{_0x1b66ba[_0xbb43('0x6e')]=_0x1d178a[_0xbb43('0x6f')]?JSON[_0xbb43('0x6d')](_0x1d178a['rawHeaders']):{};}catch(_0x3374a8){logger['error'](_0xbb43('0x70'),_0x3374a8);}if(_0x1d178a[_0xbb43('0x71')]){try{var _0x4bd0d6=require(_0x1d178a[_0xbb43('0x71')])[_0xbb43('0x72')](this,_0x1b66ba);_0x1b66ba[_0xbb43('0x73')]=Mustache[_0xbb43('0x74')](_0x1d178a[_0xbb43('0x66')],_0x4bd0d6,{},['$$','$$']);if(_0x1b66ba['headers']){_0x1b66ba['headers']=JSON[_0xbb43('0x6d')](Mustache[_0xbb43('0x74')](JSON[_0xbb43('0x75')](_0x1b66ba[_0xbb43('0x6e')]),_0x4bd0d6,{},['$$','$$']));}if(_0x1b66ba[_0xbb43('0x76')]){_0x1b66ba[_0xbb43('0x76')]=JSON[_0xbb43('0x6d')](Mustache[_0xbb43('0x74')](JSON['stringify'](_0x1b66ba[_0xbb43('0x76')]),_0x4bd0d6,{},['$$','$$']));}}catch(_0x4f613a){logger[_0xbb43('0x2f')](_0xbb43('0x77'),_0x4f613a);}}rp(_0x1b66ba)['then'](function(_0x371a7c){var _0x1ba677={'statusCode':_0x371a7c[_0xbb43('0x78')]||0xc8,'statusMessage':_0x371a7c[_0xbb43('0x79')]||'OK','headers':_0x371a7c[_0xbb43('0x6e')]||{},'body':_0x371a7c[_0xbb43('0x76')]||{}};_0x146ebc(null,_0x1ba677);})['catch'](function(_0x3d0182){var _0x2d18e7={'statusCode':_0x3d0182['statusCode']||0x1f4,'statusMessage':_0x3d0182[_0xbb43('0x7a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x3d0182[_0xbb43('0x7b')][_0xbb43('0x6e')]||{},'body':_0x3d0182[_0xbb43('0x7b')][_0xbb43('0x76')]||{}};_0x146ebc(null,_0x2d18e7);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x7c')]=function(_0x339552,_0x2042a4){scripts[_0xbb43('0x7c')](this[_0xbb43('0xe')][_0xbb43('0x3b')],_0x339552['key'],_0x339552[_0xbb43('0x5c')],_0x339552['dialogflow_language']||'en')[_0xbb43('0x16')](function(_0x41e4a8){_0x2042a4(null,_0x41e4a8);})[_0xbb43('0x14')](function(_0x21bea1){_0x2042a4(_0x21bea1);});};AGIVertices[_0xbb43('0x10')]['googleDialogflowV2']=function(_0x10498d,_0x22add9){scripts[_0xbb43('0x7d')](this[_0xbb43('0xe')][_0xbb43('0x3b')],_0x10498d['dialogflowV2_project_id'],_0x10498d[_0xbb43('0x7e')],_0x10498d['private_key'],_0x10498d[_0xbb43('0x5c')],_0x10498d[_0xbb43('0x7f')]||'en')[_0xbb43('0x16')](function(_0x1c611d){_0x22add9(null,_0x1c611d);})[_0xbb43('0x14')](function(_0x5b2803){_0x22add9(_0x5b2803);});};AGIVertices[_0xbb43('0x10')]['sestekNDA']=function(_0x6c9702,_0x56e9c1){scripts[_0xbb43('0x80')](this['channel'],_0x6c9702)[_0xbb43('0x16')](function(_0x37cf8e){_0x56e9c1(null,_0x37cf8e);})[_0xbb43('0x14')](function(_0x5f15f8){_0x56e9c1(_0x5f15f8);});};AGIVertices[_0xbb43('0x10')]['ispeechTTS']=function(_0xf95ccf,_0xacc0da){scripts['ispeechTTS'](_0xf95ccf[_0xbb43('0x81')],_0xf95ccf[_0xbb43('0x5c')],_0xf95ccf[_0xbb43('0x82')]||_0xbb43('0x5e'),_0xf95ccf['speed'])[_0xbb43('0x16')](function(_0x37eee1){_0xacc0da(null,_0x37eee1);})['catch'](function(_0x569ad2){_0xacc0da(_0x569ad2);});};AGIVertices['prototype'][_0xbb43('0x83')]=function(_0x57dd9a,_0x18830e,_0x1734b0){scripts[_0xbb43('0x83')](_0x18830e,_0x57dd9a['key'],_0x57dd9a['ispeech_asr_language']||_0xbb43('0x5e'),this[_0xbb43('0x84')](_0x57dd9a[_0xbb43('0x85')])?_0x57dd9a[_0xbb43('0x85')]:undefined)['then'](function(_0x44841f){_0x1734b0(null,_0x44841f);})[_0xbb43('0x14')](function(_0x2ea427){_0x1734b0(_0x2ea427);});};AGIVertices['prototype'][_0xbb43('0x86')]=function(_0xc9623,_0x75999e){scripts[_0xbb43('0x86')](_0xc9623[_0xbb43('0x87')],_0xc9623['aws_secret_access_key'],_0xc9623[_0xbb43('0x88')],_0xc9623['aws_polly_voice']||_0xbb43('0x89'),_0xc9623[_0xbb43('0x5c')],_0xc9623[_0xbb43('0x8a')]||_0xbb43('0x5c'))['then'](function(_0x3174ea){_0x75999e(null,_0x3174ea);})['catch'](function(_0x265bdd){_0x75999e(_0x265bdd);});};AGIVertices[_0xbb43('0x10')]['awsLex']=function(_0x2721fc,_0x40e57e){scripts[_0xbb43('0x8b')](this[_0xbb43('0xe')]['uniqueid'],_0x2721fc['aws_access_key_id'],_0x2721fc['aws_secret_access_key'],_0x2721fc[_0xbb43('0x8c')],_0x2721fc[_0xbb43('0x5c')],_0x2721fc['aws_bot_name'])[_0xbb43('0x16')](function(_0x27db99){_0x40e57e(null,_0x27db99);})[_0xbb43('0x14')](function(_0x1966f4){_0x40e57e(_0x1966f4);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x8d')]=function(_0x6a0f62,_0xf3db56,_0x2cc676){scripts['googleASR'](_0xf3db56,_0x6a0f62[_0xbb43('0x81')],_0x6a0f62[_0xbb43('0x8e')]||_0xbb43('0x5e'))[_0xbb43('0x16')](function(_0x2a95cb){_0x2cc676(null,_0x2a95cb);})[_0xbb43('0x14')](function(_0x1d6eda){_0x2cc676(_0x1d6eda);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x8f')]=function(_0x5c152,_0x9edadf,_0x5e3539){scripts[_0xbb43('0x8f')](_0x9edadf,_0x5c152[_0xbb43('0x90')],_0x5c152['appsecret'],_0x5c152[_0xbb43('0x73')])[_0xbb43('0x16')](function(_0x13e255){_0x5e3539(null,_0x13e255);})['catch'](function(_0x58ba69){_0x5e3539(_0x58ba69);});};AGIVertices[_0xbb43('0x10')][_0xbb43('0x91')]=function(_0x3e6c48){var _0x187f44=_[_0xbb43('0x92')](verticesWithRetry,_0x3e6c48[_0xbb43('0x3d')])?_0x3e6c48:_[_0xbb43('0x93')](_0x3e6c48);for(var _0xebceea in _0x187f44){if(_0x187f44['hasOwnProperty'](_0xebceea)){if(_0x187f44[_0xebceea]&&_[_0xbb43('0x94')](_0x187f44[_0xebceea])){if(_[_0xbb43('0x92')](recursiveMapAttributes,_0xebceea)){_0x187f44[_0xebceea]=this[_0xbb43('0x95')](_0x187f44[_0xebceea]);}else{_0x187f44[_0xebceea]=this[_0xbb43('0x96')](_0x187f44[_0xebceea]);}}}}return _0x187f44;};AGIVertices[_0xbb43('0x10')]['recursiveNodeIndex']=function(_0x56934f){for(var _0x29f88e in _0x56934f){if(_0x56934f[_0xbb43('0x97')](_0x29f88e)){if(_[_0xbb43('0x98')](_0x56934f[_0x29f88e])){this[_0xbb43('0x99')](_0x56934f[_0x29f88e]);}else if(_['isArray'](_0x56934f[_0x29f88e])){for(var _0xb3e15d=0x0;_0xb3e15d<_0x56934f[_0x29f88e]['length'];_0xb3e15d++){this['recursiveNodeIndex'](_0x56934f[_0x29f88e][_0xb3e15d]);}}else if(_['isString'](_0x56934f[_0x29f88e])){_0x56934f[_0x29f88e]=this[_0xbb43('0x96')](_0x56934f[_0x29f88e]);}}}};AGIVertices[_0xbb43('0x10')][_0xbb43('0x9a')]=function(_0x49daa9,_0x31708a){for(var _0x12037a in _0x49daa9){if(_0x49daa9[_0xbb43('0x97')](_0x12037a)){if(_['isPlainObject'](_0x49daa9[_0x12037a])){if(!_[_0xbb43('0x9b')](_0x49daa9[_0x12037a])){this['saveRestApiResult'](_0x49daa9[_0x12037a],util[_0xbb43('0x2b')](_0xbb43('0x9c'),_0x31708a,_0x12037a));}}else if(_[_0xbb43('0x9d')](_0x49daa9[_0x12037a])){for(var _0x12ec48=0x0;_0x12ec48<_0x49daa9[_0x12037a][_0xbb43('0x9e')];_0x12ec48++){this['saveRestApiResult'](_0x49daa9[_0x12037a][_0x12ec48],util[_0xbb43('0x2b')](_0xbb43('0x9c'),_0x31708a,_0x12037a+'['+_0x12ec48+']'));}}else{if(!_['isNil'](_0x49daa9[_0x12037a])){this[_0xbb43('0xe')]['setVariable'](util['format'](_0xbb43('0x9c'),_0x31708a,_0x12037a),_0x49daa9[_0x12037a]);}}}}};AGIVertices['prototype'][_0xbb43('0x95')]=function(_0x2a7fcd){try{var _0x1d7bf2=JSON[_0xbb43('0x6d')](_0x2a7fcd);this['recursiveNodeIndex'](_0x1d7bf2);return JSON['stringify'](_0x1d7bf2);}catch(_0xef51b7){return this[_0xbb43('0x96')](_0x2a7fcd);}};AGIVertices[_0xbb43('0x10')][_0xbb43('0x96')]=function(_0x501743){var _0x883f34=_0x501743[_0xbb43('0x9f')]('{');for(var _0x2f3739=0x1;_0x2f3739<_0x883f34[_0xbb43('0x9e')];_0x2f3739+=0x1){var _0x49b282=_0x883f34[_0x2f3739][_0xbb43('0x9f')]('}');if(_0x49b282[_0xbb43('0x9e')]>0x1){_0x501743=_0x501743['replaceAll']('{'+_0x49b282[0x0]+'}',this[_0xbb43('0xe')]['getVariable'](_0x49b282[0x0])[_0xbb43('0xa0')]||_0x49b282[0x0]);}}if(_0x883f34[_0xbb43('0x9e')]===0x1){return _0x501743[_0xbb43('0xa1')]();}return this[_0xbb43('0x96')](_0x501743);};AGIVertices['prototype'][_0xbb43('0xa2')]=function(_0x3cf673,_0x45116a){var _0x3d1677=this[_0xbb43('0xe')][_0xbb43('0x11')](_0x3cf673);if(_0x3d1677['result']===-0x1){return _0x3d1677;}logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0xa3'),_0x45116a,_0x3d1677[_0xbb43('0xa0')]));return this[_0xbb43('0xe')]['setVariable'](_0x45116a,_0x3d1677[_0xbb43('0xa0')]);};AGIVertices[_0xbb43('0x10')][_0xbb43('0x84')]=function(_0x4b46bc){return _0x4b46bc&&_0x4b46bc!=='0'&&_0x4b46bc!=='-1'&&_0x4b46bc!=='';};AGIVertices[_0xbb43('0x10')][_0xbb43('0xa4')]=function(_0x2cffd0){this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x2cffd0,'-');_0x2cffd0[_0xbb43('0xa5')]=_0x2cffd0[_0xbb43('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbb43('0x10')][_0xbb43('0xa6')]=function(_0x18738a){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0xa7'),_0x18738a[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x18738a[_0xbb43('0x5c')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xa9'));}var _0x13f97e='\x22'+_0x18738a[_0xbb43('0x5c')]+'\x22';if(this['isConfigured'](_0x18738a[_0xbb43('0x7b')])){_0x13f97e+=','+_0x18738a[_0xbb43('0x7b')];}var _0x248a03=this[_0xbb43('0xe')][_0xbb43('0x57')]('MRCPSynth',_0x13f97e);if(_0x248a03[_0xbb43('0xaa')]===-0x1){return _0x248a03;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xab'),_0x13f97e));};AGIVertices['prototype']['mrcprecog']=function(_0x418984){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x418984['label']));if(!this['isConfigured'](_0x418984[_0xbb43('0xac')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0xad'));}var _0x9eb32c=_0x418984[_0xbb43('0xac')];if(this[_0xbb43('0x84')](_0x418984['options'])){_0x9eb32c+=','+_0x418984[_0xbb43('0x7b')];}var _0x445590=this[_0xbb43('0xe')][_0xbb43('0x57')](_0xbb43('0xae'),_0x9eb32c);if(_0x445590['result']===-0x1){return _0x445590;}var _0x132910=this[_0xbb43('0xa2')](_0xbb43('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x132910[_0xbb43('0xaa')]===-0x1){return _0x132910;}var _0x427abe=this[_0xbb43('0xa2')](_0xbb43('0xb0'),_0xbb43('0xb1'));if(_0x427abe[_0xbb43('0xaa')]===-0x1){return _0x427abe;}var _0x20face=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x20face[_0xbb43('0xaa')]===-0x1){return _0x20face;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xb2'),_0x9eb32c));};AGIVertices['prototype']['agi']=function(_0x1349e5){logger['info'](util[_0xbb43('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1349e5['label']));return this[_0xbb43('0xe')][_0xbb43('0x8')]([_0x1349e5['command'],_0x1349e5[_0xbb43('0xb3')]]);};AGIVertices['prototype'][_0xbb43('0xb4')]=function(_0x5b851f){logger['info'](util['format'](_0xbb43('0xb5'),_0x5b851f[_0xbb43('0x3c')]));if(this[_0xbb43('0x84')](_0x5b851f[_0xbb43('0x67')])){logger[_0xbb43('0x31')](util['format'](_0xbb43('0xb6'),_0x5b851f[_0xbb43('0x67')]));var _0x2560b3=this[_0xbb43('0xe')][_0xbb43('0xb7')](_0x5b851f[_0xbb43('0x67')]);if(_0x2560b3[_0xbb43('0xaa')]===-0x1){return _0x2560b3;}}return this['channel'][_0xbb43('0xb4')]();};AGIVertices['prototype'][_0xbb43('0xb8')]=function(_0x3c1a63){logger[_0xbb43('0x31')](util['format'](_0xbb43('0xb9'),_0x3c1a63[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x3c1a63['list_id'])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3c1a63,_0xbb43('0xba'));}_0x3c1a63[_0xbb43('0x4e')]=moment();if(this[_0xbb43('0x84')](_0x3c1a63['delay'])){_0x3c1a63[_0xbb43('0x4e')]=moment()['add'](_0x3c1a63[_0xbb43('0xbb')],_0xbb43('0xbc'));}if(!this[_0xbb43('0x84')](_0x3c1a63[_0xbb43('0xbd')])){_0x3c1a63[_0xbb43('0xbd')]=0x2;}this['createCmContact'][_0xbb43('0x72')](this,_0x3c1a63);return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xbe'),_0x3c1a63[_0xbb43('0x4d')],_0x3c1a63[_0xbb43('0xbf')],_0x3c1a63[_0xbb43('0x4e')]));};AGIVertices[_0xbb43('0x10')]['custom_app']=function(_0x401e7b){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x401e7b[_0xbb43('0x3c')]));var _0x2ed633=this[_0xbb43('0xe')][_0xbb43('0x57')](_0x401e7b[_0xbb43('0xc0')],_0x401e7b[_0xbb43('0x7b')]);if(_0x2ed633[_0xbb43('0xaa')]===-0x1){return _0x2ed633;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xc1'),_0x401e7b[_0xbb43('0xc0')],_0x401e7b[_0xbb43('0x7b')]));};AGIVertices[_0xbb43('0x10')][_0xbb43('0xc2')]=function(_0x23bb72){logger[_0xbb43('0x31')](util['format'](_0xbb43('0xc3'),_0x23bb72[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x23bb72['text'])){return this['channel'][_0xbb43('0xa8')](_0xbb43('0xa9'));}var _0x599d64='\x22'+_0x23bb72['text']+'\x22';if(this[_0xbb43('0x84')](_0x23bb72[_0xbb43('0x7b')])){_0x599d64+=','+_0x23bb72[_0xbb43('0x7b')];}var _0x16eff3=this[_0xbb43('0xe')]['exec'](_0xbb43('0xc4'),_0x599d64);if(_0x16eff3['result']===-0x1){return _0x16eff3;}return this['channel']['noop'](util[_0xbb43('0x2b')](_0xbb43('0xab'),_0x599d64));};AGIVertices['prototype'][_0xbb43('0xc5')]=function(_0x3244ed){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0xc6'),_0x3244ed['label']));if(!this[_0xbb43('0x84')](_0x3244ed[_0xbb43('0x5c')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')]('no\x20text\x20configured');}var _0x46f510='\x22'+_0x3244ed['text']+'\x22';if(this[_0xbb43('0x84')](_0x3244ed[_0xbb43('0x7b')])){_0x46f510+=','+_0x3244ed[_0xbb43('0x7b')];}var _0x45cb88=this[_0xbb43('0xe')][_0xbb43('0x57')](_0xbb43('0xc4'),_0x46f510);if(_0x45cb88[_0xbb43('0xaa')]===-0x1){return _0x45cb88;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xab'),_0x46f510));};AGIVertices[_0xbb43('0x10')][_0xbb43('0xc7')]=function(_0x3b4260){logger[_0xbb43('0x31')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3b4260[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x3b4260['grammar'])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xad'));}var _0x2f4e12=_0x3b4260[_0xbb43('0xac')];if(this['isConfigured'](_0x3b4260[_0xbb43('0x7b')])){_0x2f4e12+=','+_0x3b4260['options'];}var _0x4ea141=this[_0xbb43('0xe')]['exec'](_0xbb43('0xae'),_0x2f4e12);if(_0x4ea141['result']===-0x1){return _0x4ea141;}var _0x23ae87=this[_0xbb43('0xa2')](_0xbb43('0xaf'),_0xbb43('0xc8'));if(_0x23ae87['result']===-0x1){return _0x23ae87;}var _0xbf45fe=this[_0xbb43('0xa2')](_0xbb43('0xb0'),_0xbb43('0xc9'));if(_0xbf45fe['result']===-0x1){return _0xbf45fe;}var _0x31d732=this[_0xbb43('0xa2')](_0xbb43('0xca'),'LUMENVOX_ASR_INSTANCE');if(_0x31d732[_0xbb43('0xaa')]===-0x1){return _0x31d732;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xb2'),_0x2f4e12));};AGIVertices['prototype'][_0xbb43('0xcb')]=function(_0x5b3250){logger['info'](util[_0xbb43('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5b3250[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x5b3250[_0xbb43('0xac')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')]('no\x20grammar\x20configured');}var _0x28d33a=_0x5b3250[_0xbb43('0xac')];if(this['isConfigured'](_0x5b3250[_0xbb43('0x7b')])){_0x28d33a+=','+_0x5b3250[_0xbb43('0x7b')];}var _0x35ae97=this[_0xbb43('0xe')][_0xbb43('0x57')](_0xbb43('0xae'),_0x28d33a);if(_0x35ae97['result']===-0x1){return _0x35ae97;}var _0x42b8b0=this[_0xbb43('0xa2')](_0xbb43('0xaf'),_0xbb43('0xcc'));if(_0x42b8b0[_0xbb43('0xaa')]===-0x1){return _0x42b8b0;}var _0x3859d9=this[_0xbb43('0xa2')](_0xbb43('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0x3859d9[_0xbb43('0xaa')]===-0x1){return _0x3859d9;}var _0x1f7c11=this['getAndSetVariable'](_0xbb43('0xca'),_0xbb43('0xcd'));if(_0x1f7c11[_0xbb43('0xaa')]===-0x1){return _0x1f7c11;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xb2'),_0x28d33a));};AGIVertices[_0xbb43('0x10')][_0xbb43('0xce')]=function(_0x38a9de){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0xcf'),_0x38a9de['label']));if(!this[_0xbb43('0x84')](_0x38a9de[_0xbb43('0xd0')])){return this['channel'][_0xbb43('0x2f')](_0x38a9de,'no\x20database\x20selected');}var _0x39b390=this[_0xbb43('0xd1')][_0xbb43('0x72')](this,_0x38a9de[_0xbb43('0xd0')]);if(!_0x39b390){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x38a9de,_0xbb43('0xd2'));}if(!this[_0xbb43('0x84')](_0x38a9de[_0xbb43('0x33')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x38a9de,_0xbb43('0xd3'));}var _0x54fca4=_0x38a9de['query'][_0xbb43('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xbb43('0xe')]['noop'](util[_0xbb43('0x2b')]('query:\x20%s',_0x54fca4));var _0x4f440e=this['getQueryOdbc'][_0xbb43('0x72')](this,_0x39b390,_0x54fca4);this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x38a9de,_0x54fca4);if(!this[_0xbb43('0x84')](_0x38a9de[_0xbb43('0xd4')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xd5'));}var _0x4e8bda=this[_0xbb43('0x11')][_0xbb43('0x72')](this,_0x38a9de['variable_id']);if(!_0x4e8bda){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x38a9de,_0xbb43('0xd6'));}var _0x17ac9b=this;_0x4f440e[_0xbb43('0xd7')](function(_0x2cd3e7,_0x422b7c){Object[_0xbb43('0xd8')](_0x2cd3e7)[_0xbb43('0xd7')](function(_0x5f5ddc){_0x17ac9b[_0xbb43('0xe')][_0xbb43('0xd9')](util['format']('%s[%s][%s]',_0x4e8bda,_0x422b7c,_0x5f5ddc),_0x2cd3e7[_0x5f5ddc]);});});this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0xda'),_0x4e8bda),_0x4f440e['length']);return this[_0xbb43('0xe')]['noop'](util[_0xbb43('0x2b')]('variable\x20%s\x20set',_0x4e8bda));};AGIVertices[_0xbb43('0x10')]['dial']=function(_0x1f941a){logger[_0xbb43('0xdb')](util[_0xbb43('0x2b')](_0xbb43('0xdc'),_0x1f941a['label']));if(!this[_0xbb43('0x84')](_0x1f941a[_0xbb43('0xdd')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x1f941a,_0xbb43('0xde'));}var _0x1fbd28=this['getUser'][_0xbb43('0x72')](this,_0x1f941a['sip_id']);if(!_0x1fbd28){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x1f941a,_0xbb43('0xdf'));}var _0x4bbf68=this[_0xbb43('0xe')][_0xbb43('0x57')]('DIAL',[util[_0xbb43('0x2b')](_0xbb43('0xe0'),_0x1fbd28),_0x1f941a[_0xbb43('0x67')],_0x1f941a[_0xbb43('0xe1')],_0x1f941a[_0xbb43('0x66')]]);if(_0x4bbf68[_0xbb43('0xaa')]===-0x1){return _0x4bbf68;}return this['channel'][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('Executed\x20command\x20%s',_0xbb43('0xe2')));};AGIVertices['prototype']['dialogflow']=function(_0x5891ab){logger[_0xbb43('0x31')](util['format'](_0xbb43('0xe3'),_0x5891ab[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x5891ab[_0xbb43('0x81')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xe4'));}if(!this[_0xbb43('0x84')](_0x5891ab['text'])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xa9'));}this[_0xbb43('0xe')][_0xbb43('0xe5')]=!![];this[_0xbb43('0x3a')](_0x5891ab);this[_0xbb43('0x47')](_0x5891ab[_0xbb43('0x5c')],'in','','');this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xe6'),_0x5891ab[_0xbb43('0x5c')]));var _0x256258=this['googleDialogflow']['sync'](this,_0x5891ab);if(_0x256258){for(var _0x30f12e in _0x256258){if(_0x256258[_0xbb43('0x97')](_0x30f12e)){this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0xe7'),_0x30f12e['toUpperCase']()),_0x256258[_0x30f12e]);}}this[_0xbb43('0x47')](_0x256258[_0xbb43('0xe8')],_0xbb43('0xe9'),_0xbb43('0xea'),'');return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xeb'),_0x256258[_0xbb43('0xe8')]));}return this['channel']['error'](_0x5891ab,_0xbb43('0xec'));};AGIVertices[_0xbb43('0x10')][_0xbb43('0xed')]=function(_0x1a7e0b){logger['info'](util[_0xbb43('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1a7e0b['label']));if(!this[_0xbb43('0x84')](_0x1a7e0b[_0xbb43('0xee')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xef'));}if(!this[_0xbb43('0x84')](_0x1a7e0b[_0xbb43('0x7e')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')]('no\x20client_email\x20configured');}if(!this[_0xbb43('0x84')](_0x1a7e0b[_0xbb43('0xf0')])){return this[_0xbb43('0xe')]['noop']('no\x20private_key\x20configured');}if(!this[_0xbb43('0x84')](_0x1a7e0b[_0xbb43('0x7f')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xf1'));}if(!this[_0xbb43('0x84')](_0x1a7e0b[_0xbb43('0x5c')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0xa9'));}this[_0xbb43('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x1a7e0b);this[_0xbb43('0x47')](_0x1a7e0b[_0xbb43('0x5c')],'in','','');this['channel']['noop'](util[_0xbb43('0x2b')](_0xbb43('0xf2'),_0x1a7e0b['text']));var _0x2a19a4=this[_0xbb43('0x7d')][_0xbb43('0x72')](this,_0x1a7e0b);if(_0x2a19a4){for(var _0x31663f in _0x2a19a4){if(_0x2a19a4['hasOwnProperty'](_0x31663f)){if(_0x31663f!==_0xbb43('0xf3')){this['channel'][_0xbb43('0xd9')](util['format'](_0xbb43('0xe7'),_0x31663f[_0xbb43('0x6c')]()),_0x2a19a4[_0x31663f]);}}}this['createSquareMessage'](_0x2a19a4[_0xbb43('0xe8')],'out',_0xbb43('0xed'),_0x2a19a4[_0xbb43('0xf3')]);return this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format'](_0xbb43('0xf4'),_0x2a19a4[_0xbb43('0xe8')]));}return this['channel'][_0xbb43('0x2f')](_0x1a7e0b,_0xbb43('0xf5'));};AGIVertices[_0xbb43('0x10')][_0xbb43('0xf6')]=function(_0x3cf8c7){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0xf7'),_0x3cf8c7[_0xbb43('0x3c')]));if(!this['isConfigured'](_0x3cf8c7[_0xbb43('0xf8')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0xf9'));}if(!this[_0xbb43('0x84')](_0x3cf8c7[_0xbb43('0xfa')])){return this['channel'][_0xbb43('0xa8')]('no\x20username\x20configured');}if(!this[_0xbb43('0x84')](_0x3cf8c7[_0xbb43('0xfb')])){return this['channel']['noop'](_0xbb43('0xfc'));}if(!this[_0xbb43('0x84')](_0x3cf8c7[_0xbb43('0xfd')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0xa9'));}this[_0xbb43('0xe')][_0xbb43('0xe5')]=!![];this['createSquareDetailsReport'](_0x3cf8c7);this[_0xbb43('0x47')](_0x3cf8c7[_0xbb43('0x5c')],'in','','');this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x3cf8c7[_0xbb43('0x5c')]));var _0x5addc8=this[_0xbb43('0x80')][_0xbb43('0x72')](this,_0x3cf8c7);if(_0x5addc8){for(var _0x2f92b4 in _0x5addc8){if(_0x5addc8[_0xbb43('0x97')](_0x2f92b4)){this[_0xbb43('0xe')]['setVariable'](util[_0xbb43('0x2b')]('SESTEK_NDA_%s',_0x2f92b4[_0xbb43('0x6c')]()),_0x5addc8[_0x2f92b4]);}}this[_0xbb43('0x47')](_0x5addc8['speech'],_0xbb43('0xe9'),_0xbb43('0xf6'),'');if(_0x5addc8[_0xbb43('0xfe')]){this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x5addc8[_0xbb43('0xfe')]));var _0x385c4b=this['channel'][_0xbb43('0xff')](_0x5addc8['audiofile']);try{fs['unlink'](_0x5addc8['audiofile']+_0xbb43('0x100'));}catch(_0xd3ece2){logger[_0xbb43('0x2f')](_0xd3ece2);}return _0x385c4b;}else{return this['channel'][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x101'),_0x5addc8[_0xbb43('0xe8')]));}}return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3cf8c7,_0xbb43('0x102'));};AGIVertices['prototype'][_0xbb43('0x103')]=function(_0x15cb69){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x15cb69[_0xbb43('0x3c')]));return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x103'));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x104')]=function(_0x376d44){logger[_0xbb43('0x31')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x376d44['label']));var _0x2b1df8='';if(_0x376d44[_0xbb43('0x105')]){if(!this[_0xbb43('0x84')](_0x376d44[_0xbb43('0x105')])){return this[_0xbb43('0xe')]['error'](_0x376d44,_0xbb43('0x106'));}else{var _0x1253d4=parseInt(_0x376d44['trunk_id'],0xa);if(isNaN(_0x1253d4)){_0x2b1df8=_0x376d44['trunk_id'];}else{_0x2b1df8=this['getTrunk']['sync'](this,_0x376d44[_0xbb43('0x105')]);if(!_0x2b1df8){return this[_0xbb43('0xe')]['error'](_0x376d44,_0xbb43('0x107'));}}}}else if(_0x376d44['trunk_name']){_0x2b1df8=_0x376d44[_0xbb43('0x108')];}else{return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x376d44,_0xbb43('0x106'));}var _0x4ce664=this[_0xbb43('0xe')]['exec'](_0xbb43('0xe2'),[util[_0xbb43('0x2b')](_0xbb43('0x109'),_0x2b1df8,_0x376d44[_0xbb43('0x4d')]),_0x376d44['timeout'],_0x376d44[_0xbb43('0xe1')],_0x376d44['url']]);if(_0x4ce664['result']===-0x1){return _0x4ce664;}return this['channel'][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x10a'),'DIAL'));};AGIVertices[_0xbb43('0x10')]['finally']=function(_0xb9fdf){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x10b'),_0xb9fdf[_0xbb43('0x3c')]));return this['channel']['noop']('finally');};AGIVertices['prototype'][_0xbb43('0x10c')]=function(_0x3bcec7){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x10d'),_0x3bcec7['label']));if(_0x3bcec7['retry']===0x0){return this[_0xbb43('0xa4')](_0x3bcec7);}_0x3bcec7['retry']-=0x1;if(!this[_0xbb43('0x84')](_0x3bcec7[_0xbb43('0x10e')])){return this[_0xbb43('0xe')]['error'](_0x3bcec7,_0xbb43('0x10f'));}var _0x59006d=this['getSound'][_0xbb43('0x72')](this,_0x3bcec7[_0xbb43('0x10e')]);if(!_0x59006d){return this[_0xbb43('0xe')]['error'](_0x3bcec7,_0xbb43('0x110'));}if(!this[_0xbb43('0x84')](_0x3bcec7[_0xbb43('0xd4')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0xbb43('0xd5'));}var _0x267100=this[_0xbb43('0xe')][_0xbb43('0x111')](_0x59006d,_0x3bcec7[_0xbb43('0x112')],_0x3bcec7['maxdigit']);var _0x199d1e=_0x267100['result']?_0x267100['result'][_0xbb43('0xa1')]():'';logger[_0xbb43('0x31')]('test',JSON[_0xbb43('0x75')](_0x267100));if(_0x267100[_0xbb43('0xaa')]===-0x1){this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x3bcec7,_0x199d1e);return _0x267100;}else if(_0x267100[_0xbb43('0xa0')]==='timeout'){_0x267100['result']=_0x199d1e[_0xbb43('0x9e')]>=parseInt(_0x3bcec7[_0xbb43('0x113')])?'x':'i';}else{_0x267100[_0xbb43('0xaa')]=_0x199d1e[_0xbb43('0x9e')]>=parseInt(_0x3bcec7[_0xbb43('0x113')])&&_0x199d1e[_0xbb43('0x9e')]<=parseInt(_0x3bcec7[_0xbb43('0x114')])?'x':'i';}var _0xd2a221=this['getVariable'][_0xbb43('0x72')](this,_0x3bcec7['variable_id']);if(!_0xd2a221){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3bcec7,_0xbb43('0xd6'));}this[_0xbb43('0xe')][_0xbb43('0xd9')](_0xd2a221,_0x199d1e);if(this[_0xbb43('0x84')](_0x3bcec7[_0xbb43('0x115')])){var _0x52074c=parseInt(_0x3bcec7[_0xbb43('0x115')],0xa);var _0x4d5fc4=rs['generate']({'charset':'*','length':_0x52074c});var _0x3b00c9=_0x199d1e[_0xbb43('0x9e')];if(_0x3b00c9>0x0){if(_0x3b00c9>_0x52074c){this[_0xbb43('0x3a')]['sync'](this,_0x3bcec7,_0x3bcec7[_0xbb43('0x116')]===_0xbb43('0x117')?_0x4d5fc4+_0x199d1e[_0xbb43('0x118')](_0x52074c):_0x199d1e[_0xbb43('0x118')](0x0,_0x3b00c9-_0x52074c)+_0x4d5fc4);}else{this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x3bcec7,rs[_0xbb43('0x119')]({'charset':'*','length':_0x3b00c9}));}}else{this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x3bcec7,'');}}else{this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x3bcec7,_0x199d1e);}return _0x267100;};AGIVertices['prototype'][_0xbb43('0xd')]=function(_0x1344f6){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x11a'),_0x1344f6[_0xbb43('0x3c')]));return this[_0xbb43('0x10c')](_0x1344f6);};AGIVertices['prototype'][_0xbb43('0x11b')]=function(_0x2e576b){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x11c'),_0x2e576b['label']));this[_0xbb43('0x3a')]['sync'](this,_0x2e576b,_0x2e576b[_0xbb43('0x11d')]);return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x11e'),_0x2e576b['goalname']));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x11f')]=function(_0x4ce0a1){logger['info'](util[_0xbb43('0x2b')](_0xbb43('0x120'),_0x4ce0a1[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x4ce0a1[_0xbb43('0x87')])||!this[_0xbb43('0x84')](_0x4ce0a1[_0xbb43('0x121')])){return this['channel'][_0xbb43('0xa8')](_0xbb43('0x122'));}if(!this['isConfigured'](_0x4ce0a1[_0xbb43('0x5c')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0xa9'));}this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x123'),_0x4ce0a1[_0xbb43('0x5c')]));var _0x1fb01e=this[_0xbb43('0x86')][_0xbb43('0x72')](this,_0x4ce0a1);if(_0x1fb01e){this[_0xbb43('0xe')]['noop'](util[_0xbb43('0x2b')](_0xbb43('0x124'),_0x1fb01e));var _0x5b1dbe=this[_0xbb43('0xe')]['streamFile'](_0x1fb01e);try{fs[_0xbb43('0x125')](_0x1fb01e+_0xbb43('0x100'));}catch(_0x1d8866){logger[_0xbb43('0x2f')](_0x1d8866);}return _0x5b1dbe;}return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x4ce0a1,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xbb43('0x126')]=function(_0x3a7eab){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x127'),_0x3a7eab[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x3a7eab[_0xbb43('0x87')])||!this[_0xbb43('0x84')](_0x3a7eab[_0xbb43('0x121')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x122'));}if(!this[_0xbb43('0x84')](_0x3a7eab[_0xbb43('0x128')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0x129'));}if(!this[_0xbb43('0x84')](_0x3a7eab['text'])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xa9'));}this[_0xbb43('0xe')]['bot']=!![];this[_0xbb43('0x3a')](_0x3a7eab);this[_0xbb43('0x47')](_0x3a7eab['text'],'in','','');this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x12a'),_0x3a7eab[_0xbb43('0x5c')]));var _0x4b3eb8=this[_0xbb43('0x8b')][_0xbb43('0x72')](this,_0x3a7eab);if(_0x4b3eb8){for(var _0x1a9ae1 in _0x4b3eb8){if(_0x4b3eb8[_0xbb43('0x97')](_0x1a9ae1)&&_[_0xbb43('0x94')](_0x4b3eb8[_0x1a9ae1])){this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0x12b'),_0x1a9ae1[_0xbb43('0x6c')]()),_0x4b3eb8[_0x1a9ae1]);}}if(_[_0xbb43('0x49')](_0x4b3eb8[_0xbb43('0x7a')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x12c'));}else{this[_0xbb43('0x47')](_0x4b3eb8[_0xbb43('0x7a')],'out',_0xbb43('0x12d'),'');return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x12e'),_0x4b3eb8[_0xbb43('0x7a')]));}}return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3a7eab,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xbb43('0x10')][_0xbb43('0x12f')]=function(_0x5d315a){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x130'),_0x5d315a[_0xbb43('0x3c')],_0x5d315a[_0xbb43('0x67')]));if(!this['isConfigured'](_0x5d315a[_0xbb43('0x81')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xe4'));}var _0x13054b=_0xbb43('0x131');var _0x21b18a=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xbb43('0x119')](0x4));var _0x504ca0=util['format'](_0xbb43('0x9c'),_0x21b18a,_0x13054b);var _0x4424b0=!![];if(_0x5d315a['beep']===_0xbb43('0x132')){_0x4424b0=![];}var _0x46ceb9=this[_0xbb43('0xe')][_0xbb43('0x133')](_0x21b18a,_0x13054b,_0x5d315a[_0xbb43('0x134')],_0x5d315a[_0xbb43('0x67')],undefined,_0x4424b0);if(_0x46ceb9[_0xbb43('0xaa')]!==-0x1){this['channel']['noop'](util[_0xbb43('0x2b')]('google\x20%s\x20file\x20created',_0x504ca0));var _0x233e10=this['googleASR'][_0xbb43('0x72')](this,_0x5d315a,_0x504ca0);if(_0x233e10){for(var _0x206f55 in _0x233e10){if(_0x233e10[_0xbb43('0x97')](_0x206f55)){this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0x135'),_0x206f55['toUpperCase']()),_0x233e10[_0x206f55]);}}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0xbb43('0x75')](_0x233e10)));}}return _0x46ceb9;};AGIVertices['prototype']['tildeasr']=function(_0x36e255){logger[_0xbb43('0x31')](util['format'](_0xbb43('0x136'),_0x36e255[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x36e255['appid'])){return this[_0xbb43('0xe')][_0xbb43('0xa8')]('no\x20appid\x20configured');}if(!this[_0xbb43('0x84')](_0x36e255['appsecret'])){return this['channel'][_0xbb43('0xa8')](_0xbb43('0x137'));}var _0x2d53a8=_0xbb43('0x131');var _0x30aa9e=util['format'](_0xbb43('0x138'),FILES_PATH,rs[_0xbb43('0x119')](0x4));var _0x4efbbe=util['format'](_0xbb43('0x9c'),_0x30aa9e,_0x2d53a8);var _0x3ee4df=!![];if(_0x36e255[_0xbb43('0x139')]===_0xbb43('0x132')){_0x3ee4df=![];}var _0x471eba=this['channel'][_0xbb43('0x133')](_0x30aa9e,_0x2d53a8,_0x36e255[_0xbb43('0x134')],_0x36e255['timeout'],undefined,_0x3ee4df);if(_0x471eba[_0xbb43('0xaa')]!==-0x1){this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format'](_0xbb43('0x13a'),_0x4efbbe));var _0x14195e=this['tildeASR'][_0xbb43('0x72')](this,_0x36e255,_0x4efbbe);if(_0x14195e){for(var _0x181fd3 in _0x14195e){if(_0x14195e['hasOwnProperty'](_0x181fd3)){this[_0xbb43('0xe')]['setVariable'](util[_0xbb43('0x2b')](_0xbb43('0x13b'),_0x181fd3[_0xbb43('0x6c')]()),_0x14195e[_0x181fd3]);}}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x14195e)));}}return _0x471eba;};AGIVertices[_0xbb43('0x10')][_0xbb43('0x13c')]=function(_0xfdfd9a){logger[_0xbb43('0x31')](util['format'](_0xbb43('0x13d'),_0xfdfd9a[_0xbb43('0x3c')]));return this[_0xbb43('0xe')]['continueAt'](_0xfdfd9a[_0xbb43('0x42')],_0xfdfd9a[_0xbb43('0x13e')],_0xfdfd9a[_0xbb43('0x43')]);};AGIVertices['prototype'][_0xbb43('0x13f')]=function(_0x368da1){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x140'),_0x368da1[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x368da1[_0xbb43('0x141')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x368da1,_0xbb43('0x142'));}try{var _0x37b006=eval(_0x368da1['condition'])?_0xbb43('0x143'):_0xbb43('0x144');this[_0xbb43('0xe')]['noop'](util['format'](_0xbb43('0x145'),_0x368da1[_0xbb43('0x141')],_0x37b006));return{'code':0xc8,'result':_0x37b006};}catch(_0x2a8019){return{'code':0xc8,'result':_0xbb43('0x144')};}};AGIVertices['prototype'][_0xbb43('0x146')]=function(_0x330365){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x330365['label']));if(!this['isConfigured'](_0x330365[_0xbb43('0x147')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x330365,'no\x20interval\x20configured');}var _0x166274=this['getIntervals'][_0xbb43('0x72')](this,_0x330365[_0xbb43('0x147')]);if(!_0x166274){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x330365,_0xbb43('0x148'));}for(var _0x5c41c4=0x0;_0x5c41c4<_0x166274[_0xbb43('0x9e')];_0x5c41c4+=0x1){var _0x4e2738=this['channel'][_0xbb43('0x11')](util[_0xbb43('0x2b')](_0xbb43('0x149'),_0x166274[_0x5c41c4]));if(_0x4e2738[_0xbb43('0xaa')]===-0x1){return _0x4e2738;}logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x14a'),_0x166274[_0x5c41c4],_0x4e2738[_0xbb43('0xa0')]));if(_0x4e2738['extra']===_0xbb43('0x143')){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x14a'),_0x166274[_0x5c41c4],_0xbb43('0x143')));this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x14a'),_0x166274[_0x5c41c4],'true'));return{'code':0xc8,'result':_0xbb43('0x143')};}else{logger[_0xbb43('0x31')](util['format'](_0xbb43('0x14a'),_0x166274[_0x5c41c4],_0xbb43('0x144')));this['channel']['noop'](util[_0xbb43('0x2b')](_0xbb43('0x14a'),_0x166274[_0x5c41c4],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xbb43('0x14b')]=function(_0x12a14e){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x14c'),_0x12a14e[_0xbb43('0x3c')]));return this[_0xbb43('0xe')][_0xbb43('0x14b')]();};AGIVertices[_0xbb43('0x10')][_0xbb43('0x14d')]=function(_0x59c107){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x14e'),_0x59c107[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x59c107[_0xbb43('0x81')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')]('no\x20key\x20configured');}var _0x392fb1=_0xbb43('0x131');var _0x1e9c62=util[_0xbb43('0x2b')](_0xbb43('0x138'),FILES_PATH,rs['generate'](0x4));var _0x949c33=util[_0xbb43('0x2b')](_0xbb43('0x9c'),_0x1e9c62,_0x392fb1);var _0x117224=!![];if(_0x59c107[_0xbb43('0x139')]===_0xbb43('0x132')){_0x117224=![];}var _0x44fc3b=this['channel'][_0xbb43('0x133')](_0x1e9c62,_0x392fb1,_0x59c107['intKey'],_0x59c107[_0xbb43('0x67')],undefined,_0x117224);if(_0x44fc3b['result']!==-0x1){this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format'](_0xbb43('0x14f'),_0x949c33));var _0x83590e=this[_0xbb43('0x83')][_0xbb43('0x72')](this,_0x59c107,_0x949c33);if(_0x83590e){for(var _0x50a6de in _0x83590e){if(_0x83590e['hasOwnProperty'](_0x50a6de)){this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0x150'),_0x50a6de[_0xbb43('0x6c')]()),_0x83590e[_0x50a6de]);}}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0xbb43('0x75')](_0x83590e)));}}return _0x44fc3b;};AGIVertices[_0xbb43('0x10')]['ispeechtts']=function(_0x3fef47){logger[_0xbb43('0x31')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3fef47[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x3fef47['key'])){return this[_0xbb43('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0xbb43('0x84')](_0x3fef47[_0xbb43('0x5c')])){return this['channel'][_0xbb43('0xa8')]('no\x20text\x20configured');}this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x151'),_0x3fef47['text']));var _0xe79aa3=this['ispeechTTS'][_0xbb43('0x72')](this,_0x3fef47);if(_0xe79aa3){this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x14f'),_0xe79aa3));var _0x438d82=this['channel'][_0xbb43('0xff')](_0xe79aa3,_0x3fef47[_0xbb43('0x134')]);try{fs[_0xbb43('0x125')](_0xe79aa3+_0xbb43('0x100'));}catch(_0x12abeb){logger[_0xbb43('0x2f')](_0x12abeb);}return _0x438d82;}return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3fef47,_0xbb43('0x152'));};AGIVertices['prototype'][_0xbb43('0x153')]=function(_0x48fca2){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x154'),_0x48fca2['label']));if(!this[_0xbb43('0x84')](_0x48fca2[_0xbb43('0x155')])){return this[_0xbb43('0xe')]['error'](_0x48fca2,_0xbb43('0x156'));}logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xbb43('0x3f')],_0x48fca2['findBy']));var _0x5bab0b=this['agentLogin'][_0xbb43('0x72')](this,_0x48fca2[_0xbb43('0x155')]);if(_0x5bab0b){logger[_0xbb43('0x31')](util['format'](_0xbb43('0x157'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x48fca2[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x48fca2[_0xbb43('0x155')]));return{'code':0xc8,'result':_0xbb43('0x158')};}else{logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x159'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x48fca2[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x159'),this[_0xbb43('0xe')]['callerid'],_0x48fca2[_0xbb43('0x155')]));return{'code':0xc8,'result':_0xbb43('0x15a')};}};AGIVertices[_0xbb43('0x10')][_0xbb43('0x15b')]=function(_0x443641){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x15c'),_0x443641[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x443641[_0xbb43('0x155')])){return this['channel']['error'](_0x443641,'no\x20find\x20by\x20configured');}logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x15d'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x443641[_0xbb43('0x155')]));var _0x4132af=this['agentLogout'][_0xbb43('0x72')](this,_0x443641[_0xbb43('0x155')]);if(_0x4132af){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x157'),this[_0xbb43('0xe')]['callerid'],_0x443641[_0xbb43('0x155')]));this['channel'][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x157'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x443641[_0xbb43('0x155')]));return{'code':0xc8,'result':_0xbb43('0x158')};}else{logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x159'),this[_0xbb43('0xe')]['callerid'],_0x443641[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format'](_0xbb43('0x159'),this['channel'][_0xbb43('0x3f')],_0x443641['findBy']));return{'code':0xc8,'result':_0xbb43('0x15a')};}};AGIVertices[_0xbb43('0x10')][_0xbb43('0x15e')]=function(_0x104bac){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x15f'),_0x104bac[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x104bac[_0xbb43('0x160')])){return this['channel'][_0xbb43('0x2f')](_0x104bac,_0xbb43('0x161'));}this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x162'),_0x104bac[_0xbb43('0x160')]));var _0x37942b=eval(_0x104bac['operation']);if(!this[_0xbb43('0x84')](_0x104bac[_0xbb43('0xd4')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xd5'));}var _0x452b96=this[_0xbb43('0x11')][_0xbb43('0x72')](this,_0x104bac[_0xbb43('0xd4')]);if(!_0x452b96){return this[_0xbb43('0xe')]['error'](_0x104bac,'no\x20variable\x20found');}if(_[_0xbb43('0x9d')](_0x37942b)){var _0x344784=this;_0x37942b[_0xbb43('0xd7')](function(_0x25b657,_0x3b7cb0){_0x344784[_0xbb43('0xe')][_0xbb43('0xd9')](util['format']('%s[%s]',_0x452b96,_0x3b7cb0),_0x25b657);});return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('variable\x20%s[key]\x20set',_0x452b96));}else{return this[_0xbb43('0xe')][_0xbb43('0xd9')](_0x452b96,_0x37942b);}};AGIVertices[_0xbb43('0x10')][_0xbb43('0x163')]=function(_0x521fd4){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x164'),_0x521fd4['label']));if(_0x521fd4['retry']===0x0){return this[_0xbb43('0xa4')](_0x521fd4);}_0x521fd4[_0xbb43('0xa5')]-=0x1;if(!this[_0xbb43('0x84')](_0x521fd4[_0xbb43('0x10e')])){return this['channel'][_0xbb43('0x2f')](_0x521fd4,_0xbb43('0x10f'));}var _0x2d081d=this[_0xbb43('0x20')][_0xbb43('0x72')](this,_0x521fd4[_0xbb43('0x10e')]);if(!_0x2d081d){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x521fd4,'no\x20file\x20audio\x20found');}var _0x1fb40a=this[_0xbb43('0xe')][_0xbb43('0x111')](_0x2d081d,_0x521fd4['response'],_0x521fd4[_0xbb43('0x165')]);var _0x363993=_0x1fb40a['result'];if(_0x1fb40a[_0xbb43('0xaa')]===-0x1){this[_0xbb43('0x3a')]['sync'](this,_0x521fd4,'-1');return _0x1fb40a;}else if(_0x1fb40a[_0xbb43('0xa0')]==='timeout'){_0x1fb40a['result']=_0x1fb40a[_0xbb43('0xaa')][_0xbb43('0x9e')]>0x0?_0x1fb40a['result']:'t';}else if(_[_0xbb43('0x9b')](_0x1fb40a[_0xbb43('0xaa')])){_0x1fb40a[_0xbb43('0xaa')]='#';_0x363993='#';}if(!this[_0xbb43('0x84')](_0x521fd4[_0xbb43('0xd4')])){this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xd5'));}else{var _0x40716b=this[_0xbb43('0x11')]['sync'](this,_0x521fd4[_0xbb43('0xd4')]);if(!_0x40716b){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x521fd4,_0xbb43('0xd6'));}this[_0xbb43('0xe')][_0xbb43('0xd9')](_0x40716b,_0x363993);}this[_0xbb43('0x3a')]['sync'](this,_0x521fd4,_0x363993);return _0x1fb40a;};AGIVertices[_0xbb43('0x10')][_0xbb43('0xa8')]=function(_0x5cd70b){logger[_0xbb43('0x31')](util['format'](_0xbb43('0x166'),_0x5cd70b[_0xbb43('0x3c')]));return this['channel']['noop'](_0x5cd70b['output']||_0x5cd70b[_0xbb43('0x3c')]);};AGIVertices['prototype'][_0xbb43('0x167')]=function(_0x3d0046){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3d0046['label']));if(!this[_0xbb43('0x84')](_0x3d0046['findBy'])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3d0046,_0xbb43('0x156'));}logger[_0xbb43('0x31')](util['format'](_0xbb43('0x15d'),this[_0xbb43('0xe')]['callerid'],_0x3d0046['findBy']));var _0x4af8b3=this[_0xbb43('0x168')][_0xbb43('0x72')](this,_0x3d0046[_0xbb43('0x169')]);var _0x5e9251=this[_0xbb43('0x50')][_0xbb43('0x72')](this,_0x3d0046[_0xbb43('0x155')],_0x4af8b3);if(_0x5e9251){logger['info'](util[_0xbb43('0x2b')](_0xbb43('0x157'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x3d0046[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x157'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x3d0046[_0xbb43('0x155')]));return{'code':0xc8,'result':_0xbb43('0x158')};}else{logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x159'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x3d0046[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x157'),this[_0xbb43('0xe')]['callerid'],_0x3d0046['findBy']));return{'code':0xc8,'result':_0xbb43('0x15a')};}};AGIVertices[_0xbb43('0x10')][_0xbb43('0x16a')]=function(_0xc4731c){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0xc4731c[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0xc4731c[_0xbb43('0x10e')])){return this['channel']['error'](_0xc4731c,_0xbb43('0x10f'));}var _0x10f879=this['getSound'][_0xbb43('0x72')](this,_0xc4731c[_0xbb43('0x10e')]);if(!_0x10f879){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0xc4731c,_0xbb43('0x110'));}var _0x7c2000=this[_0xbb43('0xe')][_0xbb43('0x57')](_0xbb43('0x16b'),[_0x10f879,_0xc4731c['opts']]);if(_0x7c2000[_0xbb43('0xaa')]===-0x1){return _0x7c2000;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xc1'),'PLAYBACK',_0x10f879));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x16c')]=function(_0x4963ba){logger['info'](util['format'](_0xbb43('0x16d'),_0x4963ba['label']));if(!this[_0xbb43('0x84')](_0x4963ba[_0xbb43('0x16e')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x4963ba,'no\x20queue\x20selected');}var _0x4735b3='';var _0x23f48a=parseInt(_0x4963ba[_0xbb43('0x16e')],0xa);if(isNaN(_0x23f48a)){_0x4735b3=_0x4963ba[_0xbb43('0x16e')];}else{_0x4735b3=this['getVoiceQueue'][_0xbb43('0x72')](this,_0x4963ba[_0xbb43('0x16e')]);if(!_0x4735b3){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x4963ba,_0xbb43('0x16f'));}}var _0x122c0f='';if(this[_0xbb43('0x84')](_0x4963ba['file_id'])){var _0x48d336=this[_0xbb43('0x20')][_0xbb43('0x72')](this,_0x4963ba['file_id']);if(_0x48d336){_0x122c0f=_0x48d336;}}this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x4963ba,_0x4735b3);if(_0x4963ba['opts'][_0xbb43('0x170')]('x')<0x0){_0x4963ba[_0xbb43('0xe1')]+='x';}if(_0x4963ba['opts']['indexOf']('X')<0x0){_0x4963ba[_0xbb43('0xe1')]+='X';}this[_0xbb43('0xe')][_0xbb43('0xd9')](_0xbb43('0x171'),_0x4735b3?_0x4735b3[_0xbb43('0x172')]():'');var _0x52e65d=this[_0xbb43('0xe')][_0xbb43('0x57')](_0xbb43('0x173'),[_0x4735b3,_0x4963ba['opts'],_0x4963ba[_0xbb43('0x66')],_0x122c0f,_0x4963ba[_0xbb43('0x67')],_0x4963ba['agi'],_0x4963ba[_0xbb43('0x174')],_0x4963ba[_0xbb43('0x175')],'',_0x4963ba[_0xbb43('0x176')]]);if(_0x52e65d[_0xbb43('0xaa')]===-0x1){return _0x52e65d;}return this['channel']['noop'](util[_0xbb43('0x2b')]('Executed\x20command\x20%s\x20%s',_0xbb43('0x173'),_0x4735b3));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x177')]=function(_0x41c067){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x41c067[_0xbb43('0x3c')]));var _0x50415f=_0x41c067[_0xbb43('0x178')]||'wav';var _0x3925c5=util[_0xbb43('0x2b')](_0xbb43('0x179'),this[_0xbb43('0xe')][_0xbb43('0x3b')],rs['generate'](0x5));var _0xec5c76=util['format'](_0xbb43('0x17a'),FILES_PATH,_0x3925c5,_0x50415f);var _0xed405c=util['format']('%s/recordings/%s',FILES_PATH,_0x3925c5);this['createSquareRecording']['sync'](this,_0x41c067,_0x3925c5,_0xec5c76);this[_0xbb43('0xe')]['setVariable'](_0xbb43('0x17b'),_0x3925c5);logger[_0xbb43('0x31')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xed405c,_0x50415f,_0x41c067[_0xbb43('0x17c')],_0x41c067[_0xbb43('0x67')]);return this[_0xbb43('0xe')][_0xbb43('0x133')](_0xed405c,_0x50415f,_0x41c067[_0xbb43('0x17c')],_0x41c067[_0xbb43('0x67')],undefined,!![]);};AGIVertices[_0xbb43('0x10')][_0xbb43('0x17d')]=function(_0x3940d4){logger['info'](util[_0xbb43('0x2b')](_0xbb43('0x17e'),_0x3940d4[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x3940d4[_0xbb43('0x66')])){return this['channel'][_0xbb43('0xa8')](_0xbb43('0x17f'));}var _0x804903=this[_0xbb43('0x65')]['sync'](this,_0x3940d4);logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x180'),util[_0xbb43('0x181')](_0x804903,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3940d4[_0xbb43('0xd4')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x182'));}var _0x4ec050=this[_0xbb43('0x11')][_0xbb43('0x72')](this,_0x3940d4[_0xbb43('0xd4')]);if(!_0x4ec050){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x3940d4,_0xbb43('0xd6'));}this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0x183'),_0x4ec050),_0x804903[_0xbb43('0x78')]?_0x804903[_0xbb43('0x78')]:'200');this[_0xbb43('0xe')][_0xbb43('0xd9')](util[_0xbb43('0x2b')](_0xbb43('0x184'),_0x4ec050),_0x804903['statusMessage']?_0x804903[_0xbb43('0x79')]:'OK');if(_0x804903['body']){try{this[_0xbb43('0x9a')](_0x804903[_0xbb43('0x76')],_0x4ec050);}catch(_0x35ffca){logger[_0xbb43('0x2f')](util[_0xbb43('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4ec050));}}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format']('variable\x20%s\x20set',_0x4ec050));};AGIVertices['prototype']['saydigits']=function(_0x2a4f14){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x185'),_0x2a4f14[_0xbb43('0x3c')]));return this[_0xbb43('0xe')][_0xbb43('0x186')](_0x2a4f14[_0xbb43('0x187')][_0xbb43('0x58')](/\s+/g,''),_0x2a4f14[_0xbb43('0x17c')]);};AGIVertices[_0xbb43('0x10')][_0xbb43('0x188')]=function(_0x10ae45){logger[_0xbb43('0x31')](util['format'](_0xbb43('0x189'),_0x10ae45[_0xbb43('0x3c')]));return this['channel']['sayNumber'](_0x10ae45[_0xbb43('0x68')][_0xbb43('0x58')](/\s+/g,''),_0x10ae45[_0xbb43('0x17c')]);};AGIVertices[_0xbb43('0x10')][_0xbb43('0x18a')]=function(_0x13e606){logger['info'](util[_0xbb43('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x13e606[_0xbb43('0x3c')]));return this['channel']['sayPhonetic'](_0x13e606[_0xbb43('0x5c')],_0x13e606[_0xbb43('0x17c')]);};AGIVertices['prototype'][_0xbb43('0x18b')]=function(_0x2eb0bb){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2eb0bb[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x2eb0bb[_0xbb43('0x18c')])){return this[_0xbb43('0xe')]['noop'](_0xbb43('0x18d'));}var _0x5ac169=this['getMailAccount']['sync'](this,_0x2eb0bb[_0xbb43('0x18c')]);if(!_0x5ac169||!_0x5ac169[_0xbb43('0x18e')]){return this['channel']['error'](_0x2eb0bb,_0xbb43('0x18f'));}var _0x1151a7={'from':util[_0xbb43('0x2b')](_0xbb43('0x190'),_0x5ac169[_0xbb43('0x17')],_0x5ac169[_0xbb43('0x191')]||_0x5ac169[_0xbb43('0x18e')]['user']),'to':_0x2eb0bb['to']||'','cc':_0x2eb0bb['cc']||'','bcc':_0x2eb0bb[_0xbb43('0x192')]||'','subject':_0x2eb0bb[_0xbb43('0x193')],'html':_0x2eb0bb['text'],'text':_0x2eb0bb['text']};if(this[_0xbb43('0x84')](_0x2eb0bb[_0xbb43('0x194')])){}logger[_0xbb43('0xdb')](_0xbb43('0x195'),JSON[_0xbb43('0x75')](_0x1151a7));this[_0xbb43('0x3a')]['sync'](this,_0x2eb0bb,_0x2eb0bb[_0xbb43('0x18c')]);this[_0xbb43('0xe')]['noop'](util[_0xbb43('0x2b')](_0xbb43('0x196'),_0x5ac169[_0xbb43('0x17')]));this['sendMailMessage']['sync'](this,_0x5ac169[_0xbb43('0x197')],_0x1151a7);return this['channel'][_0xbb43('0xa8')](_0xbb43('0x198'));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x199')]=function(_0x4b7bf2){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x19a'),_0x4b7bf2[_0xbb43('0x3c')]));return this[_0xbb43('0xe')]['noop'](_0xbb43('0x19b'));};AGIVertices['prototype'][_0xbb43('0x19c')]=function(_0x15661c){logger[_0xbb43('0x31')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x15661c['label']));if(!this['isConfigured'](_0x15661c[_0xbb43('0x19d')])){return this['channel'][_0xbb43('0xa8')](_0xbb43('0x19e'));}var _0x2f082a=this[_0xbb43('0x37')]['sync'](this,_0x15661c[_0xbb43('0x19d')]);if(!_0x2f082a){return this[_0xbb43('0xe')]['error'](_0x15661c,_0xbb43('0x19f'));}var _0x58e7f6={'body':_0x15661c[_0xbb43('0x1a0')],'phone':_0x15661c['to']||'','SmsAccountId':_0x2f082a['id']};logger[_0xbb43('0xdb')](_0xbb43('0x1a1'),JSON[_0xbb43('0x75')](_0x58e7f6));this[_0xbb43('0x3a')][_0xbb43('0x72')](this,_0x15661c,_0x15661c[_0xbb43('0x19d')]);this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2f082a['name']));this['createSmsMessage'][_0xbb43('0x72')](this,_0x58e7f6);return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x1a2'));};AGIVertices['prototype']['set']=function(_0x55a4b8){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x1a3'),_0x55a4b8[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x55a4b8[_0xbb43('0xd4')])){return this[_0xbb43('0xe')]['error'](_0x55a4b8,_0xbb43('0x1a4'));}var _0x2272c4=this[_0xbb43('0x11')][_0xbb43('0x72')](this,_0x55a4b8[_0xbb43('0xd4')]);if(!_0x2272c4){return this['channel'][_0xbb43('0x2f')](_0x55a4b8,_0xbb43('0xd6'));}return this[_0xbb43('0xe')][_0xbb43('0xd9')](_0x2272c4,_0x55a4b8['variable_value']);};AGIVertices['prototype'][_0xbb43('0x1a5')]=function(_0x59c439){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x1a6'),_0x59c439[_0xbb43('0x3c')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x1a7'));var _0x3ce048=this[_0xbb43('0xe')][_0xbb43('0x11')]('XMCS-UNIQUEID');if(!_[_0xbb43('0x9b')](_0x3ce048['extra'])){this['channel'][_0xbb43('0x3b')]=_0x3ce048[_0xbb43('0xa0')];}if(_0x59c439[_0xbb43('0xb4')]===_0xbb43('0x1a8')){this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x1a9'));return this[_0xbb43('0xe')][_0xbb43('0xb4')]();}return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x1aa'));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x1ab')]=function(_0x582904){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x1ac'),_0x582904[_0xbb43('0x3c')]));if(!this['isConfigured'](_0x582904[_0xbb43('0x1ad')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x582904,'no\x20subproject\x20selected');}var _0x317df7=this['getSquareProject'][_0xbb43('0x72')](this,_0x582904['project_id']);if(!this[_0xbb43('0x84')](_0x317df7)){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x582904,util[_0xbb43('0x2b')](_0xbb43('0x1ae'),_0x582904['project_id']));}if(_0x317df7===this[_0xbb43('0xe')][_0xbb43('0x3e')]){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x582904,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x582904,_0x317df7);var _0x3b066a=this['channel'][_0xbb43('0x57')](_0xbb43('0x1af'),util[_0xbb43('0x2b')](_0xbb43('0x1b0'),config[_0xbb43('0x8')]['host']||_0xbb43('0x1b1'),_0x317df7,this[_0xbb43('0xe')][_0xbb43('0x3e')]));if(_0x3b066a[_0xbb43('0xaa')]===-0x1){return _0x3b066a;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0xc1'),_0xbb43('0x1af'),_0x317df7));};AGIVertices[_0xbb43('0x10')][_0xbb43('0x1b2')]=function(_0x4f1ec1){logger['info'](util[_0xbb43('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4f1ec1[_0xbb43('0x3c')]));var _0x1fb0d0=this[_0xbb43('0x56')]['sync'](this,_0x4f1ec1[_0xbb43('0x1b3')]);this[_0xbb43('0x3a')]['sync'](this,_0x4f1ec1,_0x4f1ec1[_0xbb43('0x1b3')]);if(this['isConfigured'](_0x4f1ec1[_0xbb43('0xd4')])){var _0x1c1ac0=this[_0xbb43('0x11')]['sync'](this,_0x4f1ec1['variable_id']);if(_0x1c1ac0){this[_0xbb43('0xe')][_0xbb43('0xd9')](_0x1c1ac0,_0x1fb0d0);return this[_0xbb43('0xe')][_0xbb43('0xa8')](util['format'](_0xbb43('0x1b4'),_0x4f1ec1[_0xbb43('0x1b3')],_0x1c1ac0));}}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x1b5'),_0x4f1ec1[_0xbb43('0x1b3')]));};AGIVertices['prototype'][_0xbb43('0x1b6')]=function(_0x25f187){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x25f187[_0xbb43('0x3c')]));_0x25f187[_0xbb43('0x5c')]=_0x25f187[_0xbb43('0x5c')][_0xbb43('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x25f187[_0xbb43('0x5a')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0x1b7'));}if(!this['isConfigured'](_0x25f187['text'])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xa9'));}this['channel']['noop'](util[_0xbb43('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x25f187[_0xbb43('0x5c')]));var _0x208e92=this[_0xbb43('0x59')]['sync'](this,_0x25f187);if(_0x208e92){this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x1b8'),_0x208e92));var _0x3fe433=this['channel'][_0xbb43('0xff')](_0x208e92);try{fs[_0xbb43('0x125')](_0x208e92+_0xbb43('0x100'));}catch(_0x3b7f19){logger[_0xbb43('0x2f')](_0x3b7f19);}return _0x3fe433;}return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x25f187,_0xbb43('0x1b9'));};AGIVertices[_0xbb43('0x10')]['tts']=function(_0x35f61f){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x1ba'),_0x35f61f[_0xbb43('0x3c')]));_0x35f61f[_0xbb43('0x5c')]=_0x35f61f['text'][_0xbb43('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbb43('0x84')](_0x35f61f[_0xbb43('0x5c')])){return this[_0xbb43('0xe')][_0xbb43('0xa8')](_0xbb43('0xa9'));}this[_0xbb43('0xe')]['noop'](util[_0xbb43('0x2b')](_0xbb43('0x1bb'),_0x35f61f[_0xbb43('0x5c')]));var _0xf32c73=this[_0xbb43('0x63')]['sync'](this,_0x35f61f);if(_0xf32c73){this['channel'][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x1bc'),_0xf32c73));var _0x1f5da3=this[_0xbb43('0xe')][_0xbb43('0xff')](_0xf32c73);try{fs[_0xbb43('0x125')](_0xf32c73+_0xbb43('0x100'));}catch(_0x28375e){logger[_0xbb43('0x2f')](_0x28375e);}return _0x1f5da3;}return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x35f61f,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbb43('0x10')][_0xbb43('0x1bd')]=function(_0x20e21e){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x20e21e['label']));if(!this[_0xbb43('0x84')](_0x20e21e[_0xbb43('0x155')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x20e21e,_0xbb43('0x156'));}logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x15d'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x20e21e[_0xbb43('0x155')]));var _0x120c29=this[_0xbb43('0x52')]['sync'](this,_0x20e21e[_0xbb43('0x155')]);if(_0x120c29){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x157'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x20e21e[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xbb43('0x3f')],_0x20e21e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xbb43('0x31')](util['format'](_0xbb43('0x159'),this[_0xbb43('0xe')]['callerid'],_0x20e21e[_0xbb43('0x155')]));this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')](_0xbb43('0x159'),this[_0xbb43('0xe')][_0xbb43('0x3f')],_0x20e21e[_0xbb43('0x155')]));return{'code':0xc8,'result':_0xbb43('0x15a')};}};AGIVertices[_0xbb43('0x10')]['voicemail']=function(_0x292967){logger['info'](util[_0xbb43('0x2b')](_0xbb43('0x1be'),_0x292967['label']));var _0x227a3e=this[_0xbb43('0xe')][_0xbb43('0x57')](_0xbb43('0x1bf'),[_0x292967['mailbox'],_0x292967[_0xbb43('0x7b')]]);if(_0x227a3e['result']===-0x1){return _0x227a3e;}return this[_0xbb43('0xe')][_0xbb43('0xa8')](util[_0xbb43('0x2b')]('Executed\x20command\x20%s\x20%s',_0xbb43('0x1bf'),_0x292967[_0xbb43('0x1c0')]));};AGIVertices['prototype'][_0xbb43('0x1c1')]=function(_0x5a4eec){logger[_0xbb43('0x31')](util[_0xbb43('0x2b')](_0xbb43('0x1c2'),_0x5a4eec[_0xbb43('0x3c')]));if(!this[_0xbb43('0x84')](_0x5a4eec[_0xbb43('0xd4')])){return this[_0xbb43('0xe')][_0xbb43('0x2f')](_0x5a4eec,_0xbb43('0x1a4'));}var _0x47261b=this[_0xbb43('0x11')][_0xbb43('0x72')](this,_0x5a4eec[_0xbb43('0xd4')]);if(!_0x47261b){return this[_0xbb43('0xe')]['error'](_0x5a4eec,_0xbb43('0xd6'));}var _0x47c71c=this[_0xbb43('0xe')][_0xbb43('0x11')](_0x47261b);return{'code':0xc8,'result':_0x47c71c[_0xbb43('0xa0')]?_0x47c71c['extra']:'-'};};String[_0xbb43('0x10')][_0xbb43('0x1c3')]=function(_0x301594,_0x26fd6f){return this[_0xbb43('0x9f')](_0x301594)[_0xbb43('0x1c4')](_0x26fd6f);};module[_0xbb43('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 84629d0..0212ca5 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 _0x8d9b=['isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','updateAcw','timer','uniqueid','then','catch','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8d9b,0x10a));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0xb8d9('0x1'))(_0xb8d9('0x2'));var RpcUser=require(_0xb8d9('0x3'));var RpcVoiceAgentReport=require(_0xb8d9('0x4'));function Acw(_0x3eb6ab){this['voiceQueues']=_0x3eb6ab['voiceQueues'];this[_0xb8d9('0x5')]=_0x3eb6ab['agents'];this[_0xb8d9('0x6')]=_0x3eb6ab[_0xb8d9('0x6')];this[_0xb8d9('0x7')]={};ami['on'](_0xb8d9('0x8'),this['syncAgentConnect'][_0xb8d9('0x9')](this));ami['on'](_0xb8d9('0xa'),this['syncHangupRequest']['bind'](this));ami['on'](_0xb8d9('0xb'),this[_0xb8d9('0xc')][_0xb8d9('0x9')](this));ami['on'](_0xb8d9('0xd'),this[_0xb8d9('0xe')][_0xb8d9('0x9')](this));ami['on'](_0xb8d9('0xf'),this[_0xb8d9('0x10')][_0xb8d9('0x9')](this));ami['on'](_0xb8d9('0x11'),this[_0xb8d9('0x12')][_0xb8d9('0x9')](this));ami['on'](_0xb8d9('0x13'),this['syncAgentConnectPreview'][_0xb8d9('0x9')](this));}function getDiff(_0x4d3f26){var _0x2bf945=moment()[_0xb8d9('0x14')](0x0);var _0x44639c=moment(_0x4d3f26)[_0xb8d9('0x14')](0x0);return _0x2bf945[_0xb8d9('0x15')](_0x44639c,_0xb8d9('0x16'));}Acw['prototype'][_0xb8d9('0x17')]=function(_0x4e3520,_0x2afbc3){var _0x498618=this;var _0x3a9e89=getDiff(_0x498618['timers'][_0x4e3520]['lastPauseAt']);clearTimeout(_0x498618['timers'][_0x4e3520][_0xb8d9('0x18')]);_0x498618['timers'][_0x4e3520][_0xb8d9('0x18')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x3a9e89},_0x498618[_0xb8d9('0x6')][_0x4e3520][_0xb8d9('0x19')],_0x4e3520)[_0xb8d9('0x1a')](function(_0x5d75c4){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2afbc3,_0x3a9e89,_0x5d75c4);})[_0xb8d9('0x1b')](function(_0x297e34){logger[_0xb8d9('0x1c')](_0xb8d9('0x1d'),_0x2afbc3,_0x297e34);})[_0xb8d9('0x1e')](function(){delete _0x498618[_0xb8d9('0x6')][_0x4e3520];});};Acw[_0xb8d9('0x1f')]['startAcw']=function(_0x469adc){try{var _0x4414f2=this;var _0x4279c0=this[_0xb8d9('0x7')][_0x469adc][_0xb8d9('0x20')];var _0x209dd5=this[_0xb8d9('0x7')][_0x469adc][_0xb8d9('0x21')];var _0x590275=this[_0xb8d9('0x22')][_0x209dd5];var _0x4a53fc=![];var _0x466eec=_0xb8d9('0x23');if(_0x590275[_0xb8d9('0x24')]&&_0x590275[_0xb8d9('0x25')]['name']){_0x4a53fc=!![];_0x466eec=_0x590275[_0xb8d9('0x25')][_0xb8d9('0x26')];}return ami[_0xb8d9('0x27')]({'action':'QueuePause','interface':_0x4279c0,'paused':!![],'reason':_0x466eec})[_0xb8d9('0x1a')](function(){if(_0x4414f2[_0xb8d9('0x5')][_0x4279c0]){return RpcUser[_0xb8d9('0x28')](_0x4414f2[_0xb8d9('0x5')][_0x4279c0]['id'])[_0xb8d9('0x1a')](function(_0x2e3f3f){if(!_0x2e3f3f||_0x2e3f3f['voicePause']){logger[_0xb8d9('0x29')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x469adc,_0x4279c0,_0x209dd5);return;}logger['info'](_0xb8d9('0x2a'),_0x469adc,_0x4279c0,_0x209dd5);var _0x28db67=_0x4414f2[_0xb8d9('0x7')][_0x469adc][_0xb8d9('0x2b')]&&_0x4414f2['channels'][_0x469adc][_0xb8d9('0x2c')]?_0x4414f2[_0xb8d9('0x7')][_0x469adc][_0xb8d9('0x2c')]:_0x469adc;return RpcUser[_0xb8d9('0x2d')](_0x4414f2[_0xb8d9('0x5')][_0x4279c0],_0x466eec,_0x28db67)[_0xb8d9('0x1a')](function(_0x26b4e4){_0x4414f2[_0xb8d9('0x22')][_0x209dd5]['available']-=0x1;_0x4414f2[_0xb8d9('0x22')][_0x209dd5][_0xb8d9('0x2e')]+=0x1;return _0x26b4e4;});})[_0xb8d9('0x1a')](function(_0x4f51f6){if(_0x4a53fc||!_0x4f51f6){return;}_0x4414f2['timers'][_0x4279c0]={};logger[_0xb8d9('0x29')](_0xb8d9('0x2f'),_0x469adc,_0x4414f2[_0xb8d9('0x22')][_0x209dd5][_0xb8d9('0x30')],_0x4279c0,_0x209dd5);_0x4414f2[_0xb8d9('0x6')][_0x4279c0][_0xb8d9('0x18')]=setTimeout(_0x4414f2[_0xb8d9('0x31')]['bind'](_0x4414f2,_0x4279c0),_0x4414f2[_0xb8d9('0x22')][_0x209dd5][_0xb8d9('0x30')]*0x3e8);_0x4414f2[_0xb8d9('0x6')][_0x4279c0][_0xb8d9('0x32')]=moment()[_0xb8d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss');_0x4414f2['timers'][_0x4279c0][_0xb8d9('0x19')]=_0x469adc;_0x4414f2[_0xb8d9('0x6')][_0x4279c0][_0xb8d9('0x21')]=_0x209dd5;_0x4414f2['timers'][_0x4279c0][_0xb8d9('0x17')]=_0x4414f2[_0xb8d9('0x17')][_0xb8d9('0x9')](_0x4414f2,_0x4279c0,_0x469adc);});}})[_0xb8d9('0x1b')](function(){logger[_0xb8d9('0x1c')](_0xb8d9('0x2f'),_0x469adc,_0x4414f2['voiceQueues'][_0x209dd5]['acwTimeout'],_0x4279c0,_0x209dd5);})[_0xb8d9('0x1e')](function(){delete _0x4414f2[_0xb8d9('0x7')][_0x469adc];});}catch(_0x2ddf0e){logger[_0xb8d9('0x1c')](_0xb8d9('0x34'),_0x2ddf0e['message']);}};Acw['prototype'][_0xb8d9('0x31')]=function(_0x302c0b){try{var _0x42f64f=this;if(_0x42f64f[_0xb8d9('0x6')][_0x302c0b]){_0x42f64f['timers'][_0x302c0b][_0xb8d9('0x18')]=![];var _0x1d0d9e=_0x42f64f[_0xb8d9('0x6')][_0x302c0b]['uniqueid'];var _0x56d5e7=_0x42f64f[_0xb8d9('0x6')][_0x302c0b][_0xb8d9('0x21')];var _0x374a8d=_0x42f64f['voiceQueues'][_0x56d5e7]['acwTimeout'];logger[_0xb8d9('0x29')](_0xb8d9('0x35'),_0x1d0d9e,_0x302c0b);RpcUser[_0xb8d9('0x28')](this[_0xb8d9('0x5')][_0x302c0b]['id'])['then'](function(_0xe57c96){if(_0xe57c96['pauseType']===_0xb8d9('0x23')){return RpcUser[_0xb8d9('0x36')](_0x42f64f[_0xb8d9('0x5')][_0x302c0b]);}});RpcVoiceAgentReport['update']({'acwtime':_0x374a8d,'agentacw':!![]},_0x1d0d9e,_0x302c0b)['then'](function(_0x131ac7){logger[_0xb8d9('0x29')](_0xb8d9('0x37'),_0x1d0d9e,_0x374a8d,_0x131ac7);})[_0xb8d9('0x1b')](function(_0x2a4adb){logger['error'](_0xb8d9('0x1d'),_0x1d0d9e,_0x2a4adb);});}else{logger[_0xb8d9('0x1c')](_0xb8d9('0x38'),_0x302c0b);if(_0x42f64f[_0xb8d9('0x6')]){logger[_0xb8d9('0x29')]('[ACW][TIMERS]',JSON[_0xb8d9('0x39')](_0x42f64f[_0xb8d9('0x6')]));}}}catch(_0x5d8567){logger['error'](_0xb8d9('0x3a'),_0x5d8567[_0xb8d9('0x3b')]);}};Acw['prototype'][_0xb8d9('0x3c')]=function(_0x9d8010){try{if(this[_0xb8d9('0x22')][_0x9d8010[_0xb8d9('0x21')]]&&(this[_0xb8d9('0x22')][_0x9d8010[_0xb8d9('0x21')]][_0xb8d9('0x2')]||this[_0xb8d9('0x22')][_0x9d8010['queue']]['mandatoryDisposition'])){if(this[_0xb8d9('0x5')][_0x9d8010['interface']]){this['channels'][_0x9d8010[_0xb8d9('0x19')]]={'queue':_0x9d8010[_0xb8d9('0x21')],'interface':_0x9d8010[_0xb8d9('0x20')],'destlinkedid':_0x9d8010['destlinkedid']};}}}catch(_0x4c75c6){logger[_0xb8d9('0x1c')]('[ACW][syncAgentConnect]\x20%s',_0x4c75c6[_0xb8d9('0x3b')]);}};Acw[_0xb8d9('0x1f')][_0xb8d9('0x3d')]=function(_0x11b403){try{if(this[_0xb8d9('0x22')][_0x11b403[_0xb8d9('0x21')]]&&(this['voiceQueues'][_0x11b403[_0xb8d9('0x21')]][_0xb8d9('0x2')]||this['voiceQueues'][_0x11b403[_0xb8d9('0x21')]][_0xb8d9('0x24')])){if(this['agents'][_0x11b403[_0xb8d9('0x20')]]){this['channels'][_0x11b403[_0xb8d9('0x19')]]={'queue':_0x11b403[_0xb8d9('0x21')],'interface':_0x11b403[_0xb8d9('0x20')]};}}}catch(_0x5694e5){logger[_0xb8d9('0x1c')](_0xb8d9('0x3e'),_0x5694e5[_0xb8d9('0x3b')]);}};Acw[_0xb8d9('0x1f')][_0xb8d9('0x3f')]=function(_0x197991){try{if(this[_0xb8d9('0x7')][_0x197991[_0xb8d9('0x19')]]&&_['isUndefined'](this['channels'][_0x197991[_0xb8d9('0x19')]][_0xb8d9('0x2b')])){logger[_0xb8d9('0x29')](_0xb8d9('0x40'),_0x197991['uniqueid']);this[_0xb8d9('0x41')](_0x197991[_0xb8d9('0x19')]);}else if(this['channels'][_0x197991['linkedid']]&&_['isUndefined'](this[_0xb8d9('0x7')][_0x197991[_0xb8d9('0x42')]]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x197991[_0xb8d9('0x42')]);this[_0xb8d9('0x41')](_0x197991['linkedid']);}}catch(_0x6d96e0){logger['error'](_0xb8d9('0x43'),_0x6d96e0[_0xb8d9('0x3b')]);}};Acw[_0xb8d9('0x1f')][_0xb8d9('0xc')]=function(_0x172069){try{if(this[_0xb8d9('0x7')][_0x172069['uniqueid']]&&this[_0xb8d9('0x7')][_0x172069['uniqueid']][_0xb8d9('0x2b')]){logger[_0xb8d9('0x29')](_0xb8d9('0x44'),_0x172069['uniqueid']);this[_0xb8d9('0x41')](_0x172069[_0xb8d9('0x19')]);}else if(this[_0xb8d9('0x7')][_0x172069[_0xb8d9('0x42')]]&&this[_0xb8d9('0x7')][_0x172069[_0xb8d9('0x42')]][_0xb8d9('0x2b')]){logger[_0xb8d9('0x29')](_0xb8d9('0x45'),_0x172069[_0xb8d9('0x42')]);this[_0xb8d9('0x41')](_0x172069[_0xb8d9('0x42')]);}}catch(_0x269a05){logger[_0xb8d9('0x1c')](_0xb8d9('0x46'),_0x269a05[_0xb8d9('0x3b')]);}};Acw[_0xb8d9('0x1f')][_0xb8d9('0x10')]=function(_0x3697ef){try{if(!_['isNil'](this['channels'][_0x3697ef['transfereeuniqueid']])){this[_0xb8d9('0x41')](_0x3697ef[_0xb8d9('0x47')]);if(this[_0xb8d9('0x7')][_0x3697ef['secondtransfereruniqueid']]){this[_0xb8d9('0x7')][_0x3697ef[_0xb8d9('0x48')]]['attended']=!![];this[_0xb8d9('0x7')][_0x3697ef['transfertargetuniqueid']]=this['channels'][_0x3697ef['secondtransfereruniqueid']];this[_0xb8d9('0x49')](_0x3697ef[_0xb8d9('0x48')]);}}else if(!_[_0xb8d9('0x4a')](this['channels'][_0x3697ef[_0xb8d9('0x4b')]])){this[_0xb8d9('0x41')](_0x3697ef[_0xb8d9('0x4b')]);if(this[_0xb8d9('0x7')][_0x3697ef[_0xb8d9('0x4c')]]){this['channels'][_0x3697ef[_0xb8d9('0x4c')]][_0xb8d9('0x2b')]=!![];this['channels'][_0x3697ef[_0xb8d9('0x47')]]=this[_0xb8d9('0x7')][_0x3697ef[_0xb8d9('0x4c')]];this[_0xb8d9('0x49')](_0x3697ef[_0xb8d9('0x4c')]);}}}catch(_0x1cdaaf){logger['error'](_0xb8d9('0x4d'),_0x1cdaaf['message']);}};Acw['prototype'][_0xb8d9('0x12')]=function(_0x3f0bdb){try{if(this[_0xb8d9('0x7')][_0x3f0bdb[_0xb8d9('0x4e')]]){logger[_0xb8d9('0x29')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x3f0bdb['transfereruniqueid']));this[_0xb8d9('0x41')](_0x3f0bdb[_0xb8d9('0x4e')]);}else if(this[_0xb8d9('0x7')][_0x3f0bdb[_0xb8d9('0x4f')]]){logger[_0xb8d9('0x29')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb8d9('0x39')](_0x3f0bdb['transfererlinkedid']));this[_0xb8d9('0x41')](_0x3f0bdb[_0xb8d9('0x4f')]);}}catch(_0x2b56d9){logger['error'](_0xb8d9('0x50'),_0x2b56d9[_0xb8d9('0x3b')]);}};Acw[_0xb8d9('0x1f')][_0xb8d9('0xe')]=function(_0x118d09){try{if(this[_0xb8d9('0x22')][_0x118d09['queue']]&&this[_0xb8d9('0x22')][_0x118d09[_0xb8d9('0x21')]]['autopause']===_0xb8d9('0x51')){if(this[_0xb8d9('0x5')][_0x118d09[_0xb8d9('0x20')]]){logger[_0xb8d9('0x29')](_0xb8d9('0x52'),_0x118d09['uniqueid'],_0x118d09[_0xb8d9('0x20')],_0x118d09[_0xb8d9('0x21')]);return RpcUser[_0xb8d9('0x2d')](this[_0xb8d9('0x5')][_0x118d09[_0xb8d9('0x20')]],_0xb8d9('0x53'),_0x118d09[_0xb8d9('0x19')]);}}}catch(_0x58bd1e){logger['error'](_0xb8d9('0x54'),_0x58bd1e[_0xb8d9('0x3b')]);}};Acw[_0xb8d9('0x1f')][_0xb8d9('0x49')]=function(_0x1d02d2,_0x25a852=0x2710){if(this['channels'][_0x1d02d2]){setTimeout(()=>{delete this[_0xb8d9('0x7')][_0x1d02d2];},_0x25a852);}};module['exports']=Acw; \ No newline at end of file +var _0xa804=['syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','lastPauseAt','format','queue','[ACW][START]\x20%s','acwTimeout','pauseType','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xa804,0xa2));var _0x4a80=function(_0x20b944,_0x99242e){_0x20b944=_0x20b944-0x0;var _0x54d202=_0xa804[_0x20b944];return _0x54d202;};'use strict';var _=require(_0x4a80('0x0'));var moment=require(_0x4a80('0x1'));var ami=require(_0x4a80('0x2'));var logger=require(_0x4a80('0x3'))('acw');var RpcUser=require(_0x4a80('0x4'));var RpcVoiceAgentReport=require(_0x4a80('0x5'));function Acw(_0x3b2ebd){this['voiceQueues']=_0x3b2ebd[_0x4a80('0x6')];this[_0x4a80('0x7')]=_0x3b2ebd[_0x4a80('0x7')];this[_0x4a80('0x8')]=_0x3b2ebd[_0x4a80('0x8')];this['channels']={};ami['on'](_0x4a80('0x9'),this[_0x4a80('0xa')][_0x4a80('0xb')](this));ami['on'](_0x4a80('0xc'),this[_0x4a80('0xd')][_0x4a80('0xb')](this));ami['on']('hangup',this[_0x4a80('0xe')][_0x4a80('0xb')](this));ami['on'](_0x4a80('0xf'),this[_0x4a80('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0x4a80('0x11')][_0x4a80('0xb')](this));ami['on']('blindtransfer',this[_0x4a80('0x12')][_0x4a80('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x4a80('0x13')][_0x4a80('0xb')](this));}function getDiff(_0x32c7a2){var _0x2017c8=moment()[_0x4a80('0x14')](0x0);var _0x373a3c=moment(_0x32c7a2)[_0x4a80('0x14')](0x0);return _0x2017c8[_0x4a80('0x15')](_0x373a3c,_0x4a80('0x16'));}Acw[_0x4a80('0x17')][_0x4a80('0x18')]=function(_0x20124f,_0x42d58c){var _0x5bc225=this;var _0xe9da0e=getDiff(_0x5bc225[_0x4a80('0x8')][_0x20124f]['lastPauseAt']);clearTimeout(_0x5bc225['timers'][_0x20124f]['timer']);_0x5bc225[_0x4a80('0x8')][_0x20124f]['timer']=![];return RpcVoiceAgentReport[_0x4a80('0x19')]({'acwtime':_0xe9da0e},_0x5bc225[_0x4a80('0x8')][_0x20124f][_0x4a80('0x1a')],_0x20124f)[_0x4a80('0x1b')](function(_0x1a02d3){logger[_0x4a80('0x1c')](_0x4a80('0x1d'),_0x42d58c,_0xe9da0e,_0x1a02d3);})[_0x4a80('0x1e')](function(_0x5dbdee){logger[_0x4a80('0x1f')](_0x4a80('0x20'),_0x42d58c,_0x5dbdee);})[_0x4a80('0x21')](function(){delete _0x5bc225[_0x4a80('0x8')][_0x20124f];});};Acw[_0x4a80('0x17')][_0x4a80('0x22')]=function(_0x475bda){try{var _0x19b33a=this;var _0x313f3a=this[_0x4a80('0x23')][_0x475bda][_0x4a80('0x24')];var _0xbf0c5a=this[_0x4a80('0x23')][_0x475bda]['queue'];var _0x5ed709=this[_0x4a80('0x6')][_0xbf0c5a];var _0x4d5f4e=![];var _0x2a283c=_0x4a80('0x25');if(_0x5ed709[_0x4a80('0x26')]&&_0x5ed709[_0x4a80('0x27')][_0x4a80('0x28')]){_0x4d5f4e=!![];_0x2a283c=_0x5ed709[_0x4a80('0x27')][_0x4a80('0x28')];}return ami[_0x4a80('0x29')]({'action':_0x4a80('0x2a'),'interface':_0x313f3a,'paused':!![],'reason':_0x2a283c})[_0x4a80('0x1b')](function(){if(_0x19b33a[_0x4a80('0x7')][_0x313f3a]){return RpcUser[_0x4a80('0x2b')](_0x19b33a['agents'][_0x313f3a]['id'])[_0x4a80('0x1b')](function(_0x178ea4){if(!_0x178ea4||_0x178ea4[_0x4a80('0x2c')]){logger[_0x4a80('0x1c')](_0x4a80('0x2d'),_0x475bda,_0x313f3a,_0xbf0c5a);return;}logger[_0x4a80('0x1c')](_0x4a80('0x2e'),_0x475bda,_0x313f3a,_0xbf0c5a);var _0xdc0c51=_0x19b33a[_0x4a80('0x23')][_0x475bda][_0x4a80('0x2f')]&&_0x19b33a[_0x4a80('0x23')][_0x475bda][_0x4a80('0x30')]?_0x19b33a['channels'][_0x475bda][_0x4a80('0x30')]:_0x475bda;return RpcUser[_0x4a80('0x31')](_0x19b33a[_0x4a80('0x7')][_0x313f3a],_0x2a283c,_0xdc0c51)[_0x4a80('0x1b')](function(_0x53f46d){_0x19b33a[_0x4a80('0x6')][_0xbf0c5a][_0x4a80('0x32')]-=0x1;_0x19b33a[_0x4a80('0x6')][_0xbf0c5a][_0x4a80('0x33')]+=0x1;return _0x53f46d;});})[_0x4a80('0x1b')](function(_0x3d14a6){if(_0x4d5f4e||!_0x3d14a6){return;}_0x19b33a[_0x4a80('0x8')][_0x313f3a]={};logger['info'](_0x4a80('0x34'),_0x475bda,_0x19b33a[_0x4a80('0x6')][_0xbf0c5a]['acwTimeout'],_0x313f3a,_0xbf0c5a);_0x19b33a['timers'][_0x313f3a][_0x4a80('0x35')]=setTimeout(_0x19b33a[_0x4a80('0x36')][_0x4a80('0xb')](_0x19b33a,_0x313f3a),_0x19b33a[_0x4a80('0x6')][_0xbf0c5a]['acwTimeout']*0x3e8);_0x19b33a[_0x4a80('0x8')][_0x313f3a][_0x4a80('0x37')]=moment()[_0x4a80('0x38')]('YYYY-MM-DD\x20HH:mm:ss');_0x19b33a[_0x4a80('0x8')][_0x313f3a]['uniqueid']=_0x475bda;_0x19b33a[_0x4a80('0x8')][_0x313f3a][_0x4a80('0x39')]=_0xbf0c5a;_0x19b33a['timers'][_0x313f3a][_0x4a80('0x18')]=_0x19b33a['updateAcw'][_0x4a80('0xb')](_0x19b33a,_0x313f3a,_0x475bda);});}})['catch'](function(){logger[_0x4a80('0x1f')](_0x4a80('0x34'),_0x475bda,_0x19b33a['voiceQueues'][_0xbf0c5a]['acwTimeout'],_0x313f3a,_0xbf0c5a);})[_0x4a80('0x21')](function(){delete _0x19b33a[_0x4a80('0x23')][_0x475bda];});}catch(_0x44843a){logger[_0x4a80('0x1f')](_0x4a80('0x3a'),_0x44843a['message']);}};Acw['prototype']['stopAcw']=function(_0x3f7871){try{var _0x113046=this;if(_0x113046[_0x4a80('0x8')][_0x3f7871]){_0x113046['timers'][_0x3f7871][_0x4a80('0x35')]=![];var _0x36df2a=_0x113046[_0x4a80('0x8')][_0x3f7871][_0x4a80('0x1a')];var _0x100635=_0x113046[_0x4a80('0x8')][_0x3f7871]['queue'];var _0x56196c=_0x113046[_0x4a80('0x6')][_0x100635][_0x4a80('0x3b')];logger[_0x4a80('0x1c')]('[%s][TIMER][STOP][AGENT:%s]',_0x36df2a,_0x3f7871);RpcUser['getAgent'](this[_0x4a80('0x7')][_0x3f7871]['id'])['then'](function(_0x478795){if(_0x478795[_0x4a80('0x3c')]===_0x4a80('0x25')){return RpcUser[_0x4a80('0x3d')](_0x113046[_0x4a80('0x7')][_0x3f7871]);}});RpcVoiceAgentReport[_0x4a80('0x19')]({'acwtime':_0x56196c,'agentacw':!![]},_0x36df2a,_0x3f7871)[_0x4a80('0x1b')](function(_0x29c5c2){logger['info'](_0x4a80('0x1d'),_0x36df2a,_0x56196c,_0x29c5c2);})['catch'](function(_0x58a42b){logger[_0x4a80('0x1f')](_0x4a80('0x20'),_0x36df2a,_0x58a42b);});}else{logger[_0x4a80('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3f7871);if(_0x113046[_0x4a80('0x8')]){logger[_0x4a80('0x1c')](_0x4a80('0x3e'),JSON[_0x4a80('0x3f')](_0x113046[_0x4a80('0x8')]));}}}catch(_0x3c128b){logger[_0x4a80('0x1f')](_0x4a80('0x40'),_0x3c128b[_0x4a80('0x41')]);}};Acw[_0x4a80('0x17')][_0x4a80('0xa')]=function(_0x4171ff){try{if(this[_0x4a80('0x6')][_0x4171ff[_0x4a80('0x39')]]&&(this[_0x4a80('0x6')][_0x4171ff[_0x4a80('0x39')]][_0x4a80('0x42')]||this[_0x4a80('0x6')][_0x4171ff[_0x4a80('0x39')]][_0x4a80('0x26')])){if(this[_0x4a80('0x7')][_0x4171ff[_0x4a80('0x24')]]){this[_0x4a80('0x23')][_0x4171ff[_0x4a80('0x1a')]]={'queue':_0x4171ff['queue'],'interface':_0x4171ff[_0x4a80('0x24')],'destlinkedid':_0x4171ff['destlinkedid']};}}}catch(_0x5d449c){logger[_0x4a80('0x1f')](_0x4a80('0x43'),_0x5d449c[_0x4a80('0x41')]);}};Acw['prototype'][_0x4a80('0x13')]=function(_0x56586f){try{if(this[_0x4a80('0x6')][_0x56586f[_0x4a80('0x39')]]&&(this[_0x4a80('0x6')][_0x56586f[_0x4a80('0x39')]]['acw']||this[_0x4a80('0x6')][_0x56586f['queue']]['mandatoryDisposition'])){if(this[_0x4a80('0x7')][_0x56586f[_0x4a80('0x24')]]){this[_0x4a80('0x23')][_0x56586f[_0x4a80('0x1a')]]={'queue':_0x56586f[_0x4a80('0x39')],'interface':_0x56586f['interface']};}}}catch(_0x13d744){logger['error'](_0x4a80('0x44'),_0x13d744[_0x4a80('0x41')]);}};Acw[_0x4a80('0x17')][_0x4a80('0xd')]=function(_0x5e76eb){try{if(this[_0x4a80('0x23')][_0x5e76eb['uniqueid']]&&_[_0x4a80('0x45')](this[_0x4a80('0x23')][_0x5e76eb[_0x4a80('0x1a')]]['attended'])){logger[_0x4a80('0x1c')](_0x4a80('0x46'),_0x5e76eb[_0x4a80('0x1a')]);this[_0x4a80('0x22')](_0x5e76eb['uniqueid']);}else if(this['channels'][_0x5e76eb[_0x4a80('0x47')]]&&_[_0x4a80('0x45')](this[_0x4a80('0x23')][_0x5e76eb[_0x4a80('0x47')]][_0x4a80('0x2f')])){logger[_0x4a80('0x1c')](_0x4a80('0x48'),_0x5e76eb['linkedid']);this[_0x4a80('0x22')](_0x5e76eb[_0x4a80('0x47')]);}}catch(_0x140bc9){logger[_0x4a80('0x1f')](_0x4a80('0x49'),_0x140bc9[_0x4a80('0x41')]);}};Acw['prototype']['syncHangup']=function(_0x160e75){try{if(this[_0x4a80('0x23')][_0x160e75[_0x4a80('0x1a')]]&&this['channels'][_0x160e75['uniqueid']][_0x4a80('0x2f')]){logger[_0x4a80('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x160e75[_0x4a80('0x1a')]);this[_0x4a80('0x22')](_0x160e75[_0x4a80('0x1a')]);}else if(this[_0x4a80('0x23')][_0x160e75[_0x4a80('0x47')]]&&this[_0x4a80('0x23')][_0x160e75[_0x4a80('0x47')]][_0x4a80('0x2f')]){logger['info'](_0x4a80('0x4a'),_0x160e75[_0x4a80('0x47')]);this[_0x4a80('0x22')](_0x160e75['linkedid']);}}catch(_0x3de2cb){logger[_0x4a80('0x1f')]('[ACW][syncHangup]\x20%s',_0x3de2cb['message']);}};Acw['prototype'][_0x4a80('0x11')]=function(_0x10408f){try{if(!_[_0x4a80('0x4b')](this[_0x4a80('0x23')][_0x10408f['transfereeuniqueid']])){this[_0x4a80('0x22')](_0x10408f[_0x4a80('0x4c')]);if(this[_0x4a80('0x23')][_0x10408f['secondtransfereruniqueid']]){this[_0x4a80('0x23')][_0x10408f[_0x4a80('0x4d')]]['attended']=!![];this[_0x4a80('0x23')][_0x10408f['transfertargetuniqueid']]=this[_0x4a80('0x23')][_0x10408f[_0x4a80('0x4d')]];this['deleteChannelAfterTimeout'](_0x10408f[_0x4a80('0x4d')]);}}else if(!_[_0x4a80('0x4b')](this[_0x4a80('0x23')][_0x10408f[_0x4a80('0x4e')]])){this[_0x4a80('0x22')](_0x10408f[_0x4a80('0x4e')]);if(this[_0x4a80('0x23')][_0x10408f[_0x4a80('0x4f')]]){this[_0x4a80('0x23')][_0x10408f['origtransfereruniqueid']][_0x4a80('0x2f')]=!![];this[_0x4a80('0x23')][_0x10408f[_0x4a80('0x4c')]]=this[_0x4a80('0x23')][_0x10408f['origtransfereruniqueid']];this[_0x4a80('0x50')](_0x10408f[_0x4a80('0x4f')]);}}}catch(_0x3423ce){logger[_0x4a80('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x3423ce[_0x4a80('0x41')]);}};Acw[_0x4a80('0x17')]['syncBlindTransfer']=function(_0x4d0b08){try{if(this[_0x4a80('0x23')][_0x4d0b08[_0x4a80('0x51')]]){logger[_0x4a80('0x1c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x4d0b08[_0x4a80('0x51')]));this[_0x4a80('0x22')](_0x4d0b08[_0x4a80('0x51')]);}else if(this[_0x4a80('0x23')][_0x4d0b08[_0x4a80('0x52')]]){logger[_0x4a80('0x1c')](_0x4a80('0x53'),JSON[_0x4a80('0x3f')](_0x4d0b08[_0x4a80('0x52')]));this[_0x4a80('0x22')](_0x4d0b08[_0x4a80('0x52')]);}}catch(_0x15687f){logger[_0x4a80('0x1f')](_0x4a80('0x54'),_0x15687f[_0x4a80('0x41')]);}};Acw['prototype'][_0x4a80('0x10')]=function(_0x3ec61c){try{if(this[_0x4a80('0x6')][_0x3ec61c[_0x4a80('0x39')]]&&this['voiceQueues'][_0x3ec61c['queue']][_0x4a80('0x55')]===_0x4a80('0x56')){if(this[_0x4a80('0x7')][_0x3ec61c[_0x4a80('0x24')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3ec61c[_0x4a80('0x1a')],_0x3ec61c[_0x4a80('0x24')],_0x3ec61c[_0x4a80('0x39')]);return RpcUser['savePause'](this[_0x4a80('0x7')][_0x3ec61c[_0x4a80('0x24')]],_0x4a80('0x57'),_0x3ec61c[_0x4a80('0x1a')]);}}}catch(_0x56538a){logger[_0x4a80('0x1f')](_0x4a80('0x58'),_0x56538a[_0x4a80('0x41')]);}};Acw['prototype']['deleteChannelAfterTimeout']=function(_0x18e47d,_0x30e906=0x2710){if(this['channels'][_0x18e47d]){setTimeout(()=>{delete this[_0x4a80('0x23')][_0x18e47d];},_0x30e906);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 394c36d..2755fd8 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 _0xc08f=['username','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port'];(function(_0x43d5f2,_0x480e60){var _0x154a93=function(_0x3b0f8e){while(--_0x3b0f8e){_0x43d5f2['push'](_0x43d5f2['shift']());}};_0x154a93(++_0x480e60);}(_0xc08f,0x12f));var _0xfc08=function(_0x26e018,_0x329d54){_0x26e018=_0x26e018-0x0;var _0x263417=_0xc08f[_0x26e018];return _0x263417;};'use strict';var Manager=require(_0xfc08('0x0'));var BPromise=require(_0xfc08('0x1'));var util=require('util');var logger=require(_0xfc08('0x2'))(_0xfc08('0x3'));var config=require(_0xfc08('0x4'));var ami=new Manager(config[_0xfc08('0x5')][_0xfc08('0x6')],config[_0xfc08('0x5')]['ip'],config[_0xfc08('0x5')][_0xfc08('0x7')],config[_0xfc08('0x5')]['password'],!![]);ami['keepConnected']();ami[_0xfc08('0x8')]=BPromise[_0xfc08('0x9')](ami[_0xfc08('0xa')]);function error(_0x1bed17){logger[_0xfc08('0xb')](util[_0xfc08('0xc')](_0xfc08('0xd'),config['asterisk'][_0xfc08('0x7')],config[_0xfc08('0x5')]['ip'],config['asterisk'][_0xfc08('0x6')],util[_0xfc08('0xe')](_0x1bed17,![],null)));}function close(){logger[_0xfc08('0xb')](util[_0xfc08('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xfc08('0x5')]['username'],config[_0xfc08('0x5')]['ip'],config[_0xfc08('0x5')][_0xfc08('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xfc08('0xf')]=function(){return function(){return ami[_0xfc08('0x8')]({'action':'devicestatelist'});};};ami[_0xfc08('0x10')]=function(){return function(){return ami['Action']({'action':_0xfc08('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xfc08('0x12')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(){logger[_0xfc08('0x13')](util[_0xfc08('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0xfc08('0x7')],config['asterisk']['ip'],config[_0xfc08('0x5')]['port']));ami[_0xfc08('0x14')](_0xfc08('0xb'),error);ami[_0xfc08('0x14')](_0xfc08('0x15'),close);}ami['on'](_0xfc08('0x16'),connect);ami['on'](_0xfc08('0x17'),function(_0x206b2f){logger['info'](util['format'](_0xfc08('0x18'),config['asterisk'][_0xfc08('0x7')],config[_0xfc08('0x5')]['ip'],config[_0xfc08('0x5')][_0xfc08('0x6')],util[_0xfc08('0xe')](_0x206b2f,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0xfc08('0xc')](_0xfc08('0x19'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xfc08('0x5')][_0xfc08('0x6')]));return Promise[_0xfc08('0x1a')]()['then'](ami[_0xfc08('0x1b')]())[_0xfc08('0x1c')](ami[_0xfc08('0xf')]())[_0xfc08('0x1c')](ami['actionSipPeerStatus']())[_0xfc08('0x1c')](ami['actionQueueSummary']())[_0xfc08('0x1c')](ami[_0xfc08('0x12')]())[_0xfc08('0x1d')](function(_0x48113d){logger[_0xfc08('0xb')](_0xfc08('0x1e'),util['inspect'](_0x48113d,{'showHidden':![],'depth':null}));});});ami[_0xfc08('0x14')](_0xfc08('0xb'),error);ami[_0xfc08('0x14')](_0xfc08('0x15'),close);module['exports']=ami; \ No newline at end of file +var _0xd029=['once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','actionSipPeerStatus','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','bluebird','util','../../config/logger','ami','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x57c8ea,_0x515331){var _0x93262d=function(_0x5d902f){while(--_0x5d902f){_0x57c8ea['push'](_0x57c8ea['shift']());}};_0x93262d(++_0x515331);}(_0xd029,0xef));var _0x9d02=function(_0x1a39d3,_0x50bbbf){_0x1a39d3=_0x1a39d3-0x0;var _0x2881b5=_0xd029[_0x1a39d3];return _0x2881b5;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x9d02('0x0'));var util=require(_0x9d02('0x1'));var logger=require(_0x9d02('0x2'))(_0x9d02('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x9d02('0x4')]['port'],config[_0x9d02('0x4')]['ip'],config[_0x9d02('0x4')][_0x9d02('0x5')],config[_0x9d02('0x4')][_0x9d02('0x6')],!![]);ami[_0x9d02('0x7')]();ami[_0x9d02('0x8')]=BPromise[_0x9d02('0x9')](ami[_0x9d02('0xa')]);function error(_0x3fae57){logger[_0x9d02('0xb')](util[_0x9d02('0xc')](_0x9d02('0xd'),config[_0x9d02('0x4')]['username'],config[_0x9d02('0x4')]['ip'],config[_0x9d02('0x4')][_0x9d02('0xe')],util[_0x9d02('0xf')](_0x3fae57,![],null)));}function close(){logger['error'](util[_0x9d02('0xc')](_0x9d02('0x10'),config[_0x9d02('0x4')][_0x9d02('0x5')],config[_0x9d02('0x4')]['ip'],config[_0x9d02('0x4')]['port']));}ami[_0x9d02('0x11')]=function(){return function(){return ami[_0x9d02('0x8')]({'action':_0x9d02('0x12')});};};ami[_0x9d02('0x13')]=function(){return function(){return ami[_0x9d02('0x8')]({'action':_0x9d02('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x9d02('0x8')]({'action':_0x9d02('0x15')});};};ami[_0x9d02('0x16')]=function(){return function(){return ami[_0x9d02('0x8')]({'action':_0x9d02('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x9d02('0x8')]({'action':_0x9d02('0x18')});};};function connect(){logger[_0x9d02('0x19')](util[_0x9d02('0xc')](_0x9d02('0x1a'),config['asterisk']['username'],config[_0x9d02('0x4')]['ip'],config[_0x9d02('0x4')][_0x9d02('0xe')]));ami[_0x9d02('0x1b')](_0x9d02('0xb'),error);ami[_0x9d02('0x1b')](_0x9d02('0x1c'),close);}ami['on'](_0x9d02('0x1d'),connect);ami['on']('shutdown',function(_0xee930c){logger['info'](util[_0x9d02('0xc')](_0x9d02('0x1e'),config[_0x9d02('0x4')][_0x9d02('0x5')],config[_0x9d02('0x4')]['ip'],config[_0x9d02('0x4')][_0x9d02('0xe')],util[_0x9d02('0xf')](_0xee930c,![],null)));});ami['on'](_0x9d02('0x1f'),function(){logger[_0x9d02('0x19')](util[_0x9d02('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x9d02('0x4')][_0x9d02('0x5')],config['asterisk']['ip'],config[_0x9d02('0x4')][_0x9d02('0xe')]));return Promise['resolve']()[_0x9d02('0x20')](ami[_0x9d02('0x11')]())[_0x9d02('0x20')](ami[_0x9d02('0x13')]())[_0x9d02('0x20')](ami[_0x9d02('0x21')]())[_0x9d02('0x20')](ami[_0x9d02('0x16')]())[_0x9d02('0x20')](ami[_0x9d02('0x22')]())[_0x9d02('0x23')](function(_0x4eb1ba){logger['error'](_0x9d02('0x24'),util['inspect'](_0x4eb1ba,{'showHidden':![],'depth':null}));});});ami[_0x9d02('0x1b')]('error',error);ami[_0x9d02('0x1b')](_0x9d02('0x1c'),close);module[_0x9d02('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c42511c..abfdfd6 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0xcb91[_0x3a4f18];return _0x4c20fc;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x49554e,_0x3c212b){_0x49554e=_0x49554e-0x0;var _0x4fe9d7=_0x70e0[_0x49554e];return _0x4fe9d7;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('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 619a516..79b4e95 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 _0x8a3d=['user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','avgHandleTime','dialPredictiveInterval','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','loggedIn','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','UserId','[booked][checkContactBlack]','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','originated','temp','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[handleIvr]','[getContactCampaign2]','dialLimitQueue','undefined','not_inuse','getContactDialer','checkContactEmpty','checkIsBlackList','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','type','outbound','debug','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','getSeconds','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','Error','stringify','prototype','isTrunkReachable','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','Queue','silly','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','syncAgentConnect','uniqueid','decrementOriginate','queue','answertime','ivr','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','Abandoned','countabandonedretry','countglobal','dialAbandonedRetryFrequency','rescheduleContact','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','actions','channel','actionid','strategy','rrmemory','isNil','locked','stateinterface','idHopper','paused','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','ContactId','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','variable','exten','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','AMD','emit','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','membername','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','dialMachineRetryFrequency','ivrAnswerCallsDay','cause-txt','[syncAgentCompleteIvr][createHistory]','[syncHangupIvr][createHistory]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangupIvr]','[syncHangup2]','Normal\x20Clearing','outboundUnknownCallsDay','Unknown','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','reachable','resolve','Agent','user:%s'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x8a3d,0xd5));var _0xd8a3=function(_0x3acaf8,_0x1cb0d7){_0x3acaf8=_0x3acaf8-0x0;var _0x2b46ed=_0x8a3d[_0x3acaf8];return _0x2b46ed;};'use strict';var util=require(_0xd8a3('0x0'));var _=require(_0xd8a3('0x1'));var uuid=require(_0xd8a3('0x2'));var moment=require(_0xd8a3('0x3'));var rr=require('rr');var Redis=require(_0xd8a3('0x4'));var utils=require(_0xd8a3('0x5'));var hopperUtils=require(_0xd8a3('0x6'));var ut=require(_0xd8a3('0x7'));var config=require('../../../config/environment/');var logger=require(_0xd8a3('0x8'))(_0xd8a3('0x9'));var loggerBooked=require(_0xd8a3('0x8'))(_0xd8a3('0xa'));var loggerPredictive=require(_0xd8a3('0x8'))(_0xd8a3('0xb'));var loggerPredictiveCalls=require(_0xd8a3('0x8'))(_0xd8a3('0xc'));var loggerSyncQueueSummary=require(_0xd8a3('0x8'))(_0xd8a3('0xd'));var ami=require(_0xd8a3('0xe'));config[_0xd8a3('0xf')]=_['defaults'](config[_0xd8a3('0xf')],{'host':_0xd8a3('0x10'),'port':0x18eb});var io=require(_0xd8a3('0x11'))(new Redis(config[_0xd8a3('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0xd8a3('0x12'));var Action=require(_0xd8a3('0x13'));var History=require(_0xd8a3('0x14'));var Final=require(_0xd8a3('0x15'));var AgentComplete=require(_0xd8a3('0x16'));var QueueCallerAbandon=require(_0xd8a3('0x17'));var Hangup=require(_0xd8a3('0x18'));var ipAgi=process[_0xd8a3('0x19')][_0xd8a3('0x1a')]||_0xd8a3('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xd8a3('0x1c')]=function(_0x468f28){this[_0xd8a3('0x1d')]=this[_0xd8a3('0x1d')]?this[_0xd8a3('0x1d')][_0xd8a3('0x1e')](_0x468f28):_0x468f28();};function Dialer(_0x5ea750,_0x539ef8){this[_0xd8a3('0x1f')]=new Sequence();this[_0xd8a3('0x20')]=_0x539ef8;this[_0xd8a3('0x21')]=_0x5ea750[_0xd8a3('0x21')];this['campaigns']=_0x5ea750[_0xd8a3('0x22')];this['agents']=_0x5ea750[_0xd8a3('0x23')];this[_0xd8a3('0x24')]=_0x5ea750[_0xd8a3('0x24')];this['maxNumberOriginate']=config[_0xd8a3('0x25')]||0x2;this[_0xd8a3('0x26')]={};this['actions']={};this[_0xd8a3('0x27')]={};this[_0xd8a3('0x28')]={};this['optionPredictive']={};this[_0xd8a3('0x29')]={};this[_0xd8a3('0x2a')]={};this['ivrOriginated']={};this[_0xd8a3('0x2b')]={};this['queueBookedRR']={};this[_0xd8a3('0x2c')]={};ami['on'](_0xd8a3('0x2d'),this['syncAgentConnect'][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x2f'),this[_0xd8a3('0x30')]['bind'](this));ami['on'](_0xd8a3('0x31'),this[_0xd8a3('0x32')][_0xd8a3('0x2e')](this));ami['on']('agentcomplete',this[_0xd8a3('0x33')][_0xd8a3('0x2e')](this));ami['on']('custom:queuesummary',this[_0xd8a3('0xd')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x34'),this[_0xd8a3('0x35')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x36'),this[_0xd8a3('0x37')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x38'),this[_0xd8a3('0x39')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x3a'),this[_0xd8a3('0x3b')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x3c'),this['syncQueueMember'][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x3d'),this['syncQueueStatusComplete'][_0xd8a3('0x2e')](this));this[_0xd8a3('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0xd8a3('0x3f')]()[_0xd8a3('0x40')](function(_0x183dce){previewRecallmeReminderInterval=_0x183dce[_0xd8a3('0x41')];});}function isNotNull(_0xd8e72){return _0xd8e72!==null&&!_[_0xd8a3('0x42')](_0xd8e72);}function msgResponse(_0xf60ec8,_0x2a1339,_0x19bfe1){return{'action':_0xf60ec8,'response':_0x2a1339,'message':_0x19bfe1,'stack':_0x19bfe1};}function emit(_0x2eb7be,_0x4dc239,_0x3362d4){io['to'](_0x2eb7be)['emit'](_0x4dc239,_0x3362d4);}function emitOutboundVoiceQueueSummary(_0x738ec2){if(_0x738ec2[_0xd8a3('0x43')]===_0xd8a3('0x44')){logger[_0xd8a3('0x45')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xd8a3('0x46')](_0x738ec2,{'showHidden':![],'depth':null}));emit(util[_0xd8a3('0x47')](_0xd8a3('0x48'),_0x738ec2['name']),_0xd8a3('0x49'),_0x738ec2);}}function checkGetDataPredictive(_0x5caf04){if(isNotNull(_0x5caf04)&&!_[_0xd8a3('0x4a')](_0x5caf04)){loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x4c'));loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x4d'),_0x5caf04['predictiveIntervalTotalCalls']);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x4e'),_0x5caf04[_0xd8a3('0x4f')]);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x50'),_0x5caf04[_0xd8a3('0x51')]);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x52'),_0x5caf04[_0xd8a3('0x53')]);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x54'),_0x5caf04['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd8a3('0x4b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5caf04['predictiveIntervalAvgTalktime']);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x55'));if(_0x5caf04[_0xd8a3('0x56')]>0x0){if(!_[_0xd8a3('0x42')](_0x5caf04[_0xd8a3('0x57')])&&_0x5caf04['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x58'));if(!_['isUndefined'](_0x5caf04[_0xd8a3('0x59')])&&_0x5caf04[_0xd8a3('0x59')]>0x0){return!![];}loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x5a'));}else{loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x5b'));}}else{loggerPredictive[_0xd8a3('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x26debd){return function(_0xb9a989){loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x5c'));loggerPredictive['info'](_0xd8a3('0x5d'),_0xb9a989[_0xd8a3('0x5e')]);loggerPredictive['info'](_0xd8a3('0x5f'),_0xb9a989[_0xd8a3('0x60')]);loggerPredictive['info'](_0xd8a3('0x61'),_0xb9a989['erlangAbandonmentRate']);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x62'),_0xb9a989[_0xd8a3('0x63')]);loggerPredictive['info'](_0xd8a3('0x61'),_0xb9a989[_0xd8a3('0x64')]);loggerPredictive['info'](_0xd8a3('0x55'));_[_0xd8a3('0x65')](_0x26debd,_0xb9a989);};}function ifInterval(_0x38e029,_0x128241){if(_[_0xd8a3('0x42')](_0x128241)){return![];}return utils[_0xd8a3('0x66')](undefined,_0x128241)<_0x38e029*0x3c;}function clearPredictiveAttributes(_0xc7afad){if(_0xc7afad['startProgressive']){_0xc7afad[_0xd8a3('0x2a')]=undefined;loggerPredictive['debug'](_0xc7afad[_0xd8a3('0x67')],'startProgressive\x20value\x20cleared');}if(_0xc7afad[_0xd8a3('0x29')]){_0xc7afad[_0xd8a3('0x29')]=undefined;loggerPredictive[_0xd8a3('0x45')](_0xc7afad[_0xd8a3('0x67')],_0xd8a3('0x68'));}if(_0xc7afad[_0xd8a3('0x69')]){clearInterval(_0xc7afad[_0xd8a3('0x69')]);_0xc7afad['handlePredictive']=undefined;loggerPredictive[_0xd8a3('0x45')](_0xc7afad['name'],_0xd8a3('0x6a'));}}function loggerCatchPredictive(_0x28ef3f,_0x206639){return function(_0x3727e0){loggerPredictive[_0xd8a3('0x6b')](_0x206639[_0xd8a3('0x67')],_0x28ef3f);loggerPredictive['error'](_0x3727e0[_0xd8a3('0x6c')]);clearPredictiveAttributes(_0x206639);};}function loggerCatch(_0x17b046){return function(_0x129c90){logger['error'](_0x17b046,util[_0xd8a3('0x46')](_0x129c90,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x37cead){return function(_0x1bde7f){if(isNotNull(_0x1bde7f)&&isNotNull(_0x1bde7f[0x0])){if(_0x1bde7f[0x0][_0xd8a3('0x6d')]>0x0){_0x37cead[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')]['CONTACTS_RESCHEDULED'];logger[_0xd8a3('0x4b')]('[getContactDialer2][ReScheduled]'+_0x37cead[_0xd8a3('0x67')],_0x1bde7f[0x0][_0xd8a3('0x6d')],_0xd8a3('0x70'));}else{_0x37cead['message']=utils[_0xd8a3('0x6f')][_0xd8a3('0x71')];logger[_0xd8a3('0x4b')]('[getContactDialer2][Empty]'+_0x37cead[_0xd8a3('0x67')]);}}};}function createObjHistory(_0x2992e2,_0x553f81,_0x4f8e09,_0x4a516b,_0x28ed64){_0x2992e2[_0xd8a3('0x6e')]=_0x4f8e09;var _0x30fa96=new Action(_0x2992e2,_0x553f81);var _0x320fa7=new History(_0x30fa96);_0x320fa7[_0xd8a3('0x72')]=_0x4a516b;_0x320fa7[_0xd8a3('0x73')]=_0x28ed64;_0x320fa7[_0xd8a3('0x74')]=_0x30fa96['starttime'];return _0x320fa7;}function unlockQueueStatus(_0x342ac4,_0x5d3a8d){setTimeout(function(){if(_[_0xd8a3('0x42')](_0x342ac4[_0xd8a3('0x75')])){loggerBooked[_0xd8a3('0x6b')](_0xd8a3('0x76'),_0x5d3a8d);}_0x342ac4[_0xd8a3('0x75')]=!![];loggerBooked[_0xd8a3('0x4b')](_0xd8a3('0x77'),_0x5d3a8d,JSON['stringify'](_['pick'](_0x342ac4,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4df7ff){return function(){if(!isNotNull(_0x4df7ff['Interval'])){_0x4df7ff[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')][_0xd8a3('0x78')];throw _0x4df7ff[_0xd8a3('0x67')]+_0xd8a3('0x79');}if(!isNotNull(_0x4df7ff[_0xd8a3('0x7a')][_0xd8a3('0x7b')])){_0x4df7ff['message']=utils[_0xd8a3('0x6f')]['NULL_INTERVAL'];throw _0x4df7ff['name']+_0xd8a3('0x79');}if(!isNotNull(_[_0xd8a3('0x4a')](_0x4df7ff['Interval'][_0xd8a3('0x7b')]))){_0x4df7ff[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')][_0xd8a3('0x78')];throw _0x4df7ff['name']+_0xd8a3('0x79');}};}function checkIsIVRCampaignActive(_0x268d33){return function(){if(!utils[_0xd8a3('0x7c')](_0x268d33)){_0x268d33[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')][_0xd8a3('0x7d')];throw _0x268d33['name']+_0xd8a3('0x7e');}};}function emitCampaignSummary(_0x223036){if(utils[_0xd8a3('0x7f')](_0x223036)){emit(util[_0xd8a3('0x47')](_0xd8a3('0x80'),_0x223036['name']),'campaign:save',_0x223036);}}function loggerCatchQueueSummary(_0x2056f7,_0x5d58f2){return function(_0x25b99c){clearPredictiveAttributes(_0x5d58f2);emitCampaignSummary(_0x5d58f2);loggerSyncQueueSummary['debug'](_0x2056f7,util['inspect'](_0x25b99c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5f1085){if(_0x5f1085['sendMessageOneNotActive']){if(_0x5f1085['originated']===0x0){_0x5f1085[_0xd8a3('0x81')]=![];_0x5f1085[_0xd8a3('0x6e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0xd8a3('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5f1085[_0xd8a3('0x67')],_0xd8a3('0x82'));}else{_0x5f1085['message']=utils[_0xd8a3('0x6f')][_0xd8a3('0x83')];loggerSyncQueueSummary[_0xd8a3('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5f1085[_0xd8a3('0x67')],'is\x20deactivated');}emitCampaignSummary(_0x5f1085);}}function myreject(_0x5c56f9){return function(_0x5073f4){return _0x5c56f9(msgResponse('[ifTime][Action]',_0xd8a3('0x84'),JSON[_0xd8a3('0x85')](_0x5073f4)));};}Dialer[_0xd8a3('0x86')][_0xd8a3('0x87')]=function(_0x39547f){return!_[_0xd8a3('0x42')](_0x39547f)&&_0x39547f&&!_[_0xd8a3('0x42')](_0x39547f[_0xd8a3('0x67')])&&!_[_0xd8a3('0x42')](_0x39547f['active'])&&_0x39547f['active']&&(this[_0xd8a3('0x24')][util[_0xd8a3('0x47')](_0xd8a3('0x88'),_0x39547f[_0xd8a3('0x67')])][_0xd8a3('0x89')]==='reachable'||this[_0xd8a3('0x24')][util[_0xd8a3('0x47')](_0xd8a3('0x88'),_0x39547f[_0xd8a3('0x67')])][_0xd8a3('0x89')]===_0xd8a3('0x8a'));};Dialer[_0xd8a3('0x86')][_0xd8a3('0x8b')]=function(_0x4e94a3){var _0x110619=this;return function(){if(!_0x110619['isTrunkReachable'](_0x4e94a3[_0xd8a3('0x8c')])){if(!_0x110619[_0xd8a3('0x87')](_0x4e94a3[_0xd8a3('0x8d')])){_0x4e94a3[_0xd8a3('0x6e')]=utils['CAMPAIGN_STATUS'][_0xd8a3('0x8e')];throw _0x4e94a3[_0xd8a3('0x67')]+_0xd8a3('0x8f');}}};};Dialer[_0xd8a3('0x86')][_0xd8a3('0x90')]=function(_0x29a560,_0xb43b8f,_0x566ca5,_0xd370a6){var _0x427dbf=this;return function(){var _0x50983f=!![];return _0x427dbf[_0xd8a3('0x91')](_0x29a560,_0xb43b8f,_0x566ca5,_0xd370a6,_0x50983f);};};Dialer[_0xd8a3('0x86')][_0xd8a3('0x92')]=function(_0x2a4b66,_0x361b92,_0x4ac2cd,_0xc0ba93){var _0x315596=this;return function(){var _0x3d6ad9=![];return _0x315596[_0xd8a3('0x91')](_0x2a4b66[_0xd8a3('0x7b')],_0x361b92,_0x4ac2cd,_0xc0ba93,_0x3d6ad9);};};Dialer['prototype'][_0xd8a3('0x91')]=function(_0x51ef05,_0x5d08f4,_0x436be0,_0x3320cd,_0x2d361c){var _0x2811e1=[];return new Promise(function(_0x24aba6,_0x2bf795){if(!isNotNull(_0x51ef05)){_0x3320cd[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')][_0xd8a3('0x78')];return _0x2bf795(msgResponse(_0xd8a3('0x93'),_0xd8a3('0x94'),_0x436be0+_0xd8a3('0x95')));}if(_[_0xd8a3('0x4a')](_0x51ef05)){_0x3320cd[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')]['EMPTY_INTERVAL'];return _0x2bf795(msgResponse(_0xd8a3('0x93'),_0xd8a3('0x94'),_0x436be0+_0xd8a3('0x96')));}if(_0x5d08f4&&_['isUndefined'](config[_0xd8a3('0x97')][_0x5d08f4])){_0x3320cd[_0xd8a3('0x6e')]=utils[_0xd8a3('0x6f')][_0xd8a3('0x98')];return _0x2bf795(msgResponse(_0xd8a3('0x93'),_0xd8a3('0x94'),_0x436be0+'\x20Timezone\x20unknow\x20'+_0x5d08f4));}if(_[_0xd8a3('0x99')](_0x51ef05)){for(var _0x547155=0x0;_0x547155<_0x51ef05['length'];_0x547155+=0x1){_0x2811e1[_0xd8a3('0x9a')](ami[_0xd8a3('0x9b')]({'action':_0xd8a3('0x9c'),'command':util['format'](_0xd8a3('0x9d'),_0x51ef05[_0x547155][_0xd8a3('0x9e')],!_[_0xd8a3('0x42')](config[_0xd8a3('0x97')][_0x5d08f4])?_0x5d08f4:'')})[_0xd8a3('0x40')](function(_0x338ca0){return _0x338ca0[_0xd8a3('0x9f')][_0xd8a3('0xa0')](_0xd8a3('0xa1'))>=0x0;})[_0xd8a3('0xa2')](myreject(_0x2bf795)));}}else{_0x2811e1[_0xd8a3('0x9a')](ami[_0xd8a3('0x9b')]({'action':_0xd8a3('0x9c'),'command':util[_0xd8a3('0x47')]('iftime\x20%s,%s',_0x51ef05,!_[_0xd8a3('0x42')](config[_0xd8a3('0x97')][_0x5d08f4])?_0x5d08f4:'')})[_0xd8a3('0x40')](function(_0x1b8db8){return _0x1b8db8[_0xd8a3('0x9f')]['indexOf'](_0xd8a3('0xa1'))>=0x0;})['catch'](myreject(_0x2bf795)));}Promise['all'](_0x2811e1)[_0xd8a3('0x40')](function(_0xc8836e){var _0x398da1=_[_0xd8a3('0xa3')](_0xc8836e);if(_0x398da1){return _0x24aba6(_0x398da1);}else{_0x3320cd[_0xd8a3('0x6e')]=_0x2d361c?utils[_0xd8a3('0x6f')][_0xd8a3('0xa4')]:utils[_0xd8a3('0x6f')][_0xd8a3('0xa5')];return _0x2bf795(msgResponse(_0xd8a3('0xa6'),_0xd8a3('0x94'),_0xd8a3('0xa7')+_0x2d361c+'\x20'+_0x436be0+_0xd8a3('0xa8')+util['inspect'](_0x51ef05,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5d08f4));}})['catch'](function(_0x4a299b){return _0x2bf795(msgResponse('ifTime','Failure',JSON[_0xd8a3('0x85')](_0x4a299b)));});});};Dialer[_0xd8a3('0x86')][_0xd8a3('0x3e')]=function(){var _0x555a72=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xd8a3('0x40')](function(){setInterval(function(){_0x555a72[_0xd8a3('0xa9')]();},0x3e8);});};Dialer[_0xd8a3('0x86')][_0xd8a3('0xa9')]=function(){var _0x147e93=this;var _0xc0ccb6;for(var _0x265d7c in this[_0xd8a3('0x22')]){if(typeof this[_0xd8a3('0x22')][_0x265d7c]!=='undefined'){_0xc0ccb6=this[_0xd8a3('0x22')][_0x265d7c];if(utils[_0xd8a3('0x7f')](_0xc0ccb6)&&utils[_0xd8a3('0x7c')](_0xc0ccb6)){_0xc0ccb6['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xd8a3('0x40')](checkIsIVRCampaignActive(_0xc0ccb6))[_0xd8a3('0x40')](checkInterval(_0xc0ccb6))[_0xd8a3('0x40')](_0x147e93[_0xd8a3('0x8b')](_0xc0ccb6))[_0xd8a3('0x40')](_0x147e93[_0xd8a3('0x90')](_0xc0ccb6['dialGlobalInterval'],_0xc0ccb6[_0xd8a3('0xaa')],_0xc0ccb6[_0xd8a3('0x67')],_0xc0ccb6))[_0xd8a3('0x40')](_0x147e93['checkIfTimeIntervals'](_0xc0ccb6[_0xd8a3('0x7a')],_0xc0ccb6[_0xd8a3('0xaa')],_0xc0ccb6[_0xd8a3('0x67')],_0xc0ccb6))['then'](_0x147e93[_0xd8a3('0xab')](_0xc0ccb6))[_0xd8a3('0xa2')](loggerCatchQueueSummary('[syncCampaigns]',_0xc0ccb6));}else{notSendMessagesCampaign(_0xc0ccb6);}}}};Dialer[_0xd8a3('0x86')][_0xd8a3('0xac')]=function(_0x269dbc){if(_0x269dbc[_0xd8a3('0xad')]!=='predictive'){clearPredictiveAttributes(_0x269dbc);}switch(_0x269dbc[_0xd8a3('0xad')]){case _0xd8a3('0xae'):this[_0xd8a3('0xaf')](_0x269dbc,0x1);break;case'power':this[_0xd8a3('0xaf')](_0x269dbc,_0x269dbc[_0xd8a3('0xb0')]);break;case _0xd8a3('0xb'):this[_0xd8a3('0xb')](_0x269dbc);break;case _0xd8a3('0xa'):this[_0xd8a3('0xaf')](_0x269dbc,0x1);break;default:logger[_0xd8a3('0x6b')](_0xd8a3('0xb1'),_0x269dbc[_0xd8a3('0x67')],'method\x20not\x20recognized');}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x93')]=function(_0x3a75bb,_0xc0419c){var _0x1763be=_0x3a75bb[_0xd8a3('0xaa')];var _0x84a6d8=_0xc0419c?_0x3a75bb['dialGlobalInterval']:_0x3a75bb['Interval'][_0xd8a3('0x7b')];logger[_0xd8a3('0xb2')]('Dialer::ifTime()',_0x84a6d8,_0x1763be,_0x3a75bb['name'],util[_0xd8a3('0x47')]('Voice\x20Queue\x20%s\x20$s',_0x3a75bb[_0xd8a3('0x67')],_0x3a75bb['id']));var _0xfe9f08=null;return Interval['intervalIftime'](_0x84a6d8,_0x1763be)[_0xd8a3('0x40')](function(_0x102a5c){if(_0x102a5c===!![]){return _0x102a5c;}else{_0x3a75bb[_0xd8a3('0x6e')]=_0xc0419c?utils[_0xd8a3('0x6f')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xd8a3('0xa5')];_0xfe9f08=msgResponse(_0xd8a3('0xa6'),_0xd8a3('0x94'),'Global:\x20'+_0xc0419c+'\x20'+_0x3a75bb[_0xd8a3('0x67')]+_0xd8a3('0xa8')+util[_0xd8a3('0x46')](_0x84a6d8,{'showHidden':![],'depth':null})+_0xd8a3('0xb3')+_0x1763be);}if(_0xfe9f08!==null){logger[_0xd8a3('0xb2')](_0xd8a3('0xb4'),_0xfe9f08);_0xfe9f08[_0xd8a3('0xb5')]=_0xc0419c;throw _0xfe9f08;}})[_0xd8a3('0xa2')](function(_0x35d65d){logger[_0xd8a3('0x6b')]('AMI\x20IfTime',_0x35d65d);throw msgResponse('[ifTime][Action]',_0xd8a3('0x84'),util['inspect'](_0x35d65d,{'showHidden':![],'depth':null}));});};Dialer[_0xd8a3('0x86')][_0xd8a3('0xb6')]=function(_0x5ed8af){if(this[_0xd8a3('0x21')][_0x5ed8af['queue']]){if(this[_0xd8a3('0x28')][_0x5ed8af[_0xd8a3('0xb7')]]&&this[_0xd8a3('0x28')][_0x5ed8af[_0xd8a3('0xb7')]]['type']!=='ivr'){utils[_0xd8a3('0xb8')](this[_0xd8a3('0x21')][_0x5ed8af[_0xd8a3('0xb9')]],'[syncAgentConnect]');this[_0xd8a3('0x28')][_0x5ed8af[_0xd8a3('0xb7')]][_0xd8a3('0xba')]=moment()[_0xd8a3('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xd8a3('0x86')]['syncAgentComplete']=function(_0x25ecd5){var _0x21d9a4=this['uniqueId'][_0x25ecd5['uniqueid']];if(this['voiceQueues'][_0x25ecd5[_0xd8a3('0xb9')]]){if(_0x21d9a4&&_0x21d9a4['type']!==_0xd8a3('0xbb')){delete this[_0xd8a3('0x28')][_0x25ecd5[_0xd8a3('0xb7')]];this[_0xd8a3('0x21')][_0x25ecd5[_0xd8a3('0xb9')]][_0xd8a3('0xbc')]+=0x1;var _0x55aaa8=new AgentComplete(_0x21d9a4,_0x25ecd5);if(_0x25ecd5[_0xd8a3('0xbd')]==='agent'){_0x55aaa8[_0xd8a3('0xbe')]=this[_0xd8a3('0x21')][_0x25ecd5[_0xd8a3('0xb9')]][_0xd8a3('0xbf')]&&this['voiceQueues'][_0x25ecd5[_0xd8a3('0xb9')]][_0xd8a3('0xc0')]?moment()[_0xd8a3('0x47')](_0xd8a3('0xc1')):undefined;}hopperUtils[_0xd8a3('0xc2')](_0x55aaa8)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0xc3')));hopperUtils[_0xd8a3('0xc4')](_0x55aaa8)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0xc5')));}}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x30')]=function(_0x3cbda9){var _0x355c96=this[_0xd8a3('0x28')][_0x3cbda9[_0xd8a3('0xb7')]];var _0x4d709f=this;var _0x354230=![];var _0x43fde0;var _0x4c83df;if(this[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]]){if(_0x355c96&&_0x355c96[_0xd8a3('0x43')]!=='ivr'){delete this['uniqueId'][_0x3cbda9['uniqueid']];utils['decrementOriginate'](this['voiceQueues'][_0x3cbda9[_0xd8a3('0xb9')]],_0xd8a3('0xc6'));_0x355c96[_0xd8a3('0xc7')]=moment()['format'](_0xd8a3('0xc1'));var _0x4b4a4a=new QueueCallerAbandon(_0x355c96,_0x3cbda9);if(utils['getSeconds'](_0x355c96[_0xd8a3('0xc7')],_0x355c96[_0xd8a3('0xc8')])>=_0x355c96[_0xd8a3('0xc9')]){this[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]][_0xd8a3('0x51')]+=0x1;this['voiceQueues'][_0x3cbda9['queue']][_0xd8a3('0xca')]+=0x1;this[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4b4a4a[_0xd8a3('0x72')]=0xa;_0x4b4a4a[_0xd8a3('0x73')]=_0xd8a3('0xcb');_0x4b4a4a[_0xd8a3('0xcc')]=_0xd8a3('0xcd');_0x4b4a4a['agiafterat']=this[_0xd8a3('0x21')][_0x3cbda9['queue']]['dialQueueProject2']?moment()[_0xd8a3('0x47')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4b4a4a[_0xd8a3('0xce')]+=0x1;_0x4b4a4a['countglobal']+=0x1;_0x43fde0=this[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]][_0xd8a3('0xcf')];_0x4c83df=this[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]][_0xd8a3('0xd0')];hopperUtils[_0xd8a3('0xd1')](_0x4b4a4a,_0x4b4a4a[_0xd8a3('0x72')],_0x355c96[_0xd8a3('0xd2')])[_0xd8a3('0x40')](function(_0x3b1160){_0x354230=_0x3b1160[_0xd8a3('0xd3')]==0x1;if(_0x4b4a4a[_0xd8a3('0xce')]>=_0x4d709f[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]][_0xd8a3('0xd4')]){_0x4d709f[_0xd8a3('0xd5')](_0x4b4a4a,_0x3b1160['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4b4a4a[_0xd8a3('0xce')],'scheduledat':moment()[_0xd8a3('0xd6')](_0x4d709f[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]]['dialDropRetryFrequency'],_0xd8a3('0xd7'))[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x355c96['ContactId'],'ListId':_0x355c96[_0xd8a3('0xd8')],'VoiceQueueId':_0x355c96[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x355c96[_0xd8a3('0xda')]||undefined})['catch'](loggerCatch(_0xd8a3('0xdb')));var _0x5b33ba=new History(_0x4b4a4a);_0x5b33ba[_0xd8a3('0x72')]=0xa;_0x5b33ba['statedesc']=_0xd8a3('0xcb');_0x5b33ba[_0xd8a3('0xdc')]=moment()[_0xd8a3('0x47')](_0xd8a3('0xc1'));_0x5b33ba['endtime']=_0x5b33ba[_0xd8a3('0xdc')];_0x5b33ba['calleridname']=_0x4b4a4a[_0xd8a3('0xdd')];_0x5b33ba[_0xd8a3('0xde')]=_0x4b4a4a[_0xd8a3('0xde')];hopperUtils['createHistory'](_0x5b33ba)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xd8a3('0x40')](function(){if(_0x354230)hopperUtils['swapAdditionalPhones'](_0x4b4a4a,_0x43fde0,_0x4c83df)[_0xd8a3('0x40')](function(){return 0x1;});});}else{this['voiceQueues'][_0x3cbda9['queue']][_0xd8a3('0x53')]+=0x1;this[_0xd8a3('0x21')][_0x3cbda9['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x4b4a4a['state']=0xb;_0x4b4a4a[_0xd8a3('0x73')]=_0xd8a3('0xdf');_0x4b4a4a[_0xd8a3('0xcc')]='CALLEREXIT';_0x4b4a4a[_0xd8a3('0xe0')]+=0x1;_0x4b4a4a[_0xd8a3('0xe1')]+=0x1;_0x43fde0=this[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]][_0xd8a3('0xe2')];_0x4c83df=this[_0xd8a3('0x21')][_0x3cbda9['queue']][_0xd8a3('0xd0')];hopperUtils[_0xd8a3('0xd1')](_0x4b4a4a,_0x4b4a4a[_0xd8a3('0x72')],_0x355c96[_0xd8a3('0xd2')])[_0xd8a3('0x40')](function(_0x27e6b6){if(_0x4b4a4a[_0xd8a3('0xe0')]>=_0x4d709f['voiceQueues'][_0x3cbda9[_0xd8a3('0xb9')]]['dialAbandonedMaxRetry']){_0x4d709f['queueCallerAbandonCreateState'](_0x4b4a4a,_0x27e6b6[_0xd8a3('0xd3')]);}else{hopperUtils[_0xd8a3('0xe3')]({'active':![],'countabandonedretry':_0x4b4a4a['countabandonedretry'],'scheduledat':moment()[_0xd8a3('0xd6')](_0x4d709f[_0xd8a3('0x21')][_0x3cbda9[_0xd8a3('0xb9')]]['dialAbandonedRetryFrequency'],'minutes')['format'](_0xd8a3('0xc1')),'ContactId':_0x355c96['ContactId'],'ListId':_0x355c96['ListId'],'VoiceQueueId':_0x355c96[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x355c96['CampaignId']||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0xe4')));var _0x5937ef=new History(_0x4b4a4a);_0x5937ef[_0xd8a3('0x72')]=0xb;_0x5937ef['statedesc']='Abandoned';_0x5937ef[_0xd8a3('0xdc')]=moment()[_0xd8a3('0x47')](_0xd8a3('0xc1'));_0x5937ef[_0xd8a3('0x74')]=_0x5937ef['starttime'];_0x5937ef[_0xd8a3('0xdd')]=_0x4b4a4a[_0xd8a3('0xdd')];_0x5937ef['calleridnum']=_0x4b4a4a['calleridnum'];hopperUtils[_0xd8a3('0xc2')](_0x5937ef)['catch'](loggerCatch(_0xd8a3('0xe5')));}})['then'](function(){if(_0x354230)hopperUtils[_0xd8a3('0xe6')](_0x4b4a4a,_0x43fde0,_0x4c83df)[_0xd8a3('0x40')](function(){return 0x1;});});}}}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x39')]=function(_0x25a32b){if(this[_0xd8a3('0xe7')][_0x25a32b[_0xd8a3('0xb7')]]){this['actions'][_0x25a32b[_0xd8a3('0xb7')]][_0xd8a3('0xe8')]=_0x25a32b[_0xd8a3('0xe8')];}if(this[_0xd8a3('0x28')][_0x25a32b[_0xd8a3('0xb7')]]){this[_0xd8a3('0x28')][_0x25a32b[_0xd8a3('0xb7')]]['channel']=_0x25a32b[_0xd8a3('0xe8')];}};Dialer[_0xd8a3('0x86')]['syncQueueMember']=function(_0x44b380){if(!this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]]){return;}var _0x2e4fa4=this[_0xd8a3('0x21')][this['actions'][_0x44b380['actionid']][_0xd8a3('0xb9')]][_0xd8a3('0xea')]||_0xd8a3('0xeb');if(_0x2e4fa4==='roundrobin'){if(this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]]&&_[_0xd8a3('0xec')](this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]][_0xd8a3('0xed')])&&_0x44b380[_0xd8a3('0x89')]==='1'&&_0x44b380['paused']==='0'){if(this[_0xd8a3('0x23')][_0x44b380['stateinterface']]){if(!this[_0xd8a3('0x23')][_0x44b380[_0xd8a3('0xee')]][_0xd8a3('0xed')]){this['agents'][_0x44b380[_0xd8a3('0xee')]]['locked']=!![];this['actions'][_0x44b380['actionid']][_0xd8a3('0xed')]=!![];this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]][_0xd8a3('0xee')]=_0x44b380[_0xd8a3('0xee')];}}}}else if(_0x2e4fa4==='rrmemory'){if(this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]]){if(this[_0xd8a3('0x23')][_0x44b380[_0xd8a3('0xee')]]){this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]][_0xd8a3('0xee')]=_0x44b380[_0xd8a3('0xee')];if(_[_0xd8a3('0xec')](this[_0xd8a3('0x2b')][this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]]['queue']])){this['queueBooked'][this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]]=[];}this[_0xd8a3('0x2b')][this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]]['push'](_[_0xd8a3('0x65')](_['pick'](this[_0xd8a3('0xe7')][_0x44b380[_0xd8a3('0xe9')]],[_0xd8a3('0xef'),_0xd8a3('0xee')]),{'status':_0x44b380[_0xd8a3('0x89')],'paused':_0x44b380[_0xd8a3('0xf0')]}));}}}};Dialer[_0xd8a3('0x86')][_0xd8a3('0xf1')]=function(_0x56cfd2){if(!this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]]){return;}var _0x8ce859=this;var _0x16393f=this[_0xd8a3('0x21')][this[_0xd8a3('0xe7')][_0x56cfd2['actionid']]['queue']];var _0x56eb1e=_0x16393f[_0xd8a3('0xea')]||_0xd8a3('0xeb');if(_0x56eb1e==='roundrobin'){if(this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]]&&this[_0xd8a3('0xe7')][_0x56cfd2['actionid']][_0xd8a3('0xee')]){this[_0xd8a3('0x20')][_0xd8a3('0xf2')](this['actions'][_0x56cfd2['actionid']][_0xd8a3('0xef')],this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xee')])[_0xd8a3('0xa2')](function(_0xb9de34){logger[_0xd8a3('0x6b')](_0xd8a3('0xf3'),util[_0xd8a3('0x46')](_0xb9de34,{'showHidden':![],'depth':null}));})[_0xd8a3('0x1e')](function(){utils[_0xd8a3('0xb8')](_0x8ce859[_0xd8a3('0x21')][_0x8ce859[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]],_0xd8a3('0xf4'));_0x8ce859[_0xd8a3('0x23')][_0x8ce859['actions'][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xee')]][_0xd8a3('0xed')]=![];delete _0x8ce859[_0xd8a3('0xe7')][_0x56cfd2['actionid']];unlockQueueStatus(_0x16393f);});}else{utils['decrementOriginate'](this['voiceQueues'][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]],'[syncQueueStatusComplete]');hopperUtils[_0xd8a3('0xe3')]({'active':![],'ContactId':this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xf5')],'ListId':this[_0xd8a3('0xe7')][_0x56cfd2['actionid']][_0xd8a3('0xd8')],'VoiceQueueId':this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xd9')]||undefined,'CampaignId':this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xda')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd8a3('0xe7')][_0x56cfd2['actionid']];unlockQueueStatus(_0x16393f);}}else if(_0x56eb1e===_0xd8a3('0xeb')){var _0x14df89;if(this['actions'][_0x56cfd2[_0xd8a3('0xe9')]]&&!_['isEmpty'](this[_0xd8a3('0x2b')][this['actions'][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]])){if(this['queueBookedRR'][_0x8ce859[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]]){this[_0xd8a3('0xf6')][_0x8ce859[_0xd8a3('0xe7')][_0x56cfd2['actionid']]['queue']]=this['queueBookedRR'][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]]?this[_0xd8a3('0xf6')][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]]:this[_0xd8a3('0x2b')][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]]['queue']]?this[_0xd8a3('0x2b')][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]][_0xd8a3('0xf7')]||0x0:0x0;}this[_0xd8a3('0x2b')][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]]['_rr']=this[_0xd8a3('0xf6')][this[_0xd8a3('0xe7')][_0x56cfd2[_0xd8a3('0xe9')]][_0xd8a3('0xb9')]];for(var _0x1b33f3=0x0;_0x1b33f3=_0x85abcd[_0xd8a3('0x120')]){_0x40de90[_0xd8a3('0x121')](_0x572e1c,_0x194abc,_0x49cfc2,_0xd8a3('0x122'));}else{if(_0x572e1c[_0xd8a3('0x11e')]>=_0x85abcd[_0xd8a3('0x123')]){_0x40de90[_0xd8a3('0x124')](_0x572e1c,_0x194abc,_0x49cfc2,_0xd8a3('0x125'));}else{hopperUtils[_0xd8a3('0xe3')]({'active':![],'countmachineretry':_0x572e1c[_0xd8a3('0x11e')],'scheduledat':moment()[_0xd8a3('0xd6')](_0x85abcd['dialMachineRetryFrequency'],_0xd8a3('0xd7'))[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x572e1c['ContactId'],'ListId':_0x572e1c[_0xd8a3('0xd8')],'VoiceQueueId':_0x572e1c['VoiceQueueId']||undefined,'CampaignId':_0x572e1c[_0xd8a3('0xda')]||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x126')));_0x194abc({'reschedule':0x1});}}});}if(_0x2abde0[_0xd8a3('0x43')]===_0xd8a3('0xbb')&&this['campaigns'][_0x2abde0[_0xd8a3('0xb9')]][_0xd8a3('0x10a')]&&_0x366de2[_0xd8a3('0x10b')]==='HANGUP'){delete this[_0xd8a3('0x28')][_0x366de2['uniqueid']];utils['decrementOriginate'](this['campaigns'][_0x2abde0[_0xd8a3('0xb9')]],_0xd8a3('0x10d'));_0x419c75=new Hangup(_0x2abde0,_0x366de2);_0x419c75[_0xd8a3('0x72')]=0x12;_0x419c75[_0xd8a3('0x73')]=_0xd8a3('0x127');_0x419c75[_0xd8a3('0x117')]=_0xd8a3('0x10f');ami[_0xd8a3('0x110')](_0xd8a3('0x118'),ut[_0xd8a3('0x111')](_0x419c75,_0xd8a3('0x112')));this['saveInDb'](_0x419c75,_0xd8a3('0x128'),_0xd8a3('0x129'));}if(_0x2abde0['type']===_0xd8a3('0xbb')&&this[_0xd8a3('0x22')][_0x2abde0[_0xd8a3('0xb9')]][_0xd8a3('0x10a')]&&_0x366de2[_0xd8a3('0x10b')]===_0xd8a3('0x116')){return new Promise(function(_0x452ac7,_0x41febc){delete _0x40de90[_0xd8a3('0x28')][_0x366de2[_0xd8a3('0xb7')]];utils[_0xd8a3('0xb8')](_0x40de90[_0xd8a3('0x22')][_0x2abde0[_0xd8a3('0xb9')]],_0xd8a3('0x10d'));_0x40de90[_0xd8a3('0x22')][_0x2abde0['queue']][_0xd8a3('0xbc')]+=0x1;_0x40de90[_0xd8a3('0x22')][_0x2abde0[_0xd8a3('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x434e89=_0x40de90['campaigns'][_0x2abde0['queue']];var _0xb97822=new Hangup(_0x2abde0,_0x366de2);_0xb97822[_0xd8a3('0x72')]=0x13;_0xb97822[_0xd8a3('0x73')]=_0xd8a3('0x12a');_0xb97822['membername']=_0xd8a3('0x10f');_0xb97822['countmachineretry']+=0x1;_0xb97822[_0xd8a3('0xe1')]+=0x1;_0xb97822[_0xd8a3('0x112')]=!![];ami[_0xd8a3('0x110')]('custom:amd',ut[_0xd8a3('0x111')](_0xb97822,_0xd8a3('0x112')));hopperUtils[_0xd8a3('0xc2')](_0xb97822)[_0xd8a3('0xa2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xb97822['countbusyretry']+_0xb97822[_0xd8a3('0x11b')]+_0xb97822[_0xd8a3('0x11c')]+_0xb97822[_0xd8a3('0x11d')]+_0xb97822[_0xd8a3('0xce')]+_0xb97822['countabandonedretry']+_0xb97822[_0xd8a3('0x11e')]+_0xb97822[_0xd8a3('0x11f')]>=_0x434e89['dialGlobalMaxRetry']){_0x40de90['stateGlobal'](_0xb97822,_0x452ac7,_0x41febc,_0xd8a3('0x122'));}else{if(_0xb97822[_0xd8a3('0x11e')]>=_0x434e89['dialMachineMaxRetry']){_0x40de90[_0xd8a3('0x124')](_0xb97822,_0x452ac7,_0x41febc,_0xd8a3('0x125'));}else{hopperUtils[_0xd8a3('0xe3')]({'active':![],'countmachineretry':_0xb97822[_0xd8a3('0x11e')],'scheduledat':moment()['add'](_0x434e89[_0xd8a3('0x12b')],_0xd8a3('0xd7'))[_0xd8a3('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb97822[_0xd8a3('0xf5')],'ListId':_0xb97822[_0xd8a3('0xd8')],'VoiceQueueId':_0xb97822[_0xd8a3('0xd9')]||undefined,'CampaignId':_0xb97822['CampaignId']||undefined})['catch'](loggerCatch(_0xd8a3('0x126')));_0x452ac7({'reschedule':0x1});}}});}}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x37')]=function(_0x58e628){var _0x25fd51=this['uniqueId'][_0x58e628['uniqueid']];var _0x315006;if(!_0x25fd51){return;}if(_0x25fd51['type']==='ivr'){delete this[_0xd8a3('0x28')][_0x58e628['uniqueid']];utils[_0xd8a3('0xb8')](this[_0xd8a3('0x22')][_0x25fd51[_0xd8a3('0xb9')]],'[syncHangup]');this[_0xd8a3('0x22')][_0x25fd51[_0xd8a3('0xb9')]][_0xd8a3('0x12c')]+=0x1;if(_0x58e628[_0xd8a3('0x12d')]==='Normal\x20Clearing'){const _0x4b13d9=new AgentComplete(_0x25fd51,_0x58e628);_0x4b13d9['CampaignId']=this['campaigns'][_0x25fd51[_0xd8a3('0xb9')]]['id'];hopperUtils[_0xd8a3('0xc2')](_0x4b13d9)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x12e')));hopperUtils['moveContactManagedDialer'](_0x4b13d9)[_0xd8a3('0xa2')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x315006=new Hangup(_0x25fd51,_0x58e628);hopperUtils['createHistory'](_0x315006)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x12f')));hopperUtils[_0xd8a3('0xc4')](_0x315006)[_0xd8a3('0xa2')](loggerCatch('[syncHangupIvr]'));}}else{if(isNotNull(this[_0xd8a3('0x21')][_0x25fd51[_0xd8a3('0xb9')]][_0xd8a3('0x130')])){delete this[_0xd8a3('0x28')][_0x58e628[_0xd8a3('0xb7')]];utils['decrementOriginate'](this['voiceQueues'][_0x25fd51[_0xd8a3('0xb9')]],_0xd8a3('0x131'));this[_0xd8a3('0x21')][_0x25fd51[_0xd8a3('0xb9')]][_0xd8a3('0xbc')]+=0x1;this[_0xd8a3('0x21')][_0x25fd51[_0xd8a3('0xb9')]][_0xd8a3('0x10e')]+=0x1;_0x315006=new Hangup(_0x25fd51,_0x58e628);_0x315006['state']=0x10;_0x315006[_0xd8a3('0x73')]=_0xd8a3('0x132');_0x315006[_0xd8a3('0x117')]=_0xd8a3('0x133');hopperUtils[_0xd8a3('0xc2')](_0x315006)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x12f')));hopperUtils['moveContactManagedDialer'](_0x315006)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x134')));}else{delete this['uniqueId'][_0x58e628[_0xd8a3('0xb7')]];utils[_0xd8a3('0xb8')](this[_0xd8a3('0x21')][_0x25fd51[_0xd8a3('0xb9')]],_0xd8a3('0x135'));if(_0x58e628[_0xd8a3('0x12d')]===_0xd8a3('0x136')){this[_0xd8a3('0x21')][_0x25fd51[_0xd8a3('0xb9')]][_0xd8a3('0xbc')]+=0x1;const _0x1a8b9d=new AgentComplete(_0x25fd51,_0x58e628);_0x1a8b9d[_0xd8a3('0xd9')]=this[_0xd8a3('0x21')][_0x25fd51[_0xd8a3('0xb9')]]['id'];hopperUtils['createHistory'](_0x1a8b9d)['catch'](loggerCatch(_0xd8a3('0xc3')));hopperUtils[_0xd8a3('0xc4')](_0x1a8b9d)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0xc5')));}else{this['voiceQueues'][_0x25fd51[_0xd8a3('0xb9')]][_0xd8a3('0x137')]+=0x1;_0x315006=new Hangup(_0x25fd51,_0x58e628);_0x315006[_0xd8a3('0x72')]=0xc;_0x315006[_0xd8a3('0x73')]=_0x58e628[_0xd8a3('0x12d')];_0x315006['membername']=_0xd8a3('0x138');hopperUtils[_0xd8a3('0xc2')](_0x315006)[_0xd8a3('0xa2')](loggerCatch('[syncHangup][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x315006)[_0xd8a3('0xa2')](loggerCatch('[syncHangup]'));}}}};Dialer[_0xd8a3('0x86')][_0xd8a3('0xd')]=function(_0x21a47d){var _0x2803c8=this;if(!_0x2803c8[_0xd8a3('0x2c')][_0x21a47d[_0xd8a3('0x67')]]){_0x2803c8[_0xd8a3('0x2c')][_0x21a47d['name']]={'running':![]};}else if(_0x2803c8['queuesSummary'][_0x21a47d[_0xd8a3('0x67')]][_0xd8a3('0x139')]===!![]){return;}else if(_0x2803c8[_0xd8a3('0x2c')][_0x21a47d[_0xd8a3('0x67')]][_0xd8a3('0x139')]===![]){_0x2803c8['queuesSummary'][_0x21a47d['name']][_0xd8a3('0x139')]=!![];}var _0x43ad5c=_0x2803c8[_0xd8a3('0x21')][_0x21a47d['name']];var _0x366e02=_0x43ad5c[_0xd8a3('0x6e')]!==utils[_0xd8a3('0x6f')][_0xd8a3('0x7d')];var _0xa06542=utils[_0xd8a3('0x13a')](_0x43ad5c);_0x43ad5c[_0xd8a3('0x13b')]=utils['getQueueCampaignStatusMessage'](_0x43ad5c,_0x2803c8['trunks']);Promise['resolve']()[_0xd8a3('0x40')](function(){if(_0x43ad5c[_0xd8a3('0x13b')]===utils[_0xd8a3('0x6f')]['INACTIVE']){if(_0x366e02){clearPredictiveAttributes(_0x43ad5c);_0x21a47d['startPredictive']=undefined;_0x21a47d[_0xd8a3('0x2a')]=undefined;}if(_0x43ad5c['statusMessage']===utils[_0xd8a3('0x6f')][_0xd8a3('0x7d')]){_0x21a47d[_0xd8a3('0x13c')]=0x0;_0x21a47d[_0xd8a3('0xf0')]=0x0;_0x21a47d[_0xd8a3('0x13d')]=0x0;_0x21a47d[_0xd8a3('0x13e')]=0x0;_0x21a47d[_0xd8a3('0x13f')]=0x0;}}else if(_0x43ad5c[_0xd8a3('0x13b')]===utils[_0xd8a3('0x6f')][_0xd8a3('0x140')]&&!_0xa06542){return _0x2803c8[_0xd8a3('0x93')](_0x43ad5c,!![])['then'](function(){return _0x2803c8[_0xd8a3('0x93')](_0x43ad5c,![]);})[_0xd8a3('0x40')](function(){return _0x2803c8[_0xd8a3('0xac')](_0x43ad5c);})['catch'](function(_0xb3816a){loggerSyncQueueSummary[_0xd8a3('0x45')](_0xd8a3('0x141'),util[_0xd8a3('0x46')](_0xb3816a,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x43ad5c);});}else{clearPredictiveAttributes(_0x43ad5c);}})['then'](function(){var _0x5e340f=_0x21a47d[_0xd8a3('0x142')](_0x43ad5c);if(_0x5e340f||_0x43ad5c[_0xd8a3('0x143')]){_0x43ad5c['queueSummaryCountersUpdated']=![];_0x21a47d[_0xd8a3('0x144')](_0x43ad5c);Object[_0xd8a3('0x145')](_0x43ad5c,_0x21a47d);emitOutboundVoiceQueueSummary(_0x21a47d);}_0x2803c8[_0xd8a3('0x2c')][_0x43ad5c[_0xd8a3('0x67')]][_0xd8a3('0x139')]=![];})['catch'](function(_0x17e3d0){logger['error'](_0xd8a3('0x141'),util[_0xd8a3('0x46')](_0x17e3d0,{'showHidden':![],'depth':null}));_0x2803c8[_0xd8a3('0x2c')][_0x43ad5c['name']][_0xd8a3('0x139')]=![];});};Dialer[_0xd8a3('0x86')][_0xd8a3('0x35')]=_[_0xd8a3('0x146')](function(){var _0x55b73c=_[_0xd8a3('0x147')](this['voiceQueues'],function(_0x537d87){return _0x537d87['dialPreviewRecallmeReminder'];});var _0x1f4886=_[_0xd8a3('0x147')](this[_0xd8a3('0x23')],function(_0x15d8e4){return _0x15d8e4[_0xd8a3('0x148')]&&_0x15d8e4['status']===_0xd8a3('0x149');});if(_0x55b73c[_0xd8a3('0xf8')]>0x0&&_0x1f4886[_0xd8a3('0xf8')]>0x0){return Promise[_0xd8a3('0x14a')]()[_0xd8a3('0x40')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x55b73c,'id'),previewRecallmeReminderInterval,_['map'](_0x1f4886,'id')))[_0xd8a3('0x40')](function(_0x8ca126){for(var _0x12052e=0x0;_0x12052e<_0x8ca126[_0xd8a3('0xf8')];_0x12052e++){var _0x397478=_0x8ca126[_0x12052e][_0xd8a3('0x14b')][_0xd8a3('0x67')];if(_0x397478)io['to'](util[_0xd8a3('0x47')](_0xd8a3('0x14c'),_0x397478))[_0xd8a3('0x110')](_0xd8a3('0x14d'),{'hopper':_0x8ca126[_0x12052e]});}})[_0xd8a3('0xa2')](function(_0x2102af){logger[_0xd8a3('0x6b')](_0xd8a3('0x14e'),_0x2102af);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xd8a3('0x86')][_0xd8a3('0x14f')]=function(){var _0x1d20e3=this;setInterval(function(){_0x1d20e3['clearZombieChannels'](_0x1d20e3['uniqueId'],_0xd8a3('0x150'));_0x1d20e3[_0xd8a3('0x151')](_0x1d20e3[_0xd8a3('0xe7')],_0xd8a3('0x152'));},0x32c8);};Dialer['prototype'][_0xd8a3('0x151')]=function(_0x3cf7a9,_0xf93527){var _0x343cbb=this;for(var _0x46f5d4 in _0x3cf7a9){if(typeof _0x3cf7a9[_0x46f5d4]!=='undefined'){this['sequence'][_0xd8a3('0x1c')](function(){if(!_[_0xd8a3('0xec')](_0x3cf7a9[_0x46f5d4])){return ami[_0xd8a3('0x9b')]({'action':_0xd8a3('0x89'),'channel':_0x3cf7a9[_0x46f5d4]['channel']})[_0xd8a3('0xa2')](function(_0x2a2e8a){if(_0x2a2e8a[_0xd8a3('0x6e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3cf7a9[_0x46f5d4]&&_0x3cf7a9[_0x46f5d4][_0xd8a3('0x43')]!==_0xd8a3('0xbb')){utils[_0xd8a3('0xb8')](_0x343cbb[_0xd8a3('0x21')][_0x3cf7a9[_0x46f5d4][_0xd8a3('0xb9')]],'[clearZombieChannels]');logger[_0xd8a3('0x6b')](_0xd8a3('0x153'),_0xf93527,_0x46f5d4,_0x3cf7a9[_0x46f5d4][_0xd8a3('0xb9')]);delete _0x3cf7a9[_0x46f5d4];}if(_0x3cf7a9[_0x46f5d4]&&_0x3cf7a9[_0x46f5d4][_0xd8a3('0x43')]===_0xd8a3('0xbb')){utils['decrementOriginate'](_0x343cbb['campaigns'][_0x3cf7a9[_0x46f5d4][_0xd8a3('0xb9')]],_0xd8a3('0x154'));logger[_0xd8a3('0x6b')](_0xd8a3('0x155'),_0xf93527,_0x46f5d4,_0x3cf7a9[_0x46f5d4]['queue']);delete _0x3cf7a9[_0x46f5d4];}},0x2328);}});}});}}};Dialer['prototype'][_0xd8a3('0x156')]=function(_0x37c16d){return Promise[_0xd8a3('0x14a')]()[_0xd8a3('0x40')](voiceQueueRt[_0xd8a3('0x156')](_0x37c16d))[_0xd8a3('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xd8a3('0x157')]=function(_0x3b2433,_0x60eb3c,_0x12a241){var _0x16c3e0={'state':0x19,'statedesc':_0xd8a3('0x158')};utils[_0xd8a3('0xb8')](_0x60eb3c,'[emptyContact]'+_0x3b2433);this[_0xd8a3('0x113')](_[_0xd8a3('0x65')](_0x16c3e0,_[_0xd8a3('0xfc')](_0x12a241,[_0xd8a3('0xf5'),_0xd8a3('0xd8'),'UserId',_0xd8a3('0xd9'),_0xd8a3('0xda')])),_0xd8a3('0x159'),_0xd8a3('0x15a'));logger['error'](_0x3b2433);};Dialer[_0xd8a3('0x86')]['saveInDb']=function(_0x214f3,_0x18bed2,_0xb47be4){hopperUtils[_0xd8a3('0xc2')](_0x214f3)[_0xd8a3('0xa2')](loggerCatch(_0x18bed2));hopperUtils['moveContactManagedDialer'](_0x214f3)[_0xd8a3('0xa2')](loggerCatch(_0xb47be4));};Dialer[_0xd8a3('0x86')][_0xd8a3('0xd5')]=function(_0x522a76,_0x4419b8){hopperUtils[_0xd8a3('0xc2')](_0x522a76)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0xc3')));if(_0x4419b8==0x0){hopperUtils['moveContactManagedDialer'](_0x522a76)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x15b')));}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x14e')]=function(_0xef621c){return Promise[_0xd8a3('0x14a')]()['then'](cmHopper[_0xd8a3('0x15c')](_0xef621c['id'],previewRecallmeReminderInterval))[_0xd8a3('0x40')](function(_0x40a247){for(var _0x8a8807=0x0;_0x8a8807<_0x40a247['length'];_0x8a8807++){var _0x53b3cf=_0x40a247[_0x8a8807][_0xd8a3('0x14b')]['name'];if(_0x53b3cf)io['to'](util[_0xd8a3('0x47')](_0xd8a3('0x14c'),_0x53b3cf))[_0xd8a3('0x110')](_0xd8a3('0x14d'),{'hopper':_0x40a247[_0x8a8807]});}})[_0xd8a3('0xa2')](function(){});};Dialer[_0xd8a3('0x86')][_0xd8a3('0xab')]=function(_0x4ca65f){var _0xabdb93=this;return function(){_0xabdb93[_0xd8a3('0x15d')](_0x4ca65f);};};Dialer[_0xd8a3('0x86')]['actionOriginate']=function(_0x3177c5,_0x168d34){var _0x2631d6=this;var _0x540bdb=uuid['v4']();this[_0xd8a3('0xe7')][_0x540bdb]=new Action(_0x3177c5,_0x168d34,_0x540bdb);return new Promise(function(_0x146e83,_0x3c33a9){if(_[_0xd8a3('0x42')](_0x3177c5)&&typeof _0x3177c5!==_0xd8a3('0x15e')){return _0x3c33a9(msgResponse(_0xd8a3('0x15f'),_0xd8a3('0x94'),_0xd8a3('0x160')));}if(_[_0xd8a3('0x42')](_0x168d34['phone'])||_0x168d34[_0xd8a3('0x161')]===null){return _0x3c33a9(msgResponse(_0xd8a3('0x15f'),_0xd8a3('0x94'),_0xd8a3('0x162')));}var _0x8e6168={'XMD-CALLERID':_0x2631d6[_0xd8a3('0xe7')][_0x540bdb]['getCaller'](),'XMD-AGI':_0x3177c5['dialQueueProject']?util[_0xd8a3('0x47')](_0xd8a3('0x163'),ipAgi,_0x3177c5['dialQueueProject']):_0xd8a3('0x164'),'XMD-AGIAFTER':_0x3177c5[_0xd8a3('0xbf')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3177c5[_0xd8a3('0xbf')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x3177c5)?util[_0xd8a3('0x47')](_0xd8a3('0x165'),_0x3177c5[_0xd8a3('0x67')],_0x3177c5[_0xd8a3('0x166')]||'',_0x3177c5[_0xd8a3('0xc0')]?'c':'',_0x3177c5[_0xd8a3('0xc9')]||0x3):_0xd8a3('0x164'),'XMD-CONTACTID':_0x168d34[_0xd8a3('0xf5')],'XMD-CDRTYPE':_0xd8a3('0x9'),'CALLERID(all)':_0x2631d6['actions'][_0x540bdb][_0xd8a3('0x167')](),'XMD-AMD':_0x3177c5['dialAMDActive']?_0xd8a3('0x140'):_0xd8a3('0x164'),'XMD-DESTINATION':_0xd8a3('0x168')};if(_0x3177c5[_0xd8a3('0x10a')]){_0x8e6168[_0xd8a3('0x169')]=_0x3177c5[_0xd8a3('0x16a')]||0x9c4;_0x8e6168[_0xd8a3('0x16b')]=_0x3177c5[_0xd8a3('0x16c')]||0x5dc;_0x8e6168[_0xd8a3('0x16d')]=_0x3177c5['dialAMDAfterGreetingSilence']||0x320;_0x8e6168[_0xd8a3('0x16e')]=_0x3177c5['dialAMDTotalAnalysisTime']||0x1388;_0x8e6168[_0xd8a3('0x16f')]=_0x3177c5[_0xd8a3('0x170')]||0x64;_0x8e6168['XMD-AMDBETWEENWORDSSILENCE']=_0x3177c5['dialAMDBetweenWordsSilence']||0x32;_0x8e6168[_0xd8a3('0x171')]=_0x3177c5[_0xd8a3('0x172')]||0x3;_0x8e6168[_0xd8a3('0x173')]=_0x3177c5[_0xd8a3('0x174')]||0x100;_0x8e6168[_0xd8a3('0x175')]=_0x3177c5[_0xd8a3('0x176')]||0x1388;}if(utils[_0xd8a3('0x177')](_0x3177c5)){_0x8e6168[_0xd8a3('0x178')]=_0x168d34[_0xd8a3('0xd9')];}else{_0x8e6168['XMD-CAMPAIGNID']=_0x168d34[_0xd8a3('0xda')];}var _0x504b20=utils[_0xd8a3('0x179')](_0x168d34[_0xd8a3('0x17a')]);Object[_0xd8a3('0x145')](_0x8e6168,_0x504b20);var _0x812c8a=_0x2631d6[_0xd8a3('0x87')](_0x3177c5[_0xd8a3('0x8c')])?utils[_0xd8a3('0x17b')](_0x3177c5[_0xd8a3('0x8c')][_0xd8a3('0x17c')],_0x3177c5[_0xd8a3('0x17d')],_0x3177c5[_0xd8a3('0x17e')]>0x0?utils[_0xd8a3('0x17f')](_0x3177c5[_0xd8a3('0x180')],_0x3177c5['dialRandomLastDigitCallerIdNumber']):_0x3177c5[_0xd8a3('0x180')]):utils[_0xd8a3('0x17b')](_['isNil'](_0x3177c5[_0xd8a3('0x8d')])?_0x3177c5[_0xd8a3('0x8c')][_0xd8a3('0x17c')]:_0x3177c5[_0xd8a3('0x8d')][_0xd8a3('0x17c')],_0x3177c5[_0xd8a3('0x17d')],_0x3177c5[_0xd8a3('0x17e')]>0x0?utils[_0xd8a3('0x17f')](_0x3177c5[_0xd8a3('0x180')],_0x3177c5[_0xd8a3('0x17e')]):_0x3177c5['dialOriginateCallerIdNumber']);if(_0x812c8a){_0x8e6168[_0xd8a3('0x181')]=_0x2631d6[_0xd8a3('0xe7')][_0x540bdb][_0xd8a3('0x182')]=utils[_0xd8a3('0x183')](_0x812c8a);_0x8e6168[_0xd8a3('0x184')]=_0x168d34['phone'];}_0x3177c5['variables']=_0x8e6168;return ami['Action']({'actionid':_0x540bdb,'action':_0xd8a3('0x15f'),'channel':_0x2631d6[_0xd8a3('0x87')](_0x3177c5[_0xd8a3('0x8c')])?util[_0xd8a3('0x47')](_0xd8a3('0x185'),_0x3177c5[_0xd8a3('0x8c')][_0xd8a3('0x67')],isNotNull(_0x3177c5[_0xd8a3('0x186')])?_0x3177c5[_0xd8a3('0x186')][_0xd8a3('0x187')]()||'':'',_0x3177c5[_0xd8a3('0x188')]>0x0?_0x168d34[_0xd8a3('0x161')][_0xd8a3('0x189')](_0x3177c5[_0xd8a3('0x188')]):_0x168d34['phone']):util['format'](_0xd8a3('0x185'),_['isNil'](_0x3177c5[_0xd8a3('0x8d')])?_0x3177c5[_0xd8a3('0x8c')][_0xd8a3('0x67')]:_0x3177c5['TrunkBackup'][_0xd8a3('0x67')],isNotNull(_0x3177c5['dialPrefix'])?_0x3177c5[_0xd8a3('0x186')][_0xd8a3('0x187')]()||'':'',_0x3177c5[_0xd8a3('0x188')]>0x0?_0x168d34[_0xd8a3('0x161')][_0xd8a3('0x189')](_0x3177c5['dialCutDigit']):_0x168d34[_0xd8a3('0x161')]),'callerid':_0x812c8a,'Exten':_0xd8a3('0x168'),'Context':_0xd8a3('0x18a'),'Priority':'1','variable':_0x8e6168,'timeout':(_0x3177c5['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x540bdb})[_0xd8a3('0x40')](function(_0x3dffce){return _0x146e83(_0x3dffce);})[_0xd8a3('0xa2')](function(_0x55cd58){_0x3177c5[_0xd8a3('0x18b')]+=0x1;var _0x441c01=new History(_0x2631d6['actions'][_0x540bdb]);logger[_0xd8a3('0x6b')](util[_0xd8a3('0x47')]('[originateError]:\x20%s',JSON[_0xd8a3('0x85')](_0x55cd58)));_0x441c01['state']=0xe;_0x441c01[_0xd8a3('0x73')]=_0xd8a3('0x18c');_0x441c01[_0xd8a3('0xdc')]=moment()[_0xd8a3('0x47')](_0xd8a3('0xc1'));_0x441c01[_0xd8a3('0x74')]=_0x441c01['starttime'];hopperUtils[_0xd8a3('0xc2')](_0x441c01)[_0xd8a3('0xa2')](loggerCatch('[originate][error]'));_0x2631d6[_0xd8a3('0xc4')](_0x441c01)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x18d')))[_0xd8a3('0x1e')](function(){delete _0x2631d6[_0xd8a3('0xe7')][_0x540bdb];return _0x3c33a9(msgResponse(_0xd8a3('0x15f'),'Error',_0xd8a3('0x18e')));});});});};Dialer[_0xd8a3('0x86')]['checkRetriveMax']=function(_0x22bf4d,_0x275e22,_0x2e346b){var _0x2703af=new History(_0x275e22);if(_0x2703af[_0xd8a3('0x11a')]+_0x2703af[_0xd8a3('0x11b')]+_0x2703af['countnoanswerretry']+_0x2703af[_0xd8a3('0x11d')]+_0x2703af[_0xd8a3('0xce')]+_0x2703af[_0xd8a3('0xe0')]+_0x2703af[_0xd8a3('0x11e')]+_0x2703af[_0xd8a3('0x11f')]>=_0x2e346b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x22bf4d){case 0x3:if(_0x2703af[_0xd8a3('0x11c')]>=_0x2e346b[_0xd8a3('0x18f')]-0x1){return!![];}hopperUtils[_0xd8a3('0xe3')]({'active':![],'countnoanswerretry':_0x2703af[_0xd8a3('0x11c')]+=0x1,'scheduledat':moment()['add'](_0x2e346b[_0xd8a3('0x190')],_0xd8a3('0xd7'))[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x2703af[_0xd8a3('0xda')]||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x191')));break;case 0x5:if(_0x2703af[_0xd8a3('0x11a')]>=_0x2e346b[_0xd8a3('0x192')]-0x1){return!![];}hopperUtils[_0xd8a3('0xe3')]({'active':![],'countbusyretry':_0x2703af[_0xd8a3('0x11a')]+=0x1,'scheduledat':moment()[_0xd8a3('0xd6')](_0x2e346b[_0xd8a3('0x193')],_0xd8a3('0xd7'))[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x2703af['CampaignId']||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x194')));break;case 0x8:if(_0x2703af[_0xd8a3('0x11b')]>=_0x2e346b['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xd8a3('0xe3')]({'active':![],'countcongestionretry':_0x2703af[_0xd8a3('0x11b')]+=0x1,'scheduledat':moment()[_0xd8a3('0xd6')](_0x2e346b[_0xd8a3('0x195')],_0xd8a3('0xd7'))['format'](_0xd8a3('0xc1')),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x2703af[_0xd8a3('0xda')]||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x196')));break;case 0x0:if(_0x2703af[_0xd8a3('0x11d')]>=_0x2e346b[_0xd8a3('0x197')]-0x1){return!![];}else{hopperUtils[_0xd8a3('0xe3')]({'active':![],'countnosuchnumberretry':_0x2703af[_0xd8a3('0x11d')]+=0x1,'scheduledat':moment()[_0xd8a3('0xd6')](_0x2e346b[_0xd8a3('0x198')],'minutes')[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af['VoiceQueueId']||undefined,'CampaignId':_0x2703af['CampaignId']||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x199')));}break;case 0xa:if(_0x2703af[_0xd8a3('0xce')]>=_0x2e346b[_0xd8a3('0xd4')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2703af['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x2e346b[_0xd8a3('0xcf')],_0xd8a3('0xd7'))[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x2703af[_0xd8a3('0xda')]||undefined})['catch'](loggerCatch(_0xd8a3('0xdb')));break;case 0xb:if(_0x2703af[_0xd8a3('0xe0')]>=_0x2e346b['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2703af[_0xd8a3('0xe0')]+=0x1,'scheduledat':moment()[_0xd8a3('0xd6')](_0x2e346b[_0xd8a3('0xe2')],_0xd8a3('0xd7'))[_0xd8a3('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af['VoiceQueueId']||undefined,'CampaignId':_0x2703af[_0xd8a3('0xda')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2703af['countmachineretry']>=_0x2e346b[_0xd8a3('0x123')]-0x1){return!![];}hopperUtils[_0xd8a3('0xe3')]({'active':![],'countmachineretry':_0x2703af[_0xd8a3('0x11e')]+=0x1,'scheduledat':moment()[_0xd8a3('0xd6')](_0x2e346b[_0xd8a3('0x12b')],'minutes')[_0xd8a3('0x47')](_0xd8a3('0xc1')),'ContactId':_0x2703af[_0xd8a3('0xf5')],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x2703af[_0xd8a3('0xda')]||undefined})['catch'](loggerCatch(_0xd8a3('0x126')));break;case 0x14:if(_0x2703af[_0xd8a3('0x11f')]>=_0x2e346b[_0xd8a3('0x19a')]-0x1){return!![];}hopperUtils[_0xd8a3('0xe3')]({'active':![],'countagentrejectretry':_0x2703af[_0xd8a3('0x11f')]+=0x1,'scheduledat':moment()[_0xd8a3('0xd6')](_0x2e346b['dialAgentRejectRetryFrequency'],_0xd8a3('0xd7'))['format'](_0xd8a3('0xc1')),'ContactId':_0x2703af['ContactId'],'ListId':_0x2703af[_0xd8a3('0xd8')],'VoiceQueueId':_0x2703af[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x2703af[_0xd8a3('0xda')]||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x19b')));break;default:return!![];}};Dialer[_0xd8a3('0x86')]['callProgressDetecting']=function(_0x970bc5,_0x3e386e,_0x3dcb5d){var _0x1c89f8=this;var _0x3c7cdb=new History(_0x970bc5);var _0x474aff=![];var _0xd2a990;var _0xd0deb;return new Promise(function(_0x3a19b5,_0x211e7a){if(_[_0xd8a3('0x42')](_0x3e386e)&&typeof _0x3e386e!==_0xd8a3('0x15e')){return _0x211e7a(msgResponse(_0xd8a3('0x19c'),_0xd8a3('0x94'),_0xd8a3('0x19d')));}if(_[_0xd8a3('0x42')](_0x3dcb5d)&&typeof _0x3dcb5d!==_0xd8a3('0x15e')){return _0x211e7a(msgResponse('[callProgressDetecting]','Failure',_0xd8a3('0x19e')));}hopperUtils[_0xd8a3('0xd1')](_0x3c7cdb,_0x3dcb5d[_0xd8a3('0xbd')],_0x3e386e)[_0xd8a3('0x40')](function(_0x54c55b){if(_0x54c55b[_0xd8a3('0xd3')]==0x1)_0x474aff=!![];switch(_0x3dcb5d[_0xd8a3('0xbd')]){case'0':_0x3e386e[_0xd8a3('0x19f')]+=0x1;_0x3c7cdb[_0xd8a3('0x72')]=0x0;_0x3c7cdb['statedesc']=_0xd8a3('0x1a0');_0x3c7cdb['countnosuchnumberretry']+=0x1;_0x3c7cdb[_0xd8a3('0xe1')]+=0x1;ami[_0xd8a3('0x110')](_0xd8a3('0x1a1'),ut[_0xd8a3('0x111')](_0x970bc5,_0xd8a3('0x1a2')));_0xd2a990=_0x3e386e['dialNoSuchNumberRetryFrequency'];_0xd0deb=_0x3e386e['callAdditionalPhoneAfterMin'];hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x119')));if(_0x1c89f8[_0xd8a3('0x1a3')](0x0,_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb[_0xd8a3('0x11d')]>=_0x3e386e[_0xd8a3('0x197')]){_0x1c89f8[_0xd8a3('0x124')](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1a4'));}else{_0x1c89f8['stateGlobal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1a4'));}}break;case'3':_0x3e386e['outboundNoAnswerCallsDay']+=0x1;_0x3c7cdb['state']=0x3;_0x3c7cdb['statedesc']=_0xd8a3('0x1a5');_0x3c7cdb[_0xd8a3('0x11c')]+=0x1;_0x3c7cdb['countglobal']+=0x1;var _0x4f9136=ut[_0xd8a3('0x1a6')](_0x970bc5,_0x3e386e);ami['emit'](_0xd8a3('0x1a7'),_0x4f9136);_0xd2a990=_0x3e386e[_0xd8a3('0x190')];_0xd0deb=_0x3e386e[_0xd8a3('0xd0')];hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x1a8')));if(_0x1c89f8[_0xd8a3('0x1a3')](0x3,_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb[_0xd8a3('0x11c')]>=_0x3e386e[_0xd8a3('0x18f')]){_0x1c89f8[_0xd8a3('0x124')](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1a9'));}else{_0x1c89f8[_0xd8a3('0x121')](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1a9'));}}break;case'5':_0x3e386e[_0xd8a3('0x1aa')]+=0x1;_0x3c7cdb[_0xd8a3('0x72')]=0x5;_0x3c7cdb['statedesc']='Busy';_0x3c7cdb[_0xd8a3('0x11a')]+=0x1;_0x3c7cdb['countglobal']+=0x1;ami['emit'](_0xd8a3('0x1ab'),ut[_0xd8a3('0x111')](_0x970bc5,_0xd8a3('0x1ac')));_0xd2a990=_0x3e386e[_0xd8a3('0x193')];_0xd0deb=_0x3e386e['callAdditionalPhoneAfterMin'];hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x1ad')));if(_0x1c89f8[_0xd8a3('0x1a3')](0x5,_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb['countbusyretry']>=_0x3e386e[_0xd8a3('0x192')]){_0x1c89f8[_0xd8a3('0x124')](_0x3c7cdb,_0x3a19b5,_0x211e7a,'reason\x205\x20busy');}else{_0x1c89f8[_0xd8a3('0x121')](_0x3c7cdb,_0x3a19b5,_0x211e7a,'reason\x205\x20busy');}}break;case'8':_0x3e386e['outboundCongestionCallsDay']+=0x1;_0x3c7cdb['state']=0x8;_0x3c7cdb[_0xd8a3('0x73')]='Congestion';_0x3c7cdb['countcongestionretry']+=0x1;_0x3c7cdb[_0xd8a3('0xe1')]+=0x1;_0xd2a990=_0x3e386e[_0xd8a3('0x195')];_0xd0deb=_0x3e386e['callAdditionalPhoneAfterMin'];ami['emit'](_0xd8a3('0x1ae'),ut['buildObj'](_0x970bc5,'congestion'));hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x1af')));if(_0x1c89f8[_0xd8a3('0x1a3')](0x8,_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb[_0xd8a3('0x11b')]>=_0x3e386e[_0xd8a3('0x1b0')]){_0x1c89f8[_0xd8a3('0x124')](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1b1'));}else{_0x1c89f8['stateGlobal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1b1'));}}break;case'11':_0x3e386e[_0xd8a3('0x1b2')]+=0x1;_0x3c7cdb[_0xd8a3('0x72')]=0xb;_0x3c7cdb['statedesc']=_0xd8a3('0xdf');_0x3c7cdb['countabandonedretry']+=0x1;_0x3c7cdb[_0xd8a3('0xe1')]+=0x1;_0xd2a990=_0x3e386e['dialAbandonedRetryFrequency'];_0xd0deb=_0x3e386e[_0xd8a3('0xd0')];hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1c89f8['checkRetriveMax'](0xb,_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb['countabandonedretry']>=_0x3e386e[_0xd8a3('0x1b3')]){_0x1c89f8['createStateFinal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1b4'));}else{_0x1c89f8['stateGlobal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1b4'));}}break;case'20':_0x3e386e[_0xd8a3('0x1b5')]+=0x1;_0x3c7cdb[_0xd8a3('0x72')]=0x14;_0x3c7cdb[_0xd8a3('0x73')]='AgentReject';_0x3c7cdb[_0xd8a3('0x11f')]+=0x1;_0x3c7cdb[_0xd8a3('0xe1')]+=0x1;_0xd2a990=_0x3e386e['dialAgentRejectRetryFrequency'];_0xd0deb=_0x3e386e[_0xd8a3('0xd0')];ami[_0xd8a3('0x110')]('custom:agentreject',ut['buildObj'](_0x970bc5,'agentreject'));hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)[_0xd8a3('0xa2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1c89f8[_0xd8a3('0x1a3')](0x14,_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb[_0xd8a3('0x11f')]>=_0x3e386e['dialAgentRejectMaxRetry']){_0x1c89f8['createStateFinal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0xd8a3('0x1b6'));}else{_0x1c89f8['stateGlobal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,'reason\x2020\x20agentreject');}}break;default:_0x3e386e[_0xd8a3('0x137')]+=0x1;_0x3c7cdb[_0xd8a3('0x72')]=0xc;_0x3c7cdb[_0xd8a3('0x73')]=_0x3dcb5d[_0xd8a3('0xbd')];_0xd2a990=_0x3e386e[_0xd8a3('0x1b7')];_0xd0deb=_0x3e386e['callAdditionalPhoneAfterMin'];hopperUtils[_0xd8a3('0xc2')](_0x3c7cdb)[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x1b8')));if(_0x1c89f8[_0xd8a3('0x1a3')](_0x3dcb5d[_0xd8a3('0xbd')],_0x970bc5,_0x3e386e)&&!_0x474aff){if(_0x3c7cdb[_0xd8a3('0x11a')]+_0x3c7cdb['countcongestionretry']+_0x3c7cdb['countnoanswerretry']+_0x3c7cdb[_0xd8a3('0x11d')]+_0x3c7cdb[_0xd8a3('0xce')]+_0x3c7cdb[_0xd8a3('0xe0')]+_0x3c7cdb[_0xd8a3('0x11e')]+_0x3c7cdb[_0xd8a3('0x11f')]>=_0x3e386e[_0xd8a3('0x120')]){_0x1c89f8[_0xd8a3('0x121')](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0x3dcb5d['reason']);}else{_0x1c89f8['createStateFinal'](_0x3c7cdb,_0x3a19b5,_0x211e7a,_0x3dcb5d['reason']);}}}})[_0xd8a3('0x40')](function(){if(_0x474aff){hopperUtils[_0xd8a3('0xe6')](_0x3c7cdb,_0xd2a990,_0xd0deb)[_0xd8a3('0x40')](function(){return _0x3a19b5(0x1);});}});});};Dialer[_0xd8a3('0x86')][_0xd8a3('0x121')]=function(_0x2542e3,_0x2d68e3,_0x2cd94b,_0x386cfd){var _0x35b8a7=new Final(_0x2542e3);_0x35b8a7[_0xd8a3('0x72')]=0xf;_0x35b8a7[_0xd8a3('0x73')]=_0xd8a3('0x1b9');this[_0xd8a3('0x124')](_0x35b8a7,_0x2d68e3,_0x2cd94b,_0x386cfd);};Dialer[_0xd8a3('0x86')]['createStateFinal']=function(_0x4cf89f,_0x181a79,_0x56e79e,_0x36c32c){hopperUtils[_0xd8a3('0xc4')](_0x4cf89f)['then'](function(){return _0x181a79(msgResponse(_0xd8a3('0x19c'),_0xd8a3('0x105'),_0x36c32c));})[_0xd8a3('0xa2')](function(){return _0x56e79e(msgResponse('[moveContactManagedDialer][0]',_0xd8a3('0x94'),_0xd8a3('0x1ba')));});};Dialer['prototype']['predictive']=function(_0x23f07e){var _0x2de782=_0x23f07e[_0xd8a3('0x1bb')]/0x64;var _0x32170a=_0x23f07e[_0xd8a3('0xca')]/(_0x23f07e[_0xd8a3('0xca')]+_0x23f07e[_0xd8a3('0xbc')]);var _0x58be05=Math['round'](_0x23f07e[_0xd8a3('0x1bc')]*(_0x23f07e[_0xd8a3('0x1bd')]/0x64));var _0x47c990=Math[_0xd8a3('0x1be')](_0x23f07e[_0xd8a3('0x1bc')]*(_0x23f07e[_0xd8a3('0x1bf')]/0x64));var _0x53ce42=_0x23f07e[_0xd8a3('0x13c')]+_0x23f07e[_0xd8a3('0x13e')];var _0x47821b=Math[_0xd8a3('0x1c0')](_0x23f07e[_0xd8a3('0x5e')]*_0x23f07e[_0xd8a3('0x64')]*_0x23f07e[_0xd8a3('0x1c1')]*_0x23f07e[_0xd8a3('0x1c2')]);if(_[_0xd8a3('0x42')](_0x23f07e[_0xd8a3('0x2a')])){if(!_[_0xd8a3('0x42')](_0x23f07e[_0xd8a3('0x29')])){_0x23f07e['startPredictive']=undefined;loggerPredictive[_0xd8a3('0x6b')]('[startMethodPredictive][StartProgressive]',_0xd8a3('0x1c3'));}if(!_[_0xd8a3('0x42')](_0x23f07e[_0xd8a3('0x69')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xd8a3('0x1c4'));clearInterval(_0x23f07e['handlePredictive']);_0x23f07e[_0xd8a3('0x69')]=undefined;}_0x23f07e['startProgressive']=moment()[_0xd8a3('0x47')](_0xd8a3('0xc1'));loggerPredictive[_0xd8a3('0x4b')](_0x23f07e[_0xd8a3('0x67')],'collection\x20data\x20in\x20progressive\x20at',_0x23f07e[_0xd8a3('0x2a')]);this[_0xd8a3('0xaf')](_0x23f07e,0x1);}else if(ifInterval(_0x23f07e['dialPredictiveInterval'],_0x23f07e['startProgressive'])){this[_0xd8a3('0xaf')](_0x23f07e,0x1);loggerPredictiveCalls[_0xd8a3('0x4b')](_0xd8a3('0x1c5'),_0x23f07e['startProgressive'],_0x23f07e[_0xd8a3('0x67')]);_0x23f07e[_0xd8a3('0x5e')]=0x0;_0x23f07e[_0xd8a3('0x1c6')]=0x0;}else if(_0x2de782<_0x32170a&&_0x23f07e['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x23f07e);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x1c7'),_0xd8a3('0x1c8'),_0x32170a,_0xd8a3('0x2a'),_0x23f07e[_0xd8a3('0x67')]);}else if(_0x47821b<_0x23f07e[_0xd8a3('0x1c6')]&&_0x23f07e['dialPredictiveOptimization']===_0xd8a3('0x1c9')){clearPredictiveAttributes(_0x23f07e);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x1ca'),'Max\x20Drop\x20',_0x47821b,_0xd8a3('0x1cb'),_0x23f07e[_0xd8a3('0x1c6')],_0xd8a3('0x2a'),_0x23f07e[_0xd8a3('0x67')]);}else if(!ifInterval(_0x23f07e['dialPredictiveInterval'],_0x23f07e['startProgressive'])&&_[_0xd8a3('0x42')](_0x23f07e[_0xd8a3('0x29')])&&!_[_0xd8a3('0x42')](_0x23f07e[_0xd8a3('0x2a')])){_0x23f07e['startPredictive']=moment()[_0xd8a3('0x47')](_0xd8a3('0xc1'));loggerPredictive[_0xd8a3('0x4b')](_0x23f07e[_0xd8a3('0x67')],'started\x20in\x20predictive\x20at',_0x23f07e[_0xd8a3('0x29')]);hopperUtils[_0xd8a3('0x1cc')](_0x23f07e[_0xd8a3('0x1cd')])['then'](this[_0xd8a3('0x1ce')](_0x23f07e))[_0xd8a3('0x40')](mergeDataErlangB(_0x23f07e))[_0xd8a3('0x40')](this['startMethodPredictive'](_0x23f07e))['catch'](loggerCatchPredictive(_0xd8a3('0x1cf'),_0x23f07e));}else if(!ifInterval(_0x23f07e[_0xd8a3('0x1cd')],_0x23f07e[_0xd8a3('0x29')])){_0x23f07e[_0xd8a3('0x1c6')]=0x0;_0x23f07e[_0xd8a3('0x29')]=moment()[_0xd8a3('0x47')](_0xd8a3('0xc1'));loggerPredictive['info'](_0x23f07e[_0xd8a3('0x67')],_0xd8a3('0x1d0'),_0x23f07e[_0xd8a3('0x29')]);clearInterval(_0x23f07e[_0xd8a3('0x69')]);_0x23f07e[_0xd8a3('0x69')]=undefined;hopperUtils['avgHandleTime'](_0x23f07e[_0xd8a3('0x1cd')])['then'](this[_0xd8a3('0x1ce')](_0x23f07e))[_0xd8a3('0x40')](mergeDataErlangB(_0x23f07e))[_0xd8a3('0x40')](this[_0xd8a3('0x1d1')](_0x23f07e))[_0xd8a3('0xa2')](loggerCatchPredictive(_0xd8a3('0x1d2'),_0x23f07e));}else if(_0x23f07e[_0xd8a3('0x1bc')]&&_0x53ce42<_0x23f07e[_0xd8a3('0x1bc')]-_0x47c990){clearPredictiveAttributes(_0x23f07e);loggerPredictive[_0xd8a3('0x4b')](_0x23f07e[_0xd8a3('0x67')],_0xd8a3('0x1d3'),_0x53ce42,_0xd8a3('0x1d4'),_0x23f07e[_0xd8a3('0x1bc')],'-',_0x47c990,'=',_0x23f07e[_0xd8a3('0x1bc')]-_0x47c990,')');}else if(_0x23f07e[_0xd8a3('0x1bc')]&&_0x53ce42>_0x23f07e['predictiveIntervalAvailable']+_0x58be05){clearPredictiveAttributes(_0x23f07e);loggerPredictive[_0xd8a3('0x4b')](_0x23f07e['name'],_0xd8a3('0x1d3'),_0x53ce42,_0xd8a3('0x1d5'),_0x23f07e[_0xd8a3('0x1bc')],'+',_0x58be05,'=',_0x23f07e[_0xd8a3('0x1bc')]+_0x58be05,')');}};Dialer[_0xd8a3('0x86')]['getDataPredictive']=function(_0x8e9d7f){var _0x41ee45=this;return function(_0x40f519){return new Promise(function(_0x4c5bcf,_0x2dbf59){_[_0xd8a3('0x65')](_0x8e9d7f,_0x40f519[0x0]);if(checkGetDataPredictive(_0x40f519[0x0])){var _0x242584=_0x8e9d7f[_0xd8a3('0x1bc')]=_0x8e9d7f[_0xd8a3('0x13e')]+_0x8e9d7f[_0xd8a3('0x13c')];var _0x1c1c63=_0x8e9d7f[_0xd8a3('0x1cd')]*0x3c;var _0x514515=_0x40f519[0x0][_0xd8a3('0x57')]+_0x40f519[0x0][_0xd8a3('0x59')];var _0x27e36a=(_0x40f519[0x0][_0xd8a3('0x4f')]+_0x40f519[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x40f519[0x0][_0xd8a3('0x53')])/_0x40f519[0x0]['predictiveIntervalTotalCalls'];_0x8e9d7f[_0xd8a3('0x1c1')]=_0x27e36a>0x0?_0x27e36a:0x1;switch(_0x8e9d7f[_0xd8a3('0x1d6')]){case'dropRate':var _0xece6d8=_0x8e9d7f[_0xd8a3('0x1bb')]/0x64;return _0x41ee45[_0xd8a3('0x1d7')](_0x242584,_0x1c1c63,_0x514515,_0x27e36a,_0xece6d8)[_0xd8a3('0x40')](function(_0x1d78ad){return _0x4c5bcf(_0x1d78ad);});case _0xd8a3('0x1d8'):var _0x2b1e39=_0x8e9d7f['dialPredictiveOptimizationPercentage']/0x64;return _0x41ee45[_0xd8a3('0x1d9')](_0x242584,_0x1c1c63,_0x514515,_0x27e36a,_0x2b1e39)[_0xd8a3('0x40')](function(_0x108497){return _0x4c5bcf(_0x108497);});default:return _0x2dbf59(msgResponse(_0xd8a3('0x1da'),_0xd8a3('0x94'),_0xd8a3('0x1db')));}}else{return _0x2dbf59(msgResponse(_0xd8a3('0x1da'),'Failure',_0xd8a3('0x1dc')));}});};};Dialer['prototype'][_0xd8a3('0x1dd')]=function(_0x31d07f){var _0x4bd646=this;return function(_0x1c260f){return new Promise(function(_0x16bb19,_0x1b88dd){_['merge'](_0x31d07f,_0x1c260f[0x0]);if(checkGetDataPredictive(_0x1c260f[0x0])){loggerPredictive['info'](JSON[_0xd8a3('0x85')](_0x1c260f[0x0]));if(_0x31d07f[_0xd8a3('0x1d6')]===_0xd8a3('0x1c9')){return _0x4bd646[_0xd8a3('0x156')](_0x31d07f['id'])['then'](function(_0x336c0f){var _0x3c9117=_0x31d07f['loggedIn']-_0x336c0f[0x0]['outboundQueuePauses'];var _0x48afec=_0x31d07f[_0xd8a3('0x1cd')]*0x3c;var _0x1b7bf9=_0x1c260f[0x0]['predictiveIntervalAvgTalktime']+_0x1c260f[0x0][_0xd8a3('0x59')];var _0x5c9852=(_0x1c260f[0x0][_0xd8a3('0x4f')]+_0x1c260f[0x0][_0xd8a3('0x51')]+_0x1c260f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1c260f[0x0][_0xd8a3('0x56')];var _0x5dbddc=_0x31d07f[_0xd8a3('0x1bb')]/0x64;_0x31d07f['predictiveIntervalPauses']=_0x336c0f[0x0][_0xd8a3('0x1de')]||0x0;_0x31d07f[_0xd8a3('0x1c1')]=_0x5c9852>0x0?_0x5c9852:0x1;return _0x4bd646[_0xd8a3('0x1d7')](_0x3c9117,_0x48afec,_0x1b7bf9,_0x5c9852,_0x5dbddc);})[_0xd8a3('0x40')](function(_0x4f6515){return _0x16bb19(_0x4f6515);})[_0xd8a3('0xa2')](function(_0x451eb0){return _0x1b88dd(msgResponse('[CatchErlangB]','Failure',JSON[_0xd8a3('0x85')](_0x451eb0)));});}if(_0x31d07f[_0xd8a3('0x1d6')]==='agentBusyFactor'){return _0x4bd646[_0xd8a3('0x156')](_0x31d07f['id'])['then'](function(_0x59175a){var _0x2a3d84=_0x31d07f[_0xd8a3('0x1df')]-_0x59175a[0x0][_0xd8a3('0x1de')];var _0x366f8d=_0x31d07f[_0xd8a3('0x1cd')]*0x3c;var _0x1fc928=_0x1c260f[0x0][_0xd8a3('0x57')]+_0x1c260f[0x0][_0xd8a3('0x59')];var _0x1b7a84=(_0x1c260f[0x0][_0xd8a3('0x4f')]+_0x1c260f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1c260f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1c260f[0x0][_0xd8a3('0x56')];var _0x45c696=_0x31d07f['dialPredictiveOptimizationPercentage']/0x64;_0x31d07f[_0xd8a3('0x1e0')]=_0x59175a[0x0][_0xd8a3('0x1de')]||0x0;_0x31d07f[_0xd8a3('0x1c1')]=_0x1b7a84>0x0?_0x1b7a84:0x1;return _0x4bd646[_0xd8a3('0x1d9')](_0x2a3d84,_0x366f8d,_0x1fc928,_0x1b7a84,_0x45c696);})[_0xd8a3('0x40')](function(_0x227e0f){return _0x16bb19(_0x227e0f);})['catch'](function(_0x50f7bb){return _0x1b88dd(msgResponse(_0xd8a3('0x1e1'),_0xd8a3('0x94'),JSON[_0xd8a3('0x85')](_0x50f7bb)));});}}else{return _0x1b88dd(msgResponse(_0xd8a3('0x1da'),_0xd8a3('0x94'),_0xd8a3('0x1dc')));}});};};Dialer[_0xd8a3('0x86')][_0xd8a3('0x1d1')]=function(_0xc7faa9){var _0x102f10=this;return function(){var _0x3c3350=0x0;var _0x794f9=Math[_0xd8a3('0x1c0')](_0xc7faa9['erlangCallToSecond']*0x3e8);if(_0x794f9>0x0){_0x794f9=_0x794f9<0x64?0x64:_0x794f9;loggerPredictive['info'](_0xc7faa9[_0xd8a3('0x67')],_0xd8a3('0x1e2'),_0x794f9,_0xd8a3('0x1e3'));_0xc7faa9[_0xd8a3('0x69')]=setInterval(function(){_0x102f10[_0xd8a3('0x69')](_0xc7faa9);loggerPredictiveCalls[_0xd8a3('0x4b')](_0xd8a3('0x1e4'),_0x3c3350+=0x1);},_0x794f9);}else{loggerPredictive['info'](_0xc7faa9['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xd8a3('0x86')][_0xd8a3('0x1e5')]=function(_0x381ee5,_0x3b393d){var _0x265245=this;return function(_0x225e36){if(_['isEmpty'](_0x225e36)){if(_['isNil'](_0x3b393d[_0xd8a3('0x1e6')])||!_0x3b393d['recallme']){if(_0x381ee5['dialMethod']===_0xd8a3('0xa')){_0x381ee5['queueStatusComplete']=_[_0xd8a3('0x42')](_0x381ee5[_0xd8a3('0x75')])?!![]:_0x381ee5[_0xd8a3('0x75')];var _0x505a1c=uuid['v4']();_0x265245[_0xd8a3('0xe7')][_0x505a1c]=new Action(_0x381ee5,_0x3b393d,_0x505a1c);loggerBooked[_0xd8a3('0x4b')](_0xd8a3('0x1e7'),_0x505a1c,'queueStatusComplete:\x20',JSON[_0xd8a3('0x85')](_0x381ee5[_0xd8a3('0x75')]),_0xd8a3('0x1e8'),_0x381ee5[_0xd8a3('0x67')]);if(_0x381ee5[_0xd8a3('0x75')]){_0x381ee5[_0xd8a3('0x75')]=![];_0x265245[_0xd8a3('0x2b')][_0x265245[_0xd8a3('0xe7')][_0x505a1c][_0xd8a3('0xb9')]]=[];ami[_0xd8a3('0x9b')]({'actionid':_0x505a1c,'action':_0xd8a3('0x1e9'),'queue':_0x381ee5['name']})[_0xd8a3('0xa2')](function(){utils[_0xd8a3('0xb8')](_0x381ee5,_0xd8a3('0x1ea'));hopperUtils[_0xd8a3('0xe3')]({'active':![],'ContactId':_0x265245[_0xd8a3('0xe7')][_0x505a1c][_0xd8a3('0xf5')],'ListId':_0x265245['actions'][_0x505a1c][_0xd8a3('0xd8')],'VoiceQueueId':_0x265245[_0xd8a3('0xe7')][_0x505a1c][_0xd8a3('0xd9')]||undefined,'CampaignId':_0x265245[_0xd8a3('0xe7')][_0x505a1c][_0xd8a3('0xda')]||undefined})['catch'](loggerCatch(_0xd8a3('0x1eb')));delete _0x265245[_0xd8a3('0xe7')][_0x505a1c];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xd8a3('0x85')](_0x381ee5['queueStatusComplete']),_0xd8a3('0x1e8'),_0x381ee5[_0xd8a3('0x67')]);utils['decrementOriginate'](_0x381ee5,_0xd8a3('0x1ea'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x265245[_0xd8a3('0xe7')][_0x505a1c][_0xd8a3('0xf5')],'ListId':_0x265245[_0xd8a3('0xe7')][_0x505a1c][_0xd8a3('0xd8')],'VoiceQueueId':_0x265245[_0xd8a3('0xe7')][_0x505a1c]['VoiceQueueId']||undefined,'CampaignId':_0x265245[_0xd8a3('0xe7')][_0x505a1c]['CampaignId']||undefined})['catch'](loggerCatch(_0xd8a3('0x1eb')));delete _0x265245[_0xd8a3('0xe7')][_0x505a1c];}}else{return _0x265245[_0xd8a3('0x1ec')](_0x381ee5,_0x3b393d);}}else{if(utils['getSeconds'](undefined,_0x3b393d[_0xd8a3('0x1ed')])<_0x381ee5[_0xd8a3('0x1ee')]*0x3c){if(_0x3b393d['Agent']&&!_0x3b393d['Agent'][_0xd8a3('0x1ef')]){_0x265245[_0xd8a3('0x20')][_0xd8a3('0xf2')](_0x3b393d['id'])['finally'](function(){utils['decrementOriginate'](_0x381ee5,'[checkContactBlack]');});}else{hopperUtils[_0xd8a3('0x1f0')]({'active':![]},_0x3b393d['id'],0x1)[_0xd8a3('0x1e')](function(){utils[_0xd8a3('0xb8')](_0x381ee5,'[checkContactBlack]');});}}else{_0x381ee5[_0xd8a3('0x1f1')]+=0x1;utils[_0xd8a3('0xb8')](_0x381ee5,_0xd8a3('0x1ea'));if(_0x381ee5[_0xd8a3('0x1f2')]){hopperUtils[_0xd8a3('0xe3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b393d[_0xd8a3('0xf5')],'ListId':_0x3b393d[_0xd8a3('0xd8')],'VoiceQueueId':_0x3b393d[_0xd8a3('0xd9')]||undefined,'CampaignId':_0x3b393d[_0xd8a3('0xda')]||undefined})[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x1f3')));hopperUtils[_0xd8a3('0xc2')](createObjHistory(_0x381ee5,_0x3b393d,utils[_0xd8a3('0x6f')]['QUEUE_RECALL'],0x17,_0xd8a3('0x1f4')))[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x1f5')));}else{_0x265245['saveInDb'](createObjHistory(_0x381ee5,_0x3b393d,utils['CAMPAIGN_STATUS'][_0xd8a3('0x1f6')],0x16,_0xd8a3('0x1f7')),_0xd8a3('0x1f8'),_0xd8a3('0x1f9'));}}}}else{_0x381ee5[_0xd8a3('0x1fa')]+=0x1;_0x265245[_0xd8a3('0x113')](createObjHistory(_0x381ee5,_0x3b393d,utils[_0xd8a3('0x6f')]['BLACKLIST'],0xd,_0xd8a3('0x1fb')),_0xd8a3('0x1fc'),_0xd8a3('0x1fd'));throw _0xd8a3('0x1fe');}};};Dialer['prototype']['handleIvr']=function(_0x58db15){var _0x103b5e=this;var _0x44c283=_0x58db15[_0xd8a3('0x1ff')]-_0x58db15[_0xd8a3('0x200')];emitCampaignSummary(_0x58db15);if(_0x44c283>0x0&&_0x58db15[_0xd8a3('0x201')]==0x0){if(_0x44c283>this[_0xd8a3('0x25')]){_0x44c283=this[_0xd8a3('0x25')];}_0x58db15[_0xd8a3('0x201')]=0x1;hopperUtils[_0xd8a3('0x202')](_0x58db15,_0x44c283)[_0xd8a3('0x40')](function(_0x164f88){_0x58db15[_0xd8a3('0x201')]=0x0;if(_0x164f88){if(!utils['checkContactEmpty'](_0x164f88)){_0x58db15['message']=utils[_0xd8a3('0x6f')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xd8a3('0x203')+_0x58db15[_0xd8a3('0x67')]);}else{_0x58db15['originated']+=_0x164f88[_0xd8a3('0xf8')];_0x58db15['message']=utils[_0xd8a3('0x6f')][_0xd8a3('0x204')];for(var _0x24988d=0x0;_0x24988d<_0x164f88['length'];_0x24988d+=0x1){_0x58db15[_0xd8a3('0x205')]+=0x1;if(_[_0xd8a3('0xec')](_0x164f88[_0x24988d])||_[_0xd8a3('0xec')](_0x164f88[_0x24988d]['Contact'])||_[_0xd8a3('0xec')](_0x164f88[_0x24988d][_0xd8a3('0x161')])){_0x103b5e[_0xd8a3('0x157')](_0xd8a3('0x206'),_0x58db15,_0x164f88[_0x24988d]);}else{hopperUtils[_0xd8a3('0x207')](_[_0xd8a3('0xfc')](_0x164f88[_0x24988d],[_0xd8a3('0xda'),_0xd8a3('0x161')]))[_0xd8a3('0x40')](_0x103b5e[_0xd8a3('0x1e5')](_0x58db15,_0x164f88[_0x24988d]))['catch'](function(_0x19b656){logger[_0xd8a3('0x6b')]('[actionOriginateIvr]',_0x19b656);utils['decrementOriginate'](_0x58db15,_0xd8a3('0x208'));});}}}}})[_0xd8a3('0xa2')](function(_0x2ea4b0){_0x58db15[_0xd8a3('0x201')]=0x0;logger[_0xd8a3('0x6b')](_0xd8a3('0x209'),_0x2ea4b0);});}};Dialer[_0xd8a3('0x86')]['handlePower']=function(_0x445c0b,_0x12d33b){var _0x4b850c=this;var _0x5b21ea=[];if(_0x12d33b<0x1||_0x445c0b[_0xd8a3('0xad')]==='booked'){_0x12d33b=0x1;}var _0xafe901=Math[_0xd8a3('0x1c0')](_0x445c0b[_0xd8a3('0x13c')]*_0x12d33b)-_0x445c0b['originated'];if(_0x445c0b['dialLimitQueue']>0x0){var _0x463b2e=_0x445c0b[_0xd8a3('0x20a')]-_0x445c0b[_0xd8a3('0x200')]-_0x445c0b[_0xd8a3('0x13e')]-_0x445c0b[_0xd8a3('0x13f')];if(_0xafe901>_0x463b2e){_0xafe901=_0x463b2e;}}if(_0xafe901>0x0&&_0x445c0b[_0xd8a3('0x201')]==0x0){if(_0x445c0b[_0xd8a3('0xad')]===_0xd8a3('0xa')){_0xafe901=0x1;}if(_0xafe901>this[_0xd8a3('0x25')]){_0xafe901=this['maxNumberOriginate'];}for(var _0x21edfd in this[_0xd8a3('0x23')]){if(typeof this[_0xd8a3('0x23')][_0x21edfd]!==_0xd8a3('0x20b')){if(this[_0xd8a3('0x23')][_0x21edfd][_0xd8a3('0x72')]===_0xd8a3('0x20c')&&this[_0xd8a3('0x23')][_0x21edfd][_0xd8a3('0x89')]==='reachable'){_0x5b21ea[_0xd8a3('0x9a')](this['agents'][_0x21edfd]['id']);}}}_0x445c0b[_0xd8a3('0x201')]=0x1;hopperUtils[_0xd8a3('0x20d')](_0x445c0b,_0x5b21ea,_0xafe901)[_0xd8a3('0x40')](function(_0x14060c){_0x445c0b['temp']=0x0;if(_0x14060c){if(!utils[_0xd8a3('0x20e')](_0x14060c)){hopperUtils['countReScheduled'](_0x445c0b)[_0xd8a3('0x40')](sendMessageReschedule(_0x445c0b))[_0xd8a3('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x445c0b[_0xd8a3('0x200')]+=_0x14060c[_0xd8a3('0xf8')];_0x445c0b[_0xd8a3('0x6e')]=_0x445c0b[_0xd8a3('0xad')]===_0xd8a3('0xa')?utils['CAMPAIGN_STATUS'][_0xd8a3('0x140')]:utils[_0xd8a3('0x6f')]['RUNNING'];for(var _0x37f52f=0x0;_0x37f52f<_0x14060c['length'];_0x37f52f+=0x1){if(_[_0xd8a3('0xec')](_0x14060c[_0x37f52f])||_[_0xd8a3('0xec')](_0x14060c[_0x37f52f]['Contact'])||_[_0xd8a3('0xec')](_0x14060c[_0x37f52f]['phone'])){_0x4b850c[_0xd8a3('0x157')](_0xd8a3('0x206'),_0x445c0b,_0x14060c[_0x37f52f]);}else{hopperUtils[_0xd8a3('0x20f')](_[_0xd8a3('0xfc')](_0x14060c[_0x37f52f],['VoiceQueueId','phone']))[_0xd8a3('0x40')](_0x4b850c['checkContactBlack'](_0x445c0b,_0x14060c[_0x37f52f]))[_0xd8a3('0xa2')](function(_0x36c4c2){logger[_0xd8a3('0x6b')]('[actionOriginate]',_0x36c4c2);utils[_0xd8a3('0xb8')](_0x445c0b,_0xd8a3('0x210'));});}}}}})['catch'](function(_0x1e01b2){_0x445c0b['temp']=0x0;logger['error'](_0xd8a3('0x209'),_0x1e01b2);});}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x69')]=function(_0x22b5b4){if(_0x22b5b4[_0xd8a3('0x20a')]>0x0){var _0x8437b5=_0x22b5b4[_0xd8a3('0x20a')]-_0x22b5b4[_0xd8a3('0x200')]-_0x22b5b4[_0xd8a3('0x13e')];if(_0x8437b5>0x0&&_0x22b5b4[_0xd8a3('0x201')]==0x0){this[_0xd8a3('0x211')](_0x22b5b4);}else{loggerPredictiveCalls['info'](_0xd8a3('0x212'));}}else{this[_0xd8a3('0x211')](_0x22b5b4);}};Dialer[_0xd8a3('0x86')][_0xd8a3('0x211')]=function(_0x297fcc){var _0x50f636=this;var _0x101e06=[];_0x297fcc[_0xd8a3('0x200')]+=0x1;for(var _0x356665 in this[_0xd8a3('0x23')]){if(typeof this[_0xd8a3('0x23')][_0x356665]!=='undefined'){if(this['agents'][_0x356665][_0xd8a3('0x72')]===_0xd8a3('0x20c')&&this[_0xd8a3('0x23')][_0x356665][_0xd8a3('0x89')]===_0xd8a3('0x149')){_0x101e06['push'](this[_0xd8a3('0x23')][_0x356665]['id']);}}}_0x297fcc[_0xd8a3('0x201')]=0x1;return this[_0xd8a3('0x20d')](_0x297fcc['id'],_0x101e06,0x1,_0x297fcc['dialOrderByScheduledAt'],_0x297fcc)[_0xd8a3('0x40')](function(_0x2bfe29){_0x297fcc[_0xd8a3('0x201')]=0x1;if(_0x2bfe29){if(!utils[_0xd8a3('0x20e')](_0x2bfe29)){utils['checkContactLowerLimitOriginate'](_0x297fcc,0x1,0x0);return hopperUtils[_0xd8a3('0x213')](_0x297fcc)[_0xd8a3('0x40')](sendMessageReschedule(_0x297fcc))[_0xd8a3('0xa2')](loggerCatch(_0xd8a3('0x214')));}else{_0x297fcc[_0xd8a3('0x6e')]=utils['CAMPAIGN_STATUS'][_0xd8a3('0x204')];if(_[_0xd8a3('0xec')](_0x2bfe29[0x0])||_['isNil'](_0x2bfe29[0x0][_0xd8a3('0x17a')])||_[_0xd8a3('0xec')](_0x2bfe29[0x0][_0xd8a3('0x161')])){_0x50f636[_0xd8a3('0x157')](_0xd8a3('0x206'),_0x297fcc,_0x2bfe29[0x0]);}else{return hopperUtils[_0xd8a3('0x20f')](_[_0xd8a3('0xfc')](_0x2bfe29[0x0],[_0xd8a3('0xd9'),'phone']))[_0xd8a3('0x40')](_0x50f636[_0xd8a3('0x1e5')](_0x297fcc,_0x2bfe29[0x0]))[_0xd8a3('0xa2')](function(_0x2fb537){logger[_0xd8a3('0x6b')](_0xd8a3('0x215'),_0x2fb537);utils[_0xd8a3('0xb8')](_0x297fcc,_0xd8a3('0x215'));});}}}})[_0xd8a3('0xa2')](function(_0x6e2669){_0x297fcc[_0xd8a3('0x201')]=0x0;logger[_0xd8a3('0x6b')](_0xd8a3('0x209'),_0x6e2669);});};Dialer[_0xd8a3('0x86')]['abandonmentRate']=function(_0x2cd802,_0x53f502,_0x47c7a2,_0x731add,_0x413a6b,_0x30338e){loggerPredictive['info'](_0xd8a3('0x216'));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',_0x2cd802);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x217'),_0x53f502);loggerPredictive['info'](_0xd8a3('0x218'),_0x47c7a2);loggerPredictive['info'](_0xd8a3('0x219'),_0x731add);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x21a'),_0x413a6b);loggerPredictive['info'](_0xd8a3('0x55'));return new Promise(function(_0x580d67,_0x1a5895){if(_0x2cd802<=0x0||isNaN(_0x2cd802)){return _0x1a5895(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x84'),_0xd8a3('0x21c')+_0x2cd802));}if(_0x47c7a2<=0x0||isNaN(_0x47c7a2)){return _0x1a5895(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x84'),_0xd8a3('0x21d')+_0x47c7a2));}if(_0x731add<=0x0||isNaN(_0x731add)){return _0x1a5895(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x84'),'p\x20=\x20'+_0x731add));}if(_0x53f502<=0x0||isNaN(_0x53f502)){return _0x1a5895(msgResponse(_0xd8a3('0x21b'),'Error','interval\x20=\x20'+_0x53f502));}if(_0x413a6b<=0x0||isNaN(_0x413a6b)){return _0x1a5895(msgResponse(_0xd8a3('0x21b'),'Error','Amax\x20=\x20'+_0x413a6b));}_0x30338e=_0x30338e||0x0;var _0x58b5ac=0x1/_0x47c7a2;var _0x49dbe9=0x0;var _0x544d7a=0x0;var _0x54af3a=0x0;var _0x2e0a01=0x0;for(var _0x39252a=0x0;_0x54af3a<_0x413a6b;_0x39252a+=0x1){_0x544d7a=_0x39252a/_0x53f502;_0x49dbe9=(_0x731add*_0x544d7a+_0x30338e)/_0x58b5ac;_0x54af3a=utils[_0xd8a3('0x21e')](_0x49dbe9,_0x2cd802);_0x2e0a01=_0x49dbe9/_0x2cd802*(0x1-utils[_0xd8a3('0x21e')](_0x49dbe9,_0x2cd802));}return _0x580d67({'erlangCalls':_0x39252a,'erlangCallToSecond':_0x53f502/_0x39252a,'erlangAbandonmentRate':_0x54af3a,'erlangBusyFactor':_0x2e0a01});});};Dialer[_0xd8a3('0x86')][_0xd8a3('0x1d9')]=function(_0x58c6d9,_0xc6e0ba,_0x552519,_0x4ea261,_0x242bc3,_0x5a61fd){loggerPredictive['info'](_0xd8a3('0x21f'));loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x220'),_0x58c6d9);loggerPredictive[_0xd8a3('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc6e0ba);loggerPredictive['info'](_0xd8a3('0x218'),_0x552519);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',_0x4ea261);loggerPredictive[_0xd8a3('0x4b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x242bc3);loggerPredictive[_0xd8a3('0x4b')](_0xd8a3('0x55'));return new Promise(function(_0x5184b5,_0x6367d2){if(_0x58c6d9<=0x0||isNaN(_0x58c6d9)){return _0x6367d2(msgResponse(_0xd8a3('0x221'),_0xd8a3('0x84'),_0xd8a3('0x21c')+_0x58c6d9));}if(_0x552519<=0x0||isNaN(_0x552519)){return _0x6367d2(msgResponse('[busyFactor]',_0xd8a3('0x84'),_0xd8a3('0x21d')+_0x552519));}if(_0x4ea261<=0x0||isNaN(_0x4ea261)){return _0x6367d2(msgResponse(_0xd8a3('0x221'),_0xd8a3('0x84'),'p\x20=\x20'+_0x4ea261));}if(_0xc6e0ba<=0x0||isNaN(_0xc6e0ba)){return _0x6367d2(msgResponse(_0xd8a3('0x221'),_0xd8a3('0x84'),'interval\x20=\x20'+_0xc6e0ba));}if(_0x242bc3<=0x0||isNaN(_0x242bc3)){return _0x6367d2(msgResponse(_0xd8a3('0x221'),_0xd8a3('0x84'),'Umin\x20=\x20'+_0x242bc3));}_0x5a61fd=_0x5a61fd||0x0;var _0x3dfd41=0x1/_0x552519;var _0x51b299=0x0;var _0x2e0f6b=0x0;var _0x51fbf2=0x0;var _0x21af26=0x0;for(var _0x18d882=0x0;_0x21af26<_0x242bc3;_0x18d882+=0x1){_0x2e0f6b=_0x18d882/_0xc6e0ba;_0x51b299=(_0x4ea261*_0x2e0f6b+_0x5a61fd)/_0x3dfd41;_0x51fbf2=utils[_0xd8a3('0x21e')](_0x51b299,_0x58c6d9);_0x21af26=_0x51b299/_0x58c6d9*(0x1-utils['erlangb'](_0x51b299,_0x58c6d9));}return _0x5184b5({'erlangCalls':_0x18d882,'erlangCallToSecond':_0xc6e0ba/_0x18d882,'erlangAbandonmentRate':_0x51fbf2,'erlangBusyFactor':_0x21af26});});};module['exports']=Dialer; \ No newline at end of file +var _0xc805=['Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','ivr','[syncAgentConnect]','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','statedesc','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','decrementOriginate','[syncQueueStatusComplete]','ListId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','exten','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','value','MACHINE','countmachineretry','countbusyretry','countcongestionretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','dialMachineMaxRetry','syncHangup','ivrAnswerCallsDay','cause-txt','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','Normal\x20Clearing','outboundUnknownCallsDay','[syncHangup][createHistory]','[syncHangup]','running','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:%s','user:dialPreviewRecallReminder','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','callerid','getCallerIdRandom','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','floor','one\x20call\x20every:','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','originated','temp','getContactDialerIvr','checkContactEmpty','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','[actionOriginate]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','isEmpty','-----\x20Stats\x20Predictive\x20---','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','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','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','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','handlePredictive','error','stack','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','interval','timezones','content','indexOf','true','catch','command','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','stringify','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','silly'];(function(_0x23d3da,_0x3ae73b){var _0x33cfcb=function(_0x3f231e){while(--_0x3f231e){_0x23d3da['push'](_0x23d3da['shift']());}};_0x33cfcb(++_0x3ae73b);}(_0xc805,0x171));var _0x5c80=function(_0x319412,_0x3e5995){_0x319412=_0x319412-0x0;var _0x2d78b3=_0xc805[_0x319412];return _0x2d78b3;};'use strict';var util=require(_0x5c80('0x0'));var _=require('lodash');var uuid=require(_0x5c80('0x1'));var moment=require(_0x5c80('0x2'));var rr=require('rr');var Redis=require(_0x5c80('0x3'));var utils=require(_0x5c80('0x4'));var hopperUtils=require(_0x5c80('0x5'));var ut=require('../preview/util/util');var config=require(_0x5c80('0x6'));var logger=require(_0x5c80('0x7'))('dialer');var loggerBooked=require(_0x5c80('0x7'))('booked');var loggerPredictive=require(_0x5c80('0x7'))(_0x5c80('0x8'));var loggerPredictiveCalls=require(_0x5c80('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x5c80('0x7'))(_0x5c80('0x9'));var ami=require(_0x5c80('0xa'));config[_0x5c80('0xb')]=_['defaults'](config['redis'],{'host':_0x5c80('0xc'),'port':0x18eb});var io=require(_0x5c80('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x5c80('0xe'));var voiceQueueRt=require(_0x5c80('0xf'));var RpcSetting=require(_0x5c80('0x10'));var Interval=require(_0x5c80('0x11'));var Action=require('./models/action');var History=require(_0x5c80('0x12'));var Final=require(_0x5c80('0x13'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x5c80('0x14'));var Hangup=require(_0x5c80('0x15'));var ipAgi=process[_0x5c80('0x16')][_0x5c80('0x17')]||_0x5c80('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5c80('0x19')][_0x5c80('0x1a')]=function(_0x5281aa){this['tail']=this[_0x5c80('0x1b')]?this[_0x5c80('0x1b')][_0x5c80('0x1c')](_0x5281aa):_0x5281aa();};function Dialer(_0x31e242,_0x86f337){this['sequence']=new Sequence();this[_0x5c80('0x1d')]=_0x86f337;this[_0x5c80('0x1e')]=_0x31e242[_0x5c80('0x1e')];this[_0x5c80('0x1f')]=_0x31e242[_0x5c80('0x1f')];this[_0x5c80('0x20')]=_0x31e242[_0x5c80('0x20')];this[_0x5c80('0x21')]=_0x31e242[_0x5c80('0x21')];this[_0x5c80('0x22')]=config[_0x5c80('0x22')]||0x2;this[_0x5c80('0x23')]={};this[_0x5c80('0x24')]={};this['contactsId']={};this[_0x5c80('0x25')]={};this[_0x5c80('0x26')]={};this[_0x5c80('0x27')]={};this[_0x5c80('0x28')]={};this[_0x5c80('0x29')]={};this[_0x5c80('0x2a')]={};this['queueBookedRR']={};this[_0x5c80('0x2b')]={};ami['on']('agentconnect',this[_0x5c80('0x2c')][_0x5c80('0x2d')](this));ami['on'](_0x5c80('0x2e'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x5c80('0x2f'),this[_0x5c80('0x30')][_0x5c80('0x2d')](this));ami['on'](_0x5c80('0x31'),this[_0x5c80('0x32')][_0x5c80('0x2d')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x5c80('0x2d')](this));ami['on'](_0x5c80('0x33'),this[_0x5c80('0x34')][_0x5c80('0x2d')](this));ami['on'](_0x5c80('0x35'),this['syncHangup']['bind'](this));ami['on'](_0x5c80('0x36'),this[_0x5c80('0x37')]['bind'](this));ami['on'](_0x5c80('0x38'),this[_0x5c80('0x39')][_0x5c80('0x2d')](this));ami['on'](_0x5c80('0x3a'),this[_0x5c80('0x3b')][_0x5c80('0x2d')](this));ami['on'](_0x5c80('0x3c'),this[_0x5c80('0x3d')][_0x5c80('0x2d')](this));this[_0x5c80('0x3e')]();this[_0x5c80('0x3f')]();RpcSetting[_0x5c80('0x40')]()[_0x5c80('0x41')](function(_0x54ae40){previewRecallmeReminderInterval=_0x54ae40['previewRecallmeReminderInterval'];});}function isNotNull(_0x35f51b){return _0x35f51b!==null&&!_[_0x5c80('0x42')](_0x35f51b);}function msgResponse(_0x536a20,_0x34a246,_0x1d0810){return{'action':_0x536a20,'response':_0x34a246,'message':_0x1d0810,'stack':_0x1d0810};}function emit(_0x410772,_0xb051b5,_0x4b3747){io['to'](_0x410772)['emit'](_0xb051b5,_0x4b3747);}function emitOutboundVoiceQueueSummary(_0x40e7d1){if(_0x40e7d1[_0x5c80('0x43')]==='outbound'){logger[_0x5c80('0x44')](_0x5c80('0x45'),util[_0x5c80('0x46')](_0x40e7d1,{'showHidden':![],'depth':null}));emit(util[_0x5c80('0x47')](_0x5c80('0x48'),_0x40e7d1[_0x5c80('0x49')]),'voice_queue:save',_0x40e7d1);}}function checkGetDataPredictive(_0x447fa7){if(isNotNull(_0x447fa7)&&!_[_0x5c80('0x4a')](_0x447fa7)){loggerPredictive['info'](_0x5c80('0x4b'));loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x4d'),_0x447fa7[_0x5c80('0x4e')]);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x4f'),_0x447fa7[_0x5c80('0x50')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x447fa7[_0x5c80('0x51')]);loggerPredictive['info'](_0x5c80('0x52'),_0x447fa7[_0x5c80('0x53')]);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x54'),_0x447fa7['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x5c80('0x4c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x447fa7[_0x5c80('0x55')]);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x56'));if(_0x447fa7['predictiveIntervalTotalCalls']>0x0){if(!_[_0x5c80('0x42')](_0x447fa7[_0x5c80('0x55')])&&_0x447fa7[_0x5c80('0x55')]>0x0){return!![];}loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x57'));if(!_[_0x5c80('0x42')](_0x447fa7['predictiveIntervalAvgHoldtime'])&&_0x447fa7[_0x5c80('0x58')]>0x0){return!![];}loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x59'));}else{loggerPredictive['info'](_0x5c80('0x5a'));}}else{loggerPredictive['info'](_0x5c80('0x5b'));}return![];}function mergeDataErlangB(_0x3fb7cf){return function(_0x2d3816){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x5c80('0x4c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d3816[_0x5c80('0x5c')]);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x5d'),_0x2d3816[_0x5c80('0x5e')]);loggerPredictive[_0x5c80('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d3816[_0x5c80('0x5f')]);loggerPredictive[_0x5c80('0x4c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d3816[_0x5c80('0x60')]);loggerPredictive[_0x5c80('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d3816[_0x5c80('0x5f')]);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x56'));_[_0x5c80('0x61')](_0x3fb7cf,_0x2d3816);};}function ifInterval(_0x336def,_0x3602e8){if(_['isUndefined'](_0x3602e8)){return![];}return utils[_0x5c80('0x62')](undefined,_0x3602e8)<_0x336def*0x3c;}function clearPredictiveAttributes(_0x3792ab){if(_0x3792ab['startProgressive']){_0x3792ab['startProgressive']=undefined;loggerPredictive[_0x5c80('0x44')](_0x3792ab[_0x5c80('0x49')],'startProgressive\x20value\x20cleared');}if(_0x3792ab['startPredictive']){_0x3792ab[_0x5c80('0x27')]=undefined;loggerPredictive[_0x5c80('0x44')](_0x3792ab[_0x5c80('0x49')],'startPredictive\x20value\x20cleared');}if(_0x3792ab[_0x5c80('0x63')]){clearInterval(_0x3792ab[_0x5c80('0x63')]);_0x3792ab[_0x5c80('0x63')]=undefined;loggerPredictive[_0x5c80('0x44')](_0x3792ab[_0x5c80('0x49')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x2c54b8,_0x524e30){return function(_0x98425b){loggerPredictive[_0x5c80('0x64')](_0x524e30['name'],_0x2c54b8);loggerPredictive[_0x5c80('0x64')](_0x98425b[_0x5c80('0x65')]);clearPredictiveAttributes(_0x524e30);};}function loggerCatch(_0x5e8c74){return function(_0x311889){logger[_0x5c80('0x64')](_0x5e8c74,util[_0x5c80('0x46')](_0x311889,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xf7425b){return function(_0x3ad38a){if(isNotNull(_0x3ad38a)&&isNotNull(_0x3ad38a[0x0])){if(_0x3ad38a[0x0]['contactsRescheduled']>0x0){_0xf7425b[_0x5c80('0x66')]=utils[_0x5c80('0x67')]['CONTACTS_RESCHEDULED'];logger['info'](_0x5c80('0x68')+_0xf7425b[_0x5c80('0x49')],_0x3ad38a[0x0][_0x5c80('0x69')],'contacts');}else{_0xf7425b[_0x5c80('0x66')]=utils[_0x5c80('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0x5c80('0x4c')](_0x5c80('0x6a')+_0xf7425b[_0x5c80('0x49')]);}}};}function createObjHistory(_0x5804a2,_0x3ce642,_0x43c16b,_0x47ba06,_0x4e9a5e){_0x5804a2[_0x5c80('0x66')]=_0x43c16b;var _0x45f753=new Action(_0x5804a2,_0x3ce642);var _0x5453fa=new History(_0x45f753);_0x5453fa[_0x5c80('0x6b')]=_0x47ba06;_0x5453fa['statedesc']=_0x4e9a5e;_0x5453fa[_0x5c80('0x6c')]=_0x45f753[_0x5c80('0x6d')];return _0x5453fa;}function unlockQueueStatus(_0x397487,_0x5640bb){setTimeout(function(){if(_[_0x5c80('0x42')](_0x397487[_0x5c80('0x6e')])){loggerBooked[_0x5c80('0x64')](_0x5c80('0x6f'),_0x5640bb);}_0x397487['queueStatusComplete']=!![];loggerBooked[_0x5c80('0x4c')](_0x5c80('0x70'),_0x5640bb,JSON['stringify'](_[_0x5c80('0x71')](_0x397487,[_0x5c80('0x49'),_0x5c80('0x6e')])));},0x1f3);}function checkInterval(_0x280409){return function(){if(!isNotNull(_0x280409[_0x5c80('0x72')])){_0x280409[_0x5c80('0x66')]=utils[_0x5c80('0x67')][_0x5c80('0x73')];throw _0x280409[_0x5c80('0x49')]+_0x5c80('0x74');}if(!isNotNull(_0x280409[_0x5c80('0x72')][_0x5c80('0x75')])){_0x280409[_0x5c80('0x66')]=utils[_0x5c80('0x67')][_0x5c80('0x73')];throw _0x280409[_0x5c80('0x49')]+_0x5c80('0x74');}if(!isNotNull(_['isEmpty'](_0x280409[_0x5c80('0x72')][_0x5c80('0x75')]))){_0x280409['message']=utils[_0x5c80('0x67')][_0x5c80('0x73')];throw _0x280409[_0x5c80('0x49')]+_0x5c80('0x74');}};}function checkIsIVRCampaignActive(_0x4f2de7){return function(){if(!utils[_0x5c80('0x76')](_0x4f2de7)){_0x4f2de7[_0x5c80('0x66')]=utils[_0x5c80('0x67')][_0x5c80('0x77')];throw _0x4f2de7[_0x5c80('0x49')]+_0x5c80('0x78');}};}function emitCampaignSummary(_0x458282){if(utils[_0x5c80('0x79')](_0x458282)){emit(util[_0x5c80('0x47')](_0x5c80('0x7a'),_0x458282[_0x5c80('0x49')]),_0x5c80('0x7b'),_0x458282);}}function loggerCatchQueueSummary(_0x3e5050,_0x58e729){return function(_0x4e8d90){clearPredictiveAttributes(_0x58e729);emitCampaignSummary(_0x58e729);loggerSyncQueueSummary[_0x5c80('0x44')](_0x3e5050,util[_0x5c80('0x46')](_0x4e8d90,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x55f6ac){if(_0x55f6ac['sendMessageOneNotActive']){if(_0x55f6ac['originated']===0x0){_0x55f6ac['sendMessageOneNotActive']=![];_0x55f6ac[_0x5c80('0x66')]=utils['CAMPAIGN_STATUS'][_0x5c80('0x77')];loggerSyncQueueSummary[_0x5c80('0x44')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x55f6ac[_0x5c80('0x49')],_0x5c80('0x7c'));}else{_0x55f6ac[_0x5c80('0x66')]=utils[_0x5c80('0x67')][_0x5c80('0x7d')];loggerSyncQueueSummary[_0x5c80('0x44')](_0x5c80('0x7e'),_0x55f6ac[_0x5c80('0x49')],_0x5c80('0x7f'));}emitCampaignSummary(_0x55f6ac);}}function myreject(_0x92d4b9){return function(_0x5ced51){return _0x92d4b9(msgResponse(_0x5c80('0x80'),_0x5c80('0x81'),JSON['stringify'](_0x5ced51)));};}Dialer[_0x5c80('0x19')][_0x5c80('0x82')]=function(_0x54a3ec){return!_['isUndefined'](_0x54a3ec)&&_0x54a3ec&&!_[_0x5c80('0x42')](_0x54a3ec['name'])&&!_[_0x5c80('0x42')](_0x54a3ec[_0x5c80('0x83')])&&_0x54a3ec['active']&&(this[_0x5c80('0x21')][util['format'](_0x5c80('0x84'),_0x54a3ec[_0x5c80('0x49')])][_0x5c80('0x85')]===_0x5c80('0x86')||this[_0x5c80('0x21')][util[_0x5c80('0x47')](_0x5c80('0x84'),_0x54a3ec[_0x5c80('0x49')])][_0x5c80('0x85')]===_0x5c80('0x87'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x21d1a7){var _0x1ea0d0=this;return function(){if(!_0x1ea0d0[_0x5c80('0x82')](_0x21d1a7[_0x5c80('0x88')])){if(!_0x1ea0d0['isTrunkReachable'](_0x21d1a7['TrunkBackup'])){_0x21d1a7[_0x5c80('0x66')]=utils[_0x5c80('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x21d1a7[_0x5c80('0x49')]+_0x5c80('0x89');}}};};Dialer[_0x5c80('0x19')][_0x5c80('0x8a')]=function(_0x2c1724,_0x3db5b9,_0x33cc7a,_0xc18993){var _0x55a158=this;return function(){var _0x3bda87=!![];return _0x55a158['ifTimeIvr'](_0x2c1724,_0x3db5b9,_0x33cc7a,_0xc18993,_0x3bda87);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x2c78b5,_0x2ed03f,_0x934782,_0x27f004){var _0x58fc79=this;return function(){var _0x2310ea=![];return _0x58fc79[_0x5c80('0x8b')](_0x2c78b5[_0x5c80('0x75')],_0x2ed03f,_0x934782,_0x27f004,_0x2310ea);};};Dialer[_0x5c80('0x19')][_0x5c80('0x8b')]=function(_0x3570a1,_0x4004d2,_0x1ea015,_0x12b96a,_0x3262c5){var _0x41163a=[];return new Promise(function(_0x4327b8,_0x5167d2){if(!isNotNull(_0x3570a1)){_0x12b96a[_0x5c80('0x66')]=utils['CAMPAIGN_STATUS'][_0x5c80('0x73')];return _0x5167d2(msgResponse(_0x5c80('0x8c'),'Failure',_0x1ea015+_0x5c80('0x8d')));}if(_[_0x5c80('0x4a')](_0x3570a1)){_0x12b96a[_0x5c80('0x66')]=utils['CAMPAIGN_STATUS'][_0x5c80('0x8e')];return _0x5167d2(msgResponse(_0x5c80('0x8c'),'Failure',_0x1ea015+_0x5c80('0x8f')));}if(_0x4004d2&&_['isUndefined'](config['timezones'][_0x4004d2])){_0x12b96a['message']=utils[_0x5c80('0x67')][_0x5c80('0x90')];return _0x5167d2(msgResponse(_0x5c80('0x8c'),_0x5c80('0x91'),_0x1ea015+_0x5c80('0x92')+_0x4004d2));}if(_[_0x5c80('0x93')](_0x3570a1)){for(var _0x5f2910=0x0;_0x5f2910<_0x3570a1[_0x5c80('0x94')];_0x5f2910+=0x1){_0x41163a[_0x5c80('0x95')](ami[_0x5c80('0x96')]({'action':'command','command':util[_0x5c80('0x47')](_0x5c80('0x97'),_0x3570a1[_0x5f2910][_0x5c80('0x98')],!_['isUndefined'](config[_0x5c80('0x99')][_0x4004d2])?_0x4004d2:'')})[_0x5c80('0x41')](function(_0x3df2e6){return _0x3df2e6[_0x5c80('0x9a')][_0x5c80('0x9b')](_0x5c80('0x9c'))>=0x0;})[_0x5c80('0x9d')](myreject(_0x5167d2)));}}else{_0x41163a['push'](ami[_0x5c80('0x96')]({'action':_0x5c80('0x9e'),'command':util[_0x5c80('0x47')](_0x5c80('0x97'),_0x3570a1,!_['isUndefined'](config[_0x5c80('0x99')][_0x4004d2])?_0x4004d2:'')})['then'](function(_0x222b16){return _0x222b16['content'][_0x5c80('0x9b')](_0x5c80('0x9c'))>=0x0;})[_0x5c80('0x9d')](myreject(_0x5167d2)));}Promise['all'](_0x41163a)[_0x5c80('0x41')](function(_0x16bc8e){var _0x6e27b7=_[_0x5c80('0x9f')](_0x16bc8e);if(_0x6e27b7){return _0x4327b8(_0x6e27b7);}else{_0x12b96a['message']=_0x3262c5?utils[_0x5c80('0x67')][_0x5c80('0xa0')]:utils[_0x5c80('0x67')][_0x5c80('0xa1')];return _0x5167d2(msgResponse(_0x5c80('0xa2'),_0x5c80('0x91'),'Global:\x20'+_0x3262c5+'\x20'+_0x1ea015+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3570a1,{'showHidden':![],'depth':null})+_0x5c80('0xa3')+_0x4004d2));}})[_0x5c80('0x9d')](function(_0xaa4127){return _0x5167d2(msgResponse(_0x5c80('0x8c'),'Failure',JSON[_0x5c80('0xa4')](_0xaa4127)));});});};Dialer[_0x5c80('0x19')]['loopCampaigns']=function(){var _0x3f78a2=this;return cmHopper[_0x5c80('0xa5')]({'active':![]},{'where':{'active':!![]}})[_0x5c80('0x41')](function(){setInterval(function(){_0x3f78a2[_0x5c80('0xa6')]();},0x3e8);});};Dialer[_0x5c80('0x19')][_0x5c80('0xa6')]=function(){var _0x302af1=this;var _0x1a6101;for(var _0x5e5a99 in this[_0x5c80('0x1f')]){if(typeof this[_0x5c80('0x1f')][_0x5e5a99]!==_0x5c80('0xa7')){_0x1a6101=this[_0x5c80('0x1f')][_0x5e5a99];if(utils['isIVRCampaign'](_0x1a6101)&&utils[_0x5c80('0x76')](_0x1a6101)){_0x1a6101['sendMessageOneNotActive']=!![];Promise[_0x5c80('0xa8')]()[_0x5c80('0x41')](checkIsIVRCampaignActive(_0x1a6101))['then'](checkInterval(_0x1a6101))[_0x5c80('0x41')](_0x302af1[_0x5c80('0xa9')](_0x1a6101))[_0x5c80('0x41')](_0x302af1[_0x5c80('0x8a')](_0x1a6101[_0x5c80('0xaa')],_0x1a6101[_0x5c80('0xab')],_0x1a6101[_0x5c80('0x49')],_0x1a6101))[_0x5c80('0x41')](_0x302af1[_0x5c80('0xac')](_0x1a6101['Interval'],_0x1a6101[_0x5c80('0xab')],_0x1a6101[_0x5c80('0x49')],_0x1a6101))['then'](_0x302af1[_0x5c80('0xad')](_0x1a6101))['catch'](loggerCatchQueueSummary(_0x5c80('0xae'),_0x1a6101));}else{notSendMessagesCampaign(_0x1a6101);}}}};Dialer[_0x5c80('0x19')][_0x5c80('0xaf')]=function(_0x1479e6){if(_0x1479e6[_0x5c80('0xb0')]!==_0x5c80('0x8')){clearPredictiveAttributes(_0x1479e6);}switch(_0x1479e6[_0x5c80('0xb0')]){case _0x5c80('0xb1'):this['handlePower'](_0x1479e6,0x1);break;case _0x5c80('0xb2'):this[_0x5c80('0xb3')](_0x1479e6,_0x1479e6[_0x5c80('0xb4')]);break;case'predictive':this[_0x5c80('0x8')](_0x1479e6);break;case _0x5c80('0xb5'):this[_0x5c80('0xb3')](_0x1479e6,0x1);break;default:logger[_0x5c80('0x64')](_0x5c80('0xb6'),_0x1479e6['name'],'method\x20not\x20recognized');}};Dialer[_0x5c80('0x19')]['ifTime']=function(_0xd200ce,_0x2be199){var _0x306f1a=_0xd200ce['dialTimezone'];var _0x202b5a=_0x2be199?_0xd200ce['dialGlobalInterval']:_0xd200ce['Interval'][_0x5c80('0x75')];logger[_0x5c80('0xb7')]('Dialer::ifTime()',_0x202b5a,_0x306f1a,_0xd200ce[_0x5c80('0x49')],util[_0x5c80('0x47')](_0x5c80('0xb8'),_0xd200ce['name'],_0xd200ce['id']));var _0xd8c883=null;return Interval[_0x5c80('0xb9')](_0x202b5a,_0x306f1a)[_0x5c80('0x41')](function(_0x36c051){if(_0x36c051===!![]){return _0x36c051;}else{_0xd200ce['message']=_0x2be199?utils[_0x5c80('0x67')][_0x5c80('0xa0')]:utils['CAMPAIGN_STATUS'][_0x5c80('0xa1')];_0xd8c883=msgResponse(_0x5c80('0xa2'),_0x5c80('0x91'),_0x5c80('0xba')+_0x2be199+'\x20'+_0xd200ce[_0x5c80('0x49')]+_0x5c80('0xbb')+util['inspect'](_0x202b5a,{'showHidden':![],'depth':null})+_0x5c80('0xa3')+_0x306f1a);}if(_0xd8c883!==null){logger['silly'](_0x5c80('0xbc'),_0xd8c883);_0xd8c883[_0x5c80('0xbd')]=_0x2be199;throw _0xd8c883;}})['catch'](function(_0x2665d6){logger['error']('AMI\x20IfTime',_0x2665d6);throw msgResponse(_0x5c80('0x80'),_0x5c80('0x81'),util['inspect'](_0x2665d6,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x5c80('0x2c')]=function(_0xadaabc){if(this[_0x5c80('0x1e')][_0xadaabc[_0x5c80('0xbe')]]){if(this[_0x5c80('0x25')][_0xadaabc[_0x5c80('0xbf')]]&&this[_0x5c80('0x25')][_0xadaabc[_0x5c80('0xbf')]][_0x5c80('0x43')]!==_0x5c80('0xc0')){utils['decrementOriginate'](this[_0x5c80('0x1e')][_0xadaabc[_0x5c80('0xbe')]],_0x5c80('0xc1'));this[_0x5c80('0x25')][_0xadaabc[_0x5c80('0xbf')]][_0x5c80('0xc2')]=moment()[_0x5c80('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5c80('0x19')][_0x5c80('0x32')]=function(_0x2ac196){var _0x20c4cb=this['uniqueId'][_0x2ac196[_0x5c80('0xbf')]];if(this[_0x5c80('0x1e')][_0x2ac196[_0x5c80('0xbe')]]){if(_0x20c4cb&&_0x20c4cb[_0x5c80('0x43')]!=='ivr'){delete this[_0x5c80('0x25')][_0x2ac196[_0x5c80('0xbf')]];this[_0x5c80('0x1e')][_0x2ac196[_0x5c80('0xbe')]][_0x5c80('0xc3')]+=0x1;var _0x5dc21b=new AgentComplete(_0x20c4cb,_0x2ac196);if(_0x2ac196[_0x5c80('0xc4')]===_0x5c80('0xc5')){_0x5dc21b[_0x5c80('0xc6')]=this[_0x5c80('0x1e')][_0x2ac196[_0x5c80('0xbe')]][_0x5c80('0xc7')]&&this[_0x5c80('0x1e')][_0x2ac196[_0x5c80('0xbe')]][_0x5c80('0xc8')]?moment()['format'](_0x5c80('0xc9')):undefined;}hopperUtils['createHistory'](_0x5dc21b)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xca')));hopperUtils[_0x5c80('0xcb')](_0x5dc21b)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xcc')));}}};Dialer[_0x5c80('0x19')][_0x5c80('0xcd')]=function(_0x40d187){var _0x13723b=this['uniqueId'][_0x40d187['uniqueid']];var _0x1cb7a9=this;var _0x4d6934=![];var _0x32ee86;var _0x55a263;if(this['voiceQueues'][_0x40d187[_0x5c80('0xbe')]]){if(_0x13723b&&_0x13723b[_0x5c80('0x43')]!=='ivr'){delete this[_0x5c80('0x25')][_0x40d187[_0x5c80('0xbf')]];utils['decrementOriginate'](this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]],_0x5c80('0xce'));_0x13723b['droptime']=moment()['format'](_0x5c80('0xc9'));var _0x607235=new QueueCallerAbandon(_0x13723b,_0x40d187);if(utils['getSeconds'](_0x13723b[_0x5c80('0xcf')],_0x13723b[_0x5c80('0xd0')])>=_0x13723b[_0x5c80('0xd1')]){this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0x51')]+=0x1;this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xd2')]+=0x1;_0x607235[_0x5c80('0x6b')]=0xa;_0x607235['statedesc']=_0x5c80('0xd3');_0x607235['dropreason']=_0x5c80('0xd4');_0x607235[_0x5c80('0xc6')]=this['voiceQueues'][_0x40d187[_0x5c80('0xbe')]]['dialQueueProject2']?moment()[_0x5c80('0x47')](_0x5c80('0xc9')):undefined;_0x607235[_0x5c80('0xd5')]+=0x1;_0x607235[_0x5c80('0xd6')]+=0x1;_0x32ee86=this['voiceQueues'][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xd7')];_0x55a263=this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xd8')];hopperUtils[_0x5c80('0xd9')](_0x607235,_0x607235['state'],_0x13723b[_0x5c80('0xda')])[_0x5c80('0x41')](function(_0x4014c5){_0x4d6934=_0x4014c5[_0x5c80('0xdb')]==0x1;if(_0x607235[_0x5c80('0xd5')]>=_0x1cb7a9[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xdc')]){_0x1cb7a9[_0x5c80('0xdd')](_0x607235,_0x4014c5[_0x5c80('0xdb')]);}else{hopperUtils[_0x5c80('0xde')]({'active':![],'countdropretry':_0x607235[_0x5c80('0xd5')],'scheduledat':moment()[_0x5c80('0xdf')](_0x1cb7a9['voiceQueues'][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xd7')],_0x5c80('0xe0'))[_0x5c80('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13723b[_0x5c80('0xe1')],'ListId':_0x13723b['ListId'],'VoiceQueueId':_0x13723b[_0x5c80('0xe2')]||undefined,'CampaignId':_0x13723b[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xe4')));var _0x356e88=new History(_0x607235);_0x356e88[_0x5c80('0x6b')]=0xa;_0x356e88[_0x5c80('0xe5')]='Drop';_0x356e88[_0x5c80('0x6d')]=moment()['format'](_0x5c80('0xc9'));_0x356e88['endtime']=_0x356e88['starttime'];_0x356e88[_0x5c80('0xe6')]=_0x607235['calleridname'];_0x356e88[_0x5c80('0xe7')]=_0x607235['calleridnum'];hopperUtils[_0x5c80('0xe8')](_0x356e88)['catch'](loggerCatch(_0x5c80('0xe9')));}})[_0x5c80('0x41')](function(){if(_0x4d6934)hopperUtils['swapAdditionalPhones'](_0x607235,_0x32ee86,_0x55a263)['then'](function(){return 0x1;});});}else{this[_0x5c80('0x1e')][_0x40d187['queue']][_0x5c80('0x53')]+=0x1;this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xea')]+=0x1;_0x607235[_0x5c80('0x6b')]=0xb;_0x607235['statedesc']=_0x5c80('0xeb');_0x607235[_0x5c80('0xec')]=_0x5c80('0xed');_0x607235[_0x5c80('0xee')]+=0x1;_0x607235[_0x5c80('0xd6')]+=0x1;_0x32ee86=this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xef')];_0x55a263=this[_0x5c80('0x1e')][_0x40d187[_0x5c80('0xbe')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x5c80('0xd9')](_0x607235,_0x607235[_0x5c80('0x6b')],_0x13723b[_0x5c80('0xda')])['then'](function(_0x6a1d2a){if(_0x607235[_0x5c80('0xee')]>=_0x1cb7a9['voiceQueues'][_0x40d187[_0x5c80('0xbe')]][_0x5c80('0xf0')]){_0x1cb7a9['queueCallerAbandonCreateState'](_0x607235,_0x6a1d2a[_0x5c80('0xdb')]);}else{hopperUtils[_0x5c80('0xde')]({'active':![],'countabandonedretry':_0x607235[_0x5c80('0xee')],'scheduledat':moment()[_0x5c80('0xdf')](_0x1cb7a9[_0x5c80('0x1e')][_0x40d187['queue']][_0x5c80('0xef')],_0x5c80('0xe0'))['format'](_0x5c80('0xc9')),'ContactId':_0x13723b[_0x5c80('0xe1')],'ListId':_0x13723b['ListId'],'VoiceQueueId':_0x13723b[_0x5c80('0xe2')]||undefined,'CampaignId':_0x13723b[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xf1')));var _0x20c44a=new History(_0x607235);_0x20c44a[_0x5c80('0x6b')]=0xb;_0x20c44a['statedesc']=_0x5c80('0xeb');_0x20c44a[_0x5c80('0x6d')]=moment()['format'](_0x5c80('0xc9'));_0x20c44a[_0x5c80('0x6c')]=_0x20c44a[_0x5c80('0x6d')];_0x20c44a[_0x5c80('0xe6')]=_0x607235[_0x5c80('0xe6')];_0x20c44a[_0x5c80('0xe7')]=_0x607235['calleridnum'];hopperUtils['createHistory'](_0x20c44a)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xf2')));}})['then'](function(){if(_0x4d6934)hopperUtils[_0x5c80('0xf3')](_0x607235,_0x32ee86,_0x55a263)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x5c80('0x37')]=function(_0x5cd611){if(this['actions'][_0x5cd611['uniqueid']]){this[_0x5c80('0x24')][_0x5cd611[_0x5c80('0xbf')]][_0x5c80('0xf4')]=_0x5cd611[_0x5c80('0xf4')];}if(this[_0x5c80('0x25')][_0x5cd611['uniqueid']]){this['uniqueId'][_0x5cd611[_0x5c80('0xbf')]][_0x5c80('0xf4')]=_0x5cd611['channel'];}};Dialer[_0x5c80('0x19')][_0x5c80('0x3b')]=function(_0x4bd793){if(!this[_0x5c80('0x24')][_0x4bd793['actionid']]){return;}var _0x11af9a=this[_0x5c80('0x1e')][this[_0x5c80('0x24')][_0x4bd793[_0x5c80('0xf5')]]['queue']][_0x5c80('0xf6')]||_0x5c80('0xf7');if(_0x11af9a===_0x5c80('0xf8')){if(this['actions'][_0x4bd793[_0x5c80('0xf5')]]&&_[_0x5c80('0xf9')](this[_0x5c80('0x24')][_0x4bd793[_0x5c80('0xf5')]][_0x5c80('0xfa')])&&_0x4bd793['status']==='1'&&_0x4bd793[_0x5c80('0xfb')]==='0'){if(this[_0x5c80('0x20')][_0x4bd793['stateinterface']]){if(!this[_0x5c80('0x20')][_0x4bd793[_0x5c80('0xfc')]][_0x5c80('0xfa')]){this[_0x5c80('0x20')][_0x4bd793[_0x5c80('0xfc')]][_0x5c80('0xfa')]=!![];this[_0x5c80('0x24')][_0x4bd793['actionid']][_0x5c80('0xfa')]=!![];this[_0x5c80('0x24')][_0x4bd793[_0x5c80('0xf5')]]['stateinterface']=_0x4bd793[_0x5c80('0xfc')];}}}}else if(_0x11af9a==='rrmemory'){if(this[_0x5c80('0x24')][_0x4bd793[_0x5c80('0xf5')]]){if(this[_0x5c80('0x20')][_0x4bd793[_0x5c80('0xfc')]]){this['actions'][_0x4bd793[_0x5c80('0xf5')]][_0x5c80('0xfc')]=_0x4bd793[_0x5c80('0xfc')];if(_['isNil'](this[_0x5c80('0x2a')][this['actions'][_0x4bd793[_0x5c80('0xf5')]][_0x5c80('0xbe')]])){this['queueBooked'][this[_0x5c80('0x24')][_0x4bd793['actionid']][_0x5c80('0xbe')]]=[];}this['queueBooked'][this[_0x5c80('0x24')][_0x4bd793[_0x5c80('0xf5')]][_0x5c80('0xbe')]][_0x5c80('0x95')](_['merge'](_['pick'](this[_0x5c80('0x24')][_0x4bd793[_0x5c80('0xf5')]],[_0x5c80('0xfd'),_0x5c80('0xfc')]),{'status':_0x4bd793[_0x5c80('0x85')],'paused':_0x4bd793[_0x5c80('0xfb')]}));}}}};Dialer[_0x5c80('0x19')][_0x5c80('0x3d')]=function(_0x225d9a){if(!this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]]){return;}var _0x57a98f=this;var _0x590ed7=this[_0x5c80('0x1e')][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]];var _0x4bcce4=_0x590ed7[_0x5c80('0xf6')]||_0x5c80('0xf7');if(_0x4bcce4===_0x5c80('0xf8')){if(this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]]&&this[_0x5c80('0x24')][_0x225d9a['actionid']][_0x5c80('0xfc')]){this[_0x5c80('0x1d')][_0x5c80('0xfe')](this['actions'][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xfd')],this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xfc')])[_0x5c80('0x9d')](function(_0x663745){logger[_0x5c80('0x64')](_0x5c80('0xff'),util['inspect'](_0x663745,{'showHidden':![],'depth':null}));})[_0x5c80('0x1c')](function(){utils[_0x5c80('0x100')](_0x57a98f['voiceQueues'][_0x57a98f[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]],_0x5c80('0x101'));_0x57a98f[_0x5c80('0x20')][_0x57a98f[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xfc')]][_0x5c80('0xfa')]=![];delete _0x57a98f['actions'][_0x225d9a[_0x5c80('0xf5')]];unlockQueueStatus(_0x590ed7);});}else{utils[_0x5c80('0x100')](this[_0x5c80('0x1e')][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]],_0x5c80('0x101'));hopperUtils[_0x5c80('0xde')]({'active':![],'ContactId':this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xe1')],'ListId':this['actions'][_0x225d9a['actionid']][_0x5c80('0x102')],'VoiceQueueId':this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x5c80('0x24')][_0x225d9a['actionid']][_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x103')));delete this['actions'][_0x225d9a[_0x5c80('0xf5')]];unlockQueueStatus(_0x590ed7);}}else if(_0x4bcce4==='rrmemory'){var _0x420a00;if(this[_0x5c80('0x24')][_0x225d9a['actionid']]&&!_[_0x5c80('0x4a')](this[_0x5c80('0x2a')][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]])){if(this[_0x5c80('0x104')][_0x57a98f[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]]){this[_0x5c80('0x104')][_0x57a98f['actions'][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]]=this[_0x5c80('0x104')][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]]?this[_0x5c80('0x104')][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]]['queue']]:this[_0x5c80('0x2a')][this['actions'][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]]?this[_0x5c80('0x2a')][this['actions'][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]][_0x5c80('0x105')]||0x0:0x0;}this['queueBooked'][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]]['queue']][_0x5c80('0x105')]=this[_0x5c80('0x104')][this[_0x5c80('0x24')][_0x225d9a[_0x5c80('0xf5')]][_0x5c80('0xbe')]];for(var _0x441537=0x0;_0x441537=_0x3354da[_0x5c80('0x128')]){_0x5b8e03[_0x5c80('0x129')](_0x257ad5,_0x1e766a,_0x401d0e,_0x5c80('0x12a'));}else{if(_0x257ad5['countmachineretry']>=_0x3354da['dialMachineMaxRetry']){_0x5b8e03[_0x5c80('0x12b')](_0x257ad5,_0x1e766a,_0x401d0e,_0x5c80('0x12c'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x257ad5[_0x5c80('0x124')],'scheduledat':moment()['add'](_0x3354da[_0x5c80('0x12d')],_0x5c80('0xe0'))[_0x5c80('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x257ad5[_0x5c80('0xe1')],'ListId':_0x257ad5[_0x5c80('0x102')],'VoiceQueueId':_0x257ad5[_0x5c80('0xe2')]||undefined,'CampaignId':_0x257ad5[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x12e')));_0x1e766a({'reschedule':0x1});}}});}if(_0x3a2120['type']===_0x5c80('0xc0')&&this['campaigns'][_0x3a2120[_0x5c80('0xbe')]][_0x5c80('0x115')]&&_0xb9e849[_0x5c80('0x122')]===_0x5c80('0x116')){delete this[_0x5c80('0x25')][_0xb9e849[_0x5c80('0xbf')]];utils['decrementOriginate'](this['campaigns'][_0x3a2120[_0x5c80('0xbe')]],_0x5c80('0x117'));_0x3c8273=new Hangup(_0x3a2120,_0xb9e849);_0x3c8273[_0x5c80('0x6b')]=0x12;_0x3c8273[_0x5c80('0xe5')]='HangupInAMD';_0x3c8273['membername']=_0x5c80('0x11b');ami[_0x5c80('0x11c')](_0x5c80('0x11d'),ut[_0x5c80('0x11e')](_0x3c8273,_0x5c80('0x11f')));this[_0x5c80('0x120')](_0x3c8273,_0x5c80('0x12f'),_0x5c80('0x130'));}if(_0x3a2120[_0x5c80('0x43')]===_0x5c80('0xc0')&&this[_0x5c80('0x1f')][_0x3a2120[_0x5c80('0xbe')]]['dialAMDActive']&&_0xb9e849['value']===_0x5c80('0x123')){return new Promise(function(_0x1afd8c,_0xb8cbba){delete _0x5b8e03['uniqueId'][_0xb9e849[_0x5c80('0xbf')]];utils[_0x5c80('0x100')](_0x5b8e03[_0x5c80('0x1f')][_0x3a2120['queue']],_0x5c80('0x117'));_0x5b8e03[_0x5c80('0x1f')][_0x3a2120[_0x5c80('0xbe')]][_0x5c80('0xc3')]+=0x1;_0x5b8e03['campaigns'][_0x3a2120['queue']][_0x5c80('0x118')]+=0x1;var _0x4100b5=_0x5b8e03[_0x5c80('0x1f')][_0x3a2120[_0x5c80('0xbe')]];var _0x3ba3a4=new Hangup(_0x3a2120,_0xb9e849);_0x3ba3a4['state']=0x13;_0x3ba3a4[_0x5c80('0xe5')]=_0x5c80('0x131');_0x3ba3a4[_0x5c80('0x11a')]=_0x5c80('0x11b');_0x3ba3a4[_0x5c80('0x124')]+=0x1;_0x3ba3a4['countglobal']+=0x1;_0x3ba3a4['amd']=!![];ami[_0x5c80('0x11c')](_0x5c80('0x11d'),ut[_0x5c80('0x11e')](_0x3ba3a4,_0x5c80('0x11f')));hopperUtils[_0x5c80('0xe8')](_0x3ba3a4)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x132')));if(_0x3ba3a4[_0x5c80('0x125')]+_0x3ba3a4[_0x5c80('0x126')]+_0x3ba3a4[_0x5c80('0x133')]+_0x3ba3a4[_0x5c80('0x134')]+_0x3ba3a4['countdropretry']+_0x3ba3a4[_0x5c80('0xee')]+_0x3ba3a4['countmachineretry']+_0x3ba3a4[_0x5c80('0x127')]>=_0x4100b5[_0x5c80('0x128')]){_0x5b8e03[_0x5c80('0x129')](_0x3ba3a4,_0x1afd8c,_0xb8cbba,'reason19\x20machine....');}else{if(_0x3ba3a4['countmachineretry']>=_0x4100b5[_0x5c80('0x135')]){_0x5b8e03[_0x5c80('0x12b')](_0x3ba3a4,_0x1afd8c,_0xb8cbba,'reason\x2019\x20machine....');}else{hopperUtils[_0x5c80('0xde')]({'active':![],'countmachineretry':_0x3ba3a4[_0x5c80('0x124')],'scheduledat':moment()[_0x5c80('0xdf')](_0x4100b5['dialMachineRetryFrequency'],'minutes')[_0x5c80('0x47')](_0x5c80('0xc9')),'ContactId':_0x3ba3a4[_0x5c80('0xe1')],'ListId':_0x3ba3a4['ListId'],'VoiceQueueId':_0x3ba3a4[_0x5c80('0xe2')]||undefined,'CampaignId':_0x3ba3a4['CampaignId']||undefined})['catch'](loggerCatch(_0x5c80('0x12e')));_0x1afd8c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x5c80('0x136')]=function(_0xa5b02b){var _0x4a9cdb=this[_0x5c80('0x25')][_0xa5b02b['uniqueid']];var _0x2817f0;if(!_0x4a9cdb){return;}if(_0x4a9cdb['type']===_0x5c80('0xc0')){delete this['uniqueId'][_0xa5b02b[_0x5c80('0xbf')]];utils[_0x5c80('0x100')](this[_0x5c80('0x1f')][_0x4a9cdb[_0x5c80('0xbe')]],'[syncHangup]');this[_0x5c80('0x1f')][_0x4a9cdb[_0x5c80('0xbe')]][_0x5c80('0x137')]+=0x1;if(_0xa5b02b[_0x5c80('0x138')]==='Normal\x20Clearing'){const _0x67b1f9=new AgentComplete(_0x4a9cdb,_0xa5b02b);_0x67b1f9[_0x5c80('0xe3')]=this[_0x5c80('0x1f')][_0x4a9cdb['queue']]['id'];hopperUtils[_0x5c80('0xe8')](_0x67b1f9)['catch'](loggerCatch(_0x5c80('0x139')));hopperUtils['moveContactManagedDialer'](_0x67b1f9)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x13a')));}else{_0x2817f0=new Hangup(_0x4a9cdb,_0xa5b02b);hopperUtils[_0x5c80('0xe8')](_0x2817f0)[_0x5c80('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2817f0)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x13b')));}}else{if(isNotNull(this['voiceQueues'][_0x4a9cdb[_0x5c80('0xbe')]][_0x5c80('0x13c')])){delete this['uniqueId'][_0xa5b02b[_0x5c80('0xbf')]];utils[_0x5c80('0x100')](this[_0x5c80('0x1e')][_0x4a9cdb[_0x5c80('0xbe')]],'[syncHangup]');this[_0x5c80('0x1e')][_0x4a9cdb[_0x5c80('0xbe')]]['outboundAnswerCallsDay']+=0x1;this[_0x5c80('0x1e')][_0x4a9cdb[_0x5c80('0xbe')]][_0x5c80('0x118')]+=0x1;_0x2817f0=new Hangup(_0x4a9cdb,_0xa5b02b);_0x2817f0[_0x5c80('0x6b')]=0x10;_0x2817f0['statedesc']=_0x5c80('0x13d');_0x2817f0[_0x5c80('0x11a')]=_0x5c80('0x13e');hopperUtils[_0x5c80('0xe8')](_0x2817f0)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x13f')));hopperUtils[_0x5c80('0xcb')](_0x2817f0)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x13b')));}else{delete this['uniqueId'][_0xa5b02b['uniqueid']];utils['decrementOriginate'](this[_0x5c80('0x1e')][_0x4a9cdb['queue']],_0x5c80('0x140'));if(_0xa5b02b[_0x5c80('0x138')]===_0x5c80('0x141')){this[_0x5c80('0x1e')][_0x4a9cdb[_0x5c80('0xbe')]][_0x5c80('0xc3')]+=0x1;const _0x469935=new AgentComplete(_0x4a9cdb,_0xa5b02b);_0x469935[_0x5c80('0xe2')]=this[_0x5c80('0x1e')][_0x4a9cdb[_0x5c80('0xbe')]]['id'];hopperUtils['createHistory'](_0x469935)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xca')));hopperUtils[_0x5c80('0xcb')](_0x469935)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xcc')));}else{this[_0x5c80('0x1e')][_0x4a9cdb[_0x5c80('0xbe')]][_0x5c80('0x142')]+=0x1;_0x2817f0=new Hangup(_0x4a9cdb,_0xa5b02b);_0x2817f0[_0x5c80('0x6b')]=0xc;_0x2817f0[_0x5c80('0xe5')]=_0xa5b02b['cause-txt'];_0x2817f0[_0x5c80('0x11a')]='Unknown';hopperUtils[_0x5c80('0xe8')](_0x2817f0)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x143')));hopperUtils[_0x5c80('0xcb')](_0x2817f0)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x144')));}}}};Dialer['prototype']['syncQueueSummary']=function(_0x25265c){var _0x4c988e=this;if(!_0x4c988e[_0x5c80('0x2b')][_0x25265c[_0x5c80('0x49')]]){_0x4c988e[_0x5c80('0x2b')][_0x25265c[_0x5c80('0x49')]]={'running':![]};}else if(_0x4c988e[_0x5c80('0x2b')][_0x25265c[_0x5c80('0x49')]][_0x5c80('0x145')]===!![]){return;}else if(_0x4c988e[_0x5c80('0x2b')][_0x25265c['name']][_0x5c80('0x145')]===![]){_0x4c988e[_0x5c80('0x2b')][_0x25265c['name']][_0x5c80('0x145')]=!![];}var _0x4edcc5=_0x4c988e['voiceQueues'][_0x25265c[_0x5c80('0x49')]];var _0x3acbad=_0x4edcc5[_0x5c80('0x66')]!==utils[_0x5c80('0x67')]['INACTIVE'];var _0x4f1481=utils['isPreviewCampaign'](_0x4edcc5);_0x4edcc5[_0x5c80('0x146')]=utils[_0x5c80('0x147')](_0x4edcc5,_0x4c988e[_0x5c80('0x21')]);Promise[_0x5c80('0xa8')]()[_0x5c80('0x41')](function(){if(_0x4edcc5[_0x5c80('0x146')]===utils[_0x5c80('0x67')][_0x5c80('0x77')]){if(_0x3acbad){clearPredictiveAttributes(_0x4edcc5);_0x25265c[_0x5c80('0x27')]=undefined;_0x25265c[_0x5c80('0x28')]=undefined;}if(_0x4edcc5['statusMessage']===utils[_0x5c80('0x67')][_0x5c80('0x77')]){_0x25265c['available']=0x0;_0x25265c[_0x5c80('0xfb')]=0x0;_0x25265c[_0x5c80('0x148')]=0x0;_0x25265c[_0x5c80('0x149')]=0x0;_0x25265c[_0x5c80('0x14a')]=0x0;}}else if(_0x4edcc5[_0x5c80('0x146')]===utils[_0x5c80('0x67')][_0x5c80('0x14b')]&&!_0x4f1481){return _0x4c988e[_0x5c80('0x8c')](_0x4edcc5,!![])[_0x5c80('0x41')](function(){return _0x4c988e['ifTime'](_0x4edcc5,![]);})[_0x5c80('0x41')](function(){return _0x4c988e[_0x5c80('0xaf')](_0x4edcc5);})[_0x5c80('0x9d')](function(_0x50f0a2){loggerSyncQueueSummary[_0x5c80('0x44')]('[syncQueueSummary]',util['inspect'](_0x50f0a2,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4edcc5);});}else{clearPredictiveAttributes(_0x4edcc5);}})[_0x5c80('0x41')](function(){var _0x3ab457=_0x25265c['compareToOutboundQueue'](_0x4edcc5);if(_0x3ab457||_0x4edcc5[_0x5c80('0x14c')]){_0x4edcc5[_0x5c80('0x14c')]=![];_0x25265c[_0x5c80('0x14d')](_0x4edcc5);Object[_0x5c80('0x14e')](_0x4edcc5,_0x25265c);emitOutboundVoiceQueueSummary(_0x25265c);}_0x4c988e['queuesSummary'][_0x4edcc5[_0x5c80('0x49')]]['running']=![];})[_0x5c80('0x9d')](function(_0x3156ed){logger[_0x5c80('0x64')](_0x5c80('0x14f'),util[_0x5c80('0x46')](_0x3156ed,{'showHidden':![],'depth':null}));_0x4c988e[_0x5c80('0x2b')][_0x4edcc5['name']][_0x5c80('0x145')]=![];});};Dialer[_0x5c80('0x19')]['syncQueueSummaryComplete']=_[_0x5c80('0x150')](function(){var _0x2121ea=_['filter'](this[_0x5c80('0x1e')],function(_0x4ac976){return _0x4ac976[_0x5c80('0x151')];});var _0x37b16f=_[_0x5c80('0x152')](this[_0x5c80('0x20')],function(_0x5714d7){return _0x5714d7[_0x5c80('0x153')]&&_0x5714d7['status']===_0x5c80('0x86');});if(_0x2121ea['length']>0x0&&_0x37b16f['length']>0x0){return Promise[_0x5c80('0xa8')]()[_0x5c80('0x41')](cmHopper[_0x5c80('0x154')](_[_0x5c80('0x155')](_0x2121ea,'id'),previewRecallmeReminderInterval,_[_0x5c80('0x155')](_0x37b16f,'id')))[_0x5c80('0x41')](function(_0x1262c0){for(var _0x54cb32=0x0;_0x54cb32<_0x1262c0['length'];_0x54cb32++){var _0x539f89=_0x1262c0[_0x54cb32][_0x5c80('0x156')][_0x5c80('0x49')];if(_0x539f89)io['to'](util[_0x5c80('0x47')]('user:%s',_0x539f89))[_0x5c80('0x11c')]('user:dialPreviewRecallReminder',{'hopper':_0x1262c0[_0x54cb32]});}})[_0x5c80('0x9d')](function(_0x3fafe1){logger[_0x5c80('0x64')]('checkPreviewRecallReminder',_0x3fafe1);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5c80('0x19')]['loopClearZombieChannels']=function(){var _0x4f013f=this;setInterval(function(){_0x4f013f[_0x5c80('0x157')](_0x4f013f[_0x5c80('0x25')],_0x5c80('0x158'));_0x4f013f[_0x5c80('0x157')](_0x4f013f[_0x5c80('0x24')],_0x5c80('0x159'));},0x32c8);};Dialer[_0x5c80('0x19')][_0x5c80('0x157')]=function(_0x23cdcc,_0x412b47){var _0x1485a9=this;for(var _0x53737b in _0x23cdcc){if(typeof _0x23cdcc[_0x53737b]!==_0x5c80('0xa7')){this[_0x5c80('0x15a')]['enqueue'](function(){if(!_['isNil'](_0x23cdcc[_0x53737b])){return ami[_0x5c80('0x96')]({'action':_0x5c80('0x85'),'channel':_0x23cdcc[_0x53737b][_0x5c80('0xf4')]})['catch'](function(_0x151571){if(_0x151571[_0x5c80('0x66')]===_0x5c80('0x15b')){setTimeout(function(){if(_0x23cdcc[_0x53737b]&&_0x23cdcc[_0x53737b]['type']!==_0x5c80('0xc0')){utils[_0x5c80('0x100')](_0x1485a9[_0x5c80('0x1e')][_0x23cdcc[_0x53737b]['queue']],_0x5c80('0x15c'));logger[_0x5c80('0x64')]('[Dialer][checkChannel]',_0x412b47,_0x53737b,_0x23cdcc[_0x53737b][_0x5c80('0xbe')]);delete _0x23cdcc[_0x53737b];}if(_0x23cdcc[_0x53737b]&&_0x23cdcc[_0x53737b][_0x5c80('0x43')]===_0x5c80('0xc0')){utils['decrementOriginate'](_0x1485a9[_0x5c80('0x1f')][_0x23cdcc[_0x53737b][_0x5c80('0xbe')]],_0x5c80('0x15c'));logger[_0x5c80('0x64')](_0x5c80('0x15d'),_0x412b47,_0x53737b,_0x23cdcc[_0x53737b][_0x5c80('0xbe')]);delete _0x23cdcc[_0x53737b];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x115212){return Promise[_0x5c80('0xa8')]()['then'](voiceQueueRt[_0x5c80('0x15e')](_0x115212))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x5c80('0x15f')]=function(_0x2be7d4,_0x5926a8,_0x1cf91b){var _0x4d989c={'state':0x19,'statedesc':_0x5c80('0x160')};utils[_0x5c80('0x100')](_0x5926a8,'[emptyContact]'+_0x2be7d4);this[_0x5c80('0x120')](_['merge'](_0x4d989c,_[_0x5c80('0x71')](_0x1cf91b,[_0x5c80('0xe1'),'ListId',_0x5c80('0x161'),_0x5c80('0xe2'),'CampaignId'])),_0x5c80('0x162'),_0x5c80('0x163'));logger[_0x5c80('0x64')](_0x2be7d4);};Dialer['prototype'][_0x5c80('0x120')]=function(_0x3a7982,_0x1eb358,_0x581265){hopperUtils[_0x5c80('0xe8')](_0x3a7982)[_0x5c80('0x9d')](loggerCatch(_0x1eb358));hopperUtils[_0x5c80('0xcb')](_0x3a7982)['catch'](loggerCatch(_0x581265));};Dialer[_0x5c80('0x19')]['queueCallerAbandonCreateState']=function(_0x4754b3,_0x482d89){hopperUtils[_0x5c80('0xe8')](_0x4754b3)['catch'](loggerCatch(_0x5c80('0xca')));if(_0x482d89==0x0){hopperUtils[_0x5c80('0xcb')](_0x4754b3)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x164')));}};Dialer[_0x5c80('0x19')][_0x5c80('0x165')]=function(_0x3d24ad){return Promise['resolve']()[_0x5c80('0x41')](cmHopper['handlePreviewRecallNotifications'](_0x3d24ad['id'],previewRecallmeReminderInterval))[_0x5c80('0x41')](function(_0x363804){for(var _0x53ff87=0x0;_0x53ff87<_0x363804[_0x5c80('0x94')];_0x53ff87++){var _0x5cb1fd=_0x363804[_0x53ff87][_0x5c80('0x156')][_0x5c80('0x49')];if(_0x5cb1fd)io['to'](util[_0x5c80('0x47')](_0x5c80('0x166'),_0x5cb1fd))[_0x5c80('0x11c')](_0x5c80('0x167'),{'hopper':_0x363804[_0x53ff87]});}})['catch'](function(){});};Dialer[_0x5c80('0x19')]['launchHandleIvr']=function(_0xf6c699){var _0x29163d=this;return function(){_0x29163d[_0x5c80('0x168')](_0xf6c699);};};Dialer[_0x5c80('0x19')]['actionOriginate']=function(_0x6ac4cd,_0x4d48f4){var _0x4fa679=this;var _0x1dcc1a=uuid['v4']();this[_0x5c80('0x24')][_0x1dcc1a]=new Action(_0x6ac4cd,_0x4d48f4,_0x1dcc1a);return new Promise(function(_0x24bd56,_0x2b0f4e){if(_[_0x5c80('0x42')](_0x6ac4cd)&&typeof _0x6ac4cd!==_0x5c80('0x169')){return _0x2b0f4e(msgResponse(_0x5c80('0x16a'),_0x5c80('0x91'),_0x5c80('0x16b')));}if(_[_0x5c80('0x42')](_0x4d48f4[_0x5c80('0x16c')])||_0x4d48f4['phone']===null){return _0x2b0f4e(msgResponse(_0x5c80('0x16a'),_0x5c80('0x91'),_0x5c80('0x16d')));}var _0x382087={'XMD-CALLERID':_0x4fa679[_0x5c80('0x24')][_0x1dcc1a][_0x5c80('0x16e')](),'XMD-AGI':_0x6ac4cd['dialQueueProject']?util[_0x5c80('0x47')](_0x5c80('0x16f'),ipAgi,_0x6ac4cd['dialQueueProject']):_0x5c80('0x170'),'XMD-AGIAFTER':_0x6ac4cd[_0x5c80('0xc7')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x6ac4cd[_0x5c80('0xc7')]):_0x5c80('0x170'),'XMD-QUEUE':utils[_0x5c80('0x171')](_0x6ac4cd)?util[_0x5c80('0x47')](_0x5c80('0x172'),_0x6ac4cd['name'],_0x6ac4cd[_0x5c80('0x173')]||'',_0x6ac4cd[_0x5c80('0xc8')]?'c':'',_0x6ac4cd[_0x5c80('0xd1')]||0x3):'NONE','XMD-CONTACTID':_0x4d48f4[_0x5c80('0xe1')],'XMD-CDRTYPE':_0x5c80('0x174'),'CALLERID(all)':_0x4fa679[_0x5c80('0x24')][_0x1dcc1a][_0x5c80('0x16e')](),'XMD-AMD':_0x6ac4cd['dialAMDActive']?_0x5c80('0x14b'):'NONE','XMD-DESTINATION':_0x5c80('0x175')};if(_0x6ac4cd[_0x5c80('0x115')]){_0x382087[_0x5c80('0x176')]=_0x6ac4cd[_0x5c80('0x177')]||0x9c4;_0x382087[_0x5c80('0x178')]=_0x6ac4cd[_0x5c80('0x179')]||0x5dc;_0x382087[_0x5c80('0x17a')]=_0x6ac4cd['dialAMDAfterGreetingSilence']||0x320;_0x382087[_0x5c80('0x17b')]=_0x6ac4cd[_0x5c80('0x17c')]||0x1388;_0x382087[_0x5c80('0x17d')]=_0x6ac4cd['dialAMDMinWordLength']||0x64;_0x382087[_0x5c80('0x17e')]=_0x6ac4cd['dialAMDBetweenWordsSilence']||0x32;_0x382087[_0x5c80('0x17f')]=_0x6ac4cd[_0x5c80('0x180')]||0x3;_0x382087[_0x5c80('0x181')]=_0x6ac4cd['dialAMDSilenceThreshold']||0x100;_0x382087[_0x5c80('0x182')]=_0x6ac4cd[_0x5c80('0x183')]||0x1388;}if(utils['isOutboundQueue'](_0x6ac4cd)){_0x382087[_0x5c80('0x184')]=_0x4d48f4[_0x5c80('0xe2')];}else{_0x382087[_0x5c80('0x185')]=_0x4d48f4[_0x5c80('0xe3')];}var _0x26eded=utils[_0x5c80('0x186')](_0x4d48f4[_0x5c80('0x187')]);Object['assign'](_0x382087,_0x26eded);var _0x2efda2=_0x4fa679['isTrunkReachable'](_0x6ac4cd[_0x5c80('0x88')])?utils[_0x5c80('0x188')](_0x6ac4cd[_0x5c80('0x88')]['callerid'],_0x6ac4cd[_0x5c80('0x189')],_0x6ac4cd[_0x5c80('0x18a')]>0x0?utils['getCallerIdRandom'](_0x6ac4cd['dialOriginateCallerIdNumber'],_0x6ac4cd[_0x5c80('0x18a')]):_0x6ac4cd[_0x5c80('0x18b')]):utils[_0x5c80('0x188')](_['isNil'](_0x6ac4cd[_0x5c80('0x18c')])?_0x6ac4cd[_0x5c80('0x88')][_0x5c80('0x18d')]:_0x6ac4cd['TrunkBackup'][_0x5c80('0x18d')],_0x6ac4cd['dialOriginateCallerIdName'],_0x6ac4cd['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5c80('0x18e')](_0x6ac4cd[_0x5c80('0x18b')],_0x6ac4cd['dialRandomLastDigitCallerIdNumber']):_0x6ac4cd[_0x5c80('0x18b')]);if(_0x2efda2){_0x382087['XMD-ORIGINATECALLERIDNAME']=_0x4fa679[_0x5c80('0x24')][_0x1dcc1a][_0x5c80('0x18f')]=utils['extractCalleridName'](_0x2efda2);_0x382087[_0x5c80('0x190')]=_0x4d48f4[_0x5c80('0x16c')];}_0x6ac4cd[_0x5c80('0x191')]=_0x382087;return ami[_0x5c80('0x96')]({'actionid':_0x1dcc1a,'action':_0x5c80('0x16a'),'channel':_0x4fa679[_0x5c80('0x82')](_0x6ac4cd[_0x5c80('0x88')])?util[_0x5c80('0x47')](_0x5c80('0x192'),_0x6ac4cd[_0x5c80('0x88')]['name'],isNotNull(_0x6ac4cd[_0x5c80('0x193')])?_0x6ac4cd[_0x5c80('0x193')]['trim']()||'':'',_0x6ac4cd[_0x5c80('0x194')]>0x0?_0x4d48f4[_0x5c80('0x16c')][_0x5c80('0x195')](_0x6ac4cd[_0x5c80('0x194')]):_0x4d48f4[_0x5c80('0x16c')]):util[_0x5c80('0x47')](_0x5c80('0x192'),_[_0x5c80('0xf9')](_0x6ac4cd[_0x5c80('0x18c')])?_0x6ac4cd['Trunk'][_0x5c80('0x49')]:_0x6ac4cd['TrunkBackup']['name'],isNotNull(_0x6ac4cd[_0x5c80('0x193')])?_0x6ac4cd['dialPrefix']['trim']()||'':'',_0x6ac4cd[_0x5c80('0x194')]>0x0?_0x4d48f4[_0x5c80('0x16c')]['substring'](_0x6ac4cd[_0x5c80('0x194')]):_0x4d48f4[_0x5c80('0x16c')]),'callerid':_0x2efda2,'Exten':_0x5c80('0x175'),'Context':_0x5c80('0x196'),'Priority':'1','variable':_0x382087,'timeout':(_0x6ac4cd[_0x5c80('0x197')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1dcc1a})[_0x5c80('0x41')](function(_0x5a2b7c){return _0x24bd56(_0x5a2b7c);})[_0x5c80('0x9d')](function(_0x56066e){_0x6ac4cd[_0x5c80('0x198')]+=0x1;var _0x529042=new History(_0x4fa679[_0x5c80('0x24')][_0x1dcc1a]);logger['error'](util[_0x5c80('0x47')](_0x5c80('0x199'),JSON['stringify'](_0x56066e)));_0x529042[_0x5c80('0x6b')]=0xe;_0x529042[_0x5c80('0xe5')]=_0x5c80('0x19a');_0x529042['starttime']=moment()['format'](_0x5c80('0xc9'));_0x529042[_0x5c80('0x6c')]=_0x529042[_0x5c80('0x6d')];hopperUtils[_0x5c80('0xe8')](_0x529042)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x19b')));_0x4fa679['moveContactManagedDialer'](_0x529042)['catch'](loggerCatch('[originate][error]'))[_0x5c80('0x1c')](function(){delete _0x4fa679[_0x5c80('0x24')][_0x1dcc1a];return _0x2b0f4e(msgResponse(_0x5c80('0x16a'),_0x5c80('0x81'),_0x5c80('0x19c')));});});});};Dialer[_0x5c80('0x19')][_0x5c80('0x19d')]=function(_0x8a7198,_0x1d66dd,_0x5b65da){var _0x1b0949=new History(_0x1d66dd);if(_0x1b0949[_0x5c80('0x125')]+_0x1b0949[_0x5c80('0x126')]+_0x1b0949['countnoanswerretry']+_0x1b0949[_0x5c80('0x134')]+_0x1b0949[_0x5c80('0xd5')]+_0x1b0949[_0x5c80('0xee')]+_0x1b0949[_0x5c80('0x124')]+_0x1b0949[_0x5c80('0x127')]>=_0x5b65da['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x8a7198){case 0x3:if(_0x1b0949[_0x5c80('0x133')]>=_0x5b65da[_0x5c80('0x19e')]-0x1){return!![];}hopperUtils[_0x5c80('0xde')]({'active':![],'countnoanswerretry':_0x1b0949['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da['dialNoAnswerRetryFrequency'],_0x5c80('0xe0'))['format'](_0x5c80('0xc9')),'ContactId':_0x1b0949[_0x5c80('0xe1')],'ListId':_0x1b0949[_0x5c80('0x102')],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1b0949[_0x5c80('0x125')]>=_0x5b65da[_0x5c80('0x19f')]-0x1){return!![];}hopperUtils[_0x5c80('0xde')]({'active':![],'countbusyretry':_0x1b0949[_0x5c80('0x125')]+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da['dialBusyRetryFrequency'],_0x5c80('0xe0'))[_0x5c80('0x47')](_0x5c80('0xc9')),'ContactId':_0x1b0949['ContactId'],'ListId':_0x1b0949[_0x5c80('0x102')],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})['catch'](loggerCatch(_0x5c80('0x1a0')));break;case 0x8:if(_0x1b0949[_0x5c80('0x126')]>=_0x5b65da[_0x5c80('0x1a1')]-0x1){return!![];}hopperUtils[_0x5c80('0xde')]({'active':![],'countcongestionretry':_0x1b0949[_0x5c80('0x126')]+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da[_0x5c80('0x1a2')],_0x5c80('0xe0'))[_0x5c80('0x47')](_0x5c80('0xc9')),'ContactId':_0x1b0949[_0x5c80('0xe1')],'ListId':_0x1b0949[_0x5c80('0x102')],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1b0949[_0x5c80('0x134')]>=_0x5b65da[_0x5c80('0x1a3')]-0x1){return!![];}else{hopperUtils[_0x5c80('0xde')]({'active':![],'countnosuchnumberretry':_0x1b0949[_0x5c80('0x134')]+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da[_0x5c80('0x1a4')],_0x5c80('0xe0'))[_0x5c80('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b0949[_0x5c80('0xe1')],'ListId':_0x1b0949['ListId'],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1b0949[_0x5c80('0xd5')]>=_0x5b65da[_0x5c80('0xdc')]-0x1){return!![];}hopperUtils[_0x5c80('0xde')]({'active':![],'countdropretry':_0x1b0949[_0x5c80('0xd5')]+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da[_0x5c80('0xd7')],'minutes')[_0x5c80('0x47')](_0x5c80('0xc9')),'ContactId':_0x1b0949['ContactId'],'ListId':_0x1b0949[_0x5c80('0x102')],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949['CampaignId']||undefined})[_0x5c80('0x9d')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1b0949[_0x5c80('0xee')]>=_0x5b65da[_0x5c80('0xf0')]-0x1){return!![];}hopperUtils[_0x5c80('0xde')]({'active':![],'countabandonedretry':_0x1b0949[_0x5c80('0xee')]+=0x1,'scheduledat':moment()['add'](_0x5b65da[_0x5c80('0xef')],_0x5c80('0xe0'))[_0x5c80('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b0949[_0x5c80('0xe1')],'ListId':_0x1b0949['ListId'],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1b0949[_0x5c80('0x124')]>=_0x5b65da[_0x5c80('0x135')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1b0949[_0x5c80('0x124')]+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da[_0x5c80('0x12d')],'minutes')['format'](_0x5c80('0xc9')),'ContactId':_0x1b0949[_0x5c80('0xe1')],'ListId':_0x1b0949[_0x5c80('0x102')],'VoiceQueueId':_0x1b0949['VoiceQueueId']||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x12e')));break;case 0x14:if(_0x1b0949[_0x5c80('0x127')]>=_0x5b65da[_0x5c80('0x1a5')]-0x1){return!![];}hopperUtils[_0x5c80('0xde')]({'active':![],'countagentrejectretry':_0x1b0949['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x5c80('0xdf')](_0x5b65da['dialAgentRejectRetryFrequency'],_0x5c80('0xe0'))[_0x5c80('0x47')](_0x5c80('0xc9')),'ContactId':_0x1b0949[_0x5c80('0xe1')],'ListId':_0x1b0949[_0x5c80('0x102')],'VoiceQueueId':_0x1b0949[_0x5c80('0xe2')]||undefined,'CampaignId':_0x1b0949[_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x1a6')));break;default:return!![];}};Dialer[_0x5c80('0x19')][_0x5c80('0x112')]=function(_0x1fb29e,_0x479509,_0x542c52){var _0x8a72c7=this;var _0x319378=new History(_0x1fb29e);var _0x26d6d3=![];var _0x5526f9;var _0x38508b;return new Promise(function(_0x559b6b,_0x339a24){if(_[_0x5c80('0x42')](_0x479509)&&typeof _0x479509!==_0x5c80('0x169')){return _0x339a24(msgResponse(_0x5c80('0x1a7'),_0x5c80('0x91'),'entity\x20is\x20undefine'));}if(_[_0x5c80('0x42')](_0x542c52)&&typeof _0x542c52!=='object'){return _0x339a24(msgResponse('[callProgressDetecting]',_0x5c80('0x91'),'evt\x20is\x20undefine'));}hopperUtils[_0x5c80('0xd9')](_0x319378,_0x542c52[_0x5c80('0xc4')],_0x479509)[_0x5c80('0x41')](function(_0x407311){if(_0x407311[_0x5c80('0xdb')]==0x1)_0x26d6d3=!![];switch(_0x542c52[_0x5c80('0xc4')]){case'0':_0x479509[_0x5c80('0x1a8')]+=0x1;_0x319378['state']=0x0;_0x319378[_0x5c80('0xe5')]=_0x5c80('0x1a9');_0x319378['countnosuchnumberretry']+=0x1;_0x319378['countglobal']+=0x1;ami['emit'](_0x5c80('0x1aa'),ut[_0x5c80('0x11e')](_0x1fb29e,_0x5c80('0x1ab')));_0x5526f9=_0x479509[_0x5c80('0x1a4')];_0x38508b=_0x479509['callAdditionalPhoneAfterMin'];hopperUtils[_0x5c80('0xe8')](_0x319378)['catch'](loggerCatch(_0x5c80('0x132')));if(_0x8a72c7[_0x5c80('0x19d')](0x0,_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378[_0x5c80('0x134')]>=_0x479509['dialNoSuchNumberMaxRetry']){_0x8a72c7['createStateFinal'](_0x319378,_0x559b6b,_0x339a24,'reason\x200\x20no\x20such\x20number....');}else{_0x8a72c7[_0x5c80('0x129')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1ac'));}}break;case'3':_0x479509[_0x5c80('0x1ad')]+=0x1;_0x319378['state']=0x3;_0x319378[_0x5c80('0xe5')]=_0x5c80('0x1ae');_0x319378[_0x5c80('0x133')]+=0x1;_0x319378[_0x5c80('0xd6')]+=0x1;var _0x2b9748=ut[_0x5c80('0x1af')](_0x1fb29e,_0x479509);ami[_0x5c80('0x11c')](_0x5c80('0x1b0'),_0x2b9748);_0x5526f9=_0x479509[_0x5c80('0x1b1')];_0x38508b=_0x479509['callAdditionalPhoneAfterMin'];hopperUtils[_0x5c80('0xe8')](_0x319378)['catch'](loggerCatch(_0x5c80('0x1b2')));if(_0x8a72c7[_0x5c80('0x19d')](0x3,_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378['countnoanswerretry']>=_0x479509['dialNoAnswerMaxRetry']){_0x8a72c7['createStateFinal'](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1b3'));}else{_0x8a72c7[_0x5c80('0x129')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1b3'));}}break;case'5':_0x479509['outboundBusyCallsDay']+=0x1;_0x319378['state']=0x5;_0x319378[_0x5c80('0xe5')]=_0x5c80('0x1b4');_0x319378['countbusyretry']+=0x1;_0x319378[_0x5c80('0xd6')]+=0x1;ami[_0x5c80('0x11c')](_0x5c80('0x1b5'),ut[_0x5c80('0x11e')](_0x1fb29e,_0x5c80('0x1b6')));_0x5526f9=_0x479509[_0x5c80('0x1b7')];_0x38508b=_0x479509[_0x5c80('0xd8')];hopperUtils[_0x5c80('0xe8')](_0x319378)[_0x5c80('0x9d')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x8a72c7[_0x5c80('0x19d')](0x5,_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378['countbusyretry']>=_0x479509[_0x5c80('0x19f')]){_0x8a72c7['createStateFinal'](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1b8'));}else{_0x8a72c7[_0x5c80('0x129')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1b8'));}}break;case'8':_0x479509[_0x5c80('0x1b9')]+=0x1;_0x319378[_0x5c80('0x6b')]=0x8;_0x319378[_0x5c80('0xe5')]='Congestion';_0x319378[_0x5c80('0x126')]+=0x1;_0x319378['countglobal']+=0x1;_0x5526f9=_0x479509[_0x5c80('0x1a2')];_0x38508b=_0x479509[_0x5c80('0xd8')];ami[_0x5c80('0x11c')](_0x5c80('0x1ba'),ut[_0x5c80('0x11e')](_0x1fb29e,'congestion'));hopperUtils[_0x5c80('0xe8')](_0x319378)['catch'](loggerCatch(_0x5c80('0x1bb')));if(_0x8a72c7[_0x5c80('0x19d')](0x8,_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378[_0x5c80('0x126')]>=_0x479509[_0x5c80('0x1a1')]){_0x8a72c7[_0x5c80('0x12b')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1bc'));}else{_0x8a72c7[_0x5c80('0x129')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1bc'));}}break;case'11':_0x479509[_0x5c80('0x1bd')]+=0x1;_0x319378[_0x5c80('0x6b')]=0xb;_0x319378[_0x5c80('0xe5')]='Abandoned';_0x319378[_0x5c80('0xee')]+=0x1;_0x319378['countglobal']+=0x1;_0x5526f9=_0x479509[_0x5c80('0xef')];_0x38508b=_0x479509[_0x5c80('0xd8')];hopperUtils['createHistory'](_0x319378)[_0x5c80('0x9d')](loggerCatch(_0x5c80('0xf2')));if(_0x8a72c7[_0x5c80('0x19d')](0xb,_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378[_0x5c80('0xee')]>=_0x479509[_0x5c80('0xf0')]){_0x8a72c7[_0x5c80('0x12b')](_0x319378,_0x559b6b,_0x339a24,'reason\x2011\x20abandoned');}else{_0x8a72c7[_0x5c80('0x129')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1be'));}}break;case'20':_0x479509[_0x5c80('0x1bf')]+=0x1;_0x319378[_0x5c80('0x6b')]=0x14;_0x319378['statedesc']='AgentReject';_0x319378[_0x5c80('0x127')]+=0x1;_0x319378[_0x5c80('0xd6')]+=0x1;_0x5526f9=_0x479509[_0x5c80('0x1c0')];_0x38508b=_0x479509[_0x5c80('0xd8')];ami[_0x5c80('0x11c')](_0x5c80('0x1c1'),ut[_0x5c80('0x11e')](_0x1fb29e,_0x5c80('0x1c2')));hopperUtils[_0x5c80('0xe8')](_0x319378)[_0x5c80('0x9d')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x8a72c7[_0x5c80('0x19d')](0x14,_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378[_0x5c80('0x127')]>=_0x479509[_0x5c80('0x1a5')]){_0x8a72c7[_0x5c80('0x12b')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1c3'));}else{_0x8a72c7[_0x5c80('0x129')](_0x319378,_0x559b6b,_0x339a24,_0x5c80('0x1c3'));}}break;default:_0x479509['outboundUnknownCallsDay']+=0x1;_0x319378[_0x5c80('0x6b')]=0xc;_0x319378[_0x5c80('0xe5')]=_0x542c52[_0x5c80('0xc4')];_0x5526f9=_0x479509['dialAgentRejectRetryFrequency'];_0x38508b=_0x479509['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x319378)[_0x5c80('0x9d')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x8a72c7[_0x5c80('0x19d')](_0x542c52[_0x5c80('0xc4')],_0x1fb29e,_0x479509)&&!_0x26d6d3){if(_0x319378[_0x5c80('0x125')]+_0x319378[_0x5c80('0x126')]+_0x319378[_0x5c80('0x133')]+_0x319378[_0x5c80('0x134')]+_0x319378[_0x5c80('0xd5')]+_0x319378[_0x5c80('0xee')]+_0x319378['countmachineretry']+_0x319378['countagentrejectretry']>=_0x479509['dialGlobalMaxRetry']){_0x8a72c7['stateGlobal'](_0x319378,_0x559b6b,_0x339a24,_0x542c52[_0x5c80('0xc4')]);}else{_0x8a72c7[_0x5c80('0x12b')](_0x319378,_0x559b6b,_0x339a24,_0x542c52[_0x5c80('0xc4')]);}}}})['then'](function(){if(_0x26d6d3){hopperUtils[_0x5c80('0xf3')](_0x319378,_0x5526f9,_0x38508b)[_0x5c80('0x41')](function(){return _0x559b6b(0x1);});}});});};Dialer['prototype'][_0x5c80('0x129')]=function(_0x1e955f,_0x4ebcec,_0x488bb7,_0x3c5dca){var _0x229877=new Final(_0x1e955f);_0x229877[_0x5c80('0x6b')]=0xf;_0x229877[_0x5c80('0xe5')]='Global';this[_0x5c80('0x12b')](_0x229877,_0x4ebcec,_0x488bb7,_0x3c5dca);};Dialer['prototype'][_0x5c80('0x12b')]=function(_0x692921,_0x5e173a,_0x407355,_0x4f89c0){hopperUtils[_0x5c80('0xcb')](_0x692921)[_0x5c80('0x41')](function(){return _0x5e173a(msgResponse(_0x5c80('0x1a7'),_0x5c80('0x111'),_0x4f89c0));})['catch'](function(){return _0x407355(msgResponse(_0x5c80('0x1c4'),_0x5c80('0x91'),_0x5c80('0x1c5')));});};Dialer[_0x5c80('0x19')][_0x5c80('0x8')]=function(_0xc0dcbe){var _0x22cb90=_0xc0dcbe[_0x5c80('0x1c6')]/0x64;var _0x59f166=_0xc0dcbe[_0x5c80('0x1c7')]/(_0xc0dcbe[_0x5c80('0x1c7')]+_0xc0dcbe[_0x5c80('0xc3')]);var _0x7f5735=Math[_0x5c80('0x1c8')](_0xc0dcbe['predictiveIntervalAvailable']*(_0xc0dcbe['predictiveIntervalMaxThreshold']/0x64));var _0x4d911f=Math[_0x5c80('0x1c8')](_0xc0dcbe[_0x5c80('0x1c9')]*(_0xc0dcbe[_0x5c80('0x1ca')]/0x64));var _0x577869=_0xc0dcbe[_0x5c80('0x1cb')]+_0xc0dcbe['talking'];var _0x2510c3=Math['floor'](_0xc0dcbe[_0x5c80('0x5c')]*_0xc0dcbe[_0x5c80('0x5f')]*_0xc0dcbe[_0x5c80('0x1cc')]*_0xc0dcbe['predictiveIntervalMultiplicativeFactor']);if(_[_0x5c80('0x42')](_0xc0dcbe['startProgressive'])){if(!_[_0x5c80('0x42')](_0xc0dcbe[_0x5c80('0x27')])){_0xc0dcbe[_0x5c80('0x27')]=undefined;loggerPredictive['error'](_0x5c80('0x1cd'),_0x5c80('0x1ce'));}if(!_['isUndefined'](_0xc0dcbe['handlePredictive'])){loggerPredictive['error'](_0x5c80('0x1cd'),_0x5c80('0x1cf'));clearInterval(_0xc0dcbe[_0x5c80('0x63')]);_0xc0dcbe[_0x5c80('0x63')]=undefined;}_0xc0dcbe['startProgressive']=moment()[_0x5c80('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5c80('0x4c')](_0xc0dcbe['name'],'collection\x20data\x20in\x20progressive\x20at',_0xc0dcbe['startProgressive']);this['handlePower'](_0xc0dcbe,0x1);}else if(ifInterval(_0xc0dcbe[_0x5c80('0x1d0')],_0xc0dcbe[_0x5c80('0x28')])){this['handlePower'](_0xc0dcbe,0x1);loggerPredictiveCalls[_0x5c80('0x4c')]('[startMethodPredictive][StartProgressive][Loop]',_0xc0dcbe['startProgressive'],_0xc0dcbe[_0x5c80('0x49')]);_0xc0dcbe['erlangCalls']=0x0;_0xc0dcbe[_0x5c80('0xd2')]=0x0;}else if(_0x22cb90<_0x59f166&&_0xc0dcbe['dialPredictiveOptimization']===_0x5c80('0x1d1')){clearPredictiveAttributes(_0xc0dcbe);loggerPredictive[_0x5c80('0x4c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5c80('0x1d2'),_0x59f166,_0x5c80('0x28'),_0xc0dcbe['name']);}else if(_0x2510c3<_0xc0dcbe[_0x5c80('0xd2')]&&_0xc0dcbe[_0x5c80('0x1d3')]===_0x5c80('0x1d1')){clearPredictiveAttributes(_0xc0dcbe);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x1d4'),_0x5c80('0x1d5'),_0x2510c3,_0x5c80('0x1d6'),_0xc0dcbe[_0x5c80('0xd2')],_0x5c80('0x28'),_0xc0dcbe[_0x5c80('0x49')]);}else if(!ifInterval(_0xc0dcbe[_0x5c80('0x1d0')],_0xc0dcbe['startProgressive'])&&_[_0x5c80('0x42')](_0xc0dcbe[_0x5c80('0x27')])&&!_[_0x5c80('0x42')](_0xc0dcbe[_0x5c80('0x28')])){_0xc0dcbe['startPredictive']=moment()[_0x5c80('0x47')](_0x5c80('0xc9'));loggerPredictive[_0x5c80('0x4c')](_0xc0dcbe[_0x5c80('0x49')],'started\x20in\x20predictive\x20at',_0xc0dcbe[_0x5c80('0x27')]);hopperUtils[_0x5c80('0x1d7')](_0xc0dcbe[_0x5c80('0x1d0')])[_0x5c80('0x41')](this[_0x5c80('0x1d8')](_0xc0dcbe))['then'](mergeDataErlangB(_0xc0dcbe))[_0x5c80('0x41')](this['startMethodPredictive'](_0xc0dcbe))[_0x5c80('0x9d')](loggerCatchPredictive(_0x5c80('0x1d9'),_0xc0dcbe));}else if(!ifInterval(_0xc0dcbe['dialPredictiveInterval'],_0xc0dcbe[_0x5c80('0x27')])){_0xc0dcbe[_0x5c80('0xd2')]=0x0;_0xc0dcbe[_0x5c80('0x27')]=moment()[_0x5c80('0x47')](_0x5c80('0xc9'));loggerPredictive[_0x5c80('0x4c')](_0xc0dcbe[_0x5c80('0x49')],_0x5c80('0x1da'),_0xc0dcbe[_0x5c80('0x27')]);clearInterval(_0xc0dcbe['handlePredictive']);_0xc0dcbe[_0x5c80('0x63')]=undefined;hopperUtils[_0x5c80('0x1d7')](_0xc0dcbe[_0x5c80('0x1d0')])[_0x5c80('0x41')](this['getDataPredictive'](_0xc0dcbe))[_0x5c80('0x41')](mergeDataErlangB(_0xc0dcbe))[_0x5c80('0x41')](this[_0x5c80('0x1db')](_0xc0dcbe))[_0x5c80('0x9d')](loggerCatchPredictive(_0x5c80('0x1dc'),_0xc0dcbe));}else if(_0xc0dcbe[_0x5c80('0x1c9')]&&_0x577869<_0xc0dcbe[_0x5c80('0x1c9')]-_0x4d911f){clearPredictiveAttributes(_0xc0dcbe);loggerPredictive[_0x5c80('0x4c')](_0xc0dcbe['name'],_0x5c80('0x1dd'),_0x577869,')\x20are\x20less\x20than\x20threshold\x20(',_0xc0dcbe[_0x5c80('0x1c9')],'-',_0x4d911f,'=',_0xc0dcbe[_0x5c80('0x1c9')]-_0x4d911f,')');}else if(_0xc0dcbe['predictiveIntervalAvailable']&&_0x577869>_0xc0dcbe[_0x5c80('0x1c9')]+_0x7f5735){clearPredictiveAttributes(_0xc0dcbe);loggerPredictive[_0x5c80('0x4c')](_0xc0dcbe[_0x5c80('0x49')],_0x5c80('0x1dd'),_0x577869,_0x5c80('0x1de'),_0xc0dcbe[_0x5c80('0x1c9')],'+',_0x7f5735,'=',_0xc0dcbe[_0x5c80('0x1c9')]+_0x7f5735,')');}};Dialer[_0x5c80('0x19')][_0x5c80('0x1d8')]=function(_0x4fe80a){var _0x4c3392=this;return function(_0x273d42){return new Promise(function(_0x5e5b84,_0x27be61){_[_0x5c80('0x61')](_0x4fe80a,_0x273d42[0x0]);if(checkGetDataPredictive(_0x273d42[0x0])){var _0x1ccfaa=_0x4fe80a[_0x5c80('0x1c9')]=_0x4fe80a[_0x5c80('0x149')]+_0x4fe80a[_0x5c80('0x1cb')];var _0x5c9d98=_0x4fe80a[_0x5c80('0x1d0')]*0x3c;var _0x34f618=_0x273d42[0x0]['predictiveIntervalAvgTalktime']+_0x273d42[0x0][_0x5c80('0x58')];var _0x3a0f6a=(_0x273d42[0x0][_0x5c80('0x50')]+_0x273d42[0x0][_0x5c80('0x51')]+_0x273d42[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x273d42[0x0][_0x5c80('0x4e')];_0x4fe80a['predictiveIntervalHitRate']=_0x3a0f6a>0x0?_0x3a0f6a:0x1;switch(_0x4fe80a[_0x5c80('0x1d3')]){case _0x5c80('0x1d1'):var _0x103f9f=_0x4fe80a[_0x5c80('0x1c6')]/0x64;return _0x4c3392[_0x5c80('0x1df')](_0x1ccfaa,_0x5c9d98,_0x34f618,_0x3a0f6a,_0x103f9f)[_0x5c80('0x41')](function(_0x12c652){return _0x5e5b84(_0x12c652);});case'agentBusyFactor':var _0x5ef4d8=_0x4fe80a['dialPredictiveOptimizationPercentage']/0x64;return _0x4c3392[_0x5c80('0x1e0')](_0x1ccfaa,_0x5c9d98,_0x34f618,_0x3a0f6a,_0x5ef4d8)[_0x5c80('0x41')](function(_0x420104){return _0x5e5b84(_0x420104);});default:return _0x27be61(msgResponse('[getDataPredictive]',_0x5c80('0x91'),_0x5c80('0x1e1')));}}else{return _0x27be61(msgResponse(_0x5c80('0x1e2'),'Failure',_0x5c80('0x1e3')));}});};};Dialer[_0x5c80('0x19')]['getDataPredictiveOld']=function(_0x325ae3){var _0x25c775=this;return function(_0x274487){return new Promise(function(_0x22f210,_0x308f8c){_[_0x5c80('0x61')](_0x325ae3,_0x274487[0x0]);if(checkGetDataPredictive(_0x274487[0x0])){loggerPredictive[_0x5c80('0x4c')](JSON[_0x5c80('0xa4')](_0x274487[0x0]));if(_0x325ae3[_0x5c80('0x1d3')]==='dropRate'){return _0x25c775[_0x5c80('0x15e')](_0x325ae3['id'])['then'](function(_0x9c705e){var _0xd2f69=_0x325ae3[_0x5c80('0x1e4')]-_0x9c705e[0x0][_0x5c80('0x1e5')];var _0x4c9a77=_0x325ae3[_0x5c80('0x1d0')]*0x3c;var _0x5cef80=_0x274487[0x0][_0x5c80('0x55')]+_0x274487[0x0][_0x5c80('0x58')];var _0x2626cd=(_0x274487[0x0][_0x5c80('0x50')]+_0x274487[0x0][_0x5c80('0x51')]+_0x274487[0x0][_0x5c80('0x53')])/_0x274487[0x0][_0x5c80('0x4e')];var _0x178770=_0x325ae3[_0x5c80('0x1c6')]/0x64;_0x325ae3['predictiveIntervalPauses']=_0x9c705e[0x0][_0x5c80('0x1e5')]||0x0;_0x325ae3[_0x5c80('0x1cc')]=_0x2626cd>0x0?_0x2626cd:0x1;return _0x25c775[_0x5c80('0x1df')](_0xd2f69,_0x4c9a77,_0x5cef80,_0x2626cd,_0x178770);})['then'](function(_0x3bbd18){return _0x22f210(_0x3bbd18);})[_0x5c80('0x9d')](function(_0x3478b0){return _0x308f8c(msgResponse(_0x5c80('0x1e6'),'Failure',JSON[_0x5c80('0xa4')](_0x3478b0)));});}if(_0x325ae3[_0x5c80('0x1d3')]==='agentBusyFactor'){return _0x25c775[_0x5c80('0x15e')](_0x325ae3['id'])[_0x5c80('0x41')](function(_0x53da91){var _0x233bd7=_0x325ae3[_0x5c80('0x1e4')]-_0x53da91[0x0][_0x5c80('0x1e5')];var _0x237901=_0x325ae3[_0x5c80('0x1d0')]*0x3c;var _0x3574f3=_0x274487[0x0][_0x5c80('0x55')]+_0x274487[0x0][_0x5c80('0x58')];var _0x5df4cf=(_0x274487[0x0][_0x5c80('0x50')]+_0x274487[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x274487[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x274487[0x0][_0x5c80('0x4e')];var _0x4c8e55=_0x325ae3[_0x5c80('0x1c6')]/0x64;_0x325ae3[_0x5c80('0x1e7')]=_0x53da91[0x0][_0x5c80('0x1e5')]||0x0;_0x325ae3[_0x5c80('0x1cc')]=_0x5df4cf>0x0?_0x5df4cf:0x1;return _0x25c775[_0x5c80('0x1e0')](_0x233bd7,_0x237901,_0x3574f3,_0x5df4cf,_0x4c8e55);})[_0x5c80('0x41')](function(_0x45f6fb){return _0x22f210(_0x45f6fb);})[_0x5c80('0x9d')](function(_0xed9672){return _0x308f8c(msgResponse(_0x5c80('0x1e6'),_0x5c80('0x91'),JSON[_0x5c80('0xa4')](_0xed9672)));});}}else{return _0x308f8c(msgResponse(_0x5c80('0x1e2'),_0x5c80('0x91'),_0x5c80('0x1e3')));}});};};Dialer[_0x5c80('0x19')][_0x5c80('0x1db')]=function(_0x40be75){var _0x160b7c=this;return function(){var _0x494377=0x0;var _0x433426=Math[_0x5c80('0x1e8')](_0x40be75[_0x5c80('0x5e')]*0x3e8);if(_0x433426>0x0){_0x433426=_0x433426<0x64?0x64:_0x433426;loggerPredictive[_0x5c80('0x4c')](_0x40be75[_0x5c80('0x49')],_0x5c80('0x1e9'),_0x433426,'milliseconds');_0x40be75[_0x5c80('0x63')]=setInterval(function(){_0x160b7c[_0x5c80('0x63')](_0x40be75);loggerPredictiveCalls[_0x5c80('0x4c')]('[handlePredictive]',_0x494377+=0x1);},_0x433426);}else{loggerPredictive[_0x5c80('0x4c')](_0x40be75[_0x5c80('0x49')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x5c80('0x1ea')]=function(_0x11f9dd,_0x35fffe){var _0x59fcb8=this;return function(_0x5a2a68){if(_[_0x5c80('0x4a')](_0x5a2a68)){if(_[_0x5c80('0xf9')](_0x35fffe['UserId'])||!_0x35fffe['recallme']){if(_0x11f9dd[_0x5c80('0xb0')]===_0x5c80('0xb5')){_0x11f9dd['queueStatusComplete']=_['isUndefined'](_0x11f9dd['queueStatusComplete'])?!![]:_0x11f9dd[_0x5c80('0x6e')];var _0x459edd=uuid['v4']();_0x59fcb8[_0x5c80('0x24')][_0x459edd]=new Action(_0x11f9dd,_0x35fffe,_0x459edd);loggerBooked[_0x5c80('0x4c')](_0x5c80('0x1eb'),_0x459edd,'queueStatusComplete:\x20',JSON[_0x5c80('0xa4')](_0x11f9dd[_0x5c80('0x6e')]),_0x5c80('0x1ec'),_0x11f9dd[_0x5c80('0x49')]);if(_0x11f9dd[_0x5c80('0x6e')]){_0x11f9dd['queueStatusComplete']=![];_0x59fcb8[_0x5c80('0x2a')][_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0xbe')]]=[];ami[_0x5c80('0x96')]({'actionid':_0x459edd,'action':_0x5c80('0x1ed'),'queue':_0x11f9dd[_0x5c80('0x49')]})[_0x5c80('0x9d')](function(){utils[_0x5c80('0x100')](_0x11f9dd,_0x5c80('0x1ee'));hopperUtils[_0x5c80('0xde')]({'active':![],'ContactId':_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0xe1')],'ListId':_0x59fcb8[_0x5c80('0x24')][_0x459edd]['ListId'],'VoiceQueueId':_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0xe2')]||undefined,'CampaignId':_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x1ef')));delete _0x59fcb8[_0x5c80('0x24')][_0x459edd];});}else{loggerBooked[_0x5c80('0x4c')]('[booked][checkContactBlack][else]',JSON[_0x5c80('0xa4')](_0x11f9dd[_0x5c80('0x6e')]),_0x5c80('0x1ec'),_0x11f9dd['name']);utils[_0x5c80('0x100')](_0x11f9dd,_0x5c80('0x1ee'));hopperUtils[_0x5c80('0xde')]({'active':![],'ContactId':_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0xe1')],'ListId':_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0x102')],'VoiceQueueId':_0x59fcb8['actions'][_0x459edd][_0x5c80('0xe2')]||undefined,'CampaignId':_0x59fcb8[_0x5c80('0x24')][_0x459edd][_0x5c80('0xe3')]||undefined})[_0x5c80('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x59fcb8[_0x5c80('0x24')][_0x459edd];}}else{return _0x59fcb8[_0x5c80('0x1f0')](_0x11f9dd,_0x35fffe);}}else{if(utils[_0x5c80('0x62')](undefined,_0x35fffe[_0x5c80('0x1f1')])<_0x11f9dd[_0x5c80('0x1f2')]*0x3c){if(_0x35fffe['Agent']&&!_0x35fffe['Agent'][_0x5c80('0x1f3')]){_0x59fcb8[_0x5c80('0x1d')][_0x5c80('0xfe')](_0x35fffe['id'])[_0x5c80('0x1c')](function(){utils[_0x5c80('0x100')](_0x11f9dd,_0x5c80('0x1ee'));});}else{hopperUtils['unlockContact']({'active':![]},_0x35fffe['id'],0x1)[_0x5c80('0x1c')](function(){utils[_0x5c80('0x100')](_0x11f9dd,_0x5c80('0x1ee'));});}}else{_0x11f9dd[_0x5c80('0x1f4')]+=0x1;utils[_0x5c80('0x100')](_0x11f9dd,_0x5c80('0x1ee'));if(_0x11f9dd['dialRecallInQueue']){hopperUtils[_0x5c80('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x35fffe[_0x5c80('0xe1')],'ListId':_0x35fffe[_0x5c80('0x102')],'VoiceQueueId':_0x35fffe[_0x5c80('0xe2')]||undefined,'CampaignId':_0x35fffe['CampaignId']||undefined})[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x1f5')));hopperUtils[_0x5c80('0xe8')](createObjHistory(_0x11f9dd,_0x35fffe,utils[_0x5c80('0x67')][_0x5c80('0x1f6')],0x17,_0x5c80('0x1f7')))[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x1f8')));}else{_0x59fcb8[_0x5c80('0x120')](createObjHistory(_0x11f9dd,_0x35fffe,utils['CAMPAIGN_STATUS'][_0x5c80('0x1f9')],0x16,'RecallFailedTimeout'),_0x5c80('0x1fa'),_0x5c80('0x1fb'));}}}}else{_0x11f9dd[_0x5c80('0x1fc')]+=0x1;_0x59fcb8[_0x5c80('0x120')](createObjHistory(_0x11f9dd,_0x35fffe,utils[_0x5c80('0x67')][_0x5c80('0x1fd')],0xd,_0x5c80('0x1fe')),_0x5c80('0x1ff'),_0x5c80('0x200'));throw _0x5c80('0x201');}};};Dialer[_0x5c80('0x19')]['handleIvr']=function(_0x35334c){var _0x158e9f=this;var _0x26b51f=_0x35334c[_0x5c80('0x202')]-_0x35334c[_0x5c80('0x203')];emitCampaignSummary(_0x35334c);if(_0x26b51f>0x0&&_0x35334c[_0x5c80('0x204')]==0x0){if(_0x26b51f>this[_0x5c80('0x22')]){_0x26b51f=this[_0x5c80('0x22')];}_0x35334c[_0x5c80('0x204')]=0x1;hopperUtils[_0x5c80('0x205')](_0x35334c,_0x26b51f)['then'](function(_0x289012){_0x35334c[_0x5c80('0x204')]=0x0;if(_0x289012){if(!utils[_0x5c80('0x206')](_0x289012)){_0x35334c['message']=utils[_0x5c80('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0x5c80('0x4c')]('[getContactCampaign2][Empty]'+_0x35334c[_0x5c80('0x49')]);}else{_0x35334c[_0x5c80('0x203')]+=_0x289012[_0x5c80('0x94')];_0x35334c[_0x5c80('0x66')]=utils[_0x5c80('0x67')]['RUNNING'];for(var _0x1acdd6=0x0;_0x1acdd6<_0x289012[_0x5c80('0x94')];_0x1acdd6+=0x1){_0x35334c['ivrTotalCallsDays']+=0x1;if(_[_0x5c80('0xf9')](_0x289012[_0x1acdd6])||_['isNil'](_0x289012[_0x1acdd6][_0x5c80('0x187')])||_[_0x5c80('0xf9')](_0x289012[_0x1acdd6][_0x5c80('0x16c')])){_0x158e9f[_0x5c80('0x15f')](_0x5c80('0x207'),_0x35334c,_0x289012[_0x1acdd6]);}else{hopperUtils[_0x5c80('0x208')](_[_0x5c80('0x71')](_0x289012[_0x1acdd6],['CampaignId',_0x5c80('0x16c')]))[_0x5c80('0x41')](_0x158e9f['checkContactBlack'](_0x35334c,_0x289012[_0x1acdd6]))[_0x5c80('0x9d')](function(_0x41f6ac){logger['error'](_0x5c80('0x209'),_0x41f6ac);utils[_0x5c80('0x100')](_0x35334c,_0x5c80('0x20a'));});}}}}})['catch'](function(_0xc68bb9){_0x35334c[_0x5c80('0x204')]=0x0;logger['error'](_0x5c80('0x20b'),_0xc68bb9);});}};Dialer['prototype'][_0x5c80('0xb3')]=function(_0x57a1a1,_0x5f2671){var _0x184d9f=this;var _0x3ba881=[];if(_0x5f2671<0x1||_0x57a1a1['dialMethod']===_0x5c80('0xb5')){_0x5f2671=0x1;}var _0x346d45=Math['floor'](_0x57a1a1[_0x5c80('0x1cb')]*_0x5f2671)-_0x57a1a1['originated'];if(_0x57a1a1[_0x5c80('0x20c')]>0x0){var _0x4d34a5=_0x57a1a1['dialLimitQueue']-_0x57a1a1[_0x5c80('0x203')]-_0x57a1a1[_0x5c80('0x149')]-_0x57a1a1[_0x5c80('0x14a')];if(_0x346d45>_0x4d34a5){_0x346d45=_0x4d34a5;}}if(_0x346d45>0x0&&_0x57a1a1[_0x5c80('0x204')]==0x0){if(_0x57a1a1[_0x5c80('0xb0')]===_0x5c80('0xb5')){_0x346d45=0x1;}if(_0x346d45>this[_0x5c80('0x22')]){_0x346d45=this[_0x5c80('0x22')];}for(var _0x2a7a83 in this['agents']){if(typeof this['agents'][_0x2a7a83]!==_0x5c80('0xa7')){if(this[_0x5c80('0x20')][_0x2a7a83][_0x5c80('0x6b')]===_0x5c80('0x20d')&&this[_0x5c80('0x20')][_0x2a7a83][_0x5c80('0x85')]==='reachable'){_0x3ba881[_0x5c80('0x95')](this['agents'][_0x2a7a83]['id']);}}}_0x57a1a1[_0x5c80('0x204')]=0x1;hopperUtils[_0x5c80('0x20e')](_0x57a1a1,_0x3ba881,_0x346d45)[_0x5c80('0x41')](function(_0x1920e5){_0x57a1a1[_0x5c80('0x204')]=0x0;if(_0x1920e5){if(!utils['checkContactEmpty'](_0x1920e5)){hopperUtils[_0x5c80('0x20f')](_0x57a1a1)[_0x5c80('0x41')](sendMessageReschedule(_0x57a1a1))[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x210')));}else{_0x57a1a1[_0x5c80('0x203')]+=_0x1920e5['length'];_0x57a1a1['message']=_0x57a1a1[_0x5c80('0xb0')]===_0x5c80('0xb5')?utils['CAMPAIGN_STATUS'][_0x5c80('0x14b')]:utils[_0x5c80('0x67')][_0x5c80('0x211')];for(var _0x67f97e=0x0;_0x67f97e<_0x1920e5[_0x5c80('0x94')];_0x67f97e+=0x1){if(_[_0x5c80('0xf9')](_0x1920e5[_0x67f97e])||_[_0x5c80('0xf9')](_0x1920e5[_0x67f97e][_0x5c80('0x187')])||_[_0x5c80('0xf9')](_0x1920e5[_0x67f97e][_0x5c80('0x16c')])){_0x184d9f['emptyContact'](_0x5c80('0x207'),_0x57a1a1,_0x1920e5[_0x67f97e]);}else{hopperUtils['checkIsBlackList'](_[_0x5c80('0x71')](_0x1920e5[_0x67f97e],[_0x5c80('0xe2'),_0x5c80('0x16c')]))[_0x5c80('0x41')](_0x184d9f[_0x5c80('0x1ea')](_0x57a1a1,_0x1920e5[_0x67f97e]))[_0x5c80('0x9d')](function(_0x574e94){logger['error'](_0x5c80('0x212'),_0x574e94);utils['decrementOriginate'](_0x57a1a1,'[handlePower]');});}}}}})[_0x5c80('0x9d')](function(_0x14c0ce){_0x57a1a1['temp']=0x0;logger['error'](_0x5c80('0x20b'),_0x14c0ce);});}};Dialer[_0x5c80('0x19')][_0x5c80('0x63')]=function(_0x1c54ab){if(_0x1c54ab[_0x5c80('0x20c')]>0x0){var _0x540337=_0x1c54ab[_0x5c80('0x20c')]-_0x1c54ab[_0x5c80('0x203')]-_0x1c54ab[_0x5c80('0x149')];if(_0x540337>0x0&&_0x1c54ab[_0x5c80('0x204')]==0x0){this[_0x5c80('0x213')](_0x1c54ab);}else{loggerPredictiveCalls['info'](_0x5c80('0x214'));}}else{this['tryOriginatePredictive'](_0x1c54ab);}};Dialer[_0x5c80('0x19')][_0x5c80('0x213')]=function(_0x10aa8e){var _0x3cab4f=this;var _0x561796=[];_0x10aa8e[_0x5c80('0x203')]+=0x1;for(var _0x1e3c49 in this[_0x5c80('0x20')]){if(typeof this['agents'][_0x1e3c49]!==_0x5c80('0xa7')){if(this['agents'][_0x1e3c49][_0x5c80('0x6b')]==='not_inuse'&&this[_0x5c80('0x20')][_0x1e3c49]['status']===_0x5c80('0x86')){_0x561796[_0x5c80('0x95')](this[_0x5c80('0x20')][_0x1e3c49]['id']);}}}_0x10aa8e['temp']=0x1;return this[_0x5c80('0x20e')](_0x10aa8e['id'],_0x561796,0x1,_0x10aa8e[_0x5c80('0x215')],_0x10aa8e)[_0x5c80('0x41')](function(_0x32266f){_0x10aa8e['temp']=0x1;if(_0x32266f){if(!utils[_0x5c80('0x206')](_0x32266f)){utils[_0x5c80('0x216')](_0x10aa8e,0x1,0x0);return hopperUtils['countReScheduled'](_0x10aa8e)['then'](sendMessageReschedule(_0x10aa8e))[_0x5c80('0x9d')](loggerCatch(_0x5c80('0x210')));}else{_0x10aa8e['message']=utils[_0x5c80('0x67')][_0x5c80('0x211')];if(_[_0x5c80('0xf9')](_0x32266f[0x0])||_[_0x5c80('0xf9')](_0x32266f[0x0]['Contact'])||_[_0x5c80('0xf9')](_0x32266f[0x0]['phone'])){_0x3cab4f[_0x5c80('0x15f')]('[actionOriginate]\x20',_0x10aa8e,_0x32266f[0x0]);}else{return hopperUtils[_0x5c80('0x217')](_[_0x5c80('0x71')](_0x32266f[0x0],[_0x5c80('0xe2'),_0x5c80('0x16c')]))['then'](_0x3cab4f[_0x5c80('0x1ea')](_0x10aa8e,_0x32266f[0x0]))[_0x5c80('0x9d')](function(_0x2f14c5){logger[_0x5c80('0x64')](_0x5c80('0x218'),_0x2f14c5);utils['decrementOriginate'](_0x10aa8e,_0x5c80('0x218'));});}}}})['catch'](function(_0x4ffa2a){_0x10aa8e['temp']=0x0;logger[_0x5c80('0x64')](_0x5c80('0x20b'),_0x4ffa2a);});};Dialer[_0x5c80('0x19')]['abandonmentRate']=function(_0x5432d5,_0x313e07,_0x5e3426,_0x5e90aa,_0x11e189,_0x1648e4){loggerPredictive['info'](_0x5c80('0x219'));loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x21a'),_0x5432d5);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x21b'),_0x313e07);loggerPredictive[_0x5c80('0x4c')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e3426);loggerPredictive[_0x5c80('0x4c')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e90aa);loggerPredictive[_0x5c80('0x4c')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11e189);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x56'));return new Promise(function(_0x1b3baa,_0x255ed2){if(_0x5432d5<=0x0||isNaN(_0x5432d5)){return _0x255ed2(msgResponse(_0x5c80('0x21c'),_0x5c80('0x81'),_0x5c80('0x21d')+_0x5432d5));}if(_0x5e3426<=0x0||isNaN(_0x5e3426)){return _0x255ed2(msgResponse('[abandonmentRate]',_0x5c80('0x81'),_0x5c80('0x21e')+_0x5e3426));}if(_0x5e90aa<=0x0||isNaN(_0x5e90aa)){return _0x255ed2(msgResponse(_0x5c80('0x21c'),_0x5c80('0x81'),_0x5c80('0x21f')+_0x5e90aa));}if(_0x313e07<=0x0||isNaN(_0x313e07)){return _0x255ed2(msgResponse(_0x5c80('0x21c'),_0x5c80('0x81'),'interval\x20=\x20'+_0x313e07));}if(_0x11e189<=0x0||isNaN(_0x11e189)){return _0x255ed2(msgResponse(_0x5c80('0x21c'),_0x5c80('0x81'),_0x5c80('0x220')+_0x11e189));}_0x1648e4=_0x1648e4||0x0;var _0x51bfd3=0x1/_0x5e3426;var _0x43a3df=0x0;var _0x1a718b=0x0;var _0xd9e20=0x0;var _0x1ea841=0x0;for(var _0x282286=0x0;_0xd9e20<_0x11e189;_0x282286+=0x1){_0x1a718b=_0x282286/_0x313e07;_0x43a3df=(_0x5e90aa*_0x1a718b+_0x1648e4)/_0x51bfd3;_0xd9e20=utils[_0x5c80('0x221')](_0x43a3df,_0x5432d5);_0x1ea841=_0x43a3df/_0x5432d5*(0x1-utils[_0x5c80('0x221')](_0x43a3df,_0x5432d5));}return _0x1b3baa({'erlangCalls':_0x282286,'erlangCallToSecond':_0x313e07/_0x282286,'erlangAbandonmentRate':_0xd9e20,'erlangBusyFactor':_0x1ea841});});};Dialer[_0x5c80('0x19')][_0x5c80('0x1e0')]=function(_0x5f2e89,_0xf14e5,_0x48823a,_0x54f729,_0x576bc0,_0x3a6f6f){loggerPredictive[_0x5c80('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x5c80('0x4c')]('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',_0x5f2e89);loggerPredictive[_0x5c80('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf14e5);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x222'),_0x48823a);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x223'),_0x54f729);loggerPredictive[_0x5c80('0x4c')](_0x5c80('0x224'),_0x576bc0);loggerPredictive['info'](_0x5c80('0x56'));return new Promise(function(_0x6d8c56,_0x1da2af){if(_0x5f2e89<=0x0||isNaN(_0x5f2e89)){return _0x1da2af(msgResponse(_0x5c80('0x225'),_0x5c80('0x81'),_0x5c80('0x21d')+_0x5f2e89));}if(_0x48823a<=0x0||isNaN(_0x48823a)){return _0x1da2af(msgResponse('[busyFactor]',_0x5c80('0x81'),'Ts\x20=\x20'+_0x48823a));}if(_0x54f729<=0x0||isNaN(_0x54f729)){return _0x1da2af(msgResponse(_0x5c80('0x225'),'Error',_0x5c80('0x21f')+_0x54f729));}if(_0xf14e5<=0x0||isNaN(_0xf14e5)){return _0x1da2af(msgResponse(_0x5c80('0x225'),_0x5c80('0x81'),_0x5c80('0x226')+_0xf14e5));}if(_0x576bc0<=0x0||isNaN(_0x576bc0)){return _0x1da2af(msgResponse(_0x5c80('0x225'),_0x5c80('0x81'),_0x5c80('0x227')+_0x576bc0));}_0x3a6f6f=_0x3a6f6f||0x0;var _0x49f93c=0x1/_0x48823a;var _0x57c982=0x0;var _0x1680e8=0x0;var _0x448abf=0x0;var _0x743d0d=0x0;for(var _0x38b5fc=0x0;_0x743d0d<_0x576bc0;_0x38b5fc+=0x1){_0x1680e8=_0x38b5fc/_0xf14e5;_0x57c982=(_0x54f729*_0x1680e8+_0x3a6f6f)/_0x49f93c;_0x448abf=utils[_0x5c80('0x221')](_0x57c982,_0x5f2e89);_0x743d0d=_0x57c982/_0x5f2e89*(0x1-utils[_0x5c80('0x221')](_0x57c982,_0x5f2e89));}return _0x6d8c56({'erlangCalls':_0x38b5fc,'erlangCallToSecond':_0xf14e5/_0x38b5fc,'erlangAbandonmentRate':_0x448abf,'erlangBusyFactor':_0x743d0d});});};module[_0x5c80('0x228')]=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 79f60c3..895619d 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 _0xf68a=['callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format'];(function(_0x5dd2bf,_0x2cb299){var _0x19818e=function(_0x403afd){while(--_0x403afd){_0x5dd2bf['push'](_0x5dd2bf['shift']());}};_0x19818e(++_0x2cb299);}(_0xf68a,0x93));var _0xaf68=function(_0x485995,_0x55d990){_0x485995=_0x485995-0x0;var _0x49e0a1=_0xf68a[_0x485995];return _0x49e0a1;};'use strict';var util=require(_0xaf68('0x0'));var _=require(_0xaf68('0x1'));var moment=require(_0xaf68('0x2'));function checkNameSurname(_0x2b8da5,_0x11fcea,_0x14db17){var _0x5bef3c='';if(!_[_0xaf68('0x3')](_0x11fcea)&&_0xaf68('0x4')===typeof _0x11fcea){_0x5bef3c+=_0x11fcea;}if(!_[_0xaf68('0x3')](_0x14db17)&&_0xaf68('0x4')===typeof _0x14db17){_0x5bef3c+='\x20'+_0x14db17;}if(_0x5bef3c!==''){return _0x5bef3c;}return _0x2b8da5;}function Action(_0x7abae3,_0x4f8e0c,_0x41812a){this[_0xaf68('0x5')]=_0x7abae3;this['uniqueid']=_0x41812a||undefined;this['name']=checkNameSurname(_0x4f8e0c[_0xaf68('0x6')][_0xaf68('0x7')],_0x4f8e0c[_0xaf68('0x6')][_0xaf68('0x8')],_0x4f8e0c[_0xaf68('0x6')][_0xaf68('0x9')]);this[_0xaf68('0xa')]=_0x4f8e0c[_0xaf68('0x7')];this[_0xaf68('0xb')]=_0x7abae3[_0xaf68('0xc')];this['active']=_0x4f8e0c[_0xaf68('0xd')]||![];this[_0xaf68('0xe')]=_0x7abae3[_0xaf68('0xe')];this[_0xaf68('0xf')]=_0x7abae3['dialQueueTimeout']||0x3;this[_0xaf68('0x10')]=_0x4f8e0c[_0xaf68('0x10')];this['countbusyretry']=_0x4f8e0c[_0xaf68('0x11')];this[_0xaf68('0x12')]=_0x4f8e0c[_0xaf68('0x12')];this[_0xaf68('0x13')]=_0x4f8e0c[_0xaf68('0x13')];this['countnosuchnumberretry']=_0x4f8e0c['countnosuchnumberretry'];this[_0xaf68('0x14')]=_0x4f8e0c[_0xaf68('0x14')];this[_0xaf68('0x15')]=_0x4f8e0c[_0xaf68('0x15')];this[_0xaf68('0x16')]=_0x4f8e0c[_0xaf68('0x16')];this['countagentrejectretry']=_0x4f8e0c[_0xaf68('0x17')];this[_0xaf68('0x18')]=_0x4f8e0c[_0xaf68('0x18')];this[_0xaf68('0x19')]=_0x4f8e0c[_0xaf68('0x19')];this[_0xaf68('0x1a')]=_0x4f8e0c[_0xaf68('0x1a')];this[_0xaf68('0x1b')]=_0x4f8e0c['VoiceQueueId'];this[_0xaf68('0x1c')]=_0x4f8e0c[_0xaf68('0x1c')];this[_0xaf68('0x1d')]=_0x4f8e0c['id'];this[_0xaf68('0x1e')]=_0x4f8e0c[_0xaf68('0x6')]['firstName']||'';this[_0xaf68('0x1f')]=moment()[_0xaf68('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf68('0x21')]=_0x4f8e0c[_0xaf68('0x21')];this[_0xaf68('0x22')]=_0x4f8e0c['callbackuniqueid'];this[_0xaf68('0x23')]=_0x4f8e0c[_0xaf68('0x23')];this[_0xaf68('0x24')]=_0x4f8e0c[_0xaf68('0x24')];this['originatecalleridnum']='';this[_0xaf68('0x25')]='';}Action[_0xaf68('0x26')][_0xaf68('0x27')]=function(){return util[_0xaf68('0x20')](_0xaf68('0x28'),this[_0xaf68('0xc')],this[_0xaf68('0x5')][_0xaf68('0x29')]>0x0?this['number'][_0xaf68('0x2a')](this[_0xaf68('0x5')][_0xaf68('0x29')]):this[_0xaf68('0xa')]);};Action['prototype'][_0xaf68('0x2b')]=function(){return this[_0xaf68('0xb')];};module[_0xaf68('0x2c')]=Action; \ No newline at end of file +var _0xf8c7=['queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','format','\x22%s\x22\x20<%s>','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','lastName','number'];(function(_0xb3e2b4,_0x379d70){var _0xb6c4a5=function(_0x2c597e){while(--_0x2c597e){_0xb3e2b4['push'](_0xb3e2b4['shift']());}};_0xb6c4a5(++_0x379d70);}(_0xf8c7,0xa2));var _0x7f8c=function(_0x2aab56,_0xd4c3d7){_0x2aab56=_0x2aab56-0x0;var _0x13a3e0=_0xf8c7[_0x2aab56];return _0x13a3e0;};'use strict';var util=require(_0x7f8c('0x0'));var _=require('lodash');var moment=require(_0x7f8c('0x1'));function checkNameSurname(_0x3c1101,_0x5e28ab,_0x4bd113){var _0x1ea74d='';if(!_[_0x7f8c('0x2')](_0x5e28ab)&&'string'===typeof _0x5e28ab){_0x1ea74d+=_0x5e28ab;}if(!_[_0x7f8c('0x2')](_0x4bd113)&&_0x7f8c('0x3')===typeof _0x4bd113){_0x1ea74d+='\x20'+_0x4bd113;}if(_0x1ea74d!==''){return _0x1ea74d;}return _0x3c1101;}function Action(_0x1c99ab,_0x12ad8b,_0x8e610){this[_0x7f8c('0x4')]=_0x1c99ab;this[_0x7f8c('0x5')]=_0x8e610||undefined;this['name']=checkNameSurname(_0x12ad8b[_0x7f8c('0x6')][_0x7f8c('0x7')],_0x12ad8b[_0x7f8c('0x6')]['firstName'],_0x12ad8b[_0x7f8c('0x6')][_0x7f8c('0x8')]);this[_0x7f8c('0x9')]=_0x12ad8b[_0x7f8c('0x7')];this[_0x7f8c('0xa')]=_0x1c99ab[_0x7f8c('0xb')];this[_0x7f8c('0xc')]=_0x12ad8b[_0x7f8c('0xc')]||![];this[_0x7f8c('0xd')]=_0x1c99ab['type'];this[_0x7f8c('0xe')]=_0x1c99ab[_0x7f8c('0xe')]||0x3;this[_0x7f8c('0xf')]=_0x12ad8b['scheduledat'];this[_0x7f8c('0x10')]=_0x12ad8b[_0x7f8c('0x10')];this[_0x7f8c('0x11')]=_0x12ad8b[_0x7f8c('0x11')];this[_0x7f8c('0x12')]=_0x12ad8b['countnoanswerretry'];this[_0x7f8c('0x13')]=_0x12ad8b[_0x7f8c('0x13')];this['countdropretry']=_0x12ad8b[_0x7f8c('0x14')];this[_0x7f8c('0x15')]=_0x12ad8b[_0x7f8c('0x15')];this[_0x7f8c('0x16')]=_0x12ad8b[_0x7f8c('0x16')];this[_0x7f8c('0x17')]=_0x12ad8b[_0x7f8c('0x17')];this['ContactId']=_0x12ad8b['ContactId'];this[_0x7f8c('0x18')]=_0x12ad8b[_0x7f8c('0x18')];this[_0x7f8c('0x19')]=_0x12ad8b[_0x7f8c('0x19')];this[_0x7f8c('0x1a')]=_0x12ad8b[_0x7f8c('0x1a')];this[_0x7f8c('0x1b')]=_0x12ad8b[_0x7f8c('0x1b')];this[_0x7f8c('0x1c')]=_0x12ad8b['id'];this[_0x7f8c('0x1d')]=_0x12ad8b['Contact'][_0x7f8c('0x1e')]||'';this[_0x7f8c('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7f8c('0x20')]=_0x12ad8b['callback'];this[_0x7f8c('0x21')]=_0x12ad8b[_0x7f8c('0x21')];this[_0x7f8c('0x22')]=_0x12ad8b[_0x7f8c('0x22')];this[_0x7f8c('0x23')]=_0x12ad8b['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x7f8c('0x24')][_0x7f8c('0x25')]=function(){return util[_0x7f8c('0x26')](_0x7f8c('0x27'),this['name'],this[_0x7f8c('0x4')]['dialCutDigit']>0x0?this['number'][_0x7f8c('0x28')](this[_0x7f8c('0x4')]['dialCutDigit']):this['number']);};Action[_0x7f8c('0x24')][_0x7f8c('0x29')]=function(){return this[_0x7f8c('0xa')];};module[_0x7f8c('0x2a')]=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 4f4dfa7..b39ee33 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 _0xb46d=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','endtime','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','Answer','scheduledat','campaigntype','type','outbound','queue'];(function(_0xad01ed,_0x5f0d8c){var _0x2df336=function(_0x1f4702){while(--_0x1f4702){_0xad01ed['push'](_0xad01ed['shift']());}};_0x2df336(++_0x5f0d8c);}(_0xb46d,0x70));var _0xdb46=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xb46d[_0x504df1];return _0x1063b5;};'use strict';var moment=require(_0xdb46('0x0'));var utils=require('../utils');function AgentComplete(_0x21bc42,_0x451a31){this[_0xdb46('0x1')]=0x4;this['statedesc']=_0xdb46('0x2');this['scheduledat']=_0x21bc42[_0xdb46('0x3')];this['type']=_0x21bc42['type'];this[_0xdb46('0x4')]=_0x21bc42[_0xdb46('0x5')]===_0xdb46('0x6')?_0xdb46('0x7'):_0x21bc42['type'];this[_0xdb46('0x8')]=_0x21bc42['countbusyretry'];this[_0xdb46('0x9')]=_0x21bc42[_0xdb46('0x9')];this[_0xdb46('0xa')]=_0x21bc42[_0xdb46('0xa')];this[_0xdb46('0xb')]=_0x21bc42[_0xdb46('0x8')]+_0x21bc42[_0xdb46('0x9')]+_0x21bc42[_0xdb46('0xa')]+_0x21bc42[_0xdb46('0xc')]+_0x21bc42[_0xdb46('0xd')]+_0x21bc42[_0xdb46('0xe')]+_0x21bc42[_0xdb46('0xf')]+_0x21bc42['countagentrejectretry'];this[_0xdb46('0xc')]=_0x21bc42[_0xdb46('0xc')];this[_0xdb46('0xd')]=_0x21bc42[_0xdb46('0xd')];this[_0xdb46('0xe')]=_0x21bc42['countabandonedretry'];this[_0xdb46('0xf')]=_0x21bc42['countmachineretry'];this[_0xdb46('0x10')]=_0x21bc42[_0xdb46('0x10')];this[_0xdb46('0x11')]=_0x451a31['uniqueid'];this['calleridname']=_0x21bc42[_0xdb46('0x12')];this[_0xdb46('0x13')]=_0x21bc42['number'];this[_0xdb46('0x14')]=_0x21bc42[_0xdb46('0x14')];this[_0xdb46('0x15')]=_0x21bc42[_0xdb46('0x15')];this[_0xdb46('0x16')]=_0x21bc42[_0xdb46('0x16')];this['endtime']=moment()['format'](_0xdb46('0x17'));this['ringtime']=utils[_0xdb46('0x18')](_0x21bc42['responsetime'],_0x21bc42[_0xdb46('0x14')]);this['holdtime']=utils[_0xdb46('0x18')](_0x21bc42[_0xdb46('0x16')],_0x21bc42[_0xdb46('0x15')]);this[_0xdb46('0x19')]=utils[_0xdb46('0x18')](this[_0xdb46('0x1a')],_0x21bc42[_0xdb46('0x16')]);this[_0xdb46('0x7')]=_0x451a31['queue'];this['membername']=_0x451a31['membername'];this[_0xdb46('0x1b')]=_0x451a31[_0xdb46('0x1b')];this['callback']=_0x21bc42['callback'];this[_0xdb46('0x1c')]=_0x21bc42[_0xdb46('0x1c')];this['callbackat']=_0x21bc42[_0xdb46('0x1d')];this[_0xdb46('0x1e')]=_0x21bc42[_0xdb46('0x1e')];this[_0xdb46('0x1f')]=_0x21bc42['ContactId'];this[_0xdb46('0x20')]=_0x21bc42[_0xdb46('0x20')];this[_0xdb46('0x21')]=_0x21bc42[_0xdb46('0x21')];this[_0xdb46('0x22')]=_0x21bc42[_0xdb46('0x22')];this[_0xdb46('0x23')]=_0x21bc42[_0xdb46('0x23')];this['originatecalleridnum']=_0x21bc42[_0xdb46('0x24')]||'';this['originatecalleridname']=_0x21bc42[_0xdb46('0x25')]||'';this[_0xdb46('0x26')]=_0x21bc42['agiafterat'];}module[_0xdb46('0x27')]=AgentComplete; \ No newline at end of file +var _0x2299=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds'];(function(_0x512985,_0x3daa17){var _0x13a105=function(_0x28c3de){while(--_0x28c3de){_0x512985['push'](_0x512985['shift']());}};_0x13a105(++_0x3daa17);}(_0x2299,0xc7));var _0x9229=function(_0x35efdc,_0x4dd785){_0x35efdc=_0x35efdc-0x0;var _0x2924cb=_0x2299[_0x35efdc];return _0x2924cb;};'use strict';var moment=require(_0x9229('0x0'));var utils=require('../utils');function AgentComplete(_0x5ecf6c,_0x3b71c1){this[_0x9229('0x1')]=0x4;this[_0x9229('0x2')]=_0x9229('0x3');this[_0x9229('0x4')]=_0x5ecf6c[_0x9229('0x4')];this['type']=_0x5ecf6c[_0x9229('0x5')];this[_0x9229('0x6')]=_0x5ecf6c[_0x9229('0x5')]===_0x9229('0x7')?_0x9229('0x8'):_0x5ecf6c[_0x9229('0x5')];this['countbusyretry']=_0x5ecf6c['countbusyretry'];this[_0x9229('0x9')]=_0x5ecf6c['countcongestionretry'];this[_0x9229('0xa')]=_0x5ecf6c['countnoanswerretry'];this['countglobal']=_0x5ecf6c[_0x9229('0xb')]+_0x5ecf6c[_0x9229('0x9')]+_0x5ecf6c['countnoanswerretry']+_0x5ecf6c['countnosuchnumberretry']+_0x5ecf6c['countdropretry']+_0x5ecf6c[_0x9229('0xc')]+_0x5ecf6c[_0x9229('0xd')]+_0x5ecf6c[_0x9229('0xe')];this['countnosuchnumberretry']=_0x5ecf6c[_0x9229('0xf')];this[_0x9229('0x10')]=_0x5ecf6c[_0x9229('0x10')];this[_0x9229('0xc')]=_0x5ecf6c[_0x9229('0xc')];this[_0x9229('0xd')]=_0x5ecf6c[_0x9229('0xd')];this[_0x9229('0xe')]=_0x5ecf6c[_0x9229('0xe')];this[_0x9229('0x11')]=_0x3b71c1[_0x9229('0x11')];this[_0x9229('0x12')]=_0x5ecf6c[_0x9229('0x13')];this[_0x9229('0x14')]=_0x5ecf6c[_0x9229('0x15')];this[_0x9229('0x16')]=_0x5ecf6c[_0x9229('0x16')];this[_0x9229('0x17')]=_0x5ecf6c['responsetime'];this['answertime']=_0x5ecf6c[_0x9229('0x18')];this[_0x9229('0x19')]=moment()[_0x9229('0x1a')](_0x9229('0x1b'));this[_0x9229('0x1c')]=utils['getSeconds'](_0x5ecf6c[_0x9229('0x17')],_0x5ecf6c['starttime']);this[_0x9229('0x1d')]=utils[_0x9229('0x1e')](_0x5ecf6c[_0x9229('0x18')],_0x5ecf6c[_0x9229('0x17')]);this['talktime']=utils[_0x9229('0x1e')](this['endtime'],_0x5ecf6c[_0x9229('0x18')]);this['queue']=_0x3b71c1['queue'];this[_0x9229('0x1f')]=_0x3b71c1[_0x9229('0x1f')];this[_0x9229('0x20')]=_0x3b71c1['reason'];this['callback']=_0x5ecf6c[_0x9229('0x21')];this[_0x9229('0x22')]=_0x5ecf6c[_0x9229('0x22')];this['callbackat']=_0x5ecf6c[_0x9229('0x23')];this[_0x9229('0x24')]=_0x5ecf6c[_0x9229('0x24')];this[_0x9229('0x25')]=_0x5ecf6c['ContactId'];this[_0x9229('0x26')]=_0x5ecf6c[_0x9229('0x26')];this[_0x9229('0x27')]=_0x5ecf6c['UserId'];this[_0x9229('0x28')]=_0x5ecf6c[_0x9229('0x28')];this[_0x9229('0x29')]=_0x5ecf6c[_0x9229('0x29')];this[_0x9229('0x2a')]=_0x5ecf6c[_0x9229('0x2a')]||'';this[_0x9229('0x2b')]=_0x5ecf6c['originatecalleridname']||'';this[_0x9229('0x2c')]=_0x5ecf6c[_0x9229('0x2c')];}module[_0x9229('0x2d')]=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 2de60ed..c4a5de5 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 _0xe3c0=['calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x1f2e50,_0x23e4d2){var _0xf6b980=function(_0x35e4b9){while(--_0x35e4b9){_0x1f2e50['push'](_0x1f2e50['shift']());}};_0xf6b980(++_0x23e4d2);}(_0xe3c0,0x135));var _0x0e3c=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xe3c0[_0x18cd5b];return _0x5eaa52;};'use strict';function Final(_0x440fb3){this[_0x0e3c('0x0')]=_0x440fb3[_0x0e3c('0x0')];this['scheduledat']=_0x440fb3[_0x0e3c('0x1')];this['type']=_0x440fb3['type'];this[_0x0e3c('0x2')]=_0x440fb3[_0x0e3c('0x3')]===_0x0e3c('0x4')?_0x0e3c('0x5'):_0x440fb3[_0x0e3c('0x3')];this['countbusyretry']=_0x440fb3[_0x0e3c('0x6')];this[_0x0e3c('0x7')]=_0x440fb3[_0x0e3c('0x7')];this['countnoanswerretry']=_0x440fb3[_0x0e3c('0x8')];this[_0x0e3c('0x9')]=_0x440fb3[_0x0e3c('0x6')]+_0x440fb3[_0x0e3c('0x7')]+_0x440fb3[_0x0e3c('0x8')]+_0x440fb3[_0x0e3c('0xa')]+_0x440fb3['countdropretry']+_0x440fb3['countabandonedretry']+_0x440fb3['countmachineretry']+_0x440fb3[_0x0e3c('0xb')];this[_0x0e3c('0xa')]=_0x440fb3[_0x0e3c('0xa')];this[_0x0e3c('0xc')]=_0x440fb3[_0x0e3c('0xc')];this['countabandonedretry']=_0x440fb3[_0x0e3c('0xd')];this['countmachineretry']=_0x440fb3[_0x0e3c('0xe')];this[_0x0e3c('0xb')]=_0x440fb3[_0x0e3c('0xb')];this[_0x0e3c('0x5')]=_0x440fb3[_0x0e3c('0x5')];this[_0x0e3c('0xf')]=_0x440fb3['calleridname'];this[_0x0e3c('0x10')]=_0x440fb3[_0x0e3c('0x10')];this[_0x0e3c('0x11')]=_0x440fb3[_0x0e3c('0x11')];this[_0x0e3c('0x12')]=_0x440fb3[_0x0e3c('0x12')];this['endtime']=_0x440fb3[_0x0e3c('0x12')];this[_0x0e3c('0x13')]=_0x440fb3[_0x0e3c('0x13')]||0x0;this[_0x0e3c('0x14')]=_0x440fb3[_0x0e3c('0x14')]||0x0;this[_0x0e3c('0x15')]=_0x440fb3[_0x0e3c('0x15')]||0x0;this[_0x0e3c('0x16')]=_0x440fb3[_0x0e3c('0x16')];this[_0x0e3c('0x17')]=_0x440fb3[_0x0e3c('0x17')];this[_0x0e3c('0x18')]=_0x440fb3[_0x0e3c('0x18')];this[_0x0e3c('0x19')]=_0x440fb3[_0x0e3c('0x19')];this['ContactId']=_0x440fb3[_0x0e3c('0x1a')];this['ListId']=_0x440fb3[_0x0e3c('0x1b')];this[_0x0e3c('0x1c')]=_0x440fb3[_0x0e3c('0x1c')];this['VoiceQueueId']=_0x440fb3[_0x0e3c('0x1d')];this[_0x0e3c('0x1e')]=_0x440fb3[_0x0e3c('0x1e')];this[_0x0e3c('0x1f')]=_0x440fb3[_0x0e3c('0x1f')]||'';this['originatecalleridname']=_0x440fb3[_0x0e3c('0x20')]||'';this[_0x0e3c('0x21')]=_0x440fb3[_0x0e3c('0x21')];this['statedesc']=_0x440fb3[_0x0e3c('0x22')];}module[_0x0e3c('0x23')]=Final; \ No newline at end of file +var _0x2e0c=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype'];(function(_0x54aec4,_0x1917f1){var _0x15a8cb=function(_0x225413){while(--_0x225413){_0x54aec4['push'](_0x54aec4['shift']());}};_0x15a8cb(++_0x1917f1);}(_0x2e0c,0x1ac));var _0xc2e0=function(_0x52459b,_0x296ef5){_0x52459b=_0x52459b-0x0;var _0x379955=_0x2e0c[_0x52459b];return _0x379955;};'use strict';function Final(_0x25e0ab){this[_0xc2e0('0x0')]=_0x25e0ab[_0xc2e0('0x0')];this['scheduledat']=_0x25e0ab[_0xc2e0('0x1')];this[_0xc2e0('0x2')]=_0x25e0ab[_0xc2e0('0x2')];this[_0xc2e0('0x3')]=_0x25e0ab[_0xc2e0('0x2')]===_0xc2e0('0x4')?_0xc2e0('0x5'):_0x25e0ab['type'];this[_0xc2e0('0x6')]=_0x25e0ab[_0xc2e0('0x6')];this[_0xc2e0('0x7')]=_0x25e0ab[_0xc2e0('0x7')];this[_0xc2e0('0x8')]=_0x25e0ab[_0xc2e0('0x8')];this[_0xc2e0('0x9')]=_0x25e0ab[_0xc2e0('0x6')]+_0x25e0ab[_0xc2e0('0x7')]+_0x25e0ab[_0xc2e0('0x8')]+_0x25e0ab[_0xc2e0('0xa')]+_0x25e0ab[_0xc2e0('0xb')]+_0x25e0ab[_0xc2e0('0xc')]+_0x25e0ab[_0xc2e0('0xd')]+_0x25e0ab[_0xc2e0('0xe')];this['countnosuchnumberretry']=_0x25e0ab['countnosuchnumberretry'];this[_0xc2e0('0xb')]=_0x25e0ab[_0xc2e0('0xb')];this['countabandonedretry']=_0x25e0ab['countabandonedretry'];this['countmachineretry']=_0x25e0ab[_0xc2e0('0xd')];this[_0xc2e0('0xe')]=_0x25e0ab[_0xc2e0('0xe')];this[_0xc2e0('0x5')]=_0x25e0ab[_0xc2e0('0x5')];this['calleridname']=_0x25e0ab['calleridname'];this['calleridnum']=_0x25e0ab[_0xc2e0('0xf')];this[_0xc2e0('0x10')]=_0x25e0ab[_0xc2e0('0x10')];this['responsetime']=_0x25e0ab[_0xc2e0('0x11')];this[_0xc2e0('0x12')]=_0x25e0ab[_0xc2e0('0x11')];this[_0xc2e0('0x13')]=_0x25e0ab[_0xc2e0('0x13')]||0x0;this[_0xc2e0('0x14')]=_0x25e0ab[_0xc2e0('0x14')]||0x0;this[_0xc2e0('0x15')]=_0x25e0ab[_0xc2e0('0x15')]||0x0;this[_0xc2e0('0x16')]=_0x25e0ab['callback'];this[_0xc2e0('0x17')]=_0x25e0ab[_0xc2e0('0x17')];this[_0xc2e0('0x18')]=_0x25e0ab['callbackat'];this[_0xc2e0('0x19')]=_0x25e0ab[_0xc2e0('0x19')];this[_0xc2e0('0x1a')]=_0x25e0ab[_0xc2e0('0x1a')];this[_0xc2e0('0x1b')]=_0x25e0ab[_0xc2e0('0x1b')];this['UserId']=_0x25e0ab[_0xc2e0('0x1c')];this[_0xc2e0('0x1d')]=_0x25e0ab[_0xc2e0('0x1d')];this[_0xc2e0('0x1e')]=_0x25e0ab[_0xc2e0('0x1e')];this[_0xc2e0('0x1f')]=_0x25e0ab[_0xc2e0('0x1f')]||'';this[_0xc2e0('0x20')]=_0x25e0ab[_0xc2e0('0x20')]||'';this[_0xc2e0('0x21')]=_0x25e0ab['state'];this[_0xc2e0('0x22')]=_0x25e0ab['statedesc'];}module[_0xc2e0('0x23')]=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 7565c2e..c5d7858 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 _0x7b71=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','responsetime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x29ba25,_0x59c439){var _0x43614b=function(_0x198a17){while(--_0x198a17){_0x29ba25['push'](_0x29ba25['shift']());}};_0x43614b(++_0x59c439);}(_0x7b71,0xf6));var _0x17b7=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0x7b71[_0x3388d8];return _0x2bbe73;};'use strict';var moment=require(_0x17b7('0x0'));var utils=require(_0x17b7('0x1'));function Hangup(_0x2bf0f8,_0x594dec){this[_0x17b7('0x2')]=0x4;this[_0x17b7('0x3')]='Answer';this[_0x17b7('0x4')]=_0x2bf0f8[_0x17b7('0x4')];this[_0x17b7('0x5')]=_0x2bf0f8[_0x17b7('0x5')];this[_0x17b7('0x6')]=_0x2bf0f8[_0x17b7('0x5')]===_0x17b7('0x7')?_0x17b7('0x8'):_0x2bf0f8[_0x17b7('0x5')];this['amd']=_0x2bf0f8[_0x17b7('0x9')]||![];this[_0x17b7('0xa')]=_0x2bf0f8[_0x17b7('0xa')];this[_0x17b7('0xb')]=_0x2bf0f8[_0x17b7('0xb')];this['countnoanswerretry']=_0x2bf0f8[_0x17b7('0xc')];this[_0x17b7('0xd')]=_0x2bf0f8[_0x17b7('0xa')]+_0x2bf0f8[_0x17b7('0xb')]+_0x2bf0f8['countnoanswerretry']+_0x2bf0f8[_0x17b7('0xe')]+_0x2bf0f8[_0x17b7('0xf')]+_0x2bf0f8['countabandonedretry']+_0x2bf0f8['countmachineretry']+_0x2bf0f8['countagentrejectretry'];this[_0x17b7('0xe')]=_0x2bf0f8[_0x17b7('0xe')];this[_0x17b7('0xf')]=_0x2bf0f8[_0x17b7('0xf')];this[_0x17b7('0x10')]=_0x2bf0f8[_0x17b7('0x10')];this[_0x17b7('0x11')]=_0x2bf0f8[_0x17b7('0x11')];this[_0x17b7('0x12')]=_0x2bf0f8[_0x17b7('0x12')];this['uniqueid']=_0x594dec[_0x17b7('0x13')];this[_0x17b7('0x14')]=_0x2bf0f8[_0x17b7('0x15')];this[_0x17b7('0x16')]=_0x2bf0f8[_0x17b7('0x17')];this[_0x17b7('0x18')]=_0x2bf0f8[_0x17b7('0x18')];this['responsetime']=_0x2bf0f8['responsetime'];this[_0x17b7('0x19')]=moment()[_0x17b7('0x1a')](_0x17b7('0x1b'));this[_0x17b7('0x1c')]=utils[_0x17b7('0x1d')](_0x2bf0f8['responsetime'],_0x2bf0f8[_0x17b7('0x18')]);this[_0x17b7('0x1e')]=0x0;this[_0x17b7('0x1f')]=utils['getSeconds'](this['endtime'],_0x2bf0f8[_0x17b7('0x20')]);this[_0x17b7('0x8')]=_0x2bf0f8[_0x17b7('0x8')];this['membername']=_0x17b7('0x21');this[_0x17b7('0x22')]=_0x594dec[_0x17b7('0x23')];this[_0x17b7('0x24')]=_0x2bf0f8[_0x17b7('0x24')];this[_0x17b7('0x25')]=_0x2bf0f8[_0x17b7('0x25')];this[_0x17b7('0x26')]=_0x2bf0f8[_0x17b7('0x26')];this[_0x17b7('0x27')]=_0x2bf0f8[_0x17b7('0x27')];this[_0x17b7('0x28')]=_0x2bf0f8[_0x17b7('0x28')];this[_0x17b7('0x29')]=_0x2bf0f8[_0x17b7('0x29')];this[_0x17b7('0x2a')]=_0x2bf0f8['UserId'];this[_0x17b7('0x2b')]=_0x2bf0f8[_0x17b7('0x2b')];this[_0x17b7('0x2c')]=_0x2bf0f8[_0x17b7('0x2c')];}module['exports']=Hangup; \ No newline at end of file +var _0x5866=['countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x494965,_0x48ace5){var _0x3e682e=function(_0x463373){while(--_0x463373){_0x494965['push'](_0x494965['shift']());}};_0x3e682e(++_0x48ace5);}(_0x5866,0xdc));var _0x6586=function(_0x38580e,_0x273f72){_0x38580e=_0x38580e-0x0;var _0x5457d0=_0x5866[_0x38580e];return _0x5457d0;};'use strict';var moment=require(_0x6586('0x0'));var utils=require(_0x6586('0x1'));function Hangup(_0x1acfa5,_0x576211){this['state']=0x4;this['statedesc']=_0x6586('0x2');this[_0x6586('0x3')]=_0x1acfa5[_0x6586('0x3')];this[_0x6586('0x4')]=_0x1acfa5[_0x6586('0x4')];this['campaigntype']=_0x1acfa5[_0x6586('0x4')]==='outbound'?_0x6586('0x5'):_0x1acfa5[_0x6586('0x4')];this['amd']=_0x1acfa5[_0x6586('0x6')]||![];this['countbusyretry']=_0x1acfa5[_0x6586('0x7')];this[_0x6586('0x8')]=_0x1acfa5[_0x6586('0x8')];this[_0x6586('0x9')]=_0x1acfa5[_0x6586('0x9')];this[_0x6586('0xa')]=_0x1acfa5[_0x6586('0x7')]+_0x1acfa5[_0x6586('0x8')]+_0x1acfa5[_0x6586('0x9')]+_0x1acfa5[_0x6586('0xb')]+_0x1acfa5[_0x6586('0xc')]+_0x1acfa5[_0x6586('0xd')]+_0x1acfa5[_0x6586('0xe')]+_0x1acfa5[_0x6586('0xf')];this[_0x6586('0xb')]=_0x1acfa5[_0x6586('0xb')];this['countdropretry']=_0x1acfa5[_0x6586('0xc')];this[_0x6586('0xd')]=_0x1acfa5['countabandonedretry'];this[_0x6586('0xe')]=_0x1acfa5[_0x6586('0xe')];this[_0x6586('0xf')]=_0x1acfa5[_0x6586('0xf')];this[_0x6586('0x10')]=_0x576211[_0x6586('0x10')];this[_0x6586('0x11')]=_0x1acfa5[_0x6586('0x12')];this[_0x6586('0x13')]=_0x1acfa5[_0x6586('0x14')];this[_0x6586('0x15')]=_0x1acfa5[_0x6586('0x15')];this[_0x6586('0x16')]=_0x1acfa5[_0x6586('0x16')];this[_0x6586('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6586('0x18')]=utils[_0x6586('0x19')](_0x1acfa5['responsetime'],_0x1acfa5['starttime']);this[_0x6586('0x1a')]=0x0;this['talktime']=utils[_0x6586('0x19')](this[_0x6586('0x17')],_0x1acfa5['responsetime']);this[_0x6586('0x5')]=_0x1acfa5[_0x6586('0x5')];this[_0x6586('0x1b')]='IVR';this[_0x6586('0x1c')]=_0x576211[_0x6586('0x1d')];this[_0x6586('0x1e')]=_0x1acfa5['callback'];this[_0x6586('0x1f')]=_0x1acfa5[_0x6586('0x1f')];this['callbackat']=_0x1acfa5[_0x6586('0x20')];this[_0x6586('0x21')]=_0x1acfa5[_0x6586('0x21')];this[_0x6586('0x22')]=_0x1acfa5[_0x6586('0x22')];this[_0x6586('0x23')]=_0x1acfa5[_0x6586('0x23')];this[_0x6586('0x24')]=_0x1acfa5[_0x6586('0x24')];this[_0x6586('0x25')]=_0x1acfa5[_0x6586('0x25')];this[_0x6586('0x26')]=_0x1acfa5[_0x6586('0x26')];}module['exports']=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 531e615..0ffb4c7 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 _0x8e16=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x2f20be,_0x55f0fb){var _0x48046d=function(_0x1b3f29){while(--_0x1b3f29){_0x2f20be['push'](_0x2f20be['shift']());}};_0x48046d(++_0x55f0fb);}(_0x8e16,0xa6));var _0x68e1=function(_0x18d1a7,_0x44162c){_0x18d1a7=_0x18d1a7-0x0;var _0x352453=_0x8e16[_0x18d1a7];return _0x352453;};'use strict';var utils=require('../utils');function History(_0x39cc66){this[_0x68e1('0x0')]=_0x39cc66['uniqueid'];this[_0x68e1('0x1')]=_0x39cc66['scheduledat']||undefined;this[_0x68e1('0x2')]=_0x39cc66[_0x68e1('0x2')];this['campaigntype']=_0x39cc66[_0x68e1('0x2')]===_0x68e1('0x3')?_0x68e1('0x4'):_0x39cc66[_0x68e1('0x2')];this[_0x68e1('0x5')]=_0x39cc66[_0x68e1('0x5')];this[_0x68e1('0x6')]=_0x39cc66[_0x68e1('0x6')];this[_0x68e1('0x7')]=_0x39cc66[_0x68e1('0x7')];this[_0x68e1('0x8')]=_0x39cc66[_0x68e1('0x5')]+_0x39cc66['countcongestionretry']+_0x39cc66[_0x68e1('0x7')]+_0x39cc66[_0x68e1('0x9')]+_0x39cc66[_0x68e1('0xa')]+_0x39cc66[_0x68e1('0xb')]+_0x39cc66[_0x68e1('0xc')]+_0x39cc66[_0x68e1('0xd')];this[_0x68e1('0x9')]=_0x39cc66[_0x68e1('0x9')];this[_0x68e1('0xa')]=_0x39cc66[_0x68e1('0xa')];this[_0x68e1('0xb')]=_0x39cc66[_0x68e1('0xb')];this[_0x68e1('0xc')]=_0x39cc66[_0x68e1('0xc')];this[_0x68e1('0xd')]=_0x39cc66[_0x68e1('0xd')];this['queue']=_0x39cc66[_0x68e1('0x4')];this[_0x68e1('0xe')]=_0x39cc66[_0x68e1('0xf')];this[_0x68e1('0x10')]=_0x39cc66['number'];this[_0x68e1('0x11')]=_0x39cc66[_0x68e1('0x11')];this[_0x68e1('0x12')]=_0x39cc66[_0x68e1('0x12')];this['endtime']=_0x39cc66[_0x68e1('0x12')];this[_0x68e1('0x13')]=utils['getSeconds'](_0x39cc66[_0x68e1('0x12')],_0x39cc66[_0x68e1('0x11')]);this['holdtime']=0x0;this[_0x68e1('0x14')]=0x0;this[_0x68e1('0x15')]=_0x39cc66[_0x68e1('0x15')];this[_0x68e1('0x16')]=_0x39cc66['callbackuniqueid'];this[_0x68e1('0x17')]=_0x39cc66[_0x68e1('0x17')];this[_0x68e1('0x18')]=_0x39cc66[_0x68e1('0x18')];this[_0x68e1('0x19')]=_0x39cc66[_0x68e1('0x19')];this['ListId']=_0x39cc66['ListId'];this['UserId']=_0x39cc66[_0x68e1('0x1a')];this['VoiceQueueId']=_0x39cc66[_0x68e1('0x1b')];this[_0x68e1('0x1c')]=_0x39cc66['CampaignId'];this[_0x68e1('0x1d')]=_0x39cc66['originatecalleridnum']||'';this[_0x68e1('0x1e')]=_0x39cc66[_0x68e1('0x1e')]||'';this['state']=_0x39cc66['state'];this[_0x68e1('0x1f')]=_0x39cc66[_0x68e1('0x1f')];}module['exports']=History; \ No newline at end of file +var _0x9b76=['calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry'];(function(_0x543349,_0x8f9924){var _0x2f87da=function(_0x25be61){while(--_0x25be61){_0x543349['push'](_0x543349['shift']());}};_0x2f87da(++_0x8f9924);}(_0x9b76,0x66));var _0x69b7=function(_0x110724,_0x3c0fa0){_0x110724=_0x110724-0x0;var _0x1c5bc6=_0x9b76[_0x110724];return _0x1c5bc6;};'use strict';var utils=require(_0x69b7('0x0'));function History(_0xdc263){this[_0x69b7('0x1')]=_0xdc263[_0x69b7('0x1')];this[_0x69b7('0x2')]=_0xdc263[_0x69b7('0x2')]||undefined;this[_0x69b7('0x3')]=_0xdc263[_0x69b7('0x3')];this[_0x69b7('0x4')]=_0xdc263[_0x69b7('0x3')]==='outbound'?_0x69b7('0x5'):_0xdc263[_0x69b7('0x3')];this[_0x69b7('0x6')]=_0xdc263[_0x69b7('0x6')];this[_0x69b7('0x7')]=_0xdc263[_0x69b7('0x7')];this[_0x69b7('0x8')]=_0xdc263['countnoanswerretry'];this[_0x69b7('0x9')]=_0xdc263['countbusyretry']+_0xdc263[_0x69b7('0x7')]+_0xdc263['countnoanswerretry']+_0xdc263['countnosuchnumberretry']+_0xdc263[_0x69b7('0xa')]+_0xdc263[_0x69b7('0xb')]+_0xdc263['countmachineretry']+_0xdc263['countagentrejectretry'];this[_0x69b7('0xc')]=_0xdc263[_0x69b7('0xc')];this['countdropretry']=_0xdc263[_0x69b7('0xa')];this[_0x69b7('0xb')]=_0xdc263['countabandonedretry'];this[_0x69b7('0xd')]=_0xdc263[_0x69b7('0xd')];this[_0x69b7('0xe')]=_0xdc263[_0x69b7('0xe')];this[_0x69b7('0x5')]=_0xdc263[_0x69b7('0x5')];this[_0x69b7('0xf')]=_0xdc263[_0x69b7('0x10')];this[_0x69b7('0x11')]=_0xdc263[_0x69b7('0x12')];this[_0x69b7('0x13')]=_0xdc263[_0x69b7('0x13')];this['responsetime']=_0xdc263[_0x69b7('0x14')];this[_0x69b7('0x15')]=_0xdc263[_0x69b7('0x14')];this[_0x69b7('0x16')]=utils[_0x69b7('0x17')](_0xdc263[_0x69b7('0x14')],_0xdc263[_0x69b7('0x13')]);this['holdtime']=0x0;this[_0x69b7('0x18')]=0x0;this[_0x69b7('0x19')]=_0xdc263[_0x69b7('0x19')];this[_0x69b7('0x1a')]=_0xdc263[_0x69b7('0x1a')];this['callbackat']=_0xdc263[_0x69b7('0x1b')];this[_0x69b7('0x1c')]=_0xdc263[_0x69b7('0x1c')];this[_0x69b7('0x1d')]=_0xdc263[_0x69b7('0x1d')];this[_0x69b7('0x1e')]=_0xdc263[_0x69b7('0x1e')];this[_0x69b7('0x1f')]=_0xdc263[_0x69b7('0x1f')];this['VoiceQueueId']=_0xdc263[_0x69b7('0x20')];this[_0x69b7('0x21')]=_0xdc263[_0x69b7('0x21')];this[_0x69b7('0x22')]=_0xdc263[_0x69b7('0x22')]||'';this[_0x69b7('0x23')]=_0xdc263[_0x69b7('0x23')]||'';this[_0x69b7('0x24')]=_0xdc263[_0x69b7('0x24')];this[_0x69b7('0x25')]=_0xdc263[_0x69b7('0x25')];}module[_0x69b7('0x26')]=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 43c9779..9e2dbcd 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 _0x64f4=['getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','dropreason'];(function(_0x3599f0,_0x3000e0){var _0xa9a4f5=function(_0x14bfa0){while(--_0x14bfa0){_0x3599f0['push'](_0x3599f0['shift']());}};_0xa9a4f5(++_0x3000e0);}(_0x64f4,0xd6));var _0x464f=function(_0x204a2f,_0x4a215b){_0x204a2f=_0x204a2f-0x0;var _0x42d057=_0x64f4[_0x204a2f];return _0x42d057;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x5c8662,_0x22a047){this[_0x464f('0x0')]=_0x5c8662['scheduledat'];this['type']=_0x5c8662[_0x464f('0x1')];this['campaigntype']=_0x5c8662[_0x464f('0x1')]===_0x464f('0x2')?_0x464f('0x3'):_0x5c8662['type'];this['countbusyretry']=_0x5c8662['countbusyretry'];this[_0x464f('0x4')]=_0x5c8662[_0x464f('0x4')];this[_0x464f('0x5')]=_0x5c8662[_0x464f('0x5')];this[_0x464f('0x6')]=_0x5c8662[_0x464f('0x7')]+_0x5c8662[_0x464f('0x4')]+_0x5c8662['countnoanswerretry']+_0x5c8662['countnosuchnumberretry']+_0x5c8662[_0x464f('0x8')]+_0x5c8662[_0x464f('0x9')]+_0x5c8662[_0x464f('0xa')]+_0x5c8662[_0x464f('0xb')];this[_0x464f('0xc')]=_0x5c8662[_0x464f('0xc')];this[_0x464f('0x8')]=_0x5c8662[_0x464f('0x8')];this[_0x464f('0x9')]=_0x5c8662[_0x464f('0x9')];this[_0x464f('0xa')]=_0x5c8662['countmachineretry'];this['countagentrejectretry']=_0x5c8662[_0x464f('0xb')];this['uniqueid']=_0x22a047[_0x464f('0xd')];this['calleridname']=_0x5c8662['name'];this[_0x464f('0xe')]=_0x5c8662[_0x464f('0xf')];this['starttime']=_0x5c8662[_0x464f('0x10')];this[_0x464f('0x11')]=_0x5c8662['responsetime'];this[_0x464f('0x12')]=_0x5c8662[_0x464f('0x12')];this[_0x464f('0x13')]=_0x5c8662[_0x464f('0x13')];this['endtime']=this[_0x464f('0x12')];this['ringtime']=utils[_0x464f('0x14')](_0x5c8662['responsetime'],_0x5c8662[_0x464f('0x10')]);this[_0x464f('0x15')]=utils['getSeconds'](this['droptime'],_0x5c8662['responsetime']);this[_0x464f('0x16')]=0x0;this['queue']=_0x22a047['queue'];this[_0x464f('0x17')]=_0x22a047['connectedlinename'];this[_0x464f('0x18')]=_0x22a047[_0x464f('0x18')];this[_0x464f('0x19')]=_0x5c8662[_0x464f('0x19')];this[_0x464f('0x1a')]=_0x5c8662[_0x464f('0x1a')];this[_0x464f('0x1b')]=_0x5c8662['callbackat'];this[_0x464f('0x1c')]=_0x5c8662['recallme'];this[_0x464f('0x1d')]=_0x5c8662[_0x464f('0x1d')];this[_0x464f('0x1e')]=_0x5c8662[_0x464f('0x1e')];this[_0x464f('0x1f')]=_0x5c8662[_0x464f('0x1f')];this[_0x464f('0x20')]=_0x5c8662[_0x464f('0x20')];this[_0x464f('0x21')]=_0x5c8662[_0x464f('0x21')];this[_0x464f('0x22')]=_0x5c8662['originatecalleridnum']||'';this[_0x464f('0x23')]=_0x5c8662[_0x464f('0x23')]||'';this[_0x464f('0x24')]=_0x5c8662[_0x464f('0x24')];this['state']=_0x5c8662['state'];this[_0x464f('0x25')]=_0x5c8662[_0x464f('0x25')];}module[_0x464f('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x0d64=['name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x2d8eac,_0x4d2f89){var _0x4af6a7=function(_0x1519da){while(--_0x1519da){_0x2d8eac['push'](_0x2d8eac['shift']());}};_0x4af6a7(++_0x4d2f89);}(_0x0d64,0x17d));var _0x40d6=function(_0x1fa569,_0x3f0440){_0x1fa569=_0x1fa569-0x0;var _0x5c9730=_0x0d64[_0x1fa569];return _0x5c9730;};'use strict';var utils=require(_0x40d6('0x0'));function QueueCallerAbandon(_0x260006,_0x1f4f85){this['scheduledat']=_0x260006[_0x40d6('0x1')];this[_0x40d6('0x2')]=_0x260006[_0x40d6('0x2')];this[_0x40d6('0x3')]=_0x260006['type']==='outbound'?_0x40d6('0x4'):_0x260006[_0x40d6('0x2')];this[_0x40d6('0x5')]=_0x260006[_0x40d6('0x5')];this['countcongestionretry']=_0x260006[_0x40d6('0x6')];this['countnoanswerretry']=_0x260006[_0x40d6('0x7')];this[_0x40d6('0x8')]=_0x260006[_0x40d6('0x5')]+_0x260006[_0x40d6('0x6')]+_0x260006[_0x40d6('0x7')]+_0x260006[_0x40d6('0x9')]+_0x260006[_0x40d6('0xa')]+_0x260006[_0x40d6('0xb')]+_0x260006[_0x40d6('0xc')]+_0x260006['countagentrejectretry'];this['countnosuchnumberretry']=_0x260006[_0x40d6('0x9')];this[_0x40d6('0xa')]=_0x260006[_0x40d6('0xa')];this[_0x40d6('0xb')]=_0x260006['countabandonedretry'];this[_0x40d6('0xc')]=_0x260006[_0x40d6('0xc')];this[_0x40d6('0xd')]=_0x260006['countagentrejectretry'];this[_0x40d6('0xe')]=_0x1f4f85[_0x40d6('0xe')];this['calleridname']=_0x260006[_0x40d6('0xf')];this[_0x40d6('0x10')]=_0x260006[_0x40d6('0x11')];this[_0x40d6('0x12')]=_0x260006['starttime'];this[_0x40d6('0x13')]=_0x260006['responsetime'];this[_0x40d6('0x14')]=_0x260006['droptime'];this[_0x40d6('0x15')]=_0x260006[_0x40d6('0x15')];this[_0x40d6('0x16')]=this[_0x40d6('0x14')];this[_0x40d6('0x17')]=utils[_0x40d6('0x18')](_0x260006[_0x40d6('0x13')],_0x260006[_0x40d6('0x12')]);this['holdtime']=utils[_0x40d6('0x18')](this[_0x40d6('0x14')],_0x260006['responsetime']);this[_0x40d6('0x19')]=0x0;this[_0x40d6('0x4')]=_0x1f4f85[_0x40d6('0x4')];this[_0x40d6('0x1a')]=_0x1f4f85[_0x40d6('0x1b')];this[_0x40d6('0x1c')]=_0x1f4f85[_0x40d6('0x1c')];this[_0x40d6('0x1d')]=_0x260006[_0x40d6('0x1d')];this[_0x40d6('0x1e')]=_0x260006[_0x40d6('0x1e')];this[_0x40d6('0x1f')]=_0x260006[_0x40d6('0x1f')];this['recallme']=_0x260006[_0x40d6('0x20')];this[_0x40d6('0x21')]=_0x260006[_0x40d6('0x21')];this['ListId']=_0x260006[_0x40d6('0x22')];this[_0x40d6('0x23')]=_0x260006[_0x40d6('0x23')];this[_0x40d6('0x24')]=_0x260006[_0x40d6('0x24')];this[_0x40d6('0x25')]=_0x260006[_0x40d6('0x25')];this[_0x40d6('0x26')]=_0x260006['originatecalleridnum']||'';this[_0x40d6('0x27')]=_0x260006[_0x40d6('0x27')]||'';this['agiafterat']=_0x260006[_0x40d6('0x28')];this['state']=_0x260006[_0x40d6('0x29')];this[_0x40d6('0x2a')]=_0x260006[_0x40d6('0x2a')];}module[_0x40d6('0x2b')]=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 4e57600..b097a91 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 _0x2d72=['checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','[getContactDialer]','catch','error','[getContactDialerIvr]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]'];(function(_0x1411cd,_0x4d11b4){var _0x4e3d51=function(_0x317ce7){while(--_0x317ce7){_0x1411cd['push'](_0x1411cd['shift']());}};_0x4e3d51(++_0x4d11b4);}(_0x2d72,0xa8));var _0x22d7=function(_0x27b546,_0x3918e7){_0x27b546=_0x27b546-0x0;var _0x401cd2=_0x2d72[_0x27b546];return _0x401cd2;};'use strict';var util=require(_0x22d7('0x0'));var logger=require(_0x22d7('0x1'))(_0x22d7('0x2'));var cmHopper=require(_0x22d7('0x3'));var cmHopperAdditionalPhone=require(_0x22d7('0x4'));var cmHopperBlack=require(_0x22d7('0x5'));var cmHopperHistory=require(_0x22d7('0x6'));function inspectError(_0x1738ec){return util[_0x22d7('0x7')](_0x1738ec,{'showHidden':![],'depth':null});}function getContactDialer(_0xfd6d11,_0x17cfba,_0x3f5982){return cmHopper[_0x22d7('0x8')](_0xfd6d11['id'],_0x17cfba,_0x3f5982,_0xfd6d11[_0x22d7('0x9')])['catch'](function(_0x23a731){_0xfd6d11[_0x22d7('0xa')]=0x0;logger['error'](_0x22d7('0xb'),inspectError(_0x23a731));});}exports[_0x22d7('0x8')]=getContactDialer;function getContactDialerIvr(_0x1c6aaf,_0x3c694f){return cmHopper['getContactDialerIvr'](_0x1c6aaf['id'],_0x3c694f,_0x1c6aaf['dialOrderByScheduledAt'])[_0x22d7('0xc')](function(_0x257c85){_0x1c6aaf[_0x22d7('0xa')]=0x0;logger[_0x22d7('0xd')](_0x22d7('0xe'),inspectError(_0x257c85));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x47cec1){return cmHopper[_0x22d7('0xf')](_0x47cec1)['catch'](function(_0x3b725c){logger[_0x22d7('0xd')]('[countReScheduled]',inspectError(_0x3b725c));});}exports[_0x22d7('0xf')]=countReScheduled;function rescheduleContact(_0x1e107f){return cmHopper[_0x22d7('0x10')](_0x1e107f)[_0x22d7('0xc')](function(_0x1c5c19){logger[_0x22d7('0xd')](_0x22d7('0x11'),inspectError(_0x1c5c19));});}exports[_0x22d7('0x10')]=rescheduleContact;function unlockContact(_0x534223,_0x352a78,_0x442ce4){return cmHopper[_0x22d7('0x12')](_0x534223,_0x352a78,_0x442ce4)['catch'](function(_0x4d2210){logger['error'](_0x22d7('0x13'),inspectError(_0x4d2210));});}exports[_0x22d7('0x12')]=unlockContact;function moveContactManagedDialer(_0xac2233){return cmHopper[_0x22d7('0x14')](_0xac2233)[_0x22d7('0xc')](function(_0x5b32c0){logger[_0x22d7('0xd')](_0x22d7('0x15'),inspectError(_0x5b32c0));});}exports[_0x22d7('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x5ac2f7){return cmHopperBlack[_0x22d7('0x16')](_0x5ac2f7)[_0x22d7('0xc')](function(_0x3574e4){logger[_0x22d7('0xd')](_0x22d7('0x17'),inspectError(_0x3574e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x5e03d5){return cmHopperBlack[_0x22d7('0x18')](_0x5e03d5)[_0x22d7('0xc')](function(_0x21635e){logger[_0x22d7('0xd')]('[checkIsBlackListIvr]',inspectError(_0x21635e));});}exports[_0x22d7('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x141220,_0x1b7760,_0x5b6502){return cmHopperAdditionalPhone[_0x22d7('0x19')](_0x141220,_0x1b7760,_0x5b6502)['catch'](function(_0x219507){logger[_0x22d7('0xd')](_0x22d7('0x1a'),inspectError(_0x219507));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x183d73,_0x5e4c87,_0x582fe6){return cmHopperAdditionalPhone[_0x22d7('0x1b')](_0x183d73,_0x5e4c87,_0x582fe6)[_0x22d7('0xc')](function(_0x1720f0){logger[_0x22d7('0xd')](_0x22d7('0x1c'),inspectError(_0x1720f0));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x7181dc){return cmHopperHistory[_0x22d7('0x1d')](_0x7181dc)[_0x22d7('0xc')](function(_0xce7f15){logger[_0x22d7('0xd')]('[avgHandleTime]',inspectError(_0xce7f15));});}exports[_0x22d7('0x1d')]=avgHandleTime;function createHistory(_0x2ec96b){return cmHopperHistory[_0x22d7('0x1e')](_0x2ec96b)[_0x22d7('0xc')](function(_0x539ba0){logger[_0x22d7('0xd')](_0x22d7('0x1f'),inspectError(_0x539ba0));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x4fb4=['moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]'];(function(_0x3db762,_0x60d6c1){var _0x366888=function(_0xcfbb77){while(--_0xcfbb77){_0x3db762['push'](_0x3db762['shift']());}};_0x366888(++_0x60d6c1);}(_0x4fb4,0x190));var _0x44fb=function(_0x44ba4a,_0x449f7c){_0x44ba4a=_0x44ba4a-0x0;var _0x5c8cd4=_0x4fb4[_0x44ba4a];return _0x5c8cd4;};'use strict';var util=require('util');var logger=require(_0x44fb('0x0'))(_0x44fb('0x1'));var cmHopper=require(_0x44fb('0x2'));var cmHopperAdditionalPhone=require(_0x44fb('0x3'));var cmHopperBlack=require(_0x44fb('0x4'));var cmHopperHistory=require(_0x44fb('0x5'));function inspectError(_0x53ee5d){return util[_0x44fb('0x6')](_0x53ee5d,{'showHidden':![],'depth':null});}function getContactDialer(_0x953327,_0x308b96,_0x26fbd6){return cmHopper[_0x44fb('0x7')](_0x953327['id'],_0x308b96,_0x26fbd6,_0x953327[_0x44fb('0x8')])[_0x44fb('0x9')](function(_0x2a4d75){_0x953327['temp']=0x0;logger[_0x44fb('0xa')](_0x44fb('0xb'),inspectError(_0x2a4d75));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x42fcc2,_0x3d9002){return cmHopper[_0x44fb('0xc')](_0x42fcc2['id'],_0x3d9002,_0x42fcc2[_0x44fb('0x8')])[_0x44fb('0x9')](function(_0x44c83b){_0x42fcc2[_0x44fb('0xd')]=0x0;logger[_0x44fb('0xa')](_0x44fb('0xe'),inspectError(_0x44c83b));});}exports[_0x44fb('0xc')]=getContactDialerIvr;function countReScheduled(_0x4b202d){return cmHopper[_0x44fb('0xf')](_0x4b202d)[_0x44fb('0x9')](function(_0x40cb86){logger[_0x44fb('0xa')](_0x44fb('0x10'),inspectError(_0x40cb86));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x1fc8fa){return cmHopper[_0x44fb('0x11')](_0x1fc8fa)[_0x44fb('0x9')](function(_0x449150){logger[_0x44fb('0xa')]('[rescheduleContact]',inspectError(_0x449150));});}exports[_0x44fb('0x11')]=rescheduleContact;function unlockContact(_0x18268c,_0x472658,_0x147fe0){return cmHopper[_0x44fb('0x12')](_0x18268c,_0x472658,_0x147fe0)[_0x44fb('0x9')](function(_0x19b828){logger['error'](_0x44fb('0x13'),inspectError(_0x19b828));});}exports[_0x44fb('0x12')]=unlockContact;function moveContactManagedDialer(_0x2e0efd){return cmHopper[_0x44fb('0x14')](_0x2e0efd)[_0x44fb('0x9')](function(_0x22c2eb){logger[_0x44fb('0xa')](_0x44fb('0x15'),inspectError(_0x22c2eb));});}exports[_0x44fb('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1fc48c){return cmHopperBlack['checkIsBlackList'](_0x1fc48c)['catch'](function(_0x4b50f5){logger[_0x44fb('0xa')](_0x44fb('0x16'),inspectError(_0x4b50f5));});}exports[_0x44fb('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x544647){return cmHopperBlack[_0x44fb('0x18')](_0x544647)[_0x44fb('0x9')](function(_0x3394e2){logger['error']('[checkIsBlackListIvr]',inspectError(_0x3394e2));});}exports[_0x44fb('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5cf7ec,_0x441d79,_0x4fc66d){return cmHopperAdditionalPhone[_0x44fb('0x19')](_0x5cf7ec,_0x441d79,_0x4fc66d)[_0x44fb('0x9')](function(_0x1f3d5c){logger['error']('[verifyAdditionalPhone]',inspectError(_0x1f3d5c));});}exports[_0x44fb('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xa50a49,_0x1c831e,_0x733c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xa50a49,_0x1c831e,_0x733c)[_0x44fb('0x9')](function(_0x3a7cd1){logger['error']('[swapAdditionalPhone]',inspectError(_0x3a7cd1));});}exports[_0x44fb('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x2611d6){return cmHopperHistory[_0x44fb('0x1b')](_0x2611d6)[_0x44fb('0x9')](function(_0xb7e5e8){logger[_0x44fb('0xa')](_0x44fb('0x1c'),inspectError(_0xb7e5e8));});}exports[_0x44fb('0x1b')]=avgHandleTime;function createHistory(_0x6bd0b4){return cmHopperHistory['createHistory'](_0x6bd0b4)['catch'](function(_0x587984){logger[_0x44fb('0xa')]('[createHistory]',inspectError(_0x587984));});}exports[_0x44fb('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 0d24a72..f7c5baa 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 _0x2a97=['lodash','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','seconds','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','getQueueCampaignStatusMessage','talking','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','undefined','length','XMD-','toUpperCase','substring','setXMDContactVariables'];(function(_0x474b9d,_0x3ad817){var _0x19ddf7=function(_0x567943){while(--_0x567943){_0x474b9d['push'](_0x474b9d['shift']());}};_0x19ddf7(++_0x3ad817);}(_0x2a97,0xfc));var _0x72a9=function(_0x189d8b,_0xea974d){_0x189d8b=_0x189d8b-0x0;var _0x46b577=_0x2a97[_0x189d8b];return _0x46b577;};'use strict';var _=require(_0x72a9('0x0'));var moment=require('moment');var util=require(_0x72a9('0x1'));var logger=require(_0x72a9('0x2'))(_0x72a9('0x3'));var timezones=require('../../../../config/environment/shared')[_0x72a9('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x72a9('0x5'),'BLACKLIST':_0x72a9('0x6'),'CONTACTS_RESCHEDULED':_0x72a9('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x72a9('0x8'),'EMPTY_INTERVAL':_0x72a9('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x72a9('0xa'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x72a9('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0x72a9('0xc'),'QUEUE_RECALL':_0x72a9('0xd'),'RECALL_TIMEOUT':_0x72a9('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x72a9('0xf'),'UNREACHABLE_TRUNK':_0x72a9('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x57753e){return _0x57753e[_0x72a9('0x11')]===_0x72a9('0x12');}exports[_0x72a9('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x1f3414){return _0x1f3414[_0x72a9('0x14')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x436eef){return _0x436eef['type']===_0x72a9('0x15');}exports[_0x72a9('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x1c37b1){return _0x1c37b1[_0x72a9('0x17')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x16ac88){return _0x16ac88[_0x72a9('0x18')];}exports[_0x72a9('0x19')]=isIVRCampaignActive;function getSeconds(_0x23da1e,_0xc6e511){var _0x27480c=moment(_0x23da1e)['milliseconds'](0x0);var _0xae6d1b=moment(_0xc6e511)['milliseconds'](0x0);return _0x27480c['diff'](_0xae6d1b,_0x72a9('0x1a'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x66391b,_0x11a99b){var _0x296f48=![];var _0x322f3f=_0x66391b[_0x72a9('0x11')]!==_0x11a99b[_0x72a9('0x11')]||_0x66391b[_0x72a9('0x17')]!==_0x11a99b['dialActive']||_0x66391b[_0x72a9('0x1b')]!==_0x11a99b[_0x72a9('0x1b')];var _0x4b04dd=_0x66391b[_0x72a9('0x1c')]!==_0x11a99b[_0x72a9('0x1c')]||_0x66391b['loggedIn']!==_0x11a99b[_0x72a9('0x1d')]||_0x66391b[_0x72a9('0x1e')]!==_0x11a99b[_0x72a9('0x1e')]||_0x66391b[_0x72a9('0x1f')]!==_0x11a99b[_0x72a9('0x1f')]||_0x66391b['talking']!==_0x11a99b['talking']||_0x66391b['pTalking']!==_0x11a99b[_0x72a9('0x20')]||_0x66391b[_0x72a9('0x21')]!==_0x11a99b['waiting']||_0x66391b[_0x72a9('0x22')]!==_0x11a99b[_0x72a9('0x22')]||_0x66391b[_0x72a9('0x23')]!==_0x11a99b['originated'];if(_0x66391b[_0x72a9('0x24')]&&_0x11a99b[_0x72a9('0x24')]){_0x296f48=_0x66391b['Trunk'][_0x72a9('0x25')]!==_0x11a99b[_0x72a9('0x24')][_0x72a9('0x25')]||_0x66391b['Trunk']['active']!==_0x11a99b['Trunk'][_0x72a9('0x18')];}return _0x322f3f||_0x4b04dd||_0x296f48;}exports[_0x72a9('0x26')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5728ab){var _0x5a9da6=null;var _0x48d3dc=_0x5728ab[_0x72a9('0x27')];if(_[_0x72a9('0x28')](_0x5728ab[_0x72a9('0x29')])||_[_0x72a9('0x28')](_0x5728ab[_0x72a9('0x2a')])||_[_0x72a9('0x28')](_0x5728ab[_0x72a9('0x2a')][_0x72a9('0x2b')])){_0x5a9da6=CAMPAIGN_STATUS[_0x72a9('0x2c')];}else if(_[_0x72a9('0x2d')](_0x5728ab['dialGlobalInterval'])||_[_0x72a9('0x2d')](_0x5728ab[_0x72a9('0x2a')][_0x72a9('0x2b')])){_0x5a9da6=CAMPAIGN_STATUS[_0x72a9('0x2e')];}else if(_0x48d3dc&&!timezones[_0x48d3dc]){_0x5a9da6=CAMPAIGN_STATUS[_0x72a9('0x2f')];}return _0x5a9da6;}function checkAnyValidTrunk(_0x1bf898,_0x17c2bf){var _0x41555f=null;var _0x2cf3c1=_0x72a9('0x30');var _0x587ca6=[_0x72a9('0x31'),_0x72a9('0x32')];var _0x3ecc22=!![];if(_0x1bf898[_0x72a9('0x24')]&&_0x1bf898[_0x72a9('0x24')]['active']){_0x2cf3c1+=_0x1bf898['Trunk'][_0x72a9('0x25')];_0x41555f=_0x17c2bf[_0x2cf3c1];_0x3ecc22=_0x587ca6[_0x72a9('0x33')](_0x41555f[_0x72a9('0x34')]);}else if(_0x1bf898[_0x72a9('0x35')]&&_0x1bf898[_0x72a9('0x35')][_0x72a9('0x18')]){_0x2cf3c1+=_0x1bf898[_0x72a9('0x35')]['name'];_0x41555f=_0x17c2bf[_0x2cf3c1];_0x3ecc22=_0x587ca6['includes'](_0x41555f['status']);}return _0x3ecc22;}function getQueueCampaignStatusMessage(_0x630de3,_0x1a3754){var _0x25213b=CAMPAIGN_STATUS[_0x72a9('0x5')];var _0xf5ce4e=isPreviewCampaign(_0x630de3);if(!isQueueCampaignActive(_0x630de3)){if(_0xf5ce4e){_0x25213b=CAMPAIGN_STATUS[_0x72a9('0x36')];}else{if(_0x630de3[_0x72a9('0x23')]===0x0&&_0x630de3['talking']===0x0&&_0x630de3[_0x72a9('0x21')]===0x0&&(_0x630de3['pTalking']||0x0)===0x0){_0x25213b=CAMPAIGN_STATUS[_0x72a9('0x36')];}else{_0x25213b=CAMPAIGN_STATUS[_0x72a9('0x37')];}}}else if(_0x630de3[_0x72a9('0x1d')]===0x0){_0x25213b=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x630de3,_0x1a3754)){_0x25213b=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x630de3)){var _0x26210f=checkAnyValidQueueCampaignInterval(_0x630de3);if(_0x26210f){_0x25213b=_0x26210f;}}return _0x25213b;}exports[_0x72a9('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x42531d){var _0x56d57e=CAMPAIGN_STATUS[_0x72a9('0x37')];if(_0x42531d[_0x72a9('0x23')]===0x0&&_0x42531d[_0x72a9('0x39')]===0x0&&_0x42531d[_0x72a9('0x21')]===0x0&&(_0x42531d['pTalking']||0x0)===0x0){_0x56d57e=CAMPAIGN_STATUS[_0x72a9('0x36')];}return _0x56d57e;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x47f5fe){var _0x46ffae=_0x47f5fe[_0x72a9('0x3a')](/"(.*?)"/);return _0x46ffae?_0x46ffae[0x1]:_0x47f5fe;}exports[_0x72a9('0x3b')]=extractCalleridName;function getCallerId(_0x351934,_0x4fa834,_0x31f541){if(!_[_0x72a9('0x3c')](_0x31f541)&&typeof _0x31f541===_0x72a9('0x3d')&&!_[_0x72a9('0x2d')](_0x31f541)){if(!_[_0x72a9('0x3c')](_0x4fa834)&&typeof _0x4fa834===_0x72a9('0x3d')&&!_[_0x72a9('0x2d')](_0x4fa834)){return util['format'](_0x72a9('0x3e'),_0x4fa834,_0x31f541);}return util[_0x72a9('0x3f')](_0x72a9('0x3e'),_0x31f541,_0x31f541);}if(!_[_0x72a9('0x3c')](_0x351934)&&typeof _0x351934===_0x72a9('0x3d')&&!_[_0x72a9('0x2d')](_0x351934)){return _0x351934;}return _0x72a9('0x40');}exports[_0x72a9('0x41')]=getCallerId;function getCallerIdRandom(_0x56803b,_0x32d7ee){var _0x491ee6;var _0x5a5424;var _0x457a20;if(_0x32d7ee<=0x0){_0x32d7ee=0x1;}_0x491ee6=new RegExp(_0x72a9('0x42')+_0x32d7ee+'}$');_0x5a5424=Math[_0x72a9('0x43')](0xa,_0x32d7ee-0x1);_0x457a20=Math[_0x72a9('0x43')](0xa,_0x32d7ee)-0x1;return util[_0x72a9('0x3f')]('%s',_[_0x72a9('0x44')](_0x56803b,_0x491ee6,_[_0x72a9('0x45')](_0x5a5424,_0x457a20)[_0x72a9('0x46')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x509b6e,_0x67d3c0){if(_0x509b6e['originated']&&_0x509b6e[_0x72a9('0x23')]>0x0){_0x509b6e[_0x72a9('0x23')]-=0x1;}else{logger[_0x72a9('0x47')](_0x72a9('0x48'),_0x67d3c0);}}exports[_0x72a9('0x49')]=decrementOriginate;function checkContactEmpty(_0x488f5b){return _0x488f5b&&_0x488f5b['length']>0x0;}exports[_0x72a9('0x4a')]=checkContactEmpty;function erlangb(_0x3e2c7,_0x120b1b){if(_0x120b1b===0x0){return 0x0;}var _0x202d01=0x1;for(var _0x123995=0x1;_0x123995<=_0x120b1b;_0x123995+=0x1){_0x202d01=0x1+_0x202d01*_0x123995/_0x3e2c7;}return 0x1/_0x202d01;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x19f2ec,_0x55fff0,_0x343793){if(_0x55fff0>_0x343793){for(var _0x13d31d=0x0;_0x13d31d<_0x55fff0-_0x343793;_0x13d31d+=0x1){decrementOriginate(_0x19f2ec,_0x72a9('0x4b'));}}}exports[_0x72a9('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x37af9f){var _0x534b87={};var _0x5b7da8=['id',_0x72a9('0x4d'),'tags','updatedAt'];const _0xc09c86=0xfa;if(_0x37af9f){for(var _0x213c7b in _0x37af9f){if(typeof _0x37af9f[_0x213c7b]!==_0x72a9('0x4e')){if(!_[_0x72a9('0x28')](_0x37af9f[_0x213c7b])&&!_0x5b7da8['includes'](_0x213c7b)){if(_0x213c7b==='description'&&_0x37af9f[_0x213c7b][_0x72a9('0x4f')]>_0xc09c86){_0x534b87[_0x72a9('0x50')+_0x213c7b[_0x72a9('0x51')]()]=_0x37af9f[_0x213c7b][_0x72a9('0x46')]()[_0x72a9('0x52')](0x0,_0xc09c86);}else{_0x534b87[_0x72a9('0x50')+_0x213c7b[_0x72a9('0x51')]()]=_0x37af9f[_0x213c7b];}}}}}return _0x534b87;}exports[_0x72a9('0x53')]=setXMDContactVariables; \ No newline at end of file +var _0x99d0=['SIP/','reachable','unmonitored','includes','TrunkBackup','INACTIVE','pTalking','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isIVRCampaign','isOutboundQueue','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','talking','waiting','inUse','originated','Trunk','name','active','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','Intervals','EMPTY_INTERVAL'];(function(_0x45064a,_0x224c45){var _0x1a5483=function(_0x274f52){while(--_0x274f52){_0x45064a['push'](_0x45064a['shift']());}};_0x1a5483(++_0x224c45);}(_0x99d0,0x7b));var _0x099d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x99d0[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x099d('0x0'));var moment=require(_0x099d('0x1'));var util=require(_0x099d('0x2'));var logger=require(_0x099d('0x3'))(_0x099d('0x4'));var timezones=require(_0x099d('0x5'))[_0x099d('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x099d('0x7'),'BLACKLIST':_0x099d('0x8'),'CONTACTS_RESCHEDULED':_0x099d('0x9'),'DEACTIVATED':_0x099d('0xa'),'DISACTIVED':_0x099d('0xb'),'EMPTY_INTERVAL':_0x099d('0xc'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x099d('0xd'),'NO_AVAILABLE_CONTACTS':_0x099d('0xe'),'NULL_INTERVAL':_0x099d('0xf'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x099d('0x10'),'QUEUE_RECALL':_0x099d('0x11'),'RECALL_TIMEOUT':_0x099d('0x12'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x099d('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x19ded3){return _0x19ded3[_0x099d('0x14')]===_0x099d('0x15');}exports[_0x099d('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x5be93f){return _0x5be93f[_0x099d('0x17')]==='ivr';}exports[_0x099d('0x18')]=isIVRCampaign;function isOutboundQueue(_0x31bbef){return _0x31bbef[_0x099d('0x17')]==='outbound';}exports[_0x099d('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0xfe53ad){return _0xfe53ad['dialActive'];}exports[_0x099d('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0xa4e4a3){return _0xa4e4a3['active'];}exports[_0x099d('0x1b')]=isIVRCampaignActive;function getSeconds(_0x3ec8cf,_0x276a10){var _0x2f918c=moment(_0x3ec8cf)['milliseconds'](0x0);var _0x39f13e=moment(_0x276a10)[_0x099d('0x1c')](0x0);return _0x2f918c[_0x099d('0x1d')](_0x39f13e,'seconds');}exports[_0x099d('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0xf65a08,_0x50346e){var _0x3c458a=![];var _0x1c00c9=_0xf65a08[_0x099d('0x14')]!==_0x50346e[_0x099d('0x14')]||_0xf65a08['dialActive']!==_0x50346e['dialActive']||_0xf65a08[_0x099d('0x1f')]!==_0x50346e[_0x099d('0x1f')];var _0x3502f6=_0xf65a08[_0x099d('0x20')]!==_0x50346e['available']||_0xf65a08[_0x099d('0x21')]!==_0x50346e[_0x099d('0x21')]||_0xf65a08[_0x099d('0x22')]!==_0x50346e[_0x099d('0x22')]||_0xf65a08['paused']!==_0x50346e['paused']||_0xf65a08['talking']!==_0x50346e[_0x099d('0x23')]||_0xf65a08['pTalking']!==_0x50346e['pTalking']||_0xf65a08[_0x099d('0x24')]!==_0x50346e[_0x099d('0x24')]||_0xf65a08['inUse']!==_0x50346e[_0x099d('0x25')]||_0xf65a08[_0x099d('0x26')]!==_0x50346e[_0x099d('0x26')];if(_0xf65a08[_0x099d('0x27')]&&_0x50346e[_0x099d('0x27')]){_0x3c458a=_0xf65a08[_0x099d('0x27')][_0x099d('0x28')]!==_0x50346e[_0x099d('0x27')][_0x099d('0x28')]||_0xf65a08[_0x099d('0x27')][_0x099d('0x29')]!==_0x50346e[_0x099d('0x27')][_0x099d('0x29')];}return _0x1c00c9||_0x3502f6||_0x3c458a;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3aa2a4){var _0x254ba2=null;var _0xa43ab=_0x3aa2a4[_0x099d('0x2a')];if(_[_0x099d('0x2b')](_0x3aa2a4[_0x099d('0x2c')])||_[_0x099d('0x2b')](_0x3aa2a4['Interval'])||_['isNil'](_0x3aa2a4[_0x099d('0x2d')]['Intervals'])){_0x254ba2=CAMPAIGN_STATUS[_0x099d('0x2e')];}else if(_['isEmpty'](_0x3aa2a4[_0x099d('0x2c')])||_['isEmpty'](_0x3aa2a4[_0x099d('0x2d')][_0x099d('0x2f')])){_0x254ba2=CAMPAIGN_STATUS[_0x099d('0x30')];}else if(_0xa43ab&&!timezones[_0xa43ab]){_0x254ba2=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x254ba2;}function checkAnyValidTrunk(_0x2d5238,_0x35ca07){var _0x3bc741=null;var _0x4e7f0d=_0x099d('0x31');var _0x8115b9=[_0x099d('0x32'),_0x099d('0x33')];var _0x2a4536=!![];if(_0x2d5238['Trunk']&&_0x2d5238[_0x099d('0x27')][_0x099d('0x29')]){_0x4e7f0d+=_0x2d5238['Trunk']['name'];_0x3bc741=_0x35ca07[_0x4e7f0d];_0x2a4536=_0x8115b9[_0x099d('0x34')](_0x3bc741['status']);}else if(_0x2d5238[_0x099d('0x35')]&&_0x2d5238[_0x099d('0x35')][_0x099d('0x29')]){_0x4e7f0d+=_0x2d5238['TrunkBackup'][_0x099d('0x28')];_0x3bc741=_0x35ca07[_0x4e7f0d];_0x2a4536=_0x8115b9[_0x099d('0x34')](_0x3bc741['status']);}return _0x2a4536;}function getQueueCampaignStatusMessage(_0x21adf2,_0x29882a){var _0x4d2f05=CAMPAIGN_STATUS[_0x099d('0x7')];var _0x357cf1=isPreviewCampaign(_0x21adf2);if(!isQueueCampaignActive(_0x21adf2)){if(_0x357cf1){_0x4d2f05=CAMPAIGN_STATUS[_0x099d('0x36')];}else{if(_0x21adf2[_0x099d('0x26')]===0x0&&_0x21adf2[_0x099d('0x23')]===0x0&&_0x21adf2['waiting']===0x0&&(_0x21adf2[_0x099d('0x37')]||0x0)===0x0){_0x4d2f05=CAMPAIGN_STATUS[_0x099d('0x36')];}else{_0x4d2f05=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x21adf2['loggedIn']===0x0){_0x4d2f05=CAMPAIGN_STATUS[_0x099d('0x38')];}else if(!checkAnyValidTrunk(_0x21adf2,_0x29882a)){_0x4d2f05=CAMPAIGN_STATUS[_0x099d('0x39')];}else if(!isPreviewCampaign(_0x21adf2)){var _0x54cd9d=checkAnyValidQueueCampaignInterval(_0x21adf2);if(_0x54cd9d){_0x4d2f05=_0x54cd9d;}}return _0x4d2f05;}exports[_0x099d('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4675e1){var _0x253de2=CAMPAIGN_STATUS[_0x099d('0x3b')];if(_0x4675e1['originated']===0x0&&_0x4675e1[_0x099d('0x23')]===0x0&&_0x4675e1[_0x099d('0x24')]===0x0&&(_0x4675e1[_0x099d('0x37')]||0x0)===0x0){_0x253de2=CAMPAIGN_STATUS[_0x099d('0x36')];}return _0x253de2;}exports[_0x099d('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x200a46){var _0x466b71=_0x200a46[_0x099d('0x3d')](/"(.*?)"/);return _0x466b71?_0x466b71[0x1]:_0x200a46;}exports[_0x099d('0x3e')]=extractCalleridName;function getCallerId(_0x2bd97f,_0xbae5ef,_0x1da01f){if(!_[_0x099d('0x3f')](_0x1da01f)&&typeof _0x1da01f===_0x099d('0x40')&&!_[_0x099d('0x41')](_0x1da01f)){if(!_[_0x099d('0x3f')](_0xbae5ef)&&typeof _0xbae5ef===_0x099d('0x40')&&!_[_0x099d('0x41')](_0xbae5ef)){return util[_0x099d('0x42')](_0x099d('0x43'),_0xbae5ef,_0x1da01f);}return util[_0x099d('0x42')](_0x099d('0x43'),_0x1da01f,_0x1da01f);}if(!_[_0x099d('0x3f')](_0x2bd97f)&&typeof _0x2bd97f===_0x099d('0x40')&&!_[_0x099d('0x41')](_0x2bd97f)){return _0x2bd97f;}return _0x099d('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x48456e,_0x2211ff){var _0x461306;var _0x1f00ee;var _0x3bd54b;if(_0x2211ff<=0x0){_0x2211ff=0x1;}_0x461306=new RegExp(_0x099d('0x45')+_0x2211ff+'}$');_0x1f00ee=Math[_0x099d('0x46')](0xa,_0x2211ff-0x1);_0x3bd54b=Math[_0x099d('0x46')](0xa,_0x2211ff)-0x1;return util[_0x099d('0x42')]('%s',_[_0x099d('0x47')](_0x48456e,_0x461306,_[_0x099d('0x48')](_0x1f00ee,_0x3bd54b)[_0x099d('0x49')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x3b4663,_0x846028){if(_0x3b4663[_0x099d('0x26')]&&_0x3b4663[_0x099d('0x26')]>0x0){_0x3b4663[_0x099d('0x26')]-=0x1;}else{logger[_0x099d('0x4a')](_0x099d('0x4b'),_0x846028);}}exports[_0x099d('0x4c')]=decrementOriginate;function checkContactEmpty(_0x1a6e95){return _0x1a6e95&&_0x1a6e95[_0x099d('0x4d')]>0x0;}exports[_0x099d('0x4e')]=checkContactEmpty;function erlangb(_0x76b699,_0x4984e7){if(_0x4984e7===0x0){return 0x0;}var _0x432bd0=0x1;for(var _0x521cf4=0x1;_0x521cf4<=_0x4984e7;_0x521cf4+=0x1){_0x432bd0=0x1+_0x432bd0*_0x521cf4/_0x76b699;}return 0x1/_0x432bd0;}exports[_0x099d('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x474817,_0x528f93,_0x1c4f4c){if(_0x528f93>_0x1c4f4c){for(var _0x4c2136=0x0;_0x4c2136<_0x528f93-_0x1c4f4c;_0x4c2136+=0x1){decrementOriginate(_0x474817,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0x099d('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4a19aa){var _0x4177f1={};var _0x20c6be=['id','createdAt',_0x099d('0x51'),_0x099d('0x52')];const _0x486fc2=0xfa;if(_0x4a19aa){for(var _0x5c2be8 in _0x4a19aa){if(typeof _0x4a19aa[_0x5c2be8]!=='undefined'){if(!_[_0x099d('0x2b')](_0x4a19aa[_0x5c2be8])&&!_0x20c6be['includes'](_0x5c2be8)){if(_0x5c2be8==='description'&&_0x4a19aa[_0x5c2be8][_0x099d('0x4d')]>_0x486fc2){_0x4177f1[_0x099d('0x53')+_0x5c2be8[_0x099d('0x54')]()]=_0x4a19aa[_0x5c2be8][_0x099d('0x49')]()['substring'](0x0,_0x486fc2);}else{_0x4177f1[_0x099d('0x53')+_0x5c2be8['toUpperCase']()]=_0x4a19aa[_0x5c2be8];}}}}}return _0x4177f1;}exports[_0x099d('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f0a1261..23a110c 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(_0x513e24,_0x22d1c9){var _0x25f3ac=function(_0x38914a){while(--_0x38914a){_0x513e24['push'](_0x513e24['shift']());}};_0x25f3ac(++_0x22d1c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x594609,_0x30836c){var _0x1550ff=function(_0x3514eb){while(--_0x3514eb){_0x594609['push'](_0x594609['shift']());}};_0x1550ff(++_0x30836c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 8e70df8..6a5f61d 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 _0x08f8=['Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','uuid','tiff2pdf','../../../config/logger','fax','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','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','execute','%s/%s.tif','dir','XMF-PATH'];(function(_0x12df55,_0x24a2cf){var _0x2e2b72=function(_0x18c9ee){while(--_0x18c9ee){_0x12df55['push'](_0x12df55['shift']());}};_0x2e2b72(++_0x24a2cf);}(_0x08f8,0x15f));var _0x808f=function(_0x30f9d3,_0x57a007){_0x30f9d3=_0x30f9d3-0x0;var _0x2427e8=_0x08f8[_0x30f9d3];return _0x2427e8;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x808f('0x0'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x808f('0x1'));var gs=require('./util/gs');var logger=require(_0x808f('0x2'))(_0x808f('0x3'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x808f('0x4'));var Action=require(_0x808f('0x5'));var faxAccount=require(_0x808f('0x6'));var attachment=require(_0x808f('0x7'));var faxMessage=require(_0x808f('0x8'));function Fax(_0x3cdf4f){this[_0x808f('0x9')]={};this[_0x808f('0xa')]=_0x3cdf4f[_0x808f('0xa')];this[_0x808f('0xb')]=_0x3cdf4f[_0x808f('0xb')];this['actions']={};ami['on'](_0x808f('0xc'),this['syncNewchannel'][_0x808f('0xd')](this));ami['on'](_0x808f('0xe'),this[_0x808f('0xf')][_0x808f('0xd')](this));ami['on'](_0x808f('0x10'),this[_0x808f('0x11')][_0x808f('0xd')](this));ami['on'](_0x808f('0x12'),this['syncNewExten'][_0x808f('0xd')](this));ami['on'](_0x808f('0x13'),this[_0x808f('0x14')][_0x808f('0xd')](this));ami['on'](_0x808f('0x15'),this[_0x808f('0x16')][_0x808f('0xd')](this));ami['on'](_0x808f('0x17'),this[_0x808f('0x18')][_0x808f('0xd')](this));ami['on'](_0x808f('0x19'),this[_0x808f('0x1a')][_0x808f('0xd')](this));}Fax[_0x808f('0x1b')]['syncNewchannel']=function(_0x910924){if(_0x910924['context']===_0x808f('0x1c')){for(var _0x2227d9 in this[_0x808f('0xa')]){if(this[_0x808f('0xa')][_0x808f('0x1d')](_0x2227d9)){if(_0x910924['exten']===this['faxAccounts'][_0x2227d9][_0x808f('0x1e')]){this['channels'][_0x910924['uniqueid']]={};this[_0x808f('0x9')][_0x910924['uniqueid']][_0x808f('0x1f')]=_0x910924[_0x808f('0x1f')];this[_0x808f('0x9')][_0x910924['uniqueid']]['id']=this['faxAccounts'][_0x2227d9]['id'];this[_0x808f('0x9')][_0x910924[_0x808f('0x20')]]['name']=this[_0x808f('0xa')][_0x2227d9][_0x808f('0x21')];logger[_0x808f('0x22')](_0x910924[_0x808f('0x20')],_0x808f('0x23'));}}}}if(this[_0x808f('0x24')][_0x910924[_0x808f('0x20')]]){this[_0x808f('0x9')][_0x910924[_0x808f('0x20')]]={};this[_0x808f('0x9')][_0x910924[_0x808f('0x20')]]['channel']=_0x910924[_0x808f('0x1f')];logger[_0x808f('0x22')](_0x910924[_0x808f('0x20')],_0x808f('0x23'));}};Fax['prototype'][_0x808f('0xf')]=function(_0x5ddab2){if(this['channels'][_0x5ddab2[_0x808f('0x20')]]){for(var _0x61abec in _0x5ddab2[_0x808f('0x25')]){if(_0x5ddab2[_0x808f('0x25')][_0x808f('0x1d')](_0x61abec)){this[_0x808f('0x9')][_0x5ddab2['uniqueid']][_0x61abec]=_0x5ddab2['value'];}}}};Fax['prototype'][_0x808f('0x11')]=function(_0x28e2b4){if(this[_0x808f('0x9')][_0x28e2b4[_0x808f('0x20')]]){this[_0x808f('0x9')][_0x28e2b4[_0x808f('0x20')]][_0x808f('0x26')]=_0x28e2b4[_0x808f('0x26')];this['channels'][_0x28e2b4[_0x808f('0x20')]][_0x808f('0x27')]=_0x28e2b4['channelstatedesc'];}};Fax['prototype'][_0x808f('0x28')]=function(_0x446fda){if(this[_0x808f('0x9')][_0x446fda['uniqueid']]){for(var _0x2acd02 in _0x446fda[_0x808f('0x25')]){if(_0x446fda['variable']['hasOwnProperty'](_0x2acd02)){this[_0x808f('0x9')][_0x446fda[_0x808f('0x20')]][_0x2acd02]=_0x446fda['value'];}}}};Fax['prototype'][_0x808f('0x14')]=function(_0x24ccc6){if(this['channels'][_0x24ccc6[_0x808f('0x20')]]){this[_0x808f('0x9')][_0x24ccc6[_0x808f('0x20')]][_0x808f('0x29')]=_0x24ccc6[_0x808f('0x29')];this[_0x808f('0x9')][_0x24ccc6[_0x808f('0x20')]][_0x808f('0x2a')]=_0x24ccc6['status'];this['channels'][_0x24ccc6[_0x808f('0x20')]][_0x808f('0x1e')]=_0x24ccc6[_0x808f('0x1e')];this[_0x808f('0x9')][_0x24ccc6[_0x808f('0x20')]][_0x808f('0x2b')]=_0x24ccc6[_0x808f('0x2b')];logger[_0x808f('0x22')](_0x24ccc6[_0x808f('0x20')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x1b6bf3){var _0x39fe5f=this;if(this[_0x808f('0x9')][_0x1b6bf3[_0x808f('0x20')]]){var _0x42a994=this[_0x808f('0x9')][_0x1b6bf3[_0x808f('0x20')]]['id'];this['channels'][_0x1b6bf3[_0x808f('0x20')]][_0x808f('0x2c')]=_0x1b6bf3[_0x808f('0x2c')];this[_0x808f('0x9')][_0x1b6bf3[_0x808f('0x20')]][_0x808f('0x2d')]=_0x1b6bf3[_0x808f('0x2d')];this[_0x808f('0x9')][_0x1b6bf3['uniqueid']]['localstationid']=_0x1b6bf3[_0x808f('0x1e')];this[_0x808f('0x9')][_0x1b6bf3[_0x808f('0x20')]][_0x808f('0x2e')]=_0x1b6bf3['resolution'];this[_0x808f('0x9')][_0x1b6bf3[_0x808f('0x20')]][_0x808f('0x2f')]=_0x1b6bf3[_0x808f('0x2f')];this[_0x808f('0x9')][_0x1b6bf3['uniqueid']][_0x808f('0x2b')]=_0x1b6bf3[_0x808f('0x2b')];this[_0x808f('0x9')][_0x1b6bf3['uniqueid']][_0x808f('0x30')]=_0x1b6bf3['calleridnum'];if(this['channels'][_0x1b6bf3[_0x808f('0x20')]][_0x808f('0x2d')]>0x0){tiff2pdf(_0x1b6bf3[_0x808f('0x2b')],'/var/opt/motion2/server/files/attachments/',function(_0x3435dc){logger[_0x808f('0x22')](_0x1b6bf3[_0x808f('0x20')],_0x808f('0x31'),_0x3435dc[_0x808f('0x32')]);attachment[_0x808f('0x33')]({'name':path[_0x808f('0x34')](_0x1b6bf3[_0x808f('0x2b')])['name'],'basename':path[_0x808f('0x34')](_0x1b6bf3['filename'])[_0x808f('0x21')]+'.pdf','type':_0x808f('0x35')})[_0x808f('0x36')](function(_0x4ce355){faxAccount[_0x808f('0x37')](_0x42a994,{'from':_0x1b6bf3[_0x808f('0x30')],'mapKey':_0x808f('0x3'),'body':path[_0x808f('0x34')](_0x1b6bf3[_0x808f('0x2b')])['name']+_0x808f('0x38'),'AttachmentId':_0x4ce355['id']})[_0x808f('0x39')](function(_0x174e3b){logger['error'](_0x1b6bf3[_0x808f('0x20')],_0x808f('0x3a'),JSON[_0x808f('0x3b')](_0x174e3b));});})[_0x808f('0x39')](function(_0x1eba4e){logger[_0x808f('0x3c')](_0x1b6bf3[_0x808f('0x20')],_0x808f('0x3d'),JSON['stringify'](_0x1eba4e));});});}logger['info'](_0x1b6bf3[_0x808f('0x20')],_0x808f('0x3d'));}};Fax[_0x808f('0x1b')][_0x808f('0x1a')]=function(_0x3ea3e4){if(this[_0x808f('0x24')][_0x3ea3e4[_0x808f('0x20')]]){_['merge'](this[_0x808f('0x9')][_0x3ea3e4[_0x808f('0x20')]],_[_0x808f('0x3e')](_0x3ea3e4,[_0x808f('0x3f'),_0x808f('0x40')]));}};function updateStatus(_0x287d54){if(_0x287d54['AttachmentId']){faxMessage[_0x808f('0x41')](_0x287d54[_0x808f('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x808f('0x36')](function(_0x3e20b4){ut[_0x808f('0x43')](_0x808f('0x44'),_0x3e20b4);})[_0x808f('0x39')](function(_0x331ef0){ut[_0x808f('0x43')]('[Fax][Message][Error][NoUpdate1]',_0x331ef0);});}else{ut[_0x808f('0x43')](_0x808f('0x45'));}}Fax['prototype']['updateStatus']=function(_0x259539,_0xe03c2c,_0x48eece){var _0x329651=this;var _0x1ee983={};if(_0xe03c2c){_0x1ee983={'read':_0xe03c2c};}else{_0x1ee983={'failMessage':_0x48eece};}if(this['actions'][_0x259539][_0x808f('0x42')]){faxMessage[_0x808f('0x41')](this[_0x808f('0x24')][_0x259539][_0x808f('0x42')],_0x1ee983)['then'](function(_0x18b329){ut['logger'](_0x808f('0x46'),_0x18b329);})[_0x808f('0x39')](function(_0x404600){ut[_0x808f('0x43')](_0x808f('0x47'),_0x404600);})[_0x808f('0x48')](function(){delete _0x329651[_0x808f('0x9')][_0x259539];delete _0x329651['actions'][_0x259539];});}else{ut[_0x808f('0x43')](_0x808f('0x49'));this[_0x808f('0x4a')](_0x259539);delete this['actions'][_0x259539];}};Fax[_0x808f('0x1b')][_0x808f('0x18')]=function(_0x1e24b1){var _0x1b21f3=this;if(this['channels'][_0x1e24b1[_0x808f('0x20')]]){if(this[_0x808f('0x24')][_0x1e24b1[_0x808f('0x20')]]){this[_0x808f('0x9')][_0x1e24b1[_0x808f('0x20')]]['id']=this['actions'][_0x1e24b1[_0x808f('0x20')]]['id'];this['channels'][_0x1e24b1[_0x808f('0x20')]][_0x808f('0x21')]=this['actions'][_0x1e24b1[_0x808f('0x20')]][_0x808f('0x21')];}logger['info'](_0x1e24b1['uniqueid'],this[_0x808f('0x24')][_0x1e24b1[_0x808f('0x20')]]?_0x808f('0x4b'):'\x20hangup\x20faxRiceive\x20',JSON[_0x808f('0x3b')](this['channels'][_0x1e24b1[_0x808f('0x20')]]));if(this['actions'][_0x1e24b1[_0x808f('0x20')]]){if(this[_0x808f('0x9')][_0x1e24b1['uniqueid']][_0x808f('0x4c')]>0x0&&this['channels'][_0x1e24b1[_0x808f('0x20')]][_0x808f('0x13')]===_0x808f('0x4d')){this['updateStatus'](_0x1e24b1[_0x808f('0x20')],!![]);}else{this[_0x808f('0x4e')](_0x1e24b1[_0x808f('0x20')],![],this[_0x808f('0x9')][_0x1e24b1[_0x808f('0x20')]]['faxstatusstring']?_0x808f('0x4f')+this[_0x808f('0x9')][_0x1e24b1[_0x808f('0x20')]][_0x808f('0x50')]:_0x808f('0x51'));}}}};Fax['prototype'][_0x808f('0x52')]=function(_0x5eb055){var _0x5bf593=this;return new BPromise(function(_0x4dcaf2,_0x1ca483){_0x5bf593[_0x808f('0x53')](_0x5eb055,_0x5bf593[_0x808f('0xa')][_0x5eb055[_0x808f('0x54')]])[_0x808f('0x36')](function(_0x28390a){ut[_0x808f('0x43')](_0x808f('0x55'),_0x28390a);_0x4dcaf2(ut[_0x808f('0x32')]('Fax\x20received'));})['catch'](function(_0x2dcf70){ut['logger'](_0x808f('0x56'),_0x2dcf70);updateStatus(_0x5eb055);_0x1ca483(ut[_0x808f('0x32')](_0x808f('0x57')));});});};Fax[_0x808f('0x1b')]['checkAfterSend']=function(_0x1a8ba4){var _0x28ca04=this;return new BPromise(function(_0x3e72f8,_0x15ae1d){var _0x53da94=_0x28ca04[_0x808f('0x58')](_0x28ca04[_0x808f('0xa')][_0x1a8ba4['FaxAccountId']][_0x808f('0x59')],_0x1a8ba4);if(_0x53da94['isValid']){_0x3e72f8(ut['message']('Trunk\x20Reachable'));}else{_0x15ae1d(ut[_0x808f('0x32')](_0x53da94['message']));}});};function originate(_0xbb09bb,_0x1d9fd2,_0x51d477){return new BPromise(function(_0x1764af,_0x1e9931){if(_0x51d477){var _0x4db7b3=util[_0x808f('0x5a')](_0x808f('0x5b'),path[_0x808f('0x34')](_0xbb09bb[_0x808f('0x5c')])[_0x808f('0x21')],_0xbb09bb[_0x808f('0x5c')]);gs[_0x808f('0x5d')](_0x4db7b3)[_0x808f('0x36')](function(){_0xbb09bb[_0x808f('0x5c')]=util['format'](_0x808f('0x5e'),path[_0x808f('0x34')](_0xbb09bb[_0x808f('0x5c')])[_0x808f('0x5f')],path['parse'](_0xbb09bb[_0x808f('0x5c')])[_0x808f('0x21')]);_0x1d9fd2[_0x808f('0x60')]=_0xbb09bb[_0x808f('0x5c')];ut[_0x808f('0x43')]('Convert\x20pdf\x20to\x20tif','');ami[_0x808f('0x61')](ut['variablesAction'](_0xbb09bb,_0x1d9fd2))[_0x808f('0x36')](function(_0x5be3c9){_0x1764af(_0x5be3c9);})[_0x808f('0x39')](function(_0x234bba){_0x1e9931(_0x234bba);});})[_0x808f('0x39')](function(_0x37ec98){_0x1e9931(_0x37ec98);});}else{ami[_0x808f('0x61')](ut[_0x808f('0x62')](_0xbb09bb,_0x1d9fd2))[_0x808f('0x36')](function(_0x45bd13){_0x1764af(_0x45bd13);})[_0x808f('0x39')](function(_0x363d57){_0x1e9931(_0x363d57);});}});}Fax[_0x808f('0x1b')]['execOriginate']=function(_0x1e3d97,_0x309a41){var _0x3fb9f9=this;return new BPromise(function(_0x1c8108,_0x3f564f){var _0x5c8004=uuid['v4']();var _0xc75ede=ut[_0x808f('0x63')](_0x1e3d97,_0x309a41);_0x3fb9f9[_0x808f('0x24')][_0x5c8004]=new Action(_0x5c8004,_0x309a41,_0x1e3d97);var _0x5ae730=_0x3fb9f9[_0x808f('0x24')][_0x5c8004];if(path[_0x808f('0x34')](_0x1e3d97[_0x808f('0x5c')])['ext']===_0x808f('0x38')){originate(_0x5ae730,_0xc75ede,!![])['then'](function(_0x3b6b87){_0x1c8108(_0x3b6b87);})['catch'](function(_0x36df5b){_0x3f564f(_0x36df5b);});}else{originate(_0x5ae730,_0xc75ede,![])[_0x808f('0x36')](function(_0x252a8d){_0x1c8108(_0x252a8d);})[_0x808f('0x39')](function(_0x3749a2){_0x3f564f(_0x3749a2);});}});};Fax['prototype'][_0x808f('0x64')]=function(_0x1d58d8){return!_['isNil'](_0x1d58d8)&&!_['isNil'](_0x1d58d8[_0x808f('0x21')])&&!_[_0x808f('0x65')](_0x1d58d8[_0x808f('0x66')])&&_0x1d58d8[_0x808f('0x66')]&&!_['isNil'](this['trunks'][util['format'](_0x808f('0x67'),_0x1d58d8[_0x808f('0x21')])])&&!_['isNil'](this[_0x808f('0xb')][util[_0x808f('0x5a')](_0x808f('0x67'),_0x1d58d8['name'])][_0x808f('0x2a')])&&(this[_0x808f('0xb')][util[_0x808f('0x5a')]('SIP/%s',_0x1d58d8[_0x808f('0x21')])][_0x808f('0x2a')]===_0x808f('0x68')||this[_0x808f('0xb')][util[_0x808f('0x5a')]('SIP/%s',_0x1d58d8[_0x808f('0x21')])][_0x808f('0x2a')]==='unmonitored');};Fax[_0x808f('0x1b')][_0x808f('0x58')]=function(_0x53a715,_0x4ccbc9){if(!this[_0x808f('0x64')](_0x53a715)){ut[_0x808f('0x43')](_0x808f('0x69'),_[_0x808f('0x65')](_0x53a715)?'':_0x53a715[_0x808f('0x21')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x808f('0x6a')};}if(_[_0x808f('0x65')](_0x4ccbc9[_0x808f('0x3')])){ut[_0x808f('0x43')](_0x808f('0x6b'),JSON[_0x808f('0x3b')](_0x4ccbc9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x808f('0x65')](_0x4ccbc9[_0x808f('0x5c')])){ut[_0x808f('0x43')](_0x808f('0x6c'),JSON[_0x808f('0x3b')](_0x4ccbc9));return{'isValid':![],'message':_0x808f('0x6d')};}return{'isValid':!![],'message':_0x808f('0x6e')};};Fax['prototype'][_0x808f('0x4a')]=function(_0x189ea8,_0x861726=0x2710){if(this[_0x808f('0x9')][_0x189ea8]){setTimeout(()=>{delete this[_0x808f('0x9')][_0x189ea8];},_0x861726);}};module[_0x808f('0x6f')]=Fax; \ No newline at end of file +var _0xb8a8=['bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','parse','path','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20path','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','faxAccounts','trunks','syncNewchannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8a8,0x1bb));var _0x8b8a=function(_0x58e350,_0x3eaaac){_0x58e350=_0x58e350-0x0;var _0x1410b6=_0xb8a8[_0x58e350];return _0x1410b6;};'use strict';var util=require(_0x8b8a('0x0'));var _=require(_0x8b8a('0x1'));var BPromise=require(_0x8b8a('0x2'));var uuid=require('uuid');var moment=require(_0x8b8a('0x3'));var path=require('path');var tiff2pdf=require(_0x8b8a('0x4'));var gs=require(_0x8b8a('0x5'));var logger=require(_0x8b8a('0x6'))(_0x8b8a('0x7'));var ami=require(_0x8b8a('0x8'));var rpcDb=require(_0x8b8a('0x9'));var Channel=require(_0x8b8a('0xa'));var ut=require(_0x8b8a('0xb'));var Action=require(_0x8b8a('0xc'));var faxAccount=require(_0x8b8a('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x3ad5ac){this['channels']={};this[_0x8b8a('0xe')]=_0x3ad5ac[_0x8b8a('0xe')];this[_0x8b8a('0xf')]=_0x3ad5ac['trunks'];this['actions']={};ami['on']('newchannel',this[_0x8b8a('0x10')][_0x8b8a('0x11')](this));ami['on'](_0x8b8a('0x12'),this[_0x8b8a('0x13')]['bind'](this));ami['on'](_0x8b8a('0x14'),this['syncNewState']['bind'](this));ami['on'](_0x8b8a('0x15'),this[_0x8b8a('0x16')][_0x8b8a('0x11')](this));ami['on'](_0x8b8a('0x17'),this[_0x8b8a('0x18')]['bind'](this));ami['on'](_0x8b8a('0x19'),this[_0x8b8a('0x1a')]['bind'](this));ami['on']('hangup',this[_0x8b8a('0x1b')][_0x8b8a('0x11')](this));ami['on']('originateresponse',this[_0x8b8a('0x1c')][_0x8b8a('0x11')](this));}Fax[_0x8b8a('0x1d')][_0x8b8a('0x10')]=function(_0x2a52ee){if(_0x2a52ee[_0x8b8a('0x1e')]===_0x8b8a('0x1f')){for(var _0x19ad3d in this['faxAccounts']){if(this[_0x8b8a('0xe')]['hasOwnProperty'](_0x19ad3d)){if(_0x2a52ee[_0x8b8a('0x20')]===this[_0x8b8a('0xe')][_0x19ad3d]['localstationid']){this[_0x8b8a('0x21')][_0x2a52ee[_0x8b8a('0x22')]]={};this[_0x8b8a('0x21')][_0x2a52ee['uniqueid']]['channel']=_0x2a52ee[_0x8b8a('0x23')];this[_0x8b8a('0x21')][_0x2a52ee[_0x8b8a('0x22')]]['id']=this[_0x8b8a('0xe')][_0x19ad3d]['id'];this[_0x8b8a('0x21')][_0x2a52ee[_0x8b8a('0x22')]]['name']=this[_0x8b8a('0xe')][_0x19ad3d][_0x8b8a('0x24')];logger[_0x8b8a('0x25')](_0x2a52ee[_0x8b8a('0x22')],_0x8b8a('0x26'));}}}}if(this[_0x8b8a('0x27')][_0x2a52ee['uniqueid']]){this[_0x8b8a('0x21')][_0x2a52ee[_0x8b8a('0x22')]]={};this['channels'][_0x2a52ee[_0x8b8a('0x22')]][_0x8b8a('0x23')]=_0x2a52ee[_0x8b8a('0x23')];logger['info'](_0x2a52ee[_0x8b8a('0x22')],_0x8b8a('0x26'));}};Fax[_0x8b8a('0x1d')][_0x8b8a('0x13')]=function(_0xb30866){if(this[_0x8b8a('0x21')][_0xb30866[_0x8b8a('0x22')]]){for(var _0x3c3837 in _0xb30866[_0x8b8a('0x28')]){if(_0xb30866[_0x8b8a('0x28')][_0x8b8a('0x29')](_0x3c3837)){this[_0x8b8a('0x21')][_0xb30866[_0x8b8a('0x22')]][_0x3c3837]=_0xb30866['value'];}}}};Fax[_0x8b8a('0x1d')][_0x8b8a('0x2a')]=function(_0x5ddc00){if(this[_0x8b8a('0x21')][_0x5ddc00[_0x8b8a('0x22')]]){this[_0x8b8a('0x21')][_0x5ddc00[_0x8b8a('0x22')]][_0x8b8a('0x2b')]=_0x5ddc00[_0x8b8a('0x2b')];this[_0x8b8a('0x21')][_0x5ddc00[_0x8b8a('0x22')]][_0x8b8a('0x2c')]=_0x5ddc00[_0x8b8a('0x2c')];}};Fax[_0x8b8a('0x1d')]['syncNewExten']=function(_0x100bfc){if(this[_0x8b8a('0x21')][_0x100bfc[_0x8b8a('0x22')]]){for(var _0x1e86ee in _0x100bfc['variable']){if(_0x100bfc['variable'][_0x8b8a('0x29')](_0x1e86ee)){this['channels'][_0x100bfc[_0x8b8a('0x22')]][_0x1e86ee]=_0x100bfc['value'];}}}};Fax[_0x8b8a('0x1d')][_0x8b8a('0x18')]=function(_0x290197){if(this[_0x8b8a('0x21')][_0x290197['uniqueid']]){this[_0x8b8a('0x21')][_0x290197[_0x8b8a('0x22')]][_0x8b8a('0x2d')]=_0x290197[_0x8b8a('0x2d')];this[_0x8b8a('0x21')][_0x290197[_0x8b8a('0x22')]]['status']=_0x290197[_0x8b8a('0x2e')];this[_0x8b8a('0x21')][_0x290197[_0x8b8a('0x22')]]['localstationid']=_0x290197[_0x8b8a('0x2f')];this[_0x8b8a('0x21')][_0x290197['uniqueid']]['filename']=_0x290197[_0x8b8a('0x30')];logger[_0x8b8a('0x25')](_0x290197[_0x8b8a('0x22')],_0x8b8a('0x31'));}};Fax[_0x8b8a('0x1d')][_0x8b8a('0x1a')]=function(_0x7d8d9e){var _0x1515d2=this;if(this['channels'][_0x7d8d9e[_0x8b8a('0x22')]]){var _0x4fe3d8=this[_0x8b8a('0x21')][_0x7d8d9e[_0x8b8a('0x22')]]['id'];this[_0x8b8a('0x21')][_0x7d8d9e[_0x8b8a('0x22')]][_0x8b8a('0x32')]=_0x7d8d9e[_0x8b8a('0x32')];this[_0x8b8a('0x21')][_0x7d8d9e[_0x8b8a('0x22')]]['pagestransferred']=_0x7d8d9e[_0x8b8a('0x33')];this[_0x8b8a('0x21')][_0x7d8d9e['uniqueid']][_0x8b8a('0x2f')]=_0x7d8d9e[_0x8b8a('0x2f')];this['channels'][_0x7d8d9e[_0x8b8a('0x22')]][_0x8b8a('0x34')]=_0x7d8d9e[_0x8b8a('0x34')];this[_0x8b8a('0x21')][_0x7d8d9e['uniqueid']][_0x8b8a('0x35')]=_0x7d8d9e[_0x8b8a('0x35')];this[_0x8b8a('0x21')][_0x7d8d9e[_0x8b8a('0x22')]][_0x8b8a('0x30')]=_0x7d8d9e[_0x8b8a('0x30')];this[_0x8b8a('0x21')][_0x7d8d9e[_0x8b8a('0x22')]][_0x8b8a('0x36')]=_0x7d8d9e[_0x8b8a('0x36')];if(this[_0x8b8a('0x21')][_0x7d8d9e[_0x8b8a('0x22')]][_0x8b8a('0x33')]>0x0){tiff2pdf(_0x7d8d9e[_0x8b8a('0x30')],_0x8b8a('0x37'),function(_0x37a640){logger[_0x8b8a('0x25')](_0x7d8d9e[_0x8b8a('0x22')],_0x8b8a('0x38'),_0x37a640[_0x8b8a('0x39')]);attachment[_0x8b8a('0x3a')]({'name':path['parse'](_0x7d8d9e[_0x8b8a('0x30')])[_0x8b8a('0x24')],'basename':path['parse'](_0x7d8d9e[_0x8b8a('0x30')])[_0x8b8a('0x24')]+_0x8b8a('0x3b'),'type':_0x8b8a('0x3c')})[_0x8b8a('0x3d')](function(_0x4f1ca8){faxAccount[_0x8b8a('0x3e')](_0x4fe3d8,{'from':_0x7d8d9e[_0x8b8a('0x36')],'mapKey':_0x8b8a('0x7'),'body':path['parse'](_0x7d8d9e[_0x8b8a('0x30')])[_0x8b8a('0x24')]+_0x8b8a('0x3b'),'AttachmentId':_0x4f1ca8['id']})[_0x8b8a('0x3f')](function(_0x14b104){logger[_0x8b8a('0x40')](_0x7d8d9e['uniqueid'],'\x20notify\x20',JSON['stringify'](_0x14b104));});})[_0x8b8a('0x3f')](function(_0x228596){logger[_0x8b8a('0x40')](_0x7d8d9e[_0x8b8a('0x22')],_0x8b8a('0x41'),JSON['stringify'](_0x228596));});});}logger['info'](_0x7d8d9e[_0x8b8a('0x22')],'\x20receiveFax\x20');}};Fax[_0x8b8a('0x1d')][_0x8b8a('0x1c')]=function(_0x1e62fd){if(this[_0x8b8a('0x27')][_0x1e62fd[_0x8b8a('0x22')]]){_[_0x8b8a('0x42')](this['channels'][_0x1e62fd[_0x8b8a('0x22')]],_[_0x8b8a('0x43')](_0x1e62fd,[_0x8b8a('0x44'),_0x8b8a('0x45')]));}};function updateStatus(_0x332860){if(_0x332860[_0x8b8a('0x46')]){faxMessage[_0x8b8a('0x47')](_0x332860['AttachmentId'],{'failMessage':_0x8b8a('0x48')})[_0x8b8a('0x3d')](function(_0xaf28a1){ut[_0x8b8a('0x49')](_0x8b8a('0x4a'),_0xaf28a1);})[_0x8b8a('0x3f')](function(_0x3ad35c){ut[_0x8b8a('0x49')](_0x8b8a('0x4b'),_0x3ad35c);});}else{ut[_0x8b8a('0x49')](_0x8b8a('0x4c'));}}Fax[_0x8b8a('0x1d')][_0x8b8a('0x4d')]=function(_0x165362,_0x4fc69e,_0x2c4e79){var _0x5d327b=this;var _0x3d44b0={};if(_0x4fc69e){_0x3d44b0={'read':_0x4fc69e};}else{_0x3d44b0={'failMessage':_0x2c4e79};}if(this[_0x8b8a('0x27')][_0x165362][_0x8b8a('0x46')]){faxMessage[_0x8b8a('0x47')](this[_0x8b8a('0x27')][_0x165362][_0x8b8a('0x46')],_0x3d44b0)[_0x8b8a('0x3d')](function(_0x434851){ut[_0x8b8a('0x49')]('[Fax][Message][Updated]',_0x434851);})[_0x8b8a('0x3f')](function(_0x41a328){ut[_0x8b8a('0x49')]('[Fax][Message][NoUpdate1]',_0x41a328);})[_0x8b8a('0x4e')](function(){delete _0x5d327b['channels'][_0x165362];delete _0x5d327b['actions'][_0x165362];});}else{ut[_0x8b8a('0x49')](_0x8b8a('0x4f'));this[_0x8b8a('0x50')](_0x165362);delete this[_0x8b8a('0x27')][_0x165362];}};Fax[_0x8b8a('0x1d')][_0x8b8a('0x1b')]=function(_0x2d6bda){var _0x2ccfbd=this;if(this[_0x8b8a('0x21')][_0x2d6bda['uniqueid']]){if(this[_0x8b8a('0x27')][_0x2d6bda[_0x8b8a('0x22')]]){this[_0x8b8a('0x21')][_0x2d6bda[_0x8b8a('0x22')]]['id']=this[_0x8b8a('0x27')][_0x2d6bda[_0x8b8a('0x22')]]['id'];this[_0x8b8a('0x21')][_0x2d6bda['uniqueid']][_0x8b8a('0x24')]=this['actions'][_0x2d6bda[_0x8b8a('0x22')]][_0x8b8a('0x24')];}logger['info'](_0x2d6bda[_0x8b8a('0x22')],this[_0x8b8a('0x27')][_0x2d6bda[_0x8b8a('0x22')]]?_0x8b8a('0x51'):_0x8b8a('0x52'),JSON[_0x8b8a('0x53')](this['channels'][_0x2d6bda[_0x8b8a('0x22')]]));if(this[_0x8b8a('0x27')][_0x2d6bda[_0x8b8a('0x22')]]){if(this['channels'][_0x2d6bda[_0x8b8a('0x22')]]['faxpages']>0x0&&this['channels'][_0x2d6bda[_0x8b8a('0x22')]][_0x8b8a('0x17')]===_0x8b8a('0x54')){this[_0x8b8a('0x4d')](_0x2d6bda[_0x8b8a('0x22')],!![]);}else{this[_0x8b8a('0x4d')](_0x2d6bda[_0x8b8a('0x22')],![],this[_0x8b8a('0x21')][_0x2d6bda[_0x8b8a('0x22')]]['faxstatusstring']?_0x8b8a('0x55')+this[_0x8b8a('0x21')][_0x2d6bda['uniqueid']][_0x8b8a('0x56')]:_0x8b8a('0x57'));}}}};Fax[_0x8b8a('0x1d')]['send']=function(_0x4be73c){var _0x340dd5=this;return new BPromise(function(_0x5037f9,_0x5b284a){_0x340dd5[_0x8b8a('0x58')](_0x4be73c,_0x340dd5['faxAccounts'][_0x4be73c[_0x8b8a('0x59')]])[_0x8b8a('0x3d')](function(_0xfdb02d){ut[_0x8b8a('0x49')](_0x8b8a('0x5a'),_0xfdb02d);_0x5037f9(ut[_0x8b8a('0x39')](_0x8b8a('0x5b')));})['catch'](function(_0x5e3e75){ut[_0x8b8a('0x49')]('[Fax][execOriginate][failure]',_0x5e3e75);updateStatus(_0x4be73c);_0x5b284a(ut[_0x8b8a('0x39')]('Fax\x20failed'));});});};Fax[_0x8b8a('0x1d')]['checkAfterSend']=function(_0x1b743c){var _0xf556b2=this;return new BPromise(function(_0x33d75f,_0xa22c27){var _0x3d80e6=_0xf556b2[_0x8b8a('0x5c')](_0xf556b2[_0x8b8a('0xe')][_0x1b743c['FaxAccountId']][_0x8b8a('0x5d')],_0x1b743c);if(_0x3d80e6[_0x8b8a('0x5e')]){_0x33d75f(ut[_0x8b8a('0x39')](_0x8b8a('0x5f')));}else{_0xa22c27(ut[_0x8b8a('0x39')](_0x3d80e6[_0x8b8a('0x39')]));}});};function originate(_0x42b3cb,_0x52e44e,_0x1c7794){return new BPromise(function(_0x27a2a8,_0x385fef){if(_0x1c7794){var _0x249963=util[_0x8b8a('0x60')](_0x8b8a('0x61'),path[_0x8b8a('0x62')](_0x42b3cb[_0x8b8a('0x63')])[_0x8b8a('0x24')],_0x42b3cb[_0x8b8a('0x63')]);gs['execute'](_0x249963)[_0x8b8a('0x3d')](function(){_0x42b3cb[_0x8b8a('0x63')]=util[_0x8b8a('0x60')](_0x8b8a('0x64'),path[_0x8b8a('0x62')](_0x42b3cb[_0x8b8a('0x63')])[_0x8b8a('0x65')],path[_0x8b8a('0x62')](_0x42b3cb[_0x8b8a('0x63')])[_0x8b8a('0x24')]);_0x52e44e['XMF-PATH']=_0x42b3cb[_0x8b8a('0x63')];ut['logger'](_0x8b8a('0x66'),'');ami[_0x8b8a('0x67')](ut[_0x8b8a('0x68')](_0x42b3cb,_0x52e44e))[_0x8b8a('0x3d')](function(_0x1f7c51){_0x27a2a8(_0x1f7c51);})[_0x8b8a('0x3f')](function(_0x11b808){_0x385fef(_0x11b808);});})['catch'](function(_0x363aa4){_0x385fef(_0x363aa4);});}else{ami[_0x8b8a('0x67')](ut[_0x8b8a('0x68')](_0x42b3cb,_0x52e44e))['then'](function(_0x50d5d2){_0x27a2a8(_0x50d5d2);})[_0x8b8a('0x3f')](function(_0x4358f4){_0x385fef(_0x4358f4);});}});}Fax[_0x8b8a('0x1d')][_0x8b8a('0x58')]=function(_0x433f5a,_0x7de370){var _0x52cb14=this;return new BPromise(function(_0x1902bc,_0x3b4d22){var _0x149170=uuid['v4']();var _0x3945de=ut['addVariables'](_0x433f5a,_0x7de370);_0x52cb14[_0x8b8a('0x27')][_0x149170]=new Action(_0x149170,_0x7de370,_0x433f5a);var _0x554b49=_0x52cb14[_0x8b8a('0x27')][_0x149170];if(path[_0x8b8a('0x62')](_0x433f5a[_0x8b8a('0x63')])[_0x8b8a('0x69')]===_0x8b8a('0x3b')){originate(_0x554b49,_0x3945de,!![])[_0x8b8a('0x3d')](function(_0x15b049){_0x1902bc(_0x15b049);})[_0x8b8a('0x3f')](function(_0x38c87d){_0x3b4d22(_0x38c87d);});}else{originate(_0x554b49,_0x3945de,![])[_0x8b8a('0x3d')](function(_0x189f41){_0x1902bc(_0x189f41);})[_0x8b8a('0x3f')](function(_0x2d3688){_0x3b4d22(_0x2d3688);});}});};Fax[_0x8b8a('0x1d')][_0x8b8a('0x6a')]=function(_0x5999c8){return!_[_0x8b8a('0x6b')](_0x5999c8)&&!_['isNil'](_0x5999c8[_0x8b8a('0x24')])&&!_[_0x8b8a('0x6b')](_0x5999c8[_0x8b8a('0x6c')])&&_0x5999c8[_0x8b8a('0x6c')]&&!_[_0x8b8a('0x6b')](this['trunks'][util['format'](_0x8b8a('0x6d'),_0x5999c8[_0x8b8a('0x24')])])&&!_[_0x8b8a('0x6b')](this[_0x8b8a('0xf')][util['format']('SIP/%s',_0x5999c8[_0x8b8a('0x24')])][_0x8b8a('0x2e')])&&(this[_0x8b8a('0xf')][util['format'](_0x8b8a('0x6d'),_0x5999c8[_0x8b8a('0x24')])]['status']==='reachable'||this[_0x8b8a('0xf')][util[_0x8b8a('0x60')]('SIP/%s',_0x5999c8[_0x8b8a('0x24')])][_0x8b8a('0x2e')]===_0x8b8a('0x6e'));};Fax[_0x8b8a('0x1d')][_0x8b8a('0x5c')]=function(_0x5e40d7,_0x51551e){if(!this['isTrunkReachable'](_0x5e40d7)){ut[_0x8b8a('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x8b8a('0x6b')](_0x5e40d7)?'':_0x5e40d7[_0x8b8a('0x24')]+_0x8b8a('0x6f'));return{'isValid':![],'message':_0x8b8a('0x70')};}if(_[_0x8b8a('0x6b')](_0x51551e['fax'])){ut[_0x8b8a('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8b8a('0x53')](_0x51551e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x51551e[_0x8b8a('0x63')])){ut[_0x8b8a('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8b8a('0x53')](_0x51551e));return{'isValid':![],'message':_0x8b8a('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x8b8a('0x1d')]['deleteChannelAfterTimeout']=function(_0x441025,_0x332746=0x2710){if(this[_0x8b8a('0x21')][_0x441025]){setTimeout(()=>{delete this[_0x8b8a('0x21')][_0x441025];},_0x332746);}};module[_0x8b8a('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 858fa24..7f5e04f 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 _0x39ab=['notify','catch','util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0x39ab,0xbd));var _0xb39a=function(_0x480b57,_0xa38c4e){_0x480b57=_0x480b57-0x0;var _0x22c966=_0x39ab[_0x480b57];return _0x22c966;};'use strict';var util=require(_0xb39a('0x0'));var BPromise=require(_0xb39a('0x1'));var logger=require('../../../config/logger')(_0xb39a('0x2'));var _=require(_0xb39a('0x3'));var faxAccount=require(_0xb39a('0x4'));function loggerCatch(_0x172008){return function(_0x459c94){logger[_0xb39a('0x5')](_0x172008,util[_0xb39a('0x6')](_0x459c94,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x8e96b0,_0x4f62f2){return BPromise[_0xb39a('0x7')]()[_0xb39a('0x8')](faxAccount[_0xb39a('0x9')](_0x8e96b0,_0x4f62f2))[_0xb39a('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xd43d=['preview','lodash','inspect','notify','resolve','catch','util','bluebird','../../../config/logger'];(function(_0x3fea5f,_0x42d6d2){var _0x4a99ca=function(_0x2e246c){while(--_0x2e246c){_0x3fea5f['push'](_0x3fea5f['shift']());}};_0x4a99ca(++_0x42d6d2);}(_0xd43d,0xde));var _0xdd43=function(_0x39c0ac,_0x1c8f75){_0x39c0ac=_0x39c0ac-0x0;var _0x4ea84b=_0xd43d[_0x39c0ac];return _0x4ea84b;};'use strict';var util=require(_0xdd43('0x0'));var BPromise=require(_0xdd43('0x1'));var logger=require(_0xdd43('0x2'))(_0xdd43('0x3'));var _=require(_0xdd43('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2c35e4){return function(_0x479e2d){logger['error'](_0x2c35e4,util[_0xdd43('0x5')](_0x479e2d,{'showHidden':![],'depth':null}));};}exports[_0xdd43('0x6')]=function(_0x1c0930,_0x3f4179){return BPromise[_0xdd43('0x7')]()['then'](faxAccount['notify'](_0x1c0930,_0x3f4179))[_0xdd43('0x8')](loggerCatch('[Notify]\x20'));}; \ 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 5eaf577..ee1ef70 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 _0xfb16=['fax','child_process','info','Exec\x20gs','../../../../config/logger'];(function(_0x312c3c,_0x311bd1){var _0x640af8=function(_0x5892c8){while(--_0x5892c8){_0x312c3c['push'](_0x312c3c['shift']());}};_0x640af8(++_0x311bd1);}(_0xfb16,0x72));var _0x6fb1=function(_0x1c87c7,_0x11318d){_0x1c87c7=_0x1c87c7-0x0;var _0x131ccd=_0xfb16[_0x1c87c7];return _0x131ccd;};'use strict';var util=require('util');var logger=require(_0x6fb1('0x0'))(_0x6fb1('0x1'));var BPromise=require('bluebird');var exec=require(_0x6fb1('0x2'))['exec'];exports['execute']=function(_0x1ec1ea){return new BPromise(function(_0x5b5655,_0x1d9c02){exec(_0x1ec1ea,function(_0x362f42,_0x3293e7,_0x52972d){logger[_0x6fb1('0x3')](_0x6fb1('0x4'),_0x3293e7);if(_0x362f42){logger['info']('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x362f42,{'showHidden':![],'depth':null}),_0x3293e7,_0x52972d);_0x1d9c02(_0x362f42);}_0x5b5655(_0x3293e7);});});}; \ No newline at end of file +var _0x01c9=['fax','bluebird','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x16f416,_0x5d381d){var _0x5c083e=function(_0x18d7eb){while(--_0x18d7eb){_0x16f416['push'](_0x16f416['shift']());}};_0x5c083e(++_0x5d381d);}(_0x01c9,0xf1));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x901c('0x0'));var logger=require(_0x901c('0x1'))(_0x901c('0x2'));var BPromise=require(_0x901c('0x3'));var exec=require('child_process')['exec'];exports[_0x901c('0x4')]=function(_0x42f859){return new BPromise(function(_0x73235e,_0x475508){exec(_0x42f859,function(_0x55312f,_0xa91f23,_0x17f0ca){logger[_0x901c('0x5')]('Exec\x20gs',_0xa91f23);if(_0x55312f){logger['info'](_0x901c('0x6'),_0x901c('0x7'),util[_0x901c('0x8')](_0x55312f,{'showHidden':![],'depth':null}),_0xa91f23,_0x17f0ca);_0x475508(_0x55312f);}_0x73235e(_0xa91f23);});});}; \ 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 8ec9484..a182d0e 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 _0x9f06=['ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','localstationid','util','lodash','moment','../../../../config/logger','message','logger','inspect','addVariables'];(function(_0x5364d9,_0x144cb5){var _0x8db4bd=function(_0x315d87){while(--_0x315d87){_0x5364d9['push'](_0x5364d9['shift']());}};_0x8db4bd(++_0x144cb5);}(_0x9f06,0x1a8));var _0x69f0=function(_0x3bb611,_0x57c0bb){_0x3bb611=_0x3bb611-0x0;var _0x54aebe=_0x9f06[_0x3bb611];return _0x54aebe;};'use strict';var util=require(_0x69f0('0x0'));var _=require(_0x69f0('0x1'));var moment=require(_0x69f0('0x2'));var logger=require(_0x69f0('0x3'))('fax');exports[_0x69f0('0x4')]=function(_0x44a85b){return{'message':_0x44a85b};};exports[_0x69f0('0x5')]=function(_0x5c2f94,_0x27f657){logger['info'](_0x5c2f94,util[_0x69f0('0x6')](_0x27f657,{'showHidden':![],'depth':null}));};exports[_0x69f0('0x7')]=function(_0x891fe9,_0x552ca7){var _0x29cf7d={'XMF-ECM':_0x552ca7[_0x69f0('0x8')],'XMF-HEADERINFO':_0x552ca7[_0x69f0('0x9')],'XMF-MINRATE':_0x552ca7[_0x69f0('0xa')],'XMF-MAXRATE':_0x552ca7['maxrate'],'XMF-MODEM':util[_0x69f0('0xb')](_0x69f0('0xc'),_0x552ca7[_0x69f0('0xd')]),'XMF-GATEWAY':_0x552ca7[_0x69f0('0xe')],'XMF-FAXDETECT':_0x552ca7[_0x69f0('0xf')],'XMF-T38TIMEOUT':_0x552ca7[_0x69f0('0x10')],'XMF-LOCALSTATIONID':_0x552ca7['localstationid'],'XMF-PATH':_0x891fe9[_0x69f0('0x11')]};return _0x29cf7d;};exports[_0x69f0('0x12')]=function(_0x427d11,_0x449b2d){return{'actionid':_0x427d11[_0x69f0('0x13')],'action':_0x69f0('0x14'),'channel':_0x427d11['channel'],'Exten':_0x69f0('0x15'),'Context':_0x69f0('0x16'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x427d11[_0x69f0('0x9')]?_0x427d11[_0x69f0('0x9')]:'',_0x427d11[_0x69f0('0x17')]),'variable':_0x449b2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x427d11[_0x69f0('0x13')]};}; \ No newline at end of file +var _0xa26d=['gateway','localstationid','path','uniqueid','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem'];(function(_0x1a20ec,_0x27626c){var _0x3a2ec1=function(_0xb45d54){while(--_0xb45d54){_0x1a20ec['push'](_0x1a20ec['shift']());}};_0x3a2ec1(++_0x27626c);}(_0xa26d,0x91));var _0xda26=function(_0x3d4e7d,_0x1693e2){_0x3d4e7d=_0x3d4e7d-0x0;var _0x19bac2=_0xa26d[_0x3d4e7d];return _0x19bac2;};'use strict';var util=require(_0xda26('0x0'));var _=require(_0xda26('0x1'));var moment=require(_0xda26('0x2'));var logger=require(_0xda26('0x3'))(_0xda26('0x4'));exports[_0xda26('0x5')]=function(_0x5ed1a4){return{'message':_0x5ed1a4};};exports[_0xda26('0x6')]=function(_0x333f1e,_0x318b4e){logger[_0xda26('0x7')](_0x333f1e,util[_0xda26('0x8')](_0x318b4e,{'showHidden':![],'depth':null}));};exports[_0xda26('0x9')]=function(_0x5845eb,_0x6d452b){var _0x4748de={'XMF-ECM':_0x6d452b[_0xda26('0xa')],'XMF-HEADERINFO':_0x6d452b[_0xda26('0xb')],'XMF-MINRATE':_0x6d452b['minrate'],'XMF-MAXRATE':_0x6d452b[_0xda26('0xc')],'XMF-MODEM':util[_0xda26('0xd')](_0xda26('0xe'),_0x6d452b[_0xda26('0xf')]),'XMF-GATEWAY':_0x6d452b[_0xda26('0x10')],'XMF-FAXDETECT':_0x6d452b['faxdetect'],'XMF-T38TIMEOUT':_0x6d452b['t38timeout'],'XMF-LOCALSTATIONID':_0x6d452b[_0xda26('0x11')],'XMF-PATH':_0x5845eb[_0xda26('0x12')]};return _0x4748de;};exports['variablesAction']=function(_0x282d76,_0xe0079a){return{'actionid':_0x282d76[_0xda26('0x13')],'action':_0xda26('0x14'),'channel':_0x282d76['channel'],'Exten':_0xda26('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0xda26('0xd')](_0xda26('0x16'),_0x282d76[_0xda26('0xb')]?_0x282d76['headerinfo']:'',_0x282d76[_0xda26('0x11')]),'variable':_0xe0079a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x282d76['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e4ef3f6..86323db 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 _0x2907=['./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','error','util','moment'];(function(_0x5ab3a8,_0x357688){var _0x4619de=function(_0x321ec2){while(--_0x321ec2){_0x5ab3a8['push'](_0x5ab3a8['shift']());}};_0x4619de(++_0x357688);}(_0x2907,0xfe));var _0x7290=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x2907[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x7290('0x0'));var moment=require(_0x7290('0x1'));var server=require(_0x7290('0x2'));var Realtime=require(_0x7290('0x3'));var Report=require(_0x7290('0x4'));var Acw=require('./acw');var Trigger=require(_0x7290('0x5'));var Dialer=require(_0x7290('0x6'));var Preview=require(_0x7290('0x7'));var Fax=require(_0x7290('0x8'));var user=require(_0x7290('0x9'));var voiceQueue=require(_0x7290('0xa'));var voiceQueueReport=require(_0x7290('0xb'));var voiceCallReport=require(_0x7290('0xc'));var trunk=require(_0x7290('0xd'));var trigger=require(_0x7290('0xe'));var template=require(_0x7290('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x7290('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x7290('0x11'));var salesforce=require(_0x7290('0x12'));var sugarcrm=require(_0x7290('0x13'));var freshdesk=require(_0x7290('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x7290('0x15'));var vtiger=require(_0x7290('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7290('0x17'));var dynamics365=require(_0x7290('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('../../config/logger')(_0x7290('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7290('0x1a')](_0x7290('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x7290('0x1c')](user[_0x7290('0x1d')]())['then'](realtime[_0x7290('0x1e')]())[_0x7290('0x1c')](user['getTelephones']())['then'](realtime[_0x7290('0x1f')]())['then'](trunk[_0x7290('0x20')]())[_0x7290('0x1c')](realtime['initTrunks']())[_0x7290('0x1c')](voiceQueue[_0x7290('0x21')]())['then'](realtime[_0x7290('0x22')]())[_0x7290('0x1c')](trigger[_0x7290('0x23')]())[_0x7290('0x1c')](realtime['initTriggers']())[_0x7290('0x1c')](template[_0x7290('0x24')]())['then'](realtime['initTemplates']())[_0x7290('0x1c')](zendesk[_0x7290('0x25')]())['then'](realtime[_0x7290('0x26')]())[_0x7290('0x1c')](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x7290('0x27')]())['then'](realtime[_0x7290('0x28')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x7290('0x1c')](realtime['initFreshdeskAccounts']())[_0x7290('0x1c')](desk[_0x7290('0x29')]())[_0x7290('0x1c')](realtime[_0x7290('0x2a')]())['then'](zoho['getZohoAccounts']())[_0x7290('0x1c')](realtime[_0x7290('0x2b')]())['then'](vtiger[_0x7290('0x2c')]())[_0x7290('0x1c')](realtime['initVtigerAccounts']())[_0x7290('0x1c')](freshsales[_0x7290('0x2d')]())['then'](realtime[_0x7290('0x2e')]())[_0x7290('0x1c')](servicenow[_0x7290('0x2f')]())[_0x7290('0x1c')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x7290('0x30')]())[_0x7290('0x1c')](realtime[_0x7290('0x31')]())['then'](campaign[_0x7290('0x32')]())['then'](realtime[_0x7290('0x33')]())[_0x7290('0x1c')](voiceExtension[_0x7290('0x34')]())[_0x7290('0x1c')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x7290('0x35')]())[_0x7290('0x1c')](realtime['initFaxAccounts']())[_0x7290('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x7290('0x36')]()[_0x7290('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x7290('0x1c')](realtime['initVoiceQueueReports']())[_0x7290('0x1c')](cmHopperHistory[_0x7290('0x37')]())[_0x7290('0x1c')](realtime[_0x7290('0x38')]())['then'](cmHopperHistory[_0x7290('0x39')]())['then'](realtime[_0x7290('0x3a')]())[_0x7290('0x1c')](voiceCallReport[_0x7290('0x3b')]())[_0x7290('0x1c')](realtime[_0x7290('0x3c')]())[_0x7290('0x3d')](function(_0x3897da){logger['error'](_0x7290('0x3e'),util['inspect'](_0x3897da,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x7290('0x1c')](function(){return initParams();})[_0x7290('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x7290('0x3d')](function(_0xe93216){logger[_0x7290('0x3f')]('[index.js][main]',util['inspect'](_0xe93216,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x5a81=['[index.js][initParams]','inspect','listen','sync','catch','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','../../config/logger','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error'];(function(_0x2fc69b,_0x55537d){var _0x25e3c9=function(_0x4da4b5){while(--_0x4da4b5){_0x2fc69b['push'](_0x2fc69b['shift']());}};_0x25e3c9(++_0x55537d);}(_0x5a81,0x163));var _0x15a8=function(_0x47eba7,_0x5c6a62){_0x47eba7=_0x47eba7-0x0;var _0x467bfc=_0x5a81[_0x47eba7];return _0x467bfc;};'use strict';var util=require(_0x15a8('0x0'));var moment=require(_0x15a8('0x1'));var server=require('./server');var Realtime=require(_0x15a8('0x2'));var Report=require(_0x15a8('0x3'));var Acw=require(_0x15a8('0x4'));var Trigger=require(_0x15a8('0x5'));var Dialer=require(_0x15a8('0x6'));var Preview=require(_0x15a8('0x7'));var Fax=require(_0x15a8('0x8'));var user=require(_0x15a8('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x15a8('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x15a8('0xb'));var template=require(_0x15a8('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x15a8('0xd'));var voiceExtension=require(_0x15a8('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x15a8('0xf'));var salesforce=require(_0x15a8('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x15a8('0x11'));var desk=require(_0x15a8('0x12'));var zoho=require(_0x15a8('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');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(_0x15a8('0x14'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x15a8('0x15')](_0x15a8('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x15a8('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x15a8('0x17')]()['then'](user[_0x15a8('0x18')]())[_0x15a8('0x19')](realtime[_0x15a8('0x1a')]())[_0x15a8('0x19')](user[_0x15a8('0x1b')]())[_0x15a8('0x19')](realtime[_0x15a8('0x1c')]())[_0x15a8('0x19')](trunk[_0x15a8('0x1d')]())[_0x15a8('0x19')](realtime['initTrunks']())[_0x15a8('0x19')](voiceQueue[_0x15a8('0x1e')]())[_0x15a8('0x19')](realtime[_0x15a8('0x1f')]())[_0x15a8('0x19')](trigger[_0x15a8('0x20')]())[_0x15a8('0x19')](realtime[_0x15a8('0x21')]())[_0x15a8('0x19')](template[_0x15a8('0x22')]())['then'](realtime['initTemplates']())[_0x15a8('0x19')](zendesk[_0x15a8('0x23')]())[_0x15a8('0x19')](realtime['initZendeskAccounts']())['then'](salesforce[_0x15a8('0x24')]())[_0x15a8('0x19')](realtime[_0x15a8('0x25')]())[_0x15a8('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x15a8('0x19')](realtime[_0x15a8('0x26')]())[_0x15a8('0x19')](freshdesk[_0x15a8('0x27')]())[_0x15a8('0x19')](realtime[_0x15a8('0x28')]())[_0x15a8('0x19')](desk[_0x15a8('0x29')]())[_0x15a8('0x19')](realtime[_0x15a8('0x2a')]())[_0x15a8('0x19')](zoho[_0x15a8('0x2b')]())[_0x15a8('0x19')](realtime['initZohoAccounts']())[_0x15a8('0x19')](vtiger[_0x15a8('0x2c')]())['then'](realtime[_0x15a8('0x2d')]())[_0x15a8('0x19')](freshsales[_0x15a8('0x2e')]())[_0x15a8('0x19')](realtime[_0x15a8('0x2f')]())[_0x15a8('0x19')](servicenow[_0x15a8('0x30')]())[_0x15a8('0x19')](realtime[_0x15a8('0x31')]())[_0x15a8('0x19')](dynamics365[_0x15a8('0x32')]())[_0x15a8('0x19')](realtime[_0x15a8('0x33')]())['then'](campaign[_0x15a8('0x34')]())['then'](realtime['initCampaigns']())[_0x15a8('0x19')](voiceExtension[_0x15a8('0x35')]())[_0x15a8('0x19')](realtime[_0x15a8('0x36')]())[_0x15a8('0x19')](faxAccount[_0x15a8('0x37')]())[_0x15a8('0x19')](realtime[_0x15a8('0x38')]())[_0x15a8('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x15a8('0x17')]()[_0x15a8('0x19')](voiceQueueReport[_0x15a8('0x39')]())[_0x15a8('0x19')](realtime[_0x15a8('0x3a')]())[_0x15a8('0x19')](cmHopperHistory[_0x15a8('0x3b')]())[_0x15a8('0x19')](realtime[_0x15a8('0x3c')]())[_0x15a8('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0x15a8('0x19')](realtime[_0x15a8('0x3d')]())[_0x15a8('0x19')](voiceCallReport[_0x15a8('0x3e')]())['then'](realtime[_0x15a8('0x3f')]())['catch'](function(_0x14ccfc){logger[_0x15a8('0x40')](_0x15a8('0x41'),util[_0x15a8('0x42')](_0x14ccfc,{'showHidden':![],'depth':null}));});}function main(){return server[_0x15a8('0x43')](realtime,preview,fax)[_0x15a8('0x19')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x15a8('0x19')](function(){report[_0x15a8('0x44')]();setInterval(initRealtime,0x1388);})[_0x15a8('0x45')](function(_0xd235fb){logger[_0x15a8('0x40')]('[index.js][main]',util['inspect'](_0xd235fb,{'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 d00eab5..12c3a3c 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 _0x35b5=['statePause','voiceStatusTime','toNumber','format','voiceStatusCallerIdNumber','stringify','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','voiceStatus'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x35b5,0x14a));var _0x535b=function(_0x4d2e01,_0x1bccbd){_0x4d2e01=_0x4d2e01-0x0;var _0x29333c=_0x35b5[_0x4d2e01];return _0x29333c;};'use strict';var _=require(_0x535b('0x0'));var util=require(_0x535b('0x1'));var moment=require(_0x535b('0x2'));var md5=require(_0x535b('0x3'));var Redis=require(_0x535b('0x4'));var config=require(_0x535b('0x5'));config[_0x535b('0x6')]=_[_0x535b('0x7')](config[_0x535b('0x6')],{'host':_0x535b('0x8'),'port':0x18eb});var io=require(_0x535b('0x9'))(new Redis(config['redis']));function Agent(_0x2d58a1){this['id']=_0x2d58a1['id']||0x0;this[_0x535b('0xa')]=_0x2d58a1[_0x535b('0xa')]||'';this[_0x535b('0xb')]=_0x2d58a1['email']||'';this[_0x535b('0xc')]=_0x2d58a1[_0x535b('0xc')]||'';this[_0x535b('0xd')]=_0x2d58a1['fullname']||'';this[_0x535b('0xe')]=_0x535b('0xf');this[_0x535b('0x10')]=0x0;this[_0x535b('0x11')]='unknown';this[_0x535b('0x12')]='';this['phone']='';this[_0x535b('0x13')]='';this[_0x535b('0x14')]='';this[_0x535b('0x15')]=_0x2d58a1[_0x535b('0x15')]||![];this['voiceStatus']=_0x535b('0xf');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x535b('0x16')]='';this[_0x535b('0x17')]=![];this[_0x535b('0x18')]=![];this[_0x535b('0x3')]='';}Agent[_0x535b('0x19')][_0x535b('0x1a')]=function(_0x59ca43){var _0x29a7c2;if(_0x59ca43&&_0x59ca43[_0x535b('0xe')]){_0x29a7c2=_0x59ca43[_0x535b('0xe')][_0x535b('0x1b')]();switch(_0x29a7c2){case'not_inuse':_0x29a7c2=_0x535b('0x1c');break;case'inuse':_0x29a7c2='talking';break;}}if(_0x29a7c2&&this[_0x535b('0x1d')]!==_0x29a7c2||_0x59ca43[_0x535b('0x1e')]){this[_0x535b('0x1f')]=_[_0x535b('0x20')](moment()[_0x535b('0x21')]('x'));}if(_0x29a7c2){this[_0x535b('0x1d')]=_0x29a7c2;}var _0x235c89={'id':this['id'],'name':this[_0x535b('0xa')],'email':this['email'],'accountcode':this[_0x535b('0xc')],'fullname':this[_0x535b('0xd')],'state':this[_0x535b('0xe')],'stateTime':this[_0x535b('0x10')],'status':this[_0x535b('0x11')],'address':this[_0x535b('0x12')],'online':this[_0x535b('0x15')],'voiceStatus':this[_0x535b('0x1d')],'voiceStatusTime':this[_0x535b('0x1f')],'voiceStatusCallerIdNumber':this[_0x535b('0x22')],'voiceStatusQueue':this[_0x535b('0x16')],'interface':this[_0x535b('0x14')],'onhold':this[_0x535b('0x17')]};var _0x3dd9f1=md5(JSON[_0x535b('0x23')](_0x235c89));if(this['md5']!==_0x3dd9f1){this[_0x535b('0x3')]=_0x3dd9f1;io['to'](util[_0x535b('0x21')]('user:%s',_0x235c89[_0x535b('0xa')]))[_0x535b('0x24')](_0x535b('0x25'),_['omit'](_0x235c89,[_0x535b('0x15')]));io[_0x535b('0x24')](_0x535b('0x26'),_0x235c89);}};module[_0x535b('0x27')]=Agent; \ No newline at end of file +var _0xe949=['unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','local','prototype','updateStatusRealtime','idle','talking','statePause','voiceStatusTime','toNumber','format','onhold','user:%s','user:ami:update','user:presence','exports','lodash','util','moment','md5','redis','defaults','localhost','name','email','accountcode','fullname','state'];(function(_0x100068,_0x5d8af1){var _0x3f5606=function(_0x34cc14){while(--_0x34cc14){_0x100068['push'](_0x100068['shift']());}};_0x3f5606(++_0x5d8af1);}(_0xe949,0xcc));var _0x9e94=function(_0x19be82,_0x376f70){_0x19be82=_0x19be82-0x0;var _0x115d09=_0xe949[_0x19be82];return _0x115d09;};'use strict';var _=require(_0x9e94('0x0'));var util=require(_0x9e94('0x1'));var moment=require(_0x9e94('0x2'));var md5=require(_0x9e94('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9e94('0x4')]=_[_0x9e94('0x5')](config['redis'],{'host':_0x9e94('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9e94('0x4')]));function Agent(_0xdb0aa9){this['id']=_0xdb0aa9['id']||0x0;this[_0x9e94('0x7')]=_0xdb0aa9[_0x9e94('0x7')]||'';this['email']=_0xdb0aa9[_0x9e94('0x8')]||'';this[_0x9e94('0x9')]=_0xdb0aa9[_0x9e94('0x9')]||'';this[_0x9e94('0xa')]=_0xdb0aa9['fullname']||'';this[_0x9e94('0xb')]=_0x9e94('0xc');this[_0x9e94('0xd')]=0x0;this[_0x9e94('0xe')]='unknown';this[_0x9e94('0xf')]='';this[_0x9e94('0x10')]='';this[_0x9e94('0x11')]='';this[_0x9e94('0x12')]='';this[_0x9e94('0x13')]=_0xdb0aa9[_0x9e94('0x13')]||![];this[_0x9e94('0x14')]=_0x9e94('0xc');this['voiceStatusTime']=0x0;this[_0x9e94('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x9e94('0x16')]=![];this[_0x9e94('0x3')]='';}Agent[_0x9e94('0x17')][_0x9e94('0x18')]=function(_0xe6cff1){var _0x341e79;if(_0xe6cff1&&_0xe6cff1[_0x9e94('0xb')]){_0x341e79=_0xe6cff1['state']['toLowerCase']();switch(_0x341e79){case'not_inuse':_0x341e79=_0x9e94('0x19');break;case'inuse':_0x341e79=_0x9e94('0x1a');break;}}if(_0x341e79&&this['voiceStatus']!==_0x341e79||_0xe6cff1[_0x9e94('0x1b')]){this[_0x9e94('0x1c')]=_[_0x9e94('0x1d')](moment()[_0x9e94('0x1e')]('x'));}if(_0x341e79){this[_0x9e94('0x14')]=_0x341e79;}var _0x26e2f1={'id':this['id'],'name':this[_0x9e94('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x9e94('0xa')],'state':this[_0x9e94('0xb')],'stateTime':this['stateTime'],'status':this[_0x9e94('0xe')],'address':this[_0x9e94('0xf')],'online':this[_0x9e94('0x13')],'voiceStatus':this[_0x9e94('0x14')],'voiceStatusTime':this[_0x9e94('0x1c')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9e94('0x12')],'onhold':this[_0x9e94('0x1f')]};var _0x190c4d=md5(JSON['stringify'](_0x26e2f1));if(this[_0x9e94('0x3')]!==_0x190c4d){this[_0x9e94('0x3')]=_0x190c4d;io['to'](util[_0x9e94('0x1e')](_0x9e94('0x20'),_0x26e2f1[_0x9e94('0x7')]))['emit'](_0x9e94('0x21'),_['omit'](_0x26e2f1,[_0x9e94('0x13')]));io['emit'](_0x9e94('0x22'),_0x26e2f1);}};module[_0x9e94('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index cc467d5..e1916c0 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 _0x869e=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','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','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x869e,0xf7));var _0xe869=function(_0x5b399e,_0xe6d490){_0x5b399e=_0x5b399e-0x0;var _0x2cf131=_0x869e[_0x5b399e];return _0x2cf131;};'use strict';function Campaign(_0x26a82d){this['id']=_0x26a82d['id']||0x0;this[_0xe869('0x0')]=_0x26a82d[_0xe869('0x0')]||'';this[_0xe869('0x1')]=_0x26a82d[_0xe869('0x1')]||_0xe869('0x2');this[_0xe869('0x3')]=0x0;this[_0xe869('0x4')]=0x0;this[_0xe869('0x5')]=0x0;this[_0xe869('0x6')]=0x0;this['message']='';this[_0xe869('0x7')]=!![];this[_0xe869('0x8')]=_0x26a82d[_0xe869('0x8')];this['limitCalls']=_0x26a82d[_0xe869('0x9')];this['dialTimezone']=_0x26a82d[_0xe869('0xa')]||null;this[_0xe869('0xb')]=_0x26a82d[_0xe869('0xb')]?_0x26a82d[_0xe869('0xb')]:null;this[_0xe869('0xc')]=_0x26a82d[_0xe869('0xc')];this['dialOriginateCallerIdNumber']=_0x26a82d[_0xe869('0xd')];this[_0xe869('0xe')]=_0x26a82d[_0xe869('0xe')]||0x1e;this[_0xe869('0xf')]=_0x26a82d[_0xe869('0xf')];this[_0xe869('0x10')]=_0x26a82d[_0xe869('0x10')];this[_0xe869('0x11')]=_0x26a82d[_0xe869('0x11')];this['dialBusyRetryFrequency']=_0x26a82d[_0xe869('0x12')];this[_0xe869('0x13')]=_0x26a82d[_0xe869('0x13')];this[_0xe869('0x14')]=_0x26a82d[_0xe869('0x14')];this[_0xe869('0x15')]=_0x26a82d[_0xe869('0x15')];this[_0xe869('0x16')]=_0x26a82d[_0xe869('0x16')]||0x3;this[_0xe869('0x17')]=_0x26a82d[_0xe869('0x17')]||0x96;this[_0xe869('0x18')]=_0x26a82d['dialDropMaxRetry']||0x3;this[_0xe869('0x19')]=_0x26a82d[_0xe869('0x19')]||0x96;this[_0xe869('0x1a')]=_0x26a82d[_0xe869('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x26a82d[_0xe869('0x1b')]||0x96;this[_0xe869('0x1c')]=_0x26a82d[_0xe869('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x26a82d['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x26a82d[_0xe869('0x1d')]||0x3;this[_0xe869('0x1e')]=_0x26a82d[_0xe869('0x1e')]||0x96;this[_0xe869('0x1f')]=_0x26a82d['dialOrderByScheduledAt']||_0xe869('0x20');this['dialPrefix']=_0x26a82d[_0xe869('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x26a82d[_0xe869('0x22')]||undefined;this[_0xe869('0x23')]=_0x26a82d[_0xe869('0x23')]||undefined;this['TrunkBackup']=_0x26a82d['TrunkBackup']?_0x26a82d[_0xe869('0x24')]:undefined;this[_0xe869('0x25')]=_0x26a82d['Trunk']?_0x26a82d[_0xe869('0x25')]:undefined;this[_0xe869('0x26')]=_0x26a82d['Interval']?_0x26a82d['Interval']:undefined;this['SquareProject']=_0x26a82d[_0xe869('0x27')]?_0x26a82d[_0xe869('0x27')]:undefined;this[_0xe869('0x28')]=_0x26a82d[_0xe869('0x27')]?_0x26a82d[_0xe869('0x27')][_0xe869('0x0')]:undefined;this[_0xe869('0x29')]=_0x26a82d[_0xe869('0x29')]||![];this[_0xe869('0x2a')]=_0x26a82d['dialAMDInitialSilence'];this[_0xe869('0x2b')]=_0x26a82d[_0xe869('0x2b')];this[_0xe869('0x2c')]=_0x26a82d[_0xe869('0x2c')];this[_0xe869('0x2d')]=_0x26a82d['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x26a82d[_0xe869('0x2e')];this[_0xe869('0x2f')]=_0x26a82d['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x26a82d[_0xe869('0x30')];this[_0xe869('0x31')]=_0x26a82d[_0xe869('0x31')];this[_0xe869('0x32')]=_0x26a82d[_0xe869('0x32')];}module[_0xe869('0x33')]=Campaign; \ No newline at end of file +var _0xc7d2=['dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix'];(function(_0x47da8d,_0x517e13){var _0x5aabef=function(_0x2528d7){while(--_0x2528d7){_0x47da8d['push'](_0x47da8d['shift']());}};_0x5aabef(++_0x517e13);}(_0xc7d2,0x170));var _0x2c7d=function(_0x239a4b,_0x90265a){_0x239a4b=_0x239a4b-0x0;var _0xd6307e=_0xc7d2[_0x239a4b];return _0xd6307e;};'use strict';function Campaign(_0x1e4ba1){this['id']=_0x1e4ba1['id']||0x0;this[_0x2c7d('0x0')]=_0x1e4ba1['name']||'';this['type']=_0x1e4ba1['type']||_0x2c7d('0x1');this['originated']=0x0;this[_0x2c7d('0x2')]=0x0;this[_0x2c7d('0x3')]=0x0;this[_0x2c7d('0x4')]=0x0;this[_0x2c7d('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x2c7d('0x6')]=_0x1e4ba1[_0x2c7d('0x6')];this[_0x2c7d('0x7')]=_0x1e4ba1[_0x2c7d('0x7')];this[_0x2c7d('0x8')]=_0x1e4ba1[_0x2c7d('0x8')]||null;this['dialGlobalInterval']=_0x1e4ba1['dialGlobalInterval']?_0x1e4ba1[_0x2c7d('0x9')]:null;this[_0x2c7d('0xa')]=_0x1e4ba1[_0x2c7d('0xa')];this[_0x2c7d('0xb')]=_0x1e4ba1[_0x2c7d('0xb')];this['dialOriginateTimeout']=_0x1e4ba1[_0x2c7d('0xc')]||0x1e;this[_0x2c7d('0xd')]=_0x1e4ba1[_0x2c7d('0xd')];this[_0x2c7d('0xe')]=_0x1e4ba1[_0x2c7d('0xe')];this[_0x2c7d('0xf')]=_0x1e4ba1[_0x2c7d('0xf')];this[_0x2c7d('0x10')]=_0x1e4ba1[_0x2c7d('0x10')];this[_0x2c7d('0x11')]=_0x1e4ba1['dialNoAnswerMaxRetry'];this[_0x2c7d('0x12')]=_0x1e4ba1[_0x2c7d('0x12')];this[_0x2c7d('0x13')]=_0x1e4ba1[_0x2c7d('0x13')];this[_0x2c7d('0x14')]=_0x1e4ba1['dialNoSuchNumberMaxRetry']||0x3;this[_0x2c7d('0x15')]=_0x1e4ba1[_0x2c7d('0x15')]||0x96;this[_0x2c7d('0x16')]=_0x1e4ba1[_0x2c7d('0x16')]||0x3;this[_0x2c7d('0x17')]=_0x1e4ba1[_0x2c7d('0x17')]||0x96;this[_0x2c7d('0x18')]=_0x1e4ba1[_0x2c7d('0x18')]||0x3;this[_0x2c7d('0x19')]=_0x1e4ba1[_0x2c7d('0x19')]||0x96;this[_0x2c7d('0x1a')]=_0x1e4ba1['dialMachineMaxRetry']||0x3;this[_0x2c7d('0x1b')]=_0x1e4ba1['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x1e4ba1[_0x2c7d('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1e4ba1[_0x2c7d('0x1d')]||0x96;this[_0x2c7d('0x1e')]=_0x1e4ba1[_0x2c7d('0x1e')]||'DESC';this[_0x2c7d('0x1f')]=_0x1e4ba1[_0x2c7d('0x1f')]||undefined;this[_0x2c7d('0x20')]=_0x1e4ba1[_0x2c7d('0x20')]||undefined;this[_0x2c7d('0x21')]=_0x1e4ba1[_0x2c7d('0x21')]||undefined;this[_0x2c7d('0x22')]=_0x1e4ba1['TrunkBackup']?_0x1e4ba1[_0x2c7d('0x22')]:undefined;this['Trunk']=_0x1e4ba1['Trunk']?_0x1e4ba1[_0x2c7d('0x23')]:undefined;this[_0x2c7d('0x24')]=_0x1e4ba1[_0x2c7d('0x24')]?_0x1e4ba1[_0x2c7d('0x24')]:undefined;this[_0x2c7d('0x25')]=_0x1e4ba1['SquareProject']?_0x1e4ba1[_0x2c7d('0x25')]:undefined;this[_0x2c7d('0x26')]=_0x1e4ba1[_0x2c7d('0x25')]?_0x1e4ba1[_0x2c7d('0x25')][_0x2c7d('0x0')]:undefined;this[_0x2c7d('0x27')]=_0x1e4ba1[_0x2c7d('0x27')]||![];this[_0x2c7d('0x28')]=_0x1e4ba1[_0x2c7d('0x28')];this[_0x2c7d('0x29')]=_0x1e4ba1['dialAMDGreeting'];this[_0x2c7d('0x2a')]=_0x1e4ba1[_0x2c7d('0x2a')];this[_0x2c7d('0x2b')]=_0x1e4ba1[_0x2c7d('0x2b')];this[_0x2c7d('0x2c')]=_0x1e4ba1[_0x2c7d('0x2c')];this[_0x2c7d('0x2d')]=_0x1e4ba1[_0x2c7d('0x2d')];this[_0x2c7d('0x2e')]=_0x1e4ba1['dialAMDMaximumNumberOfWords'];this[_0x2c7d('0x2f')]=_0x1e4ba1[_0x2c7d('0x2f')];this[_0x2c7d('0x30')]=_0x1e4ba1[_0x2c7d('0x30')];}module[_0x2c7d('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 3af6542..74aa92f 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 _0x37e4=['context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode'];(function(_0x35b0de,_0x3dcd64){var _0x233364=function(_0x4317b1){while(--_0x4317b1){_0x35b0de['push'](_0x35b0de['shift']());}};_0x233364(++_0x3dcd64);}(_0x37e4,0x18e));var _0x437e=function(_0x337e8f,_0x458616){_0x337e8f=_0x337e8f-0x0;var _0x132e56=_0x37e4[_0x337e8f];return _0x132e56;};'use strict';function Channel(){this[_0x437e('0x0')]=null;this[_0x437e('0x1')]='';this['destinationchannel']='';this[_0x437e('0x2')]=0x0;this[_0x437e('0x3')]='';this[_0x437e('0x4')]=undefined;this[_0x437e('0x5')]=undefined;this[_0x437e('0x6')]=0x0;this[_0x437e('0x7')]='';this[_0x437e('0x8')]=0x0;this[_0x437e('0x9')]=0x0;this[_0x437e('0xa')]=0x0;this[_0x437e('0xb')]=![];this[_0x437e('0xc')]=null;this[_0x437e('0xd')]=null;this[_0x437e('0xe')]=![];this[_0x437e('0xf')]=![];this[_0x437e('0x10')]='';this['lastdata']='';this[_0x437e('0x11')]=0x0;this['billableseconds']=0x0;this[_0x437e('0x12')]=0x0;this[_0x437e('0x13')]=null;this['tag']=null;this[_0x437e('0x14')]=null;this[_0x437e('0x15')]=![];this[_0x437e('0x16')]=null;this[_0x437e('0x17')]=null;this[_0x437e('0x18')]=[];this[_0x437e('0x19')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x437e('0x1a')]=Channel; \ No newline at end of file +var _0xa44d=['calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel'];(function(_0x340c58,_0x2a9a12){var _0x1f5c5b=function(_0xd3e78d){while(--_0xd3e78d){_0x340c58['push'](_0x340c58['shift']());}};_0x1f5c5b(++_0x2a9a12);}(_0xa44d,0x1ce));var _0xda44=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0xa44d[_0x39ea42];return _0x33f5b7;};'use strict';function Channel(){this[_0xda44('0x0')]=null;this['channel']='';this[_0xda44('0x1')]='';this[_0xda44('0x2')]=0x0;this[_0xda44('0x3')]='';this[_0xda44('0x4')]=undefined;this[_0xda44('0x5')]=undefined;this[_0xda44('0x6')]=0x0;this[_0xda44('0x7')]='';this[_0xda44('0x8')]=0x0;this[_0xda44('0x9')]=0x0;this[_0xda44('0xa')]=0x0;this['answered']=![];this[_0xda44('0xb')]=null;this['endtime']=null;this[_0xda44('0xc')]=![];this[_0xda44('0xd')]=![];this[_0xda44('0xe')]='';this[_0xda44('0xf')]='';this['duration']=0x0;this[_0xda44('0x10')]=0x0;this[_0xda44('0x11')]=0x0;this[_0xda44('0x12')]=null;this[_0xda44('0x13')]=null;this[_0xda44('0x14')]=null;this[_0xda44('0x15')]=![];this['monitorFilename']=null;this[_0xda44('0x16')]=null;this[_0xda44('0x17')]=[];this[_0xda44('0x18')]=undefined;this[_0xda44('0x19')]=undefined;this[_0xda44('0x1a')]=undefined;this[_0xda44('0x1b')]=0x0;}module[_0xda44('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3fdf1fe..5a41863 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 _0x678d=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x678d,0x99));var _0xd678=function(_0x30a001,_0x4dc853){_0x30a001=_0x30a001-0x0;var _0x1b61e2=_0x678d[_0x30a001];return _0x1b61e2;};'use strict';function DeskAccount(_0x256e3f){this['id']=_0x256e3f['id']||0x0;this[_0xd678('0x0')]=_0x256e3f[_0xd678('0x0')]||'';this[_0xd678('0x1')]=_0x256e3f['username']||'';this[_0xd678('0x2')]=_0x256e3f[_0xd678('0x2')]||'';this[_0xd678('0x3')]=_0x256e3f[_0xd678('0x3')]||'';this[_0xd678('0x4')]=_0x256e3f['password']||'';this[_0xd678('0x5')]=_0x256e3f[_0xd678('0x5')]||'';this['consumerSecret']=_0x256e3f[_0xd678('0x6')]||'';this[_0xd678('0x7')]=_0x256e3f[_0xd678('0x7')]||'';this[_0xd678('0x8')]=_0x256e3f['tokenSecret']||'';this['type']=_0x256e3f[_0xd678('0x9')]||'';this['serverUrl']=_0x256e3f[_0xd678('0xa')]||'';this[_0xd678('0xb')]=_0x256e3f['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xe88e=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x54c86b,_0x3c7d0c){var _0x72ca77=function(_0x36bdf3){while(--_0x36bdf3){_0x54c86b['push'](_0x54c86b['shift']());}};_0x72ca77(++_0x3c7d0c);}(_0xe88e,0x18e));var _0xee88=function(_0x116c04,_0x4963da){_0x116c04=_0x116c04-0x0;var _0x9e011d=_0xe88e[_0x116c04];return _0x9e011d;};'use strict';function DeskAccount(_0x547613){this['id']=_0x547613['id']||0x0;this[_0xee88('0x0')]=_0x547613[_0xee88('0x0')]||'';this[_0xee88('0x1')]=_0x547613[_0xee88('0x1')]||'';this[_0xee88('0x2')]=_0x547613[_0xee88('0x2')]||'';this[_0xee88('0x3')]=_0x547613['authType']||'';this[_0xee88('0x4')]=_0x547613[_0xee88('0x4')]||'';this[_0xee88('0x5')]=_0x547613[_0xee88('0x5')]||'';this[_0xee88('0x6')]=_0x547613[_0xee88('0x6')]||'';this[_0xee88('0x7')]=_0x547613[_0xee88('0x7')]||'';this[_0xee88('0x8')]=_0x547613[_0xee88('0x8')]||'';this[_0xee88('0x9')]=_0x547613[_0xee88('0x9')]||'';this[_0xee88('0xa')]=_0x547613[_0xee88('0xa')]||'';this['Configurations']=_0x547613[_0xee88('0xb')]||{};}module[_0xee88('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 109f867..c263193 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 _0xf84b=['password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x36c9c4,_0x4854b4){var _0x116c1f=function(_0x586157){while(--_0x586157){_0x36c9c4['push'](_0x36c9c4['shift']());}};_0x116c1f(++_0x4854b4);}(_0xf84b,0xe5));var _0xbf84=function(_0x303072,_0x5ce398){_0x303072=_0x303072-0x0;var _0x463b4a=_0xf84b[_0x303072];return _0x463b4a;};'use strict';function Dynamics365Account(_0x57f29d){this['id']=_0x57f29d['id']||0x0;this[_0xbf84('0x0')]=_0x57f29d[_0xbf84('0x0')]||'';this[_0xbf84('0x1')]=_0x57f29d['username']||'';this['password']=_0x57f29d[_0xbf84('0x2')]||'';this[_0xbf84('0x3')]=_0x57f29d[_0xbf84('0x3')]||'';this['tenantId']=_0x57f29d['tenantId']||'';this[_0xbf84('0x4')]=_0x57f29d['clientId']||'';this['clientSecret']=_0x57f29d[_0xbf84('0x5')]||{};this[_0xbf84('0x6')]=_0x57f29d['serverUrl']||'';this[_0xbf84('0x7')]=_0x57f29d['modernAuthentication']||![];this['Configurations']=_0x57f29d[_0xbf84('0x8')]||{};this[_0xbf84('0x9')]=_0x57f29d['CloudProvider']||{};}module[_0xbf84('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xf114=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x4d3ff9,_0x22653f){var _0x21a8b5=function(_0x3256c4){while(--_0x3256c4){_0x4d3ff9['push'](_0x4d3ff9['shift']());}};_0x21a8b5(++_0x22653f);}(_0xf114,0xfe));var _0x4f11=function(_0x3d02b7,_0x2e6879){_0x3d02b7=_0x3d02b7-0x0;var _0x537438=_0xf114[_0x3d02b7];return _0x537438;};'use strict';function Dynamics365Account(_0x470c85){this['id']=_0x470c85['id']||0x0;this[_0x4f11('0x0')]=_0x470c85['name']||'';this[_0x4f11('0x1')]=_0x470c85[_0x4f11('0x1')]||'';this[_0x4f11('0x2')]=_0x470c85[_0x4f11('0x2')]||'';this[_0x4f11('0x3')]=_0x470c85[_0x4f11('0x3')]||'';this[_0x4f11('0x4')]=_0x470c85[_0x4f11('0x4')]||'';this[_0x4f11('0x5')]=_0x470c85['clientId']||'';this[_0x4f11('0x6')]=_0x470c85[_0x4f11('0x6')]||{};this[_0x4f11('0x7')]=_0x470c85[_0x4f11('0x7')]||'';this[_0x4f11('0x8')]=_0x470c85[_0x4f11('0x8')]||![];this['Configurations']=_0x470c85[_0x4f11('0x9')]||{};this[_0x4f11('0xa')]=_0x470c85[_0x4f11('0xa')]||{};}module[_0x4f11('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 3e80dcd..94a8132 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 _0x2b65=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x229dc4,_0x2162d4){var _0x584bc9=function(_0x323273){while(--_0x323273){_0x229dc4['push'](_0x229dc4['shift']());}};_0x584bc9(++_0x2162d4);}(_0x2b65,0x10a));var _0x52b6=function(_0x277563,_0x566184){_0x277563=_0x277563-0x0;var _0xc114d5=_0x2b65[_0x277563];return _0xc114d5;};'use strict';function FaxAccount(_0x470913){this['id']=_0x470913['id']||0x0;this[_0x52b6('0x0')]=_0x470913['name']||'';this[_0x52b6('0x1')]=_0x470913[_0x52b6('0x1')];this[_0x52b6('0x2')]=_0x470913['ecm'];this[_0x52b6('0x3')]=_0x470913[_0x52b6('0x3')];this[_0x52b6('0x4')]=_0x470913[_0x52b6('0x4')];this[_0x52b6('0x5')]=_0x470913[_0x52b6('0x5')]||0x960;this['maxrate']=_0x470913[_0x52b6('0x6')]||0x3840;this[_0x52b6('0x7')]=_0x470913['modem']||_0x52b6('0x8');this['gateway']=_0x470913[_0x52b6('0x9')]||'no';this['faxdetect']=_0x470913[_0x52b6('0xa')]||'no';this[_0x52b6('0xb')]=_0x470913[_0x52b6('0xb')]||0x1388;this[_0x52b6('0xc')]=_0x470913[_0x52b6('0xc')]||_0x52b6('0xd');this[_0x52b6('0xe')]=_0x470913[_0x52b6('0xe')]?_0x470913[_0x52b6('0xe')]:undefined;this['ListId']=_0x470913[_0x52b6('0xf')];this['key']=_0x470913[_0x52b6('0x10')];}module[_0x52b6('0x11')]=FaxAccount; \ No newline at end of file +var _0x79cc=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79cc,0xc5));var _0xc79c=function(_0x5b6efe,_0x232c52){_0x5b6efe=_0x5b6efe-0x0;var _0x3b9e6c=_0x79cc[_0x5b6efe];return _0x3b9e6c;};'use strict';function FaxAccount(_0x5f5193){this['id']=_0x5f5193['id']||0x0;this[_0xc79c('0x0')]=_0x5f5193['name']||'';this['description']=_0x5f5193[_0xc79c('0x1')];this[_0xc79c('0x2')]=_0x5f5193['ecm'];this[_0xc79c('0x3')]=_0x5f5193[_0xc79c('0x3')];this[_0xc79c('0x4')]=_0x5f5193[_0xc79c('0x4')];this[_0xc79c('0x5')]=_0x5f5193['minrate']||0x960;this[_0xc79c('0x6')]=_0x5f5193[_0xc79c('0x6')]||0x3840;this[_0xc79c('0x7')]=_0x5f5193[_0xc79c('0x7')]||_0xc79c('0x8');this[_0xc79c('0x9')]=_0x5f5193[_0xc79c('0x9')]||'no';this[_0xc79c('0xa')]=_0x5f5193[_0xc79c('0xa')]||'no';this['t38timeout']=_0x5f5193[_0xc79c('0xb')]||0x1388;this[_0xc79c('0xc')]=_0x5f5193[_0xc79c('0xc')]||'SIP';this[_0xc79c('0xd')]=_0x5f5193[_0xc79c('0xd')]?_0x5f5193['Trunk']:undefined;this['ListId']=_0x5f5193[_0xc79c('0xe')];this[_0xc79c('0xf')]=_0x5f5193[_0xc79c('0xf')];}module[_0xc79c('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f35f83e..081f063 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 _0xaa09=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xaa09,0x105));var _0x9aa0=function(_0x382fb1,_0x3d5300){_0x382fb1=_0x382fb1-0x0;var _0x59ab64=_0xaa09[_0x382fb1];return _0x59ab64;};'use strict';function FreshdeskAccount(_0x4e936e){this['id']=_0x4e936e['id']||0x0;this[_0x9aa0('0x0')]=_0x4e936e[_0x9aa0('0x0')]||'';this[_0x9aa0('0x1')]=_0x4e936e[_0x9aa0('0x1')]||'';this[_0x9aa0('0x2')]=_0x4e936e[_0x9aa0('0x3')]||'';this[_0x9aa0('0x4')]=_0x4e936e[_0x9aa0('0x4')]||'';this[_0x9aa0('0x5')]=_0x4e936e[_0x9aa0('0x5')]||'';this[_0x9aa0('0x6')]=_0x4e936e[_0x9aa0('0x6')]||{};}module[_0x9aa0('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xa550=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x533488,_0xfa8aff){var _0x3d0bc9=function(_0xd32e50){while(--_0xd32e50){_0x533488['push'](_0x533488['shift']());}};_0x3d0bc9(++_0xfa8aff);}(_0xa550,0x154));var _0x0a55=function(_0x15606a,_0x562872){_0x15606a=_0x15606a-0x0;var _0x16a540=_0xa550[_0x15606a];return _0x16a540;};'use strict';function FreshdeskAccount(_0x1cdf8b){this['id']=_0x1cdf8b['id']||0x0;this[_0x0a55('0x0')]=_0x1cdf8b[_0x0a55('0x0')]||'';this[_0x0a55('0x1')]=_0x1cdf8b['username']||'';this[_0x0a55('0x2')]=_0x1cdf8b[_0x0a55('0x3')]||'';this[_0x0a55('0x4')]=_0x1cdf8b[_0x0a55('0x4')]||'';this[_0x0a55('0x5')]=_0x1cdf8b[_0x0a55('0x5')]||'';this[_0x0a55('0x6')]=_0x1cdf8b[_0x0a55('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 26a1baa..20992d5 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 _0x9305=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x9305,0x1e2));var _0x5930=function(_0x108ba6,_0x19c594){_0x108ba6=_0x108ba6-0x0;var _0x4b5d6d=_0x9305[_0x108ba6];return _0x4b5d6d;};'use strict';function FreshsalesAccount(_0x2a1952){this['id']=_0x2a1952['id']||0x0;this[_0x5930('0x0')]=_0x2a1952[_0x5930('0x0')]||'';this[_0x5930('0x1')]=_0x2a1952['username']||'';this[_0x5930('0x2')]=_0x2a1952[_0x5930('0x3')]||'';this[_0x5930('0x4')]=_0x2a1952[_0x5930('0x4')]||'';this['serverUrl']=_0x2a1952[_0x5930('0x5')]||'';this[_0x5930('0x6')]=_0x2a1952[_0x5930('0x6')]||{};}module[_0x5930('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x96e0=['name','apiKey','token','remoteUri','Configurations','exports'];(function(_0xf67fa7,_0x3dbf9e){var _0xd2e6d7=function(_0x3ade7e){while(--_0x3ade7e){_0xf67fa7['push'](_0xf67fa7['shift']());}};_0xd2e6d7(++_0x3dbf9e);}(_0x96e0,0x7e));var _0x096e=function(_0xb2c284,_0x1c4af1){_0xb2c284=_0xb2c284-0x0;var _0x57abdf=_0x96e0[_0xb2c284];return _0x57abdf;};'use strict';function FreshsalesAccount(_0x27fe90){this['id']=_0x27fe90['id']||0x0;this['name']=_0x27fe90[_0x096e('0x0')]||'';this['username']=_0x27fe90['username']||'';this[_0x096e('0x1')]=_0x27fe90[_0x096e('0x2')]||'';this[_0x096e('0x3')]=_0x27fe90[_0x096e('0x3')]||'';this['serverUrl']=_0x27fe90['serverUrl']||'';this['Configurations']=_0x27fe90[_0x096e('0x4')]||{};}module[_0x096e('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 682edbc..63abdea 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 _0x5de7=['position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','type','calleridnum','calleridname','queue','queuecallerleaveAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5de7,0x11b));var _0x75de=function(_0x235b77,_0x15a519){_0x235b77=_0x235b77-0x0;var _0x5570e8=_0x5de7[_0x235b77];return _0x5570e8;};'use strict';function QueueReport(){this[_0x75de('0x0')]='inbound';this['uniqueid']='';this[_0x75de('0x1')]='';this[_0x75de('0x2')]='';this[_0x75de('0x3')]='';this['queuecallerjoinAt']=null;this[_0x75de('0x4')]=null;this[_0x75de('0x5')]=0x1;this[_0x75de('0x6')]=0x1;this[_0x75de('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x75de('0x8')]=![];this[_0x75de('0x9')]=null;this[_0x75de('0xa')]=![];this[_0x75de('0xb')]=null;this[_0x75de('0xc')]=0x1;this[_0x75de('0xd')]='';this[_0x75de('0xe')]='';this[_0x75de('0xf')]='';this[_0x75de('0x10')]='';this[_0x75de('0x11')]='';this[_0x75de('0x12')]='';this[_0x75de('0x13')]='';this[_0x75de('0x14')]=0x0;this['assigned']=![];this[_0x75de('0x15')]='';this[_0x75de('0x16')]=_0x75de('0x17');this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xcc80=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x5a509f,_0x31a7e3){var _0x156687=function(_0x368416){while(--_0x368416){_0x5a509f['push'](_0x5a509f['shift']());}};_0x156687(++_0x31a7e3);}(_0xcc80,0x189));var _0x0cc8=function(_0xf8c28,_0x3ff6c0){_0xf8c28=_0xf8c28-0x0;var _0x392e6b=_0xcc80[_0xf8c28];return _0x392e6b;};'use strict';function QueueReport(){this[_0x0cc8('0x0')]=_0x0cc8('0x1');this[_0x0cc8('0x2')]='';this[_0x0cc8('0x3')]='';this[_0x0cc8('0x4')]='';this[_0x0cc8('0x5')]='';this[_0x0cc8('0x6')]=null;this[_0x0cc8('0x7')]=null;this[_0x0cc8('0x8')]=0x1;this[_0x0cc8('0x9')]=0x1;this[_0x0cc8('0xa')]=![];this[_0x0cc8('0xb')]=null;this[_0x0cc8('0xc')]=![];this[_0x0cc8('0xd')]=null;this['queuecallerexit']=![];this[_0x0cc8('0xe')]=null;this['originalposition']=0x1;this[_0x0cc8('0xf')]='';this[_0x0cc8('0x10')]='';this[_0x0cc8('0x11')]='';this['accountcode']='';this[_0x0cc8('0x12')]='';this[_0x0cc8('0x13')]='';this[_0x0cc8('0x14')]='';this[_0x0cc8('0x15')]=0x0;this[_0x0cc8('0x16')]=![];this[_0x0cc8('0x17')]='';this[_0x0cc8('0x18')]='voice';this[_0x0cc8('0x19')]=0x0;this['variables']={};}module[_0x0cc8('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 24607ed..fa4ba68 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 _0x1642=['name','username','password','clientId','type','integrationTab','serverUrl','exports'];(function(_0xce51bb,_0x58dcd2){var _0x3ae531=function(_0xb42795){while(--_0xb42795){_0xce51bb['push'](_0xce51bb['shift']());}};_0x3ae531(++_0x58dcd2);}(_0x1642,0x1e8));var _0x2164=function(_0x71e723,_0x475791){_0x71e723=_0x71e723-0x0;var _0x4d13e4=_0x1642[_0x71e723];return _0x4d13e4;};'use strict';function SalesforceAccount(_0x38d38e){this['id']=_0x38d38e['id']||0x0;this['name']=_0x38d38e[_0x2164('0x0')]||'';this[_0x2164('0x1')]=_0x38d38e['username']||'';this['remoteUri']=_0x38d38e['remoteUri']||'';this[_0x2164('0x2')]=_0x38d38e['password']||'';this[_0x2164('0x3')]=_0x38d38e[_0x2164('0x3')]||'';this['clientSecret']=_0x38d38e['clientSecret']||'';this['securityToken']=_0x38d38e['securityToken']||'';this[_0x2164('0x4')]=_0x38d38e[_0x2164('0x4')]||_0x2164('0x5');this[_0x2164('0x6')]=_0x38d38e[_0x2164('0x6')]||'';this['Configurations']=_0x38d38e['Configurations']||{};}module[_0x2164('0x7')]=SalesforceAccount; \ No newline at end of file +var _0x73b3=['password','clientId','clientSecret','securityToken','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x73b3,0x1ab));var _0x373b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x73b3[_0x4bfac3];return _0x15f0f2;};'use strict';function SalesforceAccount(_0x1804b2){this['id']=_0x1804b2['id']||0x0;this[_0x373b('0x0')]=_0x1804b2[_0x373b('0x0')]||'';this[_0x373b('0x1')]=_0x1804b2[_0x373b('0x1')]||'';this[_0x373b('0x2')]=_0x1804b2[_0x373b('0x2')]||'';this[_0x373b('0x3')]=_0x1804b2[_0x373b('0x3')]||'';this[_0x373b('0x4')]=_0x1804b2[_0x373b('0x4')]||'';this['clientSecret']=_0x1804b2[_0x373b('0x5')]||'';this['securityToken']=_0x1804b2[_0x373b('0x6')]||'';this['type']=_0x1804b2['type']||'integrationTab';this[_0x373b('0x7')]=_0x1804b2[_0x373b('0x7')]||'';this[_0x373b('0x8')]=_0x1804b2[_0x373b('0x8')]||{};}module[_0x373b('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 b1195a9..a6f814b 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 _0x6f31=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3ee8b1,_0x375088){var _0x53aa77=function(_0x191971){while(--_0x191971){_0x3ee8b1['push'](_0x3ee8b1['shift']());}};_0x53aa77(++_0x375088);}(_0x6f31,0x138));var _0x16f3=function(_0x467f31,_0x428b20){_0x467f31=_0x467f31-0x0;var _0x1689d6=_0x6f31[_0x467f31];return _0x1689d6;};'use strict';function ServicenowAccount(_0x4ab033){this['id']=_0x4ab033['id']||0x0;this[_0x16f3('0x0')]=_0x4ab033['name']||'';this[_0x16f3('0x1')]=_0x4ab033[_0x16f3('0x1')]||'';this['password']=_0x4ab033[_0x16f3('0x2')]||'';this[_0x16f3('0x3')]=_0x4ab033['remoteUri']||'';this[_0x16f3('0x4')]=_0x4ab033[_0x16f3('0x4')]||'';this[_0x16f3('0x5')]=_0x4ab033[_0x16f3('0x5')]||{};}module[_0x16f3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x360a=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x360a,0x81));var _0xa360=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x360a[_0x138adb];return _0x1b27f2;};'use strict';function ServicenowAccount(_0x273b8f){this['id']=_0x273b8f['id']||0x0;this[_0xa360('0x0')]=_0x273b8f[_0xa360('0x0')]||'';this[_0xa360('0x1')]=_0x273b8f[_0xa360('0x1')]||'';this['password']=_0x273b8f[_0xa360('0x2')]||'';this['remoteUri']=_0x273b8f[_0xa360('0x3')]||'';this[_0xa360('0x4')]=_0x273b8f[_0xa360('0x4')]||'';this[_0xa360('0x5')]=_0x273b8f[_0xa360('0x5')]||{};}module[_0xa360('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 2ecac17..c982b72 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 _0x7faa=['remoteUri','serverUrl','name','username','password'];(function(_0x45ec6b,_0x32134f){var _0x496c8a=function(_0x19689e){while(--_0x19689e){_0x45ec6b['push'](_0x45ec6b['shift']());}};_0x496c8a(++_0x32134f);}(_0x7faa,0x156));var _0xa7fa=function(_0x24757c,_0x1ed7e8){_0x24757c=_0x24757c-0x0;var _0x4405e5=_0x7faa[_0x24757c];return _0x4405e5;};'use strict';function SugarcrmAccount(_0x2664f5){this['id']=_0x2664f5['id']||0x0;this[_0xa7fa('0x0')]=_0x2664f5[_0xa7fa('0x0')]||'';this[_0xa7fa('0x1')]=_0x2664f5['username']||'';this[_0xa7fa('0x2')]=_0x2664f5['password']||'';this[_0xa7fa('0x3')]=_0x2664f5[_0xa7fa('0x3')]||'';this[_0xa7fa('0x4')]=_0x2664f5['serverUrl']||'';this['Configurations']=_0x2664f5['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xfa3e=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xb2b48b,_0x3c0594){var _0x378702=function(_0x1c3ffe){while(--_0x1c3ffe){_0xb2b48b['push'](_0xb2b48b['shift']());}};_0x378702(++_0x3c0594);}(_0xfa3e,0xf0));var _0xefa3=function(_0xcf8be,_0x10f828){_0xcf8be=_0xcf8be-0x0;var _0x70a657=_0xfa3e[_0xcf8be];return _0x70a657;};'use strict';function SugarcrmAccount(_0x125f09){this['id']=_0x125f09['id']||0x0;this[_0xefa3('0x0')]=_0x125f09[_0xefa3('0x0')]||'';this['username']=_0x125f09[_0xefa3('0x1')]||'';this['password']=_0x125f09[_0xefa3('0x2')]||'';this[_0xefa3('0x3')]=_0x125f09[_0xefa3('0x3')]||'';this[_0xefa3('0x4')]=_0x125f09[_0xefa3('0x4')]||'';this[_0xefa3('0x5')]=_0x125f09[_0xefa3('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ca44b21..7bb14af 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 _0xe730=['status','unknown','address','exports','name','accountcode','state'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xe730,0xf2));var _0x0e73=function(_0x98459f,_0x4dfb55){_0x98459f=_0x98459f-0x0;var _0x128f94=_0xe730[_0x98459f];return _0x128f94;};'use strict';function Telephone(_0x2ad2ff){this['id']=_0x2ad2ff['id']||0x0;this[_0x0e73('0x0')]=_0x2ad2ff[_0x0e73('0x0')]||'';this[_0x0e73('0x1')]=_0x2ad2ff[_0x0e73('0x1')]||'';this[_0x0e73('0x2')]='unknown';this['stateTime']=0x0;this[_0x0e73('0x3')]=_0x0e73('0x4');this[_0x0e73('0x5')]='';}module[_0x0e73('0x6')]=Telephone; \ No newline at end of file +var _0xcc94=['state','unknown','address','exports','name','accountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc94,0xee));var _0x4cc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc94[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x6eeb0d){this['id']=_0x6eeb0d['id']||0x0;this[_0x4cc9('0x0')]=_0x6eeb0d[_0x4cc9('0x0')]||'';this[_0x4cc9('0x1')]=_0x6eeb0d[_0x4cc9('0x1')]||'';this[_0x4cc9('0x2')]=_0x4cc9('0x3');this['stateTime']=0x0;this['status']=_0x4cc9('0x3');this[_0x4cc9('0x4')]='';}module[_0x4cc9('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 13adbc1..d93a873 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(_0x31eceb,_0x5bd238){var _0x5f80cb=function(_0x59296e){while(--_0x59296e){_0x31eceb['push'](_0x31eceb['shift']());}};_0x5f80cb(++_0x5bd238);}(_0xb10b,0x12a));var _0xbb10=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0xb10b[_0x40348a];return _0x290d46;};'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 _0xa9e0=['exports','name'];(function(_0x154ba5,_0x37b9df){var _0x4332c6=function(_0x184e5a){while(--_0x184e5a){_0x154ba5['push'](_0x154ba5['shift']());}};_0x4332c6(++_0x37b9df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 1e5ec6a..8c201ca 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x53ed5f,_0x3d5a61){_0x53ed5f=_0x53ed5f-0x0;var _0x2ca18d=_0x0b0e[_0x53ed5f];return _0x2ca18d;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x5df55d,_0x590727){var _0x36b1f0=function(_0xc97cf8){while(--_0xc97cf8){_0x5df55d['push'](_0x5df55d['shift']());}};_0x36b1f0(++_0x590727);}(_0x8603,0x190));var _0x3860=function(_0x1abd98,_0x4efa0b){_0x1abd98=_0x1abd98-0x0;var _0x547194=_0x8603[_0x1abd98];return _0x547194;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('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 8e2fae2..88b7f83 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 _0xeb7f=['exports','active','name','state','unknown','stateTime','status','registry','indexOf','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser'];(function(_0x5f5981,_0x47aed2){var _0x1bd330=function(_0x4c4fc7){while(--_0x4c4fc7){_0x5f5981['push'](_0x5f5981['shift']());}};_0x1bd330(++_0x47aed2);}(_0xeb7f,0x131));var _0xfeb7=function(_0x3e2a49,_0x116a25){_0x3e2a49=_0x3e2a49-0x0;var _0x473685=_0xeb7f[_0x3e2a49];return _0x473685;};'use strict';function Trunk(_0x17c9f8){this['id']=_0x17c9f8['id']||0x0;this['active']=_0x17c9f8[_0xfeb7('0x0')]||![];this[_0xfeb7('0x1')]=_0x17c9f8[_0xfeb7('0x1')]||'';this[_0xfeb7('0x2')]=_0xfeb7('0x3');this[_0xfeb7('0x4')]=0x0;this[_0xfeb7('0x5')]='unknown';this[_0xfeb7('0x6')]=_0x17c9f8[_0xfeb7('0x6')]&&_0x17c9f8[_0xfeb7('0x6')][_0xfeb7('0x7')](':')?_0x17c9f8[_0xfeb7('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0xfeb7('0x8')]='';this[_0xfeb7('0x9')]='';this[_0xfeb7('0xa')]='';this['refresh']='';this[_0xfeb7('0xb')]='unknown';this[_0xfeb7('0xc')]='';this[_0xfeb7('0xd')]='';this[_0xfeb7('0xe')]=_0x17c9f8['defaultuser']||'';}module[_0xfeb7('0xf')]=Trunk; \ No newline at end of file +var _0x6b81=['registrationtime','address','exports','active','state','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','stateRegistry'];(function(_0x2f5369,_0x2e891a){var _0x30bc32=function(_0x58f9ec){while(--_0x58f9ec){_0x2f5369['push'](_0x2f5369['shift']());}};_0x30bc32(++_0x2e891a);}(_0x6b81,0xd5));var _0x16b8=function(_0x3aa321,_0x5bcde5){_0x3aa321=_0x3aa321-0x0;var _0x2bc5a5=_0x6b81[_0x3aa321];return _0x2bc5a5;};'use strict';function Trunk(_0x4881fd){this['id']=_0x4881fd['id']||0x0;this[_0x16b8('0x0')]=_0x4881fd[_0x16b8('0x0')]||![];this['name']=_0x4881fd['name']||'';this[_0x16b8('0x1')]=_0x16b8('0x2');this[_0x16b8('0x3')]=0x0;this[_0x16b8('0x4')]=_0x16b8('0x2');this['registry']=_0x4881fd[_0x16b8('0x5')]&&_0x4881fd['registry'][_0x16b8('0x6')](':')?_0x4881fd[_0x16b8('0x5')][_0x16b8('0x7')](':')[0x0]:'';this[_0x16b8('0x8')]='';this['port']='';this[_0x16b8('0x9')]='';this[_0x16b8('0xa')]='';this['refresh']='';this[_0x16b8('0xb')]='unknown';this[_0x16b8('0xc')]='';this[_0x16b8('0xd')]='';this['defaultuser']=_0x4881fd['defaultuser']||'';}module[_0x16b8('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4c0b92c..4d376b1 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 _0x4b9d=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x5f15df,_0x960bb7){var _0x388f8d=function(_0x38657b){while(--_0x38657b){_0x5f15df['push'](_0x5f15df['shift']());}};_0x388f8d(++_0x960bb7);}(_0x4b9d,0xa7));var _0xd4b9=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x4b9d[_0x1d1d09];return _0x8827e;};'use strict';function voiceExtension(_0x1f2e3e){this['id']=_0x1f2e3e['id']||0x0;this[_0xd4b9('0x0')]=_0x1f2e3e[_0xd4b9('0x0')]||'';this[_0xd4b9('0x1')]=_0x1f2e3e['recordingFormat']||_0xd4b9('0x2');this[_0xd4b9('0x3')]=_0x1f2e3e[_0xd4b9('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x83d0=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0xbf18f,_0x50d900){var _0x2ad72a=function(_0x3bd025){while(--_0x3bd025){_0xbf18f['push'](_0xbf18f['shift']());}};_0x2ad72a(++_0x50d900);}(_0x83d0,0xf8));var _0x083d=function(_0x17cf32,_0x52aed7){_0x17cf32=_0x17cf32-0x0;var _0x46819c=_0x83d0[_0x17cf32];return _0x46819c;};'use strict';function voiceExtension(_0x5b85b1){this['id']=_0x5b85b1['id']||0x0;this[_0x083d('0x0')]=_0x5b85b1[_0x083d('0x0')]||'';this[_0x083d('0x1')]=_0x5b85b1['recordingFormat']||_0x083d('0x2');this[_0x083d('0x3')]=_0x5b85b1[_0x083d('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 e740f93..dca60fb 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 _0x4489=['sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','name','monitor_format','type','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','unavailable','unknown','acw','acwTimeout','autopause'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':_0x9448('0x0'),'wav49':_0x9448('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x9448('0x2'),'leastrecent':_0x9448('0x3'),'linear':_0x9448('0x4'),'random':_0x9448('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':'rrmemory','rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x117d3a){this['id']=_0x117d3a['id']||0x0;this['name']=_0x117d3a[_0x9448('0x6')]||'';this['monitor_format']=_0x117d3a[_0x9448('0x7')]||'';this[_0x9448('0x8')]=_0x117d3a[_0x9448('0x8')]||'inbound';this['waiting']=0x0;this['total']=0x0;this[_0x9448('0x9')]=0x0;this[_0x9448('0xa')]=0x0;this[_0x9448('0xb')]=0x0;this[_0x9448('0xc')]=0x0;this[_0x9448('0xd')]=0x0;this['abandoned']=0x0;this[_0x9448('0xe')]=0x0;this[_0x9448('0xf')]=0x0;this[_0x9448('0x10')]=0x0;this[_0x9448('0x11')]=0x0;this[_0x9448('0x12')]=0x0;this[_0x9448('0x13')]=0x0;this[_0x9448('0x14')]=0x0;this[_0x9448('0x15')]=0x0;this['ringing']=0x0;this[_0x9448('0x16')]=0x0;this['talking']=0x0;this[_0x9448('0x17')]=0x0;this[_0x9448('0x18')]=0x0;this['acw']=_0x117d3a[_0x9448('0x19')]||![];this[_0x9448('0x1a')]=_0x117d3a[_0x9448('0x1a')]||0xa;this[_0x9448('0x1b')]=_0x117d3a[_0x9448('0x1b')]||'no';this[_0x9448('0x1c')]=!![];this[_0x9448('0x1d')]='';this[_0x9448('0x1e')]='';this['originated']=0x0;this[_0x9448('0x1f')]=0x0;this['dialTimezone']=_0x117d3a[_0x9448('0x20')]||null;this[_0x9448('0x21')]=_0x117d3a[_0x9448('0x21')]?_0x117d3a[_0x9448('0x21')]:null;this[_0x9448('0x22')]=_0x117d3a[_0x9448('0x22')];this[_0x9448('0x23')]=_0x117d3a[_0x9448('0x23')]||_0x9448('0x24');this[_0x9448('0x25')]=_0x117d3a['dialLimitChannel']||0x0;this[_0x9448('0x26')]=_0x117d3a['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x117d3a[_0x9448('0x27')]||0x1;this['dialPredictiveOptimization']=_0x117d3a['dialPredictiveOptimization']||'dropRate';this[_0x9448('0x28')]=_0x117d3a['dialPredictiveOptimizationPercentage']||0.03;this[_0x9448('0x29')]=_0x117d3a[_0x9448('0x29')]||0x258;this[_0x9448('0x2a')]=_0x117d3a['dialOriginateCallerIdName']||_0x9448('0x2b');this[_0x9448('0x2c')]=_0x117d3a[_0x9448('0x2c')]||_0x9448('0x2b');this[_0x9448('0x2d')]=_0x117d3a[_0x9448('0x2d')]||0x1e;this['dialQueueOptions']=_0x117d3a['dialQueueOptions']||_0x9448('0x2e');this[_0x9448('0x2f')]=_0x117d3a[_0x9448('0x2f')]||0x3;this[_0x9448('0x30')]=_0x117d3a[_0x9448('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x117d3a[_0x9448('0x31')]||0x3;this['dialCongestionRetryFrequency']=_0x117d3a[_0x9448('0x32')]||0x96;this[_0x9448('0x33')]=_0x117d3a[_0x9448('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x117d3a[_0x9448('0x34')]||0x96;this[_0x9448('0x35')]=_0x117d3a[_0x9448('0x35')]||0x3;this[_0x9448('0x36')]=_0x117d3a[_0x9448('0x36')]||0x96;this[_0x9448('0x37')]=_0x117d3a['dialNoSuchNumberMaxRetry']||0x3;this[_0x9448('0x38')]=_0x117d3a[_0x9448('0x38')]||0x96;this['dialDropMaxRetry']=_0x117d3a[_0x9448('0x39')]||0x3;this[_0x9448('0x3a')]=_0x117d3a[_0x9448('0x3a')]||0x96;this[_0x9448('0x3b')]=_0x117d3a[_0x9448('0x3b')]||0x3;this[_0x9448('0x3c')]=_0x117d3a['dialAbandonedRetryFrequency']||0x96;this[_0x9448('0x3d')]=_0x117d3a['dialMachineMaxRetry']||0x3;this[_0x9448('0x3e')]=_0x117d3a[_0x9448('0x3e')]||0x96;this[_0x9448('0x3f')]=_0x117d3a[_0x9448('0x3f')]||0x3;this[_0x9448('0x40')]=_0x117d3a[_0x9448('0x40')]||0x96;this[_0x9448('0x41')]=_0x117d3a[_0x9448('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x117d3a[_0x9448('0x42')]||0x4;this[_0x9448('0x43')]=_0x117d3a['Trunk']?_0x117d3a['Trunk']:undefined;this[_0x9448('0x44')]=_0x117d3a[_0x9448('0x44')]?_0x117d3a['TrunkBackup']:undefined;this[_0x9448('0x45')]=_0x117d3a[_0x9448('0x45')]||undefined;this[_0x9448('0x46')]=_0x117d3a[_0x9448('0x46')]?_0x117d3a[_0x9448('0x46')]:undefined;this[_0x9448('0x47')]=_0x117d3a[_0x9448('0x47')]||'DESC';this[_0x9448('0x48')]=_0x117d3a[_0x9448('0x48')]||undefined;this[_0x9448('0x49')]=_0x117d3a[_0x9448('0x49')]||undefined;this[_0x9448('0x4a')]=strategy[_0x117d3a[_0x9448('0x4a')]];this[_0x9448('0x4b')]=!![];this[_0x9448('0x4c')]=_0x117d3a[_0x9448('0x4c')]||![];this[_0x9448('0x4d')]=_0x117d3a[_0x9448('0x4d')];this['dialAMDGreeting']=_0x117d3a[_0x9448('0x4e')];this[_0x9448('0x4f')]=_0x117d3a[_0x9448('0x4f')];this[_0x9448('0x50')]=_0x117d3a['dialAMDTotalAnalysisTime'];this[_0x9448('0x51')]=_0x117d3a[_0x9448('0x51')];this['dialAMDBetweenWordsSilence']=_0x117d3a[_0x9448('0x52')];this[_0x9448('0x53')]=_0x117d3a[_0x9448('0x53')];this[_0x9448('0x54')]=_0x117d3a['dialAMDSilenceThreshold'];this[_0x9448('0x55')]=_0x117d3a[_0x9448('0x55')];this[_0x9448('0x56')]=0x0;this[_0x9448('0x57')]=0x0;this[_0x9448('0x58')]=_0x117d3a['timeout'];this[_0x9448('0x59')]=0x0;this[_0x9448('0x5a')]=0x0;this[_0x9448('0x5b')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x9448('0x5c')]=0x0;this[_0x9448('0x5d')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x9448('0x5e')]=0x0;this[_0x9448('0x5f')]=0x0;this[_0x9448('0x60')]=0x0;this[_0x9448('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0x9448('0x62')]=0x0;this[_0x9448('0x63')]=undefined;this[_0x9448('0x64')]=undefined;this[_0x9448('0x65')]=undefined;this[_0x9448('0x66')]=1.05;this[_0x9448('0x67')]=0x0;this[_0x9448('0x68')]=0x0;this[_0x9448('0x69')]=0x0;this[_0x9448('0x6a')]=0x0;this[_0x9448('0x6b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x9448('0x6c')]=0x0;this[_0x9448('0x6d')]=_0x117d3a[_0x9448('0x6e')]||0x14;this[_0x9448('0x6f')]=_0x117d3a[_0x9448('0x6e')]||0xa;this[_0x9448('0x70')]=0x0;this[_0x9448('0x71')]=0x0;this[_0x9448('0x72')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x9448('0x73')]=0x0;this[_0x9448('0x74')]=0x0;this[_0x9448('0x75')]=_0x117d3a[_0x9448('0x75')]||0x1e;this[_0x9448('0x76')]=_0x117d3a[_0x9448('0x76')]||![];this[_0x9448('0x77')]=!!_0x117d3a['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x117d3a[_0x9448('0x78')]||![];this[_0x9448('0x79')]=_0x117d3a[_0x9448('0x79')]||undefined;this[_0x9448('0x7a')]=_0x117d3a[_0x9448('0x7a')]||![];this['dialAgiAfterHangupAgent']=_0x117d3a[_0x9448('0x7b')]||![];this[_0x9448('0x7')]=monitorFormat[_0x117d3a[_0x9448('0x7')]]?monitorFormat[_0x117d3a['monitor_format']]:undefined;this[_0x9448('0x7c')]=_0x117d3a[_0x9448('0x7c')]||![];this[_0x9448('0x7d')]=_0x117d3a[_0x9448('0x7d')]?_0x117d3a[_0x9448('0x7d')]:undefined;this[_0x9448('0x7e')]=![];}module[_0x9448('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x0b78=['dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav49','gsm','fewestcalls','linear','random','rrordered','wrandom','name','monitor_format','type','inbound','answered','sumHoldTime','sumBillable','abandoned','available','busy','inUse','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName'];(function(_0x3ac542,_0xc08bc0){var _0x3807c3=function(_0xa30ded){while(--_0xa30ded){_0x3ac542['push'](_0x3ac542['shift']());}};_0x3807c3(++_0xc08bc0);}(_0x0b78,0x1d6));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x80b7('0x0'),'gsm':_0x80b7('0x1')};var strategy={'fewestcalls':_0x80b7('0x2'),'leastrecent':'leastrecent','linear':_0x80b7('0x3'),'random':_0x80b7('0x4'),'ringall':'ringall','rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x80b7('0x5'),'wrandom':_0x80b7('0x6')};function VoiceQueue(_0x2809e7){this['id']=_0x2809e7['id']||0x0;this[_0x80b7('0x7')]=_0x2809e7[_0x80b7('0x7')]||'';this[_0x80b7('0x8')]=_0x2809e7['monitor_format']||'';this[_0x80b7('0x9')]=_0x2809e7[_0x80b7('0x9')]||_0x80b7('0xa');this['waiting']=0x0;this['total']=0x0;this[_0x80b7('0xb')]=0x0;this['sumDuration']=0x0;this[_0x80b7('0xc')]=0x0;this[_0x80b7('0xd')]=0x0;this['unmanaged']=0x0;this[_0x80b7('0xe')]=0x0;this[_0x80b7('0xf')]=0x0;this[_0x80b7('0x10')]=0x0;this[_0x80b7('0x11')]=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x80b7('0x12')]=0x0;this[_0x80b7('0x13')]=0x0;this[_0x80b7('0x14')]=0x0;this[_0x80b7('0x15')]=0x0;this[_0x80b7('0x16')]=0x0;this[_0x80b7('0x17')]=0x0;this[_0x80b7('0x18')]=0x0;this[_0x80b7('0x19')]=0x0;this[_0x80b7('0x1a')]=_0x2809e7['acw']||![];this['acwTimeout']=_0x2809e7['acwTimeout']||0xa;this['autopause']=_0x2809e7[_0x80b7('0x1b')]||'no';this[_0x80b7('0x1c')]=!![];this[_0x80b7('0x1d')]='';this[_0x80b7('0x1e')]='';this[_0x80b7('0x1f')]=0x0;this[_0x80b7('0x20')]=0x0;this[_0x80b7('0x21')]=_0x2809e7[_0x80b7('0x21')]||null;this[_0x80b7('0x22')]=_0x2809e7[_0x80b7('0x22')]?_0x2809e7[_0x80b7('0x22')]:null;this[_0x80b7('0x23')]=_0x2809e7[_0x80b7('0x23')];this['dialMethod']=_0x2809e7[_0x80b7('0x24')]||_0x80b7('0x25');this[_0x80b7('0x26')]=_0x2809e7[_0x80b7('0x26')]||0x0;this[_0x80b7('0x27')]=_0x2809e7[_0x80b7('0x27')]||0x0;this[_0x80b7('0x28')]=_0x2809e7[_0x80b7('0x28')]||0x1;this[_0x80b7('0x29')]=_0x2809e7[_0x80b7('0x29')]||_0x80b7('0x2a');this[_0x80b7('0x2b')]=_0x2809e7['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x2809e7[_0x80b7('0x2c')]||0x258;this[_0x80b7('0x2d')]=_0x2809e7[_0x80b7('0x2d')]||'anonymous';this[_0x80b7('0x2e')]=_0x2809e7[_0x80b7('0x2e')]||_0x80b7('0x2f');this[_0x80b7('0x30')]=_0x2809e7[_0x80b7('0x30')]||0x1e;this[_0x80b7('0x31')]=_0x2809e7[_0x80b7('0x31')]||_0x80b7('0x32');this[_0x80b7('0x33')]=_0x2809e7[_0x80b7('0x33')]||0x3;this[_0x80b7('0x34')]=_0x2809e7['dialQueueProject']||undefined;this[_0x80b7('0x35')]=_0x2809e7[_0x80b7('0x35')]||0x3;this[_0x80b7('0x36')]=_0x2809e7[_0x80b7('0x36')]||0x96;this[_0x80b7('0x37')]=_0x2809e7[_0x80b7('0x37')]||0x3;this[_0x80b7('0x38')]=_0x2809e7[_0x80b7('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0x2809e7[_0x80b7('0x39')]||0x3;this[_0x80b7('0x3a')]=_0x2809e7[_0x80b7('0x3a')]||0x96;this[_0x80b7('0x3b')]=_0x2809e7[_0x80b7('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2809e7[_0x80b7('0x3c')]||0x96;this[_0x80b7('0x3d')]=_0x2809e7[_0x80b7('0x3d')]||0x3;this[_0x80b7('0x3e')]=_0x2809e7[_0x80b7('0x3e')]||0x96;this[_0x80b7('0x3f')]=_0x2809e7[_0x80b7('0x3f')]||0x3;this['dialAbandonedRetryFrequency']=_0x2809e7[_0x80b7('0x40')]||0x96;this[_0x80b7('0x41')]=_0x2809e7['dialMachineMaxRetry']||0x3;this[_0x80b7('0x42')]=_0x2809e7[_0x80b7('0x42')]||0x96;this[_0x80b7('0x43')]=_0x2809e7[_0x80b7('0x43')]||0x3;this[_0x80b7('0x44')]=_0x2809e7[_0x80b7('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2809e7[_0x80b7('0x45')]||0x3;this[_0x80b7('0x46')]=_0x2809e7[_0x80b7('0x46')]||0x4;this['Trunk']=_0x2809e7[_0x80b7('0x47')]?_0x2809e7[_0x80b7('0x47')]:undefined;this[_0x80b7('0x48')]=_0x2809e7['TrunkBackup']?_0x2809e7[_0x80b7('0x48')]:undefined;this[_0x80b7('0x49')]=_0x2809e7[_0x80b7('0x49')]||undefined;this[_0x80b7('0x4a')]=_0x2809e7[_0x80b7('0x4a')]?_0x2809e7[_0x80b7('0x4a')]:undefined;this[_0x80b7('0x4b')]=_0x2809e7[_0x80b7('0x4b')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x2809e7[_0x80b7('0x4c')]||undefined;this[_0x80b7('0x4d')]=_0x2809e7[_0x80b7('0x4d')]||undefined;this[_0x80b7('0x4e')]=strategy[_0x2809e7['strategy']];this['queueStatusComplete']=!![];this[_0x80b7('0x4f')]=_0x2809e7[_0x80b7('0x4f')]||![];this[_0x80b7('0x50')]=_0x2809e7[_0x80b7('0x50')];this['dialAMDGreeting']=_0x2809e7[_0x80b7('0x51')];this[_0x80b7('0x52')]=_0x2809e7['dialAMDAfterGreetingSilence'];this[_0x80b7('0x53')]=_0x2809e7['dialAMDTotalAnalysisTime'];this[_0x80b7('0x54')]=_0x2809e7['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x2809e7[_0x80b7('0x55')];this[_0x80b7('0x56')]=_0x2809e7[_0x80b7('0x56')];this[_0x80b7('0x57')]=_0x2809e7['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x2809e7[_0x80b7('0x58')];this['outboundRejectCallsDay']=0x0;this[_0x80b7('0x59')]=0x0;this[_0x80b7('0x5a')]=_0x2809e7['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x80b7('0x5b')]=0x0;this[_0x80b7('0x5c')]=0x0;this[_0x80b7('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x80b7('0x5e')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x80b7('0x5f')]=0x0;this[_0x80b7('0x60')]=0x0;this[_0x80b7('0x61')]=0x0;this[_0x80b7('0x62')]=0x0;this[_0x80b7('0x63')]=0x0;this[_0x80b7('0x64')]=0x0;this[_0x80b7('0x65')]=undefined;this[_0x80b7('0x66')]=undefined;this[_0x80b7('0x67')]=undefined;this[_0x80b7('0x68')]=1.05;this[_0x80b7('0x69')]=0x0;this[_0x80b7('0x6a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x80b7('0x6b')]=0x0;this[_0x80b7('0x6c')]=0x0;this[_0x80b7('0x6d')]=0x0;this[_0x80b7('0x6e')]=0x0;this[_0x80b7('0x6f')]=0x0;this[_0x80b7('0x70')]=_0x2809e7[_0x80b7('0x71')]||0x14;this[_0x80b7('0x72')]=_0x2809e7[_0x80b7('0x71')]||0xa;this[_0x80b7('0x73')]=0x0;this[_0x80b7('0x74')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x80b7('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0x80b7('0x76')]=0x0;this[_0x80b7('0x77')]=0x0;this[_0x80b7('0x78')]=_0x2809e7[_0x80b7('0x78')]||0x1e;this['dialRecallInQueue']=_0x2809e7[_0x80b7('0x79')]||![];this[_0x80b7('0x7a')]=!!_0x2809e7['dialPreviewAutoRecallMe']||![];this[_0x80b7('0x7b')]=!!_0x2809e7[_0x80b7('0x7b')]||![];this['dialQueueProject2']=_0x2809e7[_0x80b7('0x7c')]||undefined;this[_0x80b7('0x7d')]=_0x2809e7['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x2809e7[_0x80b7('0x7e')]||![];this[_0x80b7('0x8')]=monitorFormat[_0x2809e7[_0x80b7('0x8')]]?monitorFormat[_0x2809e7[_0x80b7('0x8')]]:undefined;this[_0x80b7('0x7f')]=_0x2809e7[_0x80b7('0x7f')]||![];this[_0x80b7('0x80')]=_0x2809e7['mandatoryDispositionPause']?_0x2809e7['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2c2158d..afbe65f 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 _0x7a2d=['type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','loggedin','callers','length','SIP/','status','keys','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','unavailable','unknown','unmanaged'];(function(_0x9eb93c,_0x7c2093){var _0x58356a=function(_0x488c91){while(--_0x488c91){_0x9eb93c['push'](_0x9eb93c['shift']());}};_0x58356a(++_0x7c2093);}(_0x7a2d,0x142));var _0xd7a2=function(_0x47b871,_0xaa95c6){_0x47b871=_0x47b871-0x0;var _0x755019=_0x7a2d[_0x47b871];return _0x755019;};'use strict';var INBOUND_COUNTERS=[_0xd7a2('0x0'),_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x3'),_0xd7a2('0x4'),_0xd7a2('0x5'),_0xd7a2('0x6')];var OUTBOUND_COUNTERS=['available','answered',_0xd7a2('0x7'),_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x8'),'outboundAbandonedCallsDay',_0xd7a2('0x9'),_0xd7a2('0xa'),_0xd7a2('0xb'),_0xd7a2('0xc'),_0xd7a2('0xd'),_0xd7a2('0xe'),_0xd7a2('0xf'),_0xd7a2('0x10'),_0xd7a2('0x11'),'paused',_0xd7a2('0x12'),_0xd7a2('0x5'),_0xd7a2('0x13'),_0xd7a2('0x14'),_0xd7a2('0x15'),_0xd7a2('0x6')];function VoiceQueueSummary(_0xe2feee){this['id']=_0xe2feee['id'];this['name']=_0xe2feee['name'];this[_0xd7a2('0x16')]=_0xe2feee['strategy'];this[_0xd7a2('0x17')]=_0xe2feee[_0xd7a2('0x17')]||0x0;this[_0xd7a2('0x18')]=_0xe2feee[_0xd7a2('0x18')]||0x0;this[_0xd7a2('0x0')]=_0xe2feee[_0xd7a2('0x0')]||0x0;this[_0xd7a2('0x19')]=_0xe2feee[_0xd7a2('0x19')]||0x0;this[_0xd7a2('0x7')]=_0xe2feee[_0xd7a2('0x7')]||0x0;this[_0xd7a2('0x1a')]=_0xe2feee['invalid']||0x0;this[_0xd7a2('0x1')]=_0xe2feee['loggedIn']||0x0;this['loggedInDb']=_0xe2feee[_0xd7a2('0x2')]||0x0;this[_0xd7a2('0x1b')]=_0xe2feee[_0xd7a2('0x1b')]||0x0;this[_0xd7a2('0x1c')]=_0xe2feee[_0xd7a2('0x1c')]||0x0;this[_0xd7a2('0x3')]=_0xe2feee['paused']||0x0;this['ringing']=_0xe2feee[_0xd7a2('0x4')]||0x0;this[_0xd7a2('0x1d')]=_0xe2feee[_0xd7a2('0x1d')];this['sumBillable']=_0xe2feee['sumBillable'];this[_0xd7a2('0x14')]=_0xe2feee['sumDuration'];this['sumHoldTime']=_0xe2feee[_0xd7a2('0x1e')]||0x0;this['talking']=_0xe2feee['talking']||0x0;this[_0xd7a2('0x15')]=_0xe2feee['total']||0x0;this['type']=_0xe2feee['type'];this[_0xd7a2('0x1f')]=_0xe2feee[_0xd7a2('0x1f')]||0x0;this[_0xd7a2('0x20')]=_0xe2feee[_0xd7a2('0x20')]||0x0;this[_0xd7a2('0x21')]=_0xe2feee[_0xd7a2('0x21')]||0x0;this[_0xd7a2('0x6')]=_0xe2feee[_0xd7a2('0x6')]||0x0;if(_0xe2feee[_0xd7a2('0x22')]===_0xd7a2('0x23')){this[_0xd7a2('0x12')]=_0xe2feee[_0xd7a2('0x12')]||0x0;this[_0xd7a2('0x24')]=_0xe2feee['dialActive'];this['dialMethod']=_0xe2feee[_0xd7a2('0x25')];this['dialOriginateCallerIdName']=_0xe2feee[_0xd7a2('0x26')];this['dialOriginateCallerIdNumber']=_0xe2feee[_0xd7a2('0x27')];this[_0xd7a2('0x28')]=_0xe2feee[_0xd7a2('0x28')];this[_0xd7a2('0x29')]=_0xe2feee[_0xd7a2('0x29')];this[_0xd7a2('0x2a')]=_0xe2feee[_0xd7a2('0x2a')];this[_0xd7a2('0x2b')]=_0xe2feee[_0xd7a2('0x2b')];this[_0xd7a2('0x9')]=_0xe2feee[_0xd7a2('0x9')];this[_0xd7a2('0xa')]=_0xe2feee[_0xd7a2('0xa')];this[_0xd7a2('0xb')]=_0xe2feee[_0xd7a2('0xb')];this['outboundCongestionCallsDay']=_0xe2feee[_0xd7a2('0xc')];this[_0xd7a2('0x2c')]=_0xe2feee['outboundDropCallsDayACS'];this[_0xd7a2('0x2d')]=_0xe2feee[_0xd7a2('0x2d')];this['outboundDropCallsDayTimeout']=_0xe2feee[_0xd7a2('0x2e')];this[_0xd7a2('0xd')]=_0xe2feee[_0xd7a2('0xd')];this['outboundNoSuchCallsDay']=_0xe2feee[_0xd7a2('0xe')];this[_0xd7a2('0x2f')]=_0xe2feee[_0xd7a2('0x2f')];this['outboundReCallsDay']=_0xe2feee[_0xd7a2('0xf')];this['outboundRejectCallsDay']=_0xe2feee[_0xd7a2('0x10')];this[_0xd7a2('0x11')]=_0xe2feee[_0xd7a2('0x11')];this[_0xd7a2('0x30')]=_0xe2feee['predictiveIntervalAnsweredCalls'];this[_0xd7a2('0x31')]=_0xe2feee[_0xd7a2('0x31')];this[_0xd7a2('0x32')]=_0xe2feee[_0xd7a2('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0xe2feee[_0xd7a2('0x33')];this[_0xd7a2('0x34')]=_0xe2feee[_0xd7a2('0x34')];this[_0xd7a2('0x35')]=_0xe2feee[_0xd7a2('0x35')];this[_0xd7a2('0x36')]=_0xe2feee[_0xd7a2('0x36')];this[_0xd7a2('0x37')]=_0xe2feee[_0xd7a2('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0xe2feee[_0xd7a2('0x38')];this[_0xd7a2('0x39')]=_0xe2feee[_0xd7a2('0x39')];this[_0xd7a2('0x3a')]=_0xe2feee['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0xe2feee[_0xd7a2('0x3b')];this['originated']=_0xe2feee[_0xd7a2('0x8')];this[_0xd7a2('0x3c')]=_0xe2feee['erlangCalls'];this[_0xd7a2('0x3d')]=_0xe2feee[_0xd7a2('0x3d')];this[_0xd7a2('0x3e')]=_0xe2feee[_0xd7a2('0x3e')];this[_0xd7a2('0x3f')]=_0xe2feee[_0xd7a2('0x3f')];this[_0xd7a2('0x40')]=_0xe2feee['startPredictive'];this['startProgressive']=_0xe2feee[_0xd7a2('0x41')];this[_0xd7a2('0x42')]=_0xe2feee['message'];this[_0xd7a2('0x43')]=_0xe2feee[_0xd7a2('0x43')];}if(_0xe2feee[_0xd7a2('0x44')]){this[_0xd7a2('0x44')]={'id':_0xe2feee[_0xd7a2('0x44')]['id'],'name':_0xe2feee[_0xd7a2('0x44')][_0xd7a2('0x45')],'active':_0xe2feee[_0xd7a2('0x44')][_0xd7a2('0x46')],'callerid':_0xe2feee['Trunk'][_0xd7a2('0x47')]};}}VoiceQueueSummary[_0xd7a2('0x48')]['createReport']=function(_0x509e00,_0x5c86bd,_0xa77a40,_0x305a63){this[_0xd7a2('0x2')]=0x0;this[_0xd7a2('0x5')]=0x0;this[_0xd7a2('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xd7a2('0x7')]=0x0;this[_0xd7a2('0x19')]=0x0;this[_0xd7a2('0x1a')]=0x0;this[_0xd7a2('0x1f')]=0x0;this['ringing']=0x0;this[_0xd7a2('0x1d')]=0x0;this[_0xd7a2('0x1b')]=0x0;if(_0xa77a40){if(_0xa77a40[_0xd7a2('0x0')]){this[_0xd7a2('0x0')]=Number(_0xa77a40['available']);}if(_0xa77a40[_0xd7a2('0x49')]){this[_0xd7a2('0x1')]=Number(_0xa77a40['loggedin']);}if(_0xa77a40['callers']){this['waiting']=Number(_0xa77a40[_0xd7a2('0x4a')]);}}for(var _0x1b8416=0x0;_0x1b8416<_0x509e00[_0xd7a2('0x4b')];_0x1b8416++){var _0x287426=_0x5c86bd[_0xd7a2('0x4c')+_0x509e00[_0x1b8416][_0xd7a2('0x45')]];if(_0x287426&&_0x287426['online']){this[_0xd7a2('0x2')]+=0x1;}if(_0x509e00[_0x1b8416]['incall']==='1'){this[_0xd7a2('0x5')]+=0x1;}if(_0x509e00[_0x1b8416][_0xd7a2('0x3')]==='1'&&!['2','7','8']['includes'](_0x509e00[_0x1b8416][_0xd7a2('0x4d')])){this[_0xd7a2('0x3')]+=0x1;}switch(_0x509e00[_0x1b8416][_0xd7a2('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xd7a2('0x1c')]+=0x1;break;case'2':this[_0xd7a2('0x7')]+=0x1;break;case'3':this[_0xd7a2('0x19')]+=0x1;break;case'4':this[_0xd7a2('0x1a')]+=0x1;break;case'5':this[_0xd7a2('0x1f')]+=0x1;break;case'6':this[_0xd7a2('0x4')]+=0x1;break;case'7':this[_0xd7a2('0x1d')]+=0x1;break;case'8':this[_0xd7a2('0x1b')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x3c5c54=Object[_0xd7a2('0x4e')](_0x305a63);for(var _0x5a282c=0x0;_0x5a282c<_0x3c5c54[_0xd7a2('0x4b')];_0x5a282c++){var _0x4cbf90=_0x3c5c54[_0x5a282c];var _0x4382d6=_0x305a63[_0x4cbf90];if(_0x4382d6[_0xd7a2('0x4f')]===this[_0xd7a2('0x45')]&&_0x4382d6[_0xd7a2('0x22')]===_0xd7a2('0x50')&&_0x4382d6[_0xd7a2('0x51')]===_0xd7a2('0x52')){this['talking']+=0x1;}}if(this[_0xd7a2('0x5')]>this[_0xd7a2('0x7')]){this['talking']=this[_0xd7a2('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xd7a2('0x48')]['compareToInboundQueue']=function(_0x357ce0){var _0xc420a8=![];if(_0x357ce0){_0xc420a8=INBOUND_COUNTERS[_0xd7a2('0x53')](function(_0x89824d){return this[_0x89824d]!==_0x357ce0[_0x89824d];},this);}return _0xc420a8;};VoiceQueueSummary[_0xd7a2('0x48')][_0xd7a2('0x54')]=function(_0x213f6e){var _0x2d9d5d=![];var _0x1bb573=![];var _0x2f3ec5=![];if(_0x213f6e){_0x2d9d5d=this[_0xd7a2('0x25')]!==_0x213f6e[_0xd7a2('0x25')]||this[_0xd7a2('0x24')]!==_0x213f6e[_0xd7a2('0x24')]||this[_0xd7a2('0x42')]!==_0x213f6e[_0xd7a2('0x42')]||this['statusMessage']!==_0x213f6e['statusMessage'];_0x1bb573=OUTBOUND_COUNTERS[_0xd7a2('0x53')](function(_0x466c30){return this[_0x466c30]!==_0x213f6e[_0x466c30];},this);if(this[_0xd7a2('0x44')]&&_0x213f6e[_0xd7a2('0x44')]){_0x2f3ec5=this[_0xd7a2('0x44')][_0xd7a2('0x45')]!==_0x213f6e[_0xd7a2('0x44')][_0xd7a2('0x45')]||this[_0xd7a2('0x44')][_0xd7a2('0x46')]!==_0x213f6e[_0xd7a2('0x44')]['active'];}}return _0x2d9d5d||_0x1bb573||_0x2f3ec5;};VoiceQueueSummary[_0xd7a2('0x48')][_0xd7a2('0x55')]=function(_0x28751e){this[_0xd7a2('0x18')]=_0x28751e[_0xd7a2('0x18')];this['message']=_0x28751e[_0xd7a2('0x42')];this[_0xd7a2('0x43')]=_0x28751e[_0xd7a2('0x43')];this['originated']=_0x28751e['originated'];this['outboundAbandonedCallsDay']=_0x28751e[_0xd7a2('0x56')];this[_0xd7a2('0x9')]=_0x28751e[_0xd7a2('0x9')];this['outboundBlacklistCallsDay']=_0x28751e[_0xd7a2('0xa')];this['outboundBusyCallsDay']=_0x28751e[_0xd7a2('0xb')];this['outboundCongestionCallsDay']=_0x28751e[_0xd7a2('0xc')];this[_0xd7a2('0xd')]=_0x28751e[_0xd7a2('0xd')];this[_0xd7a2('0xe')]=_0x28751e['outboundNoSuchCallsDay'];this[_0xd7a2('0xf')]=_0x28751e[_0xd7a2('0xf')];this['outboundRejectCallsDay']=_0x28751e['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x28751e[_0xd7a2('0x11')];this[_0xd7a2('0x13')]=_0x28751e[_0xd7a2('0x13')];this['sumDuration']=_0x28751e[_0xd7a2('0x14')];this[_0xd7a2('0x15')]=_0x28751e[_0xd7a2('0x15')];if(this[_0xd7a2('0x25')]===_0xd7a2('0x57')){this[_0xd7a2('0x12')]=_0x28751e[_0xd7a2('0x12')];}};module[_0xd7a2('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x20d6=['name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','exten','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','message','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumDuration'];(function(_0x546a68,_0x130161){var _0x5318e7=function(_0x208b95){while(--_0x208b95){_0x546a68['push'](_0x546a68['shift']());}};_0x5318e7(++_0x130161);}(_0x20d6,0x9d));var _0x620d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x20d6[_0x19e35c];return _0x3e1fe8;};'use strict';var INBOUND_COUNTERS=[_0x620d('0x0'),_0x620d('0x1'),_0x620d('0x2'),_0x620d('0x3'),_0x620d('0x4'),'talking',_0x620d('0x5')];var OUTBOUND_COUNTERS=[_0x620d('0x0'),_0x620d('0x6'),_0x620d('0x7'),'loggedIn',_0x620d('0x2'),_0x620d('0x8'),'outboundAbandonedCallsDay',_0x620d('0x9'),_0x620d('0xa'),_0x620d('0xb'),_0x620d('0xc'),_0x620d('0xd'),_0x620d('0xe'),_0x620d('0xf'),_0x620d('0x10'),_0x620d('0x11'),_0x620d('0x3'),_0x620d('0x12'),_0x620d('0x13'),'sumBillable',_0x620d('0x14'),'total',_0x620d('0x5')];function VoiceQueueSummary(_0x3063b2){this['id']=_0x3063b2['id'];this[_0x620d('0x15')]=_0x3063b2[_0x620d('0x15')];this[_0x620d('0x16')]=_0x3063b2[_0x620d('0x16')];this[_0x620d('0x17')]=_0x3063b2[_0x620d('0x17')]||0x0;this[_0x620d('0x6')]=_0x3063b2['answered']||0x0;this[_0x620d('0x0')]=_0x3063b2[_0x620d('0x0')]||0x0;this[_0x620d('0x18')]=_0x3063b2[_0x620d('0x18')]||0x0;this[_0x620d('0x7')]=_0x3063b2['inUse']||0x0;this[_0x620d('0x19')]=_0x3063b2[_0x620d('0x19')]||0x0;this[_0x620d('0x1')]=_0x3063b2[_0x620d('0x1')]||0x0;this['loggedInDb']=_0x3063b2[_0x620d('0x2')]||0x0;this[_0x620d('0x1a')]=_0x3063b2['onHold']||0x0;this[_0x620d('0x1b')]=_0x3063b2['notInUse']||0x0;this[_0x620d('0x3')]=_0x3063b2[_0x620d('0x3')]||0x0;this[_0x620d('0x4')]=_0x3063b2[_0x620d('0x4')]||0x0;this[_0x620d('0x1c')]=_0x3063b2[_0x620d('0x1c')];this[_0x620d('0x1d')]=_0x3063b2[_0x620d('0x1d')];this[_0x620d('0x14')]=_0x3063b2['sumDuration'];this[_0x620d('0x1e')]=_0x3063b2[_0x620d('0x1e')]||0x0;this[_0x620d('0x13')]=_0x3063b2[_0x620d('0x13')]||0x0;this[_0x620d('0x1f')]=_0x3063b2[_0x620d('0x1f')]||0x0;this[_0x620d('0x20')]=_0x3063b2[_0x620d('0x20')];this[_0x620d('0x21')]=_0x3063b2[_0x620d('0x21')]||0x0;this[_0x620d('0x22')]=_0x3063b2[_0x620d('0x22')]||0x0;this[_0x620d('0x23')]=_0x3063b2['unmanaged']||0x0;this['waiting']=_0x3063b2[_0x620d('0x5')]||0x0;if(_0x3063b2[_0x620d('0x20')]===_0x620d('0x24')){this[_0x620d('0x12')]=_0x3063b2['pTalking']||0x0;this[_0x620d('0x25')]=_0x3063b2[_0x620d('0x25')];this[_0x620d('0x26')]=_0x3063b2[_0x620d('0x26')];this[_0x620d('0x27')]=_0x3063b2['dialOriginateCallerIdName'];this[_0x620d('0x28')]=_0x3063b2[_0x620d('0x28')];this[_0x620d('0x29')]=_0x3063b2[_0x620d('0x29')];this[_0x620d('0x2a')]=_0x3063b2[_0x620d('0x2a')];this[_0x620d('0x2b')]=_0x3063b2[_0x620d('0x2b')];this[_0x620d('0x2c')]=_0x3063b2[_0x620d('0x2c')];this[_0x620d('0x9')]=_0x3063b2[_0x620d('0x9')];this['outboundBlacklistCallsDay']=_0x3063b2['outboundBlacklistCallsDay'];this[_0x620d('0xb')]=_0x3063b2['outboundBusyCallsDay'];this[_0x620d('0xc')]=_0x3063b2[_0x620d('0xc')];this[_0x620d('0x2d')]=_0x3063b2[_0x620d('0x2d')];this['outboundDropCallsDayCallersExit']=_0x3063b2[_0x620d('0x2e')];this[_0x620d('0x2f')]=_0x3063b2['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x3063b2[_0x620d('0xd')];this[_0x620d('0xe')]=_0x3063b2['outboundNoSuchCallsDay'];this[_0x620d('0x30')]=_0x3063b2[_0x620d('0x30')];this[_0x620d('0xf')]=_0x3063b2[_0x620d('0xf')];this[_0x620d('0x10')]=_0x3063b2[_0x620d('0x10')];this[_0x620d('0x11')]=_0x3063b2[_0x620d('0x11')];this['predictiveIntervalAnsweredCalls']=_0x3063b2[_0x620d('0x31')];this['predictiveIntervalAvgHoldtime']=_0x3063b2[_0x620d('0x32')];this[_0x620d('0x33')]=_0x3063b2[_0x620d('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x3063b2['predictiveIntervalDroppedCallsCallersExit'];this[_0x620d('0x34')]=_0x3063b2[_0x620d('0x34')];this['predictiveIntervalErlangCalls']=_0x3063b2['predictiveIntervalErlangCalls'];this[_0x620d('0x35')]=_0x3063b2[_0x620d('0x35')];this[_0x620d('0x36')]=_0x3063b2[_0x620d('0x36')];this[_0x620d('0x37')]=_0x3063b2[_0x620d('0x37')];this[_0x620d('0x38')]=_0x3063b2['predictiveIntervalPauses'];this[_0x620d('0x39')]=_0x3063b2['predictiveIntervalAvailable'];this[_0x620d('0x3a')]=_0x3063b2[_0x620d('0x3a')];this[_0x620d('0x8')]=_0x3063b2['originated'];this['erlangCalls']=_0x3063b2['erlangCalls'];this['erlangCallToSecond']=_0x3063b2[_0x620d('0x3b')];this['erlangAbandonmentRate']=_0x3063b2[_0x620d('0x3c')];this['erlangBusyFactor']=_0x3063b2[_0x620d('0x3d')];this[_0x620d('0x3e')]=_0x3063b2[_0x620d('0x3e')];this['startProgressive']=_0x3063b2['startProgressive'];this['message']=_0x3063b2['message'];this[_0x620d('0x3f')]=_0x3063b2[_0x620d('0x3f')];}if(_0x3063b2[_0x620d('0x40')]){this[_0x620d('0x40')]={'id':_0x3063b2[_0x620d('0x40')]['id'],'name':_0x3063b2[_0x620d('0x40')][_0x620d('0x15')],'active':_0x3063b2['Trunk'][_0x620d('0x41')],'callerid':_0x3063b2[_0x620d('0x40')][_0x620d('0x42')]};}}VoiceQueueSummary[_0x620d('0x43')][_0x620d('0x44')]=function(_0x326d1a,_0x1a1693,_0x2103fd,_0x4e5961){this[_0x620d('0x2')]=0x0;this[_0x620d('0x13')]=0x0;this['paused']=0x0;this[_0x620d('0x22')]=0x0;this['notInUse']=0x0;this[_0x620d('0x7')]=0x0;this[_0x620d('0x18')]=0x0;this['invalid']=0x0;this[_0x620d('0x21')]=0x0;this['ringing']=0x0;this[_0x620d('0x1c')]=0x0;this['onHold']=0x0;if(_0x2103fd){if(_0x2103fd[_0x620d('0x0')]){this['available']=Number(_0x2103fd['available']);}if(_0x2103fd[_0x620d('0x45')]){this[_0x620d('0x1')]=Number(_0x2103fd[_0x620d('0x45')]);}if(_0x2103fd['callers']){this[_0x620d('0x5')]=Number(_0x2103fd[_0x620d('0x46')]);}}for(var _0x15a1bb=0x0;_0x15a1bb<_0x326d1a[_0x620d('0x47')];_0x15a1bb++){var _0x123bea=_0x1a1693[_0x620d('0x48')+_0x326d1a[_0x15a1bb][_0x620d('0x15')]];if(_0x123bea&&_0x123bea[_0x620d('0x49')]){this[_0x620d('0x2')]+=0x1;}if(_0x326d1a[_0x15a1bb][_0x620d('0x4a')]==='1'){this[_0x620d('0x13')]+=0x1;}if(_0x326d1a[_0x15a1bb][_0x620d('0x3')]==='1'&&!['2','7','8'][_0x620d('0x4b')](_0x326d1a[_0x15a1bb]['status'])){this[_0x620d('0x3')]+=0x1;}switch(_0x326d1a[_0x15a1bb][_0x620d('0x4c')]){case'0':this[_0x620d('0x22')]+=0x1;break;case'1':this[_0x620d('0x1b')]+=0x1;break;case'2':this[_0x620d('0x7')]+=0x1;break;case'3':this[_0x620d('0x18')]+=0x1;break;case'4':this[_0x620d('0x19')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x620d('0x4')]+=0x1;break;case'7':this[_0x620d('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x620d('0x26')]===_0x620d('0x4d')){var _0xbe89e9=Object[_0x620d('0x4e')](_0x4e5961);for(var _0x45e5b8=0x0;_0x45e5b8<_0xbe89e9[_0x620d('0x47')];_0x45e5b8++){var _0x45b135=_0xbe89e9[_0x45e5b8];var _0x2e620b=_0x4e5961[_0x45b135];if(_0x2e620b['queue']===this[_0x620d('0x15')]&&_0x2e620b[_0x620d('0x20')]==='dialer'&&_0x2e620b[_0x620d('0x4f')]===_0x620d('0x50')){this[_0x620d('0x13')]+=0x1;}}if(this[_0x620d('0x13')]>this[_0x620d('0x7')]){this['talking']=this[_0x620d('0x7')];}this[_0x620d('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x620d('0x43')][_0x620d('0x51')]=function(_0x182194){var _0x55dd88=![];if(_0x182194){_0x55dd88=INBOUND_COUNTERS['some'](function(_0x1636c6){return this[_0x1636c6]!==_0x182194[_0x1636c6];},this);}return _0x55dd88;};VoiceQueueSummary[_0x620d('0x43')][_0x620d('0x52')]=function(_0x310228){var _0x2c92c2=![];var _0x3270e6=![];var _0x1e0e20=![];if(_0x310228){_0x2c92c2=this[_0x620d('0x26')]!==_0x310228[_0x620d('0x26')]||this[_0x620d('0x25')]!==_0x310228[_0x620d('0x25')]||this[_0x620d('0x53')]!==_0x310228[_0x620d('0x53')]||this['statusMessage']!==_0x310228[_0x620d('0x3f')];_0x3270e6=OUTBOUND_COUNTERS[_0x620d('0x54')](function(_0x4b45e1){return this[_0x4b45e1]!==_0x310228[_0x4b45e1];},this);if(this['Trunk']&&_0x310228[_0x620d('0x40')]){_0x1e0e20=this[_0x620d('0x40')][_0x620d('0x15')]!==_0x310228[_0x620d('0x40')][_0x620d('0x15')]||this[_0x620d('0x40')][_0x620d('0x41')]!==_0x310228[_0x620d('0x40')][_0x620d('0x41')];}}return _0x2c92c2||_0x3270e6||_0x1e0e20;};VoiceQueueSummary[_0x620d('0x43')][_0x620d('0x55')]=function(_0x3ce47d){this[_0x620d('0x6')]=_0x3ce47d['answered'];this['message']=_0x3ce47d['message'];this[_0x620d('0x3f')]=_0x3ce47d[_0x620d('0x3f')];this[_0x620d('0x8')]=_0x3ce47d[_0x620d('0x8')];this[_0x620d('0x56')]=_0x3ce47d['outboundAbandonedCallsDay'];this[_0x620d('0x9')]=_0x3ce47d[_0x620d('0x9')];this[_0x620d('0xa')]=_0x3ce47d['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x3ce47d[_0x620d('0xb')];this['outboundCongestionCallsDay']=_0x3ce47d[_0x620d('0xc')];this[_0x620d('0xd')]=_0x3ce47d[_0x620d('0xd')];this[_0x620d('0xe')]=_0x3ce47d[_0x620d('0xe')];this[_0x620d('0xf')]=_0x3ce47d[_0x620d('0xf')];this[_0x620d('0x10')]=_0x3ce47d[_0x620d('0x10')];this[_0x620d('0x11')]=_0x3ce47d['outboundUnknownCallsDay'];this[_0x620d('0x1d')]=_0x3ce47d[_0x620d('0x1d')];this[_0x620d('0x14')]=_0x3ce47d['sumDuration'];this[_0x620d('0x1f')]=_0x3ce47d[_0x620d('0x1f')];if(this[_0x620d('0x26')]===_0x620d('0x57')){this[_0x620d('0x12')]=_0x3ce47d[_0x620d('0x12')];}};module[_0x620d('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 003e433..5d23f14 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 _0x08e6=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x359a4b,_0x5c42e9){var _0x1e61c8=function(_0x2abe04){while(--_0x2abe04){_0x359a4b['push'](_0x359a4b['shift']());}};_0x1e61c8(++_0x5c42e9);}(_0x08e6,0x1b1));var _0x608e=function(_0x27ec01,_0x318223){_0x27ec01=_0x27ec01-0x0;var _0xd2326a=_0x08e6[_0x27ec01];return _0xd2326a;};'use strict';function VtigerAccount(_0xb928de){this['id']=_0xb928de['id']||0x0;this[_0x608e('0x0')]=_0xb928de[_0x608e('0x0')]||'';this[_0x608e('0x1')]=_0xb928de[_0x608e('0x1')]||'';this[_0x608e('0x2')]=_0xb928de[_0x608e('0x2')]||'';this[_0x608e('0x3')]=_0xb928de[_0x608e('0x3')]||'';this[_0x608e('0x4')]=_0xb928de[_0x608e('0x4')]||'';this['Configurations']=_0xb928de[_0x608e('0x5')]||{};}module[_0x608e('0x6')]=VtigerAccount; \ No newline at end of file +var _0xefdb=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x208822,_0x1fba2b){var _0x2d4d1b=function(_0x5be012){while(--_0x5be012){_0x208822['push'](_0x208822['shift']());}};_0x2d4d1b(++_0x1fba2b);}(_0xefdb,0x1ac));var _0xbefd=function(_0x44ee90,_0x3e540b){_0x44ee90=_0x44ee90-0x0;var _0x1657c8=_0xefdb[_0x44ee90];return _0x1657c8;};'use strict';function VtigerAccount(_0x1fbf92){this['id']=_0x1fbf92['id']||0x0;this[_0xbefd('0x0')]=_0x1fbf92[_0xbefd('0x0')]||'';this[_0xbefd('0x1')]=_0x1fbf92[_0xbefd('0x1')]||'';this['accessKey']=_0x1fbf92[_0xbefd('0x2')]||'';this[_0xbefd('0x3')]=_0x1fbf92[_0xbefd('0x3')]||'';this[_0xbefd('0x4')]=_0x1fbf92[_0xbefd('0x4')]||'';this[_0xbefd('0x5')]=_0x1fbf92[_0xbefd('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 0043828..7d06aaf 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 _0x2306=['username','password','token','remoteUri','authType','type','integrationTab','Configurations','name'];(function(_0x1448a9,_0x29fe76){var _0x3840d7=function(_0x412430){while(--_0x412430){_0x1448a9['push'](_0x1448a9['shift']());}};_0x3840d7(++_0x29fe76);}(_0x2306,0x15e));var _0x6230=function(_0x35aa6c,_0x5950a6){_0x35aa6c=_0x35aa6c-0x0;var _0x289b48=_0x2306[_0x35aa6c];return _0x289b48;};'use strict';function ZendeskAccount(_0x2eeea2){this['id']=_0x2eeea2['id']||0x0;this[_0x6230('0x0')]=_0x2eeea2[_0x6230('0x0')]||'';this[_0x6230('0x1')]=_0x2eeea2[_0x6230('0x1')]||'';this[_0x6230('0x2')]=_0x2eeea2[_0x6230('0x2')]||'';this[_0x6230('0x3')]=_0x2eeea2['token']||'';this[_0x6230('0x4')]=_0x2eeea2[_0x6230('0x4')]||'';this[_0x6230('0x5')]=_0x2eeea2[_0x6230('0x5')]||'';this['type']=_0x2eeea2[_0x6230('0x6')]||_0x6230('0x7');this['serverUrl']=_0x2eeea2['serverUrl']||'';this[_0x6230('0x8')]=_0x2eeea2[_0x6230('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x0c95=['Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x0c95,0x1b1));var _0x50c9=function(_0x5657bb,_0x2f1219){_0x5657bb=_0x5657bb-0x0;var _0x2a5ecb=_0x0c95[_0x5657bb];return _0x2a5ecb;};'use strict';function ZendeskAccount(_0x54e120){this['id']=_0x54e120['id']||0x0;this[_0x50c9('0x0')]=_0x54e120[_0x50c9('0x0')]||'';this[_0x50c9('0x1')]=_0x54e120['username']||'';this[_0x50c9('0x2')]=_0x54e120[_0x50c9('0x2')]||'';this['token']=_0x54e120[_0x50c9('0x3')]||'';this['remoteUri']=_0x54e120[_0x50c9('0x4')]||'';this[_0x50c9('0x5')]=_0x54e120[_0x50c9('0x5')]||'';this[_0x50c9('0x6')]=_0x54e120[_0x50c9('0x6')]||_0x50c9('0x7');this['serverUrl']=_0x54e120['serverUrl']||'';this[_0x50c9('0x8')]=_0x54e120[_0x50c9('0x8')]||{};}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 32eb8fa..75d3a6e 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 _0x508a=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0xf65b7a,_0x1621e5){var _0x1ed11d=function(_0x26ff2c){while(--_0x26ff2c){_0xf65b7a['push'](_0xf65b7a['shift']());}};_0x1ed11d(++_0x1621e5);}(_0x508a,0xbe));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x6ad909){this['id']=_0x6ad909['id']||0x0;this[_0xa508('0x0')]=_0x6ad909['name']||'';this[_0xa508('0x1')]=_0x6ad909[_0xa508('0x1')]||'';this[_0xa508('0x2')]=_0x6ad909['host']||'';this[_0xa508('0x3')]=_0x6ad909[_0xa508('0x3')]||'';this['clientId']=_0x6ad909[_0xa508('0x4')]||'';this[_0xa508('0x5')]=_0x6ad909[_0xa508('0x5')]||'';this[_0xa508('0x6')]=_0x6ad909[_0xa508('0x6')]||'';this[_0xa508('0x7')]=_0x6ad909[_0xa508('0x7')]||'';this[_0xa508('0x8')]=_0x6ad909[_0xa508('0x8')]||'';this[_0xa508('0x9')]=_0x6ad909[_0xa508('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x60cc=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x343db4,_0x2cd377){var _0x53d301=function(_0xce2adb){while(--_0xce2adb){_0x343db4['push'](_0x343db4['shift']());}};_0x53d301(++_0x2cd377);}(_0x60cc,0x9b));var _0xc60c=function(_0xbf6b14,_0x47c57a){_0xbf6b14=_0xbf6b14-0x0;var _0x2997f1=_0x60cc[_0xbf6b14];return _0x2997f1;};'use strict';function ZohoAccount(_0x947004){this['id']=_0x947004['id']||0x0;this[_0xc60c('0x0')]=_0x947004[_0xc60c('0x0')]||'';this[_0xc60c('0x1')]=_0x947004['description']||'';this[_0xc60c('0x2')]=_0x947004['host']||'';this[_0xc60c('0x3')]=_0x947004[_0xc60c('0x3')]||'';this[_0xc60c('0x4')]=_0x947004[_0xc60c('0x4')]||'';this[_0xc60c('0x5')]=_0x947004[_0xc60c('0x5')]||'';this['serverUrl']=_0x947004[_0xc60c('0x6')]||'';this[_0xc60c('0x7')]=_0x947004['code']||'';this[_0xc60c('0x8')]=_0x947004[_0xc60c('0x8')]||'';this[_0xc60c('0x9')]=_0x947004[_0xc60c('0x9')]||{};}module[_0xc60c('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 4247f8e..67bacfe 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 _0x5430=['ContactId','ListId','UserId','isNil','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','callback','callbackuniqueid','recallme'];(function(_0x34091d,_0x4d8f42){var _0x2f5e55=function(_0x453f29){while(--_0x453f29){_0x34091d['push'](_0x34091d['shift']());}};_0x2f5e55(++_0x4d8f42);}(_0x5430,0x10c));var _0x0543=function(_0xa2247b,_0x2c30a2){_0xa2247b=_0xa2247b-0x0;var _0x47cd4b=_0x5430[_0xa2247b];return _0x47cd4b;};'use strict';var util=require(_0x0543('0x0'));var _=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));function checkNameSurname(_0x4078bf,_0x114bf2,_0x3b93d7){var _0x5518f8='';if(!_['isNil'](_0x114bf2)&&_0x0543('0x3')===typeof _0x114bf2){_0x5518f8+=_0x114bf2;}if(!_['isNil'](_0x3b93d7)&&'string'===typeof _0x3b93d7){_0x5518f8+='\x20'+_0x3b93d7;}if(_0x5518f8!==''){return _0x5518f8;}return _0x4078bf;}function Action(_0xce0b65,_0x45b909,_0x9754ba,_0x319568,_0x46bca7){this['uniqueid']=_0x9754ba||undefined;this[_0x0543('0x4')]=_0xce0b65['id'];this[_0x0543('0x5')]=_0x45b909[_0x0543('0x6')];this[_0x0543('0x7')]=_0x45b909[_0x0543('0x7')];this[_0x0543('0x8')]='queue';this[_0x0543('0x9')]=![];this[_0x0543('0xa')]=_['isNil'](_0xce0b65[_0x0543('0xb')])?undefined:_0xce0b65[_0x0543('0xb')][_0x0543('0x6')];this[_0x0543('0xc')]=this[_0x0543('0xa')]?util[_0x0543('0xd')](_0x0543('0xe'),this[_0x0543('0xa')]):_0x319568||undefined;this[_0x0543('0xf')]=checkNameSurname(_0xce0b65[_0x0543('0x10')][_0x0543('0x11')],_0xce0b65[_0x0543('0x10')]['firstName'],_0xce0b65[_0x0543('0x10')][_0x0543('0x12')]);this['active']=_0xce0b65['active']||![];this[_0x0543('0x13')]=_0xce0b65[_0x0543('0x11')];this[_0x0543('0x14')]=_0xce0b65[_0x0543('0x14')];this[_0x0543('0x15')]=_0xce0b65['countbusyretry']||0x0;this[_0x0543('0x16')]=_0xce0b65[_0x0543('0x16')]||0x0;this[_0x0543('0x17')]=_0xce0b65[_0x0543('0x17')]||0x0;this[_0x0543('0x18')]=(_0xce0b65[_0x0543('0x15')]||0x0)+(_0xce0b65[_0x0543('0x16')]||0x0)+(_0xce0b65['countnoanswerretry']||0x0)+(_0xce0b65[_0x0543('0x19')]||0x0)+(_0xce0b65['countdropretry']||0x0)+(_0xce0b65['countabandonedretry']||0x0)+(_0xce0b65[_0x0543('0x1a')]||0x0)+(_0xce0b65[_0x0543('0x1b')]||0x0);this[_0x0543('0x19')]=_0xce0b65['countnosuchnumberretry']||0x0;this[_0x0543('0x1c')]=_0xce0b65['countdropretry']||0x0;this[_0x0543('0x1d')]=_0xce0b65[_0x0543('0x1d')]||0x0;this['countmachineretry']=_0xce0b65[_0x0543('0x1a')]||0x0;this[_0x0543('0x1b')]=_0xce0b65[_0x0543('0x1b')]||0x0;this[_0x0543('0x1e')]=_0xce0b65[_0x0543('0x1e')];this[_0x0543('0x1f')]=_0xce0b65['callbackuniqueid'];this['callbackat']=_0xce0b65['callbackat'];this[_0x0543('0x20')]=_0xce0b65[_0x0543('0x20')];this[_0x0543('0x21')]=_0xce0b65[_0x0543('0x21')];this[_0x0543('0x22')]=_0xce0b65[_0x0543('0x22')];this[_0x0543('0x23')]=_[_0x0543('0x24')](_0xce0b65[_0x0543('0xb')])?_0xce0b65[_0x0543('0x23')]:_0xce0b65[_0x0543('0xb')]['id'];this[_0x0543('0x25')]=_0xce0b65['VoiceQueueId'];this[_0x0543('0x26')]='';this[_0x0543('0x27')]='';}Action[_0x0543('0x28')]['getCaller']=function(){return util[_0x0543('0xd')](_0x0543('0x29'),this[_0x0543('0xf')],this[_0x0543('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0x4bd3=['name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','idContact','queue'];(function(_0x48af7a,_0x3cfea9){var _0x359483=function(_0x681641){while(--_0x681641){_0x48af7a['push'](_0x48af7a['shift']());}};_0x359483(++_0x3cfea9);}(_0x4bd3,0x174));var _0x34bd=function(_0x2eb91b,_0x15174c){_0x2eb91b=_0x2eb91b-0x0;var _0x4e861c=_0x4bd3[_0x2eb91b];return _0x4e861c;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var moment=require(_0x34bd('0x1'));function checkNameSurname(_0x22a9f9,_0x5369c1,_0x4997bc){var _0x4cad21='';if(!_[_0x34bd('0x2')](_0x5369c1)&&_0x34bd('0x3')===typeof _0x5369c1){_0x4cad21+=_0x5369c1;}if(!_[_0x34bd('0x2')](_0x4997bc)&&'string'===typeof _0x4997bc){_0x4cad21+='\x20'+_0x4997bc;}if(_0x4cad21!==''){return _0x4cad21;}return _0x22a9f9;}function Action(_0x2133c5,_0x2a15a2,_0x5c2a7a,_0x3e8744,_0x213716){this['uniqueid']=_0x5c2a7a||undefined;this[_0x34bd('0x4')]=_0x2133c5['id'];this[_0x34bd('0x5')]=_0x2a15a2[_0x34bd('0x6')];this[_0x34bd('0x7')]=_0x2a15a2[_0x34bd('0x7')];this[_0x34bd('0x8')]='queue';this[_0x34bd('0x9')]=![];this[_0x34bd('0xa')]=_[_0x34bd('0x2')](_0x2133c5[_0x34bd('0xb')])?undefined:_0x2133c5['Agent']['name'];this[_0x34bd('0xc')]=this['membername']?util['format'](_0x34bd('0xd'),this[_0x34bd('0xa')]):_0x3e8744||undefined;this[_0x34bd('0xe')]=checkNameSurname(_0x2133c5[_0x34bd('0xf')][_0x34bd('0x10')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x11')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x12')]);this['active']=_0x2133c5[_0x34bd('0x13')]||![];this['calleridnum']=_0x2133c5['phone'];this[_0x34bd('0x14')]=_0x2133c5[_0x34bd('0x14')];this[_0x34bd('0x15')]=_0x2133c5[_0x34bd('0x15')]||0x0;this[_0x34bd('0x16')]=_0x2133c5[_0x34bd('0x16')]||0x0;this[_0x34bd('0x17')]=_0x2133c5[_0x34bd('0x17')]||0x0;this[_0x34bd('0x18')]=(_0x2133c5[_0x34bd('0x15')]||0x0)+(_0x2133c5[_0x34bd('0x16')]||0x0)+(_0x2133c5['countnoanswerretry']||0x0)+(_0x2133c5[_0x34bd('0x19')]||0x0)+(_0x2133c5[_0x34bd('0x1a')]||0x0)+(_0x2133c5[_0x34bd('0x1b')]||0x0)+(_0x2133c5[_0x34bd('0x1c')]||0x0)+(_0x2133c5[_0x34bd('0x1d')]||0x0);this[_0x34bd('0x19')]=_0x2133c5[_0x34bd('0x19')]||0x0;this[_0x34bd('0x1a')]=_0x2133c5[_0x34bd('0x1a')]||0x0;this['countabandonedretry']=_0x2133c5[_0x34bd('0x1b')]||0x0;this[_0x34bd('0x1c')]=_0x2133c5[_0x34bd('0x1c')]||0x0;this[_0x34bd('0x1d')]=_0x2133c5[_0x34bd('0x1d')]||0x0;this['callback']=_0x2133c5['callback'];this['callbackuniqueid']=_0x2133c5['callbackuniqueid'];this[_0x34bd('0x1e')]=_0x2133c5['callbackat'];this[_0x34bd('0x1f')]=_0x2133c5[_0x34bd('0x1f')];this[_0x34bd('0x20')]=_0x2133c5['ContactId'];this[_0x34bd('0x21')]=_0x2133c5[_0x34bd('0x21')];this[_0x34bd('0x22')]=_[_0x34bd('0x2')](_0x2133c5['Agent'])?_0x2133c5[_0x34bd('0x22')]:_0x2133c5[_0x34bd('0xb')]['id'];this[_0x34bd('0x23')]=_0x2133c5[_0x34bd('0x23')];this['originatecalleridnum']='';this[_0x34bd('0x24')]='';}Action[_0x34bd('0x25')]['getCaller']=function(){return util[_0x34bd('0x26')](_0x34bd('0x27'),this[_0x34bd('0xe')],this[_0x34bd('0x28')]);};module[_0x34bd('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 24a2310..c8670dd 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 _0xb012=['custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','buildObj','complete','outboundAnswerCallsDay','total','answered','[16]','totalGlobal','logCustomer','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','pTalking:\x20','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','Global','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','cloneAction','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','decrementTalking','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','VoiceQueueId','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','run','unlock','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridNumber','setXMDContactVariables','assign','merge','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','logLookAgent','clone','isFailure','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','filterKey','keys','variable','addVariable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','emit','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','dialMethod','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pick','contactId','UserId','ListId','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','TrunkBackup','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue'];(function(_0xc0a29f,_0x5e6990){var _0xb2d64c=function(_0x19b603){while(--_0x19b603){_0xc0a29f['push'](_0xc0a29f['shift']());}};_0xb2d64c(++_0x5e6990);}(_0xb012,0xb5));var _0x2b01=function(_0x1fce4a,_0x1a7004){_0x1fce4a=_0x1fce4a-0x0;var _0x10b5a6=_0xb012[_0x1fce4a];return _0x10b5a6;};'use strict';var util=require(_0x2b01('0x0'));var _=require(_0x2b01('0x1'));var uuid=require('uuid');var moment=require(_0x2b01('0x2'));var Redis=require(_0x2b01('0x3'));var config=require(_0x2b01('0x4'));var logger=require(_0x2b01('0x5'))('preview');var loggerAction=require('../../../config/logger')(_0x2b01('0x6'));var ami=require(_0x2b01('0x7'));var rpcDb=require(_0x2b01('0x8'));var cmHopperAdditionalPhone=require(_0x2b01('0x9'));var Action=require(_0x2b01('0xa'));var ut=require(_0x2b01('0xb'));var utils=require(_0x2b01('0xc'));config[_0x2b01('0xd')]=_['defaults'](config['redis'],{'host':_0x2b01('0xe'),'port':0x18eb});var io=require(_0x2b01('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x2b01('0x10')][_0x2b01('0x11')]=function(_0x59b823){this[_0x2b01('0x12')]=this[_0x2b01('0x12')]?this[_0x2b01('0x12')][_0x2b01('0x13')](_0x59b823):_0x59b823();};function Preview(_0x5251a9){this[_0x2b01('0x14')]=new Sequence();this['campaignsPreview']=_0x5251a9[_0x2b01('0x15')];this[_0x2b01('0x16')]=_0x5251a9[_0x2b01('0x16')];this[_0x2b01('0x17')]={};this[_0x2b01('0x18')]=_0x5251a9['agents'];this[_0x2b01('0x19')]=0x0;ami['on'](_0x2b01('0x1a'),this[_0x2b01('0x1b')][_0x2b01('0x1c')](this));ami['on'](_0x2b01('0x1d'),this[_0x2b01('0x1e')][_0x2b01('0x1c')](this));ami['on'](_0x2b01('0x1f'),this[_0x2b01('0x20')]['bind'](this));ami['on']('dialend',this[_0x2b01('0x21')][_0x2b01('0x1c')](this));ami['on']('newexten',this['syncNewExten'][_0x2b01('0x1c')](this));ami['on'](_0x2b01('0x22'),this[_0x2b01('0x23')][_0x2b01('0x1c')](this));ami['on']('attendedtransfer',this[_0x2b01('0x24')][_0x2b01('0x1c')](this));ami['on'](_0x2b01('0x25'),this['syncBlindTransfer']['bind'](this));this[_0x2b01('0x26')](this[_0x2b01('0x27')]);}function emit(_0x25bfe7,_0x22eeab,_0x1ccb56){io['to'](_0x25bfe7)['emit'](_0x22eeab,_0x1ccb56);}function emitVoiceQueueChannelRemove(_0x2b4690){logger[_0x2b01('0x28')](_0x2b01('0x29'),JSON[_0x2b01('0x2a')](_0x2b4690));emit(util[_0x2b01('0x2b')]('voice:queue:%s',_0x2b4690[_0x2b01('0x2c')]),'voice_queue_channel:remove',_0x2b4690);io[_0x2b01('0x2d')]('voice_queue_presence:remove',_0x2b4690);}function notSendMessagesQueue(_0x53046f){if(_0x53046f[_0x2b01('0x2e')]){if(_0x53046f[_0x2b01('0x2f')]===0x0&&_0x53046f[_0x2b01('0x30')]===0x0){_0x53046f[_0x2b01('0x2e')]=![];_0x53046f[_0x2b01('0x31')]=0x0;_0x53046f[_0x2b01('0x32')]=0x0;_0x53046f[_0x2b01('0x33')]=utils[_0x2b01('0x34')][_0x2b01('0x35')];ut[_0x2b01('0x36')](_0x2b01('0x37'),_0x53046f[_0x2b01('0x2c')]+'\x20is\x20not\x20active');}else{_0x53046f['message']=utils[_0x2b01('0x34')]['DEACTIVATED'];ut[_0x2b01('0x36')](_0x2b01('0x37'),_0x53046f['name']+_0x2b01('0x38'));}}}Preview[_0x2b01('0x10')][_0x2b01('0x26')]=function(){var _0x497701=this;setInterval(function(){_0x497701[_0x2b01('0x39')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2fa2b1=this[_0x2b01('0x27')];this[_0x2b01('0x19')]+=0x1;for(var _0xfaa6b0 in _0x2fa2b1){if(_0x2fa2b1[_0x2b01('0x3a')](_0xfaa6b0)&&(_0x2fa2b1[_0xfaa6b0]['dialMethod']===_0x2b01('0x3b')||_0x2fa2b1[_0xfaa6b0]['dialMethod']===_0x2b01('0x3c'))&&_0x2fa2b1[_0xfaa6b0]['type']==='outbound'){if(this[_0x2b01('0x19')]>0x7){this[_0x2b01('0x19')]=0x0;this[_0x2b01('0x3d')]();}}if(_0x2fa2b1[_0x2b01('0x3a')](_0xfaa6b0)&&_0x2fa2b1[_0xfaa6b0][_0x2b01('0x3e')]==='preview'&&_0x2fa2b1[_0xfaa6b0][_0x2b01('0x3f')]===_0x2b01('0x40')){if(_0x2fa2b1[_0xfaa6b0][_0x2b01('0x41')]){this[_0x2b01('0x42')](_0x2fa2b1[_0xfaa6b0]);if(_0x2fa2b1[_0xfaa6b0][_0x2b01('0x43')])this[_0x2b01('0x44')](_0x2fa2b1[_0xfaa6b0]);}else{notSendMessagesQueue(_0x2fa2b1[_0xfaa6b0]);}}}};Preview[_0x2b01('0x10')][_0x2b01('0x45')]=function(_0x532b10){var _0x578a80=this;this['sequence']['enqueue'](function(){if(!_[_0x2b01('0x46')](_0x578a80['actions'][_0x532b10])){loggerAction[_0x2b01('0x28')](_0x2b01('0x47'),_0x532b10,_0x2b01('0x48'),_0x578a80['actions'][_0x532b10]['queue'],_0x2b01('0x49'),JSON[_0x2b01('0x2a')](_0x578a80[_0x2b01('0x27')][_0x578a80['actions'][_0x532b10][_0x2b01('0x4a')]][_0x2b01('0x2f')]),'pTalking:\x20',JSON[_0x2b01('0x2a')](_0x578a80[_0x2b01('0x27')][_0x578a80['actions'][_0x532b10][_0x2b01('0x4a')]]['pTalking']),JSON[_0x2b01('0x2a')](_0x578a80['actions'][_0x532b10]['dialAnswer']),JSON[_0x2b01('0x2a')](_[_0x2b01('0x4b')](_0x578a80[_0x2b01('0x17')][_0x532b10],[_0x2b01('0x4c'),_0x2b01('0x4d'),'VoiceQueueId',_0x2b01('0x4e')])));return ami['Action']({'action':_0x2b01('0x4f'),'channel':_0x578a80['actions'][_0x532b10][_0x2b01('0x50')]})[_0x2b01('0x51')](function(_0x2bd04f){if(_0x2bd04f[_0x2b01('0x33')]===_0x2b01('0x52')){setTimeout(function(){if(_0x578a80[_0x2b01('0x17')][_0x532b10]){utils[_0x2b01('0x53')](_0x578a80[_0x2b01('0x27')][_0x578a80[_0x2b01('0x17')][_0x532b10][_0x2b01('0x4a')]],_0x2b01('0x54'));if(_0x578a80[_0x2b01('0x17')][_0x532b10][_0x2b01('0x55')]===!![]){ut['decrementTalking'](_0x578a80[_0x2b01('0x27')][_0x578a80[_0x2b01('0x17')][_0x532b10][_0x2b01('0x4a')]],_0x2b01('0x54'));ut[_0x2b01('0x56')]('[Dialer][checkChannel][pTalking][Preview]'+_0x532b10,_0x578a80['actions'][_0x532b10][_0x2b01('0x4a')]);}ut[_0x2b01('0x56')](_0x2b01('0x57')+_0x532b10,_0x578a80[_0x2b01('0x17')][_0x532b10][_0x2b01('0x4a')]);delete _0x578a80[_0x2b01('0x17')][_0x532b10];}},0x2328);}});}});};Preview[_0x2b01('0x10')][_0x2b01('0x3d')]=function(){var _0x23c128=this;loggerAction['info'](_0x2b01('0x58'),_[_0x2b01('0x59')](this['actions']));for(var _0x2708cc in this[_0x2b01('0x17')]){if(_0x23c128[_0x2b01('0x17')]['hasOwnProperty'](_0x2708cc)){_0x23c128[_0x2b01('0x45')](_0x2708cc);}}};Preview[_0x2b01('0x10')][_0x2b01('0x44')]=function(_0x24c6af){var _0x11d0b3=this;rpcDb[_0x2b01('0x5a')](_0x24c6af['id'],ut['agentReadyId'](this[_0x2b01('0x18')]))[_0x2b01('0x5b')](function(_0x560f0a){if(!_[_0x2b01('0x46')](_0x560f0a)){for(var _0xb1bca0=0x0;_0xb1bca0<_0x560f0a['length'];_0xb1bca0+=0x1){if(ut[_0x2b01('0x5c')](_0x560f0a[_0xb1bca0][_0x2b01('0x5d')])<_0x24c6af[_0x2b01('0x5e')]*0x3c){if(_0x560f0a[_0xb1bca0][_0x2b01('0x5f')]&&!_0x560f0a[_0xb1bca0]['Agent'][_0x2b01('0x60')]){_0x11d0b3['run'](_0x560f0a[_0xb1bca0]['id'])['then'](ut[_0x2b01('0x61')]('[RecallMe]'))[_0x2b01('0x51')](ut['logger2'](_0x2b01('0x62')));}else{rpcDb[_0x2b01('0x63')](_0x560f0a[_0xb1bca0]['id']);}}else{var _0x4b3ddb=new Action(_0x560f0a[_0xb1bca0],_0x24c6af);_0x4b3ddb[_0x2b01('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x24c6af['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4b3ddb,0x17,'RecallInQueue');if(_0x24c6af['dialRecallInQueue']){rpcDb[_0x2b01('0x65')](ut[_0x2b01('0x66')](_0x560f0a[_0xb1bca0]));rpcDb[_0x2b01('0x67')](_0x4b3ddb,_0x2b01('0x68'));}else{ut['logCustomer'](_0x4b3ddb,0x16,_0x2b01('0x69'));rpcDb[_0x2b01('0x67')](_0x4b3ddb,_0x2b01('0x6a'));rpcDb[_0x2b01('0x6b')](_0x4b3ddb,_0x2b01('0x6a'));}}}}})[_0x2b01('0x51')](ut[_0x2b01('0x61')](_0x2b01('0x6c')));};Preview[_0x2b01('0x10')][_0x2b01('0x42')]=function(_0x3aaa93){_0x3aaa93[_0x2b01('0x2e')]=!![];if(ut['IsNotLoggedIn'](_0x3aaa93['loggedIn'])){_0x3aaa93[_0x2b01('0x33')]=utils[_0x2b01('0x34')][_0x2b01('0x6d')];}else if(!ut[_0x2b01('0x6e')](_0x3aaa93['dialActive'])){_0x3aaa93[_0x2b01('0x33')]=utils[_0x2b01('0x34')][_0x2b01('0x35')];}else if(!this['isTrunkReachable'](_0x3aaa93[_0x2b01('0x6f')])){if(!this[_0x2b01('0x70')](_0x3aaa93[_0x2b01('0x71')])){_0x3aaa93[_0x2b01('0x33')]=utils[_0x2b01('0x34')]['UNREACHABLE_TRUNK'];}else{_0x3aaa93[_0x2b01('0x33')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x3aaa93[_0x2b01('0x33')]=utils[_0x2b01('0x34')]['ACTIVE'];}};Preview['prototype']['callProgressDetectingCustomer']=function(_0x365db8,_0x1925b3,_0x42d871){var _0x53f4b2=this;var _0x5b2a3c=this['actions'][_0x1925b3];var _0x38815d=this[_0x2b01('0x27')][_0x5b2a3c[_0x2b01('0x4a')]];var _0x38217a;var _0x135c76=![];var _0x302bd5=0x2;var _0x56b281=0x3;if(_0x38815d){switch(_0x42d871){case'1':_0x38815d[_0x2b01('0x72')]+=0x1;_0x5b2a3c[_0x2b01('0x73')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut['totalGlobal'](_0x5b2a3c);ut['logCustomer'](_0x5b2a3c,0x0,'NoSuchNumber');ami[_0x2b01('0x2d')](_0x2b01('0x75'),ut['buildObj'](_0x5b2a3c,_0x2b01('0x76')));rpcDb[_0x2b01('0x67')](_0x5b2a3c,_0x2b01('0x77'));_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'0',_0x38815d)[_0x2b01('0x5b')](function(_0x38b3a0){_0x135c76=_0x38b3a0[_0x2b01('0x79')]==0x1;_0x302bd5=_0x38815d[_0x2b01('0x7a')];_0x56b281=_0x38815d[_0x2b01('0x7b')];if(!_0x135c76){if(ut['totalGlobal'](_0x5b2a3c)>=_0x38815d[_0x2b01('0x7c')]){_0x38217a=ut['cloneAction'](_0x5b2a3c,0xf,'Global');rpcDb[_0x2b01('0x6b')](_0x38217a,_0x2b01('0x7d'));}else{if(_0x5b2a3c[_0x2b01('0x73')]>=_0x38815d['dialNoSuchNumberMaxRetry']){rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0x7d'));}else{rpcDb[_0x2b01('0x7e')](ut[_0x2b01('0x7f')](_0x5b2a3c,_0x2b01('0x73'),_0x38815d['dialNoSuchNumberRetryFrequency']),_0x5b2a3c['unlockAgent'],_0x5b2a3c['activeContact']);}}delete this[_0x2b01('0x17')][_0x365db8[_0x2b01('0x80')]];}else{_0x5b2a3c['countnosuchnumberretry']++;logger[_0x2b01('0x28')](_0x2b01('0x81'),_0x5b2a3c[_0x2b01('0x73')]);logger[_0x2b01('0x28')]('id',_0x5b2a3c[_0x2b01('0x82')]);_0x53f4b2[_0x2b01('0x83')]({'id':_0x5b2a3c[_0x2b01('0x82')],'field':{'countnosuchnumberretry':_0x5b2a3c['countnosuchnumberretry']}})[_0x2b01('0x5b')](function(){_0x53f4b2[_0x2b01('0x84')](_0x5b2a3c,_0x302bd5,_0x56b281)['then'](function(){});});}});break;case _0x2b01('0x85'):var _0x1afcb1=moment()[_0x2b01('0x2b')](_0x2b01('0x86'));_0x5b2a3c[_0x2b01('0x87')]=_0x1afcb1;_0x5b2a3c[_0x2b01('0x88')]=_0x1afcb1;_0x5b2a3c['dialAnswer']=!![];_0x38815d[_0x2b01('0x30')]+=0x1;logger[_0x2b01('0x28')](_0x2b01('0x89'),_0x5b2a3c[_0x2b01('0x8a')],_0x2b01('0x8b'),_0x38815d[_0x2b01('0x2c')],'pTalking:\x20',_0x38815d[_0x2b01('0x30')]);ami[_0x2b01('0x2d')](_0x2b01('0x8c'),ut['buildObj'](_0x5b2a3c,_0x2b01('0x8d'),this['campaignsPreview'][_0x5b2a3c[_0x2b01('0x4a')]]));if(_0x38815d[_0x2b01('0x8e')]||_0x38815d[_0x2b01('0x8f')]){ami[_0x2b01('0x2d')](_0x2b01('0x90'),{'queue':_0x5b2a3c['queue'],'interface':_0x5b2a3c[_0x2b01('0x91')],'uniqueid':_0x5b2a3c['uniqueid']});}break;case'16':ami[_0x2b01('0x2d')]('custom:agentcomplete',ut[_0x2b01('0x92')](_0x5b2a3c,_0x2b01('0x93'),this[_0x2b01('0x27')][_0x5b2a3c['queue']]));emitVoiceQueueChannelRemove(ut[_0x2b01('0x92')](_0x5b2a3c,_0x2b01('0x93')));_0x38815d[_0x2b01('0x94')]+=0x1;_0x38815d[_0x2b01('0x95')]+=0x1;_0x38815d[_0x2b01('0x96')]+=0x1;ut['decrementTalking'](_0x38815d,_0x2b01('0x97'));_0x5b2a3c[_0x2b01('0x74')]=ut[_0x2b01('0x98')](_0x5b2a3c);ut[_0x2b01('0x99')](_0x5b2a3c,0x4,_0x2b01('0x9a'));rpcDb[_0x2b01('0x67')](_0x5b2a3c,_0x2b01('0x9b'));rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0x9c'));rpcDb['crateCustomerReportQueue'](_0x5b2a3c);_0x38815d[_0x2b01('0x9d')]+=_0x5b2a3c['talktime'];_0x38815d[_0x2b01('0x9e')]+=_0x5b2a3c[_0x2b01('0x9f')];logger['info'](_0x2b01('0xa0'),_0x5b2a3c[_0x2b01('0x8a')],_0x2b01('0x8b'),_0x38815d['name'],_0x2b01('0xa1'),_0x38815d[_0x2b01('0x30')]);delete this[_0x2b01('0x17')][_0x365db8['linkedid']];break;case _0x2b01('0xa2'):_0x38815d[_0x2b01('0xa3')]+=0x1;_0x5b2a3c[_0x2b01('0xa4')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut['totalGlobal'](_0x5b2a3c);ut[_0x2b01('0x99')](_0x5b2a3c,0x5,_0x2b01('0xa5'));_0x302bd5=_0x38815d['dialBusyRetryFrequency'];_0x56b281=_0x38815d[_0x2b01('0x7b')];ami['emit'](_0x2b01('0xa6'),ut[_0x2b01('0x92')](_0x5b2a3c,_0x2b01('0xa7')));rpcDb[_0x2b01('0x67')](_0x5b2a3c,'[callProgressDetectingCustomer][logBusy]');_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'5',_0x38815d)[_0x2b01('0x5b')](function(_0x1fd568){_0x135c76=_0x1fd568[_0x2b01('0x79')]==0x1;if(!_0x135c76){if(ut['totalGlobal'](_0x5b2a3c)>=_0x38815d['dialGlobalMaxRetry']){_0x38217a=ut['cloneAction'](_0x5b2a3c,0xf,'Global');rpcDb[_0x2b01('0x6b')](_0x38217a,_0x2b01('0xa8'));}else{if(_0x5b2a3c[_0x2b01('0xa4')]>=_0x38815d[_0x2b01('0xa9')]){rpcDb['createCustomerFinal'](_0x5b2a3c,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x2b01('0x7e')](ut[_0x2b01('0x7f')](_0x5b2a3c,_0x2b01('0xa4'),_0x38815d[_0x2b01('0xaa')]),_0x5b2a3c[_0x2b01('0xab')],_0x5b2a3c[_0x2b01('0xac')]);}}}else{_0x5b2a3c[_0x2b01('0xa4')]++;_0x53f4b2[_0x2b01('0x83')]({'id':_0x5b2a3c['idContact'],'field':{'countbusyretry':_0x5b2a3c['countbusyretry']}})['then'](function(){_0x53f4b2['swapAdditionalPhones'](_0x5b2a3c,_0x302bd5,_0x56b281)[_0x2b01('0x5b')](function(){});});}});break;case _0x2b01('0xad'):_0x38815d[_0x2b01('0xae')]+=0x1;_0x5b2a3c[_0x2b01('0xaf')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut[_0x2b01('0x98')](_0x5b2a3c);ut['logCustomer'](_0x5b2a3c,0x3,_0x2b01('0xb0'));_0x302bd5=_0x38815d[_0x2b01('0xb1')];_0x56b281=_0x38815d[_0x2b01('0x7b')];var _0x44816f=ut[_0x2b01('0xb2')](_0x5b2a3c,_0x38815d);ami[_0x2b01('0x2d')]('custom:agentnoanswer',_0x44816f);rpcDb[_0x2b01('0x67')](_0x5b2a3c,_0x2b01('0xb3'));_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'3',_0x38815d)[_0x2b01('0x5b')](function(_0x9b50dd){_0x135c76=_0x9b50dd['additional']==0x1;if(!_0x135c76){if(ut[_0x2b01('0x98')](_0x5b2a3c)>=_0x38815d['dialGlobalMaxRetry']){_0x38217a=ut['cloneAction'](_0x5b2a3c,0xf,_0x2b01('0xb4'));rpcDb[_0x2b01('0x6b')](_0x38217a,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5b2a3c['countnoanswerretry']>=_0x38815d[_0x2b01('0xb5')]){rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0xb3'));}else{rpcDb[_0x2b01('0x7e')](ut[_0x2b01('0x7f')](_0x5b2a3c,'countnoanswerretry',_0x38815d['dialNoAnswerRetryFrequency']),_0x5b2a3c['unlockAgent'],_0x5b2a3c[_0x2b01('0xac')]);}}}else{_0x5b2a3c[_0x2b01('0xaf')]++;_0x53f4b2[_0x2b01('0x83')]({'id':_0x5b2a3c[_0x2b01('0x82')],'field':{'countnoanswerretry':_0x5b2a3c[_0x2b01('0xaf')]}})[_0x2b01('0x5b')](function(){_0x53f4b2[_0x2b01('0x84')](_0x5b2a3c,_0x302bd5,_0x56b281)[_0x2b01('0x5b')](function(){});});}});break;case _0x2b01('0xb6'):_0x38815d['outboundCongestionCallsDay']+=0x1;_0x5b2a3c[_0x2b01('0xb7')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut[_0x2b01('0x98')](_0x5b2a3c);ut[_0x2b01('0x99')](_0x5b2a3c,0x8,_0x2b01('0xb8'));_0x302bd5=_0x38815d[_0x2b01('0xb9')];_0x56b281=_0x38815d[_0x2b01('0x7b')];ami['emit'](_0x2b01('0xba'),ut[_0x2b01('0x92')](_0x5b2a3c,_0x2b01('0xbb')));rpcDb[_0x2b01('0x67')](_0x5b2a3c,'[callProgressDetectingCustomer][logCongestion]');_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'8',_0x38815d)['then'](function(_0x46fa75){_0x135c76=_0x46fa75[_0x2b01('0x79')]==0x1;if(!_0x135c76){if(ut[_0x2b01('0x98')](_0x5b2a3c)>=_0x38815d[_0x2b01('0x7c')]){_0x38217a=ut[_0x2b01('0xbc')](_0x5b2a3c,0xf,_0x2b01('0xb4'));rpcDb[_0x2b01('0x6b')](_0x38217a,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5b2a3c['countcongestionretry']>=_0x38815d['dialCongestionMaxRetry']){rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0xbd'));}else{rpcDb['rescheduleContact'](ut[_0x2b01('0x7f')](_0x5b2a3c,_0x2b01('0xb7'),_0x38815d[_0x2b01('0xaa')]),_0x5b2a3c[_0x2b01('0xab')],_0x5b2a3c[_0x2b01('0xac')]);}}}else{_0x5b2a3c[_0x2b01('0xb7')]++;_0x53f4b2[_0x2b01('0x83')]({'id':_0x5b2a3c[_0x2b01('0x82')],'field':{'countcongestionretry':_0x5b2a3c[_0x2b01('0xb7')]}})[_0x2b01('0x5b')](function(){_0x53f4b2[_0x2b01('0x84')](_0x5b2a3c,_0x302bd5,_0x56b281)[_0x2b01('0x5b')](function(){});});}});break;case _0x2b01('0xbe'):_0x38815d['outboundRejectCallsDay']+=0x1;_0x5b2a3c[_0x2b01('0xbf')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut[_0x2b01('0x98')](_0x5b2a3c);ut[_0x2b01('0x99')](_0x5b2a3c,0x14,'AgentReject');_0x302bd5=_0x38815d['dialAgentRejectRetryFrequency'];_0x56b281=_0x38815d[_0x2b01('0x7b')];ami[_0x2b01('0x2d')](_0x2b01('0xc0'),ut[_0x2b01('0x92')](_0x5b2a3c,_0x2b01('0xc1')));rpcDb[_0x2b01('0x67')](_0x5b2a3c,'[syncHangupRequest][logAgentReject]');_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'20',_0x38815d)['then'](function(_0x39a7d3){_0x135c76=_0x39a7d3[_0x2b01('0x79')]==0x1;if(!_0x135c76){if(ut[_0x2b01('0x98')](_0x5b2a3c)>=_0x38815d[_0x2b01('0x7c')]){_0x38217a=ut['cloneAction'](_0x5b2a3c,0x14,_0x2b01('0xc2'));rpcDb[_0x2b01('0x6b')](_0x38217a,_0x2b01('0xc3'));}else{if(_0x5b2a3c[_0x2b01('0xbf')]>=_0x38815d['dialAgentRejectMaxRetry']){rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0xc3'));}else{rpcDb[_0x2b01('0x7e')](ut[_0x2b01('0x7f')](_0x5b2a3c,_0x2b01('0xbf'),_0x38815d[_0x2b01('0xc4')]),_0x5b2a3c['unlockAgent'],_0x5b2a3c[_0x2b01('0xac')]);}}}else{_0x5b2a3c[_0x2b01('0xaf')]++;_0x53f4b2['incrementPreviewCounters']({'id':_0x5b2a3c['idContact'],'field':{'countnoanswerretry':_0x5b2a3c[_0x2b01('0xaf')]}})[_0x2b01('0x5b')](function(){_0x53f4b2[_0x2b01('0x84')](_0x5b2a3c,_0x302bd5,_0x56b281)[_0x2b01('0x5b')](function(){});});}});break;case _0x2b01('0xc5'):_0x38815d[_0x2b01('0xc6')]+=0x1;_0x5b2a3c['countabandonedretry']+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut['totalGlobal'](_0x5b2a3c);ut[_0x2b01('0x99')](_0x5b2a3c,0xb,_0x2b01('0xc7'));rpcDb[_0x2b01('0x67')](_0x5b2a3c,'[callProgressDetectingCustomer][logAbandoned]');_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'11',_0x38815d)[_0x2b01('0x5b')](function(_0x919e96){_0x135c76=_0x919e96[_0x2b01('0x79')]==0x1;if(!_0x135c76){if(ut[_0x2b01('0x98')](_0x5b2a3c)>=_0x38815d['dialGlobalMaxRetry']){_0x38217a=ut[_0x2b01('0xbc')](_0x5b2a3c,0xf,_0x2b01('0xb4'));rpcDb[_0x2b01('0x6b')](_0x38217a,_0x2b01('0xc8'));}else{if(_0x5b2a3c['countabandonedetry']>=_0x38815d[_0x2b01('0xc9')]){rpcDb['createCustomerFinal'](_0x5b2a3c,_0x2b01('0xc8'));}else{rpcDb['rescheduleContact'](ut[_0x2b01('0x7f')](_0x5b2a3c,_0x2b01('0xca'),_0x38815d[_0x2b01('0xcb')]),_0x5b2a3c[_0x2b01('0xab')],_0x5b2a3c[_0x2b01('0xac')]);}}}else{_0x5b2a3c['countnoanswerretry']++;_0x53f4b2[_0x2b01('0x83')]({'id':_0x5b2a3c['idContact'],'field':{'countnoanswerretry':_0x5b2a3c[_0x2b01('0xaf')]}})[_0x2b01('0x5b')](function(){_0x53f4b2['swapAdditionalPhones'](_0x5b2a3c,_0x302bd5,_0x56b281)[_0x2b01('0x5b')](function(){});});}});break;case'18':_0x38815d[_0x2b01('0xcc')]+=0x1;_0x5b2a3c[_0x2b01('0xcd')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut[_0x2b01('0x98')](_0x5b2a3c);ut['logCustomer'](_0x5b2a3c,0x12,_0x365db8[_0x2b01('0xce')]||_0x365db8[_0x2b01('0xcf')]);ami[_0x2b01('0x2d')](_0x2b01('0xd0'),ut['buildObj'](_0x5b2a3c,_0x2b01('0xd1')));rpcDb[_0x2b01('0x67')](_0x5b2a3c,_0x2b01('0xd2'));_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'18',_0x38815d)[_0x2b01('0x5b')](function(_0x59ec1c){_0x135c76=_0x59ec1c['additional']==0x1;if(!_0x135c76){if(ut['totalGlobal'](_0x5b2a3c)>=_0x38815d[_0x2b01('0x7c')]){_0x38217a=ut[_0x2b01('0xbc')](_0x5b2a3c,0x12,_0x2b01('0xb4'));rpcDb[_0x2b01('0x6b')](_0x38217a,_0x2b01('0xd2'));}else{rpcDb['createCustomerFinal'](_0x5b2a3c,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x5b2a3c[_0x2b01('0xaf')]++;_0x53f4b2['incrementPreviewCounters']({'id':_0x5b2a3c[_0x2b01('0x82')],'field':{'countnoanswerretry':_0x5b2a3c[_0x2b01('0xaf')]}})[_0x2b01('0x5b')](function(){_0x53f4b2[_0x2b01('0x84')](_0x5b2a3c,_0x302bd5,_0x56b281)[_0x2b01('0x5b')](function(){});});}});delete this[_0x2b01('0x17')][_0x365db8['linkedid']];break;case'19':_0x38815d[_0x2b01('0xcc')]+=0x1;_0x5b2a3c['countglobal']=ut[_0x2b01('0x98')](_0x5b2a3c);ut['logCustomer'](_0x5b2a3c,0x13,_0x365db8[_0x2b01('0xce')]||_0x365db8['dialstatus']);ami[_0x2b01('0x2d')]('custom:amd',ut[_0x2b01('0x92')](_0x5b2a3c,_0x2b01('0xd1')));rpcDb[_0x2b01('0x67')](_0x5b2a3c,_0x2b01('0xd3'));_0x53f4b2['verifyAdditionalPhones'](_0x5b2a3c,'18',_0x38815d)[_0x2b01('0x5b')](function(_0x58fa30){_0x135c76=_0x58fa30[_0x2b01('0x79')]==0x1;if(!_0x135c76){if(ut['totalGlobal'](_0x5b2a3c)>=_0x38815d['dialGlobalMaxRetry']){_0x38217a=ut['cloneAction'](_0x5b2a3c,0xf,_0x2b01('0xb4'));rpcDb[_0x2b01('0x6b')](_0x38217a,_0x2b01('0xd3'));}else{rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0xd3'));}}else{_0x5b2a3c[_0x2b01('0xaf')]++;_0x53f4b2['incrementPreviewCounters']({'id':_0x5b2a3c[_0x2b01('0x82')],'field':{'countnoanswerretry':_0x5b2a3c[_0x2b01('0xaf')]}})[_0x2b01('0x5b')](function(){_0x53f4b2['swapAdditionalPhones'](_0x5b2a3c,_0x302bd5,_0x56b281)['then'](function(){});});}});delete this[_0x2b01('0x17')][_0x365db8['linkedid']];break;default:if(_0x5b2a3c[_0x2b01('0x55')]){ut[_0x2b01('0xd4')](_0x38815d,_0x2b01('0xd5'));ut[_0x2b01('0x56')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x38815d[_0x2b01('0x2c')],_0x365db8);}_0x38815d[_0x2b01('0xcc')]+=0x1;_0x5b2a3c[_0x2b01('0x74')]=ut[_0x2b01('0x98')](_0x5b2a3c);ut[_0x2b01('0x99')](_0x5b2a3c,0xc,_0x365db8['cause-txt']||_0x365db8['dialstatus']);_0x302bd5=_0x38815d['dialAgentRejectRetryFrequency'];_0x56b281=_0x38815d['callAdditionalPhoneAfterMin'];rpcDb[_0x2b01('0x67')](_0x5b2a3c,'[callProgressDetectingCustomer][logUnknown]');_0x53f4b2[_0x2b01('0x78')](_0x5b2a3c,'20',_0x38815d)['then'](function(_0x41c217){_0x135c76=_0x41c217[_0x2b01('0x79')]==0x1;if(!_0x135c76){if(ut['totalGlobal'](_0x5b2a3c)>=_0x38815d[_0x2b01('0x7c')]){_0x38217a=ut[_0x2b01('0xbc')](_0x5b2a3c,0xf,_0x2b01('0xb4'));rpcDb['createCustomerFinal'](_0x38217a,_0x2b01('0xd6'));}else{rpcDb[_0x2b01('0x6b')](_0x5b2a3c,_0x2b01('0xd6'));}delete this[_0x2b01('0x17')][_0x365db8[_0x2b01('0x80')]];}else{_0x53f4b2[_0x2b01('0x84')](_0x5b2a3c,_0x302bd5,_0x56b281)['then'](function(){});}});}if(!(_0x5b2a3c['dialAnswer']&&_0x42d871==='16')){utils[_0x2b01('0x53')](_0x38815d,_0x2b01('0xd7'));logger[_0x2b01('0x28')]('[originated][decrement][callProgressDetectingCustomer]',_0x5b2a3c[_0x2b01('0x8a')],_0x2b01('0x8b'),_0x38815d[_0x2b01('0x2c')],_0x2b01('0x49'),_0x38815d['originated']);}if(_0x42d871!==_0x2b01('0x85')){delete this[_0x2b01('0x17')][_0x365db8[_0x2b01('0x80')]];delete this[_0x2b01('0x17')][_0x365db8[_0x2b01('0xd8')]];}_0x38815d[_0x2b01('0xd9')]=!![];}};Preview[_0x2b01('0x10')][_0x2b01('0xda')]=function(_0x3b8d91,_0x3041aa,_0x18bebc){if(_['isUndefined'](_0x3041aa)&&_0x2b01('0xdb')!==typeof _0x3041aa){return;}if(_[_0x2b01('0xdc')](_0x18bebc)&&'object'!==typeof _0x18bebc){return;}switch(_0x18bebc[_0x2b01('0xdd')]){case'0':ut['logAgent'](_0x3b8d91,0x0,_0x2b01('0xde'));rpcDb[_0x2b01('0xdf')](_0x3b8d91,_0x2b01('0xe0'));break;case'3':ut[_0x2b01('0xe1')](_0x3b8d91,0x3,_0x2b01('0xb0'));rpcDb[_0x2b01('0xdf')](_0x3b8d91,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x2b01('0xe1')](_0x3b8d91,0x5,_0x2b01('0xa5'));rpcDb[_0x2b01('0xdf')](_0x3b8d91,_0x2b01('0xe2'));break;case'8':ut[_0x2b01('0xe1')](_0x3b8d91,0x8,'Congestion');rpcDb['createAgentHistory'](_0x3b8d91,_0x2b01('0xe3'));break;case'22':ut['logAgent'](_0x3b8d91,0x16,_0x2b01('0xe4'));rpcDb[_0x2b01('0xdf')](_0x3b8d91,_0x2b01('0xe5'));break;default:ut[_0x2b01('0xe1')](_0x3b8d91,0xc,_0x18bebc[_0x2b01('0xdd')]);rpcDb[_0x2b01('0xdf')](_0x3b8d91,_0x2b01('0xe3'));}utils[_0x2b01('0x53')](_0x3041aa,_0x2b01('0xe6'));logger[_0x2b01('0x28')](_0x2b01('0xe7'),_0x3b8d91['uniqueid'],'\x20Queue',_0x3041aa[_0x2b01('0x2c')],'originated:\x20',_0x3041aa['originated']);delete this['actions'][_0x3b8d91['uniqueid']];};Preview[_0x2b01('0x10')][_0x2b01('0x78')]=function(_0x41bc55,_0x14c541,_0x1173f0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x41bc55,_0x14c541,_0x1173f0)[_0x2b01('0x51')](logger['info'](_0x2b01('0xe8')));};Preview[_0x2b01('0x10')]['swapAdditionalPhones']=function(_0x20912c,_0xc1c70f,_0x381503){return cmHopperAdditionalPhone[_0x2b01('0x84')](_0x20912c,_0xc1c70f,_0x381503)[_0x2b01('0x51')](logger[_0x2b01('0x28')]('[swapAdditionalPhone]\x20'));};Preview[_0x2b01('0x10')][_0x2b01('0x83')]=function(_0x3ab15e){return Promise[_0x2b01('0xe9')]()[_0x2b01('0x5b')](cmHopperAdditionalPhone[_0x2b01('0x83')](_0x3ab15e))[_0x2b01('0x51')](logger[_0x2b01('0x28')](_0x2b01('0xea')));};Preview[_0x2b01('0x10')]['checkInBlack']=function(_0x671d41,_0x3692af,_0x447d5f,_0x5e7176,_0x4a3c61){var _0x235366=this;return new Promise(function(_0x480f9c,_0x5beac2){if(_[_0x2b01('0x46')](_0x3692af)||_[_0x2b01('0x46')](_0x3692af[_0x2b01('0xeb')])||_['isNil'](_0x3692af['phone'])||_[_0x2b01('0x46')](_0x3692af[_0x2b01('0xec')])){_0x5beac2(ut[_0x2b01('0x33')](_0x2b01('0xed'),_0x5e7176,_0x4a3c61));return;}var _0x2b2c5b=uuid['v4']();var _0x40e9bf=_0x235366[_0x2b01('0x27')][_0x3692af[_0x2b01('0x48')][_0x2b01('0x2c')]];var _0x317712=_0x447d5f?_0x235366[_0x2b01('0x18')][_0x447d5f]['id']:undefined;_0x235366[_0x2b01('0x17')][_0x2b2c5b]=new Action(_0x3692af,_0x40e9bf,_0x2b2c5b,_0x447d5f,_0x317712);var _0x445642=_0x235366[_0x2b01('0x17')][_0x2b2c5b];_0x445642[_0x2b01('0xab')]=_0x5e7176;_0x445642['activeContact']=_0x4a3c61;_0x445642['lookAgent']=_0x447d5f;if(_['isEmpty'](_0x671d41)){_0x235366[_0x2b01('0xee')](_0x445642,_0x40e9bf,_0x3692af,_0x447d5f)['then'](function(_0x2e538d){logger[_0x2b01('0x28')](_0x2b01('0xef'),_0x2b01('0xf0')+_0x445642['queue']+_0x2b01('0xf1')+_0x445642[_0x2b01('0x82')],JSON[_0x2b01('0x2a')](_0x2e538d));ami[_0x2b01('0x2d')](_0x2b01('0xf2'),ut['buildObj'](_0x445642,_0x2b01('0xf3'),_0x235366[_0x2b01('0x27')][_0x445642[_0x2b01('0x4a')]]));_0x480f9c(ut[_0x2b01('0x33')]('Calling'));})[_0x2b01('0x51')](function(_0xc00786){ut['logger'](_0x2b01('0xf4'),_0xc00786);_0x5beac2(ut['message'](_0x2b01('0xf5'),_0x5e7176,_0x4a3c61));});}else{_0x40e9bf[_0x2b01('0xf6')]+=0x1;ut[_0x2b01('0xf7')](_0x445642);rpcDb[_0x2b01('0xf8')](_0x445642,'[Blacklist][error]');delete _0x235366[_0x2b01('0x17')][_0x2b2c5b];_0x5beac2(ut[_0x2b01('0x33')](_0x2b01('0xf9'),_0x5e7176,_0x4a3c61));}});};Preview[_0x2b01('0x10')][_0x2b01('0x70')]=function(_0x12c2c8){return!_['isNil'](_0x12c2c8)&&!_[_0x2b01('0x46')](_0x12c2c8[_0x2b01('0x2c')])&&!_[_0x2b01('0x46')](_0x12c2c8[_0x2b01('0xfa')])&&_0x12c2c8['active']&&!_[_0x2b01('0x46')](this['trunks'][util[_0x2b01('0x2b')](_0x2b01('0xfb'),_0x12c2c8[_0x2b01('0x2c')])])&&!_[_0x2b01('0x46')](this[_0x2b01('0x16')][util[_0x2b01('0x2b')](_0x2b01('0xfb'),_0x12c2c8[_0x2b01('0x2c')])][_0x2b01('0x4f')])&&(this['trunks'][util[_0x2b01('0x2b')](_0x2b01('0xfb'),_0x12c2c8[_0x2b01('0x2c')])][_0x2b01('0x4f')]===_0x2b01('0xfc')||this['trunks'][util[_0x2b01('0x2b')]('SIP/%s',_0x12c2c8[_0x2b01('0x2c')])]['status']==='unmonitored');};Preview[_0x2b01('0x10')][_0x2b01('0xfd')]=function(_0x12c591,_0x3f215c){return this['execRun'](_0x12c591,_0x3f215c)[_0x2b01('0x5b')](function(_0x24f5b5){return _[_0x2b01('0x4b')](_0x24f5b5,[_0x2b01('0x33')]);})[_0x2b01('0x51')](function(_0x17eacc){if(_0x17eacc[_0x2b01('0xfe')]){rpcDb['unlockContact'](_0x12c591);}if(_0x17eacc[_0x2b01('0xfa')]){rpcDb[_0x2b01('0x63')](_0x12c591);}throw _[_0x2b01('0x4b')](_0x17eacc,[_0x2b01('0x33')]);});};Preview[_0x2b01('0x10')][_0x2b01('0xff')]=function(_0x557022,_0xc7780d){var _0x49a0e6=this;var _0x254e85,_0x36e5e3;return rpcDb[_0x2b01('0x100')](_0x557022)['then'](function(_0x15456a){if(!_['isNil'](_0x15456a[0x0])){_0x36e5e3=_0x15456a[0x0][_0x2b01('0x101')]?![]:!![];_0x254e85=_0x15456a[0x0]['recallme']?!![]:![];_0x254e85=_0xc7780d?!![]:_0x254e85;}var _0x56f0da=_0x49a0e6[_0x2b01('0x102')](_0x15456a);if(_0x56f0da['isValid']){rpcDb[_0x2b01('0x103')](_[_0x2b01('0x4b')](_0x15456a[0x0],['VoiceQueueId',_0x2b01('0x104')]))['then'](function(_0x52acc9){_0x49a0e6['checkInBlack'](_0x52acc9,_0x15456a[0x0],_0xc7780d,_0x36e5e3,_0x254e85)[_0x2b01('0x5b')](function(_0x343802){return _0x343802;})[_0x2b01('0x51')](function(_0x298d40){throw _0x298d40;});})[_0x2b01('0x51')](function(_0x20a811){ut[_0x2b01('0x36')](_0x2b01('0x105'),_0x20a811);throw ut[_0x2b01('0x33')](_0x2b01('0x106'),_0x36e5e3,_0x254e85);});}else{throw ut[_0x2b01('0x33')](_0x56f0da[_0x2b01('0x33')],_0x36e5e3,_0x254e85);}})[_0x2b01('0x51')](function(_0x634460){ut['logger'](_0x2b01('0x107'),_0x634460);throw ut['message'](_0x2b01('0x106'),![],!![]);});};Preview[_0x2b01('0x10')]['validateContact']=function(_0x4d1976){if(_['isNil'](_0x4d1976)||_[_0x2b01('0x108')](_0x4d1976)||!_[_0x2b01('0x46')](_0x4d1976[0x0][_0x2b01('0x5f')])&&_[_0x2b01('0x46')](_0x4d1976[0x0][_0x2b01('0x5f')][_0x2b01('0x2c')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x4d1976);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x30e693=this['campaignsPreview'][_0x4d1976[0x0][_0x2b01('0x48')][_0x2b01('0x2c')]];_0x30e693[_0x2b01('0x33')]=utils[_0x2b01('0x34')][_0x2b01('0x109')];if(_[_0x2b01('0x46')](_0x30e693)){ut[_0x2b01('0x36')](_0x2b01('0x10a'),_0x30e693);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x2b01('0x70')](_0x30e693[_0x2b01('0x6f')])){ut[_0x2b01('0x36')](_0x2b01('0x10b'),_0x2b01('0x10c')+_0x30e693['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x2b01('0x70')](_0x30e693['TrunkBackup'])){ut[_0x2b01('0x36')](_0x2b01('0x10b'),_0x30e693[_0x2b01('0x2c')]+_0x2b01('0x10d'));return{'isValid':![],'message':_0x2b01('0x10e')};}}if(!ut[_0x2b01('0x6e')](_0x30e693[_0x2b01('0x41')])){ut[_0x2b01('0x36')](_0x2b01('0x10f'),_0x30e693['name']+_0x2b01('0x110'));return{'isValid':![],'message':_0x2b01('0x10c')+_0x30e693[_0x2b01('0x2c')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x2b01('0x111')};};Preview[_0x2b01('0x10')][_0x2b01('0xee')]=function(_0xd44fe4,_0x2c69f0,_0x4c80a7,_0x1f101e){var _0x1b7651=this;return new Promise(function(_0x3a1ef3,_0x257704){var _0x592d91=_0xd44fe4['uniqueid'];var _0x358def=_0x1b7651[_0x2b01('0x70')](_0x2c69f0['Trunk'])?util['format'](_0x2b01('0x112'),_0x2c69f0['Trunk'][_0x2b01('0x2c')],_[_0x2b01('0x46')](_0x2c69f0['dialPrefix'])?'':_0x2c69f0[_0x2b01('0x113')][_0x2b01('0x114')]()||'',_0x2c69f0['dialCutDigit']>0x0?_0x4c80a7[_0x2b01('0x104')][_0x2b01('0x115')](_0x2c69f0[_0x2b01('0x116')]):_0x4c80a7[_0x2b01('0x104')]):util['format']('SIP/%s/%s%s',_[_0x2b01('0x46')](_0x2c69f0[_0x2b01('0x71')])?_0x2c69f0[_0x2b01('0x6f')][_0x2b01('0x2c')]:_0x2c69f0['TrunkBackup'][_0x2b01('0x2c')],_[_0x2b01('0x46')](_0x2c69f0['dialPrefix'])?'':_0x2c69f0['dialPrefix'][_0x2b01('0x114')]()||'',_0x2c69f0[_0x2b01('0x116')]>0x0?_0x4c80a7[_0x2b01('0x104')][_0x2b01('0x115')](_0x2c69f0[_0x2b01('0x116')]):_0x4c80a7[_0x2b01('0x104')]);var _0x22ec8f=_0x1b7651[_0x2b01('0x70')](_0x2c69f0[_0x2b01('0x6f')])?ut['getCallerId'](_0x2c69f0[_0x2b01('0x6f')][_0x2b01('0x117')],_0x2c69f0[_0x2b01('0x118')],_0x2c69f0['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x2c69f0[_0x2b01('0x119')],_0x2c69f0['dialRandomLastDigitCallerIdNumber']):_0x2c69f0[_0x2b01('0x119')]):ut[_0x2b01('0x11a')](_['isNil'](_0x2c69f0[_0x2b01('0x71')])?_0x2c69f0['Trunk'][_0x2b01('0x117')]:_0x2c69f0[_0x2b01('0x71')][_0x2b01('0x117')],_0x2c69f0[_0x2b01('0x118')],_0x2c69f0[_0x2b01('0x11b')]>0x0?ut['getCallerIdRandom'](_0x2c69f0[_0x2b01('0x119')],_0x2c69f0[_0x2b01('0x11b')]):_0x2c69f0[_0x2b01('0x119')]);if(_0x22ec8f){_0xd44fe4[_0x2b01('0x11c')]=ut['extractCalleridName'](_0x22ec8f);_0xd44fe4['originatecalleridnum']=ut[_0x2b01('0x11d')](_0x22ec8f);}var _0xd7306b=ut['addVariables'](_0x2c69f0,_0x4c80a7,_0x358def,_0x22ec8f,_0x592d91,_0xd44fe4);var _0x477196=utils[_0x2b01('0x11e')](_0x4c80a7[_0x2b01('0xeb')]);Object[_0x2b01('0x11f')](_0xd7306b,_0x477196);_[_0x2b01('0x120')](_0xd44fe4,ut['toLowerVariables'](_0xd7306b));_0xd44fe4[_0x2b01('0x64')]=moment()[_0x2b01('0x2b')](_0x2b01('0x86'));_0x2c69f0['variables']=_0xd7306b;var _0x1c2328=ut['variablesAction'](_0xd44fe4,_0x2c69f0,_0xd7306b,_0xd44fe4[_0x2b01('0xac')],_0x1f101e);return ami[_0x2b01('0x121')](_0x1c2328)['then'](function(_0x24ffa8){_0x2c69f0[_0x2b01('0x2f')]+=0x1;logger[_0x2b01('0x28')](_0x2b01('0x122'),_0x592d91,'\x20Queue',_0x2c69f0[_0x2b01('0x2c')],_0x2b01('0x49'),_0x2c69f0['originated']);_0x3a1ef3(_0x24ffa8);})[_0x2b01('0x51')](function(_0x2a0cb6){ut[_0x2b01('0xe1')](_0xd44fe4,0xe,_0x2b01('0x123'));rpcDb[_0x2b01('0xdf')](_0xd44fe4,_0x2b01('0x124'));_0x257704(_0x2a0cb6);});});};Preview['prototype'][_0x2b01('0x125')]=function(_0x19e944){if(this[_0x2b01('0x17')][_0x19e944[_0x2b01('0x80')]]){this['actions'][_0x19e944['linkedid']][_0x2b01('0x50')]=_0x19e944['channel'];}};Preview[_0x2b01('0x10')]['syncOriginateResponse']=function(_0x2fd3a0){var _0x27fbf7=this;var _0x2f7fde=this['actions'][_0x2fd3a0[_0x2b01('0x126')]];if(_0x2f7fde){if(_0x2f7fde[_0x2b01('0x127')]&&this[_0x2b01('0x18')][_0x2f7fde[_0x2b01('0x127')]]){ut[_0x2b01('0x128')](_0x2f7fde,this[_0x2b01('0x18')][_0x2f7fde['lookAgent']][_0x2b01('0x2c')],this['agents'][_0x2f7fde['lookAgent']]['id']);}var _0x50e3cb=_[_0x2b01('0x129')](_0x2f7fde);_0x50e3cb[_0x2b01('0x87')]=moment()[_0x2b01('0x2b')](_0x2b01('0x86'));var _0x4e6a1a=_0x27fbf7[_0x2b01('0x27')][_0x2f7fde[_0x2b01('0x4a')]];if(ut[_0x2b01('0x12a')](_0x2fd3a0['response'])){if(_0x2f7fde[_0x2b01('0xab')]){rpcDb[_0x2b01('0x12b')](_0x2f7fde[_0x2b01('0x82')]);}if(_0x2f7fde[_0x2b01('0xac')]){rpcDb[_0x2b01('0x63')](_0x2f7fde[_0x2b01('0x82')]);}ami[_0x2b01('0x2d')](_0x2b01('0x12c'),ut[_0x2b01('0x92')](_0x2f7fde,_0x2b01('0x12d'),this['campaignsPreview'][_0x2f7fde[_0x2b01('0x4a')]]));this[_0x2b01('0xda')](_0x50e3cb,_0x4e6a1a,_0x2fd3a0);}else{_0x2f7fde['starttime']=moment()[_0x2b01('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x50e3cb,0x4,'Answer');rpcDb['createAgentHistory'](_0x50e3cb,_0x2b01('0x12e'));}}};Preview[_0x2b01('0x10')][_0x2b01('0x1e')]=function(_0x4c01b5){var _0x552c5f=this[_0x2b01('0x17')][_0x4c01b5[_0x2b01('0x80')]];var _0x480b36;if(_0x552c5f){_0x480b36=this[_0x2b01('0x27')][_0x552c5f[_0x2b01('0x4a')]];logger[_0x2b01('0x28')]('[syncHangup][talking]',_0x4c01b5[_0x2b01('0x80')],_0x2b01('0x8b'),_0x480b36[_0x2b01('0x2c')],_0x2b01('0xa1'),_0x480b36[_0x2b01('0x30')]);}if(this[_0x2b01('0x17')][_0x4c01b5['linkedid']]&&_0x4c01b5['linkedid']!==_0x4c01b5['uniqueid']){if(_0x4c01b5[_0x2b01('0x12f')]==='16'&&this['actions'][_0x4c01b5['linkedid']][_0x2b01('0x55')]){this[_0x2b01('0x130')](_0x4c01b5,_0x4c01b5[_0x2b01('0x80')],_0x4c01b5[_0x2b01('0x12f')]);}else if(this[_0x2b01('0x17')][_0x4c01b5['linkedid']][_0x2b01('0x55')]){logger[_0x2b01('0x28')](_0x2b01('0x131'),_0x4c01b5[_0x2b01('0x80')],_0x4c01b5[_0x2b01('0x12f')],_0x2b01('0x8b'),_0x480b36[_0x2b01('0x2c')],_0x2b01('0xa1'),_0x480b36[_0x2b01('0x30')]);this[_0x2b01('0x130')](_0x4c01b5,_0x4c01b5[_0x2b01('0x80')],_0x4c01b5[_0x2b01('0x12f')]);}}else if(_0x552c5f&&_['isNil'](_0x552c5f['statedesc'])&&_0x480b36[_0x2b01('0x132')]&&_0x4c01b5[_0x2b01('0x80')]===_0x4c01b5[_0x2b01('0x8a')]&&_['isNil'](_0x4c01b5[_0x2b01('0xdd')])&&_0x4c01b5[_0x2b01('0x12f')]==='16'&&_0x4c01b5[_0x2b01('0x133')]==='6'&&_[_0x2b01('0xdc')](_0x552c5f[_0x2b01('0x134')])){if(_0x552c5f[_0x2b01('0xab')]){rpcDb[_0x2b01('0x12b')](_0x552c5f[_0x2b01('0x82')]);}if(_0x552c5f[_0x2b01('0xac')]){rpcDb[_0x2b01('0x63')](_0x552c5f['idContact']);}_0x4c01b5[_0x2b01('0xdd')]='22';this[_0x2b01('0xda')](_0x552c5f,_0x480b36,_0x4c01b5);}else if(_0x552c5f&&_0x552c5f['transfer']){if(_0x4c01b5[_0x2b01('0x12f')]==='16'&&this['actions'][_0x4c01b5[_0x2b01('0x80')]][_0x2b01('0x55')]){logger[_0x2b01('0x28')](_0x2b01('0x135'),_0x4c01b5[_0x2b01('0x80')],_0x4c01b5[_0x2b01('0x12f')],'\x20Queue',_0x480b36[_0x2b01('0x2c')],_0x2b01('0xa1'),_0x480b36[_0x2b01('0x30')]);this[_0x2b01('0x130')](_0x4c01b5,_0x4c01b5['linkedid'],_0x4c01b5[_0x2b01('0x12f')]);}else if(this[_0x2b01('0x17')][_0x4c01b5[_0x2b01('0x80')]][_0x2b01('0x55')]){logger[_0x2b01('0x28')](_0x2b01('0x131'),_0x4c01b5['linkedid'],_0x4c01b5['cause'],_0x2b01('0x8b'),_0x480b36[_0x2b01('0x2c')],_0x2b01('0xa1'),_0x480b36['pTalking']);this[_0x2b01('0x130')](_0x4c01b5,_0x4c01b5['linkedid'],_0x4c01b5[_0x2b01('0x12f')]);}}};Preview[_0x2b01('0x10')]['syncDialEnd']=function(_0x48551d){if(this[_0x2b01('0x17')][_0x48551d[_0x2b01('0xd8')]]&&_0x48551d['destlinkedid']!==_0x48551d[_0x2b01('0x136')]){this[_0x2b01('0x130')](_0x48551d,_0x48551d[_0x2b01('0xd8')],_0x48551d[_0x2b01('0xcf')]);}};Preview[_0x2b01('0x10')][_0x2b01('0x20')]=function(_0x38dff4){if(this[_0x2b01('0x17')][_0x38dff4[_0x2b01('0x80')]]&&_0x38dff4['linkedid']!==_0x38dff4[_0x2b01('0x8a')]&&!this['actions'][_0x38dff4['linkedid']][_0x2b01('0x55')]){if(_0x38dff4[_0x2b01('0x12f')]==='1'){this[_0x2b01('0x130')](_0x38dff4,_0x38dff4[_0x2b01('0x80')],_0x38dff4['cause']);}}};Preview['prototype']['addVariable']=function(_0x1c964e,_0x5501bc,_0x1c5c18){if(this[_0x2b01('0x17')][_0x1c964e]){if(_[_0x2b01('0x46')](this[_0x2b01('0x17')][_0x1c964e]['variables'])){this['actions'][_0x1c964e]['variables']={};}this[_0x2b01('0x17')][_0x1c964e]['variables'][_0x5501bc]=_0x1c5c18;}};Preview[_0x2b01('0x10')][_0x2b01('0x23')]=function(_0x10f1e6){try{if(!_[_0x2b01('0x46')](_0x10f1e6)){if(ut[_0x2b01('0x137')](_[_0x2b01('0x138')](_0x10f1e6[_0x2b01('0x139')])[0x0])){this[_0x2b01('0x13a')](_0x10f1e6[_0x2b01('0x8a')],_[_0x2b01('0x138')](_0x10f1e6[_0x2b01('0x139')])[0x0],_0x10f1e6['value']);}}}catch(_0x1381ca){logger[_0x2b01('0x13b')](_0x2b01('0x13c'),util[_0x2b01('0x13d')](_0x1381ca,{'showHidden':![],'depth':null}));}};Preview[_0x2b01('0x10')][_0x2b01('0x24')]=function(_0x4553fe){if(_0x4553fe){if(this[_0x2b01('0x17')][_0x4553fe[_0x2b01('0x13e')]]){this[_0x2b01('0x17')][_0x4553fe['transfertargetlinkedid']][_0x2b01('0x134')]=!![];}}};Preview[_0x2b01('0x10')][_0x2b01('0x13f')]=function(_0x56a363){if(_0x56a363){if(this['actions'][_0x56a363[_0x2b01('0x140')]]){this[_0x2b01('0x17')][_0x56a363[_0x2b01('0x140')]][_0x2b01('0x134')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xbd4a=['[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','linkedid','custom:amd','[callProgressDetectingCustomer][machine]','dialAnswer','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','unmonitored','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','variables','keys','variable','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','ioredis','../../../config/logger','actionPreview','../ami','./util/util','../dialer/utils','defaults','redis','localhost','prototype','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncNewExten','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','message','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','decrementOriginate','decrementTalking','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','agentReadyId','then','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','complete','total','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbd4a,0x1c6));var _0xabd4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbd4a[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xabd4('0x0'));var _=require('lodash');var uuid=require(_0xabd4('0x1'));var moment=require('moment');var Redis=require(_0xabd4('0x2'));var config=require('../../../config/environment');var logger=require(_0xabd4('0x3'))('preview');var loggerAction=require('../../../config/logger')(_0xabd4('0x4'));var ami=require(_0xabd4('0x5'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xabd4('0x6'));var utils=require(_0xabd4('0x7'));config['redis']=_[_0xabd4('0x8')](config[_0xabd4('0x9')],{'host':_0xabd4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xabd4('0x9')]));var Sequence=function(){};Sequence[_0xabd4('0xb')]['enqueue']=function(_0x47245b){this[_0xabd4('0xc')]=this[_0xabd4('0xc')]?this[_0xabd4('0xc')]['finally'](_0x47245b):_0x47245b();};function Preview(_0x246bc9){this[_0xabd4('0xd')]=new Sequence();this['campaignsPreview']=_0x246bc9[_0xabd4('0xe')];this[_0xabd4('0xf')]=_0x246bc9[_0xabd4('0xf')];this[_0xabd4('0x10')]={};this[_0xabd4('0x11')]=_0x246bc9[_0xabd4('0x11')];this[_0xabd4('0x12')]=0x0;ami['on'](_0xabd4('0x13'),this[_0xabd4('0x14')][_0xabd4('0x15')](this));ami['on'](_0xabd4('0x16'),this['syncHangup'][_0xabd4('0x15')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xabd4('0x15')](this));ami['on']('dialend',this['syncDialEnd'][_0xabd4('0x15')](this));ami['on']('newexten',this[_0xabd4('0x17')][_0xabd4('0x15')](this));ami['on']('varset',this[_0xabd4('0x18')]['bind'](this));ami['on'](_0xabd4('0x19'),this['syncAttendedTransfer'][_0xabd4('0x15')](this));ami['on'](_0xabd4('0x1a'),this[_0xabd4('0x1b')][_0xabd4('0x15')](this));this[_0xabd4('0x1c')](this[_0xabd4('0x1d')]);}function emit(_0x12283c,_0x507c60,_0x4638df){io['to'](_0x12283c)[_0xabd4('0x1e')](_0x507c60,_0x4638df);}function emitVoiceQueueChannelRemove(_0x19adcc){logger[_0xabd4('0x1f')](_0xabd4('0x20'),JSON['stringify'](_0x19adcc));emit(util[_0xabd4('0x21')](_0xabd4('0x22'),_0x19adcc[_0xabd4('0x23')]),_0xabd4('0x24'),_0x19adcc);io[_0xabd4('0x1e')](_0xabd4('0x25'),_0x19adcc);}function notSendMessagesQueue(_0x2faeb1){if(_0x2faeb1[_0xabd4('0x26')]){if(_0x2faeb1[_0xabd4('0x27')]===0x0&&_0x2faeb1[_0xabd4('0x28')]===0x0){_0x2faeb1['sendMessageOneNotActive']=![];_0x2faeb1[_0xabd4('0x29')]=0x0;_0x2faeb1['paused']=0x0;_0x2faeb1[_0xabd4('0x2a')]=utils['CAMPAIGN_STATUS'][_0xabd4('0x2b')];ut[_0xabd4('0x2c')](_0xabd4('0x2d'),_0x2faeb1['name']+_0xabd4('0x2e'));}else{_0x2faeb1['message']=utils[_0xabd4('0x2f')]['DEACTIVATED'];ut[_0xabd4('0x2c')](_0xabd4('0x2d'),_0x2faeb1['name']+'\x20is\x20deactivated');}}}Preview[_0xabd4('0xb')][_0xabd4('0x1c')]=function(){var _0x288960=this;setInterval(function(){_0x288960[_0xabd4('0x30')]();},0x7cf);};Preview[_0xabd4('0xb')][_0xabd4('0x30')]=function(){var _0x4540b7=this[_0xabd4('0x1d')];this[_0xabd4('0x12')]+=0x1;for(var _0x41175b in _0x4540b7){if(_0x4540b7[_0xabd4('0x31')](_0x41175b)&&(_0x4540b7[_0x41175b][_0xabd4('0x32')]===_0xabd4('0x33')||_0x4540b7[_0x41175b][_0xabd4('0x32')]===_0xabd4('0x34'))&&_0x4540b7[_0x41175b][_0xabd4('0x35')]===_0xabd4('0x36')){if(this[_0xabd4('0x12')]>0x7){this[_0xabd4('0x12')]=0x0;this[_0xabd4('0x37')]();}}if(_0x4540b7['hasOwnProperty'](_0x41175b)&&_0x4540b7[_0x41175b]['dialMethod']==='preview'&&_0x4540b7[_0x41175b][_0xabd4('0x35')]===_0xabd4('0x36')){if(_0x4540b7[_0x41175b][_0xabd4('0x38')]){this[_0xabd4('0x39')](_0x4540b7[_0x41175b]);if(_0x4540b7[_0x41175b][_0xabd4('0x3a')])this['recallMe'](_0x4540b7[_0x41175b]);}else{notSendMessagesQueue(_0x4540b7[_0x41175b]);}}}};Preview[_0xabd4('0xb')][_0xabd4('0x3b')]=function(_0x4fe5dd){var _0x15cdc1=this;this[_0xabd4('0xd')][_0xabd4('0x3c')](function(){if(!_[_0xabd4('0x3d')](_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd])){loggerAction[_0xabd4('0x1f')](_0xabd4('0x3e'),_0x4fe5dd,_0xabd4('0x3f'),_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd][_0xabd4('0x40')],_0xabd4('0x41'),JSON[_0xabd4('0x42')](_0x15cdc1[_0xabd4('0x1d')][_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd][_0xabd4('0x40')]]['originated']),_0xabd4('0x43'),JSON['stringify'](_0x15cdc1[_0xabd4('0x1d')][_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd][_0xabd4('0x40')]][_0xabd4('0x28')]),JSON[_0xabd4('0x42')](_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd]['dialAnswer']),JSON['stringify'](_[_0xabd4('0x44')](_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd],[_0xabd4('0x45'),_0xabd4('0x46'),_0xabd4('0x47'),_0xabd4('0x48')])));return ami[_0xabd4('0x49')]({'action':_0xabd4('0x4a'),'channel':_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd][_0xabd4('0x4b')]})['catch'](function(_0x1efccc){if(_0x1efccc[_0xabd4('0x2a')]===_0xabd4('0x4c')){setTimeout(function(){if(_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd]){utils[_0xabd4('0x4d')](_0x15cdc1[_0xabd4('0x1d')][_0x15cdc1['actions'][_0x4fe5dd][_0xabd4('0x40')]],'[clearZombieChannel]');if(_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd]['dialAnswer']===!![]){ut[_0xabd4('0x4e')](_0x15cdc1[_0xabd4('0x1d')][_0x15cdc1['actions'][_0x4fe5dd][_0xabd4('0x40')]],_0xabd4('0x4f'));ut['loggerError'](_0xabd4('0x50')+_0x4fe5dd,_0x15cdc1['actions'][_0x4fe5dd][_0xabd4('0x40')]);}ut[_0xabd4('0x51')](_0xabd4('0x52')+_0x4fe5dd,_0x15cdc1[_0xabd4('0x10')][_0x4fe5dd]['queue']);delete _0x15cdc1[_0xabd4('0x10')][_0x4fe5dd];}},0x2328);}});}});};Preview[_0xabd4('0xb')][_0xabd4('0x37')]=function(){var _0x56db18=this;loggerAction['info'](_0xabd4('0x53'),_['size'](this[_0xabd4('0x10')]));for(var _0x5d8843 in this[_0xabd4('0x10')]){if(_0x56db18[_0xabd4('0x10')][_0xabd4('0x31')](_0x5d8843)){_0x56db18[_0xabd4('0x3b')](_0x5d8843);}}};Preview[_0xabd4('0xb')]['recallMe']=function(_0x34fc99){var _0x20a5ac=this;rpcDb['getContactRecallMe'](_0x34fc99['id'],ut[_0xabd4('0x54')](this[_0xabd4('0x11')]))[_0xabd4('0x55')](function(_0xadf7cb){if(!_['isNil'](_0xadf7cb)){for(var _0x218df8=0x0;_0x218df8<_0xadf7cb['length'];_0x218df8+=0x1){if(ut['getDiff'](_0xadf7cb[_0x218df8]['scheduledat'])<_0x34fc99[_0xabd4('0x56')]*0x3c){if(_0xadf7cb[_0x218df8][_0xabd4('0x57')]&&!_0xadf7cb[_0x218df8][_0xabd4('0x57')]['voicePause']){_0x20a5ac[_0xabd4('0x58')](_0xadf7cb[_0x218df8]['id'])[_0xabd4('0x55')](ut[_0xabd4('0x59')](_0xabd4('0x5a')))[_0xabd4('0x5b')](ut[_0xabd4('0x59')](_0xabd4('0x5a')));}else{rpcDb[_0xabd4('0x5c')](_0xadf7cb[_0x218df8]['id']);}}else{var _0x438c1d=new Action(_0xadf7cb[_0x218df8],_0x34fc99);_0x438c1d[_0xabd4('0x5d')]=moment()[_0xabd4('0x21')]('YYYY-MM-DD\x20HH:mm:ss');_0x34fc99[_0xabd4('0x5e')]+=0x1;ut[_0xabd4('0x5f')](_0x438c1d,0x17,_0xabd4('0x60'));if(_0x34fc99['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0xabd4('0x61')](_0xadf7cb[_0x218df8]));rpcDb[_0xabd4('0x62')](_0x438c1d,_0xabd4('0x63'));}else{ut['logCustomer'](_0x438c1d,0x16,'RecallFailedTimeout');rpcDb[_0xabd4('0x62')](_0x438c1d,_0xabd4('0x64'));rpcDb[_0xabd4('0x65')](_0x438c1d,_0xabd4('0x64'));}}}}})[_0xabd4('0x5b')](ut['logger2'](_0xabd4('0x66')));};Preview[_0xabd4('0xb')][_0xabd4('0x39')]=function(_0x758072){_0x758072[_0xabd4('0x26')]=!![];if(ut[_0xabd4('0x67')](_0x758072[_0xabd4('0x68')])){_0x758072['message']=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0x758072['dialActive'])){_0x758072[_0xabd4('0x2a')]=utils['CAMPAIGN_STATUS'][_0xabd4('0x2b')];}else if(!this[_0xabd4('0x69')](_0x758072[_0xabd4('0x6a')])){if(!this['isTrunkReachable'](_0x758072[_0xabd4('0x6b')])){_0x758072[_0xabd4('0x2a')]=utils[_0xabd4('0x2f')][_0xabd4('0x6c')];}else{_0x758072[_0xabd4('0x2a')]=utils['CAMPAIGN_STATUS'][_0xabd4('0x6d')];}}else{_0x758072[_0xabd4('0x2a')]=utils[_0xabd4('0x2f')][_0xabd4('0x6d')];}};Preview['prototype'][_0xabd4('0x6e')]=function(_0x2353ce,_0x5bdf4b,_0x1662a8){var _0xa7a86a=this;var _0x34b268=this[_0xabd4('0x10')][_0x5bdf4b];var _0x57edf6=this[_0xabd4('0x1d')][_0x34b268[_0xabd4('0x40')]];var _0x39e1ff;var _0x30c6ba=![];var _0x484bdd=0x2;var _0x168496=0x3;if(_0x57edf6){switch(_0x1662a8){case'1':_0x57edf6[_0xabd4('0x6f')]+=0x1;_0x34b268[_0xabd4('0x70')]+=0x1;_0x34b268[_0xabd4('0x71')]=ut['totalGlobal'](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0x0,_0xabd4('0x72'));ami[_0xabd4('0x1e')](_0xabd4('0x73'),ut[_0xabd4('0x74')](_0x34b268,'nosuchnumber'));rpcDb[_0xabd4('0x62')](_0x34b268,_0xabd4('0x75'));_0xa7a86a['verifyAdditionalPhones'](_0x34b268,'0',_0x57edf6)[_0xabd4('0x55')](function(_0xb3a374){_0x30c6ba=_0xb3a374[_0xabd4('0x76')]==0x1;_0x484bdd=_0x57edf6[_0xabd4('0x77')];_0x168496=_0x57edf6[_0xabd4('0x78')];if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut[_0xabd4('0x7b')](_0x34b268,0xf,'Global');rpcDb[_0xabd4('0x65')](_0x39e1ff,_0xabd4('0x7c'));}else{if(_0x34b268[_0xabd4('0x70')]>=_0x57edf6[_0xabd4('0x7d')]){rpcDb['createCustomerFinal'](_0x34b268,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xabd4('0x7e')](ut[_0xabd4('0x7f')](_0x34b268,'countnosuchnumberretry',_0x57edf6[_0xabd4('0x77')]),_0x34b268[_0xabd4('0x80')],_0x34b268[_0xabd4('0x81')]);}}delete this[_0xabd4('0x10')][_0x2353ce['linkedid']];}else{_0x34b268[_0xabd4('0x70')]++;logger['info'](_0xabd4('0x82'),_0x34b268['countnosuchnumberretry']);logger[_0xabd4('0x1f')]('id',_0x34b268[_0xabd4('0x83')]);_0xa7a86a[_0xabd4('0x84')]({'id':_0x34b268[_0xabd4('0x83')],'field':{'countnosuchnumberretry':_0x34b268[_0xabd4('0x70')]}})[_0xabd4('0x55')](function(){_0xa7a86a[_0xabd4('0x85')](_0x34b268,_0x484bdd,_0x168496)[_0xabd4('0x55')](function(){});});}});break;case _0xabd4('0x86'):var _0x1480de=moment()[_0xabd4('0x21')](_0xabd4('0x87'));_0x34b268[_0xabd4('0x88')]=_0x1480de;_0x34b268[_0xabd4('0x89')]=_0x1480de;_0x34b268['dialAnswer']=!![];_0x57edf6['pTalking']+=0x1;logger[_0xabd4('0x1f')](_0xabd4('0x8a'),_0x34b268[_0xabd4('0x8b')],_0xabd4('0x8c'),_0x57edf6[_0xabd4('0x23')],'pTalking:\x20',_0x57edf6[_0xabd4('0x28')]);ami['emit'](_0xabd4('0x8d'),ut['buildObj'](_0x34b268,_0xabd4('0x8e'),this[_0xabd4('0x1d')][_0x34b268['queue']]));if(_0x57edf6[_0xabd4('0x8f')]||_0x57edf6[_0xabd4('0x90')]){ami['emit'](_0xabd4('0x91'),{'queue':_0x34b268[_0xabd4('0x40')],'interface':_0x34b268[_0xabd4('0x92')],'uniqueid':_0x34b268['uniqueid']});}break;case'16':ami[_0xabd4('0x1e')]('custom:agentcomplete',ut[_0xabd4('0x74')](_0x34b268,_0xabd4('0x93'),this[_0xabd4('0x1d')][_0x34b268['queue']]));emitVoiceQueueChannelRemove(ut[_0xabd4('0x74')](_0x34b268,_0xabd4('0x93')));_0x57edf6['outboundAnswerCallsDay']+=0x1;_0x57edf6[_0xabd4('0x94')]+=0x1;_0x57edf6[_0xabd4('0x95')]+=0x1;ut[_0xabd4('0x4e')](_0x57edf6,'[16]');_0x34b268['countglobal']=ut['totalGlobal'](_0x34b268);ut['logCustomer'](_0x34b268,0x4,'Answer');rpcDb['createCustomerHistory'](_0x34b268,_0xabd4('0x96'));rpcDb['createCustomerFinal'](_0x34b268,_0xabd4('0x97'));rpcDb[_0xabd4('0x98')](_0x34b268);_0x57edf6[_0xabd4('0x99')]+=_0x34b268[_0xabd4('0x9a')];_0x57edf6['sumBillable']+=_0x34b268[_0xabd4('0x9a')];logger[_0xabd4('0x1f')](_0xabd4('0x9b'),_0x34b268[_0xabd4('0x8b')],_0xabd4('0x8c'),_0x57edf6[_0xabd4('0x23')],_0xabd4('0x43'),_0x57edf6['pTalking']);delete this['actions'][_0x2353ce['linkedid']];break;case'BUSY':_0x57edf6['outboundBusyCallsDay']+=0x1;_0x34b268[_0xabd4('0x9c')]+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut['logCustomer'](_0x34b268,0x5,_0xabd4('0x9d'));_0x484bdd=_0x57edf6[_0xabd4('0x9e')];_0x168496=_0x57edf6['callAdditionalPhoneAfterMin'];ami[_0xabd4('0x1e')](_0xabd4('0x9f'),ut['buildObj'](_0x34b268,_0xabd4('0xa0')));rpcDb[_0xabd4('0x62')](_0x34b268,_0xabd4('0xa1'));_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'5',_0x57edf6)[_0xabd4('0x55')](function(_0x431439){_0x30c6ba=_0x431439[_0xabd4('0x76')]==0x1;if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut['cloneAction'](_0x34b268,0xf,_0xabd4('0xa3'));rpcDb['createCustomerFinal'](_0x39e1ff,_0xabd4('0xa4'));}else{if(_0x34b268[_0xabd4('0x9c')]>=_0x57edf6[_0xabd4('0xa5')]){rpcDb[_0xabd4('0x65')](_0x34b268,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xabd4('0x7e')](ut[_0xabd4('0x7f')](_0x34b268,_0xabd4('0x9c'),_0x57edf6['dialBusyRetryFrequency']),_0x34b268[_0xabd4('0x80')],_0x34b268['activeContact']);}}}else{_0x34b268['countbusyretry']++;_0xa7a86a['incrementPreviewCounters']({'id':_0x34b268[_0xabd4('0x83')],'field':{'countbusyretry':_0x34b268[_0xabd4('0x9c')]}})[_0xabd4('0x55')](function(){_0xa7a86a['swapAdditionalPhones'](_0x34b268,_0x484bdd,_0x168496)['then'](function(){});});}});break;case _0xabd4('0xa6'):_0x57edf6[_0xabd4('0xa7')]+=0x1;_0x34b268[_0xabd4('0xa8')]+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0x3,_0xabd4('0xa9'));_0x484bdd=_0x57edf6[_0xabd4('0xaa')];_0x168496=_0x57edf6[_0xabd4('0x78')];var _0x3da457=ut['buildNoAnswerEventPayload'](_0x34b268,_0x57edf6);ami[_0xabd4('0x1e')](_0xabd4('0xab'),_0x3da457);rpcDb['createCustomerHistory'](_0x34b268,_0xabd4('0xac'));_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'3',_0x57edf6)[_0xabd4('0x55')](function(_0x50c97a){_0x30c6ba=_0x50c97a['additional']==0x1;if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut[_0xabd4('0x7b')](_0x34b268,0xf,_0xabd4('0xa3'));rpcDb[_0xabd4('0x65')](_0x39e1ff,_0xabd4('0xad'));}else{if(_0x34b268['countnoanswerretry']>=_0x57edf6[_0xabd4('0xae')]){rpcDb['createCustomerFinal'](_0x34b268,_0xabd4('0xac'));}else{rpcDb[_0xabd4('0x7e')](ut[_0xabd4('0x7f')](_0x34b268,'countnoanswerretry',_0x57edf6[_0xabd4('0xaa')]),_0x34b268[_0xabd4('0x80')],_0x34b268[_0xabd4('0x81')]);}}}else{_0x34b268['countnoanswerretry']++;_0xa7a86a[_0xabd4('0x84')]({'id':_0x34b268[_0xabd4('0x83')],'field':{'countnoanswerretry':_0x34b268[_0xabd4('0xa8')]}})['then'](function(){_0xa7a86a[_0xabd4('0x85')](_0x34b268,_0x484bdd,_0x168496)[_0xabd4('0x55')](function(){});});}});break;case _0xabd4('0xaf'):_0x57edf6[_0xabd4('0xb0')]+=0x1;_0x34b268['countcongestionretry']+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0x8,'Congestion');_0x484bdd=_0x57edf6[_0xabd4('0xb1')];_0x168496=_0x57edf6[_0xabd4('0x78')];ami[_0xabd4('0x1e')](_0xabd4('0xb2'),ut[_0xabd4('0x74')](_0x34b268,_0xabd4('0xb3')));rpcDb[_0xabd4('0x62')](_0x34b268,_0xabd4('0xb4'));_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'8',_0x57edf6)[_0xabd4('0x55')](function(_0x2687f7){_0x30c6ba=_0x2687f7[_0xabd4('0x76')]==0x1;if(!_0x30c6ba){if(ut['totalGlobal'](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut['cloneAction'](_0x34b268,0xf,_0xabd4('0xa3'));rpcDb[_0xabd4('0x65')](_0x39e1ff,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x34b268['countcongestionretry']>=_0x57edf6[_0xabd4('0xb5')]){rpcDb[_0xabd4('0x65')](_0x34b268,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xabd4('0x7e')](ut[_0xabd4('0x7f')](_0x34b268,_0xabd4('0xb6'),_0x57edf6[_0xabd4('0x9e')]),_0x34b268[_0xabd4('0x80')],_0x34b268[_0xabd4('0x81')]);}}}else{_0x34b268[_0xabd4('0xb6')]++;_0xa7a86a[_0xabd4('0x84')]({'id':_0x34b268[_0xabd4('0x83')],'field':{'countcongestionretry':_0x34b268[_0xabd4('0xb6')]}})[_0xabd4('0x55')](function(){_0xa7a86a[_0xabd4('0x85')](_0x34b268,_0x484bdd,_0x168496)[_0xabd4('0x55')](function(){});});}});break;case _0xabd4('0xb7'):_0x57edf6[_0xabd4('0xb8')]+=0x1;_0x34b268[_0xabd4('0xb9')]+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0x14,_0xabd4('0xba'));_0x484bdd=_0x57edf6[_0xabd4('0xbb')];_0x168496=_0x57edf6[_0xabd4('0x78')];ami[_0xabd4('0x1e')]('custom:agentreject',ut[_0xabd4('0x74')](_0x34b268,_0xabd4('0xbc')));rpcDb['createCustomerHistory'](_0x34b268,_0xabd4('0xbd'));_0xa7a86a['verifyAdditionalPhones'](_0x34b268,'20',_0x57edf6)[_0xabd4('0x55')](function(_0x311536){_0x30c6ba=_0x311536[_0xabd4('0x76')]==0x1;if(!_0x30c6ba){if(ut['totalGlobal'](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut[_0xabd4('0x7b')](_0x34b268,0x14,_0xabd4('0xba'));rpcDb['createCustomerFinal'](_0x39e1ff,_0xabd4('0xbe'));}else{if(_0x34b268['countagentrejectretry']>=_0x57edf6[_0xabd4('0xbf')]){rpcDb[_0xabd4('0x65')](_0x34b268,_0xabd4('0xbe'));}else{rpcDb[_0xabd4('0x7e')](ut[_0xabd4('0x7f')](_0x34b268,_0xabd4('0xb9'),_0x57edf6[_0xabd4('0xbb')]),_0x34b268[_0xabd4('0x80')],_0x34b268[_0xabd4('0x81')]);}}}else{_0x34b268[_0xabd4('0xa8')]++;_0xa7a86a[_0xabd4('0x84')]({'id':_0x34b268['idContact'],'field':{'countnoanswerretry':_0x34b268[_0xabd4('0xa8')]}})[_0xabd4('0x55')](function(){_0xa7a86a[_0xabd4('0x85')](_0x34b268,_0x484bdd,_0x168496)['then'](function(){});});}});break;case'ABANDONED':_0x57edf6[_0xabd4('0xc0')]+=0x1;_0x34b268[_0xabd4('0xc1')]+=0x1;_0x34b268[_0xabd4('0x71')]=ut['totalGlobal'](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0xb,_0xabd4('0xc2'));rpcDb[_0xabd4('0x62')](_0x34b268,'[callProgressDetectingCustomer][logAbandoned]');_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'11',_0x57edf6)[_0xabd4('0x55')](function(_0x4c5ee9){_0x30c6ba=_0x4c5ee9['additional']==0x1;if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut['cloneAction'](_0x34b268,0xf,_0xabd4('0xa3'));rpcDb['createCustomerFinal'](_0x39e1ff,_0xabd4('0xc3'));}else{if(_0x34b268[_0xabd4('0xc4')]>=_0x57edf6[_0xabd4('0xc5')]){rpcDb['createCustomerFinal'](_0x34b268,_0xabd4('0xc3'));}else{rpcDb[_0xabd4('0x7e')](ut[_0xabd4('0x7f')](_0x34b268,_0xabd4('0xc1'),_0x57edf6[_0xabd4('0xc6')]),_0x34b268[_0xabd4('0x80')],_0x34b268[_0xabd4('0x81')]);}}}else{_0x34b268[_0xabd4('0xa8')]++;_0xa7a86a['incrementPreviewCounters']({'id':_0x34b268[_0xabd4('0x83')],'field':{'countnoanswerretry':_0x34b268[_0xabd4('0xa8')]}})['then'](function(){_0xa7a86a['swapAdditionalPhones'](_0x34b268,_0x484bdd,_0x168496)[_0xabd4('0x55')](function(){});});}});break;case'18':_0x57edf6['outboundUnknownCallsDay']+=0x1;_0x34b268[_0xabd4('0xc7')]+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0x12,_0x2353ce[_0xabd4('0xc8')]||_0x2353ce[_0xabd4('0xc9')]);ami[_0xabd4('0x1e')]('custom:amd',ut['buildObj'](_0x34b268,'amd'));rpcDb['createCustomerHistory'](_0x34b268,_0xabd4('0xca'));_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'18',_0x57edf6)[_0xabd4('0x55')](function(_0x32bea2){_0x30c6ba=_0x32bea2[_0xabd4('0x76')]==0x1;if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut[_0xabd4('0x7b')](_0x34b268,0x12,_0xabd4('0xa3'));rpcDb['createCustomerFinal'](_0x39e1ff,_0xabd4('0xca'));}else{rpcDb['createCustomerFinal'](_0x34b268,_0xabd4('0xca'));}}else{_0x34b268[_0xabd4('0xa8')]++;_0xa7a86a[_0xabd4('0x84')]({'id':_0x34b268[_0xabd4('0x83')],'field':{'countnoanswerretry':_0x34b268[_0xabd4('0xa8')]}})[_0xabd4('0x55')](function(){_0xa7a86a[_0xabd4('0x85')](_0x34b268,_0x484bdd,_0x168496)['then'](function(){});});}});delete this['actions'][_0x2353ce[_0xabd4('0xcb')]];break;case'19':_0x57edf6['outboundUnknownCallsDay']+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut[_0xabd4('0x5f')](_0x34b268,0x13,_0x2353ce[_0xabd4('0xc8')]||_0x2353ce['dialstatus']);ami[_0xabd4('0x1e')](_0xabd4('0xcc'),ut['buildObj'](_0x34b268,'amd'));rpcDb[_0xabd4('0x62')](_0x34b268,'[callProgressDetectingCustomer][machine]');_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'18',_0x57edf6)[_0xabd4('0x55')](function(_0x503ce4){_0x30c6ba=_0x503ce4[_0xabd4('0x76')]==0x1;if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut[_0xabd4('0x7b')](_0x34b268,0xf,_0xabd4('0xa3'));rpcDb[_0xabd4('0x65')](_0x39e1ff,_0xabd4('0xcd'));}else{rpcDb[_0xabd4('0x65')](_0x34b268,_0xabd4('0xcd'));}}else{_0x34b268[_0xabd4('0xa8')]++;_0xa7a86a[_0xabd4('0x84')]({'id':_0x34b268[_0xabd4('0x83')],'field':{'countnoanswerretry':_0x34b268['countnoanswerretry']}})['then'](function(){_0xa7a86a[_0xabd4('0x85')](_0x34b268,_0x484bdd,_0x168496)[_0xabd4('0x55')](function(){});});}});delete this['actions'][_0x2353ce[_0xabd4('0xcb')]];break;default:if(_0x34b268[_0xabd4('0xce')]){ut[_0xabd4('0x4e')](_0x57edf6,'[default]');ut[_0xabd4('0x51')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x57edf6['name'],_0x2353ce);}_0x57edf6['outboundUnknownCallsDay']+=0x1;_0x34b268[_0xabd4('0x71')]=ut[_0xabd4('0x79')](_0x34b268);ut['logCustomer'](_0x34b268,0xc,_0x2353ce['cause-txt']||_0x2353ce['dialstatus']);_0x484bdd=_0x57edf6['dialAgentRejectRetryFrequency'];_0x168496=_0x57edf6['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x34b268,_0xabd4('0xcf'));_0xa7a86a[_0xabd4('0xa2')](_0x34b268,'20',_0x57edf6)[_0xabd4('0x55')](function(_0x1e7e7c){_0x30c6ba=_0x1e7e7c[_0xabd4('0x76')]==0x1;if(!_0x30c6ba){if(ut[_0xabd4('0x79')](_0x34b268)>=_0x57edf6[_0xabd4('0x7a')]){_0x39e1ff=ut[_0xabd4('0x7b')](_0x34b268,0xf,_0xabd4('0xa3'));rpcDb[_0xabd4('0x65')](_0x39e1ff,_0xabd4('0xd0'));}else{rpcDb[_0xabd4('0x65')](_0x34b268,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xabd4('0x10')][_0x2353ce[_0xabd4('0xcb')]];}else{_0xa7a86a['swapAdditionalPhones'](_0x34b268,_0x484bdd,_0x168496)[_0xabd4('0x55')](function(){});}});}if(!(_0x34b268[_0xabd4('0xce')]&&_0x1662a8==='16')){utils['decrementOriginate'](_0x57edf6,_0xabd4('0xd1'));logger[_0xabd4('0x1f')]('[originated][decrement][callProgressDetectingCustomer]',_0x34b268[_0xabd4('0x8b')],_0xabd4('0x8c'),_0x57edf6[_0xabd4('0x23')],_0xabd4('0x41'),_0x57edf6[_0xabd4('0x27')]);}if(_0x1662a8!==_0xabd4('0x86')){delete this[_0xabd4('0x10')][_0x2353ce[_0xabd4('0xcb')]];delete this['actions'][_0x2353ce[_0xabd4('0xd2')]];}_0x57edf6[_0xabd4('0xd3')]=!![];}};Preview['prototype'][_0xabd4('0xd4')]=function(_0x5e18b4,_0x5f01f2,_0x29ead9){if(_[_0xabd4('0xd5')](_0x5f01f2)&&_0xabd4('0xd6')!==typeof _0x5f01f2){return;}if(_[_0xabd4('0xd5')](_0x29ead9)&&_0xabd4('0xd6')!==typeof _0x29ead9){return;}switch(_0x29ead9[_0xabd4('0xd7')]){case'0':ut[_0xabd4('0xd8')](_0x5e18b4,0x0,'NoSuchNumber');rpcDb[_0xabd4('0xd9')](_0x5e18b4,_0xabd4('0xda'));break;case'3':ut[_0xabd4('0xd8')](_0x5e18b4,0x3,'NoAnswer');rpcDb[_0xabd4('0xd9')](_0x5e18b4,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xabd4('0xd8')](_0x5e18b4,0x5,_0xabd4('0x9d'));rpcDb['createAgentHistory'](_0x5e18b4,_0xabd4('0xdb'));break;case'8':ut[_0xabd4('0xd8')](_0x5e18b4,0x8,'Congestion');rpcDb['createAgentHistory'](_0x5e18b4,_0xabd4('0xdc'));break;case'22':ut[_0xabd4('0xd8')](_0x5e18b4,0x16,_0xabd4('0xdd'));rpcDb['createAgentHistory'](_0x5e18b4,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xabd4('0xd8')](_0x5e18b4,0xc,_0x29ead9['reason']);rpcDb['createAgentHistory'](_0x5e18b4,_0xabd4('0xdc'));}utils[_0xabd4('0x4d')](_0x5f01f2,'[callProgressDetectingAgent]');logger[_0xabd4('0x1f')](_0xabd4('0xde'),_0x5e18b4[_0xabd4('0x8b')],_0xabd4('0x8c'),_0x5f01f2[_0xabd4('0x23')],'originated:\x20',_0x5f01f2['originated']);delete this[_0xabd4('0x10')][_0x5e18b4[_0xabd4('0x8b')]];};Preview[_0xabd4('0xb')][_0xabd4('0xa2')]=function(_0x3fd839,_0x100b67,_0x1f138b){return cmHopperAdditionalPhone[_0xabd4('0xa2')](_0x3fd839,_0x100b67,_0x1f138b)[_0xabd4('0x5b')](logger['info'](_0xabd4('0xdf')));};Preview[_0xabd4('0xb')][_0xabd4('0x85')]=function(_0x43c61e,_0x47e428,_0xff1e62){return cmHopperAdditionalPhone[_0xabd4('0x85')](_0x43c61e,_0x47e428,_0xff1e62)[_0xabd4('0x5b')](logger[_0xabd4('0x1f')]('[swapAdditionalPhone]\x20'));};Preview[_0xabd4('0xb')][_0xabd4('0x84')]=function(_0x1333c5){return Promise[_0xabd4('0xe0')]()['then'](cmHopperAdditionalPhone[_0xabd4('0x84')](_0x1333c5))['catch'](logger[_0xabd4('0x1f')](_0xabd4('0xe1')));};Preview[_0xabd4('0xb')][_0xabd4('0xe2')]=function(_0x50d027,_0x4d4eb2,_0x510a2d,_0x61ef4c,_0x368368){var _0x36f134=this;return new Promise(function(_0x5aca73,_0x20853d){if(_['isNil'](_0x4d4eb2)||_[_0xabd4('0x3d')](_0x4d4eb2['Contact'])||_[_0xabd4('0x3d')](_0x4d4eb2[_0xabd4('0xe3')])||_[_0xabd4('0x3d')](_0x4d4eb2[_0xabd4('0x47')])){_0x20853d(ut[_0xabd4('0x2a')](_0xabd4('0xe4'),_0x61ef4c,_0x368368));return;}var _0xb24c14=uuid['v4']();var _0x3014a6=_0x36f134[_0xabd4('0x1d')][_0x4d4eb2[_0xabd4('0x3f')][_0xabd4('0x23')]];var _0x498e3c=_0x510a2d?_0x36f134[_0xabd4('0x11')][_0x510a2d]['id']:undefined;_0x36f134[_0xabd4('0x10')][_0xb24c14]=new Action(_0x4d4eb2,_0x3014a6,_0xb24c14,_0x510a2d,_0x498e3c);var _0x3c9c7a=_0x36f134[_0xabd4('0x10')][_0xb24c14];_0x3c9c7a[_0xabd4('0x80')]=_0x61ef4c;_0x3c9c7a[_0xabd4('0x81')]=_0x368368;_0x3c9c7a[_0xabd4('0xe5')]=_0x510a2d;if(_['isEmpty'](_0x50d027)){_0x36f134[_0xabd4('0xe6')](_0x3c9c7a,_0x3014a6,_0x4d4eb2,_0x510a2d)[_0xabd4('0x55')](function(_0x443354){logger[_0xabd4('0x1f')](_0xabd4('0xe7'),_0xabd4('0xe8')+_0x3c9c7a[_0xabd4('0x40')]+_0xabd4('0xe9')+_0x3c9c7a[_0xabd4('0x83')],JSON[_0xabd4('0x42')](_0x443354));ami[_0xabd4('0x1e')](_0xabd4('0xea'),ut[_0xabd4('0x74')](_0x3c9c7a,_0xabd4('0xeb'),_0x36f134['campaignsPreview'][_0x3c9c7a['queue']]));_0x5aca73(ut[_0xabd4('0x2a')](_0xabd4('0xec')));})[_0xabd4('0x5b')](function(_0x725282){ut[_0xabd4('0x2c')](_0xabd4('0xed'),_0x725282);_0x20853d(ut[_0xabd4('0x2a')](_0xabd4('0xee'),_0x61ef4c,_0x368368));});}else{_0x3014a6[_0xabd4('0xef')]+=0x1;ut[_0xabd4('0xf0')](_0x3c9c7a);rpcDb[_0xabd4('0xf1')](_0x3c9c7a,_0xabd4('0xf2'));delete _0x36f134[_0xabd4('0x10')][_0xb24c14];_0x20853d(ut[_0xabd4('0x2a')]('Contact\x20in\x20black\x20List',_0x61ef4c,_0x368368));}});};Preview[_0xabd4('0xb')][_0xabd4('0x69')]=function(_0x2f6cbb){return!_[_0xabd4('0x3d')](_0x2f6cbb)&&!_['isNil'](_0x2f6cbb[_0xabd4('0x23')])&&!_[_0xabd4('0x3d')](_0x2f6cbb[_0xabd4('0xf3')])&&_0x2f6cbb[_0xabd4('0xf3')]&&!_[_0xabd4('0x3d')](this['trunks'][util['format']('SIP/%s',_0x2f6cbb[_0xabd4('0x23')])])&&!_[_0xabd4('0x3d')](this[_0xabd4('0xf')][util[_0xabd4('0x21')](_0xabd4('0xf4'),_0x2f6cbb[_0xabd4('0x23')])][_0xabd4('0x4a')])&&(this[_0xabd4('0xf')][util[_0xabd4('0x21')](_0xabd4('0xf4'),_0x2f6cbb[_0xabd4('0x23')])][_0xabd4('0x4a')]==='reachable'||this[_0xabd4('0xf')][util[_0xabd4('0x21')]('SIP/%s',_0x2f6cbb['name'])][_0xabd4('0x4a')]===_0xabd4('0xf5'));};Preview['prototype'][_0xabd4('0x58')]=function(_0xf2fec6,_0x186118){return this['execRun'](_0xf2fec6,_0x186118)[_0xabd4('0x55')](function(_0x3dc3c1){return _['pick'](_0x3dc3c1,['message']);})[_0xabd4('0x5b')](function(_0x3ce5cf){if(_0x3ce5cf[_0xabd4('0xf6')]){rpcDb[_0xabd4('0xf7')](_0xf2fec6);}if(_0x3ce5cf['active']){rpcDb[_0xabd4('0x5c')](_0xf2fec6);}throw _['pick'](_0x3ce5cf,[_0xabd4('0x2a')]);});};Preview[_0xabd4('0xb')]['execRun']=function(_0x1f17d3,_0x5d28d1){var _0x127803=this;var _0x2c4dad,_0x1a0d4f;return rpcDb[_0xabd4('0xf8')](_0x1f17d3)[_0xabd4('0x55')](function(_0x28e10a){if(!_['isNil'](_0x28e10a[0x0])){_0x1a0d4f=_0x28e10a[0x0][_0xabd4('0xf9')]?![]:!![];_0x2c4dad=_0x28e10a[0x0][_0xabd4('0xf9')]?!![]:![];_0x2c4dad=_0x5d28d1?!![]:_0x2c4dad;}var _0x5cefc4=_0x127803[_0xabd4('0xfa')](_0x28e10a);if(_0x5cefc4[_0xabd4('0xfb')]){rpcDb['checkIsBlackList'](_[_0xabd4('0x44')](_0x28e10a[0x0],[_0xabd4('0x47'),_0xabd4('0xe3')]))[_0xabd4('0x55')](function(_0x168666){_0x127803[_0xabd4('0xe2')](_0x168666,_0x28e10a[0x0],_0x5d28d1,_0x1a0d4f,_0x2c4dad)[_0xabd4('0x55')](function(_0x3620ab){return _0x3620ab;})['catch'](function(_0x422df3){throw _0x422df3;});})[_0xabd4('0x5b')](function(_0x59f042){ut[_0xabd4('0x2c')]('[Preview][checkIsBlackList]',_0x59f042);throw ut['message'](_0xabd4('0xfc'),_0x1a0d4f,_0x2c4dad);});}else{throw ut[_0xabd4('0x2a')](_0x5cefc4[_0xabd4('0x2a')],_0x1a0d4f,_0x2c4dad);}})[_0xabd4('0x5b')](function(_0x9c88fb){ut[_0xabd4('0x2c')](_0xabd4('0xfd'),_0x9c88fb);throw ut[_0xabd4('0x2a')](_0xabd4('0xfc'),![],!![]);});};Preview[_0xabd4('0xb')][_0xabd4('0xfa')]=function(_0x4712cb){if(_[_0xabd4('0x3d')](_0x4712cb)||_[_0xabd4('0xfe')](_0x4712cb)||!_[_0xabd4('0x3d')](_0x4712cb[0x0][_0xabd4('0x57')])&&_['isNil'](_0x4712cb[0x0][_0xabd4('0x57')]['name'])){ut[_0xabd4('0x2c')]('[Preview][validateContact][Empty\x20Contact]',_0x4712cb);return{'isValid':![],'message':_0xabd4('0xff')};}var _0x349741=this[_0xabd4('0x1d')][_0x4712cb[0x0][_0xabd4('0x3f')]['name']];_0x349741[_0xabd4('0x2a')]=utils[_0xabd4('0x2f')]['ACTIVE'];if(_['isNil'](_0x349741)){ut[_0xabd4('0x2c')]('[Preview][validateContact][Empty\x20Campaign]',_0x349741);return{'isValid':![],'message':_0xabd4('0x100')};}if(!this[_0xabd4('0x69')](_0x349741[_0xabd4('0x6a')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xabd4('0x101')+_0x349741[_0xabd4('0x23')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xabd4('0x69')](_0x349741[_0xabd4('0x6b')])){ut[_0xabd4('0x2c')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x349741[_0xabd4('0x23')]+_0xabd4('0x102'));return{'isValid':![],'message':_0xabd4('0x103')};}}if(!ut[_0xabd4('0x104')](_0x349741[_0xabd4('0x38')])){ut[_0xabd4('0x2c')](_0xabd4('0x105'),_0x349741['name']+_0xabd4('0x106'));return{'isValid':![],'message':_0xabd4('0x101')+_0x349741[_0xabd4('0x23')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xabd4('0x107')};};Preview[_0xabd4('0xb')][_0xabd4('0xe6')]=function(_0x43b8ae,_0x335235,_0xa6cac,_0xaf399e){var _0x49106d=this;return new Promise(function(_0x1c41f4,_0x2eb642){var _0x4e0555=_0x43b8ae[_0xabd4('0x8b')];var _0x19dd24=_0x49106d[_0xabd4('0x69')](_0x335235[_0xabd4('0x6a')])?util[_0xabd4('0x21')]('SIP/%s/%s%s',_0x335235[_0xabd4('0x6a')][_0xabd4('0x23')],_[_0xabd4('0x3d')](_0x335235[_0xabd4('0x108')])?'':_0x335235['dialPrefix'][_0xabd4('0x109')]()||'',_0x335235[_0xabd4('0x10a')]>0x0?_0xa6cac['phone'][_0xabd4('0x10b')](_0x335235['dialCutDigit']):_0xa6cac[_0xabd4('0xe3')]):util['format']('SIP/%s/%s%s',_[_0xabd4('0x3d')](_0x335235[_0xabd4('0x6b')])?_0x335235[_0xabd4('0x6a')][_0xabd4('0x23')]:_0x335235[_0xabd4('0x6b')]['name'],_[_0xabd4('0x3d')](_0x335235['dialPrefix'])?'':_0x335235[_0xabd4('0x108')][_0xabd4('0x109')]()||'',_0x335235[_0xabd4('0x10a')]>0x0?_0xa6cac[_0xabd4('0xe3')][_0xabd4('0x10b')](_0x335235[_0xabd4('0x10a')]):_0xa6cac[_0xabd4('0xe3')]);var _0x176907=_0x49106d[_0xabd4('0x69')](_0x335235['Trunk'])?ut['getCallerId'](_0x335235[_0xabd4('0x6a')][_0xabd4('0x10c')],_0x335235[_0xabd4('0x10d')],_0x335235[_0xabd4('0x10e')]>0x0?ut[_0xabd4('0x10f')](_0x335235[_0xabd4('0x110')],_0x335235[_0xabd4('0x10e')]):_0x335235[_0xabd4('0x110')]):ut[_0xabd4('0x111')](_['isNil'](_0x335235[_0xabd4('0x6b')])?_0x335235[_0xabd4('0x6a')][_0xabd4('0x10c')]:_0x335235[_0xabd4('0x6b')][_0xabd4('0x10c')],_0x335235[_0xabd4('0x10d')],_0x335235[_0xabd4('0x10e')]>0x0?ut[_0xabd4('0x10f')](_0x335235[_0xabd4('0x110')],_0x335235[_0xabd4('0x10e')]):_0x335235[_0xabd4('0x110')]);if(_0x176907){_0x43b8ae[_0xabd4('0x112')]=ut[_0xabd4('0x113')](_0x176907);_0x43b8ae[_0xabd4('0x114')]=ut[_0xabd4('0x115')](_0x176907);}var _0x4a36c3=ut[_0xabd4('0x116')](_0x335235,_0xa6cac,_0x19dd24,_0x176907,_0x4e0555,_0x43b8ae);var _0x2eb8c1=utils[_0xabd4('0x117')](_0xa6cac['Contact']);Object[_0xabd4('0x118')](_0x4a36c3,_0x2eb8c1);_[_0xabd4('0x119')](_0x43b8ae,ut[_0xabd4('0x11a')](_0x4a36c3));_0x43b8ae[_0xabd4('0x5d')]=moment()[_0xabd4('0x21')]('YYYY-MM-DD\x20HH:mm:ss');_0x335235['variables']=_0x4a36c3;var _0x18fd62=ut[_0xabd4('0x11b')](_0x43b8ae,_0x335235,_0x4a36c3,_0x43b8ae['activeContact'],_0xaf399e);return ami[_0xabd4('0x49')](_0x18fd62)['then'](function(_0x3ab682){_0x335235[_0xabd4('0x27')]+=0x1;logger[_0xabd4('0x1f')](_0xabd4('0x11c'),_0x4e0555,_0xabd4('0x8c'),_0x335235[_0xabd4('0x23')],'originated:\x20',_0x335235[_0xabd4('0x27')]);_0x1c41f4(_0x3ab682);})['catch'](function(_0x344b64){ut['logAgent'](_0x43b8ae,0xe,_0xabd4('0x11d'));rpcDb[_0xabd4('0xd9')](_0x43b8ae,'[originateFailure][logOriginateFailure]');_0x2eb642(_0x344b64);});});};Preview[_0xabd4('0xb')]['syncNewExten']=function(_0x108716){if(this[_0xabd4('0x10')][_0x108716['linkedid']]){this[_0xabd4('0x10')][_0x108716[_0xabd4('0xcb')]]['channel']=_0x108716['channel'];}};Preview['prototype'][_0xabd4('0x14')]=function(_0x2996c0){var _0x463287=this;var _0x2aaba9=this['actions'][_0x2996c0['actionid']];if(_0x2aaba9){if(_0x2aaba9['lookAgent']&&this['agents'][_0x2aaba9['lookAgent']]){ut['logLookAgent'](_0x2aaba9,this[_0xabd4('0x11')][_0x2aaba9[_0xabd4('0xe5')]][_0xabd4('0x23')],this[_0xabd4('0x11')][_0x2aaba9['lookAgent']]['id']);}var _0x227544=_['clone'](_0x2aaba9);_0x227544[_0xabd4('0x88')]=moment()[_0xabd4('0x21')](_0xabd4('0x87'));var _0x5b0c77=_0x463287[_0xabd4('0x1d')][_0x2aaba9[_0xabd4('0x40')]];if(ut[_0xabd4('0x11e')](_0x2996c0['response'])){if(_0x2aaba9[_0xabd4('0x80')]){rpcDb['unlockContact'](_0x2aaba9[_0xabd4('0x83')]);}if(_0x2aaba9['activeContact']){rpcDb['disableContact'](_0x2aaba9[_0xabd4('0x83')]);}ami[_0xabd4('0x1e')](_0xabd4('0x11f'),ut['buildObj'](_0x2aaba9,_0xabd4('0x120'),this[_0xabd4('0x1d')][_0x2aaba9['queue']]));this[_0xabd4('0xd4')](_0x227544,_0x5b0c77,_0x2996c0);}else{_0x2aaba9[_0xabd4('0x5d')]=moment()[_0xabd4('0x21')](_0xabd4('0x87'));ut[_0xabd4('0xd8')](_0x227544,0x4,_0xabd4('0x121'));rpcDb[_0xabd4('0xd9')](_0x227544,_0xabd4('0x122'));}}};Preview[_0xabd4('0xb')][_0xabd4('0x123')]=function(_0x5da92c){var _0x1c8f6f=this[_0xabd4('0x10')][_0x5da92c[_0xabd4('0xcb')]];var _0xa729e3;if(_0x1c8f6f){_0xa729e3=this[_0xabd4('0x1d')][_0x1c8f6f[_0xabd4('0x40')]];logger['info'](_0xabd4('0x124'),_0x5da92c[_0xabd4('0xcb')],_0xabd4('0x8c'),_0xa729e3[_0xabd4('0x23')],_0xabd4('0x43'),_0xa729e3[_0xabd4('0x28')]);}if(this['actions'][_0x5da92c['linkedid']]&&_0x5da92c[_0xabd4('0xcb')]!==_0x5da92c[_0xabd4('0x8b')]){if(_0x5da92c[_0xabd4('0x125')]==='16'&&this[_0xabd4('0x10')][_0x5da92c[_0xabd4('0xcb')]][_0xabd4('0xce')]){this[_0xabd4('0x6e')](_0x5da92c,_0x5da92c[_0xabd4('0xcb')],_0x5da92c[_0xabd4('0x125')]);}else if(this[_0xabd4('0x10')][_0x5da92c[_0xabd4('0xcb')]]['dialAnswer']){logger['info'](_0xabd4('0x126'),_0x5da92c['linkedid'],_0x5da92c[_0xabd4('0x125')],_0xabd4('0x8c'),_0xa729e3['name'],_0xabd4('0x43'),_0xa729e3['pTalking']);this[_0xabd4('0x6e')](_0x5da92c,_0x5da92c[_0xabd4('0xcb')],_0x5da92c[_0xabd4('0x125')]);}}else if(_0x1c8f6f&&_['isNil'](_0x1c8f6f[_0xabd4('0x127')])&&_0xa729e3['dialQueueProject']&&_0x5da92c['linkedid']===_0x5da92c[_0xabd4('0x8b')]&&_[_0xabd4('0x3d')](_0x5da92c[_0xabd4('0xd7')])&&_0x5da92c['cause']==='16'&&_0x5da92c[_0xabd4('0x128')]==='6'&&_[_0xabd4('0xd5')](_0x1c8f6f[_0xabd4('0x129')])){if(_0x1c8f6f['unlockAgent']){rpcDb[_0xabd4('0xf7')](_0x1c8f6f[_0xabd4('0x83')]);}if(_0x1c8f6f['activeContact']){rpcDb[_0xabd4('0x5c')](_0x1c8f6f[_0xabd4('0x83')]);}_0x5da92c[_0xabd4('0xd7')]='22';this['callProgressDetectingAgent'](_0x1c8f6f,_0xa729e3,_0x5da92c);}else if(_0x1c8f6f&&_0x1c8f6f[_0xabd4('0x129')]){if(_0x5da92c['cause']==='16'&&this[_0xabd4('0x10')][_0x5da92c[_0xabd4('0xcb')]][_0xabd4('0xce')]){logger[_0xabd4('0x1f')](_0xabd4('0x12a'),_0x5da92c[_0xabd4('0xcb')],_0x5da92c['cause'],'\x20Queue',_0xa729e3[_0xabd4('0x23')],_0xabd4('0x43'),_0xa729e3[_0xabd4('0x28')]);this['callProgressDetectingCustomer'](_0x5da92c,_0x5da92c[_0xabd4('0xcb')],_0x5da92c[_0xabd4('0x125')]);}else if(this[_0xabd4('0x10')][_0x5da92c[_0xabd4('0xcb')]]['dialAnswer']){logger[_0xabd4('0x1f')](_0xabd4('0x126'),_0x5da92c[_0xabd4('0xcb')],_0x5da92c['cause'],_0xabd4('0x8c'),_0xa729e3['name'],_0xabd4('0x43'),_0xa729e3[_0xabd4('0x28')]);this['callProgressDetectingCustomer'](_0x5da92c,_0x5da92c['linkedid'],_0x5da92c['cause']);}}};Preview[_0xabd4('0xb')]['syncDialEnd']=function(_0x27f8ca){if(this[_0xabd4('0x10')][_0x27f8ca[_0xabd4('0xd2')]]&&_0x27f8ca[_0xabd4('0xd2')]!==_0x27f8ca['destuniqueid']){this[_0xabd4('0x6e')](_0x27f8ca,_0x27f8ca[_0xabd4('0xd2')],_0x27f8ca['dialstatus']);}};Preview[_0xabd4('0xb')][_0xabd4('0x12b')]=function(_0x512616){if(this[_0xabd4('0x10')][_0x512616[_0xabd4('0xcb')]]&&_0x512616[_0xabd4('0xcb')]!==_0x512616[_0xabd4('0x8b')]&&!this[_0xabd4('0x10')][_0x512616[_0xabd4('0xcb')]][_0xabd4('0xce')]){if(_0x512616[_0xabd4('0x125')]==='1'){this[_0xabd4('0x6e')](_0x512616,_0x512616[_0xabd4('0xcb')],_0x512616[_0xabd4('0x125')]);}}};Preview[_0xabd4('0xb')][_0xabd4('0x12c')]=function(_0x53db7c,_0x4e808f,_0x4d165d){if(this[_0xabd4('0x10')][_0x53db7c]){if(_[_0xabd4('0x3d')](this[_0xabd4('0x10')][_0x53db7c][_0xabd4('0x12d')])){this[_0xabd4('0x10')][_0x53db7c][_0xabd4('0x12d')]={};}this[_0xabd4('0x10')][_0x53db7c]['variables'][_0x4e808f]=_0x4d165d;}};Preview[_0xabd4('0xb')][_0xabd4('0x18')]=function(_0x57e03e){try{if(!_[_0xabd4('0x3d')](_0x57e03e)){if(ut['filterKey'](_[_0xabd4('0x12e')](_0x57e03e['variable'])[0x0])){this[_0xabd4('0x12c')](_0x57e03e[_0xabd4('0x8b')],_['keys'](_0x57e03e[_0xabd4('0x12f')])[0x0],_0x57e03e['value']);}}}catch(_0x1fdc4e){logger[_0xabd4('0x130')]('[syncVarSet][Preview]',util[_0xabd4('0x131')](_0x1fdc4e,{'showHidden':![],'depth':null}));}};Preview[_0xabd4('0xb')]['syncAttendedTransfer']=function(_0x5f00e5){if(_0x5f00e5){if(this['actions'][_0x5f00e5[_0xabd4('0x132')]]){this['actions'][_0x5f00e5[_0xabd4('0x132')]][_0xabd4('0x129')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x32a83d){if(_0x32a83d){if(this['actions'][_0x32a83d[_0xabd4('0x133')]]){this[_0xabd4('0x10')][_0x32a83d[_0xabd4('0x133')]][_0xabd4('0x129')]=!![];}}};module[_0xabd4('0x134')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 05338ec..5aa7c09 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 _0xd66d=['createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/agentReportPreview','error','inspect','catch','[createHistory]\x20','resolve','then'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd66d,0x1a7));var _0xdd66=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd66d[_0x57b54c];return _0x59cc19;};'use strict';var util=require('util');var BPromise=require(_0xdd66('0x0'));var logger=require(_0xdd66('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xdd66('0x2'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xbb8d9d){return function(_0x361c2b){logger[_0xdd66('0x3')](_0xbb8d9d,util[_0xdd66('0x4')](_0x361c2b,{'showHidden':![],'depth':null}));};}function create(_0x11ad2f){return cmHopperHistory['createHistory'](_0x11ad2f)[_0xdd66('0x5')](loggerCatch(_0xdd66('0x6')));}function createAgent(_0x36c188){return BPromise[_0xdd66('0x7')]()[_0xdd66('0x8')](agentReportPreview[_0xdd66('0x9')](_0x36c188))[_0xdd66('0x5')](loggerCatch(_0xdd66('0x6')));}function moveContact(_0x295c62){return cmHopper['moveContactManagedDialer'](_0x295c62,!![])[_0xdd66('0x5')](loggerCatch(_0xdd66('0xa')));}exports['checkIsBlackList']=function(_0x64eb1c){return cmHopperBlack[_0xdd66('0xb')](_0x64eb1c)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xdd66('0xc')]=function(_0x4941dd){return BPromise['resolve']()['then'](cmHopper['getContactPreview'](_0x4941dd))['catch'](loggerCatch(_0xdd66('0xd')));};exports[_0xdd66('0x9')]=function(_0x52e092,_0x1478a9){create(_0x52e092)[_0xdd66('0x5')](loggerCatch(_0x1478a9));moveContact(_0x52e092)[_0xdd66('0x5')](loggerCatch(_0x1478a9));};exports[_0xdd66('0xe')]=function(_0x461050,_0x4ac9cb){createAgent(_0x461050)[_0xdd66('0x5')](loggerCatch(_0x4ac9cb));};exports[_0xdd66('0xf')]=function(_0x49fa1e,_0x2251ae){create(_0x49fa1e)[_0xdd66('0x5')](loggerCatch(_0x2251ae));};exports[_0xdd66('0x10')]=function(_0x527bb8,_0x593d8d){moveContact(_0x527bb8)['catch'](loggerCatch(_0x593d8d));};exports['rescheduleContact']=function(_0x1ab939,_0x1f913a,_0x5c47b2){if(_0x1f913a){_0x1ab939['UserId']=null;}if(_0x5c47b2){_0x1ab939['active']=![];}return cmHopper[_0xdd66('0x11')](_0x1ab939)[_0xdd66('0x5')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xdd66('0x12')]=function(_0x23a3ac){return cmHopper[_0xdd66('0x12')](_0x23a3ac)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xdd66('0x13')]=function(_0xd973a0){return cmHopper['unlockContact']({'UserId':null},_0xd973a0,0x1)[_0xdd66('0x5')](loggerCatch(_0xdd66('0x14')));};exports['disableContact']=function(_0x2aa184){return cmHopper[_0xdd66('0x13')]({'active':![]},_0x2aa184,0x1)[_0xdd66('0x5')](loggerCatch(_0xdd66('0x15')));};exports[_0xdd66('0x16')]=function(_0x638b18){var _0xc0868e={};_0xc0868e[_0xdd66('0x17')]=_0x638b18[_0xdd66('0x17')];_0xc0868e[_0xdd66('0x18')]=_0x638b18[_0xdd66('0x18')];_0xc0868e[_0xdd66('0x19')]=_0x638b18['calleridnum'];_0xc0868e[_0xdd66('0x1a')]=_0x638b18[_0xdd66('0x1a')];_0xc0868e[_0xdd66('0x1b')]=_0x638b18['queue'];_0xc0868e['queuecallerjoinAt']=_0x638b18[_0xdd66('0x1c')];_0xc0868e[_0xdd66('0x1d')]=_0x638b18['answertime'];_0xc0868e['queuecallercomplete']=0x1;_0xc0868e[_0xdd66('0x1e')]=_0x638b18[_0xdd66('0x1f')];_0xc0868e[_0xdd66('0x20')]=_0x638b18[_0xdd66('0x21')];_0xc0868e[_0xdd66('0x22')]='from-sip';_0xc0868e[_0xdd66('0x23')]=_0xdd66('0x24');_0xc0868e[_0xdd66('0x25')]=0x0;_0xc0868e[_0xdd66('0x26')]=0x1;_0xc0868e[_0xdd66('0x27')]=_0x638b18['membername'];_0xc0868e[_0xdd66('0x28')]=_0xdd66('0x29');return BPromise[_0xdd66('0x7')]()[_0xdd66('0x8')](voiceQueueReport[_0xdd66('0x2a')](_0xc0868e))['catch'](loggerCatch(_0xdd66('0x2b')));};exports[_0xdd66('0x2c')]=function(_0x208c6b,_0x47e350){return BPromise[_0xdd66('0x7')]()[_0xdd66('0x8')](cmHopper[_0xdd66('0x2c')](_0x208c6b,_0x47e350))[_0xdd66('0x5')](loggerCatch(_0xdd66('0x2d')));};exports[_0xdd66('0x2e')]=function(_0x1effe4){return cmHopper[_0xdd66('0x11')](_0x1effe4,!![],!![])[_0xdd66('0x5')](loggerCatch(_0xdd66('0x2f')));}; \ No newline at end of file +var _0xf08c=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xf08c,0xce));var _0xcf08=function(_0x20d7db,_0x5b81eb){_0x20d7db=_0x20d7db-0x0;var _0x5f5b17=_0xf08c[_0x20d7db];return _0x5f5b17;};'use strict';var util=require(_0xcf08('0x0'));var BPromise=require(_0xcf08('0x1'));var logger=require('../../../config/logger')(_0xcf08('0x2'));var cmHopper=require(_0xcf08('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xcf08('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xcf08('0x5'));function loggerCatch(_0x57ce92){return function(_0x575e54){logger['error'](_0x57ce92,util['inspect'](_0x575e54,{'showHidden':![],'depth':null}));};}function create(_0x5e116b){return cmHopperHistory[_0xcf08('0x6')](_0x5e116b)[_0xcf08('0x7')](loggerCatch(_0xcf08('0x8')));}function createAgent(_0x2cf6bf){return BPromise[_0xcf08('0x9')]()[_0xcf08('0xa')](agentReportPreview[_0xcf08('0x6')](_0x2cf6bf))[_0xcf08('0x7')](loggerCatch(_0xcf08('0x8')));}function moveContact(_0x33a2e1){return cmHopper[_0xcf08('0xb')](_0x33a2e1,!![])[_0xcf08('0x7')](loggerCatch(_0xcf08('0xc')));}exports[_0xcf08('0xd')]=function(_0x242439){return cmHopperBlack[_0xcf08('0xd')](_0x242439)[_0xcf08('0x7')](loggerCatch(_0xcf08('0xe')));};exports['getContactPreview']=function(_0x368537){return BPromise[_0xcf08('0x9')]()['then'](cmHopper['getContactPreview'](_0x368537))[_0xcf08('0x7')](loggerCatch(_0xcf08('0xf')));};exports['createHistory']=function(_0x5d0df4,_0x2f6e1a){create(_0x5d0df4)[_0xcf08('0x7')](loggerCatch(_0x2f6e1a));moveContact(_0x5d0df4)[_0xcf08('0x7')](loggerCatch(_0x2f6e1a));};exports[_0xcf08('0x10')]=function(_0xeb5eff,_0x4cce41){createAgent(_0xeb5eff)[_0xcf08('0x7')](loggerCatch(_0x4cce41));};exports['createCustomerHistory']=function(_0x364065,_0x21b803){create(_0x364065)[_0xcf08('0x7')](loggerCatch(_0x21b803));};exports['createCustomerFinal']=function(_0x486b35,_0x3c729c){moveContact(_0x486b35)['catch'](loggerCatch(_0x3c729c));};exports[_0xcf08('0x11')]=function(_0x58816b,_0x11e4c4,_0x59ff2a){if(_0x11e4c4){_0x58816b['UserId']=null;}if(_0x59ff2a){_0x58816b[_0xcf08('0x12')]=![];}return cmHopper[_0xcf08('0x11')](_0x58816b)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x2f3ace){return cmHopper[_0xcf08('0x13')](_0x2f3ace)[_0xcf08('0x7')](loggerCatch(_0xcf08('0x14')));};exports[_0xcf08('0x15')]=function(_0x3fc6ba){return cmHopper[_0xcf08('0x15')]({'UserId':null},_0x3fc6ba,0x1)[_0xcf08('0x7')](loggerCatch(_0xcf08('0x16')));};exports[_0xcf08('0x17')]=function(_0x5db2ee){return cmHopper[_0xcf08('0x15')]({'active':![]},_0x5db2ee,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xcf08('0x18')]=function(_0x495c01){var _0x527cf9={};_0x527cf9[_0xcf08('0x19')]=_0x495c01[_0xcf08('0x19')];_0x527cf9[_0xcf08('0x1a')]=_0x495c01[_0xcf08('0x1a')];_0x527cf9['calleridnum']=_0x495c01['calleridnum'];_0x527cf9[_0xcf08('0x1b')]=_0x495c01[_0xcf08('0x1b')];_0x527cf9[_0xcf08('0x1c')]=_0x495c01[_0xcf08('0x1c')];_0x527cf9[_0xcf08('0x1d')]=_0x495c01[_0xcf08('0x1e')];_0x527cf9['queuecallerleaveAt']=_0x495c01[_0xcf08('0x1e')];_0x527cf9[_0xcf08('0x1f')]=0x1;_0x527cf9[_0xcf08('0x20')]=_0x495c01[_0xcf08('0x21')];_0x527cf9[_0xcf08('0x22')]=_0x495c01[_0xcf08('0x23')];_0x527cf9[_0xcf08('0x24')]=_0xcf08('0x25');_0x527cf9['exten']='xcally-motion-preview';_0x527cf9['holdtime']=0x0;_0x527cf9['assigned']=0x1;_0x527cf9[_0xcf08('0x26')]=_0x495c01[_0xcf08('0x23')];_0x527cf9['queuecallerexitreason']=_0xcf08('0x27');return BPromise['resolve']()[_0xcf08('0xa')](voiceQueueReport[_0xcf08('0x28')](_0x527cf9))[_0xcf08('0x7')](loggerCatch(_0xcf08('0x29')));};exports[_0xcf08('0x2a')]=function(_0x4f8541,_0x1c80ae){return BPromise[_0xcf08('0x9')]()[_0xcf08('0xa')](cmHopper['getContactRecallMe'](_0x4f8541,_0x1c80ae))[_0xcf08('0x7')](loggerCatch(_0xcf08('0x2b')));};exports[_0xcf08('0x2c')]=function(_0x3084b7){return cmHopper[_0xcf08('0x11')](_0x3084b7,!![],!![])[_0xcf08('0x7')](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 bed24cb..7aeb725 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 _0x7629=['countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','isNil','not_inuse','status','reachable','push','milliseconds','seconds','createBody','idContact','type','campaigntype','dialAnswer','countnoanswerretry','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','noanswer','keys','forEach','variables','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','YYYY-MM-DD\x20HH:mm:ss','logAgent','state','statedesc','responsetime','ringtime','getSeconds','membername','UserId','logCustomer','endtime','starttime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry'];(function(_0x2b28bb,_0x2b1ca7){var _0x1b4b59=function(_0x51b5de){while(--_0x51b5de){_0x2b28bb['push'](_0x2b28bb['shift']());}};_0x1b4b59(++_0x2b1ca7);}(_0x7629,0xda));var _0x9762=function(_0x220eca,_0x229fd5){_0x220eca=_0x220eca-0x0;var _0x1aafc6=_0x7629[_0x220eca];return _0x1aafc6;};'use strict';var util=require(_0x9762('0x0'));var _=require(_0x9762('0x1'));var moment=require(_0x9762('0x2'));var logger=require(_0x9762('0x3'))(_0x9762('0x4'));var ipAgi=process[_0x9762('0x5')][_0x9762('0x6')]||_0x9762('0x7');var utils=require(_0x9762('0x8'));exports[_0x9762('0x9')]=function(_0x176bbd){return function(_0x3f1e50){logger[_0x9762('0xa')](_0x176bbd,util['inspect'](_0x3f1e50,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x19da03,_0x5ae7e4){logger[_0x9762('0xb')](_0x19da03,util[_0x9762('0xc')](_0x5ae7e4,{'showHidden':![],'depth':null}));};exports[_0x9762('0xd')]=function(_0x493912,_0x49894b){logger[_0x9762('0xa')](_0x493912,util['inspect'](_0x49894b,{'showHidden':![],'depth':null}));};exports[_0x9762('0xe')]=function(_0x184eec){return function(_0x50362b){logger['info'](_0x184eec,util[_0x9762('0xc')](_0x50362b,{'showHidden':![],'depth':null}));};};exports[_0x9762('0xf')]=function(_0x6ee88f,_0x532b51,_0x2da0b0){return{'message':_0x6ee88f,'unlock':_0x532b51,'active':_0x2da0b0};};exports[_0x9762('0x10')]=function(_0x214d61,_0x5b8da4,_0x48d894){if(!_[_0x9762('0x11')](_0x48d894)&&_0x9762('0x12')===typeof _0x48d894&&!_[_0x9762('0x13')](_0x48d894)){if(!_[_0x9762('0x11')](_0x5b8da4)&&_0x9762('0x12')===typeof _0x5b8da4&&!_[_0x9762('0x13')](_0x5b8da4)){return util[_0x9762('0x14')](_0x9762('0x15'),_0x5b8da4,_0x48d894);}return util[_0x9762('0x14')]('\x22%s\x22\x20<%s>',_0x48d894,_0x48d894);}if(!_[_0x9762('0x11')](_0x214d61)&&_0x9762('0x12')===typeof _0x214d61&&!_[_0x9762('0x13')](_0x214d61)){return _0x214d61;}return'\x22\x22\x20<>';};exports[_0x9762('0x16')]=function(_0x290ebd){if(_['isNil'](_0x290ebd)){return![];}return _0x290ebd;};exports['addVariables']=function(_0x462dcf,_0xd5e397,_0x5af18a,_0x515d2a,_0xed28fe,_0x2cc32d){var _0x147af9={'XMD-QUEUE':_0xd5e397['Queue']?_0xd5e397[_0x9762('0x17')][_0x9762('0x18')]:'','XMD-CALLERID':_0x515d2a,'XMD-CALLERID-PREVIEW':_0x2cc32d?util[_0x9762('0x14')]('\x22%s\x22\x20<%s>',_0x2cc32d[_0x9762('0x19')],_0x2cc32d[_0x9762('0x1a')]):_0x515d2a,'XMD-DIALID':_0xed28fe,'XMD-CONTACTID':_0xd5e397['ContactId'],'XMD-CDRTYPE':_0x9762('0x1b'),'CALLERID(all)':_0x515d2a,'XMD-VOICEQUEUEID':_0xd5e397[_0x9762('0x1c')],'XMD-DIALCHANNEL':_0x5af18a,'XMD-DIALTIMEOUT':_0x462dcf[_0x9762('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x9762('0x14')](_0x9762('0x1e'),_0x462dcf[_0x9762('0x1f')]?'g':'',_['isEmpty'](_0x462dcf[_0x9762('0x20')])?'':_0x9762('0x21')),'XMD-DIALURL':_0x462dcf[_0x9762('0x22')]||'','XMD-AGI':_0x462dcf['dialQueueProject']?util[_0x9762('0x14')](_0x9762('0x23'),ipAgi,_0x462dcf[_0x9762('0x24')]):_0x9762('0x25'),'XMD-AGIAFTER':_0x462dcf[_0x9762('0x1f')]?util[_0x9762('0x14')](_0x9762('0x23'),ipAgi,_0x462dcf[_0x9762('0x1f')]):_0x9762('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2cc32d?_0x2cc32d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2cc32d?_0x2cc32d['originatecalleridname']:'','XMD-DESTINATION':_0x9762('0x26'),'SIPADDHEADER':_0x9762('0x27')};if(!_[_0x9762('0x13')](_0x462dcf[_0x9762('0x20')])){_0x147af9[util['format']('%s',_0x9762('0x28'))]=_0x462dcf[_0x9762('0x20')];_0x147af9[util[_0x9762('0x14')]('%s',_0x9762('0x29'))]=_0xed28fe;}return _0x147af9;};exports[_0x9762('0x2a')]=function(_0x2efbd9){var _0x237c9e={};for(var _0x32b6ba in _0x2efbd9){if(_0x2efbd9['hasOwnProperty'](_0x32b6ba)){_0x237c9e[util[_0x9762('0x14')]('%s',_[_0x9762('0x2b')](_0x32b6ba))]=_0x2efbd9[_0x32b6ba];}}return{'variables':_0x237c9e};};exports['logBlacklist']=function(_0x40f116){var _0x39a0df=moment()[_0x9762('0x14')](_0x9762('0x2c'));_0x40f116['state']=0xd;_0x40f116['statedesc']='Blacklist';_0x40f116['starttime']=_0x39a0df;_0x40f116['responsetime']=_0x39a0df;_0x40f116['endtime']=_0x39a0df;};exports[_0x9762('0x2d')]=function(_0x55d3a8,_0x5562da,_0x5a46ea){var _0x8fb500=moment()[_0x9762('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x55d3a8[_0x9762('0x2e')]=_0x5562da;_0x55d3a8[_0x9762('0x2f')]=_0x5a46ea;_0x55d3a8[_0x9762('0x30')]=_0x8fb500;_0x55d3a8[_0x9762('0x31')]=utils[_0x9762('0x32')](_0x55d3a8['responsetime'],_0x55d3a8['starttime']);};exports['logLookAgent']=function(_0x4a035d,_0x155c32,_0x29dc1a){_0x4a035d[_0x9762('0x33')]=_0x155c32;_0x4a035d[_0x9762('0x34')]=_0x29dc1a;};exports[_0x9762('0x35')]=function(_0x2583e3,_0x5e7677,_0x250ee1){var _0x2bc617=moment()['format'](_0x9762('0x2c'));_0x2583e3['state']=_0x5e7677;_0x2583e3[_0x9762('0x2f')]=_0x250ee1;_0x2583e3[_0x9762('0x30')]=_0x2583e3[_0x9762('0x30')]?_0x2583e3[_0x9762('0x30')]:_0x2bc617;_0x2583e3[_0x9762('0x36')]=_0x2583e3[_0x9762('0x36')]?_0x2583e3[_0x9762('0x36')]:_0x2bc617;_0x2583e3[_0x9762('0x31')]=utils['getSeconds'](_0x2583e3['responsetime']||0x0,_0x2583e3[_0x9762('0x37')]||0x0);_0x2583e3[_0x9762('0x38')]=_0x2583e3[_0x9762('0x39')]?utils[_0x9762('0x32')](_0x2583e3['endtime'],_0x2583e3[_0x9762('0x39')]):0x0;};exports[_0x9762('0x3a')]=function(_0x15ca7e){return _0x15ca7e===_0x9762('0x3b');};exports[_0x9762('0x3c')]=function(_0x37582e,_0x1a685d,_0x1a2e81,_0x3270ab,_0x3dae17){var _0x302932=_0x3270ab?_0x9762('0x3d'):_0x37582e[_0x9762('0x19')];_0x302932=_0x3dae17?_0x9762('0x3e'):_0x302932;return{'actionid':_0x37582e['uniqueid'],'action':_0x9762('0x3f'),'channel':_0x37582e[_0x9762('0x40')],'callerid':util[_0x9762('0x14')](_0x9762('0x15'),_0x302932,_0x37582e['calleridnum']),'Exten':_0x9762('0x26'),'Context':_0x9762('0x41'),'Priority':'1','variable':_0x1a2e81,'timeout':(_0x1a685d[_0x9762('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x37582e[_0x9762('0x43')]};};exports[_0x9762('0x44')]=function(_0x454db5){return _0x454db5[_0x9762('0x45')]+_0x454db5[_0x9762('0x46')]+_0x454db5['countnoanswerretry']+_0x454db5[_0x9762('0x47')]+_0x454db5[_0x9762('0x48')];};exports['cloneAction']=function(_0x2de159){var _0x7097ab=_[_0x9762('0x49')](_0x2de159);_0x7097ab[_0x9762('0x2e')]=0xf;_0x7097ab[_0x9762('0x2f')]=_0x9762('0x4a');return _0x7097ab;};exports[_0x9762('0x4b')]=function(_0xb1d25e,_0x557655,_0x4bc0c1){var _0x1c0cc3={};_0x1c0cc3[_0x557655]=_0xb1d25e[_0x557655];_0x1c0cc3[_0x9762('0x4c')]=![];_0x1c0cc3[_0x9762('0x4d')]=moment()[_0x9762('0x4e')](_0x4bc0c1,_0x9762('0x4f'))[_0x9762('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c0cc3[_0x9762('0x50')]=_0xb1d25e[_0x9762('0x50')];_0x1c0cc3[_0x9762('0x51')]=_0xb1d25e[_0x9762('0x51')];_0x1c0cc3[_0x9762('0x1c')]=_0xb1d25e[_0x9762('0x1c')]||undefined;return _0x1c0cc3;};exports[_0x9762('0x52')]=function(_0x4d8b19,_0xa10b19){if(!_['isNil'](_0x4d8b19)){if(_0x4d8b19['pTalking']>0x0){_0x4d8b19[_0x9762('0x53')]-=0x1;}else{logger[_0x9762('0xb')](_0xa10b19,_0x9762('0x54'));}}else{logger[_0x9762('0xa')](_0xa10b19,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x9762('0x55')]=function(_0x1b971f){if(_0x1b971f<=0x0){return!![];}return![];};function buildObj(_0x5599d8,_0x44cb36,_0x4e65c9){_0x5599d8[_0x9762('0x56')]=_0x44cb36;_0x5599d8[_0x9762('0x18')]=_0x5599d8[_0x9762('0x57')];_0x5599d8[_0x9762('0x58')]=_0x5599d8[_0x9762('0x40')];_0x5599d8[_0x9762('0x59')]=_0x9762('0x5a');if(_0x4e65c9){_0x5599d8[_0x9762('0x5b')]=_0x4e65c9[_0x9762('0x5b')];}return _0x5599d8;}exports[_0x9762('0x5c')]=buildObj;exports[_0x9762('0x5d')]=function(_0x539a84){var _0x58137c=[];for(var _0xd86d6f in _0x539a84){if(_0x539a84[_0x9762('0x5e')](_0xd86d6f)){if(!_[_0x9762('0x5f')](_0x539a84[_0xd86d6f])&&_0x539a84[_0xd86d6f][_0x9762('0x2e')]===_0x9762('0x60')&&_0x539a84[_0xd86d6f][_0x9762('0x61')]===_0x9762('0x62')){_0x58137c[_0x9762('0x63')](_0x539a84[_0xd86d6f]['id']);}}}return _0x58137c;};exports['getDiff']=function(_0x3fea97){var _0x3d6ddc=moment()[_0x9762('0x64')](0x0);var _0x5ca6af=moment(_0x3fea97)[_0x9762('0x64')](0x0);return _0x3d6ddc['diff'](_0x5ca6af,_0x9762('0x65'));};exports[_0x9762('0x66')]=function(_0x1e00aa){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e00aa['ContactId'],'ListId':_0x1e00aa[_0x9762('0x51')],'VoiceQueueId':_0x1e00aa[_0x9762('0x1c')]||undefined,'CampaignId':_0x1e00aa['CampaignId']||undefined};};exports['filterKey']=function(_0x570866){if(_0x570866==='uniqueid'||_0x570866===_0x9762('0x67')||_0x570866===_0x9762('0x57')||_0x570866===_0x9762('0x68')||_0x570866===_0x9762('0x69')||_0x570866===_0x9762('0x6a')||_0x570866===_0x9762('0x33')||_0x570866===_0x9762('0x40')||_0x570866===_0x9762('0x19')||_0x570866==='active'||_0x570866==='calleridnum'||_0x570866==='scheduledat'||_0x570866==='countbusyretry'||_0x570866===_0x9762('0x46')||_0x570866===_0x9762('0x6b')||_0x570866==='countglobal'||_0x570866===_0x9762('0x6c')||_0x570866===_0x9762('0x6d')||_0x570866==='callbackat'||_0x570866===_0x9762('0x6e')||_0x570866==='ContactId'||_0x570866===_0x9762('0x51')||_0x570866===_0x9762('0x34')||_0x570866===_0x9762('0x1c')||_0x570866===_0x9762('0x6f')||_0x570866===_0x9762('0x70')||_0x570866===_0x9762('0x71')||_0x570866==='xmd-phone'||_0x570866===_0x9762('0x72')||_0x570866===_0x9762('0x73')||_0x570866==='xmd-dialtimeout'||_0x570866===_0x9762('0x74')||_0x570866===_0x9762('0x75')||_0x570866===_0x9762('0x76')||_0x570866===_0x9762('0x77')||_0x570866==='xmd-cdrtype'||_0x570866==='xmd-callerid'||_0x570866===_0x9762('0x78')||_0x570866===_0x9762('0x79')||_0x570866===_0x9762('0x7a')||_0x570866===_0x9762('0x7b')||_0x570866===_0x9762('0x7c')||_0x570866===_0x9762('0x7d')||_0x570866==='rtpaudioqosloss'||_0x570866===_0x9762('0x7e')||_0x570866==='rtpaudioqosrtt'||_0x570866==='rtpaudioqosrttbridged'||_0x570866===_0x9762('0x7a')||_0x570866===_0x9762('0x7b')||_0x570866===_0x9762('0x7c')||_0x570866==='rtpaudioqosjitterbridged'||_0x570866===_0x9762('0x7f')||_0x570866===_0x9762('0x7e')||_0x570866===_0x9762('0x80')||_0x570866===_0x9762('0x81')||_0x570866===_0x9762('0x82')||_0x570866===_0x9762('0x83')||_0x570866===_0x9762('0x2e')||_0x570866==='statedesc'){return![];}return!![];};exports[_0x9762('0x84')]=function(_0x20c027,_0x131e7a){var _0x5e0e0c,_0x14f0fd,_0xe50e45;if(_0x131e7a<=0x0){_0x131e7a=0x1;}_0x5e0e0c=new RegExp(_0x9762('0x85')+_0x131e7a+'}$');_0x14f0fd=Math[_0x9762('0x86')](0xa,_0x131e7a-0x1);_0xe50e45=Math[_0x9762('0x86')](0xa,_0x131e7a)-0x1;return util[_0x9762('0x14')]('%s',_[_0x9762('0x87')](_0x20c027,_0x5e0e0c,_[_0x9762('0x88')](_0x14f0fd,_0xe50e45)));};exports['extractCalleridName']=function(_0x3bbceb){var _0x1856be=_0x3bbceb[_0x9762('0x89')](/"(.*?)"/);return _0x1856be?_0x1856be[0x1]:_0x3bbceb;};exports[_0x9762('0x8a')]=function(_0x53f7e8){var _0x178500=_0x53f7e8['match'](/<(.*?)>/);return _0x178500?_0x178500[0x1]:_0x53f7e8;};function buildNoAnswerEventPayload(_0x4b043c,_0x4ba62c){var _0x344b31=buildObj(_0x4b043c,_0x9762('0x8b'));if(!_[_0x9762('0x13')](_0x4ba62c['variables'])){Object[_0x9762('0x8c')](_0x4ba62c['variables'])[_0x9762('0x8d')](function(_0x515fcf){_0x344b31[_0x515fcf['toLowerCase']()]=_0x4ba62c[_0x9762('0x8e')][_0x515fcf];});}return _0x344b31;}exports[_0x9762('0x8f')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x978b=['getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','UserId','logCustomer','starttime','talktime','answertime','isFailure','Failure','RECALL','calleridname','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','ListId','VoiceQueueId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','channelAgent','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','campaigntype','membername','scheduledat','countglobal','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid'];(function(_0x4741a3,_0x5c4a9e){var _0x5f05e3=function(_0x40f4c5){while(--_0x40f4c5){_0x4741a3['push'](_0x4741a3['shift']());}};_0x5f05e3(++_0x5c4a9e);}(_0x978b,0x9d));var _0xb978=function(_0x315508,_0x517b76){_0x315508=_0x315508-0x0;var _0x14767a=_0x978b[_0x315508];return _0x14767a;};'use strict';var util=require(_0xb978('0x0'));var _=require(_0xb978('0x1'));var moment=require(_0xb978('0x2'));var logger=require(_0xb978('0x3'))(_0xb978('0x4'));var ipAgi=process[_0xb978('0x5')][_0xb978('0x6')]||_0xb978('0x7');var utils=require('../../dialer/utils');exports[_0xb978('0x8')]=function(_0x573a8a){return function(_0x12760d){logger[_0xb978('0x9')](_0x573a8a,util[_0xb978('0xa')](_0x12760d,{'showHidden':![],'depth':null}));};};exports[_0xb978('0xb')]=function(_0x5263b5,_0x2ec0be){logger[_0xb978('0xc')](_0x5263b5,util[_0xb978('0xa')](_0x2ec0be,{'showHidden':![],'depth':null}));};exports[_0xb978('0xd')]=function(_0x5e1ed5,_0x5f0baf){logger['error'](_0x5e1ed5,util[_0xb978('0xa')](_0x5f0baf,{'showHidden':![],'depth':null}));};exports[_0xb978('0xe')]=function(_0x5a2593){return function(_0x4620a1){logger[_0xb978('0xc')](_0x5a2593,util['inspect'](_0x4620a1,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2251e3,_0x312a35,_0x76d052){return{'message':_0x2251e3,'unlock':_0x312a35,'active':_0x76d052};};exports['getCallerId']=function(_0x2fe3a8,_0x3ebec6,_0x2788fc){if(!_['isUndefined'](_0x2788fc)&&_0xb978('0xf')===typeof _0x2788fc&&!_[_0xb978('0x10')](_0x2788fc)){if(!_['isUndefined'](_0x3ebec6)&&_0xb978('0xf')===typeof _0x3ebec6&&!_['isEmpty'](_0x3ebec6)){return util[_0xb978('0x11')]('\x22%s\x22\x20<%s>',_0x3ebec6,_0x2788fc);}return util[_0xb978('0x11')](_0xb978('0x12'),_0x2788fc,_0x2788fc);}if(!_[_0xb978('0x13')](_0x2fe3a8)&&_0xb978('0xf')===typeof _0x2fe3a8&&!_[_0xb978('0x10')](_0x2fe3a8)){return _0x2fe3a8;}return _0xb978('0x14');};exports[_0xb978('0x15')]=function(_0x5deeb0){if(_[_0xb978('0x16')](_0x5deeb0)){return![];}return _0x5deeb0;};exports[_0xb978('0x17')]=function(_0x19620c,_0x16737f,_0x271190,_0x1dc45c,_0x2f64bf,_0x1f063c){var _0x251061={'XMD-QUEUE':_0x16737f[_0xb978('0x18')]?_0x16737f['Queue'][_0xb978('0x19')]:'','XMD-CALLERID':_0x1dc45c,'XMD-CALLERID-PREVIEW':_0x1f063c?util[_0xb978('0x11')]('\x22%s\x22\x20<%s>',_0x1f063c['calleridname'],_0x1f063c[_0xb978('0x1a')]):_0x1dc45c,'XMD-DIALID':_0x2f64bf,'XMD-CONTACTID':_0x16737f[_0xb978('0x1b')],'XMD-CDRTYPE':_0xb978('0x1c'),'CALLERID(all)':_0x1dc45c,'XMD-VOICEQUEUEID':_0x16737f['VoiceQueueId'],'XMD-DIALCHANNEL':_0x271190,'XMD-DIALTIMEOUT':_0x19620c['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb978('0x11')](_0xb978('0x1d'),_0x19620c[_0xb978('0x1e')]?'g':'',_[_0xb978('0x10')](_0x19620c[_0xb978('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x19620c[_0xb978('0x20')]||'','XMD-AGI':_0x19620c[_0xb978('0x21')]?util[_0xb978('0x11')](_0xb978('0x22'),ipAgi,_0x19620c[_0xb978('0x21')]):_0xb978('0x23'),'XMD-AGIAFTER':_0x19620c['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x19620c['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1f063c?_0x1f063c[_0xb978('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1f063c?_0x1f063c[_0xb978('0x25')]:'','XMD-DESTINATION':_0xb978('0x26'),'SIPADDHEADER':_0xb978('0x27')};if(!_['isEmpty'](_0x19620c[_0xb978('0x1f')])){_0x251061[util['format']('%s',_0xb978('0x28'))]=_0x19620c['monitor_format'];_0x251061[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2f64bf;}return _0x251061;};exports['toLowerVariables']=function(_0x32d38f){var _0xc10226={};for(var _0x37caee in _0x32d38f){if(_0x32d38f[_0xb978('0x29')](_0x37caee)){_0xc10226[util['format']('%s',_[_0xb978('0x2a')](_0x37caee))]=_0x32d38f[_0x37caee];}}return{'variables':_0xc10226};};exports[_0xb978('0x2b')]=function(_0x16fd9a){var _0x212e6d=moment()[_0xb978('0x11')](_0xb978('0x2c'));_0x16fd9a[_0xb978('0x2d')]=0xd;_0x16fd9a['statedesc']=_0xb978('0x2e');_0x16fd9a['starttime']=_0x212e6d;_0x16fd9a[_0xb978('0x2f')]=_0x212e6d;_0x16fd9a[_0xb978('0x30')]=_0x212e6d;};exports[_0xb978('0x31')]=function(_0x12a285,_0x572b9a,_0x1b570d){var _0x22a44b=moment()[_0xb978('0x11')](_0xb978('0x2c'));_0x12a285[_0xb978('0x2d')]=_0x572b9a;_0x12a285[_0xb978('0x32')]=_0x1b570d;_0x12a285[_0xb978('0x2f')]=_0x22a44b;_0x12a285[_0xb978('0x33')]=utils[_0xb978('0x34')](_0x12a285[_0xb978('0x2f')],_0x12a285['starttime']);};exports[_0xb978('0x35')]=function(_0x4bc428,_0x47476a,_0x435a27){_0x4bc428['membername']=_0x47476a;_0x4bc428[_0xb978('0x36')]=_0x435a27;};exports[_0xb978('0x37')]=function(_0x1ee554,_0x44a6d9,_0x1bac02){var _0x55830c=moment()[_0xb978('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ee554[_0xb978('0x2d')]=_0x44a6d9;_0x1ee554[_0xb978('0x32')]=_0x1bac02;_0x1ee554[_0xb978('0x2f')]=_0x1ee554[_0xb978('0x2f')]?_0x1ee554[_0xb978('0x2f')]:_0x55830c;_0x1ee554[_0xb978('0x30')]=_0x1ee554[_0xb978('0x30')]?_0x1ee554[_0xb978('0x30')]:_0x55830c;_0x1ee554[_0xb978('0x33')]=utils[_0xb978('0x34')](_0x1ee554['responsetime']||0x0,_0x1ee554[_0xb978('0x38')]||0x0);_0x1ee554[_0xb978('0x39')]=_0x1ee554[_0xb978('0x3a')]?utils['getSeconds'](_0x1ee554['endtime'],_0x1ee554['answertime']):0x0;};exports[_0xb978('0x3b')]=function(_0x2eaa47){return _0x2eaa47===_0xb978('0x3c');};exports['variablesAction']=function(_0x3917a7,_0xf0e59,_0x1f546a,_0x211401,_0x5bbc7a){var _0x29bb42=_0x211401?_0xb978('0x3d'):_0x3917a7[_0xb978('0x3e')];_0x29bb42=_0x5bbc7a?_0xb978('0x3f'):_0x29bb42;return{'actionid':_0x3917a7['uniqueid'],'action':_0xb978('0x40'),'channel':_0x3917a7['channelAgent'],'callerid':util[_0xb978('0x11')]('\x22%s\x22\x20<%s>',_0x29bb42,_0x3917a7[_0xb978('0x1a')]),'Exten':_0xb978('0x26'),'Context':_0xb978('0x41'),'Priority':'1','variable':_0x1f546a,'timeout':(_0xf0e59[_0xb978('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3917a7[_0xb978('0x43')]};};exports[_0xb978('0x44')]=function(_0x3929e8){return _0x3929e8[_0xb978('0x45')]+_0x3929e8[_0xb978('0x46')]+_0x3929e8[_0xb978('0x47')]+_0x3929e8[_0xb978('0x48')]+_0x3929e8[_0xb978('0x49')];};exports[_0xb978('0x4a')]=function(_0x43cf65){var _0x25f582=_[_0xb978('0x4b')](_0x43cf65);_0x25f582['state']=0xf;_0x25f582['statedesc']=_0xb978('0x4c');return _0x25f582;};exports['scheduledAt']=function(_0x11b838,_0x31c1d0,_0x1e8657){var _0x379f1e={};_0x379f1e[_0x31c1d0]=_0x11b838[_0x31c1d0];_0x379f1e[_0xb978('0x4d')]=![];_0x379f1e['scheduledat']=moment()[_0xb978('0x4e')](_0x1e8657,'minutes')[_0xb978('0x11')](_0xb978('0x2c'));_0x379f1e[_0xb978('0x1b')]=_0x11b838[_0xb978('0x1b')];_0x379f1e[_0xb978('0x4f')]=_0x11b838[_0xb978('0x4f')];_0x379f1e[_0xb978('0x50')]=_0x11b838['VoiceQueueId']||undefined;return _0x379f1e;};exports[_0xb978('0x51')]=function(_0x104790,_0x2de20d){if(!_[_0xb978('0x16')](_0x104790)){if(_0x104790[_0xb978('0x52')]>0x0){_0x104790['pTalking']-=0x1;}else{logger[_0xb978('0xc')](_0x2de20d,_0xb978('0x53'));}}else{logger[_0xb978('0x9')](_0x2de20d,_0xb978('0x54'));}};exports[_0xb978('0x55')]=function(_0x3f80a6){if(_0x3f80a6<=0x0){return!![];}return![];};function buildObj(_0x37e008,_0x3c7270,_0x398c10){_0x37e008[_0xb978('0x56')]=_0x3c7270;_0x37e008[_0xb978('0x19')]=_0x37e008[_0xb978('0x57')];_0x37e008['interface']=_0x37e008[_0xb978('0x58')];_0x37e008['motionChannel']=_0xb978('0x59');if(_0x398c10){_0x37e008[_0xb978('0x5a')]=_0x398c10[_0xb978('0x5a')];}return _0x37e008;}exports[_0xb978('0x5b')]=buildObj;exports[_0xb978('0x5c')]=function(_0x2a978c){var _0x4e97fd=[];for(var _0x3adce4 in _0x2a978c){if(_0x2a978c[_0xb978('0x29')](_0x3adce4)){if(!_[_0xb978('0x16')](_0x2a978c[_0x3adce4])&&_0x2a978c[_0x3adce4][_0xb978('0x2d')]===_0xb978('0x5d')&&_0x2a978c[_0x3adce4]['status']==='reachable'){_0x4e97fd[_0xb978('0x5e')](_0x2a978c[_0x3adce4]['id']);}}}return _0x4e97fd;};exports[_0xb978('0x5f')]=function(_0x43a51f){var _0x57ac07=moment()[_0xb978('0x60')](0x0);var _0x3ba5a1=moment(_0x43a51f)[_0xb978('0x60')](0x0);return _0x57ac07[_0xb978('0x61')](_0x3ba5a1,_0xb978('0x62'));};exports['createBody']=function(_0x48429a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x48429a[_0xb978('0x1b')],'ListId':_0x48429a[_0xb978('0x4f')],'VoiceQueueId':_0x48429a[_0xb978('0x50')]||undefined,'CampaignId':_0x48429a[_0xb978('0x63')]||undefined};};exports[_0xb978('0x64')]=function(_0x554c20){if(_0x554c20===_0xb978('0x43')||_0x554c20===_0xb978('0x65')||_0x554c20===_0xb978('0x57')||_0x554c20==='type'||_0x554c20===_0xb978('0x66')||_0x554c20==='dialAnswer'||_0x554c20===_0xb978('0x67')||_0x554c20==='channelAgent'||_0x554c20===_0xb978('0x3e')||_0x554c20===_0xb978('0x4d')||_0x554c20==='calleridnum'||_0x554c20===_0xb978('0x68')||_0x554c20===_0xb978('0x45')||_0x554c20===_0xb978('0x46')||_0x554c20==='countnoanswerretry'||_0x554c20===_0xb978('0x69')||_0x554c20==='callback'||_0x554c20===_0xb978('0x6a')||_0x554c20==='callbackat'||_0x554c20==='recallme'||_0x554c20===_0xb978('0x1b')||_0x554c20===_0xb978('0x4f')||_0x554c20===_0xb978('0x36')||_0x554c20===_0xb978('0x50')||_0x554c20===_0xb978('0x6b')||_0x554c20===_0xb978('0x6c')||_0x554c20==='xmd-queue'||_0x554c20===_0xb978('0x6d')||_0x554c20===_0xb978('0x6e')||_0x554c20===_0xb978('0x6f')||_0x554c20===_0xb978('0x70')||_0x554c20===_0xb978('0x71')||_0x554c20===_0xb978('0x72')||_0x554c20===_0xb978('0x73')||_0x554c20===_0xb978('0x74')||_0x554c20===_0xb978('0x75')||_0x554c20===_0xb978('0x76')||_0x554c20===_0xb978('0x77')||_0x554c20===_0xb978('0x78')||_0x554c20===_0xb978('0x79')||_0x554c20===_0xb978('0x7a')||_0x554c20===_0xb978('0x7b')||_0x554c20==='rtpaudioqosjitterbridged'||_0x554c20===_0xb978('0x7c')||_0x554c20==='rtpaudioqoslossbridged'||_0x554c20==='rtpaudioqosrtt'||_0x554c20===_0xb978('0x7d')||_0x554c20==='rtpaudioqos'||_0x554c20==='rtpaudioqosbridged'||_0x554c20===_0xb978('0x7b')||_0x554c20==='rtpaudioqosjitterbridged'||_0x554c20===_0xb978('0x7c')||_0x554c20===_0xb978('0x7e')||_0x554c20==='rtpaudioqosrtt'||_0x554c20===_0xb978('0x7d')||_0x554c20===_0xb978('0x7f')||_0x554c20===_0xb978('0x80')||_0x554c20===_0xb978('0x2d')||_0x554c20===_0xb978('0x32')){return![];}return!![];};exports[_0xb978('0x81')]=function(_0x1e14bf,_0x4e42c9){var _0x25e5dc,_0x1120ad,_0x284474;if(_0x4e42c9<=0x0){_0x4e42c9=0x1;}_0x25e5dc=new RegExp(_0xb978('0x82')+_0x4e42c9+'}$');_0x1120ad=Math[_0xb978('0x83')](0xa,_0x4e42c9-0x1);_0x284474=Math[_0xb978('0x83')](0xa,_0x4e42c9)-0x1;return util[_0xb978('0x11')]('%s',_[_0xb978('0x84')](_0x1e14bf,_0x25e5dc,_[_0xb978('0x85')](_0x1120ad,_0x284474)));};exports[_0xb978('0x86')]=function(_0x3e1c94){var _0x4063dd=_0x3e1c94[_0xb978('0x87')](/"(.*?)"/);return _0x4063dd?_0x4063dd[0x1]:_0x3e1c94;};exports[_0xb978('0x88')]=function(_0x640efd){var _0x9d189e=_0x640efd[_0xb978('0x87')](/<(.*?)>/);return _0x9d189e?_0x9d189e[0x1]:_0x640efd;};function buildNoAnswerEventPayload(_0xb2022e,_0x2eea3a){var _0x3f9dec=buildObj(_0xb2022e,_0xb978('0x89'));if(!_['isEmpty'](_0x2eea3a[_0xb978('0x8a')])){Object[_0xb978('0x8b')](_0x2eea3a['variables'])[_0xb978('0x8c')](function(_0x1f9305){_0x3f9dec[_0x1f9305[_0xb978('0x8d')]()]=_0x2eea3a['variables'][_0x1f9305];});}return _0x3f9dec;}exports[_0xb978('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 475e887..352f6d4 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 _0xf603=['string','boolean','queueremove','queuepause','voicequeuechannel','voicequeuechannelredirect','queueadd'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf603,0x68));var _0x3f60=function(_0x5c337b,_0xe411b4){_0x5c337b=_0x5c337b-0x0;var _0x2b0352=_0xf603[_0x5c337b];return _0x2b0352;};'use strict';exports[_0x3f60('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x3f60('0x1'),'required':!![]},'membername':{'type':_0x3f60('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x3f60('0x2'),'required':![]}};exports[_0x3f60('0x3')]={'queue':{'type':_0x3f60('0x1'),'required':!![]},'interface':{'type':_0x3f60('0x1'),'required':!![]}};exports[_0x3f60('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x3f60('0x2')},'reason':{'type':_0x3f60('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x3f60('0x1'),'required':![]}};exports[_0x3f60('0x5')]={'uniqueid':{'type':_0x3f60('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x3f60('0x1'),'required':!![]},'filename':{'type':_0x3f60('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3f60('0x1'),'required':!![]}};exports[_0x3f60('0x6')]={'uniqueid':{'type':_0x3f60('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x3f60('0x1')}}; \ No newline at end of file +var _0x76ab=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0x76ab,0x89));var _0xb76a=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x76ab[_0x4d2263];return _0x24aba0;};'use strict';exports[_0xb76a('0x0')]={'queue':{'type':_0xb76a('0x1'),'required':!![]},'interface':{'type':_0xb76a('0x1'),'required':!![]},'membername':{'type':_0xb76a('0x1'),'required':!![]},'penalty':{'type':_0xb76a('0x2'),'required':![]},'paused':{'type':_0xb76a('0x3'),'required':![]}};exports[_0xb76a('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xb76a('0x1'),'required':!![]}};exports[_0xb76a('0x5')]={'interface':{'type':_0xb76a('0x1'),'required':!![]},'paused':{'type':_0xb76a('0x3')},'reason':{'type':_0xb76a('0x1'),'required':![]}};exports[_0xb76a('0x6')]={'module':{'type':_0xb76a('0x1'),'required':![]}};exports[_0xb76a('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xb76a('0x1'),'required':!![]},'filename':{'type':_0xb76a('0x1')},'format':{'type':_0xb76a('0x1')},'mixmonitorid':{'type':_0xb76a('0x1')}};exports[_0xb76a('0x8')]={'uniqueid':{'type':_0xb76a('0x1'),'required':!![]}};exports[_0xb76a('0x9')]={'uniqueid':{'type':_0xb76a('0x1'),'required':!![]},'exten':{'type':_0xb76a('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0206efc..70c60ca 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x102d55,_0x12502a){var _0x9e6b5a=function(_0x571c08){while(--_0x571c08){_0x102d55['push'](_0x102d55['shift']());}};_0x9e6b5a(++_0x12502a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x54cdfd,_0x58086e){var _0x4d060b=function(_0x11a4cb){while(--_0x11a4cb){_0x54cdfd['push'](_0x54cdfd['shift']());}};_0x4d060b(++_0x58086e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d9443,_0xe0d01f){_0x4d9443=_0x4d9443-0x0;var _0x350586=_0xb10b[_0x4d9443];return _0x350586;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 66ab5a5..825123e 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 _0xcf8d=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x4d0f62,_0x5713a3){var _0x1e0638=function(_0x4856ad){while(--_0x4856ad){_0x4d0f62['push'](_0x4d0f62['shift']());}};_0x1e0638(++_0x5713a3);}(_0xcf8d,0x1cf));var _0xdcf8=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0xcf8d[_0x430459];return _0x3a2439;};'use strict';function mergeDBDataToRealtime(_0x2ca5f1,_0x61e9f4){var _0x265ef0=Object[_0xdcf8('0x0')]({},_0x2ca5f1);for(var _0x527cfa in _0x61e9f4){if(_0x265ef0[_0xdcf8('0x1')](_0x527cfa)){_0x265ef0[_0x527cfa]=_0x61e9f4[_0x527cfa];}}return _0x265ef0;}exports[_0xdcf8('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xf756=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x1f9ace,_0x24f995){var _0x48ea73=function(_0x17db55){while(--_0x17db55){_0x1f9ace['push'](_0x1f9ace['shift']());}};_0x48ea73(++_0x24f995);}(_0xf756,0x1ae));var _0x6f75=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf756[_0x311c35];return _0x5cc50c;};'use strict';function mergeDBDataToRealtime(_0x133057,_0x322702){var _0x364c6e=Object['assign']({},_0x133057);for(var _0x251558 in _0x322702){if(_0x364c6e[_0x6f75('0x0')](_0x251558)){_0x364c6e[_0x251558]=_0x322702[_0x251558];}}return _0x364c6e;}exports[_0x6f75('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 a4639f7..befb66e 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 _0x654f=['isArray','forEach','startsWith','Local','substring','indexOf','lastIndexOf','transfererlinkedid','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','format','SIP/%s','length','assigned','lastAssignedTo','isNil','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','getCallType','channel','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','calleridpreview','destinationchannel','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','split','UserId','membername','create','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','exten','xcally-motion-dialer','originatecalleridnum'];(function(_0x46cb35,_0x2b92ab){var _0x847507=function(_0x29b091){while(--_0x29b091){_0x46cb35['push'](_0x46cb35['shift']());}};_0x847507(++_0x2b92ab);}(_0x654f,0x67));var _0xf654=function(_0x9cf4e2,_0x40a6dc){_0x9cf4e2=_0x9cf4e2-0x0;var _0x3f23ca=_0x654f[_0x9cf4e2];return _0x3f23ca;};'use strict';var _=require(_0xf654('0x0'));var moment=require('moment');var util=require(_0xf654('0x1'));var config=require(_0xf654('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xf654('0x3'));var RpcVoiceCallReport=require(_0xf654('0x4'));var RpcVoiceDialReport=require(_0xf654('0x5'));var RpcMemberReport=require(_0xf654('0x6'));var RpcVoiceQueueReport=require(_0xf654('0x7'));var RpcVoiceRecording=require(_0xf654('0x8'));var RpcVoiceTransferReport=require(_0xf654('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xf654('0xa'));var VoiceAgentReport=require(_0xf654('0xb'));var VoiceDialReport=require(_0xf654('0xc'));var UserReport=require(_0xf654('0xd'));function Report(_0x1a9e3f){this[_0xf654('0xe')]=_0x1a9e3f;this['agents']=_0x1a9e3f[_0xf654('0xf')];this['telephones']=_0x1a9e3f[_0xf654('0x10')];}Report[_0xf654('0x11')][_0xf654('0x12')]=function(_0x169f52){var _0x3b83a4=new VoiceQueueReport(this[_0xf654('0xe')]);var _0xee7624=new VoiceAgentReport(this['realtime']);var _0x5c76e9=new VoiceDialReport(this[_0xf654('0xe')]);var _0x413332=new VoiceCallReport(this[_0xf654('0xe')]);var _0x25ec77=new UserReport(this[_0xf654('0xe')]);if(config[_0xf654('0x13')]&&config[_0xf654('0x13')]['disabled']){ami['on'](_0xf654('0x14'),this[_0xf654('0x15')][_0xf654('0x16')](this));ami['on'](_0xf654('0x17'),this[_0xf654('0x18')]['bind'](this));ami['on'](_0xf654('0x19'),this[_0xf654('0x1a')][_0xf654('0x16')](this));ami['on']('custom:voiceDialReport',this[_0xf654('0x1b')]['bind'](this));ami['on'](_0xf654('0x1c'),this[_0xf654('0x1d')][_0xf654('0x16')](this));ami['on'](_0xf654('0x1e'),this[_0xf654('0x1f')][_0xf654('0x16')](this));}};Report[_0xf654('0x11')][_0xf654('0x20')]=function(_0x380dbb){var _0x475044;_0x475044=_[_0xf654('0x21')](this['agents'],function(_0x5ac224){return _0x5ac224[_0xf654('0x22')]==_0x380dbb||_0x5ac224[_0xf654('0x23')]==_0x380dbb;});if(_['isNil'](_0x475044)){var _0x92884c=_['find'](this[_0xf654('0x10')],function(_0x3b8d90){return _0x3b8d90['accountcode']==_0x380dbb||_0x3b8d90[_0xf654('0x23')]==_0x380dbb;});if(_0x92884c){_0x475044=_['find'](this[_0xf654('0xf')],function(_0xc28c48){return _0xc28c48['interface']==util[_0xf654('0x24')](_0xf654('0x25'),_0x92884c['name']);});}}return _0x475044;};Report[_0xf654('0x11')][_0xf654('0x15')]=function(_0x544150){for(var _0x3012dd=0x0;_0x3012dd<_0x544150[_0xf654('0x26')];_0x3012dd+=0x1){var _0x9203ab=this[_0xf654('0x20')](_0x544150[_0x3012dd]['connectedlinenum']);if(_0x9203ab){_0x544150[_0x3012dd][_0xf654('0x22')]=_0x9203ab[_0xf654('0x22')];_0x544150[_0x3012dd][_0xf654('0x27')]=!![];_0x544150[_0x3012dd][_0xf654('0x28')]=_0x9203ab['name'];_0x544150[_0x3012dd]['interface']=_[_0xf654('0x29')](_0x9203ab['interface'])?util[_0xf654('0x24')](_0xf654('0x25'),_0x9203ab[_0xf654('0x23')]):_0x9203ab[_0xf654('0x2a')];if(_0x544150[_0x3012dd][_0xf654('0x2b')]){_0x544150[_0x3012dd]['queuecallercompleteAt']=moment()[_0xf654('0x24')](_0xf654('0x2c'));}if(_0x544150[_0x3012dd][_0xf654('0x2d')]){_0x544150[_0x3012dd][_0xf654('0x2e')]=moment()['format'](_0xf654('0x2c'));}RpcMemberReport[_0xf654('0x15')](_0x544150[_0x3012dd]);}RpcVoiceQueueReport['create'](_0x544150[_0x3012dd]);}};function extractCalleridNumber(_0x562de7){var _0x2c0f24=_0x562de7[_0xf654('0x2f')](/<(.*?)>/);return _0x2c0f24?_0x2c0f24[0x1]:_0x562de7;}Report[_0xf654('0x11')][_0xf654('0x30')]=function(_0x175be1){for(var _0x29887b=0x0;_0x29887b','linkedid','transfers','uniqueid','type','getCallType','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','exten','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','create','startsWith','Local','substring','indexOf','mobile','SIP/%s','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents'];(function(_0x4ec678,_0x417b92){var _0x12e8ee=function(_0x12a09b){while(--_0x12a09b){_0x4ec678['push'](_0x4ec678['shift']());}};_0x12e8ee(++_0x417b92);}(_0x1edb,0x16a));var _0xb1ed=function(_0x4a5a5d,_0x146aa6){_0x4a5a5d=_0x4a5a5d-0x0;var _0xea850d=_0x1edb[_0x4a5a5d];return _0xea850d;};'use strict';var _=require(_0xb1ed('0x0'));var moment=require(_0xb1ed('0x1'));var util=require(_0xb1ed('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xb1ed('0x3'));var RpcVoiceCallReport=require(_0xb1ed('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xb1ed('0x5'));var RpcVoiceQueueReport=require(_0xb1ed('0x6'));var RpcVoiceRecording=require(_0xb1ed('0x7'));var RpcVoiceTransferReport=require(_0xb1ed('0x8'));var VoiceQueueReport=require(_0xb1ed('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xb1ed('0xa'));var VoiceDialReport=require(_0xb1ed('0xb'));var UserReport=require(_0xb1ed('0xc'));function Report(_0x1a8bde){this['realtime']=_0x1a8bde;this[_0xb1ed('0xd')]=_0x1a8bde[_0xb1ed('0xd')];this[_0xb1ed('0xe')]=_0x1a8bde[_0xb1ed('0xe')];}Report[_0xb1ed('0xf')][_0xb1ed('0x10')]=function(_0x14d4e1){var _0x2e0445=new VoiceQueueReport(this[_0xb1ed('0x11')]);var _0x4971d4=new VoiceAgentReport(this[_0xb1ed('0x11')]);var _0x5e2cc8=new VoiceDialReport(this[_0xb1ed('0x11')]);var _0x532f47=new VoiceCallReport(this['realtime']);var _0x2e6991=new UserReport(this[_0xb1ed('0x11')]);if(config[_0xb1ed('0x12')]&&config[_0xb1ed('0x12')][_0xb1ed('0x13')]){ami['on'](_0xb1ed('0x14'),this[_0xb1ed('0x15')][_0xb1ed('0x16')](this));ami['on'](_0xb1ed('0x17'),this['voiceCallReport'][_0xb1ed('0x16')](this));ami['on'](_0xb1ed('0x18'),this[_0xb1ed('0x19')][_0xb1ed('0x16')](this));ami['on'](_0xb1ed('0x1a'),this[_0xb1ed('0x1b')][_0xb1ed('0x16')](this));ami['on']('blindtransfer',this[_0xb1ed('0x1c')][_0xb1ed('0x16')](this));ami['on'](_0xb1ed('0x1d'),this['attendedTransfer'][_0xb1ed('0x16')](this));}};Report['prototype'][_0xb1ed('0x1e')]=function(_0xf6afc1){var _0x2f5c63;_0x2f5c63=_[_0xb1ed('0x1f')](this[_0xb1ed('0xd')],function(_0x31f00c){return _0x31f00c['accountcode']==_0xf6afc1||_0x31f00c[_0xb1ed('0x20')]==_0xf6afc1;});if(_['isNil'](_0x2f5c63)){var _0x24cf36=_[_0xb1ed('0x1f')](this[_0xb1ed('0xe')],function(_0x3c0f10){return _0x3c0f10[_0xb1ed('0x21')]==_0xf6afc1||_0x3c0f10[_0xb1ed('0x20')]==_0xf6afc1;});if(_0x24cf36){_0x2f5c63=_[_0xb1ed('0x1f')](this['agents'],function(_0x488c39){return _0x488c39['interface']==util['format']('SIP/%s',_0x24cf36[_0xb1ed('0x20')]);});}}return _0x2f5c63;};Report[_0xb1ed('0xf')]['voiceQueueReport']=function(_0x2db972){for(var _0x11bee8=0x0;_0x11bee8<_0x2db972['length'];_0x11bee8+=0x1){var _0x198520=this['findAgent'](_0x2db972[_0x11bee8][_0xb1ed('0x22')]);if(_0x198520){_0x2db972[_0x11bee8][_0xb1ed('0x21')]=_0x198520['accountcode'];_0x2db972[_0x11bee8][_0xb1ed('0x23')]=!![];_0x2db972[_0x11bee8][_0xb1ed('0x24')]=_0x198520[_0xb1ed('0x20')];_0x2db972[_0x11bee8]['interface']=_[_0xb1ed('0x25')](_0x198520['interface'])?util[_0xb1ed('0x26')]('SIP/%s',_0x198520[_0xb1ed('0x20')]):_0x198520[_0xb1ed('0x27')];if(_0x2db972[_0x11bee8][_0xb1ed('0x28')]){_0x2db972[_0x11bee8]['queuecallercompleteAt']=moment()['format'](_0xb1ed('0x29'));}if(_0x2db972[_0x11bee8]['queuecallerexit']){_0x2db972[_0x11bee8][_0xb1ed('0x2a')]=moment()[_0xb1ed('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xb1ed('0x15')](_0x2db972[_0x11bee8]);}RpcVoiceQueueReport['create'](_0x2db972[_0x11bee8]);}};function extractCalleridNumber(_0x296ef2){var _0x4520f6=_0x296ef2[_0xb1ed('0x2b')](/<(.*?)>/);return _0x4520f6?_0x4520f6[0x1]:_0x296ef2;}Report['prototype'][_0xb1ed('0x2c')]=function(_0x417ef3){for(var _0x3b6e5a=0x0;_0x3b6e5a{delete this[_0xe0b3('0xa')][_0x382799];},_0x43730f);}};module[_0xe0b3('0xa2')]=VoiceAgentReport; \ No newline at end of file +var _0x0ec4=['agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentcomplete','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','agent','talktime','acw','destconnectedlinenum','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','isNil','includes','syncHangup','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','emit','custom:agentcalled','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','agentconnectAt','connectedlinenum','destchannelstate','holdtime','lastevent','connect','merge','pick','name','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere'];(function(_0x3d0e7c,_0x5dcd84){var _0x4251a4=function(_0x31dc19){while(--_0x31dc19){_0x3d0e7c['push'](_0x3d0e7c['shift']());}};_0x4251a4(++_0x5dcd84);}(_0x0ec4,0xe9));var _0x40ec=function(_0x2668e8,_0x383b7c){_0x2668e8=_0x2668e8-0x0;var _0x1afd5a=_0x0ec4[_0x2668e8];return _0x1afd5a;};'use strict';var _=require(_0x40ec('0x0'));var moment=require(_0x40ec('0x1'));var util=require(_0x40ec('0x2'));var Redis=require(_0x40ec('0x3'));var config=require(_0x40ec('0x4'));var logger=require(_0x40ec('0x5'))(_0x40ec('0x6'));var ami=require(_0x40ec('0x7'));config[_0x40ec('0x8')]=_[_0x40ec('0x9')](config[_0x40ec('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x40ec('0x8')]));function VoiceAgentReport(_0x35b649){this[_0x40ec('0xa')]={};this[_0x40ec('0xb')]=_0x35b649[_0x40ec('0xa')];this[_0x40ec('0xc')]=_0x35b649[_0x40ec('0xc')];this[_0x40ec('0xd')]=_0x35b649['agents'];this[_0x40ec('0xe')]={};ami['on']('agentcalled',this[_0x40ec('0xf')][_0x40ec('0x10')](this));ami['on']('agentconnect',this[_0x40ec('0x11')]['bind'](this));ami['on']('agentringnoanswer',this[_0x40ec('0x12')][_0x40ec('0x10')](this));ami['on'](_0x40ec('0x13'),this[_0x40ec('0x14')][_0x40ec('0x10')](this));ami['on']('agentcomplete',this[_0x40ec('0x15')][_0x40ec('0x10')](this));ami['on'](_0x40ec('0x16'),this[_0x40ec('0x17')][_0x40ec('0x10')](this));ami['on']('hangup',this['syncHangup'][_0x40ec('0x10')](this));ami['on']('musiconholdstart',this[_0x40ec('0x18')][_0x40ec('0x10')](this));ami['on'](_0x40ec('0x19'),this[_0x40ec('0x1a')][_0x40ec('0x10')](this));ami['on'](_0x40ec('0x1b'),this[_0x40ec('0x1c')]['bind'](this));ami['on'](_0x40ec('0x1d'),this['syncBlindTransfer'][_0x40ec('0x10')](this));}VoiceAgentReport[_0x40ec('0x1e')]['emit']=function(_0x2e9800,_0x371e2f,_0x1599d4){io['to'](_0x2e9800)['emit'](_0x371e2f,_0x1599d4);};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x1f')]=function(_0x53a02f){return _0x53a02f!==null&&!_[_0x40ec('0x20')](_0x53a02f);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x5739f8){try{if(this[_0x40ec('0x1f')](_0x5739f8)){logger['info'](_0x40ec('0x21'),_0x5739f8[_0x40ec('0x22')],_0x5739f8[_0x40ec('0x23')],_0x5739f8['destuniqueid']);logger[_0x40ec('0x24')](_0x40ec('0x25'),_0x5739f8[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x5739f8,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x40ec('0xa')][_0x5739f8[_0x40ec('0x22')]])){this['channels'][_0x5739f8[_0x40ec('0x22')]]={};}var _0x231d32=this['agents'][_0x5739f8[_0x40ec('0x27')]];var _0x172da5=this[_0x40ec('0xa')][_0x5739f8[_0x40ec('0x22')]][_0x5739f8[_0x40ec('0x28')]];var _0x1ac5c2=this[_0x40ec('0xc')][_0x5739f8['queue']];var _0xbcf52f=this[_0x40ec('0xe')][_0x5739f8[_0x40ec('0x22')]];if(_[_0x40ec('0x20')](_0x172da5)){_0x172da5={'agentcalledAt':moment()[_0x40ec('0x29')](_0x40ec('0x2a')),'lastevent':_0x40ec('0x2b'),'mandatoryDisposition':_0x1ac5c2&&_0x1ac5c2['mandatoryDisposition']?_0x1ac5c2[_0x40ec('0x2c')]:![],'type':_0x1ac5c2&&_0x1ac5c2[_0x40ec('0x2d')]?_0x1ac5c2['type']:_0x40ec('0x2e'),'variables':_0xbcf52f,'motionChannel':_0x40ec('0x2f')};}Object[_0x40ec('0x30')](_0x172da5,_[_0x40ec('0x31')](_0x5739f8,[_0x40ec('0x32'),_0x40ec('0x33')]));this[_0x40ec('0xa')][_0x5739f8['uniqueid']][_0x5739f8['destuniqueid']]=_0x172da5;logger[_0x40ec('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x5739f8['uniqueid'],util[_0x40ec('0x26')](_0x172da5,{'showHidden':![],'depth':null}));ami[_0x40ec('0x34')](_0x40ec('0x35'),_0x172da5);var _0x40ca74={'id':_0x231d32['id'],'calleridnum':_0x172da5['calleridnum'],'queue':_0x172da5[_0x40ec('0x36')],'variables':_0x172da5[_0x40ec('0xe')],'uniqueid':_0x5739f8[_0x40ec('0x22')]};logger[_0x40ec('0x24')](_0x40ec('0x37'),_0x5739f8[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x40ca74,{'showHidden':![],'depth':null}));this[_0x40ec('0x34')](util[_0x40ec('0x29')](_0x40ec('0x38'),_0x5739f8[_0x40ec('0x23')]),_0x40ec('0x39'),_0x40ca74);}}catch(_0x347142){logger[_0x40ec('0x3a')](_0x40ec('0x3b'),_0x5739f8[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x347142,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x11')]=function(_0x2f87ae){try{if(this[_0x40ec('0x1f')](_0x2f87ae)){if(this['channels'][_0x2f87ae[_0x40ec('0x22')]]){for(var _0x4e17b4 in this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]]){if(this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x40ec('0x3c')](_0x4e17b4)){if(_0x2f87ae[_0x40ec('0x28')]===_0x4e17b4){logger[_0x40ec('0x3d')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f87ae[_0x40ec('0x22')],_0x2f87ae[_0x40ec('0x23')],_0x2f87ae[_0x40ec('0x28')]);this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x3e')]=moment()['format'](_0x40ec('0x2a'));this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4]['connectedlinename']=_0x2f87ae['connectedlinename'];this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x3f')]=_0x2f87ae[_0x40ec('0x3f')];this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x40')]=_0x2f87ae[_0x40ec('0x40')];this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4]['destchannelstatedesc']=_0x2f87ae['destchannelstatedesc'];this[_0x40ec('0xa')][_0x2f87ae['uniqueid']][_0x4e17b4][_0x40ec('0x41')]=_0x2f87ae[_0x40ec('0x41')];this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x42')]=_0x40ec('0x43');_[_0x40ec('0x44')](this['agents'][_0x2f87ae[_0x40ec('0x27')]],_[_0x40ec('0x45')](_0x2f87ae,[_0x40ec('0x36'),'destconnectedlinenum']));var _0x3dab61=this['agents'][_0x2f87ae[_0x40ec('0x27')]];var _0x10e099={'id':_0x3dab61['id'],'name':_0x3dab61[_0x40ec('0x46')],'agentconnected':!![],'destaccountcode':_0x3dab61['accountcode'],'destconnectedlinenum':this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x2f87ae['destuniqueid']]['exten'],'queue':this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x2f87ae[_0x40ec('0x28')]]['queue'],'uniqueid':this[_0x40ec('0xa')][_0x2f87ae['uniqueid']][_0x2f87ae['destuniqueid']][_0x40ec('0x22')]};ami[_0x40ec('0x34')]('custom:agentconnect',this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x2f87ae[_0x40ec('0x28')]]);this[_0x40ec('0x34')](util[_0x40ec('0x29')](_0x40ec('0x38'),_0x2f87ae[_0x40ec('0x23')]),'user:agentconnect',_0x10e099);}else if(!this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x47')]&&!this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4]['agentcomplete']){logger[_0x40ec('0x3d')](_0x40ec('0x48'),_0x2f87ae[_0x40ec('0x22')],this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x23')],_0x4e17b4);this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x47')]=!![];this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x49')]=moment()[_0x40ec('0x29')](_0x40ec('0x2a'));this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x4a')]=_0x2f87ae[_0x40ec('0x28')];this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x4b')]=_0x2f87ae[_0x40ec('0x23')];this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x42')]=_0x40ec('0x4c');this[_0x40ec('0xa')][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4][_0x40ec('0x4d')]=_0x40ec('0x4c');logger[_0x40ec('0x24')](_0x40ec('0x4e'),_0x2f87ae[_0x40ec('0x22')],util[_0x40ec('0x26')](this['channels'][_0x2f87ae[_0x40ec('0x22')]][_0x4e17b4],{'showHidden':![],'depth':null}));ami[_0x40ec('0x34')](_0x40ec('0x4f'),this[_0x40ec('0xa')][_0x2f87ae['uniqueid']][_0x4e17b4]);}else{logger['debug']('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x2f87ae[_0x40ec('0x22')]);}}}}}}catch(_0x1b84bc){logger[_0x40ec('0x3a')]('[%s][voiceAgentReport][agentconnect]',_0x2f87ae[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x1b84bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x40ec('0x12')]=function(_0x59ade0){try{if(this['isNotNull'](_0x59ade0)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x59ade0[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x59ade0,{'showHidden':![],'depth':null}));if(this[_0x40ec('0xa')][_0x59ade0[_0x40ec('0x22')]]&&this[_0x40ec('0xa')][_0x59ade0[_0x40ec('0x22')]][_0x59ade0[_0x40ec('0x28')]]){logger[_0x40ec('0x3d')](_0x40ec('0x50'),_0x59ade0['uniqueid'],_0x59ade0[_0x40ec('0x23')],_0x59ade0[_0x40ec('0x28')]);var _0x4a7475=this[_0x40ec('0xd')][_0x59ade0[_0x40ec('0x27')]];var _0x349cdc=this[_0x40ec('0xa')][_0x59ade0[_0x40ec('0x22')]][_0x59ade0[_0x40ec('0x28')]];_0x349cdc[_0x40ec('0x47')]=!![];_0x349cdc[_0x40ec('0x49')]=moment()[_0x40ec('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x349cdc[_0x40ec('0x42')]=_0x40ec('0x51');_0x349cdc['reason']=_0x40ec('0x51');var _0xaa4bbf={'id':_0x4a7475['id'],'name':_0x4a7475[_0x40ec('0x46')],'queue':_0x349cdc[_0x40ec('0x36')],'uniqueid':_0x349cdc[_0x40ec('0x22')]};logger[_0x40ec('0x24')](_0x40ec('0x52'),_0x59ade0['uniqueid'],util[_0x40ec('0x26')](_0xaa4bbf,{'showHidden':![],'depth':null}));this['emit'](util[_0x40ec('0x29')](_0x40ec('0x38'),_0x4a7475[_0x40ec('0x46')]),_0x40ec('0x53'),_0xaa4bbf);ami[_0x40ec('0x34')]('custom:agentringnoanswer',_0x349cdc);this['channels'][_0x59ade0[_0x40ec('0x22')]][_0x59ade0[_0x40ec('0x28')]]=Object[_0x40ec('0x30')]({},_0x349cdc);}}}catch(_0x1a0c30){logger[_0x40ec('0x3a')](_0x40ec('0x54'),_0x59ade0['uniqueid'],util[_0x40ec('0x26')](_0x1a0c30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x14')]=function(_0x409fb2){try{if(this[_0x40ec('0x1f')](_0x409fb2)){logger['debug'](_0x40ec('0x55'),_0x409fb2[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x409fb2,{'showHidden':![],'depth':null}));if(this['channels'][_0x409fb2[_0x40ec('0x22')]]){for(var _0x1b816f in this[_0x40ec('0xa')][_0x409fb2[_0x40ec('0x22')]]){if(this['channels'][_0x409fb2[_0x40ec('0x22')]][_0x40ec('0x3c')](_0x1b816f)&&!this[_0x40ec('0xa')][_0x409fb2[_0x40ec('0x22')]][_0x1b816f][_0x40ec('0x47')]&&!this[_0x40ec('0xa')][_0x409fb2[_0x40ec('0x22')]][_0x1b816f][_0x40ec('0x56')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x409fb2['uniqueid'],this['channels'][_0x409fb2[_0x40ec('0x22')]][_0x1b816f]['membername'],_0x1b816f);this[_0x40ec('0xa')][_0x409fb2[_0x40ec('0x22')]][_0x1b816f]['agentringnoanswer']=!![];this[_0x40ec('0xa')][_0x409fb2['uniqueid']][_0x1b816f]['agentringnoanswerAt']=moment()['format'](_0x40ec('0x2a'));this[_0x40ec('0xa')][_0x409fb2[_0x40ec('0x22')]][_0x1b816f][_0x40ec('0x42')]=_0x40ec('0x57');this[_0x40ec('0xa')][_0x409fb2['uniqueid']][_0x1b816f][_0x40ec('0x4d')]=_0x40ec('0x57');logger['debug'](_0x40ec('0x58'),_0x409fb2['uniqueid'],util[_0x40ec('0x26')](this['channels'][_0x409fb2[_0x40ec('0x22')]][_0x1b816f],{'showHidden':![],'depth':null}));ami[_0x40ec('0x34')](_0x40ec('0x59'),this[_0x40ec('0xa')][_0x409fb2['uniqueid']][_0x1b816f]);}}}}}catch(_0x15e410){logger[_0x40ec('0x3a')](_0x40ec('0x5a'),_0x409fb2['uniqueid'],util['inspect'](_0x15e410,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x15')]=function(_0x3771c9){try{if(this[_0x40ec('0x1f')](_0x3771c9)){logger[_0x40ec('0x24')](_0x40ec('0x5b'),_0x3771c9['uniqueid'],util['inspect'](_0x3771c9,{'showHidden':![],'depth':null}));if(this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]]){for(var _0x29660d in this['channels'][_0x3771c9[_0x40ec('0x22')]]){if(this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x40ec('0x3c')](_0x29660d)){if(this['channels'][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x3e')]&&!this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x56')]){logger[_0x40ec('0x3d')](_0x40ec('0x5c'),_0x3771c9[_0x40ec('0x22')],this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x23')],_0x29660d);this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x56')]=!![];this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d]['agentcompleteAt']=moment()[_0x40ec('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x42')]=_0x40ec('0x5d');this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x4d')]=_0x3771c9[_0x40ec('0x4d')]=='transfer'?_0x40ec('0x5e'):_0x3771c9['reason'];this['channels'][_0x3771c9[_0x40ec('0x22')]][_0x29660d][_0x40ec('0x5f')]=_0x3771c9['talktime'];if(this[_0x40ec('0xc')][_0x3771c9['queue']]&&this[_0x40ec('0xc')][_0x3771c9[_0x40ec('0x36')]][_0x40ec('0x60')]){this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d]['acwtime']=this[_0x40ec('0xc')][_0x3771c9[_0x40ec('0x36')]]['acwTimeout'];this[_0x40ec('0xa')][_0x3771c9['uniqueid']][_0x29660d]['agentacw']=!![];}this['agents'][_0x3771c9[_0x40ec('0x27')]]=_[_0x40ec('0x31')](this[_0x40ec('0xd')][_0x3771c9[_0x40ec('0x27')]],['queue',_0x40ec('0x61')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x3771c9[_0x40ec('0x22')],util['inspect'](this[_0x40ec('0xa')][_0x3771c9[_0x40ec('0x22')]][_0x29660d],{'showHidden':![],'depth':null}));ami[_0x40ec('0x34')](_0x40ec('0x62'),this['channels'][_0x3771c9[_0x40ec('0x22')]][_0x29660d]);logger[_0x40ec('0x24')](_0x40ec('0x63'),_0x3771c9[_0x40ec('0x22')],util[_0x40ec('0x26')]({'id':this['agents'][_0x3771c9[_0x40ec('0x27')]]['id'],'destaccountcode':_0x3771c9[_0x40ec('0x64')]},{'showHidden':![],'depth':null}));this[_0x40ec('0x34')](util[_0x40ec('0x29')](_0x40ec('0x38'),_0x3771c9[_0x40ec('0x23')]),_0x40ec('0x65'),{'id':this[_0x40ec('0xd')][_0x3771c9['interface']]['id'],'destaccountcode':Number(_0x3771c9[_0x40ec('0x64')])});}}}}}}catch(_0x43fec5){logger[_0x40ec('0x3a')](_0x40ec('0x66'),_0x3771c9[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x43fec5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')]['syncVarSet']=function(_0x23d955){try{if(this[_0x40ec('0x1f')](_0x23d955)){logger[_0x40ec('0x24')](_0x40ec('0x67'),_0x23d955['uniqueid'],util['inspect'](_0x23d955,{'showHidden':![],'depth':null}));this[_0x40ec('0x68')](_0x23d955[_0x40ec('0x22')],_[_0x40ec('0x69')](_0x23d955[_0x40ec('0x6a')])[0x0],_0x23d955[_0x40ec('0x6b')]);if(this[_0x40ec('0xa')][_0x23d955[_0x40ec('0x22')]]){for(var _0x2be178 in this['channels'][_0x23d955[_0x40ec('0x22')]]){if(this[_0x40ec('0xa')][_0x23d955[_0x40ec('0x22')]][_0x40ec('0x3c')](_0x2be178)){logger['info'](_0x40ec('0x6c'),_0x23d955['uniqueid'],_0x2be178,_[_0x40ec('0x69')](_0x23d955[_0x40ec('0x6a')])[0x0],_0x23d955['value']);if(_[_0x40ec('0x20')](this[_0x40ec('0xa')][_0x23d955[_0x40ec('0x22')]][_0x2be178][_0x40ec('0xe')])){this[_0x40ec('0xa')][_0x23d955[_0x40ec('0x22')]][_0x2be178][_0x40ec('0xe')]={};}this[_0x40ec('0xa')][_0x23d955[_0x40ec('0x22')]][_0x2be178][_0x40ec('0xe')]=this[_0x40ec('0xe')][_0x23d955[_0x40ec('0x22')]];}}}}}catch(_0x4e2027){logger[_0x40ec('0x3a')](_0x40ec('0x6d'),_0x23d955['uniqueid'],util['inspect'](_0x4e2027,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x40ec('0x68')]=function(_0x27e86a,_0x593079,_0x29d350){var _0x50c5dd=[_0x40ec('0x6e'),_0x40ec('0x6f'),_0x40ec('0x70'),'rtpaudioqosjitterbridged',_0x40ec('0x71'),_0x40ec('0x72'),'rtpaudioqosrtt',_0x40ec('0x73'),_0x40ec('0x74'),_0x40ec('0x75'),_0x40ec('0x76'),_0x40ec('0x77'),_0x40ec('0x78'),'memberdynamic',_0x40ec('0x79'),_0x40ec('0x7a'),_0x40ec('0x23'),_0x40ec('0x7b'),'memberrealtime'];if(!_[_0x40ec('0x7c')](_0x593079)&&!_[_0x40ec('0x7d')](_0x50c5dd,_0x593079)){if(_[_0x40ec('0x20')](this[_0x40ec('0xe')][_0x27e86a])){this[_0x40ec('0xe')][_0x27e86a]={};}this[_0x40ec('0xe')][_0x27e86a][_0x593079]=_0x29d350;}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x7e')]=function(_0x5a1672){try{if(this[_0x40ec('0x1f')](_0x5a1672)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x5a1672[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x5a1672,{'showHidden':![],'depth':null}));if(this[_0x40ec('0xa')][_0x5a1672[_0x40ec('0x22')]]){for(var _0x1a15ac in this[_0x40ec('0xa')][_0x5a1672[_0x40ec('0x22')]]){if(this['channels'][_0x5a1672[_0x40ec('0x22')]][_0x40ec('0x3c')](_0x1a15ac)){if(this['channels'][_0x5a1672[_0x40ec('0x22')]][_0x1a15ac][_0x40ec('0x4d')]==_0x40ec('0x7f')&&this[_0x40ec('0xa')][_0x5a1672[_0x40ec('0x22')]][_0x1a15ac][_0x40ec('0x56')]){logger[_0x40ec('0x3d')](_0x40ec('0x80'),_0x5a1672[_0x40ec('0x22')],_0x1a15ac);this['channels'][_0x5a1672['uniqueid']][_0x1a15ac][_0x40ec('0x81')]=moment()['format'](_0x40ec('0x2a'));}}}logger['debug'](_0x40ec('0x82'),_0x5a1672[_0x40ec('0x22')],util[_0x40ec('0x26')](_[_0x40ec('0x83')](this['channels'][_0x5a1672[_0x40ec('0x22')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x40ec('0x84'),_['values'](this[_0x40ec('0xa')][_0x5a1672[_0x40ec('0x22')]]));this[_0x40ec('0x85')](_0x5a1672[_0x40ec('0x22')]);}if(this[_0x40ec('0xe')][_0x5a1672[_0x40ec('0x22')]]){delete this[_0x40ec('0xe')][_0x5a1672['uniqueid']];}}}catch(_0x5af70c){logger[_0x40ec('0x3a')]('[%s][voiceAgentReport][hangup]',_0x5a1672[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x5af70c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x1c')]=function(_0x59031d){try{if(this[_0x40ec('0x1f')](_0x59031d)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x59031d[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x59031d,{'showHidden':![],'depth':null}));if(this['channels'][_0x59031d['transfereeuniqueid']]){for(var _0x2d3f62 in this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x86')]]){if(this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x86')]]['hasOwnProperty'](_0x2d3f62)){if(_0x59031d[_0x40ec('0x87')]===_0x2d3f62){logger[_0x40ec('0x3d')](_0x40ec('0x88'),_0x59031d[_0x40ec('0x22')],this[_0x40ec('0xa')][_0x59031d['transfereeuniqueid']][_0x2d3f62]['membername'],_0x2d3f62);var _0x1e64b0=moment();this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x86')]][_0x2d3f62][_0x40ec('0x56')]=!![];this[_0x40ec('0xa')][_0x59031d['transfereeuniqueid']][_0x2d3f62][_0x40ec('0x81')]=moment()[_0x40ec('0x29')](_0x40ec('0x2a'));this['channels'][_0x59031d['transfereeuniqueid']][_0x2d3f62][_0x40ec('0x42')]=_0x40ec('0x5d');this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x86')]][_0x2d3f62][_0x40ec('0x4d')]=_0x40ec('0x7f');this['channels'][_0x59031d['transfereeuniqueid']][_0x2d3f62][_0x40ec('0x5f')]=_0x1e64b0['diff'](this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x86')]][_0x2d3f62][_0x40ec('0x3e')],'seconds');}}}}if(this[_0x40ec('0xa')][_0x59031d['secondtransfereruniqueid']]){var _0x545cf4=this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x89')]];this['channels'][_0x59031d['secondtransfereruniqueid']]=this[_0x40ec('0xa')][_0x59031d[_0x40ec('0x86')]];this['channels'][_0x59031d['transfereeuniqueid']]=_0x545cf4;}}}catch(_0x5084af){logger[_0x40ec('0x3a')](_0x40ec('0x8a'),_0x59031d[_0x40ec('0x22')],util['inspect'](_0x5084af,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x8b')]=function(_0x2b702b){try{if(this['isNotNull'](_0x2b702b)){logger[_0x40ec('0x24')](_0x40ec('0x8c'),_0x2b702b[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x2b702b,{'showHidden':![],'depth':null}));if(this[_0x40ec('0xa')][_0x2b702b['transfereeuniqueid']]){for(var _0x19f521 in this[_0x40ec('0xa')][_0x2b702b[_0x40ec('0x86')]]){if(this[_0x40ec('0xa')][_0x2b702b['transfereeuniqueid']][_0x40ec('0x3c')](_0x19f521)){if(_0x2b702b['transfereruniqueid']===_0x19f521){logger[_0x40ec('0x3d')](_0x40ec('0x8d'),_0x2b702b[_0x40ec('0x22')],this[_0x40ec('0xa')][_0x2b702b[_0x40ec('0x86')]][_0x19f521][_0x40ec('0x23')],_0x19f521);var _0x317a06=moment();this[_0x40ec('0xa')][_0x2b702b[_0x40ec('0x86')]][_0x19f521][_0x40ec('0x56')]=!![];this[_0x40ec('0xa')][_0x2b702b[_0x40ec('0x86')]][_0x19f521][_0x40ec('0x81')]=_0x317a06;this[_0x40ec('0xa')][_0x2b702b['transfereeuniqueid']][_0x19f521][_0x40ec('0x42')]='complete';this[_0x40ec('0xa')][_0x2b702b[_0x40ec('0x86')]][_0x19f521]['reason']='transfer';this[_0x40ec('0xa')][_0x2b702b['transfereeuniqueid']][_0x19f521][_0x40ec('0x5f')]=_0x317a06['diff'](this[_0x40ec('0xa')][_0x2b702b[_0x40ec('0x86')]][_0x19f521][_0x40ec('0x3e')],_0x40ec('0x8e'));}}}}}}catch(_0x4c724e){logger[_0x40ec('0x3a')](_0x40ec('0x8f'),_0x2b702b['uniqueid'],util[_0x40ec('0x26')](_0x4c724e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')][_0x40ec('0x18')]=function(_0x1c0909){var _0x851ee4='';try{if(this['isNotNull'](_0x1c0909)){logger[_0x40ec('0x24')](_0x40ec('0x90'),_0x1c0909[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x1c0909,{'showHidden':![],'depth':null}));if(_0x1c0909[_0x40ec('0x91')]){_0x851ee4=_0x1c0909[_0x40ec('0x91')][_0x40ec('0x92')](0x0,_0x1c0909[_0x40ec('0x91')][_0x40ec('0x93')]('-'));if(this[_0x40ec('0xd')][_0x851ee4]){logger['info'](_0x40ec('0x94'),_0x1c0909[_0x40ec('0x22')],_0x851ee4);this[_0x40ec('0xd')][_0x851ee4]['onhold']=!![];}}}}catch(_0x152920){logger['error'](_0x40ec('0x95'),_0x1c0909[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x152920,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x40ec('0x1a')]=function(_0x5157c6){var _0x5b1a63='';try{if(this[_0x40ec('0x1f')](_0x5157c6)){logger['debug'](_0x40ec('0x96'),_0x5157c6[_0x40ec('0x22')],util[_0x40ec('0x26')](_0x5157c6,{'showHidden':![],'depth':null}));if(_0x5157c6[_0x40ec('0x91')]){_0x5b1a63=_0x5157c6[_0x40ec('0x91')][_0x40ec('0x92')](0x0,_0x5157c6[_0x40ec('0x91')][_0x40ec('0x93')]('-'));if(this[_0x40ec('0xd')][_0x5b1a63]){logger['info'](_0x40ec('0x97'),_0x5157c6[_0x40ec('0x22')],_0x5b1a63);this[_0x40ec('0xd')][_0x5b1a63][_0x40ec('0x98')]=![];}}}}catch(_0x246765){logger[_0x40ec('0x3a')]('[%s][voiceAgentReport][musiconholdstop]',_0x5157c6['uniqueid'],util[_0x40ec('0x26')](_0x246765,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40ec('0x1e')]['deleteChannelAfterTimeout']=function(_0x2301dd,_0x4c9d1e=0x2710){if(this['channels'][_0x2301dd]){setTimeout(()=>{delete this[_0x40ec('0xa')][_0x2301dd];},_0x4c9d1e);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index a5fe31a..41b2ff6 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc402=['blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','uniqueid','linkedid','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','split','destconnectedlinenum','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','merge','lastapplication','lastdata','cdr(','isNil','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','transferType','then','getSettings','stopRecordingOnTransfer','resolve','StopMixMonitor','catch','Action','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','type','routeid','ATTENDED','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','newexten','syncNewExten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer'];(function(_0x23b5e3,_0x374475){var _0x4f947d=function(_0x38a206){while(--_0x38a206){_0x23b5e3['push'](_0x23b5e3['shift']());}};_0x4f947d(++_0x374475);}(_0xc402,0xa1));var _0x2c40=function(_0x51e55b,_0x3f5944){_0x51e55b=_0x51e55b-0x0;var _0x2566a4=_0xc402[_0x51e55b];return _0x2566a4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x2c40('0x0'));var path=require(_0x2c40('0x1'));var Redis=require('ioredis');var config=require(_0x2c40('0x2'));var logger=require(_0x2c40('0x3'))(_0x2c40('0x4'));var ami=require(_0x2c40('0x5'));var Channel=require(_0x2c40('0x6'));var RpcSetting=require(_0x2c40('0x7'));var applications=[_0x2c40('0x8'),_0x2c40('0x9'),_0x2c40('0xa'),_0x2c40('0xb'),_0x2c40('0xc'),'voicemail'];var dispositions=['NO\x20ANSWER','FAILED',_0x2c40('0xd'),_0x2c40('0xe'),'NO\x20ANSWER',_0x2c40('0xe'),_0x2c40('0xf'),_0x2c40('0x10'),_0x2c40('0xd'),_0x2c40('0xd'),_0x2c40('0xd')];config[_0x2c40('0x11')]=_[_0x2c40('0x12')](config['redis'],{'host':_0x2c40('0x13'),'port':0x18eb});var io=require(_0x2c40('0x14'))(new Redis(config[_0x2c40('0x11')]));function VoiceCallReport(_0x1b0821){this[_0x2c40('0x15')]=_0x1b0821[_0x2c40('0x15')];this[_0x2c40('0x16')]=_0x1b0821['agents'];this[_0x2c40('0x17')]={};ami['on'](_0x2c40('0x18'),this['syncNewExten']['bind'](this));ami['on'](_0x2c40('0x19'),this[_0x2c40('0x1a')]['bind'](this));ami['on'](_0x2c40('0x1b'),this[_0x2c40('0x1c')][_0x2c40('0x1d')](this));ami['on'](_0x2c40('0x1e'),this[_0x2c40('0x1f')]['bind'](this));ami['on'](_0x2c40('0x20'),this[_0x2c40('0x21')][_0x2c40('0x1d')](this));ami['on']('hangup',this[_0x2c40('0x22')][_0x2c40('0x1d')](this));ami['on'](_0x2c40('0x23'),this[_0x2c40('0x24')][_0x2c40('0x1d')](this));ami['on'](_0x2c40('0x25'),this['syncAttendedTransfer'][_0x2c40('0x1d')](this));ami['on'](_0x2c40('0x26'),this[_0x2c40('0x27')][_0x2c40('0x1d')](this));ami['on'](_0x2c40('0x28'),this[_0x2c40('0x29')][_0x2c40('0x1d')](this));ami['on'](_0x2c40('0x2a'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x2c40('0x2b')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x2c40('0x2c')]();}catch(_0x3e7edb){logger[_0x2c40('0x2d')](_0x2c40('0x2e'),util[_0x2c40('0x2f')](_0x3e7edb,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2c40('0x30')]['isNotNull']=function(_0x16444a){return _0x16444a!==null&&!_[_0x2c40('0x31')](_0x16444a);};VoiceCallReport['prototype']['emit']=function(_0x47f8b5,_0x4b7d84,_0x5abde3){io['to'](_0x47f8b5)[_0x2c40('0x32')](_0x4b7d84,_0x5abde3);};VoiceCallReport[_0x2c40('0x30')][_0x2c40('0x24')]=function(_0x5767c9){try{if(this[_0x2c40('0x33')](_0x5767c9)){logger[_0x2c40('0x2b')](_0x2c40('0x34'),_0x5767c9['uniqueid'],_0x5767c9[_0x2c40('0x35')],_0x5767c9['calleridnum']);logger[_0x2c40('0x36')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5767c9[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x5767c9,{'showHidden':![],'depth':null}));if(_0x5767c9[_0x2c40('0x37')]===_0x5767c9[_0x2c40('0x38')]){if(!_[_0x2c40('0x31')](this['channels'][_0x5767c9[_0x2c40('0x37')]])){_['merge'](this[_0x2c40('0x15')][_0x5767c9[_0x2c40('0x37')]],_[_0x2c40('0x39')](_0x5767c9,_[_0x2c40('0x3a')](this[_0x2c40('0x15')][_0x5767c9['uniqueid']])));}}if(_0x5767c9[_0x2c40('0x3b')]===_0x2c40('0x3c')){var _0xa2c3b9=this['agents'][_0x5767c9[_0x2c40('0x3d')]['split']('-')[0x0]];if(_0xa2c3b9){if(_0x5767c9[_0x2c40('0x3e')]==_0x2c40('0x3f')){_0xa2c3b9['destconnectedlinenum']=_0x5767c9[_0x2c40('0x40')];this[_0x2c40('0x32')](util[_0x2c40('0x41')](_0x2c40('0x42'),_0xa2c3b9[_0x2c40('0x43')]),_0x2c40('0x44'),{'id':_0xa2c3b9['id'],'destaccountcode':_0xa2c3b9['accountcode'],'destconnectedlinenum':_0x5767c9[_0x2c40('0x40')]});}}}}}catch(_0x35adfe){logger[_0x2c40('0x2d')](_0x2c40('0x45'),_0x5767c9[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x35adfe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c40('0x30')]['syncNewChannel']=function(_0x3c2da6){try{if(this[_0x2c40('0x33')](_0x3c2da6)){logger[_0x2c40('0x36')]('[%s][voiceCallReport][newchannel]\x20event:',_0x3c2da6['uniqueid'],util['inspect'](_0x3c2da6,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c2da6[_0x2c40('0x37')]]){return;}if(_0x3c2da6[_0x2c40('0x3d')]===_0x2c40('0x46')){return;}if(_0x3c2da6[_0x2c40('0x37')]!==_0x3c2da6[_0x2c40('0x38')]&&!this[_0x2c40('0x17')][_0x3c2da6['linkedid']]){return;}logger[_0x2c40('0x2b')](_0x2c40('0x47'),_0x3c2da6[_0x2c40('0x37')],_0x3c2da6[_0x2c40('0x3b')],_0x3c2da6[_0x2c40('0x3e')]);this[_0x2c40('0x15')][_0x3c2da6[_0x2c40('0x37')]]=new Channel();this[_0x2c40('0x15')][_0x3c2da6[_0x2c40('0x37')]][_0x2c40('0x48')]=moment()[_0x2c40('0x41')](_0x2c40('0x49'));this['channels'][_0x3c2da6['uniqueid']][_0x2c40('0x4a')]=dispositions[_[_0x2c40('0x4b')](_0x3c2da6[_0x2c40('0x4c')])];_['merge'](this[_0x2c40('0x15')][_0x3c2da6['uniqueid']],_[_0x2c40('0x39')](_0x3c2da6,_[_0x2c40('0x3a')](this[_0x2c40('0x15')][_0x3c2da6[_0x2c40('0x37')]])));if(_0x3c2da6[_0x2c40('0x3b')]===_0x2c40('0x3c')){var _0x3a2510=this[_0x2c40('0x16')][_0x3c2da6[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]];if(_0x3a2510&&typeof _0x3a2510[_0x2c40('0x4e')]===_0x2c40('0x4f')){_0x3a2510[_0x2c40('0x4e')]=_0x3c2da6[_0x2c40('0x3e')];logger[_0x2c40('0x36')](_0x2c40('0x50'),_0x3c2da6[_0x2c40('0x37')],util[_0x2c40('0x2f')]({'id':_0x3a2510['id'],'destaccountcode':_0x3a2510['accountcode'],'destconnectedlinenum':_0x3c2da6['exten']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x2c40('0x42'),_0x3a2510['name']),_0x2c40('0x44'),{'id':_0x3a2510['id'],'destaccountcode':_0x3a2510[_0x2c40('0x51')],'destconnectedlinenum':_0x3c2da6['exten']});}}}}catch(_0x3fd384){logger['error'](_0x2c40('0x52'),_0x3c2da6[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x3fd384,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c40('0x30')][_0x2c40('0x1a')]=function(_0x55e1ef){try{if(this[_0x2c40('0x33')](_0x55e1ef)){logger[_0x2c40('0x36')](_0x2c40('0x53'),_0x55e1ef['uniqueid'],util[_0x2c40('0x2f')](_0x55e1ef,{'showHidden':![],'depth':null}));if(_0x55e1ef['channel']===_0x2c40('0x46')||_0x55e1ef[_0x2c40('0x3e')]==='h')return;if(_0x55e1ef[_0x2c40('0x37')]===_0x55e1ef[_0x2c40('0x38')]||this[_0x2c40('0x17')][_0x55e1ef[_0x2c40('0x38')]]){_0x55e1ef[_0x2c40('0x54')]=_0x55e1ef[_0x2c40('0x54')]?_0x55e1ef[_0x2c40('0x54')][_0x2c40('0x55')]():undefined;_0x55e1ef[_0x2c40('0x56')]=_0x55e1ef[_0x2c40('0x57')]||_0x55e1ef[_0x2c40('0x56')];if(_0x55e1ef[_0x2c40('0x57')]&&_0x55e1ef['application']!==_0x2c40('0x9')){_0x55e1ef['applicationdata']=_0x55e1ef[_0x2c40('0x56')][_0x2c40('0x55')]();}logger[_0x2c40('0x2b')](_0x2c40('0x58'),_0x55e1ef[_0x2c40('0x37')],_0x55e1ef['application'],_0x55e1ef['applicationdata']);if(_[_0x2c40('0x31')](this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]])){this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]]=new Channel();this['channels'][_0x55e1ef[_0x2c40('0x37')]][_0x2c40('0x48')]=_0x55e1ef[_0x2c40('0x59')]?moment()[_0x2c40('0x5a')](moment[_0x2c40('0x59')](_0x55e1ef[_0x2c40('0x59')])['seconds'](),_0x2c40('0x5b'))[_0x2c40('0x41')](_0x2c40('0x49')):moment()[_0x2c40('0x41')](_0x2c40('0x49'));this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]]['disposition']='NO\x20ANSWER';}_[_0x2c40('0x5c')](this['channels'][_0x55e1ef[_0x2c40('0x37')]],_[_0x2c40('0x39')](_0x55e1ef,_[_0x2c40('0x3a')](this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]])));if(_['includes'](applications,_0x55e1ef['application'])){this[_0x2c40('0x15')][_0x55e1ef['uniqueid']][_0x2c40('0x5d')]=_0x55e1ef[_0x2c40('0x54')];this['channels'][_0x55e1ef['uniqueid']][_0x2c40('0x5e')]=_0x55e1ef[_0x2c40('0x56')];if(_0x55e1ef[_0x2c40('0x54')]===_0x2c40('0x8')&&_['startsWith'](_0x55e1ef[_0x2c40('0x56')][_0x2c40('0x55')](),_0x2c40('0x5f'))){var _0x38de29=_0x55e1ef[_0x2c40('0x56')]['split']('=');var _0x42ee5e=_0x38de29[0x0][_0x2c40('0x55')]()['match'](/cdr\((.*)\)/);if(_0x42ee5e){if(_0x42ee5e[0x1]==='type'&&!_[_0x2c40('0x60')](this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]][_0x42ee5e[0x1]]))return;this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]][_0x42ee5e[0x1]]=_0x38de29[0x1];}}else if(_0x55e1ef['application']===_0x2c40('0x9')){this[_0x2c40('0x15')][_0x55e1ef[_0x2c40('0x37')]][_0x2c40('0x9')]=_0x55e1ef['applicationdata'][_0x2c40('0x4d')](',')[0x0];}}}}}catch(_0x59b6b9){logger[_0x2c40('0x2d')]('[%s][voiceCallReport][newexten]',_0x55e1ef[_0x2c40('0x37')],util['inspect'](_0x59b6b9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2c40('0x1f')]=function(_0x619c1e){try{if(this['isNotNull'](_0x619c1e)){logger[_0x2c40('0x2b')](_0x2c40('0x61'),_0x619c1e[_0x2c40('0x37')],_0x619c1e[_0x2c40('0x38')],_0x619c1e[_0x2c40('0x35')],_0x619c1e[_0x2c40('0x62')]);logger[_0x2c40('0x36')](_0x2c40('0x63'),_0x619c1e[_0x2c40('0x37')],util['inspect'](_0x619c1e,{'showHidden':![],'depth':null}));if(_0x619c1e['channelstate']!=='6')return;var _0x35c920=this['agents'][_0x619c1e[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]];if(_0x619c1e[_0x2c40('0x37')]!==_0x619c1e[_0x2c40('0x38')]){var _0xabf27b=moment();if(this['channels'][_0x619c1e[_0x2c40('0x38')]]){if(!this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x64')]){this['channels'][_0x619c1e['linkedid']][_0x2c40('0x64')]=!![];this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x65')]=_0xabf27b[_0x2c40('0x41')](_0x2c40('0x49'));if(this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x48')]){this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x66')]=_0xabf27b[_0x2c40('0x67')](this['channels'][_0x619c1e['linkedid']][_0x2c40('0x48')],_0x2c40('0x5b'));}}this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]]['linkedid']=_0x619c1e[_0x2c40('0x37')];if(_0x619c1e[_0x2c40('0x62')]!==_0x2c40('0x3f')){this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x40')]=_0x619c1e[_0x2c40('0x62')];}this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x68')]=_0x619c1e[_0x2c40('0x35')];this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x69')]=_0x619c1e[_0x2c40('0x3d')];this[_0x2c40('0x15')][_0x619c1e['linkedid']]['disposition']=dispositions[_['toNumber'](_0x619c1e[_0x2c40('0x4c')])];if(_0x35c920){this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]]['UserId']=_0x35c920['id'];this['channels'][_0x619c1e['linkedid']][_0x2c40('0x6a')]=_0x35c920[_0x2c40('0x43')];}}if(this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]){if(!this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]['answered']){this[_0x2c40('0x15')][_0x619c1e['uniqueid']]['answered']=!![];this[_0x2c40('0x15')][_0x619c1e['uniqueid']]['answertime']=_0xabf27b[_0x2c40('0x41')](_0x2c40('0x49'));if(this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]['starttime']){this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]['holdtime']=_0xabf27b['diff'](this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]][_0x2c40('0x48')],_0x2c40('0x5b'));}}if(_0x619c1e['calleridnum']!==_0x2c40('0x3f')){this[_0x2c40('0x15')][_0x619c1e['uniqueid']]['connectedlinenum']=_0x619c1e['calleridnum'];}this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]][_0x2c40('0x68')]=_0x619c1e[_0x2c40('0x35')];this['channels'][_0x619c1e[_0x2c40('0x37')]][_0x2c40('0x69')]=_0x619c1e[_0x2c40('0x3d')];this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]][_0x2c40('0x4a')]=dispositions[_[_0x2c40('0x4b')](_0x619c1e[_0x2c40('0x4c')])];}}else{if(this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]){if(_0x35c920){this['channels'][_0x619c1e['uniqueid']]['UserId']=_0x35c920['id'];this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]][_0x2c40('0x6a')]=_0x35c920[_0x2c40('0x43')];}}}if(_0x619c1e[_0x2c40('0x3b')]===_0x2c40('0x3c')){if(_0x35c920){_0x35c920['destconnectedlinenum']=_0x619c1e[_0x2c40('0x3e')];var _0x3289e6;if(this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]){_0x3289e6=this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x37')]]['queue'];}else if(this[_0x2c40('0x15')][_0x619c1e[_0x2c40('0x38')]]){_0x3289e6=this['channels'][_0x619c1e[_0x2c40('0x38')]][_0x2c40('0x9')];}_0x35c920[_0x2c40('0x9')]=_0x3289e6;var _0xa8d77b={'id':_0x35c920['id'],'name':_0x35c920['name'],'agentconnected':!![],'destaccountcode':_0x35c920[_0x2c40('0x51')],'destconnectedlinenum':_0x619c1e[_0x2c40('0x3e')],'queue':_0x3289e6||undefined,'uniqueid':_0x619c1e[_0x2c40('0x38')]};logger[_0x2c40('0x36')](_0x2c40('0x6b'),_0x619c1e[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0xa8d77b,{'showHidden':![],'depth':null}));this[_0x2c40('0x32')](util['format'](_0x2c40('0x42'),_0x35c920[_0x2c40('0x43')]),_0x2c40('0x44'),_0xa8d77b);}}}}catch(_0x37538b){logger[_0x2c40('0x2d')](_0x2c40('0x6c'),_0x619c1e[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x37538b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c40('0x30')][_0x2c40('0x6d')]=function(_0x32894b,_0x39237e){try{if(this['channels'][_0x32894b]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x32894b,_0x39237e);this[_0x2c40('0x15')][_0x32894b][_0x2c40('0x6e')]=!![];if(_['endsWith'](_0x39237e,_0x2c40('0x6f'))){_0x39237e=_0x39237e[_0x2c40('0x70')](_0x2c40('0x6f'),_0x2c40('0x71'));}this[_0x2c40('0x15')][_0x32894b][_0x2c40('0x72')]=_0x39237e;var _0x1abe6e=_[_0x2c40('0x73')](this[_0x2c40('0x15')][_0x32894b]['monitors'],{'filename':_0x39237e});if(_[_0x2c40('0x60')](_0x1abe6e)){this[_0x2c40('0x15')][_0x32894b][_0x2c40('0x74')][_0x2c40('0x75')]({'filename':_0x39237e,'createdAt':moment()[_0x2c40('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x2c40('0x76')});}}}catch(_0x302e24){logger[_0x2c40('0x2d')](_0x2c40('0x77'),_0x32894b,util[_0x2c40('0x2f')](_0x302e24,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2c40('0x21')]=function(_0x912306){try{if(this['isNotNull'](_0x912306)){logger[_0x2c40('0x36')](_0x2c40('0x78'),_0x912306[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x912306,{'showHidden':![],'depth':null}));if(this['channels'][_0x912306[_0x2c40('0x37')]]&&_0x912306[_0x2c40('0x3d')]!=_0x2c40('0x46')){if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')])){if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x7a')])){logger[_0x2c40('0x2b')](_0x2c40('0x7b'),_0x912306['uniqueid'],_0x912306[_0x2c40('0x7c')]);this[_0x2c40('0x6d')](_0x912306['uniqueid'],_0x912306['value']);}else if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x7d')])){logger[_0x2c40('0x2b')](_0x2c40('0x7e'),_0x912306[_0x2c40('0x37')],_0x912306[_0x2c40('0x7c')]);this[_0x2c40('0x15')][_0x912306[_0x2c40('0x37')]][_0x2c40('0x62')]=_0x912306[_0x2c40('0x7c')];}else if(this[_0x2c40('0x33')](_0x912306['variable'][_0x2c40('0x7f')])){logger[_0x2c40('0x2b')](_0x2c40('0x80'),_0x912306[_0x2c40('0x37')],_0x912306['value']);this[_0x2c40('0x15')][_0x912306[_0x2c40('0x37')]][_0x2c40('0x81')]=_0x912306['value'];}else if(this['isNotNull'](_0x912306['variable'][_0x2c40('0x82')])){logger[_0x2c40('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x912306[_0x2c40('0x37')],_0x912306[_0x2c40('0x7c')]);this[_0x2c40('0x15')][_0x912306[_0x2c40('0x37')]]['type']=_0x912306[_0x2c40('0x7c')];}else if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x83')])){logger[_0x2c40('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x912306['uniqueid'],_0x912306[_0x2c40('0x7c')][_0x2c40('0x4d')](',')[0x0]);this['channels'][_0x912306['uniqueid']][_0x2c40('0x9')]=_0x912306['value'][_0x2c40('0x4d')](',')[0x0];}else if(this['isNotNull'](_0x912306[_0x2c40('0x79')][_0x2c40('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x912306[_0x2c40('0x37')],_0x912306[_0x2c40('0x7c')]);this['channels'][_0x912306[_0x2c40('0x37')]]['originatecalleridnum']=_0x912306[_0x2c40('0x7c')];}else if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x85')])){logger[_0x2c40('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x912306[_0x2c40('0x37')],_0x912306[_0x2c40('0x7c')]);this['channels'][_0x912306['uniqueid']]['destination']=_0x912306[_0x2c40('0x7c')];}else if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x86')])){logger[_0x2c40('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x912306['uniqueid'],_0x912306['value']);this[_0x2c40('0x15')][_0x912306[_0x2c40('0x37')]][_0x2c40('0x87')]=_0x912306['value'];}else if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x88')])){logger[_0x2c40('0x2b')](_0x2c40('0x89'),_0x912306[_0x2c40('0x37')],_0x912306[_0x2c40('0x7c')]);this[_0x2c40('0x15')][_0x912306[_0x2c40('0x37')]][_0x2c40('0x9')]=_0x912306[_0x2c40('0x7c')];}else if(this['isNotNull'](_0x912306[_0x2c40('0x79')][_0x2c40('0x8a')])){logger[_0x2c40('0x2b')](_0x2c40('0x8b'),_0x912306[_0x2c40('0x37')],_0x912306[_0x2c40('0x7c')]);this[_0x2c40('0x15')][_0x912306[_0x2c40('0x37')]][_0x2c40('0x8c')]=_0x912306[_0x2c40('0x7c')];}}}else if(this['isNotNull'](_0x912306[_0x2c40('0x79')][_0x2c40('0x7a')])){if(_0x912306['value']){var _0x302072=path[_0x2c40('0x8d')](_0x912306[_0x2c40('0x7c')])[_0x2c40('0x43')];logger[_0x2c40('0x2b')](_0x2c40('0x7b'),_0x302072,_0x912306[_0x2c40('0x7c')]);this[_0x2c40('0x6d')](_0x302072,_0x912306[_0x2c40('0x7c')]);}}else if(this[_0x2c40('0x15')][_0x912306[_0x2c40('0x38')]]){if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')])){if(this[_0x2c40('0x33')](_0x912306[_0x2c40('0x79')][_0x2c40('0x8a')])){logger[_0x2c40('0x2b')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x912306[_0x2c40('0x38')],_0x912306[_0x2c40('0x7c')]);this['channels'][_0x912306[_0x2c40('0x38')]][_0x2c40('0x8e')]=_0x912306[_0x2c40('0x7c')];}}}}}catch(_0x44bd4f){logger['error'](_0x2c40('0x8f'),_0x912306[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x44bd4f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2c40('0x22')]=function(_0x144803){try{if(this[_0x2c40('0x33')](_0x144803)){logger['debug'](_0x2c40('0x90'),_0x144803[_0x2c40('0x37')],util[_0x2c40('0x2f')](_0x144803,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x144803['linkedid']]){if(this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]]['linkedid']]){this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x38')]][_0x2c40('0x37')]=_0x144803[_0x2c40('0x37')];this[_0x2c40('0x15')][this['blindTransfers'][_0x144803['linkedid']][_0x2c40('0x38')]]['answered']=this['channels'][_0x144803[_0x2c40('0x37')]]['answered'];this[_0x2c40('0x15')][this['blindTransfers'][_0x144803[_0x2c40('0x38')]]['linkedid']][_0x2c40('0x65')]=this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]][_0x2c40('0x65')];this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x38')]][_0x2c40('0x69')]=this['channels'][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]]['linkedid']]['channel'];this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]]['linkedid']][_0x2c40('0x4a')]=this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]['disposition'];this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]=this['channels'][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x38')]];this[_0x2c40('0x91')](this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x38')]);}else if(this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803['linkedid']][_0x2c40('0x37')]]){this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]]['uniqueid']=[this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803['linkedid']]['uniqueid']][_0x2c40('0x38')],this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]][_0x2c40('0x38')]=this[_0x2c40('0x15')][this['blindTransfers'][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]]['uniqueid']][0x0];this['channels'][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]]['answered']=this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]['answered'];this[_0x2c40('0x15')][this['blindTransfers'][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]]['answertime']=this['channels'][_0x144803[_0x2c40('0x37')]][_0x2c40('0x65')];this['channels'][this['blindTransfers'][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]]['destinationchannel']=this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803['linkedid']][_0x2c40('0x37')]]['channel'];this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]][_0x2c40('0x4a')]=this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]][_0x2c40('0x4a')];this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]=this[_0x2c40('0x15')][this[_0x2c40('0x17')][_0x144803[_0x2c40('0x38')]][_0x2c40('0x37')]];this[_0x2c40('0x91')](this[_0x2c40('0x17')][_0x144803['linkedid']][_0x2c40('0x37')]);}}if(this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]){logger[_0x2c40('0x2b')](_0x2c40('0x92'),_0x144803[_0x2c40('0x37')],_0x144803[_0x2c40('0x93')]);var _0x191a19=moment();this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]['endtime']=_0x191a19[_0x2c40('0x41')](_0x2c40('0x49'));this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]['duration']=_0x191a19['diff'](this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]][_0x2c40('0x48')],'seconds');if(this['channels'][_0x144803[_0x2c40('0x37')]][_0x2c40('0x64')]){this['channels'][_0x144803['uniqueid']][_0x2c40('0x94')]=_0x191a19[_0x2c40('0x67')](this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]['answertime'],_0x2c40('0x5b'));this['channels'][_0x144803[_0x2c40('0x37')]][_0x2c40('0x66')]=this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]]['duration']-this[_0x2c40('0x15')][_0x144803[_0x2c40('0x37')]][_0x2c40('0x94')];}if(_0x144803[_0x2c40('0x3b')]==='from-sip'){if(this['agents'][_0x144803['channel'][_0x2c40('0x4d')]('-')[0x0]]){this[_0x2c40('0x16')][_0x144803['channel'][_0x2c40('0x4d')]('-')[0x0]]=_[_0x2c40('0x95')](this[_0x2c40('0x16')][_0x144803[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]],[_0x2c40('0x4e')]);logger[_0x2c40('0x36')](_0x2c40('0x96'),_0x144803[_0x2c40('0x37')],util['inspect']({'id':this['agents'][_0x144803[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]]['id'],'destaccountcode':this[_0x2c40('0x16')][_0x144803[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x2c40('0x32')](util[_0x2c40('0x41')](_0x2c40('0x42'),this['agents'][_0x144803[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]][_0x2c40('0x43')]),'user:agentcomplete',{'id':this[_0x2c40('0x16')][_0x144803['channel'][_0x2c40('0x4d')]('-')[0x0]]['id'],'destaccountcode':this[_0x2c40('0x16')][_0x144803[_0x2c40('0x3d')][_0x2c40('0x4d')]('-')[0x0]][_0x2c40('0x51')]});for(var _0x1af43f=0x0;_0x1af43f{delete this[_0x2c40('0x15')][_0x1ad0a3];},_0x695d89);}};module[_0x2c40('0xc6')]=VoiceCallReport; \ No newline at end of file +var _0x43a2=['variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','user:agentcomplete','length','transferType','resolve','transferToInternal','isEmpty','getSettings','then','Action','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','util','path','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','defaults','redis','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','isUndefined','prototype','isNotNull','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','emit','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','error','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','connectedlinename','destinationchannel','UserId','membername','diff','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x43a2,0x10d));var _0x243a=function(_0xd64d61,_0x4b7a03){_0xd64d61=_0xd64d61-0x0;var _0x37dd18=_0x43a2[_0xd64d61];return _0x37dd18;};'use strict';var _=require(_0x243a('0x0'));var moment=require('moment');var util=require(_0x243a('0x1'));var path=require(_0x243a('0x2'));var Redis=require('ioredis');var config=require(_0x243a('0x3'));var logger=require(_0x243a('0x4'))(_0x243a('0x5'));var ami=require(_0x243a('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x243a('0x7'));var applications=[_0x243a('0x8'),_0x243a('0x9'),'agi',_0x243a('0xa'),_0x243a('0xb'),_0x243a('0xc')];var dispositions=[_0x243a('0xd'),_0x243a('0xe'),_0x243a('0xe'),_0x243a('0xd'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED','BUSY',_0x243a('0xe'),_0x243a('0xe'),'FAILED'];config['redis']=_[_0x243a('0xf')](config[_0x243a('0x10')],{'host':'localhost','port':0x18eb});var io=require(_0x243a('0x11'))(new Redis(config[_0x243a('0x10')]));function VoiceCallReport(_0x3e642d){this[_0x243a('0x12')]=_0x3e642d['channels'];this['agents']=_0x3e642d[_0x243a('0x13')];this[_0x243a('0x14')]={};ami['on'](_0x243a('0x15'),this[_0x243a('0x16')][_0x243a('0x17')](this));ami['on']('newexten',this[_0x243a('0x16')]['bind'](this));ami['on'](_0x243a('0x18'),this[_0x243a('0x19')][_0x243a('0x17')](this));ami['on'](_0x243a('0x1a'),this['syncNewState'][_0x243a('0x17')](this));ami['on'](_0x243a('0x1b'),this[_0x243a('0x1c')][_0x243a('0x17')](this));ami['on']('hangup',this[_0x243a('0x1d')][_0x243a('0x17')](this));ami['on'](_0x243a('0x1e'),this[_0x243a('0x1f')][_0x243a('0x17')](this));ami['on'](_0x243a('0x20'),this['syncAttendedTransfer'][_0x243a('0x17')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this[_0x243a('0x21')][_0x243a('0x17')](this));ami['on'](_0x243a('0x22'),this[_0x243a('0x23')][_0x243a('0x17')](this));try{logger[_0x243a('0x24')](_0x243a('0x25'));ami[_0x243a('0x26')]();}catch(_0x37035a){logger['error'](_0x243a('0x27'),util[_0x243a('0x28')](_0x37035a,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x4f14de){return _0x4f14de!==null&&!_[_0x243a('0x29')](_0x4f14de);};VoiceCallReport[_0x243a('0x2a')]['emit']=function(_0x57e49d,_0x9e8ccc,_0x481f25){io['to'](_0x57e49d)['emit'](_0x9e8ccc,_0x481f25);};VoiceCallReport[_0x243a('0x2a')][_0x243a('0x1f')]=function(_0x503bb6){try{if(this[_0x243a('0x2b')](_0x503bb6)){logger[_0x243a('0x24')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x503bb6[_0x243a('0x2c')],_0x503bb6[_0x243a('0x2d')],_0x503bb6[_0x243a('0x2e')]);logger[_0x243a('0x2f')](_0x243a('0x30'),_0x503bb6[_0x243a('0x2c')],util[_0x243a('0x28')](_0x503bb6,{'showHidden':![],'depth':null}));if(_0x503bb6[_0x243a('0x2c')]===_0x503bb6[_0x243a('0x31')]){if(!_[_0x243a('0x29')](this[_0x243a('0x12')][_0x503bb6['uniqueid']])){_[_0x243a('0x32')](this[_0x243a('0x12')][_0x503bb6[_0x243a('0x2c')]],_[_0x243a('0x33')](_0x503bb6,_['keys'](this[_0x243a('0x12')][_0x503bb6[_0x243a('0x2c')]])));}}if(_0x503bb6[_0x243a('0x34')]==='from-sip'){var _0x1e3c91=this[_0x243a('0x13')][_0x503bb6[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]];if(_0x1e3c91){if(_0x503bb6[_0x243a('0x37')]==_0x243a('0x38')){_0x1e3c91[_0x243a('0x39')]=_0x503bb6[_0x243a('0x3a')];this[_0x243a('0x3b')](util[_0x243a('0x3c')](_0x243a('0x3d'),_0x1e3c91[_0x243a('0x3e')]),_0x243a('0x3f'),{'id':_0x1e3c91['id'],'destaccountcode':_0x1e3c91[_0x243a('0x40')],'destconnectedlinenum':_0x503bb6[_0x243a('0x3a')]});}}}}}catch(_0x5d9fd5){logger['error'](_0x243a('0x41'),_0x503bb6[_0x243a('0x2c')],util[_0x243a('0x28')](_0x5d9fd5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x243a('0x2a')][_0x243a('0x19')]=function(_0x593412){try{if(this[_0x243a('0x2b')](_0x593412)){logger[_0x243a('0x2f')](_0x243a('0x42'),_0x593412[_0x243a('0x2c')],util[_0x243a('0x28')](_0x593412,{'showHidden':![],'depth':null}));if(this[_0x243a('0x12')][_0x593412['uniqueid']]){return;}if(_0x593412[_0x243a('0x35')]===_0x243a('0x43')){return;}if(_0x593412['uniqueid']!==_0x593412[_0x243a('0x31')]&&!this['blindTransfers'][_0x593412[_0x243a('0x31')]]){return;}logger['info'](_0x243a('0x44'),_0x593412['uniqueid'],_0x593412[_0x243a('0x34')],_0x593412[_0x243a('0x37')]);this[_0x243a('0x12')][_0x593412[_0x243a('0x2c')]]=new Channel();this[_0x243a('0x12')][_0x593412['uniqueid']][_0x243a('0x45')]=moment()[_0x243a('0x3c')](_0x243a('0x46'));this['channels'][_0x593412['uniqueid']][_0x243a('0x47')]=dispositions[_[_0x243a('0x48')](_0x593412[_0x243a('0x49')])];_[_0x243a('0x32')](this[_0x243a('0x12')][_0x593412[_0x243a('0x2c')]],_[_0x243a('0x33')](_0x593412,_[_0x243a('0x4a')](this[_0x243a('0x12')][_0x593412[_0x243a('0x2c')]])));if(_0x593412['context']==='from-sip'){var _0x4e5a88=this[_0x243a('0x13')][_0x593412[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]];if(_0x4e5a88&&typeof _0x4e5a88[_0x243a('0x39')]==='undefined'){_0x4e5a88['destconnectedlinenum']=_0x593412['exten'];logger[_0x243a('0x2f')](_0x243a('0x4b'),_0x593412[_0x243a('0x2c')],util[_0x243a('0x28')]({'id':_0x4e5a88['id'],'destaccountcode':_0x4e5a88['accountcode'],'destconnectedlinenum':_0x593412[_0x243a('0x37')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x243a('0x3d'),_0x4e5a88[_0x243a('0x3e')]),_0x243a('0x3f'),{'id':_0x4e5a88['id'],'destaccountcode':_0x4e5a88[_0x243a('0x40')],'destconnectedlinenum':_0x593412[_0x243a('0x37')]});}}}}catch(_0x4a12cd){logger['error'](_0x243a('0x4c'),_0x593412['uniqueid'],util[_0x243a('0x28')](_0x4a12cd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x243a('0x2a')][_0x243a('0x16')]=function(_0x374bb7){try{if(this[_0x243a('0x2b')](_0x374bb7)){logger[_0x243a('0x2f')](_0x243a('0x4d'),_0x374bb7[_0x243a('0x2c')],util[_0x243a('0x28')](_0x374bb7,{'showHidden':![],'depth':null}));if(_0x374bb7[_0x243a('0x35')]===_0x243a('0x43')||_0x374bb7[_0x243a('0x37')]==='h')return;if(_0x374bb7[_0x243a('0x2c')]===_0x374bb7['linkedid']||this[_0x243a('0x14')][_0x374bb7[_0x243a('0x31')]]){_0x374bb7[_0x243a('0x4e')]=_0x374bb7[_0x243a('0x4e')]?_0x374bb7[_0x243a('0x4e')][_0x243a('0x4f')]():undefined;_0x374bb7[_0x243a('0x50')]=_0x374bb7['appdata']||_0x374bb7[_0x243a('0x50')];if(_0x374bb7['appdata']&&_0x374bb7['application']!=='queue'){_0x374bb7[_0x243a('0x50')]=_0x374bb7['applicationdata'][_0x243a('0x4f')]();}logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x374bb7[_0x243a('0x2c')],_0x374bb7[_0x243a('0x4e')],_0x374bb7[_0x243a('0x50')]);if(_[_0x243a('0x29')](this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]])){this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]]=new Channel();this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]][_0x243a('0x45')]=_0x374bb7[_0x243a('0x51')]?moment()[_0x243a('0x52')](moment['duration'](_0x374bb7[_0x243a('0x51')])[_0x243a('0x53')](),_0x243a('0x53'))[_0x243a('0x3c')](_0x243a('0x46')):moment()[_0x243a('0x3c')](_0x243a('0x46'));this['channels'][_0x374bb7[_0x243a('0x2c')]][_0x243a('0x47')]='NO\x20ANSWER';}_[_0x243a('0x32')](this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]],_[_0x243a('0x33')](_0x374bb7,_[_0x243a('0x4a')](this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]])));if(_[_0x243a('0x54')](applications,_0x374bb7[_0x243a('0x4e')])){this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]][_0x243a('0x55')]=_0x374bb7[_0x243a('0x4e')];this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]][_0x243a('0x56')]=_0x374bb7[_0x243a('0x50')];if(_0x374bb7[_0x243a('0x4e')]===_0x243a('0x8')&&_[_0x243a('0x57')](_0x374bb7[_0x243a('0x50')]['toLowerCase'](),_0x243a('0x58'))){var _0x2e7aeb=_0x374bb7[_0x243a('0x50')][_0x243a('0x36')]('=');var _0x11add4=_0x2e7aeb[0x0][_0x243a('0x4f')]()[_0x243a('0x59')](/cdr\((.*)\)/);if(_0x11add4){if(_0x11add4[0x1]===_0x243a('0x5a')&&!_[_0x243a('0x5b')](this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]][_0x11add4[0x1]]))return;this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]][_0x11add4[0x1]]=_0x2e7aeb[0x1];}}else if(_0x374bb7['application']==='queue'){this[_0x243a('0x12')][_0x374bb7[_0x243a('0x2c')]][_0x243a('0x9')]=_0x374bb7['applicationdata'][_0x243a('0x36')](',')[0x0];}}}}}catch(_0x1e045a){logger[_0x243a('0x5c')](_0x243a('0x5d'),_0x374bb7[_0x243a('0x2c')],util[_0x243a('0x28')](_0x1e045a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x243a('0x2a')][_0x243a('0x5e')]=function(_0x35cf69){try{if(this[_0x243a('0x2b')](_0x35cf69)){logger[_0x243a('0x24')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x35cf69[_0x243a('0x2c')],_0x35cf69[_0x243a('0x31')],_0x35cf69[_0x243a('0x2d')],_0x35cf69[_0x243a('0x2e')]);logger['debug'](_0x243a('0x5f'),_0x35cf69['uniqueid'],util[_0x243a('0x28')](_0x35cf69,{'showHidden':![],'depth':null}));if(_0x35cf69[_0x243a('0x49')]!=='6')return;var _0x26dd63=this[_0x243a('0x13')][_0x35cf69[_0x243a('0x35')]['split']('-')[0x0]];if(_0x35cf69['uniqueid']!==_0x35cf69[_0x243a('0x31')]){var _0x100456=moment();if(this['channels'][_0x35cf69[_0x243a('0x31')]]){if(!this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]]['answered']){this['channels'][_0x35cf69[_0x243a('0x31')]][_0x243a('0x60')]=!![];this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]][_0x243a('0x61')]=_0x100456[_0x243a('0x3c')](_0x243a('0x46'));if(this['channels'][_0x35cf69[_0x243a('0x31')]][_0x243a('0x45')]){this[_0x243a('0x12')][_0x35cf69['linkedid']][_0x243a('0x62')]=_0x100456['diff'](this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]]['starttime'],_0x243a('0x53'));}}this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]]['linkedid']=_0x35cf69['uniqueid'];if(_0x35cf69['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x35cf69['linkedid']][_0x243a('0x3a')]=_0x35cf69[_0x243a('0x2e')];}this[_0x243a('0x12')][_0x35cf69['linkedid']][_0x243a('0x63')]=_0x35cf69[_0x243a('0x2d')];this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]][_0x243a('0x64')]=_0x35cf69[_0x243a('0x35')];this[_0x243a('0x12')][_0x35cf69['linkedid']][_0x243a('0x47')]=dispositions[_[_0x243a('0x48')](_0x35cf69['channelstate'])];if(_0x26dd63){this['channels'][_0x35cf69['linkedid']][_0x243a('0x65')]=_0x26dd63['id'];this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]][_0x243a('0x66')]=_0x26dd63[_0x243a('0x3e')];}}if(this['channels'][_0x35cf69[_0x243a('0x2c')]]){if(!this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]][_0x243a('0x60')]){this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]][_0x243a('0x60')]=!![];this[_0x243a('0x12')][_0x35cf69['uniqueid']][_0x243a('0x61')]=_0x100456[_0x243a('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]][_0x243a('0x45')]){this[_0x243a('0x12')][_0x35cf69['uniqueid']]['holdtime']=_0x100456[_0x243a('0x67')](this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]][_0x243a('0x45')],'seconds');}}if(_0x35cf69[_0x243a('0x2e')]!==_0x243a('0x38')){this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]]['connectedlinenum']=_0x35cf69[_0x243a('0x2e')];}this[_0x243a('0x12')][_0x35cf69['uniqueid']]['connectedlinename']=_0x35cf69[_0x243a('0x2d')];this[_0x243a('0x12')][_0x35cf69['uniqueid']]['destinationchannel']=_0x35cf69['channel'];this[_0x243a('0x12')][_0x35cf69['uniqueid']][_0x243a('0x47')]=dispositions[_[_0x243a('0x48')](_0x35cf69[_0x243a('0x49')])];}}else{if(this[_0x243a('0x12')][_0x35cf69['uniqueid']]){if(_0x26dd63){this[_0x243a('0x12')][_0x35cf69['uniqueid']][_0x243a('0x65')]=_0x26dd63['id'];this[_0x243a('0x12')][_0x35cf69['uniqueid']][_0x243a('0x66')]=_0x26dd63[_0x243a('0x3e')];}}}if(_0x35cf69[_0x243a('0x34')]===_0x243a('0x68')){if(_0x26dd63){_0x26dd63[_0x243a('0x39')]=_0x35cf69[_0x243a('0x37')];var _0x373d10;if(this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]]){_0x373d10=this[_0x243a('0x12')][_0x35cf69[_0x243a('0x2c')]]['queue'];}else if(this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]]){_0x373d10=this[_0x243a('0x12')][_0x35cf69[_0x243a('0x31')]][_0x243a('0x9')];}_0x26dd63[_0x243a('0x9')]=_0x373d10;var _0x32a93b={'id':_0x26dd63['id'],'name':_0x26dd63[_0x243a('0x3e')],'agentconnected':!![],'destaccountcode':_0x26dd63['accountcode'],'destconnectedlinenum':_0x35cf69[_0x243a('0x37')],'queue':_0x373d10||undefined,'uniqueid':_0x35cf69[_0x243a('0x31')]};logger[_0x243a('0x2f')](_0x243a('0x69'),_0x35cf69[_0x243a('0x2c')],util['inspect'](_0x32a93b,{'showHidden':![],'depth':null}));this[_0x243a('0x3b')](util[_0x243a('0x3c')](_0x243a('0x3d'),_0x26dd63[_0x243a('0x3e')]),_0x243a('0x3f'),_0x32a93b);}}}}catch(_0x4ad609){logger['error'](_0x243a('0x6a'),_0x35cf69[_0x243a('0x2c')],util[_0x243a('0x28')](_0x4ad609,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x243a('0x2a')]['syncMixMonitorFilename']=function(_0x45f34c,_0xb060bb){try{if(this[_0x243a('0x12')][_0x45f34c]){logger[_0x243a('0x24')](_0x243a('0x6b'),_0x45f34c,_0xb060bb);this['channels'][_0x45f34c][_0x243a('0x6c')]=!![];if(_[_0x243a('0x6d')](_0xb060bb,'.wav49')){_0xb060bb=_0xb060bb['replace'](_0x243a('0x6e'),_0x243a('0x6f'));}this[_0x243a('0x12')][_0x45f34c][_0x243a('0x70')]=_0xb060bb;var _0x30c995=_[_0x243a('0x71')](this['channels'][_0x45f34c][_0x243a('0x72')],{'filename':_0xb060bb});if(_['isNil'](_0x30c995)){this[_0x243a('0x12')][_0x45f34c][_0x243a('0x72')][_0x243a('0x73')]({'filename':_0xb060bb,'createdAt':moment()[_0x243a('0x3c')](_0x243a('0x46')),'mixmonitorid':'','status':_0x243a('0x74')});}}}catch(_0x4d7d39){logger['error'](_0x243a('0x75'),_0x45f34c,util['inspect'](_0x4d7d39,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x243a('0x2a')][_0x243a('0x1c')]=function(_0x278750){try{if(this[_0x243a('0x2b')](_0x278750)){logger[_0x243a('0x2f')](_0x243a('0x76'),_0x278750['uniqueid'],util['inspect'](_0x278750,{'showHidden':![],'depth':null}));if(this[_0x243a('0x12')][_0x278750[_0x243a('0x2c')]]&&_0x278750['channel']!=_0x243a('0x43')){if(this[_0x243a('0x2b')](_0x278750['variable'])){if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')][_0x243a('0x78')])){logger[_0x243a('0x24')](_0x243a('0x79'),_0x278750['uniqueid'],_0x278750[_0x243a('0x7a')]);this[_0x243a('0x7b')](_0x278750[_0x243a('0x2c')],_0x278750[_0x243a('0x7a')]);}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')]['xmd-phone'])){logger[_0x243a('0x24')](_0x243a('0x7c'),_0x278750[_0x243a('0x2c')],_0x278750[_0x243a('0x7a')]);this['channels'][_0x278750[_0x243a('0x2c')]][_0x243a('0x2e')]=_0x278750[_0x243a('0x7a')];}else if(this[_0x243a('0x2b')](_0x278750['variable'][_0x243a('0x7d')])){logger[_0x243a('0x24')](_0x243a('0x7e'),_0x278750[_0x243a('0x2c')],_0x278750['value']);this[_0x243a('0x12')][_0x278750['uniqueid']]['callerid']=_0x278750[_0x243a('0x7a')];}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')]['xmd-cdrtype'])){logger['info'](_0x243a('0x7f'),_0x278750[_0x243a('0x2c')],_0x278750['value']);this['channels'][_0x278750['uniqueid']][_0x243a('0x5a')]=_0x278750[_0x243a('0x7a')];}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')][_0x243a('0x80')])){logger[_0x243a('0x24')](_0x243a('0x81'),_0x278750[_0x243a('0x2c')],_0x278750[_0x243a('0x7a')][_0x243a('0x36')](',')[0x0]);this[_0x243a('0x12')][_0x278750[_0x243a('0x2c')]]['queue']=_0x278750[_0x243a('0x7a')][_0x243a('0x36')](',')[0x0];}else if(this['isNotNull'](_0x278750[_0x243a('0x77')][_0x243a('0x82')])){logger['info'](_0x243a('0x83'),_0x278750['uniqueid'],_0x278750['value']);this[_0x243a('0x12')][_0x278750[_0x243a('0x2c')]][_0x243a('0x84')]=_0x278750[_0x243a('0x7a')];}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')][_0x243a('0x85')])){logger[_0x243a('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x278750[_0x243a('0x2c')],_0x278750[_0x243a('0x7a')]);this['channels'][_0x278750[_0x243a('0x2c')]][_0x243a('0x86')]=_0x278750[_0x243a('0x7a')];}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')]['xmd-callerid-preview'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x278750['uniqueid'],_0x278750[_0x243a('0x7a')]);this[_0x243a('0x12')][_0x278750[_0x243a('0x2c')]][_0x243a('0x87')]=_0x278750[_0x243a('0x7a')];}else if(this['isNotNull'](_0x278750[_0x243a('0x77')][_0x243a('0x88')])){logger['info'](_0x243a('0x89'),_0x278750[_0x243a('0x2c')],_0x278750[_0x243a('0x7a')]);this[_0x243a('0x12')][_0x278750['uniqueid']][_0x243a('0x9')]=_0x278750[_0x243a('0x7a')];}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')][_0x243a('0x8a')])){logger[_0x243a('0x24')](_0x243a('0x8b'),_0x278750[_0x243a('0x2c')],_0x278750[_0x243a('0x7a')]);this[_0x243a('0x12')][_0x278750[_0x243a('0x2c')]]['sipcalluniqueid']=_0x278750[_0x243a('0x7a')];}}}else if(this[_0x243a('0x2b')](_0x278750[_0x243a('0x77')][_0x243a('0x78')])){if(_0x278750[_0x243a('0x7a')]){var _0x42bb45=path['parse'](_0x278750[_0x243a('0x7a')])['name'];logger[_0x243a('0x24')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x42bb45,_0x278750[_0x243a('0x7a')]);this['syncMixMonitorFilename'](_0x42bb45,_0x278750[_0x243a('0x7a')]);}}else if(this['channels'][_0x278750[_0x243a('0x31')]]){if(this['isNotNull'](_0x278750[_0x243a('0x77')])){if(this['isNotNull'](_0x278750[_0x243a('0x77')][_0x243a('0x8a')])){logger[_0x243a('0x24')](_0x243a('0x8b'),_0x278750[_0x243a('0x31')],_0x278750['value']);this[_0x243a('0x12')][_0x278750[_0x243a('0x31')]]['sipcalllinkedid']=_0x278750[_0x243a('0x7a')];}}}}}catch(_0x3254b6){logger[_0x243a('0x5c')](_0x243a('0x8c'),_0x278750[_0x243a('0x2c')],util[_0x243a('0x28')](_0x3254b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x243a('0x2a')]['syncHangup']=function(_0xed5e7){try{if(this[_0x243a('0x2b')](_0xed5e7)){logger[_0x243a('0x2f')](_0x243a('0x8d'),_0xed5e7['uniqueid'],util[_0x243a('0x28')](_0xed5e7,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0xed5e7['linkedid']]){if(this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7['linkedid']][_0x243a('0x31')]]){this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]][_0x243a('0x2c')]=_0xed5e7[_0x243a('0x2c')];this['channels'][this['blindTransfers'][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]][_0x243a('0x60')]=this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x60')];this[_0x243a('0x12')][this['blindTransfers'][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]][_0x243a('0x61')]=this[_0x243a('0x12')][_0xed5e7['uniqueid']][_0x243a('0x61')];this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]][_0x243a('0x64')]=this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]][_0x243a('0x35')];this[_0x243a('0x12')][this['blindTransfers'][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]][_0x243a('0x47')]=this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]]['disposition'];this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]]=this['channels'][this[_0x243a('0x14')][_0xed5e7['linkedid']][_0x243a('0x31')]];this[_0x243a('0x8e')](this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x31')]);}else if(this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]]){this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]][_0x243a('0x2c')]=[this['channels'][this[_0x243a('0x14')][_0xed5e7['linkedid']][_0x243a('0x2c')]]['linkedid'],this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]][_0x243a('0x31')]=this['channels'][this['blindTransfers'][_0xed5e7['linkedid']]['uniqueid']]['uniqueid']][0x0];this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]][_0x243a('0x60')]=this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x60')];this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]][_0x243a('0x61')]=this[_0x243a('0x12')][_0xed5e7['uniqueid']][_0x243a('0x61')];this[_0x243a('0x12')][this['blindTransfers'][_0xed5e7['linkedid']]['uniqueid']][_0x243a('0x64')]=this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]][_0x243a('0x35')];this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]]['disposition']=this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x47')];this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]]=this[_0x243a('0x12')][this[_0x243a('0x14')][_0xed5e7[_0x243a('0x31')]][_0x243a('0x2c')]];this[_0x243a('0x8e')](this[_0x243a('0x14')][_0xed5e7['linkedid']][_0x243a('0x2c')]);}}if(this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]]){logger[_0x243a('0x24')](_0x243a('0x8f'),_0xed5e7[_0x243a('0x2c')],_0xed5e7[_0x243a('0x90')]);var _0x4958fa=moment();this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x91')]=_0x4958fa[_0x243a('0x3c')](_0x243a('0x46'));this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x51')]=_0x4958fa[_0x243a('0x67')](this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]]['starttime'],_0x243a('0x53'));if(this['channels'][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x60')]){this['channels'][_0xed5e7['uniqueid']][_0x243a('0x92')]=_0x4958fa[_0x243a('0x67')](this['channels'][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x61')],'seconds');this['channels'][_0xed5e7[_0x243a('0x2c')]]['holdtime']=this[_0x243a('0x12')][_0xed5e7['uniqueid']][_0x243a('0x51')]-this[_0x243a('0x12')][_0xed5e7[_0x243a('0x2c')]][_0x243a('0x92')];}if(_0xed5e7['context']===_0x243a('0x68')){if(this['agents'][_0xed5e7[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]]){this[_0x243a('0x13')][_0xed5e7[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]]=_['omit'](this['agents'][_0xed5e7[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]],[_0x243a('0x39')]);logger[_0x243a('0x2f')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0xed5e7[_0x243a('0x2c')],util[_0x243a('0x28')]({'id':this['agents'][_0xed5e7['channel'][_0x243a('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0x243a('0x13')][_0xed5e7[_0x243a('0x35')]['split']('-')[0x0]][_0x243a('0x40')]},{'showHidden':![],'depth':null}));this[_0x243a('0x3b')](util['format'](_0x243a('0x3d'),this[_0x243a('0x13')][_0xed5e7[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]]['name']),_0x243a('0x93'),{'id':this[_0x243a('0x13')][_0xed5e7[_0x243a('0x35')][_0x243a('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0x243a('0x13')][_0xed5e7[_0x243a('0x35')]['split']('-')[0x0]][_0x243a('0x40')]});for(var _0x1d8e89=0x0;_0x1d8e89{delete this[_0x243a('0x12')][_0x2b9727];},_0x567742);}};module[_0x243a('0xc1')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 6750a37..38ad383 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b02=['[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','isUndefined','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','starttime','seconds','complete','answered','holdtime','diff','billableseconds','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','channels','outbound','applications','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','hangup','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','voice_outbound_channel:save'];(function(_0x3ec120,_0x1c39bf){var _0x45fceb=function(_0x152782){while(--_0x152782){_0x3ec120['push'](_0x3ec120['shift']());}};_0x45fceb(++_0x1c39bf);}(_0x7b02,0x1c3));var _0x27b0=function(_0x35c0f9,_0x5aff29){_0x35c0f9=_0x35c0f9-0x0;var _0x543711=_0x7b02[_0x35c0f9];return _0x543711;};'use strict';var _=require(_0x27b0('0x0'));var moment=require(_0x27b0('0x1'));var util=require(_0x27b0('0x2'));var Redis=require('ioredis');var config=require(_0x27b0('0x3'));var logger=require(_0x27b0('0x4'))(_0x27b0('0x5'));var ami=require(_0x27b0('0x6'));config['redis']=_[_0x27b0('0x7')](config['redis'],{'host':_0x27b0('0x8'),'port':0x18eb});var io=require(_0x27b0('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x175f9d){this[_0x27b0('0xa')]=_0x175f9d['outboundChannels'];this[_0x27b0('0xb')]=_0x175f9d['outbound'];this[_0x27b0('0xc')]={};this['variables']={};ami['on'](_0x27b0('0xd'),this[_0x27b0('0xe')]['bind'](this));ami['on'](_0x27b0('0xf'),this[_0x27b0('0x10')][_0x27b0('0x11')](this));ami['on']('varset',this[_0x27b0('0x12')]['bind'](this));ami['on'](_0x27b0('0x13'),this['syncHangup'][_0x27b0('0x11')](this));}VoiceDialReport[_0x27b0('0x14')]['isNotNull']=function(_0x5c3d7f){return _0x5c3d7f!==null&&!_['isUndefined'](_0x5c3d7f);};VoiceDialReport[_0x27b0('0x14')][_0x27b0('0x15')]=function(_0x109a1f,_0x236112,_0x1217f7){io['to'](_0x109a1f)['emit'](_0x236112,_0x1217f7);};VoiceDialReport[_0x27b0('0x14')][_0x27b0('0xe')]=function(_0x149615){try{if(this['isNotNull'](_0x149615)){logger[_0x27b0('0x16')](_0x27b0('0x17'),_0x149615[_0x27b0('0x18')],util[_0x27b0('0x19')](_0x149615,{'showHidden':![],'depth':null}));if(this['channels'][_0x149615['uniqueid']]){_['merge'](this[_0x27b0('0xa')][_0x149615[_0x27b0('0x18')]],{'starttime':moment()[_0x27b0('0x1a')](_0x27b0('0x1b')),'lastevent':_0x27b0('0x1c'),'interface':_0x149615['channel'][_0x27b0('0x1d')](0x0,_0x149615[_0x27b0('0x1e')][_0x27b0('0x1f')]('-')),'membername':_0x149615[_0x27b0('0x1e')]['substring'](_0x149615[_0x27b0('0x1e')][_0x27b0('0x1f')]('/')+0x1,_0x149615[_0x27b0('0x1e')][_0x27b0('0x1f')]('-'))},_[_0x27b0('0x20')](_0x149615,[_0x27b0('0x21'),_0x27b0('0x22')]));logger['info'](_0x27b0('0x23'),_0x149615[_0x27b0('0x18')],this['channels'][_0x149615[_0x27b0('0x18')]][_0x27b0('0x24')],this[_0x27b0('0xa')][_0x149615[_0x27b0('0x18')]]['interface']);logger['debug'](_0x27b0('0x25'),_0x149615[_0x27b0('0x18')],util[_0x27b0('0x19')](this[_0x27b0('0xa')][_0x149615[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));if(this[_0x27b0('0xc')][_0x149615[_0x27b0('0x18')]])_[_0x27b0('0x26')](this[_0x27b0('0xa')][_0x149615[_0x27b0('0x18')]],this[_0x27b0('0xc')][_0x149615[_0x27b0('0x18')]]);this[_0x27b0('0x15')](_0x27b0('0x27'),_0x27b0('0x28'),this[_0x27b0('0xa')][_0x149615['uniqueid']]);logger[_0x27b0('0x16')](_0x27b0('0x29'),_0x149615[_0x27b0('0x18')],util[_0x27b0('0x19')](this['channels'][_0x149615['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x27b0('0x2a'),this[_0x27b0('0xa')][_0x149615[_0x27b0('0x18')]]);}}}catch(_0x1a948a){logger[_0x27b0('0x2b')](_0x27b0('0x2c'),_0x149615[_0x27b0('0x18')],util['inspect'](_0x1a948a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x27b0('0x10')]=function(_0xf312c0){try{if(this[_0x27b0('0x2d')](_0xf312c0)){logger['debug'](_0x27b0('0x2e'),_0xf312c0[_0x27b0('0x18')],util[_0x27b0('0x19')](_0xf312c0,{'showHidden':![],'depth':null}));if(this[_0x27b0('0xa')][_0xf312c0['uniqueid']]){this[_0x27b0('0xa')][_0xf312c0[_0x27b0('0x18')]][_0x27b0('0x2f')]=_0xf312c0[_0x27b0('0x2f')];if(_0xf312c0[_0x27b0('0x2f')]===_0x27b0('0x30')){this['channels'][_0xf312c0[_0x27b0('0x18')]][_0x27b0('0x31')]=_0xf312c0[_0x27b0('0x31')];this[_0x27b0('0xa')][_0xf312c0[_0x27b0('0x18')]][_0x27b0('0x32')]=_0xf312c0['connectedlinename'];this['channels'][_0xf312c0['uniqueid']][_0x27b0('0x33')]=moment()[_0x27b0('0x1a')](_0x27b0('0x1b'));this[_0x27b0('0xa')][_0xf312c0[_0x27b0('0x18')]][_0x27b0('0x34')]='connect';logger[_0x27b0('0x35')](_0x27b0('0x36'),_0xf312c0['uniqueid'],_0xf312c0[_0x27b0('0x1e')][_0x27b0('0x1d')](_0xf312c0['channel'][_0x27b0('0x1f')]('/')+0x1,_0xf312c0['channel'][_0x27b0('0x1f')]('-')));logger[_0x27b0('0x16')](_0x27b0('0x37'),_0xf312c0[_0x27b0('0x18')],util[_0x27b0('0x19')](this[_0x27b0('0xa')][_0xf312c0[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));ami[_0x27b0('0x15')](_0x27b0('0x38'),this[_0x27b0('0xa')][_0xf312c0[_0x27b0('0x18')]]);}logger[_0x27b0('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0xf312c0[_0x27b0('0x18')],util[_0x27b0('0x19')](this['channels'][_0xf312c0[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x27b0('0x27'),_0x27b0('0x28'),this['channels'][_0xf312c0[_0x27b0('0x18')]]);}}}catch(_0x51a3eb){logger[_0x27b0('0x2b')](_0x27b0('0x39'),_0xf312c0[_0x27b0('0x18')],util['inspect'](_0x51a3eb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x27b0('0x14')]['syncVarSet']=function(_0x9d6839){try{if(this[_0x27b0('0x2d')](_0x9d6839)){logger[_0x27b0('0x16')](_0x27b0('0x3a'),_0x9d6839[_0x27b0('0x18')],util[_0x27b0('0x19')](_0x9d6839,{'showHidden':![],'depth':null}));this[_0x27b0('0x3b')](_0x9d6839['uniqueid'],_[_0x27b0('0x3c')](_0x9d6839['variable'])[0x0],_0x9d6839['value']);if(this[_0x27b0('0x2d')](_0x9d6839['variable'])&&this[_0x27b0('0x2d')](_0x9d6839[_0x27b0('0x3d')][_0x27b0('0x3e')])){if(_[_0x27b0('0x3f')](this[_0x27b0('0xa')][_0x9d6839[_0x27b0('0x18')]])){this[_0x27b0('0xa')][_0x9d6839[_0x27b0('0x18')]]={'routeId':_0x9d6839[_0x27b0('0x40')],'variables':this[_0x27b0('0x41')][_0x9d6839[_0x27b0('0x18')]],'motionChannel':'voice'};logger[_0x27b0('0x35')](_0x27b0('0x42'),_0x9d6839[_0x27b0('0x18')],_0x9d6839['variable'][_0x27b0('0x3e')],_[_0x27b0('0x3c')](_0x9d6839[_0x27b0('0x3d')])[0x0],_0x9d6839[_0x27b0('0x40')]);logger['debug'](_0x27b0('0x43'),_0x9d6839[_0x27b0('0x18')],util[_0x27b0('0x19')](this['channels'][_0x9d6839['uniqueid']],{'showHidden':![],'depth':null}));this[_0x27b0('0x15')](_0x27b0('0x27'),_0x27b0('0x28'),this['channels'][_0x9d6839[_0x27b0('0x18')]]);}}}}catch(_0x58a80d){logger[_0x27b0('0x2b')](_0x27b0('0x44'),_0x9d6839[_0x27b0('0x18')],util['inspect'](_0x58a80d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x27b0('0x14')][_0x27b0('0x3b')]=function(_0x1d02b1,_0x29a8a3,_0x3987ba){var _0x4f1ec8=[_0x27b0('0x45'),'rtpaudioqosbridged',_0x27b0('0x46'),_0x27b0('0x47'),_0x27b0('0x48'),_0x27b0('0x49'),_0x27b0('0x4a'),_0x27b0('0x4b'),'sipcallid',_0x27b0('0x4c'),_0x27b0('0x4d'),_0x27b0('0x4e'),_0x27b0('0x4f'),_0x27b0('0x50'),_0x27b0('0x51'),'memberlastcall',_0x27b0('0x24'),_0x27b0('0x52'),'memberrealtime'];if(!_[_0x27b0('0x53')](_0x29a8a3)&&!_[_0x27b0('0x54')](_0x4f1ec8,_0x29a8a3)){if(_[_0x27b0('0x3f')](this[_0x27b0('0x41')][_0x1d02b1])){this[_0x27b0('0x41')][_0x1d02b1]={};}this[_0x27b0('0x41')][_0x1d02b1][_0x29a8a3]=_0x3987ba;}};VoiceDialReport[_0x27b0('0x14')][_0x27b0('0x55')]=function(_0x2932cd){try{if(this[_0x27b0('0x2d')](_0x2932cd)){logger['debug'](_0x27b0('0x56'),_0x2932cd[_0x27b0('0x18')],util['inspect'](_0x2932cd,{'showHidden':![],'depth':null}));if(this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]]){logger[_0x27b0('0x35')](_0x27b0('0x57'),_0x2932cd[_0x27b0('0x18')],_0x2932cd[_0x27b0('0x58')]);this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]]['endtime']=moment()[_0x27b0('0x1a')](_0x27b0('0x1b'));this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x59')]=moment(this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x5a')])['diff'](this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x5b')],_0x27b0('0x5c'));this[_0x27b0('0xa')][_0x2932cd['uniqueid']]['lastevent']=_0x27b0('0x5d');this[_0x27b0('0xb')]['total']+=0x1;if(this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x33')]){this[_0x27b0('0xb')][_0x27b0('0x5e')]+=0x1;this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x5f')]=moment(this['channels'][_0x2932cd['uniqueid']][_0x27b0('0x33')])[_0x27b0('0x60')](this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x5b')],_0x27b0('0x5c'));this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x61')]=moment(this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]]['endtime'])[_0x27b0('0x60')](this[_0x27b0('0xa')][_0x2932cd['uniqueid']][_0x27b0('0x33')],_0x27b0('0x5c'));this[_0x27b0('0xb')]['sumHoldTime']+=this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x5f')]||0x0;this[_0x27b0('0xb')][_0x27b0('0x62')]+=this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x61')];}this['outbound']['sumDuration']+=this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]][_0x27b0('0x59')];logger[_0x27b0('0x16')](_0x27b0('0x63'),_0x2932cd['uniqueid'],util['inspect'](this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));ami[_0x27b0('0x15')](_0x27b0('0x64'),this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2932cd[_0x27b0('0x18')],util['inspect'](this['channels'][_0x2932cd[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x27b0('0x65'),this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]]);logger[_0x27b0('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x2932cd['uniqueid'],util[_0x27b0('0x19')](this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x27b0('0x66'),this[_0x27b0('0xb')]);logger['info'](_0x27b0('0x67'),JSON[_0x27b0('0x68')](this['channels'][_0x2932cd[_0x27b0('0x18')]]));logger['debug'](_0x27b0('0x69'),_0x2932cd[_0x27b0('0x18')],util[_0x27b0('0x19')](this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]],{'showHidden':![],'depth':null}));this[_0x27b0('0x15')](_0x27b0('0x27'),_0x27b0('0x6a'),this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x18')]]);this[_0x27b0('0x6b')](_0x2932cd['uniqueid']);}else if(this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x6c')]]){this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x6c')]][_0x27b0('0x18')]=this[_0x27b0('0xa')][_0x2932cd[_0x27b0('0x6c')]][_0x27b0('0x6d')];}if(this['variables'][_0x2932cd[_0x27b0('0x18')]]){delete this['variables'][_0x2932cd[_0x27b0('0x18')]];}}}catch(_0x50c774){logger[_0x27b0('0x2b')]('[%s][voiceDialReport][hangup]',_0x2932cd[_0x27b0('0x18')],util[_0x27b0('0x19')](_0x50c774,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x27b0('0x6e')]=function(_0x4e2a94){try{if(this[_0x27b0('0x2d')](_0x4e2a94)){logger[_0x27b0('0x16')](_0x27b0('0x6f'),_0x4e2a94['uniqueid'],util[_0x27b0('0x19')](_0x4e2a94,{'showHidden':![],'depth':null}));if(_0x4e2a94['application'][_0x27b0('0x70')]()===_0x27b0('0x71')){_0x4e2a94[_0x27b0('0x72')]=(_0x4e2a94[_0x27b0('0x73')]||_0x4e2a94[_0x27b0('0x72')])[_0x27b0('0x70')]();if(_[_0x27b0('0x74')](_0x4e2a94[_0x27b0('0x72')],'cdr(')){if(_['isUndefined'](this[_0x27b0('0xc')][_0x4e2a94[_0x27b0('0x18')]]))this[_0x27b0('0xc')][_0x4e2a94[_0x27b0('0x18')]]={};logger[_0x27b0('0x35')](_0x27b0('0x75'),_0x4e2a94['uniqueid'],_0x4e2a94[_0x27b0('0x76')],_0x4e2a94[_0x27b0('0x72')]);var _0x56c83b=_0x4e2a94[_0x27b0('0x72')][_0x27b0('0x77')]('=');var _0x510054=_0x56c83b[0x0][_0x27b0('0x78')](/cdr\((.*)\)/);if(_0x510054)this[_0x27b0('0xc')][_0x4e2a94['uniqueid']][_0x510054[0x1]]=_0x56c83b[0x1];}}}}catch(_0x2d8844){logger[_0x27b0('0x2b')](_0x27b0('0x79'),_0x4e2a94['uniqueid'],util[_0x27b0('0x19')](_0x2d8844,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['deleteChannelAfterTimeout']=function(_0x294327,_0x5bcfad=0x2710){if(this[_0x27b0('0xa')][_0x294327]){setTimeout(()=>{delete this[_0x27b0('0xa')][_0x294327];},_0x5bcfad);}};module[_0x27b0('0x7a')]=VoiceDialReport; \ No newline at end of file +var _0x523a=['exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis','defaults','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','isNotNull','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','emit','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','variable','value','outboundrouteid','isUndefined','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','seconds','complete','total','holdtime','starttime','billableseconds','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','[%s][voiceDialReport][newexten]'];(function(_0x505138,_0x1b03ee){var _0x54c629=function(_0x2fd000){while(--_0x2fd000){_0x505138['push'](_0x505138['shift']());}};_0x54c629(++_0x1b03ee);}(_0x523a,0x7a));var _0xa523=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x523a[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xa523('0x0'));var moment=require(_0xa523('0x1'));var util=require(_0xa523('0x2'));var Redis=require('ioredis');var config=require(_0xa523('0x3'));var logger=require(_0xa523('0x4'))(_0xa523('0x5'));var ami=require('../ami');config[_0xa523('0x6')]=_[_0xa523('0x7')](config[_0xa523('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa523('0x6')]));function VoiceDialReport(_0x247654){this[_0xa523('0x8')]=_0x247654[_0xa523('0x9')];this[_0xa523('0xa')]=_0x247654[_0xa523('0xa')];this[_0xa523('0xb')]={};this['variables']={};ami['on'](_0xa523('0xc'),this[_0xa523('0xd')]['bind'](this));ami['on'](_0xa523('0xe'),this[_0xa523('0xf')][_0xa523('0x10')](this));ami['on'](_0xa523('0x11'),this[_0xa523('0x12')][_0xa523('0x10')](this));ami['on'](_0xa523('0x13'),this[_0xa523('0x14')][_0xa523('0x10')](this));}VoiceDialReport['prototype'][_0xa523('0x15')]=function(_0x587dc2){return _0x587dc2!==null&&!_['isUndefined'](_0x587dc2);};VoiceDialReport[_0xa523('0x16')]['emit']=function(_0x27e00d,_0x29bdba,_0x4d1747){io['to'](_0x27e00d)['emit'](_0x29bdba,_0x4d1747);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x2b0c46){try{if(this['isNotNull'](_0x2b0c46)){logger[_0xa523('0x17')](_0xa523('0x18'),_0x2b0c46[_0xa523('0x19')],util[_0xa523('0x1a')](_0x2b0c46,{'showHidden':![],'depth':null}));if(this[_0xa523('0x8')][_0x2b0c46[_0xa523('0x19')]]){_[_0xa523('0x1b')](this[_0xa523('0x8')][_0x2b0c46[_0xa523('0x19')]],{'starttime':moment()[_0xa523('0x1c')](_0xa523('0x1d')),'lastevent':_0xa523('0x1e'),'interface':_0x2b0c46[_0xa523('0x1f')][_0xa523('0x20')](0x0,_0x2b0c46[_0xa523('0x1f')][_0xa523('0x21')]('-')),'membername':_0x2b0c46[_0xa523('0x1f')][_0xa523('0x20')](_0x2b0c46[_0xa523('0x1f')][_0xa523('0x21')]('/')+0x1,_0x2b0c46[_0xa523('0x1f')][_0xa523('0x21')]('-'))},_[_0xa523('0x22')](_0x2b0c46,[_0xa523('0x23'),_0xa523('0x24')]));logger[_0xa523('0x25')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x2b0c46[_0xa523('0x19')],this['channels'][_0x2b0c46['uniqueid']]['membername'],this[_0xa523('0x8')][_0x2b0c46[_0xa523('0x19')]][_0xa523('0x26')]);logger['debug'](_0xa523('0x27'),_0x2b0c46[_0xa523('0x19')],util[_0xa523('0x1a')](this['channels'][_0x2b0c46['uniqueid']],{'showHidden':![],'depth':null}));if(this['applications'][_0x2b0c46[_0xa523('0x19')]])_[_0xa523('0x1b')](this['channels'][_0x2b0c46[_0xa523('0x19')]],this[_0xa523('0xb')][_0x2b0c46[_0xa523('0x19')]]);this[_0xa523('0x28')](_0xa523('0x29'),_0xa523('0x2a'),this[_0xa523('0x8')][_0x2b0c46[_0xa523('0x19')]]);logger[_0xa523('0x17')](_0xa523('0x2b'),_0x2b0c46['uniqueid'],util[_0xa523('0x1a')](this[_0xa523('0x8')][_0x2b0c46[_0xa523('0x19')]],{'showHidden':![],'depth':null}));ami[_0xa523('0x28')]('custom:dialbegin',this[_0xa523('0x8')][_0x2b0c46[_0xa523('0x19')]]);}}}catch(_0x1f80fa){logger[_0xa523('0x2c')](_0xa523('0x2d'),_0x2b0c46[_0xa523('0x19')],util[_0xa523('0x1a')](_0x1f80fa,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa523('0x16')][_0xa523('0xf')]=function(_0x164f0d){try{if(this[_0xa523('0x15')](_0x164f0d)){logger['debug'](_0xa523('0x2e'),_0x164f0d[_0xa523('0x19')],util[_0xa523('0x1a')](_0x164f0d,{'showHidden':![],'depth':null}));if(this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]]){this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]][_0xa523('0x2f')]=_0x164f0d[_0xa523('0x2f')];if(_0x164f0d[_0xa523('0x2f')]===_0xa523('0x30')){this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]]['connectedlinenum']=_0x164f0d[_0xa523('0x31')];this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]][_0xa523('0x32')]=_0x164f0d['connectedlinename'];this['channels'][_0x164f0d[_0xa523('0x19')]][_0xa523('0x33')]=moment()[_0xa523('0x1c')](_0xa523('0x1d'));this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]][_0xa523('0x34')]=_0xa523('0x35');logger[_0xa523('0x25')](_0xa523('0x36'),_0x164f0d['uniqueid'],_0x164f0d[_0xa523('0x1f')][_0xa523('0x20')](_0x164f0d[_0xa523('0x1f')][_0xa523('0x21')]('/')+0x1,_0x164f0d[_0xa523('0x1f')][_0xa523('0x21')]('-')));logger[_0xa523('0x17')](_0xa523('0x37'),_0x164f0d['uniqueid'],util[_0xa523('0x1a')](this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa523('0x38'),this[_0xa523('0x8')][_0x164f0d[_0xa523('0x19')]]);}logger[_0xa523('0x17')](_0xa523('0x39'),_0x164f0d[_0xa523('0x19')],util[_0xa523('0x1a')](this[_0xa523('0x8')][_0x164f0d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa523('0x28')]('voice:outbound',_0xa523('0x2a'),this[_0xa523('0x8')][_0x164f0d['uniqueid']]);}}}catch(_0x95cde6){logger[_0xa523('0x2c')](_0xa523('0x3a'),_0x164f0d[_0xa523('0x19')],util[_0xa523('0x1a')](_0x95cde6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa523('0x16')][_0xa523('0x12')]=function(_0x271a9d){try{if(this[_0xa523('0x15')](_0x271a9d)){logger[_0xa523('0x17')](_0xa523('0x3b'),_0x271a9d['uniqueid'],util[_0xa523('0x1a')](_0x271a9d,{'showHidden':![],'depth':null}));this['addVariable'](_0x271a9d[_0xa523('0x19')],_['keys'](_0x271a9d[_0xa523('0x3c')])[0x0],_0x271a9d[_0xa523('0x3d')]);if(this[_0xa523('0x15')](_0x271a9d[_0xa523('0x3c')])&&this[_0xa523('0x15')](_0x271a9d[_0xa523('0x3c')][_0xa523('0x3e')])){if(_[_0xa523('0x3f')](this[_0xa523('0x8')][_0x271a9d[_0xa523('0x19')]])){this[_0xa523('0x8')][_0x271a9d[_0xa523('0x19')]]={'routeId':_0x271a9d[_0xa523('0x3d')],'variables':this[_0xa523('0x40')][_0x271a9d['uniqueid']],'motionChannel':_0xa523('0x41')};logger[_0xa523('0x25')](_0xa523('0x42'),_0x271a9d[_0xa523('0x19')],_0x271a9d[_0xa523('0x3c')]['outboundrouteid'],_['keys'](_0x271a9d[_0xa523('0x3c')])[0x0],_0x271a9d[_0xa523('0x3d')]);logger[_0xa523('0x17')](_0xa523('0x43'),_0x271a9d[_0xa523('0x19')],util['inspect'](this['channels'][_0x271a9d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa523('0x28')](_0xa523('0x29'),_0xa523('0x2a'),this[_0xa523('0x8')][_0x271a9d['uniqueid']]);}}}}catch(_0x3cc405){logger[_0xa523('0x2c')](_0xa523('0x44'),_0x271a9d[_0xa523('0x19')],util['inspect'](_0x3cc405,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa523('0x16')][_0xa523('0x45')]=function(_0x363b58,_0x5735cf,_0xb4c9c6){var _0x4c5341=[_0xa523('0x46'),_0xa523('0x47'),_0xa523('0x48'),_0xa523('0x49'),_0xa523('0x4a'),'rtpaudioqoslossbridged',_0xa523('0x4b'),_0xa523('0x4c'),'sipcallid','sipuri',_0xa523('0x4d'),_0xa523('0x4e'),'membercalls','memberdynamic',_0xa523('0x4f'),_0xa523('0x50'),_0xa523('0x51'),_0xa523('0x52'),_0xa523('0x53')];if(!_[_0xa523('0x54')](_0x5735cf)&&!_[_0xa523('0x55')](_0x4c5341,_0x5735cf)){if(_[_0xa523('0x3f')](this[_0xa523('0x40')][_0x363b58])){this[_0xa523('0x40')][_0x363b58]={};}this['variables'][_0x363b58][_0x5735cf]=_0xb4c9c6;}};VoiceDialReport[_0xa523('0x16')]['syncHangup']=function(_0xde44d1){try{if(this[_0xa523('0x15')](_0xde44d1)){logger[_0xa523('0x17')](_0xa523('0x56'),_0xde44d1[_0xa523('0x19')],util['inspect'](_0xde44d1,{'showHidden':![],'depth':null}));if(this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]]){logger[_0xa523('0x25')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0xde44d1['uniqueid'],_0xde44d1[_0xa523('0x57')]);this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]][_0xa523('0x58')]=moment()[_0xa523('0x1c')](_0xa523('0x1d'));this[_0xa523('0x8')][_0xde44d1['uniqueid']][_0xa523('0x59')]=moment(this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]][_0xa523('0x58')])[_0xa523('0x5a')](this[_0xa523('0x8')][_0xde44d1['uniqueid']]['starttime'],_0xa523('0x5b'));this[_0xa523('0x8')][_0xde44d1['uniqueid']][_0xa523('0x34')]=_0xa523('0x5c');this[_0xa523('0xa')][_0xa523('0x5d')]+=0x1;if(this['channels'][_0xde44d1[_0xa523('0x19')]][_0xa523('0x33')]){this[_0xa523('0xa')]['answered']+=0x1;this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]][_0xa523('0x5e')]=moment(this[_0xa523('0x8')][_0xde44d1['uniqueid']][_0xa523('0x33')])['diff'](this[_0xa523('0x8')][_0xde44d1['uniqueid']][_0xa523('0x5f')],_0xa523('0x5b'));this[_0xa523('0x8')][_0xde44d1['uniqueid']][_0xa523('0x60')]=moment(this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]]['endtime'])[_0xa523('0x5a')](this[_0xa523('0x8')][_0xde44d1['uniqueid']]['answertime'],_0xa523('0x5b'));this[_0xa523('0xa')][_0xa523('0x61')]+=this['channels'][_0xde44d1[_0xa523('0x19')]]['holdtime']||0x0;this[_0xa523('0xa')][_0xa523('0x62')]+=this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]][_0xa523('0x60')];}this[_0xa523('0xa')]['sumDuration']+=this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]][_0xa523('0x59')];logger[_0xa523('0x17')](_0xa523('0x63'),_0xde44d1[_0xa523('0x19')],util['inspect'](this['channels'][_0xde44d1[_0xa523('0x19')]],{'showHidden':![],'depth':null}));ami[_0xa523('0x28')](_0xa523('0x64'),this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]]);logger[_0xa523('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0xde44d1[_0xa523('0x19')],util['inspect'](this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]],{'showHidden':![],'depth':null}));ami[_0xa523('0x28')](_0xa523('0x65'),this['channels'][_0xde44d1[_0xa523('0x19')]]);logger[_0xa523('0x17')](_0xa523('0x66'),_0xde44d1['uniqueid'],util[_0xa523('0x1a')](this['channels'][_0xde44d1[_0xa523('0x19')]],{'showHidden':![],'depth':null}));this[_0xa523('0x28')]('voice:outbound',_0xa523('0x67'),this[_0xa523('0xa')]);logger[_0xa523('0x25')](_0xa523('0x68'),JSON[_0xa523('0x69')](this[_0xa523('0x8')][_0xde44d1['uniqueid']]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0xde44d1[_0xa523('0x19')],util[_0xa523('0x1a')](this['channels'][_0xde44d1['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xa523('0x29'),_0xa523('0x6a'),this[_0xa523('0x8')][_0xde44d1[_0xa523('0x19')]]);this[_0xa523('0x6b')](_0xde44d1[_0xa523('0x19')]);}else if(this['channels'][_0xde44d1['linkedid']]){this[_0xa523('0x8')][_0xde44d1[_0xa523('0x6c')]][_0xa523('0x19')]=this[_0xa523('0x8')][_0xde44d1[_0xa523('0x6c')]][_0xa523('0x6d')];}if(this[_0xa523('0x40')][_0xde44d1[_0xa523('0x19')]]){delete this[_0xa523('0x40')][_0xde44d1[_0xa523('0x19')]];}}}catch(_0x4071ac){logger[_0xa523('0x2c')](_0xa523('0x6e'),_0xde44d1[_0xa523('0x19')],util[_0xa523('0x1a')](_0x4071ac,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa523('0x16')]['syncNewExten']=function(_0xd66411){try{if(this[_0xa523('0x15')](_0xd66411)){logger[_0xa523('0x17')](_0xa523('0x6f'),_0xd66411[_0xa523('0x19')],util[_0xa523('0x1a')](_0xd66411,{'showHidden':![],'depth':null}));if(_0xd66411['application'][_0xa523('0x70')]()===_0xa523('0x71')){_0xd66411['applicationdata']=(_0xd66411['appdata']||_0xd66411[_0xa523('0x72')])[_0xa523('0x70')]();if(_['startsWith'](_0xd66411[_0xa523('0x72')],_0xa523('0x73'))){if(_[_0xa523('0x3f')](this[_0xa523('0xb')][_0xd66411[_0xa523('0x19')]]))this[_0xa523('0xb')][_0xd66411[_0xa523('0x19')]]={};logger[_0xa523('0x25')](_0xa523('0x74'),_0xd66411[_0xa523('0x19')],_0xd66411[_0xa523('0x75')],_0xd66411['applicationdata']);var _0x156f62=_0xd66411[_0xa523('0x72')][_0xa523('0x76')]('=');var _0x49a687=_0x156f62[0x0]['match'](/cdr\((.*)\)/);if(_0x49a687)this[_0xa523('0xb')][_0xd66411[_0xa523('0x19')]][_0x49a687[0x1]]=_0x156f62[0x1];}}}}catch(_0x530226){logger[_0xa523('0x2c')](_0xa523('0x77'),_0xd66411['uniqueid'],util[_0xa523('0x1a')](_0x530226,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa523('0x16')][_0xa523('0x6b')]=function(_0x803b03,_0x535b75=0x2710){if(this['channels'][_0x803b03]){setTimeout(()=>{delete this[_0xa523('0x8')][_0x803b03];},_0x535b75);}};module[_0xa523('0x78')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 3661e7b..b3979c6 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a24=['queue','voice_queue_channel:save','voice_queue_presence:save','ATTENDEDTRANSFER','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','queues','[voiceQueueReport][queues]','isRunning','then','actionid','createQueueSummaryReport','name','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','queuestatus','outbound','statusRequests','syncQueueSummaryComplete','push','[voiceQueueReport][queuesummary]\x20event:','completeEvent','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','position','count','info','assign','pick','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','last','connectedlinenum','connectedlinename','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','startsWith','toLowerCase','local/','linkedid','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','keys','value','variable','CONTINUE','TIMEOUT','lastevent','YYYY-MM-DD\x20HH:mm:ss','custom:timeout','varset','EXITWITHKEY','queuecallerleaveAt','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','sumHoldTime','diff','seconds','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','handleHangup','cause-txt','cause','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','../model/voiceQueueSummary','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','realtime','agents','queueChannels','campaigns','summary','variables','queuesummary','syncQueueSummary','queuesummarycomplete','bind','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','queueStatusComplete','unlockRR','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','voiceQueues','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x5a24,0x18d));var _0x45a2=function(_0x444f36,_0x33ad1a){_0x444f36=_0x444f36-0x0;var _0x92b7e0=_0x5a24[_0x444f36];return _0x92b7e0;};'use strict';var _=require(_0x45a2('0x0'));var moment=require('moment');var util=require(_0x45a2('0x1'));var Redis=require('ioredis');var config=require(_0x45a2('0x2'));var logger=require(_0x45a2('0x3'))(_0x45a2('0x4'));var ami=require(_0x45a2('0x5'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x45a2('0x6'));config['redis']=_[_0x45a2('0x7')](config[_0x45a2('0x8')],{'host':_0x45a2('0x9'),'port':0x18eb});var io=require(_0x45a2('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x45a2('0xb')][_0x45a2('0xc')]=function(_0x4b9cbe){this[_0x45a2('0xd')]=this[_0x45a2('0xd')]?this['tail'][_0x45a2('0xe')](_0x4b9cbe):_0x4b9cbe();};function VoiceQueueReport(_0x509b7f){this['sequence']=new Sequence();this[_0x45a2('0xf')]={};this[_0x45a2('0x10')]=_0x509b7f;this['agents']=_0x509b7f[_0x45a2('0x11')];this['channels']=_0x509b7f[_0x45a2('0x12')];this['voiceQueues']=_0x509b7f['voiceQueues'];this[_0x45a2('0x13')]=_0x509b7f['campaigns'];this[_0x45a2('0x14')]=initializeSummary();this[_0x45a2('0x15')]={};ami['on'](_0x45a2('0x16'),this[_0x45a2('0x17')]['bind'](this));ami['on'](_0x45a2('0x18'),this['syncQueueSummaryComplete']['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x45a2('0x19')](this));ami['on']('queuestatuscomplete',this[_0x45a2('0x1a')][_0x45a2('0x19')](this));ami['on'](_0x45a2('0x1b'),this[_0x45a2('0x1c')][_0x45a2('0x19')](this));ami['on'](_0x45a2('0x1d'),this[_0x45a2('0x1e')]['bind'](this));ami['on'](_0x45a2('0x1f'),this[_0x45a2('0x20')][_0x45a2('0x19')](this));ami['on'](_0x45a2('0x21'),this[_0x45a2('0x22')]['bind'](this));ami['on']('agentconnect',this[_0x45a2('0x23')][_0x45a2('0x19')](this));ami['on']('varset',this['syncVarSet'][_0x45a2('0x19')](this));ami['on'](_0x45a2('0x24'),this[_0x45a2('0x25')][_0x45a2('0x19')](this));ami['on'](_0x45a2('0x26'),this[_0x45a2('0x27')][_0x45a2('0x19')](this));ami['on'](_0x45a2('0x28'),this[_0x45a2('0x29')][_0x45a2('0x19')](this));ami['on']('musiconholdstop',this[_0x45a2('0x2a')][_0x45a2('0x19')](this));ami['on']('attendedtransfer',this[_0x45a2('0x2b')]['bind'](this));ami['on']('blindtransfer',this[_0x45a2('0x2c')][_0x45a2('0x19')](this));this[_0x45a2('0x2d')]();this[_0x45a2('0x2e')]();}function clearChannels(_0x40b2fd){if(!_['isEmpty'](_0x40b2fd)){for(var _0x11d21c in _0x40b2fd){if(_0x40b2fd[_0x45a2('0x2f')](_0x11d21c)){delete _0x40b2fd[_0x11d21c];}}}}function clearCampaigns(_0x3c9b0c){if(!_[_0x45a2('0x30')](_0x3c9b0c)){for(var _0x893d17 in _0x3c9b0c){if(_0x3c9b0c['hasOwnProperty'](_0x893d17)){_0x3c9b0c[_0x893d17][_0x45a2('0x31')]=0x0;}}}}function clearVoiceQueues(_0x770b86){if(!_[_0x45a2('0x30')](_0x770b86)){for(var _0x234b73 in _0x770b86){if(_0x770b86[_0x45a2('0x2f')](_0x234b73)){_0x770b86[_0x234b73]['originated']=0x0;_0x770b86[_0x234b73][_0x45a2('0x32')]=0x0;_0x770b86[_0x234b73][_0x45a2('0x33')]=0x0;_0x770b86[_0x234b73]['waiting']=0x0;_0x770b86[_0x234b73][_0x45a2('0x34')]=!![];}}}}function clearAgentBooked(_0x4b15e9){if(!_[_0x45a2('0x30')](_0x4b15e9)){for(var _0x1a40cf in _0x4b15e9){if(_0x4b15e9[_0x45a2('0x2f')](_0x1a40cf)){_0x4b15e9[_0x1a40cf][_0x45a2('0x35')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x3248b7){return _0x3248b7['queuecallerexit']||_0x3248b7[_0x45a2('0x1d')]||_0x3248b7[_0x45a2('0x36')];}VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x37')]=function(){var _0x371fdc=this;for(var _0x5ba42b in this[_0x45a2('0x38')]){if(this['channels'][_0x45a2('0x2f')](_0x5ba42b)&&!this['channels'][_0x5ba42b][_0x45a2('0x39')]){this['sequence'][_0x45a2('0xc')](function(){if(!_[_0x45a2('0x3a')](_0x371fdc[_0x45a2('0x38')][_0x5ba42b])){return ami[_0x45a2('0x3b')]({'action':'status','channel':_0x371fdc[_0x45a2('0x38')][_0x5ba42b][_0x45a2('0x3c')]})[_0x45a2('0x3d')](function(_0x212fe2){if(_0x212fe2[_0x45a2('0x3e')]===_0x45a2('0x3f')){setTimeout(function(){if(_0x371fdc[_0x45a2('0x38')][_0x5ba42b]){delete _0x371fdc[_0x45a2('0x38')][_0x5ba42b];logger[_0x45a2('0x40')](_0x45a2('0x41'),_0x5ba42b,util[_0x45a2('0x42')](_0x212fe2,{'showHidden':![],'depth':null}));}if(_0x371fdc['queueReports'][_0x5ba42b]){delete _0x371fdc[_0x45a2('0xf')][_0x5ba42b];logger['error'](_0x45a2('0x43'),_0x5ba42b,util[_0x45a2('0x42')](_0x212fe2,{'showHidden':![],'depth':null}));}if(_0x371fdc[_0x45a2('0x15')][_0x5ba42b]){delete _0x371fdc[_0x45a2('0x15')][_0x5ba42b];logger[_0x45a2('0x40')](_0x45a2('0x44'),_0x5ba42b,util[_0x45a2('0x42')](_0x212fe2,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x45a2('0x27')]=function(){logger[_0x45a2('0x40')](_0x45a2('0x45'));clearChannels(this['channels']);this['clearQueueReport'](this[_0x45a2('0xf')]);clearAgentBooked(this[_0x45a2('0x11')]);clearVoiceQueues(this[_0x45a2('0x46')]);clearCampaigns(this['campaigns']);this[_0x45a2('0x14')]=initializeSummary();};VoiceQueueReport[_0x45a2('0xb')]['clearQueueReport']=function(_0x3ad477){var _0x53a77d=this;if(!_[_0x45a2('0x30')](_0x3ad477)){for(var _0x43b142 in _0x3ad477){if(_0x3ad477['hasOwnProperty'](_0x43b142)){_0x53a77d[_0x45a2('0x47')](_0x3ad477[_0x43b142],_0x45a2('0x48'));delete _0x3ad477[_0x43b142];}}}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x49')]=function(_0x4f83bf,_0x5987dc,_0x5c049f){io['to'](_0x4f83bf)[_0x45a2('0x49')](_0x5987dc,_0x5c049f);};VoiceQueueReport['prototype'][_0x45a2('0x4a')]=function(_0x2e34fd,_0x54d267){logger[_0x45a2('0x4b')](_0x45a2('0x4c')+_0x54d267+_0x45a2('0x4d'),_0x2e34fd[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x2e34fd,{'showHidden':![],'depth':null}));this['emit'](util[_0x45a2('0x4f')](_0x45a2('0x50'),_0x2e34fd[_0x45a2('0x51')]),_0x45a2('0x52'),_0x2e34fd);io[_0x45a2('0x49')](_0x45a2('0x53'),_0x2e34fd);};VoiceQueueReport['prototype'][_0x45a2('0x47')]=function(_0x20ee4e,_0x52fa66){logger[_0x45a2('0x4b')](_0x45a2('0x4c')+_0x52fa66+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x20ee4e[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x20ee4e,{'showHidden':![],'depth':null}));if(_0x20ee4e['queuecallerexitreason']===_0x45a2('0x54')){return;}this[_0x45a2('0x49')](util[_0x45a2('0x4f')](_0x45a2('0x50'),_0x20ee4e[_0x45a2('0x51')]),'voice_queue_channel:remove',_0x20ee4e);io['emit'](_0x45a2('0x55'),_0x20ee4e);};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x56')]=function(_0x264e14){if(_0x264e14[_0x45a2('0x57')]===_0x45a2('0x58')){logger[_0x45a2('0x4b')](_0x45a2('0x59'),util[_0x45a2('0x42')](_0x264e14,{'showHidden':![],'depth':null}));this[_0x45a2('0x49')](util[_0x45a2('0x4f')](_0x45a2('0x50'),_0x264e14['name']),_0x45a2('0x5a'),_0x264e14);}};VoiceQueueReport['prototype'][_0x45a2('0x5b')]=function(_0x1582e4){return _0x1582e4!==null&&!_['isUndefined'](_0x1582e4);};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x2e')]=function(){var _0x5d77e4=this;setInterval(function(){_0x5d77e4[_0x45a2('0x37')]();ami[_0x45a2('0x3b')]({'action':_0x45a2('0x5c')})[_0x45a2('0x3d')](function(_0x3b6ee2){logger['error'](_0x45a2('0x5d'),util[_0x45a2('0x42')](_0x3b6ee2,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x45a2('0xb')]['loopQueueSummary']=function(){var _0x51eb83=this;setInterval(function(){if(!_0x51eb83['summary'][_0x45a2('0x5e')]){return ami['Action']({'action':_0x45a2('0x16')})[_0x45a2('0x5f')](function(_0x3e5a35){_0x51eb83['summary']['id']=_0x3e5a35['actionid'];_0x51eb83[_0x45a2('0x14')][_0x45a2('0x5e')]=!![];_0x51eb83[_0x45a2('0x14')]['queuestatus'][_0x3e5a35[_0x45a2('0x60')]]={};})[_0x45a2('0x3d')](function(_0x9af4e8){logger['error']('[voiceQueueReport][queuesummary]',util[_0x45a2('0x42')](_0x9af4e8,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x45a2('0x61')]=function(_0x145638,_0x2b0818){var _0x18dc16;if(this[_0x45a2('0x14')]&&this['summary'][_0x45a2('0x5c')]&&this['summary'][_0x45a2('0x5c')][_0x145638['name']]){_0x18dc16=this['summary'][_0x45a2('0x5c')][_0x145638[_0x45a2('0x62')]]['summaryEvent'];}var _0x149569=new VoiceQueueSummary(_0x145638);return _0x149569[_0x45a2('0x63')](_0x2b0818[_0x45a2('0x11')],this[_0x45a2('0x11')],_0x18dc16,this['realtime'][_0x45a2('0x38')]);};VoiceQueueReport['prototype'][_0x45a2('0x64')]=function(_0x129eee,_0x47a67){var _0x1c78d8=this['createQueueSummaryReport'](_0x129eee,_0x47a67);var _0x2bc08a=![];_0x2bc08a=_0x1c78d8[_0x45a2('0x65')](_0x129eee);if(_0x2bc08a){Object['assign'](_0x129eee,_0x1c78d8);this['realtime'][_0x45a2('0x46')][_0x129eee['name']]=_0x129eee;this['emitInboundVoiceQueueSummary'](_0x1c78d8);}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x1a')]=function(_0x5cf47a){var _0x4bc0a4=null;var _0x4e4b60=this[_0x45a2('0x14')]['id'];if(this[_0x45a2('0x14')][_0x45a2('0x66')][_0x4e4b60]){_0x4bc0a4=this[_0x45a2('0x14')][_0x45a2('0x66')][_0x4e4b60][_0x5cf47a['actionid']];}if(!_0x4bc0a4){this[_0x45a2('0x14')]=initializeSummary();return;}var _0x41c6d4=this['voiceQueues'][_0x4bc0a4['queue']];if(_0x41c6d4[_0x45a2('0x57')]===_0x45a2('0x58')){this[_0x45a2('0x64')](_0x41c6d4,_0x4bc0a4);}else if(_0x41c6d4[_0x45a2('0x57')]===_0x45a2('0x67')){var _0x20f4cf=this['createQueueSummaryReport'](_0x41c6d4,_0x4bc0a4);ami[_0x45a2('0x49')]('custom:queuesummary',_0x20f4cf);}this[_0x45a2('0x14')][_0x45a2('0x68')]-=0x1;var _0x3f8de2=this[_0x45a2('0x14')][_0x45a2('0x68')]>0x0?!![]:![];if(!_0x3f8de2){return this[_0x45a2('0x69')](this[_0x45a2('0x14')]['completeEvent']);}};VoiceQueueReport[_0x45a2('0xb')]['syncQueueMember']=function(_0x5859d1){var _0x5820ac=this['summary']['id'];if(this[_0x45a2('0x14')][_0x45a2('0x66')][_0x5820ac]&&this['summary'][_0x45a2('0x66')][_0x5820ac][_0x5859d1[_0x45a2('0x60')]]){this[_0x45a2('0x14')][_0x45a2('0x66')][_0x5820ac][_0x5859d1[_0x45a2('0x60')]]['agents'][_0x45a2('0x6a')](_0x5859d1);}};VoiceQueueReport['prototype'][_0x45a2('0x17')]=function(_0x5b23de){var _0x6a833e=this;try{if(this[_0x45a2('0x5b')](_0x5b23de)&&this['isNotNull'](_0x5b23de[_0x45a2('0x51')])){logger[_0x45a2('0x4b')](_0x45a2('0x6b'),util[_0x45a2('0x42')](_0x5b23de,{'showHidden':![],'depth':null}));var _0x4a2c54=this[_0x45a2('0x46')][_0x5b23de[_0x45a2('0x51')]];if(_0x4a2c54){logger[_0x45a2('0x4b')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x4a2c54['name']);this[_0x45a2('0x14')]['queues'][_0x4a2c54[_0x45a2('0x62')]]={'summaryEvent':_0x5b23de};this[_0x45a2('0x14')]['statusRequests']+=0x1;return ami[_0x45a2('0x3b')]({'action':_0x45a2('0x66'),'queue':_0x4a2c54['name']})[_0x45a2('0x5f')](function(_0x1e89c3){if(!_0x6a833e[_0x45a2('0x14')][_0x45a2('0x66')][_0x5b23de[_0x45a2('0x60')]]){_0x6a833e[_0x45a2('0x14')][_0x45a2('0x66')][_0x5b23de['actionid']]={};}_0x6a833e['summary'][_0x45a2('0x66')][_0x5b23de[_0x45a2('0x60')]][_0x1e89c3[_0x45a2('0x60')]]={'queue':_0x4a2c54[_0x45a2('0x62')],'agents':[]};})[_0x45a2('0x3d')](function(_0x146926){throw _0x146926;});}}}catch(_0x1775d2){logger[_0x45a2('0x40')]('[voiceQueueReport][queuesummary]',util[_0x45a2('0x42')](_0x1775d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x69')]=function(_0x5a05a3){if(this[_0x45a2('0x14')][_0x45a2('0x68')]>0x0){this[_0x45a2('0x14')][_0x45a2('0x6c')]=_0x5a05a3;return;}logger[_0x45a2('0x4b')](_0x45a2('0x6d'),util[_0x45a2('0x42')](_0x5a05a3,{'showHidden':![],'depth':null}));this[_0x45a2('0x14')]=initializeSummary();ami[_0x45a2('0x49')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x45a2('0xb')]['syncQueueCallerJoin']=function(_0x229bd6){try{if(this[_0x45a2('0x5b')](_0x229bd6)){logger['debug'](_0x45a2('0x6e'),_0x229bd6[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x229bd6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x229bd6['uniqueid']])){this[_0x45a2('0xf')][_0x229bd6['uniqueid']]=[];}if(_[_0x45a2('0x6f')](this[_0x45a2('0x38')][_0x229bd6[_0x45a2('0x4e')]])){this[_0x45a2('0x38')][_0x229bd6[_0x45a2('0x4e')]]={};}var _0x1c5a5f=new QueueReport();_0x1c5a5f[_0x45a2('0x51')]=_0x229bd6[_0x45a2('0x51')];_0x1c5a5f['type']=this[_0x45a2('0x46')][_0x1c5a5f[_0x45a2('0x51')]]&&this[_0x45a2('0x46')][_0x1c5a5f[_0x45a2('0x51')]][_0x45a2('0x57')]?this[_0x45a2('0x46')][_0x1c5a5f[_0x45a2('0x51')]][_0x45a2('0x57')]||_0x45a2('0x58'):_0x45a2('0x58');_0x1c5a5f[_0x45a2('0x70')]=moment()[_0x45a2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c5a5f[_0x45a2('0x71')]=_0x229bd6['position'];_0x1c5a5f[_0x45a2('0x72')]=_0x229bd6[_0x45a2('0x72')];_0x1c5a5f['uniqueid']=_0x229bd6[_0x45a2('0x4e')];logger[_0x45a2('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1c5a5f[_0x45a2('0x51')],_0x1c5a5f[_0x45a2('0x57')]);Object[_0x45a2('0x74')](_0x1c5a5f,_[_0x45a2('0x75')](_0x229bd6,_['keys'](_0x1c5a5f)));this['queueReports'][_0x229bd6[_0x45a2('0x4e')]][_0x45a2('0x6a')](_0x1c5a5f);this[_0x45a2('0x38')][_0x229bd6[_0x45a2('0x4e')]]=_0x1c5a5f;this[_0x45a2('0x4a')](_0x1c5a5f,'queuecallerjoin');}}catch(_0x27716e){logger['error'](_0x45a2('0x6e'),_0x229bd6[_0x45a2('0x4e')],util['inspect'](_0x27716e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x1e')]=function(_0x1b4dc2){try{if(this[_0x45a2('0x5b')](_0x1b4dc2)){logger['debug'](_0x45a2('0x76'),_0x1b4dc2[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x1b4dc2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1b4dc2['uniqueid']]){var _0x4a5bee=_['last'](this[_0x45a2('0xf')][_0x1b4dc2[_0x45a2('0x4e')]]);_0x4a5bee[_0x45a2('0x36')]=![];_0x4a5bee[_0x45a2('0x77')]=null;_0x4a5bee['holdtime']=_0x1b4dc2[_0x45a2('0x78')];_0x4a5bee[_0x45a2('0x79')]=_0x1b4dc2[_0x45a2('0x79')];_0x4a5bee[_0x45a2('0x1d')]=!![];_0x4a5bee[_0x45a2('0x7a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4a5bee['queuecallerexitreason']='ABANDONED';_0x4a5bee['lastAssignedTo']=null;logger['info'](_0x45a2('0x7b'),_0x4a5bee[_0x45a2('0x51')],_0x4a5bee[_0x45a2('0x57')]);this[_0x45a2('0x38')][_0x1b4dc2[_0x45a2('0x4e')]]=_0x4a5bee;this[_0x45a2('0x47')](_0x4a5bee,_0x45a2('0x1d'));}}}catch(_0x42aba7){logger[_0x45a2('0x40')](_0x45a2('0x76'),_0x1b4dc2[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x42aba7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x45a2('0xb')]['syncQueueCallerLeave']=function(_0x40098a){try{if(this[_0x45a2('0x5b')](_0x40098a)){logger[_0x45a2('0x4b')](_0x45a2('0x7c'),_0x40098a[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x40098a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x40098a['uniqueid']]){var _0x47b252=_[_0x45a2('0x7d')](this['queueReports'][_0x40098a[_0x45a2('0x4e')]]);_0x47b252['queuecallerleaveAt']=moment()[_0x45a2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x47b252[_0x45a2('0x7e')]=_0x40098a[_0x45a2('0x7e')];_0x47b252[_0x45a2('0x7f')]=_0x40098a[_0x45a2('0x7f')];logger[_0x45a2('0x73')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x47b252[_0x45a2('0x51')],_0x47b252[_0x45a2('0x57')],_0x40098a[_0x45a2('0x7e')],_0x40098a['connectedlinename']);this[_0x45a2('0x38')][_0x40098a[_0x45a2('0x4e')]]=_0x47b252;this[_0x45a2('0x4a')](_0x47b252,_0x45a2('0x1f'));}}}catch(_0x1ec167){logger[_0x45a2('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x40098a[_0x45a2('0x4e')],util['inspect'](_0x1ec167,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x45a2('0x23')]=function(_0x348571){try{if(this['isNotNull'](_0x348571)){logger[_0x45a2('0x4b')]('[%s][voiceQueueReport][agentconnect]',_0x348571['uniqueid'],util[_0x45a2('0x42')](_0x348571,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x348571[_0x45a2('0x4e')]]){var _0x488ea2=_['last'](this[_0x45a2('0xf')][_0x348571['uniqueid']]);_0x488ea2['queuecallercomplete']=!![];_0x488ea2[_0x45a2('0x80')]=_0x45a2('0x81');logger[_0x45a2('0x73')](_0x45a2('0x82'),_0x488ea2['queue'],_0x488ea2[_0x45a2('0x57')]);}}}catch(_0x40ff46){logger[_0x45a2('0x40')](_0x45a2('0x83'),_0x348571[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x40ff46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x22')]=function(_0x3a17a1){try{if(this[_0x45a2('0x5b')](_0x3a17a1)){logger[_0x45a2('0x4b')](_0x45a2('0x84'),_0x3a17a1[_0x45a2('0x4e')],util['inspect'](_0x3a17a1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3a17a1[_0x45a2('0x4e')]]){var _0x3ac8f3=_[_0x45a2('0x7d')](this[_0x45a2('0xf')][_0x3a17a1[_0x45a2('0x4e')]]);_0x3ac8f3[_0x45a2('0x1d')]=![];_0x3ac8f3[_0x45a2('0x7a')]=null;_0x3ac8f3['assigned']=!![];_0x3ac8f3[_0x45a2('0x85')]=_0x3a17a1[_0x45a2('0x86')];_0x3ac8f3['holdtime']=_0x3a17a1[_0x45a2('0x78')];_0x3ac8f3[_0x45a2('0x36')]=!![];_0x3ac8f3[_0x45a2('0x87')]=![];_0x3ac8f3[_0x45a2('0x88')]=null;if(!_0x3ac8f3['transfer']){if(_0x3a17a1[_0x45a2('0x89')]==_0x45a2('0x8a')){_0x3ac8f3['queuecallerexitreason']=_0x45a2('0x8b');logger[_0x45a2('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3ac8f3[_0x45a2('0x51')],_0x3ac8f3[_0x45a2('0x57')]);}else{if(_[_0x45a2('0x8c')](_0x3a17a1[_0x45a2('0x3c')][_0x45a2('0x8d')](),_0x45a2('0x8e'))){if(this['queueReports'][_0x3a17a1['linkedid']]){var _0x33b3c2=_[_0x45a2('0x7d')](this[_0x45a2('0xf')][_0x3a17a1[_0x45a2('0x8f')]]);_0x33b3c2[_0x45a2('0x36')]=![];_0x33b3c2[_0x45a2('0x87')]=!![];_0x33b3c2['queuecallerexitAt']=moment(_0x3ac8f3[_0x45a2('0x70')])['add'](_0x3a17a1[_0x45a2('0x78')],'seconds')[_0x45a2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x33b3c2['queuecallerexitreason']='FORWARDTRANSFER';_0x33b3c2['transfer']=!![];_0x33b3c2[_0x45a2('0x90')]=_0x45a2('0x91');_0x33b3c2[_0x45a2('0x92')]=_0x3a17a1[_0x45a2('0x93')];_0x33b3c2['transferuniqueid']=_0x3a17a1[_0x45a2('0x4e')];logger[_0x45a2('0x73')](_0x45a2('0x94'),_0x33b3c2['queue'],_0x33b3c2[_0x45a2('0x57')]);var _0x55586e=this[_0x45a2('0xf')][_0x3a17a1[_0x45a2('0x8f')]];this[_0x45a2('0xf')][_0x3a17a1['linkedid']]=this[_0x45a2('0xf')][_0x3a17a1[_0x45a2('0x4e')]];this[_0x45a2('0xf')][_0x3a17a1['uniqueid']]=_0x55586e;}}else{_0x3ac8f3[_0x45a2('0x80')]=_0x45a2('0x95')+_0x3a17a1['reason'][_0x45a2('0x96')]();logger['info'](_0x45a2('0x97'),_0x3ac8f3[_0x45a2('0x51')],_0x3ac8f3[_0x45a2('0x57')],_0x3ac8f3['queuecallerexitreason']);}}}this[_0x45a2('0x38')][_0x3a17a1[_0x45a2('0x4e')]]=_0x3ac8f3;}}}catch(_0x4d0f42){logger['error'](_0x45a2('0x84'),_0x3a17a1[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x4d0f42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x98')]=function(_0x970219){try{if(this[_0x45a2('0x5b')](_0x970219)){logger['debug'](_0x45a2('0x99'),_0x970219['uniqueid'],util[_0x45a2('0x42')](_0x970219,{'showHidden':![],'depth':null}));this[_0x45a2('0x9a')](_0x970219[_0x45a2('0x4e')],_[_0x45a2('0x9b')](_0x970219['variable'])[0x0],_0x970219[_0x45a2('0x9c')]);if(this['queueReports'][_0x970219[_0x45a2('0x4e')]]){var _0x21ff15=_['last'](this[_0x45a2('0xf')][_0x970219['uniqueid']]);if(_0x21ff15){if(this[_0x45a2('0x5b')](_0x970219[_0x45a2('0x9d')])&&this[_0x45a2('0x5b')](_0x970219[_0x45a2('0x9d')][_0x45a2('0x66')])){switch(_0x970219[_0x45a2('0x9c')]){case _0x45a2('0x9e'):_0x21ff15[_0x45a2('0x87')]=![];_0x21ff15[_0x45a2('0x88')]=null;break;case _0x45a2('0x9f'):_0x21ff15[_0x45a2('0xa0')]='timeout';_0x21ff15[_0x45a2('0x87')]=!![];_0x21ff15[_0x45a2('0x88')]=moment()[_0x45a2('0x4f')](_0x45a2('0xa1'));_0x21ff15['queuecallerleaveAt']=moment()[_0x45a2('0x4f')](_0x45a2('0xa1'));logger[_0x45a2('0x4b')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x970219[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x21ff15,{'showHidden':![],'depth':null}));ami[_0x45a2('0x49')](_0x45a2('0xa2'),_0x21ff15);break;default:_0x21ff15[_0x45a2('0x87')]=!![];_0x21ff15['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x21ff15['queuecallerleaveAt']=moment()[_0x45a2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21ff15[_0x45a2('0x1d')]=![];_0x21ff15[_0x45a2('0x7a')]=null;_0x21ff15[_0x45a2('0x80')]=_0x970219[_0x45a2('0x9c')];this[_0x45a2('0x38')][_0x970219[_0x45a2('0x4e')]]=_0x21ff15;this[_0x45a2('0x47')](_0x21ff15,_0x45a2('0xa3'));}else if(this[_0x45a2('0x5b')](_0x970219[_0x45a2('0x9d')])&&this[_0x45a2('0x5b')](_0x970219[_0x45a2('0x9d')]['queueposition'])){if(!_0x21ff15[_0x45a2('0x1d')]){_0x21ff15[_0x45a2('0x87')]=!![];_0x21ff15[_0x45a2('0x88')]=moment()[_0x45a2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x21ff15[_0x45a2('0x80')]=_0x45a2('0xa4');_0x21ff15[_0x45a2('0xa5')]=moment()['format'](_0x45a2('0xa1'));this['channels'][_0x970219[_0x45a2('0x4e')]]=_0x21ff15;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x970219[_0x45a2('0x4e')],_0x21ff15[_0x45a2('0x51')],_0x21ff15[_0x45a2('0x57')],_[_0x45a2('0x9b')](_0x970219[_0x45a2('0x9d')])[0x0],_0x970219[_0x45a2('0x9c')]);_0x21ff15[_0x45a2('0x15')]=this[_0x45a2('0x15')][_0x970219[_0x45a2('0x4e')]];}}}}catch(_0x1cd21e){logger[_0x45a2('0x40')](_0x45a2('0x99'),_0x970219[_0x45a2('0x4e')],util[_0x45a2('0x42')](_0x1cd21e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x45a2('0xb')][_0x45a2('0x9a')]=function(_0x43e49b,_0xdda2af,_0x254d46){var _0x2404ce=['rtpaudioqos',_0x45a2('0xa6'),_0x45a2('0xa7'),'rtpaudioqosjitterbridged',_0x45a2('0xa8'),_0x45a2('0xa9'),_0x45a2('0xaa'),_0x45a2('0xab'),_0x45a2('0xac'),_0x45a2('0xad'),'bridgepeer',_0x45a2('0xae'),_0x45a2('0xaf'),'memberdynamic',_0x45a2('0xb0'),_0x45a2('0xb1'),_0x45a2('0x86'),_0x45a2('0xb2'),_0x45a2('0xb3')];if(!_[_0x45a2('0x3a')](_0xdda2af)&&!_[_0x45a2('0xb4')](_0x2404ce,_0xdda2af)){if(_['isUndefined'](this[_0x45a2('0x15')][_0x43e49b])){this[_0x45a2('0x15')][_0x43e49b]={};}this[_0x45a2('0x15')][_0x43e49b][_0xdda2af]=_0x254d46;}};VoiceQueueReport[_0x45a2('0xb')]['handleHangup']=function(_0xc22110,_0x39706c,_0x178d2f){try{var _0xa80a50={};if(this[_0x45a2('0xf')][_0xc22110]){for(var _0x143e62=0x0;_0x143e62{delete this[_0x45a2('0x38')][_0x15b4a5];},_0x90b041);}};module[_0x45a2('0xee')]=VoiceQueueReport; \ No newline at end of file +var _0xf7c6=['type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','name','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','queue','inbound','outbound','statusRequests','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','completeEvent','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','last','queuecallercomplete','queuecallercompleteAt','holdtime','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','syncQueueCallerLeave','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','seconds','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','sumHoldTime','diff','COMPLETEDBYAGENT','milliseconds','answered','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','transferexten','origtransfererexten','origtransfereruniqueid','ATTENDED','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][blindtransfer]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','prototype','enqueue','tail','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','clearZombieChannels','channels','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove'];(function(_0x38eea5,_0x1736f9){var _0x2b30ac=function(_0x21bab3){while(--_0x21bab3){_0x38eea5['push'](_0x38eea5['shift']());}};_0x2b30ac(++_0x1736f9);}(_0xf7c6,0x9a));var _0x6f7c=function(_0x54d2bd,_0x57c539){_0x54d2bd=_0x54d2bd-0x0;var _0x34f0d4=_0xf7c6[_0x54d2bd];return _0x34f0d4;};'use strict';var _=require(_0x6f7c('0x0'));var moment=require(_0x6f7c('0x1'));var util=require(_0x6f7c('0x2'));var Redis=require(_0x6f7c('0x3'));var config=require(_0x6f7c('0x4'));var logger=require(_0x6f7c('0x5'))(_0x6f7c('0x6'));var ami=require('../ami');var QueueReport=require(_0x6f7c('0x7'));var VoiceQueueSummary=require(_0x6f7c('0x8'));config[_0x6f7c('0x9')]=_[_0x6f7c('0xa')](config[_0x6f7c('0x9')],{'host':_0x6f7c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6f7c('0x9')]));var Sequence=function(){};Sequence[_0x6f7c('0xc')][_0x6f7c('0xd')]=function(_0x4579ba){this[_0x6f7c('0xe')]=this[_0x6f7c('0xe')]?this[_0x6f7c('0xe')]['finally'](_0x4579ba):_0x4579ba();};function VoiceQueueReport(_0x634f8){this[_0x6f7c('0xf')]=new Sequence();this[_0x6f7c('0x10')]={};this[_0x6f7c('0x11')]=_0x634f8;this[_0x6f7c('0x12')]=_0x634f8[_0x6f7c('0x12')];this['channels']=_0x634f8[_0x6f7c('0x13')];this[_0x6f7c('0x14')]=_0x634f8[_0x6f7c('0x14')];this['campaigns']=_0x634f8[_0x6f7c('0x15')];this[_0x6f7c('0x16')]=initializeSummary();this[_0x6f7c('0x17')]={};ami['on']('queuesummary',this[_0x6f7c('0x18')][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x1a'),this[_0x6f7c('0x1b')][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x1c'),this[_0x6f7c('0x1d')][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x1e'),this['syncQueueStatusComplete'][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x1f'),this[_0x6f7c('0x20')]['bind'](this));ami['on'](_0x6f7c('0x21'),this[_0x6f7c('0x22')]['bind'](this));ami['on'](_0x6f7c('0x23'),this['syncQueueCallerLeave'][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x24'),this[_0x6f7c('0x25')][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x26'),this[_0x6f7c('0x27')][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x28'),this[_0x6f7c('0x29')][_0x6f7c('0x19')](this));ami['on']('hangup',this[_0x6f7c('0x2a')][_0x6f7c('0x19')](this));ami['on']('fullybooted',this[_0x6f7c('0x2b')][_0x6f7c('0x19')](this));ami['on'](_0x6f7c('0x2c'),this[_0x6f7c('0x2d')]['bind'](this));ami['on'](_0x6f7c('0x2e'),this[_0x6f7c('0x2f')]['bind'](this));ami['on']('attendedtransfer',this[_0x6f7c('0x30')]['bind'](this));ami['on'](_0x6f7c('0x31'),this[_0x6f7c('0x32')]['bind'](this));this[_0x6f7c('0x33')]();this['loopQueueShow']();}function clearChannels(_0x4f7e27){if(!_[_0x6f7c('0x34')](_0x4f7e27)){for(var _0x421110 in _0x4f7e27){if(_0x4f7e27[_0x6f7c('0x35')](_0x421110)){delete _0x4f7e27[_0x421110];}}}}function clearCampaigns(_0x112cec){if(!_[_0x6f7c('0x34')](_0x112cec)){for(var _0x45d42e in _0x112cec){if(_0x112cec[_0x6f7c('0x35')](_0x45d42e)){_0x112cec[_0x45d42e]['originated']=0x0;}}}}function clearVoiceQueues(_0x1658ec){if(!_['isEmpty'](_0x1658ec)){for(var _0x97965c in _0x1658ec){if(_0x1658ec['hasOwnProperty'](_0x97965c)){_0x1658ec[_0x97965c]['originated']=0x0;_0x1658ec[_0x97965c][_0x6f7c('0x36')]=0x0;_0x1658ec[_0x97965c][_0x6f7c('0x37')]=0x0;_0x1658ec[_0x97965c][_0x6f7c('0x38')]=0x0;_0x1658ec[_0x97965c][_0x6f7c('0x39')]=!![];}}}}function clearAgentBooked(_0x140721){if(!_[_0x6f7c('0x34')](_0x140721)){for(var _0x549abb in _0x140721){if(_0x140721[_0x6f7c('0x35')](_0x549abb)){_0x140721[_0x549abb][_0x6f7c('0x3a')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x2ca416){return _0x2ca416[_0x6f7c('0x3b')]||_0x2ca416[_0x6f7c('0x21')]||_0x2ca416['queuecallercomplete'];}VoiceQueueReport['prototype'][_0x6f7c('0x3c')]=function(){var _0x584019=this;for(var _0x3a64a5 in this['channels']){if(this[_0x6f7c('0x3d')][_0x6f7c('0x35')](_0x3a64a5)&&!this[_0x6f7c('0x3d')][_0x3a64a5][_0x6f7c('0x3e')]){this['sequence']['enqueue'](function(){if(!_[_0x6f7c('0x3f')](_0x584019[_0x6f7c('0x3d')][_0x3a64a5])){return ami[_0x6f7c('0x40')]({'action':_0x6f7c('0x41'),'channel':_0x584019[_0x6f7c('0x3d')][_0x3a64a5]['channel']})[_0x6f7c('0x42')](function(_0x43594e){if(_0x43594e[_0x6f7c('0x43')]===_0x6f7c('0x44')){setTimeout(function(){if(_0x584019[_0x6f7c('0x3d')][_0x3a64a5]){delete _0x584019['channels'][_0x3a64a5];logger[_0x6f7c('0x45')](_0x6f7c('0x46'),_0x3a64a5,util['inspect'](_0x43594e,{'showHidden':![],'depth':null}));}if(_0x584019['queueReports'][_0x3a64a5]){delete _0x584019[_0x6f7c('0x10')][_0x3a64a5];logger[_0x6f7c('0x45')](_0x6f7c('0x47'),_0x3a64a5,util['inspect'](_0x43594e,{'showHidden':![],'depth':null}));}if(_0x584019['variables'][_0x3a64a5]){delete _0x584019[_0x6f7c('0x17')][_0x3a64a5];logger['error'](_0x6f7c('0x48'),_0x3a64a5,util[_0x6f7c('0x49')](_0x43594e,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x2b')]=function(){logger[_0x6f7c('0x45')](_0x6f7c('0x4a'));clearChannels(this[_0x6f7c('0x3d')]);this['clearQueueReport'](this[_0x6f7c('0x10')]);clearAgentBooked(this[_0x6f7c('0x12')]);clearVoiceQueues(this[_0x6f7c('0x14')]);clearCampaigns(this['campaigns']);this[_0x6f7c('0x16')]=initializeSummary();};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x4b')]=function(_0x874e26){var _0x1a6ae7=this;if(!_['isEmpty'](_0x874e26)){for(var _0x4be07c in _0x874e26){if(_0x874e26[_0x6f7c('0x35')](_0x4be07c)){_0x1a6ae7[_0x6f7c('0x4c')](_0x874e26[_0x4be07c],_0x6f7c('0x4d'));delete _0x874e26[_0x4be07c];}}}};VoiceQueueReport['prototype'][_0x6f7c('0x4e')]=function(_0x4635f9,_0x36e9ca,_0x2f4b61){io['to'](_0x4635f9)[_0x6f7c('0x4e')](_0x36e9ca,_0x2f4b61);};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x4f')]=function(_0xb6ef82,_0x23f904){logger[_0x6f7c('0x50')](_0x6f7c('0x51')+_0x23f904+_0x6f7c('0x52'),_0xb6ef82[_0x6f7c('0x53')],util['inspect'](_0xb6ef82,{'showHidden':![],'depth':null}));this[_0x6f7c('0x4e')](util[_0x6f7c('0x54')]('voice:queue:%s',_0xb6ef82['queue']),'voice_queue_channel:save',_0xb6ef82);io[_0x6f7c('0x4e')]('voice_queue_presence:save',_0xb6ef82);};VoiceQueueReport[_0x6f7c('0xc')]['emitVoiceQueueChannelRemove']=function(_0x5d5924,_0x23fec6){logger[_0x6f7c('0x50')](_0x6f7c('0x51')+_0x23fec6+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x5d5924[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x5d5924,{'showHidden':![],'depth':null}));if(_0x5d5924[_0x6f7c('0x55')]===_0x6f7c('0x56')){return;}this[_0x6f7c('0x4e')](util[_0x6f7c('0x54')]('voice:queue:%s',_0x5d5924['queue']),_0x6f7c('0x57'),_0x5d5924);io['emit'](_0x6f7c('0x58'),_0x5d5924);};VoiceQueueReport['prototype']['emitInboundVoiceQueueSummary']=function(_0x2c883e){if(_0x2c883e[_0x6f7c('0x59')]==='inbound'){logger['debug'](_0x6f7c('0x5a'),util[_0x6f7c('0x49')](_0x2c883e,{'showHidden':![],'depth':null}));this[_0x6f7c('0x4e')](util[_0x6f7c('0x54')](_0x6f7c('0x5b'),_0x2c883e[_0x6f7c('0x5c')]),_0x6f7c('0x5d'),_0x2c883e);}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x5e')]=function(_0x22d22f){return _0x22d22f!==null&&!_[_0x6f7c('0x5f')](_0x22d22f);};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x60')]=function(){var _0x222b5b=this;setInterval(function(){_0x222b5b[_0x6f7c('0x3c')]();ami[_0x6f7c('0x40')]({'action':_0x6f7c('0x61')})['catch'](function(_0x10831f){logger[_0x6f7c('0x45')](_0x6f7c('0x62'),util[_0x6f7c('0x49')](_0x10831f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x33')]=function(){var _0x579b06=this;setInterval(function(){if(!_0x579b06[_0x6f7c('0x16')][_0x6f7c('0x63')]){return ami[_0x6f7c('0x40')]({'action':_0x6f7c('0x64')})[_0x6f7c('0x65')](function(_0x3a583e){_0x579b06['summary']['id']=_0x3a583e[_0x6f7c('0x66')];_0x579b06['summary'][_0x6f7c('0x63')]=!![];_0x579b06['summary'][_0x6f7c('0x67')][_0x3a583e[_0x6f7c('0x66')]]={};})[_0x6f7c('0x42')](function(_0x4080a3){logger[_0x6f7c('0x45')](_0x6f7c('0x68'),util[_0x6f7c('0x49')](_0x4080a3,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x69')]=function(_0x12fd45,_0x3c25c9){var _0x27473a;if(this[_0x6f7c('0x16')]&&this[_0x6f7c('0x16')][_0x6f7c('0x61')]&&this[_0x6f7c('0x16')][_0x6f7c('0x61')][_0x12fd45[_0x6f7c('0x5c')]]){_0x27473a=this[_0x6f7c('0x16')][_0x6f7c('0x61')][_0x12fd45['name']]['summaryEvent'];}var _0x43f86c=new VoiceQueueSummary(_0x12fd45);return _0x43f86c['createReport'](_0x3c25c9[_0x6f7c('0x12')],this[_0x6f7c('0x12')],_0x27473a,this[_0x6f7c('0x11')]['channels']);};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x6a')]=function(_0x42b07d,_0x131f49){var _0x1b4886=this[_0x6f7c('0x69')](_0x42b07d,_0x131f49);var _0x303dac=![];_0x303dac=_0x1b4886[_0x6f7c('0x6b')](_0x42b07d);if(_0x303dac){Object[_0x6f7c('0x6c')](_0x42b07d,_0x1b4886);this[_0x6f7c('0x11')]['voiceQueues'][_0x42b07d[_0x6f7c('0x5c')]]=_0x42b07d;this['emitInboundVoiceQueueSummary'](_0x1b4886);}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x6d')]=function(_0x299114){var _0x456e32=null;var _0x360d50=this[_0x6f7c('0x16')]['id'];if(this['summary']['queuestatus'][_0x360d50]){_0x456e32=this['summary'][_0x6f7c('0x67')][_0x360d50][_0x299114[_0x6f7c('0x66')]];}if(!_0x456e32){this[_0x6f7c('0x16')]=initializeSummary();return;}var _0x34b2e7=this[_0x6f7c('0x14')][_0x456e32[_0x6f7c('0x6e')]];if(_0x34b2e7[_0x6f7c('0x59')]===_0x6f7c('0x6f')){this[_0x6f7c('0x6a')](_0x34b2e7,_0x456e32);}else if(_0x34b2e7['type']===_0x6f7c('0x70')){var _0x130a64=this[_0x6f7c('0x69')](_0x34b2e7,_0x456e32);ami[_0x6f7c('0x4e')]('custom:queuesummary',_0x130a64);}this[_0x6f7c('0x16')][_0x6f7c('0x71')]-=0x1;var _0xfe4621=this[_0x6f7c('0x16')][_0x6f7c('0x71')]>0x0?!![]:![];if(!_0xfe4621){return this[_0x6f7c('0x1b')](this[_0x6f7c('0x16')]['completeEvent']);}};VoiceQueueReport[_0x6f7c('0xc')]['syncQueueMember']=function(_0x54e356){var _0x53ffe8=this[_0x6f7c('0x16')]['id'];if(this[_0x6f7c('0x16')][_0x6f7c('0x67')][_0x53ffe8]&&this[_0x6f7c('0x16')][_0x6f7c('0x67')][_0x53ffe8][_0x54e356[_0x6f7c('0x66')]]){this['summary'][_0x6f7c('0x67')][_0x53ffe8][_0x54e356[_0x6f7c('0x66')]][_0x6f7c('0x12')][_0x6f7c('0x72')](_0x54e356);}};VoiceQueueReport[_0x6f7c('0xc')]['syncQueueSummary']=function(_0x4b9fc6){var _0x37cd6f=this;try{if(this[_0x6f7c('0x5e')](_0x4b9fc6)&&this[_0x6f7c('0x5e')](_0x4b9fc6[_0x6f7c('0x6e')])){logger['debug'](_0x6f7c('0x73'),util[_0x6f7c('0x49')](_0x4b9fc6,{'showHidden':![],'depth':null}));var _0x4fe67d=this[_0x6f7c('0x14')][_0x4b9fc6[_0x6f7c('0x6e')]];if(_0x4fe67d){logger[_0x6f7c('0x50')](_0x6f7c('0x74'),_0x4fe67d['name']);this[_0x6f7c('0x16')]['queues'][_0x4fe67d['name']]={'summaryEvent':_0x4b9fc6};this[_0x6f7c('0x16')]['statusRequests']+=0x1;return ami[_0x6f7c('0x40')]({'action':_0x6f7c('0x67'),'queue':_0x4fe67d[_0x6f7c('0x5c')]})['then'](function(_0x22d0e8){if(!_0x37cd6f[_0x6f7c('0x16')][_0x6f7c('0x67')][_0x4b9fc6[_0x6f7c('0x66')]]){_0x37cd6f[_0x6f7c('0x16')][_0x6f7c('0x67')][_0x4b9fc6[_0x6f7c('0x66')]]={};}_0x37cd6f['summary'][_0x6f7c('0x67')][_0x4b9fc6[_0x6f7c('0x66')]][_0x22d0e8[_0x6f7c('0x66')]]={'queue':_0x4fe67d[_0x6f7c('0x5c')],'agents':[]};})[_0x6f7c('0x42')](function(_0x3873b8){throw _0x3873b8;});}}}catch(_0xce60f6){logger[_0x6f7c('0x45')](_0x6f7c('0x68'),util[_0x6f7c('0x49')](_0xce60f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x1b')]=function(_0x4588df){if(this[_0x6f7c('0x16')][_0x6f7c('0x71')]>0x0){this[_0x6f7c('0x16')][_0x6f7c('0x75')]=_0x4588df;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6f7c('0x49')](_0x4588df,{'showHidden':![],'depth':null}));this[_0x6f7c('0x16')]=initializeSummary();ami[_0x6f7c('0x4e')](_0x6f7c('0x76'),{});};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x20')]=function(_0x57e0c2){try{if(this[_0x6f7c('0x5e')](_0x57e0c2)){logger[_0x6f7c('0x50')](_0x6f7c('0x77'),_0x57e0c2[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x57e0c2,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x6f7c('0x10')][_0x57e0c2[_0x6f7c('0x53')]])){this[_0x6f7c('0x10')][_0x57e0c2[_0x6f7c('0x53')]]=[];}if(_['isUndefined'](this[_0x6f7c('0x3d')][_0x57e0c2[_0x6f7c('0x53')]])){this['channels'][_0x57e0c2[_0x6f7c('0x53')]]={};}var _0x2f5af8=new QueueReport();_0x2f5af8[_0x6f7c('0x6e')]=_0x57e0c2[_0x6f7c('0x6e')];_0x2f5af8['type']=this[_0x6f7c('0x14')][_0x2f5af8[_0x6f7c('0x6e')]]&&this[_0x6f7c('0x14')][_0x2f5af8['queue']][_0x6f7c('0x59')]?this[_0x6f7c('0x14')][_0x2f5af8[_0x6f7c('0x6e')]]['type']||_0x6f7c('0x6f'):'inbound';_0x2f5af8[_0x6f7c('0x78')]=moment()[_0x6f7c('0x54')](_0x6f7c('0x79'));_0x2f5af8[_0x6f7c('0x7a')]=_0x57e0c2[_0x6f7c('0x7a')];_0x2f5af8['count']=_0x57e0c2[_0x6f7c('0x7b')];_0x2f5af8[_0x6f7c('0x53')]=_0x57e0c2[_0x6f7c('0x53')];logger[_0x6f7c('0x7c')](_0x6f7c('0x7d'),_0x2f5af8[_0x6f7c('0x6e')],_0x2f5af8[_0x6f7c('0x59')]);Object[_0x6f7c('0x6c')](_0x2f5af8,_['pick'](_0x57e0c2,_['keys'](_0x2f5af8)));this['queueReports'][_0x57e0c2[_0x6f7c('0x53')]]['push'](_0x2f5af8);this[_0x6f7c('0x3d')][_0x57e0c2['uniqueid']]=_0x2f5af8;this['emitVoiceQueueChannelSave'](_0x2f5af8,'queuecallerjoin');}}catch(_0xd7f4f){logger[_0x6f7c('0x45')]('[%s][voiceQueueReport][queuecallerjoin]',_0x57e0c2[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0xd7f4f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')]['syncQueueCallerAbandon']=function(_0x22e6b6){try{if(this[_0x6f7c('0x5e')](_0x22e6b6)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x22e6b6[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x22e6b6,{'showHidden':![],'depth':null}));if(this[_0x6f7c('0x10')][_0x22e6b6[_0x6f7c('0x53')]]){var _0x9518fd=_[_0x6f7c('0x7e')](this['queueReports'][_0x22e6b6[_0x6f7c('0x53')]]);_0x9518fd[_0x6f7c('0x7f')]=![];_0x9518fd[_0x6f7c('0x80')]=null;_0x9518fd[_0x6f7c('0x81')]=_0x22e6b6['holdtime'];_0x9518fd['originalposition']=_0x22e6b6['originalposition'];_0x9518fd['queuecallerabandon']=!![];_0x9518fd['queuecallerabandonAt']=moment()[_0x6f7c('0x54')](_0x6f7c('0x79'));_0x9518fd['queuecallerexitreason']=_0x6f7c('0x82');_0x9518fd[_0x6f7c('0x83')]=null;logger[_0x6f7c('0x7c')](_0x6f7c('0x84'),_0x9518fd[_0x6f7c('0x6e')],_0x9518fd['type']);this[_0x6f7c('0x3d')][_0x22e6b6[_0x6f7c('0x53')]]=_0x9518fd;this[_0x6f7c('0x4c')](_0x9518fd,_0x6f7c('0x21'));}}}catch(_0x14660){logger[_0x6f7c('0x45')](_0x6f7c('0x85'),_0x22e6b6['uniqueid'],util[_0x6f7c('0x49')](_0x14660,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x86')]=function(_0x5babde){try{if(this[_0x6f7c('0x5e')](_0x5babde)){logger[_0x6f7c('0x50')]('[%s][voiceQueueReport][queuecallerleave]',_0x5babde['uniqueid'],util[_0x6f7c('0x49')](_0x5babde,{'showHidden':![],'depth':null}));if(this[_0x6f7c('0x10')][_0x5babde[_0x6f7c('0x53')]]){var _0x47709e=_['last'](this[_0x6f7c('0x10')][_0x5babde[_0x6f7c('0x53')]]);_0x47709e['queuecallerleaveAt']=moment()[_0x6f7c('0x54')](_0x6f7c('0x79'));_0x47709e[_0x6f7c('0x87')]=_0x5babde[_0x6f7c('0x87')];_0x47709e[_0x6f7c('0x88')]=_0x5babde['connectedlinename'];logger['info'](_0x6f7c('0x89'),_0x47709e[_0x6f7c('0x6e')],_0x47709e[_0x6f7c('0x59')],_0x5babde[_0x6f7c('0x87')],_0x5babde[_0x6f7c('0x88')]);this['channels'][_0x5babde[_0x6f7c('0x53')]]=_0x47709e;this['emitVoiceQueueChannelSave'](_0x47709e,'queuecallerleave');}}}catch(_0x5b03b3){logger['error'](_0x6f7c('0x8a'),_0x5babde[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x5b03b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x27')]=function(_0x21547f){try{if(this['isNotNull'](_0x21547f)){logger[_0x6f7c('0x50')](_0x6f7c('0x8b'),_0x21547f[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x21547f,{'showHidden':![],'depth':null}));if(this[_0x6f7c('0x10')][_0x21547f[_0x6f7c('0x53')]]){var _0x42ef42=_[_0x6f7c('0x7e')](this['queueReports'][_0x21547f['uniqueid']]);_0x42ef42[_0x6f7c('0x7f')]=!![];_0x42ef42[_0x6f7c('0x55')]='COMPLETEDBYAGENT';logger[_0x6f7c('0x7c')](_0x6f7c('0x8c'),_0x42ef42['queue'],_0x42ef42[_0x6f7c('0x59')]);}}}catch(_0x7daa79){logger[_0x6f7c('0x45')](_0x6f7c('0x8b'),_0x21547f[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x7daa79,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x25')]=function(_0x17485c){try{if(this[_0x6f7c('0x5e')](_0x17485c)){logger[_0x6f7c('0x50')](_0x6f7c('0x8d'),_0x17485c['uniqueid'],util[_0x6f7c('0x49')](_0x17485c,{'showHidden':![],'depth':null}));if(this[_0x6f7c('0x10')][_0x17485c['uniqueid']]){var _0xb87ef=_['last'](this['queueReports'][_0x17485c[_0x6f7c('0x53')]]);_0xb87ef['queuecallerabandon']=![];_0xb87ef[_0x6f7c('0x8e')]=null;_0xb87ef[_0x6f7c('0x8f')]=!![];_0xb87ef['lastAssignedTo']=_0x17485c['membername'];_0xb87ef[_0x6f7c('0x81')]=_0x17485c['holdtime'];_0xb87ef[_0x6f7c('0x7f')]=!![];_0xb87ef[_0x6f7c('0x3b')]=![];_0xb87ef[_0x6f7c('0x90')]=null;if(!_0xb87ef[_0x6f7c('0x91')]){if(_0x17485c[_0x6f7c('0x92')]==_0x6f7c('0x91')){_0xb87ef['queuecallerexitreason']=_0x6f7c('0x93');logger[_0x6f7c('0x7c')](_0x6f7c('0x94'),_0xb87ef[_0x6f7c('0x6e')],_0xb87ef['type']);}else{if(_['startsWith'](_0x17485c['channel'][_0x6f7c('0x95')](),_0x6f7c('0x96'))){if(this['queueReports'][_0x17485c[_0x6f7c('0x97')]]){var _0x5ce45c=_[_0x6f7c('0x7e')](this[_0x6f7c('0x10')][_0x17485c[_0x6f7c('0x97')]]);_0x5ce45c[_0x6f7c('0x7f')]=![];_0x5ce45c[_0x6f7c('0x3b')]=!![];_0x5ce45c['queuecallerexitAt']=moment(_0xb87ef['queuecallerjoinAt'])[_0x6f7c('0x98')](_0x17485c['holdtime'],_0x6f7c('0x99'))[_0x6f7c('0x54')](_0x6f7c('0x79'));_0x5ce45c[_0x6f7c('0x55')]='FORWARDTRANSFER';_0x5ce45c[_0x6f7c('0x91')]=!![];_0x5ce45c[_0x6f7c('0x9a')]=_0x6f7c('0x9b');_0x5ce45c['transferexten']=_0x17485c[_0x6f7c('0x9c')];_0x5ce45c[_0x6f7c('0x9d')]=_0x17485c[_0x6f7c('0x53')];logger[_0x6f7c('0x7c')](_0x6f7c('0x9e'),_0x5ce45c[_0x6f7c('0x6e')],_0x5ce45c[_0x6f7c('0x59')]);var _0x55650e=this[_0x6f7c('0x10')][_0x17485c[_0x6f7c('0x97')]];this['queueReports'][_0x17485c[_0x6f7c('0x97')]]=this['queueReports'][_0x17485c['uniqueid']];this[_0x6f7c('0x10')][_0x17485c[_0x6f7c('0x53')]]=_0x55650e;}}else{_0xb87ef['queuecallerexitreason']=_0x6f7c('0x9f')+_0x17485c[_0x6f7c('0x92')]['toUpperCase']();logger[_0x6f7c('0x7c')](_0x6f7c('0xa0'),_0xb87ef[_0x6f7c('0x6e')],_0xb87ef['type'],_0xb87ef['queuecallerexitreason']);}}}this[_0x6f7c('0x3d')][_0x17485c[_0x6f7c('0x53')]]=_0xb87ef;}}}catch(_0x4d5adf){logger[_0x6f7c('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x17485c[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x4d5adf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')][_0x6f7c('0x29')]=function(_0x549e26){try{if(this['isNotNull'](_0x549e26)){logger[_0x6f7c('0x50')](_0x6f7c('0xa1'),_0x549e26[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x549e26,{'showHidden':![],'depth':null}));this[_0x6f7c('0xa2')](_0x549e26[_0x6f7c('0x53')],_['keys'](_0x549e26[_0x6f7c('0xa3')])[0x0],_0x549e26[_0x6f7c('0xa4')]);if(this[_0x6f7c('0x10')][_0x549e26['uniqueid']]){var _0x11c5cb=_[_0x6f7c('0x7e')](this[_0x6f7c('0x10')][_0x549e26[_0x6f7c('0x53')]]);if(_0x11c5cb){if(this[_0x6f7c('0x5e')](_0x549e26[_0x6f7c('0xa3')])&&this['isNotNull'](_0x549e26['variable']['queuestatus'])){switch(_0x549e26['value']){case _0x6f7c('0xa5'):_0x11c5cb[_0x6f7c('0x3b')]=![];_0x11c5cb['queuecallerexitAt']=null;break;case _0x6f7c('0xa6'):_0x11c5cb['lastevent']='timeout';_0x11c5cb[_0x6f7c('0x3b')]=!![];_0x11c5cb['queuecallerexitAt']=moment()[_0x6f7c('0x54')](_0x6f7c('0x79'));_0x11c5cb[_0x6f7c('0xa7')]=moment()[_0x6f7c('0x54')](_0x6f7c('0x79'));logger[_0x6f7c('0x50')](_0x6f7c('0xa8'),_0x549e26[_0x6f7c('0x53')],util[_0x6f7c('0x49')](_0x11c5cb,{'showHidden':![],'depth':null}));ami[_0x6f7c('0x4e')](_0x6f7c('0xa9'),_0x11c5cb);break;default:_0x11c5cb[_0x6f7c('0x3b')]=!![];_0x11c5cb[_0x6f7c('0x90')]=moment()[_0x6f7c('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x11c5cb[_0x6f7c('0xa7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x11c5cb[_0x6f7c('0x21')]=![];_0x11c5cb['queuecallerabandonAt']=null;_0x11c5cb[_0x6f7c('0x55')]=_0x549e26['value'];this[_0x6f7c('0x3d')][_0x549e26[_0x6f7c('0x53')]]=_0x11c5cb;this['emitVoiceQueueChannelRemove'](_0x11c5cb,'varset');}else if(this[_0x6f7c('0x5e')](_0x549e26['variable'])&&this['isNotNull'](_0x549e26[_0x6f7c('0xa3')]['queueposition'])){if(!_0x11c5cb[_0x6f7c('0x21')]){_0x11c5cb['queuecallerexit']=!![];_0x11c5cb[_0x6f7c('0x90')]=moment()[_0x6f7c('0x54')](_0x6f7c('0x79'));_0x11c5cb['queuecallerexitreason']=_0x6f7c('0xaa');_0x11c5cb[_0x6f7c('0xa7')]=moment()[_0x6f7c('0x54')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6f7c('0x3d')][_0x549e26[_0x6f7c('0x53')]]=_0x11c5cb;}}logger[_0x6f7c('0x7c')](_0x6f7c('0xab'),_0x549e26[_0x6f7c('0x53')],_0x11c5cb['queue'],_0x11c5cb[_0x6f7c('0x59')],_[_0x6f7c('0xac')](_0x549e26[_0x6f7c('0xa3')])[0x0],_0x549e26[_0x6f7c('0xa4')]);_0x11c5cb['variables']=this['variables'][_0x549e26[_0x6f7c('0x53')]];}}}}catch(_0x151f43){logger[_0x6f7c('0x45')](_0x6f7c('0xa1'),_0x549e26[_0x6f7c('0x53')],util['inspect'](_0x151f43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f7c('0xc')]['addVariable']=function(_0x30cfa4,_0x43b6b8,_0x4d0f3a){var _0x1ddc49=[_0x6f7c('0xad'),_0x6f7c('0xae'),_0x6f7c('0xaf'),'rtpaudioqosjitterbridged',_0x6f7c('0xb0'),_0x6f7c('0xb1'),_0x6f7c('0xb2'),_0x6f7c('0xb3'),_0x6f7c('0xb4'),'sipuri',_0x6f7c('0xb5'),_0x6f7c('0xb6'),_0x6f7c('0xb7'),'memberdynamic',_0x6f7c('0xb8'),_0x6f7c('0xb9'),'membername',_0x6f7c('0xba'),_0x6f7c('0xbb')];if(!_[_0x6f7c('0x3f')](_0x43b6b8)&&!_[_0x6f7c('0xbc')](_0x1ddc49,_0x43b6b8)){if(_[_0x6f7c('0x5f')](this[_0x6f7c('0x17')][_0x30cfa4])){this[_0x6f7c('0x17')][_0x30cfa4]={};}this[_0x6f7c('0x17')][_0x30cfa4][_0x43b6b8]=_0x4d0f3a;}};VoiceQueueReport['prototype'][_0x6f7c('0xbd')]=function(_0x861a9c,_0x8c573b,_0x3316ec){try{var _0x58598c={};if(this['queueReports'][_0x861a9c]){for(var _0x6c7b2e=0x0;_0x6c7b2e{delete this[_0x6f7c('0x3d')][_0x3d362d];},_0x189472);}};module[_0x6f7c('0xf2')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 7b3fb95..5fd3dbd 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8c0=['campaign','queue','Request','CreateReportAgentPreview','createHistory'];(function(_0x5c978c,_0x1be5f8){var _0x4ca67d=function(_0x293563){while(--_0x293563){_0x5c978c['push'](_0x5c978c['shift']());}};_0x4ca67d(++_0x1be5f8);}(_0xf8c0,0xa4));var _0x0f8c=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xf8c0[_0x363ef8];return _0x148822;};'use strict';var client=require('../client');exports[_0x0f8c('0x0')]=function(_0x5d3faa){return function(){_0x5d3faa[_0x0f8c('0x1')]=_0x5d3faa[_0x0f8c('0x2')];return client[_0x0f8c('0x3')](_0x0f8c('0x4'),{'body':_0x5d3faa,'log':_0x0f8c('0x4')});};}; \ No newline at end of file +var _0xc02c=['queue','Request','CreateReportAgentPreview','../client','createHistory','campaign'];(function(_0x2fa60d,_0x250622){var _0x2fa3a2=function(_0x1082fd){while(--_0x1082fd){_0x2fa60d['push'](_0x2fa60d['shift']());}};_0x2fa3a2(++_0x250622);}(_0xc02c,0xf9));var _0xcc02=function(_0x5b4fc0,_0xc317ea){_0x5b4fc0=_0x5b4fc0-0x0;var _0x15e56a=_0xc02c[_0x5b4fc0];return _0x15e56a;};'use strict';var client=require(_0xcc02('0x0'));exports[_0xcc02('0x1')]=function(_0x4b3005){return function(){_0x4b3005[_0xcc02('0x2')]=_0x4b3005[_0xcc02('0x3')];return client[_0xcc02('0x4')](_0xcc02('0x5'),{'body':_0x4b3005,'log':_0xcc02('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 98f9613..f12c8c9 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed91=['CreateAttachment','create'];(function(_0x3bec27,_0x16d799){var _0x49aeb6=function(_0x7b12a7){while(--_0x7b12a7){_0x3bec27['push'](_0x3bec27['shift']());}};_0x49aeb6(++_0x16d799);}(_0xed91,0x185));var _0x1ed9=function(_0x163ddf,_0x4811cb){_0x163ddf=_0x163ddf-0x0;var _0x41ef47=_0xed91[_0x163ddf];return _0x41ef47;};'use strict';var client=require('../client');exports[_0x1ed9('0x0')]=function(_0x51b69a){return client['Request'](_0x1ed9('0x1'),{'body':_0x51b69a,'log':'CreateAttachment'});}; \ No newline at end of file +var _0x8435=['CreateAttachment','../client','Request'];(function(_0x38fff7,_0x3d2f6f){var _0x335292=function(_0x2c2470){while(--_0x2c2470){_0x38fff7['push'](_0x38fff7['shift']());}};_0x335292(++_0x3d2f6f);}(_0x8435,0x199));var _0x5843=function(_0x1c3942,_0x467403){_0x1c3942=_0x1c3942-0x0;var _0x1b3f87=_0x8435[_0x1c3942];return _0x1b3f87;};'use strict';var client=require(_0x5843('0x0'));exports['create']=function(_0x2ed0dc){return client[_0x5843('0x1')](_0x5843('0x2'),{'body':_0x2ed0dc,'log':_0x5843('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index b1bf222..88c5146 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x10b2c4,_0x4b10ed){var _0xb10a8e=function(_0x58ff68){while(--_0x58ff68){_0x10b2c4['push'](_0x10b2c4['shift']());}};_0xb10a8e(++_0x4b10ed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x3c3efd,_0x5e2bbb){var _0x1289a2=function(_0x5a8675){while(--_0x5a8675){_0x3c3efd['push'](_0x3c3efd['shift']());}};_0x1289a2(++_0x5e2bbb);}(_0x326f,0xd1));var _0xf326=function(_0xe91f6d,_0x2a23ed){_0xe91f6d=_0xe91f6d-0x0;var _0x14743d=_0x326f[_0xe91f6d];return _0x14743d;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 2146176..50c8aab 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c9f=['createContact','Request','CreateCmContact','getContacts','../client'];(function(_0xd0193e,_0x1b5dcf){var _0xc35f29=function(_0x50c076){while(--_0x50c076){_0xd0193e['push'](_0xd0193e['shift']());}};_0xc35f29(++_0x1b5dcf);}(_0x9c9f,0x112));var _0xf9c9=function(_0x412fef,_0x1cfa68){_0x412fef=_0x412fef-0x0;var _0x328cfc=_0x9c9f[_0x412fef];return _0x328cfc;};'use strict';var client=require(_0xf9c9('0x0'));exports[_0xf9c9('0x1')]=function(_0x16f622){return function(){return client[_0xf9c9('0x2')](_0xf9c9('0x3'),{'body':_0x16f622,'log':_0xf9c9('0x3')});};};exports[_0xf9c9('0x4')]=function(_0x4d3087){return function(){return client[_0xf9c9('0x2')]('GetCmContact',{'options':_0x4d3087,'log':'GetCmContact'});};}; \ No newline at end of file +var _0xab75=['CreateCmContact','getContacts','GetCmContact','../client'];(function(_0x585772,_0x3bb4e7){var _0x326a7d=function(_0x45f07e){while(--_0x45f07e){_0x585772['push'](_0x585772['shift']());}};_0x326a7d(++_0x3bb4e7);}(_0xab75,0x1b3));var _0x5ab7=function(_0x5a8c71,_0x5df04e){_0x5a8c71=_0x5a8c71-0x0;var _0x5d7432=_0xab75[_0x5a8c71];return _0x5d7432;};'use strict';var client=require(_0x5ab7('0x0'));exports['createContact']=function(_0x5470d8){return function(){return client['Request'](_0x5ab7('0x1'),{'body':_0x5470d8,'log':_0x5ab7('0x1')});};};exports[_0x5ab7('0x2')]=function(_0x16e5ca){return function(){return client['Request'](_0x5ab7('0x3'),{'options':_0x16e5ca,'log':_0x5ab7('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index d6098a9..44840f8 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff22=['CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','DestroyCmHopper','getContactDialer','GetContactDialer','priority','scheduledat','ASC','getContactDialerIvr','DESC','GetContactDialerIvr','moveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','Request','GetCmHopper'];(function(_0x1f3bb7,_0x1f9e28){var _0x34db2f=function(_0x4c504e){while(--_0x4c504e){_0x1f3bb7['push'](_0x1f3bb7['shift']());}};_0x34db2f(++_0x1f9e28);}(_0xff22,0x1a0));var _0x2ff2=function(_0x3757a2,_0xb8d1e7){_0x3757a2=_0x3757a2-0x0;var _0x5e4f4f=_0xff22[_0x3757a2];return _0x5e4f4f;};'use strict';var client=require(_0x2ff2('0x0'));var moment=require(_0x2ff2('0x1'));exports['getContacts']=function(_0x296971,_0x41445f){return function(){return client[_0x2ff2('0x2')](_0x2ff2('0x3'),{'options':{'where':{'VoiceQueueId':_0x296971},'include':[{'model':_0x2ff2('0x4'),'as':_0x2ff2('0x5')}],'limit':_0x41445f,'raw':![]},'log':_0x2ff2('0x6')});};};exports[_0x2ff2('0x7')]=function(_0x10bd59,_0x47906b,_0x21f303){return function(){return client[_0x2ff2('0x2')](_0x2ff2('0x8'),{'body':_0x10bd59,'options':{'where':{'VoiceQueueId':_0x47906b,'scheduledat':{'$lte':moment()[_0x2ff2('0x9')](_0x2ff2('0xa'))}},'limit':_0x21f303},'log':_0x2ff2('0x8')});};};exports[_0x2ff2('0xb')]=function(_0x5375c7){return client[_0x2ff2('0x2')](_0x2ff2('0x8'),{'body':_0x5375c7,'options':{'where':{'ContactId':_0x5375c7[_0x2ff2('0xc')],'ListId':_0x5375c7[_0x2ff2('0xd')],'VoiceQueueId':_0x5375c7[_0x2ff2('0xe')],'CampaignId':_0x5375c7['CampaignId']}},'log':'rescheduleContact'});};exports['destroyContact']=function(_0x421472,_0x3d504e,_0x484e93){return function(){return client[_0x2ff2('0x2')](_0x2ff2('0xf'),{'options':{'where':{'VoiceQueueId':_0x421472,'ListId':_0x3d504e,'ContactId':_0x484e93}},'log':_0x2ff2('0xf')});};};exports[_0x2ff2('0x10')]=function(_0x590e8e,_0xd6d578,_0x3ff99d,_0x1c95d6){return client[_0x2ff2('0x2')](_0x2ff2('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x590e8e,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0xd6d578}}]},'order':[[_0x2ff2('0x12'),'DESC'],[_0x2ff2('0x13'),_0x1c95d6],['id',_0x2ff2('0x14')]],'raw':!![],'limit':_0x3ff99d},'log':_0x2ff2('0x11')});};exports[_0x2ff2('0x15')]=function(_0x15c2af,_0x2f2476,_0xca38d7){return client['Request'](_0x2ff2('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x15c2af,'active':![],'scheduledat':{'$lte':moment()['format'](_0x2ff2('0xa'))}},'include':[{'model':_0x2ff2('0x4'),'as':_0x2ff2('0x5')}],'order':[[_0x2ff2('0x12'),_0x2ff2('0x16')],[_0x2ff2('0x13'),_0xca38d7],['id',_0x2ff2('0x14')]],'raw':!![],'limit':_0x2f2476},'log':_0x2ff2('0x17')});};exports[_0x2ff2('0x18')]=function(_0x506ddb,_0x4a0c0a){_0x506ddb['campaign']=_0x506ddb['queue'];return client[_0x2ff2('0x2')]('MoveContactManagedDialer',{'body':_0x506ddb,'options':{'where':{'ContactId':_0x506ddb[_0x2ff2('0xc')],'ListId':_0x506ddb['ListId'],'VoiceQueueId':_0x506ddb[_0x2ff2('0xe')],'CampaignId':_0x506ddb['CampaignId'],'active':_0x4a0c0a?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0x2ff2('0x19')]=function(_0x239d65){return client[_0x2ff2('0x2')](_0x2ff2('0x1a'),{'options':{'where':{'VoiceQueueId':_0x239d65['id']?_0x239d65['id']||null:null}},'log':_0x2ff2('0x19')});};exports[_0x2ff2('0x1b')]=function(_0x50db1a){return function(){return client['Request'](_0x2ff2('0x1c'),{'options':{'where':{'id':_0x50db1a},'include':[{'model':_0x2ff2('0x4'),'as':'Contact'},{'model':_0x2ff2('0x1d'),'as':_0x2ff2('0x1e'),'attributes':['id',_0x2ff2('0x1f')]},{'model':_0x2ff2('0x20'),'as':_0x2ff2('0x21'),'attributes':['id',_0x2ff2('0x1f')]}],'raw':!![]},'log':_0x2ff2('0x6')});};};exports[_0x2ff2('0x22')]=function(_0x5e3dec,_0x2a72c8,_0x568883){return client[_0x2ff2('0x2')]('UpdateCmHopper',{'body':_0x5e3dec,'options':{'where':{'id':_0x2a72c8},'limit':_0x568883},'log':_0x2ff2('0x8')});};exports[_0x2ff2('0x23')]=function(_0x1b8202,_0xadd615){return function(){return client[_0x2ff2('0x2')](_0x2ff2('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1b8202,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x2ff2('0x9')](_0x2ff2('0xa'))},'UserId':{'$in':_0xadd615}},'order':[['priority',_0x2ff2('0x16')],['scheduledat','DESC'],['id','ASC']],'include':[{'model':_0x2ff2('0x4'),'as':'Contact'},{'model':_0x2ff2('0x1d'),'as':'Agent','attributes':['id','name',_0x2ff2('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':'GetContactDialer'});};};exports[_0x2ff2('0x26')]=function(_0x12a6a2,_0x3f0c89){return client['Request'](_0x2ff2('0x27'),{'body':_0x12a6a2,'options':_0x3f0c89||{},'log':_0x2ff2('0x27')});};exports[_0x2ff2('0x28')]=function(_0x3b9dda,_0x34161d,_0x3d8f5b){return function(){return client[_0x2ff2('0x2')](_0x2ff2('0x29'),{'body':{'where':{'voiceQueueIds':_0x3b9dda,'interval':_0x34161d,'availableAgentsIds':_0x3d8f5b}},'log':_0x2ff2('0x28')});};}; \ No newline at end of file +var _0xf69d=['CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','scheduledat','getContactDialerIvr','DESC','ASC','moveContactManagedDialer','queue','MoveContactManagedDialer','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','VoiceQueue','getContactRecallMe','GetContactRecallMe','name','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications'];(function(_0x23d749,_0x29ac8c){var _0x1ccbcb=function(_0x423af8){while(--_0x423af8){_0x23d749['push'](_0x23d749['shift']());}};_0x1ccbcb(++_0x29ac8c);}(_0xf69d,0xd3));var _0xdf69=function(_0x1f9e5,_0x3f2788){_0x1f9e5=_0x1f9e5-0x0;var _0x2bb505=_0xf69d[_0x1f9e5];return _0x2bb505;};'use strict';var client=require(_0xdf69('0x0'));var moment=require(_0xdf69('0x1'));exports[_0xdf69('0x2')]=function(_0xe063fc,_0xf89475){return function(){return client['Request'](_0xdf69('0x3'),{'options':{'where':{'VoiceQueueId':_0xe063fc},'include':[{'model':_0xdf69('0x4'),'as':_0xdf69('0x5')}],'limit':_0xf89475,'raw':![]},'log':_0xdf69('0x6')});};};exports[_0xdf69('0x7')]=function(_0x18ce2b,_0x2d456f,_0x465b1b){return function(){return client[_0xdf69('0x8')](_0xdf69('0x9'),{'body':_0x18ce2b,'options':{'where':{'VoiceQueueId':_0x2d456f,'scheduledat':{'$lte':moment()[_0xdf69('0xa')](_0xdf69('0xb'))}},'limit':_0x465b1b},'log':_0xdf69('0x9')});};};exports[_0xdf69('0xc')]=function(_0x40217f){return client[_0xdf69('0x8')](_0xdf69('0x9'),{'body':_0x40217f,'options':{'where':{'ContactId':_0x40217f['ContactId'],'ListId':_0x40217f[_0xdf69('0xd')],'VoiceQueueId':_0x40217f[_0xdf69('0xe')],'CampaignId':_0x40217f[_0xdf69('0xf')]}},'log':_0xdf69('0xc')});};exports[_0xdf69('0x10')]=function(_0x1b86d4,_0x5ec0f2,_0x4ddcf5){return function(){return client['Request']('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x1b86d4,'ListId':_0x5ec0f2,'ContactId':_0x4ddcf5}},'log':_0xdf69('0x11')});};};exports[_0xdf69('0x12')]=function(_0x3b557c,_0x3225b4,_0x1156b3,_0x38aee2){return client['Request'](_0xdf69('0x13'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3b557c,'active':![],'scheduledat':{'$lte':moment()[_0xdf69('0xa')](_0xdf69('0xb'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x3225b4}}]},'order':[[_0xdf69('0x14'),'DESC'],[_0xdf69('0x15'),_0x38aee2],['id','ASC']],'raw':!![],'limit':_0x1156b3},'log':_0xdf69('0x13')});};exports[_0xdf69('0x16')]=function(_0x5263a4,_0x1831d3,_0x449908){return client[_0xdf69('0x8')](_0xdf69('0x13'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5263a4,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xdf69('0x4'),'as':_0xdf69('0x5')}],'order':[['priority',_0xdf69('0x17')],[_0xdf69('0x15'),_0x449908],['id',_0xdf69('0x18')]],'raw':!![],'limit':_0x1831d3},'log':'GetContactDialerIvr'});};exports[_0xdf69('0x19')]=function(_0x452cfa,_0x4d09d5){_0x452cfa['campaign']=_0x452cfa[_0xdf69('0x1a')];return client[_0xdf69('0x8')](_0xdf69('0x1b'),{'body':_0x452cfa,'options':{'where':{'ContactId':_0x452cfa['ContactId'],'ListId':_0x452cfa['ListId'],'VoiceQueueId':_0x452cfa['VoiceQueueId'],'CampaignId':_0x452cfa[_0xdf69('0xf')],'active':_0x4d09d5?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0xdf69('0x1c')]=function(_0x311534){return client[_0xdf69('0x8')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x311534['id']?_0x311534['id']||null:null}},'log':'countReScheduled'});};exports[_0xdf69('0x1d')]=function(_0x1437f6){return function(){return client[_0xdf69('0x8')](_0xdf69('0x1e'),{'options':{'where':{'id':_0x1437f6},'include':[{'model':'CmContact','as':_0xdf69('0x5')},{'model':_0xdf69('0x1f'),'as':_0xdf69('0x20'),'attributes':['id','name']},{'model':_0xdf69('0x21'),'as':'Queue','attributes':['id','name']}],'raw':!![]},'log':'getCmHopper'});};};exports['unlockContact']=function(_0x146b6a,_0xe339ac,_0x4fc007){return client[_0xdf69('0x8')](_0xdf69('0x9'),{'body':_0x146b6a,'options':{'where':{'id':_0xe339ac},'limit':_0x4fc007},'log':_0xdf69('0x9')});};exports[_0xdf69('0x22')]=function(_0x1b7c16,_0x1b57b3){return function(){return client[_0xdf69('0x8')](_0xdf69('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1b7c16,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xdf69('0xa')](_0xdf69('0xb'))},'UserId':{'$in':_0x1b57b3}},'order':[[_0xdf69('0x14'),_0xdf69('0x17')],[_0xdf69('0x15'),_0xdf69('0x17')],['id',_0xdf69('0x18')]],'include':[{'model':_0xdf69('0x4'),'as':_0xdf69('0x5')},{'model':'User','as':_0xdf69('0x20'),'attributes':['id',_0xdf69('0x24'),_0xdf69('0x25')]}],'group':_0xdf69('0x26'),'raw':!![]},'log':_0xdf69('0x13')});};};exports['resetActiveCalls']=function(_0x23335d,_0x5b136b){return client[_0xdf69('0x8')](_0xdf69('0x27'),{'body':_0x23335d,'options':_0x5b136b||{},'log':'ResetActiveCalls'});};exports[_0xdf69('0x28')]=function(_0x537484,_0x1ca0c6,_0x203a5d){return function(){return client[_0xdf69('0x8')](_0xdf69('0x29'),{'body':{'where':{'voiceQueueIds':_0x537484,'interval':_0x1ca0c6,'availableAgentsIds':_0x203a5d}},'log':_0xdf69('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index b277b0b..0fe2791 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x751e=['../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x31f357,_0x3ee66d){var _0x350aec=function(_0x2864c4){while(--_0x2864c4){_0x31f357['push'](_0x31f357['shift']());}};_0x350aec(++_0x3ee66d);}(_0x751e,0x19d));var _0xe751=function(_0x4a9203,_0x17f13b){_0x4a9203=_0x4a9203-0x0;var _0x512225=_0x751e[_0x4a9203];return _0x512225;};'use strict';var client=require(_0xe751('0x0'));exports[_0xe751('0x1')]=function(_0x4282d8,_0x432464,_0x1adacd){return client[_0xe751('0x2')]('VerifyAdditionalPhones',{'body':_0x4282d8,'reason':_0x432464,'entity':_0x1adacd,'log':_0xe751('0x3')});};exports['swapAdditionalPhones']=function(_0xea3f38,_0x4f36f3,_0x4e324d){return client[_0xe751('0x2')](_0xe751('0x4'),{'body':_0xea3f38,'duration':_0x4f36f3,'waitTime':_0x4e324d,'log':_0xe751('0x4')});};exports[_0xe751('0x5')]=function(_0x3f95d8){return function(){return client[_0xe751('0x2')](_0xe751('0x6'),{'body':_0x3f95d8,'log':_0xe751('0x6')});};}; \ No newline at end of file +var _0x3728=['VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','Request'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3728,0x12a));var _0x8372=function(_0x3df07f,_0x1cd571){_0x3df07f=_0x3df07f-0x0;var _0x233084=_0x3728[_0x3df07f];return _0x233084;};'use strict';var client=require(_0x8372('0x0'));exports['verifyAdditionalPhones']=function(_0x55ecfe,_0x3395ed,_0x1269ef){return client[_0x8372('0x1')](_0x8372('0x2'),{'body':_0x55ecfe,'reason':_0x3395ed,'entity':_0x1269ef,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x3a8bb7,_0x236efb,_0x3bb2d4){return client[_0x8372('0x1')](_0x8372('0x3'),{'body':_0x3a8bb7,'duration':_0x236efb,'waitTime':_0x3bb2d4,'log':_0x8372('0x3')});};exports[_0x8372('0x4')]=function(_0x433f49){return function(){return client[_0x8372('0x1')](_0x8372('0x5'),{'body':_0x433f49,'log':_0x8372('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 5cef613..8975f74 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3cd=['GetCmHopperBlackIvr','checkIsBlackList','Request','GetCmHopperBlack','phone','checkIsBlackListIvr'];(function(_0x4a758a,_0x151086){var _0x34fb40=function(_0x2e00df){while(--_0x2e00df){_0x4a758a['push'](_0x4a758a['shift']());}};_0x34fb40(++_0x151086);}(_0xa3cd,0x13f));var _0xda3c=function(_0x3ae826,_0x1a881e){_0x3ae826=_0x3ae826-0x0;var _0x4319a0=_0xa3cd[_0x3ae826];return _0x4319a0;};'use strict';var client=require('../client');exports[_0xda3c('0x0')]=function(_0x2e2972){return client[_0xda3c('0x1')](_0xda3c('0x2'),{'options':{'where':{'VoiceQueueId':_0x2e2972['VoiceQueueId'],'phone':_0x2e2972[_0xda3c('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xda3c('0x4')]=function(_0x51e97d){return client[_0xda3c('0x1')](_0xda3c('0x2'),{'options':{'where':{'CampaignId':_0x51e97d['CampaignId'],'phone':_0x51e97d[_0xda3c('0x3')]},'raw':![]},'log':_0xda3c('0x5')});}; \ No newline at end of file +var _0xd9c7=['GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9c7,0x187));var _0x7d9c=function(_0x164d9e,_0xcf087e){_0x164d9e=_0x164d9e-0x0;var _0x4fbc03=_0xd9c7[_0x164d9e];return _0x4fbc03;};'use strict';var client=require('../client');exports['checkIsBlackList']=function(_0x2d0adb){return client[_0x7d9c('0x0')](_0x7d9c('0x1'),{'options':{'where':{'VoiceQueueId':_0x2d0adb[_0x7d9c('0x2')],'phone':_0x2d0adb[_0x7d9c('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x7d9c('0x4')]=function(_0x6d97ca){return client[_0x7d9c('0x0')](_0x7d9c('0x1'),{'options':{'where':{'CampaignId':_0x6d97ca[_0x7d9c('0x5')],'phone':_0x6d97ca[_0x7d9c('0x3')]},'raw':![]},'log':_0x7d9c('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index aa5d4e6..ae84f1f 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d70=['campaign','queue','Request','CreateCmHopperFinal','createContact'];(function(_0x3e2583,_0x2d140f){var _0x5f1e3f=function(_0x1f342f){while(--_0x1f342f){_0x3e2583['push'](_0x3e2583['shift']());}};_0x5f1e3f(++_0x2d140f);}(_0x6d70,0x9f));var _0x06d7=function(_0x22a739,_0x30e527){_0x22a739=_0x22a739-0x0;var _0x301715=_0x6d70[_0x22a739];return _0x301715;};'use strict';var client=require('../client');exports[_0x06d7('0x0')]=function(_0x21174a){return function(){_0x21174a[_0x06d7('0x1')]=_0x21174a[_0x06d7('0x2')];return client[_0x06d7('0x3')](_0x06d7('0x4'),{'body':_0x21174a,'log':_0x06d7('0x4')});};}; \ No newline at end of file +var _0x5e08=['queue','CreateCmHopperFinal','../client','createContact'];(function(_0x1964db,_0x43df38){var _0x10c7fc=function(_0x27295b){while(--_0x27295b){_0x1964db['push'](_0x1964db['shift']());}};_0x10c7fc(++_0x43df38);}(_0x5e08,0x1da));var _0x85e0=function(_0x1be392,_0x33c546){_0x1be392=_0x1be392-0x0;var _0x1b9959=_0x5e08[_0x1be392];return _0x1b9959;};'use strict';var client=require(_0x85e0('0x0'));exports[_0x85e0('0x1')]=function(_0x2f3ab6){return function(){_0x2f3ab6['campaign']=_0x2f3ab6[_0x85e0('0x2')];return client['Request'](_0x85e0('0x3'),{'body':_0x2f3ab6,'log':_0x85e0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index bff6cac..48c9112 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d56=['getVoiceQueueHopperHistory','startOf','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory'];(function(_0x4a6809,_0x1195ba){var _0x324576=function(_0x45fd5e){while(--_0x45fd5e){_0x4a6809['push'](_0x4a6809['shift']());}};_0x324576(++_0x1195ba);}(_0x5d56,0x6b));var _0x65d5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5d56[_0x138adb];return _0x1b27f2;};'use strict';var client=require(_0x65d5('0x0'));var moment=require(_0x65d5('0x1'));exports[_0x65d5('0x2')]=function(_0x37a671){_0x37a671[_0x65d5('0x3')]=_0x37a671[_0x65d5('0x4')];return client[_0x65d5('0x5')]('CreateCmHopperHistory',{'body':_0x37a671,'log':_0x65d5('0x6')});};exports[_0x65d5('0x7')]=function(_0x1b5fd8){return client[_0x65d5('0x5')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x65d5('0x8')](_0x1b5fd8,_0x65d5('0x9'))[_0x65d5('0xa')](_0x65d5('0xb')),moment()[_0x65d5('0xa')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0x65d5('0xc')});};exports[_0x65d5('0xd')]=function(){return function(){return client[_0x65d5('0x5')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x65d5('0xe')](_0x65d5('0xf'))[_0x65d5('0xa')](_0x65d5('0xb')),moment()[_0x65d5('0x10')]('day')['format'](_0x65d5('0xb'))]},'campaigntype':_0x65d5('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x65d5('0x11')]=function(){return function(){return client[_0x65d5('0x5')](_0x65d5('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x65d5('0xe')](_0x65d5('0xf'))[_0x65d5('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x65d5('0xa')](_0x65d5('0xb'))]},'campaigntype':_0x65d5('0x13')},'raw':![]},'log':_0x65d5('0x12')});};}; \ No newline at end of file +var _0xba00=['Request','CreateCmHopperHistory','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','campaign','queue'];(function(_0x255028,_0x545ecd){var _0x55770d=function(_0x57ed22){while(--_0x57ed22){_0x255028['push'](_0x255028['shift']());}};_0x55770d(++_0x545ecd);}(_0xba00,0x10e));var _0x0ba0=function(_0x10f7d6,_0x573208){_0x10f7d6=_0x10f7d6-0x0;var _0x57f1a6=_0xba00[_0x10f7d6];return _0x57f1a6;};'use strict';var client=require('../client');var moment=require('moment');exports['createHistory']=function(_0x4bc4f0){_0x4bc4f0[_0x0ba0('0x0')]=_0x4bc4f0[_0x0ba0('0x1')];return client[_0x0ba0('0x2')]('CreateCmHopperHistory',{'body':_0x4bc4f0,'log':_0x0ba0('0x3')});};exports['avgHandleTime']=function(_0x1c76ea){return client['Request']('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x0ba0('0x4')](_0x1c76ea,_0x0ba0('0x5'))[_0x0ba0('0x6')](_0x0ba0('0x7')),moment()[_0x0ba0('0x6')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0x0ba0('0x8')});};exports[_0x0ba0('0x9')]=function(){return function(){return client[_0x0ba0('0x2')](_0x0ba0('0xa'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0ba0('0xb')](_0x0ba0('0xc'))['format'](_0x0ba0('0x7')),moment()[_0x0ba0('0xd')](_0x0ba0('0xc'))[_0x0ba0('0x6')](_0x0ba0('0x7'))]},'campaigntype':_0x0ba0('0x1')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x0ba0('0xe')]=function(){return function(){return client[_0x0ba0('0x2')](_0x0ba0('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0ba0('0xb')]('day')[_0x0ba0('0x6')](_0x0ba0('0x7')),moment()[_0x0ba0('0xd')](_0x0ba0('0xc'))[_0x0ba0('0x6')](_0x0ba0('0x7'))]},'campaigntype':'ivr'},'raw':![]},'log':_0x0ba0('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index fdee0f1..8c77533 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8357=['faxdetect','t38timeout','ListId','Trunk','callerid','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','name','description','ecm','headerinfo','localstationid','modem'];(function(_0xe52e99,_0x3dc174){var _0x2c240e=function(_0x425cf1){while(--_0x425cf1){_0xe52e99['push'](_0xe52e99['shift']());}};_0x2c240e(++_0x3dc174);}(_0x8357,0x1e4));var _0x7835=function(_0x10fe86,_0x284bff){_0x10fe86=_0x10fe86-0x0;var _0x337568=_0x8357[_0x10fe86];return _0x337568;};'use strict';var client=require(_0x7835('0x0'));exports[_0x7835('0x1')]=function(){return function(){return client[_0x7835('0x2')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0x7835('0x3'),_0x7835('0x4'),_0x7835('0x5'),_0x7835('0x6'),_0x7835('0x7'),'minrate','maxrate',_0x7835('0x8'),'gateway',_0x7835('0x9'),_0x7835('0xa'),'tech','TrunkId',_0x7835('0xb'),'key'],'include':[{'model':_0x7835('0xc'),'as':_0x7835('0xc'),'attributes':['id',_0x7835('0x3'),_0x7835('0xd'),'active']}]},'log':_0x7835('0xe')});};};exports[_0x7835('0xf')]=function(_0x193c57,_0x204c3f){return client[_0x7835('0x2')](_0x7835('0x10'),{'account':{'id':_0x193c57},'body':_0x204c3f,'log':_0x7835('0x10')});}; \ No newline at end of file +var _0x2015=['gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','active','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','minrate','maxrate','modem'];(function(_0x599e00,_0x412706){var _0x569a7f=function(_0x3b5ec6){while(--_0x3b5ec6){_0x599e00['push'](_0x599e00['shift']());}};_0x569a7f(++_0x412706);}(_0x2015,0x193));var _0x5201=function(_0x34f4f2,_0x4f3a7e){_0x34f4f2=_0x34f4f2-0x0;var _0x409574=_0x2015[_0x34f4f2];return _0x409574;};'use strict';var client=require(_0x5201('0x0'));exports[_0x5201('0x1')]=function(){return function(){return client[_0x5201('0x2')](_0x5201('0x3'),{'options':{'raw':![],'attributes':['id',_0x5201('0x4'),_0x5201('0x5'),_0x5201('0x6'),_0x5201('0x7'),'localstationid',_0x5201('0x8'),_0x5201('0x9'),_0x5201('0xa'),_0x5201('0xb'),_0x5201('0xc'),_0x5201('0xd'),_0x5201('0xe'),_0x5201('0xf'),_0x5201('0x10'),_0x5201('0x11')],'include':[{'model':'Trunk','as':_0x5201('0x12'),'attributes':['id',_0x5201('0x4'),'callerid',_0x5201('0x13')]}]},'log':_0x5201('0x14')});};};exports[_0x5201('0x15')]=function(_0x47aa66,_0x129e16){return client[_0x5201('0x2')](_0x5201('0x16'),{'account':{'id':_0x47aa66},'body':_0x129e16,'log':_0x5201('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 6fa7313..8eda61c 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f6a=['UpdateFaxMessage','../client','update','Request'];(function(_0x567d,_0x2f8123){var _0x3b7a37=function(_0x55e43b){while(--_0x55e43b){_0x567d['push'](_0x567d['shift']());}};_0x3b7a37(++_0x2f8123);}(_0x7f6a,0x1cd));var _0xa7f6=function(_0x3d69c0,_0x8740d8){_0x3d69c0=_0x3d69c0-0x0;var _0xfdaa89=_0x7f6a[_0x3d69c0];return _0xfdaa89;};'use strict';var client=require(_0xa7f6('0x0'));exports[_0xa7f6('0x1')]=function(_0x221587,_0xcd02eb){return client[_0xa7f6('0x2')](_0xa7f6('0x3'),{'body':_0xcd02eb,'options':{'where':{'AttachmentId':_0x221587}},'log':_0xa7f6('0x3')});}; \ No newline at end of file +var _0x9b2f=['update','UpdateFaxMessage','../client'];(function(_0x1cc846,_0x4e2462){var _0x39f701=function(_0x4a2b43){while(--_0x4a2b43){_0x1cc846['push'](_0x1cc846['shift']());}};_0x39f701(++_0x4e2462);}(_0x9b2f,0x65));var _0xf9b2=function(_0x345de7,_0x1de531){_0x345de7=_0x345de7-0x0;var _0x26ffc7=_0x9b2f[_0x345de7];return _0x26ffc7;};'use strict';var client=require(_0xf9b2('0x0'));exports[_0xf9b2('0x1')]=function(_0x172a33,_0x11d21e){return client['Request'](_0xf9b2('0x2'),{'body':_0x11d21e,'options':{'where':{'AttachmentId':_0x172a33}},'log':_0xf9b2('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index a9dbfb4..29ddbd3 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7929=['authType','DeskConfiguration','DeskField','Subjects','type','content','variableName','Variable','name','Descriptions','key','keyType','keyContent','Fields','idField','customField','Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','description','password','remoteUri'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7929,0x189));var _0x9792=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x7929[_0x4d8dc3];return _0x9b03d9;};'use strict';var client=require(_0x9792('0x0'));exports[_0x9792('0x1')]=function(){return function(_0x38c923){return client[_0x9792('0x2')](_0x9792('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9792('0x4'),'username',_0x9792('0x5'),_0x9792('0x6'),_0x9792('0x7'),'type','serverUrl'],'include':[{'model':_0x9792('0x8'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x9792('0x9'),'as':_0x9792('0xa'),'attributes':['id',_0x9792('0xb'),_0x9792('0xc'),_0x9792('0xd')],'include':[{'model':_0x9792('0xe'),'as':_0x9792('0xe'),'attributes':['id',_0x9792('0xf')]}]},{'model':_0x9792('0x9'),'as':_0x9792('0x10'),'attributes':['id',_0x9792('0xb'),'content',_0x9792('0x11'),_0x9792('0x12'),_0x9792('0x13'),_0x9792('0xd')],'include':[{'model':_0x9792('0xe'),'as':'Variable','attributes':['id',_0x9792('0xf')]}]},{'model':'DeskField','as':_0x9792('0x14'),'attributes':['id','type','content',_0x9792('0x15'),'nameField',_0x9792('0x16'),_0x9792('0xd')],'include':[{'model':_0x9792('0xe'),'as':_0x9792('0xe'),'attributes':['id','name']}]},{'model':_0x9792('0x17'),'as':_0x9792('0x18'),'attributes':['id','name']}]}]},'log':_0x9792('0x3')});};}; \ No newline at end of file +var _0x18df=['keyContent','Fields','idField','nameField','customField','Tag','Tags','getDeskAccounts','Request','GetDeskAccount','username','remoteUri','authType','type','serverUrl','DeskConfiguration','name','DeskField','Subjects','variableName','Variable','Descriptions','content'];(function(_0x3aa2b8,_0x31fa31){var _0xc5ea10=function(_0x33c0a4){while(--_0x33c0a4){_0x3aa2b8['push'](_0x3aa2b8['shift']());}};_0xc5ea10(++_0x31fa31);}(_0x18df,0x11b));var _0xf18d=function(_0x4eb895,_0x4eeb66){_0x4eb895=_0x4eb895-0x0;var _0x801f17=_0x18df[_0x4eb895];return _0x801f17;};'use strict';var client=require('../../client');exports[_0xf18d('0x0')]=function(){return function(_0x5621ab){return client[_0xf18d('0x1')](_0xf18d('0x2'),{'options':{'raw':![],'attributes':['id','name','description',_0xf18d('0x3'),'password',_0xf18d('0x4'),_0xf18d('0x5'),_0xf18d('0x6'),_0xf18d('0x7')],'include':[{'model':_0xf18d('0x8'),'as':'Configurations','attributes':['id',_0xf18d('0x9')],'include':[{'model':_0xf18d('0xa'),'as':_0xf18d('0xb'),'attributes':['id','type','content',_0xf18d('0xc')],'include':[{'model':_0xf18d('0xd'),'as':_0xf18d('0xd'),'attributes':['id',_0xf18d('0x9')]}]},{'model':_0xf18d('0xa'),'as':_0xf18d('0xe'),'attributes':['id',_0xf18d('0x6'),_0xf18d('0xf'),'key','keyType',_0xf18d('0x10'),_0xf18d('0xc')],'include':[{'model':_0xf18d('0xd'),'as':_0xf18d('0xd'),'attributes':['id',_0xf18d('0x9')]}]},{'model':_0xf18d('0xa'),'as':_0xf18d('0x11'),'attributes':['id',_0xf18d('0x6'),_0xf18d('0xf'),_0xf18d('0x12'),_0xf18d('0x13'),_0xf18d('0x14'),_0xf18d('0xc')],'include':[{'model':_0xf18d('0xd'),'as':_0xf18d('0xd'),'attributes':['id',_0xf18d('0x9')]}]},{'model':_0xf18d('0x15'),'as':_0xf18d('0x16'),'attributes':['id',_0xf18d('0x9')]}]}]},'log':_0xf18d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 05afbf8..117aabd 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['../../client','getDynamics365Accounts','Request','remoteUri','tenantId','clientSecret','description','modernAuthentication','Dynamics365Configuration','Configurations','name','ticketType','moduleCreate','openNewTab','Dynamics365Field','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','keyContent','nameField','CloudProvider','data2','data5'];(function(_0x52ab14,_0x23f001){var _0x559707=function(_0xdf8898){while(--_0xdf8898){_0x52ab14['push'](_0x52ab14['shift']());}};_0x559707(++_0x23f001);}(_0x7708,0x188));var _0x8770=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x7708[_0x28d18d];return _0x470640;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(){return function(_0x5ce108){return client[_0x8770('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id','name','username','password',_0x8770('0x3'),_0x8770('0x4'),'clientId',_0x8770('0x5'),'serverUrl',_0x8770('0x6'),_0x8770('0x7')],'include':[{'model':_0x8770('0x8'),'as':_0x8770('0x9'),'attributes':['id',_0x8770('0xa'),_0x8770('0xb'),_0x8770('0xc'),'additionalSearchContact',_0x8770('0xd')],'include':[{'model':_0x8770('0xe'),'as':_0x8770('0xf'),'attributes':['id','type',_0x8770('0x10'),_0x8770('0x11')],'include':[{'model':_0x8770('0x12'),'as':_0x8770('0x12'),'attributes':['id','name']}]},{'model':_0x8770('0xe'),'as':_0x8770('0x13'),'attributes':['id',_0x8770('0x14'),'content',_0x8770('0x15'),_0x8770('0x16'),_0x8770('0x17'),_0x8770('0x11')],'include':[{'model':_0x8770('0x12'),'as':_0x8770('0x12'),'attributes':['id',_0x8770('0xa')]}]},{'model':_0x8770('0xe'),'as':'Fields','attributes':['id',_0x8770('0x14'),_0x8770('0x10'),'idField',_0x8770('0x18'),'customField',_0x8770('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]},{'model':_0x8770('0x19'),'as':_0x8770('0x19'),'attributes':['id',_0x8770('0x1a'),_0x8770('0x1b'),'data7']}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file +var _0xb10b=['clientSecret','description','modernAuthentication','Configurations','name','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','variableName','Variable','type','content','key','keyType','keyContent','Fields','idField','nameField','customField','CloudProvider','data2','data5','data7','../../client','Request','GetDynamics365Account','username','password','remoteUri','tenantId','clientId'];(function(_0x5a2e9d,_0x24f07c){var _0x3ce833=function(_0x2cef35){while(--_0x2cef35){_0x5a2e9d['push'](_0x5a2e9d['shift']());}};_0x3ce833(++_0x24f07c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d368b,_0xbbc5db){_0x3d368b=_0x3d368b-0x0;var _0x579af1=_0xb10b[_0x3d368b];return _0x579af1;};'use strict';var client=require(_0xbb10('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x390ae2){return client[_0xbb10('0x1')](_0xbb10('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbb10('0x3'),_0xbb10('0x4'),_0xbb10('0x5'),_0xbb10('0x6'),_0xbb10('0x7'),_0xbb10('0x8'),'serverUrl',_0xbb10('0x9'),_0xbb10('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0xbb10('0xb'),'attributes':['id',_0xbb10('0xc'),_0xbb10('0xd'),_0xbb10('0xe'),_0xbb10('0xf'),_0xbb10('0x10')],'include':[{'model':_0xbb10('0x11'),'as':_0xbb10('0x12'),'attributes':['id','type','content',_0xbb10('0x13')],'include':[{'model':_0xbb10('0x14'),'as':_0xbb10('0x14'),'attributes':['id','name']}]},{'model':_0xbb10('0x11'),'as':'Descriptions','attributes':['id',_0xbb10('0x15'),_0xbb10('0x16'),_0xbb10('0x17'),_0xbb10('0x18'),_0xbb10('0x19'),_0xbb10('0x13')],'include':[{'model':'Variable','as':_0xbb10('0x14'),'attributes':['id',_0xbb10('0xc')]}]},{'model':_0xbb10('0x11'),'as':_0xbb10('0x1a'),'attributes':['id',_0xbb10('0x15'),_0xbb10('0x16'),_0xbb10('0x1b'),_0xbb10('0x1c'),_0xbb10('0x1d'),_0xbb10('0x13')],'include':[{'model':'Variable','as':_0xbb10('0x14'),'attributes':['id',_0xbb10('0xc')]}]}]},{'model':_0xbb10('0x1e'),'as':_0xbb10('0x1e'),'attributes':['id',_0xbb10('0x1f'),_0xbb10('0x20'),_0xbb10('0x21')]}]},'log':_0xbb10('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 7834719..5fe5e17 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3b7=['content','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','type'];(function(_0x1e9c3a,_0x518173){var _0x3eefb2=function(_0x3bb71f){while(--_0x3bb71f){_0x1e9c3a['push'](_0x1e9c3a['shift']());}};_0x3eefb2(++_0x518173);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xa3b7[_0x1b6c6d];return _0x290d9d;};'use strict';var client=require(_0x7a3b('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x30a17a){return client['Request'](_0x7a3b('0x1'),{'options':{'raw':![],'attributes':['id',_0x7a3b('0x2'),_0x7a3b('0x3'),_0x7a3b('0x4'),_0x7a3b('0x5'),_0x7a3b('0x6')],'include':[{'model':_0x7a3b('0x7'),'as':'Configurations','attributes':['id',_0x7a3b('0x2')],'include':[{'model':_0x7a3b('0x8'),'attributes':['id',_0x7a3b('0x2')]},{'model':_0x7a3b('0x9'),'as':_0x7a3b('0xa'),'attributes':['id',_0x7a3b('0xb'),_0x7a3b('0xc'),'variableName'],'include':[{'model':_0x7a3b('0xd'),'as':_0x7a3b('0xd'),'attributes':['id',_0x7a3b('0x2')]}]},{'model':_0x7a3b('0x9'),'as':_0x7a3b('0xe'),'attributes':['id',_0x7a3b('0xb'),'content',_0x7a3b('0xf'),_0x7a3b('0x10'),_0x7a3b('0x11'),'variableName'],'include':[{'model':_0x7a3b('0xd'),'as':_0x7a3b('0xd'),'attributes':['id','name']}]},{'model':_0x7a3b('0x9'),'as':_0x7a3b('0x12'),'attributes':['id',_0x7a3b('0xb'),'content',_0x7a3b('0x13'),_0x7a3b('0x14'),_0x7a3b('0x15'),'variableName'],'include':[{'model':_0x7a3b('0xd'),'as':_0x7a3b('0xd'),'attributes':['id','name']}]}]}]},'log':_0x7a3b('0x1')});};}; \ No newline at end of file +var _0x4e65=['remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Subjects','type','content','variableName','Variable','FreshdeskField','Descriptions','keyType','Fields','idField','nameField','customField','getFreshdeskAccounts','Request','GetFreshdeskAccount','name'];(function(_0x45ccf6,_0x187595){var _0x140e18=function(_0xf5582f){while(--_0xf5582f){_0x45ccf6['push'](_0x45ccf6['shift']());}};_0x140e18(++_0x187595);}(_0x4e65,0xc4));var _0x54e6=function(_0x1ac50e,_0x51d5ed){_0x1ac50e=_0x1ac50e-0x0;var _0x178029=_0x4e65[_0x1ac50e];return _0x178029;};'use strict';var client=require('../../client');exports[_0x54e6('0x0')]=function(){return function(_0x281452){return client[_0x54e6('0x1')](_0x54e6('0x2'),{'options':{'raw':![],'attributes':['id',_0x54e6('0x3'),'username','apiKey',_0x54e6('0x4'),_0x54e6('0x5')],'include':[{'model':_0x54e6('0x6'),'as':_0x54e6('0x7'),'attributes':['id',_0x54e6('0x3')],'include':[{'model':'Tag','attributes':['id',_0x54e6('0x3')]},{'model':'FreshdeskField','as':_0x54e6('0x8'),'attributes':['id',_0x54e6('0x9'),_0x54e6('0xa'),_0x54e6('0xb')],'include':[{'model':'Variable','as':_0x54e6('0xc'),'attributes':['id',_0x54e6('0x3')]}]},{'model':_0x54e6('0xd'),'as':_0x54e6('0xe'),'attributes':['id',_0x54e6('0x9'),_0x54e6('0xa'),'key',_0x54e6('0xf'),'keyContent',_0x54e6('0xb')],'include':[{'model':'Variable','as':_0x54e6('0xc'),'attributes':['id',_0x54e6('0x3')]}]},{'model':'FreshdeskField','as':_0x54e6('0x10'),'attributes':['id','type',_0x54e6('0xa'),_0x54e6('0x11'),_0x54e6('0x12'),_0x54e6('0x13'),_0x54e6('0xb')],'include':[{'model':_0x54e6('0xc'),'as':'Variable','attributes':['id',_0x54e6('0x3')]}]}]}]},'log':_0x54e6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index d985a51..950068e 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae30=['serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','keyContent','../../client','getFreshsalesAccounts','GetFreshsalesAccount','name','username','apiKey'];(function(_0x779496,_0x9b0b0b){var _0x472493=function(_0x18db79){while(--_0x18db79){_0x779496['push'](_0x779496['shift']());}};_0x472493(++_0x9b0b0b);}(_0xae30,0x10a));var _0x0ae3=function(_0x2d98f1,_0x21174b){_0x2d98f1=_0x2d98f1-0x0;var _0x701cc7=_0xae30[_0x2d98f1];return _0x701cc7;};'use strict';var client=require(_0x0ae3('0x0'));exports[_0x0ae3('0x1')]=function(){return function(_0x3a1fad){return client['Request'](_0x0ae3('0x2'),{'options':{'raw':![],'attributes':['id',_0x0ae3('0x3'),_0x0ae3('0x4'),_0x0ae3('0x5'),'remoteUri',_0x0ae3('0x6')],'include':[{'model':_0x0ae3('0x7'),'as':_0x0ae3('0x8'),'attributes':['id',_0x0ae3('0x3')],'include':[{'model':_0x0ae3('0x9'),'as':_0x0ae3('0xa'),'attributes':['id',_0x0ae3('0xb'),_0x0ae3('0xc'),_0x0ae3('0xd')],'include':[{'model':_0x0ae3('0xe'),'as':_0x0ae3('0xe'),'attributes':['id',_0x0ae3('0x3')]}]},{'model':_0x0ae3('0x9'),'as':'Descriptions','attributes':['id',_0x0ae3('0xb'),_0x0ae3('0xc'),'key','keyType',_0x0ae3('0xf'),_0x0ae3('0xd')],'include':[{'model':_0x0ae3('0xe'),'as':_0x0ae3('0xe'),'attributes':['id','name']}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x33af=['key','GetFreshsalesccount','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions'];(function(_0x3a73b7,_0x58ad60){var _0x3b2d9a=function(_0x50a908){while(--_0x50a908){_0x3a73b7['push'](_0x3a73b7['shift']());}};_0x3b2d9a(++_0x58ad60);}(_0x33af,0xec));var _0xf33a=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x33af[_0x3635ce];return _0x97ecd0;};'use strict';var client=require('../../client');exports[_0xf33a('0x0')]=function(){return function(_0x54b114){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'options':{'raw':![],'attributes':['id',_0xf33a('0x3'),_0xf33a('0x4'),_0xf33a('0x5'),_0xf33a('0x6'),'serverUrl'],'include':[{'model':_0xf33a('0x7'),'as':_0xf33a('0x8'),'attributes':['id','name'],'include':[{'model':_0xf33a('0x9'),'as':_0xf33a('0xa'),'attributes':['id',_0xf33a('0xb'),_0xf33a('0xc'),_0xf33a('0xd')],'include':[{'model':_0xf33a('0xe'),'as':'Variable','attributes':['id',_0xf33a('0x3')]}]},{'model':_0xf33a('0x9'),'as':_0xf33a('0xf'),'attributes':['id',_0xf33a('0xb'),_0xf33a('0xc'),_0xf33a('0x10'),'keyType','keyContent',_0xf33a('0xd')],'include':[{'model':_0xf33a('0xe'),'as':_0xf33a('0xe'),'attributes':['id',_0xf33a('0x3')]}]}]}]},'log':_0xf33a('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index ba27ebb..d0b3350 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5d1=['moduleCreate','SalesforceField','Subjects','Variable','Descriptions','Fields','GetSalesforceAccount','../../client','getSalesforceAccounts','Request','name','username','password','remoteUri','clientSecret','securityToken','serverUrl','SalesforceConfiguration','Configurations'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb5d1,0x1e2));var _0x1b5d=function(_0x3fc5d8,_0x3eb153){_0x3fc5d8=_0x3fc5d8-0x0;var _0x25307a=_0xb5d1[_0x3fc5d8];return _0x25307a;};'use strict';var client=require(_0x1b5d('0x0'));exports[_0x1b5d('0x1')]=function(){return function(_0x5963d2){return client[_0x1b5d('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x1b5d('0x3'),_0x1b5d('0x4'),_0x1b5d('0x5'),_0x1b5d('0x6'),'clientId',_0x1b5d('0x7'),_0x1b5d('0x8'),_0x1b5d('0x9'),'type'],'include':[{'model':_0x1b5d('0xa'),'as':_0x1b5d('0xb'),'attributes':['id',_0x1b5d('0x3'),'moduleSearch',_0x1b5d('0xc'),'ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x1b5d('0xd'),'as':_0x1b5d('0xe'),'include':[{'model':'Variable','as':_0x1b5d('0xf'),'attributes':['id',_0x1b5d('0x3')]}]},{'model':'SalesforceField','as':_0x1b5d('0x10'),'include':[{'model':_0x1b5d('0xf'),'as':_0x1b5d('0xf'),'attributes':['id',_0x1b5d('0x3')]}]},{'model':_0x1b5d('0xd'),'as':_0x1b5d('0x11'),'include':[{'model':_0x1b5d('0xf'),'as':_0x1b5d('0xf'),'attributes':['id',_0x1b5d('0x3')]}]}]}]},'log':_0x1b5d('0x12')});};}; \ No newline at end of file +var _0x0c99=['SalesforceConfiguration','Configurations','moduleSearch','additionalSearchAccount','additionalSearchContact','additionalSearchLead','Subjects','Variable','SalesforceField','Descriptions','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','name','username','password','clientId','clientSecret','securityToken'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0c99,0x1af));var _0x90c9=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x0c99[_0x496738];return _0xee1381;};'use strict';var client=require(_0x90c9('0x0'));exports[_0x90c9('0x1')]=function(){return function(_0x4175ff){return client['Request'](_0x90c9('0x2'),{'options':{'raw':![],'attributes':['id',_0x90c9('0x3'),_0x90c9('0x4'),_0x90c9('0x5'),'remoteUri',_0x90c9('0x6'),_0x90c9('0x7'),_0x90c9('0x8'),'serverUrl','type'],'include':[{'model':_0x90c9('0x9'),'as':_0x90c9('0xa'),'attributes':['id',_0x90c9('0x3'),_0x90c9('0xb'),'moduleCreate','ticketType','leadId',_0x90c9('0xc'),_0x90c9('0xd'),_0x90c9('0xe')],'include':[{'model':'SalesforceField','as':_0x90c9('0xf'),'include':[{'model':_0x90c9('0x10'),'as':_0x90c9('0x10'),'attributes':['id',_0x90c9('0x3')]}]},{'model':_0x90c9('0x11'),'as':_0x90c9('0x12'),'include':[{'model':'Variable','as':_0x90c9('0x10'),'attributes':['id',_0x90c9('0x3')]}]},{'model':'SalesforceField','as':_0x90c9('0x13'),'include':[{'model':_0x90c9('0x10'),'as':_0x90c9('0x10'),'attributes':['id',_0x90c9('0x3')]}]}]}]},'log':_0x90c9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 72471f2..b636f95 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['type','variableName','Variable','keyType','Fields','content','nameField','GetServicenowkAccount','../../client','Request','name','description','username','password','email','serverUrl','ServicenowConfiguration','ServicenowField'];(function(_0x469e89,_0x1096cf){var _0x5c1afb=function(_0x4993c5){while(--_0x4993c5){_0x469e89['push'](_0x469e89['shift']());}};_0x5c1afb(++_0x1096cf);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xee2f('0x0'));exports['getServicenowAccounts']=function(){return function(_0x521787){return client[_0xee2f('0x1')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id',_0xee2f('0x2'),_0xee2f('0x3'),_0xee2f('0x4'),_0xee2f('0x5'),_0xee2f('0x6'),'remoteUri',_0xee2f('0x7')],'include':[{'model':_0xee2f('0x8'),'as':'Configurations','attributes':['id',_0xee2f('0x2')],'include':[{'model':_0xee2f('0x9'),'as':'Subjects','attributes':['id',_0xee2f('0xa'),'content',_0xee2f('0xb')],'include':[{'model':_0xee2f('0xc'),'as':'Variable','attributes':['id',_0xee2f('0x2')]}]},{'model':_0xee2f('0x9'),'as':'Descriptions','attributes':['id','type','content','key',_0xee2f('0xd'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0xee2f('0xc'),'attributes':['id',_0xee2f('0x2')]}]},{'model':_0xee2f('0x9'),'as':_0xee2f('0xe'),'attributes':['id',_0xee2f('0xa'),_0xee2f('0xf'),'idField',_0xee2f('0x10'),'customField',_0xee2f('0xb')],'include':[{'model':_0xee2f('0xc'),'as':'Variable','attributes':['id',_0xee2f('0x2')]}]}]}]},'log':_0xee2f('0x11')});};}; \ No newline at end of file +var _0xc6ac=['GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x23442c,_0x96c78a){_0x23442c=_0x23442c-0x0;var _0x4fc185=_0xc6ac[_0x23442c];return _0x4fc185;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(){return function(_0x1b6e92){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc6a('0x4'),_0xcc6a('0x5'),_0xcc6a('0x6'),_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa')],'include':[{'model':_0xcc6a('0xb'),'as':_0xcc6a('0xc'),'attributes':['id','name'],'include':[{'model':_0xcc6a('0xd'),'as':_0xcc6a('0xe'),'attributes':['id',_0xcc6a('0xf'),'content',_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]},{'model':_0xcc6a('0xd'),'as':'Descriptions','attributes':['id',_0xcc6a('0xf'),_0xcc6a('0x12'),_0xcc6a('0x13'),'keyType',_0xcc6a('0x14'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xcc6a('0xd'),'as':_0xcc6a('0x15'),'attributes':['id',_0xcc6a('0xf'),'content','idField',_0xcc6a('0x16'),_0xcc6a('0x17'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]}]}]},'log':_0xcc6a('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index c6c8290..9012462 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['idField','nameField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','serverUrl','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','Fields'];(function(_0x44f575,_0x1df8c5){var _0x4d61e8=function(_0x1d0949){while(--_0x1d0949){_0x44f575['push'](_0x44f575['shift']());}};_0x4d61e8(++_0x1df8c5);}(_0xadb5,0xad));var _0x5adb=function(_0x37f279,_0x57d62b){_0x37f279=_0x37f279-0x0;var _0x3a058d=_0xadb5[_0x37f279];return _0x3a058d;};'use strict';var client=require('../../client');exports[_0x5adb('0x0')]=function(){return function(_0x49fc17){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x3'),'username',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x5adb('0x7'),'attributes':['id',_0x5adb('0x3')],'include':[{'model':_0x5adb('0x8'),'as':_0x5adb('0x9'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id',_0x5adb('0x3')]}]},{'model':_0x5adb('0x8'),'as':_0x5adb('0xe'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),'key','keyType',_0x5adb('0xf'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':'Variable','attributes':['id',_0x5adb('0x3')]}]},{'model':'SugarcrmField','as':_0x5adb('0x10'),'attributes':['id','type',_0x5adb('0xb'),_0x5adb('0x11'),_0x5adb('0x12'),'customField',_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id','name']}]}]}]},'log':_0x5adb('0x2')});};}; \ No newline at end of file +var _0x57ca=['name','username','password','remoteUri','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','nameField','getSugarcrmAccounts','GetSugarcrmAccount'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x57ca,0x108));var _0xa57c=function(_0x5cc275,_0x7e9f91){_0x5cc275=_0x5cc275-0x0;var _0x2ea48b=_0x57ca[_0x5cc275];return _0x2ea48b;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'serverUrl'],'include':[{'model':_0xa57c('0x6'),'as':_0xa57c('0x7'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc')],'include':[{'model':'Variable','as':_0xa57c('0xd'),'attributes':['id','name']}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0xe'),'attributes':['id','type',_0xa57c('0xb'),'key',_0xa57c('0xf'),_0xa57c('0x10'),'variableName'],'include':[{'model':_0xa57c('0xd'),'as':'Variable','attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0x11'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),'idField',_0xa57c('0x12'),'customField',_0xa57c('0xc')],'include':[{'model':_0xa57c('0xd'),'as':_0xa57c('0xd'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index a79cc8a..04f4cd9 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fb9=['serverUrl','VtigerConfiguration','name','type','content','variableName','Variable','VtigerField','Descriptions','keyType','keyContent','Fields','idField','nameField','customField','GetVtigerAccount','../../client','Request','description','username','accessKey','remoteUri'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x8fb9,0x144));var _0x98fb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8fb9[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x98fb('0x0'));exports['getVtigerAccounts']=function(){return function(_0x345f3f){return client[_0x98fb('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id','name',_0x98fb('0x2'),_0x98fb('0x3'),_0x98fb('0x4'),_0x98fb('0x5'),_0x98fb('0x6')],'include':[{'model':_0x98fb('0x7'),'as':'Configurations','attributes':['id',_0x98fb('0x8')],'include':[{'model':'VtigerField','as':'Subjects','attributes':['id',_0x98fb('0x9'),_0x98fb('0xa'),_0x98fb('0xb')],'include':[{'model':_0x98fb('0xc'),'as':_0x98fb('0xc'),'attributes':['id',_0x98fb('0x8')]}]},{'model':_0x98fb('0xd'),'as':_0x98fb('0xe'),'attributes':['id',_0x98fb('0x9'),_0x98fb('0xa'),'key',_0x98fb('0xf'),_0x98fb('0x10'),_0x98fb('0xb')],'include':[{'model':_0x98fb('0xc'),'as':'Variable','attributes':['id',_0x98fb('0x8')]}]},{'model':_0x98fb('0xd'),'as':_0x98fb('0x11'),'attributes':['id',_0x98fb('0x9'),_0x98fb('0xa'),_0x98fb('0x12'),_0x98fb('0x13'),_0x98fb('0x14'),_0x98fb('0xb')],'include':[{'model':_0x98fb('0xc'),'as':_0x98fb('0xc'),'attributes':['id',_0x98fb('0x8')]}]}]}]},'log':_0x98fb('0x15')});};}; \ No newline at end of file +var _0x395d=['content','Variable','VtigerField','type','keyType','keyContent','variableName','Fields','idField','customField','../../client','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations'];(function(_0x216b88,_0x170d43){var _0x5e79d7=function(_0x3b5ba3){while(--_0x3b5ba3){_0x216b88['push'](_0x216b88['shift']());}};_0x5e79d7(++_0x170d43);}(_0x395d,0x15a));var _0xd395=function(_0x33cf2d,_0x263c8a){_0x33cf2d=_0x33cf2d-0x0;var _0x5b2a5b=_0x395d[_0x33cf2d];return _0x5b2a5b;};'use strict';var client=require(_0xd395('0x0'));exports['getVtigerAccounts']=function(){return function(_0x3ccf88){return client[_0xd395('0x1')](_0xd395('0x2'),{'options':{'raw':![],'attributes':['id',_0xd395('0x3'),_0xd395('0x4'),_0xd395('0x5'),_0xd395('0x6'),_0xd395('0x7'),_0xd395('0x8')],'include':[{'model':_0xd395('0x9'),'as':_0xd395('0xa'),'attributes':['id','name'],'include':[{'model':'VtigerField','as':'Subjects','attributes':['id','type',_0xd395('0xb'),'variableName'],'include':[{'model':'Variable','as':_0xd395('0xc'),'attributes':['id','name']}]},{'model':_0xd395('0xd'),'as':'Descriptions','attributes':['id',_0xd395('0xe'),_0xd395('0xb'),'key',_0xd395('0xf'),_0xd395('0x10'),_0xd395('0x11')],'include':[{'model':_0xd395('0xc'),'as':_0xd395('0xc'),'attributes':['id','name']}]},{'model':_0xd395('0xd'),'as':_0xd395('0x12'),'attributes':['id',_0xd395('0xe'),_0xd395('0xb'),_0xd395('0x13'),'nameField',_0xd395('0x14'),_0xd395('0x11')],'include':[{'model':_0xd395('0xc'),'as':'Variable','attributes':['id',_0xd395('0x3')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index f1a7a66..b69068c 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95c9=['token','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyContent','idField','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request','name','username','password'];(function(_0x3aa737,_0x6a1a25){var _0x479c2e=function(_0x24b3c9){while(--_0x24b3c9){_0x3aa737['push'](_0x3aa737['shift']());}};_0x479c2e(++_0x6a1a25);}(_0x95c9,0x1bc));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x995c('0x0'));exports[_0x995c('0x1')]=function(){return function(_0x47bc83){return client[_0x995c('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x995c('0x3'),_0x995c('0x4'),_0x995c('0x5'),_0x995c('0x6'),'remoteUri',_0x995c('0x7'),_0x995c('0x8'),_0x995c('0x9')],'include':[{'model':_0x995c('0xa'),'as':_0x995c('0xb'),'attributes':['id',_0x995c('0x3')],'include':[{'model':_0x995c('0xc'),'attributes':['id','name']},{'model':_0x995c('0xd'),'as':_0x995c('0xe'),'attributes':['id',_0x995c('0x9'),_0x995c('0xf'),_0x995c('0x10')],'include':[{'model':_0x995c('0x11'),'as':'Variable','attributes':['id',_0x995c('0x3')]}]},{'model':'ZendeskField','as':_0x995c('0x12'),'attributes':['id',_0x995c('0x9'),_0x995c('0xf'),_0x995c('0x13'),'keyType',_0x995c('0x14'),_0x995c('0x10')],'include':[{'model':_0x995c('0x11'),'as':_0x995c('0x11'),'attributes':['id',_0x995c('0x3')]}]},{'model':_0x995c('0xd'),'as':'Fields','attributes':['id',_0x995c('0x9'),_0x995c('0xf'),_0x995c('0x15'),_0x995c('0x16'),_0x995c('0x17'),_0x995c('0x10')],'include':[{'model':_0x995c('0x11'),'as':_0x995c('0x11'),'attributes':['id',_0x995c('0x3')]}]}]}]},'log':_0x995c('0x18')});};}; \ No newline at end of file +var _0x8e30=['password','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','key','keyContent','Fields','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount','name'];(function(_0x107041,_0x3db815){var _0x3b49a8=function(_0x54859a){while(--_0x54859a){_0x107041['push'](_0x107041['shift']());}};_0x3b49a8(++_0x3db815);}(_0x8e30,0x134));var _0x08e3=function(_0xe4a693,_0x35750b){_0xe4a693=_0xe4a693-0x0;var _0x3461ca=_0x8e30[_0xe4a693];return _0x3461ca;};'use strict';var client=require('../../client');exports[_0x08e3('0x0')]=function(){return function(_0x5e7d40){return client[_0x08e3('0x1')](_0x08e3('0x2'),{'options':{'raw':![],'attributes':['id',_0x08e3('0x3'),'username',_0x08e3('0x4'),_0x08e3('0x5'),_0x08e3('0x6'),_0x08e3('0x7'),_0x08e3('0x8'),_0x08e3('0x9')],'include':[{'model':_0x08e3('0xa'),'as':_0x08e3('0xb'),'attributes':['id',_0x08e3('0x3')],'include':[{'model':_0x08e3('0xc'),'attributes':['id','name']},{'model':_0x08e3('0xd'),'as':_0x08e3('0xe'),'attributes':['id',_0x08e3('0x9'),_0x08e3('0xf'),_0x08e3('0x10')],'include':[{'model':_0x08e3('0x11'),'as':'Variable','attributes':['id',_0x08e3('0x3')]}]},{'model':_0x08e3('0xd'),'as':'Descriptions','attributes':['id',_0x08e3('0x9'),_0x08e3('0xf'),_0x08e3('0x12'),'keyType',_0x08e3('0x13'),'variableName'],'include':[{'model':_0x08e3('0x11'),'as':_0x08e3('0x11'),'attributes':['id',_0x08e3('0x3')]}]},{'model':'ZendeskField','as':_0x08e3('0x14'),'attributes':['id',_0x08e3('0x9'),_0x08e3('0xf'),_0x08e3('0x15'),_0x08e3('0x16'),_0x08e3('0x17'),_0x08e3('0x10')],'include':[{'model':_0x08e3('0x11'),'as':_0x08e3('0x11'),'attributes':['id',_0x08e3('0x3')]}]}]}]},'log':_0x08e3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index c044792..7aa518e 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdca5=['../../client','Request','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','ZohoField','type','content','variableName','Variable','key','keyType','keyContent','Fields','idField','nameField','customField','GetZohoAccount'];(function(_0x5d58ee,_0x34523f){var _0x29d8b7=function(_0x24b743){while(--_0x24b743){_0x5d58ee['push'](_0x5d58ee['shift']());}};_0x29d8b7(++_0x34523f);}(_0xdca5,0x144));var _0x5dca=function(_0x29e1c2,_0xf77f98){_0x29e1c2=_0x29e1c2-0x0;var _0xd71396=_0xdca5[_0x29e1c2];return _0xd71396;};'use strict';var client=require(_0x5dca('0x0'));exports['getZohoAccounts']=function(){return function(_0xe8ece2){return client[_0x5dca('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x5dca('0x2'),_0x5dca('0x3'),_0x5dca('0x4'),_0x5dca('0x5'),_0x5dca('0x6'),_0x5dca('0x7'),_0x5dca('0x8'),_0x5dca('0x9'),_0x5dca('0xa')],'include':[{'model':_0x5dca('0xb'),'as':'Configurations','attributes':['id',_0x5dca('0x2'),_0x5dca('0xc'),_0x5dca('0xd'),'description'],'include':[{'model':_0x5dca('0xe'),'as':'Subjects','attributes':['id',_0x5dca('0xf'),_0x5dca('0x10'),_0x5dca('0x11')],'include':[{'model':_0x5dca('0x12'),'as':'Variable','attributes':['id',_0x5dca('0x2')]}]},{'model':_0x5dca('0xe'),'as':'Descriptions','attributes':['id',_0x5dca('0xf'),_0x5dca('0x10'),_0x5dca('0x13'),_0x5dca('0x14'),_0x5dca('0x15'),_0x5dca('0x11')],'include':[{'model':_0x5dca('0x12'),'as':'Variable','attributes':['id',_0x5dca('0x2')]}]},{'model':_0x5dca('0xe'),'as':_0x5dca('0x16'),'attributes':['id',_0x5dca('0xf'),_0x5dca('0x10'),_0x5dca('0x17'),_0x5dca('0x18'),_0x5dca('0x19'),_0x5dca('0x11')],'include':[{'model':_0x5dca('0x12'),'as':_0x5dca('0x12'),'attributes':['id',_0x5dca('0x2')]}]}]}]},'log':_0x5dca('0x1a')});};}; \ No newline at end of file +var _0x801c=['Variable','ZohoField','Descriptions','content','key','keyType','Fields','idField','customField','../../client','GetZohoAccount','description','zone','clientId','clientSecret','refreshToken','Configurations','name','moduleCreate','moduleSearch','Subjects','type','variableName'];(function(_0x47c492,_0x311a27){var _0x32105d=function(_0x5b0289){while(--_0x5b0289){_0x47c492['push'](_0x47c492['shift']());}};_0x32105d(++_0x311a27);}(_0x801c,0x93));var _0xc801=function(_0x19d6c6,_0x355acc){_0x19d6c6=_0x19d6c6-0x0;var _0x1ff40=_0x801c[_0x19d6c6];return _0x1ff40;};'use strict';var client=require(_0xc801('0x0'));exports['getZohoAccounts']=function(){return function(_0x28f391){return client['Request'](_0xc801('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xc801('0x2'),'host',_0xc801('0x3'),_0xc801('0x4'),_0xc801('0x5'),'serverUrl','code',_0xc801('0x6')],'include':[{'model':'ZohoConfiguration','as':_0xc801('0x7'),'attributes':['id',_0xc801('0x8'),_0xc801('0x9'),_0xc801('0xa'),_0xc801('0x2')],'include':[{'model':'ZohoField','as':_0xc801('0xb'),'attributes':['id',_0xc801('0xc'),'content',_0xc801('0xd')],'include':[{'model':_0xc801('0xe'),'as':_0xc801('0xe'),'attributes':['id',_0xc801('0x8')]}]},{'model':_0xc801('0xf'),'as':_0xc801('0x10'),'attributes':['id',_0xc801('0xc'),_0xc801('0x11'),_0xc801('0x12'),_0xc801('0x13'),'keyContent',_0xc801('0xd')],'include':[{'model':_0xc801('0xe'),'as':_0xc801('0xe'),'attributes':['id','name']}]},{'model':_0xc801('0xf'),'as':_0xc801('0x14'),'attributes':['id',_0xc801('0xc'),_0xc801('0x11'),_0xc801('0x15'),'nameField',_0xc801('0x16'),_0xc801('0xd')],'include':[{'model':_0xc801('0xe'),'as':_0xc801('0xe'),'attributes':['id','name']}]}]}]},'log':_0xc801('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index a401df1..fe94943 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22c8=['stack','replace','trim','silly','intervalIftime\x20called\x20with','length','every','number','map','interval','concat','Request','IntervalIftime','../../../config/logger','dialer'];(function(_0x146f57,_0x996bfa){var _0x31620c=function(_0x2fad9b){while(--_0x2fad9b){_0x146f57['push'](_0x146f57['shift']());}};_0x31620c(++_0x996bfa);}(_0x22c8,0xdf));var _0x822c=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0x22c8[_0x54f3e8];return _0x267b37;};var logger=require(_0x822c('0x0'))(_0x822c('0x1'));var client=require('../client');function intervalIftime(_0x562208,_0x1608db){const _0x2398bc=new Error()[_0x822c('0x2')][_0x822c('0x3')](/^Error/,'')[_0x822c('0x4')]();logger[_0x822c('0x5')](_0x822c('0x6'),_0x562208,_0x1608db,_0x2398bc);const _0x50aeee=Array['isArray'](_0x562208);if(!_0x562208||_0x50aeee&&_0x562208[_0x822c('0x7')]===0x0){return Promise['resolve'](![]);}else{var _0xdb684d=[];var _0x35ba2d=[];var _0x45a20c=_0x50aeee?_0x562208:[_0x562208];var _0x26e793=_0x45a20c[_0x822c('0x8')](function(_0x5a83d5){return typeof _0x5a83d5===_0x822c('0x9');});var _0x1ce545=_0x45a20c[_0x822c('0x8')](function(_0x1102b4){return typeof _0x1102b4==='string';});if(!_0x26e793&&!_0x1ce545){_0xdb684d=_0x45a20c[_0x822c('0xa')](function(_0x183db7){return _0x183db7['id'];});if(_0xdb684d['length']===0x0){_0x35ba2d=_0x45a20c['map'](function(_0x24f906){return _0x24f906[_0x822c('0xb')];});}}else{if(_0x26e793){_0xdb684d=_0xdb684d[_0x822c('0xc')](_0x45a20c);}if(_0x1ce545){_0x35ba2d=_0x35ba2d[_0x822c('0xc')](_0x45a20c);}}return client[_0x822c('0xd')](_0x822c('0xe'),{'intervalIds':_0xdb684d,'intervals':_0x35ba2d,'timezone':_0x1608db,'log':_0x822c('0xe')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file +var _0x5c27=['map','interval','concat','IntervalIftime','../../../config/logger','dialer','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray','length','resolve','every','number','string'];(function(_0xbd2b22,_0x355445){var _0x191a33=function(_0x419972){while(--_0x419972){_0xbd2b22['push'](_0xbd2b22['shift']());}};_0x191a33(++_0x355445);}(_0x5c27,0x136));var _0x75c2=function(_0x5d6482,_0x1c9b00){_0x5d6482=_0x5d6482-0x0;var _0x32e681=_0x5c27[_0x5d6482];return _0x32e681;};var logger=require(_0x75c2('0x0'))(_0x75c2('0x1'));var client=require('../client');function intervalIftime(_0x3f07c2,_0x1975bb){const _0x164228=new Error()[_0x75c2('0x2')][_0x75c2('0x3')](/^Error/,'')[_0x75c2('0x4')]();logger[_0x75c2('0x5')](_0x75c2('0x6'),_0x3f07c2,_0x1975bb,_0x164228);const _0x58bfe5=Array[_0x75c2('0x7')](_0x3f07c2);if(!_0x3f07c2||_0x58bfe5&&_0x3f07c2[_0x75c2('0x8')]===0x0){return Promise[_0x75c2('0x9')](![]);}else{var _0xd1302e=[];var _0x29888d=[];var _0x548c50=_0x58bfe5?_0x3f07c2:[_0x3f07c2];var _0x5e4907=_0x548c50[_0x75c2('0xa')](function(_0x594b47){return typeof _0x594b47===_0x75c2('0xb');});var _0x3e293f=_0x548c50[_0x75c2('0xa')](function(_0x111e23){return typeof _0x111e23===_0x75c2('0xc');});if(!_0x5e4907&&!_0x3e293f){_0xd1302e=_0x548c50[_0x75c2('0xd')](function(_0x2af97b){return _0x2af97b['id'];});if(_0xd1302e['length']===0x0){_0x29888d=_0x548c50[_0x75c2('0xd')](function(_0x2b6625){return _0x2b6625[_0x75c2('0xe')];});}}else{if(_0x5e4907){_0xd1302e=_0xd1302e[_0x75c2('0xf')](_0x548c50);}if(_0x3e293f){_0x29888d=_0x29888d[_0x75c2('0xf')](_0x548c50);}}return client['Request'](_0x75c2('0x10'),{'intervalIds':_0xd1302e,'intervals':_0x29888d,'timezone':_0x1975bb,'log':_0x75c2('0x10')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index e4ca7ad..911ed24 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd91a=['format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','diff','outbound','dialstring','agent','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd91a,0x1b4));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var _=require(_0xad91('0x0'));var util=require(_0xad91('0x1'));var client=require(_0xad91('0x2'));exports[_0xad91('0x3')]=function(_0x4317d9){var _0x558a05=_0x4317d9[_0xad91('0x4')]||_0x4317d9[_0xad91('0x5')];return client[_0xad91('0x6')](_0xad91('0x7'),{'body':{'channel':_0xad91('0x8'),'membername':_0x4317d9[_0xad91('0x9')],'interface':_[_0xad91('0xa')](_0x4317d9[_0xad91('0xb')])?util[_0xad91('0xc')](_0xad91('0xd'),_0x4317d9[_0xad91('0x9')]):_0x4317d9[_0xad91('0xb')],'type':_0xad91('0xe'),'enterAt':_0x4317d9[_0xad91('0xf')],'exitAt':_0x558a05,'duration':moment(_0x558a05)['diff'](_0x4317d9['queuecallerleaveAt'],_0xad91('0x10')),'data1':_0xad91('0x11'),'data2':_0x4317d9[_0xad91('0x12')],'data3':_0x4317d9[_0xad91('0x13')],'data4':null,'data5':_0x4317d9[_0xad91('0x14')],'role':'agent','internal':_0x4317d9[_0xad91('0x15')]?_[_0xad91('0x16')](_0x4317d9[_0xad91('0x15')]):undefined,'uniqueid':_0x4317d9[_0xad91('0x17')]},'log':_0xad91('0x7')});};exports[_0xad91('0x18')]=function(_0x685665){return client['Request'](_0xad91('0x7'),{'body':{'channel':_0xad91('0x8'),'membername':_0x685665[_0xad91('0x19')],'interface':_0x685665['interface'],'type':_0xad91('0xe'),'enterAt':_0x685665['starttime'],'exitAt':_0x685665[_0xad91('0x1a')],'duration':moment(_0x685665[_0xad91('0x1a')])['diff'](_0x685665[_0xad91('0x1b')],_0xad91('0x10'))>=0x0?moment(_0x685665['endtime'])[_0xad91('0x1c')](_0x685665['starttime'],_0xad91('0x10')):null,'data1':_0xad91('0x1d'),'data2':_0x685665['accountcode'],'data3':_0x685665['exten'],'data4':_0x685665[_0xad91('0x1e')]||null,'role':_0xad91('0x1f'),'internal':_0x685665['accountcode']?_[_0xad91('0x16')](_0x685665[_0xad91('0x15')]):undefined,'uniqueid':_0x685665[_0xad91('0x17')]},'log':_0xad91('0x7')});}; \ No newline at end of file +var _0xf7d0=['isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','outbound','dialstring','moment','util','../client','queuecallercompleteAt','Request','voice','lastAssignedTo'];(function(_0x10b9b3,_0x171a81){var _0x3548bf=function(_0x58fd48){while(--_0x58fd48){_0x10b9b3['push'](_0x10b9b3['shift']());}};_0x3548bf(++_0x171a81);}(_0xf7d0,0x69));var _0x0f7d=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xf7d0[_0x307d86];return _0x361745;};'use strict';var moment=require(_0x0f7d('0x0'));var _=require('lodash');var util=require(_0x0f7d('0x1'));var client=require(_0x0f7d('0x2'));exports['voiceQueueReport']=function(_0x57ea9e){var _0x2c40b1=_0x57ea9e[_0x0f7d('0x3')]||_0x57ea9e['queuecallerexitAt'];return client[_0x0f7d('0x4')]('CreateMemberReport',{'body':{'channel':_0x0f7d('0x5'),'membername':_0x57ea9e[_0x0f7d('0x6')],'interface':_[_0x0f7d('0x7')](_0x57ea9e[_0x0f7d('0x8')])?util[_0x0f7d('0x9')](_0x0f7d('0xa'),_0x57ea9e['lastAssignedTo']):_0x57ea9e['interface'],'type':_0x0f7d('0xb'),'enterAt':_0x57ea9e[_0x0f7d('0xc')],'exitAt':_0x2c40b1,'duration':moment(_0x2c40b1)[_0x0f7d('0xd')](_0x57ea9e[_0x0f7d('0xc')],_0x0f7d('0xe')),'data1':_0x0f7d('0xf'),'data2':_0x57ea9e[_0x0f7d('0x10')],'data3':_0x57ea9e['exten'],'data4':null,'data5':_0x57ea9e[_0x0f7d('0x11')],'role':_0x0f7d('0x12'),'internal':_0x57ea9e[_0x0f7d('0x13')]?_[_0x0f7d('0x14')](_0x57ea9e[_0x0f7d('0x13')]):undefined,'uniqueid':_0x57ea9e[_0x0f7d('0x15')]},'log':_0x0f7d('0x16')});};exports[_0x0f7d('0x17')]=function(_0x1214ed){return client[_0x0f7d('0x4')](_0x0f7d('0x16'),{'body':{'channel':'voice','membername':_0x1214ed[_0x0f7d('0x18')],'interface':_0x1214ed['interface'],'type':'TALKING','enterAt':_0x1214ed[_0x0f7d('0x19')],'exitAt':_0x1214ed['endtime'],'duration':moment(_0x1214ed['endtime'])['diff'](_0x1214ed[_0x0f7d('0x19')],_0x0f7d('0xe'))>=0x0?moment(_0x1214ed['endtime'])[_0x0f7d('0xd')](_0x1214ed['starttime'],_0x0f7d('0xe')):null,'data1':_0x0f7d('0x1a'),'data2':_0x1214ed[_0x0f7d('0x13')],'data3':_0x1214ed['exten'],'data4':_0x1214ed[_0x0f7d('0x1b')]||null,'role':_0x0f7d('0x12'),'internal':_0x1214ed['accountcode']?_[_0x0f7d('0x14')](_0x1214ed[_0x0f7d('0x13')]):undefined,'uniqueid':_0x1214ed[_0x0f7d('0x15')]},'log':_0x0f7d('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index dd8e4e1..4c5b04f 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 _0x63c6=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x259ece,_0x11b711){var _0x1d013e=function(_0x522f9c){while(--_0x522f9c){_0x259ece['push'](_0x259ece['shift']());}};_0x1d013e(++_0x11b711);}(_0x63c6,0xbb));var _0x663c=function(_0x32b0c6,_0x35ef2d){_0x32b0c6=_0x32b0c6-0x0;var _0x338576=_0x63c6[_0x32b0c6];return _0x338576;};'use strict';var client=require(_0x663c('0x0'));exports[_0x663c('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x663c('0x2'),_0x663c('0x3')]},'log':_0x663c('0x4')});}; \ No newline at end of file +var _0x4227=['GetSettings','../client','ShowSetting','previewRecallmeReminderInterval'];(function(_0x267e2c,_0x10094d){var _0x5258f3=function(_0x593546){while(--_0x593546){_0x267e2c['push'](_0x267e2c['shift']());}};_0x5258f3(++_0x10094d);}(_0x4227,0x89));var _0x7422=function(_0x5657a3,_0x54d44e){_0x5657a3=_0x5657a3-0x0;var _0x2620c3=_0x4227[_0x5657a3];return _0x2620c3;};'use strict';var client=require(_0x7422('0x0'));exports['getSettings']=function(){return client['Request'](_0x7422('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x7422('0x2')]},'log':_0x7422('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9d43dd9..b7c778a 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 _0xc15c=['Request','name'];(function(_0x4f0ded,_0x4db73d){var _0x26b21c=function(_0x1fd91d){while(--_0x1fd91d){_0x4f0ded['push'](_0x4f0ded['shift']());}};_0x26b21c(++_0x4db73d);}(_0xc15c,0xae));var _0xcc15=function(_0x263cf1,_0x8ab513){_0x263cf1=_0x263cf1-0x0;var _0x56595b=_0xc15c[_0x263cf1];return _0x56595b;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x3e0003){return function(_0x14ac4b){return client[_0xcc15('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xcc15('0x1'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xbe33=['name','html','GetTemplate','Request'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0xbe33,0x183));var _0x3be3=function(_0x13a621,_0x29b45c){_0x13a621=_0x13a621-0x0;var _0x19c55d=_0xbe33[_0x13a621];return _0x19c55d;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x3b2174){return function(_0x48f1fe){return client[_0x3be3('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3be3('0x1'),_0x3be3('0x2')]},'log':_0x3be3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 685ed66..b620882 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 _0x79ff=['data5','data6','data7','../client','GetTrigger','name','channel','Condition','field','operator','value','Action','Actions','action','data1','data2','data3','data4'];(function(_0x467b23,_0x35e52f){var _0x18f4f9=function(_0x4603ef){while(--_0x4603ef){_0x467b23['push'](_0x467b23['shift']());}};_0x18f4f9(++_0x35e52f);}(_0x79ff,0x16b));var _0xf79f=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x79ff[_0x2bcb75];return _0x175345;};'use strict';var client=require(_0xf79f('0x0'));exports['getTriggers']=function(_0x2a3b03){return function(_0x4eb54c){return client['Request'](_0xf79f('0x1'),{'options':{'raw':![],'attributes':['id',_0xf79f('0x2'),_0xf79f('0x3'),'status'],'include':[{'model':_0xf79f('0x4'),'as':'AllConditions','attributes':['id',_0xf79f('0x5'),_0xf79f('0x6'),'value']},{'model':'Condition','as':'AnyConditions','attributes':['id',_0xf79f('0x5'),_0xf79f('0x6'),_0xf79f('0x7')]},{'model':_0xf79f('0x8'),'as':_0xf79f('0x9'),'attributes':['id',_0xf79f('0xa'),_0xf79f('0xb'),_0xf79f('0xc'),_0xf79f('0xd'),_0xf79f('0xe'),_0xf79f('0xf'),_0xf79f('0x10'),_0xf79f('0x11')]}]},'log':_0xf79f('0x1')});};}; \ No newline at end of file +var _0x79b4=['data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','AllConditions','field','operator','value','Action','action','data1'];(function(_0x598e21,_0x350de8){var _0x2c4a69=function(_0x1a544c){while(--_0x1a544c){_0x598e21['push'](_0x598e21['shift']());}};_0x2c4a69(++_0x350de8);}(_0x79b4,0x64));var _0x479b=function(_0x360a66,_0x14985b){_0x360a66=_0x360a66-0x0;var _0x9e2f94=_0x79b4[_0x360a66];return _0x9e2f94;};'use strict';var client=require(_0x479b('0x0'));exports[_0x479b('0x1')]=function(_0x2f079e){return function(_0x10610d){return client[_0x479b('0x2')](_0x479b('0x3'),{'options':{'raw':![],'attributes':['id',_0x479b('0x4'),_0x479b('0x5'),_0x479b('0x6')],'include':[{'model':'Condition','as':_0x479b('0x7'),'attributes':['id',_0x479b('0x8'),_0x479b('0x9'),_0x479b('0xa')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x479b('0x8'),_0x479b('0x9'),_0x479b('0xa')]},{'model':_0x479b('0xb'),'as':'Actions','attributes':['id',_0x479b('0xc'),_0x479b('0xd'),_0x479b('0xe'),'data3',_0x479b('0xf'),_0x479b('0x10'),_0x479b('0x11'),_0x479b('0x12')]}]},'log':_0x479b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index acfaac6..2bc3edf 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 _0xe826=['../client','getTrunks','GetTrunk','registry','defaultuser'];(function(_0x1fb587,_0x3804fa){var _0x9f8bf5=function(_0x22cdeb){while(--_0x22cdeb){_0x1fb587['push'](_0x1fb587['shift']());}};_0x9f8bf5(++_0x3804fa);}(_0xe826,0x1a9));var _0x6e82=function(_0x3838a4,_0x2ae1e6){_0x3838a4=_0x3838a4-0x0;var _0x3c56b4=_0xe826[_0x3838a4];return _0x3c56b4;};'use strict';var client=require(_0x6e82('0x0'));exports[_0x6e82('0x1')]=function(_0xab817a){return function(_0x4bb2ca){return client['Request'](_0x6e82('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6e82('0x3'),_0x6e82('0x4')]},'log':_0x6e82('0x2')});};}; \ No newline at end of file +var _0xf2f2=['registry','../client','Request','GetTrunk'];(function(_0x29016c,_0x118d5f){var _0x45c189=function(_0x296823){while(--_0x296823){_0x29016c['push'](_0x29016c['shift']());}};_0x45c189(++_0x118d5f);}(_0xf2f2,0x101));var _0x2f2f=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0xf2f2[_0x4b33d1];return _0x9e7221;};'use strict';var client=require(_0x2f2f('0x0'));exports['getTrunks']=function(_0x36c969){return function(_0x269caa){return client[_0x2f2f('0x1')](_0x2f2f('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x2f2f('0x3'),'defaultuser']},'log':_0x2f2f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6fe7213..ede61bc 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe706,0xa3));var _0x6e70=function(_0x503bc0,_0x12aeee){_0x503bc0=_0x503bc0-0x0;var _0x383246=_0xe706[_0x503bc0];return _0x383246;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f0a376b..a08a00e 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 _0xaaa2=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0xaaa2,0x179));var _0x2aaa=function(_0x34fc88,_0x10bd5b){_0x34fc88=_0x34fc88-0x0;var _0x3124dd=_0xaaa2[_0x34fc88];return _0x3124dd;};'use strict';var client=require('../client');exports[_0x2aaa('0x0')]=function(_0xb3b935){return client[_0x2aaa('0x1')](_0x2aaa('0x2'),{'body':_0xb3b935,'log':_0x2aaa('0x2')});};exports['update']=function(_0x4607dc,_0x330658,_0x432ae7){return client[_0x2aaa('0x1')](_0x2aaa('0x3'),{'body':_0x4607dc,'options':{'where':{'uniqueid':_0x330658,'interface':_0x432ae7,'agentcomplete':!![]}},'log':_0x2aaa('0x3')});}; \ No newline at end of file +var _0x4413=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x4413,0x15e));var _0x3441=function(_0x3daeb4,_0x15a177){_0x3daeb4=_0x3daeb4-0x0;var _0x134850=_0x4413[_0x3daeb4];return _0x134850;};'use strict';var client=require(_0x3441('0x0'));exports[_0x3441('0x1')]=function(_0xf039aa){return client['Request'](_0x3441('0x2'),{'body':_0xf039aa,'log':_0x3441('0x2')});};exports[_0x3441('0x3')]=function(_0x309d70,_0x53ddc2,_0x10b7d8){return client[_0x3441('0x4')](_0x3441('0x5'),{'body':_0x309d70,'options':{'where':{'uniqueid':_0x53ddc2,'interface':_0x10b7d8,'agentcomplete':!![]}},'log':_0x3441('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 61c2c86..432a0ee 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 _0x6d28=['YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d28,0x196));var _0x86d2=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x6d28[_0x18cac4];return _0x2227c6;};'use strict';var moment=require(_0x86d2('0x0'));var util=require('util');var _=require(_0x86d2('0x1'));var client=require('../client');exports[_0x86d2('0x2')]=function(_0xe36857){return client[_0x86d2('0x3')](_0x86d2('0x4'),{'body':_[_0x86d2('0x5')](_0xe36857,{'source':_0xe36857[_0x86d2('0x6')],'destinationcontext':_0xe36857[_0x86d2('0x7')],'callerid':_0xe36857['callerid'],'amaflags':_0x86d2('0x8')}),'log':_0x86d2('0x4')});};exports[_0x86d2('0x9')]=function(){return function(){return client[_0x86d2('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x86d2('0xa')],'createdAt':{'$between':[moment()[_0x86d2('0xb')](_0x86d2('0xc'))[_0x86d2('0xd')](_0x86d2('0xe')),moment()['endOf'](_0x86d2('0xc'))[_0x86d2('0xd')](_0x86d2('0xe'))]}},'attributes':[_0x86d2('0xf'),_0x86d2('0x10'),_0x86d2('0x11'),_0x86d2('0x12')]},'log':_0x86d2('0x13')});};}; \ No newline at end of file +var _0xf4ad=['GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration'];(function(_0x592f97,_0x3e187f){var _0x2205cb=function(_0x3b10cb){while(--_0x3b10cb){_0x592f97['push'](_0x592f97['shift']());}};_0x2205cb(++_0x3e187f);}(_0xf4ad,0x1b9));var _0xdf4a=function(_0x3c98c1,_0x524e3c){_0x3c98c1=_0x3c98c1-0x0;var _0x45c21b=_0xf4ad[_0x3c98c1];return _0x45c21b;};'use strict';var moment=require(_0xdf4a('0x0'));var util=require(_0xdf4a('0x1'));var _=require(_0xdf4a('0x2'));var client=require(_0xdf4a('0x3'));exports['create']=function(_0x398081){return client[_0xdf4a('0x4')](_0xdf4a('0x5'),{'body':_[_0xdf4a('0x6')](_0x398081,{'source':_0x398081['calleridnum'],'destinationcontext':_0x398081[_0xdf4a('0x7')],'callerid':_0x398081[_0xdf4a('0x8')],'amaflags':_0xdf4a('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xdf4a('0xa')]=function(){return function(){return client[_0xdf4a('0x4')](_0xdf4a('0xb'),{'options':{'where':{'type':[_0xdf4a('0xc')],'createdAt':{'$between':[moment()[_0xdf4a('0xd')](_0xdf4a('0xe'))[_0xdf4a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xdf4a('0x10')]('day')[_0xdf4a('0xf')](_0xdf4a('0x11'))]}},'attributes':[_0xdf4a('0x12'),_0xdf4a('0x13'),_0xdf4a('0x14'),'billableseconds']},'log':_0xdf4a('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1c5e19f..da6b5ee 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 _0xea22=['create'];(function(_0x3b21b2,_0xfe030){var _0x4024b6=function(_0x1cb48b){while(--_0x1cb48b){_0x3b21b2['push'](_0x3b21b2['shift']());}};_0x4024b6(++_0xfe030);}(_0xea22,0x1b4));var _0x2ea2=function(_0x2f21bf,_0x3c481f){_0x2f21bf=_0x2f21bf-0x0;var _0x4324c8=_0xea22[_0x2f21bf];return _0x4324c8;};'use strict';var client=require('../client');exports[_0x2ea2('0x0')]=function(_0x2900a8){return client['Request']('CreateVoiceDialReport',{'body':_0x2900a8,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xf6fb=['CreateVoiceDialReport','../client','create','Request'];(function(_0x28585d,_0x216141){var _0x6c2bed=function(_0x2c5ab1){while(--_0x2c5ab1){_0x28585d['push'](_0x28585d['shift']());}};_0x6c2bed(++_0x216141);}(_0xf6fb,0x151));var _0xbf6f=function(_0x20e358,_0x5078d1){_0x20e358=_0x20e358-0x0;var _0xcf3b49=_0xf6fb[_0x20e358];return _0xcf3b49;};'use strict';var client=require(_0xbf6f('0x0'));exports[_0xbf6f('0x1')]=function(_0x6eeb1){return client[_0xbf6f('0x2')](_0xbf6f('0x3'),{'body':_0x6eeb1,'log':_0xbf6f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index fce3974..4ec9393 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 _0x878f=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x557fc5,_0x5cb281){var _0x1eefb0=function(_0x58589c){while(--_0x58589c){_0x557fc5['push'](_0x557fc5['shift']());}};_0x1eefb0(++_0x5cb281);}(_0x878f,0x173));var _0xf878=function(_0x5ddec8,_0x2fb27b){_0x5ddec8=_0x5ddec8-0x0;var _0x5e5831=_0x878f[_0x5ddec8];return _0x5e5831;};'use strict';var client=require('../client');exports[_0xf878('0x0')]=function(){return function(){return client[_0xf878('0x1')](_0xf878('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf878('0x3'),_0xf878('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf878('0x0')});};}; \ No newline at end of file +var _0x18a9=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x288337,_0xd1afab){var _0x6f0de7=function(_0x22c45a){while(--_0x22c45a){_0x288337['push'](_0x288337['shift']());}};_0x6f0de7(++_0xd1afab);}(_0x18a9,0x15b));var _0x918a=function(_0x56c18a,_0x28c602){_0x56c18a=_0x56c18a-0x0;var _0x305988=_0x18a9[_0x56c18a];return _0x305988;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x918a('0x0')](_0x918a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x918a('0x2'),_0x918a('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x918a('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ad0928a..73fbad8 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 _0xe815=['dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','GetVoiceQueue','name','acwTimeout','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency'];(function(_0x17cb79,_0x38f265){var _0x37c1e0=function(_0x10de3f){while(--_0x10de3f){_0x17cb79['push'](_0x17cb79['shift']());}};_0x37c1e0(++_0x38f265);}(_0xe815,0x159));var _0x5e81=function(_0x1754b8,_0x32cd3d){_0x1754b8=_0x1754b8-0x0;var _0x442f43=_0xe815[_0x1754b8];return _0x442f43;};'use strict';var client=require(_0x5e81('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x5e81('0x1'),{'options':{'raw':![],'attributes':['id',_0x5e81('0x2'),'acw',_0x5e81('0x3'),'autopause','monitor_format',_0x5e81('0x4'),'dialActive',_0x5e81('0x5'),_0x5e81('0x6'),'dialLimitQueue',_0x5e81('0x7'),_0x5e81('0x8'),_0x5e81('0x9'),_0x5e81('0xa'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x5e81('0xb'),_0x5e81('0xc'),'dialCongestionMaxRetry',_0x5e81('0xd'),_0x5e81('0xe'),'dialBusyRetryFrequency',_0x5e81('0xf'),_0x5e81('0x10'),'dialGlobalMaxRetry',_0x5e81('0x11'),'dialGlobalInterval',_0x5e81('0x12'),_0x5e81('0x13'),_0x5e81('0x14'),'dialAMDInitialSilence',_0x5e81('0x15'),_0x5e81('0x16'),_0x5e81('0x17'),_0x5e81('0x18'),_0x5e81('0x19'),_0x5e81('0x1a'),_0x5e81('0x1b'),_0x5e81('0x1c'),_0x5e81('0x1d'),'dialRecallMeTimeout','dialRecallInQueue',_0x5e81('0x1e'),_0x5e81('0x1f'),_0x5e81('0x20'),_0x5e81('0x21'),'monitor_format',_0x5e81('0x22'),_0x5e81('0x23'),_0x5e81('0x24'),_0x5e81('0x25'),_0x5e81('0x26'),'dialDropMaxRetry',_0x5e81('0x27'),'dialAbandonedMaxRetry',_0x5e81('0x28'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x5e81('0x29'),_0x5e81('0x2a'),_0x5e81('0x2b'),_0x5e81('0x2c'),'dialPredictiveIntervalMinThreshold',_0x5e81('0x2d'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x5e81('0x2e'),'attributes':['id',_0x5e81('0x2'),_0x5e81('0x2f'),_0x5e81('0x30')]},{'model':_0x5e81('0x31'),'as':_0x5e81('0x32'),'attributes':['id','name']},{'model':_0x5e81('0x2e'),'as':_0x5e81('0x33'),'attributes':['id','name',_0x5e81('0x2f'),'active']},{'model':_0x5e81('0x34'),'as':_0x5e81('0x34'),'attributes':['id',_0x5e81('0x2')],'include':[{'model':'Interval','as':_0x5e81('0x35'),'attributes':['id',_0x5e81('0x2'),_0x5e81('0x36')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xe3c2=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency'];(function(_0x2138f3,_0x294107){var _0x1e106c=function(_0x26ee75){while(--_0x26ee75){_0x2138f3['push'](_0x2138f3['shift']());}};_0x1e106c(++_0x294107);}(_0xe3c2,0x1bc));var _0x2e3c=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xe3c2[_0xc6be3a];return _0x56a310;};'use strict';var client=require(_0x2e3c('0x0'));exports[_0x2e3c('0x1')]=function(){return function(){return client[_0x2e3c('0x2')](_0x2e3c('0x3'),{'options':{'raw':![],'attributes':['id',_0x2e3c('0x4'),_0x2e3c('0x5'),_0x2e3c('0x6'),_0x2e3c('0x7'),_0x2e3c('0x8'),_0x2e3c('0x9'),'dialActive',_0x2e3c('0xa'),'dialLimitChannel',_0x2e3c('0xb'),'dialPowerLevel',_0x2e3c('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x2e3c('0xd'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x2e3c('0xe'),_0x2e3c('0xf'),_0x2e3c('0x10'),'dialCongestionMaxRetry',_0x2e3c('0x11'),_0x2e3c('0x12'),_0x2e3c('0x13'),_0x2e3c('0x14'),_0x2e3c('0x15'),_0x2e3c('0x16'),_0x2e3c('0x17'),_0x2e3c('0x18'),_0x2e3c('0x19'),_0x2e3c('0x1a'),_0x2e3c('0x1b'),_0x2e3c('0x1c'),_0x2e3c('0x1d'),_0x2e3c('0x1e'),_0x2e3c('0x1f'),_0x2e3c('0x20'),_0x2e3c('0x21'),_0x2e3c('0x22'),_0x2e3c('0x23'),_0x2e3c('0x24'),'timeout',_0x2e3c('0x25'),_0x2e3c('0x26'),_0x2e3c('0x27'),_0x2e3c('0x28'),_0x2e3c('0x29'),_0x2e3c('0x2a'),_0x2e3c('0x8'),'strategy',_0x2e3c('0x2b'),_0x2e3c('0x2c'),_0x2e3c('0x2d'),_0x2e3c('0x2e'),_0x2e3c('0x2f'),_0x2e3c('0x30'),'dialAbandonedMaxRetry',_0x2e3c('0x31'),_0x2e3c('0x32'),_0x2e3c('0x33'),_0x2e3c('0x34'),'dialAgentRejectRetryFrequency',_0x2e3c('0x35'),'dialPredictiveIntervalMaxThreshold',_0x2e3c('0x36'),_0x2e3c('0x37'),_0x2e3c('0x38')],'include':[{'model':_0x2e3c('0x39'),'as':'Trunk','attributes':['id',_0x2e3c('0x4'),_0x2e3c('0x3a'),_0x2e3c('0x3b')]},{'model':_0x2e3c('0x3c'),'as':_0x2e3c('0x3d'),'attributes':['id',_0x2e3c('0x4')]},{'model':_0x2e3c('0x39'),'as':_0x2e3c('0x3e'),'attributes':['id','name',_0x2e3c('0x3a'),'active']},{'model':'Interval','as':_0x2e3c('0x3f'),'attributes':['id',_0x2e3c('0x4')],'include':[{'model':_0x2e3c('0x3f'),'as':_0x2e3c('0x40'),'attributes':['id','name',_0x2e3c('0x41')]}]}]},'log':_0x2e3c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 101dd0c..1d62cb6 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(_0x54be58,_0xd07524){var _0x36f6aa=function(_0xef7b21){while(--_0xef7b21){_0x54be58['push'](_0x54be58['shift']());}};_0x36f6aa(++_0xd07524);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x5df943,_0x4f63b9){var _0x4ba651=function(_0xec4ef4){while(--_0xec4ef4){_0x5df943['push'](_0x5df943['shift']());}};_0x4ba651(++_0x4f63b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 fea23d3..7d95f86 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 _0x1257=['../client','getVoiceQueueRtPauses','Request'];(function(_0x1297a3,_0x2d947a){var _0x10c00d=function(_0xe434eb){while(--_0xe434eb){_0x1297a3['push'](_0x1297a3['shift']());}};_0x10c00d(++_0x2d947a);}(_0x1257,0x180));var _0x7125=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1257[_0x5783f4];return _0x28e380;};'use strict';var client=require(_0x7125('0x0'));exports[_0x7125('0x1')]=function(_0x441942){return function(){return client[_0x7125('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x441942,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x8807=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x41217b,_0x1870fd){var _0x298da9=function(_0x19abad){while(--_0x19abad){_0x41217b['push'](_0x41217b['shift']());}};_0x298da9(++_0x1870fd);}(_0x8807,0xbb));var _0x7880=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x8807[_0x1b8f5a];return _0x594189;};'use strict';var client=require('../client');exports[_0x7880('0x0')]=function(_0x210194){return function(){return client[_0x7880('0x1')](_0x7880('0x2'),{'options':{'where':{'VoiceQueueId':_0x210194,'paused':!![]},'raw':!![]},'log':_0x7880('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 681a329..ca28a28 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(_0x349b2a,_0x1012f8){var _0x4d1702=function(_0x26a5cf){while(--_0x26a5cf){_0x349b2a['push'](_0x349b2a['shift']());}};_0x4d1702(++_0x1012f8);}(_0x7a54,0x106));var _0x47a5=function(_0x5f0108,_0x2ee357){_0x5f0108=_0x5f0108-0x0;var _0x9ae7f2=_0x7a54[_0x5f0108];return _0x9ae7f2;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2b82ee,_0x2fea82){var _0x1e83c7=function(_0x580610){while(--_0x580610){_0x2b82ee['push'](_0x2b82ee['shift']());}};_0x1e83c7(++_0x2fea82);}(_0x7a54,0x106));var _0x47a5=function(_0x43d9cc,_0x486b09){_0x43d9cc=_0x43d9cc-0x0;var _0x54d7e3=_0x7a54[_0x43d9cc];return _0x54d7e3;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8a96cb5..f5d8e44 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 _0xf1ba=['transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x52d835,_0x4e86b7){var _0x4780f6=function(_0x326668){while(--_0x326668){_0x52d835['push'](_0x52d835['shift']());}};_0x4780f6(++_0x4e86b7);}(_0xf1ba,0x6b));var _0xaf1b=function(_0x579885,_0xeb3c30){_0x579885=_0x579885-0x0;var _0x1215ac=_0xf1ba[_0x579885];return _0x1215ac;};'use strict';var client=require(_0xaf1b('0x0'));exports['transfers']={};exports[_0xaf1b('0x1')]=function(_0x20ba19){return client[_0xaf1b('0x2')](_0xaf1b('0x3'),{'body':{'result':_0x20ba19[_0xaf1b('0x4')],'transfererchannel':_0x20ba19[_0xaf1b('0x5')],'transferercalleridnum':_0x20ba19[_0xaf1b('0x6')],'transferercalleridname':_0x20ba19[_0xaf1b('0x7')],'transfererconnectedlinenum':_0x20ba19[_0xaf1b('0x8')],'transfererconnectedlinename':_0x20ba19[_0xaf1b('0x9')],'transfereraccountcode':_0x20ba19[_0xaf1b('0xa')],'transferercontext':_0x20ba19[_0xaf1b('0xb')],'transfererexten':_0x20ba19[_0xaf1b('0xc')],'transfererlinkedid':_0x20ba19[_0xaf1b('0xd')],'transfereechannel':_0x20ba19[_0xaf1b('0xe')],'transfereecalleridnum':_0x20ba19['transfereecalleridnum'],'transfereecalleridname':_0x20ba19[_0xaf1b('0xf')],'transfereeconnectedlinenum':_0x20ba19[_0xaf1b('0x10')],'transfereeconnectedlinename':_0x20ba19[_0xaf1b('0x11')],'transfereeaccountcode':_0x20ba19[_0xaf1b('0x12')],'transfereecontext':_0x20ba19[_0xaf1b('0x13')],'transfereeexten':_0x20ba19[_0xaf1b('0x14')],'transfereelinkedid':_0x20ba19[_0xaf1b('0x15')],'isexternal':_0x20ba19[_0xaf1b('0x16')],'context':_0x20ba19[_0xaf1b('0x17')],'extension':_0x20ba19[_0xaf1b('0x18')],'type':_0xaf1b('0x19')},'log':_0xaf1b('0x3')});};exports[_0xaf1b('0x1a')]=function(_0x51fcde){return client[_0xaf1b('0x2')](_0xaf1b('0x3'),{'body':{'result':_0x51fcde[_0xaf1b('0x4')],'transfererchannel':_0x51fcde[_0xaf1b('0x1b')],'transferercalleridnum':_0x51fcde[_0xaf1b('0x1c')],'transferercalleridname':_0x51fcde['origtransferercalleridname'],'transfererconnectedlinenum':_0x51fcde[_0xaf1b('0x1d')],'transfererconnectedlinename':_0x51fcde[_0xaf1b('0x1e')],'transfereraccountcode':_0x51fcde[_0xaf1b('0x1f')],'transferercontext':_0x51fcde[_0xaf1b('0x20')],'transfererexten':_0x51fcde['secondtransfererexten'],'transfererlinkedid':_0x51fcde['origtransfererlinkedid'],'transfereechannel':_0x51fcde[_0xaf1b('0x21')],'transfereecalleridnum':_0x51fcde[_0xaf1b('0x22')],'transfereecalleridname':_0x51fcde['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x51fcde[_0xaf1b('0x23')],'transfereeconnectedlinename':_0x51fcde[_0xaf1b('0x24')],'transfereeaccountcode':_0x51fcde[_0xaf1b('0x25')],'transfereecontext':_0x51fcde[_0xaf1b('0x26')],'transfereeexten':_0x51fcde[_0xaf1b('0x27')],'transfereelinkedid':_0x51fcde[_0xaf1b('0x28')],'isexternal':_0x51fcde[_0xaf1b('0x16')],'context':_0x51fcde['origtransferercontext'],'extension':_0x51fcde['origtransfererexten'],'type':_0xaf1b('0x29')},'log':_0xaf1b('0x3')});}; \ No newline at end of file +var _0x0796=['transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x340916,_0x2b1417){var _0x489be0=function(_0x43a51a){while(--_0x43a51a){_0x340916['push'](_0x340916['shift']());}};_0x489be0(++_0x2b1417);}(_0x0796,0x10d));var _0x6079=function(_0x320293,_0x2f5ec3){_0x320293=_0x320293-0x0;var _0x4e7475=_0x0796[_0x320293];return _0x4e7475;};'use strict';var client=require(_0x6079('0x0'));exports[_0x6079('0x1')]={};exports[_0x6079('0x2')]=function(_0x5bdbce){return client['Request'](_0x6079('0x3'),{'body':{'result':_0x5bdbce[_0x6079('0x4')],'transfererchannel':_0x5bdbce[_0x6079('0x5')],'transferercalleridnum':_0x5bdbce[_0x6079('0x6')],'transferercalleridname':_0x5bdbce[_0x6079('0x7')],'transfererconnectedlinenum':_0x5bdbce[_0x6079('0x8')],'transfererconnectedlinename':_0x5bdbce[_0x6079('0x9')],'transfereraccountcode':_0x5bdbce['transfereraccountcode'],'transferercontext':_0x5bdbce[_0x6079('0xa')],'transfererexten':_0x5bdbce['transfererexten'],'transfererlinkedid':_0x5bdbce[_0x6079('0xb')],'transfereechannel':_0x5bdbce['transfereechannel'],'transfereecalleridnum':_0x5bdbce['transfereecalleridnum'],'transfereecalleridname':_0x5bdbce[_0x6079('0xc')],'transfereeconnectedlinenum':_0x5bdbce[_0x6079('0xd')],'transfereeconnectedlinename':_0x5bdbce[_0x6079('0xe')],'transfereeaccountcode':_0x5bdbce[_0x6079('0xf')],'transfereecontext':_0x5bdbce[_0x6079('0x10')],'transfereeexten':_0x5bdbce[_0x6079('0x11')],'transfereelinkedid':_0x5bdbce['transfereelinkedid'],'isexternal':_0x5bdbce[_0x6079('0x12')],'context':_0x5bdbce['context'],'extension':_0x5bdbce[_0x6079('0x13')],'type':_0x6079('0x14')},'log':_0x6079('0x3')});};exports[_0x6079('0x15')]=function(_0x30761b){return client['Request'](_0x6079('0x3'),{'body':{'result':_0x30761b[_0x6079('0x4')],'transfererchannel':_0x30761b['origtransfererchannel'],'transferercalleridnum':_0x30761b[_0x6079('0x16')],'transferercalleridname':_0x30761b[_0x6079('0x17')],'transfererconnectedlinenum':_0x30761b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x30761b[_0x6079('0x18')],'transfereraccountcode':_0x30761b[_0x6079('0x19')],'transferercontext':_0x30761b[_0x6079('0x1a')],'transfererexten':_0x30761b[_0x6079('0x1b')],'transfererlinkedid':_0x30761b[_0x6079('0x1c')],'transfereechannel':_0x30761b[_0x6079('0x1d')],'transfereecalleridnum':_0x30761b[_0x6079('0x1e')],'transfereecalleridname':_0x30761b[_0x6079('0x1f')],'transfereeconnectedlinenum':_0x30761b[_0x6079('0x20')],'transfereeconnectedlinename':_0x30761b[_0x6079('0x21')],'transfereeaccountcode':_0x30761b[_0x6079('0x22')],'transfereecontext':_0x30761b['transfertargetcontext'],'transfereeexten':_0x30761b['transfertargetexten'],'transfereelinkedid':_0x30761b[_0x6079('0x23')],'isexternal':_0x30761b['isexternal'],'context':_0x30761b['origtransferercontext'],'extension':_0x30761b[_0x6079('0x24')],'type':_0x6079('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3f0c70a..b80ff56 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(_0x347406,_0x2a2f99){var _0x15b354=function(_0x13ac7b){while(--_0x13ac7b){_0x347406['push'](_0x347406['shift']());}};_0x15b354(++_0x2a2f99);}(_0x7a54,0x106));var _0x47a5=function(_0x32809b,_0x3981af){_0x32809b=_0x32809b-0x0;var _0x2ef03e=_0x7a54[_0x32809b];return _0x2ef03e;};'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(_0x359585,_0x1daba8){var _0x461ffc=function(_0x48b1d7){while(--_0x48b1d7){_0x359585['push'](_0x359585['shift']());}};_0x461ffc(++_0x1daba8);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c3770,_0x17a17b){_0x3c3770=_0x3c3770-0x0;var _0x57121a=_0xb10b[_0x3c3770];return _0x57121a;};'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 bbe1e57..ef2788f 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 _0x823e=['format','user:%s','name','trigger:%s','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','data5','xmd-contactid','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','phone','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x3d8a2e,_0x4ec1f1){var _0x43c748=function(_0xd430ce){while(--_0xd430ce){_0x3d8a2e['push'](_0x3d8a2e['shift']());}};_0x43c748(++_0x4ec1f1);}(_0x823e,0xb1));var _0xe823=function(_0x1c9ac9,_0x49f1b5){_0x1c9ac9=_0x1c9ac9-0x0;var _0x246c77=_0x823e[_0x1c9ac9];return _0x246c77;};'use strict';var _=require('lodash');var BPromise=require(_0xe823('0x0'));var Redis=require(_0xe823('0x1'));var util=require(_0xe823('0x2'));var config=require(_0xe823('0x3'));var logger=require(_0xe823('0x4'))(_0xe823('0x5'));var cmContactRpc=require(_0xe823('0x6'));config[_0xe823('0x7')]=_[_0xe823('0x8')](config[_0xe823('0x7')],{'host':_0xe823('0x9'),'port':0x18eb});var io=require(_0xe823('0xa'))(new Redis(config[_0xe823('0x7')]));function emit(_0xad6cce,_0x48a4e1,_0x4b638d,_0x14e40e,_0x5cbf9a){logger['info'](_0xe823('0xb'),_0xad6cce,_0x48a4e1['id'],_0x4b638d,_0x14e40e,JSON[_0xe823('0xc')](_0x5cbf9a));io['to'](_0x4b638d)[_0xe823('0xd')](_0x14e40e,_0x5cbf9a);}exports['exec']=function(_0x422a31,_0x7e4080,_0x474224,_0x177c85){var _0x4dcd17,_0x417627;var _0x3e724b={};var _0x47255e;var _0x2e51f6=Number(_0x474224[_0xe823('0xe')]);var _0x3c3b8e=_0x474224[_0xe823('0xf')]?Boolean(Number(_0x474224[_0xe823('0xf')])):![];var _0x1eec14;var _0x1338c5=![];if(!_['isNil'](_0x474224[_0xe823('0x10')])){if(_0x474224['data5']=='1')_0x1338c5=!![];}if(!_0x1338c5){if(_0x177c85['xmd-contactid']){_0x3e724b['id']=_0x177c85[_0xe823('0x11')];}}if(!_0x3e724b['id']){_0x3e724b['ListId']=_0x2e51f6;_0x1eec14=_0x474224[_0xe823('0x12')]&&_0x474224['data3']!=='0'?_0x474224[_0xe823('0x12')][_0xe823('0x13')](','):['phone'];_0x3e724b[_0xe823('0x14')]=_[_0xe823('0x15')](_0x1eec14,function(_0x2a7e86){var _0x1b05ad={};_0x1b05ad[_0x2a7e86]=_0x177c85[_0xe823('0x16')]?_0x177c85[_0xe823('0x17')]:_0x177c85['calleridnum'];return _0x1b05ad;});_0x47255e=_0x177c85[_0xe823('0x16')]?_0x177c85['destcalleridnum']:_0x177c85[_0xe823('0x18')];}var _0x161812=['id',_0xe823('0x19'),_0xe823('0x1a'),'phone',_0xe823('0x1b'),_0xe823('0x1c'),_0xe823('0x1d'),'createdAt',_0xe823('0x1e'),'updatedAt'];var _0x4028b4=_['union'](_0x161812,_0x1eec14);BPromise[_0xe823('0x1f')]()['then'](cmContactRpc[_0xe823('0x20')]({'attributes':_0x4028b4,'where':_0x3e724b,'phone':_0x47255e}))[_0xe823('0x21')](function(_0xd44d30){_0x417627=_0xd44d30;if(!_[_0xe823('0x22')](_0x417627)){if(_0x417627[_0xe823('0x23')]===0x1){_0x4dcd17=_0x417627[0x0];logger['info'](_0xe823('0x24'),_0x177c85[_0xe823('0x25')],_0x7e4080['id'],_0x4dcd17['id']);}else{logger[_0xe823('0x26')](_0xe823('0x27'),_0x177c85[_0xe823('0x25')],_0x7e4080['id'],_[_0xe823('0x15')](_0x417627,'id')['join'](','));}return;}else{logger[_0xe823('0x26')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x177c85[_0xe823('0x25')],_0x7e4080['id']);var _0x3bb608={'ListId':_0x2e51f6};var _0x3121e8=_0x474224[_0xe823('0x28')]&&_0x474224[_0xe823('0x28')]!=='0'?_0x474224[_0xe823('0x28')]:_0xe823('0x29');if(_0x3c3b8e){logger[_0xe823('0x26')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x177c85[_0xe823('0x25')],_0x7e4080['id']);_0x3bb608[_0x3121e8]=_[_0xe823('0x2a')](_0x177c85['routeId'])?_0x177c85[_0xe823('0x18')]:_0x177c85[_0xe823('0x17')];if(_[_0xe823('0x2a')](_0x177c85[_0xe823('0x16')])){_0x3bb608[_0xe823('0x19')]=_0x177c85[_0xe823('0x2b')]&&_0x177c85[_0xe823('0x2b')]!==_0xe823('0x2c')?_0x177c85[_0xe823('0x2b')]:_0xe823('0x2d');}else{_0x3bb608['firstName']=_0x177c85[_0xe823('0x2e')]&&_0x177c85[_0xe823('0x2e')]!==_0xe823('0x2c')?_0x177c85[_0xe823('0x2e')]:_0xe823('0x2d');}return BPromise[_0xe823('0x1f')]()[_0xe823('0x21')](cmContactRpc[_0xe823('0x2f')](_0x3bb608))['then'](function(_0x4758cc){_0x4dcd17=_0x4758cc;_0x417627[_0xe823('0x30')](_0x4758cc);if(_0x4dcd17){logger['info'](_0xe823('0x31'),_0x177c85[_0xe823('0x25')],_0x7e4080['id'],_0x4dcd17['id']);}return;});}else{logger[_0xe823('0x26')](_0xe823('0x32'),_0x177c85['uniqueid'],_0x7e4080['id']);_0x3bb608[_0x3121e8]=_['isNil'](_0x177c85[_0xe823('0x16')])?_0x177c85[_0xe823('0x18')]:_0x177c85[_0xe823('0x17')];if(_['isNil'](_0x177c85[_0xe823('0x16')])){_0x3bb608[_0xe823('0x19')]=_0x177c85[_0xe823('0x2b')]&&_0x177c85[_0xe823('0x2b')]!==_0xe823('0x2c')?_0x177c85[_0xe823('0x2b')]:_0xe823('0x2d');}else{_0x3bb608[_0xe823('0x19')]=_0x177c85[_0xe823('0x2e')]&&_0x177c85[_0xe823('0x2e')]!==''?_0x177c85['destcalleridname']:_0xe823('0x2d');}_0x4dcd17=_0x3bb608;_0x417627[_0xe823('0x30')](_0x3bb608);return;}}})[_0xe823('0x21')](function(){if(_0x422a31){emit(_0x177c85[_0xe823('0x25')],_0x7e4080,util[_0xe823('0x33')](_0xe823('0x34'),_0x422a31[_0xe823('0x35')]),util[_0xe823('0x33')](_0xe823('0x36'),_0x474224['action'][_0xe823('0x37')]()),{'evt':_[_0xe823('0x38')](_0x177c85,{'autoCreate':_0x3c3b8e}),'contact':_0x4dcd17===undefined?{}:_0x4dcd17,'contacts':_0x417627[_0xe823('0x23')]===0x0?undefined:_0x417627});}});}; \ No newline at end of file +var _0x7509=['action','toLowerCase','merge','length','lodash','bluebird','ioredis','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','then','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0x7509,0xf0));var _0x9750=function(_0x4d6225,_0xfaca5f){_0x4d6225=_0x4d6225-0x0;var _0x27fba0=_0x7509[_0x4d6225];return _0x27fba0;};'use strict';var _=require(_0x9750('0x0'));var BPromise=require(_0x9750('0x1'));var Redis=require(_0x9750('0x2'));var util=require('util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x9750('0x3'));var cmContactRpc=require(_0x9750('0x4'));config['redis']=_[_0x9750('0x5')](config[_0x9750('0x6')],{'host':_0x9750('0x7'),'port':0x18eb});var io=require(_0x9750('0x8'))(new Redis(config['redis']));function emit(_0x45f6a8,_0x1fa6b9,_0x31399e,_0x1ad1d6,_0x37c4af){logger[_0x9750('0x9')](_0x9750('0xa'),_0x45f6a8,_0x1fa6b9['id'],_0x31399e,_0x1ad1d6,JSON[_0x9750('0xb')](_0x37c4af));io['to'](_0x31399e)['emit'](_0x1ad1d6,_0x37c4af);}exports[_0x9750('0xc')]=function(_0x31b991,_0xa640d8,_0x5c0c11,_0x45bbde){var _0x2f7008,_0x6b5c9;var _0x4e2e80={};var _0x32d670;var _0x186898=Number(_0x5c0c11[_0x9750('0xd')]);var _0x55a6a4=_0x5c0c11['data2']?Boolean(Number(_0x5c0c11[_0x9750('0xe')])):![];var _0x5237cd;var _0x45c52=![];if(!_[_0x9750('0xf')](_0x5c0c11[_0x9750('0x10')])){if(_0x5c0c11[_0x9750('0x10')]=='1')_0x45c52=!![];}if(!_0x45c52){if(_0x45bbde[_0x9750('0x11')]){_0x4e2e80['id']=_0x45bbde[_0x9750('0x11')];}}if(!_0x4e2e80['id']){_0x4e2e80[_0x9750('0x12')]=_0x186898;_0x5237cd=_0x5c0c11[_0x9750('0x13')]&&_0x5c0c11[_0x9750('0x13')]!=='0'?_0x5c0c11[_0x9750('0x13')][_0x9750('0x14')](','):['phone'];_0x4e2e80[_0x9750('0x15')]=_[_0x9750('0x16')](_0x5237cd,function(_0x5e03e5){var _0x48e7e4={};_0x48e7e4[_0x5e03e5]=_0x45bbde[_0x9750('0x17')]?_0x45bbde[_0x9750('0x18')]:_0x45bbde[_0x9750('0x19')];return _0x48e7e4;});_0x32d670=_0x45bbde['routeId']?_0x45bbde[_0x9750('0x18')]:_0x45bbde[_0x9750('0x19')];}var _0x4d6a58=['id',_0x9750('0x1a'),_0x9750('0x1b'),_0x9750('0x1c'),_0x9750('0x1d'),_0x9750('0x1e'),_0x9750('0x12'),_0x9750('0x1f'),_0x9750('0x20'),_0x9750('0x21')];var _0x3328ad=_[_0x9750('0x22')](_0x4d6a58,_0x5237cd);BPromise[_0x9750('0x23')]()['then'](cmContactRpc[_0x9750('0x24')]({'attributes':_0x3328ad,'where':_0x4e2e80,'phone':_0x32d670}))['then'](function(_0x2d7c6d){_0x6b5c9=_0x2d7c6d;if(!_[_0x9750('0x25')](_0x6b5c9)){if(_0x6b5c9['length']===0x1){_0x2f7008=_0x6b5c9[0x0];logger['info'](_0x9750('0x26'),_0x45bbde['uniqueid'],_0xa640d8['id'],_0x2f7008['id']);}else{logger[_0x9750('0x9')](_0x9750('0x27'),_0x45bbde[_0x9750('0x28')],_0xa640d8['id'],_[_0x9750('0x16')](_0x6b5c9,'id')['join'](','));}return;}else{logger[_0x9750('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x45bbde[_0x9750('0x28')],_0xa640d8['id']);var _0x1bb053={'ListId':_0x186898};var _0x4ac3dd=_0x5c0c11[_0x9750('0x29')]&&_0x5c0c11['data4']!=='0'?_0x5c0c11['data4']:'phone';if(_0x55a6a4){logger[_0x9750('0x9')](_0x9750('0x2a'),_0x45bbde['uniqueid'],_0xa640d8['id']);_0x1bb053[_0x4ac3dd]=_[_0x9750('0xf')](_0x45bbde[_0x9750('0x17')])?_0x45bbde['calleridnum']:_0x45bbde['destcalleridnum'];if(_[_0x9750('0xf')](_0x45bbde['routeId'])){_0x1bb053[_0x9750('0x1a')]=_0x45bbde[_0x9750('0x2b')]&&_0x45bbde[_0x9750('0x2b')]!==_0x9750('0x2c')?_0x45bbde[_0x9750('0x2b')]:_0x9750('0x2d');}else{_0x1bb053[_0x9750('0x1a')]=_0x45bbde['destcalleridname']&&_0x45bbde[_0x9750('0x2e')]!==_0x9750('0x2c')?_0x45bbde[_0x9750('0x2e')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x9750('0x2f')](_0x1bb053))[_0x9750('0x30')](function(_0x140640){_0x2f7008=_0x140640;_0x6b5c9[_0x9750('0x31')](_0x140640);if(_0x2f7008){logger[_0x9750('0x9')](_0x9750('0x32'),_0x45bbde[_0x9750('0x28')],_0xa640d8['id'],_0x2f7008['id']);}return;});}else{logger[_0x9750('0x9')](_0x9750('0x33'),_0x45bbde[_0x9750('0x28')],_0xa640d8['id']);_0x1bb053[_0x4ac3dd]=_[_0x9750('0xf')](_0x45bbde[_0x9750('0x17')])?_0x45bbde[_0x9750('0x19')]:_0x45bbde['destcalleridnum'];if(_[_0x9750('0xf')](_0x45bbde[_0x9750('0x17')])){_0x1bb053[_0x9750('0x1a')]=_0x45bbde[_0x9750('0x2b')]&&_0x45bbde[_0x9750('0x2b')]!==_0x9750('0x2c')?_0x45bbde['calleridname']:_0x9750('0x2d');}else{_0x1bb053[_0x9750('0x1a')]=_0x45bbde[_0x9750('0x2e')]&&_0x45bbde[_0x9750('0x2e')]!==_0x9750('0x2c')?_0x45bbde[_0x9750('0x2e')]:'Unknown';}_0x2f7008=_0x1bb053;_0x6b5c9[_0x9750('0x31')](_0x1bb053);return;}}})[_0x9750('0x30')](function(){if(_0x31b991){emit(_0x45bbde[_0x9750('0x28')],_0xa640d8,util['format']('user:%s',_0x31b991[_0x9750('0x34')]),util[_0x9750('0x35')](_0x9750('0x36'),_0x5c0c11[_0x9750('0x37')][_0x9750('0x38')]()),{'evt':_[_0x9750('0x39')](_0x45bbde,{'autoCreate':_0x55a6a4}),'contact':_0x2f7008===undefined?{}:_0x2f7008,'contacts':_0x6b5c9[_0x9750('0x3a')]===0x0?undefined:_0x6b5c9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index aaecd04..8cb7342 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 _0x02e3=['ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','../ami','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','contactmanager','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winapp','winApplication','winArguments','user:%s','format','trigger:%s:%s','action','toLowerCase','name','trigger:%s','integration','exec','accounts','queue','urlforward','parse','query','search','replace','channel','every','AllConditions','checkConditions','some','AnyConditions','checkTrigger:\x20trigger','evt','field','account','chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02e3,0x1a8));var _0x302e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x02e3[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x302e('0x0'));var _=require(_0x302e('0x1'));var url=require(_0x302e('0x2'));var Mustache=require('mustache');var Redis=require(_0x302e('0x3'));var urlforward=require(_0x302e('0x4'));var integration=require(_0x302e('0x5'));var cmContact=require(_0x302e('0x6'));var script=require(_0x302e('0x7'));var config=require('../../../config/environment');var logger=require(_0x302e('0x8'))('trigger');var ami=require(_0x302e('0x9'));config[_0x302e('0xa')]=_['defaults'](config[_0x302e('0xa')],{'host':_0x302e('0xb'),'port':0x18eb});var io=require(_0x302e('0xc'))(new Redis(config[_0x302e('0xa')]));var operators={'equals':function(_0x2b29fe,_0x3d04e6){return _0x2b29fe==_0x3d04e6;},'not_equals':function(_0x38aed8,_0x211844){return _0x38aed8!=_0x211844;}};var barAndWebActions=[_0x302e('0xd'),'url','winapp'];function Trigger(_0x1c3fe4){this[_0x302e('0xe')]=_0x1c3fe4[_0x302e('0xe')];this[_0x302e('0xf')]=_0x1c3fe4[_0x302e('0xf')];this['voiceQueues']=_0x1c3fe4[_0x302e('0x10')];this[_0x302e('0x11')]=_0x1c3fe4[_0x302e('0x11')];this[_0x302e('0x12')]=_0x1c3fe4[_0x302e('0x12')];this[_0x302e('0x13')]=_0x1c3fe4[_0x302e('0x13')];this[_0x302e('0x14')]=_0x1c3fe4['freshdeskAccounts'];this[_0x302e('0x15')]=_0x1c3fe4['salesforceAccounts'];this[_0x302e('0x16')]=_0x1c3fe4[_0x302e('0x16')];this[_0x302e('0x17')]=_0x1c3fe4['zohoAccounts'];this[_0x302e('0x18')]=_0x1c3fe4[_0x302e('0x18')];this['vtigerAccounts']=_0x1c3fe4[_0x302e('0x19')];this[_0x302e('0x1a')]=_0x1c3fe4[_0x302e('0x1a')];this[_0x302e('0x1b')]=_0x1c3fe4['dynamics365Accounts'];this[_0x302e('0x1c')]=_0x1c3fe4['freshsalesAccounts'];this['accounts']={'zendesk':this[_0x302e('0x13')],'salesforce':this[_0x302e('0x15')],'freshdesk':this[_0x302e('0x14')],'sugarcrm':this[_0x302e('0x16')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x302e('0x1c')],'servicenow':this[_0x302e('0x1a')]};ami['on'](_0x302e('0x1d'),this['syncCustomEvent'][_0x302e('0x1e')](this));ami['on'](_0x302e('0x1f'),this['syncCustomEvent'][_0x302e('0x1e')](this));ami['on'](_0x302e('0x20'),this[_0x302e('0x21')]['bind'](this));ami['on']('custom:agentcomplete',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x22'),this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on']('custom:agentnoanswer',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on']('custom:agentbusy',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x23'),this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x302e('0x25'),this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on']('custom:timeout',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x26'),this[_0x302e('0x27')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x28'),this[_0x302e('0x27')]['bind'](this));ami['on']('custom:dialend',this[_0x302e('0x27')][_0x302e('0x1e')](this));ami['on']('custom:newinteraction',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on']('custom:closedinteraction',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x29'),this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x2a'),this['syncCustomEvent'][_0x302e('0x1e')](this));ami['on']('custom:outgoingmessage',this[_0x302e('0x21')][_0x302e('0x1e')](this));ami['on'](_0x302e('0x2b'),this['syncCustomEvent'][_0x302e('0x1e')](this));ami['on']('custom:rejectmessage',this[_0x302e('0x21')]['bind'](this));ami['on'](_0x302e('0x2c'),this[_0x302e('0x21')][_0x302e('0x1e')](this));}Trigger[_0x302e('0x2d')][_0x302e('0x2e')]=function(_0x9b885f,_0x4d636a,_0x1203c4){logger[_0x302e('0x2f')](_0x9b885f,_0x4d636a,JSON[_0x302e('0x30')](_0x1203c4));io['to'](_0x9b885f)[_0x302e('0x2e')](_0x4d636a,_0x1203c4);};Trigger[_0x302e('0x2d')][_0x302e('0x21')]=function(_0x1a8227){var _0xdc2483=_[_0x302e('0x31')](_0x1a8227);if(typeof _0xdc2483[_0x302e('0x32')]===_0x302e('0x33')){_0xdc2483[_0x302e('0x32')]=_0x302e('0x34');}logger[_0x302e('0x35')](_0x302e('0x21'),util[_0x302e('0x36')](_0xdc2483,{'showHidden':!![],'depth':null}));this[_0x302e('0x37')](_0xdc2483);};Trigger[_0x302e('0x2d')][_0x302e('0x27')]=function(_0x4cba2d){if(this[_0x302e('0xf')][_0x4cba2d[_0x302e('0x38')]]){this[_0x302e('0x21')](_0x4cba2d);}};Trigger[_0x302e('0x2d')][_0x302e('0x37')]=function(_0x1dae29){var _0x35bc54;for(var _0x5bfe58 in this[_0x302e('0xe')]){if(this[_0x302e('0xe')][_0x302e('0x39')](_0x5bfe58)){if(this[_0x302e('0xe')][_0x5bfe58][_0x302e('0x3a')]){_0x35bc54=this[_0x302e('0x3b')](this[_0x302e('0xe')][_0x5bfe58],_0x1dae29);if(_0x35bc54){_[_0x302e('0x3c')](_0x1dae29,_0x1dae29[_0x302e('0x3d')]);for(var _0x282ff8=0x0,_0x18d604,_0x337a97,_0x24ffc2;_0x282ff80x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','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','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x1f1557,_0x2ee60c){var _0x112cbc=function(_0x5c5f42){while(--_0x5c5f42){_0x1f1557['push'](_0x1f1557['shift']());}};_0x112cbc(++_0x2ee60c);}(_0x7217,0x19e));var _0x7721=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7217[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f668c40..dd875d4 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 _0x3132=['/systemusers(','4.0','body','odata-entityid','substring','lastIndexOf','enduserId','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','picklist','nameField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','data2','resolve','CloudProvider','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts'];(function(_0x5edd9a,_0x48d429){var _0x2b508d=function(_0x5d7a24){while(--_0x5d7a24){_0x5edd9a['push'](_0x5edd9a['shift']());}};_0x2b508d(++_0x48d429);}(_0x3132,0x1f4));var _0x2313=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0x3132[_0x317bf0];return _0x225932;};'use strict';var _=require(_0x2313('0x0'));var rp=require(_0x2313('0x1'));var util=require(_0x2313('0x2'));var intUtil=require(_0x2313('0x3'));var md5=require('md5');var Redis=require(_0x2313('0x4'));var logger=require(_0x2313('0x5'))(_0x2313('0x6'));var config=require('../../../../config/environment');config[_0x2313('0x7')]=_[_0x2313('0x8')](config[_0x2313('0x7')],{'host':_0x2313('0x9'),'port':0x18eb});var io=require(_0x2313('0xa'))(new Redis(config[_0x2313('0x7')]));function getAuthToken(_0x4c509a,_0x2b6cee,_0x38a5e9){if(_0x4c509a[_0x2313('0xb')]){_0x4c509a[_0x2313('0xc')]=_0x4c509a['CloudProvider'][_0x2313('0xd')];_0x4c509a[_0x2313('0xe')]=_0x4c509a['CloudProvider'][_0x2313('0xf')];return Promise[_0x2313('0x10')](_0x4c509a[_0x2313('0x11')][_0x2313('0x12')]);}var _0xd797fa={'method':_0x2313('0x13'),'uri':_0x2b6cee,'form':{'client_id':_0x4c509a[_0x2313('0x14')],'resource':_0x4c509a[_0x2313('0xc')],'username':_0x4c509a[_0x2313('0x15')],'password':_0x4c509a['password'],'grant_type':_0x2313('0x16'),'client_secret':_0x4c509a[_0x2313('0x17')]},'json':!![]};return rp(_0xd797fa)[_0x2313('0x18')](function(_0x2d399e){return _0x2d399e[_0x2313('0x19')];})[_0x2313('0x1a')](function(_0x219ba2){logger[_0x2313('0x1b')]('['+[_0x38a5e9[_0x2313('0x1c')]()]+_0x2313('0x1d'));return _0x219ba2[_0x2313('0x1e')];});}function getUser(_0x4fc170,_0x473fb3,_0x4e85fd,_0x1149e8,_0x3d1b6e,_0x3619d0){return new Promise(function(_0x2b86ce,_0xce3724){return getAuthToken(_0x473fb3,_0x1149e8,_0x3619d0)['then'](function(_0x55ac11){var _0x469596={'method':_0x2313('0x1f'),'uri':_0x3d1b6e+_0x2313('0x20'),'headers':{'Authorization':_0x2313('0x21')+_0x55ac11,'OData-Version':'4.0'},'json':!![]};return rp(_0x469596);})['then'](function(_0x4900f1){var _0x32ac40=_0x4900f1[_0x2313('0x22')];var _0x920591=![];var _0x590e26=null;if(!_[_0x2313('0x23')](_0x4e85fd)){if(intUtil[_0x2313('0x24')](_0x4e85fd[_0x2313('0x25')])){_0x4fc170[_0x2313('0x26')]=_0x4e85fd['email'];for(_0x590e26=0x0;_0x590e26<_0x32ac40[_0x2313('0x27')];_0x590e26++){if(_0x32ac40[_0x590e26]['internalemailaddress']===_0x4e85fd[_0x2313('0x25')]&&!_0x32ac40[_0x590e26]['isdisabled']){_0x920591=!![];logger[_0x2313('0x28')]('['+[_0x3619d0['toUpperCase']()]+_0x2313('0x29')+_0x32ac40[_0x590e26][_0x2313('0x2a')]+'!');_0x4fc170[_0x2313('0x2b')]=_0x32ac40[_0x590e26][_0x2313('0x2a')];}}}}if(!_0x920591){logger[_0x2313('0x28')]('['+[_0x3619d0[_0x2313('0x1c')]()]+_0x2313('0x2c'));_0x4fc170[_0x2313('0x26')]=_0x473fb3[_0x2313('0x15')];for(_0x590e26=0x0;_0x590e26<_0x32ac40[_0x2313('0x27')];_0x590e26++){if(_0x32ac40[_0x590e26]['internalemailaddress']===_0x473fb3[_0x2313('0x15')]){_0x4fc170[_0x2313('0x2b')]=_0x32ac40[_0x590e26][_0x2313('0x2a')];}}}_0x2b86ce(_0x4fc170);})[_0x2313('0x1a')](function(_0x59cc2c){_0xce3724(_0x59cc2c[_0x2313('0x1e')]);});});}function createEndUser(_0x594846,_0x486ef4,_0x194ff4,_0xdad06e,_0x48fdf0,_0x201167,_0xaecfdc){return new Promise(function(_0x4400b3,_0x5c2643){return getAuthToken(_0x486ef4,_0x194ff4,_0x201167)[_0x2313('0x18')](function(_0x1988a6){var _0xee931b=_0x201167[_0x2313('0x2d')]()===_0x2313('0x2e')?_0x48fdf0[_0x2313('0x2f')]:_0x48fdf0[_0x2313('0x30')];var _0x11f86c={'method':_0x2313('0x13'),'uri':_0xdad06e+_0x2313('0x31'),'body':{'fullname':_0xee931b,'firstname':_0xee931b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2313('0x32')+_0x594846[_0x2313('0x2b')]+')'},'headers':{'Authorization':_0x2313('0x21')+_0x1988a6,'OData-Version':_0x2313('0x33')},'json':!![],'resolveWithFullResponse':!![]};_0x11f86c[_0x2313('0x34')][_0xaecfdc]=_0xee931b;return rp(_0x11f86c);})[_0x2313('0x18')](function(_0xcde63c){var _0x3f67dc=_0xcde63c['headers'][_0x2313('0x35')];var _0x3fb727=_0x3f67dc[_0x2313('0x36')](_0x3f67dc[_0x2313('0x37')]('(')+0x1,_0x3f67dc[_0x2313('0x37')](')'));_0x594846[_0x2313('0x38')]=_0x3fb727;_0x4400b3(_0x594846);})[_0x2313('0x1a')](function(_0x3c61fd){_0x5c2643(_0x3c61fd[_0x2313('0x1e')]);});});}function getEndUser(_0x1ec6b5,_0x499d49,_0x22a687,_0x478187,_0x46c91b,_0x185eb7,_0x1ee385,_0x4cfc02){var _0x487448=_0x185eb7[_0x2313('0x2d')]()==='outbound'?_0x46c91b[_0x2313('0x2f')]:_0x46c91b[_0x2313('0x30')];return getAuthToken(_0x499d49,_0x22a687,_0x185eb7)['then'](function(_0x1f9f7b){_0x4cfc02=_0x4cfc02?_0x4cfc02:'telephone1';var _0x90db9d={'method':_0x2313('0x1f'),'uri':_0x478187+'contacts?$select='+_0x4cfc02+_0x2313('0x39')+_0x4cfc02+_0x2313('0x3a')+_0x487448[_0x2313('0x3b')]('+',_0x2313('0x3c'))+'\x27','headers':{'Authorization':_0x2313('0x21')+_0x1f9f7b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x90db9d);})[_0x2313('0x18')](function(_0x3afc16){var _0x3ce1d4=![];if(!_0x3afc16)return _0x3ce1d4;var _0x234713=_0x3afc16[_0x2313('0x22')];for(var _0x5d3f1e=0x0;_0x5d3f1e<_0x234713[_0x2313('0x27')];_0x5d3f1e++){if(_0x234713[_0x5d3f1e][_0x4cfc02]===_0x487448){_0x3ce1d4=!![];_0x1ec6b5['enduserId']=_0x234713[_0x5d3f1e][_0x2313('0x3d')];}}return _0x3ce1d4;})[_0x2313('0x18')](function(_0x12117d){if(_0x12117d)return _0x1ec6b5;if(_0x1ee385===_0x2313('0x3e')){logger['info']('['+[_0x185eb7['toUpperCase']()]+_0x2313('0x3f'));return _0x1ec6b5;}return createEndUser(_0x1ec6b5,_0x499d49,_0x22a687,_0x478187,_0x46c91b,_0x185eb7,_0x4cfc02)['then'](function(_0x42adc9){logger[_0x2313('0x28')]('['+[_0x185eb7['toUpperCase']()]+_0x2313('0x40'),_0x42adc9[_0x2313('0x38')]);return _0x42adc9;});});}function getCustomFields(_0x4a59a0,_0x53573e,_0x7fa8c9){var _0x4a4c1a={};if(_0x4a59a0['length']>0x0){_[_0x2313('0x41')](_0x4a59a0,function(_0x31c92f){if(_['includes'](['string',_0x2313('0x42')],_0x31c92f['type'])&&_0x31c92f[_0x2313('0x43')]&&!_0x31c92f['customField']){var _0x273509=_0x31c92f['idField'][_0x2313('0x2d')]();var _0x150455=_0x273509['substring'](0x0,_0x273509[_0x2313('0x44')]('_'));var _0x4d182d=_0x273509[_0x2313('0x36')](_0x273509[_0x2313('0x44')]('_')+0x1);if(_0x150455===_0x7fa8c9){_0x4a4c1a[_0x4d182d]=_0x31c92f[_0x2313('0x45')];}}});}return _0x4a4c1a;}function getTicket(_0x4c79f9,_0x6eeacc,_0x1de582,_0x265761,_0x2c27b6,_0x38f974,_0x19b535){return new Promise(function(_0x557778,_0x2350c5){var _0x4dc7a2;return getAuthToken(_0x6eeacc,_0x1de582,_0x19b535)[_0x2313('0x18')](function(_0x5d4fb0){if(_0x38f974[_0x2313('0x46')]===_0x2313('0x47')){_0x4dc7a2={'method':_0x2313('0x13'),'uri':_0x265761+_0x2313('0x48'),'body':Object[_0x2313('0x49')]({},{'title':intUtil[_0x2313('0x4a')](_0x38f974[_0x2313('0x4b')],_0x2c27b6,'\x20'),'description':intUtil[_0x2313('0x4a')](_0x38f974[_0x2313('0x4c')],_0x2c27b6,'\x0a'),'customerid_contact@odata.bind':_0x4c79f9[_0x2313('0x38')]?_0x2313('0x4d')+_0x4c79f9['enduserId']+')':undefined,'ownerid@odata.bind':_0x2313('0x32')+_0x4c79f9[_0x2313('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x38f974[_0x2313('0x4e')],_0x2c27b6,_0x38f974[_0x2313('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x5d4fb0,'OData-Version':_0x2313('0x33')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x38f974[_0x2313('0x46')]===_0x2313('0x4f')){var _0x455793=_0x4c79f9[_0x2313('0x38')]?[{'partyid_systemuser@odata.bind':_0x2313('0x32')+_0x4c79f9['userId']+')','participationtypemask':_0x4c79f9['callDirection']===_0x2313('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x2313('0x4d')+_0x4c79f9[_0x2313('0x38')]+')','participationtypemask':_0x4c79f9[_0x2313('0x51')]===_0x2313('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x2313('0x32')+_0x4c79f9[_0x2313('0x2b')]+')','participationtypemask':_0x4c79f9[_0x2313('0x51')]===_0x2313('0x50')?0x2:0x1}];_0x4dc7a2={'method':'POST','uri':_0x265761+_0x2313('0x52'),'body':Object[_0x2313('0x49')]({},{'subject':intUtil[_0x2313('0x4a')](_0x38f974[_0x2313('0x4b')],_0x2c27b6,'\x20'),'phonenumber':String(_0x2c27b6['calleridnum']),'description':intUtil[_0x2313('0x4a')](_0x38f974[_0x2313('0x4c')],_0x2c27b6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4c79f9[_0x2313('0x38')]?'/contacts('+_0x4c79f9[_0x2313('0x38')]+')':undefined,'ownerid@odata.bind':_0x2313('0x32')+_0x4c79f9[_0x2313('0x2b')]+')','directioncode':_0x4c79f9['callDirection']===_0x2313('0x50')?![]:!![],'phonecall_activity_parties':_0x455793},getCustomFields(_0x38f974[_0x2313('0x4e')],_0x2c27b6,_0x38f974['ticketType'])),'headers':{'Authorization':_0x2313('0x21')+_0x5d4fb0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4dc7a2);})['then'](function(_0x2bea5d){var _0x15312c=_0x2bea5d['headers'][_0x2313('0x35')];var _0x134eb6=_0x15312c[_0x2313('0x36')](_0x15312c[_0x2313('0x37')]('(')+0x1,_0x15312c[_0x2313('0x37')](')'));_0x4c79f9['ticketId']=_0x134eb6;_0x557778(_0x4c79f9);})[_0x2313('0x1a')](function(_0xcffcef){_0x2350c5(_0xcffcef[_0x2313('0x1e')]);});});}function emit(_0x3ae6fe,_0x50a6c6,_0x382ac6,_0x3c89a3){var _0x31f87e={'uri':util[_0x2313('0x53')](_0x2313('0x54'),_0x3ae6fe,_0x382ac6,_0x3c89a3)};io['to'](util['format'](_0x2313('0x55'),_0x50a6c6))[_0x2313('0x56')](_0x2313('0x57'),_0x31f87e);}exports['cs']=function(_0x2bf7b3,_0x123179,_0x3edb0a,_0x360c5a,_0x55fcab,_0x3c664b,_0x2930a5,_0x1ba52e){var _0x3fe662={};_0x3c664b['remoteUri']=_0x3c664b['modernAuthentication']?intUtil['stripTrailingSlash'](_0x3c664b['CloudProvider'][_0x2313('0xd')]):intUtil[_0x2313('0x58')](_0x3c664b[_0x2313('0xc')]);_0x3c664b['serverUrl']=intUtil['stripTrailingSlash'](_0x3c664b[_0x2313('0x59')]);_0x3fe662['callDirection']=_0x1ba52e===_0x2313('0x50')||_0x1ba52e===_0x2313('0x5a')?_0x2313('0x50'):_0x2313('0x2e');var _0x47f566=_0x3c664b[_0x2313('0xb')]?util[_0x2313('0x53')](_0x2313('0x5b'),_0x3c664b[_0x2313('0x11')]['data7']):util[_0x2313('0x53')](_0x2313('0x5b'),_0x3c664b[_0x2313('0xc')]);var _0x3d6ce2=util[_0x2313('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3c664b[_0x2313('0xe')]);var _0xbbe7ea=util[_0x2313('0x53')](_0x2313('0x5c'),_0x3c664b[_0x2313('0x59')],_0x123179[_0x2313('0x5d')],md5(_0x123179['uniqueid']));if(_0x55fcab&&_0x55fcab['monitor_format']){logger[_0x2313('0x28')]('[QUEUE]',_0x2313('0x5e'));_0x123179[_0x2313('0x5f')]=_0xbbe7ea;}else if(_0x2930a5&&_0x2930a5[_0x2313('0x60')]&&_0x2930a5[_0x2313('0x60')]!==_0x2313('0x61')){logger[_0x2313('0x28')]('[OUTBOUND]',_0x2313('0x5e'));_0x123179[_0x2313('0x5f')]=_0xbbe7ea;}else{_0x123179[_0x2313('0x5f')]='';}return getUser(_0x3fe662,_0x3c664b,_0x360c5a,_0x3d6ce2,_0x47f566,_0x1ba52e)['then'](function(_0xe9d04){logger['info']('['+_0x1ba52e[_0x2313('0x1c')]()+']\x20The\x20User\x20ID\x20is:',_0xe9d04[_0x2313('0x2b')]);logger['info']('['+_0x1ba52e[_0x2313('0x1c')]()+_0x2313('0x62'),_0xe9d04['userEmail']);return getEndUser(_0xe9d04,_0x3c664b,_0x3d6ce2,_0x47f566,_0x123179,_0x1ba52e,_0x3edb0a[_0x2313('0x63')],_0x3edb0a[_0x2313('0x64')]);})[_0x2313('0x18')](function(_0x47cd60){logger[_0x2313('0x28')]('['+_0x1ba52e['toUpperCase']()+_0x2313('0x65'),_0x47cd60[_0x2313('0x38')]);logger[_0x2313('0x28')]('['+_0x1ba52e[_0x2313('0x1c')]()+_0x2313('0x66'),_0x123179['calleridnum']);return getTicket(_0x47cd60,_0x3c664b,_0x3d6ce2,_0x47f566,_0x123179,_0x3edb0a,_0x1ba52e);})[_0x2313('0x18')](function(_0x8cb640){logger[_0x2313('0x28')](util[_0x2313('0x53')]('['+_0x1ba52e['toUpperCase']()+_0x2313('0x67'),_0x3edb0a[_0x2313('0x46')],_0x8cb640['ticketId']));logger[_0x2313('0x28')](util[_0x2313('0x53')]('['+_0x1ba52e[_0x2313('0x1c')]()+_0x2313('0x68'),_0x1ba52e));if(_0x1ba52e!==_0x2313('0x5a')&&_0x3edb0a[_0x2313('0x69')]){logger[_0x2313('0x28')]('['+_0x1ba52e[_0x2313('0x1c')]()+']',_0x2313('0x6a'));emit(_0x3c664b['remoteUri'],_0x360c5a[_0x2313('0x6b')],_0x3edb0a[_0x2313('0x46')],_0x8cb640['ticketId']);}})[_0x2313('0x1a')](function(_0x162bfe){logger[_0x2313('0x1b')]('['+_0x1ba52e[_0x2313('0x1c')]()+_0x2313('0x6c'),_0x162bfe[_0x2313('0x1e')]);console[_0x2313('0x1b')](_0x2313('0x6d'),_0x162bfe);});}; \ No newline at end of file +var _0x2ad9=['POST','clientId','username','password','clientSecret','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','destcalleridnum','contacts','body','headers','substring','lastIndexOf','enduserId','calleridnum','telephone1','GET','&$filter=','\x20eq\x20\x27','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','/systemusers(','queue','callDirection','phonecalls','Descriptions','Fields','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x2ad9,0x1b5));var _0x92ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ad9[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x92ad('0x0'));var rp=require(_0x92ad('0x1'));var util=require('util');var intUtil=require(_0x92ad('0x2'));var md5=require('md5');var Redis=require(_0x92ad('0x3'));var logger=require(_0x92ad('0x4'))(_0x92ad('0x5'));var config=require(_0x92ad('0x6'));config[_0x92ad('0x7')]=_[_0x92ad('0x8')](config[_0x92ad('0x7')],{'host':_0x92ad('0x9'),'port':0x18eb});var io=require(_0x92ad('0xa'))(new Redis(config[_0x92ad('0x7')]));function getAuthToken(_0x385e11,_0x382bec,_0x5772e5){if(_0x385e11[_0x92ad('0xb')]){_0x385e11[_0x92ad('0xc')]=_0x385e11['CloudProvider'][_0x92ad('0xd')];_0x385e11[_0x92ad('0xe')]=_0x385e11[_0x92ad('0xf')][_0x92ad('0x10')];return Promise[_0x92ad('0x11')](_0x385e11[_0x92ad('0xf')][_0x92ad('0x12')]);}var _0x274d03={'method':_0x92ad('0x13'),'uri':_0x382bec,'form':{'client_id':_0x385e11[_0x92ad('0x14')],'resource':_0x385e11[_0x92ad('0xc')],'username':_0x385e11[_0x92ad('0x15')],'password':_0x385e11['password'],'grant_type':_0x92ad('0x16'),'client_secret':_0x385e11[_0x92ad('0x17')]},'json':!![]};return rp(_0x274d03)['then'](function(_0x593277){return _0x593277[_0x92ad('0x18')];})[_0x92ad('0x19')](function(_0x54abf4){logger[_0x92ad('0x1a')]('['+[_0x5772e5['toUpperCase']()]+_0x92ad('0x1b'));return _0x54abf4[_0x92ad('0x1c')];});}function getUser(_0xb08edb,_0x4bafbd,_0x470557,_0x56a35f,_0x2f061d,_0x18674){return new Promise(function(_0x1505ec,_0x2602a9){return getAuthToken(_0x4bafbd,_0x56a35f,_0x18674)[_0x92ad('0x1d')](function(_0x3d3eb6){var _0x35c358={'method':'GET','uri':_0x2f061d+_0x92ad('0x1e'),'headers':{'Authorization':_0x92ad('0x1f')+_0x3d3eb6,'OData-Version':_0x92ad('0x20')},'json':!![]};return rp(_0x35c358);})[_0x92ad('0x1d')](function(_0x275019){var _0x30c2e6=_0x275019[_0x92ad('0x21')];var _0x18f63b=![];var _0x466c74=null;if(!_[_0x92ad('0x22')](_0x470557)){if(intUtil['validateEmail'](_0x470557[_0x92ad('0x23')])){_0xb08edb['userEmail']=_0x470557['email'];for(_0x466c74=0x0;_0x466c74<_0x30c2e6[_0x92ad('0x24')];_0x466c74++){if(_0x30c2e6[_0x466c74][_0x92ad('0x25')]===_0x470557[_0x92ad('0x23')]&&!_0x30c2e6[_0x466c74][_0x92ad('0x26')]){_0x18f63b=!![];logger[_0x92ad('0x27')]('['+[_0x18674[_0x92ad('0x28')]()]+_0x92ad('0x29')+_0x30c2e6[_0x466c74][_0x92ad('0x2a')]+'!');_0xb08edb[_0x92ad('0x2b')]=_0x30c2e6[_0x466c74][_0x92ad('0x2a')];}}}}if(!_0x18f63b){logger[_0x92ad('0x27')]('['+[_0x18674[_0x92ad('0x28')]()]+_0x92ad('0x2c'));_0xb08edb[_0x92ad('0x2d')]=_0x4bafbd['username'];for(_0x466c74=0x0;_0x466c74<_0x30c2e6[_0x92ad('0x24')];_0x466c74++){if(_0x30c2e6[_0x466c74][_0x92ad('0x25')]===_0x4bafbd[_0x92ad('0x15')]){_0xb08edb[_0x92ad('0x2b')]=_0x30c2e6[_0x466c74]['systemuserid'];}}}_0x1505ec(_0xb08edb);})[_0x92ad('0x19')](function(_0x56ace6){_0x2602a9(_0x56ace6[_0x92ad('0x1c')]);});});}function createEndUser(_0xed612b,_0x4ce9ee,_0x427978,_0x2cc091,_0x23a23a,_0x5161cc,_0x27556a){return new Promise(function(_0x137d37,_0x14d4d2){return getAuthToken(_0x4ce9ee,_0x427978,_0x5161cc)[_0x92ad('0x1d')](function(_0x524f59){var _0xdc3f49=_0x5161cc[_0x92ad('0x2e')]()==='outbound'?_0x23a23a[_0x92ad('0x2f')]:_0x23a23a['calleridnum'];var _0x53e2bb={'method':'POST','uri':_0x2cc091+_0x92ad('0x30'),'body':{'fullname':_0xdc3f49,'firstname':_0xdc3f49,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xed612b[_0x92ad('0x2b')]+')'},'headers':{'Authorization':_0x92ad('0x1f')+_0x524f59,'OData-Version':_0x92ad('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x53e2bb[_0x92ad('0x31')][_0x27556a]=_0xdc3f49;return rp(_0x53e2bb);})['then'](function(_0x19add3){var _0x3fba0d=_0x19add3[_0x92ad('0x32')]['odata-entityid'];var _0x516cf9=_0x3fba0d[_0x92ad('0x33')](_0x3fba0d[_0x92ad('0x34')]('(')+0x1,_0x3fba0d['lastIndexOf'](')'));_0xed612b[_0x92ad('0x35')]=_0x516cf9;_0x137d37(_0xed612b);})[_0x92ad('0x19')](function(_0x5b54af){_0x14d4d2(_0x5b54af['message']);});});}function getEndUser(_0xb492f0,_0x325ed1,_0x1c9613,_0x2c6fbc,_0x2210ce,_0x712f2b,_0x12049d,_0x427542){var _0x5ee389=_0x712f2b[_0x92ad('0x2e')]()==='outbound'?_0x2210ce[_0x92ad('0x2f')]:_0x2210ce[_0x92ad('0x36')];return getAuthToken(_0x325ed1,_0x1c9613,_0x712f2b)[_0x92ad('0x1d')](function(_0xa0c544){_0x427542=_0x427542?_0x427542:_0x92ad('0x37');var _0x3ab394={'method':_0x92ad('0x38'),'uri':_0x2c6fbc+'contacts?$select='+_0x427542+_0x92ad('0x39')+_0x427542+_0x92ad('0x3a')+_0x5ee389['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x92ad('0x1f')+_0xa0c544,'If-None-Match':null,'OData-Version':_0x92ad('0x20')},'json':!![]};return rp(_0x3ab394);})[_0x92ad('0x1d')](function(_0x4f0ae2){var _0x10dbcf=![];if(!_0x4f0ae2)return _0x10dbcf;var _0x168e69=_0x4f0ae2['value'];for(var _0x507ca4=0x0;_0x507ca4<_0x168e69['length'];_0x507ca4++){if(_0x168e69[_0x507ca4][_0x427542]===_0x5ee389){_0x10dbcf=!![];_0xb492f0[_0x92ad('0x35')]=_0x168e69[_0x507ca4]['contactid'];}}return _0x10dbcf;})['then'](function(_0x19d85d){if(_0x19d85d)return _0xb492f0;if(_0x12049d===_0x92ad('0x3b')){logger[_0x92ad('0x27')]('['+[_0x712f2b[_0x92ad('0x28')]()]+_0x92ad('0x3c'));return _0xb492f0;}return createEndUser(_0xb492f0,_0x325ed1,_0x1c9613,_0x2c6fbc,_0x2210ce,_0x712f2b,_0x427542)[_0x92ad('0x1d')](function(_0x144c10){logger[_0x92ad('0x27')]('['+[_0x712f2b['toUpperCase']()]+_0x92ad('0x3d'),_0x144c10['enduserId']);return _0x144c10;});});}function getCustomFields(_0x3b85cd,_0x4b1f07,_0xbcf26d){var _0x42901d={};if(_0x3b85cd['length']>0x0){_[_0x92ad('0x3e')](_0x3b85cd,function(_0x274455){if(_[_0x92ad('0x3f')]([_0x92ad('0x40'),_0x92ad('0x41')],_0x274455[_0x92ad('0x42')])&&_0x274455[_0x92ad('0x43')]&&!_0x274455[_0x92ad('0x44')]){var _0x11ccbc=_0x274455[_0x92ad('0x45')][_0x92ad('0x2e')]();var _0x3bfd55=_0x11ccbc['substring'](0x0,_0x11ccbc[_0x92ad('0x46')]('_'));var _0x306ffd=_0x11ccbc[_0x92ad('0x33')](_0x11ccbc[_0x92ad('0x46')]('_')+0x1);if(_0x3bfd55===_0xbcf26d){_0x42901d[_0x306ffd]=_0x274455['content'];}}});}return _0x42901d;}function getTicket(_0x399715,_0x4d61b1,_0x517356,_0x1da2ea,_0x276fe2,_0x490c16,_0x2312da){return new Promise(function(_0x1ecb66,_0x307ecb){var _0x19cf16;return getAuthToken(_0x4d61b1,_0x517356,_0x2312da)['then'](function(_0x2fc159){if(_0x490c16[_0x92ad('0x47')]===_0x92ad('0x48')){_0x19cf16={'method':'POST','uri':_0x1da2ea+_0x92ad('0x49'),'body':Object[_0x92ad('0x4a')]({},{'title':intUtil[_0x92ad('0x4b')](_0x490c16[_0x92ad('0x4c')],_0x276fe2,'\x20'),'description':intUtil[_0x92ad('0x4b')](_0x490c16['Descriptions'],_0x276fe2,'\x0a'),'customerid_contact@odata.bind':_0x399715[_0x92ad('0x35')]?_0x92ad('0x4d')+_0x399715[_0x92ad('0x35')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x399715[_0x92ad('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x490c16['Fields'],_0x276fe2,_0x490c16[_0x92ad('0x47')])),'headers':{'Authorization':_0x92ad('0x1f')+_0x2fc159,'OData-Version':_0x92ad('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x490c16['ticketType']==='phonecall'){var _0x4e1949=_0x399715[_0x92ad('0x35')]?[{'partyid_systemuser@odata.bind':_0x92ad('0x4e')+_0x399715[_0x92ad('0x2b')]+')','participationtypemask':_0x399715['callDirection']===_0x92ad('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x92ad('0x4d')+_0x399715['enduserId']+')','participationtypemask':_0x399715[_0x92ad('0x50')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x92ad('0x4e')+_0x399715['userId']+')','participationtypemask':_0x399715[_0x92ad('0x50')]===_0x92ad('0x4f')?0x2:0x1}];_0x19cf16={'method':'POST','uri':_0x1da2ea+_0x92ad('0x51'),'body':Object[_0x92ad('0x4a')]({},{'subject':intUtil['getString'](_0x490c16[_0x92ad('0x4c')],_0x276fe2,'\x20'),'phonenumber':String(_0x276fe2[_0x92ad('0x36')]),'description':intUtil['getString'](_0x490c16[_0x92ad('0x52')],_0x276fe2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x399715[_0x92ad('0x35')]?'/contacts('+_0x399715['enduserId']+')':undefined,'ownerid@odata.bind':_0x92ad('0x4e')+_0x399715[_0x92ad('0x2b')]+')','directioncode':_0x399715['callDirection']===_0x92ad('0x4f')?![]:!![],'phonecall_activity_parties':_0x4e1949},getCustomFields(_0x490c16[_0x92ad('0x53')],_0x276fe2,_0x490c16[_0x92ad('0x47')])),'headers':{'Authorization':_0x92ad('0x1f')+_0x2fc159,'OData-Version':_0x92ad('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x19cf16);})[_0x92ad('0x1d')](function(_0x52c70d){var _0xace8c4=_0x52c70d[_0x92ad('0x32')][_0x92ad('0x54')];var _0x2605f5=_0xace8c4['substring'](_0xace8c4[_0x92ad('0x34')]('(')+0x1,_0xace8c4[_0x92ad('0x34')](')'));_0x399715[_0x92ad('0x55')]=_0x2605f5;_0x1ecb66(_0x399715);})[_0x92ad('0x19')](function(_0xe7065f){_0x307ecb(_0xe7065f[_0x92ad('0x1c')]);});});}function emit(_0x5411ce,_0xb73237,_0x47f679,_0x3e5602){var _0x1236f3={'uri':util[_0x92ad('0x56')](_0x92ad('0x57'),_0x5411ce,_0x47f679,_0x3e5602)};io['to'](util[_0x92ad('0x56')](_0x92ad('0x58'),_0xb73237))[_0x92ad('0x59')]('trigger:browser:url',_0x1236f3);}exports['cs']=function(_0x5f422f,_0x50b0b2,_0xa4c81c,_0x4d45f2,_0x51f06d,_0x246c46,_0x518152,_0x2ebb77){var _0x5e0177={};_0x246c46['remoteUri']=_0x246c46[_0x92ad('0xb')]?intUtil['stripTrailingSlash'](_0x246c46['CloudProvider'][_0x92ad('0xd')]):intUtil[_0x92ad('0x5a')](_0x246c46['remoteUri']);_0x246c46['serverUrl']=intUtil['stripTrailingSlash'](_0x246c46[_0x92ad('0x5b')]);_0x5e0177[_0x92ad('0x50')]=_0x2ebb77===_0x92ad('0x4f')||_0x2ebb77===_0x92ad('0x5c')?'queue':_0x92ad('0x5d');var _0x31a64c=_0x246c46[_0x92ad('0xb')]?util[_0x92ad('0x56')](_0x92ad('0x5e'),_0x246c46[_0x92ad('0xf')][_0x92ad('0xd')]):util[_0x92ad('0x56')](_0x92ad('0x5e'),_0x246c46['remoteUri']);var _0x379326=util[_0x92ad('0x56')](_0x92ad('0x5f'),_0x246c46['tenantId']);var _0x28dbf9=util[_0x92ad('0x56')](_0x92ad('0x60'),_0x246c46[_0x92ad('0x5b')],_0x50b0b2[_0x92ad('0x61')],md5(_0x50b0b2[_0x92ad('0x61')]));if(_0x51f06d&&_0x51f06d['monitor_format']){logger[_0x92ad('0x27')](_0x92ad('0x62'),_0x92ad('0x63'));_0x50b0b2[_0x92ad('0x64')]=_0x28dbf9;}else if(_0x518152&&_0x518152[_0x92ad('0x65')]&&_0x518152[_0x92ad('0x65')]!==_0x92ad('0x66')){logger[_0x92ad('0x27')](_0x92ad('0x67'),'Recording\x20is\x20enabled!');_0x50b0b2[_0x92ad('0x64')]=_0x28dbf9;}else{_0x50b0b2[_0x92ad('0x64')]='';}return getUser(_0x5e0177,_0x246c46,_0x4d45f2,_0x379326,_0x31a64c,_0x2ebb77)['then'](function(_0x5e7c1d){logger[_0x92ad('0x27')]('['+_0x2ebb77[_0x92ad('0x28')]()+_0x92ad('0x68'),_0x5e7c1d[_0x92ad('0x2b')]);logger[_0x92ad('0x27')]('['+_0x2ebb77[_0x92ad('0x28')]()+_0x92ad('0x69'),_0x5e7c1d[_0x92ad('0x2d')]);return getEndUser(_0x5e7c1d,_0x246c46,_0x379326,_0x31a64c,_0x50b0b2,_0x2ebb77,_0xa4c81c[_0x92ad('0x6a')],_0xa4c81c[_0x92ad('0x6b')]);})[_0x92ad('0x1d')](function(_0x4f61a7){logger[_0x92ad('0x27')]('['+_0x2ebb77[_0x92ad('0x28')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4f61a7[_0x92ad('0x35')]);logger[_0x92ad('0x27')]('['+_0x2ebb77[_0x92ad('0x28')]()+_0x92ad('0x6c'),_0x50b0b2['calleridnum']);return getTicket(_0x4f61a7,_0x246c46,_0x379326,_0x31a64c,_0x50b0b2,_0xa4c81c,_0x2ebb77);})[_0x92ad('0x1d')](function(_0x8983ee){logger[_0x92ad('0x27')](util[_0x92ad('0x56')]('['+_0x2ebb77[_0x92ad('0x28')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xa4c81c['ticketType'],_0x8983ee[_0x92ad('0x55')]));logger[_0x92ad('0x27')](util[_0x92ad('0x56')]('['+_0x2ebb77[_0x92ad('0x28')]()+']\x20Call\x20direction:\x20%s',_0x2ebb77));if(_0x2ebb77!==_0x92ad('0x5c')&&_0xa4c81c[_0x92ad('0x6d')]){logger[_0x92ad('0x27')]('['+_0x2ebb77['toUpperCase']()+']',_0x92ad('0x6e'));emit(_0x246c46[_0x92ad('0xc')],_0x4d45f2[_0x92ad('0x6f')],_0xa4c81c[_0x92ad('0x47')],_0x8983ee[_0x92ad('0x55')]);}})[_0x92ad('0x19')](function(_0x529777){logger[_0x92ad('0x1a')]('['+_0x2ebb77[_0x92ad('0x28')]()+_0x92ad('0x70'),_0x529777['message']);console[_0x92ad('0x1a')](_0x92ad('0x71'),_0x529777);});}; \ 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 aaf21cd..1e05a67 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 _0xa273=['request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','format','remoteUri','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','find','%s/api/v2/contacts','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','toString','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x1d36e9,_0x486977){var _0x824c53=function(_0x3dfce2){while(--_0x3dfce2){_0x1d36e9['push'](_0x1d36e9['shift']());}};_0x824c53(++_0x486977);}(_0xa273,0xb2));var _0x3a27=function(_0x2627f7,_0x260946){_0x2627f7=_0x2627f7-0x0;var _0xf525c7=_0xa273[_0x2627f7];return _0xf525c7;};'use strict';var _=require('lodash');var rp=require(_0x3a27('0x0'));var md5=require(_0x3a27('0x1'));var util=require('util');var Redis=require(_0x3a27('0x2'));var intUtil=require('./util');var config=require(_0x3a27('0x3'));var logger=require(_0x3a27('0x4'))(_0x3a27('0x5'));config[_0x3a27('0x6')]=_[_0x3a27('0x7')](config[_0x3a27('0x6')],{'host':_0x3a27('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x3a27('0x9'),'Accept':_0x3a27('0x9')};function emit(_0x3b5041,_0xbf5ed7,_0x1dc96b){io['to'](_0x3b5041)[_0x3a27('0xa')](_0xbf5ed7,_0x1dc96b);}function getTicket(_0x4ae793,_0x1a0b6b,_0x4d5189,_0x43a734,_0xc8ea6e){logger[_0x3a27('0xb')](_0x3a27('0xc'));var _0x370865=_[_0x3a27('0xd')]({'responder_id':_0x1a0b6b['id'],'requester_id':_0x4d5189['id'],'name':util['format'](_0x3a27('0xe'),_0xc8ea6e['calleridname']),'phone':_0xc8ea6e[_0x3a27('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3a27('0x10')](_0x43a734['Subjects'],_0xc8ea6e,'\x20'),'description':intUtil[_0x3a27('0x10')](_0x43a734[_0x3a27('0x11')],_0xc8ea6e,'
'),'tags':getTags(_0x43a734[_0x3a27('0x12')],_0x3a27('0x13'))},getCustomFields(_0x43a734[_0x3a27('0x14')],_0xc8ea6e));_0x370865[_0x3a27('0x15')]=_[_0x3a27('0x16')](_[_0x3a27('0x17')](_0x370865[_0x3a27('0x15')],'id'),'value');return request({'uri':util['format'](_0x3a27('0x18'),_0x4ae793['remoteUri']),'method':_0x3a27('0x19'),'body':_0x370865})[_0x3a27('0x1a')](function(_0x447549){logger[_0x3a27('0xb')](_0x3a27('0x1b'));return _0x447549;});}function getUser(_0x503327,_0xdd4a20){if(intUtil[_0x3a27('0x1c')](_0xdd4a20)){return request({'uri':util[_0x3a27('0x1d')]('%s/api/v2/agents',_0x503327[_0x3a27('0x1e')]),'qs':{'email':_0xdd4a20}})['then'](function(_0x4b5759){if(_0x4b5759[_0x3a27('0x1f')]){logger[_0x3a27('0xb')](_0x3a27('0x20'));return _['find'](_0x4b5759,function(_0x12a8c4){return _0x12a8c4[_0x3a27('0x21')][_0x3a27('0x22')]===_0xdd4a20;});}else{logger[_0x3a27('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3a27('0x1d')](_0x3a27('0x23'),_0x503327[_0x3a27('0x1e')])})[_0x3a27('0x1a')](function(_0x55e5a6){logger[_0x3a27('0xb')](_0x3a27('0x24'));return _0x55e5a6;});}});}else{logger[_0x3a27('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x3a27('0x23'),_0x503327[_0x3a27('0x1e')])})[_0x3a27('0x1a')](function(_0x20aabf){logger[_0x3a27('0xb')](_0x3a27('0x24'));return _0x20aabf;});}}function getEndUser(_0x340b68,_0x9d440,_0x368891){logger[_0x3a27('0xb')]('Searching\x20enduser\x20with\x20phone',_0x368891);return request({'uri':util[_0x3a27('0x1d')]('%s/api/v2/contacts',_0x340b68[_0x3a27('0x1e')]),'qs':{'phone':_0x368891}})[_0x3a27('0x1a')](function(_0x12a157){if(_0x12a157[_0x3a27('0x1f')]){logger[_0x3a27('0xb')]('Enduser\x20found!');return _[_0x3a27('0x25')](_0x12a157,{'phone':_0x368891});}else{logger[_0x3a27('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x3a27('0x26'),_0x340b68[_0x3a27('0x1e')]),'method':_0x3a27('0x19'),'body':{'name':_0x9d440,'phone':_0x368891}})[_0x3a27('0x1a')](function(_0x28281f){logger[_0x3a27('0xb')]('Enduser\x20created.');return _0x28281f;});}});}function getAuth(_0x1e8cac){return util[_0x3a27('0x1d')]('Basic\x20%s',new Buffer(_0x1e8cac[_0x3a27('0x27')]+':X')['toString'](_0x3a27('0x28')));}function request(_0x692bc2){logger[_0x3a27('0x29')](_0x3a27('0x2a'),JSON[_0x3a27('0x2b')](_0x692bc2));return rp(_[_0x3a27('0x7')](_0x692bc2,{'method':_0x3a27('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x4f63ee,_0x1788b9){var _0x3acb16=[];if(_0x4f63ee&&_0x4f63ee[_0x3a27('0x1f')]>0x0){_0x3acb16=_[_0x3a27('0x2d')](_0x4f63ee,_0x1788b9);}return _0x3acb16;}function getCustomFields(_0x2e58d1,_0x15817f){var _0x7b2e21=[];var _0x165285={'custom_fields':[]};if(_0x2e58d1[_0x3a27('0x1f')]>0x0){_[_0x3a27('0x2e')](_0x2e58d1,function(_0x14154a){if(_[_0x3a27('0x2f')]([_0x3a27('0x30'),_0x3a27('0x31')],_0x14154a[_0x3a27('0x32')])&&_0x14154a[_0x3a27('0x33')]&&!_0x14154a[_0x3a27('0x34')]){_0x165285[_0x14154a[_0x3a27('0x33')][_0x3a27('0x35')]()]=_0x14154a[_0x3a27('0x36')]['toString']();}else if(_[_0x3a27('0x2f')]([_0x3a27('0x30'),_0x3a27('0x31')],_0x14154a[_0x3a27('0x32')])&&_0x14154a[_0x3a27('0x37')]&&_0x14154a[_0x3a27('0x34')]){_0x165285[_0x3a27('0x15')][_0x3a27('0x38')]({'id':_0x14154a['idField'],'value':_0x14154a[_0x3a27('0x36')][_0x3a27('0x39')]()});}else if(_0x14154a[_0x3a27('0x32')]===_0x3a27('0x3a')&&_0x14154a[_0x3a27('0x3b')]&&_0x14154a[_0x3a27('0x37')]&&_0x14154a[_0x3a27('0x34')]){_0x15817f[_0x14154a['variableName']]&&_0x165285[_0x3a27('0x15')]['push']({'id':_0x14154a['idField'],'value':_0x15817f[_0x14154a[_0x3a27('0x3b')]][_0x3a27('0x39')]()});}else if(_0x14154a[_0x3a27('0x32')]==='customVariable'&&_0x14154a[_0x3a27('0x3c')]&&_0x14154a[_0x3a27('0x3c')][_0x3a27('0x13')]&&_0x14154a[_0x3a27('0x37')]&&_0x14154a[_0x3a27('0x34')]){_0x15817f[_0x14154a[_0x3a27('0x3c')][_0x3a27('0x13')]['toLowerCase']()]&&_0x165285['custom_fields'][_0x3a27('0x38')]({'id':_0x14154a[_0x3a27('0x37')],'value':_0x15817f[_0x14154a[_0x3a27('0x3c')][_0x3a27('0x13')][_0x3a27('0x35')]()][_0x3a27('0x39')]()});}});}return _0x165285;}exports[_0x3a27('0x3d')]=function(_0xd2ca38,_0x3f8765,_0x2add06,_0x182849,_0x2f563c,_0x8b0d28){var _0x40f4fa,_0x17c2cb;_0x8b0d28[_0x3a27('0x1e')]=intUtil[_0x3a27('0x3e')](_0x8b0d28[_0x3a27('0x1e')]);_0x8b0d28[_0x3a27('0x3f')]=intUtil['stripTrailingSlash'](_0x8b0d28[_0x3a27('0x3f')]);if(_0x2f563c&&_0x2f563c[_0x3a27('0x40')]){logger[_0x3a27('0xb')](_0x3a27('0x41'),_0x3a27('0x42'));_0x3f8765['recordingURL']=util[_0x3a27('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8b0d28[_0x3a27('0x3f')],_0x3f8765[_0x3a27('0x43')],md5(_0x3f8765[_0x3a27('0x43')]));}else{_0x3f8765[_0x3a27('0x44')]='';}headers[_0x3a27('0x45')]=getAuth(_0x8b0d28);return getUser(_0x8b0d28,_0x182849[_0x3a27('0x22')])['then'](function(_0x1be110){_0x40f4fa=_0x1be110;logger[_0x3a27('0xb')](_0x3a27('0x46'),_0x40f4fa['id']);return getEndUser(_0x8b0d28,_0x3f8765['calleridname'],_0x3f8765[_0x3a27('0xf')]);})['then'](function(_0x4b7c28){_0x17c2cb=_0x4b7c28;logger['info']('The\x20Enduser\x20ID\x20is:',_0x17c2cb['id']);return getTicket(_0x8b0d28,_0x40f4fa,_0x17c2cb,_0x2add06,_0x3f8765);})[_0x3a27('0x1a')](function(_0x2516fc){if(_0x2516fc&&_0x2516fc['id']){logger[_0x3a27('0xb')]('Ticket\x20created!');logger[_0x3a27('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2516fc['id']);logger[_0x3a27('0xb')](_0x3a27('0x41'),_0x3a27('0x47'));emit(util['format']('user:%s',_0x182849[_0x3a27('0x13')]),_0x3a27('0x48'),{'uri':util[_0x3a27('0x1d')](_0x3a27('0x49'),_0x8b0d28['remoteUri'],_0x2516fc['id'])});}})[_0x3a27('0x4a')](function(_0x380de5){logger[_0x3a27('0x4b')](_0x3a27('0x41'),JSON['stringify'](_0x380de5));});};exports[_0x3a27('0x4c')]=function(_0x45b260,_0x406e99,_0x29f34c,_0x3a39a9,_0x165b71,_0x359c32,_0x17b337){var _0x332293,_0x47376b;_0x359c32[_0x3a27('0x1e')]=intUtil[_0x3a27('0x3e')](_0x359c32[_0x3a27('0x1e')]);_0x359c32['serverUrl']=intUtil['stripTrailingSlash'](_0x359c32[_0x3a27('0x3f')]);if(_0x17b337&&_0x17b337[_0x3a27('0x4d')]&&_0x17b337[_0x3a27('0x4d')]!=='none'){logger[_0x3a27('0xb')](_0x3a27('0x4e'),'Recording\x20is\x20enabled!');_0x406e99[_0x3a27('0x44')]=util['format'](_0x3a27('0x4f'),_0x359c32['serverUrl'],_0x406e99[_0x3a27('0x43')],md5(_0x406e99[_0x3a27('0x43')]));}headers[_0x3a27('0x45')]=getAuth(_0x359c32);return getUser(_0x359c32,_0x3a39a9['email'])['then'](function(_0x3de951){_0x332293=_0x3de951;logger[_0x3a27('0xb')](_0x3a27('0x46'),_0x332293['id']);return getEndUser(_0x359c32,_0x406e99[_0x3a27('0x50')],_0x406e99[_0x3a27('0x51')]);})[_0x3a27('0x1a')](function(_0x59eb5a){_0x47376b=_0x59eb5a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x47376b['id']);return getTicket(_0x359c32,_0x332293,_0x47376b,_0x29f34c,_0x406e99);})[_0x3a27('0x1a')](function(_0x5f5af4){if(_0x5f5af4&&_0x5f5af4['id']){logger[_0x3a27('0xb')](_0x3a27('0x1b'));logger[_0x3a27('0xb')](_0x3a27('0x52'),_0x5f5af4['id']);logger[_0x3a27('0xb')](_0x3a27('0x4e'),_0x3a27('0x47'));emit(util[_0x3a27('0x1d')](_0x3a27('0x53'),_0x3a39a9['name']),_0x3a27('0x48'),{'uri':util[_0x3a27('0x1d')](_0x3a27('0x49'),_0x359c32[_0x3a27('0x1e')],_0x5f5af4['id'])});}})['catch'](function(_0x3b8be9){logger[_0x3a27('0x4b')]('[OUTBOUND]',JSON['stringify'](_0x3b8be9));});};exports[_0x3a27('0x54')]=function(_0x4dde4f,_0x7cea76,_0x101ea6,_0x2b9008,_0x547249,_0x115fee){var _0x541add,_0x16b18e;_0x115fee['remoteUri']=intUtil[_0x3a27('0x3e')](_0x115fee[_0x3a27('0x1e')]);_0x115fee[_0x3a27('0x3f')]=intUtil['stripTrailingSlash'](_0x115fee[_0x3a27('0x3f')]);if(_0x547249&&_0x547249[_0x3a27('0x40')]){logger[_0x3a27('0xb')]('['+_0x7cea76[_0x3a27('0x55')][_0x3a27('0x56')]()+']',_0x3a27('0x42'));_0x7cea76['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x115fee[_0x3a27('0x3f')],_0x7cea76['uniqueid'],md5(_0x7cea76[_0x3a27('0x43')]));}else{_0x7cea76[_0x3a27('0x44')]='';}headers['Authorization']=getAuth(_0x115fee);return getUser(_0x115fee,'')[_0x3a27('0x1a')](function(_0x138658){_0x541add=_0x138658;logger[_0x3a27('0xb')](_0x3a27('0x46'),_0x541add['id']);return getEndUser(_0x115fee,_0x7cea76[_0x3a27('0x57')],_0x7cea76['calleridnum']);})[_0x3a27('0x1a')](function(_0x3c8d2a){_0x16b18e=_0x3c8d2a;logger[_0x3a27('0xb')](_0x3a27('0x58'),_0x16b18e['id']);return getTicket(_0x115fee,_0x541add,_0x16b18e,_0x101ea6,_0x7cea76);})['then'](function(_0x3734c7){if(_0x3734c7){logger[_0x3a27('0xb')]('Ticket\x20created!');logger[_0x3a27('0xb')](_0x3a27('0x52'),_0x3734c7['id']);}})[_0x3a27('0x4a')](function(_0x5a922d){logger['error']('['+_0x7cea76['lastevent'][_0x3a27('0x56')]()+']',JSON[_0x3a27('0x2b')](_0x5a922d));});}; \ No newline at end of file +var _0x7ad8=['[HTTP]','GET','forEach','includes','string','picklist','type','nameField','customField','content','idField','variable','variableName','customVariable','Variable','toLowerCase','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','toString','base64','debug'];(function(_0x4f1939,_0x1f6992){var _0x5d5679=function(_0x31ac6a){while(--_0x31ac6a){_0x4f1939['push'](_0x4f1939['shift']());}};_0x5d5679(++_0x1f6992);}(_0x7ad8,0x19b));var _0x87ad=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7ad8[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x87ad('0x0'));var util=require(_0x87ad('0x1'));var Redis=require('ioredis');var intUtil=require(_0x87ad('0x2'));var config=require(_0x87ad('0x3'));var logger=require(_0x87ad('0x4'))(_0x87ad('0x5'));config['redis']=_[_0x87ad('0x6')](config[_0x87ad('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x87ad('0x8'))(new Redis(config[_0x87ad('0x7')]));var headers={'Content-Type':_0x87ad('0x9'),'Accept':'application/json'};function emit(_0xe1ebdb,_0x50c91d,_0x3ee347){io['to'](_0xe1ebdb)[_0x87ad('0xa')](_0x50c91d,_0x3ee347);}function getTicket(_0x1147fd,_0x2b4a87,_0x71c64a,_0x46411f,_0x52caef){logger[_0x87ad('0xb')](_0x87ad('0xc'));var _0x18e324=_[_0x87ad('0xd')]({'responder_id':_0x2b4a87['id'],'requester_id':_0x71c64a['id'],'name':util[_0x87ad('0xe')](_0x87ad('0xf'),_0x52caef[_0x87ad('0x10')]),'phone':_0x52caef[_0x87ad('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x46411f[_0x87ad('0x12')],_0x52caef,'\x20'),'description':intUtil[_0x87ad('0x13')](_0x46411f[_0x87ad('0x14')],_0x52caef,'
'),'tags':getTags(_0x46411f[_0x87ad('0x15')],_0x87ad('0x16'))},getCustomFields(_0x46411f[_0x87ad('0x17')],_0x52caef));_0x18e324[_0x87ad('0x18')]=_[_0x87ad('0x19')](_[_0x87ad('0x1a')](_0x18e324[_0x87ad('0x18')],'id'),'value');return request({'uri':util[_0x87ad('0xe')](_0x87ad('0x1b'),_0x1147fd[_0x87ad('0x1c')]),'method':_0x87ad('0x1d'),'body':_0x18e324})[_0x87ad('0x1e')](function(_0x4dcece){logger[_0x87ad('0xb')](_0x87ad('0x1f'));return _0x4dcece;});}function getUser(_0xa9a2c3,_0x545ef2){if(intUtil[_0x87ad('0x20')](_0x545ef2)){return request({'uri':util[_0x87ad('0xe')](_0x87ad('0x21'),_0xa9a2c3[_0x87ad('0x1c')]),'qs':{'email':_0x545ef2}})['then'](function(_0xb0bf0d){if(_0xb0bf0d[_0x87ad('0x22')]){logger['info'](_0x87ad('0x23'));return _[_0x87ad('0x24')](_0xb0bf0d,function(_0x35e613){return _0x35e613['contact'][_0x87ad('0x25')]===_0x545ef2;});}else{logger[_0x87ad('0xb')](_0x87ad('0x26'));return request({'uri':util['format'](_0x87ad('0x27'),_0xa9a2c3[_0x87ad('0x1c')])})['then'](function(_0x53d7ef){logger[_0x87ad('0xb')]('Admin\x20account\x20selected.');return _0x53d7ef;});}});}else{logger[_0x87ad('0xb')](_0x87ad('0x28'));return request({'uri':util[_0x87ad('0xe')](_0x87ad('0x27'),_0xa9a2c3[_0x87ad('0x1c')])})[_0x87ad('0x1e')](function(_0x42dbbc){logger[_0x87ad('0xb')](_0x87ad('0x29'));return _0x42dbbc;});}}function getEndUser(_0x3e85ba,_0x9a6b07,_0x3a33a0){logger[_0x87ad('0xb')]('Searching\x20enduser\x20with\x20phone',_0x3a33a0);return request({'uri':util['format'](_0x87ad('0x2a'),_0x3e85ba['remoteUri']),'qs':{'phone':_0x3a33a0}})['then'](function(_0x3235a4){if(_0x3235a4[_0x87ad('0x22')]){logger[_0x87ad('0xb')](_0x87ad('0x2b'));return _[_0x87ad('0x24')](_0x3235a4,{'phone':_0x3a33a0});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x87ad('0xe')](_0x87ad('0x2a'),_0x3e85ba[_0x87ad('0x1c')]),'method':'POST','body':{'name':_0x9a6b07,'phone':_0x3a33a0}})[_0x87ad('0x1e')](function(_0x79bffc){logger['info']('Enduser\x20created.');return _0x79bffc;});}});}function getAuth(_0x3621f5){return util[_0x87ad('0xe')](_0x87ad('0x2c'),new Buffer(_0x3621f5[_0x87ad('0x2d')]+':X')[_0x87ad('0x2e')](_0x87ad('0x2f')));}function request(_0x42aca4){logger[_0x87ad('0x30')](_0x87ad('0x31'),JSON['stringify'](_0x42aca4));return rp(_[_0x87ad('0x6')](_0x42aca4,{'method':_0x87ad('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x12f92d,_0x45b406){var _0x36ae76=[];if(_0x12f92d&&_0x12f92d[_0x87ad('0x22')]>0x0){_0x36ae76=_['map'](_0x12f92d,_0x45b406);}return _0x36ae76;}function getCustomFields(_0x4a2061,_0x155534){var _0xa42c32=[];var _0x3fe26d={'custom_fields':[]};if(_0x4a2061[_0x87ad('0x22')]>0x0){_[_0x87ad('0x33')](_0x4a2061,function(_0x53a39b){if(_[_0x87ad('0x34')]([_0x87ad('0x35'),_0x87ad('0x36')],_0x53a39b[_0x87ad('0x37')])&&_0x53a39b[_0x87ad('0x38')]&&!_0x53a39b[_0x87ad('0x39')]){_0x3fe26d[_0x53a39b[_0x87ad('0x38')]['toLowerCase']()]=_0x53a39b[_0x87ad('0x3a')][_0x87ad('0x2e')]();}else if(_[_0x87ad('0x34')]([_0x87ad('0x35'),'picklist'],_0x53a39b[_0x87ad('0x37')])&&_0x53a39b[_0x87ad('0x3b')]&&_0x53a39b[_0x87ad('0x39')]){_0x3fe26d[_0x87ad('0x18')]['push']({'id':_0x53a39b[_0x87ad('0x3b')],'value':_0x53a39b[_0x87ad('0x3a')][_0x87ad('0x2e')]()});}else if(_0x53a39b[_0x87ad('0x37')]===_0x87ad('0x3c')&&_0x53a39b[_0x87ad('0x3d')]&&_0x53a39b[_0x87ad('0x3b')]&&_0x53a39b['customField']){_0x155534[_0x53a39b[_0x87ad('0x3d')]]&&_0x3fe26d[_0x87ad('0x18')]['push']({'id':_0x53a39b[_0x87ad('0x3b')],'value':_0x155534[_0x53a39b[_0x87ad('0x3d')]][_0x87ad('0x2e')]()});}else if(_0x53a39b[_0x87ad('0x37')]===_0x87ad('0x3e')&&_0x53a39b[_0x87ad('0x3f')]&&_0x53a39b[_0x87ad('0x3f')][_0x87ad('0x16')]&&_0x53a39b[_0x87ad('0x3b')]&&_0x53a39b[_0x87ad('0x39')]){_0x155534[_0x53a39b[_0x87ad('0x3f')][_0x87ad('0x16')][_0x87ad('0x40')]()]&&_0x3fe26d[_0x87ad('0x18')][_0x87ad('0x41')]({'id':_0x53a39b[_0x87ad('0x3b')],'value':_0x155534[_0x53a39b[_0x87ad('0x3f')]['name'][_0x87ad('0x40')]()][_0x87ad('0x2e')]()});}});}return _0x3fe26d;}exports[_0x87ad('0x42')]=function(_0x84a6d1,_0x1e5413,_0x60387a,_0x11eb1e,_0x4534d7,_0x5cbe9f){var _0x145c13,_0x2d3c7f;_0x5cbe9f[_0x87ad('0x1c')]=intUtil[_0x87ad('0x43')](_0x5cbe9f[_0x87ad('0x1c')]);_0x5cbe9f[_0x87ad('0x44')]=intUtil[_0x87ad('0x43')](_0x5cbe9f[_0x87ad('0x44')]);if(_0x4534d7&&_0x4534d7[_0x87ad('0x45')]){logger[_0x87ad('0xb')](_0x87ad('0x46'),'Recording\x20is\x20enabled!');_0x1e5413[_0x87ad('0x47')]=util['format'](_0x87ad('0x48'),_0x5cbe9f['serverUrl'],_0x1e5413['uniqueid'],md5(_0x1e5413[_0x87ad('0x49')]));}else{_0x1e5413[_0x87ad('0x47')]='';}headers[_0x87ad('0x4a')]=getAuth(_0x5cbe9f);return getUser(_0x5cbe9f,_0x11eb1e[_0x87ad('0x25')])[_0x87ad('0x1e')](function(_0x17d451){_0x145c13=_0x17d451;logger['info'](_0x87ad('0x4b'),_0x145c13['id']);return getEndUser(_0x5cbe9f,_0x1e5413[_0x87ad('0x10')],_0x1e5413[_0x87ad('0x11')]);})[_0x87ad('0x1e')](function(_0x52cd7){_0x2d3c7f=_0x52cd7;logger[_0x87ad('0xb')](_0x87ad('0x4c'),_0x2d3c7f['id']);return getTicket(_0x5cbe9f,_0x145c13,_0x2d3c7f,_0x60387a,_0x1e5413);})[_0x87ad('0x1e')](function(_0x53c0ba){if(_0x53c0ba&&_0x53c0ba['id']){logger[_0x87ad('0xb')](_0x87ad('0x1f'));logger[_0x87ad('0xb')]('The\x20Ticket\x20ID\x20is:',_0x53c0ba['id']);logger['info']('[QUEUE]',_0x87ad('0x4d'));emit(util[_0x87ad('0xe')](_0x87ad('0x4e'),_0x11eb1e[_0x87ad('0x16')]),_0x87ad('0x4f'),{'uri':util[_0x87ad('0xe')](_0x87ad('0x50'),_0x5cbe9f[_0x87ad('0x1c')],_0x53c0ba['id'])});}})[_0x87ad('0x51')](function(_0x596dd9){logger[_0x87ad('0x52')](_0x87ad('0x46'),JSON[_0x87ad('0x53')](_0x596dd9));});};exports['outbound']=function(_0x12aa32,_0x153833,_0xe808b9,_0x372c18,_0x3bdb05,_0x15d486,_0x57de13){var _0x1d89be,_0x1d114f;_0x15d486[_0x87ad('0x1c')]=intUtil['stripTrailingSlash'](_0x15d486[_0x87ad('0x1c')]);_0x15d486[_0x87ad('0x44')]=intUtil['stripTrailingSlash'](_0x15d486[_0x87ad('0x44')]);if(_0x57de13&&_0x57de13['recordingFormat']&&_0x57de13[_0x87ad('0x54')]!=='none'){logger[_0x87ad('0xb')](_0x87ad('0x55'),_0x87ad('0x56'));_0x153833[_0x87ad('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15d486[_0x87ad('0x44')],_0x153833[_0x87ad('0x49')],md5(_0x153833[_0x87ad('0x49')]));}headers[_0x87ad('0x4a')]=getAuth(_0x15d486);return getUser(_0x15d486,_0x372c18[_0x87ad('0x25')])[_0x87ad('0x1e')](function(_0x158504){_0x1d89be=_0x158504;logger[_0x87ad('0xb')](_0x87ad('0x4b'),_0x1d89be['id']);return getEndUser(_0x15d486,_0x153833['destcalleridname'],_0x153833[_0x87ad('0x57')]);})[_0x87ad('0x1e')](function(_0x183aa6){_0x1d114f=_0x183aa6;logger[_0x87ad('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1d114f['id']);return getTicket(_0x15d486,_0x1d89be,_0x1d114f,_0xe808b9,_0x153833);})[_0x87ad('0x1e')](function(_0x50e52b){if(_0x50e52b&&_0x50e52b['id']){logger[_0x87ad('0xb')](_0x87ad('0x1f'));logger[_0x87ad('0xb')]('The\x20Ticket\x20ID\x20is:',_0x50e52b['id']);logger[_0x87ad('0xb')]('[OUTBOUND]',_0x87ad('0x4d'));emit(util[_0x87ad('0xe')]('user:%s',_0x372c18[_0x87ad('0x16')]),'trigger:browser:url',{'uri':util[_0x87ad('0xe')](_0x87ad('0x50'),_0x15d486['remoteUri'],_0x50e52b['id'])});}})['catch'](function(_0x597e34){logger['error'](_0x87ad('0x55'),JSON[_0x87ad('0x53')](_0x597e34));});};exports[_0x87ad('0x58')]=function(_0x481694,_0x4effdd,_0x2f8fb6,_0x528898,_0x5ee0a0,_0xcbf81a){var _0x7e418c,_0x5797cc;_0xcbf81a['remoteUri']=intUtil['stripTrailingSlash'](_0xcbf81a[_0x87ad('0x1c')]);_0xcbf81a['serverUrl']=intUtil['stripTrailingSlash'](_0xcbf81a['serverUrl']);if(_0x5ee0a0&&_0x5ee0a0[_0x87ad('0x45')]){logger['info']('['+_0x4effdd[_0x87ad('0x59')][_0x87ad('0x5a')]()+']',_0x87ad('0x56'));_0x4effdd[_0x87ad('0x47')]=util[_0x87ad('0xe')](_0x87ad('0x48'),_0xcbf81a['serverUrl'],_0x4effdd[_0x87ad('0x49')],md5(_0x4effdd['uniqueid']));}else{_0x4effdd['recordingURL']='';}headers[_0x87ad('0x4a')]=getAuth(_0xcbf81a);return getUser(_0xcbf81a,'')[_0x87ad('0x1e')](function(_0x418d07){_0x7e418c=_0x418d07;logger[_0x87ad('0xb')](_0x87ad('0x4b'),_0x7e418c['id']);return getEndUser(_0xcbf81a,_0x4effdd[_0x87ad('0x10')],_0x4effdd['calleridnum']);})['then'](function(_0x5d046c){_0x5797cc=_0x5d046c;logger[_0x87ad('0xb')](_0x87ad('0x4c'),_0x5797cc['id']);return getTicket(_0xcbf81a,_0x7e418c,_0x5797cc,_0x2f8fb6,_0x4effdd);})['then'](function(_0x28e7c0){if(_0x28e7c0){logger['info'](_0x87ad('0x1f'));logger['info'](_0x87ad('0x5b'),_0x28e7c0['id']);}})['catch'](function(_0xe82e03){logger[_0x87ad('0x52')]('['+_0x4effdd[_0x87ad('0x59')][_0x87ad('0x5a')]()+']',JSON['stringify'](_0xe82e03));});}; \ 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 65068b7..e36013b 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 _0xd35a=['contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','format','add','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','adminEmail','username','toLowerCase','outbound','destcalleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','defaults','localhost','redis','GET','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','Admin\x20selected','userEmail','&entities=contact','then','find'];(function(_0x165a54,_0x19b7e2){var _0xf7131c=function(_0x43edad){while(--_0x43edad){_0x165a54['push'](_0x165a54['shift']());}};_0xf7131c(++_0x19b7e2);}(_0xd35a,0x7e));var _0xad35=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xd35a[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0xad35('0x0'));var rp=require(_0xad35('0x1'));var md5=require(_0xad35('0x2'));var util=require(_0xad35('0x3'));var moment=require(_0xad35('0x4'));var Promise=require(_0xad35('0x5'));var Redis=require(_0xad35('0x6'));var intUtil=require(_0xad35('0x7'));var config=require('../../../../config/environment');var logger=require(_0xad35('0x8'))(_0xad35('0x9'));config['redis']=_[_0xad35('0xa')](config['redis'],{'host':_0xad35('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xad35('0xc')]));function getAdminId(_0x115d13,_0x572bc3,_0x310907,_0x58fa28){return new Promise(function(_0x5f0e19,_0x505137){var _0x523933=![];var _0x49170f={'method':_0xad35('0xd'),'uri':_0x58fa28+_0xad35('0xe'),'json':!![]};_0x49170f[_0xad35('0xf')]=_0x310907;logger['info'](_0xad35('0x10'));return rp(_0x49170f)['then'](function(_0x5c5f4b){if(_0x5c5f4b){var _0x4dade8=_0x5c5f4b[_0xad35('0x11')];var _0x2ebdc9=null;for(_0x2ebdc9=0x0;_0x2ebdc9<_0x4dade8[_0xad35('0x12')];_0x2ebdc9++){if(_0x4dade8[_0x2ebdc9][_0xad35('0x13')]===_0x115d13['adminEmail']){_0x115d13[_0xad35('0x14')]=_0x4dade8[_0x2ebdc9]['id'];_0x523933=!![];}}if(_0x523933){logger[_0xad35('0x15')](_0xad35('0x16'),_0x115d13['adminId']);_0x5f0e19(_0x115d13);}else{_0x505137({'statusCode':0x194,'message':_0xad35('0x17')});}}else{_0x505137({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xad35('0x18')](function(_0x22fe61){logger[_0xad35('0x19')]('['+[_0x572bc3[_0xad35('0x1a')]()]+']',_0x22fe61[_0xad35('0x1b')]);_0x505137(_0x22fe61);});});}function getUser(_0x2b056b,_0x4bba6d,_0x11038f){return function(_0x3481a7){return new Promise(function(_0x495567,_0x2d4518){var _0x4ca0c6={'method':_0xad35('0xd'),'uri':_0x11038f+'/api/selector/owners','json':!![]};_0x4ca0c6[_0xad35('0xf')]=_0x4bba6d;logger[_0xad35('0x15')](_0xad35('0x1c'));return rp(_0x4ca0c6)['then'](function(_0x57586f){if(_0x57586f){var _0x451367=_0x57586f[_0xad35('0x11')];var _0x446532=![];var _0x574f06=null;if(_0x3481a7[_0xad35('0x1d')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x3481a7['agentEmail']);_0x3481a7['userEmail']=_0x3481a7[_0xad35('0x1d')];for(_0x574f06=0x0;_0x574f06<_0x451367[_0xad35('0x12')];_0x574f06++){if(_0x451367[_0x574f06][_0xad35('0x13')]===_0x3481a7['agentEmail']){_0x446532=!![];_0x3481a7['userId']=_0x451367[_0x574f06]['id'];logger['info']('User\x20found:',_0x3481a7[_0xad35('0x1e')]);}}}if(!_0x446532){logger[_0xad35('0x15')](_0xad35('0x1f'));_0x3481a7[_0xad35('0x20')]=_0x3481a7['adminEmail'];_0x3481a7[_0xad35('0x1e')]=_0x3481a7[_0xad35('0x14')];_0x446532=!![];}if(_0x446532){_0x495567(_0x3481a7);}else{_0x2d4518({'statusCode':0x194,'message':_0xad35('0x17')});}}else{_0x2d4518({'statusCode':0x194,'message':_0xad35('0x17')});}})[_0xad35('0x18')](function(_0x2ec223){logger[_0xad35('0x19')]('['+[_0x2b056b[_0xad35('0x1a')]()]+']',_0x2ec223[_0xad35('0x1b')]);_0x2d4518(_0x2ec223);});});};}function searchContact(_0x2f2229,_0x30cc81,_0x5977a5,_0x1ef9b6){return new Promise(function(_0x708f85,_0x309975){var _0x23902e={'method':_0xad35('0xd'),'headers':_0x30cc81,'uri':_0x2f2229+'/api/lookup?q='+_0x1ef9b6+'&f='+_0x5977a5+_0xad35('0x21'),'json':!![]};rp(_0x23902e)[_0xad35('0x22')](function(_0x48e957){var _0x1c1219=_[_0xad35('0x23')](_0x48e957['contacts'][_0xad35('0x24')],[_0x5977a5,_0x1ef9b6]);_0x708f85(_0x1c1219);})[_0xad35('0x18')](function(_0x458b6e){_0x309975(_0x458b6e);});});}function getEndUser(_0x43ba31,_0x492fc0,_0x15364d){return function(_0x316797){return new Promise(function(_0x1fb203,_0x439b14){logger[_0xad35('0x15')](util['format'](_0xad35('0x25'),_0x316797['contactNumber']));searchContact(_0x15364d,_0x492fc0,_0xad35('0x26'),_0x316797[_0xad35('0x27')])[_0xad35('0x22')](function(_0x5d45f3){if(_0x5d45f3){_0x316797[_0xad35('0x28')]=_0x5d45f3['id'];logger[_0xad35('0x15')](_0xad35('0x29'),_0x316797['endUserId']);return _0x1fb203(_0x316797);}searchContact(_0x15364d,_0x492fc0,'work_number',_0x316797[_0xad35('0x27')])[_0xad35('0x22')](function(_0x42f921){if(_0x42f921){_0x316797[_0xad35('0x28')]=_0x42f921['id'];logger[_0xad35('0x15')]('Contact\x20found\x20work_number:',_0x316797['endUserId']);return _0x1fb203(_0x316797);}createEndUser(_0x316797,_0x43ba31,_0x492fc0,_0x15364d)[_0xad35('0x22')](function(_0x578a65){logger['info'](_0xad35('0x2a'),_0x578a65['endUserId']);return _0x1fb203(_0x578a65);});});})[_0xad35('0x18')](function(_0xebcd70){_0x439b14(_0xebcd70);});});};}function createEndUser(_0x5bfdfb,_0x10bb5f,_0x5d8c46,_0x3151e8){return new Promise(function(_0x5cdfa2,_0x456522){var _0x8007cd=moment();var _0x18bc89={'method':_0xad35('0x2b'),'uri':_0x3151e8+_0xad35('0x2c'),'body':{'contact':{'last_name':_0x5bfdfb['contactNumber'],'work_number':_0x5bfdfb[_0xad35('0x27')],'mobile_number':_0x5bfdfb[_0xad35('0x27')],'owner_id':_0x5bfdfb[_0xad35('0x1e')],'created_at':_0x8007cd['format'](_0xad35('0x2d'))}},'json':!![]};_0x18bc89['headers']=_0x5d8c46;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x18bc89)[_0xad35('0x22')](function(_0x3ab064){_0x5bfdfb[_0xad35('0x28')]=_0x3ab064['contact']['id'];_0x5cdfa2(_0x5bfdfb);})['catch'](function(_0x5e1809){logger[_0xad35('0x19')]('['+[_0x10bb5f[_0xad35('0x1a')]()]+']',_0x5e1809['message']);_0x456522(_0x5e1809[_0xad35('0x1b')]);});});}function getTicket(_0x590e5f,_0x24f193,_0x482f30,_0x200600,_0x3ccb1c){return function(_0x5bf5b8){logger[_0xad35('0x15')](_0xad35('0x2e'));return new Promise(function(_0x526418,_0x16c0bb){var _0xa95eeb=moment();var _0x495325={'method':_0xad35('0x2b'),'uri':_0x482f30+_0xad35('0x2f'),'body':{'title':intUtil[_0xad35('0x30')](_0x200600[_0xad35('0x31')],_0x3ccb1c,'\x20'),'description':intUtil['getString'](_0x200600[_0xad35('0x32')],_0x3ccb1c,'\x0a'),'owner_id':_0x5bf5b8[_0xad35('0x1e')],'creater_id':_0x5bf5b8[_0xad35('0x14')],'targetable_id':_0x5bf5b8['endUserId'],'targetable_type':_0xad35('0x33'),'created_at':_0xa95eeb[_0xad35('0x34')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xa95eeb[_0xad35('0x35')](0x1e,'m')[_0xad35('0x34')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x495325[_0xad35('0xf')]=_0x24f193;return rp(_0x495325)[_0xad35('0x22')](function(_0x3415a1){_0x5bf5b8[_0xad35('0x36')]=_0x3415a1[_0xad35('0x37')]['id'];logger[_0xad35('0x15')](_0xad35('0x38'),_0x5bf5b8[_0xad35('0x36')]);_0x526418(_0x5bf5b8);})[_0xad35('0x18')](function(_0x5dbdb0){logger[_0xad35('0x19')]('['+[_0x590e5f[_0xad35('0x1a')]()]+']',_0x5dbdb0[_0xad35('0x1b')]);_0x16c0bb(_0x5dbdb0[_0xad35('0x1b')]);});});};}function emit(_0x45b730,_0x402779,_0x4a4b8f){var _0x39edc8={'uri':_0x45b730+'/contacts/'+_0x4a4b8f};io['to'](util[_0xad35('0x34')](_0xad35('0x39'),_0x402779))['emit'](_0xad35('0x3a'),_0x39edc8);}exports['cs']=function(_0x259c2f,_0x543555,_0x10b114,_0x288346,_0x143eb4,_0x2fe1bc,_0x384b1b,_0x14f39b){var _0xe75c1d={};var _0x294b3c={'Authorization':_0xad35('0x3b')+_0x2fe1bc[_0xad35('0x3c')]};_0x2fe1bc['remoteUri']=intUtil[_0xad35('0x3d')](_0x2fe1bc[_0xad35('0x3e')]);_0x2fe1bc['serverUrl']=intUtil[_0xad35('0x3d')](_0x2fe1bc[_0xad35('0x3f')]);var _0x5ede86=_0x2fe1bc[_0xad35('0x3e')];_0xe75c1d[_0xad35('0x40')]=_0x2fe1bc[_0xad35('0x41')];_0xe75c1d['contactNumber']=_0x14f39b[_0xad35('0x42')]()===_0xad35('0x43')?_0x543555[_0xad35('0x44')]:_0x543555['calleridnum'];_0xe75c1d['callDirection']=_0x14f39b===_0xad35('0x45')||_0x14f39b===_0xad35('0x46')?_0xad35('0x45'):_0xad35('0x43');if(_0x288346){_0xe75c1d[_0xad35('0x1d')]=_0x288346[_0xad35('0x13')];}var _0x175ec6=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2fe1bc[_0xad35('0x3f')],_0x543555[_0xad35('0x47')],md5(_0x543555[_0xad35('0x47')]));if(_0x143eb4&&_0x143eb4[_0xad35('0x48')]){logger[_0xad35('0x15')]('[QUEUE]',_0xad35('0x49'));_0x543555[_0xad35('0x4a')]=_0x175ec6;}else if(_0x384b1b&&_0x384b1b[_0xad35('0x4b')]&&_0x384b1b[_0xad35('0x4b')]!=='none'){logger[_0xad35('0x15')](_0xad35('0x4c'),_0xad35('0x49'));_0x543555[_0xad35('0x4a')]=_0x175ec6;}else{_0x543555[_0xad35('0x4a')]='';}return getAdminId(_0xe75c1d,_0x14f39b,_0x294b3c,_0x5ede86)[_0xad35('0x22')](getUser(_0x14f39b,_0x294b3c,_0x5ede86))[_0xad35('0x22')](getEndUser(_0x14f39b,_0x294b3c,_0x5ede86))[_0xad35('0x22')](getTicket(_0x14f39b,_0x294b3c,_0x5ede86,_0x10b114,_0x543555))[_0xad35('0x22')](function(_0x3f124c){logger[_0xad35('0x15')](util['format'](_0xad35('0x4d'),_0x3f124c[_0xad35('0x36')]));if(_0x14f39b!==_0xad35('0x46')){logger[_0xad35('0x15')]('['+[_0x14f39b[_0xad35('0x1a')]()]+']',_0xad35('0x4e'));emit(_0x5ede86,_0x288346[_0xad35('0x4f')],_0x3f124c['endUserId']);}})['catch'](function(_0x1c4105){logger['error']('['+[_0x14f39b[_0xad35('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xad35('0x50')](_0x1c4105,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8e5b=['outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','[OUTBOUND]','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','agentEmail','userEmail','length','userId','User\x20found:','message','/api/lookup?q=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase'];(function(_0x3f64e5,_0x59e1a2){var _0x23b63f=function(_0x1e65fd){while(--_0x1e65fd){_0x3f64e5['push'](_0x3f64e5['shift']());}};_0x23b63f(++_0x59e1a2);}(_0x8e5b,0x1e2));var _0xb8e5=function(_0x1cf2a9,_0xec5a71){_0x1cf2a9=_0x1cf2a9-0x0;var _0x1bf4bd=_0x8e5b[_0x1cf2a9];return _0x1bf4bd;};'use strict';var _=require(_0xb8e5('0x0'));var rp=require(_0xb8e5('0x1'));var md5=require(_0xb8e5('0x2'));var util=require(_0xb8e5('0x3'));var moment=require(_0xb8e5('0x4'));var Promise=require(_0xb8e5('0x5'));var Redis=require(_0xb8e5('0x6'));var intUtil=require(_0xb8e5('0x7'));var config=require('../../../../config/environment');var logger=require(_0xb8e5('0x8'))(_0xb8e5('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xb8e5('0xa'),'port':0x18eb});var io=require(_0xb8e5('0xb'))(new Redis(config['redis']));function getAdminId(_0x233681,_0x542894,_0x5c2d60,_0x552743){return new Promise(function(_0x185c1f,_0x276abe){var _0x4024da=![];var _0xb75e7c={'method':_0xb8e5('0xc'),'uri':_0x552743+'/api/selector/owners','json':!![]};_0xb75e7c[_0xb8e5('0xd')]=_0x5c2d60;logger[_0xb8e5('0xe')](_0xb8e5('0xf'));return rp(_0xb75e7c)[_0xb8e5('0x10')](function(_0x384002){if(_0x384002){var _0x18fde4=_0x384002[_0xb8e5('0x11')];var _0x36b20e=null;for(_0x36b20e=0x0;_0x36b20e<_0x18fde4['length'];_0x36b20e++){if(_0x18fde4[_0x36b20e][_0xb8e5('0x12')]===_0x233681[_0xb8e5('0x13')]){_0x233681[_0xb8e5('0x14')]=_0x18fde4[_0x36b20e]['id'];_0x4024da=!![];}}if(_0x4024da){logger[_0xb8e5('0xe')](_0xb8e5('0x15'),_0x233681[_0xb8e5('0x14')]);_0x185c1f(_0x233681);}else{_0x276abe({'statusCode':0x194,'message':_0xb8e5('0x16')});}}else{_0x276abe({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb8e5('0x17')](function(_0x3238ba){logger[_0xb8e5('0x18')]('['+[_0x542894[_0xb8e5('0x19')]()]+']',_0x3238ba['message']);_0x276abe(_0x3238ba);});});}function getUser(_0x5ee2f4,_0xe3ba58,_0x2cd555){return function(_0x359306){return new Promise(function(_0x1972da,_0x54872a){var _0x2d23b6={'method':_0xb8e5('0xc'),'uri':_0x2cd555+_0xb8e5('0x1a'),'json':!![]};_0x2d23b6[_0xb8e5('0xd')]=_0xe3ba58;logger['info']('Getting\x20user\x20list');return rp(_0x2d23b6)['then'](function(_0x1ae4e2){if(_0x1ae4e2){var _0x22fea4=_0x1ae4e2['users'];var _0x429a0b=![];var _0x2e85e1=null;if(_0x359306[_0xb8e5('0x1b')]!==null){logger[_0xb8e5('0xe')]('Getting\x20user\x20with\x20email',_0x359306[_0xb8e5('0x1b')]);_0x359306[_0xb8e5('0x1c')]=_0x359306[_0xb8e5('0x1b')];for(_0x2e85e1=0x0;_0x2e85e1<_0x22fea4[_0xb8e5('0x1d')];_0x2e85e1++){if(_0x22fea4[_0x2e85e1]['email']===_0x359306[_0xb8e5('0x1b')]){_0x429a0b=!![];_0x359306[_0xb8e5('0x1e')]=_0x22fea4[_0x2e85e1]['id'];logger[_0xb8e5('0xe')](_0xb8e5('0x1f'),_0x359306['userId']);}}}if(!_0x429a0b){logger[_0xb8e5('0xe')]('Admin\x20selected');_0x359306[_0xb8e5('0x1c')]=_0x359306[_0xb8e5('0x13')];_0x359306[_0xb8e5('0x1e')]=_0x359306[_0xb8e5('0x14')];_0x429a0b=!![];}if(_0x429a0b){_0x1972da(_0x359306);}else{_0x54872a({'statusCode':0x194,'message':_0xb8e5('0x16')});}}else{_0x54872a({'statusCode':0x194,'message':_0xb8e5('0x16')});}})[_0xb8e5('0x17')](function(_0x5126cc){logger['error']('['+[_0x5ee2f4[_0xb8e5('0x19')]()]+']',_0x5126cc[_0xb8e5('0x20')]);_0x54872a(_0x5126cc);});});};}function searchContact(_0x5536e2,_0x527abd,_0x28c612,_0xc5c773){return new Promise(function(_0xc27b85,_0x5f4c43){var _0x29f6e8={'method':'GET','headers':_0x527abd,'uri':_0x5536e2+_0xb8e5('0x21')+_0xc5c773+'&f='+_0x28c612+'&entities=contact','json':!![]};rp(_0x29f6e8)[_0xb8e5('0x10')](function(_0x58af7f){var _0x45fdab=_['find'](_0x58af7f[_0xb8e5('0x22')][_0xb8e5('0x22')],[_0x28c612,_0xc5c773]);_0xc27b85(_0x45fdab);})['catch'](function(_0x42613d){_0x5f4c43(_0x42613d);});});}function getEndUser(_0x28a30e,_0x32d994,_0x3fac96){return function(_0x33a212){return new Promise(function(_0x1d61cc,_0x30b8cb){logger[_0xb8e5('0xe')](util[_0xb8e5('0x23')](_0xb8e5('0x24'),_0x33a212[_0xb8e5('0x25')]));searchContact(_0x3fac96,_0x32d994,'mobile_number',_0x33a212[_0xb8e5('0x25')])[_0xb8e5('0x10')](function(_0x347ce4){if(_0x347ce4){_0x33a212[_0xb8e5('0x26')]=_0x347ce4['id'];logger[_0xb8e5('0xe')]('Contact\x20found\x20mobile_number:',_0x33a212['endUserId']);return _0x1d61cc(_0x33a212);}searchContact(_0x3fac96,_0x32d994,_0xb8e5('0x27'),_0x33a212[_0xb8e5('0x25')])['then'](function(_0xf8722e){if(_0xf8722e){_0x33a212[_0xb8e5('0x26')]=_0xf8722e['id'];logger[_0xb8e5('0xe')](_0xb8e5('0x28'),_0x33a212[_0xb8e5('0x26')]);return _0x1d61cc(_0x33a212);}createEndUser(_0x33a212,_0x28a30e,_0x32d994,_0x3fac96)[_0xb8e5('0x10')](function(_0x21fb51){logger[_0xb8e5('0xe')](_0xb8e5('0x29'),_0x21fb51[_0xb8e5('0x26')]);return _0x1d61cc(_0x21fb51);});});})['catch'](function(_0x5e48e4){_0x30b8cb(_0x5e48e4);});});};}function createEndUser(_0x470199,_0x247432,_0x46dd2b,_0x44e457){return new Promise(function(_0x3aebd4,_0x1ed988){var _0x1c6797=moment();var _0x59c264={'method':_0xb8e5('0x2a'),'uri':_0x44e457+_0xb8e5('0x2b'),'body':{'contact':{'last_name':_0x470199[_0xb8e5('0x25')],'work_number':_0x470199[_0xb8e5('0x25')],'mobile_number':_0x470199[_0xb8e5('0x25')],'owner_id':_0x470199['userId'],'created_at':_0x1c6797['format'](_0xb8e5('0x2c'))}},'json':!![]};_0x59c264['headers']=_0x46dd2b;logger[_0xb8e5('0xe')](_0xb8e5('0x2d'));return rp(_0x59c264)[_0xb8e5('0x10')](function(_0x108c82){_0x470199[_0xb8e5('0x26')]=_0x108c82[_0xb8e5('0x2e')]['id'];_0x3aebd4(_0x470199);})[_0xb8e5('0x17')](function(_0x55ad57){logger['error']('['+[_0x247432[_0xb8e5('0x19')]()]+']',_0x55ad57[_0xb8e5('0x20')]);_0x1ed988(_0x55ad57[_0xb8e5('0x20')]);});});}function getTicket(_0x24314,_0x19a993,_0xfa79d8,_0xffcf7b,_0x5b0463){return function(_0x1cab02){logger[_0xb8e5('0xe')](_0xb8e5('0x2f'));return new Promise(function(_0x4acaed,_0x2ca4b9){var _0xd83379=moment();var _0x4d712c={'method':_0xb8e5('0x2a'),'uri':_0xfa79d8+_0xb8e5('0x30'),'body':{'title':intUtil[_0xb8e5('0x31')](_0xffcf7b[_0xb8e5('0x32')],_0x5b0463,'\x20'),'description':intUtil[_0xb8e5('0x31')](_0xffcf7b[_0xb8e5('0x33')],_0x5b0463,'\x0a'),'owner_id':_0x1cab02[_0xb8e5('0x1e')],'creater_id':_0x1cab02[_0xb8e5('0x14')],'targetable_id':_0x1cab02[_0xb8e5('0x26')],'targetable_type':_0xb8e5('0x34'),'created_at':_0xd83379[_0xb8e5('0x23')](_0xb8e5('0x2c')),'due_date':_0xd83379[_0xb8e5('0x35')](0x1e,'m')[_0xb8e5('0x23')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4d712c[_0xb8e5('0xd')]=_0x19a993;return rp(_0x4d712c)['then'](function(_0x444b7f){_0x1cab02[_0xb8e5('0x36')]=_0x444b7f['task']['id'];logger[_0xb8e5('0xe')](_0xb8e5('0x37'),_0x1cab02['ticketId']);_0x4acaed(_0x1cab02);})[_0xb8e5('0x17')](function(_0x4f6ff4){logger[_0xb8e5('0x18')]('['+[_0x24314[_0xb8e5('0x19')]()]+']',_0x4f6ff4[_0xb8e5('0x20')]);_0x2ca4b9(_0x4f6ff4[_0xb8e5('0x20')]);});});};}function emit(_0xd05ea3,_0x4977cf,_0x3b7058){var _0x3ce9ec={'uri':_0xd05ea3+'/contacts/'+_0x3b7058};io['to'](util['format'](_0xb8e5('0x38'),_0x4977cf))[_0xb8e5('0x39')](_0xb8e5('0x3a'),_0x3ce9ec);}exports['cs']=function(_0x389ff2,_0x2e5693,_0x165c7e,_0x57d864,_0x4a3d3a,_0xf6cf65,_0x5311bb,_0x636899){var _0x36e469={};var _0x4c088b={'Authorization':'Token\x20token='+_0xf6cf65['apiKey']};_0xf6cf65[_0xb8e5('0x3b')]=intUtil[_0xb8e5('0x3c')](_0xf6cf65[_0xb8e5('0x3b')]);_0xf6cf65[_0xb8e5('0x3d')]=intUtil[_0xb8e5('0x3c')](_0xf6cf65['serverUrl']);var _0x5a8d6b=_0xf6cf65[_0xb8e5('0x3b')];_0x36e469[_0xb8e5('0x13')]=_0xf6cf65[_0xb8e5('0x3e')];_0x36e469[_0xb8e5('0x25')]=_0x636899[_0xb8e5('0x3f')]()===_0xb8e5('0x40')?_0x2e5693[_0xb8e5('0x41')]:_0x2e5693[_0xb8e5('0x42')];_0x36e469['callDirection']=_0x636899===_0xb8e5('0x43')||_0x636899===_0xb8e5('0x44')?_0xb8e5('0x43'):'outbound';if(_0x57d864){_0x36e469[_0xb8e5('0x1b')]=_0x57d864[_0xb8e5('0x12')];}var _0x2124a9=util[_0xb8e5('0x23')](_0xb8e5('0x45'),_0xf6cf65[_0xb8e5('0x3d')],_0x2e5693[_0xb8e5('0x46')],md5(_0x2e5693[_0xb8e5('0x46')]));if(_0x4a3d3a&&_0x4a3d3a[_0xb8e5('0x47')]){logger[_0xb8e5('0xe')](_0xb8e5('0x48'),_0xb8e5('0x49'));_0x2e5693['recordingURL']=_0x2124a9;}else if(_0x5311bb&&_0x5311bb['recordingFormat']&&_0x5311bb['recordingFormat']!=='none'){logger[_0xb8e5('0xe')](_0xb8e5('0x4a'),_0xb8e5('0x49'));_0x2e5693['recordingURL']=_0x2124a9;}else{_0x2e5693[_0xb8e5('0x4b')]='';}return getAdminId(_0x36e469,_0x636899,_0x4c088b,_0x5a8d6b)[_0xb8e5('0x10')](getUser(_0x636899,_0x4c088b,_0x5a8d6b))['then'](getEndUser(_0x636899,_0x4c088b,_0x5a8d6b))[_0xb8e5('0x10')](getTicket(_0x636899,_0x4c088b,_0x5a8d6b,_0x165c7e,_0x2e5693))[_0xb8e5('0x10')](function(_0x3e242b){logger[_0xb8e5('0xe')](util[_0xb8e5('0x23')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3e242b[_0xb8e5('0x36')]));if(_0x636899!==_0xb8e5('0x44')){logger[_0xb8e5('0xe')]('['+[_0x636899[_0xb8e5('0x19')]()]+']',_0xb8e5('0x4c'));emit(_0x5a8d6b,_0x57d864['name'],_0x3e242b['endUserId']);}})[_0xb8e5('0x17')](function(_0x29b3a4){logger['error']('['+[_0x636899[_0xb8e5('0x19')]()]+_0xb8e5('0x4d'),util['inspect'](_0x29b3a4,{'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 19a414f..31397a8 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 _0x88aa=['../../../../config/logger','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','servicenow','unknown\x20integration'];(function(_0x52db34,_0x36d74c){var _0x3f9365=function(_0x56570b){while(--_0x56570b){_0x52db34['push'](_0x52db34['shift']());}};_0x3f9365(++_0x36d74c);}(_0x88aa,0x134));var _0xa88a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x88aa[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xa88a('0x0'));var util=require(_0xa88a('0x1'));var zendesk=require(_0xa88a('0x2'));var salesforce=require(_0xa88a('0x3'));var sugarcrm=require(_0xa88a('0x4'));var freshdesk=require(_0xa88a('0x5'));var zoho=require('./zoho');var desk=require(_0xa88a('0x6'));var vtiger=require(_0xa88a('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xa88a('0x8'));var freshsales=require(_0xa88a('0x9'));var integrations=[_0xa88a('0xa'),_0xa88a('0xb'),_0xa88a('0xc'),_0xa88a('0xd'),_0xa88a('0xe'),_0xa88a('0xf'),_0xa88a('0x10'),_0xa88a('0x11'),_0xa88a('0x12'),'servicenow'];exports[_0xa88a('0x13')]=function(_0x340744,_0x22931a,_0x1f8530,_0x3143c7,_0x255790,_0x1bfbdf){if(_0x1f8530){if(_[_0xa88a('0x14')](integrations,_0x340744[_0xa88a('0x15')][_0xa88a('0x16')]())){try{var _0x5243c7=null;var _0x3ebc40='';var _0x224b26=_0x1f8530[_0x340744[_0xa88a('0x15')][_0xa88a('0x16')]()];if(_0x224b26){var _0x3e0ddb=_0x224b26[_0x340744[_0xa88a('0x17')]];if(_0x3e0ddb){var _0x119cec=_['find'](_0x3e0ddb[_0xa88a('0x18')],{'id':parseInt(_0x340744[_0xa88a('0x19')],0xa)});if(_0x119cec){if(_0x3143c7){if(_0x255790&&_0x22931a[_0xa88a('0x1a')]){_0x3ebc40=_0xa88a('0x1a');}else if(_0x22931a[_0xa88a('0x1b')]){_0x3ebc40=_0xa88a('0x1c');}else{console[_0xa88a('0x1d')](_0xa88a('0x1e'),_0x22931a);}}else{_0x3ebc40=_0xa88a('0x1f');}switch(_0x340744[_0xa88a('0x15')][_0xa88a('0x16')]()){case _0xa88a('0xa'):zendesk[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case'salesforce':salesforce[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case _0xa88a('0xc'):sugarcrm[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case _0xa88a('0xd'):freshdesk[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case'zoho':zoho[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case _0xa88a('0xf'):desk[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case _0xa88a('0x10'):vtiger[_0x3ebc40](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf);break;case _0xa88a('0x12'):freshsales['cs'](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf,_0x3ebc40);break;case _0xa88a('0x20'):servicenow['cs'](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf,_0x3ebc40);break;case _0xa88a('0x11'):dynamics365['cs'](_0x340744,_0x22931a,_0x119cec,_0x3143c7,_0x255790,_0x3e0ddb,_0x1bfbdf,_0x3ebc40);break;default:console[_0xa88a('0x1d')](_0xa88a('0x21'));}}else{_0x5243c7=require(_0xa88a('0x22'))(_0x340744[_0xa88a('0x15')]['toLowerCase']());_0x5243c7[_0xa88a('0x23')](_0xa88a('0x24'),util[_0xa88a('0x25')]('%s\x20configuration\x20#%s\x20not\x20found',_0x340744['data1']['toLowerCase'](),_0x340744[_0xa88a('0x19')]));}}else{_0x5243c7=require(_0xa88a('0x22'))(_0x340744['data1'][_0xa88a('0x16')]());_0x5243c7['error']('[EXEC]',util[_0xa88a('0x25')]('%s\x20account\x20#%s\x20not\x20found',_0x340744[_0xa88a('0x15')][_0xa88a('0x16')](),_0x340744[_0xa88a('0x17')]));}}else{}}catch(_0x4f328f){console[_0xa88a('0x23')](_0x4f328f);}}}}; \ No newline at end of file +var _0xeeb1=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./zoho','./desk','./vtiger','./servicenow','zendesk','freshdesk','vtiger','dynamics365','servicenow','includes','data1','data2','Configurations','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','toLowerCase','salesforce','sugarcrm','zoho','desk','freshsales','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','data3','error','[EXEC]'];(function(_0x126a7c,_0x791415){var _0x278d38=function(_0x593b56){while(--_0x593b56){_0x126a7c['push'](_0x126a7c['shift']());}};_0x278d38(++_0x791415);}(_0xeeb1,0x1a5));var _0x1eeb=function(_0x3e6aed,_0x97a2f1){_0x3e6aed=_0x3e6aed-0x0;var _0x3220dd=_0xeeb1[_0x3e6aed];return _0x3220dd;};'use strict';var _=require(_0x1eeb('0x0'));var util=require(_0x1eeb('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x1eeb('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x1eeb('0x3'));var desk=require(_0x1eeb('0x4'));var vtiger=require(_0x1eeb('0x5'));var servicenow=require(_0x1eeb('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x1eeb('0x7'),'salesforce','sugarcrm',_0x1eeb('0x8'),'zoho','desk',_0x1eeb('0x9'),_0x1eeb('0xa'),'freshsales',_0x1eeb('0xb')];exports['exec']=function(_0x52f0a6,_0x37cd38,_0x455357,_0x3288a9,_0x586f35,_0x1089d1){if(_0x455357){if(_[_0x1eeb('0xc')](integrations,_0x52f0a6[_0x1eeb('0xd')]['toLowerCase']())){try{var _0x2ce947=null;var _0x15ddaa='';var _0x53de24=_0x455357[_0x52f0a6[_0x1eeb('0xd')]['toLowerCase']()];if(_0x53de24){var _0x360c57=_0x53de24[_0x52f0a6[_0x1eeb('0xe')]];if(_0x360c57){var _0x2daf8b=_['find'](_0x360c57[_0x1eeb('0xf')],{'id':parseInt(_0x52f0a6['data3'],0xa)});if(_0x2daf8b){if(_0x3288a9){if(_0x586f35&&_0x37cd38[_0x1eeb('0x10')]){_0x15ddaa=_0x1eeb('0x10');}else if(_0x37cd38[_0x1eeb('0x11')]){_0x15ddaa=_0x1eeb('0x12');}else{console['log'](_0x1eeb('0x13'),_0x37cd38);}}else{_0x15ddaa=_0x1eeb('0x14');}switch(_0x52f0a6[_0x1eeb('0xd')][_0x1eeb('0x15')]()){case _0x1eeb('0x7'):zendesk[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case _0x1eeb('0x16'):salesforce[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case _0x1eeb('0x17'):sugarcrm[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case'freshdesk':freshdesk[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case _0x1eeb('0x18'):zoho[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case _0x1eeb('0x19'):desk[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case'vtiger':vtiger[_0x15ddaa](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1);break;case _0x1eeb('0x1a'):freshsales['cs'](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1,_0x15ddaa);break;case'servicenow':servicenow['cs'](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1,_0x15ddaa);break;case _0x1eeb('0xa'):dynamics365['cs'](_0x52f0a6,_0x37cd38,_0x2daf8b,_0x3288a9,_0x586f35,_0x360c57,_0x1089d1,_0x15ddaa);break;default:console['log'](_0x1eeb('0x1b'));}}else{_0x2ce947=require(_0x1eeb('0x1c'))(_0x52f0a6[_0x1eeb('0xd')]['toLowerCase']());_0x2ce947['error']('[EXEC]',util[_0x1eeb('0x1d')](_0x1eeb('0x1e'),_0x52f0a6[_0x1eeb('0xd')][_0x1eeb('0x15')](),_0x52f0a6[_0x1eeb('0x1f')]));}}else{_0x2ce947=require(_0x1eeb('0x1c'))(_0x52f0a6[_0x1eeb('0xd')]['toLowerCase']());_0x2ce947[_0x1eeb('0x20')](_0x1eeb('0x21'),util[_0x1eeb('0x1d')](_0x1eeb('0x22'),_0x52f0a6[_0x1eeb('0xd')][_0x1eeb('0x15')](),_0x52f0a6[_0x1eeb('0xe')]));}}else{}}catch(_0x296dc3){console['error'](_0x296dc3);}}}}; \ 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 a07d2b8..34a0294 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 _0xbbda=['LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','picklist','idField','content','variableName','toString','Variable','name','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','catch','unmanaged','monitor_format','lastevent',']\x20Integration\x20account\x20type\x20%s.','toUpperCase','request-promise','moment','md5','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','Case','ContactId','leadId','info','sobject','ticketType','create','isNil','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','length','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xbbda,0xb9));var _0xabbd=function(_0xf0baba,_0x29c87b){_0xf0baba=_0xf0baba-0x0;var _0xb3d7dd=_0xbbda[_0xf0baba];return _0xb3d7dd;};'use strict';var _=require('lodash');var rp=require(_0xabbd('0x0'));var moment=require(_0xabbd('0x1'));var BPromise=require('bluebird');var md5=require(_0xabbd('0x2'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xabbd('0x3'));var intUtil=require(_0xabbd('0x4'));var config=require('../../../../config/environment');var logger=require(_0xabbd('0x5'))('salesforce');config[_0xabbd('0x6')]=_['defaults'](config[_0xabbd('0x6')],{'host':_0xabbd('0x7'),'port':0x18eb});var io=require(_0xabbd('0x8'))(new Redis(config[_0xabbd('0x6')]));function emit(_0xad1ce5,_0x54081f,_0x7b094d){io['to'](_0xad1ce5)[_0xabbd('0x9')](_0x54081f,_0x7b094d);}function getTicket(_0x520711,_0xe008c4,_0x5a21d4,_0x4ee1e8,_0x45071b,_0xc66ae6,_0x267281,_0x50d601){var _0x147992=Object[_0xabbd('0xa')]({},{'OwnerId':_0xe008c4['id'],'Subject':intUtil['getString'](_0x4ee1e8[_0xabbd('0xb')],_0x45071b,'\x20'),'Description':intUtil['getString'](_0x4ee1e8[_0xabbd('0xc')],_0x45071b,'\x0a')},getCustomFields(_0xc66ae6,_0x45071b));if(_0x5a21d4){if(_0x4ee1e8['ticketType']===_0xabbd('0xd')){_0x147992[_0xabbd('0xe')]=moment[_0xabbd('0xf')]();_0x147992[_0xabbd('0x10')]=![];_0x147992[_0xabbd('0x11')]=![];if(_0x5a21d4[_0xabbd('0x12')]===_0xabbd('0x13')||_0x5a21d4['endUserType']===_0xabbd('0x14')){_0x147992['WhoId']=_0x5a21d4['id'];}else if(_0x5a21d4[_0xabbd('0x12')]==='account'){_0x147992['WhatId']=_0x5a21d4['id'];}}else if(_0x4ee1e8['ticketType']===_0xabbd('0x15')){if(_0x5a21d4[_0xabbd('0x12')]==='contact'){_0x147992[_0xabbd('0x16')]=_0x5a21d4['id'];}else if(_0x5a21d4[_0xabbd('0x12')]==='account'){_0x147992['AccountId']=_0x5a21d4['id'];}else if(_0x5a21d4[_0xabbd('0x12')]===_0xabbd('0x14')&&_0x4ee1e8[_0xabbd('0x17')]){_0x147992[_0x4ee1e8[_0xabbd('0x17')]]=_0x5a21d4['id'];}else{logger[_0xabbd('0x18')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x267281[_0xabbd('0x19')](_0x4ee1e8[_0xabbd('0x1a')])[_0xabbd('0x1b')](_0x147992);}function getUser(_0x47b343,_0x403abb,_0x5e0ece){if(!_[_0xabbd('0x1c')](_0x403abb)&&intUtil[_0xabbd('0x1d')](_0x403abb)){var _0xae570={'Email':_0x403abb};var _0x6672a7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5e0ece['sobject'](_0xabbd('0x1e'))[_0xabbd('0x1f')](_0xae570,_0x6672a7)[_0xabbd('0x20')]()['then'](function(_0x2426d4){if(_0x2426d4['length']){var _0x5c1fcf=_[_0xabbd('0x1f')](_0x2426d4,function(_0x1bb596){return _0x1bb596[_0xabbd('0x21')]===_0x403abb;});if(_0x5c1fcf){logger[_0xabbd('0x18')](_0xabbd('0x22'),_0x403abb);return BPromise['resolve']({'id':_0x5c1fcf['Id'],'name':_0x5c1fcf[_0xabbd('0x23')]});}}else{logger['info'](_0xabbd('0x24'),_0x403abb);return _0x5e0ece[_0xabbd('0x25')]()[_0xabbd('0x26')](function(_0x4213f5){return BPromise[_0xabbd('0x27')]({'id':_0x4213f5[_0xabbd('0x28')],'name':_0x4213f5[_0xabbd('0x29')]});});}});}else{logger[_0xabbd('0x18')](_0xabbd('0x24'),_0x403abb);return _0x5e0ece['identity']()[_0xabbd('0x26')](function(_0x594438){return BPromise[_0xabbd('0x27')]({'id':_0x594438['user_id'],'name':_0x594438[_0xabbd('0x29')]});});}}function getEndUser(_0x14bb22,_0x4211fa,_0x5aceee,_0x511d21,_0x1723f6){var _0x4a4ba9={'$or':{'Phone':_0x511d21}};var _0x313597={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xabbd('0x27')]()[_0xabbd('0x26')](function(){logger[_0xabbd('0x18')](_0xabbd('0x2a'),_0x511d21,_0x4211fa[_0xabbd('0x2b')]);switch(_0x4211fa[_0xabbd('0x2b')]){case _0xabbd('0x2c'):var _0x213ec9=_['cloneDeep'](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x2d')]){var _0x4a6e7f={};_0x4a6e7f[_0x4211fa['additionalSearchContact']]=_0x511d21;_['merge'](_0x213ec9[_0xabbd('0x2e')],_0x4a6e7f);}return _0x1723f6[_0xabbd('0x19')](_0xabbd('0x2f'))[_0xabbd('0x1f')](_0x213ec9,_0x313597)['execute']()['then'](function(_0xa1733e){if(_0xa1733e&&_0xa1733e[_0xabbd('0x30')]){return _0xa1733e;}else{var _0x33d6c9=_[_0xabbd('0x31')](_0x4a4ba9);if(_0x4211fa['additionalSearchLead']){var _0x42ad39={};_0x42ad39[_0x4211fa[_0xabbd('0x32')]]=_0x511d21;_['merge'](_0x33d6c9[_0xabbd('0x2e')],_0x42ad39);}return _0x1723f6[_0xabbd('0x19')](_0xabbd('0x33'))[_0xabbd('0x1f')](_0x33d6c9,_0x313597);}});case _0xabbd('0x34'):var _0x56b07e=_[_0xabbd('0x31')](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x35')]){var _0x4a6e7f={};_0x4a6e7f[_0x4211fa[_0xabbd('0x35')]]=_0x511d21;_[_0xabbd('0x36')](_0x56b07e[_0xabbd('0x2e')],_0x4a6e7f);}return _0x1723f6['sobject'](_0xabbd('0x37'))[_0xabbd('0x1f')](_0x56b07e,_0x313597)[_0xabbd('0x20')]()['then'](function(_0x331958){if(_0x331958&&_0x331958[_0xabbd('0x30')]){return _0x331958;}else{var _0x39a098=_['cloneDeep'](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x2d')]){var _0xfad359={};_0xfad359[_0x4211fa['additionalSearchContact']]=_0x511d21;_[_0xabbd('0x36')](_0x39a098[_0xabbd('0x2e')],_0xfad359);}return _0x1723f6[_0xabbd('0x19')]('Contact')[_0xabbd('0x1f')](_0x39a098,_0x313597)[_0xabbd('0x26')](function(_0x5da770){if(_0x5da770&&_0x5da770[_0xabbd('0x30')]){return _0x5da770;}else{var _0x4f5cfe=_['cloneDeep'](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x32')]){var _0x2b2ccd={};_0x2b2ccd[_0x4211fa[_0xabbd('0x32')]]=_0x511d21;_[_0xabbd('0x36')](_0x4f5cfe[_0xabbd('0x2e')],_0x2b2ccd);}return _0x1723f6['sobject']('Lead')[_0xabbd('0x1f')](_0x4f5cfe,_0x313597);}});}});case _0xabbd('0x13'):var _0x213ec9=_[_0xabbd('0x31')](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x2d')]){var _0x4a6e7f={};_0x4a6e7f[_0x4211fa['additionalSearchContact']]=_0x511d21;_[_0xabbd('0x36')](_0x213ec9[_0xabbd('0x2e')],_0x4a6e7f);}return _0x1723f6['sobject']('Contact')[_0xabbd('0x1f')](_0x213ec9,_0x313597)[_0xabbd('0x20')]();case _0xabbd('0x14'):var _0x403cbe=_[_0xabbd('0x31')](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x32')]){var _0x4a6e7f={};_0x4a6e7f[_0x4211fa[_0xabbd('0x32')]]=_0x511d21;_[_0xabbd('0x36')](_0x403cbe[_0xabbd('0x2e')],_0x4a6e7f);}return _0x1723f6[_0xabbd('0x19')](_0xabbd('0x33'))[_0xabbd('0x1f')](_0x403cbe,_0x313597);case _0xabbd('0x38'):var _0x56b07e=_[_0xabbd('0x31')](_0x4a4ba9);if(_0x4211fa[_0xabbd('0x35')]){var _0x4a6e7f={};_0x4a6e7f[_0x4211fa['additionalSearchAccount']]=_0x511d21;_[_0xabbd('0x36')](_0x56b07e[_0xabbd('0x2e')],_0x4a6e7f);}return _0x1723f6['sobject'](_0xabbd('0x37'))[_0xabbd('0x1f')](_0x56b07e,_0x313597);default:return null;}})['then'](function(_0x125d07){if(_0x125d07&&_0x125d07[_0xabbd('0x30')]){var _0x18cd1b=_[_0xabbd('0x39')](_0x125d07);if(_0x18cd1b){return BPromise[_0xabbd('0x27')]({'id':_0x18cd1b['Id'],'name':_0x18cd1b[_0xabbd('0x23')],'phone':_0x18cd1b[_0xabbd('0x3a')],'endUserType':_0x18cd1b[_0xabbd('0x3b')][_0xabbd('0x3c')][_0xabbd('0x3d')]()});}}})['then'](function(_0x5ed8f2){if(_0x5ed8f2){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5ed8f2[_0xabbd('0x12')],_0x511d21);return BPromise[_0xabbd('0x27')](_0x5ed8f2);}else{logger[_0xabbd('0x18')](_0xabbd('0x3e'),_0x511d21);var _0x295b3a={'Phone':_0x511d21};if(_0x4211fa['moduleCreate']){if(_0x4211fa[_0xabbd('0x3f')]===_0xabbd('0x13')){logger['info'](_0xabbd('0x40'),_0x511d21,_0x4211fa['moduleCreate']);_0x295b3a[_0xabbd('0x41')]=_0x5aceee!==_0xabbd('0x42')?_0x5aceee:util[_0xabbd('0x43')](_0xabbd('0x44'),_0x511d21);}else if(_0x4211fa[_0xabbd('0x3f')]===_0xabbd('0x14')){logger[_0xabbd('0x18')](_0xabbd('0x40'),_0x511d21,_0x4211fa[_0xabbd('0x3f')]);_0x295b3a[_0xabbd('0x41')]=_0x5aceee!==''?_0x5aceee:util['format'](_0xabbd('0x44'),_0x511d21);_0x295b3a[_0xabbd('0x45')]='No\x20Company';}else if(_0x4211fa[_0xabbd('0x3f')]==='account'){logger[_0xabbd('0x18')](_0xabbd('0x40'),_0x511d21,_0x4211fa[_0xabbd('0x3f')]);_0x295b3a[_0xabbd('0x23')]=_0x5aceee!==''?_0x5aceee:util[_0xabbd('0x43')](_0xabbd('0x44'),_0x511d21);}else{return null;}}return _0x1723f6[_0xabbd('0x19')](_[_0xabbd('0x46')](_0x4211fa['moduleCreate']))[_0xabbd('0x1b')](_0x295b3a)[_0xabbd('0x26')](function(_0x338f47){return BPromise['resolve']({'id':_0x338f47['id'],'endUserType':_0x4211fa['moduleCreate']});});}});}function getCustomFields(_0x34d7cb,_0x1309ad){var _0x49cf62={};if(_0x34d7cb[_0xabbd('0x30')]>0x0){_[_0xabbd('0x47')](_0x34d7cb,function(_0x1dd509){if(_[_0xabbd('0x48')]([_0xabbd('0x49'),_0xabbd('0x4a')],_0x1dd509[_0xabbd('0x3c')])&&_0x1dd509[_0xabbd('0x4b')]){_0x49cf62[_0x1dd509[_0xabbd('0x4b')]]=_0x1dd509[_0xabbd('0x4c')]['toString']();}else if(_0x1dd509[_0xabbd('0x3c')]==='variable'&&_0x1dd509[_0xabbd('0x4d')]&&_0x1dd509['idField']){_0x1309ad[_0x1dd509[_0xabbd('0x4d')]]&&(_0x49cf62[_0x1dd509[_0xabbd('0x4b')]]=_0x1309ad[_0x1dd509['variableName']][_0xabbd('0x4e')]());}else if(_0x1dd509[_0xabbd('0x3c')]==='customVariable'&&_0x1dd509['Variable']&&_0x1dd509[_0xabbd('0x4f')][_0xabbd('0x50')]&&_0x1dd509['idField']){_0x1309ad[_0x1dd509[_0xabbd('0x4f')]['name'][_0xabbd('0x3d')]()]&&(_0x49cf62[_0x1dd509['idField']]=_0x1309ad[_0x1dd509[_0xabbd('0x4f')][_0xabbd('0x50')][_0xabbd('0x3d')]()][_0xabbd('0x4e')]());}});}return _0x49cf62;}function getConnection(_0x18815b){var _0x961dda=_0x18815b['password']['concat'](_0x18815b['securityToken']);var _0x18bd5e=new jsforce[(_0xabbd('0x51'))]({'oauth2':{'loginUrl':_0x18815b[_0xabbd('0x52')]||_0xabbd('0x53'),'clientId':_0x18815b[_0xabbd('0x54')],'clientSecret':_0x18815b[_0xabbd('0x55')]}});return _0x18bd5e[_0xabbd('0x56')](_0x18815b[_0xabbd('0x57')],_0x961dda)[_0xabbd('0x26')](function(){logger[_0xabbd('0x18')](_0xabbd('0x58'));return _0x18bd5e;});}exports['queue']=function(_0x28249e,_0x21615b,_0x34b617,_0x40b3d3,_0x180828,_0xc3e84d){var _0x387956,_0x5a540f,_0x32d320,_0x4ae0a1;_0xc3e84d[_0xabbd('0x59')]=intUtil[_0xabbd('0x5a')](_0xc3e84d[_0xabbd('0x59')]);_0xc3e84d['remoteUri']=intUtil[_0xabbd('0x5a')](_0xc3e84d['remoteUri']);if(_0x180828&&_0x180828['monitor_format']){logger[_0xabbd('0x18')](_0xabbd('0x5b'),_0xabbd('0x5c'));_0x21615b[_0xabbd('0x5d')]=util['format'](_0xabbd('0x5e'),_0xc3e84d[_0xabbd('0x59')],_0x21615b[_0xabbd('0x5f')],md5(_0x21615b[_0xabbd('0x5f')]));}else{_0x21615b[_0xabbd('0x5d')]='';}return getConnection(_0xc3e84d)[_0xabbd('0x26')](function(_0x34cc48){_0x4ae0a1=_0x34cc48;return getUser(_0xc3e84d,_0x40b3d3[_0xabbd('0x60')],_0x4ae0a1);})[_0xabbd('0x26')](function(_0x48ff51){_0x387956=_0x48ff51;return getEndUser(_0xc3e84d,_0x34b617,_0x21615b[_0xabbd('0x61')],_0x21615b[_0xabbd('0x62')],_0x4ae0a1);})[_0xabbd('0x26')](function(_0x211ce8){_0x5a540f=_0x211ce8;return getTicket(_0xc3e84d,_0x387956,_0x5a540f,_0x34b617,_0x21615b,_0x34b617[_0xabbd('0x63')],_0x4ae0a1,_0xabbd('0x64'));})[_0xabbd('0x26')](function(_0x3e1658){_0x32d320=_0x3e1658;logger[_0xabbd('0x18')](_0xabbd('0x65'),_0x32d320['id']);logger['info'](_0xabbd('0x66'),_0x32d320['id'],_0x40b3d3[_0xabbd('0x50')],_0xc3e84d[_0xabbd('0x3c')]);switch(_0xc3e84d[_0xabbd('0x3c')]){case _0xabbd('0x67'):emit(util[_0xabbd('0x43')](_0xabbd('0x68'),_0x40b3d3[_0xabbd('0x50')]),_0xabbd('0x69'),{'recordId':_0x32d320['id']});break;case _0xabbd('0x6a'):emit(util[_0xabbd('0x43')](_0xabbd('0x68'),_0x40b3d3[_0xabbd('0x50')]),_0xabbd('0x6b'),{'uri':util['format'](_0xabbd('0x6c'),_0x4ae0a1[_0xabbd('0x6d')],_0x32d320['id'])});break;default:logger[_0xabbd('0x6e')](_0xabbd('0x6f'));}})['catch'](function(_0x112e39){logger[_0xabbd('0x6e')](_0xabbd('0x5b'),_0x112e39);});};exports['outbound']=function(_0x231d10,_0x44879f,_0x357281,_0x3a82aa,_0x5df8a8,_0x32bc80,_0x3cf743){var _0x59788d,_0x2797df,_0xd76da2,_0x274ed4;_0x32bc80[_0xabbd('0x59')]=intUtil[_0xabbd('0x5a')](_0x32bc80[_0xabbd('0x59')]);_0x32bc80[_0xabbd('0x52')]=intUtil[_0xabbd('0x5a')](_0x32bc80[_0xabbd('0x52')]);if(_0x3cf743&&_0x3cf743['recordingFormat']&&_0x3cf743[_0xabbd('0x70')]!=='none'){logger[_0xabbd('0x18')](_0xabbd('0x71'),'Recording\x20is\x20enabled!');_0x44879f['recordingURL']=util[_0xabbd('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32bc80[_0xabbd('0x59')],_0x44879f[_0xabbd('0x5f')],md5(_0x44879f[_0xabbd('0x5f')]));}return getConnection(_0x32bc80)[_0xabbd('0x26')](function(_0x2e2028){_0x274ed4=_0x2e2028;return getUser(_0x32bc80,_0x3a82aa[_0xabbd('0x60')],_0x274ed4);})[_0xabbd('0x26')](function(_0x4af053){_0x59788d=_0x4af053;return getEndUser(_0x32bc80,_0x357281,_0x44879f[_0xabbd('0x72')],_0x44879f[_0xabbd('0x73')],_0x274ed4);})['then'](function(_0x46a40c){_0x2797df=_0x46a40c;return getTicket(_0x32bc80,_0x59788d,_0x2797df,_0x357281,_0x44879f,_0x357281[_0xabbd('0x63')],_0x274ed4,_0xabbd('0x74'));})[_0xabbd('0x26')](function(_0x35962c){_0xd76da2=_0x35962c;logger[_0xabbd('0x18')](_0xabbd('0x75'),_0xd76da2['id']);logger[_0xabbd('0x18')](_0xabbd('0x76'),_0xd76da2['id'],_0x3a82aa[_0xabbd('0x50')],_0x32bc80['type']);switch(_0x32bc80[_0xabbd('0x3c')]){case'integrationTab':emit(util[_0xabbd('0x43')](_0xabbd('0x68'),_0x3a82aa['name']),_0xabbd('0x69'),{'recordId':_0xd76da2['id']});break;case _0xabbd('0x6a'):emit(util['format'](_0xabbd('0x68'),_0x3a82aa['name']),_0xabbd('0x6b'),{'uri':util[_0xabbd('0x43')](_0xabbd('0x6c'),_0x274ed4['instanceUrl'],_0xd76da2['id'])});break;default:logger[_0xabbd('0x6e')](_0xabbd('0x71'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xabbd('0x77')](function(_0x50d854){logger[_0xabbd('0x6e')](_0xabbd('0x71'),_0x50d854);});};exports[_0xabbd('0x78')]=function(_0x26d0c4,_0x405b86,_0x51fc3a,_0x5c23ef,_0x5268ff,_0x3efb3c){var _0x447850,_0xc7b866,_0x9fe0c8,_0x1ce76e;_0x3efb3c['serverUrl']=intUtil[_0xabbd('0x5a')](_0x3efb3c['serverUrl']);_0x3efb3c[_0xabbd('0x52')]=intUtil['stripTrailingSlash'](_0x3efb3c[_0xabbd('0x52')]);if(_0x5268ff&&_0x5268ff[_0xabbd('0x79')]){logger[_0xabbd('0x18')]('['+_0x405b86[_0xabbd('0x7a')]['toUpperCase']()+']',_0xabbd('0x5c'));_0x405b86[_0xabbd('0x5d')]=util[_0xabbd('0x43')](_0xabbd('0x5e'),_0x3efb3c['serverUrl'],_0x405b86[_0xabbd('0x5f')],md5(_0x405b86['uniqueid']));}else{_0x405b86[_0xabbd('0x5d')]='';}return getConnection(_0x3efb3c)[_0xabbd('0x26')](function(_0x3d5c2d){_0x1ce76e=_0x3d5c2d;if(!_[_0xabbd('0x1c')](_0x5c23ef)){return getUser(_0x3efb3c,_0x5c23ef[_0xabbd('0x50')],_0x1ce76e);}else{return getUser(_0x3efb3c,null,_0x1ce76e);}})['then'](function(_0x46b5bf){_0x447850=_0x46b5bf;return getEndUser(_0x3efb3c,_0x51fc3a,_0x405b86[_0xabbd('0x61')],_0x405b86[_0xabbd('0x62')],_0x1ce76e);})[_0xabbd('0x26')](function(_0x4b274c){_0xc7b866=_0x4b274c;return getTicket(_0x3efb3c,_0x447850,_0xc7b866,_0x51fc3a,_0x405b86,_0x51fc3a[_0xabbd('0x63')],_0x1ce76e);})[_0xabbd('0x26')](function(_0x17bfa4){_0x9fe0c8=_0x17bfa4;logger[_0xabbd('0x18')]('['+_0x405b86[_0xabbd('0x7a')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x9fe0c8['id']);logger[_0xabbd('0x18')]('['+_0x405b86[_0xabbd('0x7a')]['toUpperCase']()+_0xabbd('0x7b'),_0x3efb3c['type']);})['catch'](function(_0x2fecfe){logger['error']('['+_0x405b86['lastevent'][_0xabbd('0x7c')]()+']',_0x2fecfe);});}; \ No newline at end of file +var _0x4be0=['merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','execute','first','Name','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','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','destcalleridname','destcalleridnum','Fields','integrationTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','../../../../config/environment','salesforce','defaults','redis','socket.io-emitter','emit','assign','Subjects','getString','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','AccountId','lead','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact'];(function(_0x483754,_0x44746f){var _0x5cea42=function(_0x3d9cc7){while(--_0x3d9cc7){_0x483754['push'](_0x483754['shift']());}};_0x5cea42(++_0x44746f);}(_0x4be0,0x159));var _0x04be=function(_0x22bf9a,_0x36e47e){_0x22bf9a=_0x22bf9a-0x0;var _0x20a817=_0x4be0[_0x22bf9a];return _0x20a817;};'use strict';var _=require(_0x04be('0x0'));var rp=require(_0x04be('0x1'));var moment=require(_0x04be('0x2'));var BPromise=require(_0x04be('0x3'));var md5=require(_0x04be('0x4'));var jsforce=require(_0x04be('0x5'));var util=require(_0x04be('0x6'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x04be('0x7'));var logger=require('../../../../config/logger')(_0x04be('0x8'));config['redis']=_[_0x04be('0x9')](config[_0x04be('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x04be('0xb'))(new Redis(config['redis']));function emit(_0x33abfb,_0x4b777e,_0x45cb9d){io['to'](_0x33abfb)[_0x04be('0xc')](_0x4b777e,_0x45cb9d);}function getTicket(_0x5119a3,_0x4e7447,_0x499d22,_0x411ada,_0xf65db1,_0x5a3c09,_0x28563d,_0x4d8130){var _0x1ebc5a=Object[_0x04be('0xd')]({},{'OwnerId':_0x4e7447['id'],'Subject':intUtil['getString'](_0x411ada[_0x04be('0xe')],_0xf65db1,'\x20'),'Description':intUtil[_0x04be('0xf')](_0x411ada['Descriptions'],_0xf65db1,'\x0a')},getCustomFields(_0x5a3c09,_0xf65db1));if(_0x499d22){if(_0x411ada['ticketType']===_0x04be('0x10')){_0x1ebc5a[_0x04be('0x11')]=moment[_0x04be('0x12')]();_0x1ebc5a['IsReminderSet']=![];_0x1ebc5a[_0x04be('0x13')]=![];if(_0x499d22[_0x04be('0x14')]===_0x04be('0x15')||_0x499d22[_0x04be('0x14')]==='lead'){_0x1ebc5a[_0x04be('0x16')]=_0x499d22['id'];}else if(_0x499d22[_0x04be('0x14')]===_0x04be('0x17')){_0x1ebc5a[_0x04be('0x18')]=_0x499d22['id'];}}else if(_0x411ada['ticketType']===_0x04be('0x19')){if(_0x499d22[_0x04be('0x14')]==='contact'){_0x1ebc5a[_0x04be('0x1a')]=_0x499d22['id'];}else if(_0x499d22[_0x04be('0x14')]==='account'){_0x1ebc5a[_0x04be('0x1b')]=_0x499d22['id'];}else if(_0x499d22[_0x04be('0x14')]===_0x04be('0x1c')&&_0x411ada['leadId']){_0x1ebc5a[_0x411ada['leadId']]=_0x499d22['id'];}else{logger[_0x04be('0x1d')](_0x04be('0x1e'));}}}return _0x28563d[_0x04be('0x1f')](_0x411ada['ticketType'])[_0x04be('0x20')](_0x1ebc5a);}function getUser(_0x50335e,_0x368b3b,_0x2615c0){if(!_[_0x04be('0x21')](_0x368b3b)&&intUtil[_0x04be('0x22')](_0x368b3b)){var _0x21b5a8={'Email':_0x368b3b};var _0x14eacf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2615c0[_0x04be('0x1f')](_0x04be('0x23'))[_0x04be('0x24')](_0x21b5a8,_0x14eacf)['execute']()[_0x04be('0x25')](function(_0x3548cd){if(_0x3548cd[_0x04be('0x26')]){var _0x444cab=_[_0x04be('0x24')](_0x3548cd,function(_0x5ad568){return _0x5ad568[_0x04be('0x27')]===_0x368b3b;});if(_0x444cab){logger[_0x04be('0x1d')](_0x04be('0x28'),_0x368b3b);return BPromise[_0x04be('0x29')]({'id':_0x444cab['Id'],'name':_0x444cab['Name']});}}else{logger[_0x04be('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x368b3b);return _0x2615c0['identity']()[_0x04be('0x25')](function(_0x5507a3){return BPromise[_0x04be('0x29')]({'id':_0x5507a3['user_id'],'name':_0x5507a3[_0x04be('0x2a')]});});}});}else{logger[_0x04be('0x1d')](_0x04be('0x2b'),_0x368b3b);return _0x2615c0[_0x04be('0x2c')]()[_0x04be('0x25')](function(_0x5e77da){return BPromise['resolve']({'id':_0x5e77da[_0x04be('0x2d')],'name':_0x5e77da[_0x04be('0x2a')]});});}}function getEndUser(_0x18032d,_0x265180,_0x223e66,_0x3202d7,_0x489398){var _0x402ad7={'$or':{'Phone':_0x3202d7}};var _0x5a6f2a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x04be('0x25')](function(){logger['info'](_0x04be('0x2e'),_0x3202d7,_0x265180[_0x04be('0x2f')]);switch(_0x265180['moduleSearch']){case _0x04be('0x30'):var _0x5ba84e=_[_0x04be('0x31')](_0x402ad7);if(_0x265180[_0x04be('0x32')]){var _0x5c4f26={};_0x5c4f26[_0x265180[_0x04be('0x32')]]=_0x3202d7;_[_0x04be('0x33')](_0x5ba84e[_0x04be('0x34')],_0x5c4f26);}return _0x489398[_0x04be('0x1f')](_0x04be('0x35'))[_0x04be('0x24')](_0x5ba84e,_0x5a6f2a)['execute']()[_0x04be('0x25')](function(_0x30d665){if(_0x30d665&&_0x30d665[_0x04be('0x26')]){return _0x30d665;}else{var _0x35c29c=_['cloneDeep'](_0x402ad7);if(_0x265180['additionalSearchLead']){var _0x35006e={};_0x35006e[_0x265180[_0x04be('0x36')]]=_0x3202d7;_[_0x04be('0x33')](_0x35c29c[_0x04be('0x34')],_0x35006e);}return _0x489398['sobject'](_0x04be('0x37'))[_0x04be('0x24')](_0x35c29c,_0x5a6f2a);}});case _0x04be('0x38'):var _0x52c483=_[_0x04be('0x31')](_0x402ad7);if(_0x265180[_0x04be('0x39')]){var _0x5c4f26={};_0x5c4f26[_0x265180[_0x04be('0x39')]]=_0x3202d7;_[_0x04be('0x33')](_0x52c483[_0x04be('0x34')],_0x5c4f26);}return _0x489398[_0x04be('0x1f')](_0x04be('0x3a'))[_0x04be('0x24')](_0x52c483,_0x5a6f2a)[_0x04be('0x3b')]()['then'](function(_0x23c11c){if(_0x23c11c&&_0x23c11c[_0x04be('0x26')]){return _0x23c11c;}else{var _0x483c1f=_['cloneDeep'](_0x402ad7);if(_0x265180[_0x04be('0x32')]){var _0x37151e={};_0x37151e[_0x265180[_0x04be('0x32')]]=_0x3202d7;_[_0x04be('0x33')](_0x483c1f[_0x04be('0x34')],_0x37151e);}return _0x489398[_0x04be('0x1f')](_0x04be('0x35'))[_0x04be('0x24')](_0x483c1f,_0x5a6f2a)[_0x04be('0x25')](function(_0x3a87fb){if(_0x3a87fb&&_0x3a87fb['length']){return _0x3a87fb;}else{var _0x1c2007=_['cloneDeep'](_0x402ad7);if(_0x265180[_0x04be('0x36')]){var _0xa770c1={};_0xa770c1[_0x265180[_0x04be('0x36')]]=_0x3202d7;_[_0x04be('0x33')](_0x1c2007[_0x04be('0x34')],_0xa770c1);}return _0x489398[_0x04be('0x1f')]('Lead')[_0x04be('0x24')](_0x1c2007,_0x5a6f2a);}});}});case _0x04be('0x15'):var _0x5ba84e=_[_0x04be('0x31')](_0x402ad7);if(_0x265180[_0x04be('0x32')]){var _0x5c4f26={};_0x5c4f26[_0x265180[_0x04be('0x32')]]=_0x3202d7;_[_0x04be('0x33')](_0x5ba84e[_0x04be('0x34')],_0x5c4f26);}return _0x489398[_0x04be('0x1f')](_0x04be('0x35'))['find'](_0x5ba84e,_0x5a6f2a)[_0x04be('0x3b')]();case _0x04be('0x1c'):var _0x5f2c40=_[_0x04be('0x31')](_0x402ad7);if(_0x265180['additionalSearchLead']){var _0x5c4f26={};_0x5c4f26[_0x265180[_0x04be('0x36')]]=_0x3202d7;_['merge'](_0x5f2c40['$or'],_0x5c4f26);}return _0x489398[_0x04be('0x1f')]('Lead')[_0x04be('0x24')](_0x5f2c40,_0x5a6f2a);case _0x04be('0x17'):var _0x52c483=_['cloneDeep'](_0x402ad7);if(_0x265180[_0x04be('0x39')]){var _0x5c4f26={};_0x5c4f26[_0x265180[_0x04be('0x39')]]=_0x3202d7;_['merge'](_0x52c483[_0x04be('0x34')],_0x5c4f26);}return _0x489398[_0x04be('0x1f')](_0x04be('0x3a'))[_0x04be('0x24')](_0x52c483,_0x5a6f2a);default:return null;}})[_0x04be('0x25')](function(_0x2591f1){if(_0x2591f1&&_0x2591f1[_0x04be('0x26')]){var _0x55e112=_[_0x04be('0x3c')](_0x2591f1);if(_0x55e112){return BPromise[_0x04be('0x29')]({'id':_0x55e112['Id'],'name':_0x55e112[_0x04be('0x3d')],'phone':_0x55e112[_0x04be('0x3e')],'endUserType':_0x55e112[_0x04be('0x3f')][_0x04be('0x40')][_0x04be('0x41')]()});}}})['then'](function(_0x13e3f8){if(_0x13e3f8){logger[_0x04be('0x1d')](_0x04be('0x42'),_0x13e3f8[_0x04be('0x14')],_0x3202d7);return BPromise['resolve'](_0x13e3f8);}else{logger['info'](_0x04be('0x43'),_0x3202d7);var _0x49ed37={'Phone':_0x3202d7};if(_0x265180[_0x04be('0x44')]){if(_0x265180[_0x04be('0x44')]===_0x04be('0x15')){logger[_0x04be('0x1d')](_0x04be('0x45'),_0x3202d7,_0x265180[_0x04be('0x44')]);_0x49ed37[_0x04be('0x46')]=_0x223e66!==_0x04be('0x47')?_0x223e66:util['format']('Caller\x20-\x20%s',_0x3202d7);}else if(_0x265180[_0x04be('0x44')]===_0x04be('0x1c')){logger[_0x04be('0x1d')](_0x04be('0x45'),_0x3202d7,_0x265180[_0x04be('0x44')]);_0x49ed37[_0x04be('0x46')]=_0x223e66!==_0x04be('0x47')?_0x223e66:util[_0x04be('0x48')](_0x04be('0x49'),_0x3202d7);_0x49ed37[_0x04be('0x4a')]=_0x04be('0x4b');}else if(_0x265180[_0x04be('0x44')]===_0x04be('0x17')){logger['info'](_0x04be('0x45'),_0x3202d7,_0x265180[_0x04be('0x44')]);_0x49ed37[_0x04be('0x3d')]=_0x223e66!==_0x04be('0x47')?_0x223e66:util[_0x04be('0x48')](_0x04be('0x49'),_0x3202d7);}else{return null;}}return _0x489398['sobject'](_[_0x04be('0x4c')](_0x265180['moduleCreate']))[_0x04be('0x20')](_0x49ed37)[_0x04be('0x25')](function(_0x4d5705){return BPromise['resolve']({'id':_0x4d5705['id'],'endUserType':_0x265180[_0x04be('0x44')]});});}});}function getCustomFields(_0x135faf,_0x12b7df){var _0x200227={};if(_0x135faf[_0x04be('0x26')]>0x0){_[_0x04be('0x4d')](_0x135faf,function(_0x2a01fd){if(_['includes']([_0x04be('0x4e'),_0x04be('0x4f')],_0x2a01fd[_0x04be('0x40')])&&_0x2a01fd[_0x04be('0x50')]){_0x200227[_0x2a01fd[_0x04be('0x50')]]=_0x2a01fd[_0x04be('0x51')][_0x04be('0x52')]();}else if(_0x2a01fd[_0x04be('0x40')]===_0x04be('0x53')&&_0x2a01fd[_0x04be('0x54')]&&_0x2a01fd[_0x04be('0x50')]){_0x12b7df[_0x2a01fd[_0x04be('0x54')]]&&(_0x200227[_0x2a01fd[_0x04be('0x50')]]=_0x12b7df[_0x2a01fd['variableName']]['toString']());}else if(_0x2a01fd[_0x04be('0x40')]===_0x04be('0x55')&&_0x2a01fd[_0x04be('0x56')]&&_0x2a01fd[_0x04be('0x56')]['name']&&_0x2a01fd[_0x04be('0x50')]){_0x12b7df[_0x2a01fd[_0x04be('0x56')][_0x04be('0x57')][_0x04be('0x41')]()]&&(_0x200227[_0x2a01fd[_0x04be('0x50')]]=_0x12b7df[_0x2a01fd[_0x04be('0x56')]['name'][_0x04be('0x41')]()][_0x04be('0x52')]());}});}return _0x200227;}function getConnection(_0x3aed77){var _0x4c5e4b=_0x3aed77[_0x04be('0x58')]['concat'](_0x3aed77[_0x04be('0x59')]);var _0x45cb70=new jsforce[(_0x04be('0x5a'))]({'oauth2':{'loginUrl':_0x3aed77['remoteUri']||_0x04be('0x5b'),'clientId':_0x3aed77[_0x04be('0x5c')],'clientSecret':_0x3aed77[_0x04be('0x5d')]}});return _0x45cb70[_0x04be('0x5e')](_0x3aed77[_0x04be('0x5f')],_0x4c5e4b)[_0x04be('0x25')](function(){logger['info'](_0x04be('0x60'));return _0x45cb70;});}exports[_0x04be('0x61')]=function(_0x3860ff,_0x4d9dfc,_0x17ae6d,_0xb52a63,_0x5ccc08,_0x204778){var _0x17aba9,_0x4e9ece,_0x54b9b4,_0x51a037;_0x204778['serverUrl']=intUtil[_0x04be('0x62')](_0x204778[_0x04be('0x63')]);_0x204778['remoteUri']=intUtil[_0x04be('0x62')](_0x204778[_0x04be('0x64')]);if(_0x5ccc08&&_0x5ccc08[_0x04be('0x65')]){logger[_0x04be('0x1d')](_0x04be('0x66'),_0x04be('0x67'));_0x4d9dfc[_0x04be('0x68')]=util[_0x04be('0x48')](_0x04be('0x69'),_0x204778[_0x04be('0x63')],_0x4d9dfc[_0x04be('0x6a')],md5(_0x4d9dfc['uniqueid']));}else{_0x4d9dfc[_0x04be('0x68')]='';}return getConnection(_0x204778)[_0x04be('0x25')](function(_0x5e3a3d){_0x51a037=_0x5e3a3d;return getUser(_0x204778,_0xb52a63[_0x04be('0x6b')],_0x51a037);})[_0x04be('0x25')](function(_0x2fe6c8){_0x17aba9=_0x2fe6c8;return getEndUser(_0x204778,_0x17ae6d,_0x4d9dfc[_0x04be('0x6c')],_0x4d9dfc[_0x04be('0x6d')],_0x51a037);})[_0x04be('0x25')](function(_0x5b7c44){_0x4e9ece=_0x5b7c44;return getTicket(_0x204778,_0x17aba9,_0x4e9ece,_0x17ae6d,_0x4d9dfc,_0x17ae6d['Fields'],_0x51a037,'queue');})[_0x04be('0x25')](function(_0xac9280){_0x54b9b4=_0xac9280;logger[_0x04be('0x1d')](_0x04be('0x6e'),_0x54b9b4['id']);logger[_0x04be('0x1d')](_0x04be('0x6f'),_0x54b9b4['id'],_0xb52a63[_0x04be('0x57')],_0x204778[_0x04be('0x40')]);switch(_0x204778['type']){case'integrationTab':emit(util['format']('user:%s',_0xb52a63['name']),_0x04be('0x70'),{'recordId':_0x54b9b4['id']});break;case _0x04be('0x71'):emit(util[_0x04be('0x48')](_0x04be('0x72'),_0xb52a63[_0x04be('0x57')]),'trigger:browser:url',{'uri':util[_0x04be('0x48')](_0x04be('0x73'),_0x51a037[_0x04be('0x74')],_0x54b9b4['id'])});break;default:logger[_0x04be('0x75')](_0x04be('0x76'));}})[_0x04be('0x77')](function(_0x436628){logger[_0x04be('0x75')]('[QUEUE]',_0x436628);});};exports['outbound']=function(_0x5dec8b,_0x28b0bd,_0x327df3,_0x50796a,_0x323874,_0x335948,_0x5511bc){var _0x590bf6,_0x4afe4d,_0x2c8c0c,_0x578f0b;_0x335948[_0x04be('0x63')]=intUtil[_0x04be('0x62')](_0x335948[_0x04be('0x63')]);_0x335948['remoteUri']=intUtil[_0x04be('0x62')](_0x335948[_0x04be('0x64')]);if(_0x5511bc&&_0x5511bc[_0x04be('0x78')]&&_0x5511bc[_0x04be('0x78')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x28b0bd['recordingURL']=util['format'](_0x04be('0x69'),_0x335948[_0x04be('0x63')],_0x28b0bd[_0x04be('0x6a')],md5(_0x28b0bd[_0x04be('0x6a')]));}return getConnection(_0x335948)[_0x04be('0x25')](function(_0x25eb37){_0x578f0b=_0x25eb37;return getUser(_0x335948,_0x50796a[_0x04be('0x6b')],_0x578f0b);})[_0x04be('0x25')](function(_0x188326){_0x590bf6=_0x188326;return getEndUser(_0x335948,_0x327df3,_0x28b0bd[_0x04be('0x79')],_0x28b0bd[_0x04be('0x7a')],_0x578f0b);})[_0x04be('0x25')](function(_0x589f59){_0x4afe4d=_0x589f59;return getTicket(_0x335948,_0x590bf6,_0x4afe4d,_0x327df3,_0x28b0bd,_0x327df3[_0x04be('0x7b')],_0x578f0b,'outbound');})[_0x04be('0x25')](function(_0x124746){_0x2c8c0c=_0x124746;logger[_0x04be('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2c8c0c['id']);logger[_0x04be('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2c8c0c['id'],_0x50796a[_0x04be('0x57')],_0x335948[_0x04be('0x40')]);switch(_0x335948[_0x04be('0x40')]){case _0x04be('0x7c'):emit(util[_0x04be('0x48')](_0x04be('0x72'),_0x50796a['name']),_0x04be('0x70'),{'recordId':_0x2c8c0c['id']});break;case _0x04be('0x71'):emit(util[_0x04be('0x48')]('user:%s',_0x50796a[_0x04be('0x57')]),'trigger:browser:url',{'uri':util[_0x04be('0x48')](_0x04be('0x73'),_0x578f0b[_0x04be('0x74')],_0x2c8c0c['id'])});break;default:logger[_0x04be('0x75')](_0x04be('0x7d'),_0x04be('0x7e'));}})[_0x04be('0x77')](function(_0x1ecf7b){logger[_0x04be('0x75')]('[OUTBOUND]',_0x1ecf7b);});};exports[_0x04be('0x7f')]=function(_0x137145,_0x4182d6,_0x19754f,_0x42a19c,_0x57705b,_0x3a06e8){var _0x1dec09,_0x2e6619,_0x381f1d,_0x792f6d;_0x3a06e8['serverUrl']=intUtil['stripTrailingSlash'](_0x3a06e8['serverUrl']);_0x3a06e8[_0x04be('0x64')]=intUtil[_0x04be('0x62')](_0x3a06e8[_0x04be('0x64')]);if(_0x57705b&&_0x57705b[_0x04be('0x65')]){logger[_0x04be('0x1d')]('['+_0x4182d6[_0x04be('0x80')]['toUpperCase']()+']',_0x04be('0x67'));_0x4182d6[_0x04be('0x68')]=util['format'](_0x04be('0x69'),_0x3a06e8[_0x04be('0x63')],_0x4182d6[_0x04be('0x6a')],md5(_0x4182d6['uniqueid']));}else{_0x4182d6['recordingURL']='';}return getConnection(_0x3a06e8)['then'](function(_0x286471){_0x792f6d=_0x286471;if(!_[_0x04be('0x21')](_0x42a19c)){return getUser(_0x3a06e8,_0x42a19c[_0x04be('0x57')],_0x792f6d);}else{return getUser(_0x3a06e8,null,_0x792f6d);}})[_0x04be('0x25')](function(_0x1486dc){_0x1dec09=_0x1486dc;return getEndUser(_0x3a06e8,_0x19754f,_0x4182d6[_0x04be('0x6c')],_0x4182d6[_0x04be('0x6d')],_0x792f6d);})[_0x04be('0x25')](function(_0x111ca8){_0x2e6619=_0x111ca8;return getTicket(_0x3a06e8,_0x1dec09,_0x2e6619,_0x19754f,_0x4182d6,_0x19754f['Fields'],_0x792f6d);})['then'](function(_0x1a8426){_0x381f1d=_0x1a8426;logger[_0x04be('0x1d')]('['+_0x4182d6[_0x04be('0x80')][_0x04be('0x81')]()+_0x04be('0x82'),_0x381f1d['id']);logger['info']('['+_0x4182d6[_0x04be('0x80')][_0x04be('0x81')]()+_0x04be('0x83'),_0x3a06e8[_0x04be('0x40')]);})[_0x04be('0x77')](function(_0x9f00df){logger[_0x04be('0x75')]('['+_0x4182d6[_0x04be('0x80')]['toUpperCase']()+']',_0x9f00df);});}; \ 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 f8f8d7e..cee88fe 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 _0xf899=['getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/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/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','includes','string','type','nameField','customField','content','toString','picklist','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xf899,0xa6));var _0x9f89=function(_0x3895ac,_0x2b0da2){_0x3895ac=_0x3895ac-0x0;var _0x432f41=_0xf899[_0x3895ac];return _0x432f41;};'use strict';var _=require(_0x9f89('0x0'));var Promise=require(_0x9f89('0x1'));var rp=require(_0x9f89('0x2'));var util=require(_0x9f89('0x3'));var md5=require('md5');var Redis=require(_0x9f89('0x4'));var intUtil=require(_0x9f89('0x5'));var config=require(_0x9f89('0x6'));var logger=require(_0x9f89('0x7'))(_0x9f89('0x8'));config['redis']=_[_0x9f89('0x9')](config[_0x9f89('0xa')],{'host':_0x9f89('0xb'),'port':0x18eb});var io=require(_0x9f89('0xc'))(new Redis(config[_0x9f89('0xa')]));function getAdminUser(_0x31beb0,_0xc9677,_0x17bb83,_0x2f4382,_0x3c4637,_0xc29a90){return new Promise(function(_0x479465,_0x4cca81){var _0x51e97b={'method':'GET','uri':_0x2f4382+_0x9f89('0xd')+'&'+_0x3c4637+'&'+_0xc29a90,'auth':_0xc9677,'json':!![]};return rp(_0x51e97b)['then'](function(_0x2a4dde){if(_0x2a4dde[_0x9f89('0xe')][_0x9f89('0xf')]>0x0){_0x17bb83[_0x9f89('0x10')]=_0x2a4dde[_0x9f89('0xe')][0x0][_0x9f89('0x11')];}logger[_0x9f89('0x12')]('['+[_0x31beb0[_0x9f89('0x13')]()]+_0x9f89('0x14'),_0x17bb83);_0x479465(_0x17bb83);})['catch'](function(_0x5ae293){logger[_0x9f89('0x15')]('['+[_0x31beb0['toUpperCase']()]+']',_0x5ae293[_0x9f89('0x16')]);_0x4cca81(_0x5ae293[_0x9f89('0x16')]);});});}function getUser(_0x25204a,_0x46ad3f,_0x3731fd,_0x41c477,_0x5a1713){return function(_0x43c8c4){logger[_0x9f89('0x12')]('['+[_0x25204a[_0x9f89('0x13')]()]+_0x9f89('0x17'),_0x43c8c4);return new Promise(function(_0x59274a,_0x23f2f9){if(intUtil[_0x9f89('0x18')](_0x43c8c4[_0x9f89('0x19')])){var _0x456ebf={'method':'GET','uri':_0x3731fd+_0x9f89('0x1a')+_0x43c8c4[_0x9f89('0x19')]+'&'+_0x41c477+'&'+_0x5a1713,'auth':_0x46ad3f,'json':!![]};logger[_0x9f89('0x12')]('['+[_0x25204a['toUpperCase']()]+_0x9f89('0x1b'),_0x456ebf);return rp(_0x456ebf)[_0x9f89('0x1c')](function(_0xe97391){logger[_0x9f89('0x12')]('['+[_0x25204a[_0x9f89('0x13')]()]+_0x9f89('0x1d'),_0xe97391);if(_0xe97391['result']['length']>0x0&&String(_0xe97391[_0x9f89('0xe')][0x0]['active'])===_0x9f89('0x1e')){_0x43c8c4[_0x9f89('0x1f')]=_0xe97391[_0x9f89('0xe')][0x0][_0x9f89('0x11')];}else{_0x43c8c4[_0x9f89('0x1f')]=_0x43c8c4['adminId'];_0x43c8c4[_0x9f89('0x19')]=_0x43c8c4[_0x9f89('0x20')];}logger[_0x9f89('0x12')]('['+[_0x25204a[_0x9f89('0x13')]()]+_0x9f89('0x21'),_0x43c8c4);_0x59274a(_0x43c8c4);})[_0x9f89('0x22')](function(_0x28bd05){logger[_0x9f89('0x15')]('['+[_0x25204a[_0x9f89('0x13')]()]+']',_0x28bd05[_0x9f89('0x16')]);_0x23f2f9(_0x28bd05[_0x9f89('0x16')]);});}else{logger[_0x9f89('0x12')]('['+[_0x25204a[_0x9f89('0x13')]()]+_0x9f89('0x23'));_0x43c8c4['userId']=_0x43c8c4[_0x9f89('0x10')];_0x43c8c4[_0x9f89('0x19')]=_0x43c8c4[_0x9f89('0x20')];_0x59274a(_0x43c8c4);}});};}function createEndUser(_0x2d4667,_0x172ad7,_0xdc71f5,_0x4db38b,_0x19480f){logger[_0x9f89('0x12')]('['+[_0x2d4667['toUpperCase']()]+_0x9f89('0x24'),_0xdc71f5);return new Promise(function(_0x1de493,_0x2cc132){var _0x5258b2={'method':_0x9f89('0x25'),'uri':_0x4db38b+_0x9f89('0x26')+_0x19480f,'body':{'user_name':_0xdc71f5['endUserNumber'],'roles':_0x9f89('0x27'),'first_name':_0xdc71f5[_0x9f89('0x28')],'active':_0x9f89('0x1e'),'date_format':_0x9f89('0x29'),'phone':_0xdc71f5[_0x9f89('0x28')]},'auth':_0x172ad7,'json':!![]};return rp(_0x5258b2)[_0x9f89('0x1c')](function(_0x52598a){logger[_0x9f89('0x12')]('['+[_0x2d4667[_0x9f89('0x13')]()]+_0x9f89('0x2a'),_0x52598a[_0x9f89('0xe')]);_0xdc71f5[_0x9f89('0x2b')]=_0x52598a[_0x9f89('0xe')]['sys_id'];_0x1de493(_0xdc71f5);})[_0x9f89('0x22')](function(_0x5aef14){logger[_0x9f89('0x15')]('['+[_0x2d4667[_0x9f89('0x13')]()]+']',_0x5aef14[_0x9f89('0x16')]);_0x2cc132(_0x5aef14[_0x9f89('0x16')]);});});}function getEndUser(_0x506d35,_0x19d705,_0x4c3bda,_0x458b57,_0x3c7e58){return function(_0x5d4189){logger[_0x9f89('0x12')]('['+[_0x506d35[_0x9f89('0x13')]()]+_0x9f89('0x2c'),_0x5d4189);return new Promise(function(_0x191c77,_0x4be981){var _0x5e2d06={'method':_0x9f89('0x2d'),'uri':_0x4c3bda+_0x9f89('0x2e')+_0x5d4189[_0x9f89('0x28')]+'&'+_0x458b57+'&'+_0x3c7e58,'auth':_0x19d705,'json':!![]};return rp(_0x5e2d06)[_0x9f89('0x1c')](function(_0xae63b0){if(_0xae63b0['result'][_0x9f89('0xf')]>0x0){_0x5d4189['endUserId']=_0xae63b0[_0x9f89('0xe')][0x0]['sys_id'];logger[_0x9f89('0x12')]('['+[_0x506d35[_0x9f89('0x13')]()]+'],\x20getEndUser\x20crm',_0x5d4189);_0x191c77(_0x5d4189);}else{return createEndUser(_0x506d35,_0x19d705,_0x5d4189,_0x4c3bda,_0x458b57)[_0x9f89('0x1c')](function(_0x5c06f9){logger[_0x9f89('0x12')]('['+[_0x506d35[_0x9f89('0x13')]()]+'],\x20createEndUser\x20crm',_0x5c06f9);_0x191c77(_0x5c06f9);});}})[_0x9f89('0x22')](function(_0x314e07){logger['error']('['+[_0x506d35[_0x9f89('0x13')]()]+']',_0x314e07[_0x9f89('0x16')]);_0x4be981(_0x314e07[_0x9f89('0x16')]);});});};}function getCustomFields(_0x3eab33,_0x397b56){var _0x3ad15c={};if(_0x3eab33[_0x9f89('0xf')]>0x0){_['forEach'](_0x3eab33,function(_0x1330fe){if(_[_0x9f89('0x2f')]([_0x9f89('0x30'),'picklist'],_0x1330fe[_0x9f89('0x31')])&&_0x1330fe[_0x9f89('0x32')]&&!_0x1330fe[_0x9f89('0x33')]){_0x3ad15c[_0x1330fe['nameField']['toLowerCase']()]=_0x1330fe[_0x9f89('0x34')][_0x9f89('0x35')]();}else if(_[_0x9f89('0x2f')]([_0x9f89('0x30'),_0x9f89('0x36')],_0x1330fe[_0x9f89('0x31')])&&_0x1330fe[_0x9f89('0x37')]&&_0x1330fe['customField']){_0x3ad15c[_0x1330fe[_0x9f89('0x37')][_0x9f89('0x38')]()]=_0x1330fe[_0x9f89('0x34')][_0x9f89('0x35')]();}else if(_0x1330fe[_0x9f89('0x31')]===_0x9f89('0x39')&&_0x1330fe[_0x9f89('0x3a')]&&_0x1330fe[_0x9f89('0x37')]&&_0x1330fe['customField']){_0x3ad15c[_0x1330fe[_0x9f89('0x37')]['toLowerCase']()]=_0x397b56[_0x1330fe[_0x9f89('0x3a')]][_0x9f89('0x35')]();}else if(_0x1330fe['type']===_0x9f89('0x3b')&&_0x1330fe[_0x9f89('0x3c')]&&_0x1330fe[_0x9f89('0x3c')][_0x9f89('0x3d')]&&_0x1330fe[_0x9f89('0x37')]&&_0x1330fe[_0x9f89('0x33')]){_0x3ad15c[_0x1330fe[_0x9f89('0x37')][_0x9f89('0x38')]()]=_0x397b56[_0x1330fe[_0x9f89('0x3c')]['name'][_0x9f89('0x38')]()][_0x9f89('0x35')]();}});}return _0x3ad15c;}function getTicket(_0x3aab56,_0x38a343,_0x378c0c,_0x35f9bc,_0x19d260,_0xc9976e){return function(_0x340b36){logger['info']('['+[_0x3aab56[_0x9f89('0x13')]()]+_0x9f89('0x3e'),_0x340b36);return new Promise(function(_0x17070e,_0xeac3ee){var _0x45ed71=_0x3aab56['toLowerCase']()===_0x9f89('0x3f')?_0x340b36[_0x9f89('0x1f')]:_0x340b36[_0x9f89('0x2b')];var _0x39bac7={'method':_0x9f89('0x25'),'uri':_0x378c0c+_0x9f89('0x40')+'?'+_0xc9976e,'body':Object[_0x9f89('0x41')]({},{'active':'true','caller_id':_0x45ed71,'assigned_to':_0x340b36[_0x9f89('0x1f')],'short_description':intUtil[_0x9f89('0x42')](_0x35f9bc['Subjects'],_0x19d260,'\x20'),'description':intUtil['getString'](_0x35f9bc[_0x9f89('0x43')],_0x19d260,'\x0a')},getCustomFields(_0x35f9bc[_0x9f89('0x44')],_0x19d260)),'auth':_0x38a343,'json':!![]};return rp(_0x39bac7)[_0x9f89('0x1c')](function(_0x10badf){logger[_0x9f89('0x12')]('['+[_0x3aab56[_0x9f89('0x13')]()]+_0x9f89('0x45'),_0x10badf[_0x9f89('0xe')]);_0x340b36[_0x9f89('0x46')]=_0x10badf[_0x9f89('0xe')][_0x9f89('0x11')];_0x340b36[_0x9f89('0x47')]=_0x10badf[_0x9f89('0xe')][_0x9f89('0x48')];logger[_0x9f89('0x12')]('['+[_0x3aab56[_0x9f89('0x13')]()]+']\x20getTicket\x20crm',_0x340b36);_0x17070e(_0x340b36);})[_0x9f89('0x22')](function(_0x1f540d){logger[_0x9f89('0x15')]('['+[_0x3aab56[_0x9f89('0x13')]()]+']',_0x1f540d[_0x9f89('0x16')]);_0xeac3ee(_0x1f540d[_0x9f89('0x16')]);});});};}function createRemoteTag(_0x233900,_0x4dca51,_0x1bf05f,_0x4b39c9){return new Promise(function(_0x134234,_0x5cb36e){var _0x495aba={'method':_0x9f89('0x25'),'uri':_0x1bf05f+_0x9f89('0x49')+'?'+_0x4b39c9,'body':{'short_description':_0x233900,'global':!![],'active':!![],'name':_0x233900},'auth':_0x4dca51,'json':!![]};return rp(_0x495aba)[_0x9f89('0x1c')](function(_0xd8caf8){var _0x5743e4=_0xd8caf8[_0x9f89('0xe')][_0x9f89('0x11')];_0x134234(_0x5743e4);});});}function getRemoteTag(_0x2c979b,_0x4a8f81,_0x4668c7,_0x2ac1f3,_0x34ae73){return new Promise(function(_0x32c440,_0x28a7d2){var _0x960623={'method':_0x9f89('0x2d'),'uri':_0x4668c7+_0x9f89('0x49')+_0x9f89('0x4a')+_0x2c979b+'&'+_0x2ac1f3,'auth':_0x4a8f81,'json':!![]};return rp(_0x960623)[_0x9f89('0x1c')](function(_0x4de5da){if(_0x4de5da['result'][_0x9f89('0xf')]>0x0){var _0x1aa209=_0x4de5da[_0x9f89('0xe')][0x0][_0x9f89('0x11')];_0x32c440(_0x1aa209);}else{return createRemoteTag(_0x2c979b,_0x4a8f81,_0x4668c7,_0x2ac1f3)[_0x9f89('0x1c')](function(_0x8b55b8){_0x32c440(_0x8b55b8);});}});});}function assignTagToIncident(_0xa019f6,_0x53e2a5,_0x48f004,_0x30ba47,_0x402392){return new Promise(function(_0x4ac72f,_0x42897b){var _0x1cb9ab={'method':_0x9f89('0x25'),'uri':_0x48f004+_0x9f89('0x4b')+'?'+_0x402392,'body':{'label':_0xa019f6,'table':_0x9f89('0x40'),'id_type':_0x9f89('0x4c'),'table_key':_0x30ba47[_0x9f89('0x46')],'title':_0x9f89('0x4d')+_0x30ba47['ticketNumber'],'id_display':_0x30ba47[_0x9f89('0x47')]},'auth':_0x53e2a5,'json':!![]};return rp(_0x1cb9ab)[_0x9f89('0x1c')](function(_0x179a6e){_0x4ac72f();})[_0x9f89('0x22')](function(){_0x4ac72f();});});}function manageTags(_0xbb0672,_0x4306f4,_0x386af6,_0x2e228f,_0x16b332,_0x4509b5,_0x1aa44a){return new Promise(function(_0x1cb218,_0x3df5cb){var _0x3e01ea=[];_0x4306f4[_0x9f89('0x4e')](function(_0x494f33){_0x3e01ea['push'](getRemoteTag(_0x494f33,_0x386af6,_0x2e228f,_0x4509b5,_0x1aa44a));});return Promise['all'](_0x3e01ea)[_0x9f89('0x1c')](function(_0x206369){if(_0x206369['length']){logger[_0x9f89('0x12')]('['+[_0xbb0672['toUpperCase']()]+_0x9f89('0x4f'),_0x206369);var _0x67fad4=[];_0x206369[_0x9f89('0x4e')](function(_0x3926bd){_0x67fad4[_0x9f89('0x50')](assignTagToIncident(_0x3926bd,_0x386af6,_0x2e228f,_0x16b332,_0x4509b5));});return Promise[_0x9f89('0x51')](_0x67fad4)[_0x9f89('0x1c')](function(){_0x1cb218();})[_0x9f89('0x22')](function(){_0x1cb218();});}else{_0x1cb218();}});});}function getTags(_0x41e97d,_0x682609,_0x379935,_0x144ca0,_0x649fe3,_0x1529ae){return function(_0x117f81){return new Promise(function(_0x2ff043,_0x1c0b5a){var _0x558c72=[];var _0x1e7f15=_0x144ca0[_0x9f89('0x52')];if(_0x1e7f15&&_0x1e7f15['length']>0x0){_0x558c72=_[_0x9f89('0x53')](_0x1e7f15,_0x9f89('0x3d'));}if(_0x558c72['length']>0x0){return manageTags(_0x41e97d,_0x558c72,_0x682609,_0x379935,_0x117f81,_0x649fe3,_0x1529ae)[_0x9f89('0x1c')](function(){_0x2ff043(_0x117f81);});}else{_0x2ff043(_0x117f81);}});};}function emit(_0x66de0e,_0x296178,_0x262c53){var _0x90fe19='%26sysparm_record_target%3Dincident'+_0x9f89('0x54')+_0x9f89('0x55')+'%255EORDERBYDESCnumber';var _0x4e72f9={'uri':_0x66de0e+_0x9f89('0x56')+_0x262c53+_0x90fe19};io['to'](util[_0x9f89('0x57')](_0x9f89('0x58'),_0x296178))[_0x9f89('0x59')](_0x9f89('0x5a'),_0x4e72f9);}exports['cs']=function(_0x502b0c,_0x540595,_0x17a1f9,_0xdb7ba8,_0x36aeaf,_0x24753f,_0x4720ff,_0x37b5f9){var _0x4995f0={};var _0xa43780={'user':_0x24753f[_0x9f89('0x5b')],'pass':_0x24753f[_0x9f89('0x5c')]};var _0x2b23ef=_0x9f89('0x5d');var _0x5e11f1=_0x9f89('0x5e');_0x24753f[_0x9f89('0x5f')]=intUtil[_0x9f89('0x60')](_0x24753f['remoteUri']);_0x24753f[_0x9f89('0x61')]=intUtil['stripTrailingSlash'](_0x24753f[_0x9f89('0x61')]);var _0x5e0833=util[_0x9f89('0x57')](_0x9f89('0x62'),_0x24753f[_0x9f89('0x5f')]);_0x4995f0[_0x9f89('0x19')]=!_['isNil'](_0xdb7ba8)?_0xdb7ba8['email']:null;_0x4995f0['adminEmail']=_0x24753f[_0x9f89('0x63')];_0x4995f0[_0x9f89('0x28')]=_0x37b5f9[_0x9f89('0x38')]()==='outbound'?_0x540595[_0x9f89('0x64')]:_0x540595[_0x9f89('0x65')];_0x4995f0[_0x9f89('0x66')]=_0x37b5f9===_0x9f89('0x67')||_0x37b5f9===_0x9f89('0x68')?_0x9f89('0x67'):_0x9f89('0x3f');var _0x17d72e=util['format'](_0x9f89('0x69'),_0x24753f['serverUrl'],_0x540595[_0x9f89('0x6a')],md5(_0x540595[_0x9f89('0x6a')]));if(_0x36aeaf&&_0x36aeaf['monitor_format']){logger['info'](_0x9f89('0x6b'),_0x9f89('0x6c'));_0x540595[_0x9f89('0x6d')]=_0x17d72e;}else if(_0x4720ff&&_0x4720ff['recordingFormat']&&_0x4720ff['recordingFormat']!==_0x9f89('0x6e')){logger[_0x9f89('0x12')](_0x9f89('0x6f'),_0x9f89('0x6c'));_0x540595[_0x9f89('0x6d')]=_0x17d72e;}else{_0x540595[_0x9f89('0x6d')]='';}return getAdminUser(_0x37b5f9,_0xa43780,_0x4995f0,_0x5e0833,_0x5e11f1,_0x2b23ef)[_0x9f89('0x1c')](getUser(_0x37b5f9,_0xa43780,_0x5e0833,_0x5e11f1,_0x2b23ef))[_0x9f89('0x1c')](getEndUser(_0x37b5f9,_0xa43780,_0x5e0833,_0x5e11f1,_0x2b23ef))[_0x9f89('0x1c')](getTicket(_0x37b5f9,_0xa43780,_0x5e0833,_0x17a1f9,_0x540595,_0x5e11f1))[_0x9f89('0x1c')](function(_0x1776d0){logger[_0x9f89('0x12')](util[_0x9f89('0x57')](_0x9f89('0x70'),_0x1776d0[_0x9f89('0x46')]));logger[_0x9f89('0x12')](util['format'](_0x9f89('0x71'),_0x37b5f9));if(_0x37b5f9!==_0x9f89('0x68')){logger[_0x9f89('0x12')]('['+[_0x37b5f9['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x24753f[_0x9f89('0x5f')],_0xdb7ba8[_0x9f89('0x3d')],_0x1776d0['ticketId']);}})[_0x9f89('0x22')](function(_0x3ee812){logger['error']('['+[_0x37b5f9[_0x9f89('0x13')]()]+_0x9f89('0x72'),util[_0x9f89('0x73')](_0x3ee812,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc974=['type','idField','variable','variableName','customVariable','Variable','name','incident','assign','true','Subjects','getString',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','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','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','toUpperCase','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','userId','adminEmail','],\x20getUser\x20crm','error','message',']\x20using\x20admin\x20profile','POST','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','nameField','customField','toLowerCase','content','toString','string','picklist'];(function(_0x1efc82,_0x10c1ed){var _0x1686d8=function(_0x334a86){while(--_0x334a86){_0x1efc82['push'](_0x1efc82['shift']());}};_0x1686d8(++_0x10c1ed);}(_0xc974,0x17c));var _0x4c97=function(_0x53f56a,_0x246a02){_0x53f56a=_0x53f56a-0x0;var _0x4a17ad=_0xc974[_0x53f56a];return _0x4a17ad;};'use strict';var _=require('lodash');var Promise=require(_0x4c97('0x0'));var rp=require('request-promise');var util=require(_0x4c97('0x1'));var md5=require(_0x4c97('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4c97('0x3'));var config=require('../../../../config/environment');var logger=require(_0x4c97('0x4'))(_0x4c97('0x5'));config['redis']=_[_0x4c97('0x6')](config[_0x4c97('0x7')],{'host':_0x4c97('0x8'),'port':0x18eb});var io=require(_0x4c97('0x9'))(new Redis(config['redis']));function getAdminUser(_0x1836f4,_0x229fb6,_0x3299d7,_0x54ccd9,_0x54c1f7,_0x11a908){return new Promise(function(_0x438e8d,_0x5309f6){var _0x52f391={'method':_0x4c97('0xa'),'uri':_0x54ccd9+_0x4c97('0xb')+'&'+_0x54c1f7+'&'+_0x11a908,'auth':_0x229fb6,'json':!![]};return rp(_0x52f391)[_0x4c97('0xc')](function(_0x1fcd5d){if(_0x1fcd5d[_0x4c97('0xd')]['length']>0x0){_0x3299d7[_0x4c97('0xe')]=_0x1fcd5d[_0x4c97('0xd')][0x0][_0x4c97('0xf')];}logger[_0x4c97('0x10')]('['+[_0x1836f4['toUpperCase']()]+_0x4c97('0x11'),_0x3299d7);_0x438e8d(_0x3299d7);})[_0x4c97('0x12')](function(_0x576732){logger['error']('['+[_0x1836f4[_0x4c97('0x13')]()]+']',_0x576732['message']);_0x5309f6(_0x576732['message']);});});}function getUser(_0xe6c725,_0x54262b,_0x467467,_0x173739,_0x16c1fa){return function(_0x3c64f5){logger['info']('['+[_0xe6c725['toUpperCase']()]+_0x4c97('0x14'),_0x3c64f5);return new Promise(function(_0x2bd57c,_0x4cb998){if(intUtil['validateEmail'](_0x3c64f5[_0x4c97('0x15')])){var _0x466541={'method':_0x4c97('0xa'),'uri':_0x467467+'sys_user?sysparm_query=email%3D'+_0x3c64f5[_0x4c97('0x15')]+'&'+_0x173739+'&'+_0x16c1fa,'auth':_0x54262b,'json':!![]};logger[_0x4c97('0x10')]('['+[_0xe6c725[_0x4c97('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x466541);return rp(_0x466541)[_0x4c97('0xc')](function(_0x83f9a3){logger['info']('['+[_0xe6c725['toUpperCase']()]+_0x4c97('0x16'),_0x83f9a3);if(_0x83f9a3['result'][_0x4c97('0x17')]>0x0&&String(_0x83f9a3[_0x4c97('0xd')][0x0][_0x4c97('0x18')])==='true'){_0x3c64f5[_0x4c97('0x19')]=_0x83f9a3[_0x4c97('0xd')][0x0][_0x4c97('0xf')];}else{_0x3c64f5[_0x4c97('0x19')]=_0x3c64f5[_0x4c97('0xe')];_0x3c64f5['userEmail']=_0x3c64f5[_0x4c97('0x1a')];}logger[_0x4c97('0x10')]('['+[_0xe6c725['toUpperCase']()]+_0x4c97('0x1b'),_0x3c64f5);_0x2bd57c(_0x3c64f5);})['catch'](function(_0x64ca6a){logger[_0x4c97('0x1c')]('['+[_0xe6c725[_0x4c97('0x13')]()]+']',_0x64ca6a['message']);_0x4cb998(_0x64ca6a[_0x4c97('0x1d')]);});}else{logger[_0x4c97('0x10')]('['+[_0xe6c725[_0x4c97('0x13')]()]+_0x4c97('0x1e'));_0x3c64f5[_0x4c97('0x19')]=_0x3c64f5[_0x4c97('0xe')];_0x3c64f5[_0x4c97('0x15')]=_0x3c64f5[_0x4c97('0x1a')];_0x2bd57c(_0x3c64f5);}});};}function createEndUser(_0x48f2bf,_0x3fc68b,_0x2b8714,_0x4ac037,_0x25b95c){logger[_0x4c97('0x10')]('['+[_0x48f2bf['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x2b8714);return new Promise(function(_0x5d5d70,_0x5c4289){var _0x58e6de={'method':_0x4c97('0x1f'),'uri':_0x4ac037+'sys_user?'+_0x25b95c,'body':{'user_name':_0x2b8714[_0x4c97('0x20')],'roles':_0x4c97('0x21'),'first_name':_0x2b8714[_0x4c97('0x20')],'active':'true','date_format':_0x4c97('0x22'),'phone':_0x2b8714['endUserNumber']},'auth':_0x3fc68b,'json':!![]};return rp(_0x58e6de)[_0x4c97('0xc')](function(_0x24a6ee){logger['info']('['+[_0x48f2bf[_0x4c97('0x13')]()]+'],\x20EndUser\x20schema',_0x24a6ee[_0x4c97('0xd')]);_0x2b8714[_0x4c97('0x23')]=_0x24a6ee[_0x4c97('0xd')][_0x4c97('0xf')];_0x5d5d70(_0x2b8714);})[_0x4c97('0x12')](function(_0x159591){logger['error']('['+[_0x48f2bf[_0x4c97('0x13')]()]+']',_0x159591[_0x4c97('0x1d')]);_0x5c4289(_0x159591['message']);});});}function getEndUser(_0x2ae6e8,_0x223a25,_0x2e3b61,_0x1ab88b,_0x251c03){return function(_0x1171ec){logger[_0x4c97('0x10')]('['+[_0x2ae6e8[_0x4c97('0x13')]()]+_0x4c97('0x24'),_0x1171ec);return new Promise(function(_0x1356a8,_0x562f01){var _0x5a4aeb={'method':_0x4c97('0xa'),'uri':_0x2e3b61+_0x4c97('0x25')+_0x1171ec[_0x4c97('0x20')]+'&'+_0x1ab88b+'&'+_0x251c03,'auth':_0x223a25,'json':!![]};return rp(_0x5a4aeb)['then'](function(_0x3eb044){if(_0x3eb044['result'][_0x4c97('0x17')]>0x0){_0x1171ec['endUserId']=_0x3eb044[_0x4c97('0xd')][0x0][_0x4c97('0xf')];logger[_0x4c97('0x10')]('['+[_0x2ae6e8[_0x4c97('0x13')]()]+'],\x20getEndUser\x20crm',_0x1171ec);_0x1356a8(_0x1171ec);}else{return createEndUser(_0x2ae6e8,_0x223a25,_0x1171ec,_0x2e3b61,_0x1ab88b)[_0x4c97('0xc')](function(_0x1b4961){logger[_0x4c97('0x10')]('['+[_0x2ae6e8[_0x4c97('0x13')]()]+_0x4c97('0x26'),_0x1b4961);_0x1356a8(_0x1b4961);});}})[_0x4c97('0x12')](function(_0x19c67c){logger[_0x4c97('0x1c')]('['+[_0x2ae6e8[_0x4c97('0x13')]()]+']',_0x19c67c[_0x4c97('0x1d')]);_0x562f01(_0x19c67c[_0x4c97('0x1d')]);});});};}function getCustomFields(_0x419804,_0x355c4d){var _0x262b91={};if(_0x419804['length']>0x0){_[_0x4c97('0x27')](_0x419804,function(_0x4086f5){if(_[_0x4c97('0x28')](['string','picklist'],_0x4086f5['type'])&&_0x4086f5[_0x4c97('0x29')]&&!_0x4086f5[_0x4c97('0x2a')]){_0x262b91[_0x4086f5[_0x4c97('0x29')][_0x4c97('0x2b')]()]=_0x4086f5[_0x4c97('0x2c')][_0x4c97('0x2d')]();}else if(_[_0x4c97('0x28')]([_0x4c97('0x2e'),_0x4c97('0x2f')],_0x4086f5[_0x4c97('0x30')])&&_0x4086f5[_0x4c97('0x31')]&&_0x4086f5['customField']){_0x262b91[_0x4086f5[_0x4c97('0x31')][_0x4c97('0x2b')]()]=_0x4086f5[_0x4c97('0x2c')][_0x4c97('0x2d')]();}else if(_0x4086f5[_0x4c97('0x30')]===_0x4c97('0x32')&&_0x4086f5[_0x4c97('0x33')]&&_0x4086f5[_0x4c97('0x31')]&&_0x4086f5['customField']){_0x262b91[_0x4086f5[_0x4c97('0x31')][_0x4c97('0x2b')]()]=_0x355c4d[_0x4086f5[_0x4c97('0x33')]][_0x4c97('0x2d')]();}else if(_0x4086f5[_0x4c97('0x30')]===_0x4c97('0x34')&&_0x4086f5[_0x4c97('0x35')]&&_0x4086f5[_0x4c97('0x35')][_0x4c97('0x36')]&&_0x4086f5[_0x4c97('0x31')]&&_0x4086f5[_0x4c97('0x2a')]){_0x262b91[_0x4086f5[_0x4c97('0x31')][_0x4c97('0x2b')]()]=_0x355c4d[_0x4086f5[_0x4c97('0x35')]['name'][_0x4c97('0x2b')]()][_0x4c97('0x2d')]();}});}return _0x262b91;}function getTicket(_0x87f383,_0x102d39,_0x4242d0,_0x250b1d,_0x28c966,_0x59011a){return function(_0x36d7a0){logger[_0x4c97('0x10')]('['+[_0x87f383[_0x4c97('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x36d7a0);return new Promise(function(_0x3e67fb,_0x334e69){var _0x3c0757=_0x87f383[_0x4c97('0x2b')]()==='outbound'?_0x36d7a0['userId']:_0x36d7a0[_0x4c97('0x23')];var _0x1b5a0c={'method':_0x4c97('0x1f'),'uri':_0x4242d0+_0x4c97('0x37')+'?'+_0x59011a,'body':Object[_0x4c97('0x38')]({},{'active':_0x4c97('0x39'),'caller_id':_0x3c0757,'assigned_to':_0x36d7a0[_0x4c97('0x19')],'short_description':intUtil['getString'](_0x250b1d[_0x4c97('0x3a')],_0x28c966,'\x20'),'description':intUtil[_0x4c97('0x3b')](_0x250b1d['Descriptions'],_0x28c966,'\x0a')},getCustomFields(_0x250b1d['Fields'],_0x28c966)),'auth':_0x102d39,'json':!![]};return rp(_0x1b5a0c)['then'](function(_0x567ed0){logger[_0x4c97('0x10')]('['+[_0x87f383[_0x4c97('0x13')]()]+_0x4c97('0x3c'),_0x567ed0[_0x4c97('0xd')]);_0x36d7a0[_0x4c97('0x3d')]=_0x567ed0[_0x4c97('0xd')][_0x4c97('0xf')];_0x36d7a0[_0x4c97('0x3e')]=_0x567ed0[_0x4c97('0xd')][_0x4c97('0x3f')];logger['info']('['+[_0x87f383['toUpperCase']()]+_0x4c97('0x40'),_0x36d7a0);_0x3e67fb(_0x36d7a0);})[_0x4c97('0x12')](function(_0x416cf8){logger['error']('['+[_0x87f383[_0x4c97('0x13')]()]+']',_0x416cf8[_0x4c97('0x1d')]);_0x334e69(_0x416cf8[_0x4c97('0x1d')]);});});};}function createRemoteTag(_0x3f8dba,_0x5a0fca,_0x5acbe9,_0x4d442c){return new Promise(function(_0x45aed3,_0x59f255){var _0x556ab3={'method':_0x4c97('0x1f'),'uri':_0x5acbe9+_0x4c97('0x41')+'?'+_0x4d442c,'body':{'short_description':_0x3f8dba,'global':!![],'active':!![],'name':_0x3f8dba},'auth':_0x5a0fca,'json':!![]};return rp(_0x556ab3)[_0x4c97('0xc')](function(_0x2ba14a){var _0x503c71=_0x2ba14a[_0x4c97('0xd')][_0x4c97('0xf')];_0x45aed3(_0x503c71);});});}function getRemoteTag(_0xa1767c,_0x79284b,_0x175f86,_0x871945,_0x18570b){return new Promise(function(_0x2c536e,_0x3116fa){var _0x58625e={'method':_0x4c97('0xa'),'uri':_0x175f86+'label'+_0x4c97('0x42')+_0xa1767c+'&'+_0x871945,'auth':_0x79284b,'json':!![]};return rp(_0x58625e)[_0x4c97('0xc')](function(_0x4d156b){if(_0x4d156b[_0x4c97('0xd')][_0x4c97('0x17')]>0x0){var _0x5bf550=_0x4d156b['result'][0x0][_0x4c97('0xf')];_0x2c536e(_0x5bf550);}else{return createRemoteTag(_0xa1767c,_0x79284b,_0x175f86,_0x871945)['then'](function(_0x2b8594){_0x2c536e(_0x2b8594);});}});});}function assignTagToIncident(_0xaf5396,_0x1a36f5,_0x40e9ed,_0x5df54c,_0xfcfb5d){return new Promise(function(_0x4051c3,_0x36a7c9){var _0x3714da={'method':_0x4c97('0x1f'),'uri':_0x40e9ed+_0x4c97('0x43')+'?'+_0xfcfb5d,'body':{'label':_0xaf5396,'table':'incident','id_type':'Incident','table_key':_0x5df54c[_0x4c97('0x3d')],'title':_0x4c97('0x44')+_0x5df54c[_0x4c97('0x3e')],'id_display':_0x5df54c[_0x4c97('0x3e')]},'auth':_0x1a36f5,'json':!![]};return rp(_0x3714da)[_0x4c97('0xc')](function(_0x54333a){_0x4051c3();})[_0x4c97('0x12')](function(){_0x4051c3();});});}function manageTags(_0x17010b,_0x542c99,_0x46518f,_0x109d7d,_0x125a91,_0x1f2483,_0x3e8450){return new Promise(function(_0x52ba33,_0x365a9b){var _0x3dd8e8=[];_0x542c99['forEach'](function(_0x3fc8b7){_0x3dd8e8[_0x4c97('0x45')](getRemoteTag(_0x3fc8b7,_0x46518f,_0x109d7d,_0x1f2483,_0x3e8450));});return Promise[_0x4c97('0x46')](_0x3dd8e8)['then'](function(_0x4a2c23){if(_0x4a2c23[_0x4c97('0x17')]){logger['info']('['+[_0x17010b[_0x4c97('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4a2c23);var _0x1ad2c6=[];_0x4a2c23[_0x4c97('0x27')](function(_0x14e278){_0x1ad2c6[_0x4c97('0x45')](assignTagToIncident(_0x14e278,_0x46518f,_0x109d7d,_0x125a91,_0x1f2483));});return Promise[_0x4c97('0x46')](_0x1ad2c6)[_0x4c97('0xc')](function(){_0x52ba33();})[_0x4c97('0x12')](function(){_0x52ba33();});}else{_0x52ba33();}});});}function getTags(_0x344212,_0x26634a,_0x364249,_0x5cd593,_0x41f390,_0x4dd0cb){return function(_0x450bd1){return new Promise(function(_0x414a2f,_0x5d8112){var _0x2cfcce=[];var _0x246c42=_0x5cd593[_0x4c97('0x47')];if(_0x246c42&&_0x246c42[_0x4c97('0x17')]>0x0){_0x2cfcce=_['map'](_0x246c42,_0x4c97('0x36'));}if(_0x2cfcce[_0x4c97('0x17')]>0x0){return manageTags(_0x344212,_0x2cfcce,_0x26634a,_0x364249,_0x450bd1,_0x41f390,_0x4dd0cb)[_0x4c97('0xc')](function(){_0x414a2f(_0x450bd1);});}else{_0x414a2f(_0x450bd1);}});};}function emit(_0x3590da,_0x42d873,_0x58438c){var _0x59288c=_0x4c97('0x48')+_0x4c97('0x49')+_0x4c97('0x4a')+_0x4c97('0x4b');var _0x2eabd3={'uri':_0x3590da+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x58438c+_0x59288c};io['to'](util[_0x4c97('0x4c')](_0x4c97('0x4d'),_0x42d873))[_0x4c97('0x4e')](_0x4c97('0x4f'),_0x2eabd3);}exports['cs']=function(_0x47d8f3,_0x224a34,_0x365dea,_0x62e57e,_0xadf49e,_0x4aa293,_0x13b8fb,_0x5a1aac){var _0x19d375={};var _0x1423f8={'user':_0x4aa293[_0x4c97('0x50')],'pass':_0x4aa293[_0x4c97('0x51')]};var _0x49a600=_0x4c97('0x52');var _0x1ac4ea=_0x4c97('0x53');_0x4aa293[_0x4c97('0x54')]=intUtil['stripTrailingSlash'](_0x4aa293[_0x4c97('0x54')]);_0x4aa293[_0x4c97('0x55')]=intUtil['stripTrailingSlash'](_0x4aa293[_0x4c97('0x55')]);var _0x66c74a=util[_0x4c97('0x4c')]('%s/api/now/table/',_0x4aa293[_0x4c97('0x54')]);_0x19d375[_0x4c97('0x15')]=!_[_0x4c97('0x56')](_0x62e57e)?_0x62e57e[_0x4c97('0x57')]:null;_0x19d375[_0x4c97('0x1a')]=_0x4aa293[_0x4c97('0x57')];_0x19d375[_0x4c97('0x20')]=_0x5a1aac['toLowerCase']()===_0x4c97('0x58')?_0x224a34[_0x4c97('0x59')]:_0x224a34[_0x4c97('0x5a')];_0x19d375[_0x4c97('0x5b')]=_0x5a1aac===_0x4c97('0x5c')||_0x5a1aac===_0x4c97('0x5d')?'queue':_0x4c97('0x58');var _0x3ead73=util['format'](_0x4c97('0x5e'),_0x4aa293[_0x4c97('0x55')],_0x224a34[_0x4c97('0x5f')],md5(_0x224a34['uniqueid']));if(_0xadf49e&&_0xadf49e[_0x4c97('0x60')]){logger[_0x4c97('0x10')](_0x4c97('0x61'),_0x4c97('0x62'));_0x224a34[_0x4c97('0x63')]=_0x3ead73;}else if(_0x13b8fb&&_0x13b8fb['recordingFormat']&&_0x13b8fb[_0x4c97('0x64')]!==_0x4c97('0x65')){logger[_0x4c97('0x10')](_0x4c97('0x66'),_0x4c97('0x62'));_0x224a34['recordingURL']=_0x3ead73;}else{_0x224a34['recordingURL']='';}return getAdminUser(_0x5a1aac,_0x1423f8,_0x19d375,_0x66c74a,_0x1ac4ea,_0x49a600)[_0x4c97('0xc')](getUser(_0x5a1aac,_0x1423f8,_0x66c74a,_0x1ac4ea,_0x49a600))[_0x4c97('0xc')](getEndUser(_0x5a1aac,_0x1423f8,_0x66c74a,_0x1ac4ea,_0x49a600))['then'](getTicket(_0x5a1aac,_0x1423f8,_0x66c74a,_0x365dea,_0x224a34,_0x1ac4ea))['then'](function(_0x343e18){logger[_0x4c97('0x10')](util[_0x4c97('0x4c')](_0x4c97('0x67'),_0x343e18['ticketId']));logger['info'](util[_0x4c97('0x4c')](_0x4c97('0x68'),_0x5a1aac));if(_0x5a1aac!==_0x4c97('0x5d')){logger[_0x4c97('0x10')]('['+[_0x5a1aac[_0x4c97('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4aa293[_0x4c97('0x54')],_0x62e57e[_0x4c97('0x36')],_0x343e18[_0x4c97('0x3d')]);}})[_0x4c97('0x12')](function(_0x441a56){logger['error']('['+[_0x5a1aac[_0x4c97('0x13')]()]+_0x4c97('0x69'),util[_0x4c97('0x6a')](_0x441a56,{'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 82a9cab..817c861 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 _0x1b20=['user:%s','toUpperCase','catch','lastevent','lodash','request-promise','bluebird','md5','ioredis','./util','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','created_by','description','Descriptions','date_start','slice','replace','parent_id','parent_name','direction','length','forEach','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','first_name','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','toLowerCase','string','custom_fields','content','variableName','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x1b20,0x7e));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x01b2('0x0'));var rp=require(_0x01b2('0x1'));var BPromise=require(_0x01b2('0x2'));var md5=require(_0x01b2('0x3'));var util=require('util');var Redis=require(_0x01b2('0x4'));var intUtil=require(_0x01b2('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x01b2('0x6'));config['redis']=_[_0x01b2('0x7')](config[_0x01b2('0x8')],{'host':_0x01b2('0x9'),'port':0x18eb});var io=require(_0x01b2('0xa'))(new Redis(config[_0x01b2('0x8')]));var def={'method':_0x01b2('0xb'),'json':!![]};function emit(_0x15527c,_0x59d043,_0x4a3691){io['to'](_0x15527c)[_0x01b2('0xc')](_0x59d043,_0x4a3691);}function getTicket(_0x14aa92,_0x5e802a,_0x5842ce,_0x386bfe,_0x371c7c,_0x485122,_0x3872bd,_0x2b684c){logger['info'](_0x01b2('0xd'));var _0x108596=new Date();var _0x1a9882=[{'name':_0x01b2('0xe'),'value':intUtil[_0x01b2('0xf')](_0x386bfe['Subjects'],_0x371c7c,'\x20')},{'name':'assigned_user_id','value':_0x5e802a['id']},{'name':_0x01b2('0x10'),'value':_0x5e802a['id']},{'name':_0x01b2('0x11'),'value':intUtil[_0x01b2('0xf')](_0x386bfe[_0x01b2('0x12')],_0x371c7c,'\x0a')},{'name':_0x01b2('0x13'),'value':_0x108596['toISOString']()[_0x01b2('0x14')](0x0,0x13)[_0x01b2('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x01b2('0x16'),'value':_0x5842ce['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x01b2('0x17'),'value':_0x5842ce[_0x01b2('0xe')]},{'name':_0x01b2('0x18'),'value':_0x2b684c}];if(_0x485122[_0x01b2('0x19')]){_[_0x01b2('0x1a')](_0x485122,function(_0x3a36b4){if(_0x371c7c[_0x3a36b4['variableName']]){_0x1a9882[_0x01b2('0x1b')]({'name':_0x3a36b4[_0x01b2('0x1c')],'value':_0x371c7c[_0x3a36b4['variableName']]});}});}return request({'form':{'method':_0x01b2('0x1d'),'input_type':'JSON','response_type':_0x01b2('0x1e'),'rest_data':JSON[_0x01b2('0x1f')]({'session':_0x3872bd['id'],'module_name':_0x01b2('0x20'),'name_value_list':_0x1a9882})}});}function getAuth(_0x15c94c){return util[_0x01b2('0x21')](_0x01b2('0x22'),new Buffer(_0x15c94c[_0x01b2('0x23')]+':X')[_0x01b2('0x24')](_0x01b2('0x25')));}function getServerInfo(_0x1c8a11){return request({'form':{'method':_0x01b2('0x26'),'input_type':_0x01b2('0x1e'),'response_type':'JSON','rest_data':JSON[_0x01b2('0x1f')]({'session':_0x1c8a11['id']})}});}function getUser(_0x2122cb,_0x117645,_0x3bf9df){if(!_[_0x01b2('0x27')](_0x117645)){logger[_0x01b2('0x28')](_0x01b2('0x29'),_0x117645);return request({'form':{'method':_0x01b2('0x2a'),'input_type':_0x01b2('0x1e'),'response_type':_0x01b2('0x1e'),'rest_data':JSON['stringify']({'session':_0x3bf9df['id'],'module_name':_0x01b2('0x2b'),'query':util[_0x01b2('0x21')](_0x01b2('0x2c'),_0x117645),'order_by':'','offset':'0','select_fields':['id','name',_0x01b2('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x20cc8a){if(_0x20cc8a['entry_list'][_0x01b2('0x19')]){var _0x2fcd55=_[_0x01b2('0x2e')](_0x20cc8a[_0x01b2('0x2f')],function(_0x2accc5){return _0x2accc5['name_value_list'][_0x01b2('0x2d')][_0x01b2('0x30')]===_0x117645;});if(_0x2fcd55){logger[_0x01b2('0x28')](_0x01b2('0x31'));return BPromise['resolve']({'id':_0x2fcd55['name_value_list']['id'][_0x01b2('0x30')],'name':_0x2fcd55[_0x01b2('0x32')][_0x01b2('0xe')][_0x01b2('0x30')]});}}logger[_0x01b2('0x28')](_0x01b2('0x33'));return BPromise[_0x01b2('0x34')]({'id':_0x3bf9df[_0x01b2('0x32')][_0x01b2('0x35')][_0x01b2('0x30')],'name':_0x3bf9df['name_value_list']['user_name'][_0x01b2('0x30')]});});}else{logger['info'](_0x01b2('0x36'));return BPromise[_0x01b2('0x34')]({'id':_0x3bf9df[_0x01b2('0x32')]['user_id']['value'],'name':_0x3bf9df[_0x01b2('0x32')][_0x01b2('0x2d')][_0x01b2('0x30')]});}}function getEndUser(_0x578968,_0xa3c2a0,_0x2b6a6e,_0x480dfb){logger[_0x01b2('0x28')](_0x01b2('0x37'),_0x2b6a6e);return request({'form':{'method':_0x01b2('0x2a'),'input_type':_0x01b2('0x1e'),'response_type':_0x01b2('0x1e'),'rest_data':JSON[_0x01b2('0x1f')]({'session':_0x480dfb['id'],'module_name':_0x01b2('0x38'),'query':util['format'](_0x01b2('0x39'),_0x2b6a6e),'order_by':'','offset':'0','select_fields':['id',_0x01b2('0xe'),_0x01b2('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x01b2('0x3b')](function(_0x599ac0){if(_0x599ac0[_0x01b2('0x2f')]['length']){var _0x2e3979=_[_0x01b2('0x2e')](_0x599ac0[_0x01b2('0x2f')],function(_0x41b9c6){return _0x41b9c6[_0x01b2('0x32')][_0x01b2('0x3a')][_0x01b2('0x30')]===_0x2b6a6e;});if(_0x2e3979){logger['info'](_0x01b2('0x3c'));return BPromise['resolve']({'id':_0x2e3979['name_value_list']['id'][_0x01b2('0x30')],'name':_0x2e3979[_0x01b2('0x32')][_0x01b2('0xe')]['value'],'phone':_0x2e3979['name_value_list'][_0x01b2('0x3a')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x01b2('0x1d'),'input_type':_0x01b2('0x1e'),'response_type':_0x01b2('0x1e'),'rest_data':JSON['stringify']({'session':_0x480dfb['id'],'module_name':_0x01b2('0x38'),'name_value_list':[{'name':_0x01b2('0x3d'),'value':_0xa3c2a0!==''?_0xa3c2a0:util[_0x01b2('0x21')]('Caller\x20-\x20%s',_0x2b6a6e)},{'name':'phone_home','value':_0x2b6a6e}]})}})['then'](function(_0x2d5d8a){logger[_0x01b2('0x28')](_0x01b2('0x3e'));return BPromise[_0x01b2('0x34')]({'id':_0x2d5d8a['id'],'name':_0x2d5d8a[_0x01b2('0x2f')][_0x01b2('0x3d')][_0x01b2('0x30')],'phone':_0x2d5d8a['entry_list'][_0x01b2('0x3a')]['value']});});}});}function request(_0x272e76){logger[_0x01b2('0x3f')](_0x01b2('0x40'),JSON[_0x01b2('0x1f')](_0x272e76));return rp(_['merge'](def,_0x272e76));}function getTags(_0x15ad09,_0x43b5f9){var _0x19e427=[];if(_0x15ad09&&_0x15ad09[_0x01b2('0x19')]>0x0){_0x19e427=_[_0x01b2('0x41')](_0x15ad09,_0x43b5f9);}return _0x19e427;}function getCustomFields(_0x2951c9,_0x2f50af){var _0x3e6082=[];var _0x4e583a={'custom_fields':[]};if(_0x2951c9[_0x01b2('0x19')]>0x0){_[_0x01b2('0x1a')](_0x2951c9,function(_0x1cf8d5){if(_0x1cf8d5[_0x01b2('0x42')]==='string'&&_0x1cf8d5[_0x01b2('0x43')]&&!_0x1cf8d5[_0x01b2('0x44')]){_0x4e583a[_0x1cf8d5['nameField'][_0x01b2('0x45')]()]=_0x1cf8d5['content'][_0x01b2('0x24')]();}else if(_0x1cf8d5[_0x01b2('0x42')]===_0x01b2('0x46')&&_0x1cf8d5['idField']&&_0x1cf8d5[_0x01b2('0x44')]){_0x4e583a[_0x01b2('0x47')][_0x01b2('0x1b')]({'id':_0x1cf8d5[_0x01b2('0x1c')],'value':_0x1cf8d5[_0x01b2('0x48')]['toString']()});}else if(_0x1cf8d5[_0x01b2('0x42')]==='variable'&&_0x1cf8d5[_0x01b2('0x49')]&&_0x1cf8d5[_0x01b2('0x1c')]&&_0x1cf8d5[_0x01b2('0x44')]){_0x2f50af[_0x1cf8d5[_0x01b2('0x49')]]&&_0x4e583a[_0x01b2('0x47')][_0x01b2('0x1b')]({'id':_0x1cf8d5[_0x01b2('0x1c')],'value':_0x2f50af[_0x1cf8d5['variableName']]['toString']()});}else if(_0x1cf8d5['type']===_0x01b2('0x4a')&&_0x1cf8d5['Variable']&&_0x1cf8d5[_0x01b2('0x4b')][_0x01b2('0xe')]&&_0x1cf8d5[_0x01b2('0x1c')]&&_0x1cf8d5[_0x01b2('0x44')]){_0x2f50af[_0x1cf8d5[_0x01b2('0x4b')][_0x01b2('0xe')][_0x01b2('0x45')]()]&&_0x4e583a[_0x01b2('0x47')][_0x01b2('0x1b')]({'id':_0x1cf8d5[_0x01b2('0x1c')],'value':_0x2f50af[_0x1cf8d5['Variable']['name'][_0x01b2('0x45')]()][_0x01b2('0x24')]()});}});}return _0x4e583a;}function getConnection(_0x51f197){return request({'method':'POST','form':{'method':_0x01b2('0x4c'),'input_type':_0x01b2('0x1e'),'response_type':_0x01b2('0x1e'),'rest_data':JSON[_0x01b2('0x1f')]({'user_auth':{'user_name':_0x51f197[_0x01b2('0x4d')],'password':_0x51f197[_0x01b2('0x4e')],'encryption':_0x01b2('0x4f')},'application':_0x01b2('0x50')})}})[_0x01b2('0x3b')](function(_0x50e6ba){var _0x51ea76=_0x50e6ba;if(_0x51ea76['id']){def[_0x01b2('0x51')]=_0x51ea76['id'];return BPromise['resolve'](_0x51ea76);}else{throw new Error(util[_0x01b2('0x21')](_0x01b2('0x52'),_0x51f197['id']));}});}function setRelationship(_0x23e20e,_0x2df45f,_0x86a8ec,_0x4728f8){return request({'form':{'method':_0x01b2('0x53'),'input_type':_0x01b2('0x1e'),'response_type':_0x01b2('0x1e'),'rest_data':JSON['stringify']({'session':_0x23e20e['id'],'module_name':_0x01b2('0x20'),'module_id':_0x86a8ec['id'],'link_field_name':_0x4728f8,'related_ids':[_0x2df45f['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x262707,_0x53750d,_0x4a0c9e,_0x3a3cc1,_0x3d3b9e,_0x1b2f33){var _0xd33fa4,_0x56b953,_0x1b876a,_0x5e335c;_0x1b2f33[_0x01b2('0x54')]=intUtil[_0x01b2('0x55')](_0x1b2f33[_0x01b2('0x54')]);_0x1b2f33['serverUrl']=intUtil[_0x01b2('0x55')](_0x1b2f33[_0x01b2('0x56')]);def[_0x01b2('0x57')]=util[_0x01b2('0x21')](_0x01b2('0x58'),_0x1b2f33[_0x01b2('0x54')]);if(_0x3d3b9e&&_0x3d3b9e[_0x01b2('0x59')]){logger[_0x01b2('0x28')](_0x01b2('0x5a'),'Recording\x20is\x20enabled!');_0x53750d[_0x01b2('0x5b')]=util[_0x01b2('0x21')](_0x01b2('0x5c'),_0x1b2f33['serverUrl'],_0x53750d[_0x01b2('0x5d')],md5(_0x53750d[_0x01b2('0x5d')]));}else{_0x53750d[_0x01b2('0x5b')]='';}return getConnection(_0x1b2f33)[_0x01b2('0x3b')](function(_0x28966d){_0x5e335c=_0x28966d;return getUser(_0x1b2f33,_0x3a3cc1[_0x01b2('0xe')],_0x5e335c);})[_0x01b2('0x3b')](function(_0x552e4a){_0xd33fa4=_0x552e4a;logger[_0x01b2('0x28')]('The\x20User\x20ID\x20is:',_0xd33fa4['id']);return getEndUser(_0x1b2f33,_0x53750d[_0x01b2('0x5e')],_0x53750d[_0x01b2('0x5f')],_0x5e335c);})[_0x01b2('0x3b')](function(_0x4a185e){_0x56b953=_0x4a185e;logger[_0x01b2('0x28')](_0x01b2('0x60'),_0x56b953['id']);return getTicket(_0x1b2f33,_0xd33fa4,_0x56b953,_0x4a0c9e,_0x53750d,_0x4a0c9e[_0x01b2('0x61')],_0x5e335c,_0x01b2('0x62'));})['then'](function(_0xa3e5b5){_0x1b876a=_0xa3e5b5;logger[_0x01b2('0x28')](_0x01b2('0x63'));logger[_0x01b2('0x28')](_0x01b2('0x64'),_0x1b876a['id']);return setRelationship(_0x5e335c,_0xd33fa4,_0x1b876a,'users');})[_0x01b2('0x3b')](function(){return setRelationship(_0x5e335c,_0x56b953,_0x1b876a,_0x01b2('0x65'));})['then'](function(){return getServerInfo(_0x5e335c);})[_0x01b2('0x3b')](function(_0x27b661){var _0x15f2fc=parseInt(_0x27b661['version'][_0x01b2('0x66')](0x0));var _0x26378f=util[_0x01b2('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1b2f33[_0x01b2('0x54')],_0x1b876a['id']);if(_0x15f2fc>0x6){_0x26378f=util[_0x01b2('0x21')](_0x01b2('0x67'),_0x1b2f33[_0x01b2('0x54')],_0x1b876a['id']);}logger[_0x01b2('0x28')](_0x01b2('0x5a'),_0x01b2('0x68'));emit(util[_0x01b2('0x21')]('user:%s',_0x3a3cc1[_0x01b2('0xe')]),_0x01b2('0x69'),{'uri':_0x26378f});})['catch'](function(_0x1276ad){logger[_0x01b2('0x6a')]('[QUEUE]',JSON[_0x01b2('0x1f')](_0x1276ad));});};exports[_0x01b2('0x6b')]=function(_0x10f796,_0x52f88c,_0x2de4ef,_0xf81956,_0x2cd3e3,_0x557809,_0x563e91){var _0x21bdaa,_0x50b0cd,_0x272218,_0x5359d5;_0x557809['remoteUri']=intUtil[_0x01b2('0x55')](_0x557809[_0x01b2('0x54')]);_0x557809[_0x01b2('0x56')]=intUtil['stripTrailingSlash'](_0x557809['serverUrl']);def[_0x01b2('0x57')]=util[_0x01b2('0x21')](_0x01b2('0x58'),_0x557809[_0x01b2('0x54')]);if(_0x563e91&&_0x563e91['recordingFormat']&&_0x563e91['recordingFormat']!==_0x01b2('0x6c')){logger['info'](_0x01b2('0x6d'),_0x01b2('0x6e'));_0x52f88c[_0x01b2('0x5b')]=util[_0x01b2('0x21')](_0x01b2('0x5c'),_0x557809[_0x01b2('0x56')],_0x52f88c[_0x01b2('0x5d')],md5(_0x52f88c['uniqueid']));}return getConnection(_0x557809)[_0x01b2('0x3b')](function(_0x32f0d2){_0x5359d5=_0x32f0d2;return getUser(_0x557809,_0xf81956[_0x01b2('0xe')],_0x5359d5);})[_0x01b2('0x3b')](function(_0x1090a8){_0x21bdaa=_0x1090a8;logger[_0x01b2('0x28')](_0x01b2('0x6f'),_0x21bdaa['id']);return getEndUser(_0x557809,_0x52f88c[_0x01b2('0x70')],_0x52f88c[_0x01b2('0x71')],_0x5359d5);})[_0x01b2('0x3b')](function(_0x11e4a1){_0x50b0cd=_0x11e4a1;logger['info'](_0x01b2('0x60'),_0x50b0cd['id']);return getTicket(_0x557809,_0x21bdaa,_0x50b0cd,_0x2de4ef,_0x52f88c,_0x2de4ef[_0x01b2('0x61')],_0x5359d5,_0x01b2('0x72'));})['then'](function(_0x1d9ad1){_0x272218=_0x1d9ad1;logger['info'](_0x01b2('0x63'));logger[_0x01b2('0x28')](_0x01b2('0x64'),_0x272218['id']);return setRelationship(_0x5359d5,_0x21bdaa,_0x272218,_0x01b2('0x73'));})[_0x01b2('0x3b')](function(){return setRelationship(_0x5359d5,_0x50b0cd,_0x272218,'contacts');})[_0x01b2('0x3b')](function(){return getServerInfo(_0x5359d5);})['then'](function(_0x5913da){var _0x3d027e=parseInt(_0x5913da[_0x01b2('0x74')]['charAt'](0x0));var _0x298d12=util['format'](_0x01b2('0x75'),_0x557809['remoteUri'],_0x272218['id']);if(_0x3d027e>0x6){_0x298d12=util['format'](_0x01b2('0x67'),_0x557809[_0x01b2('0x54')],_0x272218['id']);}logger[_0x01b2('0x28')](_0x01b2('0x6d'),_0x01b2('0x68'));emit(util['format'](_0x01b2('0x76'),_0xf81956['name']),'trigger:browser:url',{'uri':_0x298d12});})['catch'](function(_0x2cf25d){logger['error']('[OUTBOUND]',JSON['stringify'](_0x2cf25d));});};exports['unmanaged']=function(_0x1c158e,_0x40c7d9,_0x10fa28,_0x317279,_0x10f46b,_0xcefb9e){var _0xf49d1c,_0x181f9e,_0x21fbb3,_0x1d9888;_0xcefb9e[_0x01b2('0x54')]=intUtil[_0x01b2('0x55')](_0xcefb9e['remoteUri']);_0xcefb9e[_0x01b2('0x56')]=intUtil[_0x01b2('0x55')](_0xcefb9e[_0x01b2('0x56')]);def[_0x01b2('0x57')]=util['format'](_0x01b2('0x58'),_0xcefb9e[_0x01b2('0x54')]);if(_0x10f46b&&_0x10f46b[_0x01b2('0x59')]){logger[_0x01b2('0x28')]('['+_0x40c7d9['lastevent'][_0x01b2('0x77')]()+']',_0x01b2('0x6e'));_0x40c7d9['recordingURL']=util[_0x01b2('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xcefb9e[_0x01b2('0x56')],_0x40c7d9[_0x01b2('0x5d')],md5(_0x40c7d9[_0x01b2('0x5d')]));}else{_0x40c7d9[_0x01b2('0x5b')]='';}return getConnection(_0xcefb9e)[_0x01b2('0x3b')](function(_0x4c661f){_0x1d9888=_0x4c661f;if(!_[_0x01b2('0x27')](_0x317279)){return getUser(_0xcefb9e,_0x317279[_0x01b2('0xe')],_0x1d9888);}else{return getUser(_0xcefb9e,null,_0x1d9888);}})['then'](function(_0xe6778a){_0xf49d1c=_0xe6778a;logger[_0x01b2('0x28')](_0x01b2('0x6f'),_0xf49d1c['id']);return getEndUser(_0xcefb9e,_0x40c7d9[_0x01b2('0x5e')],_0x40c7d9['calleridnum'],_0x1d9888);})[_0x01b2('0x3b')](function(_0x2aa643){_0x181f9e=_0x2aa643;logger[_0x01b2('0x28')]('The\x20Enduser\x20ID\x20is:',_0x181f9e['id']);return getTicket(_0xcefb9e,_0xf49d1c,_0x181f9e,_0x10fa28,_0x40c7d9,_0x10fa28['Fields'],_0x1d9888,'Inbound');})[_0x01b2('0x3b')](function(_0x522532){_0x21fbb3=_0x522532;logger[_0x01b2('0x28')](_0x01b2('0x63'));logger['info'](_0x01b2('0x64'),_0x21fbb3['id']);return setRelationship(_0x1d9888,_0xf49d1c,_0x21fbb3,_0x01b2('0x73'));})[_0x01b2('0x3b')](function(){return setRelationship(_0x1d9888,_0x181f9e,_0x21fbb3,_0x01b2('0x65'));})[_0x01b2('0x3b')](function(){return getServerInfo(_0x1d9888);})[_0x01b2('0x78')](function(_0x1d46fa){logger[_0x01b2('0x6a')]('['+_0x40c7d9[_0x01b2('0x79')][_0x01b2('0x77')]()+']',JSON[_0x01b2('0x1f')](_0x1d46fa));});}; \ No newline at end of file +var _0xe4eb=['serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','POST','emit','info','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_type','Contacts','parent_name','name','length','forEach','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','push','idField','content','variable','variableName','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash'];(function(_0x1992f8,_0x53d817){var _0x289ee4=function(_0x59e6e2){while(--_0x59e6e2){_0x1992f8['push'](_0x1992f8['shift']());}};_0x289ee4(++_0x53d817);}(_0xe4eb,0x18d));var _0xbe4e=function(_0x4f3d36,_0x209004){_0x4f3d36=_0x4f3d36-0x0;var _0x57cd8b=_0xe4eb[_0x4f3d36];return _0x57cd8b;};'use strict';var _=require(_0xbe4e('0x0'));var rp=require(_0xbe4e('0x1'));var BPromise=require('bluebird');var md5=require(_0xbe4e('0x2'));var util=require(_0xbe4e('0x3'));var Redis=require(_0xbe4e('0x4'));var intUtil=require(_0xbe4e('0x5'));var config=require('../../../../config/environment');var logger=require(_0xbe4e('0x6'))(_0xbe4e('0x7'));config[_0xbe4e('0x8')]=_[_0xbe4e('0x9')](config[_0xbe4e('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbe4e('0x8')]));var def={'method':_0xbe4e('0xa'),'json':!![]};function emit(_0x5a0127,_0x533750,_0x50453a){io['to'](_0x5a0127)[_0xbe4e('0xb')](_0x533750,_0x50453a);}function getTicket(_0x57e71b,_0x533624,_0x25bcf4,_0x379e1e,_0x3915a2,_0x51ec6e,_0x79fc75,_0x474d98){logger[_0xbe4e('0xc')]('Creating\x20new\x20ticket...');var _0x5ec6cb=new Date();var _0x366599=[{'name':'name','value':intUtil[_0xbe4e('0xd')](_0x379e1e[_0xbe4e('0xe')],_0x3915a2,'\x20')},{'name':'assigned_user_id','value':_0x533624['id']},{'name':_0xbe4e('0xf'),'value':_0x533624['id']},{'name':_0xbe4e('0x10'),'value':intUtil[_0xbe4e('0xd')](_0x379e1e[_0xbe4e('0x11')],_0x3915a2,'\x0a')},{'name':_0xbe4e('0x12'),'value':_0x5ec6cb[_0xbe4e('0x13')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xbe4e('0x14'),'value':'0'},{'name':_0xbe4e('0x15'),'value':'15'},{'name':'parent_id','value':_0x25bcf4['id']},{'name':_0xbe4e('0x16'),'value':_0xbe4e('0x17')},{'name':_0xbe4e('0x18'),'value':_0x25bcf4[_0xbe4e('0x19')]},{'name':'direction','value':_0x474d98}];if(_0x51ec6e[_0xbe4e('0x1a')]){_[_0xbe4e('0x1b')](_0x51ec6e,function(_0x229679){if(_0x3915a2[_0x229679['variableName']]){_0x366599['push']({'name':_0x229679['idField'],'value':_0x3915a2[_0x229679['variableName']]});}});}return request({'form':{'method':_0xbe4e('0x1c'),'input_type':_0xbe4e('0x1d'),'response_type':_0xbe4e('0x1d'),'rest_data':JSON[_0xbe4e('0x1e')]({'session':_0x79fc75['id'],'module_name':_0xbe4e('0x1f'),'name_value_list':_0x366599})}});}function getAuth(_0x59ff76){return util['format'](_0xbe4e('0x20'),new Buffer(_0x59ff76[_0xbe4e('0x21')]+':X')[_0xbe4e('0x22')](_0xbe4e('0x23')));}function getServerInfo(_0x18e18b){return request({'form':{'method':_0xbe4e('0x24'),'input_type':_0xbe4e('0x1d'),'response_type':_0xbe4e('0x1d'),'rest_data':JSON['stringify']({'session':_0x18e18b['id']})}});}function getUser(_0xa90215,_0x1b7e32,_0x12d92a){if(!_[_0xbe4e('0x25')](_0x1b7e32)){logger[_0xbe4e('0xc')](_0xbe4e('0x26'),_0x1b7e32);return request({'form':{'method':_0xbe4e('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xbe4e('0x1e')]({'session':_0x12d92a['id'],'module_name':_0xbe4e('0x28'),'query':util[_0xbe4e('0x29')](_0xbe4e('0x2a'),_0x1b7e32),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3fd878){if(_0x3fd878[_0xbe4e('0x2b')][_0xbe4e('0x1a')]){var _0x375c75=_['find'](_0x3fd878[_0xbe4e('0x2b')],function(_0x4270c2){return _0x4270c2[_0xbe4e('0x2c')][_0xbe4e('0x2d')][_0xbe4e('0x2e')]===_0x1b7e32;});if(_0x375c75){logger[_0xbe4e('0xc')](_0xbe4e('0x2f'));return BPromise[_0xbe4e('0x30')]({'id':_0x375c75[_0xbe4e('0x2c')]['id']['value'],'name':_0x375c75[_0xbe4e('0x2c')][_0xbe4e('0x19')][_0xbe4e('0x2e')]});}}logger[_0xbe4e('0xc')](_0xbe4e('0x31'));return BPromise[_0xbe4e('0x30')]({'id':_0x12d92a[_0xbe4e('0x2c')][_0xbe4e('0x32')][_0xbe4e('0x2e')],'name':_0x12d92a['name_value_list'][_0xbe4e('0x2d')][_0xbe4e('0x2e')]});});}else{logger[_0xbe4e('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbe4e('0x30')]({'id':_0x12d92a[_0xbe4e('0x2c')][_0xbe4e('0x32')]['value'],'name':_0x12d92a[_0xbe4e('0x2c')][_0xbe4e('0x2d')][_0xbe4e('0x2e')]});}}function getEndUser(_0x2a093e,_0x4760df,_0xf490fc,_0x4c9e33){logger[_0xbe4e('0xc')](_0xbe4e('0x33'),_0xf490fc);return request({'form':{'method':_0xbe4e('0x27'),'input_type':_0xbe4e('0x1d'),'response_type':_0xbe4e('0x1d'),'rest_data':JSON[_0xbe4e('0x1e')]({'session':_0x4c9e33['id'],'module_name':'Contacts','query':util[_0xbe4e('0x29')](_0xbe4e('0x34'),_0xf490fc),'order_by':'','offset':'0','select_fields':['id',_0xbe4e('0x19'),_0xbe4e('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbe4e('0x36')](function(_0x512239){if(_0x512239[_0xbe4e('0x2b')][_0xbe4e('0x1a')]){var _0xcdae3=_[_0xbe4e('0x37')](_0x512239[_0xbe4e('0x2b')],function(_0x40ec4d){return _0x40ec4d[_0xbe4e('0x2c')]['phone_home'][_0xbe4e('0x2e')]===_0xf490fc;});if(_0xcdae3){logger[_0xbe4e('0xc')](_0xbe4e('0x38'));return BPromise[_0xbe4e('0x30')]({'id':_0xcdae3['name_value_list']['id']['value'],'name':_0xcdae3['name_value_list'][_0xbe4e('0x19')]['value'],'phone':_0xcdae3[_0xbe4e('0x2c')][_0xbe4e('0x35')][_0xbe4e('0x2e')]});}}else{logger[_0xbe4e('0xc')](_0xbe4e('0x39'));return request({'form':{'method':_0xbe4e('0x1c'),'input_type':_0xbe4e('0x1d'),'response_type':_0xbe4e('0x1d'),'rest_data':JSON['stringify']({'session':_0x4c9e33['id'],'module_name':'Contacts','name_value_list':[{'name':_0xbe4e('0x3a'),'value':_0x4760df!==''?_0x4760df:util[_0xbe4e('0x29')](_0xbe4e('0x3b'),_0xf490fc)},{'name':_0xbe4e('0x35'),'value':_0xf490fc}]})}})['then'](function(_0x285582){logger['info'](_0xbe4e('0x3c'));return BPromise[_0xbe4e('0x30')]({'id':_0x285582['id'],'name':_0x285582[_0xbe4e('0x2b')][_0xbe4e('0x3a')][_0xbe4e('0x2e')],'phone':_0x285582[_0xbe4e('0x2b')]['phone_home'][_0xbe4e('0x2e')]});});}});}function request(_0x594438){logger[_0xbe4e('0x3d')](_0xbe4e('0x3e'),JSON[_0xbe4e('0x1e')](_0x594438));return rp(_[_0xbe4e('0x3f')](def,_0x594438));}function getTags(_0x102df8,_0x17312c){var _0x877f13=[];if(_0x102df8&&_0x102df8[_0xbe4e('0x1a')]>0x0){_0x877f13=_[_0xbe4e('0x40')](_0x102df8,_0x17312c);}return _0x877f13;}function getCustomFields(_0x5a9942,_0x18de53){var _0x55db7f=[];var _0x3c7277={'custom_fields':[]};if(_0x5a9942['length']>0x0){_[_0xbe4e('0x1b')](_0x5a9942,function(_0x369b47){if(_0x369b47[_0xbe4e('0x41')]===_0xbe4e('0x42')&&_0x369b47[_0xbe4e('0x43')]&&!_0x369b47[_0xbe4e('0x44')]){_0x3c7277[_0x369b47[_0xbe4e('0x43')][_0xbe4e('0x45')]()]=_0x369b47['content'][_0xbe4e('0x22')]();}else if(_0x369b47[_0xbe4e('0x41')]==='string'&&_0x369b47['idField']&&_0x369b47['customField']){_0x3c7277[_0xbe4e('0x46')][_0xbe4e('0x47')]({'id':_0x369b47[_0xbe4e('0x48')],'value':_0x369b47[_0xbe4e('0x49')][_0xbe4e('0x22')]()});}else if(_0x369b47[_0xbe4e('0x41')]===_0xbe4e('0x4a')&&_0x369b47['variableName']&&_0x369b47[_0xbe4e('0x48')]&&_0x369b47[_0xbe4e('0x44')]){_0x18de53[_0x369b47[_0xbe4e('0x4b')]]&&_0x3c7277[_0xbe4e('0x46')]['push']({'id':_0x369b47['idField'],'value':_0x18de53[_0x369b47['variableName']][_0xbe4e('0x22')]()});}else if(_0x369b47['type']==='customVariable'&&_0x369b47[_0xbe4e('0x4c')]&&_0x369b47['Variable'][_0xbe4e('0x19')]&&_0x369b47[_0xbe4e('0x48')]&&_0x369b47['customField']){_0x18de53[_0x369b47['Variable'][_0xbe4e('0x19')][_0xbe4e('0x45')]()]&&_0x3c7277[_0xbe4e('0x46')][_0xbe4e('0x47')]({'id':_0x369b47[_0xbe4e('0x48')],'value':_0x18de53[_0x369b47['Variable'][_0xbe4e('0x19')][_0xbe4e('0x45')]()][_0xbe4e('0x22')]()});}});}return _0x3c7277;}function getConnection(_0x493349){return request({'method':'POST','form':{'method':_0xbe4e('0x4d'),'input_type':_0xbe4e('0x1d'),'response_type':'JSON','rest_data':JSON[_0xbe4e('0x1e')]({'user_auth':{'user_name':_0x493349[_0xbe4e('0x4e')],'password':_0x493349[_0xbe4e('0x4f')],'encryption':'PLAIN'},'application':_0xbe4e('0x50')})}})[_0xbe4e('0x36')](function(_0x1925d7){var _0x80e984=_0x1925d7;if(_0x80e984['id']){def[_0xbe4e('0x51')]=_0x80e984['id'];return BPromise['resolve'](_0x80e984);}else{throw new Error(util[_0xbe4e('0x29')](_0xbe4e('0x52'),_0x493349['id']));}});}function setRelationship(_0xdf53e4,_0x1e27d9,_0x523846,_0x33e175){return request({'form':{'method':_0xbe4e('0x53'),'input_type':_0xbe4e('0x1d'),'response_type':_0xbe4e('0x1d'),'rest_data':JSON['stringify']({'session':_0xdf53e4['id'],'module_name':_0xbe4e('0x1f'),'module_id':_0x523846['id'],'link_field_name':_0x33e175,'related_ids':[_0x1e27d9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbe4e('0x54')]=function(_0x2d9685,_0x49d1ff,_0x5ed3e2,_0x219867,_0x2787b4,_0x15032f){var _0x42e783,_0x427cbc,_0x4fd608,_0x31288a;_0x15032f[_0xbe4e('0x55')]=intUtil[_0xbe4e('0x56')](_0x15032f[_0xbe4e('0x55')]);_0x15032f[_0xbe4e('0x57')]=intUtil[_0xbe4e('0x56')](_0x15032f[_0xbe4e('0x57')]);def[_0xbe4e('0x58')]=util['format'](_0xbe4e('0x59'),_0x15032f[_0xbe4e('0x55')]);if(_0x2787b4&&_0x2787b4['monitor_format']){logger[_0xbe4e('0xc')](_0xbe4e('0x5a'),_0xbe4e('0x5b'));_0x49d1ff[_0xbe4e('0x5c')]=util[_0xbe4e('0x29')](_0xbe4e('0x5d'),_0x15032f[_0xbe4e('0x57')],_0x49d1ff[_0xbe4e('0x5e')],md5(_0x49d1ff[_0xbe4e('0x5e')]));}else{_0x49d1ff[_0xbe4e('0x5c')]='';}return getConnection(_0x15032f)['then'](function(_0x5e0b3e){_0x31288a=_0x5e0b3e;return getUser(_0x15032f,_0x219867['name'],_0x31288a);})[_0xbe4e('0x36')](function(_0x1c1ecd){_0x42e783=_0x1c1ecd;logger['info']('The\x20User\x20ID\x20is:',_0x42e783['id']);return getEndUser(_0x15032f,_0x49d1ff[_0xbe4e('0x5f')],_0x49d1ff[_0xbe4e('0x60')],_0x31288a);})[_0xbe4e('0x36')](function(_0x189308){_0x427cbc=_0x189308;logger['info'](_0xbe4e('0x61'),_0x427cbc['id']);return getTicket(_0x15032f,_0x42e783,_0x427cbc,_0x5ed3e2,_0x49d1ff,_0x5ed3e2[_0xbe4e('0x62')],_0x31288a,'Inbound');})[_0xbe4e('0x36')](function(_0x2eaaf6){_0x4fd608=_0x2eaaf6;logger[_0xbe4e('0xc')](_0xbe4e('0x63'));logger[_0xbe4e('0xc')](_0xbe4e('0x64'),_0x4fd608['id']);return setRelationship(_0x31288a,_0x42e783,_0x4fd608,_0xbe4e('0x65'));})[_0xbe4e('0x36')](function(){return setRelationship(_0x31288a,_0x427cbc,_0x4fd608,'contacts');})[_0xbe4e('0x36')](function(){return getServerInfo(_0x31288a);})[_0xbe4e('0x36')](function(_0x3b347b){var _0x1a54c3=parseInt(_0x3b347b[_0xbe4e('0x66')][_0xbe4e('0x67')](0x0));var _0xb762a3=util['format'](_0xbe4e('0x68'),_0x15032f['remoteUri'],_0x4fd608['id']);if(_0x1a54c3>0x6){_0xb762a3=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x15032f[_0xbe4e('0x55')],_0x4fd608['id']);}logger[_0xbe4e('0xc')](_0xbe4e('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbe4e('0x29')]('user:%s',_0x219867[_0xbe4e('0x19')]),_0xbe4e('0x69'),{'uri':_0xb762a3});})[_0xbe4e('0x6a')](function(_0x51b2e1){logger[_0xbe4e('0x6b')]('[QUEUE]',JSON[_0xbe4e('0x1e')](_0x51b2e1));});};exports[_0xbe4e('0x6c')]=function(_0x25fabd,_0xe084e2,_0x3a6ee5,_0x328bad,_0x49617c,_0x166316,_0x2eed4b){var _0x59da4b,_0x26d2ba,_0x4ed261,_0x4fc74a;_0x166316[_0xbe4e('0x55')]=intUtil[_0xbe4e('0x56')](_0x166316[_0xbe4e('0x55')]);_0x166316[_0xbe4e('0x57')]=intUtil[_0xbe4e('0x56')](_0x166316[_0xbe4e('0x57')]);def[_0xbe4e('0x58')]=util[_0xbe4e('0x29')](_0xbe4e('0x59'),_0x166316['remoteUri']);if(_0x2eed4b&&_0x2eed4b[_0xbe4e('0x6d')]&&_0x2eed4b[_0xbe4e('0x6d')]!==_0xbe4e('0x6e')){logger[_0xbe4e('0xc')](_0xbe4e('0x6f'),_0xbe4e('0x5b'));_0xe084e2['recordingURL']=util[_0xbe4e('0x29')](_0xbe4e('0x5d'),_0x166316[_0xbe4e('0x57')],_0xe084e2[_0xbe4e('0x5e')],md5(_0xe084e2[_0xbe4e('0x5e')]));}return getConnection(_0x166316)[_0xbe4e('0x36')](function(_0x22595d){_0x4fc74a=_0x22595d;return getUser(_0x166316,_0x328bad[_0xbe4e('0x19')],_0x4fc74a);})[_0xbe4e('0x36')](function(_0x7ab49e){_0x59da4b=_0x7ab49e;logger['info']('The\x20User\x20ID\x20is:',_0x59da4b['id']);return getEndUser(_0x166316,_0xe084e2[_0xbe4e('0x70')],_0xe084e2[_0xbe4e('0x71')],_0x4fc74a);})[_0xbe4e('0x36')](function(_0x186dec){_0x26d2ba=_0x186dec;logger['info'](_0xbe4e('0x61'),_0x26d2ba['id']);return getTicket(_0x166316,_0x59da4b,_0x26d2ba,_0x3a6ee5,_0xe084e2,_0x3a6ee5[_0xbe4e('0x62')],_0x4fc74a,_0xbe4e('0x72'));})[_0xbe4e('0x36')](function(_0x458b4e){_0x4ed261=_0x458b4e;logger[_0xbe4e('0xc')](_0xbe4e('0x63'));logger[_0xbe4e('0xc')](_0xbe4e('0x64'),_0x4ed261['id']);return setRelationship(_0x4fc74a,_0x59da4b,_0x4ed261,'users');})[_0xbe4e('0x36')](function(){return setRelationship(_0x4fc74a,_0x26d2ba,_0x4ed261,_0xbe4e('0x73'));})['then'](function(){return getServerInfo(_0x4fc74a);})['then'](function(_0x52ba59){var _0x1928f0=parseInt(_0x52ba59[_0xbe4e('0x66')][_0xbe4e('0x67')](0x0));var _0xd3b5ce=util[_0xbe4e('0x29')](_0xbe4e('0x68'),_0x166316[_0xbe4e('0x55')],_0x4ed261['id']);if(_0x1928f0>0x6){_0xd3b5ce=util[_0xbe4e('0x29')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x166316[_0xbe4e('0x55')],_0x4ed261['id']);}logger[_0xbe4e('0xc')](_0xbe4e('0x6f'),_0xbe4e('0x74'));emit(util[_0xbe4e('0x29')]('user:%s',_0x328bad['name']),_0xbe4e('0x69'),{'uri':_0xd3b5ce});})[_0xbe4e('0x6a')](function(_0x4baa84){logger[_0xbe4e('0x6b')](_0xbe4e('0x6f'),JSON['stringify'](_0x4baa84));});};exports[_0xbe4e('0x75')]=function(_0x202db8,_0x41f165,_0x2d41a0,_0x57240d,_0x5890b3,_0xd19241){var _0x3c803e,_0x44b25b,_0x47cacc,_0x5a6cc1;_0xd19241[_0xbe4e('0x55')]=intUtil[_0xbe4e('0x56')](_0xd19241[_0xbe4e('0x55')]);_0xd19241[_0xbe4e('0x57')]=intUtil[_0xbe4e('0x56')](_0xd19241[_0xbe4e('0x57')]);def[_0xbe4e('0x58')]=util[_0xbe4e('0x29')]('%s/service/v4_1/rest.php',_0xd19241['remoteUri']);if(_0x5890b3&&_0x5890b3[_0xbe4e('0x76')]){logger[_0xbe4e('0xc')]('['+_0x41f165[_0xbe4e('0x77')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x41f165['recordingURL']=util[_0xbe4e('0x29')](_0xbe4e('0x5d'),_0xd19241[_0xbe4e('0x57')],_0x41f165[_0xbe4e('0x5e')],md5(_0x41f165[_0xbe4e('0x5e')]));}else{_0x41f165[_0xbe4e('0x5c')]='';}return getConnection(_0xd19241)[_0xbe4e('0x36')](function(_0x11faec){_0x5a6cc1=_0x11faec;if(!_[_0xbe4e('0x25')](_0x57240d)){return getUser(_0xd19241,_0x57240d[_0xbe4e('0x19')],_0x5a6cc1);}else{return getUser(_0xd19241,null,_0x5a6cc1);}})[_0xbe4e('0x36')](function(_0x155421){_0x3c803e=_0x155421;logger['info']('The\x20User\x20ID\x20is:',_0x3c803e['id']);return getEndUser(_0xd19241,_0x41f165[_0xbe4e('0x5f')],_0x41f165['calleridnum'],_0x5a6cc1);})[_0xbe4e('0x36')](function(_0x4ef7f0){_0x44b25b=_0x4ef7f0;logger[_0xbe4e('0xc')]('The\x20Enduser\x20ID\x20is:',_0x44b25b['id']);return getTicket(_0xd19241,_0x3c803e,_0x44b25b,_0x2d41a0,_0x41f165,_0x2d41a0[_0xbe4e('0x62')],_0x5a6cc1,'Inbound');})[_0xbe4e('0x36')](function(_0x3cde83){_0x47cacc=_0x3cde83;logger[_0xbe4e('0xc')](_0xbe4e('0x63'));logger['info'](_0xbe4e('0x64'),_0x47cacc['id']);return setRelationship(_0x5a6cc1,_0x3c803e,_0x47cacc,_0xbe4e('0x65'));})['then'](function(){return setRelationship(_0x5a6cc1,_0x44b25b,_0x47cacc,_0xbe4e('0x73'));})[_0xbe4e('0x36')](function(){return getServerInfo(_0x5a6cc1);})[_0xbe4e('0x6a')](function(_0x46a66e){logger[_0xbe4e('0x6b')]('['+_0x41f165['lastevent'][_0xbe4e('0x78')]()+']',JSON[_0xbe4e('0x1e')](_0x46a66e));});}; \ 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 3ccb9a7..5342f88 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 _0xd7e4=['%s:\x20%s','keyContent','customVariable','format','substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key'];(function(_0x6b263b,_0x56299e){var _0x226fee=function(_0x314723){while(--_0x314723){_0x6b263b['push'](_0x6b263b['shift']());}};_0x226fee(++_0x56299e);}(_0xd7e4,0x1ca));var _0x4d7e=function(_0x36fc1c,_0x3e02de){_0x36fc1c=_0x36fc1c-0x0;var _0x3348de=_0xd7e4[_0x36fc1c];return _0x3348de;};'use strict';var _=require(_0x4d7e('0x0'));var util=require(_0x4d7e('0x1'));exports[_0x4d7e('0x2')]=function(_0x29cbaa,_0x1758e4,_0x19800c){var _0x1f8d92=[];if(_0x29cbaa[_0x4d7e('0x3')]>0x0){var _0x2efa88=_[_0x4d7e('0x4')](_0x29cbaa,['id']);for(var _0x3921cf=0x0;_0x3921cf<_0x2efa88[_0x4d7e('0x3')];_0x3921cf++){var _0x449a73=_0x2efa88[_0x3921cf];if(_0x449a73[_0x4d7e('0x5')]===_0x4d7e('0x6')){_0x1f8d92[_0x4d7e('0x7')](_0x449a73['content']);}else if(_0x449a73[_0x4d7e('0x5')]===_0x4d7e('0x8')&&_0x449a73[_0x4d7e('0x9')]){_0x1758e4[_0x449a73[_0x4d7e('0x9')]]&&_0x1f8d92['push'](_0x1758e4[_0x449a73[_0x4d7e('0x9')]][_0x4d7e('0xa')]());}else if(_0x449a73[_0x4d7e('0x5')]==='customVariable'&&_0x449a73[_0x4d7e('0xb')]&&_0x449a73[_0x4d7e('0xb')][_0x4d7e('0xc')]){_0x1758e4[_0x449a73[_0x4d7e('0xb')][_0x4d7e('0xc')][_0x4d7e('0xd')]()]&&_0x1f8d92[_0x4d7e('0x7')](_0x1758e4[_0x449a73[_0x4d7e('0xb')][_0x4d7e('0xc')][_0x4d7e('0xd')]()][_0x4d7e('0xa')]());}else if(_0x449a73['type']===_0x4d7e('0xe')){if(_0x449a73[_0x4d7e('0xf')]===_0x4d7e('0x6')&&_0x449a73[_0x4d7e('0x10')]){_0x1f8d92[_0x4d7e('0x7')](util['format'](_0x4d7e('0x11'),_0x449a73[_0x4d7e('0x10')],_0x449a73[_0x4d7e('0x12')]));}else if(_0x449a73[_0x4d7e('0xf')]===_0x4d7e('0x8')&&_0x449a73[_0x4d7e('0x9')]&&_0x449a73['key']){_0x1758e4[_0x449a73[_0x4d7e('0x9')]]&&_0x1f8d92[_0x4d7e('0x7')](util['format'](_0x4d7e('0x11'),_0x449a73['key'],_0x1758e4[_0x449a73[_0x4d7e('0x9')]]));}else if(_0x449a73[_0x4d7e('0xf')]===_0x4d7e('0x13')&&_0x449a73[_0x4d7e('0xb')]&&_0x449a73[_0x4d7e('0xb')][_0x4d7e('0xc')]&&_0x449a73['key']){_0x1758e4[_0x449a73[_0x4d7e('0xb')][_0x4d7e('0xc')][_0x4d7e('0xd')]()]&&_0x1f8d92[_0x4d7e('0x7')](util[_0x4d7e('0x14')](_0x4d7e('0x11'),_0x449a73['key'],_0x1758e4[_0x449a73[_0x4d7e('0xb')][_0x4d7e('0xc')][_0x4d7e('0xd')]()]));}}}}return _0x1f8d92['join'](_0x19800c);};exports['stripTrailingSlash']=function(_0x358af1){var _0x389187=_0x358af1['slice'](-0x1);if(_0x389187==='/'){_0x358af1=_0x358af1[_0x4d7e('0x15')](0x0,_0x358af1[_0x4d7e('0x16')](_0x389187));}return _0x358af1;};exports['validateEmail']=function(_0x1a9899){if(!_[_0x4d7e('0x17')](_0x1a9899)&&_0x1a9899!==''){var _0x17c3b7=/^(([^<>()\[\]\\.,;:\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 _0x17c3b7[_0x4d7e('0x18')](String(_0x1a9899)[_0x4d7e('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x3ca3=['variable','variableName','push','toString','customVariable','Variable','name','keyValue','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','sortBy','length','type','string'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x3ca3,0x1c6));var _0x33ca=function(_0x1dd12f,_0x2b03cf){_0x1dd12f=_0x1dd12f-0x0;var _0x11480c=_0x3ca3[_0x1dd12f];return _0x11480c;};'use strict';var _=require(_0x33ca('0x0'));var util=require('util');exports['getString']=function(_0x1338dc,_0x5f3e90,_0x3956a8){var _0x20cef2=[];if(_0x1338dc['length']>0x0){var _0x4c75a8=_[_0x33ca('0x1')](_0x1338dc,['id']);for(var _0x1c6ab3=0x0;_0x1c6ab3<_0x4c75a8[_0x33ca('0x2')];_0x1c6ab3++){var _0x22c202=_0x4c75a8[_0x1c6ab3];if(_0x22c202[_0x33ca('0x3')]===_0x33ca('0x4')){_0x20cef2['push'](_0x22c202['content']);}else if(_0x22c202[_0x33ca('0x3')]===_0x33ca('0x5')&&_0x22c202[_0x33ca('0x6')]){_0x5f3e90[_0x22c202[_0x33ca('0x6')]]&&_0x20cef2[_0x33ca('0x7')](_0x5f3e90[_0x22c202[_0x33ca('0x6')]][_0x33ca('0x8')]());}else if(_0x22c202[_0x33ca('0x3')]===_0x33ca('0x9')&&_0x22c202['Variable']&&_0x22c202[_0x33ca('0xa')][_0x33ca('0xb')]){_0x5f3e90[_0x22c202[_0x33ca('0xa')][_0x33ca('0xb')]['toLowerCase']()]&&_0x20cef2[_0x33ca('0x7')](_0x5f3e90[_0x22c202[_0x33ca('0xa')]['name']['toLowerCase']()][_0x33ca('0x8')]());}else if(_0x22c202[_0x33ca('0x3')]===_0x33ca('0xc')){if(_0x22c202[_0x33ca('0xd')]===_0x33ca('0x4')&&_0x22c202[_0x33ca('0xe')]){_0x20cef2[_0x33ca('0x7')](util[_0x33ca('0xf')](_0x33ca('0x10'),_0x22c202[_0x33ca('0xe')],_0x22c202[_0x33ca('0x11')]));}else if(_0x22c202[_0x33ca('0xd')]===_0x33ca('0x5')&&_0x22c202[_0x33ca('0x6')]&&_0x22c202[_0x33ca('0xe')]){_0x5f3e90[_0x22c202['variableName']]&&_0x20cef2[_0x33ca('0x7')](util['format'](_0x33ca('0x10'),_0x22c202[_0x33ca('0xe')],_0x5f3e90[_0x22c202['variableName']]));}else if(_0x22c202[_0x33ca('0xd')]==='customVariable'&&_0x22c202['Variable']&&_0x22c202[_0x33ca('0xa')][_0x33ca('0xb')]&&_0x22c202[_0x33ca('0xe')]){_0x5f3e90[_0x22c202[_0x33ca('0xa')][_0x33ca('0xb')][_0x33ca('0x12')]()]&&_0x20cef2['push'](util['format'](_0x33ca('0x10'),_0x22c202[_0x33ca('0xe')],_0x5f3e90[_0x22c202[_0x33ca('0xa')][_0x33ca('0xb')][_0x33ca('0x12')]()]));}}}}return _0x20cef2[_0x33ca('0x13')](_0x3956a8);};exports[_0x33ca('0x14')]=function(_0x197e0a){var _0x3679dd=_0x197e0a[_0x33ca('0x15')](-0x1);if(_0x3679dd==='/'){_0x197e0a=_0x197e0a[_0x33ca('0x16')](0x0,_0x197e0a[_0x33ca('0x17')](_0x3679dd));}return _0x197e0a;};exports[_0x33ca('0x18')]=function(_0x3ba241){if(!_[_0x33ca('0x19')](_0x3ba241)&&_0x3ba241!==''){var _0x16ac37=/^(([^<>()\[\]\\.,;:\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 _0x16ac37[_0x33ca('0x1a')](String(_0x3ba241)[_0x33ca('0x12')]());}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 9d3a4f9..18b9929 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x100600,_0x17f2b6){var _0x1fb06a=function(_0x4fa201){while(--_0x4fa201){_0x100600['push'](_0x100600['shift']());}};_0x1fb06a(++_0x17f2b6);}(_0x34e8,0x12c));var _0x834e=function(_0x130543,_0x6f56aa){_0x130543=_0x130543-0x0;var _0x280d4b=_0x34e8[_0x130543];return _0x280d4b;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x29fa6f,_0x5310a4){var _0x302fa9=function(_0x46c7fc){while(--_0x46c7fc){_0x29fa6f['push'](_0x29fa6f['shift']());}};_0x302fa9(++_0x5310a4);}(_0xe706,0xa3));var _0x6e70=function(_0x2856c6,_0x745fd1){_0x2856c6=_0x2856c6-0x0;var _0x5f23a1=_0xe706[_0x2856c6];return _0x5f23a1;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index bcb6507..91bffb1 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 _0x529e=['unmanaged','monitor_format','lastevent','calleridnum','toUpperCase','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','%s/search.json','filter','results','end-user','length','first','Enduser\x20found!','POST','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','string','picklist','type','customField','toLowerCase','content','includes','idField','custom_fields','variable','variableName','push','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','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','recordingFormat','none','[OUTBOUND]','email','destcalleridname','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x238f74,_0x15d77f){var _0x31322f=function(_0x1e0860){while(--_0x1e0860){_0x238f74['push'](_0x238f74['shift']());}};_0x31322f(++_0x15d77f);}(_0x529e,0x73));var _0xe529=function(_0x2aaad9,_0x395af7){_0x2aaad9=_0x2aaad9-0x0;var _0x1fe304=_0x529e[_0x2aaad9];return _0x1fe304;};'use strict';var _=require(_0xe529('0x0'));var rp=require(_0xe529('0x1'));var md5=require('md5');var util=require(_0xe529('0x2'));var Redis=require('ioredis');var intUtil=require(_0xe529('0x3'));var config=require(_0xe529('0x4'));var logger=require(_0xe529('0x5'))(_0xe529('0x6'));config['redis']=_[_0xe529('0x7')](config[_0xe529('0x8')],{'host':_0xe529('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3be3f7,_0x4372a8,_0x47a37c){io['to'](_0x3be3f7)[_0xe529('0xa')](_0x4372a8,_0x47a37c);}var headers={'Content-Type':_0xe529('0xb'),'Accept':'application/json'};function getTicket(_0x2570d6,_0x215490,_0x31d1c3,_0x5c872b,_0x3bfe63){logger[_0xe529('0xc')](_0xe529('0xd'));return request({'uri':util['format'](_0xe529('0xe'),_0x2570d6[_0xe529('0xf')]),'method':'POST','body':{'ticket':_[_0xe529('0x10')]({'requester_id':_0x31d1c3['id'],'submitter_id':_0x215490?_0x215490['id']:undefined,'assignee_id':_0x215490?_0x215490['id']:undefined,'tags':getTags(_0x5c872b['Tags'],_0xe529('0x11')),'subject':intUtil[_0xe529('0x12')](_0x5c872b[_0xe529('0x13')],_0x3bfe63,'\x20'),'description':intUtil[_0xe529('0x12')](_0x5c872b['Descriptions'],_0x3bfe63,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5c872b[_0xe529('0x14')],_0x3bfe63,'\x0a')}},getCustomFields(_0x5c872b[_0xe529('0x15')],_0x3bfe63))}})[_0xe529('0x16')](function(_0x5ed380){logger[_0xe529('0xc')](_0xe529('0x17'));return _0x5ed380[_0xe529('0x18')];});}function getUser(_0xde77a2,_0x5dd258){if(intUtil[_0xe529('0x19')](_0x5dd258)){logger[_0xe529('0xc')](_0xe529('0x1a'),_0x5dd258);return request({'uri':util['format']('%s/search.json',_0xde77a2[_0xe529('0xf')]),'qs':{'query':util[_0xe529('0x1b')](_0xe529('0x1c'),_0x5dd258)}})[_0xe529('0x16')](function(_0x239623){if(_0x239623[_0xe529('0x1d')]){logger['info'](_0xe529('0x1e'));return _[_0xe529('0x1f')](_0x239623['results'],{'email':_0x5dd258,'role':_0xe529('0x20')});}else{logger['info'](_0xe529('0x21'));return request({'uri':util[_0xe529('0x1b')](_0xe529('0x22'),_0xde77a2[_0xe529('0xf')])})[_0xe529('0x16')](function(_0x36c7e5){logger[_0xe529('0xc')]('Admin\x20account\x20selected.');return _0x36c7e5[_0xe529('0x23')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe529('0x1b')](_0xe529('0x22'),_0xde77a2['remoteUri'])})[_0xe529('0x16')](function(_0x51863d){logger[_0xe529('0xc')]('Admin\x20account\x20selected.');return _0x51863d[_0xe529('0x23')];});}}function getEndUser(_0x7cfb95,_0x30fcd5,_0x168650){logger[_0xe529('0xc')](_0xe529('0x24'),_0x168650);return request({'uri':util['format'](_0xe529('0x25'),_0x7cfb95[_0xe529('0xf')]),'qs':{'query':util[_0xe529('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x168650)}})[_0xe529('0x16')](function(_0x3b0926){var _0x2a999f;if(_0x3b0926['results']['length']){_0x3b0926['results']=_[_0xe529('0x26')](_0x3b0926[_0xe529('0x27')],{'suspended':![],'role':_0xe529('0x28')});if(_0x3b0926[_0xe529('0x27')][_0xe529('0x29')]){_0x2a999f=_[_0xe529('0x2a')](_0x3b0926['results']);}}if(_0x2a999f){logger[_0xe529('0xc')](_0xe529('0x2b'));return _0x2a999f;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xe529('0x1b')]('%s/users.json',_0x7cfb95['remoteUri']),'method':_0xe529('0x2c'),'body':{'user':{'role':_0xe529('0x28'),'name':util[_0xe529('0x1b')](_0xe529('0x2d'),_0x30fcd5||_0x168650),'phone':_0x168650}}})[_0xe529('0x16')](function(_0x1840f2){logger[_0xe529('0xc')]('Enduser\x20created.');return _0x1840f2[_0xe529('0x23')];});}});}function getAuth(_0x376250){var _0x2c3677;if(_0x376250[_0xe529('0x2e')]===_0xe529('0x2f')){_0x2c3677=util[_0xe529('0x1b')](_0xe529('0x30'),_0x376250['username'],_0x376250[_0xe529('0x2f')]);}else if(_0x376250[_0xe529('0x2e')]===_0xe529('0x31')){_0x2c3677=util[_0xe529('0x1b')](_0xe529('0x32'),_0x376250['username'],_0x376250['token']);}return util[_0xe529('0x1b')](_0xe529('0x33'),new Buffer(_0x2c3677)[_0xe529('0x34')](_0xe529('0x35')));}function request(_0x305348){logger[_0xe529('0x36')](_0xe529('0x37'),JSON[_0xe529('0x38')](_0x305348));return rp(_['defaults'](_0x305348,{'method':_0xe529('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x32f9f5,_0x4fc260){var _0x1dcb6=[];if(_0x32f9f5&&_0x32f9f5[_0xe529('0x29')]>0x0){_0x1dcb6=_['map'](_0x32f9f5,_0x4fc260);}return _0x1dcb6;}function getCustomFields(_0x45b594,_0xb79ec2){var _0x7b9137=[];var _0xed87a5={'custom_fields':[]};if(_0x45b594[_0xe529('0x29')]>0x0){_['forEach'](_0x45b594,function(_0x441118){if(_['includes']([_0xe529('0x3a'),_0xe529('0x3b')],_0x441118[_0xe529('0x3c')])&&_0x441118['nameField']&&!_0x441118[_0xe529('0x3d')]){_0xed87a5[_0x441118['nameField'][_0xe529('0x3e')]()]=_0x441118[_0xe529('0x3f')]['toString']();}else if(_[_0xe529('0x40')](['string',_0xe529('0x3b')],_0x441118[_0xe529('0x3c')])&&_0x441118[_0xe529('0x41')]&&_0x441118[_0xe529('0x3d')]){_0xed87a5[_0xe529('0x42')]['push']({'id':_0x441118[_0xe529('0x41')],'value':_0x441118['content'][_0xe529('0x34')]()});}else if(_0x441118[_0xe529('0x3c')]===_0xe529('0x43')&&_0x441118[_0xe529('0x44')]&&_0x441118[_0xe529('0x41')]&&_0x441118[_0xe529('0x3d')]){_0xb79ec2[_0x441118[_0xe529('0x44')]]&&_0xed87a5[_0xe529('0x42')][_0xe529('0x45')]({'id':_0x441118[_0xe529('0x41')],'value':_0xb79ec2[_0x441118[_0xe529('0x44')]]['toString']()});}else if(_0x441118['type']==='customVariable'&&_0x441118[_0xe529('0x46')]&&_0x441118['Variable'][_0xe529('0x11')]&&_0x441118[_0xe529('0x41')]&&_0x441118['customField']){_0xb79ec2[_0x441118[_0xe529('0x46')][_0xe529('0x11')][_0xe529('0x3e')]()]&&_0xed87a5[_0xe529('0x42')][_0xe529('0x45')]({'id':_0x441118[_0xe529('0x41')],'value':_0xb79ec2[_0x441118['Variable'][_0xe529('0x11')][_0xe529('0x3e')]()][_0xe529('0x34')]()});}});}return _0xed87a5;}exports['queue']=function(_0x5fc908,_0x173ac4,_0x1f50c5,_0x5979f3,_0x55a56b,_0xddfb6a){var _0x38aeca,_0x132b31;_0xddfb6a[_0xe529('0xf')]=intUtil[_0xe529('0x47')](_0xddfb6a['remoteUri']);_0xddfb6a[_0xe529('0x48')]=intUtil[_0xe529('0x47')](_0xddfb6a[_0xe529('0x48')]);if(_0x55a56b&&_0x55a56b['monitor_format']){logger[_0xe529('0xc')](_0xe529('0x49'),_0xe529('0x4a'));_0x173ac4[_0xe529('0x4b')]=util[_0xe529('0x1b')](_0xe529('0x4c'),_0xddfb6a['serverUrl'],_0x173ac4[_0xe529('0x4d')],md5(_0x173ac4[_0xe529('0x4d')]));}else{_0x173ac4[_0xe529('0x4b')]='';}headers[_0xe529('0x4e')]=getAuth(_0xddfb6a);return getUser(_0xddfb6a,_0x5979f3['email'])[_0xe529('0x16')](function(_0x3699cb){_0x38aeca=_0x3699cb;logger[_0xe529('0xc')](_0xe529('0x4f'),_0x38aeca['id']);return getEndUser(_0xddfb6a,_0x173ac4[_0xe529('0x50')],_0x173ac4['calleridnum']);})[_0xe529('0x16')](function(_0x1d7f4b){_0x132b31=_0x1d7f4b;logger[_0xe529('0xc')]('The\x20Enduser\x20ID\x20is:',_0x132b31['id']);return getTicket(_0xddfb6a,_0x38aeca,_0x132b31,_0x1f50c5,_0x173ac4);})['then'](function(_0x1ba6f5){if(_0x1ba6f5){logger['info'](_0xe529('0x51'),_0x1ba6f5['id']);switch(_0xddfb6a[_0xe529('0x3c')]){case'integrationTab':logger[_0xe529('0xc')](_0xe529('0x49'),_0xe529('0x52'));return request({'uri':util[_0xe529('0x1b')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xddfb6a[_0xe529('0xf')],_0x38aeca['id'],_0x1ba6f5['id']),'method':_0xe529('0x2c')});case _0xe529('0x53'):logger['info'](_0xe529('0x49'),_0xe529('0x54'));emit(util['format'](_0xe529('0x55'),_0x5979f3[_0xe529('0x11')]),_0xe529('0x56'),{'uri':util[_0xe529('0x1b')](_0xe529('0x57'),_0xddfb6a[_0xe529('0xf')][_0xe529('0x58')](_0xe529('0x59'),''),_0x1ba6f5['id'])});break;default:logger[_0xe529('0x5a')](_0xe529('0x49'),_0xe529('0x5b'));}}})[_0xe529('0x5c')](function(_0xb1b0b0){logger['error'](_0xe529('0x5d'),util[_0xe529('0x5e')](_0xb1b0b0,{'showHidden':!![],'depth':null}));});};exports[_0xe529('0x5f')]=function(_0x305490,_0x1545c1,_0x4b9217,_0x10c32d,_0x5df757,_0x4fa69a,_0x114add){var _0x4e07e5,_0x3afc0d;_0x4fa69a[_0xe529('0xf')]=intUtil[_0xe529('0x47')](_0x4fa69a[_0xe529('0xf')]);_0x4fa69a[_0xe529('0x48')]=intUtil[_0xe529('0x47')](_0x4fa69a[_0xe529('0x48')]);if(_0x114add&&_0x114add[_0xe529('0x60')]&&_0x114add[_0xe529('0x60')]!==_0xe529('0x61')){logger[_0xe529('0xc')](_0xe529('0x62'),'Recording\x20is\x20enabled!');_0x1545c1[_0xe529('0x4b')]=util[_0xe529('0x1b')](_0xe529('0x4c'),_0x4fa69a['serverUrl'],_0x1545c1[_0xe529('0x4d')],md5(_0x1545c1['uniqueid']));}headers['Authorization']=getAuth(_0x4fa69a);return getUser(_0x4fa69a,_0x10c32d[_0xe529('0x63')])[_0xe529('0x16')](function(_0x5478d2){_0x4e07e5=_0x5478d2;logger[_0xe529('0xc')](_0xe529('0x4f'),_0x4e07e5['id']);return getEndUser(_0x4fa69a,_0x1545c1[_0xe529('0x64')],_0x1545c1['destcalleridnum']);})[_0xe529('0x16')](function(_0x13ea56){_0x3afc0d=_0x13ea56;logger[_0xe529('0xc')](_0xe529('0x65'),_0x3afc0d['id']);return getTicket(_0x4fa69a,_0x4e07e5,_0x3afc0d,_0x4b9217,_0x1545c1);})[_0xe529('0x16')](function(_0x2cd147){if(_0x2cd147){logger[_0xe529('0xc')](_0xe529('0x51'),_0x2cd147['id']);switch(_0x4fa69a[_0xe529('0x3c')]){case _0xe529('0x66'):logger[_0xe529('0xc')](_0xe529('0x62'),_0xe529('0x52'));return request({'uri':util[_0xe529('0x1b')](_0xe529('0x67'),_0x4fa69a[_0xe529('0xf')],_0x4e07e5['id'],_0x2cd147['id']),'method':'POST'});case _0xe529('0x53'):logger[_0xe529('0xc')]('[OUTBOUND]',_0xe529('0x54'));emit(util['format'](_0xe529('0x55'),_0x10c32d['name']),_0xe529('0x56'),{'uri':util['format']('%s/agent/tickets/%s',_0x4fa69a[_0xe529('0xf')]['replace'](_0xe529('0x59'),''),_0x2cd147['id'])});break;default:logger[_0xe529('0x5a')](_0xe529('0x62'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xe529('0x5c')](function(_0x29035b){logger[_0xe529('0x5a')](_0xe529('0x68'),util[_0xe529('0x5e')](_0x29035b,{'showHidden':!![],'depth':null}));});};exports[_0xe529('0x69')]=function(_0x38ceac,_0x40d602,_0x17ac1a,_0x129a50,_0x33266c,_0xee022f){var _0xb5ce58,_0x58ae15;_0xee022f[_0xe529('0xf')]=intUtil[_0xe529('0x47')](_0xee022f[_0xe529('0xf')]);_0xee022f[_0xe529('0x48')]=intUtil['stripTrailingSlash'](_0xee022f[_0xe529('0x48')]);if(_0x33266c&&_0x33266c[_0xe529('0x6a')]){logger['info']('['+_0x40d602[_0xe529('0x6b')]['toUpperCase']()+']',_0xe529('0x4a'));_0x40d602['recordingURL']=util['format'](_0xe529('0x4c'),_0xee022f['serverUrl'],_0x40d602['uniqueid'],md5(_0x40d602[_0xe529('0x4d')]));}else{_0x40d602[_0xe529('0x4b')]='';}headers[_0xe529('0x4e')]=getAuth(_0xee022f);return getUser(_0xee022f)[_0xe529('0x16')](function(_0x2ec4ee){_0xb5ce58=_0x2ec4ee;logger['info'](_0xe529('0x4f'),_0xb5ce58['id']);return getEndUser(_0xee022f,_0x40d602[_0xe529('0x50')],_0x40d602[_0xe529('0x6c')]);})[_0xe529('0x16')](function(_0x649e5){_0x58ae15=_0x649e5;logger[_0xe529('0xc')](_0xe529('0x65'),_0x58ae15['id']);return getTicket(_0xee022f,_0xb5ce58,_0x58ae15,_0x17ac1a,_0x40d602);})['then'](function(_0x28c0b1){if(_0x28c0b1){logger[_0xe529('0xc')](_0xe529('0x51'),_0x28c0b1['id']);}})[_0xe529('0x5c')](function(_0x3ddad7){logger[_0xe529('0x5a')]('['+_0x40d602[_0xe529('0x6b')][_0xe529('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3ddad7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xeec4=['customField','toLowerCase','content','type','idField','push','variable','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','name','Subjects','getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','find','results','agent','user','Admin\x20account\x20selected.','%s/search.json','type:user\x20role:end-user\x20phone:%s','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','toString','base64','[HTTP]','GET','length','map','forEach','includes','string','picklist','nameField'];(function(_0x39fb23,_0x2ad8c5){var _0x5e862c=function(_0x1d3ce3){while(--_0x1d3ce3){_0x39fb23['push'](_0x39fb23['shift']());}};_0x5e862c(++_0x2ad8c5);}(_0xeec4,0x97));var _0x4eec=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xeec4[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0x4eec('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x4eec('0x1'));var Redis=require(_0x4eec('0x2'));var intUtil=require(_0x4eec('0x3'));var config=require(_0x4eec('0x4'));var logger=require(_0x4eec('0x5'))(_0x4eec('0x6'));config[_0x4eec('0x7')]=_[_0x4eec('0x8')](config[_0x4eec('0x7')],{'host':_0x4eec('0x9'),'port':0x18eb});var io=require(_0x4eec('0xa'))(new Redis(config['redis']));function emit(_0x2e064c,_0x28e2ce,_0xce7722){io['to'](_0x2e064c)['emit'](_0x28e2ce,_0xce7722);}var headers={'Content-Type':_0x4eec('0xb'),'Accept':_0x4eec('0xb')};function getTicket(_0x47c1e4,_0x4e8d03,_0x297c8e,_0x36f2e6,_0x5920cf){logger[_0x4eec('0xc')](_0x4eec('0xd'));return request({'uri':util['format'](_0x4eec('0xe'),_0x47c1e4[_0x4eec('0xf')]),'method':_0x4eec('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x297c8e['id'],'submitter_id':_0x4e8d03?_0x4e8d03['id']:undefined,'assignee_id':_0x4e8d03?_0x4e8d03['id']:undefined,'tags':getTags(_0x36f2e6['Tags'],_0x4eec('0x11')),'subject':intUtil['getString'](_0x36f2e6[_0x4eec('0x12')],_0x5920cf,'\x20'),'description':intUtil[_0x4eec('0x13')](_0x36f2e6[_0x4eec('0x14')],_0x5920cf,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x36f2e6[_0x4eec('0x14')],_0x5920cf,'\x0a')}},getCustomFields(_0x36f2e6[_0x4eec('0x15')],_0x5920cf))}})[_0x4eec('0x16')](function(_0x51cae2){logger['info']('Ticket\x20created!');return _0x51cae2[_0x4eec('0x17')];});}function getUser(_0x52f722,_0xe0f332){if(intUtil['validateEmail'](_0xe0f332)){logger[_0x4eec('0xc')](_0x4eec('0x18'),_0xe0f332);return request({'uri':util['format']('%s/search.json',_0x52f722[_0x4eec('0xf')]),'qs':{'query':util[_0x4eec('0x19')](_0x4eec('0x1a'),_0xe0f332)}})[_0x4eec('0x16')](function(_0x1e44e5){if(_0x1e44e5[_0x4eec('0x1b')]){logger[_0x4eec('0xc')]('Agent\x20found!');return _[_0x4eec('0x1c')](_0x1e44e5[_0x4eec('0x1d')],{'email':_0xe0f332,'role':_0x4eec('0x1e')});}else{logger[_0x4eec('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4eec('0x19')]('%s/users/me.json',_0x52f722['remoteUri'])})[_0x4eec('0x16')](function(_0x145b6e){logger['info']('Admin\x20account\x20selected.');return _0x145b6e[_0x4eec('0x1f')];});}});}else{logger[_0x4eec('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x52f722[_0x4eec('0xf')])})['then'](function(_0x505bd3){logger[_0x4eec('0xc')](_0x4eec('0x20'));return _0x505bd3[_0x4eec('0x1f')];});}}function getEndUser(_0xf17dce,_0x1c8641,_0x462bd5){logger[_0x4eec('0xc')]('Searching\x20enduser\x20with\x20phone',_0x462bd5);return request({'uri':util['format'](_0x4eec('0x21'),_0xf17dce[_0x4eec('0xf')]),'qs':{'query':util[_0x4eec('0x19')](_0x4eec('0x22'),_0x462bd5)}})[_0x4eec('0x16')](function(_0x10ef2f){var _0x1e72b0;if(_0x10ef2f[_0x4eec('0x1d')]['length']){_0x10ef2f['results']=_['filter'](_0x10ef2f[_0x4eec('0x1d')],{'suspended':![],'role':_0x4eec('0x23')});if(_0x10ef2f[_0x4eec('0x1d')]['length']){_0x1e72b0=_[_0x4eec('0x24')](_0x10ef2f[_0x4eec('0x1d')]);}}if(_0x1e72b0){logger[_0x4eec('0xc')](_0x4eec('0x25'));return _0x1e72b0;}else{logger[_0x4eec('0xc')](_0x4eec('0x26'));return request({'uri':util['format'](_0x4eec('0x27'),_0xf17dce['remoteUri']),'method':_0x4eec('0x10'),'body':{'user':{'role':_0x4eec('0x23'),'name':util[_0x4eec('0x19')](_0x4eec('0x28'),_0x1c8641||_0x462bd5),'phone':_0x462bd5}}})[_0x4eec('0x16')](function(_0x2fbb58){logger[_0x4eec('0xc')](_0x4eec('0x29'));return _0x2fbb58[_0x4eec('0x1f')];});}});}function getAuth(_0x5a15fa){var _0x244a73;if(_0x5a15fa[_0x4eec('0x2a')]===_0x4eec('0x2b')){_0x244a73=util['format'](_0x4eec('0x2c'),_0x5a15fa[_0x4eec('0x2d')],_0x5a15fa[_0x4eec('0x2b')]);}else if(_0x5a15fa[_0x4eec('0x2a')]==='token'){_0x244a73=util[_0x4eec('0x19')](_0x4eec('0x2e'),_0x5a15fa[_0x4eec('0x2d')],_0x5a15fa[_0x4eec('0x2f')]);}return util[_0x4eec('0x19')]('Basic\x20%s',new Buffer(_0x244a73)[_0x4eec('0x30')](_0x4eec('0x31')));}function request(_0x4dbba5){logger['debug'](_0x4eec('0x32'),JSON['stringify'](_0x4dbba5));return rp(_['defaults'](_0x4dbba5,{'method':_0x4eec('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x36b85f,_0x48c7ff){var _0x4fcf63=[];if(_0x36b85f&&_0x36b85f[_0x4eec('0x34')]>0x0){_0x4fcf63=_[_0x4eec('0x35')](_0x36b85f,_0x48c7ff);}return _0x4fcf63;}function getCustomFields(_0x17069e,_0xf8f23b){var _0x23aa97=[];var _0x23c591={'custom_fields':[]};if(_0x17069e[_0x4eec('0x34')]>0x0){_[_0x4eec('0x36')](_0x17069e,function(_0x57b820){if(_[_0x4eec('0x37')]([_0x4eec('0x38'),_0x4eec('0x39')],_0x57b820['type'])&&_0x57b820[_0x4eec('0x3a')]&&!_0x57b820[_0x4eec('0x3b')]){_0x23c591[_0x57b820['nameField'][_0x4eec('0x3c')]()]=_0x57b820[_0x4eec('0x3d')]['toString']();}else if(_[_0x4eec('0x37')]([_0x4eec('0x38'),_0x4eec('0x39')],_0x57b820[_0x4eec('0x3e')])&&_0x57b820[_0x4eec('0x3f')]&&_0x57b820[_0x4eec('0x3b')]){_0x23c591['custom_fields'][_0x4eec('0x40')]({'id':_0x57b820['idField'],'value':_0x57b820['content'][_0x4eec('0x30')]()});}else if(_0x57b820['type']===_0x4eec('0x41')&&_0x57b820[_0x4eec('0x42')]&&_0x57b820['idField']&&_0x57b820[_0x4eec('0x3b')]){_0xf8f23b[_0x57b820[_0x4eec('0x42')]]&&_0x23c591[_0x4eec('0x43')][_0x4eec('0x40')]({'id':_0x57b820['idField'],'value':_0xf8f23b[_0x57b820[_0x4eec('0x42')]][_0x4eec('0x30')]()});}else if(_0x57b820[_0x4eec('0x3e')]===_0x4eec('0x44')&&_0x57b820['Variable']&&_0x57b820['Variable'][_0x4eec('0x11')]&&_0x57b820[_0x4eec('0x3f')]&&_0x57b820[_0x4eec('0x3b')]){_0xf8f23b[_0x57b820[_0x4eec('0x45')][_0x4eec('0x11')]['toLowerCase']()]&&_0x23c591['custom_fields'][_0x4eec('0x40')]({'id':_0x57b820[_0x4eec('0x3f')],'value':_0xf8f23b[_0x57b820[_0x4eec('0x45')]['name'][_0x4eec('0x3c')]()]['toString']()});}});}return _0x23c591;}exports[_0x4eec('0x46')]=function(_0x46e49c,_0x37c2d3,_0x160e31,_0x4bc9e7,_0xc7eaa9,_0x489379){var _0x35bdab,_0x2f2f2c;_0x489379[_0x4eec('0xf')]=intUtil[_0x4eec('0x47')](_0x489379[_0x4eec('0xf')]);_0x489379[_0x4eec('0x48')]=intUtil[_0x4eec('0x47')](_0x489379[_0x4eec('0x48')]);if(_0xc7eaa9&&_0xc7eaa9[_0x4eec('0x49')]){logger[_0x4eec('0xc')](_0x4eec('0x4a'),'Recording\x20is\x20enabled!');_0x37c2d3[_0x4eec('0x4b')]=util[_0x4eec('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x489379[_0x4eec('0x48')],_0x37c2d3[_0x4eec('0x4c')],md5(_0x37c2d3[_0x4eec('0x4c')]));}else{_0x37c2d3['recordingURL']='';}headers[_0x4eec('0x4d')]=getAuth(_0x489379);return getUser(_0x489379,_0x4bc9e7[_0x4eec('0x4e')])[_0x4eec('0x16')](function(_0x7c2ce1){_0x35bdab=_0x7c2ce1;logger[_0x4eec('0xc')](_0x4eec('0x4f'),_0x35bdab['id']);return getEndUser(_0x489379,_0x37c2d3[_0x4eec('0x50')],_0x37c2d3[_0x4eec('0x51')]);})[_0x4eec('0x16')](function(_0x48ce8f){_0x2f2f2c=_0x48ce8f;logger[_0x4eec('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2f2f2c['id']);return getTicket(_0x489379,_0x35bdab,_0x2f2f2c,_0x160e31,_0x37c2d3);})[_0x4eec('0x16')](function(_0x7057ff){if(_0x7057ff){logger[_0x4eec('0xc')](_0x4eec('0x52'),_0x7057ff['id']);switch(_0x489379['type']){case _0x4eec('0x53'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4eec('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x489379[_0x4eec('0xf')],_0x35bdab['id'],_0x7057ff['id']),'method':_0x4eec('0x10')});case'newTab':logger['info']('[QUEUE]',_0x4eec('0x54'));emit(util[_0x4eec('0x19')]('user:%s',_0x4bc9e7[_0x4eec('0x11')]),_0x4eec('0x55'),{'uri':util['format'](_0x4eec('0x56'),_0x489379[_0x4eec('0xf')][_0x4eec('0x57')](_0x4eec('0x58'),''),_0x7057ff['id'])});break;default:logger[_0x4eec('0x59')](_0x4eec('0x4a'),_0x4eec('0x5a'));}}})['catch'](function(_0x873131){logger[_0x4eec('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4eec('0x5b')](_0x873131,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3b49a7,_0xd7dce3,_0x103994,_0x4279ba,_0x3337eb,_0x1ca39b,_0x13c729){var _0x36068d,_0x26484d;_0x1ca39b[_0x4eec('0xf')]=intUtil[_0x4eec('0x47')](_0x1ca39b[_0x4eec('0xf')]);_0x1ca39b[_0x4eec('0x48')]=intUtil[_0x4eec('0x47')](_0x1ca39b[_0x4eec('0x48')]);if(_0x13c729&&_0x13c729['recordingFormat']&&_0x13c729[_0x4eec('0x5c')]!==_0x4eec('0x5d')){logger[_0x4eec('0xc')]('[OUTBOUND]',_0x4eec('0x5e'));_0xd7dce3[_0x4eec('0x4b')]=util[_0x4eec('0x19')](_0x4eec('0x5f'),_0x1ca39b[_0x4eec('0x48')],_0xd7dce3[_0x4eec('0x4c')],md5(_0xd7dce3['uniqueid']));}headers[_0x4eec('0x4d')]=getAuth(_0x1ca39b);return getUser(_0x1ca39b,_0x4279ba['email'])[_0x4eec('0x16')](function(_0x1ab7df){_0x36068d=_0x1ab7df;logger[_0x4eec('0xc')](_0x4eec('0x4f'),_0x36068d['id']);return getEndUser(_0x1ca39b,_0xd7dce3[_0x4eec('0x60')],_0xd7dce3['destcalleridnum']);})[_0x4eec('0x16')](function(_0xa4b161){_0x26484d=_0xa4b161;logger[_0x4eec('0xc')](_0x4eec('0x61'),_0x26484d['id']);return getTicket(_0x1ca39b,_0x36068d,_0x26484d,_0x103994,_0xd7dce3);})[_0x4eec('0x16')](function(_0x16f341){if(_0x16f341){logger[_0x4eec('0xc')](_0x4eec('0x52'),_0x16f341['id']);switch(_0x1ca39b[_0x4eec('0x3e')]){case _0x4eec('0x53'):logger[_0x4eec('0xc')](_0x4eec('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4eec('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1ca39b[_0x4eec('0xf')],_0x36068d['id'],_0x16f341['id']),'method':'POST'});case'newTab':logger[_0x4eec('0xc')](_0x4eec('0x62'),_0x4eec('0x54'));emit(util['format'](_0x4eec('0x63'),_0x4279ba['name']),_0x4eec('0x55'),{'uri':util['format'](_0x4eec('0x56'),_0x1ca39b[_0x4eec('0xf')]['replace'](_0x4eec('0x58'),''),_0x16f341['id'])});break;default:logger[_0x4eec('0x59')]('[OUTBOUND]',_0x4eec('0x5a'));}}})['catch'](function(_0x212a5d){logger['error'](_0x4eec('0x64'),util[_0x4eec('0x5b')](_0x212a5d,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4ea66d,_0x111926,_0x354534,_0x40b119,_0x5540ff,_0x129e03){var _0x27e016,_0x2f529d;_0x129e03['remoteUri']=intUtil[_0x4eec('0x47')](_0x129e03[_0x4eec('0xf')]);_0x129e03[_0x4eec('0x48')]=intUtil[_0x4eec('0x47')](_0x129e03[_0x4eec('0x48')]);if(_0x5540ff&&_0x5540ff[_0x4eec('0x49')]){logger[_0x4eec('0xc')]('['+_0x111926[_0x4eec('0x65')][_0x4eec('0x66')]()+']',_0x4eec('0x5e'));_0x111926['recordingURL']=util[_0x4eec('0x19')](_0x4eec('0x5f'),_0x129e03[_0x4eec('0x48')],_0x111926['uniqueid'],md5(_0x111926[_0x4eec('0x4c')]));}else{_0x111926[_0x4eec('0x4b')]='';}headers['Authorization']=getAuth(_0x129e03);return getUser(_0x129e03)[_0x4eec('0x16')](function(_0x350c75){_0x27e016=_0x350c75;logger['info'](_0x4eec('0x4f'),_0x27e016['id']);return getEndUser(_0x129e03,_0x111926[_0x4eec('0x50')],_0x111926[_0x4eec('0x51')]);})[_0x4eec('0x16')](function(_0x14bab8){_0x2f529d=_0x14bab8;logger[_0x4eec('0xc')](_0x4eec('0x61'),_0x2f529d['id']);return getTicket(_0x129e03,_0x27e016,_0x2f529d,_0x354534,_0x111926);})[_0x4eec('0x16')](function(_0x274242){if(_0x274242){logger[_0x4eec('0xc')](_0x4eec('0x52'),_0x274242['id']);}})[_0x4eec('0x67')](function(_0x44ba77){logger[_0x4eec('0x59')]('['+_0x111926['lastevent'][_0x4eec('0x66')]()+']'+_0x4eec('0x68'),util[_0x4eec('0x5b')](_0x44ba77,{'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 7919c87..aa78d85 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 _0xaf1b=['profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','GET','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Description','Contacts','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Timeout','Call_Start_Time','agentcalledAt','Fields','/crm/v2/Calls','err','stack','log','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Inbound','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=','outbound','recordingFormat','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','calleridname','lodash','md5','util','./util','../../../../config/environment','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','then','seconds','catch','error','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user'];(function(_0x3182ae,_0x5a2440){var _0x275944=function(_0x426e99){while(--_0x426e99){_0x3182ae['push'](_0x3182ae['shift']());}};_0x275944(++_0x5a2440);}(_0xaf1b,0x182));var _0xbaf1=function(_0x27882b,_0x3120ca){_0x27882b=_0x27882b-0x0;var _0x4f2e39=_0xaf1b[_0x27882b];return _0x4f2e39;};'use strict';var _=require(_0xbaf1('0x0'));var rp=require('request-promise');var md5=require(_0xbaf1('0x1'));var util=require(_0xbaf1('0x2'));var intUtil=require(_0xbaf1('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xbaf1('0x4'));var logger=require('../../../../config/logger')('zoho');config[_0xbaf1('0x5')]=_[_0xbaf1('0x6')](config[_0xbaf1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbaf1('0x7'))(new Redis(config[_0xbaf1('0x5')]));function emit(_0x1f59b9,_0x8f5788,_0x541c78){io['to'](_0x1f59b9)[_0xbaf1('0x8')](_0x8f5788,_0x541c78);}function request(_0x4e8020){logger[_0xbaf1('0x9')](_0xbaf1('0xa'),JSON[_0xbaf1('0xb')](_0x4e8020));return rp(_0x4e8020);}function getCustomFields(_0x18e165,_0xd723d4){var _0x415dcf={};if(_0x18e165['length']>0x0){_[_0xbaf1('0xc')](_0x18e165,function(_0x3eeea2){if(_[_0xbaf1('0xd')]([_0xbaf1('0xe'),_0xbaf1('0xf')],_0x3eeea2[_0xbaf1('0x10')])&&_0x3eeea2[_0xbaf1('0x11')]){_0x415dcf[_0x3eeea2[_0xbaf1('0x11')]]=_0x3eeea2[_0xbaf1('0x12')][_0xbaf1('0x13')]();}else if(_0x3eeea2['type']===_0xbaf1('0x14')&&_0x3eeea2[_0xbaf1('0x15')]&&_0x3eeea2[_0xbaf1('0x11')]&&_0xd723d4[_0x3eeea2[_0xbaf1('0x15')]]){_0x415dcf[_0x3eeea2[_0xbaf1('0x11')]]=_0xd723d4[_0x3eeea2['variableName']][_0xbaf1('0x13')]();}else if(_0x3eeea2[_0xbaf1('0x10')]===_0xbaf1('0x16')&&_0x3eeea2[_0xbaf1('0x17')]&&_0x3eeea2[_0xbaf1('0x17')][_0xbaf1('0x18')]&&_0x3eeea2[_0xbaf1('0x11')]&&_0xd723d4[_0x3eeea2[_0xbaf1('0x17')][_0xbaf1('0x18')][_0xbaf1('0x19')]()]){_0x415dcf[_0x3eeea2[_0xbaf1('0x11')]]=_0xd723d4[_0x3eeea2[_0xbaf1('0x17')][_0xbaf1('0x18')][_0xbaf1('0x19')]()][_0xbaf1('0x13')]();}});}return _0x415dcf;}function getName(_0x708ba9){if(_0x708ba9[_0xbaf1('0x1a')]('\x20')>0x0){var _0x40031b=_0x708ba9['split'](/ (.+)/);if(_0x40031b[0x1]){return _0x40031b;}}return[_0x708ba9,_0x708ba9];}var accountsTokens={};function getAccessToken(_0x4bb819){return new Promise(function(_0x2be3fc,_0x1e306e){if(!_[_0xbaf1('0x1b')](accountsTokens[_0x4bb819['id']])&&!_[_0xbaf1('0x1b')](accountsTokens[_0x4bb819['id']][_0xbaf1('0x1c')])){if(moment()[_0xbaf1('0x1d')](accountsTokens[_0x4bb819['id']]['expires_in'])){_0x2be3fc(accountsTokens[_0x4bb819['id']][_0xbaf1('0x1c')]);}}var _0x227c05;switch(_0x4bb819[_0xbaf1('0x1e')]){case'US':_0x227c05='https://accounts.zoho.com';break;case'AU':_0x227c05=_0xbaf1('0x1f');break;case'EU':_0x227c05=_0xbaf1('0x20');break;case'IN':_0x227c05=_0xbaf1('0x21');break;case'CN':_0x227c05=_0xbaf1('0x22');break;default:_0x227c05='https://accounts.zoho.eu';break;}var _0x447644={'method':'POST','uri':_0x227c05+_0xbaf1('0x23'),'qs':{'refresh_token':_0x4bb819[_0xbaf1('0x24')],'client_id':_0x4bb819[_0xbaf1('0x25')],'client_secret':_0x4bb819['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x447644)[_0xbaf1('0x26')](function(_0x3ef84c){accountsTokens[_0x4bb819['id']]={'access_token':_0x3ef84c[_0xbaf1('0x1c')],'expires_in':moment()['add'](_0x3ef84c['expires_in'],_0xbaf1('0x27'))};_0x2be3fc(_0x3ef84c[_0xbaf1('0x1c')]);})[_0xbaf1('0x28')](function(_0x2f92a9){logger[_0xbaf1('0x29')]('Failing\x20creating\x20the\x20access_token',_0x2f92a9['stack']);_0x1e306e(_0x2f92a9);});});}function getUser(_0x1f0ff8,_0x59271f,_0x163efd,_0x29e7c5){logger[_0xbaf1('0x2a')]('Search\x20user');return request({'method':'GET','uri':util[_0xbaf1('0x2b')](_0xbaf1('0x2c'),_0x59271f),'qs':{'type':_0xbaf1('0x2d')},'headers':{'Authorization':_0xbaf1('0x2e')+_0x1f0ff8},'json':!![]})[_0xbaf1('0x26')](function(_0x30cdaf){if(_0x30cdaf[_0xbaf1('0x2f')]){var _0x557f6e=-0x1;if(_[_0xbaf1('0x30')](_0x30cdaf[_0xbaf1('0x2f')])){if(!_['isNil'](_0x29e7c5)){_0x557f6e=_['findIndex'](_0x30cdaf['users'],function(_0x5c28e2){return _0x5c28e2[_0xbaf1('0x31')]===_0x29e7c5;});}if(_0x557f6e>=0x0){logger['info'](_0xbaf1('0x32'));}else{logger[_0xbaf1('0x2a')](_0xbaf1('0x33'));_0x557f6e=_[_0xbaf1('0x34')](_0x30cdaf[_0xbaf1('0x2f')],function(_0x581de5){return _0x581de5['profile'][_0xbaf1('0x18')]===_0xbaf1('0x35');});}return _0x30cdaf[_0xbaf1('0x2f')][_0x557f6e];}else{if(_0x30cdaf[_0xbaf1('0x36')][_0xbaf1('0x37')]['name']===_0xbaf1('0x35')){logger[_0xbaf1('0x2a')]('Using\x20the\x20admin\x20account!');user=_0x30cdaf[_0xbaf1('0x36')];return user;}else{logger['error'](_0xbaf1('0x38'),JSON['stringify'](_0x30cdaf));throw new Error(_0xbaf1('0x39')+JSON['stringify'](_0x30cdaf));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xbaf1('0xb')](_0x30cdaf));throw new Error(_0xbaf1('0x39')+JSON[_0xbaf1('0xb')](_0x30cdaf));}})[_0xbaf1('0x28')](function(_0x3801be){console[_0xbaf1('0x29')](_0x3801be);});}function getZohoUser(_0x48732e,_0x245e8b){return new BPromise(function(_0x4e7cf5,_0x46ad76){request(_0x48732e)['then'](function(_0xfd71ac){var _0x2c0798=null;if(_0xfd71ac){_0x2c0798=_0xfd71ac[_0xbaf1('0x3a')][0x0];_0x2c0798[_0xbaf1('0x3b')]=_0x245e8b;}_0x4e7cf5(_0x2c0798);})[_0xbaf1('0x28')](function(_0x1403c0){_0x46ad76(_0x1403c0);});});}function createEndUser(_0x240824,_0x44ae7c,_0x2b7ce4,_0x398d70,_0x34ca82,_0x1147fb){var _0x2b7ce4=getName(_0x2b7ce4);return request({'method':_0xbaf1('0x3c'),'uri':'https://www.zohoapis.'+_0x44ae7c+_0xbaf1('0x3d')+_[_0xbaf1('0x3e')](_0x1147fb[_0xbaf1('0x3f')])+'s','body':{'data':[{'Last_Name':_0x2b7ce4[0x1],'First_Name':_0x2b7ce4[0x0],'Phone':_0x398d70,'Owner':{'name':!_[_0xbaf1('0x1b')](_0x34ca82['role'][_0xbaf1('0x18')])?_0x34ca82[_0xbaf1('0x40')][_0xbaf1('0x18')]:!_[_0xbaf1('0x1b')](_0x34ca82['first_name'])?_0x34ca82['first_name']+'\x20'+_0x34ca82[_0xbaf1('0x41')]:_0x34ca82[_0xbaf1('0x41')],'id':_0x34ca82['id']}}]},'headers':{'Authorization':_0xbaf1('0x2e')+_0x240824},'json':!![]})[_0xbaf1('0x26')](function(_0x54feef){if(_0x54feef&&_0x54feef['data'][0x0][_0xbaf1('0x42')]===_0xbaf1('0x43')){var _0x467280=_0x54feef['data'][0x0][_0xbaf1('0x44')];_0x467280['enduserType']=_['startCase'](_0x1147fb[_0xbaf1('0x3f')])+'s';return _0x467280;}logger[_0xbaf1('0x29')](_0xbaf1('0x38'),JSON[_0xbaf1('0xb')](data));throw new Error('Error:\x20'+JSON[_0xbaf1('0xb')](data));})[_0xbaf1('0x28')](function(_0x761596){console['log']('CREATE\x20ERROR',_0x761596);});}function getEndUser(_0x3ebfd5,_0xe3f0f3,_0x4442a6,_0xd99d1e,_0xe55ef1,_0x2526f3,_0x420b8e){var _0x39a29c={'method':_0xbaf1('0x45'),'uri':'','headers':{'Authorization':_0xbaf1('0x2e')+_0x3ebfd5},'json':!![]};switch(_0x420b8e[_0xbaf1('0x46')]){case _0xbaf1('0x47'):_0x39a29c['uri']=_0xbaf1('0x48')+_0xe3f0f3+_0xbaf1('0x49')+_0xe55ef1+'))';return getZohoUser(_0x39a29c,'Contacts')[_0xbaf1('0x26')](function(_0x46bbf9){if(_0x46bbf9)return _0x46bbf9;_0x39a29c[_0xbaf1('0x4a')]=_0xbaf1('0x48')+_0xe3f0f3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xe55ef1+'))';return getZohoUser(_0x39a29c,_0xbaf1('0x4b'))[_0xbaf1('0x26')](function(_0x2f7793){if(_0x2f7793)return _0x2f7793;if(_0x420b8e[_0xbaf1('0x3f')]!=_0xbaf1('0x4c')){return createEndUser(_0x3ebfd5,_0xe3f0f3,_0xd99d1e,_0xe55ef1,_0x2526f3,_0x420b8e);}else{return{};}});});break;case'contact':_0x39a29c['uri']=_0xbaf1('0x48')+_0xe3f0f3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xe55ef1+'))';return getZohoUser(_0x39a29c,'Contacts')['then'](function(_0x3d2771){if(_0x3d2771)return _0x3d2771;if(_0x420b8e[_0xbaf1('0x3f')]!='nothing'){return createEndUser(_0x3ebfd5,_0xe3f0f3,_0xd99d1e,_0xe55ef1,_0x2526f3,_0x420b8e);}else{return{};}});break;case _0xbaf1('0x4d'):_0x39a29c[_0xbaf1('0x4a')]=_0xbaf1('0x48')+_0xe3f0f3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xe55ef1+'))';return getZohoUser(_0x39a29c,_0xbaf1('0x4b'))['then'](function(_0x2dcb8f){if(_0x2dcb8f)return _0x2dcb8f;if(_0x420b8e[_0xbaf1('0x3f')]!=_0xbaf1('0x4c')){return createEndUser(_0x3ebfd5,_0xe3f0f3,_0xd99d1e,_0xe55ef1,_0x2526f3,_0x420b8e);}else{return{};}});break;}}function getCall(_0x45edf4,_0x5ceea8,_0x55d14b,_0x1dc93a,_0x39d4b9,_0x3e3c0a,_0x37eafd,_0x3c88ef){logger[_0xbaf1('0x2a')](_0xbaf1('0x4e'));var _0x5adc97={};_0x5adc97[_0xbaf1('0x4f')]={'name':!_['isNil'](_0x1dc93a['role'][_0xbaf1('0x18')])&&!_[_0xbaf1('0x1b')](_0x1dc93a[_0xbaf1('0x37')][_0xbaf1('0x18')])&&_0x1dc93a[_0xbaf1('0x37')][_0xbaf1('0x18')]===_0xbaf1('0x50')?_0x1dc93a[_0xbaf1('0x40')]['name']:!_[_0xbaf1('0x1b')](_0x1dc93a[_0xbaf1('0x51')])?_0x1dc93a['first_name']+'\x20'+_0x1dc93a[_0xbaf1('0x41')]:_0x1dc93a['last_name'],'id':_0x1dc93a['id']};_0x5adc97[_0xbaf1('0x52')]=intUtil[_0xbaf1('0x53')](_0x3e3c0a['Subjects'],_0x37eafd,'\x20');_0x5adc97[_0xbaf1('0x54')]=intUtil[_0xbaf1('0x53')](_0x3e3c0a['Descriptions'],_0x37eafd,'\x0a');if(_0x39d4b9[_0xbaf1('0x3b')]===_0xbaf1('0x55')){_0x5adc97[_0xbaf1('0x56')]={'name':!_['isNil'](_0x39d4b9[_0xbaf1('0x57')])?_0x39d4b9['Full_Name']:!_[_0xbaf1('0x1b')](_0x39d4b9['First_Name'])?_0x39d4b9[_0xbaf1('0x58')]+'\x20'+_0x39d4b9['Last_Name']:_0x39d4b9[_0xbaf1('0x59')],'id':_0x39d4b9['id']};}if(_0x39d4b9[_0xbaf1('0x3b')]===_0xbaf1('0x4b')){_0x5adc97['What_Id']={'name':!_[_0xbaf1('0x1b')](_0x39d4b9[_0xbaf1('0x57')])?_0x39d4b9[_0xbaf1('0x57')]:!_[_0xbaf1('0x1b')](_0x39d4b9[_0xbaf1('0x58')])?_0x39d4b9[_0xbaf1('0x58')]+'\x20'+_0x39d4b9['Last_Name']:_0x39d4b9['Last_Name'],'id':_0x39d4b9['id']};_0x5adc97[_0xbaf1('0x5a')]=_[_0xbaf1('0x3e')](_0x39d4b9[_0xbaf1('0x3b')]);}if(_0x37eafd[_0xbaf1('0x5b')]){_0x5adc97[_0xbaf1('0x5c')]=moment['utc'](parseInt(_0x37eafd['talktime'])*0x3e8)['format'](_0xbaf1('0x5d'));}else if(_0x37eafd[_0xbaf1('0x5e')]&&_0x37eafd[_0xbaf1('0x5f')]){_0x5adc97[_0xbaf1('0x5c')]=moment[_0xbaf1('0x60')](moment(_0x37eafd[_0xbaf1('0x5f')],_0xbaf1('0x61'))[_0xbaf1('0x62')](moment(_0x37eafd[_0xbaf1('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0xbaf1('0x2b')]('mm:ss');}switch(_0x37eafd[_0xbaf1('0x64')]){case _0xbaf1('0x65'):_0x5adc97[_0xbaf1('0x66')]=_0xbaf1('0x67');break;case _0xbaf1('0x68'):case _0xbaf1('0x69'):_0x5adc97[_0xbaf1('0x66')]=_0xbaf1('0x6a');break;case'rejected':_0x5adc97[_0xbaf1('0x66')]=_0xbaf1('0x6b');break;case _0xbaf1('0x6c'):_0x5adc97[_0xbaf1('0x66')]='Abandoned';break;case'timeout':_0x5adc97[_0xbaf1('0x66')]=_0xbaf1('0x6d');default:}_0x5adc97[_0xbaf1('0x6e')]=(_0x3c88ef==='outbound'?moment(_0x37eafd[_0xbaf1('0x63')])[_0xbaf1('0x2b')](_0xbaf1('0x61')):moment(_0x37eafd[_0xbaf1('0x6f')])[_0xbaf1('0x2b')](_0xbaf1('0x61')))||moment()['format'](_0xbaf1('0x61'));_0x5adc97['Call_Type']=_0x3c88ef||'Inbound';_0x5adc97=_['merge'](_0x5adc97,getCustomFields(_0x3e3c0a[_0xbaf1('0x70')],_0x37eafd));return request({'method':_0xbaf1('0x3c'),'uri':_0xbaf1('0x48')+_0x5ceea8+_0xbaf1('0x71'),'headers':{'Authorization':_0xbaf1('0x2e')+_0x45edf4},'body':{'data':[_0x5adc97]},'json':!![]})[_0xbaf1('0x26')](function(_0x295628){if(_0x295628&&_0x295628[_0xbaf1('0x3a')][0x0][_0xbaf1('0x42')]===_0xbaf1('0x43')){logger[_0xbaf1('0x2a')]('Call\x20created!');return{'id':_0x295628['data'][0x0][_0xbaf1('0x44')]['id']};}})[_0xbaf1('0x28')](function(_0x4ecb9b){logger['info'](_0xbaf1('0x72'),_0x4ecb9b[_0xbaf1('0x73')]);console[_0xbaf1('0x74')](_0xbaf1('0x72'),_0x4ecb9b);});}exports['queue']=function(_0x275818,_0x2c2e53,_0x3d60a7,_0xb3634c,_0x225183,_0x2976a5){var _0x141391,_0x569a33,_0x52c114;_0x2976a5['host']=intUtil[_0xbaf1('0x75')](_0x2976a5[_0xbaf1('0x76')]);_0x2976a5[_0xbaf1('0x77')]=intUtil[_0xbaf1('0x75')](_0x2976a5[_0xbaf1('0x77')]);if(_0x225183&&_0x225183['monitor_format']){logger['info'](_0xbaf1('0x78'),_0xbaf1('0x79'));_0x2c2e53[_0xbaf1('0x7a')]=_0x2976a5[_0xbaf1('0x77')]+_0xbaf1('0x7b')+_0x2c2e53[_0xbaf1('0x7c')]+_0xbaf1('0x7d')+md5(_0x2c2e53[_0xbaf1('0x7c')]);}else{_0x2c2e53[_0xbaf1('0x7a')]='';}var _0x27fba5=_0x2976a5['host']===_0xbaf1('0x7e')?'eu':_0xbaf1('0x7f');return getAccessToken(_0x2976a5)[_0xbaf1('0x26')](function(_0x335c01){_0x52c114=_0x335c01;return getUser(_0x52c114,_0x27fba5,_0x2976a5,_0xb3634c['email']);})[_0xbaf1('0x26')](function(_0x5cfb86){_0x141391=_0x5cfb86;logger[_0xbaf1('0x2a')](_0xbaf1('0x80'),_0x141391['id']);return getEndUser(_0x52c114,_0x27fba5,_0x2976a5,_0x2c2e53['calleridname'],_0x2c2e53[_0xbaf1('0x81')],_0x141391,_0x3d60a7);})[_0xbaf1('0x26')](function(_0x4f2500){_0x569a33=_0x4f2500;return getCall(_0x52c114,_0x27fba5,_0x2976a5,_0x141391,_0x569a33,_0x3d60a7,_0x2c2e53,_0xbaf1('0x82'));})['then'](function(_0xd4cc73){if(_0xd4cc73){logger['info'](_0xbaf1('0x83'),_0xd4cc73['id']);logger['info'](_0xbaf1('0x78'),_0xbaf1('0x84'));emit(util[_0xbaf1('0x2b')](_0xbaf1('0x85'),_0xb3634c[_0xbaf1('0x18')]),_0xbaf1('0x86'),{'uri':_0xbaf1('0x87')+_0x2976a5[_0xbaf1('0x76')]+_0xbaf1('0x88')+_0xd4cc73['id']});}})[_0xbaf1('0x28')](function(_0x51e9a2){logger[_0xbaf1('0x29')]('[QUEUE]',JSON[_0xbaf1('0xb')](_0x51e9a2));});};exports[_0xbaf1('0x89')]=function(_0x1ca3bb,_0x46d22e,_0x2e8e7f,_0xa089e4,_0x1ead7d,_0x293394,_0x4887ae){var _0x4777d4,_0x3dc5ed,_0xef5a49;_0x293394[_0xbaf1('0x76')]=intUtil[_0xbaf1('0x75')](_0x293394[_0xbaf1('0x76')]);_0x293394[_0xbaf1('0x77')]=intUtil['stripTrailingSlash'](_0x293394[_0xbaf1('0x77')]);if(_0x4887ae&&_0x4887ae[_0xbaf1('0x8a')]&&_0x4887ae[_0xbaf1('0x8a')]!=='none'){logger[_0xbaf1('0x2a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x46d22e[_0xbaf1('0x7a')]=_0x293394['serverUrl']+_0xbaf1('0x7b')+_0x46d22e[_0xbaf1('0x7c')]+_0xbaf1('0x7d')+md5(_0x46d22e[_0xbaf1('0x7c')]);}var _0x28121c=_0x293394[_0xbaf1('0x76')]===_0xbaf1('0x7e')?'eu':_0xbaf1('0x7f');return getAccessToken(_0x293394)[_0xbaf1('0x26')](function(_0x5e5fea){_0xef5a49=_0x5e5fea;return getUser(_0xef5a49,_0x28121c,_0x293394,_0xa089e4[_0xbaf1('0x31')]);})[_0xbaf1('0x26')](function(_0x3f7486){_0x4777d4=_0x3f7486;logger[_0xbaf1('0x2a')](_0xbaf1('0x80'),_0x4777d4['id']);return getEndUser(_0xef5a49,_0x28121c,_0x293394,_0x46d22e[_0xbaf1('0x8b')],_0x46d22e[_0xbaf1('0x8c')],_0x4777d4,_0x2e8e7f);})[_0xbaf1('0x26')](function(_0x401c2c){_0x3dc5ed=_0x401c2c;return getCall(_0xef5a49,_0x28121c,_0x293394,_0x4777d4,_0x3dc5ed,_0x2e8e7f,_0x46d22e,_0xbaf1('0x8d'));})['then'](function(_0x2f3d03){if(_0x2f3d03){logger[_0xbaf1('0x2a')](_0xbaf1('0x83'),_0x2f3d03['id']);logger[_0xbaf1('0x2a')](_0xbaf1('0x8e'),_0xbaf1('0x84'));emit(util['format'](_0xbaf1('0x85'),_0xa089e4[_0xbaf1('0x18')]),_0xbaf1('0x86'),{'uri':_0xbaf1('0x87')+_0x293394[_0xbaf1('0x76')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2f3d03['id']});}})[_0xbaf1('0x28')](function(_0x359b30){logger[_0xbaf1('0x29')](_0xbaf1('0x8e'),JSON['stringify'](_0x359b30));});};exports[_0xbaf1('0x8f')]=function(_0x10a6ce,_0x278744,_0x5b3b7d,_0x22e5cf,_0x149912,_0xc2d272){var _0x50a1e4,_0x34214d,_0x1d8794;_0xc2d272[_0xbaf1('0x76')]=intUtil[_0xbaf1('0x75')](_0xc2d272[_0xbaf1('0x76')]);_0xc2d272[_0xbaf1('0x77')]=intUtil[_0xbaf1('0x75')](_0xc2d272['serverUrl']);if(_0x149912&&_0x149912[_0xbaf1('0x90')]){logger['info']('['+_0x278744[_0xbaf1('0x64')][_0xbaf1('0x91')]()+']',_0xbaf1('0x79'));_0x278744['recordingURL']=_0xc2d272['serverUrl']+_0xbaf1('0x7b')+_0x278744['uniqueid']+_0xbaf1('0x7d')+md5(_0x278744['uniqueid']);}else{_0x278744[_0xbaf1('0x7a')]='';}var _0x209e9c=_0xc2d272[_0xbaf1('0x76')]==='zoho.eu'?'eu':_0xbaf1('0x7f');return getAccessToken(_0xc2d272)[_0xbaf1('0x26')](function(_0x4e1d55){_0x1d8794=_0x4e1d55;return getUser(_0x1d8794,_0x209e9c,_0xc2d272);})[_0xbaf1('0x26')](function(_0x52b00c){_0x50a1e4=_0x52b00c;logger[_0xbaf1('0x2a')]('The\x20User\x20ID\x20is:',_0x50a1e4['id']);return getEndUser(_0x1d8794,_0x209e9c,_0xc2d272,_0x278744[_0xbaf1('0x92')],_0x278744['calleridnum'],_0x50a1e4,_0x5b3b7d);})[_0xbaf1('0x26')](function(_0x467fa8){_0x34214d=_0x467fa8;return getCall(_0x1d8794,_0x209e9c,_0xc2d272,_0x50a1e4,_0x34214d,_0x5b3b7d,_0x278744,'Inbound');})[_0xbaf1('0x26')](function(_0x4be00c){if(_0x4be00c){logger[_0xbaf1('0x2a')](_0xbaf1('0x83'),_0x4be00c['id']);}})[_0xbaf1('0x28')](function(_0x5ecbd6){logger[_0xbaf1('0x29')]('['+_0x278744[_0xbaf1('0x64')][_0xbaf1('0x91')]()+']',JSON[_0xbaf1('0xb')](_0x5ecbd6));});}; \ No newline at end of file +var _0x547b=['uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','toUpperCase','/downloads?type=uniqueid&token=','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','[HTTP]','includes','string','picklist','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','findIndex','profile','user','Administrator','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','enduserType','https://www.zohoapis.','role','first_name','last_name','code','SUCCESS','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Contacts','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/'];(function(_0x10f99f,_0x3178f9){var _0x543b0b=function(_0x2c9108){while(--_0x2c9108){_0x10f99f['push'](_0x10f99f['shift']());}};_0x543b0b(++_0x3178f9);}(_0x547b,0x150));var _0xb547=function(_0x1c2ad7,_0x14b213){_0x1c2ad7=_0x1c2ad7-0x0;var _0xbc90c4=_0x547b[_0x1c2ad7];return _0xbc90c4;};'use strict';var _=require(_0xb547('0x0'));var rp=require(_0xb547('0x1'));var md5=require(_0xb547('0x2'));var util=require(_0xb547('0x3'));var intUtil=require(_0xb547('0x4'));var moment=require(_0xb547('0x5'));var Redis=require('ioredis');var BPromise=require(_0xb547('0x6'));var config=require(_0xb547('0x7'));var logger=require(_0xb547('0x8'))(_0xb547('0x9'));config['redis']=_[_0xb547('0xa')](config[_0xb547('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xb547('0xc'))(new Redis(config['redis']));function emit(_0x49a877,_0x21a532,_0x44b974){io['to'](_0x49a877)[_0xb547('0xd')](_0x21a532,_0x44b974);}function request(_0x2acded){logger['debug'](_0xb547('0xe'),JSON['stringify'](_0x2acded));return rp(_0x2acded);}function getCustomFields(_0x4fbea9,_0x1af461){var _0x30a360={};if(_0x4fbea9['length']>0x0){_['forEach'](_0x4fbea9,function(_0x5a0fc9){if(_[_0xb547('0xf')]([_0xb547('0x10'),_0xb547('0x11')],_0x5a0fc9[_0xb547('0x12')])&&_0x5a0fc9[_0xb547('0x13')]){_0x30a360[_0x5a0fc9[_0xb547('0x13')]]=_0x5a0fc9[_0xb547('0x14')]['toString']();}else if(_0x5a0fc9[_0xb547('0x12')]===_0xb547('0x15')&&_0x5a0fc9[_0xb547('0x16')]&&_0x5a0fc9[_0xb547('0x13')]&&_0x1af461[_0x5a0fc9[_0xb547('0x16')]]){_0x30a360[_0x5a0fc9[_0xb547('0x13')]]=_0x1af461[_0x5a0fc9[_0xb547('0x16')]][_0xb547('0x17')]();}else if(_0x5a0fc9[_0xb547('0x12')]==='customVariable'&&_0x5a0fc9[_0xb547('0x18')]&&_0x5a0fc9[_0xb547('0x18')][_0xb547('0x19')]&&_0x5a0fc9[_0xb547('0x13')]&&_0x1af461[_0x5a0fc9[_0xb547('0x18')][_0xb547('0x19')][_0xb547('0x1a')]()]){_0x30a360[_0x5a0fc9[_0xb547('0x13')]]=_0x1af461[_0x5a0fc9['Variable'][_0xb547('0x19')]['toLowerCase']()][_0xb547('0x17')]();}});}return _0x30a360;}function getName(_0x253626){if(_0x253626[_0xb547('0x1b')]('\x20')>0x0){var _0x4cd4bc=_0x253626[_0xb547('0x1c')](/ (.+)/);if(_0x4cd4bc[0x1]){return _0x4cd4bc;}}return[_0x253626,_0x253626];}var accountsTokens={};function getAccessToken(_0x1a751e){return new Promise(function(_0x5cc2ff,_0xa56a00){if(!_[_0xb547('0x1d')](accountsTokens[_0x1a751e['id']])&&!_[_0xb547('0x1d')](accountsTokens[_0x1a751e['id']][_0xb547('0x1e')])){if(moment()[_0xb547('0x1f')](accountsTokens[_0x1a751e['id']][_0xb547('0x20')])){_0x5cc2ff(accountsTokens[_0x1a751e['id']][_0xb547('0x1e')]);}}var _0x4d0492;switch(_0x1a751e['zone']){case'US':_0x4d0492=_0xb547('0x21');break;case'AU':_0x4d0492=_0xb547('0x22');break;case'EU':_0x4d0492=_0xb547('0x23');break;case'IN':_0x4d0492=_0xb547('0x24');break;case'CN':_0x4d0492=_0xb547('0x25');break;default:_0x4d0492=_0xb547('0x23');break;}var _0x2b9b6b={'method':_0xb547('0x26'),'uri':_0x4d0492+'/oauth/v2/token','qs':{'refresh_token':_0x1a751e[_0xb547('0x27')],'client_id':_0x1a751e[_0xb547('0x28')],'client_secret':_0x1a751e['clientSecret'],'grant_type':_0xb547('0x29')},'json':!![]};return rp(_0x2b9b6b)['then'](function(_0x5e29b5){accountsTokens[_0x1a751e['id']]={'access_token':_0x5e29b5['access_token'],'expires_in':moment()['add'](_0x5e29b5['expires_in'],'seconds')};_0x5cc2ff(_0x5e29b5[_0xb547('0x1e')]);})[_0xb547('0x2a')](function(_0x314bae){logger['error'](_0xb547('0x2b'),_0x314bae[_0xb547('0x2c')]);_0xa56a00(_0x314bae);});});}function getUser(_0x529a6a,_0x331f33,_0x4456ee,_0x44f127){logger[_0xb547('0x2d')](_0xb547('0x2e'));return request({'method':_0xb547('0x2f'),'uri':util[_0xb547('0x30')](_0xb547('0x31'),_0x331f33),'qs':{'type':_0xb547('0x32')},'headers':{'Authorization':_0xb547('0x33')+_0x529a6a},'json':!![]})['then'](function(_0x382fb9){if(_0x382fb9['users']){var _0x4e8439=-0x1;if(_['isArrayLikeObject'](_0x382fb9[_0xb547('0x34')])){if(!_[_0xb547('0x1d')](_0x44f127)){_0x4e8439=_['findIndex'](_0x382fb9[_0xb547('0x34')],function(_0x1f368d){return _0x1f368d[_0xb547('0x35')]===_0x44f127;});}if(_0x4e8439>=0x0){logger[_0xb547('0x2d')](_0xb547('0x36'));}else{logger[_0xb547('0x2d')]('Using\x20the\x20admin\x20account!');_0x4e8439=_[_0xb547('0x37')](_0x382fb9[_0xb547('0x34')],function(_0x1e2b91){return _0x1e2b91[_0xb547('0x38')]['name']==='Administrator';});}return _0x382fb9[_0xb547('0x34')][_0x4e8439];}else{if(_0x382fb9[_0xb547('0x39')][_0xb547('0x38')][_0xb547('0x19')]===_0xb547('0x3a')){logger[_0xb547('0x2d')]('Using\x20the\x20admin\x20account!');user=_0x382fb9['user'];return user;}else{logger[_0xb547('0x3b')](_0xb547('0x3c'),JSON[_0xb547('0x3d')](_0x382fb9));throw new Error(_0xb547('0x3e')+JSON[_0xb547('0x3d')](_0x382fb9));}}}else{logger[_0xb547('0x3b')](_0xb547('0x3c'),JSON[_0xb547('0x3d')](_0x382fb9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xb547('0x3d')](_0x382fb9));}})[_0xb547('0x2a')](function(_0x341bc6){console[_0xb547('0x3b')](_0x341bc6);});}function getZohoUser(_0x5c5de0,_0x82aa12){return new BPromise(function(_0x1096a0,_0xd8b1b9){request(_0x5c5de0)[_0xb547('0x3f')](function(_0x29350b){var _0x17e1f2=null;if(_0x29350b){_0x17e1f2=_0x29350b[_0xb547('0x40')][0x0];_0x17e1f2[_0xb547('0x41')]=_0x82aa12;}_0x1096a0(_0x17e1f2);})[_0xb547('0x2a')](function(_0xb54a0f){_0xd8b1b9(_0xb54a0f);});});}function createEndUser(_0x56ba18,_0x54fbcd,_0xe025fe,_0x21f799,_0xe2d6ca,_0x2d288){var _0xe025fe=getName(_0xe025fe);return request({'method':'POST','uri':_0xb547('0x42')+_0x54fbcd+'/crm/v2/'+_['startCase'](_0x2d288['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xe025fe[0x1],'First_Name':_0xe025fe[0x0],'Phone':_0x21f799,'Owner':{'name':!_[_0xb547('0x1d')](_0xe2d6ca[_0xb547('0x43')][_0xb547('0x19')])?_0xe2d6ca[_0xb547('0x43')][_0xb547('0x19')]:!_['isNil'](_0xe2d6ca[_0xb547('0x44')])?_0xe2d6ca[_0xb547('0x44')]+'\x20'+_0xe2d6ca['last_name']:_0xe2d6ca[_0xb547('0x45')],'id':_0xe2d6ca['id']}}]},'headers':{'Authorization':_0xb547('0x33')+_0x56ba18},'json':!![]})[_0xb547('0x3f')](function(_0x14e143){if(_0x14e143&&_0x14e143[_0xb547('0x40')][0x0][_0xb547('0x46')]===_0xb547('0x47')){var _0x3cb2d5=_0x14e143[_0xb547('0x40')][0x0]['details'];_0x3cb2d5[_0xb547('0x41')]=_['startCase'](_0x2d288[_0xb547('0x48')])+'s';return _0x3cb2d5;}logger[_0xb547('0x3b')](_0xb547('0x3c'),JSON[_0xb547('0x3d')](data));throw new Error(_0xb547('0x49')+JSON[_0xb547('0x3d')](data));})['catch'](function(_0x13305d){console[_0xb547('0x4a')](_0xb547('0x4b'),_0x13305d);});}function getEndUser(_0x1d46c9,_0x5896b1,_0xa1ef67,_0x438269,_0x4a61d5,_0x30243e,_0x23132b){var _0x20d393={'method':'GET','uri':'','headers':{'Authorization':_0xb547('0x33')+_0x1d46c9},'json':!![]};switch(_0x23132b[_0xb547('0x4c')]){case _0xb547('0x4d'):_0x20d393[_0xb547('0x4e')]='https://www.zohoapis.'+_0x5896b1+_0xb547('0x4f')+_0x4a61d5+'))';return getZohoUser(_0x20d393,'Contacts')[_0xb547('0x3f')](function(_0x186c14){if(_0x186c14)return _0x186c14;_0x20d393[_0xb547('0x4e')]=_0xb547('0x42')+_0x5896b1+_0xb547('0x50')+_0x4a61d5+'))';return getZohoUser(_0x20d393,'Leads')[_0xb547('0x3f')](function(_0x482011){if(_0x482011)return _0x482011;if(_0x23132b[_0xb547('0x48')]!=_0xb547('0x51')){return createEndUser(_0x1d46c9,_0x5896b1,_0x438269,_0x4a61d5,_0x30243e,_0x23132b);}else{return{};}});});break;case _0xb547('0x52'):_0x20d393[_0xb547('0x4e')]=_0xb547('0x42')+_0x5896b1+_0xb547('0x4f')+_0x4a61d5+'))';return getZohoUser(_0x20d393,_0xb547('0x53'))[_0xb547('0x3f')](function(_0x1fdda9){if(_0x1fdda9)return _0x1fdda9;if(_0x23132b[_0xb547('0x48')]!=_0xb547('0x51')){return createEndUser(_0x1d46c9,_0x5896b1,_0x438269,_0x4a61d5,_0x30243e,_0x23132b);}else{return{};}});break;case _0xb547('0x54'):_0x20d393[_0xb547('0x4e')]=_0xb547('0x42')+_0x5896b1+_0xb547('0x50')+_0x4a61d5+'))';return getZohoUser(_0x20d393,_0xb547('0x55'))['then'](function(_0x61d82e){if(_0x61d82e)return _0x61d82e;if(_0x23132b[_0xb547('0x48')]!=_0xb547('0x51')){return createEndUser(_0x1d46c9,_0x5896b1,_0x438269,_0x4a61d5,_0x30243e,_0x23132b);}else{return{};}});break;}}function getCall(_0x3baba4,_0x2dc520,_0x545972,_0x459575,_0x2255cd,_0x439340,_0x331d92,_0x2e3981){logger[_0xb547('0x2d')](_0xb547('0x56'));var _0x28d732={};_0x28d732[_0xb547('0x57')]={'name':!_[_0xb547('0x1d')](_0x459575[_0xb547('0x43')][_0xb547('0x19')])&&!_[_0xb547('0x1d')](_0x459575[_0xb547('0x38')][_0xb547('0x19')])&&_0x459575[_0xb547('0x38')]['name']===_0xb547('0x58')?_0x459575[_0xb547('0x43')][_0xb547('0x19')]:!_[_0xb547('0x1d')](_0x459575['first_name'])?_0x459575[_0xb547('0x44')]+'\x20'+_0x459575[_0xb547('0x45')]:_0x459575[_0xb547('0x45')],'id':_0x459575['id']};_0x28d732[_0xb547('0x59')]=intUtil['getString'](_0x439340[_0xb547('0x5a')],_0x331d92,'\x20');_0x28d732[_0xb547('0x5b')]=intUtil[_0xb547('0x5c')](_0x439340[_0xb547('0x5d')],_0x331d92,'\x0a');if(_0x2255cd['enduserType']===_0xb547('0x53')){_0x28d732[_0xb547('0x5e')]={'name':!_[_0xb547('0x1d')](_0x2255cd[_0xb547('0x5f')])?_0x2255cd[_0xb547('0x5f')]:!_[_0xb547('0x1d')](_0x2255cd['First_Name'])?_0x2255cd[_0xb547('0x60')]+'\x20'+_0x2255cd['Last_Name']:_0x2255cd[_0xb547('0x61')],'id':_0x2255cd['id']};}if(_0x2255cd[_0xb547('0x41')]===_0xb547('0x55')){_0x28d732[_0xb547('0x62')]={'name':!_[_0xb547('0x1d')](_0x2255cd[_0xb547('0x5f')])?_0x2255cd[_0xb547('0x5f')]:!_[_0xb547('0x1d')](_0x2255cd[_0xb547('0x60')])?_0x2255cd[_0xb547('0x60')]+'\x20'+_0x2255cd[_0xb547('0x61')]:_0x2255cd[_0xb547('0x61')],'id':_0x2255cd['id']};_0x28d732[_0xb547('0x63')]=_[_0xb547('0x64')](_0x2255cd[_0xb547('0x41')]);}if(_0x331d92['talktime']){_0x28d732['Call_Duration']=moment[_0xb547('0x65')](parseInt(_0x331d92[_0xb547('0x66')])*0x3e8)['format'](_0xb547('0x67'));}else if(_0x331d92[_0xb547('0x68')]&&_0x331d92[_0xb547('0x69')]){_0x28d732['Call_Duration']=moment[_0xb547('0x65')](moment(_0x331d92[_0xb547('0x69')],_0xb547('0x6a'))[_0xb547('0x6b')](moment(_0x331d92[_0xb547('0x6c')],_0xb547('0x6a'))))['format'](_0xb547('0x67'));}switch(_0x331d92[_0xb547('0x6d')]){case _0xb547('0x6e'):_0x28d732[_0xb547('0x6f')]=_0xb547('0x70');break;case'complete':case _0xb547('0x71'):_0x28d732['Call_Result']=_0xb547('0x72');break;case _0xb547('0x73'):_0x28d732['Call_Result']=_0xb547('0x74');break;case'abandoned':_0x28d732[_0xb547('0x6f')]=_0xb547('0x75');break;case _0xb547('0x76'):_0x28d732[_0xb547('0x6f')]='Timeout';default:}_0x28d732[_0xb547('0x77')]=(_0x2e3981===_0xb547('0x78')?moment(_0x331d92[_0xb547('0x6c')])[_0xb547('0x30')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x331d92[_0xb547('0x79')])[_0xb547('0x30')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xb547('0x30')](_0xb547('0x6a'));_0x28d732[_0xb547('0x7a')]=_0x2e3981||_0xb547('0x7b');_0x28d732=_[_0xb547('0x7c')](_0x28d732,getCustomFields(_0x439340['Fields'],_0x331d92));return request({'method':'POST','uri':_0xb547('0x42')+_0x2dc520+_0xb547('0x7d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3baba4},'body':{'data':[_0x28d732]},'json':!![]})[_0xb547('0x3f')](function(_0xd8ed77){if(_0xd8ed77&&_0xd8ed77[_0xb547('0x40')][0x0][_0xb547('0x46')]===_0xb547('0x47')){logger['info'](_0xb547('0x7e'));return{'id':_0xd8ed77[_0xb547('0x40')][0x0][_0xb547('0x7f')]['id']};}})['catch'](function(_0x451888){logger[_0xb547('0x2d')](_0xb547('0x80'),_0x451888[_0xb547('0x2c')]);console[_0xb547('0x4a')](_0xb547('0x80'),_0x451888);});}exports[_0xb547('0x81')]=function(_0x2952bf,_0x4ce553,_0x317a0a,_0x42c4fb,_0x539e56,_0x21efbc){var _0x3280af,_0x341d24,_0xff634a;_0x21efbc[_0xb547('0x82')]=intUtil[_0xb547('0x83')](_0x21efbc[_0xb547('0x82')]);_0x21efbc[_0xb547('0x84')]=intUtil[_0xb547('0x83')](_0x21efbc[_0xb547('0x84')]);if(_0x539e56&&_0x539e56[_0xb547('0x85')]){logger[_0xb547('0x2d')](_0xb547('0x86'),_0xb547('0x87'));_0x4ce553[_0xb547('0x88')]=_0x21efbc[_0xb547('0x84')]+_0xb547('0x89')+_0x4ce553[_0xb547('0x8a')]+'/downloads?type=uniqueid&token='+md5(_0x4ce553[_0xb547('0x8a')]);}else{_0x4ce553[_0xb547('0x88')]='';}var _0x4ba5e1=_0x21efbc[_0xb547('0x82')]===_0xb547('0x8b')?'eu':_0xb547('0x8c');return getAccessToken(_0x21efbc)[_0xb547('0x3f')](function(_0x3c04ad){_0xff634a=_0x3c04ad;return getUser(_0xff634a,_0x4ba5e1,_0x21efbc,_0x42c4fb[_0xb547('0x35')]);})[_0xb547('0x3f')](function(_0x27649e){_0x3280af=_0x27649e;logger[_0xb547('0x2d')](_0xb547('0x8d'),_0x3280af['id']);return getEndUser(_0xff634a,_0x4ba5e1,_0x21efbc,_0x4ce553[_0xb547('0x8e')],_0x4ce553['calleridnum'],_0x3280af,_0x317a0a);})['then'](function(_0x48903d){_0x341d24=_0x48903d;return getCall(_0xff634a,_0x4ba5e1,_0x21efbc,_0x3280af,_0x341d24,_0x317a0a,_0x4ce553,_0xb547('0x7b'));})[_0xb547('0x3f')](function(_0x4bd339){if(_0x4bd339){logger[_0xb547('0x2d')](_0xb547('0x8f'),_0x4bd339['id']);logger[_0xb547('0x2d')](_0xb547('0x86'),_0xb547('0x90'));emit(util[_0xb547('0x30')]('user:%s',_0x42c4fb[_0xb547('0x19')]),_0xb547('0x91'),{'uri':_0xb547('0x92')+_0x21efbc[_0xb547('0x82')]+_0xb547('0x93')+_0x4bd339['id']});}})['catch'](function(_0x2ddf4d){logger[_0xb547('0x3b')]('[QUEUE]',JSON['stringify'](_0x2ddf4d));});};exports[_0xb547('0x78')]=function(_0x1759b1,_0x56e002,_0x2f7124,_0x32db3b,_0x26cdc5,_0x160880,_0x2746f6){var _0x4e1a5a,_0x345d67,_0x48402e;_0x160880[_0xb547('0x82')]=intUtil['stripTrailingSlash'](_0x160880[_0xb547('0x82')]);_0x160880[_0xb547('0x84')]=intUtil[_0xb547('0x83')](_0x160880[_0xb547('0x84')]);if(_0x2746f6&&_0x2746f6[_0xb547('0x94')]&&_0x2746f6[_0xb547('0x94')]!==_0xb547('0x95')){logger[_0xb547('0x2d')](_0xb547('0x96'),'Recording\x20is\x20enabled!');_0x56e002[_0xb547('0x88')]=_0x160880[_0xb547('0x84')]+_0xb547('0x89')+_0x56e002[_0xb547('0x8a')]+'/downloads?type=uniqueid&token='+md5(_0x56e002['uniqueid']);}var _0x456561=_0x160880[_0xb547('0x82')]==='zoho.eu'?'eu':_0xb547('0x8c');return getAccessToken(_0x160880)[_0xb547('0x3f')](function(_0x52efd3){_0x48402e=_0x52efd3;return getUser(_0x48402e,_0x456561,_0x160880,_0x32db3b[_0xb547('0x35')]);})[_0xb547('0x3f')](function(_0x2320b2){_0x4e1a5a=_0x2320b2;logger['info'](_0xb547('0x8d'),_0x4e1a5a['id']);return getEndUser(_0x48402e,_0x456561,_0x160880,_0x56e002[_0xb547('0x97')],_0x56e002[_0xb547('0x98')],_0x4e1a5a,_0x2f7124);})['then'](function(_0xf1ae81){_0x345d67=_0xf1ae81;return getCall(_0x48402e,_0x456561,_0x160880,_0x4e1a5a,_0x345d67,_0x2f7124,_0x56e002,_0xb547('0x99'));})['then'](function(_0x5b5942){if(_0x5b5942){logger[_0xb547('0x2d')](_0xb547('0x8f'),_0x5b5942['id']);logger[_0xb547('0x2d')](_0xb547('0x96'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb547('0x30')](_0xb547('0x9a'),_0x32db3b[_0xb547('0x19')]),_0xb547('0x91'),{'uri':_0xb547('0x92')+_0x160880['host']+_0xb547('0x93')+_0x5b5942['id']});}})[_0xb547('0x2a')](function(_0x2e028e){logger[_0xb547('0x3b')](_0xb547('0x96'),JSON['stringify'](_0x2e028e));});};exports[_0xb547('0x9b')]=function(_0x3afc8f,_0x9a650d,_0x437b0c,_0x1b4b83,_0x1f8d6d,_0x3663a0){var _0x270501,_0x1f195f,_0x22ede1;_0x3663a0['host']=intUtil['stripTrailingSlash'](_0x3663a0[_0xb547('0x82')]);_0x3663a0[_0xb547('0x84')]=intUtil[_0xb547('0x83')](_0x3663a0[_0xb547('0x84')]);if(_0x1f8d6d&&_0x1f8d6d[_0xb547('0x85')]){logger['info']('['+_0x9a650d['lastevent'][_0xb547('0x9c')]()+']',_0xb547('0x87'));_0x9a650d[_0xb547('0x88')]=_0x3663a0[_0xb547('0x84')]+_0xb547('0x89')+_0x9a650d[_0xb547('0x8a')]+_0xb547('0x9d')+md5(_0x9a650d[_0xb547('0x8a')]);}else{_0x9a650d[_0xb547('0x88')]='';}var _0x1b7cd7=_0x3663a0[_0xb547('0x82')]===_0xb547('0x8b')?'eu':_0xb547('0x8c');return getAccessToken(_0x3663a0)['then'](function(_0x53179b){_0x22ede1=_0x53179b;return getUser(_0x22ede1,_0x1b7cd7,_0x3663a0);})[_0xb547('0x3f')](function(_0x2a7b0c){_0x270501=_0x2a7b0c;logger[_0xb547('0x2d')](_0xb547('0x8d'),_0x270501['id']);return getEndUser(_0x22ede1,_0x1b7cd7,_0x3663a0,_0x9a650d['calleridname'],_0x9a650d['calleridnum'],_0x270501,_0x437b0c);})['then'](function(_0x306cda){_0x1f195f=_0x306cda;return getCall(_0x22ede1,_0x1b7cd7,_0x3663a0,_0x270501,_0x1f195f,_0x437b0c,_0x9a650d,_0xb547('0x7b'));})['then'](function(_0x434988){if(_0x434988){logger[_0xb547('0x2d')](_0xb547('0x8f'),_0x434988['id']);}})[_0xb547('0x2a')](function(_0x2a7df8){logger['error']('['+_0x9a650d['lastevent'][_0xb547('0x9c')]()+']',JSON[_0xb547('0x3d')](_0x2a7df8));});}; \ 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 7da9316..0077aff 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 _0xb381=['Script','data3','render','exec','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','util','shelljs','mustache','../../../../config/logger','trigger','data2'];(function(_0x32814c,_0x2a68f5){var _0x394c8d=function(_0x10d48e){while(--_0x10d48e){_0x32814c['push'](_0x32814c['shift']());}};_0x394c8d(++_0x2a68f5);}(_0xb381,0xa2));var _0x1b38=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb381[_0x1cb18a];return _0x22442e;};'use strict';var util=require(_0x1b38('0x0'));var sh=require(_0x1b38('0x1'));var Mustache=require(_0x1b38('0x2'));var logger=require(_0x1b38('0x3'))(_0x1b38('0x4'));exports['exec']=function(_0x90b9ec,_0x3b3dca){var _0x454bf2=_0x90b9ec[_0x1b38('0x5')]?_0x90b9ec['data2']:_0x1b38('0x6');var _0x4fcfe2=_0x90b9ec[_0x1b38('0x7')]?Mustache[_0x1b38('0x8')](_0x90b9ec['data3'],_0x3b3dca):_0x3b3dca;sh[_0x1b38('0x9')](_0x4fcfe2,function(_0x26e290,_0x1fc5ee,_0x54c1ba){if(_0x26e290!==0x0){logger['error'](util[_0x1b38('0xa')](_0x1b38('0xb'),_0x454bf2,_0x4fcfe2,_0x26e290,_0x54c1ba));}else{logger[_0x1b38('0xc')](util['format'](_0x1b38('0xd'),_0x454bf2,_0x4fcfe2,_0x1fc5ee));}});}; \ No newline at end of file +var _0x895b=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','trigger','exec','data2','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format'];(function(_0x1016e3,_0x5b818e){var _0x131c06=function(_0x473d37){while(--_0x473d37){_0x1016e3['push'](_0x1016e3['shift']());}};_0x131c06(++_0x5b818e);}(_0x895b,0x1af));var _0xb895=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x895b[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var sh=require(_0xb895('0x0'));var Mustache=require(_0xb895('0x1'));var logger=require('../../../../config/logger')(_0xb895('0x2'));exports[_0xb895('0x3')]=function(_0x4790ff,_0x4a59a4){var _0x232326=_0x4790ff['data2']?_0x4790ff[_0xb895('0x4')]:'Script';var _0x2d0c29=_0x4790ff[_0xb895('0x5')]?Mustache['render'](_0x4790ff[_0xb895('0x5')],_0x4a59a4):_0x4a59a4;sh['exec'](_0x2d0c29,function(_0x3adfe2,_0x470adc,_0x100f4c){if(_0x3adfe2!==0x0){logger[_0xb895('0x6')](util['format'](_0xb895('0x7'),_0x232326,_0x2d0c29,_0x3adfe2,_0x100f4c));}else{logger['info'](util[_0xb895('0x8')](_0xb895('0x9'),_0x232326,_0x2d0c29,_0x470adc));}});}; \ 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 deeaf3d..f459acd 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 _0x86be=['stack','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then',',\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','util','mustache','exec','data1','toUpperCase','render','data2','number','data5','parse','data6','error'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x86be,0xd4));var _0xe86b=function(_0x4e0210,_0x263fe1){_0x4e0210=_0x4e0210-0x0;var _0x3ee4b3=_0x86be[_0x4e0210];return _0x3ee4b3;};'use strict';var rp=require('request-promise');var util=require(_0xe86b('0x0'));var _=require('lodash');var Mustache=require(_0xe86b('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0xe86b('0x2')]=function(_0x1a827b,_0x5d759c){var _0x531883,_0xfdd7c0;var _0x4defa5={'method':_0x1a827b[_0xe86b('0x3')][_0xe86b('0x4')](),'uri':Mustache[_0xe86b('0x5')](_0x1a827b[_0xe86b('0x6')],_0x5d759c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1a827b['data5'])===_0xe86b('0x7')&&parseInt(_0x1a827b[_0xe86b('0x8')])>=0x1&&parseInt(_0x1a827b[_0xe86b('0x8')])<=0xa?parseInt(_0x1a827b['data5'])*0x3e8:0x5*0x3e8};try{_0x4defa5['headers']=_0x1a827b['data6']?JSON[_0xe86b('0x9')](Mustache[_0xe86b('0x5')](_0x1a827b[_0xe86b('0xa')],_0x5d759c)):{};}catch(_0xc59785){logger[_0xe86b('0xb')](_0xc59785[_0xe86b('0xc')]);}switch(_0x1a827b['data1'][_0xe86b('0x4')]()){case _0xe86b('0xd'):case _0xe86b('0xe'):_0x531883=null;_0x4defa5['qs']=_0x5d759c;break;case _0xe86b('0xf'):case _0xe86b('0x10'):if(_0x1a827b[_0xe86b('0x11')]){try{_0x531883=JSON[_0xe86b('0x9')](Mustache['render'](_0x1a827b[_0xe86b('0x11')],_0x5d759c));_0x4defa5['body']=_0x531883;}catch(_0x5dd33b){logger['error'](_0x5dd33b[_0xe86b('0xc')]);logger['error'](_0xe86b('0x12'));}}else{_0x531883=_0x5d759c;_0x4defa5[_0xe86b('0x13')]=_0x531883;}break;}logger[_0xe86b('0x14')](util[_0xe86b('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x1a827b[_0xe86b('0x3')],_0x1a827b[_0xe86b('0x6')],JSON[_0xe86b('0x16')](_0x4defa5)));rp(_0x4defa5)[_0xe86b('0x17')](function(_0x3e1f1c){_0x531883=!_['isNil'](_0x531883)?_0xe86b('0x18')+_0x531883:'';_0xfdd7c0=typeof _0x3e1f1c[_0xe86b('0x13')]===_0xe86b('0x19')?JSON[_0xe86b('0x16')](_0x3e1f1c[_0xe86b('0x13')]):_0x3e1f1c[_0xe86b('0x13')];logger['info'](util[_0xe86b('0x15')](_0xe86b('0x1a'),_0x1a827b[_0xe86b('0x3')],_0x1a827b['data2'],_0x3e1f1c[_0xe86b('0x1b')],_0xfdd7c0));})[_0xe86b('0x1c')](function(_0xaa8c7b){logger['error'](util[_0xe86b('0x15')](_0xe86b('0x1d'),_0x1a827b[_0xe86b('0x3')],_0x1a827b[_0xe86b('0x6')],_0xaa8c7b['statusCode'],_0xaa8c7b[_0xe86b('0x1e')],_0xaa8c7b[_0xe86b('0x1f')]));});}; \ No newline at end of file +var _0x6ebd=['POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','data5','number','headers','data6','stack','toUpperCase','DELETE'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6ebd,0x164));var _0xd6eb=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x6ebd[_0x37bd26];return _0xe83dc4;};'use strict';var rp=require(_0xd6eb('0x0'));var util=require('util');var _=require(_0xd6eb('0x1'));var Mustache=require(_0xd6eb('0x2'));var logger=require(_0xd6eb('0x3'))(_0xd6eb('0x4'));exports[_0xd6eb('0x5')]=function(_0x2e2cfa,_0x3fa710){var _0x1aec03,_0x320c67;var _0x3eb6be={'method':_0x2e2cfa[_0xd6eb('0x6')]['toUpperCase'](),'uri':Mustache[_0xd6eb('0x7')](_0x2e2cfa[_0xd6eb('0x8')],_0x3fa710),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2e2cfa[_0xd6eb('0x9')])===_0xd6eb('0xa')&&parseInt(_0x2e2cfa['data5'])>=0x1&&parseInt(_0x2e2cfa[_0xd6eb('0x9')])<=0xa?parseInt(_0x2e2cfa['data5'])*0x3e8:0x5*0x3e8};try{_0x3eb6be[_0xd6eb('0xb')]=_0x2e2cfa[_0xd6eb('0xc')]?JSON['parse'](Mustache[_0xd6eb('0x7')](_0x2e2cfa[_0xd6eb('0xc')],_0x3fa710)):{};}catch(_0x3d0c4f){logger['error'](_0x3d0c4f[_0xd6eb('0xd')]);}switch(_0x2e2cfa['data1'][_0xd6eb('0xe')]()){case'GET':case _0xd6eb('0xf'):_0x1aec03=null;_0x3eb6be['qs']=_0x3fa710;break;case _0xd6eb('0x10'):case _0xd6eb('0x11'):if(_0x2e2cfa[_0xd6eb('0x12')]){try{_0x1aec03=JSON['parse'](Mustache['render'](_0x2e2cfa[_0xd6eb('0x12')],_0x3fa710));_0x3eb6be[_0xd6eb('0x13')]=_0x1aec03;}catch(_0x17df45){logger[_0xd6eb('0x14')](_0x17df45['stack']);logger[_0xd6eb('0x14')](_0xd6eb('0x15'));}}else{_0x1aec03=_0x3fa710;_0x3eb6be[_0xd6eb('0x13')]=_0x1aec03;}break;}logger[_0xd6eb('0x16')](util[_0xd6eb('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2e2cfa['data1'],_0x2e2cfa[_0xd6eb('0x8')],JSON[_0xd6eb('0x18')](_0x3eb6be)));rp(_0x3eb6be)[_0xd6eb('0x19')](function(_0x4999a2){_0x1aec03=!_['isNil'](_0x1aec03)?_0xd6eb('0x1a')+_0x1aec03:'';_0x320c67=typeof _0x4999a2[_0xd6eb('0x13')]===_0xd6eb('0x1b')?JSON['stringify'](_0x4999a2[_0xd6eb('0x13')]):_0x4999a2[_0xd6eb('0x13')];logger['info'](util[_0xd6eb('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2e2cfa[_0xd6eb('0x6')],_0x2e2cfa['data2'],_0x4999a2['statusCode'],_0x320c67));})['catch'](function(_0x378fe0){logger[_0xd6eb('0x14')](util[_0xd6eb('0x17')](_0xd6eb('0x1c'),_0x2e2cfa['data1'],_0x2e2cfa[_0xd6eb('0x8')],_0x378fe0[_0xd6eb('0x1d')],_0x378fe0[_0xd6eb('0x1e')],_0x378fe0['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 555df7e..6c1f76b 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 _0x37ce=['error','message','result','jayson/promise','../../config/logger','routing','client','http','request','then','debug','rpc'];(function(_0xb42172,_0x45dc1b){var _0x4d8aa4=function(_0x5846b5){while(--_0x5846b5){_0xb42172['push'](_0xb42172['shift']());}};_0x4d8aa4(++_0x45dc1b);}(_0x37ce,0x87));var _0xe37c=function(_0x56e43d,_0x50c51d){_0x56e43d=_0x56e43d-0x0;var _0x5028cf=_0x37ce[_0x56e43d];return _0x5028cf;};'use strict';var jayson=require(_0xe37c('0x0'));var BPromise=require('bluebird');var logger=require(_0xe37c('0x1'))(_0xe37c('0x2'));var client=jayson[_0xe37c('0x3')][_0xe37c('0x4')]({'port':0x2329});client['Request']=function(_0x2587bd,_0x5c0cf7){return new BPromise(function(_0x39db0f,_0x2878d9){return client[_0xe37c('0x5')](_0x2587bd,_0x5c0cf7)[_0xe37c('0x6')](function(_0x5acfa9){logger[_0xe37c('0x7')](_0xe37c('0x8'),_0xe37c('0x2'),_0x2587bd,_0x5c0cf7,_0x5acfa9);if(_0x5acfa9[_0xe37c('0x9')]){logger['error'](_0xe37c('0x8'),'routing',_0x2587bd,_0x5acfa9[_0xe37c('0x9')][_0xe37c('0xa')],_0x5c0cf7);return _0x2878d9(_0x5acfa9['error'][_0xe37c('0xa')]);}else{return _0x39db0f(_0x5acfa9[_0xe37c('0xb')]);}})['catch'](function(_0x553591){logger[_0xe37c('0x9')]('rpc',_0xe37c('0x2'),_0x2587bd,_0x553591,_0x5c0cf7);return _0x2878d9(_0x553591);});});};module['exports']=client; \ No newline at end of file +var _0xb90e=['then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client','http','request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb90e,0x166));var _0xeb90=function(_0xf705a6,_0x5720ce){_0xf705a6=_0xf705a6-0x0;var _0x443eb5=_0xb90e[_0xf705a6];return _0x443eb5;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xeb90('0x0'));var logger=require(_0xeb90('0x1'))(_0xeb90('0x2'));var client=jayson[_0xeb90('0x3')][_0xeb90('0x4')]({'port':0x2329});client['Request']=function(_0x5e6051,_0x20a10f){return new BPromise(function(_0x420fe7,_0x3130c9){return client[_0xeb90('0x5')](_0x5e6051,_0x20a10f)[_0xeb90('0x6')](function(_0x5992c2){logger[_0xeb90('0x7')](_0xeb90('0x8'),_0xeb90('0x2'),_0x5e6051,_0x20a10f,_0x5992c2);if(_0x5992c2[_0xeb90('0x9')]){logger[_0xeb90('0x9')](_0xeb90('0x8'),_0xeb90('0x2'),_0x5e6051,_0x5992c2[_0xeb90('0x9')]['message'],_0x20a10f);return _0x3130c9(_0x5992c2[_0xeb90('0x9')][_0xeb90('0xa')]);}else{return _0x420fe7(_0x5992c2[_0xeb90('0xb')]);}})[_0xeb90('0xc')](function(_0x1a874a){logger[_0xeb90('0x9')](_0xeb90('0x8'),_0xeb90('0x2'),_0x5e6051,_0x1a874a,_0x20a10f);return _0x3130c9(_0x1a874a);});});};module[_0xeb90('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e948ebb..d2129e5 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 _0xd74e=['initMailAccounts','refresh','mailAccounts','listen','catch','./realtime','../../config/logger','email','resolve','then','getMailAccounts'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xd74e,0x165));var _0xed74=function(_0x185aae,_0x4ff40a){_0x185aae=_0x185aae-0x0;var _0x22d9b0=_0xd74e[_0x185aae];return _0x22d9b0;};'use strict';var server=require('./server');var Realtime=require(_0xed74('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xed74('0x1'))(_0xed74('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xed74('0x3')]()[_0xed74('0x4')](mailAccount[_0xed74('0x5')]())[_0xed74('0x4')](realtime[_0xed74('0x6')]())[_0xed74('0x4')](function(){email[_0xed74('0x7')](realtime[_0xed74('0x8')]);return realtime;});}function main(){return server[_0xed74('0x9')](realtime,email)[_0xed74('0x4')](function(){return initRealtime();})[_0xed74('0x4')](function(){return setting['getSettings']();})[_0xed74('0x4')](function(_0x48739e){return setInterval(initRealtime,_0x48739e['loginMailFrequency']*0x3e8);})[_0xed74('0xa')](function(_0x5a2b26){logger['error']('Email\x20service\x20initialization',_0x5a2b26);});}main(); \ No newline at end of file +var _0xe4e2=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe4e2,0xf0));var _0x2e4e=function(_0x41b8fa,_0x5b9877){_0x41b8fa=_0x41b8fa-0x0;var _0x5ba5aa=_0xe4e2[_0x41b8fa];return _0x5ba5aa;};'use strict';var server=require(_0x2e4e('0x0'));var Realtime=require(_0x2e4e('0x1'));var EmailChannel=require(_0x2e4e('0x2'));var mailAccount=require(_0x2e4e('0x3'));var setting=require(_0x2e4e('0x4'));var logger=require(_0x2e4e('0x5'))(_0x2e4e('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2e4e('0x7')]()[_0x2e4e('0x8')](mailAccount[_0x2e4e('0x9')]())[_0x2e4e('0x8')](realtime[_0x2e4e('0xa')]())[_0x2e4e('0x8')](function(){email[_0x2e4e('0xb')](realtime[_0x2e4e('0xc')]);return realtime;});}function main(){return server[_0x2e4e('0xd')](realtime,email)[_0x2e4e('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0x2e4e('0xe')]();})[_0x2e4e('0x8')](function(_0x24d0bb){return setInterval(initRealtime,_0x24d0bb[_0x2e4e('0xf')]*0x3e8);})[_0x2e4e('0x10')](function(_0x51344c){logger[_0x2e4e('0x11')](_0x2e4e('0x12'),_0x51344c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3eb60b3..1a7b828 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 _0x7314=['handleImapEmail','end','handleImapEnd','error','handleImapError','bind','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','Smtp','smtp','verify','then','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox'];(function(_0x53cfce,_0x3bb189){var _0x4360d2=function(_0x1926dd){while(--_0x1926dd){_0x53cfce['push'](_0x53cfce['shift']());}};_0x4360d2(++_0x3bb189);}(_0x7314,0x1bb));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4731('0x0'));var moment=require(_0x4731('0x1'));var BPromise=require(_0x4731('0x2'));var md5=require(_0x4731('0x3'));var Redis=require(_0x4731('0x4'));var config=require(_0x4731('0x5'));var logger=require(_0x4731('0x6'))(_0x4731('0x7'));config[_0x4731('0x8')]=_[_0x4731('0x9')](config[_0x4731('0x8')],{'host':_0x4731('0xa'),'port':0x18eb});var io=require(_0x4731('0xb'))(new Redis(config[_0x4731('0x8')]));var EmailImap=require(_0x4731('0xc'));var EmailSmtp=require(_0x4731('0xd'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x59db7e){logger[_0x4731('0xe')](_0x4731('0xf'));this[_0x4731('0x10')]=_0x59db7e[_0x4731('0x10')];this[_0x4731('0x11')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x4731('0x12')]=function(_0x2299fc){var _0xb537bb=this[_0x4731('0x10')][_0x2299fc];var _0x1b1e2f={'id':_0xb537bb['id'],'name':_0xb537bb[_0x4731('0x13')],'key':_0xb537bb[_0x4731('0x14')],'active':_0xb537bb[_0x4731('0x15')],'Imap':{'status':_0xb537bb[_0x4731('0x16')][_0x4731('0x17')],'messageStatus':_0xb537bb[_0x4731('0x16')][_0x4731('0x18')],'total':_0xb537bb[_0x4731('0x16')][_0x4731('0x19')]}};if(_[_0x4731('0x1a')](md5Accounts[_0x2299fc])){md5Accounts[_0x2299fc]={};}var _0x2cd579=md5(JSON[_0x4731('0x1b')](_0x1b1e2f));if(md5Accounts[_0x2299fc]['md5']!==_0x2cd579){md5Accounts[_0x2299fc][_0x4731('0x3')]=_0x2cd579;io[_0x4731('0x12')](_0x4731('0x1c'),_0x1b1e2f);}};EmailChannel[_0x4731('0x1d')][_0x4731('0x1e')]=function(_0x15cdbd){for(var _0x4d6335 in _0x15cdbd){if(_0x15cdbd[_0x4731('0x1f')](_0x4d6335)){if(_0x15cdbd[_0x4d6335][_0x4731('0x16')]&&_0x15cdbd[_0x4d6335][_0x4731('0x15')]){var _0x464a21=_0x15cdbd[_0x4d6335][_0x4731('0x16')];if(!_0x464a21[_0x4731('0x20')]&&_0x15cdbd[_0x4d6335][_0x4731('0x21')]!==_0x4731('0x22'))_0x464a21['service']=_0x15cdbd[_0x4d6335]['provider'];if(!this[_0x4731('0x11')][_0x4731('0x1f')](_0x464a21['id'])){this[_0x4731('0x11')][_0x464a21['id']]=new EmailImap(_0x464a21,_0x15cdbd[_0x4d6335][_0x4731('0x7')]);this[_0x4731('0x11')][_0x464a21['id']]['on'](_0x4731('0x23'),this[_0x4731('0x24')]['bind'](this,_0x4d6335));this['imapAccounts'][_0x464a21['id']]['on'](_0x4731('0x7'),this[_0x4731('0x25')]['bind'](this,_0x4d6335));this['imapAccounts'][_0x464a21['id']]['on'](_0x4731('0x26'),this[_0x4731('0x27')]['bind'](this,_0x4d6335));this['imapAccounts'][_0x464a21['id']]['on'](_0x4731('0x28'),this[_0x4731('0x29')][_0x4731('0x2a')](this,_0x4d6335));}}else{if(_[_0x4731('0x1a')](this['mailAccounts'][_0x4d6335][_0x4731('0x16')])){this['mailAccounts'][_0x4d6335][_0x4731('0x16')]={};}this[_0x4731('0x10')][_0x4d6335]['Imap'][_0x4731('0x17')]=_0x4731('0x2b');this['mailAccounts'][_0x4d6335][_0x4731('0x16')][_0x4731('0x18')]='';this[_0x4731('0x12')](_0x4d6335);}}}};EmailChannel[_0x4731('0x1d')][_0x4731('0x24')]=function(_0x4ea850,_0xf494aa){if(this[_0x4731('0x10')][_0x4ea850]){this[_0x4731('0x10')][_0x4ea850][_0x4731('0x16')][_0x4731('0x17')]=_0x4731('0x2c');this['mailAccounts'][_0x4ea850][_0x4731('0x16')][_0x4731('0x18')]=_0xf494aa['name'];if(_0xf494aa['messages']){this['mailAccounts'][_0x4ea850][_0x4731('0x16')][_0x4731('0x19')]=_0xf494aa[_0x4731('0x2d')][_0x4731('0x19')];}return this[_0x4731('0x12')](_0x4ea850);}};EmailChannel[_0x4731('0x1d')]['handleImapEmail']=function(_0x4f81e7,_0x3a7761){logger[_0x4731('0xe')](_0x4731('0x2e'),_0x3a7761[_0x4731('0x2f')],_0x3a7761[_0x4731('0x30')],_0x3a7761['from'],_0x4f81e7);if(this[_0x4731('0x10')][_0x4f81e7]){return mailAccount[_0x4731('0x31')](_0x4f81e7,_0x3a7761)['then'](function(_0x353f05){if(_0x353f05){logger[_0x4731('0xe')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x40ddeb){logger['error'](_0x4731('0x32'),JSON['stringify'](_0x40ddeb));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x4d33ed){if(this[_0x4731('0x10')][_0x4d33ed]&&this[_0x4731('0x10')][_0x4d33ed][_0x4731('0x16')]){if(this['imapAccounts'][this[_0x4731('0x10')][_0x4d33ed][_0x4731('0x16')]['id']]){delete this[_0x4731('0x11')][this['mailAccounts'][_0x4d33ed][_0x4731('0x16')]['id']];}this[_0x4731('0x10')][_0x4d33ed][_0x4731('0x16')][_0x4731('0x33')]=moment();this[_0x4731('0x12')](_0x4d33ed);}};EmailChannel[_0x4731('0x1d')]['handleImapError']=function(_0x365363,_0x50eccc){if(this[_0x4731('0x10')][_0x365363]){this[_0x4731('0x10')][_0x365363][_0x4731('0x16')][_0x4731('0x17')]=_0x4731('0x28');this[_0x4731('0x10')][_0x365363]['Imap'][_0x4731('0x18')]=_0x50eccc;return this[_0x4731('0x12')](_0x365363);}};EmailChannel['prototype'][_0x4731('0x34')]=function(_0x5379ab,_0x4d5728){return this['smtp']['send'](_0x5379ab,_0x4d5728);};EmailChannel[_0x4731('0x1d')]['verifySmtp']=function(_0x3995da){var _0x463735=this;if(this[_0x4731('0x10')][_0x3995da['id']]){if(_['isNil'](this[_0x4731('0x10')][_0x3995da['id']][_0x4731('0x35')])){this[_0x4731('0x10')][_0x3995da['id']][_0x4731('0x35')]={};}this[_0x4731('0x10')][_0x3995da['id']][_0x4731('0x35')][_0x4731('0x33')]=moment();return new BPromise(function(_0x3d8409,_0x3957b0){return _0x463735[_0x4731('0x36')][_0x4731('0x37')](_0x3995da)[_0x4731('0x38')](function(_0xdf2a){_0x463735[_0x4731('0x10')][_0x3995da['id']]['Smtp'][_0x4731('0x17')]=_0x4731('0x39');_0x463735['mailAccounts'][_0x3995da['id']][_0x4731('0x35')][_0x4731('0x18')]='';_0x463735['emit'](_0x3995da['id']);_0x3d8409(_0xdf2a);})[_0x4731('0x3a')](function(_0x4bfaf1){_0x463735[_0x4731('0x10')][_0x3995da['id']][_0x4731('0x35')][_0x4731('0x17')]=_0x4731('0x28');_0x463735[_0x4731('0x10')][_0x3995da['id']]['Smtp'][_0x4731('0x18')]=_0x4bfaf1;_0x463735[_0x4731('0x12')](_0x3995da['id']);_0x3957b0(_0x4bfaf1);});});}return this[_0x4731('0x36')][_0x4731('0x37')](_0x3995da);};module[_0x4731('0x3b')]=EmailChannel; \ No newline at end of file +var _0x471a=['Smtp','verify','then','verified','catch','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','active','Imap','status','messageStatus','total','stringify','mailAccount:update','hasOwnProperty','service','provider','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','isNil','connected','name','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp'];(function(_0x36147b,_0x57f40b){var _0x141351=function(_0x219aa1){while(--_0x219aa1){_0x36147b['push'](_0x36147b['shift']());}};_0x141351(++_0x57f40b);}(_0x471a,0x114));var _0xa471=function(_0x3a3a1d,_0x48a798){_0x3a3a1d=_0x3a3a1d-0x0;var _0x1dc5ca=_0x471a[_0x3a3a1d];return _0x1dc5ca;};'use strict';var _=require(_0xa471('0x0'));var moment=require(_0xa471('0x1'));var BPromise=require(_0xa471('0x2'));var md5=require(_0xa471('0x3'));var Redis=require('ioredis');var config=require(_0xa471('0x4'));var logger=require(_0xa471('0x5'))(_0xa471('0x6'));config[_0xa471('0x7')]=_[_0xa471('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xa471('0x9'));var EmailSmtp=require(_0xa471('0xa'));var mailAccount=require(_0xa471('0xb'));var md5Accounts={};function EmailChannel(_0xb67976){logger[_0xa471('0xc')]('start\x20email\x20channel');this[_0xa471('0xd')]=_0xb67976[_0xa471('0xd')];this[_0xa471('0xe')]={};this[_0xa471('0xf')]=new EmailSmtp();}EmailChannel[_0xa471('0x10')][_0xa471('0x11')]=function(_0x352e7d){var _0x13c004=this[_0xa471('0xd')][_0x352e7d];var _0x20071c={'id':_0x13c004['id'],'name':_0x13c004['name'],'key':_0x13c004['key'],'active':_0x13c004[_0xa471('0x12')],'Imap':{'status':_0x13c004[_0xa471('0x13')][_0xa471('0x14')],'messageStatus':_0x13c004[_0xa471('0x13')][_0xa471('0x15')],'total':_0x13c004[_0xa471('0x13')][_0xa471('0x16')]}};if(_['isNil'](md5Accounts[_0x352e7d])){md5Accounts[_0x352e7d]={};}var _0xa5ca7b=md5(JSON[_0xa471('0x17')](_0x20071c));if(md5Accounts[_0x352e7d][_0xa471('0x3')]!==_0xa5ca7b){md5Accounts[_0x352e7d][_0xa471('0x3')]=_0xa5ca7b;io['emit'](_0xa471('0x18'),_0x20071c);}};EmailChannel[_0xa471('0x10')]['refresh']=function(_0xd3d1f0){for(var _0x481c0d in _0xd3d1f0){if(_0xd3d1f0[_0xa471('0x19')](_0x481c0d)){if(_0xd3d1f0[_0x481c0d][_0xa471('0x13')]&&_0xd3d1f0[_0x481c0d]['active']){var _0x45c34d=_0xd3d1f0[_0x481c0d]['Imap'];if(!_0x45c34d['service']&&_0xd3d1f0[_0x481c0d]['provider']!=='custom')_0x45c34d[_0xa471('0x1a')]=_0xd3d1f0[_0x481c0d][_0xa471('0x1b')];if(!this[_0xa471('0xe')][_0xa471('0x19')](_0x45c34d['id'])){this[_0xa471('0xe')][_0x45c34d['id']]=new EmailImap(_0x45c34d,_0xd3d1f0[_0x481c0d]['email']);this['imapAccounts'][_0x45c34d['id']]['on'](_0xa471('0x1c'),this[_0xa471('0x1d')][_0xa471('0x1e')](this,_0x481c0d));this[_0xa471('0xe')][_0x45c34d['id']]['on']('email',this[_0xa471('0x1f')][_0xa471('0x1e')](this,_0x481c0d));this[_0xa471('0xe')][_0x45c34d['id']]['on'](_0xa471('0x20'),this['handleImapEnd']['bind'](this,_0x481c0d));this['imapAccounts'][_0x45c34d['id']]['on'](_0xa471('0x21'),this[_0xa471('0x22')][_0xa471('0x1e')](this,_0x481c0d));}}else{if(_[_0xa471('0x23')](this[_0xa471('0xd')][_0x481c0d][_0xa471('0x13')])){this[_0xa471('0xd')][_0x481c0d][_0xa471('0x13')]={};}this[_0xa471('0xd')][_0x481c0d][_0xa471('0x13')][_0xa471('0x14')]='disabled';this[_0xa471('0xd')][_0x481c0d]['Imap']['messageStatus']='';this[_0xa471('0x11')](_0x481c0d);}}}};EmailChannel[_0xa471('0x10')]['handleImapBox']=function(_0x30a08a,_0x49ab94){if(this[_0xa471('0xd')][_0x30a08a]){this[_0xa471('0xd')][_0x30a08a][_0xa471('0x13')]['status']=_0xa471('0x24');this[_0xa471('0xd')][_0x30a08a][_0xa471('0x13')][_0xa471('0x15')]=_0x49ab94[_0xa471('0x25')];if(_0x49ab94['messages']){this[_0xa471('0xd')][_0x30a08a]['Imap'][_0xa471('0x16')]=_0x49ab94['messages'][_0xa471('0x16')];}return this['emit'](_0x30a08a);}};EmailChannel['prototype'][_0xa471('0x1f')]=function(_0x56029c,_0x394ed1){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x394ed1[_0xa471('0x26')],_0x394ed1[_0xa471('0x27')],_0x394ed1[_0xa471('0x28')],_0x56029c);if(this['mailAccounts'][_0x56029c]){return mailAccount['notify'](_0x56029c,_0x394ed1)['then'](function(_0x356c07){if(_0x356c07){logger[_0xa471('0xc')](_0xa471('0x29'));}})['catch'](function(_0x51a09c){logger[_0xa471('0x21')](_0xa471('0x2a'),JSON[_0xa471('0x17')](_0x51a09c));});}};EmailChannel['prototype'][_0xa471('0x2b')]=function(_0x37c518){if(this[_0xa471('0xd')][_0x37c518]&&this['mailAccounts'][_0x37c518][_0xa471('0x13')]){if(this['imapAccounts'][this['mailAccounts'][_0x37c518][_0xa471('0x13')]['id']]){delete this[_0xa471('0xe')][this[_0xa471('0xd')][_0x37c518][_0xa471('0x13')]['id']];}this[_0xa471('0xd')][_0x37c518][_0xa471('0x13')][_0xa471('0x2c')]=moment();this[_0xa471('0x11')](_0x37c518);}};EmailChannel[_0xa471('0x10')][_0xa471('0x22')]=function(_0x518e89,_0x351727){if(this[_0xa471('0xd')][_0x518e89]){this[_0xa471('0xd')][_0x518e89][_0xa471('0x13')]['status']=_0xa471('0x21');this[_0xa471('0xd')][_0x518e89][_0xa471('0x13')][_0xa471('0x15')]=_0x351727;return this[_0xa471('0x11')](_0x518e89);}};EmailChannel[_0xa471('0x10')][_0xa471('0x2d')]=function(_0x12d488,_0x23e3c2){return this[_0xa471('0xf')][_0xa471('0x2e')](_0x12d488,_0x23e3c2);};EmailChannel[_0xa471('0x10')][_0xa471('0x2f')]=function(_0x265653){var _0x3b99c2=this;if(this['mailAccounts'][_0x265653['id']]){if(_[_0xa471('0x23')](this[_0xa471('0xd')][_0x265653['id']][_0xa471('0x30')])){this['mailAccounts'][_0x265653['id']]['Smtp']={};}this[_0xa471('0xd')][_0x265653['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x55da47,_0x10d278){return _0x3b99c2[_0xa471('0xf')][_0xa471('0x31')](_0x265653)[_0xa471('0x32')](function(_0x5b5e84){_0x3b99c2[_0xa471('0xd')][_0x265653['id']][_0xa471('0x30')][_0xa471('0x14')]=_0xa471('0x33');_0x3b99c2[_0xa471('0xd')][_0x265653['id']]['Smtp'][_0xa471('0x15')]='';_0x3b99c2[_0xa471('0x11')](_0x265653['id']);_0x55da47(_0x5b5e84);})[_0xa471('0x34')](function(_0x252e3d){_0x3b99c2[_0xa471('0xd')][_0x265653['id']][_0xa471('0x30')][_0xa471('0x14')]=_0xa471('0x21');_0x3b99c2[_0xa471('0xd')][_0x265653['id']]['Smtp'][_0xa471('0x15')]=_0x252e3d;_0x3b99c2[_0xa471('0x11')](_0x265653['id']);_0x10d278(_0x252e3d);});});}return this[_0xa471('0xf')]['verify'](_0x265653);};module[_0xa471('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e8b4388..c35e2b7 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 _0xde11=['hasOwnProperty','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','connect','inherits','prototype','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','handleError','end','handleReadUnseen','fetch','slice','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode'];(function(_0xb5fa15,_0x33651b){var _0x53ac13=function(_0x244519){while(--_0x244519){_0xb5fa15['push'](_0xb5fa15['shift']());}};_0x53ac13(++_0x33651b);}(_0xde11,0x7b));var _0x1de1=function(_0x180216,_0x4ea427){_0x180216=_0x180216-0x0;var _0x2fc363=_0xde11[_0x180216];return _0x2fc363;};'use strict';var _=require(_0x1de1('0x0'));var util=require(_0x1de1('0x1'));var Imap=require(_0x1de1('0x2'));var simpleParser=require(_0x1de1('0x3'))['simpleParser'];var Iconv=require(_0x1de1('0x4'))[_0x1de1('0x5')];var EventEmitter=require(_0x1de1('0x6'))[_0x1de1('0x7')];var utils=require('./utils');var logger=require(_0x1de1('0x8'))(_0x1de1('0x9'));function EmailImap(_0x5d23c0,_0x4c2935){this[_0x1de1('0xa')]=_0x5d23c0[_0x1de1('0xa')];this[_0x1de1('0xb')]=this[_0x1de1('0xc')](_0x5d23c0,_0x4c2935);this[_0x1de1('0x2')]=new Imap(this['account']);this[_0x1de1('0x2')][_0x1de1('0xd')](_0x1de1('0xe'),this[_0x1de1('0xf')][_0x1de1('0x10')](this));this[_0x1de1('0x2')][_0x1de1('0xd')]('end',this[_0x1de1('0x11')]['bind'](this));this[_0x1de1('0x2')]['on']('error',this['handleError'][_0x1de1('0x10')](this));this[_0x1de1('0x2')][_0x1de1('0x12')]();}util[_0x1de1('0x13')](EmailImap,EventEmitter);EmailImap[_0x1de1('0x14')]['getAccount']=function(_0x478e5f,_0x45e015){var _0x4f742c={'connTimeout':_0x478e5f['connTimeout']?_0x478e5f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x478e5f[_0x1de1('0x15')]?_0x478e5f[_0x1de1('0x15')]*0x3e8:0x1388};if(_0x478e5f[_0x1de1('0x16')]){_0x4f742c['user']=_0x478e5f[_0x1de1('0x17')];if(_0x478e5f[_0x1de1('0x18')]){_0x4f742c[_0x1de1('0x19')]=utils[_0x1de1('0x1a')](_0x478e5f['CloudProvider'][_0x1de1('0x1b')],_0x478e5f[_0x1de1('0x17')]);}else{_0x4f742c[_0x1de1('0x1c')]=_0x478e5f['password'];}}else{if(_0x478e5f[_0x1de1('0x1d')]){_0x4f742c[_0x1de1('0x17')]=_0x478e5f[_0x1de1('0x17')];_0x4f742c[_0x1de1('0x1c')]=_0x478e5f[_0x1de1('0x1c')];}}_0x4f742c[_0x1de1('0x9')]=_0x45e015||_0x478e5f[_0x1de1('0x17')]||_0x1de1('0x1e');_0x4f742c['host']=_0x478e5f[_0x1de1('0x1f')];_0x4f742c['port']=_0x478e5f[_0x1de1('0x20')]||0x3e1;if(_0x478e5f[_0x1de1('0x21')]){_0x4f742c[_0x1de1('0x21')]=!![];}else{_0x4f742c[_0x1de1('0x21')]=![];_0x4f742c[_0x1de1('0x22')]=_0x1de1('0x23');}return _0x4f742c;};EmailImap[_0x1de1('0x14')]['handleReady']=function(){this[_0x1de1('0x2')][_0x1de1('0x24')](this[_0x1de1('0xa')],![],this[_0x1de1('0x25')][_0x1de1('0x10')](this));};EmailImap[_0x1de1('0x14')][_0x1de1('0x25')]=function(_0x170714,_0x2e29b9){if(_0x170714){this['handleError'](_0x170714,!![]);}else{this[_0x1de1('0x26')]('box',_0x2e29b9);this[_0x1de1('0x27')]();}};EmailImap['prototype'][_0x1de1('0x28')]=function(_0x4a5c85){if(_0x4a5c85){this[_0x1de1('0x29')](_0x4a5c85,!![]);}else{this['imap'][_0x1de1('0x2a')]();}};EmailImap[_0x1de1('0x14')][_0x1de1('0x27')]=function(){this['imap']['search'](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x1de1('0x2b')]=function(_0x5729fc,_0x5ae05d){if(_0x5729fc){this[_0x1de1('0x29')](_0x5729fc,!![]);}else{if(_0x5ae05d['length']){try{var _0x422e87=this[_0x1de1('0x2')][_0x1de1('0x2c')](_0x5ae05d[_0x1de1('0x2d')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x422e87['on'](_0x1de1('0x2e'),this[_0x1de1('0x2f')][_0x1de1('0x10')](this));_0x422e87[_0x1de1('0xd')](_0x1de1('0x30'),this[_0x1de1('0x31')][_0x1de1('0x10')](this));_0x422e87['once']('end',this[_0x1de1('0x32')][_0x1de1('0x10')](this));}catch(_0x2e23cb){logger[_0x1de1('0x30')](_0x2e23cb);}}else{this[_0x1de1('0x2')][_0x1de1('0x33')](!![],this[_0x1de1('0x28')]['bind'](this));}}};EmailImap[_0x1de1('0x14')][_0x1de1('0x2f')]=function(_0x2749b7){_0x2749b7['on'](_0x1de1('0x34'),this[_0x1de1('0x35')][_0x1de1('0x10')](this));_0x2749b7[_0x1de1('0xd')](_0x1de1('0x36'),this[_0x1de1('0x37')][_0x1de1('0x10')](this));_0x2749b7[_0x1de1('0xd')](_0x1de1('0x2a'),this[_0x1de1('0x38')]['bind'](this));};EmailImap[_0x1de1('0x14')][_0x1de1('0x35')]=function(_0xf12e21){simpleParser(_0xf12e21,{'Iconv':Iconv},this['handleSimpleParser'][_0x1de1('0x10')](this));};EmailImap[_0x1de1('0x14')][_0x1de1('0x37')]=function(){};EmailImap[_0x1de1('0x14')][_0x1de1('0x38')]=function(){};EmailImap[_0x1de1('0x14')][_0x1de1('0x39')]=function(_0x4005db,_0x3a1b9c){if(_0x4005db){logger[_0x1de1('0x30')](_0x4005db);}else{var _0x151f19=this;utils[_0x1de1('0x3a')](this[_0x1de1('0xb')],_0x3a1b9c,function(_0x4b4f3d){_0x151f19[_0x1de1('0x26')](_0x1de1('0x9'),_0x4b4f3d);});}};EmailImap[_0x1de1('0x14')][_0x1de1('0x32')]=function(){this[_0x1de1('0x2')][_0x1de1('0x33')](!![],this[_0x1de1('0x28')][_0x1de1('0x10')](this));};EmailImap[_0x1de1('0x14')][_0x1de1('0x31')]=function(_0x472fab){this[_0x1de1('0x29')](_0x472fab);this[_0x1de1('0x2')][_0x1de1('0x33')](!![],this[_0x1de1('0x28')][_0x1de1('0x10')](this));};EmailImap[_0x1de1('0x14')]['handleEnd']=function(){this[_0x1de1('0x26')](_0x1de1('0x2a'));};EmailImap[_0x1de1('0x14')][_0x1de1('0x29')]=function(_0x4b4bd0,_0x4aedd8){logger[_0x1de1('0x30')](_0x1de1('0x29'),this['account'][_0x1de1('0x9')],JSON['stringify'](_0x4b4bd0));var _0x221bfd='';if(_0x4b4bd0){if(_0x4b4bd0[_0x1de1('0x3b')]){_0x221bfd=_0x4b4bd0[_0x1de1('0x3b')];}else{for(var _0x37b9c4 in _0x4b4bd0){if(_0x4b4bd0[_0x1de1('0x3c')](_0x37b9c4)){_0x221bfd+=_['upperFirst'](_0x37b9c4)+':\x20'+_0x4b4bd0[_0x37b9c4]+'\x0a';}}}}if(_0x4aedd8){this['imap'][_0x1de1('0x2a')]();}else{this[_0x1de1('0x26')](_0x1de1('0x30'),_0x221bfd);this['emit'](_0x1de1('0x2a'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xaf47=['util','imap','simpleParser','./utils','../../../config/logger','mailbox','account','once','ready','handleReady','bind','end','handleEnd','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','password','authentication','email','anonymous@xcally.com','port','tls','autotls','required','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','slice','message','handleFetchMessage','handleFetchError','closeBox','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','error','parser','stringify','textCode','hasOwnProperty','upperFirst'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xaf47,0x113));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7af4('0x0'));var Imap=require(_0x7af4('0x1'));var simpleParser=require('mailparser')[_0x7af4('0x2')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x7af4('0x3'));var logger=require(_0x7af4('0x4'))('email');function EmailImap(_0x397e39,_0x12de20){this[_0x7af4('0x5')]=_0x397e39[_0x7af4('0x5')];this[_0x7af4('0x6')]=this['getAccount'](_0x397e39,_0x12de20);this[_0x7af4('0x1')]=new Imap(this['account']);this[_0x7af4('0x1')][_0x7af4('0x7')](_0x7af4('0x8'),this[_0x7af4('0x9')][_0x7af4('0xa')](this));this['imap'][_0x7af4('0x7')](_0x7af4('0xb'),this[_0x7af4('0xc')][_0x7af4('0xa')](this));this[_0x7af4('0x1')]['on']('error',this['handleError'][_0x7af4('0xa')](this));this[_0x7af4('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x7af4('0xd')][_0x7af4('0xe')]=function(_0x27a673,_0x2de09f){var _0x32eb69={'connTimeout':_0x27a673['connTimeout']?_0x27a673[_0x7af4('0xf')]*0x3e8:0x2710,'authTimeout':_0x27a673[_0x7af4('0x10')]?_0x27a673[_0x7af4('0x10')]*0x3e8:0x1388};if(_0x27a673[_0x7af4('0x11')]){_0x32eb69['user']=_0x27a673[_0x7af4('0x12')];if(_0x27a673[_0x7af4('0x13')]){_0x32eb69[_0x7af4('0x14')]=utils['generateXOAuth2Token'](_0x27a673[_0x7af4('0x15')]['data5'],_0x27a673[_0x7af4('0x12')]);}else{_0x32eb69[_0x7af4('0x16')]=_0x27a673['password'];}}else{if(_0x27a673[_0x7af4('0x17')]){_0x32eb69['user']=_0x27a673[_0x7af4('0x12')];_0x32eb69[_0x7af4('0x16')]=_0x27a673['password'];}}_0x32eb69[_0x7af4('0x18')]=_0x2de09f||_0x27a673[_0x7af4('0x12')]||_0x7af4('0x19');_0x32eb69['host']=_0x27a673['host'];_0x32eb69[_0x7af4('0x1a')]=_0x27a673[_0x7af4('0x1a')]||0x3e1;if(_0x27a673[_0x7af4('0x1b')]){_0x32eb69['tls']=!![];}else{_0x32eb69[_0x7af4('0x1b')]=![];_0x32eb69[_0x7af4('0x1c')]=_0x7af4('0x1d');}return _0x32eb69;};EmailImap['prototype'][_0x7af4('0x9')]=function(){this[_0x7af4('0x1')]['openBox'](this[_0x7af4('0x5')],![],this[_0x7af4('0x1e')]['bind'](this));};EmailImap[_0x7af4('0xd')][_0x7af4('0x1e')]=function(_0x10d732,_0x2b1d90){if(_0x10d732){this[_0x7af4('0x1f')](_0x10d732,!![]);}else{this[_0x7af4('0x20')](_0x7af4('0x21'),_0x2b1d90);this[_0x7af4('0x22')]();}};EmailImap[_0x7af4('0xd')][_0x7af4('0x23')]=function(_0x2c1539){if(_0x2c1539){this[_0x7af4('0x1f')](_0x2c1539,!![]);}else{this[_0x7af4('0x1')][_0x7af4('0xb')]();}};EmailImap[_0x7af4('0xd')][_0x7af4('0x22')]=function(){this['imap'][_0x7af4('0x24')]([_0x7af4('0x25')],this[_0x7af4('0x26')][_0x7af4('0xa')](this));};EmailImap[_0x7af4('0xd')]['handleReadUnseen']=function(_0x796099,_0x10eb8f){if(_0x796099){this[_0x7af4('0x1f')](_0x796099,!![]);}else{if(_0x10eb8f[_0x7af4('0x27')]){try{var _0x3f7741=this[_0x7af4('0x1')]['fetch'](_0x10eb8f[_0x7af4('0x28')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x3f7741['on'](_0x7af4('0x29'),this[_0x7af4('0x2a')][_0x7af4('0xa')](this));_0x3f7741['once']('error',this[_0x7af4('0x2b')][_0x7af4('0xa')](this));_0x3f7741['once'](_0x7af4('0xb'),this['handleFetchEnd']['bind'](this));}catch(_0x28297c){logger['error'](_0x28297c);}}else{this[_0x7af4('0x1')][_0x7af4('0x2c')](!![],this[_0x7af4('0x23')][_0x7af4('0xa')](this));}}};EmailImap[_0x7af4('0xd')][_0x7af4('0x2a')]=function(_0x57067c){_0x57067c['on']('body',this[_0x7af4('0x2d')]['bind'](this));_0x57067c[_0x7af4('0x7')](_0x7af4('0x2e'),this['handleMessageAttributes'][_0x7af4('0xa')](this));_0x57067c['once'](_0x7af4('0xb'),this[_0x7af4('0x2f')][_0x7af4('0xa')](this));};EmailImap[_0x7af4('0xd')][_0x7af4('0x2d')]=function(_0x191850){simpleParser(_0x191850,{'Iconv':Iconv},this[_0x7af4('0x30')][_0x7af4('0xa')](this));};EmailImap[_0x7af4('0xd')]['handleMessageAttributes']=function(){};EmailImap[_0x7af4('0xd')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x7af4('0x30')]=function(_0x4794a0,_0x231972){if(_0x4794a0){logger[_0x7af4('0x31')](_0x4794a0);}else{var _0x54ce3f=this;utils[_0x7af4('0x32')](this[_0x7af4('0x6')],_0x231972,function(_0x2238d0){_0x54ce3f[_0x7af4('0x20')](_0x7af4('0x18'),_0x2238d0);});}};EmailImap[_0x7af4('0xd')]['handleFetchEnd']=function(){this[_0x7af4('0x1')][_0x7af4('0x2c')](!![],this['handleCloseBox'][_0x7af4('0xa')](this));};EmailImap[_0x7af4('0xd')]['handleFetchError']=function(_0x1c8722){this[_0x7af4('0x1f')](_0x1c8722);this['imap']['closeBox'](!![],this[_0x7af4('0x23')]['bind'](this));};EmailImap[_0x7af4('0xd')][_0x7af4('0xc')]=function(){this[_0x7af4('0x20')]('end');};EmailImap[_0x7af4('0xd')][_0x7af4('0x1f')]=function(_0x285cce,_0x51046c){logger[_0x7af4('0x31')](_0x7af4('0x1f'),this[_0x7af4('0x6')][_0x7af4('0x18')],JSON[_0x7af4('0x33')](_0x285cce));var _0x5778ba='';if(_0x285cce){if(_0x285cce[_0x7af4('0x34')]){_0x5778ba=_0x285cce[_0x7af4('0x34')];}else{for(var _0x437697 in _0x285cce){if(_0x285cce[_0x7af4('0x35')](_0x437697)){_0x5778ba+=_[_0x7af4('0x36')](_0x437697)+':\x20'+_0x285cce[_0x437697]+'\x0a';}}}}if(_0x51046c){this[_0x7af4('0x1')][_0x7af4('0xb')]();}else{this[_0x7af4('0x20')](_0x7af4('0x31'),_0x5778ba);this[_0x7af4('0x20')]('end');}};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 cef6e7a..a20d4e9 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 _0xc6f1=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','createTransport','verify','Not\x20verifired'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc6f1,0x145));var _0x1c6f=function(_0x4e30c0,_0x534a76){_0x4e30c0=_0x4e30c0-0x0;var _0x5db594=_0xc6f1[_0x4e30c0];return _0x5db594;};'use strict';var nodemailer=require(_0x1c6f('0x0'));var inlineBase64=require(_0x1c6f('0x1'));function EmailSmtp(){}EmailSmtp[_0x1c6f('0x2')][_0x1c6f('0x3')]=function(_0x3962f2,_0x5409b6){return new Promise(function(_0x4a591c,_0x15afc6){var _0x24d652=nodemailer['createTransport'](_0x3962f2);_0x24d652[_0x1c6f('0x4')](_0x1c6f('0x5'),inlineBase64());_0x24d652[_0x1c6f('0x6')](_0x5409b6,function(_0x324ffd,_0x3aa1c9){if(_0x324ffd){_0x15afc6(_0x324ffd[_0x1c6f('0x7')]());}else{_0x4a591c(_0x3aa1c9);}});});};EmailSmtp[_0x1c6f('0x2')]['verify']=function(_0x3c1525){return new Promise(function(_0x546c25,_0x1813f7){var _0x149601=nodemailer[_0x1c6f('0x8')](_0x3c1525);_0x149601[_0x1c6f('0x9')](function(_0x18461a,_0x4e1238){if(_0x18461a){_0x1813f7(_0x18461a[_0x1c6f('0x7')]());}else{if(_0x4e1238){_0x546c25(_0x4e1238);}else{_0x1813f7(_0x1c6f('0xa'));}}});});};module[_0x1c6f('0xb')]=EmailSmtp; \ No newline at end of file +var _0x01a4=['createTransport','use','sendMail','verify','Not\x20verifired','nodemailer-plugin-inline-base64','prototype','send'];(function(_0xeab874,_0x5c248e){var _0x5bab28=function(_0xb98c14){while(--_0xb98c14){_0xeab874['push'](_0xeab874['shift']());}};_0x5bab28(++_0x5c248e);}(_0x01a4,0x6d));var _0x401a=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x01a4[_0x4b91c4];return _0x25cb80;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x401a('0x0'));function EmailSmtp(){}EmailSmtp[_0x401a('0x1')][_0x401a('0x2')]=function(_0x199222,_0xf34ea9){return new Promise(function(_0x444ca5,_0x453d11){var _0x4e168e=nodemailer[_0x401a('0x3')](_0x199222);_0x4e168e[_0x401a('0x4')]('compile',inlineBase64());_0x4e168e[_0x401a('0x5')](_0xf34ea9,function(_0x50caee,_0x18a23e){if(_0x50caee){_0x453d11(_0x50caee['toString']());}else{_0x444ca5(_0x18a23e);}});});};EmailSmtp[_0x401a('0x1')]['verify']=function(_0x5729fd){return new Promise(function(_0x29a90c,_0x44fe84){var _0x2984d6=nodemailer[_0x401a('0x3')](_0x5729fd);_0x2984d6[_0x401a('0x6')](function(_0x36ac87,_0x24bd5e){if(_0x36ac87){_0x44fe84(_0x36ac87['toString']());}else{if(_0x24bd5e){_0x29a90c(_0x24bd5e);}else{_0x44fe84(_0x401a('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f1cf471..b655a0c 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 _0x68ac=['forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Title','Data','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','pop','length','isEmpty','anonymous','test','html','replace','includes','0x1?_0x273c22[_0xc68a('0x10')](0x0,-0x1)[_0xc68a('0x11')]('\x20'):_0x126525[_0xc68a('0xc')];}return _0xc68a('0x12');}function getLastName(_0x24f0e7){var _0x3beb1a=_[_0xc68a('0x7')](_0x24f0e7[_0xc68a('0x8')]);if(_0x3beb1a&&_0x3beb1a[_0xc68a('0xc')]){var _0x5d443e=_0x3beb1a[_0xc68a('0xc')][_0xc68a('0xf')](/\s+/);return _0x5d443e['length']>0x1?_0x5d443e[_0xc68a('0x13')]():'';}return'';}function getMails(_0x36334d,_0x18ab65){var _0x37b0c1='';for(var _0x24d739=0x0;_0x24d739<_0x18ab65[_0xc68a('0x8')][_0xc68a('0x14')];_0x24d739+=0x1){if(_0x18ab65[_0xc68a('0x8')][_0x24d739][_0xc68a('0x9')]!==_0x36334d){if(!_[_0xc68a('0x15')](_0x37b0c1)){_0x37b0c1+=',';}_0x37b0c1+=_0x18ab65[_0xc68a('0x8')][_0x24d739][_0xc68a('0xc')]||_0x18ab65['value'][_0x24d739][_0xc68a('0x9')]||'';_0x37b0c1+='\x20<';_0x37b0c1+=_0x18ab65[_0xc68a('0x8')][_0x24d739][_0xc68a('0x9')]?_0x18ab65[_0xc68a('0x8')][_0x24d739][_0xc68a('0x9')]:_0xc68a('0x16')+random[_0xc68a('0xa')](0x6)+_0xc68a('0xb');_0x37b0c1+='>';}}return _0x37b0c1;}function parseEmail(_0x1ebbae,_0x29bb64,_0x80d12d){if(_0x29bb64['html']){var _0x450381=/)<[^<]*)*<\/script>/gi;while(_0x450381[_0xc68a('0x17')](_0x29bb64['html'])){_0x29bb64[_0xc68a('0x18')]=_0x29bb64['html'][_0xc68a('0x19')](_0x450381,'');}if(_0x29bb64[_0xc68a('0x18')][_0xc68a('0x1a')](_0xc68a('0x1b'))){var _0x95ee2a=[];_0x29bb64['attachments'][_0xc68a('0x1c')](_0x2144e1=>{_0x95ee2a[_0xc68a('0x1d')](_0x2144e1['filename']);});var _0x1d74e2=/]+>/g;var _0x4ad25a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2e86d1=_0x29bb64['html'][_0xc68a('0x19')](_0x4ad25a,_0xc68a('0x1e'));var _0x2a7282=_0x2e86d1[_0xc68a('0x19')](_0x1d74e2,_0xc68a('0x1f'));for(let _0x50ed1b=0x0;_0x50ed1b<_0x95ee2a['length'];_0x50ed1b++){var _0x2be249=_0x2a7282[_0xc68a('0x19')](_0xc68a('0x1f'),_0xc68a('0x20')+_0x95ee2a[_0x50ed1b]+_0xc68a('0x21'));_0x2a7282=_0x2be249;}_0x29bb64[_0xc68a('0x18')]=_0x2a7282;}_0x80d12d[_0xc68a('0x22')]=_0x29bb64[_0xc68a('0x18')];}else{_0x80d12d[_0xc68a('0x22')]=_0x29bb64['textAsHtml'];}if(_0x80d12d[_0xc68a('0x22')]){_0x80d12d['body']=_0x80d12d[_0xc68a('0x22')]['replace'](/0x0){var _0xed514f=[_0xc68a('0x34'),_0xc68a('0x35'),'Precedence:\x20auto_reply'];for(var _0x1f65f6=0x0;_0x1f65f6<_0x29bb64[_0xc68a('0x33')][_0xc68a('0x14')];_0x1f65f6++){var _0x186d2f=_[_0xc68a('0xe')](_0xed514f,_0x29bb64[_0xc68a('0x33')][_0x1f65f6][_0xc68a('0x36')]);if(_0x186d2f>=0x0){_0x80d12d[_0xc68a('0x37')]=!![];}}}return _0x80d12d;}exports[_0xc68a('0x38')]=function(_0x1f1425,_0x2b26b6,_0x58fb60){var _0x4c8b6e={'from':getAddress(_0x2b26b6[_0xc68a('0x39')]),'firstName':getFirstName(_0x2b26b6[_0xc68a('0x39')]),'lastName':getLastName(_0x2b26b6[_0xc68a('0x39')]),'mapKey':_0xc68a('0x5'),'message':{'from':getMails(_0x1f1425[_0xc68a('0x5')],_0x2b26b6['from']),'to':_0x1f1425['email'],'cc':'','subject':_0x2b26b6[_0xc68a('0x3a')]||'','messageId':_0x2b26b6[_0xc68a('0x3b')],'inReplyTo':_0x2b26b6[_0xc68a('0x3c')],'sentAt':moment(_0x2b26b6[_0xc68a('0x3d')])[_0xc68a('0x2c')](_0xc68a('0x3e')),'attach':![],'attachments':[]}};if(!_0x2b26b6[_0xc68a('0x18')]&&!_0x2b26b6['textAsHtml']){var _0x5ef3b5=_[_0xc68a('0x3f')](_0x2b26b6[_0xc68a('0x28')],{'contentType':_0xc68a('0x40')});if(_0x5ef3b5[_0xc68a('0x14')]){logger[_0xc68a('0x41')](util[_0xc68a('0x2c')](_0xc68a('0x42'),_0x2b26b6[_0xc68a('0x3b')]));tnef[_0xc68a('0x43')](_['first'](_0x5ef3b5)[_0xc68a('0x31')],function(_0x242a6c,_0x487eac){if(_0x487eac){_0x2b26b6[_0xc68a('0x18')]=_0x487eac[_0xc68a('0x44')]||_0xc68a('0x45');if(_0x487eac['Attachments']){for(var _0x595e77=0x0;_0x595e77<_0x487eac['Attachments'][_0xc68a('0x14')];_0x595e77++){var _0x28ae81=_0x487eac['Attachments'][_0x595e77];_0x4c8b6e['message'][_0xc68a('0x28')][_0xc68a('0x1d')]({'filename':_0x28ae81[_0xc68a('0x46')],'content':Buffer[_0xc68a('0x39')](_0x28ae81[_0xc68a('0x47')])});}}}_0x58fb60(parseEmail(_0x1f1425,_0x2b26b6,_0x4c8b6e));});}else{_0x2b26b6[_0xc68a('0x18')]=_0xc68a('0x45');_0x58fb60(parseEmail(_0x1f1425,_0x2b26b6,_0x4c8b6e));}}else{_0x58fb60(parseEmail(_0x1f1425,_0x2b26b6,_0x4c8b6e));}};exports['generateXOAuth2Token']=function(_0x198ed6,_0x37960f){var _0x2a77a7=[_0xc68a('0x48')+(_0x37960f||''),_0xc68a('0x49')+_0x198ed6,'',''];return Buffer[_0xc68a('0x39')](_0x2a77a7[_0xc68a('0x11')](''),_0xc68a('0x4a'))[_0xc68a('0x4b')]('base64');}; \ No newline at end of file +var _0xb498=['util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','length','join','Anonymous','split','isEmpty','@xcally.com','html','test','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','randomstring','path'];(function(_0xb2fcbd,_0x5bfcfd){var _0x253dca=function(_0x3ae685){while(--_0x3ae685){_0xb2fcbd['push'](_0xb2fcbd['shift']());}};_0x253dca(++_0x5bfcfd);}(_0xb498,0x1ba));var _0x8b49=function(_0x3470bd,_0x40ef54){_0x3470bd=_0x3470bd-0x0;var _0x2e0a18=_0xb498[_0x3470bd];return _0x2e0a18;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x8b49('0x0'));var fs=require('fs');var path=require(_0x8b49('0x1'));var util=require(_0x8b49('0x2'));var tnef=require(_0x8b49('0x3'));var logger=require(_0x8b49('0x4'))(_0x8b49('0x5'));var config=require(_0x8b49('0x6'));function getAddress(_0x192e22){var _0x10ea2d=_[_0x8b49('0x7')](_0x192e22[_0x8b49('0x8')]);return _0x10ea2d&&_0x10ea2d['address']?_0x10ea2d[_0x8b49('0x9')]:_0x8b49('0xa')+random[_0x8b49('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x590fa6){var _0x567e83=_[_0x8b49('0x7')](_0x590fa6[_0x8b49('0x8')]);if(_0x567e83&&_0x567e83['name']){if(_0x567e83[_0x8b49('0xc')]==_0x567e83[_0x8b49('0x9')]){return _0x567e83[_0x8b49('0xc')][_0x8b49('0xd')](0x0,_0x567e83[_0x8b49('0xc')][_0x8b49('0xe')]('@'));}var _0x1b7ea0=_0x567e83['name']['split'](/\s+/);return _0x1b7ea0[_0x8b49('0xf')]>0x1?_0x1b7ea0['slice'](0x0,-0x1)[_0x8b49('0x10')]('\x20'):_0x567e83['name'];}return _0x8b49('0x11');}function getLastName(_0x8fe67d){var _0x48d6f0=_[_0x8b49('0x7')](_0x8fe67d[_0x8b49('0x8')]);if(_0x48d6f0&&_0x48d6f0['name']){var _0x24969e=_0x48d6f0['name'][_0x8b49('0x12')](/\s+/);return _0x24969e[_0x8b49('0xf')]>0x1?_0x24969e['pop']():'';}return'';}function getMails(_0x1e2568,_0x43dbdb){var _0x50f2f0='';for(var _0x3e1cee=0x0;_0x3e1cee<_0x43dbdb[_0x8b49('0x8')][_0x8b49('0xf')];_0x3e1cee+=0x1){if(_0x43dbdb[_0x8b49('0x8')][_0x3e1cee][_0x8b49('0x9')]!==_0x1e2568){if(!_[_0x8b49('0x13')](_0x50f2f0)){_0x50f2f0+=',';}_0x50f2f0+=_0x43dbdb[_0x8b49('0x8')][_0x3e1cee][_0x8b49('0xc')]||_0x43dbdb[_0x8b49('0x8')][_0x3e1cee][_0x8b49('0x9')]||'';_0x50f2f0+='\x20<';_0x50f2f0+=_0x43dbdb[_0x8b49('0x8')][_0x3e1cee][_0x8b49('0x9')]?_0x43dbdb[_0x8b49('0x8')][_0x3e1cee][_0x8b49('0x9')]:_0x8b49('0xa')+random[_0x8b49('0xb')](0x6)+_0x8b49('0x14');_0x50f2f0+='>';}}return _0x50f2f0;}function parseEmail(_0x531973,_0x2942c4,_0x22f4b6){if(_0x2942c4[_0x8b49('0x15')]){var _0x518bc7=/)<[^<]*)*<\/script>/gi;while(_0x518bc7[_0x8b49('0x16')](_0x2942c4['html'])){_0x2942c4['html']=_0x2942c4[_0x8b49('0x15')][_0x8b49('0x17')](_0x518bc7,'');}if(_0x2942c4[_0x8b49('0x15')]['includes'](_0x8b49('0x18'))){var _0x274bfa=[];_0x2942c4[_0x8b49('0x19')][_0x8b49('0x1a')](_0x2dcb5c=>{_0x274bfa[_0x8b49('0x1b')](_0x2dcb5c[_0x8b49('0x1c')]);});var _0x267bb7=/]+>/g;var _0x2d2620=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xc3b3b6=_0x2942c4['html'][_0x8b49('0x17')](_0x2d2620,_0x8b49('0x1d'));var _0x309ead=_0xc3b3b6['replace'](_0x267bb7,_0x8b49('0x1e'));for(let _0x40e547=0x0;_0x40e547<_0x274bfa[_0x8b49('0xf')];_0x40e547++){var _0xccc821=_0x309ead['replace']('_IMG',_0x8b49('0x1f')+_0x274bfa[_0x40e547]+_0x8b49('0x20'));_0x309ead=_0xccc821;}_0x2942c4[_0x8b49('0x15')]=_0x309ead;}_0x22f4b6[_0x8b49('0x21')]=_0x2942c4[_0x8b49('0x15')];}else{_0x22f4b6[_0x8b49('0x21')]=_0x2942c4['textAsHtml'];}if(_0x22f4b6['body']){_0x22f4b6[_0x8b49('0x21')]=_0x22f4b6[_0x8b49('0x21')][_0x8b49('0x17')](/0x0){var _0x35831c=[_0x8b49('0x31'),_0x8b49('0x32'),_0x8b49('0x33')];for(var _0x97dadd=0x0;_0x97dadd<_0x2942c4[_0x8b49('0x30')]['length'];_0x97dadd++){var _0x2b3f5d=_['indexOf'](_0x35831c,_0x2942c4[_0x8b49('0x30')][_0x97dadd][_0x8b49('0x34')]);if(_0x2b3f5d>=0x0){_0x22f4b6['isAutoreply']=!![];}}}return _0x22f4b6;}exports['parser']=function(_0x1dd3e4,_0x31ed0c,_0x51fafb){var _0x3a4996={'from':getAddress(_0x31ed0c[_0x8b49('0x35')]),'firstName':getFirstName(_0x31ed0c[_0x8b49('0x35')]),'lastName':getLastName(_0x31ed0c[_0x8b49('0x35')]),'mapKey':_0x8b49('0x5'),'message':{'from':getMails(_0x1dd3e4[_0x8b49('0x5')],_0x31ed0c[_0x8b49('0x35')]),'to':_0x1dd3e4[_0x8b49('0x5')],'cc':'','subject':_0x31ed0c[_0x8b49('0x36')]||'','messageId':_0x31ed0c['messageId'],'inReplyTo':_0x31ed0c[_0x8b49('0x37')],'sentAt':moment(_0x31ed0c[_0x8b49('0x38')])['format'](_0x8b49('0x39')),'attach':![],'attachments':[]}};if(!_0x31ed0c[_0x8b49('0x15')]&&!_0x31ed0c[_0x8b49('0x3a')]){var _0x419703=_[_0x8b49('0x3b')](_0x31ed0c[_0x8b49('0x19')],{'contentType':_0x8b49('0x3c')});if(_0x419703[_0x8b49('0xf')]){logger[_0x8b49('0x3d')](util[_0x8b49('0x2b')](_0x8b49('0x3e'),_0x31ed0c['messageId']));tnef[_0x8b49('0x3f')](_[_0x8b49('0x40')](_0x419703)[_0x8b49('0x2f')],function(_0x5c9710,_0x2d2f4f){if(_0x2d2f4f){_0x31ed0c['html']=_0x2d2f4f[_0x8b49('0x41')]||_0x8b49('0x42');if(_0x2d2f4f[_0x8b49('0x43')]){for(var _0x2f6da4=0x0;_0x2f6da4<_0x2d2f4f[_0x8b49('0x43')][_0x8b49('0xf')];_0x2f6da4++){var _0x2f6188=_0x2d2f4f[_0x8b49('0x43')][_0x2f6da4];_0x3a4996['message'][_0x8b49('0x19')][_0x8b49('0x1b')]({'filename':_0x2f6188[_0x8b49('0x44')],'content':Buffer[_0x8b49('0x35')](_0x2f6188[_0x8b49('0x45')])});}}}_0x51fafb(parseEmail(_0x1dd3e4,_0x31ed0c,_0x3a4996));});}else{_0x31ed0c['html']=_0x8b49('0x42');_0x51fafb(parseEmail(_0x1dd3e4,_0x31ed0c,_0x3a4996));}}else{_0x51fafb(parseEmail(_0x1dd3e4,_0x31ed0c,_0x3a4996));}};exports[_0x8b49('0x46')]=function(_0x4255cd,_0x507943){var _0x235ca0=[_0x8b49('0x47')+(_0x507943||''),_0x8b49('0x48')+_0x4255cd,'',''];return Buffer[_0x8b49('0x35')](_0x235ca0[_0x8b49('0x10')](''),_0x8b49('0x49'))['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8d08816..ff3104c 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 _0x088a=['Smtp','name','key','SERV','active','Imap'];(function(_0x5b5e0b,_0x300268){var _0x5f4c4e=function(_0x3dcf86){while(--_0x3dcf86){_0x5b5e0b['push'](_0x5b5e0b['shift']());}};_0x5f4c4e(++_0x300268);}(_0x088a,0x109));var _0xa088=function(_0x8eb9d,_0x320ee6){_0x8eb9d=_0x8eb9d-0x0;var _0x28c28=_0x088a[_0x8eb9d];return _0x28c28;};'use strict';var _=require('lodash');function MailAccount(_0x134c87){this['id']=_0x134c87['id']||0x0;this[_0xa088('0x0')]=_0x134c87[_0xa088('0x0')]||'Service';this[_0xa088('0x1')]=_0x134c87[_0xa088('0x1')]||_0xa088('0x2');this['active']=_0x134c87[_0xa088('0x3')]||![];this[_0xa088('0x4')]=_0x134c87['Imap']||[];this[_0xa088('0x5')]=_0x134c87[_0xa088('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x9656=['exports','lodash','name','key','SERV','active','Imap','Smtp'];(function(_0x40399a,_0x688f9c){var _0x494270=function(_0x57045e){while(--_0x57045e){_0x40399a['push'](_0x40399a['shift']());}};_0x494270(++_0x688f9c);}(_0x9656,0x139));var _0x6965=function(_0x3094f8,_0x11655a){_0x3094f8=_0x3094f8-0x0;var _0x24daa2=_0x9656[_0x3094f8];return _0x24daa2;};'use strict';var _=require(_0x6965('0x0'));function MailAccount(_0x534e90){this['id']=_0x534e90['id']||0x0;this[_0x6965('0x1')]=_0x534e90[_0x6965('0x1')]||'Service';this[_0x6965('0x2')]=_0x534e90[_0x6965('0x2')]||_0x6965('0x3');this[_0x6965('0x4')]=_0x534e90[_0x6965('0x4')]||![];this[_0x6965('0x5')]=_0x534e90[_0x6965('0x5')]||[];this[_0x6965('0x6')]=_0x534e90[_0x6965('0x6')]||[];}module[_0x6965('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8a64151..0bbf6d5 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 _0x8266=['hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x45febc,_0x22c761){var _0x2f0ee3=function(_0x15c1f0){while(--_0x15c1f0){_0x45febc['push'](_0x45febc['shift']());}};_0x2f0ee3(++_0x22c761);}(_0x8266,0x1dd));var _0x6826=function(_0x505370,_0x510c0c){_0x505370=_0x505370-0x0;var _0x511be6=_0x8266[_0x505370];return _0x511be6;};'use strict';var _=require(_0x6826('0x0'));var MailAccount=require(_0x6826('0x1'));var Realtime=function(){this[_0x6826('0x2')]={};};function freeIsNotKey(_0x471df7,_0x1f1393,_0x5dcc6f){var _0x4764fd=_['mapKeys'](_0x471df7,function(_0x2ba3b6,_0x37aecf){return _0x2ba3b6[_0x5dcc6f];});for(var _0x39b303 in _0x1f1393){if(_0x1f1393[_0x6826('0x3')](_0x39b303)){if(!_0x4764fd[_0x39b303]){delete _0x1f1393[_0x39b303];}}}}Realtime[_0x6826('0x4')]['mergeFromDatabase']=function(_0x4ebb44,_0x37193b){for(var _0x183a42 in _0x37193b){if(_0x4ebb44['hasOwnProperty'](_0x183a42)){_0x4ebb44[_0x183a42]=_0x37193b[_0x183a42];}}};Realtime[_0x6826('0x4')][_0x6826('0x5')]=function(){var _0x4e5dd5=this;return function(_0x2ad641){if(_0x2ad641){freeIsNotKey(_0x2ad641,_0x4e5dd5[_0x6826('0x2')],'id');for(var _0x620c1b=0x0,_0x2ef1e5={},_0xc6faba={};_0x620c1b<_0x2ad641[_0x6826('0x6')];_0x620c1b+=0x1){_0x2ef1e5=_0x2ad641[_0x620c1b];if(_[_0x6826('0x7')](_0x4e5dd5[_0x6826('0x2')][_0x2ef1e5['id']])){_0x4e5dd5['mailAccounts'][_0x2ef1e5['id']]=new MailAccount(_0x2ef1e5);}else{_[_0x6826('0x8')](_0x4e5dd5[_0x6826('0x2')][_0x2ef1e5['id']],_0x2ef1e5);}}}return _0x4e5dd5[_0x6826('0x2')];};};module[_0x6826('0x9')]=Realtime; \ No newline at end of file +var _0x79e4=['length','exports','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','mailAccounts'];(function(_0x186d22,_0x324a80){var _0x1b7c62=function(_0x109637){while(--_0x109637){_0x186d22['push'](_0x186d22['shift']());}};_0x1b7c62(++_0x324a80);}(_0x79e4,0x185));var _0x479e=function(_0x5799ea,_0x318a47){_0x5799ea=_0x5799ea-0x0;var _0x284ce4=_0x79e4[_0x5799ea];return _0x284ce4;};'use strict';var _=require('lodash');var MailAccount=require(_0x479e('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4d5080,_0x2aa54f,_0x5076e1){var _0xc0cc1b=_[_0x479e('0x1')](_0x4d5080,function(_0x13d222,_0x17fd17){return _0x13d222[_0x5076e1];});for(var _0x2146e1 in _0x2aa54f){if(_0x2aa54f[_0x479e('0x2')](_0x2146e1)){if(!_0xc0cc1b[_0x2146e1]){delete _0x2aa54f[_0x2146e1];}}}}Realtime['prototype'][_0x479e('0x3')]=function(_0x3c5f32,_0x59e162){for(var _0x2603ef in _0x59e162){if(_0x3c5f32[_0x479e('0x2')](_0x2603ef)){_0x3c5f32[_0x2603ef]=_0x59e162[_0x2603ef];}}};Realtime[_0x479e('0x4')][_0x479e('0x5')]=function(){var _0x26a691=this;return function(_0x20c6ed){if(_0x20c6ed){freeIsNotKey(_0x20c6ed,_0x26a691[_0x479e('0x6')],'id');for(var _0x12721d=0x0,_0x67c51c={},_0x4bd52a={};_0x12721d<_0x20c6ed[_0x479e('0x7')];_0x12721d+=0x1){_0x67c51c=_0x20c6ed[_0x12721d];if(_['isUndefined'](_0x26a691[_0x479e('0x6')][_0x67c51c['id']])){_0x26a691[_0x479e('0x6')][_0x67c51c['id']]=new MailAccount(_0x67c51c);}else{_['merge'](_0x26a691['mailAccounts'][_0x67c51c['id']],_0x67c51c);}}}return _0x26a691[_0x479e('0x6')];};};module[_0x479e('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 15c4b48..6d58b42 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 _0xd101=['Smtp','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut'];(function(_0x2e6df4,_0x5e5534){var _0x192def=function(_0x1f6673){while(--_0x1f6673){_0x2e6df4['push'](_0x2e6df4['shift']());}};_0x192def(++_0x5e5534);}(_0xd101,0xc1));var _0x1d10=function(_0xdf50ba,_0x4ffc73){_0xdf50ba=_0xdf50ba-0x0;var _0x260658=_0xd101[_0xdf50ba];return _0x260658;};'use strict';var client=require(_0x1d10('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x1d10('0x1')](_0x1d10('0x2'),{'options':{'attributes':['id',_0x1d10('0x3'),_0x1d10('0x4'),_0x1d10('0x5'),_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),'ListId',_0x1d10('0x9')],'raw':![],'include':[{'model':_0x1d10('0xa'),'as':_0x1d10('0xb'),'include':[{'model':_0x1d10('0xc'),'attributes':['id',_0x1d10('0x3'),_0x1d10('0x5'),_0x1d10('0xd'),_0x1d10('0xe')],'as':_0x1d10('0xc')}]},{'model':_0x1d10('0xf'),'as':_0x1d10('0x10'),'include':[{'model':_0x1d10('0xc'),'attributes':['id',_0x1d10('0x3'),_0x1d10('0x5'),_0x1d10('0xd'),_0x1d10('0xe')],'as':_0x1d10('0xc')}]}]},'log':'getMailAccount'});};};exports[_0x1d10('0x11')]=function(_0x93cb59,_0x322bf4){return client[_0x1d10('0x1')](_0x1d10('0x12'),{'account':{'id':_0x93cb59},'body':_0x322bf4,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x7da6=['data5','notify','NotifyMailAccount','Request','GetMailAccount','name','provider','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','Smtp','service'];(function(_0x5db71c,_0x35538e){var _0x1a633d=function(_0x536859){while(--_0x536859){_0x5db71c['push'](_0x5db71c['shift']());}};_0x1a633d(++_0x35538e);}(_0x7da6,0x124));var _0x67da=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x7da6[_0x296897];return _0x2b44ab;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x67da('0x0')](_0x67da('0x1'),{'options':{'attributes':['id',_0x67da('0x2'),_0x67da('0x3'),'service',_0x67da('0x4'),_0x67da('0x5'),_0x67da('0x6'),_0x67da('0x7'),_0x67da('0x8')],'raw':![],'include':[{'model':_0x67da('0x9'),'as':'Imap','include':[{'model':_0x67da('0xa'),'attributes':['id','name','service',_0x67da('0xb'),'data5'],'as':_0x67da('0xa')}]},{'model':'MailServerOut','as':_0x67da('0xc'),'include':[{'model':_0x67da('0xa'),'attributes':['id',_0x67da('0x2'),_0x67da('0xd'),_0x67da('0xb'),_0x67da('0xe')],'as':_0x67da('0xa')}]}]},'log':'getMailAccount'});};};exports[_0x67da('0xf')]=function(_0x37b9d2,_0x329a9c){return client[_0x67da('0x0')](_0x67da('0x10'),{'account':{'id':_0x37b9d2},'body':_0x329a9c,'log':_0x67da('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 2570698..8d21ece 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 _0x38c4=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x5aee6a,_0x1efc01){var _0x978673=function(_0xc63ff4){while(--_0xc63ff4){_0x5aee6a['push'](_0x5aee6a['shift']());}};_0x978673(++_0x1efc01);}(_0x38c4,0x90));var _0x438c=function(_0x37ed20,_0x1d673d){_0x37ed20=_0x37ed20-0x0;var _0x597a8b=_0x38c4[_0x37ed20];return _0x597a8b;};'use strict';var client=require(_0x438c('0x0'));exports[_0x438c('0x1')]=function(){return client[_0x438c('0x2')](_0x438c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x438c('0x4')]},'log':_0x438c('0x5')});}; \ No newline at end of file +var _0xa408=['../client','Request','ShowSetting','GetSettings'];(function(_0xaa7e6a,_0xe3f98f){var _0xf15ba5=function(_0x1164aa){while(--_0x1164aa){_0xaa7e6a['push'](_0xaa7e6a['shift']());}};_0xf15ba5(++_0xe3f98f);}(_0xa408,0x17c));var _0x8a40=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xa408[_0x888385];return _0x22d5c2;};'use strict';var client=require(_0x8a40('0x0'));exports['getSettings']=function(){return client[_0x8a40('0x1')](_0x8a40('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x8a40('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b46c2a2..60ad7ea 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 09b0936..91d40c2 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 _0x235e=['polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0x235e,0x186));var _0xe235=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x235e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var http=require(_0xe235('0x0'));var express=require(_0xe235('0x1'));var sticky=require(_0xe235('0x2'));var Redis=require(_0xe235('0x3'));var config=require(_0xe235('0x4'));var app=express();var server=http[_0xe235('0x5')](app);server[_0xe235('0x6')]=0xdbba0;if(sticky[_0xe235('0x7')](server,config[_0xe235('0x8')])){var socketio=require(_0xe235('0x9'))(server,{'transports':['websocket',_0xe235('0xa')]});config[_0xe235('0xb')]=_['defaults'](config[_0xe235('0xb')],{'host':_0xe235('0xc'),'port':0x18eb});socketio[_0xe235('0xd')](require(_0xe235('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xe235('0xb')])}));require(_0xe235('0xf'))[_0xe235('0x10')]();require('../../config/socketio')['default'](socketio);require(_0xe235('0x11'))[_0xe235('0x10')](app);require(_0xe235('0x12'))[_0xe235('0x10')](app);}else{server['once']('listening',function(){console['log'](_0xe235('0x13'),config[_0xe235('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xacfb=['defaults','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis'];(function(_0x233309,_0x5b1d5a){var _0x441b18=function(_0xb283a4){while(--_0xb283a4){_0x233309['push'](_0x233309['shift']());}};_0x441b18(++_0x5b1d5a);}(_0xacfb,0x1d6));var _0xbacf=function(_0x29b0b9,_0x59ff97){_0x29b0b9=_0x29b0b9-0x0;var _0x4c34e8=_0xacfb[_0x29b0b9];return _0x4c34e8;};'use strict';var _=require(_0xbacf('0x0'));var http=require(_0xbacf('0x1'));var express=require(_0xbacf('0x2'));var sticky=require(_0xbacf('0x3'));var Redis=require(_0xbacf('0x4'));var config=require(_0xbacf('0x5'));var app=express();var server=http[_0xbacf('0x6')](app);server[_0xbacf('0x7')]=0xdbba0;if(sticky[_0xbacf('0x8')](server,config[_0xbacf('0x9')])){var socketio=require(_0xbacf('0xa'))(server,{'transports':['websocket',_0xbacf('0xb')]});config[_0xbacf('0xc')]=_[_0xbacf('0xd')](config[_0xbacf('0xc')],{'host':'localhost','port':0x18eb});socketio[_0xbacf('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0xbacf('0xc')]),'subClient':new Redis(config[_0xbacf('0xc')])}));require(_0xbacf('0xf'))[_0xbacf('0x10')]();require(_0xbacf('0x11'))[_0xbacf('0x10')](socketio);require(_0xbacf('0x12'))[_0xbacf('0x10')](app);require(_0xbacf('0x13'))[_0xbacf('0x10')](app);}else{server[_0xbacf('0x14')]('listening',function(){console['log'](_0xbacf('0x15'),config[_0xbacf('0x9')]);});}exports=module[_0xbacf('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 23c1ac4..2c634ec 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 _0x8e74=['bluebird','../../config/logger','routing','request','then','debug','rpc','error','message','result','exports'];(function(_0x114cdd,_0x185ac8){var _0x313ab5=function(_0x3ad2b0){while(--_0x3ad2b0){_0x114cdd['push'](_0x114cdd['shift']());}};_0x313ab5(++_0x185ac8);}(_0x8e74,0x1e4));var _0x48e7=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x8e74[_0x36c5b0];return _0xf19333;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x48e7('0x0'));var logger=require(_0x48e7('0x1'))(_0x48e7('0x2'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x1dd359,_0x580834){return new BPromise(function(_0x31fb09,_0x50dc55){return client[_0x48e7('0x3')](_0x1dd359,_0x580834)[_0x48e7('0x4')](function(_0x2d7701){logger[_0x48e7('0x5')](_0x48e7('0x6'),_0x48e7('0x2'),_0x1dd359,_0x580834,_0x2d7701);if(_0x2d7701[_0x48e7('0x7')]){logger[_0x48e7('0x7')](_0x48e7('0x6'),_0x48e7('0x2'),_0x1dd359,_0x2d7701[_0x48e7('0x7')][_0x48e7('0x8')],_0x580834);return _0x50dc55(_0x2d7701['error'][_0x48e7('0x8')]);}else{return _0x31fb09(_0x2d7701[_0x48e7('0x9')]);}})['catch'](function(_0x94503b){logger['error']('rpc',_0x48e7('0x2'),_0x1dd359,_0x94503b,_0x580834);return _0x50dc55(_0x94503b);});});};module[_0x48e7('0xa')]=client; \ No newline at end of file +var _0x68f4=['result','../../config/logger','client','http','Request','then','debug','rpc','error','routing','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x68f4,0xbc));var _0x468f=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x68f4[_0x504df1];return _0x1063b5;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x468f('0x0'))('routing');var client=jayson[_0x468f('0x1')][_0x468f('0x2')]({'port':0x2329});client[_0x468f('0x3')]=function(_0x2064dc,_0x6192e){return new BPromise(function(_0x37fc98,_0x424a78){return client['request'](_0x2064dc,_0x6192e)[_0x468f('0x4')](function(_0xddd8c2){logger[_0x468f('0x5')](_0x468f('0x6'),'routing',_0x2064dc,_0x6192e,_0xddd8c2);if(_0xddd8c2[_0x468f('0x7')]){logger[_0x468f('0x7')](_0x468f('0x6'),_0x468f('0x8'),_0x2064dc,_0xddd8c2[_0x468f('0x7')][_0x468f('0x9')],_0x6192e);return _0x424a78(_0xddd8c2[_0x468f('0x7')][_0x468f('0x9')]);}else{return _0x37fc98(_0xddd8c2[_0x468f('0xa')]);}})['catch'](function(_0x51853a){logger['error']('rpc',_0x468f('0x8'),_0x2064dc,_0x51853a,_0x6192e);return _0x424a78(_0x51853a);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 248fc09..4299932 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 _0xa725=['getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x50ebc3,_0x3ca014){var _0x113b26=function(_0x3053a6){while(--_0x3053a6){_0x50ebc3['push'](_0x50ebc3['shift']());}};_0x113b26(++_0x3ca014);}(_0xa725,0xea));var _0x5a72=function(_0x4c7a4a,_0xebe211){_0x4c7a4a=_0x4c7a4a-0x0;var _0xc60995=_0xa725[_0x4c7a4a];return _0xc60995;};'use strict';var BPromise=require(_0x5a72('0x0'));var server=require('./server');var Realtime=require(_0x5a72('0x1'));var user=require(_0x5a72('0x2'));var interval=require(_0x5a72('0x3'));var openchannelQueue=require(_0x5a72('0x4'));var chatQueue=require(_0x5a72('0x5'));var smsQueue=require(_0x5a72('0x6'));var mailQueue=require(_0x5a72('0x7'));var faxQueue=require(_0x5a72('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x5a72('0x9')]()['then'](user[_0x5a72('0xa')]())[_0x5a72('0xb')](realtime[_0x5a72('0xc')]())[_0x5a72('0xb')](interval['getIntervals']())[_0x5a72('0xb')](realtime[_0x5a72('0xd')]())[_0x5a72('0xb')](openchannelQueue[_0x5a72('0xe')]())[_0x5a72('0xb')](realtime[_0x5a72('0xf')]())['then'](chatQueue[_0x5a72('0x10')]())[_0x5a72('0xb')](realtime[_0x5a72('0x11')]())[_0x5a72('0xb')](smsQueue[_0x5a72('0x12')]())['then'](realtime['initSmsQueues']())[_0x5a72('0xb')](mailQueue[_0x5a72('0x13')]())[_0x5a72('0xb')](realtime[_0x5a72('0x14')]())[_0x5a72('0xb')](faxQueue[_0x5a72('0x15')]())[_0x5a72('0xb')](realtime[_0x5a72('0x16')]())[_0x5a72('0xb')](whatsappQueue[_0x5a72('0x17')]())['then'](realtime[_0x5a72('0x18')]())['then'](function(){return realtime;});}function main(){return server[_0x5a72('0x19')](realtime)[_0x5a72('0xb')](function(_0x16902c){return initRealtime();})[_0x5a72('0xb')](function(_0x5aa661){return setInterval(initRealtime,0x1388);})[_0x5a72('0x1a')](function(_0x1b196e){console[_0x5a72('0x1b')](_0x1b196e);});}main(); \ No newline at end of file +var _0xb60c=['getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues'];(function(_0x583ae9,_0x4781bd){var _0x4a9264=function(_0x1eb3b9){while(--_0x1eb3b9){_0x583ae9['push'](_0x583ae9['shift']());}};_0x4a9264(++_0x4781bd);}(_0xb60c,0x19a));var _0xcb60=function(_0x1cd9a9,_0x226b55){_0x1cd9a9=_0x1cd9a9-0x0;var _0x15795d=_0xb60c[_0x1cd9a9];return _0x15795d;};'use strict';var BPromise=require(_0xcb60('0x0'));var server=require(_0xcb60('0x1'));var Realtime=require('./realtime');var user=require(_0xcb60('0x2'));var interval=require(_0xcb60('0x3'));var openchannelQueue=require(_0xcb60('0x4'));var chatQueue=require(_0xcb60('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xcb60('0x6'));var faxQueue=require(_0xcb60('0x7'));var whatsappQueue=require(_0xcb60('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xcb60('0x9')]()[_0xcb60('0xa')](user['getAgents']())[_0xcb60('0xa')](realtime[_0xcb60('0xb')]())[_0xcb60('0xa')](interval[_0xcb60('0xc')]())[_0xcb60('0xa')](realtime[_0xcb60('0xd')]())['then'](openchannelQueue[_0xcb60('0xe')]())[_0xcb60('0xa')](realtime[_0xcb60('0xf')]())['then'](chatQueue[_0xcb60('0x10')]())[_0xcb60('0xa')](realtime[_0xcb60('0x11')]())[_0xcb60('0xa')](smsQueue[_0xcb60('0x12')]())[_0xcb60('0xa')](realtime[_0xcb60('0x13')]())[_0xcb60('0xa')](mailQueue[_0xcb60('0x14')]())[_0xcb60('0xa')](realtime[_0xcb60('0x15')]())['then'](faxQueue['getFaxQueues']())[_0xcb60('0xa')](realtime['initFaxQueues']())[_0xcb60('0xa')](whatsappQueue[_0xcb60('0x16')]())[_0xcb60('0xa')](realtime[_0xcb60('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0xcb60('0x18')](realtime)[_0xcb60('0xa')](function(_0x489d25){return initRealtime();})[_0xcb60('0xa')](function(_0x4d56e0){return setInterval(initRealtime,0x1388);})[_0xcb60('0x19')](function(_0x18eb79){console[_0xcb60('0x1a')](_0x18eb79);});}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 535a000..8a64ed1 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x165082,_0x207ae8){var _0x21989b=function(_0x3bec8b){while(--_0x3bec8b){_0x165082['push'](_0x165082['shift']());}};_0x21989b(++_0x207ae8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x5fc3[_0x874cf1];return _0x233579;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x1180c6,_0x45c2a1){var _0x12bfa1=function(_0xf9abe8){while(--_0xf9abe8){_0x1180c6['push'](_0x1180c6['shift']());}};_0x12bfa1(++_0x45c2a1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index bf96a68..9b765d5 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 _0xafdb=['sendMailMessage','bluebird','jayson/promise','client','http','request','error','message','result','catch'];(function(_0x3a898f,_0x5c51d6){var _0x54fc28=function(_0x36d5aa){while(--_0x36d5aa){_0x3a898f['push'](_0x3a898f['shift']());}};_0x54fc28(++_0x5c51d6);}(_0xafdb,0xd3));var _0xbafd=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xafdb[_0x13ce0c];return _0x4388fb;};'use strict';var BPromise=require(_0xbafd('0x0'));var jayson=require(_0xbafd('0x1'));var client=jayson[_0xbafd('0x2')][_0xbafd('0x3')]({'port':0x232b});function request(_0x4b9710,_0x540909){return new BPromise(function(_0x48535f,_0x5b08c4){return client[_0xbafd('0x4')](_0x4b9710,_0x540909)['then'](function(_0x56263c){if(_0x56263c[_0xbafd('0x5')]){return _0x5b08c4(_0x56263c[_0xbafd('0x5')][_0xbafd('0x6')]);}else{return _0x48535f(_0x56263c[_0xbafd('0x7')]);}})[_0xbafd('0x8')](function(_0xeaab5d){return _0x5b08c4(_0xeaab5d);});});}exports[_0xbafd('0x9')]=function(_0x2af4cb,_0x446089){return request('SendMail',{'account':_0x2af4cb,'message':_0x446089});}; \ No newline at end of file +var _0x43ab=['sendMailMessage','SendMail','bluebird','jayson/promise','client','error','message','result'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x43ab,0xda));var _0xb43a=function(_0x481585,_0x20384e){_0x481585=_0x481585-0x0;var _0x354076=_0x43ab[_0x481585];return _0x354076;};'use strict';var BPromise=require(_0xb43a('0x0'));var jayson=require(_0xb43a('0x1'));var client=jayson[_0xb43a('0x2')]['http']({'port':0x232b});function request(_0x1dadbd,_0x25a1e5){return new BPromise(function(_0x368a8f,_0x3ad46b){return client['request'](_0x1dadbd,_0x25a1e5)['then'](function(_0x194590){if(_0x194590[_0xb43a('0x3')]){return _0x3ad46b(_0x194590['error'][_0xb43a('0x4')]);}else{return _0x368a8f(_0x194590[_0xb43a('0x5')]);}})['catch'](function(_0xe2066c){return _0x3ad46b(_0xe2066c);});});}exports[_0xb43a('0x6')]=function(_0x59d8df,_0x394eb8){return request(_0xb43a('0x7'),{'account':_0x59d8df,'message':_0x394eb8});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index e819f30..8170ba8 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 _0x8ace=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','toNumber','format','Status','mailStatus','faxCurrentCapacity','openchannelStatusTime','busyQueue','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus'];(function(_0x2e1596,_0x5bc070){var _0x4af24f=function(_0x2de26e){while(--_0x2de26e){_0x2e1596['push'](_0x2e1596['shift']());}};_0x4af24f(++_0x5bc070);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x3ba79c,_0x1547d2){_0x3ba79c=_0x3ba79c-0x0;var _0xd2d1a4=_0x8ace[_0x3ba79c];return _0xd2d1a4;};'use strict';var _=require(_0xe8ac('0x0'));var md5=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var Redis=require(_0xe8ac('0x3'));var config=require(_0xe8ac('0x4'));config[_0xe8ac('0x5')]=_[_0xe8ac('0x6')](config[_0xe8ac('0x5')],{'host':_0xe8ac('0x7'),'port':0x18eb});var io=require(_0xe8ac('0x8'))(new Redis(config[_0xe8ac('0x5')]));function Agent(_0x224fc8){this['id']=_0x224fc8['id']||0x0;this[_0xe8ac('0x9')]=_0x224fc8[_0xe8ac('0x9')]||'';this['online']=_0x224fc8[_0xe8ac('0xa')]||!![];this[_0xe8ac('0xb')]=_0x224fc8['voicePause']||![];this['chatPause']=_0x224fc8[_0xe8ac('0xc')]||![];this['mailPause']=_0x224fc8[_0xe8ac('0xd')]||![];this[_0xe8ac('0xe')]=_0x224fc8[_0xe8ac('0xe')]||![];this[_0xe8ac('0xf')]=_0x224fc8[_0xe8ac('0xf')]||![];this[_0xe8ac('0x10')]=_0x224fc8['openchannelPause']||![];this[_0xe8ac('0x11')]=_0xe8ac('0x12');this[_0xe8ac('0x13')]=0x0;this['chatCapacity']=_0x224fc8[_0xe8ac('0x14')]||0x0;this[_0xe8ac('0x15')]=0x0;this['mailStatus']=_0xe8ac('0x12');this[_0xe8ac('0x16')]=0x0;this[_0xe8ac('0x17')]=_0x224fc8[_0xe8ac('0x17')]||0x0;this[_0xe8ac('0x18')]=0x0;this[_0xe8ac('0x19')]=_0xe8ac('0x12');this[_0xe8ac('0x1a')]=0x0;this[_0xe8ac('0x1b')]=_0x224fc8[_0xe8ac('0x1b')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xe8ac('0x1c')]=_0xe8ac('0x12');this['smsStatusTime']=0x0;this[_0xe8ac('0x1d')]=_0x224fc8[_0xe8ac('0x1d')]||0x0;this[_0xe8ac('0x1e')]=0x0;this[_0xe8ac('0x1f')]=_0xe8ac('0x12');this[_0xe8ac('0x20')]=0x0;this['whatsappCapacity']=_0x224fc8['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xe8ac('0x21')]=_0xe8ac('0x12');this['openchannelStatusTime']=0x0;this[_0xe8ac('0x22')]=_0x224fc8['openchannelCapacity']||0x0;this[_0xe8ac('0x23')]=0x0;this[_0xe8ac('0x24')]=![];this['busyQueue']=undefined;this[_0xe8ac('0x1')]='';this[_0xe8ac('0x25')]={};this[_0xe8ac('0x26')]={};this[_0xe8ac('0x27')]={};this['openchannelWaitingInteractions']={};this[_0xe8ac('0x28')]={};this['whatsappWaitingInteractions']={};this[_0xe8ac('0x29')]();}Agent[_0xe8ac('0x2a')][_0xe8ac('0x2b')]=function(_0x252440){if(this[_0x252440+_0xe8ac('0x2c')]>0x0){if(this[_0x252440+_0xe8ac('0x2d')]>0x0&&this[_0x252440+_0xe8ac('0x2c')]>=this[_0x252440+'Capacity']){return _0xe8ac('0x2e');}else{return _0xe8ac('0x2f');}}else{return _0xe8ac('0x30');}};Agent[_0xe8ac('0x2a')][_0xe8ac('0x29')]=function(){var _0x3a92e1=[_0xe8ac('0x31'),_0xe8ac('0x32'),_0xe8ac('0x33'),'fax','sms',_0xe8ac('0x34')];for(var _0xbef18f=0x0;_0xbef18f<_0x3a92e1['length'];_0xbef18f+=0x1){var _0x2a78c6=this[_0xe8ac('0x2b')](_0x3a92e1[_0xbef18f]);if(this[_0x3a92e1[_0xbef18f]+'Status']!==_0x2a78c6){this[_0x3a92e1[_0xbef18f]+'StatusTime']=_[_0xe8ac('0x35')](moment()[_0xe8ac('0x36')]('x'));}this[_0x3a92e1[_0xbef18f]+_0xe8ac('0x37')]=_0x2a78c6;}var _0x5d7562={'id':this['id'],'name':this[_0xe8ac('0x9')],'online':this[_0xe8ac('0xa')],'voicePause':this[_0xe8ac('0xb')],'chatPause':this['chatPause'],'mailPause':this[_0xe8ac('0xd')],'smsPause':this['smsPause'],'faxPause':this[_0xe8ac('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe8ac('0x15')],'mailStatus':this[_0xe8ac('0x38')],'mailStatusTime':this[_0xe8ac('0x16')],'mailCapacity':this[_0xe8ac('0x17')],'mailCurrentCapacity':this[_0xe8ac('0x18')],'faxStatus':this[_0xe8ac('0x19')],'faxStatusTime':this[_0xe8ac('0x1a')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe8ac('0x39')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xe8ac('0x1e')],'whatsappStatus':this[_0xe8ac('0x1f')],'whatsappStatusTime':this[_0xe8ac('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xe8ac('0x21')],'openchannelStatusTime':this[_0xe8ac('0x3a')],'openchannelCapacity':this[_0xe8ac('0x22')],'openchannelCurrentCapacity':this[_0xe8ac('0x23')],'busy':this['busy'],'busyQueue':this[_0xe8ac('0x3b')],'chatWaitingInteractions':this[_0xe8ac('0x25')],'faxWaitingInteractions':this[_0xe8ac('0x26')],'mailWaitingInteractions':this[_0xe8ac('0x27')],'openchannelWaitingInteractions':this[_0xe8ac('0x3c')],'smsWaitingInteractions':this[_0xe8ac('0x28')],'whatsappWaitingInteractions':this[_0xe8ac('0x3d')]};var _0x55a3a4=md5(JSON[_0xe8ac('0x3e')](_0x5d7562));if(this[_0xe8ac('0x1')]!==_0x55a3a4){this['md5']=_0x55a3a4;io[_0xe8ac('0x3f')](_0xe8ac('0x40'),_[_0xe8ac('0x41')](_0x5d7562,[_0xe8ac('0xa')]));}};module['exports']=Agent; \ No newline at end of file +var _0x9536=['faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','mailStatus','smsStatus','whatsappStatus','chatWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x594b53,_0x2ae1aa){var _0x39abe4=function(_0xf8f58){while(--_0xf8f58){_0x594b53['push'](_0x594b53['shift']());}};_0x39abe4(++_0x2ae1aa);}(_0x9536,0x179));var _0x6953=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x9536[_0x53b594];return _0x1e616f;};'use strict';var _=require(_0x6953('0x0'));var md5=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var Redis=require(_0x6953('0x3'));var config=require('../../../config/environment');config[_0x6953('0x4')]=_['defaults'](config[_0x6953('0x4')],{'host':_0x6953('0x5'),'port':0x18eb});var io=require(_0x6953('0x6'))(new Redis(config[_0x6953('0x4')]));function Agent(_0x2f3cc3){this['id']=_0x2f3cc3['id']||0x0;this['name']=_0x2f3cc3[_0x6953('0x7')]||'';this[_0x6953('0x8')]=_0x2f3cc3[_0x6953('0x8')]||!![];this[_0x6953('0x9')]=_0x2f3cc3[_0x6953('0x9')]||![];this['chatPause']=_0x2f3cc3[_0x6953('0xa')]||![];this[_0x6953('0xb')]=_0x2f3cc3[_0x6953('0xb')]||![];this['faxPause']=_0x2f3cc3[_0x6953('0xc')]||![];this[_0x6953('0xd')]=_0x2f3cc3[_0x6953('0xd')]||![];this[_0x6953('0xe')]=_0x2f3cc3[_0x6953('0xe')]||![];this[_0x6953('0xf')]=_0x6953('0x10');this[_0x6953('0x11')]=0x0;this[_0x6953('0x12')]=_0x2f3cc3['chatCapacity']||0x0;this[_0x6953('0x13')]=0x0;this['mailStatus']=_0x6953('0x10');this[_0x6953('0x14')]=0x0;this[_0x6953('0x15')]=_0x2f3cc3[_0x6953('0x15')]||0x0;this[_0x6953('0x16')]=0x0;this[_0x6953('0x17')]=_0x6953('0x10');this[_0x6953('0x18')]=0x0;this[_0x6953('0x19')]=_0x2f3cc3[_0x6953('0x19')]||0x0;this[_0x6953('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x6953('0x1b')]=0x0;this[_0x6953('0x1c')]=_0x2f3cc3[_0x6953('0x1c')]||0x0;this[_0x6953('0x1d')]=0x0;this['whatsappStatus']=_0x6953('0x10');this[_0x6953('0x1e')]=0x0;this['whatsappCapacity']=_0x2f3cc3[_0x6953('0x1f')]||0x0;this[_0x6953('0x20')]=0x0;this[_0x6953('0x21')]=_0x6953('0x10');this[_0x6953('0x22')]=0x0;this['openchannelCapacity']=_0x2f3cc3[_0x6953('0x23')]||0x0;this[_0x6953('0x24')]=0x0;this[_0x6953('0x25')]=![];this[_0x6953('0x26')]=undefined;this[_0x6953('0x1')]='';this['chatWaitingInteractions']={};this[_0x6953('0x27')]={};this[_0x6953('0x28')]={};this['openchannelWaitingInteractions']={};this[_0x6953('0x29')]={};this[_0x6953('0x2a')]={};this[_0x6953('0x2b')]();}Agent[_0x6953('0x2c')]['getChannelStatus']=function(_0x37f339){if(this[_0x37f339+_0x6953('0x2d')]>0x0){if(this[_0x37f339+_0x6953('0x2e')]>0x0&&this[_0x37f339+'CurrentCapacity']>=this[_0x37f339+'Capacity']){return'maxcapacity';}else{return _0x6953('0x2f');}}else{return _0x6953('0x30');}};Agent['prototype'][_0x6953('0x2b')]=function(){var _0x587df0=[_0x6953('0x31'),_0x6953('0x32'),_0x6953('0x33'),_0x6953('0x34'),_0x6953('0x35'),_0x6953('0x36')];for(var _0x53d3dc=0x0;_0x53d3dc<_0x587df0[_0x6953('0x37')];_0x53d3dc+=0x1){var _0x3c1075=this['getChannelStatus'](_0x587df0[_0x53d3dc]);if(this[_0x587df0[_0x53d3dc]+_0x6953('0x38')]!==_0x3c1075){this[_0x587df0[_0x53d3dc]+'StatusTime']=_[_0x6953('0x39')](moment()[_0x6953('0x3a')]('x'));}this[_0x587df0[_0x53d3dc]+_0x6953('0x38')]=_0x3c1075;}var _0x4b0325={'id':this['id'],'name':this[_0x6953('0x7')],'online':this[_0x6953('0x8')],'voicePause':this[_0x6953('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x6953('0xb')],'smsPause':this[_0x6953('0xd')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6953('0xf')],'chatStatusTime':this[_0x6953('0x11')],'chatCapacity':this[_0x6953('0x12')],'chatCurrentCapacity':this[_0x6953('0x13')],'mailStatus':this[_0x6953('0x3b')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6953('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6953('0x17')],'faxStatusTime':this[_0x6953('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x6953('0x3c')],'smsStatusTime':this[_0x6953('0x1b')],'smsCapacity':this[_0x6953('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x6953('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6953('0x22')],'openchannelCapacity':this[_0x6953('0x23')],'openchannelCurrentCapacity':this[_0x6953('0x24')],'busy':this[_0x6953('0x25')],'busyQueue':this[_0x6953('0x26')],'chatWaitingInteractions':this[_0x6953('0x3e')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x6953('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6953('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0xc63da7=md5(JSON[_0x6953('0x3f')](_0x4b0325));if(this[_0x6953('0x1')]!==_0xc63da7){this[_0x6953('0x1')]=_0xc63da7;io['emit'](_0x6953('0x40'),_[_0x6953('0x41')](_0x4b0325,[_0x6953('0x8')]));}};module[_0x6953('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e1a6e24..0d55071 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 _0x9759=['updateRealtime','prototype','mapAgentsId','_rr','map','Agents','loggedIn','paused','online','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','waiting','updateRouting'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x9759,0x15f));var _0x9975=function(_0x124e0c,_0x1cab8b){_0x124e0c=_0x124e0c-0x0;var _0x15fc88=_0x9759[_0x124e0c];return _0x15fc88;};'use strict';var _=require(_0x9975('0x0'));var md5=require(_0x9975('0x1'));var util=require(_0x9975('0x2'));var Redis=require(_0x9975('0x3'));var config=require(_0x9975('0x4'));config[_0x9975('0x5')]=_[_0x9975('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9975('0x7'))(new Redis(config['redis']));function ChatQueue(_0x315f7b){this['id']=_0x315f7b['id']||0x0;this[_0x9975('0x8')]=_0x315f7b['name']||'';this[_0x9975('0x9')]=_0x315f7b['timeout']||0xa;this[_0x9975('0xa')]=_0x315f7b[_0x9975('0xa')]||'beepall';this['Agents']=_0x315f7b['Agents'];this['mapAgentsId']={};this[_0x9975('0xb')]=0x0;this[_0x9975('0x1')]='';this[_0x9975('0xc')]();this[_0x9975('0xd')]();}ChatQueue[_0x9975('0xe')]['updateRouting']=function(){var _0x194985=this[_0x9975('0xf')][_0x9975('0x10')];this[_0x9975('0xf')]=_[_0x9975('0x11')](this[_0x9975('0x12')],'id');this[_0x9975('0xf')][_0x9975('0x10')]=_0x194985;};ChatQueue['prototype'][_0x9975('0xd')]=function(){this[_0x9975('0x13')]=0x0;this[_0x9975('0x14')]=0x0;for(var _0x3a17c3=0x0;_0x3a17c3=0x0?this[_0x9975('0x16')]:0x0;var _0x3afe08={'id':this['id'],'available':this[_0x9975('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x9975('0x8')],'paused':this['paused'],'waiting':this[_0x9975('0xb')]};var _0x5be3c8=md5(JSON[_0x9975('0x17')](_0x3afe08));if(this[_0x9975('0x1')]!==_0x5be3c8){this[_0x9975('0x1')]=_0x5be3c8;io['to'](util[_0x9975('0x18')](_0x9975('0x19'),_0x3afe08[_0x9975('0x8')]))[_0x9975('0x1a')]('chat_queue:save',_0x3afe08);}};module[_0x9975('0x1b')]=ChatQueue; \ No newline at end of file +var _0xc35b=['paused','available','name','stringify','format','chat:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','online','chatPause'];(function(_0x42021b,_0x461234){var _0xbc97cb=function(_0x48cd54){while(--_0x48cd54){_0x42021b['push'](_0x42021b['shift']());}};_0xbc97cb(++_0x461234);}(_0xc35b,0x1ab));var _0xbc35=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xc35b[_0x58dc25];return _0x21b0a7;};'use strict';var _=require('lodash');var md5=require(_0xbc35('0x0'));var util=require(_0xbc35('0x1'));var Redis=require(_0xbc35('0x2'));var config=require(_0xbc35('0x3'));config[_0xbc35('0x4')]=_[_0xbc35('0x5')](config['redis'],{'host':_0xbc35('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x13cad1){this['id']=_0x13cad1['id']||0x0;this['name']=_0x13cad1['name']||'';this[_0xbc35('0x7')]=_0x13cad1[_0xbc35('0x7')]||0xa;this[_0xbc35('0x8')]=_0x13cad1[_0xbc35('0x8')]||_0xbc35('0x9');this[_0xbc35('0xa')]=_0x13cad1[_0xbc35('0xa')];this[_0xbc35('0xb')]={};this[_0xbc35('0xc')]=0x0;this[_0xbc35('0x0')]='';this[_0xbc35('0xd')]();this[_0xbc35('0xe')]();}ChatQueue['prototype'][_0xbc35('0xd')]=function(){var _0x1f32cc=this[_0xbc35('0xb')][_0xbc35('0xf')];this['mapAgentsId']=_[_0xbc35('0x10')](this[_0xbc35('0xa')],'id');this[_0xbc35('0xb')][_0xbc35('0xf')]=_0x1f32cc;};ChatQueue[_0xbc35('0x11')][_0xbc35('0xe')]=function(){this[_0xbc35('0x12')]=0x0;this['paused']=0x0;for(var _0x28273f=0x0;_0x28273f=0x0?this[_0xbc35('0x16')]:0x0;var _0x26197a={'id':this['id'],'available':this[_0xbc35('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xbc35('0x17')],'paused':this[_0xbc35('0x15')],'waiting':this[_0xbc35('0xc')]};var _0x511934=md5(JSON[_0xbc35('0x18')](_0x26197a));if(this[_0xbc35('0x0')]!==_0x511934){this[_0xbc35('0x0')]=_0x511934;io['to'](util[_0xbc35('0x19')](_0xbc35('0x1a'),_0x26197a[_0xbc35('0x17')]))[_0xbc35('0x1b')]('chat_queue:save',_0x26197a);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e0ad28d..952aee8 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 _0xb269=['updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','waiting','stringify','format','fax:queue:%s','fax_queue:save','exports','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','md5'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xb269,0x13a));var _0x9b26=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb269[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x9b26('0x0'));var config=require('../../../config/environment');config[_0x9b26('0x1')]=_[_0x9b26('0x2')](config[_0x9b26('0x1')],{'host':_0x9b26('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b26('0x1')]));function FaxQueue(_0x21af4){this['id']=_0x21af4['id']||0x0;this[_0x9b26('0x4')]=_0x21af4[_0x9b26('0x4')]||'';this[_0x9b26('0x5')]=_0x21af4[_0x9b26('0x5')]||0xa;this['strategy']=_0x21af4[_0x9b26('0x6')]||'beepall';this['Agents']=_0x21af4[_0x9b26('0x7')];this[_0x9b26('0x8')]={};this['waiting']=0x0;this[_0x9b26('0x9')]='';this[_0x9b26('0xa')]();this[_0x9b26('0xb')]();}FaxQueue['prototype'][_0x9b26('0xa')]=function(){var _0x2ae863=this[_0x9b26('0x8')][_0x9b26('0xc')];this[_0x9b26('0x8')]=_[_0x9b26('0xd')](this[_0x9b26('0x7')],'id');this['mapAgentsId'][_0x9b26('0xc')]=_0x2ae863;};FaxQueue[_0x9b26('0xe')]['updateRealtime']=function(){this[_0x9b26('0xf')]=0x0;this[_0x9b26('0x10')]=0x0;for(var _0x31b0f8=0x0;_0x31b0f8=0x0?this['available']:0x0;var _0xe6b725={'id':this['id'],'available':this[_0x9b26('0x14')],'loggedIn':this[_0x9b26('0xf')],'name':this[_0x9b26('0x4')],'paused':this[_0x9b26('0x10')],'waiting':this[_0x9b26('0x15')]};var _0x28428e=md5(JSON[_0x9b26('0x16')](_0xe6b725));if(this['md5']!==_0x28428e){this[_0x9b26('0x9')]=_0x28428e;io['to'](util[_0x9b26('0x17')](_0x9b26('0x18'),_0xe6b725[_0x9b26('0x4')]))['emit'](_0x9b26('0x19'),_0xe6b725);}};module[_0x9b26('0x1a')]=FaxQueue; \ No newline at end of file +var _0xc0c8=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','available','paused','waiting','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis'];(function(_0x22900f,_0x10409b){var _0x5ab1c1=function(_0x2a16b2){while(--_0x2a16b2){_0x22900f['push'](_0x22900f['shift']());}};_0x5ab1c1(++_0x10409b);}(_0xc0c8,0x1ad));var _0x8c0c=function(_0x28c65d,_0x351ca4){_0x28c65d=_0x28c65d-0x0;var _0x3cea35=_0xc0c8[_0x28c65d];return _0x3cea35;};'use strict';var _=require('lodash');var md5=require(_0x8c0c('0x0'));var util=require(_0x8c0c('0x1'));var Redis=require(_0x8c0c('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x8c0c('0x3')],{'host':_0x8c0c('0x4'),'port':0x18eb});var io=require(_0x8c0c('0x5'))(new Redis(config[_0x8c0c('0x3')]));function FaxQueue(_0x38ae13){this['id']=_0x38ae13['id']||0x0;this[_0x8c0c('0x6')]=_0x38ae13['name']||'';this[_0x8c0c('0x7')]=_0x38ae13[_0x8c0c('0x7')]||0xa;this['strategy']=_0x38ae13[_0x8c0c('0x8')]||_0x8c0c('0x9');this[_0x8c0c('0xa')]=_0x38ae13[_0x8c0c('0xa')];this[_0x8c0c('0xb')]={};this['waiting']=0x0;this[_0x8c0c('0x0')]='';this[_0x8c0c('0xc')]();this[_0x8c0c('0xd')]();}FaxQueue['prototype'][_0x8c0c('0xc')]=function(){var _0x5cb2e4=this[_0x8c0c('0xb')][_0x8c0c('0xe')];this[_0x8c0c('0xb')]=_[_0x8c0c('0xf')](this['Agents'],'id');this[_0x8c0c('0xb')][_0x8c0c('0xe')]=_0x5cb2e4;};FaxQueue[_0x8c0c('0x10')][_0x8c0c('0xd')]=function(){this[_0x8c0c('0x11')]=0x0;this['paused']=0x0;for(var _0x63d3a6=0x0;_0x63d3a6=0x0?this[_0x8c0c('0x13')]:0x0;var _0x182f82={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8c0c('0x11')],'name':this['name'],'paused':this[_0x8c0c('0x14')],'waiting':this[_0x8c0c('0x15')]};var _0x2b0834=md5(JSON[_0x8c0c('0x16')](_0x182f82));if(this['md5']!==_0x2b0834){this[_0x8c0c('0x0')]=_0x2b0834;io['to'](util['format'](_0x8c0c('0x17'),_0x182f82[_0x8c0c('0x6')]))[_0x8c0c('0x18')](_0x8c0c('0x19'),_0x182f82);}};module[_0x8c0c('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 41fc70d..36957e5 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 _0xc872=['exports','name','Intervals'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc872,0x160));var _0x2c87=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xc872[_0xae1a83];return _0xdb9da8;};'use strict';function Interval(_0x2d373e){this['id']=_0x2d373e['id']||0x0;this['name']=_0x2d373e[_0x2c87('0x0')]||'';this[_0x2c87('0x1')]=_0x2d373e[_0x2c87('0x1')]||{};}module[_0x2c87('0x2')]=Interval; \ No newline at end of file +var _0x5e89=['Intervals','exports','name'];(function(_0x3e0790,_0x196165){var _0x45b10a=function(_0x16544f){while(--_0x16544f){_0x3e0790['push'](_0x3e0790['shift']());}};_0x45b10a(++_0x196165);}(_0x5e89,0x155));var _0x95e8=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x5e89[_0x3054be];return _0x3df150;};'use strict';function Interval(_0x2039f7){this['id']=_0x2039f7['id']||0x0;this[_0x95e8('0x0')]=_0x2039f7[_0x95e8('0x0')]||'';this['Intervals']=_0x2039f7[_0x95e8('0x1')]||{};}module[_0x95e8('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 cfbf5ae..5d30863 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 _0x5fe2=['waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','online','loggedIn','mailPause','available','format','emit','mail_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5fe2,0xd3));var _0x25fe=function(_0x1ddcf2,_0x222a1a){_0x1ddcf2=_0x1ddcf2-0x0;var _0x418a45=_0x5fe2[_0x1ddcf2];return _0x418a45;};'use strict';var _=require('lodash');var md5=require(_0x25fe('0x0'));var util=require(_0x25fe('0x1'));var Redis=require(_0x25fe('0x2'));var config=require('../../../config/environment');config[_0x25fe('0x3')]=_[_0x25fe('0x4')](config[_0x25fe('0x3')],{'host':_0x25fe('0x5'),'port':0x18eb});var io=require(_0x25fe('0x6'))(new Redis(config['redis']));function MailQueue(_0x2262a8){this['id']=_0x2262a8['id']||0x0;this[_0x25fe('0x7')]=_0x2262a8['name']||'';this[_0x25fe('0x8')]=_0x2262a8[_0x25fe('0x8')]||0xa;this[_0x25fe('0x9')]=_0x2262a8['strategy']||_0x25fe('0xa');this[_0x25fe('0xb')]=_0x2262a8[_0x25fe('0xb')];this[_0x25fe('0xc')]={};this[_0x25fe('0xd')]=0x0;this[_0x25fe('0x0')]='';this[_0x25fe('0xe')]();this[_0x25fe('0xf')]();}MailQueue['prototype'][_0x25fe('0xe')]=function(){var _0x104926=this['mapAgentsId'][_0x25fe('0x10')];this[_0x25fe('0xc')]=_[_0x25fe('0x11')](this[_0x25fe('0xb')],'id');this[_0x25fe('0xc')]['_rr']=_0x104926;};MailQueue[_0x25fe('0x12')][_0x25fe('0xf')]=function(){this['loggedIn']=0x0;this[_0x25fe('0x13')]=0x0;for(var _0x436568=0x0;_0x436568=0x0?this[_0x25fe('0x17')]:0x0;var _0x27498a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x25fe('0x7')],'paused':this[_0x25fe('0x13')],'waiting':this['waiting']};var _0x2c1d01=md5(JSON['stringify'](_0x27498a));if(this[_0x25fe('0x0')]!==_0x2c1d01){this[_0x25fe('0x0')]=_0x2c1d01;io['to'](util[_0x25fe('0x18')]('mail:queue:%s',_0x27498a[_0x25fe('0x7')]))[_0x25fe('0x19')](_0x25fe('0x1a'),_0x27498a);}};module[_0x25fe('0x1b')]=MailQueue; \ No newline at end of file +var _0x4101=['paused','loggedIn','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4101,0x183));var _0x1410=function(_0x5ade6b,_0xd320df){_0x5ade6b=_0x5ade6b-0x0;var _0x2d8fd6=_0x4101[_0x5ade6b];return _0x2d8fd6;};'use strict';var _=require(_0x1410('0x0'));var md5=require(_0x1410('0x1'));var util=require('util');var Redis=require(_0x1410('0x2'));var config=require(_0x1410('0x3'));config[_0x1410('0x4')]=_['defaults'](config[_0x1410('0x4')],{'host':_0x1410('0x5'),'port':0x18eb});var io=require(_0x1410('0x6'))(new Redis(config[_0x1410('0x4')]));function MailQueue(_0x4d6e97){this['id']=_0x4d6e97['id']||0x0;this[_0x1410('0x7')]=_0x4d6e97[_0x1410('0x7')]||'';this[_0x1410('0x8')]=_0x4d6e97[_0x1410('0x8')]||0xa;this[_0x1410('0x9')]=_0x4d6e97[_0x1410('0x9')]||'beepall';this[_0x1410('0xa')]=_0x4d6e97[_0x1410('0xa')];this[_0x1410('0xb')]={};this[_0x1410('0xc')]=0x0;this[_0x1410('0x1')]='';this[_0x1410('0xd')]();this[_0x1410('0xe')]();}MailQueue['prototype'][_0x1410('0xd')]=function(){var _0x3f33e5=this[_0x1410('0xb')][_0x1410('0xf')];this[_0x1410('0xb')]=_[_0x1410('0x10')](this[_0x1410('0xa')],'id');this[_0x1410('0xb')][_0x1410('0xf')]=_0x3f33e5;};MailQueue[_0x1410('0x11')][_0x1410('0xe')]=function(){this['loggedIn']=0x0;this[_0x1410('0x12')]=0x0;for(var _0x6317da=0x0;_0x6317da=0x0?this[_0x1410('0x15')]:0x0;var _0x1b63c1={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x1410('0x7')],'paused':this[_0x1410('0x12')],'waiting':this[_0x1410('0xc')]};var _0x47e4ae=md5(JSON[_0x1410('0x16')](_0x1b63c1));if(this[_0x1410('0x1')]!==_0x47e4ae){this[_0x1410('0x1')]=_0x47e4ae;io['to'](util[_0x1410('0x17')](_0x1410('0x18'),_0x1b63c1[_0x1410('0x7')]))['emit'](_0x1410('0x19'),_0x1b63c1);}};module[_0x1410('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d4ee66f..defb1b0 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xc4aa[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a54,0x106));var _0x47a5=function(_0x3f52c0,_0x557d25){_0x3f52c0=_0x3f52c0-0x0;var _0x12588f=_0x7a54[_0x3f52c0];return _0x12588f;};'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 c09228b..cbe80e6 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 _0xd737=['_rr','prototype','paused','length','online','smsPause','available','loggedIn','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','updateRouting','mapAgentsId','map'];(function(_0xcdf206,_0x3f0d23){var _0x3fb2d2=function(_0x3e7714){while(--_0x3e7714){_0xcdf206['push'](_0xcdf206['shift']());}};_0x3fb2d2(++_0x3f0d23);}(_0xd737,0x85));var _0x7d73=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0xd737[_0xccc0d4];return _0x27a653;};'use strict';var _=require(_0x7d73('0x0'));var md5=require('md5');var util=require(_0x7d73('0x1'));var Redis=require('ioredis');var config=require(_0x7d73('0x2'));config[_0x7d73('0x3')]=_[_0x7d73('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7d73('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5c4a2c){this['id']=_0x5c4a2c['id']||0x0;this[_0x7d73('0x6')]=_0x5c4a2c[_0x7d73('0x6')]||'';this[_0x7d73('0x7')]=_0x5c4a2c[_0x7d73('0x7')]||0xa;this[_0x7d73('0x8')]=_0x5c4a2c[_0x7d73('0x8')]||_0x7d73('0x9');this[_0x7d73('0xa')]=_0x5c4a2c['Agents'];this['mapAgentsId']={};this[_0x7d73('0xb')]=0x0;this[_0x7d73('0xc')]='';this['updateRouting']();this[_0x7d73('0xd')]();}SmsQueue['prototype'][_0x7d73('0xe')]=function(){var _0x3e2d6e=this[_0x7d73('0xf')]['_rr'];this[_0x7d73('0xf')]=_[_0x7d73('0x10')](this['Agents'],'id');this[_0x7d73('0xf')][_0x7d73('0x11')]=_0x3e2d6e;};SmsQueue[_0x7d73('0x12')][_0x7d73('0xd')]=function(){this['loggedIn']=0x0;this[_0x7d73('0x13')]=0x0;for(var _0x499223=0x0;_0x499223=0x0?this[_0x7d73('0x17')]:0x0;var _0x50539e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7d73('0x18')],'name':this[_0x7d73('0x6')],'paused':this[_0x7d73('0x13')],'waiting':this[_0x7d73('0xb')]};var _0x593072=md5(JSON['stringify'](_0x50539e));if(this[_0x7d73('0xc')]!==_0x593072){this[_0x7d73('0xc')]=_0x593072;io['to'](util[_0x7d73('0x19')](_0x7d73('0x1a'),_0x50539e['name']))[_0x7d73('0x1b')](_0x7d73('0x1c'),_0x50539e);}};module[_0x7d73('0x1d')]=SmsQueue; \ No newline at end of file +var _0xf9f7=['md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','smsPause','available','paused','format','sms:queue:%s','emit','lodash'];(function(_0x49f09b,_0x1fbfa2){var _0x5d8d32=function(_0x177bdb){while(--_0x177bdb){_0x49f09b['push'](_0x49f09b['shift']());}};_0x5d8d32(++_0x1fbfa2);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xf9f7[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x7f9f('0x0'));var md5=require(_0x7f9f('0x1'));var util=require(_0x7f9f('0x2'));var Redis=require(_0x7f9f('0x3'));var config=require(_0x7f9f('0x4'));config[_0x7f9f('0x5')]=_['defaults'](config['redis'],{'host':_0x7f9f('0x6'),'port':0x18eb});var io=require(_0x7f9f('0x7'))(new Redis(config[_0x7f9f('0x5')]));function SmsQueue(_0xee790a){this['id']=_0xee790a['id']||0x0;this[_0x7f9f('0x8')]=_0xee790a[_0x7f9f('0x8')]||'';this['timeout']=_0xee790a[_0x7f9f('0x9')]||0xa;this[_0x7f9f('0xa')]=_0xee790a[_0x7f9f('0xa')]||_0x7f9f('0xb');this[_0x7f9f('0xc')]=_0xee790a['Agents'];this[_0x7f9f('0xd')]={};this[_0x7f9f('0xe')]=0x0;this[_0x7f9f('0x1')]='';this[_0x7f9f('0xf')]();this[_0x7f9f('0x10')]();}SmsQueue[_0x7f9f('0x11')][_0x7f9f('0xf')]=function(){var _0x4a2786=this[_0x7f9f('0xd')][_0x7f9f('0x12')];this['mapAgentsId']=_['map'](this[_0x7f9f('0xc')],'id');this['mapAgentsId'][_0x7f9f('0x12')]=_0x4a2786;};SmsQueue[_0x7f9f('0x11')]['updateRealtime']=function(){this[_0x7f9f('0x13')]=0x0;this['paused']=0x0;for(var _0x292470=0x0;_0x292470=0x0?this[_0x7f9f('0x17')]:0x0;var _0x2d663e={'id':this['id'],'available':this[_0x7f9f('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7f9f('0x8')],'paused':this[_0x7f9f('0x18')],'waiting':this['waiting']};var _0x28621a=md5(JSON['stringify'](_0x2d663e));if(this[_0x7f9f('0x1')]!==_0x28621a){this[_0x7f9f('0x1')]=_0x28621a;io['to'](util[_0x7f9f('0x19')](_0x7f9f('0x1a'),_0x2d663e['name']))[_0x7f9f('0x1b')]('sms_queue:save',_0x2d663e);}};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 d4c7e48..83d3cdf 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 _0x27af=['paused','length','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','map','_rr'];(function(_0x26738b,_0x54f231){var _0x2851c8=function(_0x5b6768){while(--_0x5b6768){_0x26738b['push'](_0x26738b['shift']());}};_0x2851c8(++_0x54f231);}(_0x27af,0x17f));var _0xf27a=function(_0x3bb5e1,_0x3cfed6){_0x3bb5e1=_0x3bb5e1-0x0;var _0x48b333=_0x27af[_0x3bb5e1];return _0x48b333;};'use strict';var _=require(_0xf27a('0x0'));var md5=require(_0xf27a('0x1'));var util=require(_0xf27a('0x2'));var Redis=require(_0xf27a('0x3'));var config=require(_0xf27a('0x4'));config[_0xf27a('0x5')]=_[_0xf27a('0x6')](config[_0xf27a('0x5')],{'host':_0xf27a('0x7'),'port':0x18eb});var io=require(_0xf27a('0x8'))(new Redis(config[_0xf27a('0x5')]));function WhatsappQueue(_0x1f0628){this['id']=_0x1f0628['id']||0x0;this[_0xf27a('0x9')]=_0x1f0628['name']||'';this[_0xf27a('0xa')]=_0x1f0628[_0xf27a('0xa')]||0xa;this[_0xf27a('0xb')]=_0x1f0628[_0xf27a('0xb')]||_0xf27a('0xc');this[_0xf27a('0xd')]=_0x1f0628[_0xf27a('0xd')];this[_0xf27a('0xe')]={};this[_0xf27a('0xf')]=0x0;this[_0xf27a('0x1')]='';this['updateRouting']();this[_0xf27a('0x10')]();}WhatsappQueue[_0xf27a('0x11')]['updateRouting']=function(){var _0x18d1cf=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xf27a('0x12')](this[_0xf27a('0xd')],'id');this['mapAgentsId'][_0xf27a('0x13')]=_0x18d1cf;};WhatsappQueue[_0xf27a('0x11')][_0xf27a('0x10')]=function(){this['loggedIn']=0x0;this[_0xf27a('0x14')]=0x0;for(var _0x37aa6e=0x0;_0x37aa6e=0x0?this[_0xf27a('0x19')]:0x0;var _0x350c60={'id':this['id'],'available':this[_0xf27a('0x19')],'loggedIn':this[_0xf27a('0x17')],'name':this[_0xf27a('0x9')],'paused':this[_0xf27a('0x14')],'waiting':this[_0xf27a('0xf')]};var _0x2b48bf=md5(JSON[_0xf27a('0x1a')](_0x350c60));if(this[_0xf27a('0x1')]!==_0x2b48bf){this['md5']=_0x2b48bf;io['to'](util[_0xf27a('0x1b')](_0xf27a('0x1c'),_0x350c60[_0xf27a('0x9')]))[_0xf27a('0x1d')](_0xf27a('0x1e'),_0x350c60);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xd6a3=['strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','map','loggedIn','paused','online','available','whatsapp:queue:%s','emit','whatsapp_queue:save','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xd6a3,0x17f));var _0x3d6a=function(_0x299df2,_0x44f255){_0x299df2=_0x299df2-0x0;var _0x5bb6cc=_0xd6a3[_0x299df2];return _0x5bb6cc;};'use strict';var _=require('lodash');var md5=require(_0x3d6a('0x0'));var util=require(_0x3d6a('0x1'));var Redis=require('ioredis');var config=require(_0x3d6a('0x2'));config[_0x3d6a('0x3')]=_['defaults'](config[_0x3d6a('0x3')],{'host':_0x3d6a('0x4'),'port':0x18eb});var io=require(_0x3d6a('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x1ca436){this['id']=_0x1ca436['id']||0x0;this[_0x3d6a('0x6')]=_0x1ca436[_0x3d6a('0x6')]||'';this['timeout']=_0x1ca436[_0x3d6a('0x7')]||0xa;this[_0x3d6a('0x8')]=_0x1ca436['strategy']||_0x3d6a('0x9');this[_0x3d6a('0xa')]=_0x1ca436[_0x3d6a('0xa')];this[_0x3d6a('0xb')]={};this[_0x3d6a('0xc')]=0x0;this[_0x3d6a('0x0')]='';this['updateRouting']();this[_0x3d6a('0xd')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x285251=this['mapAgentsId'][_0x3d6a('0xe')];this[_0x3d6a('0xb')]=_[_0x3d6a('0xf')](this[_0x3d6a('0xa')],'id');this[_0x3d6a('0xb')][_0x3d6a('0xe')]=_0x285251;};WhatsappQueue['prototype'][_0x3d6a('0xd')]=function(){this[_0x3d6a('0x10')]=0x0;this[_0x3d6a('0x11')]=0x0;for(var _0x25b214=0x0;_0x25b214=0x0?this['available']:0x0;var _0x256bcb={'id':this['id'],'available':this[_0x3d6a('0x13')],'loggedIn':this[_0x3d6a('0x10')],'name':this[_0x3d6a('0x6')],'paused':this[_0x3d6a('0x11')],'waiting':this[_0x3d6a('0xc')]};var _0xaef31f=md5(JSON['stringify'](_0x256bcb));if(this[_0x3d6a('0x0')]!==_0xaef31f){this['md5']=_0xaef31f;io['to'](util['format'](_0x3d6a('0x14'),_0x256bcb[_0x3d6a('0x6')]))[_0x3d6a('0x15')](_0x3d6a('0x16'),_0x256bcb);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2ea2627..3182ac1 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 _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(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 84a8f13..4d0e7f3 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 _0x7cdf=['addTags','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x52d27f,_0x54e54a){var _0x560b36=function(_0x5c28b1){while(--_0x5c28b1){_0x52d27f['push'](_0x52d27f['shift']());}};_0x560b36(++_0x54e54a);}(_0x7cdf,0xe8));var _0xf7cd=function(_0x3e7293,_0x233fec){_0x3e7293=_0x3e7293-0x0;var _0x2847ce=_0x7cdf[_0x3e7293];return _0x2847ce;};'use strict';var client=require('../client');exports[_0xf7cd('0x0')]=function(_0x54dbc5,_0x1907dc){return client[_0xf7cd('0x1')](_0xf7cd('0x2'),{'body':_0x1907dc,'options':{'where':{'id':_0x54dbc5}},'log':'updateChatInteraction'});};exports[_0xf7cd('0x3')]=function(_0x57fc09,_0x3f0c23){return client[_0xf7cd('0x1')]('AddTagsToChatInteraction',{'body':_0x3f0c23,'options':{'where':{'id':_0x57fc09}},'log':_0xf7cd('0x4')});}; \ No newline at end of file +var _0x06ed=['UpdateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x06ed,0x101));var _0xd06e=function(_0x3213db,_0x381786){_0x3213db=_0x3213db-0x0;var _0x54cf54=_0x06ed[_0x3213db];return _0x54cf54;};'use strict';var client=require(_0xd06e('0x0'));exports['update']=function(_0x346d21,_0x4a99b4){return client['Request'](_0xd06e('0x1'),{'body':_0x4a99b4,'options':{'where':{'id':_0x346d21}},'log':'updateChatInteraction'});};exports[_0xd06e('0x2')]=function(_0x52dcb6,_0x4f73e1){return client[_0xd06e('0x3')](_0xd06e('0x4'),{'body':_0x4f73e1,'options':{'where':{'id':_0x52dcb6}},'log':_0xd06e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f70ab05..558830b 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 _0x550f=['createChatMessage','Request','CreateChatMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x550f,0x13c));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x53abe3){return client[_0xf550('0x0')](_0xf550('0x1'),{'body':_0x53abe3,'log':_0xf550('0x2')});}; \ No newline at end of file +var _0x92fe=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x11b18b,_0x2e6a9e){var _0xb8dfc5=function(_0x427ad3){while(--_0x427ad3){_0x11b18b['push'](_0x11b18b['shift']());}};_0xb8dfc5(++_0x2e6a9e);}(_0x92fe,0x108));var _0xe92f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92fe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe92f('0x0'));exports[_0xe92f('0x1')]=function(_0x216790){return client[_0xe92f('0x2')](_0xe92f('0x3'),{'body':_0x216790,'log':_0xe92f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ba0aa5d..34aae31 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 _0x212b=['User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout'];(function(_0x254aef,_0x215f5b){var _0x376a0f=function(_0x41329e){while(--_0x41329e){_0x254aef['push'](_0x254aef['shift']());}};_0x376a0f(++_0x215f5b);}(_0x212b,0x148));var _0xb212=function(_0x270aae,_0x3bbc7b){_0x270aae=_0x270aae-0x0;var _0x53e7a2=_0x212b[_0x270aae];return _0x53e7a2;};'use strict';var client=require(_0xb212('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xb212('0x1')](_0xb212('0x2'),{'options':{'raw':![],'attributes':['id',_0xb212('0x3'),_0xb212('0x4'),'strategy'],'include':[{'model':_0xb212('0x5'),'as':_0xb212('0x6'),'attributes':['id',_0xb212('0x3'),'online',_0xb212('0x7')]}]},'log':_0xb212('0x8')});};}; \ No newline at end of file +var _0x4491=['User','Agents','chatPause','../client','Request','name','timeout','strategy'];(function(_0xc11ec4,_0x2cc50b){var _0x2b75f2=function(_0x50aaad){while(--_0x50aaad){_0xc11ec4['push'](_0xc11ec4['shift']());}};_0x2b75f2(++_0x2cc50b);}(_0x4491,0x1bb));var _0x1449=function(_0xcc5e6b,_0x36a785){_0xcc5e6b=_0xcc5e6b-0x0;var _0x3935b8=_0x4491[_0xcc5e6b];return _0x3935b8;};'use strict';var client=require(_0x1449('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x1449('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x1449('0x2'),_0x1449('0x3'),_0x1449('0x4')],'include':[{'model':_0x1449('0x5'),'as':_0x1449('0x6'),'attributes':['id',_0x1449('0x2'),'online',_0x1449('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3b5ed4d..1e1f6f5 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 _0xa049=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x5ac463,_0x17d820){var _0x5ad6b8=function(_0x571cda){while(--_0x571cda){_0x5ac463['push'](_0x5ac463['shift']());}};_0x5ad6b8(++_0x17d820);}(_0xa049,0x1db));var _0x9a04=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xa049[_0x4f83ca];return _0x1fbac3;};'use strict';var client=require(_0x9a04('0x0'));exports[_0x9a04('0x1')]=function(_0x4d8743){return client[_0x9a04('0x2')](_0x9a04('0x3'),{'body':_0x4d8743,'log':_0x9a04('0x3')});};exports[_0x9a04('0x4')]=function(_0x3d2f24,_0x2ced45){return client[_0x9a04('0x2')](_0x9a04('0x5'),{'body':_0x2ced45,'options':{'where':{'uniqueid':_0x3d2f24},'order':[['id',_0x9a04('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xe105=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x274d4c,_0x296cbd){var _0x10187c=function(_0x221623){while(--_0x221623){_0x274d4c['push'](_0x274d4c['shift']());}};_0x10187c(++_0x296cbd);}(_0xe105,0xef));var _0x5e10=function(_0x680e70,_0x5942c6){_0x680e70=_0x680e70-0x0;var _0x28998d=_0xe105[_0x680e70];return _0x28998d;};'use strict';var client=require(_0x5e10('0x0'));exports['create']=function(_0x4d5a73){return client['Request']('CreateChatQueueReport',{'body':_0x4d5a73,'log':_0x5e10('0x1')});};exports[_0x5e10('0x2')]=function(_0x1cddb3,_0x191ab2){return client['Request'](_0x5e10('0x3'),{'body':_0x191ab2,'options':{'where':{'uniqueid':_0x1cddb3},'order':[['id',_0x5e10('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0dc1b78..49bb044 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x22dbcf,_0x3671b7){var _0x443194=function(_0x4bf1ce){while(--_0x4bf1ce){_0x22dbcf['push'](_0x22dbcf['shift']());}};_0x443194(++_0x3671b7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x7a54,0x106));var _0x47a5=function(_0xd36fe8,_0x2ae33f){_0xd36fe8=_0xd36fe8-0x0;var _0x427059=_0x7a54[_0xd36fe8];return _0x427059;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index d9ce7df..be1069e 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 _0x251a=['CreateFaxMessage','createFaxMessage','../client'];(function(_0x2c1991,_0x548ad7){var _0x47dd56=function(_0x232fbd){while(--_0x232fbd){_0x2c1991['push'](_0x2c1991['shift']());}};_0x47dd56(++_0x548ad7);}(_0x251a,0x8c));var _0xa251=function(_0x169790,_0x48aa33){_0x169790=_0x169790-0x0;var _0x4d0f36=_0x251a[_0x169790];return _0x4d0f36;};'use strict';var client=require(_0xa251('0x0'));exports['create']=function(_0xfd4bc0){return client['Request'](_0xa251('0x1'),{'body':_0xfd4bc0,'log':_0xa251('0x2')});}; \ No newline at end of file +var _0x2701=['../client','CreateFaxMessage','createFaxMessage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2701,0x1d1));var _0x1270=function(_0x2d9d59,_0x2e383e){_0x2d9d59=_0x2d9d59-0x0;var _0x4ee6a6=_0x2701[_0x2d9d59];return _0x4ee6a6;};'use strict';var client=require(_0x1270('0x0'));exports['create']=function(_0x15628b){return client['Request'](_0x1270('0x1'),{'body':_0x15628b,'log':_0x1270('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1277ff6..dee52e6 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 _0x970f=['Request','GetFaxQueue','name','strategy','Agents','online','faxPause','getFaxQueues'];(function(_0x1a6bab,_0x73d7f){var _0x4947c5=function(_0x238dff){while(--_0x238dff){_0x1a6bab['push'](_0x1a6bab['shift']());}};_0x4947c5(++_0x73d7f);}(_0x970f,0x1a8));var _0xf970=function(_0x5952b6,_0x45596c){_0x5952b6=_0x5952b6-0x0;var _0x5f12bd=_0x970f[_0x5952b6];return _0x5f12bd;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xf970('0x0')](_0xf970('0x1'),{'options':{'raw':![],'attributes':['id',_0xf970('0x2'),'timeout',_0xf970('0x3')],'include':[{'model':'User','as':_0xf970('0x4'),'attributes':['id',_0xf970('0x2'),_0xf970('0x5'),_0xf970('0x6')]}]},'log':_0xf970('0x7')});};}; \ No newline at end of file +var _0xd5c4=['strategy','Agents','online','faxPause','getFaxQueues','Request','name','timeout'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0xd5c4,0x104));var _0x4d5c=function(_0x5baa47,_0x3d35a7){_0x5baa47=_0x5baa47-0x0;var _0xb1bcc0=_0xd5c4[_0x5baa47];return _0xb1bcc0;};'use strict';var client=require('../client');exports[_0x4d5c('0x0')]=function(){return function(){return client[_0x4d5c('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4d5c('0x2'),_0x4d5c('0x3'),_0x4d5c('0x4')],'include':[{'model':'User','as':_0x4d5c('0x5'),'attributes':['id',_0x4d5c('0x2'),_0x4d5c('0x6'),_0x4d5c('0x7')]}]},'log':_0x4d5c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0357b1c..52fc1aa 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 _0x9e2a=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client'];(function(_0x579293,_0x3315f6){var _0x252717=function(_0x4fed96){while(--_0x4fed96){_0x579293['push'](_0x579293['shift']());}};_0x252717(++_0x3315f6);}(_0x9e2a,0x1b1));var _0xa9e2=function(_0x25955c,_0x4cff9a){_0x25955c=_0x25955c-0x0;var _0x5c38a1=_0x9e2a[_0x25955c];return _0x5c38a1;};'use strict';var client=require(_0xa9e2('0x0'));exports[_0xa9e2('0x1')]=function(_0x4aae52){return client[_0xa9e2('0x2')](_0xa9e2('0x3'),{'body':_0x4aae52,'log':'CreateFaxQueueReport'});};exports[_0xa9e2('0x4')]=function(_0x24f9d1,_0x461819){return client[_0xa9e2('0x2')]('UpdateFaxQueueReport',{'body':_0x461819,'options':{'where':{'uniqueid':_0x24f9d1},'order':[['id',_0xa9e2('0x5')]],'limit':0x1},'log':_0xa9e2('0x6')});}; \ No newline at end of file +var _0xa5f4=['UpdateFaxQueueReport','DESC','../client','Request','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa5f4,0xd4));var _0x4a5f=function(_0x15432d,_0xd5320d){_0x15432d=_0x15432d-0x0;var _0x724bec=_0xa5f4[_0x15432d];return _0x724bec;};'use strict';var client=require(_0x4a5f('0x0'));exports['create']=function(_0x7f9a61){return client[_0x4a5f('0x1')]('CreateFaxQueueReport',{'body':_0x7f9a61,'log':'CreateFaxQueueReport'});};exports[_0x4a5f('0x2')]=function(_0x1b1fb7,_0x14a6f7){return client[_0x4a5f('0x1')](_0x4a5f('0x3'),{'body':_0x14a6f7,'options':{'where':{'uniqueid':_0x1b1fb7},'order':[['id',_0x4a5f('0x4')]],'limit':0x1},'log':_0x4a5f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 7813cc3..288f2f3 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 _0xd621=['GetInterval','name','Interval','interval','../client','getIntervals','Request'];(function(_0x59dceb,_0x1fdefc){var _0x1aafa9=function(_0x38c524){while(--_0x38c524){_0x59dceb['push'](_0x59dceb['shift']());}};_0x1aafa9(++_0x1fdefc);}(_0xd621,0x1a8));var _0x1d62=function(_0x192772,_0x100b16){_0x192772=_0x192772-0x0;var _0x2b50bd=_0xd621[_0x192772];return _0x2b50bd;};'use strict';var client=require(_0x1d62('0x0'));exports[_0x1d62('0x1')]=function(){return function(){return client[_0x1d62('0x2')](_0x1d62('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1d62('0x4')],'include':[{'model':_0x1d62('0x5'),'as':'Intervals','attributes':['id','name',_0x1d62('0x6')]}]},'log':_0x1d62('0x1')});};}; \ No newline at end of file +var _0x5948=['name','interval','../client','getIntervals','Request','GetInterval'];(function(_0x514bb2,_0x385dd5){var _0x12ed88=function(_0x38df0){while(--_0x38df0){_0x514bb2['push'](_0x514bb2['shift']());}};_0x12ed88(++_0x385dd5);}(_0x5948,0x176));var _0x8594=function(_0x171b2f,_0x337677){_0x171b2f=_0x171b2f-0x0;var _0x4678d8=_0x5948[_0x171b2f];return _0x4678d8;};'use strict';var client=require(_0x8594('0x0'));exports[_0x8594('0x1')]=function(){return function(){return client[_0x8594('0x2')](_0x8594('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8594('0x4'),_0x8594('0x5')]}]},'log':_0x8594('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c465f66..09fb56a 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 _0x160f=['UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x1a80da,_0x1b532b){var _0x1c1df0=function(_0x21476f){while(--_0x21476f){_0x1a80da['push'](_0x1a80da['shift']());}};_0x1c1df0(++_0x1b532b);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf160('0x0'));exports[_0xf160('0x1')]=function(_0x2d4cde,_0x2966aa){return client['Request'](_0xf160('0x2'),{'body':_0x2966aa,'options':{'where':{'id':_0x2d4cde}},'log':_0xf160('0x3')});};exports[_0xf160('0x4')]=function(_0x3b2d7b,_0x194331){return client[_0xf160('0x5')]('AddTagsToMailInteraction',{'body':_0x194331,'options':{'where':{'id':_0x3b2d7b}},'log':_0xf160('0x6')});}; \ No newline at end of file +var _0x3423=['AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x3bf64e,_0x477041){var _0x1e52cd=function(_0x9cbf35){while(--_0x9cbf35){_0x3bf64e['push'](_0x3bf64e['shift']());}};_0x1e52cd(++_0x477041);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['update']=function(_0x381e58,_0x16bdb3){return client[_0x3342('0x0')](_0x3342('0x1'),{'body':_0x16bdb3,'options':{'where':{'id':_0x381e58}},'log':_0x3342('0x2')});};exports[_0x3342('0x3')]=function(_0x2207ce,_0x3c5d8d){return client[_0x3342('0x0')](_0x3342('0x4'),{'body':_0x3c5d8d,'options':{'where':{'id':_0x2207ce}},'log':_0x3342('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 72c514e..9e9aa27 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 _0x04e5=['createMailMessage','create','Request'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0x04e5,0x15d));var _0x504e=function(_0x584619,_0x511231){_0x584619=_0x584619-0x0;var _0x24254e=_0x04e5[_0x584619];return _0x24254e;};'use strict';var client=require('../client');exports[_0x504e('0x0')]=function(_0x499910){return client[_0x504e('0x1')]('CreateMailMessage',{'body':_0x499910,'log':_0x504e('0x2')});}; \ No newline at end of file +var _0xbb6d=['createMailMessage','../client','create','Request'];(function(_0x4bb425,_0x644b34){var _0x56c5e2=function(_0x48b09c){while(--_0x48b09c){_0x4bb425['push'](_0x4bb425['shift']());}};_0x56c5e2(++_0x644b34);}(_0xbb6d,0x7d));var _0xdbb6=function(_0x16fe64,_0x5878b3){_0x16fe64=_0x16fe64-0x0;var _0x52514d=_0xbb6d[_0x16fe64];return _0x52514d;};'use strict';var client=require(_0xdbb6('0x0'));exports[_0xdbb6('0x1')]=function(_0x28179f){return client[_0xdbb6('0x2')]('CreateMailMessage',{'body':_0x28179f,'log':_0xdbb6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 1cf0013..146d5a4 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 _0x6b4c=['../client','getMailQueues','Request','GetMailQueue','name','timeout','User','online','mailPause'];(function(_0x1d2d4c,_0x340107){var _0x58ed56=function(_0xf95ad){while(--_0xf95ad){_0x1d2d4c['push'](_0x1d2d4c['shift']());}};_0x58ed56(++_0x340107);}(_0x6b4c,0xc6));var _0xc6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc6b4('0x0'));exports[_0xc6b4('0x1')]=function(){return function(){return client[_0xc6b4('0x2')](_0xc6b4('0x3'),{'options':{'raw':![],'attributes':['id',_0xc6b4('0x4'),_0xc6b4('0x5'),'strategy'],'include':[{'model':_0xc6b4('0x6'),'as':'Agents','attributes':['id','name',_0xc6b4('0x7'),_0xc6b4('0x8')]}]},'log':_0xc6b4('0x1')});};}; \ No newline at end of file +var _0xefab=['User','Agents','mailPause','../client','getMailQueues','Request','name','strategy'];(function(_0x4c36b6,_0x3249ba){var _0xb82265=function(_0x2939f7){while(--_0x2939f7){_0x4c36b6['push'](_0x4c36b6['shift']());}};_0xb82265(++_0x3249ba);}(_0xefab,0x73));var _0xbefa=function(_0x247e76,_0x404f2b){_0x247e76=_0x247e76-0x0;var _0x4aaac1=_0xefab[_0x247e76];return _0x4aaac1;};'use strict';var client=require(_0xbefa('0x0'));exports[_0xbefa('0x1')]=function(){return function(){return client[_0xbefa('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xbefa('0x3'),'timeout',_0xbefa('0x4')],'include':[{'model':_0xbefa('0x5'),'as':_0xbefa('0x6'),'attributes':['id',_0xbefa('0x3'),'online',_0xbefa('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b2f281b..362f0d1 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 _0x6fdc=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x1cc12d,_0x1325df){var _0x46395c=function(_0x230f60){while(--_0x230f60){_0x1cc12d['push'](_0x1cc12d['shift']());}};_0x46395c(++_0x1325df);}(_0x6fdc,0xc9));var _0xc6fd=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x6fdc[_0x478414];return _0x5eb6b9;};'use strict';var client=require(_0xc6fd('0x0'));exports[_0xc6fd('0x1')]=function(_0x574377){return client['Request']('CreateMailQueueReport',{'body':_0x574377,'log':_0xc6fd('0x2')});};exports[_0xc6fd('0x3')]=function(_0x3c7524,_0x1e60dd){return client[_0xc6fd('0x4')](_0xc6fd('0x5'),{'body':_0x1e60dd,'options':{'where':{'uniqueid':_0x3c7524},'order':[['id',_0xc6fd('0x6')]],'limit':0x1},'log':_0xc6fd('0x5')});}; \ No newline at end of file +var _0x45f7=['../client','create','CreateMailQueueReport','UpdateMailQueueReport','DESC'];(function(_0x46fd7d,_0x2fa147){var _0x3d64aa=function(_0x5da960){while(--_0x5da960){_0x46fd7d['push'](_0x46fd7d['shift']());}};_0x3d64aa(++_0x2fa147);}(_0x45f7,0x1c2));var _0x745f=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x45f7[_0x24f31b];return _0x488401;};'use strict';var client=require(_0x745f('0x0'));exports[_0x745f('0x1')]=function(_0x16b4e4){return client['Request']('CreateMailQueueReport',{'body':_0x16b4e4,'log':_0x745f('0x2')});};exports['update']=function(_0x97964c,_0x2a3bad){return client['Request'](_0x745f('0x3'),{'body':_0x2a3bad,'options':{'where':{'uniqueid':_0x97964c},'order':[['id',_0x745f('0x4')]],'limit':0x1},'log':_0x745f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ace8ed3..934e840 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 _0x89d1=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request'];(function(_0x545461,_0x1891be){var _0x35db74=function(_0x4a9c91){while(--_0x4a9c91){_0x545461['push'](_0x545461['shift']());}};_0x35db74(++_0x1891be);}(_0x89d1,0x133));var _0x189d=function(_0x65fb8e,_0xc5ec5b){_0x65fb8e=_0x65fb8e-0x0;var _0x2b00ff=_0x89d1[_0x65fb8e];return _0x2b00ff;};'use strict';var client=require(_0x189d('0x0'));exports[_0x189d('0x1')]=function(_0x21091f,_0x5297a2){return client['Request'](_0x189d('0x2'),{'body':_0x5297a2,'options':{'where':{'id':_0x21091f}},'log':_0x189d('0x3')});};exports['addTags']=function(_0xea43ce,_0x28555d){return client[_0x189d('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x28555d,'options':{'where':{'id':_0xea43ce}},'log':_0x189d('0x5')});}; \ No newline at end of file +var _0x19f1=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x2323c1,_0x5a2bfb){var _0x29d511=function(_0x267399){while(--_0x267399){_0x2323c1['push'](_0x2323c1['shift']());}};_0x29d511(++_0x5a2bfb);}(_0x19f1,0x128));var _0x119f=function(_0x290f49,_0x2be0e1){_0x290f49=_0x290f49-0x0;var _0x118023=_0x19f1[_0x290f49];return _0x118023;};'use strict';var client=require(_0x119f('0x0'));exports[_0x119f('0x1')]=function(_0x3968ba,_0xb75086){return client[_0x119f('0x2')]('UpdateOpenchannelInteraction',{'body':_0xb75086,'options':{'where':{'id':_0x3968ba}},'log':_0x119f('0x3')});};exports['addTags']=function(_0x4223a0,_0x214ce4){return client['Request'](_0x119f('0x4'),{'body':_0x214ce4,'options':{'where':{'id':_0x4223a0}},'log':_0x119f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 363b365..9ca2529 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 _0x6f63=['CreateOpenchannelMessage','create','Request'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x6f63,0x136));var _0x36f6=function(_0x2eada0,_0x4ccc54){_0x2eada0=_0x2eada0-0x0;var _0x26c03f=_0x6f63[_0x2eada0];return _0x26c03f;};'use strict';var client=require('../client');exports[_0x36f6('0x0')]=function(_0x11a646){return client[_0x36f6('0x1')](_0x36f6('0x2'),{'body':_0x11a646,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x1f47=['create','Request','createOpenchannelMessage','../client'];(function(_0x43df08,_0x3e32dc){var _0x2dd3cf=function(_0x4a3c57){while(--_0x4a3c57){_0x43df08['push'](_0x43df08['shift']());}};_0x2dd3cf(++_0x3e32dc);}(_0x1f47,0x143));var _0x71f4=function(_0x2ef79d,_0x165883){_0x2ef79d=_0x2ef79d-0x0;var _0x952df5=_0x1f47[_0x2ef79d];return _0x952df5;};'use strict';var client=require(_0x71f4('0x0'));exports[_0x71f4('0x1')]=function(_0x2ac477){return client[_0x71f4('0x2')]('CreateOpenchannelMessage',{'body':_0x2ac477,'log':_0x71f4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f488bd6..c9225b1 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 _0xc519=['User','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x11de83,_0x49e1c1){var _0x45bdb0=function(_0x51041e){while(--_0x51041e){_0x11de83['push'](_0x11de83['shift']());}};_0x45bdb0(++_0x49e1c1);}(_0xc519,0x1ea));var _0x9c51=function(_0xbc88bc,_0x10ea66){_0xbc88bc=_0xbc88bc-0x0;var _0x548858=_0xc519[_0xbc88bc];return _0x548858;};'use strict';var client=require(_0x9c51('0x0'));exports[_0x9c51('0x1')]=function(){return function(){return client['Request'](_0x9c51('0x2'),{'options':{'raw':![],'attributes':['id',_0x9c51('0x3'),_0x9c51('0x4'),_0x9c51('0x5')],'include':[{'model':_0x9c51('0x6'),'as':'Agents','attributes':['id',_0x9c51('0x3'),'online',_0x9c51('0x7')]}]},'log':_0x9c51('0x1')});};}; \ No newline at end of file +var _0x88c8=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','Agents','online'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0x88c8,0x99));var _0x888c=function(_0x299f04,_0x3547d3){_0x299f04=_0x299f04-0x0;var _0x5e77ba=_0x88c8[_0x299f04];return _0x5e77ba;};'use strict';var client=require(_0x888c('0x0'));exports[_0x888c('0x1')]=function(){return function(){return client['Request'](_0x888c('0x2'),{'options':{'raw':![],'attributes':['id',_0x888c('0x3'),_0x888c('0x4'),'strategy'],'include':[{'model':'User','as':_0x888c('0x5'),'attributes':['id',_0x888c('0x3'),_0x888c('0x6'),_0x888c('0x7')]}]},'log':_0x888c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f34fdc3..166e6ca 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 _0xaf31=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x6f1277,_0x174c39){var _0x3512af=function(_0x36d5f0){while(--_0x36d5f0){_0x6f1277['push'](_0x6f1277['shift']());}};_0x3512af(++_0x174c39);}(_0xaf31,0xb4));var _0x1af3=function(_0x4f1335,_0x4be8dd){_0x4f1335=_0x4f1335-0x0;var _0x4a8cc5=_0xaf31[_0x4f1335];return _0x4a8cc5;};'use strict';var client=require(_0x1af3('0x0'));exports[_0x1af3('0x1')]=function(_0x478711){return client['Request'](_0x1af3('0x2'),{'body':_0x478711,'log':_0x1af3('0x2')});};exports[_0x1af3('0x3')]=function(_0x5f0632,_0x6aa40e){return client[_0x1af3('0x4')](_0x1af3('0x5'),{'body':_0x6aa40e,'options':{'where':{'uniqueid':_0x5f0632},'order':[['id',_0x1af3('0x6')]],'limit':0x1},'log':_0x1af3('0x5')});}; \ No newline at end of file +var _0x1bfd=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x43488d,_0x46b899){var _0x3efb1b=function(_0x1eea78){while(--_0x1eea78){_0x43488d['push'](_0x43488d['shift']());}};_0x3efb1b(++_0x46b899);}(_0x1bfd,0xbc));var _0xd1bf=function(_0x512b48,_0xa3924f){_0x512b48=_0x512b48-0x0;var _0x278a76=_0x1bfd[_0x512b48];return _0x278a76;};'use strict';var client=require(_0xd1bf('0x0'));exports[_0xd1bf('0x1')]=function(_0x5c9c10){return client['Request'](_0xd1bf('0x2'),{'body':_0x5c9c10,'log':_0xd1bf('0x2')});};exports[_0xd1bf('0x3')]=function(_0x422d52,_0x2b6830){return client[_0xd1bf('0x4')](_0xd1bf('0x5'),{'body':_0x2b6830,'options':{'where':{'uniqueid':_0x422d52},'order':[['id',_0xd1bf('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9bf4ab3..19defed 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 _0x9a19=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x5449e1,_0x5d8939){var _0x1796c9=function(_0x1a1716){while(--_0x1a1716){_0x5449e1['push'](_0x5449e1['shift']());}};_0x1796c9(++_0x5d8939);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b,_0x51ef2b){return client[_0x99a1('0x2')](_0x99a1('0x3'),{'body':_0x51ef2b,'options':{'where':{'id':_0x3d860b}},'log':_0x99a1('0x4')});};exports[_0x99a1('0x5')]=function(_0x214082,_0x3d73c5){return client[_0x99a1('0x2')](_0x99a1('0x6'),{'body':_0x3d73c5,'options':{'where':{'id':_0x214082}},'log':_0x99a1('0x7')});}; \ No newline at end of file +var _0xb4e6=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x4d8751,_0x383108){var _0x2f77b1=function(_0x23dcc5){while(--_0x23dcc5){_0x4d8751['push'](_0x4d8751['shift']());}};_0x2f77b1(++_0x383108);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xb4e6[_0x20e7e3];return _0x14b9de;};'use strict';var client=require(_0x6b4e('0x0'));exports[_0x6b4e('0x1')]=function(_0x3c385b,_0x9babca){return client[_0x6b4e('0x2')](_0x6b4e('0x3'),{'body':_0x9babca,'options':{'where':{'id':_0x3c385b}},'log':'updateSmsInteraction'});};exports[_0x6b4e('0x4')]=function(_0x55df8c,_0x1f75ee){return client[_0x6b4e('0x2')](_0x6b4e('0x5'),{'body':_0x1f75ee,'options':{'where':{'id':_0x55df8c}},'log':_0x6b4e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4eb18f6..dfbf492 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 _0xb4d9=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x47f604,_0x4367b7){var _0x3341fa=function(_0x2a06da){while(--_0x2a06da){_0x47f604['push'](_0x47f604['shift']());}};_0x3341fa(++_0x4367b7);}(_0xb4d9,0x96));var _0x9b4d=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb4d9[_0x2ec461];return _0x28603d;};'use strict';var client=require(_0x9b4d('0x0'));exports[_0x9b4d('0x1')]=function(_0x8bd3b7){return client[_0x9b4d('0x2')](_0x9b4d('0x3'),{'body':_0x8bd3b7,'log':_0x9b4d('0x4')});}; \ No newline at end of file +var _0x0d5d=['create','Request','../client'];(function(_0x2fef3c,_0x39e5ea){var _0x211028=function(_0x48862a){while(--_0x48862a){_0x2fef3c['push'](_0x2fef3c['shift']());}};_0x211028(++_0x39e5ea);}(_0x0d5d,0xb9));var _0xd0d5=function(_0x5bde81,_0x15c3cf){_0x5bde81=_0x5bde81-0x0;var _0x282a6a=_0x0d5d[_0x5bde81];return _0x282a6a;};'use strict';var client=require(_0xd0d5('0x0'));exports[_0xd0d5('0x1')]=function(_0x3b4557){return client[_0xd0d5('0x2')]('CreateSmsMessage',{'body':_0x3b4557,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 34f3945..d219c4d 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x1cb5d8,_0x55b0f6){var _0xd9a488=function(_0x4c8350){while(--_0x4c8350){_0x1cb5d8['push'](_0x1cb5d8['shift']());}};_0xd9a488(++_0x55b0f6);}(_0xe706,0xa3));var _0x6e70=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0xe706[_0x4ed786];return _0x2f0243;};'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 fa9891a..006dc50 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x226a5e,_0x58d544){var _0x3eee4b=function(_0x5ea16e){while(--_0x5ea16e){_0x226a5e['push'](_0x226a5e['shift']());}};_0x3eee4b(++_0x58d544);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xedd9,0xfc));var _0x9edd=function(_0xec18aa,_0x181a50){_0xec18aa=_0xec18aa-0x0;var _0x51fd4b=_0xedd9[_0xec18aa];return _0x51fd4b;};'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 7f2ca88..756a2e9 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(_0x1ce327,_0x2eb164){var _0x359aff=function(_0x511ed9){while(--_0x511ed9){_0x1ce327['push'](_0x1ce327['shift']());}};_0x359aff(++_0x2eb164);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x257817,_0xbfc60e){var _0x108418=function(_0x382a18){while(--_0x382a18){_0x257817['push'](_0x257817['shift']());}};_0x108418(++_0xbfc60e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 c4f634c..d6e7805 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 _0x39e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x19cfba,_0x7ebc84){var _0x39ddf7=function(_0x5347a5){while(--_0x5347a5){_0x19cfba['push'](_0x19cfba['shift']());}};_0x39ddf7(++_0x7ebc84);}(_0x39e6,0x9e));var _0x639e=function(_0x267dfd,_0x23472a){_0x267dfd=_0x267dfd-0x0;var _0xb12a05=_0x39e6[_0x267dfd];return _0xb12a05;};'use strict';var client=require(_0x639e('0x0'));exports['update']=function(_0x2b265a,_0x5719fc){return client['Request'](_0x639e('0x1'),{'body':_0x5719fc,'options':{'where':{'id':_0x2b265a}},'log':_0x639e('0x2')});};exports['addTags']=function(_0x467229,_0x207d6a){return client[_0x639e('0x3')](_0x639e('0x4'),{'body':_0x207d6a,'options':{'where':{'id':_0x467229}},'log':_0x639e('0x5')});}; \ No newline at end of file +var _0x6691=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x25886e,_0x460831){var _0x4ae3dd=function(_0x586863){while(--_0x586863){_0x25886e['push'](_0x25886e['shift']());}};_0x4ae3dd(++_0x460831);}(_0x6691,0x12d));var _0x1669=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6691[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x1669('0x0'));exports[_0x1669('0x1')]=function(_0xc9ad5a,_0x1cc116){return client[_0x1669('0x2')](_0x1669('0x3'),{'body':_0x1cc116,'options':{'where':{'id':_0xc9ad5a}},'log':_0x1669('0x4')});};exports[_0x1669('0x5')]=function(_0x19a3f5,_0x2ad807){return client['Request'](_0x1669('0x6'),{'body':_0x2ad807,'options':{'where':{'id':_0x19a3f5}},'log':_0x1669('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2bec9e0..cdad646 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 _0xb2e7=['Request','createWhatsappMessage','../client','create'];(function(_0x2033e2,_0x4a5bbc){var _0x623c11=function(_0x8ab359){while(--_0x8ab359){_0x2033e2['push'](_0x2033e2['shift']());}};_0x623c11(++_0x4a5bbc);}(_0xb2e7,0x6e));var _0x7b2e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb2e7[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x7b2e('0x0'));exports[_0x7b2e('0x1')]=function(_0x2b61bb){return client[_0x7b2e('0x2')]('CreateWhatsappMessage',{'body':_0x2b61bb,'log':_0x7b2e('0x3')});}; \ No newline at end of file +var _0xcec9=['createWhatsappMessage'];(function(_0x4ebebf,_0x11e4fb){var _0x16537d=function(_0x1e186b){while(--_0x1e186b){_0x4ebebf['push'](_0x4ebebf['shift']());}};_0x16537d(++_0x11e4fb);}(_0xcec9,0xd6));var _0x9cec=function(_0x465fb2,_0xc0ea87){_0x465fb2=_0x465fb2-0x0;var _0x1d32db=_0xcec9[_0x465fb2];return _0x1d32db;};'use strict';var client=require('../client');exports['create']=function(_0x23808c){return client['Request']('CreateWhatsappMessage',{'body':_0x23808c,'log':_0x9cec('0x0')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5a60be9..e9b6562 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 _0x559f=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','User'];(function(_0x101f45,_0x436d30){var _0x47cb38=function(_0x1f6bb1){while(--_0x1f6bb1){_0x101f45['push'](_0x101f45['shift']());}};_0x47cb38(++_0x436d30);}(_0x559f,0x198));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf559('0x0'));exports[_0xf559('0x1')]=function(){return function(){return client[_0xf559('0x2')](_0xf559('0x3'),{'options':{'raw':![],'attributes':['id',_0xf559('0x4'),'timeout','strategy'],'include':[{'model':_0xf559('0x5'),'as':_0xf559('0x6'),'attributes':['id',_0xf559('0x4'),_0xf559('0x7'),_0xf559('0x8')]}]},'log':_0xf559('0x1')});};}; \ No newline at end of file +var _0xef17=['User','Agents','../client','getWhatsappQueues','Request','name'];(function(_0xa6c130,_0x4eb41c){var _0x2a3fd3=function(_0x360e81){while(--_0x360e81){_0xa6c130['push'](_0xa6c130['shift']());}};_0x2a3fd3(++_0x4eb41c);}(_0xef17,0xc8));var _0x7ef1=function(_0x26c314,_0x2b406f){_0x26c314=_0x26c314-0x0;var _0x406f22=_0xef17[_0x26c314];return _0x406f22;};'use strict';var client=require(_0x7ef1('0x0'));exports[_0x7ef1('0x1')]=function(){return function(){return client[_0x7ef1('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x7ef1('0x3'),'timeout','strategy'],'include':[{'model':_0x7ef1('0x4'),'as':_0x7ef1('0x5'),'attributes':['id',_0x7ef1('0x3'),'online','whatsappPause']}]},'log':_0x7ef1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6b48f26..860d4e2 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 _0xffbb=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xffbb,0x113));var _0xbffb=function(_0x47277d,_0x38c165){_0x47277d=_0x47277d-0x0;var _0x52ce72=_0xffbb[_0x47277d];return _0x52ce72;};'use strict';var client=require(_0xbffb('0x0'));exports[_0xbffb('0x1')]=function(_0x5c1de4){return client['Request'](_0xbffb('0x2'),{'body':_0x5c1de4,'log':_0xbffb('0x2')});};exports[_0xbffb('0x3')]=function(_0x51fad2,_0x141365){return client[_0xbffb('0x4')](_0xbffb('0x5'),{'body':_0x141365,'options':{'where':{'uniqueid':_0x51fad2},'order':[['id','DESC']],'limit':0x1},'log':_0xbffb('0x5')});}; \ No newline at end of file +var _0x9b0e=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x1ae51f,_0x21714b){var _0x3365cb=function(_0x19dc24){while(--_0x19dc24){_0x1ae51f['push'](_0x1ae51f['shift']());}};_0x3365cb(++_0x21714b);}(_0x9b0e,0x121));var _0xe9b0=function(_0x27ddf7,_0x1c248f){_0x27ddf7=_0x27ddf7-0x0;var _0x1d712d=_0x9b0e[_0x27ddf7];return _0x1d712d;};'use strict';var client=require(_0xe9b0('0x0'));exports[_0xe9b0('0x1')]=function(_0x325ee2){return client[_0xe9b0('0x2')](_0xe9b0('0x3'),{'body':_0x325ee2,'log':_0xe9b0('0x3')});};exports[_0xe9b0('0x4')]=function(_0x4ba750,_0x278512){return client[_0xe9b0('0x2')]('UpdateWhatsappQueueReport',{'body':_0x278512,'options':{'where':{'uniqueid':_0x4ba750},'order':[['id',_0xe9b0('0x5')]],'limit':0x1},'log':_0xe9b0('0x6')});}; \ 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 58fa67c..b14ff5f 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 _0x0a16=['map','message','join','stop','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x0a16,0x91));var _0x60a1=function(_0x502256,_0x19a90){_0x502256=_0x502256-0x0;var _0x2dfb66=_0x0a16[_0x502256];return _0x2dfb66;};'use strict';var schema=require(_0x60a1('0x0'));var _=require(_0x60a1('0x1'));var util=require('util');var seqqueue=require(_0x60a1('0x2'));var logger=require(_0x60a1('0x3'))(_0x60a1('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x60a1('0x5'),'required':!![],'message':_0x60a1('0x6')},'timeout':{'type':'number','message':_0x60a1('0x7')}});function writeLog(_0x45abc5,_0x2fe9de,_0x364b58){return logger[_0x60a1('0x8')](util[_0x60a1('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x45abc5,_0x2fe9de[_0x60a1('0xa')],_0x364b58));}function handleFindAgent(_0x38c628){return function(_0x274262){return _0x274262[_0x60a1('0xa')][_0x60a1('0xb')]()===_0x38c628[_0x60a1('0xb')]();};}exports[_0x60a1('0xc')]=function(_0x321b83,_0x334441,_0x22131d,_0xbe2eee){return function(_0x518818){try{var _0x1488f6={'name':_0x334441[0x0],'timeout':_0x334441[0x1]};var _0x5f36ef=queue[_0x60a1('0x0')](_0x1488f6,{'typecast':!![]});if(_0x5f36ef[_0x60a1('0xd')]){logger[_0x60a1('0xe')]('[%s][AGENT]\x20%s',_0x321b83,_[_0x60a1('0xf')](_0x5f36ef,_0x60a1('0x10'))[_0x60a1('0x11')](',\x20'));_0x518818[_0x60a1('0x12')]();}else{var _0x17a26d=_[_0x60a1('0x13')](_0x22131d[_0x60a1('0x14')],handleFindAgent(_0x1488f6[_0x60a1('0xa')]));if(_0x17a26d){var _0x1cdd6a=(_0x1488f6['timeout']||0xa)*0x3e8;var _0x3a140a,_0x240170;var _0x3f2233=seqqueue['createQueue'](_0x1cdd6a);_0x3f2233['id']=_0x321b83;_0x3f2233[_0x60a1('0x15')]=_0x1cdd6a;_0x3f2233[_0x60a1('0x16')]=_0xbe2eee[_0x60a1('0x16')];writeLog(_0x321b83,_0x17a26d,util[_0x60a1('0x9')](_0x60a1('0x17'),_0x1cdd6a));_0x22131d[_0x60a1('0x18')][_0x321b83]['on'](_0x60a1('0x19'),function(){logger[_0x60a1('0x8')](_0x60a1('0x1a'),_0x321b83);clearTimeout(_0x240170);_0x240170=undefined;_0x3f2233[_0x60a1('0x1b')]();if(_0x22131d['rules'][_0x321b83]){delete _0x22131d[_0x60a1('0x18')][_0x321b83];}_0x518818['stop']();});_0x22131d['rules'][_0x321b83]['on'](_0x60a1('0x1c'),function(){if(_0x22131d[_0x60a1('0x18')][_0x321b83]){delete _0x22131d['rules'][_0x321b83];}});_0x240170=setTimeout(function(){logger[_0x60a1('0x8')](_0x60a1('0x1d'),_0x321b83);clearTimeout(_0x240170);_0x3f2233[_0x60a1('0x1b')]();_0x518818['next']();},_0x1cdd6a);strategy[_0x60a1('0x1e')](_0x3f2233,_0x17a26d,_0x22131d,_0xbe2eee);}else{logger[_0x60a1('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x321b83,_0x1488f6['name']);_0x518818[_0x60a1('0x12')]();}}}catch(_0x91abd2){console['log'](_0x91abd2);logger[_0x60a1('0xe')](_0x60a1('0x1f'),_0x321b83,_0x91abd2['stack']);_0x518818[_0x60a1('0x12')]();}};}; \ No newline at end of file +var _0x5270=['validate','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','log','error','[%s][QUEUE]\x20%s','stack'];(function(_0x416131,_0x227b89){var _0x242db0=function(_0x102785){while(--_0x102785){_0x416131['push'](_0x416131['shift']());}};_0x242db0(++_0x227b89);}(_0x5270,0xcc));var _0x0527=function(_0x42dab8,_0x55e939){_0x42dab8=_0x42dab8-0x0;var _0x69e085=_0x5270[_0x42dab8];return _0x69e085;};'use strict';var schema=require(_0x0527('0x0'));var _=require(_0x0527('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x0527('0x2'))(_0x0527('0x3'));var strategy=require(_0x0527('0x4'));var queue=schema({'name':{'type':_0x0527('0x5'),'required':!![],'message':_0x0527('0x6')},'timeout':{'type':_0x0527('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x37b121,_0x568364,_0x519e85){return logger['info'](util[_0x0527('0x8')](_0x0527('0x9'),_0x37b121,_0x568364[_0x0527('0xa')],_0x519e85));}function handleFindAgent(_0x244aba){return function(_0x571766){return _0x571766[_0x0527('0xa')]['toLowerCase']()===_0x244aba[_0x0527('0xb')]();};}exports['consequence']=function(_0x4c095e,_0x422eb9,_0x24836b,_0xb9cef5){return function(_0x210b8a){try{var _0x2f1916={'name':_0x422eb9[0x0],'timeout':_0x422eb9[0x1]};var _0x432dd2=queue[_0x0527('0x0')](_0x2f1916,{'typecast':!![]});if(_0x432dd2['length']){logger['error'](_0x0527('0xc'),_0x4c095e,_[_0x0527('0xd')](_0x432dd2,_0x0527('0xe'))[_0x0527('0xf')](',\x20'));_0x210b8a[_0x0527('0x10')]();}else{var _0x2093ad=_[_0x0527('0x11')](_0x24836b[_0x0527('0x12')],handleFindAgent(_0x2f1916[_0x0527('0xa')]));if(_0x2093ad){var _0x577fc2=(_0x2f1916[_0x0527('0x13')]||0xa)*0x3e8;var _0xc921f4,_0x4d724a;var _0x532cf9=seqqueue[_0x0527('0x14')](_0x577fc2);_0x532cf9['id']=_0x4c095e;_0x532cf9[_0x0527('0x15')]=_0x577fc2;_0x532cf9[_0x0527('0x16')]=_0xb9cef5[_0x0527('0x16')];writeLog(_0x4c095e,_0x2093ad,util[_0x0527('0x8')]('START:%s',_0x577fc2));_0x24836b[_0x0527('0x17')][_0x4c095e]['on']('end',function(){logger['info'](_0x0527('0x18'),_0x4c095e);clearTimeout(_0x4d724a);_0x4d724a=undefined;_0x532cf9['close']();if(_0x24836b[_0x0527('0x17')][_0x4c095e]){delete _0x24836b[_0x0527('0x17')][_0x4c095e];}_0x210b8a[_0x0527('0x10')]();});_0x24836b['rules'][_0x4c095e]['on'](_0x0527('0x19'),function(){if(_0x24836b[_0x0527('0x17')][_0x4c095e]){delete _0x24836b[_0x0527('0x17')][_0x4c095e];}});_0x4d724a=setTimeout(function(){logger['info'](_0x0527('0x1a'),_0x4c095e);clearTimeout(_0x4d724a);_0x532cf9[_0x0527('0x1b')]();_0x210b8a[_0x0527('0x1c')]();},_0x577fc2);strategy[_0x0527('0x1d')](_0x532cf9,_0x2093ad,_0x24836b,_0xb9cef5);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4c095e,_0x2f1916[_0x0527('0xa')]);_0x210b8a[_0x0527('0x10')]();}}}catch(_0x12ae9f){console[_0x0527('0x1e')](_0x12ae9f);logger[_0x0527('0x1f')](_0x0527('0x20'),_0x4c095e,_0x12ae9f[_0x0527('0x21')]);_0x210b8a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 4b85803..1834068 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 _0x56aa=['then','error','stringify','info','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','providerName','amazonlex','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','chat','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x56aa,0x109));var _0xa56a=function(_0x231b09,_0x4342ab){_0x231b09=_0x231b09-0x0;var _0x407bb6=_0x56aa[_0x231b09];return _0x407bb6;};'use strict';var _=require(_0xa56a('0x0'));var moment=require(_0xa56a('0x1'));var AWS=require(_0xa56a('0x2'));var utils=require(_0xa56a('0x3'));var logger=require(_0xa56a('0x4'))(_0xa56a('0x5'));var rpc={'chatMessage':require(_0xa56a('0x6')),'openchannelMessage':require(_0xa56a('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa56a('0x8')),'faxMessage':require(_0xa56a('0x9')),'whatsappMessage':require(_0xa56a('0xa'))};exports[_0xa56a('0xb')]=function(_0x585b05,_0x17df4d){return function(_0x52363a){try{if(!_[_0xa56a('0xc')](this[_0xa56a('0xd')][_0xa56a('0xe')])){logger['info'](_0xa56a('0xf'),_0x585b05,_0xa56a('0x10'));return _0x52363a[_0xa56a('0x11')]();}var _0xb303d3={'ContactId':this[_0xa56a('0x12')]['id'],'sentAt':moment()[_0xa56a('0x13')](_0xa56a('0x14')),'direction':'out'};if(this['channel']===_0xa56a('0x15')||this['channel']===_0xa56a('0x16')){_0xb303d3[_0xa56a('0x17')]=this[_0xa56a('0xd')][_0xa56a('0x17')];}var _0x1e5202=this[_0xa56a('0x18')];if(_0x1e5202===_0xa56a('0x19')){_0xb303d3['ChatWebsiteId']=this['account']['id'];}else{_0xb303d3[_['upperFirst'](_0x1e5202)+_0xa56a('0x1a')]=this[_0xa56a('0x1b')]['id'];}_0xb303d3[_[_0xa56a('0x1c')](_0x1e5202)+_0xa56a('0x1d')]=this[_0xa56a('0xd')]['id'];if(this[_0xa56a('0xd')][_0xa56a('0x1e')]){var _0x170abd=_0x17df4d[0x4];if(!_[_0xa56a('0x1f')](_0x170abd)){_0xb303d3[_0xa56a('0x20')]=utils[_0xa56a('0x21')](_0x170abd,this);return rpc[_0x1e5202+_0xa56a('0x22')]['create'](_0xb303d3)[_0xa56a('0x23')](function(_0x45f87d){logger['info']('[%s][AMAZONLEX]\x20%s',_0x585b05,_0xb303d3[_0xa56a('0x20')]);})['catch'](function(_0x4789d0){logger[_0xa56a('0x24')](_0xa56a('0xf'),_0x585b05,JSON[_0xa56a('0x25')](_0x4789d0));})['finally'](function(){logger[_0xa56a('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x585b05);_0x52363a[_0xa56a('0x27')]();});}else{logger[_0xa56a('0x26')](_0xa56a('0x28'),_0x585b05);_0x52363a[_0xa56a('0x27')]();}}else{var _0x4c0392=this;var _0x40526f=new AWS['LexRuntime']({'accessKeyId':_0x17df4d[0x0],'secretAccessKey':_0x17df4d[0x1],'region':_0x17df4d[0x2]});var _0x3f74d8={'botAlias':_0xa56a('0x29'),'botName':_0x17df4d[0x3],'inputText':this[_0xa56a('0x2a')][_0xa56a('0x20')],'userId':this[_0xa56a('0x18')]+':'+this[_0xa56a('0xd')]['id'][_0xa56a('0x2b')]()};_0x40526f[_0xa56a('0x2c')](_0x3f74d8,function(_0x5b2d95,_0x2f187c){if(_0x5b2d95){logger[_0xa56a('0x24')](_0xa56a('0xf'),_0x585b05,_0x5b2d95[_0xa56a('0x2a')]);_0x52363a[_0xa56a('0x11')]();}else if(_0x2f187c&&_0x2f187c[_0xa56a('0x2a')]){_0x4c0392[_0xa56a('0x20')]['amazonlex']=_0x2f187c;_0xb303d3[_0xa56a('0x20')]=_0x2f187c[_0xa56a('0x2a')];_0xb303d3[_0xa56a('0x2d')]=_0xa56a('0x2e');_0xb303d3['providerResponse']=JSON[_0xa56a('0x25')](_0x2f187c);return rpc[_0x1e5202+_0xa56a('0x22')][_0xa56a('0x2f')](_0xb303d3)['then'](function(_0x1500e0){logger[_0xa56a('0x26')](_0xa56a('0xf'),_0x585b05,_0xb303d3[_0xa56a('0x20')]);if(_0x2f187c[_0xa56a('0x30')]==_0xa56a('0x31')){_0x52363a[_0xa56a('0x11')]();}else{_0x52363a['stop']();}})['catch'](function(_0x3f074d){logger[_0xa56a('0x24')](_0xa56a('0xf'),_0x585b05,JSON[_0xa56a('0x25')](_0x3f074d));_0x52363a[_0xa56a('0x11')]();});}else{_0x52363a[_0xa56a('0x11')]();}});}}catch(_0x5a223e){logger[_0xa56a('0x24')](_0xa56a('0xf'),_0x585b05,JSON[_0xa56a('0x25')](_0x5a223e));_0x52363a[_0xa56a('0x27')]();}};}; \ No newline at end of file +var _0x5dad=['account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerName','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','phone','chat','upperFirst','AccountId'];(function(_0x3613c8,_0x42cf9b){var _0x12ce85=function(_0x226c57){while(--_0x226c57){_0x3613c8['push'](_0x3613c8['shift']());}};_0x12ce85(++_0x42cf9b);}(_0x5dad,0x115));var _0xd5da=function(_0x2d676f,_0x25fe42){_0x2d676f=_0x2d676f-0x0;var _0x3e3273=_0x5dad[_0x2d676f];return _0x3e3273;};'use strict';var _=require(_0xd5da('0x0'));var moment=require(_0xd5da('0x1'));var AWS=require(_0xd5da('0x2'));var utils=require(_0xd5da('0x3'));var logger=require(_0xd5da('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd5da('0x5')),'mailMessage':require(_0xd5da('0x6')),'smsMessage':require(_0xd5da('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd5da('0x8'))};exports[_0xd5da('0x9')]=function(_0x21d02a,_0x57599d){return function(_0x1572a3){try{if(!_['isNil'](this[_0xd5da('0xa')][_0xd5da('0xb')])){logger['info'](_0xd5da('0xc'),_0x21d02a,_0xd5da('0xd'));return _0x1572a3['next']();}var _0x1dd374={'ContactId':this[_0xd5da('0xe')]['id'],'sentAt':moment()[_0xd5da('0xf')](_0xd5da('0x10')),'direction':'out'};if(this['channel']===_0xd5da('0x11')||this[_0xd5da('0x12')]==='whatsapp'){_0x1dd374[_0xd5da('0x13')]=this['interaction'][_0xd5da('0x13')];}var _0x5d1e86=this[_0xd5da('0x12')];if(_0x5d1e86===_0xd5da('0x14')){_0x1dd374['ChatWebsiteId']=this['account']['id'];}else{_0x1dd374[_[_0xd5da('0x15')](_0x5d1e86)+_0xd5da('0x16')]=this[_0xd5da('0x17')]['id'];}_0x1dd374[_[_0xd5da('0x15')](_0x5d1e86)+_0xd5da('0x18')]=this[_0xd5da('0xa')]['id'];if(this[_0xd5da('0xa')][_0xd5da('0x19')]){var _0x3842a9=_0x57599d[0x4];if(!_[_0xd5da('0x1a')](_0x3842a9)){_0x1dd374[_0xd5da('0x1b')]=utils[_0xd5da('0x1c')](_0x3842a9,this);return rpc[_0x5d1e86+_0xd5da('0x1d')][_0xd5da('0x1e')](_0x1dd374)[_0xd5da('0x1f')](function(_0x16ae00){logger[_0xd5da('0x20')](_0xd5da('0xc'),_0x21d02a,_0x1dd374[_0xd5da('0x1b')]);})[_0xd5da('0x21')](function(_0x26101b){logger[_0xd5da('0x22')](_0xd5da('0xc'),_0x21d02a,JSON['stringify'](_0x26101b));})[_0xd5da('0x23')](function(){logger['info'](_0xd5da('0x24'),_0x21d02a);_0x1572a3[_0xd5da('0x25')]();});}else{logger[_0xd5da('0x20')](_0xd5da('0x26'),_0x21d02a);_0x1572a3[_0xd5da('0x25')]();}}else{var _0x506199=this;var _0x10d222=new AWS[(_0xd5da('0x27'))]({'accessKeyId':_0x57599d[0x0],'secretAccessKey':_0x57599d[0x1],'region':_0x57599d[0x2]});var _0x1f6cdb={'botAlias':_0xd5da('0x28'),'botName':_0x57599d[0x3],'inputText':this[_0xd5da('0x29')]['body'],'userId':this[_0xd5da('0x12')]+':'+this[_0xd5da('0xa')]['id'][_0xd5da('0x2a')]()};_0x10d222[_0xd5da('0x2b')](_0x1f6cdb,function(_0x1c7904,_0x125e5a){if(_0x1c7904){logger[_0xd5da('0x22')](_0xd5da('0xc'),_0x21d02a,_0x1c7904['message']);_0x1572a3[_0xd5da('0x2c')]();}else if(_0x125e5a&&_0x125e5a[_0xd5da('0x29')]){_0x506199[_0xd5da('0x1b')][_0xd5da('0x2d')]=_0x125e5a;_0x1dd374['body']=_0x125e5a['message'];_0x1dd374[_0xd5da('0x2e')]='amazonlex';_0x1dd374['providerResponse']=JSON[_0xd5da('0x2f')](_0x125e5a);return rpc[_0x5d1e86+'Message'][_0xd5da('0x1e')](_0x1dd374)[_0xd5da('0x1f')](function(_0x463069){logger['info'](_0xd5da('0xc'),_0x21d02a,_0x1dd374['body']);if(_0x125e5a[_0xd5da('0x30')]==_0xd5da('0x31')){_0x1572a3[_0xd5da('0x2c')]();}else{_0x1572a3[_0xd5da('0x25')]();}})[_0xd5da('0x21')](function(_0x8d6354){logger[_0xd5da('0x22')](_0xd5da('0xc'),_0x21d02a,JSON[_0xd5da('0x2f')](_0x8d6354));_0x1572a3[_0xd5da('0x2c')]();});}else{_0x1572a3['next']();}});}}catch(_0x634f43){logger[_0xd5da('0x22')](_0xd5da('0xc'),_0x21d02a,JSON[_0xd5da('0x2f')](_0x634f43));_0x1572a3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 0908795..10daeb4 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 _0x8883=['stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','finally','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','mail','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','Message','inReplyTo','messageId','html','','replace','';_0x27d3ee['headers']={'Auto-Submitted':_0x3888('0x32'),'X-Auto-Response-Suppress':_0x3888('0x33'),'Precedence':_0x3888('0x34')};return mailRpc[_0x3888('0x35')](this['account'][_0x3888('0x36')],_0x27d3ee)[_0x3888('0x37')](function(_0x11d221){logger['info'](_0x3888('0x38'),_0x1ccede);_0x27d3ee['messageId']=_0x11d221['message'][_0x3888('0x2c')];return rpc[_0x429205+_0x3888('0x2a')][_0x3888('0x39')](_0x27d3ee);})[_0x3888('0x37')](function(_0x2c996a){logger['info'](_0x3888('0x12'),_0x1ccede,JSON[_0x3888('0x3a')](_0x2c996a));})['catch'](function(_0x3d7ccd){logger['error'](_0x3888('0x3b'),_0x1ccede,JSON['stringify'](_0x3d7ccd));})['finally'](function(){Promise[_0x3888('0x3c')]()[_0x3888('0x37')](function(){if(_0x52f312[0x0]!=='2'||_0x58d69f[_0x3888('0x17')])return;return rpc[_0x429205+_0x3888('0x3d')][_0x3888('0x3e')](_0x58d69f['id'],{'autoreplyExecuted':!![]})[_0x3888('0x37')](function(_0x266ccc){logger[_0x3888('0x11')](_0x3888('0x18'),_0x1ccede,JSON[_0x3888('0x3a')](_0x266ccc));})[_0x3888('0x3f')](function(_0x4b710b){logger['error'](_0x3888('0x40'),_0x1ccede,JSON[_0x3888('0x3a')](_0x4b710b));});})[_0x3888('0x37')](function(){_0x540d2d[_0x3888('0x13')]();});});}else{return rpc[this[_0x3888('0xf')]+_0x3888('0x2a')][_0x3888('0x39')](_0x27d3ee)[_0x3888('0x37')](function(){logger[_0x3888('0x11')](_0x3888('0x12'),_0x1ccede,_0x27d3ee[_0x3888('0x10')]);})[_0x3888('0x3f')](function(_0x58a9c2){logger[_0x3888('0x41')](_0x3888('0x12'),_0x1ccede,JSON['stringify'](_0x58a9c2));})[_0x3888('0x42')](function(){Promise[_0x3888('0x3c')]()[_0x3888('0x37')](function(){if(_0x52f312[0x0]!=='2'||_0x58d69f[_0x3888('0x17')])return;return rpc[_0x429205+_0x3888('0x3d')][_0x3888('0x3e')](_0x58d69f['id'],{'autoreplyExecuted':!![]})[_0x3888('0x37')](function(_0x384738){logger['info'](_0x3888('0x18'),_0x1ccede,JSON[_0x3888('0x3a')](_0x384738));})[_0x3888('0x3f')](function(_0x455086){logger['error'](_0x3888('0x40'),_0x1ccede,JSON['stringify'](_0x455086));});})[_0x3888('0x37')](function(){_0x540d2d[_0x3888('0x13')]();});});}}}catch(_0x4a3a04){logger[_0x3888('0x41')](_0x3888('0x12'),_0x1ccede,JSON['stringify'](_0x4a3a04));_0x540d2d[_0x3888('0x43')]();}};}; \ No newline at end of file +var _0x812c=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','messageId','Message','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','contact','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat'];(function(_0x5569b7,_0x5c562c){var _0x250135=function(_0x23ad4c){while(--_0x23ad4c){_0x5569b7['push'](_0x5569b7['shift']());}};_0x250135(++_0x5c562c);}(_0x812c,0xef));var _0xc812=function(_0x5775c4,_0x11631c){_0x5775c4=_0x5775c4-0x0;var _0xa2e3a1=_0x812c[_0x5775c4];return _0xa2e3a1;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require('./utils');var logger=require(_0xc812('0x0'))(_0xc812('0x1'));var rpc={'chatMessage':require(_0xc812('0x2')),'openchannelMessage':require(_0xc812('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc812('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc812('0x5')),'chatInteraction':require(_0xc812('0x6')),'openchannelInteraction':require(_0xc812('0x7')),'mailInteraction':require(_0xc812('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xc812('0x9')),'whatsappInteraction':require(_0xc812('0xa'))};var mailRpc=require(_0xc812('0xb'));exports[_0xc812('0xc')]=function(_0x623d0,_0x42f5f8,_0x37e752,_0x280ef0){return function(_0x5e9b3c){try{var _0x45824e=this[_0xc812('0xd')];if(_0x45824e===_0xc812('0xe')&&_0x280ef0[_0xc812('0xf')][_0xc812('0x10')]){logger['info'](_0xc812('0x11'),_0x623d0,_0xc812('0x12'));return _0x5e9b3c[_0xc812('0x13')]();}if(_0x42f5f8[0x0]==='1'&&(_[_0xc812('0x14')](this[_0xc812('0x15')]['created'])||!this[_0xc812('0x15')]['created'])){logger[_0xc812('0x16')](_0xc812('0x11'),_0x623d0,_0xc812('0x17'));return _0x5e9b3c[_0xc812('0x13')]();}if(_0x42f5f8[0x0]==='2'&&this['interaction'][_0xc812('0x18')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x623d0,'One\x20Time\x20already\x20sent');return _0x5e9b3c[_0xc812('0x13')]();}var _0x3875bf={'ContactId':this[_0xc812('0x19')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc812('0x1a')};if(this[_0xc812('0xd')]==='mail'){_0x3875bf[_0xc812('0xf')]=utils[_0xc812('0x1b')](_0x42f5f8[0x2],this);}else{_0x3875bf[_0xc812('0xf')]=utils[_0xc812('0x1b')](_0x42f5f8[0x1],this);}if(this[_0xc812('0x1c')]){_0x3875bf['to']=this[_0xc812('0x1c')][_0xc812('0x1d')]||'';if(this[_0xc812('0xd')]===_0xc812('0xe')&&_0x42f5f8[0x1]==='1'){_0x3875bf['cc']=this[_0xc812('0x1c')]['cc']||'';}_0x3875bf[_0xc812('0x1d')]=this['message']['to']||'';_0x3875bf['phone']=this[_0xc812('0x1c')][_0xc812('0x1e')]||'';_0x3875bf[_0xc812('0x1f')]=!![];if(this[_0xc812('0x1c')][_0xc812('0x20')]){_0x3875bf[_0xc812('0x20')]='';_0x3875bf[_0xc812('0x20')]+=_[_0xc812('0x21')](this['message'][_0xc812('0x20')],_0xc812('0x22'))?'':_0xc812('0x23');_0x3875bf[_0xc812('0x20')]+=this[_0xc812('0x1c')][_0xc812('0x20')];}}if(this[_0xc812('0xd')]===_0xc812('0x24')){_0x3875bf[_0xc812('0x25')]=this[_0xc812('0x26')]['id'];}else{_0x3875bf[_[_0xc812('0x27')](this['channel'])+_0xc812('0x28')]=this['account']['id'];}_0x3875bf[_[_0xc812('0x27')](this[_0xc812('0xd')])+_0xc812('0x29')]=this['interaction']['id'];var _0x44d3fc=this[_0xc812('0x15')];if(rpc[this[_0xc812('0xd')]+'Message']){if(this[_0xc812('0xd')]===_0xc812('0xe')){_0x3875bf[_0xc812('0x2a')]=this[_0xc812('0x1c')]['messageId'];_0x3875bf[_0xc812('0x2b')]=_0xc812('0x2c')+_[_0xc812('0x2d')](_0x3875bf['body'],_0xc812('0x2e'),_0xc812('0x2f'))+_0xc812('0x30');_0x3875bf['headers']={'Auto-Submitted':_0xc812('0x31'),'X-Auto-Response-Suppress':_0xc812('0x32'),'Precedence':_0xc812('0x33')};return mailRpc[_0xc812('0x34')](this[_0xc812('0x26')][_0xc812('0x35')],_0x3875bf)['then'](function(_0x415836){logger[_0xc812('0x16')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x623d0);_0x3875bf[_0xc812('0x36')]=_0x415836[_0xc812('0x1c')]['messageId'];return rpc[_0x45824e+_0xc812('0x37')][_0xc812('0x38')](_0x3875bf);})[_0xc812('0x39')](function(_0x5badc2){logger['info']('[%s][AUTOREPLY]\x20%s',_0x623d0,JSON[_0xc812('0x3a')](_0x5badc2));})[_0xc812('0x3b')](function(_0x10eab8){logger[_0xc812('0x3c')](_0xc812('0x3d'),_0x623d0,JSON['stringify'](_0x10eab8));})[_0xc812('0x3e')](function(){Promise[_0xc812('0x3f')]()[_0xc812('0x39')](function(){if(_0x42f5f8[0x0]!=='2'||_0x44d3fc[_0xc812('0x18')])return;return rpc[_0x45824e+_0xc812('0x40')][_0xc812('0x41')](_0x44d3fc['id'],{'autoreplyExecuted':!![]})[_0xc812('0x39')](function(_0x4769a8){logger[_0xc812('0x16')](_0xc812('0x42'),_0x623d0,JSON['stringify'](_0x4769a8));})['catch'](function(_0x645f65){logger['error'](_0xc812('0x43'),_0x623d0,JSON[_0xc812('0x3a')](_0x645f65));});})[_0xc812('0x39')](function(){_0x5e9b3c[_0xc812('0x13')]();});});}else{return rpc[this['channel']+'Message']['create'](_0x3875bf)[_0xc812('0x39')](function(){logger[_0xc812('0x16')](_0xc812('0x11'),_0x623d0,_0x3875bf[_0xc812('0xf')]);})[_0xc812('0x3b')](function(_0x14d583){logger[_0xc812('0x3c')](_0xc812('0x11'),_0x623d0,JSON['stringify'](_0x14d583));})[_0xc812('0x3e')](function(){Promise[_0xc812('0x3f')]()['then'](function(){if(_0x42f5f8[0x0]!=='2'||_0x44d3fc[_0xc812('0x18')])return;return rpc[_0x45824e+_0xc812('0x40')]['update'](_0x44d3fc['id'],{'autoreplyExecuted':!![]})[_0xc812('0x39')](function(_0x30a3ff){logger[_0xc812('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x623d0,JSON[_0xc812('0x3a')](_0x30a3ff));})['catch'](function(_0xc010b8){logger[_0xc812('0x3c')](_0xc812('0x43'),_0x623d0,JSON[_0xc812('0x3a')](_0xc010b8));});})[_0xc812('0x39')](function(){_0x5e9b3c[_0xc812('0x13')]();});});}}}catch(_0x538ce9){logger[_0xc812('0x3c')](_0xc812('0x11'),_0x623d0,JSON[_0xc812('0x3a')](_0x538ce9));_0x5e9b3c[_0xc812('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 1477dec..afc141c 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcb5=['interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','stop','error','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','update'];(function(_0x35e882,_0x2aef74){var _0x1e8696=function(_0x4e58ab){while(--_0x4e58ab){_0x35e882['push'](_0x35e882['shift']());}};_0x1e8696(++_0x2aef74);}(_0xfcb5,0x1cb));var _0x5fcb=function(_0x1f3727,_0x3a7b){_0x1f3727=_0x1f3727-0x0;var _0x4b670f=_0xfcb5[_0x1f3727];return _0x4b670f;};'use strict';var moment=require(_0x5fcb('0x0'));var logger=require(_0x5fcb('0x1'))(_0x5fcb('0x2'));var rpc={'chatInteraction':require(_0x5fcb('0x3')),'openchannelInteraction':require(_0x5fcb('0x4')),'smsInteraction':require(_0x5fcb('0x5')),'mailInteraction':require(_0x5fcb('0x6')),'faxInteraction':require(_0x5fcb('0x7')),'whatsappInteraction':require(_0x5fcb('0x8'))};exports[_0x5fcb('0x9')]=function(_0x128c44,_0x556bdc,_0x16176c,_0x325a23){return function(_0x2f6fda){try{logger[_0x5fcb('0xa')](_0x5fcb('0xb'),_0x128c44,_0x556bdc[0x0]);var _0x48fb4a={'closed':0x1,'closedAt':moment()['format'](_0x5fcb('0xc')),'closeReason':'system','disposition':_0x556bdc[0x0]};if(rpc[_0x325a23['channel']+_0x5fcb('0xd')]){rpc[_0x325a23[_0x5fcb('0xe')]+_0x5fcb('0xd')][_0x5fcb('0xf')](_0x325a23[_0x5fcb('0x10')]['id'],_0x48fb4a)[_0x5fcb('0x11')](function(_0x1dab92){logger['info'](_0x5fcb('0x12'),_0x128c44,_0x325a23['interaction']['id']);})[_0x5fcb('0x13')](function(_0x282e8e){logger['error'](_0x5fcb('0x14'),_0x128c44,JSON['stringify'](_0x282e8e));})[_0x5fcb('0x15')](function(){_0x2f6fda[_0x5fcb('0x16')]();});}}catch(_0x430e12){logger[_0x5fcb('0x17')]('[%s][CLOSE]\x20%s',_0x128c44,JSON[_0x5fcb('0x18')](_0x430e12));_0x2f6fda[_0x5fcb('0x16')]();}};}; \ No newline at end of file +var _0xfa2f=['channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x4444b3,_0x26a714){var _0x800ed3=function(_0x23ae62){while(--_0x23ae62){_0x4444b3['push'](_0x4444b3['shift']());}};_0x800ed3(++_0x26a714);}(_0xfa2f,0xee));var _0xffa2=function(_0x3c442f,_0x5e3fda){_0x3c442f=_0x3c442f-0x0;var _0x54b8d9=_0xfa2f[_0x3c442f];return _0x54b8d9;};'use strict';var moment=require('moment');var logger=require(_0xffa2('0x0'))('routing');var rpc={'chatInteraction':require(_0xffa2('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xffa2('0x2')),'mailInteraction':require(_0xffa2('0x3')),'faxInteraction':require(_0xffa2('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xffa2('0x5')]=function(_0x321ac4,_0x491de7,_0x4ece41,_0x3b7a77){return function(_0x1639c4){try{logger[_0xffa2('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x321ac4,_0x491de7[0x0]);var _0x344acb={'closed':0x1,'closedAt':moment()['format'](_0xffa2('0x7')),'closeReason':_0xffa2('0x8'),'disposition':_0x491de7[0x0]};if(rpc[_0x3b7a77[_0xffa2('0x9')]+_0xffa2('0xa')]){rpc[_0x3b7a77[_0xffa2('0x9')]+_0xffa2('0xa')]['update'](_0x3b7a77[_0xffa2('0xb')]['id'],_0x344acb)[_0xffa2('0xc')](function(_0x425c6a){logger[_0xffa2('0x6')](_0xffa2('0xd'),_0x321ac4,_0x3b7a77[_0xffa2('0xb')]['id']);})[_0xffa2('0xe')](function(_0x4f48aa){logger['error'](_0xffa2('0xf'),_0x321ac4,JSON[_0xffa2('0x10')](_0x4f48aa));})[_0xffa2('0x11')](function(){_0x1639c4[_0xffa2('0x12')]();});}}catch(_0x435e49){logger['error'](_0xffa2('0xf'),_0x321ac4,JSON['stringify'](_0x435e49));_0x1639c4[_0xffa2('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index fc0fa2c..24d9d8f 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd05=['isEmpty','body','getMustacheRender','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then','dialogflow','result','providerName','providerResponse','create','endConversation','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account','upperFirst','InteractionId'];(function(_0x3b9aa6,_0x3f0c03){var _0x12a0a9=function(_0x4d288c){while(--_0x4d288c){_0x3b9aa6['push'](_0x3b9aa6['shift']());}};_0x12a0a9(++_0x3f0c03);}(_0xcd05,0x163));var _0x5cd0=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0xcd05[_0x3ff685];return _0x2046c9;};'use strict';var _=require(_0x5cd0('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x5cd0('0x1'));var logger=require(_0x5cd0('0x2'))(_0x5cd0('0x3'));var rpc={'chatMessage':require(_0x5cd0('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5cd0('0x5')),'smsMessage':require(_0x5cd0('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x10fd06,_0x3cfb51){return function(_0x3f609e){try{if(!_[_0x5cd0('0x7')](this[_0x5cd0('0x8')][_0x5cd0('0x9')])){logger[_0x5cd0('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x10fd06,_0x5cd0('0xb'));return _0x3f609e[_0x5cd0('0xc')]();}var _0x22f769={'ContactId':this[_0x5cd0('0xd')]['id'],'sentAt':moment()['format'](_0x5cd0('0xe')),'direction':_0x5cd0('0xf')};if(this[_0x5cd0('0x10')]===_0x5cd0('0x11')||this[_0x5cd0('0x10')]===_0x5cd0('0x12')){_0x22f769[_0x5cd0('0x13')]=this[_0x5cd0('0x8')][_0x5cd0('0x13')];}var _0x36bb9c=this['channel'];if(_0x36bb9c==='chat'){_0x22f769['ChatWebsiteId']=this[_0x5cd0('0x14')]['id'];}else{_0x22f769[_[_0x5cd0('0x15')](_0x36bb9c)+'AccountId']=this[_0x5cd0('0x14')]['id'];}_0x22f769[_['upperFirst'](_0x36bb9c)+_0x5cd0('0x16')]=this[_0x5cd0('0x8')]['id'];if(this[_0x5cd0('0x8')]['created']){var _0x50aa7f=_0x3cfb51[0x2];if(!_[_0x5cd0('0x17')](_0x50aa7f)){_0x22f769[_0x5cd0('0x18')]=utils[_0x5cd0('0x19')](_0x50aa7f,this);return rpc[_0x36bb9c+'Message']['create'](_0x22f769)['then'](function(_0x1847dd){logger[_0x5cd0('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x10fd06,_0x22f769[_0x5cd0('0x18')]);})[_0x5cd0('0x1a')](function(_0x2b906d){logger[_0x5cd0('0x1b')](_0x5cd0('0x1c'),_0x10fd06,JSON[_0x5cd0('0x1d')](_0x2b906d));})[_0x5cd0('0x1e')](function(){logger[_0x5cd0('0xa')](_0x5cd0('0x1f'),_0x10fd06);_0x3f609e[_0x5cd0('0x20')]();});}else{logger[_0x5cd0('0xa')](_0x5cd0('0x21'),_0x10fd06);_0x3f609e[_0x5cd0('0x20')]();}}else{var _0x1fe052=this;var _0x5c2bd9=apiai(_0x3cfb51[0x0],{'language':_0x3cfb51[0x1]||'en'});return _0x5c2bd9['textRequest'](this[_0x5cd0('0x22')]['body'],{'sessionId':md5(this[_0x5cd0('0x8')]['id'])})[_0x5cd0('0x23')](function(_0x1e8960){_0x1fe052[_0x5cd0('0x18')][_0x5cd0('0x24')]=_0x1e8960;_0x22f769[_0x5cd0('0x18')]=_0x1e8960[_0x5cd0('0x25')]['fulfillment']['speech'];_0x22f769[_0x5cd0('0x26')]=_0x5cd0('0x24');_0x22f769[_0x5cd0('0x27')]=JSON[_0x5cd0('0x1d')](_0x1e8960);return rpc[_0x36bb9c+'Message'][_0x5cd0('0x28')](_0x22f769)[_0x5cd0('0x23')](function(_0x364d53){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x10fd06,_0x22f769[_0x5cd0('0x18')]);if(_0x1e8960[_0x5cd0('0x25')]['metadata'][_0x5cd0('0x29')]){_0x3f609e[_0x5cd0('0xc')]();}else{_0x3f609e[_0x5cd0('0x20')]();}})[_0x5cd0('0x1a')](function(_0x3c80d1){logger[_0x5cd0('0x1b')](_0x5cd0('0x1c'),_0x10fd06,JSON['stringify'](_0x3c80d1));_0x3f609e[_0x5cd0('0xc')]();});})[_0x5cd0('0x1a')](function(_0x1b88ac){logger[_0x5cd0('0x1b')](_0x5cd0('0x1c'),_0x10fd06,_0x1b88ac[_0x5cd0('0x22')]);_0x3f609e[_0x5cd0('0xc')]();});}}catch(_0x2ed6c5){logger[_0x5cd0('0x1b')](_0x5cd0('0x1c'),_0x10fd06,JSON['stringify'](_0x2ed6c5));_0x3f609e[_0x5cd0('0x20')]();}};}; \ No newline at end of file +var _0x0309=['isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','stop','textRequest','dialogflow','result','fulfillment','speech','providerName','metadata','endConversation','message','lodash','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x4dd8ef,_0x8758c9){var _0x2d1bfc=function(_0x5c04e0){while(--_0x5c04e0){_0x4dd8ef['push'](_0x4dd8ef['shift']());}};_0x2d1bfc(++_0x8758c9);}(_0x0309,0x165));var _0x9030=function(_0x46189a,_0x31349b){_0x46189a=_0x46189a-0x0;var _0x57ef1f=_0x0309[_0x46189a];return _0x57ef1f;};'use strict';var _=require(_0x9030('0x0'));var moment=require('moment');var apiai=require(_0x9030('0x1'));var md5=require('md5');var utils=require(_0x9030('0x2'));var logger=require(_0x9030('0x3'))(_0x9030('0x4'));var rpc={'chatMessage':require(_0x9030('0x5')),'openchannelMessage':require(_0x9030('0x6')),'mailMessage':require(_0x9030('0x7')),'smsMessage':require(_0x9030('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9030('0x9')]=function(_0x105c15,_0x4f2d84){return function(_0xb53eb4){try{if(!_['isNil'](this[_0x9030('0xa')][_0x9030('0xb')])){logger[_0x9030('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x105c15,_0x9030('0xd'));return _0xb53eb4[_0x9030('0xe')]();}var _0x337b86={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9030('0xf')](_0x9030('0x10')),'direction':_0x9030('0x11')};if(this[_0x9030('0x12')]===_0x9030('0x13')||this[_0x9030('0x12')]===_0x9030('0x14')){_0x337b86['phone']=this[_0x9030('0xa')][_0x9030('0x15')];}var _0x1e5bc9=this[_0x9030('0x12')];if(_0x1e5bc9==='chat'){_0x337b86[_0x9030('0x16')]=this[_0x9030('0x17')]['id'];}else{_0x337b86[_[_0x9030('0x18')](_0x1e5bc9)+_0x9030('0x19')]=this[_0x9030('0x17')]['id'];}_0x337b86[_[_0x9030('0x18')](_0x1e5bc9)+_0x9030('0x1a')]=this[_0x9030('0xa')]['id'];if(this[_0x9030('0xa')]['created']){var _0x213040=_0x4f2d84[0x2];if(!_[_0x9030('0x1b')](_0x213040)){_0x337b86[_0x9030('0x1c')]=utils[_0x9030('0x1d')](_0x213040,this);return rpc[_0x1e5bc9+_0x9030('0x1e')][_0x9030('0x1f')](_0x337b86)[_0x9030('0x20')](function(_0x28c035){logger[_0x9030('0xc')](_0x9030('0x21'),_0x105c15,_0x337b86[_0x9030('0x1c')]);})[_0x9030('0x22')](function(_0x372716){logger[_0x9030('0x23')](_0x9030('0x21'),_0x105c15,JSON[_0x9030('0x24')](_0x372716));})[_0x9030('0x25')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x105c15);_0xb53eb4[_0x9030('0x26')]();});}else{logger[_0x9030('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x105c15);_0xb53eb4[_0x9030('0x26')]();}}else{var _0x2d28fd=this;var _0x1f806a=apiai(_0x4f2d84[0x0],{'language':_0x4f2d84[0x1]||'en'});return _0x1f806a[_0x9030('0x27')](this['message'][_0x9030('0x1c')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0xe65792){_0x2d28fd[_0x9030('0x1c')][_0x9030('0x28')]=_0xe65792;_0x337b86['body']=_0xe65792[_0x9030('0x29')][_0x9030('0x2a')][_0x9030('0x2b')];_0x337b86[_0x9030('0x2c')]=_0x9030('0x28');_0x337b86['providerResponse']=JSON[_0x9030('0x24')](_0xe65792);return rpc[_0x1e5bc9+_0x9030('0x1e')][_0x9030('0x1f')](_0x337b86)[_0x9030('0x20')](function(_0x42d1ba){logger[_0x9030('0xc')](_0x9030('0x21'),_0x105c15,_0x337b86[_0x9030('0x1c')]);if(_0xe65792[_0x9030('0x29')][_0x9030('0x2d')][_0x9030('0x2e')]){_0xb53eb4[_0x9030('0xe')]();}else{_0xb53eb4[_0x9030('0x26')]();}})[_0x9030('0x22')](function(_0x584013){logger[_0x9030('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x105c15,JSON[_0x9030('0x24')](_0x584013));_0xb53eb4['next']();});})[_0x9030('0x22')](function(_0x37bee3){logger[_0x9030('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x105c15,_0x37bee3[_0x9030('0x2f')]);_0xb53eb4[_0x9030('0xe')]();});}}catch(_0x3b70ff){logger[_0x9030('0x23')](_0x9030('0x21'),_0x105c15,JSON[_0x9030('0x24')](_0x3b70ff));_0xb53eb4[_0x9030('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index ea18091..986ffd9 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe86d=['create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','next','stack','lodash','dialogflow','md5','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','Message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe86d,0x1dd));var _0xde86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe86d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde86('0x0'));var dialogflow=require(_0xde86('0x1'));var md5=require(_0xde86('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xde86('0x3'))('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xde86('0x4')),'mailMessage':require(_0xde86('0x5')),'smsMessage':require(_0xde86('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x445cf0,_0x461a3b,_0x42cd6b,_0x441bf9){return new Promise(function(_0x1fc033,_0x5c2ab6){var _0x346a22=_[_0xde86('0x7')](_0x42cd6b);_0x346a22[_0xde86('0x8')]=_0x441bf9;return rpc[_0x461a3b+'Message']['create'](_0x346a22)[_0xde86('0x9')](function(){logger[_0xde86('0xa')](_0xde86('0xb'),_0x445cf0,_0x346a22[_0xde86('0x8')]);_0x1fc033();})[_0xde86('0xc')](function(_0x56c261){logger[_0xde86('0xd')](_0xde86('0xb'),_0x445cf0,JSON[_0xde86('0xe')](_0x56c261));_0x5c2ab6(_0x56c261);});});}exports[_0xde86('0xf')]=function(_0x479a18,_0x2db889){return function(_0x770e2f){try{if(!_[_0xde86('0x10')](this[_0xde86('0x11')][_0xde86('0x12')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x479a18,_0xde86('0x13'));return _0x770e2f['next']();}var _0x33c651={'ContactId':this[_0xde86('0x14')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xde86('0x15')};if(this[_0xde86('0x16')]==='sms'||this['channel']==='whatsapp'){_0x33c651[_0xde86('0x17')]=this[_0xde86('0x11')][_0xde86('0x17')];}var _0x5181df=this[_0xde86('0x16')];if(_0x5181df===_0xde86('0x18')){_0x33c651[_0xde86('0x19')]=this['account']['id'];}else{_0x33c651[_[_0xde86('0x1a')](_0x5181df)+_0xde86('0x1b')]=this[_0xde86('0x1c')]['id'];}_0x33c651[_[_0xde86('0x1a')](_0x5181df)+_0xde86('0x1d')]=this[_0xde86('0x11')]['id'];if(this['interaction'][_0xde86('0x1e')]){var _0x4d23f2=_0x2db889[0x4];if(!_[_0xde86('0x1f')](_0x4d23f2)){_0x33c651['body']=utils[_0xde86('0x20')](_0x4d23f2,this);return rpc[_0x5181df+_0xde86('0x21')][_0xde86('0x22')](_0x33c651)['then'](function(_0x296431){logger[_0xde86('0xa')](_0xde86('0xb'),_0x479a18,_0x33c651[_0xde86('0x8')]);})[_0xde86('0xc')](function(_0x4e5139){logger[_0xde86('0xd')](_0xde86('0xb'),_0x479a18,JSON['stringify'](_0x4e5139));})[_0xde86('0x23')](function(){logger['info'](_0xde86('0x24'),_0x479a18);_0x770e2f[_0xde86('0x25')]();});}else{logger[_0xde86('0xa')](_0xde86('0x26'),_0x479a18);_0x770e2f[_0xde86('0x25')]();}}else{var _0x4d259b=this;var _0x4ee78c=_0x2db889[0x2]['replace'](/\\n/g,'\x0a');var _0x468751={'credentials':{'private_key':_0x4ee78c,'client_email':_0x2db889[0x1]}};var _0x1a3fc4=new dialogflow[(_0xde86('0x27'))](_0x468751);var _0x435775=_0x1a3fc4[_0xde86('0x28')](_0x2db889[0x0],md5(_0x4d259b[_0xde86('0x11')]['id']));var _0x24c7ea={'session':_0x435775,'queryInput':{'text':{'text':_0x4d259b[_0xde86('0x29')][_0xde86('0x8')],'languageCode':_0x2db889[0x3]||'en'}}};return _0x1a3fc4[_0xde86('0x2a')](_0x24c7ea)['then'](function(_0x2c5e35){if(_0x2c5e35&&_0x2c5e35[_0xde86('0x2b')]){_0x4d259b['body'][_0xde86('0x2c')]=_0x2c5e35;var _0x5d9f65=_0x2c5e35[0x0];var _0x359d92=_0x5d9f65[_0xde86('0x2d')][_0xde86('0x2e')]&&_0x5d9f65[_0xde86('0x2d')][_0xde86('0x2e')][_0xde86('0x2f')]?_0x5d9f65['queryResult'][_0xde86('0x2e')][_0xde86('0x2f')][_0xde86('0x30')][_0xde86('0x31')]:![];_0x4d259b['body'][_0xde86('0x32')]=_0x5d9f65[_0xde86('0x2d')][_0xde86('0x33')];_0x4d259b[_0xde86('0x8')][_0xde86('0x34')]=_0x5d9f65[_0xde86('0x2d')][_0xde86('0x35')];_0x4d259b['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x5d9f65[_0xde86('0x2d')]['diagnosticInfo']&&_0x5d9f65[_0xde86('0x2d')][_0xde86('0x2e')][_0xde86('0x2f')]?_0x5d9f65['queryResult']['diagnosticInfo']['fields'][_0xde86('0x30')][_0xde86('0x31')]:![];_0x4d259b[_0xde86('0x8')][_0xde86('0x36')]=_0x5d9f65[_0xde86('0x2d')][_0xde86('0x37')][_0xde86('0x38')];_0x4d259b[_0xde86('0x8')][_0xde86('0x39')]=_0x5d9f65[_0xde86('0x2d')][_0xde86('0x37')][_0xde86('0x3a')];_0x4d259b[_0xde86('0x8')][_0xde86('0x3b')]=_0x5d9f65[_0xde86('0x2d')]['intent'][_0xde86('0x3c')];_0x4d259b[_0xde86('0x8')][_0xde86('0x3d')]=_0x5d9f65[_0xde86('0x2d')][_0xde86('0x3e')];_0x4d259b[_0xde86('0x8')][_0xde86('0x3f')]=_0x5d9f65['queryResult'][_0xde86('0x40')];_0x4d259b[_0xde86('0x8')]['DIALOGFLOWV2_SCORE']=_0x5d9f65['queryResult'][_0xde86('0x41')];_0x33c651[_0xde86('0x42')]=_0xde86('0x2c');_0x33c651[_0xde86('0x43')]=JSON[_0xde86('0xe')](_0x2c5e35);var _0x4f0e84=[];for(var _0x478331=0x0;_0x478331<_0x2c5e35[_0xde86('0x2b')];_0x478331++){var _0x13c32e=_0x2c5e35[_0x478331];if(_0x13c32e&&_0x13c32e[_0xde86('0x2d')]&&_0x13c32e['queryResult']['fulfillmentText']){_0x4f0e84[_0xde86('0x44')](createMessage(_0x479a18,_0x5181df,_0x33c651,_0x13c32e[_0xde86('0x2d')][_0xde86('0x45')]));}}return Promise[_0xde86('0x46')](_0x4f0e84)[_0xde86('0x9')](function(){if(_0x359d92){_0x770e2f[_0xde86('0x47')]();}else{_0x770e2f[_0xde86('0x25')]();}})['catch'](function(_0x47cef6){logger[_0xde86('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x479a18,JSON[_0xde86('0xe')](_0x47cef6));_0x770e2f[_0xde86('0x47')]();});}})[_0xde86('0xc')](function(_0x578e79){logger[_0xde86('0xd')](_0xde86('0xb'),_0x479a18,_0x578e79[_0xde86('0x29')],_0x578e79[_0xde86('0x48')]);_0x770e2f[_0xde86('0x47')]();});}}catch(_0x3a9263){logger['error'](_0xde86('0xb'),_0x479a18,JSON[_0xde86('0xe')](_0x3a9263));_0x770e2f[_0xde86('0x25')]();}};}; \ No newline at end of file +var _0xa0c7=['moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','contact','format','out','channel','phone','chat','account','upperFirst','AccountId','InteractionId','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','boolValue','DIALOGFLOWV2_INTENTNAME','name','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','next','stack','lodash','dialogflow'];(function(_0x5e89d8,_0x30a21a){var _0x5c1153=function(_0x2dcba0){while(--_0x2dcba0){_0x5e89d8['push'](_0x5e89d8['shift']());}};_0x5c1153(++_0x30a21a);}(_0xa0c7,0x143));var _0x7a0c=function(_0x283c39,_0x4a10a1){_0x283c39=_0x283c39-0x0;var _0x4d8055=_0xa0c7[_0x283c39];return _0x4d8055;};'use strict';var _=require(_0x7a0c('0x0'));var dialogflow=require(_0x7a0c('0x1'));var md5=require('md5');var moment=require(_0x7a0c('0x2'));var Promise=require(_0x7a0c('0x3'));var logger=require('../../../../config/logger')(_0x7a0c('0x4'));var utils=require(_0x7a0c('0x5'));var rpc={'chatMessage':require(_0x7a0c('0x6')),'openchannelMessage':require(_0x7a0c('0x7')),'mailMessage':require(_0x7a0c('0x8')),'smsMessage':require(_0x7a0c('0x9')),'faxMessage':require(_0x7a0c('0xa')),'whatsappMessage':require(_0x7a0c('0xb'))};function createMessage(_0x2c21f0,_0x55c897,_0x17839b,_0x4664fe){return new Promise(function(_0x32a780,_0x1a078d){var _0x21ba13=_[_0x7a0c('0xc')](_0x17839b);_0x21ba13[_0x7a0c('0xd')]=_0x4664fe;return rpc[_0x55c897+_0x7a0c('0xe')][_0x7a0c('0xf')](_0x21ba13)['then'](function(){logger[_0x7a0c('0x10')](_0x7a0c('0x11'),_0x2c21f0,_0x21ba13[_0x7a0c('0xd')]);_0x32a780();})[_0x7a0c('0x12')](function(_0x35e836){logger[_0x7a0c('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x2c21f0,JSON[_0x7a0c('0x14')](_0x35e836));_0x1a078d(_0x35e836);});});}exports[_0x7a0c('0x15')]=function(_0x2b260a,_0x2761d5){return function(_0x3206a2){try{if(!_['isNil'](this[_0x7a0c('0x16')][_0x7a0c('0x17')])){logger[_0x7a0c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x2b260a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3206a2['next']();}var _0x297db9={'ContactId':this[_0x7a0c('0x18')]['id'],'sentAt':moment()[_0x7a0c('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7a0c('0x1a')};if(this['channel']==='sms'||this[_0x7a0c('0x1b')]==='whatsapp'){_0x297db9[_0x7a0c('0x1c')]=this[_0x7a0c('0x16')]['phone'];}var _0x22251e=this[_0x7a0c('0x1b')];if(_0x22251e===_0x7a0c('0x1d')){_0x297db9['ChatWebsiteId']=this[_0x7a0c('0x1e')]['id'];}else{_0x297db9[_[_0x7a0c('0x1f')](_0x22251e)+_0x7a0c('0x20')]=this['account']['id'];}_0x297db9[_[_0x7a0c('0x1f')](_0x22251e)+_0x7a0c('0x21')]=this[_0x7a0c('0x16')]['id'];if(this[_0x7a0c('0x16')]['created']){var _0x55e22f=_0x2761d5[0x4];if(!_['isEmpty'](_0x55e22f)){_0x297db9[_0x7a0c('0xd')]=utils[_0x7a0c('0x22')](_0x55e22f,this);return rpc[_0x22251e+_0x7a0c('0xe')][_0x7a0c('0xf')](_0x297db9)[_0x7a0c('0x23')](function(_0x3498f1){logger[_0x7a0c('0x10')](_0x7a0c('0x11'),_0x2b260a,_0x297db9[_0x7a0c('0xd')]);})[_0x7a0c('0x12')](function(_0xe31a45){logger[_0x7a0c('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x2b260a,JSON[_0x7a0c('0x14')](_0xe31a45));})[_0x7a0c('0x24')](function(){logger[_0x7a0c('0x10')](_0x7a0c('0x25'),_0x2b260a);_0x3206a2[_0x7a0c('0x26')]();});}else{logger[_0x7a0c('0x10')](_0x7a0c('0x27'),_0x2b260a);_0x3206a2[_0x7a0c('0x26')]();}}else{var _0x360f55=this;var _0x45dbd0=_0x2761d5[0x2]['replace'](/\\n/g,'\x0a');var _0x5acbec={'credentials':{'private_key':_0x45dbd0,'client_email':_0x2761d5[0x1]}};var _0x5a3d2a=new dialogflow[(_0x7a0c('0x28'))](_0x5acbec);var _0x468df8=_0x5a3d2a[_0x7a0c('0x29')](_0x2761d5[0x0],md5(_0x360f55[_0x7a0c('0x16')]['id']));var _0x998185={'session':_0x468df8,'queryInput':{'text':{'text':_0x360f55['message'][_0x7a0c('0xd')],'languageCode':_0x2761d5[0x3]||'en'}}};return _0x5a3d2a[_0x7a0c('0x2a')](_0x998185)['then'](function(_0x411e86){if(_0x411e86&&_0x411e86[_0x7a0c('0x2b')]){_0x360f55[_0x7a0c('0xd')][_0x7a0c('0x2c')]=_0x411e86;var _0x1c18c7=_0x411e86[0x0];var _0x17d7c1=_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x2e')]&&_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x2e')]['fields']?_0x1c18c7['queryResult'][_0x7a0c('0x2e')][_0x7a0c('0x2f')][_0x7a0c('0x30')]['boolValue']:![];_0x360f55[_0x7a0c('0xd')][_0x7a0c('0x31')]=_0x1c18c7['queryResult'][_0x7a0c('0x32')];_0x360f55['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1c18c7['queryResult']['allRequiredParamsPresent'];_0x360f55[_0x7a0c('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x2e')]&&_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x2e')]['fields']?_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x2e')][_0x7a0c('0x2f')][_0x7a0c('0x30')][_0x7a0c('0x33')]:![];_0x360f55[_0x7a0c('0xd')][_0x7a0c('0x34')]=_0x1c18c7[_0x7a0c('0x2d')]['intent'][_0x7a0c('0x35')];_0x360f55[_0x7a0c('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x36')][_0x7a0c('0x37')];_0x360f55[_0x7a0c('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x36')][_0x7a0c('0x38')];_0x360f55[_0x7a0c('0xd')][_0x7a0c('0x39')]=_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x3a')];_0x360f55[_0x7a0c('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0x1c18c7[_0x7a0c('0x2d')]['queryText'];_0x360f55[_0x7a0c('0xd')][_0x7a0c('0x3b')]=_0x1c18c7[_0x7a0c('0x2d')][_0x7a0c('0x3c')];_0x297db9[_0x7a0c('0x3d')]=_0x7a0c('0x2c');_0x297db9['providerResponse']=JSON[_0x7a0c('0x14')](_0x411e86);var _0x3153f9=[];for(var _0x435d3e=0x0;_0x435d3e<_0x411e86[_0x7a0c('0x2b')];_0x435d3e++){var _0x9d7c49=_0x411e86[_0x435d3e];if(_0x9d7c49&&_0x9d7c49[_0x7a0c('0x2d')]&&_0x9d7c49[_0x7a0c('0x2d')][_0x7a0c('0x3e')]){_0x3153f9['push'](createMessage(_0x2b260a,_0x22251e,_0x297db9,_0x9d7c49[_0x7a0c('0x2d')][_0x7a0c('0x3e')]));}}return Promise['all'](_0x3153f9)[_0x7a0c('0x23')](function(){if(_0x17d7c1){_0x3206a2['next']();}else{_0x3206a2[_0x7a0c('0x26')]();}})[_0x7a0c('0x12')](function(_0x431644){logger['error'](_0x7a0c('0x11'),_0x2b260a,JSON['stringify'](_0x431644));_0x3206a2[_0x7a0c('0x3f')]();});}})[_0x7a0c('0x12')](function(_0x185034){logger[_0x7a0c('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x2b260a,_0x185034['message'],_0x185034[_0x7a0c('0x40')]);_0x3206a2[_0x7a0c('0x3f')]();});}}catch(_0x2cbffc){logger[_0x7a0c('0x13')](_0x7a0c('0x11'),_0x2b260a,JSON[_0x7a0c('0x14')](_0x2cbffc));_0x3206a2[_0x7a0c('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 6c46c91..6545e89 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62b2=['findIndex','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','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','consequence','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x62b2,0x66));var _0x262b=function(_0x5f1bef,_0x16d4dc){_0x5f1bef=_0x5f1bef-0x0;var _0x245144=_0x62b2[_0x5f1bef];return _0x245144;};'use strict';var schema=require(_0x262b('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x262b('0x1'));var gotoif=schema({'condition':{'type':_0x262b('0x2'),'required':!![],'message':_0x262b('0x3')},'priorityTrue':{'type':'number','message':_0x262b('0x4')},'priorityFalse':{'type':_0x262b('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x262b('0x6')]=function(_0x4481f2,_0x32312d){return function(_0x3b5c8c){try{var _0x2c83d1={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x32312d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x32312d[0x1],'priorityFalse':_0x32312d[0x2]};var _0x503017=gotoif[_0x262b('0x0')](_0x2c83d1,{'typecast':!![]});if(_0x503017[_0x262b('0x7')]){logger[_0x262b('0x8')](_0x262b('0x9'),_0x4481f2,_['map'](_0x503017,_0x262b('0xa'))[_0x262b('0xb')](',\x20'));_0x3b5c8c[_0x262b('0xc')]();}else{try{var _0x27d795=eval('('+_0x2c83d1[_0x262b('0xd')]+')');var _0x1fdeb3=_0x27d795?_0x2c83d1[_0x262b('0xe')]:_0x2c83d1['priorityFalse'];logger[_0x262b('0xf')](_0x262b('0x10'),_0x4481f2,_0x2c83d1[_0x262b('0xd')],_0x27d795,_0x1fdeb3||_0x262b('0x11'));if(_0x1fdeb3){var _0x142fdb=_[_0x262b('0x12')](_0x3b5c8c[_0x262b('0x13')](),{'p':_0x1fdeb3});if(_0x142fdb>=0x0){logger[_0x262b('0xf')](_0x262b('0x14'),_0x4481f2,_0x1fdeb3||_0x262b('0x11'),_0x142fdb);_0x3b5c8c[_0x262b('0x11')](_0x142fdb);}else{logger[_0x262b('0xf')](_0x262b('0x15'),_0x4481f2,_0x1fdeb3||'next');_0x3b5c8c[_0x262b('0xc')]();}}else{_0x3b5c8c[_0x262b('0x11')]();}}catch(_0x37c17a){logger[_0x262b('0x8')](_0x262b('0x16'),_0x4481f2,_0x37c17a[_0x262b('0xa')]);_0x3b5c8c[_0x262b('0xc')]();}}}catch(_0x3ce80c){logger[_0x262b('0x8')](_0x262b('0x9'),_0x4481f2,JSON[_0x262b('0x17')](_0x3ce80c));_0x3b5c8c[_0x262b('0xc')]();}};}; \ No newline at end of file +var _0x16be=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1296bc,_0x43c3d9){var _0x3505cc=function(_0x95b970){while(--_0x95b970){_0x1296bc['push'](_0x1296bc['shift']());}};_0x3505cc(++_0x43c3d9);}(_0x16be,0xed));var _0xe16b=function(_0x533b0b,_0x115e3b){_0x533b0b=_0x533b0b-0x0;var _0x4611ca=_0x16be[_0x533b0b];return _0x4611ca;};'use strict';var schema=require(_0xe16b('0x0'));var _=require(_0xe16b('0x1'));var htmlToText=require(_0xe16b('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xe16b('0x3'),'required':!![],'message':_0xe16b('0x4')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe16b('0x5'),'message':_0xe16b('0x6')}});exports[_0xe16b('0x7')]=function(_0x5ab412,_0x249c09){return function(_0x413b41){try{var _0x271c6f={'condition':htmlToText['fromString'](utils[_0xe16b('0x8')](_0x249c09[0x0],this),{'wordwrap':![]})[_0xe16b('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x249c09[0x1],'priorityFalse':_0x249c09[0x2]};var _0x4ce3ae=gotoif[_0xe16b('0x0')](_0x271c6f,{'typecast':!![]});if(_0x4ce3ae[_0xe16b('0xa')]){logger['error'](_0xe16b('0xb'),_0x5ab412,_['map'](_0x4ce3ae,_0xe16b('0xc'))[_0xe16b('0xd')](',\x20'));_0x413b41[_0xe16b('0xe')]();}else{try{var _0x19d9c6=eval('('+_0x271c6f[_0xe16b('0xf')]+')');var _0x4932f6=_0x19d9c6?_0x271c6f['priorityTrue']:_0x271c6f[_0xe16b('0x10')];logger[_0xe16b('0x11')](_0xe16b('0x12'),_0x5ab412,_0x271c6f[_0xe16b('0xf')],_0x19d9c6,_0x4932f6||_0xe16b('0x13'));if(_0x4932f6){var _0x38d135=_[_0xe16b('0x14')](_0x413b41[_0xe16b('0x15')](),{'p':_0x4932f6});if(_0x38d135>=0x0){logger[_0xe16b('0x11')](_0xe16b('0x16'),_0x5ab412,_0x4932f6||_0xe16b('0x13'),_0x38d135);_0x413b41[_0xe16b('0x13')](_0x38d135);}else{logger[_0xe16b('0x11')](_0xe16b('0x17'),_0x5ab412,_0x4932f6||_0xe16b('0x13'));_0x413b41[_0xe16b('0xe')]();}}else{_0x413b41[_0xe16b('0x13')]();}}catch(_0x559892){logger[_0xe16b('0x18')](_0xe16b('0x19'),_0x5ab412,_0x559892[_0xe16b('0xc')]);_0x413b41[_0xe16b('0xe')]();}}}catch(_0x1dc3a5){logger[_0xe16b('0x18')]('[%s][GOTOIF]\x20%s',_0x5ab412,JSON['stringify'](_0x1dc3a5));_0x413b41[_0xe16b('0xe')]();}};}; \ 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 513a88e..9f61ad8 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 _0xd645=['lodash','../../../../config/logger','routing','length','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xd645,0x87));var _0x5d64=function(_0x935023,_0xdbe49){_0x935023=_0x935023-0x0;var _0x1db630=_0xd645[_0x935023];return _0x1db630;};'use strict';var schema=require('validate');var _=require(_0x5d64('0x0'));var logger=require(_0x5d64('0x1'))(_0x5d64('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5353b2,_0xc94db4){return function(_0x42378d){try{var _0xf23988={'priority':_0xc94db4[0x0]};var _0x4cc791=gotop['validate'](_0xf23988,{'typecast':!![]});if(_0x4cc791[_0x5d64('0x3')]){logger[_0x5d64('0x4')](_0x5d64('0x5'),_0x5353b2,_[_0x5d64('0x6')](_0x4cc791,'message')['join'](',\x20'));_0x42378d[_0x5d64('0x7')]();}else{logger[_0x5d64('0x8')](_0x5d64('0x9'),_0x5353b2,_0xf23988[_0x5d64('0xa')]);if(_0xf23988[_0x5d64('0xa')]){var _0x10f7ac=_['findIndex'](_0x42378d['rules'](),{'p':_0xf23988[_0x5d64('0xa')]});if(_0x10f7ac>=0x0){logger[_0x5d64('0x8')](_0x5d64('0xb'),_0x5353b2,_0xf23988[_0x5d64('0xa')]||_0x5d64('0xc'),_0x10f7ac);_0x42378d[_0x5d64('0xc')](_0x10f7ac);}else{logger['info'](_0x5d64('0xd'),_0x5353b2,_0xf23988[_0x5d64('0xa')]||_0x5d64('0xc'));_0x42378d['stop']();}}else{_0x42378d[_0x5d64('0xc')]();}}}catch(_0x1b5f59){logger[_0x5d64('0x4')](_0x5d64('0x5'),_0x5353b2,JSON[_0x5d64('0xe')](_0x1b5f59));_0x42378d[_0x5d64('0x7')]();}};}; \ No newline at end of file +var _0x30e6=['next','stop','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x30e6,0x80));var _0x630e=function(_0x10ca96,_0x221ff7){_0x10ca96=_0x10ca96-0x0;var _0x225f81=_0x30e6[_0x10ca96];return _0x225f81;};'use strict';var schema=require('validate');var _=require(_0x630e('0x0'));var logger=require(_0x630e('0x1'))('routing');var gotop=schema({'priority':{'type':_0x630e('0x2'),'required':!![],'message':_0x630e('0x3')}});exports[_0x630e('0x4')]=function(_0x1a15c1,_0x597f74){return function(_0x2ad286){try{var _0x561eac={'priority':_0x597f74[0x0]};var _0x3cd0b1=gotop['validate'](_0x561eac,{'typecast':!![]});if(_0x3cd0b1[_0x630e('0x5')]){logger[_0x630e('0x6')](_0x630e('0x7'),_0x1a15c1,_[_0x630e('0x8')](_0x3cd0b1,_0x630e('0x9'))[_0x630e('0xa')](',\x20'));_0x2ad286['stop']();}else{logger[_0x630e('0xb')](_0x630e('0xc'),_0x1a15c1,_0x561eac[_0x630e('0xd')]);if(_0x561eac[_0x630e('0xd')]){var _0x3de299=_[_0x630e('0xe')](_0x2ad286[_0x630e('0xf')](),{'p':_0x561eac[_0x630e('0xd')]});if(_0x3de299>=0x0){logger[_0x630e('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1a15c1,_0x561eac['priority']||_0x630e('0x10'),_0x3de299);_0x2ad286[_0x630e('0x10')](_0x3de299);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1a15c1,_0x561eac['priority']||'next');_0x2ad286[_0x630e('0x11')]();}}else{_0x2ad286[_0x630e('0x10')]();}}}catch(_0x521db9){logger[_0x630e('0x6')](_0x630e('0x7'),_0x1a15c1,JSON['stringify'](_0x521db9));_0x2ad286[_0x630e('0x11')]();}};}; \ 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 9726019..21e7f3c 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 _0x532e=['catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x532e,0xb8));var _0xe532=function(_0x1fc47b,_0x3fa1f0){_0x1fc47b=_0x1fc47b-0x0;var _0x33a9a4=_0x532e[_0x1fc47b];return _0x33a9a4;};'use strict';var _=require(_0xe532('0x0'));var utils=require(_0xe532('0x1'));var logger=require(_0xe532('0x2'))(_0xe532('0x3'));var rpc={'chatMessage':require(_0xe532('0x4')),'openchannelMessage':require(_0xe532('0x5')),'mailMessage':require(_0xe532('0x6')),'smsMessage':require(_0xe532('0x7')),'faxMessage':require(_0xe532('0x8')),'whatsappMessage':require(_0xe532('0x9'))};exports[_0xe532('0xa')]=function(_0x4bf9d0,_0x18f4aa){return function(_0x169f71){try{var _0x7987f2={'body':utils[_0xe532('0xb')](_0x18f4aa[0x0],this),'ContactId':this[_0xe532('0xc')]['id']};if(this[_0xe532('0xd')]===_0xe532('0xe')){_0x7987f2['ChatWebsiteId']=this[_0xe532('0xf')]['id'];}else{_0x7987f2[_[_0xe532('0x10')](this[_0xe532('0xd')])+'AccountId']=this[_0xe532('0xf')]['id'];}_0x7987f2[_[_0xe532('0x10')](this[_0xe532('0xd')])+_0xe532('0x11')]=this[_0xe532('0x12')]['id'];if(rpc[this[_0xe532('0xd')]+_0xe532('0x13')]){return rpc[this['channel']+_0xe532('0x13')][_0xe532('0x14')](_0x7987f2)[_0xe532('0x15')](function(_0x1d6774){logger[_0xe532('0x16')](_0xe532('0x17'),_0x4bf9d0,_0x7987f2[_0xe532('0x18')]);_0x169f71[_0xe532('0x19')]();})[_0xe532('0x1a')](function(_0x10debc){logger[_0xe532('0x1b')]('[%s][MESSAGE]\x20%s',_0x4bf9d0,JSON[_0xe532('0x1c')](_0x10debc));_0x169f71[_0xe532('0x1d')]();});}}catch(_0x11b8ee){logger[_0xe532('0x1b')]('[%s][MESSAGE]\x20%s',_0x4bf9d0,JSON[_0xe532('0x1c')](_0x11b8ee));_0x169f71[_0xe532('0x1d')]();}};}; \ No newline at end of file +var _0xfc75=['then','catch','error','[%s][MESSAGE]\x20%s','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','account','upperFirst','interaction','Message','create'];(function(_0x377c58,_0xf0eddc){var _0x37066d=function(_0x43d2dc){while(--_0x43d2dc){_0x377c58['push'](_0x377c58['shift']());}};_0x37066d(++_0xf0eddc);}(_0xfc75,0xe1));var _0x5fc7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfc75[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x5fc7('0x0'));var utils=require(_0x5fc7('0x1'));var logger=require(_0x5fc7('0x2'))(_0x5fc7('0x3'));var rpc={'chatMessage':require(_0x5fc7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5fc7('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5fc7('0x6'))};exports[_0x5fc7('0x7')]=function(_0x27ecb5,_0x228756){return function(_0x1265a2){try{var _0x503eaa={'body':utils[_0x5fc7('0x8')](_0x228756[0x0],this),'ContactId':this['contact']['id']};if(this[_0x5fc7('0x9')]==='chat'){_0x503eaa['ChatWebsiteId']=this[_0x5fc7('0xa')]['id'];}else{_0x503eaa[_['upperFirst'](this[_0x5fc7('0x9')])+'AccountId']=this[_0x5fc7('0xa')]['id'];}_0x503eaa[_[_0x5fc7('0xb')](this[_0x5fc7('0x9')])+'InteractionId']=this[_0x5fc7('0xc')]['id'];if(rpc[this[_0x5fc7('0x9')]+_0x5fc7('0xd')]){return rpc[this['channel']+_0x5fc7('0xd')][_0x5fc7('0xe')](_0x503eaa)[_0x5fc7('0xf')](function(_0x23a387){logger['info']('[%s][MESSAGE]\x20%s',_0x27ecb5,_0x503eaa['body']);_0x1265a2['next']();})[_0x5fc7('0x10')](function(_0x13fb24){logger[_0x5fc7('0x11')](_0x5fc7('0x12'),_0x27ecb5,JSON['stringify'](_0x13fb24));_0x1265a2[_0x5fc7('0x13')]();});}}catch(_0x32d87c){logger[_0x5fc7('0x11')](_0x5fc7('0x12'),_0x27ecb5,JSON['stringify'](_0x32d87c));_0x1265a2[_0x5fc7('0x13')]();}};}; \ 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 c1dedf6..a704cdb 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 _0x8f31=['getMustacheRender','next','error','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x427cea,_0x5b4be5){var _0x3d0441=function(_0xd524e3){while(--_0xd524e3){_0x427cea['push'](_0x427cea['shift']());}};_0x3d0441(++_0x5b4be5);}(_0x8f31,0x1b3));var _0x18f3=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x8f31[_0x7feb90];return _0x3c5b33;};'use strict';var utils=require(_0x18f3('0x0'));var logger=require(_0x18f3('0x1'))(_0x18f3('0x2'));exports[_0x18f3('0x3')]=function(_0x4d248c,_0x2607ef){return function(_0x2d8cd4){try{logger[_0x18f3('0x4')](_0x18f3('0x5'),_0x4d248c,utils[_0x18f3('0x6')](_0x2607ef[0x0],this));_0x2d8cd4[_0x18f3('0x7')]();}catch(_0x306781){logger[_0x18f3('0x8')]('[%s][NOOP]\x20%s',_0x4d248c,JSON['stringify'](_0x306781));_0x2d8cd4['stop']();}};}; \ No newline at end of file +var _0x1657=['consequence','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x18e2b1,_0x27d9b6){var _0x16846f=function(_0x4b675f){while(--_0x4b675f){_0x18e2b1['push'](_0x18e2b1['shift']());}};_0x16846f(++_0x27d9b6);}(_0x1657,0x6d));var _0x7165=function(_0x374499,_0x5084b7){_0x374499=_0x374499-0x0;var _0x349da1=_0x1657[_0x374499];return _0x349da1;};'use strict';var utils=require(_0x7165('0x0'));var logger=require(_0x7165('0x1'))(_0x7165('0x2'));exports[_0x7165('0x3')]=function(_0x50d530,_0x4319d2){return function(_0x5a5f92){try{logger['info']('[%s][NOOP]\x20%s',_0x50d530,utils['getMustacheRender'](_0x4319d2[0x0],this));_0x5a5f92['next']();}catch(_0x2b4dd4){logger[_0x7165('0x4')](_0x7165('0x5'),_0x50d530,JSON[_0x7165('0x6')](_0x2b4dd4));_0x5a5f92[_0x7165('0x7')]();}};}; \ 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 516b01e..92395ce 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 _0x89e0=['find','Queues','timeout','atimeout','qtimeout','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','util','seq-queue','moment','../../../../config/environment','routing','./strategy','redis','account','queue','from','emit','clone','queue_id','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','info','[%s][END:QUEUE][NAME:%s]','catch','update\x20queue\x20report','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','stop'];(function(_0x4269ba,_0x648fa9){var _0xae6f6=function(_0x56cfc8){while(--_0x56cfc8){_0x4269ba['push'](_0x4269ba['shift']());}};_0xae6f6(++_0x648fa9);}(_0x89e0,0x1b3));var _0x089e=function(_0x457d51,_0x259c93){_0x457d51=_0x457d51-0x0;var _0x266b92=_0x89e0[_0x457d51];return _0x266b92;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x089e('0x0'));var seqqueue=require(_0x089e('0x1'));var moment=require(_0x089e('0x2'));var Redis=require('ioredis');var config=require(_0x089e('0x3'));var logger=require('../../../../config/logger')(_0x089e('0x4'));var strategy=require(_0x089e('0x5'));config[_0x089e('0x6')]=_['defaults'](config[_0x089e('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id','queue_id',_0x089e('0x7'),_0x089e('0x8'),_0x089e('0x9'),'joinAt'];function emit(_0x3054bd,_0x57d2bd,_0x377abc){io['to'](_0x3054bd)[_0x089e('0xa')](_0x57d2bd,_0x377abc);}function emitChannelQueueInteraction(_0x370298,_0x157436,_0x13ffed,_0x157995,_0x27bcfc,_0x235971,_0xf2c4e3,_0xd9dac7){var _0x3534de=_[_0x089e('0xb')](_0x13ffed);_0x3534de[_0x089e('0xc')]=_0xd9dac7;_0x3534de['queue']=_0x157436;_0x3534de[_0x089e('0x7')]=_0x157995;_0x3534de['id']=_0x27bcfc;if(_0x235971){attributes['push'](_[_0x089e('0xd')](_0x370298)+_0x089e('0xe'));_0xf2c4e3[util[_0x089e('0xf')]('%sQueuesWaitingInteractions',_0x370298)][_0x27bcfc]=_[_0x089e('0x10')](_0x3534de,attributes);}else{delete _0xf2c4e3[util[_0x089e('0xf')](_0x089e('0x11'),_0x370298)][_0x27bcfc];}emit(util[_0x089e('0xf')](_0x089e('0x12'),_0x370298,_0x157436),util['format'](_0x089e('0x13'),_0x370298,_0x235971?_0x089e('0x14'):_0x089e('0x15')),_[_0x089e('0x10')](_0x3534de,attributes));}var rpc={'openchannelQueueReport':require(_0x089e('0x16')),'mailQueueReport':require(_0x089e('0x17')),'chatQueueReport':require(_0x089e('0x18')),'smsQueueReport':require(_0x089e('0x19')),'faxQueueReport':require(_0x089e('0x1a')),'whatsappQueueReport':require(_0x089e('0x1b')),'chatInteraction':require(_0x089e('0x1c')),'faxInteraction':require(_0x089e('0x1d')),'mailInteraction':require(_0x089e('0x1e')),'openchannelInteraction':require(_0x089e('0x1f')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x089e('0x20'))};var queue=schema({'name':{'type':_0x089e('0x21'),'required':!![],'message':_0x089e('0x22')},'timeout':{'type':'number','message':_0x089e('0x23')}});function startRouting(_0x11309c,_0x197db8,_0x367724,_0x588796){if(_0x11309c&&_0x197db8&&_0x367724){_0x197db8[_0x089e('0x24')]+=0x1;var _0x311a35={'uniqueid':_0x11309c,'from':_0x367724[_0x089e('0x25')]?_0x367724[_0x089e('0x25')]['from']:'','joinAt':moment()[_0x089e('0xf')](_0x089e('0x26')),'ContactId':_0x367724[_0x089e('0x27')]?_0x367724[_0x089e('0x27')]['id']:null,'ListId':_0x367724[_0x089e('0x28')]?_0x367724['list']['id']:null};_0x311a35[_[_0x089e('0x29')](_0x367724[_0x089e('0x2a')])+_0x089e('0x2b')]=_0x197db8['id']||null;_0x311a35[_[_0x089e('0x29')](_0x367724[_0x089e('0x2a')])+'InteractionId']=_0x367724[_0x089e('0x2c')]?_0x367724['interaction']['id']:null;_0x311a35[_['upperFirst'](_0x367724[_0x089e('0x2a')])+_0x089e('0x2d')]=_0x367724[_0x089e('0x2e')]?_0x367724[_0x089e('0x2e')]['id']:null;_0x311a35[_[_0x089e('0x29')](_0x367724[_0x089e('0x2a')])+(_0x367724['channel']!=='chat'?'AccountId':_0x089e('0x2f'))]=_0x367724['account']?_0x367724[_0x089e('0x7')]['id']:null;logger['info'](util[_0x089e('0xf')](_0x089e('0x30'),_0x11309c,_0x197db8[_0x089e('0x31')]));emitChannelQueueInteraction(_0x367724['channel'],_0x197db8['name'],_0x311a35,_0x367724['account']['name'],_0x367724[_0x089e('0x2e')]['id'],!![],_0x588796,_0x197db8['id']);if(rpc[_0x367724['channel']+_0x089e('0x32')]){return rpc[_0x367724[_0x089e('0x2a')]+_0x089e('0x32')][_0x089e('0x33')](_0x311a35)['catch'](function(_0x4eceb3){logger[_0x089e('0x34')]('create\x20queue\x20report',_0x4eceb3);});}}}function stopRouting(_0x38f4cf,_0x30450a,_0x305b8f,_0xac2ebf){if(_0x38f4cf&&_0x30450a){_0x30450a[_0x089e('0x24')]-=0x1;var _0x18c431={'leaveAt':moment()[_0x089e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x089e('0x26')),'reason':_0x089e('0x35')};logger['info'](util['format'](_0x089e('0x36'),_0x38f4cf,_0x30450a[_0x089e('0x31')]));emitChannelQueueInteraction(_0x305b8f[_0x089e('0x2a')],_0x30450a[_0x089e('0x31')],_0x305b8f['body'],_0x305b8f[_0x089e('0x7')][_0x089e('0x31')],_0x305b8f[_0x089e('0x2e')]['id'],![],_0xac2ebf,_0x30450a['id']);return rpc[_0x305b8f['channel']+_0x089e('0x37')][_0x089e('0x38')](_0x305b8f['interaction']['id'],{'queueId':_0x30450a['id']})[_0x089e('0x39')](function(){if(rpc[_0x305b8f[_0x089e('0x2a')]+_0x089e('0x32')]){return rpc[_0x305b8f[_0x089e('0x2a')]+'QueueReport'][_0x089e('0x38')](_0x38f4cf,_0x18c431)['catch'](function(_0x52229c){logger[_0x089e('0x34')]('update\x20queue\x20report',_0x52229c);});}});}}function endRouting(_0x15e982,_0x390266,_0x4ac367,_0x77e643){if(_0x15e982&&_0x390266){_0x390266[_0x089e('0x24')]-=0x1;var _0x188bd5={'leaveAt':moment()[_0x089e('0xf')](_0x089e('0x26')),'exitAt':moment()[_0x089e('0xf')](_0x089e('0x26')),'reason':'timeout'};logger[_0x089e('0x3a')](util['format'](_0x089e('0x3b'),_0x15e982,_0x390266[_0x089e('0x31')]));emitChannelQueueInteraction(_0x4ac367['channel'],_0x390266[_0x089e('0x31')],_0x4ac367[_0x089e('0x25')],_0x4ac367[_0x089e('0x7')][_0x089e('0x31')],_0x4ac367[_0x089e('0x2e')]['id'],![],_0x77e643);if(rpc[_0x4ac367[_0x089e('0x2a')]+'QueueReport']){return rpc[_0x4ac367[_0x089e('0x2a')]+'QueueReport']['update'](_0x15e982,_0x188bd5)[_0x089e('0x3c')](function(_0x33822f){logger[_0x089e('0x34')](_0x089e('0x3d'),_0x33822f);});}}}function handleFindQueue(_0xd876f8){return function(_0x3c9f0d){return _0x3c9f0d[_0x089e('0x31')][_0x089e('0x3e')]()===_0xd876f8[_0x089e('0x3e')]();};}exports[_0x089e('0x3f')]=function(_0x38ae41,_0x21fa01,_0x15a22c,_0xeb7a71){return function(_0x533cba){try{var _0x2b8338={'name':_0x21fa01[0x0],'timeout':_0x21fa01[0x1]};var _0x57b610=queue[_0x089e('0x40')](_0x2b8338,{'typecast':!![]});if(_0x57b610[_0x089e('0x41')]){logger['error'](_0x089e('0x42'),_0x38ae41,_[_0x089e('0x43')](_0x57b610,_0x089e('0x2e'))['join'](',\x20'));_0x533cba[_0x089e('0x44')]();}else{var _0x41d1d2=_[_0x089e('0x45')](_0x15a22c[_0xeb7a71['channel']+_0x089e('0x46')],handleFindQueue(_0x2b8338[_0x089e('0x31')]));if(_0x41d1d2){startRouting(_0x38ae41,_0x41d1d2,_0xeb7a71,_0x15a22c);var _0x35af0a=(_0x41d1d2[_0x089e('0x47')]||0xa)*0x3e8;var _0x106990=(_0x2b8338['timeout']||0x14)*0x3e8;var _0x166639;if(_0x35af0a>_0x106990){_0x106990=_0x35af0a;}var _0x43dd40=seqqueue['createQueue'](_0x35af0a);_0x43dd40['id']=_0x38ae41;_0x43dd40[_0x089e('0x48')]=_0x35af0a;_0x43dd40[_0x089e('0x49')]=_0x106990;_0x43dd40[_0x089e('0x2a')]=_0xeb7a71['channel'];_0x15a22c[_0x089e('0x4a')][_0x38ae41]['on'](_0x089e('0x4b'),function(){logger[_0x089e('0x3a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x38ae41);stopRouting(_0x38ae41,_0x41d1d2,_0xeb7a71,_0x15a22c);clearTimeout(_0x166639);_0x166639=undefined;_0x43dd40['close'](!![]);if(_0x15a22c[_0x089e('0x4a')][_0x38ae41]){delete _0x15a22c[_0x089e('0x4a')][_0x38ae41];}_0x533cba['stop']();});_0x15a22c[_0x089e('0x4a')][_0x38ae41]['on'](_0x089e('0x4c'),function(){if(_0x15a22c[_0x089e('0x4a')][_0x38ae41]){delete _0x15a22c[_0x089e('0x4a')][_0x38ae41];}});_0x166639=setTimeout(function(){logger[_0x089e('0x3a')](_0x089e('0x4d'),_0x38ae41);endRouting(_0x38ae41,_0x41d1d2,_0xeb7a71,_0x15a22c);clearTimeout(_0x166639);_0x43dd40[_0x089e('0x4e')](!![]);_0x533cba[_0x089e('0x4f')]();},_0x106990);switch(_0x41d1d2[_0x089e('0x50')]){case'rrmemory':strategy['rrmemory'](_0x43dd40,_0x41d1d2,_0x15a22c,_0xeb7a71);break;default:strategy[_0x089e('0x51')](_0x43dd40,_0x41d1d2,_0x15a22c,_0xeb7a71);}}else{logger['error'](_0x089e('0x52'),_0x38ae41,_0x2b8338[_0x089e('0x31')]);_0x533cba[_0x089e('0x44')]();}}}catch(_0x5de06b){logger['error'](_0x089e('0x42'),_0x38ae41,_0x5de06b[_0x089e('0x53')]);_0x533cba['stop']();}};}; \ No newline at end of file +var _0x7e0b=['push','capitalize','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','clone'];(function(_0x43b7a7,_0x57d7db){var _0x42fca3=function(_0x1e82b4){while(--_0x1e82b4){_0x43b7a7['push'](_0x43b7a7['shift']());}};_0x42fca3(++_0x57d7db);}(_0x7e0b,0x149));var _0xb7e0=function(_0x19d648,_0x563fce){_0x19d648=_0x19d648-0x0;var _0x461be0=_0x7e0b[_0x19d648];return _0x461be0;};'use strict';var schema=require('validate');var _=require(_0xb7e0('0x0'));var util=require(_0xb7e0('0x1'));var seqqueue=require(_0xb7e0('0x2'));var moment=require(_0xb7e0('0x3'));var Redis=require('ioredis');var config=require(_0xb7e0('0x4'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xb7e0('0x5'));config[_0xb7e0('0x6')]=_[_0xb7e0('0x7')](config['redis'],{'host':_0xb7e0('0x8'),'port':0x18eb});var io=require(_0xb7e0('0x9'))(new Redis(config[_0xb7e0('0x6')]));var attributes=['id',_0xb7e0('0xa'),_0xb7e0('0xb'),_0xb7e0('0xc'),'from',_0xb7e0('0xd')];function emit(_0x3c35bc,_0x4279da,_0x500573){io['to'](_0x3c35bc)['emit'](_0x4279da,_0x500573);}function emitChannelQueueInteraction(_0x41e22b,_0x248386,_0x7ab55e,_0x3cdbb5,_0x20717d,_0x4dae49,_0x5e3ad1,_0x1e5eaa){var _0x3036da=_[_0xb7e0('0xe')](_0x7ab55e);_0x3036da[_0xb7e0('0xa')]=_0x1e5eaa;_0x3036da[_0xb7e0('0xc')]=_0x248386;_0x3036da[_0xb7e0('0xb')]=_0x3cdbb5;_0x3036da['id']=_0x20717d;if(_0x4dae49){attributes[_0xb7e0('0xf')](_[_0xb7e0('0x10')](_0x41e22b)+'InteractionId');_0x5e3ad1[util['format'](_0xb7e0('0x11'),_0x41e22b)][_0x20717d]=_[_0xb7e0('0x12')](_0x3036da,attributes);}else{delete _0x5e3ad1[util['format']('%sQueuesWaitingInteractions',_0x41e22b)][_0x20717d];}emit(util[_0xb7e0('0x13')](_0xb7e0('0x14'),_0x41e22b,_0x248386),util[_0xb7e0('0x13')](_0xb7e0('0x15'),_0x41e22b,_0x4dae49?_0xb7e0('0x16'):'remove'),_['pick'](_0x3036da,attributes));}var rpc={'openchannelQueueReport':require(_0xb7e0('0x17')),'mailQueueReport':require(_0xb7e0('0x18')),'chatQueueReport':require(_0xb7e0('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xb7e0('0x1a')),'whatsappQueueReport':require(_0xb7e0('0x1b')),'chatInteraction':require(_0xb7e0('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xb7e0('0x1d')),'openchannelInteraction':require(_0xb7e0('0x1e')),'smsInteraction':require(_0xb7e0('0x1f')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xb7e0('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xb7e0('0x21'),'message':_0xb7e0('0x22')}});function startRouting(_0x550c49,_0x1d8b5c,_0xc9ee39,_0x1f3bee){if(_0x550c49&&_0x1d8b5c&&_0xc9ee39){_0x1d8b5c[_0xb7e0('0x23')]+=0x1;var _0x3696b8={'uniqueid':_0x550c49,'from':_0xc9ee39['body']?_0xc9ee39[_0xb7e0('0x24')][_0xb7e0('0x25')]:'','joinAt':moment()['format'](_0xb7e0('0x26')),'ContactId':_0xc9ee39[_0xb7e0('0x27')]?_0xc9ee39[_0xb7e0('0x27')]['id']:null,'ListId':_0xc9ee39[_0xb7e0('0x28')]?_0xc9ee39[_0xb7e0('0x28')]['id']:null};_0x3696b8[_[_0xb7e0('0x29')](_0xc9ee39['channel'])+'QueueId']=_0x1d8b5c['id']||null;_0x3696b8[_['upperFirst'](_0xc9ee39[_0xb7e0('0x2a')])+_0xb7e0('0x2b')]=_0xc9ee39['interaction']?_0xc9ee39[_0xb7e0('0x2c')]['id']:null;_0x3696b8[_[_0xb7e0('0x29')](_0xc9ee39[_0xb7e0('0x2a')])+_0xb7e0('0x2d')]=_0xc9ee39[_0xb7e0('0x2e')]?_0xc9ee39['message']['id']:null;_0x3696b8[_[_0xb7e0('0x29')](_0xc9ee39[_0xb7e0('0x2a')])+(_0xc9ee39[_0xb7e0('0x2a')]!==_0xb7e0('0x2f')?_0xb7e0('0x30'):'WebsiteId')]=_0xc9ee39['account']?_0xc9ee39['account']['id']:null;logger[_0xb7e0('0x31')](util['format'](_0xb7e0('0x32'),_0x550c49,_0x1d8b5c[_0xb7e0('0x33')]));emitChannelQueueInteraction(_0xc9ee39[_0xb7e0('0x2a')],_0x1d8b5c['name'],_0x3696b8,_0xc9ee39['account']['name'],_0xc9ee39['message']['id'],!![],_0x1f3bee,_0x1d8b5c['id']);if(rpc[_0xc9ee39[_0xb7e0('0x2a')]+_0xb7e0('0x34')]){return rpc[_0xc9ee39[_0xb7e0('0x2a')]+'QueueReport'][_0xb7e0('0x35')](_0x3696b8)[_0xb7e0('0x36')](function(_0x4c8c1e){logger[_0xb7e0('0x37')]('create\x20queue\x20report',_0x4c8c1e);});}}}function stopRouting(_0x7b9c4f,_0x423373,_0x2499ed,_0x32d875){if(_0x7b9c4f&&_0x423373){_0x423373[_0xb7e0('0x23')]-=0x1;var _0x40ba06={'leaveAt':moment()[_0xb7e0('0x13')](_0xb7e0('0x26')),'acceptAt':moment()[_0xb7e0('0x13')](_0xb7e0('0x26')),'reason':_0xb7e0('0x38')};logger['info'](util[_0xb7e0('0x13')](_0xb7e0('0x39'),_0x7b9c4f,_0x423373['name']));emitChannelQueueInteraction(_0x2499ed[_0xb7e0('0x2a')],_0x423373[_0xb7e0('0x33')],_0x2499ed[_0xb7e0('0x24')],_0x2499ed[_0xb7e0('0xb')]['name'],_0x2499ed[_0xb7e0('0x2e')]['id'],![],_0x32d875,_0x423373['id']);return rpc[_0x2499ed[_0xb7e0('0x2a')]+'Interaction'][_0xb7e0('0x3a')](_0x2499ed[_0xb7e0('0x2c')]['id'],{'queueId':_0x423373['id']})[_0xb7e0('0x3b')](function(){if(rpc[_0x2499ed[_0xb7e0('0x2a')]+_0xb7e0('0x34')]){return rpc[_0x2499ed[_0xb7e0('0x2a')]+'QueueReport']['update'](_0x7b9c4f,_0x40ba06)[_0xb7e0('0x36')](function(_0x15916d){logger[_0xb7e0('0x37')](_0xb7e0('0x3c'),_0x15916d);});}});}}function endRouting(_0x42cfa5,_0xd74148,_0x3fb7d1,_0x5719ea){if(_0x42cfa5&&_0xd74148){_0xd74148[_0xb7e0('0x23')]-=0x1;var _0x568d5c={'leaveAt':moment()[_0xb7e0('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xb7e0('0x26')),'reason':'timeout'};logger[_0xb7e0('0x31')](util[_0xb7e0('0x13')](_0xb7e0('0x3d'),_0x42cfa5,_0xd74148[_0xb7e0('0x33')]));emitChannelQueueInteraction(_0x3fb7d1['channel'],_0xd74148[_0xb7e0('0x33')],_0x3fb7d1[_0xb7e0('0x24')],_0x3fb7d1[_0xb7e0('0xb')][_0xb7e0('0x33')],_0x3fb7d1['message']['id'],![],_0x5719ea);if(rpc[_0x3fb7d1['channel']+'QueueReport']){return rpc[_0x3fb7d1[_0xb7e0('0x2a')]+'QueueReport'][_0xb7e0('0x3a')](_0x42cfa5,_0x568d5c)[_0xb7e0('0x36')](function(_0x50f898){logger[_0xb7e0('0x37')](_0xb7e0('0x3c'),_0x50f898);});}}}function handleFindQueue(_0x50ad86){return function(_0x4b7e34){return _0x4b7e34[_0xb7e0('0x33')]['toLowerCase']()===_0x50ad86[_0xb7e0('0x3e')]();};}exports[_0xb7e0('0x3f')]=function(_0x5c9e5f,_0x3ea8b2,_0x7db347,_0x1edccf){return function(_0x518f0d){try{var _0x984ec9={'name':_0x3ea8b2[0x0],'timeout':_0x3ea8b2[0x1]};var _0x597579=queue[_0xb7e0('0x40')](_0x984ec9,{'typecast':!![]});if(_0x597579[_0xb7e0('0x41')]){logger['error'](_0xb7e0('0x42'),_0x5c9e5f,_[_0xb7e0('0x43')](_0x597579,'message')[_0xb7e0('0x44')](',\x20'));_0x518f0d[_0xb7e0('0x45')]();}else{var _0x478d37=_[_0xb7e0('0x46')](_0x7db347[_0x1edccf[_0xb7e0('0x2a')]+_0xb7e0('0x47')],handleFindQueue(_0x984ec9['name']));if(_0x478d37){startRouting(_0x5c9e5f,_0x478d37,_0x1edccf,_0x7db347);var _0x30d6b7=(_0x478d37['timeout']||0xa)*0x3e8;var _0x511673=(_0x984ec9[_0xb7e0('0x48')]||0x14)*0x3e8;var _0x2876de;if(_0x30d6b7>_0x511673){_0x511673=_0x30d6b7;}var _0x2c605=seqqueue['createQueue'](_0x30d6b7);_0x2c605['id']=_0x5c9e5f;_0x2c605[_0xb7e0('0x49')]=_0x30d6b7;_0x2c605[_0xb7e0('0x4a')]=_0x511673;_0x2c605[_0xb7e0('0x2a')]=_0x1edccf['channel'];_0x7db347['rules'][_0x5c9e5f]['on'](_0xb7e0('0x4b'),function(){logger['info'](_0xb7e0('0x4c'),_0x5c9e5f);stopRouting(_0x5c9e5f,_0x478d37,_0x1edccf,_0x7db347);clearTimeout(_0x2876de);_0x2876de=undefined;_0x2c605[_0xb7e0('0x4d')](!![]);if(_0x7db347[_0xb7e0('0x4e')][_0x5c9e5f]){delete _0x7db347[_0xb7e0('0x4e')][_0x5c9e5f];}_0x518f0d['stop']();});_0x7db347[_0xb7e0('0x4e')][_0x5c9e5f]['on'](_0xb7e0('0x4f'),function(){if(_0x7db347['rules'][_0x5c9e5f]){delete _0x7db347[_0xb7e0('0x4e')][_0x5c9e5f];}});_0x2876de=setTimeout(function(){logger[_0xb7e0('0x31')](_0xb7e0('0x50'),_0x5c9e5f);endRouting(_0x5c9e5f,_0x478d37,_0x1edccf,_0x7db347);clearTimeout(_0x2876de);_0x2c605['close'](!![]);_0x518f0d[_0xb7e0('0x51')]();},_0x511673);switch(_0x478d37['strategy']){case _0xb7e0('0x52'):strategy[_0xb7e0('0x52')](_0x2c605,_0x478d37,_0x7db347,_0x1edccf);break;default:strategy[_0xb7e0('0x53')](_0x2c605,_0x478d37,_0x7db347,_0x1edccf);}}else{logger[_0xb7e0('0x37')](_0xb7e0('0x54'),_0x5c9e5f,_0x984ec9['name']);_0x518f0d[_0xb7e0('0x45')]();}}}catch(_0x3dede2){logger['error']('[%s][QUEUE]\x20%s',_0x5c9e5f,_0x3dede2[_0xb7e0('0x55')]);_0x518f0d[_0xb7e0('0x45')]();}};}; \ 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 27a6524..a13f6ae 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 _0x425d=['[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x425d,0x1e0));var _0xd425=function(_0x3aac69,_0x81d09f){_0x3aac69=_0x3aac69-0x0;var _0x38d35b=_0x425d[_0x3aac69];return _0x38d35b;};'use strict';var _=require(_0xd425('0x0'));var uuid=require('uuid');var util=require(_0xd425('0x1'));var logger=require(_0xd425('0x2'))(_0xd425('0x3'));var Agent=function(_0x97e370,_0x183caa,_0x44ba48,_0x47043f){this['notificationId']=uuid['v4']();this[_0xd425('0x4')]=_0x97e370;this[_0xd425('0x5')]=_0x183caa;this[_0xd425('0x6')]=_0x44ba48;this[_0xd425('0x3')]=_0x47043f;this[_0xd425('0x4')][_0xd425('0x7')](this['handleRun'][_0xd425('0x8')](this),this[_0xd425('0x9')][_0xd425('0x8')](this));this[_0xd425('0x4')]['on'](_0xd425('0xa'),this[_0xd425('0x9')][_0xd425('0x8')](this));this[_0xd425('0x4')]['on'](_0xd425('0xb'),this[_0xd425('0xc')][_0xd425('0x8')](this));};Agent[_0xd425('0xd')][_0xd425('0x7')]=function(){this[_0xd425('0x4')][_0xd425('0x7')](this[_0xd425('0xe')][_0xd425('0x8')](this),this[_0xd425('0x9')][_0xd425('0x8')](this));};Agent[_0xd425('0xd')]['handleDrained']=function(){this[_0xd425('0x9')](!![]);};Agent[_0xd425('0xd')][_0xd425('0xe')]=function(){logger['debug'](_0xd425('0xf'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);if(_[_0xd425('0x10')](this[_0xd425('0x6')]['agents'][this[_0xd425('0x5')]['id']])){logger[_0xd425('0x11')](_0xd425('0x12'),this[_0xd425('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xd425('0x7')][_0xd425('0x8')](this),0x3e8);}else{if(this[_0xd425('0x3')][_0xd425('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime']['agents'][this[_0xd425('0x5')]['id']],this[_0xd425('0x4')][_0xd425('0x14')],![])){this['realtime'][_0xd425('0x15')][this[_0xd425('0x5')]['id']]['busy']=!![];this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']][_0xd425('0x16')]=undefined;util[_0xd425('0x17')](this[_0xd425('0x6')],this[_0xd425('0x3')],this[_0xd425('0x5')],this[_0xd425('0x4')][_0xd425('0x14')]);util[_0xd425('0x18')](this[_0xd425('0x19')],this['squeue']['id'],this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']],null,this[_0xd425('0x3')]);util[_0xd425('0x1a')](this[_0xd425('0x4')]['id'],this[_0xd425('0x6')]['agents'][this[_0xd425('0x5')]['id']],_0xd425('0x1b')+(this[_0xd425('0x3')]['forcedOwnership']?_0xd425('0x1c'):''));}else{logger[_0xd425('0x11')](_0xd425('0x1d'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);setTimeout(this[_0xd425('0x7')][_0xd425('0x8')](this),0x3e8);}}};Agent[_0xd425('0xd')][_0xd425('0x9')]=function(_0x1cac61){if(_['isNil'](this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']])){return logger[_0xd425('0x11')](_0xd425('0x12'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);}else{logger[_0xd425('0x11')](_0xd425('0x1e'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);util['hideNotification'](this[_0xd425('0x19')],this[_0xd425('0x4')]['id'],this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']],null,this['routing']);this[_0xd425('0x6')][_0xd425('0x15')][this['agent']['id']]['busy']=![];this['realtime'][_0xd425('0x15')][this[_0xd425('0x5')]['id']][_0xd425('0x16')]=undefined;util[_0xd425('0x1f')](this['realtime'],this[_0xd425('0x3')],this[_0xd425('0x5')],this[_0xd425('0x4')][_0xd425('0x14')]);util[_0xd425('0x1a')](this[_0xd425('0x4')]['id'],this[_0xd425('0x6')]['agents'][this[_0xd425('0x5')]['id']],_0x1cac61?'STOP':_0xd425('0x20'));}if(!_0x1cac61){setTimeout(this[_0xd425('0x7')][_0xd425('0x8')](this),0x3e8);}};function agent(_0x4ef4ab,_0x3ccbed,_0x26806c,_0xbbb05f){return new Agent(_0x4ef4ab,_0x3ccbed,_0x26806c,_0xbbb05f);}module[_0xd425('0x21')]=agent; \ No newline at end of file +var _0x57d4=['[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busy','showNotification','RINGING','handleTimeout','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','debug'];(function(_0x2148c5,_0x275446){var _0x3cbb05=function(_0x4ba07b){while(--_0x4ba07b){_0x2148c5['push'](_0x2148c5['shift']());}};_0x3cbb05(++_0x275446);}(_0x57d4,0x78));var _0x457d=function(_0x529022,_0x47c4dd){_0x529022=_0x529022-0x0;var _0x1c2650=_0x57d4[_0x529022];return _0x1c2650;};'use strict';var _=require(_0x457d('0x0'));var uuid=require(_0x457d('0x1'));var util=require('./util');var logger=require(_0x457d('0x2'))(_0x457d('0x3'));var Agent=function(_0x1e26ab,_0x30a25c,_0x1219e1,_0x3c89b2){this[_0x457d('0x4')]=uuid['v4']();this[_0x457d('0x5')]=_0x1e26ab;this[_0x457d('0x6')]=_0x30a25c;this[_0x457d('0x7')]=_0x1219e1;this[_0x457d('0x3')]=_0x3c89b2;this['squeue'][_0x457d('0x8')](this[_0x457d('0x9')]['bind'](this),this['handleTimeout'][_0x457d('0xa')](this));this[_0x457d('0x5')]['on'](_0x457d('0xb'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x457d('0xc'),this[_0x457d('0xd')][_0x457d('0xa')](this));};Agent[_0x457d('0xe')][_0x457d('0x8')]=function(){this[_0x457d('0x5')][_0x457d('0x8')](this[_0x457d('0x9')][_0x457d('0xa')](this),this['handleTimeout'][_0x457d('0xa')](this));};Agent[_0x457d('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x457d('0xe')][_0x457d('0x9')]=function(){logger[_0x457d('0xf')](_0x457d('0x10'),this[_0x457d('0x5')]['id'],this[_0x457d('0x6')]['id']);if(_[_0x457d('0x11')](this[_0x457d('0x7')]['agents'][this[_0x457d('0x6')]['id']])){logger[_0x457d('0xf')](_0x457d('0x12'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x457d('0x8')]['bind'](this),0x3e8);}else{if(this[_0x457d('0x3')][_0x457d('0x13')]||util['isAgentAvailable'](this[_0x457d('0x5')]['id'],this['realtime']['agents'][this[_0x457d('0x6')]['id']],this[_0x457d('0x5')][_0x457d('0x14')],![])){this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']][_0x457d('0x16')]=!![];this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x457d('0x3')],this['agent'],this['squeue']['channel']);util[_0x457d('0x17')](this[_0x457d('0x4')],this['squeue']['id'],this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']],null,this[_0x457d('0x3')]);util['writeLog'](this['squeue']['id'],this[_0x457d('0x7')]['agents'][this[_0x457d('0x6')]['id']],_0x457d('0x18')+(this[_0x457d('0x3')][_0x457d('0x13')]?':FORCED':''));}else{logger[_0x457d('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x457d('0x6')]['id']);setTimeout(this[_0x457d('0x8')]['bind'](this),0x3e8);}}};Agent[_0x457d('0xe')][_0x457d('0x19')]=function(_0x5b5b31){if(_[_0x457d('0x11')](this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']])){return logger[_0x457d('0xf')](_0x457d('0x12'),this[_0x457d('0x5')]['id'],this[_0x457d('0x6')]['id']);}else{logger[_0x457d('0xf')](_0x457d('0x1a'),this[_0x457d('0x5')]['id'],this[_0x457d('0x6')]['id']);util[_0x457d('0x1b')](this[_0x457d('0x4')],this[_0x457d('0x5')]['id'],this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']],null,this['routing']);this[_0x457d('0x7')][_0x457d('0x15')][this['agent']['id']]['busy']=![];this[_0x457d('0x7')][_0x457d('0x15')][this['agent']['id']][_0x457d('0x1c')]=undefined;util[_0x457d('0x1d')](this[_0x457d('0x7')],this[_0x457d('0x3')],this[_0x457d('0x6')],this[_0x457d('0x5')][_0x457d('0x14')]);util[_0x457d('0x1e')](this[_0x457d('0x5')]['id'],this[_0x457d('0x7')][_0x457d('0x15')][this[_0x457d('0x6')]['id']],_0x5b5b31?_0x457d('0x1f'):_0x457d('0x20'));}if(!_0x5b5b31){setTimeout(this[_0x457d('0x8')]['bind'](this),0x3e8);}};function agent(_0x27811b,_0x4a4cea,_0x5a3db2,_0x482f74){return new Agent(_0x27811b,_0x4a4cea,_0x5a3db2,_0x482f74);}module[_0x457d('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 5653c73..e801e26 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 _0x8ec7=['showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','removeWaitingNotification','lodash','uuid','routing','notificationId','queue','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','agents','RINGING','busy','busyQueue','name'];(function(_0x11e608,_0x55723e){var _0x2326d5=function(_0xbf08e8){while(--_0xbf08e8){_0x11e608['push'](_0x11e608['shift']());}};_0x2326d5(++_0x55723e);}(_0x8ec7,0x8e));var _0x78ec=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0x8ec7[_0x65d12e];return _0x4274e0;};'use strict';var _=require(_0x78ec('0x0'));var uuid=require(_0x78ec('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x78ec('0x2'));var Beepall=function(_0x2a9df8,_0x298e4d,_0x62d12a,_0x3a1607){this[_0x78ec('0x3')]=uuid['v4']();this['squeue']=_0x2a9df8;this[_0x78ec('0x4')]=_0x298e4d;this['realtime']=_0x62d12a;this[_0x78ec('0x2')]=_0x3a1607;this[_0x78ec('0x5')][_0x78ec('0x6')](this[_0x78ec('0x7')][_0x78ec('0x8')](this),this[_0x78ec('0x9')][_0x78ec('0x8')](this));this['squeue']['on'](_0x78ec('0xa'),this[_0x78ec('0x9')]['bind'](this));this[_0x78ec('0x5')]['on'](_0x78ec('0xb'),this[_0x78ec('0xc')][_0x78ec('0x8')](this));};Beepall[_0x78ec('0xd')][_0x78ec('0x6')]=function(){this[_0x78ec('0x5')][_0x78ec('0x6')](this[_0x78ec('0x7')][_0x78ec('0x8')](this),this[_0x78ec('0x9')][_0x78ec('0x8')](this));};Beepall[_0x78ec('0xd')][_0x78ec('0xc')]=function(){this[_0x78ec('0x9')](!![]);};Beepall[_0x78ec('0xd')][_0x78ec('0x7')]=function(){var _0x4e1a0e=!![];if(!_['isNil'](this[_0x78ec('0x4')])&&!_[_0x78ec('0xe')](this['queue'][_0x78ec('0xf')])&&this[_0x78ec('0x4')][_0x78ec('0xf')][_0x78ec('0x10')]>0x0){for(var _0x19fc3d=0x0,_0x1ff08e;_0x19fc3d0x0){for(var _0x2c0448=0x0,_0x1c3338;_0x2c04480x0&&_0x1f3bd9[_0x52d07d+_0x2bff('0x23')]>=_0x1f3bd9[_0x52d07d+_0x2bff('0x22')]){writeLog(_0x247fe1,_0x1f3bd9,_0x52d07d[_0x2bff('0x24')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x29062d,_0x314717,_0x4c6a91,_0x170a8f,_0x52768a){return sendNotification(!![],_0x29062d,_0x314717,_0x4c6a91,_0x170a8f,_0x52768a);};exports[_0x2bff('0x25')]=function(_0x59147b,_0x23dcd6,_0x235523,_0x551a59,_0x44c538){return sendNotification(![],_0x59147b,_0x23dcd6,_0x235523,_0x551a59,_0x44c538);};exports[_0x2bff('0x26')]=function(_0x327a0f,_0x3490a2,_0x2204ad){var _0x354d1c=_0x3490a2['interaction']['UserId'];if(!_0x354d1c&&_0x2204ad){_0x354d1c=_0x2204ad['id'];}var _0x5e8c69=_[_0x2bff('0x27')](_0x327a0f[_0x3490a2[_0x2bff('0x28')]+_0x2bff('0x29')],function(_0x35eaf2){var _0x3558e4=_['capitalize'](_0x3490a2['channel'])+'InteractionId';return _0x35eaf2[_0x3558e4]===_0x3490a2[_0x2bff('0x2a')]['id'];});if(!_0x5e8c69&&_0x354d1c&&_0x327a0f['agents'][_0x354d1c]){_0x5e8c69=_['some'](_0x327a0f['agents'][_0x354d1c][_0x3490a2[_0x2bff('0x28')]+_0x2bff('0x2b')],function(_0x339156){return _0x339156['id']===_0x3490a2[_0x2bff('0x2a')]['id'];});}return _0x5e8c69;};exports[_0x2bff('0x2c')]=function(_0x2f74c4,_0xee38f5,_0x33fa97,_0x15c418){if(_0x33fa97&&_0x33fa97['id']&&_0x2f74c4[_0x2bff('0x2d')]&&_0x2f74c4[_0x2bff('0x2d')][_0x33fa97['id']]){_0x2f74c4[_0x2bff('0x2d')][_0x33fa97['id']][_0x15c418+_0x2bff('0x2b')][_0xee38f5[_0x2bff('0x16')]['id']]={'id':_0xee38f5['interaction']['id']};}};exports[_0x2bff('0x2e')]=function(_0x17657c,_0x423e40,_0x4c4fb4,_0x3ec81a){if(_0x4c4fb4&&_0x4c4fb4['id']&&_0x17657c['agents']&&_0x17657c[_0x2bff('0x2d')][_0x4c4fb4['id']]){delete _0x17657c[_0x2bff('0x2d')][_0x4c4fb4['id']][_0x3ec81a+_0x2bff('0x2b')][_0x423e40[_0x2bff('0x16')]['id']];}};exports[_0x2bff('0x2f')]=writeLog; \ No newline at end of file +var _0x4343=['../../../../../config/environment','../../../../../config/logger','redis','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','InteractionId','agents','WaitingInteractions','saveWaitingNotification','lodash','../utils'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0x4343,0x1ae));var _0x3434=function(_0x23f1a7,_0x207ce1){_0x23f1a7=_0x23f1a7-0x0;var _0x1fff79=_0x4343[_0x23f1a7];return _0x1fff79;};'use strict';var _=require(_0x3434('0x0'));var util=require('util');var utils=require(_0x3434('0x1'));var Redis=require('ioredis');var config=require(_0x3434('0x2'));var logger=require(_0x3434('0x3'))('routing');config[_0x3434('0x4')]=_['defaults'](config[_0x3434('0x4')],{'host':_0x3434('0x5'),'port':0x18eb});var io=require(_0x3434('0x6'))(new Redis(config[_0x3434('0x4')]));function sendNotification(_0x25dc89,_0x34b8c9,_0x1e1901,_0x427b4a,_0xa41e79,_0x5c99b3){var _0x9d1e6b=_0x5c99b3||{};var _0x3317d8=_0x1e1901[_0x3434('0x7')]('.');var _0x3b7dcd={'uniqueid':_0x34b8c9,'channel':_0x3317d8[0x0],'id':_0x3317d8[0x1],'title':_0x3317d8[0x0]+_0x3434('0x8'),'interactionId':_0x3317d8[0x2],'queue':_0xa41e79?_0xa41e79[_0x3434('0x9')]:null,'sound':_0x9d1e6b[_0x3434('0xa')]['notificationSound'],'shake':_0x9d1e6b[_0x3434('0xa')][_0x3434('0xb')]};try{if(!_0x9d1e6b[_0x3434('0xc')]){_0x9d1e6b[_0x3434('0xc')]={};}if(_0xa41e79){_0x9d1e6b['body'][_0x3434('0xd')]=_0xa41e79;}else if(_0x9d1e6b[_0x3434('0xc')][_0x3434('0xd')]){delete _0x9d1e6b[_0x3434('0xc')][_0x3434('0xd')];}_0x3b7dcd[_0x3434('0xe')]=utils[_0x3434('0xf')](_0x9d1e6b[_0x3434('0xa')]['notificationTemplate'],_0x9d1e6b);}catch(_0x2de786){_0x3b7dcd[_0x3434('0xe')]=_0x3434('0x10');logger['error'](util[_0x3434('0x11')](_0x3434('0x12'),_0x34b8c9,_0x2de786[_0x3434('0x13')]));}io['to'](util[_0x3434('0x11')](_0x3434('0x14'),_0x427b4a[_0x3434('0x9')]))[_0x3434('0x15')](util[_0x3434('0x11')](_0x3434('0x16'),_0x25dc89?'save':'remove'),_0x3b7dcd);}function writeLog(_0x153951,_0x191877,_0x45af5d){return logger[_0x3434('0x17')](util[_0x3434('0x11')](_0x3434('0x18'),_0x153951,_0x191877[_0x3434('0x9')],_0x45af5d));}exports[_0x3434('0x19')]=function(_0x517989,_0x6f8fe7,_0x140b96,_0x3fcbc1){if(_0x6f8fe7[_0x3434('0x1a')]){writeLog(_0x517989,_0x6f8fe7,_0x3434('0x1b'));return![];}if(!_0x6f8fe7[_0x3434('0x1c')]){writeLog(_0x517989,_0x6f8fe7,_0x3434('0x1d'));return![];}if(_0x6f8fe7[_0x140b96+'Pause']){writeLog(_0x517989,_0x6f8fe7,_0x3434('0x1e'));return![];}if(_0x3fcbc1&&_0x6f8fe7[_0x3434('0x1f')](_0x140b96+_0x3434('0x20'))&&_0x6f8fe7[_0x3434('0x1f')](_0x140b96+_0x3434('0x21'))){if(_0x6f8fe7[_0x140b96+'Capacity']>0x0&&_0x6f8fe7[_0x140b96+'CurrentCapacity']>=_0x6f8fe7[_0x140b96+_0x3434('0x20')]){writeLog(_0x517989,_0x6f8fe7,_0x140b96[_0x3434('0x22')]()+_0x3434('0x23'));return![];}}return!![];};exports[_0x3434('0x24')]=function(_0x526951,_0x47a217,_0x2fe7dd,_0x57812c,_0x1a697d){return sendNotification(!![],_0x526951,_0x47a217,_0x2fe7dd,_0x57812c,_0x1a697d);};exports[_0x3434('0x25')]=function(_0x534ba8,_0x3dc269,_0x2015a0,_0x115606,_0x232ae4){return sendNotification(![],_0x534ba8,_0x3dc269,_0x2015a0,_0x115606,_0x232ae4);};exports[_0x3434('0x26')]=function(_0x181a01,_0x35d5b2,_0x50421b){var _0x304825=_0x35d5b2[_0x3434('0x27')][_0x3434('0x28')];if(!_0x304825&&_0x50421b){_0x304825=_0x50421b['id'];}var _0x350b33=_[_0x3434('0x29')](_0x181a01[_0x35d5b2[_0x3434('0x2a')]+_0x3434('0x2b')],function(_0x20c543){var _0x2be175=_['capitalize'](_0x35d5b2[_0x3434('0x2a')])+_0x3434('0x2c');return _0x20c543[_0x2be175]===_0x35d5b2[_0x3434('0x27')]['id'];});if(!_0x350b33&&_0x304825&&_0x181a01[_0x3434('0x2d')][_0x304825]){_0x350b33=_[_0x3434('0x29')](_0x181a01[_0x3434('0x2d')][_0x304825][_0x35d5b2[_0x3434('0x2a')]+_0x3434('0x2e')],function(_0x2288ad){return _0x2288ad['id']===_0x35d5b2[_0x3434('0x27')]['id'];});}return _0x350b33;};exports[_0x3434('0x2f')]=function(_0x5a4ecb,_0x2af465,_0x2d826a,_0x6ac46f){if(_0x2d826a&&_0x2d826a['id']&&_0x5a4ecb[_0x3434('0x2d')]&&_0x5a4ecb[_0x3434('0x2d')][_0x2d826a['id']]){_0x5a4ecb[_0x3434('0x2d')][_0x2d826a['id']][_0x6ac46f+_0x3434('0x2e')][_0x2af465[_0x3434('0x13')]['id']]={'id':_0x2af465['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x4b2aea,_0x1d6d07,_0x4e70b3,_0x4ef592){if(_0x4e70b3&&_0x4e70b3['id']&&_0x4b2aea['agents']&&_0x4b2aea[_0x3434('0x2d')][_0x4e70b3['id']]){delete _0x4b2aea[_0x3434('0x2d')][_0x4e70b3['id']][_0x4ef592+_0x3434('0x2e')][_0x1d6d07[_0x3434('0x13')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index b810ea7..e53ec94 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 _0xcd89=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec'];(function(_0x1e9d2d,_0x3f2df0){var _0x40219e=function(_0x4814f4){while(--_0x4814f4){_0x1e9d2d['push'](_0x1e9d2d['shift']());}};_0x40219e(++_0x3f2df0);}(_0xcd89,0xe1));var _0x9cd8=function(_0x30ea33,_0x5b13da){_0x30ea33=_0x30ea33-0x0;var _0x57679b=_0xcd89[_0x30ea33];return _0x57679b;};'use strict';var schema=require(_0x9cd8('0x0'));var sh=require(_0x9cd8('0x1'));var _=require(_0x9cd8('0x2'));var utils=require(_0x9cd8('0x3'));var logger=require(_0x9cd8('0x4'))('routing');var system=schema({'command':{'type':_0x9cd8('0x5'),'required':!![],'message':_0x9cd8('0x6')}});exports['consequence']=function(_0x2b5a82,_0x49a1a3){return function(_0x1c448d){try{var _0x11b931={'command':_0x49a1a3[0x0]};var _0x43650e=system[_0x9cd8('0x0')](_0x11b931,{'typecast':!![]});if(_0x43650e[_0x9cd8('0x7')]){logger[_0x9cd8('0x8')](_0x9cd8('0x9'),_0x2b5a82,_['map'](_0x43650e,'message')[_0x9cd8('0xa')](',\x20'));logger[_0x9cd8('0xb')](_0x9cd8('0xc'),_0x2b5a82);_0x1c448d[_0x9cd8('0xd')]();}else{var _0x2a6115=this;var _0x1d93ab=utils['getMustacheRender'](_0x49a1a3[0x0],this);logger[_0x9cd8('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2b5a82,_0x1d93ab);sh[_0x9cd8('0xe')](_['trim'](_0x1d93ab),function(_0x4adad9,_0x108d6b){logger[_0x9cd8('0xb')](_0x9cd8('0xf'),_0x2b5a82,_0x4adad9);if(_0x4adad9==0x0){var _0x425cef=_0x108d6b[_0x9cd8('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x49a1a3[0x1])||_['isEmpty'](_0x49a1a3[0x1])){logger['info'](_0x9cd8('0x11'),_0x2b5a82);_0x2a6115[_0x9cd8('0x12')][_0x49a1a3[0x1]]=_0x425cef;}else{logger[_0x9cd8('0xb')](_0x9cd8('0x13'),_0x2b5a82,_0x49a1a3[0x1],_0x425cef);_0x2a6115[_0x9cd8('0x12')][_0x49a1a3[0x1]]=_0x425cef;}}_0x1c448d[_0x9cd8('0xd')]();});}}catch(_0x1169f9){logger[_0x9cd8('0x8')](_0x9cd8('0x9'),_0x2b5a82,_['isObject'](_0x1169f9)?JSON['stringify'](_0x1169f9):_0x1169f9);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2b5a82);_0x1c448d[_0x9cd8('0xd')]();}};}; \ No newline at end of file +var _0x6315=['map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','validate','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s'];(function(_0x377945,_0x217133){var _0x53d744=function(_0x3ef4b4){while(--_0x3ef4b4){_0x377945['push'](_0x377945['shift']());}};_0x53d744(++_0x217133);}(_0x6315,0xc7));var _0x5631=function(_0x58abeb,_0x30a3b8){_0x58abeb=_0x58abeb-0x0;var _0x143764=_0x6315[_0x58abeb];return _0x143764;};'use strict';var schema=require(_0x5631('0x0'));var sh=require('shelljs');var _=require(_0x5631('0x1'));var utils=require(_0x5631('0x2'));var logger=require(_0x5631('0x3'))(_0x5631('0x4'));var system=schema({'command':{'type':_0x5631('0x5'),'required':!![],'message':_0x5631('0x6')}});exports[_0x5631('0x7')]=function(_0x3c7c23,_0x4815a6){return function(_0x530bf4){try{var _0x45eb22={'command':_0x4815a6[0x0]};var _0x6628aa=system[_0x5631('0x0')](_0x45eb22,{'typecast':!![]});if(_0x6628aa['length']){logger['error'](_0x5631('0x8'),_0x3c7c23,_[_0x5631('0x9')](_0x6628aa,_0x5631('0xa'))[_0x5631('0xb')](',\x20'));logger['info'](_0x5631('0xc'),_0x3c7c23);_0x530bf4[_0x5631('0xd')]();}else{var _0x2f97ea=this;var _0x3da781=utils[_0x5631('0xe')](_0x4815a6[0x0],this);logger[_0x5631('0xf')](_0x5631('0x10'),_0x3c7c23,_0x3da781);sh[_0x5631('0x11')](_[_0x5631('0x12')](_0x3da781),function(_0x362cd8,_0x1d4d6b){logger[_0x5631('0xf')](_0x5631('0x13'),_0x3c7c23,_0x362cd8);if(_0x362cd8==0x0){var _0x4a7ba3=_0x1d4d6b['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x5631('0x14')](_0x4815a6[0x1])||_[_0x5631('0x15')](_0x4815a6[0x1])){logger[_0x5631('0xf')](_0x5631('0x16'),_0x3c7c23);_0x2f97ea[_0x5631('0x17')][_0x4815a6[0x1]]=_0x4a7ba3;}else{logger[_0x5631('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3c7c23,_0x4815a6[0x1],_0x4a7ba3);_0x2f97ea[_0x5631('0x17')][_0x4815a6[0x1]]=_0x4a7ba3;}}_0x530bf4[_0x5631('0xd')]();});}}catch(_0x3f1579){logger[_0x5631('0x18')](_0x5631('0x8'),_0x3c7c23,_[_0x5631('0x19')](_0x3f1579)?JSON['stringify'](_0x3f1579):_0x3f1579);logger[_0x5631('0xf')](_0x5631('0xc'),_0x3c7c23);_0x530bf4[_0x5631('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 82e01ee..49fc0cd 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 _0x0ca1=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0ca1,0x64));var _0x10ca=function(_0x552c74,_0xc63b1c){_0x552c74=_0x552c74-0x0;var _0x484071=_0x0ca1[_0x552c74];return _0x484071;};'use strict';var schema=require('validate');var _=require(_0x10ca('0x0'));var rpc={'chatInteraction':require(_0x10ca('0x1')),'openchannelInteraction':require(_0x10ca('0x2')),'smsInteraction':require(_0x10ca('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x10ca('0x4')),'whatsappInteraction':require(_0x10ca('0x5'))};var logger=require(_0x10ca('0x6'))('routing');var tag=schema({'tag':{'type':_0x10ca('0x7'),'required':!![],'message':_0x10ca('0x8')}});exports[_0x10ca('0x9')]=function(_0x5aa447,_0x207021,_0x593137,_0x11c36f){return function(_0x29ddcc){try{var _0x13e22e={'tag':_0x207021[0x0]};var _0x2bf6c3=tag[_0x10ca('0xa')](_0x13e22e,{'typecast':!![]});if(_0x2bf6c3['length']){logger[_0x10ca('0xb')](_0x10ca('0xc'),_0x5aa447,_[_0x10ca('0xd')](_0x2bf6c3,'message')['join'](',\x20'));logger[_0x10ca('0xe')](_0x10ca('0xf'),_0x5aa447);_0x29ddcc[_0x10ca('0x10')]();}else{var _0x249568={'ids':[_0x207021[0x0]]};if(rpc[_0x11c36f[_0x10ca('0x11')]+_0x10ca('0x12')]){rpc[_0x11c36f['channel']+_0x10ca('0x12')]['addTags'](_0x11c36f[_0x10ca('0x13')]['id'],_0x249568)[_0x10ca('0x14')](function(_0x441f5c){logger[_0x10ca('0xe')](_0x10ca('0x15'),_0x5aa447,_0x207021[0x1],_0x11c36f['channel'],_0x11c36f[_0x10ca('0x13')]['id']);})['catch'](function(_0x4afa1c){logger['error'](_0x10ca('0xc'),_0x5aa447,JSON[_0x10ca('0x16')](_0x4afa1c));logger['info'](_0x10ca('0xf'),_0x5aa447);})['finally'](function(){_0x29ddcc[_0x10ca('0x10')]();});}}}catch(_0x3a7a9c){logger['error']('[%s][TAG]\x20%s',_0x5aa447,_[_0x10ca('0x17')](_0x3a7a9c)?JSON['stringify'](_0x3a7a9c):_0x3a7a9c);logger[_0x10ca('0xe')](_0x10ca('0xf'),_0x5aa447);_0x29ddcc['next']();}};}; \ No newline at end of file +var _0x1d26=['consequence','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1d26,0x117));var _0x61d2=function(_0x291276,_0x5a4690){_0x291276=_0x291276-0x0;var _0x303ab3=_0x1d26[_0x291276];return _0x303ab3;};'use strict';var schema=require(_0x61d2('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x61d2('0x1')),'openchannelInteraction':require(_0x61d2('0x2')),'smsInteraction':require(_0x61d2('0x3')),'mailInteraction':require(_0x61d2('0x4')),'faxInteraction':require(_0x61d2('0x5')),'whatsappInteraction':require(_0x61d2('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x61d2('0x7')]=function(_0x5440be,_0x665bbd,_0x48beb7,_0x4b25e9){return function(_0x45e97d){try{var _0x1f34aa={'tag':_0x665bbd[0x0]};var _0x1896fa=tag[_0x61d2('0x0')](_0x1f34aa,{'typecast':!![]});if(_0x1896fa['length']){logger['error'](_0x61d2('0x8'),_0x5440be,_[_0x61d2('0x9')](_0x1896fa,_0x61d2('0xa'))[_0x61d2('0xb')](',\x20'));logger[_0x61d2('0xc')](_0x61d2('0xd'),_0x5440be);_0x45e97d['next']();}else{var _0x4c6e4d={'ids':[_0x665bbd[0x0]]};if(rpc[_0x4b25e9[_0x61d2('0xe')]+_0x61d2('0xf')]){rpc[_0x4b25e9[_0x61d2('0xe')]+_0x61d2('0xf')][_0x61d2('0x10')](_0x4b25e9[_0x61d2('0x11')]['id'],_0x4c6e4d)[_0x61d2('0x12')](function(_0x337ace){logger['info'](_0x61d2('0x13'),_0x5440be,_0x665bbd[0x1],_0x4b25e9[_0x61d2('0xe')],_0x4b25e9[_0x61d2('0x11')]['id']);})[_0x61d2('0x14')](function(_0x277156){logger[_0x61d2('0x15')](_0x61d2('0x8'),_0x5440be,JSON[_0x61d2('0x16')](_0x277156));logger[_0x61d2('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5440be);})[_0x61d2('0x17')](function(){_0x45e97d[_0x61d2('0x18')]();});}}}catch(_0x91ee62){logger['error'](_0x61d2('0x8'),_0x5440be,_[_0x61d2('0x19')](_0x91ee62)?JSON[_0x61d2('0x16')](_0x91ee62):_0x91ee62);logger[_0x61d2('0xc')](_0x61d2('0xd'),_0x5440be);_0x45e97d[_0x61d2('0x18')]();}};}; \ 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 10169ae..033f3ec 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 _0x93da=['&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','title','2.0','login','params','stringify','utf8','POST','application/json-rpc','then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId='];(function(_0x59f288,_0x54aef3){var _0x3d968b=function(_0x33b025){while(--_0x33b025){_0x59f288['push'](_0x59f288['shift']());}};_0x3d968b(++_0x54aef3);}(_0x93da,0x92));var _0xa93d=function(_0x19c535,_0x2ad2b5){_0x19c535=_0x19c535-0x0;var _0x282e28=_0x93da[_0x19c535];return _0x282e28;};'use strict';var rp=require(_0xa93d('0x0'));var logger=require('../../../../config/logger')(_0xa93d('0x1'));var _=require(_0xa93d('0x2'));var arr=[];exports[_0xa93d('0x3')]=function(_0x377ea4,_0x4d7413){return function(_0x541603){var _0x5ef77f=_0x4d7413[0xa];var _0x1130ed=_0x4d7413[0xb];var _0x2a0dbb=_0x4d7413[0xc];var _0x101fc0=_0x4d7413[0xd];var _0x425437=_0x4d7413[0xe];var _0x179156=_0x4d7413[0xf][_0xa93d('0x4')](/\n/g,_0xa93d('0x5'));var _0x54f9c8=_0x4d7413[0x10][_0xa93d('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x1130ed)){arr[_0xa93d('0x6')](_0x1130ed);var _0x58381c=_0x4d7413[0x3];var _0x18b853=_0x4d7413[0x4];var _0x81053e=_0x4d7413[0x1];var _0x2baf3b=_0x4d7413[0x0];var _0x5ac02c={};_0x5ac02c[_0xa93d('0x7')]=_0x4d7413[0x8]+_0xa93d('0x8')+_0x2a0dbb+'|'+_0x5ef77f+'|'+_0x101fc0+'|'+_0x1130ed+'|'+_0x425437;_0x5ac02c[_0xa93d('0x9')]=_0x4d7413[0x7]+_0xa93d('0x8')+_0x2a0dbb+'|'+_0x5ef77f+'|'+_0x101fc0+'|'+_0x1130ed+'|'+_0x425437+'|'+_0x179156+'|'+_0x54f9c8;_0x5ac02c[_0xa93d('0xa')]=_0x4d7413[0x9];var _0x51a451={};_0x51a451['jsonrpc']=_0xa93d('0xb');_0x51a451['method']=_0xa93d('0xc');var _0x39d1e6=[];_0x39d1e6[_0xa93d('0x6')](_0x4d7413[0x2]);_0x39d1e6[_0xa93d('0x6')](_0x4d7413[0x5]);_0x39d1e6[_0xa93d('0x6')](_0x4d7413[0x6]);_0x51a451[_0xa93d('0xd')]=_0x39d1e6;_0x51a451['id']=0x1;var _0x3d9759=JSON[_0xa93d('0xe')](_0x51a451);var _0xebf01a={'encoding':_0xa93d('0xf'),'method':_0xa93d('0x10'),'timeout':0x2710,'url':_0x58381c,'headers':{'Content-Type':_0xa93d('0x11')},'body':_0x3d9759};return rp(_0xebf01a)[_0xa93d('0x12')](function(_0x32252d){const _0x3a5d16=JSON['parse'](_0x32252d);if(!_0x3a5d16['result'][_0xa93d('0x13')]){throw new Error(_0xa93d('0x14'));}var _0x3fb2c5=_0x1130ed;var _0x2cdf6b=_0xa93d('0x15')+_0x81053e+_0xa93d('0x16')+_0x2baf3b+_0xa93d('0x17')+_0x3fb2c5+_0xa93d('0x18')+JSON[_0xa93d('0xe')](_0x5ac02c);var _0x54124c=_0x18b853+'?'+_0x2cdf6b;return rp(_0x54124c);})[_0xa93d('0x12')](function(_0x38d0e3){logger['info'](_0xa93d('0x19'),_0x377ea4,_0x38d0e3);_0x541603[_0xa93d('0x1a')]();})[_0xa93d('0x1b')](function(_0x4a0f2d){logger[_0xa93d('0x1c')](_0xa93d('0x1d'),_0x377ea4,_[_0xa93d('0x1e')](_0x4a0f2d)?JSON[_0xa93d('0xe')](_0x4a0f2d):_0x4a0f2d);_0x541603[_0xa93d('0x1a')]();});}else{logger[_0xa93d('0x1f')](_0xa93d('0x20'),_0x377ea4);_0x541603[_0xa93d('0x21')]();}};}; \ No newline at end of file +var _0xefc0=['request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','2.0','params','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0xc731bb,_0x5891d4){var _0xfe197d=function(_0x2cd6a7){while(--_0x2cd6a7){_0xc731bb['push'](_0xc731bb['shift']());}};_0xfe197d(++_0x5891d4);}(_0xefc0,0x140));var _0x0efc=function(_0x7651ae,_0x48bca4){_0x7651ae=_0x7651ae-0x0;var _0x1d05f8=_0xefc0[_0x7651ae];return _0x1d05f8;};'use strict';var rp=require(_0x0efc('0x0'));var logger=require(_0x0efc('0x1'))(_0x0efc('0x2'));var _=require(_0x0efc('0x3'));var arr=[];exports[_0x0efc('0x4')]=function(_0x43deb0,_0x4cdaca){return function(_0xc743c8){var _0x204b76=_0x4cdaca[0xa];var _0x1d1341=_0x4cdaca[0xb];var _0x2c84fc=_0x4cdaca[0xc];var _0x8c3969=_0x4cdaca[0xd];var _0x1627b1=_0x4cdaca[0xe];var _0x5bf3cf=_0x4cdaca[0xf][_0x0efc('0x5')](/\n/g,_0x0efc('0x6'));var _0x2e871a=_0x4cdaca[0x10][_0x0efc('0x5')](/\n/g,'\x20');if(!arr[_0x0efc('0x7')](_0x1d1341)){arr[_0x0efc('0x8')](_0x1d1341);var _0x2a36b7=_0x4cdaca[0x3];var _0x39872d=_0x4cdaca[0x4];var _0x574a9d=_0x4cdaca[0x1];var _0x46e5cd=_0x4cdaca[0x0];var _0x309fe8={};_0x309fe8[_0x0efc('0x9')]=_0x4cdaca[0x8]+'?params='+_0x2c84fc+'|'+_0x204b76+'|'+_0x8c3969+'|'+_0x1d1341+'|'+_0x1627b1;_0x309fe8[_0x0efc('0xa')]=_0x4cdaca[0x7]+_0x0efc('0xb')+_0x2c84fc+'|'+_0x204b76+'|'+_0x8c3969+'|'+_0x1d1341+'|'+_0x1627b1+'|'+_0x5bf3cf+'|'+_0x2e871a;_0x309fe8[_0x0efc('0xc')]=_0x4cdaca[0x9];var _0x45a129={};_0x45a129['jsonrpc']=_0x0efc('0xd');_0x45a129['method']='login';var _0x1ffcef=[];_0x1ffcef[_0x0efc('0x8')](_0x4cdaca[0x2]);_0x1ffcef[_0x0efc('0x8')](_0x4cdaca[0x5]);_0x1ffcef[_0x0efc('0x8')](_0x4cdaca[0x6]);_0x45a129[_0x0efc('0xe')]=_0x1ffcef;_0x45a129['id']=0x1;var _0x5c6319=JSON['stringify'](_0x45a129);var _0x52a117={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x2a36b7,'headers':{'Content-Type':_0x0efc('0xf')},'body':_0x5c6319};return rp(_0x52a117)[_0x0efc('0x10')](function(_0x3e9af2){const _0x2380c8=JSON[_0x0efc('0x11')](_0x3e9af2);if(!_0x2380c8['result'][_0x0efc('0x12')]){throw new Error(_0x0efc('0x13'));}var _0x53cde7=_0x1d1341;var _0x12c721=_0x0efc('0x14')+_0x574a9d+_0x0efc('0x15')+_0x46e5cd+_0x0efc('0x16')+_0x53cde7+_0x0efc('0x17')+JSON[_0x0efc('0x18')](_0x309fe8);var _0x32c330=_0x39872d+'?'+_0x12c721;return rp(_0x32c330);})[_0x0efc('0x10')](function(_0x8d2ee9){logger[_0x0efc('0x19')](_0x0efc('0x1a'),_0x43deb0,_0x8d2ee9);_0xc743c8[_0x0efc('0x1b')]();})['catch'](function(_0x5ba183){logger[_0x0efc('0x1c')]('[%s][TVOX]\x20%s',_0x43deb0,_[_0x0efc('0x1d')](_0x5ba183)?JSON['stringify'](_0x5ba183):_0x5ba183);_0xc743c8[_0x0efc('0x1b')]();});}else{logger[_0x0efc('0x19')](_0x0efc('0x1e'),_0x43deb0);_0xc743c8[_0x0efc('0x1f')]();}};}; \ 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 d60d4ab..968b1ef 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x184000,_0x27c0ea){var _0x22e9d7=function(_0x391ce0){while(--_0x391ce0){_0x184000['push'](_0x184000['shift']());}};_0x22e9d7(++_0x27c0ea);}(_0xe706,0xa3));var _0x6e70=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xe706[_0xc6be3a];return _0x56a310;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1e83b0,_0x5a04ef){var _0x17b0f1=function(_0xa66138){while(--_0xa66138){_0x1e83b0['push'](_0x1e83b0['shift']());}};_0x17b0f1(++_0x5a04ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b1c2a4a..1e3fd31 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 _0x4c99=['whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','existsSync','join','app','.js','toLowerCase','split','mail','push','slice','length','appdata','dialogflowv2','amazonlex','tag','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','waiting','openchannelQueues','smsQueues','loggedIn','name','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0xbd016,_0x2d7656){var _0x3c409c=function(_0x5ceb32){while(--_0x5ceb32){_0xbd016['push'](_0xbd016['shift']());}};_0x3c409c(++_0x2d7656);}(_0x4c99,0x1ec));var _0x94c9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x4c99[_0x1b6186];return _0x186121;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var path=require(_0x94c9('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x94c9('0x2'));var logger=require(_0x94c9('0x3'))('routing');var rpc={'openchannelQueueReport':require(_0x94c9('0x4')),'mailQueueReport':require(_0x94c9('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x94c9('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x23d961,_0x4403ba,_0x3a1743){return util[_0x94c9('0x7')](_0x94c9('0x8'),_0x23d961,_0x4403ba||0x0,_0x3a1743||0x0);}function getIntervals(_0x1c0983,_0x13fc19){var _0x359356=[];if(!_[_0x94c9('0x9')](_0x13fc19[_0x94c9('0xa')])&&!_['isNil'](_0x1c0983[_0x13fc19[_0x94c9('0xa')]])&&!_[_0x94c9('0x9')](_0x1c0983[_0x13fc19[_0x94c9('0xa')]]['Intervals'])){_0x359356=_[_0x94c9('0xb')](_0x1c0983[_0x13fc19[_0x94c9('0xa')]][_0x94c9('0xc')],_0x94c9('0xd'));}else if(!_[_0x94c9('0x9')](_0x13fc19[_0x94c9('0xd')])){_0x359356=[_0x13fc19[_0x94c9('0xd')]];}return _0x359356;}exports[_0x94c9('0xe')]=function(_0x495654){_0x495654['rules']={};return new BPromise(function(_0x5801d3,_0x3afa3){var _0x33b735={'Start':function(_0x5249d3){var _0x210709=this;return new Promise(function(_0x3abfa5,_0x372b66){if(_0x5249d3){try{var _0x56609d=[];var _0x5db248=getId(_0x5249d3[_0x94c9('0xf')],_0x5249d3[_0x94c9('0x10')]?_0x5249d3[_0x94c9('0x10')]['id']:0x0,_0x5249d3[_0x94c9('0x11')]?_0x5249d3['interaction']['id']:0x0);var _0xb3d5d6=sUtils[_0x94c9('0x12')](_0x495654,_0x5249d3);if(_0x5249d3[_0x94c9('0x13')]||!_0xb3d5d6&&_0x5249d3[_0x94c9('0x14')]&&_[_0x94c9('0x15')](_0x5249d3[_0x94c9('0x14')])&&_0x5249d3[_0x94c9('0x14')]['length']){for(var _0x256614=0x0;_0x256614<_0x5249d3[_0x94c9('0x14')]['length'];_0x256614+=0x1){var _0x35b03c=_0x5249d3[_0x94c9('0x14')][_0x256614];if(fs[_0x94c9('0x16')](path[_0x94c9('0x17')](__dirname,_0x94c9('0x14'),_0x35b03c[_0x94c9('0x18')]+_0x94c9('0x19')))){var _0x45f33f=[];switch(_0x35b03c[_0x94c9('0x18')][_0x94c9('0x1a')]()){case'autoreply':var _0x2f20bd=_0x35b03c['appdata'][_0x94c9('0x1b')](',');if(_0x5249d3['channel']===_0x94c9('0x1c')){_0x45f33f[_0x94c9('0x1d')](_0x2f20bd[0x0]);_0x45f33f[_0x94c9('0x1d')](_0x2f20bd[0x1]);_0x45f33f[_0x94c9('0x1d')](_0x2f20bd[_0x94c9('0x1e')](0x2,_0x2f20bd[_0x94c9('0x1f')])['join'](','));}else{_0x45f33f[_0x94c9('0x1d')](_0x2f20bd[0x0]);_0x45f33f[_0x94c9('0x1d')](_0x2f20bd[_0x94c9('0x1e')](0x1,_0x2f20bd['length'])[_0x94c9('0x17')](','));}break;case'dialogflow':var _0x586b40=_0x35b03c[_0x94c9('0x20')][_0x94c9('0x1b')](',');_0x45f33f[_0x94c9('0x1d')](_0x586b40[0x0]);_0x45f33f[_0x94c9('0x1d')](_0x586b40[0x1]);_0x45f33f[_0x94c9('0x1d')](_0x586b40['slice'](0x2,_0x586b40[_0x94c9('0x1f')])[_0x94c9('0x17')](','));break;case _0x94c9('0x21'):var _0x575a3b=_0x35b03c[_0x94c9('0x20')][_0x94c9('0x1b')](',');_0x45f33f[_0x94c9('0x1d')](_0x575a3b[0x0]);_0x45f33f[_0x94c9('0x1d')](_0x575a3b[0x1]);_0x45f33f['push'](_0x575a3b[0x2]);_0x45f33f[_0x94c9('0x1d')](_0x575a3b[0x3]);_0x45f33f[_0x94c9('0x1d')](_0x575a3b['slice'](0x4,_0x575a3b[_0x94c9('0x1f')])[_0x94c9('0x17')](','));break;case _0x94c9('0x22'):var _0x3a3347=_0x35b03c[_0x94c9('0x20')][_0x94c9('0x1b')](',');_0x45f33f[_0x94c9('0x1d')](_0x3a3347[0x0]);_0x45f33f['push'](_0x3a3347[0x1]);_0x45f33f[_0x94c9('0x1d')](_0x3a3347[0x2]);_0x45f33f[_0x94c9('0x1d')](_0x3a3347[0x3]);_0x45f33f[_0x94c9('0x1d')](_0x3a3347[_0x94c9('0x1e')](0x4,_0x3a3347['length'])[_0x94c9('0x17')](','));break;case _0x94c9('0x10'):_0x45f33f['push'](_0x35b03c[_0x94c9('0x20')]);break;case _0x94c9('0x23'):_0x45f33f[_0x94c9('0x1d')](_0x35b03c['TagId']);_0x45f33f[_0x94c9('0x1d')](_0x35b03c[_0x94c9('0x20')]);break;case'tvox':var _0x3e5aee=utils['getMustacheRender'](_0x5249d3['account'][_0x94c9('0x24')],_0x5249d3);var _0x52ed35=_0x35b03c[_0x94c9('0x20')][_0x94c9('0x1b')](',');_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x0]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x1]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x2]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x3]);_0x45f33f['push'](_0x52ed35[0x4]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x5]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x6]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x7]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0x8]);_0x45f33f['push'](_0x52ed35[0x9]);_0x45f33f[_0x94c9('0x1d')](_0x52ed35[0xa]);_0x45f33f[_0x94c9('0x1d')](_0x5249d3[_0x94c9('0x11')]['id']);_0x45f33f[_0x94c9('0x1d')](_0x5249d3['message']['id']);_0x45f33f[_0x94c9('0x1d')](_0x35b03c[_0x94c9('0x25')]);_0x45f33f[_0x94c9('0x1d')](_0x5249d3['interaction'][_0x94c9('0x26')]);_0x45f33f[_0x94c9('0x1d')](_0x5249d3[_0x94c9('0x27')][_0x94c9('0x27')]);_0x45f33f[_0x94c9('0x1d')](_0x3e5aee);break;default:_0x45f33f=_[_0x94c9('0x9')](_0x35b03c[_0x94c9('0x20')])?[]:_0x35b03c[_0x94c9('0x20')][_0x94c9('0x1b')](',');}var _0x3dc269={'id':util[_0x94c9('0x7')](_0x94c9('0x28'),_0x5db248,_0x35b03c['id'],_0x35b03c[_0x94c9('0x18')]),'condition':require(_0x94c9('0x29'))[_0x94c9('0x2a')](_0x5db248,getIntervals(_0x495654[_0x94c9('0x2b')],_0x35b03c),_0x495654),'consequence':require(_0x94c9('0x2c')+_0x35b03c[_0x94c9('0x18')])[_0x94c9('0x2d')](_0x5db248,_0x45f33f,_0x495654,_0x5249d3),'p':_0x35b03c[_0x94c9('0x2e')]||0x0};logger[_0x94c9('0x2f')]('Push\x20new\x20rule',_0x3dc269['id'],_0x94c9('0x30'),getIntervals(_0x495654[_0x94c9('0x2b')],_0x35b03c)[_0x94c9('0x17')]('\x20|\x20'));_0x56609d[_0x94c9('0x1d')](_0x3dc269);}else{logger['error'](_0x94c9('0x31'),path[_0x94c9('0x17')](__dirname,_0x94c9('0x14'),_0x35b03c['app']+_0x94c9('0x19')));}}_0x495654['rules'][_0x5db248]=new RuleEngine(_0x56609d);_0x495654[_0x94c9('0x32')][_0x5db248][_0x94c9('0x33')](_0x5249d3,function(_0x2ef897){logger[_0x94c9('0x2f')](_0x94c9('0x34'),JSON[_0x94c9('0x35')](_0x2ef897['matchPath']));if(_0x495654['rules'][_0x5db248]){_0x495654['rules'][_0x5db248][_0x94c9('0x36')](_0x94c9('0x37'));}});return _0x3abfa5({'code':0xc8,'message':_0x5249d3});}else{if(_0xb3d5d6){logger[_0x94c9('0x2f')](util['format'](_0x94c9('0x38'),_0x5db248));}else{logger['info'](_0x94c9('0x39'));}return _0x3abfa5({'code':0xc8,'message':_0x5249d3});}}catch(_0x27bcd6){logger[_0x94c9('0x3a')](_0x27bcd6[_0x94c9('0x3b')]);return _0x372b66(_0x210709[_0x94c9('0x3a')](0x1f4,_0x27bcd6));}}return _0x372b66(_0x94c9('0x3c'));});},'AcceptMessage':function(_0x3b878e){var _0x52ca34=this;return new Promise(function(_0xe800ed,_0x4b68c5){if(_0x3b878e[_0x94c9('0x3d')]&&_0x3b878e[_0x94c9('0x3d')]['id']){if(_0x495654[_0x94c9('0x3e')][_0x3b878e[_0x94c9('0x3d')]['id']]){_0x495654[_0x94c9('0x3e')][_0x3b878e[_0x94c9('0x3d')]['id']][_0x94c9('0x3f')]=![];_0x495654[_0x94c9('0x3e')][_0x3b878e['agent']['id']][_0x94c9('0x40')]=undefined;}}if(_0x3b878e[_0x94c9('0x10')]&&_0x3b878e[_0x94c9('0x10')]['id']){try{var _0x14f796=getId(_0x3b878e[_0x94c9('0xf')],_0x3b878e['message']?_0x3b878e[_0x94c9('0x10')]['id']:0x0,_0x3b878e[_0x94c9('0x11')]?_0x3b878e['interaction']['id']:0x0);if(_0x495654[_0x94c9('0x32')][_0x14f796]){_0x495654['rules'][_0x14f796][_0x94c9('0x36')]('end');if(rpc[_0x3b878e['channel']+_0x94c9('0x41')]){rpc[_0x3b878e['channel']+_0x94c9('0x41')]['update'](_0x14f796,{'UserId':_0x3b878e[_0x94c9('0x10')][_0x94c9('0x42')]})[_0x94c9('0x43')](function(){logger['error'](_0x94c9('0x44'));});}}return _0xe800ed({'code':0xc8,'message':_0x3b878e});}catch(_0x26890f){logger[_0x94c9('0x3a')](_0x26890f[_0x94c9('0x3b')]);return _0x4b68c5(_0x52ca34[_0x94c9('0x3a')](0x1f4,_0x26890f));}}logger['error']('message\x20is\x20empty');return _0x4b68c5(_0x52ca34[_0x94c9('0x3a')](0x1f4,_0x94c9('0x45')));});},'RejectMessage':function(_0xd3db73){var _0x4933aa=this;return new Promise(function(_0x433b6e,_0x8cd580){if(_0xd3db73[_0x94c9('0x3d')]&&_0xd3db73['agent']['id']){try{if(_0x495654[_0x94c9('0x3e')][_0xd3db73[_0x94c9('0x3d')]['id']]){_0x495654[_0x94c9('0x3e')][_0xd3db73[_0x94c9('0x3d')]['id']][_0x94c9('0x3f')]=![];_0x495654[_0x94c9('0x3e')][_0xd3db73[_0x94c9('0x3d')]['id']][_0x94c9('0x40')]=undefined;}return _0x433b6e({'code':0xc8,'message':_0xd3db73});}catch(_0x59b2c0){logger[_0x94c9('0x3a')](_0x59b2c0[_0x94c9('0x3b')]);return _0x8cd580(_0x4933aa[_0x94c9('0x3a')](0x1f4,_0x59b2c0));}}logger['error']('message\x20is\x20empty');return _0x8cd580(_0x4933aa['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x512b12){var _0x1e36bc=this;return new Promise(function(_0x262bc1,_0x30c285){if(_0x512b12[_0x94c9('0xf')]&&_0x512b12[_0x94c9('0x11')]&&_0x512b12['interaction']['id']){try{var _0xe9cc6a=getId(_0x512b12[_0x94c9('0xf')],_0x512b12[_0x94c9('0x10')]?_0x512b12[_0x94c9('0x10')]['id']:0x0,_0x512b12[_0x94c9('0x11')]?_0x512b12['interaction']['id']:0x0);if(_0x495654['rules'][_0xe9cc6a]){_0x495654['rules'][_0xe9cc6a][_0x94c9('0x36')]('end');}return _0x262bc1({'code':0xc8,'message':_0x512b12});}catch(_0x24e5fd){logger[_0x94c9('0x3a')](_0x24e5fd[_0x94c9('0x3b')]);return _0x30c285(_0x1e36bc[_0x94c9('0x3a')](0x1f4,_0x24e5fd));}}logger['error'](_0x94c9('0x45'));return _0x30c285(_0x1e36bc[_0x94c9('0x3a')](0x1f4,_0x94c9('0x45')));});},'AgentCapacity':function(_0x33198b){var _0xbbed57=this;return new Promise(function(_0x2db4e6,_0x1c916e){if(_0x495654[_0x94c9('0x3e')][_0x94c9('0x46')](_0x33198b['id'])){for(var _0x25ae3f in _0x33198b[_0x94c9('0x47')]){if(_0x33198b[_0x94c9('0x47')][_0x94c9('0x46')](_0x25ae3f)){if(_0x495654[_0x94c9('0x3e')][_0x33198b['id']][_0x94c9('0x46')](_0x25ae3f+'CurrentCapacity')){_0x495654[_0x94c9('0x3e')][_0x33198b['id']][_0x25ae3f+_0x94c9('0x48')]=parseInt(_0x33198b[_0x94c9('0x47')][_0x25ae3f],0xa);}}}_0x495654[_0x94c9('0x3e')][_0x33198b['id']][_0x94c9('0x49')]();return _0x2db4e6({'code':0xc8,'message':_0x495654[_0x94c9('0x3e')][_0x33198b['id']]});}else{return _0x1c916e(_0xbbed57[_0x94c9('0x3a')](0x1f4,_0x94c9('0x4a')));}});},'Agents':function(_0x2208bc){return new Promise(function(_0x45864f){var _0x38bea4=_[_0x94c9('0x4b')](_0x495654[_0x94c9('0x3e')]);if(_0x2208bc&&_0x2208bc['id']){var _0x262a0b=_[_0x94c9('0x4c')](_0x38bea4,function(_0x1bf299){return _0x1bf299['id']===_0x2208bc['id'];});_0x45864f(_0x262a0b);}else{_0x45864f({'count':_0x38bea4['length'],'rows':_0x38bea4});}});},'ChatQueues':function(){return new Promise(function(_0x449592){var _0x15cfd0=[];for(var _0x3f1914 in _0x495654[_0x94c9('0x4d')]){if(_0x495654['chatQueues']['hasOwnProperty'](_0x3f1914)){var _0xdf95a6=_0x495654[_0x94c9('0x4d')][_0x3f1914];var _0x312e42={'id':_0xdf95a6['id'],'available':_0xdf95a6[_0x94c9('0x4e')],'loggedIn':_0xdf95a6['loggedIn'],'name':_0xdf95a6['name'],'paused':_0xdf95a6[_0x94c9('0x4f')],'waiting':_0xdf95a6[_0x94c9('0x50')]};_0x15cfd0[_0x94c9('0x1d')](_0x312e42);}}_0x449592({'count':_0x15cfd0[_0x94c9('0x1f')],'rows':_0x15cfd0});});},'MailQueues':function(){return new Promise(function(_0xd05cfb){var _0x450d8a=[];for(var _0x11a500 in _0x495654['mailQueues']){if(_0x495654['mailQueues'][_0x94c9('0x46')](_0x11a500)){var _0x308dbd=_0x495654['mailQueues'][_0x11a500];var _0x554117={'id':_0x308dbd['id'],'available':_0x308dbd['available'],'loggedIn':_0x308dbd['loggedIn'],'name':_0x308dbd['name'],'paused':_0x308dbd['paused'],'waiting':_0x308dbd[_0x94c9('0x50')]};_0x450d8a[_0x94c9('0x1d')](_0x554117);}}_0xd05cfb({'count':_0x450d8a[_0x94c9('0x1f')],'rows':_0x450d8a});});},'OpenchannelQueues':function(){return new Promise(function(_0x26ac9d){var _0x5dfdaa=[];for(var _0x2d0e23 in _0x495654['openchannelQueues']){if(_0x495654[_0x94c9('0x51')][_0x94c9('0x46')](_0x2d0e23)){var _0x5bf6b0=_0x495654[_0x94c9('0x51')][_0x2d0e23];var _0x2e93db={'id':_0x5bf6b0['id'],'available':_0x5bf6b0[_0x94c9('0x4e')],'loggedIn':_0x5bf6b0['loggedIn'],'name':_0x5bf6b0['name'],'paused':_0x5bf6b0[_0x94c9('0x4f')],'waiting':_0x5bf6b0[_0x94c9('0x50')]};_0x5dfdaa[_0x94c9('0x1d')](_0x2e93db);}}_0x26ac9d({'count':_0x5dfdaa['length'],'rows':_0x5dfdaa});});},'SmsQueues':function(){return new Promise(function(_0x580133){var _0x586ae1=[];for(var _0x203ebd in _0x495654['smsQueues']){if(_0x495654[_0x94c9('0x52')][_0x94c9('0x46')](_0x203ebd)){var _0x315b82=_0x495654[_0x94c9('0x52')][_0x203ebd];var _0x2c8d91={'id':_0x315b82['id'],'available':_0x315b82[_0x94c9('0x4e')],'loggedIn':_0x315b82[_0x94c9('0x53')],'name':_0x315b82[_0x94c9('0x54')],'paused':_0x315b82['paused'],'waiting':_0x315b82['waiting']};_0x586ae1[_0x94c9('0x1d')](_0x2c8d91);}}_0x580133({'count':_0x586ae1['length'],'rows':_0x586ae1});});},'FaxQueues':function(){return new Promise(function(_0x2353e6){var _0xda474b=[];for(var _0x2717c2 in _0x495654[_0x94c9('0x55')]){if(_0x495654['faxQueues']['hasOwnProperty'](_0x2717c2)){var _0x9406fd=_0x495654[_0x94c9('0x55')][_0x2717c2];var _0x4041a9={'id':_0x9406fd['id'],'available':_0x9406fd['available'],'loggedIn':_0x9406fd[_0x94c9('0x53')],'name':_0x9406fd[_0x94c9('0x54')],'paused':_0x9406fd['paused'],'waiting':_0x9406fd[_0x94c9('0x50')]};_0xda474b[_0x94c9('0x1d')](_0x4041a9);}}_0x2353e6({'count':_0xda474b['length'],'rows':_0xda474b});});},'WhatsappQueues':function(){return new Promise(function(_0x54a177){var _0x9bcf11=[];for(var _0x2714ab in _0x495654[_0x94c9('0x56')]){if(_0x495654[_0x94c9('0x56')]['hasOwnProperty'](_0x2714ab)){var _0x5b8401=_0x495654[_0x94c9('0x56')][_0x2714ab];var _0x46dd23={'id':_0x5b8401['id'],'available':_0x5b8401[_0x94c9('0x4e')],'loggedIn':_0x5b8401[_0x94c9('0x53')],'name':_0x5b8401[_0x94c9('0x54')],'paused':_0x5b8401[_0x94c9('0x4f')],'waiting':_0x5b8401[_0x94c9('0x50')]};_0x9bcf11['push'](_0x46dd23);}}_0x54a177({'count':_0x9bcf11[_0x94c9('0x1f')],'rows':_0x9bcf11});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4b159e){var _0x1e76f2=_[_0x94c9('0x4b')](_0x495654['chatQueuesWaitingInteractions']);_0x4b159e({'count':_0x1e76f2[_0x94c9('0x1f')],'rows':_0x1e76f2});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x56ca13){var _0x1441fe=_[_0x94c9('0x4b')](_0x495654['mailQueuesWaitingInteractions']);_0x56ca13({'count':_0x1441fe[_0x94c9('0x1f')],'rows':_0x1441fe});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x251013){var _0x373c04=_['values'](_0x495654[_0x94c9('0x57')]);_0x251013({'count':_0x373c04[_0x94c9('0x1f')],'rows':_0x373c04});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4dbc6f){var _0x49b8d3=_[_0x94c9('0x4b')](_0x495654[_0x94c9('0x58')]);_0x4dbc6f({'count':_0x49b8d3[_0x94c9('0x1f')],'rows':_0x49b8d3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3302ab){var _0x1adb86=_['values'](_0x495654[_0x94c9('0x59')]);_0x3302ab({'count':_0x1adb86['length'],'rows':_0x1adb86});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4c0f79){var _0x1345e9=_[_0x94c9('0x4b')](_0x495654[_0x94c9('0x5a')]);_0x4c0f79({'count':_0x1345e9['length'],'rows':_0x1345e9});});}};var _0x4dd5d7=jayson[_0x94c9('0x5b')](_0x33b735)[_0x94c9('0x5c')]();_0x4dd5d7['on'](_0x94c9('0x3a'),function(_0x4ed44d){logger[_0x94c9('0x3a')](JSON[_0x94c9('0x35')](_0x4ed44d));return _0x3afa3(_0x4ed44d);});_0x4dd5d7['listen'](0x232c,_0x94c9('0x5d'),function(){console[_0x94c9('0x5e')](_0x94c9('0x5f'),0x232c);return _0x5801d3(_0x94c9('0x60')+0x232c);});});}; \ No newline at end of file +var _0x5853=['isArray','length','existsSync','app','.js','mail','push','slice','join','dialogflow','appdata','split','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','ContactId','body','%s:%s:%s','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','error','stack','routing\x20is\x20empty','agents','agent','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','find','chatQueues','loggedIn','name','paused','openchannelQueues','available','waiting','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','checkWaitingNotifications','transfer','applications'];(function(_0x29d7fd,_0x4d4818){var _0x32546a=function(_0x2cb6cb){while(--_0x2cb6cb){_0x29d7fd['push'](_0x29d7fd['shift']());}};_0x32546a(++_0x4d4818);}(_0x5853,0x113));var _0x3585=function(_0x30f781,_0x1ce35d){_0x30f781=_0x30f781-0x0;var _0x461df7=_0x5853[_0x30f781];return _0x461df7;};'use strict';var _=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var path=require(_0x3585('0x2'));var fs=require('fs');var jayson=require(_0x3585('0x3'));var BPromise=require(_0x3585('0x4'));var utils=require('./applications/utils');var sUtils=require(_0x3585('0x5'));var logger=require(_0x3585('0x6'))(_0x3585('0x7'));var rpc={'openchannelQueueReport':require(_0x3585('0x8')),'mailQueueReport':require(_0x3585('0x9')),'chatQueueReport':require(_0x3585('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x3585('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x1a97fd,_0x5e78f3,_0x5910ab){return util[_0x3585('0xc')](_0x3585('0xd'),_0x1a97fd,_0x5e78f3||0x0,_0x5910ab||0x0);}function getIntervals(_0x2febe8,_0x2e1d23){var _0x16810e=[];if(!_[_0x3585('0xe')](_0x2e1d23['IntervalId'])&&!_[_0x3585('0xe')](_0x2febe8[_0x2e1d23[_0x3585('0xf')]])&&!_[_0x3585('0xe')](_0x2febe8[_0x2e1d23[_0x3585('0xf')]][_0x3585('0x10')])){_0x16810e=_[_0x3585('0x11')](_0x2febe8[_0x2e1d23[_0x3585('0xf')]]['Intervals'],_0x3585('0x12'));}else if(!_['isNil'](_0x2e1d23['interval'])){_0x16810e=[_0x2e1d23['interval']];}return _0x16810e;}exports['listen']=function(_0x1f9404){_0x1f9404['rules']={};return new BPromise(function(_0x16b42a,_0x1cfae3){var _0x5434ee={'Start':function(_0x27837a){var _0x3c97ae=this;return new Promise(function(_0x5e31b2,_0x366723){if(_0x27837a){try{var _0x10449b=[];var _0x43c5d7=getId(_0x27837a[_0x3585('0x13')],_0x27837a[_0x3585('0x14')]?_0x27837a['message']['id']:0x0,_0x27837a[_0x3585('0x15')]?_0x27837a['interaction']['id']:0x0);var _0x22cfec=sUtils[_0x3585('0x16')](_0x1f9404,_0x27837a);if(_0x27837a[_0x3585('0x17')]||!_0x22cfec&&_0x27837a[_0x3585('0x18')]&&_[_0x3585('0x19')](_0x27837a[_0x3585('0x18')])&&_0x27837a[_0x3585('0x18')]['length']){for(var _0x56b231=0x0;_0x56b231<_0x27837a[_0x3585('0x18')][_0x3585('0x1a')];_0x56b231+=0x1){var _0x2f3819=_0x27837a[_0x3585('0x18')][_0x56b231];if(fs[_0x3585('0x1b')](path['join'](__dirname,_0x3585('0x18'),_0x2f3819[_0x3585('0x1c')]+_0x3585('0x1d')))){var _0x2de21d=[];switch(_0x2f3819[_0x3585('0x1c')]['toLowerCase']()){case'autoreply':var _0x5dbbec=_0x2f3819['appdata']['split'](',');if(_0x27837a['channel']===_0x3585('0x1e')){_0x2de21d[_0x3585('0x1f')](_0x5dbbec[0x0]);_0x2de21d[_0x3585('0x1f')](_0x5dbbec[0x1]);_0x2de21d[_0x3585('0x1f')](_0x5dbbec[_0x3585('0x20')](0x2,_0x5dbbec['length'])[_0x3585('0x21')](','));}else{_0x2de21d[_0x3585('0x1f')](_0x5dbbec[0x0]);_0x2de21d['push'](_0x5dbbec[_0x3585('0x20')](0x1,_0x5dbbec['length'])[_0x3585('0x21')](','));}break;case _0x3585('0x22'):var _0xeb24a0=_0x2f3819[_0x3585('0x23')][_0x3585('0x24')](',');_0x2de21d[_0x3585('0x1f')](_0xeb24a0[0x0]);_0x2de21d[_0x3585('0x1f')](_0xeb24a0[0x1]);_0x2de21d[_0x3585('0x1f')](_0xeb24a0[_0x3585('0x20')](0x2,_0xeb24a0[_0x3585('0x1a')])[_0x3585('0x21')](','));break;case _0x3585('0x25'):var _0x4f74f5=_0x2f3819[_0x3585('0x23')][_0x3585('0x24')](',');_0x2de21d[_0x3585('0x1f')](_0x4f74f5[0x0]);_0x2de21d[_0x3585('0x1f')](_0x4f74f5[0x1]);_0x2de21d[_0x3585('0x1f')](_0x4f74f5[0x2]);_0x2de21d[_0x3585('0x1f')](_0x4f74f5[0x3]);_0x2de21d['push'](_0x4f74f5[_0x3585('0x20')](0x4,_0x4f74f5[_0x3585('0x1a')])[_0x3585('0x21')](','));break;case _0x3585('0x26'):var _0x118849=_0x2f3819[_0x3585('0x23')]['split'](',');_0x2de21d['push'](_0x118849[0x0]);_0x2de21d[_0x3585('0x1f')](_0x118849[0x1]);_0x2de21d[_0x3585('0x1f')](_0x118849[0x2]);_0x2de21d[_0x3585('0x1f')](_0x118849[0x3]);_0x2de21d[_0x3585('0x1f')](_0x118849['slice'](0x4,_0x118849['length'])[_0x3585('0x21')](','));break;case _0x3585('0x14'):_0x2de21d[_0x3585('0x1f')](_0x2f3819[_0x3585('0x23')]);break;case'tag':_0x2de21d[_0x3585('0x1f')](_0x2f3819[_0x3585('0x27')]);_0x2de21d['push'](_0x2f3819[_0x3585('0x23')]);break;case _0x3585('0x28'):var _0x53b821=utils[_0x3585('0x29')](_0x27837a['account']['notificationTemplate'],_0x27837a);var _0x3f3452=_0x2f3819[_0x3585('0x23')]['split'](',');_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x0]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x1]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x2]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x3]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x4]);_0x2de21d['push'](_0x3f3452[0x5]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x6]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x7]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0x8]);_0x2de21d['push'](_0x3f3452[0x9]);_0x2de21d[_0x3585('0x1f')](_0x3f3452[0xa]);_0x2de21d['push'](_0x27837a[_0x3585('0x15')]['id']);_0x2de21d[_0x3585('0x1f')](_0x27837a[_0x3585('0x14')]['id']);_0x2de21d[_0x3585('0x1f')](_0x2f3819['ChatWebsiteId']);_0x2de21d['push'](_0x27837a[_0x3585('0x15')][_0x3585('0x2a')]);_0x2de21d['push'](_0x27837a[_0x3585('0x2b')][_0x3585('0x2b')]);_0x2de21d[_0x3585('0x1f')](_0x53b821);break;default:_0x2de21d=_[_0x3585('0xe')](_0x2f3819[_0x3585('0x23')])?[]:_0x2f3819['appdata'][_0x3585('0x24')](',');}var _0x3ea701={'id':util[_0x3585('0xc')](_0x3585('0x2c'),_0x43c5d7,_0x2f3819['id'],_0x2f3819[_0x3585('0x1c')]),'condition':require('./interval')['condition'](_0x43c5d7,getIntervals(_0x1f9404['intervals'],_0x2f3819),_0x1f9404),'consequence':require(_0x3585('0x2d')+_0x2f3819['app'])[_0x3585('0x2e')](_0x43c5d7,_0x2de21d,_0x1f9404,_0x27837a),'p':_0x2f3819[_0x3585('0x2f')]||0x0};logger[_0x3585('0x30')](_0x3585('0x31'),_0x3ea701['id'],_0x3585('0x32'),getIntervals(_0x1f9404[_0x3585('0x33')],_0x2f3819)[_0x3585('0x21')](_0x3585('0x34')));_0x10449b['push'](_0x3ea701);}else{logger['error'](_0x3585('0x35'),path[_0x3585('0x21')](__dirname,_0x3585('0x18'),_0x2f3819['app']+_0x3585('0x1d')));}}_0x1f9404[_0x3585('0x36')][_0x43c5d7]=new RuleEngine(_0x10449b);_0x1f9404[_0x3585('0x36')][_0x43c5d7][_0x3585('0x37')](_0x27837a,function(_0x79bf0b){logger[_0x3585('0x30')](_0x3585('0x38'),JSON[_0x3585('0x39')](_0x79bf0b[_0x3585('0x3a')]));if(_0x1f9404[_0x3585('0x36')][_0x43c5d7]){_0x1f9404[_0x3585('0x36')][_0x43c5d7][_0x3585('0x3b')](_0x3585('0x3c'));}});return _0x5e31b2({'code':0xc8,'message':_0x27837a});}else{if(_0x22cfec){logger[_0x3585('0x30')](util[_0x3585('0xc')]('Skipped\x20routing\x20for\x20%s',_0x43c5d7));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x5e31b2({'code':0xc8,'message':_0x27837a});}}catch(_0x51b433){logger[_0x3585('0x3d')](_0x51b433[_0x3585('0x3e')]);return _0x366723(_0x3c97ae[_0x3585('0x3d')](0x1f4,_0x51b433));}}return _0x366723(_0x3585('0x3f'));});},'AcceptMessage':function(_0x354595){var _0x48af96=this;return new Promise(function(_0x51a882,_0x4611d7){if(_0x354595['agent']&&_0x354595['agent']['id']){if(_0x1f9404[_0x3585('0x40')][_0x354595['agent']['id']]){_0x1f9404[_0x3585('0x40')][_0x354595[_0x3585('0x41')]['id']][_0x3585('0x42')]=![];_0x1f9404[_0x3585('0x40')][_0x354595[_0x3585('0x41')]['id']][_0x3585('0x43')]=undefined;}}if(_0x354595[_0x3585('0x14')]&&_0x354595[_0x3585('0x14')]['id']){try{var _0x2b0bdb=getId(_0x354595[_0x3585('0x13')],_0x354595[_0x3585('0x14')]?_0x354595[_0x3585('0x14')]['id']:0x0,_0x354595[_0x3585('0x15')]?_0x354595[_0x3585('0x15')]['id']:0x0);if(_0x1f9404[_0x3585('0x36')][_0x2b0bdb]){_0x1f9404[_0x3585('0x36')][_0x2b0bdb][_0x3585('0x3b')](_0x3585('0x44'));if(rpc[_0x354595[_0x3585('0x13')]+_0x3585('0x45')]){rpc[_0x354595[_0x3585('0x13')]+_0x3585('0x45')][_0x3585('0x46')](_0x2b0bdb,{'UserId':_0x354595['message'][_0x3585('0x47')]})[_0x3585('0x48')](function(){logger[_0x3585('0x3d')](_0x3585('0x49'));});}}return _0x51a882({'code':0xc8,'message':_0x354595});}catch(_0x30bd9a){logger[_0x3585('0x3d')](_0x30bd9a['stack']);return _0x4611d7(_0x48af96['error'](0x1f4,_0x30bd9a));}}logger['error']('message\x20is\x20empty');return _0x4611d7(_0x48af96[_0x3585('0x3d')](0x1f4,_0x3585('0x4a')));});},'RejectMessage':function(_0x25b82c){var _0x3c7916=this;return new Promise(function(_0x5f5295,_0x425453){if(_0x25b82c[_0x3585('0x41')]&&_0x25b82c[_0x3585('0x41')]['id']){try{if(_0x1f9404[_0x3585('0x40')][_0x25b82c[_0x3585('0x41')]['id']]){_0x1f9404[_0x3585('0x40')][_0x25b82c[_0x3585('0x41')]['id']][_0x3585('0x42')]=![];_0x1f9404['agents'][_0x25b82c[_0x3585('0x41')]['id']][_0x3585('0x43')]=undefined;}return _0x5f5295({'code':0xc8,'message':_0x25b82c});}catch(_0x5ae7f2){logger[_0x3585('0x3d')](_0x5ae7f2[_0x3585('0x3e')]);return _0x425453(_0x3c7916[_0x3585('0x3d')](0x1f4,_0x5ae7f2));}}logger[_0x3585('0x3d')]('message\x20is\x20empty');return _0x425453(_0x3c7916[_0x3585('0x3d')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x29d910){var _0x4e83b3=this;return new Promise(function(_0x870170,_0x5a603c){if(_0x29d910[_0x3585('0x13')]&&_0x29d910['interaction']&&_0x29d910[_0x3585('0x15')]['id']){try{var _0x5ce4f1=getId(_0x29d910['channel'],_0x29d910['message']?_0x29d910[_0x3585('0x14')]['id']:0x0,_0x29d910[_0x3585('0x15')]?_0x29d910[_0x3585('0x15')]['id']:0x0);if(_0x1f9404[_0x3585('0x36')][_0x5ce4f1]){_0x1f9404[_0x3585('0x36')][_0x5ce4f1]['emit']('end');}return _0x870170({'code':0xc8,'message':_0x29d910});}catch(_0x5ddd83){logger['error'](_0x5ddd83[_0x3585('0x3e')]);return _0x5a603c(_0x4e83b3[_0x3585('0x3d')](0x1f4,_0x5ddd83));}}logger[_0x3585('0x3d')]('message\x20is\x20empty');return _0x5a603c(_0x4e83b3['error'](0x1f4,_0x3585('0x4a')));});},'AgentCapacity':function(_0x49aad8){var _0x5da9f8=this;return new Promise(function(_0x434f6d,_0xd3911c){if(_0x1f9404[_0x3585('0x40')]['hasOwnProperty'](_0x49aad8['id'])){for(var _0x4736a1 in _0x49aad8['capacity']){if(_0x49aad8[_0x3585('0x4b')][_0x3585('0x4c')](_0x4736a1)){if(_0x1f9404['agents'][_0x49aad8['id']][_0x3585('0x4c')](_0x4736a1+_0x3585('0x4d'))){_0x1f9404[_0x3585('0x40')][_0x49aad8['id']][_0x4736a1+_0x3585('0x4d')]=parseInt(_0x49aad8[_0x3585('0x4b')][_0x4736a1],0xa);}}}_0x1f9404[_0x3585('0x40')][_0x49aad8['id']][_0x3585('0x4e')]();return _0x434f6d({'code':0xc8,'message':_0x1f9404[_0x3585('0x40')][_0x49aad8['id']]});}else{return _0xd3911c(_0x5da9f8[_0x3585('0x3d')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xce37e0){return new Promise(function(_0x1cdea4){var _0x1e931a=_['values'](_0x1f9404['agents']);if(_0xce37e0&&_0xce37e0['id']){var _0x1c953d=_[_0x3585('0x4f')](_0x1e931a,function(_0x374d19){return _0x374d19['id']===_0xce37e0['id'];});_0x1cdea4(_0x1c953d);}else{_0x1cdea4({'count':_0x1e931a['length'],'rows':_0x1e931a});}});},'ChatQueues':function(){return new Promise(function(_0x960dec){var _0xd81b27=[];for(var _0x4c9869 in _0x1f9404[_0x3585('0x50')]){if(_0x1f9404['chatQueues']['hasOwnProperty'](_0x4c9869)){var _0x32654d=_0x1f9404[_0x3585('0x50')][_0x4c9869];var _0xfaa965={'id':_0x32654d['id'],'available':_0x32654d['available'],'loggedIn':_0x32654d[_0x3585('0x51')],'name':_0x32654d[_0x3585('0x52')],'paused':_0x32654d['paused'],'waiting':_0x32654d['waiting']};_0xd81b27[_0x3585('0x1f')](_0xfaa965);}}_0x960dec({'count':_0xd81b27[_0x3585('0x1a')],'rows':_0xd81b27});});},'MailQueues':function(){return new Promise(function(_0x477717){var _0x3ebd68=[];for(var _0x2ab218 in _0x1f9404['mailQueues']){if(_0x1f9404['mailQueues'][_0x3585('0x4c')](_0x2ab218)){var _0x555717=_0x1f9404['mailQueues'][_0x2ab218];var _0x2f63d9={'id':_0x555717['id'],'available':_0x555717['available'],'loggedIn':_0x555717[_0x3585('0x51')],'name':_0x555717[_0x3585('0x52')],'paused':_0x555717[_0x3585('0x53')],'waiting':_0x555717['waiting']};_0x3ebd68[_0x3585('0x1f')](_0x2f63d9);}}_0x477717({'count':_0x3ebd68[_0x3585('0x1a')],'rows':_0x3ebd68});});},'OpenchannelQueues':function(){return new Promise(function(_0x3c3eaa){var _0x196618=[];for(var _0x5967f1 in _0x1f9404[_0x3585('0x54')]){if(_0x1f9404[_0x3585('0x54')][_0x3585('0x4c')](_0x5967f1)){var _0x21f809=_0x1f9404[_0x3585('0x54')][_0x5967f1];var _0x3119ee={'id':_0x21f809['id'],'available':_0x21f809[_0x3585('0x55')],'loggedIn':_0x21f809[_0x3585('0x51')],'name':_0x21f809['name'],'paused':_0x21f809[_0x3585('0x53')],'waiting':_0x21f809[_0x3585('0x56')]};_0x196618[_0x3585('0x1f')](_0x3119ee);}}_0x3c3eaa({'count':_0x196618[_0x3585('0x1a')],'rows':_0x196618});});},'SmsQueues':function(){return new Promise(function(_0x2d9d48){var _0x3301aa=[];for(var _0xddcfbf in _0x1f9404[_0x3585('0x57')]){if(_0x1f9404['smsQueues'][_0x3585('0x4c')](_0xddcfbf)){var _0x5ebf46=_0x1f9404[_0x3585('0x57')][_0xddcfbf];var _0x5ce184={'id':_0x5ebf46['id'],'available':_0x5ebf46[_0x3585('0x55')],'loggedIn':_0x5ebf46['loggedIn'],'name':_0x5ebf46['name'],'paused':_0x5ebf46['paused'],'waiting':_0x5ebf46[_0x3585('0x56')]};_0x3301aa[_0x3585('0x1f')](_0x5ce184);}}_0x2d9d48({'count':_0x3301aa[_0x3585('0x1a')],'rows':_0x3301aa});});},'FaxQueues':function(){return new Promise(function(_0x3af83c){var _0x140707=[];for(var _0x48bd73 in _0x1f9404[_0x3585('0x58')]){if(_0x1f9404[_0x3585('0x58')][_0x3585('0x4c')](_0x48bd73)){var _0x53c74e=_0x1f9404[_0x3585('0x58')][_0x48bd73];var _0xc33aef={'id':_0x53c74e['id'],'available':_0x53c74e['available'],'loggedIn':_0x53c74e['loggedIn'],'name':_0x53c74e[_0x3585('0x52')],'paused':_0x53c74e[_0x3585('0x53')],'waiting':_0x53c74e[_0x3585('0x56')]};_0x140707[_0x3585('0x1f')](_0xc33aef);}}_0x3af83c({'count':_0x140707[_0x3585('0x1a')],'rows':_0x140707});});},'WhatsappQueues':function(){return new Promise(function(_0x2153e3){var _0x468456=[];for(var _0x3444ac in _0x1f9404[_0x3585('0x59')]){if(_0x1f9404[_0x3585('0x59')]['hasOwnProperty'](_0x3444ac)){var _0x1b669f=_0x1f9404['whatsappQueues'][_0x3444ac];var _0x91ae8f={'id':_0x1b669f['id'],'available':_0x1b669f['available'],'loggedIn':_0x1b669f[_0x3585('0x51')],'name':_0x1b669f[_0x3585('0x52')],'paused':_0x1b669f['paused'],'waiting':_0x1b669f['waiting']};_0x468456['push'](_0x91ae8f);}}_0x2153e3({'count':_0x468456['length'],'rows':_0x468456});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3cf355){var _0x1c156f=_[_0x3585('0x5a')](_0x1f9404[_0x3585('0x5b')]);_0x3cf355({'count':_0x1c156f[_0x3585('0x1a')],'rows':_0x1c156f});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x49a731){var _0x4da084=_[_0x3585('0x5a')](_0x1f9404['mailQueuesWaitingInteractions']);_0x49a731({'count':_0x4da084[_0x3585('0x1a')],'rows':_0x4da084});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x49f466){var _0x6394fb=_[_0x3585('0x5a')](_0x1f9404[_0x3585('0x5c')]);_0x49f466({'count':_0x6394fb[_0x3585('0x1a')],'rows':_0x6394fb});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x28f1af){var _0x14b9c0=_['values'](_0x1f9404[_0x3585('0x5d')]);_0x28f1af({'count':_0x14b9c0[_0x3585('0x1a')],'rows':_0x14b9c0});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x37ca33){var _0x469e52=_['values'](_0x1f9404['faxQueuesWaitingInteractions']);_0x37ca33({'count':_0x469e52[_0x3585('0x1a')],'rows':_0x469e52});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4ce33a){var _0x55ac58=_['values'](_0x1f9404[_0x3585('0x5e')]);_0x4ce33a({'count':_0x55ac58['length'],'rows':_0x55ac58});});}};var _0x1fbd11=jayson[_0x3585('0x5f')](_0x5434ee)['http']();_0x1fbd11['on'](_0x3585('0x3d'),function(_0x4213c3){logger['error'](JSON[_0x3585('0x39')](_0x4213c3));return _0x1cfae3(_0x4213c3);});_0x1fbd11[_0x3585('0x60')](0x232c,'127.0.0.1',function(){console[_0x3585('0x61')](_0x3585('0x62'),0x232c);return _0x16b42a(_0x3585('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4171103..da161da 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 _0x586b=['stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','indexOf','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','stack'];(function(_0x42519d,_0x3c4b3e){var _0x39bd6e=function(_0x2d125d){while(--_0x2d125d){_0x42519d['push'](_0x42519d['shift']());}};_0x39bd6e(++_0x3c4b3e);}(_0x586b,0x1b4));var _0xb586=function(_0x774298,_0x4f21ba){_0x774298=_0x774298-0x0;var _0x4ea3a=_0x586b[_0x774298];return _0x4ea3a;};'use strict';var util=require(_0xb586('0x0'));var BPromise=require(_0xb586('0x1'));var jayson=require(_0xb586('0x2'));var _=require(_0xb586('0x3'));var logger=require(_0xb586('0x4'))(_0xb586('0x5'));var client=jayson[_0xb586('0x6')][_0xb586('0x7')]({'port':0x232a});function request(_0x33e946,_0x5eea40){return new BPromise(function(_0x1354a1,_0x309c4d){return client[_0xb586('0x8')](_0x33e946,_0x5eea40)[_0xb586('0x9')](function(_0x537372){if(_0x537372['error']){return _0x309c4d(_0x537372[_0xb586('0xa')][_0xb586('0xb')]);}else{return _0x1354a1(_0x537372[_0xb586('0xc')]);}})['catch'](function(_0x1cba94){return _0x309c4d(_0x1cba94);});});}exports['condition']=function(_0x125b6e,_0x4c5fe1,_0xbb2d06){return function(_0x54a9ad){if(_0xbb2d06[_0xb586('0xd')]&&!_0xbb2d06[_0xb586('0xd')][_0x125b6e]){logger[_0xb586('0xe')](_0xb586('0xf'),_0x125b6e);return _0x54a9ad['stop']();}var _0x4ead83=[];for(var _0x199874=0x0;_0x199874<_0x4c5fe1['length'];_0x199874+=0x1){_0x4ead83[_0xb586('0x10')](request(_0xb586('0x11'),{'command':util[_0xb586('0x12')]('iftime\x20%s',_0x4c5fe1[_0x199874])})['then'](function(_0x3db0b9){return _0x3db0b9&&_0x3db0b9[_0xb586('0xb')]&&_0x3db0b9['message'][_0xb586('0x13')]('true')>=0x0?!![]:![];})['catch'](function(){logger['error']('[%s][INTERVAL]\x20%s',_0x125b6e,_0x4c5fe1[_0x199874]);}));}BPromise[_0xb586('0x14')](_0x4ead83)[_0xb586('0x9')](function(_0x51b8af){var _0x58c30c=_[_0xb586('0x15')](_0x51b8af);logger[_0xb586('0xe')](_0xb586('0x16'),_0x125b6e,_0x4c5fe1[_0xb586('0x17')](_0xb586('0x18')),_0x58c30c);_0x54a9ad[_0xb586('0x19')](_0x58c30c);})[_0xb586('0x1a')](function(_0x552ed2){logger['error'](_0xb586('0x16'),_0x125b6e,_0x4c5fe1[_0xb586('0x17')](_0xb586('0x18')),_0x552ed2[_0xb586('0x1b')]);_0x54a9ad[_0xb586('0x1c')]();});};}; \ No newline at end of file +var _0x603b=['[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','join','stack','util','jayson/promise','../../../config/logger','routing','client','http','request','error','message','result','catch','condition','rules','stop','length','push','format','iftime\x20%s','then','indexOf','[%s][INTERVAL]\x20%s','some','info'];(function(_0x1a7a28,_0x2c43e1){var _0x18bcd9=function(_0x388e56){while(--_0x388e56){_0x1a7a28['push'](_0x1a7a28['shift']());}};_0x18bcd9(++_0x2c43e1);}(_0x603b,0x17e));var _0xb603=function(_0x537dbf,_0x4609c6){_0x537dbf=_0x537dbf-0x0;var _0x133df1=_0x603b[_0x537dbf];return _0x133df1;};'use strict';var util=require(_0xb603('0x0'));var BPromise=require('bluebird');var jayson=require(_0xb603('0x1'));var _=require('lodash');var logger=require(_0xb603('0x2'))(_0xb603('0x3'));var client=jayson[_0xb603('0x4')][_0xb603('0x5')]({'port':0x232a});function request(_0x41a799,_0x122229){return new BPromise(function(_0x313562,_0x347a0b){return client[_0xb603('0x6')](_0x41a799,_0x122229)['then'](function(_0x56ccf1){if(_0x56ccf1[_0xb603('0x7')]){return _0x347a0b(_0x56ccf1[_0xb603('0x7')][_0xb603('0x8')]);}else{return _0x313562(_0x56ccf1[_0xb603('0x9')]);}})[_0xb603('0xa')](function(_0x4b2dd7){return _0x347a0b(_0x4b2dd7);});});}exports[_0xb603('0xb')]=function(_0x587980,_0x1def84,_0x2a17d6){return function(_0x22ac6a){if(_0x2a17d6[_0xb603('0xc')]&&!_0x2a17d6['rules'][_0x587980]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x587980);return _0x22ac6a[_0xb603('0xd')]();}var _0x8fa64c=[];for(var _0x437fcd=0x0;_0x437fcd<_0x1def84[_0xb603('0xe')];_0x437fcd+=0x1){_0x8fa64c[_0xb603('0xf')](request('Command',{'command':util[_0xb603('0x10')](_0xb603('0x11'),_0x1def84[_0x437fcd])})[_0xb603('0x12')](function(_0x569901){return _0x569901&&_0x569901[_0xb603('0x8')]&&_0x569901['message'][_0xb603('0x13')]('true')>=0x0?!![]:![];})[_0xb603('0xa')](function(){logger['error'](_0xb603('0x14'),_0x587980,_0x1def84[_0x437fcd]);}));}BPromise['all'](_0x8fa64c)[_0xb603('0x12')](function(_0x2f0ace){var _0x434b7e=_[_0xb603('0x15')](_0x2f0ace);logger[_0xb603('0x16')](_0xb603('0x17'),_0x587980,_0x1def84['join'](_0xb603('0x18')),_0x434b7e);_0x22ac6a['when'](_0x434b7e);})[_0xb603('0xa')](function(_0x172f6a){logger[_0xb603('0x7')](_0xb603('0x17'),_0x587980,_0x1def84[_0xb603('0x19')](_0xb603('0x18')),_0x172f6a[_0xb603('0x1a')]);_0x22ac6a[_0xb603('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 57a8d43..06d8fe7 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 _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(_0x48b871,_0x15f722){var _0xcfa6e0=function(_0x4fcea3){while(--_0x4fcea3){_0x48b871['push'](_0x48b871['shift']());}};_0xcfa6e0(++_0x15f722);}(_0xa478,0x136));var _0x8a47=function(_0x51edca,_0x18ad70){_0x51edca=_0x51edca-0x0;var _0x2b77ec=_0xa478[_0x51edca];return _0x2b77ec;};'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 +var _0xeffd=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','origtransfereruniqueid','transfereeuniqueid','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','now','called','error','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','push','[%s][agents][agentringnoanswer]','forIn','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid'];(function(_0x5c0f7e,_0x5a75af){var _0x4d0f23=function(_0x14570a){while(--_0x14570a){_0x5c0f7e['push'](_0x5c0f7e['shift']());}};_0x4d0f23(++_0x5a75af);}(_0xeffd,0x6b));var _0xdeff=function(_0x33d81b,_0x4f994e){_0x33d81b=_0x33d81b-0x0;var _0x16406b=_0xeffd[_0x33d81b];return _0x16406b;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var utils=require(_0xdeff('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xd8f1d6,_0x281a05){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x4'),_0xd8f1d6[_0xdeff('0x5')],_0xd8f1d6[_0xdeff('0x6')],_0xd8f1d6[_0xdeff('0x7')],_0xd8f1d6[_0xdeff('0x8')],_0xd8f1d6[_0xdeff('0x9')],_0xd8f1d6[_0xdeff('0xa')],_0xd8f1d6[_0xdeff('0xb')],_0xd8f1d6[_0xdeff('0xc')]));if(_0xd8f1d6[_0xdeff('0x7')]){utils[_0xdeff('0xd')](_0xd8f1d6[_0xdeff('0x7')])['then'](function(_0x3ae201){if(_0x3ae201){_0xd8f1d6[_0xdeff('0xe')]=_0x3ae201[_0xdeff('0xe')];_0xd8f1d6['agentacw']=_0xd8f1d6[_0xdeff('0xf')]?_0x3ae201[_0xdeff('0x10')]:![];_0xd8f1d6[_0xdeff('0x11')]=_0xd8f1d6[_0xdeff('0x12')]?_0x3ae201[_0xdeff('0x13')]:0x0;}utils[_0xdeff('0x14')](_0xdeff('0x15'),_0xd8f1d6);});}else{utils[_0xdeff('0x14')]('CreateVoiceAgentReport',_0xd8f1d6);}if(_0x281a05){delete transfers[_0xd8f1d6[_0xdeff('0x5')]];}else{delete agents[_0xd8f1d6[_0xdeff('0x16')]];}}exports['agentcalled']=function(_0x2e614c){try{utils['debug'](util['format'](_0xdeff('0x17'),_0x2e614c[_0xdeff('0x5')]),_0x2e614c);agents[_0x2e614c[_0xdeff('0x16')]]=_0x2e614c;agents[_0x2e614c[_0xdeff('0x16')]]['agentcalledAt']=utils[_0xdeff('0x18')]();agents[_0x2e614c[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x19');agents[_0x2e614c[_0xdeff('0x16')]][_0xdeff('0xb')]=null;agents[_0x2e614c['destuniqueid']]['connectedlinename']=null;utils[_0xdeff('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2e614c[_0xdeff('0x5')],agents[_0x2e614c[_0xdeff('0x16')]]['membername'],_0x2e614c[_0xdeff('0x16')]));}catch(_0x42e98e){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x17'),_0x2e614c[_0xdeff('0x5')]),_0x42e98e);}};exports[_0xdeff('0x1b')]=function(_0x919c93){try{if(!_['isNil'](agents[_0x919c93['destuniqueid']])){utils['debug'](util[_0xdeff('0x3')]('[%s][agents][agentringnoanswer]',_0x919c93[_0xdeff('0x5')]),_0x919c93);utils[_0xdeff('0x2')](util['format'](_0xdeff('0x1c'),_0x919c93[_0xdeff('0x5')],agents[_0x919c93['destuniqueid']]['membername'],_0x919c93[_0xdeff('0x16')]));agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1b')]=!![];agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1d')]=utils['now']();agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x1e');agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1f')]=_0xdeff('0x1e');agents[_0x919c93[_0xdeff('0x16')]]['holdtime']=_0x919c93[_0xdeff('0x20')]?parseInt(_0x919c93[_0xdeff('0x20')])/0x3e8:0x0;agents[_0x919c93['destuniqueid']]['talktime']=0x0;unanswered[_0xdeff('0x21')](_0x919c93[_0xdeff('0x16')]);}}catch(_0x16b2d0){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x22'),_0x919c93[_0xdeff('0x5')]),_0x16b2d0);}};exports['queuecallerabandon']=function(_0x331ddc){try{_[_0xdeff('0x23')](agents,function(_0x34e258,_0x5045b8){if(_0x34e258['uniqueid']==_0x331ddc[_0xdeff('0x5')]&&!_['includes'](unanswered,_0x34e258[_0xdeff('0x16')])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][queuecallerabandon]',_0x331ddc[_0xdeff('0x5')]),_0x331ddc);utils['info'](util['format'](_0xdeff('0x25'),_0x331ddc[_0xdeff('0x5')],_0x34e258[_0xdeff('0x8')],_0x34e258[_0xdeff('0x16')]));_0x34e258['agentringnoanswer']=!![];_0x34e258[_0xdeff('0x1d')]=utils[_0xdeff('0x18')]();_0x34e258[_0xdeff('0xc')]=_0xdeff('0x26');_0x34e258[_0xdeff('0x1f')]=_0xdeff('0x26');_0x34e258[_0xdeff('0x27')]=_0x331ddc['holdtime'];_0x34e258[_0xdeff('0x28')]=0x0;writeDB(_0x34e258);}});}catch(_0x5cef77){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x29'),_0x331ddc[_0xdeff('0x5')]),_0x5cef77);}};exports[_0xdeff('0x2a')]=function(_0x965c5b){try{if(agents[_0x965c5b['destuniqueid']]){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][agentconnect]',_0x965c5b[_0xdeff('0x5')]),_0x965c5b);utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x2b'),_0x965c5b[_0xdeff('0x5')],agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0x8')],_0x965c5b[_0xdeff('0x16')]));agents[_0x965c5b['destuniqueid']][_0xdeff('0x2c')]=utils['now']();agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0xb')]=_0x965c5b[_0xdeff('0xb')];agents[_0x965c5b['destuniqueid']][_0xdeff('0x2d')]=_0x965c5b[_0xdeff('0x2d')];agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0x27')]=_0x965c5b[_0xdeff('0x20')];agents[_0x965c5b['destuniqueid']][_0xdeff('0xc')]='connect';_[_0xdeff('0x23')](agents,function(_0x14f1d0,_0x518280){if(_0x14f1d0[_0xdeff('0x16')]!=_0x965c5b[_0xdeff('0x16')]&&_0x14f1d0[_0xdeff('0x5')]==_0x965c5b[_0xdeff('0x5')]){_0x14f1d0[_0xdeff('0x28')]=0x0;_0x14f1d0['holdtime']=_0x965c5b[_0xdeff('0x20')];_0x14f1d0[_0xdeff('0x1b')]=!![];_0x14f1d0[_0xdeff('0x1d')]=utils[_0xdeff('0x18')]();_0x14f1d0[_0xdeff('0xc')]='answered_elsewhere';_0x14f1d0['reason']=_0xdeff('0x2e');_0x14f1d0[_0xdeff('0x2f')]=_0x965c5b[_0xdeff('0x16')];_0x14f1d0[_0xdeff('0x30')]=_0x965c5b[_0xdeff('0x8')];writeDB(_0x14f1d0);}});}}catch(_0x289f70){utils[_0xdeff('0x1a')](util['format'](_0xdeff('0x31'),_0x965c5b[_0xdeff('0x5')]),_0x289f70);}};exports[_0xdeff('0xf')]=function(_0x54fa5b){try{if(!_[_0xdeff('0x32')](agents[_0x54fa5b[_0xdeff('0x16')]])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][agentcomplete]',_0x54fa5b[_0xdeff('0x5')]),_0x54fa5b);utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x33'),_0x54fa5b[_0xdeff('0x5')],agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x8')],_0x54fa5b[_0xdeff('0x16')]));agents[_0x54fa5b['destuniqueid']][_0xdeff('0xf')]=!![];agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x34')]=utils[_0xdeff('0x18')]();agents[_0x54fa5b[_0xdeff('0x16')]]['talktime']=utils[_0xdeff('0x35')](agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x34')],agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x2c')]);agents[_0x54fa5b['destuniqueid']][_0xdeff('0x1f')]=_0x54fa5b['reason'];agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x36');writeDB(agents[_0x54fa5b[_0xdeff('0x16')]]);}}catch(_0xf58aa6){utils[_0xdeff('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x54fa5b[_0xdeff('0x5')]),_0xf58aa6);}};exports[_0xdeff('0x37')]=function(_0x3dc206){try{if(!_['isNil'](agents[_0x3dc206['transfereruniqueid']])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][blindtransfer]',_0x3dc206[_0xdeff('0x5')]),_0x3dc206);utils[_0xdeff('0x2')](util[_0xdeff('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x3dc206[_0xdeff('0x5')],agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x8')],agents[_0x3dc206['transfereruniqueid']][_0xdeff('0x5')]));agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x39')]=!![];agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x3a')]=_0xdeff('0x3b');agents[_0x3dc206[_0xdeff('0x38')]]['transferexten']=_0x3dc206[_0xdeff('0x3c')];agents[_0x3dc206[_0xdeff('0x38')]]['transferuniqueid']=agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x5')];}}catch(_0x2967b4){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x3d'),_0x3dc206[_0xdeff('0x5')]),_0x2967b4);}};exports[_0xdeff('0x3e')]=function(_0x5ca032){try{utils[_0xdeff('0x24')](util[_0xdeff('0x3')](_0xdeff('0x3f'),_0x5ca032['origtransfereruniqueid']),_0x5ca032);if(_0x5ca032['origtransfereruniqueid']==_0x5ca032[_0xdeff('0x40')]){if(!_[_0xdeff('0x32')](agents[_0x5ca032[_0xdeff('0x41')]])){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x42'),_0x5ca032['origtransfereruniqueid'],agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x8')]));agents[_0x5ca032[_0xdeff('0x41')]]['transfer']=!![];agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x3a')]=_0xdeff('0x43');agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x44')]=_0x5ca032[_0xdeff('0x45')];agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x46')]=_0x5ca032[_0xdeff('0x47')];}if(_0x5ca032['transfereeuniqueid']&&agents[_0x5ca032[_0xdeff('0x48')]]){agents[_0x5ca032[_0xdeff('0x48')]]['agententerreason']=0x1;transfers[_0x5ca032[_0xdeff('0x48')]]=_[_0xdeff('0x49')](agents[_0x5ca032[_0xdeff('0x48')]]);transfers[_0x5ca032['transfereeuniqueid']]['calleridnum']=agents[_0x5ca032[_0xdeff('0x41')]]['calleridnum'];transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x4a')]=agents[_0x5ca032[_0xdeff('0x41')]][_0xdeff('0x4a')];transfers[_0x5ca032[_0xdeff('0x48')]]['agentcalledAt']=utils['now']();transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x2c')]=utils[_0xdeff('0x18')]();transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x27')]=0x0;transfers[_0x5ca032[_0xdeff('0x48')]]['agententerreason']=0x2;}}else if(_0x5ca032[_0xdeff('0x41')]==_0x5ca032['secondtransfererlinkedid']){if(!_[_0xdeff('0x32')](agents[_0x5ca032[_0xdeff('0x47')]])){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x42'),_0x5ca032[_0xdeff('0x47')],agents[_0x5ca032[_0xdeff('0x47')]][_0xdeff('0x8')]));agents[_0x5ca032[_0xdeff('0x47')]]['transfer']=!![];agents[_0x5ca032[_0xdeff('0x47')]]['transfertype']=_0xdeff('0x43');agents[_0x5ca032[_0xdeff('0x47')]]['transferexten']=_0x5ca032[_0xdeff('0x4b')];agents[_0x5ca032['origtransfereruniqueid']][_0xdeff('0x46')]=_0x5ca032['secondtransfereruniqueid'];}if(_0x5ca032['transfertargetuniqueid']&&agents[_0x5ca032[_0xdeff('0x4c')]]){agents[_0x5ca032[_0xdeff('0x4c')]]['agententerreason']=0x1;transfers[_0x5ca032[_0xdeff('0x4c')]]=_[_0xdeff('0x49')](agents[_0x5ca032[_0xdeff('0x4c')]]);transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0xa')]=agents[_0x5ca032[_0xdeff('0x47')]][_0xdeff('0xa')];transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x4a')]=agents[_0x5ca032['origtransfereruniqueid']][_0xdeff('0x4a')];transfers[_0x5ca032[_0xdeff('0x4c')]]['agentcalledAt']=utils['now']();transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x2c')]=utils['now']();transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x27')]=0x0;transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x4d')]=0x2;}}}catch(_0x194eed){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x3f'),_0x5ca032[_0xdeff('0x47')]),_0x194eed);}};exports[_0xdeff('0x4e')]=function(_0x5ab2c5){try{utils[_0xdeff('0x24')](util[_0xdeff('0x3')](_0xdeff('0x4f'),_0x5ab2c5[_0xdeff('0x5')]),_0x5ab2c5);if(agents[_0x5ab2c5[_0xdeff('0x5')]]&&agents[_0x5ab2c5['uniqueid']]['reason']==='timeout'){if(_0x5ab2c5[_0xdeff('0x50')]==='21'){agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')]=_0xdeff('0x51');agents[_0x5ab2c5['uniqueid']]['lastevent']=_0xdeff('0x51');}utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x52'),_0x5ab2c5[_0xdeff('0x5')],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x8')],agents[_0x5ab2c5[_0xdeff('0x5')]]['reason'],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]));writeDB(agents[_0x5ab2c5[_0xdeff('0x5')]]);var _0x452fd4=unanswered[_0xdeff('0x53')](_0x5ab2c5[_0xdeff('0x5')]);if(_0x452fd4>-0x1){unanswered[_0xdeff('0x54')](_0x452fd4,0x1);}}if(transfers[_0x5ab2c5[_0xdeff('0x5')]]){transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xf')]=!![];transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x34')]=utils['now']();transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x28')]=utils[_0xdeff('0x35')](transfers[_0x5ab2c5['uniqueid']][_0xdeff('0x34')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x2c')]);transfers[_0x5ab2c5[_0xdeff('0x5')]]['reason']=_0xdeff('0x55');transfers[_0x5ab2c5[_0xdeff('0x5')]]['lastevent']=_0xdeff('0x36');utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x52'),_0x5ab2c5[_0xdeff('0x5')],transfers[_0x5ab2c5['uniqueid']][_0xdeff('0x8')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]));writeDB(transfers[_0x5ab2c5['uniqueid']],!![]);}if(agents[_0x5ab2c5[_0xdeff('0x5')]]&&agents[_0x5ab2c5[_0xdeff('0x5')]]['agentconnectAt']){agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xf')]=!![];agents[_0x5ab2c5[_0xdeff('0x5')]]['agentcompleteAt']=utils[_0xdeff('0x18')]();agents[_0x5ab2c5[_0xdeff('0x5')]]['talktime']=utils[_0xdeff('0x35')](agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x34')],agents[_0x5ab2c5[_0xdeff('0x5')]]['agentconnectAt']);agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')]=agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x39')]?_0xdeff('0x39'):_0xdeff('0x55');agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]=_0xdeff('0x36');utils['info'](util[_0xdeff('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ab2c5[_0xdeff('0x5')],agents[_0x5ab2c5['uniqueid']]['membername'],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')],agents[_0x5ab2c5['uniqueid']][_0xdeff('0xc')]));writeDB(agents[_0x5ab2c5[_0xdeff('0x5')]]);}}catch(_0xd49939){utils[_0xdeff('0x1a')](util['format'](_0xdeff('0x4f'),_0x5ab2c5[_0xdeff('0x5')]),_0xd49939);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 2a25641..90b9b6b 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 _0xf71b=['lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','FAILED','NO\x20ANSWER','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split'];(function(_0x498c78,_0x2eab48){var _0xb7697f=function(_0x1f6da7){while(--_0x1f6da7){_0x498c78['push'](_0x498c78['shift']());}};_0xb7697f(++_0x2eab48);}(_0xf71b,0xd2));var _0xbf71=function(_0x45fb23,_0x4696d2){_0x45fb23=_0x45fb23-0x0;var _0x5ed695=_0xf71b[_0x45fb23];return _0x5ed695;};'use strict';var _=require(_0xbf71('0x0'));var util=require(_0xbf71('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0xbf71('0x2'),_0xbf71('0x2'),_0xbf71('0x3'),_0xbf71('0x3'),_0xbf71('0x3'),'ANSWERED',_0xbf71('0x4'),'FAILED','FAILED',_0xbf71('0x2')];var channels={};function writeDB(_0x381719){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x7'),_0x381719[_0xbf71('0x8')],_0x381719[_0xbf71('0x9')],_0x381719['queue'],_0x381719[_0xbf71('0xa')],_0x381719[_0xbf71('0xb')],_0x381719[_0xbf71('0xc')],_0x381719[_0xbf71('0xd')],_0x381719['lastevent']));if(_0x381719[_0xbf71('0xe')]){utils[_0xbf71('0xf')](_0x381719[_0xbf71('0xe')])['then'](function(_0xddc481){if(_0xddc481){_0x381719['UserId']=_0xddc481['id'];}utils[_0xbf71('0x10')](_0xbf71('0x11'),_0x381719);});}else{utils[_0xbf71('0x10')](_0xbf71('0x11'),_0x381719);}if(channels[_0x381719[_0xbf71('0x8')]]){delete channels[_0x381719[_0xbf71('0x8')]];}}exports[_0xbf71('0x12')]=function(_0x11e922){try{utils['debug'](util[_0xbf71('0x6')](_0xbf71('0x13'),_0x11e922['uniqueid']),_0x11e922);if(_0x11e922[_0xbf71('0x8')]==_0x11e922['linkedid']&&_0x11e922['channel']!=_0xbf71('0x14')){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x15'),_0x11e922[_0xbf71('0x8')],_0x11e922['context'],_0x11e922[_0xbf71('0x16')]));channels[_0x11e922[_0xbf71('0x8')]]={'uniqueid':_0x11e922['uniqueid'],'accountcode':_0x11e922[_0xbf71('0xe')],'source':_0x11e922[_0xbf71('0xc')],'destination':_0x11e922[_0xbf71('0x16')],'destinationcontext':_0x11e922[_0xbf71('0x17')],'channel':_0x11e922['channel'],'starttime':utils[_0xbf71('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xbf71('0x19')};}}catch(_0x4c68de){utils[_0xbf71('0x1a')](util[_0xbf71('0x6')](_0xbf71('0x13'),_0x11e922[_0xbf71('0x8')]),_0x4c68de);}};exports['newstate']=function(_0x127e31){try{utils[_0xbf71('0x1b')](util['format'](_0xbf71('0x1c'),_0x127e31[_0xbf71('0x8')]),_0x127e31);if(!_[_0xbf71('0x1d')](channels[_0x127e31['uniqueid']])&&_0x127e31[_0xbf71('0x1e')]==0x6){utils['info'](util[_0xbf71('0x6')](_0xbf71('0x1f'),_0x127e31[_0xbf71('0x8')],_0x127e31['context'],_0x127e31[_0xbf71('0x9')]));if(_['isNil'](channels[_0x127e31[_0xbf71('0x8')]][_0xbf71('0x20')])){channels[_0x127e31[_0xbf71('0x8')]][_0xbf71('0x20')]=utils['now']();}}else if(!_[_0xbf71('0x1d')](channels[_0x127e31[_0xbf71('0x21')]])&&_0x127e31[_0xbf71('0x1e')]==0x6&&_0x127e31[_0xbf71('0x17')]!=_0xbf71('0x22')){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x23'),_0x127e31['uniqueid'],_0x127e31[_0xbf71('0x21')],_0x127e31[_0xbf71('0x17')],_0x127e31['channel']));channels[_0x127e31['linkedid']]['accountcode']=_0x127e31[_0xbf71('0xe')];channels[_0x127e31[_0xbf71('0x21')]][_0xbf71('0x24')]=_0x127e31['channel'];if(_[_0xbf71('0x1d')](channels[_0x127e31[_0xbf71('0x21')]]['answertime'])){channels[_0x127e31[_0xbf71('0x21')]][_0xbf71('0x25')]=utils['now']();}channels[_0x127e31[_0xbf71('0x21')]][_0xbf71('0x26')]=dispositions[_['toNumber'](_0x127e31[_0xbf71('0x1e')])]||_0xbf71('0x27');}}catch(_0x4c51a9){utils[_0xbf71('0x1a')](util[_0xbf71('0x6')](_0xbf71('0x1c'),_0x127e31['uniqueid']),_0x4c51a9);}};exports['hangup']=function(_0x4da034){try{if(!_[_0xbf71('0x1d')](channels[_0x4da034[_0xbf71('0x8')]])){utils['debug'](util['format'](_0xbf71('0x28'),_0x4da034['uniqueid']),_0x4da034);if(_[_0xbf71('0x1d')](channels[_0x4da034[_0xbf71('0x8')]][_0xbf71('0x29')])){channels[_0x4da034[_0xbf71('0x8')]][_0xbf71('0x29')]=_0x4da034[_0xbf71('0x2a')]+'\x20<'+_0x4da034[_0xbf71('0xc')]+'>';}utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x2b'),_0x4da034[_0xbf71('0x8')],channels[_0x4da034[_0xbf71('0x8')]]['callerid'],_0x4da034[_0xbf71('0x2c')]));channels[_0x4da034['uniqueid']][_0xbf71('0x2d')]=utils[_0xbf71('0x18')]();channels[_0x4da034[_0xbf71('0x8')]][_0xbf71('0x2e')]=utils[_0xbf71('0x2f')](channels[_0x4da034[_0xbf71('0x8')]]['endtime'],channels[_0x4da034[_0xbf71('0x8')]]['starttime']);channels[_0x4da034['uniqueid']][_0xbf71('0x30')]=channels[_0x4da034[_0xbf71('0x8')]][_0xbf71('0x25')]?utils['diffTime'](channels[_0x4da034[_0xbf71('0x8')]]['endtime'],channels[_0x4da034['uniqueid']][_0xbf71('0x25')]):0x0;writeDB(channels[_0x4da034[_0xbf71('0x8')]]);}}catch(_0x3a6f3d){utils[_0xbf71('0x1a')](util[_0xbf71('0x6')](_0xbf71('0x28'),_0x4da034[_0xbf71('0x8')]),_0x3a6f3d);}};exports[_0xbf71('0x31')]=function(_0x31d433){try{if(!_[_0xbf71('0x1d')](channels[_0x31d433[_0xbf71('0x32')]])){utils[_0xbf71('0x1b')](util[_0xbf71('0x6')]('[%s][calls][attendedtransfer]',_0x31d433[_0xbf71('0x33')]),_0x31d433);if(channels[_0x31d433[_0xbf71('0x32')]][_0xbf71('0x9')]==_0x31d433['transfereechannel']){utils['info'](util[_0xbf71('0x6')](_0xbf71('0x34'),_0x31d433['origtransfereruniqueid'],_0x31d433[_0xbf71('0x32')],_0x31d433[_0xbf71('0x35')]));channels[_0x31d433[_0xbf71('0x32')]][_0xbf71('0x24')]=_0x31d433['secondtransfererchannel'];channels[_0x31d433[_0xbf71('0x32')]]['userfield']=_0xbf71('0x36');}else if(channels[_0x31d433[_0xbf71('0x32')]]['channel']=_0x31d433[_0xbf71('0x37')]){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x34'),_0x31d433[_0xbf71('0x33')],_0x31d433[_0xbf71('0x32')],_0x31d433[_0xbf71('0x38')]));channels[_0x31d433[_0xbf71('0x32')]][_0xbf71('0x24')]=_0x31d433[_0xbf71('0x38')];channels[_0x31d433['localtwolinkedid']][_0xbf71('0x39')]=_0xbf71('0x36');}}}catch(_0x58e637){utils[_0xbf71('0x1a')](util['format'](_0xbf71('0x3a'),_0x31d433[_0xbf71('0x33')]),_0x58e637);}};exports['musiconholdstart']=function(_0x41b6bc){try{if(!_[_0xbf71('0x1d')](channels[_0x41b6bc[_0xbf71('0x8')]])){utils[_0xbf71('0x1b')](util[_0xbf71('0x6')](_0xbf71('0x3b'),_0x41b6bc['uniqueid']),_0x41b6bc);channels[_0x41b6bc[_0xbf71('0x8')]][_0xbf71('0x3c')]=utils['now']();utils[_0xbf71('0x5')](util[_0xbf71('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x41b6bc[_0xbf71('0x8')],channels[_0x41b6bc['uniqueid']][_0xbf71('0x3c')]));}}catch(_0x55d0c9){utils[_0xbf71('0x1a')](util[_0xbf71('0x6')]('[%s][calls][musiconholdstart]',_0x41b6bc['uniqueid']),_0x55d0c9);}};exports[_0xbf71('0x3d')]=function(_0x31f7d8){try{if(!_['isNil'](channels[_0x31f7d8[_0xbf71('0x8')]])){utils[_0xbf71('0x1b')](util['format']('[%s][calls][musiconholdstop]',_0x31f7d8[_0xbf71('0x8')]),_0x31f7d8);if(!_[_0xbf71('0x1d')](channels[_0x31f7d8[_0xbf71('0x8')]][_0xbf71('0x3c')])){channels[_0x31f7d8[_0xbf71('0x8')]][_0xbf71('0x3e')]+=utils[_0xbf71('0x2f')](utils[_0xbf71('0x18')](),channels[_0x31f7d8[_0xbf71('0x8')]]['musiconholdstartAt']);utils['info'](util['format'](_0xbf71('0x3f'),_0x31f7d8[_0xbf71('0x8')],channels[_0x31f7d8[_0xbf71('0x8')]][_0xbf71('0x3e')]));delete channels[_0x31f7d8['uniqueid']][_0xbf71('0x3c')];}}}catch(_0x52d402){utils[_0xbf71('0x1a')](util[_0xbf71('0x6')](_0xbf71('0x40'),_0x31f7d8[_0xbf71('0x8')]),_0x52d402);}};exports['varset']=function(_0x403188){try{if(!_[_0xbf71('0x1d')](channels[_0x403188[_0xbf71('0x8')]])){utils[_0xbf71('0x1b')](util['format'](_0xbf71('0x41'),_0x403188[_0xbf71('0x8')]),_0x403188);if(!_[_0xbf71('0x1d')](_0x403188['variable'][_0xbf71('0x42')])){utils[_0xbf71('0x5')](util['format'](_0xbf71('0x43'),_0x403188[_0xbf71('0x8')],_0x403188[_0xbf71('0x44')]));channels[_0x403188[_0xbf71('0x8')]]['source']=_0x403188[_0xbf71('0x44')];}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')][_0xbf71('0x46')])){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x47'),_0x403188[_0xbf71('0x8')],_0x403188[_0xbf71('0x44')]));channels[_0x403188['uniqueid']][_0xbf71('0x48')]=_0x403188[_0xbf71('0x44')];channels[_0x403188[_0xbf71('0x8')]][_0xbf71('0x29')]='\x22'+_0x403188[_0xbf71('0x44')]+'\x22\x20<'+_0x403188[_0xbf71('0x44')]+'>';}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')][_0xbf71('0x49')])||!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')]['xmd-callerid'])){utils['info'](util['format'](_0xbf71('0x4a'),_0x403188['uniqueid'],!_['isNil'](_0x403188[_0xbf71('0x45')][_0xbf71('0x49')])?_0xbf71('0x49'):'xmd-callerid',_0x403188[_0xbf71('0x44')]));channels[_0x403188[_0xbf71('0x8')]][_0xbf71('0x29')]=_0x403188[_0xbf71('0x44')];}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')][_0xbf71('0x4b')])||!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')][_0xbf71('0x4c')])){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x4a'),_0x403188[_0xbf71('0x8')],!_[_0xbf71('0x1d')](_0x403188['variable'][_0xbf71('0x4b')])?_0xbf71('0x4b'):_0xbf71('0x4c'),_0x403188['value']));channels[_0x403188['uniqueid']][_0xbf71('0x4d')]=_0xbf71('0x4e');channels[_0x403188['uniqueid']]['lastdata']=_0x403188['value'];channels[_0x403188[_0xbf71('0x8')]][_0xbf71('0x4f')]=!![];}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')][_0xbf71('0x50')])){utils['info'](util[_0xbf71('0x6')](_0xbf71('0x51'),_0x403188[_0xbf71('0x8')],_0x403188['value']));channels[_0x403188['uniqueid']]['ContactId']=_0x403188[_0xbf71('0x44')];}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')]['xmd-cdrtype'])){utils[_0xbf71('0x5')](util[_0xbf71('0x6')](_0xbf71('0x52'),_0x403188[_0xbf71('0x8')],_0x403188[_0xbf71('0x44')]));channels[_0x403188[_0xbf71('0x8')]][_0xbf71('0x53')]=_0x403188[_0xbf71('0x44')];}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')]['outboundrouteid'])){utils['info'](util[_0xbf71('0x6')](_0xbf71('0x54'),_0x403188['uniqueid'],_0x403188[_0xbf71('0x44')]));channels[_0x403188['uniqueid']][_0xbf71('0x55')]=_0x403188[_0xbf71('0x44')];}if(!_[_0xbf71('0x1d')](_0x403188[_0xbf71('0x45')][_0xbf71('0x56')])){utils[_0xbf71('0x5')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x403188[_0xbf71('0x8')],_0x403188[_0xbf71('0x44')]));channels[_0x403188['uniqueid']]['sipcallid']=_0x403188[_0xbf71('0x44')];}}}catch(_0x292ea8){utils[_0xbf71('0x1a')](util[_0xbf71('0x6')](_0xbf71('0x41'),_0x403188[_0xbf71('0x8')]),_0x292ea8);}};exports[_0xbf71('0x57')]=function(_0x39047c){try{if(!_[_0xbf71('0x1d')](channels[_0x39047c['uniqueid']])){utils[_0xbf71('0x1b')](util['format'](_0xbf71('0x58'),_0x39047c['uniqueid']),_0x39047c);utils[_0xbf71('0x5')](util['format'](_0xbf71('0x59'),_0x39047c[_0xbf71('0x8')],_0x39047c[_0xbf71('0x5a')],_0x39047c[_0xbf71('0x5b')]));if(_0x39047c[_0xbf71('0x5a')][_0xbf71('0x5c')]()=='set'&&_[_0xbf71('0x5d')](_0x39047c[_0xbf71('0x5b')]['toLowerCase'](),_0xbf71('0x5e'))){var _0x4f06e6=_0x39047c[_0xbf71('0x5b')][_0xbf71('0x5f')]('=');var _0x39fbd4=_0x4f06e6[0x0]['substring'](_0x4f06e6[0x0]['lastIndexOf']('(')+0x1,_0x4f06e6[0x0][_0xbf71('0x60')](')'));var _0x1e8c63=_0x4f06e6[0x1];channels[_0x39047c[_0xbf71('0x8')]][_0x39fbd4]=_0x1e8c63;}if(!_[_0xbf71('0x61')]([_0xbf71('0x62'),_0xbf71('0x63'),_0xbf71('0x64'),'set',_0xbf71('0x65')],_0x39047c[_0xbf71('0x5a')][_0xbf71('0x5c')]())){channels[_0x39047c[_0xbf71('0x8')]][_0xbf71('0x4d')]=_0x39047c['application'];channels[_0x39047c['uniqueid']]['lastdata']=_0x39047c[_0xbf71('0x5b')];}}}catch(_0x4beb8c){utils['error'](util[_0xbf71('0x6')](_0xbf71('0x58'),_0x39047c[_0xbf71('0x8')]),_0x4beb8c);}}; \ No newline at end of file +var _0x0de8=['source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lastdata','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','uniqueid','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','context','channel','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x5f13c7,_0x4b0f7b){var _0x348082=function(_0x4e42ac){while(--_0x4e42ac){_0x5f13c7['push'](_0x5f13c7['shift']());}};_0x348082(++_0x4b0f7b);}(_0x0de8,0x96));var _0x80de=function(_0x297fe8,_0x2c9c7e){_0x297fe8=_0x297fe8-0x0;var _0x337023=_0x0de8[_0x297fe8];return _0x337023;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var utils=require('./utils');var dispositions=[_0x80de('0x2'),_0x80de('0x3'),_0x80de('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x80de('0x2'),_0x80de('0x4'),_0x80de('0x5'),'FAILED',_0x80de('0x3'),_0x80de('0x3')];var channels={};function writeDB(_0x4994b9){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x8'),_0x4994b9['uniqueid'],_0x4994b9['channel'],_0x4994b9['queue'],_0x4994b9[_0x80de('0x9')],_0x4994b9[_0x80de('0xa')],_0x4994b9[_0x80de('0xb')],_0x4994b9['connectedlinenum'],_0x4994b9[_0x80de('0xc')]));if(_0x4994b9[_0x80de('0xd')]){utils[_0x80de('0xe')](_0x4994b9[_0x80de('0xd')])[_0x80de('0xf')](function(_0x5359b8){if(_0x5359b8){_0x4994b9[_0x80de('0x10')]=_0x5359b8['id'];}utils['request'](_0x80de('0x11'),_0x4994b9);});}else{utils[_0x80de('0x12')](_0x80de('0x11'),_0x4994b9);}if(channels[_0x4994b9['uniqueid']]){delete channels[_0x4994b9[_0x80de('0x13')]];}}exports[_0x80de('0x14')]=function(_0xd7e62f){try{utils['debug'](util[_0x80de('0x7')](_0x80de('0x15'),_0xd7e62f[_0x80de('0x13')]),_0xd7e62f);if(_0xd7e62f[_0x80de('0x13')]==_0xd7e62f[_0x80de('0x16')]&&_0xd7e62f['channel']!=_0x80de('0x17')){utils[_0x80de('0x6')](util[_0x80de('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0xd7e62f[_0x80de('0x13')],_0xd7e62f['context'],_0xd7e62f[_0x80de('0x18')]));channels[_0xd7e62f['uniqueid']]={'uniqueid':_0xd7e62f[_0x80de('0x13')],'accountcode':_0xd7e62f[_0x80de('0xd')],'source':_0xd7e62f[_0x80de('0xb')],'destination':_0xd7e62f[_0x80de('0x18')],'destinationcontext':_0xd7e62f[_0x80de('0x19')],'channel':_0xd7e62f[_0x80de('0x1a')],'starttime':utils[_0x80de('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x80de('0x2'),'amaflags':_0x80de('0x1c')};}}catch(_0x4876e3){utils['error'](util[_0x80de('0x7')](_0x80de('0x15'),_0xd7e62f['uniqueid']),_0x4876e3);}};exports[_0x80de('0x1d')]=function(_0x26ca4d){try{utils[_0x80de('0x1e')](util[_0x80de('0x7')](_0x80de('0x1f'),_0x26ca4d[_0x80de('0x13')]),_0x26ca4d);if(!_[_0x80de('0x20')](channels[_0x26ca4d[_0x80de('0x13')]])&&_0x26ca4d[_0x80de('0x21')]==0x6){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x22'),_0x26ca4d[_0x80de('0x13')],_0x26ca4d[_0x80de('0x19')],_0x26ca4d['channel']));if(_['isNil'](channels[_0x26ca4d[_0x80de('0x13')]][_0x80de('0x23')])){channels[_0x26ca4d[_0x80de('0x13')]][_0x80de('0x23')]=utils[_0x80de('0x1b')]();}}else if(!_[_0x80de('0x20')](channels[_0x26ca4d[_0x80de('0x16')]])&&_0x26ca4d[_0x80de('0x21')]==0x6&&_0x26ca4d['context']!=_0x80de('0x24')){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x25'),_0x26ca4d['uniqueid'],_0x26ca4d['linkedid'],_0x26ca4d[_0x80de('0x19')],_0x26ca4d['channel']));channels[_0x26ca4d[_0x80de('0x16')]][_0x80de('0xd')]=_0x26ca4d[_0x80de('0xd')];channels[_0x26ca4d[_0x80de('0x16')]][_0x80de('0x26')]=_0x26ca4d[_0x80de('0x1a')];if(_[_0x80de('0x20')](channels[_0x26ca4d[_0x80de('0x16')]]['answertime'])){channels[_0x26ca4d[_0x80de('0x16')]][_0x80de('0x27')]=utils[_0x80de('0x1b')]();}channels[_0x26ca4d[_0x80de('0x16')]]['disposition']=dispositions[_['toNumber'](_0x26ca4d['channelstate'])]||'ANSWERED';}}catch(_0x362911){utils[_0x80de('0x28')](util['format'](_0x80de('0x1f'),_0x26ca4d['uniqueid']),_0x362911);}};exports[_0x80de('0x29')]=function(_0x29c2a8){try{if(!_[_0x80de('0x20')](channels[_0x29c2a8[_0x80de('0x13')]])){utils['debug'](util['format'](_0x80de('0x2a'),_0x29c2a8[_0x80de('0x13')]),_0x29c2a8);if(_['isNil'](channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x2b')])){channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x2b')]=_0x29c2a8[_0x80de('0x2c')]+'\x20<'+_0x29c2a8[_0x80de('0xb')]+'>';}utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x2d'),_0x29c2a8[_0x80de('0x13')],channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x2b')],_0x29c2a8['cause-txt']));channels[_0x29c2a8['uniqueid']][_0x80de('0x2e')]=utils['now']();channels[_0x29c2a8['uniqueid']][_0x80de('0x2f')]=utils[_0x80de('0x30')](channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x2e')],channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x31')]);channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x32')]=channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x27')]?utils[_0x80de('0x30')](channels[_0x29c2a8[_0x80de('0x13')]]['endtime'],channels[_0x29c2a8[_0x80de('0x13')]][_0x80de('0x27')]):0x0;writeDB(channels[_0x29c2a8[_0x80de('0x13')]]);}}catch(_0x52c813){utils[_0x80de('0x28')](util[_0x80de('0x7')](_0x80de('0x2a'),_0x29c2a8['uniqueid']),_0x52c813);}};exports['attendedtransfer']=function(_0x14b02e){try{if(!_[_0x80de('0x20')](channels[_0x14b02e[_0x80de('0x33')]])){utils['debug'](util[_0x80de('0x7')](_0x80de('0x34'),_0x14b02e[_0x80de('0x35')]),_0x14b02e);if(channels[_0x14b02e[_0x80de('0x33')]][_0x80de('0x1a')]==_0x14b02e[_0x80de('0x36')]){utils['info'](util[_0x80de('0x7')](_0x80de('0x37'),_0x14b02e[_0x80de('0x35')],_0x14b02e['localtwolinkedid'],_0x14b02e[_0x80de('0x38')]));channels[_0x14b02e['localtwolinkedid']][_0x80de('0x26')]=_0x14b02e[_0x80de('0x38')];channels[_0x14b02e[_0x80de('0x33')]][_0x80de('0x39')]=_0x80de('0x3a');}else if(channels[_0x14b02e['localtwolinkedid']][_0x80de('0x1a')]=_0x14b02e[_0x80de('0x3b')]){utils['info'](util[_0x80de('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x14b02e[_0x80de('0x35')],_0x14b02e[_0x80de('0x33')],_0x14b02e[_0x80de('0x3c')]));channels[_0x14b02e[_0x80de('0x33')]][_0x80de('0x26')]=_0x14b02e[_0x80de('0x3c')];channels[_0x14b02e[_0x80de('0x33')]][_0x80de('0x39')]=_0x80de('0x3a');}}}catch(_0x3b2699){utils[_0x80de('0x28')](util[_0x80de('0x7')](_0x80de('0x34'),_0x14b02e[_0x80de('0x35')]),_0x3b2699);}};exports[_0x80de('0x3d')]=function(_0x5f35f6){try{if(!_['isNil'](channels[_0x5f35f6[_0x80de('0x13')]])){utils[_0x80de('0x1e')](util[_0x80de('0x7')](_0x80de('0x3e'),_0x5f35f6[_0x80de('0x13')]),_0x5f35f6);channels[_0x5f35f6[_0x80de('0x13')]]['musiconholdstartAt']=utils[_0x80de('0x1b')]();utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x3f'),_0x5f35f6['uniqueid'],channels[_0x5f35f6[_0x80de('0x13')]]['musiconholdstartAt']));}}catch(_0x4e29aa){utils[_0x80de('0x28')](util[_0x80de('0x7')]('[%s][calls][musiconholdstart]',_0x5f35f6['uniqueid']),_0x4e29aa);}};exports['musiconholdstop']=function(_0x586702){try{if(!_[_0x80de('0x20')](channels[_0x586702[_0x80de('0x13')]])){utils[_0x80de('0x1e')](util[_0x80de('0x7')](_0x80de('0x40'),_0x586702[_0x80de('0x13')]),_0x586702);if(!_[_0x80de('0x20')](channels[_0x586702[_0x80de('0x13')]]['musiconholdstartAt'])){channels[_0x586702[_0x80de('0x13')]][_0x80de('0x41')]+=utils[_0x80de('0x30')](utils[_0x80de('0x1b')](),channels[_0x586702['uniqueid']][_0x80de('0x42')]);utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x43'),_0x586702[_0x80de('0x13')],channels[_0x586702[_0x80de('0x13')]]['mohtime']));delete channels[_0x586702[_0x80de('0x13')]][_0x80de('0x42')];}}}catch(_0x5c9daf){utils['error'](util[_0x80de('0x7')](_0x80de('0x40'),_0x586702[_0x80de('0x13')]),_0x5c9daf);}};exports[_0x80de('0x44')]=function(_0x4b61c1){try{if(!_[_0x80de('0x20')](channels[_0x4b61c1['uniqueid']])){utils[_0x80de('0x1e')](util[_0x80de('0x7')](_0x80de('0x45'),_0x4b61c1['uniqueid']),_0x4b61c1);if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x47')])){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x48'),_0x4b61c1['uniqueid'],_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x4a')]=_0x4b61c1[_0x80de('0x49')];}if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x4b')])){utils[_0x80de('0x6')](util['format'](_0x80de('0x4c'),_0x4b61c1['uniqueid'],_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x4d')]=_0x4b61c1[_0x80de('0x49')];channels[_0x4b61c1[_0x80de('0x13')]]['callerid']='\x22'+_0x4b61c1[_0x80de('0x49')]+_0x80de('0x4e')+_0x4b61c1[_0x80de('0x49')]+'>';}if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x4f')])||!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x50')])){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x51'),_0x4b61c1['uniqueid'],!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x4f')])?_0x80de('0x4f'):_0x80de('0x50'),_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x2b')]=_0x4b61c1[_0x80de('0x49')];}if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')]['xmd-queue'])||!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x52')])){utils[_0x80de('0x6')](util['format'](_0x80de('0x51'),_0x4b61c1[_0x80de('0x13')],!_['isNil'](_0x4b61c1[_0x80de('0x46')][_0x80de('0x53')])?'xmd-queue':_0x80de('0x52'),_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x54')]=_0x80de('0x55');channels[_0x4b61c1[_0x80de('0x13')]]['lastdata']=_0x4b61c1[_0x80de('0x49')];channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x56')]=!![];}if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x57')])){utils[_0x80de('0x6')](util['format'](_0x80de('0x58'),_0x4b61c1[_0x80de('0x13')],_0x4b61c1['value']));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x59')]=_0x4b61c1['value'];}if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')][_0x80de('0x5a')])){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x5b'),_0x4b61c1['uniqueid'],_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x5c')]=_0x4b61c1['value'];}if(!_['isNil'](_0x4b61c1['variable'][_0x80de('0x5d')])){utils[_0x80de('0x6')](util[_0x80de('0x7')](_0x80de('0x5e'),_0x4b61c1[_0x80de('0x13')],_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1['uniqueid']]['routeid']=_0x4b61c1[_0x80de('0x49')];}if(!_[_0x80de('0x20')](_0x4b61c1[_0x80de('0x46')]['sipcallid'])){utils['info'](util[_0x80de('0x7')](_0x80de('0x5f'),_0x4b61c1['uniqueid'],_0x4b61c1[_0x80de('0x49')]));channels[_0x4b61c1[_0x80de('0x13')]][_0x80de('0x60')]=_0x4b61c1[_0x80de('0x49')];}}}catch(_0x34f58b){utils[_0x80de('0x28')](util['format'](_0x80de('0x45'),_0x4b61c1[_0x80de('0x13')]),_0x34f58b);}};exports['newexten']=function(_0x54daf6){try{if(!_[_0x80de('0x20')](channels[_0x54daf6['uniqueid']])){utils['debug'](util['format']('[%s][calls][newexten]',_0x54daf6[_0x80de('0x13')]),_0x54daf6);utils[_0x80de('0x6')](util['format'](_0x80de('0x61'),_0x54daf6['uniqueid'],_0x54daf6[_0x80de('0x62')],_0x54daf6[_0x80de('0x63')]));if(_0x54daf6['application'][_0x80de('0x64')]()=='set'&&_[_0x80de('0x65')](_0x54daf6['appdata'][_0x80de('0x64')](),_0x80de('0x66'))){var _0x2b091b=_0x54daf6[_0x80de('0x63')][_0x80de('0x67')]('=');var _0xbc76c0=_0x2b091b[0x0][_0x80de('0x68')](_0x2b091b[0x0][_0x80de('0x69')]('(')+0x1,_0x2b091b[0x0][_0x80de('0x69')](')'));var _0x17ba57=_0x2b091b[0x1];channels[_0x54daf6['uniqueid']][_0xbc76c0]=_0x17ba57;}if(!_[_0x80de('0x6a')]([_0x80de('0x29'),_0x80de('0x6b'),_0x80de('0x6c'),_0x80de('0x6d'),_0x80de('0x6e')],_0x54daf6[_0x80de('0x62')][_0x80de('0x64')]())){channels[_0x54daf6[_0x80de('0x13')]][_0x80de('0x54')]=_0x54daf6['application'];channels[_0x54daf6[_0x80de('0x13')]][_0x80de('0x6f')]=_0x54daf6[_0x80de('0x63')];}}}catch(_0x1f7840){utils['error'](util['format']('[%s][calls][newexten]',_0x54daf6[_0x80de('0x13')]),_0x1f7840);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index f687143..9a6b4a0 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 _0xd482=['connect','info','fullybooted','error','[core]\x20error','[core]\x20close','./utils'];(function(_0x249b65,_0x459d67){var _0x4fac1c=function(_0x5ddb3a){while(--_0x5ddb3a){_0x249b65['push'](_0x249b65['shift']());}};_0x4fac1c(++_0x459d67);}(_0xd482,0x156));var _0x2d48=function(_0x120cfc,_0x472578){_0x120cfc=_0x120cfc-0x0;var _0x59ec43=_0xd482[_0x120cfc];return _0x59ec43;};'use strict';var utils=require(_0x2d48('0x0'));exports[_0x2d48('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils[_0x2d48('0x2')]('[core]\x20shutdown');};exports[_0x2d48('0x3')]=function(){utils[_0x2d48('0x2')]('[core]\x20fullybooted');};exports[_0x2d48('0x4')]=function(_0x4566d1){utils['error'](_0x2d48('0x5'),_0x4566d1);};exports['close']=function(){utils[_0x2d48('0x2')](_0x2d48('0x6'));};exports['managerevent']=function(_0x93047b){}; \ No newline at end of file +var _0x453e=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x453e,0x8a));var _0xe453=function(_0x5d7ff4,_0x1384c1){_0x5d7ff4=_0x5d7ff4-0x0;var _0x3edd41=_0x453e[_0x5d7ff4];return _0x3edd41;};'use strict';var utils=require(_0xe453('0x0'));exports[_0xe453('0x1')]=function(){utils['info'](_0xe453('0x2'));};exports[_0xe453('0x3')]=function(){utils['info'](_0xe453('0x4'));};exports[_0xe453('0x5')]=function(){utils[_0xe453('0x6')](_0xe453('0x7'));};exports['error']=function(_0x358f32){utils[_0xe453('0x8')](_0xe453('0x9'),_0x358f32);};exports[_0xe453('0xa')]=function(){utils[_0xe453('0x6')](_0xe453('0xb'));};exports[_0xe453('0xc')]=function(_0x138ad0){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 16db9bf..6f47c85 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 _0xbc44=['hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','holdtime','endtime','billableseconds','lodash','./utils','format','uniqueid','channel','calleridnum','dialstatus','request','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s'];(function(_0x11de63,_0x310b77){var _0x218cb4=function(_0x2dc923){while(--_0x2dc923){_0x11de63['push'](_0x11de63['shift']());}};_0x218cb4(++_0x310b77);}(_0xbc44,0x14c));var _0x4bc4=function(_0x359dc1,_0x2cff14){_0x359dc1=_0x359dc1-0x0;var _0x560d12=_0xbc44[_0x359dc1];return _0x560d12;};'use strict';var _=require(_0x4bc4('0x0'));var util=require('util');var utils=require(_0x4bc4('0x1'));var dials={};function writeDB(_0x358d74){utils['info'](util[_0x4bc4('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x358d74[_0x4bc4('0x3')],_0x358d74[_0x4bc4('0x4')],_0x358d74['dialstring'],_0x358d74[_0x4bc4('0x5')],_0x358d74['connectedlinenum'],_0x358d74[_0x4bc4('0x6')]));utils[_0x4bc4('0x7')]('CreateVoiceDialReport',_0x358d74);delete dials[_0x358d74['uniqueid']];}exports['newexten']=function(_0x2dda38){try{utils[_0x4bc4('0x8')](util[_0x4bc4('0x2')]('[%s][dials][newexten]',_0x2dda38[_0x4bc4('0x3')]),_0x2dda38);utils[_0x4bc4('0x9')](util[_0x4bc4('0x2')](_0x4bc4('0xa'),_0x2dda38['uniqueid'],_0x2dda38[_0x4bc4('0xb')],_0x2dda38[_0x4bc4('0xc')]));if(_0x2dda38[_0x4bc4('0xb')][_0x4bc4('0xd')]()=='set'&&_[_0x4bc4('0xe')](_0x2dda38[_0x4bc4('0xc')][_0x4bc4('0xd')](),'cdr(routeid)')){var _0x3345b7=_0x2dda38[_0x4bc4('0xc')][_0x4bc4('0xf')]('=');dials[_0x2dda38[_0x4bc4('0x3')]]={'routeId':_0x3345b7[0x1]};}}catch(_0x44ffd5){utils['error'](util['format'](_0x4bc4('0x10'),_0x2dda38[_0x4bc4('0x3')]),_0x44ffd5);}};exports[_0x4bc4('0x11')]=function(_0x5e9a93){try{utils['debug'](util[_0x4bc4('0x2')](_0x4bc4('0x12'),_0x5e9a93[_0x4bc4('0x3')]),_0x5e9a93);if(!_[_0x4bc4('0x13')](_0x5e9a93[_0x4bc4('0x14')]['outboundrouteid'])){utils[_0x4bc4('0x9')](util[_0x4bc4('0x2')](_0x4bc4('0x15'),_0x5e9a93['uniqueid'],_0x5e9a93[_0x4bc4('0x16')]));dials[_0x5e9a93['uniqueid']]={'routeId':_0x5e9a93[_0x4bc4('0x16')]};}}catch(_0x1d7c5a){utils[_0x4bc4('0x17')](util['format'](_0x4bc4('0x12'),_0x5e9a93[_0x4bc4('0x3')]),_0x1d7c5a);}};exports[_0x4bc4('0x18')]=function(_0x137bb2){try{if(!_[_0x4bc4('0x13')](dials[_0x137bb2[_0x4bc4('0x3')]])){utils[_0x4bc4('0x8')](util[_0x4bc4('0x2')](_0x4bc4('0x19'),_0x137bb2[_0x4bc4('0x3')]),_0x137bb2);dials[_0x137bb2[_0x4bc4('0x3')]]=_[_0x4bc4('0x1a')](dials[_0x137bb2[_0x4bc4('0x3')]],_0x137bb2);dials[_0x137bb2[_0x4bc4('0x3')]][_0x4bc4('0x1b')]=utils[_0x4bc4('0x1c')]();dials[_0x137bb2['uniqueid']]['lastevent']='called';utils[_0x4bc4('0x9')](util[_0x4bc4('0x2')](_0x4bc4('0x1d'),_0x137bb2['uniqueid'],dials[_0x137bb2[_0x4bc4('0x3')]][_0x4bc4('0x1b')]));}}catch(_0x3b1d17){utils[_0x4bc4('0x17')](util['format'](_0x4bc4('0x19'),_0x137bb2['uniqueid']),_0x3b1d17);}};exports[_0x4bc4('0x1e')]=function(_0x1edaec){try{if(!_[_0x4bc4('0x13')](dials[_0x1edaec[_0x4bc4('0x3')]])){utils['debug'](util[_0x4bc4('0x2')]('[%s][dials][dialend]',_0x1edaec[_0x4bc4('0x3')]),_0x1edaec);dials[_0x1edaec[_0x4bc4('0x3')]][_0x4bc4('0x6')]=_0x1edaec['dialstatus'];if(_0x1edaec[_0x4bc4('0x6')]=='ANSWER'){dials[_0x1edaec[_0x4bc4('0x3')]]=_[_0x4bc4('0x1a')](dials[_0x1edaec[_0x4bc4('0x3')]],_0x1edaec);dials[_0x1edaec['uniqueid']][_0x4bc4('0x1f')]=utils[_0x4bc4('0x1c')]();dials[_0x1edaec[_0x4bc4('0x3')]][_0x4bc4('0x20')]=_0x4bc4('0x21');utils['info'](util[_0x4bc4('0x2')](_0x4bc4('0x22'),_0x1edaec[_0x4bc4('0x3')],_0x1edaec[_0x4bc4('0x6')],dials[_0x1edaec[_0x4bc4('0x3')]][_0x4bc4('0x1f')]));}else{utils[_0x4bc4('0x9')](util[_0x4bc4('0x2')](_0x4bc4('0x23'),_0x1edaec[_0x4bc4('0x3')],_0x1edaec[_0x4bc4('0x6')]));}}}catch(_0x187281){utils[_0x4bc4('0x17')](util[_0x4bc4('0x2')]('[%s][dials][dialend]',_0x1edaec[_0x4bc4('0x3')]),_0x187281);}};exports[_0x4bc4('0x24')]=function(_0x197a96){try{if(!_[_0x4bc4('0x13')](dials[_0x197a96['uniqueid']])){utils[_0x4bc4('0x8')](util['format'](_0x4bc4('0x25'),_0x197a96[_0x4bc4('0x3')]),_0x197a96);utils[_0x4bc4('0x9')](util[_0x4bc4('0x2')](_0x4bc4('0x26'),_0x197a96['uniqueid'],_0x197a96[_0x4bc4('0x5')],_0x197a96[_0x4bc4('0x27')],_0x197a96[_0x4bc4('0x28')]));dials[_0x197a96[_0x4bc4('0x3')]]=_[_0x4bc4('0x1a')](dials[_0x197a96[_0x4bc4('0x3')]],{'endtime':utils[_0x4bc4('0x1c')](),'lastevent':'complete'});dials[_0x197a96[_0x4bc4('0x3')]][_0x4bc4('0x29')]=utils[_0x4bc4('0x2a')](dials[_0x197a96[_0x4bc4('0x3')]]['endtime'],dials[_0x197a96[_0x4bc4('0x3')]]['starttime']);dials[_0x197a96[_0x4bc4('0x3')]][_0x4bc4('0x2b')]=utils['diffTime'](dials[_0x197a96[_0x4bc4('0x3')]][_0x4bc4('0x1f')]||dials[_0x197a96[_0x4bc4('0x3')]][_0x4bc4('0x2c')],dials[_0x197a96['uniqueid']][_0x4bc4('0x1b')]);dials[_0x197a96['uniqueid']][_0x4bc4('0x2d')]=dials[_0x197a96['uniqueid']][_0x4bc4('0x1f')]?utils['diffTime'](dials[_0x197a96[_0x4bc4('0x3')]][_0x4bc4('0x2c')],dials[_0x197a96[_0x4bc4('0x3')]]['answertime']):0x0;writeDB(dials[_0x197a96['uniqueid']]);}}catch(_0x5abefb){utils[_0x4bc4('0x17')](util[_0x4bc4('0x2')](_0x4bc4('0x25'),_0x197a96[_0x4bc4('0x3')]),_0x5abefb);}}; \ No newline at end of file +var _0x279f=['now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','connectedlinenum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','uniqueid','application','appdata','set','startsWith','toLowerCase','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign'];(function(_0x3aa4b3,_0x17759f){var _0x1f8da7=function(_0x469b4d){while(--_0x469b4d){_0x3aa4b3['push'](_0x3aa4b3['shift']());}};_0x1f8da7(++_0x17759f);}(_0x279f,0x1ce));var _0xf279=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x279f[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xf279('0x0'));var util=require('util');var utils=require(_0xf279('0x1'));var dials={};function writeDB(_0x4b2df2){utils[_0xf279('0x2')](util[_0xf279('0x3')](_0xf279('0x4'),_0x4b2df2['uniqueid'],_0x4b2df2[_0xf279('0x5')],_0x4b2df2['dialstring'],_0x4b2df2['calleridnum'],_0x4b2df2[_0xf279('0x6')],_0x4b2df2['dialstatus']));utils['request'](_0xf279('0x7'),_0x4b2df2);delete dials[_0x4b2df2['uniqueid']];}exports[_0xf279('0x8')]=function(_0x510b4c){try{utils[_0xf279('0x9')](util[_0xf279('0x3')](_0xf279('0xa'),_0x510b4c['uniqueid']),_0x510b4c);utils[_0xf279('0x2')](util[_0xf279('0x3')](_0xf279('0xb'),_0x510b4c[_0xf279('0xc')],_0x510b4c[_0xf279('0xd')],_0x510b4c[_0xf279('0xe')]));if(_0x510b4c[_0xf279('0xd')]['toLowerCase']()==_0xf279('0xf')&&_[_0xf279('0x10')](_0x510b4c[_0xf279('0xe')][_0xf279('0x11')](),'cdr(routeid)')){var _0x51d00a=_0x510b4c[_0xf279('0xe')][_0xf279('0x12')]('=');dials[_0x510b4c['uniqueid']]={'routeId':_0x51d00a[0x1]};}}catch(_0x560cab){utils[_0xf279('0x13')](util[_0xf279('0x3')](_0xf279('0xa'),_0x510b4c[_0xf279('0xc')]),_0x560cab);}};exports['varset']=function(_0xea0867){try{utils[_0xf279('0x9')](util['format'](_0xf279('0x14'),_0xea0867[_0xf279('0xc')]),_0xea0867);if(!_[_0xf279('0x15')](_0xea0867[_0xf279('0x16')][_0xf279('0x17')])){utils[_0xf279('0x2')](util[_0xf279('0x3')](_0xf279('0x18'),_0xea0867[_0xf279('0xc')],_0xea0867[_0xf279('0x19')]));dials[_0xea0867[_0xf279('0xc')]]={'routeId':_0xea0867[_0xf279('0x19')]};}}catch(_0x9d5855){utils[_0xf279('0x13')](util[_0xf279('0x3')]('[%s][dials][varset]',_0xea0867['uniqueid']),_0x9d5855);}};exports[_0xf279('0x1a')]=function(_0x200a1d){try{if(!_[_0xf279('0x15')](dials[_0x200a1d['uniqueid']])){utils[_0xf279('0x9')](util[_0xf279('0x3')]('[%s][dials][dialbegin]',_0x200a1d[_0xf279('0xc')]),_0x200a1d);dials[_0x200a1d[_0xf279('0xc')]]=_[_0xf279('0x1b')](dials[_0x200a1d[_0xf279('0xc')]],_0x200a1d);dials[_0x200a1d[_0xf279('0xc')]]['starttime']=utils[_0xf279('0x1c')]();dials[_0x200a1d[_0xf279('0xc')]]['lastevent']=_0xf279('0x1d');utils[_0xf279('0x2')](util[_0xf279('0x3')](_0xf279('0x1e'),_0x200a1d[_0xf279('0xc')],dials[_0x200a1d['uniqueid']][_0xf279('0x1f')]));}}catch(_0x49b400){utils['error'](util[_0xf279('0x3')](_0xf279('0x20'),_0x200a1d[_0xf279('0xc')]),_0x49b400);}};exports[_0xf279('0x21')]=function(_0xa3dd11){try{if(!_[_0xf279('0x15')](dials[_0xa3dd11[_0xf279('0xc')]])){utils[_0xf279('0x9')](util['format'](_0xf279('0x22'),_0xa3dd11[_0xf279('0xc')]),_0xa3dd11);dials[_0xa3dd11[_0xf279('0xc')]][_0xf279('0x23')]=_0xa3dd11[_0xf279('0x23')];if(_0xa3dd11['dialstatus']==_0xf279('0x24')){dials[_0xa3dd11[_0xf279('0xc')]]=_['assign'](dials[_0xa3dd11[_0xf279('0xc')]],_0xa3dd11);dials[_0xa3dd11[_0xf279('0xc')]][_0xf279('0x25')]=utils[_0xf279('0x1c')]();dials[_0xa3dd11[_0xf279('0xc')]][_0xf279('0x26')]='connect';utils[_0xf279('0x2')](util[_0xf279('0x3')](_0xf279('0x27'),_0xa3dd11[_0xf279('0xc')],_0xa3dd11['dialstatus'],dials[_0xa3dd11[_0xf279('0xc')]]['answertime']));}else{utils[_0xf279('0x2')](util[_0xf279('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0xa3dd11[_0xf279('0xc')],_0xa3dd11[_0xf279('0x23')]));}}}catch(_0xf1aa7c){utils[_0xf279('0x13')](util[_0xf279('0x3')](_0xf279('0x22'),_0xa3dd11[_0xf279('0xc')]),_0xf1aa7c);}};exports[_0xf279('0x28')]=function(_0x3c8afc){try{if(!_[_0xf279('0x15')](dials[_0x3c8afc[_0xf279('0xc')]])){utils[_0xf279('0x9')](util[_0xf279('0x3')](_0xf279('0x29'),_0x3c8afc['uniqueid']),_0x3c8afc);utils[_0xf279('0x2')](util[_0xf279('0x3')](_0xf279('0x2a'),_0x3c8afc[_0xf279('0xc')],_0x3c8afc['calleridnum'],_0x3c8afc['calleridname'],_0x3c8afc[_0xf279('0x2b')]));dials[_0x3c8afc[_0xf279('0xc')]]=_['assign'](dials[_0x3c8afc[_0xf279('0xc')]],{'endtime':utils['now'](),'lastevent':_0xf279('0x2c')});dials[_0x3c8afc[_0xf279('0xc')]][_0xf279('0x2d')]=utils[_0xf279('0x2e')](dials[_0x3c8afc[_0xf279('0xc')]]['endtime'],dials[_0x3c8afc['uniqueid']][_0xf279('0x1f')]);dials[_0x3c8afc[_0xf279('0xc')]][_0xf279('0x2f')]=utils[_0xf279('0x2e')](dials[_0x3c8afc[_0xf279('0xc')]][_0xf279('0x25')]||dials[_0x3c8afc[_0xf279('0xc')]][_0xf279('0x30')],dials[_0x3c8afc[_0xf279('0xc')]][_0xf279('0x1f')]);dials[_0x3c8afc['uniqueid']]['billableseconds']=dials[_0x3c8afc[_0xf279('0xc')]][_0xf279('0x25')]?utils[_0xf279('0x2e')](dials[_0x3c8afc['uniqueid']]['endtime'],dials[_0x3c8afc['uniqueid']]['answertime']):0x0;writeDB(dials[_0x3c8afc[_0xf279('0xc')]]);}}catch(_0x379494){utils[_0xf279('0x13')](util[_0xf279('0x3')](_0xf279('0x29'),_0x3c8afc['uniqueid']),_0x379494);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9bfa05b..89ad0de 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 _0xeda3=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','production','local','asterisk','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0xa9d7ad,_0x949281){var _0xa8f05e=function(_0xce879f){while(--_0xce879f){_0xa9d7ad['push'](_0xa9d7ad['shift']());}};_0xa8f05e(++_0x949281);}(_0xeda3,0x17f));var _0x3eda=function(_0x4f335b,_0x360312){_0x4f335b=_0x4f335b-0x0;var _0x1666bd=_0xeda3[_0x4f335b];return _0x1666bd;};var AsteriskManager=require(_0x3eda('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x3eda('0x1'));var isXDREnabled=config['xdr']&&config[_0x3eda('0x2')][_0x3eda('0x3')]?!config[_0x3eda('0x2')][_0x3eda('0x3')]:!![];var isProduction=config['env']===_0x3eda('0x4')||![];var isLocalAsterisk=config[_0x3eda('0x2')]&&config[_0x3eda('0x2')][_0x3eda('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x3eda('0x6')]['port'],config[_0x3eda('0x6')]['ip'],config[_0x3eda('0x6')][_0x3eda('0x7')],config['asterisk'][_0x3eda('0x8')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x3eda('0x9')](_0x3eda('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x3eda('0x9')](_0x3eda('0xb'));}else{var agents=require(_0x3eda('0xc'));var calls=require(_0x3eda('0xd'));var queues=require('./queues.controller');var recordings=require(_0x3eda('0xe'));var members=require(_0x3eda('0xf'));var dials=require(_0x3eda('0x10'));var transfers=require(_0x3eda('0x11'));var core=require(_0x3eda('0x12'));ami['on'](_0x3eda('0x13'),core[_0x3eda('0x13')]);ami['on'](_0x3eda('0x14'),core[_0x3eda('0x14')]);ami['on'](_0x3eda('0x15'),core[_0x3eda('0x15')]);ami['on'](_0x3eda('0x16'),core[_0x3eda('0x16')]);ami['on'](_0x3eda('0x17'),core[_0x3eda('0x17')]);ami['on'](_0x3eda('0x18'),core[_0x3eda('0x18')]);ami['on'](_0x3eda('0x19'),function(_0x24397a){try{utils[_0x3eda('0x1a')](util['format'](_0x3eda('0x1b'),_0x24397a[_0x3eda('0x1c')]),_0x24397a);members[_0x3eda('0x19')](_0x24397a);}catch(_0x217545){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')]('[%s][index][devicestatechange]',_0x24397a['device']),_0x217545);}});ami['on']('agentcalled',function(_0x564198){try{utils[_0x3eda('0x1a')](util['format'](_0x3eda('0x1e'),_0x564198[_0x3eda('0x1f')]),_0x564198);agents[_0x3eda('0x20')](_0x564198);}catch(_0x1099ce){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')]('[%s][index][agentcalled]',_0x564198[_0x3eda('0x1f')]),_0x1099ce);}});ami['on'](_0x3eda('0x21'),function(_0x1672c4){try{utils[_0x3eda('0x1a')](util['format'](_0x3eda('0x22'),_0x1672c4[_0x3eda('0x1f')]),_0x1672c4);agents[_0x3eda('0x21')](_0x1672c4);}catch(_0x4192df){utils['error'](util[_0x3eda('0x1d')]('[%s][index][agentringnoanswer]',_0x1672c4[_0x3eda('0x1f')]),_0x4192df);}});ami['on'](_0x3eda('0x23'),function(_0x43c4f0){try{utils[_0x3eda('0x1a')](util['format'](_0x3eda('0x24'),_0x43c4f0[_0x3eda('0x1f')]),_0x43c4f0);agents[_0x3eda('0x23')](_0x43c4f0);queues[_0x3eda('0x23')](_0x43c4f0);}catch(_0x145893){utils[_0x3eda('0x16')](util['format'](_0x3eda('0x24'),_0x43c4f0[_0x3eda('0x1f')]),_0x145893);}});ami['on'](_0x3eda('0x25'),function(_0x440b0c){try{utils[_0x3eda('0x1a')](util['format'](_0x3eda('0x26'),_0x440b0c[_0x3eda('0x1f')]),_0x440b0c);agents['agentcomplete'](_0x440b0c);queues[_0x3eda('0x25')](_0x440b0c);members[_0x3eda('0x25')](_0x440b0c);}catch(_0x25ebe7){utils[_0x3eda('0x16')](util['format']('[%s][index][agentcomplete]',_0x440b0c['uniqueid']),_0x25ebe7);}});ami['on'](_0x3eda('0x27'),function(_0x149580){try{utils['debug'](util[_0x3eda('0x1d')](_0x3eda('0x28'),_0x149580[_0x3eda('0x1f')]),_0x149580);agents['queuecallerabandon'](_0x149580);queues[_0x3eda('0x27')](_0x149580);}catch(_0x3a0d76){utils['error'](util[_0x3eda('0x1d')]('[%s][index][queuecallerabandon]',_0x149580[_0x3eda('0x1f')]),_0x3a0d76);}});ami['on']('queuecallerjoin',function(_0x50d661){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')]('[%s][index][queuecallerjoin]',_0x50d661[_0x3eda('0x1f')]),_0x50d661);queues['queuecallerjoin'](_0x50d661);recordings[_0x3eda('0x29')](_0x50d661);}catch(_0x4a7171){utils['error'](util['format']('[%s][index][queuecallerjoin]',_0x50d661[_0x3eda('0x1f')]),_0x4a7171);}});ami['on'](_0x3eda('0x2a'),function(_0x26aeb1){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x2b'),_0x26aeb1['uniqueid']),_0x26aeb1);queues[_0x3eda('0x2a')](_0x26aeb1);}catch(_0x32b33e){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')]('[%s][index][queuecallerleave]',_0x26aeb1[_0x3eda('0x1f')]),_0x32b33e);}});ami['on']('musiconholdstart',function(_0x4a051d){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x2c'),_0x4a051d[_0x3eda('0x1f')]),_0x4a051d);queues[_0x3eda('0x2d')](_0x4a051d);calls[_0x3eda('0x2d')](_0x4a051d);}catch(_0x358305){utils[_0x3eda('0x16')](util['format'](_0x3eda('0x2c'),_0x4a051d[_0x3eda('0x1f')]),_0x358305);}});ami['on'](_0x3eda('0x2e'),function(_0x4dec3d){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x2f'),_0x4dec3d[_0x3eda('0x1f')]),_0x4dec3d);queues[_0x3eda('0x2e')](_0x4dec3d);calls['musiconholdstop'](_0x4dec3d);}catch(_0x43911e){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')]('[%s][index][musiconholdstop]',_0x4dec3d[_0x3eda('0x1f')]),_0x43911e);}});ami['on'](_0x3eda('0x30'),function(_0x926c0f){try{utils['debug'](util[_0x3eda('0x1d')](_0x3eda('0x31'),_0x926c0f[_0x3eda('0x1f')]),_0x926c0f);calls['newstate'](_0x926c0f);recordings[_0x3eda('0x30')](_0x926c0f);}catch(_0xfc9a5d){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')](_0x3eda('0x31'),_0x926c0f[_0x3eda('0x1f')]),_0xfc9a5d);}});ami['on'](_0x3eda('0x32'),function(_0x1bde8a){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x33'),_0x1bde8a['uniqueid']),_0x1bde8a);calls[_0x3eda('0x32')](_0x1bde8a);recordings[_0x3eda('0x32')](_0x1bde8a);dials[_0x3eda('0x32')](_0x1bde8a);agents['hangup'](_0x1bde8a);queues['hangup'](_0x1bde8a);}catch(_0x1651c0){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')](_0x3eda('0x33'),_0x1bde8a[_0x3eda('0x1f')]),_0x1651c0);}});ami['on'](_0x3eda('0x34'),function(_0x50d3e5){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x35'),_0x50d3e5[_0x3eda('0x1f')]),_0x50d3e5);members[_0x3eda('0x34')](_0x50d3e5);}catch(_0x48d118){utils[_0x3eda('0x16')](util['format'](_0x3eda('0x35'),_0x50d3e5['uniqueid']),_0x48d118);}});ami['on'](_0x3eda('0x36'),function(_0x3531cc){try{utils[_0x3eda('0x1a')](util['format']('[%s][index][blindtransfer]',_0x3531cc[_0x3eda('0x1f')]),_0x3531cc);queues[_0x3eda('0x36')](_0x3531cc);agents['blindtransfer'](_0x3531cc);transfers[_0x3eda('0x36')](_0x3531cc);}catch(_0x5e4aea){utils['error'](util[_0x3eda('0x1d')](_0x3eda('0x37'),_0x3531cc['uniqueid']),_0x5e4aea);}});ami['on']('attendedtransfer',function(_0x41a1cd){try{utils['debug'](util[_0x3eda('0x1d')]('[%s][index][attendedtransfer]',_0x41a1cd[_0x3eda('0x38')]),_0x41a1cd);queues[_0x3eda('0x39')](_0x41a1cd);transfers[_0x3eda('0x39')](_0x41a1cd);agents[_0x3eda('0x39')](_0x41a1cd);calls[_0x3eda('0x39')](_0x41a1cd);}catch(_0x1dd55b){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')](_0x3eda('0x3a'),_0x41a1cd[_0x3eda('0x38')]),_0x1dd55b);}});ami['on'](_0x3eda('0x3b'),function(_0x3eb18a){try{utils['debug'](util['format'](_0x3eda('0x3c'),_0x3eb18a[_0x3eda('0x1f')]),_0x3eb18a);queues[_0x3eda('0x3b')](_0x3eb18a);recordings['varset'](_0x3eb18a);calls[_0x3eda('0x3b')](_0x3eb18a);dials[_0x3eda('0x3b')](_0x3eb18a);}catch(_0x2a678c){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')](_0x3eda('0x3c'),_0x3eb18a[_0x3eda('0x1f')]),_0x2a678c);}});ami['on'](_0x3eda('0x3d'),function(_0x152454){try{utils[_0x3eda('0x1a')](util['format'](_0x3eda('0x3e'),_0x152454['uniqueid']),_0x152454);calls[_0x3eda('0x3d')](_0x152454);recordings[_0x3eda('0x3d')](_0x152454);dials['newexten'](_0x152454);}catch(_0x3c720f){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')](_0x3eda('0x3e'),_0x152454['uniqueid']),_0x3c720f);}});ami['on']('newchannel',function(_0x130fe6){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x3f'),_0x130fe6[_0x3eda('0x1f')]),_0x130fe6);calls[_0x3eda('0x40')](_0x130fe6);recordings[_0x3eda('0x40')](_0x130fe6);}catch(_0x58d21f){utils['error'](util[_0x3eda('0x1d')](_0x3eda('0x3f'),_0x130fe6[_0x3eda('0x1f')]),_0x58d21f);}});ami['on'](_0x3eda('0x41'),function(_0x5d18de){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')](_0x3eda('0x42'),_0x5d18de[_0x3eda('0x1f')]),_0x5d18de);dials[_0x3eda('0x41')](_0x5d18de);}catch(_0x4e33f9){utils[_0x3eda('0x16')](util[_0x3eda('0x1d')](_0x3eda('0x43'),_0x5d18de['uniqueid']),_0x4e33f9);}});ami['on'](_0x3eda('0x44'),function(_0x254d5a){try{utils[_0x3eda('0x1a')](util[_0x3eda('0x1d')]('[%s][index][dialend]',_0x254d5a[_0x3eda('0x1f')]),_0x254d5a);dials['dialend'](_0x254d5a);}catch(_0x3f40b8){utils['error'](util['format'](_0x3eda('0x45'),_0x254d5a[_0x3eda('0x1f')]),_0x3f40b8);}});} \ No newline at end of file +var _0x95ff=['[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','env','production','local','asterisk','port','username','keepConnected','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]'];(function(_0x4cc21b,_0xa786ba){var _0x33ba45=function(_0x143c60){while(--_0x143c60){_0x4cc21b['push'](_0x4cc21b['shift']());}};_0x33ba45(++_0xa786ba);}(_0x95ff,0xa3));var _0xf95f=function(_0x264113,_0x7c5565){_0x264113=_0x264113-0x0;var _0x4b3f0a=_0x95ff[_0x264113];return _0x4b3f0a;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xf95f('0x0'));var util=require(_0xf95f('0x1'));var isXDREnabled=config[_0xf95f('0x2')]&&config['xdr']['disabled']?!config[_0xf95f('0x2')]['disabled']:!![];var isProduction=config[_0xf95f('0x3')]===_0xf95f('0x4')||![];var isLocalAsterisk=config[_0xf95f('0x2')]&&config[_0xf95f('0x2')][_0xf95f('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xf95f('0x6')][_0xf95f('0x7')],config[_0xf95f('0x6')]['ip'],config[_0xf95f('0x6')][_0xf95f('0x8')],config['asterisk']['password'],!![]);ami[_0xf95f('0x9')]();if(!isXDREnabled){utils[_0xf95f('0xa')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xf95f('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xf95f('0xb'));var calls=require(_0xf95f('0xc'));var queues=require(_0xf95f('0xd'));var recordings=require(_0xf95f('0xe'));var members=require(_0xf95f('0xf'));var dials=require(_0xf95f('0x10'));var transfers=require(_0xf95f('0x11'));var core=require(_0xf95f('0x12'));ami['on'](_0xf95f('0x13'),core['connect']);ami['on'](_0xf95f('0x14'),core[_0xf95f('0x14')]);ami['on'](_0xf95f('0x15'),core[_0xf95f('0x15')]);ami['on'](_0xf95f('0x16'),core[_0xf95f('0x16')]);ami['on'](_0xf95f('0x17'),core[_0xf95f('0x17')]);ami['on'](_0xf95f('0x18'),core['managerevent']);ami['on'](_0xf95f('0x19'),function(_0x589778){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x1c'),_0x589778[_0xf95f('0x1d')]),_0x589778);members[_0xf95f('0x19')](_0x589778);}catch(_0x261e39){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')]('[%s][index][devicestatechange]',_0x589778[_0xf95f('0x1d')]),_0x261e39);}});ami['on']('agentcalled',function(_0x3426fd){try{utils['debug'](util[_0xf95f('0x1b')](_0xf95f('0x1e'),_0x3426fd[_0xf95f('0x1f')]),_0x3426fd);agents[_0xf95f('0x20')](_0x3426fd);}catch(_0x44cfc8){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x1e'),_0x3426fd[_0xf95f('0x1f')]),_0x44cfc8);}});ami['on'](_0xf95f('0x21'),function(_0x18fa73){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x22'),_0x18fa73[_0xf95f('0x1f')]),_0x18fa73);agents[_0xf95f('0x21')](_0x18fa73);}catch(_0x229011){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x22'),_0x18fa73[_0xf95f('0x1f')]),_0x229011);}});ami['on'](_0xf95f('0x23'),function(_0x21a92e){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x24'),_0x21a92e[_0xf95f('0x1f')]),_0x21a92e);agents[_0xf95f('0x23')](_0x21a92e);queues[_0xf95f('0x23')](_0x21a92e);}catch(_0x50ec91){utils['error'](util[_0xf95f('0x1b')](_0xf95f('0x24'),_0x21a92e[_0xf95f('0x1f')]),_0x50ec91);}});ami['on'](_0xf95f('0x25'),function(_0x146f02){try{utils[_0xf95f('0x1a')](util['format'](_0xf95f('0x26'),_0x146f02[_0xf95f('0x1f')]),_0x146f02);agents[_0xf95f('0x25')](_0x146f02);queues[_0xf95f('0x25')](_0x146f02);members[_0xf95f('0x25')](_0x146f02);}catch(_0x5ede90){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x26'),_0x146f02[_0xf95f('0x1f')]),_0x5ede90);}});ami['on'](_0xf95f('0x27'),function(_0xf7908d){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')]('[%s][index][queuecallerabandon]',_0xf7908d[_0xf95f('0x1f')]),_0xf7908d);agents[_0xf95f('0x27')](_0xf7908d);queues['queuecallerabandon'](_0xf7908d);}catch(_0x44bab1){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x28'),_0xf7908d['uniqueid']),_0x44bab1);}});ami['on']('queuecallerjoin',function(_0x2bf50f){try{utils[_0xf95f('0x1a')](util['format'](_0xf95f('0x29'),_0x2bf50f[_0xf95f('0x1f')]),_0x2bf50f);queues[_0xf95f('0x2a')](_0x2bf50f);recordings[_0xf95f('0x2a')](_0x2bf50f);}catch(_0x547dd7){utils[_0xf95f('0x16')](util['format'](_0xf95f('0x29'),_0x2bf50f[_0xf95f('0x1f')]),_0x547dd7);}});ami['on'](_0xf95f('0x2b'),function(_0xb06f26){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x2c'),_0xb06f26['uniqueid']),_0xb06f26);queues[_0xf95f('0x2b')](_0xb06f26);}catch(_0xd0289f){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x2c'),_0xb06f26[_0xf95f('0x1f')]),_0xd0289f);}});ami['on'](_0xf95f('0x2d'),function(_0x1c5309){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x2e'),_0x1c5309[_0xf95f('0x1f')]),_0x1c5309);queues[_0xf95f('0x2d')](_0x1c5309);calls[_0xf95f('0x2d')](_0x1c5309);}catch(_0x286292){utils[_0xf95f('0x16')](util['format'](_0xf95f('0x2e'),_0x1c5309[_0xf95f('0x1f')]),_0x286292);}});ami['on'](_0xf95f('0x2f'),function(_0x1415e3){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')]('[%s][index][musiconholdstop]',_0x1415e3[_0xf95f('0x1f')]),_0x1415e3);queues[_0xf95f('0x2f')](_0x1415e3);calls[_0xf95f('0x2f')](_0x1415e3);}catch(_0x2d57e8){utils['error'](util[_0xf95f('0x1b')]('[%s][index][musiconholdstop]',_0x1415e3[_0xf95f('0x1f')]),_0x2d57e8);}});ami['on'](_0xf95f('0x30'),function(_0x426271){try{utils['debug'](util[_0xf95f('0x1b')]('[%s][index][newstate]',_0x426271[_0xf95f('0x1f')]),_0x426271);calls[_0xf95f('0x30')](_0x426271);recordings[_0xf95f('0x30')](_0x426271);}catch(_0x2be2f0){utils['error'](util['format']('[%s][index][newstate]',_0x426271[_0xf95f('0x1f')]),_0x2be2f0);}});ami['on']('hangup',function(_0x4173aa){try{utils['debug'](util['format'](_0xf95f('0x31'),_0x4173aa[_0xf95f('0x1f')]),_0x4173aa);calls['hangup'](_0x4173aa);recordings['hangup'](_0x4173aa);dials['hangup'](_0x4173aa);agents[_0xf95f('0x32')](_0x4173aa);queues[_0xf95f('0x32')](_0x4173aa);}catch(_0xcd179e){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')]('[%s][index][hangup]',_0x4173aa[_0xf95f('0x1f')]),_0xcd179e);}});ami['on'](_0xf95f('0x33'),function(_0x1e1730){try{utils['debug'](util[_0xf95f('0x1b')](_0xf95f('0x34'),_0x1e1730['uniqueid']),_0x1e1730);members[_0xf95f('0x33')](_0x1e1730);}catch(_0x101c88){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x34'),_0x1e1730[_0xf95f('0x1f')]),_0x101c88);}});ami['on']('blindtransfer',function(_0x449a17){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x35'),_0x449a17[_0xf95f('0x1f')]),_0x449a17);queues[_0xf95f('0x36')](_0x449a17);agents['blindtransfer'](_0x449a17);transfers[_0xf95f('0x36')](_0x449a17);}catch(_0x12f202){utils['error'](util[_0xf95f('0x1b')](_0xf95f('0x35'),_0x449a17[_0xf95f('0x1f')]),_0x12f202);}});ami['on'](_0xf95f('0x37'),function(_0x3d2e2e){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x38'),_0x3d2e2e[_0xf95f('0x39')]),_0x3d2e2e);queues[_0xf95f('0x37')](_0x3d2e2e);transfers[_0xf95f('0x37')](_0x3d2e2e);agents[_0xf95f('0x37')](_0x3d2e2e);calls[_0xf95f('0x37')](_0x3d2e2e);}catch(_0x5cdd68){utils['error'](util[_0xf95f('0x1b')](_0xf95f('0x38'),_0x3d2e2e[_0xf95f('0x39')]),_0x5cdd68);}});ami['on'](_0xf95f('0x3a'),function(_0x2c56f0){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x3b'),_0x2c56f0[_0xf95f('0x1f')]),_0x2c56f0);queues[_0xf95f('0x3a')](_0x2c56f0);recordings[_0xf95f('0x3a')](_0x2c56f0);calls[_0xf95f('0x3a')](_0x2c56f0);dials[_0xf95f('0x3a')](_0x2c56f0);}catch(_0x580c50){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x3b'),_0x2c56f0[_0xf95f('0x1f')]),_0x580c50);}});ami['on']('newexten',function(_0x4b274f){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x3c'),_0x4b274f[_0xf95f('0x1f')]),_0x4b274f);calls[_0xf95f('0x3d')](_0x4b274f);recordings['newexten'](_0x4b274f);dials[_0xf95f('0x3d')](_0x4b274f);}catch(_0x326571){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x3c'),_0x4b274f[_0xf95f('0x1f')]),_0x326571);}});ami['on'](_0xf95f('0x3e'),function(_0x2d3f22){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')]('[%s][index][newchannel]',_0x2d3f22[_0xf95f('0x1f')]),_0x2d3f22);calls[_0xf95f('0x3e')](_0x2d3f22);recordings[_0xf95f('0x3e')](_0x2d3f22);}catch(_0x441275){utils['error'](util[_0xf95f('0x1b')](_0xf95f('0x3f'),_0x2d3f22['uniqueid']),_0x441275);}});ami['on'](_0xf95f('0x40'),function(_0x4e3a50){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')]('[%s][index][dialbegin]',_0x4e3a50[_0xf95f('0x1f')]),_0x4e3a50);dials[_0xf95f('0x40')](_0x4e3a50);}catch(_0x44060c){utils[_0xf95f('0x16')](util[_0xf95f('0x1b')](_0xf95f('0x41'),_0x4e3a50[_0xf95f('0x1f')]),_0x44060c);}});ami['on'](_0xf95f('0x42'),function(_0x6f0386){try{utils[_0xf95f('0x1a')](util[_0xf95f('0x1b')](_0xf95f('0x43'),_0x6f0386[_0xf95f('0x1f')]),_0x6f0386);dials[_0xf95f('0x42')](_0x6f0386);}catch(_0x469f6d){utils[_0xf95f('0x16')](util['format'](_0xf95f('0x43'),_0x6f0386['uniqueid']),_0x469f6d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 64655c2..9923459 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 _0x159b=['device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','[%s][members][devicestatechange]','debug','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','split','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','error','some','devicestatechange'];(function(_0x30da8e,_0x26e28b){var _0x5789da=function(_0x558960){while(--_0x558960){_0x30da8e['push'](_0x30da8e['shift']());}};_0x5789da(++_0x26e28b);}(_0x159b,0x181));var _0xb159=function(_0x43e8c6,_0x171255){_0x43e8c6=_0x43e8c6-0x0;var _0x23e88d=_0x159b[_0x43e8c6];return _0x23e88d;};'use strict';var _=require(_0xb159('0x0'));var util=require(_0xb159('0x1'));var utils=require(_0xb159('0x2'));var members={};var exclude=[_0xb159('0x3'),_0xb159('0x4')];function writeDB(_0x19ceab){utils[_0xb159('0x5')](util[_0xb159('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x19ceab[_0xb159('0x7')],_0x19ceab[_0xb159('0x8')],_0x19ceab[_0xb159('0x9')],_0x19ceab[_0xb159('0xa')],_0x19ceab['membername'],_0x19ceab[_0xb159('0xb')]));if(_0x19ceab[_0xb159('0x8')]){utils[_0xb159('0xc')](_0x19ceab[_0xb159('0x8')])[_0xb159('0xd')](function(_0x7f9727){if(_0x7f9727){_0x19ceab[_0xb159('0xe')]=_0x7f9727[_0xb159('0xf')];_0x19ceab[_0xb159('0x10')]=_0x7f9727[_0xb159('0x10')];utils[_0xb159('0x11')](_0xb159('0x12'),_0x19ceab);}else{utils[_0xb159('0x13')](_0x19ceab['interface']['split']('/')[0x1])[_0xb159('0xd')](function(_0xc81bb7){if(_0xc81bb7){_0x19ceab[_0xb159('0xe')]=_0xc81bb7[_0xb159('0xf')];_0x19ceab[_0xb159('0x10')]=_0xc81bb7[_0xb159('0x10')];utils['request'](_0xb159('0x12'),_0x19ceab);}});}})['catch'](function(_0xd264a1){utils[_0xb159('0x14')](util['format']('[%s][members][writeDB]',_0x19ceab[_0xb159('0x7')]),_0xd264a1);});}delete members[_0x19ceab[_0xb159('0x8')]];}function startsWith(_0x69c5e2,_0x5e755c){return _[_0xb159('0x15')](_0x69c5e2,function(_0x20bbb8){return _['startsWith'](_0x5e755c,_0x20bbb8);});}exports[_0xb159('0x16')]=function(_0x2094e5){try{utils['debug'](util[_0xb159('0x6')]('[%s][members][devicestatechange]',members[_0x2094e5[_0xb159('0x17')]]?members[_0x2094e5[_0xb159('0x17')]][_0xb159('0x7')]:_0x2094e5['device']),_0x2094e5);utils[_0xb159('0x5')](util['format'](_0xb159('0x18'),members[_0x2094e5[_0xb159('0x17')]]?members[_0x2094e5[_0xb159('0x17')]][_0xb159('0x7')]:_0x2094e5[_0xb159('0x17')],_0x2094e5[_0xb159('0x19')],_0x2094e5[_0xb159('0x17')]));switch(_0x2094e5[_0xb159('0x19')]){case _0xb159('0x1a'):case _0xb159('0x1b'):if(!startsWith(exclude,_0x2094e5[_0xb159('0x17')])){members[_0x2094e5[_0xb159('0x17')]]={'channel':_0xb159('0x1c'),'interface':_0x2094e5['device'],'type':_0xb159('0x1d'),'enterAt':utils['now'](),'role':'agent'};}break;case _0xb159('0x1e'):if(!_[_0xb159('0x1f')](members[_0x2094e5[_0xb159('0x17')]])){members[_0x2094e5['device']][_0xb159('0x20')]=utils[_0xb159('0x21')]();members[_0x2094e5['device']][_0xb159('0x22')]=utils[_0xb159('0x23')](members[_0x2094e5[_0xb159('0x17')]][_0xb159('0x20')],members[_0x2094e5[_0xb159('0x17')]][_0xb159('0x24')]);if(members[_0x2094e5[_0xb159('0x17')]][_0xb159('0x7')]){writeDB(members[_0x2094e5['device']]);}}break;default:break;}}catch(_0x116988){utils[_0xb159('0x14')](util['format'](_0xb159('0x25'),members[_0x2094e5['device']]?members[_0x2094e5['device']]['uniqueid']:_0x2094e5[_0xb159('0x17')]),_0x116988);}};exports['agentcomplete']=function(_0x3eb8b0){try{if(!_[_0xb159('0x1f')](members[_0x3eb8b0[_0xb159('0x8')]])){utils[_0xb159('0x26')](util['format'](_0xb159('0x27'),_0x3eb8b0[_0xb159('0x7')]),_0x3eb8b0);utils[_0xb159('0x5')](util[_0xb159('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3eb8b0[_0xb159('0x7')],_0x3eb8b0['interface'],_0x3eb8b0[_0xb159('0x28')]));members[_0x3eb8b0[_0xb159('0x8')]]=_[_0xb159('0x29')](members[_0x3eb8b0[_0xb159('0x8')]],{'data4':_0x3eb8b0[_0xb159('0x28')],'uniqueid':_0x3eb8b0[_0xb159('0x7')]});}}catch(_0x2aa053){utils[_0xb159('0x14')](util['format'](_0xb159('0x27'),_0x3eb8b0[_0xb159('0x7')]),_0x2aa053);}};exports[_0xb159('0x2a')]=function(_0x18175a){try{utils[_0xb159('0x26')](util['format'](_0xb159('0x2b'),_0x18175a['uniqueid']),_0x18175a);if(_0x18175a[_0xb159('0x9')]){var _0x2ef5e9=_0x18175a[_0xb159('0x9')][_0xb159('0x2c')]('-')[0x0];if(!_[_0xb159('0x1f')](members[_0x2ef5e9])){members[_0x2ef5e9]=_[_0xb159('0x29')](members[_0x2ef5e9],{'data1':members[_0x2ef5e9]['data1']||_0x18175a[_0xb159('0xb')],'data2':members[_0x2ef5e9][_0xb159('0xa')]||_0x18175a[_0xb159('0x2d')],'data3':members[_0x2ef5e9][_0xb159('0x2e')]||_0x18175a['destination'],'uniqueid':members[_0x2ef5e9][_0xb159('0x7')]||_0x18175a['uniqueid']});utils['info'](util[_0xb159('0x6')](_0xb159('0x2f'),_0x18175a['uniqueid'],members[_0x2ef5e9][_0xb159('0x30')],members[_0x2ef5e9][_0xb159('0xa')],members[_0x2ef5e9]['data3']));if(members[_0x2ef5e9][_0xb159('0x20')]){writeDB(members[_0x2ef5e9]);}}}if(_0x18175a[_0xb159('0x31')]){var _0x38b8c0=_0x18175a[_0xb159('0x31')][_0xb159('0x2c')]('-')[0x0];if(!_[_0xb159('0x1f')](members[_0x38b8c0])){members[_0x38b8c0]=_[_0xb159('0x29')](members[_0x38b8c0],{'data1':members[_0x38b8c0][_0xb159('0x30')]||_0x18175a[_0xb159('0xb')],'data2':members[_0x38b8c0]['data2']||_0x18175a[_0xb159('0x2d')],'data3':members[_0x38b8c0][_0xb159('0x2e')]||_0x18175a[_0xb159('0x32')],'uniqueid':members[_0x38b8c0][_0xb159('0x7')]||_0x18175a['uniqueid']});utils[_0xb159('0x5')](util[_0xb159('0x6')](_0xb159('0x2f'),_0x18175a[_0xb159('0x7')],members[_0x38b8c0]['data1'],members[_0x38b8c0][_0xb159('0xa')],members[_0x38b8c0][_0xb159('0x2e')]));if(members[_0x38b8c0][_0xb159('0x20')]){writeDB(members[_0x38b8c0]);}}}}catch(_0x1eda41){utils[_0xb159('0x14')](util[_0xb159('0x6')](_0xb159('0x2b'),_0x18175a['uniqueid']),_0x1eda41);}}; \ No newline at end of file +var _0xb43b=['CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','duration','exitAt','agentcomplete','isNil','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','then','membername','name','internal','request'];(function(_0x38de92,_0x3f3a91){var _0xd8fb0a=function(_0x5c2918){while(--_0x5c2918){_0x38de92['push'](_0x38de92['shift']());}};_0xd8fb0a(++_0x3f3a91);}(_0xb43b,0xbf));var _0xbb43=function(_0x1a257b,_0x677855){_0x1a257b=_0x1a257b-0x0;var _0x3aff92=_0xb43b[_0x1a257b];return _0x3aff92;};'use strict';var _=require(_0xbb43('0x0'));var util=require('util');var utils=require(_0xbb43('0x1'));var members={};var exclude=[_0xbb43('0x2'),_0xbb43('0x3')];function writeDB(_0x293836){utils[_0xbb43('0x4')](util[_0xbb43('0x5')](_0xbb43('0x6'),_0x293836[_0xbb43('0x7')],_0x293836[_0xbb43('0x8')],_0x293836[_0xbb43('0x9')],_0x293836[_0xbb43('0xa')],_0x293836['membername'],_0x293836[_0xbb43('0xb')]));if(_0x293836['interface']){utils['getUserByInterface'](_0x293836[_0xbb43('0x8')])[_0xbb43('0xc')](function(_0x20ed03){if(_0x20ed03){_0x293836[_0xbb43('0xd')]=_0x20ed03[_0xbb43('0xe')];_0x293836['internal']=_0x20ed03[_0xbb43('0xf')];utils[_0xbb43('0x10')](_0xbb43('0x11'),_0x293836);}else{utils[_0xbb43('0x12')](_0x293836['interface'][_0xbb43('0x13')]('/')[0x1])[_0xbb43('0xc')](function(_0x5a25b6){if(_0x5a25b6){_0x293836['membername']=_0x5a25b6['name'];_0x293836[_0xbb43('0xf')]=_0x5a25b6['internal'];utils[_0xbb43('0x10')]('CreateMemberReport',_0x293836);}});}})[_0xbb43('0x14')](function(_0x217a4e){utils[_0xbb43('0x15')](util[_0xbb43('0x5')](_0xbb43('0x16'),_0x293836['uniqueid']),_0x217a4e);});}delete members[_0x293836[_0xbb43('0x8')]];}function startsWith(_0x4ac25c,_0x199726){return _[_0xbb43('0x17')](_0x4ac25c,function(_0x15182b){return _[_0xbb43('0x18')](_0x199726,_0x15182b);});}exports[_0xbb43('0x19')]=function(_0x126f61){try{utils[_0xbb43('0x1a')](util[_0xbb43('0x5')](_0xbb43('0x1b'),members[_0x126f61[_0xbb43('0x1c')]]?members[_0x126f61[_0xbb43('0x1c')]]['uniqueid']:_0x126f61[_0xbb43('0x1c')]),_0x126f61);utils['info'](util[_0xbb43('0x5')](_0xbb43('0x1d'),members[_0x126f61[_0xbb43('0x1c')]]?members[_0x126f61[_0xbb43('0x1c')]]['uniqueid']:_0x126f61[_0xbb43('0x1c')],_0x126f61[_0xbb43('0x1e')],_0x126f61[_0xbb43('0x1c')]));switch(_0x126f61[_0xbb43('0x1e')]){case _0xbb43('0x1f'):case _0xbb43('0x20'):if(!startsWith(exclude,_0x126f61[_0xbb43('0x1c')])){members[_0x126f61[_0xbb43('0x1c')]]={'channel':_0xbb43('0x21'),'interface':_0x126f61[_0xbb43('0x1c')],'type':_0xbb43('0x22'),'enterAt':utils[_0xbb43('0x23')](),'role':_0xbb43('0x24')};}break;case _0xbb43('0x25'):if(!_['isNil'](members[_0x126f61[_0xbb43('0x1c')]])){members[_0x126f61[_0xbb43('0x1c')]]['exitAt']=utils[_0xbb43('0x23')]();members[_0x126f61[_0xbb43('0x1c')]][_0xbb43('0x26')]=utils['diffTime'](members[_0x126f61['device']][_0xbb43('0x27')],members[_0x126f61[_0xbb43('0x1c')]]['enterAt']);if(members[_0x126f61['device']][_0xbb43('0x7')]){writeDB(members[_0x126f61[_0xbb43('0x1c')]]);}}break;default:break;}}catch(_0x268fb5){utils[_0xbb43('0x15')](util[_0xbb43('0x5')](_0xbb43('0x1b'),members[_0x126f61[_0xbb43('0x1c')]]?members[_0x126f61[_0xbb43('0x1c')]]['uniqueid']:_0x126f61[_0xbb43('0x1c')]),_0x268fb5);}};exports[_0xbb43('0x28')]=function(_0x821beb){try{if(!_[_0xbb43('0x29')](members[_0x821beb[_0xbb43('0x8')]])){utils[_0xbb43('0x1a')](util[_0xbb43('0x5')]('[%s][members][agentcomplete]',_0x821beb[_0xbb43('0x7')]),_0x821beb);utils[_0xbb43('0x4')](util[_0xbb43('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x821beb[_0xbb43('0x7')],_0x821beb[_0xbb43('0x8')],_0x821beb[_0xbb43('0x2a')]));members[_0x821beb[_0xbb43('0x8')]]=_[_0xbb43('0x2b')](members[_0x821beb[_0xbb43('0x8')]],{'data4':_0x821beb[_0xbb43('0x2a')],'uniqueid':_0x821beb[_0xbb43('0x7')]});}}catch(_0xd579d8){utils['error'](util['format']('[%s][members][agentcomplete]',_0x821beb['uniqueid']),_0xd579d8);}};exports[_0xbb43('0x2c')]=function(_0x1186fd){try{utils[_0xbb43('0x1a')](util[_0xbb43('0x5')](_0xbb43('0x2d'),_0x1186fd[_0xbb43('0x7')]),_0x1186fd);if(_0x1186fd[_0xbb43('0x9')]){var _0x3082b3=_0x1186fd['channel'][_0xbb43('0x13')]('-')[0x0];if(!_[_0xbb43('0x29')](members[_0x3082b3])){members[_0x3082b3]=_[_0xbb43('0x2b')](members[_0x3082b3],{'data1':members[_0x3082b3][_0xbb43('0x2e')]||_0x1186fd['type'],'data2':members[_0x3082b3][_0xbb43('0xa')]||_0x1186fd[_0xbb43('0x2f')],'data3':members[_0x3082b3][_0xbb43('0x30')]||_0x1186fd[_0xbb43('0x31')],'uniqueid':members[_0x3082b3]['uniqueid']||_0x1186fd[_0xbb43('0x7')]});utils['info'](util[_0xbb43('0x5')](_0xbb43('0x32'),_0x1186fd[_0xbb43('0x7')],members[_0x3082b3][_0xbb43('0x2e')],members[_0x3082b3][_0xbb43('0xa')],members[_0x3082b3][_0xbb43('0x30')]));if(members[_0x3082b3][_0xbb43('0x27')]){writeDB(members[_0x3082b3]);}}}if(_0x1186fd[_0xbb43('0x33')]){var _0xc087aa=_0x1186fd[_0xbb43('0x33')][_0xbb43('0x13')]('-')[0x0];if(!_[_0xbb43('0x29')](members[_0xc087aa])){members[_0xc087aa]=_['assign'](members[_0xc087aa],{'data1':members[_0xc087aa][_0xbb43('0x2e')]||_0x1186fd[_0xbb43('0xb')],'data2':members[_0xc087aa][_0xbb43('0xa')]||_0x1186fd[_0xbb43('0x2f')],'data3':members[_0xc087aa][_0xbb43('0x30')]||_0x1186fd[_0xbb43('0x31')],'uniqueid':members[_0xc087aa][_0xbb43('0x7')]||_0x1186fd[_0xbb43('0x7')]});utils[_0xbb43('0x4')](util[_0xbb43('0x5')](_0xbb43('0x32'),_0x1186fd[_0xbb43('0x7')],members[_0xc087aa][_0xbb43('0x2e')],members[_0xc087aa][_0xbb43('0xa')],members[_0xc087aa][_0xbb43('0x30')]));if(members[_0xc087aa]['exitAt']){writeDB(members[_0xc087aa]);}}}}catch(_0x4807a3){utils[_0xbb43('0x15')](util[_0xbb43('0x5')](_0xbb43('0x2d'),_0x1186fd[_0xbb43('0x7')]),_0x4807a3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0ac43ff..33c9561 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 _0x3da3=['musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','info','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','value','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','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','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x3da3,0x1f3));var _0x33da=function(_0x13efd8,_0x3e3c14){_0x13efd8=_0x13efd8-0x0;var _0x3f24dd=_0x3da3[_0x13efd8];return _0x3f24dd;};'use strict';var _=require(_0x33da('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x4342cf){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4342cf[_0x33da('0x1')],_0x4342cf['channel'],_0x4342cf[_0x33da('0x2')],_0x4342cf[_0x33da('0x3')],_0x4342cf[_0x33da('0x4')],_0x4342cf[_0x33da('0x5')],_0x4342cf[_0x33da('0x6')]));if(_0x4342cf[_0x33da('0x2')]){utils[_0x33da('0x7')](_0x4342cf[_0x33da('0x2')])[_0x33da('0x8')](function(_0x3c0c4b){if(_0x3c0c4b){_0x4342cf[_0x33da('0x9')]=_0x3c0c4b[_0x33da('0x9')];}utils[_0x33da('0xa')](_0x33da('0xb'),_0x4342cf);});}else{utils[_0x33da('0xa')](_0x33da('0xb'),_0x4342cf);}if(_0x4342cf[_0x33da('0xc')]){delete queues[_0x4342cf['transfereduniqueid']];}else{delete queues[_0x4342cf[_0x33da('0x1')]];}}exports['queuecallerjoin']=function(_0x1ecb4e){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x1ecb4e[_0x33da('0x1')]),_0x1ecb4e);utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0xf'),_0x1ecb4e['uniqueid'],_0x1ecb4e[_0x33da('0x2')],_0x1ecb4e[_0x33da('0x10')]));queues[_0x1ecb4e['uniqueid']]=_[_0x33da('0x11')](_0x1ecb4e,{'originalposition':_0x1ecb4e['position'],'queuecallerjoinAt':utils[_0x33da('0x12')](),'mohtime':0x0});}catch(_0x5ada9d){utils['error'](util['format'](_0x33da('0x13'),_0x1ecb4e['uniqueid']),_0x5ada9d);}};exports['hangup']=function(_0x4bd2be){try{if(!_[_0x33da('0x14')](queues[_0x4bd2be[_0x33da('0x1')]])){utils[_0x33da('0x15')](util['format'](_0x33da('0x16'),_0x4bd2be[_0x33da('0x1')]),_0x4bd2be);if(queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0x17')]){if(!queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0x18')]&&!queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0x19')]){queues[_0x4bd2be['uniqueid']][_0x33da('0x1a')]=!![];queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0x1b')]=utils[_0x33da('0x12')]();queues[_0x4bd2be[_0x33da('0x1')]]['queuecallerexitreason']=_0x33da('0x1c');}utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x1d'),_0x4bd2be[_0x33da('0x1')],queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0x1e')],queues[_0x4bd2be[_0x33da('0x1')]]['queuecallerexitreason']));writeDB(queues[_0x4bd2be['uniqueid']]);}else if(queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0xc')]){utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x1f'),_0x4bd2be[_0x33da('0x1')],queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0x1e')],queues[_0x4bd2be[_0x33da('0x1')]]['transfereduniqueid']));queues[queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0xc')]]=queues[_0x4bd2be[_0x33da('0x1')]];queues[queues[_0x4bd2be[_0x33da('0x1')]][_0x33da('0xc')]][_0x33da('0x20')]=0x2;delete queues[_0x4bd2be['uniqueid']];}}}catch(_0x2814c7){utils[_0x33da('0x21')](util[_0x33da('0xe')](_0x33da('0x16'),_0x4bd2be['uniqueid']),_0x2814c7);}};exports[_0x33da('0x22')]=function(_0x39e8f8){try{utils[_0x33da('0x15')](util[_0x33da('0xe')](_0x33da('0x23'),_0x39e8f8[_0x33da('0x1')]),_0x39e8f8);if(!_[_0x33da('0x14')](_0x39e8f8['variable']['queuestatus'])&&_0x39e8f8[_0x33da('0x24')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x33da('0x14')](queues[_0x39e8f8[_0x33da('0x1')]])){queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x18')]=![];queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x25')]=null;queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x19')]=!![];queues[_0x39e8f8[_0x33da('0x1')]]['queuecallerexitAt']=utils['now']();queues[_0x39e8f8[_0x33da('0x1')]]['queuecallerexitreason']=_0x39e8f8[_0x33da('0x24')][_0x33da('0x26')]();utils[_0x33da('0xd')](util['format'](_0x33da('0x27'),_0x39e8f8[_0x33da('0x1')],queues[_0x39e8f8['uniqueid']][_0x33da('0x1e')],_0x39e8f8[_0x33da('0x24')],queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x6')]));writeDB(queues[_0x39e8f8[_0x33da('0x1')]]);}}else if(!_[_0x33da('0x14')](_0x39e8f8[_0x33da('0x28')]['queueposition'])){if(!_[_0x33da('0x14')](queues[_0x39e8f8[_0x33da('0x1')]])&&!queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x18')]){queues[_0x39e8f8[_0x33da('0x1')]]['queuecallerabandon']=![];queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x25')]=null;queues[_0x39e8f8[_0x33da('0x1')]]['queuecallerexit']=!![];queues[_0x39e8f8[_0x33da('0x1')]][_0x33da('0x29')]=utils[_0x33da('0x12')]();queues[_0x39e8f8[_0x33da('0x1')]]['queuecallerexitreason']=_0x33da('0x2a');utils[_0x33da('0xd')](util['format'](_0x33da('0x2b'),_0x39e8f8[_0x33da('0x1')],queues[_0x39e8f8[_0x33da('0x1')]]['name'],_0x39e8f8[_0x33da('0x24')],queues[_0x39e8f8[_0x33da('0x1')]]['queuecallerexitreason']));}}}catch(_0x3a8b48){utils[_0x33da('0x21')](util['format']('[%s][queues][varset]',_0x39e8f8[_0x33da('0x1')]),_0x3a8b48);}};exports[_0x33da('0x18')]=function(_0x1fd82d){try{if(!_[_0x33da('0x14')](queues[_0x1fd82d[_0x33da('0x1')]])){utils[_0x33da('0x15')](util[_0x33da('0xe')](_0x33da('0x2c'),_0x1fd82d['uniqueid']),_0x1fd82d);queues[_0x1fd82d[_0x33da('0x1')]][_0x33da('0x19')]=![];queues[_0x1fd82d[_0x33da('0x1')]][_0x33da('0x29')]=null;queues[_0x1fd82d[_0x33da('0x1')]]['queuecallerabandon']=!![];queues[_0x1fd82d[_0x33da('0x1')]][_0x33da('0x25')]=utils[_0x33da('0x12')]();queues[_0x1fd82d['uniqueid']]['queuecallerexitreason']=_0x33da('0x2d');utils['info'](util[_0x33da('0xe')](_0x33da('0x2e'),_0x1fd82d[_0x33da('0x1')],queues[_0x1fd82d[_0x33da('0x1')]][_0x33da('0x1e')],queues[_0x1fd82d['uniqueid']]['queuecallerexitreason']));}}catch(_0x2144e6){utils[_0x33da('0x21')](util[_0x33da('0xe')]('[%s][queues][queuecallerabandon]',_0x1fd82d[_0x33da('0x1')]),_0x2144e6);}};exports[_0x33da('0x2f')]=function(_0x10a8e8){try{if(!_[_0x33da('0x14')](queues[_0x10a8e8['uniqueid']])){utils[_0x33da('0x15')](util[_0x33da('0xe')](_0x33da('0x30'),_0x10a8e8[_0x33da('0x1')]),_0x10a8e8);utils['info'](util[_0x33da('0xe')](_0x33da('0x31'),_0x10a8e8[_0x33da('0x1')],queues[_0x10a8e8[_0x33da('0x1')]][_0x33da('0x1e')],_0x10a8e8[_0x33da('0x32')],_0x10a8e8[_0x33da('0x33')]));queues[_0x10a8e8[_0x33da('0x1')]]['queuecallerleave']=!![];queues[_0x10a8e8[_0x33da('0x1')]]['queuecallerleaveAt']=utils['now']();queues[_0x10a8e8[_0x33da('0x1')]][_0x33da('0x34')]=utils[_0x33da('0x35')](queues[_0x10a8e8['uniqueid']][_0x33da('0x17')],queues[_0x10a8e8['uniqueid']][_0x33da('0x36')]);queues[_0x10a8e8[_0x33da('0x1')]]['position']=_0x10a8e8['position'];queues[_0x10a8e8[_0x33da('0x1')]]['count']=_0x10a8e8[_0x33da('0x37')];queues[_0x10a8e8[_0x33da('0x1')]][_0x33da('0x32')]=_0x10a8e8[_0x33da('0x32')];queues[_0x10a8e8['uniqueid']][_0x33da('0x33')]=_0x10a8e8[_0x33da('0x33')];}}catch(_0x57464d){utils[_0x33da('0x21')](util[_0x33da('0xe')](_0x33da('0x30'),_0x10a8e8['uniqueid']),_0x57464d);}};exports['agentconnect']=function(_0x144c49){try{if(!_[_0x33da('0x14')](queues[_0x144c49['uniqueid']])){utils[_0x33da('0x15')](util[_0x33da('0xe')]('[%s][queues][agentconnect]',_0x144c49[_0x33da('0x1')]),_0x144c49);utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x38'),_0x144c49['uniqueid'],queues[_0x144c49[_0x33da('0x1')]][_0x33da('0x1e')],_0x144c49[_0x33da('0x39')],_0x144c49[_0x33da('0x3a')]));queues[_0x144c49[_0x33da('0x1')]]['queuecallerabandon']=![];queues[_0x144c49[_0x33da('0x1')]][_0x33da('0x18')]=![];queues[_0x144c49[_0x33da('0x1')]]['queuecallerabandonAt']=null;queues[_0x144c49['uniqueid']][_0x33da('0x19')]=![];queues[_0x144c49[_0x33da('0x1')]]['queuecallerexitreason']=null;queues[_0x144c49[_0x33da('0x1')]]['queuecallerexitAt']=null;queues[_0x144c49[_0x33da('0x1')]][_0x33da('0x3b')]=!![];queues[_0x144c49['uniqueid']][_0x33da('0x5')]=_0x144c49['destaccountcode'];queues[_0x144c49[_0x33da('0x1')]][_0x33da('0x3')]=_0x144c49['membername'];}}catch(_0x5881a4){utils[_0x33da('0x21')](util[_0x33da('0xe')](_0x33da('0x3c'),_0x144c49[_0x33da('0x1')]),_0x5881a4);}};exports['agentcomplete']=function(_0x4ca6b1){try{if(!_[_0x33da('0x14')](queues[_0x4ca6b1['uniqueid']])){if(queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x17')]){utils[_0x33da('0x15')](util['format'](_0x33da('0x3d'),_0x4ca6b1['uniqueid']),_0x4ca6b1);queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x18')]=![];queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x18')]=![];queues[_0x4ca6b1['uniqueid']][_0x33da('0x25')]=null;queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x19')]=![];queues[_0x4ca6b1[_0x33da('0x1')]]['queuecallerexitAt']=null;queues[_0x4ca6b1['uniqueid']][_0x33da('0x3b')]=!![];queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x3')]=_0x4ca6b1[_0x33da('0x39')];queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x1a')]=!![];queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x1b')]=utils['now']();if(_0x4ca6b1[_0x33da('0x3e')]==_0x33da('0x3f')){if(!queues[_0x4ca6b1[_0x33da('0x1')]]['transfer']){queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x6')]=_0x33da('0x40');}}else{queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x6')]=_0x33da('0x41')+_0x4ca6b1[_0x33da('0x3e')][_0x33da('0x26')]();}utils['info'](util[_0x33da('0xe')](_0x33da('0x42'),_0x4ca6b1['uniqueid'],queues[_0x4ca6b1[_0x33da('0x1')]][_0x33da('0x1e')],_0x4ca6b1[_0x33da('0x39')],queues[_0x4ca6b1[_0x33da('0x1')]]['queuecallerexitreason']));writeDB(queues[_0x4ca6b1[_0x33da('0x1')]]);}}}catch(_0x5baa37){utils[_0x33da('0x21')](util['format']('[%s][queues][agentcomplete]',_0x4ca6b1[_0x33da('0x1')]),_0x5baa37);}};exports[_0x33da('0x43')]=function(_0x22c71b){try{if(!_[_0x33da('0x14')](queues[_0x22c71b['transfereeuniqueid']])){utils[_0x33da('0x15')](util['format'](_0x33da('0x44'),_0x22c71b[_0x33da('0x1')]),_0x22c71b);queues[_0x22c71b['transfereeuniqueid']]['transfer']=!![];queues[_0x22c71b[_0x33da('0x45')]][_0x33da('0x46')]=_0x33da('0x47');queues[_0x22c71b[_0x33da('0x45')]][_0x33da('0x48')]=_0x22c71b[_0x33da('0x49')];queues[_0x22c71b[_0x33da('0x45')]][_0x33da('0x4a')]=_0x22c71b[_0x33da('0x45')];queues[_0x22c71b[_0x33da('0x45')]]['queuecallerexitreason']=_0x33da('0x4b');utils[_0x33da('0xd')](util[_0x33da('0xe')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x22c71b[_0x33da('0x1')],queues[_0x22c71b['transfereeuniqueid']][_0x33da('0x1e')],_0x22c71b[_0x33da('0x45')],_0x22c71b[_0x33da('0x49')]));}}catch(_0x1c5748){utils[_0x33da('0x21')](util['format'](_0x33da('0x44'),_0x22c71b[_0x33da('0x1')]),_0x1c5748);}};exports['attendedtransfer']=function(_0x2acd3b){try{utils[_0x33da('0x15')](util[_0x33da('0xe')](_0x33da('0x4c'),_0x2acd3b['origtransfereruniqueid']),_0x2acd3b);if(_0x2acd3b[_0x33da('0x4d')]==_0x2acd3b[_0x33da('0x4e')]){if(!_[_0x33da('0x14')](queues[_0x2acd3b[_0x33da('0x4f')]])){utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x50'),_0x2acd3b[_0x33da('0x4d')],queues[_0x2acd3b['secondtransfererlinkedid']][_0x33da('0x1e')],_0x2acd3b['origtransfererexten']));queues[_0x2acd3b['secondtransfererlinkedid']][_0x33da('0x3f')]=!![];queues[_0x2acd3b['secondtransfererlinkedid']][_0x33da('0x46')]='ATTENDED';queues[_0x2acd3b[_0x33da('0x4f')]][_0x33da('0x48')]=_0x2acd3b[_0x33da('0x51')];queues[_0x2acd3b[_0x33da('0x4f')]][_0x33da('0x4a')]=_0x2acd3b[_0x33da('0x4d')];queues[_0x2acd3b[_0x33da('0x4f')]][_0x33da('0x6')]=_0x33da('0x52');}if(!_[_0x33da('0x14')](queues[_0x2acd3b['origtransfererlinkedid']])){if(_0x2acd3b[_0x33da('0x53')]&&queues[_0x2acd3b[_0x33da('0x53')]]){queues[_0x2acd3b[_0x33da('0x53')]][_0x33da('0x20')]=0x1;queues[_0x2acd3b[_0x33da('0x45')]]=_['clone'](queues[_0x2acd3b[_0x33da('0x53')]]);queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0xc')]=_0x2acd3b[_0x33da('0x54')];queues[_0x2acd3b['transfereeuniqueid']][_0x33da('0x20')]=0x2;queues[_0x2acd3b['transfereeuniqueid']][_0x33da('0x4')]=queues[_0x2acd3b['secondtransfererlinkedid']][_0x33da('0x4')];queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0x55')]=queues[_0x2acd3b[_0x33da('0x4f')]]['calleridname'];queues[_0x2acd3b['transfereeuniqueid']][_0x33da('0x36')]=utils[_0x33da('0x12')]();queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0x17')]=utils[_0x33da('0x12')]();queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0x34')]=0x0;queues[_0x2acd3b['transfereeuniqueid']][_0x33da('0x56')]=0x0;utils['info'](util[_0x33da('0xe')](_0x33da('0x57'),_0x2acd3b[_0x33da('0x4d')],queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0x1e')],queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0x4')],queues[_0x2acd3b[_0x33da('0x45')]][_0x33da('0x55')]));}else{utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x58'),_0x2acd3b[_0x33da('0x4d')],queues[_0x2acd3b['origtransfererlinkedid']][_0x33da('0x1e')],_0x2acd3b[_0x33da('0x4f')]));queues[_0x2acd3b[_0x33da('0x4e')]][_0x33da('0xc')]=_0x2acd3b[_0x33da('0x4f')];}}}else if(_0x2acd3b[_0x33da('0x59')]==_0x2acd3b[_0x33da('0x4f')]){if(!_[_0x33da('0x14')](queues[_0x2acd3b[_0x33da('0x4e')]])){utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x5a'),_0x2acd3b[_0x33da('0x4d')],queues[_0x2acd3b['origtransfererlinkedid']][_0x33da('0x1e')],_0x2acd3b[_0x33da('0x59')],_0x2acd3b['secondtransfererexten']));queues[_0x2acd3b[_0x33da('0x4e')]][_0x33da('0x3f')]=!![];queues[_0x2acd3b[_0x33da('0x4e')]][_0x33da('0x46')]='ATTENDED';queues[_0x2acd3b[_0x33da('0x4e')]][_0x33da('0x48')]=_0x2acd3b[_0x33da('0x5b')];queues[_0x2acd3b['origtransfererlinkedid']][_0x33da('0x4a')]=_0x2acd3b[_0x33da('0x59')];queues[_0x2acd3b['origtransfererlinkedid']][_0x33da('0x6')]=_0x33da('0x52');}if(!_[_0x33da('0x14')](queues[_0x2acd3b[_0x33da('0x4f')]])){if(_0x2acd3b[_0x33da('0x5c')]&&queues[_0x2acd3b[_0x33da('0x5c')]]){queues[_0x2acd3b[_0x33da('0x5c')]][_0x33da('0x20')]=0x1;queues[_0x2acd3b[_0x33da('0x54')]]=_['clone'](queues[_0x2acd3b[_0x33da('0x5c')]]);queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0xc')]=_0x2acd3b[_0x33da('0x54')];queues[_0x2acd3b['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x4')]=queues[_0x2acd3b['origtransfererlinkedid']]['calleridnum'];queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x55')]=queues[_0x2acd3b[_0x33da('0x4e')]][_0x33da('0x55')];queues[_0x2acd3b['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x33da('0x12')]();queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x17')]=utils['now']();queues[_0x2acd3b['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x56')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x2acd3b[_0x33da('0x4d')],queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x1e')],queues[_0x2acd3b[_0x33da('0x54')]]['transfereduniqueid'],queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x4')],queues[_0x2acd3b[_0x33da('0x54')]][_0x33da('0x55')]));}else{utils[_0x33da('0xd')](util[_0x33da('0xe')](_0x33da('0x58'),_0x2acd3b[_0x33da('0x4d')],queues[_0x2acd3b[_0x33da('0x4f')]]['name'],_0x2acd3b['origtransfererlinkedid']));queues[_0x2acd3b[_0x33da('0x4f')]][_0x33da('0xc')]=_0x2acd3b[_0x33da('0x4e')];}}}}catch(_0x4cb8eb){utils['error'](util[_0x33da('0xe')](_0x33da('0x4c'),_0x2acd3b[_0x33da('0x4d')]),_0x4cb8eb);}};exports[_0x33da('0x5d')]=function(_0x45fa3c){try{if(!_[_0x33da('0x14')](queues[_0x45fa3c['uniqueid']])){utils[_0x33da('0x15')](util[_0x33da('0xe')]('[%s][queues][musiconholdstart]',_0x45fa3c[_0x33da('0x1')]),_0x45fa3c);queues[_0x45fa3c[_0x33da('0x1')]]['musiconholdstartAt']=utils[_0x33da('0x12')]();utils[_0x33da('0xd')](util['format'](_0x33da('0x5e'),_0x45fa3c[_0x33da('0x1')],queues[_0x45fa3c[_0x33da('0x1')]]['name'],queues[_0x45fa3c[_0x33da('0x1')]][_0x33da('0x5f')]));}}catch(_0x1bcde7){utils['error'](util['format']('[%s][queues][musiconholdstart]',_0x45fa3c['uniqueid']),_0x1bcde7);}};exports[_0x33da('0x60')]=function(_0x51745f){try{if(!_[_0x33da('0x14')](queues[_0x51745f[_0x33da('0x1')]])){if(!_[_0x33da('0x14')](queues[_0x51745f[_0x33da('0x1')]][_0x33da('0x5f')])){utils['debug'](util[_0x33da('0xe')](_0x33da('0x61'),_0x51745f['uniqueid']),_0x51745f);queues[_0x51745f['uniqueid']][_0x33da('0x56')]+=utils[_0x33da('0x35')](utils['now'](),queues[_0x51745f[_0x33da('0x1')]]['musiconholdstartAt']);utils['info'](util[_0x33da('0xe')](_0x33da('0x62'),_0x51745f[_0x33da('0x1')],queues[_0x51745f['uniqueid']]['name'],queues[_0x51745f[_0x33da('0x1')]][_0x33da('0x56')]));delete queues[_0x51745f[_0x33da('0x1')]][_0x33da('0x5f')];}}}catch(_0x5c68ac){utils[_0x33da('0x21')](util[_0x33da('0xe')](_0x33da('0x61'),_0x51745f['uniqueid']),_0x5c68ac);}}; \ No newline at end of file +var _0x05ca=['transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','info','format','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','debug','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','assigned','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x05ca,0x74));var _0xa05c=function(_0x14ba01,_0x186dfc){_0x14ba01=_0x14ba01-0x0;var _0x317534=_0x05ca[_0x14ba01];return _0x317534;};'use strict';var _=require(_0xa05c('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x2d4536){utils[_0xa05c('0x1')](util[_0xa05c('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2d4536['uniqueid'],_0x2d4536[_0xa05c('0x3')],_0x2d4536['queue'],_0x2d4536[_0xa05c('0x4')],_0x2d4536[_0xa05c('0x5')],_0x2d4536[_0xa05c('0x6')],_0x2d4536[_0xa05c('0x7')]));if(_0x2d4536[_0xa05c('0x8')]){utils[_0xa05c('0x9')](_0x2d4536[_0xa05c('0x8')])[_0xa05c('0xa')](function(_0x141c95){if(_0x141c95){_0x2d4536[_0xa05c('0xb')]=_0x141c95[_0xa05c('0xb')];}utils[_0xa05c('0xc')](_0xa05c('0xd'),_0x2d4536);});}else{utils[_0xa05c('0xc')]('CreateVoiceQueueReport',_0x2d4536);}if(_0x2d4536[_0xa05c('0xe')]){delete queues[_0x2d4536[_0xa05c('0xe')]];}else{delete queues[_0x2d4536['uniqueid']];}}exports['queuecallerjoin']=function(_0x5570af){try{utils['debug'](util[_0xa05c('0x2')](_0xa05c('0xf'),_0x5570af[_0xa05c('0x10')]),_0x5570af);utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x11'),_0x5570af[_0xa05c('0x10')],_0x5570af[_0xa05c('0x8')],_0x5570af['position']));queues[_0x5570af[_0xa05c('0x10')]]=_[_0xa05c('0x12')](_0x5570af,{'originalposition':_0x5570af[_0xa05c('0x13')],'queuecallerjoinAt':utils[_0xa05c('0x14')](),'mohtime':0x0});}catch(_0x48b23f){utils['error'](util['format'](_0xa05c('0xf'),_0x5570af['uniqueid']),_0x48b23f);}};exports['hangup']=function(_0x15ec12){try{if(!_[_0xa05c('0x15')](queues[_0x15ec12[_0xa05c('0x10')]])){utils['debug'](util[_0xa05c('0x2')]('[%s][queues][hangup]',_0x15ec12['uniqueid']),_0x15ec12);if(queues[_0x15ec12[_0xa05c('0x10')]]['queuecallerleaveAt']){if(!queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x16')]&&!queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x17')]){queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x18')]=!![];queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x19')]=utils['now']();queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x7')]=_0xa05c('0x1a');}utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x1b'),_0x15ec12[_0xa05c('0x10')],queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x1c')],queues[_0x15ec12['uniqueid']][_0xa05c('0x7')]));writeDB(queues[_0x15ec12[_0xa05c('0x10')]]);}else if(queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0xe')]){utils[_0xa05c('0x1')](util['format'](_0xa05c('0x1d'),_0x15ec12[_0xa05c('0x10')],queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0x1c')],queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0xe')]));queues[queues[_0x15ec12['uniqueid']]['transfereduniqueid']]=queues[_0x15ec12['uniqueid']];queues[queues[_0x15ec12[_0xa05c('0x10')]][_0xa05c('0xe')]][_0xa05c('0x1e')]=0x2;delete queues[_0x15ec12['uniqueid']];}}}catch(_0x16fe0){utils[_0xa05c('0x1f')](util['format']('[%s][queues][hangup]',_0x15ec12[_0xa05c('0x10')]),_0x16fe0);}};exports[_0xa05c('0x20')]=function(_0x1bebb9){try{utils['debug'](util['format'](_0xa05c('0x21'),_0x1bebb9[_0xa05c('0x10')]),_0x1bebb9);if(!_[_0xa05c('0x15')](_0x1bebb9[_0xa05c('0x22')]['queuestatus'])&&_0x1bebb9[_0xa05c('0x23')][_0xa05c('0x24')]()!==_0xa05c('0x25')){if(!_[_0xa05c('0x15')](queues[_0x1bebb9[_0xa05c('0x10')]])){queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x16')]=![];queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x26')]=null;queues[_0x1bebb9['uniqueid']][_0xa05c('0x17')]=!![];queues[_0x1bebb9['uniqueid']][_0xa05c('0x27')]=utils['now']();queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x7')]=_0x1bebb9[_0xa05c('0x23')][_0xa05c('0x24')]();utils['info'](util['format'](_0xa05c('0x28'),_0x1bebb9['uniqueid'],queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x1c')],_0x1bebb9[_0xa05c('0x23')],queues[_0x1bebb9['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x1bebb9[_0xa05c('0x10')]]);}}else if(!_['isNil'](_0x1bebb9[_0xa05c('0x22')][_0xa05c('0x29')])){if(!_[_0xa05c('0x15')](queues[_0x1bebb9[_0xa05c('0x10')]])&&!queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x16')]){queues[_0x1bebb9['uniqueid']][_0xa05c('0x16')]=![];queues[_0x1bebb9[_0xa05c('0x10')]]['queuecallerabandonAt']=null;queues[_0x1bebb9['uniqueid']][_0xa05c('0x17')]=!![];queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x27')]=utils[_0xa05c('0x14')]();queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x7')]=_0xa05c('0x2a');utils[_0xa05c('0x1')](util[_0xa05c('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1bebb9[_0xa05c('0x10')],queues[_0x1bebb9['uniqueid']][_0xa05c('0x1c')],_0x1bebb9['value'],queues[_0x1bebb9[_0xa05c('0x10')]][_0xa05c('0x7')]));}}}catch(_0x1f9c73){utils[_0xa05c('0x1f')](util[_0xa05c('0x2')]('[%s][queues][varset]',_0x1bebb9[_0xa05c('0x10')]),_0x1f9c73);}};exports[_0xa05c('0x16')]=function(_0x5cfb24){try{if(!_[_0xa05c('0x15')](queues[_0x5cfb24[_0xa05c('0x10')]])){utils['debug'](util[_0xa05c('0x2')]('[%s][queues][queuecallerabandon]',_0x5cfb24[_0xa05c('0x10')]),_0x5cfb24);queues[_0x5cfb24[_0xa05c('0x10')]][_0xa05c('0x17')]=![];queues[_0x5cfb24['uniqueid']][_0xa05c('0x27')]=null;queues[_0x5cfb24[_0xa05c('0x10')]][_0xa05c('0x16')]=!![];queues[_0x5cfb24['uniqueid']][_0xa05c('0x26')]=utils[_0xa05c('0x14')]();queues[_0x5cfb24[_0xa05c('0x10')]][_0xa05c('0x7')]=_0xa05c('0x2b');utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x2c'),_0x5cfb24['uniqueid'],queues[_0x5cfb24[_0xa05c('0x10')]][_0xa05c('0x1c')],queues[_0x5cfb24[_0xa05c('0x10')]][_0xa05c('0x7')]));}}catch(_0x2a6027){utils[_0xa05c('0x1f')](util['format'](_0xa05c('0x2d'),_0x5cfb24[_0xa05c('0x10')]),_0x2a6027);}};exports[_0xa05c('0x2e')]=function(_0x2b9de0){try{if(!_[_0xa05c('0x15')](queues[_0x2b9de0[_0xa05c('0x10')]])){utils[_0xa05c('0x2f')](util[_0xa05c('0x2')](_0xa05c('0x30'),_0x2b9de0['uniqueid']),_0x2b9de0);utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x31'),_0x2b9de0[_0xa05c('0x10')],queues[_0x2b9de0[_0xa05c('0x10')]][_0xa05c('0x1c')],_0x2b9de0['connectedlinenum'],_0x2b9de0[_0xa05c('0x32')]));queues[_0x2b9de0['uniqueid']][_0xa05c('0x2e')]=!![];queues[_0x2b9de0[_0xa05c('0x10')]][_0xa05c('0x33')]=utils[_0xa05c('0x14')]();queues[_0x2b9de0[_0xa05c('0x10')]]['holdtime']=utils['diffTime'](queues[_0x2b9de0[_0xa05c('0x10')]][_0xa05c('0x33')],queues[_0x2b9de0['uniqueid']]['queuecallerjoinAt']);queues[_0x2b9de0['uniqueid']][_0xa05c('0x13')]=_0x2b9de0['position'];queues[_0x2b9de0['uniqueid']][_0xa05c('0x34')]=_0x2b9de0[_0xa05c('0x34')];queues[_0x2b9de0[_0xa05c('0x10')]][_0xa05c('0x35')]=_0x2b9de0[_0xa05c('0x35')];queues[_0x2b9de0['uniqueid']][_0xa05c('0x32')]=_0x2b9de0[_0xa05c('0x32')];}}catch(_0x2fe456){utils[_0xa05c('0x1f')](util[_0xa05c('0x2')](_0xa05c('0x30'),_0x2b9de0[_0xa05c('0x10')]),_0x2fe456);}};exports[_0xa05c('0x36')]=function(_0x2ad8e2){try{if(!_[_0xa05c('0x15')](queues[_0x2ad8e2['uniqueid']])){utils[_0xa05c('0x2f')](util[_0xa05c('0x2')](_0xa05c('0x37'),_0x2ad8e2[_0xa05c('0x10')]),_0x2ad8e2);utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x38'),_0x2ad8e2[_0xa05c('0x10')],queues[_0x2ad8e2[_0xa05c('0x10')]][_0xa05c('0x1c')],_0x2ad8e2[_0xa05c('0x39')],_0x2ad8e2['destaccountcode']));queues[_0x2ad8e2[_0xa05c('0x10')]][_0xa05c('0x16')]=![];queues[_0x2ad8e2['uniqueid']][_0xa05c('0x16')]=![];queues[_0x2ad8e2[_0xa05c('0x10')]][_0xa05c('0x26')]=null;queues[_0x2ad8e2['uniqueid']]['queuecallerexit']=![];queues[_0x2ad8e2[_0xa05c('0x10')]]['queuecallerexitreason']=null;queues[_0x2ad8e2['uniqueid']][_0xa05c('0x27')]=null;queues[_0x2ad8e2[_0xa05c('0x10')]]['assigned']=!![];queues[_0x2ad8e2[_0xa05c('0x10')]][_0xa05c('0x6')]=_0x2ad8e2[_0xa05c('0x3a')];queues[_0x2ad8e2[_0xa05c('0x10')]][_0xa05c('0x4')]=_0x2ad8e2[_0xa05c('0x39')];}}catch(_0x38e833){utils[_0xa05c('0x1f')](util[_0xa05c('0x2')](_0xa05c('0x37'),_0x2ad8e2[_0xa05c('0x10')]),_0x38e833);}};exports[_0xa05c('0x3b')]=function(_0x51c59c){try{if(!_[_0xa05c('0x15')](queues[_0x51c59c[_0xa05c('0x10')]])){if(queues[_0x51c59c[_0xa05c('0x10')]]['queuecallerleaveAt']){utils[_0xa05c('0x2f')](util['format']('[%s][queues][agentcomplete]',_0x51c59c[_0xa05c('0x10')]),_0x51c59c);queues[_0x51c59c[_0xa05c('0x10')]]['queuecallerabandon']=![];queues[_0x51c59c[_0xa05c('0x10')]]['queuecallerabandon']=![];queues[_0x51c59c[_0xa05c('0x10')]]['queuecallerabandonAt']=null;queues[_0x51c59c[_0xa05c('0x10')]]['queuecallerexit']=![];queues[_0x51c59c['uniqueid']][_0xa05c('0x27')]=null;queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x3c')]=!![];queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x4')]=_0x51c59c[_0xa05c('0x39')];queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x18')]=!![];queues[_0x51c59c[_0xa05c('0x10')]]['queuecallercompleteAt']=utils[_0xa05c('0x14')]();if(_0x51c59c[_0xa05c('0x3d')]==_0xa05c('0x3e')){if(!queues[_0x51c59c['uniqueid']]['transfer']){queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x7')]=_0xa05c('0x3f');}}else{queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x7')]='COMPLETEDBY'+_0x51c59c[_0xa05c('0x3d')][_0xa05c('0x24')]();}utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x40'),_0x51c59c[_0xa05c('0x10')],queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x1c')],_0x51c59c['membername'],queues[_0x51c59c[_0xa05c('0x10')]][_0xa05c('0x7')]));writeDB(queues[_0x51c59c[_0xa05c('0x10')]]);}}}catch(_0x273b6d){utils[_0xa05c('0x1f')](util[_0xa05c('0x2')](_0xa05c('0x41'),_0x51c59c[_0xa05c('0x10')]),_0x273b6d);}};exports[_0xa05c('0x42')]=function(_0x181500){try{if(!_[_0xa05c('0x15')](queues[_0x181500[_0xa05c('0x43')]])){utils['debug'](util[_0xa05c('0x2')](_0xa05c('0x44'),_0x181500['uniqueid']),_0x181500);queues[_0x181500['transfereeuniqueid']][_0xa05c('0x3e')]=!![];queues[_0x181500[_0xa05c('0x43')]][_0xa05c('0x45')]=_0xa05c('0x46');queues[_0x181500['transfereeuniqueid']]['transferexten']=_0x181500[_0xa05c('0x47')];queues[_0x181500[_0xa05c('0x43')]][_0xa05c('0x48')]=_0x181500[_0xa05c('0x43')];queues[_0x181500[_0xa05c('0x43')]][_0xa05c('0x7')]=_0xa05c('0x49');utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x4a'),_0x181500['uniqueid'],queues[_0x181500['transfereeuniqueid']][_0xa05c('0x1c')],_0x181500[_0xa05c('0x43')],_0x181500[_0xa05c('0x47')]));}}catch(_0x5510f9){utils['error'](util[_0xa05c('0x2')](_0xa05c('0x44'),_0x181500[_0xa05c('0x10')]),_0x5510f9);}};exports[_0xa05c('0x4b')]=function(_0x20c206){try{utils[_0xa05c('0x2f')](util[_0xa05c('0x2')]('[%s][queues][attendedtransfer]',_0x20c206[_0xa05c('0x4c')]),_0x20c206);if(_0x20c206[_0xa05c('0x4c')]==_0x20c206[_0xa05c('0x4d')]){if(!_[_0xa05c('0x15')](queues[_0x20c206['secondtransfererlinkedid']])){utils['info'](util['format'](_0xa05c('0x4e'),_0x20c206[_0xa05c('0x4c')],queues[_0x20c206[_0xa05c('0x4f')]][_0xa05c('0x1c')],_0x20c206[_0xa05c('0x50')]));queues[_0x20c206['secondtransfererlinkedid']][_0xa05c('0x3e')]=!![];queues[_0x20c206['secondtransfererlinkedid']][_0xa05c('0x45')]=_0xa05c('0x51');queues[_0x20c206[_0xa05c('0x4f')]]['transferexten']=_0x20c206[_0xa05c('0x50')];queues[_0x20c206[_0xa05c('0x4f')]][_0xa05c('0x48')]=_0x20c206['origtransfereruniqueid'];queues[_0x20c206['secondtransfererlinkedid']][_0xa05c('0x7')]='ATTENDEDTRANSFER';}if(!_[_0xa05c('0x15')](queues[_0x20c206['origtransfererlinkedid']])){if(_0x20c206[_0xa05c('0x52')]&&queues[_0x20c206[_0xa05c('0x52')]]){queues[_0x20c206[_0xa05c('0x52')]][_0xa05c('0x1e')]=0x1;queues[_0x20c206['transfereeuniqueid']]=_['clone'](queues[_0x20c206[_0xa05c('0x52')]]);queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0xe')]=_0x20c206['transfertargetuniqueid'];queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x1e')]=0x2;queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x5')]=queues[_0x20c206[_0xa05c('0x4f')]][_0xa05c('0x5')];queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x53')]=queues[_0x20c206['secondtransfererlinkedid']][_0xa05c('0x53')];queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x54')]=utils[_0xa05c('0x14')]();queues[_0x20c206['transfereeuniqueid']][_0xa05c('0x33')]=utils['now']();queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x55')]=0x0;queues[_0x20c206['transfereeuniqueid']][_0xa05c('0x56')]=0x0;utils[_0xa05c('0x1')](util[_0xa05c('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x20c206[_0xa05c('0x4c')],queues[_0x20c206['transfereeuniqueid']][_0xa05c('0x1c')],queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x5')],queues[_0x20c206[_0xa05c('0x43')]][_0xa05c('0x53')]));}else{utils['info'](util[_0xa05c('0x2')](_0xa05c('0x57'),_0x20c206[_0xa05c('0x4c')],queues[_0x20c206['origtransfererlinkedid']][_0xa05c('0x1c')],_0x20c206['secondtransfererlinkedid']));queues[_0x20c206[_0xa05c('0x4d')]][_0xa05c('0xe')]=_0x20c206['secondtransfererlinkedid'];}}}else if(_0x20c206[_0xa05c('0x58')]==_0x20c206['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x20c206[_0xa05c('0x4d')]])){utils[_0xa05c('0x1')](util['format'](_0xa05c('0x59'),_0x20c206[_0xa05c('0x4c')],queues[_0x20c206[_0xa05c('0x4d')]]['name'],_0x20c206[_0xa05c('0x58')],_0x20c206[_0xa05c('0x5a')]));queues[_0x20c206[_0xa05c('0x4d')]][_0xa05c('0x3e')]=!![];queues[_0x20c206[_0xa05c('0x4d')]][_0xa05c('0x45')]=_0xa05c('0x51');queues[_0x20c206['origtransfererlinkedid']]['transferexten']=_0x20c206[_0xa05c('0x5a')];queues[_0x20c206[_0xa05c('0x4d')]]['transferuniqueid']=_0x20c206[_0xa05c('0x58')];queues[_0x20c206[_0xa05c('0x4d')]][_0xa05c('0x7')]=_0xa05c('0x5b');}if(!_[_0xa05c('0x15')](queues[_0x20c206['secondtransfererlinkedid']])){if(_0x20c206[_0xa05c('0x5c')]&&queues[_0x20c206[_0xa05c('0x5c')]]){queues[_0x20c206[_0xa05c('0x5c')]][_0xa05c('0x1e')]=0x1;queues[_0x20c206[_0xa05c('0x5d')]]=_[_0xa05c('0x5e')](queues[_0x20c206[_0xa05c('0x5c')]]);queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0xe')]=_0x20c206[_0xa05c('0x5d')];queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0x1e')]=0x2;queues[_0x20c206['transfertargetuniqueid']][_0xa05c('0x5')]=queues[_0x20c206[_0xa05c('0x4d')]][_0xa05c('0x5')];queues[_0x20c206['transfertargetuniqueid']]['calleridname']=queues[_0x20c206[_0xa05c('0x4d')]][_0xa05c('0x53')];queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0x54')]=utils[_0xa05c('0x14')]();queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0x33')]=utils[_0xa05c('0x14')]();queues[_0x20c206['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0x56')]=0x0;utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x5f'),_0x20c206[_0xa05c('0x4c')],queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0x1c')],queues[_0x20c206[_0xa05c('0x5d')]][_0xa05c('0xe')],queues[_0x20c206['transfertargetuniqueid']][_0xa05c('0x5')],queues[_0x20c206[_0xa05c('0x5d')]]['calleridname']));}else{utils[_0xa05c('0x1')](util[_0xa05c('0x2')](_0xa05c('0x57'),_0x20c206[_0xa05c('0x4c')],queues[_0x20c206[_0xa05c('0x4f')]][_0xa05c('0x1c')],_0x20c206[_0xa05c('0x4d')]));queues[_0x20c206['secondtransfererlinkedid']]['transfereduniqueid']=_0x20c206['origtransfererlinkedid'];}}}}catch(_0x53de95){utils['error'](util[_0xa05c('0x2')](_0xa05c('0x60'),_0x20c206[_0xa05c('0x4c')]),_0x53de95);}};exports[_0xa05c('0x61')]=function(_0xed6e54){try{if(!_[_0xa05c('0x15')](queues[_0xed6e54[_0xa05c('0x10')]])){utils[_0xa05c('0x2f')](util[_0xa05c('0x2')](_0xa05c('0x62'),_0xed6e54[_0xa05c('0x10')]),_0xed6e54);queues[_0xed6e54['uniqueid']][_0xa05c('0x63')]=utils[_0xa05c('0x14')]();utils[_0xa05c('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0xed6e54[_0xa05c('0x10')],queues[_0xed6e54['uniqueid']][_0xa05c('0x1c')],queues[_0xed6e54[_0xa05c('0x10')]][_0xa05c('0x63')]));}}catch(_0x5275fd){utils[_0xa05c('0x1f')](util['format'](_0xa05c('0x62'),_0xed6e54[_0xa05c('0x10')]),_0x5275fd);}};exports[_0xa05c('0x64')]=function(_0x13224b){try{if(!_[_0xa05c('0x15')](queues[_0x13224b[_0xa05c('0x10')]])){if(!_['isNil'](queues[_0x13224b[_0xa05c('0x10')]][_0xa05c('0x63')])){utils[_0xa05c('0x2f')](util['format'](_0xa05c('0x65'),_0x13224b[_0xa05c('0x10')]),_0x13224b);queues[_0x13224b[_0xa05c('0x10')]][_0xa05c('0x56')]+=utils[_0xa05c('0x66')](utils[_0xa05c('0x14')](),queues[_0x13224b[_0xa05c('0x10')]]['musiconholdstartAt']);utils['info'](util[_0xa05c('0x2')](_0xa05c('0x67'),_0x13224b[_0xa05c('0x10')],queues[_0x13224b[_0xa05c('0x10')]][_0xa05c('0x1c')],queues[_0x13224b[_0xa05c('0x10')]][_0xa05c('0x56')]));delete queues[_0x13224b[_0xa05c('0x10')]][_0xa05c('0x63')];}}}catch(_0xf93d42){utils[_0xa05c('0x1f')](util['format']('[%s][queues][musiconholdstop]',_0x13224b[_0xa05c('0x10')]),_0xf93d42);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 08d0b6d..24ce61c 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 _0xa236=['calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','channelstate','channel','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa236,0x8f));var _0x6a23=function(_0x4d378d,_0x3820b1){_0x4d378d=_0x4d378d-0x0;var _0x5c4d81=_0xa236[_0x4d378d];return _0x5c4d81;};'use strict';var _=require(_0x6a23('0x0'));var util=require(_0x6a23('0x1'));var utils=require(_0x6a23('0x2'));var recordings={};function writeDB(_0xda6f6f){utils['info'](util[_0x6a23('0x3')]('[%s][recordings][writeDB]',_0xda6f6f[_0x6a23('0x4')]));if(_0xda6f6f[_0x6a23('0x5')]){utils[_0x6a23('0x6')](_0xda6f6f[_0x6a23('0x5')])[_0x6a23('0x7')](function(_0x2d7e7b){if(_0x2d7e7b){_0xda6f6f[_0x6a23('0x8')]=_0x2d7e7b[_0x6a23('0x9')];_0xda6f6f[_0x6a23('0xa')]=_0x2d7e7b['id'];}utils[_0x6a23('0xb')](_0x6a23('0xc'),_0xda6f6f);});}else{utils[_0x6a23('0xb')](_0x6a23('0xc'),_0xda6f6f);}}exports['newchannel']=function(_0x359fd4){try{utils['debug'](util[_0x6a23('0x3')](_0x6a23('0xd'),_0x359fd4['uniqueid']),_0x359fd4);if(_0x359fd4['uniqueid']==_0x359fd4[_0x6a23('0xe')]){utils[_0x6a23('0xf')](util[_0x6a23('0x3')](_0x6a23('0x10'),_0x359fd4[_0x6a23('0x4')],_0x359fd4[_0x6a23('0x11')],_0x359fd4[_0x6a23('0x12')]));recordings[_0x359fd4[_0x6a23('0x4')]]={'uniqueid':_0x359fd4['uniqueid'],'accountcode':_0x359fd4[_0x6a23('0x5')],'exten':_0x359fd4['exten'],'context':_0x359fd4[_0x6a23('0x11')],'channel':_0x359fd4['channel'],'monitors':[]};}}catch(_0x41e37e){utils[_0x6a23('0x13')](util[_0x6a23('0x3')]('[%s][recordings][newchannel]',_0x359fd4[_0x6a23('0x4')]),_0x41e37e);}};exports[_0x6a23('0x14')]=function(_0x355fb6){try{utils['debug'](util[_0x6a23('0x3')]('[%s][recordings][newstate]',_0x355fb6[_0x6a23('0x4')]),_0x355fb6);if(!_['isNil'](recordings[_0x355fb6[_0x6a23('0x4')]])&&_0x355fb6[_0x6a23('0x15')]==0x6){utils[_0x6a23('0xf')](util[_0x6a23('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x355fb6[_0x6a23('0x4')],_0x355fb6[_0x6a23('0x11')],_0x355fb6[_0x6a23('0x16')]));}else if(!_[_0x6a23('0x17')](recordings[_0x355fb6[_0x6a23('0xe')]])&&_0x355fb6[_0x6a23('0x15')]==0x6&&_0x355fb6['context']!=_0x6a23('0x18')){utils['info'](util[_0x6a23('0x3')](_0x6a23('0x19'),_0x355fb6['uniqueid'],_0x355fb6['linkedid'],_0x355fb6[_0x6a23('0x11')],_0x355fb6['channel']));recordings[_0x355fb6[_0x6a23('0xe')]]['accountcode']=_0x355fb6['accountcode'];}}catch(_0x433e3d){utils[_0x6a23('0x13')](util['format'](_0x6a23('0x1a'),_0x355fb6['uniqueid']),_0x433e3d);}};exports[_0x6a23('0x1b')]=function(_0x17edf0){try{if(!_[_0x6a23('0x17')](_0x17edf0[_0x6a23('0x1c')])&&!_['isNil'](_0x17edf0[_0x6a23('0x1c')][_0x6a23('0x1d')])){utils[_0x6a23('0x1e')](util[_0x6a23('0x3')](_0x6a23('0x1f'),_0x17edf0[_0x6a23('0x4')]),_0x17edf0);utils[_0x6a23('0xf')](util[_0x6a23('0x3')](_0x6a23('0x20'),_0x17edf0['uniqueid'],_0x17edf0['variable'],_0x17edf0[_0x6a23('0x21')]));if(_['endsWith'](_0x17edf0[_0x6a23('0x21')],_0x6a23('0x22'))){_0x17edf0[_0x6a23('0x21')]=_0x17edf0[_0x6a23('0x21')]['replace'](_0x6a23('0x22'),_0x6a23('0x23'));}if(recordings[_0x17edf0[_0x6a23('0xe')]]){var _0x504928=_['find'](recordings[_0x17edf0[_0x6a23('0xe')]][_0x6a23('0x24')],{'value':_0x17edf0['value']});if(_[_0x6a23('0x17')](_0x504928)){recordings[_0x17edf0[_0x6a23('0xe')]][_0x6a23('0x24')][_0x6a23('0x25')]({'value':_0x17edf0[_0x6a23('0x21')]});}}}}catch(_0x45029c){utils[_0x6a23('0x13')](util['format'](_0x6a23('0x1f'),_0x17edf0[_0x6a23('0x4')]),_0x45029c);}};exports['hangup']=function(_0x4f83d8){try{if(!_['isNil'](recordings[_0x4f83d8[_0x6a23('0x4')]])){utils['debug'](util['format'](_0x6a23('0x26'),_0x4f83d8[_0x6a23('0x4')]),_0x4f83d8);utils[_0x6a23('0xf')](util[_0x6a23('0x3')](_0x6a23('0x27'),_0x4f83d8['uniqueid'],_0x4f83d8[_0x6a23('0x28')],_0x4f83d8[_0x6a23('0x29')],_0x4f83d8['cause-txt']));recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x28')]=_0x4f83d8[_0x6a23('0x28')];recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x29')]=_0x4f83d8['calleridname'];recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x2a')]=_0x4f83d8[_0x6a23('0x2a')];recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x2b')]=_0x4f83d8[_0x6a23('0x2b')];if(recordings[_0x4f83d8['uniqueid']][_0x6a23('0x2c')]==_0x6a23('0x2d')&&recordings[_0x4f83d8['uniqueid']][_0x6a23('0x5')]){recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x2a')]=recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x5')];recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x2b')]='';}recordings[_0x4f83d8[_0x6a23('0x4')]][_0x6a23('0x24')][_0x6a23('0x2e')](function(_0x2c74f3){var _0x5b65f1=_[_0x6a23('0x2f')](recordings[_0x4f83d8[_0x6a23('0x4')]]);_0x5b65f1[_0x6a23('0x21')]=_0x2c74f3[_0x6a23('0x21')];writeDB(_0x5b65f1);});delete recordings[_0x4f83d8[_0x6a23('0x4')]];}}catch(_0x1cc29c){utils[_0x6a23('0x13')](util[_0x6a23('0x3')](_0x6a23('0x26'),_0x4f83d8[_0x6a23('0x4')]),_0x1cc29c);}};exports[_0x6a23('0x30')]=function(_0x402ddd){try{if(!_['isNil'](recordings[_0x402ddd[_0x6a23('0x4')]])){utils[_0x6a23('0x1e')](util['format'](_0x6a23('0x31'),_0x402ddd[_0x6a23('0x4')]),_0x402ddd);utils['info'](util['format'](_0x6a23('0x32'),_0x402ddd[_0x6a23('0x4')],_0x402ddd[_0x6a23('0x33')],_0x402ddd[_0x6a23('0x34')]));if(_0x402ddd[_0x6a23('0x33')]['toLowerCase']()==_0x6a23('0x35')&&_['startsWith'](_0x402ddd['appdata'][_0x6a23('0x36')](),'cdr')){var _0x300f82=_0x402ddd[_0x6a23('0x34')][_0x6a23('0x37')]('=');var _0x24c933=_0x300f82[0x0]['substring'](_0x300f82[0x0][_0x6a23('0x38')]('(')+0x1,_0x300f82[0x0][_0x6a23('0x38')](')'));var _0x3fd2b3=_0x300f82[0x1];recordings[_0x402ddd[_0x6a23('0x4')]][_0x24c933]=_0x3fd2b3;}}}catch(_0x1dece2){utils[_0x6a23('0x13')](util['format']('[%s][recordings][newexten]',_0x402ddd[_0x6a23('0x4')]),_0x1dece2);}};exports[_0x6a23('0x39')]=function(_0x3ec01e){try{if(!_[_0x6a23('0x17')](recordings[_0x3ec01e[_0x6a23('0x4')]])){utils[_0x6a23('0x1e')](util[_0x6a23('0x3')](_0x6a23('0x3a'),_0x3ec01e['uniqueid']),_0x3ec01e);utils[_0x6a23('0xf')](util[_0x6a23('0x3')](_0x6a23('0x3b'),_0x3ec01e[_0x6a23('0x4')],_0x3ec01e[_0x6a23('0x3c')]));recordings[_0x3ec01e[_0x6a23('0x4')]][_0x6a23('0x3c')]=_0x3ec01e[_0x6a23('0x3c')];}}catch(_0x56596b){utils['error'](util[_0x6a23('0x3')](_0x6a23('0x3a'),_0x3ec01e['uniqueid']),_0x56596b);}}; \ No newline at end of file +var _0x0965=['monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','application','set','startsWith','toLowerCase','appdata','split','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV'];(function(_0x285d12,_0x486795){var _0x22e573=function(_0x59f605){while(--_0x59f605){_0x285d12['push'](_0x285d12['shift']());}};_0x22e573(++_0x486795);}(_0x0965,0x187));var _0x5096=function(_0x1c8e7c,_0x55acd1){_0x1c8e7c=_0x1c8e7c-0x0;var _0x361567=_0x0965[_0x1c8e7c];return _0x361567;};'use strict';var _=require(_0x5096('0x0'));var util=require(_0x5096('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x40583a){utils[_0x5096('0x2')](util[_0x5096('0x3')](_0x5096('0x4'),_0x40583a['uniqueid']));if(_0x40583a['accountcode']){utils[_0x5096('0x5')](_0x40583a[_0x5096('0x6')])['then'](function(_0x2eb570){if(_0x2eb570){_0x40583a['membername']=_0x2eb570[_0x5096('0x7')];_0x40583a[_0x5096('0x8')]=_0x2eb570['id'];}utils[_0x5096('0x9')](_0x5096('0xa'),_0x40583a);});}else{utils['request']('CreateVoiceRecording',_0x40583a);}}exports[_0x5096('0xb')]=function(_0x5b2168){try{utils[_0x5096('0xc')](util[_0x5096('0x3')](_0x5096('0xd'),_0x5b2168[_0x5096('0xe')]),_0x5b2168);if(_0x5b2168[_0x5096('0xe')]==_0x5b2168[_0x5096('0xf')]){utils[_0x5096('0x2')](util[_0x5096('0x3')](_0x5096('0x10'),_0x5b2168[_0x5096('0xe')],_0x5b2168[_0x5096('0x11')],_0x5b2168['exten']));recordings[_0x5b2168[_0x5096('0xe')]]={'uniqueid':_0x5b2168[_0x5096('0xe')],'accountcode':_0x5b2168[_0x5096('0x6')],'exten':_0x5b2168['exten'],'context':_0x5b2168[_0x5096('0x11')],'channel':_0x5b2168[_0x5096('0x12')],'monitors':[]};}}catch(_0x38aa04){utils[_0x5096('0x13')](util[_0x5096('0x3')]('[%s][recordings][newchannel]',_0x5b2168[_0x5096('0xe')]),_0x38aa04);}};exports[_0x5096('0x14')]=function(_0x240df5){try{utils[_0x5096('0xc')](util[_0x5096('0x3')]('[%s][recordings][newstate]',_0x240df5['uniqueid']),_0x240df5);if(!_[_0x5096('0x15')](recordings[_0x240df5['uniqueid']])&&_0x240df5['channelstate']==0x6){utils[_0x5096('0x2')](util['format'](_0x5096('0x16'),_0x240df5[_0x5096('0xe')],_0x240df5['context'],_0x240df5[_0x5096('0x12')]));}else if(!_[_0x5096('0x15')](recordings[_0x240df5[_0x5096('0xf')]])&&_0x240df5[_0x5096('0x17')]==0x6&&_0x240df5['context']!=_0x5096('0x18')){utils[_0x5096('0x2')](util[_0x5096('0x3')](_0x5096('0x19'),_0x240df5[_0x5096('0xe')],_0x240df5[_0x5096('0xf')],_0x240df5[_0x5096('0x11')],_0x240df5[_0x5096('0x12')]));recordings[_0x240df5[_0x5096('0xf')]]['accountcode']=_0x240df5['accountcode'];}}catch(_0x298f98){utils['error'](util[_0x5096('0x3')](_0x5096('0x1a'),_0x240df5[_0x5096('0xe')]),_0x298f98);}};exports[_0x5096('0x1b')]=function(_0x26ba68){try{if(!_[_0x5096('0x15')](_0x26ba68[_0x5096('0x1c')])&&!_[_0x5096('0x15')](_0x26ba68[_0x5096('0x1c')][_0x5096('0x1d')])){utils[_0x5096('0xc')](util['format'](_0x5096('0x1e'),_0x26ba68[_0x5096('0xe')]),_0x26ba68);utils[_0x5096('0x2')](util['format'](_0x5096('0x1f'),_0x26ba68[_0x5096('0xe')],_0x26ba68[_0x5096('0x1c')],_0x26ba68[_0x5096('0x20')]));if(_[_0x5096('0x21')](_0x26ba68[_0x5096('0x20')],_0x5096('0x22'))){_0x26ba68[_0x5096('0x20')]=_0x26ba68[_0x5096('0x20')]['replace'](_0x5096('0x22'),_0x5096('0x23'));}if(recordings[_0x26ba68['linkedid']]){var _0x351844=_['find'](recordings[_0x26ba68[_0x5096('0xf')]][_0x5096('0x24')],{'value':_0x26ba68[_0x5096('0x20')]});if(_[_0x5096('0x15')](_0x351844)){recordings[_0x26ba68[_0x5096('0xf')]]['monitors'][_0x5096('0x25')]({'value':_0x26ba68['value']});}}}}catch(_0x38df77){utils[_0x5096('0x13')](util[_0x5096('0x3')](_0x5096('0x1e'),_0x26ba68[_0x5096('0xe')]),_0x38df77);}};exports[_0x5096('0x26')]=function(_0x73b956){try{if(!_[_0x5096('0x15')](recordings[_0x73b956[_0x5096('0xe')]])){utils[_0x5096('0xc')](util['format'](_0x5096('0x27'),_0x73b956[_0x5096('0xe')]),_0x73b956);utils['info'](util[_0x5096('0x3')](_0x5096('0x28'),_0x73b956['uniqueid'],_0x73b956[_0x5096('0x29')],_0x73b956[_0x5096('0x2a')],_0x73b956[_0x5096('0x2b')]));recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x29')]=_0x73b956[_0x5096('0x29')];recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x2a')]=_0x73b956[_0x5096('0x2a')];recordings[_0x73b956['uniqueid']][_0x5096('0x2c')]=_0x73b956[_0x5096('0x2c')];recordings[_0x73b956[_0x5096('0xe')]]['connectedlinename']=_0x73b956[_0x5096('0x2d')];if(recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x2e')]=='outbound'&&recordings[_0x73b956[_0x5096('0xe')]]['accountcode']){recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x2c')]=recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x6')];recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x2d')]='';}recordings[_0x73b956[_0x5096('0xe')]][_0x5096('0x24')][_0x5096('0x2f')](function(_0x4ef9c3){var _0x35d976=_[_0x5096('0x30')](recordings[_0x73b956[_0x5096('0xe')]]);_0x35d976[_0x5096('0x20')]=_0x4ef9c3[_0x5096('0x20')];writeDB(_0x35d976);});delete recordings[_0x73b956[_0x5096('0xe')]];}}catch(_0x64a066){utils[_0x5096('0x13')](util['format'](_0x5096('0x27'),_0x73b956[_0x5096('0xe')]),_0x64a066);}};exports[_0x5096('0x31')]=function(_0x4caf5b){try{if(!_[_0x5096('0x15')](recordings[_0x4caf5b['uniqueid']])){utils[_0x5096('0xc')](util[_0x5096('0x3')](_0x5096('0x32'),_0x4caf5b[_0x5096('0xe')]),_0x4caf5b);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4caf5b[_0x5096('0xe')],_0x4caf5b['application'],_0x4caf5b['appdata']));if(_0x4caf5b[_0x5096('0x33')]['toLowerCase']()==_0x5096('0x34')&&_[_0x5096('0x35')](_0x4caf5b['appdata'][_0x5096('0x36')](),'cdr')){var _0x3c2a3b=_0x4caf5b[_0x5096('0x37')][_0x5096('0x38')]('=');var _0x177c88=_0x3c2a3b[0x0]['substring'](_0x3c2a3b[0x0][_0x5096('0x39')]('(')+0x1,_0x3c2a3b[0x0]['lastIndexOf'](')'));var _0x291d56=_0x3c2a3b[0x1];recordings[_0x4caf5b[_0x5096('0xe')]][_0x177c88]=_0x291d56;}}}catch(_0x1d7aa9){utils[_0x5096('0x13')](util['format']('[%s][recordings][newexten]',_0x4caf5b[_0x5096('0xe')]),_0x1d7aa9);}};exports[_0x5096('0x3a')]=function(_0x447f4d){try{if(!_[_0x5096('0x15')](recordings[_0x447f4d['uniqueid']])){utils[_0x5096('0xc')](util[_0x5096('0x3')]('[%s][recordings][queuecallerjoin]',_0x447f4d['uniqueid']),_0x447f4d);utils[_0x5096('0x2')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x447f4d[_0x5096('0xe')],_0x447f4d[_0x5096('0x3b')]));recordings[_0x447f4d[_0x5096('0xe')]][_0x5096('0x3b')]=_0x447f4d['queue'];}}catch(_0x41c595){utils['error'](util[_0x5096('0x3')](_0x5096('0x3c'),_0x447f4d[_0x5096('0xe')]),_0x41c595);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 6449aca..e6e465b 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 _0x78fa=['attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x78fa,0x141));var _0xa78f=function(_0x310285,_0x6af2ed){_0x310285=_0x310285-0x0;var _0x3173db=_0x78fa[_0x310285];return _0x3173db;};'use strict';var _=require(_0xa78f('0x0'));var util=require(_0xa78f('0x1'));var utils=require(_0xa78f('0x2'));function writeDB(_0x175da3){utils[_0xa78f('0x3')](util[_0xa78f('0x4')](_0xa78f('0x5'),_0x175da3[_0xa78f('0x6')]===_0xa78f('0x7')?_0x175da3[_0xa78f('0x8')]:_0x175da3['uniqueid'],_0x175da3['type']));utils[_0xa78f('0x9')](_0xa78f('0xa'),_0x175da3);}exports[_0xa78f('0xb')]=function(_0xc71c41){try{utils['debug'](util[_0xa78f('0x4')](_0xa78f('0xc'),_0xc71c41[_0xa78f('0xd')]),_0xc71c41);utils[_0xa78f('0x3')](util[_0xa78f('0x4')](_0xa78f('0xe'),_0xc71c41['uniqueid'],_0xc71c41[_0xa78f('0xf')],_0xc71c41[_0xa78f('0x10')],_0xc71c41['transfereecalleridnum'],_0xc71c41[_0xa78f('0x11')]));_0xc71c41[_0xa78f('0x6')]='blind';writeDB(_0xc71c41);}catch(_0x3c0480){utils[_0xa78f('0x12')](util['format'](_0xa78f('0xc'),_0xc71c41['uniqueid']),_0x3c0480);}};exports[_0xa78f('0x13')]=function(_0x526c44){try{utils['debug'](util[_0xa78f('0x4')](_0xa78f('0x14'),_0x526c44['origtransfereruniqueid']),_0x526c44);utils[_0xa78f('0x3')](util[_0xa78f('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x526c44[_0xa78f('0x8')],_0x526c44[_0xa78f('0x15')],_0x526c44['origtransferercalleridname'],_0x526c44[_0xa78f('0x16')],_0x526c44[_0xa78f('0x17')]));_0x526c44=_['assign'](_0x526c44,{'transfererchannel':_0x526c44[_0xa78f('0x18')],'transferercalleridnum':_0x526c44[_0xa78f('0x15')],'transferercalleridname':_0x526c44[_0xa78f('0x19')],'transfererconnectedlinenum':_0x526c44[_0xa78f('0x1a')],'transfererconnectedlinename':_0x526c44[_0xa78f('0x1b')],'transfereraccountcode':_0x526c44[_0xa78f('0x1c')],'transferercontext':_0x526c44[_0xa78f('0x1d')],'transfererexten':_0x526c44[_0xa78f('0x1e')],'transfererlinkedid':_0x526c44[_0xa78f('0x1f')],'context':_0x526c44['origtransferercontext'],'extension':_0x526c44[_0xa78f('0x20')],'type':_0xa78f('0x7')});if(_[_0xa78f('0x21')](_0x526c44[_0xa78f('0x22')])){_0x526c44=_['assign'](_0x526c44,{'transfereechannel':_0x526c44[_0xa78f('0x23')],'transfereecalleridnum':_0x526c44[_0xa78f('0x16')],'transfereecalleridname':_0x526c44[_0xa78f('0x17')],'transfereeconnectedlinenum':_0x526c44['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x526c44[_0xa78f('0x24')],'transfereeaccountcode':_0x526c44[_0xa78f('0x25')],'transfereecontext':_0x526c44[_0xa78f('0x26')],'transfereeexten':_0x526c44[_0xa78f('0x27')],'transfereelinkedid':_0x526c44[_0xa78f('0x28')]});}writeDB(_0x526c44);}catch(_0x3cd37f){utils[_0xa78f('0x12')](util[_0xa78f('0x4')](_0xa78f('0x14'),_0x526c44[_0xa78f('0x8')]),_0x3cd37f);}}; \ No newline at end of file +var _0xd53c=['transfereecalleridname','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum'];(function(_0x373e27,_0x527f8d){var _0x4a336f=function(_0x2cf6c0){while(--_0x2cf6c0){_0x373e27['push'](_0x373e27['shift']());}};_0x4a336f(++_0x527f8d);}(_0xd53c,0xe6));var _0xcd53=function(_0x28b13b,_0x1904a1){_0x28b13b=_0x28b13b-0x0;var _0x484607=_0xd53c[_0x28b13b];return _0x484607;};'use strict';var _=require(_0xcd53('0x0'));var util=require(_0xcd53('0x1'));var utils=require('./utils');function writeDB(_0x5c9805){utils[_0xcd53('0x2')](util[_0xcd53('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x5c9805[_0xcd53('0x4')]===_0xcd53('0x5')?_0x5c9805[_0xcd53('0x6')]:_0x5c9805[_0xcd53('0x7')],_0x5c9805[_0xcd53('0x4')]));utils[_0xcd53('0x8')](_0xcd53('0x9'),_0x5c9805);}exports[_0xcd53('0xa')]=function(_0x387a52){try{utils[_0xcd53('0xb')](util[_0xcd53('0x3')]('[%s][transfers][blindtransfer]',_0x387a52[_0xcd53('0x7')]),_0x387a52);utils['info'](util[_0xcd53('0x3')](_0xcd53('0xc'),_0x387a52[_0xcd53('0x7')],_0x387a52[_0xcd53('0xd')],_0x387a52[_0xcd53('0xe')],_0x387a52[_0xcd53('0xf')],_0x387a52[_0xcd53('0x10')]));_0x387a52['type']='blind';writeDB(_0x387a52);}catch(_0x19fa7d){utils[_0xcd53('0x11')](util['format'](_0xcd53('0x12'),_0x387a52[_0xcd53('0x7')]),_0x19fa7d);}};exports[_0xcd53('0x13')]=function(_0x18d98d){try{utils[_0xcd53('0xb')](util[_0xcd53('0x3')]('[%s][transfers][attendedtransfer]',_0x18d98d['origtransfereruniqueid']),_0x18d98d);utils[_0xcd53('0x2')](util[_0xcd53('0x3')](_0xcd53('0x14'),_0x18d98d['origtransfereruniqueid'],_0x18d98d[_0xcd53('0x15')],_0x18d98d['origtransferercalleridname'],_0x18d98d['transfertargetcalleridnum'],_0x18d98d[_0xcd53('0x16')]));_0x18d98d=_[_0xcd53('0x17')](_0x18d98d,{'transfererchannel':_0x18d98d[_0xcd53('0x18')],'transferercalleridnum':_0x18d98d[_0xcd53('0x15')],'transferercalleridname':_0x18d98d[_0xcd53('0x19')],'transfererconnectedlinenum':_0x18d98d[_0xcd53('0x1a')],'transfererconnectedlinename':_0x18d98d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x18d98d[_0xcd53('0x1b')],'transferercontext':_0x18d98d[_0xcd53('0x1c')],'transfererexten':_0x18d98d[_0xcd53('0x1d')],'transfererlinkedid':_0x18d98d['origtransfererlinkedid'],'context':_0x18d98d[_0xcd53('0x1e')],'extension':_0x18d98d['origtransfererexten'],'type':_0xcd53('0x5')});if(_[_0xcd53('0x1f')](_0x18d98d[_0xcd53('0x20')])){_0x18d98d=_['assign'](_0x18d98d,{'transfereechannel':_0x18d98d[_0xcd53('0x21')],'transfereecalleridnum':_0x18d98d[_0xcd53('0x22')],'transfereecalleridname':_0x18d98d[_0xcd53('0x16')],'transfereeconnectedlinenum':_0x18d98d[_0xcd53('0x23')],'transfereeconnectedlinename':_0x18d98d[_0xcd53('0x24')],'transfereeaccountcode':_0x18d98d[_0xcd53('0x25')],'transfereecontext':_0x18d98d['transfertargetcontext'],'transfereeexten':_0x18d98d[_0xcd53('0x26')],'transfereelinkedid':_0x18d98d[_0xcd53('0x27')]});}writeDB(_0x18d98d);}catch(_0x10f250){utils['error'](util[_0xcd53('0x3')](_0xcd53('0x28'),_0x18d98d['origtransfereruniqueid']),_0x10f250);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 01036a2..c3c7a84 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 _0x655f=['moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x655f,0xc6));var _0xf655=function(_0x277a47,_0x31bf51){_0x277a47=_0x277a47-0x0;var _0x4d86e2=_0x655f[_0x277a47];return _0x4d86e2;};'use strict';var BPromise=require(_0xf655('0x0'));var jayson=require(_0xf655('0x1'));var moment=require(_0xf655('0x2'));var util=require(_0xf655('0x3'));var client=jayson[_0xf655('0x4')]['http']({'port':0x2329});var logger=require(_0xf655('0x5'))(_0xf655('0x6'));exports[_0xf655('0x7')]=function(_0x49f8f2,_0x1bd587){logger[_0xf655('0x7')](_0x49f8f2,_0x1bd587?util[_0xf655('0x8')](_0x1bd587,{'showHidden':![],'depth':null}):'');};exports[_0xf655('0x9')]=function(_0x2ceb7f,_0x159ef0){logger[_0xf655('0x9')](_0x2ceb7f,_0x159ef0?util[_0xf655('0x8')](_0x159ef0,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x23567a,_0x59f643){logger[_0xf655('0xa')](_0x23567a,_0x59f643?util[_0xf655('0x8')](_0x59f643,{'showHidden':![],'depth':null}):'');};exports[_0xf655('0xb')]=function(_0x2016ee,_0x128d2d){return client[_0xf655('0xb')](_0x2016ee,{'body':_0x128d2d})[_0xf655('0xc')](function(_0x33c1cd){logger[_0xf655('0x9')](_0xf655('0xd'),_0x2016ee,_0x33c1cd?util['inspect'](_0x33c1cd,{'showHidden':![],'depth':null}):'');})[_0xf655('0xe')](function(_0x4ddeb7){logger[_0xf655('0xa')]('[utils][request]\x20name:%s',_0x2016ee,_0x4ddeb7?util['inspect'](_0x4ddeb7,{'showHidden':![],'depth':null}):'');});};function getUser(_0xaacf75){return client[_0xf655('0xb')](_0xf655('0xf'),{'options':{'raw':!![],'attributes':['id','internal',_0xf655('0x10'),_0xf655('0x11')],'where':_0xaacf75,'limit':0x1}})['then'](function(_0xa713c0){logger[_0xf655('0x9')](_0xf655('0x12'),JSON[_0xf655('0x13')](_0xaacf75),_0xa713c0?util[_0xf655('0x8')](_0xa713c0,{'showHidden':![],'depth':null}):'');return _0xa713c0[_0xf655('0x14')][_0xf655('0x15')]?_0xa713c0[_0xf655('0x14')][0x0]:null;});}exports[_0xf655('0x16')]=function(_0x285119){return new BPromise(function(_0x14fd84,_0x3e46f8){if(_0x285119){return getUser({'internal':_0x285119})[_0xf655('0xc')](function(_0x43096f){logger[_0xf655('0x7')](_0xf655('0x17'),_0x285119,_0x43096f?'found':_0xf655('0x18'));return _0x14fd84(_0x43096f);})[_0xf655('0xe')](function(_0x3e97a7){logger[_0xf655('0xa')](_0xf655('0x19'),_0x3e97a7?util['inspect'](_0x3e97a7,{'showHidden':![],'depth':null}):'');return _0x14fd84(null);});}return _0x14fd84(null);});};exports['getUserByInterface']=function(_0x286e37){return new BPromise(function(_0x4299da,_0x1e45bb){if(_0x286e37){return getUser({'interface':_0x286e37})[_0xf655('0xc')](function(_0x5c422e){logger['info'](_0xf655('0x1a'),_0x286e37,_0x5c422e?_0xf655('0x1b'):'notfound');return _0x4299da(_0x5c422e);})['catch'](function(_0x210636){logger[_0xf655('0xa')](_0xf655('0x1c'),_0x210636?util[_0xf655('0x8')](_0x210636,{'showHidden':![],'depth':null}):'');return _0x4299da(null);});}return _0x4299da(null);});};exports[_0xf655('0x1d')]=function(_0x609c97){return new BPromise(function(_0x2e1429,_0x500f35){if(_0x609c97){return getUser({'name':_0x609c97})['then'](function(_0x20a739){logger[_0xf655('0x7')](_0xf655('0x1e'),_0x609c97,_0x20a739?'found':_0xf655('0x18'));return _0x2e1429(_0x20a739);})[_0xf655('0xe')](function(_0xd87394){logger[_0xf655('0xa')](_0xf655('0x1f'),_0xd87394?util[_0xf655('0x8')](_0xd87394,{'showHidden':![],'depth':null}):'');return _0x2e1429(null);});}return _0x2e1429(null);});};exports[_0xf655('0x20')]=function(_0x11e580){return new BPromise(function(_0x5803b4,_0x24e293){if(_0x11e580){return client[_0xf655('0xb')](_0xf655('0x21'),{'options':{'raw':!![],'attributes':['id','name',_0xf655('0x22'),_0xf655('0x23'),_0xf655('0x24')],'where':{'name':_0x11e580},'limit':0x1}})[_0xf655('0xc')](function(_0x3abbfb){logger[_0xf655('0x9')](_0xf655('0x25'),_0x11e580,_0x3abbfb?util[_0xf655('0x8')](_0x3abbfb,{'showHidden':![],'depth':null}):'');logger[_0xf655('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x11e580,_0x3abbfb?_0xf655('0x1b'):_0xf655('0x18'));return _0x5803b4(_0x3abbfb[_0xf655('0x14')][_0xf655('0x15')]?_0x3abbfb[_0xf655('0x14')][0x0]:null);})[_0xf655('0xe')](function(_0x3f67f3){logger['error']('[utils][getVoiceQueueByName]',_0x3f67f3?util['inspect'](_0x3f67f3,{'showHidden':![],'depth':null}):'');return _0x5803b4(null);});}return _0x5803b4(null);});};exports[_0xf655('0x26')]=function(_0x577956,_0xe4bbec){return moment(_0x577956)['add'](_0xe4bbec,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf655('0x27')]=function(_0x157596,_0x1e6cd2){return moment(_0x157596)[_0xf655('0x28')](_0x1e6cd2,_0xf655('0x29'))['format'](_0xf655('0x2a'));};exports[_0xf655('0x2b')]=function(_0x346ea9,_0x4f46bb){return moment(_0x346ea9)[_0xf655('0x2c')](moment(_0x4f46bb),_0xf655('0x29'));};exports[_0xf655('0x2d')]=function(_0x3ad279,_0x1f7f49){return parseInt(_0x3ad279,0xa)+parseInt(_0x1f7f49,0xa);};exports[_0xf655('0x2e')]=function(){return moment()[_0xf655('0x2f')](_0xf655('0x2a'));};exports[_0xf655('0x30')]=function(_0x431ae8,_0x620e67){if(_0x620e67){return moment(_0x431ae8)[_0xf655('0x30')](_0x620e67);}return!![];};exports['isBefore']=function(_0x2b346b,_0x41e322){if(_0x41e322){return moment(_0x2b346b)[_0xf655('0x31')](_0x41e322);}else if(_0x2b346b){return!![];}return![];}; \ No newline at end of file +var _0x461a=['getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]'];(function(_0x2bd440,_0xfb5a9d){var _0x58f325=function(_0x19847f){while(--_0x19847f){_0x2bd440['push'](_0x2bd440['shift']());}};_0x58f325(++_0xfb5a9d);}(_0x461a,0x192));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa461('0x0'));var moment=require(_0xa461('0x1'));var util=require(_0xa461('0x2'));var client=jayson[_0xa461('0x3')][_0xa461('0x4')]({'port':0x2329});var logger=require(_0xa461('0x5'))(_0xa461('0x6'));exports['info']=function(_0xb01b28,_0x3a2d86){logger['info'](_0xb01b28,_0x3a2d86?util[_0xa461('0x7')](_0x3a2d86,{'showHidden':![],'depth':null}):'');};exports[_0xa461('0x8')]=function(_0x2b181a,_0x143950){logger['debug'](_0x2b181a,_0x143950?util['inspect'](_0x143950,{'showHidden':![],'depth':null}):'');};exports[_0xa461('0x9')]=function(_0x47d905,_0x24218f){logger[_0xa461('0x9')](_0x47d905,_0x24218f?util[_0xa461('0x7')](_0x24218f,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x1de33e,_0x13e9e6){return client[_0xa461('0xa')](_0x1de33e,{'body':_0x13e9e6})[_0xa461('0xb')](function(_0x25531a){logger[_0xa461('0x8')](_0xa461('0xc'),_0x1de33e,_0x25531a?util[_0xa461('0x7')](_0x25531a,{'showHidden':![],'depth':null}):'');})[_0xa461('0xd')](function(_0x17079a){logger[_0xa461('0x9')](_0xa461('0xc'),_0x1de33e,_0x17079a?util[_0xa461('0x7')](_0x17079a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x23ccd8){return client[_0xa461('0xa')](_0xa461('0xe'),{'options':{'raw':!![],'attributes':['id',_0xa461('0xf'),_0xa461('0x10'),_0xa461('0x11')],'where':_0x23ccd8,'limit':0x1}})['then'](function(_0x21e6e2){logger[_0xa461('0x8')](_0xa461('0x12'),JSON['stringify'](_0x23ccd8),_0x21e6e2?util['inspect'](_0x21e6e2,{'showHidden':![],'depth':null}):'');return _0x21e6e2[_0xa461('0x13')]['length']?_0x21e6e2[_0xa461('0x13')][0x0]:null;});}exports[_0xa461('0x14')]=function(_0x1b00b5){return new BPromise(function(_0x359f82,_0x258655){if(_0x1b00b5){return getUser({'internal':_0x1b00b5})[_0xa461('0xb')](function(_0x4f492a){logger[_0xa461('0x15')](_0xa461('0x16'),_0x1b00b5,_0x4f492a?_0xa461('0x17'):_0xa461('0x18'));return _0x359f82(_0x4f492a);})[_0xa461('0xd')](function(_0x67b0f4){logger[_0xa461('0x9')]('[utils][getUserByInternal]',_0x67b0f4?util['inspect'](_0x67b0f4,{'showHidden':![],'depth':null}):'');return _0x359f82(null);});}return _0x359f82(null);});};exports[_0xa461('0x19')]=function(_0x408ef0){return new BPromise(function(_0x35c125,_0x2f8536){if(_0x408ef0){return getUser({'interface':_0x408ef0})[_0xa461('0xb')](function(_0x2ab62c){logger[_0xa461('0x15')](_0xa461('0x1a'),_0x408ef0,_0x2ab62c?'found':_0xa461('0x18'));return _0x35c125(_0x2ab62c);})[_0xa461('0xd')](function(_0x21198d){logger['error'](_0xa461('0x1b'),_0x21198d?util['inspect'](_0x21198d,{'showHidden':![],'depth':null}):'');return _0x35c125(null);});}return _0x35c125(null);});};exports[_0xa461('0x1c')]=function(_0x2b9b7f){return new BPromise(function(_0x5d2de0,_0x158700){if(_0x2b9b7f){return getUser({'name':_0x2b9b7f})['then'](function(_0x725ed5){logger[_0xa461('0x15')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2b9b7f,_0x725ed5?_0xa461('0x17'):'notfound');return _0x5d2de0(_0x725ed5);})[_0xa461('0xd')](function(_0x34fc6f){logger['error'](_0xa461('0x1d'),_0x34fc6f?util[_0xa461('0x7')](_0x34fc6f,{'showHidden':![],'depth':null}):'');return _0x5d2de0(null);});}return _0x5d2de0(null);});};exports[_0xa461('0x1e')]=function(_0x4aa978){return new BPromise(function(_0x1ad41b,_0x54b256){if(_0x4aa978){return client['request'](_0xa461('0x1f'),{'options':{'raw':!![],'attributes':['id','name','type',_0xa461('0x20'),_0xa461('0x21')],'where':{'name':_0x4aa978},'limit':0x1}})[_0xa461('0xb')](function(_0x462f6c){logger[_0xa461('0x8')](_0xa461('0x22'),_0x4aa978,_0x462f6c?util[_0xa461('0x7')](_0x462f6c,{'showHidden':![],'depth':null}):'');logger[_0xa461('0x15')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aa978,_0x462f6c?'found':_0xa461('0x18'));return _0x1ad41b(_0x462f6c[_0xa461('0x13')][_0xa461('0x23')]?_0x462f6c[_0xa461('0x13')][0x0]:null);})['catch'](function(_0x5aa889){logger['error'](_0xa461('0x24'),_0x5aa889?util[_0xa461('0x7')](_0x5aa889,{'showHidden':![],'depth':null}):'');return _0x1ad41b(null);});}return _0x1ad41b(null);});};exports[_0xa461('0x25')]=function(_0x43c3a0,_0x184ae9){return moment(_0x43c3a0)[_0xa461('0x26')](_0x184ae9,'seconds')[_0xa461('0x27')](_0xa461('0x28'));};exports[_0xa461('0x29')]=function(_0x49239f,_0x5dcc24){return moment(_0x49239f)['subtract'](_0x5dcc24,_0xa461('0x2a'))[_0xa461('0x27')](_0xa461('0x28'));};exports['diffTime']=function(_0x2bde48,_0x2031c7){return moment(_0x2bde48)[_0xa461('0x2b')](moment(_0x2031c7),_0xa461('0x2a'));};exports[_0xa461('0x2c')]=function(_0xd8b00c,_0x1815f9){return parseInt(_0xd8b00c,0xa)+parseInt(_0x1815f9,0xa);};exports[_0xa461('0x2d')]=function(){return moment()[_0xa461('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa461('0x2e')]=function(_0x47e21a,_0x139f8b){if(_0x139f8b){return moment(_0x47e21a)[_0xa461('0x2e')](_0x139f8b);}return!![];};exports['isBefore']=function(_0x430234,_0xa0cb0a){if(_0xa0cb0a){return moment(_0x430234)[_0xa461('0x2f')](_0xa0cb0a);}else if(_0x430234){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 80a05a4..2002494 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 _0x6d37=['agent_id','agent_name','test','setupLoggers','lodash','express-winston','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','name','ensureDir','catch','user','then','no-user','data','timestamp','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','inspect','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method'];(function(_0x14eb9e,_0x29fe9e){var _0x4c59c4=function(_0x13b7a6){while(--_0x13b7a6){_0x14eb9e['push'](_0x14eb9e['shift']());}};_0x4c59c4(++_0x29fe9e);}(_0x6d37,0xe5));var _0x76d3=function(_0x51d309,_0xaccdfb){_0x51d309=_0x51d309-0x0;var _0x5ce1a1=_0x6d37[_0x51d309];return _0x5ce1a1;};var fs=require('fs-extra');var _=require(_0x76d3('0x0'));var ewinston=require(_0x76d3('0x1'));var path=require('path');var util=require(_0x76d3('0x2'));var fileLogger=require(_0x76d3('0x3'))[_0x76d3('0x4')];var safeTemplate=require(_0x76d3('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x76d3('0x6'))[_0x76d3('0x7')];function ClientSideLogger(){function _0x5e1c05(_0xc7a5d5){var _0x4c1db8=path['join'](_0x76d3('0x8'),_0x76d3('0x9'),_0x76d3('0xa'));var _0x2de1ac=path[_0x76d3('0xb')](_0x76d3('0xc'),_0xc7a5d5['role']+'-'+_0xc7a5d5[_0x76d3('0xd')]);return fs[_0x76d3('0xe')](path[_0x76d3('0xb')](_0x4c1db8,_0x2de1ac))['then'](function(){var _0x22f425=fileLogger('client',path[_0x76d3('0xb')](_0x4c1db8,_0x2de1ac));return _0x22f425;})[_0x76d3('0xf')](function(_0xb62951){throw _0xb62951;});}this['log']=function(_0x4e2169,_0x1ce81a,_0x2f5dbb,_0x5cf583){return _0x5e1c05(_0x4e2169[_0x76d3('0x10')])[_0x76d3('0x11')](function(_0x313e73){var _0x1e9228=_0x313e73[_0x1ce81a];return _0x1e9228;})[_0x76d3('0x11')](function(_0x39dbbe){var _0x1a8e50=_0x4e2169[_0x76d3('0x10')]?_0x4e2169['user']['id']:_0x76d3('0x12');var _0x394b2e=_0x5cf583[_0x76d3('0x13')];var _0x26de8a=_0x5cf583[_0x76d3('0x14')];var _0x22570d=new Date(Number(_0x26de8a));return _0x39dbbe(_0x1a8e50,_0x22570d,_0x2f5dbb,_0x394b2e);})[_0x76d3('0xf')](function(_0xd5de05){fileLogger(_0x76d3('0xc'))['error'](_0xd5de05);});};}function setupLoggers(_0x27dfbe){return new Promise(function(_0x26e854){var _0x48f61e=new ClientSideLogger();var _0x755d6a=fileLogger('api');var _0x4c6614=fileLogger('auth');_0x27dfbe[_0x76d3('0x15')](_0x76d3('0x16'),_0x48f61e);_0x27dfbe[_0x76d3('0x17')](ewinston[_0x76d3('0x18')]({'winstonInstance':_0x755d6a,'meta':![],'statusLevels':!![],'msg':function(_0x502397,_0x7a776d){var _0x22a370=_0x76d3('0x19');if(!_[_0x76d3('0x1a')](_0x502397['body'])){_0x22a370+='\x20body=%s';var _0x1de820=_0x502397[_0x76d3('0x1b')];maskSensitiveData(_0x1de820);}return safeTemplate(util[_0x76d3('0x1c')](_0x22a370,_0x502397['method'],_0x502397[_0x76d3('0x1d')]['x-forwarded-for']?_0x502397['headers'][_0x76d3('0x1e')]:_0x502397[_0x76d3('0x1f')][_0x76d3('0x20')]||_0x502397['ip'],_0x502397[_0x76d3('0x21')],_0x7a776d[_0x76d3('0x22')],_0x7a776d[_0x76d3('0x23')],_0x502397[_0x76d3('0x10')]?_0x502397[_0x76d3('0x10')]['id']:null,_0x502397[_0x76d3('0x10')]?_0x502397[_0x76d3('0x10')][_0x76d3('0xd')]:null,_0x502397[_0x76d3('0x10')]?_0x502397[_0x76d3('0x10')][_0x76d3('0x24')]:null,_0x1de820?util[_0x76d3('0x25')](_0x1de820,![],null):''));}}));_0x27dfbe[_0x76d3('0x17')](ewinston[_0x76d3('0x18')]({'winstonInstance':_0x4c6614,'meta':![],'statusLevels':!![],'msg':function(_0x6c7109,_0x19bb8e){var _0x5a0a31='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x6c7109['body']&&_0x6c7109[_0x76d3('0x1b')][_0x76d3('0x26')]&&_0x6c7109[_0x76d3('0x1b')]['agent_id']){_0x5a0a31=_0x76d3('0x27');}return util[_0x76d3('0x1c')](_0x5a0a31,_0x6c7109[_0x76d3('0x28')],_0x6c7109[_0x76d3('0x1d')]['x-forwarded-for']?_0x6c7109[_0x76d3('0x1d')][_0x76d3('0x1e')]:_0x6c7109[_0x76d3('0x1f')][_0x76d3('0x20')]||_0x6c7109['ip'],_0x6c7109[_0x76d3('0x21')],_0x19bb8e[_0x76d3('0x22')],_0x19bb8e['responseTime'],_0x6c7109[_0x76d3('0x10')]?_0x6c7109[_0x76d3('0x10')]['id']:null,_0x6c7109[_0x76d3('0x10')]?_0x6c7109['user'][_0x76d3('0xd')]:null,_0x6c7109[_0x76d3('0x10')]?_0x6c7109[_0x76d3('0x10')]['role']:null,_0x6c7109[_0x76d3('0x1b')]&&_0x6c7109[_0x76d3('0x1b')]['device']?_0x6c7109[_0x76d3('0x1b')][_0x76d3('0x26')]:'other',_0x6c7109[_0x76d3('0x1b')]&&_0x6c7109['body']['agent_id']?_0x6c7109[_0x76d3('0x1b')][_0x76d3('0x29')]:'',_0x6c7109['body']&&_0x6c7109[_0x76d3('0x1b')][_0x76d3('0x2a')]?_0x6c7109['body'][_0x76d3('0x2a')]:'');},'ignoreRoute':function(_0x55d1a4){var _0x1148bd=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1148bd[_0x76d3('0x2b')](_0x55d1a4['url']);}}));return _0x26e854();});}exports[_0x76d3('0x2c')]=setupLoggers; \ No newline at end of file +var _0xdfb2=['client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','statusCode','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','auth','set'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0xdfb2,0x14a));var _0x2dfb=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xdfb2[_0x4243a3];return _0x1b2a33;};var fs=require(_0x2dfb('0x0'));var _=require(_0x2dfb('0x1'));var ewinston=require(_0x2dfb('0x2'));var path=require(_0x2dfb('0x3'));var util=require(_0x2dfb('0x4'));var fileLogger=require(_0x2dfb('0x5'))['fileLogger'];var safeTemplate=require(_0x2dfb('0x6'))[_0x2dfb('0x7')];var maskSensitiveData=require(_0x2dfb('0x8'))[_0x2dfb('0x9')];function ClientSideLogger(){function _0x395e48(_0xd28de7){var _0x5d6d8c=path[_0x2dfb('0xa')](_0x2dfb('0xb'),_0x2dfb('0xc'),_0x2dfb('0xd'));var _0xcd2e27=path[_0x2dfb('0xa')](_0x2dfb('0xe'),_0xd28de7[_0x2dfb('0xf')]+'-'+_0xd28de7[_0x2dfb('0x10')]);return fs[_0x2dfb('0x11')](path[_0x2dfb('0xa')](_0x5d6d8c,_0xcd2e27))[_0x2dfb('0x12')](function(){var _0x2e85ee=fileLogger('client',path[_0x2dfb('0xa')](_0x5d6d8c,_0xcd2e27));return _0x2e85ee;})[_0x2dfb('0x13')](function(_0x515860){throw _0x515860;});}this[_0x2dfb('0xc')]=function(_0x4a6f4b,_0x227114,_0x23d5ac,_0x5b34aa){return _0x395e48(_0x4a6f4b[_0x2dfb('0x14')])[_0x2dfb('0x12')](function(_0x582904){var _0x4861e2=_0x582904[_0x227114];return _0x4861e2;})['then'](function(_0x45b119){var _0x500afd=_0x4a6f4b['user']?_0x4a6f4b[_0x2dfb('0x14')]['id']:_0x2dfb('0x15');var _0x354f3e=_0x5b34aa[_0x2dfb('0x16')];var _0x358e2a=_0x5b34aa[_0x2dfb('0x17')];var _0x41e6eb=new Date(Number(_0x358e2a));return _0x45b119(_0x500afd,_0x41e6eb,_0x23d5ac,_0x354f3e);})[_0x2dfb('0x13')](function(_0x5d110b){fileLogger('client')[_0x2dfb('0x18')](_0x5d110b);});};}function setupLoggers(_0x1bf614){return new Promise(function(_0x47a60f){var _0x403382=new ClientSideLogger();var _0x599fd2=fileLogger('api');var _0x12e59e=fileLogger(_0x2dfb('0x19'));_0x1bf614[_0x2dfb('0x1a')](_0x2dfb('0x1b'),_0x403382);_0x1bf614[_0x2dfb('0x1c')](ewinston[_0x2dfb('0x1d')]({'winstonInstance':_0x599fd2,'meta':![],'statusLevels':!![],'msg':function(_0x21fc67,_0x1601f4){var _0x2070a9=_0x2dfb('0x1e');if(!_[_0x2dfb('0x1f')](_0x21fc67[_0x2dfb('0x20')])){_0x2070a9+=_0x2dfb('0x21');var _0x2a0e5d=_0x21fc67[_0x2dfb('0x20')];maskSensitiveData(_0x2a0e5d);}return safeTemplate(util[_0x2dfb('0x22')](_0x2070a9,_0x21fc67[_0x2dfb('0x23')],_0x21fc67[_0x2dfb('0x24')][_0x2dfb('0x25')]?_0x21fc67[_0x2dfb('0x24')][_0x2dfb('0x25')]:_0x21fc67[_0x2dfb('0x26')][_0x2dfb('0x27')]||_0x21fc67['ip'],_0x21fc67[_0x2dfb('0x28')],_0x1601f4['statusCode'],_0x1601f4[_0x2dfb('0x29')],_0x21fc67[_0x2dfb('0x14')]?_0x21fc67[_0x2dfb('0x14')]['id']:null,_0x21fc67[_0x2dfb('0x14')]?_0x21fc67['user'][_0x2dfb('0x10')]:null,_0x21fc67[_0x2dfb('0x14')]?_0x21fc67[_0x2dfb('0x14')][_0x2dfb('0xf')]:null,_0x2a0e5d?util[_0x2dfb('0x2a')](_0x2a0e5d,![],null):''));}}));_0x1bf614[_0x2dfb('0x1c')](ewinston[_0x2dfb('0x1d')]({'winstonInstance':_0x12e59e,'meta':![],'statusLevels':!![],'msg':function(_0x21e793,_0x33be2c){var _0x23982c=_0x2dfb('0x2b');if(_0x21e793[_0x2dfb('0x20')]&&_0x21e793[_0x2dfb('0x20')]['device']&&_0x21e793[_0x2dfb('0x20')][_0x2dfb('0x2c')]){_0x23982c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x23982c,_0x21e793[_0x2dfb('0x23')],_0x21e793[_0x2dfb('0x24')][_0x2dfb('0x25')]?_0x21e793[_0x2dfb('0x24')][_0x2dfb('0x25')]:_0x21e793[_0x2dfb('0x26')]['remoteAddress']||_0x21e793['ip'],_0x21e793[_0x2dfb('0x28')],_0x33be2c[_0x2dfb('0x2d')],_0x33be2c[_0x2dfb('0x29')],_0x21e793['user']?_0x21e793[_0x2dfb('0x14')]['id']:null,_0x21e793[_0x2dfb('0x14')]?_0x21e793[_0x2dfb('0x14')][_0x2dfb('0x10')]:null,_0x21e793[_0x2dfb('0x14')]?_0x21e793[_0x2dfb('0x14')][_0x2dfb('0xf')]:null,_0x21e793['body']&&_0x21e793[_0x2dfb('0x20')][_0x2dfb('0x2e')]?_0x21e793[_0x2dfb('0x20')][_0x2dfb('0x2e')]:_0x2dfb('0x2f'),_0x21e793[_0x2dfb('0x20')]&&_0x21e793[_0x2dfb('0x20')]['agent_id']?_0x21e793[_0x2dfb('0x20')][_0x2dfb('0x2c')]:'',_0x21e793[_0x2dfb('0x20')]&&_0x21e793[_0x2dfb('0x20')][_0x2dfb('0x30')]?_0x21e793[_0x2dfb('0x20')]['agent_name']:'');},'ignoreRoute':function(_0x5da1a3){var _0x3c63bf=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3c63bf[_0x2dfb('0x31')](_0x5da1a3['url']);}}));return _0x47a60f();});}exports[_0x2dfb('0x32')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e9fb064..cf15921 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1160=['ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','monthCompare','guess','test','split','padStart','length','iftime','lodash','moment-timezone','source','join','Date\x20not\x20valid','isValid','map','locale','toLowerCase','indexOf','slice','concat','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format'];(function(_0x360bfe,_0x498ba2){var _0x556213=function(_0x39b31f){while(--_0x39b31f){_0x360bfe['push'](_0x360bfe['shift']());}};_0x556213(++_0x498ba2);}(_0x1160,0xdd));var _0x0116=function(_0x4f66c2,_0x47d4ed){_0x4f66c2=_0x4f66c2-0x0;var _0x447633=_0x1160[_0x4f66c2];return _0x447633;};var _=require(_0x0116('0x0'));var moment=require(_0x0116('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x128a58){return _0x128a58[_0x0116('0x2')];})[_0x0116('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x0116('0x4');function throwIfDateNotValid(_0x133667){if(!_0x133667[_0x0116('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4e70f4){var _0x212b5c=_0x4e70f4['split'](':')[_0x0116('0x6')](function(_0x16d21c){return parseInt(_0x16d21c,0xa);});var _0x3fd411=_0x212b5c[0x0];var _0x23c88b=_0x212b5c[0x1];if(_0x3fd411<0x0||_0x3fd411>0x17||_0x23c88b<0x0||_0x23c88b>0x3b){throw new Error(EINVALID_DATE);}return[_0x3fd411,_0x23c88b];}function circularDoWInterval(_0xac668d,_0x227a84){if(_0xac668d===_0x227a84){return[_0xac668d];}else{var _0x444e3b=moment[_0x0116('0x7')]();moment[_0x0116('0x7')]('en');var _0x2d8103=moment['weekdaysShort']()[_0x0116('0x6')](function(_0x2dedae){return _0x2dedae[_0x0116('0x8')]();});moment['locale'](_0x444e3b);var _0x67e907=_0x2d8103[_0x0116('0x9')](_0xac668d);var _0x9aabad=_0x2d8103[_0x0116('0x9')](_0x227a84);if(_0x9aabad>_0x67e907){return _0x2d8103[_0x0116('0xa')](_0x67e907,_0x9aabad+0x1);}else{var _0x186c15=_0x2d8103[_0x0116('0xa')](0x0,_0x9aabad+0x1);var _0x150ecf=_0x2d8103[_0x0116('0xa')](_0x67e907);return _0x150ecf[_0x0116('0xb')](_0x186c15);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x389ce5,_0x208365){if(_0x389ce5===_0x208365){return[_0x389ce5];}else{var _0x57f325=moment['locale']();moment[_0x0116('0x7')]('en');var _0x4e351e=moment[_0x0116('0xc')]()[_0x0116('0x6')](function(_0x49b6){return _0x49b6['toLowerCase']();});moment[_0x0116('0x7')](_0x57f325);var _0xf5458e=_0x4e351e['indexOf'](_0x389ce5);var _0x17ef46=_0x4e351e[_0x0116('0x9')](_0x208365);if(_0x17ef46>_0xf5458e){return _0x4e351e[_0x0116('0xa')](_0xf5458e,_0x17ef46+0x1);}else{var _0x488e78=_0x4e351e[_0x0116('0xa')](0x0,_0x17ef46+0x1);var _0x5e40b7=_0x4e351e[_0x0116('0xa')](_0xf5458e);return _0x5e40b7['concat'](_0x488e78);}}}module[_0x0116('0xd')][_0x0116('0xe')]=circularMonthInterval;function parseDom(_0x422017){var _0x58cff2=parseInt(_0x422017,0xa);if(_0x58cff2<0x1||_0x58cff2>0x1f){throw new Error(EINVALID_DATE);}return _0x58cff2;}function timeCompare(_0x151678,_0xcec695,_0x1cbc78){var _0x68c0de=_0x151678[_0x0116('0xf')]();var _0x547d84=extractTime(_0xcec695);var _0x1ffdd3=_0x547d84[0x0];var _0x397931=_0x547d84[0x1];var _0x56c4ba=_0x151678[_0x0116('0xf')]()[_0x0116('0x10')](_0x1ffdd3)[_0x0116('0x11')](_0x397931);throwIfDateNotValid(_0x56c4ba);var _0x56602d=extractTime(_0x1cbc78);var _0x38527d=_0x56602d[0x0];var _0x26eb0b=_0x56602d[0x1];var _0x311a44=_0x151678['clone']()[_0x0116('0x10')](_0x38527d)[_0x0116('0x11')](_0x26eb0b);throwIfDateNotValid(_0x311a44);if(_0x311a44[_0x0116('0x12')](_0x56c4ba)){var _0x3e4d5c=_0x68c0de[_0x0116('0xf')]()[_0x0116('0x13')](_0x0116('0x14'));var _0x370bd4=_0x68c0de[_0x0116('0xf')]()[_0x0116('0x15')]('day');return _0x68c0de[_0x0116('0x16')](_0x56c4ba,_0x370bd4,undefined,'[]')||_0x68c0de[_0x0116('0x16')](_0x3e4d5c,_0x311a44,undefined,'[]');}else{return _0x68c0de[_0x0116('0x16')](_0x56c4ba,_0x311a44,undefined,'[]');}}module[_0x0116('0xd')][_0x0116('0x17')]=timeCompare;function dowCompare(_0x2bad16,_0xaa91b9,_0x34e4b3){var _0x4d5c95=_0x2bad16['locale']('en')[_0x0116('0x18')](_0x0116('0x19'))[_0x0116('0x8')]();return circularDoWInterval(_0xaa91b9,_0x34e4b3)[_0x0116('0x1a')](_0x4d5c95);}module[_0x0116('0xd')][_0x0116('0x1b')]=dowCompare;function domCompare(_0x233240,_0x5a84b6,_0x1a77ca){var _0x46b595=_0x233240[_0x0116('0x1c')]();if(_0x5a84b6===_0x1a77ca){return _0x46b595===_0x5a84b6;}else{var _0x2521f0=_0x233240[_0x0116('0x1d')]();var _0x2f7875=_0x5a84b6<_0x1a77ca;let _0x575797=![];var _0x32360d=0x0;var _0x3eb314=0x0;if(_0x2f7875){_0x32360d=Math['max'](0x1,_0x5a84b6);_0x3eb314=Math[_0x0116('0x1e')](_0x1a77ca,_0x2521f0);_0x575797=_0x46b595>=_0x32360d&&_0x46b595<=_0x3eb314;}else{_0x32360d=Math[_0x0116('0x1e')](_0x5a84b6,_0x2521f0);_0x3eb314=Math[_0x0116('0x1f')](0x1,_0x1a77ca);_0x575797=_0x46b595>=_0x32360d||_0x46b595<=_0x3eb314;}return _0x575797;}}module[_0x0116('0xd')][_0x0116('0x20')]=domCompare;function monthCompare(_0x5da2c0,_0x5b1000,_0x3e6c46){var _0x1fefe6=_0x5da2c0[_0x0116('0x7')]('en')[_0x0116('0x18')](_0x0116('0x21'))['toLowerCase']();return circularMonthInterval(_0x5b1000,_0x3e6c46)[_0x0116('0x1a')](_0x1fefe6);}module['exports'][_0x0116('0x22')]=monthCompare;function iftime(_0x277f12,_0x2a13cd=moment['tz'][_0x0116('0x23')](),_0x1cbcfb=moment()){if(!validateRx[_0x0116('0x24')](_0x277f12)){throw new Error(EINVALID_STRING);}else{var _0x5e30c4=(moment['isMoment'](_0x1cbcfb)?_0x1cbcfb[_0x0116('0xf')]():moment(_0x1cbcfb))['tz'](_0x2a13cd)[_0x0116('0x7')]('en');throwIfDateNotValid(_0x5e30c4);var _0x39f8e1=_0x277f12[_0x0116('0x25')](',');var _0x2ec417=_0x39f8e1[0x0];var _0x357852=_0x39f8e1[0x1];var _0x46a1f7=_0x39f8e1[0x2];var _0xd4d6da=_0x39f8e1[0x3];let _0x5eccae=!![];if(_0x2ec417!=='*'){var _0x23f5bb=_0x2ec417[_0x0116('0x25')]('-');var _0x1d7700=_[_0x0116('0x26')](_0x23f5bb[0x0],0x5,'0');var _0x43f0b0=_0x23f5bb[_0x0116('0x27')]===0x2?_['padStart'](_0x23f5bb[0x1],0x5,'0'):_0x1d7700;_0x5eccae=timeCompare(_0x5e30c4,_0x1d7700,_0x43f0b0);}let _0x544925=!![];if(_0x357852!=='*'){var _0x4fc496=_0x357852[_0x0116('0x25')]('-');var _0x588ad3=_0x4fc496[0x0];var _0x2c8e3b=_0x4fc496['length']===0x2?_0x4fc496[0x1]:_0x588ad3;_0x544925=dowCompare(_0x5e30c4,_0x588ad3,_0x2c8e3b);}let _0x43b2fa=!![];if(_0x46a1f7!=='*'){var _0x3ca198=_0x46a1f7[_0x0116('0x25')]('-');var _0xcfc788=parseDom(_0x3ca198[0x0]);var _0x1f63a4=_0x3ca198['length']===0x2?parseDom(_0x3ca198[0x1]):_0xcfc788;_0x43b2fa=domCompare(_0x5e30c4,_0xcfc788,_0x1f63a4);}let _0x3d0560=!![];if(_0xd4d6da!=='*'){var _0x1c60a0=_0xd4d6da[_0x0116('0x25')]('-');var _0x126009=_0x1c60a0[0x0];var _0x4c3b97=_0x1c60a0[_0x0116('0x27')]===0x2?_0x1c60a0[0x1]:_0x1c60a0[0x0];_0x3d0560=monthCompare(_0x5e30c4,_0x126009,_0x4c3b97);}return _0x5eccae&&_0x544925&&_0x43b2fa&&_0x3d0560;}}module[_0x0116('0xd')][_0x0116('0x28')]=iftime; \ No newline at end of file +var _0xa272=['map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','daysInMonth','min','max','MMM','includes','monthCompare','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','source','Date\x20not\x20valid','isValid'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xa272,0x16d));var _0x2a27=function(_0x52d1b0,_0xd7f945){_0x52d1b0=_0x52d1b0-0x0;var _0x2326b0=_0xa272[_0x52d1b0];return _0x2326b0;};var _=require(_0x2a27('0x0'));var moment=require(_0x2a27('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x311d68){return _0x311d68[_0x2a27('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x2a27('0x3');function throwIfDateNotValid(_0x4e5853){if(!_0x4e5853[_0x2a27('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x12f8c6){var _0x4fabe6=_0x12f8c6['split'](':')[_0x2a27('0x5')](function(_0x357f77){return parseInt(_0x357f77,0xa);});var _0x14285b=_0x4fabe6[0x0];var _0x79e25e=_0x4fabe6[0x1];if(_0x14285b<0x0||_0x14285b>0x17||_0x79e25e<0x0||_0x79e25e>0x3b){throw new Error(EINVALID_DATE);}return[_0x14285b,_0x79e25e];}function circularDoWInterval(_0x37d343,_0xd8697f){if(_0x37d343===_0xd8697f){return[_0x37d343];}else{var _0x205421=moment['locale']();moment[_0x2a27('0x6')]('en');var _0xf3ece4=moment[_0x2a27('0x7')]()[_0x2a27('0x5')](function(_0xa913f){return _0xa913f[_0x2a27('0x8')]();});moment[_0x2a27('0x6')](_0x205421);var _0x3eb49b=_0xf3ece4[_0x2a27('0x9')](_0x37d343);var _0x4bbb0c=_0xf3ece4[_0x2a27('0x9')](_0xd8697f);if(_0x4bbb0c>_0x3eb49b){return _0xf3ece4[_0x2a27('0xa')](_0x3eb49b,_0x4bbb0c+0x1);}else{var _0x5d8518=_0xf3ece4[_0x2a27('0xa')](0x0,_0x4bbb0c+0x1);var _0x520960=_0xf3ece4['slice'](_0x3eb49b);return _0x520960[_0x2a27('0xb')](_0x5d8518);}}}module[_0x2a27('0xc')][_0x2a27('0xd')]=circularDoWInterval;function circularMonthInterval(_0x5ab53d,_0x363e83){if(_0x5ab53d===_0x363e83){return[_0x5ab53d];}else{var _0x11b1b6=moment[_0x2a27('0x6')]();moment['locale']('en');var _0x364e32=moment[_0x2a27('0xe')]()['map'](function(_0x224c71){return _0x224c71['toLowerCase']();});moment[_0x2a27('0x6')](_0x11b1b6);var _0x275454=_0x364e32[_0x2a27('0x9')](_0x5ab53d);var _0x1d07f6=_0x364e32[_0x2a27('0x9')](_0x363e83);if(_0x1d07f6>_0x275454){return _0x364e32[_0x2a27('0xa')](_0x275454,_0x1d07f6+0x1);}else{var _0x11c594=_0x364e32[_0x2a27('0xa')](0x0,_0x1d07f6+0x1);var _0x14659a=_0x364e32[_0x2a27('0xa')](_0x275454);return _0x14659a[_0x2a27('0xb')](_0x11c594);}}}module[_0x2a27('0xc')][_0x2a27('0xf')]=circularMonthInterval;function parseDom(_0xcd63ce){var _0x26a711=parseInt(_0xcd63ce,0xa);if(_0x26a711<0x1||_0x26a711>0x1f){throw new Error(EINVALID_DATE);}return _0x26a711;}function timeCompare(_0x202fcb,_0x353e68,_0x659d08){var _0x351218=_0x202fcb[_0x2a27('0x10')]();var _0x1b5a85=extractTime(_0x353e68);var _0x140b36=_0x1b5a85[0x0];var _0x222fcd=_0x1b5a85[0x1];var _0x488a63=_0x202fcb[_0x2a27('0x10')]()['hours'](_0x140b36)[_0x2a27('0x11')](_0x222fcd);throwIfDateNotValid(_0x488a63);var _0x553eba=extractTime(_0x659d08);var _0x16bf0b=_0x553eba[0x0];var _0x1c6477=_0x553eba[0x1];var _0xac8763=_0x202fcb[_0x2a27('0x10')]()['hours'](_0x16bf0b)[_0x2a27('0x11')](_0x1c6477);throwIfDateNotValid(_0xac8763);if(_0xac8763[_0x2a27('0x12')](_0x488a63)){var _0x129da3=_0x351218[_0x2a27('0x10')]()[_0x2a27('0x13')](_0x2a27('0x14'));var _0x34923c=_0x351218[_0x2a27('0x10')]()['endOf']('day');return _0x351218[_0x2a27('0x15')](_0x488a63,_0x34923c,undefined,'[]')||_0x351218[_0x2a27('0x15')](_0x129da3,_0xac8763,undefined,'[]');}else{return _0x351218[_0x2a27('0x15')](_0x488a63,_0xac8763,undefined,'[]');}}module[_0x2a27('0xc')][_0x2a27('0x16')]=timeCompare;function dowCompare(_0x4da37c,_0x153038,_0x59f7a2){var _0x4dd74e=_0x4da37c['locale']('en')[_0x2a27('0x17')](_0x2a27('0x18'))[_0x2a27('0x8')]();return circularDoWInterval(_0x153038,_0x59f7a2)['includes'](_0x4dd74e);}module[_0x2a27('0xc')]['dowCompare']=dowCompare;function domCompare(_0xc7a615,_0x151b6b,_0x5bd716){var _0x1e570d=_0xc7a615['date']();if(_0x151b6b===_0x5bd716){return _0x1e570d===_0x151b6b;}else{var _0x46e6d6=_0xc7a615[_0x2a27('0x19')]();var _0x20edf=_0x151b6b<_0x5bd716;let _0x59ef35=![];var _0x21beff=0x0;var _0x451e05=0x0;if(_0x20edf){_0x21beff=Math['max'](0x1,_0x151b6b);_0x451e05=Math[_0x2a27('0x1a')](_0x5bd716,_0x46e6d6);_0x59ef35=_0x1e570d>=_0x21beff&&_0x1e570d<=_0x451e05;}else{_0x21beff=Math[_0x2a27('0x1a')](_0x151b6b,_0x46e6d6);_0x451e05=Math[_0x2a27('0x1b')](0x1,_0x5bd716);_0x59ef35=_0x1e570d>=_0x21beff||_0x1e570d<=_0x451e05;}return _0x59ef35;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x1aa7d9,_0x3d87a8,_0x6c0d77){var _0x312d1d=_0x1aa7d9[_0x2a27('0x6')]('en')[_0x2a27('0x17')](_0x2a27('0x1c'))[_0x2a27('0x8')]();return circularMonthInterval(_0x3d87a8,_0x6c0d77)[_0x2a27('0x1d')](_0x312d1d);}module[_0x2a27('0xc')][_0x2a27('0x1e')]=monthCompare;function iftime(_0x274128,_0x2f458d=moment['tz']['guess'](),_0x20c13a=moment()){if(!validateRx[_0x2a27('0x1f')](_0x274128)){throw new Error(EINVALID_STRING);}else{var _0x20636a=(moment[_0x2a27('0x20')](_0x20c13a)?_0x20c13a[_0x2a27('0x10')]():moment(_0x20c13a))['tz'](_0x2f458d)[_0x2a27('0x6')]('en');throwIfDateNotValid(_0x20636a);var _0x270a02=_0x274128[_0x2a27('0x21')](',');var _0x38e907=_0x270a02[0x0];var _0x4b1604=_0x270a02[0x1];var _0x23115d=_0x270a02[0x2];var _0x1b8eed=_0x270a02[0x3];let _0x4f39f5=!![];if(_0x38e907!=='*'){var _0x5b49b4=_0x38e907[_0x2a27('0x21')]('-');var _0x3bce11=_[_0x2a27('0x22')](_0x5b49b4[0x0],0x5,'0');var _0x3c8403=_0x5b49b4[_0x2a27('0x23')]===0x2?_[_0x2a27('0x22')](_0x5b49b4[0x1],0x5,'0'):_0x3bce11;_0x4f39f5=timeCompare(_0x20636a,_0x3bce11,_0x3c8403);}let _0x21f563=!![];if(_0x4b1604!=='*'){var _0x3fd962=_0x4b1604[_0x2a27('0x21')]('-');var _0x598337=_0x3fd962[0x0];var _0x19ae1a=_0x3fd962[_0x2a27('0x23')]===0x2?_0x3fd962[0x1]:_0x598337;_0x21f563=dowCompare(_0x20636a,_0x598337,_0x19ae1a);}let _0x500526=!![];if(_0x23115d!=='*'){var _0x4d7210=_0x23115d[_0x2a27('0x21')]('-');var _0xa7ae4a=parseDom(_0x4d7210[0x0]);var _0x5116c4=_0x4d7210[_0x2a27('0x23')]===0x2?parseDom(_0x4d7210[0x1]):_0xa7ae4a;_0x500526=domCompare(_0x20636a,_0xa7ae4a,_0x5116c4);}let _0x5bdd80=!![];if(_0x1b8eed!=='*'){var _0x4d63bc=_0x1b8eed[_0x2a27('0x21')]('-');var _0x5c1c23=_0x4d63bc[0x0];var _0x13f73=_0x4d63bc[_0x2a27('0x23')]===0x2?_0x4d63bc[0x1]:_0x4d63bc[0x0];_0x5bdd80=monthCompare(_0x20636a,_0x5c1c23,_0x13f73);}return _0x4f39f5&&_0x21f563&&_0x500526&&_0x5bdd80;}}module['exports'][_0x2a27('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 34b35b3..c4167f5 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a54=['redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','path','util','moment','winston','debugLevel','info'];(function(_0x448e8d,_0x43a056){var _0x46e774=function(_0x22f0be){while(--_0x22f0be){_0x448e8d['push'](_0x448e8d['shift']());}};_0x46e774(++_0x43a056);}(_0x1a54,0x19c));var _0x41a5=function(_0x4fe6ac,_0xd43fc){_0x4fe6ac=_0x4fe6ac-0x0;var _0x17631c=_0x1a54[_0x4fe6ac];return _0x17631c;};'use strict';var path=require(_0x41a5('0x0'));var util=require(_0x41a5('0x1'));var moment=require(_0x41a5('0x2'));var winston=require(_0x41a5('0x3'));var config=require('../config/environment');var debugLevel=config[_0x41a5('0x4')]?config[_0x41a5('0x4')]['toLowerCase']():_0x41a5('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x41a5('0x6'),'error':_0x41a5('0x7'),'warn':_0x41a5('0x8'),'info':_0x41a5('0x9'),'print':_0x41a5('0xa'),'success':_0x41a5('0xb'),'http':_0x41a5('0xc'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x41a5('0xd')};winston[_0x41a5('0xe')](XC_LOG_COLORS);function getLogFileName(_0x2d69c7,_0x10676a,_0x1acb1a){var _0x27e3bd=_0x2d69c7||_0x41a5('0xf');return path[_0x41a5('0x10')](_0x27e3bd,util['format'](_0x41a5('0x11'),_0x10676a,_0x1acb1a));}function formatter(_0x469d37,_0x1c8a7f){_0x1c8a7f[_0x41a5('0x12')]=_0x1c8a7f[_0x41a5('0x12')][_0x41a5('0x13')](/@@{/g,_0x41a5('0x14'))[_0x41a5('0x13')](/}@@/g,_0x41a5('0x15'))[_0x41a5('0x13')](/@{/g,'{{')[_0x41a5('0x13')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x41a5('0x16')](_0x41a5('0x17')),_0x1c8a7f[_0x41a5('0x18')][_0x41a5('0x19')](),_0x469d37,_0x1c8a7f[_0x41a5('0x12')]);}function fileFormat(_0x3fdc04,_0xabfe1e){_0xabfe1e[_0x41a5('0x12')]=_0xabfe1e['message'][_0x41a5('0x13')](/@@{/g,_0x41a5('0x14'))['replace'](/}@@/g,_0x41a5('0x15'))[_0x41a5('0x13')](/@{/g,'{{')[_0x41a5('0x13')](/}@/g,'}}');var _0x1fac40=_0xabfe1e[_0x41a5('0x1a')]&&Object[_0x41a5('0x1b')](_0xabfe1e[_0x41a5('0x1a')])[_0x41a5('0x1c')]?'\x0a\x09'+JSON['stringify'](_0xabfe1e[_0x41a5('0x1a')]):'';return util['format'](_0x41a5('0x1d'),moment()[_0x41a5('0x16')](_0x41a5('0x17')),_0xabfe1e[_0x41a5('0x18')][_0x41a5('0x19')](),_0x3fdc04,_0xabfe1e[_0x41a5('0x12')],_0x1fac40);}function consoleLogger(){var _0x34a4de=new winston[(_0x41a5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x41a5('0x1f'))][(_0x41a5('0x20'))]({'level':'warn','json':![],'formatter':function(_0x340cfa){return formatter('',_0x340cfa);}})]});return _0x34a4de;}function fileLogger(_0x3bec63,_0x26ef50){var _0x139f1c=new winston[(_0x41a5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x41a5('0x21'))]({'name':util[_0x41a5('0x16')](_0x41a5('0x22'),_0x3bec63,'error'),'filename':getLogFileName(_0x26ef50,_0x3bec63,_0x41a5('0x23')),'level':_0x41a5('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a411c){return fileFormat(_0x3bec63,_0x1a411c);}}),new winston['transports'][(_0x41a5('0x21'))]({'name':util[_0x41a5('0x16')](_0x41a5('0x22'),_0x3bec63,debugLevel),'filename':getLogFileName(_0x26ef50,_0x3bec63,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xad4c9d){return fileFormat(_0x3bec63,_0xad4c9d);}}),new winston[(_0x41a5('0x1f'))][(_0x41a5('0x20'))]({'level':_0x41a5('0x24'),'json':![],'formatter':function(_0x8ae9d5){return fileFormat(_0x3bec63,_0x8ae9d5);}})]});return _0x139f1c;}exports[_0x41a5('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xfb5a=['meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','warn','File','%s-%s','error','Console','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20blue','addColors','/var/log/xcally','join','%s-%s.log','message','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','}}}'];(function(_0x2aac18,_0x517186){var _0x474ae3=function(_0x2fe31b){while(--_0x2fe31b){_0x2aac18['push'](_0x2aac18['shift']());}};_0x474ae3(++_0x517186);}(_0xfb5a,0x7f));var _0xafb5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfb5a[_0x5b644e];return _0x49c6bf;};'use strict';var path=require(_0xafb5('0x0'));var util=require(_0xafb5('0x1'));var moment=require(_0xafb5('0x2'));var winston=require('winston');var config=require(_0xafb5('0x3'));var debugLevel=config[_0xafb5('0x4')]?config[_0xafb5('0x4')][_0xafb5('0x5')]():_0xafb5('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':'red','warn':_0xafb5('0x7'),'info':_0xafb5('0x8'),'print':_0xafb5('0x9'),'success':_0xafb5('0xa'),'http':_0xafb5('0xb'),'verbose':'bold\x20magenta','debug':_0xafb5('0xc'),'silly':'bold\x20cyan'};winston[_0xafb5('0xd')](XC_LOG_COLORS);function getLogFileName(_0x5acaf5,_0x514d97,_0x47e664){var _0x5362ee=_0x5acaf5||_0xafb5('0xe');return path[_0xafb5('0xf')](_0x5362ee,util['format'](_0xafb5('0x10'),_0x514d97,_0x47e664));}function formatter(_0x24b3a7,_0x51ebb5){_0x51ebb5[_0xafb5('0x11')]=_0x51ebb5[_0xafb5('0x11')]['replace'](/@@{/g,_0xafb5('0x12'))[_0xafb5('0x13')](/}@@/g,'}}}')[_0xafb5('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xafb5('0x14')](_0xafb5('0x15'),moment()[_0xafb5('0x14')](_0xafb5('0x16')),_0x51ebb5['level'][_0xafb5('0x17')](),_0x24b3a7,_0x51ebb5[_0xafb5('0x11')]);}function fileFormat(_0x495db7,_0xd62561){_0xd62561['message']=_0xd62561['message'][_0xafb5('0x13')](/@@{/g,_0xafb5('0x12'))[_0xafb5('0x13')](/}@@/g,_0xafb5('0x18'))[_0xafb5('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5511c8=_0xd62561[_0xafb5('0x19')]&&Object['keys'](_0xd62561['meta'])[_0xafb5('0x1a')]?'\x0a\x09'+JSON[_0xafb5('0x1b')](_0xd62561['meta']):'';return util['format'](_0xafb5('0x1c'),moment()[_0xafb5('0x14')](_0xafb5('0x16')),_0xd62561[_0xafb5('0x1d')]['toUpperCase'](),_0x495db7,_0xd62561['message'],_0x5511c8);}function consoleLogger(){var _0x3f0ad3=new winston[(_0xafb5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xafb5('0x1f'))]['Console']({'level':_0xafb5('0x20'),'json':![],'formatter':function(_0x3efb90){return formatter('',_0x3efb90);}})]});return _0x3f0ad3;}function fileLogger(_0x1fe9f8,_0x5243d9){var _0x3ea4c0=new winston[(_0xafb5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xafb5('0x1f'))][(_0xafb5('0x21'))]({'name':util[_0xafb5('0x14')](_0xafb5('0x22'),_0x1fe9f8,'error'),'filename':getLogFileName(_0x5243d9,_0x1fe9f8,_0xafb5('0x23')),'level':_0xafb5('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2360fd){return fileFormat(_0x1fe9f8,_0x2360fd);}}),new winston[(_0xafb5('0x1f'))][(_0xafb5('0x21'))]({'name':util[_0xafb5('0x14')]('%s-%s',_0x1fe9f8,debugLevel),'filename':getLogFileName(_0x5243d9,_0x1fe9f8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xcb5f9b){return fileFormat(_0x1fe9f8,_0xcb5f9b);}}),new winston[(_0xafb5('0x1f'))][(_0xafb5('0x24'))]({'level':_0xafb5('0x20'),'json':![],'formatter':function(_0x3384a4){return fileFormat(_0x1fe9f8,_0x3384a4);}})]});return _0x3ea4c0;}exports['consoleLogger']=consoleLogger;exports[_0xafb5('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 572af8f..9232b54 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 _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x453e38,_0x48864b){var _0x75894e=function(_0x1af443){while(--_0x1af443){_0x453e38['push'](_0x453e38['shift']());}};_0x75894e(++_0x48864b);}(_0x2ef3,0xba));var _0x32ef=function(_0xdb1044,_0x96dcb2){_0xdb1044=_0xdb1044-0x0;var _0xcc9956=_0x2ef3[_0xdb1044];return _0xcc9956;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x0295,0x1f0));var _0x5029=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0x0295[_0x260073];return _0x4ff033;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 333d25b..6d30055 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['\x5c$&','replace'];(function(_0x423505,_0x445c4e){var _0x16b240=function(_0x51fba8){while(--_0x51fba8){_0x423505['push'](_0x423505['shift']());}};_0x16b240(++_0x445c4e);}(_0xadb5,0xad));var _0x5adb=function(_0x7c6623,_0x58b238){_0x7c6623=_0x7c6623-0x0;var _0x176375=_0xadb5[_0x7c6623];return _0x176375;};module['exports']={'escapeRegExp'(_0x2e4c9a,_0x49fc17=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x2e4c9a[_0x5adb('0x0')](_0x49fc17,_0x5adb('0x1'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x16aa70,_0x5b1f73){var _0x11875f=function(_0x18c7be){while(--_0x18c7be){_0x16aa70['push'](_0x16aa70['shift']());}};_0x11875f(++_0x5b1f73);}(_0x5fab,0x177));var _0xb5fa=function(_0x30da2e,_0x146e54){_0x30da2e=_0x30da2e-0x0;var _0x794139=_0x5fab[_0x30da2e];return _0x794139;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 309bc7a..7ffcaef 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 _0x36ee=['replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','string'];(function(_0x217af7,_0x3d1c86){var _0x33117e=function(_0x1d204d){while(--_0x1d204d){_0x217af7['push'](_0x217af7['shift']());}};_0x33117e(++_0x3d1c86);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4889d8){return _0x4889d8==='{{'?_0xe36e('0x0'):'\x20}\x20}';}function safeTemplate(_0xf6b517){var _0x4018bf=_0xf6b517;if(typeof _0xf6b517===_0xe36e('0x1')){_0x4018bf=_0xf6b517[_0xe36e('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe36e('0x3')](_0xf6b517)){_0x4018bf=_0xf6b517[_0xe36e('0x4')](function(_0x29e692){return safeTemplate(_0x29e692);});}else if(_[_0xe36e('0x5')](_0xf6b517)){_0x4018bf=Object[_0xe36e('0x6')](_0xf6b517)[_0xe36e('0x7')](function(_0x21be0b,_0x1aa596){_0x21be0b[_0x1aa596]=safeTemplate(_0xf6b517[_0x1aa596]);return _0x21be0b;},{});}return _0x4018bf;}module['exports'][_0xe36e('0x8')]=safeTemplate; \ No newline at end of file +var _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x150c38,_0x58409f){var _0x1c5e26=function(_0x17271a){while(--_0x17271a){_0x150c38['push'](_0x150c38['shift']());}};_0x1c5e26(++_0x58409f);}(_0x7708,0x188));var _0x8770=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x7708[_0x3e8cae];return _0x45c4d6;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 9ef04fb..75a2c89 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 _0xdc51=['then','readJSON','updated','info','Updating\x20app.json','exports','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists'];(function(_0x3c690f,_0x5ae651){var _0x347381=function(_0x33046f){while(--_0x33046f){_0x3c690f['push'](_0x3c690f['shift']());}};_0x347381(++_0x5ae651);}(_0xdc51,0x6a));var _0x1dc5=function(_0x23983a,_0x38947d){_0x23983a=_0x23983a-0x0;var _0x127ff1=_0xdc51[_0x23983a];return _0x127ff1;};var fs=require('fs-extra');var path=require(_0x1dc5('0x0'));var config=require(_0x1dc5('0x1'));var root=config[_0x1dc5('0x2')];var APP_JSON_PATH=path[_0x1dc5('0x3')](root,_0x1dc5('0x4'));var NODEPATH=path[_0x1dc5('0x3')](root,_0x1dc5('0x5'));function setLegacyLibsNodeEnvPath(_0x4045ce){let _0x50d2fa=![];if(Array[_0x1dc5('0x6')](_0x4045ce[_0x1dc5('0x7')])){var _0x19ea7a=_0x4045ce[_0x1dc5('0x7')][_0x1dc5('0x8')](function(_0x1a60a6){return _0x1a60a6[_0x1dc5('0x9')]===_0x1dc5('0xa');});if(_0x19ea7a>-0x1){var _0x1bf18e=_0x4045ce['apps'][_0x19ea7a];if(typeof _0x1bf18e[_0x1dc5('0xb')][_0x1dc5('0xc')]!=='string'){_0x1bf18e[_0x1dc5('0xb')][_0x1dc5('0xc')]=NODEPATH;_0x50d2fa=!![];}}return{'appConfig':_0x4045ce,'updated':_0x50d2fa};}}function updateAppConfig(_0x59020b){return fs[_0x1dc5('0xd')](APP_JSON_PATH)[_0x1dc5('0xe')](function(_0x5c49b1){if(_0x5c49b1){return fs[_0x1dc5('0xf')](APP_JSON_PATH)['then'](function(_0x4d84f9){var _0x2902a2=setLegacyLibsNodeEnvPath(_0x4d84f9);if(_0x2902a2[_0x1dc5('0x10')]){_0x59020b[_0x1dc5('0x11')](_0x1dc5('0x12'));return fs['writeJSON'](APP_JSON_PATH,_0x4d84f9,{'spaces':0x2});}else{return Promise[_0x1dc5('0x3')]();}});}else{return Promise[_0x1dc5('0x3')]();}});}module[_0x1dc5('0x13')]=updateAppConfig; \ No newline at end of file +var _0x22ae=['fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','then','info','exports'];(function(_0x1f87a3,_0x2ddc84){var _0x572824=function(_0x5bf9b3){while(--_0x5bf9b3){_0x1f87a3['push'](_0x1f87a3['shift']());}};_0x572824(++_0x2ddc84);}(_0x22ae,0x198));var _0xe22a=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x22ae[_0x289891];return _0x31cf2e;};var fs=require(_0xe22a('0x0'));var path=require(_0xe22a('0x1'));var config=require(_0xe22a('0x2'));var root=config[_0xe22a('0x3')];var APP_JSON_PATH=path[_0xe22a('0x4')](root,_0xe22a('0x5'));var NODEPATH=path[_0xe22a('0x4')](root,_0xe22a('0x6'));function setLegacyLibsNodeEnvPath(_0xf64f39){let _0x1b588d=![];if(Array['isArray'](_0xf64f39[_0xe22a('0x7')])){var _0x1ff054=_0xf64f39[_0xe22a('0x7')][_0xe22a('0x8')](function(_0x2ebe1c){return _0x2ebe1c[_0xe22a('0x9')]===_0xe22a('0xa');});if(_0x1ff054>-0x1){var _0x334476=_0xf64f39['apps'][_0x1ff054];if(typeof _0x334476[_0xe22a('0xb')]['NODE_PATH']!=='string'){_0x334476[_0xe22a('0xb')][_0xe22a('0xc')]=NODEPATH;_0x1b588d=!![];}}return{'appConfig':_0xf64f39,'updated':_0x1b588d};}}function updateAppConfig(_0x45c4f1){return fs[_0xe22a('0xd')](APP_JSON_PATH)[_0xe22a('0xe')](function(_0x453424){if(_0x453424){return fs['readJSON'](APP_JSON_PATH)[_0xe22a('0xe')](function(_0xcc0db0){var _0x3e472b=setLegacyLibsNodeEnvPath(_0xcc0db0);if(_0x3e472b['updated']){_0x45c4f1[_0xe22a('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0xcc0db0,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe22a('0x4')]();}});}module[_0xe22a('0x10')]=updateAppConfig; \ No newline at end of file